@tangle-network/agent-runtime 0.104.0 → 0.106.0
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 +176 -42
- package/dist/activation-CRjVfOiy.js +203 -0
- package/dist/activation-CRjVfOiy.js.map +1 -0
- package/dist/activation-DyWB0K6E.d.ts +98 -0
- package/dist/agent.d.ts +216 -234
- package/dist/agent.js +615 -547
- package/dist/agent.js.map +1 -1
- package/dist/analyst-loop-DGdtVENg.js +517 -0
- package/dist/analyst-loop-DGdtVENg.js.map +1 -0
- package/dist/analyst-loop.d.ts +10 -43
- package/dist/analyst-loop.js +2 -11
- package/dist/backends-Dy8NujB4.js +713 -0
- package/dist/backends-Dy8NujB4.js.map +1 -0
- package/dist/candidate-execution/index.d.ts +4 -192
- package/dist/candidate-execution/index.js +5 -66
- package/dist/candidate-execution-DqMbv1rU.js +488 -0
- package/dist/candidate-execution-DqMbv1rU.js.map +1 -0
- package/dist/coder-yhVWbdWc.js +40 -0
- package/dist/coder-yhVWbdWc.js.map +1 -0
- package/dist/conversation-XucG_K3l.js +1265 -0
- package/dist/conversation-XucG_K3l.js.map +1 -0
- package/dist/conversation.d.ts +2 -804
- package/dist/conversation.js +2 -55
- package/dist/environment-provider-CfLUmKmf.js +1168 -0
- package/dist/environment-provider-CfLUmKmf.js.map +1 -0
- package/dist/environment-provider-IUGU3epE.d.ts +964 -0
- package/dist/environment-provider.d.ts +2 -78
- package/dist/environment-provider.js +2 -18
- package/dist/errors-DEAvWQPy.js +111 -0
- package/dist/errors-DEAvWQPy.js.map +1 -0
- package/dist/improvement-adapter-Cr5TBSji.d.ts +166 -0
- package/dist/improvement-cycle-C095kS_g.js +2624 -0
- package/dist/improvement-cycle-C095kS_g.js.map +1 -0
- package/dist/index-BGdxAwfO.d.ts +838 -0
- package/dist/index-C-FYUuFG.d.ts +193 -0
- package/dist/index-CbNM40xG.d.ts +140 -0
- package/dist/index-DruSKs3Z.d.ts +7224 -0
- package/dist/index-Efjb3nrQ.d.ts +671 -0
- package/dist/index.d.ts +14 -1134
- package/dist/index.js +2134 -1972
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +776 -888
- package/dist/intelligence.js +1466 -1410
- package/dist/intelligence.js.map +1 -1
- package/dist/{kb-gate-CwHO0vz6.d.ts → kb-gate-C8z2juK8.d.ts} +33 -31
- package/dist/kb-gate-DpaSwXVx.js +80 -0
- package/dist/kb-gate-DpaSwXVx.js.map +1 -0
- package/dist/knowledge-Ku-mPP4f.js +433 -0
- package/dist/knowledge-Ku-mPP4f.js.map +1 -0
- package/dist/knowledge.d.ts +2 -150
- package/dist/knowledge.js +2 -40
- package/dist/local-harness-Dh8PJ0ot.d.ts +455 -0
- package/dist/loop-runner-bin-BXsFEUcf.d.ts +162 -0
- package/dist/loop-runner-bin-BwjQ1NfH.js +268 -0
- package/dist/loop-runner-bin-BwjQ1NfH.js.map +1 -0
- package/dist/loop-runner-bin.d.ts +2 -17
- package/dist/loop-runner-bin.js +2 -24
- package/dist/loops.d.ts +5 -4164
- package/dist/loops.js +8 -419
- package/dist/mcp/bin.d.ts +1 -1
- package/dist/mcp/bin.js +116 -146
- package/dist/mcp/bin.js.map +1 -1
- package/dist/mcp/index.d.ts +295 -437
- package/dist/mcp/index.js +1242 -1177
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/memory-bin.d.ts +1 -1
- package/dist/mcp/memory-bin.js +37 -16
- package/dist/mcp/memory-bin.js.map +1 -1
- package/dist/memory-server-DL6cE2Ag.js +234 -0
- package/dist/memory-server-DL6cE2Ag.js.map +1 -0
- package/dist/model-resolution-Btd9iIKV.js +98 -0
- package/dist/model-resolution-Btd9iIKV.js.map +1 -0
- package/dist/openai-tools-B68JaOCx.d.ts +24 -0
- package/dist/openai-tools-CKLy1C7M.js +44 -0
- package/dist/openai-tools-CKLy1C7M.js.map +1 -0
- package/dist/otel-export-D34IQW1C.js +843 -0
- package/dist/otel-export-D34IQW1C.js.map +1 -0
- package/dist/platform.d.ts +188 -185
- package/dist/platform.js +185 -218
- package/dist/platform.js.map +1 -1
- package/dist/prepare-B53sPV7M.js +4292 -0
- package/dist/prepare-B53sPV7M.js.map +1 -0
- package/dist/primeintellect/index.d.ts +150 -147
- package/dist/primeintellect/index.js +626 -1004
- package/dist/primeintellect/index.js.map +1 -1
- package/dist/profiles.d.ts +296 -490
- package/dist/profiles.js +722 -749
- package/dist/profiles.js.map +1 -1
- package/dist/protected-model-port-BLPH5VVv.js +722 -0
- package/dist/protected-model-port-BLPH5VVv.js.map +1 -0
- package/dist/protected-model-port-BP6Z4eau.d.ts +283 -0
- package/dist/protected-redaction--F3v1oo8.js +200 -0
- package/dist/protected-redaction--F3v1oo8.js.map +1 -0
- package/dist/redact-D-u-rrcn.js +82 -0
- package/dist/redact-D-u-rrcn.js.map +1 -0
- package/dist/redact-kbIOjfjM.d.ts +452 -0
- package/dist/researcher-CoVqNhfI.js +433 -0
- package/dist/researcher-CoVqNhfI.js.map +1 -0
- package/dist/runtime-BG0BziaP.js +5408 -0
- package/dist/runtime-BG0BziaP.js.map +1 -0
- package/dist/sandbox-events-DeI5xX8P.js +316 -0
- package/dist/sandbox-events-DeI5xX8P.js.map +1 -0
- package/dist/spawn-journal-CwPvKUTa.js +456 -0
- package/dist/spawn-journal-CwPvKUTa.js.map +1 -0
- package/dist/structural-rollout-IXUEplky.js +1445 -0
- package/dist/structural-rollout-IXUEplky.js.map +1 -0
- package/dist/substrate-B0TYNrXn.js +27 -0
- package/dist/substrate-B0TYNrXn.js.map +1 -0
- package/dist/{substrate-Dyiqmd3o.d.ts → substrate-BcnuSHXm.d.ts} +57 -54
- package/dist/supervise-BiRutHS9.js +7321 -0
- package/dist/supervise-BiRutHS9.js.map +1 -0
- package/dist/supervisor-DTKhF-RV.js +3826 -0
- package/dist/supervisor-DTKhF-RV.js.map +1 -0
- package/dist/testing.d.ts +4 -3
- package/dist/testing.js +2478 -2637
- package/dist/testing.js.map +1 -1
- package/dist/tool-server-RcWgLIsL.js +141 -0
- package/dist/tool-server-RcWgLIsL.js.map +1 -0
- package/dist/trace-propagation-CJJC7SVB.js +57 -0
- package/dist/trace-propagation-CJJC7SVB.js.map +1 -0
- package/dist/types-BaIpb0XT.d.ts +492 -0
- package/dist/types-BevOjfTY.d.ts +765 -0
- package/dist/types-C9j4qg6l.d.ts +500 -0
- package/dist/types-Cja5OTGh.d.ts +190 -0
- package/dist/util-MVgdwuIS.js +145 -0
- package/dist/util-MVgdwuIS.js.map +1 -0
- package/dist/workspace-archive-BosQiotA.js +575 -0
- package/dist/workspace-archive-BosQiotA.js.map +1 -0
- package/package.json +43 -55
- package/skills/build-with-agent-runtime/SKILL.md +16 -9
- package/skills/loop-writer/SKILL.md +1 -1
- package/dist/activation-Cm-9MMX1.d.ts +0 -69
- package/dist/analyst-loop.js.map +0 -1
- package/dist/backends-BO4Jqoe2.d.ts +0 -134
- package/dist/candidate-execution/index.js.map +0 -1
- package/dist/chunk-2KGAN2HM.js +0 -1256
- package/dist/chunk-2KGAN2HM.js.map +0 -1
- package/dist/chunk-2QJSNOGK.js +0 -48
- package/dist/chunk-2QJSNOGK.js.map +0 -1
- package/dist/chunk-2UABGGUB.js +0 -474
- package/dist/chunk-2UABGGUB.js.map +0 -1
- package/dist/chunk-2VZYRB55.js +0 -834
- package/dist/chunk-2VZYRB55.js.map +0 -1
- package/dist/chunk-2X65HYMI.js +0 -3526
- package/dist/chunk-2X65HYMI.js.map +0 -1
- package/dist/chunk-3MDZX7YU.js +0 -125
- package/dist/chunk-3MDZX7YU.js.map +0 -1
- package/dist/chunk-3PPVCS75.js +0 -199
- package/dist/chunk-3PPVCS75.js.map +0 -1
- package/dist/chunk-5HNDYWUT.js +0 -6424
- package/dist/chunk-5HNDYWUT.js.map +0 -1
- package/dist/chunk-5IBQAPVB.js +0 -29
- package/dist/chunk-5IBQAPVB.js.map +0 -1
- package/dist/chunk-5QOB7H74.js +0 -387
- package/dist/chunk-5QOB7H74.js.map +0 -1
- package/dist/chunk-ATDFUJYI.js +0 -4728
- package/dist/chunk-ATDFUJYI.js.map +0 -1
- package/dist/chunk-B7K7V22Y.js +0 -699
- package/dist/chunk-B7K7V22Y.js.map +0 -1
- package/dist/chunk-DPEUKJRO.js +0 -27
- package/dist/chunk-DPEUKJRO.js.map +0 -1
- package/dist/chunk-FD2MBMOH.js +0 -494
- package/dist/chunk-FD2MBMOH.js.map +0 -1
- package/dist/chunk-FJI3EXU3.js +0 -2402
- package/dist/chunk-FJI3EXU3.js.map +0 -1
- package/dist/chunk-HAO4CXHP.js +0 -200
- package/dist/chunk-HAO4CXHP.js.map +0 -1
- package/dist/chunk-ISPWRSEC.js +0 -408
- package/dist/chunk-ISPWRSEC.js.map +0 -1
- package/dist/chunk-KRBFHMV6.js +0 -1228
- package/dist/chunk-KRBFHMV6.js.map +0 -1
- package/dist/chunk-L5DST3QC.js +0 -351
- package/dist/chunk-L5DST3QC.js.map +0 -1
- package/dist/chunk-M22PL4GH.js +0 -171
- package/dist/chunk-M22PL4GH.js.map +0 -1
- package/dist/chunk-NURIQBJQ.js +0 -72
- package/dist/chunk-NURIQBJQ.js.map +0 -1
- package/dist/chunk-PZZKQVQV.js +0 -52
- package/dist/chunk-PZZKQVQV.js.map +0 -1
- package/dist/chunk-Q2JSAVQ3.js +0 -671
- package/dist/chunk-Q2JSAVQ3.js.map +0 -1
- package/dist/chunk-SBTWKPVR.js +0 -5576
- package/dist/chunk-SBTWKPVR.js.map +0 -1
- package/dist/chunk-SGKPNBXE.js +0 -60
- package/dist/chunk-SGKPNBXE.js.map +0 -1
- package/dist/chunk-SNSMRT6H.js +0 -680
- package/dist/chunk-SNSMRT6H.js.map +0 -1
- package/dist/chunk-STJEHM5F.js +0 -1338
- package/dist/chunk-STJEHM5F.js.map +0 -1
- package/dist/chunk-UPWGXKXB.js +0 -254
- package/dist/chunk-UPWGXKXB.js.map +0 -1
- package/dist/chunk-YEJR7IXO.js +0 -68
- package/dist/chunk-YEJR7IXO.js.map +0 -1
- package/dist/chunk-ZXICDSAK.js +0 -907
- package/dist/chunk-ZXICDSAK.js.map +0 -1
- package/dist/completion-gate-Bv47cOnn.d.ts +0 -256
- package/dist/conversation.js.map +0 -1
- package/dist/coordination-CxtzMxSM.d.ts +0 -2570
- package/dist/environment-provider.js.map +0 -1
- package/dist/improve--2A0gK1-.d.ts +0 -440
- package/dist/improvement-adapter-HAZz-7vK.d.ts +0 -203
- package/dist/knowledge.js.map +0 -1
- package/dist/local-harness-CtK9dSny.d.ts +0 -175
- package/dist/loop-runner-bin-DUOGtvOl.d.ts +0 -207
- package/dist/loop-runner-bin.js.map +0 -1
- package/dist/loops.js.map +0 -1
- package/dist/openai-tools-fnj6SRVg.d.ts +0 -46
- package/dist/protected-model-port-DzkUY3HQ.d.ts +0 -271
- package/dist/sanitize-DEbPNtyI.d.ts +0 -328
- package/dist/structural-rollout-C4mabf87.d.ts +0 -446
- package/dist/supervise-7q9F5brx.d.ts +0 -379
- package/dist/types-BCoemcXU.d.ts +0 -802
- package/dist/types-BwoZWq-i.d.ts +0 -510
- package/dist/types-Cbp72qyu.d.ts +0 -491
- package/dist/types-CmYCMbFT.d.ts +0 -203
- package/dist/types-CvNwMzQt.d.ts +0 -957
- package/dist/worktree-fanout-WsOzt8qu.d.ts +0 -999
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import { ChildProcess } from 'node:child_process';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* Subprocess wrappers for the local coding-harness CLIs installed in the
|
|
6
|
-
* sandbox image (claude-code, codex, opencode). Used by the in-process
|
|
7
|
-
* delegation executor (`createInProcessExecutor`) so a delegated coding task
|
|
8
|
-
* spawns a real harness on a real git worktree instead of provisioning a
|
|
9
|
-
* sibling sandbox.
|
|
10
|
-
*
|
|
11
|
-
* All harness invocations:
|
|
12
|
-
* - run with `cwd` set to the worktree
|
|
13
|
-
* - inherit env from the parent (the MCP server inside the sandbox has
|
|
14
|
-
* the harness's auth already)
|
|
15
|
-
* - capture stdout/stderr
|
|
16
|
-
* - support cancellation via AbortSignal
|
|
17
|
-
* - enforce a wall-clock timeout
|
|
18
|
-
*
|
|
19
|
-
* @experimental
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/** Local coding harness available inside the sandbox. */
|
|
23
|
-
type LocalHarness = 'claude' | 'codex' | 'opencode';
|
|
24
|
-
/** @experimental */
|
|
25
|
-
interface RunLocalHarnessOptions {
|
|
26
|
-
harness: LocalHarness;
|
|
27
|
-
/** Working directory for the subprocess (typically a worktree path). */
|
|
28
|
-
cwd: string;
|
|
29
|
-
/** Prompt forwarded as the harness CLI's task argument. */
|
|
30
|
-
taskPrompt: string;
|
|
31
|
-
/**
|
|
32
|
-
* Pre-built command + args (e.g. from `harnessInvocation` so the full authored
|
|
33
|
-
* `AgentProfile` — systemPrompt + model — reaches the harness). When set it OVERRIDES the
|
|
34
|
-
* default prompt-only `buildArgs(taskPrompt)` path; `command` defaults to the harness's
|
|
35
|
-
* default binary when only `args` is supplied. When absent the legacy prompt-only shape
|
|
36
|
-
* is used unchanged.
|
|
37
|
-
*/
|
|
38
|
-
invocation?: {
|
|
39
|
-
command?: string;
|
|
40
|
-
args: ReadonlyArray<string>;
|
|
41
|
-
};
|
|
42
|
-
/** Allow autonomous Claude edits without an interactive permission prompt.
|
|
43
|
-
* Use only when `cwd` is an isolated candidate worktree. */
|
|
44
|
-
dangerouslySkipPermissions?: boolean;
|
|
45
|
-
/** Isolate Codex from ambient configuration/instructions and require JSONL token usage.
|
|
46
|
-
* The invocation should come from `harnessInvocation(..., { codexReproducible: true })`. */
|
|
47
|
-
codexReproducible?: boolean;
|
|
48
|
-
/** Absolute host paths that reproducible Codex must not read. The normalized set is compiled
|
|
49
|
-
* into the controlled permission profile and its digest is returned in execution evidence. */
|
|
50
|
-
codexReadDeniedPaths?: ReadonlyArray<string>;
|
|
51
|
-
/** Wall-clock kill deadline (ms). Default 5 min. Subprocess SIGTERMed on expiry. */
|
|
52
|
-
timeoutMs?: number;
|
|
53
|
-
/** Newest stdout/stderr bytes retained per stream. Default 64 MiB. */
|
|
54
|
-
maxOutputBytes?: number;
|
|
55
|
-
/** Caller cancellation. SIGTERM is sent on abort. */
|
|
56
|
-
signal?: AbortSignal;
|
|
57
|
-
/** Override env (defaults to inheriting from the parent). */
|
|
58
|
-
env?: NodeJS.ProcessEnv;
|
|
59
|
-
/**
|
|
60
|
-
* Test seam — inject a custom spawner so unit tests can mock the
|
|
61
|
-
* subprocess without touching the OS. Defaults to node's `child_process.spawn`.
|
|
62
|
-
*/
|
|
63
|
-
spawn?: (command: string, args: ReadonlyArray<string>, opts: {
|
|
64
|
-
cwd: string;
|
|
65
|
-
env: NodeJS.ProcessEnv;
|
|
66
|
-
stdio: 'pipe';
|
|
67
|
-
detached: boolean;
|
|
68
|
-
}) => ChildProcess;
|
|
69
|
-
/** Test seam for locating the native Codex executable before it is staged in the worktree. */
|
|
70
|
-
resolveCodexExecutable?: (command: string, env: NodeJS.ProcessEnv) => Promise<string>;
|
|
71
|
-
}
|
|
72
|
-
/** Exact aggregate usage emitted by Codex's terminal `turn.completed` JSONL event. */
|
|
73
|
-
interface CodexTokenUsage {
|
|
74
|
-
inputTokens: number;
|
|
75
|
-
cachedInputTokens: number;
|
|
76
|
-
outputTokens: number;
|
|
77
|
-
reasoningOutputTokens: number;
|
|
78
|
-
}
|
|
79
|
-
/** Isolation settings asserted before a reproducible Codex run is allowed to start. */
|
|
80
|
-
interface CodexExecutionPolicy {
|
|
81
|
-
sessionPersistence: 'ephemeral';
|
|
82
|
-
userConfig: false;
|
|
83
|
-
rules: false;
|
|
84
|
-
projectInstructions: false;
|
|
85
|
-
skillInstructions: false;
|
|
86
|
-
appInstructions: false;
|
|
87
|
-
toolSuggestions: false;
|
|
88
|
-
multiAgentInstructions: false;
|
|
89
|
-
sandbox: 'workspace-write';
|
|
90
|
-
permissionProfile: 'agent_runtime_reproducible';
|
|
91
|
-
approvalPolicy: 'never';
|
|
92
|
-
shellNetwork: false;
|
|
93
|
-
webSearch: false;
|
|
94
|
-
serviceTier: 'default';
|
|
95
|
-
shellEnvironment: 'core-filtered';
|
|
96
|
-
loginShell: false;
|
|
97
|
-
credentialsReadable: false;
|
|
98
|
-
hostHomeReadable: false;
|
|
99
|
-
procEnvironment: 'private-sanitized';
|
|
100
|
-
sensitiveEnvironmentNamesVisible: false;
|
|
101
|
-
parentRepoRead: false;
|
|
102
|
-
gitMetadata: false;
|
|
103
|
-
temporaryDirectory: 'workspace-private';
|
|
104
|
-
stagedExecutable: 'static-elf-read-only';
|
|
105
|
-
callerReadDeniedPaths: 'enforced';
|
|
106
|
-
containerSockets: false;
|
|
107
|
-
}
|
|
108
|
-
/** Zero-model-call evidence for the exact Codex process about to run. */
|
|
109
|
-
interface CodexExecutionEvidence {
|
|
110
|
-
cliVersion: string;
|
|
111
|
-
executableSha256: string;
|
|
112
|
-
/** SHA-256 of the exact composed prompt argument proved present in the rendered prompt. */
|
|
113
|
-
requestedPromptSha256: string;
|
|
114
|
-
effectivePromptSha256: string;
|
|
115
|
-
nonPromptArgsSha256: string;
|
|
116
|
-
controlledConfigSha256: string;
|
|
117
|
-
/** Sorted normalized paths compiled into the permission profile. */
|
|
118
|
-
readDeniedPaths: string[];
|
|
119
|
-
readDeniedPathsSha256: string;
|
|
120
|
-
readDeniedPathCount: number;
|
|
121
|
-
policy: CodexExecutionPolicy;
|
|
122
|
-
}
|
|
123
|
-
/** @experimental */
|
|
124
|
-
interface LocalHarnessResult {
|
|
125
|
-
/** OS exit code. `null` when killed before exit. */
|
|
126
|
-
exitCode: number | null;
|
|
127
|
-
/** Concatenated stdout. */
|
|
128
|
-
stdout: string;
|
|
129
|
-
/** Concatenated stderr. */
|
|
130
|
-
stderr: string;
|
|
131
|
-
/** Set when the process exited via signal (timeout / abort). */
|
|
132
|
-
killedBySignal: NodeJS.Signals | null;
|
|
133
|
-
/** Wall-clock duration ms (spawn → exit). */
|
|
134
|
-
durationMs: number;
|
|
135
|
-
/** Set when timeoutMs elapsed before exit. */
|
|
136
|
-
timedOut: boolean;
|
|
137
|
-
/**
|
|
138
|
-
* Set when the caller's AbortSignal fired before this result settled.
|
|
139
|
-
* Optional so injected runners and stored results from older releases remain valid.
|
|
140
|
-
*/
|
|
141
|
-
aborted?: boolean;
|
|
142
|
-
/** Present for a reproducible Codex run; parsed from the real terminal JSONL event. */
|
|
143
|
-
usage?: CodexTokenUsage;
|
|
144
|
-
/** Present for reproducible Codex runs; generated and checked before model execution. */
|
|
145
|
-
evidence?: CodexExecutionEvidence;
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Spawn a local coding harness CLI as a subprocess + collect its output.
|
|
149
|
-
*
|
|
150
|
-
* NOT responsible for parsing the harness's output or extracting a diff —
|
|
151
|
-
* the in-process executor's `streamPrompt` orchestrates `git diff` against
|
|
152
|
-
* the worktree after this resolves. This function is intentionally narrow:
|
|
153
|
-
* spawn, wait, capture, return.
|
|
154
|
-
*
|
|
155
|
-
* Fails loud — throws when:
|
|
156
|
-
* - `cwd` doesn't exist (subprocess emits ENOENT; surfaced as Error)
|
|
157
|
-
* - the harness binary is not on PATH (ENOENT)
|
|
158
|
-
* - the caller signal was already aborted before process launch
|
|
159
|
-
*
|
|
160
|
-
* Does NOT throw when:
|
|
161
|
-
* - the subprocess exits non-zero (`result.exitCode` carries the code)
|
|
162
|
-
* - a non-reproducible subprocess is aborted / timed out (`result.aborted` /
|
|
163
|
-
* `result.timedOut` carries the reason even when a TERM-aware child exits zero)
|
|
164
|
-
*
|
|
165
|
-
* Reproducible Codex additionally requires a terminal usage event. If cancellation
|
|
166
|
-
* prevents that event, this rejects with `CodexExecutionDiagnosticError` instead of
|
|
167
|
-
* returning an incomplete reproducibility receipt.
|
|
168
|
-
*
|
|
169
|
-
* @experimental
|
|
170
|
-
*/
|
|
171
|
-
declare function runLocalHarness(options: RunLocalHarnessOptions): Promise<LocalHarnessResult>;
|
|
172
|
-
/** Parse and validate the one terminal usage event emitted by `codex exec --json`. */
|
|
173
|
-
declare function parseCodexTokenUsage(stdout: string): CodexTokenUsage;
|
|
174
|
-
|
|
175
|
-
export { type CodexTokenUsage as C, type LocalHarness as L, type RunLocalHarnessOptions as R, type CodexExecutionEvidence as a, type LocalHarnessResult as b, type CodexExecutionPolicy as c, parseCodexTokenUsage as p, runLocalHarness as r };
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import { Scenario } from '@tangle-network/agent-eval/campaign';
|
|
2
|
-
import { SelfImproveOptions, SelfImproveResult } from '@tangle-network/agent-eval/contract';
|
|
3
|
-
import { R as RunAnalystLoopOpts, a as RunAnalystLoopResult } from './types-CmYCMbFT.js';
|
|
4
|
-
import { F as FactCandidate, C as CreateKbGateOptions } from './kb-gate-CwHO0vz6.js';
|
|
5
|
-
import { B as Budget } from './types-CvNwMzQt.js';
|
|
6
|
-
import { A as AuthoredHarness, W as WinnerStrategy, a as WorktreeFanoutOptions, b as WorktreePatchArtifact } from './worktree-fanout-WsOzt8qu.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* `runDelegatedLoop` — the configured delegated loop-runner.
|
|
11
|
-
*
|
|
12
|
-
* One typed entrypoint a worker agent (or a scheduled routine) calls to run a
|
|
13
|
-
* disciplined loop in a chosen MODE, over agent-runtime's hardened engines:
|
|
14
|
-
*
|
|
15
|
-
* code → build-in-a-loop on the GENERIC recursive path (worktreeLoopRunner: author one
|
|
16
|
-
* `AgentProfile` per harness → worktree-CLI leaves → `patchDelivered` gate)
|
|
17
|
-
* review → caller-registered runner — a `code` runner with an approval gate over candidates
|
|
18
|
-
* research → research-in-a-loop with valid-only KB growth (createKbGate)
|
|
19
|
-
* audit → analyze trace/run data → findings (runAnalystLoop, caller-wired)
|
|
20
|
-
* self-improve → closed-loop text/config optimization (selfImprove, held-out gated)
|
|
21
|
-
*
|
|
22
|
-
* It is intentionally a thin façade: the value is that EVERY product reuses the
|
|
23
|
-
* one hardened engine instead of forking delegation logic. The dispatcher owns
|
|
24
|
-
* mode routing, timing, fail-loud on an unregistered mode, and a uniform result
|
|
25
|
-
* shape; each mode's engine is a pre-configured runner in the registry (build it
|
|
26
|
-
* with the factories below, or inject your own / a stub).
|
|
27
|
-
*
|
|
28
|
-
* @experimental
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
/** All valid delegated-loop mode names — used for validation and CLI surfaces. @experimental */
|
|
32
|
-
declare const DELEGATED_LOOP_MODES: readonly ["code", "review", "research", "audit", "self-improve"];
|
|
33
|
-
/** @experimental */
|
|
34
|
-
type DelegatedLoopMode = (typeof DELEGATED_LOOP_MODES)[number];
|
|
35
|
-
/** Type guard — returns true when `value` is a valid `DelegatedLoopMode` string. @experimental */
|
|
36
|
-
declare function isDelegatedLoopMode(value: unknown): value is DelegatedLoopMode;
|
|
37
|
-
/** @experimental A pre-configured loop for one mode. Returns the mode's raw
|
|
38
|
-
* output; the dispatcher wraps it in a {@link DelegatedLoopResult}. */
|
|
39
|
-
type DelegatedLoopRunner<T = unknown> = (signal: AbortSignal) => Promise<T>;
|
|
40
|
-
/** @experimental Mode → configured runner. Partial: only register the modes a
|
|
41
|
-
* given product/routine actually uses. */
|
|
42
|
-
type DelegatedLoopRegistry = Partial<Record<DelegatedLoopMode, DelegatedLoopRunner>>;
|
|
43
|
-
/** @experimental Uniform result — never throws from a registered runner; a
|
|
44
|
-
* thrown engine becomes `{ ok: false, error }` so a routine can record + move on. */
|
|
45
|
-
interface DelegatedLoopResult<T = unknown> {
|
|
46
|
-
mode: DelegatedLoopMode;
|
|
47
|
-
ok: boolean;
|
|
48
|
-
output?: T;
|
|
49
|
-
error?: string;
|
|
50
|
-
durationMs: number;
|
|
51
|
-
}
|
|
52
|
-
/** @experimental */
|
|
53
|
-
interface RunDelegatedLoopOptions {
|
|
54
|
-
signal?: AbortSignal;
|
|
55
|
-
/** Clock override for deterministic tests. */
|
|
56
|
-
now?: () => number;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
*
|
|
60
|
-
* Dispatch a configured loop by mode. Fails loud (throws `ConfigError`) when no
|
|
61
|
-
* runner is registered for the mode — a routine pointed at an unwired mode is a
|
|
62
|
-
* config bug, not a silent no-op. A runner that throws is captured as
|
|
63
|
-
* `{ ok: false }` so unattended runs record the failure rather than crash.
|
|
64
|
-
*
|
|
65
|
-
* @experimental
|
|
66
|
-
*/
|
|
67
|
-
declare function runDelegatedLoop<T = unknown>(mode: DelegatedLoopMode, registry: DelegatedLoopRegistry, options?: RunDelegatedLoopOptions): Promise<DelegatedLoopResult<T>>;
|
|
68
|
-
/** @experimental Options for the local-repo `code` runner over the GENERIC recursive path. */
|
|
69
|
-
interface WorktreeLoopRunnerOptions {
|
|
70
|
-
/** Absolute path to the local git checkout each worktree is cut from. */
|
|
71
|
-
repoRoot: string;
|
|
72
|
-
/** The instruction handed to every authored harness (composed under each profile's systemPrompt). */
|
|
73
|
-
taskPrompt: string;
|
|
74
|
-
/** The supervisor-authored harness profiles — one fanout item (one worktree-CLI leaf) each. */
|
|
75
|
-
harnesses: ReadonlyArray<AuthoredHarness>;
|
|
76
|
-
/** Conserved budget pool bounding the fanout (equal-k holds by construction). */
|
|
77
|
-
budget: Budget;
|
|
78
|
-
/** Shell command run in each worktree to derive the tests-PASS signal. */
|
|
79
|
-
testCmd?: string;
|
|
80
|
-
/** Shell command run in each worktree to derive the typecheck-PASS signal. */
|
|
81
|
-
typecheckCmd?: string;
|
|
82
|
-
/** Which verification signals the deliverable REQUIRES present-and-passing (default none). */
|
|
83
|
-
require?: ReadonlyArray<'tests' | 'typecheck'>;
|
|
84
|
-
/** Diff-size cap (lines). */
|
|
85
|
-
maxDiffLines?: number;
|
|
86
|
-
/** Literal path prefixes the patch must not touch (the secret-floor is always on regardless). */
|
|
87
|
-
forbiddenPaths?: string[];
|
|
88
|
-
/** Winner-selection strategy among gated candidates. Default `highest-score`. */
|
|
89
|
-
winnerStrategy?: WinnerStrategy;
|
|
90
|
-
/** Test seams forwarded to the worktree-CLI leaves so the runner drives offline. */
|
|
91
|
-
runGit?: WorktreeFanoutOptions['runGit'];
|
|
92
|
-
runHarness?: WorktreeFanoutOptions['runHarness'];
|
|
93
|
-
runCommand?: WorktreeFanoutOptions['runCommand'];
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
*
|
|
97
|
-
* `code` mode on the GENERIC recursive path: author one `AgentProfile` per harness, run them as a
|
|
98
|
-
* `worktreeFanout` (N `createWorktreeCliExecutor` leaves, each `gateOnDeliverable`) through
|
|
99
|
-
* `runPersonified` on the keystone Supervisor. The sandbox-session counterpart that drives the in-box
|
|
100
|
-
* harness over a `SandboxClient` is `detachedSessionDelegate` (`./mcp/delegates`); here there is no
|
|
101
|
-
* `runAgentRounds` driver, no role-coupled delegate — the harness list is the fanout, the gate is
|
|
102
|
-
* `patchDelivered`,
|
|
103
|
-
* the winner is the shared valid-only selector (NOT `defaultSelectWinner`, whose non-valid fallback
|
|
104
|
-
* would surface an ungated patch). Equal-k holds by the conserved budget pool. Returns the winning
|
|
105
|
-
* patch artifact, or throws when no candidate is delivered (fail loud, never a vacuous done).
|
|
106
|
-
*
|
|
107
|
-
* @experimental
|
|
108
|
-
*/
|
|
109
|
-
declare function worktreeLoopRunner(options: WorktreeLoopRunnerOptions): DelegatedLoopRunner<WorktreePatchArtifact>;
|
|
110
|
-
/** @experimental A fact rejected at the KB gate — surfaced, never dropped. */
|
|
111
|
-
interface VetoedFact {
|
|
112
|
-
candidate: FactCandidate;
|
|
113
|
-
vetoedBy?: string;
|
|
114
|
-
reason?: string;
|
|
115
|
-
}
|
|
116
|
-
/** @experimental */
|
|
117
|
-
interface ResearchLoopResult {
|
|
118
|
-
/** Facts that passed the fail-closed gate — safe to write to the KB. */
|
|
119
|
-
accepted: FactCandidate[];
|
|
120
|
-
/** Facts the gate vetoed in the final round — escalate, do not silently drop. */
|
|
121
|
-
vetoed: VetoedFact[];
|
|
122
|
-
/** Research rounds actually run. */
|
|
123
|
-
rounds: number;
|
|
124
|
-
}
|
|
125
|
-
/** @experimental Options for the default `research` runner. */
|
|
126
|
-
interface ResearchLoopRunnerOptions {
|
|
127
|
-
/**
|
|
128
|
-
* The research engine (the consumer's web/doc searcher + extractor). Called
|
|
129
|
-
* each round with the prior round's vetoes so it can re-research the gaps.
|
|
130
|
-
* Returns fact candidates carrying their grounding (`verbatimPassage` +
|
|
131
|
-
* `sourceText`).
|
|
132
|
-
*/
|
|
133
|
-
research: (round: number, vetoed: VetoedFact[]) => Promise<FactCandidate[]>;
|
|
134
|
-
/** Gate config (extra judges, self-artifact kinds, …). The floor is always on. */
|
|
135
|
-
gate?: CreateKbGateOptions;
|
|
136
|
-
/** Max research rounds (correct-on-veto remediation). Default 1. */
|
|
137
|
-
maxRounds?: number;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* `research` mode — research-in-a-loop with valid-only KB growth.
|
|
141
|
-
*
|
|
142
|
-
* Each round: research → gate every candidate (fail-closed; passage MUST be in
|
|
143
|
-
* the source) → accept the clean ones → re-research the vetoed ones next round,
|
|
144
|
-
* up to `maxRounds`. Vetoed facts in the final round are RETURNED (escalate,
|
|
145
|
-
* never silently dropped) so the caller audits vs retries.
|
|
146
|
-
*
|
|
147
|
-
* @experimental
|
|
148
|
-
*/
|
|
149
|
-
declare function researchLoopRunner(o: ResearchLoopRunnerOptions): DelegatedLoopRunner<ResearchLoopResult>;
|
|
150
|
-
/**
|
|
151
|
-
* `self-improve` mode — agent-eval's one-call closed improvement loop (held-out gated).
|
|
152
|
-
*
|
|
153
|
-
* @experimental
|
|
154
|
-
*/
|
|
155
|
-
declare function selfImproveLoopRunner<TScenario extends Scenario, TArtifact>(options: SelfImproveOptions<TScenario, TArtifact>): DelegatedLoopRunner<SelfImproveResult<TScenario, TArtifact>>;
|
|
156
|
-
/**
|
|
157
|
-
* `audit` mode — analyst loop over captured trace/run data.
|
|
158
|
-
*
|
|
159
|
-
* @experimental
|
|
160
|
-
*/
|
|
161
|
-
declare function auditLoopRunner<TProposal = unknown, TEdit = unknown>(options: RunAnalystLoopOpts): DelegatedLoopRunner<RunAnalystLoopResult<TProposal, TEdit>>;
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
*
|
|
165
|
-
* `agent-runtime-loop` — the schedulable entrypoint for the configured
|
|
166
|
-
* delegated loop-runner. A cron job / routine / Makefile target invokes:
|
|
167
|
-
*
|
|
168
|
-
* agent-runtime-loop --mode research --config ./loops.config.js
|
|
169
|
-
*
|
|
170
|
-
* The config module wires the registry (with full access to env / creds —
|
|
171
|
-
* which is why the deps live there, not in this generic bin). It must default-
|
|
172
|
-
* export a `DelegatedLoopRegistry`, or a `() => DelegatedLoopRegistry | Promise<…>`.
|
|
173
|
-
* The bin runs the selected mode, prints the `DelegatedLoopResult` as JSON, and
|
|
174
|
-
* exits 0 on `ok`, 1 on a recorded failure, 2 on a usage/config error.
|
|
175
|
-
*
|
|
176
|
-
* @experimental
|
|
177
|
-
*/
|
|
178
|
-
|
|
179
|
-
/** @experimental Parsed CLI invocation. */
|
|
180
|
-
interface LoopRunnerCliArgs {
|
|
181
|
-
mode: string;
|
|
182
|
-
/** Loads the registry — the bin wires this from `--config`; tests inject a stub. */
|
|
183
|
-
loadRegistry: () => Promise<DelegatedLoopRegistry> | DelegatedLoopRegistry;
|
|
184
|
-
now?: () => number;
|
|
185
|
-
}
|
|
186
|
-
/** @experimental */
|
|
187
|
-
interface LoopRunnerCliResult {
|
|
188
|
-
exitCode: number;
|
|
189
|
-
result?: DelegatedLoopResult;
|
|
190
|
-
error?: string;
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
*
|
|
194
|
-
* Pure CLI core (no process / argv / IO) so it's unit-testable: validate the
|
|
195
|
-
* mode, load the registry, dispatch, map to an exit code (0 ok / 1 failed /
|
|
196
|
-
* 2 usage). Exported for embedding in custom runners + tests.
|
|
197
|
-
*
|
|
198
|
-
* @experimental
|
|
199
|
-
*/
|
|
200
|
-
declare function runLoopRunnerCli(args: LoopRunnerCliArgs): Promise<LoopRunnerCliResult>;
|
|
201
|
-
/** Parse `--mode X --config Y` from an argv tail (`process.argv.slice(2)`). */
|
|
202
|
-
declare function parseLoopRunnerArgv(argv: string[]): {
|
|
203
|
-
mode?: string;
|
|
204
|
-
config?: string;
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
export { DELEGATED_LOOP_MODES as D, type LoopRunnerCliArgs as L, type ResearchLoopResult as R, type VetoedFact as V, type WorktreeLoopRunnerOptions as W, type DelegatedLoopMode as a, type DelegatedLoopRegistry as b, type DelegatedLoopResult as c, type DelegatedLoopRunner as d, type LoopRunnerCliResult as e, type ResearchLoopRunnerOptions as f, type RunDelegatedLoopOptions as g, auditLoopRunner as h, isDelegatedLoopMode as i, runDelegatedLoop as j, runLoopRunnerCli as k, parseLoopRunnerArgv as p, researchLoopRunner as r, selfImproveLoopRunner as s, worktreeLoopRunner as w };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/loops.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { O as OpenAIChatTool } from './types-BwoZWq-i.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* OpenAI Chat Completions `tools[]` projection of the queue-bound agent-runtime
|
|
6
|
-
* MCP delegation tools.
|
|
7
|
-
*
|
|
8
|
-
* Use when configuring `createOpenAICompatibleBackend({ tools: ... })` so the
|
|
9
|
-
* model can call `delegate_feedback`, `delegation_status`, and
|
|
10
|
-
* `delegation_history` through the OpenAI-compat transport (tcloud, OpenRouter,
|
|
11
|
-
* OpenAI direct, cli-bridge). The runtime surfaces tool calls as `tool_call`
|
|
12
|
-
* stream events — execution is the caller's responsibility (typically the
|
|
13
|
-
* parent sandbox runtime's MCP mount).
|
|
14
|
-
*
|
|
15
|
-
* Sandbox-SDK callers do NOT need this helper: the sandbox runtime mounts
|
|
16
|
-
* MCP servers natively and the in-sandbox harness discovers tools via the
|
|
17
|
-
* runtime, not via an OpenAI tools array.
|
|
18
|
-
*
|
|
19
|
-
* Tool name + description + JSON-schema are pulled from the canonical
|
|
20
|
-
* `DELEGATE_*` constants exported by `./tools/*` so the projection cannot
|
|
21
|
-
* drift from the server's own validators.
|
|
22
|
-
*
|
|
23
|
-
* @experimental
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* Returns the queue-bound delegation tools projected into OpenAI Chat
|
|
29
|
-
* Completions `tools[]` shape. The order is stable: `delegate_feedback`,
|
|
30
|
-
* `delegation_status`, `delegation_history`.
|
|
31
|
-
*
|
|
32
|
-
* @experimental
|
|
33
|
-
*/
|
|
34
|
-
declare function mcpToolsForRuntimeMcp(): OpenAIChatTool[];
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
* Subset filter — return only the projected tools whose `function.name`
|
|
38
|
-
* appears in `names`. Useful for curated mounts (e.g. only the queue-bound
|
|
39
|
-
* delegation tools, omitting `delegate_feedback`). Unknown names are
|
|
40
|
-
* silently ignored; pass an empty array to get an empty result.
|
|
41
|
-
*
|
|
42
|
-
* @experimental
|
|
43
|
-
*/
|
|
44
|
-
declare function mcpToolsForRuntimeMcpSubset(names: ReadonlyArray<string>): OpenAIChatTool[];
|
|
45
|
-
|
|
46
|
-
export { mcpToolsForRuntimeMcpSubset as a, mcpToolsForRuntimeMcp as m };
|