@moda-ai/cli 1.55.37 → 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 (39) hide show
  1. package/dist/{agent-4pyeecf7.js → agent-bhe95ae8.js} +8 -8
  2. package/dist/{cli-nqgyz74b.js → cli-1vqq24qh.js} +1 -1
  3. package/dist/{cli-nzx7rqjs.js → cli-2h2nvq6w.js} +1 -1
  4. package/dist/{cli-w3ckvma5.js → cli-39617gab.js} +3 -3
  5. package/dist/{cli-ef9eagsc.js → cli-4hkesrkq.js} +1 -1
  6. package/dist/{cli-wh83c3ss.js → cli-6gtgm2gx.js} +4 -4
  7. package/dist/{cli-xkcy9wns.js → cli-as4c1xwm.js} +5 -5
  8. package/dist/{cli-x605txan.js → cli-c7vj8tq1.js} +5 -5
  9. package/dist/{cli-4d92a450.js → cli-jkza0bj6.js} +1 -1
  10. package/dist/{cli-npkb08xt.js → cli-jmbt1hf9.js} +8 -8
  11. package/dist/{cli-cdx6yd7m.js → cli-k9se46y4.js} +81 -10
  12. package/dist/{cli-cr44672e.js → cli-msgp78ag.js} +5 -5
  13. package/dist/{cli-gjzr7jq5.js → cli-ptm7pwqg.js} +1 -1
  14. package/dist/{cli-s72pph9c.js → cli-qzag917n.js} +1 -1
  15. package/dist/{cli-wg6e2a1g.js → cli-wr6f0kyw.js} +70 -20
  16. package/dist/cli.js +436 -60
  17. package/dist/{doctor-w8z3wj1e.js → doctor-3v20hc26.js} +7 -7
  18. package/dist/{fix-667fyx00.js → fix-s3zkjt69.js} +4 -4
  19. package/dist/{harness-github-actions-7s41s1vg.js → harness-github-actions-mcy21e4d.js} +5 -5
  20. package/dist/{harness-fb0083ap.js → harness-n4569wbm.js} +5 -5
  21. package/dist/{index-4w5szrnw.js → index-2qm3h7v2.js} +11 -11
  22. package/dist/{production-intelligence-v2wq2aqv.js → production-intelligence-z2cad1hv.js} +61 -4
  23. package/dist/{profile-commands-3hw4trwk.js → profile-commands-7ck1tqfv.js} +3 -3
  24. package/dist/{prompt-attribution-g7md8hzc.js → prompt-attribution-dm50am6e.js} +5 -5
  25. package/dist/prompt-source-mcp.js +5 -5
  26. package/dist/{prompts-ab-59r52mxw.js → prompts-ab-9e0dsmce.js} +7 -7
  27. package/dist/{prompts-90v9eg2k.js → prompts-p9hhxx0c.js} +5 -5
  28. package/dist/{prompts-propose-cbenbk8w.js → prompts-propose-91qrjpd0.js} +7 -7
  29. package/dist/{provision-8c4s6vgg.js → provision-x4wkyw60.js} +5 -5
  30. package/dist/{registry-qvjyvbk8.js → registry-nq8qsqtv.js} +3 -3
  31. package/dist/{skills-z7w5x7jj.js → skills-rk2pmwx8.js} +5 -5
  32. package/dist/{sync-r32tgpar.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 +4 -2
  36. package/skills/moda-cli/references/commands.md +3 -2
  37. package/skills/moda-cli/references/dashboard-parity.md +5 -0
  38. package/skills/moda-cli/references/detections.md +53 -0
  39. package/skills/moda-cli/references/production-intelligence.md +1 -1
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  buildDoctorReport
3
- } from "./cli-cr44672e.js";
4
- import"./cli-gjzr7jq5.js";
5
- import"./cli-npkb08xt.js";
3
+ } from "./cli-msgp78ag.js";
4
+ import"./cli-ptm7pwqg.js";
5
+ import"./cli-jmbt1hf9.js";
6
6
  import"./cli-mm48br00.js";
7
7
  import {
8
8
  readHarnessSyncState
@@ -15,15 +15,15 @@ import {
15
15
  readHarnessReport,
16
16
  validateHarnessReport
17
17
  } from "./cli-cesds766.js";
18
- import"./cli-4d92a450.js";
19
- import"./cli-cdx6yd7m.js";
20
- import"./cli-s72pph9c.js";
18
+ import"./cli-jkza0bj6.js";
19
+ import"./cli-k9se46y4.js";
20
+ import"./cli-qzag917n.js";
21
21
  import {
22
22
  resolveApiKey,
23
23
  resolveIngestUrl,
24
24
  resolveModaBaseUrl,
25
25
  resolveTenantId
26
- } from "./cli-wg6e2a1g.js";
26
+ } from "./cli-wr6f0kyw.js";
27
27
  import {
28
28
  CliInputError
29
29
  } from "./cli-k4tqwah4.js";
@@ -94,7 +94,7 @@ async function buildAgentContext(context) {
94
94
  const graph = readHarnessGraphIfPresent(context.cwd);
95
95
  const reportState = readHarnessReportState(context.cwd);
96
96
  const syncState = readHarnessSyncState(context.cwd);
97
- const harness = graph ? await import("./harness-fb0083ap.js") : undefined;
97
+ const harness = graph ? await import("./harness-n4569wbm.js") : undefined;
98
98
  const topFindings = doctor.checks.filter((check) => check.status === "fail" || check.status === "warning").slice(0, 12).map(checkToFinding);
99
99
  const evidenceRefs = [
100
100
  ...doctor.checks.map(checkToEvidenceRef),
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  shellArg
3
- } from "./cli-wg6e2a1g.js";
3
+ } from "./cli-wr6f0kyw.js";
4
4
  import {
5
5
  CliInputError
6
6
  } from "./cli-k4tqwah4.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  callControlAPI
3
- } from "./cli-s72pph9c.js";
3
+ } from "./cli-qzag917n.js";
4
4
 
5
5
  // src/replay-runs.ts
6
6
  var DEFAULT_POLL_INTERVAL_MS = 15000;
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  fetchApiKeyProbe
3
- } from "./cli-ef9eagsc.js";
3
+ } from "./cli-4hkesrkq.js";
4
4
  import {
5
5
  authFetch,
6
6
  getCachedLoginContext
7
- } from "./cli-gjzr7jq5.js";
7
+ } from "./cli-ptm7pwqg.js";
8
8
  import {
9
9
  embeddedTenantIdFromApiKey,
10
10
  getModaDir,
@@ -15,7 +15,7 @@ import {
15
15
  resolveTenantIdFromActiveProfile,
16
16
  saveCliConfig,
17
17
  writeSecretJsonFile
18
- } from "./cli-wg6e2a1g.js";
18
+ } from "./cli-wr6f0kyw.js";
19
19
  import {
20
20
  CliAccessError,
21
21
  CliInputError,
@@ -5,7 +5,7 @@ import {
5
5
  resolveApiKey,
6
6
  resolveApiKeyFromActiveProfile,
7
7
  resolveModaBaseUrl
8
- } from "./cli-wg6e2a1g.js";
8
+ } from "./cli-wr6f0kyw.js";
9
9
 
10
10
  // src/api-key-auth.ts
11
11
  var PROBE_TIMEOUT_MS = 1e4;
@@ -13,22 +13,22 @@ import {
13
13
  } from "./cli-hcwdz9sd.js";
14
14
  import {
15
15
  createCommandContext
16
- } from "./cli-4d92a450.js";
16
+ } from "./cli-jkza0bj6.js";
17
17
  import {
18
18
  assertFlags,
19
19
  assertPositionals,
20
20
  writeDryRun
21
- } from "./cli-cdx6yd7m.js";
21
+ } from "./cli-k9se46y4.js";
22
22
  import {
23
23
  callControlAPI
24
- } from "./cli-s72pph9c.js";
24
+ } from "./cli-qzag917n.js";
25
25
  import {
26
26
  recordApiRequest,
27
27
  resolveApiKey,
28
28
  resolveIngestUrl,
29
29
  resolveTenantId,
30
30
  shellArg
31
- } from "./cli-wg6e2a1g.js";
31
+ } from "./cli-wr6f0kyw.js";
32
32
  import {
33
33
  CliInputError
34
34
  } from "./cli-k4tqwah4.js";
@@ -4,19 +4,19 @@ import {
4
4
  parsePromptFileForAb,
5
5
  readPromptLock,
6
6
  runPromptSync
7
- } from "./cli-npkb08xt.js";
7
+ } from "./cli-jmbt1hf9.js";
8
8
  import {
9
9
  DEFAULT_POLL_INTERVAL_MS,
10
10
  DEFAULT_WAIT_TIMEOUT_MS,
11
11
  fetchLatestRun
12
- } from "./cli-nzx7rqjs.js";
12
+ } from "./cli-2h2nvq6w.js";
13
13
  import {
14
14
  UUID_RE
15
- } from "./cli-cdx6yd7m.js";
15
+ } from "./cli-k9se46y4.js";
16
16
  import {
17
17
  callControlAPI,
18
18
  callDataAPI
19
- } from "./cli-s72pph9c.js";
19
+ } from "./cli-qzag917n.js";
20
20
  import {
21
21
  EXIT_ERROR,
22
22
  EXIT_OK,
@@ -24,7 +24,7 @@ import {
24
24
  setPlatformTenantOverride,
25
25
  shellArg,
26
26
  validateConfig
27
- } from "./cli-wg6e2a1g.js";
27
+ } from "./cli-wr6f0kyw.js";
28
28
  import {
29
29
  CliInputError
30
30
  } from "./cli-k4tqwah4.js";
@@ -44,16 +44,16 @@ import {
44
44
  import {
45
45
  createCommandContext,
46
46
  stringOption
47
- } from "./cli-4d92a450.js";
47
+ } from "./cli-jkza0bj6.js";
48
48
  import {
49
49
  assertFlags,
50
50
  assertPositionals,
51
51
  requireTenant
52
- } from "./cli-cdx6yd7m.js";
52
+ } from "./cli-k9se46y4.js";
53
53
  import {
54
54
  ApiError,
55
55
  callControlAPI
56
- } from "./cli-s72pph9c.js";
56
+ } from "./cli-qzag917n.js";
57
57
  import {
58
58
  embeddedTenantIdFromApiKey,
59
59
  getActiveProfile,
@@ -63,7 +63,7 @@ import {
63
63
  resolveModaBaseUrl,
64
64
  resolveTenantId,
65
65
  shellArg
66
- } from "./cli-wg6e2a1g.js";
66
+ } from "./cli-wr6f0kyw.js";
67
67
  import {
68
68
  CliInputError,
69
69
  CliInputRequiredError
@@ -14048,7 +14048,7 @@ async function runHarnessCommand(context) {
14048
14048
  throw new CliInputError("Focused remote prompt analysis is not supported yet.", "Use local --analyst=claude|codex|cursor|local-scan, or drop --concern for a full remote report.");
14049
14049
  }
14050
14050
  if (context.flags["github-actions"] === "true") {
14051
- const { runGithubActionsAnalyze } = await import("./harness-github-actions-7s41s1vg.js");
14051
+ const { runGithubActionsAnalyze } = await import("./harness-github-actions-mcy21e4d.js");
14052
14052
  const result = await runGithubActionsAnalyze(rootDir, {
14053
14053
  writeReport: (report2) => {
14054
14054
  const normalized = normalizeHarnessReport(report2);
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createCliOutput,
3
3
  outputModeFromFlags
4
- } from "./cli-wg6e2a1g.js";
4
+ } from "./cli-wr6f0kyw.js";
5
5
 
6
6
  // src/boolean-words.ts
7
7
  var BOOLEAN_TRUE_WORDS = new Set(["true", "yes", "1", "on"]);
@@ -4,14 +4,14 @@ import {
4
4
  } from "./cli-mm48br00.js";
5
5
  import {
6
6
  createCommandContext
7
- } from "./cli-4d92a450.js";
7
+ } from "./cli-jkza0bj6.js";
8
8
  import {
9
9
  assertFlags,
10
10
  assertPositionals
11
- } from "./cli-cdx6yd7m.js";
11
+ } from "./cli-k9se46y4.js";
12
12
  import {
13
13
  callControlAPI
14
- } from "./cli-s72pph9c.js";
14
+ } from "./cli-qzag917n.js";
15
15
  import {
16
16
  CliInputError
17
17
  } from "./cli-k4tqwah4.js";
@@ -5725,9 +5725,9 @@ async function runPromptsCommand(input, legacyFlags, legacyProfileOptions) {
5725
5725
  await promotePrompt(positionals, flags, profileOptions, context);
5726
5726
  break;
5727
5727
  case "ab":
5728
- return (await import("./prompts-ab-59r52mxw.js")).runPromptAb(flags, profileOptions, context);
5728
+ return (await import("./prompts-ab-9e0dsmce.js")).runPromptAb(flags, profileOptions, context);
5729
5729
  case "propose":
5730
- await (await import("./prompts-propose-cbenbk8w.js")).runPromptPropose(positionals, flags, profileOptions, context);
5730
+ await (await import("./prompts-propose-91qrjpd0.js")).runPromptPropose(positionals, flags, profileOptions, context);
5731
5731
  break;
5732
5732
  case "list":
5733
5733
  case "show":
@@ -5830,7 +5830,7 @@ async function runPromptSyncExclusive(flags, profileOptions, options) {
5830
5830
  const analyzedDefinitions = new Map;
5831
5831
  if (flags["no-analyze"] !== "true") {
5832
5832
  options.onProgress?.("Analyzing prompt sources before sync.");
5833
- const { analyzeHarnessPrompts } = await import("./harness-fb0083ap.js");
5833
+ const { analyzeHarnessPrompts } = await import("./harness-n4569wbm.js");
5834
5834
  const result = await analyzeHarnessPrompts({
5835
5835
  rootDir: process.cwd(),
5836
5836
  existing: established.flatMap((prompt) => prompt.sourceDefinition ? [prompt.sourceDefinition.source] : []),
@@ -5858,7 +5858,7 @@ async function runPromptSyncExclusive(flags, profileOptions, options) {
5858
5858
  const mergedSources = mergePromptSources(manifest.sources, extraSources);
5859
5859
  const manifestUpdate = stableJson(mergedSources) === stableJson(mergePromptSources(manifest.sources, [])) ? undefined : $stringify({ version: 2, prompt_paths: manifest.promptPaths, sources: mergedSources });
5860
5860
  const prompts = await discoverPrompts(extraSources);
5861
- const { checkPromptAttribution } = await import("./prompt-attribution-g7md8hzc.js");
5861
+ const { checkPromptAttribution } = await import("./prompt-attribution-dm50am6e.js");
5862
5862
  const attribution = checkPromptAttribution(process.cwd(), prompts.map((prompt) => prompt.key));
5863
5863
  const brokenAttribution = attribution.references.filter((reference) => reference.status === "missing");
5864
5864
  if (brokenAttribution.length) {
@@ -6164,7 +6164,7 @@ async function migratePromptManifest(options = {}) {
6164
6164
  let addedSources = [];
6165
6165
  let pendingSources = [];
6166
6166
  if (options.discover) {
6167
- const { analyzeHarnessPrompts } = await import("./harness-fb0083ap.js");
6167
+ const { analyzeHarnessPrompts } = await import("./harness-n4569wbm.js");
6168
6168
  const result = await analyzeHarnessPrompts({
6169
6169
  rootDir: root,
6170
6170
  existing: manifest.sources,
@@ -2,7 +2,7 @@ import {
2
2
  ApiError,
3
3
  callControlAPI,
4
4
  callDataAPI
5
- } from "./cli-s72pph9c.js";
5
+ } from "./cli-qzag917n.js";
6
6
  import {
7
7
  continuationCommand,
8
8
  embeddedTenantIdFromApiKey,
@@ -11,7 +11,7 @@ import {
11
11
  resolveApiTenantId,
12
12
  setPlatformTenantOverride,
13
13
  shellArg
14
- } from "./cli-wg6e2a1g.js";
14
+ } from "./cli-wr6f0kyw.js";
15
15
  import {
16
16
  CliAccessError,
17
17
  CliInputError
@@ -89,6 +89,48 @@ var ContextSchema = z.object({
89
89
  max_messages: z.number().int().min(1).max(5000).optional().describe("With --all: maximum messages to read (default 500)"),
90
90
  ids_from: z.string().min(1).optional().describe("Read several targets (<id> or <id>@<msg_index>), one per line, from a file or - for stdin (batch mode, up to 25)")
91
91
  });
92
+ var EMOTION_SIGNALS = [
93
+ "exasperation",
94
+ "anger",
95
+ "profanity",
96
+ "insult",
97
+ "sarcasm",
98
+ "escalation_request",
99
+ "disapprove",
100
+ "disappointment",
101
+ "resignation",
102
+ "self_blame",
103
+ "personal_distress",
104
+ "confusion",
105
+ "urgency",
106
+ "distrust",
107
+ "gratitude",
108
+ "satisfaction",
109
+ "delight"
110
+ ];
111
+ var EMOTION_ELICITORS = ["bot", "external", "self", "ambiguous"];
112
+ var EMOTION_TRAJECTORIES = ["none", "building", "peak", "resolved", "sustained"];
113
+ var EMOTION_TRACE_SORTS = ["score", "risk_score", "detected_at", "message_count"];
114
+ var HALLUCINATION_SOURCES = ["rule", "classifier", "gpu", "judge", "human"];
115
+ var HALLUCINATION_TRACE_SORTS = ["contradicted_count", "verified_count", "last_detected_at"];
116
+ var LAZINESS_TRACE_SORTS = ["detections_count", "strong_count", "last_detected_at"];
117
+ var SORT_ORDERS = ["asc", "desc"];
118
+ var emotionSignalsFlag = () => z.string().trim().min(1).refine((value) => value.split(",").every((signal) => EMOTION_SIGNALS.includes(signal.trim())), { message: `must be one or more of ${EMOTION_SIGNALS.join(", ")}, comma-separated` }).optional().describe(`Only traces expressing any of these signals, comma-separated (${EMOTION_SIGNALS.join(", ")}); needs --group-by=trace`);
119
+ var emotionTraceFilters = {
120
+ group_by: z.enum(["detection", "trace"]).optional().describe("detection (default): one row per trace and family. trace: one row per trace, totals count traces as the dashboard does"),
121
+ search: z.string().trim().min(1).max(200).optional().describe("Trace ID or primary-cause substring; needs --group-by=trace"),
122
+ status: z.enum(["all", "detected"]).optional().describe("all: any detected family. detected: a negative-family detection; needs --group-by=trace"),
123
+ elicitor: z.enum(EMOTION_ELICITORS).optional().describe("Who elicited the emotion; needs --group-by=trace"),
124
+ trajectory: z.enum(EMOTION_TRAJECTORIES).optional().describe("How the emotion moved over the trace; needs --group-by=trace"),
125
+ signal: emotionSignalsFlag(),
126
+ sort: z.enum(EMOTION_TRACE_SORTS).optional().describe("Trace order (default score); needs --group-by=trace"),
127
+ order: z.enum(SORT_ORDERS).optional().describe("Sort direction (default desc); needs --group-by=trace")
128
+ };
129
+ var TRACE_GRAIN_FLAGS = {
130
+ emotions: ["search", "status", "elicitor", "trajectory", "signal", "sort", "order"],
131
+ frustrations: ["search", "status", "elicitor", "trajectory", "signal", "sort", "order"],
132
+ hallucinations: ["search", "status", "rule", "source", "sort", "order"]
133
+ };
92
134
  var FrustrationsSchema = z.object({
93
135
  days_back: daysBackFlag(7),
94
136
  limit: z.number().int().min(1).max(20).default(10).optional().describe("Maximum detections to return"),
@@ -96,14 +138,27 @@ var FrustrationsSchema = z.object({
96
138
  include_window: boolFlag().describe("Attach the surrounding messages to each detection (agent output omits them by default)"),
97
139
  window: z.number().int().min(1).max(5).default(1).optional().describe("Messages on each side with --include-window"),
98
140
  user_id: z.string().min(1).max(256).optional().describe("Scope everything to one end user"),
99
- conversation_id: z.string().min(1).max(256).optional().describe("Scope everything to one trace ID")
141
+ conversation_id: z.string().min(1).max(256).optional().describe("Scope everything to one trace ID"),
142
+ ...emotionTraceFilters
100
143
  });
101
144
  var ToolFailuresSchema = z.object({
102
145
  days_back: daysBackFlag(7)
103
146
  });
147
+ var PROBLEM_LIST_VIEWS = ["auto", "book", "dream"];
148
+ var BOOK_PROBLEM_SORTS = ["rank", "users", "signals", "problems"];
149
+ var DREAM_PROBLEM_SORTS = ["severity", "users", "silent"];
150
+ var PROBLEMS_MAX_LIMIT = 200;
151
+ var PROBLEMS_DEFAULT_LIMIT = 10;
152
+ var COHORT_REF = /^(all|builtin:[a-z_]{1,64}|[a-z_]{1,64}|[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
104
153
  var ProblemsSchema = z.object({
105
- days_back: daysBackFlag(30),
106
- limit: z.number().int().min(1).max(25).default(25).optional().describe("Maximum Problems to return")
154
+ view: z.enum(PROBLEM_LIST_VIEWS).default("auto").optional().describe("auto: what the dashboard shows (the dream grouping when published, else the Book); book or dream to force one"),
155
+ days_back: daysBackFlag().describe("Whole days to look back (Book default 30; the dream view defaults to its run window)"),
156
+ limit: z.number().int().min(1).max(PROBLEMS_MAX_LIMIT).default(PROBLEMS_DEFAULT_LIMIT).optional().describe("Problems per page (Book: per partition, problems and untrusted)"),
157
+ offset: z.number().int().min(0).max(1e4).optional().describe("Row to start at: next_offset from the previous page"),
158
+ list_version: z.string().regex(/^[0-9a-f]{1,64}$/, "must be the list_version of a previous page").optional().describe("list_version of the first page, passed with every later --offset"),
159
+ sort: z.string().regex(/^(rank|severity|users|signals|problems|silent|signal:[a-z_]{1,64})$/, "must be rank, severity, users, silent (dream), signals, problems or signal:<family> (Book)").optional().describe("Order: rank (default), users; dream: severity, silent; Book: signals, problems, signal:<family>"),
160
+ dir: z.enum(["desc", "asc"]).optional().describe("Sort direction (default desc)"),
161
+ cohort: z.string().regex(COHORT_REF, "must be builtin:<key> or a saved cohort id").optional().describe("Only the Problems this cohort hit (builtin:<key> or a saved cohort id), with its counts")
107
162
  });
108
163
  var REMAINDER_FAMILIES = [
109
164
  "tool_failure",
@@ -157,7 +212,10 @@ var ProblemSchema = z.object({
157
212
  limit: z.number().int().min(1).max(50).optional().describe("Page size for a sub-resource page"),
158
213
  cursor: z.string().optional().describe("next_cursor from the previous page, verbatim"),
159
214
  family: z.enum(PROBLEM_FAMILIES).optional().describe("With --traces: only this signal family"),
160
- door: z.enum(PROBLEM_DOORS).optional().describe("With --traces: only this attribution door")
215
+ door: z.enum(PROBLEM_DOORS).optional().describe("With --traces: only this attribution door"),
216
+ view: z.enum(["book", "dream"]).optional().describe("dream: the dream view of the problem (definition, severity, incidents with verdicts); default the dossier"),
217
+ offset: z.number().int().min(0).max(1e4).optional().describe("With --view=dream: first incident to return"),
218
+ days_back: daysBackFlag().describe("With --view=dream: whole days to count (default the dream run window)")
161
219
  });
162
220
  var PROBLEM_FEEDBACK_ACTIONS = [
163
221
  "mark_fixed",
@@ -260,14 +318,22 @@ var EmotionsSchema = z.object({
260
318
  family: z.enum(EMOTION_FAMILIES).optional().describe("Only this family in the detections list (summary covers all)"),
261
319
  user_id: z.string().min(1).max(256).optional().describe("Scope everything to one end user"),
262
320
  conversation_id: z.string().min(1).max(256).optional().describe("Scope everything to one trace ID"),
263
- include_window: boolFlag().describe("Keep each detection's conversation context (agent output omits it by default)")
321
+ include_window: boolFlag().describe("Keep each detection's conversation context (agent output omits it by default)"),
322
+ ...emotionTraceFilters
264
323
  });
265
324
  var HallucinationsSchema = z.object({
266
325
  days_back: daysBackFlag(7),
267
326
  limit: z.number().int().min(1).max(20).default(10).optional().describe("Maximum detections to return"),
268
327
  offset: z.number().int().min(0).max(1e4).optional().describe("Number of detections to skip"),
269
328
  conversation_id: z.string().max(200).optional().describe("Scope summary and list to one trace ID"),
270
- kind: z.enum(["contradicted", "verified"]).optional().describe("Only this kind in the detections list")
329
+ kind: z.enum(["contradicted", "verified"]).optional().describe("Only this kind in the detections list"),
330
+ group_by: z.enum(["message", "trace"]).optional().describe("message (default): one row per scored message. trace: one row per trace, totals count traces as the dashboard does"),
331
+ search: z.string().trim().min(1).max(200).optional().describe("Trace ID substring; needs --group-by=trace"),
332
+ status: z.enum(["contradicted", "all"]).optional().describe("contradicted (default): traces with a contradiction. all: also verified-only traces; needs --group-by=trace"),
333
+ rule: z.string().trim().min(1).max(200).optional().describe("One rule_id from summary.rule_breakdown; scopes the summary too; needs --group-by=trace"),
334
+ source: z.enum(HALLUCINATION_SOURCES).optional().describe("Only detections from this source; needs --group-by=trace"),
335
+ sort: z.enum(HALLUCINATION_TRACE_SORTS).optional().describe("Trace order (default contradicted_count); needs --group-by=trace"),
336
+ order: z.enum(SORT_ORDERS).optional().describe("Sort direction (default desc); needs --group-by=trace")
271
337
  });
272
338
  var LAZINESS_FAMILIES = [
273
339
  "omission_comment",
@@ -295,7 +361,12 @@ var LazinessSchema = z.object({
295
361
  limit: z.number().int().min(1).max(50).default(10).optional().describe("Maximum detections to return"),
296
362
  offset: z.number().int().min(0).max(1e4).optional().describe("Number of detections to skip"),
297
363
  conversation_id: z.string().max(200).optional().describe("One trace's detections"),
298
- family: z.enum(LAZINESS_FAMILIES).optional().describe("Only this laziness family")
364
+ family: z.enum(LAZINESS_FAMILIES).optional().describe("Only this laziness family"),
365
+ group_by: z.enum(["trace"]).optional().describe("Accepted for symmetry: laziness rows are always one per trace"),
366
+ search: z.string().trim().min(1).max(200).optional().describe("Trace ID substring"),
367
+ status: z.enum(["all", "strong"]).optional().describe("all (default), or strong: traces with a high-confidence detection"),
368
+ sort: z.enum(LAZINESS_TRACE_SORTS).optional().describe("Trace order (default detections_count)"),
369
+ order: z.enum(SORT_ORDERS).optional().describe("Sort direction (default desc)")
299
370
  });
300
371
  var StepScoresSchema = z.object({
301
372
  conversation_id: z.string().min(1).describe("Trace ID")
@@ -1359,4 +1430,4 @@ function unknownSignalsSubcommandError(sub, args = []) {
1359
1430
  ${SIGNAL_USAGE}`);
1360
1431
  }
1361
1432
 
1362
- export { ProblemsRemainderSchema, UUID_RE, ProblemImpactSchema, PROBLEM_FEEDBACK_ACTIONS, ProblemFeedbackSchema, ProblemLinearFileSchema, SignalLabelSchema, DETECTION_VERDICTS, DetectionReviewSchema, FALSE_POSITIVE_KINDS, FalsePositiveSchema, EMOTION_FAMILIES, LAZINESS_FAMILIES, StepScoresSchema, AuditSchema, FEEDBACK_USAGE, isFeedbackRefFlag, buildFeedbackRequest, writeDryRun, COMMAND_FLAG_SPECS, flagSpecFor, kebabFlag, schemaShape, describeField, specFlagKeys, specFlagNames, describeSpecFlags, closestMatches, usageLine, renderFlagHelp, subcommandHelpFlags, manifestFlagFields, requireTenant, assertFlags, assertPositionals, runUsersCommand, runUserCommand, runProblemReopenCommand, runSignalsManagementCommand, SIGNALS_MANAGEMENT_SUBCOMMANDS, unknownSignalsSubcommandError };
1433
+ export { TRACE_GRAIN_FLAGS, BOOK_PROBLEM_SORTS, DREAM_PROBLEM_SORTS, PROBLEMS_MAX_LIMIT, PROBLEMS_DEFAULT_LIMIT, ProblemsRemainderSchema, UUID_RE, ProblemImpactSchema, PROBLEM_FEEDBACK_ACTIONS, ProblemFeedbackSchema, ProblemLinearFileSchema, SignalLabelSchema, DETECTION_VERDICTS, DetectionReviewSchema, FALSE_POSITIVE_KINDS, FalsePositiveSchema, EMOTION_FAMILIES, LAZINESS_FAMILIES, StepScoresSchema, AuditSchema, FEEDBACK_USAGE, isFeedbackRefFlag, buildFeedbackRequest, writeDryRun, COMMAND_FLAG_SPECS, flagSpecFor, kebabFlag, schemaShape, describeField, specFlagKeys, specFlagNames, describeSpecFlags, closestMatches, usageLine, renderFlagHelp, subcommandHelpFlags, manifestFlagFields, requireTenant, assertFlags, assertPositionals, runUsersCommand, runUserCommand, runProblemReopenCommand, runSignalsManagementCommand, SIGNALS_MANAGEMENT_SUBCOMMANDS, unknownSignalsSubcommandError };
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  isAuthSessionValid,
3
3
  loadAuthSession
4
- } from "./cli-gjzr7jq5.js";
4
+ } from "./cli-ptm7pwqg.js";
5
5
  import {
6
6
  inspectPromptManifest
7
- } from "./cli-npkb08xt.js";
7
+ } from "./cli-jmbt1hf9.js";
8
8
  import {
9
9
  readHarnessSyncState,
10
10
  renderDoctorHuman,
@@ -12,7 +12,7 @@ import {
12
12
  } from "./cli-xq45etg1.js";
13
13
  import {
14
14
  callDataAPI
15
- } from "./cli-s72pph9c.js";
15
+ } from "./cli-qzag917n.js";
16
16
  import {
17
17
  ensureSecretFilePermissions,
18
18
  getActiveProfile,
@@ -26,7 +26,7 @@ import {
26
26
  resolveSecretReference,
27
27
  resolveTenantId,
28
28
  secretFilePathFromRef
29
- } from "./cli-wg6e2a1g.js";
29
+ } from "./cli-wr6f0kyw.js";
30
30
  import {
31
31
  __require
32
32
  } from "./cli-0v6na3yp.js";
@@ -376,7 +376,7 @@ async function harnessCurrentCheck(cwd, manifestPath, manifestExists, tenantId)
376
376
  };
377
377
  }
378
378
  try {
379
- const { scanHarness } = await import("./harness-fb0083ap.js");
379
+ const { scanHarness } = await import("./harness-n4569wbm.js");
380
380
  const current = scanHarness({
381
381
  rootDir: cwd,
382
382
  scannerVersion: "doctor",
@@ -6,7 +6,7 @@ import {
6
6
  saveProfileConfig,
7
7
  secretFilePathFromRef,
8
8
  writeSecretJsonFile
9
- } from "./cli-wg6e2a1g.js";
9
+ } from "./cli-wr6f0kyw.js";
10
10
  import {
11
11
  CliAuthError,
12
12
  CliInputError
@@ -3,7 +3,7 @@ import {
3
3
  recordApiRequest,
4
4
  resolveApiKey,
5
5
  resolveModaBaseUrl
6
- } from "./cli-wg6e2a1g.js";
6
+ } from "./cli-wr6f0kyw.js";
7
7
 
8
8
  // src/api-client.ts
9
9
  var REQUEST_TIMEOUT_MS = 30000;
@@ -1277,7 +1277,10 @@ function createAgentEnvelope(options) {
1277
1277
  findings: text.findings,
1278
1278
  evidence_refs: text.evidence_refs,
1279
1279
  recommended_actions: text.recommended_actions,
1280
- next_commands: [...withoutSupersededPaging(text.next_commands, bounded.supersededPaging), ...canonicalSuggestions(bounded.nextCommands ?? [])],
1280
+ next_commands: [
1281
+ ...withoutSupersededPaging(text.next_commands, bounded.supersededPaging).filter((command) => !(command.nextPage && bounded.nextCommands?.length)).map(({ nextPage: _nextPage, ...command }) => command),
1282
+ ...canonicalSuggestions(bounded.nextCommands ?? [])
1283
+ ],
1281
1284
  artifacts: [
1282
1285
  ...options.artifacts ?? [],
1283
1286
  ...bounded.fullOutputPath ? [{ kind: "full_output", path: bounded.fullOutputPath, description: "Complete command output (the same JSON --json prints); data in this envelope was bounded." }] : [],
@@ -1922,20 +1925,22 @@ function continuationCommand(invocation, overrides) {
1922
1925
  var PAGED_LIST_BY_COMMAND = {
1923
1926
  "tool-failure-detail": "examples",
1924
1927
  "tool-catalog": "tools",
1925
- emotions: "detections",
1926
- frustrations: "frustrations",
1928
+ emotions: ["detections", "traces"],
1929
+ frustrations: ["frustrations", "traces"],
1927
1930
  laziness: "conversations",
1931
+ problems: ["problems", "untrusted"],
1928
1932
  "problems remainder": "groups",
1929
1933
  "problem remainder": "groups"
1930
1934
  };
1931
- function pagedListFor(invocation) {
1935
+ function pagedListsFor(invocation) {
1932
1936
  const { command, positionals } = invocation.routedAs ?? invocation;
1933
1937
  const subcommand = positionals[0];
1934
- return (subcommand !== undefined ? PAGED_LIST_BY_COMMAND[`${command} ${subcommand}`] : undefined) ?? PAGED_LIST_BY_COMMAND[command];
1938
+ const paged = (subcommand !== undefined ? PAGED_LIST_BY_COMMAND[`${command} ${subcommand}`] : undefined) ?? PAGED_LIST_BY_COMMAND[command];
1939
+ return paged === undefined ? [] : typeof paged === "string" ? [paged] : paged;
1935
1940
  }
1936
1941
  var MAX_PAGE_OFFSET = 1e4;
1937
1942
  function rewritePagination(list, isTopLevel, invocation) {
1938
- const { parent, array, originalLength } = list;
1943
+ const { parent, array } = list;
1939
1944
  if (!parent)
1940
1945
  return;
1941
1946
  const nested = asRecord(parent.pagination);
@@ -1945,32 +1950,40 @@ function rewritePagination(list, isTopLevel, invocation) {
1945
1950
  return;
1946
1951
  const listKey = list.path.split(".").pop() ?? list.path;
1947
1952
  const arrayKeys = Object.keys(parent).filter((key) => Array.isArray(parent[key]));
1948
- if (arrayKeys.length > 1) {
1949
- const paged = invocation ? pagedListFor(invocation) : undefined;
1950
- if (paged === undefined || paged !== listKey)
1951
- return;
1952
- }
1953
- if (typeof pagination.returned === "number" ? pagination.returned !== originalLength : typeof pagination.limit === "number" && originalLength > pagination.limit) {
1953
+ const paged = invocation ? pagedListsFor(invocation) : [];
1954
+ if (arrayKeys.length > 1 && !paged.includes(listKey))
1955
+ return;
1956
+ if (typeof pagination.returned === "number" ? pagination.returned !== list.originalLength : typeof pagination.limit === "number" && list.originalLength > pagination.limit) {
1954
1957
  return;
1955
1958
  }
1956
- const kept = array.length;
1959
+ const kept = list.page?.kept ?? array.length;
1960
+ const originalLength = list.page?.original ?? list.originalLength;
1957
1961
  const omitted = originalLength - kept;
1962
+ const requested = typeof pagination.limit === "number" ? pagination.limit : undefined;
1963
+ const step = requested !== undefined ? Math.min(kept, requested) : kept;
1964
+ const ranked = requested !== undefined ? Math.min(requested, originalLength) : originalLength;
1965
+ const nextLimit = ranked > step ? ranked - step : requested ?? omitted;
1958
1966
  const offset = typeof pagination.offset === "number" && Number.isFinite(pagination.offset) ? pagination.offset : undefined;
1959
1967
  const hadCursor = typeof pagination.next_cursor === "string" && pagination.next_cursor.length > 0 || typeof pagination.nextCursor === "string" && pagination.nextCursor.length > 0;
1960
1968
  if (typeof pagination.limit === "number") {
1961
1969
  pagination.requested_limit = pagination.limit;
1962
1970
  pagination.limit = kept;
1963
1971
  }
1964
- pagination.returned = kept;
1972
+ pagination.returned = array.length;
1973
+ for (const key of paged.slice(1)) {
1974
+ if (typeof pagination[`${key}_returned`] === "number" && Array.isArray(parent[key])) {
1975
+ pagination[`${key}_returned`] = parent[key].length;
1976
+ }
1977
+ }
1965
1978
  pagination.omitted_for_byte_limit = omitted;
1966
1979
  pagination.has_more = true;
1967
1980
  if ("hasMore" in pagination)
1968
1981
  pagination.hasMore = true;
1969
1982
  if ("nextCursor" in pagination && typeof pagination.nextCursor === "string" && pagination.nextCursor)
1970
1983
  pagination.nextCursor = null;
1971
- const pastOffsetCap = offset !== undefined && offset + kept > MAX_PAGE_OFFSET;
1984
+ const pastOffsetCap = offset !== undefined && offset + step > MAX_PAGE_OFFSET;
1972
1985
  if (offset !== undefined && !pastOffsetCap)
1973
- pagination.next_offset = offset + kept;
1986
+ pagination.next_offset = offset + step;
1974
1987
  if (hadCursor)
1975
1988
  pagination.next_cursor = null;
1976
1989
  const where = `data.${list.path}`;
@@ -1983,12 +1996,15 @@ function rewritePagination(list, isTopLevel, invocation) {
1983
1996
  return { note: `${where} holds ${kept} of ${originalLength} row(s)` };
1984
1997
  }
1985
1998
  if (offset !== undefined) {
1986
- const command = continuationCommand(invocation, { offset: offset + kept, limit: omitted });
1999
+ const overrides = { offset: offset + step, limit: nextLimit };
2000
+ if (typeof pagination.list_version === "string")
2001
+ overrides["list-version"] = pagination.list_version;
2002
+ const command = continuationCommand(invocation, overrides);
1987
2003
  return {
1988
- note: `${where} holds ${kept} of ${originalLength} row(s); pagination.next_offset=${offset + kept}. Fetch the ${omitted} omitted row(s) with: ${command}`,
2004
+ note: `${where} holds ${kept} of ${originalLength} row(s); pagination.next_offset=${offset + step}. Fetch the ${omitted} omitted row(s) with: ${command}`,
1989
2005
  nextCommand: {
1990
2006
  command,
1991
- purpose: `Fetch the ${omitted} row(s) of this page that were left out to fit the agent byte limit.`,
2007
+ purpose: `Continue from the first row of this page that was left out to fit the agent byte limit.`,
1992
2008
  mutability: "read",
1993
2009
  requires_approval: false
1994
2010
  },
@@ -2065,6 +2081,10 @@ function boundForAgent(data, maxBytes = agentMaxOutputBytes(), options = {}) {
2065
2081
  boundedBytes = sizeOf(bounded);
2066
2082
  }
2067
2083
  }
2084
+ const root = asRecord(bounded);
2085
+ if (root && options.invocation && alignPagedLists(root, pagedListsFor(options.invocation), droppedLists, droppedItems)) {
2086
+ boundedBytes = sizeOf(bounded);
2087
+ }
2068
2088
  const dropped = Object.entries(droppedItems);
2069
2089
  const whereIsTheRest = fullOutputPath ? `The complete output (every item, no text shortened) is in ${fullOutputPath}; read it in line ranges or query it with jq. ` : "The complete output could not be saved to a file. ";
2070
2090
  const howToGetMore = whereIsTheRest + "Alternatively narrow the query (a smaller --limit, with --offset or --cursor paging where the command supports it), " + "rerun with --json (no byte limit), or raise MODA_AGENT_MAX_OUTPUT_BYTES.";
@@ -2080,7 +2100,6 @@ function boundForAgent(data, maxBytes = agentMaxOutputBytes(), options = {}) {
2080
2100
  fullOutputPath
2081
2101
  };
2082
2102
  }
2083
- const root = asRecord(bounded);
2084
2103
  const notes = [];
2085
2104
  const nextCommands = [];
2086
2105
  const supersededPaging = new Set;
@@ -2128,6 +2147,37 @@ function withoutSupersededPaging(commands, superseded) {
2128
2147
  const flags = superseded.map((flag) => new RegExp(`(^|\\s)--${flag}=`));
2129
2148
  return commands.filter((next) => !flags.some((flag) => flag.test(next.command)));
2130
2149
  }
2150
+ function alignPagedLists(root, lists, droppedLists, droppedItems) {
2151
+ if (lists.length < 2)
2152
+ return false;
2153
+ const cut = lists.flatMap((key) => {
2154
+ const list = droppedLists.get(key);
2155
+ return list && list.parent === root ? [list] : [];
2156
+ });
2157
+ if (cut.length === 0)
2158
+ return false;
2159
+ const kept = Math.min(...cut.map((list) => list.array.length));
2160
+ let aligned = false;
2161
+ let primary;
2162
+ let original = 0;
2163
+ for (const key of lists) {
2164
+ const array = root[key];
2165
+ if (!Array.isArray(array))
2166
+ continue;
2167
+ const length = droppedLists.get(key)?.originalLength ?? array.length;
2168
+ original = Math.max(original, length);
2169
+ if (array.length > kept) {
2170
+ droppedItems[key] = (droppedItems[key] ?? 0) + array.length - kept;
2171
+ array.splice(kept);
2172
+ aligned = true;
2173
+ }
2174
+ droppedLists.delete(key);
2175
+ primary ??= { path: key, parent: root, array, originalLength: length };
2176
+ }
2177
+ if (primary)
2178
+ droppedLists.set(primary.path, { ...primary, page: { kept, original } });
2179
+ return aligned;
2180
+ }
2131
2181
  function asRecord(value) {
2132
2182
  return value && typeof value === "object" && !Array.isArray(value) ? value : undefined;
2133
2183
  }