@juanbenjumea/pi-agy 0.6.7 → 0.6.8

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
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.8
4
+
5
+ - Keep agy's internal `--print-timeout` five seconds behind Pi's hard parent deadline. agy 1.1.28+ returns partial output with exit code 0 when its own timeout fires, so Pi must win the race to classify the run as timed out and preserve resumable-conversation guidance.
6
+ - Recognize agy 1.2.6+ structured `AGY_ERROR` records with a top-level `retryable` boolean while retaining legacy status-text matching. Strict whole-line JSON parsing rejects malformed and user-controlled lookalikes, and canonical `retryable: false` overrides legacy patterns such as `429`.
7
+ - Add `npm run test:live`, an opt-in, zero-inference smoke for the installed CLI version, stable model aliases, custom-agent roster, quota schema, and doctor integration; refresh compile/test dependencies to Pi 0.86.1.
8
+ - Make CI and releases deterministic with `npm ci`, clean-tree and package checks, and isolate npm OIDC permissions in a publish-only job that runs only after unprivileged verification succeeds.
9
+
3
10
  ## 0.6.7
4
11
 
5
12
  - Add custom-agent discovery health to `/agy doctor` using the same bounded, read-only `agy agents` path as `agy_agents` and `/agy agents`.
package/README.md CHANGED
@@ -42,7 +42,9 @@ Auth is unchanged: existing `agy` OAuth (`~/.gemini/oauth_creds.json`).
42
42
  `timeout_ms` (default 5m, max 10m) is a hard parent-side deadline — lock
43
43
  waits, preflight probes, and post-run summaries all count against it. When
44
44
  it fires, the full agy process group is killed so nested tools cannot
45
- outlive the run.
45
+ outlive the run. agy's own `--print-timeout` is set five seconds later because
46
+ agy 1.1.28+ returns partial output with exit code 0 when that internal timer
47
+ fires; Pi therefore remains the authoritative timeout owner.
46
48
 
47
49
  Active tool updates show bounded intent (for example a tool action or async
48
50
  threshold) but never echo full command lines, which may contain secrets.
@@ -207,6 +209,11 @@ npm test
207
209
  npm run typecheck
208
210
  ```
209
211
 
212
+ With an installed, authenticated `agy`, run `npm run test:live` to verify the
213
+ CLI version, stable model catalog, custom-agent roster, quota schema, and doctor
214
+ integration against the real binary. The smoke uses read-only commands only and
215
+ does not start an inference turn or spend model tokens.
216
+
210
217
  ## License
211
218
 
212
219
  MIT
@@ -90,6 +90,10 @@ export interface AgyOptions {
90
90
  }
91
91
 
92
92
  const PREFLIGHT_TIMEOUT_MS = 10_000;
93
+ // agy >= 1.1.28 returns partial output with exit 0 when its own print timeout
94
+ // fires. Keep that timeout behind Pi's hard parent deadline (and its 2s kill
95
+ // escalation) so a timed-out partial response can never be reported as success.
96
+ const PRINT_TIMEOUT_BUFFER_MS = 5_000;
93
97
  // Raw stdout capture bound; only the non-streaming/parse-failure fallback —
94
98
  // the stream-json path accumulates results incrementally and is not capped by
95
99
  // it. Large enough that plain-text fallbacks rarely truncate.
@@ -236,9 +240,29 @@ export function supportsAgyEffort(model?: AgyModel, tier?: AgyOptions["tier"]):
236
240
  const TRANSIENT_FAILURE_PATTERN =
237
241
  /rate.?limit|resource[_ -]?exhausted|429|overloaded|temporarily unavailable|network|connection (reset|refused)|econnreset|etimedout|socket hang up|\b50[023]\b/i;
238
242
 
243
+ function parseStructuredRetryability(message: string): boolean | undefined {
244
+ for (const line of message.split(/\r?\n/)) {
245
+ const match = line.match(/^\s*AGY_ERROR:\s*(\{.*\})\s*$/);
246
+ if (!match) continue;
247
+ try {
248
+ const parsed: unknown = JSON.parse(match[1]);
249
+ if (
250
+ typeof parsed === "object" &&
251
+ parsed !== null &&
252
+ typeof (parsed as { retryable?: unknown }).retryable === "boolean"
253
+ ) {
254
+ return (parsed as { retryable: boolean }).retryable;
255
+ }
256
+ } catch {
257
+ // Malformed structured diagnostics fall back to legacy text matching.
258
+ }
259
+ }
260
+ return undefined;
261
+ }
262
+
239
263
  /** Heuristic for transient agy failures that are safe to retry once. */
240
264
  export function isTransientAgyFailure(message: string): boolean {
241
- return TRANSIENT_FAILURE_PATTERN.test(message);
265
+ return parseStructuredRetryability(message) ?? TRANSIENT_FAILURE_PATTERN.test(message);
242
266
  }
243
267
 
244
268
  const MAX_AGENT_NAME_LENGTH = 128;
@@ -294,7 +318,7 @@ export function buildAgyArgs(options: AgyOptions): string[] {
294
318
 
295
319
  const model = resolveAgyModelId(options.model, options.tier);
296
320
  const agent = normalizeAgyAgentName(options.agent);
297
- const timeoutSec = Math.ceil(options.timeout_ms / 1000);
321
+ const timeoutSec = Math.ceil((options.timeout_ms + PRINT_TIMEOUT_BUFFER_MS) / 1000);
298
322
  const mode = options.mode ?? "accept-edits";
299
323
  const writes = mode === "accept-edits";
300
324
  const skipPermissions = options.skipPermissions ?? true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juanbenjumea/pi-agy",
3
- "version": "0.6.7",
3
+ "version": "0.6.8",
4
4
  "description": "Reliable Antigravity delegation for Pi — quota-aware runs, resumable tasks, repo verification, cancellation, and trustworthy diff summaries.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -25,6 +25,7 @@
25
25
  "homepage": "https://github.com/huaxel/pi-agy#readme",
26
26
  "scripts": {
27
27
  "test": "node --import ./tests/resolve-hook.mjs --test tests/*.test.ts",
28
+ "test:live": "node --import ./tests/resolve-hook.mjs tests/live-smoke.ts",
28
29
  "typecheck": "tsc --noEmit --pretty false",
29
30
  "pack:check": "npm pack --dry-run --json"
30
31
  },
@@ -49,9 +50,10 @@
49
50
  "@sinclair/typebox": "*"
50
51
  },
51
52
  "devDependencies": {
52
- "@earendil-works/pi-tui": "^0.85.1",
53
+ "@earendil-works/pi-coding-agent": "^0.86.1",
54
+ "@earendil-works/pi-tui": "^0.86.1",
53
55
  "@sinclair/typebox": "^0.34.41",
54
- "@types/node": "^22.0.0",
56
+ "@types/node": "^22.20.4",
55
57
  "typescript": "^5.0.0"
56
58
  },
57
59
  "engines": {