@letterstory/cli 0.177.122 → 0.177.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/lib/cli.mjs +2 -1
- package/lib/commands/admin.mjs +30 -2
- package/lib/commands/collection.mjs +17 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -204,6 +204,7 @@ letterstory collection run-status <run-id> # status, steps,
|
|
|
204
204
|
letterstory collection runs --collection <id> --status ready
|
|
205
205
|
letterstory collection approve <run-id> --now
|
|
206
206
|
letterstory collection cancel <run-id>
|
|
207
|
+
letterstory collection rewrite <run-id> # a held post, rewritten to the finding
|
|
207
208
|
letterstory collection inventory <id> # every piece; each finished draft's publish-on-its-own time
|
|
208
209
|
letterstory collection links <id> # internal-link refresh: on/off, posts due
|
|
209
210
|
letterstory collection links <id> --refresh # run the next batch now
|
package/lib/cli.mjs
CHANGED
|
@@ -93,7 +93,7 @@ import {
|
|
|
93
93
|
import { fetchParkedSections, withoutParked } from "./parked.mjs";
|
|
94
94
|
|
|
95
95
|
// Matches cli/package.json; publish-cli.yml rewrites both to the published version.
|
|
96
|
-
export const VERSION = "0.177.
|
|
96
|
+
export const VERSION = "0.177.123";
|
|
97
97
|
|
|
98
98
|
/** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
|
|
99
99
|
export const EXIT_PAYMENT_REQUIRED = 3;
|
|
@@ -661,6 +661,7 @@ Collections (the content engine as a primitive — one door, 'collection run'):
|
|
|
661
661
|
collection runs [--collection <id>] [--status <s>] [--limit <n>]
|
|
662
662
|
collection approve <run-id> [--now] Answer the gate (--now publishes immediately)
|
|
663
663
|
collection start <run-id> Start a scheduled slot's writing now (it goes live at its slot)
|
|
664
|
+
collection rewrite <run-id> Rewrite a held post to its finding (skip_code held_guard in collection runs)
|
|
664
665
|
collection move <run-id> --date YYYY-MM-DD Move a slot not yet written, or an approved written post, to another day
|
|
665
666
|
collection cancel <run-id>
|
|
666
667
|
collection inventory <id> Where every piece is; each finished draft's publish-on-its-own time
|
package/lib/commands/admin.mjs
CHANGED
|
@@ -5362,7 +5362,7 @@ const BUILD_FAILURES = "/api/superadmin/build-failures";
|
|
|
5362
5362
|
const SUGGESTION_REVIEW = "/api/superadmin/suggestion-review";
|
|
5363
5363
|
const TURN_ENDINGS = "/api/superadmin/turn-endings";
|
|
5364
5364
|
const ENGINE_USAGE =
|
|
5365
|
-
"Usage: admin letterpress status | gaps | friction [--kind error|exception|rage|step|rule|server|stall|background] [--surface s] [--org id] [--limit N] [--customers] | issues [--days N] [--state came_back|open|fixing|resolved] [--source ask|friction] [--surface s] [--whose ours|agent|setup] [--limit N] | issues fix|unfix <key> [--pr url] [--note …] | tools [--days N] [--org id] [--customers] | checks | frustration [--days N] | health | asks [--days N] [--surface cmd_l|build_chat|slack|terminal|app|signup|letter] [--people | --letter] [--door d] [--family premise|landing|preview|outcome|run|infra|writing|waiting|other] [--whose ours|agent|setup|member] [--pattern <code or key>] [--org id] [--limit N] [--customers] | telemetry [--days N] [--harness h] [--customers] | tokens [--days N] [--so-far] [--all-orgs] | prs [--days N | --from YYYY-MM-DD [--to YYYY-MM-DD] | --all-time] [--day YYYY-MM-DD] [--org id] [--state merged|open|closed] [--people | --letter] [--top N] [--tz zone] [--all-orgs] | failures [--days N | --from YYYY-MM-DD [--to YYYY-MM-DD] | --all-time] [--day YYYY-MM-DD] [--org id] [--failure ours|agent|setup|undelivered] [--cause c] [--stopped-at step] [--repo owner/name] [--slow] [--tz zone] [--customers] | blocked [--days N] [--org id] [--customers] | endings [--days N | --since ISO] [--org id,id] [--no-model] [--top N] [--write-cases [--dir evals/letterpress]] | unblock <org-id> <host> <subject> | decisions <org-id> [--site host] [--surface plan|fix|build|site] | undo <org-id> <host> <decision-id> | runs [--status s] [--error-code c] [--first-review-cause agent|context|setup|unknown] [--pr merged|closed|open|none] [--harness h] [--days N] [--customers] | beyond [--limit N] [--before ISO] | companies | company <org-id> [--site host] | ideas <org-id> [--site host] [--repo connected|none] | suggestions fix|idea [--day YYYY-MM-DD] [--type key [--org id]] [--customers] | suggestions flag fix|idea <type-key> [--org id --item item-id] [--note …] | suggestions clear <flag-id> | facts <org-id> [--site host] | fits [--recipe id] [--org id] [--site host] [--fits yes|no|unknown|waiting] [--limit N] | replay <run-id> | mark <run-id> <item-id> <right|weak|wrong|lead|gap|recipe|clear> [--note …] | settings | set <weights.<ask>.<reading>|lenses.<lens>.bar.<reading>|lenses.<lens>.bar|lenses.<lens>.research.turns|lenses.<lens>.research.ms|asks.<lens>.ask|asks.<lens>.guidance|dismissals.block_days|preflight.off|explore.ask|explore.research.turns|explore.research.ms|explore.every_days> <value>";
|
|
5365
|
+
"Usage: admin letterpress status | gaps | friction [--kind error|exception|rage|step|rule|server|stall|background] [--surface s] [--org id] [--limit N] [--customers] | issues [--days N] [--state came_back|open|fixing|resolved] [--source ask|friction] [--surface s] [--whose ours|agent|setup] [--limit N] | issues fix|unfix <key> [--pr url] [--note …] | tools [--days N] [--org id] [--customers] | checks | frustration [--days N] | health | asks [--days N] [--surface cmd_l|build_chat|slack|terminal|app|signup|letter] [--people | --letter] [--door d] [--family premise|landing|preview|outcome|run|infra|writing|waiting|other] [--whose ours|agent|setup|member] [--pattern <code or key>] [--org id] [--limit N] [--customers] | telemetry [--days N] [--harness h] [--customers] | tokens [--days N] [--so-far] [--all-orgs] | prs [--days N | --from YYYY-MM-DD [--to YYYY-MM-DD] | --all-time] [--day YYYY-MM-DD] [--org id] [--state merged|open|closed] [--people | --letter] [--top N] [--tz zone] [--all-orgs] | failures [--days N | --from YYYY-MM-DD [--to YYYY-MM-DD] | --all-time] [--day YYYY-MM-DD] [--org id] [--failure ours|agent|setup|undelivered] [--cause c] [--stopped-at step] [--repo owner/name] [--slow] [--tz zone] [--customers] | blocked [--days N] [--org id] [--customers] | endings [--days N | --since ISO] [--org id,id] [--no-model] [--top N] [--write-cases [--dir evals/letterpress]] | unblock <org-id> <host> <subject> | decisions <org-id> [--site host] [--surface plan|fix|build|site] | undo <org-id> <host> <decision-id> | runs [--status s] [--error-code c] [--first-review-cause agent|context|setup|unknown] [--no-change-code code] [--failure-kind network|provider|tool_denied|agent|unrecorded] [--pr merged|closed|open|none] [--harness h] [--days N] [--customers] | beyond [--limit N] [--before ISO] | companies | company <org-id> [--site host] | ideas <org-id> [--site host] [--repo connected|none] | suggestions fix|idea [--day YYYY-MM-DD] [--type key [--org id]] [--customers] | suggestions flag fix|idea <type-key> [--org id --item item-id] [--note …] | suggestions clear <flag-id> | facts <org-id> [--site host] | fits [--recipe id] [--org id] [--site host] [--fits yes|no|unknown|waiting] [--limit N] | replay <run-id> | mark <run-id> <item-id> <right|weak|wrong|lead|gap|recipe|clear> [--note …] | settings | set <weights.<ask>.<reading>|lenses.<lens>.bar.<reading>|lenses.<lens>.bar|lenses.<lens>.research.turns|lenses.<lens>.research.ms|asks.<lens>.ask|asks.<lens>.guidance|dismissals.block_days|preflight.off|explore.ask|explore.research.turns|explore.research.ms|explore.every_days> <value>";
|
|
5366
5366
|
|
|
5367
5367
|
/** One number of the settings from a dotted path and a value: the PUT body save_engine_settings reads. */
|
|
5368
5368
|
function engineSettingsPatch(path, value) {
|
|
@@ -5581,7 +5581,7 @@ async function cmdAdminLetterpress(ctx) {
|
|
|
5581
5581
|
`Tools that failed, last ${t.days} days (${t.turns} turns)`,
|
|
5582
5582
|
...t.rows.map(
|
|
5583
5583
|
(x) =>
|
|
5584
|
-
`${String(x.failed).padStart(4)} of ${String(x.calls).padEnd(5)} ${x.tool.padEnd(32)} ${x.orgs} orgs ${x.top_reason ?? ""}`
|
|
5584
|
+
`${String(x.failed).padStart(4)} of ${String(x.calls).padEnd(5)} ${x.tool.padEnd(32)} ${x.orgs} orgs ${x.invalid ? `${x.invalid} bad arguments${x.top_field ? ` (${x.top_field.field}, ${x.top_field.code})` : ""}, ` : ""}${x.refused} refused ${x.top_reason ?? ""}`
|
|
5585
5585
|
),
|
|
5586
5586
|
].join("\n")
|
|
5587
5587
|
);
|
|
@@ -5718,9 +5718,35 @@ async function cmdAdminLetterpress(ctx) {
|
|
|
5718
5718
|
.map(
|
|
5719
5719
|
(g) => ` missed (${g.cause}, ${g.category}): ${g.runs} runs. ${g.notes[0] ?? g.what_to_do}`
|
|
5720
5720
|
),
|
|
5721
|
+
`first review's blocking issues: ${t.first_pass.issues.caught_fixed} caught and fixed, ${t.first_pass.issues.open_at_end} still open at the end${t.first_pass.issues.unread ? `, ${t.first_pass.issues.unread} not read` : ""}`,
|
|
5721
5722
|
t.failures.length
|
|
5722
5723
|
? `failures: ${t.failures.map((f) => `${f.error_code} ${f.count} (was ${f.previous}, ${f.fault})`).join(", ")}`
|
|
5723
5724
|
: "no failures",
|
|
5725
|
+
t.no_change.length
|
|
5726
|
+
? `changed nothing: ${t.no_change
|
|
5727
|
+
.slice(0, 8)
|
|
5728
|
+
.map((n) => `${n.source_kind} ${n.code} ${n.runs}`)
|
|
5729
|
+
.join(", ")}`
|
|
5730
|
+
: "no run changed nothing",
|
|
5731
|
+
`agent stops: ${
|
|
5732
|
+
Object.entries(t.ground.failure_kinds)
|
|
5733
|
+
.map(([k, n]) => `${k} ${n}`)
|
|
5734
|
+
.join(", ") || "none"
|
|
5735
|
+
}; checkouts: ${
|
|
5736
|
+
Object.entries(t.ground.checkout)
|
|
5737
|
+
.map(([k, n]) => `${k} ${n}`)
|
|
5738
|
+
.join(", ") || "none"
|
|
5739
|
+
}; failed previews: ${
|
|
5740
|
+
Object.entries(t.ground.preview_causes)
|
|
5741
|
+
.map(([k, n]) => `${k} ${n}`)
|
|
5742
|
+
.join(", ") || "none"
|
|
5743
|
+
}`,
|
|
5744
|
+
t.starts_refused.length
|
|
5745
|
+
? `starts refused: ${t.starts_refused
|
|
5746
|
+
.slice(0, 8)
|
|
5747
|
+
.map((x) => `${x.door}/${x.reason} ${x.count}`)
|
|
5748
|
+
.join(", ")}`
|
|
5749
|
+
: "no start refused",
|
|
5724
5750
|
`lost to timeouts/memory/crashes: ${pct(t.resilience)}${t.resilience.over_bar ? " OVER 3%" : ""}`,
|
|
5725
5751
|
].join("\n")
|
|
5726
5752
|
);
|
|
@@ -5984,6 +6010,8 @@ async function cmdAdminLetterpress(ctx) {
|
|
|
5984
6010
|
["status", "status"],
|
|
5985
6011
|
["error-code", "error_code"],
|
|
5986
6012
|
["first-review-cause", "first_review_cause"],
|
|
6013
|
+
["no-change-code", "no_change_code"],
|
|
6014
|
+
["failure-kind", "failure_kind"],
|
|
5987
6015
|
["harness", "harness"],
|
|
5988
6016
|
["pr", "pr"],
|
|
5989
6017
|
])
|
|
@@ -138,6 +138,9 @@ export const ARGS = {
|
|
|
138
138
|
start_collection_run: {
|
|
139
139
|
run_id: { positional: 0, label: "run-id", required: true },
|
|
140
140
|
},
|
|
141
|
+
release_held_post: {
|
|
142
|
+
run_id: { positional: 0, label: "run-id", required: true },
|
|
143
|
+
},
|
|
141
144
|
reschedule_collection_run: {
|
|
142
145
|
run_id: { positional: 0, label: "run-id", required: true },
|
|
143
146
|
date: { flag: "date", required: true },
|
|
@@ -190,6 +193,8 @@ export async function cmdCollection(ctx) {
|
|
|
190
193
|
return collectionCancel(rest);
|
|
191
194
|
case "start":
|
|
192
195
|
return collectionStart(rest);
|
|
196
|
+
case "rewrite":
|
|
197
|
+
return collectionRewrite(rest);
|
|
193
198
|
case "move":
|
|
194
199
|
case "reschedule":
|
|
195
200
|
return collectionMove(rest);
|
|
@@ -413,6 +418,18 @@ async function collectionStart(ctx) {
|
|
|
413
418
|
return 0;
|
|
414
419
|
}
|
|
415
420
|
|
|
421
|
+
// `collection rewrite <run-id>` — a written post a publish guard holds (skip_code held_guard in `collection runs`) is
|
|
422
|
+
// rewritten to its finding (release_held_post).
|
|
423
|
+
async function collectionRewrite(ctx) {
|
|
424
|
+
const result = await ctx.client.callTool(
|
|
425
|
+
"release_held_post",
|
|
426
|
+
argsFromFlags(ARGS.release_held_post, ctx.flags, ctx.positionals)
|
|
427
|
+
);
|
|
428
|
+
ok(ctx, "Rewriting it to the finding: it publishes again once it fits.");
|
|
429
|
+
printResult(ctx.io, ctx.flags, result);
|
|
430
|
+
return 0;
|
|
431
|
+
}
|
|
432
|
+
|
|
416
433
|
// `collection move <run-id> --date YYYY-MM-DD` — a slot not yet written, or a written post
|
|
417
434
|
// already approved, onto another day (reschedule_collection_run).
|
|
418
435
|
async function collectionMove(ctx) {
|