@metaobjectsdev/metadata 0.21.5 → 0.22.0-rc.1

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 (60) hide show
  1. package/dist/core/requirement/meta-requirement.d.ts +23 -0
  2. package/dist/core/requirement/meta-requirement.d.ts.map +1 -0
  3. package/dist/core/requirement/meta-requirement.js +52 -0
  4. package/dist/core/requirement/meta-requirement.js.map +1 -0
  5. package/dist/core/requirement/requirement-constants.d.ts +35 -0
  6. package/dist/core/requirement/requirement-constants.d.ts.map +1 -0
  7. package/dist/core/requirement/requirement-constants.js +68 -0
  8. package/dist/core/requirement/requirement-constants.js.map +1 -0
  9. package/dist/core/requirement/requirement-definition.embedded.d.ts +3 -0
  10. package/dist/core/requirement/requirement-definition.embedded.d.ts.map +1 -0
  11. package/dist/core/requirement/requirement-definition.embedded.js +141 -0
  12. package/dist/core/requirement/requirement-definition.embedded.js.map +1 -0
  13. package/dist/core-types.d.ts.map +1 -1
  14. package/dist/core-types.js +27 -1
  15. package/dist/core-types.js.map +1 -1
  16. package/dist/errors.d.ts +1 -1
  17. package/dist/errors.d.ts.map +1 -1
  18. package/dist/errors.js +1 -0
  19. package/dist/errors.js.map +1 -1
  20. package/dist/index.d.ts +3 -0
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +7 -0
  23. package/dist/index.js.map +1 -1
  24. package/dist/naming.d.ts.map +1 -1
  25. package/dist/naming.js +9 -3
  26. package/dist/naming.js.map +1 -1
  27. package/dist/persistence/db/db-definition.embedded.d.ts.map +1 -1
  28. package/dist/persistence/db/db-definition.embedded.js +28 -0
  29. package/dist/persistence/db/db-definition.embedded.js.map +1 -1
  30. package/dist/registry.d.ts.map +1 -1
  31. package/dist/registry.js +28 -0
  32. package/dist/registry.js.map +1 -1
  33. package/dist/shared/base-types.d.ts +4 -1
  34. package/dist/shared/base-types.d.ts.map +1 -1
  35. package/dist/shared/base-types.js +4 -0
  36. package/dist/shared/base-types.js.map +1 -1
  37. package/dist/shared/node-guards.d.ts +24 -0
  38. package/dist/shared/node-guards.d.ts.map +1 -0
  39. package/dist/shared/node-guards.js +87 -0
  40. package/dist/shared/node-guards.js.map +1 -0
  41. package/dist/template/prompt-definition.embedded.d.ts.map +1 -1
  42. package/dist/template/prompt-definition.embedded.js +0 -276
  43. package/dist/template/prompt-definition.embedded.js.map +1 -1
  44. package/dist/template/template-definition.embedded.d.ts.map +1 -1
  45. package/dist/template/template-definition.embedded.js +267 -3
  46. package/dist/template/template-definition.embedded.js.map +1 -1
  47. package/package.json +1 -1
  48. package/src/core/requirement/meta-requirement.ts +69 -0
  49. package/src/core/requirement/requirement-constants.ts +82 -0
  50. package/src/core/requirement/requirement-definition.embedded.ts +148 -0
  51. package/src/core-types.ts +30 -0
  52. package/src/errors.ts +1 -0
  53. package/src/index.ts +15 -0
  54. package/src/naming.ts +10 -4
  55. package/src/persistence/db/db-definition.embedded.ts +28 -0
  56. package/src/registry.ts +34 -0
  57. package/src/shared/base-types.ts +4 -0
  58. package/src/shared/node-guards.ts +96 -0
  59. package/src/template/prompt-definition.embedded.ts +0 -276
  60. package/src/template/template-definition.embedded.ts +267 -3
@@ -102,282 +102,6 @@ export const PROMPT_DEFINITION: ProviderDefinition = {
102
102
  "description": "ASCII normalization mode for tolerant enum extract (none|collapse|strip, default strip). On field.enum it is per-field; on object.value it is the default for the object's enum fields."
103
103
  }
104
104
  ]
105
- },
106
- {
107
- "type": "template",
108
- "subType": "prompt",
109
- "children": [
110
- {
111
- "type": "attr",
112
- "subType": "string",
113
- "name": "payloadRef",
114
- "min": 1,
115
- "max": 1,
116
- "description": "Reference to the payload (a view-object / projection) this template renders against."
117
- },
118
- {
119
- "type": "attr",
120
- "subType": "string",
121
- "name": "textRef",
122
- "min": 0,
123
- "max": 1,
124
- "description": "2-layer logical reference (group/source) to the body text, resolved by a provider at render time."
125
- },
126
- {
127
- "type": "attr",
128
- "subType": "string",
129
- "name": "format",
130
- "min": 0,
131
- "max": 1,
132
- "default": "text",
133
- "allowedValues": [
134
- "text",
135
- "html",
136
- "xml",
137
- "csv",
138
- "json",
139
- "markdown",
140
- "spreadsheet"
141
- ],
142
- "description": "Output format; drives the render engine's escaping/whitespace behavior."
143
- },
144
- {
145
- "type": "attr",
146
- "subType": "int",
147
- "name": "maxChars",
148
- "min": 0,
149
- "max": 1,
150
- "description": "Size budget for the rendered output, in characters."
151
- },
152
- {
153
- "type": "attr",
154
- "subType": "string",
155
- "name": "owner",
156
- "min": 0,
157
- "max": 1,
158
- "description": "Governance: the owner of this template."
159
- },
160
- {
161
- "type": "attr",
162
- "subType": "string",
163
- "name": "since",
164
- "min": 0,
165
- "max": 1,
166
- "description": "Governance: the version this template was introduced in."
167
- },
168
- {
169
- "type": "attr",
170
- "subType": "string",
171
- "name": "requiredTags",
172
- "isArray": true,
173
- "min": 0,
174
- "max": 1,
175
- "description": "Output tags the rendered text must contain (drives the verify output-tag check)."
176
- },
177
- {
178
- "type": "attr",
179
- "subType": "int",
180
- "name": "maxTokens",
181
- "min": 0,
182
- "max": 1,
183
- "description": "Token budget for the rendered prompt (LLM-specific)."
184
- },
185
- {
186
- "type": "attr",
187
- "subType": "string",
188
- "name": "requiredSlots",
189
- "isArray": true,
190
- "min": 0,
191
- "max": 1,
192
- "description": "Slots that must resolve at render time (drives the verify check)."
193
- },
194
- {
195
- "type": "attr",
196
- "subType": "string",
197
- "name": "model",
198
- "min": 0,
199
- "max": 1,
200
- "description": "Target model id (LLM-specific)."
201
- },
202
- {
203
- "type": "attr",
204
- "subType": "string",
205
- "name": "responseRef",
206
- "min": 0,
207
- "max": 1,
208
- "description": "Optional ref to the response value-object this prompt expects (peer of @payloadRef; drives typed LLM-call trace derivation)."
209
- }
210
- ]
211
- },
212
- {
213
- "type": "template",
214
- "subType": "output",
215
- "children": [
216
- {
217
- "type": "attr",
218
- "subType": "string",
219
- "name": "payloadRef",
220
- "min": 1,
221
- "max": 1,
222
- "description": "Reference to the payload (a view-object / projection) this template renders against."
223
- },
224
- {
225
- "type": "attr",
226
- "subType": "string",
227
- "name": "textRef",
228
- "min": 0,
229
- "max": 1,
230
- "description": "2-layer logical reference (group/source) to the body text, resolved by a provider at render time."
231
- },
232
- {
233
- "type": "attr",
234
- "subType": "string",
235
- "name": "format",
236
- "min": 0,
237
- "max": 1,
238
- "default": "text",
239
- "allowedValues": [
240
- "text",
241
- "html",
242
- "xml",
243
- "csv",
244
- "json",
245
- "markdown",
246
- "spreadsheet"
247
- ],
248
- "description": "Output format; drives the render engine's escaping/whitespace behavior."
249
- },
250
- {
251
- "type": "attr",
252
- "subType": "int",
253
- "name": "maxChars",
254
- "min": 0,
255
- "max": 1,
256
- "description": "Size budget for the rendered output, in characters."
257
- },
258
- {
259
- "type": "attr",
260
- "subType": "string",
261
- "name": "owner",
262
- "min": 0,
263
- "max": 1,
264
- "description": "Governance: the owner of this template."
265
- },
266
- {
267
- "type": "attr",
268
- "subType": "string",
269
- "name": "since",
270
- "min": 0,
271
- "max": 1,
272
- "description": "Governance: the version this template was introduced in."
273
- },
274
- {
275
- "type": "attr",
276
- "subType": "string",
277
- "name": "requiredTags",
278
- "isArray": true,
279
- "min": 0,
280
- "max": 1,
281
- "description": "Output tags the rendered text must contain (drives the verify output-tag check)."
282
- },
283
- {
284
- "type": "attr",
285
- "subType": "string",
286
- "name": "promptStyle",
287
- "min": 0,
288
- "max": 1,
289
- "default": "guide",
290
- "allowedValues": [
291
- "guide",
292
- "inline",
293
- "exampleOnly"
294
- ],
295
- "description": "FR-010 output-format prompt presentation: 'guide' (prose list + example), 'inline' (inline placeholders / enum choices), or 'exampleOnly' (filled skeleton). Guidance is never emitted as comments."
296
- },
297
- {
298
- "type": "attr",
299
- "subType": "string",
300
- "name": "kind",
301
- "min": 0,
302
- "max": 1,
303
- "default": "document",
304
- "allowedValues": [
305
- "document",
306
- "email"
307
- ],
308
- "description": "Output shape: 'document' (renders @textRef in @format → one string) or 'email' (renders subject + html + optional text → a structured EmailDocument)."
309
- },
310
- {
311
- "type": "attr",
312
- "subType": "string",
313
- "name": "subjectRef",
314
- "min": 0,
315
- "max": 1,
316
- "description": "Email only: 2-layer logical reference (group/source) to the subject-line text. Required when @kind=\"email\"."
317
- },
318
- {
319
- "type": "attr",
320
- "subType": "string",
321
- "name": "htmlBodyRef",
322
- "min": 0,
323
- "max": 1,
324
- "description": "Email only: 2-layer logical reference (group/source) to the HTML body text. Required when @kind=\"email\"."
325
- },
326
- {
327
- "type": "attr",
328
- "subType": "string",
329
- "name": "textBodyRef",
330
- "min": 0,
331
- "max": 1,
332
- "description": "Email only: 2-layer logical reference (group/source) to the optional plain-text alternative body."
333
- }
334
- ]
335
- },
336
- {
337
- "type": "template",
338
- "subType": "toolcall",
339
- "children": [
340
- {
341
- "type": "attr",
342
- "subType": "string",
343
- "name": "toolName",
344
- "min": 1,
345
- "max": 1,
346
- "description": "Wire tool name surfaced to the LLM (vendor-specific format)."
347
- },
348
- {
349
- "type": "attr",
350
- "subType": "string",
351
- "name": "payloadRef",
352
- "min": 1,
353
- "max": 1,
354
- "description": "Output value-object the tool produces (resolved against the metamodel)."
355
- },
356
- {
357
- "type": "attr",
358
- "subType": "string",
359
- "name": "owner",
360
- "min": 0,
361
- "max": 1,
362
- "description": "Governance: the owner of this toolcall."
363
- },
364
- {
365
- "type": "attr",
366
- "subType": "string",
367
- "name": "since",
368
- "min": 0,
369
- "max": 1,
370
- "description": "Governance: the version this toolcall was introduced in."
371
- },
372
- {
373
- "type": "attr",
374
- "subType": "int",
375
- "name": "maxTokens",
376
- "min": 0,
377
- "max": 1,
378
- "description": "Per-call token budget for the tool-call's structured response (LLM-specific). Vendor-agnostic config; peer of @maxTokens on template.prompt (#237)."
379
- }
380
- ]
381
105
  }
382
106
  ]
383
107
  };
@@ -20,20 +20,284 @@ export const TEMPLATE_DEFINITION: ProviderDefinition = {
20
20
  "subType": "prompt",
21
21
  "description": "An LLM-targeted renderable prompt template (FR-004). Carries the generic reference + governance attrs plus the LLM overlay (@maxTokens / @requiredSlots / @model / @responseRef). Its renderable body is required via @textRef.",
22
22
  "whenToUse": "You are sending text to an LLM. Declare a prompt template with a typed payload so the prompt is versioned, drift-checked against its fields, and cache-stable — instead of string-building it in code.",
23
- "rules": "prompt requires @payloadRef (the typed payload it renders against) AND @textRef (the body text, provider-resolved at render time — enforced in the loader's validateTemplatePayloadRefs pass, not at the attr layer where @textRef is relaxed to optional so template.output email can omit it). @format is a closed enum keyed by the render engine's escaper. @responseRef (optional) names the response value-object the prompt expects and drives typed LLM-call trace derivation."
23
+ "rules": "prompt requires @payloadRef (the typed payload it renders against) AND @textRef (the body text, provider-resolved at render time — enforced in the loader's validateTemplatePayloadRefs pass, not at the attr layer where @textRef is relaxed to optional so template.output email can omit it). @format is a closed enum keyed by the render engine's escaper. @responseRef (optional) names the response value-object the prompt expects and drives typed LLM-call trace derivation.",
24
+ "children": [
25
+ {
26
+ "type": "attr",
27
+ "subType": "string",
28
+ "name": "payloadRef",
29
+ "min": 1,
30
+ "max": 1,
31
+ "description": "Reference to the payload (a view-object / projection) this template renders against."
32
+ },
33
+ {
34
+ "type": "attr",
35
+ "subType": "string",
36
+ "name": "textRef",
37
+ "min": 0,
38
+ "max": 1,
39
+ "description": "2-layer logical reference (group/source) to the body text, resolved by a provider at render time."
40
+ },
41
+ {
42
+ "type": "attr",
43
+ "subType": "string",
44
+ "name": "format",
45
+ "min": 0,
46
+ "max": 1,
47
+ "default": "text",
48
+ "allowedValues": [
49
+ "text",
50
+ "html",
51
+ "xml",
52
+ "csv",
53
+ "json",
54
+ "markdown",
55
+ "spreadsheet"
56
+ ],
57
+ "description": "Output format; drives the render engine's escaping/whitespace behavior."
58
+ },
59
+ {
60
+ "type": "attr",
61
+ "subType": "int",
62
+ "name": "maxChars",
63
+ "min": 0,
64
+ "max": 1,
65
+ "description": "Size budget for the rendered output, in characters."
66
+ },
67
+ {
68
+ "type": "attr",
69
+ "subType": "string",
70
+ "name": "owner",
71
+ "min": 0,
72
+ "max": 1,
73
+ "description": "Governance: the owner of this template."
74
+ },
75
+ {
76
+ "type": "attr",
77
+ "subType": "string",
78
+ "name": "since",
79
+ "min": 0,
80
+ "max": 1,
81
+ "description": "Governance: the version this template was introduced in."
82
+ },
83
+ {
84
+ "type": "attr",
85
+ "subType": "string",
86
+ "name": "requiredTags",
87
+ "isArray": true,
88
+ "min": 0,
89
+ "max": 1,
90
+ "description": "Output tags the rendered text must contain (drives the verify output-tag check)."
91
+ },
92
+ {
93
+ "type": "attr",
94
+ "subType": "int",
95
+ "name": "maxTokens",
96
+ "min": 0,
97
+ "max": 1,
98
+ "description": "Token budget for the rendered prompt (LLM-specific)."
99
+ },
100
+ {
101
+ "type": "attr",
102
+ "subType": "string",
103
+ "name": "requiredSlots",
104
+ "isArray": true,
105
+ "min": 0,
106
+ "max": 1,
107
+ "description": "Slots that must resolve at render time (drives the verify check)."
108
+ },
109
+ {
110
+ "type": "attr",
111
+ "subType": "string",
112
+ "name": "model",
113
+ "min": 0,
114
+ "max": 1,
115
+ "description": "Target model id (LLM-specific)."
116
+ },
117
+ {
118
+ "type": "attr",
119
+ "subType": "string",
120
+ "name": "responseRef",
121
+ "min": 0,
122
+ "max": 1,
123
+ "description": "Optional ref to the response value-object this prompt expects (peer of @payloadRef; drives typed LLM-call trace derivation)."
124
+ }
125
+ ]
24
126
  },
25
127
  {
26
128
  "type": "template",
27
129
  "subType": "output",
28
130
  "description": "An output / serialization template (FR-004): every rendered artifact other than an LLM prompt — a document (email, export, docs, config) or an email. Carries the generic reference + governance attrs, the FR-010 @promptStyle, and the @kind + email part-refs.",
29
131
  "whenToUse": "You render a document/email/serialized output from typed data. Declare an output template so the {{fields}} are drift-checked against the payload VO at build time.",
30
- "rules": "output is either a document (@kind=\"document\" or absent → renders @textRef in @format to one string) or an email (@kind=\"email\" → renders subject + html + optional text to a structured EmailDocument). The cross-field presence rule is enforced in the loader's validateTemplatePayloadRefs pass: document requires @textRef; email requires @subjectRef AND @htmlBodyRef (with @textBodyRef optional) and carries NO @textRef. @format is a closed enum keyed by the render engine's escaper; @promptStyle (FR-010) selects the output-format prompt presentation and is never emitted as comments."
132
+ "rules": "output is either a document (@kind=\"document\" or absent → renders @textRef in @format to one string) or an email (@kind=\"email\" → renders subject + html + optional text to a structured EmailDocument). The cross-field presence rule is enforced in the loader's validateTemplatePayloadRefs pass: document requires @textRef; email requires @subjectRef AND @htmlBodyRef (with @textBodyRef optional) and carries NO @textRef. @format is a closed enum keyed by the render engine's escaper; @promptStyle (FR-010) selects the output-format prompt presentation and is never emitted as comments.",
133
+ "children": [
134
+ {
135
+ "type": "attr",
136
+ "subType": "string",
137
+ "name": "payloadRef",
138
+ "min": 1,
139
+ "max": 1,
140
+ "description": "Reference to the payload (a view-object / projection) this template renders against."
141
+ },
142
+ {
143
+ "type": "attr",
144
+ "subType": "string",
145
+ "name": "textRef",
146
+ "min": 0,
147
+ "max": 1,
148
+ "description": "2-layer logical reference (group/source) to the body text, resolved by a provider at render time."
149
+ },
150
+ {
151
+ "type": "attr",
152
+ "subType": "string",
153
+ "name": "format",
154
+ "min": 0,
155
+ "max": 1,
156
+ "default": "text",
157
+ "allowedValues": [
158
+ "text",
159
+ "html",
160
+ "xml",
161
+ "csv",
162
+ "json",
163
+ "markdown",
164
+ "spreadsheet"
165
+ ],
166
+ "description": "Output format; drives the render engine's escaping/whitespace behavior."
167
+ },
168
+ {
169
+ "type": "attr",
170
+ "subType": "int",
171
+ "name": "maxChars",
172
+ "min": 0,
173
+ "max": 1,
174
+ "description": "Size budget for the rendered output, in characters."
175
+ },
176
+ {
177
+ "type": "attr",
178
+ "subType": "string",
179
+ "name": "owner",
180
+ "min": 0,
181
+ "max": 1,
182
+ "description": "Governance: the owner of this template."
183
+ },
184
+ {
185
+ "type": "attr",
186
+ "subType": "string",
187
+ "name": "since",
188
+ "min": 0,
189
+ "max": 1,
190
+ "description": "Governance: the version this template was introduced in."
191
+ },
192
+ {
193
+ "type": "attr",
194
+ "subType": "string",
195
+ "name": "requiredTags",
196
+ "isArray": true,
197
+ "min": 0,
198
+ "max": 1,
199
+ "description": "Output tags the rendered text must contain (drives the verify output-tag check)."
200
+ },
201
+ {
202
+ "type": "attr",
203
+ "subType": "string",
204
+ "name": "promptStyle",
205
+ "min": 0,
206
+ "max": 1,
207
+ "default": "guide",
208
+ "allowedValues": [
209
+ "guide",
210
+ "inline",
211
+ "exampleOnly"
212
+ ],
213
+ "description": "FR-010 output-format prompt presentation: 'guide' (prose list + example), 'inline' (inline placeholders / enum choices), or 'exampleOnly' (filled skeleton). Guidance is never emitted as comments."
214
+ },
215
+ {
216
+ "type": "attr",
217
+ "subType": "string",
218
+ "name": "kind",
219
+ "min": 0,
220
+ "max": 1,
221
+ "default": "document",
222
+ "allowedValues": [
223
+ "document",
224
+ "email"
225
+ ],
226
+ "description": "Output shape: 'document' (renders @textRef in @format → one string) or 'email' (renders subject + html + optional text → a structured EmailDocument)."
227
+ },
228
+ {
229
+ "type": "attr",
230
+ "subType": "string",
231
+ "name": "subjectRef",
232
+ "min": 0,
233
+ "max": 1,
234
+ "description": "Email only: 2-layer logical reference (group/source) to the subject-line text. Required when @kind=\"email\"."
235
+ },
236
+ {
237
+ "type": "attr",
238
+ "subType": "string",
239
+ "name": "htmlBodyRef",
240
+ "min": 0,
241
+ "max": 1,
242
+ "description": "Email only: 2-layer logical reference (group/source) to the HTML body text. Required when @kind=\"email\"."
243
+ },
244
+ {
245
+ "type": "attr",
246
+ "subType": "string",
247
+ "name": "textBodyRef",
248
+ "min": 0,
249
+ "max": 1,
250
+ "description": "Email only: 2-layer logical reference (group/source) to the optional plain-text alternative body."
251
+ }
252
+ ]
31
253
  },
32
254
  {
33
255
  "type": "template",
34
256
  "subType": "toolcall",
35
257
  "description": "A vendor-agnostic LLM tool-call envelope (ADR-0011). Unlike prompt/output it has NO renderable text body — the body IS the structured output schema resolved via @payloadRef. This is why toolcall is its own subtype rather than template.output + @toolName. Does NOT inherit the generic attrs.",
36
- "rules": "toolcall requires @toolName (the wire tool name surfaced to the LLM) AND @payloadRef (the output value-object the tool produces). @textRef is intentionally absent — a tool-call has no renderable text. Core keeps toolcall vendor-agnostic; vendor wire details (retry semantics, fallback shapes, parallel invocation, cache hints) are added by consumer providers via registry.extend(TYPE_TEMPLATE, \"toolcall\", { attributes: [...] }). The LLM-facing tool description reuses the @description documentation common attr (added to every type by docProvider), so it is not redeclared here."
258
+ "rules": "toolcall requires @toolName (the wire tool name surfaced to the LLM) AND @payloadRef (the output value-object the tool produces). @textRef is intentionally absent — a tool-call has no renderable text. Core keeps toolcall vendor-agnostic; vendor wire details (retry semantics, fallback shapes, parallel invocation, cache hints) are added by consumer providers via registry.extend(TYPE_TEMPLATE, \"toolcall\", { attributes: [...] }). The LLM-facing tool description reuses the @description documentation common attr (added to every type by docProvider), so it is not redeclared here.",
259
+ "children": [
260
+ {
261
+ "type": "attr",
262
+ "subType": "string",
263
+ "name": "toolName",
264
+ "min": 1,
265
+ "max": 1,
266
+ "description": "Wire tool name surfaced to the LLM (vendor-specific format)."
267
+ },
268
+ {
269
+ "type": "attr",
270
+ "subType": "string",
271
+ "name": "payloadRef",
272
+ "min": 1,
273
+ "max": 1,
274
+ "description": "Output value-object the tool produces (resolved against the metamodel)."
275
+ },
276
+ {
277
+ "type": "attr",
278
+ "subType": "string",
279
+ "name": "owner",
280
+ "min": 0,
281
+ "max": 1,
282
+ "description": "Governance: the owner of this toolcall."
283
+ },
284
+ {
285
+ "type": "attr",
286
+ "subType": "string",
287
+ "name": "since",
288
+ "min": 0,
289
+ "max": 1,
290
+ "description": "Governance: the version this toolcall was introduced in."
291
+ },
292
+ {
293
+ "type": "attr",
294
+ "subType": "int",
295
+ "name": "maxTokens",
296
+ "min": 0,
297
+ "max": 1,
298
+ "description": "Per-call token budget for the tool-call's structured response (LLM-specific). Vendor-agnostic config; peer of @maxTokens on template.prompt (#237)."
299
+ }
300
+ ]
37
301
  }
38
302
  ]
39
303
  };