@tangle-network/agent-runtime 0.102.0 → 0.102.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.
Files changed (77) hide show
  1. package/dist/agent.d.ts +1 -1
  2. package/dist/agent.js +5 -3
  3. package/dist/agent.js.map +1 -1
  4. package/dist/analyst-loop.d.ts +1 -1
  5. package/dist/candidate-execution/index.js +5 -4
  6. package/dist/{chunk-SPCD4IQQ.js → chunk-377GOJHJ.js} +2 -2
  7. package/dist/{chunk-LKKIM5QD.js → chunk-3DW5DEKQ.js} +3 -3
  8. package/dist/{chunk-KVJQV342.js → chunk-6MR4IJRW.js} +25 -1777
  9. package/dist/chunk-6MR4IJRW.js.map +1 -0
  10. package/dist/{chunk-4AMAFNUD.js → chunk-7FJJUC73.js} +311 -40
  11. package/dist/chunk-7FJJUC73.js.map +1 -0
  12. package/dist/{chunk-23Z7N5IG.js → chunk-CI7WS6S2.js} +5 -5
  13. package/dist/{chunk-DA7YL6I4.js → chunk-CK76OZPM.js} +3 -3
  14. package/dist/{chunk-KSBUSEUA.js → chunk-KJ2Q4T7F.js} +2 -2
  15. package/dist/{chunk-MAONWP4R.js → chunk-KPHTCHQ4.js} +611 -1419
  16. package/dist/chunk-KPHTCHQ4.js.map +1 -0
  17. package/dist/{chunk-AIBIRAJ6.js → chunk-KSM6GFHP.js} +2 -2
  18. package/dist/chunk-L5DST3QC.js +351 -0
  19. package/dist/chunk-L5DST3QC.js.map +1 -0
  20. package/dist/{chunk-TGDHHHH4.js → chunk-LJLG734E.js} +12 -253
  21. package/dist/chunk-LJLG734E.js.map +1 -0
  22. package/dist/chunk-ROILMKDL.js +1338 -0
  23. package/dist/chunk-ROILMKDL.js.map +1 -0
  24. package/dist/{chunk-N2CEE5Q3.js → chunk-RTB3TC73.js} +3 -3
  25. package/dist/chunk-SQ3ZJH3Y.js +3082 -0
  26. package/dist/chunk-SQ3ZJH3Y.js.map +1 -0
  27. package/dist/chunk-UPWGXKXB.js +254 -0
  28. package/dist/chunk-UPWGXKXB.js.map +1 -0
  29. package/dist/{completion-gate-C80jiRfN.d.ts → completion-gate-C6dhVN-N.d.ts} +2 -2
  30. package/dist/{coordination-BFE3Den7.d.ts → coordination-D9l_YmwW.d.ts} +6 -6
  31. package/dist/environment-provider.d.ts +2 -2
  32. package/dist/{improve-CIml6hT3.d.ts → improve-B40dRu0X.d.ts} +40 -19
  33. package/dist/index.d.ts +329 -21
  34. package/dist/index.js +541 -137
  35. package/dist/index.js.map +1 -1
  36. package/dist/intelligence.d.ts +5 -5
  37. package/dist/intelligence.js +7 -5
  38. package/dist/intelligence.js.map +1 -1
  39. package/dist/knowledge.d.ts +8 -8
  40. package/dist/knowledge.js +9 -7
  41. package/dist/{local-harness-ZqCx51u7.d.ts → local-harness-CtK9dSny.d.ts} +14 -2
  42. package/dist/{loop-runner-bin-Cn1N2rRo.d.ts → loop-runner-bin-PnWslIw4.d.ts} +2 -2
  43. package/dist/loop-runner-bin.d.ts +6 -6
  44. package/dist/loop-runner-bin.js +6 -4
  45. package/dist/loops.d.ts +231 -460
  46. package/dist/loops.js +58 -37
  47. package/dist/mcp/bin.js +2 -2
  48. package/dist/mcp/index.d.ts +184 -12
  49. package/dist/mcp/index.js +31 -9
  50. package/dist/mcp/index.js.map +1 -1
  51. package/dist/mcp/memory-bin.d.ts +1 -0
  52. package/dist/mcp/memory-bin.js +22 -0
  53. package/dist/mcp/memory-bin.js.map +1 -0
  54. package/dist/profiles.d.ts +3 -3
  55. package/dist/structural-rollout-D7xik9XR.d.ts +446 -0
  56. package/dist/{substrate-DO2GHNg2.d.ts → substrate-Dyiqmd3o.d.ts} +1 -1
  57. package/dist/{supervise-BLPI50-w.d.ts → supervise-BQdNAXtK.d.ts} +4 -4
  58. package/dist/testing.js +10 -8
  59. package/dist/testing.js.map +1 -1
  60. package/dist/{types-B3vAW0Oq.d.ts → types-CLat4bT9.d.ts} +1 -1
  61. package/dist/{types-CmnA2iL3.d.ts → types-D870JlH0.d.ts} +2 -2
  62. package/dist/{worktree-fanout-DCA3G4bO.d.ts → worktree-fanout-DsIR4d6w.d.ts} +234 -234
  63. package/package.json +4 -3
  64. package/dist/chunk-4AMAFNUD.js.map +0 -1
  65. package/dist/chunk-IKGCKPDX.js +0 -1115
  66. package/dist/chunk-IKGCKPDX.js.map +0 -1
  67. package/dist/chunk-KVJQV342.js.map +0 -1
  68. package/dist/chunk-MAONWP4R.js.map +0 -1
  69. package/dist/chunk-TGDHHHH4.js.map +0 -1
  70. package/dist/{chunk-SPCD4IQQ.js.map → chunk-377GOJHJ.js.map} +0 -0
  71. package/dist/{chunk-LKKIM5QD.js.map → chunk-3DW5DEKQ.js.map} +0 -0
  72. package/dist/{chunk-23Z7N5IG.js.map → chunk-CI7WS6S2.js.map} +0 -0
  73. package/dist/{chunk-DA7YL6I4.js.map → chunk-CK76OZPM.js.map} +0 -0
  74. package/dist/{chunk-KSBUSEUA.js.map → chunk-KJ2Q4T7F.js.map} +0 -0
  75. package/dist/{chunk-AIBIRAJ6.js.map → chunk-KSM6GFHP.js.map} +0 -0
  76. package/dist/{chunk-N2CEE5Q3.js.map → chunk-RTB3TC73.js.map} +0 -0
  77. package/dist/{sanitize-BTSsdBXw.d.ts → sanitize-DEbPNtyI.d.ts} +58 -58
package/dist/loops.js CHANGED
@@ -1,23 +1,20 @@
1
1
  import {
2
2
  FileCorpus,
3
3
  InMemoryCorpus,
4
+ McpSpawnFault,
4
5
  SandboxRunAbortError,
5
- adaptiveRefine,
6
6
  analyzeTrace,
7
7
  anytimeReport,
8
8
  assertStrategyContract,
9
9
  assertTraceDerivedFindings,
10
10
  auditIntent,
11
11
  authorStrategy,
12
- breadthStrategy,
13
12
  buildSteerContext,
14
13
  builtinShapes,
15
- canDisplace,
16
14
  collectAgentTurn,
17
- compareCheckOutcomes,
18
15
  completionAuthorizes,
19
- composeCheckSources,
20
16
  computeFindingId,
17
+ connectStdioMcp,
21
18
  createMcpEnvironment,
22
19
  createPushTraceSource,
23
20
  createScopeAnalyst,
@@ -25,22 +22,17 @@ import {
25
22
  createVerifierEnvironment,
26
23
  createWaterfallCollector,
27
24
  decodeToolPart,
28
- defaultAnalystInstruction,
29
25
  defaultAuditorInstruction,
30
- defaultExtractCandidate,
31
- defaultStructuralRolloutPolicy,
32
26
  defaultToolDetectors,
33
27
  defineLeaderboard,
34
28
  definePersona,
35
- defineStrategy,
36
- depthStrategy,
37
29
  deterministicCompletion,
38
30
  discriminatingMeans,
39
31
  dumbDriver,
32
+ envKeyProvider,
40
33
  equalKOnCost,
41
34
  failuresAnalyst,
42
35
  fanout,
43
- filterAuthoredAsserts,
44
36
  flatWidenGate,
45
37
  gitWorkspace,
46
38
  harvestCorpus,
@@ -48,15 +40,15 @@ import {
48
40
  inlineSandboxClient,
49
41
  jjWorkspace,
50
42
  leaderboard,
43
+ localSandboxClient,
51
44
  localShell,
52
45
  loopCampaignDispatch,
53
46
  loopDispatch,
54
47
  loopUntil,
55
48
  makeFinding,
56
- modelAuthoredChecks,
49
+ materializeLocalMcp,
50
+ mcpSecretEnvMetadataKey,
57
51
  naiveDriver,
58
- observe,
59
- officialChecksFromMeta,
60
52
  openSandboxRun,
61
53
  pairwiseSignificance,
62
54
  panel,
@@ -65,7 +57,6 @@ import {
65
57
  pipeline,
66
58
  printBenchmarkReport,
67
59
  promotionGate,
68
- refine,
69
60
  registerShape,
70
61
  registryScopeAnalyst,
71
62
  renderAnytimeTable,
@@ -74,35 +65,29 @@ import {
74
65
  renderLeaderboardMarkdown,
75
66
  renderLeaderboardSvg,
76
67
  renderPairwiseMarkdown,
77
- renderReport,
78
68
  reportLoopUsage,
79
- resolveEntrySymbol,
80
69
  resolveSandboxClient,
81
- runAgentic,
70
+ resolveSecretEnv,
82
71
  runBenchmark,
83
72
  runInWorkspace,
84
73
  runPersonified,
85
74
  runStrategyEvolution,
86
- sample,
87
- sampleThenRefine,
88
- sandboxCheckRunner,
89
75
  sandboxSessionTraceSource,
90
- selectBestIndex,
76
+ sanitizeMcpToolSchema,
77
+ secretEnvOfMcpServer,
91
78
  selectChampion,
92
79
  selectValidWinner,
93
80
  sentinelCompletion,
94
81
  stopSentinel,
95
82
  strategyAuthorContract,
96
83
  streamAgentTurn,
97
- structuralRollout,
98
84
  superviseSurface,
99
85
  trajectoryReport,
100
86
  verify,
101
- visibleCheckScore,
102
87
  watchTrace,
103
88
  widen,
104
89
  worktreeFanout
105
- } from "./chunk-MAONWP4R.js";
90
+ } from "./chunk-KPHTCHQ4.js";
106
91
  import "./chunk-Q2JSAVQ3.js";
107
92
  import {
108
93
  acquireSandbox,
@@ -110,15 +95,12 @@ import {
110
95
  assessAuthoredProfile,
111
96
  authoredWorker,
112
97
  cliWorktreeExecutor,
113
- createBudgetPool,
114
98
  createEventBus,
115
99
  createExecutor,
116
100
  createExecutorRegistry,
117
101
  createInMemoryRunContext,
118
102
  createInbox,
119
103
  createSandboxLineage,
120
- createScope,
121
- createSupervisor,
122
104
  createWorktreeCliExecutor,
123
105
  defaultDelegateBudget,
124
106
  defaultProfileRichnessThresholds,
@@ -129,24 +111,54 @@ import {
129
111
  gateOnDeliverable,
130
112
  probeSandboxCapabilities,
131
113
  profileRichnessFinding,
132
- routerBrain,
133
- routerChatWithTools,
134
- routerChatWithUsage,
135
- routerToolLoop,
136
114
  runLoop,
137
115
  serveCoordinationMcp,
138
- settledToIteration,
139
- spendFromUsageEvents,
140
116
  supervise,
141
117
  supervisorAgent,
142
118
  supervisorInstructions,
143
119
  workerFromBackend
144
- } from "./chunk-KVJQV342.js";
120
+ } from "./chunk-6MR4IJRW.js";
145
121
  import "./chunk-DPEUKJRO.js";
122
+ import {
123
+ adaptiveRefine,
124
+ breadthStrategy,
125
+ canDisplace,
126
+ compareCheckOutcomes,
127
+ composeCheckSources,
128
+ defaultAnalystInstruction,
129
+ defaultExtractCandidate,
130
+ defaultStructuralRolloutPolicy,
131
+ defineStrategy,
132
+ depthStrategy,
133
+ filterAuthoredAsserts,
134
+ modelAuthoredChecks,
135
+ observe,
136
+ officialChecksFromMeta,
137
+ refine,
138
+ renderReport,
139
+ resolveEntrySymbol,
140
+ runAgentic,
141
+ sample,
142
+ sampleThenRefine,
143
+ sandboxCheckRunner,
144
+ selectBestIndex,
145
+ structuralRollout,
146
+ visibleCheckScore
147
+ } from "./chunk-ROILMKDL.js";
148
+ import "./chunk-UPWGXKXB.js";
146
149
  import "./chunk-2VZYRB55.js";
147
150
  import {
148
- assertModelAllowed
149
- } from "./chunk-IKGCKPDX.js";
151
+ assertModelAllowed,
152
+ createBudgetPool,
153
+ createScope,
154
+ createSupervisor,
155
+ routerBrain,
156
+ routerChatWithTools,
157
+ routerChatWithUsage,
158
+ routerToolLoop,
159
+ settledToIteration,
160
+ spendFromUsageEvents
161
+ } from "./chunk-SQ3ZJH3Y.js";
150
162
  import {
151
163
  InMemoryResultBlobStore,
152
164
  InMemorySpawnJournal,
@@ -173,6 +185,7 @@ export {
173
185
  InMemoryCorpus,
174
186
  InMemoryResultBlobStore,
175
187
  InMemorySpawnJournal,
188
+ McpSpawnFault,
176
189
  SandboxRunAbortError,
177
190
  acquireSandbox,
178
191
  adaptiveRefine,
@@ -196,6 +209,7 @@ export {
196
209
  completionAuthorizes,
197
210
  composeCheckSources,
198
211
  computeFindingId,
212
+ connectStdioMcp,
199
213
  contentAddress,
200
214
  createAgentEnvironmentProviderRegistry,
201
215
  createBudgetPool,
@@ -233,6 +247,7 @@ export {
233
247
  discriminatingMeans,
234
248
  driverAgent,
235
249
  dumbDriver,
250
+ envKeyProvider,
236
251
  equalKOnCost,
237
252
  extractLlmCallEvent,
238
253
  failuresAnalyst,
@@ -247,6 +262,7 @@ export {
247
262
  inlineSandboxClient,
248
263
  jjWorkspace,
249
264
  leaderboard,
265
+ localSandboxClient,
250
266
  localShell,
251
267
  loopCampaignDispatch,
252
268
  loopDispatch,
@@ -254,6 +270,8 @@ export {
254
270
  makeFinding,
255
271
  mapSandboxEvent,
256
272
  mapSandboxToolEvent,
273
+ materializeLocalMcp,
274
+ mcpSecretEnvMetadataKey,
257
275
  modelAuthoredChecks,
258
276
  naiveDriver,
259
277
  observe,
@@ -284,6 +302,7 @@ export {
284
302
  resolveAgentEnvironmentProvider,
285
303
  resolveEntrySymbol,
286
304
  resolveSandboxClient,
305
+ resolveSecretEnv,
287
306
  routerBrain,
288
307
  routerChatWithTools,
289
308
  routerChatWithUsage,
@@ -299,6 +318,8 @@ export {
299
318
  sandboxCheckRunner,
300
319
  sandboxClientAsProvider,
301
320
  sandboxSessionTraceSource,
321
+ sanitizeMcpToolSchema,
322
+ secretEnvOfMcpServer,
302
323
  selectBestIndex,
303
324
  selectChampion,
304
325
  selectValidWinner,
package/dist/mcp/bin.js CHANGED
@@ -9,10 +9,10 @@ import {
9
9
  DelegationTaskQueue,
10
10
  FileDelegationStore,
11
11
  createMcpServer
12
- } from "../chunk-KVJQV342.js";
12
+ } from "../chunk-6MR4IJRW.js";
13
13
  import "../chunk-DPEUKJRO.js";
14
14
  import "../chunk-2VZYRB55.js";
15
- import "../chunk-IKGCKPDX.js";
15
+ import "../chunk-SQ3ZJH3Y.js";
16
16
  import "../chunk-IMSNJSXH.js";
17
17
  import "../chunk-M6MD6JBS.js";
18
18
  import "../chunk-3MDZX7YU.js";
@@ -1,19 +1,19 @@
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
- import { L as LocalHarness, r as runLocalHarness } from '../local-harness-ZqCx51u7.js';
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-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';
1
+ import { S as SandboxClient, b as LoopSandboxPlacement } from '../types-CLat4bT9.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-D9l_YmwW.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-D9l_YmwW.js';
4
+ import { L as LocalHarness, r as runLocalHarness } from '../local-harness-CtK9dSny.js';
5
+ export { a as CodexExecutionEvidence, c as CodexExecutionPolicy, C as CodexTokenUsage, b as LocalHarnessResult, R as RunLocalHarnessOptions, p as parseCodexTokenUsage } from '../local-harness-CtK9dSny.js';
6
+ import { G as GitRunner } from '../completion-gate-C6dhVN-N.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-C6dhVN-N.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
+ import { AgentProfileMcpServer } from '@tangle-network/agent-interface';
9
10
  export { m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from '../openai-tools-fnj6SRVg.js';
10
11
  import { AnalystFinding } from '@tangle-network/agent-eval';
11
- import { U as UiLens } from '../substrate-DO2GHNg2.js';
12
+ import { a as UiLens } from '../substrate-Dyiqmd3o.js';
12
13
  import '@tangle-network/sandbox';
13
14
  import '../types-BwoZWq-i.js';
14
- import '../types-CmnA2iL3.js';
15
- import '@tangle-network/agent-interface';
16
- import '../sanitize-BTSsdBXw.js';
15
+ import '../types-D870JlH0.js';
16
+ import '../sanitize-DEbPNtyI.js';
17
17
  import '../environment-provider.js';
18
18
  import '@tangle-network/agent-interface/environment-provider';
19
19
  import 'node:child_process';
@@ -25,6 +25,7 @@ interface CodexExecutionFailureDiagnostic {
25
25
  exitCode: number | null;
26
26
  killedBySignal: NodeJS.Signals | null;
27
27
  timedOut: boolean;
28
+ aborted?: boolean;
28
29
  durationMs: number;
29
30
  stdout: string;
30
31
  stderr: string;
@@ -120,6 +121,177 @@ interface InProcessExecutorDescribePlacement extends LoopSandboxPlacement {
120
121
  */
121
122
  declare function createInProcessExecutor(options: InProcessExecutorOptions): DelegationExecutor;
122
123
 
124
+ /**
125
+ * `createStdioToolServer` — the generic newline-delimited JSON-RPC 2.0 MCP
126
+ * server core: `initialize` / `notifications/initialized` / `tools/list` /
127
+ * `tools/call` over a stdio-shaped transport, protocol 2024-11-05.
128
+ *
129
+ * Extracted from `createMcpServer` (server.ts) so every in-repo MCP server —
130
+ * the delegation server, the memory server — serves the ONE wire protocol the
131
+ * same-host client (`connectStdioMcp`, runtime/stdio-mcp-client.ts) speaks.
132
+ * A second hand-rolled serve loop could drift from what the client expects;
133
+ * this core makes that impossible by construction.
134
+ *
135
+ * @experimental
136
+ */
137
+ /** @experimental */
138
+ interface McpToolDescriptor {
139
+ name: string;
140
+ description: string;
141
+ inputSchema: Record<string, unknown>;
142
+ handler: (raw: unknown) => Promise<unknown>;
143
+ }
144
+ /** @experimental */
145
+ interface McpTransport {
146
+ input: NodeJS.ReadableStream;
147
+ output: NodeJS.WritableStream;
148
+ }
149
+ /** @experimental */
150
+ interface JsonRpcMessage {
151
+ jsonrpc: '2.0';
152
+ id?: number | string | null;
153
+ method: string;
154
+ params?: unknown;
155
+ }
156
+ /** @experimental */
157
+ interface JsonRpcResponse {
158
+ jsonrpc: '2.0';
159
+ id: number | string | null;
160
+ result?: unknown;
161
+ error?: {
162
+ code: number;
163
+ message: string;
164
+ data?: unknown;
165
+ };
166
+ }
167
+ /** @experimental */
168
+ interface StdioToolServerOptions {
169
+ /** Server display name surfaced via `initialize`. */
170
+ serverName: string;
171
+ /** Server version surfaced via `initialize`. */
172
+ serverVersion: string;
173
+ /** The tools to serve. Duplicate names throw — a silent shadow would hide a tool. */
174
+ tools: readonly McpToolDescriptor[];
175
+ }
176
+ /** @experimental */
177
+ interface StdioToolServer {
178
+ /** Tools currently registered, keyed by name. */
179
+ readonly tools: ReadonlyMap<string, McpToolDescriptor>;
180
+ /** Handle a single parsed JSON-RPC message. Returns the response object (or `null` for notifications). */
181
+ handle(message: JsonRpcMessage): Promise<JsonRpcResponse | null>;
182
+ /** Drive the server on a stdio-shaped transport until `stop()` is called. */
183
+ serve(transport?: McpTransport): Promise<void>;
184
+ /** Stop a `serve` call. Subsequent requests are rejected. */
185
+ stop(): void;
186
+ }
187
+ /** Build the generic stdio JSON-RPC tool server. */
188
+ declare function createStdioToolServer(options: StdioToolServerOptions): StdioToolServer;
189
+
190
+ /**
191
+ * Memory MCP server — the LIVE serving half of the `memory` profile surface
192
+ * (Phase 5). A curated memory (lessons distilled from prior runs) is only
193
+ * real if the DRIVEN agent can query it mid-task; this module serves a flat
194
+ * store of `MemoryItem` rows as `memory_search` / `memory_get` tools over the
195
+ * ONE in-repo stdio JSON-RPC core (`createStdioToolServer`), so the exact
196
+ * wire protocol the same-host client (`connectStdioMcp` /
197
+ * `materializeLocalMcp`, runtime/stdio-mcp-client.ts) speaks is guaranteed by
198
+ * construction — serve and consume cannot drift.
199
+ *
200
+ * Retrieval is DETERMINISTIC lexical overlap (no vectors, no LLM): a lift
201
+ * measured with this memory mounted is attributable to the lessons
202
+ * themselves, never to retrieval-model noise — the same discipline as
203
+ * agent-eval's `memoryCurationProposer` (deterministic curation). Every
204
+ * `memory_search` can append one JSONL row to a retrieval log (`logPath`) —
205
+ * the per-query record an off-policy retrieval estimator (agent-knowledge's
206
+ * `RetrievalHoldout`) consumes. agent-knowledge is NOT a dependency of this
207
+ * repo, so the log file is the flagged cross-package seam, not an import.
208
+ *
209
+ * Fail-loud discipline (mirrors `materializeLocalMcp`): an EMPTY memory is
210
+ * never served — a profile without memory simply omits the artifact, and
211
+ * silently serving zero rows would fake the with/without ablation.
212
+ *
213
+ * @experimental
214
+ */
215
+
216
+ /** One row of agent memory: a crisp lesson/fact with provenance. */
217
+ interface MemoryItem {
218
+ /** Stable id (content-hash by convention; see `memoryArtifactFromLessons`). */
219
+ id: string;
220
+ /** The lesson itself — one imperative or observation the agent should recall. */
221
+ text: string;
222
+ /** Optional retrieval tags, matched by `memory_search` alongside the text. */
223
+ tags?: string[];
224
+ /** Provenance: the finding / trace / curation pass this row came from. */
225
+ source?: string;
226
+ }
227
+ /**
228
+ * The `memory` artifact payload — HOW a profile's memory is stored and served:
229
+ *
230
+ * - `store: 'file'` — served by the in-repo memory bin
231
+ * (`agent-runtime-memory-mcp`, src/mcp/memory-bin.ts): rows load from
232
+ * `path` (a JSON array or JSONL file of `MemoryItem`) and/or the inline
233
+ * `items` seed (inline wins on id collision). At least one of
234
+ * `path`/`items` is required.
235
+ * - `store: 'mcp'` — an EXTERNAL, already-runnable MCP server that exposes
236
+ * the memory tools itself; `server` is required and mounts verbatim.
237
+ *
238
+ * `logPath` makes the served memory append one JSONL row per `memory_search`
239
+ * — the retrieval log a holdout estimator reads (see module doc).
240
+ */
241
+ interface AgentMemorySpec {
242
+ store: 'file' | 'mcp';
243
+ /** `store:'file'` — host path to the durable row store (JSON array or JSONL). */
244
+ path?: string;
245
+ /** Inline seed rows, served alongside (and winning over) `path` rows. */
246
+ items?: MemoryItem[];
247
+ /** `store:'mcp'` — the external server that already serves memory tools. */
248
+ server?: AgentProfileMcpServer;
249
+ /** JSONL retrieval log: one row per `memory_search` (ts, query, k, returned). */
250
+ logPath?: string;
251
+ }
252
+ /** Env var naming the durable row store file the memory bin loads (the
253
+ * `memoryMcpServer` ↔ memory-bin contract). */
254
+ declare const MEMORY_FILE_ENV = "AGENT_MEMORY_FILE";
255
+ /** Env var carrying inline JSON `MemoryItem` rows (win over file rows on id). */
256
+ declare const MEMORY_ITEMS_ENV = "AGENT_MEMORY_ITEMS";
257
+ /** Env var naming the JSONL retrieval log (one row per `memory_search`). */
258
+ declare const MEMORY_LOG_ENV = "AGENT_MEMORY_LOG";
259
+ /** Env var overriding the served display name (default 'agent-memory'). */
260
+ declare const MEMORY_NAME_ENV = "AGENT_MEMORY_NAME";
261
+ interface CreateMemoryToolServerOptions {
262
+ /** The rows to serve. MUST be non-empty (an empty memory is never served). */
263
+ items: readonly MemoryItem[];
264
+ /** Server display name surfaced via `initialize`. Default 'agent-memory'. */
265
+ serverName?: string;
266
+ /** Server version surfaced via `initialize`. Default '0'. */
267
+ serverVersion?: string;
268
+ /** Default result count for `memory_search`. Default 5. */
269
+ defaultK?: number;
270
+ /** Append one JSONL row per `memory_search` (the retrieval-holdout seam). */
271
+ logPath?: string;
272
+ }
273
+ /**
274
+ * Build the memory MCP server: `memory_search` (lexical top-k over the rows)
275
+ * and `memory_get` (one row by id) on the generic stdio JSON-RPC core.
276
+ */
277
+ declare function createMemoryToolServer(opts: CreateMemoryToolServerOptions): StdioToolServer;
278
+ /** Coerce an untrusted JSON array into validated `MemoryItem` rows. */
279
+ declare function parseMemoryItems(value: unknown, source: string): MemoryItem[];
280
+ /** Read a memory store file: a JSON array, or JSONL (one `MemoryItem` per line). */
281
+ declare function readMemoryItemsFile(path: string): MemoryItem[];
282
+ /** What the memory bin resolved from its environment. */
283
+ interface ResolvedMemoryEnv {
284
+ items: MemoryItem[];
285
+ serverName?: string;
286
+ logPath?: string;
287
+ }
288
+ /**
289
+ * Resolve the bin's memory from `AGENT_MEMORY_FILE` (durable store) and/or
290
+ * `AGENT_MEMORY_ITEMS` (inline JSON rows; wins on id collision). Zero rows is
291
+ * a boot FAILURE, matching the fail-closed materialization discipline.
292
+ */
293
+ declare function resolveMemoryFromEnv(env: Record<string, string | undefined>): ResolvedMemoryEnv;
294
+
123
295
  /**
124
296
  *
125
297
  * The trace-analyst KIND directory — the operator's lenses, as composable DATA.
@@ -457,4 +629,4 @@ interface DelegationStatusHandlerOptions {
457
629
  /** Build the MCP tool handler that polls a `DelegationTaskQueue` for task status. @experimental */
458
630
  declare function createDelegationStatusHandler(options: DelegationStatusHandlerOptions): (raw: unknown) => Promise<DelegationStatusResult>;
459
631
 
460
- export { type Check, type CheckRunnerOptions, CodexExecutionDiagnosticError, type CodexExecutionFailureDiagnostic, DELEGATE_FEEDBACK_DESCRIPTION, DELEGATE_FEEDBACK_INPUT_SCHEMA, DELEGATE_FEEDBACK_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, DelegateFeedbackArgs, DelegateFeedbackResult, DelegateUiAuditArgs, DelegateUiAuditResult, DelegationExecutor, DelegationHistoryArgs, DelegationHistoryResult, DelegationStatusArgs, DelegationStatusResult, DelegationTaskQueue, type DetectExecutorArgs, FeedbackStore, FleetHandle, GitRunner, type InProcessExecutorDescribePlacement, type InProcessExecutorOptions, LocalHarness, UiAuditorDelegate, createDelegateFeedbackHandler, createDelegateUiAuditHandler, createDelegationHistoryHandler, createDelegationStatusHandler, createInProcessExecutor, defaultChecks, detectExecutor, liftFindings, makeCheckRunner, renderTrace, runCheck, runLocalHarness, validateDelegateFeedbackArgs, validateDelegateUiAuditArgs, validateDelegationHistoryArgs, validateDelegationStatusArgs };
632
+ export { type AgentMemorySpec, type Check, type CheckRunnerOptions, CodexExecutionDiagnosticError, type CodexExecutionFailureDiagnostic, type CreateMemoryToolServerOptions, DELEGATE_FEEDBACK_DESCRIPTION, DELEGATE_FEEDBACK_INPUT_SCHEMA, DELEGATE_FEEDBACK_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, DelegateFeedbackArgs, DelegateFeedbackResult, DelegateUiAuditArgs, DelegateUiAuditResult, DelegationExecutor, DelegationHistoryArgs, DelegationHistoryResult, DelegationStatusArgs, DelegationStatusResult, DelegationTaskQueue, type DetectExecutorArgs, FeedbackStore, FleetHandle, GitRunner, type InProcessExecutorDescribePlacement, type InProcessExecutorOptions, LocalHarness, MEMORY_FILE_ENV, MEMORY_ITEMS_ENV, MEMORY_LOG_ENV, MEMORY_NAME_ENV, type MemoryItem, type ResolvedMemoryEnv, type McpToolDescriptor as StdioToolDescriptor, type StdioToolServer, type StdioToolServerOptions, UiAuditorDelegate, createDelegateFeedbackHandler, createDelegateUiAuditHandler, createDelegationHistoryHandler, createDelegationStatusHandler, createInProcessExecutor, createMemoryToolServer, createStdioToolServer, defaultChecks, detectExecutor, liftFindings, makeCheckRunner, parseMemoryItems, readMemoryItemsFile, renderTrace, resolveMemoryFromEnv, runCheck, runLocalHarness, validateDelegateFeedbackArgs, validateDelegateUiAuditArgs, validateDelegationHistoryArgs, validateDelegationStatusArgs };
package/dist/mcp/index.js CHANGED
@@ -6,10 +6,21 @@ import {
6
6
  readTraceContextFromEnv,
7
7
  traceContextToEnv
8
8
  } from "../chunk-AYU35OTU.js";
9
+ import {
10
+ MEMORY_FILE_ENV,
11
+ MEMORY_ITEMS_ENV,
12
+ MEMORY_LOG_ENV,
13
+ MEMORY_NAME_ENV,
14
+ createMemoryToolServer,
15
+ createStdioToolServer,
16
+ parseMemoryItems,
17
+ readMemoryItemsFile,
18
+ resolveMemoryFromEnv
19
+ } from "../chunk-L5DST3QC.js";
9
20
  import {
10
21
  mcpToolsForRuntimeMcp,
11
22
  mcpToolsForRuntimeMcpSubset
12
- } from "../chunk-KSBUSEUA.js";
23
+ } from "../chunk-KJ2Q4T7F.js";
13
24
  import {
14
25
  createKbGate
15
26
  } from "../chunk-SGKPNBXE.js";
@@ -17,7 +28,7 @@ import {
17
28
  assertTraceDerivedFindings,
18
29
  runCoderChecks,
19
30
  selectValidWinner
20
- } from "../chunk-MAONWP4R.js";
31
+ } from "../chunk-KPHTCHQ4.js";
21
32
  import "../chunk-Q2JSAVQ3.js";
22
33
  import {
23
34
  DELEGATE_DESCRIPTION,
@@ -45,7 +56,6 @@ import {
45
56
  InMemoryFeedbackStore,
46
57
  buildDelegationTraceSpans,
47
58
  capDelegationTrace,
48
- captureWorktreeDiff,
49
59
  composeLoopTraceEmitters,
50
60
  createCoordinationTools,
51
61
  createDelegateFeedbackHandler,
@@ -57,25 +67,28 @@ import {
57
67
  createInProcessTransport,
58
68
  createMcpServer,
59
69
  createSandboxForSpec,
60
- createWorktree,
61
70
  eventToSnapshot,
62
71
  hashIdempotencyInput,
63
- removeWorktree,
64
72
  runLoop,
65
- runWorktreeHarness,
66
73
  validateDelegateArgs,
67
74
  validateDelegateFeedbackArgs,
68
75
  validateDelegateUiAuditArgs,
69
76
  validateDelegationHistoryArgs,
70
77
  validateDelegationStatusArgs
71
- } from "../chunk-KVJQV342.js";
78
+ } from "../chunk-6MR4IJRW.js";
72
79
  import "../chunk-DPEUKJRO.js";
80
+ import "../chunk-ROILMKDL.js";
81
+ import "../chunk-UPWGXKXB.js";
73
82
  import "../chunk-2VZYRB55.js";
74
83
  import {
75
84
  CodexExecutionDiagnosticError,
85
+ captureWorktreeDiff,
86
+ createWorktree,
76
87
  parseCodexTokenUsage,
77
- runLocalHarness
78
- } from "../chunk-IKGCKPDX.js";
88
+ removeWorktree,
89
+ runLocalHarness,
90
+ runWorktreeHarness
91
+ } from "../chunk-SQ3ZJH3Y.js";
79
92
  import "../chunk-IMSNJSXH.js";
80
93
  import "../chunk-M6MD6JBS.js";
81
94
  import {
@@ -1208,6 +1221,10 @@ export {
1208
1221
  FileDelegationStore,
1209
1222
  InMemoryDelegationStore,
1210
1223
  InMemoryFeedbackStore,
1224
+ MEMORY_FILE_ENV,
1225
+ MEMORY_ITEMS_ENV,
1226
+ MEMORY_LOG_ENV,
1227
+ MEMORY_NAME_ENV,
1211
1228
  buildDelegationTraceSpans,
1212
1229
  capDelegationTrace,
1213
1230
  captureWorktreeDiff,
@@ -1226,8 +1243,10 @@ export {
1226
1243
  createInProcessTransport,
1227
1244
  createKbGate,
1228
1245
  createMcpServer,
1246
+ createMemoryToolServer,
1229
1247
  createPropagatingTraceEmitter,
1230
1248
  createSiblingSandboxExecutor,
1249
+ createStdioToolServer,
1231
1250
  createWorktree,
1232
1251
  defaultChecks,
1233
1252
  detachedSessionDelegate,
@@ -1242,9 +1261,12 @@ export {
1242
1261
  mcpToolsForRuntimeMcpSubset,
1243
1262
  parseCodexTokenUsage,
1244
1263
  parseDetachedSessionRef,
1264
+ parseMemoryItems,
1265
+ readMemoryItemsFile,
1245
1266
  readTraceContextFromEnv,
1246
1267
  removeWorktree,
1247
1268
  renderTrace,
1269
+ resolveMemoryFromEnv,
1248
1270
  runCheck,
1249
1271
  runDetachedTurn,
1250
1272
  runLocalHarness,