maka-agent 0.2.0-dev.31.20260913 → 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 (71) hide show
  1. package/dist/pi-transcript.js +3 -4
  2. package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
  3. package/node_modules/@maka/core/dist/agent-graph-schedule.js +15 -4
  4. package/node_modules/@maka/core/dist/executor-id.js +22 -0
  5. package/node_modules/@maka/core/dist/external-session.js +18 -0
  6. package/node_modules/@maka/core/dist/model-call-usage-projection.js +0 -13
  7. package/node_modules/@maka/core/dist/runtime-event.js +19 -3
  8. package/node_modules/@maka/core/dist/session-send-projection.js +6 -3
  9. package/node_modules/@maka/core/dist/session.js +8 -2
  10. package/node_modules/@maka/core/dist/shell-run-result.js +1 -0
  11. package/node_modules/@maka/core/dist/shell-run.js +4 -0
  12. package/node_modules/@maka/core/dist/work-board.js +94 -1
  13. package/node_modules/@maka/core/package.json +1 -0
  14. package/node_modules/@maka/eval/dist/fleet-simulation.js +270 -0
  15. package/node_modules/@maka/eval/dist/fleet-store.js +243 -0
  16. package/node_modules/@maka/eval/dist/fleet-worker.js +125 -0
  17. package/node_modules/@maka/eval/dist/fleet.js +329 -0
  18. package/node_modules/@maka/eval/dist/index.js +3 -0
  19. package/node_modules/@maka/runtime/dist/agent-run.js +2 -17
  20. package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +6 -2
  21. package/node_modules/@maka/runtime/dist/ai-sdk-message-projection.js +36 -24
  22. package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +257 -330
  23. package/node_modules/@maka/runtime/dist/background-task-health-tool.js +104 -0
  24. package/node_modules/@maka/runtime/dist/history-compaction.js +3 -1
  25. package/node_modules/@maka/runtime/dist/local-web-fetch.js +1 -1
  26. package/node_modules/@maka/runtime/dist/model-adapter.js +62 -53
  27. package/node_modules/@maka/runtime/dist/model-history.js +1 -5
  28. package/node_modules/@maka/runtime/dist/plugin-executor-backend.js +311 -0
  29. package/node_modules/@maka/runtime/dist/plugin-executor-service.js +344 -0
  30. package/node_modules/@maka/runtime/dist/provider-error-classification.js +7 -1
  31. package/node_modules/@maka/runtime/dist/provider-request-telemetry.js +35 -8
  32. package/node_modules/@maka/runtime/dist/runtime-event-backfill.js +7 -1
  33. package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +1 -0
  34. package/node_modules/@maka/runtime/dist/runtime-invocation-route.js +49 -0
  35. package/node_modules/@maka/runtime/dist/runtime-kernel.js +72 -150
  36. package/node_modules/@maka/runtime/dist/runtime-read-model.js +0 -2
  37. package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +3 -0
  38. package/node_modules/@maka/runtime/dist/session-manager.js +100 -58
  39. package/node_modules/@maka/runtime/dist/shell-run-manager.js +9 -3
  40. package/node_modules/@maka/runtime/dist/shell-run-tool-result.js +1 -0
  41. package/node_modules/@maka/runtime/dist/stream-graph-schedule-reconcile.js +1 -0
  42. package/node_modules/@maka/runtime/dist/stream-graph-supervisor-tools.js +26 -4
  43. package/node_modules/@maka/runtime/dist/subagent-tools.js +7 -0
  44. package/node_modules/@maka/runtime/dist/tool-runtime.js +45 -466
  45. package/node_modules/@maka/runtime/package.json +3 -0
  46. package/node_modules/@maka/runtime-host/dist/adapter/session-projector.js +7 -2
  47. package/node_modules/@maka/runtime-host/dist/client/session-catalog-summary.js +1 -0
  48. package/node_modules/@maka/runtime-host/dist/protocol/external-session.js +24 -3
  49. package/node_modules/@maka/runtime-host/dist/protocol/index.js +4 -1
  50. package/node_modules/@maka/runtime-host/dist/protocol/plugin-platform.js +42 -5
  51. package/node_modules/@maka/runtime-host/dist/protocol/session-catalog.js +31 -3
  52. package/node_modules/@maka/runtime-host/dist/protocol/session-continuity.js +6 -0
  53. package/node_modules/@maka/runtime-host/dist/server/child-agent-composition.js +1 -0
  54. package/node_modules/@maka/runtime-host/dist/server/execution-artifacts.js +1 -22
  55. package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +54 -8
  56. package/node_modules/@maka/runtime-host/dist/server/external-session-coordinator.js +14 -1
  57. package/node_modules/@maka/runtime-host/dist/server/host-session-availability.js +10 -2
  58. package/node_modules/@maka/runtime-host/dist/server/plugin-platform-coordinator.js +6 -0
  59. package/node_modules/@maka/runtime-host/dist/server/plugin-platform.js +6 -0
  60. package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +56 -16
  61. package/node_modules/@maka/runtime-host/dist/server/session-continuity-coordinator.js +4 -3
  62. package/node_modules/@maka/runtime-host/dist/server/session-revision-coordinator.js +4 -0
  63. package/node_modules/@maka/runtime-host/dist/server/web-fetch-tool.js +37 -1
  64. package/node_modules/@maka/storage/dist/claude-code-session-adapter.js +450 -234
  65. package/node_modules/@maka/storage/dist/claude-code-transcript-lineage.js +106 -77
  66. package/node_modules/@maka/storage/dist/legacy-run-header.js +2 -2
  67. package/node_modules/@maka/storage/dist/model-call-usage-sql.js +1 -1
  68. package/node_modules/@maka/storage/dist/session-store.js +12 -2
  69. package/node_modules/@maka/storage/dist/sqlite-long-term-memory-store.js +86 -12
  70. package/node_modules/@maka/storage/dist/work-board-store.js +40 -1
  71. package/package.json +1 -1
@@ -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)
@@ -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 &&
@@ -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;
@@ -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 } : {}),
@@ -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
  }));