harnessed 5.0.13 → 5.0.15
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/CHANGELOG.md +23 -1
- package/README-zh.md +0 -28
- package/README.md +0 -28
- package/bin/harnessed-update-reminder-worker.mjs +231 -27
- package/bin/harnessed-update-reminder.mjs +32 -11
- package/dist/cli.mjs +171 -33
- package/dist/cli.mjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/schemas/index.mjs +3 -0
- package/dist/schemas/index.mjs.map +1 -1
- package/manifests/skill-packs/design-taste-frontend.yaml +9 -0
- package/manifests/skill-packs/gsd.yaml +10 -3
- package/manifests/tools/playwright-test.yaml +8 -0
- package/manifests/tools/webapp-testing.yaml +8 -0
- package/package.json +1 -2
- package/schemas/manifest.v1.schema.json +8 -0
- package/README-en.md +0 -660
package/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,29 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [
|
|
8
|
+
## [5.0.15] - 2026-11-09
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- `harnessed setup` can now update the components it installed, instead of refusing every one of them. Since v5.0.0 the force-update pass refused to replace anything whose existing source it could not prove: a skill pack, a marketplace plugin or a cloned checkout was kept exactly as it was, and the summary then told the user to re-run setup later — advice that could never work, because the same proof would fail again. The refusal itself was right; what was missing was the other half, a way to prove ownership. A skill pack now refreshes when its manifest declares the footprint it owns and every existing entry in that footprint passes the manifest's own marker check; a marketplace plugin refreshes when the host's plugin registry holds it under the exact qualified identity the install command installs (`name@marketplace`), which is the same source the official `claude plugin install` upgrades from; a cloned component refreshes when the checkout's git origin is the URL the manifest clones from. Everything that does not prove out is still refused: an undeclared source, a look-alike directory carrying somebody else's marker, a plugin registered under a different marketplace, a checkout whose origin points elsewhere, a pack whose declaration does not cover every skill it claims to install.
|
|
13
|
+
- A force update no longer fails on the ownership receipt it writes itself. The receipt records the paths an install created, so a refresh — which creates nothing new — had nothing to record, and the install failed on its own empty receipt. An authorized refresh now records the footprint it just proved, which is what it owns.
|
|
14
|
+
- The GSD pack's ownership declaration now matches what the pack actually ships. Its marker demanded the literal text `gsd-core` from every skill, agent and command it owns, and nine of its own skills plus four of its own agents never contain that text — so the declaration proved nothing and the pack was refused exactly like an undeclared one. The marker is now the artifact's own `gsd-` identity, which every file the declaration admits carries on both hosts.
|
|
15
|
+
- The update summary no longer promises a retry that cannot succeed. A component kept because its source is not provably ours is now reported as such, with the upstream tool named as the way to update it; the "re-run setup later" hint is kept only for the failures a retry can actually fix.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Global npm tools (`ctx7`, `playwright-cli`) now take part in the force-update pass. They were excluded from it because a global npm install is a system-scope change and the system-scope gate asked for a flag the force pass never passes — so those two tools could never be updated by harnessed at all. The force pass is an explicit request to update the components that are already installed, and `npm install -g <pkg>` is the official upgrade path of a globally installed CLI: it writes into the npm global prefix, which is scoped per package name rather than a shared namespace. The force pass therefore runs that command for those components, and the confirmation prompt names them and the scope change before it starts. A tool the force pass upgraded is not offered a second time by the L4 rescue. The normal install pass is unchanged — installing a global tool still needs the explicit system-scope opt-in, and the documented `harnessed setup --system --non-interactive --update-installed` path still works as before.
|
|
20
|
+
- The manifest ownership contract learned a fifth root. A skill the `skills` CLI installs without `--global` lives in `~/.agents/skills` and is linked into the host's skills directory, and the link was deliberately invisible to the ownership check, because a link can point anywhere. The ownership roots now include `agents-skills`, so a manifest can declare the real files of such a pack; the `design-taste-frontend` pack does exactly that.
|
|
21
|
+
|
|
22
|
+
## [5.0.14] - 2026-11-09
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- The update reminder no longer goes silent when one version check fails. The check itself was the fragile part: the binary channel asked the GitHub releases API and nothing else, so a timeout, a rate limit or a blocked host turned "a newer version exists" into "we could not determine" and the reminder printed nothing for the next day. The probe now asks GitHub first (the authoritative source for the downloadable assets) and falls back to the npm registry over plain HTTP, and it reports the reason it failed so a rate-limited probe can be told apart from an unreachable network. A failed check also no longer erases what was already known: the last successful observation is kept and marked as last known, so one bad network moment leaves the reminder in place instead of deleting it. Only a machine that never managed a single successful check stays silent, and the next check then happens within the hour rather than after a day.
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- The README set no longer ships a second English copy. `README-en.md` was a compatibility mirror of `README.md` that no locale linked to and that had to be kept in step by hand, so it is removed, and the documentation contract now pins the ten locales that actually exist. The installation section of every README also documents one channel only — the standalone binary — instead of three, so the page a reader lands on names the same install path on every host. The npm and bun channels are unchanged in the product: the install scripts still fall back to them on unsupported platforms, `harnessed update` still updates an npm install in place, and the npm package is still published.
|
|
9
31
|
|
|
10
32
|
## [5.0.13] - 2026-11-08
|
|
11
33
|
|
package/README-zh.md
CHANGED
|
@@ -32,34 +32,6 @@ irm https://raw.githubusercontent.com/easyinplay/harnessed/main/install.ps1 | ie
|
|
|
32
32
|
|
|
33
33
|
> 独立二进制内嵌 runtime,harnessed 自身不需要外部 Node.js 或 Bun;上游组件仍可能要求 Node/npm、Git、Bun、Python 或浏览器系统库。
|
|
34
34
|
|
|
35
|
-
二进制安装脚本在交互会话中征得同意后提供 setup。成功完成后无需重复;若跳过、失败或使用非交互安装,请运行 `harnessed setup`。
|
|
36
|
-
|
|
37
|
-
`harnessed setup` 默认安装 cache-only **SessionStart 更新提醒**。其 foreground 路径只读取有大小上限的本地 cache:零网络请求、零文件系统 mutation,失败时静默退出 `0`。仅在 cache 表明有可用更新时显示提醒;cache 缺失或过期时可启动 detached background worker 刷新版本信息,不会安装更新。Codex 使用 local plugin,可能需要用户批准 trust;setup 不会自动授予 trust。
|
|
38
|
-
|
|
39
|
-
`harnessed setup --no-update-reminder` 持久禁用提醒,后续 setup/update 会保留该选择。重新启用时,删除对应的 `update-reminder-preferences.json`,再运行 `harnessed setup`。Claude Code 默认路径为 `~/.claude/harnessed/update-reminder-preferences.json`,Codex 默认路径为 `~/.codex/harnessed/update-reminder-preferences.json`;若使用 `CLAUDE_CONFIG_DIR`、`CODEX_HOME` 或 `HARNESSED_ROOT_OVERRIDE`,则使用对应 reminder state root 下的文件。
|
|
40
|
-
|
|
41
|
-
**通过 Bun 安装 (次要推荐; 可选)**:
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
bun install -g harnessed && bun run --bun harnessed setup
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
后续 Bun 命令请使用 `bun run --bun harnessed`;裸 `harnessed` shim 仍可能调用 Node.js。
|
|
48
|
-
|
|
49
|
-
**npm 仍受支持** (需要 Node.js >= 22):
|
|
50
|
-
|
|
51
|
-
此渠道不需要 Bun,继续兼容 Node.js >= 22。
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
npm install -g harnessed && harnessed setup
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
> Windows PowerShell 5.x 不支持 `&&`。两个 package 渠道都应先执行安装命令,成功后再单独执行 setup。bash / zsh / PowerShell 7+ / cmd.exe 支持此 chain。
|
|
58
|
-
|
|
59
|
-
> [!TIP]
|
|
60
|
-
> 🚀 **很多人喜爱的 Agent Teams 和 Subagent 功能,在 harnessed 中会根据任务自动启用!**
|
|
61
|
-
> 无需手动配置 `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` —— `harnessed setup` 会自动写入 `~/.claude/settings.json`。Pattern A 全栈三路 / Pattern C 4-specialist 等 multi-agent workflow 即开即用。
|
|
62
|
-
|
|
63
35
|
---
|
|
64
36
|
|
|
65
37
|
## ⏱️ First 5 Minutes
|
package/README.md
CHANGED
|
@@ -32,34 +32,6 @@ irm https://raw.githubusercontent.com/easyinplay/harnessed/main/install.ps1 | ie
|
|
|
32
32
|
|
|
33
33
|
> The standalone binary embeds its runtime: harnessed itself needs neither external Node.js nor Bun. Upstream components may still require Node/npm, Git, Bun, Python, or browser system libraries.
|
|
34
34
|
|
|
35
|
-
The binary installer offers setup with your consent in interactive sessions. Do not repeat it if it completed successfully. If setup was skipped or failed, or you installed noninteractively, run `harnessed setup`.
|
|
36
|
-
|
|
37
|
-
`harnessed setup` installs a cache-only **SessionStart update reminder** by default. Its foreground path only reads a bounded local cache: zero network requests, zero filesystem mutation, and fail-soft exit `0`. It only displays a reminder for a cached available update; missing or stale cache may launch a detached background worker to refresh version information, never to install updates. Codex uses a local plugin and may require user trust approval; setup does not grant trust automatically.
|
|
38
|
-
|
|
39
|
-
`harnessed setup --no-update-reminder` persistently disables the reminder; later setup/update runs preserve that choice. To re-enable it, delete the corresponding `update-reminder-preferences.json` and run `harnessed setup` again. Default locations are `~/.claude/harnessed/update-reminder-preferences.json` for Claude Code and `~/.codex/harnessed/update-reminder-preferences.json` for Codex; when using `CLAUDE_CONFIG_DIR`, `CODEX_HOME`, or `HARNESSED_ROOT_OVERRIDE`, use the corresponding reminder state root instead.
|
|
40
|
-
|
|
41
|
-
**Via Bun (secondary recommendation; optional)**:
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
bun install -g harnessed && bun run --bun harnessed setup
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
For later Bun commands, use `bun run --bun harnessed`; the bare `harnessed` shim may still invoke Node.js.
|
|
48
|
-
|
|
49
|
-
**Via npm (supported alternative; Node.js >= 22 required)**:
|
|
50
|
-
|
|
51
|
-
Bun is not required for this channel; Node.js >= 22 remains supported.
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
npm install -g harnessed && harnessed setup
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
> Windows PowerShell 5.x does not support `&&`. For either package channel, run the install command first, then run setup only if installation succeeds. bash / zsh / PowerShell 7+ / cmd.exe support the chain.
|
|
58
|
-
|
|
59
|
-
> [!TIP]
|
|
60
|
-
> 🚀 **The much-loved Agent Teams and Subagent features are auto-enabled in harnessed based on the task!**
|
|
61
|
-
> No need to manually configure `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` — `harnessed setup` writes it to `~/.claude/settings.json` automatically. Pattern A full-stack three-way / Pattern C 4-specialist and other multi-agent workflows work out of the box.
|
|
62
|
-
|
|
63
35
|
---
|
|
64
36
|
|
|
65
37
|
## ⏱️ First 5 Minutes
|
|
@@ -65,7 +65,7 @@ var init_package = __esm({
|
|
|
65
65
|
'package.json'() {
|
|
66
66
|
package_default = {
|
|
67
67
|
name: 'harnessed',
|
|
68
|
-
version: '5.0.
|
|
68
|
+
version: '5.0.15',
|
|
69
69
|
description: 'AI coding harness package manager + composition orchestrator',
|
|
70
70
|
type: 'module',
|
|
71
71
|
license: 'Apache-2.0',
|
|
@@ -118,7 +118,6 @@ var init_package = __esm({
|
|
|
118
118
|
'schemas',
|
|
119
119
|
'CHANGELOG.md',
|
|
120
120
|
'README.md',
|
|
121
|
-
'README-en.md',
|
|
122
121
|
'README-zh.md',
|
|
123
122
|
'LICENSE',
|
|
124
123
|
'NOTICE',
|
|
@@ -745,6 +744,9 @@ var init_autoUpdateNotice = __esm({
|
|
|
745
744
|
|
|
746
745
|
// src/cli/lib/updateReminderCache.ts
|
|
747
746
|
import fs from 'node:fs'
|
|
747
|
+
function isReminderProbeFailure(value) {
|
|
748
|
+
return typeof value === 'string' && REMINDER_PROBE_FAILURES.includes(value)
|
|
749
|
+
}
|
|
748
750
|
function isReminderVersion(value) {
|
|
749
751
|
return (
|
|
750
752
|
typeof value === 'string' &&
|
|
@@ -768,7 +770,7 @@ function parseCache(text, identity, now) {
|
|
|
768
770
|
return null
|
|
769
771
|
}
|
|
770
772
|
}
|
|
771
|
-
const { installed: installed2, latest, state, checkedAt, retryAfter } = cache2
|
|
773
|
+
const { installed: installed2, latest, state, checkedAt, retryAfter, stale, lastError } = cache2
|
|
772
774
|
if (
|
|
773
775
|
!isReminderVersion(installed2) ||
|
|
774
776
|
typeof checkedAt !== 'number' ||
|
|
@@ -780,14 +782,18 @@ function parseCache(text, identity, now) {
|
|
|
780
782
|
retryAfter < 0
|
|
781
783
|
)
|
|
782
784
|
return null
|
|
785
|
+
if (stale !== void 0 && typeof stale !== 'boolean') return null
|
|
786
|
+
if (lastError !== void 0 && !isReminderProbeFailure(lastError)) return null
|
|
783
787
|
if (state === 'unknown') {
|
|
784
788
|
if (latest !== null || retryAfter !== checkedAt + REMINDER_RETRY_MS) return null
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
!isReminderVersion(latest)
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
789
|
+
if (stale === true) return null
|
|
790
|
+
} else {
|
|
791
|
+
if (!['behind', 'current', 'ahead'].includes(state ?? '') || !isReminderVersion(latest))
|
|
792
|
+
return null
|
|
793
|
+
if (stale === true) {
|
|
794
|
+
if (retryAfter <= checkedAt) return null
|
|
795
|
+
} else if (retryAfter !== 0) return null
|
|
796
|
+
}
|
|
791
797
|
return {
|
|
792
798
|
schemaVersion: 1,
|
|
793
799
|
identity: { ...identity },
|
|
@@ -796,6 +802,8 @@ function parseCache(text, identity, now) {
|
|
|
796
802
|
state,
|
|
797
803
|
checkedAt,
|
|
798
804
|
retryAfter,
|
|
805
|
+
...(stale === true ? { stale: true } : {}),
|
|
806
|
+
...(lastError !== void 0 ? { lastError } : {}),
|
|
799
807
|
}
|
|
800
808
|
}
|
|
801
809
|
function readReminderCache(cachePath, identity, now = Date.now()) {
|
|
@@ -821,9 +829,14 @@ function readReminderCache(cachePath, identity, now = Date.now()) {
|
|
|
821
829
|
function shouldRefreshReminder(cache2, now) {
|
|
822
830
|
if (!cache2) return true
|
|
823
831
|
if (cache2.retryAfter > now) return false
|
|
832
|
+
if (cache2.stale === true) return true
|
|
824
833
|
return cache2.state === 'unknown' || now - cache2.checkedAt >= REMINDER_TTL_MS
|
|
825
834
|
}
|
|
826
|
-
var REMINDER_TTL_MS,
|
|
835
|
+
var REMINDER_TTL_MS,
|
|
836
|
+
REMINDER_RETRY_MS,
|
|
837
|
+
REMINDER_MAX_BYTES,
|
|
838
|
+
REMINDER_LOCK_STALE_MS,
|
|
839
|
+
REMINDER_PROBE_FAILURES
|
|
827
840
|
var init_updateReminderCache = __esm({
|
|
828
841
|
'src/cli/lib/updateReminderCache.ts'() {
|
|
829
842
|
'use strict'
|
|
@@ -831,6 +844,13 @@ var init_updateReminderCache = __esm({
|
|
|
831
844
|
REMINDER_RETRY_MS = 60 * 60 * 1e3
|
|
832
845
|
REMINDER_MAX_BYTES = 16 * 1024
|
|
833
846
|
REMINDER_LOCK_STALE_MS = 3e4
|
|
847
|
+
REMINDER_PROBE_FAILURES = [
|
|
848
|
+
'github-rate-limited',
|
|
849
|
+
'github-timeout',
|
|
850
|
+
'github-unavailable',
|
|
851
|
+
'npm-unavailable',
|
|
852
|
+
'invalid-version',
|
|
853
|
+
]
|
|
834
854
|
},
|
|
835
855
|
})
|
|
836
856
|
|
|
@@ -4425,6 +4445,10 @@ function autoUpdateChannel(channel) {
|
|
|
4425
4445
|
}
|
|
4426
4446
|
return 'npm'
|
|
4427
4447
|
}
|
|
4448
|
+
function probeFailure(reason, channel) {
|
|
4449
|
+
if (isReminderProbeFailure(reason)) return reason
|
|
4450
|
+
return channel === 'binary' ? 'github-unavailable' : 'npm-unavailable'
|
|
4451
|
+
}
|
|
4428
4452
|
function resumeFragmentBytes(execPath, version) {
|
|
4429
4453
|
try {
|
|
4430
4454
|
return statSync2(join8(dirname6(execPath), `.harnessed-update-${version}.part`)).size
|
|
@@ -4518,9 +4542,10 @@ async function runUpdateReminderWorker(options) {
|
|
|
4518
4542
|
},
|
|
4519
4543
|
})
|
|
4520
4544
|
owned = true
|
|
4521
|
-
const
|
|
4522
|
-
if (!shouldRefreshReminder(
|
|
4545
|
+
const previous = readReminderCache(options.cachePath, options.identity, now())
|
|
4546
|
+
if (!shouldRefreshReminder(previous, now())) return 0
|
|
4523
4547
|
let latest = null
|
|
4548
|
+
let failure = null
|
|
4524
4549
|
try {
|
|
4525
4550
|
const observation = await Promise.race([
|
|
4526
4551
|
options.observe(controller.signal),
|
|
@@ -4532,10 +4557,23 @@ async function runUpdateReminderWorker(options) {
|
|
|
4532
4557
|
}),
|
|
4533
4558
|
])
|
|
4534
4559
|
if (isReminderVersion(observation.latest)) latest = observation.latest
|
|
4535
|
-
|
|
4560
|
+
else failure = probeFailure(observation.reason, options.identity.channel)
|
|
4561
|
+
} catch {
|
|
4562
|
+
failure = probeFailure(null, options.identity.channel)
|
|
4563
|
+
}
|
|
4564
|
+
let stale = false
|
|
4565
|
+
if (
|
|
4566
|
+
latest === null &&
|
|
4567
|
+
previous !== null &&
|
|
4568
|
+
previous.state !== 'unknown' &&
|
|
4569
|
+
previous.latest !== null
|
|
4570
|
+
) {
|
|
4571
|
+
latest = previous.latest
|
|
4572
|
+
stale = true
|
|
4573
|
+
}
|
|
4536
4574
|
const checkedAt = now()
|
|
4537
4575
|
const state = latest === null ? 'unknown' : compareVersions(options.installed, latest)
|
|
4538
|
-
if (state === 'behind' && latest !== null) autoUpdateTarget = latest
|
|
4576
|
+
if (state === 'behind' && latest !== null && !stale) autoUpdateTarget = latest
|
|
4539
4577
|
const result = {
|
|
4540
4578
|
schemaVersion: 1,
|
|
4541
4579
|
identity: { ...options.identity },
|
|
@@ -4543,7 +4581,11 @@ async function runUpdateReminderWorker(options) {
|
|
|
4543
4581
|
latest,
|
|
4544
4582
|
state,
|
|
4545
4583
|
checkedAt,
|
|
4546
|
-
|
|
4584
|
+
// A stale record asks for the next probe after ONE hour, not after the
|
|
4585
|
+
// 24 h TTL: the network may come back at any time.
|
|
4586
|
+
retryAfter: state === 'unknown' || stale ? checkedAt + REMINDER_RETRY_MS : 0,
|
|
4587
|
+
...(stale ? { stale: true } : {}),
|
|
4588
|
+
...(failure ? { lastError: failure } : {}),
|
|
4547
4589
|
}
|
|
4548
4590
|
const text = `${JSON.stringify(result)}
|
|
4549
4591
|
`
|
|
@@ -4578,6 +4620,169 @@ var init_updateReminderWorkerMain = __esm({
|
|
|
4578
4620
|
},
|
|
4579
4621
|
})
|
|
4580
4622
|
|
|
4623
|
+
// src/cli/lib/latestPublishedVersion.ts
|
|
4624
|
+
var latestPublishedVersion_exports = {}
|
|
4625
|
+
__export(latestPublishedVersion_exports, {
|
|
4626
|
+
PROBE_TIMEOUT_MS: () => PROBE_TIMEOUT_MS,
|
|
4627
|
+
probeLatestPublishedVersion: () => probeLatestPublishedVersion,
|
|
4628
|
+
})
|
|
4629
|
+
function isVersion(value) {
|
|
4630
|
+
return typeof value === 'string' && VERSION_PATTERN.test(value)
|
|
4631
|
+
}
|
|
4632
|
+
async function defaultFetchJson(url, init) {
|
|
4633
|
+
const response = await fetch(url, init)
|
|
4634
|
+
const headers = {}
|
|
4635
|
+
response.headers?.forEach((value, key) => {
|
|
4636
|
+
headers[key.toLowerCase()] = value
|
|
4637
|
+
})
|
|
4638
|
+
return {
|
|
4639
|
+
ok: response.ok,
|
|
4640
|
+
status: response.status,
|
|
4641
|
+
headers,
|
|
4642
|
+
json: () => response.json(),
|
|
4643
|
+
}
|
|
4644
|
+
}
|
|
4645
|
+
async function fetchJsonWithTimeout(fetchJson, url, timeoutMs, signal) {
|
|
4646
|
+
const controller = new AbortController()
|
|
4647
|
+
let timedOut = false
|
|
4648
|
+
let timer
|
|
4649
|
+
const onExternalAbort = () => controller.abort()
|
|
4650
|
+
if (signal) {
|
|
4651
|
+
if (signal.aborted) controller.abort()
|
|
4652
|
+
else signal.addEventListener('abort', onExternalAbort, { once: true })
|
|
4653
|
+
}
|
|
4654
|
+
try {
|
|
4655
|
+
const response = await Promise.race([
|
|
4656
|
+
fetchJson(url, {
|
|
4657
|
+
signal: controller.signal,
|
|
4658
|
+
headers: { 'user-agent': `harnessed/${package_default.version}` },
|
|
4659
|
+
}),
|
|
4660
|
+
new Promise((_, reject) => {
|
|
4661
|
+
timer = setTimeout(() => {
|
|
4662
|
+
timedOut = true
|
|
4663
|
+
controller.abort()
|
|
4664
|
+
reject(new ProbeTimeout())
|
|
4665
|
+
}, timeoutMs)
|
|
4666
|
+
}),
|
|
4667
|
+
])
|
|
4668
|
+
return { response, timedOut }
|
|
4669
|
+
} catch {
|
|
4670
|
+
return { timedOut }
|
|
4671
|
+
} finally {
|
|
4672
|
+
if (timer) clearTimeout(timer)
|
|
4673
|
+
if (signal) signal.removeEventListener('abort', onExternalAbort)
|
|
4674
|
+
}
|
|
4675
|
+
}
|
|
4676
|
+
async function isRateLimited(response) {
|
|
4677
|
+
if (response.headers?.['x-ratelimit-remaining'] === '0') return true
|
|
4678
|
+
try {
|
|
4679
|
+
const body = await response.json()
|
|
4680
|
+
const message = typeof body?.message === 'string' ? body.message.toLowerCase() : ''
|
|
4681
|
+
return message.includes('rate limit')
|
|
4682
|
+
} catch {
|
|
4683
|
+
return false
|
|
4684
|
+
}
|
|
4685
|
+
}
|
|
4686
|
+
async function probeGitHub(fetchJson, url, timeoutMs, signal) {
|
|
4687
|
+
if (signal?.aborted) {
|
|
4688
|
+
return { source: 'github', version: null, reason: 'github-unavailable' }
|
|
4689
|
+
}
|
|
4690
|
+
const { response, timedOut } = await fetchJsonWithTimeout(fetchJson, url, timeoutMs, signal)
|
|
4691
|
+
if (!response) {
|
|
4692
|
+
return {
|
|
4693
|
+
source: 'github',
|
|
4694
|
+
version: null,
|
|
4695
|
+
reason: timedOut ? 'github-timeout' : 'github-unavailable',
|
|
4696
|
+
}
|
|
4697
|
+
}
|
|
4698
|
+
if (!response.ok) {
|
|
4699
|
+
const rateLimited = await isRateLimited(response)
|
|
4700
|
+
return {
|
|
4701
|
+
source: 'github',
|
|
4702
|
+
version: null,
|
|
4703
|
+
reason: rateLimited ? 'github-rate-limited' : 'github-unavailable',
|
|
4704
|
+
}
|
|
4705
|
+
}
|
|
4706
|
+
let body
|
|
4707
|
+
try {
|
|
4708
|
+
body = await response.json()
|
|
4709
|
+
} catch {
|
|
4710
|
+
return { source: 'github', version: null, reason: 'invalid-version' }
|
|
4711
|
+
}
|
|
4712
|
+
const tag = body?.tag_name
|
|
4713
|
+
const version = typeof tag === 'string' ? tag.replace(/^v/, '') : ''
|
|
4714
|
+
if (!isVersion(version)) {
|
|
4715
|
+
return { source: 'github', version: null, reason: 'invalid-version' }
|
|
4716
|
+
}
|
|
4717
|
+
return { source: 'github', version, reason: null }
|
|
4718
|
+
}
|
|
4719
|
+
async function probeNpm(fetchJson, url, timeoutMs, signal) {
|
|
4720
|
+
if (signal?.aborted) {
|
|
4721
|
+
return { source: 'npm', version: null, reason: 'npm-unavailable' }
|
|
4722
|
+
}
|
|
4723
|
+
const { response } = await fetchJsonWithTimeout(fetchJson, url, timeoutMs, signal)
|
|
4724
|
+
if (!response) {
|
|
4725
|
+
return { source: 'npm', version: null, reason: 'npm-unavailable' }
|
|
4726
|
+
}
|
|
4727
|
+
if (!response.ok) {
|
|
4728
|
+
return { source: 'npm', version: null, reason: 'npm-unavailable' }
|
|
4729
|
+
}
|
|
4730
|
+
let body
|
|
4731
|
+
try {
|
|
4732
|
+
body = await response.json()
|
|
4733
|
+
} catch {
|
|
4734
|
+
return { source: 'npm', version: null, reason: 'invalid-version' }
|
|
4735
|
+
}
|
|
4736
|
+
const version = body?.version
|
|
4737
|
+
if (!isVersion(version)) {
|
|
4738
|
+
return { source: 'npm', version: null, reason: 'invalid-version' }
|
|
4739
|
+
}
|
|
4740
|
+
return { source: 'npm', version, reason: null }
|
|
4741
|
+
}
|
|
4742
|
+
function pickReason(github, npm) {
|
|
4743
|
+
if (github === 'github-rate-limited') return 'github-rate-limited'
|
|
4744
|
+
if (github === 'github-timeout') return 'github-timeout'
|
|
4745
|
+
if (github === 'github-unavailable') return 'github-unavailable'
|
|
4746
|
+
if (npm === 'npm-unavailable') return 'npm-unavailable'
|
|
4747
|
+
return 'invalid-version'
|
|
4748
|
+
}
|
|
4749
|
+
async function probeLatestPublishedVersion(deps = {}) {
|
|
4750
|
+
const fetchJson = deps.fetchJson ?? defaultFetchJson
|
|
4751
|
+
const ensureProxy = deps.ensureProxy ?? (() => ensureProxyDispatcher())
|
|
4752
|
+
const timeoutMs = deps.timeoutMs ?? PROBE_TIMEOUT_MS
|
|
4753
|
+
const githubUrl = deps.githubUrl ?? GITHUB_LATEST_URL
|
|
4754
|
+
const npmUrl = deps.npmUrl ?? NPM_LATEST_URL
|
|
4755
|
+
const signal = deps.signal
|
|
4756
|
+
try {
|
|
4757
|
+
await ensureProxy()
|
|
4758
|
+
} catch {}
|
|
4759
|
+
const github = await probeGitHub(fetchJson, githubUrl, timeoutMs, signal)
|
|
4760
|
+
if (github.version !== null) {
|
|
4761
|
+
return { latest: github.version, source: 'github', reason: null, github, npm: null }
|
|
4762
|
+
}
|
|
4763
|
+
try {
|
|
4764
|
+
await ensureProxy()
|
|
4765
|
+
} catch {}
|
|
4766
|
+
const npm = await probeNpm(fetchJson, npmUrl, timeoutMs, signal)
|
|
4767
|
+
if (npm.version !== null) {
|
|
4768
|
+
return { latest: npm.version, source: 'npm', reason: null, github, npm }
|
|
4769
|
+
}
|
|
4770
|
+
return { latest: null, source: null, reason: pickReason(github.reason, npm.reason), github, npm }
|
|
4771
|
+
}
|
|
4772
|
+
var PROBE_TIMEOUT_MS, GITHUB_LATEST_URL, NPM_LATEST_URL, VERSION_PATTERN, ProbeTimeout
|
|
4773
|
+
var init_latestPublishedVersion = __esm({
|
|
4774
|
+
'src/cli/lib/latestPublishedVersion.ts'() {
|
|
4775
|
+
'use strict'
|
|
4776
|
+
init_package()
|
|
4777
|
+
init_proxyDispatcher()
|
|
4778
|
+
PROBE_TIMEOUT_MS = 3e3
|
|
4779
|
+
GITHUB_LATEST_URL = 'https://api.github.com/repos/easyinplay/harnessed/releases/latest'
|
|
4780
|
+
NPM_LATEST_URL = 'https://registry.npmjs.org/harnessed/latest'
|
|
4781
|
+
VERSION_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/
|
|
4782
|
+
ProbeTimeout = class extends Error {}
|
|
4783
|
+
},
|
|
4784
|
+
})
|
|
4785
|
+
|
|
4581
4786
|
// src/compile/updateReminderEntrypoint.ts
|
|
4582
4787
|
import { createHash as createHash3 } from 'node:crypto'
|
|
4583
4788
|
init_package()
|
|
@@ -4697,24 +4902,23 @@ async function runUpdateReminderWorkerEntrypoint(options = {}) {
|
|
|
4697
4902
|
...runtime,
|
|
4698
4903
|
observe: async (signal) => {
|
|
4699
4904
|
if (runtime.identity.channel === 'binary') {
|
|
4700
|
-
const
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
return {
|
|
4707
|
-
latest: typeof value.tag_name === 'string' ? value.tag_name.replace(/^v/, '') : null,
|
|
4708
|
-
}
|
|
4905
|
+
const { probeLatestPublishedVersion: probeLatestPublishedVersion2 } =
|
|
4906
|
+
await Promise.resolve().then(
|
|
4907
|
+
() => (init_latestPublishedVersion(), latestPublishedVersion_exports),
|
|
4908
|
+
)
|
|
4909
|
+
const result = await probeLatestPublishedVersion2({ signal })
|
|
4910
|
+
return { latest: result.latest, reason: result.reason }
|
|
4709
4911
|
}
|
|
4710
4912
|
const {
|
|
4711
4913
|
fetchLatestBunVersion: fetchLatestBunVersion2,
|
|
4712
4914
|
fetchLatestNpmVersion: fetchLatestNpmVersion2,
|
|
4713
4915
|
} = await Promise.resolve().then(() => (init_version_check(), version_check_exports))
|
|
4916
|
+
const latest = await (runtime.identity.channel === 'bun'
|
|
4917
|
+
? fetchLatestBunVersion2()
|
|
4918
|
+
: fetchLatestNpmVersion2())
|
|
4714
4919
|
return {
|
|
4715
|
-
latest
|
|
4716
|
-
|
|
4717
|
-
: fetchLatestNpmVersion2()),
|
|
4920
|
+
latest,
|
|
4921
|
+
reason: latest === null ? 'npm-unavailable' : null,
|
|
4718
4922
|
}
|
|
4719
4923
|
},
|
|
4720
4924
|
})
|
|
@@ -14,7 +14,7 @@ var init_package = __esm({
|
|
|
14
14
|
'package.json'() {
|
|
15
15
|
package_default = {
|
|
16
16
|
name: 'harnessed',
|
|
17
|
-
version: '5.0.
|
|
17
|
+
version: '5.0.15',
|
|
18
18
|
description: 'AI coding harness package manager + composition orchestrator',
|
|
19
19
|
type: 'module',
|
|
20
20
|
license: 'Apache-2.0',
|
|
@@ -67,7 +67,6 @@ var init_package = __esm({
|
|
|
67
67
|
'schemas',
|
|
68
68
|
'CHANGELOG.md',
|
|
69
69
|
'README.md',
|
|
70
|
-
'README-en.md',
|
|
71
70
|
'README-zh.md',
|
|
72
71
|
'LICENSE',
|
|
73
72
|
'NOTICE',
|
|
@@ -673,6 +672,9 @@ var init_autoUpdateNotice = __esm({
|
|
|
673
672
|
|
|
674
673
|
// src/cli/lib/updateReminderCache.ts
|
|
675
674
|
import fs from 'node:fs'
|
|
675
|
+
function isReminderProbeFailure(value) {
|
|
676
|
+
return typeof value === 'string' && REMINDER_PROBE_FAILURES.includes(value)
|
|
677
|
+
}
|
|
676
678
|
function isReminderVersion(value) {
|
|
677
679
|
return (
|
|
678
680
|
typeof value === 'string' &&
|
|
@@ -696,7 +698,7 @@ function parseCache(text, identity, now) {
|
|
|
696
698
|
return null
|
|
697
699
|
}
|
|
698
700
|
}
|
|
699
|
-
const { installed, latest, state, checkedAt, retryAfter } = cache2
|
|
701
|
+
const { installed, latest, state, checkedAt, retryAfter, stale, lastError } = cache2
|
|
700
702
|
if (
|
|
701
703
|
!isReminderVersion(installed) ||
|
|
702
704
|
typeof checkedAt !== 'number' ||
|
|
@@ -708,14 +710,18 @@ function parseCache(text, identity, now) {
|
|
|
708
710
|
retryAfter < 0
|
|
709
711
|
)
|
|
710
712
|
return null
|
|
713
|
+
if (stale !== void 0 && typeof stale !== 'boolean') return null
|
|
714
|
+
if (lastError !== void 0 && !isReminderProbeFailure(lastError)) return null
|
|
711
715
|
if (state === 'unknown') {
|
|
712
716
|
if (latest !== null || retryAfter !== checkedAt + REMINDER_RETRY_MS) return null
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
!isReminderVersion(latest)
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
717
|
+
if (stale === true) return null
|
|
718
|
+
} else {
|
|
719
|
+
if (!['behind', 'current', 'ahead'].includes(state ?? '') || !isReminderVersion(latest))
|
|
720
|
+
return null
|
|
721
|
+
if (stale === true) {
|
|
722
|
+
if (retryAfter <= checkedAt) return null
|
|
723
|
+
} else if (retryAfter !== 0) return null
|
|
724
|
+
}
|
|
719
725
|
return {
|
|
720
726
|
schemaVersion: 1,
|
|
721
727
|
identity: { ...identity },
|
|
@@ -724,6 +730,8 @@ function parseCache(text, identity, now) {
|
|
|
724
730
|
state,
|
|
725
731
|
checkedAt,
|
|
726
732
|
retryAfter,
|
|
733
|
+
...(stale === true ? { stale: true } : {}),
|
|
734
|
+
...(lastError !== void 0 ? { lastError } : {}),
|
|
727
735
|
}
|
|
728
736
|
}
|
|
729
737
|
function readReminderCache(cachePath, identity, now = Date.now()) {
|
|
@@ -749,6 +757,7 @@ function readReminderCache(cachePath, identity, now = Date.now()) {
|
|
|
749
757
|
function shouldRefreshReminder(cache2, now) {
|
|
750
758
|
if (!cache2) return true
|
|
751
759
|
if (cache2.retryAfter > now) return false
|
|
760
|
+
if (cache2.stale === true) return true
|
|
752
761
|
return cache2.state === 'unknown' || now - cache2.checkedAt >= REMINDER_TTL_MS
|
|
753
762
|
}
|
|
754
763
|
function isReminderWorkerActive(cachePath, now) {
|
|
@@ -759,7 +768,11 @@ function isReminderWorkerActive(cachePath, now) {
|
|
|
759
768
|
return false
|
|
760
769
|
}
|
|
761
770
|
}
|
|
762
|
-
var REMINDER_TTL_MS,
|
|
771
|
+
var REMINDER_TTL_MS,
|
|
772
|
+
REMINDER_RETRY_MS,
|
|
773
|
+
REMINDER_MAX_BYTES,
|
|
774
|
+
REMINDER_LOCK_STALE_MS,
|
|
775
|
+
REMINDER_PROBE_FAILURES
|
|
763
776
|
var init_updateReminderCache = __esm({
|
|
764
777
|
'src/cli/lib/updateReminderCache.ts'() {
|
|
765
778
|
'use strict'
|
|
@@ -767,6 +780,13 @@ var init_updateReminderCache = __esm({
|
|
|
767
780
|
REMINDER_RETRY_MS = 60 * 60 * 1e3
|
|
768
781
|
REMINDER_MAX_BYTES = 16 * 1024
|
|
769
782
|
REMINDER_LOCK_STALE_MS = 3e4
|
|
783
|
+
REMINDER_PROBE_FAILURES = [
|
|
784
|
+
'github-rate-limited',
|
|
785
|
+
'github-timeout',
|
|
786
|
+
'github-unavailable',
|
|
787
|
+
'npm-unavailable',
|
|
788
|
+
'invalid-version',
|
|
789
|
+
]
|
|
770
790
|
},
|
|
771
791
|
})
|
|
772
792
|
|
|
@@ -827,8 +847,9 @@ async function runUpdateReminderHook(options) {
|
|
|
827
847
|
const cache2 = readReminderCache(options.cachePath, options.identity, now)
|
|
828
848
|
if (options.enabled && cache2?.state === 'behind') {
|
|
829
849
|
try {
|
|
850
|
+
const known = cache2.stale === true ? ' (last known)' : ''
|
|
830
851
|
write(
|
|
831
|
-
`Harnessed update available: ${cache2.installed} -> ${cache2.latest}. Run /harnessed-update.
|
|
852
|
+
`Harnessed update available: ${cache2.installed} -> ${cache2.latest}${known}. Run /harnessed-update.
|
|
832
853
|
`,
|
|
833
854
|
)
|
|
834
855
|
} catch {}
|