@moda-ai/cli 1.55.88 → 1.55.90

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 (37) hide show
  1. package/dist/{agent-85087h8a.js → agent-a6hz6vfr.js} +9 -9
  2. package/dist/{cli-p5grm12t.js → cli-0semcakc.js} +184 -5
  3. package/dist/{cli-5ms8rw8x.js → cli-13zdcv4w.js} +1 -1
  4. package/dist/{cli-z1t3sf7b.js → cli-1nd4339b.js} +1 -1
  5. package/dist/{cli-n1406hqg.js → cli-62e1vy8f.js} +3 -3
  6. package/dist/{cli-22yvg5kh.js → cli-6ga6kmdp.js} +2 -2
  7. package/dist/{cli-fr85gngq.js → cli-8v6v3ket.js} +7 -7
  8. package/dist/{cli-snswkrxd.js → cli-998n4kz9.js} +1 -1
  9. package/dist/{cli-m5epf2gm.js → cli-aqk56bkg.js} +14940 -19079
  10. package/dist/{cli-4g7gn0yn.js → cli-c9v875xv.js} +5 -5
  11. package/dist/{cli-87xy1evx.js → cli-dxajrq9h.js} +1 -1
  12. package/dist/{cli-y7dtztan.js → cli-gmvbapx7.js} +2 -1517
  13. package/dist/{cli-rrggdmf8.js → cli-qwnkv4jy.js} +1 -1
  14. package/dist/cli-t29r8b6f.js +1522 -0
  15. package/dist/{cli-1smcq5pf.js → cli-t8vmcbe0.js} +4 -4
  16. package/dist/{cli-6hpfw3vf.js → cli-wm0p9kn2.js} +2 -2
  17. package/dist/cli-xc4gq7pv.js +4506 -0
  18. package/dist/cli.js +22 -21
  19. package/dist/{doctor-6gjvc25v.js → doctor-72qrmfe7.js} +8 -8
  20. package/dist/{harness-github-actions-gkhfqybk.js → harness-github-actions-9a48sd2r.js} +9 -7
  21. package/dist/{harness-5v0wxmj7.js → harness-kr06zrhh.js} +9 -7
  22. package/dist/{index-c12v9gjq.js → index-5q79y09b.js} +19 -16
  23. package/dist/{index-jwg6s0gb.js → index-t4fncjwa.js} +18 -15
  24. package/dist/{index-rcfrwtk2.js → index-vx6eysne.js} +18 -16
  25. package/dist/{production-intelligence-f9sd68te.js → production-intelligence-1y884f69.js} +4 -4
  26. package/dist/{profile-commands-1fdvrs5y.js → profile-commands-tav5q639.js} +5 -5
  27. package/dist/{prompt-attribution-13eyebd7.js → prompt-attribution-1cwnp7fb.js} +10 -8
  28. package/dist/prompt-source-mcp.js +9 -7
  29. package/dist/{prompt-sources-3mq04qc6.js → prompt-sources-x5z4p7n5.js} +3 -2
  30. package/dist/{prompts-ys1abkb1.js → prompts-hczy41m5.js} +6 -6
  31. package/dist/{provision-ya3vebee.js → provision-d0sxcka1.js} +6 -6
  32. package/dist/{registry-c64qr7ta.js → registry-4mhr7xsd.js} +4 -4
  33. package/dist/resolver-kef7vjjn.js +20 -0
  34. package/dist/{skills-knpeqryb.js → skills-hf8fa7w7.js} +6 -6
  35. package/dist/{sync-vp8jwq7g.js → sync-e2aydwa0.js} +11 -9
  36. package/package.json +1 -1
  37. package/skills/integration/index.json +2 -2
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  buildDoctorReport
3
- } from "./cli-4g7gn0yn.js";
4
- import"./cli-rrggdmf8.js";
5
- import"./cli-fr85gngq.js";
3
+ } from "./cli-c9v875xv.js";
4
+ import"./cli-qwnkv4jy.js";
5
+ import"./cli-8v6v3ket.js";
6
6
  import"./cli-mm48br00.js";
7
7
  import {
8
8
  readHarnessSyncState
@@ -15,21 +15,21 @@ import {
15
15
  readHarnessReport,
16
16
  validateHarnessReport
17
17
  } from "./cli-y333w08f.js";
18
- import"./cli-22yvg5kh.js";
19
- import"./cli-87xy1evx.js";
20
- import"./cli-5ms8rw8x.js";
18
+ import"./cli-6ga6kmdp.js";
19
+ import"./cli-dxajrq9h.js";
20
+ import"./cli-13zdcv4w.js";
21
21
  import"./cli-e0kbye4s.js";
22
22
  import {
23
23
  resolveApiKey,
24
24
  resolveIngestUrl,
25
25
  resolveModaBaseUrl,
26
26
  resolveTenantId
27
- } from "./cli-z1t3sf7b.js";
27
+ } from "./cli-1nd4339b.js";
28
28
  import {
29
29
  CliInputError
30
30
  } from "./cli-k4tqwah4.js";
31
31
  import"./cli-9kfxkxmk.js";
32
- import"./cli-p5grm12t.js";
32
+ import"./cli-0semcakc.js";
33
33
  import {
34
34
  __require
35
35
  } from "./cli-0v6na3yp.js";
@@ -95,7 +95,7 @@ async function buildAgentContext(context) {
95
95
  const graph = readHarnessGraphIfPresent(context.cwd);
96
96
  const reportState = readHarnessReportState(context.cwd);
97
97
  const syncState = readHarnessSyncState(context.cwd);
98
- const harness = graph ? await import("./harness-5v0wxmj7.js") : undefined;
98
+ const harness = graph ? await import("./harness-kr06zrhh.js") : undefined;
99
99
  const topFindings = doctor.checks.filter((check) => check.status === "fail" || check.status === "warning").slice(0, 12).map(checkToFinding);
100
100
  const evidenceRefs = [
101
101
  ...doctor.checks.map(checkToEvidenceRef),
@@ -210,17 +210,24 @@ function redactSecretValue(value) {
210
210
  return value;
211
211
  return REDACTED;
212
212
  }
213
+ var MASK_SUFFIX = "...[REDACTED]";
214
+ var MASK_SUFFIX_PATTERN = /\.\.\.\[REDACTED\]$/;
215
+ var MASKING_PATTERNS = SECRET_PATTERNS.map(({ pattern, prefixLength }) => ({
216
+ pattern: new RegExp(`(?:${pattern.source})(?:\\.\\.\\.\\[REDACTED\\])?`, pattern.flags),
217
+ prefixLength
218
+ }));
213
219
  function redactStringWithCount(input) {
214
220
  let text = input;
215
221
  let redactionCount = 0;
216
- for (const { pattern, prefixLength } of SECRET_PATTERNS) {
217
- text = text.replace(pattern, (match) => {
222
+ for (const { pattern, prefixLength } of MASKING_PATTERNS) {
223
+ text = text.replace(pattern, (rawMatch) => {
218
224
  redactionCount += 1;
225
+ const match = rawMatch.replace(MASK_SUFFIX_PATTERN, "");
219
226
  if (/^Bearer\s+/i.test(match)) {
220
227
  const token = match.replace(/^Bearer\s+/i, "");
221
- return `Bearer ${token.slice(0, prefixLength)}...[REDACTED]`;
228
+ return `Bearer ${token.slice(0, prefixLength)}${MASK_SUFFIX}`;
222
229
  }
223
- return `${match.slice(0, prefixLength)}...[REDACTED]`;
230
+ return `${match.slice(0, prefixLength)}${MASK_SUFFIX}`;
224
231
  });
225
232
  }
226
233
  return { text, redactionCount };
@@ -339,4 +346,176 @@ function packSnapshot(inputs, opts) {
339
346
  skips
340
347
  };
341
348
  }
342
- export { 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, redactSnapshotText, packSnapshot };
349
+
350
+ // ../../packages/harness-snapshot/src/artifact-bodies.ts
351
+ var PRIVATE_KEY_BLOCK = /-----BEGIN ([A-Z ]*)PRIVATE KEY-----(?:[\s\S]*?-----END \1PRIVATE KEY-----|(?:(?:\r\n|\r|\n)[ \t]*[A-Za-z0-9+/=]+[ \t]*(?=[\r\n]|$))*)/g;
352
+ function maskPrivateKeyBlock(block) {
353
+ return block.split(/(\r\n|\r|\n)/).map((part, index) => index === 0 ? "[REDACTED PRIVATE KEY]" : index % 2 === 1 ? part : "").join("");
354
+ }
355
+ var CREDENTIAL_FIELD = /(\b(?:[A-Za-z0-9]+[_-])*(?:api[_-]?key|apikey|secret(?:[_-]?key)?|password|passwd|access[_-]?token|auth[_-]?token|refresh[_-]?token|client[_-]?secret|private[_-]?key)\b["']?\s*[:=]\s*["']?)(?![<${]|process\.env|os\.environ)([^\s"'`,;]{8,})/gi;
356
+ var CALL_OR_INDEX = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*[([]/;
357
+ var DOTTED_REFERENCE = /^[A-Za-z_$][\w$]{0,39}(?:\.[A-Za-z_$][\w$]{0,39})+$/;
358
+ function isCredentialReference(field, value) {
359
+ if (/["']$/.test(field))
360
+ return false;
361
+ return CALL_OR_INDEX.test(value) || DOTTED_REFERENCE.test(value);
362
+ }
363
+ function redactArtifactBody(body) {
364
+ const masked = body.replace(PRIVATE_KEY_BLOCK, maskPrivateKeyBlock).replace(CREDENTIAL_FIELD, (match, field, value) => isCredentialReference(field, value) ? match : `${field}[REDACTED]`);
365
+ return redactSnapshotText(masked).text;
366
+ }
367
+ var MAX_STORED_ARTIFACT_BODY_BYTES = 1e6;
368
+ var MAX_ARTIFACT_BODY_UPLOAD_COUNT = 100;
369
+ var MAX_ARTIFACT_BODY_UPLOAD_BYTES = 1800000;
370
+ var MAX_ARTIFACT_BODY_HASH_QUERY = 1000;
371
+ var encoder = new TextEncoder;
372
+ async function webCryptoSha256Hex(text) {
373
+ const digest = await globalThis.crypto.subtle.digest("SHA-256", encoder.encode(text));
374
+ return [...new Uint8Array(digest)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
375
+ }
376
+ function artifactsOf(graph) {
377
+ if (!graph || typeof graph !== "object")
378
+ return [];
379
+ const artifacts = graph.artifacts;
380
+ return Array.isArray(artifacts) ? artifacts.filter((artifact) => Boolean(artifact) && typeof artifact === "object") : [];
381
+ }
382
+ async function captureFullArtifactBodies(graph, sha256 = webCryptoSha256Hex) {
383
+ const captured = new Map;
384
+ for (const artifact of artifactsOf(graph)) {
385
+ if (typeof artifact.body !== "string" || artifact.body.length === 0)
386
+ continue;
387
+ const body = redactArtifactBody(artifact.body);
388
+ artifact.body = body;
389
+ if (encoder.encode(body).length > MAX_STORED_ARTIFACT_BODY_BYTES)
390
+ continue;
391
+ captured.set(artifact, { hash: await sha256(body), body, length: body.length });
392
+ }
393
+ return captured;
394
+ }
395
+ var BODY_CAPS = [32768, 16384, 8192, 4096, 2048, 1024, 768, 512, 384, 256];
396
+ var PROMPT_ARTIFACT_TYPES = new Set(["prompt", "skill"]);
397
+ var ARTIFACT_BODY_TRUNCATION_MARKER = `
398
+ [Truncated by Moda to fit the harness sync limit: `;
399
+ function fitGraphForSync(graph, maxBytes, fullBodies) {
400
+ if (!graph || typeof graph !== "object")
401
+ return 0;
402
+ const g = graph;
403
+ const bytes = (value) => encoder.encode(JSON.stringify(value)).length;
404
+ if (bytes(g) <= maxBytes || !Array.isArray(g.artifacts))
405
+ return 0;
406
+ const scan = g.scan && typeof g.scan === "object" ? g.scan : g.scan = {};
407
+ const previousReasons = scan.truncationReasons;
408
+ const previousTruncated = scan.truncated;
409
+ const reasons = Array.isArray(scan.truncationReasons) ? scan.truncationReasons : [];
410
+ scan.truncationReasons = [...new Set([...reasons, "artifact bodies shortened to fit the sync limit"])];
411
+ scan.truncated = true;
412
+ let size = bytes(g);
413
+ let shortened = 0;
414
+ const artifacts = g.artifacts;
415
+ const shorten = (eligible) => {
416
+ for (const cap of BODY_CAPS) {
417
+ if (size <= maxBytes)
418
+ return;
419
+ const withBodies = artifacts.filter((artifact) => eligible(artifact) && typeof artifact.body === "string" && artifact.body.length > cap).sort((a, b) => b.body.length - a.body.length);
420
+ for (const artifact of withBodies) {
421
+ const body = artifact.body;
422
+ const full = fullBodies?.get(artifact);
423
+ if (full && artifact.bodyHash === undefined) {
424
+ size += bytes({ bodyHash: full.hash, bodyLength: full.length }) - 1;
425
+ artifact.bodyHash = full.hash;
426
+ artifact.bodyLength = full.length;
427
+ }
428
+ const where = typeof artifact.sourcePath === "string" ? ` in ${artifact.sourcePath}` : "";
429
+ const next = `${body.slice(0, cap)}${ARTIFACT_BODY_TRUNCATION_MARKER}${body.length - cap} more characters${where}.]`;
430
+ size += bytes(next) - bytes(body);
431
+ artifact.body = next;
432
+ shortened += 1;
433
+ if (size <= maxBytes)
434
+ return;
435
+ }
436
+ }
437
+ };
438
+ const isPrompt = (artifact) => PROMPT_ARTIFACT_TYPES.has(String(artifact.type));
439
+ shorten((artifact) => !isPrompt(artifact));
440
+ shorten(isPrompt);
441
+ if (shortened === 0) {
442
+ if (previousReasons === undefined)
443
+ delete scan.truncationReasons;
444
+ else
445
+ scan.truncationReasons = previousReasons;
446
+ if (previousTruncated === undefined)
447
+ delete scan.truncated;
448
+ else
449
+ scan.truncated = previousTruncated;
450
+ }
451
+ return shortened;
452
+ }
453
+ function referencedFullBodies(graph, fullBodies) {
454
+ const byHash = new Map;
455
+ for (const artifact of artifactsOf(graph)) {
456
+ const full = fullBodies.get(artifact);
457
+ if (full && artifact.bodyHash === full.hash)
458
+ byHash.set(full.hash, full);
459
+ }
460
+ return [...byHash.values()];
461
+ }
462
+ function stripArtifactBodyHashes(graph) {
463
+ let stripped = 0;
464
+ for (const artifact of artifactsOf(graph)) {
465
+ if (artifact.bodyHash === undefined && artifact.bodyLength === undefined)
466
+ continue;
467
+ delete artifact.bodyHash;
468
+ delete artifact.bodyLength;
469
+ stripped += 1;
470
+ }
471
+ return stripped;
472
+ }
473
+ function chunk(items, size) {
474
+ const out = [];
475
+ for (let index = 0;index < items.length; index += size)
476
+ out.push(items.slice(index, index + size));
477
+ return out;
478
+ }
479
+ async function uploadMissingArtifactBodies(bodies, store) {
480
+ const byHash = new Map(bodies.map((body) => [body.hash, body]));
481
+ if (byHash.size === 0)
482
+ return { referenced: 0, uploaded: 0, batches: 0 };
483
+ const missing = new Set;
484
+ for (const hashes of chunk([...byHash.keys()], MAX_ARTIFACT_BODY_HASH_QUERY)) {
485
+ const answer = await store.missing(hashes);
486
+ const asked = new Set(hashes);
487
+ for (const hash of answer)
488
+ if (asked.has(hash))
489
+ missing.add(hash);
490
+ }
491
+ const batches = [];
492
+ let current = [];
493
+ let currentBytes = 0;
494
+ for (const hash of missing) {
495
+ const entry = { hash, body: byHash.get(hash).body };
496
+ const entryBytes = encoder.encode(JSON.stringify(entry)).length + 1;
497
+ if (current.length > 0 && (current.length >= MAX_ARTIFACT_BODY_UPLOAD_COUNT || currentBytes + entryBytes > MAX_ARTIFACT_BODY_UPLOAD_BYTES)) {
498
+ batches.push(current);
499
+ current = [];
500
+ currentBytes = 0;
501
+ }
502
+ current.push(entry);
503
+ currentBytes += entryBytes;
504
+ }
505
+ if (current.length > 0)
506
+ batches.push(current);
507
+ for (const batch of batches)
508
+ await store.upload(batch);
509
+ return { referenced: byHash.size, uploaded: missing.size, batches: batches.length };
510
+ }
511
+ async function storeShortenedArtifactBodies(graph, fullBodies, store, options = {}) {
512
+ const bodies = referencedFullBodies(graph, fullBodies);
513
+ try {
514
+ return await uploadMissingArtifactBodies(bodies, store);
515
+ } catch (error) {
516
+ if (!options.keepHashesOnError)
517
+ stripArtifactBodyHashes(graph);
518
+ return { referenced: bodies.length, uploaded: 0, batches: 0, error };
519
+ }
520
+ }
521
+ export { 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, redactArtifactBody, MAX_STORED_ARTIFACT_BODY_BYTES, captureFullArtifactBodies, fitGraphForSync, storeShortenedArtifactBodies };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createCliOutput,
3
3
  outputModeFromFlags
4
- } from "./cli-z1t3sf7b.js";
4
+ } from "./cli-1nd4339b.js";
5
5
 
6
6
  // src/command-context.ts
7
7
  function flagEnabled(flags, key) {
@@ -12,7 +12,7 @@ import {
12
12
  } from "./cli-k4tqwah4.js";
13
13
  import {
14
14
  redactDeep
15
- } from "./cli-p5grm12t.js";
15
+ } from "./cli-0semcakc.js";
16
16
 
17
17
  // src/profiles.ts
18
18
  import {
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  fetchApiKeyProbe
3
- } from "./cli-snswkrxd.js";
3
+ } from "./cli-998n4kz9.js";
4
4
  import {
5
5
  authFetch,
6
6
  getCachedLoginContext
7
- } from "./cli-rrggdmf8.js";
7
+ } from "./cli-qwnkv4jy.js";
8
8
  import {
9
9
  embeddedTenantIdFromApiKey,
10
10
  getModaDir,
@@ -15,7 +15,7 @@ import {
15
15
  resolveTenantIdFromActiveProfile,
16
16
  saveCliConfig,
17
17
  writeSecretJsonFile
18
- } from "./cli-z1t3sf7b.js";
18
+ } from "./cli-1nd4339b.js";
19
19
  import {
20
20
  CliAccessError,
21
21
  CliInputError,
@@ -2,7 +2,7 @@ import {
2
2
  ApiError,
3
3
  callControlAPI,
4
4
  callDataAPI
5
- } from "./cli-87xy1evx.js";
5
+ } from "./cli-dxajrq9h.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-z1t3sf7b.js";
14
+ } from "./cli-1nd4339b.js";
15
15
  import {
16
16
  CliAccessError,
17
17
  CliInputError
@@ -5,13 +5,13 @@ import {
5
5
  import {
6
6
  assertFlags,
7
7
  assertPositionals
8
- } from "./cli-22yvg5kh.js";
8
+ } from "./cli-6ga6kmdp.js";
9
9
  import {
10
10
  callControlAPI
11
- } from "./cli-87xy1evx.js";
11
+ } from "./cli-dxajrq9h.js";
12
12
  import {
13
13
  createCommandContext
14
- } from "./cli-5ms8rw8x.js";
14
+ } from "./cli-13zdcv4w.js";
15
15
  import {
16
16
  CliInputError
17
17
  } from "./cli-k4tqwah4.js";
@@ -5543,7 +5543,7 @@ import {
5543
5543
  import { dirname, isAbsolute, join, relative, resolve } from "node:path";
5544
5544
  var promptSourcesModule;
5545
5545
  async function loadPromptSources() {
5546
- promptSourcesModule ??= await import("./prompt-sources-3mq04qc6.js");
5546
+ promptSourcesModule ??= await import("./prompt-sources-x5z4p7n5.js");
5547
5547
  return promptSourcesModule;
5548
5548
  }
5549
5549
  var MODA_DIR = ".moda";
@@ -5768,7 +5768,7 @@ async function runPromptSyncExclusive(flags, profileOptions, options) {
5768
5768
  const analyzedDefinitions = new Map;
5769
5769
  if (flags["no-analyze"] !== "true") {
5770
5770
  options.onProgress?.("Analyzing prompt sources before sync.");
5771
- const { analyzeHarnessPrompts } = await import("./harness-5v0wxmj7.js");
5771
+ const { analyzeHarnessPrompts } = await import("./harness-kr06zrhh.js");
5772
5772
  const result = await analyzeHarnessPrompts({
5773
5773
  rootDir: process.cwd(),
5774
5774
  existing: established.flatMap((prompt) => prompt.sourceDefinition ? [prompt.sourceDefinition.source] : []),
@@ -5796,7 +5796,7 @@ async function runPromptSyncExclusive(flags, profileOptions, options) {
5796
5796
  const mergedSources = mergePromptSources(manifest.sources, extraSources);
5797
5797
  const manifestUpdate = stableJson(mergedSources) === stableJson(mergePromptSources(manifest.sources, [])) ? undefined : $stringify({ version: 2, prompt_paths: manifest.promptPaths, sources: mergedSources });
5798
5798
  const prompts = await discoverPrompts(extraSources);
5799
- const { checkPromptAttribution } = await import("./prompt-attribution-13eyebd7.js");
5799
+ const { checkPromptAttribution } = await import("./prompt-attribution-1cwnp7fb.js");
5800
5800
  const attribution = checkPromptAttribution(process.cwd(), prompts.map((prompt) => prompt.key));
5801
5801
  const brokenAttribution = attribution.references.filter((reference) => reference.status === "missing");
5802
5802
  if (brokenAttribution.length) {
@@ -6102,7 +6102,7 @@ async function migratePromptManifest(options = {}) {
6102
6102
  let addedSources = [];
6103
6103
  let pendingSources = [];
6104
6104
  if (options.discover) {
6105
- const { analyzeHarnessPrompts } = await import("./harness-5v0wxmj7.js");
6105
+ const { analyzeHarnessPrompts } = await import("./harness-kr06zrhh.js");
6106
6106
  const result = await analyzeHarnessPrompts({
6107
6107
  rootDir: root,
6108
6108
  existing: manifest.sources,
@@ -5,7 +5,7 @@ import {
5
5
  resolveApiKey,
6
6
  resolveApiKeyFromActiveProfile,
7
7
  resolveModaBaseUrl
8
- } from "./cli-z1t3sf7b.js";
8
+ } from "./cli-1nd4339b.js";
9
9
 
10
10
  // src/api-key-auth.ts
11
11
  var PROBE_TIMEOUT_MS = 1e4;