@moda-ai/cli 1.55.21 → 1.55.23

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 (33) hide show
  1. package/dist/{agent-mj622k8s.js → agent-f8a1kejk.js} +8 -9
  2. package/dist/{cli-569hj0bj.js → cli-2cggp8ww.js} +1 -1
  3. package/dist/{cli-a5c9te95.js → cli-4f6jkrnm.js} +5 -5
  4. package/dist/cli-4yarp5s1.js +61 -0
  5. package/dist/{cli-4j8nffsm.js → cli-54zhv6cx.js} +57 -28
  6. package/dist/{cli-sf0g0fjg.js → cli-8dtnwp9r.js} +152 -57
  7. package/dist/{cli-9x9adrtj.js → cli-9g8vz4sv.js} +1 -1
  8. package/dist/{cli-cehskjde.js → cli-cv3jt1ms.js} +5 -7
  9. package/dist/{cli-033n2mpb.js → cli-d2zews6c.js} +6 -9
  10. package/dist/{cli-38p87ykc.js → cli-frhm2wz7.js} +1 -1
  11. package/dist/{cli-wf7gfa1e.js → cli-s6tw1fje.js} +8 -10
  12. package/dist/{cli-5ke3xe6y.js → cli-t3a6eknn.js} +26 -1
  13. package/dist/{cli-rqk6f6n6.js → cli-wkmdw40s.js} +24 -5
  14. package/dist/{cli-pc5cw7mx.js → cli-z3g07t65.js} +5 -5
  15. package/dist/cli.js +50 -35
  16. package/dist/{doctor-mx6jf435.js → doctor-snb87jvy.js} +8 -9
  17. package/dist/{fix-9fmy6p2x.js → fix-fr48gr0w.js} +6 -7
  18. package/dist/{harness-github-actions-c826bfxs.js → harness-github-actions-cfkx9ty9.js} +5 -6
  19. package/dist/{harness-xvg6ws6x.js → harness-m63b6s0k.js} +5 -6
  20. package/dist/{index-ewqbpnwz.js → index-nsaph4as.js} +58 -22
  21. package/dist/{production-intelligence-dbe9dmc5.js → production-intelligence-fwjh572m.js} +8 -7
  22. package/dist/{profile-commands-kmmd9y86.js → profile-commands-548ts402.js} +7 -48
  23. package/dist/prompt-source-mcp.js +5 -6
  24. package/dist/{prompts-1tkhrxkq.js → prompts-p66y7wep.js} +6 -7
  25. package/dist/{provision-wzttap58.js → provision-r9fhrvpw.js} +5 -4
  26. package/dist/{registry-atqyb5fa.js → registry-n7dsdxmg.js} +3 -4
  27. package/dist/{skills-bundled-r9a2vs07.js → skills-bundled-dq20spzk.js} +2 -2
  28. package/dist/skills-c17gg69y.js +18 -0
  29. package/dist/{sync-25vn78je.js → sync-bne90xvj.js} +8 -9
  30. package/package.json +1 -1
  31. package/skills/integration/index.json +2 -2
  32. package/dist/cli-7ea02wca.js +0 -30
  33. package/dist/skills-br82cpt7.js +0 -19
@@ -2,18 +2,16 @@ import {
2
2
  ApiError,
3
3
  callControlAPI,
4
4
  callDataAPI
5
- } from "./cli-rqk6f6n6.js";
6
- import {
7
- isPlatformApiKey,
8
- setPlatformTenantOverride
9
- } from "./cli-7ea02wca.js";
5
+ } from "./cli-wkmdw40s.js";
10
6
  import {
11
7
  CliAccessError,
12
8
  CliInputError,
13
9
  embeddedTenantIdFromApiKey,
10
+ isPlatformApiKey,
14
11
  resolveApiKey,
15
- resolveApiTenantId
16
- } from "./cli-5ke3xe6y.js";
12
+ resolveApiTenantId,
13
+ setPlatformTenantOverride
14
+ } from "./cli-t3a6eknn.js";
17
15
 
18
16
  // src/schemas.ts
19
17
  import { z } from "zod";
@@ -1,7 +1,10 @@
1
+ import {
2
+ fetchApiKeyProbe
3
+ } from "./cli-4yarp5s1.js";
1
4
  import {
2
5
  authFetch,
3
6
  getCachedLoginContext
4
- } from "./cli-9x9adrtj.js";
7
+ } from "./cli-9g8vz4sv.js";
5
8
  import {
6
9
  CliAccessError,
7
10
  CliInputError,
@@ -9,14 +12,13 @@ import {
9
12
  embeddedTenantIdFromApiKey,
10
13
  getModaDir,
11
14
  loadCliConfig,
12
- recordApiRequest,
13
15
  resolveApiKeyFromActiveProfile,
14
16
  resolveIngestUrl,
15
17
  resolveModaBaseUrl,
16
18
  resolveTenantIdFromActiveProfile,
17
19
  saveCliConfig,
18
20
  writeSecretJsonFile
19
- } from "./cli-5ke3xe6y.js";
21
+ } from "./cli-t3a6eknn.js";
20
22
 
21
23
  // src/init/tenant.ts
22
24
  import { randomUUID } from "node:crypto";
@@ -115,12 +117,7 @@ function bootstrapLabel(custom) {
115
117
  var embeddedTenantId = embeddedTenantIdFromApiKey;
116
118
  async function isStoredKeyLive(key, options = {}) {
117
119
  try {
118
- recordApiRequest();
119
- const response = await fetch(`${resolveModaBaseUrl(options)}/api/v1/data/overview`, {
120
- method: "GET",
121
- headers: { "x-api-key": key },
122
- signal: AbortSignal.timeout(VALIDATE_TIMEOUT_MS)
123
- });
120
+ const response = await fetchApiKeyProbe(resolveModaBaseUrl(options), { "x-api-key": key }, VALIDATE_TIMEOUT_MS);
124
121
  if (response.status !== 200)
125
122
  return false;
126
123
  await response.json();
@@ -5,7 +5,7 @@ import {
5
5
  packageAssetPath,
6
6
  readSkillsManifest,
7
7
  upsertSkillManifestRecord
8
- } from "./cli-sf0g0fjg.js";
8
+ } from "./cli-8dtnwp9r.js";
9
9
 
10
10
  // src/skills-bundled.ts
11
11
  import { createHash } from "node:crypto";
@@ -12,28 +12,26 @@ import {
12
12
  require_typescript,
13
13
  resolvePromptSource,
14
14
  safePromptEvidencePath
15
- } from "./cli-a5c9te95.js";
15
+ } from "./cli-4f6jkrnm.js";
16
16
  import {
17
17
  createCommandContext
18
- } from "./cli-569hj0bj.js";
18
+ } from "./cli-2cggp8ww.js";
19
19
  import {
20
20
  assertFlags,
21
21
  assertPositionals
22
- } from "./cli-cehskjde.js";
22
+ } from "./cli-cv3jt1ms.js";
23
23
  import {
24
24
  callControlAPI,
25
25
  callDataAPI
26
- } from "./cli-rqk6f6n6.js";
27
- import {
28
- setPlatformTenantOverride
29
- } from "./cli-7ea02wca.js";
26
+ } from "./cli-wkmdw40s.js";
30
27
  import {
31
28
  CliInputError,
32
29
  EXIT_ERROR,
33
30
  EXIT_OK,
34
31
  resolveApiTenantId,
32
+ setPlatformTenantOverride,
35
33
  validateConfig
36
- } from "./cli-5ke3xe6y.js";
34
+ } from "./cli-t3a6eknn.js";
37
35
  import {
38
36
  __commonJS,
39
37
  __require,
@@ -6731,7 +6729,7 @@ async function runPromptSyncExclusive(flags, profileOptions, options) {
6731
6729
  const analyzedDefinitions = new Map;
6732
6730
  if (flags["no-analyze"] !== "true") {
6733
6731
  options.onProgress?.("Analyzing prompt sources before sync.");
6734
- const { analyzeHarnessPrompts } = await import("./harness-xvg6ws6x.js");
6732
+ const { analyzeHarnessPrompts } = await import("./harness-m63b6s0k.js");
6735
6733
  const result = await analyzeHarnessPrompts({
6736
6734
  rootDir: process.cwd(),
6737
6735
  existing: established.flatMap((prompt) => prompt.sourceDefinition ? [prompt.sourceDefinition.source] : []),
@@ -7061,7 +7059,7 @@ async function migratePromptManifest(options = {}) {
7061
7059
  let addedSources = [];
7062
7060
  let pendingSources = [];
7063
7061
  if (options.discover) {
7064
- const { analyzeHarnessPrompts } = await import("./harness-xvg6ws6x.js");
7062
+ const { analyzeHarnessPrompts } = await import("./harness-m63b6s0k.js");
7065
7063
  const result = await analyzeHarnessPrompts({
7066
7064
  rootDir: root,
7067
7065
  existing: manifest.sources,
@@ -2622,4 +2622,29 @@ function extractSuggestedCommands(text) {
2622
2622
  return commands.length > 0 ? commands : undefined;
2623
2623
  }
2624
2624
 
2625
- export { PROD_BASE_URL, DEFAULT_INGEST_URL, getModaPaths, getModaDir, isLoopbackBaseUrl, describeBaseUrlSource, loadProfileConfig, saveProfileConfig, getActiveProfile, setActiveProfile, upsertProfile, clearStoredApiKeyCredentials, secretFilePathFromRef, resolveSecretReference, resolveApiKeyFromActiveProfile, resolveTenantIdFromActiveProfile, ensureSecretFilePermissions, writeSecretJsonFile, CliInputError, attachInputDetails, 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, BATCH_MAX_TARGETS, BATCH_CONCURRENCY, parseBatchTarget, collectBatchTargets, mapWithConcurrency, contextTarget, asRecord, asString, asNumber, frustrationAnchorIndex, frustrationsFromEmotions, withFrustrationAnchors, shellWord, trimToolFailureConversations, withToolFailureAnchors, embeddedWindowSize, withoutDetectionWindows, compactProblemDossier, 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, errorToAgentError, agentMaxOutputBytes };
2625
+ // src/api-key-headers.ts
2626
+ var PLATFORM_API_KEY_PREFIX = "moda_pk_";
2627
+ var TENANT_HEADER = "x-moda-tenant-id";
2628
+ function isPlatformApiKey(key) {
2629
+ return Boolean(key?.startsWith(PLATFORM_API_KEY_PREFIX));
2630
+ }
2631
+ var platformTenantOverride;
2632
+ function setPlatformTenantOverride(tenantId) {
2633
+ platformTenantOverride = tenantId;
2634
+ }
2635
+ var TENANT_PATH = /\/tenants\/([^/?#]+)/;
2636
+ function tenantFromUrl(url) {
2637
+ const match = url ? TENANT_PATH.exec(url) : null;
2638
+ return match ? decodeURIComponent(match[1]) : undefined;
2639
+ }
2640
+ function apiKeyHeaders(key, options = {}, url) {
2641
+ const headers = { "x-api-key": key };
2642
+ if (isPlatformApiKey(key)) {
2643
+ const tenantId = tenantFromUrl(url) || platformTenantOverride || resolveTenantId(options);
2644
+ if (tenantId)
2645
+ headers[TENANT_HEADER] = tenantId;
2646
+ }
2647
+ return headers;
2648
+ }
2649
+
2650
+ export { PROD_BASE_URL, DEFAULT_INGEST_URL, getModaPaths, getModaDir, isLoopbackBaseUrl, describeBaseUrlSource, loadProfileConfig, saveProfileConfig, getActiveProfile, setActiveProfile, upsertProfile, clearStoredApiKeyCredentials, secretFilePathFromRef, resolveSecretReference, resolveApiKeyFromActiveProfile, resolveTenantIdFromActiveProfile, ensureSecretFilePermissions, writeSecretJsonFile, CliInputError, attachInputDetails, CliAccessError, CliInputRequiredError, CliAuthError, CliNotFoundError, CliCancellationError, isNetworkLikeError, isApiLikeError, apiErrorStatus, VERSION, MODA_BASE_URL, loadCliConfig, saveCliConfig, resolveApiKey, embeddedTenantIdFromApiKey, resolveIngestUrl2 as resolveIngestUrl, resolveTenantId, resolveApiTenantId, resolveModaBaseUrl, validateConfig, isPlatformApiKey, setPlatformTenantOverride, apiKeyHeaders, recordApiRequest, getApiRequestCount, resetApiRequestCount, BATCH_MAX_TARGETS, BATCH_CONCURRENCY, parseBatchTarget, collectBatchTargets, mapWithConcurrency, contextTarget, asRecord, asString, asNumber, frustrationAnchorIndex, frustrationsFromEmotions, withFrustrationAnchors, shellWord, trimToolFailureConversations, withToolFailureAnchors, embeddedWindowSize, withoutDetectionWindows, compactProblemDossier, 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, errorToAgentError, agentMaxOutputBytes };
@@ -1,11 +1,9 @@
1
1
  import {
2
- apiKeyHeaders
3
- } from "./cli-7ea02wca.js";
4
- import {
2
+ apiKeyHeaders,
5
3
  recordApiRequest,
6
4
  resolveApiKey,
7
5
  resolveModaBaseUrl
8
- } from "./cli-5ke3xe6y.js";
6
+ } from "./cli-t3a6eknn.js";
9
7
 
10
8
  // src/api-client.ts
11
9
  var REQUEST_TIMEOUT_MS = 30000;
@@ -87,7 +85,28 @@ function isRetryable(status) {
87
85
  }
88
86
  async function callDataAPI(endpoint, init = { method: "GET" }, requestOptions = {}) {
89
87
  const url = `${resolveModaBaseUrl()}/api/v1/data${endpoint}`;
90
- return callModaAPI(url, init, {}, requestOptions);
88
+ try {
89
+ return await callModaAPI(url, init, {}, requestOptions);
90
+ } catch (error) {
91
+ const fallback = withoutIncludeContext(endpoint);
92
+ if (fallback === endpoint || !isUnknownIncludeContextError(error))
93
+ throw error;
94
+ return callModaAPI(`${resolveModaBaseUrl()}/api/v1/data${fallback}`, init, {}, requestOptions);
95
+ }
96
+ }
97
+ function withoutIncludeContext(endpoint) {
98
+ const [path, query] = endpoint.split("?", 2);
99
+ if (query === undefined)
100
+ return endpoint;
101
+ const params = new URLSearchParams(query);
102
+ if (!params.has("include_context"))
103
+ return endpoint;
104
+ params.delete("include_context");
105
+ const rest = params.toString();
106
+ return rest ? `${path}?${rest}` : path;
107
+ }
108
+ function isUnknownIncludeContextError(error) {
109
+ return error instanceof ApiError && error.statusCode === 400 && /property include_context should not exist/i.test(error.responseBody ?? "");
91
110
  }
92
111
  async function callControlAPI(endpoint, options = {}, profileOptions = {}, requestOptions = {}) {
93
112
  const url = `${resolveModaBaseUrl(profileOptions)}/api${endpoint}`;
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  isAuthSessionValid,
3
3
  loadAuthSession
4
- } from "./cli-9x9adrtj.js";
4
+ } from "./cli-9g8vz4sv.js";
5
5
  import {
6
6
  inspectPromptManifest
7
- } from "./cli-wf7gfa1e.js";
7
+ } from "./cli-s6tw1fje.js";
8
8
  import {
9
9
  readHarnessSyncState,
10
10
  renderDoctorHuman,
11
11
  renderStatusHuman,
12
12
  scanHarness
13
- } from "./cli-a5c9te95.js";
13
+ } from "./cli-4f6jkrnm.js";
14
14
  import {
15
15
  callDataAPI
16
- } from "./cli-rqk6f6n6.js";
16
+ } from "./cli-wkmdw40s.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-5ke3xe6y.js";
30
+ } from "./cli-t3a6eknn.js";
31
31
 
32
32
  // src/doctor.ts
33
33
  import { createHash } from "node:crypto";
package/dist/cli.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  createCommandContext,
7
7
  parseBooleanFlagValue
8
- } from "./cli-569hj0bj.js";
8
+ } from "./cli-2cggp8ww.js";
9
9
  import {
10
10
  AuditSchema,
11
11
  COMMAND_FLAG_SPECS,
@@ -43,17 +43,12 @@ import {
43
43
  specFlagNames,
44
44
  subcommandHelpFlags,
45
45
  unknownSignalsSubcommandError
46
- } from "./cli-cehskjde.js";
46
+ } from "./cli-cv3jt1ms.js";
47
47
  import {
48
48
  ApiError,
49
49
  callControlAPI,
50
50
  callDataAPI
51
- } from "./cli-rqk6f6n6.js";
52
- import {
53
- apiKeyHeaders,
54
- isPlatformApiKey,
55
- setPlatformTenantOverride
56
- } from "./cli-7ea02wca.js";
51
+ } from "./cli-wkmdw40s.js";
57
52
  import {
58
53
  AGENT_ERROR_CODES,
59
54
  BATCH_CONCURRENCY,
@@ -75,6 +70,7 @@ import {
75
70
  agentEnvelopeFits,
76
71
  agentMaxOutputBytes,
77
72
  apiErrorStatus,
73
+ apiKeyHeaders,
78
74
  asNumber,
79
75
  asRecord,
80
76
  asString,
@@ -91,6 +87,7 @@ import {
91
87
  getModaDir,
92
88
  isApiLikeError,
93
89
  isNetworkLikeError,
90
+ isPlatformApiKey,
94
91
  loadProfileConfig,
95
92
  mapWithConcurrency,
96
93
  parseBatchTarget,
@@ -102,13 +99,14 @@ import {
102
99
  safeWriteStderr,
103
100
  safeWriteStdout,
104
101
  setAgentUpdateNotice,
102
+ setPlatformTenantOverride,
105
103
  trimToolFailureConversations,
106
104
  validateConfig,
107
105
  wasOutputCancelled,
108
106
  withFrustrationAnchors,
109
107
  withToolFailureAnchors,
110
108
  withoutDetectionWindows
111
- } from "./cli-5ke3xe6y.js";
109
+ } from "./cli-t3a6eknn.js";
112
110
  import {
113
111
  __require
114
112
  } from "./cli-0v6na3yp.js";
@@ -1850,46 +1848,46 @@ function exitCodesForCommand(command) {
1850
1848
  import { fileURLToPath } from "url";
1851
1849
  import { realpathSync } from "fs";
1852
1850
  async function runPromptsCommand(...args) {
1853
- return (await import("./prompts-1tkhrxkq.js")).runPromptsCommand(...args);
1851
+ return (await import("./prompts-p66y7wep.js")).runPromptsCommand(...args);
1854
1852
  }
1855
1853
  async function runSkillsCommand(...args) {
1856
- return (await import("./skills-br82cpt7.js")).runSkillsCommand(...args);
1854
+ return (await import("./skills-c17gg69y.js")).runSkillsCommand(...args);
1857
1855
  }
1858
1856
  async function runFixCommand(...args) {
1859
- return (await import("./fix-9fmy6p2x.js")).runFixCommand(...args);
1857
+ return (await import("./fix-fr48gr0w.js")).runFixCommand(...args);
1860
1858
  }
1861
1859
  async function runFixesCommand(...args) {
1862
- return (await import("./fix-9fmy6p2x.js")).runFixesCommand(...args);
1860
+ return (await import("./fix-fr48gr0w.js")).runFixesCommand(...args);
1863
1861
  }
1864
1862
  async function runHarnessCommand(...args) {
1865
- return (await import("./harness-xvg6ws6x.js")).runHarnessCommand(...args);
1863
+ return (await import("./harness-m63b6s0k.js")).runHarnessCommand(...args);
1866
1864
  }
1867
1865
  async function runSyncCommand(...args) {
1868
- return (await import("./sync-25vn78je.js")).runSyncCommand(...args);
1866
+ return (await import("./sync-bne90xvj.js")).runSyncCommand(...args);
1869
1867
  }
1870
1868
  async function runRegistryCommand(...args) {
1871
- return (await import("./registry-atqyb5fa.js")).runRegistryCommand(...args);
1869
+ return (await import("./registry-n7dsdxmg.js")).runRegistryCommand(...args);
1872
1870
  }
1873
1871
  async function runDoctorCommand(...args) {
1874
- return (await import("./doctor-mx6jf435.js")).runDoctorCommand(...args);
1872
+ return (await import("./doctor-snb87jvy.js")).runDoctorCommand(...args);
1875
1873
  }
1876
1874
  async function runStatusCommand(...args) {
1877
- return (await import("./doctor-mx6jf435.js")).runStatusCommand(...args);
1875
+ return (await import("./doctor-snb87jvy.js")).runStatusCommand(...args);
1878
1876
  }
1879
1877
  async function runAuthCommand(...args) {
1880
- return (await import("./profile-commands-kmmd9y86.js")).runAuthCommand(...args);
1878
+ return (await import("./profile-commands-548ts402.js")).runAuthCommand(...args);
1881
1879
  }
1882
1880
  async function runConfigCommand(...args) {
1883
- return (await import("./profile-commands-kmmd9y86.js")).runConfigCommand(...args);
1881
+ return (await import("./profile-commands-548ts402.js")).runConfigCommand(...args);
1884
1882
  }
1885
1883
  async function runProfilesCommand(...args) {
1886
- return (await import("./profile-commands-kmmd9y86.js")).runProfilesCommand(...args);
1884
+ return (await import("./profile-commands-548ts402.js")).runProfilesCommand(...args);
1887
1885
  }
1888
1886
  async function runAgentCommand(...args) {
1889
- return (await import("./agent-mj622k8s.js")).runAgentCommand(...args);
1887
+ return (await import("./agent-f8a1kejk.js")).runAgentCommand(...args);
1890
1888
  }
1891
1889
  async function runProductionCommand(...args) {
1892
- return (await import("./production-intelligence-dbe9dmc5.js")).runProductionCommand(...args);
1890
+ return (await import("./production-intelligence-fwjh572m.js")).runProductionCommand(...args);
1893
1891
  }
1894
1892
  function parseArgs(argv) {
1895
1893
  const args = argv.slice(2);
@@ -2945,14 +2943,20 @@ async function searchFallbackToTraces(params) {
2945
2943
  function capProblemsBlocks(data, limit) {
2946
2944
  const truncated = {};
2947
2945
  const payload = { ...data };
2948
- if (Array.isArray(data.emerging) && data.emerging.length > limit) {
2949
- truncated.emerging = data.emerging.length - limit;
2950
- payload.emerging = data.emerging.slice(0, limit);
2946
+ if (Array.isArray(data.emerging)) {
2947
+ const total = Math.max(asNumber(data.emerging_total) ?? 0, data.emerging.length);
2948
+ if (total > limit)
2949
+ truncated.emerging = total - Math.min(limit, data.emerging.length);
2950
+ if (data.emerging.length > limit)
2951
+ payload.emerging = data.emerging.slice(0, limit);
2951
2952
  }
2952
2953
  const hierarchy = asRecord(data.hierarchy);
2953
- if (hierarchy && Array.isArray(hierarchy.macros) && hierarchy.macros.length > limit) {
2954
- truncated.hierarchy_macros = hierarchy.macros.length - limit;
2955
- payload.hierarchy = { ...hierarchy, macros: hierarchy.macros.slice(0, limit) };
2954
+ if (hierarchy && Array.isArray(hierarchy.macros)) {
2955
+ const total = Math.max(asNumber(hierarchy.macro_total) ?? 0, hierarchy.macros.length);
2956
+ if (total > limit)
2957
+ truncated.hierarchy_macros = total - Math.min(limit, hierarchy.macros.length);
2958
+ if (hierarchy.macros.length > limit)
2959
+ payload.hierarchy = { ...hierarchy, macros: hierarchy.macros.slice(0, limit) };
2956
2960
  }
2957
2961
  return Object.keys(truncated).length > 0 ? { payload, truncated } : { payload };
2958
2962
  }
@@ -3789,9 +3793,11 @@ async function runCommand(command, positional, flags, positionals = positional ?
3789
3793
  if (params.conversation_id)
3790
3794
  query2.set("conversation_id", params.conversation_id);
3791
3795
  query2.set("family", "frustration");
3792
- const data = frustrationsFromEmotions(await callDataAPI(`/emotions?${query2.toString()}`));
3793
3796
  const includeWindow = params.include_window === true;
3794
3797
  const agentMode = context.output.mode === "agent" || context.output.mode === "agent-stream";
3798
+ if (agentMode && !includeWindow)
3799
+ query2.set("include_context", "0");
3800
+ const data = frustrationsFromEmotions(await callDataAPI(`/emotions?${query2.toString()}`));
3795
3801
  const anchored = withFrustrationAnchors(data);
3796
3802
  await printWithOptionalWindows(agentMode && !includeWindow ? withoutDetectionWindows(anchored, "frustrations", "conversation") : anchored, "frustrations", includeWindow, params.window ?? 1, context.output, processingDisabledWarning(data, "frustration"), agentMode && includeWindow ? (payload) => withoutRepeatedFrustrationWindow(payload) : undefined);
3797
3803
  break;
@@ -3829,6 +3835,8 @@ async function runCommand(command, positional, flags, positionals = positional ?
3829
3835
  query2.set("limit", (params.limit ?? TOOL_FAILURE_DETAIL_DEFAULT_LIMIT).toString());
3830
3836
  if (params.offset !== undefined)
3831
3837
  query2.set("offset", params.offset.toString());
3838
+ if (dropConversation)
3839
+ query2.set("include_context", "0");
3832
3840
  const queryString = query2.toString() ? `?${query2.toString()}` : "";
3833
3841
  const data = await callDataAPI(`/tool-failures/${encodeURIComponent(params.tool_name)}${queryString}`);
3834
3842
  const tfRecord = asRecord(data) ?? {};
@@ -4304,10 +4312,12 @@ async function runCommand(command, positional, flags, positionals = positional ?
4304
4312
  query2.set("user_id", params.user_id);
4305
4313
  if (params.conversation_id)
4306
4314
  query2.set("conversation_id", params.conversation_id);
4315
+ const agentMode = context.output.mode === "agent" || context.output.mode === "agent-stream";
4316
+ if (agentMode && params.include_window !== true)
4317
+ query2.set("include_context", "0");
4307
4318
  const queryString = query2.toString() ? `?${query2.toString()}` : "";
4308
4319
  const raw = await callDataAPI(`/emotions${queryString}`);
4309
4320
  const processingWarnings = processingDisabledWarning(raw, "emotion");
4310
- const agentMode = context.output.mode === "agent" || context.output.mode === "agent-stream";
4311
4321
  const record = asRecord(raw);
4312
4322
  const data = agentMode && params.include_window !== true && record ? withoutDetectionWindows(record, "detections", "conversation_context") : raw;
4313
4323
  context.output.writeData(data, processingWarnings.length > 0 ? { warnings: processingWarnings } : undefined);
@@ -4473,7 +4483,9 @@ function initAgentWriteOptions(result) {
4473
4483
  warnings: [
4474
4484
  ...manualActions.filter((action) => action.reason).map((action) => `${action.title}: ${action.reason}`),
4475
4485
  ...result.promptSync?.status === "failed" ? [`Prompt sync failed: ${result.promptSync.error}. Retry with 'moda prompts sync'.`] : [],
4476
- ...result.skillSync?.status === "failed" ? [`Skill sync failed: ${result.skillSync.error}. Retry with 'moda skills sync'.`] : []
4486
+ ...result.skillSync?.status === "failed" ? [`Skill sync failed: ${result.skillSync.error}. Retry with 'moda skills sync'.`] : [],
4487
+ ...result.skillSync?.warnings ?? [],
4488
+ ...(result.skillInstall?.warnings ?? []).map((warning) => `moda-cli skill install: ${warning}`)
4477
4489
  ]
4478
4490
  };
4479
4491
  }
@@ -4533,7 +4545,7 @@ var commandRegistry = createCommandRegistry([
4533
4545
  resetApiRequestCountBeforeRun: true,
4534
4546
  telemetry: "result-and-error",
4535
4547
  handler: async (context) => {
4536
- const { runInit } = await import("./index-ewqbpnwz.js");
4548
+ const { runInit } = await import("./index-nsaph4as.js");
4537
4549
  if (context.outputMode === "agent-stream") {
4538
4550
  context.output.writeEvent({
4539
4551
  event: "started",
@@ -4553,7 +4565,10 @@ var commandRegistry = createCommandRegistry([
4553
4565
  }
4554
4566
  });
4555
4567
  if (context.outputMode !== "human") {
4556
- context.output.writeData(result, initAgentWriteOptions(result));
4568
+ context.output.writeData(result, {
4569
+ ...initAgentWriteOptions(result),
4570
+ ...result.skillInstall?.status === "failed" ? { status: "degraded" } : {}
4571
+ });
4557
4572
  }
4558
4573
  return { exitCode: 0, apiKey: result.apiKey };
4559
4574
  }
@@ -4580,7 +4595,7 @@ var commandRegistry = createCommandRegistry([
4580
4595
  resetApiRequestCountBeforeRun: true,
4581
4596
  telemetry: "result-and-error",
4582
4597
  handler: async (context) => {
4583
- const { runProvision } = await import("./provision-wzttap58.js");
4598
+ const { runProvision } = await import("./provision-r9fhrvpw.js");
4584
4599
  return runProvision(context, {
4585
4600
  resumeCommand: buildResumeCommand("provision", context.rawFlags)
4586
4601
  });
@@ -3,17 +3,16 @@ import {
3
3
  promptsDiscoveredCheck,
4
4
  runDoctorCommand,
5
5
  runStatusCommand
6
- } from "./cli-pc5cw7mx.js";
7
- import"./cli-9x9adrtj.js";
8
- import"./cli-wf7gfa1e.js";
6
+ } from "./cli-z3g07t65.js";
7
+ import"./cli-9g8vz4sv.js";
8
+ import"./cli-s6tw1fje.js";
9
9
  import"./cli-mm48br00.js";
10
- import"./cli-a5c9te95.js";
10
+ import"./cli-4f6jkrnm.js";
11
11
  import"./cli-97fnztpy.js";
12
- import"./cli-569hj0bj.js";
13
- import"./cli-cehskjde.js";
14
- import"./cli-rqk6f6n6.js";
15
- import"./cli-7ea02wca.js";
16
- import"./cli-5ke3xe6y.js";
12
+ import"./cli-2cggp8ww.js";
13
+ import"./cli-cv3jt1ms.js";
14
+ import"./cli-wkmdw40s.js";
15
+ import"./cli-t3a6eknn.js";
17
16
  import"./cli-0v6na3yp.js";
18
17
  export {
19
18
  runStatusCommand,
@@ -2,18 +2,17 @@ import {
2
2
  DEFAULT_POLL_INTERVAL_MS,
3
3
  DEFAULT_WAIT_TIMEOUT_MS,
4
4
  fetchLatestRun
5
- } from "./cli-wf7gfa1e.js";
5
+ } from "./cli-s6tw1fje.js";
6
6
  import"./cli-mm48br00.js";
7
- import"./cli-a5c9te95.js";
7
+ import"./cli-4f6jkrnm.js";
8
8
  import"./cli-97fnztpy.js";
9
- import"./cli-569hj0bj.js";
9
+ import"./cli-2cggp8ww.js";
10
10
  import {
11
11
  assertFlags
12
- } from "./cli-cehskjde.js";
12
+ } from "./cli-cv3jt1ms.js";
13
13
  import {
14
14
  callControlAPI
15
- } from "./cli-rqk6f6n6.js";
16
- import"./cli-7ea02wca.js";
15
+ } from "./cli-wkmdw40s.js";
17
16
  import {
18
17
  CliInputError,
19
18
  EXIT_DEGRADED,
@@ -22,7 +21,7 @@ import {
22
21
  getModaPaths,
23
22
  resolveApiTenantId,
24
23
  validateConfig
25
- } from "./cli-5ke3xe6y.js";
24
+ } from "./cli-t3a6eknn.js";
26
25
  import"./cli-0v6na3yp.js";
27
26
 
28
27
  // src/fix.ts
@@ -1,14 +1,13 @@
1
1
  import {
2
2
  buildSourceSnapshot
3
- } from "./cli-a5c9te95.js";
3
+ } from "./cli-4f6jkrnm.js";
4
4
  import"./cli-97fnztpy.js";
5
- import"./cli-569hj0bj.js";
6
- import"./cli-cehskjde.js";
7
- import"./cli-rqk6f6n6.js";
8
- import"./cli-7ea02wca.js";
5
+ import"./cli-2cggp8ww.js";
6
+ import"./cli-cv3jt1ms.js";
7
+ import"./cli-wkmdw40s.js";
9
8
  import {
10
9
  recordApiRequest
11
- } from "./cli-5ke3xe6y.js";
10
+ } from "./cli-t3a6eknn.js";
12
11
  import"./cli-0v6na3yp.js";
13
12
 
14
13
  // src/harness-github-actions.ts
@@ -42,13 +42,12 @@ import {
42
42
  writeHarnessAnalyzeResult,
43
43
  writeHarnessArtifacts,
44
44
  writeHumanProgress
45
- } from "./cli-a5c9te95.js";
45
+ } from "./cli-4f6jkrnm.js";
46
46
  import"./cli-97fnztpy.js";
47
- import"./cli-569hj0bj.js";
48
- import"./cli-cehskjde.js";
49
- import"./cli-rqk6f6n6.js";
50
- import"./cli-7ea02wca.js";
51
- import"./cli-5ke3xe6y.js";
47
+ import"./cli-2cggp8ww.js";
48
+ import"./cli-cv3jt1ms.js";
49
+ import"./cli-wkmdw40s.js";
50
+ import"./cli-t3a6eknn.js";
52
51
  import"./cli-0v6na3yp.js";
53
52
  export {
54
53
  writeHumanProgress,