@volter/supercode-teams 0.2.131 → 0.2.133
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/machine.mjs +15 -4
- package/package.json +1 -1
package/machine.mjs
CHANGED
|
@@ -129,6 +129,15 @@ function deadPaneExit(session) {
|
|
|
129
129
|
/** How often a pane whose launcher asked to be told of its end is looked for. */
|
|
130
130
|
const LAUNCH_END_POLL_MS = 5000;
|
|
131
131
|
|
|
132
|
+
function paneExitOutput(pane) {
|
|
133
|
+
if (!/^p_[A-Za-z0-9_-]+$/.test(pane ?? '')) return null;
|
|
134
|
+
for (const root of [process.env.SUPERCODE_HOME, join(homedir(), '.config', 'supercode')].filter(Boolean)) {
|
|
135
|
+
try { const bytes=readFileSync(join(root,'pane-exits',`${pane}.screen`));return {screen:bytes.subarray(-32768).toString('utf8'),stream:'pty_stdout_stderr',truncated:bytes.length>=32768}; }
|
|
136
|
+
catch { /* Older launches did not retain their output. */ }
|
|
137
|
+
}
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
|
|
132
141
|
function paneExit(pane) {
|
|
133
142
|
const logs = [process.env.SUPERCODE_HOME, join(homedir(), '.config', 'supercode')].filter(Boolean).map((dir) => join(dir, 'pane-exits.log'));
|
|
134
143
|
for (const log of logs) {
|
|
@@ -1307,7 +1316,7 @@ export class TeamsMachine extends MachineCore {
|
|
|
1307
1316
|
// No harness callback: discovery may be the harness's own caller.
|
|
1308
1317
|
const whole = operator || holds(admitted, 'view', '*');
|
|
1309
1318
|
if (!whole && !observesPanes(admitted)) need('view', '*');
|
|
1310
|
-
const sessions = (await this.host.listSessions()).filter(s => s.contextKey && (whole || holds(admitted, 'observe', `pane:${s.contextKey}`)));
|
|
1319
|
+
const sessions = (await this.host.listSessions()).filter(s => s.contextKey && !s.dead && (whole || holds(admitted, 'observe', `pane:${s.contextKey}`)));
|
|
1311
1320
|
return Promise.all(sessions.map(async session => {
|
|
1312
1321
|
const screen = await Promise.resolve().then(() => this.host.capture(session.id, { lines: 100, preserveEscapes: true })).catch(() => null);
|
|
1313
1322
|
const kind = this.#paneKind(session.contextKey, session);
|
|
@@ -1328,7 +1337,7 @@ export class TeamsMachine extends MachineCore {
|
|
|
1328
1337
|
const rows = await this.attentionEvidence();
|
|
1329
1338
|
// `title` is what a viewer should show: the override if one is set, else the tmux label.
|
|
1330
1339
|
return rows.filter((row) => row.session.id && shown(row.session.contextKey)).map(({ session: s, attention, rank, notify, evidence }) => ({
|
|
1331
|
-
pane: s.contextKey, label: s.label, title: titles[`pane:${s.contextKey}`] ?? s.label, cwd: s.cwd, owned: s.owned, activeCommand: s.activeCommand, pid: s.rootPid ?? null, size: s.size, suspended: this.suspended.has(s.contextKey),
|
|
1340
|
+
pane: s.contextKey, dead: Boolean(s.dead), label: s.label, title: titles[`pane:${s.contextKey}`] ?? s.label, cwd: s.cwd, owned: s.owned, activeCommand: s.activeCommand, pid: s.rootPid ?? null, size: s.size, suspended: this.suspended.has(s.contextKey),
|
|
1332
1341
|
attention, rank, notify, evidence,
|
|
1333
1342
|
}));
|
|
1334
1343
|
}
|
|
@@ -1409,7 +1418,9 @@ export class TeamsMachine extends MachineCore {
|
|
|
1409
1418
|
if (!found) return null;
|
|
1410
1419
|
const session = await this.#paneByContext(found.pane);
|
|
1411
1420
|
return {
|
|
1412
|
-
|
|
1421
|
+
exit_output: !session || session.dead ? paneExitOutput(found.pane) : null,
|
|
1422
|
+
exit: session?.dead ? deadPaneExit(session) : !session ? paneExit(found.pane) : null,
|
|
1423
|
+
key: found.key, pane: found.pane, live: Boolean(session && !session.dead), label: session?.label ?? null, activeCommand: session?.activeCommand ?? null,
|
|
1413
1424
|
...initialInputFacts(found),
|
|
1414
1425
|
};
|
|
1415
1426
|
}
|
|
@@ -1420,7 +1431,7 @@ export class TeamsMachine extends MachineCore {
|
|
|
1420
1431
|
const rows = [];
|
|
1421
1432
|
for (const found of this.launches.all()) {
|
|
1422
1433
|
const session = found.pane ? await this.#paneByContext(found.pane) : null;
|
|
1423
|
-
rows.push({ key: found.key, pane: found.pane ?? null, kind: found.kind ?? null, by: found.by ?? null, status: found.status ?? null, at: found.t, live: Boolean(session), ...initialInputFacts(found) });
|
|
1434
|
+
rows.push({ key: found.key, pane: found.pane ?? null, kind: found.kind ?? null, by: found.by ?? null, status: found.status ?? null, at: found.t, live: Boolean(session && !session.dead), ...initialInputFacts(found) });
|
|
1424
1435
|
}
|
|
1425
1436
|
return rows;
|
|
1426
1437
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/supercode-teams",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.133",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A machine daemon serving this machine's doors, and a local or remote Teams server for shared session discovery, OpenTelemetry ingestion and access to enrolled machines.",
|
|
6
6
|
"license": "MIT",
|