@tangle-network/agent-runtime 0.94.10 → 0.94.12
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 +65 -1
- package/dist/agent.d.ts +2 -1
- package/dist/agent.js +2 -1
- package/dist/agent.js.map +1 -1
- package/dist/{agentic-generator-1g7GDba7.d.ts → agentic-generator-DDMM45kZ.d.ts} +46 -6
- package/dist/analyst-loop.d.ts +2 -1
- package/dist/backends-BO4Jqoe2.d.ts +134 -0
- package/dist/chunk-AEG3NGJ2.js +639 -0
- package/dist/chunk-AEG3NGJ2.js.map +1 -0
- package/dist/{chunk-GHXW56PO.js → chunk-D3H7F6L2.js} +136 -36
- package/dist/chunk-D3H7F6L2.js.map +1 -0
- package/dist/{chunk-7NCP74SL.js → chunk-PCURO3DL.js} +4 -4
- package/dist/chunk-PCURO3DL.js.map +1 -0
- package/dist/{chunk-YP6B7RZ2.js → chunk-U33YZ7B2.js} +6 -635
- package/dist/chunk-U33YZ7B2.js.map +1 -0
- package/dist/chunk-VYA2YEKA.js +1187 -0
- package/dist/chunk-VYA2YEKA.js.map +1 -0
- package/dist/{chunk-MXBQNVFE.js → chunk-XP5KDM3R.js} +5 -5
- package/dist/{completion-gate-BB4IZwyh.d.ts → completion-gate-D1gX1-hg.d.ts} +2 -2
- package/dist/conversation.d.ts +793 -0
- package/dist/conversation.js +56 -0
- package/dist/conversation.js.map +1 -0
- package/dist/{coordination-CyVQ61My.d.ts → coordination-Dr_axlAf.d.ts} +6 -5
- package/dist/environment-provider.d.ts +3 -2
- package/dist/{improve-DZeatcs7.d.ts → improve-BN3HyXIO.d.ts} +2 -2
- package/dist/index.d.ts +29 -943
- package/dist/index.js +58 -1159
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +6 -5
- package/dist/intelligence.js +5 -5
- package/dist/knowledge.d.ts +8 -7
- package/dist/lifecycle.d.ts +3 -3
- package/dist/lifecycle.js +1 -1
- package/dist/{local-harness-ZLMkKdZc.d.ts → local-harness-ZqCx51u7.d.ts} +1 -1
- package/dist/{loop-runner-bin-DA3ccCAs.d.ts → loop-runner-bin-BRQSQdHa.d.ts} +2 -2
- package/dist/loop-runner-bin.d.ts +7 -6
- package/dist/loop-runner-bin.js +4 -3
- package/dist/loops.d.ts +16 -15
- package/dist/loops.js +2 -1
- package/dist/mcp/index.d.ts +11 -10
- package/dist/mcp/index.js +2 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/{mcp-serve-verifier-BO4MEsR3.d.ts → mcp-serve-verifier-DQQDbuyz.d.ts} +1 -1
- package/dist/{openai-tools-0wACz8f8.d.ts → openai-tools-fnj6SRVg.d.ts} +1 -1
- package/dist/primeintellect/index.d.ts +214 -0
- package/dist/primeintellect/index.js +1120 -0
- package/dist/primeintellect/index.js.map +1 -0
- package/dist/profiles.d.ts +2 -1
- package/dist/{sanitize-Dcbjp0tU.d.ts → sanitize-BTSsdBXw.d.ts} +1 -1
- package/dist/{supervise-BaEsCHNh.d.ts → supervise-DmYOug5f.d.ts} +4 -4
- package/dist/{types-CogNCaw7.d.ts → types-1d5QGK3t.d.ts} +1 -1
- package/dist/types-BwoZWq-i.d.ts +510 -0
- package/dist/{types-CKmyZ9TP.d.ts → types-ByAYqlVb.d.ts} +3 -509
- package/dist/{worktree-fanout-Do2YbtFD.d.ts → worktree-fanout-CPprU-qI.d.ts} +4 -4
- package/package.json +15 -3
- package/dist/chunk-7NCP74SL.js.map +0 -1
- package/dist/chunk-GHXW56PO.js.map +0 -1
- package/dist/chunk-YP6B7RZ2.js.map +0 -1
- /package/dist/{chunk-MXBQNVFE.js.map → chunk-XP5KDM3R.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AnalystFinding,
|
|
1
|
+
import { AnalystFinding, CostLedgerHandle, MaximumCharge } from '@tangle-network/agent-eval';
|
|
2
2
|
import { AgentProfile, ReasoningEffort } from '@tangle-network/agent-interface';
|
|
3
|
-
import { L as LocalHarness, C as CodexTokenUsage, a as CodexExecutionEvidence, r as runLocalHarness } from './local-harness-
|
|
3
|
+
import { L as LocalHarness, C as CodexTokenUsage, a as CodexExecutionEvidence, b as LocalHarnessResult, r as runLocalHarness } from './local-harness-ZqCx51u7.js';
|
|
4
4
|
import { LabeledScenarioStore, WorktreeAdapter, SurfaceProposer } from '@tangle-network/agent-eval/campaign';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -59,7 +59,7 @@ interface CandidateGenerator {
|
|
|
59
59
|
generation?: number;
|
|
60
60
|
candidateIndex?: number;
|
|
61
61
|
/** Shared run-wide paid-call account supplied by agent-eval 0.117+. */
|
|
62
|
-
costLedger?:
|
|
62
|
+
costLedger?: CostLedgerHandle;
|
|
63
63
|
/** Receipt attribution phase supplied alongside `costLedger`. */
|
|
64
64
|
costPhase?: string;
|
|
65
65
|
}): Promise<{
|
|
@@ -166,6 +166,41 @@ interface AgenticGeneratorShotReceipt {
|
|
|
166
166
|
readonly message: string;
|
|
167
167
|
} | null;
|
|
168
168
|
}
|
|
169
|
+
/** Frozen exact harness result for an author shot: full streams, process state,
|
|
170
|
+
* token usage, and execution-policy evidence.
|
|
171
|
+
* The `onShotCompleted` callback receives `null` when execution failed before
|
|
172
|
+
* the harness returned. */
|
|
173
|
+
type AgenticGeneratorShotExecution = Readonly<Omit<LocalHarnessResult, 'usage' | 'evidence'> & {
|
|
174
|
+
readonly usage?: Readonly<CodexTokenUsage>;
|
|
175
|
+
readonly evidence?: Readonly<Omit<CodexExecutionEvidence, 'readDeniedPaths' | 'policy'>> & {
|
|
176
|
+
readonly readDeniedPaths: ReadonlyArray<string>;
|
|
177
|
+
readonly policy: Readonly<CodexExecutionEvidence['policy']>;
|
|
178
|
+
};
|
|
179
|
+
}>;
|
|
180
|
+
/** Worktree decision emitted before a completed shot is retried, accepted, or
|
|
181
|
+
* discarded. The callback runs while `worktreePath` is still available, so
|
|
182
|
+
* callers can persist the exact diff. */
|
|
183
|
+
type AgenticGeneratorShotDisposition = {
|
|
184
|
+
readonly kind: 'clean';
|
|
185
|
+
readonly worktreePath: string;
|
|
186
|
+
} | {
|
|
187
|
+
readonly kind: 'rejected';
|
|
188
|
+
readonly worktreePath: string;
|
|
189
|
+
readonly stage: 'raw-trace-evidence' | 'verification';
|
|
190
|
+
readonly feedback: string | null;
|
|
191
|
+
} | {
|
|
192
|
+
readonly kind: 'accepted';
|
|
193
|
+
readonly worktreePath: string;
|
|
194
|
+
readonly verified: boolean;
|
|
195
|
+
} | {
|
|
196
|
+
readonly kind: 'setup-error';
|
|
197
|
+
readonly worktreePath: string;
|
|
198
|
+
readonly stage: 'worktree-inspection' | 'raw-trace-evidence' | 'verification';
|
|
199
|
+
readonly error: {
|
|
200
|
+
readonly name: string;
|
|
201
|
+
readonly message: string;
|
|
202
|
+
};
|
|
203
|
+
};
|
|
169
204
|
interface AgenticGeneratorOptions {
|
|
170
205
|
/** Local coding harness to run in the worktree. Default `claude`. */
|
|
171
206
|
harness?: LocalHarness;
|
|
@@ -179,8 +214,13 @@ interface AgenticGeneratorOptions {
|
|
|
179
214
|
* candidate-specific paths after the driver creates its worktree. */
|
|
180
215
|
codexReadDeniedPaths?: ReadonlyArray<string> | ((worktreePath: string) => ReadonlyArray<string>);
|
|
181
216
|
/** Awaited once for every attempted author shot, including process failures.
|
|
182
|
-
*
|
|
183
|
-
|
|
217
|
+
* The second argument preserves the exact harness result, including stdout
|
|
218
|
+
* and stderr, before worktree inspection or verification can reject the
|
|
219
|
+
* shot. Throwing aborts the candidate so evidence persistence fails closed. */
|
|
220
|
+
onShotCompleted?: (receipt: AgenticGeneratorShotReceipt, execution: AgenticGeneratorShotExecution | null) => void | Promise<void>;
|
|
221
|
+
/** Awaited after worktree inspection and before the shot is accepted,
|
|
222
|
+
* retried, or discarded. Throwing aborts the candidate. */
|
|
223
|
+
onShotDisposition?: (receipt: AgenticGeneratorShotReceipt, disposition: AgenticGeneratorShotDisposition) => void | Promise<void>;
|
|
184
224
|
/** Optional hard upper bound passed to the run-wide CostLedger before each
|
|
185
225
|
* author shot. This MUST be enforced by the provider or executor; a planning
|
|
186
226
|
* estimate is not an admissible bound. Omit for an uncapped ledger. A capped
|
|
@@ -215,4 +255,4 @@ declare function agenticGenerator(opts?: AgenticGeneratorOptions): CandidateGene
|
|
|
215
255
|
* silent fallback). */
|
|
216
256
|
declare function commandVerifier(command: string, args?: string[], timeoutMs?: number): Verifier;
|
|
217
257
|
|
|
218
|
-
export { AGENTIC_PROFILE_RESOURCE_ROOT as A, type CandidateGenerator as C, type ImprovementDriverOptions as I, type ManagedImprovementDriver as M, type Verifier as V, type AgenticGeneratorOptions as a, type
|
|
258
|
+
export { AGENTIC_PROFILE_RESOURCE_ROOT as A, type CandidateGenerator as C, type ImprovementDriverOptions as I, type ManagedImprovementDriver as M, type Verifier as V, type AgenticGeneratorOptions as a, type AgenticGeneratorShotDisposition as b, type AgenticGeneratorShotExecution as c, type AgenticGeneratorShotReceipt as d, type VerifyResult as e, agenticGenerator as f, commandVerifier as g, improvementDriver as i };
|
package/dist/analyst-loop.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { TraceAnalystByteBudgets, TraceAnalysisStore } from '@tangle-network/agent-eval';
|
|
2
|
-
import { I as Iteration } from './types-
|
|
2
|
+
import { I as Iteration } from './types-ByAYqlVb.js';
|
|
3
3
|
import { R as RunAnalystLoopOpts, a as RunAnalystLoopResult } from './types-BC3bZpH0.js';
|
|
4
4
|
export { A as AnalystLoopEvent, b as AnalystRegistryLike, c as AnalystRegistryStreamingLike, d as AutoApplyPolicy, F as FindingsStoreLike, I as ImprovementAdapter, e as ImprovementEditBatch, f as ImprovementReport, K as KnowledgeAdapter, g as KnowledgeProposalBatch, h as KnowledgeReport } from './types-BC3bZpH0.js';
|
|
5
5
|
import '@tangle-network/sandbox';
|
|
6
|
+
import './types-BwoZWq-i.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
*
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { A as AgentBackendInput, O as OpenAIChatTool, a as OpenAIChatToolChoice, b as OpenAIChatResponseFormat, c as AgentExecutionBackend, d as AgentBackendContext, R as RuntimeStreamEvent } from './types-BwoZWq-i.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* Backend factories for `runAgentTaskStream`. Three shapes ship in core:
|
|
6
|
+
*
|
|
7
|
+
* - `createIterableBackend` — wrap any custom async iterable into a backend
|
|
8
|
+
* - `createSandboxPromptBackend` — sandbox / sidecar `streamPrompt` clients
|
|
9
|
+
* - `createOpenAICompatibleBackend` — OpenAI-style chat completions endpoints
|
|
10
|
+
*
|
|
11
|
+
* Adapters stay thin: domain repos own auth, model selection, and the concrete
|
|
12
|
+
* tool surface. The factories handle session creation, stream normalization,
|
|
13
|
+
* and graceful end-of-stream signalling.
|
|
14
|
+
*
|
|
15
|
+
* @stable
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** Wrap any custom async-iterable stream into a typed `AgentExecutionBackend`. @stable */
|
|
19
|
+
declare function createIterableBackend<TInput extends AgentBackendInput>(options: {
|
|
20
|
+
kind: string;
|
|
21
|
+
start?: AgentExecutionBackend<TInput>['start'];
|
|
22
|
+
resume?: AgentExecutionBackend<TInput>['resume'];
|
|
23
|
+
stream: AgentExecutionBackend<TInput>['stream'];
|
|
24
|
+
stop?: AgentExecutionBackend<TInput>['stop'];
|
|
25
|
+
}): AgentExecutionBackend<TInput>;
|
|
26
|
+
/** Build an `AgentExecutionBackend` backed by a sandbox/sidecar `streamPrompt` call. @stable */
|
|
27
|
+
declare function createSandboxPromptBackend<TBox, TInput extends AgentBackendInput = AgentBackendInput>(options: {
|
|
28
|
+
kind?: string;
|
|
29
|
+
getBox(input: TInput, context: Omit<AgentBackendContext, 'session'>): Promise<TBox> | TBox;
|
|
30
|
+
streamPrompt(box: TBox, message: string, context: AgentBackendContext): AsyncIterable<unknown>;
|
|
31
|
+
mapEvent?: (event: unknown, context: AgentBackendContext) => RuntimeStreamEvent | undefined;
|
|
32
|
+
getSessionId?: (box: TBox, input: TInput) => string | undefined;
|
|
33
|
+
}): AgentExecutionBackend<TInput>;
|
|
34
|
+
/** @stable */
|
|
35
|
+
/**
|
|
36
|
+
* Retry policy for transient transport errors (rate limits, upstream
|
|
37
|
+
* timeouts). Defaults to 5 attempts with exponential backoff starting at
|
|
38
|
+
* 1s, ±25% jitter, capped at 30s. Set `maxAttempts: 1` to disable retries.
|
|
39
|
+
*
|
|
40
|
+
* Retried status codes:
|
|
41
|
+
* - 408 Request Timeout
|
|
42
|
+
* - 425 Too Early
|
|
43
|
+
* - 429 Too Many Requests
|
|
44
|
+
* - 500 / 502 / 503 / 504 — upstream transient failures
|
|
45
|
+
*
|
|
46
|
+
* Hard failures (401, 403, 4xx other than the above) propagate immediately.
|
|
47
|
+
*/
|
|
48
|
+
interface BackendRetryPolicy {
|
|
49
|
+
/** Total attempts including the first try. Default 5. */
|
|
50
|
+
maxAttempts?: number;
|
|
51
|
+
/** Initial backoff in ms before the second attempt. Default 1000. */
|
|
52
|
+
initialBackoffMs?: number;
|
|
53
|
+
/** Hard ceiling on backoff in ms. Default 30000. */
|
|
54
|
+
maxBackoffMs?: number;
|
|
55
|
+
/** Jitter fraction in [0, 1]. Default 0.25 (±25%). */
|
|
56
|
+
jitter?: number;
|
|
57
|
+
/** Status codes that trigger a retry. Default: 408, 425, 429, 500, 502, 503, 504. */
|
|
58
|
+
retryStatuses?: ReadonlyArray<number>;
|
|
59
|
+
/**
|
|
60
|
+
* Per-attempt wall-clock deadline in ms. If a single fetch attempt does
|
|
61
|
+
* not return headers within this window the attempt is aborted and
|
|
62
|
+
* retried. Default 120000 (2 min). Without this a hung upstream blocks
|
|
63
|
+
* the attempt indefinitely — observed in production as a 15-minute
|
|
64
|
+
* `fetch failed` that burned an entire eval persona. Set to 0 to disable.
|
|
65
|
+
*/
|
|
66
|
+
requestTimeoutMs?: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
*
|
|
70
|
+
* OpenAI-compat streaming backend. Routes `runAgentTaskStream` through any
|
|
71
|
+
* `POST /chat/completions` endpoint that speaks OpenAI's SSE protocol —
|
|
72
|
+
* Tangle Router, OpenAI direct, OpenRouter, Groq, DeepSeek, Together. The
|
|
73
|
+
* router also fronts Anthropic models in Anthropic-native SSE shape; this
|
|
74
|
+
* backend handles both.
|
|
75
|
+
*
|
|
76
|
+
* ### Tool calls
|
|
77
|
+
*
|
|
78
|
+
* Pass `tools` (and optionally `toolChoice`) to forward an OpenAI Chat
|
|
79
|
+
* Completions `tools[]` array on every request. Streamed `tool_call` chunks
|
|
80
|
+
* are buffered until the model finalizes them (either `finish_reason:
|
|
81
|
+
* 'tool_calls'` for OpenAI shape or a `content_block_stop` for Anthropic
|
|
82
|
+
* `tool_use` blocks proxied through the router), then emitted as a single
|
|
83
|
+
* `tool_call` RuntimeStreamEvent with the assembled `args`.
|
|
84
|
+
*
|
|
85
|
+
* The backend does NOT execute tools — it surfaces calls for the caller's
|
|
86
|
+
* own dispatcher (typically the product's MCP / sandbox runtime) to fulfill
|
|
87
|
+
* and feed back as a subsequent `messages` turn. This keeps the transport
|
|
88
|
+
* thin and lets the agent host own tool dispatch policy.
|
|
89
|
+
*
|
|
90
|
+
* ### Fail-loud errors
|
|
91
|
+
*
|
|
92
|
+
* Non-success HTTP responses (4xx/5xx) and exhausted retry budgets throw
|
|
93
|
+
* `BackendTransportError` from inside the `stream()` generator. The runtime
|
|
94
|
+
* catches the throw, yields a `backend_error` with a typed `error` field
|
|
95
|
+
* (`kind`, `status`, truncated `body`) and a terminal `final` event with
|
|
96
|
+
* `status: 'failed'` carrying the same detail. Consumers MUST map
|
|
97
|
+
* `final.error` onto their `RunRecord.error` — silently treating an empty
|
|
98
|
+
* `finalText` as "agent produced nothing" hides credit exhaustion, auth
|
|
99
|
+
* failure, and upstream outages.
|
|
100
|
+
*
|
|
101
|
+
* @stable
|
|
102
|
+
*/
|
|
103
|
+
declare function createOpenAICompatibleBackend<TInput extends AgentBackendInput = AgentBackendInput>(options: {
|
|
104
|
+
apiKey: string;
|
|
105
|
+
baseUrl: string;
|
|
106
|
+
model: string;
|
|
107
|
+
kind?: string;
|
|
108
|
+
/**
|
|
109
|
+
* OpenAI Chat Completions `tools[]` definitions surfaced to the model on
|
|
110
|
+
* every request. Omit to send a tool-free request (existing behavior).
|
|
111
|
+
* The runtime makes no assumption about the dispatcher — calls stream out
|
|
112
|
+
* as `tool_call` events and the caller is responsible for executing them
|
|
113
|
+
* and feeding `tool_result` messages back on a follow-up turn.
|
|
114
|
+
*/
|
|
115
|
+
tools?: ReadonlyArray<OpenAIChatTool>;
|
|
116
|
+
/**
|
|
117
|
+
* OpenAI Chat Completions `tool_choice`. Default `undefined` (request
|
|
118
|
+
* omits the field; provider falls back to its own default — typically
|
|
119
|
+
* `'auto'`).
|
|
120
|
+
*/
|
|
121
|
+
toolChoice?: OpenAIChatToolChoice;
|
|
122
|
+
/**
|
|
123
|
+
* OpenAI Chat Completions `response_format`. Omit for provider default text.
|
|
124
|
+
*/
|
|
125
|
+
responseFormat?: OpenAIChatResponseFormat;
|
|
126
|
+
/** OpenAI Chat Completions `temperature`. Omit for provider default. */
|
|
127
|
+
temperature?: number;
|
|
128
|
+
/** Maximum completion tokens, sent as OpenAI-compatible `max_tokens`. Omit for provider default. */
|
|
129
|
+
maxTokens?: number;
|
|
130
|
+
fetchImpl?: typeof fetch;
|
|
131
|
+
retry?: BackendRetryPolicy;
|
|
132
|
+
}): AgentExecutionBackend<TInput>;
|
|
133
|
+
|
|
134
|
+
export { createIterableBackend as a, createSandboxPromptBackend as b, createOpenAICompatibleBackend as c };
|