@dtmd/temper 0.0.22 → 0.0.23
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/dist/src/builtins.d.ts +12 -23
- package/dist/src/builtins.js +38 -22
- package/dist/src/contract.d.ts +3 -1
- package/dist/src/contract.js +3 -1
- package/dist/src/generated/CollectionAddressRow.d.ts +9 -5
- package/dist/src/generated/index.d.ts +1 -0
- package/dist/src/generated/index.js +1 -0
- package/dist/src/generated/tap-hooks.d.ts +18 -0
- package/dist/src/generated/tap-hooks.js +7 -0
- package/package.json +3 -3
package/dist/src/builtins.d.ts
CHANGED
|
@@ -407,18 +407,6 @@ export declare const HOOK_HANDLER_KEY = "hooks";
|
|
|
407
407
|
/** The one group-level field a matcher group lifts beside its handlers — {@link Hook}'s
|
|
408
408
|
* `matcher`, and the other half of the group's identity the join keys on (same source). */
|
|
409
409
|
export declare const HOOK_MATCHER_KEY = "matcher";
|
|
410
|
-
/**
|
|
411
|
-
* A hook member's **name** — its lifecycle `event`, then `:` and the matcher's authored
|
|
412
|
-
* bytes; the bare event where the group binds no matcher
|
|
413
|
-
* (`hook:PostToolUse:Edit|Write`, `hook:SessionStart`).
|
|
414
|
-
*
|
|
415
|
-
* Name and collection key part company because the **group** is the member and the event
|
|
416
|
-
* keys them all: Claude Code nests several matcher groups under one event, and two
|
|
417
|
-
* members at one address is a malformed lock. The matcher is joined verbatim, never
|
|
418
|
-
* normalized — `Edit|Write` and `Edit, Write` are two groups on the wire and two members
|
|
419
|
-
* here — which is also why an authored empty matcher joins as the empty bytes it is.
|
|
420
|
-
*/
|
|
421
|
-
export declare function hookMemberName(event: string, matcher: string | undefined): string;
|
|
422
410
|
/**
|
|
423
411
|
* The `hooks.<Event>` collection key a hook member's name was joined onto — its text
|
|
424
412
|
* before its own first `:`. The inverse of {@link hookMemberName} for the one reader that
|
|
@@ -1203,18 +1191,19 @@ export declare const hookDefaultContract: readonly Clause[];
|
|
|
1203
1191
|
* projects its tap hook at. The event-name is the author-facing token a telemetry
|
|
1204
1192
|
* verifier names (`contract.ts`'s `telemetry`, the `roster.rs` admissibility set); the
|
|
1205
1193
|
* `event` is the `hooks.<Event>` key the tap registers under, and the `matcher` scopes
|
|
1206
|
-
* the fire to the telemetry-relevant subset —
|
|
1207
|
-
* (code.claude.com/docs/en/hooks, retrieved 2026-08-26)
|
|
1194
|
+
* the fire to the telemetry-relevant subset — a load reason, a command name, a tool name,
|
|
1195
|
+
* each an external fact (code.claude.com/docs/en/hooks, retrieved 2026-08-26).
|
|
1196
|
+
*
|
|
1197
|
+
* The pairing's one home is the engine's own `TAP_HOOK_BINDINGS` table
|
|
1198
|
+
* (`src/builtin_kind.rs`), which states and cites each event's own matcher and resolves the
|
|
1199
|
+
* table through an exhaustive match over the `TapEvent` it already classifies hook payloads
|
|
1200
|
+
* into — and which `check` reads for the admissibility set too, so the names a telemetry
|
|
1201
|
+
* verifier may declare and the names a tap hook is synthesized for are one enumeration. The
|
|
1202
|
+
* binding read here is machine-written across the `generated/` seam from that table and held
|
|
1203
|
+
* byte-equal by the seam gate (`tests/it/seam_bindings_current.rs`).
|
|
1208
1204
|
*
|
|
1209
|
-
*
|
|
1210
|
-
*
|
|
1211
|
-
* include, compact), so always-on members that load at session start are recorded.
|
|
1212
|
-
* - `SkillInvoked` is a skill invocation, surfaced under `PostToolUse` with the tool-name
|
|
1213
|
-
* matcher `Skill` — the tap's own read of a skill call.
|
|
1214
|
-
* - `UserPromptExpansion` fires on a command expansion; its matcher filters the command
|
|
1215
|
-
* name, `.*` capturing every one.
|
|
1216
|
-
* - `ToolUse` fires after any tool call; its matcher filters the tool name, `.*`
|
|
1217
|
-
* capturing every one.
|
|
1205
|
+
* The widened annotation stays: `tapHookRows` looks up an author-supplied event name, which
|
|
1206
|
+
* the generated literal's own narrow key type would refuse.
|
|
1218
1207
|
*/
|
|
1219
1208
|
export declare const TELEMETRY_EVENT_HOOKS: Readonly<Record<string, {
|
|
1220
1209
|
readonly event: string;
|
package/dist/src/builtins.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* `@dtmd/temper/claude-code` subpath
|
|
10
10
|
* — never from the root.
|
|
11
11
|
*/
|
|
12
|
+
import { TAP_EVENT_HOOKS } from "./generated/index.js";
|
|
12
13
|
import { kind } from "./kind.js";
|
|
13
14
|
import { isNameQualifier } from "./member-address.js";
|
|
14
15
|
import { allowedChars, clause, closedKeys, degree, deny, enumOf, extent, forbiddenKeys, globValid, maxLen, mentionReachable, minLen, nameMatchesDir, optional, required, shape, type, uniqueName, when, } from "./contract.js";
|
|
@@ -159,7 +160,7 @@ export const HOOK_MATCHER_KEY = "matcher";
|
|
|
159
160
|
* normalized — `Edit|Write` and `Edit, Write` are two groups on the wire and two members
|
|
160
161
|
* here — which is also why an authored empty matcher joins as the empty bytes it is.
|
|
161
162
|
*/
|
|
162
|
-
|
|
163
|
+
function hookMemberName(event, matcher) {
|
|
163
164
|
return matcher === undefined ? event : `${event}:${matcher}`;
|
|
164
165
|
}
|
|
165
166
|
/**
|
|
@@ -851,6 +852,25 @@ export const mcp = kind({
|
|
|
851
852
|
* never stranded by temper's release cadence.
|
|
852
853
|
*/
|
|
853
854
|
export const mcpDefaultContract = [];
|
|
855
|
+
/**
|
|
856
|
+
* The cite behind {@link pathsGateGuidance} — one doc page and three dated probes: the
|
|
857
|
+
* gating hard-error, and the two negative findings that a shell read and a search read
|
|
858
|
+
* open no path gate. Dated facts go stale together, so they live in one place: a re-probe
|
|
859
|
+
* re-dates this const and every clause reading it moves with it.
|
|
860
|
+
*/
|
|
861
|
+
const PATHS_GATE_CITE = "https://code.claude.com/docs/en/skills (retrieved 2026-07-16; gating hard-error verified against 2.1.211; shell and search reads open no path gate, probed on Claude Code 2.1.281, 2026-09-24)";
|
|
862
|
+
/**
|
|
863
|
+
* The `mentionReachable("paths", "paths")` clause's guidance, for a member kind that
|
|
864
|
+
* carries a `paths` gate and can mention another that does. The reachability argument is
|
|
865
|
+
* a property of the gate mechanic, not of either kind, so the two default contracts that
|
|
866
|
+
* bind this clause — `skill` and `rule` — differ in exactly one word: the noun naming the
|
|
867
|
+
* mentioning member.
|
|
868
|
+
*/
|
|
869
|
+
function pathsGateGuidance(member) {
|
|
870
|
+
return ("A mention of a gated member is actionable only where that member can be invoked. A `paths` gate removes its member from every invocation channel until a file tool (read, edit, write) touches a matching path, and invoking a gated member from outside its gate hard-errors (`Unknown skill`) — the harness then tells the user it doesn't exist. " +
|
|
871
|
+
`So a ${member} that loads where its target cannot be invoked hands Claude an obligation it cannot act on. Two remedies: scope this ${member}'s \`paths\` to the target's gate, or ungate the target. ` +
|
|
872
|
+
"Advisory because the containment test is literal — every glob here must appear verbatim in the gate — so a semantically narrower glob (`src/**/*.ts` inside `src/**`) false-fires; retune or drop this clause in your own contract when it does. The judgment is over the gates, not over how they open: only a file tool (read, edit, write) opens a path gate — a shell read of a matching path, or a search tool's, opens none — so a session that works inside the gate through the shell alone loads neither member, and nothing static can see that.");
|
|
873
|
+
}
|
|
854
874
|
/**
|
|
855
875
|
* The default contract for `skill` — Anthropic's documented skill contract: the Agent
|
|
856
876
|
* Skills open standard (agentskills.io), Anthropic's platform upload
|
|
@@ -947,8 +967,8 @@ export const skillDefaultContract = [
|
|
|
947
967
|
}),
|
|
948
968
|
clause(mentionReachable("paths", "paths"), {
|
|
949
969
|
severity: "advisory",
|
|
950
|
-
guidance: "
|
|
951
|
-
cite:
|
|
970
|
+
guidance: pathsGateGuidance("skill"),
|
|
971
|
+
cite: PATHS_GATE_CITE,
|
|
952
972
|
}),
|
|
953
973
|
];
|
|
954
974
|
/**
|
|
@@ -1056,8 +1076,8 @@ export const ruleDefaultContract = [
|
|
|
1056
1076
|
}),
|
|
1057
1077
|
clause(mentionReachable("paths", "paths"), {
|
|
1058
1078
|
severity: "advisory",
|
|
1059
|
-
guidance: "
|
|
1060
|
-
cite:
|
|
1079
|
+
guidance: pathsGateGuidance("rule"),
|
|
1080
|
+
cite: PATHS_GATE_CITE,
|
|
1061
1081
|
}),
|
|
1062
1082
|
];
|
|
1063
1083
|
/**
|
|
@@ -1224,25 +1244,21 @@ export const hookDefaultContract = [
|
|
|
1224
1244
|
* projects its tap hook at. The event-name is the author-facing token a telemetry
|
|
1225
1245
|
* verifier names (`contract.ts`'s `telemetry`, the `roster.rs` admissibility set); the
|
|
1226
1246
|
* `event` is the `hooks.<Event>` key the tap registers under, and the `matcher` scopes
|
|
1227
|
-
* the fire to the telemetry-relevant subset —
|
|
1228
|
-
* (code.claude.com/docs/en/hooks, retrieved 2026-08-26)
|
|
1247
|
+
* the fire to the telemetry-relevant subset — a load reason, a command name, a tool name,
|
|
1248
|
+
* each an external fact (code.claude.com/docs/en/hooks, retrieved 2026-08-26).
|
|
1249
|
+
*
|
|
1250
|
+
* The pairing's one home is the engine's own `TAP_HOOK_BINDINGS` table
|
|
1251
|
+
* (`src/builtin_kind.rs`), which states and cites each event's own matcher and resolves the
|
|
1252
|
+
* table through an exhaustive match over the `TapEvent` it already classifies hook payloads
|
|
1253
|
+
* into — and which `check` reads for the admissibility set too, so the names a telemetry
|
|
1254
|
+
* verifier may declare and the names a tap hook is synthesized for are one enumeration. The
|
|
1255
|
+
* binding read here is machine-written across the `generated/` seam from that table and held
|
|
1256
|
+
* byte-equal by the seam gate (`tests/it/seam_bindings_current.rs`).
|
|
1229
1257
|
*
|
|
1230
|
-
*
|
|
1231
|
-
*
|
|
1232
|
-
* include, compact), so always-on members that load at session start are recorded.
|
|
1233
|
-
* - `SkillInvoked` is a skill invocation, surfaced under `PostToolUse` with the tool-name
|
|
1234
|
-
* matcher `Skill` — the tap's own read of a skill call.
|
|
1235
|
-
* - `UserPromptExpansion` fires on a command expansion; its matcher filters the command
|
|
1236
|
-
* name, `.*` capturing every one.
|
|
1237
|
-
* - `ToolUse` fires after any tool call; its matcher filters the tool name, `.*`
|
|
1238
|
-
* capturing every one.
|
|
1258
|
+
* The widened annotation stays: `tapHookRows` looks up an author-supplied event name, which
|
|
1259
|
+
* the generated literal's own narrow key type would refuse.
|
|
1239
1260
|
*/
|
|
1240
|
-
export const TELEMETRY_EVENT_HOOKS =
|
|
1241
|
-
InstructionsLoaded: { event: "InstructionsLoaded", matcher: ".*" },
|
|
1242
|
-
SkillInvoked: { event: "PostToolUse", matcher: "Skill" },
|
|
1243
|
-
UserPromptExpansion: { event: "UserPromptExpansion", matcher: ".*" },
|
|
1244
|
-
ToolUse: { event: "PostToolUse", matcher: ".*" },
|
|
1245
|
-
};
|
|
1261
|
+
export const TELEMETRY_EVENT_HOOKS = TAP_EVENT_HOOKS;
|
|
1246
1262
|
/**
|
|
1247
1263
|
* Every documented `.mcp.json` server transport — the closed set a server entry's `type`
|
|
1248
1264
|
* is drawn from (code.claude.com/docs/en/mcp, retrieved 2026-07-15). `stdio` is the
|
package/dist/src/contract.d.ts
CHANGED
|
@@ -387,7 +387,9 @@ export declare const script: (path: string) => Verifier;
|
|
|
387
387
|
* A telemetry verifier — the named documented harness events the emitted tap records
|
|
388
388
|
* to a local-locus log, judged by reading the field record. Each name must be a
|
|
389
389
|
* documented harness lifecycle event — the gate checks each resolves, never records
|
|
390
|
-
* into it.
|
|
390
|
+
* into it. The vocabulary is the engine's own `TAP_HOOK_BINDINGS` table
|
|
391
|
+
* (`src/builtin_kind.rs`), machine-written across the `generated/` seam and read by
|
|
392
|
+
* `builtins.ts`'s `TELEMETRY_EVENT_HOOKS`.
|
|
391
393
|
*/
|
|
392
394
|
export declare const telemetry: (events: readonly string[]) => Verifier;
|
|
393
395
|
/**
|
package/dist/src/contract.js
CHANGED
|
@@ -315,7 +315,9 @@ export const script = (path) => ({ species: "script", path });
|
|
|
315
315
|
* A telemetry verifier — the named documented harness events the emitted tap records
|
|
316
316
|
* to a local-locus log, judged by reading the field record. Each name must be a
|
|
317
317
|
* documented harness lifecycle event — the gate checks each resolves, never records
|
|
318
|
-
* into it.
|
|
318
|
+
* into it. The vocabulary is the engine's own `TAP_HOOK_BINDINGS` table
|
|
319
|
+
* (`src/builtin_kind.rs`), machine-written across the `generated/` seam and read by
|
|
320
|
+
* `builtins.ts`'s `TELEMETRY_EVENT_HOOKS`.
|
|
319
321
|
*/
|
|
320
322
|
export const telemetry = (events) => ({ species: "telemetry", events });
|
|
321
323
|
/** An identity helper — types a requirement literal at the keystroke. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A kind's declared **collection address** row — the manifest a registration member
|
|
3
|
-
* surfaces in
|
|
4
|
-
* [`KindFactRow::collection_address`] carries. Absent from a
|
|
5
|
-
* kind owns its own file locus.
|
|
3
|
+
* surfaces in, the key path it keys at, and the shape its entry takes: the
|
|
4
|
+
* presence-coupled triple [`KindFactRow::collection_address`] carries. Absent from a
|
|
5
|
+
* [`KindFactRow`] means the kind owns its own file locus.
|
|
6
6
|
*/
|
|
7
7
|
export type CollectionAddressRow = {
|
|
8
8
|
/**
|
|
@@ -15,7 +15,11 @@ export type CollectionAddressRow = {
|
|
|
15
15
|
*/
|
|
16
16
|
key_path: string;
|
|
17
17
|
/**
|
|
18
|
-
* The entry's declared shape —
|
|
18
|
+
* The entry's declared shape — `object`, `scalar(field)`, or
|
|
19
|
+
* `group-array(member_key;lifted_fields)`, a closed vocabulary the engine's kind lift
|
|
20
|
+
* rejects an unknown value from. Required: the shape is the kind's own declared fact,
|
|
21
|
+
* never derivable from the key path (two kinds keying at `hooks.<Event>` may lift
|
|
22
|
+
* different group fields).
|
|
19
23
|
*/
|
|
20
|
-
entry_shape: string
|
|
24
|
+
entry_shape: string;
|
|
21
25
|
};
|
|
@@ -35,3 +35,4 @@ export type { TemplateRow } from "./TemplateRow.js";
|
|
|
35
35
|
export type { ValueType } from "./ValueType.js";
|
|
36
36
|
export type { Verifier } from "./Verifier.js";
|
|
37
37
|
export { GUARD_COMMAND, SESSION_START_COMMAND } from "./gate-commands.js";
|
|
38
|
+
export { TAP_EVENT_HOOKS } from "./tap-hooks.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const TAP_EVENT_HOOKS: {
|
|
2
|
+
readonly InstructionsLoaded: {
|
|
3
|
+
readonly event: "InstructionsLoaded";
|
|
4
|
+
readonly matcher: ".*";
|
|
5
|
+
};
|
|
6
|
+
readonly SkillInvoked: {
|
|
7
|
+
readonly event: "PostToolUse";
|
|
8
|
+
readonly matcher: "Skill";
|
|
9
|
+
};
|
|
10
|
+
readonly UserPromptExpansion: {
|
|
11
|
+
readonly event: "UserPromptExpansion";
|
|
12
|
+
readonly matcher: ".*";
|
|
13
|
+
};
|
|
14
|
+
readonly ToolUse: {
|
|
15
|
+
readonly event: "PostToolUse";
|
|
16
|
+
readonly matcher: ".*";
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// This file carries temper's tap-hook registrations, generated from the engine's own table. Do not edit this file manually.
|
|
2
|
+
export const TAP_EVENT_HOOKS = {
|
|
3
|
+
"InstructionsLoaded": { event: "InstructionsLoaded", matcher: ".*" },
|
|
4
|
+
"SkillInvoked": { event: "PostToolUse", matcher: "Skill" },
|
|
5
|
+
"UserPromptExpansion": { event: "UserPromptExpansion", matcher: ".*" },
|
|
6
|
+
"ToolUse": { event: "PostToolUse", matcher: ".*" },
|
|
7
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dtmd/temper",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"description": "The temper authoring face — the six-noun model as typed modules: harness(), kind<T>(), clause values, needs, and file()/text/blocks(). Emit compiles to the declaration rows the engine reads, a byte-faithful projection, and the lock.",
|
|
5
5
|
"license": "(MIT OR Apache-2.0)",
|
|
6
6
|
"repository": {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"temper": "bin/temper.js"
|
|
53
53
|
},
|
|
54
54
|
"optionalDependencies": {
|
|
55
|
-
"@dtmd/temper-linux-x64": "0.0.
|
|
56
|
-
"@dtmd/temper-win32-x64": "0.0.
|
|
55
|
+
"@dtmd/temper-linux-x64": "0.0.23",
|
|
56
|
+
"@dtmd/temper-win32-x64": "0.0.23"
|
|
57
57
|
}
|
|
58
58
|
}
|