@moda-ai/cli 1.55.27 → 1.55.28
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.
- package/dist/{agent-vp9prdma.js → agent-0w9rtdsw.js} +22 -16
- package/dist/cli-3n0gz4d0.js +17971 -0
- package/dist/{cli-q9nsvqqg.js → cli-3retgh64.js} +85 -1165
- package/dist/{cli-ccjfwzqx.js → cli-97jew729.js} +1 -1
- package/dist/{cli-r5pp7qny.js → cli-99p2jh28.js} +42 -456
- package/dist/{cli-0pkc8jhg.js → cli-9bgk5jeh.js} +8 -6
- package/dist/{cli-hmjdgxrn.js → cli-9bgnvth2.js} +5 -3
- package/dist/cli-9kfxkxmk.js +6994 -0
- package/dist/cli-cesds766.js +1516 -0
- package/dist/{cli-v8q7sd7g.js → cli-dr6x0zv7.js} +1 -1
- package/dist/{cli-pg5qfmqc.js → cli-e23g9ywa.js} +1 -1
- package/dist/{cli-vdkwkkp5.js → cli-fwpqghgc.js} +4 -2
- package/dist/cli-k4tqwah4.js +89 -0
- package/dist/{cli-6et4z504.js → cli-mg5zv4s6.js} +15 -13
- package/dist/{cli-wzds257x.js → cli-n2hng3gv.js} +6 -4
- package/dist/cli-ns5fcnkz.js +341 -0
- package/dist/{cli-4h0ave0f.js → cli-ny48a8de.js} +12 -9
- package/dist/{cli-qwgct6x7.js → cli-qpq84eee.js} +5220 -32716
- package/dist/cli-xq45etg1.js +1098 -0
- package/dist/cli-yf39avhh.js +754 -0
- package/dist/cli-yz8xcpyk.js +12 -0
- package/dist/cli.js +77 -153
- package/dist/doctor-k3ta6h2y.js +24 -0
- package/dist/{fix-75s9s0d6.js → fix-w5z02wt4.js} +8 -9
- package/dist/{harness-a7tb9a23.js → harness-7azmzytc.js} +15 -7
- package/dist/{harness-github-actions-6v4wydb8.js → harness-github-actions-bv2qrnqb.js} +11 -5
- package/dist/harness-report-rd9c4e9v.js +54 -0
- package/dist/{index-91bpc8g8.js → index-d1z50dsq.js} +41 -33
- package/dist/{production-intelligence-7nqddd4f.js → production-intelligence-wvsgjxth.js} +9 -6
- package/dist/{profile-commands-49yn02yg.js → profile-commands-h8evz9x0.js} +7 -4
- package/dist/prompt-attribution-1nytc9wj.js +148 -0
- package/dist/prompt-source-mcp.js +14 -7
- package/dist/prompt-sources-07tczyqa.js +19 -0
- package/dist/{prompts-17wyrst6.js → prompts-6y9wfq5z.js} +8 -7
- package/dist/prompts-ab-ezrd63sk.js +70 -0
- package/dist/prompts-propose-2k3enm2q.js +255 -0
- package/dist/{provision-bc3h68e1.js → provision-y5bdbh4y.js} +9 -6
- package/dist/{registry-fpzhjznj.js → registry-96aze5wp.js} +7 -4
- package/dist/{skills-ccdbqghj.js → skills-j8865009.js} +7 -5
- package/dist/{sync-hkxce5zh.js → sync-ew7yvy0e.js} +16 -10
- package/package.json +1 -1
- package/skills/integration/index.json +2 -2
- package/dist/doctor-wmre3mr7.js +0 -22
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
callControlAPI
|
|
3
|
+
} from "./cli-e23g9ywa.js";
|
|
4
|
+
|
|
5
|
+
// src/replay-runs.ts
|
|
6
|
+
var DEFAULT_POLL_INTERVAL_MS = 15000;
|
|
7
|
+
var DEFAULT_WAIT_TIMEOUT_MS = 2 * 60 * 60 * 1000;
|
|
8
|
+
async function fetchLatestRun(tenantId, replaySetId, runId, profileOptions) {
|
|
9
|
+
return callControlAPI(`/tenants/${encodeURIComponent(tenantId)}/replay-sets/${encodeURIComponent(replaySetId)}/runs/latest?runId=${encodeURIComponent(runId)}`, { method: "GET" }, profileOptions, { timeoutMs: 60000, retries: 2 });
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { DEFAULT_POLL_INTERVAL_MS, DEFAULT_WAIT_TIMEOUT_MS, fetchLatestRun };
|
package/dist/cli.js
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
withFrustrationAnchors,
|
|
18
18
|
withToolFailureAnchors,
|
|
19
19
|
withoutDetectionWindows
|
|
20
|
-
} from "./cli-
|
|
20
|
+
} from "./cli-fwpqghgc.js";
|
|
21
21
|
import {
|
|
22
22
|
createCommandContext,
|
|
23
23
|
envOptOutSet,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
optOutFlagSet,
|
|
26
26
|
parseBooleanFlagValue,
|
|
27
27
|
withoutFlag
|
|
28
|
-
} from "./cli-
|
|
28
|
+
} from "./cli-dr6x0zv7.js";
|
|
29
29
|
import {
|
|
30
30
|
AuditSchema,
|
|
31
31
|
COMMAND_FLAG_SPECS,
|
|
@@ -67,20 +67,14 @@ import {
|
|
|
67
67
|
unknownSignalsSubcommandError,
|
|
68
68
|
usageLine,
|
|
69
69
|
writeDryRun
|
|
70
|
-
} from "./cli-
|
|
70
|
+
} from "./cli-n2hng3gv.js";
|
|
71
71
|
import {
|
|
72
72
|
ApiError,
|
|
73
73
|
callControlAPI,
|
|
74
74
|
callDataAPI
|
|
75
|
-
} from "./cli-
|
|
75
|
+
} from "./cli-e23g9ywa.js";
|
|
76
76
|
import {
|
|
77
77
|
AGENT_ERROR_CODES,
|
|
78
|
-
CliAccessError,
|
|
79
|
-
CliAuthError,
|
|
80
|
-
CliCancellationError,
|
|
81
|
-
CliInputError,
|
|
82
|
-
CliInputRequiredError,
|
|
83
|
-
CliNotFoundError,
|
|
84
78
|
EXIT_AUTH_REQUIRED,
|
|
85
79
|
EXIT_CANCELLED,
|
|
86
80
|
EXIT_DEGRADED,
|
|
@@ -92,18 +86,13 @@ import {
|
|
|
92
86
|
VERSION,
|
|
93
87
|
agentEnvelopeFits,
|
|
94
88
|
agentMaxOutputBytes,
|
|
95
|
-
apiErrorStatus,
|
|
96
89
|
apiKeyHeaders,
|
|
97
|
-
attachInputDetails,
|
|
98
90
|
canonicalCommandText,
|
|
99
91
|
createCliOutput,
|
|
100
92
|
embeddedTenantIdFromApiKey,
|
|
101
93
|
errorToAgentError,
|
|
102
94
|
getApiRequestCount,
|
|
103
95
|
getModaDir,
|
|
104
|
-
inputDetailsOf,
|
|
105
|
-
isApiLikeError,
|
|
106
|
-
isNetworkLikeError,
|
|
107
96
|
isPlatformApiKey,
|
|
108
97
|
loadProfileConfig,
|
|
109
98
|
resetApiRequestCount,
|
|
@@ -119,7 +108,21 @@ import {
|
|
|
119
108
|
shellArg,
|
|
120
109
|
validateConfig,
|
|
121
110
|
wasOutputCancelled
|
|
122
|
-
} from "./cli-
|
|
111
|
+
} from "./cli-99p2jh28.js";
|
|
112
|
+
import {
|
|
113
|
+
CliAccessError,
|
|
114
|
+
CliAuthError,
|
|
115
|
+
CliCancellationError,
|
|
116
|
+
CliInputError,
|
|
117
|
+
CliInputRequiredError,
|
|
118
|
+
CliNotFoundError,
|
|
119
|
+
apiErrorStatus,
|
|
120
|
+
attachInputDetails,
|
|
121
|
+
inputDetailsOf,
|
|
122
|
+
isApiLikeError,
|
|
123
|
+
isNetworkLikeError
|
|
124
|
+
} from "./cli-k4tqwah4.js";
|
|
125
|
+
import"./cli-ns5fcnkz.js";
|
|
123
126
|
import {
|
|
124
127
|
__require
|
|
125
128
|
} from "./cli-0v6na3yp.js";
|
|
@@ -2639,46 +2642,46 @@ function leafManifestFields(leaf, commands) {
|
|
|
2639
2642
|
import { fileURLToPath } from "url";
|
|
2640
2643
|
import { realpathSync } from "fs";
|
|
2641
2644
|
async function runPromptsCommand(...args) {
|
|
2642
|
-
return (await import("./prompts-
|
|
2645
|
+
return (await import("./prompts-6y9wfq5z.js")).runPromptsCommand(...args);
|
|
2643
2646
|
}
|
|
2644
2647
|
async function runSkillsCommand(...args) {
|
|
2645
|
-
return (await import("./skills-
|
|
2648
|
+
return (await import("./skills-j8865009.js")).runSkillsCommand(...args);
|
|
2646
2649
|
}
|
|
2647
2650
|
async function runFixCommand(...args) {
|
|
2648
|
-
return (await import("./fix-
|
|
2651
|
+
return (await import("./fix-w5z02wt4.js")).runFixCommand(...args);
|
|
2649
2652
|
}
|
|
2650
2653
|
async function runFixesCommand(...args) {
|
|
2651
|
-
return (await import("./fix-
|
|
2654
|
+
return (await import("./fix-w5z02wt4.js")).runFixesCommand(...args);
|
|
2652
2655
|
}
|
|
2653
2656
|
async function runHarnessCommand(...args) {
|
|
2654
|
-
return (await import("./harness-
|
|
2657
|
+
return (await import("./harness-7azmzytc.js")).runHarnessCommand(...args);
|
|
2655
2658
|
}
|
|
2656
2659
|
async function runSyncCommand(...args) {
|
|
2657
|
-
return (await import("./sync-
|
|
2660
|
+
return (await import("./sync-ew7yvy0e.js")).runSyncCommand(...args);
|
|
2658
2661
|
}
|
|
2659
2662
|
async function runRegistryCommand(...args) {
|
|
2660
|
-
return (await import("./registry-
|
|
2663
|
+
return (await import("./registry-96aze5wp.js")).runRegistryCommand(...args);
|
|
2661
2664
|
}
|
|
2662
2665
|
async function runDoctorCommand(...args) {
|
|
2663
|
-
return (await import("./doctor-
|
|
2666
|
+
return (await import("./doctor-k3ta6h2y.js")).runDoctorCommand(...args);
|
|
2664
2667
|
}
|
|
2665
2668
|
async function runStatusCommand(...args) {
|
|
2666
|
-
return (await import("./doctor-
|
|
2669
|
+
return (await import("./doctor-k3ta6h2y.js")).runStatusCommand(...args);
|
|
2667
2670
|
}
|
|
2668
2671
|
async function runAuthCommand(...args) {
|
|
2669
|
-
return (await import("./profile-commands-
|
|
2672
|
+
return (await import("./profile-commands-h8evz9x0.js")).runAuthCommand(...args);
|
|
2670
2673
|
}
|
|
2671
2674
|
async function runConfigCommand(...args) {
|
|
2672
|
-
return (await import("./profile-commands-
|
|
2675
|
+
return (await import("./profile-commands-h8evz9x0.js")).runConfigCommand(...args);
|
|
2673
2676
|
}
|
|
2674
2677
|
async function runProfilesCommand(...args) {
|
|
2675
|
-
return (await import("./profile-commands-
|
|
2678
|
+
return (await import("./profile-commands-h8evz9x0.js")).runProfilesCommand(...args);
|
|
2676
2679
|
}
|
|
2677
2680
|
async function runAgentCommand(...args) {
|
|
2678
|
-
return (await import("./agent-
|
|
2681
|
+
return (await import("./agent-0w9rtdsw.js")).runAgentCommand(...args);
|
|
2679
2682
|
}
|
|
2680
2683
|
async function runProductionCommand(...args) {
|
|
2681
|
-
return (await import("./production-intelligence-
|
|
2684
|
+
return (await import("./production-intelligence-wvsgjxth.js")).runProductionCommand(...args);
|
|
2682
2685
|
}
|
|
2683
2686
|
function parseArgs(argv) {
|
|
2684
2687
|
const args = argv.slice(2);
|
|
@@ -3376,23 +3379,21 @@ function noWorldStateWarnings(conversationId, isMissing) {
|
|
|
3376
3379
|
}
|
|
3377
3380
|
var AUDIT_DEFAULT_LIMIT = 200;
|
|
3378
3381
|
var AUDIT_MAX_LIMIT = 1000;
|
|
3379
|
-
function auditCapStatus(data
|
|
3382
|
+
function auditCapStatus(data) {
|
|
3380
3383
|
const record = asRecord(data);
|
|
3381
3384
|
if (!record)
|
|
3382
3385
|
return null;
|
|
3383
3386
|
const summary = asRecord(record.summary) ?? {};
|
|
3384
3387
|
const rows = (asNumber(summary.ingest_rows) ?? (Array.isArray(record.ingest) ? record.ingest.length : 0)) + (asNumber(record.parse_errors) ?? 0);
|
|
3385
3388
|
const spans = asNumber(summary.total_spans) ?? (Array.isArray(record.spans) ? record.spans.length : 0);
|
|
3386
|
-
const
|
|
3389
|
+
const rowsCapped = record.has_more === true || summary.has_more === true;
|
|
3387
3390
|
const spansCapped = summary.truncated === true || record.truncated === true;
|
|
3388
|
-
const serverSaid = typeof record.has_more === "boolean" || typeof summary.has_more === "boolean";
|
|
3389
|
-
const rowsCapped = hasMore || !serverSaid && rows >= limit;
|
|
3390
3391
|
if (!rowsCapped && !spansCapped)
|
|
3391
3392
|
return null;
|
|
3392
3393
|
const reason = typeof summary.truncated_reason === "string" ? summary.truncated_reason : null;
|
|
3393
3394
|
const cursorValue = summary.next_cursor ?? record.next_cursor;
|
|
3394
3395
|
const nextCursor = typeof cursorValue === "string" && cursorValue ? cursorValue : null;
|
|
3395
|
-
return { rowsCapped, spansCapped,
|
|
3396
|
+
return { rowsCapped, spansCapped, rows, spans, reason, nextCursor };
|
|
3396
3397
|
}
|
|
3397
3398
|
var AUDIT_AGENT_RESERVE_BYTES = 16384;
|
|
3398
3399
|
function auditMaxBytes(budgetBytes) {
|
|
@@ -3463,7 +3464,7 @@ function auditOutput(command, params, data, keep) {
|
|
|
3463
3464
|
}
|
|
3464
3465
|
};
|
|
3465
3466
|
}
|
|
3466
|
-
const capped = auditCapStatus(data
|
|
3467
|
+
const capped = auditCapStatus(data);
|
|
3467
3468
|
if (!capped || !record) {
|
|
3468
3469
|
return {
|
|
3469
3470
|
data: record ? { ...record, truncated: false, has_more: false, next_cursor: null } : data,
|
|
@@ -3488,7 +3489,7 @@ function auditOutput(command, params, data, keep) {
|
|
|
3488
3489
|
warnings.push(`Spans were capped: the page reached the server's per-page span cap after ${capped.rows} ingest row(s), so this trace has more spans than the ${shownText}. Continue with the next_cursor page. Orphan/duplicate analysis covers this page only.`);
|
|
3489
3490
|
} else if (capped.rowsCapped) {
|
|
3490
3491
|
const bigger = Math.min(AUDIT_MAX_LIMIT, limit * 5);
|
|
3491
|
-
warnings.push(`Spans were capped: read ${capped.rows} ingest row(s), the --limit=${limit} maximum, so this trace
|
|
3492
|
+
warnings.push(`Spans were capped: read ${capped.rows} ingest row(s), the --limit=${limit} maximum, so this trace has more spans than the ${shownText}. ` + (capped.nextCursor ? "Page on with the next_cursor command, or " : "") + (limit < AUDIT_MAX_LIMIT ? `${capped.nextCursor ? "rerun" : "Rerun"} with --limit=${bigger} (max ${AUDIT_MAX_LIMIT}), or ${perTrace}.` : capped.nextCursor ? `${perTrace}.` : `${perTrace[0].toUpperCase()}${perTrace.slice(1)}.`));
|
|
3492
3493
|
if (limit < AUDIT_MAX_LIMIT && !params.cursor && !sliced) {
|
|
3493
3494
|
nextCommands.push({ command: auditFlags([`--limit=${bigger}`]), purpose: "Read more ingest rows of this trace.", mutability: "read", requires_approval: false });
|
|
3494
3495
|
}
|
|
@@ -4257,8 +4258,18 @@ var CONTEXT_BUDGET_BYTES_PER_FIRST_PAGE_MESSAGE = 480;
|
|
|
4257
4258
|
function jsonByteLength(value) {
|
|
4258
4259
|
return Buffer.byteLength(JSON.stringify(value) ?? "", "utf8");
|
|
4259
4260
|
}
|
|
4260
|
-
|
|
4261
|
-
|
|
4261
|
+
function largestFittingCount(max, fits) {
|
|
4262
|
+
let low = 1;
|
|
4263
|
+
let high = Math.max(1, max);
|
|
4264
|
+
while (low < high) {
|
|
4265
|
+
const mid = Math.ceil((low + high) / 2);
|
|
4266
|
+
if (fits(mid))
|
|
4267
|
+
low = mid;
|
|
4268
|
+
else
|
|
4269
|
+
high = mid - 1;
|
|
4270
|
+
}
|
|
4271
|
+
return low;
|
|
4272
|
+
}
|
|
4262
4273
|
var LONE_SURROGATE = /[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/g;
|
|
4263
4274
|
function stripLoneSurrogates(value) {
|
|
4264
4275
|
if (typeof value === "string")
|
|
@@ -4270,13 +4281,6 @@ function stripLoneSurrogates(value) {
|
|
|
4270
4281
|
}
|
|
4271
4282
|
return value;
|
|
4272
4283
|
}
|
|
4273
|
-
function isUnknownRangeParamsError(error) {
|
|
4274
|
-
const e = error;
|
|
4275
|
-
if (e?.statusCode !== 400)
|
|
4276
|
-
return false;
|
|
4277
|
-
const text = `${typeof e.responseBody === "string" ? e.responseBody : ""} ${typeof e.message === "string" ? e.message : ""}`;
|
|
4278
|
-
return /property (from|count) should not exist/i.test(text);
|
|
4279
|
-
}
|
|
4280
4284
|
function pageMessages(page) {
|
|
4281
4285
|
const messages = asRecord(page.context)?.messages ?? page.messages;
|
|
4282
4286
|
return (Array.isArray(messages) ? messages : []).map((m) => asRecord(m) ?? {});
|
|
@@ -4286,13 +4290,11 @@ async function readFullTranscript(conversationId, opts = {}) {
|
|
|
4286
4290
|
const start = opts.from ?? 0;
|
|
4287
4291
|
const requested = opts.maxMessages ?? FULL_TRANSCRIPT_DEFAULT_MAX_MESSAGES;
|
|
4288
4292
|
const path = `/conversations/${encodeURIComponent(conversationId)}/context`;
|
|
4289
|
-
const warnings = [];
|
|
4290
4293
|
const messages = [];
|
|
4291
4294
|
let total = 0;
|
|
4292
4295
|
let summary = null;
|
|
4293
4296
|
let ordering;
|
|
4294
4297
|
let nextFrom = null;
|
|
4295
|
-
let legacy = false;
|
|
4296
4298
|
let cursor = start;
|
|
4297
4299
|
let readBytes = 0;
|
|
4298
4300
|
const byteBudget = opts.fits ? opts.maxBytes : undefined;
|
|
@@ -4303,22 +4305,13 @@ async function readFullTranscript(conversationId, opts = {}) {
|
|
|
4303
4305
|
const estimate = average > 0 ? Math.ceil(Math.max(0, byteBudget - readBytes) / average) + 1 : Math.max(1, Math.floor(byteBudget / CONTEXT_BUDGET_BYTES_PER_FIRST_PAGE_MESSAGE));
|
|
4304
4306
|
count = Math.max(1, Math.min(count, estimate));
|
|
4305
4307
|
}
|
|
4306
|
-
|
|
4307
|
-
try {
|
|
4308
|
-
page = asRecord(await callDataAPI(`${path}?from=${cursor}&count=${count}`)) ?? {};
|
|
4309
|
-
} catch (error) {
|
|
4310
|
-
if (cursor === start && isUnknownRangeParamsError(error)) {
|
|
4311
|
-
legacy = true;
|
|
4312
|
-
break;
|
|
4313
|
-
}
|
|
4314
|
-
throw error;
|
|
4315
|
-
}
|
|
4308
|
+
const page = asRecord(await callDataAPI(`${path}?from=${cursor}&count=${count}`)) ?? {};
|
|
4316
4309
|
if (cursor === start) {
|
|
4317
4310
|
total = asNumber(page.total_messages) ?? 0;
|
|
4318
|
-
summary = page.summary ?? null;
|
|
4319
|
-
ordering = asRecord(page.ordering) ?? undefined;
|
|
4311
|
+
summary = stripLoneSurrogates(page.summary ?? null);
|
|
4312
|
+
ordering = stripLoneSurrogates(asRecord(page.ordering) ?? undefined);
|
|
4320
4313
|
}
|
|
4321
|
-
const batch = pageMessages(page);
|
|
4314
|
+
const batch = stripLoneSurrogates(pageMessages(page));
|
|
4322
4315
|
messages.push(...batch);
|
|
4323
4316
|
if (byteBudget !== undefined)
|
|
4324
4317
|
readBytes += batch.reduce((sum, message) => sum + jsonByteLength(message) + 1, 0);
|
|
@@ -4330,46 +4323,13 @@ async function readFullTranscript(conversationId, opts = {}) {
|
|
|
4330
4323
|
break;
|
|
4331
4324
|
cursor = nextFrom;
|
|
4332
4325
|
}
|
|
4333
|
-
if (legacy) {
|
|
4334
|
-
const limit = Math.min(requested, LEGACY_WINDOW_MAX_MESSAGES);
|
|
4335
|
-
const window = 5;
|
|
4336
|
-
const span = window * 2 + 1;
|
|
4337
|
-
const byIndex = new Map;
|
|
4338
|
-
for (let center = start + window;; center += span) {
|
|
4339
|
-
const page = asRecord(await callDataAPI(`${path}?msg_index=${center}&window=${window}`)) ?? {};
|
|
4340
|
-
if (center === start + window) {
|
|
4341
|
-
total = asNumber(page.total_messages) ?? 0;
|
|
4342
|
-
summary = page.summary ?? null;
|
|
4343
|
-
}
|
|
4344
|
-
for (const message of pageMessages(page)) {
|
|
4345
|
-
const index = asNumber(message.index);
|
|
4346
|
-
if (index !== null && index !== undefined && index >= start && index < start + limit)
|
|
4347
|
-
byIndex.set(index, message);
|
|
4348
|
-
}
|
|
4349
|
-
if (center + window + 1 >= Math.min(total, start + limit))
|
|
4350
|
-
break;
|
|
4351
|
-
}
|
|
4352
|
-
messages.push(...[...byIndex.entries()].sort(([a], [b]) => a - b).map(([, message]) => message));
|
|
4353
|
-
const end = start + messages.length;
|
|
4354
|
-
nextFrom = end < total && messages.length > 0 ? end : null;
|
|
4355
|
-
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.`);
|
|
4356
|
-
}
|
|
4357
4326
|
throwIfNotFound("trace", conversationId, total === 0);
|
|
4358
|
-
const pageSize =
|
|
4327
|
+
const pageSize = requested;
|
|
4359
4328
|
const tied = asNumber(ordering?.tied_timestamp_messages) ?? 0;
|
|
4360
4329
|
const synthetic = asNumber(ordering?.synthetic_timestamp_messages) ?? 0;
|
|
4361
|
-
const atCap = (value) => {
|
|
4362
|
-
const text = typeof value === "string" ? value : value === undefined || value === null ? "" : JSON.stringify(value);
|
|
4363
|
-
return text.length >= CONTEXT_MESSAGE_TRUNCATE_CHARS;
|
|
4364
|
-
};
|
|
4365
|
-
const isTruncated = (record) => {
|
|
4366
|
-
const toolCalls = Array.isArray(record.tool_calls) ? record.tool_calls : [];
|
|
4367
|
-
const toolResults = Array.isArray(record.tool_results) ? record.tool_results : [];
|
|
4368
|
-
return atCap(record.content) || toolCalls.some((call) => atCap(asRecord(call)?.input)) || toolResults.some((result) => atCap(asRecord(result)?.content));
|
|
4369
|
-
};
|
|
4370
4330
|
const build = (kept) => {
|
|
4371
4331
|
const returned = messages.slice(0, kept);
|
|
4372
|
-
const out = [
|
|
4332
|
+
const out = [];
|
|
4373
4333
|
if (total > 0 && start >= total) {
|
|
4374
4334
|
out.push(`--from=${start} is past the end of this trace (${total} messages, indexes 0-${total - 1}).`);
|
|
4375
4335
|
}
|
|
@@ -4391,12 +4351,9 @@ async function readFullTranscript(conversationId, opts = {}) {
|
|
|
4391
4351
|
if (tied > 0 || synthetic > 0) {
|
|
4392
4352
|
out.push(`Message order may not be chronological: ${tied} of ${total} messages share a timestamp with another message (ordered by id, not time)${synthetic > 0 ? ` and ${synthetic} carry a synthetic pre-2022 timestamp` : ""}.`);
|
|
4393
4353
|
}
|
|
4394
|
-
if (legacy && returned.some(isTruncated)) {
|
|
4395
|
-
out.push(`This Moda server is older and truncates message text, tool-call inputs and tool results longer than ${CONTEXT_MESSAGE_TRUNCATE_CHARS} characters. For full content (prompts, tool arguments/results) use \`moda traces spans <conversation_id> --include-bodies\` (or \`--include-raw\` for the verbatim events).`);
|
|
4396
|
-
}
|
|
4397
4354
|
return {
|
|
4398
|
-
data:
|
|
4399
|
-
conversation_id: conversationId,
|
|
4355
|
+
data: {
|
|
4356
|
+
conversation_id: stripLoneSurrogates(conversationId),
|
|
4400
4357
|
total_messages: total,
|
|
4401
4358
|
from: start,
|
|
4402
4359
|
returned: returned.length,
|
|
@@ -4405,7 +4362,7 @@ async function readFullTranscript(conversationId, opts = {}) {
|
|
|
4405
4362
|
summary,
|
|
4406
4363
|
...ordering ? { ordering } : {},
|
|
4407
4364
|
messages: returned
|
|
4408
|
-
}
|
|
4365
|
+
},
|
|
4409
4366
|
warnings: out,
|
|
4410
4367
|
nextCommands
|
|
4411
4368
|
};
|
|
@@ -4413,18 +4370,10 @@ async function readFullTranscript(conversationId, opts = {}) {
|
|
|
4413
4370
|
const full = build(messages.length);
|
|
4414
4371
|
if (!opts.fits || messages.length <= 1 || opts.fits(full))
|
|
4415
4372
|
return full;
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
while (low < high) {
|
|
4419
|
-
const mid = Math.ceil((low + high) / 2);
|
|
4420
|
-
if (opts.fits(build(mid)))
|
|
4421
|
-
low = mid;
|
|
4422
|
-
else
|
|
4423
|
-
high = mid - 1;
|
|
4424
|
-
}
|
|
4425
|
-
return build(low);
|
|
4373
|
+
const fits = opts.fits;
|
|
4374
|
+
return build(largestFittingCount(messages.length - 1, (kept) => fits(build(kept))));
|
|
4426
4375
|
}
|
|
4427
|
-
async function readContextItem(
|
|
4376
|
+
async function readContextItem(params, inputWarnings, budget) {
|
|
4428
4377
|
const fits = budget?.fits;
|
|
4429
4378
|
if (params.all === true) {
|
|
4430
4379
|
const full = await readFullTranscript(params.conversation_id, {
|
|
@@ -4533,17 +4482,10 @@ function trimContextWindow(conversationId, record, requestedAnchor, fits) {
|
|
|
4533
4482
|
};
|
|
4534
4483
|
return { data, warnings, nextCommands };
|
|
4535
4484
|
};
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
const page = build(mid);
|
|
4541
|
-
if (fits(page.data, page.warnings, page.nextCommands))
|
|
4542
|
-
low = mid;
|
|
4543
|
-
else
|
|
4544
|
-
high = mid - 1;
|
|
4545
|
-
}
|
|
4546
|
-
return build(low);
|
|
4485
|
+
return build(largestFittingCount(order.length, (kept) => {
|
|
4486
|
+
const page = build(kept);
|
|
4487
|
+
return fits(page.data, page.warnings, page.nextCommands);
|
|
4488
|
+
}));
|
|
4547
4489
|
}
|
|
4548
4490
|
var AUDIT_USAGE = "Usage: moda traces spans <conversation_id|trace_id> [--kind=auto|trace|conversation] [--include-raw] [--include-bodies] [--limit=N] [--cursor=<next_cursor>]";
|
|
4549
4491
|
var AUDIT_BATCH_USAGE = `Usage: moda traces spans <id> <id> ... | --ids-from=-|<file> [--kind=auto|trace|conversation] [--include-raw] [--include-bodies] [--limit=N] (max ${BATCH_MAX_TARGETS} targets)`;
|
|
@@ -4569,16 +4511,10 @@ async function readAuditItem(command, params, budget) {
|
|
|
4569
4511
|
const available = (Array.isArray(spans) ? spans.length : 0) - (params.span_offset ?? 0);
|
|
4570
4512
|
if (available <= 0)
|
|
4571
4513
|
return whole;
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
const page2 = auditOutput(command, params, raw, mid);
|
|
4577
|
-
if (budget.fits(page2.data, page2.options))
|
|
4578
|
-
low = mid;
|
|
4579
|
-
else
|
|
4580
|
-
high = mid - 1;
|
|
4581
|
-
}
|
|
4514
|
+
const low = largestFittingCount(available, (keep) => {
|
|
4515
|
+
const page2 = auditOutput(command, params, raw, keep);
|
|
4516
|
+
return budget.fits(page2.data, page2.options);
|
|
4517
|
+
});
|
|
4582
4518
|
const page = auditOutput(command, params, raw, low);
|
|
4583
4519
|
if (low === 1 && !budget.fits(page.data, page.options)) {
|
|
4584
4520
|
page.options.warnings = [
|
|
@@ -4661,7 +4597,7 @@ async function readBatchTargets(targets, agentMode, read) {
|
|
|
4661
4597
|
});
|
|
4662
4598
|
}
|
|
4663
4599
|
function fitsShare(share) {
|
|
4664
|
-
return (data, options) =>
|
|
4600
|
+
return (data, options) => jsonByteLength({ data, ...options }) <= share;
|
|
4665
4601
|
}
|
|
4666
4602
|
function isBatchFatal(error) {
|
|
4667
4603
|
const type = classifyCliError(error);
|
|
@@ -4776,7 +4712,7 @@ async function runContextBatch(command, positionals, flags, context) {
|
|
|
4776
4712
|
conversation_id: target.id,
|
|
4777
4713
|
...target.msgIndex !== undefined ? { msg_index: target.msgIndex } : {}
|
|
4778
4714
|
};
|
|
4779
|
-
return withAnchorHint(target, () => readContextItem(
|
|
4715
|
+
return withAnchorHint(target, () => readContextItem(params, [], budget));
|
|
4780
4716
|
});
|
|
4781
4717
|
return writeBatchResult(command, context, targets, results, inputWarnings, rest);
|
|
4782
4718
|
}
|
|
@@ -4983,16 +4919,7 @@ async function runCommand(command, positional, flags, positionals = positional ?
|
|
|
4983
4919
|
return agentEnvelopeFits(command, page2.data, page2.options);
|
|
4984
4920
|
};
|
|
4985
4921
|
if (agentMode && kept > 1 && !fitsAgent(kept)) {
|
|
4986
|
-
|
|
4987
|
-
let high = kept - 1;
|
|
4988
|
-
while (low < high) {
|
|
4989
|
-
const mid = Math.ceil((low + high) / 2);
|
|
4990
|
-
if (fitsAgent(mid))
|
|
4991
|
-
low = mid;
|
|
4992
|
-
else
|
|
4993
|
-
high = mid - 1;
|
|
4994
|
-
}
|
|
4995
|
-
kept = low;
|
|
4922
|
+
kept = largestFittingCount(kept - 1, fitsAgent);
|
|
4996
4923
|
}
|
|
4997
4924
|
const page = write(kept);
|
|
4998
4925
|
recordSearchTelemetry(context, page.data);
|
|
@@ -5054,7 +4981,7 @@ async function runCommand(command, positional, flags, positionals = positional ?
|
|
|
5054
4981
|
return runContextBatch(command, positionals, flags, context);
|
|
5055
4982
|
const { params, warnings: inputWarnings } = parseContextRequest(...singleContextTarget(positional, flags));
|
|
5056
4983
|
const agentMode = context.output.mode === "agent" || context.output.mode === "agent-stream";
|
|
5057
|
-
const read = () => readContextItem(
|
|
4984
|
+
const read = () => readContextItem(params, inputWarnings, agentMode ? { fits: (data, options) => agentEnvelopeFits(command, data, options), maxBytes: agentMaxOutputBytes() } : undefined);
|
|
5058
4985
|
const item = positional === undefined ? await read() : await withAnchorHint(parseBatchTarget(positional, true, CONTEXT_USAGE), read);
|
|
5059
4986
|
context.output.writeData(item.data, item.options);
|
|
5060
4987
|
break;
|
|
@@ -5767,7 +5694,6 @@ async function runCommand(command, positional, flags, positionals = positional ?
|
|
|
5767
5694
|
function telemetryCommandName(definition) {
|
|
5768
5695
|
return definition.telemetryCommand ?? definition.name;
|
|
5769
5696
|
}
|
|
5770
|
-
var TELEMETRY_EXEMPT_COMMANDS = {};
|
|
5771
5697
|
function telemetrySubcommandNames(definition) {
|
|
5772
5698
|
return [
|
|
5773
5699
|
...definition.subcommands?.map((subcommand) => subcommand.name) ?? [],
|
|
@@ -5900,7 +5826,7 @@ var commandRegistry = createCommandRegistry([
|
|
|
5900
5826
|
resetApiRequestCountBeforeRun: true,
|
|
5901
5827
|
telemetry: "result-and-error",
|
|
5902
5828
|
handler: async (context) => {
|
|
5903
|
-
const { runInit } = await import("./index-
|
|
5829
|
+
const { runInit } = await import("./index-d1z50dsq.js");
|
|
5904
5830
|
if (context.outputMode === "agent-stream") {
|
|
5905
5831
|
context.output.writeEvent({
|
|
5906
5832
|
event: "started",
|
|
@@ -5950,7 +5876,7 @@ var commandRegistry = createCommandRegistry([
|
|
|
5950
5876
|
resetApiRequestCountBeforeRun: true,
|
|
5951
5877
|
telemetry: "result-and-error",
|
|
5952
5878
|
handler: async (context) => {
|
|
5953
|
-
const { runProvision } = await import("./provision-
|
|
5879
|
+
const { runProvision } = await import("./provision-y5bdbh4y.js");
|
|
5954
5880
|
return runProvision(context, {
|
|
5955
5881
|
resumeCommand: buildResumeCommand("provision", context.rawFlags)
|
|
5956
5882
|
});
|
|
@@ -7479,7 +7405,6 @@ export {
|
|
|
7479
7405
|
trimContextWindow,
|
|
7480
7406
|
telemetrySubcommandNames,
|
|
7481
7407
|
telemetryCommandName,
|
|
7482
|
-
stripLoneSurrogates,
|
|
7483
7408
|
searchOutcomeWarnings,
|
|
7484
7409
|
searchDegradeWarning,
|
|
7485
7410
|
searchCoverageWarnings,
|
|
@@ -7490,6 +7415,7 @@ export {
|
|
|
7490
7415
|
parseCommandFlags,
|
|
7491
7416
|
parseArgs,
|
|
7492
7417
|
normalizeBooleanFlags,
|
|
7418
|
+
largestFittingCount,
|
|
7493
7419
|
initFlagsForContext,
|
|
7494
7420
|
globalFlagHelpLines,
|
|
7495
7421
|
flagsToArgs,
|
|
@@ -7506,10 +7432,8 @@ export {
|
|
|
7506
7432
|
canonicalFlagKey,
|
|
7507
7433
|
buildResumeCommand,
|
|
7508
7434
|
auditCapStatus,
|
|
7509
|
-
TELEMETRY_EXEMPT_COMMANDS,
|
|
7510
7435
|
TAIL_LIMITS,
|
|
7511
7436
|
RAW_BOOLEAN_FLAGS,
|
|
7512
|
-
LEGACY_WINDOW_MAX_MESSAGES,
|
|
7513
7437
|
FULL_TRANSCRIPT_DEFAULT_MAX_MESSAGES,
|
|
7514
7438
|
CliInputError,
|
|
7515
7439
|
CONTEXT_MAX_WINDOW,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildDoctorReport,
|
|
3
|
+
promptsDiscoveredCheck,
|
|
4
|
+
runDoctorCommand,
|
|
5
|
+
runStatusCommand
|
|
6
|
+
} from "./cli-ny48a8de.js";
|
|
7
|
+
import"./cli-9bgnvth2.js";
|
|
8
|
+
import"./cli-3retgh64.js";
|
|
9
|
+
import"./cli-mm48br00.js";
|
|
10
|
+
import"./cli-xq45etg1.js";
|
|
11
|
+
import"./cli-dr6x0zv7.js";
|
|
12
|
+
import"./cli-n2hng3gv.js";
|
|
13
|
+
import"./cli-e23g9ywa.js";
|
|
14
|
+
import"./cli-99p2jh28.js";
|
|
15
|
+
import"./cli-k4tqwah4.js";
|
|
16
|
+
import"./cli-9kfxkxmk.js";
|
|
17
|
+
import"./cli-ns5fcnkz.js";
|
|
18
|
+
import"./cli-0v6na3yp.js";
|
|
19
|
+
export {
|
|
20
|
+
runStatusCommand,
|
|
21
|
+
runDoctorCommand,
|
|
22
|
+
promptsDiscoveredCheck,
|
|
23
|
+
buildDoctorReport
|
|
24
|
+
};
|
|
@@ -2,19 +2,14 @@ import {
|
|
|
2
2
|
DEFAULT_POLL_INTERVAL_MS,
|
|
3
3
|
DEFAULT_WAIT_TIMEOUT_MS,
|
|
4
4
|
fetchLatestRun
|
|
5
|
-
} from "./cli-
|
|
6
|
-
import"./cli-mm48br00.js";
|
|
7
|
-
import"./cli-qwgct6x7.js";
|
|
8
|
-
import"./cli-97fnztpy.js";
|
|
9
|
-
import"./cli-v8q7sd7g.js";
|
|
5
|
+
} from "./cli-yz8xcpyk.js";
|
|
10
6
|
import {
|
|
11
7
|
assertFlags
|
|
12
|
-
} from "./cli-
|
|
8
|
+
} from "./cli-n2hng3gv.js";
|
|
13
9
|
import {
|
|
14
10
|
callControlAPI
|
|
15
|
-
} from "./cli-
|
|
11
|
+
} from "./cli-e23g9ywa.js";
|
|
16
12
|
import {
|
|
17
|
-
CliInputError,
|
|
18
13
|
EXIT_DEGRADED,
|
|
19
14
|
EXIT_ERROR,
|
|
20
15
|
EXIT_OK,
|
|
@@ -22,7 +17,11 @@ import {
|
|
|
22
17
|
resolveApiTenantId,
|
|
23
18
|
shellArg,
|
|
24
19
|
validateConfig
|
|
25
|
-
} from "./cli-
|
|
20
|
+
} from "./cli-99p2jh28.js";
|
|
21
|
+
import {
|
|
22
|
+
CliInputError
|
|
23
|
+
} from "./cli-k4tqwah4.js";
|
|
24
|
+
import"./cli-ns5fcnkz.js";
|
|
26
25
|
import"./cli-0v6na3yp.js";
|
|
27
26
|
|
|
28
27
|
// src/fix.ts
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CONCERN_CANDIDATE_KINDS,
|
|
3
|
-
HARNESS_ANALYZE_CONCERNS,
|
|
4
3
|
SEED_CANDIDATE_KIND_LABELS,
|
|
5
4
|
analystEventProgress,
|
|
6
5
|
analyzeHarnessPrompts,
|
|
@@ -23,7 +22,6 @@ import {
|
|
|
23
22
|
numericEnv,
|
|
24
23
|
numericEnvAllowZero,
|
|
25
24
|
promptNameFromPath,
|
|
26
|
-
readHarnessSyncState,
|
|
27
25
|
renderAnalystCandidateLines,
|
|
28
26
|
renderAnalystSeedLines,
|
|
29
27
|
renderExternalHarnessAnalystPrompt,
|
|
@@ -42,12 +40,22 @@ import {
|
|
|
42
40
|
writeHarnessAnalyzeResult,
|
|
43
41
|
writeHarnessArtifacts,
|
|
44
42
|
writeHumanProgress
|
|
45
|
-
} from "./cli-
|
|
43
|
+
} from "./cli-3n0gz4d0.js";
|
|
44
|
+
import {
|
|
45
|
+
readHarnessSyncState
|
|
46
|
+
} from "./cli-xq45etg1.js";
|
|
46
47
|
import"./cli-97fnztpy.js";
|
|
47
|
-
import
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
import"./cli-
|
|
48
|
+
import {
|
|
49
|
+
HARNESS_ANALYZE_CONCERNS
|
|
50
|
+
} from "./cli-cesds766.js";
|
|
51
|
+
import"./cli-qpq84eee.js";
|
|
52
|
+
import"./cli-dr6x0zv7.js";
|
|
53
|
+
import"./cli-n2hng3gv.js";
|
|
54
|
+
import"./cli-e23g9ywa.js";
|
|
55
|
+
import"./cli-99p2jh28.js";
|
|
56
|
+
import"./cli-k4tqwah4.js";
|
|
57
|
+
import"./cli-9kfxkxmk.js";
|
|
58
|
+
import"./cli-ns5fcnkz.js";
|
|
51
59
|
import"./cli-0v6na3yp.js";
|
|
52
60
|
export {
|
|
53
61
|
writeHumanProgress,
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildSourceSnapshot
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-3n0gz4d0.js";
|
|
4
|
+
import"./cli-xq45etg1.js";
|
|
4
5
|
import"./cli-97fnztpy.js";
|
|
5
|
-
import"./cli-
|
|
6
|
-
import"./cli-
|
|
7
|
-
import"./cli-
|
|
6
|
+
import"./cli-cesds766.js";
|
|
7
|
+
import"./cli-qpq84eee.js";
|
|
8
|
+
import"./cli-dr6x0zv7.js";
|
|
9
|
+
import"./cli-n2hng3gv.js";
|
|
10
|
+
import"./cli-e23g9ywa.js";
|
|
8
11
|
import {
|
|
9
12
|
recordApiRequest
|
|
10
|
-
} from "./cli-
|
|
13
|
+
} from "./cli-99p2jh28.js";
|
|
14
|
+
import"./cli-k4tqwah4.js";
|
|
15
|
+
import"./cli-9kfxkxmk.js";
|
|
16
|
+
import"./cli-ns5fcnkz.js";
|
|
11
17
|
import"./cli-0v6na3yp.js";
|
|
12
18
|
|
|
13
19
|
// src/harness-github-actions.ts
|