@apollo/client-ai-apps 0.3.2 → 0.4.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.
- package/.github/workflows/pr.yaml +52 -3
- package/.github/workflows/prep-release.yml +38 -0
- package/.github/workflows/release.yaml +8 -4
- package/.github/workflows/verify-changeset.yml +58 -0
- package/CHANGELOG.md +88 -0
- package/dist/core/ApolloClient.d.ts +3 -2
- package/dist/core/ApolloClient.d.ts.map +1 -0
- package/dist/core/ApolloClient.js +65 -0
- package/dist/core/ApolloClient.js.map +1 -0
- package/dist/index.d.ts +18 -18
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -279
- package/dist/index.js.map +1 -0
- package/dist/link/ToolCallLink.d.ts +1 -0
- package/dist/link/ToolCallLink.d.ts.map +1 -0
- package/dist/link/ToolCallLink.js +39 -0
- package/dist/link/ToolCallLink.js.map +1 -0
- package/dist/react/ApolloProvider.d.ts +4 -3
- package/dist/react/ApolloProvider.d.ts.map +1 -0
- package/dist/react/ApolloProvider.js +30 -0
- package/dist/react/ApolloProvider.js.map +1 -0
- package/dist/react/context/ToolUseContext.d.ts +4 -3
- package/dist/react/context/ToolUseContext.d.ts.map +1 -0
- package/dist/react/context/ToolUseContext.js +11 -0
- package/dist/react/context/ToolUseContext.js.map +1 -0
- package/dist/react/hooks/useCallTool.d.ts +4 -0
- package/dist/react/hooks/useCallTool.d.ts.map +1 -0
- package/dist/react/hooks/useCallTool.js +5 -0
- package/dist/react/hooks/useCallTool.js.map +1 -0
- package/dist/react/hooks/useOpenAiGlobal.d.ts +2 -1
- package/dist/react/hooks/useOpenAiGlobal.d.ts.map +1 -0
- package/dist/react/hooks/useOpenAiGlobal.js +20 -0
- package/dist/react/hooks/useOpenAiGlobal.js.map +1 -0
- package/dist/react/hooks/useOpenExternal.d.ts +1 -0
- package/dist/react/hooks/useOpenExternal.d.ts.map +1 -0
- package/dist/react/hooks/useOpenExternal.js +5 -0
- package/dist/react/hooks/useOpenExternal.js.map +1 -0
- package/dist/react/hooks/useRequestDisplayMode.d.ts +2 -1
- package/dist/react/hooks/useRequestDisplayMode.d.ts.map +1 -0
- package/dist/react/hooks/useRequestDisplayMode.js +6 -0
- package/dist/react/hooks/useRequestDisplayMode.js.map +1 -0
- package/dist/react/hooks/useSendFollowUpMessage.d.ts +1 -0
- package/dist/react/hooks/useSendFollowUpMessage.d.ts.map +1 -0
- package/dist/react/hooks/useSendFollowUpMessage.js +8 -0
- package/dist/react/hooks/useSendFollowUpMessage.js.map +1 -0
- package/dist/react/hooks/useToolEffect.d.ts +1 -0
- package/dist/react/hooks/useToolEffect.d.ts.map +1 -0
- package/dist/react/hooks/useToolEffect.js +28 -0
- package/dist/react/hooks/useToolEffect.js.map +1 -0
- package/dist/react/hooks/useToolInput.d.ts +1 -0
- package/dist/react/hooks/useToolInput.d.ts.map +1 -0
- package/dist/react/hooks/useToolInput.js +6 -0
- package/dist/react/hooks/useToolInput.js.map +1 -0
- package/dist/react/hooks/useToolName.d.ts +1 -0
- package/dist/react/hooks/useToolName.d.ts.map +1 -0
- package/dist/react/hooks/useToolName.js +6 -0
- package/dist/react/hooks/useToolName.js.map +1 -0
- package/dist/react/hooks/useToolOutput.d.ts +2 -1
- package/dist/react/hooks/useToolOutput.d.ts.map +1 -0
- package/dist/react/hooks/useToolOutput.js +5 -0
- package/dist/react/hooks/useToolOutput.js.map +1 -0
- package/dist/react/hooks/useToolResponseMetadata.d.ts +2 -1
- package/dist/react/hooks/useToolResponseMetadata.d.ts.map +1 -0
- package/dist/react/hooks/useToolResponseMetadata.js +5 -0
- package/dist/react/hooks/useToolResponseMetadata.js.map +1 -0
- package/dist/react/hooks/useWidgetState.d.ts +3 -2
- package/dist/react/hooks/useWidgetState.d.ts.map +1 -0
- package/dist/react/hooks/useWidgetState.js +27 -0
- package/dist/react/hooks/useWidgetState.js.map +1 -0
- package/dist/types/application-manifest.d.ts +15 -0
- package/dist/types/application-manifest.d.ts.map +1 -0
- package/dist/types/application-manifest.js +2 -0
- package/dist/types/application-manifest.js.map +1 -0
- package/dist/types/openai.d.ts +1 -0
- package/dist/types/openai.d.ts.map +1 -0
- package/dist/types/openai.js +6 -0
- package/dist/types/openai.js.map +1 -0
- package/dist/vite/absolute_asset_imports_plugin.d.ts +1 -0
- package/dist/vite/absolute_asset_imports_plugin.d.ts.map +1 -0
- package/dist/vite/absolute_asset_imports_plugin.js +17 -0
- package/dist/vite/absolute_asset_imports_plugin.js.map +1 -0
- package/dist/vite/application_manifest_plugin.d.ts +2 -1
- package/dist/vite/application_manifest_plugin.d.ts.map +1 -0
- package/dist/vite/application_manifest_plugin.js +317 -0
- package/dist/vite/application_manifest_plugin.js.map +1 -0
- package/dist/vite/index.d.ts +3 -2
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.js +3 -307
- package/dist/vite/index.js.map +1 -0
- package/knope.toml +63 -0
- package/package.json +19 -11
- package/src/core/ApolloClient.ts +10 -5
- package/src/core/__tests__/ApolloClient.test.ts +33 -10
- package/src/index.ts +19 -18
- package/src/react/ApolloProvider.tsx +4 -3
- package/src/react/__tests__/ApolloProvider.test.tsx +3 -3
- package/src/react/context/ToolUseContext.tsx +2 -1
- package/src/react/hooks/__tests__/useCallTool.test.ts +1 -1
- package/src/react/hooks/__tests__/useOpenAiGlobal.test.ts +6 -6
- package/src/react/hooks/__tests__/useOpenExternal.test.tsx +2 -2
- package/src/react/hooks/__tests__/useRequestDisplayMode.test.ts +2 -2
- package/src/react/hooks/__tests__/useSendFollowUpMessage.test.ts +1 -1
- package/src/react/hooks/__tests__/useToolEffect.test.tsx +2 -2
- package/src/react/hooks/__tests__/useToolInput.test.ts +1 -1
- package/src/react/hooks/__tests__/useToolName.test.ts +1 -1
- package/src/react/hooks/__tests__/useToolOutput.test.tsx +2 -2
- package/src/react/hooks/__tests__/useToolResponseMetadata.test.tsx +2 -2
- package/src/react/hooks/__tests__/useWidgetState.test.tsx +2 -2
- package/src/react/hooks/useOpenAiGlobal.ts +2 -5
- package/src/react/hooks/useOpenExternal.ts +1 -1
- package/src/react/hooks/useRequestDisplayMode.ts +1 -1
- package/src/react/hooks/useToolEffect.tsx +3 -3
- package/src/react/hooks/useToolInput.ts +1 -1
- package/src/react/hooks/useToolName.ts +1 -1
- package/src/react/hooks/useToolOutput.ts +1 -1
- package/src/react/hooks/useToolResponseMetadata.ts +1 -1
- package/src/react/hooks/useWidgetState.ts +4 -3
- package/src/testing/internal/index.ts +2 -2
- package/src/testing/internal/matchers/index.ts +1 -1
- package/src/testing/internal/matchers/toRerender.ts +2 -2
- package/src/testing/internal/matchers/{index.d.ts → types.ts} +1 -1
- package/src/testing/internal/openai/dispatchStateChange.ts +1 -1
- package/src/testing/internal/openai/stubOpenAiGlobals.ts +6 -2
- package/src/types/application-manifest.ts +16 -0
- package/src/vite/__tests__/absolute_asset_imports_plugin.test.ts +2 -2
- package/src/vite/__tests__/application_manifest_plugin.test.ts +460 -240
- package/src/vite/application_manifest_plugin.ts +253 -93
- package/src/vite/index.ts +2 -2
- package/tsconfig.base.build.json +13 -0
- package/tsconfig.base.json +21 -0
- package/tsconfig.config.json +9 -0
- package/tsconfig.json +10 -0
- package/tsconfig.src.build.json +14 -0
- package/tsconfig.src.json +17 -0
- package/tsconfig.test.json +20 -0
- package/tsconfig.vite.build.json +6 -0
- package/tsconfig.vite.json +16 -0
- package/scripts/build-vite.mjs +0 -18
- package/scripts/build.mjs +0 -7
- package/scripts/shared.mjs +0 -9
package/src/index.ts
CHANGED
|
@@ -9,8 +9,8 @@ export type {
|
|
|
9
9
|
Theme,
|
|
10
10
|
UserAgent,
|
|
11
11
|
UnknownObject,
|
|
12
|
-
} from "./types/openai";
|
|
13
|
-
export { SET_GLOBALS_EVENT_TYPE, SetGlobalsEvent } from "./types/openai";
|
|
12
|
+
} from "./types/openai.js";
|
|
13
|
+
export { SET_GLOBALS_EVENT_TYPE, SetGlobalsEvent } from "./types/openai.js";
|
|
14
14
|
|
|
15
15
|
export type {
|
|
16
16
|
ApplicationManifest,
|
|
@@ -18,21 +18,22 @@ export type {
|
|
|
18
18
|
ManifestTool,
|
|
19
19
|
ManifestExtraInput,
|
|
20
20
|
ManifestCsp,
|
|
21
|
-
|
|
21
|
+
ManifestLabels,
|
|
22
|
+
ManifestWidgetSettings,
|
|
23
|
+
} from "./types/application-manifest.js";
|
|
22
24
|
|
|
23
|
-
export { ToolUseProvider } from "./react/context/ToolUseContext";
|
|
24
|
-
export { useOpenAiGlobal } from "./react/hooks/useOpenAiGlobal";
|
|
25
|
-
export { useToolName } from "./react/hooks/useToolName";
|
|
26
|
-
export { useToolInput } from "./react/hooks/useToolInput";
|
|
27
|
-
export { useSendFollowUpMessage } from "./react/hooks/useSendFollowUpMessage";
|
|
28
|
-
export { useRequestDisplayMode } from "./react/hooks/useRequestDisplayMode";
|
|
29
|
-
export { useToolEffect } from "./react/hooks/useToolEffect";
|
|
30
|
-
export { useOpenExternal } from "./react/hooks/useOpenExternal";
|
|
31
|
-
export { useToolOutput } from "./react/hooks/useToolOutput";
|
|
32
|
-
export { useToolResponseMetadata } from "./react/hooks/useToolResponseMetadata";
|
|
33
|
-
export { useWidgetState } from "./react/hooks/useWidgetState";
|
|
25
|
+
export { ToolUseProvider } from "./react/context/ToolUseContext.js";
|
|
26
|
+
export { useOpenAiGlobal } from "./react/hooks/useOpenAiGlobal.js";
|
|
27
|
+
export { useToolName } from "./react/hooks/useToolName.js";
|
|
28
|
+
export { useToolInput } from "./react/hooks/useToolInput.js";
|
|
29
|
+
export { useSendFollowUpMessage } from "./react/hooks/useSendFollowUpMessage.js";
|
|
30
|
+
export { useRequestDisplayMode } from "./react/hooks/useRequestDisplayMode.js";
|
|
31
|
+
export { useToolEffect } from "./react/hooks/useToolEffect.js";
|
|
32
|
+
export { useOpenExternal } from "./react/hooks/useOpenExternal.js";
|
|
33
|
+
export { useToolOutput } from "./react/hooks/useToolOutput.js";
|
|
34
|
+
export { useToolResponseMetadata } from "./react/hooks/useToolResponseMetadata.js";
|
|
35
|
+
export { useWidgetState } from "./react/hooks/useWidgetState.js";
|
|
34
36
|
|
|
35
|
-
export
|
|
36
|
-
export {
|
|
37
|
-
export {
|
|
38
|
-
export { ToolCallLink } from "./link/ToolCallLink";
|
|
37
|
+
export { ApolloClient } from "./core/ApolloClient.js";
|
|
38
|
+
export { ApolloProvider } from "./react/ApolloProvider.js";
|
|
39
|
+
export { ToolCallLink } from "./link/ToolCallLink.js";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
2
3
|
import { ApolloProvider as BaseApolloProvider } from "@apollo/client/react";
|
|
3
|
-
import { ApolloClient } from "../core/ApolloClient";
|
|
4
|
-
import { SET_GLOBALS_EVENT_TYPE } from "../types/openai";
|
|
4
|
+
import type { ApolloClient } from "../core/ApolloClient.js";
|
|
5
|
+
import { SET_GLOBALS_EVENT_TYPE } from "../types/openai.js";
|
|
5
6
|
|
|
6
7
|
export declare namespace ApolloProvider {
|
|
7
8
|
export interface Props {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { expect, test, vi } from "vitest";
|
|
2
|
-
import { ApolloProvider } from "../ApolloProvider";
|
|
2
|
+
import { ApolloProvider } from "../ApolloProvider.js";
|
|
3
3
|
import { render } from "@testing-library/react";
|
|
4
|
-
import { ApolloClient } from "../../core/ApolloClient";
|
|
5
|
-
import { SET_GLOBALS_EVENT_TYPE } from "../../types/openai";
|
|
4
|
+
import { ApolloClient } from "../../core/ApolloClient.js";
|
|
5
|
+
import { SET_GLOBALS_EVENT_TYPE } from "../../types/openai.js";
|
|
6
6
|
|
|
7
7
|
test("Should call prefetch data when window.open is immediately available", () => {
|
|
8
8
|
vi.stubGlobal("openai", {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { expect, test, vi } from "vitest";
|
|
2
|
-
import { useOpenAiGlobal } from "../useOpenAiGlobal";
|
|
2
|
+
import { useOpenAiGlobal } from "../useOpenAiGlobal.js";
|
|
3
3
|
import { renderHook, act } from "@testing-library/react";
|
|
4
|
-
import { SET_GLOBALS_EVENT_TYPE } from "../../../types/openai";
|
|
4
|
+
import { SET_GLOBALS_EVENT_TYPE } from "../../../types/openai.js";
|
|
5
5
|
|
|
6
6
|
test("Should update value when globals are updated and event it triggered", async () => {
|
|
7
7
|
vi.stubGlobal("openai", {
|
|
@@ -9,7 +9,7 @@ test("Should update value when globals are updated and event it triggered", asyn
|
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
const { result } = renderHook(() => useOpenAiGlobal("toolResponseMetadata"));
|
|
12
|
-
const beforeValue = result.current
|
|
12
|
+
const beforeValue = result.current?.toolName;
|
|
13
13
|
|
|
14
14
|
act(() => {
|
|
15
15
|
vi.stubGlobal("openai", {
|
|
@@ -24,7 +24,7 @@ test("Should update value when globals are updated and event it triggered", asyn
|
|
|
24
24
|
);
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
const afterValue = result.current
|
|
27
|
+
const afterValue = result.current?.toolName;
|
|
28
28
|
|
|
29
29
|
expect(beforeValue).toBe("my-tool");
|
|
30
30
|
expect(afterValue).toBe("my-other-tool");
|
|
@@ -36,7 +36,7 @@ test("Should not update value when event key does not match the provided key", a
|
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
const { result } = renderHook(() => useOpenAiGlobal("toolResponseMetadata"));
|
|
39
|
-
const beforeValue = result.current
|
|
39
|
+
const beforeValue = result.current?.toolName;
|
|
40
40
|
|
|
41
41
|
act(() => {
|
|
42
42
|
vi.stubGlobal("openai", {
|
|
@@ -49,7 +49,7 @@ test("Should not update value when event key does not match the provided key", a
|
|
|
49
49
|
);
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
const afterValue = result.current
|
|
52
|
+
const afterValue = result.current?.toolName;
|
|
53
53
|
|
|
54
54
|
expect(beforeValue).toBe("my-tool");
|
|
55
55
|
expect(afterValue).toBe("my-tool");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { expect, test, vi } from "vitest";
|
|
2
2
|
import { renderHookToSnapshotStream } from "@testing-library/react-render-stream";
|
|
3
|
-
import { useOpenExternal } from "../useOpenExternal";
|
|
4
|
-
import { stubOpenAiGlobals } from "../../../testing/internal";
|
|
3
|
+
import { useOpenExternal } from "../useOpenExternal.js";
|
|
4
|
+
import { stubOpenAiGlobals } from "../../../testing/internal/index.js";
|
|
5
5
|
|
|
6
6
|
test("calls the global openExternal function", async () => {
|
|
7
7
|
const openExternalMock = vi.fn();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { expect, test, vi } from "vitest";
|
|
2
|
-
import { useRequestDisplayMode } from "../useRequestDisplayMode";
|
|
3
|
-
import { DisplayMode } from "../../../types/openai";
|
|
2
|
+
import { useRequestDisplayMode } from "../useRequestDisplayMode.js";
|
|
3
|
+
import type { DisplayMode } from "../../../types/openai.js";
|
|
4
4
|
|
|
5
5
|
test("Should set display mode when returned function is called", async () => {
|
|
6
6
|
vi.stubGlobal("openai", {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { expect, test, vi } from "vitest";
|
|
2
|
-
import { useSendFollowUpMessage } from "../useSendFollowUpMessage";
|
|
2
|
+
import { useSendFollowUpMessage } from "../useSendFollowUpMessage.js";
|
|
3
3
|
|
|
4
4
|
test("Should set display mode when returned function is called", async () => {
|
|
5
5
|
vi.stubGlobal("openai", {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { expect, test, vi } from "vitest";
|
|
2
|
-
import { useToolEffect } from "../useToolEffect";
|
|
2
|
+
import { useToolEffect } from "../useToolEffect.js";
|
|
3
3
|
import { renderHook } from "@testing-library/react";
|
|
4
|
-
import { ToolUseProvider } from "../../context/ToolUseContext";
|
|
4
|
+
import { ToolUseProvider } from "../../context/ToolUseContext.js";
|
|
5
5
|
|
|
6
6
|
test("Should trigger effect when tool name matches toolResponseMetadata", async () => {
|
|
7
7
|
vi.stubGlobal("openai", {
|
|
@@ -2,9 +2,9 @@ import { afterEach, expect, test, vi } from "vitest";
|
|
|
2
2
|
import {
|
|
3
3
|
dispatchStateChange,
|
|
4
4
|
stubOpenAiGlobals,
|
|
5
|
-
} from "../../../testing/internal";
|
|
5
|
+
} from "../../../testing/internal/index.js";
|
|
6
6
|
import { renderHookToSnapshotStream } from "@testing-library/react-render-stream";
|
|
7
|
-
import { useToolOutput } from "../useToolOutput";
|
|
7
|
+
import { useToolOutput } from "../useToolOutput.js";
|
|
8
8
|
|
|
9
9
|
afterEach(() => {
|
|
10
10
|
vi.unstubAllGlobals();
|
|
@@ -2,9 +2,9 @@ import { afterEach, expect, test, vi } from "vitest";
|
|
|
2
2
|
import {
|
|
3
3
|
dispatchStateChange,
|
|
4
4
|
stubOpenAiGlobals,
|
|
5
|
-
} from "../../../testing/internal";
|
|
5
|
+
} from "../../../testing/internal/index.js";
|
|
6
6
|
import { renderHookToSnapshotStream } from "@testing-library/react-render-stream";
|
|
7
|
-
import { useToolResponseMetadata } from "../useToolResponseMetadata";
|
|
7
|
+
import { useToolResponseMetadata } from "../useToolResponseMetadata.js";
|
|
8
8
|
|
|
9
9
|
afterEach(() => {
|
|
10
10
|
vi.unstubAllGlobals();
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
disableActEnvironment,
|
|
4
4
|
renderHookToSnapshotStream,
|
|
5
5
|
} from "@testing-library/react-render-stream";
|
|
6
|
-
import { useWidgetState } from "../useWidgetState";
|
|
7
|
-
import { stubOpenAiGlobals } from "../../../testing/internal";
|
|
6
|
+
import { useWidgetState } from "../useWidgetState.js";
|
|
7
|
+
import { stubOpenAiGlobals } from "../../../testing/internal/index.js";
|
|
8
8
|
|
|
9
9
|
afterEach(() => {
|
|
10
10
|
vi.unstubAllGlobals();
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { useSyncExternalStore, useCallback } from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
SetGlobalsEvent,
|
|
5
|
-
OpenAiGlobals,
|
|
6
|
-
} from "../../types/openai";
|
|
2
|
+
import type { SetGlobalsEvent, OpenAiGlobals } from "../../types/openai.js";
|
|
3
|
+
import { SET_GLOBALS_EVENT_TYPE } from "../../types/openai.js";
|
|
7
4
|
|
|
8
5
|
export function useOpenAiGlobal<K extends keyof OpenAiGlobals>(
|
|
9
6
|
key: K
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect } from "react";
|
|
2
|
-
import { useToolName } from "./useToolName";
|
|
3
|
-
import { useToolInput } from "./useToolInput";
|
|
4
|
-
import { useToolUseState } from "../context/ToolUseContext";
|
|
2
|
+
import { useToolName } from "./useToolName.js";
|
|
3
|
+
import { useToolInput } from "./useToolInput.js";
|
|
4
|
+
import { useToolUseState } from "../context/ToolUseContext.js";
|
|
5
5
|
|
|
6
6
|
export const useToolEffect = (
|
|
7
7
|
toolName: string | string[],
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { SetStateAction
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { SetStateAction } from "react";
|
|
2
|
+
import { useCallback, useState } from "react";
|
|
3
|
+
import type { UnknownObject } from "../../types/openai.js";
|
|
4
|
+
import { useOpenAiGlobal } from "./useOpenAiGlobal.js";
|
|
4
5
|
|
|
5
6
|
export function useWidgetState<T extends UnknownObject>(
|
|
6
7
|
defaultState: T | (() => T)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { dispatchStateChange } from "./openai/dispatchStateChange";
|
|
2
|
-
export { stubOpenAiGlobals } from "./openai/stubOpenAiGlobals";
|
|
1
|
+
export { dispatchStateChange } from "./openai/dispatchStateChange.js";
|
|
2
|
+
export { stubOpenAiGlobals } from "./openai/stubOpenAiGlobals.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import "./toRerender";
|
|
1
|
+
import "./toRerender.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Vitest port of toRerender from
|
|
2
2
|
// https://github.com/testing-library/react-render-stream-testing-library/blob/main/src/expect/renderStreamMatchers.ts
|
|
3
|
-
import {
|
|
3
|
+
import type {
|
|
4
4
|
Assertable,
|
|
5
5
|
NextRenderOptions,
|
|
6
6
|
RenderStream,
|
|
7
|
-
WaitForRenderTimeoutError,
|
|
8
7
|
} from "@testing-library/react-render-stream";
|
|
8
|
+
import { WaitForRenderTimeoutError } from "@testing-library/react-render-stream";
|
|
9
9
|
|
|
10
10
|
import { expect } from "vitest";
|
|
11
11
|
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { vi } from "vitest";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import type {
|
|
3
|
+
API,
|
|
4
|
+
OpenAiGlobals,
|
|
5
|
+
UnknownObject,
|
|
6
|
+
} from "../../../types/openai.js";
|
|
7
|
+
import { dispatchStateChange } from "./dispatchStateChange.js";
|
|
4
8
|
|
|
5
9
|
export function stubOpenAiGlobals(globals?: Partial<API<any> & OpenAiGlobals>) {
|
|
6
10
|
vi.stubGlobal("openai", {
|
|
@@ -7,6 +7,8 @@ export type ApplicationManifest = {
|
|
|
7
7
|
resource: string;
|
|
8
8
|
operations: ManifestOperation[];
|
|
9
9
|
csp: ManifestCsp;
|
|
10
|
+
widgetSettings?: ManifestWidgetSettings;
|
|
11
|
+
labels?: ManifestLabels;
|
|
10
12
|
};
|
|
11
13
|
|
|
12
14
|
export type ManifestOperation = {
|
|
@@ -24,6 +26,13 @@ export type ManifestTool = {
|
|
|
24
26
|
name: string;
|
|
25
27
|
description: string;
|
|
26
28
|
extraInputs?: ManifestExtraInput[];
|
|
29
|
+
labels?: ManifestLabels;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type ManifestWidgetSettings = {
|
|
33
|
+
description?: string;
|
|
34
|
+
domain?: string;
|
|
35
|
+
prefersBorder?: boolean;
|
|
27
36
|
};
|
|
28
37
|
|
|
29
38
|
export type ManifestExtraInput = {
|
|
@@ -34,5 +43,12 @@ export type ManifestExtraInput = {
|
|
|
34
43
|
|
|
35
44
|
export type ManifestCsp = {
|
|
36
45
|
connectDomains: string[];
|
|
46
|
+
frameDomains: string[];
|
|
47
|
+
redirectDomains: string[];
|
|
37
48
|
resourceDomains: string[];
|
|
38
49
|
};
|
|
50
|
+
|
|
51
|
+
export type ManifestLabels = {
|
|
52
|
+
"toolInvocation/invoking"?: string;
|
|
53
|
+
"toolInvocation/invoked"?: string;
|
|
54
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { expect, test
|
|
2
|
-
import { AbsoluteAssetImportsPlugin } from "../absolute_asset_imports_plugin";
|
|
1
|
+
import { expect, test } from "vitest";
|
|
2
|
+
import { AbsoluteAssetImportsPlugin } from "../absolute_asset_imports_plugin.js";
|
|
3
3
|
|
|
4
4
|
test("Should replace root relative scripts with full url when origin is provided", () => {
|
|
5
5
|
const ctx = {
|