@linzumi/cli 1.0.299 → 1.0.301
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/README.md +31 -1
- package/dist/cloud-supervisor.mjs +108 -107
- package/dist/hosted-coding-account-worker.js +18 -17
- package/dist/index.js +401 -392
- package/dist/mcp-server.mjs +41 -38
- package/dist/remote-codex-harness-worker.js +121 -118
- package/dist/topics-cli.mjs +15 -15
- package/native/darwin/linzumi-terminal-pty-helper +0 -0
- package/native/darwin/terminal-pty-helper.manifest.json +5 -4
- package/package.json +2 -1
- package/scripts/bump-cli-version.mjs +11 -3
- package/scripts/terminal-pty-helper.c +91 -1
|
Binary file
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 1,
|
|
3
|
-
"sourceSha256": "
|
|
4
|
-
"buildScriptSha256": "
|
|
5
|
-
"binarySha256": "
|
|
3
|
+
"sourceSha256": "192542c039720061daa0b31359564c06cef9e00fed6729c59bd5c3e8edfcca49",
|
|
4
|
+
"buildScriptSha256": "2c295e06280bb843579edb0e42b6a25e68d18790cbdb3ec5520504dae3715379",
|
|
5
|
+
"binarySha256": "4ed8952bc81b03e4028539c7c08b669d427ad661d1e5d624f7c8856d410d30fa",
|
|
6
6
|
"architectures": [
|
|
7
7
|
"arm64",
|
|
8
8
|
"x86_64"
|
|
@@ -20,5 +20,6 @@
|
|
|
20
20
|
"-mmacosx-version-min=11.0"
|
|
21
21
|
],
|
|
22
22
|
"compiler": "Apple clang version 21.0.0 (clang-2100.3.34.2)",
|
|
23
|
-
"sdkVersion": "27.0"
|
|
23
|
+
"sdkVersion": "27.0",
|
|
24
|
+
"inputReceipts": 1
|
|
24
25
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linzumi/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.301",
|
|
4
4
|
"description": "Linzumi CLI \u2014 point a Codex agent at the real code on your laptop, with your team watching and steering from shared threads.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"blessed": "^0.1.81",
|
|
50
50
|
"ghostty-web": "0.4.0",
|
|
51
51
|
"proper-lockfile": "3.2.0",
|
|
52
|
+
"stream-json": "1.9.1",
|
|
52
53
|
"undici": "^6.25.0",
|
|
53
54
|
"ws": "^8.18.0",
|
|
54
55
|
"zod": "^3.25.76"
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
// src/version.ts, README.md, the public alias manifest, and version-pinning tests). This script rewrites
|
|
20
20
|
// every known site, FAILS LOUDLY if any expected pattern is missing, and then
|
|
21
21
|
// scans package.json/src/README/test/scripts/bin for any leftover
|
|
22
|
-
// old-version
|
|
22
|
+
// exact old-version token - so a future, not-yet-listed pin site cannot silently
|
|
23
23
|
// drift past a release.
|
|
24
24
|
//
|
|
25
25
|
// Flags:
|
|
@@ -238,7 +238,7 @@ for (const site of knownSites) {
|
|
|
238
238
|
});
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
-
// Leftover scan: after the planned rewrites, no old-version
|
|
241
|
+
// Leftover scan: after the planned rewrites, no exact old-version token may remain
|
|
242
242
|
// anywhere in the package surface. This is what catches an unlisted 8th site.
|
|
243
243
|
function scanTargets() {
|
|
244
244
|
const roots = ['src', 'test', 'scripts', 'bin'];
|
|
@@ -301,6 +301,14 @@ function walk(directory) {
|
|
|
301
301
|
return results;
|
|
302
302
|
}
|
|
303
303
|
|
|
304
|
+
// Spec: plans/2026-07-12-linzumi-unscoped-npm-package-spec.md.
|
|
305
|
+
// A dependency with a longer patch/prerelease/build is a distinct version,
|
|
306
|
+
// not another CLI pin. Conventional artifact prefixes (v, cli-) introduce pins;
|
|
307
|
+
// only numeric/dotted prefixes can extend the version itself.
|
|
308
|
+
const escapedOldVersion = oldVersion.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
309
|
+
const oldVersionToken = new RegExp(
|
|
310
|
+
`(^|[^0-9.])${escapedOldVersion}(?=$|[^0-9A-Za-z.+-])`
|
|
311
|
+
);
|
|
304
312
|
const leftovers = [];
|
|
305
313
|
|
|
306
314
|
for (const file of scanTargets()) {
|
|
@@ -325,7 +333,7 @@ for (const file of scanTargets()) {
|
|
|
325
333
|
}
|
|
326
334
|
}
|
|
327
335
|
|
|
328
|
-
if (
|
|
336
|
+
if (oldVersionToken.test(content)) {
|
|
329
337
|
leftovers.push(file);
|
|
330
338
|
}
|
|
331
339
|
}
|
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
* 'i' input bytes, written to the PTY master exactly once
|
|
9
9
|
* 'r' resize: cols u16 BE, rows u16 BE (clamped 20..400 x 5..200)
|
|
10
10
|
* 's' stop: SIGHUP+SIGTERM the shell group, SIGKILL after 2s
|
|
11
|
+
* 'w' write receipt: id u32 BE. Answered once, in order, on stderr
|
|
12
|
+
* when every input byte accepted before it has been written
|
|
13
|
+
* to the PTY master (WRITTEN), or when Stop or a closed PTY
|
|
14
|
+
* means some of them never will be (DROPPED). A receipt
|
|
15
|
+
* confirms the PTY write only - never that a program read or
|
|
16
|
+
* acted on the bytes (plans/2026-10-19-terminal-enter-delivery.md).
|
|
11
17
|
* EOF on stdin is treated as 's' (Commander died or detached us).
|
|
12
18
|
* SIGTERM/SIGHUP/SIGINT delivered to the helper itself are also 's',
|
|
13
19
|
* so a stop is never queued behind unconsumed input.
|
|
@@ -30,6 +36,11 @@
|
|
|
30
36
|
* (discarded: post-Stop output bytes Commander was not draining;
|
|
31
37
|
* explicit, never silent)
|
|
32
38
|
* LINZUMI_PTY_ERROR <code>
|
|
39
|
+
* LINZUMI_PTY_INPUT_WRITTEN id=<n> | LINZUMI_PTY_INPUT_DROPPED id=<n>
|
|
40
|
+
* LINZUMI_PTY_INPUT_FAILED errno=<n> (a PTY write failed for good:
|
|
41
|
+
* the pending input is discarded and its receipts DROPPED)
|
|
42
|
+
* LINZUMI_PTY_INPUT_INVALID_RECEIPT length=<n> (a 'w' frame without
|
|
43
|
+
* a 4-byte id; there is no id to answer, so it is named instead)
|
|
33
44
|
*
|
|
34
45
|
* The helper never logs input/output content. The post-fork child does only
|
|
35
46
|
* async-signal-safe work (chdir, execve, _exit); argv/envp are built pre-fork.
|
|
@@ -76,6 +87,8 @@
|
|
|
76
87
|
#define KILL_CONFIRM_MS 1000
|
|
77
88
|
/* Final cleanup re-enumerates and kills at most this many times. */
|
|
78
89
|
#define CLEANUP_ROUNDS 4
|
|
90
|
+
/* Outstanding write receipts; a further 'w' frame waits (backpressure). */
|
|
91
|
+
#define MAX_RECEIPTS 64
|
|
79
92
|
|
|
80
93
|
extern char **environ;
|
|
81
94
|
|
|
@@ -92,6 +105,17 @@ static void status_line(const char *line) {
|
|
|
92
105
|
}
|
|
93
106
|
}
|
|
94
107
|
|
|
108
|
+
typedef struct {
|
|
109
|
+
uint32_t id;
|
|
110
|
+
unsigned long long target; /* accepted-input total the receipt waits for */
|
|
111
|
+
} receipt;
|
|
112
|
+
|
|
113
|
+
static void receipt_line(const char *outcome, uint32_t id) {
|
|
114
|
+
char line[64];
|
|
115
|
+
snprintf(line, sizeof(line), "LINZUMI_PTY_INPUT_%s id=%u\n", outcome, (unsigned)id);
|
|
116
|
+
status_line(line);
|
|
117
|
+
}
|
|
118
|
+
|
|
95
119
|
static int fail(const char *code, int status) {
|
|
96
120
|
char line[128];
|
|
97
121
|
snprintf(line, sizeof(line), "LINZUMI_PTY_ERROR %s\n", code);
|
|
@@ -170,10 +194,12 @@ static int test_fault(const char *name) {
|
|
|
170
194
|
#define fault_pid_lookup() test_fault("pid_lookup")
|
|
171
195
|
#define fault_pause_before_reap() test_fault("pause_before_reap")
|
|
172
196
|
#define fault_pause_after_fork() test_fault("pause_after_fork")
|
|
197
|
+
#define fault_input_write() test_fault("input_write")
|
|
173
198
|
#else
|
|
174
199
|
#define fault_pid_lookup() 0
|
|
175
200
|
#define fault_pause_before_reap() 0
|
|
176
201
|
#define fault_pause_after_fork() 0
|
|
202
|
+
#define fault_input_write() 0
|
|
177
203
|
#endif
|
|
178
204
|
|
|
179
205
|
static void add_member(pid_t pid, struct timeval started) {
|
|
@@ -408,6 +434,16 @@ int main(int argc, char **argv) {
|
|
|
408
434
|
size_t pending_used = 0;
|
|
409
435
|
size_t out_used = 0;
|
|
410
436
|
unsigned long long discarded = 0; /* post-stop bytes Commander could not take */
|
|
437
|
+
static receipt receipts[MAX_RECEIPTS];
|
|
438
|
+
size_t receipts_used = 0;
|
|
439
|
+
unsigned long long accepted_total = 0; /* input bytes ever queued for the PTY */
|
|
440
|
+
unsigned long long written_total = 0; /* input bytes ever written to the PTY */
|
|
441
|
+
/* Each receipt covers the input accepted after the previous receipt, up to
|
|
442
|
+
* its own target. Bytes up to discarded_through never reached the PTY, so a
|
|
443
|
+
* receipt covering any of them is DROPPED, even one parsed after the
|
|
444
|
+
* failure (the 'i' and 'w' frames may arrive in separate reads). */
|
|
445
|
+
unsigned long long last_receipt_target = 0;
|
|
446
|
+
unsigned long long discarded_through = 0;
|
|
411
447
|
int stdin_open = 1;
|
|
412
448
|
int stdout_open = 1;
|
|
413
449
|
int master_open = 1;
|
|
@@ -419,11 +455,29 @@ int main(int argc, char **argv) {
|
|
|
419
455
|
/* The shell exited but is deliberately NOT reaped until cleanup ends. */
|
|
420
456
|
int child_exited = 0;
|
|
421
457
|
|
|
458
|
+
/* Answers every receipt whose bytes are all written, in order. */
|
|
459
|
+
#define SETTLE_RECEIPTS() \
|
|
460
|
+
do { \
|
|
461
|
+
size_t settled = 0; \
|
|
462
|
+
while (settled < receipts_used && receipts[settled].target <= written_total) \
|
|
463
|
+
receipt_line("WRITTEN", receipts[settled++].id); \
|
|
464
|
+
memmove(receipts, receipts + settled, (receipts_used - settled) * sizeof(receipt)); \
|
|
465
|
+
receipts_used -= settled; \
|
|
466
|
+
} while (0)
|
|
467
|
+
/* The pending bytes will never be written: every open receipt is dropped. */
|
|
468
|
+
#define DROP_RECEIPTS() \
|
|
469
|
+
do { \
|
|
470
|
+
for (size_t r = 0; r < receipts_used; r++) \
|
|
471
|
+
receipt_line("DROPPED", receipts[r].id); \
|
|
472
|
+
receipts_used = 0; \
|
|
473
|
+
} while (0)
|
|
474
|
+
|
|
422
475
|
#define BEGIN_STOP() \
|
|
423
476
|
do { \
|
|
424
477
|
if (!stopping) { \
|
|
425
478
|
stopping = 1; \
|
|
426
479
|
pending_used = 0; /* fenced: never reaches PTY */ \
|
|
480
|
+
DROP_RECEIPTS(); \
|
|
427
481
|
kill_deadline = monotonic_ms() + STOP_GRACE_MS; \
|
|
428
482
|
collect_session_members(child); \
|
|
429
483
|
signal_terminal(child, master, SIGHUP); \
|
|
@@ -516,11 +570,26 @@ int main(int argc, char **argv) {
|
|
|
516
570
|
} else if (revents & (POLLHUP | POLLERR)) {
|
|
517
571
|
master_open = 0;
|
|
518
572
|
}
|
|
573
|
+
if (!master_open) DROP_RECEIPTS(); /* nothing more reaches the PTY */
|
|
519
574
|
if (master_open && !stopping && (revents & POLLOUT) && pending_used > 0) {
|
|
520
|
-
ssize_t wrote = write(master, pending, pending_used);
|
|
575
|
+
ssize_t wrote = fault_input_write() ? (errno = EIO, -1) : write(master, pending, pending_used);
|
|
521
576
|
if (wrote > 0) {
|
|
522
577
|
memmove(pending, pending + wrote, pending_used - (size_t)wrote);
|
|
523
578
|
pending_used -= (size_t)wrote;
|
|
579
|
+
written_total += (unsigned long long)wrote;
|
|
580
|
+
SETTLE_RECEIPTS();
|
|
581
|
+
} else if (wrote < 0 && errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK) {
|
|
582
|
+
/* Never silent: the bytes cannot reach the PTY, so they are
|
|
583
|
+
* discarded (never retried) and every waiting receipt is dropped. */
|
|
584
|
+
char line[64];
|
|
585
|
+
snprintf(line, sizeof(line), "LINZUMI_PTY_INPUT_FAILED errno=%d\n", errno);
|
|
586
|
+
status_line(line);
|
|
587
|
+
/* Counted as settled so a later receipt waits only for later bytes;
|
|
588
|
+
* every receipt covering the discarded bytes is dropped. */
|
|
589
|
+
written_total += (unsigned long long)pending_used;
|
|
590
|
+
discarded_through = accepted_total;
|
|
591
|
+
pending_used = 0;
|
|
592
|
+
DROP_RECEIPTS();
|
|
524
593
|
}
|
|
525
594
|
}
|
|
526
595
|
}
|
|
@@ -579,6 +648,25 @@ int main(int argc, char **argv) {
|
|
|
579
648
|
if (!stopping && master_open) {
|
|
580
649
|
memcpy(pending + pending_used, payload, length);
|
|
581
650
|
pending_used += length;
|
|
651
|
+
accepted_total += length;
|
|
652
|
+
}
|
|
653
|
+
} else if (type == 'w' && length != 4) {
|
|
654
|
+
char line[64];
|
|
655
|
+
snprintf(line, sizeof(line), "LINZUMI_PTY_INPUT_INVALID_RECEIPT length=%u\n", (unsigned)length);
|
|
656
|
+
status_line(line);
|
|
657
|
+
} else if (type == 'w') {
|
|
658
|
+
if (receipts_used == MAX_RECEIPTS) break; /* wait; never drop */
|
|
659
|
+
uint32_t id = ((uint32_t)payload[0] << 24) | ((uint32_t)payload[1] << 16) |
|
|
660
|
+
((uint32_t)payload[2] << 8) | (uint32_t)payload[3];
|
|
661
|
+
int covers_discarded = discarded_through > last_receipt_target;
|
|
662
|
+
last_receipt_target = accepted_total;
|
|
663
|
+
if (stopping || !master_open || covers_discarded) {
|
|
664
|
+
receipt_line("DROPPED", id);
|
|
665
|
+
} else {
|
|
666
|
+
receipts[receipts_used].id = id;
|
|
667
|
+
receipts[receipts_used].target = accepted_total;
|
|
668
|
+
receipts_used++;
|
|
669
|
+
SETTLE_RECEIPTS();
|
|
582
670
|
}
|
|
583
671
|
} else if (type == 'r' && length == 4 && master_open) {
|
|
584
672
|
struct winsize next;
|
|
@@ -595,6 +683,8 @@ int main(int argc, char **argv) {
|
|
|
595
683
|
}
|
|
596
684
|
}
|
|
597
685
|
|
|
686
|
+
/* The loop ended with input unwritten: those receipts never complete. */
|
|
687
|
+
DROP_RECEIPTS();
|
|
598
688
|
if (!child_exited) {
|
|
599
689
|
kill(-child, SIGKILL);
|
|
600
690
|
kill(child, SIGKILL);
|