glasspane-harness 0.14.1 → 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 +15 -10
- package/README.zh-CN.md +9 -6
- 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
|
|
@@ -275,9 +275,12 @@ What stays where it belongs: the engine decides what the application did; neithe
|
|
|
275
275
|
an interface on its own. The gate reports and withholds — it does not run the recipe, because
|
|
276
276
|
neither product ships a recipe executor. The formats above come from one published contract
|
|
277
277
|
layer, [`iterate-kernel`](https://www.npmjs.com/package/iterate-kernel), and the boundary is
|
|
278
|
-
stated honestly:
|
|
279
|
-
|
|
280
|
-
CI step
|
|
278
|
+
stated honestly: `bun script/kernel-conformance.mjs --impl <canonical checkout>` runs both
|
|
279
|
+
implementations over the *pinned* corpus and requires byte-identical answers, and nothing in this
|
|
280
|
+
repository — no CI step, no operator command — compares the two on a case the corpus never wrote down.
|
|
281
|
+
The sentence that used to live here named `scripts/diff_kernel_implementations.py`, a file that exists
|
|
282
|
+
in neither this fork nor the canonical kernel checkout, which made it a pointer to nowhere rather than a
|
|
283
|
+
boundary. The exchange from the loop's side is documented in the iterate-harness README
|
|
281
284
|
([Two-way integration with GlassPane](https://github.com/jingzhao-l/iterate-harness#-two-way-integration-with-glasspane)),
|
|
282
285
|
and from the engine's side in [GlassPane's two-way integration section](https://github.com/jingzhao-l/GlassPane#two-way-integration-with-the-review-loop).
|
|
283
286
|
Implementation detail: [`docs/kernel-integration.md`](docs/kernel-integration.md) and
|
|
@@ -285,6 +288,8 @@ Implementation detail: [`docs/kernel-integration.md`](docs/kernel-integration.md
|
|
|
285
288
|
|
|
286
289
|
## Documentation
|
|
287
290
|
|
|
291
|
+
- [`docs/index.md`](docs/index.md) — the page map and the four laws; every other page in this
|
|
292
|
+
directory is linked from it
|
|
288
293
|
- [`docs/install.md`](docs/install.md) — install paths, permissions, verification
|
|
289
294
|
- [`docs/models-and-keys.md`](docs/models-and-keys.md) — the model catalog and how to supply
|
|
290
295
|
your own API keys
|
|
@@ -323,7 +328,7 @@ fork-diff, kernel-pin, tool-surface, surface-semantics, product-surface,
|
|
|
323
328
|
brand-surface); their rationale, negative controls and known boundaries are documented in
|
|
324
329
|
`harness/README.md`. Every customisation commit carries the `[gp]` prefix.
|
|
325
330
|
|
|
326
|
-
## License
|
|
331
|
+
## License and attribution
|
|
327
332
|
|
|
328
333
|
MIT, like upstream. `LICENSE` is upstream's, unchanged; [`NOTICE`](NOTICE) records what
|
|
329
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 的
|
|
@@ -230,8 +230,10 @@ GlassPane Harness 是第二对产品里的一半。引擎回答"这次操作到
|
|
|
230
230
|
各归各位:应用做了什么由引擎判定,两个 harness 都不自行给界面下结论。闸只报与拦,不执行配方——
|
|
231
231
|
两个产品都没有配方执行器。上面这些格式来自同一份发布出去的契约层
|
|
232
232
|
[`iterate-kernel`](https://www.npmjs.com/package/iterate-kernel),边界也说清楚:
|
|
233
|
-
|
|
234
|
-
|
|
233
|
+
`bun script/kernel-conformance.mjs --impl <canonical checkout>` 会让两份实现对同一份**钉住的**语料
|
|
234
|
+
给出逐字节相同的答案;语料没写过的案子,这个仓里没有任何东西(CI 步骤或操作者命令)去比对两份实现。
|
|
235
|
+
原先这里写的是 `scripts/diff_kernel_implementations.py`——那个文件在本 fork 与 canonical 内核检出里
|
|
236
|
+
都不存在,所以它不是一条边界,是一个指向别处的指针。回路那一侧的说明见 iterate-harness README 的
|
|
235
237
|
[与 GlassPane 的双向集成](https://github.com/jingzhao-l/iterate-harness/blob/main/README.zh-CN.md#-与-glasspane-的双向集成),
|
|
236
238
|
引擎那一侧见 [GlassPane 的双向集成小节](https://github.com/jingzhao-l/GlassPane#two-way-integration-with-the-review-loop)。
|
|
237
239
|
实现细节:[`docs/kernel-integration.md`](docs/kernel-integration.md) 与
|
|
@@ -239,6 +241,7 @@ GlassPane Harness 是第二对产品里的一半。引擎回答"这次操作到
|
|
|
239
241
|
|
|
240
242
|
## 文档
|
|
241
243
|
|
|
244
|
+
- [`docs/index.md`](docs/index.md) — 页面索引与四条铁律;这个目录里每一页都由它连出去
|
|
242
245
|
- [`docs/install.md`](docs/install.md) — 安装通道、权限、自检
|
|
243
246
|
- [`docs/models-and-keys.md`](docs/models-and-keys.md) — 模型目录,以及怎么把你自己的 API key
|
|
244
247
|
交进去
|
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"})`)
|