@sema-agent/core 1.348.0 → 1.350.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/subagent.d.ts.map +1 -1
- package/dist/agents/subagent.js +63 -25
- package/dist/agents/subagent.js.map +1 -1
- package/dist/core/runner/prepare-task.d.ts.map +1 -1
- package/dist/core/runner/prepare-task.js +20 -0
- package/dist/core/runner/prepare-task.js.map +1 -1
- package/dist/core/types.d.ts +6 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/engine/loop/agent-loop.js +1 -1
- package/dist/engine/loop/agent-loop.js.map +1 -1
- package/dist/engine/loop/types.d.ts +1 -0
- package/dist/engine/loop/types.d.ts.map +1 -1
- package/dist/orchestration/run-workflow-tool.d.ts.map +1 -1
- package/dist/orchestration/run-workflow-tool.js +3 -0
- package/dist/orchestration/run-workflow-tool.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subagent.d.ts","sourceRoot":"","sources":["../../src/agents/subagent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAa7F,OAAO,EAAU,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAKnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAoB5E,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAiB5E,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,SAAS,GACvC,YAAY,CAAC,wB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AC;IAO7C,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,uBAAuB,EAAE,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;IAE9F,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,MAAM,CAAC,EAAE,OAAO,mBAAmB,EAAE,WAAW,CAAC;IAGjD,aAAa,CAAC,EAAE,oBAAoB,CAAC;CACtC;AAkBD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,mBAAmB,EAAE,WAAW,GAAG,SAAS,EAAE,KAAK,EAAE,OAAO,mBAAmB,EAAE,WAAW,GAAG,IAAI,CAOnJ;AAcD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,sBAAsB;;;;aAsUjE;AAGD,eAAO,MAAM,0BAA0B,oBAAoB,CAAC;AAK5D,MAAM,WAAW,0BAA0B;IAEzC,MAAM,EAAE,MAAM,CAAC;IAEf,QAAQ,EAAE,OAAO,0BAA0B,EAAE,YAAY,CAAC;IAE1D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAaD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,0BAA0B;;;aAoEzE"}
|
package/dist/agents/subagent.js
CHANGED
|
@@ -869,10 +869,11 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
|
|
|
869
869
|
const wantsBackground = opts.background !== undefined && a.run_in_background !== false;
|
|
870
870
|
const prompt = String(a.prompt ?? "").trim();
|
|
871
871
|
if (!prompt) {
|
|
872
|
-
return { content: "Sub-agent not started: 'prompt' was empty.", details: { error: "empty prompt" } };
|
|
872
|
+
return { isError: true, content: "Sub-agent not started: 'prompt' was empty.", details: { error: "empty prompt" } };
|
|
873
873
|
}
|
|
874
874
|
if (a.subagent_type !== undefined && typeof a.subagent_type !== "string") {
|
|
875
875
|
return {
|
|
876
|
+
isError: true,
|
|
876
877
|
content: `Sub-agent not started: subagent_type must be a string. Available subagent_type values: ${acceptedSubagentTypes().join(", ")}.`,
|
|
877
878
|
details: { error: "unknown subagent_type" },
|
|
878
879
|
};
|
|
@@ -881,46 +882,52 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
|
|
|
881
882
|
const wantsFork = forkOffered && rawType === FORK_SUBAGENT_TYPE;
|
|
882
883
|
const omitted = rawType === "";
|
|
883
884
|
const def = hasAgents && !wantsFork && !omitted ? agentMap.get(rawType) : undefined;
|
|
885
|
+
const spawnAgentType = wantsFork ? FORK_SUBAGENT_TYPE : omitted ? GENERAL_PURPOSE_SUBAGENT_TYPE : rawType;
|
|
884
886
|
if (!def && !wantsFork && !omitted) {
|
|
885
887
|
return {
|
|
888
|
+
isError: true,
|
|
886
889
|
content: `Sub-agent not started: unknown subagent_type "${rawType}". Available subagent_type values: ${acceptedSubagentTypes().join(", ")}.`,
|
|
887
890
|
details: { error: "unknown subagent_type" },
|
|
888
891
|
};
|
|
889
892
|
}
|
|
890
893
|
if (a.name !== undefined && typeof a.name !== "string") {
|
|
891
|
-
return { content: "Sub-agent not started: name must be a string.", details: { error: "name.invalid" } };
|
|
894
|
+
return { isError: true, content: "Sub-agent not started: name must be a string.", details: { error: "name.invalid" } };
|
|
892
895
|
}
|
|
893
896
|
const agentName = a.name;
|
|
894
897
|
if (agentName !== undefined) {
|
|
895
898
|
if (!/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/.test(agentName)) {
|
|
896
899
|
return {
|
|
900
|
+
isError: true,
|
|
897
901
|
content: "Sub-agent not started: name must start with a letter or digit and contain only letters, digits, underscores, or hyphens (max 64 chars).",
|
|
898
902
|
details: { error: "name.invalid" },
|
|
899
903
|
};
|
|
900
904
|
}
|
|
901
905
|
if (agentName.toLowerCase() === "main") {
|
|
902
906
|
return {
|
|
907
|
+
isError: true,
|
|
903
908
|
content: 'Sub-agent not started: "main" is reserved — SendMessage routes it to the main conversation.',
|
|
904
909
|
details: { error: "name.reserved" },
|
|
905
910
|
};
|
|
906
911
|
}
|
|
907
912
|
if (ctx.spawnedAgentName !== undefined) {
|
|
908
913
|
return {
|
|
914
|
+
isError: true,
|
|
909
915
|
content: "Sub-agent not started: teammates cannot spawn other teammates — the team roster is flat. To spawn a subagent instead, omit the `name` parameter.",
|
|
910
916
|
details: { error: "name.nested_teammate" },
|
|
911
917
|
};
|
|
912
918
|
}
|
|
913
919
|
}
|
|
914
920
|
if (a.cwd !== undefined && typeof a.cwd !== "string") {
|
|
915
|
-
return { content: "Sub-agent not started: cwd must be an absolute path string.", details: { error: "cwd.relative" } };
|
|
921
|
+
return { isError: true, content: "Sub-agent not started: cwd must be an absolute path string.", details: { error: "cwd.relative" } };
|
|
916
922
|
}
|
|
917
923
|
const childCwd = a.cwd;
|
|
918
924
|
if (childCwd !== undefined) {
|
|
919
925
|
if (!isAbsolute(childCwd)) {
|
|
920
|
-
return { content: "Sub-agent not started: cwd must be an absolute path.", details: { error: "cwd.relative" } };
|
|
926
|
+
return { isError: true, content: "Sub-agent not started: cwd must be an absolute path.", details: { error: "cwd.relative" } };
|
|
921
927
|
}
|
|
922
928
|
if ((a.isolation ?? def?.isolation) === "worktree") {
|
|
923
929
|
return {
|
|
930
|
+
isError: true,
|
|
924
931
|
content: 'Sub-agent not started: cwd and isolation "worktree" are mutually exclusive — the worktree defines its own working directory.',
|
|
925
932
|
details: { error: "cwd.isolation_conflict" },
|
|
926
933
|
};
|
|
@@ -932,15 +939,17 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
|
|
|
932
939
|
? "this task (enableFork: false)"
|
|
933
940
|
: `this principal (runtimeCaps.allowFork: false)`;
|
|
934
941
|
return {
|
|
942
|
+
isError: true,
|
|
935
943
|
content: `Sub-agent not started: subagent_type "${FORK_SUBAGENT_TYPE}" is disabled for ${who}. Delegate without subagent_type instead.`,
|
|
936
944
|
details: { error: "fork.disabled" },
|
|
937
945
|
};
|
|
938
946
|
}
|
|
939
947
|
if (ctx.insideFork === true) {
|
|
940
|
-
return { content: `Sub-agent not started: subagent_type "${FORK_SUBAGENT_TYPE}" is not available inside a forked agent.`, details: { error: "fork.nested" } };
|
|
948
|
+
return { isError: true, content: `Sub-agent not started: subagent_type "${FORK_SUBAGENT_TYPE}" is not available inside a forked agent.`, details: { error: "fork.nested" } };
|
|
941
949
|
}
|
|
942
|
-
if (ctx.sessionId === undefined || !hasSessionFork(opts.runner.sessions)) {
|
|
950
|
+
if (ctx.sessionId === undefined || (ctx.hostSessionFork === undefined && !hasSessionFork(opts.runner.sessions))) {
|
|
943
951
|
return {
|
|
952
|
+
isError: true,
|
|
944
953
|
content: `Sub-agent not started: subagent_type "${FORK_SUBAGENT_TYPE}" is unavailable here (this run has no fork-capable durable session). Delegate without subagent_type instead.`,
|
|
945
954
|
details: { error: "fork.unavailable" },
|
|
946
955
|
};
|
|
@@ -971,6 +980,7 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
|
|
|
971
980
|
const iso = ctx.worktreeIsolation;
|
|
972
981
|
if (!iso) {
|
|
973
982
|
return {
|
|
983
|
+
isError: true,
|
|
974
984
|
content: `Sub-agent not started: isolation "worktree" is unavailable on this run (no worktree capability — read-only run or no execution environment). Retry without the isolation parameter.`,
|
|
975
985
|
details: { error: "isolation.unavailable" },
|
|
976
986
|
};
|
|
@@ -980,6 +990,7 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
|
|
|
980
990
|
}
|
|
981
991
|
catch (e) {
|
|
982
992
|
return {
|
|
993
|
+
isError: true,
|
|
983
994
|
content: `Sub-agent not started: worktree isolation failed — ${e instanceof Error ? e.message : String(e)}. Retry without the isolation parameter, or fix the repository state.`,
|
|
984
995
|
details: { error: "isolation.failed" },
|
|
985
996
|
};
|
|
@@ -1028,8 +1039,6 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
|
|
|
1028
1039
|
toolCallId: ctx.toolCallId,
|
|
1029
1040
|
...(ctx.taskId !== undefined ? { parentTaskId: ctx.taskId } : {}),
|
|
1030
1041
|
...(ctx.sessionId !== undefined ? { parentSessionId: ctx.sessionId } : {}),
|
|
1031
|
-
...(ctx.sessionId !== undefined ? { parentSessionId: ctx.sessionId } : {}),
|
|
1032
|
-
...(ctx.sessionId !== undefined ? { parentSessionId: ctx.sessionId } : {}),
|
|
1033
1042
|
...(ctx.principal !== undefined ? { principal: ctx.principal } : {}),
|
|
1034
1043
|
...(def !== undefined ? { agentType: def.name } : wantsFork ? { agentType: FORK_SUBAGENT_TYPE } : {}),
|
|
1035
1044
|
depth,
|
|
@@ -1044,6 +1053,7 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
|
|
|
1044
1053
|
if (ctx.signal?.aborted) {
|
|
1045
1054
|
const wt = await finishWorktree();
|
|
1046
1055
|
return {
|
|
1056
|
+
isError: true,
|
|
1047
1057
|
content: `Sub-agent not started: the parent task was aborted while extraTools was being evaluated.${wt ? `\n${wt}` : ""}`,
|
|
1048
1058
|
details: { error: "aborted" },
|
|
1049
1059
|
};
|
|
@@ -1423,16 +1433,24 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
|
|
|
1423
1433
|
};
|
|
1424
1434
|
if (wantsFork) {
|
|
1425
1435
|
let forkedId;
|
|
1436
|
+
let releaseForked;
|
|
1426
1437
|
try {
|
|
1427
|
-
|
|
1438
|
+
if (ctx.hostSessionFork) {
|
|
1439
|
+
const forkHandle = await ctx.hostSessionFork();
|
|
1440
|
+
forkedId = forkHandle?.sessionId ?? null;
|
|
1441
|
+
releaseForked = forkHandle?.release;
|
|
1442
|
+
}
|
|
1443
|
+
else {
|
|
1444
|
+
forkedId = (await opts.runner.sessions.fork?.(ctx.sessionId, ctx.principal ?? null)) ?? null;
|
|
1445
|
+
}
|
|
1428
1446
|
}
|
|
1429
1447
|
catch (e) {
|
|
1430
1448
|
const wt = await finishWorktree();
|
|
1431
|
-
return { content: `Sub-agent not started: session fork failed (${e instanceof Error ? e.message : String(e)}).${wt ? `\n${wt}` : ""}`, details: { error: "fork failed" } };
|
|
1449
|
+
return { isError: true, content: `Sub-agent not started: session fork failed (${e instanceof Error ? e.message : String(e)}).${wt ? `\n${wt}` : ""}`, details: { error: "fork failed" } };
|
|
1432
1450
|
}
|
|
1433
1451
|
if (!forkedId) {
|
|
1434
1452
|
const wt = await finishWorktree();
|
|
1435
|
-
return { content: `Sub-agent not started: source session not found or fork unavailable.${wt ? `\n${wt}` : ""}`, details: { error: "source not found" } };
|
|
1453
|
+
return { isError: true, content: `Sub-agent not started: source session not found or fork unavailable.${wt ? `\n${wt}` : ""}`, details: { error: "source not found", ...(ctx.sessionId !== undefined ? { sourceSessionId: ctx.sessionId } : {}) } };
|
|
1436
1454
|
}
|
|
1437
1455
|
const forkInternals = { ...childInternals, insideFork: true };
|
|
1438
1456
|
stepRecorder.lockTo(forkedId);
|
|
@@ -1469,12 +1487,12 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
|
|
|
1469
1487
|
catch (e) {
|
|
1470
1488
|
dropHostAbortListener();
|
|
1471
1489
|
try {
|
|
1472
|
-
await opts.runner.sessions.release?.(forkedId);
|
|
1490
|
+
await (releaseForked ? releaseForked() : opts.runner.sessions.release?.(forkedId));
|
|
1473
1491
|
}
|
|
1474
1492
|
catch {
|
|
1475
1493
|
}
|
|
1476
1494
|
const wt = await finishWorktree();
|
|
1477
|
-
return { content: `Sub-agent not started in background: ${e instanceof Error ? e.message : String(e)}${wt ? `\n${wt}` : ""}`, details: { error: "register_failed" } };
|
|
1495
|
+
return { isError: true, content: `Sub-agent not started in background: ${e instanceof Error ? e.message : String(e)}${wt ? `\n${wt}` : ""}`, details: { error: "register_failed" } };
|
|
1478
1496
|
}
|
|
1479
1497
|
if (agentName !== undefined) {
|
|
1480
1498
|
recordRosterSpawn(ctx.roster, { name: agentName, agentId: taskId, sessionId: forkedId, toolUseId: ctx.toolCallId, ...(bgOwner !== undefined ? { owner: bgOwner } : {}), ...(bgScope !== undefined ? { scope: bgScope } : {}), ...(sessionScopedBg ? { sessionScoped: true } : {}), createdAt: Date.now() });
|
|
@@ -1494,12 +1512,13 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
|
|
|
1494
1512
|
...(bgOwner !== undefined ? { owner: bgOwner } : {}),
|
|
1495
1513
|
...(bgScope !== undefined ? { scope: bgScope } : {}),
|
|
1496
1514
|
description: shortDesc,
|
|
1515
|
+
agentType: spawnAgentType,
|
|
1516
|
+
...(agentName !== undefined ? { name: agentName } : {}),
|
|
1497
1517
|
sessionId: forkedId,
|
|
1498
|
-
...(ctx.taskId !== undefined ? { parentTaskId: ctx.taskId } : {}),
|
|
1499
|
-
...(ctx.sessionId !== undefined ? { parentSessionId: ctx.sessionId } : {}),
|
|
1518
|
+
...(ctx.taskId !== undefined && ctx.taskId !== ctx.sessionId ? { parentTaskId: ctx.taskId } : {}),
|
|
1500
1519
|
...(ctx.sessionId !== undefined ? { parentSessionId: ctx.sessionId } : {}),
|
|
1501
1520
|
});
|
|
1502
|
-
const bgForkSpec = { ...buildChildSpec(abort.signal), sessionId: forkedId, objective: forkObjective };
|
|
1521
|
+
const bgForkSpec = { ...buildChildSpec(abort.signal), sessionId: forkedId, requireExistingSession: true, objective: forkObjective };
|
|
1503
1522
|
if (sessionScopedBg && bgForkSpec.limits?.timeoutSec === undefined) {
|
|
1504
1523
|
bgForkSpec.limits = { ...(bgForkSpec.limits ?? {}), timeoutSec: SESSION_BG_DEFAULT_TIMEOUT_SEC };
|
|
1505
1524
|
}
|
|
@@ -1524,6 +1543,7 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
|
|
|
1524
1543
|
sessionScoped: sessionScopedBg === true,
|
|
1525
1544
|
progressTaskId: e.taskId,
|
|
1526
1545
|
...(e.parentTaskId !== undefined ? { progressParentTaskId: e.parentTaskId } : {}),
|
|
1546
|
+
agentType: spawnAgentType,
|
|
1527
1547
|
...(e.name !== undefined ? { name: e.name } : {}),
|
|
1528
1548
|
...(currentAction !== undefined ? { currentAction } : {}),
|
|
1529
1549
|
usage: e.usage,
|
|
@@ -1557,15 +1577,23 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
|
|
|
1557
1577
|
...(!okBg ? { error: reapedBg ? BG_AGENT_REAP_STOP_ERROR : child.errorMessage ?? String(child.status) } : {}),
|
|
1558
1578
|
}) ?? (abort.signal.aborted ? "killed" : okBg ? "completed" : "failed");
|
|
1559
1579
|
const stoppedByBg = settledBg === "killed" ? bg.registry.getStopAttribution(taskId) ?? "system" : undefined;
|
|
1580
|
+
const stillbornFork = child.errorCode === "resume.session_not_found";
|
|
1581
|
+
if (stillbornFork) {
|
|
1582
|
+
try {
|
|
1583
|
+
await (releaseForked ? releaseForked() : opts.runner.sessions.release?.(forkedId));
|
|
1584
|
+
}
|
|
1585
|
+
catch {
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1560
1588
|
const residualFork = residualFields();
|
|
1561
|
-
const resumableFork = settledBg !== "killed";
|
|
1589
|
+
const resumableFork = settledBg !== "killed" && !stillbornFork;
|
|
1562
1590
|
const forkTranscriptId = child.sessionId ?? forkedId;
|
|
1563
1591
|
sinkEmit({
|
|
1564
1592
|
kind: "terminal",
|
|
1565
1593
|
taskId,
|
|
1566
1594
|
sessionScoped: sessionScopedBg === true,
|
|
1567
1595
|
sessionId: forkTranscriptId,
|
|
1568
|
-
transcriptId: forkTranscriptId,
|
|
1596
|
+
...(stillbornFork ? {} : { transcriptId: forkTranscriptId }),
|
|
1569
1597
|
status: settledBg,
|
|
1570
1598
|
...(stoppedByBg !== undefined ? { stoppedBy: stoppedByBg } : {}),
|
|
1571
1599
|
summary: `${shortDesc} — ${settledBg === "killed" ? "stopped" : child.status}`,
|
|
@@ -1617,6 +1645,7 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
|
|
|
1617
1645
|
task_type: "background_agent",
|
|
1618
1646
|
toolUseId: ctx.toolCallId,
|
|
1619
1647
|
status: settledBg,
|
|
1648
|
+
sessionId: forkedId,
|
|
1620
1649
|
...(stoppedByBg !== undefined ? { stoppedBy: stoppedByBg } : {}),
|
|
1621
1650
|
summary: summaryBg,
|
|
1622
1651
|
}, { priority: "later" });
|
|
@@ -1652,16 +1681,23 @@ task_id: ${taskId}
|
|
|
1652
1681
|
: undefined;
|
|
1653
1682
|
let forkChild;
|
|
1654
1683
|
try {
|
|
1655
|
-
forkChild = await opts.runner.runTask({ ...buildChildSpec(ctx.signal), sessionId: forkedId, objective: forkObjective }, forkInternals);
|
|
1684
|
+
forkChild = await opts.runner.runTask({ ...buildChildSpec(ctx.signal), sessionId: forkedId, requireExistingSession: true, objective: forkObjective }, forkInternals);
|
|
1685
|
+
if (forkChild.errorCode === "resume.session_not_found") {
|
|
1686
|
+
try {
|
|
1687
|
+
await (releaseForked ? releaseForked() : opts.runner.sessions.release?.(forkedId));
|
|
1688
|
+
}
|
|
1689
|
+
catch {
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1656
1692
|
}
|
|
1657
1693
|
catch (e) {
|
|
1658
1694
|
try {
|
|
1659
|
-
await opts.runner.sessions.release?.(forkedId);
|
|
1695
|
+
await (releaseForked ? releaseForked() : opts.runner.sessions.release?.(forkedId));
|
|
1660
1696
|
}
|
|
1661
1697
|
catch {
|
|
1662
1698
|
}
|
|
1663
1699
|
const wt = await finishWorktree();
|
|
1664
|
-
return { content: `Fork failed: the forked run threw (${e instanceof Error ? e.message : String(e)}).${wt ? `\n${wt}` : ""}`, details: { error: "fork run failed" } };
|
|
1700
|
+
return { isError: true, content: `Fork failed: the forked run threw (${e instanceof Error ? e.message : String(e)}).${wt ? `\n${wt}` : ""}`, details: { error: "fork run failed" } };
|
|
1665
1701
|
}
|
|
1666
1702
|
const nsf = forkChild.stats.nested;
|
|
1667
1703
|
ctx.reportUsage?.({
|
|
@@ -1744,7 +1780,7 @@ task_id: ${taskId}
|
|
|
1744
1780
|
dropHostAbortListener();
|
|
1745
1781
|
await cancelObserver();
|
|
1746
1782
|
const wt = await finishWorktree();
|
|
1747
|
-
return { content: `Sub-agent not started in background: ${e instanceof Error ? e.message : String(e)}${wt ? `\n${wt}` : ""}`, details: { error: "register_failed" } };
|
|
1783
|
+
return { isError: true, content: `Sub-agent not started in background: ${e instanceof Error ? e.message : String(e)}${wt ? `\n${wt}` : ""}`, details: { error: "register_failed" } };
|
|
1748
1784
|
}
|
|
1749
1785
|
if (agentName !== undefined) {
|
|
1750
1786
|
recordRosterSpawn(ctx.roster, { name: agentName, agentId: taskId, toolUseId: ctx.toolCallId, ...(bgOwner !== undefined ? { owner: bgOwner } : {}), ...(bgScope !== undefined ? { scope: bgScope } : {}), ...(sessionScopedBg ? { sessionScoped: true } : {}), createdAt: Date.now() });
|
|
@@ -1764,8 +1800,9 @@ task_id: ${taskId}
|
|
|
1764
1800
|
...(bgOwner !== undefined ? { owner: bgOwner } : {}),
|
|
1765
1801
|
...(bgScope !== undefined ? { scope: bgScope } : {}),
|
|
1766
1802
|
description: shortDesc,
|
|
1767
|
-
|
|
1768
|
-
...(
|
|
1803
|
+
agentType: spawnAgentType,
|
|
1804
|
+
...(agentName !== undefined ? { name: agentName } : {}),
|
|
1805
|
+
...(ctx.taskId !== undefined && ctx.taskId !== ctx.sessionId ? { parentTaskId: ctx.taskId } : {}),
|
|
1769
1806
|
...(ctx.sessionId !== undefined ? { parentSessionId: ctx.sessionId } : {}),
|
|
1770
1807
|
});
|
|
1771
1808
|
const bgRetainLedger = sessionScopedBg
|
|
@@ -1811,6 +1848,7 @@ task_id: ${taskId}
|
|
|
1811
1848
|
sessionScoped: sessionScopedBg === true,
|
|
1812
1849
|
progressTaskId: e.taskId,
|
|
1813
1850
|
...(e.parentTaskId !== undefined ? { progressParentTaskId: e.parentTaskId } : {}),
|
|
1851
|
+
agentType: spawnAgentType,
|
|
1814
1852
|
...(e.name !== undefined ? { name: e.name } : {}),
|
|
1815
1853
|
...(currentAction !== undefined ? { currentAction } : {}),
|
|
1816
1854
|
usage: e.usage,
|
|
@@ -2248,7 +2286,7 @@ export function createSendMessageTool(opts) {
|
|
|
2248
2286
|
content: `Message not sent: no agent matches "${to}" (unknown id or name, not yours, or expired).` +
|
|
2249
2287
|
(byName.suggestion !== undefined ? ` Did you mean: ${byName.suggestion}?` : "") +
|
|
2250
2288
|
(labels.length > 0 ? ` Running background agents: ${labels.join(", ")}.` : "") +
|
|
2251
|
-
`
|
|
2289
|
+
` Note: a completed foreground agent is not resumable (its transcript is not retained) — spawn with run_in_background to keep an agent addressable, or launch a new agent.`,
|
|
2252
2290
|
details: { error: "not_found", to, ...(byName.suggestion !== undefined ? { suggestion: byName.suggestion } : {}) },
|
|
2253
2291
|
};
|
|
2254
2292
|
}
|