@touchcastllc/napster-companion-api-dev 1.0.0-alpha.73 → 1.0.0-alpha.74

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.
@@ -26,6 +26,8 @@ export declare class EdgeMcpBridge {
26
26
  private tools;
27
27
  private onToolChange;
28
28
  private onResourceUpdated;
29
+ private onResourceListChanged;
30
+ private readonly seededUris;
29
31
  private lastInlineSig;
30
32
  private sessionReady;
31
33
  private disposed;
@@ -40,6 +42,23 @@ export declare class EdgeMcpBridge {
40
42
  attach(): Promise<EdgeMcpModelContext | null>;
41
43
  /** Attach to a known model context: cache tools and subscribe to events. */
42
44
  private bind;
45
+ /**
46
+ * Relay the current value of every registered resource to the agent once, as
47
+ * an initial state seed — batched into a SINGLE `send_message` rather than one
48
+ * per resource, so the agent gets the whole starting state in one context
49
+ * injection. Feature-detects the toolkit's resource extension (`getResources` /
50
+ * `readResource`) — a bare WebMCP surface has neither, so this is a no-op there.
51
+ * Already-seeded URIs are skipped so a `resourcelistchanged` re-seed only emits
52
+ * genuinely new resources. (Ongoing changes still relay per-resource via
53
+ * `relayResourceUpdate`, since they happen one at a time.)
54
+ */
55
+ private seedResources;
56
+ /**
57
+ * Send the whole initial state set to the agent as ONE `role: 'system'`
58
+ * message (one line per resource). `trigger_response: false` so the avatar
59
+ * doesn't speak on the seed; `delay: true` to wait for any current speech.
60
+ */
61
+ private relayInitialState;
43
62
  /** Re-read the tool catalog from the model context. */
44
63
  private refreshTools;
45
64
  /** Map the current WebMCP tools to `set_settings.inline_functions` definitions. */
@@ -12,6 +12,29 @@ export interface EdgeMcpToolInfo {
12
12
  inputSchema?: Record<string, unknown> | string;
13
13
  /** Optional human-readable label. */
14
14
  title?: string;
15
+ /**
16
+ * Standard WebMCP/MCP annotation hints, surfaced by the polyfill's
17
+ * `getTools()`. The bridge reads these to gate agent behavior — most
18
+ * importantly, `destructiveHint` ⇒ the agent must confirm with the user before
19
+ * calling. A bare WebMCP surface (or older polyfill) may omit this entirely, so
20
+ * every field is optional and the bridge treats a missing object as "no hints."
21
+ */
22
+ annotations?: EdgeMcpToolAnnotations;
23
+ }
24
+ /** The standard MCP tool annotation hints the bridge understands. */
25
+ export interface EdgeMcpToolAnnotations {
26
+ /** Tool only reads state — safe to call freely, no confirmation. */
27
+ readOnlyHint?: boolean;
28
+ /**
29
+ * Tool performs a destructive / final action. Bridge convention: treat this as
30
+ * "confirm with the user before calling" (covers additive-but-final actions
31
+ * like submit / send / place-order too).
32
+ */
33
+ destructiveHint?: boolean;
34
+ /** Safe to retry with the same args (no extra effect). */
35
+ idempotentHint?: boolean;
36
+ /** Output may contain untrusted / third-party content (injection risk). */
37
+ untrustedContentHint?: boolean;
15
38
  }
16
39
  /**
17
40
  * Payload of the toolkit's `resourceupdated` event (live-state extension).
@@ -2,4 +2,4 @@ export { EdgeMcpBridge } from "./edge-mcp-bridge";
2
2
  export type { EdgeMcpBridgeOptions } from "./edge-mcp-bridge";
3
3
  export { normalizeFunctionCallEvent } from "./normalizeFunctionCallEvent";
4
4
  export { getModelContext, discoverModelContext } from "./edge-mcp-discovery";
5
- export type { EdgeMcpModelContext, EdgeMcpToolInfo, EdgeMcpResourceUpdate, FunctionCallEvent, SendCommand, } from "./edge-mcp-types";
5
+ export type { EdgeMcpModelContext, EdgeMcpToolInfo, EdgeMcpToolAnnotations, EdgeMcpResourceUpdate, FunctionCallEvent, SendCommand, } from "./edge-mcp-types";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@touchcastllc/napster-companion-api-dev",
3
- "version": "1.0.0-alpha.73",
3
+ "version": "1.0.0-alpha.74",
4
4
  "keywords": [
5
5
  "napster",
6
6
  "companion-api",