glasspane-harness 0.14.2 → 0.14.5
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 +7 -7
- package/README.zh-CN.md +4 -4
- package/package.json +3 -3
- package/postinstall.mjs +87 -7
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
- [Two-way integration with iterate-harness](#two-way-integration-with-iterate-harness)
|
|
36
36
|
- [Documentation](#documentation)
|
|
37
37
|
- [Development](#development)
|
|
38
|
-
- [License
|
|
38
|
+
- [License and attribution](#license-and-attribution)
|
|
39
39
|
|
|
40
40
|
---
|
|
41
41
|
|
|
@@ -98,14 +98,14 @@ That is a measured claim, not a promise. The fork tracks upstream
|
|
|
98
98
|
[anomalyco/opencode](https://github.com/anomalyco/opencode) at a pinned tag, and
|
|
99
99
|
`harness/tools/fork-diff.mjs` compares every file in this tree against that tag on every
|
|
100
100
|
change. The ruler prints its own line — this is that line, verbatim, against the golden
|
|
101
|
-
recorded 2026-
|
|
101
|
+
recorded 2026-11-08:
|
|
102
102
|
|
|
103
103
|
```
|
|
104
|
-
fork-diff vs v1.18.32:
|
|
104
|
+
fork-diff vs v1.18.32: 4630/6769 byte-identical, 294 edited, 137 added, 1708 deleted
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
-
Most of what upstream ships is still byte-for-byte upstream — 4,
|
|
108
|
-
|
|
107
|
+
Most of what upstream ships is still byte-for-byte upstream — 4,630 of its 6,632 files. The
|
|
108
|
+
294 edits are concentrated in config/paths/branding, the `gp_*` tool surface, the kernel
|
|
109
109
|
binding, the compaction hook, and the packaging scripts. The deleted files are upstream's own
|
|
110
110
|
publish plumbing for channels this product does not use (ghcr images, AUR, a Homebrew tap, a
|
|
111
111
|
hosted console account) — plus, in 0.4.0, the first-party account surface described below.
|
|
@@ -157,7 +157,7 @@ npm install -g glasspane-harness
|
|
|
157
157
|
bun add -g glasspane-harness
|
|
158
158
|
|
|
159
159
|
# or one-click (npm first, GitHub release asset as fallback)
|
|
160
|
-
curl -fsSL https://raw.githubusercontent.com/jingzhao-l/glasspane-harness/v0.14.
|
|
160
|
+
curl -fsSL https://raw.githubusercontent.com/jingzhao-l/glasspane-harness/v0.14.5/scripts/install.sh | bash
|
|
161
161
|
```
|
|
162
162
|
|
|
163
163
|
Two commands are installed: **`glasspane-harness`** and the short alias **`gp-harness`**. npm and
|
|
@@ -328,7 +328,7 @@ fork-diff, kernel-pin, tool-surface, surface-semantics, product-surface,
|
|
|
328
328
|
brand-surface); their rationale, negative controls and known boundaries are documented in
|
|
329
329
|
`harness/README.md`. Every customisation commit carries the `[gp]` prefix.
|
|
330
330
|
|
|
331
|
-
## License
|
|
331
|
+
## License and attribution
|
|
332
332
|
|
|
333
333
|
MIT, like upstream. `LICENSE` is upstream's, unchanged; [`NOTICE`](NOTICE) records what
|
|
334
334
|
this fork changed and where the code came from. Upstream:
|
package/README.zh-CN.md
CHANGED
|
@@ -87,13 +87,13 @@ SDK 与 plugin API。为了塞下内核,没有任何功能被砍掉。
|
|
|
87
87
|
这句话是**量出来的**,不是承诺。分叉锚定上游
|
|
88
88
|
[anomalyco/opencode](https://github.com/anomalyco/opencode) 的某个 tag,
|
|
89
89
|
`harness/tools/fork-diff.mjs` 每次改动都会把本树与那个 tag 逐文件对比。那把尺子自己打出的就是
|
|
90
|
-
下面这一行——原样照抄,对着 2026-
|
|
90
|
+
下面这一行——原样照抄,对着 2026-11-08 记录的金样:
|
|
91
91
|
|
|
92
92
|
```
|
|
93
|
-
fork-diff vs v1.18.32:
|
|
93
|
+
fork-diff vs v1.18.32: 4630/6769 byte-identical, 294 edited, 137 added, 1708 deleted
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
上游发来的 6,632 个文件里 4,
|
|
96
|
+
上游发来的 6,632 个文件里 4,630 个仍逐字节保持上游原样。改动(294 个)集中在 config/paths/品牌、
|
|
97
97
|
`gp_*` 工具面、内核绑定、压缩钩子和打包脚本;删掉的是上游**自己的**发布管道(ghcr 镜像、AUR、
|
|
98
98
|
Homebrew tap、托管 console 账号)——外加 0.4.0 里下面说的第一方账号面。
|
|
99
99
|
|
|
@@ -135,7 +135,7 @@ Azure、OpenRouter 等等全在——几百个模型——每一个都用**你
|
|
|
135
135
|
```bash
|
|
136
136
|
npm install -g glasspane-harness # 推荐
|
|
137
137
|
bun add -g glasspane-harness
|
|
138
|
-
curl -fsSL https://raw.githubusercontent.com/jingzhao-l/glasspane-harness/v0.14.
|
|
138
|
+
curl -fsSL https://raw.githubusercontent.com/jingzhao-l/glasspane-harness/v0.14.5/scripts/install.sh | bash
|
|
139
139
|
```
|
|
140
140
|
|
|
141
141
|
会装出两个命令:**`glasspane-harness`** 与短别名 **`gp-harness`**。npm 与 bun 从 wrapper 的
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"scripts": {
|
|
26
26
|
"postinstall": "node ./postinstall.mjs"
|
|
27
27
|
},
|
|
28
|
-
"version": "0.14.
|
|
28
|
+
"version": "0.14.5",
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"os": [
|
|
31
31
|
"darwin"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"sideEffects": false,
|
|
46
46
|
"optionalDependencies": {
|
|
47
|
-
"glasspane-harness-darwin-arm64": "0.14.
|
|
48
|
-
"glasspane-harness-darwin-x64": "0.14.
|
|
47
|
+
"glasspane-harness-darwin-arm64": "0.14.5",
|
|
48
|
+
"glasspane-harness-darwin-x64": "0.14.5"
|
|
49
49
|
}
|
|
50
50
|
}
|
package/postinstall.mjs
CHANGED
|
@@ -357,23 +357,92 @@ function installPackage(name) {
|
|
|
357
357
|
console.error(`the package this run fetched is ${fetched.name}@${fetched.version}, not ${name}@${version} — refusing it`)
|
|
358
358
|
return false
|
|
359
359
|
}
|
|
360
|
-
|
|
361
|
-
return
|
|
360
|
+
// The placement, not `true`: the caller has to be able to undo exactly what this line did.
|
|
361
|
+
return copyBinary(path.join(packageDir, "bin", sourceBinary), targetBinary)
|
|
362
362
|
} finally {
|
|
363
363
|
fs.rmSync(temp, { recursive: true, force: true })
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
366
|
|
|
367
|
+
/**
|
|
368
|
+
* Place the resolved bytes at `target`, and hand back what THIS run can undo.
|
|
369
|
+
*
|
|
370
|
+
* Two measured hazards live in these lines.
|
|
371
|
+
*
|
|
372
|
+
* The leaf (measured 2026-11-06): `fs.existsSync` answers FALSE for a dangling symlink, so the old
|
|
373
|
+
* `existsSync → unlinkSync` guard left a stale link in place; `linkSync` then threw EEXIST, the
|
|
374
|
+
* catch's `copyFileSync` wrote THROUGH the link to whatever it points at, and `chmodSync` chmodded
|
|
375
|
+
* that file too. This project's own installer already refuses that class (`installer/cli.js`,
|
|
376
|
+
* "chmod 不许穿过叶子链接"), so the decision is made from `lstatSync`, on the leaf itself, and only an
|
|
377
|
+
* existing REGULAR file may be replaced.
|
|
378
|
+
*
|
|
379
|
+
* The undo (measured the same day, and the reason this returns something): `main()` placed first
|
|
380
|
+
* and verified after, and when the check failed it moved on with the unverified bytes still sitting
|
|
381
|
+
* at `targetBinary` — the command the user then ran was exactly the build this run had declared
|
|
382
|
+
* wrong. `undo()` removes only the file this run placed and, by rename rather than by rewriting,
|
|
383
|
+
* puts back the regular file that was here before, so a refused install leaves no executable behind
|
|
384
|
+
* without destroying what this run did not create. `commit()` drops that backup once a check has
|
|
385
|
+
* passed.
|
|
386
|
+
*/
|
|
367
387
|
function copyBinary(source, target) {
|
|
368
388
|
if (!fs.existsSync(source)) throw new Error(`Binary not found at ${source}`)
|
|
369
389
|
fs.mkdirSync(path.dirname(target), { recursive: true })
|
|
370
|
-
|
|
390
|
+
refuseLeaf(target)
|
|
391
|
+
const backup = fs.existsSync(target) ? `${target}.previous-install` : null
|
|
392
|
+
if (backup !== null) fs.renameSync(target, backup)
|
|
371
393
|
try {
|
|
372
394
|
fs.linkSync(source, target)
|
|
373
395
|
} catch {
|
|
374
396
|
fs.copyFileSync(source, target)
|
|
375
397
|
}
|
|
376
398
|
fs.chmodSync(target, 0o755)
|
|
399
|
+
return { undo: () => undoPlacement(target, backup), commit: () => commitPlacement(backup) }
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Anything at `target` that `lstat` cannot call a regular file is refused before one byte is
|
|
404
|
+
* written or chmodded, because both operations follow a link out of the tree. No later candidate
|
|
405
|
+
* can work around this: `targetBinary` is the same path for every name.
|
|
406
|
+
*/
|
|
407
|
+
function refuseLeaf(target) {
|
|
408
|
+
let leaf
|
|
409
|
+
try {
|
|
410
|
+
leaf = fs.lstatSync(target)
|
|
411
|
+
} catch (error) {
|
|
412
|
+
if (error.code === "ENOENT") return
|
|
413
|
+
throw new Error(
|
|
414
|
+
`${target} has no readable leaf (${error instanceof Error ? error.message : String(error)}): it cannot be shown not to be a symbolic link, so nothing was written and nothing was chmod-ed`,
|
|
415
|
+
)
|
|
416
|
+
}
|
|
417
|
+
if (leaf.isFile()) return
|
|
418
|
+
const where = leaf.isSymbolicLink() ? `a symbolic link to ${readLink(target)}` : "not a regular file"
|
|
419
|
+
throw new Error(`${target} is ${where} — refusing to write or chmod through it; nothing was written and nothing was removed`)
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
function readLink(target) {
|
|
423
|
+
try {
|
|
424
|
+
return fs.readlinkSync(target)
|
|
425
|
+
} catch {
|
|
426
|
+
return "a target that cannot be read"
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
function undoPlacement(target, backup) {
|
|
431
|
+
// Never follow a leaf swapped in after the placement: `unlink` on the link would be a removal this
|
|
432
|
+
// run did not make, so only a regular file this run created is removed.
|
|
433
|
+
let leaf
|
|
434
|
+
try {
|
|
435
|
+
leaf = fs.lstatSync(target)
|
|
436
|
+
} catch {
|
|
437
|
+
leaf = null
|
|
438
|
+
}
|
|
439
|
+
if (leaf !== null && leaf.isFile()) fs.unlinkSync(target)
|
|
440
|
+
if (backup !== null) fs.renameSync(backup, target)
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
function commitPlacement(backup) {
|
|
444
|
+
if (backup === null) return
|
|
445
|
+
fs.rmSync(backup, { force: true })
|
|
377
446
|
}
|
|
378
447
|
|
|
379
448
|
/**
|
|
@@ -417,16 +486,27 @@ function main() {
|
|
|
417
486
|
// What each candidate actually answered, kept so the final refusal can name the observation
|
|
418
487
|
// instead of blaming the package manager for something it may have delivered correctly.
|
|
419
488
|
const seen = []
|
|
489
|
+
// Every placement is undone when the check that follows it fails: `targetBinary` is the command
|
|
490
|
+
// the user runs next, so bytes this run refused must not be sitting on it.
|
|
420
491
|
for (const name of names) {
|
|
421
492
|
try {
|
|
422
|
-
copyBinary(resolveBinary(name), targetBinary)
|
|
493
|
+
const placement = copyBinary(resolveBinary(name), targetBinary)
|
|
423
494
|
const check = verifyBinary(expected)
|
|
424
|
-
if (check.ok)
|
|
495
|
+
if (check.ok) {
|
|
496
|
+
placement.commit()
|
|
497
|
+
return
|
|
498
|
+
}
|
|
499
|
+
placement.undo()
|
|
425
500
|
seen.push(`${name}: ${check.detail}`)
|
|
426
501
|
} catch (error) {
|
|
427
|
-
|
|
502
|
+
const placement = installPackage(name)
|
|
503
|
+
if (placement) {
|
|
428
504
|
const check = verifyBinary(expected)
|
|
429
|
-
if (check.ok)
|
|
505
|
+
if (check.ok) {
|
|
506
|
+
placement.commit()
|
|
507
|
+
return
|
|
508
|
+
}
|
|
509
|
+
placement.undo()
|
|
430
510
|
seen.push(`${name}: ${check.detail}`)
|
|
431
511
|
} else {
|
|
432
512
|
seen.push(`${name}: not installable here (${error instanceof Error ? error.message : "unknown failure"})`)
|