@apollo/client-ai-apps 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (404) hide show
  1. package/.github/CODEOWNERS +1 -0
  2. package/.github/workflows/pr.yaml +23 -1
  3. package/.github/workflows/release.yaml +1 -5
  4. package/.github/workflows/verify-changeset.yml +112 -21
  5. package/CHANGELOG.md +353 -0
  6. package/__mocks__/fs/promises.cjs +3 -0
  7. package/__mocks__/fs.cjs +3 -0
  8. package/dist/config/defineConfig.d.ts +26 -0
  9. package/dist/config/defineConfig.d.ts.map +1 -0
  10. package/dist/config/defineConfig.js +7 -0
  11. package/dist/config/defineConfig.js.map +1 -0
  12. package/dist/config/index.d.ts +3 -0
  13. package/dist/config/index.d.ts.map +1 -0
  14. package/dist/config/index.js +2 -0
  15. package/dist/config/index.js.map +1 -0
  16. package/dist/config/schema.d.ts +29 -0
  17. package/dist/config/schema.d.ts.map +1 -0
  18. package/dist/config/schema.js +51 -0
  19. package/dist/config/schema.js.map +1 -0
  20. package/dist/config/types.d.ts +7 -0
  21. package/dist/config/types.d.ts.map +1 -0
  22. package/dist/config/types.js +2 -0
  23. package/dist/config/types.js.map +1 -0
  24. package/dist/core/ApolloClient.d.ts +4 -3
  25. package/dist/core/ApolloClient.d.ts.map +1 -1
  26. package/dist/core/ApolloClient.js +6 -59
  27. package/dist/core/ApolloClient.js.map +1 -1
  28. package/dist/core/Platform.d.ts +8 -0
  29. package/dist/core/Platform.d.ts.map +1 -0
  30. package/dist/core/Platform.js +20 -0
  31. package/dist/core/Platform.js.map +1 -0
  32. package/dist/core/types.d.ts +13 -0
  33. package/dist/core/types.d.ts.map +1 -0
  34. package/dist/core/types.js +2 -0
  35. package/dist/core/types.js.map +1 -0
  36. package/dist/index.d.ts +1 -14
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +1 -13
  39. package/dist/index.js.map +1 -1
  40. package/dist/index.mcp.d.ts +5 -0
  41. package/dist/index.mcp.d.ts.map +1 -0
  42. package/dist/index.mcp.js +5 -0
  43. package/dist/index.mcp.js.map +1 -0
  44. package/dist/index.openai.d.ts +5 -0
  45. package/dist/index.openai.d.ts.map +1 -0
  46. package/dist/index.openai.js +5 -0
  47. package/dist/index.openai.js.map +1 -0
  48. package/dist/link/ToolCallLink.d.ts +3 -3
  49. package/dist/link/ToolCallLink.d.ts.map +1 -1
  50. package/dist/link/ToolCallLink.js +5 -14
  51. package/dist/link/ToolCallLink.js.map +1 -1
  52. package/dist/mcp/core/ApolloClient.d.ts +21 -0
  53. package/dist/mcp/core/ApolloClient.d.ts.map +1 -0
  54. package/dist/mcp/core/ApolloClient.js +65 -0
  55. package/dist/mcp/core/ApolloClient.js.map +1 -0
  56. package/dist/mcp/core/McpAppManager.d.ts +34 -0
  57. package/dist/mcp/core/McpAppManager.d.ts.map +1 -0
  58. package/dist/mcp/core/McpAppManager.js +63 -0
  59. package/dist/mcp/core/McpAppManager.js.map +1 -0
  60. package/dist/mcp/core/Platform.d.ts +8 -0
  61. package/dist/mcp/core/Platform.d.ts.map +1 -0
  62. package/dist/mcp/core/Platform.js +8 -0
  63. package/dist/mcp/core/Platform.js.map +1 -0
  64. package/dist/mcp/index.d.ts +3 -0
  65. package/dist/mcp/index.d.ts.map +1 -0
  66. package/dist/mcp/index.js +3 -0
  67. package/dist/mcp/index.js.map +1 -0
  68. package/dist/mcp/link/ToolCallLink.d.ts +28 -0
  69. package/dist/mcp/link/ToolCallLink.d.ts.map +1 -0
  70. package/dist/mcp/link/ToolCallLink.js +35 -0
  71. package/dist/mcp/link/ToolCallLink.js.map +1 -0
  72. package/dist/mcp/react/hooks/useApolloClient.d.ts +3 -0
  73. package/dist/mcp/react/hooks/useApolloClient.d.ts.map +1 -0
  74. package/dist/mcp/react/hooks/useApolloClient.js +9 -0
  75. package/dist/mcp/react/hooks/useApolloClient.js.map +1 -0
  76. package/dist/mcp/react/hooks/useApp.d.ts +2 -0
  77. package/dist/mcp/react/hooks/useApp.d.ts.map +1 -0
  78. package/dist/mcp/react/hooks/useApp.js +5 -0
  79. package/dist/mcp/react/hooks/useApp.js.map +1 -0
  80. package/dist/mcp/react/hooks/useToolInput.d.ts +2 -0
  81. package/dist/mcp/react/hooks/useToolInput.d.ts.map +1 -0
  82. package/dist/mcp/react/hooks/useToolInput.js +5 -0
  83. package/dist/mcp/react/hooks/useToolInput.js.map +1 -0
  84. package/dist/mcp/react/hooks/useToolMetadata.d.ts +8 -0
  85. package/dist/mcp/react/hooks/useToolMetadata.d.ts.map +1 -0
  86. package/dist/mcp/react/hooks/useToolMetadata.js +5 -0
  87. package/dist/mcp/react/hooks/useToolMetadata.js.map +1 -0
  88. package/dist/mcp/react/hooks/useToolName.d.ts +2 -0
  89. package/dist/mcp/react/hooks/useToolName.d.ts.map +1 -0
  90. package/dist/mcp/react/hooks/useToolName.js +5 -0
  91. package/dist/mcp/react/hooks/useToolName.js.map +1 -0
  92. package/dist/mcp/react/index.d.ts +5 -0
  93. package/dist/mcp/react/index.d.ts.map +1 -0
  94. package/dist/mcp/react/index.js +5 -0
  95. package/dist/mcp/react/index.js.map +1 -0
  96. package/dist/openai/core/ApolloClient.d.ts +21 -0
  97. package/dist/openai/core/ApolloClient.d.ts.map +1 -0
  98. package/dist/openai/core/ApolloClient.js +66 -0
  99. package/dist/openai/core/ApolloClient.js.map +1 -0
  100. package/dist/openai/core/McpAppManager.d.ts +28 -0
  101. package/dist/openai/core/McpAppManager.d.ts.map +1 -0
  102. package/dist/openai/core/McpAppManager.js +73 -0
  103. package/dist/openai/core/McpAppManager.js.map +1 -0
  104. package/dist/openai/core/Platform.d.ts +8 -0
  105. package/dist/openai/core/Platform.d.ts.map +1 -0
  106. package/dist/openai/core/Platform.js +8 -0
  107. package/dist/openai/core/Platform.js.map +1 -0
  108. package/dist/openai/globals.d.ts +12 -0
  109. package/dist/openai/globals.d.ts.map +1 -0
  110. package/dist/openai/globals.js +2 -0
  111. package/dist/openai/globals.js.map +1 -0
  112. package/dist/openai/index.d.ts +3 -0
  113. package/dist/openai/index.d.ts.map +1 -0
  114. package/dist/openai/index.js +3 -0
  115. package/dist/openai/index.js.map +1 -0
  116. package/dist/openai/link/ToolCallLink.d.ts +28 -0
  117. package/dist/openai/link/ToolCallLink.d.ts.map +1 -0
  118. package/dist/openai/link/ToolCallLink.js +35 -0
  119. package/dist/openai/link/ToolCallLink.js.map +1 -0
  120. package/dist/openai/react/hooks/useApolloClient.d.ts +3 -0
  121. package/dist/openai/react/hooks/useApolloClient.d.ts.map +1 -0
  122. package/dist/openai/react/hooks/useApolloClient.js +9 -0
  123. package/dist/openai/react/hooks/useApolloClient.js.map +1 -0
  124. package/dist/openai/react/hooks/useApp.d.ts +2 -0
  125. package/dist/openai/react/hooks/useApp.d.ts.map +1 -0
  126. package/dist/openai/react/hooks/useApp.js +5 -0
  127. package/dist/openai/react/hooks/useApp.js.map +1 -0
  128. package/dist/openai/react/hooks/useOpenAiGlobal.d.ts +3 -0
  129. package/dist/openai/react/hooks/useOpenAiGlobal.d.ts.map +1 -0
  130. package/dist/{react → openai/react}/hooks/useOpenAiGlobal.js +1 -1
  131. package/dist/openai/react/hooks/useOpenAiGlobal.js.map +1 -0
  132. package/dist/openai/react/hooks/useToolInput.d.ts +2 -0
  133. package/dist/openai/react/hooks/useToolInput.d.ts.map +1 -0
  134. package/dist/openai/react/hooks/useToolInput.js +5 -0
  135. package/dist/openai/react/hooks/useToolInput.js.map +1 -0
  136. package/dist/openai/react/hooks/useToolMetadata.d.ts +2 -0
  137. package/dist/openai/react/hooks/useToolMetadata.d.ts.map +1 -0
  138. package/dist/openai/react/hooks/useToolMetadata.js +5 -0
  139. package/dist/openai/react/hooks/useToolMetadata.js.map +1 -0
  140. package/dist/openai/react/hooks/useToolName.d.ts.map +1 -0
  141. package/dist/openai/react/hooks/useToolName.js +5 -0
  142. package/dist/openai/react/hooks/useToolName.js.map +1 -0
  143. package/dist/{react → openai/react}/hooks/useWidgetState.d.ts +1 -1
  144. package/dist/openai/react/hooks/useWidgetState.d.ts.map +1 -0
  145. package/dist/openai/react/hooks/useWidgetState.js.map +1 -0
  146. package/dist/openai/react/index.d.ts +6 -0
  147. package/dist/openai/react/index.d.ts.map +1 -0
  148. package/dist/openai/react/index.js +6 -0
  149. package/dist/openai/react/index.js.map +1 -0
  150. package/dist/{types/openai.d.ts → openai/types.d.ts} +7 -11
  151. package/dist/openai/types.d.ts.map +1 -0
  152. package/dist/{types/openai.js → openai/types.js} +1 -1
  153. package/dist/openai/types.js.map +1 -0
  154. package/dist/react/ApolloProvider.d.ts +6 -2
  155. package/dist/react/ApolloProvider.d.ts.map +1 -1
  156. package/dist/react/ApolloProvider.js +12 -27
  157. package/dist/react/ApolloProvider.js.map +1 -1
  158. package/dist/react/index.d.ts +6 -0
  159. package/dist/react/index.d.ts.map +1 -0
  160. package/dist/react/index.js +9 -0
  161. package/dist/react/index.js.map +1 -0
  162. package/dist/react/index.mcp.d.ts +3 -0
  163. package/dist/react/index.mcp.d.ts.map +1 -0
  164. package/dist/react/index.mcp.js +3 -0
  165. package/dist/react/index.mcp.js.map +1 -0
  166. package/dist/react/index.openai.d.ts +3 -0
  167. package/dist/react/index.openai.d.ts.map +1 -0
  168. package/dist/react/index.openai.js +3 -0
  169. package/dist/react/index.openai.js.map +1 -0
  170. package/dist/react/missingHook.d.ts +2 -0
  171. package/dist/react/missingHook.d.ts.map +1 -0
  172. package/dist/react/missingHook.js +6 -0
  173. package/dist/react/missingHook.js.map +1 -0
  174. package/dist/tsconfig/core/tsconfig.json +5 -0
  175. package/dist/tsconfig/mcp/tsconfig.json +6 -0
  176. package/dist/tsconfig/openai/tsconfig.json +7 -0
  177. package/dist/types/application-manifest.d.ts +5 -1
  178. package/dist/types/application-manifest.d.ts.map +1 -1
  179. package/dist/types/application-manifest.js.map +1 -1
  180. package/dist/utilities/cacheAsync.d.ts +4 -0
  181. package/dist/utilities/cacheAsync.d.ts.map +1 -0
  182. package/dist/utilities/cacheAsync.js +19 -0
  183. package/dist/utilities/cacheAsync.js.map +1 -0
  184. package/dist/utilities/constants.d.ts +6 -0
  185. package/dist/utilities/constants.d.ts.map +1 -0
  186. package/dist/utilities/constants.js +6 -0
  187. package/dist/utilities/constants.js.map +1 -0
  188. package/dist/utilities/emptyModule.d.ts +2 -0
  189. package/dist/utilities/emptyModule.d.ts.map +1 -0
  190. package/dist/utilities/emptyModule.js +2 -0
  191. package/dist/utilities/emptyModule.js.map +1 -0
  192. package/dist/utilities/getVariablesForOperationFromToolInput.d.ts +5 -0
  193. package/dist/utilities/getVariablesForOperationFromToolInput.d.ts.map +1 -0
  194. package/dist/utilities/getVariablesForOperationFromToolInput.js +18 -0
  195. package/dist/utilities/getVariablesForOperationFromToolInput.js.map +1 -0
  196. package/dist/utilities/index.d.ts +6 -0
  197. package/dist/utilities/index.d.ts.map +1 -0
  198. package/dist/utilities/index.js +6 -0
  199. package/dist/utilities/index.js.map +1 -0
  200. package/dist/utilities/invariant.d.ts +2 -0
  201. package/dist/utilities/invariant.d.ts.map +1 -0
  202. package/dist/utilities/invariant.js +6 -0
  203. package/dist/utilities/invariant.js.map +1 -0
  204. package/dist/utilities/promiseWithResolvers.d.ts +7 -0
  205. package/dist/utilities/promiseWithResolvers.d.ts.map +1 -0
  206. package/dist/utilities/promiseWithResolvers.js +16 -0
  207. package/dist/utilities/promiseWithResolvers.js.map +1 -0
  208. package/dist/vite/__tests__/utilities/build.d.ts +41 -0
  209. package/dist/vite/__tests__/utilities/build.d.ts.map +1 -0
  210. package/dist/vite/__tests__/utilities/build.js +63 -0
  211. package/dist/vite/__tests__/utilities/build.js.map +1 -0
  212. package/dist/vite/apolloClientAiApps.d.ts +14 -0
  213. package/dist/vite/apolloClientAiApps.d.ts.map +1 -0
  214. package/dist/vite/apolloClientAiApps.js +350 -0
  215. package/dist/vite/apolloClientAiApps.js.map +1 -0
  216. package/dist/vite/index.d.ts +1 -2
  217. package/dist/vite/index.d.ts.map +1 -1
  218. package/dist/vite/index.js +1 -2
  219. package/dist/vite/index.js.map +1 -1
  220. package/dist/vite/utilities/config.d.ts +2 -0
  221. package/dist/vite/utilities/config.d.ts.map +1 -0
  222. package/dist/vite/utilities/config.js +11 -0
  223. package/dist/vite/utilities/config.js.map +1 -0
  224. package/dist/vite/utilities/graphql.d.ts +20 -0
  225. package/dist/vite/utilities/graphql.d.ts.map +1 -0
  226. package/dist/vite/utilities/graphql.js +42 -0
  227. package/dist/vite/utilities/graphql.js.map +1 -0
  228. package/knope.toml +1 -1
  229. package/package.json +105 -9
  230. package/src/config/defineConfig.ts +8 -0
  231. package/src/config/index.ts +2 -0
  232. package/src/config/schema.ts +73 -0
  233. package/src/config/types.ts +7 -0
  234. package/src/core/ApolloClient.ts +7 -95
  235. package/src/core/Platform.ts +27 -0
  236. package/src/core/types.ts +14 -0
  237. package/src/index.mcp.ts +5 -0
  238. package/src/index.openai.ts +5 -0
  239. package/src/index.ts +2 -27
  240. package/src/link/ToolCallLink.ts +6 -22
  241. package/src/mcp/core/ApolloClient.ts +102 -0
  242. package/src/mcp/core/McpAppManager.ts +98 -0
  243. package/src/mcp/core/Platform.ts +11 -0
  244. package/src/mcp/core/__tests__/ApolloClient.test.ts +464 -0
  245. package/src/mcp/index.ts +2 -0
  246. package/src/mcp/link/ToolCallLink.ts +40 -0
  247. package/src/mcp/link/__tests__/ToolCallLink.test.ts +53 -0
  248. package/src/mcp/react/hooks/__tests__/useApp.test.tsx +46 -0
  249. package/src/mcp/react/hooks/__tests__/useToolInput.test.tsx +50 -0
  250. package/src/mcp/react/hooks/__tests__/useToolMetadata.test.tsx +53 -0
  251. package/src/mcp/react/hooks/__tests__/useToolName.test.tsx +50 -0
  252. package/src/mcp/react/hooks/useApolloClient.ts +14 -0
  253. package/src/mcp/react/hooks/useApp.ts +5 -0
  254. package/src/mcp/react/hooks/useToolInput.ts +5 -0
  255. package/src/mcp/react/hooks/useToolMetadata.ts +5 -0
  256. package/src/mcp/react/hooks/useToolName.ts +5 -0
  257. package/src/mcp/react/index.ts +4 -0
  258. package/src/openai/core/ApolloClient.ts +100 -0
  259. package/src/openai/core/McpAppManager.ts +110 -0
  260. package/src/openai/core/Platform.ts +11 -0
  261. package/src/openai/core/__tests__/ApolloClient.test.ts +537 -0
  262. package/src/openai/globals.ts +14 -0
  263. package/src/openai/index.ts +2 -0
  264. package/src/openai/link/ToolCallLink.ts +40 -0
  265. package/src/{react → openai/react}/hooks/__tests__/useOpenAiGlobal.test.ts +1 -1
  266. package/src/openai/react/hooks/__tests__/useToolInput.test.tsx +85 -0
  267. package/src/openai/react/hooks/__tests__/useToolMetadata.test.tsx +86 -0
  268. package/src/openai/react/hooks/__tests__/useToolName.test.tsx +50 -0
  269. package/src/{react → openai/react}/hooks/__tests__/useWidgetState.test.tsx +1 -1
  270. package/src/openai/react/hooks/useApolloClient.ts +14 -0
  271. package/src/openai/react/hooks/useApp.ts +5 -0
  272. package/src/{react → openai/react}/hooks/useOpenAiGlobal.ts +2 -2
  273. package/src/openai/react/hooks/useToolInput.ts +5 -0
  274. package/src/openai/react/hooks/useToolMetadata.ts +5 -0
  275. package/src/openai/react/hooks/useToolName.ts +5 -0
  276. package/src/{react → openai/react}/hooks/useWidgetState.ts +1 -1
  277. package/src/openai/react/index.ts +5 -0
  278. package/src/{types/openai.ts → openai/types.ts} +9 -13
  279. package/src/react/ApolloProvider.tsx +23 -31
  280. package/src/react/__tests__/ApolloProvider/mcp.test.tsx +74 -0
  281. package/src/react/__tests__/ApolloProvider/openai.test.tsx +146 -0
  282. package/src/react/index.mcp.ts +7 -0
  283. package/src/react/index.openai.ts +7 -0
  284. package/src/react/index.ts +19 -0
  285. package/src/react/missingHook.ts +9 -0
  286. package/src/testing/internal/index.ts +8 -0
  287. package/src/testing/internal/matchers/index.ts +2 -0
  288. package/src/testing/internal/matchers/toComplete.ts +46 -0
  289. package/src/testing/internal/matchers/toEmitValue.ts +71 -0
  290. package/src/testing/internal/matchers/types.ts +3 -0
  291. package/src/testing/internal/mcp/graphqlToolResult.ts +31 -0
  292. package/src/testing/internal/mcp/minimalHostContextWithToolName.ts +9 -0
  293. package/src/testing/internal/mcp/mockMcpHost.ts +188 -0
  294. package/src/testing/internal/openai/dispatchStateChange.ts +1 -1
  295. package/src/testing/internal/openai/stubOpenAiGlobals.ts +22 -9
  296. package/src/testing/internal/react/renderAsync.ts +7 -0
  297. package/src/testing/internal/utilities/ObservableStream.ts +172 -0
  298. package/src/testing/internal/utilities/getSerializableProperties.ts +55 -0
  299. package/src/testing/internal/utilities/mockApplicationManifest.ts +39 -0
  300. package/src/testing/internal/utilities/spyOnConsole.ts +29 -0
  301. package/src/testing/internal/utilities/wait.ts +3 -0
  302. package/src/tsconfig/core/tsconfig.json +5 -0
  303. package/src/tsconfig/mcp/tsconfig.json +6 -0
  304. package/src/tsconfig/openai/tsconfig.json +7 -0
  305. package/src/types/application-manifest.ts +7 -1
  306. package/src/utilities/__tests__/cacheAsync.test.ts +64 -0
  307. package/src/utilities/cacheAsync.ts +25 -0
  308. package/src/utilities/constants.ts +5 -0
  309. package/src/utilities/emptyModule.ts +1 -0
  310. package/src/utilities/getVariablesForOperationFromToolInput.ts +27 -0
  311. package/src/utilities/index.ts +5 -0
  312. package/src/utilities/invariant.ts +5 -0
  313. package/src/utilities/promiseWithResolvers.ts +18 -0
  314. package/src/vite/__tests__/apolloClientAiApps.test.ts +1521 -0
  315. package/src/vite/__tests__/utilities/build.ts +72 -0
  316. package/src/vite/apolloClientAiApps.ts +515 -0
  317. package/src/vite/index.ts +1 -2
  318. package/src/vite/utilities/config.ts +13 -0
  319. package/src/vite/utilities/graphql.ts +123 -0
  320. package/tsconfig.base.json +2 -2
  321. package/tsconfig.vite.build.json +4 -1
  322. package/tsconfig.vite.json +8 -2
  323. package/vitest-setup.ts +28 -0
  324. package/dist/react/context/ToolUseContext.d.ts +0 -16
  325. package/dist/react/context/ToolUseContext.d.ts.map +0 -1
  326. package/dist/react/context/ToolUseContext.js +0 -11
  327. package/dist/react/context/ToolUseContext.js.map +0 -1
  328. package/dist/react/hooks/useCallTool.d.ts +0 -4
  329. package/dist/react/hooks/useCallTool.d.ts.map +0 -1
  330. package/dist/react/hooks/useCallTool.js +0 -5
  331. package/dist/react/hooks/useCallTool.js.map +0 -1
  332. package/dist/react/hooks/useOpenAiGlobal.d.ts +0 -3
  333. package/dist/react/hooks/useOpenAiGlobal.d.ts.map +0 -1
  334. package/dist/react/hooks/useOpenAiGlobal.js.map +0 -1
  335. package/dist/react/hooks/useOpenExternal.d.ts +0 -4
  336. package/dist/react/hooks/useOpenExternal.d.ts.map +0 -1
  337. package/dist/react/hooks/useOpenExternal.js +0 -5
  338. package/dist/react/hooks/useOpenExternal.js.map +0 -1
  339. package/dist/react/hooks/useRequestDisplayMode.d.ts +0 -7
  340. package/dist/react/hooks/useRequestDisplayMode.d.ts.map +0 -1
  341. package/dist/react/hooks/useRequestDisplayMode.js +0 -6
  342. package/dist/react/hooks/useRequestDisplayMode.js.map +0 -1
  343. package/dist/react/hooks/useSendFollowUpMessage.d.ts +0 -2
  344. package/dist/react/hooks/useSendFollowUpMessage.d.ts.map +0 -1
  345. package/dist/react/hooks/useSendFollowUpMessage.js +0 -8
  346. package/dist/react/hooks/useSendFollowUpMessage.js.map +0 -1
  347. package/dist/react/hooks/useToolEffect.d.ts +0 -3
  348. package/dist/react/hooks/useToolEffect.d.ts.map +0 -1
  349. package/dist/react/hooks/useToolEffect.js +0 -28
  350. package/dist/react/hooks/useToolEffect.js.map +0 -1
  351. package/dist/react/hooks/useToolInput.d.ts +0 -2
  352. package/dist/react/hooks/useToolInput.d.ts.map +0 -1
  353. package/dist/react/hooks/useToolInput.js +0 -6
  354. package/dist/react/hooks/useToolInput.js.map +0 -1
  355. package/dist/react/hooks/useToolName.d.ts.map +0 -1
  356. package/dist/react/hooks/useToolName.js +0 -6
  357. package/dist/react/hooks/useToolName.js.map +0 -1
  358. package/dist/react/hooks/useToolOutput.d.ts +0 -2
  359. package/dist/react/hooks/useToolOutput.d.ts.map +0 -1
  360. package/dist/react/hooks/useToolOutput.js +0 -5
  361. package/dist/react/hooks/useToolOutput.js.map +0 -1
  362. package/dist/react/hooks/useToolResponseMetadata.d.ts +0 -2
  363. package/dist/react/hooks/useToolResponseMetadata.d.ts.map +0 -1
  364. package/dist/react/hooks/useToolResponseMetadata.js +0 -5
  365. package/dist/react/hooks/useToolResponseMetadata.js.map +0 -1
  366. package/dist/react/hooks/useWidgetState.d.ts.map +0 -1
  367. package/dist/react/hooks/useWidgetState.js.map +0 -1
  368. package/dist/types/openai.d.ts.map +0 -1
  369. package/dist/types/openai.js.map +0 -1
  370. package/dist/vite/absolute_asset_imports_plugin.d.ts +0 -5
  371. package/dist/vite/absolute_asset_imports_plugin.d.ts.map +0 -1
  372. package/dist/vite/absolute_asset_imports_plugin.js +0 -17
  373. package/dist/vite/absolute_asset_imports_plugin.js.map +0 -1
  374. package/dist/vite/application_manifest_plugin.d.ts +0 -10
  375. package/dist/vite/application_manifest_plugin.d.ts.map +0 -1
  376. package/dist/vite/application_manifest_plugin.js +0 -317
  377. package/dist/vite/application_manifest_plugin.js.map +0 -1
  378. package/src/core/__tests__/ApolloClient.test.ts +0 -646
  379. package/src/react/__tests__/ApolloProvider.test.tsx +0 -41
  380. package/src/react/context/ToolUseContext.tsx +0 -31
  381. package/src/react/hooks/__tests__/useCallTool.test.ts +0 -46
  382. package/src/react/hooks/__tests__/useOpenExternal.test.tsx +0 -24
  383. package/src/react/hooks/__tests__/useRequestDisplayMode.test.ts +0 -17
  384. package/src/react/hooks/__tests__/useSendFollowUpMessage.test.ts +0 -15
  385. package/src/react/hooks/__tests__/useToolEffect.test.tsx +0 -67
  386. package/src/react/hooks/__tests__/useToolInput.test.ts +0 -13
  387. package/src/react/hooks/__tests__/useToolName.test.ts +0 -13
  388. package/src/react/hooks/__tests__/useToolOutput.test.tsx +0 -49
  389. package/src/react/hooks/__tests__/useToolResponseMetadata.test.tsx +0 -49
  390. package/src/react/hooks/useCallTool.ts +0 -13
  391. package/src/react/hooks/useOpenExternal.ts +0 -11
  392. package/src/react/hooks/useRequestDisplayMode.ts +0 -7
  393. package/src/react/hooks/useSendFollowUpMessage.ts +0 -7
  394. package/src/react/hooks/useToolEffect.tsx +0 -37
  395. package/src/react/hooks/useToolInput.ts +0 -7
  396. package/src/react/hooks/useToolName.ts +0 -7
  397. package/src/react/hooks/useToolOutput.ts +0 -5
  398. package/src/react/hooks/useToolResponseMetadata.ts +0 -5
  399. package/src/vite/__tests__/absolute_asset_imports_plugin.test.ts +0 -102
  400. package/src/vite/__tests__/application_manifest_plugin.test.ts +0 -1199
  401. package/src/vite/absolute_asset_imports_plugin.ts +0 -22
  402. package/src/vite/application_manifest_plugin.ts +0 -539
  403. /package/dist/{react → openai/react}/hooks/useToolName.d.ts +0 -0
  404. /package/dist/{react → openai/react}/hooks/useWidgetState.js +0 -0
@@ -1,646 +0,0 @@
1
- import { expect, test, describe, vi } from "vitest";
2
- import { ApolloClient } from "../ApolloClient.js";
3
- import type { ApplicationManifest } from "../../types/application-manifest.js";
4
- import { parse } from "graphql";
5
- import { ApolloLink, HttpLink, InMemoryCache } from "@apollo/client";
6
- import { ToolCallLink } from "../../link/ToolCallLink.js";
7
-
8
- describe("Client Basics", () => {
9
- test("Should execute tool call when client.query is called", async () => {
10
- vi.stubGlobal("openai", {
11
- toolInput: {},
12
- toolOutput: {},
13
- toolResponseMetadata: {
14
- toolName: "the-store--Get Product",
15
- },
16
- callTool: vi.fn(async (name: string, args: Record<string, unknown>) => {
17
- return {
18
- structuredContent: {
19
- data: {
20
- product: {
21
- id: "1",
22
- title: "Pen",
23
- rating: 5,
24
- price: 1.0,
25
- description: "Awesome pen",
26
- images: [],
27
- __typename: "Product",
28
- },
29
- },
30
- },
31
- };
32
- }),
33
- });
34
-
35
- const manifest = {
36
- format: "apollo-ai-app-manifest",
37
- version: "1",
38
- name: "the-store",
39
- description:
40
- "An online store selling a variety of high quality products across many different categories.",
41
- hash: "f6a24922f6ad6ed8c2aa57baf3b8242ae5f38a09a6df3f2693077732434c4256",
42
- operations: [
43
- {
44
- id: "c43af26552874026c3fb346148c5795896aa2f3a872410a0a2621cffee25291c",
45
- name: "Product",
46
- type: "query",
47
- body: "query Product($id: ID!) {\n product(id: $id) {\n id\n title\n rating\n price\n description\n images\n __typename\n }\n}",
48
- variables: { id: "ID" },
49
- prefetch: false,
50
- tools: [
51
- {
52
- name: "Get Product",
53
- description: "Shows the details page for a specific product.",
54
- },
55
- ],
56
- },
57
- ],
58
- resource: "index.html",
59
- csp: {
60
- connectDomains: [],
61
- resourceDomains: [],
62
- frameDomains: [],
63
- redirectDomains: [],
64
- },
65
- } satisfies ApplicationManifest;
66
-
67
- const client = new ApolloClient({
68
- cache: new InMemoryCache(),
69
- manifest,
70
- });
71
-
72
- const variables = { id: "1" };
73
- await client.query({
74
- query: parse(manifest.operations[0].body),
75
- variables,
76
- });
77
-
78
- expect(window.openai.callTool).toBeCalledWith("execute", {
79
- query: manifest.operations[0].body,
80
- variables,
81
- });
82
- expect(client.extract()).toMatchInlineSnapshot(`
83
- {
84
- "Product:1": {
85
- "__typename": "Product",
86
- "description": "Awesome pen",
87
- "id": "1",
88
- "images": [],
89
- "price": 1,
90
- "rating": 5,
91
- "title": "Pen",
92
- },
93
- "ROOT_QUERY": {
94
- "__typename": "Query",
95
- "product({"id":"1"})": {
96
- "__ref": "Product:1",
97
- },
98
- },
99
- }
100
- `);
101
- });
102
- });
103
-
104
- describe("prefetchData", () => {
105
- test("Should cache tool response when data is provided", async () => {
106
- vi.stubGlobal("openai", {
107
- toolInput: {
108
- id: 1,
109
- },
110
- toolOutput: {
111
- result: {
112
- data: {
113
- product: {
114
- id: "1",
115
- title: "Pen",
116
- rating: 5,
117
- price: 1.0,
118
- description: "Awesome pen",
119
- images: [],
120
- __typename: "Product",
121
- },
122
- },
123
- },
124
- },
125
- toolResponseMetadata: {
126
- toolName: "the-store--Get Product",
127
- },
128
- });
129
-
130
- const manifest = {
131
- format: "apollo-ai-app-manifest",
132
- version: "1",
133
- name: "the-store",
134
- description:
135
- "An online store selling a variety of high quality products across many different categories.",
136
- hash: "f6a24922f6ad6ed8c2aa57baf3b8242ae5f38a09a6df3f2693077732434c4256",
137
- operations: [
138
- {
139
- id: "c43af26552874026c3fb346148c5795896aa2f3a872410a0a2621cffee25291c",
140
- name: "Product",
141
- type: "query",
142
- body: "query Product($id: ID!) {\n product(id: $id) {\n id\n title\n rating\n price\n description\n images\n __typename\n }\n}",
143
- variables: { id: "ID" },
144
- prefetch: false,
145
- tools: [
146
- {
147
- name: "Get Product",
148
- description: "Shows the details page for a specific product.",
149
- },
150
- ],
151
- },
152
- ],
153
- resource: "index.html",
154
- csp: {
155
- connectDomains: [],
156
- resourceDomains: [],
157
- frameDomains: [],
158
- redirectDomains: [],
159
- },
160
- } satisfies ApplicationManifest;
161
-
162
- const client = new ApolloClient({
163
- cache: new InMemoryCache(),
164
- manifest,
165
- });
166
- await client.prefetchData();
167
-
168
- expect(client.extract()).toMatchInlineSnapshot(`
169
- {
170
- "Product:1": {
171
- "__typename": "Product",
172
- "description": "Awesome pen",
173
- "id": "1",
174
- "images": [],
175
- "price": 1,
176
- "rating": 5,
177
- "title": "Pen",
178
- },
179
- "ROOT_QUERY": {
180
- "__typename": "Query",
181
- "product({"id":1})": {
182
- "__ref": "Product:1",
183
- },
184
- },
185
- }
186
- `);
187
- });
188
-
189
- test("Should cache prefetched data when prefetched data is provided", async () => {
190
- vi.stubGlobal("openai", {
191
- toolInput: {},
192
- toolOutput: {
193
- result: {},
194
- prefetch: {
195
- __anonymous: {
196
- data: {
197
- topProducts: [
198
- {
199
- id: "2",
200
- title: "iPhone 17",
201
- rating: 5,
202
- price: 999.99,
203
- description: "Awesome phone",
204
- images: [],
205
- __typename: "Product",
206
- },
207
- ],
208
- },
209
- },
210
- },
211
- },
212
- toolResponseMetadata: {
213
- toolName: "the-store--Get Product",
214
- },
215
- });
216
-
217
- const manifest = {
218
- format: "apollo-ai-app-manifest",
219
- version: "1",
220
- name: "the-store",
221
- description:
222
- "An online store selling a variety of high quality products across many different categories.",
223
- hash: "f6a24922f6ad6ed8c2aa57baf3b8242ae5f38a09a6df3f2693077732434c4256",
224
- operations: [
225
- {
226
- id: "cd0d52159b9003e791de97c6a76efa03d34fe00cee278d1a3f4bfcec5fb3e1e6",
227
- name: "TopProducts",
228
- type: "query",
229
- body: "query TopProducts {\n topProducts {\n id\n title\n rating\n price\n __typename\n }\n}",
230
- variables: {},
231
- prefetch: true,
232
- prefetchID: "__anonymous",
233
- tools: [
234
- {
235
- name: "Top Products",
236
- description: "Shows the currently highest rated products.",
237
- },
238
- ],
239
- },
240
- ],
241
- resource: "index.html",
242
- };
243
-
244
- const client = new ApolloClient({
245
- cache: new InMemoryCache(),
246
- manifest: manifest as ApplicationManifest,
247
- });
248
- await client.prefetchData();
249
-
250
- expect(client.extract()).toMatchInlineSnapshot(`
251
- {
252
- "Product:2": {
253
- "__typename": "Product",
254
- "id": "2",
255
- "price": 999.99,
256
- "rating": 5,
257
- "title": "iPhone 17",
258
- },
259
- "ROOT_QUERY": {
260
- "__typename": "Query",
261
- "topProducts": [
262
- {
263
- "__ref": "Product:2",
264
- },
265
- ],
266
- },
267
- }
268
- `);
269
- });
270
-
271
- test("Should cache both prefetch and tool response when both are provided", async () => {
272
- vi.stubGlobal("openai", {
273
- toolInput: {
274
- id: 1,
275
- },
276
- toolOutput: {
277
- result: {
278
- data: {
279
- product: {
280
- id: "1",
281
- title: "Pen",
282
- rating: 5,
283
- price: 1.0,
284
- description: "Awesome pen",
285
- images: [],
286
- __typename: "Product",
287
- },
288
- },
289
- },
290
- prefetch: {
291
- __anonymous: {
292
- data: {
293
- topProducts: [
294
- {
295
- id: "2",
296
- title: "iPhone 17",
297
- rating: 5,
298
- price: 999.99,
299
- description: "Awesome phone",
300
- images: [],
301
- __typename: "Product",
302
- },
303
- ],
304
- },
305
- },
306
- },
307
- },
308
- toolResponseMetadata: {
309
- toolName: "the-store--Get Product",
310
- },
311
- });
312
-
313
- const manifest = {
314
- format: "apollo-ai-app-manifest",
315
- version: "1",
316
- name: "the-store",
317
- description:
318
- "An online store selling a variety of high quality products across many different categories.",
319
- hash: "f6a24922f6ad6ed8c2aa57baf3b8242ae5f38a09a6df3f2693077732434c4256",
320
- operations: [
321
- {
322
- id: "c43af26552874026c3fb346148c5795896aa2f3a872410a0a2621cffee25291c",
323
- name: "Product",
324
- type: "query",
325
- body: "query Product($id: ID!) {\n product(id: $id) {\n id\n title\n rating\n price\n description\n images\n __typename\n }\n}",
326
- variables: { id: "ID" },
327
- prefetch: false,
328
- tools: [
329
- {
330
- name: "Get Product",
331
- description: "Shows the details page for a specific product.",
332
- },
333
- ],
334
- },
335
- {
336
- id: "cd0d52159b9003e791de97c6a76efa03d34fe00cee278d1a3f4bfcec5fb3e1e6",
337
- name: "TopProducts",
338
- type: "query",
339
- body: "query TopProducts {\n topProducts {\n id\n title\n rating\n price\n __typename\n }\n}",
340
- variables: {},
341
- prefetch: true,
342
- prefetchID: "__anonymous",
343
- tools: [
344
- {
345
- name: "Top Products",
346
- description: "Shows the currently highest rated products.",
347
- },
348
- ],
349
- },
350
- ],
351
- resource: "index.html",
352
- };
353
-
354
- const client = new ApolloClient({
355
- cache: new InMemoryCache(),
356
- manifest: manifest as ApplicationManifest,
357
- });
358
- await client.prefetchData();
359
-
360
- expect(client.extract()).toMatchInlineSnapshot(`
361
- {
362
- "Product:1": {
363
- "__typename": "Product",
364
- "description": "Awesome pen",
365
- "id": "1",
366
- "images": [],
367
- "price": 1,
368
- "rating": 5,
369
- "title": "Pen",
370
- },
371
- "Product:2": {
372
- "__typename": "Product",
373
- "id": "2",
374
- "price": 999.99,
375
- "rating": 5,
376
- "title": "iPhone 17",
377
- },
378
- "ROOT_QUERY": {
379
- "__typename": "Query",
380
- "product({"id":1})": {
381
- "__ref": "Product:1",
382
- },
383
- "topProducts": [
384
- {
385
- "__ref": "Product:2",
386
- },
387
- ],
388
- },
389
- }
390
- `);
391
- });
392
-
393
- test("Should exclude extra inputs when writing to cache", async () => {
394
- vi.stubGlobal("openai", {
395
- toolInput: {
396
- id: 1,
397
- myOtherThing: 2,
398
- },
399
- toolOutput: {
400
- result: {
401
- data: {
402
- product: {
403
- id: "1",
404
- title: "Pen",
405
- rating: 5,
406
- price: 1.0,
407
- description: "Awesome pen",
408
- images: [],
409
- __typename: "Product",
410
- },
411
- },
412
- },
413
- },
414
- toolResponseMetadata: {
415
- toolName: "the-store--Get Product",
416
- },
417
- });
418
-
419
- const manifest = {
420
- format: "apollo-ai-app-manifest",
421
- version: "1",
422
- name: "the-store",
423
- description:
424
- "An online store selling a variety of high quality products across many different categories.",
425
- hash: "f6a24922f6ad6ed8c2aa57baf3b8242ae5f38a09a6df3f2693077732434c4256",
426
- operations: [
427
- {
428
- id: "c43af26552874026c3fb346148c5795896aa2f3a872410a0a2621cffee25291c",
429
- name: "Product",
430
- type: "query",
431
- body: "query Product($id: ID!) {\n product(id: $id) {\n id\n title\n rating\n price\n description\n images\n __typename\n }\n}",
432
- variables: { id: "ID" },
433
- prefetch: false,
434
- tools: [
435
- {
436
- name: "Get Product",
437
- description: "Shows the details page for a specific product.",
438
- },
439
- ],
440
- },
441
- ],
442
- resource: "index.html",
443
- csp: {
444
- connectDomains: [],
445
- resourceDomains: [],
446
- frameDomains: [],
447
- redirectDomains: [],
448
- },
449
- } satisfies ApplicationManifest;
450
-
451
- const client = new ApolloClient({
452
- cache: new InMemoryCache(),
453
- manifest,
454
- });
455
- await client.prefetchData();
456
-
457
- expect(client.extract()).toMatchInlineSnapshot(`
458
- {
459
- "Product:1": {
460
- "__typename": "Product",
461
- "description": "Awesome pen",
462
- "id": "1",
463
- "images": [],
464
- "price": 1,
465
- "rating": 5,
466
- "title": "Pen",
467
- },
468
- "ROOT_QUERY": {
469
- "__typename": "Query",
470
- "product({"id":1})": {
471
- "__ref": "Product:1",
472
- },
473
- },
474
- }
475
- `);
476
- });
477
- });
478
-
479
- describe("custom links", () => {
480
- test("allows for custom links provided to the constructor", async () => {
481
- vi.stubGlobal("openai", {
482
- toolInput: {},
483
- toolOutput: {},
484
- toolResponseMetadata: {
485
- toolName: "the-store--Get Product",
486
- },
487
- callTool: vi.fn(async (name: string, args: Record<string, unknown>) => {
488
- return {
489
- structuredContent: {
490
- data: {
491
- product: {
492
- id: "1",
493
- title: "Pen",
494
- rating: 5,
495
- price: 1.0,
496
- description: "Awesome pen",
497
- images: [],
498
- __typename: "Product",
499
- },
500
- },
501
- },
502
- };
503
- }),
504
- });
505
-
506
- const manifest = createManifest();
507
- const linkHandler = vi.fn<ApolloLink.RequestHandler>((operation, forward) =>
508
- forward(operation)
509
- );
510
-
511
- const client = new ApolloClient({
512
- manifest,
513
- cache: new InMemoryCache(),
514
- link: ApolloLink.from([new ApolloLink(linkHandler), new ToolCallLink()]),
515
- });
516
-
517
- const variables = { id: "1" };
518
- const query = parse(manifest.operations[0].body);
519
-
520
- await expect(client.query({ query, variables })).resolves.toStrictEqual({
521
- data: {
522
- product: {
523
- id: "1",
524
- title: "Pen",
525
- rating: 5,
526
- price: 1.0,
527
- description: "Awesome pen",
528
- images: [],
529
- __typename: "Product",
530
- },
531
- },
532
- });
533
-
534
- expect(linkHandler).toHaveBeenCalledOnce();
535
- expect(linkHandler).toHaveBeenCalledWith(
536
- expect.objectContaining({ query, variables, operationType: "query" }),
537
- expect.any(Function)
538
- );
539
- });
540
-
541
- test("enforces ToolCallLink as terminating link", async () => {
542
- const manifest = createManifest();
543
- const expectedError = new Error(
544
- "The terminating link must be a `ToolCallLink`. If you are using a `split` link, ensure the `right` branch uses a `ToolCallLink` as the terminating link."
545
- );
546
-
547
- expect(() => {
548
- new ApolloClient({
549
- manifest,
550
- cache: new InMemoryCache(),
551
- link: new HttpLink(),
552
- });
553
- }).toThrow(expectedError);
554
-
555
- expect(() => {
556
- new ApolloClient({
557
- manifest,
558
- cache: new InMemoryCache(),
559
- link: new ApolloLink(),
560
- });
561
- }).toThrow(expectedError);
562
-
563
- expect(() => {
564
- new ApolloClient({
565
- manifest,
566
- cache: new InMemoryCache(),
567
- link: ApolloLink.from([new ApolloLink(), new HttpLink()]),
568
- });
569
- }).toThrow(expectedError);
570
-
571
- expect(() => {
572
- new ApolloClient({
573
- manifest,
574
- cache: new InMemoryCache(),
575
- link: ApolloLink.split(() => true, new ApolloLink(), new HttpLink()),
576
- });
577
- }).toThrow(expectedError);
578
-
579
- expect(() => {
580
- new ApolloClient({
581
- manifest,
582
- cache: new InMemoryCache(),
583
- link: ApolloLink.split(() => true, new ToolCallLink(), new HttpLink()),
584
- });
585
- }).toThrow(expectedError);
586
-
587
- // Allow you to use a custom terminating link for `split` links if the
588
- // custom link is the `left` branch link.
589
- expect(() => {
590
- new ApolloClient({
591
- manifest,
592
- cache: new InMemoryCache(),
593
- link: ApolloLink.split(() => true, new HttpLink(), new ToolCallLink()),
594
- });
595
- }).not.toThrow(expectedError);
596
-
597
- expect(() => {
598
- new ApolloClient({
599
- manifest,
600
- cache: new InMemoryCache(),
601
- link: ApolloLink.split(
602
- () => true,
603
- new ToolCallLink(),
604
- new ToolCallLink()
605
- ),
606
- });
607
- }).not.toThrow();
608
- });
609
- });
610
-
611
- function createManifest(
612
- overrides?: Partial<ApplicationManifest>
613
- ): ApplicationManifest {
614
- return {
615
- format: "apollo-ai-app-manifest",
616
- version: "1",
617
- name: "the-store",
618
- description:
619
- "An online store selling a variety of high quality products across many different categories.",
620
- hash: "f6a24922f6ad6ed8c2aa57baf3b8242ae5f38a09a6df3f2693077732434c4256",
621
- operations: [
622
- {
623
- id: "c43af26552874026c3fb346148c5795896aa2f3a872410a0a2621cffee25291c",
624
- name: "Product",
625
- type: "query",
626
- body: "query Product($id: ID!) {\n product(id: $id) {\n id\n title\n rating\n price\n description\n images\n __typename\n }\n}",
627
- variables: { id: "ID" },
628
- prefetch: false,
629
- tools: [
630
- {
631
- name: "Get Product",
632
- description: "Shows the details page for a specific product.",
633
- },
634
- ],
635
- },
636
- ],
637
- resource: "index.html",
638
- csp: {
639
- resourceDomains: [],
640
- connectDomains: [],
641
- frameDomains: [],
642
- redirectDomains: [],
643
- },
644
- ...overrides,
645
- };
646
- }
@@ -1,41 +0,0 @@
1
- import { expect, test, vi } from "vitest";
2
- import { ApolloProvider } from "../ApolloProvider.js";
3
- import { render } from "@testing-library/react";
4
- import { ApolloClient } from "../../core/ApolloClient.js";
5
- import { SET_GLOBALS_EVENT_TYPE } from "../../types/openai.js";
6
-
7
- test("Should call prefetch data when window.open is immediately available", () => {
8
- vi.stubGlobal("openai", {
9
- toolOutput: {},
10
- });
11
-
12
- const client = {
13
- prefetchData: vi.fn(async () => {}),
14
- } as unknown as ApolloClient;
15
-
16
- render(<ApolloProvider client={client} />);
17
-
18
- expect(client.prefetchData).toBeCalled();
19
- });
20
-
21
- test("Should NOT call prefetch data when window.open is not immediately available", () => {
22
- const client = {
23
- prefetchData: vi.fn(async () => {}),
24
- } as unknown as ApolloClient;
25
-
26
- render(<ApolloProvider client={client} />);
27
-
28
- expect(client.prefetchData).not.toBeCalled();
29
- });
30
-
31
- test("Should call prefetch data when window.open is not immediately available and event is sent", () => {
32
- const client = {
33
- prefetchData: vi.fn(async () => {}),
34
- } as unknown as ApolloClient;
35
-
36
- render(<ApolloProvider client={client} />);
37
-
38
- window.dispatchEvent(new CustomEvent(SET_GLOBALS_EVENT_TYPE));
39
-
40
- expect(client.prefetchData).toBeCalled();
41
- });
@@ -1,31 +0,0 @@
1
- import type { ReactNode } from "react";
2
- import { createContext, useContext, useState } from "react";
3
-
4
- interface ToolUseState {
5
- appName: string;
6
- hasNavigated: boolean;
7
- setHasNavigated: (v: boolean) => void;
8
- }
9
-
10
- const ToolUseContext = createContext<ToolUseState | null>(null);
11
-
12
- export declare namespace ToolUseProvider {
13
- export interface Props {
14
- children?: ReactNode;
15
- appName: string;
16
- }
17
- }
18
-
19
- export function ToolUseProvider({ children, appName }: ToolUseProvider.Props) {
20
- const [hasNavigated, setHasNavigated] = useState(false);
21
-
22
- return (
23
- <ToolUseContext.Provider value={{ hasNavigated, setHasNavigated, appName }}>
24
- {children}
25
- </ToolUseContext.Provider>
26
- );
27
- }
28
-
29
- export function useToolUseState() {
30
- return useContext(ToolUseContext);
31
- }