@touchcastllc/napster-companion-api-dev 1.0.0-alpha.68 → 1.0.0-alpha.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,33 +1,17 @@
1
1
  import type { EdgeMcpApi, FunctionCallEvent, SendCommand } from "./edge-mcp-types";
2
2
  export interface EdgeMcpBridgeOptions {
3
3
  /**
4
- * The SDK's `sendCommand` method, bound to the live instance so the
5
- * bridge can emit `send_message` (for state relays) and
6
- * `function_call_output` (for invoke results).
4
+ * The SDK's `sendCommand`, bound to the live instance so the bridge can emit
5
+ * `send_message` (state relays) and `function_call_output` (invoke results).
7
6
  */
8
7
  sendCommand: SendCommand;
9
- /**
10
- * When true, the bridge logs attach status, every dispatched function
11
- * call, and every state push relay to the developer console. Match the
12
- * SDK's own `debug` flag.
13
- *
14
- * Default: `false`.
15
- */
8
+ /** Mirror the SDK's `debug` flag. Default: `false`. */
16
9
  debug?: boolean;
17
- /**
18
- * How long `attach()` waits for a producer publication before giving up.
19
- * The SDK is not blocked beyond this duration even when no Edge MCP
20
- * exists in the page.
21
- *
22
- * Default: `1500` (ms).
23
- */
10
+ /** How long `attach()` waits for an Edge MCP to publish. Default: `1500` ms. */
24
11
  attachTimeoutMs?: number;
25
12
  /**
26
- * When true, Edge MCP state pushes are forwarded to the agent as
27
- * `role: 'system'` messages. Set false if the consuming application
28
- * wants to control state delivery itself.
29
- *
30
- * Default: `true`.
13
+ * Forward Edge MCP state pushes to the agent as `role: 'system'` messages.
14
+ * Set false to control state delivery yourself. Default: `true`.
31
15
  */
32
16
  relayStatePushes?: boolean;
33
17
  }
@@ -38,57 +22,35 @@ export declare class EdgeMcpBridge {
38
22
  private readonly options;
39
23
  constructor(options: EdgeMcpBridgeOptions);
40
24
  /**
41
- * Discover an Edge MCP instance in the page and subscribe to state
42
- * changes. Returns the discovered api ref, or `null` if no Edge MCP
43
- * publishes within the timeout.
44
- *
45
- * Safe to await from the SDK's `init()` path. Failure is silent — the
46
- * SDK continues to run exactly as it would without Edge MCP present.
25
+ * Discover an Edge MCP in the page and subscribe to its state changes.
26
+ * Returns the api ref, or `null` if none publishes within the timeout.
27
+ * Safe to fire from `init()` — failure is silent and non-fatal.
47
28
  */
48
29
  attach(): Promise<EdgeMcpApi | null>;
49
30
  /** True if `attach()` succeeded and the bridge has a live api ref. */
50
31
  get isAttached(): boolean;
51
- /**
52
- * Direct access to the attached Edge MCP api ref, for callers that need
53
- * to read `listCapabilities()` themselves (for example, to build the
54
- * `invokeCapability` function definition for `set_settings.functions`).
55
- *
56
- * Returns `null` if not attached.
57
- */
32
+ /** The attached Edge MCP api ref, or `null` if not attached. */
58
33
  getApi(): EdgeMcpApi | null;
59
34
  /**
60
- * Dispatch an incoming function call from the agent. The SDK's
61
- * data-channel message handler is responsible for normalizing the
62
- * upstream event shape into `FunctionCallEvent` before calling this.
63
- *
64
- * Only the Edge MCP wrapper function (see
65
- * `INVOKE_CAPABILITY_FUNCTION_NAMES`) is handled. Anything else is silently
66
- * ignored so the bridge can coexist with other tool paths (vendor-registered
67
- * tools, customer's own `onFunctionCall`, etc.).
68
- *
69
- * Always responds via `function_call_output` — success, validation
70
- * failure, and unexpected error all produce a structured result the
71
- * agent can read and narrate back to the user.
35
+ * Dispatch a normalized agent function call. Handles it only when the name
36
+ * matches a capability the attached Edge MCP currently exposes. The name can
37
+ * arrive as the top-level `event.name` (direct call, args in
38
+ * `event.arguments`) or nested in a wrapper tool's `tool_name` (args under
39
+ * `arguments`/`args`). Anything else is ignored so the bridge coexists with
40
+ * other tool paths. Matched calls always reply via `function_call_output`.
72
41
  */
73
42
  dispatchFunctionCall(event: FunctionCallEvent): Promise<void>;
74
- /**
75
- * Tear down subscriptions and drop the Edge MCP api ref. Call from the
76
- * SDK's `destroy()` path. Idempotent.
77
- */
43
+ /** Tear down subscriptions and drop the api ref. Idempotent. */
78
44
  dispose(): void;
79
45
  /**
80
46
  * Forward an Edge MCP state push to the agent as a system message.
81
- *
82
- * `role: 'system'` injects context without rendering to the user.
83
- * `trigger_response: false` keeps the avatar from speaking on every
84
- * state change. `delay: true` waits for the agent to finish its current
85
- * speech before delivering, so it doesn't interrupt mid-sentence.
47
+ * `trigger_response: false` keeps the avatar from speaking on every change;
48
+ * `delay: true` waits for it to finish its current speech first.
86
49
  */
87
50
  private relayStateChange;
88
51
  /**
89
- * Emit a `function_call_output` command carrying the bridge's result for
90
- * a given `call_id`. The `output` field is a JSON-encoded string per the
91
- * Realtime protocol convention.
52
+ * Emit a `function_call_output` for a `call_id`. `output` is JSON-encoded per
53
+ * the Realtime protocol convention.
92
54
  */
93
55
  private sendOutput;
94
56
  private log;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@touchcastllc/napster-companion-api-dev",
3
- "version": "1.0.0-alpha.68",
3
+ "version": "1.0.0-alpha.69",
4
4
  "keywords": [
5
5
  "napster",
6
6
  "companion-api",