@dtmd/temper 0.0.4 → 0.0.6

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.
Files changed (84) hide show
  1. package/README.md +10 -12
  2. package/dist/src/assembly.d.ts +32 -16
  3. package/dist/src/assembly.js +11 -10
  4. package/dist/src/builtins.d.ts +104 -40
  5. package/dist/src/builtins.js +130 -53
  6. package/dist/src/claude-code.d.ts +7 -9
  7. package/dist/src/claude-code.js +6 -8
  8. package/dist/src/contract.d.ts +47 -24
  9. package/dist/src/contract.js +35 -9
  10. package/dist/src/declarations.d.ts +25 -103
  11. package/dist/src/declarations.js +311 -47
  12. package/dist/src/emit.d.ts +13 -32
  13. package/dist/src/emit.js +136 -53
  14. package/dist/src/generated/AssemblyFactRow.d.ts +29 -0
  15. package/dist/src/generated/AssemblyFactRow.js +2 -0
  16. package/dist/src/generated/BoundRow.d.ts +14 -0
  17. package/dist/src/generated/BoundRow.js +2 -0
  18. package/dist/src/generated/CharsetRow.d.ts +15 -0
  19. package/dist/src/generated/CharsetRow.js +2 -0
  20. package/dist/src/generated/ClauseRow.d.ts +97 -0
  21. package/dist/src/generated/ClauseRow.js +1 -0
  22. package/dist/src/generated/CollectionEntryRow.d.ts +23 -0
  23. package/dist/src/generated/CollectionEntryRow.js +2 -0
  24. package/dist/src/generated/CollectionEntryWire.d.ts +17 -0
  25. package/dist/src/generated/CollectionEntryWire.js +2 -0
  26. package/dist/src/generated/CountBoundRow.d.ts +13 -0
  27. package/dist/src/generated/CountBoundRow.js +2 -0
  28. package/dist/src/generated/Declarations.d.ts +72 -0
  29. package/dist/src/generated/Declarations.js +1 -0
  30. package/dist/src/generated/DegreeBoundRow.d.ts +15 -0
  31. package/dist/src/generated/DegreeBoundRow.js +1 -0
  32. package/dist/src/generated/EdgeBoundRow.d.ts +13 -0
  33. package/dist/src/generated/EdgeBoundRow.js +2 -0
  34. package/dist/src/generated/EmbeddedMember.d.ts +45 -0
  35. package/dist/src/generated/EmbeddedMember.js +1 -0
  36. package/dist/src/generated/EmbeddedMemberCollectionEntry.d.ts +21 -0
  37. package/dist/src/generated/EmbeddedMemberCollectionEntry.js +1 -0
  38. package/dist/src/generated/FeatureValue.d.ts +23 -0
  39. package/dist/src/generated/FeatureValue.js +1 -0
  40. package/dist/src/generated/Features.d.ts +82 -0
  41. package/dist/src/generated/Features.js +1 -0
  42. package/dist/src/generated/FencedBlock.d.ts +24 -0
  43. package/dist/src/generated/FencedBlock.js +2 -0
  44. package/dist/src/generated/IncludeRow.d.ts +18 -0
  45. package/dist/src/generated/IncludeRow.js +2 -0
  46. package/dist/src/generated/KindFactRow.d.ts +51 -0
  47. package/dist/src/generated/KindFactRow.js +1 -0
  48. package/dist/src/generated/LayoutRegionRow.d.ts +29 -0
  49. package/dist/src/generated/LayoutRegionRow.js +2 -0
  50. package/dist/src/generated/LayoutRow.d.ts +12 -0
  51. package/dist/src/generated/LayoutRow.js +1 -0
  52. package/dist/src/generated/MentionRow.d.ts +17 -0
  53. package/dist/src/generated/MentionRow.js +2 -0
  54. package/dist/src/generated/NestedMemberRow.d.ts +39 -0
  55. package/dist/src/generated/NestedMemberRow.js +1 -0
  56. package/dist/src/generated/Payload.d.ts +25 -0
  57. package/dist/src/generated/Payload.js +1 -0
  58. package/dist/src/generated/PayloadMember.d.ts +31 -0
  59. package/dist/src/generated/PayloadMember.js +2 -0
  60. package/dist/src/generated/RangeBoundRow.d.ts +15 -0
  61. package/dist/src/generated/RangeBoundRow.js +2 -0
  62. package/dist/src/generated/RequirementRow.d.ts +40 -0
  63. package/dist/src/generated/RequirementRow.js +1 -0
  64. package/dist/src/generated/SatisfiesRow.d.ts +14 -0
  65. package/dist/src/generated/SatisfiesRow.js +2 -0
  66. package/dist/src/generated/Section.d.ts +21 -0
  67. package/dist/src/generated/Section.js +2 -0
  68. package/dist/src/generated/SectionContainsRow.d.ts +14 -0
  69. package/dist/src/generated/SectionContainsRow.js +2 -0
  70. package/dist/src/generated/ValueType.d.ts +9 -0
  71. package/dist/src/generated/ValueType.js +2 -0
  72. package/dist/src/generated/index.d.ts +29 -0
  73. package/dist/src/generated/index.js +1 -0
  74. package/dist/src/index.d.ts +14 -18
  75. package/dist/src/index.js +10 -13
  76. package/dist/src/kind.d.ts +163 -41
  77. package/dist/src/kind.js +24 -24
  78. package/dist/src/needs.d.ts +8 -8
  79. package/dist/src/needs.js +7 -7
  80. package/dist/src/prose.d.ts +75 -28
  81. package/dist/src/prose.js +0 -0
  82. package/package.json +1 -1
  83. package/dist/src/genres.d.ts +0 -38
  84. package/dist/src/genres.js +0 -24
@@ -1,13 +1,15 @@
1
1
  /**
2
- * Prose — three constructors, one field type (`specs/architecture/20-surface.md`,
3
- * "Prose — three constructors, one field type"). A member's words are data the
2
+ * Prose — three constructors, one field type. A member's words are data the
4
3
  * member declares: `file()` for a document that keeps its medium, `` text`…` ``
5
- * for short inline prose, `blocks()` for fully composed genre values. Whatever
4
+ * for short inline prose, `blocks()` for fully composed embedded-member values. Whatever
6
5
  * the constructor, the words land byte-identical to their authored text (law 5).
7
- * Interpolations in `` text`…` `` are **mentions** — declared one-way edges,
8
- * authored per word, resolution-checked at emit, never mined (law 8).
6
+ * Interpolations in `` text`…` `` are references, two intents apart: a **mention**
7
+ * (a {@link Mentionable}) is a declared one-way edge that moves no content, and an
8
+ * **include** (an {@link Include}) pulls the target file's bytes into the host's emitted
9
+ * projection. Both are authored per word and resolution-checked at emit, never mined
10
+ * (law 8).
9
11
  */
10
- import type { GenreValue } from "./genres.js";
12
+ import type { EmbeddedMemberValue } from "./kind.js";
11
13
  /** A declared value a mention may name — the target of the one-way citation edge. */
12
14
  export interface Mentionable {
13
15
  /** The mention's rendered form and graph edge target (`kind:name` or a leaf address). */
@@ -21,14 +23,32 @@ export interface Mention {
21
23
  readonly target: Mentionable;
22
24
  }
23
25
  /**
24
- * `file(path)` — the document keeps its medium: markdown in a markdown file,
25
- * full tooling, forever legal (posture 1, `15-kinds.md`). Resolved and read in
26
- * byte-for-byte at emit.
26
+ * An include the author interpolates into `` text`…` `` — it moves content, not a
27
+ * citation: at emit the engine pulls the target file's bytes into the host's projection
28
+ * at this slot and fingerprints the dependency. The path resolves against the stating
29
+ * module ({@link moduleUrl}), never the workspace — the same anchor {@link file} takes.
30
+ */
31
+ export interface Include {
32
+ readonly kind: "include";
33
+ /** Path to the include target, resolved against {@link moduleUrl}. */
34
+ readonly path: string;
35
+ /** The declaring module's own `import.meta.url` — what {@link path} resolves against. */
36
+ readonly moduleUrl: string;
37
+ }
38
+ /** A `` text`…` `` interpolation — a mention (moves no content) or an include (moves content). */
39
+ export type Reference = Mentionable | Include;
40
+ /**
41
+ * `file(moduleUrl, path)` — the document keeps its medium: markdown in a
42
+ * markdown file, full tooling, forever legal (posture 1, `15-kinds.md`).
43
+ * Resolved and read in byte-for-byte at emit, relative to the declaring
44
+ * module, never the process cwd.
27
45
  */
28
46
  export interface File {
29
47
  readonly kind: "file";
30
- /** Module-relative path to the authored document. */
48
+ /** Path to the authored document, resolved against {@link moduleUrl}. */
31
49
  readonly path: string;
50
+ /** The declaring module's own `import.meta.url` — what {@link path} resolves against. */
51
+ readonly moduleUrl: string;
32
52
  }
33
53
  /**
34
54
  * `` text`…` `` — short prose inline, dedented, byte-deterministic; the
@@ -37,38 +57,54 @@ export interface File {
37
57
  */
38
58
  export interface Text {
39
59
  readonly kind: "text";
40
- /** The dedented authored text with one {@link MENTION_SLOT} per mention, in order. */
60
+ /**
61
+ * The dedented authored text with one {@link MENTION_SLOT} per mention and one
62
+ * {@link INCLUDE_SLOT} per include, each in authored order.
63
+ */
41
64
  readonly template: string;
42
65
  readonly mentions: readonly Mention[];
66
+ /** The includes riding beside the text, in authored order — one per {@link INCLUDE_SLOT}. */
67
+ readonly includes: readonly Include[];
43
68
  }
44
69
  /**
45
- * `blocks(…)` — fully composed genre values (posture 3): typed collections whose
46
- * emitted document is pure render, byte-identical to the same values authored as
47
- * fences (posture 2). The shared fence format is `(genre-fence-format)`, deferred
48
- * until its first consumer lands (`15-kinds.md`), so a `blocks()` body composes
49
- * now and renders when the pilot does — emit refuses to project one until then,
50
- * never guessing a format.
70
+ * `blocks(…)` — fully composed embedded-member values (posture 3): typed
71
+ * collections rendered to `member.<kind> <key>` TOML fences, byte-identical to
72
+ * the same values authored as fences directly (posture 2) and read back by the
73
+ * engine's fold (`src/extract.rs` `parse_embedded_info`/`parse_embedded_member`).
51
74
  */
52
75
  export interface Blocks {
53
76
  readonly kind: "blocks";
54
- readonly values: readonly GenreValue[];
77
+ readonly values: readonly EmbeddedMemberValue[];
55
78
  }
56
79
  /** A member's prose — one of the three constructors, one field type. */
57
80
  export type Prose = File | Text | Blocks;
58
- /** Declare a document whose medium is preserved — read in whole at emit (posture 1). */
59
- export declare function file(path: string): File;
60
81
  /**
61
- * The inline dedenting prose constructor. Interpolate only {@link Mentionable}
62
- * values — each interpolation is a mention, opt-in per word; plain prose with
63
- * zero mentions is fully legal forever (the opt-in Decision, `20-surface.md`).
82
+ * Declare a document whose medium is preserved — read in whole at emit
83
+ * (posture 1). `moduleUrl` is the declaring module's own `import.meta.url`,
84
+ * so `path` resolves relative to that module, never the process cwd:
85
+ * `file(import.meta.url, "./long.md")`.
86
+ */
87
+ export declare function file(moduleUrl: string, path: string): File;
88
+ /**
89
+ * The inline dedenting prose constructor. Interpolate {@link Reference} values — a
90
+ * {@link Mentionable} is a mention (moves no content), an {@link Include} pulls the
91
+ * target's bytes in; either is opt-in per word, and plain prose with zero references is
92
+ * fully legal forever (the opt-in Decision, `20-surface.md`).
64
93
  *
65
94
  * # Throws
66
- * If an authored chunk contains {@link MENTION_SLOT} — the marker must be the
67
- * tool's alone, so a stray NUL is a loud authoring error, not a silent mis-split.
95
+ * If an authored chunk carries {@link MENTION_SLOT} or {@link INCLUDE_SLOT} — the markers
96
+ * are the tool's alone, so a stray one is a loud authoring error, not a silent mis-split.
68
97
  */
69
- export declare function text(strings: TemplateStringsArray, ...targets: Mentionable[]): Text;
70
- /** Compose fully-typed genre values into a member's body (posture 3). */
71
- export declare function blocks(...values: GenreValue[]): Blocks;
98
+ export declare function text(strings: TemplateStringsArray, ...targets: Reference[]): Text;
99
+ /**
100
+ * Declare an include target — its bytes are pulled into the host's projection at emit,
101
+ * a dependency the lock fingerprints. `moduleUrl` is the declaring module's own
102
+ * `import.meta.url`, so `path` resolves relative to that module, never the process cwd:
103
+ * `include(import.meta.url, "./fragment.md")`.
104
+ */
105
+ export declare function include(moduleUrl: string, path: string): Include;
106
+ /** Compose fully-typed embedded-member values into a member's body (posture 3). */
107
+ export declare function blocks(...values: EmbeddedMemberValue[]): Blocks;
72
108
  /**
73
109
  * Render an inline body to its final text — the display rule applied: each
74
110
  * mention slot becomes its target's display form, the surrounding words
@@ -76,3 +112,14 @@ export declare function blocks(...values: GenreValue[]): Blocks;
76
112
  * construction, so the walk consumes every slot.
77
113
  */
78
114
  export declare function renderText(prose: Text): string;
115
+ /**
116
+ * Resolve a leaf's authored value to its stored/rendered string: a bare string
117
+ * is unchanged; a `Text` leaf is mention-resolution-checked against
118
+ * `mentionable` (loud on a dangling address) and rendered by {@link renderText}
119
+ * — the same rule a member-level `Text` body resolves by. `context` prefixes
120
+ * the dangling-mention error so it names the leaf, not just the mention.
121
+ *
122
+ * # Throws
123
+ * If a mention names no declared value.
124
+ */
125
+ export declare function resolveLeaf(value: string | Text, mentionable: ReadonlySet<string>, context: string): string;
package/dist/src/prose.js CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dtmd/temper",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
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": {
@@ -1,38 +0,0 @@
1
- /**
2
- * Genre values — prose that declares its own anatomy (`specs/architecture/15-kinds.md`,
3
- * "A genre is a kind at the block locus"; ratified `specs/intent/00-intent.md`, the
4
- * genre Decision). A genre value's meaning-carrying fields are prose leaves —
5
- * authored strings, law-5 protected one by one — plus keyed sibling collections.
6
- * This constructor carries the **shape only**: any predicate over a genre value
7
- * is a clause some module ships, never here (`15-kinds.md`, the genre Decision).
8
- * There is no prescribed genre ontology — a corpus that argues differently
9
- * declares its own genres with the same machinery (`15-kinds.md`, "a genre is
10
- * a full kind, and genre checks are data, never engine").
11
- *
12
- * `genreValue()` is the posture-3 spelling — a fully composed value passed to
13
- * `blocks()` (`20-surface.md`). The byte-identical posture-2 fence render awaits
14
- * `(genre-fence-format)`, deferred until its first consumer lands.
15
- */
16
- /**
17
- * A genre value serialized whole: leaves are authored strings keyed by field
18
- * name; sibling collections are keyed at every level (`rejected."baked-projection"`),
19
- * never positional — leaf addresses are structural and keyed (`20-surface.md`,
20
- * the leaf-address Decision).
21
- */
22
- export interface GenreValue {
23
- /** The genre name — a project's own, never a built-in prescribed ontology. */
24
- readonly genre: string;
25
- /** The value's key — the identity a leaf address carries (`surface-authority`). */
26
- readonly key: string;
27
- /** Prose leaves: authored strings, law-5 protected one by one. */
28
- readonly leaves: Readonly<Record<string, string>>;
29
- /** Keyed sibling collections: collection → entry key → field → authored string. */
30
- readonly collections: Readonly<Record<string, Readonly<Record<string, Readonly<Record<string, string>>>>>>;
31
- }
32
- /** A project's own genre — the same machinery, an author-declared shape. */
33
- export declare function genreValue(init: {
34
- genre: string;
35
- key: string;
36
- leaves: Readonly<Record<string, string>>;
37
- collections?: GenreValue["collections"];
38
- }): GenreValue;
@@ -1,24 +0,0 @@
1
- /**
2
- * Genre values — prose that declares its own anatomy (`specs/architecture/15-kinds.md`,
3
- * "A genre is a kind at the block locus"; ratified `specs/intent/00-intent.md`, the
4
- * genre Decision). A genre value's meaning-carrying fields are prose leaves —
5
- * authored strings, law-5 protected one by one — plus keyed sibling collections.
6
- * This constructor carries the **shape only**: any predicate over a genre value
7
- * is a clause some module ships, never here (`15-kinds.md`, the genre Decision).
8
- * There is no prescribed genre ontology — a corpus that argues differently
9
- * declares its own genres with the same machinery (`15-kinds.md`, "a genre is
10
- * a full kind, and genre checks are data, never engine").
11
- *
12
- * `genreValue()` is the posture-3 spelling — a fully composed value passed to
13
- * `blocks()` (`20-surface.md`). The byte-identical posture-2 fence render awaits
14
- * `(genre-fence-format)`, deferred until its first consumer lands.
15
- */
16
- /** A project's own genre — the same machinery, an author-declared shape. */
17
- export function genreValue(init) {
18
- return {
19
- genre: init.genre,
20
- key: init.key,
21
- leaves: init.leaves,
22
- collections: init.collections ?? {},
23
- };
24
- }