@strayl/agent 0.1.1 → 0.1.2

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/agent.js CHANGED
@@ -12231,6 +12231,19 @@ var SubAgentManager = class {
12231
12231
  break;
12232
12232
  }
12233
12233
  for (const tc of toolCalls) {
12234
+ let parsedArgs;
12235
+ try {
12236
+ parsedArgs = JSON.parse(tc.function.arguments);
12237
+ } catch {
12238
+ parsedArgs = {};
12239
+ }
12240
+ this.emitter.emit({
12241
+ type: "tool-call-start",
12242
+ id: tc.id,
12243
+ name: tc.function.name,
12244
+ args: parsedArgs,
12245
+ _subagent: id
12246
+ });
12234
12247
  const ctx = {
12235
12248
  emitter: this.emitter,
12236
12249
  workDir: config.workDir,
@@ -12239,6 +12252,13 @@ var SubAgentManager = class {
12239
12252
  toolCallId: tc.id
12240
12253
  };
12241
12254
  const output = await executeTool(registry, tc, ctx, []);
12255
+ this.emitter.emit({
12256
+ type: "tool-result",
12257
+ id: tc.id,
12258
+ name: tc.function.name,
12259
+ output,
12260
+ _subagent: id
12261
+ });
12242
12262
  messages.push({
12243
12263
  role: "tool",
12244
12264
  content: output,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strayl/agent",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -117,6 +117,18 @@ export class SubAgentManager {
117
117
 
118
118
  // Execute tool calls
119
119
  for (const tc of toolCalls) {
120
+ let parsedArgs: unknown;
121
+ try { parsedArgs = JSON.parse(tc.function.arguments); } catch { parsedArgs = {}; }
122
+
123
+ // Emit with _subagent tag so app can associate with this subagent
124
+ (this.emitter as { emit(e: Record<string, unknown>): void }).emit({
125
+ type: "tool-call-start",
126
+ id: tc.id,
127
+ name: tc.function.name,
128
+ args: parsedArgs,
129
+ _subagent: id,
130
+ });
131
+
120
132
  const ctx = {
121
133
  emitter: this.emitter,
122
134
  workDir: config.workDir,
@@ -125,6 +137,15 @@ export class SubAgentManager {
125
137
  toolCallId: tc.id,
126
138
  };
127
139
  const output = await executeTool(registry, tc, ctx, []);
140
+
141
+ (this.emitter as { emit(e: Record<string, unknown>): void }).emit({
142
+ type: "tool-result",
143
+ id: tc.id,
144
+ name: tc.function.name,
145
+ output,
146
+ _subagent: id,
147
+ });
148
+
128
149
  messages.push({
129
150
  role: "tool",
130
151
  content: output,