maka-agent 0.2.0-dev.30.20260912 → 0.2.0-dev.32.20260914

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 (245) hide show
  1. package/THIRD_PARTY_NOTICES.txt +392 -0
  2. package/dist/acp/maka-acp-agent.js +8 -2
  3. package/dist/acp/prompt-content.js +225 -0
  4. package/dist/acp/session-event-mapper.js +103 -0
  5. package/dist/acp/session-registry.js +654 -17
  6. package/dist/acp/stdio-server.js +10 -1
  7. package/dist/cli-core.js +1 -1
  8. package/dist/pi-transcript-tools.js +3 -2
  9. package/dist/pi-transcript.js +15 -6
  10. package/dist/runtime-host-session-channel.js +63 -9
  11. package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
  12. package/node_modules/@maka/core/dist/agent-graph-schedule.js +15 -4
  13. package/node_modules/@maka/core/dist/artifacts.js +6 -0
  14. package/node_modules/@maka/core/dist/attachments.js +7 -2
  15. package/node_modules/@maka/core/dist/durable-tool-result-projection.js +3 -1
  16. package/node_modules/@maka/core/dist/events.js +21 -0
  17. package/node_modules/@maka/core/dist/executor-id.js +22 -0
  18. package/node_modules/@maka/core/dist/external-session.js +18 -0
  19. package/node_modules/@maka/core/dist/goal.js +44 -2
  20. package/node_modules/@maka/core/dist/model-call-usage-projection.js +0 -13
  21. package/node_modules/@maka/core/dist/permission.js +0 -1
  22. package/node_modules/@maka/core/dist/runtime-boundary.js +73 -29
  23. package/node_modules/@maka/core/dist/runtime-event.js +25 -6
  24. package/node_modules/@maka/core/dist/runtime-handoff.js +10 -2
  25. package/node_modules/@maka/core/dist/runtime-logical-execution.js +39 -14
  26. package/node_modules/@maka/core/dist/session-send-projection.js +6 -3
  27. package/node_modules/@maka/core/dist/session.js +8 -2
  28. package/node_modules/@maka/core/dist/shell-run-result.js +1 -0
  29. package/node_modules/@maka/core/dist/shell-run.js +4 -0
  30. package/node_modules/@maka/core/dist/tool-result-archive-evidence.js +3 -1
  31. package/node_modules/@maka/core/dist/tool-result-record-schema.js +2 -1
  32. package/node_modules/@maka/core/dist/unified-diff.js +33 -26
  33. package/node_modules/@maka/core/dist/work-board.js +94 -1
  34. package/node_modules/@maka/core/package.json +1 -0
  35. package/node_modules/@maka/eval/dist/fleet-simulation.js +270 -0
  36. package/node_modules/@maka/eval/dist/fleet-store.js +243 -0
  37. package/node_modules/@maka/eval/dist/fleet-worker.js +125 -0
  38. package/node_modules/@maka/eval/dist/fleet.js +329 -0
  39. package/node_modules/@maka/eval/dist/index.js +3 -0
  40. package/node_modules/@maka/runtime/dist/agent-run.js +2 -17
  41. package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +55 -180
  42. package/node_modules/@maka/runtime/dist/ai-sdk-message-projection.js +43 -26
  43. package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +271 -382
  44. package/node_modules/@maka/runtime/dist/background-task-health-tool.js +104 -0
  45. package/node_modules/@maka/runtime/dist/bash-model-output.js +7 -1
  46. package/node_modules/@maka/runtime/dist/bash-tail-buffer.js +13 -52
  47. package/node_modules/@maka/runtime/dist/builtin-tools.js +59 -111
  48. package/node_modules/@maka/runtime/dist/child-fd-input.js +3 -2
  49. package/node_modules/@maka/runtime/dist/context-budget-policy.js +1 -11
  50. package/node_modules/@maka/runtime/dist/context-budget.js +12 -1
  51. package/node_modules/@maka/runtime/dist/conversation-copy.js +104 -9
  52. package/node_modules/@maka/runtime/dist/filesystem-executor.js +10 -6
  53. package/node_modules/@maka/runtime/dist/filesystem-worker/client.js +77 -19
  54. package/node_modules/@maka/runtime/dist/filesystem-worker/launch-spec.js +66 -55
  55. package/node_modules/@maka/runtime/dist/filesystem-worker/operations.js +34 -97
  56. package/node_modules/@maka/runtime/dist/filesystem-worker/protocol.js +25 -10
  57. package/node_modules/@maka/runtime/dist/filesystem-worker/worker-entry.js +2 -0
  58. package/node_modules/@maka/runtime/dist/glob-search.js +74 -0
  59. package/node_modules/@maka/runtime/dist/goal-continuation.js +78 -8
  60. package/node_modules/@maka/runtime/dist/goal-state.js +7 -0
  61. package/node_modules/@maka/runtime/dist/grep-search.js +155 -0
  62. package/node_modules/@maka/runtime/dist/history-compaction.js +3 -1
  63. package/node_modules/@maka/runtime/dist/ledger-tool-result-archive-reader.js +84 -94
  64. package/node_modules/@maka/runtime/dist/local-web-fetch.js +1 -1
  65. package/node_modules/@maka/runtime/dist/model-adapter.js +62 -53
  66. package/node_modules/@maka/runtime/dist/model-history.js +26 -8
  67. package/node_modules/@maka/runtime/dist/pipe-tail-collector.js +6 -9
  68. package/node_modules/@maka/runtime/dist/plugin-executor-backend.js +311 -0
  69. package/node_modules/@maka/runtime/dist/plugin-executor-service.js +344 -0
  70. package/node_modules/@maka/runtime/dist/provider-error-classification.js +7 -1
  71. package/node_modules/@maka/runtime/dist/provider-request-telemetry.js +35 -8
  72. package/node_modules/@maka/runtime/dist/read-page.js +231 -0
  73. package/node_modules/@maka/runtime/dist/request-projection.js +2 -15
  74. package/node_modules/@maka/runtime/dist/ripgrep-executable.js +62 -0
  75. package/node_modules/@maka/runtime/dist/ripgrep-guidance.js +81 -0
  76. package/node_modules/@maka/runtime/dist/runtime-event-backfill.js +7 -1
  77. package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +188 -20
  78. package/node_modules/@maka/runtime/dist/runtime-invocation-route.js +49 -0
  79. package/node_modules/@maka/runtime/dist/runtime-kernel.js +72 -150
  80. package/node_modules/@maka/runtime/dist/runtime-read-model.js +2 -3
  81. package/node_modules/@maka/runtime/dist/sandbox/linux-profile-path.js +7 -1
  82. package/node_modules/@maka/runtime/dist/sandbox/linux-sandbox.js +20 -5
  83. package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +3 -0
  84. package/node_modules/@maka/runtime/dist/session-manager.js +106 -64
  85. package/node_modules/@maka/runtime/dist/session-recap.js +9 -5
  86. package/node_modules/@maka/runtime/dist/shell-exec.js +7 -25
  87. package/node_modules/@maka/runtime/dist/shell-run-manager.js +10 -4
  88. package/node_modules/@maka/runtime/dist/shell-run-tool-result.js +2 -1
  89. package/node_modules/@maka/runtime/dist/shell-tools.js +6 -12
  90. package/node_modules/@maka/runtime/dist/stream-graph-schedule-reconcile.js +1 -0
  91. package/node_modules/@maka/runtime/dist/stream-graph-supervisor-tools.js +26 -4
  92. package/node_modules/@maka/runtime/dist/subagent-tools.js +7 -0
  93. package/node_modules/@maka/runtime/dist/tool-availability.js +0 -1
  94. package/node_modules/@maka/runtime/dist/tool-output.js +1 -1
  95. package/node_modules/@maka/runtime/dist/tool-result-archive-capability.js +24 -36
  96. package/node_modules/@maka/runtime/dist/tool-result-archive-resource.js +32 -527
  97. package/node_modules/@maka/runtime/dist/tool-result-archive-transition.js +17 -119
  98. package/node_modules/@maka/runtime/dist/tool-result-archive.js +7 -25
  99. package/node_modules/@maka/runtime/dist/tool-runtime.js +52 -471
  100. package/node_modules/@maka/runtime/dist/workers/filesystem-worker.js +6933 -3681
  101. package/node_modules/@maka/runtime/dist/workspace-executor.js +20 -24
  102. package/node_modules/@maka/runtime/package.json +5 -0
  103. package/node_modules/@maka/runtime-host/dist/adapter/session-projector.js +7 -2
  104. package/node_modules/@maka/runtime-host/dist/client/host-handoff-copy.js +185 -191
  105. package/node_modules/@maka/runtime-host/dist/client/reconnecting-connection.js +3 -0
  106. package/node_modules/@maka/runtime-host/dist/client/session-catalog-summary.js +1 -0
  107. package/node_modules/@maka/runtime-host/dist/protocol/external-session.js +24 -3
  108. package/node_modules/@maka/runtime-host/dist/protocol/index.js +8 -1
  109. package/node_modules/@maka/runtime-host/dist/protocol/message.js +2 -2
  110. package/node_modules/@maka/runtime-host/dist/protocol/operations.js +1 -0
  111. package/node_modules/@maka/runtime-host/dist/protocol/plugin-platform.js +42 -5
  112. package/node_modules/@maka/runtime-host/dist/protocol/session-catalog.js +31 -3
  113. package/node_modules/@maka/runtime-host/dist/protocol/session-continuity.js +8 -2
  114. package/node_modules/@maka/runtime-host/dist/protocol/turn.js +10 -2
  115. package/node_modules/@maka/runtime-host/dist/protocol/workhub-coordination.js +38 -0
  116. package/node_modules/@maka/runtime-host/dist/server/child-agent-composition.js +1 -0
  117. package/node_modules/@maka/runtime-host/dist/server/execution-artifacts.js +3 -30
  118. package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +56 -8
  119. package/node_modules/@maka/runtime-host/dist/server/external-session-coordinator.js +14 -1
  120. package/node_modules/@maka/runtime-host/dist/server/goal-coordinator.js +81 -7
  121. package/node_modules/@maka/runtime-host/dist/server/host-session-availability.js +10 -2
  122. package/node_modules/@maka/runtime-host/dist/server/hosted-execution-tool-profile.js +13 -13
  123. package/node_modules/@maka/runtime-host/dist/server/interaction-coordinator.js +65 -0
  124. package/node_modules/@maka/runtime-host/dist/server/plugin-platform-coordinator.js +6 -0
  125. package/node_modules/@maka/runtime-host/dist/server/plugin-platform.js +6 -0
  126. package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +1 -0
  127. package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +56 -16
  128. package/node_modules/@maka/runtime-host/dist/server/session-continuity-coordinator.js +9 -5
  129. package/node_modules/@maka/runtime-host/dist/server/session-revision-coordinator.js +4 -0
  130. package/node_modules/@maka/runtime-host/dist/server/session-transcript-reader.js +88 -72
  131. package/node_modules/@maka/runtime-host/dist/server/web-fetch-tool.js +37 -1
  132. package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-action-gate.js +21 -4
  133. package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +145 -1
  134. package/node_modules/@maka/storage/dist/agent-run-store.js +5 -2
  135. package/node_modules/@maka/storage/dist/claude-code-session-adapter.js +450 -234
  136. package/node_modules/@maka/storage/dist/claude-code-transcript-lineage.js +106 -77
  137. package/node_modules/@maka/storage/dist/execution-stores.js +2 -1
  138. package/node_modules/@maka/storage/dist/legacy-run-header.js +2 -2
  139. package/node_modules/@maka/storage/dist/model-call-usage-sql.js +1 -1
  140. package/node_modules/@maka/storage/dist/runtime-transcript-query.js +27 -14
  141. package/node_modules/@maka/storage/dist/session-store.js +12 -2
  142. package/node_modules/@maka/storage/dist/sqlite-long-term-memory-store.js +86 -12
  143. package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +69 -3
  144. package/node_modules/@maka/storage/dist/work-board-store.js +40 -1
  145. package/node_modules/balanced-match/LICENSE.md +23 -0
  146. package/node_modules/balanced-match/README.md +57 -0
  147. package/node_modules/balanced-match/dist/commonjs/index.js +59 -0
  148. package/node_modules/balanced-match/dist/commonjs/package.json +3 -0
  149. package/node_modules/balanced-match/dist/esm/index.js +54 -0
  150. package/node_modules/balanced-match/dist/esm/package.json +3 -0
  151. package/node_modules/balanced-match/package.json +68 -0
  152. package/node_modules/brace-expansion/LICENSE +23 -0
  153. package/node_modules/brace-expansion/README.md +105 -0
  154. package/node_modules/brace-expansion/dist/commonjs/index.js +289 -0
  155. package/node_modules/brace-expansion/dist/commonjs/package.json +3 -0
  156. package/node_modules/brace-expansion/dist/esm/index.js +285 -0
  157. package/node_modules/brace-expansion/dist/esm/package.json +3 -0
  158. package/node_modules/brace-expansion/package.json +64 -0
  159. package/node_modules/glob/LICENSE.md +63 -0
  160. package/node_modules/glob/README.md +1203 -0
  161. package/node_modules/glob/dist/commonjs/glob.js +248 -0
  162. package/node_modules/glob/dist/commonjs/has-magic.js +27 -0
  163. package/node_modules/glob/dist/commonjs/ignore.js +119 -0
  164. package/node_modules/glob/dist/commonjs/index.js +68 -0
  165. package/node_modules/glob/dist/commonjs/index.min.js +4 -0
  166. package/node_modules/glob/dist/commonjs/package.json +3 -0
  167. package/node_modules/glob/dist/commonjs/pattern.js +223 -0
  168. package/node_modules/glob/dist/commonjs/processor.js +301 -0
  169. package/node_modules/glob/dist/commonjs/walker.js +387 -0
  170. package/node_modules/glob/dist/esm/glob.js +244 -0
  171. package/node_modules/glob/dist/esm/has-magic.js +23 -0
  172. package/node_modules/glob/dist/esm/ignore.js +115 -0
  173. package/node_modules/glob/dist/esm/index.js +55 -0
  174. package/node_modules/glob/dist/esm/index.min.js +4 -0
  175. package/node_modules/glob/dist/esm/package.json +3 -0
  176. package/node_modules/glob/dist/esm/pattern.js +219 -0
  177. package/node_modules/glob/dist/esm/processor.js +294 -0
  178. package/node_modules/glob/dist/esm/walker.js +381 -0
  179. package/node_modules/glob/package.json +98 -0
  180. package/node_modules/minimatch/LICENSE.md +55 -0
  181. package/node_modules/minimatch/README.md +528 -0
  182. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
  183. package/node_modules/minimatch/dist/commonjs/ast.js +845 -0
  184. package/node_modules/minimatch/dist/commonjs/brace-expressions.js +150 -0
  185. package/node_modules/minimatch/dist/commonjs/escape.js +30 -0
  186. package/node_modules/minimatch/dist/commonjs/index.js +1127 -0
  187. package/node_modules/minimatch/dist/commonjs/package.json +3 -0
  188. package/node_modules/minimatch/dist/commonjs/unescape.js +38 -0
  189. package/node_modules/minimatch/dist/esm/assert-valid-pattern.js +10 -0
  190. package/node_modules/minimatch/dist/esm/ast.js +841 -0
  191. package/node_modules/minimatch/dist/esm/brace-expressions.js +146 -0
  192. package/node_modules/minimatch/dist/esm/escape.js +26 -0
  193. package/node_modules/minimatch/dist/esm/index.js +1114 -0
  194. package/node_modules/minimatch/dist/esm/package.json +3 -0
  195. package/node_modules/minimatch/dist/esm/unescape.js +34 -0
  196. package/node_modules/minimatch/package.json +73 -0
  197. package/node_modules/minipass/LICENSE.md +55 -0
  198. package/node_modules/minipass/README.md +825 -0
  199. package/node_modules/minipass/dist/commonjs/index.js +1038 -0
  200. package/node_modules/minipass/dist/commonjs/package.json +3 -0
  201. package/node_modules/minipass/dist/esm/index.js +1020 -0
  202. package/node_modules/minipass/dist/esm/package.json +3 -0
  203. package/node_modules/minipass/package.json +77 -0
  204. package/node_modules/path-scurry/LICENSE.md +55 -0
  205. package/node_modules/path-scurry/README.md +636 -0
  206. package/node_modules/path-scurry/dist/commonjs/index.js +2018 -0
  207. package/node_modules/path-scurry/dist/commonjs/package.json +3 -0
  208. package/node_modules/path-scurry/dist/esm/index.js +1983 -0
  209. package/node_modules/path-scurry/dist/esm/package.json +3 -0
  210. package/node_modules/path-scurry/node_modules/lru-cache/LICENSE.md +55 -0
  211. package/node_modules/path-scurry/node_modules/lru-cache/README.md +469 -0
  212. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel.js +7 -0
  213. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/index.js +1726 -0
  214. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/index.min.js +2 -0
  215. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/perf.js +10 -0
  216. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/diagnostics-channel-cjs.d.cts.map +1 -0
  217. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/diagnostics-channel.js +7 -0
  218. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +1726 -0
  219. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.min.js +2 -0
  220. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel.js +9 -0
  221. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/index.js +1726 -0
  222. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/index.min.js +2 -0
  223. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/perf.js +10 -0
  224. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/package.json +3 -0
  225. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/perf.js +10 -0
  226. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.js +4 -0
  227. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/index.js +1722 -0
  228. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/index.min.js +2 -0
  229. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/perf.js +7 -0
  230. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/diagnostics-channel-esm.d.mts.map +1 -0
  231. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/diagnostics-channel.js +19 -0
  232. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.js +1722 -0
  233. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.min.js +2 -0
  234. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/diagnostics-channel.js +6 -0
  235. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/index.js +1722 -0
  236. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/index.min.js +2 -0
  237. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/perf.js +7 -0
  238. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/package.json +3 -0
  239. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/perf.js +7 -0
  240. package/node_modules/path-scurry/node_modules/lru-cache/package.json +154 -0
  241. package/node_modules/path-scurry/package.json +72 -0
  242. package/package.json +1 -1
  243. package/node_modules/@maka/runtime/dist/active-tool-result-prune.js +0 -248
  244. package/node_modules/@maka/runtime/dist/active-tool-result-working-set.js +0 -218
  245. package/node_modules/@maka/runtime/dist/archive-read-tool.js +0 -115
@@ -237,6 +237,15 @@ export class SessionManager {
237
237
  ...(header.projectId !== undefined ? { sourceProjectId: header.projectId } : {}),
238
238
  });
239
239
  }
240
+ async resolveChildToolNames(parentSessionId, parentHeader, definition) {
241
+ const availableChildTools = await this.childToolsForSession(parentSessionId);
242
+ assertAgentDefinitionRunnable({
243
+ definition,
244
+ tools: availableChildTools,
245
+ worktreeChildExecutorAvailable: await this.isWorktreeChildExecutorAvailable(parentHeader),
246
+ });
247
+ return buildToolsForAgentDefinition(availableChildTools, definition).map((tool) => tool.name);
248
+ }
240
249
  async finalizeAndListChildTurnArtifacts(sessionId, turnId, status) {
241
250
  const list = this.deps.listArtifactsForTurn;
242
251
  if (!list)
@@ -720,10 +729,10 @@ export class SessionManager {
720
729
  : header.permissionMode;
721
730
  const narrows = narrowsExecutionAuthority(current, permissionMode);
722
731
  if (narrows && this.runtimeKernel.hasActiveRuns(sessionId)) {
723
- throw new Error('当前任务正在运行,等结束后再切换沙箱边界。');
732
+ throw new SessionConfigurationTransitionError('session_busy', 'Execution boundary cannot change while a Turn is running');
724
733
  }
725
734
  if (header.status === 'waiting_for_user') {
726
- throw new Error('当前有沙箱边界请求正在等待确认,处理后再切换。');
735
+ throw new SessionConfigurationTransitionError('session_busy', 'Execution boundary cannot change while an Interaction is pending');
727
736
  }
728
737
  const boundary = await this.commitExecutionBoundaryTransition(sessionId, current, permissionMode, async () => () => this.deps.store.setExecutionBoundaryKind(sessionId, kind, { permissionMode }));
729
738
  return boundary;
@@ -904,18 +913,18 @@ export class SessionManager {
904
913
  throw new PlanConflictError('Linked child Sessions cannot enter Plan mode');
905
914
  }
906
915
  if (this.runtimeKernel.hasActiveRuns(sessionId)) {
907
- throw new Error('当前任务正在运行,等结束后再切换协作模式。');
916
+ throw new SessionConfigurationTransitionError('session_busy', 'Collaboration mode cannot change while a Turn is running');
908
917
  }
909
918
  if (previous.status === 'waiting_for_user') {
910
- throw new Error('当前有工具调用正在等待确认,处理后再切换协作模式。');
919
+ throw new SessionConfigurationTransitionError('session_busy', 'Collaboration mode cannot change while an Interaction is pending');
911
920
  }
912
921
  const planState = await this.requirePlanStore().readState(sessionId);
913
922
  if (mode === 'plan' && planState.activeExecutionId) {
914
- throw new Error('当前计划仍在执行,结束或中断后才能切换到 Plan Mode。');
923
+ throw new SessionConfigurationTransitionError('session_busy', 'An active Plan execution prevents entering Plan mode');
915
924
  }
916
925
  const latestProposal = planState.proposals.find((proposal) => proposal.proposalId === planState.latestProposalId);
917
926
  if (mode === 'agent' && latestProposal?.status === 'pending_approval') {
918
- throw new Error('当前方案正在等待审批,请明确放弃方案后再退出 Plan Mode。');
927
+ throw new SessionConfigurationTransitionError('operation_conflict', 'A pending Plan proposal must be resolved before leaving Plan mode');
919
928
  }
920
929
  const next = await this.deps.store.updateHeader(sessionId, {
921
930
  collaborationMode: mode,
@@ -1450,13 +1459,13 @@ export class SessionManager {
1450
1459
  const definition = resolvedPreset
1451
1460
  ? requireBuiltinAgentDefinitionByProfile(resolvedPreset.profile)
1452
1461
  : requireBuiltinAgentDefinition(input.agentId);
1453
- const availableChildTools = await this.childToolsForSession(input.source.sessionId);
1454
- assertAgentDefinitionRunnable({
1455
- definition,
1456
- tools: availableChildTools,
1457
- worktreeChildExecutorAvailable: await this.isWorktreeChildExecutorAvailable(parentHeader),
1458
- });
1459
- const resolvedToolNames = buildToolsForAgentDefinition(availableChildTools, definition).map((tool) => tool.name);
1462
+ const executorId = input.executorId ?? (resolvedPreset ? undefined : parentHeader.executorId);
1463
+ if (executorId) {
1464
+ this.deps.assertChildExecutorAvailable?.(input.source.sessionId, executorId);
1465
+ }
1466
+ const resolvedToolNames = executorId
1467
+ ? []
1468
+ : await this.resolveChildToolNames(input.source.sessionId, parentHeader, definition);
1460
1469
  const childPermissionMode = parentHeader.permissionMode === 'bypass' ? 'bypass' : definition.permissionMode;
1461
1470
  const initialTurnId = this.deps.newId();
1462
1471
  const initialRunId = this.deps.newId();
@@ -1482,6 +1491,7 @@ export class SessionManager {
1482
1491
  toolNames: resolvedToolNames,
1483
1492
  categoryPolicy: {},
1484
1493
  systemPrompt: definition.systemPrompt,
1494
+ executorId: executorId ?? null,
1485
1495
  ...(resolvedPreset
1486
1496
  ? {
1487
1497
  preset: {
@@ -1512,20 +1522,28 @@ export class SessionManager {
1512
1522
  cwd: workspace?.worktreePath ?? parentHeader.cwd,
1513
1523
  ...(parentHeader.projectId !== undefined ? { projectId: parentHeader.projectId } : {}),
1514
1524
  name: resolvedPreset?.name ?? definition.name,
1515
- ...(resolvedPreset
1516
- ? { llmConnectionId: resolvedPreset.connectionId }
1517
- : parentHeader.llmConnectionId === undefined
1518
- ? {}
1519
- : { llmConnectionId: parentHeader.llmConnectionId }),
1520
- llmConnectionSlug: resolvedPreset?.connectionSlug ?? parentHeader.llmConnectionSlug,
1521
- model: resolvedPreset?.model ?? parentHeader.model,
1522
- ...(resolvedPreset
1523
- ? resolvedPreset.thinkingLevel !== undefined
1524
- ? { thinkingLevel: resolvedPreset.thinkingLevel }
1525
- : {}
1526
- : parentHeader.thinkingLevel !== undefined
1527
- ? { thinkingLevel: parentHeader.thinkingLevel }
1528
- : {}),
1525
+ ...(executorId
1526
+ ? {
1527
+ executorId,
1528
+ llmConnectionSlug: `executor:${executorId}`,
1529
+ model: executorId,
1530
+ }
1531
+ : {
1532
+ ...(resolvedPreset
1533
+ ? { llmConnectionId: resolvedPreset.connectionId }
1534
+ : parentHeader.llmConnectionId === undefined
1535
+ ? {}
1536
+ : { llmConnectionId: parentHeader.llmConnectionId }),
1537
+ llmConnectionSlug: resolvedPreset?.connectionSlug ?? parentHeader.llmConnectionSlug,
1538
+ model: resolvedPreset?.model ?? parentHeader.model,
1539
+ ...(resolvedPreset
1540
+ ? resolvedPreset.thinkingLevel !== undefined
1541
+ ? { thinkingLevel: resolvedPreset.thinkingLevel }
1542
+ : {}
1543
+ : parentHeader.thinkingLevel !== undefined
1544
+ ? { thinkingLevel: parentHeader.thinkingLevel }
1545
+ : {}),
1546
+ }),
1529
1547
  permissionMode: childPermissionMode,
1530
1548
  collaborationMode: 'agent',
1531
1549
  orchestrationMode: 'default',
@@ -1924,13 +1942,12 @@ export class SessionManager {
1924
1942
  ]);
1925
1943
  this.assertActiveParentRun(parentSessionId, parentRun, input.spawnedBy.parentTurnId);
1926
1944
  const definition = requireBuiltinAgentDefinitionByProfile(input.agentProfile);
1927
- const availableChildTools = await this.childToolsForSession(parentSessionId);
1928
- assertAgentDefinitionRunnable({
1929
- definition,
1930
- tools: availableChildTools,
1931
- worktreeChildExecutorAvailable: await this.isWorktreeChildExecutorAvailable(parentHeader),
1932
- });
1933
- const resolvedToolNames = buildToolsForAgentDefinition(availableChildTools, definition).map((tool) => tool.name);
1945
+ const executorId = input.executorId ?? (input.resolvedPreset ? undefined : parentHeader.executorId);
1946
+ if (executorId)
1947
+ this.deps.assertChildExecutorAvailable?.(parentSessionId, executorId);
1948
+ const resolvedToolNames = executorId
1949
+ ? []
1950
+ : await this.resolveChildToolNames(parentSessionId, parentHeader, definition);
1934
1951
  const proposedTurnId = input.turnId ?? this.deps.newId();
1935
1952
  const proposedRunId = input.runId ?? this.deps.newId();
1936
1953
  const workspace = await this.provisionChildWorkspace(parentHeader, definition, requestFingerprint);
@@ -1938,20 +1955,28 @@ export class SessionManager {
1938
1955
  cwd: workspace?.worktreePath ?? parentHeader.cwd,
1939
1956
  ...(parentHeader.projectId !== undefined ? { projectId: parentHeader.projectId } : {}),
1940
1957
  name: input.name ?? input.resolvedPreset?.name ?? definition.name,
1941
- ...(input.resolvedPreset
1942
- ? { llmConnectionId: input.resolvedPreset.connectionId }
1943
- : parentHeader.llmConnectionId === undefined
1944
- ? {}
1945
- : { llmConnectionId: parentHeader.llmConnectionId }),
1946
- llmConnectionSlug: input.resolvedPreset?.connectionSlug ?? parentHeader.llmConnectionSlug,
1947
- model: input.resolvedPreset?.model ?? parentHeader.model,
1948
- ...(input.resolvedPreset
1949
- ? input.resolvedPreset.thinkingLevel !== undefined
1950
- ? { thinkingLevel: input.resolvedPreset.thinkingLevel }
1951
- : {}
1952
- : parentHeader.thinkingLevel !== undefined
1953
- ? { thinkingLevel: parentHeader.thinkingLevel }
1954
- : {}),
1958
+ ...(executorId
1959
+ ? {
1960
+ executorId,
1961
+ llmConnectionSlug: `executor:${executorId}`,
1962
+ model: executorId,
1963
+ }
1964
+ : {
1965
+ ...(input.resolvedPreset
1966
+ ? { llmConnectionId: input.resolvedPreset.connectionId }
1967
+ : parentHeader.llmConnectionId === undefined
1968
+ ? {}
1969
+ : { llmConnectionId: parentHeader.llmConnectionId }),
1970
+ llmConnectionSlug: input.resolvedPreset?.connectionSlug ?? parentHeader.llmConnectionSlug,
1971
+ model: input.resolvedPreset?.model ?? parentHeader.model,
1972
+ ...(input.resolvedPreset
1973
+ ? input.resolvedPreset.thinkingLevel !== undefined
1974
+ ? { thinkingLevel: input.resolvedPreset.thinkingLevel }
1975
+ : {}
1976
+ : parentHeader.thinkingLevel !== undefined
1977
+ ? { thinkingLevel: parentHeader.thinkingLevel }
1978
+ : {}),
1979
+ }),
1955
1980
  permissionMode: definition.permissionMode,
1956
1981
  collaborationMode: 'agent',
1957
1982
  orchestrationMode: 'default',
@@ -2545,7 +2570,7 @@ export class SessionManager {
2545
2570
  const opening = {
2546
2571
  kind: 'invocation_opened',
2547
2572
  protocol: 'invocation_opened_v1',
2548
- route: session.llmConnectionId === undefined
2573
+ route: session.llmConnectionId === undefined || session.backend === 'plugin-executor'
2549
2574
  ? {
2550
2575
  provenance: 'unknown',
2551
2576
  backendKind: session.backend,
@@ -3367,6 +3392,7 @@ export function headerToSummary(h) {
3367
3392
  ...(h.revisionIndex !== undefined ? { revisionIndex: h.revisionIndex } : {}),
3368
3393
  ...(h.revisionState ? { revisionState: h.revisionState } : {}),
3369
3394
  backend: h.backend,
3395
+ ...(h.executorId ? { executorId: h.executorId } : {}),
3370
3396
  ...(h.llmConnectionId === undefined ? {} : { llmConnectionId: h.llmConnectionId }),
3371
3397
  llmConnectionSlug: h.llmConnectionSlug,
3372
3398
  connectionLocked: h.connectionLocked,
@@ -3435,30 +3461,44 @@ function childSessionSpawnKey(parentSessionId, input) {
3435
3461
  ]);
3436
3462
  }
3437
3463
  function childSessionRequestFingerprint(parentSessionId, input) {
3438
- const payload = input.resolvedPreset
3464
+ const payload = input.executorId
3439
3465
  ? [
3440
- 2,
3466
+ 3,
3441
3467
  parentSessionId,
3442
3468
  input.spawnedBy.parentRunId,
3443
3469
  input.spawnedBy.parentTurnId,
3444
3470
  input.spawnedBy.toolCallId,
3445
3471
  input.agentProfile,
3446
- input.resolvedPreset,
3472
+ input.executorId,
3473
+ input.resolvedPreset ?? null,
3447
3474
  input.prompt,
3448
3475
  input.swarm?.swarmId ?? null,
3449
3476
  input.swarm?.itemId ?? null,
3450
3477
  ]
3451
- : [
3452
- 1,
3453
- parentSessionId,
3454
- input.spawnedBy.parentRunId,
3455
- input.spawnedBy.parentTurnId,
3456
- input.spawnedBy.toolCallId,
3457
- input.agentProfile,
3458
- input.prompt,
3459
- input.swarm?.swarmId ?? null,
3460
- input.swarm?.itemId ?? null,
3461
- ];
3478
+ : input.resolvedPreset
3479
+ ? [
3480
+ 2,
3481
+ parentSessionId,
3482
+ input.spawnedBy.parentRunId,
3483
+ input.spawnedBy.parentTurnId,
3484
+ input.spawnedBy.toolCallId,
3485
+ input.agentProfile,
3486
+ input.resolvedPreset,
3487
+ input.prompt,
3488
+ input.swarm?.swarmId ?? null,
3489
+ input.swarm?.itemId ?? null,
3490
+ ]
3491
+ : [
3492
+ 1,
3493
+ parentSessionId,
3494
+ input.spawnedBy.parentRunId,
3495
+ input.spawnedBy.parentTurnId,
3496
+ input.spawnedBy.toolCallId,
3497
+ input.agentProfile,
3498
+ input.prompt,
3499
+ input.swarm?.swarmId ?? null,
3500
+ input.swarm?.itemId ?? null,
3501
+ ];
3462
3502
  return createHash('sha256').update(JSON.stringify(payload)).digest('hex');
3463
3503
  }
3464
3504
  function claimedAgentGraphIntentRequestFingerprint(input) {
@@ -3491,7 +3531,8 @@ function claimedAgentGraphIntentResult(claim, result) {
3491
3531
  function sessionConfigurationWithPermissionMode(header, permissionMode) {
3492
3532
  return {
3493
3533
  backend: header.backend,
3494
- ...(header.llmConnectionId === undefined ? {} : { llmConnectionId: header.llmConnectionId }),
3534
+ executorId: header.executorId,
3535
+ llmConnectionId: header.llmConnectionId,
3495
3536
  llmConnectionSlug: header.llmConnectionSlug,
3496
3537
  connectionLocked: header.connectionLocked,
3497
3538
  model: header.model,
@@ -3503,6 +3544,7 @@ function sessionConfigurationWithPermissionMode(header, permissionMode) {
3503
3544
  }
3504
3545
  function sessionConfigurationMatchesExceptPermissionMode(header, configuration) {
3505
3546
  return (header.backend === configuration.backend &&
3547
+ header.executorId === configuration.executorId &&
3506
3548
  header.llmConnectionId === configuration.llmConnectionId &&
3507
3549
  header.llmConnectionSlug === configuration.llmConnectionSlug &&
3508
3550
  header.connectionLocked === configuration.connectionLocked &&
@@ -19,7 +19,7 @@
19
19
  import { runtimeEventHasModelVisibleContent } from '@maka/core/runtime-event';
20
20
  import { resolveSelectedModelContextWindow } from './context-budget-policy.js';
21
21
  import { stableJsonLength } from './context-budget-helpers.js';
22
- import { groupEventsByTurn } from './model-history.js';
22
+ import { groupEventsByTurn, formatTextWithInlineRefs } from './model-history.js';
23
23
  import { HistoryCompactSummarizerError } from './history-compact-error.js';
24
24
  import { fitHistoryCompactMessages } from './history-compact-input-fit.js';
25
25
  const SESSION_RECAP_TOOL_OUTCOME_MAX_CHARS = 600;
@@ -99,10 +99,14 @@ function projectSessionRecapMessages(events) {
99
99
  continue;
100
100
  const content = event.content;
101
101
  if (content?.kind === 'text' && (event.role === 'user' || event.role === 'model')) {
102
- const text = content.text.trim();
103
- if (text.length > 0) {
104
- messages.push({ role: event.role === 'user' ? 'user' : 'assistant', content: text });
105
- }
102
+ // The gate above already decided visibility through the shared
103
+ // predicate, which is satisfied by non-empty text or by the structured
104
+ // carriers — so every event reaching here projects, with its trimmed
105
+ // text and staged refs rendered by the shared inline-ref formatter.
106
+ messages.push({
107
+ role: event.role === 'user' ? 'user' : 'assistant',
108
+ content: formatTextWithInlineRefs({ ...content, text: content.text.trim() }),
109
+ });
106
110
  continue;
107
111
  }
108
112
  if (content?.kind !== 'function_response')
@@ -30,11 +30,11 @@ import { buildShellSpawnPlan, defaultShellPlan } from './shell-detect.js';
30
30
  import { BashTailBuffer } from './bash-tail-buffer.js';
31
31
  import { DEFAULT_PROCESS_TERMINATION_GRACE_MS } from './process-tree-terminator.js';
32
32
  import { DEFAULT_PROCESS_IO_DRAIN_TIMEOUT_MS, manageChildProcessLifecycle, } from './child-process-lifecycle.js';
33
- import { OUTPUT_RECOVERY_HINT } from './tool-output.js';
34
33
  import { buildSpawnStdio, closeChildFdSources, writeChildFdInputs, } from './child-fd-input.js';
35
34
  // Per-stream cap on the output RETAINED for the result (~1MB). This only bounds
36
- // what is kept to return. The tool layer (truncateToolOutput) trims this further
37
- // to the model's budget. Shared so both Bash paths retain identically.
35
+ // what is kept to return. The tool layer preserves this result for durable
36
+ // storage; unified result pruning bounds its model projection.
37
+ // Shared so both Bash paths retain identically.
38
38
  export const BASH_MAX_RETAINED_CHARS = 1024 * 1024;
39
39
  // Per-stream cap on output forwarded LIVE via emitOutput (~1MB). The command is
40
40
  // never killed for size and the full recoverable tail is still RETAINED (above),
@@ -47,20 +47,6 @@ export const BASH_MAX_LIVE_EMIT_CHARS = 1024 * 1024;
47
47
  // not lost — it still feeds the retained tail and the returned result.
48
48
  export const LIVE_OUTPUT_SUPPRESSED_MARKER = '[live output suppressed: too much output to stream live; the command keeps ' +
49
49
  'running and its result still contains the most recent output]';
50
- // Appended to a stream when BashTailBuffer dropped an oversized line that had no
51
- // newline to truncate at (dropped whole for redaction safety). Without it, a
52
- // command whose only output was one giant line would look like it produced
53
- // nothing. Carries no dropped content — just a recoverable notice.
54
- const UNSAFE_DROP_MARKER = '[a single line larger than the output limit was omitted for safety. ' +
55
- OUTPUT_RECOVERY_HINT +
56
- ']';
57
- export function shellTailValueWithUnsafeDropMarker(buf) {
58
- const text = buf.value(); // value() trims first, so the drop flag is current after it
59
- if (!buf.hasDroppedUnsafe())
60
- return text;
61
- // Append (not prepend) so a later tail-keeping truncateToolOutput retains it.
62
- return text ? `${text}\n${UNSAFE_DROP_MARKER}` : UNSAFE_DROP_MARKER;
63
- }
64
50
  /**
65
51
  * Run `command` in a shell, streaming output into a memory-bounded tail. Never
66
52
  * kills the command for producing too much output — it keeps only the last
@@ -213,8 +199,8 @@ function runSpawnedProcessWithBoundedTail(program, args, useShellOption, options
213
199
  return;
214
200
  settled = true;
215
201
  cleanup();
216
- const stdout = shellTailValueWithUnsafeDropMarker(stdoutBuf);
217
- const stderr = shellTailValueWithUnsafeDropMarker(stderrBuf);
202
+ const stdout = stdoutBuf.value();
203
+ const stderr = stderrBuf.value();
218
204
  resolvePromise({
219
205
  exitCode: termination
220
206
  ? termination.timedOut
@@ -223,12 +209,8 @@ function runSpawnedProcessWithBoundedTail(program, args, useShellOption, options
223
209
  : (outcome.exitCode ?? (outcome.signal ? 128 : 1)),
224
210
  stdout,
225
211
  stderr,
226
- stdoutTruncated: outcome.incompleteOutputs.has('stdout') ||
227
- stdoutChars > stdout.length ||
228
- stdoutBuf.hasDroppedUnsafe(),
229
- stderrTruncated: outcome.incompleteOutputs.has('stderr') ||
230
- stderrChars > stderr.length ||
231
- stderrBuf.hasDroppedUnsafe(),
212
+ stdoutTruncated: outcome.incompleteOutputs.has('stdout') || stdoutChars > stdout.length,
213
+ stderrTruncated: outcome.incompleteOutputs.has('stderr') || stderrChars > stderr.length,
232
214
  timedOut: !!termination?.timedOut,
233
215
  aborted: !!termination?.aborted,
234
216
  });
@@ -715,7 +715,7 @@ export class ShellRunProcessManager {
715
715
  sourceToolCallId: input.sourceToolCallId,
716
716
  ...(input.visibility === undefined ? {} : { visibility: input.visibility }),
717
717
  cwd: input.cwd,
718
- command: redactSecrets(input.command),
718
+ command: input.command,
719
719
  status: 'starting',
720
720
  startedAt,
721
721
  updatedAt: startedAt,
@@ -736,6 +736,7 @@ export class ShellRunProcessManager {
736
736
  async markRunning(live) {
737
737
  live.record = await this.input.store.updateShellRun(live.sessionId, live.shellRunId, {
738
738
  status: 'running',
739
+ ...this.processPidPatch(live),
739
740
  output: (await this.snapshotAtCut(live, false)).output,
740
741
  updatedAt: this.input.now(),
741
742
  });
@@ -746,6 +747,10 @@ export class ShellRunProcessManager {
746
747
  this.scheduleAutomaticFlush(live);
747
748
  }
748
749
  }
750
+ processPidPatch(live) {
751
+ const pid = live.driver.pid;
752
+ return pid !== undefined && Number.isSafeInteger(pid) && pid > 0 ? { pid } : {};
753
+ }
749
754
  onPipeData(live, stream, data) {
750
755
  if (live.driverExit || live.finalizeOnce)
751
756
  return;
@@ -894,12 +899,13 @@ export class ShellRunProcessManager {
894
899
  if (live.persistFailure && !options.bestEffort)
895
900
  throw live.persistFailure;
896
901
  const current = live.record;
897
- const candidate = { ...current, ...patch, output: snapshot.output };
902
+ // ConPTY can publish its PID after admission, even without new output.
903
+ const update = { ...patch, ...this.processPidPatch(live), output: snapshot.output };
904
+ const candidate = { ...current, ...update };
898
905
  let updated = current;
899
906
  if (!isDeepStrictEqual(candidate, current)) {
900
907
  updated = await this.input.store.updateShellRun(live.sessionId, live.shellRunId, {
901
- ...patch,
902
- output: snapshot.output,
908
+ ...update,
903
909
  updatedAt: this.input.now(),
904
910
  });
905
911
  live.record = updated;
@@ -43,7 +43,7 @@ export function terminalContent(record) {
43
43
  status: terminalResultStatus(record.status),
44
44
  ...(record.exitCode !== undefined ? { exitCode: record.exitCode } : {}),
45
45
  ...(record.failureMessage !== undefined ? { failureMessage: record.failureMessage } : {}),
46
- output: projectShellOutputForModel(record.output),
46
+ output: record.output,
47
47
  ...(sandboxDenialForRecord(record) ? { sandboxDenial: sandboxDenialForRecord(record) } : {}),
48
48
  };
49
49
  }
@@ -107,6 +107,7 @@ function shellRunStateContent(record) {
107
107
  cmd: record.command,
108
108
  startedAt: record.startedAt,
109
109
  updatedAt: record.updatedAt,
110
+ ...(record.pid !== undefined ? { pid: record.pid } : {}),
110
111
  ...(record.completedAt !== undefined ? { completedAt: record.completedAt } : {}),
111
112
  ...(record.timeoutMs !== undefined ? { timeoutMs: record.timeoutMs } : {}),
112
113
  ...(record.exitCode !== undefined ? { exitCode: record.exitCode } : {}),
@@ -20,11 +20,9 @@ import { z } from 'zod';
20
20
  import { jsonSchema, zodSchema } from 'ai';
21
21
  import { encodedTerminalInputActionsByteLength, normalizeTerminalInputActionDefaults, parseTerminalInputAction, TERMINAL_INPUT_MODIFIERS, TERMINAL_INPUT_NAMED_KEYS, TERMINAL_MOUSE_BUTTONS, TERMINAL_MOUSE_EVENTS, TERMINAL_MOUSE_SCROLL_DIRECTIONS, } from '@maka/core/terminal-input';
22
22
  import { isActiveShellRunStatus } from '@maka/core/shell-run';
23
- import { redactSecrets } from '@maka/core/redaction';
24
23
  import { isLikelySandboxDenial } from './sandbox/detect.js';
25
24
  import { runShellWithBoundedTail } from './shell-exec.js';
26
25
  import { bashToolShellGuidance, bashToolTurnShellGuidance, defaultShellPlan, throwIfShellSetupFailed, } from './shell-detect.js';
27
- import { truncateToolOutput } from './tool-output.js';
28
26
  import { DEFAULT_BASH_TIMEOUT_MS, MAX_PTY_COLS, MAX_PTY_ROWS, MAX_FOREGROUND_BASH_TIMEOUT_MS, MAX_SHELL_RUN_RESOURCE_REF_CHARS, MAX_SHELL_RUN_TIMEOUT_MS, MAX_WRITE_STDIN_ACTIONS, MAX_WRITE_STDIN_INPUT_BYTES, MIN_PTY_COLS, MIN_PTY_ROWS, isShellRunResourceRef, isWellFormedTerminalInput, } from './shell-run-contract.js';
29
27
  import { bashToolResultToModelOutput } from './bash-model-output.js';
30
28
  import { BASH_REQUIRED_BOUNDARY_DESCRIPTION, bashBoundaryIntentSchema, preflightDeclaredSandboxBoundary, preprocessBashBoundaryDeclaration, refineBashBoundaryDeclaration, sandboxBoundaryExpansionSchema, selectedBashBoundaryExpansion, } from './sandbox-boundary-declaration.js';
@@ -473,23 +471,19 @@ function isEmptyProviderSize(value) {
473
471
  entries.every(([, field]) => field === undefined || field === null || field === 0));
474
472
  }
475
473
  export function shapeTerminalResult(input) {
476
- const stdout = redactSecrets(input.result.stdout);
477
- const stderr = redactSecrets(input.result.stderr);
478
- const stdoutView = truncateToolOutput(stdout, { direction: 'tail' });
479
- const stderrView = truncateToolOutput(stderr, { direction: 'tail' });
480
474
  return {
481
475
  kind: 'terminal',
482
476
  cwd: input.cwd,
483
- cmd: redactSecrets(input.command),
477
+ cmd: input.command,
484
478
  status: terminalStatus(input.result),
485
479
  exitCode: input.result.exitCode,
486
480
  output: {
487
481
  mode: 'pipes',
488
- stdout: stdoutView.content,
489
- stderr: stderrView.content,
490
- stdoutTruncated: Boolean(input.result.stdoutTruncated) || stdoutView.truncated,
491
- stderrTruncated: Boolean(input.result.stderrTruncated) || stderrView.truncated,
492
- redacted: stdout !== input.result.stdout || stderr !== input.result.stderr,
482
+ stdout: input.result.stdout,
483
+ stderr: input.result.stderr,
484
+ stdoutTruncated: Boolean(input.result.stdoutTruncated),
485
+ stderrTruncated: Boolean(input.result.stderrTruncated),
486
+ redacted: false,
493
487
  },
494
488
  ...(isLikelySandboxDenial({
495
489
  stdout: input.result.stdout,
@@ -637,6 +637,7 @@ function buildOperatorProvisionInput(topology, observation, work, source, expect
637
637
  ...(work.target.kind === 'preset'
638
638
  ? { subagentId: work.target.presetId }
639
639
  : { agentId: work.target.agentId }),
640
+ ...(work.target.executorId ? { executorId: work.target.executorId } : {}),
640
641
  operatorId,
641
642
  source,
642
643
  edges,
@@ -17,6 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
  import { z } from 'zod';
20
+ import { isExecutorId } from '@maka/core/executor-id';
20
21
  import { AGENT_GRAPH_SCHEDULE_MAX_ADD_WORK, AGENT_GRAPH_SCHEDULE_MAX_INPUT_IDS, AGENT_GRAPH_SCHEDULE_MAX_INSTRUCTION_CHARS, AGENT_GRAPH_SCHEDULE_MAX_REASON_CHARS, AGENT_GRAPH_SCHEDULE_MAX_RESULT_IDS, AGENT_GRAPH_SCHEDULE_MAX_SELECTED_RESULT_INPUTS, AGENT_GRAPH_SCHEDULE_MAX_STOP, AGENT_GRAPH_SCHEDULE_UPDATE_SCHEMA_VERSION, decodeAgentGraphScheduleUpdate, } from '@maka/core/agent-graph-schedule';
21
22
  import { stableHash } from './request-shape.js';
22
23
  export const VIEW_AGENT_GRAPH_TOOL_NAME = 'view_agent_graph';
@@ -35,6 +36,7 @@ const identitySchema = z
35
36
  .min(1)
36
37
  .max(256)
37
38
  .refine((value) => !/[\u0000-\u001f\u007f]/.test(value), 'Identity contains control characters');
39
+ const executorIdSchema = z.string().refine(isExecutorId, 'Invalid plugin executor id');
38
40
  const cursorSchema = z
39
41
  .string()
40
42
  .trim()
@@ -56,6 +58,9 @@ const addWorkSchema = z.preprocess(cleanAddWorkInput, z
56
58
  operator_id: identitySchema
57
59
  .optional()
58
60
  .describe('Runtime id of an EXISTING graph operator returned by view_agent_graph. Use only for follow-up work; set operator_id OR agent_id, never both.'),
61
+ executor_id: executorIdSchema
62
+ .optional()
63
+ .describe('Plugin executor id for a newly created agent or preset target.'),
59
64
  instruction: z.string().trim().min(1).max(AGENT_GRAPH_SCHEDULE_MAX_INSTRUCTION_CHARS),
60
65
  input_ids: z
61
66
  .array(identitySchema)
@@ -245,6 +250,7 @@ function cleanAddWorkInput(input) {
245
250
  if (cleaned.target_kind === 'existing_operator') {
246
251
  delete cleaned.agent_id;
247
252
  delete cleaned.subagent_id;
253
+ delete cleaned.executor_id;
248
254
  }
249
255
  if (cleaned.replacement_mode === 'none')
250
256
  delete cleaned.replaces;
@@ -696,10 +702,18 @@ function assertGraphObservation(graphId, observation) {
696
702
  }
697
703
  function normalizeWorkTarget(input) {
698
704
  if (input.target_kind === 'new_agent') {
699
- return { kind: 'agent', agentId: requireIdentity(input.agent_id, 'agent id') };
705
+ return {
706
+ kind: 'agent',
707
+ agentId: requireIdentity(input.agent_id, 'agent id'),
708
+ ...(input.executor_id ? { executorId: input.executor_id } : {}),
709
+ };
700
710
  }
701
711
  if (input.target_kind === 'new_preset') {
702
- return { kind: 'preset', presetId: requireIdentity(input.subagent_id, 'subagent preset id') };
712
+ return {
713
+ kind: 'preset',
714
+ presetId: requireIdentity(input.subagent_id, 'subagent preset id'),
715
+ ...(input.executor_id ? { executorId: input.executor_id } : {}),
716
+ };
703
717
  }
704
718
  if (input.target_kind === 'existing_operator') {
705
719
  return {
@@ -712,10 +726,18 @@ function normalizeWorkTarget(input) {
712
726
  throw new Error('Exactly one of subagent_id, agent_id, or operator_id is required');
713
727
  }
714
728
  if (input.subagent_id) {
715
- return { kind: 'preset', presetId: requireIdentity(input.subagent_id, 'subagent preset id') };
729
+ return {
730
+ kind: 'preset',
731
+ presetId: requireIdentity(input.subagent_id, 'subagent preset id'),
732
+ ...(input.executor_id ? { executorId: input.executor_id } : {}),
733
+ };
716
734
  }
717
735
  return input.agent_id
718
- ? { kind: 'agent', agentId: requireIdentity(input.agent_id, 'agent id') }
736
+ ? {
737
+ kind: 'agent',
738
+ agentId: requireIdentity(input.agent_id, 'agent id'),
739
+ ...(input.executor_id ? { executorId: input.executor_id } : {}),
740
+ }
719
741
  : { kind: 'operator', operatorId: requireIdentity(input.operator_id, 'operator id') };
720
742
  }
721
743
  function normalizeUniqueIdentities(values, name) {
@@ -17,6 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
  import { z } from 'zod';
20
+ import { isExecutorId } from '@maka/core/executor-id';
20
21
  import { decodeCanonicalToolResultContent } from '@maka/core/tool-result-record-schema';
21
22
  import { isSafeSubagentPresetId } from '@maka/core/subagent-settings';
22
23
  import { AGENT_WORKSPACE_SAME_WORKSPACE, AGENT_WORKSPACE_WORKTREE, AGENT_WRITE_BACK_PATCH, AGENT_WRITE_BACK_SUMMARY, BUILTIN_AGENT_DEFINITIONS, agentProfilesForDefinitions, buildToolsForAgentDefinition, requireAgentDefinitionByProfile, } from './agent-catalog.js';
@@ -86,6 +87,11 @@ export function buildSubagentSpawnTool(deps = {}) {
86
87
  .refine(isSafeSubagentPresetId)
87
88
  .optional()
88
89
  .describe('User-approved subagent preset id from agent_list.'),
90
+ executor_id: z
91
+ .string()
92
+ .refine(isExecutorId)
93
+ .optional()
94
+ .describe('Plugin executor id for this child task.'),
89
95
  task: z
90
96
  .string()
91
97
  .min(1)
@@ -158,6 +164,7 @@ export function buildSubagentSpawnTool(deps = {}) {
158
164
  result = projectSubagentToolResult(await ctx.spawnChildSession({
159
165
  agentProfile: definition.profile,
160
166
  ...(input.subagent_id ? { subagentId: input.subagent_id } : {}),
167
+ ...(input.executor_id ? { executorId: input.executor_id } : {}),
161
168
  prompt: input.task,
162
169
  onEvent: (event) => progress.observe(event),
163
170
  }));
@@ -32,7 +32,6 @@ export const TOOL_SEARCH_MAX_SCHEMA_CHARS = 64 * 1024;
32
32
  const DIRECT_TOOL_NAMES = new Set([
33
33
  'Bash',
34
34
  'Read',
35
- 'ArchiveRead',
36
35
  'Write',
37
36
  'Edit',
38
37
  'Glob',
@@ -141,7 +141,7 @@ export function truncateToolOutput(text, options = {}) {
141
141
  return { content: text, truncated: false, removed: 0, unit: 'lines' };
142
142
  }
143
143
  const unit = hitBytes ? 'bytes' : 'lines';
144
- const marker = `...${removed} ${unit} truncated. ${OUTPUT_RECOVERY_HINT} ` +
144
+ const marker = `...${removed} ${unit} truncated. ${options.recoveryHint ?? OUTPUT_RECOVERY_HINT} ` +
145
145
  'Otherwise work from the kept output above.';
146
146
  const content = direction === 'head' ? `${preview}\n\n${marker}` : `${marker}\n\n${preview}`;
147
147
  return { content, truncated: true, removed, unit };