mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-26 12:35:35 +02:00
feat(sdk): collect device metadata during verify handshake
Auto-collect navigator.userAgent, platform, and language in the SDK verify RPC payload. Add DeviceMeta type. Hub receives this metadata for display in the Desktop UI device list and confirmation dialog. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -25,6 +25,7 @@ export {
|
||||
type DeleteAgentResult,
|
||||
type UpdateGatewayParams,
|
||||
type UpdateGatewayResult,
|
||||
type DeviceMeta,
|
||||
type VerifyParams,
|
||||
type VerifyResult,
|
||||
} from "./rpc";
|
||||
|
||||
@@ -146,9 +146,17 @@ export interface UpdateGatewayResult {
|
||||
connectionState: string;
|
||||
}
|
||||
|
||||
/** Device metadata collected during verify handshake */
|
||||
export interface DeviceMeta {
|
||||
userAgent?: string;
|
||||
platform?: string;
|
||||
language?: string;
|
||||
}
|
||||
|
||||
/** verify - request params */
|
||||
export interface VerifyParams {
|
||||
token?: string;
|
||||
meta?: DeviceMeta;
|
||||
}
|
||||
|
||||
/** verify - response payload */
|
||||
|
||||
@@ -312,10 +312,15 @@ export class GatewayClient {
|
||||
if (this.options.hubId) {
|
||||
// Set internal state to allow send/request during verify
|
||||
this._state = "registered";
|
||||
const meta = typeof navigator !== "undefined" ? {
|
||||
userAgent: navigator.userAgent,
|
||||
platform: navigator.platform,
|
||||
language: navigator.language,
|
||||
} : undefined;
|
||||
this.request<{ hubId: string; agentId: string }>(
|
||||
this.options.hubId,
|
||||
"verify",
|
||||
{ token: this.options.token },
|
||||
{ token: this.options.token, meta },
|
||||
this.options.verifyTimeout,
|
||||
)
|
||||
.then((result) => {
|
||||
|
||||
Reference in New Issue
Block a user