@tangle-network/agent-app 0.63.29 → 0.63.30
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/default-backend.d.ts +19 -2
- package/dist/chat-routes/hybrid-producer.d.ts +7 -2
- package/dist/chat-routes/index.js +3 -3
- package/dist/chat-routes/route-storage.d.ts +1 -1
- package/dist/chat-routes/router-producer.d.ts +2 -1
- package/dist/chat-routes/turn-route-contracts.d.ts +1 -1
- package/dist/{chunk-56JUV4DK.js → chunk-5AUZR655.js} +3335 -3020
- package/dist/chunk-5AUZR655.js.map +1 -0
- package/dist/{chunk-QUT3T2IN.js → chunk-L3QR274L.js} +11 -3
- package/dist/chunk-L3QR274L.js.map +1 -0
- package/dist/{chunk-DCJCZ7EP.js → chunk-QLZ6A73E.js} +37 -19
- package/dist/chunk-QLZ6A73E.js.map +1 -0
- package/dist/model-resolution/index.js +1 -1
- package/dist/public-consultation/index.js +3 -3
- package/dist/sandbox/computer-files.d.ts +67 -0
- package/dist/sandbox/computer-receipts.d.ts +46 -0
- package/dist/sandbox/computer-step.d.ts +78 -0
- package/dist/sandbox/index.d.ts +4 -0
- package/dist/sandbox/index.js +23 -1
- package/dist/sandbox/router-models.d.ts +26 -0
- package/dist/sandbox/sandbox-run-tool.d.ts +5 -4
- package/package.json +1 -1
- package/dist/chunk-56JUV4DK.js.map +0 -1
- package/dist/chunk-DCJCZ7EP.js.map +0 -1
- package/dist/chunk-QUT3T2IN.js.map +0 -1
|
@@ -4,6 +4,11 @@ import { type StreamSandboxPromptOptions } from '../sandbox/prompt-options';
|
|
|
4
4
|
import type { ChatTurnStoreBindings } from './route-storage';
|
|
5
5
|
import { type ModelPolicy } from '../policy-filters/index';
|
|
6
6
|
import type { ChatTurnProduceArgs, ChatTurnHybridConfiguration } from './turn-route-contracts';
|
|
7
|
+
import type { RouterTurnTool } from '../runtime/router-turn';
|
|
8
|
+
import type { RouterTurnKey } from './router-producer';
|
|
9
|
+
import type { ComputerVault } from '../sandbox/computer-files';
|
|
10
|
+
import type { ComputerStepReceipts } from '../sandbox/computer-receipts';
|
|
11
|
+
import type { Outcome } from '../sandbox/outcome';
|
|
7
12
|
/** Worker bindings are explicit; no ambient deployment credentials replace product policy. */
|
|
8
13
|
export interface ChatTurnEnvironment {
|
|
9
14
|
DB?: ChatTurnStoreBindings['db'];
|
|
@@ -18,7 +23,7 @@ export interface ChatTurnEnvironment {
|
|
|
18
23
|
SANDBOX_GATEWAY_URL?: string;
|
|
19
24
|
}
|
|
20
25
|
/** Domain data for the default lane, instead of constructing producers or admission hooks. */
|
|
21
|
-
export interface ChatTurnDefaultBackend {
|
|
26
|
+
export interface ChatTurnDefaultBackend<TContext = unknown, TResource = unknown> {
|
|
22
27
|
model?: string;
|
|
23
28
|
systemPrompt?: string;
|
|
24
29
|
harness?: Harness;
|
|
@@ -28,9 +33,21 @@ export interface ChatTurnDefaultBackend {
|
|
|
28
33
|
shell?: SandboxRuntimeConfig;
|
|
29
34
|
/** Explicitly keep every turn on the sandbox lane. */
|
|
30
35
|
router?: false;
|
|
36
|
+
/** Who pays for the Router model call: the turn's key, or a per-turn lease (`createDelegatedTurnKeys`) the
|
|
37
|
+
* producer revokes when the turn settles. Default `TANGLE_API_KEY`. Started before the turn lock, like the call. */
|
|
38
|
+
funding?(args: ChatTurnProduceArgs<TContext, TResource>): RouterTurnKey | Promise<RouterTurnKey>;
|
|
39
|
+
/** The product's in-process tools for the Router model; `sandbox_run` is added after them. */
|
|
40
|
+
tools?(args: ChatTurnProduceArgs<TContext, TResource>): RouterTurnTool[] | Promise<RouterTurnTool[]>;
|
|
41
|
+
/** What the computer step does beyond running the task: copy its files into the product's Vault, keep durable
|
|
42
|
+
* receipts, and run a model the box key allows (`readSandboxRouterModels` with the payer's key). */
|
|
43
|
+
computer?: {
|
|
44
|
+
files?(args: ChatTurnProduceArgs<TContext, TResource>): ComputerVault | undefined;
|
|
45
|
+
receipts?: ComputerStepReceipts;
|
|
46
|
+
allowedModels?(args: ChatTurnProduceArgs<TContext, TResource>, signal: AbortSignal): Promise<Outcome<readonly string[] | null>>;
|
|
47
|
+
};
|
|
31
48
|
}
|
|
32
49
|
export declare function defaultChatShell(projectId: string, env: ChatTurnEnvironment, config: ChatTurnDefaultBackend): SandboxRuntimeConfig;
|
|
33
|
-
export declare function createDefaultChatBackend<TContext, TResource>(projectId: string, env: ChatTurnEnvironment, config: ChatTurnDefaultBackend, bindings?: ChatTurnStoreBindings, modelPolicy?: ModelPolicy): {
|
|
50
|
+
export declare function createDefaultChatBackend<TContext, TResource>(projectId: string, env: ChatTurnEnvironment, config: ChatTurnDefaultBackend<TContext, TResource>, bindings?: ChatTurnStoreBindings, modelPolicy?: ModelPolicy): {
|
|
34
51
|
when: (args: ChatTurnProduceArgs<TContext, TResource>) => boolean;
|
|
35
52
|
router(args: ChatTurnProduceArgs<TContext, TResource>): Promise<ChatTurnHybridConfiguration>;
|
|
36
53
|
sandbox: (args: ChatTurnProduceArgs<TContext, TResource>) => Promise<{
|
|
@@ -39,6 +39,7 @@ import type { SandboxInstance } from '@tangle-network/sandbox';
|
|
|
39
39
|
import type { RouterTurnTool } from '../runtime/router-turn';
|
|
40
40
|
import { type EscalationHint, type EscalationInput } from '../sandbox/escalation-speculator';
|
|
41
41
|
import { type SandboxRunToolOptions } from '../sandbox/sandbox-run-tool';
|
|
42
|
+
import { type ComputerStepOptions } from '../sandbox/computer-step';
|
|
42
43
|
import type { PersistedChatMessageForTurn } from '../stream/index';
|
|
43
44
|
import { type RouterTurnProducerOptions } from './router-producer';
|
|
44
45
|
import type { ChatTurnRouteProducer } from './turn-routes';
|
|
@@ -51,8 +52,12 @@ export interface HybridTurnBox {
|
|
|
51
52
|
acquire(signal: AbortSignal): Promise<SandboxInstance>;
|
|
52
53
|
/** A start admission already began ({@link startHybridBox}); the producer takes it as the turn's start. */
|
|
53
54
|
started?: Promise<SandboxInstance>;
|
|
54
|
-
/** Runs the task on the box and returns its answer
|
|
55
|
-
runTask
|
|
55
|
+
/** Runs the task on the box and returns its answer. Omit it and pass `computer` for agent-app's computer step. */
|
|
56
|
+
runTask?: SandboxRunToolOptions['runTask'];
|
|
57
|
+
/** agent-app's computer step ({@link createComputerStep}): the first of the turn's models the box key allows, one
|
|
58
|
+
* session value, stable step ids, durable receipts and the copy of the step's files into the product's Vault.
|
|
59
|
+
* `parentExecutionId` defaults to the turn's execution id on the chat route, else the trace id. */
|
|
60
|
+
computer?: ComputerStepOptions;
|
|
56
61
|
/** Wall-clock cap for one `sandbox_run` call, box start included. Default 4 minutes. */
|
|
57
62
|
timeoutMs?: number;
|
|
58
63
|
warm?: SandboxRunToolOptions['warm'];
|
|
@@ -79,7 +79,7 @@ import {
|
|
|
79
79
|
turnCarriesFiles,
|
|
80
80
|
turnPromptText,
|
|
81
81
|
withProducerStream
|
|
82
|
-
} from "../chunk-
|
|
82
|
+
} from "../chunk-QLZ6A73E.js";
|
|
83
83
|
import "../chunk-CWO2LHXH.js";
|
|
84
84
|
import {
|
|
85
85
|
sniffMimeFromName
|
|
@@ -87,7 +87,7 @@ import {
|
|
|
87
87
|
import "../chunk-4DBHC63F.js";
|
|
88
88
|
import "../chunk-RN4WPTBH.js";
|
|
89
89
|
import "../chunk-MM6RLOXF.js";
|
|
90
|
-
import "../chunk-
|
|
90
|
+
import "../chunk-5AUZR655.js";
|
|
91
91
|
import "../chunk-F4TUZYMX.js";
|
|
92
92
|
import {
|
|
93
93
|
redactErrorMessage
|
|
@@ -156,7 +156,7 @@ import {
|
|
|
156
156
|
turnResponseEventFor,
|
|
157
157
|
validateSandboxMentionPath
|
|
158
158
|
} from "../chunk-QGJOT6R6.js";
|
|
159
|
-
import "../chunk-
|
|
159
|
+
import "../chunk-L3QR274L.js";
|
|
160
160
|
import "../chunk-XELWWXJJ.js";
|
|
161
161
|
import "../chunk-DSMGS4IV.js";
|
|
162
162
|
import "../chunk-ACB7KOQ6.js";
|
|
@@ -24,7 +24,7 @@ export declare function createDefaultTurnLock<TContext>(store: Pick<ChatTurnStor
|
|
|
24
24
|
export type ResolvedChatTurnRoutesOptions<TContext, TResource = unknown> = Omit<CreateChatTurnRoutesOptions<TContext, TResource>, 'turnStore' | 'turnLock' | 'produce'> & {
|
|
25
25
|
turnStore: TurnEventStore;
|
|
26
26
|
turnLock?: Exclude<CreateChatTurnRoutesOptions<TContext, TResource>['turnLock'], false>;
|
|
27
|
-
produce: Exclude<CreateChatTurnRoutesOptions<TContext, TResource>['produce'], undefined | import('./default-backend').ChatTurnDefaultBackend
|
|
27
|
+
produce: Exclude<CreateChatTurnRoutesOptions<TContext, TResource>['produce'], undefined | import('./default-backend').ChatTurnDefaultBackend<TContext, TResource>>;
|
|
28
28
|
};
|
|
29
29
|
export declare function turnStorageBindings(options: {
|
|
30
30
|
turnStore: TurnEventStore | ChatTurnStoreBindings;
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
import { composeRouterTurnPromptSections, type RouterTurnEvent, type RouterTurnFailure, type RouterTurnOptions, type RouterTurnOutcome, type RouterTurnPromptOptions } from '../runtime/router-turn';
|
|
12
12
|
import type { ChatTurnRouteProducer } from './turn-routes';
|
|
13
13
|
import type { ProducerWireEvent } from './wire';
|
|
14
|
-
|
|
14
|
+
/** The turn's model key: a plain key, or a per-turn lease whose fetch and revocation belong to the producer. */
|
|
15
|
+
export type RouterTurnKey = string | {
|
|
15
16
|
key: string;
|
|
16
17
|
fetchImpl?: typeof fetch;
|
|
17
18
|
revoke(): Promise<void>;
|
|
@@ -604,7 +604,7 @@ export interface CreateChatTurnRoutesOptions<TContext = void, TResource = unknow
|
|
|
604
604
|
* when selects the Router backend (default true); false selects sandbox,
|
|
605
605
|
* which always starts after admission. A function also starts after admission.
|
|
606
606
|
* Reused user rows always finish admission before either backend starts. */
|
|
607
|
-
produce?: import('./default-backend').ChatTurnDefaultBackend | ((args: ChatTurnProduceArgs<TContext, TResource>) => ChatTurnRouteProducer | Promise<ChatTurnRouteProducer>) | {
|
|
607
|
+
produce?: import('./default-backend').ChatTurnDefaultBackend<TContext, TResource> | ((args: ChatTurnProduceArgs<TContext, TResource>) => ChatTurnRouteProducer | Promise<ChatTurnRouteProducer>) | {
|
|
608
608
|
router(args: ChatTurnProduceArgs<TContext, TResource>): ChatTurnRouterBackend | Promise<ChatTurnRouterBackend>;
|
|
609
609
|
when?(args: ChatTurnProduceArgs<TContext, TResource>): boolean;
|
|
610
610
|
sandbox?(args: ChatTurnProduceArgs<TContext, TResource>): ChatTurnSandboxBackend | Promise<ChatTurnSandboxBackend>;
|