@sema-agent/core 1.428.0 → 1.429.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.
@@ -18,6 +18,8 @@ export declare class SubagentStepRecorder {
18
18
  private readonly pending;
19
19
  private readonly edits;
20
20
  private action;
21
+ private actionTool;
22
+ private actionTarget;
21
23
  constructor(parentToolCallId?: string);
22
24
  lockTo(taskId: string): void;
23
25
  private resetRecorded;
@@ -26,5 +28,9 @@ export declare class SubagentStepRecorder {
26
28
  recentSteps(): SubagentStep[] | undefined;
27
29
  editedFiles(): SubagentEditedFile[] | undefined;
28
30
  currentAction(): string | undefined;
31
+ currentActionStructured(): {
32
+ toolName: string;
33
+ target?: string;
34
+ } | undefined;
29
35
  }
30
36
  export declare function stepsFromMessages(messages: readonly unknown[], lastN: number): SubagentStep[];
@@ -58,6 +58,8 @@ export class SubagentStepRecorder {
58
58
  pending = new Map();
59
59
  edits = new Map();
60
60
  action;
61
+ actionTool;
62
+ actionTarget;
61
63
  constructor(parentToolCallId) {
62
64
  this.parentToolCallId = parentToolCallId;
63
65
  }
@@ -72,6 +74,8 @@ export class SubagentStepRecorder {
72
74
  this.pending.clear();
73
75
  this.edits.clear();
74
76
  this.action = undefined;
77
+ this.actionTool = undefined;
78
+ this.actionTarget = undefined;
75
79
  }
76
80
  inScope(e) {
77
81
  const { sourceTaskId: src, parentToolCallId: ptc } = e;
@@ -94,6 +98,8 @@ export class SubagentStepRecorder {
94
98
  const target = extractTarget(e.args);
95
99
  this.pending.set(e.toolCallId, { tool, target, ...(editTargetPath(e.toolName, e.args) ? { edit: editTargetPath(e.toolName, e.args) } : {}) });
96
100
  this.action = target ? `${tool} ${target}`.slice(0, FIELD_MAX + tool.length + 1) : tool;
101
+ this.actionTool = tool;
102
+ this.actionTarget = target || undefined;
97
103
  }
98
104
  else if (e.type === "tool_end") {
99
105
  if (!this.inScope(e))
@@ -128,6 +134,9 @@ export class SubagentStepRecorder {
128
134
  currentAction() {
129
135
  return this.action;
130
136
  }
137
+ currentActionStructured() {
138
+ return this.actionTool === undefined ? undefined : { toolName: this.actionTool, ...(this.actionTarget !== undefined ? { target: this.actionTarget } : {}) };
139
+ }
131
140
  }
132
141
  export function stepsFromMessages(messages, lastN) {
133
142
  const results = new Map();
@@ -1686,6 +1686,7 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
1686
1686
  }
1687
1687
  if (e.type === "task_progress") {
1688
1688
  const currentAction = stepRecorder.currentAction();
1689
+ const currentTool = stepRecorder.currentActionStructured();
1689
1690
  sinkEmit({
1690
1691
  kind: "tick",
1691
1692
  taskId,
@@ -1696,6 +1697,7 @@ function makeSubagentTool(opts, depth, excluded, extraToolsBudget) {
1696
1697
  agentType: spawnAgentType,
1697
1698
  ...(e.name !== undefined ? { name: e.name } : {}),
1698
1699
  ...(currentAction !== undefined ? { currentAction } : {}),
1700
+ ...(currentTool !== undefined ? { currentTool } : {}),
1699
1701
  usage: e.usage,
1700
1702
  });
1701
1703
  }
@@ -2078,6 +2080,7 @@ task_id: ${taskId}
2078
2080
  }
2079
2081
  if (e.type === "task_progress") {
2080
2082
  const currentAction = stepRecorder.currentAction();
2083
+ const currentTool = stepRecorder.currentActionStructured();
2081
2084
  sinkEmit({
2082
2085
  kind: "tick",
2083
2086
  taskId,
@@ -2088,6 +2091,7 @@ task_id: ${taskId}
2088
2091
  agentType: spawnAgentType,
2089
2092
  ...(e.name !== undefined ? { name: e.name } : {}),
2090
2093
  ...(currentAction !== undefined ? { currentAction } : {}),
2094
+ ...(currentTool !== undefined ? { currentTool } : {}),
2091
2095
  usage: e.usage,
2092
2096
  });
2093
2097
  }
@@ -646,6 +646,10 @@ export interface BackgroundChildEvent {
646
646
  progressParentTaskId?: string;
647
647
  name?: string;
648
648
  currentAction?: string;
649
+ currentTool?: {
650
+ toolName: string;
651
+ target?: string;
652
+ };
649
653
  sessionId?: string;
650
654
  transcriptId?: string;
651
655
  recentSteps?: import("../agents/subagent-steps.js").SubagentStep[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/core",
3
- "version": "1.428.0",
3
+ "version": "1.429.0",
4
4
  "description": "Stateless, task-oriented AI agent core",
5
5
  "type": "module",
6
6
  "license": "BUSL-1.1",