@dtmd/temper 0.0.20 → 0.0.22
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/assembly.d.ts +20 -5
- package/dist/src/assembly.js +17 -7
- package/dist/src/builtins.d.ts +241 -52
- package/dist/src/builtins.js +248 -42
- package/dist/src/claude-code.d.ts +3 -2
- package/dist/src/claude-code.js +8 -1
- package/dist/src/contract.d.ts +20 -1
- package/dist/src/contract.js +20 -1
- package/dist/src/declarations.d.ts +26 -38
- package/dist/src/declarations.js +169 -92
- package/dist/src/emit.d.ts +9 -5
- package/dist/src/emit.js +265 -122
- package/dist/src/generated/AssemblyFactRow.d.ts +7 -5
- package/dist/src/generated/Declarations.d.ts +2 -2
- package/dist/src/generated/PayloadMember.d.ts +9 -3
- package/dist/src/generated/gate-commands.d.ts +2 -0
- package/dist/src/generated/gate-commands.js +3 -0
- package/dist/src/generated/index.d.ts +1 -0
- package/dist/src/generated/index.js +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/kind.d.ts +11 -4
- package/dist/src/kind.js +29 -0
- package/dist/src/member-address.d.ts +133 -25
- package/dist/src/member-address.js +144 -31
- package/dist/src/prose.d.ts +54 -13
- package/dist/src/prose.js +52 -11
- package/package.json +3 -3
package/dist/src/prose.d.ts
CHANGED
|
@@ -22,9 +22,10 @@ export interface Mentionable {
|
|
|
22
22
|
readonly display: string;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
* Spell a
|
|
26
|
-
* {@link
|
|
27
|
-
* repeats to cite a member from prose.
|
|
25
|
+
* Spell a member as the {@link Mentionable} a mention carries: its own
|
|
26
|
+
* {@link memberAddress}, its bare name the display text — the convention every corpus
|
|
27
|
+
* repeats to cite a member from prose. A nested file child spells the host-qualified
|
|
28
|
+
* address it resolves at, exactly as its declaration rows key by it.
|
|
28
29
|
*/
|
|
29
30
|
export declare function mentionOf(member: Member): Mentionable;
|
|
30
31
|
/** One authored interpolation: position in the template plus its target. */
|
|
@@ -48,10 +49,10 @@ export interface Include {
|
|
|
48
49
|
/** A `` text`…` `` interpolation — a mention (moves no content) or an include (moves content). */
|
|
49
50
|
export type Reference = Mentionable | Include;
|
|
50
51
|
/**
|
|
51
|
-
* The resolution universe
|
|
52
|
-
* resolve here and now ({@link mentionable}), and the kinds whose members the program
|
|
53
|
-
* declares but does not compose ({@link deferrableKinds}) — a
|
|
54
|
-
*
|
|
52
|
+
* The resolution universe an authored reference is checked against at emit: the addresses
|
|
53
|
+
* that resolve here and now ({@link mentionable}), and the kinds whose members the program
|
|
54
|
+
* declares but does not compose ({@link deferrableKinds}) — a reference naming one of those
|
|
55
|
+
* defers to `check` rather than refusing at emit.
|
|
55
56
|
*/
|
|
56
57
|
export interface MentionScope {
|
|
57
58
|
/** Every address a mention may resolve against in the program's own universe. */
|
|
@@ -60,12 +61,17 @@ export interface MentionScope {
|
|
|
60
61
|
readonly deferrableKinds: ReadonlySet<string>;
|
|
61
62
|
}
|
|
62
63
|
/**
|
|
63
|
-
* Whether
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
64
|
+
* Whether an unresolved address **defers to the gate** rather than refusing at emit: a
|
|
65
|
+
* host address ({@link parseHostAddress}) whose kind is one the program declares at a
|
|
66
|
+
* discovery locus (an `at`-locus kind) may name a member discovered on disk, so `check`
|
|
67
|
+
* owns the verdict. Anything the grammar's reader answers `undefined` for — a segmented
|
|
68
|
+
* embedded address, a bare requirement name, a name-less `kind:` — names no discoverable
|
|
69
|
+
* member, and stays a dangling refusal however deferrable its head reads.
|
|
70
|
+
*
|
|
71
|
+
* The predicate reads an address, never the reference that carries it: refusal reaches
|
|
72
|
+
* exactly as far as the program's own universe (`pipeline.md`, "Emit", the "Refusing"
|
|
73
|
+
* bullet), so a mention ({@link checkMentions}) and an embedded value's edge target
|
|
74
|
+
* (`emit.ts`'s `edgeTargetFacts`) draw the same boundary at the same place.
|
|
69
75
|
*/
|
|
70
76
|
export declare function defersToGate(address: string, deferrableKinds: ReadonlySet<string>): boolean;
|
|
71
77
|
/**
|
|
@@ -196,3 +202,38 @@ export declare function renderText(prose: Text): string;
|
|
|
196
202
|
* If a mention names no declared value and has no discovery locus.
|
|
197
203
|
*/
|
|
198
204
|
export declare function resolveLeaf(value: string | Text, scope: MentionScope, context: string): string;
|
|
205
|
+
/**
|
|
206
|
+
* One embedded member value's leaves after {@link resolveEmbeddedLeaves} — the
|
|
207
|
+
* top-level fields and each collection's entries, every `Text` already rendered to
|
|
208
|
+
* its final stored string. Both faces of a composed body spell this same pair:
|
|
209
|
+
* `kind.ts`'s `ResolvedEmbeddedMemberValue` (what a `render` hook receives) and the
|
|
210
|
+
* generated `NestedMemberRow` (what the engine reads), the entry shape theirs share
|
|
211
|
+
* as `ResolvedEmbeddedMemberCollectionEntry` and `CollectionEntryWire`.
|
|
212
|
+
*/
|
|
213
|
+
export interface ResolvedEmbeddedLeaves {
|
|
214
|
+
/** Top-level leaves, keyed by field name, in authored order. */
|
|
215
|
+
readonly leaves: Record<string, string>;
|
|
216
|
+
/** Sibling collections, each entry's leaves resolved, in authored order. */
|
|
217
|
+
readonly collections: Record<string, {
|
|
218
|
+
readonly key: string;
|
|
219
|
+
readonly leaves: Record<string, string>;
|
|
220
|
+
}[]>;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Resolve one embedded member value's leaves — the top-level fields and each
|
|
224
|
+
* collection entry's — to their final stored strings, each through
|
|
225
|
+
* {@link resolveLeaf} against `scope`, in authored order.
|
|
226
|
+
*
|
|
227
|
+
* The one walk behind both faces of a composed body: the `member.<kind> <key>`
|
|
228
|
+
* fence `emit` renders and the `nested_member` declaration row the engine reads.
|
|
229
|
+
* Each face still reads the authored value for itself (0018's second read), but
|
|
230
|
+
* off this one resolution, so a dangling leaf mention refuses identically
|
|
231
|
+
* whichever face runs — both name the leaf by the one context grammar
|
|
232
|
+
* ``member.<kind> <key>: leaf `<child-path>` ``, a collection entry's child path
|
|
233
|
+
* spelled `<collection>.<entry-key>.<field>`.
|
|
234
|
+
*
|
|
235
|
+
* # Throws
|
|
236
|
+
* If a leaf's mention names no declared value and has no discovery locus, or a
|
|
237
|
+
* leaf carries an include ({@link resolveLeaf}).
|
|
238
|
+
*/
|
|
239
|
+
export declare function resolveEmbeddedLeaves(value: EmbeddedMemberValue, scope: MentionScope): ResolvedEmbeddedLeaves;
|
package/dist/src/prose.js
CHANGED
|
@@ -13,22 +13,28 @@
|
|
|
13
13
|
* **include** (an {@link Include}) pulls the target file's bytes into the host's emitted
|
|
14
14
|
* projection. Both are authored per word and resolution-checked at emit, never mined.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
16
|
+
import { memberAddress, parseHostAddress } from "./member-address.js";
|
|
17
17
|
/**
|
|
18
|
-
* Spell a
|
|
19
|
-
* {@link
|
|
20
|
-
* repeats to cite a member from prose.
|
|
18
|
+
* Spell a member as the {@link Mentionable} a mention carries: its own
|
|
19
|
+
* {@link memberAddress}, its bare name the display text — the convention every corpus
|
|
20
|
+
* repeats to cite a member from prose. A nested file child spells the host-qualified
|
|
21
|
+
* address it resolves at, exactly as its declaration rows key by it.
|
|
21
22
|
*/
|
|
22
23
|
export function mentionOf(member) {
|
|
23
|
-
return { address:
|
|
24
|
+
return { address: memberAddress(member), display: member.name };
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
26
|
-
* Whether
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
27
|
+
* Whether an unresolved address **defers to the gate** rather than refusing at emit: a
|
|
28
|
+
* host address ({@link parseHostAddress}) whose kind is one the program declares at a
|
|
29
|
+
* discovery locus (an `at`-locus kind) may name a member discovered on disk, so `check`
|
|
30
|
+
* owns the verdict. Anything the grammar's reader answers `undefined` for — a segmented
|
|
31
|
+
* embedded address, a bare requirement name, a name-less `kind:` — names no discoverable
|
|
32
|
+
* member, and stays a dangling refusal however deferrable its head reads.
|
|
33
|
+
*
|
|
34
|
+
* The predicate reads an address, never the reference that carries it: refusal reaches
|
|
35
|
+
* exactly as far as the program's own universe (`pipeline.md`, "Emit", the "Refusing"
|
|
36
|
+
* bullet), so a mention ({@link checkMentions}) and an embedded value's edge target
|
|
37
|
+
* (`emit.ts`'s `edgeTargetFacts`) draw the same boundary at the same place.
|
|
32
38
|
*/
|
|
33
39
|
export function defersToGate(address, deferrableKinds) {
|
|
34
40
|
const host = parseHostAddress(address);
|
|
@@ -233,3 +239,38 @@ export function resolveLeaf(value, scope, context) {
|
|
|
233
239
|
checkMentions(value.mentions, scope, context);
|
|
234
240
|
return renderText(value);
|
|
235
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* Resolve one embedded member value's leaves — the top-level fields and each
|
|
244
|
+
* collection entry's — to their final stored strings, each through
|
|
245
|
+
* {@link resolveLeaf} against `scope`, in authored order.
|
|
246
|
+
*
|
|
247
|
+
* The one walk behind both faces of a composed body: the `member.<kind> <key>`
|
|
248
|
+
* fence `emit` renders and the `nested_member` declaration row the engine reads.
|
|
249
|
+
* Each face still reads the authored value for itself (0018's second read), but
|
|
250
|
+
* off this one resolution, so a dangling leaf mention refuses identically
|
|
251
|
+
* whichever face runs — both name the leaf by the one context grammar
|
|
252
|
+
* ``member.<kind> <key>: leaf `<child-path>` ``, a collection entry's child path
|
|
253
|
+
* spelled `<collection>.<entry-key>.<field>`.
|
|
254
|
+
*
|
|
255
|
+
* # Throws
|
|
256
|
+
* If a leaf's mention names no declared value and has no discovery locus, or a
|
|
257
|
+
* leaf carries an include ({@link resolveLeaf}).
|
|
258
|
+
*/
|
|
259
|
+
export function resolveEmbeddedLeaves(value, scope) {
|
|
260
|
+
const context = (childPath) => `member.${value.kind} ${value.key}: leaf \`${childPath}\``;
|
|
261
|
+
const leaves = {};
|
|
262
|
+
for (const [field, leaf] of Object.entries(value.leaves)) {
|
|
263
|
+
leaves[field] = resolveLeaf(leaf, scope, context(field));
|
|
264
|
+
}
|
|
265
|
+
const collections = {};
|
|
266
|
+
for (const [collection, entries] of Object.entries(value.collections)) {
|
|
267
|
+
collections[collection] = entries.map((entry) => {
|
|
268
|
+
const entryLeaves = {};
|
|
269
|
+
for (const [field, leaf] of Object.entries(entry.leaves)) {
|
|
270
|
+
entryLeaves[field] = resolveLeaf(leaf, scope, context(`${collection}.${entry.key}.${field}`));
|
|
271
|
+
}
|
|
272
|
+
return { key: entry.key, leaves: entryLeaves };
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
return { leaves, collections };
|
|
276
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dtmd/temper",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
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.22",
|
|
56
|
+
"@dtmd/temper-win32-x64": "0.0.22"
|
|
57
57
|
}
|
|
58
58
|
}
|