@agimon-ai/po-team 0.0.0-alpha.174 → 0.0.0-alpha.176

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.
@@ -217,16 +217,21 @@ var NativeRunCoordinator = class {
217
217
  }
218
218
  if (!service.restore) throw new Error("This child-session service cannot restore runs.");
219
219
  const handle = await service.restore(run.request.runId, intercom ? { intercom } : void 0);
220
- return this.adopt(sessionId, run.request.scope, run.request, handle, storedRunIdentity(run));
220
+ const leg = run.request.meta?.leg;
221
+ return this.adopt(sessionId, run.request.scope, run.request, handle, storedRunIdentity(run), typeof leg === "string" ? leg : void 0);
221
222
  }
222
223
  async resume(sessionId, scope, run, input, identity, intercom) {
223
224
  const service = this.service();
224
225
  if (!service.resume) throw new Error("This host cannot resume finished subagent runs.");
226
+ const leg = (0, node_crypto.randomUUID)();
225
227
  const handle = await service.resume(run.runId, input, {
226
228
  ...intercom ? { intercom } : {},
227
- meta: identity ? JSON.parse(JSON.stringify(identity)) : {}
229
+ meta: {
230
+ ...identity ? JSON.parse(JSON.stringify(identity)) : {},
231
+ leg
232
+ }
228
233
  });
229
- return this.adopt(sessionId, scope, run, handle, identity);
234
+ return this.adopt(sessionId, scope, run, handle, identity, leg);
230
235
  }
231
236
  /**
232
237
  * Lists the runs that finished before this session was rebuilt from storage, from their stored outcomes. Nothing is
@@ -265,7 +270,7 @@ var NativeRunCoordinator = class {
265
270
  }
266
271
  return runs.length;
267
272
  }
268
- async adopt(sessionId, scope, request, handle, identity) {
273
+ async adopt(sessionId, scope, request, handle, identity, leg) {
269
274
  if (this.closed) {
270
275
  if (identity?.awaited) {
271
276
  await handle.stop("The owning Team session closed during child startup.");
@@ -278,6 +283,7 @@ var NativeRunCoordinator = class {
278
283
  scope,
279
284
  request,
280
285
  ...identity ? { identity } : {},
286
+ ...leg ? { leg } : {},
281
287
  handle,
282
288
  terminal: false
283
289
  };
@@ -392,6 +398,7 @@ var NativeRunCoordinator = class {
392
398
  this.entries.delete(entryKey(entry.sessionId, entry.request.runId));
393
399
  const result = {
394
400
  runId: entry.request.runId,
401
+ ...entry.leg ? { leg: entry.leg } : {},
395
402
  agent: entry.request.agent,
396
403
  ...entry.identity ? {
397
404
  identity: entry.identity.identity,
@@ -5137,6 +5144,7 @@ function buildCompletionDetails(result) {
5137
5144
  inline
5138
5145
  } : {},
5139
5146
  runId: result.runId,
5147
+ ...asString(result.leg) ? { leg: asString(result.leg) } : {},
5140
5148
  status,
5141
5149
  resultPreview: summary,
5142
5150
  ...taskInfo ? { taskInfo } : {},
@@ -7052,7 +7060,7 @@ const root = (0, _agimon_ai_po_core_extensionFile.defineRoot)(async ({ context,
7052
7060
  details
7053
7061
  });
7054
7062
  if (options?.triggerTurn === false) return;
7055
- const runIds = details.map((detail) => detail.runId).toSorted();
7063
+ const runIds = details.map((detail) => detail.leg ? `${detail.runId}:${detail.leg}` : detail.runId).toSorted();
7056
7064
  const requestId = runIds.length ? `subagent-report:${runIds.join(",")}` : void 0;
7057
7065
  const solo = details.length === 1 ? details[0] : void 0;
7058
7066
  if (solo && requestId && execution.session.admitMessage) {