@serene-pub/contracts 0.6.0-pr-6 → 0.6.0-pr-8
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/inlets.d.ts +16 -8
- package/dist/inlets.js +17 -8
- package/dist/oracles.d.ts +192 -5
- package/dist/oracles.js +106 -10
- package/dist/outlets.d.ts +413 -18
- package/dist/outlets.js +462 -21
- package/dist/queries.d.ts +429 -1
- package/dist/queries.js +435 -3
- package/dist/tasks.d.ts +257 -24
- package/dist/tasks.js +175 -15
- package/package.json +3 -3
package/dist/queries.js
CHANGED
|
@@ -1144,12 +1144,230 @@ export const castPresences = pin(describeQueryDefinition({
|
|
|
1144
1144
|
/** A session with no book, or a book that dates nobody, reads nothing — a normal state. */
|
|
1145
1145
|
optional: true,
|
|
1146
1146
|
ports: {
|
|
1147
|
-
in: {
|
|
1147
|
+
in: {
|
|
1148
|
+
scope: S.sessionScope,
|
|
1149
|
+
/**
|
|
1150
|
+
* 🚧 The hour to place the cast at (M0, SHAPES L3): a clock target. Unwired,
|
|
1151
|
+
* the clock's present hour, today.
|
|
1152
|
+
*/
|
|
1153
|
+
atHour: S.clockTarget,
|
|
1154
|
+
},
|
|
1148
1155
|
out: {
|
|
1149
1156
|
/** `{ bindingId, from, until, position }[]`, on the session's line. */
|
|
1150
1157
|
main: S.json,
|
|
1151
1158
|
/** The story date the session reads at, or null for the head. */
|
|
1152
1159
|
at: S.json,
|
|
1160
|
+
/**
|
|
1161
|
+
* 🚧 `{ bindingId: number; where: string }[]` — where each cast member is at `atHour`, read
|
|
1162
|
+
* from the first `schedule` field on an entry they hold; a member with none is left out.
|
|
1163
|
+
*/
|
|
1164
|
+
placements: S.json,
|
|
1165
|
+
},
|
|
1166
|
+
},
|
|
1167
|
+
}));
|
|
1168
|
+
/**
|
|
1169
|
+
* 🚧 **Minutes a round is worth** — the session's round worth, as a whole
|
|
1170
|
+
* number and as a clock step.
|
|
1171
|
+
*
|
|
1172
|
+
* It reads the session's `roundWorth` genre field from the settings document
|
|
1173
|
+
* (the cascade applied: the session's value, else its preset's, else the
|
|
1174
|
+
* genre's, else the field's default). `minutes` is a whole number ≥ 0; `step`
|
|
1175
|
+
* is `{ by: minutes, unit: 'minutes' }`, exactly what `core:task/clock-step@1`'s
|
|
1176
|
+
* `step` in-port takes; `main` is `{ minutes, step }`. All of it is 0 when the
|
|
1177
|
+
* genre places no `roundWorth` field (it has not opted in) or the session sets
|
|
1178
|
+
* 0 (off).
|
|
1179
|
+
*
|
|
1180
|
+
* It never reads or moves the clock and does not say whether one is set: gate
|
|
1181
|
+
* on `core:query/cast-presences@1`'s `at` for that.
|
|
1182
|
+
*
|
|
1183
|
+
* ⚠ Not the Dungeon Crawler Planner's round minutes (the time one round took,
|
|
1184
|
+
* judged), and not `core:task/clock-step@1`.
|
|
1185
|
+
* @experimental
|
|
1186
|
+
*/
|
|
1187
|
+
export const roundWorth = pin(describeQueryDefinition({
|
|
1188
|
+
id: 'core:query/round-worth@1',
|
|
1189
|
+
i18n: { name: { en: 'Minutes a round is worth' } },
|
|
1190
|
+
timeoutMs: 2000,
|
|
1191
|
+
ports: {
|
|
1192
|
+
in: { scope: S.sessionScope },
|
|
1193
|
+
out: {
|
|
1194
|
+
/** `{ minutes, step }`. */
|
|
1195
|
+
main: S.json,
|
|
1196
|
+
/** The round worth as a whole number of minutes, ≥ 0. */
|
|
1197
|
+
minutes: S.json,
|
|
1198
|
+
/** `{ by: minutes, unit: 'minutes' }`: what `clock-step@1`'s `step` in-port takes. */
|
|
1199
|
+
step: S.json,
|
|
1200
|
+
},
|
|
1201
|
+
},
|
|
1202
|
+
}));
|
|
1203
|
+
/**
|
|
1204
|
+
* 🚧 **Where scenes begin** — the scenes routine's code-only look back over
|
|
1205
|
+
* the session's `main` channel (every name here is provisional).
|
|
1206
|
+
*
|
|
1207
|
+
* It walks the channel's standing lines up to the newest line that is at least
|
|
1208
|
+
* `depth` rounds old (a round as the turn order counts it), evaluates the
|
|
1209
|
+
* session's enabled boundary triggers line by line, and returns
|
|
1210
|
+
* `SceneBoundary[]` in line order on `main`. **A query writes nothing.**
|
|
1211
|
+
*
|
|
1212
|
+
* Where the walk starts is derived, never stored: after the latest of the
|
|
1213
|
+
* channel's latest scene boundary, its latest decided or offered scene cue, and
|
|
1214
|
+
* a branch's last copied line. `routine` is the routine inlet's `routine` port
|
|
1215
|
+
* (the firing); its cadence's `n` bounds how far back a session with none of
|
|
1216
|
+
* those looks. `depth` keeps a line that is swiped, retaken or taken back from
|
|
1217
|
+
* ever being read.
|
|
1218
|
+
*
|
|
1219
|
+
* ⚠ Not the judged scene check (the sweep's model question) and not
|
|
1220
|
+
* `core:outlet/propose-scene-cue@1` (which places).
|
|
1221
|
+
* @experimental
|
|
1222
|
+
*/
|
|
1223
|
+
export const sceneBoundaries = pin(describeQueryDefinition({
|
|
1224
|
+
id: 'core:query/scene-boundaries@1',
|
|
1225
|
+
i18n: { name: { en: 'Where scenes begin' } },
|
|
1226
|
+
timeoutMs: 5000,
|
|
1227
|
+
slots: {
|
|
1228
|
+
params: {
|
|
1229
|
+
kind: 'parameters',
|
|
1230
|
+
facet: 'behavior',
|
|
1231
|
+
schema: {
|
|
1232
|
+
depth: {
|
|
1233
|
+
type: 'integer',
|
|
1234
|
+
default: 2,
|
|
1235
|
+
min: 1,
|
|
1236
|
+
max: 50,
|
|
1237
|
+
label: { en: 'Rounds it waits' },
|
|
1238
|
+
description: {
|
|
1239
|
+
en: 'Only lines at least this many rounds old are read, so a line that is swiped, retaken or taken back is never read.',
|
|
1240
|
+
},
|
|
1241
|
+
},
|
|
1242
|
+
},
|
|
1243
|
+
},
|
|
1244
|
+
},
|
|
1245
|
+
ports: {
|
|
1246
|
+
in: { scope: S.sessionScope, routine: S.json },
|
|
1247
|
+
out: { main: S.json },
|
|
1248
|
+
},
|
|
1249
|
+
}));
|
|
1250
|
+
/**
|
|
1251
|
+
* 🚧 **The scene due a summary** — the scene summaries routine's code-only look
|
|
1252
|
+
* at the session's `main` channel (every name here is provisional).
|
|
1253
|
+
*
|
|
1254
|
+
* `main` is **the oldest** finished scene on `main` that is due a summary, as
|
|
1255
|
+
* its scene id (a number), or `null` when none is due. Due: it closed at least
|
|
1256
|
+
* `depth` rounds ago (a round as the turn order counts it), it is not
|
|
1257
|
+
* summarized, and nobody has decided about it — a summary a person saved, a
|
|
1258
|
+
* review a person discarded, a failed run, a run going or a review waiting are
|
|
1259
|
+
* never taken; the session's **Summaries** is not *Never*; and no turns are
|
|
1260
|
+
* taken back. At most one scene per run. **A query writes nothing.**
|
|
1261
|
+
*
|
|
1262
|
+
* ⚠ Not *Summarize all* (the app's `scenesToSummarize`: every unsummarized
|
|
1263
|
+
* scene, a person's press) and not `core:outlet/summarize-finished-scene@1`
|
|
1264
|
+
* (which starts the summary).
|
|
1265
|
+
* @experimental
|
|
1266
|
+
*/
|
|
1267
|
+
export const sceneSummaryDue = pin(describeQueryDefinition({
|
|
1268
|
+
id: 'core:query/scene-summary-due@1',
|
|
1269
|
+
i18n: { name: { en: 'The scene due a summary' } },
|
|
1270
|
+
timeoutMs: 5000,
|
|
1271
|
+
slots: {
|
|
1272
|
+
params: {
|
|
1273
|
+
kind: 'parameters',
|
|
1274
|
+
facet: 'behavior',
|
|
1275
|
+
schema: {
|
|
1276
|
+
depth: {
|
|
1277
|
+
type: 'integer',
|
|
1278
|
+
default: 6,
|
|
1279
|
+
min: 1,
|
|
1280
|
+
max: 50,
|
|
1281
|
+
label: { en: 'Rounds after it ends' },
|
|
1282
|
+
description: {
|
|
1283
|
+
en: 'A scene is summarized once it ended at least this many rounds ago, so its lines have stopped changing.',
|
|
1284
|
+
},
|
|
1285
|
+
},
|
|
1286
|
+
},
|
|
1287
|
+
},
|
|
1288
|
+
},
|
|
1289
|
+
ports: {
|
|
1290
|
+
in: { scope: S.sessionScope },
|
|
1291
|
+
out: { main: S.json },
|
|
1292
|
+
},
|
|
1293
|
+
}));
|
|
1294
|
+
/**
|
|
1295
|
+
* 🚧 **Earlier scenes** — the summaries of this session's finished scenes, for
|
|
1296
|
+
* the block *Earlier in the story* (every name here is provisional).
|
|
1297
|
+
*
|
|
1298
|
+
* `main` is `{ maxTokens: number | null, scenes: Array<{ sceneId: number,
|
|
1299
|
+
* name: string, summary: string, firstLineId: number }> }`: the session's
|
|
1300
|
+
* closed `main`-channel scenes with a usable summary (`summaryStatus =
|
|
1301
|
+
* 'done'`, a person's or the routine's) that are not compiled into a history
|
|
1302
|
+
* entry, in story order (oldest first, by where each scene starts: its opening
|
|
1303
|
+
* line, else its smallest selected line), at most the newest 200. `name` is
|
|
1304
|
+
* the scene's name as shown; `firstLineId` is its first line's message id.
|
|
1305
|
+
* `maxTokens` is `floor(share × budget.total)`, or `null` when `budget` is
|
|
1306
|
+
* unwired (then the block is not capped).
|
|
1307
|
+
*
|
|
1308
|
+
* It returns data, never rendered text: `core:task/assemble@2` decides which
|
|
1309
|
+
* scenes show (only those whose first line is older than the first line the
|
|
1310
|
+
* prompt keeps) and fits them to `maxTokens`.
|
|
1311
|
+
*
|
|
1312
|
+
* ⚠ Not `core:query/scene-summary-due@1` (the routine's look, one scene), not
|
|
1313
|
+
* `core:spec/scene-summaries` (the routine that writes the summaries) and not
|
|
1314
|
+
* `core:query/session-history@1`. **A query writes nothing.**
|
|
1315
|
+
* @experimental
|
|
1316
|
+
*/
|
|
1317
|
+
export const earlierScenes = pin(describeQueryDefinition({
|
|
1318
|
+
id: 'core:query/earlier-scenes@1',
|
|
1319
|
+
i18n: { name: { en: 'Earlier scenes' } },
|
|
1320
|
+
timeoutMs: 2000,
|
|
1321
|
+
slots: {
|
|
1322
|
+
params: {
|
|
1323
|
+
kind: 'parameters',
|
|
1324
|
+
facet: 'weights',
|
|
1325
|
+
schema: {
|
|
1326
|
+
share: {
|
|
1327
|
+
type: 'number',
|
|
1328
|
+
min: 0,
|
|
1329
|
+
max: 1,
|
|
1330
|
+
default: 0.15,
|
|
1331
|
+
label: { en: 'Share — earlier scenes' },
|
|
1332
|
+
description: {
|
|
1333
|
+
en: 'How much of the context window the summaries of earlier scenes may take. When they do not fit, the oldest are left out first.',
|
|
1334
|
+
},
|
|
1335
|
+
},
|
|
1336
|
+
},
|
|
1337
|
+
},
|
|
1338
|
+
},
|
|
1339
|
+
ports: {
|
|
1340
|
+
in: { scope: S.sessionScope, budget: S.budget },
|
|
1341
|
+
out: { main: S.json },
|
|
1342
|
+
},
|
|
1343
|
+
}));
|
|
1344
|
+
/**
|
|
1345
|
+
* 🚧 **One cast member**, as the scope session reads them — their line, their
|
|
1346
|
+
* clock, the session's own notes over the book.
|
|
1347
|
+
*
|
|
1348
|
+
* `member` is `seated-member:<castMemberId>`, `player-seat:<seatId>` (that
|
|
1349
|
+
* seat's cast member), or a cast member id (a number) of the session's
|
|
1350
|
+
* lorebook or its own. Anything else, a seat with no cast member, or a member
|
|
1351
|
+
* the session doesn't read is refused with a sentence.
|
|
1352
|
+
*
|
|
1353
|
+
* `main` is `CastMemberV1` (`@serene-pub/sdk`): the member, the card version
|
|
1354
|
+
* they follow, which fields they follow, and the character profile as the
|
|
1355
|
+
* session reads it.
|
|
1356
|
+
* @experimental
|
|
1357
|
+
*/
|
|
1358
|
+
export const castMember = pin(describeQueryDefinition({
|
|
1359
|
+
id: 'core:query/cast-member@1',
|
|
1360
|
+
i18n: { name: { en: 'Cast member' } },
|
|
1361
|
+
timeoutMs: 2000,
|
|
1362
|
+
ports: {
|
|
1363
|
+
in: {
|
|
1364
|
+
scope: S.sessionScope,
|
|
1365
|
+
/** `seated-member:<id>`, `player-seat:<id>`, or a cast member id. */
|
|
1366
|
+
member: S.json,
|
|
1367
|
+
},
|
|
1368
|
+
out: {
|
|
1369
|
+
/** `CastMemberV1`. */
|
|
1370
|
+
main: S.json,
|
|
1153
1371
|
},
|
|
1154
1372
|
},
|
|
1155
1373
|
}));
|
|
@@ -2364,7 +2582,70 @@ export const sessionAnnex = pin(describeQueryDefinition({
|
|
|
2364
2582
|
/** Whose prompt, for `view: 'ai'` — a `character:` or `envoy:` reference. */
|
|
2365
2583
|
speaker: S.participantRef,
|
|
2366
2584
|
},
|
|
2367
|
-
out: {
|
|
2585
|
+
out: {
|
|
2586
|
+
main: S.json,
|
|
2587
|
+
/**
|
|
2588
|
+
* 🚧 The owner's **annex document version** (M2a a8): a count the
|
|
2589
|
+
* host moves with every write of that document, 0 before the
|
|
2590
|
+
* first. Wire it into `set-session-annex`'s `base` to make the
|
|
2591
|
+
* write a compare-and-set. Absent for `view: 'template'` (many
|
|
2592
|
+
* owners, no one version).
|
|
2593
|
+
*/
|
|
2594
|
+
version: S.json,
|
|
2595
|
+
},
|
|
2596
|
+
},
|
|
2597
|
+
}));
|
|
2598
|
+
/**
|
|
2599
|
+
* 🚧 The **lorebook annex** (M0, SHAPES L9): read one owner's document
|
|
2600
|
+
* out of the annex of the book the session reads — the session annex's model
|
|
2601
|
+
* at book scope, for world-level engine state that is neither an attribute nor
|
|
2602
|
+
* prose. Like `session-annex@1`, the owner defaults to the running spec's own
|
|
2603
|
+
* namespace, and reading another's takes `sharedAnnex`.
|
|
2604
|
+
*
|
|
2605
|
+
* ⚠ Not an entry, and not a save: typed world facts stay attributes, and a
|
|
2606
|
+
* session is the save.
|
|
2607
|
+
* @experimental
|
|
2608
|
+
*/
|
|
2609
|
+
export const lorebookAnnex = pin(describeQueryDefinition({
|
|
2610
|
+
id: 'core:query/lorebook-annex@1',
|
|
2611
|
+
i18n: { name: { en: 'Lorebook annex' } },
|
|
2612
|
+
timeoutMs: 1000,
|
|
2613
|
+
slots: {
|
|
2614
|
+
params: {
|
|
2615
|
+
kind: 'parameters',
|
|
2616
|
+
facet: 'behavior',
|
|
2617
|
+
schema: {
|
|
2618
|
+
owner: {
|
|
2619
|
+
type: 'string',
|
|
2620
|
+
default: '',
|
|
2621
|
+
label: { en: 'Owner' },
|
|
2622
|
+
description: {
|
|
2623
|
+
en: "Whose document to read. Blank means this pipeline's own.",
|
|
2624
|
+
},
|
|
2625
|
+
},
|
|
2626
|
+
sharedAnnex: {
|
|
2627
|
+
type: 'boolean',
|
|
2628
|
+
default: false,
|
|
2629
|
+
label: { en: 'Read another owner' },
|
|
2630
|
+
description: {
|
|
2631
|
+
en: "Allow reading a document this pipeline does not own. Off refuses, with a note on the receipt.",
|
|
2632
|
+
},
|
|
2633
|
+
},
|
|
2634
|
+
},
|
|
2635
|
+
},
|
|
2636
|
+
},
|
|
2637
|
+
ports: {
|
|
2638
|
+
in: { scope: S.sessionScope },
|
|
2639
|
+
out: {
|
|
2640
|
+
main: S.json,
|
|
2641
|
+
/**
|
|
2642
|
+
* 🚧 (M2b) The owner's annex document version on the book a
|
|
2643
|
+
* `set-lorebook-annex` from this run would write (0 before the first
|
|
2644
|
+
* write) — wire it into that step's `base` for a compare-and-set.
|
|
2645
|
+
* Absent when the run has no book to write.
|
|
2646
|
+
*/
|
|
2647
|
+
version: S.json,
|
|
2648
|
+
},
|
|
2368
2649
|
},
|
|
2369
2650
|
}));
|
|
2370
2651
|
// ── Summarization ───────────────────────────────────────────────────────────
|
|
@@ -2671,6 +2952,14 @@ export const graphScenes = pin(describeQueryDefinition({
|
|
|
2671
2952
|
* declaration default, with absence meaning **inherit** rather than zero, and
|
|
2672
2953
|
* derived slots computed rather than read.
|
|
2673
2954
|
*
|
|
2955
|
+
* 🚧 Each `cast.byId` entry carries `ref` (the seat's participant reference,
|
|
2956
|
+
* as the host fills it), `castMemberId` (the seat's cast member) and `cardId`
|
|
2957
|
+
* (the member's active card on the timeline; null when card-less). A reader
|
|
2958
|
+
* looks an entry up by `ref` or `castMemberId` (or takes the owner's `key` off
|
|
2959
|
+
* `session-state@1`'s owners), never by building or parsing the key: it is an
|
|
2960
|
+
* opaque owner key — `player_seat:<id>`, 🚧 `seated_member:<id>` from the
|
|
2961
|
+
* flip, ⏳ the card id before it.
|
|
2962
|
+
*
|
|
2674
2963
|
* A Query, and a plain one: what it is is a read. There is no as-of parameter
|
|
2675
2964
|
* — this is the `current` view, and the temporal registry that would give the
|
|
2676
2965
|
* other one is not built (see docs/stats-and-states.md).
|
|
@@ -2813,7 +3102,8 @@ export const lorebookState = pin(describeQueryDefinition({
|
|
|
2813
3102
|
/**
|
|
2814
3103
|
* One owner: `"world"`, `{ kind: 'cast_member', id }` or
|
|
2815
3104
|
* `{ kind: 'location', id }` (the session kinds `session`,
|
|
2816
|
-
* `session_cast`, `session_location` are
|
|
3105
|
+
* 🚧 `seated_member`, ⏳ `session_cast`, `session_location` are
|
|
3106
|
+
* translated). Optional.
|
|
2817
3107
|
*/
|
|
2818
3108
|
owner: S.json,
|
|
2819
3109
|
/** 🚧 `'main'`, `'mostRecent'`, `'session'` or a branch id of this book. Optional. */
|
|
@@ -3412,4 +3702,146 @@ export const likenessImages = pin(describeQueryDefinition({
|
|
|
3412
3702
|
out: { main: S.mediaList, references: S.mediaList },
|
|
3413
3703
|
},
|
|
3414
3704
|
}));
|
|
3705
|
+
// ── 🚧 core:query/message-line@1 (speech lane D follow-up, ★1, 2026-10-28) ──
|
|
3706
|
+
/**
|
|
3707
|
+
* 🚧 **One message as a line to speak**: its words, whose line it is and the
|
|
3708
|
+
* inflection it was recorded with — what `core:task/cue-lines@1` takes, read
|
|
3709
|
+
* off ONE stored row by id. The manual *Read aloud* / *Say it as…* verbs'
|
|
3710
|
+
* read (`core:spec/speak-message`): the history read's rows are opaque
|
|
3711
|
+
* (`messages@1`), so nothing else can hand cue-lines a stored line's speaker
|
|
3712
|
+
* or inflection.
|
|
3713
|
+
*
|
|
3714
|
+
* - `text` — the row's words; **empty** when the row is not this session's,
|
|
3715
|
+
* is hidden, or is still being written (the history read's rule), so a
|
|
3716
|
+
* spec junctions on it and nothing is spoken.
|
|
3717
|
+
* - `speaker` — the participant reference the row was voiced by: an envoy's
|
|
3718
|
+
* `envoy:<slug>`, a persona's or character's `character:<id>`; absent for
|
|
3719
|
+
* narration and for a person's own line with no persona.
|
|
3720
|
+
* - `inflection` — the line's recorded inflection: the label of the sprite
|
|
3721
|
+
* shown on its active swipe (a sprite pick is an inflection). Absent when
|
|
3722
|
+
* no sprite was shown.
|
|
3723
|
+
*
|
|
3724
|
+
* `say` overrides the recorded inflection with what a person asked for (the
|
|
3725
|
+
* *Say it as…* press's collected text): a word the host's marker table knows
|
|
3726
|
+
* (`sighs`, `angrily`, `joy`) becomes that label; any other words are kept as
|
|
3727
|
+
* the label as written, which a prose-taking model reads as direction and a
|
|
3728
|
+
* tag-taking model drops. Blank `say` keeps the recorded one.
|
|
3729
|
+
*
|
|
3730
|
+
* No writes, no model: a read.
|
|
3731
|
+
* @experimental
|
|
3732
|
+
*/
|
|
3733
|
+
export const messageLine = pin(describeQueryDefinition({
|
|
3734
|
+
id: 'core:query/message-line@1',
|
|
3735
|
+
i18n: {
|
|
3736
|
+
name: { en: 'Message line' },
|
|
3737
|
+
description: {
|
|
3738
|
+
en: "One message's words, who said it, and how it was said — for reading it aloud.",
|
|
3739
|
+
},
|
|
3740
|
+
},
|
|
3741
|
+
timeoutMs: 2000,
|
|
3742
|
+
ports: {
|
|
3743
|
+
in: {
|
|
3744
|
+
scope: S.sessionScope,
|
|
3745
|
+
/** The row — the inlet's `messageId`, the message a press on a message's ⋮ was made on. */
|
|
3746
|
+
messageId: S.rowIds,
|
|
3747
|
+
/** How it should sound, in a person's words; blank keeps the recorded inflection. */
|
|
3748
|
+
say: S.text,
|
|
3749
|
+
},
|
|
3750
|
+
out: {
|
|
3751
|
+
main: S.text,
|
|
3752
|
+
/** The row's words; empty when the row is hidden, still written, or not this session's. */
|
|
3753
|
+
text: S.text,
|
|
3754
|
+
/** Whose line it is; absent for narration. */
|
|
3755
|
+
speaker: S.participantRef,
|
|
3756
|
+
/** How it is spoken: `say` when given, else the recorded sprite label; absent when neither. */
|
|
3757
|
+
inflection: S.inflection,
|
|
3758
|
+
},
|
|
3759
|
+
},
|
|
3760
|
+
}));
|
|
3761
|
+
/**
|
|
3762
|
+
* The largest file `core:query/plugin-storage@1` will read: 4 MiB. A bigger
|
|
3763
|
+
* file is refused with a sentence naming both sizes. (M2a)
|
|
3764
|
+
* @experimental
|
|
3765
|
+
*/
|
|
3766
|
+
export const PLUGIN_STORAGE_QUERY_MAX_BYTES = 4 * 1024 * 1024;
|
|
3767
|
+
/**
|
|
3768
|
+
* 🚧 (M2a) **A file from the running plugin's own storage** — read-only, size
|
|
3769
|
+
* capped, one file per read. Say a plugin's genre has a create pipeline that
|
|
3770
|
+
* loads a custom world the person imported: the world sits in the plugin's
|
|
3771
|
+
* storage, and this reads it into the run.
|
|
3772
|
+
*
|
|
3773
|
+
* Why a query and not a task: tasks are pure (F11) — the same inputs give the
|
|
3774
|
+
* same output — and a file on disk is state outside the graph, so it enters
|
|
3775
|
+
* the way every other outside state does, through a query.
|
|
3776
|
+
*
|
|
3777
|
+
* Whose storage: only the plugin that owns the running pipeline. A core or
|
|
3778
|
+
* person-authored pipeline is refused ("plugin-storage reads only a plugin's
|
|
3779
|
+
* own pipeline's storage"). `scope: 'pub'` reads the plugin's shared files and
|
|
3780
|
+
* needs its `storage` grant in force; `scope: 'me'` reads the acting person's
|
|
3781
|
+
* own folder and needs `storage-per-user` in force and a person on the run.
|
|
3782
|
+
* The path is relative, with no `..`, and stays inside the folder. No write,
|
|
3783
|
+
* no listing. A missing file answers `found: false`, not a halt.
|
|
3784
|
+
* @experimental
|
|
3785
|
+
*/
|
|
3786
|
+
export const pluginStorage = pin(describeQueryDefinition({
|
|
3787
|
+
id: 'core:query/plugin-storage@1',
|
|
3788
|
+
i18n: { name: { en: 'Plugin storage' } },
|
|
3789
|
+
timeoutMs: 2000,
|
|
3790
|
+
slots: {
|
|
3791
|
+
params: {
|
|
3792
|
+
kind: 'parameters',
|
|
3793
|
+
facet: 'behavior',
|
|
3794
|
+
schema: {
|
|
3795
|
+
scope: {
|
|
3796
|
+
type: 'enum',
|
|
3797
|
+
default: 'pub',
|
|
3798
|
+
label: { en: 'Whose files' },
|
|
3799
|
+
members: [
|
|
3800
|
+
{
|
|
3801
|
+
key: 'pub',
|
|
3802
|
+
label: { en: 'The plugin' },
|
|
3803
|
+
description: { en: "The plugin's shared files." },
|
|
3804
|
+
},
|
|
3805
|
+
{
|
|
3806
|
+
key: 'me',
|
|
3807
|
+
label: { en: 'The person' },
|
|
3808
|
+
description: {
|
|
3809
|
+
en: "The acting person's own files for this plugin.",
|
|
3810
|
+
},
|
|
3811
|
+
},
|
|
3812
|
+
],
|
|
3813
|
+
},
|
|
3814
|
+
as: {
|
|
3815
|
+
type: 'enum',
|
|
3816
|
+
default: 'json',
|
|
3817
|
+
label: { en: 'Read as' },
|
|
3818
|
+
members: [
|
|
3819
|
+
{
|
|
3820
|
+
key: 'json',
|
|
3821
|
+
label: { en: 'JSON' },
|
|
3822
|
+
description: { en: 'Parse the file and give the value.' },
|
|
3823
|
+
},
|
|
3824
|
+
{
|
|
3825
|
+
key: 'text',
|
|
3826
|
+
label: { en: 'Text' },
|
|
3827
|
+
description: { en: 'Give the file as text.' },
|
|
3828
|
+
},
|
|
3829
|
+
],
|
|
3830
|
+
},
|
|
3831
|
+
},
|
|
3832
|
+
},
|
|
3833
|
+
},
|
|
3834
|
+
ports: {
|
|
3835
|
+
in: {
|
|
3836
|
+
/** The file, relative to the folder: `worlds/atlas.json`. */
|
|
3837
|
+
path: S.text,
|
|
3838
|
+
},
|
|
3839
|
+
out: {
|
|
3840
|
+
/** The parsed JSON, or the text; null when the file is missing. */
|
|
3841
|
+
main: S.json,
|
|
3842
|
+
/** Whether the file was there. */
|
|
3843
|
+
found: S.json,
|
|
3844
|
+
},
|
|
3845
|
+
},
|
|
3846
|
+
}));
|
|
3415
3847
|
//# sourceMappingURL=queries.js.map
|