@volter/supercode-teams 0.2.88 → 0.2.89
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/package.json +1 -1
- package/popup-terminals.mjs +9 -35
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/supercode-teams",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.89",
|
|
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,10 +4,10 @@
|
|
|
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,
|
|
8
|
-
import {
|
|
7
|
+
import { chmodSync, existsSync, writeFileSync } from 'node:fs';
|
|
8
|
+
import { tmpdir } from 'node:os';
|
|
9
9
|
import { join } from 'node:path';
|
|
10
|
-
import {
|
|
10
|
+
import { randomBytes } from 'node:crypto';
|
|
11
11
|
import { weztermConfigFile } from './terminal-look.mjs';
|
|
12
12
|
|
|
13
13
|
const onPath = (name) => {
|
|
@@ -27,39 +27,13 @@ function selfDeletingScript(argv, extension) {
|
|
|
27
27
|
return path;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
// config's content: WezTerm does not reload it (terminal-look.mjs), so a process holding an older look is never reused.
|
|
36
|
-
const WEZTERM_CLASS = 'dev.volter.supercode';
|
|
37
|
-
|
|
38
|
-
/** The socket of a running supercode WezTerm process of class `cls`, or null. */
|
|
39
|
-
function weztermSocket(cls) {
|
|
40
|
-
const dir = join(homedir(), '.local', 'share', 'wezterm');
|
|
41
|
-
let names;
|
|
42
|
-
try { names = readdirSync(dir); } catch { return null; }
|
|
43
|
-
for (const name of names) {
|
|
44
|
-
const pid = Number(/^gui-sock-(\d+)$/.exec(name)?.[1]);
|
|
45
|
-
if (!pid) continue;
|
|
46
|
-
try { process.kill(pid, 0); } catch { continue; }
|
|
47
|
-
const command = spawnSync('ps', ['-p', String(pid), '-o', 'command='], { encoding: 'utf8', timeout: 2_000 }).stdout ?? '';
|
|
48
|
-
if (command.includes(`--class ${cls} `)) return join(dir, name);
|
|
49
|
-
}
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/** WezTerm's launch: a window in supercode's running WezTerm, else a new one with supercode's look (terminal-look.mjs). */
|
|
30
|
+
// Each window is a WezTerm process of its own, with supercode's look (terminal-look.mjs). Windows sharing one process
|
|
31
|
+
// share its one main thread: on the owner's Mac, four Claude sessions' output kept that thread painting for whole
|
|
32
|
+
// seconds at a time (97-98% of 3 s samples), and a drag in any other popup went unanswered meanwhile. A process of its
|
|
33
|
+
// own opens in 0.7 to 2 s where a window in a running process opened in about 0.3 s; it is never frozen by another
|
|
34
|
+
// window's output.
|
|
54
35
|
function weztermLaunch(program, argv) {
|
|
55
|
-
|
|
56
|
-
const cls = `${WEZTERM_CLASS}.${createHash('sha256').update(readFileSync(config)).digest('hex').slice(0, 12)}`;
|
|
57
|
-
const start = [program, '--config-file', config, 'start', '--always-new-process', '--class', cls, '--', ...argv];
|
|
58
|
-
const socket = process.platform === 'win32' ? null : weztermSocket(cls);
|
|
59
|
-
if (!socket) return [start[0], start.slice(1)];
|
|
60
|
-
const quote = (arg) => `'${String(arg).replaceAll("'", `'"'"'`)}'`;
|
|
61
|
-
const spawnWindow = [program, 'cli', '--no-auto-start', 'spawn', '--new-window', '--', ...argv].map(quote).join(' ');
|
|
62
|
-
return ['/bin/sh', ['-c', `WEZTERM_UNIX_SOCKET=${quote(socket)} ${spawnWindow} >/dev/null 2>&1 || exec ${start.map(quote).join(' ')}`]];
|
|
36
|
+
return [program, ['--config-file', weztermConfigFile(), 'start', '--always-new-process', '--', ...argv]];
|
|
63
37
|
}
|
|
64
38
|
|
|
65
39
|
/** Adapters by platform, in rank order: { name, find() → program or null, launch(program, argv) → [command, args] }. */
|