@juanbenjumea/pi-agy 0.6.3 → 0.6.4

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.4
4
+
5
+ - Add bounded active-tool progress details from agy's existing stream (`TargetFile`, task id, human-facing action/summary, and async threshold) while deliberately never exposing full `CommandLine` values that may contain secrets.
6
+ - Strip ANSI CSI/OSC sequences, ASCII/C1 controls, and Unicode bidi controls from streamed tool names and progress details before rendering.
7
+ - Make timeout recovery guidance truthful: successfully persisted conversation ids point to `conversation_id`, `/agy continue`, and `/agy sessions`; observed-only ids fall back to explicit `conversation_id` when the local session store could not be written.
8
+ - Document and preserve the bounded execution invariant: background tasks are not detached because agy 1.2.7 exposes no reliable headless lifecycle or task-to-process ownership; timeout/cancellation continues to kill the full process tree before releasing the workspace lock.
9
+
3
10
  ## 0.6.3
4
11
 
5
12
  - Add `/agy doctor` diagnostics for the CLI/version, stable model discovery, quota health, config validation, session-store corruption, active/stale workspace locks, and the repository verification gate; add `/agy usage [model]` for direct quota inspection.
package/README.md CHANGED
@@ -42,6 +42,13 @@ waits, preflight probes, and post-run summaries all count against it. When
42
42
  it fires, the full agy process group is killed so nested tools cannot
43
43
  outlive the run.
44
44
 
45
+ Active tool updates show bounded intent (for example a tool action or async
46
+ threshold) but never echo full command lines, which may contain secrets.
47
+ Background commands are intentionally not detached or managed out-of-band:
48
+ agy exposes no reliable headless task lifecycle or task-to-process ownership,
49
+ so timeout/cancellation still kills the full process tree and prevents work from
50
+ continuing after the directory lock is released.
51
+
45
52
  The deadline never discards finished work:
46
53
 
47
54
  - A response that fully arrived before the kill is returned with an
@@ -51,6 +58,9 @@ The deadline never discards finished work:
51
58
  are skipped with a note rather than failing the run.
52
59
  - The conversation id is recorded on timeout and cancellation, so the run
53
60
  stays resumable via `conversation_id`, `/agy continue`, or `/agy sessions`.
61
+ Timeout errors distinguish ids successfully recorded for `/agy continue` or
62
+ `/agy sessions` from ids merely observed when local persistence failed; the
63
+ latter can still be resumed by passing `conversation_id` explicitly.
54
64
 
55
65
  ## Tool params (new)
56
66
 
@@ -272,6 +272,7 @@ export async function executeAgyTask(
272
272
  );
273
273
  } catch (error) {
274
274
  const conversationId = getAgyConversationId(error);
275
+ let conversationPersisted = false;
275
276
  if (conversationId) {
276
277
  try {
277
278
  // The composed signal is aborted in exactly the cases this save
@@ -285,12 +286,18 @@ export async function executeAgyTask(
285
286
  AbortSignal.timeout(10_000),
286
287
  conversationSummary(options.prompt),
287
288
  );
289
+ conversationPersisted = true;
288
290
  } catch {
289
291
  // Preserve the original agy failure; session persistence is best effort.
290
292
  }
291
293
  }
292
294
  if (budgetController.signal.aborted && !signal?.aborted) {
293
- throw new Error(`agy timed out after ${options.timeout_ms}ms`);
295
+ const resume = conversationId
296
+ ? conversationPersisted
297
+ ? `; conversation ${JSON.stringify(conversationId.slice(0, 128))} was recorded — resume with conversation_id, /agy continue, or /agy sessions`
298
+ : `; conversation ${JSON.stringify(conversationId.slice(0, 128))} was observed — resume with conversation_id`
299
+ : "";
300
+ throw new Error(`agy timed out after ${options.timeout_ms}ms${resume}`);
294
301
  }
295
302
  throw error;
296
303
  } finally {
@@ -1,3 +1,5 @@
1
+ import { stripTerminalSequences } from "@earendil-works/pi-tui";
2
+
1
3
  export interface AgyUsage {
2
4
  input_tokens?: number;
3
5
  output_tokens?: number;
@@ -70,6 +72,25 @@ export function parseStreamLine(line: string): AgyStreamLine | null {
70
72
  }
71
73
  }
72
74
 
75
+ function compactProgressValue(value: unknown, max = 120): string | undefined {
76
+ if (typeof value !== "string") return undefined;
77
+ const compact = stripTerminalSequences(value)
78
+ .replace(/[\u0000-\u001f\u007f-\u009f\u200e\u200f\u202a-\u202e\u2066-\u2069]+/g, " ")
79
+ .replace(/\s+/g, " ")
80
+ .trim();
81
+ if (!compact) return undefined;
82
+ return compact.length > max ? compact.slice(0, max - 1) + "…" : compact;
83
+ }
84
+
85
+ function formatAsyncThreshold(value: unknown): string | undefined {
86
+ if (typeof value !== "number" || !Number.isFinite(value) || value < 0) return undefined;
87
+ if (value >= 1_000) {
88
+ const seconds = value / 1_000;
89
+ return `${Number.isInteger(seconds) ? seconds : seconds.toFixed(1)}s`;
90
+ }
91
+ return `${value}ms`;
92
+ }
93
+
73
94
  export function formatStepProgress(parsed: AgyStreamLine): string | null {
74
95
  if (parsed.event === "init") {
75
96
  const model = parsed.init?.model ?? "agy";
@@ -88,9 +109,24 @@ export function formatStepProgress(parsed: AgyStreamLine): string | null {
88
109
  if (!step) return null;
89
110
 
90
111
  if (step.step_type === "tool" && step.state === "ACTIVE") {
91
- const name = step.tool_name ?? step.tool_info?.name ?? "tool";
92
- const target = step.tool_info?.parameters?.TargetFile;
93
- return target ? `▸ ${name} → ${String(target)}` : `▸ ${name}`;
112
+ const name =
113
+ compactProgressValue(step.tool_name ?? step.tool_info?.name, 40) ?? "tool";
114
+ const parameters = step.tool_info?.parameters;
115
+ const target = compactProgressValue(parameters?.TargetFile);
116
+ const action =
117
+ compactProgressValue(parameters?.toolAction) ??
118
+ compactProgressValue(parameters?.toolSummary);
119
+ const taskId = compactProgressValue(parameters?.TaskId, 60);
120
+ const asyncThreshold = formatAsyncThreshold(parameters?.WaitMsBeforeAsync);
121
+ const detail = target
122
+ ? ` → ${target}`
123
+ : taskId
124
+ ? ` → task ${taskId}${action ? ` — ${action}` : ""}`
125
+ : action
126
+ ? ` — ${action}`
127
+ : "";
128
+ const asyncNote = asyncThreshold ? ` · async threshold ${asyncThreshold}` : "";
129
+ return `▸ ${name}${detail}${asyncNote}`;
94
130
  }
95
131
 
96
132
  if (step.step_type === "agent_response" && step.text_delta) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juanbenjumea/pi-agy",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
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",
@@ -60,7 +60,7 @@ agy_usage
60
60
  - **Default to `mode=plan`** for exploration; escalate to `accept-edits` only for scoped batches.
61
61
  - **Always review the `git diff`** after agy runs with `accept-edits`.
62
62
  - **Run `just ci`** (or the project gate) after write modes in this repo.
63
- - **Never use agy for irreversible production changes.**
63
+ - **Never use agy for irreversible production changes or persistent background servers/watchers.** Delegations are bounded; timeout/cancellation kills the full process tree rather than releasing unowned work.
64
64
  - Reuse `conversation_id` or `continue=true` for multi-step plan → implement → review.
65
65
  - Keep `context=none` (default) unless the task depends on prior Pi discussion; prefer `summary` over `recent` to minimize disclosure. Context handoff excludes system prompts, thinking, tool arguments/results, images, and custom messages.
66
66
  - Use `flash-medium` by default, `flash-low` for trivial/high-volume work, and `flash-high` for difficult agentic work.