@aestheticfunction/dspack-gen 0.1.0 → 0.1.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.
- package/CHANGELOG.md +19 -0
- package/README.md +8 -6
- package/dist/core/generation-schema.js +13 -2
- package/package.json +1 -1
- package/src/core/generation-schema.ts +13 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.1 — generation-schema grammar alignment
|
|
4
|
+
|
|
5
|
+
Two fixes to the generation schema for grammar-constrained decoders
|
|
6
|
+
(Ollama structured outputs / llama.cpp grammars), which enforce the
|
|
7
|
+
schema's declared shapes and property order verbatim:
|
|
8
|
+
|
|
9
|
+
- Array-typed contract props now reach the schema as `{ type: "array" }`
|
|
10
|
+
(previously the string fallback), with an optional contract-declared
|
|
11
|
+
`items` schema passed through verbatim. The string fallback made the
|
|
12
|
+
grammar forbid the arrays models plan (e.g. table `columns`), measured
|
|
13
|
+
as malformed scalar props, abandoned subtrees, and emit-gate failures.
|
|
14
|
+
- Node properties are declared `component, id, props, text, children`
|
|
15
|
+
(previously `text` before `props`). Models and the worked examples
|
|
16
|
+
serialize `props` first; under order-enforcing grammars the old
|
|
17
|
+
declaration made node text unreachable once `props` was emitted —
|
|
18
|
+
measured as text-less nodes in every live generation.
|
|
19
|
+
|
|
20
|
+
Golden regenerated; no API changes.
|
|
21
|
+
|
|
3
22
|
## 0.1.0 — first public release
|
|
4
23
|
|
|
5
24
|
The generation and governance pipeline for dspack contracts, previously
|
package/README.md
CHANGED
|
@@ -10,12 +10,14 @@ produces a versioned audit report.
|
|
|
10
10
|
|
|
11
11
|
> *A2UI defines what can render. dspack defines what is correct.*
|
|
12
12
|
|
|
13
|
-
**Status: Milestones 1
|
|
14
|
-
[m1](https://github.com/aestheticfunction/dspack-gen/releases/tag/m1)
|
|
15
|
-
[m2](https://github.com/aestheticfunction/dspack-gen/releases/tag/m2)
|
|
16
|
-
[
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
**Status: Milestones 1 through 3 complete.** Tags
|
|
14
|
+
[m1](https://github.com/aestheticfunction/dspack-gen/releases/tag/m1),
|
|
15
|
+
[m2](https://github.com/aestheticfunction/dspack-gen/releases/tag/m2), and
|
|
16
|
+
[m3](https://github.com/aestheticfunction/dspack-gen/releases/tag/m3); write-ups in
|
|
17
|
+
[docs/m1-report.md](docs/m1-report.md), [docs/m2-report.md](docs/m2-report.md), and
|
|
18
|
+
[docs/m3-report.md](docs/m3-report.md), findings in
|
|
19
|
+
[docs/findings.md](docs/findings.md). M4 is trigger-gated on A2UI v1.0 leaving
|
|
20
|
+
Candidate status.
|
|
19
21
|
The emitter is consumed from npm as `@aestheticfunction/dspack-emit`
|
|
20
22
|
(renamed from `@aestheticfunction/dspack-to-a2ui` with the ADR-D2 repo
|
|
21
23
|
rename; the old package is deprecated with a pointer).
|
|
@@ -66,18 +66,29 @@ function componentProps(component) {
|
|
|
66
66
|
? { type: "boolean" }
|
|
67
67
|
: descriptor.type === "number"
|
|
68
68
|
? { type: "number" }
|
|
69
|
-
:
|
|
69
|
+
: descriptor.type === "array"
|
|
70
|
+
? // Array props must reach the grammar as arrays: the previous
|
|
71
|
+
// string fallback made grammar-constrained decoders (Ollama
|
|
72
|
+
// structured outputs) forbid the array the model plans,
|
|
73
|
+
// forcing malformed scalars or abandoned subtrees. An optional
|
|
74
|
+
// contract-declared `items` schema passes through verbatim.
|
|
75
|
+
{ type: "array", ...(descriptor.items !== undefined ? { items: descriptor.items } : {}) }
|
|
76
|
+
: { type: "string" };
|
|
70
77
|
}
|
|
71
78
|
return { type: "object", additionalProperties: false, properties };
|
|
72
79
|
}
|
|
73
80
|
function branch(id, props, level, depth) {
|
|
81
|
+
// Declaration order is load-bearing: grammar-constrained decoders enforce
|
|
82
|
+
// it verbatim. Models (and the worked examples) serialize `props` before
|
|
83
|
+
// `text`; declaring `text` first made node text unreachable once `props`
|
|
84
|
+
// was emitted — measured as text-less nodes in every live generation.
|
|
74
85
|
const properties = {
|
|
75
86
|
component: { const: id },
|
|
76
87
|
id: { type: "string" },
|
|
77
|
-
text: { type: "string" },
|
|
78
88
|
};
|
|
79
89
|
if (props)
|
|
80
90
|
properties.props = props;
|
|
91
|
+
properties.text = { type: "string" };
|
|
81
92
|
if (level < depth - 1) {
|
|
82
93
|
properties.children = { type: "array", items: { $ref: `#/$defs/node_${level + 1}` } };
|
|
83
94
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aestheticfunction/dspack-gen",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Generation + governance pipeline for dspack contracts: prompt/context compiler, surface gates S1\u2013S3, bounded repair, protocol emission, audit reports.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -80,18 +80,29 @@ function componentProps(component: ContractComponent): Json | null {
|
|
|
80
80
|
? { type: "boolean" }
|
|
81
81
|
: descriptor.type === "number"
|
|
82
82
|
? { type: "number" }
|
|
83
|
-
:
|
|
83
|
+
: descriptor.type === "array"
|
|
84
|
+
? // Array props must reach the grammar as arrays: the previous
|
|
85
|
+
// string fallback made grammar-constrained decoders (Ollama
|
|
86
|
+
// structured outputs) forbid the array the model plans,
|
|
87
|
+
// forcing malformed scalars or abandoned subtrees. An optional
|
|
88
|
+
// contract-declared `items` schema passes through verbatim.
|
|
89
|
+
{ type: "array", ...(descriptor.items !== undefined ? { items: descriptor.items as Json } : {}) }
|
|
90
|
+
: { type: "string" };
|
|
84
91
|
}
|
|
85
92
|
return { type: "object", additionalProperties: false, properties };
|
|
86
93
|
}
|
|
87
94
|
|
|
88
95
|
function branch(id: string, props: Json | null, level: number, depth: number): Json {
|
|
96
|
+
// Declaration order is load-bearing: grammar-constrained decoders enforce
|
|
97
|
+
// it verbatim. Models (and the worked examples) serialize `props` before
|
|
98
|
+
// `text`; declaring `text` first made node text unreachable once `props`
|
|
99
|
+
// was emitted — measured as text-less nodes in every live generation.
|
|
89
100
|
const properties: Json = {
|
|
90
101
|
component: { const: id },
|
|
91
102
|
id: { type: "string" },
|
|
92
|
-
text: { type: "string" },
|
|
93
103
|
};
|
|
94
104
|
if (props) properties.props = props;
|
|
105
|
+
properties.text = { type: "string" };
|
|
95
106
|
if (level < depth - 1) {
|
|
96
107
|
properties.children = { type: "array", items: { $ref: `#/$defs/node_${level + 1}` } };
|
|
97
108
|
}
|