@serene-pub/sdk 0.6.0-pr-2 → 0.6.0-pr-5
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/README.md +24 -20
- package/dist/actions.d.ts +150 -68
- package/dist/actions.js +90 -36
- package/dist/annexFields.d.ts +8 -4
- package/dist/annexFields.js +5 -2
- package/dist/announce.d.ts +78 -28
- package/dist/announce.js +14 -5
- package/dist/attributes.d.ts +9 -6
- package/dist/attributes.js +9 -5
- package/dist/bands.d.ts +41 -6
- package/dist/bands.js +83 -33
- package/dist/builder.d.ts +161 -58
- package/dist/builder.js +128 -22
- package/dist/candidates.d.ts +5 -3
- package/dist/candidates.js +3 -2
- package/dist/clauses.d.ts +2 -1
- package/dist/clauses.js +2 -1
- package/dist/component.d.ts +24 -7
- package/dist/component.js +16 -6
- package/dist/componentBuild.d.ts +16 -5
- package/dist/componentBuild.js +14 -5
- package/dist/componentClient.d.ts +61 -30
- package/dist/componentClient.js +11 -1
- package/dist/componentImports.d.ts +8 -5
- package/dist/componentImports.js +23 -4
- package/dist/componentModule.js +2 -1
- package/dist/componentWire.d.ts +2 -1
- package/dist/componentWire.js +34 -2
- package/dist/config.d.ts +28 -14
- package/dist/config.js +20 -10
- package/dist/connections.d.ts +9 -4
- package/dist/connections.js +7 -4
- package/dist/declarations.d.ts +46 -17
- package/dist/declarations.js +46 -15
- package/dist/descriptors.d.ts +242 -97
- package/dist/descriptors.js +145 -41
- package/dist/dev.d.ts +6 -5
- package/dist/dev.js +6 -5
- package/dist/document.d.ts +74 -25
- package/dist/document.js +32 -11
- package/dist/dowry.d.ts +241 -0
- package/dist/dowry.js +315 -0
- package/dist/engines.d.ts +16 -7
- package/dist/engines.js +6 -4
- package/dist/eventMapLaws.d.ts +19 -8
- package/dist/eventMapLaws.js +9 -6
- package/dist/events.d.ts +101 -39
- package/dist/events.js +106 -33
- package/dist/executor.d.ts +122 -41
- package/dist/executor.js +195 -96
- package/dist/extension.d.ts +99 -35
- package/dist/extension.js +43 -9
- package/dist/facets.d.ts +2 -1
- package/dist/facets.js +4 -2
- package/dist/foldedSections.d.ts +4 -2
- package/dist/foldedSections.js +2 -1
- package/dist/genres.d.ts +123 -41
- package/dist/genres.js +127 -22
- package/dist/guardedConnection.d.ts +4 -3
- package/dist/guardedConnection.js +4 -3
- package/dist/handlebarsReach.d.ts +1 -1
- package/dist/handlebarsReach.js +1 -1
- package/dist/hash.d.ts +16 -5
- package/dist/hash.js +14 -4
- package/dist/hookGrants.d.ts +3 -2
- package/dist/hookGrants.js +6 -4
- package/dist/hooks.d.ts +21 -16
- package/dist/hooks.js +12 -10
- package/dist/hostElements.d.ts +41 -17
- package/dist/hostElements.js +49 -17
- package/dist/i18n.d.ts +5 -3
- package/dist/i18n.js +5 -3
- package/dist/identity.d.ts +5 -4
- package/dist/identity.js +5 -4
- package/dist/index.d.ts +5 -0
- package/dist/index.js +15 -0
- package/dist/layout.d.ts +36 -15
- package/dist/layout.js +2 -2
- package/dist/loadouts.d.ts +97 -0
- package/dist/loadouts.js +81 -0
- package/dist/media.d.ts +26 -4
- package/dist/media.js +2 -1
- package/dist/messageBlocks.d.ts +44 -32
- package/dist/messageBlocks.js +23 -18
- package/dist/migration.d.ts +16 -8
- package/dist/migration.js +14 -8
- package/dist/names.d.ts +2 -1
- package/dist/names.js +2 -1
- package/dist/nodeInput.d.ts +2 -1
- package/dist/nodeInput.js +2 -1
- package/dist/participants.d.ts +22 -15
- package/dist/participants.js +14 -12
- package/dist/personGate.d.ts +2 -1
- package/dist/personGate.js +2 -1
- package/dist/pluginHarness.d.ts +8 -3
- package/dist/pluginHarness.js +4 -2
- package/dist/pluginPermissions.d.ts +2 -1
- package/dist/pluginPermissions.js +12 -1
- package/dist/pluginRuleRef.d.ts +2 -2
- package/dist/pluginRuleRef.js +1 -1
- package/dist/predicates.d.ts +16 -11
- package/dist/predicates.js +7 -6
- package/dist/preview.d.ts +8 -3
- package/dist/preview.js +2 -1
- package/dist/promptBlocks.d.ts +5 -3
- package/dist/promptBlocks.js +5 -3
- package/dist/rankingDecisions.d.ts +2 -1
- package/dist/rankingDecisions.js +2 -1
- package/dist/receipt.d.ts +65 -29
- package/dist/receipt.js +9 -4
- package/dist/receiverRules.js +3 -2
- package/dist/refs.d.ts +34 -9
- package/dist/refs.js +33 -13
- package/dist/registry.d.ts +42 -23
- package/dist/registry.js +7 -5
- package/dist/review.d.ts +16 -5
- package/dist/review.js +11 -4
- package/dist/sampling.d.ts +54 -0
- package/dist/sampling.js +95 -3
- package/dist/sceneSettings.d.ts +312 -0
- package/dist/sceneSettings.js +425 -0
- package/dist/scope.d.ts +6 -4
- package/dist/scope.js +4 -3
- package/dist/scripts.d.ts +81 -14
- package/dist/scripts.js +90 -11
- package/dist/sessionDossier.d.ts +521 -0
- package/dist/sessionDossier.js +33 -0
- package/dist/sessionLayout.d.ts +303 -19
- package/dist/sessionLayout.js +354 -40
- package/dist/sessionSettings.d.ts +8 -5
- package/dist/settings.d.ts +45 -20
- package/dist/settings.js +19 -12
- package/dist/settingsSlot.d.ts +11 -8
- package/dist/settingsSlot.js +11 -8
- package/dist/shapes.d.ts +103 -41
- package/dist/shapes.js +105 -40
- package/dist/sheets.d.ts +4 -2
- package/dist/sheets.js +6 -3
- package/dist/statShapes.d.ts +2 -1
- package/dist/statShapes.js +2 -1
- package/dist/status.d.ts +13 -9
- package/dist/status.js +8 -6
- package/dist/storage.d.ts +2 -1
- package/dist/storage.js +2 -1
- package/dist/storyTime.d.ts +13 -7
- package/dist/storyTime.js +11 -6
- package/dist/strokes.d.ts +176 -0
- package/dist/strokes.js +281 -0
- package/dist/surfaces.d.ts +54 -25
- package/dist/surfaces.js +3 -3
- package/dist/template.d.ts +9 -5
- package/dist/template.js +5 -3
- package/dist/templateCheck.d.ts +2 -2
- package/dist/templateCheck.js +2 -2
- package/dist/templateFit.d.ts +37 -8
- package/dist/templateFit.js +92 -8
- package/dist/templateIds.d.ts +3 -3
- package/dist/templateIds.js +3 -3
- package/dist/templateScopeAt.d.ts +21 -11
- package/dist/templateScopeAt.js +21 -11
- package/dist/testing.d.ts +11 -4
- package/dist/testing.js +13 -5
- package/dist/tokenizers.d.ts +2 -2
- package/dist/tokenizers.js +2 -2
- package/dist/turnLock.d.ts +4 -2
- package/dist/turnLock.js +2 -1
- package/dist/turnOrder.d.ts +17 -11
- package/dist/turnOrder.js +9 -5
- package/dist/validate.d.ts +11 -8
- package/dist/validate.js +81 -10
- package/dist/values.d.ts +17 -8
- package/dist/values.js +11 -6
- package/dist/variables.d.ts +46 -7
- package/dist/variables.js +87 -6
- package/dist/verdicts.d.ts +20 -13
- package/dist/verdicts.js +17 -11
- package/dist/widgetDecls.d.ts +8 -4
- package/dist/widgetDecls.js +4 -2
- package/dist/widgets.d.ts +987 -94
- package/dist/widgets.js +93 -18
- package/dist/wire.d.ts +13 -6
- package/dist/wire.js +3 -3
- package/dist/worldinfo.d.ts +11 -6
- package/dist/worldinfo.js +8 -4
- package/host-elements.d.ts +13 -0
- package/package.json +1 -1
package/dist/validate.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Validation — the Fixed Ledger laws that can be checked statically.
|
|
3
3
|
*
|
|
4
|
-
* Every finding names what to do instead
|
|
4
|
+
* Every finding names what to do instead. A prohibition without a stated
|
|
5
5
|
* alternative is a bug, and there is a test asserting exactly that.
|
|
6
|
+
* @ruling 15 §1.3
|
|
6
7
|
*/
|
|
7
8
|
import { pluginRuleRef } from './pluginRuleRef.js';
|
|
8
9
|
import { JUNCTION_CLAUSE_PORTS, junctionBranchEnds } from './document.js';
|
|
@@ -16,6 +17,7 @@ import { PREDICATE_CONDITION_KEYS } from './predicates.js';
|
|
|
16
17
|
import { provisionalVerdict, settingsTravelVerdict } from './verdicts.js';
|
|
17
18
|
import { settingsSchemaFindings } from './settings.js';
|
|
18
19
|
import { actionDocumentFindingsByLaw } from './actions.js';
|
|
20
|
+
import { boundaryTriggerFindings } from './sceneSettings.js';
|
|
19
21
|
import { templateLawFindings } from './templateFit.js';
|
|
20
22
|
import { isSlotRef } from './refs.js';
|
|
21
23
|
import { assignable, isStreaming, JSON_SHAPE } from './shapes.js';
|
|
@@ -33,9 +35,10 @@ const FIELD_ASSEMBLED_SHAPES = new Set([
|
|
|
33
35
|
'core:shape/template-context@1',
|
|
34
36
|
]);
|
|
35
37
|
/**
|
|
36
|
-
* A verdict's sentence or fix as a finding's string
|
|
38
|
+
* A verdict's sentence or fix as a finding's string: findings are
|
|
37
39
|
* `en`, the locale every map carries. An absent fix is the empty string —
|
|
38
40
|
* every verdict this file quotes declares one.
|
|
41
|
+
* @ruling 01 §13
|
|
39
42
|
*/
|
|
40
43
|
const en = (v) => (v === undefined ? '' : (i18nText(v) ?? ''));
|
|
41
44
|
/** @experimental */
|
|
@@ -452,6 +455,26 @@ export function validate(doc, options = {}) {
|
|
|
452
455
|
fix: fix ?? 'declare the action as `contributes.actions[]` describes — see the SDK\'s actions.ts',
|
|
453
456
|
});
|
|
454
457
|
}
|
|
458
|
+
// ── 🚧 Boundary triggers (★9; live scenes §15 G18, 2026-10-13) ────────────
|
|
459
|
+
//
|
|
460
|
+
// A genre's declared boundary triggers ride its summarize-scene spec as
|
|
461
|
+
// `contributes.boundaryTriggers`. `spec()` refuses a malformed one where
|
|
462
|
+
// the author is (`boundaryTriggerFindings`, the builder's own sentences);
|
|
463
|
+
// a document from any other source — a hand-written JSON, an import, a
|
|
464
|
+
// patched row — gets the same sentences here, and a host's publish runs
|
|
465
|
+
// this. The channels against the genre are the builder's to check
|
|
466
|
+
// (`summarizeScene`, where a genre is at hand): a stored document names
|
|
467
|
+
// none to check against. A host reading one still takes only the
|
|
468
|
+
// triggers that read (`boundaryTriggersOf`).
|
|
469
|
+
for (const message of boundaryTriggerFindings(doc.contributes?.boundaryTriggers, 'contributes.boundaryTriggers'))
|
|
470
|
+
f.push({
|
|
471
|
+
law: 'boundary triggers',
|
|
472
|
+
severity: 'error',
|
|
473
|
+
message,
|
|
474
|
+
fix: "declare each as { key, label, when } — a camelCase key that is not core's, display text " +
|
|
475
|
+
"for the chip, and at least one of channel, narration, speaker, actionKey, stateKey — as " +
|
|
476
|
+
"summarizeScene(…, { boundaries }) writes them (see the SDK's sceneSettings.ts)",
|
|
477
|
+
});
|
|
455
478
|
// ── R-20 — every author-facing string the document carries is display text
|
|
456
479
|
// (a string or a locale map with `en`, never blank; U5i, ruled 2026-09-17):
|
|
457
480
|
// each author preset's label and description; the genre a create pipeline
|
|
@@ -496,7 +519,7 @@ export function validate(doc, options = {}) {
|
|
|
496
519
|
return false;
|
|
497
520
|
};
|
|
498
521
|
/**
|
|
499
|
-
* What a branch may state, counted off ONE list
|
|
522
|
+
* What a branch may state, counted off ONE list.
|
|
500
523
|
*
|
|
501
524
|
* This read the three words out of a literal, so the night `equalsPath`
|
|
502
525
|
* joined the grammar it was legal in an action's enabled-when and refused
|
|
@@ -504,6 +527,7 @@ export function validate(doc, options = {}) {
|
|
|
504
527
|
* two doors, which is the one thing a shared shape exists to prevent.
|
|
505
528
|
* `default` is the junction's own fourth: only a branch can fire because
|
|
506
529
|
* nothing else did.
|
|
530
|
+
* @ruling D-4a (2026-09-17)
|
|
507
531
|
*/
|
|
508
532
|
const BRANCH_CONDITIONS = [...PREDICATE_CONDITION_KEYS, 'default'];
|
|
509
533
|
for (const b of doc.clauses) {
|
|
@@ -1071,6 +1095,50 @@ export function validate(doc, options = {}) {
|
|
|
1071
1095
|
}
|
|
1072
1096
|
}
|
|
1073
1097
|
}
|
|
1098
|
+
// ── assemble wiring — a prompt is assembled for the model call it feeds ───
|
|
1099
|
+
// `assemble@2` reads its `template` slot and the connection it renders for
|
|
1100
|
+
// only when the spec wires them: unwired, the run halts on a real instance
|
|
1101
|
+
// ("assemble has no template"), and once the template is wired a chat
|
|
1102
|
+
// wire-mode connection is handed a prompt with no messages. Neither shows
|
|
1103
|
+
// on a fixture host, so it is said here, where the author is (F3 docs
|
|
1104
|
+
// gate, stalls 12 and 14). A warning, not an error: a host saves documents
|
|
1105
|
+
// its own tests and older plugins built bare, and the run's own halt is
|
|
1106
|
+
// the error.
|
|
1107
|
+
for (const n of doc.nodes) {
|
|
1108
|
+
if (n.definitionId !== 'core:task/assemble' || n.definitionVersion !== 2)
|
|
1109
|
+
continue;
|
|
1110
|
+
// A wired port, not the spine's implicit `main` hand-off.
|
|
1111
|
+
const generate = doc.edges
|
|
1112
|
+
.filter((e) => e.from === n.key && !e.implicit)
|
|
1113
|
+
.map((e) => byKey.get(e.to))
|
|
1114
|
+
.find((t) => {
|
|
1115
|
+
if (t?.kind !== 'oracle')
|
|
1116
|
+
return false;
|
|
1117
|
+
const d = desc(t.key);
|
|
1118
|
+
return d !== undefined && isModelCall(d);
|
|
1119
|
+
});
|
|
1120
|
+
if (!generate)
|
|
1121
|
+
continue;
|
|
1122
|
+
const wired = (port) => n.config[port] !== undefined || doc.edges.some((e) => e.to === n.key && e.toPort.split('.')[0] === port);
|
|
1123
|
+
if (!wired('template'))
|
|
1124
|
+
f.push({
|
|
1125
|
+
law: 'assemble wiring',
|
|
1126
|
+
severity: 'warning',
|
|
1127
|
+
nodeKey: n.key,
|
|
1128
|
+
message: `'${n.key}' assembles the prompt '${generate.key}' sends, but its template is not wired — ` +
|
|
1129
|
+
`the run halts with "assemble has no template", whatever configuration an administrator picks`,
|
|
1130
|
+
fix: `add template: slot.template() to '${n.key}' (C.assemble.v2({ …, template: slot.template() }))`,
|
|
1131
|
+
});
|
|
1132
|
+
if (!wired('connection'))
|
|
1133
|
+
f.push({
|
|
1134
|
+
law: 'assemble wiring',
|
|
1135
|
+
severity: 'warning',
|
|
1136
|
+
nodeKey: n.key,
|
|
1137
|
+
message: `'${n.key}' assembles the prompt '${generate.key}' sends, but does not know that connection — ` +
|
|
1138
|
+
`a chat wire-mode connection is handed a prompt with no messages`,
|
|
1139
|
+
fix: `add connection: slot.connectionOf('${generate.key}') to '${n.key}', so the prompt is written for the connection that sends it`,
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1074
1142
|
// ── T1 — a template fits where it is rendered (typed templates P5) ─────────
|
|
1075
1143
|
// Collisions and forbidden kinds in a template node's scope, a band with
|
|
1076
1144
|
// no variable, and — given the checker — every template source the
|
|
@@ -1081,8 +1149,7 @@ export function validate(doc, options = {}) {
|
|
|
1081
1149
|
return f;
|
|
1082
1150
|
}
|
|
1083
1151
|
/**
|
|
1084
|
-
* The streaming step and the step status, as declared on `expose
|
|
1085
|
-
* pass B3/B18; owner D6 and D5, 2026-09-27).
|
|
1152
|
+
* The streaming step and the step status, as declared on `expose`.
|
|
1086
1153
|
*
|
|
1087
1154
|
* Which oracle streams into the reply is **declared**, never inferred: the
|
|
1088
1155
|
* inference it replaced skipped every oracle inside a clause and streamed the
|
|
@@ -1094,7 +1161,7 @@ export function validate(doc, options = {}) {
|
|
|
1094
1161
|
* would write its document into the row a person is reading;
|
|
1095
1162
|
* · **one per execution path** — a run has one live row, and two streams
|
|
1096
1163
|
* interleave or concatenate into it. Two steps that can never run in the
|
|
1097
|
-
* same execution may each stream
|
|
1164
|
+
* same execution may each stream: they sit in different
|
|
1098
1165
|
* branches of one junction whose predicates are mutually exclusive — one
|
|
1099
1166
|
* is the `otherwise`, or both are `equals` on the same path with different
|
|
1100
1167
|
* literals. The runtime streams whichever one runs. Anything weaker (a
|
|
@@ -1104,10 +1171,11 @@ export function validate(doc, options = {}) {
|
|
|
1104
1171
|
* into the same row;
|
|
1105
1172
|
* · **an oracle** — only an oracle has a model's tokens to stream.
|
|
1106
1173
|
*
|
|
1107
|
-
* A step status, step label and step purpose are display text
|
|
1174
|
+
* A step status, step label and step purpose are display text, and a
|
|
1108
1175
|
* step purpose sits only on a model call — an oracle whose definition declares
|
|
1109
1176
|
* a `connection` slot (`isModelCall`; law `step purpose`, 2026-09-30).
|
|
1110
1177
|
* @internal
|
|
1178
|
+
* @ruling lair pass B3/B18, owner D6 and D5 (2026-09-27), W2 (2026-09-27), R-20
|
|
1111
1179
|
*/
|
|
1112
1180
|
export function streamingStepFindings(doc) {
|
|
1113
1181
|
const f = [];
|
|
@@ -1214,13 +1282,14 @@ export function streamingStepFindings(doc) {
|
|
|
1214
1282
|
return f;
|
|
1215
1283
|
}
|
|
1216
1284
|
/**
|
|
1217
|
-
* Whether `a` always runs after `b` has finished (
|
|
1285
|
+
* Whether `a` always runs after `b` has finished ("after, not beside").
|
|
1218
1286
|
*
|
|
1219
1287
|
* A level — the spine, or one chain of one clause — runs its items one at a
|
|
1220
1288
|
* time in position order; only a clause's chains may run side by side. So
|
|
1221
1289
|
* `a` follows `b` exactly when, at the innermost level both sit in, the item
|
|
1222
1290
|
* holding `a` is positioned after the item holding `b`. Two branches of one
|
|
1223
1291
|
* clause meet at that clause's own position, and are never ordered.
|
|
1292
|
+
* @ruling F7
|
|
1224
1293
|
*/
|
|
1225
1294
|
function runsStrictlyAfter(doc, a, b) {
|
|
1226
1295
|
const clauseById = new Map(doc.clauses.map((c) => [c.id, c]));
|
|
@@ -1248,9 +1317,10 @@ function runsStrictlyAfter(doc, a, b) {
|
|
|
1248
1317
|
return false;
|
|
1249
1318
|
}
|
|
1250
1319
|
/**
|
|
1251
|
-
* Whether two nodes can never run in the same execution
|
|
1320
|
+
* Whether two nodes can never run in the same execution: they diverge
|
|
1252
1321
|
* in two branches of one junction whose predicates cannot both fire.
|
|
1253
1322
|
* Conservative — anything not provably exclusive is the same path.
|
|
1323
|
+
* @ruling W2
|
|
1254
1324
|
*/
|
|
1255
1325
|
function exclusiveSteps(clauseById, a, b) {
|
|
1256
1326
|
// Each node's ancestry, innermost first, as (clause, chain) pairs.
|
|
@@ -1361,11 +1431,12 @@ export function assertValid(doc, options) {
|
|
|
1361
1431
|
}
|
|
1362
1432
|
}
|
|
1363
1433
|
/**
|
|
1364
|
-
* The
|
|
1434
|
+
* The display-text findings over one stored document: presets, and the genre
|
|
1365
1435
|
* declaration a create pipeline carries. Read as `unknown` throughout — a
|
|
1366
1436
|
* document may have come from anywhere — so a wrong shape is a sentence,
|
|
1367
1437
|
* never a throw.
|
|
1368
1438
|
* @experimental
|
|
1439
|
+
* @ruling R-20
|
|
1369
1440
|
*/
|
|
1370
1441
|
export function documentDisplayTextFindings(doc) {
|
|
1371
1442
|
const out = [];
|
package/dist/values.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The value-type system
|
|
2
|
+
* The value-type system.
|
|
3
3
|
*
|
|
4
4
|
* Authoring goes through a toolkit facade — `v.integer({})`, `v.weights({})`,
|
|
5
5
|
* `v.stackedBar({})` — for ergonomics and dot-discoverability; the output is
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* Unknown keys degrade safely: consumers render a read-only fallback and
|
|
15
15
|
* refuse writes to types they cannot validate.
|
|
16
16
|
*
|
|
17
|
-
* Constraints come in two tiers, both pure data
|
|
17
|
+
* Constraints come in two tiers, both pure data:
|
|
18
18
|
* - T1 declarative: min/max/step/pattern/options; group: sumTo/normalize.
|
|
19
19
|
* - T2 predicates: `requiredWhen`/`visibleWhen`/`enabledWhen`, reusing the
|
|
20
20
|
* route-predicate shape ({path, equals, truthy}) — declarations that read
|
|
@@ -24,14 +24,16 @@
|
|
|
24
24
|
* Four consumers key off the same id — factory (here), validator (here),
|
|
25
25
|
* control renderer (@serene-pub/controls), scaffold printer (cli) — and a
|
|
26
26
|
* conformance canary asserts no shipped type is missing any of the four.
|
|
27
|
+
* @ruling 24 §8, 24 §8
|
|
27
28
|
*/
|
|
28
29
|
import { type I18n } from './i18n.js';
|
|
29
30
|
/**
|
|
30
|
-
* One condition over sibling values — the route-predicate shape
|
|
31
|
+
* One condition over sibling values — the route-predicate shape.
|
|
31
32
|
* A settings-form field's gate, not the action-level **enabled-when** of
|
|
32
33
|
* `predicates.ts` (which reads the session's published values and carries a
|
|
33
34
|
* `reason`); the two share the shape, not the document.
|
|
34
35
|
* @experimental
|
|
36
|
+
* @ruling 20 §10
|
|
35
37
|
*/
|
|
36
38
|
export interface ValuePredicate {
|
|
37
39
|
/** Dot path into the sibling value map. */
|
|
@@ -43,12 +45,16 @@ export interface ValuePredicate {
|
|
|
43
45
|
}
|
|
44
46
|
/** Fields every declaration may carry, regardless of kind. @experimental */
|
|
45
47
|
export interface ValueCommon {
|
|
46
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* What a person reads beside the control — a string or a locale map with `en`.
|
|
50
|
+
* @ruling R-20
|
|
51
|
+
*/
|
|
47
52
|
label?: I18n;
|
|
48
53
|
description?: I18n;
|
|
49
54
|
/**
|
|
50
55
|
* No shipped default — a config MUST supply this value. Requiredness is
|
|
51
|
-
* what makes "missing" a fact the coverage report can state
|
|
56
|
+
* what makes "missing" a fact the coverage report can state.
|
|
57
|
+
* @ruling 24 §7
|
|
52
58
|
*/
|
|
53
59
|
required?: boolean;
|
|
54
60
|
requiredWhen?: ValuePredicate;
|
|
@@ -175,15 +181,17 @@ type Validator = (schema: Record<string, unknown>, value: unknown) => string[];
|
|
|
175
181
|
export declare const valueValidators: Record<string, Validator>;
|
|
176
182
|
/**
|
|
177
183
|
* Validate one value against its declaration. Unknown type ids refuse —
|
|
178
|
-
* a consumer must never accept a write it cannot check
|
|
184
|
+
* a consumer must never accept a write it cannot check.
|
|
179
185
|
* @experimental
|
|
186
|
+
* @ruling 24 §8
|
|
180
187
|
*/
|
|
181
188
|
export declare function validateValue(declaration: ValueDecl, value: unknown): string[];
|
|
182
189
|
/**
|
|
183
|
-
* A deliberate hole
|
|
190
|
+
* A deliberate hole: type-checks wherever a value goes, so authoring
|
|
184
191
|
* can continue — but the coverage report lists it as a named gap, and
|
|
185
192
|
* validation refuses it like any other unknown.
|
|
186
193
|
* @experimental
|
|
194
|
+
* @ruling 24 §7
|
|
187
195
|
*/
|
|
188
196
|
export declare function todo(note: string): {
|
|
189
197
|
'todo@1': {
|
|
@@ -200,12 +208,13 @@ export declare const isTodo: (value: unknown) => value is {
|
|
|
200
208
|
export declare const shippedValueKinds: readonly string[];
|
|
201
209
|
/**
|
|
202
210
|
* The bridge from the settings-schema vocabulary (`{type:'integer', …}` on
|
|
203
|
-
* node-type slots) to value declarations
|
|
211
|
+
* node-type slots) to value declarations. Derived at read, never
|
|
204
212
|
* stored — no document or hash changes — so panels and controls can speak
|
|
205
213
|
* the value-decl contract while the schemas migrate underneath at their own
|
|
206
214
|
* pace. Unknown entry types map to nothing, and the caller keeps its
|
|
207
215
|
* legacy rendering for them.
|
|
208
216
|
* @experimental
|
|
217
|
+
* @ruling 24 T6c
|
|
209
218
|
*/
|
|
210
219
|
export declare function valueDeclOf(entry: unknown): ValueDecl | null;
|
|
211
220
|
export {};
|
package/dist/values.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The value-type system
|
|
2
|
+
* The value-type system.
|
|
3
3
|
*
|
|
4
4
|
* Authoring goes through a toolkit facade — `v.integer({})`, `v.weights({})`,
|
|
5
5
|
* `v.stackedBar({})` — for ergonomics and dot-discoverability; the output is
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* Unknown keys degrade safely: consumers render a read-only fallback and
|
|
15
15
|
* refuse writes to types they cannot validate.
|
|
16
16
|
*
|
|
17
|
-
* Constraints come in two tiers, both pure data
|
|
17
|
+
* Constraints come in two tiers, both pure data:
|
|
18
18
|
* - T1 declarative: min/max/step/pattern/options; group: sumTo/normalize.
|
|
19
19
|
* - T2 predicates: `requiredWhen`/`visibleWhen`/`enabledWhen`, reusing the
|
|
20
20
|
* route-predicate shape ({path, equals, truthy}) — declarations that read
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
* Four consumers key off the same id — factory (here), validator (here),
|
|
25
25
|
* control renderer (@serene-pub/controls), scaffold printer (cli) — and a
|
|
26
26
|
* conformance canary asserts no shipped type is missing any of the four.
|
|
27
|
+
* @ruling 24 §8, 24 §8
|
|
27
28
|
*/
|
|
28
29
|
import { i18nFindings } from './i18n.js';
|
|
29
30
|
/** The one key of a declaration — its type id. Throws on malformed decls. @experimental */
|
|
@@ -53,11 +54,12 @@ function decl(definitionId, props) {
|
|
|
53
54
|
return freeze({ [definitionId]: freeze(clean) });
|
|
54
55
|
}
|
|
55
56
|
/**
|
|
56
|
-
* The authoring door's half of
|
|
57
|
+
* The authoring door's half of the display-text rule: a declaration's `label` and
|
|
57
58
|
* `description`, and each select option's, are display text — a string or a
|
|
58
59
|
* locale map with `en` — refused at the author's line otherwise. `decl()`
|
|
59
60
|
* itself stays unchecked because `valueDeclOf` bridges stored schemas through
|
|
60
61
|
* it at read time, and a panel is not the place to refuse a row.
|
|
62
|
+
* @ruling R-20
|
|
61
63
|
*/
|
|
62
64
|
function declared(definitionId, props) {
|
|
63
65
|
const findings = [
|
|
@@ -236,8 +238,9 @@ export const valueValidators = {
|
|
|
236
238
|
};
|
|
237
239
|
/**
|
|
238
240
|
* Validate one value against its declaration. Unknown type ids refuse —
|
|
239
|
-
* a consumer must never accept a write it cannot check
|
|
241
|
+
* a consumer must never accept a write it cannot check.
|
|
240
242
|
* @experimental
|
|
243
|
+
* @ruling 24 §8
|
|
241
244
|
*/
|
|
242
245
|
export function validateValue(declaration, value) {
|
|
243
246
|
const kind = valueKind(declaration);
|
|
@@ -247,10 +250,11 @@ export function validateValue(declaration, value) {
|
|
|
247
250
|
return validator(declaration[kind], value);
|
|
248
251
|
}
|
|
249
252
|
/**
|
|
250
|
-
* A deliberate hole
|
|
253
|
+
* A deliberate hole: type-checks wherever a value goes, so authoring
|
|
251
254
|
* can continue — but the coverage report lists it as a named gap, and
|
|
252
255
|
* validation refuses it like any other unknown.
|
|
253
256
|
* @experimental
|
|
257
|
+
* @ruling 24 §7
|
|
254
258
|
*/
|
|
255
259
|
export function todo(note) {
|
|
256
260
|
return freeze({ 'todo@1': freeze({ note }) });
|
|
@@ -264,12 +268,13 @@ export const isTodo = (value) => typeof value === 'object' &&
|
|
|
264
268
|
export const shippedValueKinds = Object.freeze(Object.keys(valueValidators));
|
|
265
269
|
/**
|
|
266
270
|
* The bridge from the settings-schema vocabulary (`{type:'integer', …}` on
|
|
267
|
-
* node-type slots) to value declarations
|
|
271
|
+
* node-type slots) to value declarations. Derived at read, never
|
|
268
272
|
* stored — no document or hash changes — so panels and controls can speak
|
|
269
273
|
* the value-decl contract while the schemas migrate underneath at their own
|
|
270
274
|
* pace. Unknown entry types map to nothing, and the caller keeps its
|
|
271
275
|
* legacy rendering for them.
|
|
272
276
|
* @experimental
|
|
277
|
+
* @ruling 24 T6c
|
|
273
278
|
*/
|
|
274
279
|
export function valueDeclOf(entry) {
|
|
275
280
|
const e = entry;
|
package/dist/variables.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Context variables as an open registry (
|
|
2
|
+
* Context variables as an open registry (ids namespaced, `core:` reserved).
|
|
3
3
|
*
|
|
4
4
|
* ## The inversion this exists to make
|
|
5
5
|
*
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
* `sample` is the other half. A preview that renders against real chat data
|
|
29
29
|
* needs a chat; a preview that renders against a declared sample needs nothing,
|
|
30
30
|
* which is what lets the template editor show output while you type.
|
|
31
|
+
* @ruling F2
|
|
31
32
|
*/
|
|
32
33
|
import type { I18n } from './descriptors.js';
|
|
33
34
|
import { type ScopeValues, type TemplateScope, type VarField, type VarValue } from './template.js';
|
|
@@ -58,13 +59,14 @@ export interface VariableDecl {
|
|
|
58
59
|
}
|
|
59
60
|
type IsUnion<T, U = T> = T extends unknown ? ([U] extends [T] ? false : true) : never;
|
|
60
61
|
/**
|
|
61
|
-
* What a declaration's `sample` must be, from its `scope
|
|
62
|
+
* What a declaration's `sample` must be, from its `scope`.
|
|
62
63
|
*
|
|
63
64
|
* One root — the usual case, `{ worldLore: … }` — and the sample is that
|
|
64
65
|
* root's value; several, and it is an object covering them (`sampleValues`).
|
|
65
66
|
* A scope the compiler cannot see into (`TemplateScope` itself, a widened
|
|
66
67
|
* `VarField`) leaves the sample `unknown`, exactly as before.
|
|
67
68
|
* @experimental
|
|
69
|
+
* @ruling typed templates P1
|
|
68
70
|
*/
|
|
69
71
|
export type VariableSample<S extends TemplateScope> = string extends keyof S ? unknown : true extends IsUnion<keyof S> ? ScopeValues<S> : VarValue<S[keyof S]>;
|
|
70
72
|
/**
|
|
@@ -114,11 +116,11 @@ export declare function _clearVariables(): void;
|
|
|
114
116
|
export declare function _withdrawVariable(id: VariableId): boolean;
|
|
115
117
|
/**
|
|
116
118
|
* What is wrong with a package's variable list, one sentence each — the check
|
|
117
|
-
* `defineExtension`, the packager and a host's install share
|
|
118
|
-
*
|
|
119
|
-
* reserved and another package's namespace is theirs (F2). A list naming one
|
|
119
|
+
* `defineExtension`, the packager and a host's install share. Every id sits under the package's own namespace: `core:` is
|
|
120
|
+
* reserved and another package's namespace is theirs. A list naming one
|
|
120
121
|
* id twice with different content is refused — an id means one thing.
|
|
121
122
|
* @experimental
|
|
123
|
+
* @ruling typed templates (2026-09-27), F2
|
|
122
124
|
*/
|
|
123
125
|
export declare function pluginVariableFindings(slug: string, raw: unknown, at?: string): string[];
|
|
124
126
|
/** @experimental */
|
|
@@ -198,6 +200,42 @@ export declare const varPersonaNames: VariableDecl & {
|
|
|
198
200
|
};
|
|
199
201
|
};
|
|
200
202
|
};
|
|
203
|
+
/**
|
|
204
|
+
* 🚧 Everyone on stage's **likeness prompt**:
|
|
205
|
+
* the tag line each card carries for drawing them — the switched-on cast,
|
|
206
|
+
* then the personas. The group answer for a picture prompt: a scene names
|
|
207
|
+
* each present character's look.
|
|
208
|
+
*
|
|
209
|
+
* Not the description (prose for the language model) and not the avatar.
|
|
210
|
+
* `prompt` is an empty string for a character whose card has none, so the
|
|
211
|
+
* list always names everyone present. A list of objects, so it gets the
|
|
212
|
+
* automatic JSON layout (`objectVariableLayouts.ts` in the host).
|
|
213
|
+
* @experimental
|
|
214
|
+
*/
|
|
215
|
+
export declare const varLikenesses: VariableDecl & {
|
|
216
|
+
scope: {
|
|
217
|
+
likenesses: {
|
|
218
|
+
type: "list";
|
|
219
|
+
of: {
|
|
220
|
+
type: "object";
|
|
221
|
+
fields: {
|
|
222
|
+
name: {
|
|
223
|
+
type: "string";
|
|
224
|
+
description: {
|
|
225
|
+
en: string;
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
prompt: {
|
|
229
|
+
type: "string";
|
|
230
|
+
description: {
|
|
231
|
+
en: string;
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
};
|
|
201
239
|
/** @experimental */
|
|
202
240
|
export declare const varWorldLore: VariableDecl & {
|
|
203
241
|
scope: {
|
|
@@ -245,7 +283,7 @@ export declare const varDocsExcerpts: VariableDecl & {
|
|
|
245
283
|
/**
|
|
246
284
|
* Recalled lines — older transcript lines found again because they name what
|
|
247
285
|
* the current context names: the band `core:query/entity-search@1` publishes
|
|
248
|
-
* on its `messages` out-port (declared 2026-09-27
|
|
286
|
+
* on its `messages` out-port (declared 2026-09-27).
|
|
249
287
|
*
|
|
250
288
|
* Its own band, not `messages`: the transcript renders from the recent
|
|
251
289
|
* window (`sessionMessages`), so a recalled line in the transcript's band was
|
|
@@ -259,8 +297,9 @@ export declare const varDocsExcerpts: VariableDecl & {
|
|
|
259
297
|
* that names the transcript's own lines.
|
|
260
298
|
*
|
|
261
299
|
* Not *recall* the measurement (precision/recall): a **recalled line** is a
|
|
262
|
-
* line, and the qualifier is what keeps the two apart
|
|
300
|
+
* line, and the qualifier is what keeps the two apart.
|
|
263
301
|
* @experimental
|
|
302
|
+
* @ruling owner ruling option b, R3
|
|
264
303
|
*/
|
|
265
304
|
export declare const varRecalledLines: VariableDecl & {
|
|
266
305
|
scope: {
|
package/dist/variables.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Context variables as an open registry (
|
|
2
|
+
* Context variables as an open registry (ids namespaced, `core:` reserved).
|
|
3
3
|
*
|
|
4
4
|
* ## The inversion this exists to make
|
|
5
5
|
*
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
* `sample` is the other half. A preview that renders against real chat data
|
|
29
29
|
* needs a chat; a preview that renders against a declared sample needs nothing,
|
|
30
30
|
* which is what lets the template editor show output while you type.
|
|
31
|
+
* @ruling F2
|
|
31
32
|
*/
|
|
32
33
|
import { checkScopeSample, } from './template.js';
|
|
33
34
|
import { refuseUnlessIdentical } from './hash.js';
|
|
@@ -84,11 +85,11 @@ export function _withdrawVariable(id) {
|
|
|
84
85
|
}
|
|
85
86
|
/**
|
|
86
87
|
* What is wrong with a package's variable list, one sentence each — the check
|
|
87
|
-
* `defineExtension`, the packager and a host's install share
|
|
88
|
-
*
|
|
89
|
-
* reserved and another package's namespace is theirs (F2). A list naming one
|
|
88
|
+
* `defineExtension`, the packager and a host's install share. Every id sits under the package's own namespace: `core:` is
|
|
89
|
+
* reserved and another package's namespace is theirs. A list naming one
|
|
90
90
|
* id twice with different content is refused — an id means one thing.
|
|
91
91
|
* @experimental
|
|
92
|
+
* @ruling typed templates (2026-09-27), F2
|
|
92
93
|
*/
|
|
93
94
|
export function pluginVariableFindings(slug, raw, at = 'variables') {
|
|
94
95
|
if (raw === undefined)
|
|
@@ -164,6 +165,49 @@ const CHARACTER_CARD = {
|
|
|
164
165
|
optional: true,
|
|
165
166
|
description: { en: 'How they behave. Absent for a non-speaker when the session shows brief character detail.' },
|
|
166
167
|
},
|
|
168
|
+
/**
|
|
169
|
+
* The card's strokes, resolved (strokes.ts) — widened in place, ruled
|
|
170
|
+
* 2026-10-11, rather than an `@2`: optional, so every template written
|
|
171
|
+
* against the four fields reads the same card.
|
|
172
|
+
*
|
|
173
|
+
* Present only when the card is painted in strokes and a
|
|
174
|
+
* `core:task/card-strokes@1` step ran; `description`/`personality`
|
|
175
|
+
* above are then already compiled from the `always` + fired ones. Here
|
|
176
|
+
* so a template can iterate them or pick one by slug. `off` strokes
|
|
177
|
+
* never appear; `brief` detail drops personality strokes as it drops
|
|
178
|
+
* the field.
|
|
179
|
+
*/
|
|
180
|
+
strokes: {
|
|
181
|
+
type: 'list',
|
|
182
|
+
optional: true,
|
|
183
|
+
description: { en: 'The card in pieces, when it is written in strokes, in order.' },
|
|
184
|
+
of: {
|
|
185
|
+
type: 'object',
|
|
186
|
+
fields: {
|
|
187
|
+
kind: {
|
|
188
|
+
type: 'string',
|
|
189
|
+
description: { en: "Which field the stroke paints: 'description' or 'personality'." },
|
|
190
|
+
},
|
|
191
|
+
slug: {
|
|
192
|
+
type: 'string',
|
|
193
|
+
optional: true,
|
|
194
|
+
description: { en: 'Its key, for picking one stroke out by name.' },
|
|
195
|
+
},
|
|
196
|
+
label: {
|
|
197
|
+
type: 'string',
|
|
198
|
+
optional: true,
|
|
199
|
+
description: { en: 'Its heading — "Eyes" in "Eyes: green".' },
|
|
200
|
+
},
|
|
201
|
+
text: { type: 'string', description: { en: 'The stroke itself.' } },
|
|
202
|
+
fired: {
|
|
203
|
+
type: 'boolean',
|
|
204
|
+
description: {
|
|
205
|
+
en: 'Whether it is in this prompt: always for an every-turn stroke, and for a keyword stroke whether a key appeared in the recent conversation.',
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
},
|
|
167
211
|
},
|
|
168
212
|
};
|
|
169
213
|
const ash = {
|
|
@@ -279,6 +323,42 @@ export const varPersonaNames = defineVariable({
|
|
|
279
323
|
scope: { personaNames: { type: 'string' } },
|
|
280
324
|
sample: 'Rell',
|
|
281
325
|
});
|
|
326
|
+
/**
|
|
327
|
+
* 🚧 Everyone on stage's **likeness prompt**:
|
|
328
|
+
* the tag line each card carries for drawing them — the switched-on cast,
|
|
329
|
+
* then the personas. The group answer for a picture prompt: a scene names
|
|
330
|
+
* each present character's look.
|
|
331
|
+
*
|
|
332
|
+
* Not the description (prose for the language model) and not the avatar.
|
|
333
|
+
* `prompt` is an empty string for a character whose card has none, so the
|
|
334
|
+
* list always names everyone present. A list of objects, so it gets the
|
|
335
|
+
* automatic JSON layout (`objectVariableLayouts.ts` in the host).
|
|
336
|
+
* @experimental
|
|
337
|
+
*/
|
|
338
|
+
export const varLikenesses = defineVariable({
|
|
339
|
+
id: 'core:var/likenesses@1',
|
|
340
|
+
i18n: { name: { en: 'Likenesses' } },
|
|
341
|
+
description: { en: "How to draw everyone in the scene: each one's likeness prompt, by name." },
|
|
342
|
+
scope: {
|
|
343
|
+
likenesses: {
|
|
344
|
+
type: 'list',
|
|
345
|
+
of: {
|
|
346
|
+
type: 'object',
|
|
347
|
+
fields: {
|
|
348
|
+
name: { type: 'string', description: { en: 'Who this is.' } },
|
|
349
|
+
prompt: {
|
|
350
|
+
type: 'string',
|
|
351
|
+
description: { en: "Their likeness prompt — a tag line of their look; empty when the card has none." },
|
|
352
|
+
},
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
sample: [
|
|
358
|
+
{ name: 'Ash', prompt: 'adult woman, red braid, green cloak, freckles' },
|
|
359
|
+
{ name: 'Rell', prompt: '' },
|
|
360
|
+
],
|
|
361
|
+
});
|
|
282
362
|
// ── Produced during assembly ────────────────────────────────────────────────
|
|
283
363
|
//
|
|
284
364
|
// These come out the other side of the budget, so what reaches a layout
|
|
@@ -346,7 +426,7 @@ export const varDocsExcerpts = defineVariable({
|
|
|
346
426
|
/**
|
|
347
427
|
* Recalled lines — older transcript lines found again because they name what
|
|
348
428
|
* the current context names: the band `core:query/entity-search@1` publishes
|
|
349
|
-
* on its `messages` out-port (declared 2026-09-27
|
|
429
|
+
* on its `messages` out-port (declared 2026-09-27).
|
|
350
430
|
*
|
|
351
431
|
* Its own band, not `messages`: the transcript renders from the recent
|
|
352
432
|
* window (`sessionMessages`), so a recalled line in the transcript's band was
|
|
@@ -360,8 +440,9 @@ export const varDocsExcerpts = defineVariable({
|
|
|
360
440
|
* that names the transcript's own lines.
|
|
361
441
|
*
|
|
362
442
|
* Not *recall* the measurement (precision/recall): a **recalled line** is a
|
|
363
|
-
* line, and the qualifier is what keeps the two apart
|
|
443
|
+
* line, and the qualifier is what keeps the two apart.
|
|
364
444
|
* @experimental
|
|
445
|
+
* @ruling owner ruling option b, R3
|
|
365
446
|
*/
|
|
366
447
|
export const varRecalledLines = defineVariable({
|
|
367
448
|
id: 'core:var/recalled-lines@1',
|