@touchcastllc/napster-companion-api-dev 1.0.0-alpha.72 → 1.0.0-alpha.73
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.
- package/lib/index.d.ts +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.js +1 -1
- package/lib/index.standalone.js +1 -1
- package/lib/services/{webmcp/webmcp-bridge.d.ts → edge-mcp/edge-mcp-bridge.d.ts} +5 -5
- package/lib/services/{webmcp/webmcp-discovery.d.ts → edge-mcp/edge-mcp-discovery.d.ts} +3 -3
- package/lib/services/{webmcp/webmcp-types.d.ts → edge-mcp/edge-mcp-types.d.ts} +7 -7
- package/lib/services/edge-mcp/index.d.ts +5 -0
- package/lib/services/{webmcp → edge-mcp}/normalizeFunctionCallEvent.d.ts +2 -2
- package/package.json +1 -1
- package/lib/services/webmcp/index.d.ts +0 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FunctionCallEvent, SendCommand,
|
|
2
|
-
export interface
|
|
1
|
+
import type { FunctionCallEvent, SendCommand, EdgeMcpModelContext } from "./edge-mcp-types";
|
|
2
|
+
export interface EdgeMcpBridgeOptions {
|
|
3
3
|
/**
|
|
4
4
|
* The SDK's `sendCommand`, bound to the live instance so the bridge can emit
|
|
5
5
|
* `send_message` (state relays) and `send_function_output` (tool results).
|
|
@@ -21,7 +21,7 @@ export interface WebMcpBridgeOptions {
|
|
|
21
21
|
*/
|
|
22
22
|
registerInlineFunctions?: boolean;
|
|
23
23
|
}
|
|
24
|
-
export declare class
|
|
24
|
+
export declare class EdgeMcpBridge {
|
|
25
25
|
private mc;
|
|
26
26
|
private tools;
|
|
27
27
|
private onToolChange;
|
|
@@ -30,14 +30,14 @@ export declare class WebMcpBridge {
|
|
|
30
30
|
private sessionReady;
|
|
31
31
|
private disposed;
|
|
32
32
|
private readonly options;
|
|
33
|
-
constructor(options:
|
|
33
|
+
constructor(options: EdgeMcpBridgeOptions);
|
|
34
34
|
/**
|
|
35
35
|
* Discover `document.modelContext` in the page, cache its tools, and wire up
|
|
36
36
|
* the `toolchange` / `resourceupdated` listeners. Returns the model context,
|
|
37
37
|
* or `null` if none appears within the timeout. Safe to fire from `init()` —
|
|
38
38
|
* failure is silent and non-fatal.
|
|
39
39
|
*/
|
|
40
|
-
attach(): Promise<
|
|
40
|
+
attach(): Promise<EdgeMcpModelContext | null>;
|
|
41
41
|
/** Attach to a known model context: cache tools and subscribe to events. */
|
|
42
42
|
private bind;
|
|
43
43
|
/** Re-read the tool catalog from the model context. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EdgeMcpModelContext } from "./edge-mcp-types";
|
|
2
2
|
/** Read `document.modelContext`, falling back to the deprecated navigator alias. */
|
|
3
|
-
export declare function getModelContext():
|
|
3
|
+
export declare function getModelContext(): EdgeMcpModelContext | null;
|
|
4
4
|
/**
|
|
5
5
|
* Discover `document.modelContext`, polling briefly if it is not present yet.
|
|
6
6
|
*
|
|
@@ -11,4 +11,4 @@ export declare function getModelContext(): WebMcpModelContext | null;
|
|
|
11
11
|
* 1500ms — long enough to cover normal hydration ordering,
|
|
12
12
|
* short enough not to delay the SDK noticeably.
|
|
13
13
|
*/
|
|
14
|
-
export declare function discoverModelContext(timeoutMs?: number): Promise<
|
|
14
|
+
export declare function discoverModelContext(timeoutMs?: number): Promise<EdgeMcpModelContext | null>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Tool metadata as returned by `document.modelContext.getTools()`. */
|
|
2
|
-
export interface
|
|
2
|
+
export interface EdgeMcpToolInfo {
|
|
3
3
|
/** Domain-named identifier, e.g. `'docs.search'` or `'cart.add'`. */
|
|
4
4
|
name: string;
|
|
5
5
|
/** One-sentence description the agent uses to decide WHEN to invoke. */
|
|
@@ -18,7 +18,7 @@ export interface WebMcpToolInfo {
|
|
|
18
18
|
* Mirrors MCP's `notifications/resources/updated`, but carries the value
|
|
19
19
|
* inline so the SDK can relay it without a follow-up read.
|
|
20
20
|
*/
|
|
21
|
-
export interface
|
|
21
|
+
export interface EdgeMcpResourceUpdate {
|
|
22
22
|
uri: string;
|
|
23
23
|
value: unknown;
|
|
24
24
|
}
|
|
@@ -32,9 +32,9 @@ export interface WebMcpResourceUpdate {
|
|
|
32
32
|
* `document.modelContext` is an `EventTarget`: it dispatches `toolchange` when
|
|
33
33
|
* the tool list changes and (with the toolkit) `resourceupdated` on state push.
|
|
34
34
|
*/
|
|
35
|
-
export interface
|
|
36
|
-
getTools(): Promise<
|
|
37
|
-
executeTool(tool:
|
|
35
|
+
export interface EdgeMcpModelContext extends EventTarget {
|
|
36
|
+
getTools(): Promise<EdgeMcpToolInfo[]>;
|
|
37
|
+
executeTool(tool: EdgeMcpToolInfo, inputArgsJson: string, options?: {
|
|
38
38
|
signal?: AbortSignal;
|
|
39
39
|
}): Promise<string | null>;
|
|
40
40
|
getResources?: () => Array<{
|
|
@@ -42,14 +42,14 @@ export interface WebMcpModelContext extends EventTarget {
|
|
|
42
42
|
name: string;
|
|
43
43
|
}>;
|
|
44
44
|
readResource?: (uri: string) => Promise<unknown>;
|
|
45
|
-
subscribeResource?: (uri: string, handler: (update:
|
|
45
|
+
subscribeResource?: (uri: string, handler: (update: EdgeMcpResourceUpdate) => void) => () => void;
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
48
|
* Normalized shape of an incoming function-call event.
|
|
49
49
|
*
|
|
50
50
|
* The server signals an agent tool call with a `function_implicitly_called`
|
|
51
51
|
* event; the SDK's data-channel handler extracts these three fields before
|
|
52
|
-
* calling `
|
|
52
|
+
* calling `EdgeMcpBridge.dispatchFunctionCall`.
|
|
53
53
|
*/
|
|
54
54
|
export interface FunctionCallEvent {
|
|
55
55
|
/** The tool/function name the agent invoked. */
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { EdgeMcpBridge } from "./edge-mcp-bridge";
|
|
2
|
+
export type { EdgeMcpBridgeOptions } from "./edge-mcp-bridge";
|
|
3
|
+
export { normalizeFunctionCallEvent } from "./normalizeFunctionCallEvent";
|
|
4
|
+
export { getModelContext, discoverModelContext } from "./edge-mcp-discovery";
|
|
5
|
+
export type { EdgeMcpModelContext, EdgeMcpToolInfo, EdgeMcpResourceUpdate, FunctionCallEvent, SendCommand, } from "./edge-mcp-types";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { FunctionCallEvent } from "./
|
|
1
|
+
import type { FunctionCallEvent } from "./edge-mcp-types";
|
|
2
2
|
/**
|
|
3
3
|
* Returns a normalized `FunctionCallEvent` if `message` represents a function
|
|
4
4
|
* call, otherwise `null`. Callers route a non-null result to
|
|
5
|
-
* `
|
|
5
|
+
* `EdgeMcpBridge.dispatchFunctionCall` and skip normal chat handling.
|
|
6
6
|
*
|
|
7
7
|
* Requires `name` and `call_id`. `arguments` is passed through as-is (object
|
|
8
8
|
* for `function_implicitly_called`, JSON string for realtime protocols, or
|
package/package.json
CHANGED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { WebMcpBridge } from "./webmcp-bridge";
|
|
2
|
-
export type { WebMcpBridgeOptions } from "./webmcp-bridge";
|
|
3
|
-
export { normalizeFunctionCallEvent } from "./normalizeFunctionCallEvent";
|
|
4
|
-
export { getModelContext, discoverModelContext } from "./webmcp-discovery";
|
|
5
|
-
export type { WebMcpModelContext, WebMcpToolInfo, WebMcpResourceUpdate, FunctionCallEvent, SendCommand, } from "./webmcp-types";
|