@moda-ai/cli 1.55.38 → 1.55.39

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.
Files changed (38) hide show
  1. package/dist/{agent-9r58v0bc.js → agent-bhe95ae8.js} +8 -8
  2. package/dist/{cli-n311b8g0.js → cli-1vqq24qh.js} +1 -1
  3. package/dist/{cli-xk630wjq.js → cli-2h2nvq6w.js} +1 -1
  4. package/dist/{cli-tdcx8yz9.js → cli-39617gab.js} +3 -3
  5. package/dist/{cli-9g5kzsg6.js → cli-4hkesrkq.js} +1 -1
  6. package/dist/{cli-93926afn.js → cli-6gtgm2gx.js} +4 -4
  7. package/dist/{cli-nh23q6ay.js → cli-as4c1xwm.js} +5 -5
  8. package/dist/{cli-skvvwp2q.js → cli-c7vj8tq1.js} +5 -5
  9. package/dist/{cli-b7nyw498.js → cli-jkza0bj6.js} +1 -1
  10. package/dist/{cli-dmnayt2r.js → cli-jmbt1hf9.js} +8 -8
  11. package/dist/{cli-xheg54qc.js → cli-k9se46y4.js} +21 -6
  12. package/dist/{cli-xtyszvq1.js → cli-msgp78ag.js} +5 -5
  13. package/dist/{cli-sk1p71wr.js → cli-ptm7pwqg.js} +1 -1
  14. package/dist/{cli-3n040fp2.js → cli-qzag917n.js} +1 -1
  15. package/dist/{cli-rcjhfts4.js → cli-wr6f0kyw.js} +65 -16
  16. package/dist/cli.js +295 -47
  17. package/dist/{doctor-xq5bjvpq.js → doctor-3v20hc26.js} +7 -7
  18. package/dist/{fix-kvszavm1.js → fix-s3zkjt69.js} +4 -4
  19. package/dist/{harness-github-actions-drbkcb8d.js → harness-github-actions-mcy21e4d.js} +5 -5
  20. package/dist/{harness-qatnwxrz.js → harness-n4569wbm.js} +5 -5
  21. package/dist/{index-y5jnz2t2.js → index-2qm3h7v2.js} +11 -11
  22. package/dist/{production-intelligence-j55vaw6t.js → production-intelligence-z2cad1hv.js} +3 -3
  23. package/dist/{profile-commands-skdxe17v.js → profile-commands-7ck1tqfv.js} +3 -3
  24. package/dist/{prompt-attribution-zq38actx.js → prompt-attribution-dm50am6e.js} +5 -5
  25. package/dist/prompt-source-mcp.js +5 -5
  26. package/dist/{prompts-ab-yd2dawe3.js → prompts-ab-9e0dsmce.js} +7 -7
  27. package/dist/{prompts-cwqn8a57.js → prompts-p9hhxx0c.js} +5 -5
  28. package/dist/{prompts-propose-11dj9ked.js → prompts-propose-91qrjpd0.js} +7 -7
  29. package/dist/{provision-ghca9d54.js → provision-x4wkyw60.js} +5 -5
  30. package/dist/{registry-76sngjw6.js → registry-nq8qsqtv.js} +3 -3
  31. package/dist/{skills-btn9r48v.js → skills-rk2pmwx8.js} +5 -5
  32. package/dist/{sync-ye7nxeen.js → sync-xxbfjcz5.js} +7 -7
  33. package/package.json +1 -1
  34. package/skills/integration/index.json +2 -2
  35. package/skills/moda-cli/SKILL.md +2 -2
  36. package/skills/moda-cli/references/commands.md +2 -2
  37. package/skills/moda-cli/references/dashboard-parity.md +2 -0
  38. package/skills/moda-cli/references/production-intelligence.md +1 -1
package/dist/cli.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  withFrustrationAnchors,
21
21
  withToolFailureAnchors,
22
22
  withoutDetectionWindows
23
- } from "./cli-n311b8g0.js";
23
+ } from "./cli-1vqq24qh.js";
24
24
  import {
25
25
  createCommandContext,
26
26
  envOptOutSet,
@@ -28,17 +28,21 @@ import {
28
28
  optOutFlagSet,
29
29
  parseBooleanFlagValue,
30
30
  withoutFlag
31
- } from "./cli-b7nyw498.js";
31
+ } from "./cli-jkza0bj6.js";
32
32
  import {
33
33
  AuditSchema,
34
+ BOOK_PROBLEM_SORTS,
34
35
  COMMAND_FLAG_SPECS,
35
36
  DETECTION_VERDICTS,
37
+ DREAM_PROBLEM_SORTS,
36
38
  DetectionReviewSchema,
37
39
  EMOTION_FAMILIES,
38
40
  FALSE_POSITIVE_KINDS,
39
41
  FEEDBACK_USAGE,
40
42
  FalsePositiveSchema,
41
43
  LAZINESS_FAMILIES,
44
+ PROBLEMS_DEFAULT_LIMIT,
45
+ PROBLEMS_MAX_LIMIT,
42
46
  PROBLEM_FEEDBACK_ACTIONS,
43
47
  ProblemFeedbackSchema,
44
48
  ProblemImpactSchema,
@@ -71,12 +75,12 @@ import {
71
75
  unknownSignalsSubcommandError,
72
76
  usageLine,
73
77
  writeDryRun
74
- } from "./cli-xheg54qc.js";
78
+ } from "./cli-k9se46y4.js";
75
79
  import {
76
80
  ApiError,
77
81
  callControlAPI,
78
82
  callDataAPI
79
- } from "./cli-3n040fp2.js";
83
+ } from "./cli-qzag917n.js";
80
84
  import {
81
85
  AGENT_ERROR_CODES,
82
86
  EXIT_AUTH_REQUIRED,
@@ -113,7 +117,7 @@ import {
113
117
  shellArg,
114
118
  validateConfig,
115
119
  wasOutputCancelled
116
- } from "./cli-rcjhfts4.js";
120
+ } from "./cli-wr6f0kyw.js";
117
121
  import {
118
122
  CliAccessError,
119
123
  CliAuthError,
@@ -1156,8 +1160,8 @@ var CANONICAL_LEAVES = [
1156
1160
  path: "problems list",
1157
1161
  args: "",
1158
1162
  handler: "problems",
1159
- summary: "Rank cross-signal Problems by root cause (what to fix first)",
1160
- examples: ["moda problems list", "moda problems list --days-back=7 --limit=10"]
1163
+ summary: "The Problems the dashboard shows, ranked (the dream grouping when published, else the Book)",
1164
+ examples: ["moda problems list", "moda problems list --sort=users --limit=20", "moda problems list --view=book --days-back=7 --offset=10 --list-version=<list_version>"]
1161
1165
  },
1162
1166
  {
1163
1167
  noun: "problems",
@@ -1165,8 +1169,8 @@ var CANONICAL_LEAVES = [
1165
1169
  path: "problems get",
1166
1170
  args: "<problem_id>",
1167
1171
  handler: "problem",
1168
- summary: "One Problem: dossier, or its --evidence/--reports/--traces/--feedback pages",
1169
- examples: ["moda problems get <problem_id>", "moda problems get <problem_id> --evidence --limit=10", "moda problems get <problem_id> --traces --family=tool_failure"]
1172
+ summary: "One Problem: dossier, its --evidence/--reports/--traces/--feedback pages, or --view=dream",
1173
+ examples: ["moda problems get <problem_id>", "moda problems get <problem_id> --view=dream", "moda problems get <problem_id> --evidence --limit=10", "moda problems get <problem_id> --traces --family=tool_failure"]
1170
1174
  },
1171
1175
  {
1172
1176
  noun: "problems",
@@ -2982,46 +2986,46 @@ function leafManifestFields(leaf, commands) {
2982
2986
  import { fileURLToPath } from "url";
2983
2987
  import { realpathSync } from "fs";
2984
2988
  async function runPromptsCommand(...args) {
2985
- return (await import("./prompts-cwqn8a57.js")).runPromptsCommand(...args);
2989
+ return (await import("./prompts-p9hhxx0c.js")).runPromptsCommand(...args);
2986
2990
  }
2987
2991
  async function runSkillsCommand(...args) {
2988
- return (await import("./skills-btn9r48v.js")).runSkillsCommand(...args);
2992
+ return (await import("./skills-rk2pmwx8.js")).runSkillsCommand(...args);
2989
2993
  }
2990
2994
  async function runFixCommand(...args) {
2991
- return (await import("./fix-kvszavm1.js")).runFixCommand(...args);
2995
+ return (await import("./fix-s3zkjt69.js")).runFixCommand(...args);
2992
2996
  }
2993
2997
  async function runFixesCommand(...args) {
2994
- return (await import("./fix-kvszavm1.js")).runFixesCommand(...args);
2998
+ return (await import("./fix-s3zkjt69.js")).runFixesCommand(...args);
2995
2999
  }
2996
3000
  async function runHarnessCommand(...args) {
2997
- return (await import("./harness-qatnwxrz.js")).runHarnessCommand(...args);
3001
+ return (await import("./harness-n4569wbm.js")).runHarnessCommand(...args);
2998
3002
  }
2999
3003
  async function runSyncCommand(...args) {
3000
- return (await import("./sync-ye7nxeen.js")).runSyncCommand(...args);
3004
+ return (await import("./sync-xxbfjcz5.js")).runSyncCommand(...args);
3001
3005
  }
3002
3006
  async function runRegistryCommand(...args) {
3003
- return (await import("./registry-76sngjw6.js")).runRegistryCommand(...args);
3007
+ return (await import("./registry-nq8qsqtv.js")).runRegistryCommand(...args);
3004
3008
  }
3005
3009
  async function runDoctorCommand(...args) {
3006
- return (await import("./doctor-xq5bjvpq.js")).runDoctorCommand(...args);
3010
+ return (await import("./doctor-3v20hc26.js")).runDoctorCommand(...args);
3007
3011
  }
3008
3012
  async function runStatusCommand(...args) {
3009
- return (await import("./doctor-xq5bjvpq.js")).runStatusCommand(...args);
3013
+ return (await import("./doctor-3v20hc26.js")).runStatusCommand(...args);
3010
3014
  }
3011
3015
  async function runAuthCommand(...args) {
3012
- return (await import("./profile-commands-skdxe17v.js")).runAuthCommand(...args);
3016
+ return (await import("./profile-commands-7ck1tqfv.js")).runAuthCommand(...args);
3013
3017
  }
3014
3018
  async function runConfigCommand(...args) {
3015
- return (await import("./profile-commands-skdxe17v.js")).runConfigCommand(...args);
3019
+ return (await import("./profile-commands-7ck1tqfv.js")).runConfigCommand(...args);
3016
3020
  }
3017
3021
  async function runProfilesCommand(...args) {
3018
- return (await import("./profile-commands-skdxe17v.js")).runProfilesCommand(...args);
3022
+ return (await import("./profile-commands-7ck1tqfv.js")).runProfilesCommand(...args);
3019
3023
  }
3020
3024
  async function runAgentCommand(...args) {
3021
- return (await import("./agent-9r58v0bc.js")).runAgentCommand(...args);
3025
+ return (await import("./agent-bhe95ae8.js")).runAgentCommand(...args);
3022
3026
  }
3023
3027
  async function runProductionCommand(...args) {
3024
- return (await import("./production-intelligence-j55vaw6t.js")).runProductionCommand(...args);
3028
+ return (await import("./production-intelligence-z2cad1hv.js")).runProductionCommand(...args);
3025
3029
  }
3026
3030
  function parseArgs(argv) {
3027
3031
  const args = argv.slice(2);
@@ -4146,7 +4150,7 @@ var WINDOW_FLAG_HINTS = {
4146
4150
  var COMMAND_FLAG_HINTS = {
4147
4151
  problems: {
4148
4152
  family: "'moda problems' ranks every family together. To filter by family use 'moda problems unexplained --family=<family>' (signals no Problem explains yet) or 'moda problems get <problem_id> --traces --family=<family>' (one Problem's traces).",
4149
- cursor: "'moda problems' has no cursor; 'moda problems unexplained --cursor=<next_cursor>' pages the unexplained signals."
4153
+ cursor: "'moda problems list' pages with --offset=<next_offset> --list-version=<list_version>; 'moda problems unexplained --cursor=<next_cursor>' pages the unexplained signals."
4150
4154
  }
4151
4155
  };
4152
4156
  function parseCommandFlags(schema, args, command, options = {}) {
@@ -4521,6 +4525,260 @@ async function runProblemsRemainder(flags, context) {
4521
4525
  const queryString = query2.toString() ? `?${query2.toString()}` : "";
4522
4526
  context.output.writeData(await callDataAPI(`/problems/remainder${queryString}`));
4523
4527
  }
4528
+ var isDreamOnlySort = (sort) => sort === "severity" || sort === "silent";
4529
+ var isBookOnlySort = (sort) => sort === "signals" || sort === "problems" || (sort?.startsWith("signal:") ?? false);
4530
+ function problemsListCommand(params, view, page, daysGiven) {
4531
+ const parts = ["moda problems list", `--view=${view}`];
4532
+ if (daysGiven && params.days_back !== undefined)
4533
+ parts.push(`--days-back=${params.days_back}`);
4534
+ parts.push(`--limit=${params.limit ?? PROBLEMS_DEFAULT_LIMIT}`);
4535
+ if (params.sort)
4536
+ parts.push(`--sort=${shellArg(params.sort)}`);
4537
+ if (params.dir)
4538
+ parts.push(`--dir=${params.dir}`);
4539
+ if (params.cohort)
4540
+ parts.push(`--cohort=${shellArg(params.cohort)}`);
4541
+ parts.push(`--offset=${page.offset}`, `--list-version=${page.listVersion}`);
4542
+ return parts.join(" ");
4543
+ }
4544
+ function listVersionWarning(params, served) {
4545
+ if (!params.list_version || typeof served !== "string" || served === params.list_version)
4546
+ return [];
4547
+ return [
4548
+ `The list changed since --list-version=${params.list_version} was read (this page is list_version=${served}). Offsets of the two lists do not line up: restart from the first page (drop --offset and --list-version).`
4549
+ ];
4550
+ }
4551
+ function hierarchyForPage(payload) {
4552
+ const hierarchy = asRecord(payload.hierarchy);
4553
+ if (!hierarchy || !Array.isArray(hierarchy.macros))
4554
+ return payload;
4555
+ const shown = new Set([...Array.isArray(payload.problems) ? payload.problems : [], ...Array.isArray(payload.untrusted) ? payload.untrusted : []].map((row) => asRecord(row)?.problem_id).filter((id) => typeof id === "string"));
4556
+ const macros = hierarchy.macros.map((macro) => {
4557
+ const record = asRecord(macro);
4558
+ if (!record || !Array.isArray(record.children))
4559
+ return macro;
4560
+ return { ...record, children: record.children.filter((id) => typeof id === "string" && shown.has(id)) };
4561
+ });
4562
+ return { ...payload, hierarchy: { ...hierarchy, macros, children_listed: "this page only; child_count is the full size" } };
4563
+ }
4564
+ async function runProblemsList(flags, context, command) {
4565
+ const args = flagsToArgs(flags);
4566
+ const params = parseSpecFlags("problems", args, command);
4567
+ const view = params.view ?? "auto";
4568
+ const daysGiven = args.days_back !== undefined;
4569
+ const limit = params.limit ?? PROBLEMS_DEFAULT_LIMIT;
4570
+ const offset = params.offset ?? 0;
4571
+ if (view === "book" && isDreamOnlySort(params.sort)) {
4572
+ throw new CliInputError(`--sort=${params.sort} orders the dream view; the Book sorts by ${BOOK_PROBLEM_SORTS.join(", ")} or signal:<family>.`);
4573
+ }
4574
+ if (view === "dream" && isBookOnlySort(params.sort)) {
4575
+ throw new CliInputError(`--sort=${params.sort} orders the Book; the dream view sorts by rank, ${DREAM_PROBLEM_SORTS.join(", ")}.`);
4576
+ }
4577
+ if (params.list_version && params.offset === undefined) {
4578
+ throw new CliInputError("--list-version pages a list: pass it with the --offset of the next page (next_offset).");
4579
+ }
4580
+ if (view !== "book") {
4581
+ const query3 = new URLSearchParams;
4582
+ if (daysGiven && params.days_back !== undefined)
4583
+ query3.set("days_back", String(params.days_back));
4584
+ if (params.cohort)
4585
+ query3.set("cohort", params.cohort);
4586
+ const bookOnly = isBookOnlySort(params.sort);
4587
+ query3.set("limit", String(bookOnly ? 1 : limit));
4588
+ if (!bookOnly) {
4589
+ if (offset > 0)
4590
+ query3.set("offset", String(offset));
4591
+ if (params.list_version)
4592
+ query3.set("list_version", params.list_version);
4593
+ if (params.sort && params.sort !== "rank")
4594
+ query3.set("sort", params.sort);
4595
+ if (params.dir)
4596
+ query3.set("dir", params.dir);
4597
+ }
4598
+ const dream = asRecord(await callDataAPI(`/problems/dream?${query3.toString()}`)) ?? {};
4599
+ if (dream.available === true) {
4600
+ if (bookOnly) {
4601
+ throw new CliInputError(`This tenant's dashboard shows the dream grouping of its Problems, which --sort=${params.sort} does not order.`, `Use --sort=rank|${DREAM_PROBLEM_SORTS.join("|")} for the dream view, or --view=book --sort=${params.sort} for the Book's ranked list.`);
4602
+ }
4603
+ writeDreamProblemsList(context, params, dream, { offset, limit, daysGiven });
4604
+ return;
4605
+ }
4606
+ if (view === "dream") {
4607
+ context.output.writeData({ available: false, view: "dream", dashboard_url: `${MODA_BASE_URL}/dashboard/problems` }, {
4608
+ warnings: ["This tenant has no dream grouping published; the dashboard shows the Book. List it with: moda problems list --view=book"],
4609
+ nextCommands: [{ command: "moda problems list --view=book", purpose: "List the Book's ranked Problems (what the dashboard shows for this tenant).", mutability: "read", requires_approval: false }]
4610
+ });
4611
+ return;
4612
+ }
4613
+ }
4614
+ if (isDreamOnlySort(params.sort)) {
4615
+ throw new CliInputError(`This tenant has no dream grouping published, so its Problems are the Book's ranked list, which --sort=${params.sort} does not order.`, `Use --sort=${BOOK_PROBLEM_SORTS.join("|")} or signal:<family>.`);
4616
+ }
4617
+ const query2 = new URLSearchParams;
4618
+ query2.set("days_back", String(params.days_back ?? 30));
4619
+ query2.set("limit", String(limit));
4620
+ if (offset > 0)
4621
+ query2.set("offset", String(offset));
4622
+ if (params.list_version)
4623
+ query2.set("list_version", params.list_version);
4624
+ if (params.sort)
4625
+ query2.set("sort", params.sort);
4626
+ if (params.dir)
4627
+ query2.set("dir", params.dir);
4628
+ if (params.cohort)
4629
+ query2.set("cohort", params.cohort);
4630
+ const data = await callDataAPI(`/problems?${query2.toString()}`);
4631
+ const { payload: capped, truncated } = capProblemsBlocks(asRecord(data) ?? {}, limit);
4632
+ const agentMode = context.output.mode === "agent" || context.output.mode === "agent-stream";
4633
+ const payload = agentMode ? hierarchyForPage(capped) : capped;
4634
+ const problems = Array.isArray(payload.problems) ? payload.problems : [];
4635
+ const untrusted = Array.isArray(payload.untrusted) ? payload.untrusted : [];
4636
+ const nextOffset = typeof payload.next_offset === "number" ? payload.next_offset : null;
4637
+ const listVersion = typeof payload.list_version === "string" ? payload.list_version : undefined;
4638
+ const withLink = {
4639
+ view: "book",
4640
+ ...payload,
4641
+ pagination: {
4642
+ offset,
4643
+ limit,
4644
+ returned: problems.length,
4645
+ untrusted_returned: untrusted.length,
4646
+ has_more: nextOffset !== null,
4647
+ next_offset: nextOffset,
4648
+ ...listVersion ? { list_version: listVersion } : {}
4649
+ },
4650
+ ...truncated ? { truncated } : {},
4651
+ dashboard_url: `${MODA_BASE_URL}/dashboard/problems`
4652
+ };
4653
+ const nextCommands = [];
4654
+ if (nextOffset !== null && listVersion) {
4655
+ nextCommands.push({
4656
+ command: problemsListCommand(params, "book", { offset: nextOffset, listVersion }, daysGiven),
4657
+ purpose: `Read the next page of the Book (problems and untrusted from row ${nextOffset}).`,
4658
+ mutability: "read",
4659
+ requires_approval: false,
4660
+ nextPage: true
4661
+ });
4662
+ }
4663
+ const top = asRecord(problems[0]) ?? asRecord(untrusted[0]);
4664
+ if (typeof top?.problem_id === "string") {
4665
+ nextCommands.push({ command: `moda problems get ${shellArg(top.problem_id)}`, purpose: "Open the first Problem on this page.", mutability: "read", requires_approval: false });
4666
+ }
4667
+ const warnings = [
4668
+ ...serverWarnings(payload),
4669
+ ...listVersionWarning(params, listVersion),
4670
+ ...truncated ? [`--limit=${limit} also capped ${Object.entries(truncated).map(([block, count]) => `${block} (${count} more)`).join(", ")}; raise --limit (max ${PROBLEMS_MAX_LIMIT}) or open dashboard_url for the rest.`] : []
4671
+ ];
4672
+ context.output.writeData(withLink, {
4673
+ ...warnings.length > 0 ? { warnings } : {},
4674
+ ...nextCommands.length > 0 ? { nextCommands } : {}
4675
+ });
4676
+ }
4677
+ function writeDreamProblemsList(context, params, dream, page) {
4678
+ const problems = Array.isArray(dream.problems) ? dream.problems : [];
4679
+ const nextOffset = typeof dream.next_offset === "number" ? dream.next_offset : null;
4680
+ const listVersion = typeof dream.list_version === "string" ? dream.list_version : undefined;
4681
+ const run = asRecord(dream.run);
4682
+ const { offset: _offset, limit: _limit, next_offset: _next, list_version: _version, ...rest } = dream;
4683
+ const data = {
4684
+ ...rest,
4685
+ pagination: {
4686
+ offset: page.offset,
4687
+ limit: page.limit,
4688
+ returned: problems.length,
4689
+ total: asNumber(asRecord(dream.summary)?.problems) ?? null,
4690
+ has_more: nextOffset !== null,
4691
+ next_offset: nextOffset,
4692
+ ...listVersion ? { list_version: listVersion } : {}
4693
+ },
4694
+ dashboard_url: `${MODA_BASE_URL}/dashboard/problems`
4695
+ };
4696
+ const nextCommands = [];
4697
+ if (nextOffset !== null && listVersion) {
4698
+ nextCommands.push({
4699
+ command: problemsListCommand(params, "dream", { offset: nextOffset, listVersion }, page.daysGiven),
4700
+ purpose: `Read the next page of the dream grouping (from row ${nextOffset}).`,
4701
+ mutability: "read",
4702
+ requires_approval: false,
4703
+ nextPage: true
4704
+ });
4705
+ }
4706
+ const top = asRecord(problems[0]);
4707
+ if (typeof top?.problem_id === "string") {
4708
+ const id = shellArg(top.problem_id);
4709
+ nextCommands.push({ command: `moda problems get ${id} --view=dream`, purpose: "Open the first Problem as the dashboard shows it: definition, severity and its most serious incidents.", mutability: "read", requires_approval: false }, { command: `moda problems get ${id} --evidence`, purpose: "Page the evidence behind it (dream problem ids are Book ids).", mutability: "read", requires_approval: false });
4710
+ }
4711
+ const windowHours = asNumber(run?.window_hours);
4712
+ const warnings = [
4713
+ "This tenant's dashboard shows the dream grouping of its Problems, so this is that list, in the dashboard table's order. The Book's ranked list is --view=book.",
4714
+ ...!page.daysGiven && windowHours !== undefined ? [`Counts cover the dream run's window (${windowHours} hours), the dashboard's default range; pass --days-back to choose another.`] : [],
4715
+ ...listVersionWarning(params, listVersion)
4716
+ ];
4717
+ context.output.writeData(data, { warnings, ...nextCommands.length > 0 ? { nextCommands } : {} });
4718
+ }
4719
+ var DREAM_INCIDENTS_DEFAULT_LIMIT = 3;
4720
+ async function runDreamProblem(params, context, command) {
4721
+ const others = ["evidence", "reports", "traces", "conversations", "feedback", "full"].filter((key) => params[key] === true);
4722
+ if (others.length > 0) {
4723
+ throw new CliInputError(`--view=dream is its own page; it does not combine with ${others.map((key) => `--${key === "conversations" ? "traces" : key}`).join(", ")}.`, `Usage: moda problems get <problem_id> --view=dream [--limit=N] [--offset=N] [--days-back=N], or drop --view=dream for the dossier and its pages.`);
4724
+ }
4725
+ rejectInapplicableFlags(command, params, ["cursor", "family", "door"], "to --view=dream; it pages incidents with --limit and --offset");
4726
+ if (!UUID_RE.test(params.id)) {
4727
+ throw new CliInputError(`--view=dream requires a canonical problem UUID; got "${params.id}". Run \`moda problems list\` to list problem ids.`);
4728
+ }
4729
+ const limit = params.limit ?? DREAM_INCIDENTS_DEFAULT_LIMIT;
4730
+ const offset = params.offset ?? 0;
4731
+ const query2 = new URLSearchParams({ limit: String(limit) });
4732
+ if (offset > 0)
4733
+ query2.set("offset", String(offset));
4734
+ if (params.days_back !== undefined)
4735
+ query2.set("days_back", String(params.days_back));
4736
+ const id = shellArg(params.id);
4737
+ const data = asRecord(await callDataAPI(`/problems/dream/${encodeURIComponent(params.id)}?${query2.toString()}`).catch((error) => {
4738
+ if (error instanceof ApiError && error.statusCode === 404) {
4739
+ throwIfNotFound("problem", params.id, true, `Problem "${params.id}" is not in this tenant's dream grouping; read its dossier with: moda problems get ${id}`);
4740
+ }
4741
+ throw error;
4742
+ })) ?? {};
4743
+ if (data.available !== true) {
4744
+ context.output.writeData({ available: false, view: "dream", problem_id: params.id }, {
4745
+ warnings: [`This tenant has no dream grouping published; read the problem's dossier with: moda problems get ${id}`],
4746
+ nextCommands: [{ command: `moda problems get ${id}`, purpose: "Read the dossier (what the dashboard shows for this tenant).", mutability: "read", requires_approval: false }]
4747
+ });
4748
+ return;
4749
+ }
4750
+ const incidents = Array.isArray(data.incidents) ? data.incidents : [];
4751
+ const nextOffset = typeof data.next_offset === "number" ? data.next_offset : null;
4752
+ const { offset: _offset, limit: _limit, next_offset: _next, ...rest } = data;
4753
+ const nextCommands = [];
4754
+ if (nextOffset !== null) {
4755
+ const days = params.days_back !== undefined ? ` --days-back=${params.days_back}` : "";
4756
+ nextCommands.push({
4757
+ command: `moda problems get ${id} --view=dream --limit=${limit} --offset=${nextOffset}${days}`,
4758
+ purpose: `Read the next incidents of this problem (from incident ${nextOffset}).`,
4759
+ mutability: "read",
4760
+ requires_approval: false,
4761
+ nextPage: true
4762
+ });
4763
+ }
4764
+ const first = asRecord(incidents[0]);
4765
+ if (typeof first?.conversation_id === "string") {
4766
+ nextCommands.push({ command: `moda traces get ${shellArg(first.conversation_id)}`, purpose: "Open the trace of its most serious incident.", mutability: "read", requires_approval: false });
4767
+ }
4768
+ nextCommands.push({ command: `moda problems get ${id} --evidence`, purpose: "Page the Book evidence behind the same problem (dream ids are Book ids).", mutability: "read", requires_approval: false });
4769
+ context.output.writeData({
4770
+ ...rest,
4771
+ pagination: {
4772
+ offset,
4773
+ limit,
4774
+ returned: incidents.length,
4775
+ total: asNumber(data.incidents_total) ?? null,
4776
+ has_more: nextOffset !== null,
4777
+ next_offset: nextOffset
4778
+ },
4779
+ dashboard_url: `${MODA_BASE_URL}/dashboard/problems/${encodeURIComponent(params.id)}`
4780
+ }, { nextCommands });
4781
+ }
4524
4782
  function processingDisabledWarning(data, family) {
4525
4783
  const processing = asRecord(asRecord(data)?.processing);
4526
4784
  const label = family === "emotion" ? "Emotion" : "Frustration";
@@ -5665,25 +5923,9 @@ async function runCommand(command, positional, flags, positionals = positional ?
5665
5923
  break;
5666
5924
  }
5667
5925
  if (positional) {
5668
- throw new CliInputError(`Unknown problems subcommand '${positional}'.`, "Usage: moda problems [--days-back=N] [--limit=N] | moda problems unexplained [--family=F] [--days-back=N] [--limit=N] [--cursor=TOKEN]. For one Problem use 'moda problems get <id>'.");
5926
+ throw new CliInputError(`Unknown problems subcommand '${positional}'.`, "Usage: moda problems list [--view=auto|book|dream] [--days-back=N] [--limit=N] [--offset=N --list-version=V] [--sort=S] [--cohort=REF] | moda problems unexplained [--family=F] [--days-back=N] [--limit=N] [--cursor=TOKEN]. For one Problem use 'moda problems get <id>'.");
5669
5927
  }
5670
- const args = flagsToArgs(flags);
5671
- const params = parseSpecFlags("problems", args, command);
5672
- const query2 = new URLSearchParams;
5673
- if (params.days_back)
5674
- query2.set("days_back", params.days_back.toString());
5675
- if (params.limit)
5676
- query2.set("limit", params.limit.toString());
5677
- const queryString = query2.toString() ? `?${query2.toString()}` : "";
5678
- const data = await callDataAPI(`/problems${queryString}`);
5679
- const { payload, truncated } = capProblemsBlocks(asRecord(data) ?? {}, params.limit ?? 25);
5680
- const withLink = {
5681
- ...payload,
5682
- ...truncated ? { truncated } : {},
5683
- dashboard_url: `${MODA_BASE_URL}/dashboard/problems`
5684
- };
5685
- const warnings = [...serverWarnings(payload), ...truncated ? [`--limit=${params.limit ?? 25} also capped ${Object.entries(truncated).map(([block, count]) => `${block} (${count} more)`).join(", ")}; raise --limit (max 25) or open dashboard_url for the rest.`] : []];
5686
- context.output.writeData(withLink, warnings.length > 0 ? { warnings } : undefined);
5928
+ await runProblemsList(flags, context, command);
5687
5929
  break;
5688
5930
  }
5689
5931
  case "problem": {
@@ -5696,6 +5938,11 @@ async function runCommand(command, positional, flags, positionals = positional ?
5696
5938
  }
5697
5939
  const args = flagsToArgs(flags, "id", positional);
5698
5940
  const params = parseSpecFlags("problem", args, command);
5941
+ if (params.view === "dream") {
5942
+ await runDreamProblem(params, context, command);
5943
+ break;
5944
+ }
5945
+ rejectInapplicableFlags(command, params, ["offset", "days_back"], "without --view=dream; the dossier pages page with --limit and --cursor");
5699
5946
  const traceView = params.traces === true || params.conversations === true;
5700
5947
  const views = ["evidence", "reports", "conversations", "feedback"].filter((view2) => view2 === "conversations" ? traceView : params[view2] === true);
5701
5948
  if (views.length > 1) {
@@ -6396,7 +6643,7 @@ var commandRegistry = createCommandRegistry([
6396
6643
  resetApiRequestCountBeforeRun: true,
6397
6644
  telemetry: "result-and-error",
6398
6645
  handler: async (context) => {
6399
- const { runInit } = await import("./index-y5jnz2t2.js");
6646
+ const { runInit } = await import("./index-2qm3h7v2.js");
6400
6647
  if (context.outputMode === "agent-stream") {
6401
6648
  context.output.writeEvent({
6402
6649
  event: "started",
@@ -6446,7 +6693,7 @@ var commandRegistry = createCommandRegistry([
6446
6693
  resetApiRequestCountBeforeRun: true,
6447
6694
  telemetry: "result-and-error",
6448
6695
  handler: async (context) => {
6449
- const { runProvision } = await import("./provision-ghca9d54.js");
6696
+ const { runProvision } = await import("./provision-x4wkyw60.js");
6450
6697
  return runProvision(context, {
6451
6698
  resumeCommand: buildResumeCommand("provision", context.rawFlags)
6452
6699
  });
@@ -6962,7 +7209,7 @@ var commandRegistry = createCommandRegistry([
6962
7209
  legacyCommand({
6963
7210
  name: "problems",
6964
7211
  description: "Rank cross-signal Problems by root cause (what to fix first)",
6965
- examples: ["moda problems list", "moda problems list --days-back=7 --limit=10", "moda problems get <problem_id> --evidence", "moda problems unexplained --family=emotion"],
7212
+ examples: ["moda problems list", "moda problems list --view=book --sort=users --limit=20", "moda problems get <problem_id> --view=dream", "moda problems get <problem_id> --evidence", "moda problems unexplained --family=emotion"],
6966
7213
  subcommands: treeSubcommandHelp("problems"),
6967
7214
  defaultSubcommand: "list",
6968
7215
  ...dataApiDefaults
@@ -6984,14 +7231,15 @@ var commandRegistry = createCommandRegistry([
6984
7231
  }),
6985
7232
  legacyCommand({
6986
7233
  name: "problem",
6987
- description: "Open one Problem: dossier, or --evidence/--reports/--traces/--feedback pages (--conversations is a legacy alias of --traces)",
7234
+ description: "Open one Problem: dossier, --evidence/--reports/--traces/--feedback pages (--conversations is a legacy alias of --traces), or --view=dream",
6988
7235
  examples: [
6989
7236
  "moda problems get <problem_id>",
6990
7237
  "moda problems get <problem_id> --full # whole dossier (agent output defaults to a compact one)",
6991
7238
  "moda problems get <problem_id> --evidence --limit=10",
6992
7239
  "moda problems get <problem_id> --reports",
6993
7240
  "moda problems get <problem_id> --traces --family=tool_failure",
6994
- "moda problems get <problem_id> --feedback"
7241
+ "moda problems get <problem_id> --feedback",
7242
+ "moda problems get <problem_id> --view=dream --limit=3 --offset=3 # the dream page: definition, severity, incidents"
6995
7243
  ],
6996
7244
  ...dataApiDefaults
6997
7245
  }),
@@ -3,15 +3,15 @@ import {
3
3
  promptsDiscoveredCheck,
4
4
  runDoctorCommand,
5
5
  runStatusCommand
6
- } from "./cli-xtyszvq1.js";
7
- import"./cli-sk1p71wr.js";
8
- import"./cli-dmnayt2r.js";
6
+ } from "./cli-msgp78ag.js";
7
+ import"./cli-ptm7pwqg.js";
8
+ import"./cli-jmbt1hf9.js";
9
9
  import"./cli-mm48br00.js";
10
10
  import"./cli-xq45etg1.js";
11
- import"./cli-b7nyw498.js";
12
- import"./cli-xheg54qc.js";
13
- import"./cli-3n040fp2.js";
14
- import"./cli-rcjhfts4.js";
11
+ import"./cli-jkza0bj6.js";
12
+ import"./cli-k9se46y4.js";
13
+ import"./cli-qzag917n.js";
14
+ import"./cli-wr6f0kyw.js";
15
15
  import"./cli-k4tqwah4.js";
16
16
  import"./cli-9kfxkxmk.js";
17
17
  import"./cli-ns5fcnkz.js";
@@ -2,13 +2,13 @@ import {
2
2
  DEFAULT_POLL_INTERVAL_MS,
3
3
  DEFAULT_WAIT_TIMEOUT_MS,
4
4
  fetchLatestRun
5
- } from "./cli-xk630wjq.js";
5
+ } from "./cli-2h2nvq6w.js";
6
6
  import {
7
7
  assertFlags
8
- } from "./cli-xheg54qc.js";
8
+ } from "./cli-k9se46y4.js";
9
9
  import {
10
10
  callControlAPI
11
- } from "./cli-3n040fp2.js";
11
+ } from "./cli-qzag917n.js";
12
12
  import {
13
13
  EXIT_DEGRADED,
14
14
  EXIT_ERROR,
@@ -17,7 +17,7 @@ import {
17
17
  resolveApiTenantId,
18
18
  shellArg,
19
19
  validateConfig
20
- } from "./cli-rcjhfts4.js";
20
+ } from "./cli-wr6f0kyw.js";
21
21
  import {
22
22
  CliInputError
23
23
  } from "./cli-k4tqwah4.js";
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  buildSourceSnapshot
3
- } from "./cli-skvvwp2q.js";
3
+ } from "./cli-c7vj8tq1.js";
4
4
  import"./cli-xq45etg1.js";
5
5
  import"./cli-97fnztpy.js";
6
6
  import"./cli-cesds766.js";
7
7
  import"./cli-qpq84eee.js";
8
- import"./cli-b7nyw498.js";
9
- import"./cli-xheg54qc.js";
10
- import"./cli-3n040fp2.js";
8
+ import"./cli-jkza0bj6.js";
9
+ import"./cli-k9se46y4.js";
10
+ import"./cli-qzag917n.js";
11
11
  import {
12
12
  recordApiRequest
13
- } from "./cli-rcjhfts4.js";
13
+ } from "./cli-wr6f0kyw.js";
14
14
  import"./cli-k4tqwah4.js";
15
15
  import"./cli-9kfxkxmk.js";
16
16
  import"./cli-ns5fcnkz.js";
@@ -40,17 +40,17 @@ import {
40
40
  writeHarnessAnalyzeResult,
41
41
  writeHarnessArtifacts,
42
42
  writeHumanProgress
43
- } from "./cli-skvvwp2q.js";
43
+ } from "./cli-c7vj8tq1.js";
44
44
  import"./cli-xq45etg1.js";
45
45
  import"./cli-97fnztpy.js";
46
46
  import {
47
47
  HARNESS_ANALYZE_CONCERNS
48
48
  } from "./cli-cesds766.js";
49
49
  import"./cli-qpq84eee.js";
50
- import"./cli-b7nyw498.js";
51
- import"./cli-xheg54qc.js";
52
- import"./cli-3n040fp2.js";
53
- import"./cli-rcjhfts4.js";
50
+ import"./cli-jkza0bj6.js";
51
+ import"./cli-k9se46y4.js";
52
+ import"./cli-qzag917n.js";
53
+ import"./cli-wr6f0kyw.js";
54
54
  import"./cli-k4tqwah4.js";
55
55
  import"./cli-9kfxkxmk.js";
56
56
  import"./cli-ns5fcnkz.js";
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  buildDoctorReport
3
- } from "./cli-xtyszvq1.js";
3
+ } from "./cli-msgp78ag.js";
4
4
  import {
5
5
  selectTenantAndCreateKey
6
- } from "./cli-tdcx8yz9.js";
7
- import"./cli-9g5kzsg6.js";
6
+ } from "./cli-39617gab.js";
7
+ import"./cli-4hkesrkq.js";
8
8
  import {
9
9
  ConnectCodeError,
10
10
  connectWithCode,
11
11
  loadAuthSession,
12
12
  loadToken,
13
13
  login
14
- } from "./cli-sk1p71wr.js";
14
+ } from "./cli-ptm7pwqg.js";
15
15
  import {
16
16
  bundledSkillsDir,
17
17
  installIntegrationSkill,
@@ -20,7 +20,7 @@ import {
20
20
  import {
21
21
  agentsMdProblem,
22
22
  runSkillSync
23
- } from "./cli-93926afn.js";
23
+ } from "./cli-6gtgm2gx.js";
24
24
  import"./cli-qm5b1vck.js";
25
25
  import {
26
26
  detectAgents
@@ -32,7 +32,7 @@ import {
32
32
  import {
33
33
  initPrompts,
34
34
  runPromptSync
35
- } from "./cli-dmnayt2r.js";
35
+ } from "./cli-jmbt1hf9.js";
36
36
  import"./cli-mm48br00.js";
37
37
  import {
38
38
  codingAgentDisplayName,
@@ -46,7 +46,7 @@ import {
46
46
  runCodingAgent,
47
47
  runHarnessCommand,
48
48
  startRemoteAnalyze
49
- } from "./cli-skvvwp2q.js";
49
+ } from "./cli-c7vj8tq1.js";
50
50
  import {
51
51
  canonicalText,
52
52
  renderInitBanner,
@@ -62,16 +62,16 @@ import"./cli-cesds766.js";
62
62
  import"./cli-qpq84eee.js";
63
63
  import {
64
64
  createCommandContext
65
- } from "./cli-b7nyw498.js";
66
- import"./cli-xheg54qc.js";
67
- import"./cli-3n040fp2.js";
65
+ } from "./cli-jkza0bj6.js";
66
+ import"./cli-k9se46y4.js";
67
+ import"./cli-qzag917n.js";
68
68
  import {
69
69
  VERSION,
70
70
  recordApiRequest,
71
71
  resolveIngestUrl,
72
72
  resolveModaBaseUrl,
73
73
  shellArg
74
- } from "./cli-rcjhfts4.js";
74
+ } from "./cli-wr6f0kyw.js";
75
75
  import {
76
76
  CliAuthError,
77
77
  CliInputError