@juanbenjumea/pi-agy 0.5.9 → 0.6.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 +10 -0
- package/README.md +6 -1
- package/extensions/commands.ts +3 -13
- package/extensions/index.ts +52 -1
- package/extensions/lib/execute.ts +3 -1
- package/extensions/lib/output.ts +12 -0
- package/extensions/lib/sessions.ts +22 -3
- package/package.json +1 -1
- package/skills/agy/SKILL.md +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.1
|
|
4
|
+
|
|
5
|
+
- Supersede 0.6.0, whose publish run failed: a fixed 300 ms abort in two delivery-vs-cancellation tests raced preflight on slow CI runners (the abort must land after the result arrives). The cancels are now event-driven (fired when the SUCCESS progress arrives, i.e. strictly after delivery) and tight budget margins widened 6×.
|
|
6
|
+
|
|
7
|
+
## 0.6.0
|
|
8
|
+
|
|
9
|
+
- New `agy_history` tool: list recorded agy conversations for a working directory (ids, models, ages, task summaries) so agents can discover and resume past work without remembering ids; read-only, no model turn spent.
|
|
10
|
+
- Record a one-line task summary (collapsed first ~80 chars of the prompt) with every saved conversation — surfaced in `agy_history` and the `/agy sessions` picker; stored locally, backward compatible with existing stores.
|
|
11
|
+
- `getHistory` normalizes entries (drops malformed fields, keeps only known ones).
|
|
12
|
+
|
|
3
13
|
## 0.5.9
|
|
4
14
|
|
|
5
15
|
- Parse the real agy 1.2.6 `/usage` schema (`command.data.groups[].buckets[]`): usage groups carry the model family in `name`, which the quota reader now honors — live runs previously fell back to dumping the raw JSON envelope and reported `quota_status: unknown`. Found by an end-to-end run against the real CLI.
|
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ Requires Node.js >= 20.3.
|
|
|
18
18
|
|---------|----------|-----------|
|
|
19
19
|
| Live progress | Final text only | `stream-json` → Pi `onUpdate` cards |
|
|
20
20
|
| Model aliases | Hardcoded ids | Live `agy models` catalog (newest stable generation wins; preview/experimental ignored), static map fallback |
|
|
21
|
-
| Conversation resume | None | `conversation_id`, `continue`, session store, `/agy sessions` picker — runs that time out or are cancelled are recorded too |
|
|
21
|
+
| Conversation resume | None | `conversation_id`, `continue`, session store with task summaries, `/agy sessions` picker, `agy_history` discovery tool — runs that time out or are cancelled are recorded too |
|
|
22
22
|
| Verify injection | `npm test` only | `just ci` first, then `npm test`/`uv run pytest` |
|
|
23
23
|
| Post-write summary | None | Appends `git diff --stat` for newly-dirty files only; pre-existing dirt (including renames and unstaged edits) is listed separately and never misattributed |
|
|
24
24
|
| Preflight | Every call | Health/model checks cached 5 min per process; model quotas refresh every minute |
|
|
@@ -69,6 +69,11 @@ headless `/usage` continue without failing the task. The extension requires
|
|
|
69
69
|
agy 1.1.11+ before invoking `/usage`; older versions are refused safely because
|
|
70
70
|
that command could otherwise consume model quota as a prompt.
|
|
71
71
|
|
|
72
|
+
The `agy_history` tool lists recorded conversations for a directory — ids,
|
|
73
|
+
models, ages, and one-line task summaries — so agents can find a
|
|
74
|
+
`conversation_id` to resume; `/agy sessions` offers the same in the TUI
|
|
75
|
+
picker. Summaries are stored locally (first ~80 chars of each prompt).
|
|
76
|
+
|
|
72
77
|
## Human-callable `/agy` command
|
|
73
78
|
|
|
74
79
|
Run agy directly from the Pi TUI — fast path when fully specified, wizard otherwise:
|
package/extensions/commands.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
type AgyModel,
|
|
9
9
|
} from "./lib/cli.js";
|
|
10
10
|
import { executeAgyTask } from "./lib/execute.js";
|
|
11
|
-
import { truncate } from "./lib/output.js";
|
|
11
|
+
import { describeWhen, truncate } from "./lib/output.js";
|
|
12
12
|
import { describePreRunDirt } from "./lib/postflight.js";
|
|
13
13
|
import { getHistory, getSession } from "./lib/sessions.js";
|
|
14
14
|
|
|
@@ -263,7 +263,8 @@ async function runSessionsPicker(ctx: ExtensionCommandContext): Promise<void> {
|
|
|
263
263
|
const options = history.map((entry, index) => {
|
|
264
264
|
const id = entry.conversation_id.slice(0, 8);
|
|
265
265
|
const model = entry.model ?? "unknown model";
|
|
266
|
-
|
|
266
|
+
const summary = entry.summary ? `${entry.summary.slice(0, 50)} · ` : "";
|
|
267
|
+
return `${index + 1}. ${summary}${model} · ${describeWhen(entry.updated_at)} · ${id}…`;
|
|
267
268
|
});
|
|
268
269
|
const pick = await ctx.ui.select("resume agy conversation", options);
|
|
269
270
|
if (!pick) {
|
|
@@ -382,17 +383,6 @@ function createStatusThrottler(ctx: ExtensionCommandContext, intervalMs = 300) {
|
|
|
382
383
|
};
|
|
383
384
|
}
|
|
384
385
|
|
|
385
|
-
function describeWhen(iso: string): string {
|
|
386
|
-
const ms = Date.now() - Date.parse(iso);
|
|
387
|
-
if (!Number.isFinite(ms)) return "unknown age";
|
|
388
|
-
const minutes = Math.round(ms / 60_000);
|
|
389
|
-
if (minutes < 1) return "just now";
|
|
390
|
-
if (minutes < 60) return `${minutes}m ago`;
|
|
391
|
-
const hours = Math.round(minutes / 60);
|
|
392
|
-
if (hours < 24) return `${hours}h ago`;
|
|
393
|
-
return `${Math.round(hours / 24)}d ago`;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
386
|
function optionKey(option: string): string {
|
|
397
387
|
return option.split(" — ")[0];
|
|
398
388
|
}
|
package/extensions/index.ts
CHANGED
|
@@ -19,7 +19,8 @@ import {
|
|
|
19
19
|
validateAgyExecutionOptions,
|
|
20
20
|
type AgyMode,
|
|
21
21
|
} from "./lib/execute.js";
|
|
22
|
-
import { truncate } from "./lib/output.js";
|
|
22
|
+
import { describeWhen, truncate } from "./lib/output.js";
|
|
23
|
+
import { getHistory } from "./lib/sessions.js";
|
|
23
24
|
|
|
24
25
|
const DEFAULT_TIMEOUT_MS = 300_000;
|
|
25
26
|
const MAX_TIMEOUT_MS = 600_000;
|
|
@@ -195,6 +196,56 @@ export default function piAgyExtension(pi: ExtensionAPI) {
|
|
|
195
196
|
},
|
|
196
197
|
});
|
|
197
198
|
|
|
199
|
+
pi.registerTool({
|
|
200
|
+
name: "agy_history",
|
|
201
|
+
label: "Antigravity Conversations",
|
|
202
|
+
description:
|
|
203
|
+
"List recorded agy conversations for a working directory (most recent first) with ids, models, ages, and task summaries — find a conversation_id to resume with agy_execute. Read-only; no model turn is spent.",
|
|
204
|
+
promptSnippet: "List recorded agy conversations before resuming one",
|
|
205
|
+
parameters: Type.Object({
|
|
206
|
+
dir: Type.Optional(
|
|
207
|
+
Type.String({
|
|
208
|
+
description: "Working directory. Defaults to current project root.",
|
|
209
|
+
}),
|
|
210
|
+
),
|
|
211
|
+
limit: Type.Optional(
|
|
212
|
+
Type.Number({
|
|
213
|
+
description: "Maximum conversations to list (default 10).",
|
|
214
|
+
minimum: 1,
|
|
215
|
+
maximum: 10,
|
|
216
|
+
default: 10,
|
|
217
|
+
}),
|
|
218
|
+
),
|
|
219
|
+
}),
|
|
220
|
+
|
|
221
|
+
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
222
|
+
const cwd = params.dir ? path.resolve(ctx.cwd, params.dir) : ctx.cwd;
|
|
223
|
+
const history = await getHistory(cwd);
|
|
224
|
+
const limited = history.slice(0, params.limit ?? 10);
|
|
225
|
+
if (limited.length === 0) {
|
|
226
|
+
return {
|
|
227
|
+
content: [{
|
|
228
|
+
type: "text",
|
|
229
|
+
text: `No agy conversations are recorded for ${cwd} yet. They are recorded automatically when agy_execute completes or is interrupted with a conversation id.`,
|
|
230
|
+
}],
|
|
231
|
+
details: { dir: cwd, conversations: [] },
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
const lines = limited.map((entry, index) => {
|
|
235
|
+
const model = entry.model ?? "unknown model";
|
|
236
|
+
const summary = entry.summary ? ` · ${entry.summary}` : "";
|
|
237
|
+
return `${index + 1}. ${entry.conversation_id} · ${model} · ${describeWhen(entry.updated_at)}${summary}`;
|
|
238
|
+
});
|
|
239
|
+
const text =
|
|
240
|
+
`agy conversations for ${cwd} (most recent first):\n${lines.join("\n")}\n\n` +
|
|
241
|
+
"Resume with agy_execute conversation_id=<id>, or continue=true for the most recent.";
|
|
242
|
+
return {
|
|
243
|
+
content: [{ type: "text", text }],
|
|
244
|
+
details: { dir: cwd, conversations: limited },
|
|
245
|
+
};
|
|
246
|
+
},
|
|
247
|
+
});
|
|
248
|
+
|
|
198
249
|
pi.registerTool({
|
|
199
250
|
name: "agy_usage",
|
|
200
251
|
label: "Antigravity Quota",
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
type GitBaseline,
|
|
25
25
|
} from "./postflight.js";
|
|
26
26
|
import { runPreflight } from "./preflight.js";
|
|
27
|
-
import { getSession, saveSession } from "./sessions.js";
|
|
27
|
+
import { getSession, saveSession, conversationSummary } from "./sessions.js";
|
|
28
28
|
|
|
29
29
|
export type AgyMode = "plan" | "accept-edits" | "sandbox";
|
|
30
30
|
|
|
@@ -192,6 +192,7 @@ export async function executeAgyTask(
|
|
|
192
192
|
run.conversation_id,
|
|
193
193
|
effectiveModel,
|
|
194
194
|
AbortSignal.timeout(10_000),
|
|
195
|
+
conversationSummary(options.prompt),
|
|
195
196
|
);
|
|
196
197
|
} catch (error) {
|
|
197
198
|
const reason = error instanceof Error ? error.message : String(error);
|
|
@@ -260,6 +261,7 @@ export async function executeAgyTask(
|
|
|
260
261
|
conversationId,
|
|
261
262
|
effectiveModel,
|
|
262
263
|
AbortSignal.timeout(10_000),
|
|
264
|
+
conversationSummary(options.prompt),
|
|
263
265
|
);
|
|
264
266
|
} catch {
|
|
265
267
|
// Preserve the original agy failure; session persistence is best effort.
|
package/extensions/lib/output.ts
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
const DEFAULT_MAX_OUTPUT_CHARS = 8000;
|
|
2
2
|
|
|
3
|
+
/** Human-facing relative age for an ISO timestamp ("5m ago", "2h ago", …). */
|
|
4
|
+
export function describeWhen(iso: string): string {
|
|
5
|
+
const ms = Date.now() - Date.parse(iso);
|
|
6
|
+
if (!Number.isFinite(ms)) return "unknown age";
|
|
7
|
+
const minutes = Math.round(ms / 60_000);
|
|
8
|
+
if (minutes < 1) return "just now";
|
|
9
|
+
if (minutes < 60) return `${minutes}m ago`;
|
|
10
|
+
const hours = Math.round(minutes / 60);
|
|
11
|
+
if (hours < 24) return `${hours}h ago`;
|
|
12
|
+
return `${Math.round(hours / 24)}d ago`;
|
|
13
|
+
}
|
|
14
|
+
|
|
3
15
|
export function truncate(text: string, max = DEFAULT_MAX_OUTPUT_CHARS): string {
|
|
4
16
|
if (text.length <= max) return text;
|
|
5
17
|
if (max <= 0) return "";
|
|
@@ -17,6 +17,8 @@ export interface AgyConversationEntry {
|
|
|
17
17
|
conversation_id: string;
|
|
18
18
|
model?: string;
|
|
19
19
|
updated_at: string;
|
|
20
|
+
/** Short task excerpt so humans and agents can tell conversations apart. */
|
|
21
|
+
summary?: string;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
export interface AgySessionRecord {
|
|
@@ -66,9 +68,16 @@ export interface AgySessionStore {
|
|
|
66
68
|
conversationId: string,
|
|
67
69
|
model?: string,
|
|
68
70
|
signal?: AbortSignal,
|
|
71
|
+
summary?: string,
|
|
69
72
|
): Promise<void>;
|
|
70
73
|
}
|
|
71
74
|
|
|
75
|
+
/** Collapse a prompt into a short one-line task summary. */
|
|
76
|
+
export function conversationSummary(prompt: string, max = 80): string {
|
|
77
|
+
const collapsed = prompt.trim().replace(/\s+/g, " ");
|
|
78
|
+
return collapsed.length > max ? collapsed.slice(0, max) + "…" : collapsed;
|
|
79
|
+
}
|
|
80
|
+
|
|
72
81
|
/**
|
|
73
82
|
* Create a session store. The optional path (string or lazy resolver) makes
|
|
74
83
|
* persistence testable; the lazy form re-reads `PI_CODING_AGENT_DIR` on each
|
|
@@ -145,7 +154,15 @@ export function createSessionStore(
|
|
|
145
154
|
typeof entry.conversation_id === "string" &&
|
|
146
155
|
typeof entry.updated_at === "string",
|
|
147
156
|
)
|
|
148
|
-
.
|
|
157
|
+
.map((entry) => {
|
|
158
|
+
const normalized: AgyConversationEntry = {
|
|
159
|
+
conversation_id: entry.conversation_id,
|
|
160
|
+
updated_at: entry.updated_at,
|
|
161
|
+
};
|
|
162
|
+
if (typeof entry.model === "string") normalized.model = entry.model;
|
|
163
|
+
if (typeof entry.summary === "string") normalized.summary = entry.summary;
|
|
164
|
+
return normalized;
|
|
165
|
+
})
|
|
149
166
|
: [];
|
|
150
167
|
}
|
|
151
168
|
|
|
@@ -227,6 +244,7 @@ export function createSessionStore(
|
|
|
227
244
|
conversationId: string,
|
|
228
245
|
model?: string,
|
|
229
246
|
signal?: AbortSignal,
|
|
247
|
+
summary?: string,
|
|
230
248
|
): Promise<void> {
|
|
231
249
|
const operation = waitForMutation(signal).then(() =>
|
|
232
250
|
withStoreLock(async () => {
|
|
@@ -239,7 +257,7 @@ export function createSessionStore(
|
|
|
239
257
|
last_model: model,
|
|
240
258
|
updated_at: updatedAt,
|
|
241
259
|
history: [
|
|
242
|
-
{ conversation_id: conversationId, model, updated_at: updatedAt },
|
|
260
|
+
{ conversation_id: conversationId, model, updated_at: updatedAt, summary },
|
|
243
261
|
...(Array.isArray(record.history) ? record.history : []).filter(
|
|
244
262
|
(entry) =>
|
|
245
263
|
entry &&
|
|
@@ -276,6 +294,7 @@ export function saveSession(
|
|
|
276
294
|
conversationId: string,
|
|
277
295
|
model?: string,
|
|
278
296
|
signal?: AbortSignal,
|
|
297
|
+
summary?: string,
|
|
279
298
|
): Promise<void> {
|
|
280
|
-
return defaultStore.saveSession(dir, conversationId, model, signal);
|
|
299
|
+
return defaultStore.saveSession(dir, conversationId, model, signal, summary);
|
|
281
300
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juanbenjumea/pi-agy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Enhanced Antigravity CLI (agy) bridge for Pi — streaming progress, conversation continuity, repo-aware verify, and diff summaries.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/skills/agy/SKILL.md
CHANGED
|
@@ -42,6 +42,7 @@ agy_execute prompt="Generate exhaustive unit tests for src/auth/" model=flash-lo
|
|
|
42
42
|
agy_execute prompt="Plan the migration to ESM" model=sonnet mode=plan digest=true
|
|
43
43
|
agy_execute prompt="Implement the approved plan" conversation_id=<id> mode=accept-edits
|
|
44
44
|
agy_execute prompt="Adversarial review the diff" model=opus effort=high mode=plan
|
|
45
|
+
agy_history
|
|
45
46
|
agy_usage
|
|
46
47
|
```
|
|
47
48
|
|
|
@@ -72,7 +73,7 @@ agy_usage
|
|
|
72
73
|
|
|
73
74
|
- **Quota discovery** — `agy_usage` and `/agy usage` report model-specific remaining quota and reset times; executions refresh quota snapshots and return machine-readable `quota_status` as well.
|
|
74
75
|
- **Streaming progress** — live tool steps via `stream-json` and Pi `onUpdate`.
|
|
75
|
-
- **Conversation continuity** — `conversation_id`, `continue`, session store under `$PI_CODING_AGENT_DIR/agy-sessions.json` (or `~/.pi/agent/agy-sessions.json` by default); runs that time out or are cancelled are recorded too and stay resumable.
|
|
76
|
+
- **Conversation continuity** — `conversation_id`, `continue`, session store under `$PI_CODING_AGENT_DIR/agy-sessions.json` (or `~/.pi/agent/agy-sessions.json` by default) with one-line task summaries; runs that time out or are cancelled are recorded too and stay resumable, and the `agy_history` tool lets agents list past conversations.
|
|
76
77
|
- **Repo-aware verify** — prefers `just ci` when a justfile defines `ci:`.
|
|
77
78
|
- **Diff summary** — accept-edits results append newly-dirty files only; pre-existing dirt is listed separately, never misattributed.
|
|
78
79
|
- **Per-directory lock** — serializes concurrent agy calls on the same tree across Pi processes (symlink-aware).
|