@sema-agent/settings-schema 19.0.1 → 21.0.0
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 +172 -0
- package/README.md +28 -2
- package/conformance/VERSION +1 -1
- package/conformance/cases/c34-skills-content-vs-manifest/expected.json +0 -3
- package/conformance/cases/c36-skills-entry-without-content/expected.json +0 -3
- package/conformance/cases/c37-skills-field-null/expected.json +0 -3
- package/conformance/cases/c80-prompts-wire-v2-verbatim/expected.json +0 -3
- package/conformance/cases/c84-sandbox-git-block-carried-verbatim/expected.json +0 -3
- package/conformance/cases/c85-sandbox-git-refused-block-still-carried/expected.json +0 -3
- package/dist/config-fns.d.ts +5 -0
- package/dist/config-fns.js +16 -5
- package/dist/conformance/derive.d.ts +1 -1
- package/dist/conformance/derive.js +10 -9
- package/dist/hooks-config.d.ts +54 -25
- package/dist/hooks-config.js +82 -21
- package/dist/retired-envs.js +2 -0
- package/dist/types.d.ts +75 -7
- package/dist/types.js +39 -2
- package/docs/API-SURFACE.md +22 -4
- package/docs/CC-DIVERGENCE.md +4 -4
- package/docs/CONFORMANCE.md +1 -1
- package/docs/CONSUMER-INTEGRATION.md +51 -4
- package/llms-full.txt +10 -4
- package/llms.txt +7 -3
- package/package.json +1 -1
package/dist/hooks-config.d.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* ONE READER. "Can this document's hooks be loaded, and which pieces must go?" has one answer: {@link classifyHooksConfig}. The zod faces
|
|
7
7
|
* below ({@link HooksConfig}, {@link HookMatcherEntry}, {@link HookEntry} and the per-type five) are its PROJECTIONS — accepted ⇔ the
|
|
8
8
|
* classifier says `"loaded"`, the parsed value is what it loaded, each issue is one of its pieces (code + coordinate). There is no second
|
|
9
|
-
* statement of what a valid hook entry is: the per-type field table {@link HOOK_ENTRY_FIELDS} is
|
|
10
|
-
* the
|
|
9
|
+
* statement of what a valid hook entry is: the per-type field table {@link HOOK_ENTRY_FIELDS} (exported) is what the entry TYPES are derived from at
|
|
10
|
+
* compile time, and the classifier reads its closure-private projection of it ({@link HOOK_ENTRY_FIELDS_READ}, tied to the table's type — see there).
|
|
11
11
|
*
|
|
12
12
|
* GRANULARITY = CC 2.1.296 (`cli296.js:237470`, `Yy` → `on`): four levels of piece — the `hooks` key, an event, a matcher, an entry.
|
|
13
13
|
* · Outside the guard events, a bad piece is DROPPED alone (the rest of the document — its `permissions.deny`, its `env` — still applies).
|
|
@@ -31,8 +31,11 @@
|
|
|
31
31
|
* with a sign>] }` reports the matcher's wrong `matcher` field. A sign of the piece decides before a wrong contract field of the same piece does
|
|
32
32
|
* (it is why the piece is rejected rather than dropped).
|
|
33
33
|
*
|
|
34
|
-
* CC 2.1.296 DIVERGENCES (each in the stricter direction — a document CC would load may be rejected here, never the reverse): listed once,
|
|
35
|
-
* in `docs/CC-DIVERGENCE.md` (section "hooks classifier", H1–H7) — the whole-subtree guard-sign scan is the first of them.
|
|
34
|
+
* CC 2.1.296 DIVERGENCES (the ones LISTED there are each in the stricter direction — a document CC would load may be rejected here, never the reverse): listed once,
|
|
35
|
+
* in `docs/CC-DIVERGENCE.md` (section "hooks classifier", H1–H7) — the whole-subtree guard-sign scan is the first of them. The entry field table
|
|
36
|
+
* ({@link HOOK_ENTRY_FIELDS}) carries EVERY key CC's five hook-entry schemas carry (`cli309.js:252382`), so no key CC judges is stripped here unjudged. That is a statement about
|
|
37
|
+
* which KEYS are read; the VALUE forms are the field kinds' (H7 lists where they judge more than CC does), with one known place where a kind judges LESS than CC: an `http` entry's `url`
|
|
38
|
+
* is read as a non-empty string where CC checks URL syntax (not closed yet — see CHANGELOG 20.0.0, "已知限制").
|
|
36
39
|
*
|
|
37
40
|
* COORDINATES are raw {@link ConfigPath} segments (the keys as written). An unknown event name or a key outside `hooks` is user text and may be
|
|
38
41
|
* anything, a pasted credential included: pass a coordinate through `outgoingPath` before it leaves the process (log, UI, wire). The classifier
|
|
@@ -69,25 +72,47 @@ export type HookEntryType = (typeof HOOK_ENTRY_TYPES)[number];
|
|
|
69
72
|
export declare const HOOK_ON_FAILURE_WORDS: readonly ["continue", "block"];
|
|
70
73
|
/** One word of {@link HOOK_ON_FAILURE_WORDS}. */
|
|
71
74
|
export type HookOnFailure = (typeof HOOK_ON_FAILURE_WORDS)[number];
|
|
75
|
+
/**
|
|
76
|
+
* The words CC gives `cloud` (CC `cli309.js:252382`, `cloud:B(["device","skip"]).optional().catch("skip")`, marked `@internal` there): where this hook may run when a cloud session is driven from the
|
|
77
|
+
* machine that holds the settings. `device`: offer it to the cloud session and run it on the device even when its script sits where the cloud session can write; `skip`: never offer it to cloud
|
|
78
|
+
* sessions. The key absent is a third reading (CC's default: a command hook whose script can be pinned and lies outside everything the cloud session can write is offered, an http hook is offered).
|
|
79
|
+
* REFERENCE FOR READERS, not a check: CC's `.catch("skip")` takes ANY value that is not one of these words (a non-string, `null`, an object included) as `skip` and still loads the file, so `cloud` has no bad
|
|
80
|
+
* value — {@link classifyHooksConfig} carries whatever is written, as written (it neither judges it, nor folds it to `skip`, nor strips it), and folding to `skip` is the reader's. Carried by `command` and
|
|
81
|
+
* `http` entries. CARRIED, not executed here.
|
|
82
|
+
*/
|
|
83
|
+
export declare const HOOK_CLOUD_WORDS: readonly ["device", "skip"];
|
|
84
|
+
/** One word of {@link HOOK_CLOUD_WORDS}. */
|
|
85
|
+
export type HookCloud = (typeof HOOK_CLOUD_WORDS)[number];
|
|
72
86
|
/** `shell` values: 'bash' = the user's $SHELL family; 'powershell' = pwsh. Default bash. */
|
|
73
87
|
declare const HOOK_SHELLS: readonly ["bash", "powershell"];
|
|
74
88
|
/**
|
|
75
|
-
* THE field table of a hook entry, per type —
|
|
76
|
-
* types below
|
|
89
|
+
* THE field table of a hook entry, per type — exported, deeply frozen (a consumer that projects "which fields does an entry carry" reads this one object and
|
|
90
|
+
* cannot change what the others read), and what the entry types below are derived from. Field order = the order a loaded entry's keys come out in.
|
|
91
|
+
* The classifier does not read THIS object: it is copied as source by consumers' generators, and a closure that read an exported declaration — or a private one
|
|
92
|
+
* that an export expression reaches — would not be copyable. It reads {@link HOOK_ENTRY_FIELDS_READ}, annotated with this table's type.
|
|
77
93
|
* · command: `args` = exec form (CC `cli309.js:252382`: when present — `[]` included — `command` is an executable spawned directly with these arguments, no shell; the mere
|
|
78
94
|
* presence of `args` is the switch), `shell` (see above), `async` = run in background without blocking, `asyncRewake` = background + wake the model on exit 2,
|
|
79
|
-
* `onFailure` (see {@link HOOK_ON_FAILURE_WORDS})
|
|
80
|
-
*
|
|
95
|
+
* `onFailure` (see {@link HOOK_ON_FAILURE_WORDS}), and — CC marks them `@internal` — `rewakeMessage` (the prefix of the system-reminder the model gets when an `asyncRewake` hook exits
|
|
96
|
+
* 2) and `rewakeSummary` (the one-line summary the user sees then): both a string of at least one character (`nonEmpty`), `cloud` (`any`: CC reads every value outside {@link HOOK_CLOUD_WORDS} as `skip`
|
|
97
|
+
* and loads the file, so there is nothing to judge — the value is carried as written and the reader folds);
|
|
98
|
+
* · prompt / agent: `prompt` ($ARGUMENTS = the hook input JSON), `model`; prompt only: `continueOnBlock` = the `continue` value of the `decision: "block"` the entry produces when its
|
|
99
|
+
* verdict is not ok (CC default false: the turn ends);
|
|
81
100
|
* · http: `url`, `headers` (values may reference $NAMEs listed in `allowedEnvVars` — env-NAME interpolation only, the config never carries a
|
|
82
|
-
* secret value; `interpolateHookEnvVars` is the one reading), `allowedEnvVars`, `onFailure` (the other schema CC gives it to);
|
|
101
|
+
* secret value; `interpolateHookEnvVars` is the one reading), `allowedEnvVars`, `onFailure` (the other schema CC gives it to), `cloud` (the other schema CC gives it to);
|
|
83
102
|
* · mcp_tool: `server` (an already-configured MCP server's name), `tool`, `input` (the tool's arguments; string values may interpolate
|
|
84
103
|
* `${path}` from the hook input JSON — CC 2.1.296 semantics, the runner's business).
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
104
|
+
* Every key of CC's five entry schemas (`cli309.js:252382`) is in its row — nothing CC judges is stripped here. A key outside a type's row is not carried and not a bad piece
|
|
105
|
+
* (`docs/CC-DIVERGENCE.md` H7): `args` on a non-command entry, `onFailure` on a prompt / agent / mcp_tool entry, `cloud` and `rewakeMessage` / `rewakeSummary` and `continueOnBlock` on a type CC's
|
|
106
|
+
* schema does not give them to, and any key CC does not know. CARRIED, not executed: `rewakeMessage` / `rewakeSummary` / `cloud` / `continueOnBlock` are read by the consumer that runs the hook
|
|
107
|
+
* (a consumer that does not run them carries them as written).
|
|
108
|
+
* The row order also decides which field an already-bad entry names (the first wrong one), so a column added later goes at the TAIL of its row (after the shared fields): adding one never
|
|
109
|
+
* moves an answer the table already gave.
|
|
88
110
|
*/
|
|
89
|
-
declare const HOOK_ENTRY_FIELDS: {
|
|
90
|
-
|
|
111
|
+
export declare const HOOK_ENTRY_FIELDS: Readonly<{
|
|
112
|
+
command: Readonly<{
|
|
113
|
+
readonly rewakeMessage: "nonEmpty?";
|
|
114
|
+
readonly rewakeSummary: "nonEmpty?";
|
|
115
|
+
readonly cloud: "any?";
|
|
91
116
|
readonly if: "string?";
|
|
92
117
|
readonly timeout: "seconds?";
|
|
93
118
|
readonly statusMessage: "string?";
|
|
@@ -98,24 +123,26 @@ declare const HOOK_ENTRY_FIELDS: {
|
|
|
98
123
|
readonly async: "boolean?";
|
|
99
124
|
readonly asyncRewake: "boolean?";
|
|
100
125
|
readonly onFailure: "onFailure?";
|
|
101
|
-
}
|
|
102
|
-
|
|
126
|
+
}>;
|
|
127
|
+
prompt: Readonly<{
|
|
128
|
+
readonly continueOnBlock: "boolean?";
|
|
103
129
|
readonly if: "string?";
|
|
104
130
|
readonly timeout: "seconds?";
|
|
105
131
|
readonly statusMessage: "string?";
|
|
106
132
|
readonly once: "boolean?";
|
|
107
133
|
readonly prompt: "text";
|
|
108
134
|
readonly model: "string?";
|
|
109
|
-
}
|
|
110
|
-
|
|
135
|
+
}>;
|
|
136
|
+
agent: Readonly<{
|
|
111
137
|
readonly if: "string?";
|
|
112
138
|
readonly timeout: "seconds?";
|
|
113
139
|
readonly statusMessage: "string?";
|
|
114
140
|
readonly once: "boolean?";
|
|
115
141
|
readonly prompt: "text";
|
|
116
142
|
readonly model: "string?";
|
|
117
|
-
}
|
|
118
|
-
|
|
143
|
+
}>;
|
|
144
|
+
http: Readonly<{
|
|
145
|
+
readonly cloud: "any?";
|
|
119
146
|
readonly if: "string?";
|
|
120
147
|
readonly timeout: "seconds?";
|
|
121
148
|
readonly statusMessage: "string?";
|
|
@@ -124,8 +151,8 @@ declare const HOOK_ENTRY_FIELDS: {
|
|
|
124
151
|
readonly headers: "stringRecord?";
|
|
125
152
|
readonly allowedEnvVars: "stringList?";
|
|
126
153
|
readonly onFailure: "onFailure?";
|
|
127
|
-
}
|
|
128
|
-
|
|
154
|
+
}>;
|
|
155
|
+
mcp_tool: Readonly<{
|
|
129
156
|
readonly if: "string?";
|
|
130
157
|
readonly timeout: "seconds?";
|
|
131
158
|
readonly statusMessage: "string?";
|
|
@@ -133,9 +160,11 @@ declare const HOOK_ENTRY_FIELDS: {
|
|
|
133
160
|
readonly server: "string";
|
|
134
161
|
readonly tool: "string";
|
|
135
162
|
readonly input: "record?";
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
163
|
+
}>;
|
|
164
|
+
}>;
|
|
165
|
+
/** The type of {@link HOOK_ENTRY_FIELDS}: per entry type, field name → field kind (literal types). */
|
|
166
|
+
export type HookEntryFields = typeof HOOK_ENTRY_FIELDS;
|
|
167
|
+
type HookFieldBaseValue<B> = B extends "text" | "nonEmpty" | "string" ? string : B extends "shell" ? (typeof HOOK_SHELLS)[number] : B extends "onFailure" ? HookOnFailure : B extends "any" ? unknown : B extends "boolean" ? boolean : B extends "seconds" ? number : B extends "stringRecord" ? Record<string, string> : B extends "stringList" | "argv" ? string[] : B extends "record" ? Record<string, unknown> : never;
|
|
139
168
|
type HookFieldValue<K> = K extends `${infer B}?` ? HookFieldBaseValue<B> : HookFieldBaseValue<K>;
|
|
140
169
|
type Flat<O> = {
|
|
141
170
|
[K in keyof O]: O[K];
|
package/dist/hooks-config.js
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* ONE READER. "Can this document's hooks be loaded, and which pieces must go?" has one answer: {@link classifyHooksConfig}. The zod faces
|
|
7
7
|
* below ({@link HooksConfig}, {@link HookMatcherEntry}, {@link HookEntry} and the per-type five) are its PROJECTIONS — accepted ⇔ the
|
|
8
8
|
* classifier says `"loaded"`, the parsed value is what it loaded, each issue is one of its pieces (code + coordinate). There is no second
|
|
9
|
-
* statement of what a valid hook entry is: the per-type field table {@link HOOK_ENTRY_FIELDS} is
|
|
10
|
-
* the
|
|
9
|
+
* statement of what a valid hook entry is: the per-type field table {@link HOOK_ENTRY_FIELDS} (exported) is what the entry TYPES are derived from at
|
|
10
|
+
* compile time, and the classifier reads its closure-private projection of it ({@link HOOK_ENTRY_FIELDS_READ}, tied to the table's type — see there).
|
|
11
11
|
*
|
|
12
12
|
* GRANULARITY = CC 2.1.296 (`cli296.js:237470`, `Yy` → `on`): four levels of piece — the `hooks` key, an event, a matcher, an entry.
|
|
13
13
|
* · Outside the guard events, a bad piece is DROPPED alone (the rest of the document — its `permissions.deny`, its `env` — still applies).
|
|
@@ -31,8 +31,11 @@
|
|
|
31
31
|
* with a sign>] }` reports the matcher's wrong `matcher` field. A sign of the piece decides before a wrong contract field of the same piece does
|
|
32
32
|
* (it is why the piece is rejected rather than dropped).
|
|
33
33
|
*
|
|
34
|
-
* CC 2.1.296 DIVERGENCES (each in the stricter direction — a document CC would load may be rejected here, never the reverse): listed once,
|
|
35
|
-
* in `docs/CC-DIVERGENCE.md` (section "hooks classifier", H1–H7) — the whole-subtree guard-sign scan is the first of them.
|
|
34
|
+
* CC 2.1.296 DIVERGENCES (the ones LISTED there are each in the stricter direction — a document CC would load may be rejected here, never the reverse): listed once,
|
|
35
|
+
* in `docs/CC-DIVERGENCE.md` (section "hooks classifier", H1–H7) — the whole-subtree guard-sign scan is the first of them. The entry field table
|
|
36
|
+
* ({@link HOOK_ENTRY_FIELDS}) carries EVERY key CC's five hook-entry schemas carry (`cli309.js:252382`), so no key CC judges is stripped here unjudged. That is a statement about
|
|
37
|
+
* which KEYS are read; the VALUE forms are the field kinds' (H7 lists where they judge more than CC does), with one known place where a kind judges LESS than CC: an `http` entry's `url`
|
|
38
|
+
* is read as a non-empty string where CC checks URL syntax (not closed yet — see CHANGELOG 20.0.0, "已知限制").
|
|
36
39
|
*
|
|
37
40
|
* COORDINATES are raw {@link ConfigPath} segments (the keys as written). An unknown event name or a key outside `hooks` is user text and may be
|
|
38
41
|
* anything, a pasted credential included: pass a coordinate through `outgoingPath` before it leaves the process (log, UI, wire). The classifier
|
|
@@ -113,6 +116,15 @@ export const HOOK_ENTRY_TYPES = ["command", "prompt", "agent", "http", "mcp_tool
|
|
|
113
116
|
* The classifier reads this set through a closure-private projection that the compiler ties to it in both directions.
|
|
114
117
|
*/
|
|
115
118
|
export const HOOK_ON_FAILURE_WORDS = ["continue", "block"];
|
|
119
|
+
/**
|
|
120
|
+
* The words CC gives `cloud` (CC `cli309.js:252382`, `cloud:B(["device","skip"]).optional().catch("skip")`, marked `@internal` there): where this hook may run when a cloud session is driven from the
|
|
121
|
+
* machine that holds the settings. `device`: offer it to the cloud session and run it on the device even when its script sits where the cloud session can write; `skip`: never offer it to cloud
|
|
122
|
+
* sessions. The key absent is a third reading (CC's default: a command hook whose script can be pinned and lies outside everything the cloud session can write is offered, an http hook is offered).
|
|
123
|
+
* REFERENCE FOR READERS, not a check: CC's `.catch("skip")` takes ANY value that is not one of these words (a non-string, `null`, an object included) as `skip` and still loads the file, so `cloud` has no bad
|
|
124
|
+
* value — {@link classifyHooksConfig} carries whatever is written, as written (it neither judges it, nor folds it to `skip`, nor strips it), and folding to `skip` is the reader's. Carried by `command` and
|
|
125
|
+
* `http` entries. CARRIED, not executed here.
|
|
126
|
+
*/
|
|
127
|
+
export const HOOK_CLOUD_WORDS = ["device", "skip"];
|
|
116
128
|
/** `shell` values: 'bash' = the user's $SHELL family; 'powershell' = pwsh. Default bash. */
|
|
117
129
|
const HOOK_SHELLS = ["bash", "powershell"];
|
|
118
130
|
/** The classifier's reading of {@link HOOK_ON_FAILURE_WORDS}. The classifier is copied as source by consumers' generators, so its closure cannot read an exported name (its one free name
|
|
@@ -121,29 +133,74 @@ const HOOK_SHELLS = ["bash", "powershell"];
|
|
|
121
133
|
const HOOK_ON_FAILURE_ACCEPTED = { continue: true, block: true };
|
|
122
134
|
/** Fields every entry type takes: `if` = permission-rule syntax (e.g. "Bash(git *)") evaluated against tool_name/tool_input before the hook
|
|
123
135
|
* runs (tool events only; shell superset field, CC-compatible); `timeout` = seconds for this entry (default `DEFAULT_HOOK_TIMEOUT_SECONDS`);
|
|
124
|
-
* `statusMessage` = spinner status message; `once` = run once, then remove.
|
|
136
|
+
* `statusMessage` = spinner status message; `once` = run once, then remove. Read by the exported table below only — the classifier's own
|
|
137
|
+
* projection spells these four out per row (it is a closure, see {@link HOOK_ENTRY_FIELDS_READ}). */
|
|
125
138
|
const HOOK_ENTRY_COMMON_FIELDS = { if: "string?", timeout: "seconds?", statusMessage: "string?", once: "boolean?" };
|
|
126
139
|
/**
|
|
127
|
-
* THE field table of a hook entry, per type —
|
|
128
|
-
* types below
|
|
140
|
+
* THE field table of a hook entry, per type — exported, deeply frozen (a consumer that projects "which fields does an entry carry" reads this one object and
|
|
141
|
+
* cannot change what the others read), and what the entry types below are derived from. Field order = the order a loaded entry's keys come out in.
|
|
142
|
+
* The classifier does not read THIS object: it is copied as source by consumers' generators, and a closure that read an exported declaration — or a private one
|
|
143
|
+
* that an export expression reaches — would not be copyable. It reads {@link HOOK_ENTRY_FIELDS_READ}, annotated with this table's type.
|
|
129
144
|
* · command: `args` = exec form (CC `cli309.js:252382`: when present — `[]` included — `command` is an executable spawned directly with these arguments, no shell; the mere
|
|
130
145
|
* presence of `args` is the switch), `shell` (see above), `async` = run in background without blocking, `asyncRewake` = background + wake the model on exit 2,
|
|
131
|
-
* `onFailure` (see {@link HOOK_ON_FAILURE_WORDS})
|
|
132
|
-
*
|
|
146
|
+
* `onFailure` (see {@link HOOK_ON_FAILURE_WORDS}), and — CC marks them `@internal` — `rewakeMessage` (the prefix of the system-reminder the model gets when an `asyncRewake` hook exits
|
|
147
|
+
* 2) and `rewakeSummary` (the one-line summary the user sees then): both a string of at least one character (`nonEmpty`), `cloud` (`any`: CC reads every value outside {@link HOOK_CLOUD_WORDS} as `skip`
|
|
148
|
+
* and loads the file, so there is nothing to judge — the value is carried as written and the reader folds);
|
|
149
|
+
* · prompt / agent: `prompt` ($ARGUMENTS = the hook input JSON), `model`; prompt only: `continueOnBlock` = the `continue` value of the `decision: "block"` the entry produces when its
|
|
150
|
+
* verdict is not ok (CC default false: the turn ends);
|
|
133
151
|
* · http: `url`, `headers` (values may reference $NAMEs listed in `allowedEnvVars` — env-NAME interpolation only, the config never carries a
|
|
134
|
-
* secret value; `interpolateHookEnvVars` is the one reading), `allowedEnvVars`, `onFailure` (the other schema CC gives it to);
|
|
152
|
+
* secret value; `interpolateHookEnvVars` is the one reading), `allowedEnvVars`, `onFailure` (the other schema CC gives it to), `cloud` (the other schema CC gives it to);
|
|
135
153
|
* · mcp_tool: `server` (an already-configured MCP server's name), `tool`, `input` (the tool's arguments; string values may interpolate
|
|
136
154
|
* `${path}` from the hook input JSON — CC 2.1.296 semantics, the runner's business).
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
155
|
+
* Every key of CC's five entry schemas (`cli309.js:252382`) is in its row — nothing CC judges is stripped here. A key outside a type's row is not carried and not a bad piece
|
|
156
|
+
* (`docs/CC-DIVERGENCE.md` H7): `args` on a non-command entry, `onFailure` on a prompt / agent / mcp_tool entry, `cloud` and `rewakeMessage` / `rewakeSummary` and `continueOnBlock` on a type CC's
|
|
157
|
+
* schema does not give them to, and any key CC does not know. CARRIED, not executed: `rewakeMessage` / `rewakeSummary` / `cloud` / `continueOnBlock` are read by the consumer that runs the hook
|
|
158
|
+
* (a consumer that does not run them carries them as written).
|
|
159
|
+
* The row order also decides which field an already-bad entry names (the first wrong one), so a column added later goes at the TAIL of its row (after the shared fields): adding one never
|
|
160
|
+
* moves an answer the table already gave.
|
|
140
161
|
*/
|
|
141
|
-
const HOOK_ENTRY_FIELDS = {
|
|
142
|
-
command: {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
162
|
+
export const HOOK_ENTRY_FIELDS = Object.freeze({
|
|
163
|
+
command: Object.freeze({
|
|
164
|
+
command: "text",
|
|
165
|
+
args: "argv?",
|
|
166
|
+
shell: "shell?",
|
|
167
|
+
async: "boolean?",
|
|
168
|
+
asyncRewake: "boolean?",
|
|
169
|
+
onFailure: "onFailure?",
|
|
170
|
+
...HOOK_ENTRY_COMMON_FIELDS,
|
|
171
|
+
rewakeMessage: "nonEmpty?",
|
|
172
|
+
rewakeSummary: "nonEmpty?",
|
|
173
|
+
cloud: "any?",
|
|
174
|
+
}),
|
|
175
|
+
prompt: Object.freeze({ prompt: "text", model: "string?", ...HOOK_ENTRY_COMMON_FIELDS, continueOnBlock: "boolean?" }),
|
|
176
|
+
agent: Object.freeze({ prompt: "text", model: "string?", ...HOOK_ENTRY_COMMON_FIELDS }),
|
|
177
|
+
http: Object.freeze({ url: "text", headers: "stringRecord?", allowedEnvVars: "stringList?", onFailure: "onFailure?", ...HOOK_ENTRY_COMMON_FIELDS, cloud: "any?" }),
|
|
178
|
+
mcp_tool: Object.freeze({ server: "string", tool: "string", input: "record?", ...HOOK_ENTRY_COMMON_FIELDS }),
|
|
179
|
+
});
|
|
180
|
+
/** The classifier's reading of {@link HOOK_ENTRY_FIELDS}. Same reason and same form as {@link HOOK_ON_FAILURE_ACCEPTED}: the classifier closure cannot read the exported table, so this
|
|
181
|
+
* is its closure-private projection, spelled out in full (no shared piece with the exported table) and annotated with the exported table's type — a row, a field or a field kind that
|
|
182
|
+
* the two do not agree on is a compile error in one direction (a missing one) or the other (an extra one). the hook-entry-fields pin under `test/` holds the run-time half: what the
|
|
183
|
+
* classifier accepts, requires and orders per type is what the exported table says. */
|
|
184
|
+
const HOOK_ENTRY_FIELDS_READ = {
|
|
185
|
+
command: {
|
|
186
|
+
command: "text",
|
|
187
|
+
args: "argv?",
|
|
188
|
+
shell: "shell?",
|
|
189
|
+
async: "boolean?",
|
|
190
|
+
asyncRewake: "boolean?",
|
|
191
|
+
onFailure: "onFailure?",
|
|
192
|
+
if: "string?",
|
|
193
|
+
timeout: "seconds?",
|
|
194
|
+
statusMessage: "string?",
|
|
195
|
+
once: "boolean?",
|
|
196
|
+
rewakeMessage: "nonEmpty?",
|
|
197
|
+
rewakeSummary: "nonEmpty?",
|
|
198
|
+
cloud: "any?",
|
|
199
|
+
},
|
|
200
|
+
prompt: { prompt: "text", model: "string?", if: "string?", timeout: "seconds?", statusMessage: "string?", once: "boolean?", continueOnBlock: "boolean?" },
|
|
201
|
+
agent: { prompt: "text", model: "string?", if: "string?", timeout: "seconds?", statusMessage: "string?", once: "boolean?" },
|
|
202
|
+
http: { url: "text", headers: "stringRecord?", allowedEnvVars: "stringList?", onFailure: "onFailure?", if: "string?", timeout: "seconds?", statusMessage: "string?", once: "boolean?", cloud: "any?" },
|
|
203
|
+
mcp_tool: { server: "string", tool: "string", input: "record?", if: "string?", timeout: "seconds?", statusMessage: "string?", once: "boolean?" },
|
|
147
204
|
};
|
|
148
205
|
// ── classification vocabulary ──────────────────────────────────────────────────────────────────────────────
|
|
149
206
|
/** What happened to a document's hooks: all loaded / loaded with pieces dropped / the document rejected (nothing in it applies). */
|
|
@@ -338,6 +395,8 @@ function hookFieldFits(base, value) {
|
|
|
338
395
|
switch (base) {
|
|
339
396
|
case "text":
|
|
340
397
|
return typeof value === "string" && value.length > 0 && !value.includes("\0");
|
|
398
|
+
case "nonEmpty":
|
|
399
|
+
return typeof value === "string" && value.length > 0;
|
|
341
400
|
case "string":
|
|
342
401
|
return typeof value === "string";
|
|
343
402
|
case "shell":
|
|
@@ -366,6 +425,8 @@ function hookFieldFits(base, value) {
|
|
|
366
425
|
return true;
|
|
367
426
|
case "onFailure":
|
|
368
427
|
return typeof value === "string" && Object.hasOwn(HOOK_ON_FAILURE_ACCEPTED, value);
|
|
428
|
+
case "any":
|
|
429
|
+
return true;
|
|
369
430
|
case "record":
|
|
370
431
|
return hookIsRecord(value);
|
|
371
432
|
default: {
|
|
@@ -379,9 +440,9 @@ function hookEntryRead(entry) {
|
|
|
379
440
|
if (!hookIsRecord(entry))
|
|
380
441
|
return {};
|
|
381
442
|
const type = Object.hasOwn(entry, "type") ? entry.type : undefined;
|
|
382
|
-
if (typeof type !== "string" || !Object.hasOwn(
|
|
443
|
+
if (typeof type !== "string" || !Object.hasOwn(HOOK_ENTRY_FIELDS_READ, type))
|
|
383
444
|
return { field: "type" };
|
|
384
|
-
const fields =
|
|
445
|
+
const fields = HOOK_ENTRY_FIELDS_READ[type];
|
|
385
446
|
const out = { type };
|
|
386
447
|
for (const field of Object.keys(fields)) {
|
|
387
448
|
const kind = fields[field];
|
package/dist/retired-envs.js
CHANGED
|
@@ -77,6 +77,8 @@ export const RETIRED_ENVS = [
|
|
|
77
77
|
["UNATTENDED_PERMISSION_MODE", "since server 7.109.0 the unattended legs (leader workers and their repair legs, run-local, and their durable resumes) always run permissionMode \"default\" with an approver that answers by ask class: a machine answers only \"ordinary\" asks, and every other class goes to the leg's approver seat (run-local's terminal prompt) or parks / is refused — there is no mode to choose", "removed"],
|
|
78
78
|
// 执行车道总开关:每个部署都点名自己的车道之后它恒真(「点名了没有」只剩一个答者 REMOTE_EXEC),留着 = 两个键答一个问题;「没有执行环境」也是一个声明(REMOTE_EXEC=none)。
|
|
79
79
|
["REQUIRE_EXECUTION_LANE", "REMOTE_EXEC", "replaced", "every deployment names its execution lane; REMOTE_EXEC=none declares one with no execution environment"],
|
|
80
|
+
// 沙箱车道的 LSP 桥整只删除:e2b / k8s 车道本来就不挂 LSP,这个旋钮没有可 rename 的目标。host 车道的开关是另一个键 LSP_HOST_ENABLED(缺省开,活旋钮,不在本表)。
|
|
81
|
+
["LSP_ENABLED", "the sandbox-lane LSP bridge was removed (e2b / k8s lanes mount no LSP); unset it — the host lane's switch is LSP_HOST_ENABLED", "removed"],
|
|
80
82
|
];
|
|
81
83
|
// 冻结:拿到导出的人改不了拒启判据(读拒句的与投影 wire 的是同一个数组对象)。
|
|
82
84
|
for (const row of RETIRED_ENVS)
|
package/dist/types.d.ts
CHANGED
|
@@ -162,6 +162,27 @@ export declare const ModelTier: z.ZodEnum<{
|
|
|
162
162
|
premium: "premium";
|
|
163
163
|
}>;
|
|
164
164
|
export type ModelTier = z.infer<typeof ModelTier>;
|
|
165
|
+
/** The reasoning-level words a catalog entry's {@link ModelEntry}`.thinkingLevelMap` is keyed by: `off` plus the six effort tiers. A mirror of the
|
|
166
|
+
* engine's `ModelThinkingLevel`, which exists only as a type — so the mirror is held at compile time by the upstream-drift gate (both directions: the
|
|
167
|
+
* engine adds or drops a word ⇒ `tsc` is red), not copied a second time anywhere else. The schema of the map ({@link ModelThinkingLevelMap}) mints its
|
|
168
|
+
* keys from this table. */
|
|
169
|
+
export declare const MODEL_THINKING_LEVEL_WORDS: readonly ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
170
|
+
/** One word of {@link MODEL_THINKING_LEVEL_WORDS}. */
|
|
171
|
+
export type ModelThinkingLevel = (typeof MODEL_THINKING_LEVEL_WORDS)[number];
|
|
172
|
+
/** A catalog entry's per-level wire values — the engine's `Model.thinkingLevelMap`. Every key is optional, the key set is CLOSED
|
|
173
|
+
* ({@link MODEL_THINKING_LEVEL_WORDS}), and an unknown key refuses the whole map (`.strict()`): a misspelt level name is not stripped, because
|
|
174
|
+
* stripping "this level cannot be turned off" reads as "this level behaves as usual". The refusal lands on the entry that carries the map (the schema
|
|
175
|
+
* face: a bad form is a bad entry), not on this object alone. */
|
|
176
|
+
export declare const ModelThinkingLevelMap: z.ZodObject<{
|
|
177
|
+
off: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
178
|
+
minimal: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
179
|
+
low: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
180
|
+
medium: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
181
|
+
high: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
182
|
+
xhigh: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
183
|
+
max: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
184
|
+
}, z.core.$strict>;
|
|
185
|
+
export type ModelThinkingLevelMap = z.infer<typeof ModelThinkingLevelMap>;
|
|
165
186
|
export declare const ModelEntry: z.ZodObject<{
|
|
166
187
|
name: z.ZodString;
|
|
167
188
|
id: z.ZodString;
|
|
@@ -185,6 +206,15 @@ export declare const ModelEntry: z.ZodObject<{
|
|
|
185
206
|
}>>;
|
|
186
207
|
reasoning: z.ZodOptional<z.ZodBoolean>;
|
|
187
208
|
vision: z.ZodOptional<z.ZodBoolean>;
|
|
209
|
+
thinkingLevelMap: z.ZodOptional<z.ZodObject<{
|
|
210
|
+
off: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
211
|
+
minimal: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
212
|
+
low: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
213
|
+
medium: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
214
|
+
high: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
215
|
+
xhigh: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
216
|
+
max: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
217
|
+
}, z.core.$strict>>;
|
|
188
218
|
contextWindow: z.ZodOptional<z.ZodNumber>;
|
|
189
219
|
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
190
220
|
autoCompactTokens: z.ZodOptional<z.ZodNumber>;
|
|
@@ -298,6 +328,15 @@ export declare const ModelsConfig: z.ZodObject<{
|
|
|
298
328
|
}>>;
|
|
299
329
|
reasoning: z.ZodOptional<z.ZodBoolean>;
|
|
300
330
|
vision: z.ZodOptional<z.ZodBoolean>;
|
|
331
|
+
thinkingLevelMap: z.ZodOptional<z.ZodObject<{
|
|
332
|
+
off: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
333
|
+
minimal: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
334
|
+
low: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
335
|
+
medium: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
336
|
+
high: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
337
|
+
xhigh: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
338
|
+
max: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
339
|
+
}, z.core.$strict>>;
|
|
301
340
|
contextWindow: z.ZodOptional<z.ZodNumber>;
|
|
302
341
|
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
303
342
|
autoCompactTokens: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1446,8 +1485,8 @@ export declare const WorkerSpec: z.ZodObject<{
|
|
|
1446
1485
|
}>>;
|
|
1447
1486
|
memory: z.ZodPrefault<z.ZodObject<{
|
|
1448
1487
|
engine: z.ZodDefault<z.ZodEnum<{
|
|
1449
|
-
on: "on";
|
|
1450
1488
|
off: "off";
|
|
1489
|
+
on: "on";
|
|
1451
1490
|
}>>;
|
|
1452
1491
|
backend: z.ZodDefault<z.ZodEnum<{
|
|
1453
1492
|
file: "file";
|
|
@@ -1607,8 +1646,8 @@ export declare const WorkersConfig: z.ZodObject<{
|
|
|
1607
1646
|
}>>;
|
|
1608
1647
|
memory: z.ZodPrefault<z.ZodObject<{
|
|
1609
1648
|
engine: z.ZodDefault<z.ZodEnum<{
|
|
1610
|
-
on: "on";
|
|
1611
1649
|
off: "off";
|
|
1650
|
+
on: "on";
|
|
1612
1651
|
}>>;
|
|
1613
1652
|
backend: z.ZodDefault<z.ZodEnum<{
|
|
1614
1653
|
file: "file";
|
|
@@ -1943,7 +1982,8 @@ export declare const A2aPeerSpec: z.ZodObject<{
|
|
|
1943
1982
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
1944
1983
|
}, z.core.$strip>;
|
|
1945
1984
|
export type A2aPeerSpec = z.infer<typeof A2aPeerSpec>;
|
|
1946
|
-
/** `a2a` 域:常驻出站 A2A
|
|
1985
|
+
/** `a2a` 域:常驻出站 A2A 对端名册。空名册 = 不拨任何对端;文档缺席(店 / `config.d`)读作空名册。对端名唯一(重名拒,同 mcp)。
|
|
1986
|
+
* 线上(`GET /effective`)缺席不是空名册:读口不补,{@link EffectiveWire} 上 `a2a` 缺席 = 生产方没发这个域(它的契约早于本域),见 {@link WIRE_CARRIED_DOMAINS}。 */
|
|
1947
1987
|
export declare const A2aConfig: z.ZodObject<{
|
|
1948
1988
|
peers: z.ZodPrefault<z.ZodArray<z.ZodObject<{
|
|
1949
1989
|
name: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
@@ -2401,6 +2441,15 @@ export declare const DOMAIN_SCHEMAS: {
|
|
|
2401
2441
|
}>>;
|
|
2402
2442
|
reasoning: z.ZodOptional<z.ZodBoolean>;
|
|
2403
2443
|
vision: z.ZodOptional<z.ZodBoolean>;
|
|
2444
|
+
thinkingLevelMap: z.ZodOptional<z.ZodObject<{
|
|
2445
|
+
off: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2446
|
+
minimal: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2447
|
+
low: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2448
|
+
medium: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2449
|
+
high: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2450
|
+
xhigh: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2451
|
+
max: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2452
|
+
}, z.core.$strict>>;
|
|
2404
2453
|
contextWindow: z.ZodOptional<z.ZodNumber>;
|
|
2405
2454
|
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
2406
2455
|
autoCompactTokens: z.ZodOptional<z.ZodNumber>;
|
|
@@ -2718,8 +2767,8 @@ export declare const DOMAIN_SCHEMAS: {
|
|
|
2718
2767
|
}>>;
|
|
2719
2768
|
memory: z.ZodPrefault<z.ZodObject<{
|
|
2720
2769
|
engine: z.ZodDefault<z.ZodEnum<{
|
|
2721
|
-
on: "on";
|
|
2722
2770
|
off: "off";
|
|
2771
|
+
on: "on";
|
|
2723
2772
|
}>>;
|
|
2724
2773
|
backend: z.ZodDefault<z.ZodEnum<{
|
|
2725
2774
|
file: "file";
|
|
@@ -3157,7 +3206,8 @@ export interface EffectiveConfig {
|
|
|
3157
3206
|
/** cost/限流族的热更新发布位(0.19.0,消费方 #322 批1)。域缺席 ⇒ `{}`(每一键都 ABSENT =
|
|
3158
3207
|
* web-admin 不管 ⇒ 消费方回 env 底);11.0.0 起五个限额键的唯一位。 */
|
|
3159
3208
|
limits: LimitsConfig;
|
|
3160
|
-
/** 常驻出站 A2A 对端名册(18.0.0)
|
|
3209
|
+
/** 常驻出站 A2A 对端名册(18.0.0)。读店 / `config.d` 时文档缺席 ⇒ `{ peers: [] }`(读者即本包,恒懂此域:没写 = 不拨任何对端);header 值只以 env-NAME 引用出现,
|
|
3210
|
+
* 读方从自己的环境取值。线上读形不在此列:{@link EffectiveWire} 上的 `a2a` 是可选的(缺席 = 生产方没发,20.0.0 起不补空名册)。 */
|
|
3161
3211
|
a2a: A2aConfig;
|
|
3162
3212
|
}
|
|
3163
3213
|
/** One provenance source in a key's resolution trail. Two orthogonal axes: the TOC file LAYER, or the TOB
|
|
@@ -3261,12 +3311,30 @@ export type EffectiveKey = z.infer<typeof EffectiveKey>;
|
|
|
3261
3311
|
* gate is closed), never the storage shape.
|
|
3262
3312
|
* `sandboxGit` (14.7.0) is the third wire-only key and the third carried verbatim: the sandbox git plane's origin block — web-admin projects it from the
|
|
3263
3313
|
* deployment's registry, it is NOT a stored domain, so `buildEffective` never produces it and `readEffectiveWire` neither validates nor drops it. Optional with
|
|
3264
|
-
* no default (absent = the deployment projects no such block); the ONE seat that judges it is `SandboxGitConfig` (`./sandbox-git`), run by the consumer before use.
|
|
3265
|
-
|
|
3314
|
+
* no default (absent = the deployment projects no such block); the ONE seat that judges it is `SandboxGitConfig` (`./sandbox-git`), run by the consumer before use.
|
|
3315
|
+
* `a2a` (20.0.0) is optional here too: the wire reader never fabricates a domain the producer did not send — {@link WIRE_CARRIED_DOMAINS} is the one table of
|
|
3316
|
+
* domains carried by presence (absent on the wire ⇒ absent here; a producer whose contract predates the domain does not send it), every other domain is
|
|
3317
|
+
* sent by every supported producer and reads as the contract default when absent. */
|
|
3318
|
+
export type EffectiveWire = Omit<EffectiveConfig, "skills" | WireCarriedDomain> & {
|
|
3266
3319
|
skills: SkillsManifest;
|
|
3267
3320
|
prompts?: unknown;
|
|
3268
3321
|
sandboxGit?: unknown;
|
|
3322
|
+
} & {
|
|
3323
|
+
[K in Exclude<WireCarriedDomain, "prompts">]?: EffectiveConfig[K];
|
|
3269
3324
|
};
|
|
3325
|
+
/**
|
|
3326
|
+
* **线上读口不编造生产方没发的域**(20.0.0)—— 按在场性承运的域的唯一一张表。表里的域在 `GET /effective` 载荷上缺席 ⇒ `readEffectiveWire` 的读出形里
|
|
3327
|
+
* 同样缺席({@link EffectiveWire} 上可选:缺席 = 生产方没发这个域,它的契约早于本域,或它刻意不发);在场 ⇒ 照该域既有读法。在场判据只有一个:
|
|
3328
|
+
* 载荷的**自有键,且值不是 `undefined`**(与 `parseDomain`「只有 undefined 是缺席」同律 —— JSON 载荷里没有 undefined,嵌入方传的 `undefined` 与没写同读)。
|
|
3329
|
+
* · `prompts`:线上形是发布形 {@link EffectivePromptsWire},读口原样承运、由消费方判(发布闸关 / 没有发布 = 不发,缺席是常态形);
|
|
3330
|
+
* · `a2a`:在场 ⇒ 照域读法(解析、逐条抢救、整域读不进 ⇒ `{ peers: [] }` + `domain-defaulted`)。缺席 ≠ 空名册 —— 18.0.0 之前的生产方不懂此域,不发它;
|
|
3331
|
+
* 18.0.0 起 `buildEffective` 恒物化 a2a,所以 ≥ 18.0.0 的中心恒发(没存文档也发 `{ peers: [] }`):线上缺席 ⇔ 生产方不懂此域。
|
|
3332
|
+
* 不在表里的域在 1.0.0 起就在域表上,支持面内的每个生产方都恒发;线上缺席读作契约缺省(与读店同一份缺省)。**之后加进域表的域进这张表**:
|
|
3333
|
+
* 比它旧的生产方必不发它,物化它就是替生产方编造一份「说了空」。读店 / 读 `config.d`(`EffectiveConfig`)不在本律内:那两腿的读者就是本包,恒懂每个域。
|
|
3334
|
+
*/
|
|
3335
|
+
export declare const WIRE_CARRIED_DOMAINS: readonly ["prompts", "a2a"];
|
|
3336
|
+
/** {@link WIRE_CARRIED_DOMAINS} 的成员。 */
|
|
3337
|
+
export type WireCarriedDomain = (typeof WIRE_CARRIED_DOMAINS)[number];
|
|
3270
3338
|
/** Reserved audit "domain" for RBAC/user-management events (not a config domain → no snapshot, not
|
|
3271
3339
|
* rollback-able). Lets user changes share the one audit stream the Audit page already renders. */
|
|
3272
3340
|
export declare const RBAC_AUDIT = "rbac";
|
package/dist/types.js
CHANGED
|
@@ -479,6 +479,21 @@ export const PARSE_TRANSPARENT_KEYS = [
|
|
|
479
479
|
* places that name it (`ModelEntry.tier`, `RoleTarget.select.tier`). Not the tier-group ladder of {@link TierBindings}
|
|
480
480
|
* (`ultra` … `lite`), which binds model NAMES to rungs. */
|
|
481
481
|
export const ModelTier = z.enum(["cheap", "standard", "premium"]);
|
|
482
|
+
/** The reasoning-level words a catalog entry's {@link ModelEntry}`.thinkingLevelMap` is keyed by: `off` plus the six effort tiers. A mirror of the
|
|
483
|
+
* engine's `ModelThinkingLevel`, which exists only as a type — so the mirror is held at compile time by the upstream-drift gate (both directions: the
|
|
484
|
+
* engine adds or drops a word ⇒ `tsc` is red), not copied a second time anywhere else. The schema of the map ({@link ModelThinkingLevelMap}) mints its
|
|
485
|
+
* keys from this table. */
|
|
486
|
+
export const MODEL_THINKING_LEVEL_WORDS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
487
|
+
/** What a deployment says one level is called on the wire: a non-empty string = the provider's own value for that level; `null` = this level is not
|
|
488
|
+
* supported on this model. (A level with no key at all = the provider's default. The empty string is not a value — it would put an empty effort on the wire.) */
|
|
489
|
+
const ThinkingLevelSpelling = z.string().min(1).nullable();
|
|
490
|
+
/** A catalog entry's per-level wire values — the engine's `Model.thinkingLevelMap`. Every key is optional, the key set is CLOSED
|
|
491
|
+
* ({@link MODEL_THINKING_LEVEL_WORDS}), and an unknown key refuses the whole map (`.strict()`): a misspelt level name is not stripped, because
|
|
492
|
+
* stripping "this level cannot be turned off" reads as "this level behaves as usual". The refusal lands on the entry that carries the map (the schema
|
|
493
|
+
* face: a bad form is a bad entry), not on this object alone. */
|
|
494
|
+
export const ModelThinkingLevelMap = z
|
|
495
|
+
.object(Object.fromEntries(MODEL_THINKING_LEVEL_WORDS.map((word) => [word, ThinkingLevelSpelling.optional()])))
|
|
496
|
+
.strict();
|
|
482
497
|
export const ModelEntry = z.object({
|
|
483
498
|
/** Catalog key + `@name` mention handle (stable, url/word-safe), e.g. "model-a". */
|
|
484
499
|
name: z.string().min(1).regex(/^[a-z0-9][a-z0-9._-]*$/i, "letters/digits/._- , no spaces"),
|
|
@@ -507,6 +522,16 @@ export const ModelEntry = z.object({
|
|
|
507
522
|
* absent bit in: reading "not written" as "not capable" is a default only a reader may choose. */
|
|
508
523
|
reasoning: z.boolean().optional(),
|
|
509
524
|
vision: z.boolean().optional(),
|
|
525
|
+
/** Per-level wire values for the reasoning knob — the engine's `Model.thinkingLevelMap` (keys {@link MODEL_THINKING_LEVEL_WORDS}; a string is the
|
|
526
|
+
* provider's own value for that level, `null` marks the level unsupported on this model, a missing key = the provider's default). Real need: a
|
|
527
|
+
* deployment on an `anthropic-messages` wire where some level cannot be turned off, or goes by another name — the catalog entry is the seat
|
|
528
|
+
* that declares it; without this key the declaration is stripped at parse on every read leg and never reaches the consumer.
|
|
529
|
+
* THREE-STATE like the capability bits above: ABSENT = not declared (this package never mints `{}`), `{}` = declared with no overrides.
|
|
530
|
+
* **A bad form refuses the WHOLE entry** — an unknown key, a non-object, an empty-string value, a value that is neither a string nor `null`:
|
|
531
|
+
* nothing is stripped and nothing is defaulted (the read legs drop the entry with `entry-dropped` and the rest of the catalog stands as long as the entry is not referenced; an entry that is REFERENCED — named by `roles`, by `atMention.models` in mode `only`, or by `tierGroups[].tiers` — leaves that reference dangling once dropped, and the existing dangling-reference law defaults the WHOLE `models` domain: `domain-defaulted` only, the catalog reads empty, siblings go with it, no `entry-dropped` (any bad referenced entry gets this answer; 19.0.x loaded such an entry and only stripped the key). When no entry of the catalog survives, the existing zero-survivor law gives the same outcome; the document-face read throws; the write gate refuses it). This is the schema
|
|
532
|
+
* face's rule for a closed vocabulary, unlike `compat`'s parse-transparent carry. What each value means on the wire is the reading
|
|
533
|
+
* consumer's call; this package only carries the declaration. */
|
|
534
|
+
thinkingLevelMap: ModelThinkingLevelMap.optional(),
|
|
510
535
|
contextWindow: INTEGER.positive().optional(),
|
|
511
536
|
maxTokens: INTEGER.positive().optional(),
|
|
512
537
|
/** Auto-compaction trigger threshold (tokens) for this model — web-admin 显式下发时本地 FileConfigStore
|
|
@@ -2744,7 +2769,8 @@ export const A2aPeerSpec = z.object({
|
|
|
2744
2769
|
scenarios: z.array(z.string().min(1)).prefault([]),
|
|
2745
2770
|
enabled: z.boolean().default(true),
|
|
2746
2771
|
});
|
|
2747
|
-
/** `a2a` 域:常驻出站 A2A
|
|
2772
|
+
/** `a2a` 域:常驻出站 A2A 对端名册。空名册 = 不拨任何对端;文档缺席(店 / `config.d`)读作空名册。对端名唯一(重名拒,同 mcp)。
|
|
2773
|
+
* 线上(`GET /effective`)缺席不是空名册:读口不补,{@link EffectiveWire} 上 `a2a` 缺席 = 生产方没发这个域(它的契约早于本域),见 {@link WIRE_CARRIED_DOMAINS}。 */
|
|
2748
2774
|
export const A2aConfig = z
|
|
2749
2775
|
.object({ peers: z.array(A2aPeerSpec).prefault([]) })
|
|
2750
2776
|
.superRefine((cfg, ctx) => {
|
|
@@ -3009,7 +3035,7 @@ export const DOMAIN_SCHEMAS = {
|
|
|
3009
3035
|
projects: ProjectsConfig, // 0.10.0: 142-S3 project identity ledger + 无仓铸造权威 (scope=tenant 轴; NOT portable — 租户身份数据)
|
|
3010
3036
|
prompts: PromptsConfig, // 0.10.18 起;14.0.0 单轴:中心 artifact 的身份(`{ artifact?, workers? }`);13.x 两轴的键是墓碑(SS-M10)
|
|
3011
3037
|
limits: LimitsConfig, // 0.19.0: cost/限流族热更新发布位(消费方 #322 批1;本地腿闭集缺口的源头修复)
|
|
3012
|
-
a2a: A2aConfig, // 18.0.0: 常驻出站 A2A 对端名册(便携;本地腿 config.d/a2a.json 与中心腿 /effective.a2a
|
|
3038
|
+
a2a: A2aConfig, // 18.0.0: 常驻出站 A2A 对端名册(便携;本地腿 config.d/a2a.json 与中心腿 /effective.a2a 同一个声明座;线上按在场性承运,见 WIRE_CARRIED_DOMAINS)
|
|
3013
3039
|
// integrations + access: DELETED in 0.6.0 (EXPERT-REDESIGN §9) — parseDomain/effective/路由随之 404。
|
|
3014
3040
|
};
|
|
3015
3041
|
// ── Effective-config PROVENANCE (the unified shape TOC `sema config --effective` and TOB `/effective?principal=`
|
|
@@ -3040,6 +3066,17 @@ export const EffectiveKey = z.object({
|
|
|
3040
3066
|
lockBehavior: z.enum(["locked", "advisory", "forced-off", "tighten-only"]).optional(),
|
|
3041
3067
|
sources: z.array(SettingSource).optional(),
|
|
3042
3068
|
});
|
|
3069
|
+
/**
|
|
3070
|
+
* **线上读口不编造生产方没发的域**(20.0.0)—— 按在场性承运的域的唯一一张表。表里的域在 `GET /effective` 载荷上缺席 ⇒ `readEffectiveWire` 的读出形里
|
|
3071
|
+
* 同样缺席({@link EffectiveWire} 上可选:缺席 = 生产方没发这个域,它的契约早于本域,或它刻意不发);在场 ⇒ 照该域既有读法。在场判据只有一个:
|
|
3072
|
+
* 载荷的**自有键,且值不是 `undefined`**(与 `parseDomain`「只有 undefined 是缺席」同律 —— JSON 载荷里没有 undefined,嵌入方传的 `undefined` 与没写同读)。
|
|
3073
|
+
* · `prompts`:线上形是发布形 {@link EffectivePromptsWire},读口原样承运、由消费方判(发布闸关 / 没有发布 = 不发,缺席是常态形);
|
|
3074
|
+
* · `a2a`:在场 ⇒ 照域读法(解析、逐条抢救、整域读不进 ⇒ `{ peers: [] }` + `domain-defaulted`)。缺席 ≠ 空名册 —— 18.0.0 之前的生产方不懂此域,不发它;
|
|
3075
|
+
* 18.0.0 起 `buildEffective` 恒物化 a2a,所以 ≥ 18.0.0 的中心恒发(没存文档也发 `{ peers: [] }`):线上缺席 ⇔ 生产方不懂此域。
|
|
3076
|
+
* 不在表里的域在 1.0.0 起就在域表上,支持面内的每个生产方都恒发;线上缺席读作契约缺省(与读店同一份缺省)。**之后加进域表的域进这张表**:
|
|
3077
|
+
* 比它旧的生产方必不发它,物化它就是替生产方编造一份「说了空」。读店 / 读 `config.d`(`EffectiveConfig`)不在本律内:那两腿的读者就是本包,恒懂每个域。
|
|
3078
|
+
*/
|
|
3079
|
+
export const WIRE_CARRIED_DOMAINS = ["prompts", "a2a"];
|
|
3043
3080
|
/** Reserved audit "domain" for RBAC/user-management events (not a config domain → no snapshot, not
|
|
3044
3081
|
* rollback-able). Lets user changes share the one audit stream the Audit page already renders. */
|
|
3045
3082
|
export const RBAC_AUDIT = "rbac";
|