@copilotkit/vue 2.0.0-rc.20 → 2.0.0-rc.21
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/dist/index.cjs +1 -1
- package/dist/index.mjs +13 -13
- package/dist/use-render-activity-message-BAhbpSDh.js +16200 -0
- package/dist/use-render-activity-message-BAhbpSDh.js.map +1 -0
- package/dist/use-render-activity-message-DJ6q1qHV.cjs +114 -0
- package/dist/use-render-activity-message-DJ6q1qHV.cjs.map +1 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts +14 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts.map +1 -1
- package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts +10 -3
- package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts.map +1 -1
- package/dist/v2/components/CopilotKitInspector.vue.d.ts +5 -1
- package/dist/v2/components/CopilotKitInspector.vue.d.ts.map +1 -1
- package/dist/v2/components/MCPAppsActivityRenderer.d.ts.map +1 -1
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts +7 -21
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts +0 -5
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts +10 -15
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts +14 -138
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts.map +1 -1
- package/dist/v2/components/a2ui/catalog.d.ts.map +1 -1
- package/dist/v2/components/a2ui/utils.d.ts +3 -15
- package/dist/v2/components/a2ui/utils.d.ts.map +1 -1
- package/dist/v2/components/a2ui.d.ts +6 -1
- package/dist/v2/components/a2ui.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChat.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAttachmentQueue.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts +4 -8
- package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatLightbox.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallItem.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotThreadsDrawer.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/StreamingMarkdownDefault.vue.d.ts +1 -0
- package/dist/v2/components/chat/StreamingMarkdownDefault.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/audioRecorder.d.ts +3 -4
- package/dist/v2/components/chat/audioRecorder.d.ts.map +1 -1
- package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts +3 -2
- package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts.map +1 -1
- package/dist/v2/components/chat/index.d.ts +6 -6
- package/dist/v2/components/chat/tool-call-display-context.d.ts +3 -1
- package/dist/v2/components/chat/tool-call-display-context.d.ts.map +1 -1
- package/dist/v2/components/chat/tool-call-group-parts.d.ts.map +1 -1
- package/dist/v2/components/chat/types.d.ts +1 -1
- package/dist/v2/components/chat/types.d.ts.map +1 -1
- package/dist/v2/components/chat/use-lightbox.d.ts.map +1 -1
- package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts +1 -1
- package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts.map +1 -1
- package/dist/v2/hooks/use-agent-context.d.ts +2 -3
- package/dist/v2/hooks/use-agent-context.d.ts.map +1 -1
- package/dist/v2/hooks/use-agent.d.ts +4 -1
- package/dist/v2/hooks/use-agent.d.ts.map +1 -1
- package/dist/v2/hooks/use-attachments.d.ts +7 -0
- package/dist/v2/hooks/use-attachments.d.ts.map +1 -1
- package/dist/v2/hooks/use-capabilities.d.ts.map +1 -1
- package/dist/v2/hooks/use-component.d.ts +1 -0
- package/dist/v2/hooks/use-component.d.ts.map +1 -1
- package/dist/v2/hooks/use-configure-suggestions.d.ts +4 -9
- package/dist/v2/hooks/use-configure-suggestions.d.ts.map +1 -1
- package/dist/v2/hooks/use-default-render-tool.d.ts.map +1 -1
- package/dist/v2/hooks/use-human-in-the-loop.d.ts +2 -1
- package/dist/v2/hooks/use-human-in-the-loop.d.ts.map +1 -1
- package/dist/v2/hooks/use-interrupt.d.ts +0 -1
- package/dist/v2/hooks/use-interrupt.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-activity-message.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-custom-messages.d.ts.map +1 -1
- package/dist/v2/hooks/use-suggestions.d.ts.map +1 -1
- package/dist/v2/hooks/use-threads.d.ts +0 -8
- package/dist/v2/hooks/use-threads.d.ts.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.mjs +1 -1
- package/dist/v2/lib/vue-core.d.ts +12 -11
- package/dist/v2/lib/vue-core.d.ts.map +1 -1
- package/dist/v2/providers/CopilotChatConfigurationProvider.vue.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.types.d.ts +9 -124
- package/dist/v2/providers/CopilotKitProvider.types.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts +9 -10
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts.map +1 -1
- package/dist/v2/providers/chat-configuration-store-key.d.ts +8 -0
- package/dist/v2/providers/chat-configuration-store-key.d.ts.map +1 -0
- package/dist/v2/providers/markdown-renderer.d.ts +3 -1
- package/dist/v2/providers/markdown-renderer.d.ts.map +1 -1
- package/dist/v2/providers/use-inspector-thread-override.d.ts +5 -0
- package/dist/v2/providers/use-inspector-thread-override.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/v2/__tests__/exports.test.ts +10 -0
- package/src/v2/__tests__/mocks/web-inspector.ts +6 -0
- package/src/v2/__tests__/utils/test-helpers.ts +34 -4
- package/src/v2/components/A2UIMessageRenderer.ts +98 -68
- package/src/v2/components/A2UISurfaceActivityRenderer.vue +68 -103
- package/src/v2/components/CopilotKitInspector.vue +104 -51
- package/src/v2/components/MCPAppsActivityRenderer.ts +75 -201
- package/src/v2/components/OpenGenerativeUIRenderer.ts +78 -80
- package/src/v2/components/__tests__/A2UIMessageRenderer.test.ts +171 -8
- package/src/v2/components/__tests__/CopilotKitInspector.test.ts +42 -0
- package/src/v2/components/__tests__/OpenGenerativeUIRenderer.test.ts +9 -2
- package/src/v2/components/__tests__/OpenGenerativeUIToolRenderer.test.ts +38 -0
- package/src/v2/components/a2ui/A2UIBuiltInToolCallRenderer.ts +1 -6
- package/src/v2/components/a2ui/A2UICatalogContext.ts +27 -93
- package/src/v2/components/a2ui/A2UIRecoveryStates.ts +127 -327
- package/src/v2/components/a2ui/catalog.ts +2 -3
- package/src/v2/components/a2ui/utils.ts +13 -67
- package/src/v2/components/a2ui.ts +14 -21
- package/src/v2/components/chat/CopilotChat.vue +136 -324
- package/src/v2/components/chat/CopilotChatAttachmentQueue.vue +22 -45
- package/src/v2/components/chat/CopilotChatAudioRecorder.vue +19 -246
- package/src/v2/components/chat/CopilotChatInput.vue +69 -407
- package/src/v2/components/chat/CopilotChatLightbox.vue +10 -31
- package/src/v2/components/chat/CopilotChatMessageView.vue +52 -112
- package/src/v2/components/chat/CopilotChatToolCallGroup.vue +14 -45
- package/src/v2/components/chat/CopilotChatToolCallItem.vue +6 -4
- package/src/v2/components/chat/CopilotChatToolCallsView.vue +16 -19
- package/src/v2/components/chat/CopilotChatView.vue +28 -23
- package/src/v2/components/chat/CopilotPopupViewInternal.vue +21 -97
- package/src/v2/components/chat/CopilotSidebarViewInternal.vue +24 -25
- package/src/v2/components/chat/CopilotThreadsDrawer.vue +37 -102
- package/src/v2/components/chat/StreamingMarkdownDefault.vue +13 -26
- package/src/v2/components/chat/__tests__/CopilotChat.test.ts +12 -10
- package/src/v2/components/chat/__tests__/CopilotChatAttachmentQueue.test.ts +28 -0
- package/src/v2/components/chat/__tests__/CopilotChatInput.test.ts +56 -0
- package/src/v2/components/chat/__tests__/CopilotPopupView.test.ts +19 -0
- package/src/v2/components/chat/__tests__/CopilotSidebarView.position.test.ts +32 -8
- package/src/v2/components/chat/__tests__/CopilotSidebarView.test.ts +2 -1
- package/src/v2/components/chat/__tests__/StreamingMarkdownDefault.test.ts +54 -0
- package/src/v2/components/chat/audioRecorder.ts +4 -7
- package/src/v2/components/chat/copilotChatToolCallItemRender.ts +22 -71
- package/src/v2/components/chat/tool-call-display-context.ts +6 -1
- package/src/v2/components/chat/tool-call-group-parts.ts +13 -33
- package/src/v2/components/chat/types.ts +1 -1
- package/src/v2/components/chat/use-lightbox.ts +15 -33
- package/src/v2/hooks/__tests__/use-agent-error-state.test.ts +5 -3
- package/src/v2/hooks/__tests__/use-agent-stability.test.ts +25 -4
- package/src/v2/hooks/__tests__/use-agent-throttle.test.ts +5 -1
- package/src/v2/hooks/__tests__/use-agent.test.ts +6 -3
- package/src/v2/hooks/__tests__/use-component.test.ts +21 -0
- package/src/v2/hooks/__tests__/use-configure-suggestions.test.ts +30 -1
- package/src/v2/hooks/__tests__/use-default-render-tool.test.ts +10 -10
- package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.ts +4 -0
- package/src/v2/hooks/__tests__/use-human-in-the-loop.e2e.test.ts +6 -1
- package/src/v2/hooks/__tests__/use-human-in-the-loop.test.ts +187 -12
- package/src/v2/hooks/__tests__/use-interrupt.test.ts +97 -0
- package/src/v2/hooks/__tests__/use-render-activity-message.test.ts +2 -1
- package/src/v2/hooks/__tests__/use-threads.test.ts +48 -6
- package/src/v2/hooks/use-agent-context.ts +4 -10
- package/src/v2/hooks/use-agent.ts +86 -290
- package/src/v2/hooks/use-attachments.ts +42 -166
- package/src/v2/hooks/use-capabilities.ts +2 -7
- package/src/v2/hooks/use-component.ts +7 -4
- package/src/v2/hooks/use-configure-suggestions.ts +28 -218
- package/src/v2/hooks/use-default-render-tool.ts +34 -94
- package/src/v2/hooks/use-human-in-the-loop.ts +11 -80
- package/src/v2/hooks/use-interrupt.ts +29 -308
- package/src/v2/hooks/use-render-activity-message.ts +17 -20
- package/src/v2/hooks/use-render-custom-messages.ts +20 -63
- package/src/v2/hooks/use-suggestions.ts +9 -33
- package/src/v2/hooks/use-threads.ts +43 -273
- package/src/v2/lib/__tests__/vue-core-renderers.test.ts +42 -0
- package/src/v2/lib/vue-core.ts +67 -72
- package/src/v2/providers/CopilotChatConfigurationProvider.vue +48 -186
- package/src/v2/providers/CopilotKitProvider.types.ts +12 -127
- package/src/v2/providers/CopilotKitProvider.vue +188 -402
- package/src/v2/providers/__tests__/CopilotChatConfigurationProvider.test.ts +22 -2
- package/src/v2/providers/__tests__/CopilotKitProvider.a2ui.test.ts +19 -1
- package/src/v2/providers/__tests__/CopilotKitProvider.config.test.ts +124 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.sandboxFunctions.test.ts +4 -1
- package/src/v2/providers/__tests__/CopilotKitProvider.test.ts +45 -2
- package/src/v2/providers/chat-configuration-store-key.ts +9 -0
- package/src/v2/providers/markdown-renderer.ts +7 -1
- package/src/v2/providers/use-inspector-thread-override.ts +22 -80
- package/vite.config.ts +5 -1
- package/vitest.config.ts +12 -7
- package/dist/use-render-activity-message-CsWYyd6r.cjs +0 -91
- package/dist/use-render-activity-message-CsWYyd6r.cjs.map +0 -1
- package/dist/use-render-activity-message-DntKKNdd.js +0 -17418
- package/dist/use-render-activity-message-DntKKNdd.js.map +0 -1
- package/dist/v2/components/chat/normalize-auto-scroll.d.ts +0 -3
- package/dist/v2/components/chat/normalize-auto-scroll.d.ts.map +0 -1
- package/dist/v2/lib/is-mobile-viewport.d.ts +0 -2
- package/dist/v2/lib/is-mobile-viewport.d.ts.map +0 -1
- package/src/v2/components/__tests__/A2UICatalogContext.test.ts +0 -63
- package/src/v2/components/a2ui/__tests__/A2UIRecoveryStates.test.ts +0 -175
- package/src/v2/components/chat/normalize-auto-scroll.ts +0 -3
- package/src/v2/lib/is-mobile-viewport.ts +0 -5
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-auto-scroll.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/chat/normalize-auto-scroll.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,IAAI,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC/E,YAAY,EAAE,eAAe,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-mobile-viewport.d.ts","sourceRoot":"","sources":["../../../src/v2/lib/is-mobile-viewport.ts"],"names":[],"mappings":"AACA,OAAO,EACL,uBAAuB,IAAI,sBAAsB,EACjD,iBAAiB,IAAI,gBAAgB,GACtC,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { z } from "zod-v3";
|
|
3
|
-
import { Catalog } from "@a2ui/web_core/v0_9";
|
|
4
|
-
import type { ComponentApi } from "@a2ui/web_core/v0_9";
|
|
5
|
-
import { buildCatalogContextValue } from "../a2ui/A2UICatalogContext";
|
|
6
|
-
import { vueBasicCatalog } from "../a2ui/catalog";
|
|
7
|
-
|
|
8
|
-
function makeCustomCatalog(): Catalog<ComponentApi> {
|
|
9
|
-
const components: ComponentApi[] = [
|
|
10
|
-
{ name: "FlightCard", schema: z.object({ airline: z.string() }) },
|
|
11
|
-
{
|
|
12
|
-
name: "PieChart",
|
|
13
|
-
schema: z.object({ innerRadius: z.number().optional() }),
|
|
14
|
-
},
|
|
15
|
-
];
|
|
16
|
-
return new Catalog<ComponentApi>(
|
|
17
|
-
"copilotkit://custom-catalog",
|
|
18
|
-
components,
|
|
19
|
-
[],
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
describe("buildCatalogContextValue", () => {
|
|
24
|
-
it("includes each custom component's JSON schema by default", () => {
|
|
25
|
-
const value = buildCatalogContextValue(makeCustomCatalog());
|
|
26
|
-
|
|
27
|
-
expect(value).toContain("- copilotkit://custom-catalog");
|
|
28
|
-
expect(value).toContain(" - FlightCard:");
|
|
29
|
-
expect(value).toContain('"airline"');
|
|
30
|
-
expect(value).toContain('"innerRadius"');
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it("includes schemas when includeSchema is true", () => {
|
|
34
|
-
const catalog = makeCustomCatalog();
|
|
35
|
-
|
|
36
|
-
expect(buildCatalogContextValue(catalog, { includeSchema: true })).toBe(
|
|
37
|
-
buildCatalogContextValue(catalog),
|
|
38
|
-
);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it("lists custom components by name only when includeSchema is false", () => {
|
|
42
|
-
const value = buildCatalogContextValue(makeCustomCatalog(), {
|
|
43
|
-
includeSchema: false,
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
expect(value).toBe(
|
|
47
|
-
[
|
|
48
|
-
"Available A2UI catalog:",
|
|
49
|
-
"- copilotkit://custom-catalog",
|
|
50
|
-
" Custom catalog (does NOT include all basic components).",
|
|
51
|
-
" Custom components:",
|
|
52
|
-
" - FlightCard",
|
|
53
|
-
" - PieChart",
|
|
54
|
-
].join("\n"),
|
|
55
|
-
);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it("describes the basic catalog the same way regardless of includeSchema", () => {
|
|
59
|
-
expect(
|
|
60
|
-
buildCatalogContextValue(vueBasicCatalog, { includeSchema: false }),
|
|
61
|
-
).toBe(buildCatalogContextValue(vueBasicCatalog));
|
|
62
|
-
});
|
|
63
|
-
});
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, afterEach } from "vitest";
|
|
2
|
-
import { h, nextTick } from "vue";
|
|
3
|
-
import type { Component } from "vue";
|
|
4
|
-
import { render as renderVue } from "@testing-library/vue";
|
|
5
|
-
import {
|
|
6
|
-
A2UIBuildingState,
|
|
7
|
-
A2UIRetryingState,
|
|
8
|
-
A2UIRecoveryFailure,
|
|
9
|
-
resolveDebugExposure,
|
|
10
|
-
} from "../A2UIRecoveryStates";
|
|
11
|
-
|
|
12
|
-
// Ported from React's A2UIRecoveryStates tests; renders each Vue component
|
|
13
|
-
// with the same props the React tests pass.
|
|
14
|
-
const render = (component: Component, props: Record<string, unknown>) =>
|
|
15
|
-
renderVue({ render: () => h(component, props) });
|
|
16
|
-
|
|
17
|
-
afterEach(() => {
|
|
18
|
-
vi.useRealTimers();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
describe("A2UI lifecycle states (OSS-162)", () => {
|
|
22
|
-
describe("building", () => {
|
|
23
|
-
it("shows the 'Building interface' skeleton", () => {
|
|
24
|
-
const { container } = render(A2UIBuildingState, {
|
|
25
|
-
content: { status: "building" },
|
|
26
|
-
});
|
|
27
|
-
expect(container.textContent).toContain("Building interface");
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it("shows a live token count when progressTokens is present", () => {
|
|
31
|
-
const { container } = render(A2UIBuildingState, {
|
|
32
|
-
content: { status: "building", progressTokens: 97 },
|
|
33
|
-
});
|
|
34
|
-
expect(container.textContent).toContain("Building interface");
|
|
35
|
-
expect(container.textContent).toContain("97 tokens");
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it("omits the token count when progressTokens is absent or zero", () => {
|
|
39
|
-
const { container } = render(A2UIBuildingState, {
|
|
40
|
-
content: { status: "building", progressTokens: 0 },
|
|
41
|
-
});
|
|
42
|
-
expect(container.textContent).not.toContain("tokens");
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
describe("retrying (threshold-gated label)", () => {
|
|
47
|
-
it("stays the generic building skeleton before the delay on a fast first retry", () => {
|
|
48
|
-
vi.useFakeTimers();
|
|
49
|
-
const { container } = render(A2UIRetryingState, {
|
|
50
|
-
content: { status: "retrying", attempt: 1, maxAttempts: 3 },
|
|
51
|
-
showAfterMs: 2000,
|
|
52
|
-
showAfterAttempts: 2,
|
|
53
|
-
debugExposure: "collapsed",
|
|
54
|
-
});
|
|
55
|
-
expect(container.textContent).toContain("Building interface");
|
|
56
|
-
expect(container.textContent).not.toContain("Retrying");
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it("reveals 'Retrying generation… (N/M attempts)' once the delay elapses", async () => {
|
|
60
|
-
vi.useFakeTimers();
|
|
61
|
-
const { container } = render(A2UIRetryingState, {
|
|
62
|
-
content: { status: "retrying", attempt: 1, maxAttempts: 3 },
|
|
63
|
-
showAfterMs: 2000,
|
|
64
|
-
showAfterAttempts: 2,
|
|
65
|
-
debugExposure: "collapsed",
|
|
66
|
-
});
|
|
67
|
-
vi.advanceTimersByTime(2100);
|
|
68
|
-
await nextTick();
|
|
69
|
-
expect(container.textContent).toContain("Retrying generation");
|
|
70
|
-
expect(container.textContent).toContain("(1/3 attempts)");
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it("reveals the retry label immediately once attempts cross the threshold", () => {
|
|
74
|
-
vi.useFakeTimers();
|
|
75
|
-
const { container } = render(A2UIRetryingState, {
|
|
76
|
-
content: { status: "retrying", attempt: 2, maxAttempts: 3 },
|
|
77
|
-
showAfterMs: 999999,
|
|
78
|
-
showAfterAttempts: 2,
|
|
79
|
-
debugExposure: "collapsed",
|
|
80
|
-
});
|
|
81
|
-
expect(container.textContent).toContain("Retrying generation");
|
|
82
|
-
expect(container.textContent).toContain("(2/3 attempts)");
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it("shows validation-issue detail once revealed, unless debugExposure is 'hidden'", () => {
|
|
86
|
-
const shown = render(A2UIRetryingState, {
|
|
87
|
-
content: {
|
|
88
|
-
status: "retrying",
|
|
89
|
-
attempt: 2,
|
|
90
|
-
maxAttempts: 3,
|
|
91
|
-
errors: [{ code: "missing_required_prop" }],
|
|
92
|
-
},
|
|
93
|
-
showAfterMs: 0,
|
|
94
|
-
showAfterAttempts: 1,
|
|
95
|
-
debugExposure: "collapsed",
|
|
96
|
-
});
|
|
97
|
-
expect(shown.container.querySelector("details")).not.toBeNull();
|
|
98
|
-
expect(shown.container.textContent).toContain("missing_required_prop");
|
|
99
|
-
|
|
100
|
-
const hidden = render(A2UIRetryingState, {
|
|
101
|
-
content: {
|
|
102
|
-
status: "retrying",
|
|
103
|
-
attempt: 2,
|
|
104
|
-
maxAttempts: 3,
|
|
105
|
-
errors: [{ code: "missing_required_prop" }],
|
|
106
|
-
},
|
|
107
|
-
showAfterMs: 0,
|
|
108
|
-
showAfterAttempts: 1,
|
|
109
|
-
debugExposure: "hidden",
|
|
110
|
-
});
|
|
111
|
-
expect(hidden.container.querySelector("details")).toBeNull();
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
describe("failed (replaces the skeleton in place)", () => {
|
|
116
|
-
it("renders a clean message with expandable developer detail (collapsed default)", () => {
|
|
117
|
-
const { container } = render(A2UIRecoveryFailure, {
|
|
118
|
-
content: {
|
|
119
|
-
status: "failed",
|
|
120
|
-
error: "Failed to generate valid A2UI after 3 attempt(s)",
|
|
121
|
-
attempts: [
|
|
122
|
-
{
|
|
123
|
-
attempt: 1,
|
|
124
|
-
ok: false,
|
|
125
|
-
errors: [{ code: "missing_required_prop" }],
|
|
126
|
-
},
|
|
127
|
-
],
|
|
128
|
-
},
|
|
129
|
-
debugExposure: "collapsed",
|
|
130
|
-
});
|
|
131
|
-
expect(container.textContent).toContain("Couldn't generate");
|
|
132
|
-
const details = container.querySelector("details");
|
|
133
|
-
expect(details).not.toBeNull();
|
|
134
|
-
expect(details!.hasAttribute("open")).toBe(false);
|
|
135
|
-
expect(container.textContent).toContain("missing_required_prop");
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
it("hides developer detail entirely when debugExposure is 'hidden'", () => {
|
|
139
|
-
const { container } = render(A2UIRecoveryFailure, {
|
|
140
|
-
content: {
|
|
141
|
-
status: "failed",
|
|
142
|
-
error: "boom",
|
|
143
|
-
attempts: [{ attempt: 1, ok: false }],
|
|
144
|
-
},
|
|
145
|
-
debugExposure: "hidden",
|
|
146
|
-
});
|
|
147
|
-
expect(container.textContent).toContain("Couldn't generate");
|
|
148
|
-
expect(container.querySelector("details")).toBeNull();
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
it("opens the developer detail when debugExposure is 'verbose'", () => {
|
|
152
|
-
const { container } = render(A2UIRecoveryFailure, {
|
|
153
|
-
content: { status: "failed", error: "boom", attempts: [] },
|
|
154
|
-
debugExposure: "verbose",
|
|
155
|
-
});
|
|
156
|
-
const details = container.querySelector("details");
|
|
157
|
-
expect(details).not.toBeNull();
|
|
158
|
-
expect(details!.hasAttribute("open")).toBe(true);
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
describe("resolveDebugExposure precedence", () => {
|
|
163
|
-
it("server-stamped content.debugExposure wins over the client option", () => {
|
|
164
|
-
expect(resolveDebugExposure({ debugExposure: "hidden" }, "verbose")).toBe(
|
|
165
|
-
"hidden",
|
|
166
|
-
);
|
|
167
|
-
});
|
|
168
|
-
it("falls back to the client option when content has none", () => {
|
|
169
|
-
expect(resolveDebugExposure({}, "verbose")).toBe("verbose");
|
|
170
|
-
});
|
|
171
|
-
it("falls back to the resolved default when neither is set", () => {
|
|
172
|
-
expect(resolveDebugExposure(undefined, "collapsed")).toBe("collapsed");
|
|
173
|
-
});
|
|
174
|
-
});
|
|
175
|
-
});
|