@moda-ai/cli 1.55.42 → 1.55.44

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 (45) hide show
  1. package/README.md +1 -1
  2. package/dist/{agent-86hghww1.js → agent-5ax7fqhe.js} +9 -8
  3. package/dist/{cli-daqkdnm1.js → cli-4pc0a18x.js} +1 -1
  4. package/dist/{cli-1z1sx8dg.js → cli-5aa48ry5.js} +5 -4
  5. package/dist/{cli-xddtv3yn.js → cli-8pcq2et6.js} +2 -40
  6. package/dist/{cli-hjm9151g.js → cli-8pksf2x7.js} +5 -5
  7. package/dist/{cli-vwpbspr5.js → cli-d4cdczhe.js} +5 -5
  8. package/dist/{cli-0xc5htv7.js → cli-dmm9jm9m.js} +1 -1
  9. package/dist/cli-e0kbye4s.js +39 -0
  10. package/dist/{cli-t0pb7qbs.js → cli-e24fjyrb.js} +118 -10
  11. package/dist/{cli-gt3yq1y5.js → cli-k2ka2kjb.js} +184 -2
  12. package/dist/{cli-pmzh2qjy.js → cli-sejqvvhv.js} +14 -6
  13. package/dist/{cli-srwzar82.js → cli-t4xfvrry.js} +34 -15
  14. package/dist/{cli-4sy4tytm.js → cli-tztzrh6b.js} +19 -5
  15. package/dist/{cli-he8csgsr.js → cli-wwbr5caw.js} +8 -8
  16. package/dist/{cli-77ekrx7d.js → cli-xcpwp0gb.js} +14 -7
  17. package/dist/{cli-mxfyq5nq.js → cli-xx0pjzkh.js} +4 -4
  18. package/dist/cli.js +82 -41
  19. package/dist/{doctor-c05njdv8.js → doctor-k4tdgvgv.js} +8 -7
  20. package/dist/{fix-aghp304m.js → fix-nk5xffz8.js} +4 -4
  21. package/dist/{harness-vabp33ak.js → harness-avynbq4f.js} +6 -5
  22. package/dist/{harness-github-actions-112503xs.js → harness-github-actions-gd6vyxb0.js} +6 -5
  23. package/dist/{index-dtxvvcq2.js → index-63k2a6gb.js} +12 -11
  24. package/dist/{production-intelligence-e5vsc6cw.js → production-intelligence-sv3qx7f4.js} +24 -7
  25. package/dist/{profile-commands-se9947c1.js → profile-commands-mh3kfqkn.js} +98 -20
  26. package/dist/{prompt-attribution-pbns1ya3.js → prompt-attribution-wvvnzw4m.js} +6 -5
  27. package/dist/prompt-source-mcp.js +6 -5
  28. package/dist/{prompts-ab-f5qrvpkt.js → prompts-ab-y7egdzg4.js} +8 -7
  29. package/dist/{prompts-propose-jg2j41wx.js → prompts-propose-5nw25v9a.js} +8 -7
  30. package/dist/{prompts-qppk0mhp.js → prompts-snnbyxmz.js} +6 -5
  31. package/dist/{provision-cya5rpxa.js → provision-t1dpzcjp.js} +6 -5
  32. package/dist/{registry-8a1940sr.js → registry-8zkxefjs.js} +3 -3
  33. package/dist/{skills-sh93b156.js → skills-d4215fa9.js} +6 -5
  34. package/dist/{sync-0pp1c8hs.js → sync-17f9yxb1.js} +8 -7
  35. package/package.json +1 -1
  36. package/skills/integration/index.json +2 -2
  37. package/skills/moda-cli/SKILL.md +6 -3
  38. package/skills/moda-cli/references/auth.md +16 -7
  39. package/skills/moda-cli/references/commands.md +4 -2
  40. package/skills/moda-cli/references/dashboard-parity.md +3 -0
  41. package/skills/moda-cli/references/detections.md +20 -0
  42. package/skills/moda-cli/references/output-protocol.md +1 -1
  43. package/skills/moda-cli/references/production-intelligence.md +48 -0
  44. package/skills/moda-cli/references/search-and-traces.md +3 -1
  45. package/skills/moda-cli/references/troubleshooting.md +14 -0
@@ -6,7 +6,7 @@ import {
6
6
  saveProfileConfig,
7
7
  secretFilePathFromRef,
8
8
  writeSecretJsonFile
9
- } from "./cli-t0pb7qbs.js";
9
+ } from "./cli-e24fjyrb.js";
10
10
  import {
11
11
  CliAuthError,
12
12
  CliInputError
@@ -345,10 +345,11 @@ async function connectWithCode(code, options = {}) {
345
345
  if (!CONNECT_CODE_RE.test(code)) {
346
346
  throw new ConnectCodeError("That is not a Moda sign-in code. Copy the command from the Moda onboarding page again.", "rejected");
347
347
  }
348
+ const baseUrl = resolveModaBaseUrl(options);
348
349
  let response;
349
350
  try {
350
351
  recordApiRequest();
351
- response = await fetch(`${resolveModaBaseUrl(options)}/api/cli/auth/connect`, {
352
+ response = await fetch(`${baseUrl}/api/cli/auth/connect`, {
352
353
  method: "POST",
353
354
  headers: { "Content-Type": "application/json" },
354
355
  body: JSON.stringify({ code, label: hostname(), ...options.tenantId ? { tenant_id: options.tenantId } : {} }),
@@ -452,6 +453,13 @@ async function login(screen = "login", options = {}) {
452
453
  reject(new CliInputError(`Moda profile '${targetProfile}' does not exist.`, 'Create it with "moda profiles create <name>" or check "moda profiles list".'));
453
454
  return;
454
455
  }
456
+ let baseUrl;
457
+ try {
458
+ baseUrl = resolveModaBaseUrl(storageOptions);
459
+ } catch (err) {
460
+ reject(err);
461
+ return;
462
+ }
455
463
  const server = createServer(async (req, res) => {
456
464
  if (settled) {
457
465
  res.writeHead(410, { Connection: "close" });
@@ -480,7 +488,7 @@ async function login(screen = "login", options = {}) {
480
488
  try {
481
489
  const cliToken = await exchangeCodeForSession(code);
482
490
  res.writeHead(302, {
483
- Location: `${resolveModaBaseUrl(storageOptions)}/auth/cli/done?status=success`,
491
+ Location: `${baseUrl}/auth/cli/done?status=success`,
484
492
  Connection: "close"
485
493
  });
486
494
  res.end(() => {
@@ -490,7 +498,7 @@ async function login(screen = "login", options = {}) {
490
498
  exchangeInFlight = false;
491
499
  const error2 = err instanceof Error ? err : new Error(String(err));
492
500
  res.writeHead(302, {
493
- Location: `${resolveModaBaseUrl(storageOptions)}/auth/cli/done?status=error&reason=${exchangeFailureReason(err)}`,
501
+ Location: `${baseUrl}/auth/cli/done?status=error&reason=${exchangeFailureReason(err)}`,
494
502
  Connection: "close"
495
503
  });
496
504
  res.end(() => {
@@ -598,7 +606,7 @@ async function login(screen = "login", options = {}) {
598
606
  let response;
599
607
  try {
600
608
  recordApiRequest();
601
- response = await fetch(`${resolveModaBaseUrl(storageOptions)}/api/cli/auth/exchange`, {
609
+ response = await fetch(`${baseUrl}/api/cli/auth/exchange`, {
602
610
  method: "POST",
603
611
  headers: { "Content-Type": "application/json" },
604
612
  body: JSON.stringify({
@@ -762,7 +770,7 @@ async function login(screen = "login", options = {}) {
762
770
  if (address && typeof address === "object") {
763
771
  localPort = address.port;
764
772
  }
765
- const authUrl = `${resolveModaBaseUrl(storageOptions)}/auth/cli?port=${localPort}&screen=${screen}&state=${state}&code_challenge=${codeChallenge}&challenge_method=S256`;
773
+ const authUrl = `${baseUrl}/auth/cli?port=${localPort}&screen=${screen}&state=${state}&code_challenge=${codeChallenge}&challenge_method=S256`;
766
774
  attachPromptInput();
767
775
  try {
768
776
  await (options.openUrl ?? openAuthUrl)(authUrl);
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  isAuthSessionValid,
3
3
  loadAuthSession
4
- } from "./cli-pmzh2qjy.js";
4
+ } from "./cli-sejqvvhv.js";
5
5
  import {
6
6
  inspectPromptManifest
7
- } from "./cli-he8csgsr.js";
7
+ } from "./cli-wwbr5caw.js";
8
8
  import {
9
9
  readHarnessSyncState,
10
10
  renderDoctorHuman,
@@ -12,21 +12,22 @@ import {
12
12
  } from "./cli-xq45etg1.js";
13
13
  import {
14
14
  callDataAPI
15
- } from "./cli-0xc5htv7.js";
15
+ } from "./cli-dmm9jm9m.js";
16
16
  import {
17
+ describeModaBaseUrl,
17
18
  ensureSecretFilePermissions,
18
19
  getActiveProfile,
19
20
  getModaPaths,
20
21
  isLoopbackBaseUrl,
21
22
  loadProfileConfig,
22
23
  recordApiRequest,
24
+ refusedBaseUrlMessage,
23
25
  resolveApiKey,
24
26
  resolveIngestUrl,
25
- resolveModaBaseUrl,
26
27
  resolveSecretReference,
27
28
  resolveTenantId,
28
29
  secretFilePathFromRef
29
- } from "./cli-t0pb7qbs.js";
30
+ } from "./cli-e24fjyrb.js";
30
31
  import {
31
32
  __require
32
33
  } from "./cli-0v6na3yp.js";
@@ -65,7 +66,7 @@ async function runStatusCommand(context) {
65
66
  },
66
67
  workspace: {
67
68
  tenantId: resolveTenantId() ?? null,
68
- baseUrl: resolveModaBaseUrl(),
69
+ baseUrl: describeModaBaseUrl().url,
69
70
  ingestUrl: resolveIngestUrl()
70
71
  },
71
72
  dataFlow: checkStatus(report.checks, "cloud_data_flow"),
@@ -102,7 +103,8 @@ async function buildDoctorReport(context, options) {
102
103
  const profileOptions = { profile: context.profile, env: context.env };
103
104
  const apiKey = resolveApiKey(profileOptions);
104
105
  const tenantId = resolveTenantId(profileOptions);
105
- const baseUrl = resolveModaBaseUrl(profileOptions);
106
+ const base = describeModaBaseUrl(profileOptions);
107
+ const baseUrl = base.url;
106
108
  const ingestUrl = resolveIngestUrl(profileOptions);
107
109
  checks.push({
108
110
  id: "active_profile_resolves",
@@ -157,6 +159,8 @@ async function buildDoctorReport(context, options) {
157
159
  checks.push(urlCheck("base_url_valid", "config", "Base URL is valid", baseUrl));
158
160
  checks.push(urlCheck("ingest_url_valid", "config", "Ingest URL is valid", ingestUrl));
159
161
  checks.push(localBaseUrlCheck(activeProfile.environment, baseUrl));
162
+ if (base.refused)
163
+ checks.push(refusedBaseUrlCheck(base.refused));
160
164
  const manifestPath = join(context.cwd, ".moda", "harness.json");
161
165
  const manifestExists = existsSync(manifestPath);
162
166
  checks.push({
@@ -183,8 +187,8 @@ async function buildDoctorReport(context, options) {
183
187
  "__tests__"
184
188
  ]));
185
189
  checks.push(validationEventPathCheck(ingestUrl));
186
- if (options.offline || !apiKey) {
187
- checks.push(...offlineCloudChecks(options.offline));
190
+ if (options.offline || !apiKey || base.refused) {
191
+ checks.push(...offlineCloudChecks(options.offline, Boolean(base.refused)));
188
192
  } else {
189
193
  checks.push(...await cloudDataFlowChecks(ingestUrl, apiKey));
190
194
  }
@@ -278,6 +282,21 @@ function secretPermissionCheck(path) {
278
282
  remediation: permission.secure ? undefined : "Restrict secret file permissions to the current user."
279
283
  };
280
284
  }
285
+ function refusedBaseUrlCheck(refused) {
286
+ return {
287
+ id: "base_url_not_refused",
288
+ group: "config",
289
+ title: "Base URL is usable with the active profile",
290
+ status: "fail",
291
+ severity: "critical",
292
+ evidence: [
293
+ { label: "MODA_BASE_URL", value: refused.url },
294
+ { label: "profile", value: `${refused.profile} (${refused.environment})` }
295
+ ],
296
+ remediation: `${refusedBaseUrlMessage(refused)} Re-run with --profile=local (or MODA_PROFILE=local) for the local stack, or unset MODA_BASE_URL for production.`,
297
+ nextCommand: "moda status --profile=local"
298
+ };
299
+ }
281
300
  function urlCheck(id, group, title, value) {
282
301
  let valid = false;
283
302
  try {
@@ -376,7 +395,7 @@ async function harnessCurrentCheck(cwd, manifestPath, manifestExists, tenantId)
376
395
  };
377
396
  }
378
397
  try {
379
- const { scanHarness } = await import("./harness-vabp33ak.js");
398
+ const { scanHarness } = await import("./harness-avynbq4f.js");
380
399
  const current = scanHarness({
381
400
  rootDir: cwd,
382
401
  scannerVersion: "doctor",
@@ -515,11 +534,11 @@ function validationEventPathCheck(ingestUrl) {
515
534
  evidence: [{ label: "path", value: `${ingestUrl.replace(/\/+$/, "")}/v1/otel/validation` }]
516
535
  };
517
536
  }
518
- function offlineCloudChecks(isOffline) {
519
- const status = isOffline ? "skipped" : "warning";
520
- const evidence = [{ label: "mode", value: isOffline ? "offline" : "missing api key" }];
521
- const remediation = isOffline ? "Rerun without --offline to check Moda Cloud." : "Configure an API key before checking cloud data flow.";
522
- const nextCommand = isOffline ? "moda doctor --online" : "moda init";
537
+ function offlineCloudChecks(isOffline, refused = false) {
538
+ const status = isOffline || refused ? "skipped" : "warning";
539
+ const evidence = [{ label: "mode", value: refused ? "base url refused" : isOffline ? "offline" : "missing api key" }];
540
+ const remediation = refused ? "Fix the refused MODA_BASE_URL (see base_url_not_refused) before checking Moda Cloud." : isOffline ? "Rerun without --offline to check Moda Cloud." : "Configure an API key before checking cloud data flow.";
541
+ const nextCommand = refused ? "moda doctor --online --profile=local" : isOffline ? "moda doctor --online" : "moda init";
523
542
  return [
524
543
  {
525
544
  id: "cloud_api_reachable",
@@ -2,7 +2,7 @@ import {
2
2
  ApiError,
3
3
  callControlAPI,
4
4
  callDataAPI
5
- } from "./cli-0xc5htv7.js";
5
+ } from "./cli-dmm9jm9m.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-t0pb7qbs.js";
14
+ } from "./cli-e24fjyrb.js";
15
15
  import {
16
16
  CliAccessError,
17
17
  CliInputError
@@ -40,8 +40,16 @@ var COHORT_REF = /^(all|builtin:[a-z_]{1,64}|[a-z_]{1,64}|[0-9a-fA-F]{8}-[0-9a-f
40
40
  var COHORT_REF_MESSAGE = "must be builtin:<key> or a saved cohort id (see moda cohorts list)";
41
41
  var cohortFlag = (description) => z.string().regex(COHORT_REF, COHORT_REF_MESSAGE).optional().describe(description);
42
42
  var CLUSTER_COHORT_TIME_RANGES = ["all", "3d", "7d", "30d"];
43
+ var TREND_UNITS = ["conversation", "segment", "turn"];
44
+ var compareFlag = () => boolFlag().describe("Add summary.compare: the dashboard KPI tiles and rate for this window against the previous window of equal length");
43
45
  var OverviewSchema = z.object({
44
- days_back: daysBackFlag(7)
46
+ days_back: daysBackFlag(7),
47
+ compare: boolFlag().describe("Add trends: overview KPIs, per-unit rates and each detector family, against the previous window of equal length"),
48
+ series: boolFlag().describe("Add trends.series: [bucket, value] per hour (windows up to 2 days) or per day"),
49
+ since: isoBoundFlag().describe("Trends window start (ISO date or datetime, UTC unless an offset is given); the previous window is the same span before it"),
50
+ until: isoBoundFlag().describe("Trends window end, inclusive (default now); needs --since"),
51
+ agent_name: z.string().trim().min(1).max(200).optional().describe("Scope the trends overview KPIs to one sub-agent (the Analytics agent selector; names are in trends.agent.options)"),
52
+ unit: z.enum(TREND_UNITS).optional().describe("Denominator of trends.rates (default conversation)")
45
53
  });
46
54
  var ClustersSchema = z.object({
47
55
  parent_id: z.string().optional().describe("List the children of this cluster node"),
@@ -143,6 +151,7 @@ var conversationIdsFlag = () => z.string().min(1).max(MAX_CONVERSATION_IDS_FILTE
143
151
  var idsFromFilterFlag = () => z.string().min(1).optional().describe(`Read the trace IDs to scope to from a file, or - for stdin, one per line (up to ${MAX_CONVERSATION_IDS_FILTER})`);
144
152
  var FrustrationsSchema = z.object({
145
153
  days_back: daysBackFlag(7),
154
+ compare: compareFlag(),
146
155
  limit: z.number().int().min(1).max(20).default(10).optional().describe("Maximum detections to return"),
147
156
  offset: z.number().int().min(0).default(0).optional().describe("Number of detections to skip"),
148
157
  include_window: boolFlag().describe("Attach the surrounding messages to each detection (agent output omits them by default)"),
@@ -155,7 +164,8 @@ var FrustrationsSchema = z.object({
155
164
  });
156
165
  var ToolFailuresSchema = z.object({
157
166
  days_back: daysBackFlag(7),
158
- cohort: cohortFlag("The dashboard Tool Failures leaderboard for this cohort's traces (builtin:<key> or a saved cohort id)")
167
+ cohort: cohortFlag("The dashboard Tool Failures leaderboard for this cohort's traces (builtin:<key> or a saved cohort id)"),
168
+ compare: compareFlag()
159
169
  });
160
170
  var PROBLEM_LIST_VIEWS = ["auto", "book", "dream"];
161
171
  var BOOK_PROBLEM_SORTS = ["rank", "users", "signals", "problems"];
@@ -227,7 +237,8 @@ var ProblemSchema = z.object({
227
237
  door: z.enum(PROBLEM_DOORS).optional().describe("With --traces: only this attribution door"),
228
238
  view: z.enum(["book", "dream"]).optional().describe("dream: the dream view of the problem (definition, severity, incidents with verdicts); default the dossier"),
229
239
  offset: z.number().int().min(0).max(1e4).optional().describe("With --view=dream: first incident to return"),
230
- days_back: daysBackFlag().describe("With --view=dream: whole days to count (default the dream run window)")
240
+ days_back: daysBackFlag().describe("With --view=dream: whole days to count (default the dream run window). With --trend: days of history (default 30)"),
241
+ trend: boolFlag().describe("Incidents and users per day, and the window against the previous window of equal length")
231
242
  });
232
243
  var PROBLEM_FEEDBACK_ACTIONS = [
233
244
  "mark_fixed",
@@ -326,6 +337,7 @@ var EMOTION_FAMILIES = [
326
337
  ];
327
338
  var EmotionsSchema = z.object({
328
339
  days_back: daysBackFlag(7),
340
+ compare: compareFlag(),
329
341
  limit: z.number().int().min(1).max(20).default(10).optional().describe("Maximum detections to return"),
330
342
  offset: z.number().int().min(0).max(1e4).optional().describe("Number of detections to skip"),
331
343
  family: z.enum(EMOTION_FAMILIES).optional().describe("Only this family in the detections list (summary covers all)"),
@@ -338,6 +350,7 @@ var EmotionsSchema = z.object({
338
350
  });
339
351
  var HallucinationsSchema = z.object({
340
352
  days_back: daysBackFlag(7),
353
+ compare: compareFlag(),
341
354
  limit: z.number().int().min(1).max(20).default(10).optional().describe("Maximum detections to return"),
342
355
  offset: z.number().int().min(0).max(1e4).optional().describe("Number of detections to skip"),
343
356
  conversation_id: z.string().max(200).optional().describe("Scope summary and list to one trace ID"),
@@ -376,6 +389,7 @@ var LAZINESS_FAMILIES = [
376
389
  ];
377
390
  var LazinessSchema = z.object({
378
391
  days_back: daysBackFlag(7),
392
+ compare: compareFlag(),
379
393
  limit: z.number().int().min(1).max(50).default(10).optional().describe("Maximum detections to return"),
380
394
  offset: z.number().int().min(0).max(1e4).optional().describe("Number of detections to skip"),
381
395
  conversation_id: z.string().max(200).optional().describe("One trace's detections"),
@@ -4,14 +4,14 @@ import {
4
4
  } from "./cli-mm48br00.js";
5
5
  import {
6
6
  createCommandContext
7
- } from "./cli-xddtv3yn.js";
7
+ } from "./cli-8pcq2et6.js";
8
8
  import {
9
9
  assertFlags,
10
10
  assertPositionals
11
- } from "./cli-4sy4tytm.js";
11
+ } from "./cli-tztzrh6b.js";
12
12
  import {
13
13
  callControlAPI
14
- } from "./cli-0xc5htv7.js";
14
+ } from "./cli-dmm9jm9m.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-f5qrvpkt.js")).runPromptAb(flags, profileOptions, context);
5728
+ return (await import("./prompts-ab-y7egdzg4.js")).runPromptAb(flags, profileOptions, context);
5729
5729
  case "propose":
5730
- await (await import("./prompts-propose-jg2j41wx.js")).runPromptPropose(positionals, flags, profileOptions, context);
5730
+ await (await import("./prompts-propose-5nw25v9a.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-vabp33ak.js");
5833
+ const { analyzeHarnessPrompts } = await import("./harness-avynbq4f.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-pbns1ya3.js");
5861
+ const { checkPromptAttribution } = await import("./prompt-attribution-wvvnzw4m.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-vabp33ak.js");
6167
+ const { analyzeHarnessPrompts } = await import("./harness-avynbq4f.js");
6168
6168
  const result = await analyzeHarnessPrompts({
6169
6169
  rootDir: root,
6170
6170
  existing: manifest.sources,
@@ -5,7 +5,7 @@ import {
5
5
  resolveApiKey,
6
6
  resolveApiKeyFromActiveProfile,
7
7
  resolveModaBaseUrl
8
- } from "./cli-t0pb7qbs.js";
8
+ } from "./cli-e24fjyrb.js";
9
9
 
10
10
  // src/api-key-auth.ts
11
11
  var PROBE_TIMEOUT_MS = 1e4;
@@ -37,25 +37,32 @@ async function fetchApiKeyProbe(baseUrl, headers, timeoutMs) {
37
37
  return probe("overview");
38
38
  }
39
39
  async function probeApiKey(key, options = {}) {
40
+ const baseUrl = resolveModaBaseUrl(options);
40
41
  let response;
41
42
  try {
42
- response = await fetchApiKeyProbe(resolveModaBaseUrl(options), apiKeyHeaders(key, options), PROBE_TIMEOUT_MS);
43
+ response = await fetchApiKeyProbe(baseUrl, apiKeyHeaders(key, options), PROBE_TIMEOUT_MS);
43
44
  } catch (error) {
44
45
  const reason = error instanceof Error ? error.message : String(error);
45
46
  return { outcome: "unreachable", reason };
46
47
  }
47
48
  if (response.status === 401 || response.status === 403) {
48
- return { outcome: "rejected", status: response.status };
49
+ const body2 = await response.text().catch(() => {
50
+ return;
51
+ });
52
+ return { outcome: "rejected", status: response.status, ...body2 ? { body: body2 } : {} };
49
53
  }
50
54
  if (response.status !== 200) {
51
- return { outcome: "unreachable", reason: `HTTP ${response.status}` };
55
+ return { outcome: "unreachable", reason: `HTTP ${response.status}`, status: response.status };
52
56
  }
57
+ let body;
53
58
  try {
54
- await response.json();
59
+ body = await response.json();
55
60
  } catch {
56
- return { outcome: "unreachable", reason: "non-JSON response from the Data API" };
61
+ return { outcome: "unreachable", reason: "non-JSON response from the Data API", status: response.status };
57
62
  }
58
- return { outcome: "live" };
63
+ const record = body !== null && typeof body === "object" && !Array.isArray(body) ? body : undefined;
64
+ const identity = record && typeof record.tenant_id === "string" && typeof record.key_kind === "string" ? record : undefined;
65
+ return identity ? { outcome: "live", identity } : { outcome: "live" };
59
66
  }
60
67
 
61
68
  export { resolveApiKeyCredential, redactApiKey, fetchApiKeyProbe, probeApiKey };
@@ -13,22 +13,22 @@ import {
13
13
  } from "./cli-hcwdz9sd.js";
14
14
  import {
15
15
  createCommandContext
16
- } from "./cli-xddtv3yn.js";
16
+ } from "./cli-8pcq2et6.js";
17
17
  import {
18
18
  assertFlags,
19
19
  assertPositionals,
20
20
  writeDryRun
21
- } from "./cli-4sy4tytm.js";
21
+ } from "./cli-tztzrh6b.js";
22
22
  import {
23
23
  callControlAPI
24
- } from "./cli-0xc5htv7.js";
24
+ } from "./cli-dmm9jm9m.js";
25
25
  import {
26
26
  recordApiRequest,
27
27
  resolveApiKey,
28
28
  resolveIngestUrl,
29
29
  resolveTenantId,
30
30
  shellArg
31
- } from "./cli-t0pb7qbs.js";
31
+ } from "./cli-e24fjyrb.js";
32
32
  import {
33
33
  CliInputError
34
34
  } from "./cli-k4tqwah4.js";