@copilotkitnext/web-inspector 1.51.4-next.7 → 1.51.4-next.8
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 +6 -0
- package/dist/index.js +594 -189
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +594 -189
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +388 -139
- package/dist/index.umd.js.map +1 -1
- package/package.json +4 -5
- package/src/__tests__/web-inspector.spec.ts +25 -9
- package/src/components.d.ts +6 -10
- package/src/index.ts +958 -373
- package/src/lib/context-helpers.ts +60 -19
- package/src/lib/persistence.ts +16 -11
- package/src/lib/types.ts +4 -4
- package/tsup.config.ts +7 -7
- package/.turbo/turbo-build$colon$css.log +0 -7
- package/.turbo/turbo-build.log +0 -36
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@copilotkitnext/web-inspector",
|
|
3
|
-
"version": "1.51.4-next.
|
|
3
|
+
"version": "1.51.4-next.8",
|
|
4
4
|
"description": "Lit-based web component for the CopilotKit web inspector",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"lit": "^3.2.0",
|
|
22
22
|
"lucide": "^0.525.0",
|
|
23
23
|
"marked": "^12.0.2",
|
|
24
|
-
"@copilotkitnext/core": "1.51.4-next.
|
|
24
|
+
"@copilotkitnext/core": "1.51.4-next.8"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@tailwindcss/cli": "^4.1.11",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"tsup": "^8.5.0",
|
|
33
33
|
"typescript": "5.8.2",
|
|
34
34
|
"vitest": "^3.0.5",
|
|
35
|
-
"@copilotkitnext/eslint-config": "1.51.4-next.
|
|
36
|
-
"@copilotkitnext/typescript-config": "1.51.4-next.
|
|
35
|
+
"@copilotkitnext/eslint-config": "1.51.4-next.8",
|
|
36
|
+
"@copilotkitnext/typescript-config": "1.51.4-next.8"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
39
|
"node": ">=18"
|
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
"dev:css": "npx @tailwindcss/cli -i ./src/styles/tailwind.css -o ./src/styles/generated.css --watch --minify",
|
|
47
47
|
"lint": "eslint .",
|
|
48
48
|
"check-types": "pnpm run build:css && tsc --noEmit",
|
|
49
|
-
"clean": "rm -rf dist src/styles/generated.css",
|
|
50
49
|
"test": "pnpm run build:css && vitest run"
|
|
51
50
|
}
|
|
52
51
|
}
|
|
@@ -7,7 +7,9 @@ import {
|
|
|
7
7
|
import type { AbstractAgent, AgentSubscriber } from "@ag-ui/client";
|
|
8
8
|
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
9
9
|
|
|
10
|
-
type MockAgentController = {
|
|
10
|
+
type MockAgentController = {
|
|
11
|
+
emit: (key: keyof AgentSubscriber, payload: unknown) => void;
|
|
12
|
+
};
|
|
11
13
|
|
|
12
14
|
type InspectorInternals = {
|
|
13
15
|
flattenedEvents: Array<{ type: string }>;
|
|
@@ -63,7 +65,9 @@ type MockCore = {
|
|
|
63
65
|
context: Record<string, unknown>;
|
|
64
66
|
properties: Record<string, unknown>;
|
|
65
67
|
runtimeConnectionStatus: CopilotKitCoreRuntimeConnectionStatus;
|
|
66
|
-
subscribe: (subscriber: CopilotKitCoreSubscriber) => {
|
|
68
|
+
subscribe: (subscriber: CopilotKitCoreSubscriber) => {
|
|
69
|
+
unsubscribe: () => void;
|
|
70
|
+
};
|
|
67
71
|
};
|
|
68
72
|
|
|
69
73
|
function createMockCore(initialAgents: Record<string, AbstractAgent> = {}) {
|
|
@@ -95,7 +99,9 @@ function createMockCore(initialAgents: Record<string, AbstractAgent> = {}) {
|
|
|
95
99
|
subscribers.forEach((subscriber) =>
|
|
96
100
|
subscriber.onContextChanged?.({
|
|
97
101
|
copilotkit: core as unknown as CopilotKitCore,
|
|
98
|
-
context: core.context as unknown as Readonly<
|
|
102
|
+
context: core.context as unknown as Readonly<
|
|
103
|
+
Record<string, { value: string; description: string }>
|
|
104
|
+
>,
|
|
99
105
|
}),
|
|
100
106
|
);
|
|
101
107
|
},
|
|
@@ -107,7 +113,8 @@ describe("WebInspectorElement", () => {
|
|
|
107
113
|
document.body.innerHTML = "";
|
|
108
114
|
localStorage.clear();
|
|
109
115
|
const mockClipboard = { writeText: vi.fn().mockResolvedValue(undefined) };
|
|
110
|
-
(navigator as unknown as { clipboard: typeof mockClipboard }).clipboard =
|
|
116
|
+
(navigator as unknown as { clipboard: typeof mockClipboard }).clipboard =
|
|
117
|
+
mockClipboard;
|
|
111
118
|
});
|
|
112
119
|
|
|
113
120
|
it("records agent events and syncs state/messages/tools", async () => {
|
|
@@ -135,10 +142,16 @@ describe("WebInspectorElement", () => {
|
|
|
135
142
|
|
|
136
143
|
const flattened = inspectorHandle.flattenedEvents;
|
|
137
144
|
expect(flattened.some((evt) => evt.type === "RUN_STARTED")).toBe(true);
|
|
138
|
-
expect(flattened.some((evt) => evt.type === "MESSAGES_SNAPSHOT")).toBe(
|
|
139
|
-
|
|
145
|
+
expect(flattened.some((evt) => evt.type === "MESSAGES_SNAPSHOT")).toBe(
|
|
146
|
+
true,
|
|
147
|
+
);
|
|
148
|
+
expect(
|
|
149
|
+
inspectorHandle.agentMessages.get("alpha")?.[0]?.contentText,
|
|
150
|
+
).toContain("hi there");
|
|
140
151
|
expect(inspectorHandle.agentStates.get("alpha")).toBeDefined();
|
|
141
|
-
expect(
|
|
152
|
+
expect(
|
|
153
|
+
inspectorHandle.cachedTools.some((tool) => tool.name === "greet"),
|
|
154
|
+
).toBe(true);
|
|
142
155
|
});
|
|
143
156
|
|
|
144
157
|
it("normalizes context, persists state, and copies context values", async () => {
|
|
@@ -161,8 +174,11 @@ describe("WebInspectorElement", () => {
|
|
|
161
174
|
expect(ctxB.description).toBe("Described");
|
|
162
175
|
|
|
163
176
|
await inspectorHandle.copyContextValue({ nested: true }, "ctxA");
|
|
164
|
-
const clipboard = (
|
|
165
|
-
|
|
177
|
+
const clipboard = (
|
|
178
|
+
navigator as unknown as {
|
|
179
|
+
clipboard: { writeText: ReturnType<typeof vi.fn> };
|
|
180
|
+
}
|
|
181
|
+
).clipboard.writeText as ReturnType<typeof vi.fn>;
|
|
166
182
|
expect(clipboard).toHaveBeenCalledTimes(1);
|
|
167
183
|
|
|
168
184
|
inspectorHandle.persistState();
|
package/src/components.d.ts
CHANGED
|
@@ -5,20 +5,16 @@
|
|
|
5
5
|
* It contains typing information for all components that exist in this project.
|
|
6
6
|
*/
|
|
7
7
|
import { HTMLStencilElement, JSXBase } from "@stencil/core/internal";
|
|
8
|
-
export namespace Components {
|
|
9
|
-
}
|
|
8
|
+
export namespace Components {}
|
|
10
9
|
declare global {
|
|
11
|
-
|
|
12
|
-
}
|
|
10
|
+
interface HTMLElementTagNameMap {}
|
|
13
11
|
}
|
|
14
12
|
declare namespace LocalJSX {
|
|
15
|
-
|
|
16
|
-
}
|
|
13
|
+
interface IntrinsicElements {}
|
|
17
14
|
}
|
|
18
15
|
export { LocalJSX as JSX };
|
|
19
16
|
declare module "@stencil/core" {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
17
|
+
export namespace JSX {
|
|
18
|
+
interface IntrinsicElements {}
|
|
19
|
+
}
|
|
24
20
|
}
|