@sema-agent/settings-schema 31.1.0 → 32.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 +753 -0
- package/README.md +79 -17
- package/conformance/VERSION +1 -1
- package/conformance/cases/c97-roles-own-proto-key-entry-dropped/expected.json +105 -0
- package/conformance/cases/c97-roles-own-proto-key-entry-dropped/input.json +26 -0
- package/conformance/cases/c97-roles-own-proto-key-entry-dropped/meta.json +6 -0
- package/dist/api/auth.d.ts +1 -1
- package/dist/api/feedback.d.ts +3 -3
- package/dist/api/feedback.js +3 -2
- package/dist/center-refs.d.ts +1 -1
- package/dist/center-refs.js +1 -1
- package/dist/config-fns.d.ts +14 -3
- package/dist/config-fns.js +49 -12
- package/dist/config-root-documents.js +1 -1
- package/dist/conformance/contract-adapter.js +18 -1
- package/dist/declared-capture.d.ts +1 -1
- package/dist/declared-capture.js +5 -1
- package/dist/device-lane-knobs.d.ts +57 -0
- package/dist/device-lane-knobs.js +127 -0
- package/dist/execution-lanes.d.ts +3 -1
- package/dist/execution-lanes.js +3 -1
- package/dist/fleet.d.ts +5 -5
- package/dist/fleet.js +4 -3
- package/dist/hooks-config.d.ts +47 -23
- package/dist/hooks-config.js +93 -134
- package/dist/hooks.d.ts +26 -22
- package/dist/hooks.js +17 -8
- package/dist/host-path.d.ts +9 -5
- package/dist/host-path.js +9 -20
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/ip-address.d.ts +19 -0
- package/dist/ip-address.js +28 -0
- package/dist/loopback.d.ts +3 -11
- package/dist/loopback.js +11 -12
- package/dist/mcp-request-entry.js +4 -6
- package/dist/migration-receipt.d.ts +1 -1
- package/dist/migration-receipt.js +1 -1
- package/dist/one-time-migrations.d.ts +1 -1
- package/dist/one-time-migrations.js +257 -62
- package/dist/plain-json-object.d.ts +5 -8
- package/dist/plain-json-object.js +5 -8
- package/dist/record-seat.d.ts +35 -0
- package/dist/record-seat.js +97 -0
- package/dist/reserved-member-name.d.ts +8 -3
- package/dist/reserved-member-name.js +10 -3
- package/dist/retired-envs.js +10 -0
- package/dist/safety-merge-spec.d.ts +11 -3
- package/dist/safety-merge-spec.js +3 -2
- package/dist/types.d.ts +404 -112
- package/dist/types.js +132 -73
- package/docs/API-SURFACE.md +23 -6
- package/docs/CC-DIVERGENCE.md +11 -2
- package/docs/CONFORMANCE.md +2 -2
- package/docs/CONSUMER-INTEGRATION.md +157 -6
- package/llms-full.txt +31 -18
- package/llms.txt +11 -7
- package/package.json +7 -6
package/dist/hooks-config.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
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
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
|
|
10
|
+
* compile time and what the classifier reads at run time (a registered name of its closure — see SELF-CONTAINED below).
|
|
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).
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
* (it is why the piece is rejected rather than dropped).
|
|
33
33
|
*
|
|
34
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–
|
|
35
|
+
* in `docs/CC-DIVERGENCE.md` (section "hooks classifier", H1–H9) — the whole-subtree guard-sign scan is the first of them. The entry field table
|
|
36
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
|
|
38
|
-
*
|
|
37
|
+
* which KEYS are read; the VALUE forms are the field kinds' (H7 lists where they judge more than CC does; H9 is the `url` kind: CC trims the string before it checks URL syntax,
|
|
38
|
+
* this package checks it both as written and trimmed, and carries it as written).
|
|
39
39
|
* One column is this contract's own, not CC's (H8): a `command` entry's `plugin` ({@link HookPluginContext}, 31.0.0) — CC reads a plugin hook's context from where the plugin sits, so its
|
|
40
40
|
* entry schema has no such key and strips one written in a settings file; here the context travels on the entry, and a bad one is a bad piece like any other field's bad value.
|
|
41
41
|
*
|
|
@@ -44,12 +44,20 @@
|
|
|
44
44
|
* echoes no values and writes no sentences — the sentences are the consumers' (same law as `DROPPED_ENTRY_REASON_CODES`).
|
|
45
45
|
*
|
|
46
46
|
* SELF-CONTAINED. {@link classifyHooksConfig} and the module-private declarations it uses reference nothing outside themselves except their REGISTERED
|
|
47
|
-
* names and JavaScript built-ins (no zod)
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
47
|
+
* names and JavaScript built-ins (no zod). ONE RULE for every fact the closure reads: it reads it from its one declaration, never from a copy of its own —
|
|
48
|
+
* a registered name is a name this module binds to that declaration (an export of this module, or an import). A consumer that copies the function into its
|
|
49
|
+
* own bundle (client-core's generator does, with the private declarations it uses) copies one closure and gives the copy's scope each registered name, bound
|
|
50
|
+
* to the declaration it names — never a copy of it. The registered names:
|
|
51
|
+
* · exports of this module — {@link HOOK_EVENTS} (the event vocabulary), {@link HOOK_ENTRY_FIELDS} (the field table), {@link HOOK_ON_FAILURE_WORDS} (the
|
|
52
|
+
* `onFailure` words), {@link pluginOptionKeysProblem} (it registers {@link pluginOptionEnvName} in turn) and {@link readHookPluginOptionRef} (the one reading of "is this
|
|
53
|
+
* option value a stored reference"; it registers `readCredentialRef` of the engine primitives package, the one reader of a credential reference, in turn — the closure itself
|
|
54
|
+
* does not call `readCredentialRef`);
|
|
55
|
+
* · imports — `isAbsoluteHostPath` (the engine primitives package: the one judge of "is this a host path"), and
|
|
56
|
+
* `jsonShapeOf` / `isPlainJsonObject` / `isJsonArray` (`./plain-json-object`, the package's one statement of "what shape is this value": a module of the
|
|
57
|
+
* package with no import of its own, not in the package's exports map — a consumer that copies the classifier copies that module once beside it).
|
|
58
|
+
* The built-ins it uses include `URL` (the `url` field kind asks the runtime's WHATWG URL parser) and `Symbol`.
|
|
59
|
+
* The hooks-classify test file (group ⑤) holds the registered set exactly and that the closure reads what it is given; `test/hook-plugin-context-31.0.0.test.ts`
|
|
60
|
+
* S7 holds "no copy" for the `plugin` column's three judgements.
|
|
53
61
|
*
|
|
54
62
|
* Input is a settings document as parsed from JSON. Values JSON cannot produce (accessors, class instances, cycles) are not part of the
|
|
55
63
|
* contract; cycles are tolerated, a throwing accessor propagates.
|
|
@@ -74,7 +82,7 @@ export type HookEntryType = (typeof HOOK_ENTRY_TYPES)[number];
|
|
|
74
82
|
* than 0 or 2, or printed JSON that is invalid or fails validation. `continue` (CC's default when the key is absent; this package does not fill it in — an absent key stays absent): the
|
|
75
83
|
* failure is reported and the action goes ahead. `block`: the failure counts as exit code 2, so the action the event guards is blocked. Carried by `command` and `http` entries only.
|
|
76
84
|
* CARRIED, not executed here: a consumer that reads `block` executes it or refuses it — ignoring it makes a guard that cannot start let the action through.
|
|
77
|
-
* The classifier reads this set
|
|
85
|
+
* The classifier reads this set itself (a registered name of its closure).
|
|
78
86
|
*/
|
|
79
87
|
export declare const HOOK_ON_FAILURE_WORDS: readonly ["continue", "block"];
|
|
80
88
|
/** One word of {@link HOOK_ON_FAILURE_WORDS}. */
|
|
@@ -93,14 +101,29 @@ export type HookCloud = (typeof HOOK_CLOUD_WORDS)[number];
|
|
|
93
101
|
/**
|
|
94
102
|
* A plugin option value that names a stored credential instead of carrying it (31.0.0): the `vault` kind of the engine primitives' credential reference, and ONLY that kind — an `env`,
|
|
95
103
|
* `handle` or `assertion` reference is never taken from a hook entry (an environment name would read any variable of the process that resolves it, a handle names someone else's
|
|
96
|
-
* credential, an assertion is minted by the deployment). Judged by
|
|
97
|
-
*
|
|
104
|
+
* credential, an assertion is minted by the deployment). Judged by {@link readHookPluginOptionRef} — the one reading, which asks the primitives' `readCredentialRef` and takes a `vault`
|
|
105
|
+
* reference only; this type is that kind of the primitives' `CredentialRef`.
|
|
98
106
|
* FORM ONLY: who may resolve the entry, and whether anything does, are the consumers' — this package judges the shape. A runner that cannot resolve a reference refuses the hook:
|
|
99
107
|
* it never runs it with the reference standing in for the value.
|
|
100
108
|
*/
|
|
101
109
|
export type HookPluginOptionRef = Extract<CredentialRef, {
|
|
102
110
|
readonly kind: "vault";
|
|
103
111
|
}>;
|
|
112
|
+
/**
|
|
113
|
+
* THE one reading of "is this value a stored reference this contract takes as a plugin option value": the answer is the reference, or `undefined` — nothing else, and no value makes it throw.
|
|
114
|
+
* The primitives' `readCredentialRef` reads the value (it is the one reader of a credential reference: this package carries no second reading of its own), and of what it reads only a
|
|
115
|
+
* `vault` reference is taken ({@link HookPluginOptionRef}: an `env`, `handle` or `assertion` reference is never taken from a hook entry). A taken value answers a FRESH
|
|
116
|
+
* `{ kind: "vault", entry }` built from that reading — it shares nothing with the value, and it is the copy a loaded entry carries. `undefined` is "not read": the value is not a credential
|
|
117
|
+
* reference, is a reference of another kind, or is a bad `vault` one (an accessor, a member it does not have, bad entry text); there is no finer answer. A string is not a reference —
|
|
118
|
+
* it is the option's own value, and the classifier takes a string before it asks this.
|
|
119
|
+
* ONE GATE for every party that puts this one question to one value: the classifier (it asks it of every option value that is not a string), a sender that decides whether an option value
|
|
120
|
+
* goes out as a reference, a terminal or a server executor that decides whether a value is a reference to resolve. None of them writes the `vault` kind out again or calls the primitives'
|
|
121
|
+
* reader for it — a second statement of "which references this contract takes" is a second reader. FORM ONLY, as {@link HookPluginOptionRef}: who may resolve the reference, and
|
|
122
|
+
* whether anything does, are the callers'.
|
|
123
|
+
* Its one REGISTERED name is the primitives' `readCredentialRef` (no other free name but JavaScript built-ins): a consumer's generator may copy it whole and give the copy that name, bound
|
|
124
|
+
* to the primitives' export — never to a copy of it.
|
|
125
|
+
*/
|
|
126
|
+
export declare function readHookPluginOptionRef(value: unknown): HookPluginOptionRef | undefined;
|
|
104
127
|
/**
|
|
105
128
|
* The plugin context a `command` entry carries (field `plugin`, 31.0.0 — before 31.0.0 the key was not a contract field and was stripped): the plugin the hook belongs to.
|
|
106
129
|
* · `name` — the plugin's name: a non-empty string with no NUL byte;
|
|
@@ -255,8 +278,7 @@ declare const HOOK_SHELLS: readonly ["bash", "powershell"];
|
|
|
255
278
|
/**
|
|
256
279
|
* 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
|
|
257
280
|
* 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.
|
|
258
|
-
* The classifier
|
|
259
|
-
* that an export expression reaches — would not be copyable. It reads {@link HOOK_ENTRY_FIELDS_READ}, annotated with this table's type.
|
|
281
|
+
* The classifier reads THIS object (a registered name of its closure — see the file header), so what the table says is what is judged: there is no second statement of it.
|
|
260
282
|
* · command: `args` = exec form (CC `cli309.js:252382`: when present — `[]` included — `command` is an executable spawned directly with these arguments, no shell; the mere
|
|
261
283
|
* presence of `args` is the switch), `shell` (see above), `async` = run in background without blocking, `asyncRewake` = background + wake the model on exit 2,
|
|
262
284
|
* `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
|
|
@@ -265,7 +287,7 @@ declare const HOOK_SHELLS: readonly ["bash", "powershell"];
|
|
|
265
287
|
* (the plugin context: {@link HookPluginContext}; a bad one is a bad piece);
|
|
266
288
|
* · prompt / agent: `prompt` ($ARGUMENTS = the hook input JSON), `model`; prompt only: `continueOnBlock` = the `continue` value of the `decision: "block"` the entry produces when its
|
|
267
289
|
* verdict is not ok (CC default false: the turn ends);
|
|
268
|
-
* · http: `url
|
|
290
|
+
* · http: `url` (an absolute URL — the `url` kind), `headers` (values may reference $NAMEs listed in `allowedEnvVars` — env-NAME interpolation only, the config never carries a
|
|
269
291
|
* secret value; `interpolateHookEnvVars` is the one reading), `allowedEnvVars`, `onFailure` (the other schema CC gives it to), `cloud` (the other schema CC gives it to);
|
|
270
292
|
* · mcp_tool: `server` (an already-configured MCP server's name), `tool`, `input` (the tool's arguments; string values may interpolate
|
|
271
293
|
* `${path}` from the hook input JSON — CC 2.1.296 semantics, the runner's business).
|
|
@@ -316,7 +338,7 @@ export declare const HOOK_ENTRY_FIELDS: {
|
|
|
316
338
|
readonly timeout: "seconds?";
|
|
317
339
|
readonly statusMessage: "string?";
|
|
318
340
|
readonly once: "boolean?";
|
|
319
|
-
readonly url: "
|
|
341
|
+
readonly url: "url";
|
|
320
342
|
readonly headers: "stringRecord?";
|
|
321
343
|
readonly allowedEnvVars: "stringList?";
|
|
322
344
|
readonly onFailure: "onFailure?";
|
|
@@ -333,7 +355,7 @@ export declare const HOOK_ENTRY_FIELDS: {
|
|
|
333
355
|
};
|
|
334
356
|
/** The type of {@link HOOK_ENTRY_FIELDS}: per entry type, field name → field kind (literal types). */
|
|
335
357
|
export type HookEntryFields = typeof HOOK_ENTRY_FIELDS;
|
|
336
|
-
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> : B extends "plugin" ? HookPluginContext : never;
|
|
358
|
+
type HookFieldBaseValue<B> = B extends "text" | "url" | "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> : B extends "plugin" ? HookPluginContext : never;
|
|
337
359
|
type HookFieldValue<K> = K extends `${infer B}?` ? HookFieldBaseValue<B> : HookFieldBaseValue<K>;
|
|
338
360
|
type Flat<O> = {
|
|
339
361
|
[K in keyof O]: O[K];
|
|
@@ -435,11 +457,13 @@ export type HooksClassification = {
|
|
|
435
457
|
* Rejections and drops are listed in document order.
|
|
436
458
|
*
|
|
437
459
|
* COPYING THIS FUNCTION (client-core's generator, or any consumer that emits it as source): its free names besides JavaScript built-ins are its
|
|
438
|
-
* REGISTERED names
|
|
439
|
-
*
|
|
440
|
-
*
|
|
441
|
-
*
|
|
442
|
-
*
|
|
460
|
+
* REGISTERED names (the file header lists them: five exports of this module — `readHookPluginOptionRef` among them, not the primitives' `readCredentialRef`, which it registers
|
|
461
|
+
* itself — the primitives' `isAbsoluteHostPath`, and the three shape readings of `./plain-json-object`). The copy's scope must be GIVEN each of them, bound to the declaration it names (the generator
|
|
462
|
+
* injects each as a registered value, it does not re-declare it; `pluginOptionKeysProblem` in turn registers {@link pluginOptionEnvName}, and `readHookPluginOptionRef` registers
|
|
463
|
+
* `readCredentialRef`).
|
|
464
|
+
* Never paste a literal event list, a literal field table or a copied judgement into the generated text: a second event table is one the upstream drift
|
|
465
|
+
* gate (it watches `HOOK_EVENTS`) cannot see and goes stale the first time CC adds an event; a second field table or word list is a second statement of
|
|
466
|
+
* what an entry may carry; a copied judgement is a second reading that drifts from its owner unseen.
|
|
443
467
|
* The module-private declarations the closure uses (the `HOOK_*` constants and `hook*` helpers below the classifier line) are copied with it;
|
|
444
468
|
* the hooks-classify test file (group ⑤) pins that the free names are exactly these.
|
|
445
469
|
*/
|