@volter/supercode-teams 0.2.73 → 0.2.75
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 +1 -1
- package/package.json +1 -1
- package/popup-terminals.mjs +36 -5
package/machine.mjs
CHANGED
|
@@ -1114,7 +1114,7 @@ export class TeamsMachine extends MachineCore {
|
|
|
1114
1114
|
const rows = await this.attentionEvidence();
|
|
1115
1115
|
// `title` is what a viewer should show: the override if one is set, else the tmux label.
|
|
1116
1116
|
return rows.filter((row) => row.session.id && shown(row.session.contextKey)).map(({ session: s, attention, rank, notify, evidence }) => ({
|
|
1117
|
-
pane: s.contextKey, label: s.label, title: titles[`pane:${s.contextKey}`] ?? s.label, cwd: s.cwd, owned: s.owned, activeCommand: s.activeCommand, size: s.size, suspended: this.suspended.has(s.contextKey),
|
|
1117
|
+
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),
|
|
1118
1118
|
attention, rank, notify, evidence,
|
|
1119
1119
|
}));
|
|
1120
1120
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/supercode-teams",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.75",
|
|
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",
|
package/popup-terminals.mjs
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
// daemon's ConPTY host on Windows, holds it); the pane ending ends the client, and the terminal closes the window as
|
|
5
5
|
// its command exits. Adapters are tried in rank order; SUPERCODE_POPUP_TERMINAL names one (or `none`).
|
|
6
6
|
import { spawn, spawnSync } from 'node:child_process';
|
|
7
|
-
import { chmodSync, existsSync, writeFileSync } from 'node:fs';
|
|
8
|
-
import { tmpdir } from 'node:os';
|
|
7
|
+
import { chmodSync, existsSync, readdirSync, writeFileSync } from 'node:fs';
|
|
8
|
+
import { homedir, tmpdir } from 'node:os';
|
|
9
9
|
import { join } from 'node:path';
|
|
10
10
|
import { randomBytes } from 'node:crypto';
|
|
11
11
|
import { weztermConfigFile } from './terminal-look.mjs';
|
|
@@ -27,11 +27,42 @@ function selfDeletingScript(argv, extension) {
|
|
|
27
27
|
return path;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
// Supercode's windows share one WezTerm process, as Terminal.app's windows share one app: a window opened into a
|
|
31
|
+
// running process is on screen in about 0.3 s, where a process started per window took 0.7 to 2 s (measured on macOS
|
|
32
|
+
// 26 with WezTerm 20240203). The process is known by its class; it listens on ~/.local/share/wezterm/gui-sock-<pid>.
|
|
33
|
+
// A window goes into it with `wezterm cli spawn --new-window`, and when there is none, or the spawn fails, the window
|
|
34
|
+
// starts it. The fallback runs in the launched shell, so the daemon never waits on WezTerm.
|
|
35
|
+
const WEZTERM_CLASS = 'dev.volter.supercode';
|
|
36
|
+
|
|
37
|
+
/** The socket of a running supercode WezTerm process, or null. */
|
|
38
|
+
function weztermSocket() {
|
|
39
|
+
const dir = join(homedir(), '.local', 'share', 'wezterm');
|
|
40
|
+
let names;
|
|
41
|
+
try { names = readdirSync(dir); } catch { return null; }
|
|
42
|
+
for (const name of names) {
|
|
43
|
+
const pid = Number(/^gui-sock-(\d+)$/.exec(name)?.[1]);
|
|
44
|
+
if (!pid) continue;
|
|
45
|
+
try { process.kill(pid, 0); } catch { continue; }
|
|
46
|
+
const command = spawnSync('ps', ['-p', String(pid), '-o', 'command='], { encoding: 'utf8', timeout: 2_000 }).stdout ?? '';
|
|
47
|
+
if (command.includes(`--class ${WEZTERM_CLASS}`)) return join(dir, name);
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** WezTerm's launch: a window in supercode's running WezTerm, else a new one with supercode's look (terminal-look.mjs). */
|
|
53
|
+
function weztermLaunch(program, argv) {
|
|
54
|
+
const start = [program, '--config-file', weztermConfigFile(), 'start', '--always-new-process', '--class', WEZTERM_CLASS, '--', ...argv];
|
|
55
|
+
const socket = process.platform === 'win32' ? null : weztermSocket();
|
|
56
|
+
if (!socket) return [start[0], start.slice(1)];
|
|
57
|
+
const quote = (arg) => `'${String(arg).replaceAll("'", `'"'"'`)}'`;
|
|
58
|
+
const spawnWindow = [program, 'cli', '--no-auto-start', 'spawn', '--new-window', '--', ...argv].map(quote).join(' ');
|
|
59
|
+
return ['/bin/sh', ['-c', `WEZTERM_UNIX_SOCKET=${quote(socket)} ${spawnWindow} >/dev/null 2>&1 || exec ${start.map(quote).join(' ')}`]];
|
|
60
|
+
}
|
|
61
|
+
|
|
30
62
|
/** Adapters by platform, in rank order: { name, find() → program or null, launch(program, argv) → [command, args] }. */
|
|
31
63
|
const ADAPTERS = {
|
|
32
64
|
darwin: [
|
|
33
|
-
|
|
34
|
-
{ name: 'wezterm', find: () => onPath('wezterm') ?? firstPath('/Applications/WezTerm.app/Contents/MacOS/wezterm'), launch: (p, argv) => [p, ['--config-file', weztermConfigFile(), 'start', '--always-new-process', '--', ...argv]] },
|
|
65
|
+
{ name: 'wezterm', find: () => onPath('wezterm') ?? firstPath('/Applications/WezTerm.app/Contents/MacOS/wezterm'), launch: weztermLaunch },
|
|
35
66
|
{ name: 'kitty', find: () => onPath('kitty') ?? firstPath('/Applications/kitty.app/Contents/MacOS/kitty'), launch: (p, argv) => [p, argv] },
|
|
36
67
|
{ name: 'ghostty', find: () => firstPath('/Applications/Ghostty.app'), launch: (p, argv) => ['open', ['-na', p, '--args', '-e', ...argv]] },
|
|
37
68
|
{ name: 'alacritty', find: () => onPath('alacritty') ?? firstPath('/Applications/Alacritty.app/Contents/MacOS/alacritty'), launch: (p, argv) => [p, ['-e', ...argv]] },
|
|
@@ -49,7 +80,7 @@ const ADAPTERS = {
|
|
|
49
80
|
{ name: 'conhost', find: () => firstPath(join(process.env.SystemRoot ?? 'C:\\Windows', 'System32', 'conhost.exe')), launch: (p, argv) => [p, argv] },
|
|
50
81
|
],
|
|
51
82
|
linux: [
|
|
52
|
-
{ name: 'wezterm', find: () => onPath('wezterm'), launch:
|
|
83
|
+
{ name: 'wezterm', find: () => onPath('wezterm'), launch: weztermLaunch },
|
|
53
84
|
{ name: 'kitty', find: () => onPath('kitty'), launch: (p, argv) => [p, argv] },
|
|
54
85
|
{ name: 'ghostty', find: () => onPath('ghostty'), launch: (p, argv) => [p, ['-e', ...argv]] },
|
|
55
86
|
{ name: 'alacritty', find: () => onPath('alacritty'), launch: (p, argv) => [p, ['-e', ...argv]] },
|