@tangle-network/agent-app 0.62.4 → 0.63.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 +1 -1
- package/dist/agent-profiles/d1.js +1 -1
- package/dist/agent-profiles/index.d.ts +4 -1
- package/dist/agent-profiles/index.js +1 -1
- package/dist/app-auth/index.js +2 -2
- package/dist/assistant/index.js +7 -7
- package/dist/chat-react/index.js +3 -3
- package/dist/chat-routes/cancellation.d.ts +61 -0
- package/dist/chat-routes/dispatch-first.d.ts +14 -25
- package/dist/chat-routes/early-turn-work.d.ts +10 -0
- package/dist/chat-routes/hybrid-producer.d.ts +4 -3
- package/dist/chat-routes/index.d.ts +2 -1
- package/dist/chat-routes/index.js +86 -1874
- package/dist/chat-routes/index.js.map +1 -1
- package/dist/chat-routes/native-turn-timing.d.ts +15 -0
- package/dist/chat-routes/producer-stream.d.ts +5 -0
- package/dist/chat-routes/route-producer.d.ts +3 -0
- package/dist/chat-routes/route-storage.d.ts +7 -0
- package/dist/chat-routes/router-producer.d.ts +31 -5
- package/dist/chat-routes/turn-admission.d.ts +2 -1
- package/dist/chat-routes/turn-execution.d.ts +6 -11
- package/dist/chat-routes/turn-ownership.d.ts +22 -0
- package/dist/chat-routes/turn-route-contracts.d.ts +112 -105
- package/dist/chat-routes/turn-routes.d.ts +4 -4
- package/dist/chat-routes/wire.d.ts +0 -7
- package/dist/chat-store/index.d.ts +1 -1
- package/dist/chat-store/index.js +21 -3
- package/dist/chat-store/index.js.map +1 -1
- package/dist/chat-store/schema.d.ts +3 -2
- package/dist/chat-store/store.d.ts +8 -0
- package/dist/{chunk-GIEUZBQQ.js → chunk-4CALWPN5.js} +3 -7
- package/dist/chunk-4CALWPN5.js.map +1 -0
- package/dist/chunk-4DBHC63F.js +54 -0
- package/dist/chunk-4DBHC63F.js.map +1 -0
- package/dist/{chunk-G7M2C72Q.js → chunk-5TSRFF5W.js} +1 -1
- package/dist/chunk-5TSRFF5W.js.map +1 -0
- package/dist/chunk-A2NQMVMF.js +485 -0
- package/dist/chunk-A2NQMVMF.js.map +1 -0
- package/dist/{chunk-PCAY23GS.js → chunk-AVBNS64P.js} +172 -2
- package/dist/chunk-AVBNS64P.js.map +1 -0
- package/dist/{chunk-4P5NFBWX.js → chunk-BI5AZAOO.js} +4 -4
- package/dist/chunk-BV3VZEKB.js +483 -0
- package/dist/chunk-BV3VZEKB.js.map +1 -0
- package/dist/{chunk-UW2DKTEM.js → chunk-IDG2XR5O.js} +20 -10
- package/dist/chunk-IDG2XR5O.js.map +1 -0
- package/dist/{chunk-KS4I7KVC.js → chunk-JRTWTADT.js} +184 -123
- package/dist/chunk-JRTWTADT.js.map +1 -0
- package/dist/chunk-KG2Y44XT.js +1 -0
- package/dist/chunk-KG2Y44XT.js.map +1 -0
- package/dist/chunk-MM3GOLHO.js +3365 -0
- package/dist/chunk-MM3GOLHO.js.map +1 -0
- package/dist/chunk-N6URQ6DM.js +225 -0
- package/dist/chunk-N6URQ6DM.js.map +1 -0
- package/dist/{chunk-ISRPOPMM.js → chunk-ND5XWLRU.js} +21 -18
- package/dist/chunk-ND5XWLRU.js.map +1 -0
- package/dist/{chunk-IUVDR3KJ.js → chunk-NHVSO47Q.js} +2 -2
- package/dist/{chunk-FAXSYC2C.js → chunk-RZLCBWGG.js} +2 -2
- package/dist/{chunk-MRZP65DZ.js → chunk-SRWQCWLR.js} +14 -3
- package/dist/chunk-SRWQCWLR.js.map +1 -0
- package/dist/{chunk-JRW6LCIA.js → chunk-V6YGLAQC.js} +2 -2
- package/dist/{chunk-54YIL7WM.js → chunk-WPPDNS63.js} +4 -4
- package/dist/{chunk-CQZVJVME.js → chunk-YCMVNXAX.js} +2 -2
- package/dist/design-canvas/index.js +3 -3
- package/dist/openui/index.js +3 -3
- package/dist/operator/index.js +2 -2
- package/dist/platform/billable-turn-admission.d.ts +13 -9
- package/dist/platform/delegated-keys.d.ts +4 -3
- package/dist/platform/delegated-turn-keys.d.ts +17 -6
- package/dist/platform/index.js +80 -23
- package/dist/platform/index.js.map +1 -1
- package/dist/preset-cloudflare/index.d.ts +2 -0
- package/dist/preset-cloudflare/index.js +344 -0
- package/dist/preset-cloudflare/index.js.map +1 -1
- package/dist/preset-cloudflare/native-completion-owner.d.ts +90 -0
- package/dist/preset-cloudflare/native-completion-store.d.ts +56 -0
- package/dist/preset-cloudflare/native-completion-workflow.d.ts +10 -0
- package/dist/public-consultation/index.js +28 -7
- package/dist/public-consultation/index.js.map +1 -1
- package/dist/rollout/d1.d.ts +103 -3
- package/dist/rollout/d1.js +152 -5
- package/dist/rollout/d1.js.map +1 -1
- package/dist/runtime/index.js +3 -4
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/router-turn.d.ts +4 -0
- package/dist/runtime/router-turn.js +2 -3
- package/dist/sandbox/index.js +3 -4
- package/dist/sandbox/sandbox-run-tool.d.ts +5 -0
- package/dist/sequences/index.js +5 -5
- package/dist/signoff/cli.js +6 -1
- package/dist/signoff/cli.js.map +1 -1
- package/dist/signoff/config.d.ts +3 -1
- package/dist/signoff/index.d.ts +2 -1
- package/dist/signoff/index.js +3 -1
- package/dist/signoff/phases.d.ts +3 -0
- package/dist/signoff/proof.js +3 -0
- package/dist/signoff/proof.js.map +1 -1
- package/dist/signoff/run.d.ts +3 -1
- package/dist/signoff/types.d.ts +13 -0
- package/dist/skills-placement/box.js +5 -5
- package/dist/skills-placement/index.js +2 -2
- package/dist/tools/index.js +1 -1
- package/dist/turn-stream/adapters.d.ts +10 -4
- package/dist/turn-stream/index.js +33 -356
- package/dist/turn-stream/index.js.map +1 -1
- package/dist/turn-trace/index.d.ts +1 -0
- package/dist/turn-trace/index.js +4 -5
- package/dist/turn-trace/phase-timing.d.ts +20 -0
- package/dist/turn-trace/recorder.d.ts +3 -0
- package/dist/turn-trace/turn-facts.d.ts +17 -0
- package/dist/web-react/agent-profile-editor.js +1 -1
- package/dist/web-react/chat-stream.d.ts +0 -7
- package/dist/web-react/index.js +7 -9
- package/dist/work-product/index.js +7 -7
- package/package.json +1 -1
- package/dist/chat-routes/minted-thread.d.ts +0 -63
- package/dist/chunk-6R73V3Y5.js +0 -17
- package/dist/chunk-6R73V3Y5.js.map +0 -1
- package/dist/chunk-CCVWR33L.js +0 -99
- package/dist/chunk-CCVWR33L.js.map +0 -1
- package/dist/chunk-EFQUAWWF.js +0 -1749
- package/dist/chunk-EFQUAWWF.js.map +0 -1
- package/dist/chunk-G7M2C72Q.js.map +0 -1
- package/dist/chunk-GIEUZBQQ.js.map +0 -1
- package/dist/chunk-ISRPOPMM.js.map +0 -1
- package/dist/chunk-KS4I7KVC.js.map +0 -1
- package/dist/chunk-MRZP65DZ.js.map +0 -1
- package/dist/chunk-PCAY23GS.js.map +0 -1
- package/dist/chunk-UW2DKTEM.js.map +0 -1
- package/dist/chunk-VK3F4N4U.js +0 -133
- package/dist/chunk-VK3F4N4U.js.map +0 -1
- /package/dist/{chunk-4P5NFBWX.js.map → chunk-BI5AZAOO.js.map} +0 -0
- /package/dist/{chunk-IUVDR3KJ.js.map → chunk-NHVSO47Q.js.map} +0 -0
- /package/dist/{chunk-FAXSYC2C.js.map → chunk-RZLCBWGG.js.map} +0 -0
- /package/dist/{chunk-JRW6LCIA.js.map → chunk-V6YGLAQC.js.map} +0 -0
- /package/dist/{chunk-54YIL7WM.js.map → chunk-WPPDNS63.js.map} +0 -0
- /package/dist/{chunk-CQZVJVME.js.map → chunk-YCMVNXAX.js.map} +0 -0
package/README.md
CHANGED
|
@@ -238,7 +238,7 @@ measure request to the first reasoning, tool activity or answer output. First an
|
|
|
238
238
|
Chat routes mark both automatically; lifecycle timings start at `onTurnStart` after
|
|
239
239
|
admission. See [turn timing and rollout migration](docs/turn-trace.md#the-trace).
|
|
240
240
|
|
|
241
|
-
|
|
241
|
+
An `afterAuthorize` hook can return `{ resource, dispose }` for work started before the lock and profile pin. The route passes that promise as `args.earlyResource` and owns disposal after the producer finishes or admission refuses, including resources that arrive after refusal. Router descriptors dispatch early by default; tools wait for final admission. The legacy release callback remains available for product-owned lifetimes.
|
|
242
242
|
|
|
243
243
|
`/router-turn` compresses bodies of at least 32 KiB when the base URL has the
|
|
244
244
|
origin of `DEFAULT_TANGLE_ROUTER_BASE_URL`. Other origins stay uncompressed.
|
|
@@ -100,7 +100,8 @@ export interface ProfileRevisionStore {
|
|
|
100
100
|
appendKnowledgeEvent(event: ProfileKnowledgeEvent): Promise<void>;
|
|
101
101
|
}
|
|
102
102
|
export declare class ProfileConflictError extends Error {
|
|
103
|
-
|
|
103
|
+
readonly code?: 'profile_changed' | undefined;
|
|
104
|
+
constructor(message: string, code?: 'profile_changed' | undefined);
|
|
104
105
|
}
|
|
105
106
|
export declare class ProfileAccessError extends Error {
|
|
106
107
|
constructor(message: string);
|
|
@@ -233,6 +234,8 @@ export declare function admitProfileTurn(input: {
|
|
|
233
234
|
key: ProfileBindingKey;
|
|
234
235
|
messageId: string;
|
|
235
236
|
content: string;
|
|
237
|
+
/** The revision whose prompt this request already dispatched; a different pin is refused before use or write. */
|
|
238
|
+
expectedRevisionId?: string;
|
|
236
239
|
/** Effective ADC plan digest selected by the executor for this revision and turn. */
|
|
237
240
|
observedManagedPlanDigest: string;
|
|
238
241
|
/** Required if trusted per-turn attachments change the public profile plan. */
|
package/dist/app-auth/index.js
CHANGED
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
createAuthGuard,
|
|
3
3
|
createBetterAuthSessionCookieMinter,
|
|
4
4
|
createTangleSsoHandlers
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-BI5AZAOO.js";
|
|
6
6
|
import {
|
|
7
7
|
noticeEmail
|
|
8
8
|
} from "../chunk-WOTWQ2ST.js";
|
|
9
|
-
import "../chunk-D6UJEOZQ.js";
|
|
10
9
|
import "../chunk-CQGEGPY7.js";
|
|
11
10
|
import "../chunk-RN4WPTBH.js";
|
|
12
11
|
import "../chunk-WP2GYFZ4.js";
|
|
12
|
+
import "../chunk-D6UJEOZQ.js";
|
|
13
13
|
import "../chunk-TXD5HXLE.js";
|
|
14
14
|
import "../chunk-6Z7TZVKZ.js";
|
|
15
15
|
import "../chunk-57XPEL7X.js";
|
package/dist/assistant/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ReasoningRow,
|
|
3
3
|
chatToolCallPart
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-4CALWPN5.js";
|
|
5
5
|
import "../chunk-3HUFJ5LO.js";
|
|
6
6
|
import "../chunk-UHSUY6H6.js";
|
|
7
7
|
import "../chunk-7PULOECS.js";
|
|
@@ -9,7 +9,7 @@ import "../chunk-ZOS3D26Z.js";
|
|
|
9
9
|
import "../chunk-Y6PRDUFJ.js";
|
|
10
10
|
import {
|
|
11
11
|
ChatComposer
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-V6YGLAQC.js";
|
|
13
13
|
import "../chunk-L7MB2LLM.js";
|
|
14
14
|
import "../chunk-6ZVSMA4T.js";
|
|
15
15
|
import "../chunk-2HQP2CTA.js";
|
|
@@ -30,16 +30,16 @@ import {
|
|
|
30
30
|
AsyncView
|
|
31
31
|
} from "../chunk-AVP5SNIG.js";
|
|
32
32
|
import "../chunk-FQYAJYPW.js";
|
|
33
|
-
import "../chunk-
|
|
33
|
+
import "../chunk-NHVSO47Q.js";
|
|
34
34
|
import "../chunk-B7CL7ENS.js";
|
|
35
|
-
import "../chunk-
|
|
36
|
-
import "../chunk-FAXSYC2C.js";
|
|
35
|
+
import "../chunk-RZLCBWGG.js";
|
|
37
36
|
import "../chunk-ZVEEWGDK.js";
|
|
38
|
-
import "../chunk-
|
|
37
|
+
import "../chunk-5TSRFF5W.js";
|
|
39
38
|
import "../chunk-VUBJZEZB.js";
|
|
40
39
|
import "../chunk-6VQCFJWP.js";
|
|
41
|
-
import "../chunk-
|
|
40
|
+
import "../chunk-AMUXRAUO.js";
|
|
42
41
|
import "../chunk-PV33JZKV.js";
|
|
42
|
+
import "../chunk-ELX5YITO.js";
|
|
43
43
|
import "../chunk-TXD5HXLE.js";
|
|
44
44
|
import "../chunk-WL7PZK7Q.js";
|
|
45
45
|
|
package/dist/chat-react/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ComposerModeControls,
|
|
3
3
|
EntryComposer
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-V6YGLAQC.js";
|
|
5
5
|
import "../chunk-L7MB2LLM.js";
|
|
6
6
|
import "../chunk-2HQP2CTA.js";
|
|
7
7
|
import "../chunk-SJWIZT7B.js";
|
|
@@ -10,9 +10,9 @@ import "../chunk-X6SZGQTK.js";
|
|
|
10
10
|
import "../chunk-52SDU43B.js";
|
|
11
11
|
import "../chunk-ZAMHLXNS.js";
|
|
12
12
|
import "../chunk-RASGKEAL.js";
|
|
13
|
-
import "../chunk-
|
|
13
|
+
import "../chunk-NHVSO47Q.js";
|
|
14
|
+
import "../chunk-5TSRFF5W.js";
|
|
14
15
|
import "../chunk-AMUXRAUO.js";
|
|
15
|
-
import "../chunk-G7M2C72Q.js";
|
|
16
16
|
import "../chunk-ELX5YITO.js";
|
|
17
17
|
import "../chunk-TXD5HXLE.js";
|
|
18
18
|
export {
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { ChatRouteEvent, ChatTurnProduceArgs, CreateChatTurnRoutesOptions } from './turn-route-contracts';
|
|
2
|
+
export interface ChatTurnCancelRequest extends Record<string, unknown> {
|
|
3
|
+
threadId: string;
|
|
4
|
+
turnId: string;
|
|
5
|
+
cancellationToken?: string;
|
|
6
|
+
}
|
|
7
|
+
/** Product identity and editor access have already been checked before target is called. */
|
|
8
|
+
export interface ChatTurnCancelArgs<TContext> {
|
|
9
|
+
request: Request;
|
|
10
|
+
body: ChatTurnCancelRequest;
|
|
11
|
+
tenantId: string;
|
|
12
|
+
userId: string;
|
|
13
|
+
context?: TContext;
|
|
14
|
+
/** Supplied only by the execution owner after admission; never copied from a request body. */
|
|
15
|
+
messageId?: string;
|
|
16
|
+
}
|
|
17
|
+
/** Structural public Sandbox API; addressing always comes from the captured receipt. */
|
|
18
|
+
export interface ChatTurnCancelSource {
|
|
19
|
+
id: string;
|
|
20
|
+
session(id: string): {
|
|
21
|
+
interrupt(input: {
|
|
22
|
+
executionId: string;
|
|
23
|
+
}): Promise<{
|
|
24
|
+
cancelled: boolean;
|
|
25
|
+
}>;
|
|
26
|
+
status(): Promise<{
|
|
27
|
+
id: string;
|
|
28
|
+
status?: string;
|
|
29
|
+
activeExecutionId?: string | null;
|
|
30
|
+
} | null>;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** Application fields are projected once; the shared owner never infers OAuth or source-key authority. */
|
|
34
|
+
export interface ChatTurnCancelTarget {
|
|
35
|
+
capturedMetadata: Record<string, unknown>;
|
|
36
|
+
status: string | undefined;
|
|
37
|
+
dispatchToken?: string;
|
|
38
|
+
requiresDispatchToken: boolean;
|
|
39
|
+
native?: {
|
|
40
|
+
state: string | undefined;
|
|
41
|
+
sandboxId?: string;
|
|
42
|
+
sessionId?: string;
|
|
43
|
+
executionId?: string;
|
|
44
|
+
/** Resolve the original authorized box only after the dispatch token and receipt are validated. */
|
|
45
|
+
source(): Promise<ChatTurnCancelSource | null>;
|
|
46
|
+
};
|
|
47
|
+
/** Compare the WHOLE captured record atomically, then merge the stopped fields. False changes nothing. */
|
|
48
|
+
markStopped(capturedMetadata: Record<string, unknown>, stoppedAt: string): Promise<boolean>;
|
|
49
|
+
}
|
|
50
|
+
export interface ChatTurnCancelOptions<TContext> {
|
|
51
|
+
target(args: ChatTurnCancelArgs<TContext>): Promise<ChatTurnCancelTarget | Response>;
|
|
52
|
+
}
|
|
53
|
+
/** Existing product Stop, composed with the same authorization and storage owner as chat. */
|
|
54
|
+
export declare function cancelChatTurn<TContext>(request: Request, options: {
|
|
55
|
+
authorize: CreateChatTurnRoutesOptions<TContext>['authorize'];
|
|
56
|
+
cancel?: ChatTurnCancelOptions<TContext>;
|
|
57
|
+
log?: (message: string, meta?: Record<string, unknown>) => void;
|
|
58
|
+
}): Promise<Response>;
|
|
59
|
+
/** Internal route observation of the same product Stop target. This reads only;
|
|
60
|
+
* native interruption and metadata writes remain exclusive to cancelChatTurn. */
|
|
61
|
+
export declare function observeTurnCancellation<TContext, TResource>(source: AsyncIterable<ChatRouteEvent>, args: ChatTurnProduceArgs<TContext, TResource>, cancel: ChatTurnCancelOptions<TContext>, abort: AbortController): AsyncGenerator<ChatRouteEvent, void, unknown>;
|
|
@@ -1,24 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* commits; a refusal aborts the producer and drops what it emitted.
|
|
7
|
-
*
|
|
8
|
-
* Why: on Creative production (2026-10-21, gemini-3.7-flash, n=32 Router
|
|
9
|
-
* turns) the chain between `authorize` and the producer held about 780 ms of
|
|
10
|
-
* every turn's p50 (admission 343, profile pin 338, turn open 99) before the
|
|
11
|
-
* model was even called. The model's own first token takes 2.5-3.6 s, so that
|
|
12
|
-
* work fits inside it.
|
|
13
|
-
*
|
|
14
|
-
* What stays fail-closed: `authorize` has already run, so no model call starts
|
|
15
|
-
* for a caller without identity and workspace access. Billing is enforced in
|
|
16
|
-
* `authorize` or at the model service, which holds spend before it calls the
|
|
17
|
-
* provider; the product names which (`dispatchFirst: { billing }`). Gates the
|
|
18
|
-
* model service cannot know, such as a seat, run in `contextGate` beside the
|
|
19
|
-
* model call, and the output waits for them. Single-flight is unchanged: the lock still decides which turn's output is
|
|
20
|
-
* kept; a refused duplicate costs only the model call it started, which its
|
|
21
|
-
* `admissionSignal` cancels.
|
|
1
|
+
/** Router calls overlap the lock, history recheck, user insert and gates.
|
|
2
|
+
* authorize already verified identity/access; the model service enforces spend.
|
|
3
|
+
* Events remain buffered until admission commits. Refusal cancels the call and
|
|
4
|
+
* drops its output; tools and durable effects must wait for args.admitted.
|
|
5
|
+
* Ordinary functions and Sandbox backends never execute speculatively.
|
|
22
6
|
*/
|
|
23
7
|
import type { TurnTrace } from '../turn-trace/recorder';
|
|
24
8
|
import type { ChatTurnProduceArgs, ChatTurnRouteProducer, CreateChatTurnRoutesOptions } from './turn-route-contracts';
|
|
@@ -26,11 +10,16 @@ import type { ChatTurnProduceArgs, ChatTurnRouteProducer, CreateChatTurnRoutesOp
|
|
|
26
10
|
export declare class TurnAdmissionRefusedError extends Error {
|
|
27
11
|
constructor();
|
|
28
12
|
}
|
|
29
|
-
export interface DispatchedProducer<TContext> {
|
|
13
|
+
export interface DispatchedProducer<TContext, TResource = unknown> {
|
|
30
14
|
/** The admission chain committed: hand the producer its final args and return it, with what it already emitted first. */
|
|
31
|
-
take(args: ChatTurnProduceArgs<TContext>): Promise<ChatTurnRouteProducer>;
|
|
15
|
+
take(args: ChatTurnProduceArgs<TContext, TResource>): Promise<ChatTurnRouteProducer>;
|
|
32
16
|
/** The turn ended without the producer: abort it and discard its output. Idempotent; a no-op after `take`. */
|
|
33
17
|
refuse(): void;
|
|
34
18
|
}
|
|
35
|
-
/**
|
|
36
|
-
export declare function
|
|
19
|
+
/** Select once, so admission's context mutations cannot switch execution backends. */
|
|
20
|
+
export declare function selectTurnProducer<TContext, TResource = unknown>(produce: CreateChatTurnRoutesOptions<TContext, TResource>['produce'], args: ChatTurnProduceArgs<TContext, TResource>): {
|
|
21
|
+
produce: (args: ChatTurnProduceArgs<TContext, TResource>) => ChatTurnRouteProducer | Promise<ChatTurnRouteProducer>;
|
|
22
|
+
router: boolean;
|
|
23
|
+
};
|
|
24
|
+
/** A reused user row must pass duplicate/refusal checks before another model call. */
|
|
25
|
+
export declare function dispatchFirstFor<TContext, TResource = unknown>(selected: ReturnType<typeof selectTurnProducer<TContext, TResource>>, args: ChatTurnProduceArgs<TContext, TResource>, trace: TurnTrace): DispatchedProducer<TContext, TResource> | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Request-owned speculative work: legacy release callbacks and opaque resource lifetimes. */
|
|
2
|
+
import type { ChatTurnAfterAuthorizeRelease } from './turn-route-contracts';
|
|
3
|
+
export interface AfterAuthorizeWork<TResource = unknown> {
|
|
4
|
+
resource?: Promise<TResource>;
|
|
5
|
+
handOff(): void;
|
|
6
|
+
release(): Promise<void>;
|
|
7
|
+
settle(): Promise<void>;
|
|
8
|
+
add(release: () => void): void;
|
|
9
|
+
}
|
|
10
|
+
export declare function earlyTurnWork<TResource>(started: ChatTurnAfterAuthorizeRelease<TResource> | undefined, log: (message: string, meta?: Record<string, unknown>) => void): AfterAuthorizeWork<TResource>;
|
|
@@ -30,6 +30,8 @@
|
|
|
30
30
|
*
|
|
31
31
|
* The trace passes through: model calls, tool calls, the box claim and the box
|
|
32
32
|
* run are recorded under the turn's `trace` when the route gives one.
|
|
33
|
+
* A typed computer failure also emits a persisted warning; the Router keeps
|
|
34
|
+
* answering without relying on the model to explain that failure faithfully.
|
|
33
35
|
*/
|
|
34
36
|
import type { SandboxInstance } from '@tangle-network/sandbox';
|
|
35
37
|
import type { RouterTurnTool } from '../runtime/router-turn';
|
|
@@ -56,6 +58,8 @@ export interface HybridTurnBox {
|
|
|
56
58
|
/** The tool's name and description. Default `sandbox_run` and its shared description. */
|
|
57
59
|
name?: string;
|
|
58
60
|
description?: string;
|
|
61
|
+
/** Dispose this turn's opaque client credentials/resources after any started acquire settles. Never retire the box. */
|
|
62
|
+
dispose?(): Promise<void> | void;
|
|
59
63
|
}
|
|
60
64
|
export interface HybridTurnProducerOptions extends RouterTurnProducerOptions {
|
|
61
65
|
/** The app's in-process tools. `sandbox_run` is added after them. */
|
|
@@ -69,9 +73,6 @@ export interface HybridTurnProducerOptions extends RouterTurnProducerOptions {
|
|
|
69
73
|
onSpeculate?(hint: EscalationHint): void;
|
|
70
74
|
/** Appended to `systemPrompt`. Default {@link HYBRID_TURN_GUIDANCE}; `false` when the prompt already says it. */
|
|
71
75
|
guidance?: string | false;
|
|
72
|
-
/** Runs once when the turn's stream ends, however it ends (revoke a per-turn key, close a key scope). Its
|
|
73
|
-
* failure is logged, never thrown to the route. */
|
|
74
|
-
onSettled?(): Promise<void> | void;
|
|
75
76
|
}
|
|
76
77
|
/**
|
|
77
78
|
* Start the box at admission when the request asks for execution, so its resume overlaps the turn lock and the
|
|
@@ -10,7 +10,6 @@ export * from './wire';
|
|
|
10
10
|
export * from './binary-sniff';
|
|
11
11
|
export * from './attachment-validation';
|
|
12
12
|
export * from './turn-routes';
|
|
13
|
-
export type { ChatTurnCreateThreadOptions, ChatTurnCreateThreadResult, ChatTurnNewThread, ChatTurnThreadOwner } from './minted-thread';
|
|
14
13
|
export type { ChatTurnPrefetch, ChatTurnPrefetchArgs, ChatTurnPrefetchIdentity } from './turn-prefetch';
|
|
15
14
|
export * from './turn-progress';
|
|
16
15
|
export * from './gateway-adapter';
|
|
@@ -24,6 +23,7 @@ export * from './draft-persistence';
|
|
|
24
23
|
export * from './detached-turn';
|
|
25
24
|
export { type CompletedSandboxTurnSource, type ReadCompletedSandboxTurnOptions, readCompletedSandboxTurn, recoverSandboxAssistantMessage, } from './completed-sandbox-turn';
|
|
26
25
|
export * from './native-completion';
|
|
26
|
+
export type { NativeTurnTimingFacts, NativeCompletionHandoffOptions } from './native-turn-timing';
|
|
27
27
|
export * from './plan-follow-up';
|
|
28
28
|
export * from './durable-projection';
|
|
29
29
|
export * from './upload';
|
|
@@ -34,4 +34,5 @@ export * from './attachment-upload';
|
|
|
34
34
|
export * from './dispatch-parts';
|
|
35
35
|
export * from './promote-file-part';
|
|
36
36
|
export * from './intelligence';
|
|
37
|
+
export * from './cancellation';
|
|
37
38
|
export * from './stored-attachments';
|