@sema-agent/core 1.400.0 → 1.402.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.
@@ -1,6 +1,6 @@
1
1
  import { Type } from "typebox";
2
2
  import { isAbsolute } from "node:path";
3
- import { resolveModel } from "../core/roles.js";
3
+ import { resolveModel, resolveModelDisplayLabel } from "../core/roles.js";
4
4
  import { OUTPUT_TOOL_NAME, REPORT_BLOCKED_TOOL_NAME } from "../core/runner/synthetic-tools.js";
5
5
  import { defineTool } from "../core/tools.js";
6
6
  import { TOOL_SEARCH_NAME } from "../core/runner/tool-disclosure.js";
@@ -1591,7 +1591,7 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
1591
1591
  ...(ctx.taskId !== undefined && ctx.taskId !== ctx.sessionId ? { parentTaskId: ctx.taskId } : {}),
1592
1592
  ...(ctx.sessionId !== undefined ? { parentSessionId: ctx.sessionId } : {}),
1593
1593
  ...((ctx.rootSessionId ?? ctx.sessionId) !== undefined ? { rootSessionId: ctx.rootSessionId ?? ctx.sessionId } : {}),
1594
- ...((typeof childModel === "string" ? childModel : childModel?.id) !== undefined ? { model: typeof childModel === "string" ? childModel : childModel?.id } : {}),
1594
+ ...((typeof childModel === "string" ? resolveModelDisplayLabel(childModel) : childModel?.id) !== undefined ? { model: typeof childModel === "string" ? childModel : childModel?.id } : {}),
1595
1595
  deliveryChannel: "attaching",
1596
1596
  toolUseId: ctx.toolCallId,
1597
1597
  ...(bg.agentStore !== undefined ? { store: bg.agentStore } : {}),
@@ -1610,7 +1610,7 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
1610
1610
  }
1611
1611
  bg.registry.bindBackgroundAgentSession(taskId, forkedId);
1612
1612
  if (agentName !== undefined) {
1613
- recordRosterSpawn(ctx.roster, { name: agentName, agentId: taskId, sessionId: forkedId, toolUseId: ctx.toolCallId, owner: bgOwner, scope: bgScope, ...((typeof childModel === "string" ? childModel : childModel?.id) !== undefined ? { model: typeof childModel === "string" ? childModel : childModel?.id } : {}), ...((ctx.rootSessionId ?? ctx.sessionId) !== undefined ? { rootSessionId: ctx.rootSessionId ?? ctx.sessionId } : {}), ...(sessionScopedBg ? { sessionScoped: true } : {}), createdAt: Date.now() });
1613
+ recordRosterSpawn(ctx.roster, { name: agentName, agentId: taskId, sessionId: forkedId, toolUseId: ctx.toolCallId, owner: bgOwner, scope: bgScope, ...((typeof childModel === "string" ? resolveModelDisplayLabel(childModel) : childModel?.id) !== undefined ? { model: typeof childModel === "string" ? childModel : childModel?.id } : {}), ...((ctx.rootSessionId ?? ctx.sessionId) !== undefined ? { rootSessionId: ctx.rootSessionId ?? ctx.sessionId } : {}), ...(sessionScopedBg ? { sessionScoped: true } : {}), createdAt: Date.now() });
1614
1614
  }
1615
1615
  const bgSink = ctx.onBackgroundChildEvent;
1616
1616
  const sinkEmit = (event) => {
@@ -1939,7 +1939,7 @@ task_id: ${taskId}
1939
1939
  ...(ctx.taskId !== undefined && ctx.taskId !== ctx.sessionId ? { parentTaskId: ctx.taskId } : {}),
1940
1940
  ...(ctx.sessionId !== undefined ? { parentSessionId: ctx.sessionId } : {}),
1941
1941
  ...((ctx.rootSessionId ?? ctx.sessionId) !== undefined ? { rootSessionId: ctx.rootSessionId ?? ctx.sessionId } : {}),
1942
- ...((typeof childModel === "string" ? childModel : childModel?.id) !== undefined ? { model: typeof childModel === "string" ? childModel : childModel?.id } : {}),
1942
+ ...((typeof childModel === "string" ? resolveModelDisplayLabel(childModel) : childModel?.id) !== undefined ? { model: typeof childModel === "string" ? childModel : childModel?.id } : {}),
1943
1943
  deliveryChannel: "attaching",
1944
1944
  toolUseId: ctx.toolCallId,
1945
1945
  ...(bg.agentStore !== undefined ? { store: bg.agentStore } : {}),
@@ -1953,7 +1953,7 @@ task_id: ${taskId}
1953
1953
  return { isError: true, content: `Sub-agent not started in background: ${e instanceof Error ? e.message : String(e)}${wt ? `\n${wt}` : ""}`, details: { error: "register_failed" } };
1954
1954
  }
1955
1955
  if (agentName !== undefined) {
1956
- recordRosterSpawn(ctx.roster, { name: agentName, agentId: taskId, toolUseId: ctx.toolCallId, owner: bgOwner, scope: bgScope, ...((typeof childModel === "string" ? childModel : childModel?.id) !== undefined ? { model: typeof childModel === "string" ? childModel : childModel?.id } : {}), ...(reviveRow !== undefined ? (reviveRow.rootSessionId !== undefined ? { rootSessionId: reviveRow.rootSessionId } : {}) : (ctx.rootSessionId ?? ctx.sessionId) !== undefined ? { rootSessionId: ctx.rootSessionId ?? ctx.sessionId } : {}), ...(sessionScopedBg ? { sessionScoped: true } : {}), createdAt: reviveRow?.spawnedAt ?? Date.now() });
1956
+ recordRosterSpawn(ctx.roster, { name: agentName, agentId: taskId, toolUseId: ctx.toolCallId, owner: bgOwner, scope: bgScope, ...((typeof childModel === "string" ? resolveModelDisplayLabel(childModel) : childModel?.id) !== undefined ? { model: typeof childModel === "string" ? childModel : childModel?.id } : {}), ...(reviveRow !== undefined ? (reviveRow.rootSessionId !== undefined ? { rootSessionId: reviveRow.rootSessionId } : {}) : (ctx.rootSessionId ?? ctx.sessionId) !== undefined ? { rootSessionId: ctx.rootSessionId ?? ctx.sessionId } : {}), ...(sessionScopedBg ? { sessionScoped: true } : {}), createdAt: reviveRow?.spawnedAt ?? Date.now() });
1957
1957
  }
1958
1958
  const bgSink = ctx.onBackgroundChildEvent;
1959
1959
  const sinkEmit = (event) => {