@moda-ai/cli 1.55.11 → 1.55.12

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 (29) hide show
  1. package/dist/{agent-n0ch2j90.js → agent-rd9deae9.js} +9 -9
  2. package/dist/{cli-m16taf4z.js → cli-09rr5smg.js} +1 -1
  3. package/dist/{cli-11fevr8y.js → cli-34zdvcpg.js} +5 -5
  4. package/dist/{cli-k5qqj2bp.js → cli-4x9w6ey7.js} +1 -1
  5. package/dist/{cli-fq7kk77e.js → cli-90hb4ng0.js} +8 -8
  6. package/dist/{cli-n9gexgma.js → cli-bfmn3bsk.js} +2 -2
  7. package/dist/{cli-g7ferymy.js → cli-k7vwt56h.js} +3 -3
  8. package/dist/{cli-429zt7g4.js → cli-kwz900s4.js} +95 -21
  9. package/dist/{cli-m857n028.js → cli-m0fa54ny.js} +5 -5
  10. package/dist/{cli-tmqd1f0m.js → cli-ryd7nzke.js} +2 -2
  11. package/dist/{cli-t4jjhn3g.js → cli-ssqb8bfw.js} +1 -1
  12. package/dist/{cli-fwec3m42.js → cli-y8gbbe9k.js} +4 -4
  13. package/dist/cli.js +75 -53
  14. package/dist/{doctor-spvy2zb3.js → doctor-8yb6r66e.js} +9 -9
  15. package/dist/{fix-ax6bbg37.js → fix-bt5zn07e.js} +7 -7
  16. package/dist/{harness-jbqpbp6n.js → harness-9psndqtm.js} +6 -6
  17. package/dist/{harness-github-actions-mtksqp3c.js → harness-github-actions-nph5t2s7.js} +6 -6
  18. package/dist/{index-2d0q94sv.js → index-qjaprhrv.js} +11 -11
  19. package/dist/{production-intelligence-1tf98n79.js → production-intelligence-mg3qp2dg.js} +3 -3
  20. package/dist/{profile-commands-f6599bcx.js → profile-commands-2g5bjzj2.js} +3 -3
  21. package/dist/prompt-source-mcp.js +6 -6
  22. package/dist/{prompts-y3xd9heh.js → prompts-mzazn8ce.js} +7 -7
  23. package/dist/{provision-cjpsswa9.js → provision-rm0yc08f.js} +4 -4
  24. package/dist/{registry-1dvxsekd.js → registry-mbz65bjy.js} +4 -4
  25. package/dist/{skills-1k0hbkaf.js → skills-sagxq9sc.js} +6 -6
  26. package/dist/{sync-by81xqk4.js → sync-gkwexz68.js} +8 -8
  27. package/package.json +1 -1
  28. package/skills/integration/index.json +2 -2
  29. package/skills/moda-cli/SKILL.md +10 -4
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  buildDoctorReport
3
- } from "./cli-11fevr8y.js";
4
- import"./cli-t4jjhn3g.js";
5
- import"./cli-fq7kk77e.js";
3
+ } from "./cli-34zdvcpg.js";
4
+ import"./cli-ssqb8bfw.js";
5
+ import"./cli-90hb4ng0.js";
6
6
  import"./cli-mm48br00.js";
7
7
  import {
8
8
  HARNESS_REPORT_APPROVAL_PATH,
@@ -14,19 +14,19 @@ import {
14
14
  readHarnessSyncState,
15
15
  summarizeHarness,
16
16
  validateHarnessReport
17
- } from "./cli-m857n028.js";
17
+ } from "./cli-m0fa54ny.js";
18
18
  import"./cli-97fnztpy.js";
19
- import"./cli-k5qqj2bp.js";
20
- import"./cli-g7ferymy.js";
21
- import"./cli-tmqd1f0m.js";
22
- import"./cli-m16taf4z.js";
19
+ import"./cli-4x9w6ey7.js";
20
+ import"./cli-k7vwt56h.js";
21
+ import"./cli-ryd7nzke.js";
22
+ import"./cli-09rr5smg.js";
23
23
  import {
24
24
  CliInputError,
25
25
  resolveApiKey,
26
26
  resolveIngestUrl,
27
27
  resolveModaBaseUrl,
28
28
  resolveTenantId
29
- } from "./cli-429zt7g4.js";
29
+ } from "./cli-kwz900s4.js";
30
30
  import"./cli-0v6na3yp.js";
31
31
 
32
32
  // src/agent.ts
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveTenantId
3
- } from "./cli-429zt7g4.js";
3
+ } from "./cli-kwz900s4.js";
4
4
 
5
5
  // src/api-key-headers.ts
6
6
  var PLATFORM_API_KEY_PREFIX = "moda_pk_";
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  isAuthSessionValid,
3
3
  loadAuthSession
4
- } from "./cli-t4jjhn3g.js";
4
+ } from "./cli-ssqb8bfw.js";
5
5
  import {
6
6
  inspectPromptManifest
7
- } from "./cli-fq7kk77e.js";
7
+ } from "./cli-90hb4ng0.js";
8
8
  import {
9
9
  readHarnessSyncState,
10
10
  renderDoctorHuman,
11
11
  renderStatusHuman,
12
12
  scanHarness
13
- } from "./cli-m857n028.js";
13
+ } from "./cli-m0fa54ny.js";
14
14
  import {
15
15
  callDataAPI
16
- } from "./cli-tmqd1f0m.js";
16
+ } from "./cli-ryd7nzke.js";
17
17
  import {
18
18
  ensureSecretFilePermissions,
19
19
  getActiveProfile,
@@ -27,7 +27,7 @@ import {
27
27
  resolveSecretReference,
28
28
  resolveTenantId,
29
29
  secretFilePathFromRef
30
- } from "./cli-429zt7g4.js";
30
+ } from "./cli-kwz900s4.js";
31
31
 
32
32
  // src/doctor.ts
33
33
  import { createHash } from "node:crypto";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createCliOutput,
3
3
  outputModeFromFlags
4
- } from "./cli-429zt7g4.js";
4
+ } from "./cli-kwz900s4.js";
5
5
 
6
6
  // src/command-context.ts
7
7
  function flagEnabled(flags, key) {
@@ -12,28 +12,28 @@ import {
12
12
  require_typescript,
13
13
  resolvePromptSource,
14
14
  safePromptEvidencePath
15
- } from "./cli-m857n028.js";
15
+ } from "./cli-m0fa54ny.js";
16
16
  import {
17
17
  createCommandContext
18
- } from "./cli-k5qqj2bp.js";
18
+ } from "./cli-4x9w6ey7.js";
19
19
  import {
20
20
  assertFlags,
21
21
  assertPositionals
22
- } from "./cli-g7ferymy.js";
22
+ } from "./cli-k7vwt56h.js";
23
23
  import {
24
24
  callControlAPI,
25
25
  callDataAPI
26
- } from "./cli-tmqd1f0m.js";
26
+ } from "./cli-ryd7nzke.js";
27
27
  import {
28
28
  setPlatformTenantOverride
29
- } from "./cli-m16taf4z.js";
29
+ } from "./cli-09rr5smg.js";
30
30
  import {
31
31
  CliInputError,
32
32
  EXIT_ERROR,
33
33
  EXIT_OK,
34
34
  resolveApiTenantId,
35
35
  validateConfig
36
- } from "./cli-429zt7g4.js";
36
+ } from "./cli-kwz900s4.js";
37
37
  import {
38
38
  __commonJS,
39
39
  __require,
@@ -6731,7 +6731,7 @@ async function runPromptSyncExclusive(flags, profileOptions, options) {
6731
6731
  const analyzedDefinitions = new Map;
6732
6732
  if (flags["no-analyze"] !== "true") {
6733
6733
  options.onProgress?.("Analyzing prompt sources before sync.");
6734
- const { analyzeHarnessPrompts } = await import("./harness-jbqpbp6n.js");
6734
+ const { analyzeHarnessPrompts } = await import("./harness-9psndqtm.js");
6735
6735
  const result = await analyzeHarnessPrompts({
6736
6736
  rootDir: process.cwd(),
6737
6737
  existing: established.flatMap((prompt) => prompt.sourceDefinition ? [prompt.sourceDefinition.source] : []),
@@ -7061,7 +7061,7 @@ async function migratePromptManifest(options = {}) {
7061
7061
  let addedSources = [];
7062
7062
  let pendingSources = [];
7063
7063
  if (options.discover) {
7064
- const { analyzeHarnessPrompts } = await import("./harness-jbqpbp6n.js");
7064
+ const { analyzeHarnessPrompts } = await import("./harness-9psndqtm.js");
7065
7065
  const result = await analyzeHarnessPrompts({
7066
7066
  rootDir: root,
7067
7067
  existing: manifest.sources,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  authFetch,
3
3
  getCachedLoginContext
4
- } from "./cli-t4jjhn3g.js";
4
+ } from "./cli-ssqb8bfw.js";
5
5
  import {
6
6
  CliAccessError,
7
7
  CliInputError,
@@ -16,7 +16,7 @@ import {
16
16
  resolveTenantIdFromActiveProfile,
17
17
  saveCliConfig,
18
18
  writeSecretJsonFile
19
- } from "./cli-429zt7g4.js";
19
+ } from "./cli-kwz900s4.js";
20
20
 
21
21
  // src/init/tenant.ts
22
22
  import { randomUUID } from "node:crypto";
@@ -2,18 +2,18 @@ import {
2
2
  ApiError,
3
3
  callControlAPI,
4
4
  callDataAPI
5
- } from "./cli-tmqd1f0m.js";
5
+ } from "./cli-ryd7nzke.js";
6
6
  import {
7
7
  isPlatformApiKey,
8
8
  setPlatformTenantOverride
9
- } from "./cli-m16taf4z.js";
9
+ } from "./cli-09rr5smg.js";
10
10
  import {
11
11
  CliAccessError,
12
12
  CliInputError,
13
13
  embeddedTenantIdFromApiKey,
14
14
  resolveApiKey,
15
15
  resolveApiTenantId
16
- } from "./cli-429zt7g4.js";
16
+ } from "./cli-kwz900s4.js";
17
17
 
18
18
  // src/parity-commands.ts
19
19
  import { readFileSync } from "node:fs";
@@ -576,6 +576,19 @@ class CliAuthError extends Error {
576
576
  usage;
577
577
  }
578
578
 
579
+ class CliNotFoundError extends Error {
580
+ entity;
581
+ id;
582
+ usage;
583
+ constructor(entity, id, message, usage) {
584
+ super(message ?? `No ${entity} found for id "${id}" in this tenant.`);
585
+ this.entity = entity;
586
+ this.id = id;
587
+ this.usage = usage;
588
+ this.name = "CliNotFoundError";
589
+ }
590
+ }
591
+
579
592
  class CliCancellationError extends Error {
580
593
  constructor(message) {
581
594
  super(message);
@@ -588,6 +601,12 @@ function isNetworkLikeError(error) {
588
601
  function isApiLikeError(error) {
589
602
  return error instanceof Error && (error.name === "ApiError" || ("statusCode" in error) && typeof error.statusCode === "number");
590
603
  }
604
+ function apiErrorStatus(error) {
605
+ if (!isApiLikeError(error))
606
+ return;
607
+ const status = error.statusCode;
608
+ return typeof status === "number" ? status : undefined;
609
+ }
591
610
 
592
611
  // src/config.ts
593
612
  import { readFileSync as readFileSync2 } from "node:fs";
@@ -640,9 +659,9 @@ function resolveModaBaseUrl(options = {}) {
640
659
  }
641
660
  function validateConfig() {
642
661
  if (!resolveApiKey()) {
643
- throw new CliAuthError('No Moda API key found. Set MODA_API_KEY or run "moda init".', {
662
+ throw new CliAuthError('No Moda API key found. Set MODA_API_KEY=moda_sk_... in the environment, save one with "moda auth login --api-key", or run "moda init" for interactive setup.', {
644
663
  reason: "no_stored_credentials",
645
- login_command: ["moda", "init"]
664
+ login_command: ["moda", "auth", "login", "--api-key"]
646
665
  }, "Get your API key from https://moda.dev/settings");
647
666
  }
648
667
  }
@@ -1004,9 +1023,16 @@ import { randomUUID } from "node:crypto";
1004
1023
  import { lstatSync, mkdirSync as mkdirSync2, readdirSync, unlinkSync, writeFileSync as writeFileSync2 } from "node:fs";
1005
1024
  import { tmpdir } from "node:os";
1006
1025
  import { join as join2 } from "node:path";
1026
+ var agentUpdateNotice;
1027
+ function setAgentUpdateNotice(notice) {
1028
+ agentUpdateNotice = notice;
1029
+ }
1030
+ function resolveAgentUpdateNotice() {
1031
+ return typeof agentUpdateNotice === "function" ? agentUpdateNotice() : agentUpdateNotice;
1032
+ }
1007
1033
  var AGENT_SCHEMA_VERSION = "moda.agent.v1";
1008
1034
  var AGENT_EVENT_SCHEMA_VERSION = "moda.agent_event.v1";
1009
- var FEEDBACK_TIP = 'Help us improve! If a result in this response looks wrong or is missing data, flag it: moda feedback "<describe what looked wrong>" [--category=...] [--conversation-id=... | --cluster-id=... | --tool-name=...]. Only submit genuine observations.';
1035
+ var FEEDBACK_TIP = 'If a result looks wrong or is missing data: moda feedback "<what looked wrong>"';
1010
1036
  var EXIT_OK = 0;
1011
1037
  var EXIT_ERROR = 1;
1012
1038
  var EXIT_DEGRADED = 3;
@@ -1024,7 +1050,8 @@ var AGENT_ERROR_CODES = [
1024
1050
  "access_denied",
1025
1051
  "unknown_error",
1026
1052
  "cloud_unavailable",
1027
- "output_error"
1053
+ "output_error",
1054
+ "not_found"
1028
1055
  ];
1029
1056
  var FALLBACK_RUN_ID = randomUUID();
1030
1057
  var fallbackSeq = 0;
@@ -1139,8 +1166,10 @@ function createCliOutput(options) {
1139
1166
  startedAt: Date.now(),
1140
1167
  lastEventAt: Date.now()
1141
1168
  };
1142
- const emitEvent = (event) => {
1143
- if (options.quiet || options.mode !== "agent-stream")
1169
+ const emitEvent = (event, { bypassQuiet = false } = {}) => {
1170
+ if (options.mode !== "agent-stream")
1171
+ return;
1172
+ if (options.quiet && !bypassQuiet)
1144
1173
  return;
1145
1174
  if (state.terminal)
1146
1175
  return;
@@ -1156,16 +1185,19 @@ function createCliOutput(options) {
1156
1185
  safeWriteStdout(`${JSON.stringify(createAgentEvent(options.command, event, state))}
1157
1186
  `);
1158
1187
  };
1159
- const ensureStarted = () => {
1160
- if (options.mode !== "agent-stream" || state.started || options.quiet)
1188
+ const ensureStarted = ({ bypassQuiet = false } = {}) => {
1189
+ if (options.mode !== "agent-stream" || state.started)
1190
+ return;
1191
+ if (options.quiet && !bypassQuiet)
1161
1192
  return;
1162
- startHeartbeat(options.command, state);
1193
+ if (!options.quiet)
1194
+ startHeartbeat(options.command, state);
1163
1195
  emitEvent({
1164
1196
  event: "started",
1165
1197
  phase: options.command,
1166
1198
  message: `Starting ${options.command}.`,
1167
1199
  elapsed_ms: 0
1168
- });
1200
+ }, { bypassQuiet });
1169
1201
  };
1170
1202
  const writeEnvelope = (data, writeOptions = {}) => {
1171
1203
  return createAgentEnvelope({
@@ -1175,7 +1207,8 @@ function createCliOutput(options) {
1175
1207
  meta: {
1176
1208
  ...writeOptions.meta ?? {},
1177
1209
  run_id: state.runId,
1178
- ...options.command === "feedback" ? {} : { tip: FEEDBACK_TIP }
1210
+ ...options.command === "feedback" ? {} : { tip: FEEDBACK_TIP },
1211
+ ...((update) => update ? { update } : {})(resolveAgentUpdateNotice())
1179
1212
  },
1180
1213
  summary: writeOptions.summary,
1181
1214
  findings: writeOptions.findings,
@@ -1235,12 +1268,12 @@ function createCliOutput(options) {
1235
1268
  emitEvent(event);
1236
1269
  },
1237
1270
  writeError(error) {
1238
- if (options.quiet || state.terminal)
1271
+ if (state.terminal)
1239
1272
  return;
1240
1273
  const agentError = errorToAgentError(error);
1241
1274
  const envelope = createAgentErrorEnvelope(options.command || "unknown", agentError, state.runId, errorWarnings(error));
1242
1275
  if (options.mode === "agent-stream") {
1243
- ensureStarted();
1276
+ ensureStarted({ bypassQuiet: true });
1244
1277
  if (error instanceof CliInputRequiredError) {
1245
1278
  emitEvent({
1246
1279
  event: "needs_input",
@@ -1249,18 +1282,18 @@ function createCliOutput(options) {
1249
1282
  error: agentError,
1250
1283
  input_request: error.input_request,
1251
1284
  result: envelope
1252
- });
1285
+ }, { bypassQuiet: true });
1253
1286
  return;
1254
1287
  }
1255
- if (error instanceof CliAuthError) {
1288
+ if (error instanceof CliAuthError || agentError.code === "auth_required") {
1256
1289
  emitEvent({
1257
1290
  event: "auth_required",
1258
1291
  status: "error",
1259
- message: error.message,
1292
+ message: agentError.message,
1260
1293
  error: agentError,
1261
- auth: error.auth,
1294
+ auth: error instanceof CliAuthError ? error.auth : agentError.auth,
1262
1295
  result: envelope
1263
- });
1296
+ }, { bypassQuiet: true });
1264
1297
  return;
1265
1298
  }
1266
1299
  if (error instanceof CliCancellationError) {
@@ -1270,7 +1303,7 @@ function createCliOutput(options) {
1270
1303
  message: error.message,
1271
1304
  error: agentError,
1272
1305
  result: envelope
1273
- });
1306
+ }, { bypassQuiet: true });
1274
1307
  return;
1275
1308
  }
1276
1309
  emitEvent({
@@ -1279,7 +1312,7 @@ function createCliOutput(options) {
1279
1312
  message: agentError.message,
1280
1313
  error: agentError,
1281
1314
  result: envelope
1282
- });
1315
+ }, { bypassQuiet: true });
1283
1316
  return;
1284
1317
  }
1285
1318
  if (options.mode === "agent" || options.mode === "json") {
@@ -1549,6 +1582,20 @@ function formatValidationMessage(error) {
1549
1582
  });
1550
1583
  return `Validation error — ${[...new Set(parts)].join("; ")}`;
1551
1584
  }
1585
+ var API_KEY_RECOVERY = "Set MODA_API_KEY=moda_sk_... in the environment, or save one with `moda auth login --api-key` (reads MODA_API_KEY or --api-key-stdin). Keys: https://moda.dev/settings";
1586
+ function serverErrorMessage(error) {
1587
+ const body = error.responseBody;
1588
+ if (typeof body !== "string" || !body.trimStart().startsWith("{"))
1589
+ return;
1590
+ try {
1591
+ const message = JSON.parse(body).message;
1592
+ if (typeof message === "string" && message.trim())
1593
+ return message.trim().replace(/\.$/, "");
1594
+ if (Array.isArray(message))
1595
+ return message.filter((m) => typeof m === "string").join("; ") || undefined;
1596
+ } catch {}
1597
+ return;
1598
+ }
1552
1599
  function errorToAgentError(error) {
1553
1600
  if (error instanceof CliInputRequiredError) {
1554
1601
  return {
@@ -1580,6 +1627,15 @@ function errorToAgentError(error) {
1580
1627
  blocking: true
1581
1628
  };
1582
1629
  }
1630
+ if (error instanceof CliNotFoundError) {
1631
+ return {
1632
+ code: "not_found",
1633
+ message: error.message,
1634
+ cause: error.usage,
1635
+ suggested_commands: error.usage ? extractSuggestedCommands(error.usage) : undefined,
1636
+ blocking: true
1637
+ };
1638
+ }
1583
1639
  if (error instanceof CliAccessError) {
1584
1640
  return {
1585
1641
  code: "access_denied",
@@ -1598,6 +1654,24 @@ function errorToAgentError(error) {
1598
1654
  blocking: true
1599
1655
  };
1600
1656
  }
1657
+ if (apiErrorStatus(error) === 401) {
1658
+ return {
1659
+ code: "auth_required",
1660
+ message: "The Moda API rejected the API key (HTTP 401): it is invalid, revoked, or for another environment.",
1661
+ cause: API_KEY_RECOVERY,
1662
+ suggested_commands: ["moda auth login --api-key", "moda auth status --online"],
1663
+ auth: { reason: "api_key_rejected", login_command: ["moda", "auth", "login", "--api-key"] },
1664
+ blocking: true
1665
+ };
1666
+ }
1667
+ if (apiErrorStatus(error) === 403) {
1668
+ return {
1669
+ code: "access_denied",
1670
+ message: `The Moda API refused this request (HTTP 403): ${serverErrorMessage(error) ?? "the API key does not allow it"}.`,
1671
+ cause: "Read-only keys cannot run writes, and organization keys cannot select another tenant. Use a key with the needed access.",
1672
+ blocking: true
1673
+ };
1674
+ }
1601
1675
  if (isApiLikeError(error)) {
1602
1676
  const statusCode = "statusCode" in error ? error.statusCode : undefined;
1603
1677
  const typedCode = "code" in error && typeof error.code === "string" ? error.code : undefined;
@@ -1871,4 +1945,4 @@ function extractSuggestedCommands(text) {
1871
1945
  return commands.length > 0 ? commands : undefined;
1872
1946
  }
1873
1947
 
1874
- export { PROD_BASE_URL, DEFAULT_INGEST_URL, getModaPaths, getModaDir, isLoopbackBaseUrl, describeBaseUrlSource, loadProfileConfig, saveProfileConfig, getActiveProfile, setActiveProfile, upsertProfile, clearStoredApiKeyCredentials, secretFilePathFromRef, resolveSecretReference, resolveApiKeyFromActiveProfile, resolveTenantIdFromActiveProfile, ensureSecretFilePermissions, writeSecretJsonFile, CliInputError, CliAccessError, CliInputRequiredError, CliAuthError, CliCancellationError, isNetworkLikeError, isApiLikeError, VERSION, MODA_BASE_URL, loadCliConfig, saveCliConfig, resolveApiKey, embeddedTenantIdFromApiKey, resolveIngestUrl2 as resolveIngestUrl, resolveTenantId, resolveApiTenantId, resolveModaBaseUrl, validateConfig, recordApiRequest, getApiRequestCount, resetApiRequestCount, MAX_SCANNED_FILE_BYTES, DEFAULT_MAX_INVENTORY_FILES, DEFAULT_MAX_INVENTORY_TEXT_BYTES, MAX_RECORDED_SKIPS, SKIPPED_DIRS, isSkippedDir, isSkippedPathPrefix, isEvalLikePath, shouldInventoryFile, isTextFile, isSecretishPath, SECRET_KEYS, redactDeep, redactString, packSnapshot, EXIT_OK, EXIT_ERROR, EXIT_DEGRADED, EXIT_AUTH_REQUIRED, EXIT_INPUT_REQUIRED, EXIT_CANCELLED, AGENT_ERROR_CODES, wasOutputCancelled, safeWriteStdout, safeWriteStderr, explicitOutputMode, outputModeFromFlags, resolveOutputMode, createCliOutput, agentEnvelopeFits, agentMaxOutputBytes };
1948
+ export { PROD_BASE_URL, DEFAULT_INGEST_URL, getModaPaths, getModaDir, isLoopbackBaseUrl, describeBaseUrlSource, loadProfileConfig, saveProfileConfig, getActiveProfile, setActiveProfile, upsertProfile, clearStoredApiKeyCredentials, secretFilePathFromRef, resolveSecretReference, resolveApiKeyFromActiveProfile, resolveTenantIdFromActiveProfile, ensureSecretFilePermissions, writeSecretJsonFile, CliInputError, CliAccessError, CliInputRequiredError, CliAuthError, CliNotFoundError, CliCancellationError, isNetworkLikeError, isApiLikeError, apiErrorStatus, VERSION, MODA_BASE_URL, loadCliConfig, saveCliConfig, resolveApiKey, embeddedTenantIdFromApiKey, resolveIngestUrl2 as resolveIngestUrl, resolveTenantId, resolveApiTenantId, resolveModaBaseUrl, validateConfig, recordApiRequest, getApiRequestCount, resetApiRequestCount, MAX_SCANNED_FILE_BYTES, DEFAULT_MAX_INVENTORY_FILES, DEFAULT_MAX_INVENTORY_TEXT_BYTES, MAX_RECORDED_SKIPS, SKIPPED_DIRS, isSkippedDir, isSkippedPathPrefix, isEvalLikePath, shouldInventoryFile, isTextFile, isSecretishPath, SECRET_KEYS, redactDeep, redactString, packSnapshot, setAgentUpdateNotice, EXIT_OK, EXIT_ERROR, EXIT_DEGRADED, EXIT_AUTH_REQUIRED, EXIT_INPUT_REQUIRED, EXIT_CANCELLED, AGENT_ERROR_CODES, wasOutputCancelled, safeWriteStdout, safeWriteStderr, explicitOutputMode, outputModeFromFlags, resolveOutputMode, createCliOutput, agentEnvelopeFits, agentMaxOutputBytes };
@@ -4,16 +4,16 @@ import {
4
4
  import {
5
5
  createCommandContext,
6
6
  stringOption
7
- } from "./cli-k5qqj2bp.js";
7
+ } from "./cli-4x9w6ey7.js";
8
8
  import {
9
9
  assertFlags,
10
10
  assertPositionals,
11
11
  requireTenant
12
- } from "./cli-g7ferymy.js";
12
+ } from "./cli-k7vwt56h.js";
13
13
  import {
14
14
  ApiError,
15
15
  callControlAPI
16
- } from "./cli-tmqd1f0m.js";
16
+ } from "./cli-ryd7nzke.js";
17
17
  import {
18
18
  CliInputError,
19
19
  CliInputRequiredError,
@@ -39,7 +39,7 @@ import {
39
39
  resolveModaBaseUrl,
40
40
  resolveTenantId,
41
41
  shouldInventoryFile
42
- } from "./cli-429zt7g4.js";
42
+ } from "./cli-kwz900s4.js";
43
43
  import {
44
44
  __commonJS,
45
45
  __require,
@@ -193996,7 +193996,7 @@ async function runHarnessCommand(context) {
193996
193996
  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.");
193997
193997
  }
193998
193998
  if (context.flags["github-actions"] === "true") {
193999
- const { runGithubActionsAnalyze } = await import("./harness-github-actions-mtksqp3c.js");
193999
+ const { runGithubActionsAnalyze } = await import("./harness-github-actions-nph5t2s7.js");
194000
194000
  const result = await runGithubActionsAnalyze(rootDir, {
194001
194001
  writeReport: (report2) => {
194002
194002
  const normalized = normalizeHarnessReport(report2);
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  apiKeyHeaders
3
- } from "./cli-m16taf4z.js";
3
+ } from "./cli-09rr5smg.js";
4
4
  import {
5
5
  recordApiRequest,
6
6
  resolveApiKey,
7
7
  resolveModaBaseUrl
8
- } from "./cli-429zt7g4.js";
8
+ } from "./cli-kwz900s4.js";
9
9
 
10
10
  // src/api-client.ts
11
11
  var REQUEST_TIMEOUT_MS = 30000;
@@ -8,7 +8,7 @@ import {
8
8
  saveProfileConfig,
9
9
  secretFilePathFromRef,
10
10
  writeSecretJsonFile
11
- } from "./cli-429zt7g4.js";
11
+ } from "./cli-kwz900s4.js";
12
12
  import {
13
13
  __require
14
14
  } from "./cli-0v6na3yp.js";
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  createCommandContext
3
- } from "./cli-k5qqj2bp.js";
3
+ } from "./cli-4x9w6ey7.js";
4
4
  import {
5
5
  assertFlags,
6
6
  assertPositionals
7
- } from "./cli-g7ferymy.js";
7
+ } from "./cli-k7vwt56h.js";
8
8
  import {
9
9
  callControlAPI
10
- } from "./cli-tmqd1f0m.js";
10
+ } from "./cli-ryd7nzke.js";
11
11
  import {
12
12
  CliInputError,
13
13
  recordApiRequest,
14
14
  resolveApiKey,
15
15
  resolveIngestUrl,
16
16
  resolveTenantId
17
- } from "./cli-429zt7g4.js";
17
+ } from "./cli-kwz900s4.js";
18
18
  import {
19
19
  SKILL_SOURCE_HARNESS,
20
20
  SKILL_SOURCE_INTEGRATION_BUNDLED,
package/dist/cli.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  import {
14
14
  createCommandContext,
15
15
  parseBooleanFlagValue
16
- } from "./cli-k5qqj2bp.js";
16
+ } from "./cli-4x9w6ey7.js";
17
17
  import {
18
18
  SIGNALS_MANAGEMENT_SUBCOMMANDS,
19
19
  assertFlags,
@@ -23,17 +23,17 @@ import {
23
23
  runUserCommand,
24
24
  runUsersCommand,
25
25
  unknownSignalsSubcommandError
26
- } from "./cli-g7ferymy.js";
26
+ } from "./cli-k7vwt56h.js";
27
27
  import {
28
28
  ApiError,
29
29
  callControlAPI,
30
30
  callDataAPI
31
- } from "./cli-tmqd1f0m.js";
31
+ } from "./cli-ryd7nzke.js";
32
32
  import {
33
33
  apiKeyHeaders,
34
34
  isPlatformApiKey,
35
35
  setPlatformTenantOverride
36
- } from "./cli-m16taf4z.js";
36
+ } from "./cli-09rr5smg.js";
37
37
  import {
38
38
  AGENT_ERROR_CODES,
39
39
  CliAccessError,
@@ -41,6 +41,7 @@ import {
41
41
  CliCancellationError,
42
42
  CliInputError,
43
43
  CliInputRequiredError,
44
+ CliNotFoundError,
44
45
  EXIT_AUTH_REQUIRED,
45
46
  EXIT_CANCELLED,
46
47
  EXIT_DEGRADED,
@@ -51,6 +52,7 @@ import {
51
52
  VERSION,
52
53
  agentEnvelopeFits,
53
54
  agentMaxOutputBytes,
55
+ apiErrorStatus,
54
56
  createCliOutput,
55
57
  embeddedTenantIdFromApiKey,
56
58
  getApiRequestCount,
@@ -65,9 +67,10 @@ import {
65
67
  resolveOutputMode,
66
68
  safeWriteStderr,
67
69
  safeWriteStdout,
70
+ setAgentUpdateNotice,
68
71
  validateConfig,
69
72
  wasOutputCancelled
70
- } from "./cli-429zt7g4.js";
73
+ } from "./cli-kwz900s4.js";
71
74
  import {
72
75
  __require
73
76
  } from "./cli-0v6na3yp.js";
@@ -897,6 +900,10 @@ async function startUpdateCheck(options = {}, now = Date.now()) {
897
900
  clearTimeout(timeout);
898
901
  }
899
902
  }
903
+ function getAvailableUpdate(options = {}) {
904
+ const cache = readCache(options);
905
+ return cache && isNewerVersion(cache.latest, VERSION) ? cache.latest : undefined;
906
+ }
900
907
  function getUpdateNotice(options = {}) {
901
908
  const cache = readCache(options);
902
909
  if (!cache || !isNewerVersion(cache.latest, VERSION)) {
@@ -1660,7 +1667,7 @@ var agentAuthSchema = {
1660
1667
  properties: {
1661
1668
  reason: {
1662
1669
  type: "string",
1663
- enum: ["no_stored_credentials", "token_expired", "token_revoked", "renew_failed"]
1670
+ enum: ["no_stored_credentials", "token_expired", "token_revoked", "renew_failed", "api_key_rejected"]
1664
1671
  },
1665
1672
  login_command: { type: "array", items: { type: "string" } },
1666
1673
  resume_command: { type: "array", items: { type: "string" } }
@@ -1934,6 +1941,8 @@ async function finishRun(context, outcome) {
1934
1941
  function exitCodeForError(error) {
1935
1942
  if (error instanceof CliAuthError)
1936
1943
  return EXIT_AUTH_REQUIRED;
1944
+ if (apiErrorStatus(error) === 401)
1945
+ return EXIT_AUTH_REQUIRED;
1937
1946
  if (error instanceof CliInputRequiredError)
1938
1947
  return EXIT_INPUT_REQUIRED;
1939
1948
  if (error instanceof CliCancellationError)
@@ -2072,46 +2081,46 @@ function exitCodesForCommand(command) {
2072
2081
  import { fileURLToPath } from "url";
2073
2082
  import { realpathSync } from "fs";
2074
2083
  async function runPromptsCommand(...args) {
2075
- return (await import("./prompts-y3xd9heh.js")).runPromptsCommand(...args);
2084
+ return (await import("./prompts-mzazn8ce.js")).runPromptsCommand(...args);
2076
2085
  }
2077
2086
  async function runSkillsCommand(...args) {
2078
- return (await import("./skills-1k0hbkaf.js")).runSkillsCommand(...args);
2087
+ return (await import("./skills-sagxq9sc.js")).runSkillsCommand(...args);
2079
2088
  }
2080
2089
  async function runFixCommand(...args) {
2081
- return (await import("./fix-ax6bbg37.js")).runFixCommand(...args);
2090
+ return (await import("./fix-bt5zn07e.js")).runFixCommand(...args);
2082
2091
  }
2083
2092
  async function runFixesCommand(...args) {
2084
- return (await import("./fix-ax6bbg37.js")).runFixesCommand(...args);
2093
+ return (await import("./fix-bt5zn07e.js")).runFixesCommand(...args);
2085
2094
  }
2086
2095
  async function runHarnessCommand(...args) {
2087
- return (await import("./harness-jbqpbp6n.js")).runHarnessCommand(...args);
2096
+ return (await import("./harness-9psndqtm.js")).runHarnessCommand(...args);
2088
2097
  }
2089
2098
  async function runSyncCommand(...args) {
2090
- return (await import("./sync-by81xqk4.js")).runSyncCommand(...args);
2099
+ return (await import("./sync-gkwexz68.js")).runSyncCommand(...args);
2091
2100
  }
2092
2101
  async function runRegistryCommand(...args) {
2093
- return (await import("./registry-1dvxsekd.js")).runRegistryCommand(...args);
2102
+ return (await import("./registry-mbz65bjy.js")).runRegistryCommand(...args);
2094
2103
  }
2095
2104
  async function runDoctorCommand(...args) {
2096
- return (await import("./doctor-spvy2zb3.js")).runDoctorCommand(...args);
2105
+ return (await import("./doctor-8yb6r66e.js")).runDoctorCommand(...args);
2097
2106
  }
2098
2107
  async function runStatusCommand(...args) {
2099
- return (await import("./doctor-spvy2zb3.js")).runStatusCommand(...args);
2108
+ return (await import("./doctor-8yb6r66e.js")).runStatusCommand(...args);
2100
2109
  }
2101
2110
  async function runAuthCommand(...args) {
2102
- return (await import("./profile-commands-f6599bcx.js")).runAuthCommand(...args);
2111
+ return (await import("./profile-commands-2g5bjzj2.js")).runAuthCommand(...args);
2103
2112
  }
2104
2113
  async function runConfigCommand(...args) {
2105
- return (await import("./profile-commands-f6599bcx.js")).runConfigCommand(...args);
2114
+ return (await import("./profile-commands-2g5bjzj2.js")).runConfigCommand(...args);
2106
2115
  }
2107
2116
  async function runProfilesCommand(...args) {
2108
- return (await import("./profile-commands-f6599bcx.js")).runProfilesCommand(...args);
2117
+ return (await import("./profile-commands-2g5bjzj2.js")).runProfilesCommand(...args);
2109
2118
  }
2110
2119
  async function runAgentCommand(...args) {
2111
- return (await import("./agent-n0ch2j90.js")).runAgentCommand(...args);
2120
+ return (await import("./agent-rd9deae9.js")).runAgentCommand(...args);
2112
2121
  }
2113
2122
  async function runProductionCommand(...args) {
2114
- return (await import("./production-intelligence-1tf98n79.js")).runProductionCommand(...args);
2123
+ return (await import("./production-intelligence-mg3qp2dg.js")).runProductionCommand(...args);
2115
2124
  }
2116
2125
  function parseArgs(argv) {
2117
2126
  const args = argv.slice(2);
@@ -2455,7 +2464,8 @@ Output auto-detection (no flags needed):
2455
2464
  Piped/redirected stdout, CI, or an agent env (CLAUDECODE/CURSOR/MODA_AGENT)
2456
2465
  => schema-versioned agent JSON. An interactive terminal => human prose.
2457
2466
  Override with the flags above or MODA_FORMAT=human|json|agent|agent-stream.
2458
- Exit codes: 0 ok, 3 degraded (local fallback), 1 error.
2467
+ Exit codes: 0 ok, 1 error (errors[0].code says which, e.g. not_found), 3 degraded (local fallback),
2468
+ 4 auth required (no key or key rejected), 5 input required, 130 cancelled.
2459
2469
  --dry-run Show the planned mutation when supported
2460
2470
  --yes Accept explicit automation defaults
2461
2471
  --tui Force the human analyst dashboard when supported
@@ -2800,12 +2810,24 @@ async function printWithOptionalWindows(enriched, listKey, includeWindow, window
2800
2810
  data = finalize(data, allWarnings);
2801
2811
  output.writeData(data, allWarnings.length > 0 ? { warnings: allWarnings } : undefined);
2802
2812
  }
2803
- function notFoundWarning(entity, id, isMissing) {
2813
+ var NOT_FOUND_HINTS = {
2814
+ trace: 'Find trace ids with: moda search "<text>" or moda traces --search=<text>',
2815
+ cluster: "List cluster node ids with: moda clusters",
2816
+ problem: "List problem ids with: moda problems"
2817
+ };
2818
+ function throwIfNotFound(entity, id, isMissing, message) {
2804
2819
  if (!isMissing)
2805
- return [];
2806
- return [
2807
- `No ${entity} found for id "${id}" — it may not exist in this tenant (the Data API returns an empty result rather than an error for unknown ids).`
2808
- ];
2820
+ return;
2821
+ throw new CliNotFoundError(entity, id, message, NOT_FOUND_HINTS[entity]);
2822
+ }
2823
+ function noWorldStateWarnings(conversationId, isMissing) {
2824
+ if (!isMissing)
2825
+ return;
2826
+ return {
2827
+ warnings: [
2828
+ `No world state for trace "${conversationId}": the trace may not exist in this tenant, or its world state has not been generated yet. Check the trace exists with: moda context ${conversationId} --metadata-only`
2829
+ ]
2830
+ };
2809
2831
  }
2810
2832
  var AUDIT_DEFAULT_LIMIT = 200;
2811
2833
  var AUDIT_MAX_LIMIT = 1000;
@@ -3657,6 +3679,7 @@ async function readFullTranscript(conversationId, opts = {}) {
3657
3679
  nextFrom = end < total && messages.length > 0 ? end : null;
3658
3680
  warnings.push(`This Moda server has no range reads for context (older backend), so --all fell back to windowed paging and stopped at ${LEGACY_WINDOW_MAX_MESSAGES} messages to keep it cheap.`);
3659
3681
  }
3682
+ throwIfNotFound("trace", conversationId, total === 0);
3660
3683
  const pageSize = legacy ? LEGACY_WINDOW_MAX_MESSAGES : requested;
3661
3684
  const tied = asNumber(ordering?.tied_timestamp_messages) ?? 0;
3662
3685
  const synthetic = asNumber(ordering?.synthetic_timestamp_messages) ?? 0;
@@ -3671,7 +3694,7 @@ async function readFullTranscript(conversationId, opts = {}) {
3671
3694
  };
3672
3695
  const build = (kept) => {
3673
3696
  const returned = messages.slice(0, kept);
3674
- const out = [...notFoundWarning("trace", conversationId, total === 0), ...warnings];
3697
+ const out = [...warnings];
3675
3698
  if (total > 0 && start >= total) {
3676
3699
  out.push(`--from=${start} is past the end of this trace (${total} messages, indexes 0-${total - 1}).`);
3677
3700
  }
@@ -3758,7 +3781,7 @@ async function runCommand(command, positional, flags, positionals = positional ?
3758
3781
  const data2 = await callDataAPI(`/task-clusters/search?${query3.toString()}`);
3759
3782
  const record = asRecord(data2) ?? {};
3760
3783
  const matches = Array.isArray(record.matches) ? record.matches : [];
3761
- const warnings = params.node_id !== undefined && matches.length === 0 ? notFoundWarning("cluster", params.node_id, true) : [];
3784
+ const warnings = params.node_id !== undefined && matches.length === 0 ? [`No cluster matched node id "${params.node_id}" for this search. ${NOT_FOUND_HINTS.cluster}`] : [];
3762
3785
  context.output.writeData(data2, warnings.length > 0 ? { warnings } : undefined);
3763
3786
  break;
3764
3787
  }
@@ -3785,10 +3808,10 @@ async function runCommand(command, positional, flags, positionals = positional ?
3785
3808
  if (params.offset !== undefined)
3786
3809
  query2.set("offset", params.offset.toString());
3787
3810
  const queryString = query2.toString() ? `?${query2.toString()}` : "";
3788
- const data = await callDataAPI(`/clusters/${params.node_id}/conversations${queryString}`);
3811
+ const data = await callDataAPI(`/clusters/${encodeURIComponent(params.node_id)}/conversations${queryString}`);
3789
3812
  const clusterRecord = asRecord(data) ?? {};
3790
- const warnings = notFoundWarning("cluster", params.node_id, clusterRecord.cluster === null || clusterRecord.cluster === undefined);
3791
- context.output.writeData(data, warnings.length > 0 ? { warnings } : undefined);
3813
+ throwIfNotFound("cluster", params.node_id, clusterRecord.cluster === null || clusterRecord.cluster === undefined);
3814
+ context.output.writeData(data);
3792
3815
  break;
3793
3816
  }
3794
3817
  case "traces":
@@ -3922,10 +3945,9 @@ async function runCommand(command, positional, flags, positionals = positional ?
3922
3945
  query3.set("block_index", params.block_index.toString());
3923
3946
  if (params.segment_index !== undefined)
3924
3947
  query3.set("segment_index", params.segment_index.toString());
3925
- const data2 = await callDataAPI(`/conversations/${params.conversation_id}/world-state/snapshot?${query3.toString()}`);
3948
+ const data2 = await callDataAPI(`/conversations/${encodeURIComponent(params.conversation_id)}/world-state/snapshot?${query3.toString()}`);
3926
3949
  const snapshotRecord = asRecord(data2) ?? {};
3927
- const warnings2 = notFoundWarning("world state", params.conversation_id, snapshotRecord.found === false);
3928
- context.output.writeData(data2, warnings2.length > 0 ? { warnings: warnings2 } : undefined);
3950
+ context.output.writeData(data2, noWorldStateWarnings(params.conversation_id, snapshotRecord.found === false));
3929
3951
  break;
3930
3952
  }
3931
3953
  if (params.replay === true) {
@@ -3937,10 +3959,9 @@ async function runCommand(command, positional, flags, positionals = positional ?
3937
3959
  query3.set("format", format === "fold-inputs" ? "fold_inputs" : "frames");
3938
3960
  if (params.message_count !== undefined)
3939
3961
  query3.set("message_count", params.message_count.toString());
3940
- const data2 = await callDataAPI(`/conversations/${params.conversation_id}/world-state/replay?${query3.toString()}`);
3962
+ const data2 = await callDataAPI(`/conversations/${encodeURIComponent(params.conversation_id)}/world-state/replay?${query3.toString()}`);
3941
3963
  const replayRecord = asRecord(data2) ?? {};
3942
- const warnings2 = notFoundWarning("world state", params.conversation_id, replayRecord.hasData === false);
3943
- context.output.writeData(data2, warnings2.length > 0 ? { warnings: warnings2 } : undefined);
3964
+ context.output.writeData(data2, noWorldStateWarnings(params.conversation_id, replayRecord.hasData === false));
3944
3965
  break;
3945
3966
  }
3946
3967
  const query2 = new URLSearchParams;
@@ -3949,10 +3970,9 @@ async function runCommand(command, positional, flags, positionals = positional ?
3949
3970
  if (params.event_limit)
3950
3971
  query2.set("event_limit", params.event_limit.toString());
3951
3972
  const queryString = query2.toString() ? `?${query2.toString()}` : "";
3952
- const data = await callDataAPI(`/conversations/${params.conversation_id}/world-state${queryString}`);
3973
+ const data = await callDataAPI(`/conversations/${encodeURIComponent(params.conversation_id)}/world-state${queryString}`);
3953
3974
  const wsRecord = asRecord(data) ?? {};
3954
- const warnings = notFoundWarning("world state", params.conversation_id, wsRecord.hasData === false);
3955
- context.output.writeData(data, warnings.length > 0 ? { warnings } : undefined);
3975
+ context.output.writeData(data, noWorldStateWarnings(params.conversation_id, wsRecord.hasData === false));
3956
3976
  break;
3957
3977
  }
3958
3978
  case "context": {
@@ -3983,10 +4003,8 @@ async function runCommand(command, positional, flags, positionals = positional ?
3983
4003
  const contextPath = `/conversations/${encodeURIComponent(params.conversation_id)}/context`;
3984
4004
  const data = params.metadata_only === true ? await readContextMetadataOnly(contextPath, query2) : await callDataAPI(`${contextPath}${queryString}`);
3985
4005
  const ctxRecord = asRecord(data) ?? {};
3986
- const warnings = [
3987
- ...inputWarnings,
3988
- ...notFoundWarning("trace", params.conversation_id, asNumber(ctxRecord.total_messages) === 0)
3989
- ];
4006
+ throwIfNotFound("trace", params.conversation_id, asNumber(ctxRecord.total_messages) === 0);
4007
+ const warnings = [...inputWarnings];
3990
4008
  const nextCommands = [];
3991
4009
  if (params.window !== undefined && params.window > CONTEXT_MAX_WINDOW) {
3992
4010
  const center = asNumber(asRecord(ctxRecord.context)?.center_index) ?? params.msg_index ?? 0;
@@ -4089,7 +4107,7 @@ async function runCommand(command, positional, flags, positionals = positional ?
4089
4107
  if (params.offset !== undefined)
4090
4108
  query2.set("offset", params.offset.toString());
4091
4109
  const queryString = query2.toString() ? `?${query2.toString()}` : "";
4092
- const data = await callDataAPI(`/tool-failures/${params.tool_name}${queryString}`);
4110
+ const data = await callDataAPI(`/tool-failures/${encodeURIComponent(params.tool_name)}${queryString}`);
4093
4111
  const tfRecord = asRecord(data) ?? {};
4094
4112
  const subtypeCount = Array.isArray(tfRecord.subtypes) ? tfRecord.subtypes.length : 0;
4095
4113
  const exampleCount = Array.isArray(tfRecord.examples) ? tfRecord.examples.length : 0;
@@ -4193,10 +4211,8 @@ async function runCommand(command, positional, flags, positionals = positional ?
4193
4211
  if (view === undefined) {
4194
4212
  const data2 = await callDataAPI(`/problems/${encodeURIComponent(params.id)}`);
4195
4213
  const record = asRecord(data2) ?? {};
4196
- const warnings = record.found === false ? [
4197
- `No problem found for id "${params.id}" — it may not exist in this tenant, or may have been merged away (the API returns found:false rather than an error).`
4198
- ] : [];
4199
- context.output.writeData(data2, warnings.length > 0 ? { warnings } : undefined);
4214
+ throwIfNotFound("problem", params.id, record.found === false, `No problem found for id "${params.id}" in this tenant; it may have been merged into another problem.`);
4215
+ context.output.writeData(data2);
4200
4216
  break;
4201
4217
  }
4202
4218
  if (!UUID_RE.test(params.id)) {
@@ -4215,7 +4231,7 @@ async function runCommand(command, positional, flags, positionals = positional ?
4215
4231
  query2.set("door", params.door);
4216
4232
  }
4217
4233
  const queryString = query2.toString() ? `?${query2.toString()}` : "";
4218
- const data = await callDataAPI(`/problems/${params.id}/${view}${queryString}`);
4234
+ const data = await callDataAPI(`/problems/${encodeURIComponent(params.id)}/${view}${queryString}`);
4219
4235
  context.output.writeData(data);
4220
4236
  break;
4221
4237
  }
@@ -4270,7 +4286,7 @@ async function runCommand(command, positional, flags, positionals = positional ?
4270
4286
  if (!UUID_RE.test(positional)) {
4271
4287
  throw new CliInputError(`Problem id must be a canonical UUID; got "${positional}". Run \`moda problems\` to list problems with their canonical ids.`);
4272
4288
  }
4273
- const data = await callDataAPI(`/problems/${positional}/linear`).catch((error) => {
4289
+ const data = await callDataAPI(`/problems/${encodeURIComponent(positional)}/linear`).catch((error) => {
4274
4290
  throw linearApiError(error);
4275
4291
  });
4276
4292
  const link = asRecord(data)?.link;
@@ -4745,7 +4761,7 @@ var commandRegistry = createCommandRegistry([
4745
4761
  resetApiRequestCountBeforeRun: true,
4746
4762
  telemetry: "result",
4747
4763
  handler: async (context) => {
4748
- const { runInit } = await import("./index-2d0q94sv.js");
4764
+ const { runInit } = await import("./index-qjaprhrv.js");
4749
4765
  if (context.outputMode === "agent-stream") {
4750
4766
  context.output.writeEvent({
4751
4767
  event: "started",
@@ -4786,7 +4802,7 @@ var commandRegistry = createCommandRegistry([
4786
4802
  resetApiRequestCountBeforeRun: true,
4787
4803
  telemetry: "result-and-error",
4788
4804
  handler: async (context) => {
4789
- const { runProvision } = await import("./provision-cjpsswa9.js");
4805
+ const { runProvision } = await import("./provision-rm0yc08f.js");
4790
4806
  return runProvision(context, {
4791
4807
  resumeCommand: buildResumeCommand("provision", context.rawFlags)
4792
4808
  });
@@ -5674,6 +5690,8 @@ function classifyCliError(error) {
5674
5690
  return "auth_error";
5675
5691
  if (error instanceof CliAccessError)
5676
5692
  return "access_error";
5693
+ if (error instanceof CliNotFoundError)
5694
+ return "api_not_found";
5677
5695
  if (error instanceof ApiError && error.statusCode === 401)
5678
5696
  return "auth_error";
5679
5697
  if (error instanceof ApiError && error.statusCode === 403)
@@ -5878,6 +5896,10 @@ async function dispatchParsedCommandInner(parsed, startedAt) {
5878
5896
  }
5879
5897
  if (!updateCheckDisabled) {
5880
5898
  startUpdateCheck();
5899
+ setAgentUpdateNotice(() => {
5900
+ const latest = getAvailableUpdate();
5901
+ return latest ? `moda-cli ${VERSION} is out of date (latest ${latest}); commands and flags may differ from the docs. Update: npm install -g @moda-ai/cli@latest` : undefined;
5902
+ });
5881
5903
  }
5882
5904
  const context = createCommandContext(parsed, {
5883
5905
  commandName: definition.name,
@@ -3,17 +3,17 @@ import {
3
3
  promptsDiscoveredCheck,
4
4
  runDoctorCommand,
5
5
  runStatusCommand
6
- } from "./cli-11fevr8y.js";
7
- import"./cli-t4jjhn3g.js";
8
- import"./cli-fq7kk77e.js";
6
+ } from "./cli-34zdvcpg.js";
7
+ import"./cli-ssqb8bfw.js";
8
+ import"./cli-90hb4ng0.js";
9
9
  import"./cli-mm48br00.js";
10
- import"./cli-m857n028.js";
10
+ import"./cli-m0fa54ny.js";
11
11
  import"./cli-97fnztpy.js";
12
- import"./cli-k5qqj2bp.js";
13
- import"./cli-g7ferymy.js";
14
- import"./cli-tmqd1f0m.js";
15
- import"./cli-m16taf4z.js";
16
- import"./cli-429zt7g4.js";
12
+ import"./cli-4x9w6ey7.js";
13
+ import"./cli-k7vwt56h.js";
14
+ import"./cli-ryd7nzke.js";
15
+ import"./cli-09rr5smg.js";
16
+ import"./cli-kwz900s4.js";
17
17
  import"./cli-0v6na3yp.js";
18
18
  export {
19
19
  runStatusCommand,
@@ -2,18 +2,18 @@ import {
2
2
  DEFAULT_POLL_INTERVAL_MS,
3
3
  DEFAULT_WAIT_TIMEOUT_MS,
4
4
  fetchLatestRun
5
- } from "./cli-fq7kk77e.js";
5
+ } from "./cli-90hb4ng0.js";
6
6
  import"./cli-mm48br00.js";
7
- import"./cli-m857n028.js";
7
+ import"./cli-m0fa54ny.js";
8
8
  import"./cli-97fnztpy.js";
9
- import"./cli-k5qqj2bp.js";
9
+ import"./cli-4x9w6ey7.js";
10
10
  import {
11
11
  assertFlags
12
- } from "./cli-g7ferymy.js";
12
+ } from "./cli-k7vwt56h.js";
13
13
  import {
14
14
  callControlAPI
15
- } from "./cli-tmqd1f0m.js";
16
- import"./cli-m16taf4z.js";
15
+ } from "./cli-ryd7nzke.js";
16
+ import"./cli-09rr5smg.js";
17
17
  import {
18
18
  CliInputError,
19
19
  EXIT_DEGRADED,
@@ -22,7 +22,7 @@ import {
22
22
  getModaPaths,
23
23
  resolveApiTenantId,
24
24
  validateConfig
25
- } from "./cli-429zt7g4.js";
25
+ } from "./cli-kwz900s4.js";
26
26
  import"./cli-0v6na3yp.js";
27
27
 
28
28
  // src/fix.ts
@@ -42,13 +42,13 @@ import {
42
42
  writeHarnessAnalyzeResult,
43
43
  writeHarnessArtifacts,
44
44
  writeHumanProgress
45
- } from "./cli-m857n028.js";
45
+ } from "./cli-m0fa54ny.js";
46
46
  import"./cli-97fnztpy.js";
47
- import"./cli-k5qqj2bp.js";
48
- import"./cli-g7ferymy.js";
49
- import"./cli-tmqd1f0m.js";
50
- import"./cli-m16taf4z.js";
51
- import"./cli-429zt7g4.js";
47
+ import"./cli-4x9w6ey7.js";
48
+ import"./cli-k7vwt56h.js";
49
+ import"./cli-ryd7nzke.js";
50
+ import"./cli-09rr5smg.js";
51
+ import"./cli-kwz900s4.js";
52
52
  import"./cli-0v6na3yp.js";
53
53
  export {
54
54
  writeHumanProgress,
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  buildSourceSnapshot
3
- } from "./cli-m857n028.js";
3
+ } from "./cli-m0fa54ny.js";
4
4
  import"./cli-97fnztpy.js";
5
- import"./cli-k5qqj2bp.js";
6
- import"./cli-g7ferymy.js";
7
- import"./cli-tmqd1f0m.js";
8
- import"./cli-m16taf4z.js";
5
+ import"./cli-4x9w6ey7.js";
6
+ import"./cli-k7vwt56h.js";
7
+ import"./cli-ryd7nzke.js";
8
+ import"./cli-09rr5smg.js";
9
9
  import {
10
10
  recordApiRequest
11
- } from "./cli-429zt7g4.js";
11
+ } from "./cli-kwz900s4.js";
12
12
  import"./cli-0v6na3yp.js";
13
13
 
14
14
  // src/harness-github-actions.ts
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  selectTenantAndCreateKey
3
- } from "./cli-n9gexgma.js";
3
+ } from "./cli-bfmn3bsk.js";
4
4
  import {
5
5
  buildDoctorReport
6
- } from "./cli-11fevr8y.js";
6
+ } from "./cli-34zdvcpg.js";
7
7
  import {
8
8
  ConnectCodeError,
9
9
  connectWithCode,
10
10
  loadAuthSession,
11
11
  loadToken,
12
12
  login
13
- } from "./cli-t4jjhn3g.js";
13
+ } from "./cli-ssqb8bfw.js";
14
14
  import {
15
15
  initPrompts,
16
16
  runPromptSync
17
- } from "./cli-fq7kk77e.js";
17
+ } from "./cli-90hb4ng0.js";
18
18
  import"./cli-mm48br00.js";
19
19
  import {
20
20
  canonicalText,
@@ -34,7 +34,7 @@ import {
34
34
  runCodingAgent,
35
35
  runHarnessCommand,
36
36
  startRemoteAnalyze
37
- } from "./cli-m857n028.js";
37
+ } from "./cli-m0fa54ny.js";
38
38
  import {
39
39
  stripAnsi
40
40
  } from "./cli-97fnztpy.js";
@@ -45,13 +45,13 @@ import {
45
45
  } from "./cli-c5c6f0yw.js";
46
46
  import {
47
47
  runSkillSync
48
- } from "./cli-fwec3m42.js";
48
+ } from "./cli-y8gbbe9k.js";
49
49
  import {
50
50
  createCommandContext
51
- } from "./cli-k5qqj2bp.js";
52
- import"./cli-g7ferymy.js";
53
- import"./cli-tmqd1f0m.js";
54
- import"./cli-m16taf4z.js";
51
+ } from "./cli-4x9w6ey7.js";
52
+ import"./cli-k7vwt56h.js";
53
+ import"./cli-ryd7nzke.js";
54
+ import"./cli-09rr5smg.js";
55
55
  import {
56
56
  CliAuthError,
57
57
  CliInputError,
@@ -59,7 +59,7 @@ import {
59
59
  recordApiRequest,
60
60
  resolveIngestUrl,
61
61
  resolveModaBaseUrl
62
- } from "./cli-429zt7g4.js";
62
+ } from "./cli-kwz900s4.js";
63
63
  import {
64
64
  detectAgents,
65
65
  installRules
@@ -16,10 +16,10 @@ import {
16
16
  import {
17
17
  callControlAPI,
18
18
  callDataAPI
19
- } from "./cli-tmqd1f0m.js";
19
+ } from "./cli-ryd7nzke.js";
20
20
  import {
21
21
  apiKeyHeaders
22
- } from "./cli-m16taf4z.js";
22
+ } from "./cli-09rr5smg.js";
23
23
  import {
24
24
  CliAuthError,
25
25
  CliInputError,
@@ -29,7 +29,7 @@ import {
29
29
  resolveApiKey,
30
30
  resolveModaBaseUrl,
31
31
  safeWriteStderr
32
- } from "./cli-429zt7g4.js";
32
+ } from "./cli-kwz900s4.js";
33
33
  import"./cli-0v6na3yp.js";
34
34
 
35
35
  // src/production-intelligence.ts
@@ -5,10 +5,10 @@ import {
5
5
  loadAuthSession,
6
6
  login,
7
7
  revokeCliSessionToken
8
- } from "./cli-t4jjhn3g.js";
8
+ } from "./cli-ssqb8bfw.js";
9
9
  import {
10
10
  apiKeyHeaders
11
- } from "./cli-m16taf4z.js";
11
+ } from "./cli-09rr5smg.js";
12
12
  import {
13
13
  CliInputError,
14
14
  DEFAULT_INGEST_URL,
@@ -34,7 +34,7 @@ import {
34
34
  secretFilePathFromRef,
35
35
  setActiveProfile,
36
36
  upsertProfile
37
- } from "./cli-429zt7g4.js";
37
+ } from "./cli-kwz900s4.js";
38
38
  import"./cli-0v6na3yp.js";
39
39
 
40
40
  // src/api-key-auth.ts
@@ -5,13 +5,13 @@ import {
5
5
  inspectCodeSelectors,
6
6
  inspectPythonSelectors,
7
7
  safePromptEvidencePath
8
- } from "./cli-m857n028.js";
8
+ } from "./cli-m0fa54ny.js";
9
9
  import"./cli-97fnztpy.js";
10
- import"./cli-k5qqj2bp.js";
11
- import"./cli-g7ferymy.js";
12
- import"./cli-tmqd1f0m.js";
13
- import"./cli-m16taf4z.js";
14
- import"./cli-429zt7g4.js";
10
+ import"./cli-4x9w6ey7.js";
11
+ import"./cli-k7vwt56h.js";
12
+ import"./cli-ryd7nzke.js";
13
+ import"./cli-09rr5smg.js";
14
+ import"./cli-kwz900s4.js";
15
15
  import {
16
16
  __commonJS,
17
17
  __toESM
@@ -11,17 +11,17 @@ import {
11
11
  runPromptSync,
12
12
  runPromptsCommand,
13
13
  writePromptSyncProgress
14
- } from "./cli-fq7kk77e.js";
14
+ } from "./cli-90hb4ng0.js";
15
15
  import {
16
16
  promptSourceHashPayload
17
17
  } from "./cli-mm48br00.js";
18
- import"./cli-m857n028.js";
18
+ import"./cli-m0fa54ny.js";
19
19
  import"./cli-97fnztpy.js";
20
- import"./cli-k5qqj2bp.js";
21
- import"./cli-g7ferymy.js";
22
- import"./cli-tmqd1f0m.js";
23
- import"./cli-m16taf4z.js";
24
- import"./cli-429zt7g4.js";
20
+ import"./cli-4x9w6ey7.js";
21
+ import"./cli-k7vwt56h.js";
22
+ import"./cli-ryd7nzke.js";
23
+ import"./cli-09rr5smg.js";
24
+ import"./cli-kwz900s4.js";
25
25
  import"./cli-0v6na3yp.js";
26
26
  export {
27
27
  writePromptSyncProgress,
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  selectTenantAndCreateKey
3
- } from "./cli-n9gexgma.js";
3
+ } from "./cli-bfmn3bsk.js";
4
4
  import {
5
5
  loadAuthSession
6
- } from "./cli-t4jjhn3g.js";
6
+ } from "./cli-ssqb8bfw.js";
7
7
  import {
8
8
  stringOption
9
- } from "./cli-k5qqj2bp.js";
9
+ } from "./cli-4x9w6ey7.js";
10
10
  import {
11
11
  CliAuthError,
12
12
  resolveIngestUrl,
13
13
  resolveModaBaseUrl
14
- } from "./cli-429zt7g4.js";
14
+ } from "./cli-kwz900s4.js";
15
15
  import"./cli-0v6na3yp.js";
16
16
 
17
17
  // src/provision.ts
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  assertFlags
3
- } from "./cli-g7ferymy.js";
3
+ } from "./cli-k7vwt56h.js";
4
4
  import {
5
5
  callControlAPI
6
- } from "./cli-tmqd1f0m.js";
7
- import"./cli-m16taf4z.js";
6
+ } from "./cli-ryd7nzke.js";
7
+ import"./cli-09rr5smg.js";
8
8
  import {
9
9
  CliInputError,
10
10
  explicitOutputMode,
11
11
  resolveApiKey
12
- } from "./cli-429zt7g4.js";
12
+ } from "./cli-kwz900s4.js";
13
13
  import"./cli-0v6na3yp.js";
14
14
 
15
15
  // src/registry.ts
@@ -3,12 +3,12 @@ import {
3
3
  pullSkills,
4
4
  runSkillSync,
5
5
  runSkillsCommand
6
- } from "./cli-fwec3m42.js";
7
- import"./cli-k5qqj2bp.js";
8
- import"./cli-g7ferymy.js";
9
- import"./cli-tmqd1f0m.js";
10
- import"./cli-m16taf4z.js";
11
- import"./cli-429zt7g4.js";
6
+ } from "./cli-y8gbbe9k.js";
7
+ import"./cli-4x9w6ey7.js";
8
+ import"./cli-k7vwt56h.js";
9
+ import"./cli-ryd7nzke.js";
10
+ import"./cli-09rr5smg.js";
11
+ import"./cli-kwz900s4.js";
12
12
  import"./cli-ssfq84k5.js";
13
13
  import"./cli-0v6na3yp.js";
14
14
  export {
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  runPromptsCommand
3
- } from "./cli-fq7kk77e.js";
3
+ } from "./cli-90hb4ng0.js";
4
4
  import"./cli-mm48br00.js";
5
5
  import {
6
6
  runHarnessCommand
7
- } from "./cli-m857n028.js";
7
+ } from "./cli-m0fa54ny.js";
8
8
  import"./cli-97fnztpy.js";
9
9
  import {
10
10
  runSkillsCommand
11
- } from "./cli-fwec3m42.js";
12
- import"./cli-k5qqj2bp.js";
13
- import"./cli-g7ferymy.js";
14
- import"./cli-tmqd1f0m.js";
15
- import"./cli-m16taf4z.js";
11
+ } from "./cli-y8gbbe9k.js";
12
+ import"./cli-4x9w6ey7.js";
13
+ import"./cli-k7vwt56h.js";
14
+ import"./cli-ryd7nzke.js";
15
+ import"./cli-09rr5smg.js";
16
16
  import {
17
17
  CliInputError
18
- } from "./cli-429zt7g4.js";
18
+ } from "./cli-kwz900s4.js";
19
19
  import"./cli-ssfq84k5.js";
20
20
  import"./cli-0v6na3yp.js";
21
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moda-ai/cli",
3
- "version": "1.55.11",
3
+ "version": "1.55.12",
4
4
  "description": "CLI for Moda: production monitoring and evals for AI agents.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema_version": "moda.skill_index.v1",
3
- "bundled_at": "2026-10-15T04:55:11.718Z",
4
- "cli_version": "1.55.11",
3
+ "bundled_at": "2026-10-15T05:06:16.495Z",
4
+ "cli_version": "1.55.12",
5
5
  "skills": [
6
6
  {
7
7
  "id": "integration-cloudflare-think",
@@ -276,9 +276,9 @@ Branch on the exit code; it is stable and cheaper than parsing the payload:
276
276
  | Exit | Meaning | How to treat it |
277
277
  |---|---|---|
278
278
  | `0` | ok — answer is grounded in Moda Cloud intelligence | Trust it. |
279
- | `1` | error — bad input, API/network failure, or unexpected failure | Read `errors[]`; retry only when the code is retryable. |
279
+ | `1` | error — bad input, unknown id (`not_found`), access denied, API/network failure | Read `errors[0].code`; retry only `network_error` / 5xx `api_error`. For `not_found`, find a valid id first (the `cause` names the command). |
280
280
  | `3` | degraded — Moda Cloud was unavailable; answer synthesized from local Data API evidence | Answer is present but lower-trust; verify before acting. |
281
- | `4` | auth required — credentials are missing or expired | Run the `login_command` from the `auth` payload (`moda auth login`), then re-run `resume_command`. |
281
+ | `4` | auth required — no API key, or the API rejected it (HTTP 401) | Set `MODA_API_KEY` or run the `login_command` from the `auth` payload (`moda auth login --api-key`), then re-run. |
282
282
  | `5` | input required — a choice is needed that the non-interactive run could not answer | Pick a choice from the `input_request` payload and re-invoke the same command with that choice's `resume_flags` appended. |
283
283
  | `130` | cancelled | Treat as interrupted or closed pipe; do not retry blindly. |
284
284
 
@@ -1302,8 +1302,14 @@ moda feedback "trace is a refund request, not this problem" \
1302
1302
  from local evidence — not a failure (`investigate`/`failures` always exit
1303
1303
  `0` on success). Treat exit `1` as the only hard error (see
1304
1304
  [Agent protocol](#agent-protocol)).
1305
- - Errors print to stderr with non-zero exit. Check stderr before claiming
1306
- success.
1305
+ - Errors exit non-zero. In agent/JSON mode the error envelope is printed to
1306
+ stdout (`status: "error"`, `errors[0].code`), even with `--quiet`; human
1307
+ mode prints prose to stderr. Check the exit code before claiming success.
1308
+ - An unknown trace, problem, or cluster id exits 1 with
1309
+ `errors[0].code: "not_found"`; it is not an empty success.
1310
+ - `moda world-state` returns success with a warning when state is missing.
1311
+ This can mean an unknown trace or a real trace without generated state.
1312
+ Use `moda context <id> --metadata-only` to check whether the trace exists.
1307
1313
  - If the JSON has `"conversations": []` or `"frustrations": []`, the call
1308
1314
  worked but the time window is empty — widen `--days-back` before
1309
1315
  concluding "no data".