@copilotkit/web-inspector 1.66.4 → 1.67.1
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/README.md +92 -13
- package/dist/index.cjs +1436 -429
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +118 -8
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +118 -8
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1438 -431
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +1721 -533
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/inspector-metadata.cjs +60 -0
- package/dist/lib/inspector-metadata.cjs.map +1 -0
- package/dist/lib/inspector-metadata.mjs +60 -0
- package/dist/lib/inspector-metadata.mjs.map +1 -0
- package/dist/lib/telemetry.cjs +117 -32
- package/dist/lib/telemetry.cjs.map +1 -1
- package/dist/lib/telemetry.mjs +116 -33
- package/dist/lib/telemetry.mjs.map +1 -1
- package/dist/lib/thread-selection.cjs +36 -0
- package/dist/lib/thread-selection.cjs.map +1 -0
- package/dist/lib/thread-selection.mjs +35 -0
- package/dist/lib/thread-selection.mjs.map +1 -0
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/styles/generated.cjs +1 -1
- package/dist/styles/generated.cjs.map +1 -1
- package/dist/styles/generated.mjs +1 -1
- package/dist/styles/generated.mjs.map +1 -1
- package/package.json +9 -4
- package/CHANGELOG.md +0 -505
- package/dev/css-raw-import.spec.ts +0 -31
- package/dev/index.html +0 -115
- package/dev/main.ts +0 -165
- package/dev/vite.config.ts +0 -30
- package/src/__tests__/memory-recall.spec.ts +0 -76
- package/src/__tests__/telemetry-egress-guard.spec.ts +0 -41
- package/src/__tests__/web-inspector.spec.ts +0 -3935
- package/src/assets/inspector-logo-icon.svg +0 -8
- package/src/assets/inspector-logo.svg +0 -40
- package/src/components.d.ts +0 -20
- package/src/index.ts +0 -11849
- package/src/lib/__tests__/telemetry.test.ts +0 -557
- package/src/lib/context-helpers.ts +0 -166
- package/src/lib/persistence.ts +0 -206
- package/src/lib/telemetry.ts +0 -474
- package/src/lib/testing/telemetry-egress-guard.ts +0 -33
- package/src/lib/types.ts +0 -19
- package/src/styles/generated.css +0 -2
- package/src/styles/tailwind.css +0 -23
- package/src/types/css.d.ts +0 -4
- package/src/types/svg.d.ts +0 -4
- package/tsconfig.json +0 -14
- package/tsdown.config.ts +0 -45
- package/vitest.config.ts +0 -66
- package/vitest.setup.ts +0 -84
package/tsdown.config.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "tsdown";
|
|
2
|
-
|
|
3
|
-
export default defineConfig([
|
|
4
|
-
{
|
|
5
|
-
entry: ["src/index.ts"],
|
|
6
|
-
format: ["esm", "cjs"],
|
|
7
|
-
dts: true,
|
|
8
|
-
sourcemap: true,
|
|
9
|
-
target: "es2022",
|
|
10
|
-
outDir: "dist",
|
|
11
|
-
unbundle: true,
|
|
12
|
-
loader: {
|
|
13
|
-
".css": "text",
|
|
14
|
-
".svg": "dataurl",
|
|
15
|
-
},
|
|
16
|
-
exports: true,
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
entry: ["src/index.ts"],
|
|
20
|
-
format: ["umd"],
|
|
21
|
-
globalName: "CopilotKitWebInspector",
|
|
22
|
-
sourcemap: true,
|
|
23
|
-
target: "es2018",
|
|
24
|
-
outDir: "dist",
|
|
25
|
-
external: ["lit", "lit/decorators.js"],
|
|
26
|
-
loader: {
|
|
27
|
-
".css": "text",
|
|
28
|
-
".svg": "dataurl",
|
|
29
|
-
},
|
|
30
|
-
codeSplitting: false,
|
|
31
|
-
outputOptions(options) {
|
|
32
|
-
options.entryFileNames = "[name].umd.js";
|
|
33
|
-
options.globals = {
|
|
34
|
-
lit: "Lit",
|
|
35
|
-
"lit/decorators.js": "LitDecorators",
|
|
36
|
-
"lit/directives/style-map.js": "LitDirectivesStyleMap",
|
|
37
|
-
"lit/directives/unsafe-html.js": "LitDirectivesUnsafeHtml",
|
|
38
|
-
marked: "marked",
|
|
39
|
-
lucide: "lucide",
|
|
40
|
-
"@copilotkit/core": "CopilotKitCore",
|
|
41
|
-
};
|
|
42
|
-
return options;
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
]);
|
package/vitest.config.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "vitest/config";
|
|
2
|
-
|
|
3
|
-
// Node 25.0 unflagged the experimental Web Storage API (nodejs/node#57658),
|
|
4
|
-
// so on Node 25+ a stub `window.localStorage` is installed BEFORE vitest's
|
|
5
|
-
// jsdom environment runs. vitest's jsdom env does NOT replace it, so the
|
|
6
|
-
// stub stays in place — and it has no `.clear()` / `.getItem()` /
|
|
7
|
-
// `.setItem()` methods. Any test that touches localStorage crashes with
|
|
8
|
-
// `TypeError: window.localStorage.clear is not a function`.
|
|
9
|
-
//
|
|
10
|
-
// This is NOT fixed by upgrading vitest or jsdom:
|
|
11
|
-
// - vitest 4.x + jsdom 29 still leave Node's stub in place — confirmed
|
|
12
|
-
// in vitest-dev/vitest#8757 (closed as "non-LTS, won't fix").
|
|
13
|
-
// - Node 25.2.0 tried throwing on access; 25.2.1 reverted it as too
|
|
14
|
-
// breaking. The real Node-side fix is targeted for Node 26.0
|
|
15
|
-
// (semver-major), no backport — see nodejs/node#60303.
|
|
16
|
-
//
|
|
17
|
-
// On Node 22.4–24.x, the API exists but stays behind
|
|
18
|
-
// `--experimental-webstorage`, so nothing gets installed and tests pass
|
|
19
|
-
// without any workaround. The bug ONLY bites on Node 25+.
|
|
20
|
-
//
|
|
21
|
-
// Workaround: pass `--no-experimental-webstorage` to the vitest worker so
|
|
22
|
-
// Node doesn't install the stub and jsdom owns the localStorage globals
|
|
23
|
-
// cleanly. This is the canonical community workaround (also used by
|
|
24
|
-
// happy-dom#1950, ArkType, and the vitest#8757 thread).
|
|
25
|
-
//
|
|
26
|
-
// Version gate:
|
|
27
|
-
// - Lower bound (Node 22.4+): the flag only exists from Node 22.4
|
|
28
|
-
// onward. Passing it to older Node (e.g. CI's Node 20) makes Node
|
|
29
|
-
// refuse to start with "not allowed in NODE_OPTIONS". On Node
|
|
30
|
-
// 22.4–24.x the flag is a harmless no-op since webstorage is still
|
|
31
|
-
// gated by --experimental-webstorage, but we keep the lower bound
|
|
32
|
-
// strict so we don't silently fail closed on Node 20.
|
|
33
|
-
// - Upper bound (Node < 26): Node 26 is expected to land the upstream
|
|
34
|
-
// fix and may remove / rename this flag as part of the unflagging
|
|
35
|
-
// cleanup. We gate the upper bound so this config doesn't blow up
|
|
36
|
-
// on Node 26+ in the future. Node 26 isn't out as of this commit,
|
|
37
|
-
// so the upper bound is purely defensive.
|
|
38
|
-
//
|
|
39
|
-
// When the minimum supported Node version is >=26 (which will be a long
|
|
40
|
-
// time — Node 26 will likely arrive in late 2026 and need to age into
|
|
41
|
-
// LTS), this whole block can be removed outright.
|
|
42
|
-
const [nodeMajor, nodeMinor] = process.versions.node.split(".").map(Number);
|
|
43
|
-
const needsNoExperimentalWebstorage =
|
|
44
|
-
// lower bound: flag exists (Node 22.4+)
|
|
45
|
-
(nodeMajor! > 22 || (nodeMajor === 22 && nodeMinor! >= 4)) &&
|
|
46
|
-
// upper bound: Node hasn't fixed the underlying bug yet (< 26)
|
|
47
|
-
nodeMajor! < 26;
|
|
48
|
-
|
|
49
|
-
const workerExecArgv = needsNoExperimentalWebstorage
|
|
50
|
-
? ["--no-experimental-webstorage"]
|
|
51
|
-
: [];
|
|
52
|
-
|
|
53
|
-
export default defineConfig({
|
|
54
|
-
test: {
|
|
55
|
-
environment: "jsdom",
|
|
56
|
-
globals: true,
|
|
57
|
-
clearMocks: true,
|
|
58
|
-
setupFiles: ["./vitest.setup.ts"],
|
|
59
|
-
reporters: [["default", { summary: false }]],
|
|
60
|
-
silent: true,
|
|
61
|
-
poolOptions: {
|
|
62
|
-
forks: { execArgv: workerExecArgv },
|
|
63
|
-
threads: { execArgv: workerExecArgv },
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
});
|
package/vitest.setup.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
// Node 25 ships an experimental built-in `localStorage` global (gated on the
|
|
2
|
-
// `--localstorage-file` flag, but the accessor exists unconditionally). When
|
|
3
|
-
// vitest boots the jsdom environment, jsdom defines its own `localStorage` on
|
|
4
|
-
// the synthetic `window`, but Node's global accessor still wins on
|
|
5
|
-
// `globalThis.localStorage` AND — because vitest's jsdom integration aliases
|
|
6
|
-
// `window` to `globalThis` — also on `window.localStorage`. The result is that
|
|
7
|
-
// `window.localStorage` resolves to Node's stub object which has no `clear`,
|
|
8
|
-
// `setItem`, `removeItem`, etc., breaking every test that touches localStorage.
|
|
9
|
-
//
|
|
10
|
-
// This setup file installs a proper in-memory Storage implementation on both
|
|
11
|
-
// `globalThis` and `window` BEFORE any test code runs. The shim is a plain
|
|
12
|
-
// object (not a class) so `vi.spyOn(window.localStorage, "getItem")` works —
|
|
13
|
-
// vitest needs the methods to be own properties on the spied target.
|
|
14
|
-
//
|
|
15
|
-
// We re-install the shim in `beforeEach` so a test that did
|
|
16
|
-
// `vi.restoreAllMocks()` (which restores spied methods) still sees the shim's
|
|
17
|
-
// methods, and so each test starts with a fresh empty store.
|
|
18
|
-
|
|
19
|
-
import { beforeEach } from "vitest";
|
|
20
|
-
|
|
21
|
-
import { createTelemetryEgressGuard } from "./src/lib/testing/telemetry-egress-guard.js";
|
|
22
|
-
|
|
23
|
-
// No test may POST a real `oss.inspector.*` event to the live telemetry sink —
|
|
24
|
-
// see the helper for why no environment variable can cover this.
|
|
25
|
-
if (typeof globalThis.fetch === "function") {
|
|
26
|
-
globalThis.fetch = createTelemetryEgressGuard(globalThis.fetch);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function createStorageShim(): Storage {
|
|
30
|
-
const store = new Map<string, string>();
|
|
31
|
-
const shim = {
|
|
32
|
-
get length() {
|
|
33
|
-
return store.size;
|
|
34
|
-
},
|
|
35
|
-
key(index: number): string | null {
|
|
36
|
-
return Array.from(store.keys())[index] ?? null;
|
|
37
|
-
},
|
|
38
|
-
getItem(key: string): string | null {
|
|
39
|
-
return store.has(key) ? store.get(key)! : null;
|
|
40
|
-
},
|
|
41
|
-
setItem(key: string, value: string): void {
|
|
42
|
-
store.set(String(key), String(value));
|
|
43
|
-
},
|
|
44
|
-
removeItem(key: string): void {
|
|
45
|
-
store.delete(key);
|
|
46
|
-
},
|
|
47
|
-
clear(): void {
|
|
48
|
-
store.clear();
|
|
49
|
-
},
|
|
50
|
-
} as Storage;
|
|
51
|
-
return shim;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function installLocalStorageShim(): void {
|
|
55
|
-
const shim = createStorageShim();
|
|
56
|
-
// Override the Node 25 global accessor (and any jsdom accessor) with a
|
|
57
|
-
// plain data property pointing at our shim. `configurable: true` so a
|
|
58
|
-
// subsequent install can replace it.
|
|
59
|
-
Object.defineProperty(globalThis, "localStorage", {
|
|
60
|
-
value: shim,
|
|
61
|
-
writable: true,
|
|
62
|
-
configurable: true,
|
|
63
|
-
enumerable: true,
|
|
64
|
-
});
|
|
65
|
-
if (typeof window !== "undefined" && window !== (globalThis as unknown)) {
|
|
66
|
-
Object.defineProperty(window, "localStorage", {
|
|
67
|
-
value: shim,
|
|
68
|
-
writable: true,
|
|
69
|
-
configurable: true,
|
|
70
|
-
enumerable: true,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Install once at module load so any top-level code in test files (e.g.
|
|
76
|
-
// imports that read localStorage on init) sees the shim.
|
|
77
|
-
installLocalStorageShim();
|
|
78
|
-
|
|
79
|
-
// Re-install before each test so `vi.restoreAllMocks()` from a prior test
|
|
80
|
-
// can't leave behind spied/replaced methods, and each test starts with an
|
|
81
|
-
// empty store.
|
|
82
|
-
beforeEach(() => {
|
|
83
|
-
installLocalStorageShim();
|
|
84
|
-
});
|