@apollo/client-ai-apps 0.5.2 → 0.5.4

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 (101) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/core/ApolloClient.d.ts +1 -1
  3. package/dist/core/ApolloClient.d.ts.map +1 -1
  4. package/dist/core/ApolloClient.js +1 -1
  5. package/dist/core/ApolloClient.js.map +1 -1
  6. package/dist/mcp/core/ApolloClient.d.ts +6 -1
  7. package/dist/mcp/core/ApolloClient.d.ts.map +1 -1
  8. package/dist/mcp/core/ApolloClient.js +36 -3
  9. package/dist/mcp/core/ApolloClient.js.map +1 -1
  10. package/dist/mcp/core/McpAppManager.d.ts +2 -2
  11. package/dist/mcp/core/McpAppManager.d.ts.map +1 -1
  12. package/dist/mcp/core/McpAppManager.js +3 -3
  13. package/dist/mcp/core/McpAppManager.js.map +1 -1
  14. package/dist/mcp/react/hooks/createHydrationUtils.d.ts +15 -0
  15. package/dist/mcp/react/hooks/createHydrationUtils.d.ts.map +1 -0
  16. package/dist/mcp/react/hooks/createHydrationUtils.js +113 -0
  17. package/dist/mcp/react/hooks/createHydrationUtils.js.map +1 -0
  18. package/dist/mcp/react/index.d.ts +1 -0
  19. package/dist/mcp/react/index.d.ts.map +1 -1
  20. package/dist/mcp/react/index.js +1 -0
  21. package/dist/mcp/react/index.js.map +1 -1
  22. package/dist/openai/core/ApolloClient.d.ts +6 -1
  23. package/dist/openai/core/ApolloClient.d.ts.map +1 -1
  24. package/dist/openai/core/ApolloClient.js +37 -3
  25. package/dist/openai/core/ApolloClient.js.map +1 -1
  26. package/dist/openai/core/McpAppManager.d.ts +2 -2
  27. package/dist/openai/core/McpAppManager.d.ts.map +1 -1
  28. package/dist/openai/core/McpAppManager.js +5 -5
  29. package/dist/openai/core/McpAppManager.js.map +1 -1
  30. package/dist/openai/react/hooks/createHydrationUtils.d.ts +15 -0
  31. package/dist/openai/react/hooks/createHydrationUtils.d.ts.map +1 -0
  32. package/dist/openai/react/hooks/createHydrationUtils.js +113 -0
  33. package/dist/openai/react/hooks/createHydrationUtils.js.map +1 -0
  34. package/dist/openai/react/index.d.ts +1 -0
  35. package/dist/openai/react/index.d.ts.map +1 -1
  36. package/dist/openai/react/index.js +1 -0
  37. package/dist/openai/react/index.js.map +1 -1
  38. package/dist/react/ApolloProvider.js +1 -1
  39. package/dist/react/ApolloProvider.js.map +1 -1
  40. package/dist/react/index.d.ts +4 -0
  41. package/dist/react/index.d.ts.map +1 -1
  42. package/dist/react/index.js +3 -0
  43. package/dist/react/index.js.map +1 -1
  44. package/dist/react/index.mcp.d.ts +1 -1
  45. package/dist/react/index.mcp.d.ts.map +1 -1
  46. package/dist/react/index.mcp.js +1 -1
  47. package/dist/react/index.mcp.js.map +1 -1
  48. package/dist/react/index.openai.d.ts +1 -1
  49. package/dist/react/index.openai.d.ts.map +1 -1
  50. package/dist/react/index.openai.js +1 -1
  51. package/dist/react/index.openai.js.map +1 -1
  52. package/dist/react/reactive.d.ts +9 -0
  53. package/dist/react/reactive.d.ts.map +1 -0
  54. package/dist/react/reactive.js +11 -0
  55. package/dist/react/reactive.js.map +1 -0
  56. package/dist/utilities/getToolNamesFromDocument.d.ts +3 -0
  57. package/dist/utilities/getToolNamesFromDocument.d.ts.map +1 -0
  58. package/dist/utilities/getToolNamesFromDocument.js +12 -0
  59. package/dist/utilities/getToolNamesFromDocument.js.map +1 -0
  60. package/dist/utilities/getVariableNamesFromDocument.d.ts +3 -0
  61. package/dist/utilities/getVariableNamesFromDocument.d.ts.map +1 -0
  62. package/dist/utilities/getVariableNamesFromDocument.js +6 -0
  63. package/dist/utilities/getVariableNamesFromDocument.js.map +1 -0
  64. package/dist/utilities/index.d.ts +3 -0
  65. package/dist/utilities/index.d.ts.map +1 -1
  66. package/dist/utilities/index.js +3 -0
  67. package/dist/utilities/index.js.map +1 -1
  68. package/dist/utilities/warnOnVariableMismatch.d.ts +3 -0
  69. package/dist/utilities/warnOnVariableMismatch.d.ts.map +1 -0
  70. package/dist/utilities/warnOnVariableMismatch.js +10 -0
  71. package/dist/utilities/warnOnVariableMismatch.js.map +1 -0
  72. package/dist/vite/apolloClientAiApps.d.ts.map +1 -1
  73. package/dist/vite/apolloClientAiApps.js +35 -31
  74. package/dist/vite/apolloClientAiApps.js.map +1 -1
  75. package/package.json +2 -1
  76. package/src/core/ApolloClient.ts +1 -1
  77. package/src/mcp/core/ApolloClient.ts +67 -2
  78. package/src/mcp/core/McpAppManager.ts +3 -3
  79. package/src/mcp/core/__tests__/ApolloClient.test.ts +109 -6
  80. package/src/mcp/link/__tests__/ToolCallLink.test.ts +1 -1
  81. package/src/mcp/react/hooks/__tests__/createHydrationUtils.test.tsx +1228 -0
  82. package/src/mcp/react/hooks/createHydrationUtils.ts +182 -0
  83. package/src/mcp/react/index.ts +1 -0
  84. package/src/openai/core/ApolloClient.ts +68 -2
  85. package/src/openai/core/McpAppManager.ts +5 -5
  86. package/src/openai/core/__tests__/ApolloClient.test.ts +113 -7
  87. package/src/openai/react/hooks/__tests__/createHydrationUtils.test.tsx +1333 -0
  88. package/src/openai/react/hooks/createHydrationUtils.ts +182 -0
  89. package/src/openai/react/index.ts +1 -0
  90. package/src/react/ApolloProvider.tsx +1 -1
  91. package/src/react/index.mcp.ts +1 -0
  92. package/src/react/index.openai.ts +1 -0
  93. package/src/react/index.ts +7 -0
  94. package/src/react/reactive.ts +19 -0
  95. package/src/testing/internal/mcp/graphqlToolResult.ts +5 -5
  96. package/src/utilities/getToolNamesFromDocument.ts +15 -0
  97. package/src/utilities/getVariableNamesFromDocument.ts +9 -0
  98. package/src/utilities/index.ts +3 -0
  99. package/src/utilities/warnOnVariableMismatch.ts +20 -0
  100. package/src/vite/__tests__/apolloClientAiApps.test.ts +183 -2
  101. package/src/vite/apolloClientAiApps.ts +46 -40
@@ -10,7 +10,7 @@ export declare class McpAppManager {
10
10
  get toolName(): string | undefined;
11
11
  get toolMetadata(): Record<string, unknown> | null;
12
12
  get toolInput(): Record<string, unknown> | undefined;
13
- waitForInitialization: (() => Promise<{
13
+ connect: (() => Promise<{
14
14
  toolName: string | undefined;
15
15
  args: Record<string, unknown> | undefined;
16
16
  result: FormattedExecutionResult;
@@ -23,6 +23,6 @@ export declare class McpAppManager {
23
23
  query: DocumentNode;
24
24
  variables: OperationVariables | undefined;
25
25
  }): Promise<FormattedExecutionResult<import("graphql/jsutils/ObjMap").ObjMap<unknown>, import("graphql/jsutils/ObjMap").ObjMap<unknown>>>;
26
- private connect;
26
+ private connectToHost;
27
27
  }
28
28
  //# sourceMappingURL=McpAppManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"McpAppManager.d.ts","sourceRoot":"","sources":["../../../src/openai/core/McpAppManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAwB,MAAM,gCAAgC,CAAC;AAE3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AASvE,gBAAgB;AAChB,qBAAa,aAAa;;IACxB,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;gBAMN,QAAQ,EAAE,mBAAmB;IAIzC,IAAI,QAAQ,uBAEX;IAED,IAAI,YAAY,mCAEf;IAED,IAAI,SAAS,wCAEZ;IAED,qBAAqB;;;;;;;MAqClB;IAEH,KAAK;IAIC,YAAY,CAAC,EACjB,KAAK,EACL,SAAS,GACV,EAAE;QACD,KAAK,EAAE,YAAY,CAAC;QACpB,SAAS,EAAE,kBAAkB,GAAG,SAAS,CAAC;KAC3C;YASa,OAAO;CAWtB"}
1
+ {"version":3,"file":"McpAppManager.d.ts","sourceRoot":"","sources":["../../../src/openai/core/McpAppManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAwB,MAAM,gCAAgC,CAAC;AAE3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AASvE,gBAAgB;AAChB,qBAAa,aAAa;;IACxB,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;gBAMN,QAAQ,EAAE,mBAAmB;IAIzC,IAAI,QAAQ,uBAEX;IAED,IAAI,YAAY,mCAEf;IAED,IAAI,SAAS,wCAEZ;IAED,OAAO;;;;;;;MAqCJ;IAEH,KAAK;IAIC,YAAY,CAAC,EACjB,KAAK,EACL,SAAS,GACV,EAAE;QACD,KAAK,EAAE,YAAY,CAAC;QACpB,SAAS,EAAE,kBAAkB,GAAG,SAAS,CAAC;KAC3C;YASa,aAAa;CAW5B"}
@@ -19,12 +19,12 @@ export class McpAppManager {
19
19
  get toolInput() {
20
20
  return this.#toolInput;
21
21
  }
22
- waitForInitialization = cacheAsync(async () => {
22
+ connect = cacheAsync(async () => {
23
23
  let toolResult = promiseWithResolvers();
24
24
  this.app.ontoolresult = (params) => {
25
25
  toolResult.resolve(params);
26
26
  };
27
- await this.connect();
27
+ await this.connectToHost();
28
28
  const { structuredContent } = await toolResult.promise;
29
29
  this.#toolName = this.app.getHostContext()?.toolInfo?.tool.name;
30
30
  // OpenAI is not consistent about sending `ui/notifications/tool-input`.
@@ -32,12 +32,12 @@ export class McpAppManager {
32
32
  // before we get the tool result (which should always happen and at most
33
33
  // once according to the spec). Rather than relying on the
34
34
  // `ui/notifications/tool-input` notification to set the tool input value,
35
- // we read from `window.openai.toolInput so that we hvae the most recent
35
+ // we read from `window.openai.toolInput so that we have the most recent
36
36
  // set value.
37
37
  //
38
38
  // When OpenAI fixes this issue and sends `ui/notifications/tool-input`
39
39
  // consistently according to the MCP Apps specification, this can be
40
- // reverrted to use the `app.ontoolinput` callback.
40
+ // reverted to use the `app.ontoolinput` callback.
41
41
  this.#toolInput = window.openai.toolInput;
42
42
  // OpenAI doesn't provide access to `_meta`, so we need to use
43
43
  // window.openai.toolResponseMetadata directly
@@ -58,7 +58,7 @@ export class McpAppManager {
58
58
  }));
59
59
  return result.structuredContent;
60
60
  }
61
- async connect() {
61
+ async connectToHost() {
62
62
  try {
63
63
  return await this.app.connect(new PostMessageTransport(window.parent, window.parent));
64
64
  }
@@ -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,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,qBAAqB,GAAG,UAAU,CAAC,KAAK,IAAI,EAAE;QAC5C,IAAI,UAAU,GAAG,oBAAoB,EAAsC,CAAC;QAE5E,IAAI,CAAC,GAAG,CAAC,YAAY,GAAG,CAAC,MAAM,EAAE,EAAE;YACjC,UAAU,CAAC,OAA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C,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 waitForInitialization = 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.connect();\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 hvae 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 // reverrted 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 connect() {\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,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,C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C,EACjB,KAAK,EACL,SAAS,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"]}
@@ -0,0 +1,15 @@
1
+ import type { DocumentNode, OperationVariables, TypedDocumentNode } from "@apollo/client";
2
+ import type { Reactive } from "../../../react/reactive.js";
3
+ type HydratedVariablesInput<TVariables> = {
4
+ [K in keyof TVariables]: TVariables[K] | Reactive<TVariables[K]>;
5
+ };
6
+ type StateVariables<TVariables, Input> = {
7
+ [K in keyof TVariables as K extends keyof Input ? Input[K] extends Reactive<any> ? never : K : K]: K extends keyof TVariables ? TVariables[K] : never;
8
+ };
9
+ type SetVariables<TState> = (update: Partial<TState> | ((prev: TState) => Partial<TState>)) => void;
10
+ /** @experimental */
11
+ export declare function createHydrationUtils<TVariables extends OperationVariables = OperationVariables>(document: TypedDocumentNode<any, TVariables> | DocumentNode): {
12
+ useHydratedVariables: <TInputVariables extends HydratedVariablesInput<TVariables>>(variables: TInputVariables & Record<Exclude<keyof TInputVariables, keyof TVariables>, never>) => [variables: TVariables, setVariables: SetVariables<StateVariables<TVariables, TInputVariables>>];
13
+ };
14
+ export {};
15
+ //# sourceMappingURL=createHydrationUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createHydrationUtils.d.ts","sourceRoot":"","sources":["../../../../src/openai/react/hooks/createHydrationUtils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AAIxB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAQ3D,KAAK,sBAAsB,CAAC,UAAU,IAAI;KACvC,CAAC,IAAI,MAAM,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;CACjE,CAAC;AAEF,KAAK,cAAc,CAAC,UAAU,EAAE,KAAK,IAAI;KACtC,CAAC,IAAI,MAAM,UAAU,IAAI,CAAC,SAAS,MAAM,KAAK,GAC7C,KAAK,CAAC,CAAC,CAAC,SAAS,QAAQ,CAAC,GAAG,CAAC,GAC5B,KAAK,GACL,CAAC,GACH,CAAC,GAAG,CAAC,SAAS,MAAM,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,KAAK;CACzD,CAAC;AAEF,KAAK,YAAY,CAAC,MAAM,IAAI,CAC1B,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC,KAC1D,IAAI,CAAC;AAEV,oBAAoB;AACpB,wBAAgB,oBAAoB,CAClC,UAAU,SAAS,kBAAkB,GAAG,kBAAkB,EAC1D,QAAQ,EAAE,iBAAiB,CAAC,GAAG,EAAE,UAAU,CAAC,GAAG,YAAY;2BAKzD,eAAe,SAAS,sBAAsB,CAAC,UAAU,CAAC,aAE/C,eAAe,GACxB,MAAM,CAAC,OAAO,CAAC,MAAM,eAAe,EAAE,MAAM,UAAU,CAAC,EAAE,KAAK,CAAC,KAChE,CACD,SAAS,EAAE,UAAU,EACrB,YAAY,EAAE,YAAY,CAAC,cAAc,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC,CACxE;EAqIF"}
@@ -0,0 +1,113 @@
1
+ import { useState, useCallback, useRef, useMemo, useLayoutEffect } from "react";
2
+ import { useApolloClient } from "./useApolloClient.js";
3
+ import { useToolName } from "./useToolName.js";
4
+ import { isReactive } from "../../../react/reactive.js";
5
+ import { equal } from "@wry/equality";
6
+ import { __DEV__ } from "@apollo/client/utilities/environment";
7
+ import { getToolNamesFromDocument, getVariableNamesFromDocument, } from "../../../utilities/index.js";
8
+ /** @experimental */
9
+ export function createHydrationUtils(document) {
10
+ const documentToolNames = getToolNamesFromDocument(document);
11
+ const variableNames = getVariableNamesFromDocument(document);
12
+ function useHydratedVariables(variables) {
13
+ const client = useApolloClient();
14
+ const toolName = useToolName();
15
+ const [toolInput] = useState(() => client.toolInput);
16
+ const toolMatches = toolInput !== undefined &&
17
+ toolName !== undefined &&
18
+ documentToolNames.has(toolName);
19
+ const [stateVars, setStateVars] = useState(() => {
20
+ const values = {};
21
+ for (const [key, value] of Object.entries(toolMatches ? toolInput : variables)) {
22
+ if (variableNames.has(key) && !isReactive(value)) {
23
+ values[key] = value;
24
+ }
25
+ }
26
+ return values;
27
+ });
28
+ const [initialReactiveValues] = useState(() => {
29
+ const values = {};
30
+ for (const [key, value] of Object.entries(variables)) {
31
+ if (variableNames.has(key) && isReactive(value)) {
32
+ values[key] = value.value;
33
+ }
34
+ }
35
+ return values;
36
+ });
37
+ const [reactiveVars, setReactiveVars] = useState(() => {
38
+ const values = {};
39
+ for (const [key, value] of Object.entries(initialReactiveValues)) {
40
+ if (toolMatches && key in toolInput) {
41
+ values[key] = toolInput[key];
42
+ }
43
+ else if (!toolMatches) {
44
+ values[key] = value;
45
+ }
46
+ }
47
+ return values;
48
+ });
49
+ const changedKeysRef = useRef(new Set());
50
+ const nextReactiveVars = {};
51
+ for (const [key, value] of Object.entries(variables)) {
52
+ if (!variableNames.has(key) || !isReactive(value))
53
+ continue;
54
+ const hasChanged = changedKeysRef.current.has(key) ||
55
+ !equal(value.value, initialReactiveValues[key]);
56
+ if (toolMatches && !hasChanged) {
57
+ if (key in toolInput) {
58
+ nextReactiveVars[key] = toolInput[key];
59
+ }
60
+ }
61
+ else {
62
+ nextReactiveVars[key] = value.value;
63
+ }
64
+ }
65
+ if (!equal(nextReactiveVars, reactiveVars)) {
66
+ setReactiveVars(nextReactiveVars);
67
+ }
68
+ // Clear the tool input after first mount so that remounting the component
69
+ // uses the user-provided variables rather than the hydrated tool input.
70
+ // This runs once on mount; watchQuery also clears it when useQuery is
71
+ // present, so both paths are idempotent.
72
+ useLayoutEffect(() => {
73
+ if (toolMatches) {
74
+ client.clearToolInput();
75
+ }
76
+ // eslint-disable-next-line react-hooks/exhaustive-deps
77
+ }, []);
78
+ useLayoutEffect(() => {
79
+ for (const [key, value] of Object.entries(variables)) {
80
+ if (variableNames.has(key) &&
81
+ isReactive(value) &&
82
+ !changedKeysRef.current.has(key) &&
83
+ !equal(value.value, initialReactiveValues[key])) {
84
+ changedKeysRef.current.add(key);
85
+ }
86
+ }
87
+ });
88
+ const resolvedVariables = useMemo(() => {
89
+ return { ...stateVars, ...reactiveVars };
90
+ }, [stateVars, reactiveVars]);
91
+ const setVariables = useCallback((update) => {
92
+ setStateVars((prev) => {
93
+ const updates = typeof update === "function" ? update(prev) : update;
94
+ const filtered = Object.fromEntries(Object.entries(updates).filter(([key]) => {
95
+ if (key in initialReactiveValues) {
96
+ if (__DEV__) {
97
+ console.warn(`Attempted to set reactive variable "${key}" via setVariables. ` +
98
+ `Reactive variables are read-only and are ignored. `);
99
+ }
100
+ return false;
101
+ }
102
+ return true;
103
+ }));
104
+ if (Object.keys(filtered).length === 0)
105
+ return prev;
106
+ return { ...prev, ...filtered };
107
+ });
108
+ }, []);
109
+ return [resolvedVariables, setVariables];
110
+ }
111
+ return { useHydratedVariables };
112
+ }
113
+ //# sourceMappingURL=createHydrationUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createHydrationUtils.js","sourceRoot":"","sources":["../../../../src/openai/react/hooks/createHydrationUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAMhF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAC/D,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,6BAA6B,CAAC;AAkBrC,oBAAoB;AACpB,MAAM,UAAU,oBAAoB,CAElC,QAA2D;IAC3D,MAAM,iBAAiB,GAAG,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IAC7D,MAAM,aAAa,GAAG,4BAA4B,CAAC,QAAQ,CAAC,CAAC;IAE7D,SAAS,oBAAoB,CAG3B,SACiE;QAKjE,MAAM,MAAM,GAAG,eAAe,EA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,WAAW,CACjC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE;oBACvC,IAAI,GAAG,IAAI,qBAAqB,EAAE,CAAC;wBACjC,IAAI,OAAO,EAAE,CAAC;4BACZ,OAAO,CAAC,IAAI,CACV,uCAAuC,GAAG,sBAAsB;gCAC9D,oDAAoD,CACvD,CAAC;wBACJ,CAAC;wBACD,OAAO,KAAK,CAAC;oBACf,CAAC;oBACD,OAAO,IAAI,CAAC;gBACd,CAAC,CAAC,CACH,CAAC;gBAEF,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC;oBAAE,OAAO,IAAI,CAAC;gBAEpD,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,EAAE,CAAC;YAClC,CAAC,CAAC,CAAC;QACL,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,OAAO,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC;IAC3C,CAAC;IAED,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAClC,CAAC","sourcesContent":["import { useState, useCallback, useRef, useMemo, useLayoutEffect } from \"react\";\nimport type {\n DocumentNode,\n OperationVariables,\n TypedDocumentNode,\n} from \"@apollo/client\";\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport { useToolName } from \"./useToolName.js\";\nimport { isReactive } from \"../../../react/reactive.js\";\nimport type { Reactive } from \"../../../react/reactive.js\";\nimport { equal } from \"@wry/equality\";\nimport { __DEV__ } from \"@apollo/client/utilities/environment\";\nimport {\n getToolNamesFromDocument,\n getVariableNamesFromDocument,\n} from \"../../../utilities/index.js\";\n\ntype HydratedVariablesInput<TVariables> = {\n [K in keyof TVariables]: TVariables[K] | Reactive<TVariables[K]>;\n};\n\ntype StateVariables<TVariables, Input> = {\n [K in keyof TVariables as K extends keyof Input ?\n Input[K] extends Reactive<any> ?\n never\n : K\n : K]: K extends keyof TVariables ? TVariables[K] : never;\n};\n\ntype SetVariables<TState> = (\n update: Partial<TState> | ((prev: TState) => Partial<TState>)\n) => void;\n\n/** @experimental */\nexport function createHydrationUtils<\n TVariables extends OperationVariables = OperationVariables,\n>(document: TypedDocumentNode<any, TVariables> | DocumentNode) {\n const documentToolNames = getToolNamesFromDocument(document);\n const variableNames = getVariableNamesFromDocument(document);\n\n function useHydratedVariables<\n TInputVariables extends HydratedVariablesInput<TVariables>,\n >(\n variables: TInputVariables &\n Record<Exclude<keyof TInputVariables, keyof TVariables>, never>\n ): [\n variables: TVariables,\n setVariables: SetVariables<StateVariables<TVariables, TInputVariables>>,\n ] {\n const client = useApolloClient();\n const toolName = useToolName();\n const [toolInput] = useState(() => client.toolInput);\n\n const toolMatches =\n toolInput !== undefined &&\n toolName !== undefined &&\n documentToolNames.has(toolName);\n\n const [stateVars, setStateVars] = useState<Record<string, unknown>>(() => {\n const values: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(\n toolMatches ? toolInput : variables\n )) {\n if (variableNames.has(key) && !isReactive(value)) {\n values[key] = value;\n }\n }\n\n return values;\n });\n\n const [initialReactiveValues] = useState<Record<string, unknown>>(() => {\n const values: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(variables)) {\n if (variableNames.has(key) && isReactive(value)) {\n values[key] = value.value;\n }\n }\n\n return values;\n });\n\n const [reactiveVars, setReactiveVars] = useState(() => {\n const values: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(initialReactiveValues)) {\n if (toolMatches && key in toolInput) {\n values[key] = toolInput[key];\n } else if (!toolMatches) {\n values[key] = value;\n }\n }\n\n return values;\n });\n\n const changedKeysRef = useRef(new Set<string>());\n const nextReactiveVars: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(variables)) {\n if (!variableNames.has(key) || !isReactive(value)) continue;\n\n const hasChanged =\n changedKeysRef.current.has(key) ||\n !equal(value.value, initialReactiveValues[key]);\n\n if (toolMatches && !hasChanged) {\n if (key in toolInput) {\n nextReactiveVars[key] = toolInput[key];\n }\n } else {\n nextReactiveVars[key] = value.value;\n }\n }\n\n if (!equal(nextReactiveVars, reactiveVars)) {\n setReactiveVars(nextReactiveVars);\n }\n\n // Clear the tool input after first mount so that remounting the component\n // uses the user-provided variables rather than the hydrated tool input.\n // This runs once on mount; watchQuery also clears it when useQuery is\n // present, so both paths are idempotent.\n useLayoutEffect(() => {\n if (toolMatches) {\n client.clearToolInput();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useLayoutEffect(() => {\n for (const [key, value] of Object.entries(variables)) {\n if (\n variableNames.has(key) &&\n isReactive(value) &&\n !changedKeysRef.current.has(key) &&\n !equal(value.value, initialReactiveValues[key])\n ) {\n changedKeysRef.current.add(key);\n }\n }\n });\n\n const resolvedVariables = useMemo(() => {\n return { ...stateVars, ...reactiveVars } as TVariables;\n }, [stateVars, reactiveVars]);\n\n const setVariables = useCallback<\n SetVariables<StateVariables<TVariables, TInputVariables>>\n >((update) => {\n setStateVars((prev) => {\n const updates =\n typeof update === \"function\" ? update(prev as any) : update;\n\n const filtered = Object.fromEntries(\n Object.entries(updates).filter(([key]) => {\n if (key in initialReactiveValues) {\n if (__DEV__) {\n console.warn(\n `Attempted to set reactive variable \"${key}\" via setVariables. ` +\n `Reactive variables are read-only and are ignored. `\n );\n }\n return false;\n }\n return true;\n })\n );\n\n if (Object.keys(filtered).length === 0) return prev;\n\n return { ...prev, ...filtered };\n });\n }, []);\n\n return [resolvedVariables, setVariables];\n }\n\n return { useHydratedVariables };\n}\n"]}
@@ -2,5 +2,6 @@ export { useApp } from "./hooks/useApp.js";
2
2
  export { useToolName } from "./hooks/useToolName.js";
3
3
  export { useToolMetadata } from "./hooks/useToolMetadata.js";
4
4
  export { useToolInput } from "./hooks/useToolInput.js";
5
+ export { createHydrationUtils } from "./hooks/createHydrationUtils.js";
5
6
  export { useWidgetState } from "./hooks/useWidgetState.js";
6
7
  //# 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,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,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"}
@@ -2,5 +2,6 @@ export { useApp } from "./hooks/useApp.js";
2
2
  export { useToolName } from "./hooks/useToolName.js";
3
3
  export { useToolMetadata } from "./hooks/useToolMetadata.js";
4
4
  export { useToolInput } from "./hooks/useToolInput.js";
5
+ export { createHydrationUtils } from "./hooks/createHydrationUtils.js";
5
6
  export { useWidgetState } from "./hooks/useWidgetState.js";
6
7
  //# 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,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 { 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,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"]}
@@ -9,7 +9,7 @@ export function ApolloProvider({ children, client }) {
9
9
  if (__DEV__) {
10
10
  invariant(client[aiClientSymbol], 'The "client" instance provided to <ApolloProvider /> is the wrong instance. You might have imported `ApolloClient` from `@apollo/client`. Please import `ApolloClient` from `@apollo/client-ai-apps` instead.');
11
11
  }
12
- use(client.waitForInitialization());
12
+ use(client.connect());
13
13
  return (_jsx(BaseApolloProvider, { client: client, children: children }));
14
14
  }
15
15
  //# sourceMappingURL=ApolloProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ApolloProvider.js","sourceRoot":"","sources":["../../src/react/ApolloProvider.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE5E,OAAO,EAAE,YAAY,IAAI,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpF,OAAO,EAAE,YAAY,IAAI,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9E,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAWlE,MAAM,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAwB;IACvE,IAAI,OAAO,EAAE,CAAC;QACZ,SAAS,CACP,MAAM,CAAC,cAAc,CAAC,EACtB,+MAA+M,CAChN,CAAC;IACJ,CAAC;IAED,GAAG,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC,CAAC;IAEpC,OAAO,CACL,KAAC,kBAAkB,IAAC,MAAM,EAAE,MAA0B,YACnD,QAAQ,GACU,CACtB,CAAC;AACJ,CAAC","sourcesContent":["import type { ReactNode } from \"react\";\nimport { use } from \"react\";\nimport { ApolloProvider as BaseApolloProvider } from \"@apollo/client/react\";\nimport type { ApolloClient as BaseApolloClient } from \"@apollo/client\";\nimport { ApolloClient as OpenAiApolloClient } from \"../openai/core/ApolloClient.js\";\nimport { ApolloClient as McpApolloClient } from \"../mcp/core/ApolloClient.js\";\nimport type { ApolloClient as FallbackApolloClient } from \"../core/ApolloClient.js\";\nimport { __DEV__ } from \"@apollo/client/utilities/environment\";\nimport { aiClientSymbol, invariant } from \"../utilities/index.js\";\n\ntype ApolloClient = OpenAiApolloClient | McpApolloClient | FallbackApolloClient;\n\nexport declare namespace ApolloProvider {\n export interface Props {\n children?: ReactNode;\n client: ApolloClient;\n }\n}\n\nexport function ApolloProvider({ children, client }: ApolloProvider.Props) {\n if (__DEV__) {\n invariant(\n client[aiClientSymbol],\n 'The \"client\" instance provided to <ApolloProvider /> is the wrong instance. You might have imported `ApolloClient` from `@apollo/client`. Please import `ApolloClient` from `@apollo/client-ai-apps` instead.'\n );\n }\n\n use(client.waitForInitialization());\n\n return (\n <BaseApolloProvider client={client as BaseApolloClient}>\n {children}\n </BaseApolloProvider>\n );\n}\n"]}
1
+ {"version":3,"file":"ApolloProvider.js","sourceRoot":"","sources":["../../src/react/ApolloProvider.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE5E,OAAO,EAAE,YAAY,IAAI,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpF,OAAO,EAAE,YAAY,IAAI,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9E,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAWlE,MAAM,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAwB;IACvE,IAAI,OAAO,EAAE,CAAC;QACZ,SAAS,CACP,MAAM,CAAC,cAAc,CAAC,EACtB,+MAA+M,CAChN,CAAC;IACJ,CAAC;IAED,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IAEtB,OAAO,CACL,KAAC,kBAAkB,IAAC,MAAM,EAAE,MAA0B,YACnD,QAAQ,GACU,CACtB,CAAC;AACJ,CAAC","sourcesContent":["import type { ReactNode } from \"react\";\nimport { use } from \"react\";\nimport { ApolloProvider as BaseApolloProvider } from \"@apollo/client/react\";\nimport type { ApolloClient as BaseApolloClient } from \"@apollo/client\";\nimport { ApolloClient as OpenAiApolloClient } from \"../openai/core/ApolloClient.js\";\nimport { ApolloClient as McpApolloClient } from \"../mcp/core/ApolloClient.js\";\nimport type { ApolloClient as FallbackApolloClient } from \"../core/ApolloClient.js\";\nimport { __DEV__ } from \"@apollo/client/utilities/environment\";\nimport { aiClientSymbol, invariant } from \"../utilities/index.js\";\n\ntype ApolloClient = OpenAiApolloClient | McpApolloClient | FallbackApolloClient;\n\nexport declare namespace ApolloProvider {\n export interface Props {\n children?: ReactNode;\n client: ApolloClient;\n }\n}\n\nexport function ApolloProvider({ children, client }: ApolloProvider.Props) {\n if (__DEV__) {\n invariant(\n client[aiClientSymbol],\n 'The \"client\" instance provided to <ApolloProvider /> is the wrong instance. You might have imported `ApolloClient` from `@apollo/client`. Please import `ApolloClient` from `@apollo/client-ai-apps` instead.'\n );\n }\n\n use(client.connect());\n\n return (\n <BaseApolloProvider client={client as BaseApolloClient}>\n {children}\n </BaseApolloProvider>\n );\n}\n"]}
@@ -1,6 +1,10 @@
1
1
  export { ApolloProvider } from "./ApolloProvider.js";
2
+ export { reactive } from "./reactive.js";
3
+ export type { Reactive } from "./reactive.js";
2
4
  export declare const useApp: typeof import("./index.mcp.js").useApp;
3
5
  export declare const useToolInput: typeof import("./index.mcp.js").useToolInput;
4
6
  export declare const useToolMetadata: typeof import("./index.mcp.js").useToolMetadata;
5
7
  export declare const useToolName: typeof import("./index.mcp.js").useToolName;
8
+ /** @experimental */
9
+ export declare const createHydrationUtils: typeof import("./index.mcp.js").createHydrationUtils;
6
10
  //# 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;AAIrD,eAAO,MAAM,MAAM,wCAC4C,CAAC;AAEhE,eAAO,MAAM,YAAY,8CACkD,CAAC;AAE5E,eAAO,MAAM,eAAe,iDAGzB,CAAC;AAEJ,eAAO,MAAM,WAAW,6CACiD,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,YAAY,8CACkD,CAAC;AAE5E,eAAO,MAAM,eAAe,iDAGzB,CAAC;AAEJ,eAAO,MAAM,WAAW,6CACiD,CAAC;AAE1E,oBAAoB;AACpB,eAAO,MAAM,oBAAoB,sDAER,CAAC"}
@@ -1,9 +1,12 @@
1
1
  import { missingHook } from "./missingHook.js";
2
2
  export { ApolloProvider } from "./ApolloProvider.js";
3
+ export { reactive } from "./reactive.js";
3
4
  // Use `mcp` related types since these are the most common between the two
4
5
  // targets
5
6
  export const useApp = missingHook("useApp");
6
7
  export const useToolInput = missingHook("useToolInput");
7
8
  export const useToolMetadata = missingHook("useToolMetadata");
8
9
  export const useToolName = missingHook("useToolName");
10
+ /** @experimental */
11
+ export const createHydrationUtils = missingHook("createHydrationUtils");
9
12
  //# 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;AAErD,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","sourcesContent":["import { missingHook } from \"./missingHook.js\";\n\nexport { ApolloProvider } from \"./ApolloProvider.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"]}
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,3 +1,3 @@
1
1
  export * from "./index.js";
2
- export { useApp, useToolInput, useToolMetadata, useToolName, } from "../mcp/react/index.js";
2
+ export { useApp, useToolInput, 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,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,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,WAAW,GACZ,MAAM,uBAAuB,CAAC"}
@@ -1,3 +1,3 @@
1
1
  export * from "./index.js";
2
- export { useApp, useToolInput, useToolMetadata, useToolName, } from "../mcp/react/index.js";
2
+ export { useApp, useToolInput, 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,eAAe,EACf,WAAW,GACZ,MAAM,uBAAuB,CAAC","sourcesContent":["export * from \"./index.js\";\nexport {\n useApp,\n useToolInput,\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,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,3 +1,3 @@
1
1
  export * from "./index.js";
2
- export { useApp, useToolInput, useToolMetadata, useToolName, } from "../openai/react/index.js";
2
+ export { useApp, useToolInput, 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,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,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,WAAW,GACZ,MAAM,0BAA0B,CAAC"}
@@ -1,3 +1,3 @@
1
1
  export * from "./index.js";
2
- export { useApp, useToolInput, useToolMetadata, useToolName, } from "../openai/react/index.js";
2
+ export { useApp, useToolInput, 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,eAAe,EACf,WAAW,GACZ,MAAM,0BAA0B,CAAC","sourcesContent":["export * from \"./index.js\";\nexport {\n useApp,\n useToolInput,\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,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"]}
@@ -0,0 +1,9 @@
1
+ declare const REACTIVE: unique symbol;
2
+ export interface Reactive<T> {
3
+ readonly [REACTIVE]: true;
4
+ readonly value: T;
5
+ }
6
+ export declare function reactive<T>(value: T): Reactive<T>;
7
+ export declare function isReactive(value: unknown): value is Reactive<unknown>;
8
+ export {};
9
+ //# sourceMappingURL=reactive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reactive.d.ts","sourceRoot":"","sources":["../../src/react/reactive.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,QAAQ,eAA4B,CAAC;AAE3C,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB,QAAQ,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;CACnB;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAEjD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAAC,OAAO,CAAC,CAOrE"}
@@ -0,0 +1,11 @@
1
+ const REACTIVE = Symbol("apollo.reactive");
2
+ export function reactive(value) {
3
+ return { [REACTIVE]: true, value };
4
+ }
5
+ export function isReactive(value) {
6
+ return (typeof value === "object" &&
7
+ value !== null &&
8
+ REACTIVE in value &&
9
+ value[REACTIVE] === true);
10
+ }
11
+ //# sourceMappingURL=reactive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reactive.js","sourceRoot":"","sources":["../../src/react/reactive.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAO3C,MAAM,UAAU,QAAQ,CAAI,KAAQ;IAClC,OAAO,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,QAAQ,IAAI,KAAK;QAChB,KAAiC,CAAC,QAAQ,CAAC,KAAK,IAAI,CACtD,CAAC;AACJ,CAAC","sourcesContent":["const REACTIVE = Symbol(\"apollo.reactive\");\n\nexport interface Reactive<T> {\n readonly [REACTIVE]: true;\n readonly value: T;\n}\n\nexport function reactive<T>(value: T): Reactive<T> {\n return { [REACTIVE]: true, value };\n}\n\nexport function isReactive(value: unknown): value is Reactive<unknown> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n REACTIVE in value &&\n (value as Record<symbol, unknown>)[REACTIVE] === true\n );\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import { type DocumentNode } from "graphql";
2
+ export declare function getToolNamesFromDocument(document: DocumentNode): Set<string>;
3
+ //# sourceMappingURL=getToolNamesFromDocument.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getToolNamesFromDocument.d.ts","sourceRoot":"","sources":["../../src/utilities/getToolNamesFromDocument.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAElD,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,YAAY,eAW9D"}
@@ -0,0 +1,12 @@
1
+ import { getOperationDefinition } from "@apollo/client/utilities/internal";
2
+ import { Kind } from "graphql";
3
+ export function getToolNamesFromDocument(document) {
4
+ const operationDef = getOperationDefinition(document);
5
+ return new Set(operationDef?.directives
6
+ ?.filter((d) => d.name.value === "tool")
7
+ .flatMap((d) => {
8
+ const nameArg = d.arguments?.find((arg) => arg.name.value === "name");
9
+ return nameArg?.value.kind === Kind.STRING ? [nameArg.value.value] : [];
10
+ }));
11
+ }
12
+ //# sourceMappingURL=getToolNamesFromDocument.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getToolNamesFromDocument.js","sourceRoot":"","sources":["../../src/utilities/getToolNamesFromDocument.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAqB,MAAM,SAAS,CAAC;AAElD,MAAM,UAAU,wBAAwB,CAAC,QAAsB;IAC7D,MAAM,YAAY,GAAG,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IAEtD,OAAO,IAAI,GAAG,CACZ,YAAY,EAAE,UAAU;QACtB,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,KAAK,MAAM,CAAC;SACvC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACb,MAAM,OAAO,GAAG,CAAC,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC;QACtE,OAAO,OAAO,EAAE,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1E,CAAC,CAAC,CACL,CAAC;AACJ,CAAC","sourcesContent":["import { getOperationDefinition } from \"@apollo/client/utilities/internal\";\nimport { Kind, type DocumentNode } from \"graphql\";\n\nexport function getToolNamesFromDocument(document: DocumentNode) {\n const operationDef = getOperationDefinition(document);\n\n return new Set(\n operationDef?.directives\n ?.filter((d) => d.name.value === \"tool\")\n .flatMap((d) => {\n const nameArg = d.arguments?.find((arg) => arg.name.value === \"name\");\n return nameArg?.value.kind === Kind.STRING ? [nameArg.value.value] : [];\n })\n );\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import type { DocumentNode } from "graphql";
2
+ export declare function getVariableNamesFromDocument(document: DocumentNode): Set<string>;
3
+ //# sourceMappingURL=getVariableNamesFromDocument.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getVariableNamesFromDocument.d.ts","sourceRoot":"","sources":["../../src/utilities/getVariableNamesFromDocument.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,YAAY,eAKlE"}
@@ -0,0 +1,6 @@
1
+ import { getOperationDefinition } from "@apollo/client/utilities/internal";
2
+ export function getVariableNamesFromDocument(document) {
3
+ const operationDef = getOperationDefinition(document);
4
+ return new Set(operationDef?.variableDefinitions?.map((v) => v.variable.name.value) ?? []);
5
+ }
6
+ //# sourceMappingURL=getVariableNamesFromDocument.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getVariableNamesFromDocument.js","sourceRoot":"","sources":["../../src/utilities/getVariableNamesFromDocument.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAG3E,MAAM,UAAU,4BAA4B,CAAC,QAAsB;IACjE,MAAM,YAAY,GAAG,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IACtD,OAAO,IAAI,GAAG,CACZ,YAAY,EAAE,mBAAmB,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAC3E,CAAC;AACJ,CAAC","sourcesContent":["import { getOperationDefinition } from \"@apollo/client/utilities/internal\";\nimport type { DocumentNode } from \"graphql\";\n\nexport function getVariableNamesFromDocument(document: DocumentNode) {\n const operationDef = getOperationDefinition(document);\n return new Set(\n operationDef?.variableDefinitions?.map((v) => v.variable.name.value) ?? []\n );\n}\n"]}
@@ -1,6 +1,9 @@
1
1
  export { aiClientSymbol } from "./constants.js";
2
2
  export { getVariablesForOperationFromToolInput } from "./getVariablesForOperationFromToolInput.js";
3
+ export { getToolNamesFromDocument } from "./getToolNamesFromDocument.js";
4
+ export { getVariableNamesFromDocument } from "./getVariableNamesFromDocument.js";
3
5
  export { cacheAsync } from "./cacheAsync.js";
4
6
  export { invariant } from "./invariant.js";
5
7
  export { promiseWithResolvers } from "./promiseWithResolvers.js";
8
+ export { warnOnVariableMismatch } from "./warnOnVariableMismatch.js";
6
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,qCAAqC,EAAE,MAAM,4CAA4C,CAAC;AACnG,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,qCAAqC,EAAE,MAAM,4CAA4C,CAAC;AACnG,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -1,6 +1,9 @@
1
1
  export { aiClientSymbol } from "./constants.js";
2
2
  export { getVariablesForOperationFromToolInput } from "./getVariablesForOperationFromToolInput.js";
3
+ export { getToolNamesFromDocument } from "./getToolNamesFromDocument.js";
4
+ export { getVariableNamesFromDocument } from "./getVariableNamesFromDocument.js";
3
5
  export { cacheAsync } from "./cacheAsync.js";
4
6
  export { invariant } from "./invariant.js";
5
7
  export { promiseWithResolvers } from "./promiseWithResolvers.js";
8
+ export { warnOnVariableMismatch } from "./warnOnVariableMismatch.js";
6
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,qCAAqC,EAAE,MAAM,4CAA4C,CAAC;AACnG,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC","sourcesContent":["export { aiClientSymbol } from \"./constants.js\";\nexport { getVariablesForOperationFromToolInput } from \"./getVariablesForOperationFromToolInput.js\";\nexport { cacheAsync } from \"./cacheAsync.js\";\nexport { invariant } from \"./invariant.js\";\nexport { promiseWithResolvers } from \"./promiseWithResolvers.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,qCAAqC,EAAE,MAAM,4CAA4C,CAAC;AACnG,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC","sourcesContent":["export { aiClientSymbol } from \"./constants.js\";\nexport { getVariablesForOperationFromToolInput } from \"./getVariablesForOperationFromToolInput.js\";\nexport { getToolNamesFromDocument } from \"./getToolNamesFromDocument.js\";\nexport { getVariableNamesFromDocument } from \"./getVariableNamesFromDocument.js\";\nexport { cacheAsync } from \"./cacheAsync.js\";\nexport { invariant } from \"./invariant.js\";\nexport { promiseWithResolvers } from \"./promiseWithResolvers.js\";\nexport { warnOnVariableMismatch } from \"./warnOnVariableMismatch.js\";\n"]}
@@ -0,0 +1,3 @@
1
+ import type { DocumentNode, OperationVariables } from "@apollo/client";
2
+ export declare function warnOnVariableMismatch(document: DocumentNode, toolInput: OperationVariables, actualVariables: OperationVariables | undefined): void;
3
+ //# sourceMappingURL=warnOnVariableMismatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warnOnVariableMismatch.d.ts","sourceRoot":"","sources":["../../src/utilities/warnOnVariableMismatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGvE,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,kBAAkB,EAC7B,eAAe,EAAE,kBAAkB,GAAG,SAAS,QAahD"}
@@ -0,0 +1,10 @@
1
+ import { getOperationName } from "@apollo/client/utilities/internal/internal.cjs";
2
+ export function warnOnVariableMismatch(document, toolInput, actualVariables) {
3
+ const operationName = getOperationName(document, "(anonymous)");
4
+ console.warn(`The operation "${operationName}" has a @tool directive matching the current ` +
5
+ "tool call, but the variables provided to the query don't match the tool " +
6
+ "input. Use the `useHydratedVariables` hook returned from `createHydrationUtils` " +
7
+ "to provide the hydrated variables to the query. " +
8
+ "\n\nExpected variables:\n%o\n\nReceived:\n%o", toolInput, actualVariables);
9
+ }
10
+ //# sourceMappingURL=warnOnVariableMismatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warnOnVariableMismatch.js","sourceRoot":"","sources":["../../src/utilities/warnOnVariableMismatch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAElF,MAAM,UAAU,sBAAsB,CACpC,QAAsB,EACtB,SAA6B,EAC7B,eAA+C;IAE/C,MAAM,aAAa,GAAG,gBAAgB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IAEhE,OAAO,CAAC,IAAI,CACV,kBAAkB,aAAa,+CAA+C;QAC5E,0EAA0E;QAC1E,kFAAkF;QAClF,kDAAkD;QAClD,8CAA8C,EAChD,SAAS,EACT,eAAe,CAChB,CAAC;AACJ,CAAC","sourcesContent":["import type { DocumentNode, OperationVariables } from \"@apollo/client\";\nimport { getOperationName } from \"@apollo/client/utilities/internal/internal.cjs\";\n\nexport function warnOnVariableMismatch(\n document: DocumentNode,\n toolInput: OperationVariables,\n actualVariables: OperationVariables | undefined\n) {\n const operationName = getOperationName(document, \"(anonymous)\");\n\n console.warn(\n `The operation \"${operationName}\" has a @tool directive matching the current ` +\n \"tool call, but the variables provided to the query don't match the tool \" +\n \"input. Use the `useHydratedVariables` hook returned from `createHydrationUtils` \" +\n \"to provide the hydrated variables to the query. \" +\n \"\\n\\nExpected variables:\\n%o\\n\\nReceived:\\n%o\",\n toolInput,\n actualVariables\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"apolloClientAiApps.d.ts","sourceRoot":"","sources":["../../src/vite/apollo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