@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
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  buildDoctorReport
3
- } from "./cli-xtyszvq1.js";
4
- import"./cli-sk1p71wr.js";
5
- import"./cli-dmnayt2r.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-b7nyw498.js";
19
- import"./cli-xheg54qc.js";
20
- import"./cli-3n040fp2.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-rcjhfts4.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-qatnwxrz.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-rcjhfts4.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-3n040fp2.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-9g5kzsg6.js";
3
+ } from "./cli-4hkesrkq.js";
4
4
  import {
5
5
  authFetch,
6
6
  getCachedLoginContext
7
- } from "./cli-sk1p71wr.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-rcjhfts4.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-rcjhfts4.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-b7nyw498.js";
16
+ } from "./cli-jkza0bj6.js";
17
17
  import {
18
18
  assertFlags,
19
19
  assertPositionals,
20
20
  writeDryRun
21
- } from "./cli-xheg54qc.js";
21
+ } from "./cli-k9se46y4.js";
22
22
  import {
23
23
  callControlAPI
24
- } from "./cli-3n040fp2.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-rcjhfts4.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-dmnayt2r.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-xk630wjq.js";
12
+ } from "./cli-2h2nvq6w.js";
13
13
  import {
14
14
  UUID_RE
15
- } from "./cli-xheg54qc.js";
15
+ } from "./cli-k9se46y4.js";
16
16
  import {
17
17
  callControlAPI,
18
18
  callDataAPI
19
- } from "./cli-3n040fp2.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-rcjhfts4.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-b7nyw498.js";
47
+ } from "./cli-jkza0bj6.js";
48
48
  import {
49
49
  assertFlags,
50
50
  assertPositionals,
51
51
  requireTenant
52
- } from "./cli-xheg54qc.js";
52
+ } from "./cli-k9se46y4.js";
53
53
  import {
54
54
  ApiError,
55
55
  callControlAPI
56
- } from "./cli-3n040fp2.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-rcjhfts4.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-drbkcb8d.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-rcjhfts4.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-b7nyw498.js";
7
+ } from "./cli-jkza0bj6.js";
8
8
  import {
9
9
  assertFlags,
10
10
  assertPositionals
11
- } from "./cli-xheg54qc.js";
11
+ } from "./cli-k9se46y4.js";
12
12
  import {
13
13
  callControlAPI
14
- } from "./cli-3n040fp2.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-yd2dawe3.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-11dj9ked.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-qatnwxrz.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-zq38actx.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-qatnwxrz.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-3n040fp2.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-rcjhfts4.js";
14
+ } from "./cli-wr6f0kyw.js";
15
15
  import {
16
16
  CliAccessError,
17
17
  CliInputError
@@ -144,9 +144,21 @@ var FrustrationsSchema = z.object({
144
144
  var ToolFailuresSchema = z.object({
145
145
  days_back: daysBackFlag(7)
146
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})$/;
147
153
  var ProblemsSchema = z.object({
148
- days_back: daysBackFlag(30),
149
- 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")
150
162
  });
151
163
  var REMAINDER_FAMILIES = [
152
164
  "tool_failure",
@@ -200,7 +212,10 @@ var ProblemSchema = z.object({
200
212
  limit: z.number().int().min(1).max(50).optional().describe("Page size for a sub-resource page"),
201
213
  cursor: z.string().optional().describe("next_cursor from the previous page, verbatim"),
202
214
  family: z.enum(PROBLEM_FAMILIES).optional().describe("With --traces: only this signal family"),
203
- 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)")
204
219
  });
205
220
  var PROBLEM_FEEDBACK_ACTIONS = [
206
221
  "mark_fixed",
@@ -1415,4 +1430,4 @@ function unknownSignalsSubcommandError(sub, args = []) {
1415
1430
  ${SIGNAL_USAGE}`);
1416
1431
  }
1417
1432
 
1418
- export { TRACE_GRAIN_FLAGS, 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-sk1p71wr.js";
4
+ } from "./cli-ptm7pwqg.js";
5
5
  import {
6
6
  inspectPromptManifest
7
- } from "./cli-dmnayt2r.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-3n040fp2.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-rcjhfts4.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-qatnwxrz.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-rcjhfts4.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-rcjhfts4.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." }] : [],
@@ -1925,6 +1928,7 @@ var PAGED_LIST_BY_COMMAND = {
1925
1928
  emotions: ["detections", "traces"],
1926
1929
  frustrations: ["frustrations", "traces"],
1927
1930
  laziness: "conversations",
1931
+ problems: ["problems", "untrusted"],
1928
1932
  "problems remainder": "groups",
1929
1933
  "problem remainder": "groups"
1930
1934
  };
@@ -1936,7 +1940,7 @@ function pagedListsFor(invocation) {
1936
1940
  }
1937
1941
  var MAX_PAGE_OFFSET = 1e4;
1938
1942
  function rewritePagination(list, isTopLevel, invocation) {
1939
- const { parent, array, originalLength } = list;
1943
+ const { parent, array } = list;
1940
1944
  if (!parent)
1941
1945
  return;
1942
1946
  const nested = asRecord(parent.pagination);
@@ -1946,32 +1950,40 @@ function rewritePagination(list, isTopLevel, invocation) {
1946
1950
  return;
1947
1951
  const listKey = list.path.split(".").pop() ?? list.path;
1948
1952
  const arrayKeys = Object.keys(parent).filter((key) => Array.isArray(parent[key]));
1949
- if (arrayKeys.length > 1) {
1950
- const paged = invocation ? pagedListsFor(invocation) : [];
1951
- if (!paged.includes(listKey))
1952
- return;
1953
- }
1954
- 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) {
1955
1957
  return;
1956
1958
  }
1957
- const kept = array.length;
1959
+ const kept = list.page?.kept ?? array.length;
1960
+ const originalLength = list.page?.original ?? list.originalLength;
1958
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;
1959
1966
  const offset = typeof pagination.offset === "number" && Number.isFinite(pagination.offset) ? pagination.offset : undefined;
1960
1967
  const hadCursor = typeof pagination.next_cursor === "string" && pagination.next_cursor.length > 0 || typeof pagination.nextCursor === "string" && pagination.nextCursor.length > 0;
1961
1968
  if (typeof pagination.limit === "number") {
1962
1969
  pagination.requested_limit = pagination.limit;
1963
1970
  pagination.limit = kept;
1964
1971
  }
1965
- 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
+ }
1966
1978
  pagination.omitted_for_byte_limit = omitted;
1967
1979
  pagination.has_more = true;
1968
1980
  if ("hasMore" in pagination)
1969
1981
  pagination.hasMore = true;
1970
1982
  if ("nextCursor" in pagination && typeof pagination.nextCursor === "string" && pagination.nextCursor)
1971
1983
  pagination.nextCursor = null;
1972
- const pastOffsetCap = offset !== undefined && offset + kept > MAX_PAGE_OFFSET;
1984
+ const pastOffsetCap = offset !== undefined && offset + step > MAX_PAGE_OFFSET;
1973
1985
  if (offset !== undefined && !pastOffsetCap)
1974
- pagination.next_offset = offset + kept;
1986
+ pagination.next_offset = offset + step;
1975
1987
  if (hadCursor)
1976
1988
  pagination.next_cursor = null;
1977
1989
  const where = `data.${list.path}`;
@@ -1984,12 +1996,15 @@ function rewritePagination(list, isTopLevel, invocation) {
1984
1996
  return { note: `${where} holds ${kept} of ${originalLength} row(s)` };
1985
1997
  }
1986
1998
  if (offset !== undefined) {
1987
- 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);
1988
2003
  return {
1989
- 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}`,
1990
2005
  nextCommand: {
1991
2006
  command,
1992
- 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.`,
1993
2008
  mutability: "read",
1994
2009
  requires_approval: false
1995
2010
  },
@@ -2066,6 +2081,10 @@ function boundForAgent(data, maxBytes = agentMaxOutputBytes(), options = {}) {
2066
2081
  boundedBytes = sizeOf(bounded);
2067
2082
  }
2068
2083
  }
2084
+ const root = asRecord(bounded);
2085
+ if (root && options.invocation && alignPagedLists(root, pagedListsFor(options.invocation), droppedLists, droppedItems)) {
2086
+ boundedBytes = sizeOf(bounded);
2087
+ }
2069
2088
  const dropped = Object.entries(droppedItems);
2070
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. ";
2071
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.";
@@ -2081,7 +2100,6 @@ function boundForAgent(data, maxBytes = agentMaxOutputBytes(), options = {}) {
2081
2100
  fullOutputPath
2082
2101
  };
2083
2102
  }
2084
- const root = asRecord(bounded);
2085
2103
  const notes = [];
2086
2104
  const nextCommands = [];
2087
2105
  const supersededPaging = new Set;
@@ -2129,6 +2147,37 @@ function withoutSupersededPaging(commands, superseded) {
2129
2147
  const flags = superseded.map((flag) => new RegExp(`(^|\\s)--${flag}=`));
2130
2148
  return commands.filter((next) => !flags.some((flag) => flag.test(next.command)));
2131
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
+ }
2132
2181
  function asRecord(value) {
2133
2182
  return value && typeof value === "object" && !Array.isArray(value) ? value : undefined;
2134
2183
  }