@dtmd/temper 0.0.4 → 0.0.7
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 +10 -12
- package/bin/temper.js +52 -0
- package/dist/src/assembly.d.ts +32 -16
- package/dist/src/assembly.js +11 -10
- package/dist/src/builtins.d.ts +206 -41
- package/dist/src/builtins.js +258 -54
- package/dist/src/claude-code.d.ts +7 -9
- package/dist/src/claude-code.js +6 -8
- package/dist/src/contract.d.ts +47 -24
- package/dist/src/contract.js +35 -9
- package/dist/src/declarations.d.ts +42 -101
- package/dist/src/declarations.js +375 -47
- package/dist/src/emit.d.ts +56 -28
- package/dist/src/emit.js +177 -54
- package/dist/src/generated/AssemblyFactRow.d.ts +29 -0
- package/dist/src/generated/AssemblyFactRow.js +2 -0
- package/dist/src/generated/BoundRow.d.ts +14 -0
- package/dist/src/generated/BoundRow.js +2 -0
- package/dist/src/generated/CharsetRow.d.ts +15 -0
- package/dist/src/generated/CharsetRow.js +2 -0
- package/dist/src/generated/ClauseRow.d.ts +97 -0
- package/dist/src/generated/ClauseRow.js +1 -0
- package/dist/src/generated/CollectionAddressRow.d.ts +17 -0
- package/dist/src/generated/CollectionAddressRow.js +2 -0
- package/dist/src/generated/CollectionEntryRow.d.ts +23 -0
- package/dist/src/generated/CollectionEntryRow.js +2 -0
- package/dist/src/generated/CollectionEntryWire.d.ts +17 -0
- package/dist/src/generated/CollectionEntryWire.js +2 -0
- package/dist/src/generated/CountBoundRow.d.ts +13 -0
- package/dist/src/generated/CountBoundRow.js +2 -0
- package/dist/src/generated/Declarations.d.ts +89 -0
- package/dist/src/generated/Declarations.js +1 -0
- package/dist/src/generated/DegreeBoundRow.d.ts +15 -0
- package/dist/src/generated/DegreeBoundRow.js +1 -0
- package/dist/src/generated/EdgeBoundRow.d.ts +13 -0
- package/dist/src/generated/EdgeBoundRow.js +2 -0
- package/dist/src/generated/EmbeddedMember.d.ts +45 -0
- package/dist/src/generated/EmbeddedMember.js +1 -0
- package/dist/src/generated/EmbeddedMemberCollectionEntry.d.ts +21 -0
- package/dist/src/generated/EmbeddedMemberCollectionEntry.js +1 -0
- package/dist/src/generated/FeatureValue.d.ts +23 -0
- package/dist/src/generated/FeatureValue.js +1 -0
- package/dist/src/generated/Features.d.ts +82 -0
- package/dist/src/generated/Features.js +1 -0
- package/dist/src/generated/FencedBlock.d.ts +24 -0
- package/dist/src/generated/FencedBlock.js +2 -0
- package/dist/src/generated/IncludeRow.d.ts +18 -0
- package/dist/src/generated/IncludeRow.js +2 -0
- package/dist/src/generated/KindFactRow.d.ts +65 -0
- package/dist/src/generated/KindFactRow.js +1 -0
- package/dist/src/generated/LayoutRegionRow.d.ts +29 -0
- package/dist/src/generated/LayoutRegionRow.js +2 -0
- package/dist/src/generated/LayoutRow.d.ts +12 -0
- package/dist/src/generated/LayoutRow.js +1 -0
- package/dist/src/generated/MentionRow.d.ts +17 -0
- package/dist/src/generated/MentionRow.js +2 -0
- package/dist/src/generated/NestedMemberRow.d.ts +39 -0
- package/dist/src/generated/NestedMemberRow.js +1 -0
- package/dist/src/generated/Payload.d.ts +25 -0
- package/dist/src/generated/Payload.js +1 -0
- package/dist/src/generated/PayloadMember.d.ts +31 -0
- package/dist/src/generated/PayloadMember.js +2 -0
- package/dist/src/generated/RangeBoundRow.d.ts +15 -0
- package/dist/src/generated/RangeBoundRow.js +2 -0
- package/dist/src/generated/RegistrationRow.d.ts +35 -0
- package/dist/src/generated/RegistrationRow.js +2 -0
- package/dist/src/generated/RequirementRow.d.ts +40 -0
- package/dist/src/generated/RequirementRow.js +1 -0
- package/dist/src/generated/SatisfiesRow.d.ts +14 -0
- package/dist/src/generated/SatisfiesRow.js +2 -0
- package/dist/src/generated/Section.d.ts +21 -0
- package/dist/src/generated/Section.js +2 -0
- package/dist/src/generated/SectionContainsRow.d.ts +14 -0
- package/dist/src/generated/SectionContainsRow.js +2 -0
- package/dist/src/generated/SettingsRow.d.ts +25 -0
- package/dist/src/generated/SettingsRow.js +2 -0
- package/dist/src/generated/ValueType.d.ts +9 -0
- package/dist/src/generated/ValueType.js +2 -0
- package/dist/src/generated/index.d.ts +32 -0
- package/dist/src/generated/index.js +1 -0
- package/dist/src/index.d.ts +14 -18
- package/dist/src/index.js +10 -13
- package/dist/src/kind.d.ts +190 -43
- package/dist/src/kind.js +34 -30
- package/dist/src/needs.d.ts +8 -8
- package/dist/src/needs.js +7 -7
- package/dist/src/prose.d.ts +75 -28
- package/dist/src/prose.js +0 -0
- package/package.json +9 -1
- package/dist/src/genres.d.ts +0 -38
- package/dist/src/genres.js +0 -24
package/dist/src/contract.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Contracts — clauses and requirements as typed values
|
|
2
|
+
* Contracts — clauses and requirements as typed values.
|
|
3
3
|
* A clause is `predicate · severity · guidance · cite`; a requirement is
|
|
4
|
-
* `
|
|
5
|
-
* at the seam
|
|
4
|
+
* `prose · kind · required · clauses? · verifiedBy?`. Both erase to compiled data
|
|
5
|
+
* at the seam: the author composes typed objects, the engine
|
|
6
6
|
* consumes their rows. The predicate vocabulary is the closed algebra — a clause
|
|
7
|
-
* outside it is a squiggle, not a runtime rejection
|
|
8
|
-
* walls).
|
|
7
|
+
* outside it is a squiggle, not a runtime rejection.
|
|
9
8
|
*/
|
|
10
|
-
// Node-scope predicates
|
|
9
|
+
// Node-scope predicates.
|
|
11
10
|
/** A field or marker is present. */
|
|
12
11
|
export const required = (field) => ({ key: "required", field });
|
|
13
12
|
/** The field's parsed scalar type is as declared. */
|
|
@@ -36,8 +35,35 @@ export const deny = (field, values) => ({
|
|
|
36
35
|
export const requireSections = () => ({ key: "require_sections" });
|
|
37
36
|
/** The member's name matches its directory. */
|
|
38
37
|
export const nameMatchesDir = () => ({ key: "name-matches-dir" });
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
/** Names are unique within the artifact kind (a scope-wide identity collision). */
|
|
39
|
+
export const uniqueName = () => ({ key: "unique-name" });
|
|
40
|
+
/**
|
|
41
|
+
* The named field may be present — always satisfied, recording the key as part of a
|
|
42
|
+
* declared (closed) schema. `dependency-exists` has no constructor: the engine holds
|
|
43
|
+
* it back absent a decidable reference syntax, so a hand-authored clause would fail
|
|
44
|
+
* admissibility.
|
|
45
|
+
*/
|
|
46
|
+
export const optional = (field) => ({ key: "optional", field });
|
|
47
|
+
/** The field's numeric value lies within the inclusive `[min, max]` bound. */
|
|
48
|
+
export const range = (field, min, max) => ({
|
|
49
|
+
key: "range",
|
|
50
|
+
field,
|
|
51
|
+
range: { min, max },
|
|
52
|
+
});
|
|
53
|
+
/** The field's value is one of `values`. Spelled `enumOf` — `enum` is a reserved word. */
|
|
54
|
+
export const enumOf = (field, values) => ({
|
|
55
|
+
key: "enum",
|
|
56
|
+
field,
|
|
57
|
+
values,
|
|
58
|
+
});
|
|
59
|
+
/** The named body marker is defined (e.g. `disable-model-invocation`). */
|
|
60
|
+
export const mustDefine = (marker) => ({ key: "must_define", field: marker });
|
|
61
|
+
/** Every body section whose heading *starts with* `heading` carries `marker` in its body. */
|
|
62
|
+
export const sectionContains = (heading, marker) => ({
|
|
63
|
+
key: "section_contains",
|
|
64
|
+
section: { heading, marker },
|
|
65
|
+
});
|
|
66
|
+
// Node-set/edge-scope predicates — a requirement's set-scope demands ride
|
|
41
67
|
// these as ordinary clause values, the same four-channel `clause()` shape as
|
|
42
68
|
// the node-scope predicates above.
|
|
43
69
|
/** The satisfier set's size lies in the inclusive `[min, max]` bound. */
|
|
@@ -74,7 +100,7 @@ export const degree = (bounds) => {
|
|
|
74
100
|
export function clause(predicate, opts) {
|
|
75
101
|
return { predicate, severity: opts.severity, guidance: opts.guidance, cite: opts.cite };
|
|
76
102
|
}
|
|
77
|
-
/** An identity helper — types a requirement literal at the keystroke
|
|
103
|
+
/** An identity helper — types a requirement literal at the keystroke. */
|
|
78
104
|
export function requirement(init) {
|
|
79
105
|
return init;
|
|
80
106
|
}
|
|
@@ -1,113 +1,54 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Declaration rows — the composed program's erased declarations
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* (
|
|
9
|
-
*
|
|
2
|
+
* Declaration rows — the composed program's erased declarations.
|
|
3
|
+
* Every type erases at the seam: kinds, clauses, requirements, and
|
|
4
|
+
* assembly facts compile to plain rows the engine reads. The **row shapes are the
|
|
5
|
+
* generated `ts-rs` bindings** (`./generated/`, derived from `src/drift.rs`), so a
|
|
6
|
+
* Rust-side row rename is a compile error here, never a silent shape drift. This
|
|
7
|
+
* module authors the builders that fill them; the same rows ride the internal
|
|
8
|
+
* versioned JSON pipe ({@link encodeSeam}) — not a designed IR, versioned
|
|
9
|
+
* in lockstep.
|
|
10
10
|
*/
|
|
11
11
|
import type { Harness } from "./assembly.js";
|
|
12
|
-
import type {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
readonly provider?: string;
|
|
17
|
-
readonly governs_root: string;
|
|
18
|
-
readonly governs_glob: string;
|
|
19
|
-
readonly format?: string;
|
|
20
|
-
readonly unit_shape?: string;
|
|
21
|
-
readonly registration?: string;
|
|
22
|
-
}
|
|
12
|
+
import type { Declarations, Payload, RegistrationRow, SettingsRow } from "./generated/index.js";
|
|
13
|
+
export type { AssemblyFactRow, ClauseRow, Declarations, KindFactRow, RequirementRow, SatisfiesRow, } from "./generated/index.js";
|
|
14
|
+
/** The stable-sort ordering every declaration row family shares. */
|
|
15
|
+
export declare function compareStrings(a: string, b: string): number;
|
|
23
16
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
17
|
+
* The `registration` rows — every fields-only registration member (a hook, an MCP server)
|
|
18
|
+
* erased for the manifest write face, kind-then-key sorted so double emit is byte-stable.
|
|
19
|
+
* Each carries its identity (`kind`/`key`), its collection address (`manifest`/`keyPath`,
|
|
20
|
+
* the wire's snake_case `key_path`), and its folded typed fields — the entry value the
|
|
21
|
+
* engine's write face places under `key`. The one source `emit.ts`'s public
|
|
22
|
+
* {@link RegistrationFact} view also maps from, so the seam and the `EmitResult` sibling
|
|
23
|
+
* cannot disagree on what a manifest carries.
|
|
24
|
+
*
|
|
25
|
+
* # Throws
|
|
26
|
+
* If a fields-only member declares no collection address — it surfaces in no host manifest.
|
|
29
27
|
*/
|
|
30
|
-
export
|
|
31
|
-
readonly kind?: string;
|
|
32
|
-
readonly predicate: string;
|
|
33
|
-
readonly field?: string;
|
|
34
|
-
readonly severity: string;
|
|
35
|
-
/** The just-in-time teaching channel the predicate cannot encode (`10-contracts.md`, "guidance"). */
|
|
36
|
-
readonly guidance?: string;
|
|
37
|
-
/** The external-fact source backing the clause — a doc URL plus retrieved date (`10-contracts.md`, "cite"). */
|
|
38
|
-
readonly cite?: string;
|
|
39
|
-
/** The `count` predicate's satisfier-set-size bound. */
|
|
40
|
-
readonly count?: {
|
|
41
|
-
readonly min: number;
|
|
42
|
-
readonly max: number;
|
|
43
|
-
};
|
|
44
|
-
/** The `membership` predicate's target requirement name. */
|
|
45
|
-
readonly target?: string;
|
|
46
|
-
/** The `degree` predicate's in/out edge-count bound. */
|
|
47
|
-
readonly degree?: {
|
|
48
|
-
readonly incoming?: {
|
|
49
|
-
readonly min?: number;
|
|
50
|
-
readonly max?: number;
|
|
51
|
-
};
|
|
52
|
-
readonly outgoing?: {
|
|
53
|
-
readonly min?: number;
|
|
54
|
-
readonly max?: number;
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
/** The `min_len`/`max_len`/`max_lines` predicate's scalar bound. */
|
|
58
|
-
readonly bound?: {
|
|
59
|
-
readonly min?: number;
|
|
60
|
-
readonly max?: number;
|
|
61
|
-
};
|
|
62
|
-
/** The `allowed_chars` predicate's declared character class. */
|
|
63
|
-
readonly charset?: Charset;
|
|
64
|
-
/** The `forbidden_keys` predicate's forbidden key list. */
|
|
65
|
-
readonly keys?: readonly string[];
|
|
66
|
-
/** The `deny` predicate's forbidden value list. */
|
|
67
|
-
readonly values?: readonly string[];
|
|
68
|
-
}
|
|
28
|
+
export declare function registrationRows(harness: Harness): RegistrationRow[];
|
|
69
29
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* is the whole of its set-/edge-scope demand, no facet columns beside it.
|
|
30
|
+
* The `settings` rows — the assembly's harness-level residual settings keys, each folded
|
|
31
|
+
* into the settings.json manifest's opaque residue at emit. Key-sorted so double emit is
|
|
32
|
+
* byte-stable. Seam-inbound: the value lives in the projected manifest, never the lock.
|
|
74
33
|
*/
|
|
75
|
-
export
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
readonly from?: string;
|
|
87
|
-
readonly field?: string;
|
|
88
|
-
readonly to?: string;
|
|
89
|
-
}
|
|
90
|
-
/** One member→requirement fill edge — a resolved `satisfies` key. */
|
|
91
|
-
export interface SatisfiesRow {
|
|
92
|
-
readonly member: string;
|
|
93
|
-
readonly requirement: string;
|
|
94
|
-
}
|
|
95
|
-
/** The five declaration families — the whole erased program the lock and pipe carry. */
|
|
96
|
-
export interface Declarations {
|
|
97
|
-
readonly kinds: readonly KindFactRow[];
|
|
98
|
-
readonly clauses: readonly ClauseRow[];
|
|
99
|
-
readonly requirements: readonly RequirementRow[];
|
|
100
|
-
readonly assembly: readonly AssemblyFactRow[];
|
|
101
|
-
readonly satisfies: readonly SatisfiesRow[];
|
|
102
|
-
}
|
|
103
|
-
/** Compile a harness into its five declaration families — the erased program. */
|
|
34
|
+
export declare function settingsRows(harness: Harness): SettingsRow[];
|
|
35
|
+
/** Every requirement name a `satisfies` claim may fill — assembly `require` ∪ member `requires`. */
|
|
36
|
+
export declare function declaredRequirements(harness: Harness): Set<string>;
|
|
37
|
+
/**
|
|
38
|
+
* Every address a mention may name — declared requirement names ∪ each member's
|
|
39
|
+
* `kind:name`. Shared by `emit.ts` (a member-level `Text` body's mentions) and
|
|
40
|
+
* this module (an embedded member's `Text` leaves) — the one resolution-check
|
|
41
|
+
* set, so a leaf mention and a member mention are held to the identical bar.
|
|
42
|
+
*/
|
|
43
|
+
export declare function declaredAddresses(harness: Harness): Set<string>;
|
|
44
|
+
/** Compile a harness into its seven declaration families — the erased program. */
|
|
104
45
|
export declare function compileDeclarations(harness: Harness): Declarations;
|
|
105
46
|
/** The SDK's pinned engine/interchange version — the JSON pipe rides it in lockstep. */
|
|
106
47
|
export declare const SEAM_VERSION = 2;
|
|
107
48
|
/**
|
|
108
|
-
* Serialize the
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
49
|
+
* Serialize the seam payload to the internal versioned JSON pipe — `encodeSeam`
|
|
50
|
+
* stamps `version`, so the caller supplies the rest of the {@link Payload}.
|
|
51
|
+
* Deterministic: insertion-ordered keys and a trailing newline, so a re-emit is
|
|
52
|
+
* byte-identical.
|
|
112
53
|
*/
|
|
113
|
-
export declare function
|
|
54
|
+
export declare function encodeSeam(payload: Omit<Payload, "version">): string;
|