{"version":3,"sources":["../src/event-map.ts"],"names":["TOOL_RESULT_METHOD","TOOL_INPUT_METHOD","TOOL_INPUT_PARTIAL_METHOD","TOOL_CANCELLED_METHOD","RESOURCE_TEARDOWN_METHOD"],"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,EAAeA,0BAAA;AAAA,EACf,YAAA,EAAcC,yBAAA;AAAA,EACd,oBAAA,EAAsBC,iCAAA;AAAA,EACtB,gBAAA,EAAkBC,6BAAA;AAAA,EAClB,QAAA,EAAUC;AACZ,CAAA;AAMO,SAAS,mBAAmB,IAAA,EAAsB;AACvD,EAAA,OAAO,SAAA,CAAU,IAAI,CAAA,IAAK,IAAA;AAC5B","file":"chunk-ISV6HFQE.cjs","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"]}