@oh-my-pi/pi-agent-core 18.10.1 → 18.10.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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [18.10.2] - 2026-10-12
6
+
7
+ ### Added
8
+
9
+ - Added `AgentLoopConfig.onDetachedToolUpdate`: a tool's `onUpdate` frames that arrive after its run's event stream ended (a returned call whose background job keeps reporting) reach it instead of being dropped; `Agent` forwards them to its subscribers as `tool_execution_update` events
10
+
5
11
  ## [18.9.2] - 2026-10-11
6
12
 
7
13
  ### Changed
@@ -79,9 +79,9 @@ uutils coreutils (https://github.com/uutils/coreutils), MIT
79
79
  --------------------------------------------------------------------------------
80
80
  Covers: base32, base64, basename, cat, cksum (shared checksum machinery),
81
81
  b2sum, md5sum, sha1sum, sha224sum, sha256sum, sha384sum, sha512sum, comm, cp,
82
- cut, date, dirname, head, hostname, ln, ls, mkdir, mktemp, mv, nproc, paste,
83
- printenv, readlink, realpath, rm, seq, sort, stat, tac, tail, tee, touch, tr,
84
- truncate, uname, uniq, wc, whoami, yes.
82
+ cut, date, dirname, head, hostname, ln, ls, mkdir, mktemp, mv, nl, nproc,
83
+ paste, printenv, readlink, realpath, rm, seq, sort, stat, tac, tail, tee,
84
+ touch, tr, truncate, uname, uniq, wc, whoami, yes.
85
85
 
86
86
  Copyright (c) uutils developers
87
87
 
@@ -279,6 +279,15 @@ export interface AgentLoopConfig extends SimpleStreamOptions {
279
279
  * tools finish first.
280
280
  */
281
281
  hasQueuedAsides?: () => boolean | Promise<boolean>;
282
+ /**
283
+ * Receives a tool's `onUpdate` frames that arrive after this run's event
284
+ * stream ended: a call that returned while its background job keeps
285
+ * reporting (`details.async`), whose run yielded before the job settled.
286
+ * Without it those frames are dropped.
287
+ */
288
+ onDetachedToolUpdate?: (event: Extract<AgentEvent, {
289
+ type: "tool_execution_update";
290
+ }>) => void;
282
291
  /**
283
292
  * Returns follow-up messages to process after the agent would otherwise stop.
284
293
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/pi-agent-core",
4
- "version": "18.10.1",
4
+ "version": "18.10.2",
5
5
  "description": "General-purpose agent with transport abstraction, state management, and attachment support",
6
6
  "homepage": "https://omp.sh",
7
7
  "author": {
@@ -38,16 +38,16 @@
38
38
  "fmt": "oxfmt --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts'"
39
39
  },
40
40
  "dependencies": {
41
- "@oh-my-pi/pi-ai": "18.10.1",
42
- "@oh-my-pi/pi-catalog": "18.10.1",
43
- "@oh-my-pi/pi-natives": "18.10.1",
44
- "@oh-my-pi/pi-utils": "18.10.1",
45
- "@oh-my-pi/pi-wire": "18.10.1",
46
- "@oh-my-pi/snapcompact": "18.10.1",
41
+ "@oh-my-pi/pi-ai": "18.10.2",
42
+ "@oh-my-pi/pi-catalog": "18.10.2",
43
+ "@oh-my-pi/pi-natives": "18.10.2",
44
+ "@oh-my-pi/pi-utils": "18.10.2",
45
+ "@oh-my-pi/pi-wire": "18.10.2",
46
+ "@oh-my-pi/snapcompact": "18.10.2",
47
47
  "@opentelemetry/api": "^1.9.1"
48
48
  },
49
49
  "devDependencies": {
50
- "@oh-my-pi/omptype": "18.10.1",
50
+ "@oh-my-pi/omptype": "18.10.2",
51
51
  "@opentelemetry/context-async-hooks": "^2.9.0",
52
52
  "@opentelemetry/sdk-trace-base": "^2.9.0",
53
53
  "@types/bun": "^1.3.14"
package/src/agent-loop.ts CHANGED
@@ -3570,13 +3570,15 @@ async function executeToolCalls(
3570
3570
  executionArgs,
3571
3571
  record.signal,
3572
3572
  partialResult => {
3573
- stream.push({
3573
+ const event: Extract<AgentEvent, { type: "tool_execution_update" }> = {
3574
3574
  type: "tool_execution_update",
3575
3575
  toolCallId: toolCall.id,
3576
3576
  toolName: toolCall.name,
3577
3577
  args: executionArgs,
3578
3578
  partialResult: coerceToolResult(partialResult).result,
3579
- });
3579
+ };
3580
+ if (stream.done) config.onDetachedToolUpdate?.(event);
3581
+ else stream.push(event);
3580
3582
  },
3581
3583
  toolContext,
3582
3584
  );
package/src/agent.ts CHANGED
@@ -1950,6 +1950,7 @@ export class Agent {
1950
1950
  getFollowUpMessages: signal => this.#dequeueFollowUpMessagesAfterHooks(signal ?? loopSignal),
1951
1951
  getAsideMessages: async () => (await this.#asideMessageProvider?.()) ?? [],
1952
1952
  onBeforeYield: () => this.#onBeforeYield?.(),
1953
+ onDetachedToolUpdate: event => this.emitExternalEvent(event),
1953
1954
  telemetry: this.#telemetry,
1954
1955
  };
1955
1956
 
package/src/types.ts CHANGED
@@ -338,6 +338,13 @@ export interface AgentLoopConfig extends SimpleStreamOptions {
338
338
  * tools finish first.
339
339
  */
340
340
  hasQueuedAsides?: () => boolean | Promise<boolean>;
341
+ /**
342
+ * Receives a tool's `onUpdate` frames that arrive after this run's event
343
+ * stream ended: a call that returned while its background job keeps
344
+ * reporting (`details.async`), whose run yielded before the job settled.
345
+ * Without it those frames are dropped.
346
+ */
347
+ onDetachedToolUpdate?: (event: Extract<AgentEvent, { type: "tool_execution_update" }>) => void;
341
348
 
342
349
  /**
343
350
  * Returns follow-up messages to process after the agent would otherwise stop.