@cotal-ai/manager 0.8.3 → 0.9.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/attach-client.d.ts +14 -1
- package/dist/attach-client.d.ts.map +1 -1
- package/dist/attach-client.js +161 -14
- package/dist/attach-client.js.map +1 -1
- package/dist/attach-endpoint.d.ts.map +1 -1
- package/dist/attach-endpoint.js +43 -10
- package/dist/attach-endpoint.js.map +1 -1
- package/dist/commands.d.ts +4 -3
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +35 -15
- package/dist/commands.js.map +1 -1
- package/dist/manager.d.ts +66 -4
- package/dist/manager.d.ts.map +1 -1
- package/dist/manager.js +283 -23
- package/dist/manager.js.map +1 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +9 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/pty.d.ts.map +1 -1
- package/dist/runtime/pty.js +26 -10
- package/dist/runtime/pty.js.map +1 -1
- package/package.json +9 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pty.d.ts","sourceRoot":"","sources":["../../src/runtime/pty.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pty.d.ts","sourceRoot":"","sources":["../../src/runtime/pty.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAiB,UAAU,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAoBtF;;;;;GAKG;AACH,qBAAa,UAAW,YAAW,OAAO;IACxC,QAAQ,CAAC,IAAI,EAAG,KAAK,CAAU;IAE/B,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,WAAW;CA4IhE"}
|
package/dist/runtime/pty.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import * as pty from "@lydell/node-pty";
|
|
2
|
+
import Headless from "@xterm/headless";
|
|
3
|
+
import { SerializeAddon } from "@xterm/addon-serialize";
|
|
2
4
|
import { preparePtyLaunch } from "./windows-launch.js";
|
|
3
5
|
const DEFAULT_COLS = 120;
|
|
4
6
|
const DEFAULT_ROWS = 32;
|
|
5
|
-
/** How
|
|
6
|
-
|
|
7
|
+
/** How many rows of history the attach-time screen mirror retains (see spawn) so a late attach
|
|
8
|
+
* still sees output that scrolled past. */
|
|
9
|
+
const SCROLLBACK_ROWS = 1000;
|
|
7
10
|
/** Spacing between auto-confirm Enter presses, and how many to send. Claude's startup gates
|
|
8
11
|
* (workspace-trust, then the dev-channels warning) each wait for Enter and neither has a headless
|
|
9
12
|
* override. The count is variable — a fresh folder shows both, a re-launch on a now-trusted folder
|
|
@@ -42,8 +45,18 @@ export class PtyRuntime {
|
|
|
42
45
|
});
|
|
43
46
|
const dataSubs = new Set();
|
|
44
47
|
const exitSubs = new Set();
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
// Mirror the child's PTY into a headless terminal, so on attach we hand the new client a
|
|
49
|
+
// reconstructed screen image — the alternate-screen buffer of a full-screen TUI, or the
|
|
50
|
+
// scrollback of an inline one — instead of a raw byte replay. A raw replay can't rebuild an
|
|
51
|
+
// alt-screen, which left a late or concurrent attach staring at a partial screen (see `backlog`).
|
|
52
|
+
const term = new Headless.Terminal({
|
|
53
|
+
cols: DEFAULT_COLS,
|
|
54
|
+
rows: DEFAULT_ROWS,
|
|
55
|
+
scrollback: SCROLLBACK_ROWS,
|
|
56
|
+
allowProposedApi: true, // the serialize addon reads buffer internals via proposed API
|
|
57
|
+
});
|
|
58
|
+
const serializer = new SerializeAddon();
|
|
59
|
+
term.loadAddon(serializer);
|
|
47
60
|
let alive = true;
|
|
48
61
|
let cols = DEFAULT_COLS;
|
|
49
62
|
let rows = DEFAULT_ROWS;
|
|
@@ -63,12 +76,8 @@ export class PtyRuntime {
|
|
|
63
76
|
}, CONFIRM_INTERVAL_MS);
|
|
64
77
|
}
|
|
65
78
|
proc.onData((d) => {
|
|
79
|
+
term.write(d); // mirror into the screen model for attach-time reconstruction
|
|
66
80
|
const b = Buffer.from(d, "utf8");
|
|
67
|
-
ring.push(b);
|
|
68
|
-
ringBytes += b.length;
|
|
69
|
-
while (ringBytes > SCROLLBACK_BYTES && ring.length > 1) {
|
|
70
|
-
ringBytes -= ring.shift().length;
|
|
71
|
-
}
|
|
72
81
|
for (const fn of dataSubs)
|
|
73
82
|
fn(b);
|
|
74
83
|
});
|
|
@@ -132,7 +141,12 @@ export class PtyRuntime {
|
|
|
132
141
|
get rows() {
|
|
133
142
|
return rows;
|
|
134
143
|
},
|
|
135
|
-
backlog: () =>
|
|
144
|
+
backlog: () =>
|
|
145
|
+
// Serialize the mirrored screen into bytes that repaint it exactly — the alt-screen buffer
|
|
146
|
+
// (and modes) of a full-screen TUI, or the scrollback of an inline one. The empty write
|
|
147
|
+
// drains the parser first (xterm writes are FIFO), so the snapshot reflects every byte the
|
|
148
|
+
// child has emitted so far, not a state that lags behind in-flight output.
|
|
149
|
+
new Promise((resolve) => term.write("", () => resolve(Buffer.from(serializer.serialize(), "utf8")))),
|
|
136
150
|
onData: (fn) => {
|
|
137
151
|
dataSubs.add(fn);
|
|
138
152
|
return () => dataSubs.delete(fn);
|
|
@@ -148,6 +162,8 @@ export class PtyRuntime {
|
|
|
148
162
|
resize: (c, r) => {
|
|
149
163
|
cols = c;
|
|
150
164
|
rows = r;
|
|
165
|
+
if (c > 0 && r > 0)
|
|
166
|
+
term.resize(c, r); // keep the mirror in step so snapshots reconstruct at size
|
|
151
167
|
if (alive)
|
|
152
168
|
proc.resize(c, r);
|
|
153
169
|
},
|
package/dist/runtime/pty.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pty.js","sourceRoot":"","sources":["../../src/runtime/pty.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"pty.js","sourceRoot":"","sources":["../../src/runtime/pty.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T,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;wBAAE,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,2DAA2D;oBAClG,IAAI,KAAK;wBAAE,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC/B,CAAC;aACF,CAAC;SACH,CAAC;IACJ,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cotal-ai/manager",
|
|
3
3
|
"description": "Cotal agent supervisor: spawns and manages mesh nodes via a pluggable runtime (pty/tmux/cmux).",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.9.1",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -21,16 +21,20 @@
|
|
|
21
21
|
"@lydell/node-pty": "1.2.0-beta.12",
|
|
22
22
|
"@xterm/addon-attach": "^0.11.0",
|
|
23
23
|
"@xterm/addon-fit": "^0.10.0",
|
|
24
|
+
"@xterm/addon-serialize": "^0.13.0",
|
|
25
|
+
"@xterm/headless": "^5.5.0",
|
|
24
26
|
"@xterm/xterm": "^5.5.0",
|
|
25
27
|
"ws": "^8.21.0",
|
|
26
28
|
"yaml": "^2.9.0",
|
|
27
29
|
"zod": "^4.4.3",
|
|
28
|
-
"@cotal-ai/
|
|
29
|
-
"@cotal-ai/
|
|
30
|
+
"@cotal-ai/workspace": "0.9.1",
|
|
31
|
+
"@cotal-ai/core": "0.9.1"
|
|
30
32
|
},
|
|
31
33
|
"devDependencies": {
|
|
34
|
+
"@nats-io/jetstream": "^3.4.0",
|
|
35
|
+
"@nats-io/transport-node": "^3.4.0",
|
|
32
36
|
"@types/ws": "^8.18.1",
|
|
33
|
-
"@cotal-ai/connector-core": "0.
|
|
37
|
+
"@cotal-ai/connector-core": "0.9.1"
|
|
34
38
|
},
|
|
35
39
|
"files": [
|
|
36
40
|
"dist"
|
|
@@ -39,6 +43,7 @@
|
|
|
39
43
|
"access": "public"
|
|
40
44
|
},
|
|
41
45
|
"scripts": {
|
|
46
|
+
"test": "tsx smoke/start-model-preflight.smoke.ts",
|
|
42
47
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
43
48
|
"build": "tsc -p tsconfig.json && node -e \"const fs=require('node:fs'); fs.rmSync('dist/console', { recursive: true, force: true }); fs.cpSync('src/console', 'dist/console', { recursive: true })\""
|
|
44
49
|
}
|