@moda-ai/cli 1.55.14 → 1.55.16

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 (31) hide show
  1. package/README.md +12 -0
  2. package/dist/{agent-y47qgmf1.js → agent-a2xwfeeh.js} +9 -9
  3. package/dist/{cli-ryd7nzke.js → cli-2ars875d.js} +2 -2
  4. package/dist/{cli-bfmn3bsk.js → cli-3gwbg0xp.js} +2 -2
  5. package/dist/{cli-4qe6n8am.js → cli-438g4nwh.js} +122 -2
  6. package/dist/{cli-k7vwt56h.js → cli-53mvsfgn.js} +3 -3
  7. package/dist/{cli-ssqb8bfw.js → cli-6ca1sz0a.js} +1 -1
  8. package/dist/{cli-k9nae6t9.js → cli-7fc44hhq.js} +1123 -187
  9. package/dist/{cli-ndn5m6wn.js → cli-86q35fpq.js} +8 -8
  10. package/dist/{cli-09rr5smg.js → cli-atx672xv.js} +1 -1
  11. package/dist/{cli-kwz900s4.js → cli-b3cxcxgn.js} +5 -4
  12. package/dist/{cli-4x9w6ey7.js → cli-kf3d6y8c.js} +1 -1
  13. package/dist/{cli-weqp7xc1.js → cli-xy6zn80e.js} +5 -5
  14. package/dist/{cli-y8gbbe9k.js → cli-zdeywyn9.js} +4 -4
  15. package/dist/cli.js +504 -150
  16. package/dist/{doctor-grvx6xx0.js → doctor-e2xrbpmp.js} +9 -9
  17. package/dist/{fix-91sr76gw.js → fix-v8xka487.js} +7 -7
  18. package/dist/{harness-vm0xd80p.js → harness-28wbzncq.js} +6 -6
  19. package/dist/{harness-github-actions-tmy3gqwa.js → harness-github-actions-301nak95.js} +6 -6
  20. package/dist/{index-f6cydfxg.js → index-ccdpy9ma.js} +11 -11
  21. package/dist/{production-intelligence-mg3qp2dg.js → production-intelligence-0wqcvvxk.js} +6 -5
  22. package/dist/{profile-commands-2g5bjzj2.js → profile-commands-f5kysjrv.js} +3 -3
  23. package/dist/prompt-source-mcp.js +6 -6
  24. package/dist/{prompts-kw5kzm39.js → prompts-jg0stjfb.js} +7 -7
  25. package/dist/{provision-rm0yc08f.js → provision-25bw5rd7.js} +4 -4
  26. package/dist/{registry-mbz65bjy.js → registry-39xzetsc.js} +4 -4
  27. package/dist/{skills-sagxq9sc.js → skills-gjesa81c.js} +6 -6
  28. package/dist/{sync-xv04wnth.js → sync-7ts9psky.js} +8 -8
  29. package/package.json +1 -1
  30. package/skills/integration/index.json +2 -2
  31. package/skills/moda-cli/SKILL.md +31 -4
package/README.md CHANGED
@@ -76,8 +76,20 @@ moda search "stripe.charges.create" --mode=keyword # Exact identifiers, incl. to
76
76
  moda search "checkout" --include-tool-io # Search tool inputs/outputs too
77
77
  moda context <conversation_id> --msg-index=5 # Read the exact turn
78
78
  moda audit <conversation_id|trace_id> # Raw span audit (trace ID or OTLP trace_id)
79
+ moda context <id>@12 <id2>@3 --window=2 # Batch: several traces in one call (max 25)
80
+ moda audit <id1> <id2> # Batch audit
81
+ jq -r '...' | moda context --ids-from=- # Batch targets from stdin (or --ids-from=<file>)
79
82
  ```
80
83
 
84
+ Batch reads: `moda context` and `moda audit` take up to 25 targets (several
85
+ positionals, or one per line with `--ids-from=-` / `--ids-from=<file>`). A
86
+ context target is `<id>` or `<id>@<msg_index>`; ids may contain `:`, and a line
87
+ may be JSON (`{"id":"...","msg_index":N}`) for an id that ends in `@<digits>`.
88
+ Audit ids are verbatim. The output is `{ results: [{ target, ok, data | error }],
89
+ succeeded, failed, has_more, remaining_targets }`; a missing trace is a per-item
90
+ `not_found`, and the exit code is 1 only when every target failed. One id keeps
91
+ the single-trace output.
92
+
81
93
  Production intelligence:
82
94
 
83
95
  ```bash
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  buildDoctorReport
3
- } from "./cli-weqp7xc1.js";
4
- import"./cli-ssqb8bfw.js";
5
- import"./cli-ndn5m6wn.js";
3
+ } from "./cli-xy6zn80e.js";
4
+ import"./cli-6ca1sz0a.js";
5
+ import"./cli-86q35fpq.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-k9nae6t9.js";
17
+ } from "./cli-7fc44hhq.js";
18
18
  import"./cli-97fnztpy.js";
19
- import"./cli-4x9w6ey7.js";
20
- import"./cli-k7vwt56h.js";
21
- import"./cli-ryd7nzke.js";
22
- import"./cli-09rr5smg.js";
19
+ import"./cli-kf3d6y8c.js";
20
+ import"./cli-53mvsfgn.js";
21
+ import"./cli-2ars875d.js";
22
+ import"./cli-atx672xv.js";
23
23
  import {
24
24
  CliInputError,
25
25
  resolveApiKey,
26
26
  resolveIngestUrl,
27
27
  resolveModaBaseUrl,
28
28
  resolveTenantId
29
- } from "./cli-kwz900s4.js";
29
+ } from "./cli-b3cxcxgn.js";
30
30
  import"./cli-0v6na3yp.js";
31
31
 
32
32
  // src/agent.ts
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  apiKeyHeaders
3
- } from "./cli-09rr5smg.js";
3
+ } from "./cli-atx672xv.js";
4
4
  import {
5
5
  recordApiRequest,
6
6
  resolveApiKey,
7
7
  resolveModaBaseUrl
8
- } from "./cli-kwz900s4.js";
8
+ } from "./cli-b3cxcxgn.js";
9
9
 
10
10
  // src/api-client.ts
11
11
  var REQUEST_TIMEOUT_MS = 30000;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  authFetch,
3
3
  getCachedLoginContext
4
- } from "./cli-ssqb8bfw.js";
4
+ } from "./cli-6ca1sz0a.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-kwz900s4.js";
19
+ } from "./cli-b3cxcxgn.js";
20
20
 
21
21
  // src/init/tenant.ts
22
22
  import { randomUUID } from "node:crypto";
@@ -1,3 +1,123 @@
1
+ import {
2
+ CliInputError
3
+ } from "./cli-b3cxcxgn.js";
4
+
5
+ // src/batch-reads.ts
6
+ import { readFile } from "node:fs/promises";
7
+ var BATCH_MAX_TARGETS = 25;
8
+ var BATCH_CONCURRENCY = 4;
9
+ var ANCHOR_SUFFIX = /^(.+)@(\d+)$/;
10
+ function parseBatchTarget(text, anchors, usage) {
11
+ const raw = text.trim();
12
+ if (raw.startsWith("{")) {
13
+ let parsed;
14
+ try {
15
+ parsed = JSON.parse(raw);
16
+ } catch {
17
+ throw new CliInputError(`Could not parse the JSON target ${JSON.stringify(raw)}.`, usage, "bad_batch_target");
18
+ }
19
+ const record = parsed;
20
+ const id = record?.id ?? record?.conversation_id ?? record?.trace_id;
21
+ if (typeof id !== "string" || id.trim() === "") {
22
+ throw new CliInputError(`JSON target ${JSON.stringify(raw)} has no "id" string.`, usage, "bad_batch_target");
23
+ }
24
+ const index = record.msg_index ?? record.message_index;
25
+ if (index !== undefined && index !== null) {
26
+ if (!anchors) {
27
+ throw new CliInputError(`JSON target ${JSON.stringify(raw)} has a msg_index, which this command does not take.`, usage, "bad_batch_target");
28
+ }
29
+ if (typeof index !== "number" || !Number.isSafeInteger(index) || index < 0) {
30
+ throw new CliInputError(`JSON target ${JSON.stringify(raw)} has an invalid msg_index (want an integer >= 0).`, usage, "bad_batch_target");
31
+ }
32
+ return { raw, id, msgIndex: index };
33
+ }
34
+ return { raw, id };
35
+ }
36
+ if (anchors) {
37
+ const match = ANCHOR_SUFFIX.exec(raw);
38
+ if (match) {
39
+ const msgIndex = Number(match[2]);
40
+ if (!Number.isSafeInteger(msgIndex)) {
41
+ throw new CliInputError(`Target ${JSON.stringify(raw)} has an @msg_index past ${Number.MAX_SAFE_INTEGER}. ` + 'If the id itself ends in @<digits>, pass it as {"id": "..."}.', usage, "bad_batch_target");
42
+ }
43
+ return { raw, id: match[1], msgIndex };
44
+ }
45
+ }
46
+ return { raw, id: raw };
47
+ }
48
+ function parseTargetLines(text, anchors, usage) {
49
+ return text.split(/\r?\n/).map((line) => line.trim()).filter((line) => line !== "").map((line) => parseBatchTarget(line, anchors, usage));
50
+ }
51
+ async function readStdinText() {
52
+ if (process.stdin.isTTY) {
53
+ throw new CliInputError("--ids-from=- reads targets from stdin, but stdin is a terminal. Pipe ids in (one per line) or pass a file path.", undefined, "ids_from_tty");
54
+ }
55
+ const chunks = [];
56
+ for await (const chunk of process.stdin)
57
+ chunks.push(typeof chunk === "string" ? Buffer.from(chunk) : chunk);
58
+ return Buffer.concat(chunks).toString("utf8");
59
+ }
60
+ async function readIdsFrom(source, usage) {
61
+ if (source === "" || source === "true") {
62
+ throw new CliInputError("--ids-from needs a value: - (stdin) or a file path.", usage, "missing_flag_value");
63
+ }
64
+ if (source === "-")
65
+ return readStdinText();
66
+ try {
67
+ return await readFile(source, "utf8");
68
+ } catch (error) {
69
+ const code = error.code;
70
+ throw new CliInputError(`Could not read --ids-from file ${JSON.stringify(source)}${typeof code === "string" ? ` (${code})` : ""}.`, usage, "ids_from_unreadable");
71
+ }
72
+ }
73
+ async function collectBatchTargets(positionals, idsFrom, options) {
74
+ const targets = positionals.map((value) => parseBatchTarget(value, options.anchors, options.usage));
75
+ if (idsFrom !== undefined) {
76
+ targets.push(...parseTargetLines(await readIdsFrom(idsFrom, options.usage), options.anchors, options.usage));
77
+ }
78
+ const seen = new Set;
79
+ const unique = targets.filter((target) => {
80
+ const key = `${target.id}\x00${target.msgIndex ?? ""}`;
81
+ if (seen.has(key))
82
+ return false;
83
+ seen.add(key);
84
+ return true;
85
+ });
86
+ if (unique.length === 0) {
87
+ throw new CliInputError(`No targets: --ids-from gave no ids (one per line).`, options.usage, "missing_positional");
88
+ }
89
+ if (unique.length > BATCH_MAX_TARGETS) {
90
+ throw new CliInputError(`Got ${unique.length} targets; 'moda ${options.command}' reads at most ${BATCH_MAX_TARGETS} per call, so nothing was read. ` + `Split the ids into calls of ${BATCH_MAX_TARGETS} or fewer.`, options.usage, "batch_too_large");
91
+ }
92
+ return unique;
93
+ }
94
+ async function mapWithConcurrency(items, limit, fn) {
95
+ const results = new Array(items.length);
96
+ let next = 0;
97
+ let failure;
98
+ const worker = async () => {
99
+ while (!failure && next < items.length) {
100
+ const index = next++;
101
+ try {
102
+ results[index] = await fn(items[index], index);
103
+ } catch (error) {
104
+ failure ??= { error };
105
+ }
106
+ }
107
+ };
108
+ await Promise.all(Array.from({ length: Math.max(1, Math.min(limit, items.length)) }, worker));
109
+ if (failure)
110
+ throw failure.error;
111
+ return results;
112
+ }
113
+ function idNeedsJsonTarget(id) {
114
+ return ANCHOR_SUFFIX.test(id);
115
+ }
116
+ function contextTarget(id) {
117
+ const verbatim = id === id.trim() && !id.startsWith("{") && !idNeedsJsonTarget(id);
118
+ return verbatim ? id : JSON.stringify({ id });
119
+ }
120
+
1
121
  // src/transforms.ts
2
122
  function asRecord(value) {
3
123
  if (value && typeof value === "object" && !Array.isArray(value)) {
@@ -165,7 +285,7 @@ function trimToolFailureConversations(response, opts) {
165
285
  const msgIndex = asNumber(asRecord(row.anchor)?.msg_index) ?? asNumber(row.msg_index);
166
286
  return {
167
287
  ...rest,
168
- ...conversationId && msgIndex !== null ? { context_command: `moda context ${shellWord(conversationId)} --msg-index=${msgIndex} --window=${TOOL_FAILURE_CONTEXT_RADIUS}` } : {},
288
+ ...conversationId && msgIndex !== null ? { context_command: `moda context ${shellWord(contextTarget(conversationId))} --msg-index=${msgIndex} --window=${TOOL_FAILURE_CONTEXT_RADIUS}` } : {},
169
289
  ...opts.drop ? {} : { conversation: trimFailureWindow(conversation, TOOL_FAILURE_CONTEXT_RADIUS, msgIndex) },
170
290
  ..."window" in row ? { window: trimFailureWindow(window, opts.windowRadius ?? TOOL_FAILURE_CONTEXT_RADIUS, msgIndex) } : {}
171
291
  };
@@ -342,4 +462,4 @@ var MODA_INTELLIGENCE_V1_JSON_SCHEMA = {
342
462
  }
343
463
  };
344
464
 
345
- export { asRecord, asString, asNumber, frustrationAnchorIndex, frustrationsFromEmotions, withFrustrationAnchors, shellWord, trimToolFailureConversations, withToolFailureAnchors, embeddedWindowSize, INTELLIGENCE_SCHEMA_VERSION, MODA_INTELLIGENCE_V1_JSON_SCHEMA };
465
+ export { BATCH_MAX_TARGETS, BATCH_CONCURRENCY, parseBatchTarget, collectBatchTargets, mapWithConcurrency, contextTarget, asRecord, asString, asNumber, frustrationAnchorIndex, frustrationsFromEmotions, withFrustrationAnchors, shellWord, trimToolFailureConversations, withToolFailureAnchors, embeddedWindowSize, INTELLIGENCE_SCHEMA_VERSION, MODA_INTELLIGENCE_V1_JSON_SCHEMA };
@@ -2,18 +2,18 @@ import {
2
2
  ApiError,
3
3
  callControlAPI,
4
4
  callDataAPI
5
- } from "./cli-ryd7nzke.js";
5
+ } from "./cli-2ars875d.js";
6
6
  import {
7
7
  isPlatformApiKey,
8
8
  setPlatformTenantOverride
9
- } from "./cli-09rr5smg.js";
9
+ } from "./cli-atx672xv.js";
10
10
  import {
11
11
  CliAccessError,
12
12
  CliInputError,
13
13
  embeddedTenantIdFromApiKey,
14
14
  resolveApiKey,
15
15
  resolveApiTenantId
16
- } from "./cli-kwz900s4.js";
16
+ } from "./cli-b3cxcxgn.js";
17
17
 
18
18
  // src/parity-commands.ts
19
19
  import { readFileSync } from "node:fs";
@@ -8,7 +8,7 @@ import {
8
8
  saveProfileConfig,
9
9
  secretFilePathFromRef,
10
10
  writeSecretJsonFile
11
- } from "./cli-kwz900s4.js";
11
+ } from "./cli-b3cxcxgn.js";
12
12
  import {
13
13
  __require
14
14
  } from "./cli-0v6na3yp.js";