@tangle-network/agent-runtime 0.94.13 → 0.96.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 +64 -15
- package/dist/activation-B0ZD7nfX.d.ts +63 -0
- package/dist/agent.d.ts +6 -193
- package/dist/agent.js +10 -234
- package/dist/agent.js.map +1 -1
- package/dist/analyst-loop.d.ts +7 -10
- package/dist/analyst-loop.js +1 -2
- package/dist/candidate-execution/index.d.ts +43 -16
- package/dist/candidate-execution/index.js +17 -8
- package/dist/{chunk-VYA2YEKA.js → chunk-2KGAN2HM.js} +83 -14
- package/dist/chunk-2KGAN2HM.js.map +1 -0
- package/dist/chunk-3XKSBI2U.js +474 -0
- package/dist/chunk-3XKSBI2U.js.map +1 -0
- package/dist/{chunk-TVJQAYQM.js → chunk-6XKPVJAZ.js} +107 -716
- package/dist/chunk-6XKPVJAZ.js.map +1 -0
- package/dist/chunk-BLQIYRVR.js +699 -0
- package/dist/chunk-BLQIYRVR.js.map +1 -0
- package/dist/{chunk-QDSOD7RC.js → chunk-FD2MBMOH.js} +13 -101
- package/dist/chunk-FD2MBMOH.js.map +1 -0
- package/dist/{chunk-U33YZ7B2.js → chunk-FXF2OL34.js} +8 -8
- package/dist/{chunk-EP6RVHMX.js → chunk-HZDEXTSL.js} +848 -2
- package/dist/chunk-HZDEXTSL.js.map +1 -0
- package/dist/{chunk-WIPGQ4GT.js → chunk-IMSNJSXH.js} +1 -1
- package/dist/{chunk-WIPGQ4GT.js.map → chunk-IMSNJSXH.js.map} +1 -1
- package/dist/{chunk-VSWBYWFK.js → chunk-M6MD6JBS.js} +20 -27
- package/dist/chunk-M6MD6JBS.js.map +1 -0
- package/dist/chunk-PSOCBNM3.js +2069 -0
- package/dist/chunk-PSOCBNM3.js.map +1 -0
- package/dist/{chunk-AEG3NGJ2.js → chunk-Q2JSAVQ3.js} +34 -2
- package/dist/chunk-Q2JSAVQ3.js.map +1 -0
- package/dist/{chunk-XP5KDM3R.js → chunk-SGQ4YIQW.js} +4 -4
- package/dist/{chunk-C3UKLQ54.js → chunk-UQ6PNNXM.js} +18 -10
- package/dist/chunk-UQ6PNNXM.js.map +1 -0
- package/dist/{chunk-33OG2NN3.js → chunk-WYC2XJF2.js} +2 -2
- package/dist/{chunk-ZEYAT33L.js → chunk-Y3SRWZMP.js} +2 -2
- package/dist/{chunk-CNH7DF7Z.js → chunk-YOLKCWRV.js} +1116 -591
- package/dist/chunk-YOLKCWRV.js.map +1 -0
- package/dist/{completion-gate-D1gX1-hg.d.ts → completion-gate-C80jiRfN.d.ts} +1 -1
- package/dist/conversation.d.ts +12 -1
- package/dist/conversation.js +2 -3
- package/dist/{coordination-Dr_axlAf.d.ts → coordination-BFE3Den7.d.ts} +10 -11
- package/dist/environment-provider.d.ts +2 -2
- package/dist/environment-provider.js +1 -2
- package/dist/{agentic-generator-DDMM45kZ.d.ts → improve-g75IE2Cx.d.ts} +152 -4
- package/dist/{improvement-adapter-BieWeK5J.d.ts → improvement-adapter-HAZz-7vK.d.ts} +8 -31
- package/dist/index.d.ts +55 -28
- package/dist/index.js +206 -82
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +185 -120
- package/dist/intelligence.js +509 -345
- package/dist/intelligence.js.map +1 -1
- package/dist/knowledge.d.ts +40 -12
- package/dist/knowledge.js +13 -7
- package/dist/{loop-runner-bin-BRQSQdHa.d.ts → loop-runner-bin-Cn1N2rRo.d.ts} +3 -3
- package/dist/loop-runner-bin.d.ts +6 -6
- package/dist/loop-runner-bin.js +8 -10
- package/dist/loops.d.ts +13 -13
- package/dist/loops.js +6 -8
- package/dist/mcp/bin.js +5 -7
- package/dist/mcp/bin.js.map +1 -1
- package/dist/mcp/index.d.ts +6 -6
- package/dist/mcp/index.js +12 -14
- package/dist/mcp/index.js.map +1 -1
- package/dist/platform.js +0 -2
- package/dist/platform.js.map +1 -1
- package/dist/primeintellect/index.js +1 -2
- package/dist/primeintellect/index.js.map +1 -1
- package/dist/profile-DbfaMTdk.d.ts +233 -0
- package/dist/profiles.d.ts +1 -1
- package/dist/profiles.js +0 -1
- package/dist/profiles.js.map +1 -1
- package/dist/{supervise-DmYOug5f.d.ts → supervise-BLPI50-w.d.ts} +3 -3
- package/dist/{types-ByAYqlVb.d.ts → types-B3vAW0Oq.d.ts} +1 -1
- package/dist/{prepare-CtdtsFNG.d.ts → types-CWqfCO8s.d.ts} +67 -298
- package/dist/{types-BC3bZpH0.d.ts → types-CmYCMbFT.d.ts} +12 -54
- package/dist/{types-1d5QGK3t.d.ts → types-CmnA2iL3.d.ts} +3 -3
- package/dist/{worktree-fanout-CPprU-qI.d.ts → worktree-fanout-DCA3G4bO.d.ts} +3 -3
- package/package.json +14 -16
- package/skills/build-with-agent-runtime/SKILL.md +122 -213
- package/dist/chunk-6O73TRHW.js +0 -142
- package/dist/chunk-6O73TRHW.js.map +0 -1
- package/dist/chunk-AEG3NGJ2.js.map +0 -1
- package/dist/chunk-C3UKLQ54.js.map +0 -1
- package/dist/chunk-CNH7DF7Z.js.map +0 -1
- package/dist/chunk-D3H7F6L2.js +0 -626
- package/dist/chunk-D3H7F6L2.js.map +0 -1
- package/dist/chunk-DGUM43GV.js +0 -11
- package/dist/chunk-DGUM43GV.js.map +0 -1
- package/dist/chunk-EP6RVHMX.js.map +0 -1
- package/dist/chunk-HGRW27YY.js +0 -214
- package/dist/chunk-HGRW27YY.js.map +0 -1
- package/dist/chunk-ISTDY47H.js +0 -849
- package/dist/chunk-ISTDY47H.js.map +0 -1
- package/dist/chunk-PCURO3DL.js +0 -661
- package/dist/chunk-PCURO3DL.js.map +0 -1
- package/dist/chunk-QDSOD7RC.js.map +0 -1
- package/dist/chunk-TVJQAYQM.js.map +0 -1
- package/dist/chunk-VSWBYWFK.js.map +0 -1
- package/dist/chunk-VYA2YEKA.js.map +0 -1
- package/dist/generator-YkAQrOoD.d.ts +0 -382
- package/dist/improve-BN3HyXIO.d.ts +0 -172
- package/dist/lifecycle.d.ts +0 -870
- package/dist/lifecycle.js +0 -981
- package/dist/lifecycle.js.map +0 -1
- package/dist/mcp-serve-verifier-DQQDbuyz.d.ts +0 -34
- package/skills/agent-runtime-adoption/SKILL.md +0 -246
- /package/dist/{chunk-U33YZ7B2.js.map → chunk-FXF2OL34.js.map} +0 -0
- /package/dist/{chunk-XP5KDM3R.js.map → chunk-SGQ4YIQW.js.map} +0 -0
- /package/dist/{chunk-33OG2NN3.js.map → chunk-WYC2XJF2.js.map} +0 -0
- /package/dist/{chunk-ZEYAT33L.js.map → chunk-Y3SRWZMP.js.map} +0 -0
package/dist/knowledge.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { KnowledgeReadinessSpec, BuildEvalKnowledgeBundleOptions, KnowledgeBaseQualityOptions, KnowledgeImprovementResult, KnowledgeImprovementOptions } from '@tangle-network/agent-knowledge';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import '
|
|
7
|
-
import './
|
|
8
|
-
import './
|
|
1
|
+
import { PromoteKnowledgeCandidateOptions, RagKnowledgeUpdateResult, KnowledgeReadinessSpec, BuildEvalKnowledgeBundleOptions, KnowledgeBaseQualityOptions, KnowledgeImprovementResult, KnowledgeImprovementOptions } from '@tangle-network/agent-knowledge';
|
|
2
|
+
import { a as AgentImprovementActivationResultStore, c as AgentImprovementActivationTransition, A as AgentImprovementActivationReconciliation } from './activation-B0ZD7nfX.js';
|
|
3
|
+
import { AgentCandidateKnowledge, AgentCandidateCapturedArtifact, AgentCandidateBundle } from '@tangle-network/agent-interface';
|
|
4
|
+
import { b as AgentCandidateOutputArtifactPort } from './types-CWqfCO8s.js';
|
|
5
|
+
import { E as ExecutorConfig } from './coordination-BFE3Den7.js';
|
|
6
|
+
import { a as SuperviseOptions, S as SupervisorProfile } from './supervise-BLPI50-w.js';
|
|
7
|
+
import { B as Budget, b as SupervisedResult } from './types-CmnA2iL3.js';
|
|
8
|
+
import { D as DeliverableSpec } from './completion-gate-C80jiRfN.js';
|
|
9
9
|
import '@tangle-network/agent-eval';
|
|
10
|
+
import './substrate-DO2GHNg2.js';
|
|
11
|
+
import './types-B3vAW0Oq.js';
|
|
10
12
|
import '@tangle-network/sandbox';
|
|
11
13
|
import './types-BwoZWq-i.js';
|
|
12
14
|
import './sanitize-BTSsdBXw.js';
|
|
@@ -16,6 +18,18 @@ import './environment-provider.js';
|
|
|
16
18
|
import '@tangle-network/agent-interface/environment-provider';
|
|
17
19
|
import '@tangle-network/agent-profile-materialize';
|
|
18
20
|
|
|
21
|
+
interface CreateKnowledgeImprovementActivationExecutorOptions extends Omit<PromoteKnowledgeCandidateOptions, 'root' | 'candidate'> {
|
|
22
|
+
root: string;
|
|
23
|
+
identity: string;
|
|
24
|
+
results: AgentImprovementActivationResultStore;
|
|
25
|
+
}
|
|
26
|
+
interface KnowledgeImprovementActivationExecutor {
|
|
27
|
+
transition: AgentImprovementActivationTransition;
|
|
28
|
+
reconcile: AgentImprovementActivationReconciliation;
|
|
29
|
+
}
|
|
30
|
+
/** Apply or restore one local knowledge candidate through the shared activation contract. */
|
|
31
|
+
declare function createKnowledgeImprovementActivationExecutor(options: CreateKnowledgeImprovementActivationExecutorOptions): KnowledgeImprovementActivationExecutor;
|
|
32
|
+
|
|
19
33
|
/** Standing prompt for a supervisor that grows a shared knowledge base through spawned researchers. */
|
|
20
34
|
declare const RESEARCH_SUPERVISOR_SYSTEM_PROMPT: string;
|
|
21
35
|
interface KnowledgeReadinessCheckInput {
|
|
@@ -42,7 +56,7 @@ interface SupervisedKnowledgeUpdateResult {
|
|
|
42
56
|
applied: boolean;
|
|
43
57
|
summary: string;
|
|
44
58
|
supervised: SupervisedResult<unknown>;
|
|
45
|
-
metadata:
|
|
59
|
+
metadata: NonNullable<RagKnowledgeUpdateResult['metadata']>;
|
|
46
60
|
}
|
|
47
61
|
interface SupervisedKnowledgeUpdateOptions {
|
|
48
62
|
root: string;
|
|
@@ -84,6 +98,7 @@ interface RunKnowledgeImprovementJobOptions extends Omit<KnowledgeImprovementOpt
|
|
|
84
98
|
superviseOptions?: Partial<Omit<SuperviseOptions, 'budget' | 'backend' | 'deliverable' | 'makeWorkerAgent' | 'allowedModels'>>;
|
|
85
99
|
allowedModels?: readonly string[];
|
|
86
100
|
runSupervised?: (profile: SupervisorProfile, task: unknown, opts: SuperviseOptions) => Promise<SupervisedResult<unknown>>;
|
|
101
|
+
candidateArtifacts?: AgentCandidateOutputArtifactPort;
|
|
87
102
|
onMeasurement?: (measurement: KnowledgeImprovementJobMeasurement) => Promise<void> | void;
|
|
88
103
|
}
|
|
89
104
|
interface KnowledgeImprovementJobMeasurement {
|
|
@@ -96,16 +111,27 @@ interface KnowledgeImprovementJobMeasurement {
|
|
|
96
111
|
iterations: number;
|
|
97
112
|
inputTokens: number;
|
|
98
113
|
outputTokens: number;
|
|
114
|
+
usdKnown: boolean;
|
|
99
115
|
usd: number;
|
|
100
116
|
ms: number;
|
|
101
117
|
};
|
|
102
118
|
}
|
|
103
119
|
interface KnowledgeImprovementJobResult {
|
|
104
120
|
improvement: KnowledgeImprovementResult;
|
|
121
|
+
knowledge?: KnowledgeImprovementCandidatePair;
|
|
105
122
|
measurement: KnowledgeImprovementJobMeasurement;
|
|
106
|
-
promoted: boolean;
|
|
107
123
|
blocked: boolean;
|
|
108
124
|
}
|
|
125
|
+
interface KnowledgeImprovementCandidatePair {
|
|
126
|
+
reference: AgentCandidateKnowledge['candidate'];
|
|
127
|
+
evaluation: AgentCandidateCapturedArtifact;
|
|
128
|
+
baseline: AgentCandidateKnowledge['snapshot'];
|
|
129
|
+
candidate: AgentCandidateKnowledge['snapshot'];
|
|
130
|
+
}
|
|
131
|
+
interface KnowledgeImprovementExperimentBundles {
|
|
132
|
+
baseline: AgentCandidateBundle;
|
|
133
|
+
candidate: AgentCandidateBundle;
|
|
134
|
+
}
|
|
109
135
|
interface AgentKnowledgeReadinessCheckOptions {
|
|
110
136
|
goal: string;
|
|
111
137
|
readinessSpecs?: readonly KnowledgeReadinessSpec[];
|
|
@@ -116,7 +142,9 @@ interface AgentKnowledgeReadinessCheckOptions {
|
|
|
116
142
|
}
|
|
117
143
|
/** Build the default readiness check backed by `@tangle-network/agent-knowledge` validation and scoring. */
|
|
118
144
|
declare function createAgentKnowledgeReadinessCheck(options: AgentKnowledgeReadinessCheckOptions): KnowledgeReadinessCheck;
|
|
119
|
-
/**
|
|
145
|
+
/** Produce a frozen KB candidate while leaving live knowledge content unchanged. */
|
|
120
146
|
declare function runKnowledgeImprovementJob(options: RunKnowledgeImprovementJobOptions): Promise<KnowledgeImprovementJobResult>;
|
|
147
|
+
/** Attach both frozen knowledge inputs to one otherwise-identical bundle pair. */
|
|
148
|
+
declare function buildKnowledgeImprovementExperimentBundles(bundle: AgentCandidateBundle, knowledge: KnowledgeImprovementCandidatePair): KnowledgeImprovementExperimentBundles;
|
|
121
149
|
|
|
122
|
-
export { type AgentKnowledgeReadinessCheckOptions, type KnowledgeImprovementJobMeasurement, type KnowledgeImprovementJobResult, type KnowledgeReadinessCheck, type KnowledgeReadinessCheckInput, type KnowledgeReadinessCheckResult, RESEARCH_SUPERVISOR_SYSTEM_PROMPT, type RunKnowledgeImprovementJobOptions, type SupervisedKnowledgeUpdateInput, type SupervisedKnowledgeUpdateOptions, type SupervisedKnowledgeUpdateResult, type SupervisedKnowledgeUpdater, createAgentKnowledgeReadinessCheck, createSupervisedKnowledgeUpdater, formatSupervisedKnowledgeTask, knowledgeReadinessDeliverable, runKnowledgeImprovementJob, runSupervisedKnowledgeUpdate };
|
|
150
|
+
export { type AgentKnowledgeReadinessCheckOptions, type CreateKnowledgeImprovementActivationExecutorOptions, type KnowledgeImprovementActivationExecutor, type KnowledgeImprovementCandidatePair, type KnowledgeImprovementExperimentBundles, type KnowledgeImprovementJobMeasurement, type KnowledgeImprovementJobResult, type KnowledgeReadinessCheck, type KnowledgeReadinessCheckInput, type KnowledgeReadinessCheckResult, RESEARCH_SUPERVISOR_SYSTEM_PROMPT, type RunKnowledgeImprovementJobOptions, type SupervisedKnowledgeUpdateInput, type SupervisedKnowledgeUpdateOptions, type SupervisedKnowledgeUpdateResult, type SupervisedKnowledgeUpdater, buildKnowledgeImprovementExperimentBundles, createAgentKnowledgeReadinessCheck, createKnowledgeImprovementActivationExecutor, createSupervisedKnowledgeUpdater, formatSupervisedKnowledgeTask, knowledgeReadinessDeliverable, runKnowledgeImprovementJob, runSupervisedKnowledgeUpdate };
|
package/dist/knowledge.js
CHANGED
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RESEARCH_SUPERVISOR_SYSTEM_PROMPT,
|
|
3
|
+
buildKnowledgeImprovementExperimentBundles,
|
|
3
4
|
createAgentKnowledgeReadinessCheck,
|
|
5
|
+
createKnowledgeImprovementActivationExecutor,
|
|
4
6
|
createSupervisedKnowledgeUpdater,
|
|
5
7
|
formatSupervisedKnowledgeTask,
|
|
6
8
|
knowledgeReadinessDeliverable,
|
|
7
9
|
runKnowledgeImprovementJob,
|
|
8
10
|
runSupervisedKnowledgeUpdate
|
|
9
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-3XKSBI2U.js";
|
|
10
12
|
import "./chunk-5QOB7H74.js";
|
|
11
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-BLQIYRVR.js";
|
|
14
|
+
import "./chunk-PSOCBNM3.js";
|
|
15
|
+
import "./chunk-YOLKCWRV.js";
|
|
16
|
+
import "./chunk-UQ6PNNXM.js";
|
|
12
17
|
import "./chunk-DPEUKJRO.js";
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-HZDEXTSL.js";
|
|
19
|
+
import "./chunk-IMSNJSXH.js";
|
|
20
|
+
import "./chunk-M6MD6JBS.js";
|
|
16
21
|
import "./chunk-3MDZX7YU.js";
|
|
22
|
+
import "./chunk-FD2MBMOH.js";
|
|
17
23
|
import "./chunk-M22PL4GH.js";
|
|
18
|
-
import "./chunk-EP6RVHMX.js";
|
|
19
24
|
import "./chunk-YEJR7IXO.js";
|
|
20
|
-
import "./chunk-DGUM43GV.js";
|
|
21
25
|
export {
|
|
22
26
|
RESEARCH_SUPERVISOR_SYSTEM_PROMPT,
|
|
27
|
+
buildKnowledgeImprovementExperimentBundles,
|
|
23
28
|
createAgentKnowledgeReadinessCheck,
|
|
29
|
+
createKnowledgeImprovementActivationExecutor,
|
|
24
30
|
createSupervisedKnowledgeUpdater,
|
|
25
31
|
formatSupervisedKnowledgeTask,
|
|
26
32
|
knowledgeReadinessDeliverable,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Scenario } from '@tangle-network/agent-eval/campaign';
|
|
2
2
|
import { SelfImproveOptions, SelfImproveResult } from '@tangle-network/agent-eval/contract';
|
|
3
|
-
import { R as RunAnalystLoopOpts, a as RunAnalystLoopResult } from './types-
|
|
3
|
+
import { R as RunAnalystLoopOpts, a as RunAnalystLoopResult } from './types-CmYCMbFT.js';
|
|
4
4
|
import { F as FactCandidate, C as CreateKbGateOptions } from './kb-gate-CwHO0vz6.js';
|
|
5
|
-
import { B as Budget } from './types-
|
|
6
|
-
import { A as AuthoredHarness, W as WinnerStrategy, a as WorktreeFanoutOptions, b as WorktreePatchArtifact } from './worktree-fanout-
|
|
5
|
+
import { B as Budget } from './types-CmnA2iL3.js';
|
|
6
|
+
import { A as AuthoredHarness, W as WinnerStrategy, a as WorktreeFanoutOptions, b as WorktreePatchArtifact } from './worktree-fanout-DCA3G4bO.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
*
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export { L as LoopRunnerCliArgs, e as LoopRunnerCliResult, p as parseLoopRunnerArgv, k as runLoopRunnerCli } from './loop-runner-bin-
|
|
2
|
+
export { L as LoopRunnerCliArgs, e as LoopRunnerCliResult, p as parseLoopRunnerArgv, k as runLoopRunnerCli } from './loop-runner-bin-Cn1N2rRo.js';
|
|
3
3
|
import '@tangle-network/agent-eval/campaign';
|
|
4
4
|
import '@tangle-network/agent-eval/contract';
|
|
5
|
-
import './types-
|
|
5
|
+
import './types-CmYCMbFT.js';
|
|
6
6
|
import '@tangle-network/agent-eval';
|
|
7
7
|
import './kb-gate-CwHO0vz6.js';
|
|
8
|
-
import './types-
|
|
8
|
+
import './types-CmnA2iL3.js';
|
|
9
9
|
import '@tangle-network/agent-interface';
|
|
10
10
|
import '@tangle-network/sandbox';
|
|
11
|
-
import './types-
|
|
11
|
+
import './types-B3vAW0Oq.js';
|
|
12
12
|
import './types-BwoZWq-i.js';
|
|
13
|
-
import './worktree-fanout-
|
|
14
|
-
import './completion-gate-
|
|
13
|
+
import './worktree-fanout-DCA3G4bO.js';
|
|
14
|
+
import './completion-gate-C80jiRfN.js';
|
|
15
15
|
import '@tangle-network/agent-profile-materialize';
|
|
16
16
|
import './local-harness-ZqCx51u7.js';
|
|
17
17
|
import 'node:child_process';
|
package/dist/loop-runner-bin.js
CHANGED
|
@@ -2,21 +2,19 @@
|
|
|
2
2
|
import {
|
|
3
3
|
parseLoopRunnerArgv,
|
|
4
4
|
runLoopRunnerCli
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-SGQ4YIQW.js";
|
|
6
6
|
import "./chunk-SGKPNBXE.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-FXF2OL34.js";
|
|
8
|
+
import "./chunk-Q2JSAVQ3.js";
|
|
9
|
+
import "./chunk-UQ6PNNXM.js";
|
|
9
10
|
import "./chunk-DPEUKJRO.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-VSWBYWFK.js";
|
|
11
|
+
import "./chunk-HZDEXTSL.js";
|
|
12
|
+
import "./chunk-IMSNJSXH.js";
|
|
13
|
+
import "./chunk-M6MD6JBS.js";
|
|
14
14
|
import "./chunk-3MDZX7YU.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-FD2MBMOH.js";
|
|
16
16
|
import "./chunk-M22PL4GH.js";
|
|
17
|
-
import "./chunk-EP6RVHMX.js";
|
|
18
17
|
import "./chunk-YEJR7IXO.js";
|
|
19
|
-
import "./chunk-DGUM43GV.js";
|
|
20
18
|
export {
|
|
21
19
|
parseLoopRunnerArgv,
|
|
22
20
|
runLoopRunnerCli
|
package/dist/loops.d.ts
CHANGED
|
@@ -2,25 +2,25 @@ import { ChatClient, RunRecord, HarnessType, AgentProfile, MaximumCharge, Analys
|
|
|
2
2
|
export { AnalystFinding, DefaultVerdict, computeFindingId, makeFinding } from '@tangle-network/agent-eval';
|
|
3
3
|
import { SandboxEvent, SandboxInstance, CreateSandboxOptions, PromptOptions, TaskOptions } from '@tangle-network/sandbox';
|
|
4
4
|
export { AgentProfile, CreateSandboxOptions, SandboxEvent, SandboxInstance } from '@tangle-network/sandbox';
|
|
5
|
-
import { a as ResultBlobStore, f as SpawnJournal, N as NodeId, j as SpawnEvent, E as ExecutorFactory, A as Agent, B as Budget, S as Scope, h as Settled, b as SupervisedResult, i as Spend, U as UsageEvent, e as ExecutorRegistry, k as Supervisor } from './types-
|
|
6
|
-
export { d as AgentSpec, c as Executor, l as ExecutorContext, m as ExecutorResult, R as Runtime, n as SupervisorOpts, T as TreeView, W as WidenGate } from './types-
|
|
7
|
-
import { M as MakeWorkerAgent, A as AnalystRegistry, o as CoordinationTools, n as CoordinationEvent, as as QuestionPolicy, E as ExecutorConfig } from './coordination-
|
|
8
|
-
export { bh as BusEvent, bi as BusRecord, bj as BusStats, bk as EventBus, bl as ProviderSeam, bm as PublishOptions, bn as cliWorktreeExecutor, bo as createEventBus, bp as createExecutor, bq as createExecutorRegistry } from './coordination-
|
|
9
|
-
import { R as RuntimeHooks, I as Iteration, S as SandboxClient, D as Driver, A as AgentRunSpec, O as OutputAdapter, V as Validator, E as ExecCtx, t as LoopWinner, u as LoopLineageOptions, v as LoopResult, L as LoopTokenUsage, M as MountRecorder, w as SelectionReceipt } from './types-
|
|
10
|
-
export { x as LoopDecisionPayload, y as LoopEndedPayload, z as LoopIterationDispatchPayload, B as LoopIterationEndedPayload, C as LoopIterationStartedPayload, F as LoopPlanDescription, G as LoopPlanPayload,
|
|
5
|
+
import { a as ResultBlobStore, f as SpawnJournal, N as NodeId, j as SpawnEvent, E as ExecutorFactory, A as Agent, B as Budget, S as Scope, h as Settled, b as SupervisedResult, i as Spend, U as UsageEvent, e as ExecutorRegistry, k as Supervisor } from './types-CmnA2iL3.js';
|
|
6
|
+
export { d as AgentSpec, c as Executor, l as ExecutorContext, m as ExecutorResult, R as Runtime, n as SupervisorOpts, T as TreeView, W as WidenGate } from './types-CmnA2iL3.js';
|
|
7
|
+
import { M as MakeWorkerAgent, A as AnalystRegistry, o as CoordinationTools, n as CoordinationEvent, as as QuestionPolicy, E as ExecutorConfig } from './coordination-BFE3Den7.js';
|
|
8
|
+
export { bh as BusEvent, bi as BusRecord, bj as BusStats, bk as EventBus, bl as ProviderSeam, bm as PublishOptions, bn as cliWorktreeExecutor, bo as createEventBus, bp as createExecutor, bq as createExecutorRegistry } from './coordination-BFE3Den7.js';
|
|
9
|
+
import { R as RuntimeHooks, I as Iteration, S as SandboxClient, D as Driver, A as AgentRunSpec, O as OutputAdapter, V as Validator, E as ExecCtx, t as LoopWinner, u as LoopLineageOptions, v as LoopResult, L as LoopTokenUsage, M as MountRecorder, w as SelectionReceipt } from './types-B3vAW0Oq.js';
|
|
10
|
+
export { x as LoopDecisionPayload, y as LoopEndedPayload, z as LoopIterationDispatchPayload, B as LoopIterationEndedPayload, C as LoopIterationStartedPayload, F as LoopPlanDescription, G as LoopPlanPayload, a as LoopSandboxPlacement, H as LoopStartedPayload, J as LoopTeardownFailedPayload, r as LoopTraceEmitter, b as LoopTraceEvent, K as MountManifestEntry, N as RunProvenance, P as ValidationCtx } from './types-B3vAW0Oq.js';
|
|
11
11
|
import { RunProfileMatrixResult, Scenario, ProfileDispatchFn, JudgeConfig, RunProfileMatrixOptions, DispatchFn } from '@tangle-network/agent-eval/campaign';
|
|
12
12
|
export { AgentEnvironmentProviderRef, AgentEnvironmentProviderRegistry, ProviderAsSandboxClientOptions, ProviderExecutorOptions, SandboxClientProviderOptions, createAgentEnvironmentProviderRegistry, providerAsExecutor, providerAsSandboxClient, resolveAgentEnvironmentProvider, sandboxClientAsProvider } from './environment-provider.js';
|
|
13
|
-
import { C as CorpusRecord, c as Corpus, O as Outcome, S as ScopeAnalyzeInput, d as AssertTraceDerivedFindings, e as SteerContext, f as ScopeAnalyst, F as FanoutOptions, g as CombinatorShape, h as ScopeWidenGate, L as LoopUntilSpec, P as PanelSpec, i as PipelineStage, W as WinnerStrategy, j as FanoutWinnerSelector, V as VerifySpec, k as WidenSpec, l as CorpusFilter, R as RenderCorpusToInstructionsOptions, D as DefinePersonaInput, m as Persona, n as RunPersonifiedOptions, o as ShapeRegistry, p as LoopShape, E as EqualKArm, q as EqualKOnCostOptions, r as EqualKVerdict, T as TrajectoryReportOptions, s as TrajectoryReport } from './worktree-fanout-
|
|
14
|
-
export { A as AuthoredHarness, t as DefinePersona, u as EqualKOnCost, v as Fanout, w as FanoutSynthesis, x as FlatWidenGate, y as LoopUntil, z as LoopUntilState, B as Panel, G as PanelJudge, H as PanelVerdict, I as PatchDeliverableOptions, J as PersonaContext, K as PersonaExecutors, M as Pipeline, N as RenderCorpusToInstructions, Q as RunPersonified, U as ShapeBudget, X as ShapeContext, Y as TrajectoryNode, Z as TrajectoryReportFn, _ as Verify, $ as Widen, a0 as WidenDecision, a1 as WidenLineage, a2 as WorktreeCliExecutorOptions, a as WorktreeFanoutOptions, b as WorktreePatchArtifact, a3 as createWorktreeCliExecutor, a4 as patchDelivered, a5 as worktreeFanout } from './worktree-fanout-
|
|
15
|
-
import { b as AnalystRegistryLike } from './types-
|
|
13
|
+
import { C as CorpusRecord, c as Corpus, O as Outcome, S as ScopeAnalyzeInput, d as AssertTraceDerivedFindings, e as SteerContext, f as ScopeAnalyst, F as FanoutOptions, g as CombinatorShape, h as ScopeWidenGate, L as LoopUntilSpec, P as PanelSpec, i as PipelineStage, W as WinnerStrategy, j as FanoutWinnerSelector, V as VerifySpec, k as WidenSpec, l as CorpusFilter, R as RenderCorpusToInstructionsOptions, D as DefinePersonaInput, m as Persona, n as RunPersonifiedOptions, o as ShapeRegistry, p as LoopShape, E as EqualKArm, q as EqualKOnCostOptions, r as EqualKVerdict, T as TrajectoryReportOptions, s as TrajectoryReport } from './worktree-fanout-DCA3G4bO.js';
|
|
14
|
+
export { A as AuthoredHarness, t as DefinePersona, u as EqualKOnCost, v as Fanout, w as FanoutSynthesis, x as FlatWidenGate, y as LoopUntil, z as LoopUntilState, B as Panel, G as PanelJudge, H as PanelVerdict, I as PatchDeliverableOptions, J as PersonaContext, K as PersonaExecutors, M as Pipeline, N as RenderCorpusToInstructions, Q as RunPersonified, U as ShapeBudget, X as ShapeContext, Y as TrajectoryNode, Z as TrajectoryReportFn, _ as Verify, $ as Widen, a0 as WidenDecision, a1 as WidenLineage, a2 as WorktreeCliExecutorOptions, a as WorktreeFanoutOptions, b as WorktreePatchArtifact, a3 as createWorktreeCliExecutor, a4 as patchDelivered, a5 as worktreeFanout } from './worktree-fanout-DCA3G4bO.js';
|
|
15
|
+
import { b as AnalystRegistryLike } from './types-CmYCMbFT.js';
|
|
16
16
|
import { AgentProfile as AgentProfile$1 } from '@tangle-network/agent-interface';
|
|
17
17
|
import { R as RouterConfig, T as ToolLoopChat, a as ToolLoopCompactionOptions } from './sanitize-BTSsdBXw.js';
|
|
18
18
|
export { j as RouterChatResult, k as RouterChatToolsResult, l as RouterToolCall, m as RouterToolLoopResult, n as ToolLoopCompaction, b as ToolSpec, r as routerBrain, o as routerChatWithTools, p as routerChatWithUsage, q as routerToolLoop } from './sanitize-BTSsdBXw.js';
|
|
19
19
|
import { R as RuntimeStreamEvent, c as AgentExecutionBackend, f as AgentTaskStatus, B as BackendErrorDetail } from './types-BwoZWq-i.js';
|
|
20
|
-
import { D as DeliverableSpec } from './completion-gate-
|
|
21
|
-
export { g as WorktreeCommandResult, h as WorktreeProfileMaterializationReceipt, i as gateOnDeliverable } from './completion-gate-
|
|
22
|
-
import { S as SupervisorProfile } from './supervise-
|
|
23
|
-
export { D as DriveHarness, a as SuperviseOptions, b as SupervisorAgentDeps, s as supervise, c as supervisorAgent, w as workerFromBackend } from './supervise-
|
|
20
|
+
import { D as DeliverableSpec } from './completion-gate-C80jiRfN.js';
|
|
21
|
+
export { g as WorktreeCommandResult, h as WorktreeProfileMaterializationReceipt, i as gateOnDeliverable } from './completion-gate-C80jiRfN.js';
|
|
22
|
+
import { S as SupervisorProfile } from './supervise-BLPI50-w.js';
|
|
23
|
+
export { D as DriveHarness, a as SuperviseOptions, b as SupervisorAgentDeps, s as supervise, c as supervisorAgent, w as workerFromBackend } from './supervise-BLPI50-w.js';
|
|
24
24
|
import { stuckLoopView, toolWasteView } from '@tangle-network/agent-eval/pipelines';
|
|
25
25
|
export { AgentEnvironment, AgentEnvironmentCapabilities, AgentEnvironmentEvent, AgentEnvironmentProvider, AgentEnvironmentQuery, AgentEnvironmentStatus, AgentEnvironmentSummary, AgentProfileRef, AgentSession, AgentSessionRef, AgentSessionStatus, AgentTurnInput, AgentTurnResult, CheckpointRef, CheckpointRequest, CreateAgentEnvironmentInput, ExecRequest, ExecResult, ForkRequest, PlacementInfo, ResourceRequest, WorkspaceRequest } from '@tangle-network/agent-interface/environment-provider';
|
|
26
26
|
import './substrate-DO2GHNg2.js';
|
package/dist/loops.js
CHANGED
|
@@ -102,7 +102,8 @@ import {
|
|
|
102
102
|
watchTrace,
|
|
103
103
|
widen,
|
|
104
104
|
worktreeFanout
|
|
105
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-FXF2OL34.js";
|
|
106
|
+
import "./chunk-Q2JSAVQ3.js";
|
|
106
107
|
import {
|
|
107
108
|
acquireSandbox,
|
|
108
109
|
asAuthoredProfile,
|
|
@@ -140,24 +141,23 @@ import {
|
|
|
140
141
|
supervisorAgent,
|
|
141
142
|
supervisorInstructions,
|
|
142
143
|
workerFromBackend
|
|
143
|
-
} from "./chunk-
|
|
144
|
+
} from "./chunk-UQ6PNNXM.js";
|
|
144
145
|
import "./chunk-DPEUKJRO.js";
|
|
145
|
-
import "./chunk-AEG3NGJ2.js";
|
|
146
146
|
import {
|
|
147
147
|
assertModelAllowed
|
|
148
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-HZDEXTSL.js";
|
|
149
149
|
import {
|
|
150
150
|
InMemoryResultBlobStore,
|
|
151
151
|
InMemorySpawnJournal,
|
|
152
152
|
contentAddress
|
|
153
|
-
} from "./chunk-
|
|
153
|
+
} from "./chunk-IMSNJSXH.js";
|
|
154
154
|
import {
|
|
155
155
|
createAgentEnvironmentProviderRegistry,
|
|
156
156
|
providerAsExecutor,
|
|
157
157
|
providerAsSandboxClient,
|
|
158
158
|
resolveAgentEnvironmentProvider,
|
|
159
159
|
sandboxClientAsProvider
|
|
160
|
-
} from "./chunk-
|
|
160
|
+
} from "./chunk-M6MD6JBS.js";
|
|
161
161
|
import "./chunk-3MDZX7YU.js";
|
|
162
162
|
import {
|
|
163
163
|
createSandboxToolPartState,
|
|
@@ -166,9 +166,7 @@ import {
|
|
|
166
166
|
mapSandboxToolEvent,
|
|
167
167
|
sumSandboxUsage
|
|
168
168
|
} from "./chunk-M22PL4GH.js";
|
|
169
|
-
import "./chunk-EP6RVHMX.js";
|
|
170
169
|
import "./chunk-YEJR7IXO.js";
|
|
171
|
-
import "./chunk-DGUM43GV.js";
|
|
172
170
|
export {
|
|
173
171
|
FileCorpus,
|
|
174
172
|
InMemoryCorpus,
|
package/dist/mcp/bin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
readTraceContextFromEnv
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-Y3SRWZMP.js";
|
|
5
5
|
import {
|
|
6
6
|
resolveRouterBaseUrl
|
|
7
7
|
} from "../chunk-NURIQBJQ.js";
|
|
@@ -9,16 +9,14 @@ import {
|
|
|
9
9
|
DelegationTaskQueue,
|
|
10
10
|
FileDelegationStore,
|
|
11
11
|
createMcpServer
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-UQ6PNNXM.js";
|
|
13
13
|
import "../chunk-DPEUKJRO.js";
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
14
|
+
import "../chunk-HZDEXTSL.js";
|
|
15
|
+
import "../chunk-IMSNJSXH.js";
|
|
16
|
+
import "../chunk-M6MD6JBS.js";
|
|
17
17
|
import "../chunk-3MDZX7YU.js";
|
|
18
18
|
import "../chunk-M22PL4GH.js";
|
|
19
|
-
import "../chunk-EP6RVHMX.js";
|
|
20
19
|
import "../chunk-YEJR7IXO.js";
|
|
21
|
-
import "../chunk-DGUM43GV.js";
|
|
22
20
|
|
|
23
21
|
// src/mcp/delegate-supervisor-provisioning.ts
|
|
24
22
|
var DEFAULT_SUPERVISOR_MODEL = "moonshotai/kimi-k2.6";
|
package/dist/mcp/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/mcp/delegate-supervisor-provisioning.ts","../../src/mcp/bin.ts"],"sourcesContent":["/**\n *\n * Resolve the `delegate` supervisor substrate (router brain + worker backend) from env, so the\n * `agent-runtime-mcp` bin can serve the ONE generic `delegate` verb by env, over the SAME stdio\n * invocation a consumer already mounts.\n *\n * `delegate` is wired into `createMcpServer` via `McpServerOptions.delegateSupervisor`, which needs a\n * router (the supervisor brain's substrate) and a backend (WHERE the authored workers run). Inside a\n * sandbox child the natural backend is `sandbox`: authored workers run as sub-sandboxes through the\n * SAME `SandboxClient` the bin already loads from `TANGLE_API_KEY`. The brain's router reuses the\n * repo's `resolveRouterBaseUrl` convention\n * (`TANGLE_ROUTER_URL` / `TANGLE_ROUTER_BASE_URL`), normalised to an OpenAI-compatible `/v1` endpoint,\n * keyed by `TANGLE_API_KEY`.\n *\n * @experimental\n */\n\nimport type { BackendType } from '@tangle-network/sandbox'\nimport { type RouterEnv, resolveRouterBaseUrl } from '../model-resolution.js'\nimport type { SandboxClient } from '../runtime'\nimport type { RouterConfig } from '../runtime/router-client'\nimport type { ExecutorConfig } from '../runtime/supervise/runtime'\nimport type { DelegateHandlerOptions } from './tools/delegate'\n\nconst DEFAULT_SUPERVISOR_MODEL = 'moonshotai/kimi-k2.6'\nconst DEFAULT_WORKER_HARNESS = 'opencode'\n\nfunction trimmed(value: string | undefined): string | undefined {\n const v = value?.trim()\n return v ? v : undefined\n}\n\n/** True when the operator opted the generic `delegate` verb in (`MCP_ENABLE_DELEGATE=1`). Default off:\n * the wiring is additive, so consumers that do not enable it are unaffected. */\nexport function delegateEnabled(env: NodeJS.ProcessEnv = process.env): boolean {\n return env.MCP_ENABLE_DELEGATE === '1'\n}\n\n/** Resolve the supervisor brain's router substrate from env. The key falls back through the platform\n * key the bin already requires; the base reuses `resolveRouterBaseUrl`, normalised to `/v1`. */\nfunction resolveRouter(env: NodeJS.ProcessEnv): RouterConfig {\n const routerKey = trimmed(env.MCP_SUPERVISOR_ROUTER_KEY) ?? trimmed(env.TANGLE_API_KEY) ?? ''\n const base = trimmed(env.MCP_SUPERVISOR_ROUTER_BASE_URL) ?? resolveRouterBaseUrl(env as RouterEnv)\n const routerBaseUrl = /\\/v\\d+\\/?$/.test(base)\n ? base.replace(/\\/$/, '')\n : `${base.replace(/\\/$/, '')}/v1`\n const model =\n trimmed(env.MCP_SUPERVISOR_MODEL) ??\n trimmed(env.MCP_WORKER_MODEL) ??\n trimmed(env.WORKER_MODEL) ??\n DEFAULT_SUPERVISOR_MODEL\n return { routerBaseUrl, routerKey, model }\n}\n\n/**\n * Build the `delegateSupervisor` substrate for `createMcpServer` from env + the bin's loaded\n * `SandboxClient`. Returns `undefined` when `delegate` is not opted in, so the caller mounts it only\n * when asked. The worker backend is `sandbox` (authored workers run as sub-sandboxes via the same\n * client) on the harness named by `MCP_DELEGATE_WORKER_HARNESS` (default `opencode`).\n */\nexport function resolveDelegateSupervisor(\n sandboxClient: SandboxClient,\n env: NodeJS.ProcessEnv = process.env,\n): DelegateHandlerOptions | undefined {\n if (!delegateEnabled(env)) return undefined\n const router = resolveRouter(env)\n const harness = (trimmed(env.MCP_DELEGATE_WORKER_HARNESS) ??\n DEFAULT_WORKER_HARNESS) as BackendType\n const backend: ExecutorConfig = {\n backend: 'sandbox',\n harness,\n sandboxClient,\n }\n return {\n router,\n backend,\n model: router.model,\n }\n}\n","#!/usr/bin/env node\n\n/**\n *\n * `agent-runtime-mcp` — stdio MCP server entry point.\n *\n * Serves the ONE generic `delegate` verb (opt-in via `MCP_ENABLE_DELEGATE=1`): one intent → a\n * supervisor that authors + drives its own worker over `supervise()`, returning the delivered output\n * with its cost. The supervisor brain runs on the router; authored workers run as sub-sandboxes\n * through the same `SandboxClient` the bin loads from `TANGLE_API_KEY`. The queue-bound tools\n * (`delegate_feedback`, `delegation_status`, `delegation_history`) are always served.\n *\n * Environment variables:\n * TANGLE_API_KEY required — passed to `new Sandbox({ apiKey })`\n * SANDBOX_BASE_URL optional — sandbox-SDK base URL override\n * MCP_ENABLE_DELEGATE set to `1` to serve the generic `delegate` verb. Its authoring\n * supervisor runs the brain on the router and spawns authored\n * workers as sub-sandboxes via the same client; needs TANGLE_API_KEY.\n * MCP_SUPERVISOR_MODEL supervisor brain model id (falls back to MCP_WORKER_MODEL, then\n * WORKER_MODEL, then a default). Must be a tool-calling model.\n * MCP_SUPERVISOR_ROUTER_KEY router key for the supervisor brain (defaults to TANGLE_API_KEY)\n * MCP_SUPERVISOR_ROUTER_BASE_URL router base for the supervisor brain (defaults to the repo's\n * resolveRouterBaseUrl, normalized to `/v1`)\n * MCP_DELEGATE_WORKER_HARNESS harness the authored workers run on (default `opencode`)\n * AGENT_RUNTIME_DELEGATION_STATE_FILE\n * optional — absolute path of a JSON state\n * file. When set, delegation records persist\n * across MCP restarts (FileDelegationStore):\n * status/history survive and idempotency keys\n * dedupe across processes.\n * AGENT_RUNTIME_DELEGATION_STATE_RECOVER\n * set to `1` to archive a corrupt state file\n * (`<file>.corrupt-<ts>`) and start empty\n * instead of refusing to boot.\n * AGENT_RUNTIME_DELEGATION_RETAIN_TERMINAL\n * optional — positive integer cap on retained\n * terminal records. Unset = keep forever.\n *\n * @experimental\n */\n\nimport type { SandboxClient } from '../runtime'\nimport { delegateEnabled, resolveDelegateSupervisor } from './delegate-supervisor-provisioning'\nimport { FileDelegationStore } from './delegation-store'\nimport { createMcpServer } from './server'\nimport { DelegationTaskQueue } from './task-queue'\nimport { readTraceContextFromEnv, type TraceContext } from './trace-propagation'\n\nconst DEFAULT_SANDBOX_BASE_URL = 'https://sandbox.tangle.tools'\n\nasync function main(): Promise<void> {\n const wantDelegate = delegateEnabled(process.env)\n\n // The generic `delegate` verb needs the sandbox client: its authored workers run as sub-sandboxes\n // (the `sandbox` backend). When `delegate` is not opted in, the server runs the queue-only subset\n // (feedback + status + history) with no sandbox.\n let sandboxClient: SandboxClient | undefined\n if (wantDelegate) {\n const apiKey = process.env.TANGLE_API_KEY\n if (!apiKey && !process.env.AGENT_RUNTIME_MCP_ALLOW_NO_KEY) {\n process.stderr.write(\n 'agent-runtime-mcp: TANGLE_API_KEY is required to serve `delegate`. Set AGENT_RUNTIME_MCP_ALLOW_NO_KEY=1 to run without it for diagnostics, or unset MCP_ENABLE_DELEGATE to run the queue-only subset.\\n',\n )\n process.exit(2)\n }\n sandboxClient = await loadSandboxClient(apiKey)\n }\n\n // The supervisor's loop topology spans export to the OTLP / Tangle Intelligence sink when\n // OTEL_EXPORTER_OTLP_ENDPOINT is set (+ TRACE_ID / PARENT_SPAN_ID for correlation). The same\n // context is stamped onto every delegation record so journal consumers join records into the\n // caller's trace.\n const traceContext = readTraceContextFromEnv()\n if (process.env.OTEL_EXPORTER_OTLP_ENDPOINT) {\n process.stderr.write(\n `agent-runtime-mcp: exporting loop topology → ${process.env.OTEL_EXPORTER_OTLP_ENDPOINT}\\n`,\n )\n }\n\n // The ONE generic `delegate` verb — opt-in via MCP_ENABLE_DELEGATE=1. Its authoring supervisor\n // runs the brain on the router and spawns authored workers as sub-sandboxes through the SAME\n // client, so it needs the loaded `sandboxClient`. Gated on the client resolving (no key → no\n // delegate, fail-closed).\n const delegateSupervisor =\n wantDelegate && sandboxClient ? resolveDelegateSupervisor(sandboxClient) : undefined\n if (wantDelegate && delegateSupervisor) {\n process.stderr.write('agent-runtime-mcp: delegate enabled — generic authoring supervisor\\n')\n }\n\n const durableQueue = await buildDurableQueueFromEnv(traceContext)\n const server = createMcpServer({\n ...(delegateSupervisor ? { delegateSupervisor } : {}),\n traceContext,\n ...(durableQueue ? { queue: durableQueue } : {}),\n })\n\n const shutdown = () => {\n server.stop()\n // Drain journal writes so the state file reflects the final record\n // states before the process exits. A persist failure already routed\n // through onPersistError; swallow the duplicate rejection here.\n if (durableQueue) {\n void durableQueue\n .flush()\n .catch(() => {})\n .finally(() => process.exit(0))\n return\n }\n process.exit(0)\n }\n process.on('SIGINT', shutdown)\n process.on('SIGTERM', shutdown)\n\n await server.serve()\n}\n\nasync function buildDurableQueueFromEnv(\n traceContext: TraceContext,\n): Promise<DelegationTaskQueue | undefined> {\n const stateFile = process.env.AGENT_RUNTIME_DELEGATION_STATE_FILE?.trim()\n if (!stateFile) return undefined\n const store = new FileDelegationStore({\n filePath: stateFile,\n recoverCorrupt: process.env.AGENT_RUNTIME_DELEGATION_STATE_RECOVER === '1',\n })\n const maxTerminalRecords = parseRetention(process.env.AGENT_RUNTIME_DELEGATION_RETAIN_TERMINAL)\n const queue = await DelegationTaskQueue.restore({\n store,\n traceContext,\n ...(maxTerminalRecords !== undefined ? { maxTerminalRecords } : {}),\n onPersistError: (error) => {\n // Durable mode that can no longer write is a broken contract: crash\n // loud instead of degrading to memory-only behind the caller's back.\n process.stderr.write(`agent-runtime-mcp: ${error.message}\\n`)\n process.exit(1)\n },\n })\n process.stderr.write(`agent-runtime-mcp: durable delegation state → ${stateFile}\\n`)\n return queue\n}\n\nfunction parseRetention(raw: string | undefined): number | undefined {\n if (raw === undefined || raw.trim() === '') return undefined\n const n = Number(raw)\n if (!Number.isInteger(n) || n < 1) {\n process.stderr.write(\n `agent-runtime-mcp: AGENT_RUNTIME_DELEGATION_RETAIN_TERMINAL must be a positive integer, got \"${raw}\"\\n`,\n )\n process.exit(2)\n }\n return n\n}\n\nasync function loadSandboxClient(apiKey: string | undefined): Promise<SandboxClient> {\n // Diagnostic mode: AGENT_RUNTIME_MCP_ALLOW_NO_KEY=1 enables tools/list + the\n // queue-bound tools (status / history / feedback) without sandbox creds.\n // `delegate` requires a real client; the stub fails loud at create() so the\n // agent observes the cause instead of silent success.\n if (!apiKey) {\n return {\n async create() {\n throw new Error(\n 'agent-runtime-mcp: TANGLE_API_KEY is unset; `delegate` is disabled in diagnostic mode. Set TANGLE_API_KEY or unset MCP_ENABLE_DELEGATE to remove the unsupported tool from the tool list.',\n )\n },\n } satisfies SandboxClient\n }\n // Dynamic import keeps the bin importable in environments that haven't\n // installed `@tangle-network/sandbox` yet (the runtime package lists it\n // as a peer dep, not a hard dep).\n const mod = await import('@tangle-network/sandbox').catch((err) => {\n process.stderr.write(\n `agent-runtime-mcp: failed to load @tangle-network/sandbox (${err.message}); install the peer dependency\\n`,\n )\n process.exit(2)\n })\n const SandboxCtor = (mod as { Sandbox?: new (config: unknown) => SandboxClient }).Sandbox\n if (!SandboxCtor) {\n process.stderr.write(\n 'agent-runtime-mcp: @tangle-network/sandbox does not export Sandbox; cannot construct client\\n',\n )\n process.exit(2)\n }\n // @tangle-network/sandbox ≥0.6 makes baseUrl required; default it so the MCP server\n // starts without forcing every caller to set SANDBOX_BASE_URL. Treat empty/whitespace as\n // unset (|| not ??) so `SANDBOX_BASE_URL=` still resolves to the default.\n const baseUrl = process.env.SANDBOX_BASE_URL?.trim() || DEFAULT_SANDBOX_BASE_URL\n return new SandboxCtor({ apiKey, baseUrl })\n}\n\nmain().catch((err) => {\n process.stderr.write(`agent-runtime-mcp: ${err instanceof Error ? err.stack : String(err)}\\n`)\n process.exit(1)\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAM,2BAA2B;AACjC,IAAM,yBAAyB;AAE/B,SAAS,QAAQ,OAA+C;AAC9D,QAAM,IAAI,OAAO,KAAK;AACtB,SAAO,IAAI,IAAI;AACjB;AAIO,SAAS,gBAAgB,MAAyB,QAAQ,KAAc;AAC7E,SAAO,IAAI,wBAAwB;AACrC;AAIA,SAAS,cAAc,KAAsC;AAC3D,QAAM,YAAY,QAAQ,IAAI,yBAAyB,KAAK,QAAQ,IAAI,cAAc,KAAK;AAC3F,QAAM,OAAO,QAAQ,IAAI,8BAA8B,KAAK,qBAAqB,GAAgB;AACjG,QAAM,gBAAgB,aAAa,KAAK,IAAI,IACxC,KAAK,QAAQ,OAAO,EAAE,IACtB,GAAG,KAAK,QAAQ,OAAO,EAAE,CAAC;AAC9B,QAAM,QACJ,QAAQ,IAAI,oBAAoB,KAChC,QAAQ,IAAI,gBAAgB,KAC5B,QAAQ,IAAI,YAAY,KACxB;AACF,SAAO,EAAE,eAAe,WAAW,MAAM;AAC3C;AAQO,SAAS,0BACd,eACA,MAAyB,QAAQ,KACG;AACpC,MAAI,CAAC,gBAAgB,GAAG,EAAG,QAAO;AAClC,QAAM,SAAS,cAAc,GAAG;AAChC,QAAM,UAAW,QAAQ,IAAI,2BAA2B,KACtD;AACF,QAAM,UAA0B;AAAA,IAC9B,SAAS;AAAA,IACT;AAAA,IACA;AAAA,EACF;AACA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,OAAO,OAAO;AAAA,EAChB;AACF;;;AC9BA,IAAM,2BAA2B;AAEjC,eAAe,OAAsB;AACnC,QAAM,eAAe,gBAAgB,QAAQ,GAAG;AAKhD,MAAI;AACJ,MAAI,cAAc;A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AAE,MAAM,CAAC,QAAQ;AACpB,UAAQ,OAAO,MAAM,sBAAsB,eAAe,QAAQ,IAAI,QAAQ,OAAO,GAAG,CAAC;AAAA,CAAI;AAC7F,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/mcp/delegate-supervisor-provisioning.ts","../../src/mcp/bin.ts"],"sourcesContent":["/**\n *\n * Resolve the `delegate` supervisor substrate (router brain + worker backend) from env, so the\n * `agent-runtime-mcp` bin can serve the ONE generic `delegate` verb by env, over the SAME stdio\n * invocation a consumer already mounts.\n *\n * `delegate` is wired into `createMcpServer` via `McpServerOptions.delegateSupervisor`, which needs a\n * router (the supervisor brain's substrate) and a backend (WHERE the authored workers run). Inside a\n * sandbox child the natural backend is `sandbox`: authored workers run as sub-sandboxes through the\n * SAME `SandboxClient` the bin already loads from `TANGLE_API_KEY`. The brain's router reuses the\n * repo's `resolveRouterBaseUrl` convention\n * (`TANGLE_ROUTER_URL` / `TANGLE_ROUTER_BASE_URL`), normalised to an OpenAI-compatible `/v1` endpoint,\n * keyed by `TANGLE_API_KEY`.\n *\n * @experimental\n */\n\nimport type { BackendType } from '@tangle-network/sandbox'\nimport { type RouterEnv, resolveRouterBaseUrl } from '../model-resolution.js'\nimport type { SandboxClient } from '../runtime'\nimport type { RouterConfig } from '../runtime/router-client'\nimport type { ExecutorConfig } from '../runtime/supervise/runtime'\nimport type { DelegateHandlerOptions } from './tools/delegate'\n\nconst DEFAULT_SUPERVISOR_MODEL = 'moonshotai/kimi-k2.6'\nconst DEFAULT_WORKER_HARNESS = 'opencode'\n\nfunction trimmed(value: string | undefined): string | undefined {\n const v = value?.trim()\n return v ? v : undefined\n}\n\n/** True when the operator opted the generic `delegate` verb in (`MCP_ENABLE_DELEGATE=1`). Default off:\n * the wiring is additive, so consumers that do not enable it are unaffected. */\nexport function delegateEnabled(env: NodeJS.ProcessEnv = process.env): boolean {\n return env.MCP_ENABLE_DELEGATE === '1'\n}\n\n/** Resolve the supervisor brain's router substrate from env. The key falls back through the platform\n * key the bin already requires; the base reuses `resolveRouterBaseUrl`, normalised to `/v1`. */\nfunction resolveRouter(env: NodeJS.ProcessEnv): RouterConfig {\n const routerKey = trimmed(env.MCP_SUPERVISOR_ROUTER_KEY) ?? trimmed(env.TANGLE_API_KEY) ?? ''\n const base = trimmed(env.MCP_SUPERVISOR_ROUTER_BASE_URL) ?? resolveRouterBaseUrl(env as RouterEnv)\n const routerBaseUrl = /\\/v\\d+\\/?$/.test(base)\n ? base.replace(/\\/$/, '')\n : `${base.replace(/\\/$/, '')}/v1`\n const model =\n trimmed(env.MCP_SUPERVISOR_MODEL) ??\n trimmed(env.MCP_WORKER_MODEL) ??\n trimmed(env.WORKER_MODEL) ??\n DEFAULT_SUPERVISOR_MODEL\n return { routerBaseUrl, routerKey, model }\n}\n\n/**\n * Build the `delegateSupervisor` substrate for `createMcpServer` from env + the bin's loaded\n * `SandboxClient`. Returns `undefined` when `delegate` is not opted in, so the caller mounts it only\n * when asked. The worker backend is `sandbox` (authored workers run as sub-sandboxes via the same\n * client) on the harness named by `MCP_DELEGATE_WORKER_HARNESS` (default `opencode`).\n */\nexport function resolveDelegateSupervisor(\n sandboxClient: SandboxClient,\n env: NodeJS.ProcessEnv = process.env,\n): DelegateHandlerOptions | undefined {\n if (!delegateEnabled(env)) return undefined\n const router = resolveRouter(env)\n const harness = (trimmed(env.MCP_DELEGATE_WORKER_HARNESS) ??\n DEFAULT_WORKER_HARNESS) as BackendType\n const backend: ExecutorConfig = {\n backend: 'sandbox',\n harness,\n sandboxClient,\n }\n return {\n router,\n backend,\n model: router.model,\n }\n}\n","#!/usr/bin/env node\n\n/**\n *\n * `agent-runtime-mcp` — stdio MCP server entry point.\n *\n * Serves the ONE generic `delegate` verb (opt-in via `MCP_ENABLE_DELEGATE=1`): one intent → a\n * supervisor that authors + drives its own worker over `supervise()`, returning the delivered output\n * with its cost. The supervisor brain runs on the router; authored workers run as sub-sandboxes\n * through the same `SandboxClient` the bin loads from `TANGLE_API_KEY`. The queue-bound tools\n * (`delegate_feedback`, `delegation_status`, `delegation_history`) are always served.\n *\n * Environment variables:\n * TANGLE_API_KEY required — passed to `new Sandbox({ apiKey })`\n * SANDBOX_BASE_URL optional — sandbox-SDK base URL override\n * MCP_ENABLE_DELEGATE set to `1` to serve the generic `delegate` verb. Its authoring\n * supervisor runs the brain on the router and spawns authored\n * workers as sub-sandboxes via the same client; needs TANGLE_API_KEY.\n * MCP_SUPERVISOR_MODEL supervisor brain model id (falls back to MCP_WORKER_MODEL, then\n * WORKER_MODEL, then a default). Must be a tool-calling model.\n * MCP_SUPERVISOR_ROUTER_KEY router key for the supervisor brain (defaults to TANGLE_API_KEY)\n * MCP_SUPERVISOR_ROUTER_BASE_URL router base for the supervisor brain (defaults to the repo's\n * resolveRouterBaseUrl, normalized to `/v1`)\n * MCP_DELEGATE_WORKER_HARNESS harness the authored workers run on (default `opencode`)\n * AGENT_RUNTIME_DELEGATION_STATE_FILE\n * optional — absolute path of a JSON state\n * file. When set, delegation records persist\n * across MCP restarts (FileDelegationStore):\n * status/history survive and idempotency keys\n * dedupe across processes.\n * AGENT_RUNTIME_DELEGATION_STATE_RECOVER\n * set to `1` to archive a corrupt state file\n * (`<file>.corrupt-<ts>`) and start empty\n * instead of refusing to boot.\n * AGENT_RUNTIME_DELEGATION_RETAIN_TERMINAL\n * optional — positive integer cap on retained\n * terminal records. Unset = keep forever.\n *\n * @experimental\n */\n\nimport type { SandboxClient } from '../runtime'\nimport { delegateEnabled, resolveDelegateSupervisor } from './delegate-supervisor-provisioning'\nimport { FileDelegationStore } from './delegation-store'\nimport { createMcpServer } from './server'\nimport { DelegationTaskQueue } from './task-queue'\nimport { readTraceContextFromEnv, type TraceContext } from './trace-propagation'\n\nconst DEFAULT_SANDBOX_BASE_URL = 'https://sandbox.tangle.tools'\n\nasync function main(): Promise<void> {\n const wantDelegate = delegateEnabled(process.env)\n\n // The generic `delegate` verb needs the sandbox client: its authored workers run as sub-sandboxes\n // (the `sandbox` backend). When `delegate` is not opted in, the server runs the queue-only subset\n // (feedback + status + history) with no sandbox.\n let sandboxClient: SandboxClient | undefined\n if (wantDelegate) {\n const apiKey = process.env.TANGLE_API_KEY\n if (!apiKey && !process.env.AGENT_RUNTIME_MCP_ALLOW_NO_KEY) {\n process.stderr.write(\n 'agent-runtime-mcp: TANGLE_API_KEY is required to serve `delegate`. Set AGENT_RUNTIME_MCP_ALLOW_NO_KEY=1 to run without it for diagnostics, or unset MCP_ENABLE_DELEGATE to run the queue-only subset.\\n',\n )\n process.exit(2)\n }\n sandboxClient = await loadSandboxClient(apiKey)\n }\n\n // The supervisor's loop topology spans export to the OTLP / Tangle Intelligence sink when\n // OTEL_EXPORTER_OTLP_ENDPOINT is set (+ TRACE_ID / PARENT_SPAN_ID for correlation). The same\n // context is stamped onto every delegation record so journal consumers join records into the\n // caller's trace.\n const traceContext = readTraceContextFromEnv()\n if (process.env.OTEL_EXPORTER_OTLP_ENDPOINT) {\n process.stderr.write(\n `agent-runtime-mcp: exporting loop topology → ${process.env.OTEL_EXPORTER_OTLP_ENDPOINT}\\n`,\n )\n }\n\n // The ONE generic `delegate` verb — opt-in via MCP_ENABLE_DELEGATE=1. Its authoring supervisor\n // runs the brain on the router and spawns authored workers as sub-sandboxes through the SAME\n // client, so it needs the loaded `sandboxClient`. Gated on the client resolving (no key → no\n // delegate, fail-closed).\n const delegateSupervisor =\n wantDelegate && sandboxClient ? resolveDelegateSupervisor(sandboxClient) : undefined\n if (wantDelegate && delegateSupervisor) {\n process.stderr.write('agent-runtime-mcp: delegate enabled — generic authoring supervisor\\n')\n }\n\n const durableQueue = await buildDurableQueueFromEnv(traceContext)\n const server = createMcpServer({\n ...(delegateSupervisor ? { delegateSupervisor } : {}),\n traceContext,\n ...(durableQueue ? { queue: durableQueue } : {}),\n })\n\n const shutdown = () => {\n server.stop()\n // Drain journal writes so the state file reflects the final record\n // states before the process exits. A persist failure already routed\n // through onPersistError; swallow the duplicate rejection here.\n if (durableQueue) {\n void durableQueue\n .flush()\n .catch(() => {})\n .finally(() => process.exit(0))\n return\n }\n process.exit(0)\n }\n process.on('SIGINT', shutdown)\n process.on('SIGTERM', shutdown)\n\n await server.serve()\n}\n\nasync function buildDurableQueueFromEnv(\n traceContext: TraceContext,\n): Promise<DelegationTaskQueue | undefined> {\n const stateFile = process.env.AGENT_RUNTIME_DELEGATION_STATE_FILE?.trim()\n if (!stateFile) return undefined\n const store = new FileDelegationStore({\n filePath: stateFile,\n recoverCorrupt: process.env.AGENT_RUNTIME_DELEGATION_STATE_RECOVER === '1',\n })\n const maxTerminalRecords = parseRetention(process.env.AGENT_RUNTIME_DELEGATION_RETAIN_TERMINAL)\n const queue = await DelegationTaskQueue.restore({\n store,\n traceContext,\n ...(maxTerminalRecords !== undefined ? { maxTerminalRecords } : {}),\n onPersistError: (error) => {\n // Durable mode that can no longer write is a broken contract: crash\n // loud instead of degrading to memory-only behind the caller's back.\n process.stderr.write(`agent-runtime-mcp: ${error.message}\\n`)\n process.exit(1)\n },\n })\n process.stderr.write(`agent-runtime-mcp: durable delegation state → ${stateFile}\\n`)\n return queue\n}\n\nfunction parseRetention(raw: string | undefined): number | undefined {\n if (raw === undefined || raw.trim() === '') return undefined\n const n = Number(raw)\n if (!Number.isInteger(n) || n < 1) {\n process.stderr.write(\n `agent-runtime-mcp: AGENT_RUNTIME_DELEGATION_RETAIN_TERMINAL must be a positive integer, got \"${raw}\"\\n`,\n )\n process.exit(2)\n }\n return n\n}\n\nasync function loadSandboxClient(apiKey: string | undefined): Promise<SandboxClient> {\n // Diagnostic mode: AGENT_RUNTIME_MCP_ALLOW_NO_KEY=1 enables tools/list + the\n // queue-bound tools (status / history / feedback) without sandbox creds.\n // `delegate` requires a real client; the stub fails loud at create() so the\n // agent observes the cause instead of silent success.\n if (!apiKey) {\n return {\n async create() {\n throw new Error(\n 'agent-runtime-mcp: TANGLE_API_KEY is unset; `delegate` is disabled in diagnostic mode. Set TANGLE_API_KEY or unset MCP_ENABLE_DELEGATE to remove the unsupported tool from the tool list.',\n )\n },\n } satisfies SandboxClient\n }\n // Dynamic import keeps the bin importable in environments that haven't\n // installed `@tangle-network/sandbox` yet (the runtime package lists it\n // as a peer dep, not a hard dep).\n const mod = await import('@tangle-network/sandbox').catch((err) => {\n process.stderr.write(\n `agent-runtime-mcp: failed to load @tangle-network/sandbox (${err.message}); install the peer dependency\\n`,\n )\n process.exit(2)\n })\n const SandboxCtor = (mod as { Sandbox?: new (config: unknown) => SandboxClient }).Sandbox\n if (!SandboxCtor) {\n process.stderr.write(\n 'agent-runtime-mcp: @tangle-network/sandbox does not export Sandbox; cannot construct client\\n',\n )\n process.exit(2)\n }\n // @tangle-network/sandbox ≥0.6 makes baseUrl required; default it so the MCP server\n // starts without forcing every caller to set SANDBOX_BASE_URL. Treat empty/whitespace as\n // unset (|| not ??) so `SANDBOX_BASE_URL=` still resolves to the default.\n const baseUrl = process.env.SANDBOX_BASE_URL?.trim() || DEFAULT_SANDBOX_BASE_URL\n return new SandboxCtor({ apiKey, baseUrl })\n}\n\nmain().catch((err) => {\n process.stderr.write(`agent-runtime-mcp: ${err instanceof Error ? err.stack : String(err)}\\n`)\n process.exit(1)\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwBA,IAAM,2BAA2B;AACjC,IAAM,yBAAyB;AAE/B,SAAS,QAAQ,OAA+C;AAC9D,QAAM,IAAI,OAAO,KAAK;AACtB,SAAO,IAAI,IAAI;AACjB;AAIO,SAAS,gBAAgB,MAAyB,QAAQ,KAAc;AAC7E,SAAO,IAAI,wBAAwB;AACrC;AAIA,SAAS,cAAc,KAAsC;AAC3D,QAAM,YAAY,QAAQ,IAAI,yBAAyB,KAAK,QAAQ,IAAI,cAAc,KAAK;AAC3F,QAAM,OAAO,QAAQ,IAAI,8BAA8B,KAAK,qBAAqB,GAAgB;AACjG,QAAM,gBAAgB,aAAa,KAAK,IAAI,IACxC,KAAK,QAAQ,OAAO,EAAE,IACtB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AChB;AACA,SAAO;AACT;AAEA,eAAe,kBAAkB,QAAoD;AAKnF,MAAI,CAAC,QAAQ;AACX,WAAO;AAAA,MACL,MAAM,SAAS;AACb,cAAM,IAAI;AAAA,UACR;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAIA,QAAM,MAAM,MAAM,OAAO,yBAAyB,EAAE,MAAM,CAAC,QAAQ;AACjE,YAAQ,OAAO;AAAA,MACb,8DAA8D,IAAI,OAAO;AAAA;AAAA,IAC3E;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AACD,QAAM,cAAe,IAA6D;AAClF,MAAI,CAAC,aAAa;AAChB,YAAQ,OAAO;AAAA,MACb;AAAA,IACF;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AAIA,QAAM,UAAU,QAAQ,IAAI,kBAAkB,KAAK,KAAK;AACxD,SAAO,IAAI,YAAY,EAAE,QAAQ,QAAQ,CAAC;AAC5C;AAEA,KAAK,EAAE,MAAM,CAAC,QAAQ;AACpB,UAAQ,OAAO,MAAM,sBAAsB,eAAe,QAAQ,IAAI,QAAQ,OAAO,GAAG,CAAC;AAAA,CAAI;AAC7F,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { S as SandboxClient,
|
|
2
|
-
import { F as FleetHandle, D as DelegationExecutor, a as DelegationTaskQueue, b as FeedbackStore, c as DelegateFeedbackResult, d as DelegateFeedbackArgs, U as UiAuditorDelegate, e as DelegateUiAuditArgs, f as DelegateUiAuditResult, g as DelegationHistoryResult, h as DelegationHistoryArgs, i as DelegationStatusResult, j as DelegationStatusArgs } from '../coordination-
|
|
3
|
-
export { A as AnalystRegistry, C as CappedDelegationTrace, k as CoderDelegate, l as CoderReview, m as CoderReviewer, n as CoordinationEvent, o as CoordinationTools, p as CoordinationToolsOptions, q as DELEGATE_DESCRIPTION, r as DELEGATE_INPUT_SCHEMA, s as DELEGATE_TOOL_NAME, t as DELEGATION_TRACE_MAX_BYTES, u as DELEGATION_TRACE_MAX_SPANS, v as DelegateArgs, w as DelegateCodeArgs, x as DelegateCodeConfig, y as DelegateCodeResult, z as DelegateHandlerOptions, B as DelegateResearchArgs, G as DelegateResearchConfig, H as DelegateResearchResult, I as DelegateResult, J as DelegateRunCtx, K as DelegateUiAuditConfig, L as DelegateUiAuditRoute, N as DelegationError, O as DelegationFeedbackSnapshot, P as DelegationHistoryEntry, Q as DelegationPersistenceError, R as DelegationProfile, S as DelegationProgress, T as DelegationRecord, V as DelegationResultPayload, W as DelegationResumeContext, X as DelegationResumeDriver, Y as DelegationResumeTick, Z as DelegationRunContext, _ as DelegationStateCorruptError, $ as DelegationStatus, a0 as DelegationStore, a1 as DelegationTaskQueueOptions, a2 as DelegationTraceCaps, a3 as DelegationTraceCollector, a4 as DelegationTraceSpan, a5 as DetachedSessionDelegateOptions, a6 as DetachedSessionRefParts, a7 as DetachedTurn, a8 as DetachedTurnResumeDriverOptions, a9 as DetachedWinnerSelection, aa as DriveTurnCapableBox, ab as DriveTurnTick, ac as FeedbackEvent, ad as FeedbackRating, ae as FeedbackRefersTo, af as FileDelegationStore, ag as FileDelegationStoreOptions, ah as FleetWorkspaceExecutorOptions, ai as InMemoryDelegationStore, aj as InMemoryFeedbackStore, ak as JsonRpcMessage, al as JsonRpcResponse, M as MakeWorkerAgent, am as McpServer, an as McpServerOptions, ao as McpToolDescriptor, ap as McpTransport, aq as Question, ar as QuestionDecision, as as QuestionPolicy, at as QuestionRecord, au as ResearchOutputShape, av as ResearchSource, aw as RunDetachedTurnOptions, ax as SettleDetachedCoderTurnOptions, ay as SettledWorker, az as SiblingSandboxExecutorOptions, aA as SubmitInput, aB as SubmitOutput, aC as TraceContext, aD as UiAuditorDelegationOutput, aE as buildDelegationTraceSpans, aF as capDelegationTrace, aG as coderTaskFromArgs, aH as composeLoopTraceEmitters, aI as createCoordinationTools, aJ as createDelegateHandler, aK as createDelegationTraceCollector, aL as createDetachedTurnResumeDriver, aM as createFleetWorkspaceExecutor, aN as createInProcessTransport, aO as createMcpServer, aP as createPropagatingTraceEmitter, aQ as createSiblingSandboxExecutor, aR as detachedSessionDelegate, aS as detachedTurnEvents, aT as eventToSnapshot, aU as formatDetachedSessionRef, aV as hashIdempotencyInput, aW as parseDetachedSessionRef, aX as readTraceContextFromEnv, aY as runDetachedTurn, aZ as settleDetachedCoderTurn, a_ as traceContextToEnv, a$ as validateDelegateArgs } from '../coordination-
|
|
1
|
+
import { S as SandboxClient, a as LoopSandboxPlacement } from '../types-B3vAW0Oq.js';
|
|
2
|
+
import { F as FleetHandle, D as DelegationExecutor, a as DelegationTaskQueue, b as FeedbackStore, c as DelegateFeedbackResult, d as DelegateFeedbackArgs, U as UiAuditorDelegate, e as DelegateUiAuditArgs, f as DelegateUiAuditResult, g as DelegationHistoryResult, h as DelegationHistoryArgs, i as DelegationStatusResult, j as DelegationStatusArgs } from '../coordination-BFE3Den7.js';
|
|
3
|
+
export { A as AnalystRegistry, C as CappedDelegationTrace, k as CoderDelegate, l as CoderReview, m as CoderReviewer, n as CoordinationEvent, o as CoordinationTools, p as CoordinationToolsOptions, q as DELEGATE_DESCRIPTION, r as DELEGATE_INPUT_SCHEMA, s as DELEGATE_TOOL_NAME, t as DELEGATION_TRACE_MAX_BYTES, u as DELEGATION_TRACE_MAX_SPANS, v as DelegateArgs, w as DelegateCodeArgs, x as DelegateCodeConfig, y as DelegateCodeResult, z as DelegateHandlerOptions, B as DelegateResearchArgs, G as DelegateResearchConfig, H as DelegateResearchResult, I as DelegateResult, J as DelegateRunCtx, K as DelegateUiAuditConfig, L as DelegateUiAuditRoute, N as DelegationError, O as DelegationFeedbackSnapshot, P as DelegationHistoryEntry, Q as DelegationPersistenceError, R as DelegationProfile, S as DelegationProgress, T as DelegationRecord, V as DelegationResultPayload, W as DelegationResumeContext, X as DelegationResumeDriver, Y as DelegationResumeTick, Z as DelegationRunContext, _ as DelegationStateCorruptError, $ as DelegationStatus, a0 as DelegationStore, a1 as DelegationTaskQueueOptions, a2 as DelegationTraceCaps, a3 as DelegationTraceCollector, a4 as DelegationTraceSpan, a5 as DetachedSessionDelegateOptions, a6 as DetachedSessionRefParts, a7 as DetachedTurn, a8 as DetachedTurnResumeDriverOptions, a9 as DetachedWinnerSelection, aa as DriveTurnCapableBox, ab as DriveTurnTick, ac as FeedbackEvent, ad as FeedbackRating, ae as FeedbackRefersTo, af as FileDelegationStore, ag as FileDelegationStoreOptions, ah as FleetWorkspaceExecutorOptions, ai as InMemoryDelegationStore, aj as InMemoryFeedbackStore, ak as JsonRpcMessage, al as JsonRpcResponse, M as MakeWorkerAgent, am as McpServer, an as McpServerOptions, ao as McpToolDescriptor, ap as McpTransport, aq as Question, ar as QuestionDecision, as as QuestionPolicy, at as QuestionRecord, au as ResearchOutputShape, av as ResearchSource, aw as RunDetachedTurnOptions, ax as SettleDetachedCoderTurnOptions, ay as SettledWorker, az as SiblingSandboxExecutorOptions, aA as SubmitInput, aB as SubmitOutput, aC as TraceContext, aD as UiAuditorDelegationOutput, aE as buildDelegationTraceSpans, aF as capDelegationTrace, aG as coderTaskFromArgs, aH as composeLoopTraceEmitters, aI as createCoordinationTools, aJ as createDelegateHandler, aK as createDelegationTraceCollector, aL as createDetachedTurnResumeDriver, aM as createFleetWorkspaceExecutor, aN as createInProcessTransport, aO as createMcpServer, aP as createPropagatingTraceEmitter, aQ as createSiblingSandboxExecutor, aR as detachedSessionDelegate, aS as detachedTurnEvents, aT as eventToSnapshot, aU as formatDetachedSessionRef, aV as hashIdempotencyInput, aW as parseDetachedSessionRef, aX as readTraceContextFromEnv, aY as runDetachedTurn, aZ as settleDetachedCoderTurn, a_ as traceContextToEnv, a$ as validateDelegateArgs } from '../coordination-BFE3Den7.js';
|
|
4
4
|
import { L as LocalHarness, r as runLocalHarness } from '../local-harness-ZqCx51u7.js';
|
|
5
5
|
export { a as CodexExecutionEvidence, c as CodexExecutionPolicy, C as CodexTokenUsage, b as LocalHarnessResult, R as RunLocalHarnessOptions, p as parseCodexTokenUsage } from '../local-harness-ZqCx51u7.js';
|
|
6
|
-
import { G as GitRunner } from '../completion-gate-
|
|
7
|
-
export { C as CreateWorktreeOptions, b as DiffOptions, c as DiffResult, R as RemoveWorktreeOptions, d as WorktreeHandle, e as captureWorktreeDiff, f as createWorktree, r as removeWorktree } from '../completion-gate-
|
|
6
|
+
import { G as GitRunner } from '../completion-gate-C80jiRfN.js';
|
|
7
|
+
export { C as CreateWorktreeOptions, b as DiffOptions, c as DiffResult, R as RemoveWorktreeOptions, d as WorktreeHandle, e as captureWorktreeDiff, f as createWorktree, r as removeWorktree } from '../completion-gate-C80jiRfN.js';
|
|
8
8
|
export { C as CreateKbGateOptions, F as FactCandidate, a as FactJudge, b as FactJudgeVerdict, K as KbGateResult, c as createKbGate } from '../kb-gate-CwHO0vz6.js';
|
|
9
9
|
export { m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from '../openai-tools-fnj6SRVg.js';
|
|
10
10
|
import { AnalystFinding } from '@tangle-network/agent-eval';
|
|
11
11
|
import { U as UiLens } from '../substrate-DO2GHNg2.js';
|
|
12
12
|
import '@tangle-network/sandbox';
|
|
13
13
|
import '../types-BwoZWq-i.js';
|
|
14
|
-
import '../types-
|
|
14
|
+
import '../types-CmnA2iL3.js';
|
|
15
15
|
import '@tangle-network/agent-interface';
|
|
16
16
|
import '../sanitize-BTSsdBXw.js';
|
|
17
17
|
import '../environment-provider.js';
|
package/dist/mcp/index.js
CHANGED
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
createPropagatingTraceEmitter,
|
|
6
6
|
readTraceContextFromEnv,
|
|
7
7
|
traceContextToEnv
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-Y3SRWZMP.js";
|
|
9
9
|
import {
|
|
10
10
|
mcpToolsForRuntimeMcp,
|
|
11
11
|
mcpToolsForRuntimeMcpSubset
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-WYC2XJF2.js";
|
|
13
13
|
import {
|
|
14
14
|
createKbGate
|
|
15
15
|
} from "../chunk-SGKPNBXE.js";
|
|
@@ -17,7 +17,8 @@ import {
|
|
|
17
17
|
assertTraceDerivedFindings,
|
|
18
18
|
runCoderChecks,
|
|
19
19
|
selectValidWinner
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-FXF2OL34.js";
|
|
21
|
+
import "../chunk-Q2JSAVQ3.js";
|
|
21
22
|
import {
|
|
22
23
|
DELEGATE_DESCRIPTION,
|
|
23
24
|
DELEGATE_FEEDBACK_DESCRIPTION,
|
|
@@ -67,12 +68,15 @@ import {
|
|
|
67
68
|
validateDelegateUiAuditArgs,
|
|
68
69
|
validateDelegationHistoryArgs,
|
|
69
70
|
validateDelegationStatusArgs
|
|
70
|
-
} from "../chunk-
|
|
71
|
+
} from "../chunk-UQ6PNNXM.js";
|
|
71
72
|
import "../chunk-DPEUKJRO.js";
|
|
72
|
-
import
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
import {
|
|
74
|
+
CodexExecutionDiagnosticError,
|
|
75
|
+
parseCodexTokenUsage,
|
|
76
|
+
runLocalHarness
|
|
77
|
+
} from "../chunk-HZDEXTSL.js";
|
|
78
|
+
import "../chunk-IMSNJSXH.js";
|
|
79
|
+
import "../chunk-M6MD6JBS.js";
|
|
76
80
|
import {
|
|
77
81
|
deleteBoxSafe,
|
|
78
82
|
sleep,
|
|
@@ -80,15 +84,9 @@ import {
|
|
|
80
84
|
throwIfAborted
|
|
81
85
|
} from "../chunk-3MDZX7YU.js";
|
|
82
86
|
import "../chunk-M22PL4GH.js";
|
|
83
|
-
import {
|
|
84
|
-
CodexExecutionDiagnosticError,
|
|
85
|
-
parseCodexTokenUsage,
|
|
86
|
-
runLocalHarness
|
|
87
|
-
} from "../chunk-EP6RVHMX.js";
|
|
88
87
|
import {
|
|
89
88
|
ValidationError
|
|
90
89
|
} from "../chunk-YEJR7IXO.js";
|
|
91
|
-
import "../chunk-DGUM43GV.js";
|
|
92
90
|
|
|
93
91
|
// src/mcp/executor.ts
|
|
94
92
|
function createSiblingSandboxExecutor(options) {
|