@nimblebrain/synapse 0.18.0 → 0.20.0
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/README.md +32 -37
- package/dist/check-JEM5PN64.cjs +435 -0
- package/dist/check-JEM5PN64.cjs.map +1 -0
- package/dist/check-YDZUQT6A.js +429 -0
- package/dist/check-YDZUQT6A.js.map +1 -0
- package/dist/{chunk-VDQZQDU3.cjs → chunk-BNF352SA.cjs} +56 -145
- package/dist/chunk-BNF352SA.cjs.map +1 -0
- package/dist/{chunk-HKRTDGXN.js → chunk-DJS2FKBN.js} +21 -89
- package/dist/chunk-DJS2FKBN.js.map +1 -0
- package/dist/chunk-H3INUKA3.js +32 -0
- package/dist/chunk-H3INUKA3.js.map +1 -0
- package/dist/{chunk-FB7GPBEM.cjs → chunk-HQLSVUOR.cjs} +193 -314
- package/dist/chunk-HQLSVUOR.cjs.map +1 -0
- package/dist/chunk-ISV6HFQE.cjs +40 -0
- package/dist/chunk-ISV6HFQE.cjs.map +1 -0
- package/dist/{chunk-3YSXPBEQ.js → chunk-TR2YNWZ5.js} +190 -313
- package/dist/chunk-TR2YNWZ5.js.map +1 -0
- package/dist/{chunk-ZLASWV4N.js → chunk-UKP4W6DI.js} +56 -145
- package/dist/chunk-UKP4W6DI.js.map +1 -0
- package/dist/{chunk-LPWEQCZV.cjs → chunk-YSL7KJNU.cjs} +21 -92
- package/dist/chunk-YSL7KJNU.cjs.map +1 -0
- package/dist/codegen/cli.cjs +38 -1
- package/dist/codegen/cli.cjs.map +1 -1
- package/dist/codegen/cli.js +38 -1
- package/dist/codegen/cli.js.map +1 -1
- package/dist/codegen/index.d.cts +1 -1
- package/dist/codegen/index.d.ts +1 -1
- package/dist/connect.iife.global.js +66 -43
- package/dist/{detect-BHYg26_d.d.cts → detect-DVGaL2bH.d.cts} +39 -33
- package/dist/{detect-Bf8Q_0dK.d.ts → detect-DVGaL2bH.d.ts} +39 -33
- package/dist/host/index.cjs +17 -17
- package/dist/host/index.d.cts +11 -27
- package/dist/host/index.d.ts +11 -27
- package/dist/host/index.js +2 -2
- package/dist/index.cjs +52 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +104 -31
- package/dist/index.d.ts +104 -31
- package/dist/index.js +34 -3
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +11 -10
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +49 -12
- package/dist/react/index.d.ts +49 -12
- package/dist/react/index.js +6 -5
- package/dist/react/index.js.map +1 -1
- package/dist/{server-QIYIJHD5.cjs → server-BR5MNFOB.cjs} +40 -29
- package/dist/server-BR5MNFOB.cjs.map +1 -0
- package/dist/{server-5N76YCWC.js → server-OOEEWAEG.js} +40 -30
- package/dist/server-OOEEWAEG.js.map +1 -0
- package/dist/synapse-runtime.iife.global.js +66 -43
- package/dist/synapse-ui.iife.global.js +4 -4
- package/dist/{types-uEO4VFJ2.d.cts → types-BxPfGHKO.d.cts} +48 -125
- package/dist/{types-uEO4VFJ2.d.ts → types-BxPfGHKO.d.ts} +48 -125
- package/dist/vite/index.cjs +77 -33
- package/dist/vite/index.cjs.map +1 -1
- package/dist/vite/index.d.cts +5 -1
- package/dist/vite/index.d.ts +5 -1
- package/dist/vite/index.js +77 -33
- package/dist/vite/index.js.map +1 -1
- package/package.json +12 -6
- package/dist/chunk-3YSXPBEQ.js.map +0 -1
- package/dist/chunk-FB7GPBEM.cjs.map +0 -1
- package/dist/chunk-HKRTDGXN.js.map +0 -1
- package/dist/chunk-LPWEQCZV.cjs.map +0 -1
- package/dist/chunk-VDQZQDU3.cjs.map +0 -1
- package/dist/chunk-ZLASWV4N.js.map +0 -1
- package/dist/server-5N76YCWC.js.map +0 -1
- package/dist/server-QIYIJHD5.cjs.map +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { RESOURCE_TEARDOWN_METHOD, TOOL_CANCELLED_METHOD, TOOL_INPUT_PARTIAL_METHOD, TOOL_INPUT_METHOD, TOOL_RESULT_METHOD } from '@modelcontextprotocol/ext-apps';
|
|
2
|
+
|
|
3
|
+
// src/event-map.ts
|
|
4
|
+
var TOOLS_CALL_METHOD = "tools/call";
|
|
5
|
+
var RESOURCE_LIST_CHANGED_METHOD = "notifications/resources/list_changed";
|
|
6
|
+
var READ_RESOURCE_METHOD = "resources/read";
|
|
7
|
+
var LIST_RESOURCES_METHOD = "resources/list";
|
|
8
|
+
var ACTION_METHOD = "ai.nimblebrain/action";
|
|
9
|
+
var REQUEST_FILE_METHOD = "ai.nimblebrain/request-file";
|
|
10
|
+
var KEYDOWN_METHOD = "ai.nimblebrain/keydown";
|
|
11
|
+
var NIMBLEBRAIN_EXTENSIONS = {
|
|
12
|
+
/** App → host notification: run a host action (navigate, open a panel). */
|
|
13
|
+
action: { method: ACTION_METHOD, capability: ACTION_METHOD },
|
|
14
|
+
/** App → host request: the host's file picker, answered `{ files }`. */
|
|
15
|
+
requestFile: { method: REQUEST_FILE_METHOD, capability: REQUEST_FILE_METHOD },
|
|
16
|
+
/** App → host notification: a keyboard shortcut pressed inside the frame. */
|
|
17
|
+
keydown: { method: KEYDOWN_METHOD, capability: KEYDOWN_METHOD }
|
|
18
|
+
};
|
|
19
|
+
var EVENT_MAP = {
|
|
20
|
+
"tool-result": TOOL_RESULT_METHOD,
|
|
21
|
+
"tool-input": TOOL_INPUT_METHOD,
|
|
22
|
+
"tool-input-partial": TOOL_INPUT_PARTIAL_METHOD,
|
|
23
|
+
"tool-cancelled": TOOL_CANCELLED_METHOD,
|
|
24
|
+
teardown: RESOURCE_TEARDOWN_METHOD
|
|
25
|
+
};
|
|
26
|
+
function resolveEventMethod(name) {
|
|
27
|
+
return EVENT_MAP[name] ?? name;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { KEYDOWN_METHOD, LIST_RESOURCES_METHOD, NIMBLEBRAIN_EXTENSIONS, READ_RESOURCE_METHOD, RESOURCE_LIST_CHANGED_METHOD, TOOLS_CALL_METHOD, resolveEventMethod };
|
|
31
|
+
//# sourceMappingURL=chunk-H3INUKA3.js.map
|
|
32
|
+
//# sourceMappingURL=chunk-H3INUKA3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/event-map.ts"],"names":[],"mappings":";;;AAoBO,IAAM,iBAAA,GAA+C;AAYrD,IAAM,4BAAA,GACX;AACK,IAAM,oBAAA,GAAsD;AAC5D,IAAM,qBAAA,GAAwD;AAU9D,IAAM,aAAA,GAAgB,uBAAA;AACtB,IAAM,mBAAA,GAAsB,6BAAA;AAC5B,IAAM,cAAA,GAAiB;AAgBvB,IAAM,sBAAA,GAAyB;AAAA;AAAA,EAEpC,MAAA,EAAQ,EAAE,MAAA,EAAQ,aAAA,EAAe,YAAY,aAAA,EAAc;AAAA;AAAA,EAE3D,WAAA,EAAa,EAAE,MAAA,EAAQ,mBAAA,EAAqB,YAAY,mBAAA,EAAoB;AAAA;AAAA,EAE5E,OAAA,EAAS,EAAE,MAAA,EAAQ,cAAA,EAAgB,YAAY,cAAA;AACjD;AAgBA,IAAM,SAAA,GAAoC;AAAA,EACxC,aAAA,EAAe,kBAAA;AAAA,EACf,YAAA,EAAc,iBAAA;AAAA,EACd,oBAAA,EAAsB,yBAAA;AAAA,EACtB,gBAAA,EAAkB,qBAAA;AAAA,EAClB,QAAA,EAAU;AACZ,CAAA;AAMO,SAAS,mBAAmB,IAAA,EAAsB;AACvD,EAAA,OAAO,SAAA,CAAU,IAAI,CAAA,IAAK,IAAA;AAC5B","file":"chunk-H3INUKA3.js","sourcesContent":["import {\n HOST_CONTEXT_CHANGED_METHOD,\n RESOURCE_TEARDOWN_METHOD,\n TOOL_CANCELLED_METHOD,\n TOOL_INPUT_METHOD,\n TOOL_INPUT_PARTIAL_METHOD,\n TOOL_RESULT_METHOD,\n} from \"@modelcontextprotocol/ext-apps\";\nimport type {\n CallToolRequest,\n ListResourcesRequest,\n ReadResourceRequest,\n ResourceListChangedNotification,\n} from \"@modelcontextprotocol/sdk/types.js\";\n\n/**\n * A server's own `tools/call`. Core MCP, so the same reasoning as the resource\n * methods below: no constant to import, and typing the literal with the SDK's\n * own `method` field still breaks the build if it is renamed.\n */\nexport const TOOLS_CALL_METHOD: CallToolRequest[\"method\"] = \"tools/call\";\n\n/**\n * A server's own resource methods. Core MCP rather than ext-apps, so there are\n * no constants to import; typing each literal with the SDK's own `method` field\n * still breaks the build if one is renamed.\n *\n * `serverResources` in a host's `hostCapabilities` is the promise to carry all\n * three: the object itself says the host proxies resource reads, and its\n * `listChanged` says the host forwards the notification to that server's views.\n * A host announcing it owes an answer to every method here.\n */\nexport const RESOURCE_LIST_CHANGED_METHOD: ResourceListChangedNotification[\"method\"] =\n \"notifications/resources/list_changed\";\nexport const READ_RESOURCE_METHOD: ReadResourceRequest[\"method\"] = \"resources/read\";\nexport const LIST_RESOURCES_METHOD: ListResourcesRequest[\"method\"] = \"resources/list\";\n\n/**\n * NimbleBrain host extension methods. No spec equivalent, so no constant to\n * import — but naming them once here means no source file spells the wire\n * string twice. The `ai.nimblebrain/` prefix names the owner: these are the\n * NimbleBrain host's extensions, which this package implements a client for.\n *\n * Each is used only when the host declares it: see {@link NIMBLEBRAIN_EXTENSIONS}.\n */\nexport const ACTION_METHOD = \"ai.nimblebrain/action\";\nexport const REQUEST_FILE_METHOD = \"ai.nimblebrain/request-file\";\nexport const KEYDOWN_METHOD = \"ai.nimblebrain/keydown\";\n\n/**\n * The NimbleBrain host extensions. This is the complete list; anything else an\n * app sends is spec.\n *\n * Each extension has one name, used both as its method and as the identifier a\n * host declares in `hostCapabilities.experimental` to offer it. The ext-apps\n * host capability type has no field for extensions, and a spec client parses\n * the `ui/initialize` result against that type, so `experimental` is the one\n * slot whose contents reach the app. The MCP tasks capability travels the same\n * way, for the same reason.\n *\n * The gate is the declaration, not the host's name. A host that implements an\n * extension says so; a host that does not is never sent it.\n */\nexport const NIMBLEBRAIN_EXTENSIONS = {\n /** App → host notification: run a host action (navigate, open a panel). */\n action: { method: ACTION_METHOD, capability: ACTION_METHOD },\n /** App → host request: the host's file picker, answered `{ files }`. */\n requestFile: { method: REQUEST_FILE_METHOD, capability: REQUEST_FILE_METHOD },\n /** App → host notification: a keyboard shortcut pressed inside the frame. */\n keydown: { method: KEYDOWN_METHOD, capability: KEYDOWN_METHOD },\n} as const;\n\nexport type NimbleBrainExtension = keyof typeof NIMBLEBRAIN_EXTENSIONS;\n\n/**\n * Maps short event names used in App.on() to full MCP method names.\n * Uses canonical constants from @modelcontextprotocol/ext-apps to stay\n * in sync with the spec — if the spec changes a method name, this breaks\n * at compile time, not silently at runtime.\n *\n * `theme-changed` and `host-context-changed` are deliberately absent:\n * `connect()` routes both itself, because each is a typed *view* over the same\n * notification rather than its raw params. Listing them here would be a second\n * table nothing consults — the kind of copy that goes wrong quietly because\n * nothing reads it to notice.\n */\nconst EVENT_MAP: Record<string, string> = {\n \"tool-result\": TOOL_RESULT_METHOD,\n \"tool-input\": TOOL_INPUT_METHOD,\n \"tool-input-partial\": TOOL_INPUT_PARTIAL_METHOD,\n \"tool-cancelled\": TOOL_CANCELLED_METHOD,\n teardown: RESOURCE_TEARDOWN_METHOD,\n};\n\n/**\n * Resolve a short event name to a full MCP method name.\n * Returns the mapped method if found, otherwise passes through as-is.\n */\nexport function resolveEventMethod(name: string): string {\n return EVENT_MAP[name] ?? name;\n}\n\n/** The wire method behind the `theme-changed` / `host-context-changed` events. */\nexport { HOST_CONTEXT_CHANGED_METHOD };\n"]}
|