@serene-pub/contracts 0.6.0-pr-4 → 0.6.0-pr-6
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/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/inlets.d.ts +295 -50
- package/dist/inlets.js +468 -55
- package/dist/oracles.d.ts +440 -19
- package/dist/oracles.js +425 -42
- package/dist/outlets.d.ts +583 -44
- package/dist/outlets.js +641 -60
- package/dist/queries.d.ts +323 -80
- package/dist/queries.js +330 -90
- package/dist/tasks.d.ts +1425 -179
- package/dist/tasks.js +1169 -148
- package/package.json +3 -3
package/dist/tasks.js
CHANGED
|
@@ -18,7 +18,7 @@ export const contextBudget = pin(describeTaskDefinition({
|
|
|
18
18
|
* Where the window comes from.
|
|
19
19
|
*
|
|
20
20
|
* The context window belongs to the sampling config, never to a knob
|
|
21
|
-
* on a node
|
|
21
|
+
* on a node — and the executor resolves a `sampling` slot to
|
|
22
22
|
* the config's switched-on *values*, so this stays a pure Task reading
|
|
23
23
|
* data it was handed rather than a Query looking one up.
|
|
24
24
|
*
|
|
@@ -29,14 +29,14 @@ export const contextBudget = pin(describeTaskDefinition({
|
|
|
29
29
|
sampling: { kind: 'sampling', quick: true },
|
|
30
30
|
/**
|
|
31
31
|
* The connection the reply is sent on — for the model's own
|
|
32
|
-
* context window
|
|
32
|
+
* context window, which caps the sampling config's when
|
|
33
33
|
* the model states one.
|
|
34
34
|
*
|
|
35
35
|
* Shared with the generating step in every shipped spec
|
|
36
36
|
* (`slot.connectionOf('generate')`), on the same terms as
|
|
37
37
|
* `sampling` above: the budget has to be sized to the window the
|
|
38
38
|
* request is actually sent against, and the ONE computation of
|
|
39
|
-
* that window
|
|
39
|
+
* that window reads both halves off the same resolved pair.
|
|
40
40
|
*/
|
|
41
41
|
connection: { kind: 'connection' },
|
|
42
42
|
params: {
|
|
@@ -59,7 +59,32 @@ export const contextBudget = pin(describeTaskDefinition({
|
|
|
59
59
|
},
|
|
60
60
|
},
|
|
61
61
|
},
|
|
62
|
-
ports: {
|
|
62
|
+
ports: {
|
|
63
|
+
/**
|
|
64
|
+
* 🚧 `blocks` (optional, 2026-10-16 — rulesets programme W3-S;
|
|
65
|
+
* additive, so `@1` evolves in place): labelled prompt blocks to fit
|
|
66
|
+
* into what `available` leaves — each `{ key, text, tokens,
|
|
67
|
+
* priority, depth, min, max, depths }`, where `depths` holds the
|
|
68
|
+
* block's text and tokens at each render depth it has (`full`,
|
|
69
|
+
* `summary`, `index`). The rule is **degrade depth before
|
|
70
|
+
* dropping**: under pressure the lowest-priority block steps down a
|
|
71
|
+
* depth (full → summary → index) before any block is dropped, and a
|
|
72
|
+
* block is dropped only at its shallowest depth, never below its
|
|
73
|
+
* `min`. `fittedBlocks` is the same records at the depth each
|
|
74
|
+
* landed on, dropped ones left out; absent `blocks`, it is absent.
|
|
75
|
+
*/
|
|
76
|
+
in: { blocks: S.json },
|
|
77
|
+
/**
|
|
78
|
+
* 🚧 `reads` (O9, 2026-10-21; additive, `@1` evolves in place):
|
|
79
|
+
* what the pair behind `connection` reads, by media kind — the
|
|
80
|
+
* same `ConnectionReadsV1` placement reads off its own slot. The
|
|
81
|
+
* budget already resolves that pair for its window, so a step that
|
|
82
|
+
* must know what the call can hear BEFORE placement (the
|
|
83
|
+
* transcribe step) reads it here rather than resolving the call's
|
|
84
|
+
* pair a second time. Null for an unwired slot.
|
|
85
|
+
*/
|
|
86
|
+
out: { main: S.budget, available: S.budget, fittedBlocks: S.json, reads: S.json },
|
|
87
|
+
},
|
|
63
88
|
}));
|
|
64
89
|
/**
|
|
65
90
|
* Fuse two mechanisms that answered the same question into one ordering.
|
|
@@ -140,7 +165,7 @@ export const concatCandidates = pin(describeTaskDefinition({
|
|
|
140
165
|
}));
|
|
141
166
|
/**
|
|
142
167
|
* **Eligibility** — the hard gates between the mechanisms and the ranker
|
|
143
|
-
* (
|
|
168
|
+
* (owner rulings of 2026-09-30; built 2026-10-02).
|
|
144
169
|
*
|
|
145
170
|
* Scoring and eligibility are separate on purpose: a hard rule must not compete
|
|
146
171
|
* numerically with a soft one and lose. This node scores nothing. It takes the
|
|
@@ -158,7 +183,7 @@ export const concatCandidates = pin(describeTaskDefinition({
|
|
|
158
183
|
* 2. **Secrecy.** A `relationships` candidate that is somebody's secret
|
|
159
184
|
* (`payload.secretOf`, the holder's participant reference) is ineligible for
|
|
160
185
|
* any other `speaker`. Unwired or null, the producers' own scope decided.
|
|
161
|
-
* 3. **Presence
|
|
186
|
+
* 3. **Presence.** A candidate about a cast member (`payload.lorebookBindingId`)
|
|
162
187
|
* whose member has presences on the line and none holding at `at` — the
|
|
163
188
|
* member is not in the world then. A member with no presences is always
|
|
164
189
|
* present.
|
|
@@ -210,9 +235,9 @@ const rankPorts = {
|
|
|
210
235
|
* A declared out-port rather than an implementation detail, because it is
|
|
211
236
|
* what Assemble allocates from — and because a ranker swapped in by a
|
|
212
237
|
* plugin has to produce it too, or the budget panel goes blank the moment
|
|
213
|
-
* anyone changes rankers
|
|
238
|
+
* anyone changes rankers.
|
|
214
239
|
*
|
|
215
|
-
* Shape `S.decisions
|
|
240
|
+
* Shape `S.decisions`: a node publishing it is recorded in the
|
|
216
241
|
* ranking store automatically — a plugin's ranker included.
|
|
217
242
|
*/
|
|
218
243
|
decisions: S.decisions,
|
|
@@ -223,7 +248,7 @@ const rankPorts = {
|
|
|
223
248
|
* **signal** matrix, which is cross-source and stays here.
|
|
224
249
|
*
|
|
225
250
|
* ⚠ No longer the members of `share` / `maxEntries` / `minEntries`: those are
|
|
226
|
-
* per-source and live on the sources (
|
|
251
|
+
* per-source and live on the sources (`bandIntentFields`), so a plugin
|
|
227
252
|
* adding a sixth band declares its own intent on its own definition and never
|
|
228
253
|
* touches this list. Its candidates score by `presetScore` or by the ranker's
|
|
229
254
|
* lore signal set — a per-band signal row for a plugin band is a follow-up,
|
|
@@ -264,9 +289,9 @@ const SOURCES = [
|
|
|
264
289
|
];
|
|
265
290
|
/**
|
|
266
291
|
* How the shares the sources declared are turned into token budgets — the one
|
|
267
|
-
* thing about shares that is genuinely the ranker's (
|
|
268
|
-
*
|
|
269
|
-
*
|
|
292
|
+
* thing about shares that is genuinely the ranker's (Assemble keeps only what
|
|
293
|
+
* is genuinely global: total budget, truncation policy, and how weights
|
|
294
|
+
* normalize).
|
|
270
295
|
*
|
|
271
296
|
* `relative` is what ships and is arithmetically what has always run: every
|
|
272
297
|
* band with a share above zero gets `pool × share / Σ shares`, so only the
|
|
@@ -276,10 +301,10 @@ const SOURCES = [
|
|
|
276
301
|
* scales them all down together only when they add up to more than one. In
|
|
277
302
|
* both, whatever a band cannot spend is swept to the others in score order.
|
|
278
303
|
*
|
|
279
|
-
* ⚠ **The per-source maps this file used to declare here are gone**
|
|
280
|
-
* 2026-09-16). `share`, `maxEntries` and `minEntries` — five-band maps keyed
|
|
281
|
-
* `{messages, worldLore, characterLore, history, relationships}` — were
|
|
282
|
-
* per-source table
|
|
304
|
+
* ⚠ **The per-source maps this file used to declare here are gone**
|
|
305
|
+
* (2026-09-16). `share`, `maxEntries` and `minEntries` — five-band maps keyed
|
|
306
|
+
* `{messages, worldLore, characterLore, history, relationships}` — were a
|
|
307
|
+
* per-source table the design rejects, kept on the ranker rather than on
|
|
283
308
|
* Assemble. Each source declares its own now (`bandIntentFields`) and the
|
|
284
309
|
* ranker reads them off the candidates it is handed (`BandIntent` in the SDK);
|
|
285
310
|
* migration 0135 moved every stored value to the node that owns it. What is
|
|
@@ -330,8 +355,8 @@ const SHARE_NORMALISATION = {
|
|
|
330
355
|
* not "cannot apply": the scorer has no per-source branches, so turning
|
|
331
356
|
* `nameMatch` on for messages is moving a slider, not asking for a feature.
|
|
332
357
|
*
|
|
333
|
-
* On `rank-hybrid` alone, like its `scripts` hook and for the same reason
|
|
334
|
-
*
|
|
358
|
+
* On `rank-hybrid` alone, like its `scripts` hook and for the same reason:
|
|
359
|
+
* the `rank-recall` example ranks without signals, and widening a
|
|
335
360
|
* sibling's declared surface is a hash change on a type nobody meant to touch.
|
|
336
361
|
*/
|
|
337
362
|
const SIGNAL_WEIGHT_FIELDS = {
|
|
@@ -374,8 +399,8 @@ const SIGNAL_WEIGHT_FIELDS = {
|
|
|
374
399
|
* by construction, so the first question scores every present character's
|
|
375
400
|
* private lore alike and distinguishes nothing.
|
|
376
401
|
*
|
|
377
|
-
* ⚠ **The world-lore half is graded now, and this weight moved with it
|
|
378
|
-
*
|
|
402
|
+
* ⚠ **The world-lore half is graded now, and this weight moved with it**.
|
|
403
|
+
* It used to be a binary substring
|
|
379
404
|
* test — does the entry's title or keys contain a cast name, `Al` firing on
|
|
380
405
|
* `Alchemy` — worth exactly `{0, 0.2}`. It is now the rarity-weighted,
|
|
381
406
|
* word-boundary, two-sided overlap the admission gate already used: what the
|
|
@@ -611,7 +636,7 @@ const SIGNAL_WEIGHT_FIELDS = {
|
|
|
611
636
|
},
|
|
612
637
|
};
|
|
613
638
|
/**
|
|
614
|
-
* How much each way of *finding* an entry counts
|
|
639
|
+
* How much each way of *finding* an entry counts.
|
|
615
640
|
*
|
|
616
641
|
* The signal weights above are the right data at the wrong altitude.
|
|
617
642
|
* Nobody thinks in "tf-idf", and a reader who wants less guessing and more
|
|
@@ -646,7 +671,7 @@ const SIGNAL_WEIGHT_FIELDS = {
|
|
|
646
671
|
* to say "keys only" or "stop guessing" — and is a thing to want.
|
|
647
672
|
*
|
|
648
673
|
* On `rank-hybrid` alone, like the signal matrix and `scoreLedAllocation` and for
|
|
649
|
-
* the same reason
|
|
674
|
+
* the same reason: the `rank-recall` example does not score with signals,
|
|
650
675
|
* and widening a sibling's declared surface is a hash change on a type nobody
|
|
651
676
|
* meant to touch.
|
|
652
677
|
*/
|
|
@@ -688,13 +713,13 @@ const MECHANISM_WEIGHTS = {
|
|
|
688
713
|
},
|
|
689
714
|
};
|
|
690
715
|
/**
|
|
691
|
-
* Which allocation precedence the selection runs under
|
|
716
|
+
* Which allocation precedence the selection runs under.
|
|
692
717
|
*
|
|
693
718
|
* Off is what ships, and off is the shipped engine exactly: the shares split
|
|
694
719
|
* the window into fixed bands and each source fills its own. A turn that needs
|
|
695
720
|
* no history still reserves history's band, and one relevant world-lore entry
|
|
696
721
|
* larger than a sixth of the window cannot be kept however it scored — which is
|
|
697
|
-
* the
|
|
722
|
+
* the precedence the design calls backwards.
|
|
698
723
|
*
|
|
699
724
|
* On, the precedence inverts to *score allocates, minimums guarantee, shares
|
|
700
725
|
* cap*: the minimums are met first exactly as before, then one pool is spent
|
|
@@ -719,7 +744,7 @@ const MECHANISM_WEIGHTS = {
|
|
|
719
744
|
* is what leaves the parity corpus measuring the shipped path.
|
|
720
745
|
*
|
|
721
746
|
* On `rank-hybrid` alone, like the signal matrix and the `scripts` hook and for
|
|
722
|
-
* the same reason
|
|
747
|
+
* the same reason: the `rank-recall` example does not run this selection,
|
|
723
748
|
* and widening a sibling's declared surface is a hash change on a type nobody
|
|
724
749
|
* meant to touch.
|
|
725
750
|
*/
|
|
@@ -740,7 +765,7 @@ export const rankHybrid = pin(describeTaskDefinition({
|
|
|
740
765
|
kind: 'parameters',
|
|
741
766
|
facet: 'weights',
|
|
742
767
|
schema: {
|
|
743
|
-
// Cross-source only
|
|
768
|
+
// Cross-source only. Ahead of the nine, because it
|
|
744
769
|
// is the altitude a reader starts at: the grouped mechanisms
|
|
745
770
|
// first, the individual signals under them for anyone who
|
|
746
771
|
// wants that far in, then how the sources' shares divide
|
|
@@ -752,10 +777,10 @@ export const rankHybrid = pin(describeTaskDefinition({
|
|
|
752
777
|
},
|
|
753
778
|
},
|
|
754
779
|
/**
|
|
755
|
-
* The post-retrieval hook
|
|
780
|
+
* The post-retrieval hook: user chains over the candidate
|
|
756
781
|
* pool before ranking sees it. Spread onto this type alone rather
|
|
757
782
|
* than into `rankSlots` — widening a sibling's accepted set is a
|
|
758
|
-
* hash change on a type nobody meant to touch
|
|
783
|
+
* hash change on a type nobody meant to touch.
|
|
759
784
|
*/
|
|
760
785
|
scripts: {
|
|
761
786
|
kind: 'scripts',
|
|
@@ -802,8 +827,8 @@ export const rankHybrid = pin(describeTaskDefinition({
|
|
|
802
827
|
* while the numbers sat one node upstream.
|
|
803
828
|
*
|
|
804
829
|
* Spread onto this type alone rather than into `rankPorts` —
|
|
805
|
-
* the same reason the `scripts` hook above is, one construct up
|
|
806
|
-
*
|
|
830
|
+
* the same reason the `scripts` hook above is, one construct up.
|
|
831
|
+
* The `rank-recall` example computes no per-band usage;
|
|
807
832
|
* giving it a port it cannot fill would move a hash to declare
|
|
808
833
|
* a promise it does not keep.
|
|
809
834
|
*
|
|
@@ -827,8 +852,8 @@ export const rankHybrid = pin(describeTaskDefinition({
|
|
|
827
852
|
* first.
|
|
828
853
|
*
|
|
829
854
|
* And it carries the **semantic mechanism's one switch**, `searchByMeaning`,
|
|
830
|
-
* because it is the first node of the mechanism's chain (2026-09-29
|
|
831
|
-
*
|
|
855
|
+
* because it is the first node of the mechanism's chain (2026-09-29) —
|
|
856
|
+
* `auto | on | off`, shipping `auto`, which searches whenever an
|
|
832
857
|
* embedding model is set up, wherever it runs (owner, 2026-09-30).
|
|
833
858
|
* @experimental
|
|
834
859
|
*/
|
|
@@ -906,7 +931,7 @@ export const queryWindows = pin(describeTaskDefinition({
|
|
|
906
931
|
* per turn in API mode. `maxEntries` is a ceiling now, and
|
|
907
932
|
* ships non-zero so that turning this on does something.
|
|
908
933
|
* It was then a boolean defaulting to off for one day
|
|
909
|
-
* (
|
|
934
|
+
* (2026-09-29), which spent nothing and searched nothing.
|
|
910
935
|
*/
|
|
911
936
|
searchByMeaning: {
|
|
912
937
|
type: 'enum',
|
|
@@ -971,7 +996,7 @@ export const queryWindows = pin(describeTaskDefinition({
|
|
|
971
996
|
* to replace. The Query retrieves and computes similarity; this decides.
|
|
972
997
|
*
|
|
973
998
|
* `similarity` is a port because MMR needs to compare candidates to each other
|
|
974
|
-
* and a Task cannot ask the host for anything
|
|
999
|
+
* and a Task cannot ask the host for anything. It is a matrix of cosines,
|
|
975
1000
|
* not the embeddings — derived, bounded, and not reversible into the vectors.
|
|
976
1001
|
* @experimental
|
|
977
1002
|
*/
|
|
@@ -986,7 +1011,7 @@ export const rankSemantic = pin(describeTaskDefinition({
|
|
|
986
1011
|
schema: {
|
|
987
1012
|
/**
|
|
988
1013
|
* ⚠ No `currentWindow` / `recentWindow` here, and there
|
|
989
|
-
* were (culled 2026-09-16
|
|
1014
|
+
* were (culled 2026-09-16). They size the two query
|
|
990
1015
|
* windows — how many messages form the 'current' and the
|
|
991
1016
|
* 'recent' question — which `core:task/query-windows@1`
|
|
992
1017
|
* cuts and declares as its own params. Declared here too,
|
|
@@ -1103,7 +1128,7 @@ export const rankSemantic = pin(describeTaskDefinition({
|
|
|
1103
1128
|
},
|
|
1104
1129
|
}));
|
|
1105
1130
|
/**
|
|
1106
|
-
* A plugin's ranker — same kind, same shape, so the swap list offers it
|
|
1131
|
+
* A plugin's ranker — same kind, same shape, so the swap list offers it.
|
|
1107
1132
|
*
|
|
1108
1133
|
* Named `rankRecall`, not `rankSemantic`: binding names derive from the id's
|
|
1109
1134
|
* name segment and ignore the namespace, so this and `core:task/rank-semantic@1`
|
|
@@ -1141,8 +1166,7 @@ const ASSEMBLE_TEMPLATE_SCOPE = {
|
|
|
1141
1166
|
name: { type: 'string' },
|
|
1142
1167
|
message: { type: 'string', optional: true },
|
|
1143
1168
|
/**
|
|
1144
|
-
* 🚧 The line's files, placed
|
|
1145
|
-
* §3.5): media markers, inlined text files and placeholders,
|
|
1169
|
+
* 🚧 The line's files, placed: media markers, inlined text files and placeholders,
|
|
1146
1170
|
* from `core:task/place-attachments@1`. Absent on a line
|
|
1147
1171
|
* with no files, and on every line of a spec with no
|
|
1148
1172
|
* placement step.
|
|
@@ -1181,7 +1205,7 @@ const ASSEMBLE_TEMPLATE_SCOPE = {
|
|
|
1181
1205
|
},
|
|
1182
1206
|
},
|
|
1183
1207
|
/**
|
|
1184
|
-
* 🚧 The session's **author's note**, placed (2026-10-02
|
|
1208
|
+
* 🚧 The session's **author's note**, placed (2026-10-02) — the
|
|
1185
1209
|
* person's own steering text for this session, at its own depth, with no
|
|
1186
1210
|
* token trigger. Not the post-history reminder: that one is the pipeline's
|
|
1187
1211
|
* and the card's "how to respond"; this is the person's "what is true now".
|
|
@@ -1205,7 +1229,7 @@ export const assemble = pin(describeTaskDefinition({
|
|
|
1205
1229
|
timeoutMs: 1000,
|
|
1206
1230
|
slots: {
|
|
1207
1231
|
// An *assembly* template: its scope really is the input ports, so this half of
|
|
1208
|
-
//
|
|
1232
|
+
// the claim holds.
|
|
1209
1233
|
template: {
|
|
1210
1234
|
kind: 'template',
|
|
1211
1235
|
// Handlebars FIRST, then Liquid: the first entry is what a new
|
|
@@ -1215,14 +1239,14 @@ export const assemble = pin(describeTaskDefinition({
|
|
|
1215
1239
|
// layout, not a dialect: the same arrangement is expressible in
|
|
1216
1240
|
// either, and a slot naming one makes the other unselectable
|
|
1217
1241
|
// everywhere. Jinja is absent because core renders neither
|
|
1218
|
-
// parity nor helpers for it
|
|
1242
|
+
// parity nor helpers for it.
|
|
1219
1243
|
acceptedEngines: [handlebars.id, liquid.id],
|
|
1220
1244
|
facet: 'templates',
|
|
1221
1245
|
/**
|
|
1222
1246
|
* Assemble's own names — what `render()` writes onto the context
|
|
1223
1247
|
* AFTER spreading the prompts and the builder's context, so these
|
|
1224
|
-
* are the last word (typed templates
|
|
1225
|
-
* ruling
|
|
1248
|
+
* are the last word (typed templates, edited in place by owner
|
|
1249
|
+
* ruling).
|
|
1226
1250
|
*
|
|
1227
1251
|
* Corrected 2026-09-27: this declared `blocks`, `budget` as two
|
|
1228
1252
|
* bare names and `prompts` — `blocks` is a param that reorders the
|
|
@@ -1263,7 +1287,7 @@ export const assemble = pin(describeTaskDefinition({
|
|
|
1263
1287
|
currentDate: 'core:var/current-date@1',
|
|
1264
1288
|
},
|
|
1265
1289
|
/**
|
|
1266
|
-
* Open (typed templates
|
|
1290
|
+
* Open (typed templates, edited in place by owner ruling):
|
|
1267
1291
|
* every band declared upstream of `candidates` is rendered too,
|
|
1268
1292
|
* under its key and through its variable's layout — a plugin's
|
|
1269
1293
|
* source adds its band here by declaring it.
|
|
@@ -1309,16 +1333,16 @@ export const assemble = pin(describeTaskDefinition({
|
|
|
1309
1333
|
* ⚠ No `truncation` here, and there was one — an enum of
|
|
1310
1334
|
* `oldest-first | lowest-weight`, "what gets dropped first
|
|
1311
1335
|
* when the context is over budget" — declared, rendered,
|
|
1312
|
-
* and read by nothing (culled 2026-09-16
|
|
1336
|
+
* and read by nothing (culled 2026-09-16). What LORE
|
|
1313
1337
|
* fits is decided upstream by the ranker's `select`, per
|
|
1314
1338
|
* band, against `share`, `maxEntries`, `minEntries` and
|
|
1315
1339
|
* `scoreLedAllocation` on `core:task/rank-hybrid@1`, and
|
|
1316
1340
|
* this node renders the decisions it is handed. A second
|
|
1317
1341
|
* drop rule for lore here would be a second owner of one
|
|
1318
|
-
* decision.
|
|
1342
|
+
* decision.
|
|
1319
1343
|
*
|
|
1320
1344
|
* ⚠ The TRANSCRIPT is the exception, because nobody else
|
|
1321
|
-
* owns it (
|
|
1345
|
+
* owns it (2026-10-03): no shipped spec ranks a message
|
|
1322
1346
|
* candidate, so the conversation's rows were never fitted
|
|
1323
1347
|
* at all and a long session went out larger than the
|
|
1324
1348
|
* window. The host's binding measures what it rendered and,
|
|
@@ -1403,7 +1427,7 @@ export const assemble = pin(describeTaskDefinition({
|
|
|
1403
1427
|
* shape on this edge got no finding, and a plugin ASSEMBLER had
|
|
1404
1428
|
* nothing to read to learn the port existed.
|
|
1405
1429
|
*
|
|
1406
|
-
* `S.decisions`, matching `rankPorts.out.decisions`
|
|
1430
|
+
* `S.decisions`, matching `rankPorts.out.decisions` — a
|
|
1407
1431
|
* decision is a candidate with its arithmetic attached, and the
|
|
1408
1432
|
* panel reads the same objects the allocator does. Typed, so a
|
|
1409
1433
|
* plugin ranker wired here publishes the shape the ranking store
|
|
@@ -1448,15 +1472,15 @@ export const assemble = pin(describeTaskDefinition({
|
|
|
1448
1472
|
groups: S.json,
|
|
1449
1473
|
/**
|
|
1450
1474
|
* The annex a template may read, as `annex.<owner>.<key>`
|
|
1451
|
-
* (typed templates
|
|
1475
|
+
* (typed templates, edited in place by owner ruling).
|
|
1452
1476
|
*
|
|
1453
1477
|
* Fed ONLY by `core:query/session-annex@1` with `view:
|
|
1454
1478
|
* 'template'`: every DECLARED key of every owner in scope —
|
|
1455
1479
|
* core, the enabled plugins — for the session's genre, keyed by
|
|
1456
1480
|
* owner. A key no declaration covers never arrives, and a
|
|
1457
|
-
* declaration refuses secrets at write time
|
|
1481
|
+
* declaration refuses secrets at write time, so what
|
|
1458
1482
|
* reaches a template is what an owner said may be kept there
|
|
1459
|
-
* (owner ruling
|
|
1483
|
+
* (owner ruling: "nothing dangerous should ever be stored
|
|
1460
1484
|
* there"). Law T2 refuses anything else wired here, and a
|
|
1461
1485
|
* template-view read wired anywhere else.
|
|
1462
1486
|
*
|
|
@@ -1478,7 +1502,7 @@ const contextPorts = {
|
|
|
1478
1502
|
in: {
|
|
1479
1503
|
cast: S.sessionCast,
|
|
1480
1504
|
/**
|
|
1481
|
-
* Whose voice the reply is, when a next-speaker node decided
|
|
1505
|
+
* Whose voice the reply is, when a next-speaker node decided.
|
|
1482
1506
|
* Optional: unwired, the speaker still rides the cast bundle (the
|
|
1483
1507
|
* scope's value), which is how every spec worked before the node
|
|
1484
1508
|
* existed — and how the narrator's context, which has no speaker,
|
|
@@ -1522,7 +1546,7 @@ const PROMPTS_DESCRIPTION = 'The written instructions this pipeline sends the mo
|
|
|
1522
1546
|
const VARIABLES_DESCRIPTION = 'How each part of the prompt is laid out — JSON, prose, or whatever you write. Duplicate one to change it.';
|
|
1523
1547
|
/**
|
|
1524
1548
|
* What a context builder's `templateContext` carries, in the template type
|
|
1525
|
-
* language (typed templates
|
|
1549
|
+
* language (typed templates, 2026-09-27) — so a template editor offers
|
|
1526
1550
|
* `{{{characters}}}` with a type, and `templateScopeAt` puts these keys in
|
|
1527
1551
|
* the scope of whatever template renders the builder's output.
|
|
1528
1552
|
*
|
|
@@ -1552,6 +1576,8 @@ export const TEMPLATE_CONTEXT_SCHEMA = {
|
|
|
1552
1576
|
scenario: { type: 'string', description: 'The scenario, resolved and laid out.' },
|
|
1553
1577
|
characterNames: { type: 'string', description: '“A, B, and C” — every enabled character’s name (none at speaker-only detail).' },
|
|
1554
1578
|
personaNames: { type: 'string', description: '“A, B, and C” — every persona’s name.' },
|
|
1579
|
+
/** 🚧 `core:var/likenesses@1` — everyone on stage's likeness prompt, laid out. */
|
|
1580
|
+
likenesses: { type: 'string', description: 'Everyone on stage’s likeness prompt, by name, laid out (JSON by default).' },
|
|
1555
1581
|
exampleDialogue: { type: 'string', description: 'The speaker’s example dialogue.' },
|
|
1556
1582
|
postHistoryInstructions: { type: 'string', description: 'The post-history instructions, resolved.' },
|
|
1557
1583
|
relationshipsPerspectives: { type: 'string', description: 'How the speaker regards everyone.' },
|
|
@@ -1611,6 +1637,8 @@ const sharedRenders = {
|
|
|
1611
1637
|
postHistoryInstructions: 'core:var/post-history-instructions@1',
|
|
1612
1638
|
characterNames: 'core:var/character-names@1',
|
|
1613
1639
|
personaNames: 'core:var/persona-names@1',
|
|
1640
|
+
/** 🚧 Everyone on stage's likeness prompt. */
|
|
1641
|
+
likenesses: 'core:var/likenesses@1',
|
|
1614
1642
|
};
|
|
1615
1643
|
/**
|
|
1616
1644
|
* The reply pipeline's context builder.
|
|
@@ -1626,7 +1654,7 @@ const sharedRenders = {
|
|
|
1626
1654
|
*
|
|
1627
1655
|
* A type is the unit that declares a configurable surface — it is how a plugin
|
|
1628
1656
|
* declares one, and `RegistryEntry.slots` carries the declaration precisely so
|
|
1629
|
-
* core can render a form without executing the plugin that owns it
|
|
1657
|
+
* core can render a form without executing the plugin that owns it.
|
|
1630
1658
|
* Narrowing per-spec instead would have meant the row said one thing and the
|
|
1631
1659
|
* running pipeline another, which is the defect widening that column fixed.
|
|
1632
1660
|
*
|
|
@@ -1638,7 +1666,7 @@ export const buildTemplateContext = pin(describeTaskDefinition({
|
|
|
1638
1666
|
id: 'core:task/build-template-context@1',
|
|
1639
1667
|
i18n: { name: { en: 'Build template context' } },
|
|
1640
1668
|
timeoutMs: 2000,
|
|
1641
|
-
/** What `templateContext` carries — typed templates
|
|
1669
|
+
/** What `templateContext` carries — typed templates; policy, so no pin moves. */
|
|
1642
1670
|
portSchemas: { out: { main: TEMPLATE_CONTEXT_SCHEMA, templateContext: TEMPLATE_CONTEXT_SCHEMA } },
|
|
1643
1671
|
/**
|
|
1644
1672
|
* The example-dialogue pick. Declaring it is what gets `ctx.random` — the
|
|
@@ -1684,7 +1712,7 @@ export const buildTemplateContext = pin(describeTaskDefinition({
|
|
|
1684
1712
|
},
|
|
1685
1713
|
},
|
|
1686
1714
|
/**
|
|
1687
|
-
* The pre-assemble context hook
|
|
1715
|
+
* The pre-assemble context hook: user chains over the
|
|
1688
1716
|
* finished template context — conditional style guides, seeded
|
|
1689
1717
|
* event tables — after this node resolves it and before anything
|
|
1690
1718
|
* renders it.
|
|
@@ -1694,7 +1722,7 @@ export const buildTemplateContext = pin(describeTaskDefinition({
|
|
|
1694
1722
|
* template-context *data* (`context.injections`, resolved to
|
|
1695
1723
|
* `injectionsByIndex` beside `postHistory.targetIndex`), rendered
|
|
1696
1724
|
* by the template's own message loop. Splicing them into the list
|
|
1697
|
-
* behind the template's back would
|
|
1725
|
+
* behind the template's back would repeat an old defect one
|
|
1698
1726
|
* layer down: a position the template cannot express, an author
|
|
1699
1727
|
* cannot see, and a corpus cannot check.
|
|
1700
1728
|
*/
|
|
@@ -1732,7 +1760,7 @@ export const buildTemplateContext = pin(describeTaskDefinition({
|
|
|
1732
1760
|
* narrate spec never supplies these because graph context
|
|
1733
1761
|
* needs a speaker's perspective and a narrator has none — so
|
|
1734
1762
|
* widening the shared map would give it two ports it must
|
|
1735
|
-
* leave empty forever, and move its hash to say so
|
|
1763
|
+
* leave empty forever, and move its hash to say so.
|
|
1736
1764
|
*/
|
|
1737
1765
|
relationshipsPerspectives: S.json,
|
|
1738
1766
|
relationshipsKnown: S.json,
|
|
@@ -1762,8 +1790,8 @@ export const buildTemplateContext = pin(describeTaskDefinition({
|
|
|
1762
1790
|
speakerName: S.text,
|
|
1763
1791
|
speakerCharacter: S.json,
|
|
1764
1792
|
/**
|
|
1765
|
-
* Who is speaking, as a participant reference (
|
|
1766
|
-
*
|
|
1793
|
+
* Who is speaking, as a participant reference (2026-09-16)
|
|
1794
|
+
* — the turn strategy's `speaker`. Read for one
|
|
1767
1795
|
* thing: an **envoy** (`envoy:<slug>`) has no character row, so
|
|
1768
1796
|
* its card — name and description, off the genre's declaration
|
|
1769
1797
|
* the cast read carries — is compiled here where a cast
|
|
@@ -1795,23 +1823,22 @@ export const buildTemplateContext = pin(describeTaskDefinition({
|
|
|
1795
1823
|
state: S.json,
|
|
1796
1824
|
/**
|
|
1797
1825
|
* What the person typed with the press, for an action that
|
|
1798
|
-
* reads its composer text as **direction** (
|
|
1799
|
-
*
|
|
1800
|
-
*
|
|
1801
|
-
* uplift C2, 2026-09-29). Rendered as
|
|
1826
|
+
* reads its composer text as **direction** (2026-09-27): the
|
|
1827
|
+
* Lair's Trigger trap and Reveal, and Whodunit's Search — what
|
|
1828
|
+
* the detective is looking for (2026-09-29). Rendered as
|
|
1802
1829
|
* `{{turnDirection}}` — the same name, and the same meaning,
|
|
1803
|
-
* `build-scene-context@1` gives the Lair's reply
|
|
1830
|
+
* `build-scene-context@1` gives the Lair's reply. Absent
|
|
1804
1831
|
* when blank, so a prompt writes `{{#if turnDirection}}…{{/if}}`
|
|
1805
1832
|
* and a press with nothing typed leaves it to the prompt.
|
|
1806
1833
|
* Declared here rather than in `contextPorts`, like `state`
|
|
1807
1834
|
* above; the narrator and side-character builders declare
|
|
1808
|
-
* their own
|
|
1835
|
+
* their own. Unwired on every spec whose composer text is
|
|
1809
1836
|
* a line somebody said.
|
|
1810
1837
|
*/
|
|
1811
1838
|
turnDirection: S.text,
|
|
1812
1839
|
/**
|
|
1813
1840
|
* The places the lorebook holds, for an envoy that talks about
|
|
1814
|
-
* the world from outside it (
|
|
1841
|
+
* the world from outside it (2026-09-28): the
|
|
1815
1842
|
* Lair's Castellan in the Sanctum. A
|
|
1816
1843
|
* `core:query/lorebook-entries@1` listing, rendered exactly as
|
|
1817
1844
|
* the planner's and the scene's port of this name is —
|
|
@@ -1822,7 +1849,7 @@ export const buildTemplateContext = pin(describeTaskDefinition({
|
|
|
1822
1849
|
locationEntries: S.json,
|
|
1823
1850
|
/**
|
|
1824
1851
|
* The story's newest rows, for a speaker who talks ABOUT the
|
|
1825
|
-
* story from another channel
|
|
1852
|
+
* story from another channel: the Castellan
|
|
1826
1853
|
* in the Sanctum reads `main`'s last few rows. Transcript rows
|
|
1827
1854
|
* (a `session-history@1` read), rendered as prose — one
|
|
1828
1855
|
* `Name: line` per row, named as the transcript names them, no
|
|
@@ -1832,8 +1859,8 @@ export const buildTemplateContext = pin(describeTaskDefinition({
|
|
|
1832
1859
|
*/
|
|
1833
1860
|
recentStory: S.messages,
|
|
1834
1861
|
/**
|
|
1835
|
-
* The session's genre fields, by their own names (
|
|
1836
|
-
*
|
|
1862
|
+
* The session's genre fields, by their own names (2026-09-28):
|
|
1863
|
+
* `{{sanctumSteers}}` for the Castellan in
|
|
1837
1864
|
* the Sanctum, whose instructions say whether its talk shapes
|
|
1838
1865
|
* the next turn. The planner's and the scene's `fields`, on the
|
|
1839
1866
|
* same terms. Declared on THIS type alone, like `state`;
|
|
@@ -1841,7 +1868,7 @@ export const buildTemplateContext = pin(describeTaskDefinition({
|
|
|
1841
1868
|
*/
|
|
1842
1869
|
fields: S.json,
|
|
1843
1870
|
/**
|
|
1844
|
-
* The speaker's own running notes (
|
|
1871
|
+
* The speaker's own running notes (owner ruling of
|
|
1845
1872
|
* 2026-09-28): the Castellan's **scratchpad**, the Lair's annex
|
|
1846
1873
|
* field `castellan-scratchpad`, read for it alone
|
|
1847
1874
|
* (`session-annex@1`'s AI view, with its own reference as the
|
|
@@ -1909,12 +1936,12 @@ export const buildNarratorContext = pin(describeTaskDefinition({
|
|
|
1909
1936
|
in: {
|
|
1910
1937
|
...contextPorts.in,
|
|
1911
1938
|
/**
|
|
1912
|
-
* What the person asked this narration to do (
|
|
1913
|
-
*
|
|
1939
|
+
* What the person asked this narration to do (2026-09-29):
|
|
1940
|
+
* the narrator modal's text or `/narrate
|
|
1914
1941
|
* <text>` — the turn's triggering text, `$.input.text`.
|
|
1915
1942
|
* Rendered as `{{turnDirection}}`, the name and the meaning
|
|
1916
1943
|
* `build-template-context@1` and `build-scene-context@1` give
|
|
1917
|
-
* it
|
|
1944
|
+
* it; absent when blank, so a row writes
|
|
1918
1945
|
* `{{#if turnDirection}}…{{/if}}` and an undirected narration
|
|
1919
1946
|
* renders exactly what it did before.
|
|
1920
1947
|
*
|
|
@@ -1968,7 +1995,7 @@ export const buildNarratorContext = pin(describeTaskDefinition({
|
|
|
1968
1995
|
* the card; the id stays where the host can act on it.
|
|
1969
1996
|
*
|
|
1970
1997
|
* ⚠ **The OUT-port `speaker` is the other half of that sentence** (added
|
|
1971
|
-
* 2026-09-17
|
|
1998
|
+
* 2026-09-17). The half-working control was a speaker id that changed the
|
|
1972
1999
|
* prompt's voice and not the lore; the repair is not an in-port but a lane
|
|
1973
2000
|
* inside the same clause reading the answer this node already computed —
|
|
1974
2001
|
* `core:query/character-lore@1` takes `speaker`, so the voice and its private
|
|
@@ -2017,8 +2044,8 @@ export const buildSideCharacterContext = pin(describeTaskDefinition({
|
|
|
2017
2044
|
* because a typed name is all there is.
|
|
2018
2045
|
*
|
|
2019
2046
|
* `characterId` (a row id) or `ref` (a participant reference,
|
|
2020
|
-
* `character:<id>` — what a pressed option carries
|
|
2021
|
-
*
|
|
2047
|
+
* `character:<id>` — what a pressed option carries) names the
|
|
2048
|
+
* speaker BY ROW, and then the row is who
|
|
2022
2049
|
* speaks: the name is a label, never a second lookup, so two
|
|
2023
2050
|
* people sharing a name stay two people and a row the cast does
|
|
2024
2051
|
* not seat is still the person it names. A fact with neither
|
|
@@ -2047,7 +2074,7 @@ export const buildSideCharacterContext = pin(describeTaskDefinition({
|
|
|
2047
2074
|
plan: S.json,
|
|
2048
2075
|
/**
|
|
2049
2076
|
* The rooms, listed (`core:query/lorebook-entries@1`), as the
|
|
2050
|
-
* planner and the scene get them (
|
|
2077
|
+
* planner and the scene get them (2026-09-28):
|
|
2051
2078
|
* `{{knownLocations}}` and the one the party stand in as
|
|
2052
2079
|
* `{{locationEntry}}`, so a voice can name the room it is in
|
|
2053
2080
|
* now that nobody narrates it first. Unwired, neither renders.
|
|
@@ -2055,7 +2082,7 @@ export const buildSideCharacterContext = pin(describeTaskDefinition({
|
|
|
2055
2082
|
locationEntries: S.json,
|
|
2056
2083
|
/**
|
|
2057
2084
|
* A place described only in prose, as `{{locationPassage}}`
|
|
2058
|
-
* (
|
|
2085
|
+
* (2026-09-28): the paragraph
|
|
2059
2086
|
* `core:task/undescribed-name@1` found describing the room the
|
|
2060
2087
|
* party are about to walk into (its `passage`), when no entry
|
|
2061
2088
|
* describes it — that room's text for this turn. Blank or
|
|
@@ -2064,10 +2091,10 @@ export const buildSideCharacterContext = pin(describeTaskDefinition({
|
|
|
2064
2091
|
locationPassage: S.text,
|
|
2065
2092
|
/**
|
|
2066
2093
|
* What the person asked this side character's turn to do
|
|
2067
|
-
* (
|
|
2094
|
+
* (2026-09-29) — the narrator modal's text,
|
|
2068
2095
|
* which feeds both of its halves. `{{turnDirection}}`, on the
|
|
2069
2096
|
* terms `build-narrator-context@1` states; wired by
|
|
2070
|
-
* `core:spec/
|
|
2097
|
+
* `core:spec/story-side-character` alone, so a genre's voices
|
|
2071
2098
|
* (whose composer text is a line somebody said) render
|
|
2072
2099
|
* nothing new.
|
|
2073
2100
|
*/
|
|
@@ -2079,7 +2106,7 @@ export const buildSideCharacterContext = pin(describeTaskDefinition({
|
|
|
2079
2106
|
* Who this voice is, as a **participant reference** — the row
|
|
2080
2107
|
* the fact named (`characterId` or `ref`), else
|
|
2081
2108
|
* `character:<id>` for a name the cast holds, else null for a
|
|
2082
|
-
* free-form one. Additive, 2026-09-17
|
|
2109
|
+
* free-form one. Additive, 2026-09-17. A lore read wired
|
|
2083
2110
|
* to it takes null as unwired, so the run's scope decides for
|
|
2084
2111
|
* a free-form voice.
|
|
2085
2112
|
*
|
|
@@ -2125,7 +2152,7 @@ export const buildSideCharacterContext = pin(describeTaskDefinition({
|
|
|
2125
2152
|
* `SlotNamesOf<typeof buildPlannerContext>` `never`, so a handler bound to the
|
|
2126
2153
|
* three surfaces could type-check reading NO slot and declare NO slot read,
|
|
2127
2154
|
* which is the "declares least, checked least" hole `nodeInput.ts` warns about.
|
|
2128
|
-
* Found when the surfaces gained `reads` declarations (
|
|
2155
|
+
* Found when the surfaces gained `reads` declarations (2026-09-16).
|
|
2129
2156
|
*/
|
|
2130
2157
|
const agentContextSlots = (promptFields) => ({
|
|
2131
2158
|
prompts: {
|
|
@@ -2187,22 +2214,22 @@ export const buildPlannerContext = pin(describeTaskDefinition({
|
|
|
2187
2214
|
fields: S.json,
|
|
2188
2215
|
/**
|
|
2189
2216
|
* What the person just sent, when the genre reads it as
|
|
2190
|
-
* **direction** rather than as a line somebody said
|
|
2191
|
-
*
|
|
2217
|
+
* **direction** rather than as a line somebody said
|
|
2218
|
+
* (2026-09-27) — the Lair's composer. On the template
|
|
2192
2219
|
* context and in the prompt as `{{turnDirection}}`; empty or
|
|
2193
2220
|
* absent on a turn nobody directed (a Continue), so a prompt
|
|
2194
2221
|
* writes `{{#if turnDirection}}…{{/if}}`. A genre whose composer
|
|
2195
2222
|
* text is a participant's line leaves it unwired: that line is
|
|
2196
2223
|
* already in the transcript. *Turn* direction, never bare
|
|
2197
2224
|
* `direction`: that word is the Lair's standing-note state slot
|
|
2198
|
-
* (`core:slot/direction@1`), a different fact (
|
|
2199
|
-
* 2026-09-27).
|
|
2225
|
+
* (`core:slot/direction@1`), a different fact (one word, one
|
|
2226
|
+
* meaning; renamed 2026-09-27).
|
|
2200
2227
|
*/
|
|
2201
2228
|
turnDirection: S.text,
|
|
2202
2229
|
/**
|
|
2203
2230
|
* The places the lorebook holds — a
|
|
2204
2231
|
* `core:query/lorebook-entries@1` listing of location entries
|
|
2205
|
-
* (
|
|
2232
|
+
* (2026-09-27). On the template context as
|
|
2206
2233
|
* `{{knownLocations}}` (their names, one line) and
|
|
2207
2234
|
* `{{locationEntry}}` (the entry whose name is the world's
|
|
2208
2235
|
* `location` slot — where the party are, its exits included),
|
|
@@ -2212,7 +2239,7 @@ export const buildPlannerContext = pin(describeTaskDefinition({
|
|
|
2212
2239
|
*/
|
|
2213
2240
|
locationEntries: S.json,
|
|
2214
2241
|
/**
|
|
2215
|
-
* **Side talk** (
|
|
2242
|
+
* **Side talk** (2026-09-28): what was said on
|
|
2216
2243
|
* another channel since the story's last line — the Lair's
|
|
2217
2244
|
* Sanctum talk, read by `session-history@1` with
|
|
2218
2245
|
* `unplayedOnly`. Transcript rows, rendered as prose into
|
|
@@ -2224,15 +2251,15 @@ export const buildPlannerContext = pin(describeTaskDefinition({
|
|
|
2224
2251
|
*/
|
|
2225
2252
|
sideTalk: S.messages,
|
|
2226
2253
|
/**
|
|
2227
|
-
* The planner's own running notes (
|
|
2254
|
+
* The planner's own running notes (owner ruling of
|
|
2228
2255
|
* 2026-09-28): the Castellan's **scratchpad**, rendered as
|
|
2229
2256
|
* `{{scratchpad}}`. Absent when unwired or blank; the Lair
|
|
2230
2257
|
* wires it beside `sideTalk`.
|
|
2231
2258
|
*/
|
|
2232
2259
|
scratchpad: S.text,
|
|
2233
2260
|
/**
|
|
2234
|
-
* **How the cast stand with each other** (
|
|
2235
|
-
*
|
|
2261
|
+
* **How the cast stand with each other** (2026-09-29): the
|
|
2262
|
+
* ranker's allocated candidates, of which the
|
|
2236
2263
|
* builder reads the `relationships` band's `castRelationships`
|
|
2237
2264
|
* lane — `core:query/relationship-search@1` read with nobody
|
|
2238
2265
|
* speaking. Rendered as `{{castRelationships}}`: JSON keyed by
|
|
@@ -2299,22 +2326,22 @@ export const buildSceneContext = pin(describeTaskDefinition({
|
|
|
2299
2326
|
fields: S.json,
|
|
2300
2327
|
/**
|
|
2301
2328
|
* What the person just sent, when the genre reads it as
|
|
2302
|
-
* **direction** rather than as a line somebody said
|
|
2303
|
-
*
|
|
2329
|
+
* **direction** rather than as a line somebody said
|
|
2330
|
+
* (2026-09-27) — the Lair's composer. On the template
|
|
2304
2331
|
* context and in the prompt as `{{turnDirection}}`; empty or
|
|
2305
2332
|
* absent on a turn nobody directed (a Continue), so a prompt
|
|
2306
2333
|
* writes `{{#if turnDirection}}…{{/if}}`. A genre whose composer
|
|
2307
2334
|
* text is a participant's line leaves it unwired: that line is
|
|
2308
2335
|
* already in the transcript. *Turn* direction, never bare
|
|
2309
2336
|
* `direction`: that word is the Lair's standing-note state slot
|
|
2310
|
-
* (`core:slot/direction@1`), a different fact (
|
|
2311
|
-
* 2026-09-27).
|
|
2337
|
+
* (`core:slot/direction@1`), a different fact (one word, one
|
|
2338
|
+
* meaning; renamed 2026-09-27).
|
|
2312
2339
|
*/
|
|
2313
2340
|
turnDirection: S.text,
|
|
2314
2341
|
/**
|
|
2315
2342
|
* The places the lorebook holds — a
|
|
2316
2343
|
* `core:query/lorebook-entries@1` listing of location entries
|
|
2317
|
-
* (
|
|
2344
|
+
* (2026-09-27). On the template context as
|
|
2318
2345
|
* `{{knownLocations}}` (their names, one line) and
|
|
2319
2346
|
* `{{locationEntry}}` (the room the world's `location` names,
|
|
2320
2347
|
* else the planner's location hint — where the party are, its
|
|
@@ -2325,7 +2352,7 @@ export const buildSceneContext = pin(describeTaskDefinition({
|
|
|
2325
2352
|
*/
|
|
2326
2353
|
locationEntries: S.json,
|
|
2327
2354
|
/**
|
|
2328
|
-
* **Side talk** (
|
|
2355
|
+
* **Side talk** (2026-09-28), on the
|
|
2329
2356
|
* planner's terms: the Lair's Sanctum talk since the story's
|
|
2330
2357
|
* last line, rendered as prose into `{{sideTalk}}` — for the
|
|
2331
2358
|
* Castellan's narration, wired while the session's _Sanctum
|
|
@@ -2335,7 +2362,7 @@ export const buildSceneContext = pin(describeTaskDefinition({
|
|
|
2335
2362
|
sideTalk: S.messages,
|
|
2336
2363
|
/**
|
|
2337
2364
|
* How the cast stand with each other, on the narrator's terms
|
|
2338
|
-
* — the same port as the planner's (
|
|
2365
|
+
* — the same port as the planner's (2026-09-29), rendered
|
|
2339
2366
|
* as `{{castRelationships}}`. See `buildPlannerContext`.
|
|
2340
2367
|
*/
|
|
2341
2368
|
castRelationships: S.candidates,
|
|
@@ -2438,6 +2465,16 @@ export const buildKeeperContext = pin(describeTaskDefinition({
|
|
|
2438
2465
|
* prompt naming `{{tone}}` rendered a blank.
|
|
2439
2466
|
*/
|
|
2440
2467
|
fields: S.json,
|
|
2468
|
+
/**
|
|
2469
|
+
* 🚧 **How much time the player chose** (live scenes §15 G6,
|
|
2470
|
+
* 2026-10-13): a collected clock step, `{ by, unit }` — the
|
|
2471
|
+
* inlet's `clockStep` on a *Time passes…* press. Spelled on the
|
|
2472
|
+
* template context as `{{clockStep}}` (`3 hours`, `1 day`,
|
|
2473
|
+
* `2 hours back`), so the keeper describes what the world does
|
|
2474
|
+
* over the span the player picked rather than one notch of
|
|
2475
|
+
* the time of day. Absent when unwired or not a step.
|
|
2476
|
+
*/
|
|
2477
|
+
clockStep: S.json,
|
|
2441
2478
|
},
|
|
2442
2479
|
out: contextPorts.out,
|
|
2443
2480
|
},
|
|
@@ -2457,11 +2494,11 @@ export const processMessages = pin(describeTaskDefinition({
|
|
|
2457
2494
|
timeoutMs: 1000,
|
|
2458
2495
|
slots: {
|
|
2459
2496
|
/**
|
|
2460
|
-
* The message-rewrite hook
|
|
2497
|
+
* The message-rewrite hook, on the *processed* list —
|
|
2461
2498
|
* names resolved, per-message interpolation done. `transform` only:
|
|
2462
2499
|
* `messages/inject` deliberately does **not** live here. Injection
|
|
2463
2500
|
* is a statement about *position in the rendered conversation*, and
|
|
2464
|
-
* position belongs to the template (
|
|
2501
|
+
* position belongs to the template (ruling of 2026-08-23) —
|
|
2465
2502
|
* inject chains attach on the context builders, land as
|
|
2466
2503
|
* `context.injections`, and the template's own loop renders them.
|
|
2467
2504
|
* Splicing rows into this list would be a position the template
|
|
@@ -2483,8 +2520,7 @@ export const processMessages = pin(describeTaskDefinition({
|
|
|
2483
2520
|
seedName: S.text,
|
|
2484
2521
|
/**
|
|
2485
2522
|
* Text the model is being asked to CONTINUE — the seed line's
|
|
2486
|
-
* body rather than a message of its own (ruling 2026-09-08
|
|
2487
|
-
* D-2).
|
|
2523
|
+
* body rather than a message of its own (ruling 2026-09-08).
|
|
2488
2524
|
*
|
|
2489
2525
|
* ⚠ **Absent on an ordinary turn, and that is the normal case.**
|
|
2490
2526
|
* There is no `optional` marker for a port: a port nothing wires
|
|
@@ -2549,8 +2585,7 @@ export const proseTranscript = pin(describeTaskDefinition({
|
|
|
2549
2585
|
},
|
|
2550
2586
|
}));
|
|
2551
2587
|
/**
|
|
2552
|
-
* 🚧 **Where each line's attachments go** (
|
|
2553
|
-
* D2/D3, 2026-10-02).
|
|
2588
|
+
* 🚧 **Where each line's attachments go** (owner rulings of 2026-10-02).
|
|
2554
2589
|
*
|
|
2555
2590
|
* Pure. Takes the processed lines and the attachments by message, and gives
|
|
2556
2591
|
* each line an `attachments` string the template renders after the line's text
|
|
@@ -2617,11 +2652,11 @@ export const placeAttachments = pin(describeTaskDefinition({
|
|
|
2617
2652
|
},
|
|
2618
2653
|
}));
|
|
2619
2654
|
/**
|
|
2620
|
-
* The turn-order pool, orderer and strategies (
|
|
2621
|
-
*
|
|
2655
|
+
* The turn-order pool, orderer and strategies (re-ported in place
|
|
2656
|
+
* 2026-09-22, pre-release).
|
|
2622
2657
|
*
|
|
2623
|
-
* Turn order is **state**, not a decision made inside the reply run
|
|
2624
|
-
*
|
|
2658
|
+
* Turn order is **state**, not a decision made inside the reply run.
|
|
2659
|
+
* One spec per genre — `core:spec/<genre>-turn-order` — answers a session event by
|
|
2625
2660
|
* reading the cast and the history, pooling who *may* be seated, ordering
|
|
2626
2661
|
* them, turning them into entries, and writing the result to
|
|
2627
2662
|
* `sessions.metadata.turnOrder`. The reply run then fires an entry; it
|
|
@@ -2638,9 +2673,9 @@ export const placeAttachments = pin(describeTaskDefinition({
|
|
|
2638
2673
|
* - **a strategy** turns candidates into *entries*: who speaks, where, and
|
|
2639
2674
|
* what to fire. It is the last node before the write.
|
|
2640
2675
|
*
|
|
2641
|
-
* ⚠ **No `speaker` in-port, and no halt
|
|
2642
|
-
* enters a strategy — a person's pick is fired directly (`fireTurnEntry
|
|
2643
|
-
*
|
|
2676
|
+
* ⚠ **No `speaker` in-port, and no halt**. An explicit pick never
|
|
2677
|
+
* enters a strategy — a person's pick is fired directly (`fireTurnEntry`)
|
|
2678
|
+
* and the next recompute sees the row it produced — and a strategy
|
|
2644
2679
|
* that seats nobody publishes an **empty order**, which is an answer. The
|
|
2645
2680
|
* halt (`nobody is due`) and the `characterId` port went with the decider
|
|
2646
2681
|
* they belonged to.
|
|
@@ -2675,7 +2710,7 @@ const turnStrategy = (id, label, extras = {}) => describeTaskDefinition({
|
|
|
2675
2710
|
* in candidate order. A character spoke when a non-hidden, non-narrator row
|
|
2676
2711
|
* after the last user row carries its id; an envoy when `metadata.speaker`
|
|
2677
2712
|
* carries its reference; a persona when a user row carries its `personaId`
|
|
2678
|
-
* — which is how a session knows it is the person's turn
|
|
2713
|
+
* — which is how a session knows it is the person's turn.
|
|
2679
2714
|
* @experimental
|
|
2680
2715
|
*/
|
|
2681
2716
|
export const turnRoundRobin = pin(turnStrategy('core:task/turn-round-robin@1', 'Round robin'));
|
|
@@ -2683,7 +2718,7 @@ export const turnRoundRobin = pin(turnStrategy('core:task/turn-round-robin@1', '
|
|
|
2683
2718
|
* A seeded uniform pick over the not-yet-spoken candidates — one entry.
|
|
2684
2719
|
* `declaresRandomness`, so a replayed run re-rolls identically; an
|
|
2685
2720
|
* unrelated recompute may roll differently, which is documented rather than
|
|
2686
|
-
* prevented
|
|
2721
|
+
* prevented.
|
|
2687
2722
|
* @experimental
|
|
2688
2723
|
*/
|
|
2689
2724
|
export const turnRandom = pin(turnStrategy('core:task/turn-random@1', 'Random', {
|
|
@@ -2706,6 +2741,10 @@ export const turnUserSplit = pin(turnStrategy('core:task/turn-user-split@1', 'Ro
|
|
|
2706
2741
|
* @experimental
|
|
2707
2742
|
*/
|
|
2708
2743
|
export const turnScripted = pin(turnStrategy('core:task/turn-scripted@1', 'Scripted', {
|
|
2744
|
+
// A select script runs in the sandbox: the node routinely takes
|
|
2745
|
+
// 0.6–1.4 s end to end (2026-10-17, a Dungeon Crawler round timed out
|
|
2746
|
+
// at the strategies' 1 s), so this one strategy gets five.
|
|
2747
|
+
timeoutMs: 5000,
|
|
2709
2748
|
scriptPoints: [
|
|
2710
2749
|
{
|
|
2711
2750
|
key: 'select',
|
|
@@ -2728,7 +2767,68 @@ export const turnManual = pin(turnStrategy('core:task/turn-manual@1', 'Manual'))
|
|
|
2728
2767
|
*/
|
|
2729
2768
|
export const turnNarrator = pin(turnStrategy('core:task/turn-narrator@1', 'Narrator replies'));
|
|
2730
2769
|
/**
|
|
2731
|
-
*
|
|
2770
|
+
* 🚧 **Unprompted turns** (PLAN-genre-restructure §4, the voices group; lane
|
|
2771
|
+
* 2, 2026-10-19): what a genre's background tasks add to the order a
|
|
2772
|
+
* strategy prepared, after the round. Canon A9 holds — who speaks is state,
|
|
2773
|
+
* written by the turn-order spec and fired by auto-advance; nothing reads the
|
|
2774
|
+
* history to decide a reply elsewhere.
|
|
2775
|
+
*
|
|
2776
|
+
* Only when the round has ended (no AI entry still to fire) and somebody has
|
|
2777
|
+
* answered the person since their line, it puts ONE entry at the head, at
|
|
2778
|
+
* most once per round each:
|
|
2779
|
+
*
|
|
2780
|
+
* · `side-cast` on — a seated character who did not speak last speaks up
|
|
2781
|
+
* again (`{ ref: 'character:<id>', via: 'unprompted' }`); once any
|
|
2782
|
+
* character has spoken twice since the person's line, it is done;
|
|
2783
|
+
* · `narrator-interjections` on — the narrator adds a line
|
|
2784
|
+
* (`{ ref: null, via: 'unprompted', subject: <params.narrate> }`, the
|
|
2785
|
+
* genre's narrate action; a plain narrator reply when unset), unless a
|
|
2786
|
+
* narration already landed since the person's line.
|
|
2787
|
+
*
|
|
2788
|
+
* `modes` is `{ 'side-cast': …, 'narrator-interjections': … }` — `full` or
|
|
2789
|
+
* `off` each, the genre's voices settings as the turn-order spec reads them
|
|
2790
|
+
* (`core:script/unprompted-modes`, 2026-10-20; was the retired background
|
|
2791
|
+
* tasks' modes); a key absent or `off` adds nothing, so the order passes
|
|
2792
|
+
* through untouched — a session with neither on gets exactly its strategy's
|
|
2793
|
+
* order. Pure.
|
|
2794
|
+
* @experimental
|
|
2795
|
+
*/
|
|
2796
|
+
export const turnUnprompted = pin(describeTaskDefinition({
|
|
2797
|
+
id: 'core:task/turn-unprompted@1',
|
|
2798
|
+
i18n: { name: { en: 'Unprompted turns' } },
|
|
2799
|
+
timeoutMs: 1000,
|
|
2800
|
+
slots: {
|
|
2801
|
+
params: {
|
|
2802
|
+
kind: 'parameters',
|
|
2803
|
+
facet: 'behavior',
|
|
2804
|
+
schema: {
|
|
2805
|
+
narrate: {
|
|
2806
|
+
type: 'string',
|
|
2807
|
+
default: '',
|
|
2808
|
+
label: { en: 'Narrator action' },
|
|
2809
|
+
description: {
|
|
2810
|
+
en: "The action a narrator's own line fires, as '<spec>#<key>'. Empty: an ordinary reply in the narrator's voice.",
|
|
2811
|
+
},
|
|
2812
|
+
},
|
|
2813
|
+
},
|
|
2814
|
+
},
|
|
2815
|
+
},
|
|
2816
|
+
ports: {
|
|
2817
|
+
in: {
|
|
2818
|
+
/** What the strategy prepared. */
|
|
2819
|
+
order: S.turnEntries,
|
|
2820
|
+
/** Who may be seated — the pool's output. */
|
|
2821
|
+
candidates: S.turnCandidates,
|
|
2822
|
+
/** The session's visible history, ascending. */
|
|
2823
|
+
messages: S.messages,
|
|
2824
|
+
/** `{ 'side-cast', 'narrator-interjections' }` → `full` | `off`: the genre's voices settings. */
|
|
2825
|
+
modes: S.json,
|
|
2826
|
+
},
|
|
2827
|
+
out: { main: S.turnEntries, order: S.turnEntries },
|
|
2828
|
+
},
|
|
2829
|
+
}));
|
|
2830
|
+
/**
|
|
2831
|
+
* The pool: who *may* be seated this recompute, from the settings
|
|
2732
2832
|
* document's cast and the history.
|
|
2733
2833
|
*
|
|
2734
2834
|
* Its four params are the whole of a genre's or a session's say over
|
|
@@ -2839,7 +2939,7 @@ export const turnPool = pin(describeTaskDefinition({
|
|
|
2839
2939
|
},
|
|
2840
2940
|
ports: {
|
|
2841
2941
|
in: {
|
|
2842
|
-
/** The settings document's cast, envoys included
|
|
2942
|
+
/** The settings document's cast, envoys included. */
|
|
2843
2943
|
cast: S.sessionCast,
|
|
2844
2944
|
/** The session's visible history, ascending. */
|
|
2845
2945
|
messages: S.messages,
|
|
@@ -2848,7 +2948,7 @@ export const turnPool = pin(describeTaskDefinition({
|
|
|
2848
2948
|
},
|
|
2849
2949
|
}));
|
|
2850
2950
|
/**
|
|
2851
|
-
* The first orderer
|
|
2951
|
+
* The first orderer: mentioned candidates sort to the front.
|
|
2852
2952
|
*
|
|
2853
2953
|
* A composable node rather than a seventh strategy, because "who was named"
|
|
2854
2954
|
* and "whose turn it is" are two questions — a session can have the
|
|
@@ -2889,7 +2989,64 @@ export const turnMentioned = pin(describeTaskDefinition({
|
|
|
2889
2989
|
},
|
|
2890
2990
|
}));
|
|
2891
2991
|
/**
|
|
2892
|
-
*
|
|
2992
|
+
* Card strokes — marks each keyword stroke fired or not against the recent
|
|
2993
|
+
* transcript; never ranks, never budgets.
|
|
2994
|
+
*
|
|
2995
|
+
* A card painted in strokes (`strokes.ts`) carries keyword strokes: prose that
|
|
2996
|
+
* belongs in the prompt only when one of its keys was said. Unrun, every
|
|
2997
|
+
* enabled stroke is in — the card's cached `description`/`personality` — and
|
|
2998
|
+
* nothing is lost but room. Placed before the context builder, this stamps
|
|
2999
|
+
* `fired` on every stroke of every cast member (`resolveStrokes`), and the
|
|
3000
|
+
* builder then compiles `always` + fired ones only and puts the resolved list
|
|
3001
|
+
* on the card (`core:var/characters@1`'s optional `strokes`).
|
|
3002
|
+
*
|
|
3003
|
+
* The host answers each keyword condition with the lore keyword **matcher**
|
|
3004
|
+
* — the same match modes and regex time limit, one matcher at the seam — but
|
|
3005
|
+
* a stroke is not a lorebook entry: it never reaches the ranker, the lore
|
|
3006
|
+
* budget or `select`, and never competes with lore for room.
|
|
3007
|
+
*
|
|
3008
|
+
* `cast` in, `cast` out, so it slots between the cast read and the builder
|
|
3009
|
+
* without either changing; a card with no strokes passes through as it came.
|
|
3010
|
+
* The window is the last `scanDepth` rows of `messages`, defaulting to the
|
|
3011
|
+
* lore scan's 10 for the reason given there: a round grows with the cast.
|
|
3012
|
+
* Pure — the explicit step "no magic in core" asks for, placed in a spec.
|
|
3013
|
+
*
|
|
3014
|
+
* ⏸ Paused 2026-10-11 (owner): no core spec places this step and the app hides strokes behind `STROKES_ENABLED`; kept so stored documents and the registry hash stay stable.
|
|
3015
|
+
* @experimental
|
|
3016
|
+
*/
|
|
3017
|
+
export const cardStrokes = pin(describeTaskDefinition({
|
|
3018
|
+
id: 'core:task/card-strokes@1',
|
|
3019
|
+
i18n: {
|
|
3020
|
+
name: { en: 'Card strokes' },
|
|
3021
|
+
description: {
|
|
3022
|
+
en: 'Marks each keyword stroke fired or not against the recent transcript; never ranks, never budgets.',
|
|
3023
|
+
},
|
|
3024
|
+
},
|
|
3025
|
+
timeoutMs: 1000,
|
|
3026
|
+
slots: {
|
|
3027
|
+
params: {
|
|
3028
|
+
kind: 'parameters',
|
|
3029
|
+
facet: 'behavior',
|
|
3030
|
+
schema: {
|
|
3031
|
+
scanDepth: {
|
|
3032
|
+
type: 'integer',
|
|
3033
|
+
default: 10,
|
|
3034
|
+
min: 1,
|
|
3035
|
+
label: { en: 'Messages scanned for stroke keywords' },
|
|
3036
|
+
description: {
|
|
3037
|
+
en: "How many recent messages are read for a keyword stroke's keys.",
|
|
3038
|
+
},
|
|
3039
|
+
},
|
|
3040
|
+
},
|
|
3041
|
+
},
|
|
3042
|
+
},
|
|
3043
|
+
ports: {
|
|
3044
|
+
in: { cast: S.sessionCast, messages: S.messages },
|
|
3045
|
+
out: { main: S.sessionCast, cast: S.sessionCast },
|
|
3046
|
+
},
|
|
3047
|
+
}));
|
|
3048
|
+
/**
|
|
3049
|
+
* Tool calling's two pure halves. A *tool* is any same-shaped
|
|
2893
3050
|
* provider — a sandboxed plugin hook canonically — and these tasks only
|
|
2894
3051
|
* decide how the model learns about it and how its answer is read back.
|
|
2895
3052
|
* Between them sits the ordinary generate step; around them sits the loop
|
|
@@ -2987,7 +3144,7 @@ export const joinText = pin(describeTaskDefinition({
|
|
|
2987
3144
|
}));
|
|
2988
3145
|
/**
|
|
2989
3146
|
* A document's lists, as one **folded section** a reply carries collapsed
|
|
2990
|
-
* (
|
|
3147
|
+
* (2026-09-27).
|
|
2991
3148
|
*
|
|
2992
3149
|
* The producer the message outlets' `sections` in-port was built for: a
|
|
2993
3150
|
* planner's document is structure, and the person reading the reply wants its
|
|
@@ -3035,7 +3192,7 @@ export const listSection = pin(describeTaskDefinition({
|
|
|
3035
3192
|
sections: S.foldedSections,
|
|
3036
3193
|
/**
|
|
3037
3194
|
* The same lines as a markdown list, one `- ` item per line
|
|
3038
|
-
* (
|
|
3195
|
+
* (2026-09-28) — for a message whose BODY is the
|
|
3039
3196
|
* list: the Lair's beats row in the Sanctum. Empty when
|
|
3040
3197
|
* nothing was listed.
|
|
3041
3198
|
*/
|
|
@@ -3044,8 +3201,8 @@ export const listSection = pin(describeTaskDefinition({
|
|
|
3044
3201
|
},
|
|
3045
3202
|
}));
|
|
3046
3203
|
/**
|
|
3047
|
-
* A list, split into its **first** item and the **rest**, in order
|
|
3048
|
-
*
|
|
3204
|
+
* A list, split into its **first** item and the **rest**, in order
|
|
3205
|
+
* (2026-09-28).
|
|
3049
3206
|
*
|
|
3050
3207
|
* A data reference is `{node, port}` with no sub-path, and `parse-json@1`'s
|
|
3051
3208
|
* `path` selects a key or an index but never a tail — so a spec that treats
|
|
@@ -3242,7 +3399,7 @@ export const makeChoices = pin(describeTaskDefinition({
|
|
|
3242
3399
|
fn: S.text,
|
|
3243
3400
|
/**
|
|
3244
3401
|
* The identity of the declaration the options fire, when it is
|
|
3245
|
-
* another spec's (`core:spec/
|
|
3402
|
+
* another spec's (`core:spec/story-answer#answer`). Absent,
|
|
3246
3403
|
* the host stamps this spec's own declaration for `fn` at the
|
|
3247
3404
|
* write.
|
|
3248
3405
|
*/
|
|
@@ -3254,14 +3411,14 @@ export const makeChoices = pin(describeTaskDefinition({
|
|
|
3254
3411
|
/**
|
|
3255
3412
|
* What the question is about, by name — stamped on the block
|
|
3256
3413
|
* as its `referent` and handed back by `read-answer@1` to the
|
|
3257
|
-
* run the press fires (
|
|
3414
|
+
* run the press fires (2026-09-27: the room the
|
|
3258
3415
|
* party knocked at). Blank or absent writes none.
|
|
3259
3416
|
*/
|
|
3260
3417
|
referent: S.text,
|
|
3261
3418
|
/**
|
|
3262
3419
|
* Where the question was asked **from**, by name — stamped on
|
|
3263
3420
|
* the block as its `vantage` and handed back by
|
|
3264
|
-
* `read-answer@1`, beside `referent` (
|
|
3421
|
+
* `read-answer@1`, beside `referent` (2026-09-30:
|
|
3265
3422
|
* the room the Lair's planner said the party stood in as
|
|
3266
3423
|
* they knocked). JSON because it is usually read off a
|
|
3267
3424
|
* model's document (`parse-json@1`'s `value`); anything but
|
|
@@ -3306,7 +3463,7 @@ export const readAnswer = pin(describeTaskDefinition({
|
|
|
3306
3463
|
question: S.text,
|
|
3307
3464
|
/**
|
|
3308
3465
|
* What the question was about, by name — the block's
|
|
3309
|
-
* `referent`, as the asking run stamped it
|
|
3466
|
+
* `referent`, as the asking run stamped it;
|
|
3310
3467
|
* empty when it named nothing, never null, so a write wired
|
|
3311
3468
|
* to it still offers the field at its review gate (a review
|
|
3312
3469
|
* form shows only the fields a payload carries).
|
|
@@ -3314,7 +3471,7 @@ export const readAnswer = pin(describeTaskDefinition({
|
|
|
3314
3471
|
referent: S.text,
|
|
3315
3472
|
/**
|
|
3316
3473
|
* Where the question was asked from, by name — the block's
|
|
3317
|
-
* `vantage`, as the asking run stamped it
|
|
3474
|
+
* `vantage`, as the asking run stamped it; null
|
|
3318
3475
|
* when it named nowhere.
|
|
3319
3476
|
*/
|
|
3320
3477
|
vantage: S.json,
|
|
@@ -3332,7 +3489,7 @@ export const readAnswer = pin(describeTaskDefinition({
|
|
|
3332
3489
|
* first parameter a user with long posts reaches for.
|
|
3333
3490
|
* @internal
|
|
3334
3491
|
*/
|
|
3335
|
-
|
|
3492
|
+
const batchMessagesAt1 = pin(describeTaskDefinition({
|
|
3336
3493
|
id: 'core:task/batch-messages@1',
|
|
3337
3494
|
i18n: { name: { en: 'Batch messages' } },
|
|
3338
3495
|
timeoutMs: 2000,
|
|
@@ -3342,7 +3499,7 @@ export const batchMessages = pin(describeTaskDefinition({
|
|
|
3342
3499
|
* that the drafting step generates against.
|
|
3343
3500
|
*
|
|
3344
3501
|
* The context window belongs to the sampling config, never to a knob
|
|
3345
|
-
* on a node
|
|
3502
|
+
* on a node, and the executor resolves a `sampling` slot to
|
|
3346
3503
|
* the config's switched-on *values* — so this stays a pure Task
|
|
3347
3504
|
* reading data it was handed rather than a Query looking one up. Same
|
|
3348
3505
|
* shape and same reason as `core:task/context-budget@1`.
|
|
@@ -3406,6 +3563,174 @@ export const batchMessages = pin(describeTaskDefinition({
|
|
|
3406
3563
|
out: { main: S.drafts, batches: S.drafts },
|
|
3407
3564
|
},
|
|
3408
3565
|
}));
|
|
3566
|
+
/**
|
|
3567
|
+
* 🚧 What a genre's **transcript template** may read, section by section
|
|
3568
|
+
* (live scenes §12.1/§14). The template is one Handlebars source holding
|
|
3569
|
+
* three inline partials — `{{#*inline "preamble"}}`, `{{#*inline "line"}}`
|
|
3570
|
+
* and `{{#*inline "aside"}}` — and the binding renders each on its own:
|
|
3571
|
+
* `preamble` once, `line` per story message, `aside` per aside row. Text
|
|
3572
|
+
* outside the three partials is never rendered. A section the template does
|
|
3573
|
+
* not define falls back to the shipped Default's.
|
|
3574
|
+
*/
|
|
3575
|
+
const TRANSCRIPT_TEMPLATE_SCOPE = {
|
|
3576
|
+
scene: {
|
|
3577
|
+
type: 'object',
|
|
3578
|
+
optional: true,
|
|
3579
|
+
description: 'The scene, in `preamble`: its name, place and date when the host knows them.',
|
|
3580
|
+
fields: {
|
|
3581
|
+
name: { type: 'string', optional: true },
|
|
3582
|
+
place: { type: 'string', optional: true },
|
|
3583
|
+
date: { type: 'string', optional: true },
|
|
3584
|
+
},
|
|
3585
|
+
},
|
|
3586
|
+
cast: {
|
|
3587
|
+
type: 'list',
|
|
3588
|
+
description: 'Who was present, in `preamble`, by name.',
|
|
3589
|
+
of: { type: 'object', fields: { name: { type: 'string' } } },
|
|
3590
|
+
},
|
|
3591
|
+
messageId: { type: 'number', description: 'In `line` and `aside`: the message this unit renders.' },
|
|
3592
|
+
name: { type: 'string', description: 'In `line` and `aside`: who wrote the line, as the session names them.' },
|
|
3593
|
+
role: { type: 'string', description: "In `line` and `aside`: 'user', 'assistant' or 'system'." },
|
|
3594
|
+
text: { type: 'string', description: "In `line` and `aside`: the message's text." },
|
|
3595
|
+
attachments: {
|
|
3596
|
+
type: 'string',
|
|
3597
|
+
description: "In `line` and `aside`: the files the message shows, each named on a line of its own — `[image: cat.png — a grey cat]`, `[file: notes.txt]` — carrying its own leading line break when the message has text, so it renders straight after `{{{text}}}`, as `place-attachments@1`'s does. Empty when the message shows none. A summary is drafted from text, so a file reaches it as its name.",
|
|
3598
|
+
},
|
|
3599
|
+
channel: { type: 'string', description: 'In `aside`: the channel the row was written on — `sanctum`, `sanctum:2`.' },
|
|
3600
|
+
};
|
|
3601
|
+
/**
|
|
3602
|
+
* 🚧 Lay a scene's messages out as text, one **transcript unit** per message
|
|
3603
|
+
* — the genre's own words for what a line and an aside look like (live
|
|
3604
|
+
* scenes §12.1, §14, 2026-10-13).
|
|
3605
|
+
*
|
|
3606
|
+
* ## Why a template, and why it is the spec's
|
|
3607
|
+
*
|
|
3608
|
+
* A summary of the Lair has to say the Sanctum is talk the party never hear;
|
|
3609
|
+
* a summary of Chat has nothing to say about it. That difference is
|
|
3610
|
+
* presentation, so it is a template on this node's `template` slot, and the
|
|
3611
|
+
* shipped template is the summarize-scene spec's Default — a genre ships its
|
|
3612
|
+
* own by building its spec with `summarizeScene(…, { transcript })`, and an
|
|
3613
|
+
* admin edits it in the Pipelines view like any other template.
|
|
3614
|
+
*
|
|
3615
|
+
* ## The outlet
|
|
3616
|
+
*
|
|
3617
|
+
* `preamble` — the rendered `preamble` section, once. `units` — every
|
|
3618
|
+
* story line and aside in reading order (each aside after the story line it
|
|
3619
|
+
* is attached to), `{ messageId, text, tokens }`: the batch cut needs the
|
|
3620
|
+
* count, and the message id is what makes a draft traceable to its rows.
|
|
3621
|
+
* Pure: no model, no write. An empty span renders an empty `units`.
|
|
3622
|
+
* @experimental
|
|
3623
|
+
*/
|
|
3624
|
+
export const renderTranscript = pin(describeTaskDefinition({
|
|
3625
|
+
id: 'core:task/render-transcript@1',
|
|
3626
|
+
i18n: { name: { en: 'Lay out the transcript' } },
|
|
3627
|
+
timeoutMs: 2000,
|
|
3628
|
+
slots: {
|
|
3629
|
+
template: {
|
|
3630
|
+
kind: 'template',
|
|
3631
|
+
acceptedEngines: [handlebars.id],
|
|
3632
|
+
facet: 'templates',
|
|
3633
|
+
variables: TRANSCRIPT_TEMPLATE_SCOPE,
|
|
3634
|
+
description: 'How the transcript a summary is drafted from reads: three sections — the preamble, a story line, and an aside. Leave empty to use the built-in layout.',
|
|
3635
|
+
},
|
|
3636
|
+
},
|
|
3637
|
+
ports: {
|
|
3638
|
+
in: {
|
|
3639
|
+
/** The story's rows (`summarize-source@2`'s `messages`). */
|
|
3640
|
+
messages: S.messages,
|
|
3641
|
+
/** The aside rows (`summarize-source@2`'s `asides`). */
|
|
3642
|
+
asides: S.messages,
|
|
3643
|
+
/**
|
|
3644
|
+
* The files by message, from `core:query/history-attachments@1`
|
|
3645
|
+
* over the story rows — `batch-messages@1`'s port, for its
|
|
3646
|
+
* reason: a message that is only a picture still reaches the
|
|
3647
|
+
* draft as something. Each story line's files are named into
|
|
3648
|
+
* the `line` section's `attachments`. Unwired, or a message
|
|
3649
|
+
* with no files, and the line renders as it would without.
|
|
3650
|
+
*/
|
|
3651
|
+
attachments: S.mediaByMessage,
|
|
3652
|
+
/**
|
|
3653
|
+
* 🚧 The aside rows' files by message, from a second
|
|
3654
|
+
* `core:query/history-attachments@1` over the asides (lane
|
|
3655
|
+
* E): each aside's files are named into the `aside`
|
|
3656
|
+
* section's `attachments`. Unwired, an aside renders as it
|
|
3657
|
+
* would without.
|
|
3658
|
+
*/
|
|
3659
|
+
asideAttachments: S.mediaByMessage,
|
|
3660
|
+
/** Who was present — the session's cast read. */
|
|
3661
|
+
cast: S.sessionCast,
|
|
3662
|
+
/**
|
|
3663
|
+
* The scene being summarized: its name, place and date where the
|
|
3664
|
+
* host knows them. Wired to the summarize request in the shipped
|
|
3665
|
+
* specs; the binding reads the request's `scene` field.
|
|
3666
|
+
*/
|
|
3667
|
+
scene: S.json,
|
|
3668
|
+
},
|
|
3669
|
+
out: {
|
|
3670
|
+
main: S.transcriptUnits,
|
|
3671
|
+
preamble: S.text,
|
|
3672
|
+
units: S.transcriptUnits,
|
|
3673
|
+
},
|
|
3674
|
+
},
|
|
3675
|
+
}));
|
|
3676
|
+
/**
|
|
3677
|
+
* 🚧 Cut a rendered transcript into batches a model can hold — `@1`'s cut,
|
|
3678
|
+
* over **text** (live scenes §14, 2026-10-13).
|
|
3679
|
+
*
|
|
3680
|
+
* `@1` cuts message rows and formats them itself; this one is handed units the
|
|
3681
|
+
* transcript template already laid out, counts each unit's `tokens`, and opens
|
|
3682
|
+
* every batch with the `preamble` so each draft knows the scene it is in. A
|
|
3683
|
+
* unit is never split. Out: `batches`, one string per batch, in order. An
|
|
3684
|
+
* empty `units` cuts to no batches. `@1` stays for the shared summarize specs.
|
|
3685
|
+
* @experimental
|
|
3686
|
+
*/
|
|
3687
|
+
const batchMessagesAt2 = pin(describeTaskDefinition({
|
|
3688
|
+
id: 'core:task/batch-messages@2',
|
|
3689
|
+
i18n: { name: { en: 'Batch the transcript' } },
|
|
3690
|
+
timeoutMs: 2000,
|
|
3691
|
+
slots: {
|
|
3692
|
+
/**
|
|
3693
|
+
* The window the cut is clamped to — wired by REFERENCE to the
|
|
3694
|
+
* drafting step's sampling, for `@1`'s reason: a batch cut against
|
|
3695
|
+
* one window and drafted against another overflows silently.
|
|
3696
|
+
*/
|
|
3697
|
+
sampling: { kind: 'sampling', quick: true },
|
|
3698
|
+
params: {
|
|
3699
|
+
kind: 'parameters',
|
|
3700
|
+
facet: 'weights',
|
|
3701
|
+
schema: {
|
|
3702
|
+
batchTokens: {
|
|
3703
|
+
type: 'integer',
|
|
3704
|
+
default: 2560,
|
|
3705
|
+
label: { en: 'How much chat each batch holds' },
|
|
3706
|
+
description: {
|
|
3707
|
+
en: 'Tokens of transcript one summary draft is written from. Capped by the drafting step\u2019s Context Tokens, less room for the prompt and the draft itself.',
|
|
3708
|
+
},
|
|
3709
|
+
},
|
|
3710
|
+
minBatchMessages: {
|
|
3711
|
+
type: 'integer',
|
|
3712
|
+
default: 1,
|
|
3713
|
+
description: 'Never cut a batch smaller than this many messages.',
|
|
3714
|
+
},
|
|
3715
|
+
},
|
|
3716
|
+
},
|
|
3717
|
+
},
|
|
3718
|
+
ports: {
|
|
3719
|
+
in: { preamble: S.text, units: S.transcriptUnits },
|
|
3720
|
+
out: { main: S.drafts, batches: S.drafts },
|
|
3721
|
+
},
|
|
3722
|
+
}));
|
|
3723
|
+
/**
|
|
3724
|
+
* Cut a summary's material into batches — both pins on one export (04 §4b):
|
|
3725
|
+
* `C.batchMessages.v1(…)` cuts message rows, `C.batchMessages.v2(…)` cuts a
|
|
3726
|
+
* rendered transcript. `id` and `descriptor` stay `@1`'s; `@2`'s descriptor
|
|
3727
|
+
* rides its constructor (`typeof C.batchMessages.v2` types a binding).
|
|
3728
|
+
* @internal
|
|
3729
|
+
*/
|
|
3730
|
+
export const batchMessages = {
|
|
3731
|
+
...batchMessagesAt1,
|
|
3732
|
+
v2: Object.assign(batchMessagesAt2.v2, { descriptor: batchMessagesAt2.descriptor }),
|
|
3733
|
+
};
|
|
3409
3734
|
// ── Stats and states ────────────────────────────────────────────────────────
|
|
3410
3735
|
/** @experimental */
|
|
3411
3736
|
export const setState = pin(describeTaskDefinition({
|
|
@@ -3444,13 +3769,19 @@ export const setState = pin(describeTaskDefinition({
|
|
|
3444
3769
|
// [{ owner: { kind, id }, slotId, value, base? } | { owner, entryId, delta, base? }]
|
|
3445
3770
|
// `scope` is what says which session, and therefore which message a
|
|
3446
3771
|
// change is anchored to — a change with no anchor is one a swipe
|
|
3447
|
-
// could not take back.
|
|
3772
|
+
// could not take back. 🚧 A clock line `{ kind: 'clock', by, unit }`
|
|
3773
|
+
// (★3) is held by `propose` as a clock proposal and passed over by
|
|
3774
|
+
// `apply` — see `resolve-state-changes@1`'s `clock` out-port. One
|
|
3775
|
+
// marked `skipped` (a sentence: the story has no clock to take it,
|
|
3776
|
+
// live scenes §15 G16) is written to the session's ledger as a
|
|
3777
|
+
// skipped clock move in either mode — never proposed, never moved
|
|
3778
|
+
// — and its row id rides `main.skipped`.
|
|
3448
3779
|
in: {
|
|
3449
3780
|
changes: S.json,
|
|
3450
3781
|
scope: S.sessionScope,
|
|
3451
3782
|
/**
|
|
3452
|
-
* The **state version** the changes are deltas against
|
|
3453
|
-
*
|
|
3783
|
+
* The **state version** the changes are deltas against — the
|
|
3784
|
+
* session-state query's
|
|
3454
3785
|
* `version`, for every change that does not carry its own
|
|
3455
3786
|
* `base`. In `apply` mode a base behind the current version is
|
|
3456
3787
|
* **rebased**: a change whose slot is untouched since the base
|
|
@@ -3463,8 +3794,8 @@ export const setState = pin(describeTaskDefinition({
|
|
|
3463
3794
|
*/
|
|
3464
3795
|
base: S.json,
|
|
3465
3796
|
/**
|
|
3466
|
-
* **The row the WORLD's changes are filed at** (
|
|
3467
|
-
*
|
|
3797
|
+
* **The row the WORLD's changes are filed at** (2026-09-28): a
|
|
3798
|
+
* message this run wrote earlier, as that
|
|
3468
3799
|
* write's result. Optional, and only for world-owned changes
|
|
3469
3800
|
* (the session and its places); a cast member's change still
|
|
3470
3801
|
* files at that member's own latest line (the turn lock).
|
|
@@ -3489,12 +3820,12 @@ export const setState = pin(describeTaskDefinition({
|
|
|
3489
3820
|
},
|
|
3490
3821
|
}));
|
|
3491
3822
|
/**
|
|
3492
|
-
* A room name, unless something already describes it (
|
|
3493
|
-
*
|
|
3823
|
+
* A room name, unless something already describes it (2026-09-28; replaced
|
|
3824
|
+
* `core:task/unlisted-name@1`).
|
|
3494
3825
|
*
|
|
3495
3826
|
* The Lair's planner names the room the party are about to walk into when it
|
|
3496
3827
|
* thinks nobody has built it, and the turn stops to ask the dungeon's master
|
|
3497
|
-
* to describe it (owner ruling
|
|
3828
|
+
* to describe it (owner ruling, 2026-09-28: *ask, unless it is already
|
|
3498
3829
|
* described in prose or the lorebook*). This is the deterministic check after
|
|
3499
3830
|
* the planner's judgement. Lookups, in order; the first hit wins:
|
|
3500
3831
|
*
|
|
@@ -3523,7 +3854,7 @@ export const setState = pin(describeTaskDefinition({
|
|
|
3523
3854
|
* hard-codes a genre's slug: a spec that wants a side channel's prose to count
|
|
3524
3855
|
* reads it and names it here.
|
|
3525
3856
|
*
|
|
3526
|
-
* ## Which room is this one (
|
|
3857
|
+
* ## Which room is this one (2026-09-29)
|
|
3527
3858
|
*
|
|
3528
3859
|
* The same lookup answers the Lair's other question: *which room do the party
|
|
3529
3860
|
* stand in?* — the world's `location` stat, resolved against the rooms, so
|
|
@@ -3539,7 +3870,7 @@ export const setState = pin(describeTaskDefinition({
|
|
|
3539
3870
|
* find a namesake. So a value with an `entryId` is answered by the listed
|
|
3540
3871
|
* entry with that id (`describedBy` `entry`), and by nothing when no
|
|
3541
3872
|
* listing holds it — archived, or hidden from this read.
|
|
3542
|
-
* - **`fallbackName`** (
|
|
3873
|
+
* - **`fallbackName`** (2026-09-30): what to look for when `name`
|
|
3543
3874
|
* (at `path`) names nothing — for the Lair, the room its planner said the
|
|
3544
3875
|
* party stood in as they knocked (the knock's `vantage`). The world's
|
|
3545
3876
|
* value wins and the hint stands in only while it names nothing: the
|
|
@@ -3598,8 +3929,8 @@ export const undescribedName = pin(describeTaskDefinition({
|
|
|
3598
3929
|
},
|
|
3599
3930
|
},
|
|
3600
3931
|
/**
|
|
3601
|
-
* Where the name is inside `name`, as a dotted path
|
|
3602
|
-
*
|
|
3932
|
+
* Where the name is inside `name`, as a dotted path — the
|
|
3933
|
+
* Lair reads `world.location` off a
|
|
3603
3934
|
* session-state document. Empty reads `name` itself.
|
|
3604
3935
|
*/
|
|
3605
3936
|
path: {
|
|
@@ -3621,7 +3952,7 @@ export const undescribedName = pin(describeTaskDefinition({
|
|
|
3621
3952
|
* `value`), or a document holding it at `path`; anything but a
|
|
3622
3953
|
* string is no name, and nothing is undescribed — save a lore
|
|
3623
3954
|
* reference (`{ entryId }`), which is the listed entry it
|
|
3624
|
-
* references
|
|
3955
|
+
* references.
|
|
3625
3956
|
*/
|
|
3626
3957
|
name: S.json,
|
|
3627
3958
|
/**
|
|
@@ -3689,8 +4020,9 @@ export const undescribedName = pin(describeTaskDefinition({
|
|
|
3689
4020
|
*
|
|
3690
4021
|
* A spec wires `$.input.sessionScope` (or a literal) — something durable. The
|
|
3691
4022
|
* run's seed is a different string every turn and a pick keyed on it would
|
|
3692
|
-
* move between two questions. It is `scopeKey` and not `key` (
|
|
3693
|
-
* 2026-09-17, before anything shipped):
|
|
4023
|
+
* move between two questions. It is `scopeKey` and not `key` (a qualified
|
|
4024
|
+
* name, never the bare noun; named 2026-09-17, before anything shipped):
|
|
4025
|
+
* *key* alone is the option key on a
|
|
3694
4026
|
* choice, the identity a candidate is scored under, and a settings field's
|
|
3695
4027
|
* name, and this port is none of them — it is the scope the pick is made
|
|
3696
4028
|
* within.
|
|
@@ -3770,7 +4102,7 @@ export const pickByHash = pin(describeTaskDefinition({
|
|
|
3770
4102
|
/**
|
|
3771
4103
|
* Where it sat in the list **as handed in**, not among the
|
|
3772
4104
|
* identifiable entries. `pickIndex` rather than `index`
|
|
3773
|
-
* (
|
|
4105
|
+
* (qualified, never the bare noun): a bare *index* is a database index, a message's
|
|
3774
4106
|
* position and a list offset all at once.
|
|
3775
4107
|
*/
|
|
3776
4108
|
pickIndex: S.json,
|
|
@@ -3799,7 +4131,7 @@ export const pickByHash = pin(describeTaskDefinition({
|
|
|
3799
4131
|
*
|
|
3800
4132
|
* ## The key is a participant reference
|
|
3801
4133
|
*
|
|
3802
|
-
* `character:<id>`, the reference vocabulary
|
|
4134
|
+
* `character:<id>`, the reference vocabulary — not a name, which
|
|
3803
4135
|
* two cast members can share and an author can edit, and not a bare id, which
|
|
3804
4136
|
* says nothing about what it identifies. It survives the round trip: the key
|
|
3805
4137
|
* lands on the pressed option, `core:task/read-answer@1` publishes it as
|
|
@@ -3847,7 +4179,7 @@ export const castChoices = pin(describeTaskDefinition({
|
|
|
3847
4179
|
/**
|
|
3848
4180
|
* Which half of the room to leave out.
|
|
3849
4181
|
*
|
|
3850
|
-
* A persona is a character the player voices
|
|
4182
|
+
* A persona is a character the player voices, so
|
|
3851
4183
|
* both halves are cast members and which one a question
|
|
3852
4184
|
* is about depends entirely on the question: *who do you
|
|
3853
4185
|
* accuse* is asked about the suspects and must not offer
|
|
@@ -3915,7 +4247,7 @@ export const castChoices = pin(describeTaskDefinition({
|
|
|
3915
4247
|
* ## The gap it closes
|
|
3916
4248
|
*
|
|
3917
4249
|
* A junction branches on **one** port, and `equalsPath` compares two paths of
|
|
3918
|
-
* **one** document
|
|
4250
|
+
* **one** document. So the grammar can ask *is the accused the culprit?*
|
|
3919
4251
|
* only once something has put the accused and the culprit in the same
|
|
3920
4252
|
* document, and nothing in core did: no task merged two json ports, and the
|
|
3921
4253
|
* obvious repair — a second in-port on the junction — is not a repair, it is a
|
|
@@ -4008,4 +4340,693 @@ export const pair = pin(describeTaskDefinition({
|
|
|
4008
4340
|
},
|
|
4009
4341
|
}));
|
|
4010
4342
|
// ── Contracts batch 2: the two-document pair ────────────────────── end ──────
|
|
4343
|
+
// ── Pictures: the cut-out (image generation I4, 2026-10-12) ────────────────
|
|
4344
|
+
/**
|
|
4345
|
+
* 🚧 Each picture, with its background removed — a **cut-out**.
|
|
4346
|
+
*
|
|
4347
|
+
* The step after `core:oracle/generate-image@1` when the pair could not draw a
|
|
4348
|
+
* transparent background itself (`cutOut: native-or-task`). The host runs a
|
|
4349
|
+
* local matting model (BiRefNet-lite, ONNX) over each picture and stores the
|
|
4350
|
+
* result as a new PNG with an alpha channel; the source picture is left as it
|
|
4351
|
+
* was.
|
|
4352
|
+
*
|
|
4353
|
+
* ## Same list in, same list out
|
|
4354
|
+
*
|
|
4355
|
+
* One item out per item in, in order. An item that was cut out is replaced by
|
|
4356
|
+
* a reference to its cut-out; every other field the item carried — its series
|
|
4357
|
+
* `key` included — travels across unchanged, so a keyed outlet downstream
|
|
4358
|
+
* files each cut-out under the label it was drawn for. An item that is not an
|
|
4359
|
+
* image passes through untouched.
|
|
4360
|
+
*
|
|
4361
|
+
* ## `mode`
|
|
4362
|
+
*
|
|
4363
|
+
* - `auto` (default) skips a picture that already has a transparent
|
|
4364
|
+
* background: its media meta says `transparent: 'native'` (the pair drew
|
|
4365
|
+
* it), it is itself a cut-out (`cutOutOf`), or its pixels already carry
|
|
4366
|
+
* transparency.
|
|
4367
|
+
* - `always` cuts every picture out, whatever it says about itself.
|
|
4368
|
+
* - `off` hands the list on unchanged — the switch a spec author flips to see
|
|
4369
|
+
* the raw pictures without rewiring.
|
|
4370
|
+
*
|
|
4371
|
+
* Pure given its input: the same pictures make the same cut-outs (the media
|
|
4372
|
+
* store dedupes identical bytes). The first run on a machine downloads the
|
|
4373
|
+
* matting model once, which is why the timeout is idle rather than wall.
|
|
4374
|
+
* @experimental
|
|
4375
|
+
*/
|
|
4376
|
+
export const cutOut = pin(describeTaskDefinition({
|
|
4377
|
+
id: 'core:task/cut-out@1',
|
|
4378
|
+
i18n: {
|
|
4379
|
+
name: { en: 'Cut out' },
|
|
4380
|
+
description: {
|
|
4381
|
+
en: 'Removes the background from each picture, leaving it transparent. Downloads a small background-removal model the first time.',
|
|
4382
|
+
},
|
|
4383
|
+
},
|
|
4384
|
+
timeoutMs: 120000,
|
|
4385
|
+
timeoutKind: 'idle',
|
|
4386
|
+
slots: {
|
|
4387
|
+
params: {
|
|
4388
|
+
kind: 'parameters',
|
|
4389
|
+
schema: {
|
|
4390
|
+
mode: {
|
|
4391
|
+
type: 'enum',
|
|
4392
|
+
of: ['auto', 'always', 'off'],
|
|
4393
|
+
members: [
|
|
4394
|
+
{
|
|
4395
|
+
key: 'auto',
|
|
4396
|
+
label: { en: 'When needed' },
|
|
4397
|
+
description: { en: 'Skips pictures that already have a transparent background.' },
|
|
4398
|
+
},
|
|
4399
|
+
{
|
|
4400
|
+
key: 'always',
|
|
4401
|
+
label: { en: 'Always' },
|
|
4402
|
+
description: { en: 'Cuts every picture out, even one that is already transparent.' },
|
|
4403
|
+
},
|
|
4404
|
+
{
|
|
4405
|
+
key: 'off',
|
|
4406
|
+
label: { en: 'Off' },
|
|
4407
|
+
description: { en: 'Hands the pictures on unchanged.' },
|
|
4408
|
+
},
|
|
4409
|
+
],
|
|
4410
|
+
default: 'auto',
|
|
4411
|
+
quick: true,
|
|
4412
|
+
description: 'Which pictures get their background removed.',
|
|
4413
|
+
},
|
|
4414
|
+
},
|
|
4415
|
+
},
|
|
4416
|
+
},
|
|
4417
|
+
ports: {
|
|
4418
|
+
in: { media: S.mediaList },
|
|
4419
|
+
out: { main: S.mediaList, media: S.mediaList },
|
|
4420
|
+
},
|
|
4421
|
+
}));
|
|
4422
|
+
// ── Pictures: the sprite series (image generation I5, 2026-10-12) ──────────
|
|
4423
|
+
/**
|
|
4424
|
+
* 🚧 The pictures a **Sprite set fill** asks for — one image series item per
|
|
4425
|
+
* sprite label.
|
|
4426
|
+
*
|
|
4427
|
+
* Each item is `{ key, vars }`:
|
|
4428
|
+
*
|
|
4429
|
+
* - `key` is the label made filename-safe (trimmed, case-folded, spaces to
|
|
4430
|
+
* `-`, anything else dropped, collisions suffixed `joy`, `joy-2`). A key
|
|
4431
|
+
* is an address, never prose: the picture's description comes from
|
|
4432
|
+
* `vars.labelPhrase`, never from the key.
|
|
4433
|
+
* - `vars.label` is the sprite label as the card spells it, which is what
|
|
4434
|
+
* `core:outlet/attach-sprite@1` files the picture under.
|
|
4435
|
+
* - `vars.labelPhrase` is the label's **sprite label phrase** — the
|
|
4436
|
+
* `phrases` prompt field, one `label: phrase` per line (*Sprite label
|
|
4437
|
+
* phrases*, editable like any prompt row). A label with no line falls back
|
|
4438
|
+
* to the label word itself.
|
|
4439
|
+
* - `vars.likeness` / `vars.likenessNegative` carry the card's likeness, so
|
|
4440
|
+
* the picture step's prompt rows can say `{{likeness}}` per item.
|
|
4441
|
+
*
|
|
4442
|
+
* The phrases and the sprite picker's labels stay two vocabularies, never
|
|
4443
|
+
* merged: the picker never reads a phrase. Pure given its input — no read, no call.
|
|
4444
|
+
* @experimental
|
|
4445
|
+
*/
|
|
4446
|
+
export const buildSpriteSeries = pin(describeTaskDefinition({
|
|
4447
|
+
id: 'core:task/build-sprite-series@1',
|
|
4448
|
+
i18n: {
|
|
4449
|
+
name: { en: 'Sprite series' },
|
|
4450
|
+
description: {
|
|
4451
|
+
en: 'Turns the sprite labels to draw into one picture request each, with a short description of each expression.',
|
|
4452
|
+
},
|
|
4453
|
+
},
|
|
4454
|
+
timeoutMs: 5000,
|
|
4455
|
+
slots: {
|
|
4456
|
+
prompts: {
|
|
4457
|
+
kind: 'prompts',
|
|
4458
|
+
quick: true,
|
|
4459
|
+
facet: 'prompts',
|
|
4460
|
+
description: 'How each sprite label is described to the picture model: one "label: phrase" per line.',
|
|
4461
|
+
fields: {
|
|
4462
|
+
phrases: { type: 'text' },
|
|
4463
|
+
},
|
|
4464
|
+
},
|
|
4465
|
+
},
|
|
4466
|
+
ports: {
|
|
4467
|
+
in: {
|
|
4468
|
+
/** The sprite labels to draw, as the card spells them. */
|
|
4469
|
+
labels: S.json,
|
|
4470
|
+
likeness: S.text,
|
|
4471
|
+
likenessNegative: S.text,
|
|
4472
|
+
},
|
|
4473
|
+
out: {
|
|
4474
|
+
main: S.imageSeries,
|
|
4475
|
+
series: S.imageSeries,
|
|
4476
|
+
/** The labels kept, in order — blanks and repeats dropped. */
|
|
4477
|
+
labels: S.json,
|
|
4478
|
+
},
|
|
4479
|
+
},
|
|
4480
|
+
}));
|
|
4481
|
+
// ── Pictures: proofs (image generation I8, 2026-10-12) ─────────────────────
|
|
4482
|
+
/**
|
|
4483
|
+
* 🚧 **Proofs** — *n* identical pictures to choose from, as an image
|
|
4484
|
+
* series. A photographer's proof prints: the
|
|
4485
|
+
* same shot several times, one kept. Not a retrieval **candidate**, which is
|
|
4486
|
+
* something that might reach a prompt.
|
|
4487
|
+
*
|
|
4488
|
+
* Each item is `{ key, vars: {} }` with keys `"1"` … `"n"`: the same picture
|
|
4489
|
+
* asked for *n* times, so every item renders the same prompt. That sameness
|
|
4490
|
+
* is what lets the host pack the series as ONE batch call on a pair whose
|
|
4491
|
+
* drawing sheet takes `perCall ≥ n` (a hosted API's `n`, a ComfyUI graph's
|
|
4492
|
+
* batch size); a pair that draws one picture per call loops. The spec never
|
|
4493
|
+
* knows which.
|
|
4494
|
+
*
|
|
4495
|
+
* `count` is read as a whole number and clamped to 1–8 (the default
|
|
4496
|
+
* `seriesMax`); anything that is not a number is 1. The Portrait form offers
|
|
4497
|
+
* 1–4. Pure given its input — no read, no call.
|
|
4498
|
+
* @experimental
|
|
4499
|
+
*/
|
|
4500
|
+
export const buildProofs = pin(describeTaskDefinition({
|
|
4501
|
+
id: 'core:task/build-proofs@1',
|
|
4502
|
+
i18n: {
|
|
4503
|
+
name: { en: 'Proofs' },
|
|
4504
|
+
description: {
|
|
4505
|
+
en: 'Asks for the same picture several times, so there are a few to choose from.',
|
|
4506
|
+
},
|
|
4507
|
+
},
|
|
4508
|
+
timeoutMs: 5000,
|
|
4509
|
+
ports: {
|
|
4510
|
+
in: {
|
|
4511
|
+
/** How many pictures: a whole number, clamped to 1–8. */
|
|
4512
|
+
count: S.json,
|
|
4513
|
+
},
|
|
4514
|
+
out: {
|
|
4515
|
+
main: S.imageSeries,
|
|
4516
|
+
series: S.imageSeries,
|
|
4517
|
+
},
|
|
4518
|
+
},
|
|
4519
|
+
}));
|
|
4520
|
+
// ── The Scene action (DESIGN-image-generation §6.4, I9, 2026-10-12) ─────────
|
|
4521
|
+
/**
|
|
4522
|
+
* 🚧 A model's reply, cleaned into a picture prompt — the step between the
|
|
4523
|
+
* Scene action's **scene prompt** (a quiet text call asked for a tag list)
|
|
4524
|
+
* and the picture step.
|
|
4525
|
+
*
|
|
4526
|
+
* A text model asked for "a comma-separated tag list and nothing else"
|
|
4527
|
+
* still answers with a fence, a `Prompt:` label, quotes round the whole
|
|
4528
|
+
* line or a list one tag per line. Each is undone here: fences and the
|
|
4529
|
+
* label dropped, wrapping quotes stripped, line breaks and bullets turned
|
|
4530
|
+
* into commas, empty tags and repeated commas and spaces collapsed, a
|
|
4531
|
+
* trailing full stop removed. Prose survives as prose — only its line
|
|
4532
|
+
* breaks become commas. Pure: no read, no model.
|
|
4533
|
+
*
|
|
4534
|
+
* An empty result halts: a picture of nothing is not a picture.
|
|
4535
|
+
* @experimental
|
|
4536
|
+
*/
|
|
4537
|
+
export const cleanImagePrompt = pin(describeTaskDefinition({
|
|
4538
|
+
id: 'core:task/clean-image-prompt@1',
|
|
4539
|
+
i18n: {
|
|
4540
|
+
name: { en: 'Clean picture prompt' },
|
|
4541
|
+
description: { en: "Tidies a model's reply into one line a picture model can read." },
|
|
4542
|
+
},
|
|
4543
|
+
timeoutMs: 500,
|
|
4544
|
+
ports: {
|
|
4545
|
+
in: { text: S.text },
|
|
4546
|
+
out: { main: S.text, prompt: S.text },
|
|
4547
|
+
},
|
|
4548
|
+
}));
|
|
4549
|
+
/**
|
|
4550
|
+
* 🚧 Where the Scene action's picture goes — its **placement**: posted as a
|
|
4551
|
+
* message, set as the session's backdrop, or both.
|
|
4552
|
+
*
|
|
4553
|
+
* The `placement` parameter is the admin's (Admin › Pipelines, the Scene
|
|
4554
|
+
* pipeline's config); a press may name its own in its payload
|
|
4555
|
+
* (`{ placement: 'backdrop' }` — the Backdrop widget's *Illustrate*), and a
|
|
4556
|
+
* named one wins. Published as two flags, `message` and `backdrop`, because
|
|
4557
|
+
* a junction branch reads one truthy value: each outlet sits behind its own.
|
|
4558
|
+
* Pure: no read, no model.
|
|
4559
|
+
* @experimental
|
|
4560
|
+
*/
|
|
4561
|
+
export const picturePlacement = pin(describeTaskDefinition({
|
|
4562
|
+
id: 'core:task/picture-placement@1',
|
|
4563
|
+
i18n: {
|
|
4564
|
+
name: { en: 'Placement' },
|
|
4565
|
+
description: { en: 'Decides whether the picture is posted, set as the backdrop, or both.' },
|
|
4566
|
+
},
|
|
4567
|
+
timeoutMs: 500,
|
|
4568
|
+
slots: {
|
|
4569
|
+
params: {
|
|
4570
|
+
kind: 'parameters',
|
|
4571
|
+
facet: 'behavior',
|
|
4572
|
+
schema: {
|
|
4573
|
+
placement: {
|
|
4574
|
+
type: 'enum',
|
|
4575
|
+
of: ['message', 'backdrop', 'both'],
|
|
4576
|
+
members: [
|
|
4577
|
+
{
|
|
4578
|
+
key: 'message',
|
|
4579
|
+
label: { en: 'Post it' },
|
|
4580
|
+
description: { en: 'Posts the picture in the session as a message.' },
|
|
4581
|
+
},
|
|
4582
|
+
{
|
|
4583
|
+
key: 'backdrop',
|
|
4584
|
+
label: { en: 'Backdrop' },
|
|
4585
|
+
description: { en: "Sets the picture as the session's backdrop, and posts nothing." },
|
|
4586
|
+
},
|
|
4587
|
+
{
|
|
4588
|
+
key: 'both',
|
|
4589
|
+
label: { en: 'Both' },
|
|
4590
|
+
description: { en: 'Posts the picture and sets it as the backdrop.' },
|
|
4591
|
+
},
|
|
4592
|
+
],
|
|
4593
|
+
default: 'both',
|
|
4594
|
+
label: { en: 'Placement' },
|
|
4595
|
+
description: 'Where the picture goes. A press that names its own placement uses that.',
|
|
4596
|
+
},
|
|
4597
|
+
},
|
|
4598
|
+
},
|
|
4599
|
+
},
|
|
4600
|
+
ports: {
|
|
4601
|
+
in: {
|
|
4602
|
+
/** The press's payload; its `placement`, when one of the three, wins. */
|
|
4603
|
+
payload: S.json,
|
|
4604
|
+
},
|
|
4605
|
+
out: {
|
|
4606
|
+
main: S.json,
|
|
4607
|
+
/** `message`, `backdrop` or `both` — what was decided. */
|
|
4608
|
+
placement: S.text,
|
|
4609
|
+
/** True when the picture is posted as a message. */
|
|
4610
|
+
message: S.json,
|
|
4611
|
+
/** True when the picture is set as the backdrop. */
|
|
4612
|
+
backdrop: S.json,
|
|
4613
|
+
},
|
|
4614
|
+
},
|
|
4615
|
+
}));
|
|
4616
|
+
/**
|
|
4617
|
+
* 🚧 A **clock step**: how far the story clock moves, decided — `{ by, unit }`
|
|
4618
|
+
* and whether it moves at all (2026-10-13, PROPOSAL-live-scenes §6).
|
|
4619
|
+
*
|
|
4620
|
+
* Two uses, one shape. *Time passes…* hands it the press's collected
|
|
4621
|
+
* `step` (`input.clockStep`), which wins. Chat's reply hands it nothing and
|
|
4622
|
+
* reads its own parameters — **By** (0, the default, is off) and **Unit** —
|
|
4623
|
+
* exposed as the session setting *Each reply advances the clock by …*. Either
|
|
4624
|
+
* way the step publishes `moves` (true when `by` is a whole number other than
|
|
4625
|
+
* zero), and the *Advance story clock* outlet sits behind a junction on it,
|
|
4626
|
+
* so a step of nothing is never written and never refused. Pure: no read, no
|
|
4627
|
+
* model, never the clock itself.
|
|
4628
|
+
* @experimental
|
|
4629
|
+
*/
|
|
4630
|
+
export const clockStep = pin(describeTaskDefinition({
|
|
4631
|
+
id: 'core:task/clock-step@1',
|
|
4632
|
+
i18n: {
|
|
4633
|
+
name: { en: 'Clock step' },
|
|
4634
|
+
description: { en: 'Decides how far the story clock moves: a number of minutes, hours, days, months or years.' },
|
|
4635
|
+
},
|
|
4636
|
+
timeoutMs: 500,
|
|
4637
|
+
slots: {
|
|
4638
|
+
params: {
|
|
4639
|
+
kind: 'parameters',
|
|
4640
|
+
facet: 'behavior',
|
|
4641
|
+
schema: {
|
|
4642
|
+
by: {
|
|
4643
|
+
type: 'integer',
|
|
4644
|
+
default: 0,
|
|
4645
|
+
label: { en: 'By' },
|
|
4646
|
+
description: { en: 'How many units the clock moves. 0 moves nothing; negative goes back.' },
|
|
4647
|
+
},
|
|
4648
|
+
unit: {
|
|
4649
|
+
type: 'enum',
|
|
4650
|
+
of: ['minutes', 'hours', 'days', 'months', 'years'],
|
|
4651
|
+
members: [
|
|
4652
|
+
{ key: 'minutes', label: { en: 'Minutes' } },
|
|
4653
|
+
{ key: 'hours', label: { en: 'Hours' } },
|
|
4654
|
+
{ key: 'days', label: { en: 'Days' } },
|
|
4655
|
+
{ key: 'months', label: { en: 'Months' } },
|
|
4656
|
+
{ key: 'years', label: { en: 'Years' } },
|
|
4657
|
+
],
|
|
4658
|
+
default: 'minutes',
|
|
4659
|
+
label: { en: 'Unit' },
|
|
4660
|
+
description: { en: 'What to count.' },
|
|
4661
|
+
},
|
|
4662
|
+
},
|
|
4663
|
+
},
|
|
4664
|
+
},
|
|
4665
|
+
ports: {
|
|
4666
|
+
in: {
|
|
4667
|
+
/** A collected step, `{ by, unit }` — wins over the parameters when it reads. */
|
|
4668
|
+
step: S.json,
|
|
4669
|
+
/**
|
|
4670
|
+
* When truthy, the clock does not move (`moves` false). Chat's
|
|
4671
|
+
* reply wires the row it re-drives (`input.messageId`), so a
|
|
4672
|
+
* regenerate, a swipe or an extend never ticks the clock twice.
|
|
4673
|
+
*/
|
|
4674
|
+
unless: S.json,
|
|
4675
|
+
},
|
|
4676
|
+
out: {
|
|
4677
|
+
main: S.json,
|
|
4678
|
+
/** True when the clock moves: `by` is a whole number other than zero. */
|
|
4679
|
+
moves: S.json,
|
|
4680
|
+
/** The signed amount — what *Advance story clock* takes on its `by` port. */
|
|
4681
|
+
by: S.json,
|
|
4682
|
+
/** The unit — what *Advance story clock* takes on its `unit` port. */
|
|
4683
|
+
unit: S.text,
|
|
4684
|
+
},
|
|
4685
|
+
},
|
|
4686
|
+
}));
|
|
4687
|
+
/**
|
|
4688
|
+
* **Run a script** — the script step (2026-10-12).
|
|
4689
|
+
*
|
|
4690
|
+
* The node itself does nothing: it passes its input through to `main`, and
|
|
4691
|
+
* the `core:script:data/transform@1` scripts attached after `main` transform
|
|
4692
|
+
* it in order, each handed the value the one before returned. That is what
|
|
4693
|
+
* lets an admin write a custom task in-app without a plugin — the body is a
|
|
4694
|
+
* sandboxed script, the contract is JSON in, JSON out.
|
|
4695
|
+
* @experimental
|
|
4696
|
+
*/
|
|
4697
|
+
export const runScript = pin(describeTaskDefinition({
|
|
4698
|
+
id: 'core:task/run-script@1',
|
|
4699
|
+
i18n: {
|
|
4700
|
+
name: { en: 'Run a script' },
|
|
4701
|
+
description: {
|
|
4702
|
+
en: 'Passes its input through; the scripts attached after it transform the value, each handed what the one before returned.',
|
|
4703
|
+
},
|
|
4704
|
+
},
|
|
4705
|
+
timeoutMs: 2000,
|
|
4706
|
+
slots: {
|
|
4707
|
+
scripts: {
|
|
4708
|
+
kind: 'scripts',
|
|
4709
|
+
accepts: ['core:script:data/transform@1'],
|
|
4710
|
+
port: 'main',
|
|
4711
|
+
phase: 'after',
|
|
4712
|
+
description: 'The script, or scripts, this step runs over its input. Each is handed the value the one before returned.',
|
|
4713
|
+
},
|
|
4714
|
+
/**
|
|
4715
|
+
* The time each script in the chain may take.
|
|
4716
|
+
* Read by the HOST's script applier off the scope chain, not by the
|
|
4717
|
+
* binding — the binding never sees the chain. A script past it is
|
|
4718
|
+
* stopped and recorded `err` with the time in its reason, and 🚧 the
|
|
4719
|
+
* step HALTS with that reason (2026-10-19): a script step's answer
|
|
4720
|
+
* is its script's, and handing its own input on as that answer
|
|
4721
|
+
* reached the next step as nonsense. Unset, the seam default
|
|
4722
|
+
* applies (the same 250 ms).
|
|
4723
|
+
*/
|
|
4724
|
+
params: {
|
|
4725
|
+
kind: 'parameters',
|
|
4726
|
+
facet: 'weights',
|
|
4727
|
+
schema: {
|
|
4728
|
+
budgetMs: {
|
|
4729
|
+
type: 'integer',
|
|
4730
|
+
min: 1,
|
|
4731
|
+
max: 1000,
|
|
4732
|
+
default: 250,
|
|
4733
|
+
label: { en: 'Script time limit (ms)' },
|
|
4734
|
+
description: {
|
|
4735
|
+
en: 'How long each script in this step may run. A script that runs longer is stopped, and the step stops with it.',
|
|
4736
|
+
},
|
|
4737
|
+
},
|
|
4738
|
+
},
|
|
4739
|
+
},
|
|
4740
|
+
},
|
|
4741
|
+
ports: {
|
|
4742
|
+
in: { input: S.json },
|
|
4743
|
+
out: { main: S.json },
|
|
4744
|
+
},
|
|
4745
|
+
}));
|
|
4746
|
+
/**
|
|
4747
|
+
* 🚧 **Resolve a ruleset** — the one handler every genre calls to read and
|
|
4748
|
+
* apply a session's ruleset (rulesets programme, P1 contract stub).
|
|
4749
|
+
*
|
|
4750
|
+
* Ruleset-agnostic: it reads whichever ruleset the session has from the
|
|
4751
|
+
* registry (`defineRuleset`), at the rigour it is handed, in a fixed phase
|
|
4752
|
+
* order (base → piece effects → derived → bridges → prose render). A genre's
|
|
4753
|
+
* spec supplies only the moment:
|
|
4754
|
+
*
|
|
4755
|
+
* · `resolve` — before a model call: labelled prompt blocks and the facts a
|
|
4756
|
+
* step may need. No dice.
|
|
4757
|
+
* · `apply` — after the model proposes: validates the `deltas`, rolls what
|
|
4758
|
+
* must be rolled (seeded — hence `declaresRandomness`), and returns the
|
|
4759
|
+
* outcomes, the explain trace and the deltas it refused.
|
|
4760
|
+
* · `advance` — `apply` with no deltas and an `elapsed` amount (a rest, a
|
|
4761
|
+
* journey, a scene break).
|
|
4762
|
+
*
|
|
4763
|
+
* `blocks` is a record of labelled variables — `voice`, `sheet`, `pieces`,
|
|
4764
|
+
* `ties`, `outcomes`, `custom` — which a context template places by name;
|
|
4765
|
+
* the handler never writes into a prompt itself. `explain` is for receipts
|
|
4766
|
+
* and ledgers, never a prompt. Bound by the app since 2026-10-17 (no longer
|
|
4767
|
+
* provisional — the Dungeon Crawler create spec seeds it).
|
|
4768
|
+
* @experimental
|
|
4769
|
+
*/
|
|
4770
|
+
export const rulesetResolve = pin(describeTaskDefinition({
|
|
4771
|
+
id: 'core:task/ruleset-resolve@1',
|
|
4772
|
+
i18n: {
|
|
4773
|
+
name: { en: 'Resolve a ruleset' },
|
|
4774
|
+
description: {
|
|
4775
|
+
en: "Reads the session's ruleset for the owners it is given, at the rigour it is given: prompt blocks before a reply, validated changes and rolled outcomes after one.",
|
|
4776
|
+
},
|
|
4777
|
+
},
|
|
4778
|
+
timeoutMs: 5000,
|
|
4779
|
+
declaresRandomness: true,
|
|
4780
|
+
slots: {
|
|
4781
|
+
params: {
|
|
4782
|
+
kind: 'parameters',
|
|
4783
|
+
facet: 'behavior',
|
|
4784
|
+
schema: {
|
|
4785
|
+
/**
|
|
4786
|
+
* 🚧 D3 (2026-10-23): whether the events this step's
|
|
4787
|
+
* functions raise are emitted after the run's receipt. Off:
|
|
4788
|
+
* they are reported on `facts` and never emitted. The
|
|
4789
|
+
* pipeline's own switch (`SpecDocument.functionEvents`)
|
|
4790
|
+
* turns off every step's at once.
|
|
4791
|
+
*/
|
|
4792
|
+
emits: {
|
|
4793
|
+
type: 'boolean',
|
|
4794
|
+
default: true,
|
|
4795
|
+
label: { en: 'Emit what its functions raise' },
|
|
4796
|
+
description: {
|
|
4797
|
+
en: "The events the ruleset's functions raise in this step are emitted once the run is saved. Off: they are only reported.",
|
|
4798
|
+
},
|
|
4799
|
+
},
|
|
4800
|
+
},
|
|
4801
|
+
},
|
|
4802
|
+
},
|
|
4803
|
+
ports: {
|
|
4804
|
+
in: {
|
|
4805
|
+
/**
|
|
4806
|
+
* The session the call reads — its ruleset, setting values and
|
|
4807
|
+
* owners when `owners` names none. Added 2026-10-16 (W3-S) so a
|
|
4808
|
+
* call that is not handed owners still knows its session; `@1`
|
|
4809
|
+
* evolves in place.
|
|
4810
|
+
*/
|
|
4811
|
+
scope: S.sessionScope,
|
|
4812
|
+
/** The owners resolved this turn — the acting cast, the scene's place. */
|
|
4813
|
+
owners: S.json,
|
|
4814
|
+
/** `prose`, `mechanics` or `scripts`; else the session's rigour. */
|
|
4815
|
+
rigour: S.text,
|
|
4816
|
+
/**
|
|
4817
|
+
* `resolve`, `apply` or `advance` — or 🚧 `propose` (lane 2,
|
|
4818
|
+
* 2026-10-19): `apply` whose every change is filed for review
|
|
4819
|
+
* (`state_proposals`) rather than applied, for a task on Review.
|
|
4820
|
+
*/
|
|
4821
|
+
mode: S.text,
|
|
4822
|
+
/** The turn's declared actions — what selects the pieces in play. */
|
|
4823
|
+
actions: S.json,
|
|
4824
|
+
/** `apply`: the changes the model proposed, to validate. */
|
|
4825
|
+
deltas: S.json,
|
|
4826
|
+
/** `advance` (or `apply`): story time passed, in the ruleset's unit. */
|
|
4827
|
+
elapsed: S.json,
|
|
4828
|
+
/**
|
|
4829
|
+
* 🚧 **Whose eyes** the blocks are for (2026-10-17): a participant
|
|
4830
|
+
* reference, or `gm` for the game-master-facing step. Decides
|
|
4831
|
+
* what a repertoire's `earshot` and `gmOnly` let into `blocks` —
|
|
4832
|
+
* a holder's own pieces into their voice, the creatures a
|
|
4833
|
+
* player never reads into the Narrator's. Unwired: everyone's
|
|
4834
|
+
* view, which carries nothing marked for the holder or the GM.
|
|
4835
|
+
*/
|
|
4836
|
+
viewer: S.text,
|
|
4837
|
+
/**
|
|
4838
|
+
* 🚧 D3 (2026-10-23): the event that woke the step — `{ id,
|
|
4839
|
+
* payload }` — when a registration or routine runs it on one;
|
|
4840
|
+
* what a function's handler reads as `ctx.event`. Unwired: none.
|
|
4841
|
+
*/
|
|
4842
|
+
event: S.json,
|
|
4843
|
+
},
|
|
4844
|
+
out: {
|
|
4845
|
+
/** Labelled variables: `voice`, `sheet`, `pieces`, `ties`, `outcomes`, `custom`. */
|
|
4846
|
+
blocks: S.json,
|
|
4847
|
+
/** What a step may need: targets, what is equipped, what is allowed this turn. */
|
|
4848
|
+
facts: S.json,
|
|
4849
|
+
/** `apply` / `advance`: rolls, degrees and totals, each with its origins. */
|
|
4850
|
+
outcomes: S.json,
|
|
4851
|
+
/** How each number was reached — for receipts and ledgers, never a prompt. */
|
|
4852
|
+
explain: S.json,
|
|
4853
|
+
/** Proposed changes the mechanics refused, with why — review items, never silent corrections. */
|
|
4854
|
+
rejected: S.json,
|
|
4855
|
+
/**
|
|
4856
|
+
* 🚧 D7 (2026-10-23): the JSON Schema a reply that carries changes
|
|
4857
|
+
* answers against — `{ message, changes }`, built from the
|
|
4858
|
+
* session's ruleset (`facts.replySchema`) — when the step's
|
|
4859
|
+
* `actions` asked for it (`{ replyShape: true }`); else null.
|
|
4860
|
+
*/
|
|
4861
|
+
replySchema: S.json,
|
|
4862
|
+
},
|
|
4863
|
+
},
|
|
4864
|
+
}));
|
|
4865
|
+
/**
|
|
4866
|
+
* One duty a routine or a reply may be asked to do, as its pipeline's own
|
|
4867
|
+
* setting (PLAN-layering §5, R1, A6): a switch the session's owner sees
|
|
4868
|
+
* (`reach: 'owner'`), on or off. `on`/`off` only — *how* a duty's writes land
|
|
4869
|
+
* (applied, or held for review) is the routine's **mode** (R37), never the
|
|
4870
|
+
* duty's.
|
|
4871
|
+
*/
|
|
4872
|
+
const duty = (label, description, on) => ({
|
|
4873
|
+
type: 'boolean',
|
|
4874
|
+
default: on,
|
|
4875
|
+
reach: 'owner',
|
|
4876
|
+
label: { en: label },
|
|
4877
|
+
description: { en: description },
|
|
4878
|
+
});
|
|
4879
|
+
/**
|
|
4880
|
+
* The out-ports every duties step publishes: `modes` (each duty's key →
|
|
4881
|
+
* `full` · `review` · `off`, what a junction reads by `path` and a script by
|
|
4882
|
+
* key), `any` (true when any duty is on) and `main` (both, as one document).
|
|
4883
|
+
*/
|
|
4884
|
+
const dutyPorts = {
|
|
4885
|
+
in: {
|
|
4886
|
+
/**
|
|
4887
|
+
* The routine's firing (`core:inlet/routine@1`'s `routine` port) — its
|
|
4888
|
+
* `mode` is what an on duty runs at: `full` applies, `review` holds
|
|
4889
|
+
* each write for the owner. Unwired (a reply's duties): `full`.
|
|
4890
|
+
*/
|
|
4891
|
+
routine: S.json,
|
|
4892
|
+
},
|
|
4893
|
+
out: {
|
|
4894
|
+
main: S.json,
|
|
4895
|
+
/** `{ [duty key]: 'full' | 'review' | 'off' }`, keyed as the steps that read them name them. */
|
|
4896
|
+
modes: S.json,
|
|
4897
|
+
/** True when any duty is on — the routine has something to do. */
|
|
4898
|
+
any: S.json,
|
|
4899
|
+
},
|
|
4900
|
+
};
|
|
4901
|
+
/**
|
|
4902
|
+
* 🚧 **What a reply reads** (PLAN-layering §4, R1, A6; 2026-10-20) — the
|
|
4903
|
+
* reply's own duties, a switch each, read where the reply branches: *Read the
|
|
4904
|
+
* lorebook* gates what retrieval hands the ranker, *Read the scene* gates
|
|
4905
|
+
* what the context builder is told about where the story is. Neither costs a
|
|
4906
|
+
* call. 🚧 *Replies carry changes* (PLAN-rulesets-functions D7, R7;
|
|
4907
|
+
* 2026-10-23; off): the reply is one JSON object — its words and what the
|
|
4908
|
+
* scene changed of the rules' attributes and entries — and the rules apply
|
|
4909
|
+
* the changes (owner ruling 2026-10-23: no review of a reply's changes; how
|
|
4910
|
+
* strict the rules are and the lore write modes decide what lands, and a
|
|
4911
|
+
* replaced reply's changes go with it). Publishes `modes` keyed `lore-retrieval`,
|
|
4912
|
+
* `scene-reading` and `reply-changes` (each `full` or `off`). Pure; no
|
|
4913
|
+
* model call.
|
|
4914
|
+
*
|
|
4915
|
+
* Was the reply group of the retired background tasks (`resolve-tasks@1`):
|
|
4916
|
+
* a reply's settings belong to the reply (A6), so a preset that swaps the
|
|
4917
|
+
* reply for another shows that one's settings instead (§5).
|
|
4918
|
+
* @experimental
|
|
4919
|
+
*/
|
|
4920
|
+
export const replyDuties = pin(describeTaskDefinition({
|
|
4921
|
+
id: 'core:task/reply-duties@1',
|
|
4922
|
+
i18n: {
|
|
4923
|
+
name: { en: 'What the reply reads' },
|
|
4924
|
+
description: {
|
|
4925
|
+
en: 'Switches for what the reply reads besides the conversation: the lorebook, and where the story is. Neither costs a model call.',
|
|
4926
|
+
},
|
|
4927
|
+
},
|
|
4928
|
+
timeoutMs: 500,
|
|
4929
|
+
slots: {
|
|
4930
|
+
params: {
|
|
4931
|
+
kind: 'parameters',
|
|
4932
|
+
facet: 'behavior',
|
|
4933
|
+
schema: {
|
|
4934
|
+
lore: duty('Read the lorebook', 'Finds the lorebook entries the scene calls for and puts them in the reply’s context.', true),
|
|
4935
|
+
scene: duty('Read the scene', 'Puts where the story is — the place, what it is like, the ways out — into the reply’s context. Writes nothing.', true),
|
|
4936
|
+
changes: duty('Replies carry changes', 'The reply comes back with what the scene changed — a value up or down, something gained or lost — beside its words, and the rules apply it. Swiping, regenerating or deleting the reply takes it back.', false),
|
|
4937
|
+
},
|
|
4938
|
+
},
|
|
4939
|
+
},
|
|
4940
|
+
ports: dutyPorts,
|
|
4941
|
+
}));
|
|
4942
|
+
/**
|
|
4943
|
+
* 🚧 **Note what changed** (PLAN-layering §4, R5, R37; 2026-10-20; titled by
|
|
4944
|
+
* the routine's name since 2026-10-23, PLAN-genres-seams S7 — was *What the
|
|
4945
|
+
* reckoning keeps*) — the duties of a reckoning routine (Story's
|
|
4946
|
+
* `core:spec/story-reckoning`; the Lair's keeper titles its own card):
|
|
4947
|
+
* one JSON call after a turn or a round that notes what the story made true.
|
|
4948
|
+
* Each duty is a switch; the routine's mode decides whether what an on duty
|
|
4949
|
+
* finds is applied (`full`) or held for review (`review`). Publishes `modes`
|
|
4950
|
+
* keyed `attributes`, `conditions`, `time`, `places-on-move`, `timed-expiry`
|
|
4951
|
+
* — the keys the reckoning's scripts and junctions read — and `any`.
|
|
4952
|
+
*
|
|
4953
|
+
* *End what runs out* (`timed-expiry`) and *Track conditions* are also what
|
|
4954
|
+
* the ruleset handler's expiry reads (the host, lane 6). A duty that writes
|
|
4955
|
+
* a lorebook (*Describe new places*) reads Off in a session with none.
|
|
4956
|
+
* Pure; no model call.
|
|
4957
|
+
* @experimental
|
|
4958
|
+
*/
|
|
4959
|
+
export const reckoningDuties = pin(describeTaskDefinition({
|
|
4960
|
+
id: 'core:task/reckoning-duties@1',
|
|
4961
|
+
i18n: {
|
|
4962
|
+
name: { en: 'Note what changed' },
|
|
4963
|
+
description: {
|
|
4964
|
+
en: 'Switches for what is noted after the story moves: the sheets, conditions, the clock, new places, what runs out. How the changes land is the routine’s mode.',
|
|
4965
|
+
},
|
|
4966
|
+
},
|
|
4967
|
+
timeoutMs: 500,
|
|
4968
|
+
slots: {
|
|
4969
|
+
params: {
|
|
4970
|
+
kind: 'parameters',
|
|
4971
|
+
facet: 'behavior',
|
|
4972
|
+
schema: {
|
|
4973
|
+
attributes: duty('Keep the sheets', 'Notes what the story changed about health, mood, belongings and the place, and updates the sheets.', true),
|
|
4974
|
+
conditions: duty('Track conditions', 'Puts conditions on and takes them off: hurt, tired, poisoned, inspired.', true),
|
|
4975
|
+
time: duty('Move the clock', 'Moves the story clock by as much time as the story took.', true),
|
|
4976
|
+
placesOnMove: duty('Describe new places', 'When the story moves somewhere new, files the place and its ways out.', true),
|
|
4977
|
+
timedExpiry: duty('End what runs out', 'Ends conditions and effects when their time is up.', true),
|
|
4978
|
+
},
|
|
4979
|
+
},
|
|
4980
|
+
},
|
|
4981
|
+
ports: dutyPorts,
|
|
4982
|
+
}));
|
|
4983
|
+
/**
|
|
4984
|
+
* 🚧 **Look back over the story** (PLAN-layering §4, R5, R37; 2026-10-20;
|
|
4985
|
+
* titled by the routine's name since 2026-10-23, S7 — was *What the sweep
|
|
4986
|
+
* files*) — the duties of a sweep routine (Story's `core:spec/story-sweep`): ONE batched
|
|
4987
|
+
* JSON call every few turns that looks back over the story and files what is
|
|
4988
|
+
* worth keeping. Each duty is a switch; the routine's mode decides whether
|
|
4989
|
+
* what it files is written (`full`) or held for review (`review`). Publishes
|
|
4990
|
+
* `modes` keyed `summary`, `lore`, `cast`, `relationships`, `world-state`,
|
|
4991
|
+
* `scenes`, `goals`, `goal-reached`, `scene-moved-on` — the keys the sweep's scripts and
|
|
4992
|
+
* junctions read — and `any`. Duties that write a lorebook read Off in a
|
|
4993
|
+
* session with none. *Mark goals reached* (`goal-reached`) is read by the
|
|
4994
|
+
* host when the goals note moves (lane 6). Pure; no model call.
|
|
4995
|
+
* @experimental
|
|
4996
|
+
*/
|
|
4997
|
+
export const sweepDuties = pin(describeTaskDefinition({
|
|
4998
|
+
id: 'core:task/sweep-duties@1',
|
|
4999
|
+
i18n: {
|
|
5000
|
+
name: { en: 'Look back over the story' },
|
|
5001
|
+
description: {
|
|
5002
|
+
en: 'Switches for what is filed every few turns: a summary, lore, people, how they stand, the world, places, goals. How it lands is the routine’s mode.',
|
|
5003
|
+
},
|
|
5004
|
+
},
|
|
5005
|
+
timeoutMs: 500,
|
|
5006
|
+
slots: {
|
|
5007
|
+
params: {
|
|
5008
|
+
kind: 'parameters',
|
|
5009
|
+
facet: 'behavior',
|
|
5010
|
+
schema: {
|
|
5011
|
+
summary: duty('Summarize the story', 'Files a summary of what happened in the lorebook’s history.', true),
|
|
5012
|
+
lore: duty('Add to the lore', 'Files new facts the story established as lorebook entries.', true),
|
|
5013
|
+
cast: duty('Note new people', 'Files the people the story introduced as lorebook entries.', true),
|
|
5014
|
+
relationships: duty('Track relationships', 'Proposes how the characters now stand with each other, for you to look over.', false),
|
|
5015
|
+
worldState: duty('Keep the world', 'Updates the world’s state from what happened: where the story is, the time of day, the weather.', true),
|
|
5016
|
+
scenes: duty('File the places', 'Files each place the story used as a place in the lorebook.', false),
|
|
5017
|
+
goals: duty('Track goals', 'Keeps a running note of what the characters are after and how close they are.', false),
|
|
5018
|
+
goalReached: duty('Mark goals reached', 'When a goal in the goals note is ticked, says so in the story and tells everyone in the session.', false),
|
|
5019
|
+
sceneMovedOn: duty('Notice when the scene moves on', 'Looks over the lines since the last look for where the story moved on to a new scene, and suggests one there — or starts it, when this session’s scenes are Automatic.', true),
|
|
5020
|
+
},
|
|
5021
|
+
},
|
|
5022
|
+
},
|
|
5023
|
+
ports: {
|
|
5024
|
+
in: dutyPorts.in,
|
|
5025
|
+
out: {
|
|
5026
|
+
...dutyPorts.out,
|
|
5027
|
+
/** 🚧 A \`JudgedSceneCheck\` (pass 7, R-i): what *Notice when the scene moves on* may judge this run — not due when the duty is Off or the host's conditions do not hold. */
|
|
5028
|
+
sceneCheck: S.json,
|
|
5029
|
+
},
|
|
5030
|
+
},
|
|
5031
|
+
}));
|
|
4011
5032
|
//# sourceMappingURL=tasks.js.map
|