@paigy/harness 0.3.28 → 0.3.29
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/README.md +11 -0
- package/dist/agy-acp.js +44 -8
- package/dist/cli.js +465 -242
- package/dist/main.js +4746 -4539
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# paigy-harness
|
|
2
2
|
|
|
3
|
+
Phone launches persist their selected harness and Paigy session identity with the local slot.
|
|
4
|
+
Recovery uses that runtime, never a default Claude process. Older slots need a known named
|
|
5
|
+
runtime or a Claude transcript; otherwise the host logs a missing-runtime blocker.
|
|
6
|
+
|
|
7
|
+
The Antigravity adapter reconnects once after its specific `subscriber fell behind updates`
|
|
8
|
+
failure, using the conversation ID reported by `agy`. It asks the resumed agent to inspect
|
|
9
|
+
existing results before continuing, rather than replaying the original task. Missing IDs,
|
|
10
|
+
other errors, and a failed recovery remain visible failures. Diagnostics name the conversation,
|
|
11
|
+
recovery attempt, and outcome. This mitigates the vendor stream failure; it does not repair
|
|
12
|
+
Antigravity's internal broadcaster. Keep verbose command output in files and read bounded summaries.
|
|
13
|
+
|
|
3
14
|
Runs Claude Code and Codex on your machine, mirrors every turn to your Paigy inbox, and
|
|
4
15
|
— when you ask it to — **rings your phone when an agent is blocked** (#804).
|
|
5
16
|
|
package/dist/agy-acp.js
CHANGED
|
@@ -22,6 +22,13 @@ var AgyAcp = class {
|
|
|
22
22
|
bypass = false;
|
|
23
23
|
started = false;
|
|
24
24
|
promptId;
|
|
25
|
+
conversation;
|
|
26
|
+
dropped = false;
|
|
27
|
+
retried = false;
|
|
28
|
+
/** The vendor can fail on stderr without a result frame. Never retry other failures. */
|
|
29
|
+
diagnostic(text) {
|
|
30
|
+
if (text.includes("subscriber fell behind updates")) this.dropped = true;
|
|
31
|
+
}
|
|
25
32
|
/** A frame from the harness. */
|
|
26
33
|
fromClient(msg) {
|
|
27
34
|
const out = { client: [], agy: [] };
|
|
@@ -50,6 +57,8 @@ var AgyAcp = class {
|
|
|
50
57
|
out.start = { cwd: this.cwd, args: agyArgs(this.bypass) };
|
|
51
58
|
}
|
|
52
59
|
this.promptId = msg.id;
|
|
60
|
+
this.dropped = false;
|
|
61
|
+
this.retried = false;
|
|
53
62
|
out.agy.push(JSON.stringify({ event: "user", message: { role: "user", content } }));
|
|
54
63
|
return out;
|
|
55
64
|
}
|
|
@@ -68,6 +77,10 @@ var AgyAcp = class {
|
|
|
68
77
|
return out;
|
|
69
78
|
}
|
|
70
79
|
const update = (body) => out.client.push(frame({ method: "session/update", params: { sessionId: this.sessionId, update: body } }));
|
|
80
|
+
if (ev.event === "init" && typeof ev.conversation_id === "string" && /^[0-9a-f-]{36}$/i.test(ev.conversation_id)) {
|
|
81
|
+
this.conversation = ev.conversation_id;
|
|
82
|
+
out.diagnostic = `agy conversation=${this.conversation} recovery=${this.retried ? 1 : 0} connected`;
|
|
83
|
+
}
|
|
71
84
|
if (ev.event === "step_update") {
|
|
72
85
|
const s = ev.step_update ?? {};
|
|
73
86
|
if (s.step_type === "agent_response" && typeof s.text_delta === "string" && s.text_delta) {
|
|
@@ -79,6 +92,9 @@ var AgyAcp = class {
|
|
|
79
92
|
}
|
|
80
93
|
if (ev.event === "result" && this.promptId !== void 0) {
|
|
81
94
|
const r = ev.result ?? {};
|
|
95
|
+
if (r.status !== "SUCCESS") this.diagnostic(String(r.error ?? ""));
|
|
96
|
+
if (r.status !== "SUCCESS" && this.dropped && this.conversation && !this.retried) return out;
|
|
97
|
+
if (this.retried) out.diagnostic = `agy conversation=${this.conversation} recovery=1 outcome=${r.status === "SUCCESS" ? "success" : "failed"}`;
|
|
82
98
|
const denied = Array.isArray(r.denied_actions) ? r.denied_actions : [];
|
|
83
99
|
if (denied.length) {
|
|
84
100
|
const names = denied.map((d) => d.display_name ?? d.action ?? "a tool").join(", ");
|
|
@@ -96,10 +112,20 @@ Antigravity cannot ask for permission when it runs in the background, so it was
|
|
|
96
112
|
return out;
|
|
97
113
|
}
|
|
98
114
|
/** `agy` exited: a turn still open fails by name rather than hanging the harness. */
|
|
99
|
-
exited(code) {
|
|
115
|
+
exited(code, recover = true) {
|
|
100
116
|
const out = { client: [], agy: [] };
|
|
117
|
+
if (recover && this.promptId !== void 0 && this.dropped && this.conversation && !this.retried) {
|
|
118
|
+
this.retried = true;
|
|
119
|
+
this.dropped = false;
|
|
120
|
+
out.start = { cwd: this.cwd, args: [...agyArgs(this.bypass), "--conversation", this.conversation] };
|
|
121
|
+
out.agy.push(JSON.stringify({ event: "user", message: { role: "user", content: "The update stream disconnected. Inspect this conversation and existing command results before continuing the unfinished work. Do not repeat completed actions or blindly rerun the previous command. Redirect verbose command output to a file and read only a bounded summary. If the outcome of an action is uncertain, verify it before retrying; report a blocker if you cannot do so safely." } }));
|
|
122
|
+
out.diagnostic = `agy conversation=${this.conversation} recovery=1 reason=subscriber_lag exit=${code} reconnecting`;
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
101
125
|
if (this.promptId !== void 0) {
|
|
102
|
-
|
|
126
|
+
const message = this.retried ? `Antigravity stream recovery failed for conversation ${this.conversation}; inspect its results before retrying` : `agy exited ${code ?? "by signal"}`;
|
|
127
|
+
out.client.push(frame({ id: this.promptId, error: { code: -32e3, message } }));
|
|
128
|
+
out.diagnostic = `agy conversation=${this.conversation ?? "unknown"} recovery=${this.retried ? 1 : 0} outcome=failed exit=${code}`;
|
|
103
129
|
this.promptId = void 0;
|
|
104
130
|
}
|
|
105
131
|
return out;
|
|
@@ -108,22 +134,31 @@ Antigravity cannot ask for permission when it runs in the background, so it was
|
|
|
108
134
|
function main() {
|
|
109
135
|
const adapter = new AgyAcp();
|
|
110
136
|
let agy;
|
|
137
|
+
let closed = false;
|
|
111
138
|
const apply = (out) => {
|
|
139
|
+
if (out.diagnostic) process.stderr.write(`${out.diagnostic}
|
|
140
|
+
`);
|
|
112
141
|
for (const f of out.client) process.stdout.write(`${f}
|
|
113
142
|
`);
|
|
114
143
|
if (out.start) {
|
|
115
144
|
agy = spawn("agy", out.start.args, { cwd: out.start.cwd, stdio: ["pipe", "pipe", "pipe"], env: process.env });
|
|
145
|
+
agy.stdin.on("error", () => {
|
|
146
|
+
});
|
|
116
147
|
createInterface({ input: agy.stdout }).on("line", (l) => apply(adapter.fromAgy(l)));
|
|
117
|
-
|
|
118
|
-
agy.on("
|
|
119
|
-
|
|
120
|
-
|
|
148
|
+
let diagnosticTail = "";
|
|
149
|
+
agy.stderr.on("data", (chunk) => {
|
|
150
|
+
adapter.diagnostic(diagnosticTail + String(chunk));
|
|
151
|
+
diagnosticTail = (diagnosticTail + String(chunk)).slice(-512);
|
|
152
|
+
process.stderr.write(chunk);
|
|
153
|
+
});
|
|
154
|
+
agy.on("close", (code) => {
|
|
155
|
+
const next = adapter.exited(code, !closed);
|
|
156
|
+
apply(next);
|
|
157
|
+
if (!next.start) process.stdout.write("", () => process.exit(code ?? 1));
|
|
121
158
|
});
|
|
122
159
|
agy.on("error", (e) => {
|
|
123
160
|
process.stderr.write(`agy: ${e.message}
|
|
124
161
|
`);
|
|
125
|
-
apply(adapter.exited(null));
|
|
126
|
-
process.exit(1);
|
|
127
162
|
});
|
|
128
163
|
}
|
|
129
164
|
for (const l of out.agy) agy?.stdin?.write(`${l}
|
|
@@ -135,6 +170,7 @@ function main() {
|
|
|
135
170
|
} catch {
|
|
136
171
|
}
|
|
137
172
|
}).on("close", () => {
|
|
173
|
+
closed = true;
|
|
138
174
|
agy?.stdin?.end();
|
|
139
175
|
if (!agy) process.exit(0);
|
|
140
176
|
});
|