@stage5/lumine 0.3.81 → 0.3.82
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/lib/admin-arena.js +40 -1
- package/lib/commands.js +1 -1
- package/package.json +1 -1
- package/sdk/LUMINE_ADMIN.md +65 -0
package/lib/admin-arena.js
CHANGED
|
@@ -13,6 +13,9 @@ import path from "node:path";
|
|
|
13
13
|
// at once; a dry run (validation only) unless --confirm;
|
|
14
14
|
// re-importing a folder retires that paper's earlier items
|
|
15
15
|
// status --item <id> --to live|retired|checked
|
|
16
|
+
// revise --file <revisions.json> in-place text/passage/visual/review fixes to
|
|
17
|
+
// live items: same item id, a new content version;
|
|
18
|
+
// a dry run unless --confirm; audited
|
|
16
19
|
// today-withdraw --user <id> (--keys <k,...> | --file <withdraw.json>) --reason <text>
|
|
17
20
|
// withdraw that member's unserved queued Today's
|
|
18
21
|
// Challenge questions (preview unless --confirm; audited)
|
|
@@ -22,7 +25,7 @@ import path from "node:path";
|
|
|
22
25
|
// <itemId>.png renders of picture-option items
|
|
23
26
|
// (panels are drawn by the web, not stored)
|
|
24
27
|
export const ARENA_USAGE =
|
|
25
|
-
"Usage: lumine admin arena queue | paper-queue [--cursor <id>] [--limit <1-100>] | marking [--cursor <id>] [--limit <1-200>] | import (--dir <paper folder> | --additive --file <reviewed-items.json>) [--audio audio/<exam>/<paper>] [--live] [--confirm] | status --item <id> --to live|retired|checked [--confirm] | today-queue [--cursor <id>] [--limit <1-100>] | today-member --user <id> | today-import --file <reviewed-questions.json> [--confirm] | today-withdraw --user <id> (--keys <key,...> | --file <withdraw.json>) --reason <text> [--confirm] | picture-audit [--items <id,id,...> | --cursor <id>] [--limit <1-20>] [--renders <dir of <itemId>.png>] [--output <review-list.json>] [--json]";
|
|
28
|
+
"Usage: lumine admin arena queue | paper-queue [--cursor <id>] [--limit <1-100>] | marking [--cursor <id>] [--limit <1-200>] | import (--dir <paper folder> | --additive --file <reviewed-items.json>) [--audio audio/<exam>/<paper>] [--live] [--confirm] | status --item <id> --to live|retired|checked [--confirm] | revise --file <revisions.json> [--confirm] | today-queue [--cursor <id>] [--limit <1-100>] | today-member --user <id> | today-import --file <reviewed-questions.json> [--confirm] | today-withdraw --user <id> (--keys <key,...> | --file <withdraw.json>) --reason <text> [--confirm] | picture-audit [--items <id,id,...> | --cursor <id>] [--limit <1-20>] [--renders <dir of <itemId>.png>] [--output <review-list.json>] [--json]";
|
|
26
29
|
const MAX_ITEMS = 300;
|
|
27
30
|
|
|
28
31
|
function validationError(message) {
|
|
@@ -256,6 +259,32 @@ export function buildArenaOperation({ action, options }) {
|
|
|
256
259
|
timeoutMs: 120000,
|
|
257
260
|
};
|
|
258
261
|
}
|
|
262
|
+
if (action === "revise") {
|
|
263
|
+
if (!options.adminFile) throw validationError("Use revise --file <revisions.json> [--confirm].");
|
|
264
|
+
const file = path.resolve(options.adminFile);
|
|
265
|
+
let parsed;
|
|
266
|
+
try {
|
|
267
|
+
if (fs.statSync(file).size > 5_000_000) throw validationError("The revision file must be under 5 MB.");
|
|
268
|
+
parsed = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
269
|
+
} catch (error) {
|
|
270
|
+
if (error.code === "CLI_ADMIN_CLI_VALIDATION") throw error;
|
|
271
|
+
throw validationError(`Cannot read the revision file ${file}: ${error.message}`);
|
|
272
|
+
}
|
|
273
|
+
const items = Array.isArray(parsed) ? parsed : parsed?.items;
|
|
274
|
+
if (!Array.isArray(items) || !items.length || items.length > MAX_ITEMS) {
|
|
275
|
+
throw validationError(`A revision file holds 1 to ${MAX_ITEMS} revisions: an array, or {reason, items:[...]}.`);
|
|
276
|
+
}
|
|
277
|
+
const confirm = confirmed(options);
|
|
278
|
+
return {
|
|
279
|
+
name: confirm ? "arena.revise" : "arena.revise.preview",
|
|
280
|
+
method: "POST",
|
|
281
|
+
path: "/cli/admin/arena/items/revise",
|
|
282
|
+
body: { items, ...(typeof parsed?.reason === "string" ? { reason: parsed.reason } : {}), dryRun: !confirm },
|
|
283
|
+
mutates: confirm,
|
|
284
|
+
requiresRun: false,
|
|
285
|
+
timeoutMs: 120000,
|
|
286
|
+
};
|
|
287
|
+
}
|
|
259
288
|
if (action === "status") {
|
|
260
289
|
const id = Number(options.adminArenaItem);
|
|
261
290
|
const to = String(options.adminArenaTo || "");
|
|
@@ -337,6 +366,16 @@ export function formatArenaResult({ operation, data }) {
|
|
|
337
366
|
due.length ? `${due.length} type(s) due for a refill.` : "No standalone practice refill due; check paper-queue for waiting exams.",
|
|
338
367
|
];
|
|
339
368
|
}
|
|
369
|
+
if (operation.name === "arena.revise.preview" || operation.name === "arena.revise") {
|
|
370
|
+
const revised = data?.revised || [];
|
|
371
|
+
const unchanged = data?.unchanged || [];
|
|
372
|
+
return [
|
|
373
|
+
`${data?.dryRun ? "Dry run: would revise" : "Revised"} ${revised.length} item(s)${unchanged.length ? `; ${unchanged.length} already as written` : ""}.`,
|
|
374
|
+
...revised.map((r) => `Item ${r.itemId}${r.paper ? ` (${r.paper} #${r.number})` : r.number ? ` (#${r.number})` : ""}: v${r.fromVersion} -> v${r.toVersion}, ${r.changed.join(", ")}${r.fromPassageVersion !== r.toPassageVersion ? `; passage ${r.passageId} v${r.fromPassageVersion} -> v${r.toPassageVersion}` : ""}`),
|
|
375
|
+
...unchanged.map((r) => `Item ${r.itemId}: ${r.status === "already_applied" ? "already revised" : "no change"} (v${r.version})`),
|
|
376
|
+
...(data?.dryRun && revised.length ? ["Add --confirm to publish these versions."] : []),
|
|
377
|
+
];
|
|
378
|
+
}
|
|
340
379
|
if (operation.name === "arena.import.preview") {
|
|
341
380
|
return [`Dry run: ${data?.wouldImport ?? 0} item(s) pass validation. Add --confirm to import.`];
|
|
342
381
|
}
|
package/lib/commands.js
CHANGED
|
@@ -3351,7 +3351,7 @@ export function printHelp() {
|
|
|
3351
3351
|
lumine admin cardcraft-review list [--status pending|approved|all] [--cursor <id>] | show <id> | approve|reject|revoke <id> [--reason <text>]
|
|
3352
3352
|
lumine admin craft seed --build <id> --file <pairs.json> [--confirm] | stats --build <id> [--limit <1-100>] | revise --build <id> --item <id|name> [--why <text>] [--emoji <emoji>] [--category <field>] [--confirm] | revise --build <id> --pair <pairId|a+b> --why <text> [--confirm] | retire --build <id> --item <id|name> --reason <text> [--confirm] | unfizzle --build <id> [--since <iso>] [--pair <a+b>] [--confirm] (Twinkle.craft curation: dry run without --confirm)
|
|
3353
3353
|
lumine admin sliding-block status | add --file <levels.json> [--confirm] (sliding-block-v1 campaign refills, RushHour: dry run without --confirm; the server solves each board and appends it)
|
|
3354
|
-
lumine admin arena queue | paper-queue [--cursor <id>] [--limit <1-100>] | import --dir <paper folder> [--audio audio/<exam>/<paper>] [--live] [--confirm] | status --item <id> --to live|retired|checked --confirm | picture-audit [--items <id,id,...> | --cursor <id>] [--limit 1-20] [--renders <dir of <itemId>.png>] [--output <review-list.json>] (Arena's mock-exam bank; picture-audit is an advisory JEV image review list that never retires or edits items; import
|
|
3354
|
+
lumine admin arena queue | paper-queue [--cursor <id>] [--limit <1-100>] | import --dir <paper folder> [--audio audio/<exam>/<paper>] [--live] [--confirm] | status --item <id> --to live|retired|checked --confirm | revise --file <revisions.json> [--confirm] | picture-audit [--items <id,id,...> | --cursor <id>] [--limit 1-20] [--renders <dir of <itemId>.png>] [--output <review-list.json>] (Arena's mock-exam bank; picture-audit is an advisory JEV image review list that never retires or edits items; import and revise are validation-only dry runs without --confirm; revise fixes a live item in place as a new content version; upload audio first with twinkle-api scripts/arena-upload-media.ts)
|
|
3355
3355
|
lumine admin arena today-queue [--cursor <id>] | today-member --user <id> | today-import --file <reviewed-questions.json> [--confirm] | today-withdraw --user <id> (--keys <key,...> | --file <withdraw.json>) --reason <text> [--confirm] (Today's Challenge personal queues; import and withdraw are dry runs without --confirm; withdraw removes only unserved queued questions and is audited)
|
|
3356
3356
|
lumine admin nonogram status | add --file <pictures.json> | retire <key> | restore <key> [--confirm] (private reviewed pictures; changes are dry runs without --confirm)
|
|
3357
3357
|
lumine admin build-plans stuck [--days <1-90>] [--all] | recheck <buildId> [<buildId> ...] [--confirm] (Lumine Build plans stuck on one milestone: runs, Energy vs estimate, gradings, loop-guard state; recheck re-grades the current milestone with today's evaluator, free for the creator, dry run without --confirm)
|
package/package.json
CHANGED
package/sdk/LUMINE_ADMIN.md
CHANGED
|
@@ -5695,6 +5695,71 @@ Bridge Builder qualifies from QR check-ins: 7 different people, or one meetup a
|
|
|
5695
5695
|
Every decision requires Mikey's authorization for that crew and action. Mutations are audited and idempotent; `--output <path>` is an explicit request to retain the canonical JSON. General write receipts omit private crew details.
|
|
5696
5696
|
|
|
5697
5697
|
|
|
5698
|
+
## Arena timed-bank item revisions
|
|
5699
|
+
|
|
5700
|
+
Reviewed text, option and visual fixes to a published paper go live in place, without
|
|
5701
|
+
re-importing the paper:
|
|
5702
|
+
|
|
5703
|
+
```
|
|
5704
|
+
lumine admin arena revise --file <revisions.json> --json
|
|
5705
|
+
lumine admin arena revise --file <revisions.json> --confirm --json
|
|
5706
|
+
```
|
|
5707
|
+
|
|
5708
|
+
The file is `{ "reason": "...", "items": [ { "itemId": <live id>,
|
|
5709
|
+
"expectedVersion": <version you read>, "paper": "<edition>", "number": <n>,
|
|
5710
|
+
"content": { "stem", "body", "choices", "answer", "accepted",
|
|
5711
|
+
"transformation", "review", "visual", "passage" (any subset) }, "reason": "...", "review":
|
|
5712
|
+
"<options-only check + blind solve evidence>" } ] }` (or a bare array). `paper`
|
|
5713
|
+
and `number` are optional guards; a per-item `reason` overrides the file's.
|
|
5714
|
+
Without `--confirm` it is a dry run.
|
|
5715
|
+
|
|
5716
|
+
- The item keeps its id, so exposures, question identity, paper completeness
|
|
5717
|
+
and passed/solo exclusions are unchanged. The old content is archived as its
|
|
5718
|
+
version and the item gets the next version. Finished papers, open sittings,
|
|
5719
|
+
marking, review cards and drills keep the version they froze. A cover or
|
|
5720
|
+
challenge prepared before the revision starts on the new version.
|
|
5721
|
+
- Stem, body, choices, key (`answer`, `accepted`, `transformation`), review,
|
|
5722
|
+
visual and an existing unrecorded text passage can change. Set membership,
|
|
5723
|
+
type, number, mode, rubric and recordings stay fixed. Changing choices, key,
|
|
5724
|
+
passage or visual requires the full rewritten `content.review`. Its explanation
|
|
5725
|
+
is non-empty text; optional `why` notes are an array of strings, one per choice.
|
|
5726
|
+
Option reasoning may instead be included in the full explanation. The same
|
|
5727
|
+
field types apply to a supplied Korean translation.
|
|
5728
|
+
- To change a passage, send `content.passage` and top-level
|
|
5729
|
+
`expectedPassageVersion` for **every live/checked item sharing that passage**,
|
|
5730
|
+
each with its own expected item version and review evidence. All siblings must
|
|
5731
|
+
carry the identical new text. The entire set is validated, and the old passage
|
|
5732
|
+
and item versions are archived in the same transaction. Old sittings and drills
|
|
5733
|
+
keep their original text; new starts use the revised item and passage together.
|
|
5734
|
+
A passage also used by a retired/draft item is refused, because its unchanged
|
|
5735
|
+
version must retain its old text.
|
|
5736
|
+
Use `visual: null` to remove a visual; supplied diagrams/charts must validate.
|
|
5737
|
+
- The result is checked with the import validators together with the rest of
|
|
5738
|
+
its set (choice count, key index, `why` lines, evidence spans). A version
|
|
5739
|
+
other than `expectedVersion`, a retired item, an essay/spoken task or any
|
|
5740
|
+
invalid result refuses the whole file; nothing is written.
|
|
5741
|
+
- Confirmed runs are audited (`arena.items.revise`: operator, time, item ids,
|
|
5742
|
+
reasons). Each item records the revision (versions, reason, evidence,
|
|
5743
|
+
audit id) in its authoring. A retried request replays its receipt;
|
|
5744
|
+
re-running an applied file reports `already applied` and writes nothing.
|
|
5745
|
+
- The new version starts its own calibration from the item's level, as on
|
|
5746
|
+
import; the old version's calibration stays on record.
|
|
5747
|
+
|
|
5748
|
+
### Ordered timed-review explanations
|
|
5749
|
+
|
|
5750
|
+
Authored timed items may include `review.steps`: 1–8 ordered `{text, scene?}`
|
|
5751
|
+
pairs. `text` is 1–1600 characters; the whole sequence is bounded to 40,000
|
|
5752
|
+
characters. Keep `review.explanation` as the full readable fallback. The review
|
|
5753
|
+
screen and Zero/Ciel use these exact step numbers. A translated `review.ko`
|
|
5754
|
+
must provide the same number of aligned steps when explicit steps are used.
|
|
5755
|
+
|
|
5756
|
+
Scenes use the existing `cards`, `bars` or `passage` contract (caption up to
|
|
5757
|
+
300 characters; 1–12 parts with text up to 1600 characters; bars need a finite
|
|
5758
|
+
value from 0 to 1,000,000), or the validated `diagram` contract with a required
|
|
5759
|
+
accessible `alt` (up to 200 characters). No executable markup or figure-plan
|
|
5760
|
+
placeholders. Render and review the actual scenes at phone size before import.
|
|
5761
|
+
Older text-only items retain the sentence-based step behavior.
|
|
5762
|
+
|
|
5698
5763
|
## Arena Today's Challenge personal queues
|
|
5699
5764
|
|
|
5700
5765
|
Each member who chose Today's Challenge preferences is served the oldest
|