stitchkit 0.99.0 → 0.100.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/CHANGELOG.md +44 -0
- package/dist/agent-runtime/contained-darwin.d.ts +0 -17
- package/dist/agent-runtime/contained-darwin.d.ts.map +1 -1
- package/dist/agent-runtime/contained-write.d.ts.map +1 -1
- package/dist/agent-runtime/invocation-attempt.d.ts +22 -0
- package/dist/agent-runtime/invocation-attempt.d.ts.map +1 -0
- package/dist/agent-runtime/invocation-failure.d.ts +6 -0
- package/dist/agent-runtime/invocation-failure.d.ts.map +1 -0
- package/dist/agent-runtime/invocation-payload.d.ts +18 -0
- package/dist/agent-runtime/invocation-payload.d.ts.map +1 -0
- package/dist/agent-runtime/invocation-read.d.ts +131 -0
- package/dist/agent-runtime/invocation-read.d.ts.map +1 -0
- package/dist/agent-runtime/invocation-schema.d.ts +378 -0
- package/dist/agent-runtime/invocation-schema.d.ts.map +1 -0
- package/dist/agent-runtime/invocations.d.ts +46 -0
- package/dist/agent-runtime/invocations.d.ts.map +1 -0
- package/dist/agent-runtime/run-acquisition.d.ts.map +1 -1
- package/dist/agent-runtime/run-execution-state.d.ts +4 -2
- package/dist/agent-runtime/run-execution-state.d.ts.map +1 -1
- package/dist/agent-runtime/run-execution.d.ts.map +1 -1
- package/dist/agent-runtime/run-failure.d.ts.map +1 -1
- package/dist/agent-runtime/run-model-attempts.d.ts.map +1 -1
- package/dist/agent-runtime/run-operation-lifecycle.d.ts +2 -2
- package/dist/agent-runtime/run-operation-lifecycle.d.ts.map +1 -1
- package/dist/agent-runtime/run-provider-ledger.d.ts +1 -0
- package/dist/agent-runtime/run-provider-ledger.d.ts.map +1 -1
- package/dist/agent-runtime/runtime.d.ts +11 -0
- package/dist/agent-runtime/runtime.d.ts.map +1 -1
- package/dist/agent-runtime/store-create.d.ts.map +1 -1
- package/dist/agent-runtime/store-event-once.d.ts +29 -0
- package/dist/agent-runtime/store-event-once.d.ts.map +1 -0
- package/dist/agent-runtime/store.d.ts +5 -0
- package/dist/agent-runtime/store.d.ts.map +1 -1
- package/dist/application/change-subscription.d.ts +36 -0
- package/dist/application/change-subscription.d.ts.map +1 -0
- package/dist/application/diagnostic-journal-contract.d.ts +3 -6
- package/dist/application/diagnostic-journal-contract.d.ts.map +1 -1
- package/dist/application/notification-delivery.d.ts +32 -0
- package/dist/application/notification-delivery.d.ts.map +1 -0
- package/dist/application/notification-outbox-state.d.ts +37 -0
- package/dist/application/notification-outbox-state.d.ts.map +1 -0
- package/dist/application/notification-outbox.d.ts +7 -1
- package/dist/application/notification-outbox.d.ts.map +1 -1
- package/dist/application/watch-hub-core.d.ts +10 -15
- package/dist/application/watch-hub-core.d.ts.map +1 -1
- package/dist/application/watch-hub.d.ts +10 -2
- package/dist/application/watch-hub.d.ts.map +1 -1
- package/dist/browser/session-credentials.d.ts +20 -0
- package/dist/browser/session-credentials.d.ts.map +1 -0
- package/dist/browser/session.d.ts +31 -0
- package/dist/browser/session.d.ts.map +1 -0
- package/dist/durability/events.d.ts +6 -0
- package/dist/durability/events.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/coding-tools.js +3 -2
- package/dist/entrypoints/agent-runtime/harness.js +5 -3
- package/dist/entrypoints/agent-runtime/sandbox.js +3 -2
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +3 -3
- package/dist/entrypoints/agent-runtime/sqlite/node.js +3 -3
- package/dist/entrypoints/agent-runtime/testing.js +3 -3
- package/dist/entrypoints/agent-runtime.d.ts +3 -0
- package/dist/entrypoints/agent-runtime.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime.js +15 -4
- package/dist/entrypoints/application/diagnostic-journal.js +2 -1
- package/dist/entrypoints/application.d.ts +3 -1
- package/dist/entrypoints/application.d.ts.map +1 -1
- package/dist/entrypoints/application.js +629 -189
- package/dist/entrypoints/files.js +2 -1
- package/dist/entrypoints/index.d.ts +2 -0
- package/dist/entrypoints/index.d.ts.map +1 -1
- package/dist/entrypoints/index.js +172 -0
- package/dist/entrypoints/live.js +68 -13
- package/dist/entrypoints/react.d.ts +1 -1
- package/dist/entrypoints/react.d.ts.map +1 -1
- package/dist/entrypoints/react.js +59 -16
- package/dist/{index-wsm5w4ee.js → index-0b1cnze2.js} +35 -3
- package/dist/{index-gxrt5h6v.js → index-cyktc4bp.js} +3 -0
- package/dist/{index-px2gm2jp.js → index-fhwqwxe0.js} +17 -55
- package/dist/{index-e4hkgm5t.js → index-gw8bmyaj.js} +4 -2
- package/dist/{index-8p52kd5p.js → index-js7gqrb1.js} +96 -14
- package/dist/{index-wt743f7f.js → index-k6gpggb9.js} +2 -1
- package/dist/index-q3pyb9n0.js +22 -0
- package/dist/{index-sp1tzwnb.js → index-s84he4v7.js} +2 -2
- package/dist/{index-jhx828hc.js → index-xwhjjw2x.js} +878 -279
- package/dist/{index-1m2thnq0.js → index-y9qn426m.js} +2 -2
- package/dist/index-zjjyynm3.js +42 -0
- package/dist/internal/coalesced-task.d.ts +15 -0
- package/dist/internal/coalesced-task.d.ts.map +1 -0
- package/dist/internal/darwin-binding.d.ts +19 -0
- package/dist/internal/darwin-binding.d.ts.map +1 -0
- package/dist/internal/exclusive-lock.d.ts +20 -7
- package/dist/internal/exclusive-lock.d.ts.map +1 -1
- package/dist/internal/mutation-queue.d.ts +4 -0
- package/dist/internal/mutation-queue.d.ts.map +1 -0
- package/dist/internal/process-identity.d.ts +1 -1
- package/dist/internal/process-identity.d.ts.map +1 -1
- package/dist/internal/process-instance.d.ts +26 -0
- package/dist/internal/process-instance.d.ts.map +1 -0
- package/dist/live/watch-client-state.d.ts +71 -0
- package/dist/live/watch-client-state.d.ts.map +1 -0
- package/dist/live/watch-client.d.ts +5 -1
- package/dist/live/watch-client.d.ts.map +1 -1
- package/dist/live/watch-contract.d.ts +12 -0
- package/dist/live/watch-contract.d.ts.map +1 -1
- package/dist/react/cache-bridge.d.ts +10 -0
- package/dist/react/cache-bridge.d.ts.map +1 -1
- package/llms/agent-runtime.2.txt +94 -0
- package/llms/agent-runtime.3.txt +24 -0
- package/llms/application.2.txt +68 -2
- package/llms/application.txt +32 -2
- package/llms/files.txt +1 -1
- package/llms/live.txt +7 -0
- package/llms/react.txt +8 -0
- package/llms/server.3.txt +35 -0
- package/llms/stitchkit.2.txt +41 -0
- package/llms/stitchkit.3.txt +22 -0
- package/llms/stitchkit.txt +3 -3
- package/llms/upgrading-0.37.0.txt +176 -0
- package/llms/{upgrading-0.37.0-0.58.0.txt → upgrading-0.44.0-0.60.0.txt} +229 -169
- package/llms/{upgrading-0.59.0-0.71.0.txt → upgrading-0.61.0-0.73.0.txt} +122 -229
- package/llms/{upgrading-0.72.0-0.99.0.txt → upgrading-0.74.0-0.100.0.txt} +67 -122
- package/llms/upgrading.txt +4 -3
- package/llms-full.txt +393 -6
- package/llms.txt +10 -9
- package/native/darwin-arm64.node +0 -0
- package/native/darwin-x64.node +0 -0
- package/package.json +1 -1
- package/dist/agent-runtime/run-mutation-queue.d.ts +0 -21
- package/dist/agent-runtime/run-mutation-queue.d.ts.map +0 -1
|
@@ -5,6 +5,8 @@ export type { BindRealtimeClientOptions, BoundRealtimeClient, RealtimeClientTran
|
|
|
5
5
|
export { bindRealtimeClient } from '../browser/realtime-client.js';
|
|
6
6
|
export { type ResumableAttempt, type ResumableIteratorConfig, resumableIterator, } from '../browser/resumable.js';
|
|
7
7
|
export { createRetainedTopics, type RetainedTopics } from '../browser/retained.js';
|
|
8
|
+
export { createSessionScope, SessionExpiredError, type SessionOperation, type SessionScope, } from '../browser/session.js';
|
|
9
|
+
export { createSessionCredentials, type SessionCredentials, type SessionCredentialsConfig, } from '../browser/session-credentials.js';
|
|
8
10
|
export type { RealtimeClient, RealtimeClientOptions, SocketEventMap, SocketIOClient, SocketIOClientConfig, SocketIOClientPeerLoaders, } from '../browser/socket-io.js';
|
|
9
11
|
export { createRealtimeClient, createSocketIOClient } from '../browser/socket-io.js';
|
|
10
12
|
export { type ParseNDJSONOptions, type ParseSSEOptions, parseNDJSON, parseSSE, } from '../browser/stream.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entrypoints/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,wBAAwB,EACxB,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,QAAQ,EACR,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,mBAAmB,GACzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAC9B,+BAA+B,EAC/B,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EACxB,yBAAyB,EACzB,KAAK,wBAAwB,GAC9B,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,yBAAyB,EACzB,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChF,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,WAAW,EACX,QAAQ,GACT,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,mBAAmB,EACnB,aAAa,GACd,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAKvD,OAAO,EAAE,cAAc,EAAE,KAAK,eAAe,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGzF,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,YAAY,GAClB,MAAM,wBAAwB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entrypoints/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,wBAAwB,EACxB,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,QAAQ,EACR,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,mBAAmB,GACzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAC9B,+BAA+B,EAC/B,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EACxB,yBAAyB,EACzB,KAAK,wBAAwB,GAC9B,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,yBAAyB,EACzB,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,KAAK,gBAAgB,EACrB,KAAK,YAAY,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,wBAAwB,EACxB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,GAC9B,MAAM,gCAAgC,CAAC;AACxC,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,WAAW,EACX,QAAQ,GACT,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,mBAAmB,EACnB,aAAa,GACd,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAKvD,OAAO,EAAE,cAAc,EAAE,KAAK,eAAe,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGzF,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,YAAY,GAClB,MAAM,wBAAwB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
|
@@ -44,6 +44,9 @@ import {
|
|
|
44
44
|
ContractStreamFrameSchema,
|
|
45
45
|
DEFAULT_CONTRACT_STREAM_FRAME_BYTES
|
|
46
46
|
} from "../index-wqgjfstn.js";
|
|
47
|
+
import {
|
|
48
|
+
createMutationQueue
|
|
49
|
+
} from "../index-q3pyb9n0.js";
|
|
47
50
|
import {
|
|
48
51
|
LiveStateControllerStatusSchema,
|
|
49
52
|
LiveStatePhaseSchema,
|
|
@@ -393,6 +396,172 @@ function createRetainedTopics() {
|
|
|
393
396
|
}
|
|
394
397
|
};
|
|
395
398
|
}
|
|
399
|
+
// src/browser/session.ts
|
|
400
|
+
class SessionExpiredError extends Error {
|
|
401
|
+
constructor() {
|
|
402
|
+
super("The originating session is no longer active");
|
|
403
|
+
this.name = "SessionExpiredError";
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
function createSessionScope() {
|
|
407
|
+
let generation = 0;
|
|
408
|
+
let stopped = false;
|
|
409
|
+
let active;
|
|
410
|
+
let abort;
|
|
411
|
+
const invalidate = () => {
|
|
412
|
+
const previous = abort;
|
|
413
|
+
generation += 1;
|
|
414
|
+
active = undefined;
|
|
415
|
+
abort = undefined;
|
|
416
|
+
previous?.abort(new SessionExpiredError);
|
|
417
|
+
};
|
|
418
|
+
return {
|
|
419
|
+
get generation() {
|
|
420
|
+
return generation;
|
|
421
|
+
},
|
|
422
|
+
replace(context) {
|
|
423
|
+
if (stopped)
|
|
424
|
+
throw new SessionExpiredError;
|
|
425
|
+
const previous = abort;
|
|
426
|
+
generation += 1;
|
|
427
|
+
const controller = new AbortController;
|
|
428
|
+
abort = controller;
|
|
429
|
+
const id = generation;
|
|
430
|
+
const current = () => !stopped && generation === id && !controller.signal.aborted;
|
|
431
|
+
const assertCurrent = () => {
|
|
432
|
+
if (!current())
|
|
433
|
+
throw new SessionExpiredError;
|
|
434
|
+
};
|
|
435
|
+
const operation = {
|
|
436
|
+
context,
|
|
437
|
+
id: crypto.randomUUID(),
|
|
438
|
+
generation: id,
|
|
439
|
+
signal: controller.signal,
|
|
440
|
+
current,
|
|
441
|
+
assertCurrent,
|
|
442
|
+
async run(work) {
|
|
443
|
+
assertCurrent();
|
|
444
|
+
try {
|
|
445
|
+
const result = await work();
|
|
446
|
+
assertCurrent();
|
|
447
|
+
return result;
|
|
448
|
+
} catch (error) {
|
|
449
|
+
assertCurrent();
|
|
450
|
+
throw error;
|
|
451
|
+
}
|
|
452
|
+
},
|
|
453
|
+
deliver(delivery) {
|
|
454
|
+
if (!current())
|
|
455
|
+
return false;
|
|
456
|
+
delivery();
|
|
457
|
+
return true;
|
|
458
|
+
},
|
|
459
|
+
bindFetch(fetch, headers) {
|
|
460
|
+
return async (input, init) => {
|
|
461
|
+
assertCurrent();
|
|
462
|
+
const request = new Request(input, init);
|
|
463
|
+
const extra = headers?.();
|
|
464
|
+
assertCurrent();
|
|
465
|
+
if (extra)
|
|
466
|
+
new Headers(extra).forEach((value, key) => {
|
|
467
|
+
request.headers.set(key, value);
|
|
468
|
+
});
|
|
469
|
+
const signal = AbortSignal.any([controller.signal, request.signal]);
|
|
470
|
+
return operation.run(() => fetch(new Request(request, { signal })));
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
active = Object.freeze(operation);
|
|
475
|
+
previous?.abort(new SessionExpiredError);
|
|
476
|
+
return operation;
|
|
477
|
+
},
|
|
478
|
+
clear: invalidate,
|
|
479
|
+
stop() {
|
|
480
|
+
stopped = true;
|
|
481
|
+
invalidate();
|
|
482
|
+
},
|
|
483
|
+
capture() {
|
|
484
|
+
if (!active)
|
|
485
|
+
throw new SessionExpiredError;
|
|
486
|
+
return active;
|
|
487
|
+
},
|
|
488
|
+
owns(operation) {
|
|
489
|
+
return active === operation && operation.current();
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
// src/browser/session-credentials.ts
|
|
494
|
+
function createSessionCredentials(config) {
|
|
495
|
+
const capacity = config.maxPendingWrites ?? 128;
|
|
496
|
+
if (!Number.isSafeInteger(capacity) || capacity < 1 || capacity > 65536)
|
|
497
|
+
throw new RangeError("maxPendingWrites must be between 1 and 65536");
|
|
498
|
+
const serialize = createMutationQueue(capacity);
|
|
499
|
+
const timeout = config.refreshTimeoutMs ?? 30000;
|
|
500
|
+
if (!Number.isInteger(timeout) || timeout < 1 || timeout > 3600000) {
|
|
501
|
+
throw new RangeError("refreshTimeoutMs must be between 1 and 3600000");
|
|
502
|
+
}
|
|
503
|
+
let state;
|
|
504
|
+
let flight;
|
|
505
|
+
const read = (operation) => {
|
|
506
|
+
if (!config.scope.owns(operation) || state?.operation !== operation)
|
|
507
|
+
throw new SessionExpiredError;
|
|
508
|
+
return state.credentials;
|
|
509
|
+
};
|
|
510
|
+
const write = (operation, credentials) => serialize(async () => {
|
|
511
|
+
read(operation);
|
|
512
|
+
await config.storage.write(operation.context, credentials);
|
|
513
|
+
operation.assertCurrent();
|
|
514
|
+
});
|
|
515
|
+
return {
|
|
516
|
+
async login(session, credentials) {
|
|
517
|
+
const operation = config.scope.replace(session);
|
|
518
|
+
operation.assertCurrent();
|
|
519
|
+
state = { operation, credentials };
|
|
520
|
+
await write(operation, credentials);
|
|
521
|
+
return operation;
|
|
522
|
+
},
|
|
523
|
+
logout() {
|
|
524
|
+
config.scope.clear();
|
|
525
|
+
state = undefined;
|
|
526
|
+
const generation = config.scope.generation;
|
|
527
|
+
return serialize(async () => {
|
|
528
|
+
if (config.scope.generation === generation)
|
|
529
|
+
await config.storage.clear();
|
|
530
|
+
});
|
|
531
|
+
},
|
|
532
|
+
read,
|
|
533
|
+
refresh(operation) {
|
|
534
|
+
const credentials = read(operation);
|
|
535
|
+
if (flight?.operation === operation)
|
|
536
|
+
return flight.result;
|
|
537
|
+
const controller = new AbortController;
|
|
538
|
+
const signal = AbortSignal.any([operation.signal, controller.signal]);
|
|
539
|
+
const timer = setTimeout(() => controller.abort(new DOMException("Refresh timed out", "TimeoutError")), timeout);
|
|
540
|
+
let onAbort = () => {
|
|
541
|
+
return;
|
|
542
|
+
};
|
|
543
|
+
const abortPromise = new Promise((_, reject) => {
|
|
544
|
+
onAbort = () => reject(signal.reason);
|
|
545
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
546
|
+
});
|
|
547
|
+
const result = operation.run(async () => {
|
|
548
|
+
const next = await Promise.race([config.refresh(credentials, signal), abortPromise]);
|
|
549
|
+
read(operation);
|
|
550
|
+
await write(operation, next);
|
|
551
|
+
read(operation);
|
|
552
|
+
state = { operation, credentials: next };
|
|
553
|
+
return next;
|
|
554
|
+
}).finally(() => {
|
|
555
|
+
clearTimeout(timer);
|
|
556
|
+
signal.removeEventListener("abort", onAbort);
|
|
557
|
+
if (flight?.result === result)
|
|
558
|
+
flight = undefined;
|
|
559
|
+
});
|
|
560
|
+
flight = { operation, result };
|
|
561
|
+
return result;
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
}
|
|
396
565
|
// src/browser/socket-io-connection.ts
|
|
397
566
|
function toIoAuth(auth) {
|
|
398
567
|
if (typeof auth !== "function")
|
|
@@ -724,6 +893,8 @@ export {
|
|
|
724
893
|
createUrlBuilder,
|
|
725
894
|
createTraceContext,
|
|
726
895
|
createSocketIOClient,
|
|
896
|
+
createSessionScope,
|
|
897
|
+
createSessionCredentials,
|
|
727
898
|
createScopedUrlBuilders,
|
|
728
899
|
createScopedClients,
|
|
729
900
|
createRetainedTopics,
|
|
@@ -742,6 +913,7 @@ export {
|
|
|
742
913
|
asRealtimeRejection,
|
|
743
914
|
appError,
|
|
744
915
|
TOOL_TRANSPORTS,
|
|
916
|
+
SessionExpiredError,
|
|
745
917
|
STITCH_ERROR_STATUS,
|
|
746
918
|
RealtimeRequestTimeoutError,
|
|
747
919
|
RealtimeRequestRejectedError,
|
package/dist/entrypoints/live.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
diff,
|
|
15
15
|
watchContract,
|
|
16
16
|
watchKeyString
|
|
17
|
-
} from "../index-
|
|
17
|
+
} from "../index-k6gpggb9.js";
|
|
18
18
|
import"../index-1j8pm5t0.js";
|
|
19
19
|
import"../index-d9pk3td4.js";
|
|
20
20
|
import {
|
|
@@ -73,23 +73,23 @@ function toRealtimeContract(declaration) {
|
|
|
73
73
|
}
|
|
74
74
|
return { serverToClient, clientToServer: {} };
|
|
75
75
|
}
|
|
76
|
-
// src/live/watch-client.ts
|
|
77
|
-
function watchTransport(client) {
|
|
78
|
-
return client;
|
|
79
|
-
}
|
|
76
|
+
// src/live/watch-client-state.ts
|
|
80
77
|
function publishState(entry, state) {
|
|
81
78
|
entry.state = state;
|
|
82
79
|
for (const listener of [...entry.listeners])
|
|
83
80
|
listener.state?.(state);
|
|
84
81
|
}
|
|
85
82
|
async function openWatch(config, openTimeoutMs, entry) {
|
|
86
|
-
if (entry.opened)
|
|
83
|
+
if (entry.opened || entry.released || config.session && !config.session.current())
|
|
87
84
|
return;
|
|
85
|
+
const epoch = ++entry.epoch;
|
|
88
86
|
entry.opened = true;
|
|
89
87
|
entry.answered = false;
|
|
90
88
|
try {
|
|
91
89
|
const have = entry.hasValue && entry.fingerprint !== undefined ? { revision: entry.revision, fingerprint: entry.fingerprint } : undefined;
|
|
92
90
|
const acknowledgement = await config.transport.request(WATCH_OPEN, { key: entry.key, args: entry.args, ...have !== undefined && { have } }, { timeoutMs: openTimeoutMs });
|
|
91
|
+
if (epoch !== entry.epoch || entry.released || config.session && !config.session.current())
|
|
92
|
+
return;
|
|
93
93
|
if (!acknowledgement.accepted) {
|
|
94
94
|
const reason = acknowledgement.reason ?? "the server refused this watch";
|
|
95
95
|
config.onRefused?.(entry.key, reason);
|
|
@@ -101,6 +101,8 @@ async function openWatch(config, openTimeoutMs, entry) {
|
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
} catch (error) {
|
|
104
|
+
if (epoch !== entry.epoch || entry.released || config.session && !config.session.current())
|
|
105
|
+
return;
|
|
104
106
|
entry.opened = false;
|
|
105
107
|
const code = typeof error === "object" && error !== null && "code" in error ? String(Reflect.get(error, "code")) : undefined;
|
|
106
108
|
publishState(entry, {
|
|
@@ -160,8 +162,19 @@ function applyWatchFrame(entry, frame) {
|
|
|
160
162
|
entry.answered = true;
|
|
161
163
|
return { kind: "value", value };
|
|
162
164
|
}
|
|
165
|
+
|
|
166
|
+
// src/live/watch-client.ts
|
|
167
|
+
function watchTransport(client) {
|
|
168
|
+
return client;
|
|
169
|
+
}
|
|
163
170
|
function createWatchClient(contract, config) {
|
|
164
171
|
const entries = new Map;
|
|
172
|
+
const valid = () => !config.session || config.session.current();
|
|
173
|
+
const maxKeys = config.maxKeys ?? 1024;
|
|
174
|
+
const maxListeners = config.maxListenersPerKey ?? 128;
|
|
175
|
+
for (const bound of [maxKeys, maxListeners])
|
|
176
|
+
if (!Number.isInteger(bound) || bound < 1)
|
|
177
|
+
throw new RangeError("Watch capacity must be positive");
|
|
165
178
|
const holdMs = config.holdMs ?? 0;
|
|
166
179
|
const openTimeoutMs = config.openTimeoutMs ?? 1e4;
|
|
167
180
|
const service = contract.meta.prefix;
|
|
@@ -175,7 +188,9 @@ function createWatchClient(contract, config) {
|
|
|
175
188
|
config.transport.emit(WATCH_CLOSE, { key: entry.key });
|
|
176
189
|
openWatch(config, openTimeoutMs, entry);
|
|
177
190
|
}
|
|
178
|
-
config.transport.on(WATCH_VALUE, (frame) => {
|
|
191
|
+
const offValue = config.transport.on(WATCH_VALUE, (frame) => {
|
|
192
|
+
if (!valid())
|
|
193
|
+
return;
|
|
179
194
|
const entry = entries.get(watchKeyString(frame.key));
|
|
180
195
|
if (!entry)
|
|
181
196
|
return;
|
|
@@ -189,16 +204,21 @@ function createWatchClient(contract, config) {
|
|
|
189
204
|
for (const listener of [...entry.listeners])
|
|
190
205
|
listener.value(outcome.value);
|
|
191
206
|
});
|
|
192
|
-
config.transport.on(WATCH_STATE, (frame) => {
|
|
207
|
+
const offState = config.transport.on(WATCH_STATE, (frame) => {
|
|
208
|
+
if (!valid())
|
|
209
|
+
return;
|
|
193
210
|
const entry = entries.get(watchKeyString(frame.key));
|
|
194
211
|
if (!entry)
|
|
195
212
|
return;
|
|
196
213
|
publishState(entry, frame);
|
|
197
214
|
});
|
|
198
|
-
config.transport.onConnectionChange((connected, reason) => {
|
|
215
|
+
const offConnection = config.transport.onConnectionChange((connected, reason) => {
|
|
216
|
+
if (!valid())
|
|
217
|
+
return;
|
|
199
218
|
if (!connected) {
|
|
200
219
|
for (const entry of entries.values()) {
|
|
201
220
|
entry.opened = false;
|
|
221
|
+
entry.epoch += 1;
|
|
202
222
|
publishState(entry, {
|
|
203
223
|
key: entry.key,
|
|
204
224
|
phase: "unavailable",
|
|
@@ -215,6 +235,25 @@ function createWatchClient(contract, config) {
|
|
|
215
235
|
openWatch(config, openTimeoutMs, entry);
|
|
216
236
|
}
|
|
217
237
|
});
|
|
238
|
+
const shutdown = () => {
|
|
239
|
+
offValue();
|
|
240
|
+
offState();
|
|
241
|
+
offConnection();
|
|
242
|
+
for (const entry of entries.values()) {
|
|
243
|
+
entry.released = true;
|
|
244
|
+
entry.epoch++;
|
|
245
|
+
clearTimeout(entry.release);
|
|
246
|
+
entry.listeners.clear();
|
|
247
|
+
entry.value = undefined;
|
|
248
|
+
entry.hasValue = false;
|
|
249
|
+
config.transport.emit(WATCH_CLOSE, { key: entry.key });
|
|
250
|
+
}
|
|
251
|
+
entries.clear();
|
|
252
|
+
};
|
|
253
|
+
if (config.session?.signal.aborted)
|
|
254
|
+
shutdown();
|
|
255
|
+
else
|
|
256
|
+
config.session?.signal.addEventListener("abort", shutdown, { once: true });
|
|
218
257
|
function entryFor(key, args) {
|
|
219
258
|
const id = watchKeyString(key);
|
|
220
259
|
const existing = entries.get(id);
|
|
@@ -223,7 +262,11 @@ function createWatchClient(contract, config) {
|
|
|
223
262
|
existing.release = undefined;
|
|
224
263
|
return existing;
|
|
225
264
|
}
|
|
265
|
+
if (entries.size >= maxKeys)
|
|
266
|
+
throw new Error("Watch key capacity exceeded");
|
|
226
267
|
const entry = {
|
|
268
|
+
epoch: 0,
|
|
269
|
+
released: false,
|
|
227
270
|
key,
|
|
228
271
|
args,
|
|
229
272
|
listeners: new Set,
|
|
@@ -236,12 +279,14 @@ function createWatchClient(contract, config) {
|
|
|
236
279
|
entries.set(id, entry);
|
|
237
280
|
return entry;
|
|
238
281
|
}
|
|
239
|
-
function
|
|
282
|
+
function releaseWatchClientEntry(entry) {
|
|
240
283
|
if (entry.listeners.size > 0)
|
|
241
284
|
return;
|
|
242
285
|
const drop = () => {
|
|
243
286
|
if (entry.listeners.size > 0)
|
|
244
287
|
return;
|
|
288
|
+
entry.released = true;
|
|
289
|
+
entry.epoch++;
|
|
245
290
|
entries.delete(watchKeyString(entry.key));
|
|
246
291
|
config.transport.emit(WATCH_CLOSE, { key: entry.key });
|
|
247
292
|
};
|
|
@@ -254,9 +299,19 @@ function createWatchClient(contract, config) {
|
|
|
254
299
|
}
|
|
255
300
|
function handleFor(action, args) {
|
|
256
301
|
const mine = new Set;
|
|
257
|
-
|
|
302
|
+
let entry = entryFor({
|
|
303
|
+
service,
|
|
304
|
+
action,
|
|
305
|
+
digest: argumentsDigest(args),
|
|
306
|
+
...config.session && { instance: config.session.id }
|
|
307
|
+
}, args);
|
|
258
308
|
return {
|
|
259
309
|
subscribe(listeners) {
|
|
310
|
+
config.session?.assertCurrent();
|
|
311
|
+
if (entry.released)
|
|
312
|
+
entry = entryFor(entry.key, args);
|
|
313
|
+
if (entry.listeners.size >= maxListeners)
|
|
314
|
+
throw new Error("Watch listener capacity exceeded");
|
|
260
315
|
const registered = listeners;
|
|
261
316
|
mine.add(registered);
|
|
262
317
|
entry.listeners.add(registered);
|
|
@@ -267,14 +322,14 @@ function createWatchClient(contract, config) {
|
|
|
267
322
|
return () => {
|
|
268
323
|
mine.delete(registered);
|
|
269
324
|
entry.listeners.delete(registered);
|
|
270
|
-
|
|
325
|
+
releaseWatchClientEntry(entry);
|
|
271
326
|
};
|
|
272
327
|
},
|
|
273
328
|
close() {
|
|
274
329
|
for (const listener of mine)
|
|
275
330
|
entry.listeners.delete(listener);
|
|
276
331
|
mine.clear();
|
|
277
|
-
|
|
332
|
+
releaseWatchClientEntry(entry);
|
|
278
333
|
}
|
|
279
334
|
};
|
|
280
335
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { type CacheBridge, type CacheBridgeConfig, type CacheBridgeContext, type CacheBridgeHandler, type CacheBridgeHandlers, type CacheBridgeSocket, createCacheBridge, createRealtimeCacheBridge, type RealtimeCacheBridgeConfig, } from '../react/cache-bridge.js';
|
|
1
|
+
export { type CacheBridge, type CacheBridgeConfig, type CacheBridgeContext, type CacheBridgeHandler, type CacheBridgeHandlers, type CacheBridgeSocket, createCacheBridge, createRealtimeCacheBridge, type RealtimeCacheBridgeConfig, type WatchCacheBinding, } from '../react/cache-bridge.js';
|
|
2
2
|
export { type CursorQueryConfig, createCursorQuery } from '../react/cursor-query.js';
|
|
3
3
|
export { createEntityCacheHandlers, type DeletedPayload, type EntityCacheConfig, type EntityCacheEvent, type EntityCacheHandlers, type EntityCacheKey, type EntityCacheListConfig, type EntityCacheListShape, type EntityCacheMembership, type EntityCacheMembershipPolicy, type EntityCacheTotalDeltaInput, type EntityCacheTotalPolicy, } from '../react/entity-cache.js';
|
|
4
4
|
export { type ApiErrorRetryConfig, apiErrorRetry, createQueryClientFactory, type QueryClientFactoryConfig, type QueryClientServerCache, type QueryRetryValue, } from '../react/query-client.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/entrypoints/react.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,iBAAiB,EACjB,yBAAyB,EACzB,KAAK,yBAAyB,
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/entrypoints/react.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,iBAAiB,EACjB,yBAAyB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAClF,OAAO,EACL,yBAAyB,EACzB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAC/B,KAAK,sBAAsB,GAC5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,mBAAmB,EACxB,aAAa,EACb,wBAAwB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,eAAe,GACrB,MAAM,uBAAuB,CAAC"}
|
|
@@ -36,28 +36,71 @@ function createCacheBridge(config) {
|
|
|
36
36
|
expiryTimers.clear();
|
|
37
37
|
freshAt.clear();
|
|
38
38
|
};
|
|
39
|
+
let connected = false;
|
|
40
|
+
let clearWatched;
|
|
41
|
+
const disconnect = () => {
|
|
42
|
+
for (const off of unsubscribers)
|
|
43
|
+
off();
|
|
44
|
+
unsubscribers = [];
|
|
45
|
+
connected = false;
|
|
46
|
+
clearFresh();
|
|
47
|
+
config.session?.signal.removeEventListener("abort", invalidateSession);
|
|
48
|
+
};
|
|
49
|
+
const invalidateSession = () => {
|
|
50
|
+
disconnect();
|
|
51
|
+
clearWatched?.();
|
|
52
|
+
};
|
|
39
53
|
return {
|
|
40
54
|
connect() {
|
|
41
|
-
|
|
55
|
+
config.session?.assertCurrent();
|
|
56
|
+
if (connected)
|
|
42
57
|
return;
|
|
43
58
|
const queryClient = typeof config.queryClient === "function" ? config.queryClient() : config.queryClient;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
|
|
59
|
+
connected = true;
|
|
60
|
+
try {
|
|
61
|
+
clearWatched = () => {
|
|
62
|
+
for (const binding of config.watched ?? [])
|
|
63
|
+
queryClient.removeQueries({ queryKey: binding.queryKey, exact: true });
|
|
64
|
+
};
|
|
65
|
+
config.session?.signal.addEventListener("abort", invalidateSession, { once: true });
|
|
66
|
+
for (const binding of config.watched ?? []) {
|
|
67
|
+
unsubscribers.push(binding.handle.subscribe({
|
|
68
|
+
value(value) {
|
|
69
|
+
if (!config.session || config.session.current())
|
|
70
|
+
queryClient.setQueryData(binding.queryKey, value);
|
|
71
|
+
},
|
|
72
|
+
state(state) {
|
|
73
|
+
if (config.session && !config.session.current())
|
|
74
|
+
return;
|
|
75
|
+
if (state.phase !== "live")
|
|
76
|
+
queryClient.invalidateQueries({
|
|
77
|
+
queryKey: binding.queryKey,
|
|
78
|
+
exact: true,
|
|
79
|
+
refetchType: "none"
|
|
80
|
+
});
|
|
81
|
+
binding.state?.(state);
|
|
82
|
+
}
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
const ctx = { queryClient, isFresh };
|
|
86
|
+
const handlers = config.handlers;
|
|
87
|
+
const socket = config.socket;
|
|
88
|
+
for (const event of Object.keys(handlers)) {
|
|
89
|
+
const handler = handlers[event];
|
|
90
|
+
if (!handler)
|
|
91
|
+
continue;
|
|
92
|
+
const off = socket.on(event, (data) => {
|
|
93
|
+
if (!config.session || config.session.current())
|
|
94
|
+
handler(data, ctx);
|
|
95
|
+
});
|
|
96
|
+
unsubscribers.push(off);
|
|
97
|
+
}
|
|
98
|
+
} catch (error) {
|
|
99
|
+
disconnect();
|
|
100
|
+
throw error;
|
|
53
101
|
}
|
|
54
102
|
},
|
|
55
|
-
disconnect
|
|
56
|
-
for (const off of unsubscribers)
|
|
57
|
-
off();
|
|
58
|
-
unsubscribers = [];
|
|
59
|
-
clearFresh();
|
|
60
|
-
},
|
|
103
|
+
disconnect,
|
|
61
104
|
markFresh(key) {
|
|
62
105
|
const serialised = JSON.stringify(key);
|
|
63
106
|
const existingTimer = expiryTimers.get(serialised);
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
canonicalAgentJson,
|
|
20
20
|
decodeAgentConversationArchive,
|
|
21
21
|
encodeAgentConversationArchive
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-cyktc4bp.js";
|
|
23
23
|
import {
|
|
24
24
|
AgentMessageSchema,
|
|
25
25
|
AgentRecordIdSchema,
|
|
@@ -427,6 +427,37 @@ async function importConversation(driver, bytes) {
|
|
|
427
427
|
});
|
|
428
428
|
}
|
|
429
429
|
|
|
430
|
+
// src/agent-runtime/store-event-once.ts
|
|
431
|
+
import { createHash } from "node:crypto";
|
|
432
|
+
function appendEventOnce(driver, input, key) {
|
|
433
|
+
const parsed = AppendAgentStoreEventSchema.parse(input);
|
|
434
|
+
if (!key)
|
|
435
|
+
throw new TypeError("Event admission key must not be empty");
|
|
436
|
+
const eventId = createHash("sha256").update(JSON.stringify([parsed.conversationId, parsed.kind, key])).digest("hex");
|
|
437
|
+
return driver.transaction(async (transaction) => {
|
|
438
|
+
if (await driver.conversations?.isPurged(transaction, parsed.conversationId)) {
|
|
439
|
+
throw new AgentConversationPurgedError;
|
|
440
|
+
}
|
|
441
|
+
let fromSeq;
|
|
442
|
+
do {
|
|
443
|
+
const page = await driver.events.list(transaction, {
|
|
444
|
+
conversationId: parsed.conversationId,
|
|
445
|
+
fromSeq,
|
|
446
|
+
limit: 1e4
|
|
447
|
+
});
|
|
448
|
+
const previous = page.items.find((event2) => event2.eventId === eventId);
|
|
449
|
+
if (previous)
|
|
450
|
+
return { outcome: "duplicate", event: previous };
|
|
451
|
+
fromSeq = page.nextSeq;
|
|
452
|
+
} while (fromSeq !== undefined);
|
|
453
|
+
const event = await driver.events.append(transaction, {
|
|
454
|
+
...agentStoreEventDraft(parsed),
|
|
455
|
+
eventId
|
|
456
|
+
});
|
|
457
|
+
return { outcome: "applied", event };
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
|
|
430
461
|
// src/agent-runtime/store-mutate.ts
|
|
431
462
|
import { z as z4 } from "zod";
|
|
432
463
|
|
|
@@ -453,7 +484,7 @@ function applied(current, input, effects) {
|
|
|
453
484
|
}
|
|
454
485
|
|
|
455
486
|
// src/agent-runtime/store-reducer.ts
|
|
456
|
-
import { createHash } from "node:crypto";
|
|
487
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
457
488
|
|
|
458
489
|
// src/agent-runtime/store-reduce-history.ts
|
|
459
490
|
function reduceAccept(current, input) {
|
|
@@ -737,7 +768,7 @@ function transitionRecord(operation) {
|
|
|
737
768
|
assistant: {
|
|
738
769
|
id: assistant.id,
|
|
739
770
|
status: assistant.status,
|
|
740
|
-
sha256:
|
|
771
|
+
sha256: createHash2("sha256").update(body).digest("hex"),
|
|
741
772
|
parts: assistant.parts.length,
|
|
742
773
|
bytes: Buffer.byteLength(body)
|
|
743
774
|
}
|
|
@@ -979,6 +1010,7 @@ function createAgentRuntimeStore(driver) {
|
|
|
979
1010
|
loadSnapshot: (conversationId) => loadSnapshot(driver, conversationId),
|
|
980
1011
|
loadRun: (input) => loadRun(driver, input),
|
|
981
1012
|
listActiveRuns: (conversationId) => listActiveRuns(driver, conversationId),
|
|
1013
|
+
appendEventOnce: (input, key) => appendEventOnce(driver, input, key),
|
|
982
1014
|
appendEvent: (input) => appendEvent(driver, input),
|
|
983
1015
|
readEvents: (input) => readEvents(driver, input),
|
|
984
1016
|
exportConversation: (conversationId) => exportConversation(driver, conversationId),
|
|
@@ -17,6 +17,9 @@ import { z } from "zod";
|
|
|
17
17
|
var AgentStoreEventKindSchema = z.enum([
|
|
18
18
|
"runtime/baseline",
|
|
19
19
|
"runtime/transition",
|
|
20
|
+
"invocation/started",
|
|
21
|
+
"invocation/finished",
|
|
22
|
+
"provider/payload",
|
|
20
23
|
"provider/request",
|
|
21
24
|
"provider/response",
|
|
22
25
|
"provider/message",
|