pi-squire 0.3.0 → 0.3.1

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
@@ -6,6 +6,16 @@ follows [Semantic Versioning](https://semver.org/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.3.1] - 2026-10-03
10
+
11
+ ### Changed
12
+
13
+ - With auto-exit on, a delegate whose run ends on a usage-limit error now
14
+ closes its window, as after a normal completion. The parent still gets the
15
+ `failed` reply and the session file stays. Other failures still leave the
16
+ window open. `test/harness.test.ts` now fails its run with a `400` instead
17
+ of a `429`, since a `429` is a usage limit and now exits.
18
+
9
19
  ## [0.3.0] - 2026-10-03
10
20
 
11
21
  ### Added
@@ -138,7 +148,8 @@ author's dotfiles; the changes below are against that copy.
138
148
 
139
149
  - The published file list includes `child.ts`, which `index.ts` imports.
140
150
 
141
- [Unreleased]: https://github.com/gvanderclay/pi-squire/compare/v0.3.0...HEAD
151
+ [Unreleased]: https://github.com/gvanderclay/pi-squire/compare/v0.3.1...HEAD
152
+ [0.3.1]: https://github.com/gvanderclay/pi-squire/compare/v0.3.0...v0.3.1
142
153
  [0.3.0]: https://github.com/gvanderclay/pi-squire/compare/v0.2.2...v0.3.0
143
154
  [0.2.2]: https://github.com/gvanderclay/pi-squire/compare/v0.2.1...v0.2.2
144
155
  [0.2.1]: https://github.com/gvanderclay/pi-squire/compare/v0.2.0...v0.2.1
package/README.md CHANGED
@@ -353,7 +353,9 @@ The parent resolves each delegation's auto-exit from the call
353
353
  down (`ctx.shutdown()`) on the next event-loop turn, after the settle
354
354
  reply has been sent, so its tmux window closes. The session file stays, and
355
355
  `pi --session <path>` reopens it.
356
- - A run that ended stopped or failed never exits the delegate.
356
+ - A run that ended stopped, or failed on anything but a usage limit, never
357
+ exits the delegate. A usage-limit failure is final until the quota resets,
358
+ so it exits like a normal completion; the parent still gets the failed reply.
357
359
  - The user taking over turns it off for the rest of the session, with a
358
360
  notice: typed or RPC input, or a run the user stopped (Esc).
359
361
  - `/auto-exit` inside the delegate turns it on again for the next normal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-squire",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Starts a delegate Pi session in a background tmux window, sends it the task over message:*, and shows the parent its result",
5
5
  "keywords": [
6
6
  "pi-package",
package/src/child.ts CHANGED
@@ -17,7 +17,7 @@
17
17
  // ponytail: drop the takeover once #5581 lands and the minimum Pi has it.
18
18
  import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
19
19
 
20
- import { type Response, recordLimit } from "./limits.ts";
20
+ import { classify, type Response, recordLimit } from "./limits.ts";
21
21
 
22
22
  /** The launch variable that carries the parent's resolved setting. */
23
23
  export const AUTO_EXIT_ENV = "PI_DELEGATE_AUTO_EXIT";
@@ -99,7 +99,9 @@ export function registerChild(pi: ExtensionAPI, parent: string): void {
99
99
  const stopped = last?.stopReason === "aborted" || ctx.signal?.aborted === true;
100
100
  if (stopped) disarm(ctx);
101
101
  if (!stopped && last?.stopReason === "error") recordUsageLimit(last, ctx, response);
102
- completed = !stopped && last?.stopReason !== "error";
102
+ // A usage limit is final until the quota resets, so it ends the work like a completion.
103
+ const limited = typeof last?.errorMessage === "string" && classify(last.errorMessage) !== undefined;
104
+ completed = !stopped && (last?.stopReason !== "error" || limited);
103
105
  });
104
106
 
105
107
  pi.on("agent_settled", async (_event, ctx) => {