@letterstory/cli 0.177.54 → 0.177.55

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/cli.mjs CHANGED
@@ -90,7 +90,7 @@ import {
90
90
  import { fetchParkedSections, withoutParked } from "./parked.mjs";
91
91
 
92
92
  // Matches cli/package.json; publish-cli.yml rewrites both to the published version.
93
- export const VERSION = "0.177.54";
93
+ export const VERSION = "0.177.55";
94
94
 
95
95
  /** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
96
96
  export const EXIT_PAYMENT_REQUIRED = 3;
@@ -2139,7 +2139,9 @@ Models (your own writing models, each trained on writing you give it so it write
2139
2139
  models confirm <id> [<link-id>…] [--keep-rest] [--no-train]
2140
2140
  Confirm what was found (all, or the ids) and train on it
2141
2141
  models remove <id> <link-id>… Take links out of the next version
2142
- models train <id> [--retry] Train the next version, or try a stopped one again
2142
+ models train <id> [--retry] [--recipe <id>] Train the next version, or try a stopped one again
2143
+ models test <id> [--version <n>] [--units <n>] Test a version on held-out writing against Claude with examples
2144
+ models activate <id> <version> Make a ready version live (a first version is live when it trains)
2143
2145
  models stop <id> Stop what is training; what it spent is charged
2144
2146
  models rewrite <id> "<source text>" Rewrite supplied prose in its trained voice
2145
2147
  models compare <id> "<source text>" Compare your model, Astra and Claude + Skill
@@ -14,7 +14,9 @@
14
14
  // letterstory models find <id> "<the writing to find>" [--max <n>]
15
15
  // letterstory models confirm <id> [<link-id>…] [--keep-rest] [--no-train] no link ids: all of them
16
16
  // letterstory models remove <id> <link-id>…
17
- // letterstory models train <id> [--retry]
17
+ // letterstory models train <id> [--retry] [--recipe rewrite_v1|content_brief_v2]
18
+ // letterstory models activate <id> <version> make a ready version live
19
+ // letterstory models test <id> [--version <n>] [--units <8-24>] test a version on held-out writing
18
20
  // letterstory models stop <id> stop what is training
19
21
  // letterstory models write <id> "<what to write>" [--words <n>]
20
22
  // letterstory models update <id> [--name <n>] [--budget <usd>] [--description <d>] [--base <base-id>]
@@ -102,20 +104,32 @@ export const ARGS = {
102
104
  train: { flag: "no-train", type: "bool", invert: true },
103
105
  },
104
106
  remove_writing_model_links: { model_id: modelId, source_ids: { value: rest(1) } },
105
- train_writing_model: { model_id: modelId, retry: { flag: "retry", type: "bool" } },
107
+ train_writing_model: { model_id: modelId, retry: { flag: "retry", type: "bool" }, recipe: "recipe" },
108
+ activate_writing_model_version: {
109
+ model_id: modelId,
110
+ version: { value: (flags, positionals) => (positionals[1] ? Number(positionals[1]) : undefined) },
111
+ },
112
+ evaluate_writing_model_version: {
113
+ model_id: modelId,
114
+ version: { flag: "version", type: "num" },
115
+ units: { flag: "units", type: "num" },
116
+ },
106
117
  cancel_writing_model_run: { model_id: modelId },
107
118
  rewrite_with_writing_model: {
108
119
  model_id: modelId,
109
120
  text: { value: (flags, positionals) => positionals.slice(1).join(" ").trim() || undefined },
121
+ version: { flag: "version", type: "num" },
110
122
  },
111
123
  compare_writing_model: {
112
124
  model_id: modelId,
113
125
  text: { value: (flags, positionals) => positionals.slice(1).join(" ").trim() || undefined },
126
+ version: { flag: "version", type: "num" },
114
127
  },
115
128
  write_with_writing_model: {
116
129
  model_id: modelId,
117
130
  ask: { value: (flags, positionals) => positionals.slice(1).join(" ").trim() || undefined },
118
131
  max_words: { flag: "words", type: "num" },
132
+ version: { flag: "version", type: "num" },
119
133
  },
120
134
  };
121
135
 
@@ -283,6 +297,18 @@ export async function cmdModels(ctx) {
283
297
  printResult(next.io, next.flags, result, (r) => runLine(r.run));
284
298
  return 0;
285
299
  }
300
+ case "activate": {
301
+ refuseUnknownFlags(next, ARGS.activate_writing_model_version, []);
302
+ const args = argsFromFlags(ARGS.activate_writing_model_version, next.flags, next.positionals);
303
+ if (!Number.isInteger(args.version)) throw new CliError("Give the version: models activate <id> <version>");
304
+ return modelShow(next, await next.client.callTool("activate_writing_model_version", args));
305
+ }
306
+ case "test": {
307
+ refuseUnknownFlags(next, ARGS.evaluate_writing_model_version, []);
308
+ const result = await call(next, "evaluate_writing_model_version");
309
+ printResult(next.io, next.flags, result, (r) => evaluationLines(r.evaluation).join("\n"));
310
+ return 0;
311
+ }
286
312
  case "stop": {
287
313
  refuseUnknownFlags(next, ARGS.cancel_writing_model_run, []);
288
314
  const result = await call(next, "cancel_writing_model_run");
@@ -325,11 +351,24 @@ export async function cmdModels(ctx) {
325
351
  return modelShow(next, await call(next, "update_writing_model", { archived: sub === "archive" }));
326
352
  default:
327
353
  throw new CliError(
328
- "Usage: models [list|create|show|add|find|confirm|remove|train|stop|rewrite|compare|write|update|archive|restore]"
354
+ "Usage: models [list|create|show|add|find|confirm|remove|train|test|activate|stop|rewrite|compare|write|update|archive|restore]"
329
355
  );
330
356
  }
331
357
  }
332
358
 
359
+ const pct = (x) => (x === null || x === undefined ? "n/a" : `${Math.round(x * 100)}%`);
360
+
361
+ function evaluationLines(e) {
362
+ if (e.status === "too_few") return [`Version ${e.version}: only ${e.units} held-out passages, too few to read.`];
363
+ return [
364
+ `Version ${e.version} (${e.recipe}) on ${e.units} held-out passages${e.failed ? `, ${e.failed} left out` : ""}:`,
365
+ ` picked as the real writing: version ${pct(e.adapterVsOriginal)}, Claude with examples ${pct(e.baselineVsOriginal)} (50% is indistinguishable)`,
366
+ ` version against Claude with examples: ${pct(e.adapterVsBaseline)} chose the version`,
367
+ ` real against real (judge check): ${pct(e.nullTest)}`,
368
+ ` facts kept: version ${pct(e.factsKept.adapter)}, Claude ${pct(e.factsKept.baseline)}`,
369
+ ];
370
+ }
371
+
333
372
  function runLine(run) {
334
373
  if (!run) return "Not trained yet.";
335
374
  const where = run.blockedOn ? `stopped: ${run.blockedOn}` : (run.stageNote ?? run.stage);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.177.54",
3
+ "version": "0.177.55",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",