@adhdev/ghostty-vt-node 1.0.82 → 1.0.83-rc.2
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/prebuilt/darwin-arm64-node137/ghostty_vt_node.node +0 -0
- package/prebuilt/darwin-arm64-node137/libghostty-vt.0.1.0.dylib +0 -0
- package/prebuilt/darwin-arm64-node137/libghostty-vt.dylib +0 -0
- package/prebuilt/darwin-arm64-node137/manifest.json +6 -6
- package/scripts/check-prebuilts.mjs +40 -2
- package/scripts/check-release-prebuilts.sh +29 -0
- package/scripts/scrub-gha-workspace-paths.mjs +119 -0
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -19,16 +19,16 @@
|
|
|
19
19
|
},
|
|
20
20
|
"files": {
|
|
21
21
|
"ghostty_vt_node.node": {
|
|
22
|
-
"sha256": "
|
|
23
|
-
"size":
|
|
22
|
+
"sha256": "f123534ed51344b5135fc2d16100ddba30e1a1d322c54bd7d14998cb63ead2a2",
|
|
23
|
+
"size": 118096
|
|
24
24
|
},
|
|
25
25
|
"libghostty-vt.0.1.0.dylib": {
|
|
26
|
-
"sha256": "
|
|
27
|
-
"size":
|
|
26
|
+
"sha256": "24e5faa28c66ea03a2bc5de824ad2eb4532f1d49826c4047cfc93be45e0c15c7",
|
|
27
|
+
"size": 1418912
|
|
28
28
|
},
|
|
29
29
|
"libghostty-vt.dylib": {
|
|
30
|
-
"sha256": "
|
|
31
|
-
"size":
|
|
30
|
+
"sha256": "24e5faa28c66ea03a2bc5de824ad2eb4532f1d49826c4047cfc93be45e0c15c7",
|
|
31
|
+
"size": 1418912
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
// (loading alone proves nothing: a stale binary loads fine).
|
|
14
14
|
// (c) native-ci the native CI build compiles from source instead of copying
|
|
15
15
|
// the tracked prebuilt, and verifies + stamps what it built;
|
|
16
|
-
// the release job checks every prebuilt it is about to publish.
|
|
16
|
+
// the release job checks every committed prebuilt it is about to publish.
|
|
17
17
|
// (d) host-paths every shipped native file is free of absolute home-directory
|
|
18
18
|
// paths (ASCII and UTF-16LE), see scripts/host-path-scan.mjs.
|
|
19
|
+
// (e) gha-scrub reject hosted CI workspace prefixes in shipped native files.
|
|
19
20
|
//
|
|
20
21
|
// node scripts/check-prebuilts.mjs [--all-present]
|
|
21
22
|
import { spawnSync } from 'node:child_process';
|
|
@@ -30,6 +31,12 @@ import { printVerifyReport, verifyPrebuilt } from './verify-prebuilt.mjs';
|
|
|
30
31
|
|
|
31
32
|
const WORKFLOW_DIR = join(PACKAGE_DIR, '..', '..', '.github', 'workflows');
|
|
32
33
|
|
|
34
|
+
function workflowJob(workflow, name) {
|
|
35
|
+
const normalized = workflow.replace(/\r\n/g, '\n');
|
|
36
|
+
const jobs = normalized.match(/^jobs:[ \t]*\n([\s\S]*?)(?=^\w|$(?![\s\S]))/m)?.[1] ?? '';
|
|
37
|
+
return jobs.match(new RegExp(`^ ${name}:[ \\t]*\\n([\\s\\S]*?)(?=^ \\S|$(?![\\s\\S]))`, 'm'))?.[1] ?? '';
|
|
38
|
+
}
|
|
39
|
+
|
|
33
40
|
function checkExactHostPrebuilt() {
|
|
34
41
|
const triplet = shippedTripletFor();
|
|
35
42
|
if (!triplet) {
|
|
@@ -71,7 +78,29 @@ export function nativeCiFindings(workflowDir = WORKFLOW_DIR, packageDir = PACKAG
|
|
|
71
78
|
findings.push(['native build forces a compile', forced, buildStep ? buildText.trim().replace(/\s+/g, ' ') : 'no "Build ghostty-vt-node" step']);
|
|
72
79
|
findings.push(['native build verifies the exact staged artifact', /scripts\/verify-prebuilt\.mjs "?dist-prebuilt\//.test(native), 'verify-prebuilt.mjs on dist-prebuilt/<triplet>']);
|
|
73
80
|
findings.push(['native build stamps a manifest from the built binary', /scripts\/prebuilt-manifest\.mjs write "?dist-prebuilt\//.test(native), 'prebuilt-manifest.mjs write dist-prebuilt/<triplet>']);
|
|
74
|
-
|
|
81
|
+
const publish = workflowJob(ci, 'publish');
|
|
82
|
+
const gate = ' run: bash packages/ghostty-vt-node/scripts/check-release-prebuilts.sh';
|
|
83
|
+
const publishLines = publish.split('\n').filter((line) => !/^\s*#/.test(line));
|
|
84
|
+
const publishSteps = publishLines.join('\n').split(/^ - /m).slice(1);
|
|
85
|
+
const downloadSteps = publishSteps.filter((step) => /uses:\s*actions\/download-artifact@/.test(step));
|
|
86
|
+
findings.push(['release gate checks committed prebuilts', publishLines.includes(gate), 'publish runs check-release-prebuilts.sh']);
|
|
87
|
+
const replacesPrebuilts = publishLines.some((line) => line !== gate
|
|
88
|
+
&& !/^\s*- name:/.test(line)
|
|
89
|
+
&& /prebuilt|\bgh\s+run\s+download\b|\bgh\s+api\b/i.test(line));
|
|
90
|
+
const onlyDistDownload = downloadSteps.length === 1
|
|
91
|
+
&& /^ with:\n name: publish-artifacts\n path: packages\s*$/m.test(downloadSteps[0])
|
|
92
|
+
&& !/^ (?:pattern|run-id|artifact-ids|github-token|repository):/m.test(downloadSteps[0]);
|
|
93
|
+
const build = workflowJob(ci, 'build');
|
|
94
|
+
const uploadPaths = build.match(/^ path: \|\r?\n((?: {12}\S[^\n]*\n)+)/m)?.[1] ?? '';
|
|
95
|
+
const distPaths = ['session-host-core', 'session-host-daemon', 'mcp-server', 'daemon-core', 'daemon-standalone', 'web-standalone']
|
|
96
|
+
.map((name) => `packages/${name}/dist`).sort().join('\n');
|
|
97
|
+
findings.push(['publish downloads only build dist', !replacesPrebuilts && onlyDistDownload
|
|
98
|
+
&& uploadPaths.trim().split(/\n/).map((line) => line.trim()).sort().join('\n') === distPaths,
|
|
99
|
+
'publish-artifacts is same-run dist only; no Ghostty replacement']);
|
|
100
|
+
const windows = workflowJob(native, 'native-build').split(/^ - runner: /m).slice(1)
|
|
101
|
+
.filter((entry) => /^ platform: win32\s*$/m.test(entry));
|
|
102
|
+
findings.push(['Windows native build uses windows-2022', windows.length === 1 && windows[0].startsWith('windows-2022\n'),
|
|
103
|
+
'Windows x64 must use the VS 2022 runner']);
|
|
75
104
|
|
|
76
105
|
const plan = spawnSync(process.execPath, [join(packageDir, 'scripts', 'build-or-use-prebuilt.mjs'), '--plan'], {
|
|
77
106
|
cwd: packageDir,
|
|
@@ -104,6 +133,15 @@ if (process.argv[1] && fileURLToPath(import.meta.url) === resolve(process.argv[1
|
|
|
104
133
|
results.nativeCi = existsSync(WORKFLOW_DIR) ? checkNativeCi() : (console.log('[ghostty-vt] no .github/workflows next to this package (npm install); skipped'), true);
|
|
105
134
|
console.log('── (d) shipped native files carry no host paths');
|
|
106
135
|
results.hostPaths = printHostPathReport(scanHostPaths());
|
|
136
|
+
console.log('── (e) official GHA runner /work/ prefixes scrubbed from shipped natives');
|
|
137
|
+
{
|
|
138
|
+
const check = spawnSync(process.execPath, [join(PACKAGE_DIR, 'scripts', 'scrub-gha-workspace-paths.mjs'), '--check'], {
|
|
139
|
+
cwd: PACKAGE_DIR, encoding: 'utf8', windowsHide: true,
|
|
140
|
+
});
|
|
141
|
+
const ok = check.status === 0;
|
|
142
|
+
console.log(` ${ok ? '✓' : '✗'} scrub-gha-workspace-paths --check: ${(check.stdout || check.stderr || '').trim().split('\n').pop()}`);
|
|
143
|
+
results.ghaScrub = ok;
|
|
144
|
+
}
|
|
107
145
|
const failed = Object.entries(results).filter(([, ok]) => !ok).map(([name]) => name);
|
|
108
146
|
if (failed.length) {
|
|
109
147
|
console.error(`✗ ghostty-vt-node prebuilt gate failed: ${failed.join(', ')}`);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
package=packages/ghostty-vt-node
|
|
5
|
+
# Include ignored files because extra ABI directories can otherwise take
|
|
6
|
+
# precedence in the loader and end up in the npm tarball.
|
|
7
|
+
changes=$(git status --porcelain --untracked-files=all --ignored -- "$package/prebuilt")
|
|
8
|
+
if [[ -n "$changes" ]]; then
|
|
9
|
+
echo "Release prebuilts must match the checkout without extra files:" >&2
|
|
10
|
+
printf '%s\n' "$changes" >&2
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
if [[ "$(uname -s)-$(uname -m)" != Linux-x86_64 ]] || ! awk '
|
|
15
|
+
/^flags[[:space:]]*:/ {
|
|
16
|
+
seen = 1
|
|
17
|
+
for (i = 2; i <= NF; i++) if ($i ~ /^avx512/) avx512 = 1
|
|
18
|
+
}
|
|
19
|
+
END { exit !(seen && !avx512) }
|
|
20
|
+
' /proc/cpuinfo; then
|
|
21
|
+
echo "Release load verification requires a Linux x64 runner without AVX-512." >&2
|
|
22
|
+
exit 1
|
|
23
|
+
fi
|
|
24
|
+
echo "Linux x64 runner without AVX-512 at $(git rev-parse HEAD)"
|
|
25
|
+
|
|
26
|
+
# Validate all committed bytes before executing any of them.
|
|
27
|
+
node "$package/scripts/prebuilt-manifest.mjs" check --all-present
|
|
28
|
+
node "$package/scripts/ensure-prebuilt-sonames.mjs" --check --load
|
|
29
|
+
node "$package/scripts/check-prebuilts.mjs" --all-present
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Check shipped native files for hosted CI workspace prefixes. Binary changes
|
|
3
|
+
// need format-specific tooling and signature verification before promotion.
|
|
4
|
+
// node scripts/scrub-gha-workspace-paths.mjs --check [<file-or-dir>...]
|
|
5
|
+
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
6
|
+
import { join, relative } from 'node:path';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
|
|
9
|
+
import { PACKAGE_DIR } from './binding-digest.mjs';
|
|
10
|
+
import { PREBUILT_ROOT, RUNTIME_FILE_PATTERN, SHIPPED_TRIPLETS } from './prebuilt-manifest.mjs';
|
|
11
|
+
|
|
12
|
+
// Equal-length neutral stand-ins (Mach-O/PE string tables stay aligned).
|
|
13
|
+
// Must NOT match personal-paths `/(Users|home)/<name>` or `X:\Users\<name>\`.
|
|
14
|
+
function equalLengthNeutral(from, posixStem) {
|
|
15
|
+
if (from.length < posixStem.length) {
|
|
16
|
+
throw new Error(`scrub stem too long for ${JSON.stringify(from)}`);
|
|
17
|
+
}
|
|
18
|
+
const to = posixStem + 'x'.repeat(from.length - posixStem.length);
|
|
19
|
+
if (to.length !== from.length) throw new Error('scrub pad failed');
|
|
20
|
+
return to;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const GHA_WORKSPACE_SCRUBS = Object.freeze(
|
|
24
|
+
['runner', 'runneradmin'].flatMap((account) =>
|
|
25
|
+
['/Users/', '/home/', 'C:/Users/', 'C:\\Users\\'].map((root) => {
|
|
26
|
+
const separator = root.at(-1);
|
|
27
|
+
const from = root + account + separator + 'work' + separator;
|
|
28
|
+
const stem = separator === '\\' ? 'C:\\tmp\\gvn\\work\\'
|
|
29
|
+
: root.startsWith('C:') ? 'C:/tmp/gvn/work/' : '/tmp/gvn/work/';
|
|
30
|
+
return Object.freeze({ from, to: equalLengthNeutral(from, stem) });
|
|
31
|
+
})),
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
function utf16lePattern(ascii) {
|
|
35
|
+
const out = Buffer.alloc(ascii.length * 2);
|
|
36
|
+
for (let i = 0; i < ascii.length; i++) out[i * 2] = ascii.charCodeAt(i);
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function scrubGithubActionsWorkspacePaths(input) {
|
|
41
|
+
let bytes = Buffer.from(input);
|
|
42
|
+
let replacements = 0;
|
|
43
|
+
for (const { from, to } of GHA_WORKSPACE_SCRUBS) {
|
|
44
|
+
const needles = [Buffer.from(from, 'utf8'), utf16lePattern(from)];
|
|
45
|
+
const reps = [Buffer.from(to, 'utf8'), utf16lePattern(to)];
|
|
46
|
+
for (let n = 0; n < needles.length; n++) {
|
|
47
|
+
const needle = needles[n];
|
|
48
|
+
const rep = reps[n];
|
|
49
|
+
let offset = 0;
|
|
50
|
+
for (;;) {
|
|
51
|
+
const at = bytes.indexOf(needle, offset);
|
|
52
|
+
if (at < 0) break;
|
|
53
|
+
rep.copy(bytes, at);
|
|
54
|
+
replacements++;
|
|
55
|
+
offset = at + rep.length;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return { bytes, replacements };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function runtimeFilesUnder(root) {
|
|
63
|
+
const out = [];
|
|
64
|
+
const walk = (dir) => {
|
|
65
|
+
for (const name of readdirSync(dir)) {
|
|
66
|
+
const path = join(dir, name);
|
|
67
|
+
const st = statSync(path);
|
|
68
|
+
if (st.isDirectory()) walk(path);
|
|
69
|
+
else if (RUNTIME_FILE_PATTERN.test(name)) out.push(path);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
walk(root);
|
|
73
|
+
return out.sort();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function defaultTargets() {
|
|
77
|
+
return SHIPPED_TRIPLETS.flatMap((triplet) => {
|
|
78
|
+
const dir = join(PREBUILT_ROOT, triplet);
|
|
79
|
+
return existsSync(dir) ? runtimeFilesUnder(dir) : [];
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function checkFiles(paths) {
|
|
84
|
+
const results = [];
|
|
85
|
+
for (const path of paths) {
|
|
86
|
+
const before = readFileSync(path);
|
|
87
|
+
const { replacements } = scrubGithubActionsWorkspacePaths(before);
|
|
88
|
+
results.push({
|
|
89
|
+
path: relative(PACKAGE_DIR, path) || path,
|
|
90
|
+
replacements,
|
|
91
|
+
changed: replacements > 0,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return results;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function main(argv) {
|
|
98
|
+
if (!argv.includes('--check')) {
|
|
99
|
+
throw new Error('Only --check is supported for native files');
|
|
100
|
+
}
|
|
101
|
+
const targets = argv.filter((a) => a !== '--check');
|
|
102
|
+
const paths = targets.length
|
|
103
|
+
? targets.flatMap((t) => (statSync(t).isDirectory() ? runtimeFilesUnder(t) : [t]))
|
|
104
|
+
: defaultTargets();
|
|
105
|
+
const results = checkFiles(paths);
|
|
106
|
+
const changed = results.filter((r) => r.changed);
|
|
107
|
+
for (const r of results) {
|
|
108
|
+
console.log(`${r.changed ? 'dirty' : 'clean'} ${r.replacements} ${r.path}`);
|
|
109
|
+
}
|
|
110
|
+
if (changed.length) {
|
|
111
|
+
console.error(`scrub-gha-workspace-paths: ${changed.length} file(s) still contain GHA /work/ prefixes`);
|
|
112
|
+
process.exit(1);
|
|
113
|
+
}
|
|
114
|
+
console.log(`scrub-gha-workspace-paths: ${changed.length} file(s) dirty, ${paths.length} scanned`);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1]) {
|
|
118
|
+
main(process.argv.slice(2));
|
|
119
|
+
}
|