@kumwe/studio-core 0.1.0-alpha.10

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 (104) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +86 -0
  3. package/THIRD_PARTY_NOTICES.md +9 -0
  4. package/dist/binding-projection.d.ts +47 -0
  5. package/dist/binding-projection.d.ts.map +1 -0
  6. package/dist/binding-projection.js +253 -0
  7. package/dist/binding-projection.js.map +1 -0
  8. package/dist/canonical.d.ts +20 -0
  9. package/dist/canonical.d.ts.map +1 -0
  10. package/dist/canonical.js +100 -0
  11. package/dist/canonical.js.map +1 -0
  12. package/dist/clone.d.ts +2 -0
  13. package/dist/clone.d.ts.map +1 -0
  14. package/dist/clone.js +4 -0
  15. package/dist/clone.js.map +1 -0
  16. package/dist/commands.d.ts +18 -0
  17. package/dist/commands.d.ts.map +1 -0
  18. package/dist/commands.js +799 -0
  19. package/dist/commands.js.map +1 -0
  20. package/dist/contributions.d.ts +93 -0
  21. package/dist/contributions.d.ts.map +1 -0
  22. package/dist/contributions.js +435 -0
  23. package/dist/contributions.js.map +1 -0
  24. package/dist/entry-commands.d.ts +3 -0
  25. package/dist/entry-commands.d.ts.map +1 -0
  26. package/dist/entry-commands.js +36 -0
  27. package/dist/entry-commands.js.map +1 -0
  28. package/dist/extension-sdk.d.ts +51 -0
  29. package/dist/extension-sdk.d.ts.map +1 -0
  30. package/dist/extension-sdk.js +260 -0
  31. package/dist/extension-sdk.js.map +1 -0
  32. package/dist/history.d.ts +22 -0
  33. package/dist/history.d.ts.map +1 -0
  34. package/dist/history.js +81 -0
  35. package/dist/history.js.map +1 -0
  36. package/dist/host-session.d.ts +74 -0
  37. package/dist/host-session.d.ts.map +1 -0
  38. package/dist/host-session.js +713 -0
  39. package/dist/host-session.js.map +1 -0
  40. package/dist/index.d.ts +23 -0
  41. package/dist/index.d.ts.map +1 -0
  42. package/dist/index.js +23 -0
  43. package/dist/index.js.map +1 -0
  44. package/dist/layout.d.ts +66 -0
  45. package/dist/layout.d.ts.map +1 -0
  46. package/dist/layout.js +240 -0
  47. package/dist/layout.js.map +1 -0
  48. package/dist/migrations.d.ts +47 -0
  49. package/dist/migrations.d.ts.map +1 -0
  50. package/dist/migrations.js +83 -0
  51. package/dist/migrations.js.map +1 -0
  52. package/dist/model-commands.d.ts +3 -0
  53. package/dist/model-commands.d.ts.map +1 -0
  54. package/dist/model-commands.js +21 -0
  55. package/dist/model-commands.js.map +1 -0
  56. package/dist/modes.d.ts +47 -0
  57. package/dist/modes.d.ts.map +1 -0
  58. package/dist/modes.js +280 -0
  59. package/dist/modes.js.map +1 -0
  60. package/dist/negotiation.d.ts +23 -0
  61. package/dist/negotiation.d.ts.map +1 -0
  62. package/dist/negotiation.js +65 -0
  63. package/dist/negotiation.js.map +1 -0
  64. package/dist/production-values.d.ts +12 -0
  65. package/dist/production-values.d.ts.map +1 -0
  66. package/dist/production-values.js +224 -0
  67. package/dist/production-values.js.map +1 -0
  68. package/dist/production.d.ts +86 -0
  69. package/dist/production.d.ts.map +1 -0
  70. package/dist/production.js +811 -0
  71. package/dist/production.js.map +1 -0
  72. package/dist/profile-validator.d.ts +47 -0
  73. package/dist/profile-validator.d.ts.map +1 -0
  74. package/dist/profile-validator.js +887 -0
  75. package/dist/profile-validator.js.map +1 -0
  76. package/dist/recipes.d.ts +15 -0
  77. package/dist/recipes.d.ts.map +1 -0
  78. package/dist/recipes.js +34 -0
  79. package/dist/recipes.js.map +1 -0
  80. package/dist/registry.d.ts +17 -0
  81. package/dist/registry.d.ts.map +1 -0
  82. package/dist/registry.js +56 -0
  83. package/dist/registry.js.map +1 -0
  84. package/dist/schema-profile.d.ts +27 -0
  85. package/dist/schema-profile.d.ts.map +1 -0
  86. package/dist/schema-profile.js +1015 -0
  87. package/dist/schema-profile.js.map +1 -0
  88. package/dist/semver.d.ts +20 -0
  89. package/dist/semver.d.ts.map +1 -0
  90. package/dist/semver.js +128 -0
  91. package/dist/semver.js.map +1 -0
  92. package/dist/session.d.ts +73 -0
  93. package/dist/session.d.ts.map +1 -0
  94. package/dist/session.js +191 -0
  95. package/dist/session.js.map +1 -0
  96. package/dist/url-policy.d.ts +45 -0
  97. package/dist/url-policy.d.ts.map +1 -0
  98. package/dist/url-policy.js +248 -0
  99. package/dist/url-policy.js.map +1 -0
  100. package/dist/validation.d.ts +13 -0
  101. package/dist/validation.d.ts.map +1 -0
  102. package/dist/validation.js +444 -0
  103. package/dist/validation.js.map +1 -0
  104. package/package.json +41 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kumwe Studio contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,86 @@
1
+ # `@kumwe/studio-core`
2
+
3
+ Status: pre-Gate-A foundation alpha. The implemented kernel does not claim production completeness.
4
+
5
+ The framework-neutral state engine for Studio. It registers versioned blocks, validates blueprint
6
+ documents, applies typed commands without mutating caller-owned data, and maintains bounded
7
+ undo/redo history.
8
+
9
+ The implemented surface covers:
10
+
11
+ - `applyCommand` / `invertCommand` — the deterministic reducers for the canonical command
12
+ vocabulary (insert, remove, move, duplicate with ID remapping, reorder, property set/unset with
13
+ responsive overrides, binding set/remove, and atomic batches), with computed inverse commands
14
+ verified against the published command vectors;
15
+ - `applyEntryCommand` — the locale-guarded `set-field-value` reducer for entries;
16
+ - `StudioSession` — bounded history behind fail-closed session guards (read-only state, session
17
+ generation, expected revision), dirty tracking, and a validated selection model;
18
+ - `openStudioSession` — capability-negotiated Blueprint loading and a headless host-session handle for
19
+ serialized optimistic saves, raw optional recovery-port access, read-only model `list`/`get`, bounded
20
+ resource search, stale-generation invalidation, and local idempotent disposal;
21
+ - `projectBlueprintFieldBindings` — an immutable exact-model projection of compatible block-port field
22
+ candidates, declared authoring controls and stable invalid-binding diagnostics;
23
+ - `ContributionRuntime` — owner-aware, transactional, schema-validated activation of block,
24
+ pattern, design-vocabulary, migration, inspector, and field-adapter payloads into kind-scoped
25
+ immutable generations, with disable, reactivate, trust-revocation, stale-generation refusal, and
26
+ inspectable unresolved contributions;
27
+ - `validateBlueprint` and `BlockRegistry` — schema, limit, lock, and registry validation with
28
+ stable diagnostics;
29
+ - `canonicalStringify` / `canonicalUtf8Bytes` — the canonical cross-language serialization form
30
+ used for checksums.
31
+ - `createCoreLayoutBlockDefinitions` / `resolveCoreLayoutIntent` — first-party section, stack, grid,
32
+ and columns definitions plus theme-validated responsive intent resolution, with no DOM or stored
33
+ CSS;
34
+ - `createCoreProductionBlockDefinitions` / `createCoreProductionPatterns` — the standalone 45-block
35
+ production catalog and ten portable starter compositions, including media, rich content,
36
+ progressive composites including dialogs, popovers, and notices, data display, and
37
+ host-authoritative resource/query projections;
38
+ - `coreProductionInitialProperties` — schema-valid defaults used by the Studio insertion path for
39
+ every first-party type;
40
+ - `parseStudioPresentationIntent` — the closed, CSS-free visual capability contract shared by all
41
+ first-party inspector surfaces and renderers;
42
+ - `compileStudioPropertySchema` / `assertStudioPropertySchema` — eval-free admission and validation
43
+ for the closed, local-only `studio.profile/schema-property` surface, with stable
44
+ `StudioSchemaProfileError` codes and schema pointers.
45
+
46
+ The package has no DOM dependency. Web Components, Flutter clients, command-line tools, and server
47
+ adapters can therefore share the same command and validation semantics through the protocol.
48
+
49
+ ## Blueprint host-session composition
50
+
51
+ `openStudioSession(hostAdapter, options)` consumes a complete, host-resolved `StudioConfiguration` from
52
+ `OpenStudioSessionOptions`. Its injected `StudioHostSessionIdentifierFactories` provide deterministic
53
+ `requestId(operationId)` and `idempotencyKey(operationId)` values. Opening requires
54
+ `mode: blueprint`, `composite: single`, either session state, and the configured Blueprint reference;
55
+ it passes the resolved Blueprint/read-only mode, session generation, resource context, locale,
56
+ protocol, and history limit through the headless lifecycle. It does not perform the host handshake,
57
+ automatically load model/theme dependencies, fabricate an artifact for model/content/hybrid
58
+ configuration, or provide a transport.
59
+
60
+ The returned handle serializes saves against the latest accepted host revision and coalesces matching
61
+ concurrent intents. An exact retry after failure retains its idempotency key. If the document changes
62
+ while a snapshot is saving, the success advances the accepted revision but the newer state remains
63
+ dirty. Every current, undo, and redo snapshot carries that accepted revision without a local state-version
64
+ change, so later history and exact preview staging use one coherent base. Conflicts and other refusals
65
+ preserve the document, history, selection, and saved baseline.
66
+
67
+ `StudioHostSessionHandle.recovery` is a `StudioHostSessionRecovery` with direct `store`, `load`, and
68
+ `discard` calls when the optional port is present, and is `undefined` otherwise. The core does not
69
+ synthesize or reconcile recovery envelopes. A
70
+ `studio.host/stale-session-generation` diagnostic invalidates the complete handle. `dispose()` is
71
+ local and idempotent and does not imply host teardown or preview cleanup. See
72
+ [ADR 0020](../../docs/decisions/0020-blueprint-host-session-composition.md) for the deliberate scope.
73
+
74
+ `StudioHostSessionHandle.models` is present only when the negotiated model port and adapter both implement
75
+ `list` and `get`. Results are canonical-schema validated, exact-coordinate checked and detached before they
76
+ leave the boundary; stale generation invalidates the whole handle. The surface is deliberately read-only.
77
+ Pass an authorized active model to `projectBlueprintFieldBindings(blueprint, model, definitions)` to derive
78
+ portable candidates and diagnostics without changing any input. See
79
+ [ADR 0024](../../docs/decisions/0024-read-only-model-binding-projection.md).
80
+
81
+ `StudioHostSessionHandle.resources` is present only when the negotiated resource port advertises
82
+ `studio.operation/resource.search` and the adapter implements it. `search` validates and clones bounded
83
+ queries before allocating a request, then accepts only detached pages whose stable, unique hit IDs and
84
+ qualified message references match the requested resource type. Malformed adapter output becomes a safe
85
+ `studio.host/unexpected-resource-result` failure. This is a read-only discovery surface: hosts still own
86
+ authorization and resolution, and first-party dynamic resource/query bindings remain read-only in Studio.
@@ -0,0 +1,9 @@
1
+ # Third-party notices
2
+
3
+ <!-- Generated by scripts/generate-third-party-notices.mjs. Do not edit by hand. -->
4
+
5
+ Package: `@kumwe/studio-core`
6
+
7
+ Production closure SHA-256: `4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945`
8
+
9
+ This package has no third-party runtime dependencies.
@@ -0,0 +1,47 @@
1
+ import type { BlockDefinition, BlueprintDocument, ContentFieldKind, ContentModelDocument, FieldBinding, FieldDefinition, LocalName, LockedArtifactReference, MessageReference, QualifiedName, StudioDiagnostic } from '@kumwe/studio-protocol';
2
+ /** The stable outcomes a binding port can expose to any authoring shell. */
3
+ export type FieldBindingProjectionStatus = 'invalid' | 'non-field-source' | 'resolved' | 'unbound';
4
+ /** One model field that can be bound to one exact block port. */
5
+ export interface FieldBindingCandidate {
6
+ readonly cardinality: FieldDefinition['cardinality'];
7
+ readonly control?: QualifiedName;
8
+ readonly fieldPath: readonly LocalName[];
9
+ readonly itemKind?: Exclude<ContentFieldKind, 'collection'>;
10
+ readonly kind: ContentFieldKind;
11
+ readonly label: MessageReference;
12
+ }
13
+ /** Deterministic projection of one declared or preserved node binding port. */
14
+ export interface FieldBindingPortProjection {
15
+ readonly binding?: FieldBinding;
16
+ readonly boundFieldPath?: readonly LocalName[];
17
+ readonly candidates: readonly FieldBindingCandidate[];
18
+ readonly multiple?: boolean;
19
+ readonly port: LocalName;
20
+ readonly required?: boolean;
21
+ readonly status: FieldBindingProjectionStatus;
22
+ readonly valueType?: string;
23
+ }
24
+ /** Deterministic projection of all binding affordances on one Blueprint node. */
25
+ export interface NodeFieldBindingProjection {
26
+ readonly nodeId: string;
27
+ readonly ports: readonly FieldBindingPortProjection[];
28
+ }
29
+ /**
30
+ * Read-only, language-neutral view of a Blueprint's bindings against one exact
31
+ * host-projected model revision.
32
+ */
33
+ export interface BlueprintFieldBindingProjection {
34
+ readonly diagnostics: readonly StudioDiagnostic[];
35
+ readonly model: LockedArtifactReference;
36
+ readonly nodes: readonly NodeFieldBindingProjection[];
37
+ }
38
+ /**
39
+ * Projects the active model into field-binding affordances and diagnostics.
40
+ *
41
+ * The function never changes a model, Blueprint, block definition, workflow,
42
+ * translation, or permission value. It accepts only already-authorized model
43
+ * projections and returns detached JSON-compatible snapshots. Field IDs, not
44
+ * labels or storage names, are the only binding coordinates.
45
+ */
46
+ export declare function projectBlueprintFieldBindings(blueprint: BlueprintDocument, model: ContentModelDocument, definitions: readonly BlockDefinition[]): BlueprintFieldBindingProjection;
47
+ //# sourceMappingURL=binding-projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binding-projection.d.ts","sourceRoot":"","sources":["../src/binding-projection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAEf,iBAAiB,EAEjB,gBAAgB,EAChB,oBAAoB,EACpB,YAAY,EACZ,eAAe,EAEf,SAAS,EACT,uBAAuB,EACvB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAGhC,4EAA4E;AAC5E,MAAM,MAAM,4BAA4B,GAAG,SAAS,GAAG,kBAAkB,GAAG,UAAU,GAAG,SAAS,CAAC;AAEnG,iEAAiE;AACjE,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,WAAW,EAAE,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3B,WAAW,EAAE,SAAS,eAAe,EAAE,GACtC,+BAA+B,CA6BjC"}
@@ -0,0 +1,253 @@
1
+ import { cloneContractValue } from './clone.js';
2
+ /**
3
+ * Projects the active model into field-binding affordances and diagnostics.
4
+ *
5
+ * The function never changes a model, Blueprint, block definition, workflow,
6
+ * translation, or permission value. It accepts only already-authorized model
7
+ * projections and returns detached JSON-compatible snapshots. Field IDs, not
8
+ * labels or storage names, are the only binding coordinates.
9
+ */
10
+ export function projectBlueprintFieldBindings(blueprint, model, definitions) {
11
+ const documentSnapshot = cloneContractValue(blueprint);
12
+ const modelSnapshot = cloneContractValue(model);
13
+ const definitionSnapshots = cloneContractValue(definitions);
14
+ const diagnostics = [];
15
+ const modelReference = cloneContractValue(documentSnapshot.model);
16
+ const modelCompatible = appendModelCoordinateDiagnostics(documentSnapshot, modelSnapshot, diagnostics);
17
+ const indexedDefinitions = new Map();
18
+ for (const definition of definitionSnapshots) {
19
+ indexedDefinitions.set(blockKey(definition.type, definition.version), definition);
20
+ }
21
+ const context = {
22
+ blueprintId: documentSnapshot.id,
23
+ definitions: indexedDefinitions,
24
+ diagnostics,
25
+ fields: modelCompatible ? flattenModelFields(modelSnapshot.fields) : [],
26
+ modelCompatible,
27
+ modelReference,
28
+ };
29
+ const nodes = [];
30
+ visitNodes(documentSnapshot.roots, (node) => {
31
+ nodes.push(projectNode(node, context));
32
+ });
33
+ return cloneContractValue({ diagnostics, model: modelReference, nodes });
34
+ }
35
+ function appendModelCoordinateDiagnostics(blueprint, model, diagnostics) {
36
+ let compatible = true;
37
+ for (const mismatch of [
38
+ {
39
+ actual: model.id,
40
+ code: 'studio.binding/model-id-mismatch',
41
+ expected: blueprint.model.id,
42
+ member: 'id',
43
+ },
44
+ {
45
+ actual: model.version,
46
+ code: 'studio.binding/model-version-mismatch',
47
+ expected: blueprint.model.version,
48
+ member: 'version',
49
+ },
50
+ {
51
+ actual: model.revision,
52
+ code: 'studio.binding/model-revision-mismatch',
53
+ expected: blueprint.model.revision,
54
+ member: 'revision',
55
+ },
56
+ ]) {
57
+ if (mismatch.actual === mismatch.expected) {
58
+ continue;
59
+ }
60
+ compatible = false;
61
+ diagnostics.push(diagnostic(mismatch.code, `The projected model ${mismatch.member} {actual} does not match the Blueprint lock {expected}.`, 'error', {
62
+ actual: mismatch.actual,
63
+ expected: mismatch.expected,
64
+ member: mismatch.member,
65
+ }, { artifactId: blueprint.id }));
66
+ }
67
+ return compatible;
68
+ }
69
+ function projectNode(node, context) {
70
+ const definition = context.definitions.get(blockKey(node.type, node.version));
71
+ const declaredPorts = definition?.ports ?? [];
72
+ const declaredIds = new Set(declaredPorts.map((port) => port.id));
73
+ const preservedPortIds = Object.keys(node.bindings)
74
+ .filter((port) => !declaredIds.has(port))
75
+ .sort(compareCodeUnits);
76
+ const ports = [
77
+ ...declaredPorts.map((port) => projectPort(node, port, context)),
78
+ ...preservedPortIds.map((port) => projectMissingPort(node, port, context)),
79
+ ];
80
+ return { nodeId: node.id, ports };
81
+ }
82
+ function projectPort(node, port, context) {
83
+ const candidates = context.modelCompatible
84
+ ? context.fields
85
+ .filter((candidate) => candidate.field.authoring?.hidden !== true && fieldMatchesPort(candidate.field, port))
86
+ .map(({ field, fieldPath }) => candidateProjection(field, fieldPath))
87
+ : [];
88
+ const binding = node.bindings[port.id];
89
+ if (binding === undefined) {
90
+ if (port.required) {
91
+ context.diagnostics.push(diagnostic('studio.binding/required-port-unbound', 'Required block port {port} is not bound to a source.', 'warning', { port: port.id }, { artifactId: context.blueprintId, nodeId: node.id }));
92
+ }
93
+ return {
94
+ candidates,
95
+ multiple: port.multiple,
96
+ port: port.id,
97
+ required: port.required,
98
+ status: 'unbound',
99
+ valueType: port.valueType,
100
+ };
101
+ }
102
+ if (binding.source.kind !== 'entry-field') {
103
+ return {
104
+ binding: cloneContractValue(binding),
105
+ candidates,
106
+ multiple: port.multiple,
107
+ port: port.id,
108
+ required: port.required,
109
+ status: 'non-field-source',
110
+ valueType: port.valueType,
111
+ };
112
+ }
113
+ const fieldPath = [...binding.source.fieldPath];
114
+ if (!context.modelCompatible) {
115
+ return invalidProjection(port, binding, fieldPath, candidates);
116
+ }
117
+ const resolution = resolveFieldPath(context.fields, fieldPath);
118
+ if (resolution === undefined) {
119
+ context.diagnostics.push(diagnostic('studio.binding/field-missing', 'Binding port {port} addresses field path {fieldPath}, which the locked model no longer declares.', 'error', { fieldPath: fieldPath.join('.'), port: port.id }, { artifactId: context.blueprintId, fieldPath, nodeId: node.id }));
120
+ return invalidProjection(port, binding, fieldPath, candidates);
121
+ }
122
+ if (fieldIsMultiple(resolution.field) !== port.multiple) {
123
+ context.diagnostics.push(diagnostic('studio.binding/field-cardinality-incompatible', 'Binding port {port} and field {fieldPath} no longer have compatible cardinality.', 'error', { fieldPath: fieldPath.join('.'), port: port.id }, { artifactId: context.blueprintId, fieldPath, nodeId: node.id }));
124
+ return invalidProjection(port, binding, fieldPath, candidates);
125
+ }
126
+ if (!fieldKindMatchesValueType(resolution.field, port.valueType)) {
127
+ context.diagnostics.push(diagnostic('studio.binding/field-kind-incompatible', 'Binding port {port} expects {valueType}, but field {fieldPath} now projects as {fieldKind}.', 'error', {
128
+ fieldKind: effectiveFieldKind(resolution.field),
129
+ fieldPath: fieldPath.join('.'),
130
+ port: port.id,
131
+ valueType: port.valueType,
132
+ }, { artifactId: context.blueprintId, fieldPath, nodeId: node.id }));
133
+ return invalidProjection(port, binding, fieldPath, candidates);
134
+ }
135
+ return {
136
+ binding: cloneContractValue(binding),
137
+ boundFieldPath: fieldPath,
138
+ candidates,
139
+ multiple: port.multiple,
140
+ port: port.id,
141
+ required: port.required,
142
+ status: 'resolved',
143
+ valueType: port.valueType,
144
+ };
145
+ }
146
+ function projectMissingPort(node, port, context) {
147
+ const binding = node.bindings[port];
148
+ if (binding === undefined) {
149
+ return { candidates: [], port, status: 'invalid' };
150
+ }
151
+ context.diagnostics.push(diagnostic('studio.binding/port-missing', 'Binding port {port} is not declared by the locked block definition.', 'error', { port }, { artifactId: context.blueprintId, nodeId: node.id }));
152
+ return {
153
+ binding: cloneContractValue(binding),
154
+ ...(binding.source.kind === 'entry-field'
155
+ ? { boundFieldPath: [...binding.source.fieldPath] }
156
+ : {}),
157
+ candidates: [],
158
+ port,
159
+ status: 'invalid',
160
+ };
161
+ }
162
+ function invalidProjection(port, binding, fieldPath, candidates) {
163
+ return {
164
+ binding: cloneContractValue(binding),
165
+ boundFieldPath: [...fieldPath],
166
+ candidates,
167
+ multiple: port.multiple,
168
+ port: port.id,
169
+ required: port.required,
170
+ status: 'invalid',
171
+ valueType: port.valueType,
172
+ };
173
+ }
174
+ function candidateProjection(field, fieldPath) {
175
+ return {
176
+ cardinality: field.cardinality,
177
+ ...(field.authoring?.control === undefined ? {} : { control: field.authoring.control }),
178
+ fieldPath: [...fieldPath],
179
+ ...(field.itemKind === undefined ? {} : { itemKind: field.itemKind }),
180
+ kind: field.kind,
181
+ label: cloneContractValue(field.label),
182
+ };
183
+ }
184
+ function flattenModelFields(fields) {
185
+ const flattened = [];
186
+ const visit = (siblings, prefix) => {
187
+ const ordered = siblings
188
+ .map((field, index) => ({ field, index }))
189
+ .sort((left, right) => (left.field.authoring?.order ?? Number.MAX_SAFE_INTEGER) -
190
+ (right.field.authoring?.order ?? Number.MAX_SAFE_INTEGER) || left.index - right.index);
191
+ for (const { field } of ordered) {
192
+ const fieldPath = [...prefix, field.id];
193
+ flattened.push({ field, fieldPath });
194
+ if (field.kind === 'object' && field.cardinality === 'one' && field.fields !== undefined) {
195
+ visit(field.fields, fieldPath);
196
+ }
197
+ }
198
+ };
199
+ visit(fields, []);
200
+ return flattened;
201
+ }
202
+ function resolveFieldPath(fields, fieldPath) {
203
+ return fields.find((candidate) => samePath(candidate.fieldPath, fieldPath));
204
+ }
205
+ function fieldMatchesPort(field, port) {
206
+ return (fieldIsMultiple(field) === port.multiple && fieldKindMatchesValueType(field, port.valueType));
207
+ }
208
+ function fieldIsMultiple(field) {
209
+ return field.cardinality === 'many';
210
+ }
211
+ function fieldKindMatchesValueType(field, valueType) {
212
+ const kind = effectiveFieldKind(field);
213
+ if (kind === valueType) {
214
+ return true;
215
+ }
216
+ if (valueType === 'text') {
217
+ return kind === 'string' || kind === 'enum';
218
+ }
219
+ if (valueType === 'number') {
220
+ return kind === 'decimal' || kind === 'integer';
221
+ }
222
+ return false;
223
+ }
224
+ function effectiveFieldKind(field) {
225
+ return field.kind === 'collection' ? (field.itemKind ?? 'object') : field.kind;
226
+ }
227
+ function visitNodes(nodes, visit) {
228
+ for (const node of nodes) {
229
+ visit(node);
230
+ for (const slot of Object.keys(node.slots).sort(compareCodeUnits)) {
231
+ visitNodes(node.slots[slot] ?? [], visit);
232
+ }
233
+ }
234
+ }
235
+ function diagnostic(code, defaultMessage, severity, parameters, location) {
236
+ return {
237
+ code,
238
+ ...(location === undefined ? {} : { location }),
239
+ message: { defaultMessage, key: code },
240
+ ...(parameters === undefined ? {} : { parameters }),
241
+ severity,
242
+ };
243
+ }
244
+ function blockKey(type, version) {
245
+ return `${type}@${version}`;
246
+ }
247
+ function samePath(left, right) {
248
+ return left.length === right.length && left.every((value, index) => value === right[index]);
249
+ }
250
+ function compareCodeUnits(left, right) {
251
+ return left < right ? -1 : left > right ? 1 : 0;
252
+ }
253
+ //# sourceMappingURL=binding-projection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binding-projection.js","sourceRoot":"","sources":["../src/binding-projection.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAyDhD;;;;;;;GAOG;AACH,MAAM,UAAU,6BAA6B,CAC3C,SAA4B,EAC5B,KAA2B,EAC3B,WAAuC;IAEvC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;IACvD,MAAM,aAAa,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,mBAAmB,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAC5D,MAAM,WAAW,GAAuB,E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CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC;QACnD,QAAQ;KACT,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY,EAAE,OAAe;IAC7C,OAAO,GAAG,IAAI,IAAI,OAAO,EAAE,CAAC;AAC9B,CAAC;AAED,SAAS,QAAQ,CAAC,IAAuB,EAAE,KAAwB;IACjE,OAAO,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAC9F,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAY,EAAE,KAAa;IACnD,OAAO,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClD,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { JsonValue } from '@kumwe/studio-protocol';
2
+ export interface CanonicalSerializationOptions {
3
+ maximumDepth?: number;
4
+ }
5
+ /**
6
+ * Serialize a bounded JSON value into the canonical cross-language form the
7
+ * portability contract defines for checksums: UTF-8 JSON, object members
8
+ * sorted by Unicode code unit, arrays in semantic order, minimal ECMA-404
9
+ * string escaping, and finite numbers only. Every conforming runtime MUST
10
+ * produce byte-identical output for the same value.
11
+ */
12
+ export declare function canonicalStringify(value: JsonValue, options?: Readonly<CanonicalSerializationOptions>): string;
13
+ /**
14
+ * The canonical UTF-8 bytes of a value; checksums in Studio contracts are
15
+ * computed over exactly these bytes with the algorithm the referencing
16
+ * contract names (SRI-style sha256 unless stated otherwise). Encoding is
17
+ * implemented locally so the core stays free of DOM and platform globals.
18
+ */
19
+ export declare function canonicalUtf8Bytes(value: JsonValue, options?: Readonly<CanonicalSerializationOptions>): Uint8Array;
20
+ //# sourceMappingURL=canonical.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonical.d.ts","sourceRoot":"","sources":["../src/canonical.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,WAAW,6BAA6B;IAC5C,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAID;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,SAAS,EAChB,OAAO,GAAE,QAAQ,CAAC,6BAA6B,CAAM,GACpD,MAAM,CAMR;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,SAAS,EAChB,OAAO,GAAE,QAAQ,CAAC,6BAA6B,CAAM,GACpD,UAAU,CA4BZ"}
@@ -0,0 +1,100 @@
1
+ const DEFAULT_MAXIMUM_DEPTH = 64;
2
+ /**
3
+ * Serialize a bounded JSON value into the canonical cross-language form the
4
+ * portability contract defines for checksums: UTF-8 JSON, object members
5
+ * sorted by Unicode code unit, arrays in semantic order, minimal ECMA-404
6
+ * string escaping, and finite numbers only. Every conforming runtime MUST
7
+ * produce byte-identical output for the same value.
8
+ */
9
+ export function canonicalStringify(value, options = {}) {
10
+ const maximumDepth = options.maximumDepth ?? DEFAULT_MAXIMUM_DEPTH;
11
+ if (!Number.isInteger(maximumDepth) || maximumDepth < 1) {
12
+ throw new RangeError('Canonical serialization depth must be a positive integer.');
13
+ }
14
+ return serialize(value, maximumDepth, 0);
15
+ }
16
+ /**
17
+ * The canonical UTF-8 bytes of a value; checksums in Studio contracts are
18
+ * computed over exactly these bytes with the algorithm the referencing
19
+ * contract names (SRI-style sha256 unless stated otherwise). Encoding is
20
+ * implemented locally so the core stays free of DOM and platform globals.
21
+ */
22
+ export function canonicalUtf8Bytes(value, options = {}) {
23
+ const text = canonicalStringify(value, options);
24
+ const bytes = [];
25
+ for (const character of text) {
26
+ const codePoint = character.codePointAt(0);
27
+ if (codePoint === undefined) {
28
+ break;
29
+ }
30
+ if (codePoint <= 0x7f) {
31
+ bytes.push(codePoint);
32
+ }
33
+ else if (codePoint <= 0x7ff) {
34
+ bytes.push(0xc0 | (codePoint >> 6), 0x80 | (codePoint & 0x3f));
35
+ }
36
+ else if (codePoint <= 0xffff) {
37
+ bytes.push(0xe0 | (codePoint >> 12), 0x80 | ((codePoint >> 6) & 0x3f), 0x80 | (codePoint & 0x3f));
38
+ }
39
+ else {
40
+ bytes.push(0xf0 | (codePoint >> 18), 0x80 | ((codePoint >> 12) & 0x3f), 0x80 | ((codePoint >> 6) & 0x3f), 0x80 | (codePoint & 0x3f));
41
+ }
42
+ }
43
+ return Uint8Array.from(bytes);
44
+ }
45
+ function serialize(value, maximumDepth, depth) {
46
+ if (value === null) {
47
+ return 'null';
48
+ }
49
+ switch (typeof value) {
50
+ case 'boolean':
51
+ return value ? 'true' : 'false';
52
+ case 'number': {
53
+ if (!Number.isFinite(value)) {
54
+ throw new TypeError('Canonical JSON cannot represent a non-finite number.');
55
+ }
56
+ // JSON.stringify implements the deterministic ECMAScript number
57
+ // grammar; Object.is separates -0, which canonicalizes to 0.
58
+ return JSON.stringify(Object.is(value, -0) ? 0 : value);
59
+ }
60
+ case 'string':
61
+ return JSON.stringify(value);
62
+ case 'object':
63
+ break;
64
+ default:
65
+ throw new TypeError(`Canonical JSON cannot represent a ${typeof value} value.`);
66
+ }
67
+ if (depth >= maximumDepth) {
68
+ throw new RangeError(`Canonical serialization exceeds the depth limit of ${maximumDepth}.`);
69
+ }
70
+ if (Array.isArray(value)) {
71
+ const items = value.map((item) => {
72
+ if (item === undefined) {
73
+ throw new TypeError('Canonical JSON arrays cannot contain undefined entries.');
74
+ }
75
+ return serialize(item, maximumDepth, depth + 1);
76
+ });
77
+ return `[${items.join(',')}]`;
78
+ }
79
+ const prototype = Object.getPrototypeOf(value);
80
+ if (prototype !== Object.prototype && prototype !== null) {
81
+ throw new TypeError('Canonical JSON only serializes plain objects and arrays.');
82
+ }
83
+ const members = Object.keys(value).sort(compareCodeUnits);
84
+ const parts = [];
85
+ for (const member of members) {
86
+ if (member === '__proto__' || member === 'prototype' || member === 'constructor') {
87
+ throw new TypeError(`Canonical JSON forbids the object member name ${member}.`);
88
+ }
89
+ const memberValue = value[member];
90
+ if (memberValue === undefined) {
91
+ continue;
92
+ }
93
+ parts.push(`${JSON.stringify(member)}:${serialize(memberValue, maximumDepth, depth + 1)}`);
94
+ }
95
+ return `{${parts.join(',')}}`;
96
+ }
97
+ function compareCodeUnits(left, right) {
98
+ return left < right ? -1 : left > right ? 1 : 0;
99
+ }
100
+ //# sourceMappingURL=canonical.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonical.js","sourceRoot":"","sources":["../src/canonical.ts"],"names":[],"mappings":"AAMA,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAEjC;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAgB,EAChB,UAAmD,EAAE;IAErD,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,qBAAqB,CAAC;IACnE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;QACxD,MAAM,IAAI,UAAU,CAAC,2DAA2D,CAAC,CAAC;IACpF,CAAC;IACD,OAAO,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC;AAC3C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAgB,EAChB,UAAmD,EAAE;IAErD,MAAM,IAAI,GAAG,kBAAkB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAChD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,SAAS,IAAI,IAAI,EAAE,CAAC;QAC7B,MAAM,SAAS,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAC3C,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,MAAM;QACR,CAAC;QACD,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AC;IAED,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC1D,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,MAAM,KAAK,WAAW,IAAI,MAAM,KAAK,WAAW,IAAI,MAAM,KAAK,aAAa,EAAE,CAAC;YACjF,MAAM,IAAI,SAAS,CAAC,iDAAiD,MAAM,GAAG,CAAC,CAAC;QAClF,CAAC;QACD,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAClC,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC9B,SAAS;QACX,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,WAAW,EAAE,YAAY,EAAE,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;IAC7F,CAAC;IACD,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AAChC,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAY,EAAE,KAAa;IACnD,OAAO,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function cloneContractValue<T>(value: T): T;
2
+ //# sourceMappingURL=clone.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clone.d.ts","sourceRoot":"","sources":["../src/clone.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAEjD"}
package/dist/clone.js ADDED
@@ -0,0 +1,4 @@
1
+ export function cloneContractValue(value) {
2
+ return JSON.parse(JSON.stringify(value));
3
+ }
4
+ //# sourceMappingURL=clone.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clone.js","sourceRoot":"","sources":["../src/clone.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,kBAAkB,CAAI,KAAQ;IAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAM,CAAC;AAChD,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { BlueprintBatchOperation, BlueprintCommand, BlueprintDocument, StableId } from '@kumwe/studio-protocol';
2
+ export type StudioCommandErrorCode = 'artifact-not-draft' | 'binding-not-found' | 'duplicate-field' | 'duplicate-node' | 'illegal-move' | 'invalid-batch' | 'invalid-id-map' | 'invalid-index' | 'invalid-order' | 'locale-mismatch' | 'mode-forbidden' | 'node-not-found' | 'parent-not-found' | 'property-not-found' | 'read-only-session' | 'stale-generation' | 'stale-state' | 'unsupported-command';
3
+ export declare class StudioCommandError extends Error {
4
+ readonly code: StudioCommandErrorCode;
5
+ constructor(code: StudioCommandErrorCode, message: string);
6
+ }
7
+ export interface InverseCommandOptions {
8
+ id: StableId;
9
+ }
10
+ export declare function applyCommand(document: BlueprintDocument, command: BlueprintCommand): BlueprintDocument;
11
+ export declare function invertCommand(document: BlueprintDocument, command: BlueprintCommand, options: Readonly<InverseCommandOptions>): BlueprintCommand;
12
+ /**
13
+ * Applies one batchable operation to a document in place. Exported for the
14
+ * package-internal hybrid-bound trial evaluation in `modes.ts`; the public
15
+ * reducer surface remains `applyCommand`.
16
+ */
17
+ export declare function applyOperation(document: BlueprintDocument, operation: BlueprintBatchOperation): void;
18
+ //# sourceMappingURL=commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EASjB,QAAQ,EAET,MAAM,wBAAwB,CAAC;AAGhC,MAAM,MAAM,sBAAsB,GAC9B,oBAAoB,GACpB,mBAAmB,GACnB,iBAAiB,GACjB,gBAAgB,GAChB,cAAc,GACd,eAAe,GACf,gBAAgB,GAChB,eAAe,GACf,eAAe,GACf,iBAAiB,GACjB,gBAAgB,GAChB,gBAAgB,GAChB,kBAAkB,GAClB,oBAAoB,GACpB,mBAAmB,GACnB,kBAAkB,GAClB,aAAa,GACb,qBAAqB,CAAC;AAE1B,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,SAAgB,IAAI,EAAE,sBAAsB,CAAC;gBAE1B,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,MAAM;CAKjE;AAED,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,QAAQ,CAAC;CACd;AAUD,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,EAAE,gBAAgB,GACxB,iBAAiB,CAqBnB;AAED,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,QAAQ,CAAC,qBAAqB,CAAC,GACvC,gBAAgB,CA4DlB;AA2BD;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,iBAAiB,EAC3B,SAAS,EAAE,uBAAuB,GACjC,IAAI,CAgPN"}