@linzumi/cli 1.0.241 → 1.0.243

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.
@@ -0,0 +1,21 @@
1
+ {
2
+ "version": 1,
3
+ "sourceSha256": "7c168456109138578f8fa5fd3bc380f9fa3a6befdffde5ecc534d2ed8ab16a87",
4
+ "buildScriptSha256": "52eaf6b1a76cb6df19d572f939f712ea582915c8172989914b9b9febdd64012a",
5
+ "binarySha256": "ae41488f097db1fec1714ecb6399107d0b8d0c9281544364ae93efd927ed4d4f",
6
+ "architectures": ["arm64", "x86_64"],
7
+ "flags": [
8
+ "-std=c11",
9
+ "-Wall",
10
+ "-Wextra",
11
+ "-Werror",
12
+ "-Os",
13
+ "-arch",
14
+ "arm64",
15
+ "-arch",
16
+ "x86_64",
17
+ "-mmacosx-version-min=11.0"
18
+ ],
19
+ "compiler": "Apple clang version 21.0.0 (clang-2100.1.1.101)",
20
+ "sdkVersion": "26.5"
21
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linzumi/cli",
3
- "version": "1.0.241",
3
+ "version": "1.0.243",
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": {
package/scripts/build.mjs CHANGED
@@ -8,13 +8,114 @@ import {
8
8
  readFile,
9
9
  rm,
10
10
  writeFile,
11
+ mkdtemp,
12
+ stat,
13
+ chmod,
11
14
  } from 'node:fs/promises';
15
+ import { execFileSync } from 'node:child_process';
16
+ import { createHash } from 'node:crypto';
17
+ import { tmpdir } from 'node:os';
12
18
  import { dirname, join } from 'node:path';
13
19
  import { fileURLToPath, pathToFileURL } from 'node:url';
14
- import { build } from 'esbuild';
15
20
 
16
21
  const packageRoot = dirname(dirname(fileURLToPath(import.meta.url)));
17
22
 
23
+ // Spec: plans/2026-09-06-preview-cold-watcher-reproduction.md.
24
+ // Native source changes use the existing Darwin build host, not an end-user
25
+ // compiler or Linux cross-build. Normal builds verify/copy the immutable asset.
26
+ const identitySource = join(packageRoot, 'scripts/preview-process-identity.c');
27
+ const identityAsset = join(
28
+ packageRoot,
29
+ 'native/darwin/preview-process-identity'
30
+ );
31
+ const identityManifestPath = join(packageRoot, 'native/darwin/manifest.json');
32
+ const digest = (bytes) => createHash('sha256').update(bytes).digest('hex');
33
+ const nativeFlags = [
34
+ '-std=c11',
35
+ '-Wall',
36
+ '-Wextra',
37
+ '-Werror',
38
+ '-Os',
39
+ '-arch',
40
+ 'arm64',
41
+ '-arch',
42
+ 'x86_64',
43
+ '-mmacosx-version-min=11.0',
44
+ ];
45
+ const nativeInputs = {
46
+ sourceSha256: digest(await readFile(identitySource)),
47
+ buildScriptSha256: digest(await readFile(fileURLToPath(import.meta.url))),
48
+ };
49
+ if (
50
+ process.argv.includes('--build-preview-identity') ||
51
+ process.argv.includes('--check-preview-identity')
52
+ ) {
53
+ if (process.platform !== 'darwin')
54
+ throw new Error('preview_identity_build_requires_darwin');
55
+ const dir = await mkdtemp(join(tmpdir(), 'linzumi-preview-identity-'));
56
+ const output = join(dir, 'preview-process-identity');
57
+ execFileSync(
58
+ 'xcrun',
59
+ ['clang', ...nativeFlags, identitySource, '-o', output],
60
+ { stdio: 'inherit' }
61
+ );
62
+ const architectures = execFileSync('lipo', ['-archs', output], {
63
+ encoding: 'utf8',
64
+ })
65
+ .trim()
66
+ .split(/\s+/)
67
+ .sort();
68
+ if (JSON.stringify(architectures) !== '["arm64","x86_64"]')
69
+ throw new Error('preview_identity_architectures_invalid');
70
+ const manifest = {
71
+ version: 1,
72
+ ...nativeInputs,
73
+ binarySha256: digest(await readFile(output)),
74
+ architectures,
75
+ flags: nativeFlags,
76
+ compiler: execFileSync('xcrun', ['clang', '--version'], {
77
+ encoding: 'utf8',
78
+ }).split('\n')[0],
79
+ sdkVersion: execFileSync('xcrun', ['--show-sdk-version'], {
80
+ encoding: 'utf8',
81
+ }).trim(),
82
+ };
83
+ if (process.argv.includes('--check-preview-identity')) {
84
+ const prior = JSON.parse(await readFile(identityManifestPath, 'utf8'));
85
+ if (
86
+ JSON.stringify(prior) !== JSON.stringify(manifest) ||
87
+ digest(await readFile(identityAsset)) !== manifest.binarySha256 ||
88
+ ((await stat(identityAsset)).mode & 0o777) !== 0o755
89
+ )
90
+ throw new Error('preview_identity_rebuild_mismatch');
91
+ } else {
92
+ await mkdir(dirname(identityAsset), { recursive: true });
93
+ await copyFile(output, identityAsset);
94
+ await chmod(identityAsset, 0o755);
95
+ await writeFile(
96
+ identityManifestPath,
97
+ `${JSON.stringify(manifest, null, 2)}\n`
98
+ );
99
+ }
100
+ console.log(JSON.stringify({ ...manifest, buildDirectory: dir }));
101
+ process.exit(0);
102
+ }
103
+ const nativeManifest = JSON.parse(await readFile(identityManifestPath, 'utf8'));
104
+ if (
105
+ nativeManifest.version !== 1 ||
106
+ nativeManifest.sourceSha256 !== nativeInputs.sourceSha256 ||
107
+ nativeManifest.buildScriptSha256 !== nativeInputs.buildScriptSha256 ||
108
+ nativeManifest.binarySha256 !== digest(await readFile(identityAsset)) ||
109
+ JSON.stringify(nativeManifest.architectures) !== '["arm64","x86_64"]' ||
110
+ JSON.stringify(nativeManifest.flags) !== JSON.stringify(nativeFlags) ||
111
+ typeof nativeManifest.compiler !== 'string' ||
112
+ typeof nativeManifest.sdkVersion !== 'string' ||
113
+ ((await stat(identityAsset)).mode & 0o777) !== 0o755
114
+ )
115
+ throw new Error('preview_identity_packaged_asset_invalid');
116
+
117
+ const { build } = await import('esbuild');
118
+
18
119
  // Spec: plans/2026-08-17-tcp-tunnel-cli.spec.md. The zero-TS tunnel command
19
120
  // is a mandatory ReScript build input, not a fail-soft optional rung.
20
121
  const tcpTunnelCliEntry = join(
@@ -32,6 +133,18 @@ const packageVersion = JSON.parse(
32
133
  ).version;
33
134
 
34
135
  await rm(join(packageRoot, 'dist'), { recursive: true, force: true });
136
+ for (const implementation of ['impl-ts', 'impl-res']) {
137
+ const destination = join(
138
+ packageRoot,
139
+ 'dist',
140
+ implementation,
141
+ 'native/darwin'
142
+ );
143
+ await mkdir(destination, { recursive: true });
144
+ await copyFile(identityAsset, join(destination, 'preview-process-identity'));
145
+ await chmod(join(destination, 'preview-process-identity'), 0o755);
146
+ await copyFile(identityManifestPath, join(destination, 'manifest.json'));
147
+ }
35
148
 
36
149
  // Renamed banner import (the build-auth-parity-oracle.mjs convention, made
37
150
  // load-bearing by prod RCA 2026-07-20): esbuild injects banners VERBATIM -
@@ -0,0 +1,45 @@
1
+ /* Spec: plans/2026-05-20-commander-port-watchers-worker-descendants.md.
2
+ * Recovery operator 2026-09-06: read only the requested process incarnation.
3
+ * No arguments, environment, signal, attachment, or privileged operations. */
4
+ #include <errno.h>
5
+ #include <inttypes.h>
6
+ #include <libproc.h>
7
+ #include <stdio.h>
8
+ #include <stdlib.h>
9
+ #include <sys/sysctl.h>
10
+ #include <sys/time.h>
11
+ #include <unistd.h>
12
+
13
+ int main(int argc, char **argv) {
14
+ if (argc != 2) { fputs("preview_identity_pid_required\n", stderr); return 2; }
15
+ errno = 0;
16
+ char *end = NULL;
17
+ long parsed = strtol(argv[1], &end, 10);
18
+ if (errno || !end || *end || parsed <= 1 || parsed > INT32_MAX) {
19
+ fputs("preview_identity_pid_invalid\n", stderr); return 2;
20
+ }
21
+ struct proc_bsdinfo info = {0};
22
+ int size = proc_pidinfo((int)parsed, PROC_PIDTBSDINFO, 0, &info, sizeof(info));
23
+ if (size != sizeof(info) || info.pbi_pid != (uint32_t)parsed) {
24
+ fputs("preview_identity_process_unavailable\n", stderr); return 3;
25
+ }
26
+ if (info.pbi_uid != getuid()) {
27
+ fputs("preview_identity_foreign_uid\n", stderr); return 4;
28
+ }
29
+ char boot[64] = {0};
30
+ size_t boot_size = sizeof(boot);
31
+ if (sysctlbyname("kern.bootsessionuuid", boot, &boot_size, NULL, 0) != 0 || boot_size < 2 || boot_size > sizeof(boot)) {
32
+ fputs("preview_identity_boot_unavailable\n", stderr); return 5;
33
+ }
34
+ for (size_t i = 0; i < boot_size - 1; i++) {
35
+ char ch = boot[i];
36
+ if (!((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f') || ch == '-')) {
37
+ fputs("preview_identity_boot_invalid\n", stderr); return 5;
38
+ }
39
+ }
40
+ if (boot[boot_size - 1] != '\0') { fputs("preview_identity_boot_invalid\n", stderr); return 5; }
41
+ printf("{\"pid\":%u,\"uid\":%u,\"birth\":\"%" PRIu64 ":%" PRIu64 "\",\"boot\":\"%s\"}\n",
42
+ info.pbi_pid, info.pbi_uid, info.pbi_start_tvsec, info.pbi_start_tvusec,
43
+ boot);
44
+ return 0;
45
+ }