@metaobjectsdev/sdk 0.20.16 → 0.21.0

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.
@@ -330,8 +330,12 @@ Per finding: `file:line` → what → generated-equivalent exists? → recommend
330
330
  ## Prompt anti-patterns (hunt per site; classify: fully-modeled / partial / fully-inline)
331
331
 
332
332
  - Inline prompt strings (triple-quoted / template-literal constants in service code).
333
- - Untyped payloads (`str.format(**dict)` / f-strings / ad-hoc dicts) — payload should be an
334
- `object.value` with `origin.*` (`passthrough` / `aggregate` / `collection`) fields.
333
+ - Untyped payloads (`str.format(**dict)` / f-strings / ad-hoc dicts) — payload should be a declared
334
+ shape: an `object.value` (caller-supplied fields; `origin.passthrough` only FR-015 parameter
335
+ lineage) or, when fields derive by `aggregate` / `collection` / `computed` / `first`, a
336
+ **sourceless `object.projection`** carrying those origins (#210 — assembly origins on an
337
+ `object.value` fail load with `ERR_SUBTYPE_RULE_VIOLATION`; `@payloadRef` accepts the sourceless
338
+ projection).
335
339
  - Silent-degradation hack (`try/except KeyError` or `?? ''` around formatting) — flag every instance.
336
340
  - Hand-rolled output parsing (regex / XML / ad-hoc JSON) vs declared `template.output` +
337
341
  generated `parse*` / `safeParse*` / `extract*` parser — **generated in all five ports**
@@ -28,7 +28,7 @@ Both carry the generic attrs:
28
28
 
29
29
  | Attr | Required | Purpose |
30
30
  |---|---|---|
31
- | `@payloadRef` | yes | the `object.value` declaring the payload shape |
31
+ | `@payloadRef` | yes | the `object.value` — or sourceless `object.projection` (#210) — declaring the payload shape |
32
32
  | `@textRef` | yes for `template.prompt` and a `template.output @kind: document` (the default) — a `template.output @kind: email` carries **no** `@textRef`; it uses `@subjectRef` + `@htmlBodyRef` (+ optional `@textBodyRef`) instead | the 2-layer logical text reference `group/source`, resolved by a provider |
33
33
  | `@format` | no | `text` (default) / `html` / `xml` / `csv` / `json` / `markdown` / `spreadsheet` — drives the escaper |
34
34
  | `@maxChars` | no | build-time size budget |
@@ -41,7 +41,8 @@ selects how the output-format prompt fragment presents the payload shape to an L
41
41
  (see "the output-format prompt fragment" below); `@requiredTags` names output tags
42
42
  the rendered text must contain (`verify` checks it) on both subtypes.
43
43
  `template.prompt` additionally carries `@responseRef` — naming the response
44
- value-object the prompt expects, for typed LLM-call trace derivation.
44
+ shape (an `object.value` or sourceless `object.projection`, #210) the prompt
45
+ expects, for typed LLM-call trace derivation.
45
46
 
46
47
  A third, structurally different subtype is also registered core vocabulary:
47
48
  **`template.toolcall`** (`@toolName` + `@payloadRef`, ADR-0011) — a vendor-agnostic
@@ -50,21 +51,26 @@ LLM tool-call envelope with no renderable text body (the body IS the
50
51
  `@format` attrs above). The vocabulary exists today; MCP exposure of declared
51
52
  prompts/tools is roadmap, not shipped — don't promise it.
52
53
 
53
- ## The payload is an `object.value` you declare
54
+ ## The payload is a shape you declare — an `object.value`, or a sourceless `object.projection`
54
55
 
55
- The payload is **not** an entity — it's an `object.value` whose DECLARED fields ARE
56
- the prompt's typed shape. Every port's payload codegen is
56
+ The payload is **not** an entity — it's a declared shape whose fields ARE the
57
+ prompt's typed surface: an `object.value` (caller-supplied fields;
58
+ `origin.passthrough` only — FR-015 parameter lineage), or a **sourceless
59
+ `object.projection`** (#210 — no `source.*` child, own or inherited) when fields
60
+ derive by assembly. Every port's payload codegen is
57
61
  **declared-type-authoritative (#270)**: a field's generated type comes only from its
58
62
  declared `field.<subType>` + `isArray` + `@objectRef`, and a nested payload is a
59
63
  declared `field.object @objectRef` to another `object.value` (`isArray: true` for a
60
- list). The caller supplies the field values at render time. An `origin.*` child on a
61
- payload field is IGNORED for typing never author assembly origins (`aggregate` /
62
- `collection` / `computed` / `first`) on a payload VO. Derivation belongs to
63
- **projection** read models (`object.projection` over an entity), covered by the
64
- `metaobjects-authoring` skill and `docs/features/source-kinds.md`, not here.
64
+ list nested targets stay value-only, loader-enforced). The caller supplies the
65
+ field values at render time. An `origin.*` child on a payload field is IGNORED for
66
+ typing — and the assembly origins (`aggregate` / `collection` / `computed` /
67
+ `first`) are ILLEGAL on an `object.value` host (`ERR_SUBTYPE_RULE_VIOLATION`, #210):
68
+ an origin-derived payload lives on the sourceless projection, which `@payloadRef`
69
+ accepts. Projections generally are covered by the `metaobjects-authoring` skill and
70
+ `docs/features/source-kinds.md`, not here.
65
71
 
66
72
  Declaring the payload shape is what makes payload bloat visible: adding a field to
67
- the prompt is a diff on the `object.value`, and `verify` catches template/payload
73
+ the prompt is a diff on the declared shape, and `verify` catches template/payload
68
74
  drift at build time instead of letting a prompt silently degrade.
69
75
 
70
76
  ```json
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metaobjectsdev/sdk",
3
- "version": "0.20.16",
3
+ "version": "0.21.0",
4
4
  "description": "Workspace helpers and agent-docs utilities for MetaObjects projects.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -56,7 +56,7 @@
56
56
  "access": "public"
57
57
  },
58
58
  "dependencies": {
59
- "@metaobjectsdev/metadata": "0.20.16",
59
+ "@metaobjectsdev/metadata": "0.21.0",
60
60
  "zod": "^3.23.0"
61
61
  },
62
62
  "devDependencies": {