@copilotkit/web-inspector 1.61.0 → 1.61.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/dist/index.cjs +23 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +5 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +23 -5
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +26 -7
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/web-inspector.spec.ts +184 -0
- package/src/index.ts +38 -6
package/dist/index.cjs
CHANGED
|
@@ -405,6 +405,7 @@ var ɵCpkThreadDetails = class ɵCpkThreadDetails extends lit.LitElement {
|
|
|
405
405
|
this.thread = null;
|
|
406
406
|
this.runtimeUrl = "";
|
|
407
407
|
this.headers = {};
|
|
408
|
+
this.threadInspectionAvailable = false;
|
|
408
409
|
this.agentStateInput = null;
|
|
409
410
|
this.agentEventsInput = [];
|
|
410
411
|
this.liveMessageVersion = 0;
|
|
@@ -464,6 +465,7 @@ var ɵCpkThreadDetails = class ɵCpkThreadDetails extends lit.LitElement {
|
|
|
464
465
|
thread: { attribute: false },
|
|
465
466
|
runtimeUrl: { attribute: false },
|
|
466
467
|
headers: { attribute: false },
|
|
468
|
+
threadInspectionAvailable: { attribute: false },
|
|
467
469
|
agentStateInput: { attribute: false },
|
|
468
470
|
agentEventsInput: { attribute: false },
|
|
469
471
|
liveMessageVersion: { attribute: false },
|
|
@@ -1128,7 +1130,7 @@ var ɵCpkThreadDetails = class ɵCpkThreadDetails extends lit.LitElement {
|
|
|
1128
1130
|
* so users see an explicit loading indicator on first load.
|
|
1129
1131
|
*/
|
|
1130
1132
|
async fetchMessages(threadId, silent = false) {
|
|
1131
|
-
if (!this.runtimeUrl) {
|
|
1133
|
+
if (!this.runtimeUrl || !this.threadInspectionAvailable) {
|
|
1132
1134
|
if (!silent) this._conversation = [];
|
|
1133
1135
|
return;
|
|
1134
1136
|
}
|
|
@@ -1160,7 +1162,7 @@ var ɵCpkThreadDetails = class ɵCpkThreadDetails extends lit.LitElement {
|
|
|
1160
1162
|
}
|
|
1161
1163
|
async fetchEvents(threadId) {
|
|
1162
1164
|
this._eventsNotAvailable = false;
|
|
1163
|
-
if (!this.runtimeUrl) {
|
|
1165
|
+
if (!this.runtimeUrl || !this.threadInspectionAvailable) {
|
|
1164
1166
|
this._fetchedEvents = null;
|
|
1165
1167
|
return;
|
|
1166
1168
|
}
|
|
@@ -1194,7 +1196,7 @@ var ɵCpkThreadDetails = class ɵCpkThreadDetails extends lit.LitElement {
|
|
|
1194
1196
|
}
|
|
1195
1197
|
async fetchState(threadId) {
|
|
1196
1198
|
this._stateNotAvailable = false;
|
|
1197
|
-
if (!this.runtimeUrl) {
|
|
1199
|
+
if (!this.runtimeUrl || !this.threadInspectionAvailable) {
|
|
1198
1200
|
this._fetchedState = null;
|
|
1199
1201
|
return;
|
|
1200
1202
|
}
|
|
@@ -2253,11 +2255,13 @@ var WebInspectorElement = class extends lit.LitElement {
|
|
|
2253
2255
|
if (this.core?.getThreadStore(agentId)) return;
|
|
2254
2256
|
const core = this.core;
|
|
2255
2257
|
if (!core?.runtimeUrl) return;
|
|
2258
|
+
if (core.threadEndpoints?.list === false) return;
|
|
2256
2259
|
const store = (0, _copilotkit_core.ɵcreateThreadStore)({ fetch: globalThis.fetch });
|
|
2257
2260
|
store.start();
|
|
2258
2261
|
store.setContext({
|
|
2259
2262
|
runtimeUrl: core.runtimeUrl,
|
|
2260
|
-
headers: {},
|
|
2263
|
+
headers: { ...core.headers },
|
|
2264
|
+
wsUrl: core.intelligence?.wsUrl,
|
|
2261
2265
|
agentId
|
|
2262
2266
|
});
|
|
2263
2267
|
this._ownedThreadStores.set(agentId, store);
|
|
@@ -2269,6 +2273,15 @@ var WebInspectorElement = class extends lit.LitElement {
|
|
|
2269
2273
|
if (!store) return;
|
|
2270
2274
|
store.refresh();
|
|
2271
2275
|
}
|
|
2276
|
+
updateOwnedThreadStoreHeaders(headers) {
|
|
2277
|
+
const core = this.core;
|
|
2278
|
+
if (!core?.runtimeUrl) return;
|
|
2279
|
+
for (const [agentId, store] of this._ownedThreadStores) store.setContext({
|
|
2280
|
+
runtimeUrl: core.runtimeUrl,
|
|
2281
|
+
headers: { ...headers },
|
|
2282
|
+
agentId
|
|
2283
|
+
});
|
|
2284
|
+
}
|
|
2272
2285
|
removeOwnedThreadStore(agentId) {
|
|
2273
2286
|
const store = this._ownedThreadStores.get(agentId);
|
|
2274
2287
|
if (!store) return;
|
|
@@ -2296,7 +2309,8 @@ var WebInspectorElement = class extends lit.LitElement {
|
|
|
2296
2309
|
require_telemetry.maybeShowDisclosure();
|
|
2297
2310
|
}
|
|
2298
2311
|
this.flushPendingBannerViewed();
|
|
2299
|
-
for (const agentId of this._ownedThreadStores.keys()) this.refreshOwnedThreadStore(agentId);
|
|
2312
|
+
if (core.threadEndpoints?.list !== false) for (const agentId of this._ownedThreadStores.keys()) this.refreshOwnedThreadStore(agentId);
|
|
2313
|
+
else this.teardownOwnedThreadStores();
|
|
2300
2314
|
} else {
|
|
2301
2315
|
this._threadsByAgent.clear();
|
|
2302
2316
|
this._threads = [];
|
|
@@ -2307,6 +2321,9 @@ var WebInspectorElement = class extends lit.LitElement {
|
|
|
2307
2321
|
this.coreProperties = properties;
|
|
2308
2322
|
this.requestUpdate();
|
|
2309
2323
|
},
|
|
2324
|
+
onHeadersChanged: ({ headers }) => {
|
|
2325
|
+
this.updateOwnedThreadStoreHeaders(headers);
|
|
2326
|
+
},
|
|
2310
2327
|
onError: ({ code, error }) => {
|
|
2311
2328
|
this.lastCoreError = {
|
|
2312
2329
|
code,
|
|
@@ -4352,6 +4369,7 @@ ${argsString}</pre
|
|
|
4352
4369
|
.thread=${selectedThread}
|
|
4353
4370
|
.runtimeUrl=${this._core?.runtimeUrl ?? ""}
|
|
4354
4371
|
.headers=${this._core?.headers ?? {}}
|
|
4372
|
+
.threadInspectionAvailable=${this._core?.threadEndpoints?.inspect !== false}
|
|
4355
4373
|
.liveMessageVersion=${this.selectedThreadId ? this.liveMessageVersion.get(this.selectedThreadId) ?? 0 : 0}
|
|
4356
4374
|
.agentStateInput=${selectedThread ? this.getLatestStateForAgent(selectedThread.agentId) : null}
|
|
4357
4375
|
.agentEventsInput=${selectedThread ? this.agentEvents.get(selectedThread.agentId) ?? [] : []}
|