@tangle-network/agent-runtime 0.126.0 → 0.131.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 +70 -20
- package/dist/{activation-DhWJ3p8N.js → activation-BCzMOTaV.js} +3 -3
- package/dist/{activation-DhWJ3p8N.js.map → activation-BCzMOTaV.js.map} +1 -1
- package/dist/agent.d.ts +2 -3
- package/dist/agent.js +4 -5
- package/dist/agent.js.map +1 -1
- package/dist/{analyst-loop-DvSciOfB.js → analyst-loop-BE8cDs5Q.js} +2 -2
- package/dist/{analyst-loop-DvSciOfB.js.map → analyst-loop-BE8cDs5Q.js.map} +1 -1
- package/dist/analyst-loop.d.ts +1 -1
- package/dist/analyst-loop.js +1 -1
- package/dist/authoring-CvHwo1oW.js +163 -0
- package/dist/authoring-CvHwo1oW.js.map +1 -0
- package/dist/candidate-execution/index.js +4 -4
- package/dist/{candidate-execution-BFpq-Xi6.js → candidate-execution-BNxKr-Bu.js} +5 -5
- package/dist/{candidate-execution-BFpq-Xi6.js.map → candidate-execution-BNxKr-Bu.js.map} +1 -1
- package/dist/{conversation-BpLQZGPH.js → conversation-DNtxaJ1Z.js} +113 -31
- package/dist/conversation-DNtxaJ1Z.js.map +1 -0
- package/dist/conversation.d.ts +2 -2
- package/dist/conversation.js +2 -2
- package/dist/environment-provider-CxvSd1W6.d.ts +86 -0
- package/dist/{environment-provider-DqFS6FSZ.js → environment-provider-Dyg8DtLK.js} +8 -4
- package/dist/environment-provider-Dyg8DtLK.js.map +1 -0
- package/dist/environment-provider.d.ts +1 -1
- package/dist/environment-provider.js +1 -1
- package/dist/graph-BJTxGOFB.js +471 -0
- package/dist/graph-BJTxGOFB.js.map +1 -0
- package/dist/{improvement-cycle-IJgCbKWQ.js → improvement-cycle-Csp38cWg.js} +133 -224
- package/dist/improvement-cycle-Csp38cWg.js.map +1 -0
- package/dist/{index-EdjCQBV9.d.ts → index-CoO7atyo.d.ts} +640 -1184
- package/dist/{index-DIV33AF5.d.ts → index-DwGtu9nc.d.ts} +7 -9
- package/dist/{index-Efjb3nrQ.d.ts → index-qYHpsmG2.d.ts} +36 -18
- package/dist/index.d.ts +353 -11
- package/dist/index.js +111 -354
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +6 -6
- package/dist/intelligence.js +9 -8
- package/dist/intelligence.js.map +1 -1
- package/dist/kernel.d.ts +7 -5
- package/dist/kernel.js +13 -9
- package/dist/{knowledge-EnuEqm_Y.js → knowledge-ce0_uKCl.js} +19 -17
- package/dist/knowledge-ce0_uKCl.js.map +1 -0
- package/dist/knowledge.d.ts +1 -1
- package/dist/knowledge.js +1 -1
- package/dist/{loop-runner-bin-Bo29_fiD.d.ts → loop-runner-bin-BwgZ8m_7.d.ts} +6 -3
- package/dist/{loop-runner-bin-qwT_4F5I.js → loop-runner-bin-DSbuDDqM.js} +5 -27
- package/dist/loop-runner-bin-DSbuDDqM.js.map +1 -0
- package/dist/loop-runner-bin.d.ts +1 -1
- package/dist/loop-runner-bin.js +1 -1
- package/dist/materialization-COJ1UYQ-.js +272 -0
- package/dist/materialization-COJ1UYQ-.js.map +1 -0
- package/dist/mcp/bin.js +39 -47
- package/dist/mcp/bin.js.map +1 -1
- package/dist/mcp/index.d.ts +24 -30
- package/dist/mcp/index.js +66 -83
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/memory-bin.js +1 -1
- package/dist/{memory-server-DL6cE2Ag.js → memory-server-5HEJH672.js} +2 -2
- package/dist/{memory-server-DL6cE2Ag.js.map → memory-server-5HEJH672.js.map} +1 -1
- package/dist/model-policy-CqziaqS1.js +232 -0
- package/dist/model-policy-CqziaqS1.js.map +1 -0
- package/dist/{openai-tools-B68JaOCx.d.ts → openai-tools-D3oMyVGl.d.ts} +2 -2
- package/dist/{openai-tools-Bp1KSkP6.js → openai-tools-ru75mLjq.js} +2 -2
- package/dist/openai-tools-ru75mLjq.js.map +1 -0
- package/dist/{prepare--8EvLqCr.js → prepare-DYWjVcPx.js} +169 -153
- package/dist/prepare-DYWjVcPx.js.map +1 -0
- package/dist/primeintellect/index.d.ts +7 -6
- package/dist/primeintellect/index.js +9 -11
- package/dist/primeintellect/index.js.map +1 -1
- package/dist/profiles.d.ts +21 -174
- package/dist/profiles.js +67 -276
- package/dist/profiles.js.map +1 -1
- package/dist/{protected-model-port-CXVfOUu_.js → protected-model-port-48ALLGxT.js} +2 -2
- package/dist/{protected-model-port-CXVfOUu_.js.map → protected-model-port-48ALLGxT.js.map} +1 -1
- package/dist/{redact-PQzmE1Jn.d.ts → redact-9_Gf-8m3.d.ts} +58 -69
- package/dist/{researcher-CoVqNhfI.js → researcher-Skz5-Uc8.js} +50 -26
- package/dist/researcher-Skz5-Uc8.js.map +1 -0
- package/dist/{run-layout-C2FGmZ3v.js → run-layout-CeJsEAom.js} +2 -2
- package/dist/{run-layout-C2FGmZ3v.js.map → run-layout-CeJsEAom.js.map} +1 -1
- package/dist/runtime-D-QfLbSd.d.ts +893 -0
- package/dist/{runtime-BzXz7OjS.js → runtime-hiAABiTk.js} +329 -854
- package/dist/runtime-hiAABiTk.js.map +1 -0
- package/dist/{sandbox-events-Yhd1GYWl.js → sandbox-events-CRDwc5WN.js} +42 -5
- package/dist/sandbox-events-CRDwc5WN.js.map +1 -0
- package/dist/snapshot-CXiiuHhL.js +21 -0
- package/dist/snapshot-CXiiuHhL.js.map +1 -0
- package/dist/{spawn-journal-DsZKDqeh.js → spawn-journal-saHQzqYi.js} +15 -21
- package/dist/spawn-journal-saHQzqYi.js.map +1 -0
- package/dist/stream-agent-turn-C852AgMT.d.ts +128 -0
- package/dist/stream-agent-turn-rYgaOLO0.js +910 -0
- package/dist/stream-agent-turn-rYgaOLO0.js.map +1 -0
- package/dist/{structural-rollout-zY0oqQzO.js → structural-rollout-3uxVGcg2.js} +459 -235
- package/dist/structural-rollout-3uxVGcg2.js.map +1 -0
- package/dist/{supervise-Ds8FtyI9.js → supervise-iPN27pO0.js} +932 -4771
- package/dist/supervise-iPN27pO0.js.map +1 -0
- package/dist/{supervisor-DpjO0Gmy.js → supervisor-CV6Jh28D.js} +7439 -2897
- package/dist/supervisor-CV6Jh28D.js.map +1 -0
- package/dist/testing.d.ts +3 -1
- package/dist/testing.js +271 -221
- package/dist/testing.js.map +1 -1
- package/dist/{top-app-5unxqovu.js → top-app-G4M18b6i.js} +3 -3
- package/dist/{top-app-5unxqovu.js.map → top-app-G4M18b6i.js.map} +1 -1
- package/dist/tui/bin.js +1 -1
- package/dist/tui/index.js +1 -1
- package/dist/{environment-provider-PM9PeW_J.d.ts → types-C6Q-J0Dt.d.ts} +57 -114
- package/dist/{types-DnNGJ5Gz.d.ts → types-ebIY0dMG.d.ts} +556 -30
- package/dist/{util-MVgdwuIS.js → util-Bw6srryQ.js} +3 -2
- package/dist/{util-MVgdwuIS.js.map → util-Bw6srryQ.js.map} +1 -1
- package/dist/{workspace-archive-BQxvkypI.js → workspace-archive-aOfJ47ms.js} +3 -3
- package/dist/{workspace-archive-BQxvkypI.js.map → workspace-archive-aOfJ47ms.js.map} +1 -1
- package/package.json +12 -15
- package/skills/agent-graphs/IMPROVE.md +58 -0
- package/skills/agent-graphs/SKILL.md +139 -0
- package/skills/agent-graphs/cases/artifact-mission-release-notes.json +10 -0
- package/skills/agent-graphs/cases/audited-single-writer.json +9 -0
- package/skills/agent-graphs/cases/cap-as-stop-mistake.json +8 -0
- package/skills/agent-graphs/cases/mission-in-deliverable.json +8 -0
- package/skills/agent-graphs/cases/review-pipeline.json +13 -0
- package/skills/agent-graphs/cases/runtime-discovered-fanout.json +8 -0
- package/skills/agent-graphs/cases/single-agent-suffices.json +7 -0
- package/skills/agent-graphs/cases/steer-heavy-drafting.json +9 -0
- package/skills/agent-graphs/cases/unmeasured-harness.json +7 -0
- package/skills/agent-graphs/generations/gen1-baseline.json +248 -0
- package/skills/agent-graphs/generations/gen2.json +375 -0
- package/skills/agent-graphs/generations/gen3.json +702 -0
- package/skills/build-with-agent-runtime/SKILL.md +1 -0
- package/dist/backends-CiOCyRHb.js +0 -743
- package/dist/backends-CiOCyRHb.js.map +0 -1
- package/dist/conversation-BpLQZGPH.js.map +0 -1
- package/dist/environment-provider-DqFS6FSZ.js.map +0 -1
- package/dist/improvement-cycle-IJgCbKWQ.js.map +0 -1
- package/dist/index-D_M4d1_B.d.ts +0 -545
- package/dist/knowledge-EnuEqm_Y.js.map +0 -1
- package/dist/local-harness-BIajef4A.d.ts +0 -465
- package/dist/loop-runner-bin-qwT_4F5I.js.map +0 -1
- package/dist/model-resolution-Btd9iIKV.js +0 -98
- package/dist/model-resolution-Btd9iIKV.js.map +0 -1
- package/dist/openai-tools-Bp1KSkP6.js.map +0 -1
- package/dist/prepare--8EvLqCr.js.map +0 -1
- package/dist/researcher-CoVqNhfI.js.map +0 -1
- package/dist/runtime-BzXz7OjS.js.map +0 -1
- package/dist/sandbox-events-Yhd1GYWl.js.map +0 -1
- package/dist/spawn-journal-DsZKDqeh.js.map +0 -1
- package/dist/structural-rollout-zY0oqQzO.js.map +0 -1
- package/dist/supervise-Ds8FtyI9.js.map +0 -1
- package/dist/supervisor-DpjO0Gmy.js.map +0 -1
- package/dist/types-C9j4qg6l.d.ts +0 -500
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { E as SandboxClient, h as LoopSandboxPlacement } from "../types-ebIY0dMG.js";
|
|
2
|
+
import { $l as McpTransport, $u as DelegateUiAuditResult, Ad as DelegationStore, Al as SettledWorker, Au as parseDetachedSessionRef, Bl as createMcpServer, Bu as SubmitInput, Cd as DelegationTraceSpan, Cl as Question, Cu as DetachedTurnResumeDriverOptions, Dd as createDelegationTraceCollector, Dl as QuestionPolicy, Du as createDetachedTurnResumeDriver, Ed as composeLoopTraceEmitters, El as QuestionOption, Eu as RunDetachedTurnOptions, Fl as createCoordinationTools, Fu as DelegationResumeDriver, Gl as DelegateError, Gu as DelegateCodeResult, Hl as DELEGATE_INPUT_SCHEMA, Hu as hashIdempotencyInput, Iu as DelegationResumeTick, Jl as createDelegateHandler, Ju as DelegateResearchArgs, Kl as DelegateHandlerOptions, Ku as DelegateFeedbackArgs, Ll as McpServer, Lu as DelegationRunContext, Md as FileDelegationStoreOptions, Ml as WorkerSpawnContext, Mu as DelegationArgs, Nd as InMemoryDelegationStore, Nl as WorkerWatchOptions, Nu as DelegationRecord, Od as DelegationPersistenceError, Ol as QuestionRecord, Ou as detachedTurnEvents, Pu as DelegationResumeContext, Ql as McpToolDescriptor, Qu as DelegateUiAuditConfig, Rl as McpServerOptions, Ru as DelegationTaskQueue, Sd as DelegationTraceCollector, Sl as MakeWorkerAgent, Su as DetachedTurn, Td as capDelegationTrace, Tl as QuestionLevel, Tu as DriveTurnTick, Ud as CoderOutput, Ul as DELEGATE_TOOL_NAME, Uu as DelegateCodeArgs, Vl as DELEGATE_DESCRIPTION, Vu as SubmitOutput, Wl as DelegateArgs, Wu as DelegateCodeConfig, Xl as JsonRpcMessage, Xu as DelegateResearchResult, Yl as validateDelegateArgs, Yu as DelegateResearchConfig, Zl as JsonRpcResponse, Zu as DelegateUiAuditArgs, _d as UiAuditorDelegationOutput, _l as DEFAULT_AWAIT_EVENT_TIMEOUT_MS, _u as FleetWorkspaceExecutorOptions, ad as DelegationHistoryResult, au as CoderReview, bd as DELEGATION_TRACE_MAX_SPANS, bl as DownMessageDeliveryOutcome, bu as createSiblingSandboxExecutor, cd as DelegationResultPayload, cl as AnalystRegistry, cu as DetachedSessionDelegateOptions, dd as DelegationStatusResult, dl as AuthorizedDownMessage, du as UiAuditorDelegate, ed as DelegateUiAuditRoute, eu as FeedbackEvent, fd as FeedbackRating, fl as ContinuationInstruction, fu as coderTaskFromArgs, gd as UiAuditLensFilter, gl as CoordinationToolsOptions, gu as FleetHandle, hd as ResearchSource, hl as CoordinationTools, hu as DelegationExecutor, id as DelegationHistoryEntry, iu as CoderDelegate, jd as FileDelegationStore, ju as runDetachedTurn, kd as DelegationStateCorruptError, kl as QuestionUrgency, ku as formatDetachedSessionRef, ld as DelegationStatus, lu as DetachedWinnerSelection, md as ResearchOutputShape, ml as CoordinationEvent, mu as settleDetachedCoderTurn, nd as DelegationFeedbackSnapshot, nu as InMemoryFeedbackStore, od as DelegationProfile, ou as CoderReviewer, pd as FeedbackRefersTo, pu as detachedSessionDelegate, ql as DelegateResult, qu as DelegateFeedbackResult, rd as DelegationHistoryArgs, ru as eventToSnapshot, sd as DelegationProgress, sl as AnalystFindingEvent, su as DelegateRunCtx, td as DelegationError, tu as FeedbackStore, ud as DelegationStatusArgs, ul as AuthorizeDownMessage, uu as SettleDetachedCoderTurnOptions, vd as CappedDelegationTrace, vl as DownMessageAuthorizationInput, vu as SiblingSandboxExecutorOptions, wd as buildDelegationTraceSpans, wl as QuestionDecision, wu as DriveTurnCapableBox, xd as DelegationTraceCaps, xl as DownMessageEvent, xu as DetachedSessionRefParts, yd as DELEGATION_TRACE_MAX_BYTES, yl as DownMessageDeliveryAttempt, yu as createFleetWorkspaceExecutor, zl as createInProcessTransport, zu as DelegationTaskQueueOptions } from "../index-CoO7atyo.js";
|
|
3
|
+
import { at as mergeTraceEnv, it as createPropagatingTraceEmitter, ot as readTraceContextFromEnv, rt as TraceContext, st as traceContextToEnv } from "../types-C6Q-J0Dt.js";
|
|
4
4
|
import { o as UiLens } from "../substrate-BcnuSHXm.js";
|
|
5
|
-
import {
|
|
5
|
+
import { A as LocalHarness, B as GitRunner, D as CodexTokenUsage, E as CodexExecutionPolicy, F as parseCodexTokenUsage, G as removeWorktree, H as WorktreeHandle, I as runLocalHarness, L as CreateWorktreeOptions, M as RunLocalHarnessOptions, N as harnessSupportsReasoningEffort, O as DEFAULT_LOCAL_HARNESS, P as localHarnessExecutable, R as DiffOptions, T as CodexExecutionEvidence, U as captureWorktreeDiff, V as RemoveWorktreeOptions, W as createWorktree, j as LocalHarnessResult, k as LOCAL_HARNESSES, z as DiffResult } from "../runtime-D-QfLbSd.js";
|
|
6
6
|
import { a as KbGateResult, i as FactJudgeVerdict, n as FactCandidate, o as createKbGate, r as FactJudge, t as CreateKbGateOptions } from "../kb-gate-C8z2juK8.js";
|
|
7
|
-
import { n as mcpToolsForRuntimeMcpSubset, t as mcpToolsForRuntimeMcp } from "../openai-tools-
|
|
7
|
+
import { n as mcpToolsForRuntimeMcpSubset, t as mcpToolsForRuntimeMcp } from "../openai-tools-D3oMyVGl.js";
|
|
8
8
|
import { AgentProfileMcpServer } from "@tangle-network/agent-interface";
|
|
9
9
|
//#region src/mcp/codex-diagnostics.d.ts
|
|
10
10
|
/** Bounded, credential-redacted process context attached when reproducible Codex output fails
|
|
@@ -62,8 +62,6 @@ declare function detectExecutor(args: DetectExecutorArgs): Promise<DelegationExe
|
|
|
62
62
|
interface InProcessExecutorOptions {
|
|
63
63
|
/** Absolute path to the git repo (the workspace). Worktrees go under `<repoRoot>/.agent-worktrees/`. */
|
|
64
64
|
repoRoot: string;
|
|
65
|
-
/** Harnesses to round-robin across `create()` calls. One entry = no fanout. Default `['claude-code']`. */
|
|
66
|
-
harnesses?: ReadonlyArray<LocalHarness>;
|
|
67
65
|
/** Optional per-delegation test command run in the worktree after the harness exits. */
|
|
68
66
|
testCmd?: string;
|
|
69
67
|
/** Optional per-delegation typecheck command. Same shape as `testCmd`. */
|
|
@@ -207,11 +205,11 @@ interface ResolvedMemoryEnv {
|
|
|
207
205
|
declare function resolveMemoryFromEnv(env: Record<string, string | undefined>): ResolvedMemoryEnv;
|
|
208
206
|
//#endregion
|
|
209
207
|
//#region src/mcp/tools/delegate-feedback.d.ts
|
|
210
|
-
/** MCP tool name for the `delegate_feedback` feedback-recording tool. @
|
|
208
|
+
/** MCP tool name for the `delegate_feedback` feedback-recording tool. @stable */
|
|
211
209
|
declare const DELEGATE_FEEDBACK_TOOL_NAME = "delegate_feedback";
|
|
212
|
-
/** Human-readable description of the `delegate_feedback` MCP tool, injected into the tool manifest. @
|
|
210
|
+
/** Human-readable description of the `delegate_feedback` MCP tool, injected into the tool manifest. @stable */
|
|
213
211
|
declare const DELEGATE_FEEDBACK_DESCRIPTION: string;
|
|
214
|
-
/** JSON Schema for `delegate_feedback` tool arguments (`refersTo`, `rating`, `by`, optional fields). @
|
|
212
|
+
/** JSON Schema for `delegate_feedback` tool arguments (`refersTo`, `rating`, `by`, optional fields). @stable */
|
|
215
213
|
declare const DELEGATE_FEEDBACK_INPUT_SCHEMA: {
|
|
216
214
|
readonly type: "object";
|
|
217
215
|
readonly properties: {
|
|
@@ -262,16 +260,16 @@ declare const DELEGATE_FEEDBACK_INPUT_SCHEMA: {
|
|
|
262
260
|
readonly required: readonly ["refersTo", "rating", "by"];
|
|
263
261
|
readonly additionalProperties: false;
|
|
264
262
|
};
|
|
265
|
-
/** Parse and validate raw MCP tool input into typed `DelegateFeedbackArgs`; throws `TypeError` on bad input. @
|
|
263
|
+
/** Parse and validate raw MCP tool input into typed `DelegateFeedbackArgs`; throws `TypeError` on bad input. @stable */
|
|
266
264
|
declare function validateDelegateFeedbackArgs(raw: unknown): DelegateFeedbackArgs;
|
|
267
|
-
/** @
|
|
265
|
+
/** @stable */
|
|
268
266
|
interface DelegateFeedbackHandlerOptions {
|
|
269
267
|
queue: DelegationTaskQueue;
|
|
270
268
|
store: FeedbackStore;
|
|
271
269
|
generateId?: () => string;
|
|
272
270
|
now?: () => string;
|
|
273
271
|
}
|
|
274
|
-
/** Build the MCP tool handler that persists feedback events and attaches them to delegation records. @
|
|
272
|
+
/** Build the MCP tool handler that persists feedback events and attaches them to delegation records. @stable */
|
|
275
273
|
declare function createDelegateFeedbackHandler(options: DelegateFeedbackHandlerOptions): (raw: unknown) => Promise<DelegateFeedbackResult>;
|
|
276
274
|
//#endregion
|
|
277
275
|
//#region src/mcp/tools/delegate-ui-audit.d.ts
|
|
@@ -377,11 +375,11 @@ interface DelegateUiAuditHandlerOptions {
|
|
|
377
375
|
declare function createDelegateUiAuditHandler(options: DelegateUiAuditHandlerOptions): (raw: unknown) => Promise<DelegateUiAuditResult>;
|
|
378
376
|
//#endregion
|
|
379
377
|
//#region src/mcp/tools/delegation-history.d.ts
|
|
380
|
-
/** MCP tool name for the `delegation_history` read-past-delegations tool. @
|
|
378
|
+
/** MCP tool name for the `delegation_history` read-past-delegations tool. @stable */
|
|
381
379
|
declare const DELEGATION_HISTORY_TOOL_NAME = "delegation_history";
|
|
382
|
-
/** Human-readable description of the `delegation_history` MCP tool, injected into the tool manifest. @
|
|
380
|
+
/** Human-readable description of the `delegation_history` MCP tool, injected into the tool manifest. @stable */
|
|
383
381
|
declare const DELEGATION_HISTORY_DESCRIPTION: string;
|
|
384
|
-
/** JSON Schema for `delegation_history` tool arguments (optional `namespace`, `profile`, `since`, `limit`). @
|
|
382
|
+
/** JSON Schema for `delegation_history` tool arguments (optional `namespace`, `profile`, `since`, `limit`). @stable */
|
|
385
383
|
declare const DELEGATION_HISTORY_INPUT_SCHEMA: {
|
|
386
384
|
readonly type: "object";
|
|
387
385
|
readonly properties: {
|
|
@@ -404,21 +402,21 @@ declare const DELEGATION_HISTORY_INPUT_SCHEMA: {
|
|
|
404
402
|
};
|
|
405
403
|
readonly additionalProperties: false;
|
|
406
404
|
};
|
|
407
|
-
/** Parse and validate raw MCP tool input into typed `DelegationHistoryArgs`; throws `TypeError` on bad input. @
|
|
405
|
+
/** Parse and validate raw MCP tool input into typed `DelegationHistoryArgs`; throws `TypeError` on bad input. @stable */
|
|
408
406
|
declare function validateDelegationHistoryArgs(raw: unknown): DelegationHistoryArgs;
|
|
409
|
-
/** @
|
|
407
|
+
/** @stable */
|
|
410
408
|
interface DelegationHistoryHandlerOptions {
|
|
411
409
|
queue: DelegationTaskQueue;
|
|
412
410
|
}
|
|
413
|
-
/** Build the MCP tool handler that reads filtered past delegations from a `DelegationTaskQueue`. @
|
|
411
|
+
/** Build the MCP tool handler that reads filtered past delegations from a `DelegationTaskQueue`. @stable */
|
|
414
412
|
declare function createDelegationHistoryHandler(options: DelegationHistoryHandlerOptions): (raw: unknown) => Promise<DelegationHistoryResult>;
|
|
415
413
|
//#endregion
|
|
416
414
|
//#region src/mcp/tools/delegation-status.d.ts
|
|
417
|
-
/** MCP tool name for the `delegation_status` synchronous-poll tool. @
|
|
415
|
+
/** MCP tool name for the `delegation_status` synchronous-poll tool. @stable */
|
|
418
416
|
declare const DELEGATION_STATUS_TOOL_NAME = "delegation_status";
|
|
419
|
-
/** Human-readable description of the `delegation_status` MCP tool, injected into the tool manifest. @
|
|
417
|
+
/** Human-readable description of the `delegation_status` MCP tool, injected into the tool manifest. @stable */
|
|
420
418
|
declare const DELEGATION_STATUS_DESCRIPTION: string;
|
|
421
|
-
/** JSON Schema for `delegation_status` tool arguments (`taskId` + optional `includeTrace`). @
|
|
419
|
+
/** JSON Schema for `delegation_status` tool arguments (`taskId` + optional `includeTrace`). @stable */
|
|
422
420
|
declare const DELEGATION_STATUS_INPUT_SCHEMA: {
|
|
423
421
|
readonly type: "object";
|
|
424
422
|
readonly properties: {
|
|
@@ -434,18 +432,14 @@ declare const DELEGATION_STATUS_INPUT_SCHEMA: {
|
|
|
434
432
|
readonly required: readonly ["taskId"];
|
|
435
433
|
readonly additionalProperties: false;
|
|
436
434
|
};
|
|
437
|
-
/** Parse and validate raw MCP tool input into typed `DelegationStatusArgs`; throws `TypeError` on bad input. @
|
|
435
|
+
/** Parse and validate raw MCP tool input into typed `DelegationStatusArgs`; throws `TypeError` on bad input. @stable */
|
|
438
436
|
declare function validateDelegationStatusArgs(raw: unknown): DelegationStatusArgs;
|
|
439
|
-
/** @
|
|
437
|
+
/** @stable */
|
|
440
438
|
interface DelegationStatusHandlerOptions {
|
|
441
439
|
queue: DelegationTaskQueue;
|
|
442
440
|
}
|
|
443
|
-
/** Build the MCP tool handler that polls a `DelegationTaskQueue` for task status. @
|
|
441
|
+
/** Build the MCP tool handler that polls a `DelegationTaskQueue` for task status. @stable */
|
|
444
442
|
declare function createDelegationStatusHandler(options: DelegationStatusHandlerOptions): (raw: unknown) => Promise<DelegationStatusResult>;
|
|
445
443
|
//#endregion
|
|
446
|
-
|
|
447
|
-
/** @deprecated Use `McpToolDescriptor`; both names are the same protocol contract. */
|
|
448
|
-
type StdioToolDescriptor = McpToolDescriptor;
|
|
449
|
-
//#endregion
|
|
450
|
-
export { type AgentMemorySpec, type AnalystFindingEvent, type AnalystRegistry, type AuthorizeDownMessage, type AuthorizedDownMessage, type CappedDelegationTrace, type CoderDelegate, type CoderOutput, type CoderReview, type CoderReviewer, CodexExecutionDiagnosticError, type CodexExecutionEvidence, type CodexExecutionFailureDiagnostic, type CodexExecutionPolicy, type CodexTokenUsage, type ContinuationInstruction, type CoordinationEvent, type CoordinationTools, type CoordinationToolsOptions, type CreateKbGateOptions, type CreateMemoryToolServerOptions, type CreateWorktreeOptions, DEFAULT_AWAIT_EVENT_TIMEOUT_MS, DEFAULT_LOCAL_HARNESS, DELEGATE_DESCRIPTION, DELEGATE_FEEDBACK_DESCRIPTION, DELEGATE_FEEDBACK_INPUT_SCHEMA, DELEGATE_FEEDBACK_TOOL_NAME, DELEGATE_INPUT_SCHEMA, DELEGATE_TOOL_NAME, DELEGATE_UI_AUDIT_DESCRIPTION, DELEGATE_UI_AUDIT_INPUT_SCHEMA, DELEGATE_UI_AUDIT_TOOL_NAME, DELEGATION_HISTORY_DESCRIPTION, DELEGATION_HISTORY_INPUT_SCHEMA, DELEGATION_HISTORY_TOOL_NAME, DELEGATION_STATUS_DESCRIPTION, DELEGATION_STATUS_INPUT_SCHEMA, DELEGATION_STATUS_TOOL_NAME, DELEGATION_TRACE_MAX_BYTES, DELEGATION_TRACE_MAX_SPANS, type DelegateArgs, type DelegateCodeArgs, type DelegateCodeConfig, type DelegateCodeResult, type DelegateError, type DelegateFeedbackArgs, type DelegateFeedbackHandlerOptions, type DelegateFeedbackResult, type DelegateHandlerOptions, type DelegateResearchArgs, type DelegateResearchConfig, type DelegateResearchResult, type DelegateResult, type DelegateRunCtx, type DelegateUiAuditArgs, type DelegateUiAuditConfig, type DelegateUiAuditHandlerOptions, type DelegateUiAuditResult, type DelegateUiAuditRoute, type DelegationArgs, type DelegationError, type DelegationExecutor, type DelegationFeedbackSnapshot, type DelegationHistoryArgs, type DelegationHistoryEntry, type DelegationHistoryHandlerOptions, type DelegationHistoryResult, DelegationPersistenceError, type DelegationProfile, type DelegationProgress, type DelegationRecord, type DelegationResultPayload, type DelegationResumeContext, type DelegationResumeDriver, type DelegationResumeTick, type DelegationRunContext, DelegationStateCorruptError, type DelegationStatus, type DelegationStatusArgs, type DelegationStatusHandlerOptions, type DelegationStatusResult, type DelegationStore, DelegationTaskQueue, type DelegationTaskQueueOptions, type DelegationTraceCaps, type DelegationTraceCollector, type DelegationTraceSpan, type DetachedSessionDelegateOptions, type DetachedSessionRefParts, type DetachedTurn, type DetachedTurnResumeDriverOptions, type DetachedWinnerSelection, type DetectExecutorArgs, type DiffOptions, type DiffResult, type DownMessageAuthorizationInput, type DownMessageDeliveryAttempt, type DownMessageDeliveryOutcome, type DownMessageEvent, type DriveTurnCapableBox, type DriveTurnTick, type FactCandidate, type FactJudge, type FactJudgeVerdict, type FeedbackEvent, type FeedbackRating, type FeedbackRefersTo, type FeedbackStore, FileDelegationStore, type FileDelegationStoreOptions, type FleetHandle, type FleetWorkspaceExecutorOptions, type GitRunner, InMemoryDelegationStore, InMemoryFeedbackStore, type InProcessExecutorDescribePlacement, type InProcessExecutorOptions, type JsonRpcMessage, type JsonRpcResponse, type KbGateResult, LOCAL_HARNESSES, type LocalHarness, type LocalHarnessResult, MEMORY_FILE_ENV, MEMORY_ITEMS_ENV, MEMORY_LOG_ENV, MEMORY_NAME_ENV, type MakeWorkerAgent, type McpServer, type McpServerOptions, type McpToolDescriptor, type McpTransport, type MemoryItem, type Question, type QuestionDecision, type QuestionLevel, type QuestionOption, type QuestionPolicy, type QuestionRecord, type QuestionUrgency, type RemoveWorktreeOptions, type ResearchOutputShape, type ResearchSource, type ResolvedMemoryEnv, type RunDetachedTurnOptions, type RunLocalHarnessOptions, type SettleDetachedCoderTurnOptions, type SettledWorker, type SiblingSandboxExecutorOptions, StdioToolDescriptor, type StdioToolServer, type StdioToolServerOptions, type SubmitInput, type SubmitOutput, type TraceContext, type UiAuditLensFilter, type UiAuditorDelegate, type UiAuditorDelegationOutput, type WorkerSpawnContext, type WorkerWatchOptions, type WorktreeHandle, buildDelegationTraceSpans, capDelegationTrace, captureWorktreeDiff, coderTaskFromArgs, composeLoopTraceEmitters, createCoordinationTools, createDelegateFeedbackHandler, createDelegateHandler, createDelegateUiAuditHandler, createDelegationHistoryHandler, createDelegationStatusHandler, createDelegationTraceCollector, createDetachedTurnResumeDriver, createFleetWorkspaceExecutor, createInProcessExecutor, createInProcessTransport, createKbGate, createMcpServer, createMemoryToolServer, createPropagatingTraceEmitter, createSiblingSandboxExecutor, createStdioToolServer, createWorktree, detachedSessionDelegate, detachedTurnEvents, detectExecutor, eventToSnapshot, formatDetachedSessionRef, harnessSupportsReasoningEffort, hashIdempotencyInput, localHarnessExecutable, mcpToolsForRuntimeMcp, mcpToolsForRuntimeMcpSubset, mergeTraceEnv, parseCodexTokenUsage, parseDetachedSessionRef, parseMemoryItems, readMemoryItemsFile, readTraceContextFromEnv, removeWorktree, resolveMemoryFromEnv, runDetachedTurn, runLocalHarness, settleDetachedCoderTurn, traceContextToEnv, validateDelegateArgs, validateDelegateFeedbackArgs, validateDelegateUiAuditArgs, validateDelegationHistoryArgs, validateDelegationStatusArgs };
|
|
444
|
+
export { type AgentMemorySpec, type AnalystFindingEvent, type AnalystRegistry, type AuthorizeDownMessage, type AuthorizedDownMessage, type CappedDelegationTrace, type CoderDelegate, type CoderOutput, type CoderReview, type CoderReviewer, CodexExecutionDiagnosticError, type CodexExecutionEvidence, type CodexExecutionFailureDiagnostic, type CodexExecutionPolicy, type CodexTokenUsage, type ContinuationInstruction, type CoordinationEvent, type CoordinationTools, type CoordinationToolsOptions, type CreateKbGateOptions, type CreateMemoryToolServerOptions, type CreateWorktreeOptions, DEFAULT_AWAIT_EVENT_TIMEOUT_MS, DEFAULT_LOCAL_HARNESS, DELEGATE_DESCRIPTION, DELEGATE_FEEDBACK_DESCRIPTION, DELEGATE_FEEDBACK_INPUT_SCHEMA, DELEGATE_FEEDBACK_TOOL_NAME, DELEGATE_INPUT_SCHEMA, DELEGATE_TOOL_NAME, DELEGATE_UI_AUDIT_DESCRIPTION, DELEGATE_UI_AUDIT_INPUT_SCHEMA, DELEGATE_UI_AUDIT_TOOL_NAME, DELEGATION_HISTORY_DESCRIPTION, DELEGATION_HISTORY_INPUT_SCHEMA, DELEGATION_HISTORY_TOOL_NAME, DELEGATION_STATUS_DESCRIPTION, DELEGATION_STATUS_INPUT_SCHEMA, DELEGATION_STATUS_TOOL_NAME, DELEGATION_TRACE_MAX_BYTES, DELEGATION_TRACE_MAX_SPANS, type DelegateArgs, type DelegateCodeArgs, type DelegateCodeConfig, type DelegateCodeResult, type DelegateError, type DelegateFeedbackArgs, type DelegateFeedbackHandlerOptions, type DelegateFeedbackResult, type DelegateHandlerOptions, type DelegateResearchArgs, type DelegateResearchConfig, type DelegateResearchResult, type DelegateResult, type DelegateRunCtx, type DelegateUiAuditArgs, type DelegateUiAuditConfig, type DelegateUiAuditHandlerOptions, type DelegateUiAuditResult, type DelegateUiAuditRoute, type DelegationArgs, type DelegationError, type DelegationExecutor, type DelegationFeedbackSnapshot, type DelegationHistoryArgs, type DelegationHistoryEntry, type DelegationHistoryHandlerOptions, type DelegationHistoryResult, DelegationPersistenceError, type DelegationProfile, type DelegationProgress, type DelegationRecord, type DelegationResultPayload, type DelegationResumeContext, type DelegationResumeDriver, type DelegationResumeTick, type DelegationRunContext, DelegationStateCorruptError, type DelegationStatus, type DelegationStatusArgs, type DelegationStatusHandlerOptions, type DelegationStatusResult, type DelegationStore, DelegationTaskQueue, type DelegationTaskQueueOptions, type DelegationTraceCaps, type DelegationTraceCollector, type DelegationTraceSpan, type DetachedSessionDelegateOptions, type DetachedSessionRefParts, type DetachedTurn, type DetachedTurnResumeDriverOptions, type DetachedWinnerSelection, type DetectExecutorArgs, type DiffOptions, type DiffResult, type DownMessageAuthorizationInput, type DownMessageDeliveryAttempt, type DownMessageDeliveryOutcome, type DownMessageEvent, type DriveTurnCapableBox, type DriveTurnTick, type FactCandidate, type FactJudge, type FactJudgeVerdict, type FeedbackEvent, type FeedbackRating, type FeedbackRefersTo, type FeedbackStore, FileDelegationStore, type FileDelegationStoreOptions, type FleetHandle, type FleetWorkspaceExecutorOptions, type GitRunner, InMemoryDelegationStore, InMemoryFeedbackStore, type InProcessExecutorDescribePlacement, type InProcessExecutorOptions, type JsonRpcMessage, type JsonRpcResponse, type KbGateResult, LOCAL_HARNESSES, type LocalHarness, type LocalHarnessResult, MEMORY_FILE_ENV, MEMORY_ITEMS_ENV, MEMORY_LOG_ENV, MEMORY_NAME_ENV, type MakeWorkerAgent, type McpServer, type McpServerOptions, type McpToolDescriptor, type McpTransport, type MemoryItem, type Question, type QuestionDecision, type QuestionLevel, type QuestionOption, type QuestionPolicy, type QuestionRecord, type QuestionUrgency, type RemoveWorktreeOptions, type ResearchOutputShape, type ResearchSource, type ResolvedMemoryEnv, type RunDetachedTurnOptions, type RunLocalHarnessOptions, type SettleDetachedCoderTurnOptions, type SettledWorker, type SiblingSandboxExecutorOptions, type StdioToolServer, type StdioToolServerOptions, type SubmitInput, type SubmitOutput, type TraceContext, type UiAuditLensFilter, type UiAuditorDelegate, type UiAuditorDelegationOutput, type WorkerSpawnContext, type WorkerWatchOptions, type WorktreeHandle, buildDelegationTraceSpans, capDelegationTrace, captureWorktreeDiff, coderTaskFromArgs, composeLoopTraceEmitters, createCoordinationTools, createDelegateFeedbackHandler, createDelegateHandler, createDelegateUiAuditHandler, createDelegationHistoryHandler, createDelegationStatusHandler, createDelegationTraceCollector, createDetachedTurnResumeDriver, createFleetWorkspaceExecutor, createInProcessExecutor, createInProcessTransport, createKbGate, createMcpServer, createMemoryToolServer, createPropagatingTraceEmitter, createSiblingSandboxExecutor, createStdioToolServer, createWorktree, detachedSessionDelegate, detachedTurnEvents, detectExecutor, eventToSnapshot, formatDetachedSessionRef, harnessSupportsReasoningEffort, hashIdempotencyInput, localHarnessExecutable, mcpToolsForRuntimeMcp, mcpToolsForRuntimeMcpSubset, mergeTraceEnv, parseCodexTokenUsage, parseDetachedSessionRef, parseMemoryItems, readMemoryItemsFile, readTraceContextFromEnv, removeWorktree, resolveMemoryFromEnv, runDetachedTurn, settleDetachedCoderTurn, traceContextToEnv, validateDelegateArgs, validateDelegateFeedbackArgs, validateDelegateUiAuditArgs, validateDelegationHistoryArgs, validateDelegationStatusArgs };
|
|
451
445
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/mcp/index.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { u as ValidationError } from "../errors-DEAvWQPy.js";
|
|
2
|
-
import { l as throwAbort, n as deleteBoxSafe, s as sleep, u as throwIfAborted } from "../util-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { i as ConfigError, u as ValidationError } from "../errors-DEAvWQPy.js";
|
|
2
|
+
import { l as throwAbort, n as deleteBoxSafe, s as sleep, u as throwIfAborted } from "../util-Bw6srryQ.js";
|
|
3
|
+
import { t as assertExecutableAgentProfile } from "../model-policy-CqziaqS1.js";
|
|
4
|
+
import { At as removeWorktree, Dt as runWorktreeHarness, Ft as parseCodexTokenUsage, It as CodexExecutionDiagnosticError, Mt as LOCAL_HARNESSES, Nt as harnessSupportsReasoningEffort, Ot as captureWorktreeDiff, Pt as localHarnessExecutable, Q as runAgentRounds, X as createSandboxForSpec, at as mergeTraceEnv, it as createPropagatingTraceEmitter, jt as DEFAULT_LOCAL_HARNESS, kt as createWorktree, ot as readTraceContextFromEnv, st as traceContextToEnv } from "../supervisor-CV6Jh28D.js";
|
|
5
|
+
import { S as runCoderChecks, et as selectValidWinner } from "../runtime-hiAABiTk.js";
|
|
6
|
+
import { $ as DELEGATION_TRACE_MAX_BYTES, A as DELEGATION_HISTORY_INPUT_SCHEMA, B as DELEGATE_FEEDBACK_INPUT_SCHEMA, C as createMcpServer, D as createDelegationStatusHandler, Dt as createCoordinationTools, E as DELEGATION_STATUS_TOOL_NAME, F as DELEGATE_UI_AUDIT_INPUT_SCHEMA, G as DELEGATE_INPUT_SCHEMA, H as createDelegateFeedbackHandler, I as DELEGATE_UI_AUDIT_TOOL_NAME, J as validateDelegateArgs, K as DELEGATE_TOOL_NAME, L as createDelegateUiAuditHandler, M as createDelegationHistoryHandler, N as validateDelegationHistoryArgs, O as validateDelegationStatusArgs, P as DELEGATE_UI_AUDIT_DESCRIPTION, Q as hashIdempotencyInput, R as validateDelegateUiAuditArgs, S as createInProcessTransport, T as DELEGATION_STATUS_INPUT_SCHEMA, Tt as DEFAULT_AWAIT_EVENT_TIMEOUT_MS, U as validateDelegateFeedbackArgs, V as DELEGATE_FEEDBACK_TOOL_NAME, W as DELEGATE_DESCRIPTION, Z as DelegationTaskQueue, at as DelegationPersistenceError, ct as InMemoryDelegationStore, et as DELEGATION_TRACE_MAX_SPANS, it as createDelegationTraceCollector, j as DELEGATION_HISTORY_TOOL_NAME, k as DELEGATION_HISTORY_DESCRIPTION, lt as InMemoryFeedbackStore, nt as capDelegationTrace, ot as DelegationStateCorruptError, q as createDelegateHandler, rt as composeLoopTraceEmitters, st as FileDelegationStore, tt as buildDelegationTraceSpans, ut as eventToSnapshot, w as DELEGATION_STATUS_DESCRIPTION, z as DELEGATE_FEEDBACK_DESCRIPTION } from "../supervise-iPN27pO0.js";
|
|
6
7
|
import { t as createStdioToolServer } from "../tool-server-RcWgLIsL.js";
|
|
7
8
|
import { t as createKbGate } from "../kb-gate-DpaSwXVx.js";
|
|
8
|
-
import { n as mcpToolsForRuntimeMcpSubset, t as mcpToolsForRuntimeMcp } from "../openai-tools-
|
|
9
|
+
import { n as mcpToolsForRuntimeMcpSubset, t as mcpToolsForRuntimeMcp } from "../openai-tools-ru75mLjq.js";
|
|
9
10
|
import { t as coderTaskToPrompt } from "../coder-yhVWbdWc.js";
|
|
10
|
-
import { a as createMemoryToolServer, c as resolveMemoryFromEnv, i as MEMORY_NAME_ENV, n as MEMORY_ITEMS_ENV, o as parseMemoryItems, r as MEMORY_LOG_ENV, s as readMemoryItemsFile, t as MEMORY_FILE_ENV } from "../memory-server-
|
|
11
|
+
import { a as createMemoryToolServer, c as resolveMemoryFromEnv, i as MEMORY_NAME_ENV, n as MEMORY_ITEMS_ENV, o as parseMemoryItems, r as MEMORY_LOG_ENV, s as readMemoryItemsFile, t as MEMORY_FILE_ENV } from "../memory-server-5HEJH672.js";
|
|
12
|
+
import { agentProfileSchema } from "@tangle-network/agent-interface";
|
|
11
13
|
import { randomUUID } from "node:crypto";
|
|
12
14
|
//#region src/mcp/executor.ts
|
|
13
15
|
/**
|
|
@@ -99,7 +101,7 @@ function readId(box) {
|
|
|
99
101
|
* carries the local coding-harness CLIs (claude / codex / opencode), delegations spawn the harness
|
|
100
102
|
* AS A SUBPROCESS against a git worktree on the SAME filesystem instead of provisioning a sibling
|
|
101
103
|
* sandbox. Zero provisioning latency; worker diffs land in-place; multi-harness fanout = N parallel
|
|
102
|
-
* subprocesses in N parallel worktrees
|
|
104
|
+
* subprocesses in N parallel worktrees. Each authored profile selects its own harness.
|
|
103
105
|
*
|
|
104
106
|
* This is a THIN adapter over `runWorktreeHarness` (`./worktree-harness`) — the SAME core the
|
|
105
107
|
* `Scope` leaf `createWorktreeCliExecutor` uses. It only adapts the core to the `SandboxClient`
|
|
@@ -123,7 +125,6 @@ const DEFAULT_POSTCHECK_TIMEOUT_MS = 120 * 1e3;
|
|
|
123
125
|
* @experimental
|
|
124
126
|
*/
|
|
125
127
|
function createInProcessExecutor(options) {
|
|
126
|
-
const harnesses = options.harnesses && options.harnesses.length > 0 ? [...options.harnesses] : [DEFAULT_LOCAL_HARNESS];
|
|
127
128
|
const runPostCheck = options.runPostCheck ?? defaultRunPostCheck;
|
|
128
129
|
const runCommand = async ({ command, cwd, signal }) => {
|
|
129
130
|
try {
|
|
@@ -139,26 +140,30 @@ function createInProcessExecutor(options) {
|
|
|
139
140
|
};
|
|
140
141
|
}
|
|
141
142
|
};
|
|
142
|
-
let callIndex = 0;
|
|
143
143
|
return {
|
|
144
144
|
client: {
|
|
145
145
|
async create(opts) {
|
|
146
|
+
const rawProfile = (opts?.backend)?.profile;
|
|
147
|
+
if (rawProfile === void 0) throw new ConfigError("in-process executor: backend.profile is required and must select the exact harness, provider, and model");
|
|
148
|
+
const profile = agentProfileSchema.parse(rawProfile);
|
|
149
|
+
assertExecutableAgentProfile(profile, "in-process executor");
|
|
150
|
+
const harness = profile.harness;
|
|
151
|
+
if (!LOCAL_HARNESSES.includes(harness)) throw new ConfigError(`in-process executor: AgentProfile.harness ${JSON.stringify(harness)} is not a local harness; expected ${LOCAL_HARNESSES.join(", ")}`);
|
|
152
|
+
if (opts?.backend?.type !== void 0 && opts.backend.type !== harness) throw new ConfigError(`in-process executor: backend.type ${JSON.stringify(opts.backend.type)} conflicts with AgentProfile.harness ${JSON.stringify(harness)}`);
|
|
153
|
+
const localHarness = harness;
|
|
146
154
|
const runId = randomUUID();
|
|
147
|
-
const harness = harnesses[callIndex % harnesses.length];
|
|
148
|
-
callIndex += 1;
|
|
149
|
-
const profile = (opts?.backend)?.profile ?? { name: `in-process-${harness}` };
|
|
150
155
|
return {
|
|
151
156
|
id: `in-process-${runId}`,
|
|
152
157
|
__inProcess: {
|
|
153
158
|
runId,
|
|
154
|
-
harness
|
|
159
|
+
harness: localHarness
|
|
155
160
|
},
|
|
156
161
|
async *streamPrompt(message, promptOpts) {
|
|
157
162
|
const taskPrompt = typeof message === "string" ? message : message.map((p) => typeof p === "object" && p && "text" in p ? String(p.text) : "").join("\n");
|
|
158
163
|
const run = await runWorktreeHarness({
|
|
159
164
|
repoRoot: options.repoRoot,
|
|
160
165
|
profile,
|
|
161
|
-
harness,
|
|
166
|
+
harness: localHarness,
|
|
162
167
|
taskPrompt,
|
|
163
168
|
runId,
|
|
164
169
|
harnessTimeoutMs: options.harnessTimeoutMs ?? DEFAULT_HARNESS_TIMEOUT_MS,
|
|
@@ -176,9 +181,9 @@ function createInProcessExecutor(options) {
|
|
|
176
181
|
type: "in_process.harness.started",
|
|
177
182
|
data: {
|
|
178
183
|
runId,
|
|
179
|
-
harness,
|
|
184
|
+
harness: localHarness,
|
|
180
185
|
worktreePath: run.worktree.path,
|
|
181
|
-
command:
|
|
186
|
+
command: localHarness
|
|
182
187
|
}
|
|
183
188
|
};
|
|
184
189
|
const h = run.result.harness;
|
|
@@ -199,7 +204,7 @@ function createInProcessExecutor(options) {
|
|
|
199
204
|
data: {
|
|
200
205
|
result: run.result,
|
|
201
206
|
source: "in-process-executor",
|
|
202
|
-
harness,
|
|
207
|
+
harness: localHarness,
|
|
203
208
|
runId
|
|
204
209
|
}
|
|
205
210
|
};
|
|
@@ -222,7 +227,7 @@ function createInProcessExecutor(options) {
|
|
|
222
227
|
},
|
|
223
228
|
placement: "in-process",
|
|
224
229
|
describe() {
|
|
225
|
-
return `in-process (repoRoot=${options.repoRoot},
|
|
230
|
+
return `in-process (repoRoot=${options.repoRoot}, harness=profile-selected${options.testCmd ? `, testCmd="${options.testCmd}"` : ""}${options.typecheckCmd ? `, typecheckCmd="${options.typecheckCmd}"` : ""})`;
|
|
226
231
|
}
|
|
227
232
|
};
|
|
228
233
|
}
|
|
@@ -289,7 +294,6 @@ async function detectExecutor(args) {
|
|
|
289
294
|
if (!repoRoot) throw new Error("agent-runtime-mcp: AGENT_RUNTIME_IN_SANDBOX=1 requires AGENT_RUNTIME_REPO_ROOT to point at the workspace root");
|
|
290
295
|
return createInProcessExecutor({
|
|
291
296
|
repoRoot,
|
|
292
|
-
harnesses: parseHarnesses(env.AGENT_RUNTIME_LOCAL_HARNESSES),
|
|
293
297
|
testCmd: env.AGENT_RUNTIME_TEST_CMD?.trim() || void 0,
|
|
294
298
|
typecheckCmd: env.AGENT_RUNTIME_TYPECHECK_CMD?.trim() || void 0
|
|
295
299
|
});
|
|
@@ -301,13 +305,6 @@ async function detectExecutor(args) {
|
|
|
301
305
|
excludeMachineIds: parseList(env.TANGLE_FLEET_EXCLUDE_MACHINES)
|
|
302
306
|
});
|
|
303
307
|
}
|
|
304
|
-
function parseHarnesses(raw) {
|
|
305
|
-
if (!raw) return void 0;
|
|
306
|
-
const parts = raw.split(",").map((s) => s.trim()).filter(Boolean);
|
|
307
|
-
if (parts.length === 0) return void 0;
|
|
308
|
-
for (const part of parts) if (!LOCAL_HARNESSES.includes(part)) throw new Error(`agent-runtime-mcp: AGENT_RUNTIME_LOCAL_HARNESSES contains unknown harness "${part}". Expected: ${LOCAL_HARNESSES.join(", ")}.`);
|
|
309
|
-
return parts;
|
|
310
|
-
}
|
|
311
308
|
async function defaultResolveFleet(sandboxClient, fleetId) {
|
|
312
309
|
const fleets = sandboxClient.fleets;
|
|
313
310
|
if (!fleets || typeof fleets.get !== "function") throw new Error("agent-runtime-mcp: the configured sandbox client does not expose `.fleets.get`; upgrade @tangle-network/sandbox to >= 0.2.1 or unset TANGLE_FLEET_ID.");
|
|
@@ -330,38 +327,32 @@ function parseList(raw) {
|
|
|
330
327
|
}
|
|
331
328
|
//#endregion
|
|
332
329
|
//#region src/mcp/detached-coder.ts
|
|
333
|
-
const DEFAULT_MAX_DIFF_LINES = 400;
|
|
334
330
|
/**
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
331
|
+
*
|
|
332
|
+
* Sandbox-session coder decode layer. The sandbox-session delegate (`./delegates`) and the
|
|
333
|
+
* cross-restart resume driver run the in-box harness over a `SandboxClient` and need to
|
|
334
|
+
* (a) build an `AgentRunSpec` from the caller-authored exact worker
|
|
335
|
+
* profile, (b) decode the harness event stream into a structured `CoderOutput`, and (c) gate it with
|
|
336
|
+
* the shared mechanical checks. This sandbox-session path is kept separate from the generic recursive
|
|
337
|
+
* path: `worktreeFanout` instead settles the raw `WorktreePatchArtifact` and gates via
|
|
338
|
+
* `patchDelivered`. Prefer `worktreeFanout` / `worktreeLoopRunner` for NEW local-repo coding.
|
|
339
|
+
*
|
|
340
|
+
* The decode tolerates two `result`-event shapes:
|
|
341
|
+
* 1. the in-process executor's raw worktree-harness result (`{ branch, patch, stats, checks }`),
|
|
342
|
+
* projected onto `CoderOutput`; and
|
|
343
|
+
* 2. an LLM-emitted JSON block (`{ branch, patch, testResult, typecheckResult, diffStats }`),
|
|
344
|
+
* lifted onto `data.result` or scanned out of the assistant transcript (any harness shape).
|
|
345
|
+
*
|
|
346
|
+
* @experimental
|
|
339
347
|
*/
|
|
340
|
-
|
|
341
|
-
return { name: "coder" };
|
|
342
|
-
}
|
|
343
|
-
/** Build the authored `AgentProfile` for one harness on the sandbox-session path: the caller's
|
|
344
|
-
* profile (or the minimal model-only default), with the per-run harness/model/prompt overrides. */
|
|
345
|
-
function coderRunProfile(options) {
|
|
346
|
-
const harness = options.harness ?? "claude-code";
|
|
347
|
-
const name = options.name ?? `coder-${harness}`;
|
|
348
|
-
const base = options.profile ?? minimalCoderProfile();
|
|
349
|
-
return {
|
|
350
|
-
...base,
|
|
351
|
-
name,
|
|
352
|
-
...options.systemPrompt ? { prompt: { systemPrompt: options.systemPrompt } } : {},
|
|
353
|
-
model: options.model ? { default: options.model } : base.model,
|
|
354
|
-
metadata: {
|
|
355
|
-
...base.metadata,
|
|
356
|
-
backendType: harness
|
|
357
|
-
}
|
|
358
|
-
};
|
|
359
|
-
}
|
|
348
|
+
const DEFAULT_MAX_DIFF_LINES = 400;
|
|
360
349
|
/** @experimental Build the `AgentRunSpec<CoderTask>` the sandbox-session `runAgentRounds` path drives. */
|
|
361
|
-
function coderRunSpec(options
|
|
350
|
+
function coderRunSpec(options) {
|
|
351
|
+
const profile = agentProfileSchema.parse(options.profile);
|
|
352
|
+
assertExecutableAgentProfile(profile, "coderRunSpec");
|
|
362
353
|
return {
|
|
363
|
-
name: options.name ??
|
|
364
|
-
profile
|
|
354
|
+
name: options.name ?? profile.name,
|
|
355
|
+
profile,
|
|
365
356
|
taskToPrompt: coderTaskToPrompt
|
|
366
357
|
};
|
|
367
358
|
}
|
|
@@ -373,18 +364,9 @@ const coderOutputAdapter = { parse: parseCoderEvents };
|
|
|
373
364
|
*
|
|
374
365
|
* @experimental
|
|
375
366
|
*/
|
|
376
|
-
function multiHarnessCoderFanout(options
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
"codex",
|
|
380
|
-
"opencode/zai-coding-plan/glm-5.1"
|
|
381
|
-
];
|
|
382
|
-
const models = options.models ?? [];
|
|
383
|
-
const agentRuns = harnesses.map((harness, i) => coderRunSpec({
|
|
384
|
-
...options.profile ? { profile: options.profile } : {},
|
|
385
|
-
harness,
|
|
386
|
-
model: models[i]
|
|
387
|
-
}));
|
|
367
|
+
function multiHarnessCoderFanout(options) {
|
|
368
|
+
if (!options.profiles || options.profiles.length === 0) throw new ConfigError("multiHarnessCoderFanout: at least one exact profile is required");
|
|
369
|
+
const agentRuns = options.profiles.map((profile) => coderRunSpec({ profile }));
|
|
388
370
|
return {
|
|
389
371
|
agentRuns,
|
|
390
372
|
output: coderOutputAdapter,
|
|
@@ -717,7 +699,7 @@ async function runDetachedTurn(options) {
|
|
|
717
699
|
* the trace sinks (OTEL exporter, delegation journal) observe detached work
|
|
718
700
|
* exactly like a streamed `runAgentRounds` run. `runId` = the deterministic session
|
|
719
701
|
* id; cost/token figures are structurally unavailable on the `driveTurn`
|
|
720
|
-
* surface
|
|
702
|
+
* surface, so zero observed subtotals carry explicit unknown flags.
|
|
721
703
|
*/
|
|
722
704
|
function createDetachedTurnTrace(options) {
|
|
723
705
|
const emitter = options.traceEmitter;
|
|
@@ -782,7 +764,13 @@ function createDetachedTurnTrace(options) {
|
|
|
782
764
|
iterationIndex: 0,
|
|
783
765
|
agentRunName,
|
|
784
766
|
costUsd: 0,
|
|
767
|
+
costUsdKnown: false,
|
|
785
768
|
durationMs: endMs - startMs,
|
|
769
|
+
tokenUsage: {
|
|
770
|
+
input: 0,
|
|
771
|
+
output: 0,
|
|
772
|
+
tokensKnown: false
|
|
773
|
+
},
|
|
786
774
|
...error !== void 0 ? { error } : {}
|
|
787
775
|
}
|
|
788
776
|
});
|
|
@@ -793,6 +781,7 @@ function createDetachedTurnTrace(options) {
|
|
|
793
781
|
payload: {
|
|
794
782
|
...error === void 0 ? { winnerIterationIndex: 0 } : {},
|
|
795
783
|
totalCostUsd: 0,
|
|
784
|
+
costUsdKnown: false,
|
|
796
785
|
durationMs: endMs - startMs,
|
|
797
786
|
iterations: 1
|
|
798
787
|
}
|
|
@@ -891,26 +880,26 @@ function createDetachedTurnResumeDriver(options) {
|
|
|
891
880
|
* @experimental
|
|
892
881
|
*/
|
|
893
882
|
function detachedSessionDelegate(options) {
|
|
883
|
+
if (!options.workerProfile) throw new ConfigError("detachedSessionDelegate: workerProfile is required");
|
|
884
|
+
const workerProfile = coderRunSpec({ profile: options.workerProfile }).profile;
|
|
885
|
+
const fanoutProfiles = options.fanoutProfiles?.map((profile) => coderRunSpec({ profile }).profile);
|
|
886
|
+
if (fanoutProfiles?.length === 0) throw new ConfigError("detachedSessionDelegate: fanoutProfiles must not be empty");
|
|
894
887
|
const executor = resolveExecutor(options);
|
|
895
888
|
const sandboxClient = executor.client;
|
|
896
|
-
const fanoutHarnesses = options.fanoutHarnesses;
|
|
897
889
|
const maxConcurrency = options.maxConcurrency ?? 4;
|
|
898
890
|
const traceEmitter = options.traceEmitter;
|
|
899
891
|
return async (args, ctx) => {
|
|
900
892
|
const task = coderTaskFromArgs(args);
|
|
901
893
|
const variants = Math.max(1, Math.trunc(args.variants ?? 1));
|
|
894
|
+
const selectedFanoutProfiles = variants <= 1 ? void 0 : fanoutProfiles ?? Array.from({ length: variants }, () => workerProfile);
|
|
895
|
+
if (selectedFanoutProfiles && selectedFanoutProfiles.length < variants) throw new ConfigError(`detachedSessionDelegate: ${variants} variants requested but only ${selectedFanoutProfiles.length} exact fanout profiles were configured`);
|
|
902
896
|
const loopEmitter = composeLoopTraceEmitters(traceEmitter, ctx.traceEmitter);
|
|
903
897
|
ctx.report({
|
|
904
898
|
iteration: 0,
|
|
905
899
|
phase: "starting"
|
|
906
900
|
});
|
|
907
901
|
if (variants <= 1) {
|
|
908
|
-
const agentRunSpec = coderRunSpec({
|
|
909
|
-
...options.workerProfile ? { profile: options.workerProfile } : {},
|
|
910
|
-
...options.harness ? { harness: options.harness } : {},
|
|
911
|
-
...options.model ? { model: options.model } : {},
|
|
912
|
-
...options.systemPrompt ? { systemPrompt: options.systemPrompt } : {}
|
|
913
|
-
});
|
|
902
|
+
const agentRunSpec = coderRunSpec({ profile: workerProfile });
|
|
914
903
|
const output = coderOutputAdapter;
|
|
915
904
|
const validator = createCoderValidator(task);
|
|
916
905
|
if (ctx.detachedSessionRef !== void 0 && ctx.updateDetachedSessionRef) {
|
|
@@ -935,8 +924,6 @@ function detachedSessionDelegate(options) {
|
|
|
935
924
|
task,
|
|
936
925
|
sessionId,
|
|
937
926
|
signal: ctx.signal,
|
|
938
|
-
...options.harness ? { harness: options.harness } : {},
|
|
939
|
-
...options.model ? { model: options.model } : {},
|
|
940
927
|
...options.reviewer ? { reviewer: options.reviewer } : {}
|
|
941
928
|
});
|
|
942
929
|
ctx.report({
|
|
@@ -972,11 +959,7 @@ function detachedSessionDelegate(options) {
|
|
|
972
959
|
});
|
|
973
960
|
return chosen;
|
|
974
961
|
}
|
|
975
|
-
const fanout = multiHarnessCoderFanout({
|
|
976
|
-
...options.workerProfile ? { profile: options.workerProfile } : {},
|
|
977
|
-
...fanoutHarnesses && fanoutHarnesses.length > 0 ? { harnesses: fanoutHarnesses.slice(0, variants) } : {},
|
|
978
|
-
...options.fanoutModels ? { models: options.fanoutModels.slice(0, variants) } : {}
|
|
979
|
-
});
|
|
962
|
+
const fanout = multiHarnessCoderFanout({ profiles: selectedFanoutProfiles.slice(0, variants) });
|
|
980
963
|
const agentRuns = fanout.agentRuns.slice(0, variants);
|
|
981
964
|
const chosen = await pickCoderWinner({
|
|
982
965
|
iterations: (await runAgentRounds({
|
|
@@ -1136,6 +1119,6 @@ const singleShotDriver = {
|
|
|
1136
1119
|
}
|
|
1137
1120
|
};
|
|
1138
1121
|
//#endregion
|
|
1139
|
-
export { CodexExecutionDiagnosticError, DEFAULT_AWAIT_EVENT_TIMEOUT_MS, DEFAULT_LOCAL_HARNESS, DELEGATE_DESCRIPTION, DELEGATE_FEEDBACK_DESCRIPTION, DELEGATE_FEEDBACK_INPUT_SCHEMA, DELEGATE_FEEDBACK_TOOL_NAME, DELEGATE_INPUT_SCHEMA, DELEGATE_TOOL_NAME, DELEGATE_UI_AUDIT_DESCRIPTION, DELEGATE_UI_AUDIT_INPUT_SCHEMA, DELEGATE_UI_AUDIT_TOOL_NAME, DELEGATION_HISTORY_DESCRIPTION, DELEGATION_HISTORY_INPUT_SCHEMA, DELEGATION_HISTORY_TOOL_NAME, DELEGATION_STATUS_DESCRIPTION, DELEGATION_STATUS_INPUT_SCHEMA, DELEGATION_STATUS_TOOL_NAME, DELEGATION_TRACE_MAX_BYTES, DELEGATION_TRACE_MAX_SPANS, DelegationPersistenceError, DelegationStateCorruptError, DelegationTaskQueue, FileDelegationStore, InMemoryDelegationStore, InMemoryFeedbackStore, LOCAL_HARNESSES, MEMORY_FILE_ENV, MEMORY_ITEMS_ENV, MEMORY_LOG_ENV, MEMORY_NAME_ENV, buildDelegationTraceSpans, capDelegationTrace, captureWorktreeDiff, coderTaskFromArgs, composeLoopTraceEmitters, createCoordinationTools, createDelegateFeedbackHandler, createDelegateHandler, createDelegateUiAuditHandler, createDelegationHistoryHandler, createDelegationStatusHandler, createDelegationTraceCollector, createDetachedTurnResumeDriver, createFleetWorkspaceExecutor, createInProcessExecutor, createInProcessTransport, createKbGate, createMcpServer, createMemoryToolServer, createPropagatingTraceEmitter, createSiblingSandboxExecutor, createStdioToolServer, createWorktree, detachedSessionDelegate, detachedTurnEvents, detectExecutor, eventToSnapshot, formatDetachedSessionRef, harnessSupportsReasoningEffort, hashIdempotencyInput, localHarnessExecutable, mcpToolsForRuntimeMcp, mcpToolsForRuntimeMcpSubset, mergeTraceEnv, parseCodexTokenUsage, parseDetachedSessionRef, parseMemoryItems, readMemoryItemsFile, readTraceContextFromEnv, removeWorktree, resolveMemoryFromEnv, runDetachedTurn,
|
|
1122
|
+
export { CodexExecutionDiagnosticError, DEFAULT_AWAIT_EVENT_TIMEOUT_MS, DEFAULT_LOCAL_HARNESS, DELEGATE_DESCRIPTION, DELEGATE_FEEDBACK_DESCRIPTION, DELEGATE_FEEDBACK_INPUT_SCHEMA, DELEGATE_FEEDBACK_TOOL_NAME, DELEGATE_INPUT_SCHEMA, DELEGATE_TOOL_NAME, DELEGATE_UI_AUDIT_DESCRIPTION, DELEGATE_UI_AUDIT_INPUT_SCHEMA, DELEGATE_UI_AUDIT_TOOL_NAME, DELEGATION_HISTORY_DESCRIPTION, DELEGATION_HISTORY_INPUT_SCHEMA, DELEGATION_HISTORY_TOOL_NAME, DELEGATION_STATUS_DESCRIPTION, DELEGATION_STATUS_INPUT_SCHEMA, DELEGATION_STATUS_TOOL_NAME, DELEGATION_TRACE_MAX_BYTES, DELEGATION_TRACE_MAX_SPANS, DelegationPersistenceError, DelegationStateCorruptError, DelegationTaskQueue, FileDelegationStore, InMemoryDelegationStore, InMemoryFeedbackStore, LOCAL_HARNESSES, MEMORY_FILE_ENV, MEMORY_ITEMS_ENV, MEMORY_LOG_ENV, MEMORY_NAME_ENV, buildDelegationTraceSpans, capDelegationTrace, captureWorktreeDiff, coderTaskFromArgs, composeLoopTraceEmitters, createCoordinationTools, createDelegateFeedbackHandler, createDelegateHandler, createDelegateUiAuditHandler, createDelegationHistoryHandler, createDelegationStatusHandler, createDelegationTraceCollector, createDetachedTurnResumeDriver, createFleetWorkspaceExecutor, createInProcessExecutor, createInProcessTransport, createKbGate, createMcpServer, createMemoryToolServer, createPropagatingTraceEmitter, createSiblingSandboxExecutor, createStdioToolServer, createWorktree, detachedSessionDelegate, detachedTurnEvents, detectExecutor, eventToSnapshot, formatDetachedSessionRef, harnessSupportsReasoningEffort, hashIdempotencyInput, localHarnessExecutable, mcpToolsForRuntimeMcp, mcpToolsForRuntimeMcpSubset, mergeTraceEnv, parseCodexTokenUsage, parseDetachedSessionRef, parseMemoryItems, readMemoryItemsFile, readTraceContextFromEnv, removeWorktree, resolveMemoryFromEnv, runDetachedTurn, settleDetachedCoderTurn, traceContextToEnv, validateDelegateArgs, validateDelegateFeedbackArgs, validateDelegateUiAuditArgs, validateDelegationHistoryArgs, validateDelegationStatusArgs };
|
|
1140
1123
|
|
|
1141
1124
|
//# sourceMappingURL=index.js.map
|