@tangle-network/agent-app 0.63.45 → 0.63.47
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/chat-routes/index.js +3 -3
- package/dist/chat-routes/route-storage.d.ts +1 -0
- package/dist/chat-routes/turn-ownership.d.ts +1 -1
- package/dist/chat-routes/turn-route-contracts.d.ts +2 -0
- package/dist/{chunk-YQUZQHAD.js → chunk-HHIEHETJ.js} +2 -2
- package/dist/{chunk-L63GYPYY.js → chunk-IMFJMFHK.js} +13 -26
- package/dist/chunk-IMFJMFHK.js.map +1 -0
- package/dist/{chunk-LUKLQDIK.js → chunk-ISNEHOOO.js} +1 -1
- package/dist/chunk-ISNEHOOO.js.map +1 -0
- package/dist/{chunk-N5RWYR5N.js → chunk-ZTGITMYQ.js} +10 -1
- package/dist/chunk-ZTGITMYQ.js.map +1 -0
- package/dist/preset-cloudflare/index.js +1 -1
- package/dist/public-consultation/index.js +3 -3
- package/dist/sandbox/index.js +2 -2
- package/dist/theme-contract/cli.js +1 -1
- package/dist/theme-contract/index.d.ts +4 -7
- package/dist/theme-contract/index.js +1 -1
- package/dist/turn-stream/adapters.d.ts +6 -6
- package/dist/turn-stream/core.d.ts +1 -0
- package/dist/turn-stream/index.js +7 -3
- package/dist/turn-stream/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-L63GYPYY.js.map +0 -1
- package/dist/chunk-LUKLQDIK.js.map +0 -1
- package/dist/chunk-N5RWYR5N.js.map +0 -1
- /package/dist/{chunk-YQUZQHAD.js.map → chunk-HHIEHETJ.js.map} +0 -0
|
@@ -79,13 +79,13 @@ import {
|
|
|
79
79
|
turnCarriesFiles,
|
|
80
80
|
turnPromptText,
|
|
81
81
|
withProducerStream
|
|
82
|
-
} from "../chunk-
|
|
82
|
+
} from "../chunk-IMFJMFHK.js";
|
|
83
83
|
import "../chunk-CWO2LHXH.js";
|
|
84
84
|
import "../chunk-H6BRJU5M.js";
|
|
85
85
|
import "../chunk-4DBHC63F.js";
|
|
86
86
|
import "../chunk-RN4WPTBH.js";
|
|
87
87
|
import "../chunk-MM6RLOXF.js";
|
|
88
|
-
import "../chunk-
|
|
88
|
+
import "../chunk-HHIEHETJ.js";
|
|
89
89
|
import "../chunk-F4TUZYMX.js";
|
|
90
90
|
import {
|
|
91
91
|
redactErrorMessage
|
|
@@ -116,7 +116,7 @@ import {
|
|
|
116
116
|
DEFAULT_STALE_TURN_LOCK_GRACE_MS,
|
|
117
117
|
DEFAULT_TERMINAL_TURN_LOCK_GRACE_MS,
|
|
118
118
|
reconcileStaleTurnLock
|
|
119
|
-
} from "../chunk-
|
|
119
|
+
} from "../chunk-ZTGITMYQ.js";
|
|
120
120
|
import {
|
|
121
121
|
coalesceDeltas,
|
|
122
122
|
createBufferedTurnTap
|
|
@@ -16,6 +16,7 @@ export interface ChatTurnStoreBindings {
|
|
|
16
16
|
export declare function createDefaultTurnLock<TContext>(store: Pick<ChatTurnStoreBindings, 'lock' | 'region'>): {
|
|
17
17
|
acquire(args: import("../turn-stream").TurnLockSeamArgs<TContext>): Promise<import("../turn-stream").TurnLockSeamResult>;
|
|
18
18
|
release(handle: unknown): Promise<void>;
|
|
19
|
+
park(handle: unknown): Promise<boolean>;
|
|
19
20
|
warm(target: {
|
|
20
21
|
tenantId: string;
|
|
21
22
|
threadId?: string;
|
|
@@ -16,7 +16,7 @@ interface OwnershipState {
|
|
|
16
16
|
}
|
|
17
17
|
/** One transfer of terminal authority, retaining the route only as a live projector. */
|
|
18
18
|
export declare function createChatTurnOwnership(state: OwnershipState, log: (message: string, meta?: Record<string, unknown>) => void, turnStreamId: string, options: {
|
|
19
|
-
turnLock?: Pick<ChatTurnLock<unknown>, 'release'>;
|
|
19
|
+
turnLock?: Pick<ChatTurnLock<unknown>, 'release' | 'park'>;
|
|
20
20
|
}): {
|
|
21
21
|
handoffCompletion: (handoff?: NativeCompletionHandoffOptions) => Promise<void>;
|
|
22
22
|
releaseLock: () => Promise<void>;
|
|
@@ -383,6 +383,8 @@ export type ChatTurnLockResult = {
|
|
|
383
383
|
export interface ChatTurnLock<TContext, TResource = unknown> {
|
|
384
384
|
acquire(args: ChatTurnProduceArgs<TContext, TResource>): ChatTurnLockResult | Promise<ChatTurnLockResult>;
|
|
385
385
|
release(handle: unknown): void | Promise<void>;
|
|
386
|
+
/** Record a release for the durable owner to complete without freeing the lock; absent or false, the lock stays held. */
|
|
387
|
+
park?(handle: unknown): Promise<boolean>;
|
|
386
388
|
/** Bring up whatever `acquire` will talk to, as soon as the turn is admitted
|
|
387
389
|
* and while `prepareTurn` and the history read run. Never awaited; a failure
|
|
388
390
|
* is logged and the turn goes on to `acquire` as usual. */
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
import {
|
|
18
18
|
DEFAULT_TURN_LOCK_LOCATION_HINT,
|
|
19
19
|
createDurableTurnLock
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-ZTGITMYQ.js";
|
|
21
21
|
import {
|
|
22
22
|
createD1TurnEventStore
|
|
23
23
|
} from "./chunk-3Q3UEWKK.js";
|
|
@@ -4310,4 +4310,4 @@ export {
|
|
|
4310
4310
|
SandboxFilesystemNotReadyError,
|
|
4311
4311
|
runForegroundSandboxSingleFlight
|
|
4312
4312
|
};
|
|
4313
|
-
//# sourceMappingURL=chunk-
|
|
4313
|
+
//# sourceMappingURL=chunk-HHIEHETJ.js.map
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
sandboxRunFailureDetail,
|
|
28
28
|
streamSandboxPrompt,
|
|
29
29
|
turnStorageBindings
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-HHIEHETJ.js";
|
|
31
31
|
import {
|
|
32
32
|
redactErrorMessage
|
|
33
33
|
} from "./chunk-MH74DY2I.js";
|
|
@@ -2230,6 +2230,13 @@ function createNativeTimingTransfer(read, onError) {
|
|
|
2230
2230
|
|
|
2231
2231
|
// src/chat-routes/turn-ownership.ts
|
|
2232
2232
|
function createChatTurnOwnership(state, log, turnStreamId, options) {
|
|
2233
|
+
const attempt = async (step, run) => {
|
|
2234
|
+
try {
|
|
2235
|
+
await run();
|
|
2236
|
+
} catch (err) {
|
|
2237
|
+
log(`[chat-routes] ${step} failed`, { turnId: turnStreamId, error: err instanceof Error ? err.message : String(err) });
|
|
2238
|
+
}
|
|
2239
|
+
};
|
|
2233
2240
|
const handoffCompletion = (handoff) => {
|
|
2234
2241
|
if (!state.completionHandoffPromise) {
|
|
2235
2242
|
state.completionHandoffPromise = (async () => {
|
|
@@ -2241,14 +2248,7 @@ function createChatTurnOwnership(state, log, turnStreamId, options) {
|
|
|
2241
2248
|
registrationFailed = true;
|
|
2242
2249
|
throw error;
|
|
2243
2250
|
} finally {
|
|
2244
|
-
|
|
2245
|
-
await state.tap?.detach();
|
|
2246
|
-
} catch (err) {
|
|
2247
|
-
log("[chat-routes] turn buffer detach failed", {
|
|
2248
|
-
turnId: turnStreamId,
|
|
2249
|
-
error: err instanceof Error ? err.message : String(err)
|
|
2250
|
-
});
|
|
2251
|
-
}
|
|
2251
|
+
await attempt("turn buffer detach", () => state.tap?.detach());
|
|
2252
2252
|
try {
|
|
2253
2253
|
await state.draft?.close();
|
|
2254
2254
|
} catch (err) {
|
|
@@ -2268,26 +2268,13 @@ function createChatTurnOwnership(state, log, turnStreamId, options) {
|
|
|
2268
2268
|
const releaseLock = async () => {
|
|
2269
2269
|
if (state.completionHandoff || !state.lockAcquired || state.lockReleased) return;
|
|
2270
2270
|
if (state.producer?.terminalObserved && !state.producer.terminalObserved()) {
|
|
2271
|
+
await attempt("turnLock.park", () => options.turnLock?.park?.(state.lockHandle));
|
|
2271
2272
|
await state.closeCancellation?.();
|
|
2272
2273
|
return;
|
|
2273
2274
|
}
|
|
2274
2275
|
state.lockReleased = true;
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
} catch (err) {
|
|
2278
|
-
log("[chat-routes] turn cancellation close failed", {
|
|
2279
|
-
turnId: turnStreamId,
|
|
2280
|
-
error: err instanceof Error ? err.message : String(err)
|
|
2281
|
-
});
|
|
2282
|
-
}
|
|
2283
|
-
try {
|
|
2284
|
-
await options.turnLock.release(state.lockHandle);
|
|
2285
|
-
} catch (err) {
|
|
2286
|
-
log("[chat-routes] turnLock.release failed", {
|
|
2287
|
-
turnId: turnStreamId,
|
|
2288
|
-
error: err instanceof Error ? err.message : String(err)
|
|
2289
|
-
});
|
|
2290
|
-
}
|
|
2276
|
+
await attempt("turn cancellation close", () => state.closeCancellation?.());
|
|
2277
|
+
await attempt("turnLock.release", () => options.turnLock.release(state.lockHandle));
|
|
2291
2278
|
};
|
|
2292
2279
|
return { handoffCompletion, releaseLock };
|
|
2293
2280
|
}
|
|
@@ -3949,4 +3936,4 @@ export {
|
|
|
3949
3936
|
createChatTurnRoutes,
|
|
3950
3937
|
streamChatRouteAsSandboxEvents
|
|
3951
3938
|
};
|
|
3952
|
-
//# sourceMappingURL=chunk-
|
|
3939
|
+
//# sourceMappingURL=chunk-IMFJMFHK.js.map
|