@letterstory/cli 0.177.200 → 0.177.202

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
@@ -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.200";
96
+ export const VERSION = "0.177.202";
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;
@@ -545,6 +545,8 @@ export const BOOLEAN_FLAGS = new Set([
545
545
  "named",
546
546
  // visits transact site --check-link: read the site for its link to the Agent Site now.
547
547
  "check-link",
548
+ // visits transact site --tree: add the screen's question tree.
549
+ "tree",
548
550
  ]);
549
551
 
550
552
  // Tiny argv parser: `--flag value`, `--flag=value`, boolean `--flag`, and positionals.
@@ -79,6 +79,9 @@ export const ARGS = {
79
79
  org_id: { flag: "org" },
80
80
  limit: { flag: "limit", type: "num" },
81
81
  },
82
+ get_ask: {
83
+ id: { positional: 1, label: "id", required: true },
84
+ },
82
85
  get_crossing_dropoff: {
83
86
  crossing: { positional: 0, label: "crossing" },
84
87
  days: { flag: "days", type: "num" },
@@ -5393,7 +5396,7 @@ const BUILD_FAILURES = "/api/superadmin/build-failures";
5393
5396
  const SUGGESTION_REVIEW = "/api/superadmin/suggestion-review";
5394
5397
  const TURN_ENDINGS = "/api/superadmin/turn-endings";
5395
5398
  const ENGINE_USAGE =
5396
- "Usage: admin letterpress status | gaps | friction [--kind error|exception|rage|step|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>";
5399
+ "Usage: admin letterpress status | gaps | friction [--kind error|exception|rage|step|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 | ask <id> | asks [--days N] [--q words] [--outcome delivered|not_delivered|stuck|in_flight|waiting_on_member|cancelled|replied] [--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>";
5397
5400
 
5398
5401
  /** One number of the settings from a dotted path and a value: the PUT body save_engine_settings reads. */
5399
5402
  function engineSettingsPatch(path, value) {
@@ -5664,6 +5667,38 @@ async function cmdAdminLetterpress(ctx) {
5664
5667
  );
5665
5668
  return 0;
5666
5669
  }
5670
+ case "ask": {
5671
+ // get_ask: one request, whole (docs/architecture/failure-visibility.md "One request").
5672
+ if (!positionals[1]) throw new CliError("Usage: admin letterpress ask <id>");
5673
+ const r = await ctx.client.callTool("get_ask", argsFromFlags(ARGS.get_ask, flags, positionals));
5674
+ const when = (x) => (x ? String(x).slice(0, 16) : "—");
5675
+ printResult(io, flags, r, (a) =>
5676
+ [
5677
+ `${a.surface_label} · ${a.org ?? a.org_id} · ${when(a.at)} · ${a.outcome ?? "not listed"}`,
5678
+ "",
5679
+ a.words ?? `${a.ask?.title ?? "Untitled"} (no words typed)`,
5680
+ "",
5681
+ a.ask?.why ? `Why: ${a.ask.why}${a.ask.reason ? ` (${a.ask.reason})` : ""}` : "",
5682
+ a.ask?.pr_url ? `PR: ${a.ask.pr_url}${a.ask.landed ? ` (${a.ask.landed})` : ""}` : "",
5683
+ a.reply ? `Letterpress: ${a.reply}` : "",
5684
+ a.turn
5685
+ ? `Turn: ${a.turn.action ?? "—"} via ${a.turn.route ?? "—"}${a.turn.stopped_by ? `, stopped by ${a.turn.stopped_by}` : ""}; tools ${a.turn.tools.map((t) => (t.ok ? t.name : `${t.name}(failed)`)).join(", ") || "none"}`
5686
+ : "",
5687
+ ...(a.conversation?.messages ?? []).map(
5688
+ (m) =>
5689
+ ` ${m.role === "member" ? "Them" : "Letterpress"}: ${m.body.split("\n")[0].slice(0, 160)}${m.question ? ` ? ${m.question}` : ""}`
5690
+ ),
5691
+ ...a.steps.map((s) => `Step ${s.status.padEnd(9)} ${s.title}${s.error ? `: ${s.error}` : ""}`),
5692
+ ...a.runs.flatMap((x) => [
5693
+ `Run ${x.id} ${x.status}${x.phase ? ` at ${x.phase}` : ""}${x.error_code ? ` ${x.error_code}: ${x.error_detail ?? ""}` : ""}${x.cost_usd != null ? ` $${x.cost_usd.toFixed(2)}` : ""}${x.pr_url ? ` ${x.pr_url}` : ""}`,
5694
+ ...x.review.map((v) => ` review ${v.round}: ${v.verdict ?? "—"}`),
5695
+ ]),
5696
+ ]
5697
+ .filter((l) => l !== "")
5698
+ .join("\n")
5699
+ );
5700
+ return 0;
5701
+ }
5667
5702
  case "asks": {
5668
5703
  // get_ask_outcomes: did each ask end with what was asked (docs/architecture/failure-visibility.md).
5669
5704
  const q = new URLSearchParams({ view: "asks", days: String(flags.days ?? 7) });
@@ -5674,6 +5709,8 @@ async function cmdAdminLetterpress(ctx) {
5674
5709
  if (flags.whose) q.set("whose", String(flags.whose));
5675
5710
  if (flags.family) q.set("family", String(flags.family));
5676
5711
  if (flags.pattern) q.set("pattern", String(flags.pattern));
5712
+ if (flags.q) q.set("q", String(flags.q));
5713
+ if (flags.outcome) q.set("outcome", String(flags.outcome));
5677
5714
  if (flags.org) q.set("org_id", String(flags.org));
5678
5715
  if (flagBool(flags.customers)) q.set("customers", "1");
5679
5716
  if (flags.limit) q.set("limit", String(flags.limit));
@@ -36,7 +36,7 @@
36
36
  // letterstory visits transact prebuild <site-id>... [--dry-run] staff: build customers' agent sites, Letter paying
37
37
  // letterstory visits transact asks [--since 7d] [--limit 50]
38
38
  // letterstory visits transact learnings [--since 7d]
39
- // letterstory visits transact site [publish|unpublish] [--prepare] [--domain ask.acme.com | --domain none] [--remove <slug>] [--dismiss "<question>"] [--forget <address>] [--check-link] [--dns-for <address>] the Agent Site tab
39
+ // letterstory visits transact site [publish|unpublish] [--prepare] [--domain ask.acme.com | --domain none] [--remove <slug>] [--dismiss "<question>"] [--forget <address>] [--check-link] [--dns-for <address>] [--tree [--since 7d]] the Agent Site tab
40
40
 
41
41
  import { CliError } from "../client.mjs";
42
42
  import { closeSync, fstatSync, openSync, readSync } from "node:fs";
@@ -255,6 +255,8 @@ export const ARGS = {
255
255
  host: "host",
256
256
  check_link: { value: (flags) => (flagBool(flags["check-link"]) ? true : undefined) },
257
257
  dns_for: { flag: "dns-for" },
258
+ tree: { value: (flags) => (flagBool(flags.tree) ? true : undefined) },
259
+ days,
258
260
  },
259
261
  visitors_prebuild_agent_sites: {
260
262
  site_ids: { value: (flags, positionals) => (positionals.length ? positionals : undefined) },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.177.200",
3
+ "version": "0.177.202",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",