@adamchanadam/agent-handoff-kit 0.3.42 → 0.3.44
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.en.md +197 -0
- package/README.md +5 -3
- package/bin/agent-handoff-kit.mjs +45 -12
- package/bin/installed-file-contract.mjs +74 -74
- package/bin/official-origin-catalog.mjs +74 -74
- package/bin/semantic-candidate.mjs +594 -594
- package/bin/upgrade-inventory.mjs +587 -587
- package/bin/user-rules-router.mjs +461 -461
- package/package.json +20 -20
- package/packs/closeout.md +15 -15
- package/packs/communication.md +8 -8
- package/packs/onboarding.md +1 -1
- package/packs/release.md +2 -0
- package/packs/writing.md +5 -0
- package/runtime-core/AGENTS.core.md +8 -8
- package/runtime-core/PROJECT_INDEX.md +1 -1
- package/runtime-core/SESSION_HANDOFF.md +12 -12
- package/runtime-core/START_NEXT_SESSION_PROMPT.txt +1 -1
- package/runtime-core/USER_RULES.md +30 -30
- package/runtime-core/USER_RULES_ENTRY.md +7 -7
package/README.en.md
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# Agent Handoff Kit
|
|
2
|
+
|
|
3
|
+
[繁體中文](README.md) · [Getting started](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-intro.en.html) · [Practical guide](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-guide.en.html) · [AI install page](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-ai-install.en.html)
|
|
4
|
+
|
|
5
|
+
Current source candidate: `v0.3.44`. The currently published npm release is `v0.3.43`.
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<img src="https://raw.githubusercontent.com/Adamchanadam/agent-handoff-kit/main/images/agent-handoff-kit-promo-30s.gif" alt="Agent Handoff Kit overview animation" width="720">
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
Agent Handoff Kit is a **handoff baton between AI conversations**.
|
|
12
|
+
|
|
13
|
+
It solves one narrow but important problem: AI conversations forget. A new conversation may not know where the last one stopped, which new files or reference sources matter, what is safe to change, or which document is authoritative. The kit keeps the current state, next action, risks, file routes, and the next-session prompt in the project so the next local AI can continue honestly.
|
|
14
|
+
|
|
15
|
+
📌 You describe the outcome you want. An AI that can read and write the local folder confirms the folder, decides whether to install or upgrade, runs the technical checks, and explains the result. You do not need to learn npm commands or diagnose file conflicts.
|
|
16
|
+
|
|
17
|
+
## 🚀 Start in three steps
|
|
18
|
+
|
|
19
|
+
For a first use, do not start by reading every technical detail. Do these three things:
|
|
20
|
+
|
|
21
|
+
1. Open a local AI agent in the folder where you want to use Agent Handoff Kit and send:
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
Read https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-ai-install.en.html and install or upgrade Agent Handoff Kit in this folder.
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
You can also open the [AI install page](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-ai-install.en.html) first to see the procedure the AI must follow.
|
|
28
|
+
|
|
29
|
+
2. When installation finishes, say `Start Agent Handoff` or `開工` to the AI.
|
|
30
|
+
3. When you are genuinely ending this work session, say `wrap up` or `收工`.
|
|
31
|
+
|
|
32
|
+
You do not decide whether the folder needs an install, upgrade, health check, or a safe stop. The AI must show the folder it sees, explain risk and the next action, and ask when your confirmation is needed.
|
|
33
|
+
|
|
34
|
+
If the folder already contains older Kit files or AI memory files such as `AGENTS.md`, `CLAUDE.md`, or `GEMINI.md`, use the same request. The AI inspects first; it must not silently overwrite them.
|
|
35
|
+
|
|
36
|
+
For a non-technical introduction, open the [English introduction](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-intro.en.html). For complete walkthroughs, open the [English practical guide](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-guide.en.html).
|
|
37
|
+
To see how Agent Handoff Kit sits in a local agentic AI workflow, open [`local-agentic-ai-workflow-case-study.en.html`](https://adamchanadam.github.io/agent-handoff-kit/local-agentic-ai-workflow-case-study.en.html).
|
|
38
|
+
|
|
39
|
+
## 🧭 How to read this repository
|
|
40
|
+
|
|
41
|
+
If you only want to use the kit, start from these four pages:
|
|
42
|
+
|
|
43
|
+
| Entry | Purpose |
|
|
44
|
+
|---|---|
|
|
45
|
+
| [This README](README.en.md) | Product purpose, safe use, and boundaries. |
|
|
46
|
+
| [60-second introduction](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-intro.en.html) | A non-technical overview. |
|
|
47
|
+
| [Practical guide](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-guide.en.html) | Three detailed scenarios: everyday local work, research with external tools, and a long-lived project. |
|
|
48
|
+
| [AI install page](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-ai-install.en.html) | The instructions an AI follows to install, upgrade, check, or stop safely. |
|
|
49
|
+
|
|
50
|
+
This public repository keeps the material needed for use, installation, GitHub Pages, and the npm runtime. Normal users only need the four entries above.
|
|
51
|
+
|
|
52
|
+
## 🔎 What problem does it solve?
|
|
53
|
+
|
|
54
|
+
Long-running work with AI commonly has five problems:
|
|
55
|
+
|
|
56
|
+
| Problem | What Agent Handoff Kit does |
|
|
57
|
+
|---|---|
|
|
58
|
+
| A new AI does not know the current state | Keeps `dev/SESSION_HANDOFF.md` with the current objective, risks, validation, and next action. |
|
|
59
|
+
| New files or reference sources become disconnected | Lets you ask the AI to connect a document to the Kit, recording what it is for, which source is authoritative, and when it must be refreshed. |
|
|
60
|
+
| Different local AI tools start differently | Installs `AGENTS.md`, `CLAUDE.md`, and `GEMINI.md` as routes into one startup flow. Antigravity CLI reads the work folder’s `AGENTS.md` and `GEMINI.md`. |
|
|
61
|
+
| An AI could overwrite, delete, or publish carelessly | Requires an explanation and confirmation for high-risk work; destructive commands and unapproved release actions are prohibited. |
|
|
62
|
+
| External tools leave resources behind or clear shared resources | Applies ownership: resources demonstrably created for this task may be closed; shared, user-owned, or unclear resources are reported with evidence and kept until confirmed. |
|
|
63
|
+
|
|
64
|
+
It is not a chatbot and not a development framework. Think of it as a durable project handoff book.
|
|
65
|
+
|
|
66
|
+
## 🧰 Supported tools
|
|
67
|
+
|
|
68
|
+
Agent Handoff Kit is for agentic AI tools that can read and write a local project folder, such as Claude Code, OpenAI Codex, Gemini CLI, Google Antigravity, or another local-workspace agent. Antigravity CLI uses the work folder’s `AGENTS.md` and `GEMINI.md` routes to reach the same startup flow.
|
|
69
|
+
|
|
70
|
+
It is not for ordinary web-chat AI that cannot access your local folder. Uploading a file or pasting a handoff into a web chat does not give that chat the ability to maintain the project’s handoff files safely.
|
|
71
|
+
|
|
72
|
+
## 🟢 Start work
|
|
73
|
+
|
|
74
|
+
Open a local AI agent in the correct project folder.
|
|
75
|
+
|
|
76
|
+
If the AI is already in that folder, ordinary continuity startup is simply:
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
Start Agent Handoff
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
You may also say `開工`.
|
|
83
|
+
|
|
84
|
+
If the AI is not yet pointed at the project folder, use the path-bearing startup sentence:
|
|
85
|
+
|
|
86
|
+
```text
|
|
87
|
+
Work in <your project folder>. Read AGENTS.md first, then Start Agent Handoff. Before changing anything, tell me the current state and your recommended next step.
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
A first installation merely makes onboarding available; it does not force a tutorial. When your goal and the available facts are clear, the AI begins the first safe task action. It uses guided onboarding only when the goal is genuinely unclear or you explicitly request guidance.
|
|
91
|
+
|
|
92
|
+
For ordinary daily startup, the AI reads `dev/SESSION_HANDOFF.md` first. Inside the same folder it does not reread `START_NEXT_SESSION_PROMPT.txt` or `dev/SESSION_LOG.md` during normal startup. The prompt copy is only for an AI that has not yet been pointed at the project folder.
|
|
93
|
+
|
|
94
|
+
A bare `Start Agent Handoff` / `開工` restores the minimum current state, shows the startup card, status, and recommended next action, then waits. It does **not** authorize research, planning, QA, packaging, file writes, network use, or sub-agents. To work immediately, say so in the same message, for example: `Start Agent Handoff, continue <task>`.
|
|
95
|
+
|
|
96
|
+
Then describe your task in ordinary language. The AI should explain the current state, next action, and risk before it starts the requested work.
|
|
97
|
+
|
|
98
|
+
## 💾 Wrap up
|
|
99
|
+
|
|
100
|
+
When the work session is really ending, say:
|
|
101
|
+
|
|
102
|
+
```text
|
|
103
|
+
wrap up
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
You can also say `收工`, `Wrap up Agent Handoff`, or `handoff`.
|
|
107
|
+
|
|
108
|
+
If the phrase could instead mean a real-world closing event, such as a restaurant closing, the AI should ask one short question rather than immediately changing the project handoff.
|
|
109
|
+
|
|
110
|
+
At a real closeout, the AI updates the handoff and regenerates:
|
|
111
|
+
|
|
112
|
+
```text
|
|
113
|
+
START_NEXT_SESSION_PROMPT.txt
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
That file is a portable convenience copy for an AI that is not yet in the project folder. The authority remains the next-session opening message in `dev/SESSION_HANDOFF.md`; if the two differ, the AI rebuilds the copy from the handoff.
|
|
117
|
+
|
|
118
|
+
## 🩺 When you are unsure about the state
|
|
119
|
+
|
|
120
|
+
If you are unsure whether the folder is installed correctly, needs an upgrade, or is healthy after an upgrade, ask the AI:
|
|
121
|
+
|
|
122
|
+
```text
|
|
123
|
+
Read the AI install page and check the Agent Handoff Kit state of this folder.
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
The AI performs the check. A successful check does not mean it has understood your project task; when you want continuity work, still say `Start Agent Handoff` or `開工`.
|
|
127
|
+
|
|
128
|
+
## 🗂️ What the AI maintains for you
|
|
129
|
+
|
|
130
|
+
After installation, the Kit places a small set of handoff files in the project. You do not need to read or maintain each one manually.
|
|
131
|
+
|
|
132
|
+
- **Startup entries:** `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, and `START_NEXT_SESSION_PROMPT.txt` route local AI tools into the same startup flow.
|
|
133
|
+
- **Current state:** `dev/SESSION_HANDOFF.md` records progress, next action, risks, and validation.
|
|
134
|
+
- **Trace record:** recent work remains available for trace-back; long-running use is compacted so the record does not grow without limit.
|
|
135
|
+
- **Project index and decisions:** important files, external sources, synchronization responsibilities, and durable decisions remain findable when you later ask “why did we choose this?”
|
|
136
|
+
- **Routed work rules:** the AI loads the rules needed for the task; you do not have to memorize rule-file names.
|
|
137
|
+
|
|
138
|
+
## 🧭 How work rules operate
|
|
139
|
+
|
|
140
|
+
You do not need to remember rule file names. The Kit lets the AI classify what you need and load only the relevant work rules.
|
|
141
|
+
|
|
142
|
+
| What you want to do | What the AI does |
|
|
143
|
+
|---|---|
|
|
144
|
+
| Write code or fix a bug | Reads the project index and relevant files, then changes and tests only what is needed. |
|
|
145
|
+
| Write an article, README, or public copy | Clarifies audience, purpose, tone, and publication surface. |
|
|
146
|
+
| Research or compare tools | Separates verified facts, source summaries, and the AI’s judgement. |
|
|
147
|
+
| Delete files, use Git, publish, or use npm | Explains impact first and waits for your confirmation. |
|
|
148
|
+
| Use Notion, Google Drive, or another external tool | Checks the current tool guidance, handles resources by ownership, and keeps secrets out of project files. |
|
|
149
|
+
|
|
150
|
+
You can simply say what you want, for example: “Help me revise the README”, “Research whether this tool is suitable”, or “Connect this document to Agent Handoff Kit.” The AI chooses the needed rules.
|
|
151
|
+
|
|
152
|
+
For a durable preference, tell the AI rather than editing rule files blindly:
|
|
153
|
+
|
|
154
|
+
```text
|
|
155
|
+
For future public English documents, use clear professional English. Connect this rule to Agent Handoff Kit.
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
The AI decides whether that belongs in a one-off note, the next handoff, the project index, or a durable work rule. It must not put everything into one file.
|
|
159
|
+
|
|
160
|
+
## 💬 Things you can ask an AI to do
|
|
161
|
+
|
|
162
|
+
State the goal in natural language. The AI decides which handoff files, rules, or indexes it needs to read.
|
|
163
|
+
|
|
164
|
+
| What you want | Example |
|
|
165
|
+
|---|---|
|
|
166
|
+
| Continue the last session | `Start Agent Handoff` or `開工` |
|
|
167
|
+
| End this session | `wrap up` or `收工` |
|
|
168
|
+
| Keep a new document from becoming disconnected | “Connect this document to Agent Handoff Kit so the next AI knows when to read and update it.” |
|
|
169
|
+
| Find important unconnected documents | “Scan for important documents not yet connected to Agent Handoff Kit.” |
|
|
170
|
+
| Avoid the same mistake in future work | “Turn this mistake into a durable work rule for future sessions.” |
|
|
171
|
+
| Keep an API or tool practice usable | “Use this API approach in future sessions too.” |
|
|
172
|
+
| Use Notion, Google Drive, GitHub, or another external tool | “This project uses these tools. Record what can be used directly and keep secrets out of project files.” |
|
|
173
|
+
| Finish a long task that used MCP, browser, or automation tools | “At wrap up, show the external-tool resource closeout: which task-owned resources were closed and which uncertain resources were retained with evidence.” |
|
|
174
|
+
|
|
175
|
+
When scanning for important documents, the AI first lists candidates and reasons. It does not automatically modify, merge, or retire them. For deletion, rename, authority changes, publication, upload, or permission changes, it must explain the impact and wait for confirmation.
|
|
176
|
+
|
|
177
|
+
Rules that must persist across future sessions should be written into the appropriate project file, not left only in the current chat summary.
|
|
178
|
+
|
|
179
|
+
## 🛡️ Safety boundaries
|
|
180
|
+
|
|
181
|
+
Even if you do not write code, the Kit requires an AI to stop and explain high-risk actions.
|
|
182
|
+
|
|
183
|
+
- **Destructive operations:** commands such as `rm -rf`, `git reset --hard`, and operations against system root paths are prohibited by default. Force-push, branch or tag deletion, and history rewriting need explicit scope, explicit approval, and readback of the affected refs.
|
|
184
|
+
- **Secrets:** do not print, commit, or upload `.env` values, API keys, or tokens.
|
|
185
|
+
- **Verify; do not guess:** before using a third-party service, connector, MCP, CLI, API, or plugin, check current official or already verified local guidance. If it cannot be verified, say so.
|
|
186
|
+
- **External-tool closeout:** an AI may close only resources it can show were created for the current task. Shared, user-owned, other-agent-owned, or unclear resources must be reported and left alone until you confirm.
|
|
187
|
+
- **Permission failures:** if a file is locked or permission is missing, stop and provide safe manual steps; do not bypass the protection.
|
|
188
|
+
- **Publishing:** tags, GitHub Releases, npm publication, deployment, and upload always require explicit approval. “Ready” is never approval.
|
|
189
|
+
|
|
190
|
+
## 🔗 Optional companion: Adam-AI-Instructions
|
|
191
|
+
|
|
192
|
+
Agent Handoff Kit can work alongside [Adam-AI-Instructions](https://github.com/prompt-templates/Adam-AI-Instructions). They are complementary, not competing authorities. They deliberately keep a minimum shared baseline for safety, secrets, irreversible operations, and release boundaries; neither is the parent source of truth for the other, and they should not be merged into one rule set:
|
|
193
|
+
|
|
194
|
+
- **Adam-AI-Instructions** governs how an AI works within one conversation: tone, priorities, response structure, calculation discipline, and safety boundaries.
|
|
195
|
+
- **Agent Handoff Kit** governs continuity between conversations: current state, next action, file routes, real closeout, and the next startup.
|
|
196
|
+
|
|
197
|
+
This pairing is optional. It does not change installation or everyday use of Agent Handoff Kit.
|
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
# Agent Handoff Kit
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# Agent Handoff Kit
|
|
2
|
+
|
|
3
|
+
English: [README.en.md](README.en.md) · [Getting started](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-intro.en.html) · [Practical guide](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-guide.en.html) · [AI install page](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-ai-install.en.html)
|
|
4
|
+
|
|
5
|
+
目前候選版本:`v0.3.44`(尚未發佈);正式可用版本是 `v0.3.43`。
|
|
4
6
|
|
|
5
7
|
<p align="center">
|
|
6
8
|
<img src="https://raw.githubusercontent.com/Adamchanadam/agent-handoff-kit/main/images/agent-handoff-kit-promo-30s.gif" alt="Agent Handoff Kit 功能簡介動畫" width="720">
|
|
@@ -2186,10 +2186,14 @@ async function runDoctor(root, version, options = {}) {
|
|
|
2186
2186
|
// R-031.2 v0.3.2+: 項目狀態速覽 —— 三向 version 對比 + 距上次 closeout 幾耐 +
|
|
2187
2187
|
// 項目首次安裝距今幾耐。從用戶跑 doctor 嗰刻嘅 mental state 出發(confirm health /
|
|
2188
2188
|
// suspect drift / curious about version / continuity awareness),唔等用戶 ask AI。
|
|
2189
|
-
console.log("");
|
|
2190
|
-
console.log("項目狀態速覽:");
|
|
2189
|
+
console.log("");
|
|
2190
|
+
console.log("項目狀態速覽:");
|
|
2191
2191
|
const versionAlignment = await assessVersionAlignment(root, version, {
|
|
2192
|
-
skipRegistryLookup: options.skipVersionRegistryLookup === true
|
|
2192
|
+
skipRegistryLookup: options.skipVersionRegistryLookup === true,
|
|
2193
|
+
// checkCurrentStateWitness above has freshly verified both the journal
|
|
2194
|
+
// identity and active bytes. Only that verified transaction target may
|
|
2195
|
+
// speak for a preserved project's current product state.
|
|
2196
|
+
acceptedVersion: currentStateWitness?.transaction?.attemptedVersion ?? null
|
|
2193
2197
|
});
|
|
2194
2198
|
printVersionAlignment(versionAlignment);
|
|
2195
2199
|
const versionNextStep = getVersionAlignmentNextStep(versionAlignment);
|
|
@@ -6162,12 +6166,29 @@ async function assessVersionAlignment(root, cliVersion, options = {}) {
|
|
|
6162
6166
|
}
|
|
6163
6167
|
}
|
|
6164
6168
|
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6169
|
+
const acceptedVersion = isStableSemver(options.acceptedVersion ?? "")
|
|
6170
|
+
? options.acceptedVersion
|
|
6171
|
+
: null;
|
|
6172
|
+
return { cliVersion, rootVersion, npmLatest, acceptedVersion };
|
|
6173
|
+
}
|
|
6174
|
+
|
|
6175
|
+
function printVersionAlignment(result) {
|
|
6176
|
+
const { cliVersion, rootVersion, npmLatest, acceptedVersion } = result;
|
|
6177
|
+
if (acceptedVersion !== null) {
|
|
6178
|
+
const metadata = rootVersion === null ? "項目版本記錄缺失" : `項目記錄 v${rootVersion}${rootVersion === acceptedVersion ? "" : "(保留資料)"}`;
|
|
6179
|
+
console.log(` 📦 版本:工具 v${cliVersion} / 已接受目前狀態 v${acceptedVersion} / ${metadata} / npm latest ${npmLatest ? "v" + npmLatest : "無法查詢"}`);
|
|
6180
|
+
if (compareSemver(acceptedVersion, cliVersion) < 0) {
|
|
6181
|
+
console.log(` 項目已接受的狀態是 v${acceptedVersion},目前工具是 v${cliVersion};要升級時先執行:npx --yes @adamchanadam/agent-handoff-kit@latest upgrade --dry-run`);
|
|
6182
|
+
} else if (compareSemver(acceptedVersion, cliVersion) > 0) {
|
|
6183
|
+
console.log(` 項目已接受的狀態比目前工具新;請先用較新的工具執行 doctor 或 upgrade,不會用舊工具把項目降級。`);
|
|
6184
|
+
}
|
|
6185
|
+
if (npmLatest && compareSemver(npmLatest, cliVersion) > 0) {
|
|
6186
|
+
console.log(` npm 有新版(v${npmLatest});doctor 只檢查不修改。要使用最新版時先執行:npx --yes @adamchanadam/agent-handoff-kit@latest upgrade --dry-run`);
|
|
6187
|
+
console.log(" --dry-run 只預覽、不寫入;確認計劃沒問題後,再去掉 --dry-run 正式升級。");
|
|
6188
|
+
}
|
|
6189
|
+
return;
|
|
6190
|
+
}
|
|
6191
|
+
if (rootVersion === null) {
|
|
6171
6192
|
console.log(` 📦 版本:工具 v${cliVersion} / 項目版本記錄缺失(可能曾經手動編輯)/ npm latest ${npmLatest ? "v" + npmLatest : "無法查詢"}`);
|
|
6172
6193
|
return;
|
|
6173
6194
|
}
|
|
@@ -6190,9 +6211,21 @@ function printVersionAlignment(result) {
|
|
|
6190
6211
|
}
|
|
6191
6212
|
}
|
|
6192
6213
|
|
|
6193
|
-
function getVersionAlignmentNextStep(result) {
|
|
6194
|
-
const { cliVersion, rootVersion, npmLatest } = result;
|
|
6195
|
-
if (
|
|
6214
|
+
function getVersionAlignmentNextStep(result) {
|
|
6215
|
+
const { cliVersion, rootVersion, npmLatest, acceptedVersion } = result;
|
|
6216
|
+
if (acceptedVersion !== null) {
|
|
6217
|
+
if (compareSemver(acceptedVersion, cliVersion) > 0) {
|
|
6218
|
+
return `檢查已通過,但項目已接受的狀態是 v${acceptedVersion},比目前工具 v${cliVersion} 新。請先使用較新的工具;doctor 不會用舊工具把項目降級。`;
|
|
6219
|
+
}
|
|
6220
|
+
if (npmLatest && compareSemver(npmLatest, cliVersion) > 0) {
|
|
6221
|
+
return `檢查已通過,npm 有新版 v${npmLatest}。doctor 沒有修改檔案;要升級時先執行 npx --yes @adamchanadam/agent-handoff-kit@latest upgrade --dry-run。--dry-run 只預覽、不寫入;確認計劃沒問題後,再去掉 --dry-run 正式升級。`;
|
|
6222
|
+
}
|
|
6223
|
+
if (compareSemver(acceptedVersion, cliVersion) < 0) {
|
|
6224
|
+
return `檢查已通過,但項目已接受的狀態仍是 v${acceptedVersion},目前工具是 v${cliVersion}。doctor 沒有修改檔案;要升級時先執行 npx --yes @adamchanadam/agent-handoff-kit@latest upgrade --dry-run。--dry-run 只預覽、不寫入;確認後再去掉 --dry-run 正式升級。`;
|
|
6225
|
+
}
|
|
6226
|
+
return null;
|
|
6227
|
+
}
|
|
6228
|
+
if (npmLatest && compareSemver(npmLatest, cliVersion) > 0) {
|
|
6196
6229
|
return `檢查已通過,但 npm 有新版 v${npmLatest}。doctor 沒有修改檔案;建議先執行 npx --yes @adamchanadam/agent-handoff-kit@latest upgrade --dry-run。--dry-run 只預覽、不寫入;確認計劃沒問題後,再去掉 --dry-run 正式升級。`;
|
|
6197
6230
|
}
|
|
6198
6231
|
if (rootVersion === null) {
|
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
// Single source of truth for the historical files Agent Handoff Kit installs
|
|
2
|
-
// and upgrades. Fresh-only files are declared separately so their new path
|
|
3
|
-
// cannot silently become legacy ownership or upgrade evidence.
|
|
4
|
-
|
|
5
|
-
export const INSTALLED_FILE_CONTRACT_SCHEMA = 1;
|
|
6
|
-
|
|
7
|
-
export const installedFileContracts = Object.freeze([
|
|
8
|
-
contract("runtime-core/AGENTS.core.md", "AGENTS.md", "managed-core"),
|
|
9
|
-
contract("runtime-core/CLAUDE.md", "CLAUDE.md", "strict-bridge"),
|
|
10
|
-
contract("runtime-core/GEMINI.md", "GEMINI.md", "strict-bridge"),
|
|
11
|
-
contract("runtime-core/START_NEXT_SESSION_PROMPT.txt", "START_NEXT_SESSION_PROMPT.txt", "generated-state"),
|
|
12
|
-
contract("runtime-core/SESSION_HANDOFF.md", "dev/SESSION_HANDOFF.md", "stateful-handoff"),
|
|
13
|
-
contract("runtime-core/SESSION_LOG.md", "dev/SESSION_LOG.md", "stateful-log"),
|
|
14
|
-
contract("runtime-core/PROJECT_INDEX.md", "dev/PROJECT_INDEX.md", "stateful-index"),
|
|
15
|
-
contract("runtime-core/DOC_SYNC_REGISTRY.md", "dev/DOC_SYNC_REGISTRY.md", "stateful-registry"),
|
|
16
|
-
contract("runtime-core/RULE_PACKS.md", "dev/RULE_PACKS.md", "marked-routing-table"),
|
|
17
|
-
contract("runtime-core/PROJECT_DECISIONS.md", "dev/PROJECT_DECISIONS.md", "stateful-decisions"),
|
|
18
|
-
contract("packs/safety.md", "dev/rules/safety.md", "rule-pack"),
|
|
19
|
-
contract("packs/coding.md", "dev/rules/coding.md", "rule-pack"),
|
|
20
|
-
contract("packs/writing.md", "dev/rules/writing.md", "rule-pack"),
|
|
21
|
-
contract("packs/research.md", "dev/rules/research.md", "rule-pack"),
|
|
22
|
-
contract("packs/agent-governance.md", "dev/rules/agent-governance.md", "rule-pack"),
|
|
23
|
-
contract("packs/release.md", "dev/rules/release.md", "rule-pack"),
|
|
24
|
-
contract("packs/knowledge.md", "dev/rules/knowledge.md", "rule-pack"),
|
|
25
|
-
contract("packs/communication.md", "dev/rules/communication.md", "rule-pack"),
|
|
26
|
-
contract("packs/closeout.md", "dev/rules/closeout.md", "rule-pack"),
|
|
27
|
-
contract("packs/onboarding.md", "dev/rules/onboarding.md", "rule-pack"),
|
|
28
|
-
contract("packs/integrations.md", "dev/rules/integrations.md", "rule-pack")
|
|
29
|
-
]);
|
|
30
|
-
|
|
31
|
-
export const installedMappings = Object.freeze(
|
|
32
|
-
installedFileContracts.map(({ sourceRel, targetRel }) => Object.freeze([sourceRel, targetRel]))
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
// The router is installed on fresh roots, but is not evidence that an arbitrary
|
|
36
|
-
// legacy or mixed file is Kit-managed. Its upgrade treatment lives in a
|
|
37
|
-
// separate, state-bound transition contract below rather than the historical
|
|
38
|
-
// file catalog.
|
|
39
|
-
export const freshInstallFileContracts = Object.freeze([
|
|
40
|
-
...installedFileContracts,
|
|
41
|
-
contract("runtime-core/USER_RULES.md", "dev/USER_RULES.md", "fresh-user-router")
|
|
42
|
-
]);
|
|
43
|
-
|
|
44
|
-
export const freshInstallMappings = Object.freeze(
|
|
45
|
-
freshInstallFileContracts.map(({ sourceRel, targetRel }) => Object.freeze([sourceRel, targetRel]))
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
// R-034: formal user-rule state is part of an upgrade only when the existing
|
|
49
|
-
// AGENTS.md entry and router form one verifiable formal state. This separate
|
|
50
|
-
// contract deliberately does not reclassify a path, title, or directory as
|
|
51
|
-
// historical Kit ownership.
|
|
52
|
-
export const upgradeStateFileContracts = Object.freeze([
|
|
53
|
-
contract("runtime-core/USER_RULES.md", "dev/USER_RULES.md", "accepted-user-rules-router")
|
|
54
|
-
]);
|
|
55
|
-
|
|
56
|
-
export const upgradeStateMappings = Object.freeze(
|
|
57
|
-
upgradeStateFileContracts.map(({ sourceRel, targetRel }) => Object.freeze([sourceRel, targetRel]))
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
export const upgradeStateTargets = Object.freeze(
|
|
61
|
-
upgradeStateFileContracts.map(({ targetRel }) => targetRel)
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
export const requiredInstalledTargets = Object.freeze(
|
|
65
|
-
installedFileContracts.map(({ targetRel }) => targetRel)
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
export function installedFileContract(targetRel) {
|
|
69
|
-
return installedFileContracts.find((item) => item.targetRel === targetRel) ?? null;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function contract(sourceRel, targetRel, strategy) {
|
|
73
|
-
return Object.freeze({ sourceRel, targetRel, strategy });
|
|
74
|
-
}
|
|
1
|
+
// Single source of truth for the historical files Agent Handoff Kit installs
|
|
2
|
+
// and upgrades. Fresh-only files are declared separately so their new path
|
|
3
|
+
// cannot silently become legacy ownership or upgrade evidence.
|
|
4
|
+
|
|
5
|
+
export const INSTALLED_FILE_CONTRACT_SCHEMA = 1;
|
|
6
|
+
|
|
7
|
+
export const installedFileContracts = Object.freeze([
|
|
8
|
+
contract("runtime-core/AGENTS.core.md", "AGENTS.md", "managed-core"),
|
|
9
|
+
contract("runtime-core/CLAUDE.md", "CLAUDE.md", "strict-bridge"),
|
|
10
|
+
contract("runtime-core/GEMINI.md", "GEMINI.md", "strict-bridge"),
|
|
11
|
+
contract("runtime-core/START_NEXT_SESSION_PROMPT.txt", "START_NEXT_SESSION_PROMPT.txt", "generated-state"),
|
|
12
|
+
contract("runtime-core/SESSION_HANDOFF.md", "dev/SESSION_HANDOFF.md", "stateful-handoff"),
|
|
13
|
+
contract("runtime-core/SESSION_LOG.md", "dev/SESSION_LOG.md", "stateful-log"),
|
|
14
|
+
contract("runtime-core/PROJECT_INDEX.md", "dev/PROJECT_INDEX.md", "stateful-index"),
|
|
15
|
+
contract("runtime-core/DOC_SYNC_REGISTRY.md", "dev/DOC_SYNC_REGISTRY.md", "stateful-registry"),
|
|
16
|
+
contract("runtime-core/RULE_PACKS.md", "dev/RULE_PACKS.md", "marked-routing-table"),
|
|
17
|
+
contract("runtime-core/PROJECT_DECISIONS.md", "dev/PROJECT_DECISIONS.md", "stateful-decisions"),
|
|
18
|
+
contract("packs/safety.md", "dev/rules/safety.md", "rule-pack"),
|
|
19
|
+
contract("packs/coding.md", "dev/rules/coding.md", "rule-pack"),
|
|
20
|
+
contract("packs/writing.md", "dev/rules/writing.md", "rule-pack"),
|
|
21
|
+
contract("packs/research.md", "dev/rules/research.md", "rule-pack"),
|
|
22
|
+
contract("packs/agent-governance.md", "dev/rules/agent-governance.md", "rule-pack"),
|
|
23
|
+
contract("packs/release.md", "dev/rules/release.md", "rule-pack"),
|
|
24
|
+
contract("packs/knowledge.md", "dev/rules/knowledge.md", "rule-pack"),
|
|
25
|
+
contract("packs/communication.md", "dev/rules/communication.md", "rule-pack"),
|
|
26
|
+
contract("packs/closeout.md", "dev/rules/closeout.md", "rule-pack"),
|
|
27
|
+
contract("packs/onboarding.md", "dev/rules/onboarding.md", "rule-pack"),
|
|
28
|
+
contract("packs/integrations.md", "dev/rules/integrations.md", "rule-pack")
|
|
29
|
+
]);
|
|
30
|
+
|
|
31
|
+
export const installedMappings = Object.freeze(
|
|
32
|
+
installedFileContracts.map(({ sourceRel, targetRel }) => Object.freeze([sourceRel, targetRel]))
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
// The router is installed on fresh roots, but is not evidence that an arbitrary
|
|
36
|
+
// legacy or mixed file is Kit-managed. Its upgrade treatment lives in a
|
|
37
|
+
// separate, state-bound transition contract below rather than the historical
|
|
38
|
+
// file catalog.
|
|
39
|
+
export const freshInstallFileContracts = Object.freeze([
|
|
40
|
+
...installedFileContracts,
|
|
41
|
+
contract("runtime-core/USER_RULES.md", "dev/USER_RULES.md", "fresh-user-router")
|
|
42
|
+
]);
|
|
43
|
+
|
|
44
|
+
export const freshInstallMappings = Object.freeze(
|
|
45
|
+
freshInstallFileContracts.map(({ sourceRel, targetRel }) => Object.freeze([sourceRel, targetRel]))
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
// R-034: formal user-rule state is part of an upgrade only when the existing
|
|
49
|
+
// AGENTS.md entry and router form one verifiable formal state. This separate
|
|
50
|
+
// contract deliberately does not reclassify a path, title, or directory as
|
|
51
|
+
// historical Kit ownership.
|
|
52
|
+
export const upgradeStateFileContracts = Object.freeze([
|
|
53
|
+
contract("runtime-core/USER_RULES.md", "dev/USER_RULES.md", "accepted-user-rules-router")
|
|
54
|
+
]);
|
|
55
|
+
|
|
56
|
+
export const upgradeStateMappings = Object.freeze(
|
|
57
|
+
upgradeStateFileContracts.map(({ sourceRel, targetRel }) => Object.freeze([sourceRel, targetRel]))
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
export const upgradeStateTargets = Object.freeze(
|
|
61
|
+
upgradeStateFileContracts.map(({ targetRel }) => targetRel)
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
export const requiredInstalledTargets = Object.freeze(
|
|
65
|
+
installedFileContracts.map(({ targetRel }) => targetRel)
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
export function installedFileContract(targetRel) {
|
|
69
|
+
return installedFileContracts.find((item) => item.targetRel === targetRel) ?? null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function contract(sourceRel, targetRel, strategy) {
|
|
73
|
+
return Object.freeze({ sourceRel, targetRel, strategy });
|
|
74
|
+
}
|
|
@@ -38,13 +38,13 @@ export function validateOfficialOriginCatalog(catalog) {
|
|
|
38
38
|
}
|
|
39
39
|
if (entry.canonicalSha256 !== content.canonicalSha256) {
|
|
40
40
|
throw new Error(`official origin catalog canonical hash mismatch: ${version} ${targetRel}`);
|
|
41
|
-
}
|
|
42
|
-
referenced.add(entry.contentId);
|
|
43
|
-
}
|
|
44
|
-
for (const targetRel of Object.keys(release.managedSegments ?? {})) {
|
|
45
|
-
getArtifactBoundManagedSegment({ version, targetRel, catalog });
|
|
46
|
-
}
|
|
47
|
-
}
|
|
41
|
+
}
|
|
42
|
+
referenced.add(entry.contentId);
|
|
43
|
+
}
|
|
44
|
+
for (const targetRel of Object.keys(release.managedSegments ?? {})) {
|
|
45
|
+
getArtifactBoundManagedSegment({ version, targetRel, catalog });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
48
|
|
|
49
49
|
for (const [contentId, content] of Object.entries(catalog.contents)) {
|
|
50
50
|
if (contentId !== sha256(`${content.targetRel}\0${content.text}`)) {
|
|
@@ -58,31 +58,31 @@ export function validateOfficialOriginCatalog(catalog) {
|
|
|
58
58
|
return true;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
export function identifyOfficialOrigin({ targetRel, text, bytes = null, catalog }) {
|
|
62
|
-
assertCatalogShape(catalog);
|
|
63
|
-
const sourceText = String(text);
|
|
64
|
-
const rawBytes = bytes == null ? Buffer.from(sourceText, "utf8") : Buffer.from(bytes);
|
|
65
|
-
const rawSha256 = createHash("sha256").update(rawBytes).digest("hex");
|
|
66
|
-
const normalizedSha256 = sha256(normalizeNewlines(sourceText));
|
|
67
|
-
const canonicalSha256 = sha256(canonicalizeOfficialText(targetRel, sourceText));
|
|
68
|
-
const rawExactVersions = [];
|
|
69
|
-
const exactVersions = [];
|
|
70
|
-
const canonicalVersions = [];
|
|
61
|
+
export function identifyOfficialOrigin({ targetRel, text, bytes = null, catalog }) {
|
|
62
|
+
assertCatalogShape(catalog);
|
|
63
|
+
const sourceText = String(text);
|
|
64
|
+
const rawBytes = bytes == null ? Buffer.from(sourceText, "utf8") : Buffer.from(bytes);
|
|
65
|
+
const rawSha256 = createHash("sha256").update(rawBytes).digest("hex");
|
|
66
|
+
const normalizedSha256 = sha256(normalizeNewlines(sourceText));
|
|
67
|
+
const canonicalSha256 = sha256(canonicalizeOfficialText(targetRel, sourceText));
|
|
68
|
+
const rawExactVersions = [];
|
|
69
|
+
const exactVersions = [];
|
|
70
|
+
const canonicalVersions = [];
|
|
71
71
|
|
|
72
72
|
for (const [version, release] of Object.entries(catalog.releases)) {
|
|
73
73
|
const entry = release.manifest[targetRel];
|
|
74
74
|
if (!entry || entry.state !== "present") continue;
|
|
75
|
-
if (entry.rawSha256 === rawSha256) rawExactVersions.push(version);
|
|
76
|
-
if (entry.normalizedSha256 === normalizedSha256) exactVersions.push(version);
|
|
75
|
+
if (entry.rawSha256 === rawSha256) rawExactVersions.push(version);
|
|
76
|
+
if (entry.normalizedSha256 === normalizedSha256) exactVersions.push(version);
|
|
77
77
|
else if (entry.canonicalSha256 === canonicalSha256) canonicalVersions.push(version);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
return {
|
|
81
|
-
targetRel,
|
|
82
|
-
rawSha256,
|
|
83
|
-
rawExact: rawExactVersions.length > 0,
|
|
84
|
-
rawExactVersions,
|
|
85
|
-
normalizedSha256,
|
|
81
|
+
targetRel,
|
|
82
|
+
rawSha256,
|
|
83
|
+
rawExact: rawExactVersions.length > 0,
|
|
84
|
+
rawExactVersions,
|
|
85
|
+
normalizedSha256,
|
|
86
86
|
canonicalSha256,
|
|
87
87
|
exact: exactVersions.length > 0,
|
|
88
88
|
exactVersions,
|
|
@@ -90,7 +90,7 @@ export function identifyOfficialOrigin({ targetRel, text, bytes = null, catalog
|
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
export function getOfficialBaseline({ version, targetRel, catalog, root = null }) {
|
|
93
|
+
export function getOfficialBaseline({ version, targetRel, catalog, root = null }) {
|
|
94
94
|
assertCatalogShape(catalog);
|
|
95
95
|
const release = catalog.releases[stripVersionPrefix(version)];
|
|
96
96
|
if (!release) return null;
|
|
@@ -109,46 +109,46 @@ export function getOfficialBaseline({ version, targetRel, catalog, root = null }
|
|
|
109
109
|
normalizedSha256: entry.normalizedSha256,
|
|
110
110
|
canonicalSha256: entry.canonicalSha256
|
|
111
111
|
};
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// A managed segment is deliberately narrower than a whole-file catalog
|
|
115
|
-
// identity. It exists only when the release is tied to an npm artifact and
|
|
116
|
-
// its raw source plus transformed core bytes are recorded in this catalog.
|
|
117
|
-
// Markers, filenames, headings, and language never grant this authority.
|
|
118
|
-
export function getArtifactBoundManagedSegment({ version, targetRel, catalog }) {
|
|
119
|
-
assertCatalogShape(catalog);
|
|
120
|
-
const normalizedVersion = stripVersionPrefix(version);
|
|
121
|
-
const release = catalog.releases[normalizedVersion];
|
|
122
|
-
const segment = release?.managedSegments?.[targetRel];
|
|
123
|
-
if (!segment) return null;
|
|
124
|
-
const npm = release.source?.npm;
|
|
125
|
-
if (!npm || typeof npm.spec !== "string" || !/^[a-f0-9]{40}$/.test(npm.shasum)
|
|
126
|
-
|| typeof npm.integrity !== "string" || !npm.integrity.startsWith("sha512-")) {
|
|
127
|
-
throw new Error(`official origin catalog managed segment has no artifact identity: ${normalizedVersion} ${targetRel}`);
|
|
128
|
-
}
|
|
129
|
-
if (!segment || typeof segment !== "object" || Array.isArray(segment)
|
|
130
|
-
|| segment.sourceRel !== "runtime-core/AGENTS.core.md"
|
|
131
|
-
|| segment.transform?.kind !== "utf8-trim-wrapped-managed-core"
|
|
132
|
-
|| typeof segment.transform.beginMarker !== "string" || !segment.transform.beginMarker
|
|
133
|
-
|| typeof segment.transform.endMarker !== "string" || !segment.transform.endMarker
|
|
134
|
-
|| !validSegmentByteIdentity(segment.artifactSource)
|
|
135
|
-
|| !validSegmentByteIdentity(segment.transform.core)) {
|
|
136
|
-
throw new Error(`official origin catalog managed segment is invalid: ${normalizedVersion} ${targetRel}`);
|
|
137
|
-
}
|
|
138
|
-
return Object.freeze({
|
|
139
|
-
version: normalizedVersion,
|
|
140
|
-
targetRel,
|
|
141
|
-
sourceRel: segment.sourceRel,
|
|
142
|
-
artifact: Object.freeze({ spec: npm.spec, shasum: npm.shasum, integrity: npm.integrity }),
|
|
143
|
-
artifactSource: Object.freeze({ ...segment.artifactSource }),
|
|
144
|
-
transform: Object.freeze({
|
|
145
|
-
kind: segment.transform.kind,
|
|
146
|
-
beginMarker: segment.transform.beginMarker,
|
|
147
|
-
endMarker: segment.transform.endMarker,
|
|
148
|
-
core: Object.freeze({ ...segment.transform.core })
|
|
149
|
-
})
|
|
150
|
-
});
|
|
151
|
-
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// A managed segment is deliberately narrower than a whole-file catalog
|
|
115
|
+
// identity. It exists only when the release is tied to an npm artifact and
|
|
116
|
+
// its raw source plus transformed core bytes are recorded in this catalog.
|
|
117
|
+
// Markers, filenames, headings, and language never grant this authority.
|
|
118
|
+
export function getArtifactBoundManagedSegment({ version, targetRel, catalog }) {
|
|
119
|
+
assertCatalogShape(catalog);
|
|
120
|
+
const normalizedVersion = stripVersionPrefix(version);
|
|
121
|
+
const release = catalog.releases[normalizedVersion];
|
|
122
|
+
const segment = release?.managedSegments?.[targetRel];
|
|
123
|
+
if (!segment) return null;
|
|
124
|
+
const npm = release.source?.npm;
|
|
125
|
+
if (!npm || typeof npm.spec !== "string" || !/^[a-f0-9]{40}$/.test(npm.shasum)
|
|
126
|
+
|| typeof npm.integrity !== "string" || !npm.integrity.startsWith("sha512-")) {
|
|
127
|
+
throw new Error(`official origin catalog managed segment has no artifact identity: ${normalizedVersion} ${targetRel}`);
|
|
128
|
+
}
|
|
129
|
+
if (!segment || typeof segment !== "object" || Array.isArray(segment)
|
|
130
|
+
|| segment.sourceRel !== "runtime-core/AGENTS.core.md"
|
|
131
|
+
|| segment.transform?.kind !== "utf8-trim-wrapped-managed-core"
|
|
132
|
+
|| typeof segment.transform.beginMarker !== "string" || !segment.transform.beginMarker
|
|
133
|
+
|| typeof segment.transform.endMarker !== "string" || !segment.transform.endMarker
|
|
134
|
+
|| !validSegmentByteIdentity(segment.artifactSource)
|
|
135
|
+
|| !validSegmentByteIdentity(segment.transform.core)) {
|
|
136
|
+
throw new Error(`official origin catalog managed segment is invalid: ${normalizedVersion} ${targetRel}`);
|
|
137
|
+
}
|
|
138
|
+
return Object.freeze({
|
|
139
|
+
version: normalizedVersion,
|
|
140
|
+
targetRel,
|
|
141
|
+
sourceRel: segment.sourceRel,
|
|
142
|
+
artifact: Object.freeze({ spec: npm.spec, shasum: npm.shasum, integrity: npm.integrity }),
|
|
143
|
+
artifactSource: Object.freeze({ ...segment.artifactSource }),
|
|
144
|
+
transform: Object.freeze({
|
|
145
|
+
kind: segment.transform.kind,
|
|
146
|
+
beginMarker: segment.transform.beginMarker,
|
|
147
|
+
endMarker: segment.transform.endMarker,
|
|
148
|
+
core: Object.freeze({ ...segment.transform.core })
|
|
149
|
+
})
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
152
|
|
|
153
153
|
export function normalizeNewlines(text) {
|
|
154
154
|
return String(text).replace(/\r\n?/g, "\n");
|
|
@@ -228,15 +228,15 @@ function materializeHandoffOpeningRoot(text, root) {
|
|
|
228
228
|
return `${before}${opening}${text.slice(fenceEnd)}`;
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
function stripVersionPrefix(version) {
|
|
232
|
-
return String(version ?? "").replace(/^v/, "");
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
function validSegmentByteIdentity(value) {
|
|
236
|
-
return Boolean(value && typeof value === "object" && !Array.isArray(value)
|
|
237
|
-
&& /^[a-f0-9]{64}$/.test(value.sha256)
|
|
238
|
-
&& Number.isInteger(value.bytes) && value.bytes >= 0);
|
|
239
|
-
}
|
|
231
|
+
function stripVersionPrefix(version) {
|
|
232
|
+
return String(version ?? "").replace(/^v/, "");
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function validSegmentByteIdentity(value) {
|
|
236
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value)
|
|
237
|
+
&& /^[a-f0-9]{64}$/.test(value.sha256)
|
|
238
|
+
&& Number.isInteger(value.bytes) && value.bytes >= 0);
|
|
239
|
+
}
|
|
240
240
|
|
|
241
241
|
function assertCatalogShape(catalog) {
|
|
242
242
|
if (!catalog || catalog.schemaVersion !== OFFICIAL_ORIGIN_CATALOG_SCHEMA) {
|