zcode-acp-server 0.46.7 → 0.47.1
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 +1 -1
- package/dist/code-fingerprint.json +2 -2
- package/dist/remote/endpoint.d.ts.map +1 -1
- package/dist/remote/endpoint.js +23 -0
- package/dist/remote/endpoint.js.map +1 -1
- package/dist/remote/hub-server.d.ts.map +1 -1
- package/dist/remote/hub-server.js +115 -2
- package/dist/remote/hub-server.js.map +1 -1
- package/dist/remote/settings-endpoint.d.ts +47 -0
- package/dist/remote/settings-endpoint.d.ts.map +1 -0
- package/dist/remote/settings-endpoint.js +1046 -0
- package/dist/remote/settings-endpoint.js.map +1 -0
- package/dist/settings/agents-config.d.ts +158 -0
- package/dist/settings/agents-config.d.ts.map +1 -0
- package/dist/settings/agents-config.js +598 -0
- package/dist/settings/agents-config.js.map +1 -0
- package/dist/settings/app-update.d.ts +193 -0
- package/dist/settings/app-update.d.ts.map +1 -0
- package/dist/settings/app-update.js +659 -0
- package/dist/settings/app-update.js.map +1 -0
- package/dist/settings/atomic-write.d.ts +106 -0
- package/dist/settings/atomic-write.d.ts.map +1 -0
- package/dist/settings/atomic-write.js +228 -0
- package/dist/settings/atomic-write.js.map +1 -0
- package/dist/settings/cli-config.d.ts +162 -0
- package/dist/settings/cli-config.d.ts.map +1 -0
- package/dist/settings/cli-config.js +369 -0
- package/dist/settings/cli-config.js.map +1 -0
- package/dist/settings/coding-plan.d.ts +106 -0
- package/dist/settings/coding-plan.d.ts.map +1 -0
- package/dist/settings/coding-plan.js +299 -0
- package/dist/settings/coding-plan.js.map +1 -0
- package/dist/settings/file-lock.d.ts +39 -0
- package/dist/settings/file-lock.d.ts.map +1 -0
- package/dist/settings/file-lock.js +282 -0
- package/dist/settings/file-lock.js.map +1 -0
- package/dist/settings/provider-config.d.ts +123 -0
- package/dist/settings/provider-config.d.ts.map +1 -0
- package/dist/settings/provider-config.js +311 -0
- package/dist/settings/provider-config.js.map +1 -0
- package/dist/settings/skills.d.ts +72 -0
- package/dist/settings/skills.d.ts.map +1 -0
- package/dist/settings/skills.js +245 -0
- package/dist/settings/skills.js.map +1 -0
- package/dist/settings/usage-stats.d.ts +74 -0
- package/dist/settings/usage-stats.d.ts.map +1 -0
- package/dist/settings/usage-stats.js +235 -0
- package/dist/settings/usage-stats.js.map +1 -0
- package/dist/utils.d.ts +14 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +22 -0
- package/dist/utils.js.map +1 -1
- package/docs/ARCHITECTURE.md +65 -0
- package/docs/REMOTE-CLIENTS.md +285 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-update.js","sourceRoot":"","sources":["../../src/settings/app-update.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C,6EAA6E;AAC7E,SAAS,SAAS,CAAC,MAAyB,OAAO,C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AAG,GAAG,CAAC;IACf,OAAO,GAAG,CAAC;AACb,CAAC;AAED,kDAAkD;AAClD,MAAM,UAAU,0BAA0B;IACxC,YAAY,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IACpF,QAAQ,GAAG,IAAI,CAAC;IAChB,0EAA0E;IAC1E,kEAAkE;IAClE,iBAAiB,IAAI,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locked, validated, backed-up JSON writes for the app-owned config files.
|
|
3
|
+
*
|
|
4
|
+
* Four invariants, in order (ADR-0026):
|
|
5
|
+
*
|
|
6
|
+
* 1. **Cross-process mutual exclusion.** Every write holds ZCode's own file
|
|
7
|
+
* lock, so a settings write never discards a change the desktop app is
|
|
8
|
+
* making at the same moment.
|
|
9
|
+
* 2. **Read-modify-write, never rewrite.** The mutator receives the parsed
|
|
10
|
+
* current document and returns the next one, so keys this module knows
|
|
11
|
+
* nothing about survive byte-for-byte. The same file carries skills, MCP,
|
|
12
|
+
* hooks, plugins and agent-runtime settings owned by different writers.
|
|
13
|
+
* 3. **Self-validation before the bytes land.** `validate(encode(next))`
|
|
14
|
+
* must succeed; a candidate that cannot round-trip is refused, because the
|
|
15
|
+
* failure mode otherwise is the backend silently degrading to an empty
|
|
16
|
+
* overlay while the user watches their models disappear.
|
|
17
|
+
* 4. **Backup then atomic rename.** The previous content is copied to
|
|
18
|
+
* `<file>.bak-<timestamp>` (newest 5 kept) before a temp file is renamed
|
|
19
|
+
* over the target. A crash mid-write leaves either the old file or the new
|
|
20
|
+
* one, never a torn document.
|
|
21
|
+
*
|
|
22
|
+
* A corrupt existing file REFUSES the write instead of being treated as `{}`:
|
|
23
|
+
* silently rewriting a damaged document from an empty base would destroy
|
|
24
|
+
* whatever is still recoverable in it.
|
|
25
|
+
*
|
|
26
|
+
* Scope of invariant 1, precisely: ZCode takes this lock for
|
|
27
|
+
* `provider_config.json`, `credentials.json` and the builtin-provider config,
|
|
28
|
+
* so those three are genuinely mutually excluded against a running desktop app.
|
|
29
|
+
* `cli/config.json` is NOT locked by the app's own writer (it does a bare
|
|
30
|
+
* temp+rename), so for that file the lock only excludes other BRIDGE
|
|
31
|
+
* processes — concurrent edits still lose one side's change, exactly as they
|
|
32
|
+
* do between the app's own multiple processes. Invariants 2-4 hold everywhere.
|
|
33
|
+
*/
|
|
34
|
+
import { type FileLockOptions } from "./file-lock.js";
|
|
35
|
+
/** How many timestamped backups to keep per file. */
|
|
36
|
+
export declare const BACKUP_KEEP = 5;
|
|
37
|
+
/** Serialization for the config files this module owns: 2-space, trailing newline. */
|
|
38
|
+
export declare function encodeJson(value: unknown): string;
|
|
39
|
+
/**
|
|
40
|
+
* Read + parse a config file.
|
|
41
|
+
*
|
|
42
|
+
* @returns the parsed document, or `null` when the file is absent.
|
|
43
|
+
* @throws when the file exists but is not a JSON object — the caller must
|
|
44
|
+
* refuse the write rather than base it on an empty document.
|
|
45
|
+
*/
|
|
46
|
+
export declare function readJsonDocument(file: string): Promise<Record<string, unknown> | null>;
|
|
47
|
+
export interface WriteJsonOptions extends FileLockOptions {
|
|
48
|
+
/**
|
|
49
|
+
* Serializer for the bytes that land on disk. Defaults to
|
|
50
|
+
* {@link encodeJson} (2-space + trailing newline); pass a custom one for
|
|
51
|
+
* files whose canonical form differs.
|
|
52
|
+
*/
|
|
53
|
+
encode?: (doc: Record<string, unknown>) => string;
|
|
54
|
+
/**
|
|
55
|
+
* Round-trip check on the candidate document. Return `false` (or throw) to
|
|
56
|
+
* refuse the write; nothing is backed up or renamed in that case.
|
|
57
|
+
*/
|
|
58
|
+
validate?: (doc: Record<string, unknown>) => boolean | string;
|
|
59
|
+
/** Skip the pre-write backup (used by the restore path, which re-backs-up). */
|
|
60
|
+
skipBackup?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface WriteJsonResult {
|
|
63
|
+
/** The document actually written. */
|
|
64
|
+
doc: Record<string, unknown>;
|
|
65
|
+
/** Backup path taken before the write, when one existed. */
|
|
66
|
+
backup?: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Read-modify-write one config file under the file lock.
|
|
70
|
+
*
|
|
71
|
+
* @param mutator receives the parsed current document (an empty object when
|
|
72
|
+
* the file is absent) and returns the next document. Returning the same
|
|
73
|
+
* reference is a no-op that still validates and writes.
|
|
74
|
+
* @throws on a corrupt existing file, a failed validation, or a lock timeout.
|
|
75
|
+
*/
|
|
76
|
+
export declare function writeJsonAtomic(file: string, mutator: (current: Record<string, unknown>) => Record<string, unknown> | Promise<Record<string, unknown>>, options?: WriteJsonOptions): Promise<WriteJsonResult>;
|
|
77
|
+
/**
|
|
78
|
+
* Write a non-JSON text file (agent markdown) atomically.
|
|
79
|
+
*
|
|
80
|
+
* The config files are JSON and go through `writeJsonAtomic`; agent markdown is
|
|
81
|
+
* a different format but has the same crash-safety requirement — a plain
|
|
82
|
+
* `writeFile` truncates in place, so a crash mid-write leaves a torn file with
|
|
83
|
+
* no backup to recover from. Same shape as the JSON path minus the JSON encode
|
|
84
|
+
* and validation: backup, temp file in the same directory, rename.
|
|
85
|
+
*
|
|
86
|
+
* No file lock: ZCode's own writer for `~/.zcode/agents/*.md` does not take the
|
|
87
|
+
* config lock, so taking it here would buy mutual exclusion only against other
|
|
88
|
+
* bridge processes while adding contention the app never has.
|
|
89
|
+
*/
|
|
90
|
+
export declare function writeTextAtomic(file: string, content: string, options?: {
|
|
91
|
+
skipBackup?: boolean;
|
|
92
|
+
}): Promise<void>;
|
|
93
|
+
/** List the backups currently held for a config file, newest first. */
|
|
94
|
+
export declare function listBackups(file: string): Promise<Array<{
|
|
95
|
+
path: string;
|
|
96
|
+
createdAt: string;
|
|
97
|
+
}>>;
|
|
98
|
+
/**
|
|
99
|
+
* Rebuild an ISO timestamp from the flattened backup stamp.
|
|
100
|
+
*
|
|
101
|
+
* `new Date().toISOString()` yields `2026-09-22T14:10:00.000Z`; the backup name
|
|
102
|
+
* flattens `:` and `.` to `-`, giving `2026-09-22T14-10-00-000Z`. The date half
|
|
103
|
+
* keeps its dashes, so only the trailing four segments are restored.
|
|
104
|
+
*/
|
|
105
|
+
export declare function backupStampToIso(stamp: string): string;
|
|
106
|
+
//# sourceMappingURL=atomic-write.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atomic-write.d.ts","sourceRoot":"","sources":["../../src/settings/atomic-write.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAKH,OAAO,EAAgB,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGpE,qDAAqD;AACrD,eAAO,MAAM,WAAW,IAAI,CAAC;AAE7B,sFAAsF;AACtF,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEjD;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAoB5F;AA4DD,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD;;;;OAIG;IACH,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC;IAClD;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,GAAG,MAAM,CAAC;IAC9D,+EAA+E;IAC/E,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,qCAAqC;IACrC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,CACP,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC7B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC/D,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,eAAe,CAAC,CA2C1B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,GACrC,OAAO,CAAC,IAAI,CAAC,CAef;AAMD,uEAAuE;AACvE,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAUrD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAItD"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locked, validated, backed-up JSON writes for the app-owned config files.
|
|
3
|
+
*
|
|
4
|
+
* Four invariants, in order (ADR-0026):
|
|
5
|
+
*
|
|
6
|
+
* 1. **Cross-process mutual exclusion.** Every write holds ZCode's own file
|
|
7
|
+
* lock, so a settings write never discards a change the desktop app is
|
|
8
|
+
* making at the same moment.
|
|
9
|
+
* 2. **Read-modify-write, never rewrite.** The mutator receives the parsed
|
|
10
|
+
* current document and returns the next one, so keys this module knows
|
|
11
|
+
* nothing about survive byte-for-byte. The same file carries skills, MCP,
|
|
12
|
+
* hooks, plugins and agent-runtime settings owned by different writers.
|
|
13
|
+
* 3. **Self-validation before the bytes land.** `validate(encode(next))`
|
|
14
|
+
* must succeed; a candidate that cannot round-trip is refused, because the
|
|
15
|
+
* failure mode otherwise is the backend silently degrading to an empty
|
|
16
|
+
* overlay while the user watches their models disappear.
|
|
17
|
+
* 4. **Backup then atomic rename.** The previous content is copied to
|
|
18
|
+
* `<file>.bak-<timestamp>` (newest 5 kept) before a temp file is renamed
|
|
19
|
+
* over the target. A crash mid-write leaves either the old file or the new
|
|
20
|
+
* one, never a torn document.
|
|
21
|
+
*
|
|
22
|
+
* A corrupt existing file REFUSES the write instead of being treated as `{}`:
|
|
23
|
+
* silently rewriting a damaged document from an empty base would destroy
|
|
24
|
+
* whatever is still recoverable in it.
|
|
25
|
+
*
|
|
26
|
+
* Scope of invariant 1, precisely: ZCode takes this lock for
|
|
27
|
+
* `provider_config.json`, `credentials.json` and the builtin-provider config,
|
|
28
|
+
* so those three are genuinely mutually excluded against a running desktop app.
|
|
29
|
+
* `cli/config.json` is NOT locked by the app's own writer (it does a bare
|
|
30
|
+
* temp+rename), so for that file the lock only excludes other BRIDGE
|
|
31
|
+
* processes — concurrent edits still lose one side's change, exactly as they
|
|
32
|
+
* do between the app's own multiple processes. Invariants 2-4 hold everywhere.
|
|
33
|
+
*/
|
|
34
|
+
import { mkdir, readFile, readdir, rename, rm, writeFile } from "node:fs/promises";
|
|
35
|
+
import { dirname, join } from "node:path";
|
|
36
|
+
import { withFileLock } from "./file-lock.js";
|
|
37
|
+
import { warn } from "../utils.js";
|
|
38
|
+
/** How many timestamped backups to keep per file. */
|
|
39
|
+
export const BACKUP_KEEP = 5;
|
|
40
|
+
/** Serialization for the config files this module owns: 2-space, trailing newline. */
|
|
41
|
+
export function encodeJson(value) {
|
|
42
|
+
return `${JSON.stringify(value, null, 2)}\n`;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Read + parse a config file.
|
|
46
|
+
*
|
|
47
|
+
* @returns the parsed document, or `null` when the file is absent.
|
|
48
|
+
* @throws when the file exists but is not a JSON object — the caller must
|
|
49
|
+
* refuse the write rather than base it on an empty document.
|
|
50
|
+
*/
|
|
51
|
+
export async function readJsonDocument(file) {
|
|
52
|
+
let raw;
|
|
53
|
+
try {
|
|
54
|
+
raw = await readFile(file, "utf8");
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
if (error?.code === "ENOENT")
|
|
58
|
+
return null;
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
let parsed;
|
|
62
|
+
try {
|
|
63
|
+
parsed = JSON.parse(raw);
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
throw new Error(`${file} is not valid JSON — refusing to write (${error instanceof Error ? error.message : String(error)})`);
|
|
67
|
+
}
|
|
68
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
69
|
+
throw new Error(`${file} is not a JSON object — refusing to write`);
|
|
70
|
+
}
|
|
71
|
+
return parsed;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Scan a directory for `<basename>.bak-*` entries, newest first.
|
|
75
|
+
*
|
|
76
|
+
* `readdir` yields bare file names, so the prefix must be the BASENAME — an
|
|
77
|
+
* absolute-path prefix never matches and the rotation silently keeps
|
|
78
|
+
* everything. The stamp is a flattened ISO timestamp, whose lexicographic
|
|
79
|
+
* order equals chronological order, so a string sort is the date sort.
|
|
80
|
+
*/
|
|
81
|
+
async function scanBackups(file) {
|
|
82
|
+
const dir = dirname(file);
|
|
83
|
+
const prefix = `${basename(file)}.bak-`;
|
|
84
|
+
let entries;
|
|
85
|
+
try {
|
|
86
|
+
entries = await readdir(dir);
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return []; // directory vanished — nothing to scan
|
|
90
|
+
}
|
|
91
|
+
return entries
|
|
92
|
+
.filter((name) => name.startsWith(prefix))
|
|
93
|
+
.map((name) => ({ name, path: join(dir, name) }))
|
|
94
|
+
.sort((a, b) => (a.name < b.name ? 1 : -1)); // newest first
|
|
95
|
+
}
|
|
96
|
+
/** Rotate `<file>.bak-<ts>` copies down to {@link BACKUP_KEEP} newest. */
|
|
97
|
+
async function pruneBackups(file) {
|
|
98
|
+
const backups = await scanBackups(file);
|
|
99
|
+
for (const stale of backups.slice(BACKUP_KEEP)) {
|
|
100
|
+
await rm(stale.path, { force: true }).catch(() => { });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Copy the current content aside before it is replaced.
|
|
105
|
+
*
|
|
106
|
+
* @returns the backup path, or undefined when there was nothing to back up or
|
|
107
|
+
* the copy failed (a failed backup never blocks the write itself).
|
|
108
|
+
*/
|
|
109
|
+
async function backupCurrent(file) {
|
|
110
|
+
let raw;
|
|
111
|
+
try {
|
|
112
|
+
raw = await readFile(file, "utf8");
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
return undefined; // absent (or unreadable) — nothing worth backing up
|
|
116
|
+
}
|
|
117
|
+
const stamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
118
|
+
const backupPath = `${file}.bak-${stamp}`;
|
|
119
|
+
try {
|
|
120
|
+
await writeFile(backupPath, raw, { encoding: "utf8", mode: 0o600 });
|
|
121
|
+
await pruneBackups(file);
|
|
122
|
+
return backupPath;
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
warn(`settings: backup of ${file} failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Read-modify-write one config file under the file lock.
|
|
131
|
+
*
|
|
132
|
+
* @param mutator receives the parsed current document (an empty object when
|
|
133
|
+
* the file is absent) and returns the next document. Returning the same
|
|
134
|
+
* reference is a no-op that still validates and writes.
|
|
135
|
+
* @throws on a corrupt existing file, a failed validation, or a lock timeout.
|
|
136
|
+
*/
|
|
137
|
+
export async function writeJsonAtomic(file, mutator, options = {}) {
|
|
138
|
+
return withFileLock(file, async () => {
|
|
139
|
+
const current = await readJsonDocument(file);
|
|
140
|
+
const next = await mutator(current ?? {});
|
|
141
|
+
const encoded = (options.encode ?? encodeJson)(next);
|
|
142
|
+
if (options.validate) {
|
|
143
|
+
const verdict = options.validate(next);
|
|
144
|
+
if (verdict !== true) {
|
|
145
|
+
throw new Error(typeof verdict === "string"
|
|
146
|
+
? `refusing to write ${file}: ${verdict}`
|
|
147
|
+
: `refusing to write ${file}: validation failed`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// Re-parse the encoded bytes: what lands on disk must decode back to the
|
|
151
|
+
// same document, otherwise the writer and the reader disagree about the
|
|
152
|
+
// file's meaning.
|
|
153
|
+
const reparsed = JSON.parse(encoded);
|
|
154
|
+
if (typeof reparsed !== "object" || reparsed === null || Array.isArray(reparsed)) {
|
|
155
|
+
throw new Error(`refusing to write ${file}: encoded document is not an object`);
|
|
156
|
+
}
|
|
157
|
+
const backup = options.skipBackup ? undefined : await backupCurrent(file);
|
|
158
|
+
const dir = dirname(file);
|
|
159
|
+
await mkdir(dir, { recursive: true });
|
|
160
|
+
const temp = join(dir, `.${basename(file)}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}.tmp`);
|
|
161
|
+
try {
|
|
162
|
+
await writeFile(temp, encoded, { encoding: "utf8", mode: 0o600 });
|
|
163
|
+
await rename(temp, file);
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
await rm(temp, { force: true }).catch(() => { });
|
|
167
|
+
throw error;
|
|
168
|
+
}
|
|
169
|
+
return { doc: next, ...(backup !== undefined ? { backup } : {}) };
|
|
170
|
+
}, options);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Write a non-JSON text file (agent markdown) atomically.
|
|
174
|
+
*
|
|
175
|
+
* The config files are JSON and go through `writeJsonAtomic`; agent markdown is
|
|
176
|
+
* a different format but has the same crash-safety requirement — a plain
|
|
177
|
+
* `writeFile` truncates in place, so a crash mid-write leaves a torn file with
|
|
178
|
+
* no backup to recover from. Same shape as the JSON path minus the JSON encode
|
|
179
|
+
* and validation: backup, temp file in the same directory, rename.
|
|
180
|
+
*
|
|
181
|
+
* No file lock: ZCode's own writer for `~/.zcode/agents/*.md` does not take the
|
|
182
|
+
* config lock, so taking it here would buy mutual exclusion only against other
|
|
183
|
+
* bridge processes while adding contention the app never has.
|
|
184
|
+
*/
|
|
185
|
+
export async function writeTextAtomic(file, content, options = {}) {
|
|
186
|
+
if (!options.skipBackup)
|
|
187
|
+
await backupCurrent(file);
|
|
188
|
+
const dir = dirname(file);
|
|
189
|
+
await mkdir(dir, { recursive: true });
|
|
190
|
+
const temp = join(dir, `.${basename(file)}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}.tmp`);
|
|
191
|
+
try {
|
|
192
|
+
await writeFile(temp, content, { encoding: "utf8", mode: 0o600 });
|
|
193
|
+
await rename(temp, file);
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
await rm(temp, { force: true }).catch(() => { });
|
|
197
|
+
throw error;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function basename(file) {
|
|
201
|
+
return file.split(/[\\/]/).pop() ?? file;
|
|
202
|
+
}
|
|
203
|
+
/** List the backups currently held for a config file, newest first. */
|
|
204
|
+
export async function listBackups(file) {
|
|
205
|
+
const prefix = `${basename(file)}.bak-`;
|
|
206
|
+
return (await scanBackups(file)).map(({ name, path: backupPath }) => ({
|
|
207
|
+
path: backupPath,
|
|
208
|
+
// The stamp is the ISO time with ':' and '.' flattened. Only the TIME part
|
|
209
|
+
// used those separators — the date uses '-' natively — so rebuilding by
|
|
210
|
+
// replacing every '-' would corrupt the date (`2026:09:22T…`). Restore the
|
|
211
|
+
// time segments only.
|
|
212
|
+
createdAt: backupStampToIso(name.slice(prefix.length)),
|
|
213
|
+
}));
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Rebuild an ISO timestamp from the flattened backup stamp.
|
|
217
|
+
*
|
|
218
|
+
* `new Date().toISOString()` yields `2026-09-22T14:10:00.000Z`; the backup name
|
|
219
|
+
* flattens `:` and `.` to `-`, giving `2026-09-22T14-10-00-000Z`. The date half
|
|
220
|
+
* keeps its dashes, so only the trailing four segments are restored.
|
|
221
|
+
*/
|
|
222
|
+
export function backupStampToIso(stamp) {
|
|
223
|
+
const match = /^(.*T)(\d+)-(\d+)-(\d+)-(\d+)Z$/u.exec(stamp);
|
|
224
|
+
if (!match)
|
|
225
|
+
return stamp;
|
|
226
|
+
return `${match[1]}${match[2]}:${match[3]}:${match[4]}.${match[5]}Z`;
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=atomic-write.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atomic-write.js","sourceRoot":"","sources":["../../src/settings/atomic-write.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAwB,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,qDAAqD;AACrD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAE7B,sFAAsF;AACtF,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;AAC/C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAAY;IACjD,IAAI,GAAW,CAAC;IAChB,IAAI,CAAC;QACH,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACrC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;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AwE;QACxE,2EAA2E;QAC3E,sBAAsB;QACtB,SAAS,EAAE,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;KACvD,CAAC,CAAC,CAAC;AACN,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,MAAM,KAAK,GAAG,kCAAkC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7D,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACzB,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read/write for the ZCode CLI config (`~/.zcode/cli/config.json`).
|
|
3
|
+
*
|
|
4
|
+
* ONE file, four independent owners: skills enablement, MCP servers, hooks, and
|
|
5
|
+
* plugins. Every writer is therefore a read-modify-write that preserves keys it
|
|
6
|
+
* does not recognise — the file also carries agent-runtime settings owned by
|
|
7
|
+
* the backend, and rewriting from a partial model would silently delete them.
|
|
8
|
+
*
|
|
9
|
+
* The enable/disable spellings are not symmetric, and getting them wrong makes
|
|
10
|
+
* a toggle look broken while the file is technically valid:
|
|
11
|
+
*
|
|
12
|
+
* - **skills**: key = the SKILL.md absolute path, value `{enable: false}`.
|
|
13
|
+
* `enable: true` is the DEFAULT and must DELETE the key — writing `true`
|
|
14
|
+
* leaves a permanent override that shadows later enablement changes.
|
|
15
|
+
* - **MCP**: `enabled: false` inside the server object. Same rule: `true`
|
|
16
|
+
* deletes the key (and a legacy `enable` key is migrated on the way).
|
|
17
|
+
* - **hooks**: a whole different shape — a nested tree under `hooks`, gated by
|
|
18
|
+
* a top-level `hooks.enabled: true`. WITHOUT that flag every hook in the file
|
|
19
|
+
* is inert, which is the single most common way a hand-written config does
|
|
20
|
+
* nothing.
|
|
21
|
+
* - **plugins**: `enabledPlugins` / `suppressedBuiltins` maps keyed by
|
|
22
|
+
* `<name>@<marketplace>`.
|
|
23
|
+
*
|
|
24
|
+
* None of these are hot-reloaded by the agent: `cli/config.json` is read once
|
|
25
|
+
* at agent start (MCP servers are frozen into the runtime config), except the
|
|
26
|
+
* skills enablement map which the host re-reads live. Writes therefore report
|
|
27
|
+
* `needs-restart` for MCP and hooks, `immediate` for skills.
|
|
28
|
+
*/
|
|
29
|
+
/** The seven hook events the schema accepts, in its own order. */
|
|
30
|
+
export declare const HOOK_EVENT_NAMES: readonly ["SessionStart", "UserPromptSubmit", "PreToolUse", "PermissionRequest", "PostToolUse", "PostToolUseFailure", "Stop"];
|
|
31
|
+
export type HookEventName = (typeof HOOK_EVENT_NAMES)[number];
|
|
32
|
+
/** One hook entry. Passthrough in the schema — unknown keys are preserved. */
|
|
33
|
+
export interface HookEntry {
|
|
34
|
+
type: "command" | "process";
|
|
35
|
+
command: string;
|
|
36
|
+
enabled?: boolean;
|
|
37
|
+
async?: boolean;
|
|
38
|
+
shell?: true | string;
|
|
39
|
+
/** Seconds (only meaningful for `type: "command"`). */
|
|
40
|
+
timeout?: number;
|
|
41
|
+
/** Milliseconds; wins over `timeout` when both are present. */
|
|
42
|
+
timeoutMs?: number;
|
|
43
|
+
args?: string[];
|
|
44
|
+
statusMessage?: string;
|
|
45
|
+
[key: string]: unknown;
|
|
46
|
+
}
|
|
47
|
+
/** One matcher group under an event. STRICT in the schema — no unknown keys. */
|
|
48
|
+
export interface HookMatcher {
|
|
49
|
+
matcher?: string;
|
|
50
|
+
hooks: HookEntry[];
|
|
51
|
+
}
|
|
52
|
+
export interface HooksConfig {
|
|
53
|
+
enabled?: boolean;
|
|
54
|
+
timeoutMs?: number;
|
|
55
|
+
maxOutputBytes?: number;
|
|
56
|
+
events?: Partial<Record<HookEventName, HookMatcher[]>>;
|
|
57
|
+
}
|
|
58
|
+
export interface McpServerConfig {
|
|
59
|
+
type?: string;
|
|
60
|
+
url?: string;
|
|
61
|
+
command?: string;
|
|
62
|
+
args?: string[];
|
|
63
|
+
env?: Record<string, string>;
|
|
64
|
+
headers?: Record<string, string>;
|
|
65
|
+
enabled?: boolean;
|
|
66
|
+
[key: string]: unknown;
|
|
67
|
+
}
|
|
68
|
+
export interface CliConfigFile {
|
|
69
|
+
skills?: Record<string, {
|
|
70
|
+
enable?: boolean;
|
|
71
|
+
}>;
|
|
72
|
+
mcp?: {
|
|
73
|
+
servers?: Record<string, McpServerConfig>;
|
|
74
|
+
};
|
|
75
|
+
hooks?: HooksConfig;
|
|
76
|
+
plugins?: {
|
|
77
|
+
enabled?: boolean;
|
|
78
|
+
dirs?: string[];
|
|
79
|
+
enabledPlugins?: Record<string, boolean>;
|
|
80
|
+
suppressedBuiltins?: string[];
|
|
81
|
+
[key: string]: unknown;
|
|
82
|
+
};
|
|
83
|
+
[key: string]: unknown;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Read the CLI config.
|
|
87
|
+
*
|
|
88
|
+
* @throws when the file exists but is malformed. Unlike the app's skills
|
|
89
|
+
* writer (which silently reads damage as `{}` and would then rewrite
|
|
90
|
+
* the file from an empty base), this refuses — the caller surfaces an
|
|
91
|
+
* error instead of destroying what is left of the document.
|
|
92
|
+
*/
|
|
93
|
+
export declare function readCliConfig(): Promise<CliConfigFile>;
|
|
94
|
+
/** Structural check for the parts of the file this module owns. */
|
|
95
|
+
export declare function validateCliConfig(doc: Record<string, unknown>): boolean | string;
|
|
96
|
+
/**
|
|
97
|
+
* Type-check the known MCP server fields before they reach the config file.
|
|
98
|
+
*
|
|
99
|
+
* The route passes the request body through to `upsertMcpServer` unmerged, and
|
|
100
|
+
* the schema check above only asks "is it an object" — so without this a
|
|
101
|
+
* `{"args": "npx"}` (string where the runtime expects an array) would persist
|
|
102
|
+
* happily. It does NOT take the whole map down: the runtime validates each
|
|
103
|
+
* entry separately and skips only the bad one (source: ZCode
|
|
104
|
+
* `packages/adapters/src/config/schema.ts`, `normalizeConfigFileInput` —
|
|
105
|
+
* per-entry `mcpServerSchema.safeParse` with a `config_mcp_server_invalid`
|
|
106
|
+
* warning). What the user loses is the server they just added, disappearing
|
|
107
|
+
* with no error anywhere in the bridge — so the write is refused here, where
|
|
108
|
+
* the reason can be reported, instead of being silently dropped at the next
|
|
109
|
+
* agent start. Unknown keys still pass through: the runtime keeps adding
|
|
110
|
+
* fields and the file is not ours to narrow.
|
|
111
|
+
*/
|
|
112
|
+
export declare function validateMcpServer(name: string, server: unknown): boolean | string;
|
|
113
|
+
/**
|
|
114
|
+
* Set a skill's enabled state.
|
|
115
|
+
*
|
|
116
|
+
* `enable: true` REMOVES the override rather than writing `true` — enabled is
|
|
117
|
+
* the default state, and a stored `true` is a permanent pin that would shadow
|
|
118
|
+
* the file's real state.
|
|
119
|
+
*/
|
|
120
|
+
export declare function setSkillEnabled(skillPath: string, enable: boolean): Promise<CliConfigFile>;
|
|
121
|
+
/**
|
|
122
|
+
* Create or update an MCP server.
|
|
123
|
+
*
|
|
124
|
+
* `enabled: true` deletes the flag (and a legacy `enable` key) instead of
|
|
125
|
+
* storing it; only a DISABLE is worth persisting.
|
|
126
|
+
*/
|
|
127
|
+
export declare function upsertMcpServer(name: string, server: McpServerConfig): Promise<CliConfigFile>;
|
|
128
|
+
/** Enable or disable an existing MCP server. */
|
|
129
|
+
export declare function setMcpServerEnabled(name: string, enabled: boolean): Promise<CliConfigFile>;
|
|
130
|
+
export declare function removeMcpServer(name: string): Promise<CliConfigFile>;
|
|
131
|
+
/**
|
|
132
|
+
* Read the hooks tree. Returns the raw config; an absent file yields `{}`.
|
|
133
|
+
*
|
|
134
|
+
* Note the returned `enabled` flag: hooks are inert unless the top-level flag
|
|
135
|
+
* is `true`, so callers must surface it rather than inferring it.
|
|
136
|
+
*/
|
|
137
|
+
export declare function readHooks(): Promise<HooksConfig>;
|
|
138
|
+
/**
|
|
139
|
+
* Set the global hooks switch.
|
|
140
|
+
*
|
|
141
|
+
* A file full of hooks with `enabled` absent runs NOTHING — the runtime root
|
|
142
|
+
* defaults to disabled. This is the one field that turns the whole tree on.
|
|
143
|
+
*/
|
|
144
|
+
export declare function setHooksEnabled(enabled: boolean): Promise<CliConfigFile>;
|
|
145
|
+
/**
|
|
146
|
+
* Edit ONE existing hook entry in place.
|
|
147
|
+
*
|
|
148
|
+
* Deliberately not a create path: the matcher list is an array of arrays, and
|
|
149
|
+
* an insert shifts every later index, so a remote "add a hook" call races with
|
|
150
|
+
* any concurrent edit of the same event. Editing an existing entry's
|
|
151
|
+
* command/timeout/enabled covers the real use case (temporarily disable one,
|
|
152
|
+
* tweak a command) without that hazard.
|
|
153
|
+
*
|
|
154
|
+
* Unknown keys on the hook object are preserved: the schema is `.passthrough()`
|
|
155
|
+
* precisely so extensions can ride along.
|
|
156
|
+
*/
|
|
157
|
+
export declare function updateHookEntry(event: HookEventName, matcherIndex: number, hookIndex: number, patch: Partial<Pick<HookEntry, "command" | "enabled" | "timeoutMs" | "timeout">>): Promise<CliConfigFile>;
|
|
158
|
+
/** Enable or disable a plugin by its `<name>@<marketplace>` key. */
|
|
159
|
+
export declare function setPluginEnabled(pluginKey: string, enabled: boolean): Promise<CliConfigFile>;
|
|
160
|
+
/** Raw text for the settings snapshot. Absent → null. */
|
|
161
|
+
export declare function readCliConfigRaw(): Promise<string | null>;
|
|
162
|
+
//# sourceMappingURL=cli-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-config.d.ts","sourceRoot":"","sources":["../../src/settings/cli-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAOH,kEAAkE;AAClE,eAAO,MAAM,gBAAgB,+HAQnB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D,8EAA8E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