@hheei/pi-subagents 0.5.0 → 0.5.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/dist/host-adapter.d.ts +2 -0
- package/dist/host-adapter.js +10 -1
- package/dist/runtime.js +12 -1
- package/package.json +1 -1
package/dist/host-adapter.d.ts
CHANGED
|
@@ -36,6 +36,8 @@ export interface HostObservation {
|
|
|
36
36
|
readonly identity: HostAttachmentIdentity;
|
|
37
37
|
readonly alive: boolean;
|
|
38
38
|
readonly known: boolean;
|
|
39
|
+
/** True when the underlying host container (tab, pane, or surface) no longer exists. */
|
|
40
|
+
readonly containerGone?: boolean;
|
|
39
41
|
/**
|
|
40
42
|
* Whether a human is looking at this panel. Absent when the host cannot say, which includes
|
|
41
43
|
* both hosts without the capability and a lookup that failed just now; the caller must treat
|
package/dist/host-adapter.js
CHANGED
|
@@ -138,10 +138,13 @@ export function createHerdrHostAdapter(options) {
|
|
|
138
138
|
const listed = herdrListingSucceeded(tabs) && herdrListingSucceeded(workspaces)
|
|
139
139
|
? herdrPanelFocused(tabs.stdout, workspaces.stdout, target.tabId)
|
|
140
140
|
: undefined;
|
|
141
|
+
const code = herdrErrorCode(process.stderr) ?? herdrErrorCode(process.stdout);
|
|
142
|
+
const containerGone = code === "pane_not_found" || code === "tab_not_found";
|
|
141
143
|
const alive = herdrPaneAlive(process);
|
|
142
144
|
return {
|
|
143
145
|
process,
|
|
144
146
|
...(alive === undefined ? {} : { alive }),
|
|
147
|
+
...(containerGone ? { containerGone: true } : {}),
|
|
145
148
|
...(listed === undefined ? {} : { focused: listed }),
|
|
146
149
|
};
|
|
147
150
|
},
|
|
@@ -187,7 +190,12 @@ export function createCmuxHostAdapter(options) {
|
|
|
187
190
|
const process = await runner.run("cmux", ["--json", "list-panels"], { timeoutMs });
|
|
188
191
|
if (process.timedOut || process.exitCode !== 0)
|
|
189
192
|
return { process };
|
|
190
|
-
|
|
193
|
+
const alive = containsString(process.stdout, attachmentId);
|
|
194
|
+
return {
|
|
195
|
+
process,
|
|
196
|
+
alive,
|
|
197
|
+
...(!alive ? { containerGone: true } : {}),
|
|
198
|
+
};
|
|
191
199
|
},
|
|
192
200
|
close: () => runner.run("cmux", ["--json", "close-surface", "--surface", attachmentId], {
|
|
193
201
|
timeoutMs,
|
|
@@ -207,6 +215,7 @@ function hostAttachment(options) {
|
|
|
207
215
|
// the caller drop the panel and the runtime evidence, so it is only ever said on purpose.
|
|
208
216
|
alive: result.alive === true,
|
|
209
217
|
known: result.alive !== undefined,
|
|
218
|
+
...(result.containerGone ? { containerGone: true } : {}),
|
|
210
219
|
...(focused === undefined ? {} : { focused }),
|
|
211
220
|
detail: result.process.stderr || result.process.stdout,
|
|
212
221
|
};
|
package/dist/runtime.js
CHANGED
|
@@ -154,11 +154,22 @@ export async function openChildPanel(options) {
|
|
|
154
154
|
const combinedSignal = options.signal
|
|
155
155
|
? AbortSignal.any([options.signal, earlyExitAbort.signal])
|
|
156
156
|
: earlyExitAbort.signal;
|
|
157
|
+
let childAppeared = false;
|
|
157
158
|
let earlyExitObserved;
|
|
158
159
|
const probeInterval = setInterval(async () => {
|
|
159
160
|
try {
|
|
160
161
|
const obs = await attachment.observe();
|
|
161
|
-
if (obs.known
|
|
162
|
+
if (!obs.known)
|
|
163
|
+
return;
|
|
164
|
+
if (obs.containerGone) {
|
|
165
|
+
earlyExitObserved = obs;
|
|
166
|
+
earlyExitAbort.abort();
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
if (obs.alive) {
|
|
170
|
+
childAppeared = true;
|
|
171
|
+
}
|
|
172
|
+
else if (childAppeared) {
|
|
162
173
|
earlyExitObserved = obs;
|
|
163
174
|
earlyExitAbort.abort();
|
|
164
175
|
}
|