@apollo/client-ai-apps 0.5.4 → 0.6.1

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.
Files changed (123) hide show
  1. package/CHANGELOG.md +180 -0
  2. package/dist/config/defineConfig.d.ts +1 -0
  3. package/dist/config/defineConfig.d.ts.map +1 -1
  4. package/dist/config/schema.d.ts +1 -0
  5. package/dist/config/schema.d.ts.map +1 -1
  6. package/dist/config/schema.js +1 -0
  7. package/dist/config/schema.js.map +1 -1
  8. package/dist/core/typeRegistration.d.ts +33 -0
  9. package/dist/core/typeRegistration.d.ts.map +1 -0
  10. package/dist/core/typeRegistration.js +2 -0
  11. package/dist/core/typeRegistration.js.map +1 -0
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js.map +1 -1
  15. package/dist/mcp/core/McpAppManager.d.ts +2 -1
  16. package/dist/mcp/core/McpAppManager.d.ts.map +1 -1
  17. package/dist/mcp/core/McpAppManager.js +11 -1
  18. package/dist/mcp/core/McpAppManager.js.map +1 -1
  19. package/dist/mcp/react/hooks/useHostContext.d.ts +2 -0
  20. package/dist/mcp/react/hooks/useHostContext.d.ts.map +1 -0
  21. package/dist/mcp/react/hooks/useHostContext.js +7 -0
  22. package/dist/mcp/react/hooks/useHostContext.js.map +1 -0
  23. package/dist/mcp/react/hooks/useToolInfo.d.ts +3 -0
  24. package/dist/mcp/react/hooks/useToolInfo.d.ts.map +1 -0
  25. package/dist/mcp/react/hooks/useToolInfo.js +10 -0
  26. package/dist/mcp/react/hooks/useToolInfo.js.map +1 -0
  27. package/dist/mcp/react/hooks/useToolInput.d.ts +6 -1
  28. package/dist/mcp/react/hooks/useToolInput.d.ts.map +1 -1
  29. package/dist/mcp/react/hooks/useToolInput.js +4 -0
  30. package/dist/mcp/react/hooks/useToolInput.js.map +1 -1
  31. package/dist/mcp/react/hooks/useToolName.d.ts +6 -1
  32. package/dist/mcp/react/hooks/useToolName.d.ts.map +1 -1
  33. package/dist/mcp/react/hooks/useToolName.js +4 -0
  34. package/dist/mcp/react/hooks/useToolName.js.map +1 -1
  35. package/dist/mcp/react/index.d.ts +2 -0
  36. package/dist/mcp/react/index.d.ts.map +1 -1
  37. package/dist/mcp/react/index.js +2 -0
  38. package/dist/mcp/react/index.js.map +1 -1
  39. package/dist/openai/core/McpAppManager.d.ts +2 -1
  40. package/dist/openai/core/McpAppManager.d.ts.map +1 -1
  41. package/dist/openai/core/McpAppManager.js +11 -1
  42. package/dist/openai/core/McpAppManager.js.map +1 -1
  43. package/dist/openai/react/hooks/useHostContext.d.ts +2 -0
  44. package/dist/openai/react/hooks/useHostContext.d.ts.map +1 -0
  45. package/dist/openai/react/hooks/useHostContext.js +7 -0
  46. package/dist/openai/react/hooks/useHostContext.js.map +1 -0
  47. package/dist/openai/react/hooks/useToolInfo.d.ts +3 -0
  48. package/dist/openai/react/hooks/useToolInfo.d.ts.map +1 -0
  49. package/dist/openai/react/hooks/useToolInfo.js +10 -0
  50. package/dist/openai/react/hooks/useToolInfo.js.map +1 -0
  51. package/dist/openai/react/hooks/useToolInput.d.ts +6 -1
  52. package/dist/openai/react/hooks/useToolInput.d.ts.map +1 -1
  53. package/dist/openai/react/hooks/useToolInput.js +4 -0
  54. package/dist/openai/react/hooks/useToolInput.js.map +1 -1
  55. package/dist/openai/react/hooks/useToolName.d.ts +6 -1
  56. package/dist/openai/react/hooks/useToolName.d.ts.map +1 -1
  57. package/dist/openai/react/hooks/useToolName.js +4 -0
  58. package/dist/openai/react/hooks/useToolName.js.map +1 -1
  59. package/dist/openai/react/index.d.ts +2 -0
  60. package/dist/openai/react/index.d.ts.map +1 -1
  61. package/dist/openai/react/index.js +2 -0
  62. package/dist/openai/react/index.js.map +1 -1
  63. package/dist/react/index.d.ts +10 -0
  64. package/dist/react/index.d.ts.map +1 -1
  65. package/dist/react/index.js +10 -0
  66. package/dist/react/index.js.map +1 -1
  67. package/dist/react/index.mcp.d.ts +1 -1
  68. package/dist/react/index.mcp.d.ts.map +1 -1
  69. package/dist/react/index.mcp.js +1 -1
  70. package/dist/react/index.mcp.js.map +1 -1
  71. package/dist/react/index.openai.d.ts +1 -1
  72. package/dist/react/index.openai.d.ts.map +1 -1
  73. package/dist/react/index.openai.js +1 -1
  74. package/dist/react/index.openai.js.map +1 -1
  75. package/dist/tsconfig/core/tsconfig.json +2 -0
  76. package/dist/tsconfig/mcp/tsconfig.json +2 -0
  77. package/dist/tsconfig/openai/tsconfig.json +2 -0
  78. package/dist/types/application-manifest.d.ts +1 -0
  79. package/dist/types/application-manifest.d.ts.map +1 -1
  80. package/dist/types/application-manifest.js.map +1 -1
  81. package/dist/vite/__tests__/utilities/build.d.ts.map +1 -1
  82. package/dist/vite/__tests__/utilities/build.js +0 -1
  83. package/dist/vite/__tests__/utilities/build.js.map +1 -1
  84. package/dist/vite/apolloClientAiApps.d.ts +2 -0
  85. package/dist/vite/apolloClientAiApps.d.ts.map +1 -1
  86. package/dist/vite/apolloClientAiApps.js +362 -53
  87. package/dist/vite/apolloClientAiApps.js.map +1 -1
  88. package/dist/vite/utilities/recast.d.ts +54 -0
  89. package/dist/vite/utilities/recast.d.ts.map +1 -0
  90. package/dist/vite/utilities/recast.js +71 -0
  91. package/dist/vite/utilities/recast.js.map +1 -0
  92. package/package.json +7 -6
  93. package/src/config/schema.ts +1 -0
  94. package/src/core/typeRegistration.ts +32 -0
  95. package/src/index.ts +7 -0
  96. package/src/mcp/core/McpAppManager.ts +23 -1
  97. package/src/mcp/react/hooks/__tests__/useHostContext.test.tsx +95 -0
  98. package/src/mcp/react/hooks/__tests__/useToolInfo.test.tsx +53 -0
  99. package/src/mcp/react/hooks/useHostContext.ts +14 -0
  100. package/src/mcp/react/hooks/useToolInfo.ts +13 -0
  101. package/src/mcp/react/hooks/useToolInput.ts +6 -1
  102. package/src/mcp/react/hooks/useToolName.ts +6 -1
  103. package/src/mcp/react/index.ts +2 -0
  104. package/src/openai/core/McpAppManager.ts +22 -1
  105. package/src/openai/react/hooks/__tests__/useToolInfo.test.tsx +92 -0
  106. package/src/openai/react/hooks/useHostContext.ts +14 -0
  107. package/src/openai/react/hooks/useToolInfo.ts +13 -0
  108. package/src/openai/react/hooks/useToolInput.ts +6 -1
  109. package/src/openai/react/hooks/useToolName.ts +6 -1
  110. package/src/openai/react/index.ts +2 -0
  111. package/src/react/index.mcp.ts +2 -0
  112. package/src/react/index.openai.ts +2 -0
  113. package/src/react/index.ts +14 -0
  114. package/src/testing/internal/mcp/mockMcpHost.ts +12 -0
  115. package/src/testing/internal/utilities/mockApplicationManifest.ts +1 -0
  116. package/src/tsconfig/core/tsconfig.json +2 -0
  117. package/src/tsconfig/mcp/tsconfig.json +2 -0
  118. package/src/tsconfig/openai/tsconfig.json +2 -0
  119. package/src/types/application-manifest.ts +1 -0
  120. package/src/vite/__tests__/apolloClientAiApps.test.ts +1022 -66
  121. package/src/vite/__tests__/utilities/build.ts +0 -1
  122. package/src/vite/apolloClientAiApps.ts +604 -81
  123. package/src/vite/utilities/recast.ts +100 -0
@@ -1 +1 @@
1
- {"version":3,"file":"McpAppManager.js","sourceRoot":"","sources":["../../../src/openai/core/McpAppManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAK3E,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAOnE,gBAAgB;AAChB,MAAM,OAAO,aAAa;IACf,GAAG,CAAM;IAElB,SAAS,CAAqB;IAC9B,aAAa,GAAmC,IAAI,CAAC;IACrD,UAAU,CAAsC;IAEhD,YAAY,QAA6B;QACvC,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;IAC5E,CAAC;IAED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AS,GAIV;QACC,MAAM,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC;YAC5C,IAAI,EAAE,SAAS;YACf,SAAS,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE;SAC9C,CAAC,CAA+B,CAAC;QAElC,OAAO,MAAM,CAAC,iBAAiB,CAAC;IAClC,CAAC;IAEO,KAAK,CAAC,aAAa;QACzB,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAC3B,IAAI,oBAAoB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CACvD,CAAC;QACJ,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,KAAK,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;YAEtE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF","sourcesContent":["import { App, PostMessageTransport } from \"@modelcontextprotocol/ext-apps\";\nimport type { CallToolResult } from \"@modelcontextprotocol/sdk/types.js\";\nimport type { ApplicationManifest } from \"../../types/application-manifest\";\nimport type { FormattedExecutionResult } from \"graphql\";\nimport type { DocumentNode, OperationVariables } from \"@apollo/client\";\nimport { print } from \"@apollo/client/utilities\";\nimport { cacheAsync, promiseWithResolvers } from \"../../utilities\";\nimport type { ApolloMcpServerApps } from \"../../core/types\";\n\ntype ExecuteQueryCallToolResult = Omit<CallToolResult, \"structuredContent\"> & {\n structuredContent: FormattedExecutionResult;\n};\n\n/** @internal */\nexport class McpAppManager {\n readonly app: App;\n\n #toolName: string | undefined;\n #toolMetadata: Record<string, unknown> | null = null;\n #toolInput: Record<string, unknown> | undefined;\n\n constructor(manifest: ApplicationManifest) {\n this.app = new App({ name: manifest.name, version: manifest.appVersion });\n }\n\n get toolName() {\n return this.#toolName;\n }\n\n get toolMetadata() {\n return this.#toolMetadata;\n }\n\n get toolInput() {\n return this.#toolInput;\n }\n\n connect = cacheAsync(async () => {\n let toolResult = promiseWithResolvers<ApolloMcpServerApps.CallToolResult>();\n\n this.app.ontoolresult = (params) => {\n toolResult.resolve(\n params as unknown as ApolloMcpServerApps.CallToolResult\n );\n };\n\n await this.connectToHost();\n\n const { structuredContent } = await toolResult.promise;\n\n this.#toolName = this.app.getHostContext()?.toolInfo?.tool.name;\n\n // OpenAI is not consistent about sending `ui/notifications/tool-input`.\n // Sometimes it doesn't send at all, other times it sends more than once\n // before we get the tool result (which should always happen and at most\n // once according to the spec). Rather than relying on the\n // `ui/notifications/tool-input` notification to set the tool input value,\n // we read from `window.openai.toolInput so that we have the most recent\n // set value.\n //\n // When OpenAI fixes this issue and sends `ui/notifications/tool-input`\n // consistently according to the MCP Apps specification, this can be\n // reverted to use the `app.ontoolinput` callback.\n this.#toolInput = window.openai.toolInput;\n\n // OpenAI doesn't provide access to `_meta`, so we need to use\n // window.openai.toolResponseMetadata directly\n this.#toolMetadata = window.openai.toolResponseMetadata;\n\n return {\n ...structuredContent,\n toolName: this.toolName,\n args: this.toolInput,\n };\n });\n\n close() {\n return this.app.close();\n }\n\n async executeQuery({\n query,\n variables,\n }: {\n query: DocumentNode;\n variables: OperationVariables | undefined;\n }) {\n const result = (await this.app.callServerTool({\n name: \"execute\",\n arguments: { query: print(query), variables },\n })) as ExecuteQueryCallToolResult;\n\n return result.structuredContent;\n }\n\n private async connectToHost() {\n try {\n return await this.app.connect(\n new PostMessageTransport(window.parent, window.parent)\n );\n } catch (e) {\n const error = e instanceof Error ? e : new Error(\"Failed to connect\");\n\n throw error;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"McpAppManager.js","sourceRoot":"","sources":["../../../src/openai/core/McpAppManager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,EACH,oBAAoB,GAErB,MAAM,gCAAgC,CAAC;AAKxC,OAAO,EAAE,KAAK,EAAE,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AM,EAAE,MAAM,CAAC,MAAM,CAAC,CACvD,CAAC;QACJ,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,KAAK,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;YAEtE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF","sourcesContent":["import {\n App,\n PostMessageTransport,\n type McpUiHostContextChangedNotification,\n} from \"@modelcontextprotocol/ext-apps\";\nimport type { CallToolResult } from \"@modelcontextprotocol/sdk/types.js\";\nimport type { ApplicationManifest } from \"../../types/application-manifest\";\nimport type { FormattedExecutionResult } from \"graphql\";\nimport type { DocumentNode, OperationVariables } from \"@apollo/client\";\nimport { print } from \"@apollo/client/utilities\";\nimport { cacheAsync, promiseWithResolvers } from \"../../utilities\";\nimport type { ApolloMcpServerApps } from \"../../core/types\";\n\ntype ExecuteQueryCallToolResult = Omit<CallToolResult, \"structuredContent\"> & {\n structuredContent: FormattedExecutionResult;\n};\n\n/** @internal */\nexport class McpAppManager {\n readonly app: App;\n\n #toolName: string | undefined;\n #toolMetadata: Record<string, unknown> | null = null;\n #toolInput: Record<string, unknown> | undefined;\n\n #hostContextCallbacks = new Set<\n (params: McpUiHostContextChangedNotification[\"params\"]) => void\n >();\n\n constructor(manifest: ApplicationManifest) {\n this.app = new App({ name: manifest.name, version: manifest.appVersion });\n }\n\n get toolName() {\n return this.#toolName;\n }\n\n get toolMetadata() {\n return this.#toolMetadata;\n }\n\n get toolInput() {\n return this.#toolInput;\n }\n\n onHostContextChanged(\n cb: (params: McpUiHostContextChangedNotification[\"params\"]) => void\n ) {\n this.#hostContextCallbacks.add(cb);\n return () => {\n this.#hostContextCallbacks.delete(cb);\n };\n }\n\n connect = cacheAsync(async () => {\n let toolResult = promiseWithResolvers<ApolloMcpServerApps.CallToolResult>();\n\n this.app.ontoolresult = (params) => {\n toolResult.resolve(\n params as unknown as ApolloMcpServerApps.CallToolResult\n );\n };\n\n this.app.onhostcontextchanged = (params) => {\n this.#hostContextCallbacks.forEach((cb) => cb(params));\n };\n\n await this.connectToHost();\n\n const { structuredContent } = await toolResult.promise;\n\n this.#toolName = this.app.getHostContext()?.toolInfo?.tool.name;\n\n // OpenAI is not consistent about sending `ui/notifications/tool-input`.\n // Sometimes it doesn't send at all, other times it sends more than once\n // before we get the tool result (which should always happen and at most\n // once according to the spec). Rather than relying on the\n // `ui/notifications/tool-input` notification to set the tool input value,\n // we read from `window.openai.toolInput so that we have the most recent\n // set value.\n //\n // When OpenAI fixes this issue and sends `ui/notifications/tool-input`\n // consistently according to the MCP Apps specification, this can be\n // reverted to use the `app.ontoolinput` callback.\n this.#toolInput = window.openai.toolInput;\n\n // OpenAI doesn't provide access to `_meta`, so we need to use\n // window.openai.toolResponseMetadata directly\n this.#toolMetadata = window.openai.toolResponseMetadata;\n\n return {\n ...structuredContent,\n toolName: this.toolName,\n args: this.toolInput,\n };\n });\n\n close() {\n return this.app.close();\n }\n\n async executeQuery({\n query,\n variables,\n }: {\n query: DocumentNode;\n variables: OperationVariables | undefined;\n }) {\n const result = (await this.app.callServerTool({\n name: \"execute\",\n arguments: { query: print(query), variables },\n })) as ExecuteQueryCallToolResult;\n\n return result.structuredContent;\n }\n\n private async connectToHost() {\n try {\n return await this.app.connect(\n new PostMessageTransport(window.parent, window.parent)\n );\n } catch (e) {\n const error = e instanceof Error ? e : new Error(\"Failed to connect\");\n\n throw error;\n }\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function useHostContext(): import("@modelcontextprotocol/ext-apps").McpUiHostContext | undefined;
2
+ //# sourceMappingURL=useHostContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useHostContext.d.ts","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useHostContext.ts"],"names":[],"mappings":"AAGA,wBAAgB,cAAc,0EAU7B"}
@@ -0,0 +1,7 @@
1
+ import { useCallback, useSyncExternalStore } from "react";
2
+ import { useApolloClient } from "./useApolloClient";
3
+ export function useHostContext() {
4
+ const appManager = useApolloClient()["appManager"];
5
+ return useSyncExternalStore(useCallback((update) => appManager.onHostContextChanged(update), [appManager]), () => appManager.app.getHostContext());
6
+ }
7
+ //# sourceMappingURL=useHostContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useHostContext.js","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useHostContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,UAAU,cAAc;IAC5B,MAAM,UAAU,GAAG,eAAe,EAAE,CAAC,YAAY,CAAC,CAAC;IAEnD,OAAO,oBAAoB,CACzB,WAAW,CACT,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,oBAAoB,CAAC,MAAM,CAAC,EACnD,CAAC,UAAU,CAAC,CACb,EACD,GAAG,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,cAAc,EAAE,CACtC,CAAC;AACJ,CAAC","sourcesContent":["import { useCallback, useSyncExternalStore } from \"react\";\nimport { useApolloClient } from \"./useApolloClient\";\n\nexport function useHostContext() {\n const appManager = useApolloClient()[\"appManager\"];\n\n return useSyncExternalStore(\n useCallback(\n (update) => appManager.onHostContextChanged(update),\n [appManager]\n ),\n () => appManager.app.getHostContext()\n );\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import type { ToolInfo } from "../../../core/typeRegistration.js";
2
+ export declare function useToolInfo(): ToolInfo | undefined;
3
+ //# sourceMappingURL=useToolInfo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToolInfo.d.ts","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useToolInfo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAGlE,wBAAgB,WAAW,IAAI,QAAQ,GAAG,SAAS,CASlD"}
@@ -0,0 +1,10 @@
1
+ import { useApolloClient } from "./useApolloClient.js";
2
+ export function useToolInfo() {
3
+ const appManager = useApolloClient()["appManager"];
4
+ const toolName = appManager.toolName;
5
+ if (!toolName) {
6
+ return;
7
+ }
8
+ return { toolName, toolInput: appManager.toolInput };
9
+ }
10
+ //# sourceMappingURL=useToolInfo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToolInfo.js","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useToolInfo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,UAAU,WAAW;IACzB,MAAM,UAAU,GAAG,eAAe,EAAE,CAAC,YAAY,CAAC,CAAC;IACnD,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;IAErC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO;IACT,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC,SAAS,EAAE,CAAC;AACvD,CAAC","sourcesContent":["import type { ToolInfo } from \"../../../core/typeRegistration.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\n\nexport function useToolInfo(): ToolInfo | undefined {\n const appManager = useApolloClient()[\"appManager\"];\n const toolName = appManager.toolName;\n\n if (!toolName) {\n return;\n }\n\n return { toolName, toolInput: appManager.toolInput };\n}\n"]}
@@ -1,2 +1,7 @@
1
- export declare function useToolInput(): Record<string, unknown> | undefined;
1
+ import type { ToolInput } from "../../../core/typeRegistration.js";
2
+ /**
3
+ * @deprecated Please use the `useToolInfo` hook. `useToolInput` will be removed
4
+ * in the next major version.
5
+ */
6
+ export declare function useToolInput(): ToolInput | undefined;
2
7
  //# sourceMappingURL=useToolInput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useToolInput.d.ts","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useToolInput.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,wCAE3B"}
1
+ {"version":3,"file":"useToolInput.d.ts","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useToolInput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAGnE;;;GAGG;AACH,wBAAgB,YAAY,IAAI,SAAS,GAAG,SAAS,CAEpD"}
@@ -1,4 +1,8 @@
1
1
  import { useApolloClient } from "./useApolloClient.js";
2
+ /**
3
+ * @deprecated Please use the `useToolInfo` hook. `useToolInput` will be removed
4
+ * in the next major version.
5
+ */
2
6
  export function useToolInput() {
3
7
  return useApolloClient()["appManager"].toolInput;
4
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useToolInput.js","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useToolInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,UAAU,YAAY;IAC1B,OAAO,eAAe,EAAE,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC;AACnD,CAAC","sourcesContent":["import { useApolloClient } from \"./useApolloClient.js\";\n\nexport function useToolInput() {\n return useApolloClient()[\"appManager\"].toolInput;\n}\n"]}
1
+ {"version":3,"file":"useToolInput.js","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useToolInput.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;GAGG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,eAAe,EAAE,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC;AACnD,CAAC","sourcesContent":["import type { ToolInput } from \"../../../core/typeRegistration.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\n\n/**\n * @deprecated Please use the `useToolInfo` hook. `useToolInput` will be removed\n * in the next major version.\n */\nexport function useToolInput(): ToolInput | undefined {\n return useApolloClient()[\"appManager\"].toolInput;\n}\n"]}
@@ -1,2 +1,7 @@
1
- export declare const useToolName: () => string | undefined;
1
+ import type { ToolName } from "../../../core/typeRegistration.js";
2
+ /**
3
+ * @deprecated Please use the `useToolInfo` hook. `useToolName` will be removed
4
+ * in the next major version.
5
+ */
6
+ export declare const useToolName: () => ToolName | undefined;
2
7
  //# sourceMappingURL=useToolName.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useToolName.d.ts","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useToolName.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,0BAEvB,CAAC"}
1
+ {"version":3,"file":"useToolName.d.ts","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useToolName.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAGlE;;;GAGG;AACH,eAAO,MAAM,WAAW,QAAO,QAAQ,GAAG,SAEzC,CAAC"}
@@ -1,4 +1,8 @@
1
1
  import { useApolloClient } from "./useApolloClient.js";
2
+ /**
3
+ * @deprecated Please use the `useToolInfo` hook. `useToolName` will be removed
4
+ * in the next major version.
5
+ */
2
6
  export const useToolName = () => {
3
7
  return useApolloClient()["appManager"].toolName;
4
8
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useToolName.js","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useToolName.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE;IAC9B,OAAO,eAAe,EAAE,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC;AAClD,CAAC,CAAC","sourcesContent":["import { useApolloClient } from \"./useApolloClient.js\";\n\nexport const useToolName = () => {\n return useApolloClient()[\"appManager\"].toolName;\n};\n"]}
1
+ {"version":3,"file":"useToolName.js","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useToolName.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,GAAyB,EAAE;IACpD,OAAO,eAAe,EAAE,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC;AAClD,CAAC,CAAC","sourcesContent":["import type { ToolName } from \"../../../core/typeRegistration.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\n\n/**\n * @deprecated Please use the `useToolInfo` hook. `useToolName` will be removed\n * in the next major version.\n */\nexport const useToolName = (): ToolName | undefined => {\n return useApolloClient()[\"appManager\"].toolName;\n};\n"]}
@@ -1,7 +1,9 @@
1
1
  export { useApp } from "./hooks/useApp.js";
2
+ export { useHostContext } from "./hooks/useHostContext.js";
2
3
  export { useToolName } from "./hooks/useToolName.js";
3
4
  export { useToolMetadata } from "./hooks/useToolMetadata.js";
4
5
  export { useToolInput } from "./hooks/useToolInput.js";
6
+ export { useToolInfo } from "./hooks/useToolInfo.js";
5
7
  export { createHydrationUtils } from "./hooks/createHydrationUtils.js";
6
8
  export { useWidgetState } from "./hooks/useWidgetState.js";
7
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/openai/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/openai/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
@@ -1,7 +1,9 @@
1
1
  export { useApp } from "./hooks/useApp.js";
2
+ export { useHostContext } from "./hooks/useHostContext.js";
2
3
  export { useToolName } from "./hooks/useToolName.js";
3
4
  export { useToolMetadata } from "./hooks/useToolMetadata.js";
4
5
  export { useToolInput } from "./hooks/useToolInput.js";
6
+ export { useToolInfo } from "./hooks/useToolInfo.js";
5
7
  export { createHydrationUtils } from "./hooks/createHydrationUtils.js";
6
8
  export { useWidgetState } from "./hooks/useWidgetState.js";
7
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/openai/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC","sourcesContent":["export { useApp } from \"./hooks/useApp.js\";\nexport { useToolName } from \"./hooks/useToolName.js\";\nexport { useToolMetadata } from \"./hooks/useToolMetadata.js\";\nexport { useToolInput } from \"./hooks/useToolInput.js\";\nexport { createHydrationUtils } from \"./hooks/createHydrationUtils.js\";\nexport { useWidgetState } from \"./hooks/useWidgetState.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/openai/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC","sourcesContent":["export { useApp } from \"./hooks/useApp.js\";\nexport { useHostContext } from \"./hooks/useHostContext.js\";\nexport { useToolName } from \"./hooks/useToolName.js\";\nexport { useToolMetadata } from \"./hooks/useToolMetadata.js\";\nexport { useToolInput } from \"./hooks/useToolInput.js\";\nexport { useToolInfo } from \"./hooks/useToolInfo.js\";\nexport { createHydrationUtils } from \"./hooks/createHydrationUtils.js\";\nexport { useWidgetState } from \"./hooks/useWidgetState.js\";\n"]}
@@ -2,9 +2,19 @@ export { ApolloProvider } from "./ApolloProvider.js";
2
2
  export { reactive } from "./reactive.js";
3
3
  export type { Reactive } from "./reactive.js";
4
4
  export declare const useApp: typeof import("./index.mcp.js").useApp;
5
+ export declare const useHostContext: typeof import("./index.mcp.js").useHostContext;
6
+ /**
7
+ * @deprecated Please use the `useToolInfo` hook. `useToolInput` will be removed
8
+ * in the next major version.
9
+ */
5
10
  export declare const useToolInput: typeof import("./index.mcp.js").useToolInput;
6
11
  export declare const useToolMetadata: typeof import("./index.mcp.js").useToolMetadata;
12
+ /**
13
+ * @deprecated Please use the `useToolInfo` hook. `useToolName` will be removed
14
+ * in the next major version.
15
+ */
7
16
  export declare const useToolName: typeof import("./index.mcp.js").useToolName;
17
+ export declare const useToolInfo: typeof import("./index.mcp.js").useToolInfo;
8
18
  /** @experimental */
9
19
  export declare const createHydrationUtils: typeof import("./index.mcp.js").createHydrationUtils;
10
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAI9C,eAAO,MAAM,MAAM,wCAC4C,CAAC;AAEhE,eAAO,MAAM,YAAY,8CACkD,CAAC;AAE5E,eAAO,MAAM,eAAe,iDAGzB,CAAC;AAEJ,eAAO,MAAM,WAAW,6CACiD,CAAC;AAE1E,oBAAoB;AACpB,eAAO,MAAM,oBAAoB,sDAER,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAI9C,eAAO,MAAM,MAAM,wCAC4C,CAAC;AAEhE,eAAO,MAAM,cAAc,gDACoD,CAAC;AAEhF;;;GAGG;AACH,eAAO,MAAM,YAAY,8CACkD,CAAC;AAE5E,eAAO,MAAM,eAAe,iDAGzB,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,WAAW,6CACiD,CAAC;AAE1E,eAAO,MAAM,WAAW,6CACiD,CAAC;AAE1E,oBAAoB;AACpB,eAAO,MAAM,oBAAoB,sDAER,CAAC"}
@@ -4,9 +4,19 @@ export { reactive } from "./reactive.js";
4
4
  // Use `mcp` related types since these are the most common between the two
5
5
  // targets
6
6
  export const useApp = missingHook("useApp");
7
+ export const useHostContext = missingHook("useHostContext");
8
+ /**
9
+ * @deprecated Please use the `useToolInfo` hook. `useToolInput` will be removed
10
+ * in the next major version.
11
+ */
7
12
  export const useToolInput = missingHook("useToolInput");
8
13
  export const useToolMetadata = missingHook("useToolMetadata");
14
+ /**
15
+ * @deprecated Please use the `useToolInfo` hook. `useToolName` will be removed
16
+ * in the next major version.
17
+ */
9
18
  export const useToolName = missingHook("useToolName");
19
+ export const useToolInfo = missingHook("useToolInfo");
10
20
  /** @experimental */
11
21
  export const createHydrationUtils = missingHook("createHydrationUtils");
12
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,0EAA0E;AAC1E,UAAU;AACV,MAAM,CAAC,MAAM,MAAM,GACjB,WAAW,CAAyC,QAAQ,CAAC,CAAC;AAEhE,MAAM,CAAC,MAAM,YAAY,GACvB,WAAW,CAA+C,cAAc,CAAC,CAAC;AAE5E,MAAM,CAAC,MAAM,eAAe,GAC1B,WAAW,CACT,iBAAiB,CAClB,CAAC;AAEJ,MAAM,CAAC,MAAM,WAAW,GACtB,WAAW,CAA8C,aAAa,CAAC,CAAC;AAE1E,oBAAoB;AACpB,MAAM,CAAC,MAAM,oBAAoB,GAAG,WAAW,CAE7C,sBAAsB,CAAC,CAAC","sourcesContent":["import { missingHook } from \"./missingHook.js\";\n\nexport { ApolloProvider } from \"./ApolloProvider.js\";\nexport { reactive } from \"./reactive.js\";\nexport type { Reactive } from \"./reactive.js\";\n\n// Use `mcp` related types since these are the most common between the two\n// targets\nexport const useApp =\n missingHook<typeof import(\"./index.mcp.js\").useApp>(\"useApp\");\n\nexport const useToolInput =\n missingHook<typeof import(\"./index.mcp.js\").useToolInput>(\"useToolInput\");\n\nexport const useToolMetadata =\n missingHook<typeof import(\"./index.mcp.js\").useToolMetadata>(\n \"useToolMetadata\"\n );\n\nexport const useToolName =\n missingHook<typeof import(\"./index.mcp.js\").useToolName>(\"useToolName\");\n\n/** @experimental */\nexport const createHydrationUtils = missingHook<\n typeof import(\"./index.mcp.js\").createHydrationUtils\n>(\"createHydrationUtils\");\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,0EAA0E;AAC1E,UAAU;AACV,MAAM,CAAC,MAAM,MAAM,GACjB,WAAW,CAAyC,QAAQ,CAAC,CAAC;AAEhE,MAAM,CAAC,MAAM,cAAc,GACzB,WAAW,CAAiD,gBAAgB,CAAC,CAAC;AAEhF;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GACvB,WAAW,CAA+C,cAAc,CAAC,CAAC;AAE5E,MAAM,CAAC,MAAM,eAAe,GAC1B,WAAW,CACT,iBAAiB,CAClB,CAAC;AAEJ;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GACtB,WAAW,CAA8C,aAAa,CAAC,CAAC;AAE1E,MAAM,CAAC,MAAM,WAAW,GACtB,WAAW,CAA8C,aAAa,CAAC,CAAC;AAE1E,oBAAoB;AACpB,MAAM,CAAC,MAAM,oBAAoB,GAAG,WAAW,CAE7C,sBAAsB,CAAC,CAAC","sourcesContent":["import { missingHook } from \"./missingHook.js\";\n\nexport { ApolloProvider } from \"./ApolloProvider.js\";\nexport { reactive } from \"./reactive.js\";\nexport type { Reactive } from \"./reactive.js\";\n\n// Use `mcp` related types since these are the most common between the two\n// targets\nexport const useApp =\n missingHook<typeof import(\"./index.mcp.js\").useApp>(\"useApp\");\n\nexport const useHostContext =\n missingHook<typeof import(\"./index.mcp.js\").useHostContext>(\"useHostContext\");\n\n/**\n * @deprecated Please use the `useToolInfo` hook. `useToolInput` will be removed\n * in the next major version.\n */\nexport const useToolInput =\n missingHook<typeof import(\"./index.mcp.js\").useToolInput>(\"useToolInput\");\n\nexport const useToolMetadata =\n missingHook<typeof import(\"./index.mcp.js\").useToolMetadata>(\n \"useToolMetadata\"\n );\n\n/**\n * @deprecated Please use the `useToolInfo` hook. `useToolName` will be removed\n * in the next major version.\n */\nexport const useToolName =\n missingHook<typeof import(\"./index.mcp.js\").useToolName>(\"useToolName\");\n\nexport const useToolInfo =\n missingHook<typeof import(\"./index.mcp.js\").useToolInfo>(\"useToolInfo\");\n\n/** @experimental */\nexport const createHydrationUtils = missingHook<\n typeof import(\"./index.mcp.js\").createHydrationUtils\n>(\"createHydrationUtils\");\n"]}
@@ -1,3 +1,3 @@
1
1
  export * from "./index.js";
2
- export { useApp, useToolInput, createHydrationUtils, useToolMetadata, useToolName, } from "../mcp/react/index.js";
2
+ export { useApp, useHostContext, useToolInput, useToolInfo, createHydrationUtils, useToolMetadata, useToolName, } from "../mcp/react/index.js";
3
3
  //# sourceMappingURL=index.mcp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mcp.d.ts","sourceRoot":"","sources":["../../src/react/index.mcp.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,MAAM,EACN,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,WAAW,GACZ,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.mcp.d.ts","sourceRoot":"","sources":["../../src/react/index.mcp.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,MAAM,EACN,cAAc,EACd,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,eAAe,EACf,WAAW,GACZ,MAAM,uBAAuB,CAAC"}
@@ -1,3 +1,3 @@
1
1
  export * from "./index.js";
2
- export { useApp, useToolInput, createHydrationUtils, useToolMetadata, useToolName, } from "../mcp/react/index.js";
2
+ export { useApp, useHostContext, useToolInput, useToolInfo, createHydrationUtils, useToolMetadata, useToolName, } from "../mcp/react/index.js";
3
3
  //# sourceMappingURL=index.mcp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mcp.js","sourceRoot":"","sources":["../../src/react/index.mcp.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,MAAM,EACN,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,WAAW,GACZ,MAAM,uBAAuB,CAAC","sourcesContent":["export * from \"./index.js\";\nexport {\n useApp,\n useToolInput,\n createHydrationUtils,\n useToolMetadata,\n useToolName,\n} from \"../mcp/react/index.js\";\n"]}
1
+ {"version":3,"file":"index.mcp.js","sourceRoot":"","sources":["../../src/react/index.mcp.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,MAAM,EACN,cAAc,EACd,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,eAAe,EACf,WAAW,GACZ,MAAM,uBAAuB,CAAC","sourcesContent":["export * from \"./index.js\";\nexport {\n useApp,\n useHostContext,\n useToolInput,\n useToolInfo,\n createHydrationUtils,\n useToolMetadata,\n useToolName,\n} from \"../mcp/react/index.js\";\n"]}
@@ -1,3 +1,3 @@
1
1
  export * from "./index.js";
2
- export { useApp, useToolInput, createHydrationUtils, useToolMetadata, useToolName, } from "../openai/react/index.js";
2
+ export { useApp, useHostContext, useToolInput, useToolInfo, createHydrationUtils, useToolMetadata, useToolName, } from "../openai/react/index.js";
3
3
  //# sourceMappingURL=index.openai.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.openai.d.ts","sourceRoot":"","sources":["../../src/react/index.openai.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,MAAM,EACN,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,WAAW,GACZ,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.openai.d.ts","sourceRoot":"","sources":["../../src/react/index.openai.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,MAAM,EACN,cAAc,EACd,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,eAAe,EACf,WAAW,GACZ,MAAM,0BAA0B,CAAC"}
@@ -1,3 +1,3 @@
1
1
  export * from "./index.js";
2
- export { useApp, useToolInput, createHydrationUtils, useToolMetadata, useToolName, } from "../openai/react/index.js";
2
+ export { useApp, useHostContext, useToolInput, useToolInfo, createHydrationUtils, useToolMetadata, useToolName, } from "../openai/react/index.js";
3
3
  //# sourceMappingURL=index.openai.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.openai.js","sourceRoot":"","sources":["../../src/react/index.openai.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,MAAM,EACN,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,WAAW,GACZ,MAAM,0BAA0B,CAAC","sourcesContent":["export * from \"./index.js\";\nexport {\n useApp,\n useToolInput,\n createHydrationUtils,\n useToolMetadata,\n useToolName,\n} from \"../openai/react/index.js\";\n"]}
1
+ {"version":3,"file":"index.openai.js","sourceRoot":"","sources":["../../src/react/index.openai.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,MAAM,EACN,cAAc,EACd,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,eAAe,EACf,WAAW,GACZ,MAAM,0BAA0B,CAAC","sourcesContent":["export * from \"./index.js\";\nexport {\n useApp,\n useHostContext,\n useToolInput,\n useToolInfo,\n createHydrationUtils,\n useToolMetadata,\n useToolName,\n} from \"../openai/react/index.js\";\n"]}
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
+ "allowArbitraryExtensions": true,
4
+ "resolveJsonModule": true,
3
5
  "moduleSuffixes": [".mcp", ".openai", ""]
4
6
  }
5
7
  }
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
+ "allowArbitraryExtensions": true,
4
+ "resolveJsonModule": true,
3
5
  "customConditions": ["mcp"],
4
6
  "moduleSuffixes": [".mcp", ""]
5
7
  }
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
+ "allowArbitraryExtensions": true,
4
+ "resolveJsonModule": true,
3
5
  "customConditions": ["openai"],
4
6
  "types": ["@apollo/client-ai-apps/openai/globals"],
5
7
  "moduleSuffixes": [".openai", ""]
@@ -41,6 +41,7 @@ export type ManifestExtraInput = {
41
41
  type: "string" | "boolean" | "number";
42
42
  };
43
43
  export type ManifestCsp = {
44
+ baseUriDomains: string[];
44
45
  connectDomains: string[];
45
46
  frameDomains: string[];
46
47
  redirectDomains: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"application-manifest.d.ts","sourceRoot":"","sources":["../../src/types/application-manifest.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,wBAAwB,CAAC;IACjC,OAAO,EAAE,GAAG,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EACJ,MAAM,GACN;QACE,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACN,UAAU,EAAE,iBAAiB,EAAE,CAAC;IAChC,GAAG,EAAE,WAAW,CAAC;IACjB,cAAc,CAAC,EAAE,sBAAsB,CAAC;IACxC,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE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AAI,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"application-manifest.js","sourceRoot":"","sources":["../../src/types/application-manifest.ts"],"names":[],"mappings":"","sourcesContent":["export type ApplicationManifest = {\n format: \"apollo-ai-app-manifest\";\n version: \"1\";\n appVersion: string;\n name: string;\n description: string;\n hash: string;\n resource:\n | string\n | {\n mcp?: string;\n openai?: string;\n };\n operations: ManifestOperation[];\n csp: ManifestCsp;\n widgetSettings?: ManifestWidgetSettings;\n labels?: ManifestLabels;\n};\n\nexport type ManifestOperation = {\n id: string;\n name: string;\n type: \"query\" | \"mutation\";\n body: string;\n variables?: Record<string, string | undefined>;\n prefetch: boolean;\n prefetchID?: string;\n tools: ManifestTool[];\n};\n\nexport type ManifestTool = {\n name: string;\n description: string;\n extraInputs?: ManifestExtraInput[];\n labels?: ManifestLabels;\n};\n\nexport type ManifestWidgetSettings = {\n description?: string;\n domain?: string;\n prefersBorder?: boolean;\n};\n\nexport type ManifestExtraInput = {\n name: string;\n description: string;\n type: \"string\" | \"boolean\" | \"number\";\n};\n\nexport type ManifestCsp = {\n connectDomains: string[];\n frameDomains: string[];\n redirectDomains: string[];\n resourceDomains: string[];\n};\n\nexport type ManifestLabels = {\n \"toolInvocation/invoking\"?: string;\n \"toolInvocation/invoked\"?: string;\n};\n"]}
1
+ {"version":3,"file":"application-manifest.js","sourceRoot":"","sources":["../../src/types/application-manifest.ts"],"names":[],"mappings":"","sourcesContent":["export type ApplicationManifest = {\n format: \"apollo-ai-app-manifest\";\n version: \"1\";\n appVersion: string;\n name: string;\n description: string;\n hash: string;\n resource:\n | string\n | {\n mcp?: string;\n openai?: string;\n };\n operations: ManifestOperation[];\n csp: ManifestCsp;\n widgetSettings?: ManifestWidgetSettings;\n labels?: ManifestLabels;\n};\n\nexport type ManifestOperation = {\n id: string;\n name: string;\n type: \"query\" | \"mutation\";\n body: string;\n variables?: Record<string, string | undefined>;\n prefetch: boolean;\n prefetchID?: string;\n tools: ManifestTool[];\n};\n\nexport type ManifestTool = {\n name: string;\n description: string;\n extraInputs?: ManifestExtraInput[];\n labels?: ManifestLabels;\n};\n\nexport type ManifestWidgetSettings = {\n description?: string;\n domain?: string;\n prefersBorder?: boolean;\n};\n\nexport type ManifestExtraInput = {\n name: string;\n description: string;\n type: \"string\" | \"boolean\" | \"number\";\n};\n\nexport type ManifestCsp = {\n baseUriDomains: string[];\n connectDomains: string[];\n frameDomains: string[];\n redirectDomains: string[];\n resourceDomains: string[];\n};\n\nexport type ManifestLabels = {\n \"toolInvocation/invoking\"?: string;\n \"toolInvocation/invoked\"?: string;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../src/vite/__tests__/utilities/build.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,MAAM,CAAC;AAE9D,KAAK,OAAO,GAAG,WAAW,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC;AAEpD,wBAAsB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE;;;;;;;;;;;;;;;;;;;qBAkEmmkG,CAAC;;;;;;;;;;;mCAA45C,CAAC;GAlD7knG;AAED,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,YAAY,GAAG,SAAS,CAAC,GAAG;IACrD,OAAO,EAAE,OAAO,CAAC;CAClB,iBA4CF"}
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../src/vite/__tests__/utilities/build.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,MAAM,CAAC;AAE9D,KAAK,OAAO,GAAG,WAAW,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC;AAEpD,wBAAsB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE;;;;;;;;;;;;;;;;;;;qBAiEynkG,CAAC;;;;;;;;;;;mCAA45C,CAAC;GAjDnmnG;AAED,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,YAAY,GAAG,SAAS,CAAC,GAAG;IACrD,OAAO,EAAE,OAAO,CAAC;CAClB,iBA2CF"}
@@ -24,7 +24,6 @@ export async function buildApp(config) {
24
24
  ...config,
25
25
  build: {
26
26
  emptyOutDir: false,
27
- outDir: "dist",
28
27
  ...config.build,
29
28
  rollupOptions: {
30
29
  input: config.build?.rollupOptions?.input ?? "virtual:entry",
@@ -1 +1 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["../../../../src/vite/__tests__/utilities/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,YAAY,EAAqB,MAAM,MAAM,CAAC;AAI9D,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAA2C;IAC3E,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC;QAChC,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE;YACN,IAAI,EAAE,IAAI;YACV,GAAG,MAAM,CAAC,MAAM;SACjB;QACD,GAAG,MAAM;KACV,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,MAAM;QACT,CAA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AM,CAAC,CAAC;oBACrC,CAAC;gBACH,CAAC;aACF;SACF;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { build, createServer, type InlineConfig } from \"vite\";\n\ntype Plugins = NonNullable<InlineConfig[\"plugins\"]>;\n\nexport async function setupServer(config: InlineConfig & { plugins: Plugins }) {\n const server = await createServer({\n configFile: false,\n server: {\n port: 3333,\n ...config.server,\n },\n ...config,\n });\n\n return {\n ...server,\n [Symbol.asyncDispose]() {\n return server.close();\n },\n };\n}\n\nexport async function buildApp(\n config: Omit<InlineConfig, \"configFile\" | \"plugins\"> & {\n plugins: Plugins;\n }\n) {\n await build({\n configFile: false,\n logLevel: \"silent\",\n ...config,\n build: {\n emptyOutDir: false,\n outDir: \"dist\",\n ...config.build,\n rollupOptions: {\n input: config.build?.rollupOptions?.input ?? \"virtual:entry\",\n },\n },\n plugins: [\n ...config.plugins,\n\n // We need to use `fs` to resolve modules to ensure vite uses memfs when\n // building, otherwise we get an ENOENT error for any files written to the\n // virtual filesystem.\n {\n name: \"test:virtual-entry\",\n resolveId(id) {\n if (id === \"virtual:entry\") return id;\n if (id.endsWith(\".html\")) return path.resolve(id);\n\n if (id.startsWith(\"/\")) {\n const resolved = path.resolve(id.slice(1));\n\n if (fs.existsSync(resolved)) {\n return resolved;\n }\n }\n },\n load(id) {\n if (id === \"virtual:entry\") return \"export default {};\";\n\n if (fs.existsSync(id)) {\n return fs.readFileSync(id, \"utf8\");\n }\n },\n },\n ],\n });\n}\n"]}
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../../../src/vite/__tests__/utilities/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,YAAY,EAAqB,MAAM,MAAM,CAAC;AAI9D,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAA2C;IAC3E,M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CAAC,EAAE;oBACL,IAAI,EAAE,KAAK,eAAe;wBAAE,OAAO,oBAAoB,CAAC;oBAExD,IAAI,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC;wBACtB,OAAO,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;oBACrC,CAAC;gBACH,CAAC;aACF;SACF;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { build, createServer, type InlineConfig } from \"vite\";\n\ntype Plugins = NonNullable<InlineConfig[\"plugins\"]>;\n\nexport async function setupServer(config: InlineConfig & { plugins: Plugins }) {\n const server = await createServer({\n configFile: false,\n server: {\n port: 3333,\n ...config.server,\n },\n ...config,\n });\n\n return {\n ...server,\n [Symbol.asyncDispose]() {\n return server.close();\n },\n };\n}\n\nexport async function buildApp(\n config: Omit<InlineConfig, \"configFile\" | \"plugins\"> & {\n plugins: Plugins;\n }\n) {\n await build({\n configFile: false,\n logLevel: \"silent\",\n ...config,\n build: {\n emptyOutDir: false,\n ...config.build,\n rollupOptions: {\n input: config.build?.rollupOptions?.input ?? \"virtual:entry\",\n },\n },\n plugins: [\n ...config.plugins,\n\n // We need to use `fs` to resolve modules to ensure vite uses memfs when\n // building, otherwise we get an ENOENT error for any files written to the\n // virtual filesystem.\n {\n name: \"test:virtual-entry\",\n resolveId(id) {\n if (id === \"virtual:entry\") return id;\n if (id.endsWith(\".html\")) return path.resolve(id);\n\n if (id.startsWith(\"/\")) {\n const resolved = path.resolve(id.slice(1));\n\n if (fs.existsSync(resolved)) {\n return resolved;\n }\n }\n },\n load(id) {\n if (id === \"virtual:entry\") return \"export default {};\";\n\n if (fs.existsSync(id)) {\n return fs.readFileSync(id, \"utf8\");\n }\n },\n },\n ],\n });\n}\n"]}
@@ -6,6 +6,8 @@ export declare namespace apolloClientAiApps {
6
6
  interface Options {
7
7
  targets: Target[];
8
8
  devTarget?: Target | undefined;
9
+ appsOutDir: string;
10
+ schema?: string | undefined;
9
11
  }
10
12
  }
11
13
  export declare function devTarget(target: string | undefined): "mcp" | "openai" | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"apolloClientAiApps.d.ts","sourceRoot":"","sources":["../../src/vite/apolloClientAiApps.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,MAAM,EAEZ,MAAM,MAAM,CAAC;AAId,OAAO,EAA4B,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAoB7E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAKnE,MAAM,CAAC,OAAO,WAAW,kBAAkB,CAAC;IAC1C,KAAY,MAAM,GAAG,wBAAwB,CAAC,SAAS,CAAC;IAExD,UAAiB,OAAO;QACtB,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAChC;CACF;AAgBD,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,gCAOnD;AAQD,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,kBAAkB,CAAC,OAAO,GAClC,MAAM,CAkRR;AA8ED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,CA2CzE"}
1
+ {"version":3,"file":"apolloClientAiApps.d.ts","sourceRoot":"","sources":["../../src/vite/apolloClientAiApps.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,MAAM,EAEZ,MAAM,MAAM,CAAC;AAMd,OAAO,EAA4B,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAqB7E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAenE,MAAM,CAAC,OAAO,WAAW,kBAAkB,CAAC;IAC1C,KAAY,MAAM,GAAG,wBAAwB,CAAC,SAAS,CAAC;IAExD,UAAiB,OAAO;QACtB,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,SAAS,CAAC,EAAE,MAA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