@metaobjectsdev/sdk 0.20.15 → 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
|
|
334
|
-
`object.value`
|
|
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
|
-
|
|
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,27 +51,27 @@ 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`
|
|
54
|
-
|
|
55
|
-
The payload is **not** an entity — it's
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
`docs/features/source-kinds.md`, not here
|
|
70
|
-
|
|
71
|
-
Declaring the payload
|
|
72
|
-
|
|
73
|
-
|
|
54
|
+
## The payload is a shape you declare — an `object.value`, or a sourceless `object.projection`
|
|
55
|
+
|
|
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
|
|
61
|
+
**declared-type-authoritative (#270)**: a field's generated type comes only from its
|
|
62
|
+
declared `field.<subType>` + `isArray` + `@objectRef`, and a nested payload is a
|
|
63
|
+
declared `field.object @objectRef` to another `object.value` (`isArray: true` for a
|
|
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.
|
|
71
|
+
|
|
72
|
+
Declaring the payload shape is what makes payload bloat visible: adding a field to
|
|
73
|
+
the prompt is a diff on the declared shape, and `verify` catches template/payload
|
|
74
|
+
drift at build time instead of letting a prompt silently degrade.
|
|
74
75
|
|
|
75
76
|
```json
|
|
76
77
|
{
|
|
@@ -81,12 +82,10 @@ breaks the build instead of silently degrading the prompt.
|
|
|
81
82
|
"object.value": {
|
|
82
83
|
"name": "WelcomePayload",
|
|
83
84
|
"children": [
|
|
84
|
-
{ "field.string": { "name": "displayName",
|
|
85
|
-
|
|
86
|
-
{ "field.long": { "name": "postCount",
|
|
87
|
-
"children": [ { "origin.aggregate": { "@agg": "count", "@of": "Post.id", "@via": "Author.posts" } } ] } },
|
|
85
|
+
{ "field.string": { "name": "displayName" } },
|
|
86
|
+
{ "field.long": { "name": "postCount" } },
|
|
88
87
|
{ "field.object": { "name": "posts", "@objectRef": "PostSummary",
|
|
89
|
-
"
|
|
88
|
+
"isArray": true } }
|
|
90
89
|
]
|
|
91
90
|
}
|
|
92
91
|
},
|
|
@@ -94,8 +93,7 @@ breaks the build instead of silently degrading the prompt.
|
|
|
94
93
|
"object.value": {
|
|
95
94
|
"name": "PostSummary",
|
|
96
95
|
"children": [
|
|
97
|
-
{ "field.string": { "name": "title"
|
|
98
|
-
"children": [ { "origin.passthrough": { "@from": "Post.title" } } ] } }
|
|
96
|
+
{ "field.string": { "name": "title" } }
|
|
99
97
|
]
|
|
100
98
|
}
|
|
101
99
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metaobjectsdev/sdk",
|
|
3
|
-
"version": "0.
|
|
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.
|
|
59
|
+
"@metaobjectsdev/metadata": "0.21.0",
|
|
60
60
|
"zod": "^3.23.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|