@sema-agent/core 1.349.0 → 1.351.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 +1 -0
- package/dist/agents/subagent.d.ts.map +1 -1
- package/dist/agents/subagent.js +127 -20
- 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 +28 -1
- package/dist/core/runner/prepare-task.js.map +1 -1
- package/dist/core/task-registry.d.ts +7 -0
- package/dist/core/task-registry.d.ts.map +1 -1
- package/dist/core/task-registry.js +14 -1
- package/dist/core/task-registry.js.map +1 -1
- package/dist/core/types.d.ts +7 -0
- package/dist/core/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -177,6 +177,7 @@ export interface SendMessageToolOptions {
|
|
|
177
177
|
senderName?: string;
|
|
178
178
|
roster?: import("./roster-store.js").RosterStore;
|
|
179
179
|
siblingRetain?: SubagentRetainLedger;
|
|
180
|
+
onBackgroundChildEvent?: (event: import("../core/types.js").BackgroundChildEvent) => void;
|
|
180
181
|
}
|
|
181
182
|
export declare function recordRosterSpawn(roster: import("./roster-store.js").RosterStore | undefined, entry: import("./roster-store.js").RosterEntry): void;
|
|
182
183
|
export declare function createSendMessageTool(opts: SendMessageToolOptions): import("../core/types.js").AgentTool<Type.TObject<{
|
|
@@ -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;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AM,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
|
@@ -442,6 +442,7 @@ function makeSubagentResume(deps) {
|
|
|
442
442
|
const childRunner = entry.runner ?? deps.runner;
|
|
443
443
|
let stream;
|
|
444
444
|
let reviveCycle;
|
|
445
|
+
let reviveEmit;
|
|
445
446
|
let marker;
|
|
446
447
|
try {
|
|
447
448
|
let leafId;
|
|
@@ -478,9 +479,52 @@ function makeSubagentResume(deps) {
|
|
|
478
479
|
: "resume unavailable: the agent's registry row no longer exists (terminal GC) — relaunch a new agent instead.", revived.reason === "still_running" ? "steering.still_running" : "resume.row_gone");
|
|
479
480
|
}
|
|
480
481
|
reviveCycle = revived.cycle;
|
|
482
|
+
if (deps.bgSink !== undefined) {
|
|
483
|
+
reviveEmit = (event) => {
|
|
484
|
+
try {
|
|
485
|
+
deps.bgSink(event);
|
|
486
|
+
}
|
|
487
|
+
catch {
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
reviveEmit({
|
|
491
|
+
kind: "spawn",
|
|
492
|
+
taskId: deps.taskId,
|
|
493
|
+
sessionScoped: deps.sessionScoped === true,
|
|
494
|
+
...(deps.rowOwner !== undefined ? { owner: deps.rowOwner } : {}),
|
|
495
|
+
...(deps.rowScope !== undefined ? { scope: deps.rowScope } : {}),
|
|
496
|
+
description: `${deps.rowDescription ?? "sub-agent"} (resumed ${marker})`,
|
|
497
|
+
...(deps.rowAgentType !== undefined ? { agentType: deps.rowAgentType } : {}),
|
|
498
|
+
...(deps.rowName !== undefined ? { name: deps.rowName } : {}),
|
|
499
|
+
sessionId: entry.childSessionId,
|
|
500
|
+
});
|
|
501
|
+
}
|
|
481
502
|
}
|
|
482
503
|
stream = childRunner.runTaskStream(resumeSpec, undefined, {
|
|
483
504
|
...entry.internalsSnapshot,
|
|
505
|
+
...(reviveEmit !== undefined
|
|
506
|
+
? {
|
|
507
|
+
onForwardEvent: (e) => {
|
|
508
|
+
try {
|
|
509
|
+
entry.internalsSnapshot.onForwardEvent?.(e);
|
|
510
|
+
}
|
|
511
|
+
catch {
|
|
512
|
+
}
|
|
513
|
+
if (e.type === "task_progress") {
|
|
514
|
+
reviveEmit({
|
|
515
|
+
kind: "tick",
|
|
516
|
+
taskId: deps.taskId,
|
|
517
|
+
sessionScoped: deps.sessionScoped === true,
|
|
518
|
+
...(deps.rowAgentType !== undefined ? { agentType: deps.rowAgentType } : {}),
|
|
519
|
+
progressTaskId: e.taskId,
|
|
520
|
+
...(e.parentTaskId !== undefined ? { progressParentTaskId: e.parentTaskId } : {}),
|
|
521
|
+
...(e.name !== undefined ? { name: e.name } : {}),
|
|
522
|
+
usage: e.usage,
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
},
|
|
526
|
+
}
|
|
527
|
+
: {}),
|
|
484
528
|
...(deps.currentParentNotify !== undefined ? { parentNotify: deps.currentParentNotify } : {}),
|
|
485
529
|
...(reviveCycle !== undefined
|
|
486
530
|
? {
|
|
@@ -534,6 +578,17 @@ function makeSubagentResume(deps) {
|
|
|
534
578
|
catch {
|
|
535
579
|
}
|
|
536
580
|
}
|
|
581
|
+
reviveEmit?.({
|
|
582
|
+
kind: "terminal",
|
|
583
|
+
taskId: deps.taskId,
|
|
584
|
+
sessionScoped: deps.sessionScoped === true,
|
|
585
|
+
sessionId: entry.childSessionId,
|
|
586
|
+
transcriptId: entry.childSessionId,
|
|
587
|
+
status,
|
|
588
|
+
summary: `resumed sub-agent ${marker} — ${status === "killed" ? "killed" : child.status}`,
|
|
589
|
+
resumable: status !== "killed",
|
|
590
|
+
usage: { tokens: child.stats.tokens, turns: child.stats.turns, costMicroUsd: child.stats.costMicroUsd },
|
|
591
|
+
});
|
|
537
592
|
const resumeFrame = {
|
|
538
593
|
task_id: entry.childSessionId,
|
|
539
594
|
task_type: "background_agent",
|
|
@@ -578,6 +633,14 @@ function makeSubagentResume(deps) {
|
|
|
578
633
|
catch {
|
|
579
634
|
}
|
|
580
635
|
}
|
|
636
|
+
reviveEmit?.({
|
|
637
|
+
kind: "terminal",
|
|
638
|
+
taskId: deps.taskId,
|
|
639
|
+
sessionScoped: deps.sessionScoped === true,
|
|
640
|
+
sessionId: entry.childSessionId,
|
|
641
|
+
status: abort.signal.aborted ? "killed" : "failed",
|
|
642
|
+
summary: `resumed sub-agent ${marker} — ${abort.signal.aborted ? "killed" : "failed"}`.slice(0, 300),
|
|
643
|
+
});
|
|
581
644
|
try {
|
|
582
645
|
deps.notify?.({
|
|
583
646
|
task_id: entry.childSessionId,
|
|
@@ -947,7 +1010,7 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
|
|
|
947
1010
|
if (ctx.insideFork === true) {
|
|
948
1011
|
return { isError: true, content: `Sub-agent not started: subagent_type "${FORK_SUBAGENT_TYPE}" is not available inside a forked agent.`, details: { error: "fork.nested" } };
|
|
949
1012
|
}
|
|
950
|
-
if (ctx.sessionId === undefined || !hasSessionFork(opts.runner.sessions)) {
|
|
1013
|
+
if (ctx.sessionId === undefined || (ctx.hostSessionFork === undefined && !hasSessionFork(opts.runner.sessions))) {
|
|
951
1014
|
return {
|
|
952
1015
|
isError: true,
|
|
953
1016
|
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.`,
|
|
@@ -1039,8 +1102,6 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
|
|
|
1039
1102
|
toolCallId: ctx.toolCallId,
|
|
1040
1103
|
...(ctx.taskId !== undefined ? { parentTaskId: ctx.taskId } : {}),
|
|
1041
1104
|
...(ctx.sessionId !== undefined ? { parentSessionId: ctx.sessionId } : {}),
|
|
1042
|
-
...(ctx.sessionId !== undefined ? { parentSessionId: ctx.sessionId } : {}),
|
|
1043
|
-
...(ctx.sessionId !== undefined ? { parentSessionId: ctx.sessionId } : {}),
|
|
1044
1105
|
...(ctx.principal !== undefined ? { principal: ctx.principal } : {}),
|
|
1045
1106
|
...(def !== undefined ? { agentType: def.name } : wantsFork ? { agentType: FORK_SUBAGENT_TYPE } : {}),
|
|
1046
1107
|
depth,
|
|
@@ -1302,15 +1363,17 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
|
|
|
1302
1363
|
...(ctx.excludeTools !== undefined ? { excludeTools: [...ctx.excludeTools] } : {}),
|
|
1303
1364
|
...(ctx.deferTools !== undefined ? { deferTools: [...ctx.deferTools] } : {}),
|
|
1304
1365
|
...(ctx.promptProfile !== undefined ? { promptProfile: ctx.promptProfile } : {}),
|
|
1366
|
+
...(ctx.additionalDirectories !== undefined ? { additionalDirectories: [...ctx.additionalDirectories] } : {}),
|
|
1367
|
+
...(ctx.envFacts !== undefined ? { envFacts: { ...ctx.envFacts } } : {}),
|
|
1305
1368
|
...(ctx.getApiKeyAndHeaders !== undefined ? { getApiKeyAndHeaders: ctx.getApiKeyAndHeaders } : {}),
|
|
1306
1369
|
enableBlockedReport: true,
|
|
1307
1370
|
limits: childLimits,
|
|
1308
1371
|
signal,
|
|
1309
1372
|
});
|
|
1310
|
-
const tryRetainChild = async (ledger, entryTtlMs) => {
|
|
1373
|
+
const tryRetainChild = async (ledger, entryTtlMs, preMintedSessionId) => {
|
|
1311
1374
|
if (!ledger)
|
|
1312
1375
|
return undefined;
|
|
1313
|
-
const childSessionId = uuidv7();
|
|
1376
|
+
const childSessionId = preMintedSessionId ?? uuidv7();
|
|
1314
1377
|
const { signal: _spawnSignal, ...plainSpec } = buildChildSpec(undefined);
|
|
1315
1378
|
let entry = ledger.register(ctx.toolCallId, {
|
|
1316
1379
|
childSessionId,
|
|
@@ -1435,8 +1498,16 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
|
|
|
1435
1498
|
};
|
|
1436
1499
|
if (wantsFork) {
|
|
1437
1500
|
let forkedId;
|
|
1501
|
+
let releaseForked;
|
|
1438
1502
|
try {
|
|
1439
|
-
|
|
1503
|
+
if (ctx.hostSessionFork) {
|
|
1504
|
+
const forkHandle = await ctx.hostSessionFork();
|
|
1505
|
+
forkedId = forkHandle?.sessionId ?? null;
|
|
1506
|
+
releaseForked = forkHandle?.release;
|
|
1507
|
+
}
|
|
1508
|
+
else {
|
|
1509
|
+
forkedId = (await opts.runner.sessions.fork?.(ctx.sessionId, ctx.principal ?? null)) ?? null;
|
|
1510
|
+
}
|
|
1440
1511
|
}
|
|
1441
1512
|
catch (e) {
|
|
1442
1513
|
const wt = await finishWorktree();
|
|
@@ -1472,6 +1543,7 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
|
|
|
1472
1543
|
...(bgScope !== undefined ? { scope: bgScope } : {}),
|
|
1473
1544
|
...(sessionScopedBg ? { sessionScoped: true } : {}),
|
|
1474
1545
|
description: shortDesc,
|
|
1546
|
+
agentType: spawnAgentType,
|
|
1475
1547
|
...(agentName !== undefined ? { name: agentName } : {}),
|
|
1476
1548
|
deliveryChannel: "attaching",
|
|
1477
1549
|
toolUseId: ctx.toolCallId,
|
|
@@ -1481,7 +1553,7 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
|
|
|
1481
1553
|
catch (e) {
|
|
1482
1554
|
dropHostAbortListener();
|
|
1483
1555
|
try {
|
|
1484
|
-
await opts.runner.sessions.release?.(forkedId);
|
|
1556
|
+
await (releaseForked ? releaseForked() : opts.runner.sessions.release?.(forkedId));
|
|
1485
1557
|
}
|
|
1486
1558
|
catch {
|
|
1487
1559
|
}
|
|
@@ -1509,10 +1581,10 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
|
|
|
1509
1581
|
agentType: spawnAgentType,
|
|
1510
1582
|
...(agentName !== undefined ? { name: agentName } : {}),
|
|
1511
1583
|
sessionId: forkedId,
|
|
1512
|
-
...(ctx.taskId !== undefined ? { parentTaskId: ctx.taskId } : {}),
|
|
1584
|
+
...(ctx.taskId !== undefined && ctx.taskId !== ctx.sessionId ? { parentTaskId: ctx.taskId } : {}),
|
|
1513
1585
|
...(ctx.sessionId !== undefined ? { parentSessionId: ctx.sessionId } : {}),
|
|
1514
1586
|
});
|
|
1515
|
-
const bgForkSpec = { ...buildChildSpec(abort.signal), sessionId: forkedId, objective: forkObjective };
|
|
1587
|
+
const bgForkSpec = { ...buildChildSpec(abort.signal), sessionId: forkedId, requireExistingSession: true, objective: forkObjective };
|
|
1516
1588
|
if (sessionScopedBg && bgForkSpec.limits?.timeoutSec === undefined) {
|
|
1517
1589
|
bgForkSpec.limits = { ...(bgForkSpec.limits ?? {}), timeoutSec: SESSION_BG_DEFAULT_TIMEOUT_SEC };
|
|
1518
1590
|
}
|
|
@@ -1537,6 +1609,7 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
|
|
|
1537
1609
|
sessionScoped: sessionScopedBg === true,
|
|
1538
1610
|
progressTaskId: e.taskId,
|
|
1539
1611
|
...(e.parentTaskId !== undefined ? { progressParentTaskId: e.parentTaskId } : {}),
|
|
1612
|
+
agentType: spawnAgentType,
|
|
1540
1613
|
...(e.name !== undefined ? { name: e.name } : {}),
|
|
1541
1614
|
...(currentAction !== undefined ? { currentAction } : {}),
|
|
1542
1615
|
usage: e.usage,
|
|
@@ -1570,15 +1643,23 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
|
|
|
1570
1643
|
...(!okBg ? { error: reapedBg ? BG_AGENT_REAP_STOP_ERROR : child.errorMessage ?? String(child.status) } : {}),
|
|
1571
1644
|
}) ?? (abort.signal.aborted ? "killed" : okBg ? "completed" : "failed");
|
|
1572
1645
|
const stoppedByBg = settledBg === "killed" ? bg.registry.getStopAttribution(taskId) ?? "system" : undefined;
|
|
1646
|
+
const stillbornFork = child.errorCode === "resume.session_not_found";
|
|
1647
|
+
if (stillbornFork) {
|
|
1648
|
+
try {
|
|
1649
|
+
await (releaseForked ? releaseForked() : opts.runner.sessions.release?.(forkedId));
|
|
1650
|
+
}
|
|
1651
|
+
catch {
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1573
1654
|
const residualFork = residualFields();
|
|
1574
|
-
const resumableFork = settledBg !== "killed";
|
|
1655
|
+
const resumableFork = settledBg !== "killed" && !stillbornFork;
|
|
1575
1656
|
const forkTranscriptId = child.sessionId ?? forkedId;
|
|
1576
1657
|
sinkEmit({
|
|
1577
1658
|
kind: "terminal",
|
|
1578
1659
|
taskId,
|
|
1579
1660
|
sessionScoped: sessionScopedBg === true,
|
|
1580
1661
|
sessionId: forkTranscriptId,
|
|
1581
|
-
transcriptId: forkTranscriptId,
|
|
1662
|
+
...(stillbornFork ? {} : { transcriptId: forkTranscriptId }),
|
|
1582
1663
|
status: settledBg,
|
|
1583
1664
|
...(stoppedByBg !== undefined ? { stoppedBy: stoppedByBg } : {}),
|
|
1584
1665
|
summary: `${shortDesc} — ${settledBg === "killed" ? "stopped" : child.status}`,
|
|
@@ -1666,16 +1747,23 @@ task_id: ${taskId}
|
|
|
1666
1747
|
: undefined;
|
|
1667
1748
|
let forkChild;
|
|
1668
1749
|
try {
|
|
1669
|
-
forkChild = await opts.runner.runTask({ ...buildChildSpec(ctx.signal), sessionId: forkedId, objective: forkObjective }, forkInternals);
|
|
1750
|
+
forkChild = await opts.runner.runTask({ ...buildChildSpec(ctx.signal), sessionId: forkedId, requireExistingSession: true, objective: forkObjective }, forkInternals);
|
|
1751
|
+
if (forkChild.errorCode === "resume.session_not_found") {
|
|
1752
|
+
try {
|
|
1753
|
+
await (releaseForked ? releaseForked() : opts.runner.sessions.release?.(forkedId));
|
|
1754
|
+
}
|
|
1755
|
+
catch {
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1670
1758
|
}
|
|
1671
1759
|
catch (e) {
|
|
1672
1760
|
try {
|
|
1673
|
-
await opts.runner.sessions.release?.(forkedId);
|
|
1761
|
+
await (releaseForked ? releaseForked() : opts.runner.sessions.release?.(forkedId));
|
|
1674
1762
|
}
|
|
1675
1763
|
catch {
|
|
1676
1764
|
}
|
|
1677
1765
|
const wt = await finishWorktree();
|
|
1678
|
-
return { content: `Fork failed: the forked run threw (${e instanceof Error ? e.message : String(e)}).${wt ? `\n${wt}` : ""}`, details: { error: "fork run failed" } };
|
|
1766
|
+
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" } };
|
|
1679
1767
|
}
|
|
1680
1768
|
const nsf = forkChild.stats.nested;
|
|
1681
1769
|
ctx.reportUsage?.({
|
|
@@ -1748,6 +1836,7 @@ task_id: ${taskId}
|
|
|
1748
1836
|
...(bgScope !== undefined ? { scope: bgScope } : {}),
|
|
1749
1837
|
...(sessionScopedBg ? { sessionScoped: true } : {}),
|
|
1750
1838
|
description: shortDesc,
|
|
1839
|
+
agentType: spawnAgentType,
|
|
1751
1840
|
...(agentName !== undefined ? { name: agentName } : {}),
|
|
1752
1841
|
deliveryChannel: "attaching",
|
|
1753
1842
|
toolUseId: ctx.toolCallId,
|
|
@@ -1771,6 +1860,8 @@ task_id: ${taskId}
|
|
|
1771
1860
|
catch {
|
|
1772
1861
|
}
|
|
1773
1862
|
};
|
|
1863
|
+
const bgChildSessionId = uuidv7();
|
|
1864
|
+
stepRecorder.lockTo(bgChildSessionId);
|
|
1774
1865
|
sinkEmit({
|
|
1775
1866
|
kind: "spawn",
|
|
1776
1867
|
taskId,
|
|
@@ -1780,7 +1871,8 @@ task_id: ${taskId}
|
|
|
1780
1871
|
description: shortDesc,
|
|
1781
1872
|
agentType: spawnAgentType,
|
|
1782
1873
|
...(agentName !== undefined ? { name: agentName } : {}),
|
|
1783
|
-
|
|
1874
|
+
sessionId: bgChildSessionId,
|
|
1875
|
+
...(ctx.taskId !== undefined && ctx.taskId !== ctx.sessionId ? { parentTaskId: ctx.taskId } : {}),
|
|
1784
1876
|
...(ctx.sessionId !== undefined ? { parentSessionId: ctx.sessionId } : {}),
|
|
1785
1877
|
});
|
|
1786
1878
|
const bgRetainLedger = sessionScopedBg
|
|
@@ -1790,9 +1882,7 @@ task_id: ${taskId}
|
|
|
1790
1882
|
: ctx.subagentRetain;
|
|
1791
1883
|
if (sessionScopedBg && bgRetainLedger)
|
|
1792
1884
|
ensureSessionReapHook(bg.registry);
|
|
1793
|
-
const bgRetain = await tryRetainChild(bgRetainLedger, sessionScopedBg && ctx.subagentRetain ? ctx.subagentRetain.ttlMs : undefined);
|
|
1794
|
-
if (bgRetain)
|
|
1795
|
-
stepRecorder.lockTo(bgRetain.childSessionId);
|
|
1885
|
+
const bgRetain = await tryRetainChild(bgRetainLedger, sessionScopedBg && ctx.subagentRetain ? ctx.subagentRetain.ttlMs : undefined, bgChildSessionId);
|
|
1796
1886
|
if (bgRetain) {
|
|
1797
1887
|
bg.registry.markRetainedContinuation(taskId);
|
|
1798
1888
|
const origRelease = bgRetain.release;
|
|
@@ -1801,7 +1891,7 @@ task_id: ${taskId}
|
|
|
1801
1891
|
await origRelease();
|
|
1802
1892
|
};
|
|
1803
1893
|
}
|
|
1804
|
-
const bgSpec = { ...buildChildSpec(abort.signal),
|
|
1894
|
+
const bgSpec = { ...buildChildSpec(abort.signal), sessionId: bgChildSessionId };
|
|
1805
1895
|
if (sessionScopedBg && bgSpec.limits?.timeoutSec === undefined) {
|
|
1806
1896
|
bgSpec.limits = { ...(bgSpec.limits ?? {}), timeoutSec: SESSION_BG_DEFAULT_TIMEOUT_SEC };
|
|
1807
1897
|
}
|
|
@@ -1826,6 +1916,7 @@ task_id: ${taskId}
|
|
|
1826
1916
|
sessionScoped: sessionScopedBg === true,
|
|
1827
1917
|
progressTaskId: e.taskId,
|
|
1828
1918
|
...(e.parentTaskId !== undefined ? { progressParentTaskId: e.parentTaskId } : {}),
|
|
1919
|
+
agentType: spawnAgentType,
|
|
1829
1920
|
...(e.name !== undefined ? { name: e.name } : {}),
|
|
1830
1921
|
...(currentAction !== undefined ? { currentAction } : {}),
|
|
1831
1922
|
usage: e.usage,
|
|
@@ -1949,6 +2040,13 @@ task_id: ${taskId}
|
|
|
1949
2040
|
else
|
|
1950
2041
|
bgRetainLedger?.markSettled(ctx.toolCallId);
|
|
1951
2042
|
}
|
|
2043
|
+
else {
|
|
2044
|
+
try {
|
|
2045
|
+
await opts.runner.sessions.release(bgChildSessionId);
|
|
2046
|
+
}
|
|
2047
|
+
catch {
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
1952
2050
|
const msg = e instanceof Error ? e.message : String(e);
|
|
1953
2051
|
const settled = bg.registry.settleBackgroundAgent(taskId, { status: killed ? "killed" : "failed", error: msg }) ?? (killed ? "killed" : "failed");
|
|
1954
2052
|
const stoppedBy = settled === "killed" ? bg.registry.getStopAttribution(taskId) ?? "system" : undefined;
|
|
@@ -1957,6 +2055,7 @@ task_id: ${taskId}
|
|
|
1957
2055
|
kind: "terminal",
|
|
1958
2056
|
taskId,
|
|
1959
2057
|
sessionScoped: sessionScopedBg === true,
|
|
2058
|
+
sessionId: bgChildSessionId,
|
|
1960
2059
|
status: settled,
|
|
1961
2060
|
...(stoppedBy !== undefined ? { stoppedBy } : {}),
|
|
1962
2061
|
summary: `${shortDesc} — ${settled === "failed" ? `failed: ${msg}` : settled}${observerNote}`.slice(0, 300),
|
|
@@ -1967,6 +2066,7 @@ task_id: ${taskId}
|
|
|
1967
2066
|
task_type: "background_agent",
|
|
1968
2067
|
toolUseId: ctx.toolCallId,
|
|
1969
2068
|
status: settled,
|
|
2069
|
+
sessionId: bgChildSessionId,
|
|
1970
2070
|
...(seqAtSettle !== undefined ? { seq: seqAtSettle } : {}),
|
|
1971
2071
|
...(stoppedBy !== undefined ? { stoppedBy } : {}),
|
|
1972
2072
|
summary: `${shortDesc} — ${settled === "failed" ? `failed: ${msg}` : settled}${observerNote}`.slice(0, 300),
|
|
@@ -2240,7 +2340,7 @@ export function createSendMessageTool(opts) {
|
|
|
2240
2340
|
}
|
|
2241
2341
|
if (byName.status === "found") {
|
|
2242
2342
|
const h = byName.handle;
|
|
2243
|
-
target = { task_id: h.id, type: h.type, status: h.status, ...(h.toolUseId !== undefined ? { toolUseId: h.toolUseId } : {}) };
|
|
2343
|
+
target = { task_id: h.id, type: h.type, status: h.status, ...(h.toolUseId !== undefined ? { toolUseId: h.toolUseId } : {}), ...(h.sessionScoped ? { sessionScoped: true } : {}), ...(h.description !== undefined ? { description: h.description } : {}), ...(h.name !== undefined ? { name: h.name } : {}), ...(h.agentType !== undefined ? { agentType: h.agentType } : {}), ...(h.owner !== undefined ? { owner: h.owner } : {}), ...(h.scope !== undefined ? { scope: h.scope } : {}) };
|
|
2244
2344
|
}
|
|
2245
2345
|
else {
|
|
2246
2346
|
let rosterHit;
|
|
@@ -2335,6 +2435,13 @@ export function createSendMessageTool(opts) {
|
|
|
2335
2435
|
registry: opts.registry,
|
|
2336
2436
|
taskId: targetId,
|
|
2337
2437
|
taskAccess: resolvedAccess,
|
|
2438
|
+
...((ctx.onBackgroundChildEvent ?? opts.onBackgroundChildEvent) ? { bgSink: ctx.onBackgroundChildEvent ?? opts.onBackgroundChildEvent } : {}),
|
|
2439
|
+
sessionScoped: row.sessionScoped === true,
|
|
2440
|
+
...(row.description !== undefined ? { rowDescription: row.description } : {}),
|
|
2441
|
+
...(row.name !== undefined ? { rowName: row.name } : {}),
|
|
2442
|
+
...(row.agentType !== undefined ? { rowAgentType: row.agentType } : {}),
|
|
2443
|
+
...(row.owner !== undefined ? { rowOwner: row.owner } : {}),
|
|
2444
|
+
...(row.scope !== undefined ? { rowScope: row.scope } : {}),
|
|
2338
2445
|
...(opts.notify ? { currentParentNotify: opts.notify } : {}),
|
|
2339
2446
|
});
|
|
2340
2447
|
const summary = typeof a.summary === "string" && a.summary.trim() !== "" ? a.summary.trim().slice(0, 200) : undefined;
|