@tangle-network/agent-app 0.63.3 → 0.63.4
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/cancellation.d.ts +12 -1
- package/dist/chat-routes/index.js +3 -3
- package/dist/chat-routes/stale-turn-lock.d.ts +17 -1
- package/dist/chat-routes/turn-ownership.d.ts +1 -0
- package/dist/chat-routes/turn-route-contracts.d.ts +13 -3
- package/dist/{chunk-POIVNKYH.js → chunk-72ASTUPN.js} +2 -2
- package/dist/{chunk-464WRGJ3.js → chunk-MT6ZTQGD.js} +315 -114
- package/dist/chunk-MT6ZTQGD.js.map +1 -0
- package/dist/{chunk-PGWKYLHC.js → chunk-UXK5EBQT.js} +34 -4
- package/dist/chunk-UXK5EBQT.js.map +1 -0
- package/dist/preset-cloudflare/index.js +1 -1
- package/dist/public-consultation/index.d.ts +1 -1
- package/dist/public-consultation/index.js +3 -3
- package/dist/sandbox/index.js +2 -2
- package/dist/turn-stream/adapters.d.ts +13 -11
- package/dist/turn-stream/cancellation-do.d.ts +31 -0
- package/dist/turn-stream/cancellation.d.ts +23 -0
- package/dist/turn-stream/core.d.ts +23 -4
- package/dist/turn-stream/do.d.ts +4 -2
- package/dist/turn-stream/index.d.ts +1 -0
- package/dist/turn-stream/index.js +186 -14
- package/dist/turn-stream/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-464WRGJ3.js.map +0 -1
- package/dist/chunk-PGWKYLHC.js.map +0 -1
- /package/dist/{chunk-POIVNKYH.js.map → chunk-72ASTUPN.js.map} +0 -0
|
@@ -30,12 +30,22 @@ export interface ChatTurnCancelSource {
|
|
|
30
30
|
} | null>;
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
+
/** Acknowledges durable intent only; the execution owner still reconciles actual completion and side effects. */
|
|
34
|
+
export interface ChatTurnCancelControlResult {
|
|
35
|
+
requested: boolean;
|
|
36
|
+
}
|
|
33
37
|
/** Application fields are projected once; the shared owner never infers OAuth or source-key authority. */
|
|
34
38
|
export interface ChatTurnCancelTarget {
|
|
35
39
|
capturedMetadata: Record<string, unknown>;
|
|
36
40
|
status: string | undefined;
|
|
37
41
|
dispatchToken?: string;
|
|
38
42
|
requiresDispatchToken: boolean;
|
|
43
|
+
/** Server-captured exact owner, never coordinates supplied by the caller.
|
|
44
|
+
* Called after authorization and dispatch-token checks. A positive request
|
|
45
|
+
* acknowledges intent; it must not mark native work stopped. */
|
|
46
|
+
control?: {
|
|
47
|
+
request(capturedMetadata: Record<string, unknown>): Promise<ChatTurnCancelControlResult>;
|
|
48
|
+
};
|
|
39
49
|
native?: {
|
|
40
50
|
state: string | undefined;
|
|
41
51
|
sandboxId?: string;
|
|
@@ -44,7 +54,8 @@ export interface ChatTurnCancelTarget {
|
|
|
44
54
|
/** Resolve the original authorized box only after the dispatch token and receipt are validated. */
|
|
45
55
|
source(): Promise<ChatTurnCancelSource | null>;
|
|
46
56
|
};
|
|
47
|
-
/** Compare the WHOLE captured record atomically, then merge the stopped fields. False changes nothing.
|
|
57
|
+
/** Compare the WHOLE captured record atomically, then merge the stopped fields. False changes nothing.
|
|
58
|
+
* A requested-only control target never calls this; the execution owner confirms its terminal outcome. */
|
|
48
59
|
markStopped(capturedMetadata: Record<string, unknown>, stoppedAt: string): Promise<boolean>;
|
|
49
60
|
}
|
|
50
61
|
export interface ChatTurnCancelOptions<TContext> {
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
turnCarriesFiles,
|
|
72
72
|
turnPromptText,
|
|
73
73
|
withProducerStream
|
|
74
|
-
} from "../chunk-
|
|
74
|
+
} from "../chunk-UXK5EBQT.js";
|
|
75
75
|
import "../chunk-KH4QSBNI.js";
|
|
76
76
|
import {
|
|
77
77
|
sniffMimeFromName
|
|
@@ -85,7 +85,7 @@ import {
|
|
|
85
85
|
import "../chunk-MM6RLOXF.js";
|
|
86
86
|
import {
|
|
87
87
|
flattenHistory
|
|
88
|
-
} from "../chunk-
|
|
88
|
+
} from "../chunk-72ASTUPN.js";
|
|
89
89
|
import "../chunk-F4TUZYMX.js";
|
|
90
90
|
import {
|
|
91
91
|
assistantRowIdForTurn,
|
|
@@ -146,7 +146,7 @@ import {
|
|
|
146
146
|
DEFAULT_STALE_TURN_LOCK_GRACE_MS,
|
|
147
147
|
DEFAULT_TERMINAL_TURN_LOCK_GRACE_MS,
|
|
148
148
|
reconcileStaleTurnLock
|
|
149
|
-
} from "../chunk-
|
|
149
|
+
} from "../chunk-MT6ZTQGD.js";
|
|
150
150
|
import {
|
|
151
151
|
coalesceDeltas,
|
|
152
152
|
createBufferedTurnTap
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TurnCancellationIdentity } from '../turn-stream/cancellation';
|
|
1
2
|
/**
|
|
2
3
|
* Recovery policy for a `ChatTurnLock` whose holder died.
|
|
3
4
|
*
|
|
@@ -14,7 +15,11 @@
|
|
|
14
15
|
* probes — which box key, which session id, which sidecar endpoint — in the
|
|
15
16
|
* product.
|
|
16
17
|
*
|
|
17
|
-
*
|
|
18
|
+
* A supplied exact Router owner probe replaces the native rules: live and
|
|
19
|
+
* unknown hold; positive outer + child abandonment observes the same terminal
|
|
20
|
+
* grace and exact release fence. A native session cannot attest to a Router owner.
|
|
21
|
+
*
|
|
22
|
+
* The native rules, in precedence order:
|
|
18
23
|
*
|
|
19
24
|
* 1. The session probe answered and the execution is TERMINAL ⇒ release, once
|
|
20
25
|
* the lock is past a short grace period. The authority on "is this turn
|
|
@@ -55,6 +60,12 @@ export type StaleTurnLockSessionProbeResult = {
|
|
|
55
60
|
reachable: false;
|
|
56
61
|
reason?: string;
|
|
57
62
|
};
|
|
63
|
+
/** A positive abandoned verdict covers the exact outer producer and every registered child/effect owner. */
|
|
64
|
+
export interface StaleTurnLockOwnerProbeResult {
|
|
65
|
+
identity: TurnCancellationIdentity;
|
|
66
|
+
status: 'live' | 'abandoned' | 'unknown';
|
|
67
|
+
diagnostics?: Record<string, unknown>;
|
|
68
|
+
}
|
|
58
69
|
/**
|
|
59
70
|
* Minimum age a lock must reach before the "sandbox unreachable ⇒ nothing can
|
|
60
71
|
* be running" fallback may force-release it.
|
|
@@ -100,6 +111,11 @@ export interface ReconcileStaleTurnLockOptions {
|
|
|
100
111
|
/** When the held lock was acquired (epoch ms). The grace period is measured
|
|
101
112
|
* from here, so it must be the LOCK's start, not the turn's. */
|
|
102
113
|
lockStartedAt: number;
|
|
114
|
+
/** Router ownership replaces native-only inference. Missing/uncertain outer or child evidence must stay unknown. */
|
|
115
|
+
owner?: {
|
|
116
|
+
identity: TurnCancellationIdentity;
|
|
117
|
+
probe(identity: TurnCancellationIdentity): Promise<StaleTurnLockOwnerProbeResult>;
|
|
118
|
+
};
|
|
103
119
|
/** Is the box there and running? Never provisions — a peek, not an ensure.
|
|
104
120
|
* A throw is treated as unreachable, same as `absent`. */
|
|
105
121
|
probeSandbox(): Promise<StaleTurnLockSandboxProbeResult>;
|
|
@@ -11,6 +11,7 @@ interface OwnershipState {
|
|
|
11
11
|
lockAcquired: boolean;
|
|
12
12
|
lockReleased: boolean;
|
|
13
13
|
lockHandle: unknown;
|
|
14
|
+
closeCancellation?: () => Promise<void>;
|
|
14
15
|
}
|
|
15
16
|
/** One transfer of terminal authority, retaining the route only as a live projector. */
|
|
16
17
|
export declare function createChatTurnOwnership(state: OwnershipState, log: (message: string, meta?: Record<string, unknown>) => void, turnStreamId: string, options: {
|
|
@@ -306,9 +306,11 @@ export interface ChatTurnProduceArgs<TContext, TResource = unknown> {
|
|
|
306
306
|
* `TurnAdmissionRefusedError` when the turn is refused. Start the model call at once; write nothing durable,
|
|
307
307
|
* and read nothing `beforeTurn` adds to `context`, until it resolves. */
|
|
308
308
|
admitted?: Promise<ChatTurnProduceArgs<TContext, TResource>>;
|
|
309
|
-
/**
|
|
310
|
-
*
|
|
311
|
-
* Router
|
|
309
|
+
/** Effective execution signal: product Stop/supersession, opted-in durable Stop/control loss,
|
|
310
|
+
* and optional request-disconnect cancellation.
|
|
311
|
+
* A fresh Router backend also aborts on admission refusal or when the route stops reading it.
|
|
312
|
+
* Pass it to producer I/O; Router/Sandbox option data binds it automatically.
|
|
313
|
+
* Early Router handoff waits for `admitted`. */
|
|
312
314
|
admissionSignal?: AbortSignal;
|
|
313
315
|
}
|
|
314
316
|
/** One event as it crosses the route: the producer's own vocabulary, or an
|
|
@@ -356,12 +358,20 @@ export type ChatTurnGateResult = {
|
|
|
356
358
|
proceed: 'handoff';
|
|
357
359
|
response: Response;
|
|
358
360
|
};
|
|
361
|
+
/** This owner's cancellation observation: the signal aborts on Stop or control loss.
|
|
362
|
+
* Closing observation does not release the lock or establish remote completion. */
|
|
363
|
+
export interface ChatTurnCancellation {
|
|
364
|
+
signal: AbortSignal;
|
|
365
|
+
/** Close this owner's observation; never release the durable lock or claim remote work stopped. */
|
|
366
|
+
close(): void | Promise<void>;
|
|
367
|
+
}
|
|
359
368
|
/** Single-flight lock verdict — acquired (with an opaque handle passed back to
|
|
360
369
|
* `release`), or already held (short-circuit with the product's 409-style
|
|
361
370
|
* `Response`). */
|
|
362
371
|
export type ChatTurnLockResult = {
|
|
363
372
|
acquired: true;
|
|
364
373
|
handle?: unknown;
|
|
374
|
+
cancellation?: ChatTurnCancellation;
|
|
365
375
|
} | {
|
|
366
376
|
acquired: false;
|
|
367
377
|
response: Response;
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
DEFAULT_TURN_LOCK_LOCATION_HINT,
|
|
16
16
|
createDurableTurnLock
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-MT6ZTQGD.js";
|
|
18
18
|
import {
|
|
19
19
|
createD1TurnEventStore
|
|
20
20
|
} from "./chunk-ISP6ZH3G.js";
|
|
@@ -3748,4 +3748,4 @@ export {
|
|
|
3748
3748
|
sandboxPromptRunner,
|
|
3749
3749
|
createSandboxRunTool
|
|
3750
3750
|
};
|
|
3751
|
-
//# sourceMappingURL=chunk-
|
|
3751
|
+
//# sourceMappingURL=chunk-72ASTUPN.js.map
|