@apollo/client-ai-apps 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +131 -0
- package/dist/core/typeRegistration.d.ts +33 -0
- package/dist/core/typeRegistration.d.ts.map +1 -0
- package/dist/core/typeRegistration.js +2 -0
- package/dist/core/typeRegistration.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/react/hooks/useToolInfo.d.ts +3 -0
- package/dist/mcp/react/hooks/useToolInfo.d.ts.map +1 -0
- package/dist/mcp/react/hooks/useToolInfo.js +10 -0
- package/dist/mcp/react/hooks/useToolInfo.js.map +1 -0
- package/dist/mcp/react/hooks/useToolInput.d.ts +6 -1
- package/dist/mcp/react/hooks/useToolInput.d.ts.map +1 -1
- package/dist/mcp/react/hooks/useToolInput.js +4 -0
- package/dist/mcp/react/hooks/useToolInput.js.map +1 -1
- package/dist/mcp/react/hooks/useToolName.d.ts +6 -1
- package/dist/mcp/react/hooks/useToolName.d.ts.map +1 -1
- package/dist/mcp/react/hooks/useToolName.js +4 -0
- package/dist/mcp/react/hooks/useToolName.js.map +1 -1
- package/dist/mcp/react/index.d.ts +1 -0
- package/dist/mcp/react/index.d.ts.map +1 -1
- package/dist/mcp/react/index.js +1 -0
- package/dist/mcp/react/index.js.map +1 -1
- package/dist/openai/react/hooks/useToolInfo.d.ts +3 -0
- package/dist/openai/react/hooks/useToolInfo.d.ts.map +1 -0
- package/dist/openai/react/hooks/useToolInfo.js +10 -0
- package/dist/openai/react/hooks/useToolInfo.js.map +1 -0
- package/dist/openai/react/hooks/useToolInput.d.ts +6 -1
- package/dist/openai/react/hooks/useToolInput.d.ts.map +1 -1
- package/dist/openai/react/hooks/useToolInput.js +4 -0
- package/dist/openai/react/hooks/useToolInput.js.map +1 -1
- package/dist/openai/react/hooks/useToolName.d.ts +6 -1
- package/dist/openai/react/hooks/useToolName.d.ts.map +1 -1
- package/dist/openai/react/hooks/useToolName.js +4 -0
- package/dist/openai/react/hooks/useToolName.js.map +1 -1
- package/dist/openai/react/index.d.ts +1 -0
- package/dist/openai/react/index.d.ts.map +1 -1
- package/dist/openai/react/index.js +1 -0
- package/dist/openai/react/index.js.map +1 -1
- package/dist/react/index.d.ts +9 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +9 -0
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mcp.d.ts +1 -1
- package/dist/react/index.mcp.d.ts.map +1 -1
- package/dist/react/index.mcp.js +1 -1
- package/dist/react/index.mcp.js.map +1 -1
- package/dist/react/index.openai.d.ts +1 -1
- package/dist/react/index.openai.d.ts.map +1 -1
- package/dist/react/index.openai.js +1 -1
- package/dist/react/index.openai.js.map +1 -1
- package/dist/tsconfig/core/tsconfig.json +2 -0
- package/dist/tsconfig/mcp/tsconfig.json +2 -0
- package/dist/tsconfig/openai/tsconfig.json +2 -0
- package/dist/vite/apolloClientAiApps.d.ts +1 -0
- package/dist/vite/apolloClientAiApps.d.ts.map +1 -1
- package/dist/vite/apolloClientAiApps.js +346 -43
- package/dist/vite/apolloClientAiApps.js.map +1 -1
- package/dist/vite/utilities/recast.d.ts +54 -0
- package/dist/vite/utilities/recast.d.ts.map +1 -0
- package/dist/vite/utilities/recast.js +71 -0
- package/dist/vite/utilities/recast.js.map +1 -0
- package/package.json +7 -3
- package/src/core/typeRegistration.ts +32 -0
- package/src/index.ts +7 -0
- package/src/mcp/react/hooks/__tests__/useToolInfo.test.tsx +53 -0
- package/src/mcp/react/hooks/useToolInfo.ts +13 -0
- package/src/mcp/react/hooks/useToolInput.ts +6 -1
- package/src/mcp/react/hooks/useToolName.ts +6 -1
- package/src/mcp/react/index.ts +1 -0
- package/src/openai/react/hooks/__tests__/useToolInfo.test.tsx +92 -0
- package/src/openai/react/hooks/useToolInfo.ts +13 -0
- package/src/openai/react/hooks/useToolInput.ts +6 -1
- package/src/openai/react/hooks/useToolName.ts +6 -1
- package/src/openai/react/index.ts +1 -0
- package/src/react/index.mcp.ts +1 -0
- package/src/react/index.openai.ts +1 -0
- package/src/react/index.ts +11 -0
- package/src/tsconfig/core/tsconfig.json +2 -0
- package/src/tsconfig/mcp/tsconfig.json +2 -0
- package/src/tsconfig/openai/tsconfig.json +2 -0
- package/src/vite/__tests__/apolloClientAiApps.test.ts +754 -6
- package/src/vite/apolloClientAiApps.ts +564 -68
- package/src/vite/utilities/recast.ts +100 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ToolInfo } from "../../../core/typeRegistration.js";
|
|
2
|
+
import { useApolloClient } from "./useApolloClient.js";
|
|
3
|
+
|
|
4
|
+
export function useToolInfo(): ToolInfo | undefined {
|
|
5
|
+
const appManager = useApolloClient()["appManager"];
|
|
6
|
+
const toolName = appManager.toolName;
|
|
7
|
+
|
|
8
|
+
if (!toolName) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return { toolName, toolInput: appManager.toolInput };
|
|
13
|
+
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import type { ToolInput } from "../../../core/typeRegistration.js";
|
|
1
2
|
import { useApolloClient } from "./useApolloClient.js";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Please use the `useToolInfo` hook. `useToolInput` will be removed
|
|
6
|
+
* in the next major version.
|
|
7
|
+
*/
|
|
8
|
+
export function useToolInput(): ToolInput | undefined {
|
|
4
9
|
return useApolloClient()["appManager"].toolInput;
|
|
5
10
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import type { ToolName } from "../../../core/typeRegistration.js";
|
|
1
2
|
import { useApolloClient } from "./useApolloClient.js";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Please use the `useToolInfo` hook. `useToolName` will be removed
|
|
6
|
+
* in the next major version.
|
|
7
|
+
*/
|
|
8
|
+
export const useToolName = (): ToolName | undefined => {
|
|
4
9
|
return useApolloClient()["appManager"].toolName;
|
|
5
10
|
};
|
|
@@ -3,5 +3,6 @@ export { useHostContext } from "./hooks/useHostContext.js";
|
|
|
3
3
|
export { useToolName } from "./hooks/useToolName.js";
|
|
4
4
|
export { useToolMetadata } from "./hooks/useToolMetadata.js";
|
|
5
5
|
export { useToolInput } from "./hooks/useToolInput.js";
|
|
6
|
+
export { useToolInfo } from "./hooks/useToolInfo.js";
|
|
6
7
|
export { createHydrationUtils } from "./hooks/createHydrationUtils.js";
|
|
7
8
|
export { useWidgetState } from "./hooks/useWidgetState.js";
|
package/src/react/index.mcp.ts
CHANGED
package/src/react/index.ts
CHANGED
|
@@ -12,6 +12,10 @@ export const useApp =
|
|
|
12
12
|
export const useHostContext =
|
|
13
13
|
missingHook<typeof import("./index.mcp.js").useHostContext>("useHostContext");
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Please use the `useToolInfo` hook. `useToolInput` will be removed
|
|
17
|
+
* in the next major version.
|
|
18
|
+
*/
|
|
15
19
|
export const useToolInput =
|
|
16
20
|
missingHook<typeof import("./index.mcp.js").useToolInput>("useToolInput");
|
|
17
21
|
|
|
@@ -20,9 +24,16 @@ export const useToolMetadata =
|
|
|
20
24
|
"useToolMetadata"
|
|
21
25
|
);
|
|
22
26
|
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Please use the `useToolInfo` hook. `useToolName` will be removed
|
|
29
|
+
* in the next major version.
|
|
30
|
+
*/
|
|
23
31
|
export const useToolName =
|
|
24
32
|
missingHook<typeof import("./index.mcp.js").useToolName>("useToolName");
|
|
25
33
|
|
|
34
|
+
export const useToolInfo =
|
|
35
|
+
missingHook<typeof import("./index.mcp.js").useToolInfo>("useToolInfo");
|
|
36
|
+
|
|
26
37
|
/** @experimental */
|
|
27
38
|
export const createHydrationUtils = missingHook<
|
|
28
39
|
typeof import("./index.mcp.js").createHydrationUtils
|