@rudderhq/cli 0.4.6-canary.7 → 0.4.6-canary.9
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/index.js +131 -49
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -544,7 +544,7 @@ var init_website_icons = __esm({
|
|
|
544
544
|
{ hostnames: ["docs.google.com"], siteName: "Google Docs", iconDataUrl: googleDocsIcon },
|
|
545
545
|
{ hostnames: ["notion.so", "www.notion.so"], siteName: "Notion", iconDataUrl: notionIcon },
|
|
546
546
|
{ hostnames: ["linear.app", "linear.com"], siteName: "Linear", iconDataUrl: linearIcon },
|
|
547
|
-
{ hostnames: ["openai.com"], includeSubdomains: true, siteName: "OpenAI", iconDataUrl: openaiIcon },
|
|
547
|
+
{ hostnames: ["openai.com"], includeSubdomains: true, siteName: "OpenAI", iconDataUrl: openaiIcon, darkMode: "invert" },
|
|
548
548
|
{ hostnames: ["chatgpt.com", "chat.openai.com"], includeSubdomains: true, siteName: "ChatGPT", iconDataUrl: chatgptIcon },
|
|
549
549
|
{ hostnames: ["anthropic.com"], includeSubdomains: true, siteName: "Anthropic", iconDataUrl: anthropicIcon },
|
|
550
550
|
{ hostnames: ["claude.ai"], siteName: "Claude", iconDataUrl: claudeIcon },
|
|
@@ -1254,7 +1254,8 @@ var init_organization = __esm({
|
|
|
1254
1254
|
logoAssetId: logoAssetIdSchema
|
|
1255
1255
|
}).strict().refine((value) => value.name !== void 0 || value.description !== void 0 || value.brandColor !== void 0 || value.logoAssetId !== void 0, "At least one branding field must be provided");
|
|
1256
1256
|
updateOrganizationWorkspaceFileSchema = z9.object({
|
|
1257
|
-
content: z9.string()
|
|
1257
|
+
content: z9.string(),
|
|
1258
|
+
expectedContent: z9.string().optional()
|
|
1258
1259
|
});
|
|
1259
1260
|
createOrganizationWorkspaceFileSchema = z9.object({
|
|
1260
1261
|
filePath: z9.string().trim().min(1).max(1e3),
|
|
@@ -7872,9 +7873,9 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
7872
7873
|
},
|
|
7873
7874
|
{
|
|
7874
7875
|
id: "runs.list",
|
|
7875
|
-
command: "rudder runs list --org-id <id> [--used-skill <skill>] [--loaded-skill <skill>]",
|
|
7876
|
+
command: "rudder runs list --org-id <id> [--used-skill <skill>] [--loaded-skill <skill>] [--cursor <cursor>] [--full]",
|
|
7876
7877
|
category: "runs",
|
|
7877
|
-
description: "List
|
|
7878
|
+
description: "List lightweight run summaries with stable pagination and filters; use --full only for legacy full-row compatibility.",
|
|
7878
7879
|
mutating: false,
|
|
7879
7880
|
contract: "agent-v1",
|
|
7880
7881
|
requiresOrgId: true,
|
|
@@ -7884,9 +7885,9 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
7884
7885
|
},
|
|
7885
7886
|
{
|
|
7886
7887
|
id: "runs.by-skill",
|
|
7887
|
-
command: "rudder runs by-skill <skill> --org-id <id> [--evidence <used-or-loaded>]",
|
|
7888
|
+
command: "rudder runs by-skill <skill> --org-id <id> [--evidence <used-or-loaded>] [--cursor <cursor>] [--full]",
|
|
7888
7889
|
category: "runs",
|
|
7889
|
-
description: "Build a skill evidence packet from
|
|
7890
|
+
description: "Build a paginated skill evidence packet from lightweight run summaries; use --full only for legacy full-row compatibility.",
|
|
7890
7891
|
mutating: false,
|
|
7891
7892
|
contract: "agent-v1",
|
|
7892
7893
|
requiresOrgId: true,
|
|
@@ -7908,9 +7909,9 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
7908
7909
|
},
|
|
7909
7910
|
{
|
|
7910
7911
|
id: "runs.events",
|
|
7911
|
-
command: "rudder runs events <run-id>",
|
|
7912
|
+
command: "rudder runs events <run-id> [--after-seq <n>] [--limit <n>]",
|
|
7912
7913
|
category: "runs",
|
|
7913
|
-
description: "List persisted run events.",
|
|
7914
|
+
description: "List a bounded page of persisted run events with a sequence cursor.",
|
|
7914
7915
|
mutating: false,
|
|
7915
7916
|
contract: "agent-v1",
|
|
7916
7917
|
requiresOrgId: false,
|
|
@@ -7920,9 +7921,9 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
7920
7921
|
},
|
|
7921
7922
|
{
|
|
7922
7923
|
id: "runs.log",
|
|
7923
|
-
command: "rudder runs log <run-id>",
|
|
7924
|
+
command: "rudder runs log <run-id> [--offset <bytes>] [--limit-bytes <n>]",
|
|
7924
7925
|
category: "runs",
|
|
7925
|
-
description: "Read stored run log content
|
|
7926
|
+
description: "Read a bounded byte range of stored run log content.",
|
|
7926
7927
|
mutating: false,
|
|
7927
7928
|
contract: "agent-v1",
|
|
7928
7929
|
requiresOrgId: false,
|
|
@@ -8169,7 +8170,10 @@ function mcpInputSchemaForCapability(id) {
|
|
|
8169
8170
|
turnLimit: "Maximum turns to return.",
|
|
8170
8171
|
contextTurns: "Number of context turns.",
|
|
8171
8172
|
maxChars: "Maximum characters.",
|
|
8172
|
-
snippetChars: "Maximum snippet characters."
|
|
8173
|
+
snippetChars: "Maximum snippet characters.",
|
|
8174
|
+
afterSeq: "Return events after this sequence number.",
|
|
8175
|
+
offset: "Byte offset for ranged reads.",
|
|
8176
|
+
limitBytes: "Maximum bytes for ranged reads."
|
|
8173
8177
|
})) {
|
|
8174
8178
|
add(key, mcpNumber(description));
|
|
8175
8179
|
}
|
|
@@ -8182,7 +8186,7 @@ function mcpInputSchemaForCapability(id) {
|
|
|
8182
8186
|
})) {
|
|
8183
8187
|
add(key, mcpStringArray(description));
|
|
8184
8188
|
}
|
|
8185
|
-
for (const key of ["clearTitle", "clearCapabilities", "clearDescription", "clearReportsTo", "enable", "enabled", "disabled", "reopen", "planMode", "includeTranscript", "includeOutput", "includeOutputs", "notifyOnIssueCreated", "errorsOnly", "chronological", "narrative", "submit"]) {
|
|
8189
|
+
for (const key of ["clearTitle", "clearCapabilities", "clearDescription", "clearReportsTo", "enable", "enabled", "disabled", "reopen", "planMode", "includeTranscript", "includeOutput", "includeOutputs", "notifyOnIssueCreated", "errorsOnly", "chronological", "narrative", "submit", "full"]) {
|
|
8186
8190
|
add(key, mcpBoolean(`Boolean option ${key}.`));
|
|
8187
8191
|
}
|
|
8188
8192
|
return {
|
|
@@ -9118,7 +9122,9 @@ function cliArgsForCapability(capabilityId, input, tempFiles, env) {
|
|
|
9118
9122
|
pushOptional(args, "--used-skill", input.usedSkill);
|
|
9119
9123
|
pushOptional(args, "--loaded-skill", input.loadedSkill);
|
|
9120
9124
|
pushOptional(args, "--created-before", input.createdBefore);
|
|
9125
|
+
pushOptional(args, "--cursor", input.cursor);
|
|
9121
9126
|
pushOptional(args, "--limit", input.limit);
|
|
9127
|
+
pushBoolean(args, "--full", input.full);
|
|
9122
9128
|
return args;
|
|
9123
9129
|
}
|
|
9124
9130
|
case "runs.by-skill": {
|
|
@@ -9129,16 +9135,24 @@ function cliArgsForCapability(capabilityId, input, tempFiles, env) {
|
|
|
9129
9135
|
pushOptional(args, "--runtime", input.runtime);
|
|
9130
9136
|
pushOptional(args, "--issue-id", input.issueId);
|
|
9131
9137
|
pushOptional(args, "--created-before", input.createdBefore);
|
|
9138
|
+
pushOptional(args, "--cursor", input.cursor);
|
|
9132
9139
|
pushOptional(args, "--limit", input.limit);
|
|
9140
|
+
pushBoolean(args, "--full", input.full);
|
|
9133
9141
|
return args;
|
|
9134
9142
|
}
|
|
9135
9143
|
case "runs.get":
|
|
9136
9144
|
return ["runs", "get", requiredString(input, "run")];
|
|
9137
|
-
case "runs.events":
|
|
9138
|
-
|
|
9145
|
+
case "runs.events": {
|
|
9146
|
+
const args = ["runs", "events", requiredString(input, "run")];
|
|
9147
|
+
pushOptional(args, "--after-seq", input.afterSeq);
|
|
9148
|
+
pushOptional(args, "--limit", input.limit);
|
|
9149
|
+
return args;
|
|
9150
|
+
}
|
|
9139
9151
|
case "runs.log": {
|
|
9140
9152
|
const args = ["runs", "log", requiredString(input, "run")];
|
|
9141
9153
|
pushOptional(args, "--max-chars", input.maxChars);
|
|
9154
|
+
pushOptional(args, "--offset", input.offset);
|
|
9155
|
+
pushOptional(args, "--limit-bytes", input.limitBytes);
|
|
9142
9156
|
return args;
|
|
9143
9157
|
}
|
|
9144
9158
|
case "runs.transcript": {
|
|
@@ -14140,7 +14154,7 @@ function projectPath(projectRef, orgId) {
|
|
|
14140
14154
|
function registerRunsCommands(program) {
|
|
14141
14155
|
const runs = program.command("runs").description("Run debugging operations");
|
|
14142
14156
|
addCommonClientOptions(
|
|
14143
|
-
runs.command("list").description(getAgentCliCapabilityById("runs.list").description).option("-O, --org-id <id>", "Organization ID").option("--updated-after <iso>", "Only runs updated after this timestamp").option("--run-id-prefix <prefix>", "Filter by run ID prefix").option("--agent-id <id>", "Filter by agent ID").option("--status <status>", "Filter by run status").option("--runtime <type>", "Filter by runtime type").option("--issue-id <id>", "Filter by linked issue ID").option("--used-skill <key-or-name>", "Filter by skill actually used during the run").option("--loaded-skill <key-or-name>", "Filter by skill loaded for the run").option("--created-before <iso>", "Only runs created before this timestamp").option("--limit <n>", "Maximum rows", "
|
|
14157
|
+
runs.command("list").description(getAgentCliCapabilityById("runs.list").description).option("-O, --org-id <id>", "Organization ID").option("--updated-after <iso>", "Only runs updated after this timestamp").option("--run-id-prefix <prefix>", "Filter by run ID prefix").option("--agent-id <id>", "Filter by agent ID").option("--status <status>", "Filter by run status").option("--runtime <type>", "Filter by runtime type").option("--issue-id <id>", "Filter by linked issue ID").option("--used-skill <key-or-name>", "Filter by skill actually used during the run").option("--loaded-skill <key-or-name>", "Filter by skill loaded for the run").option("--created-before <iso>", "Only runs created before this timestamp").option("--cursor <cursor>", "Stable summary cursor returned in page.nextCursor").option("--limit <n>", "Maximum rows; defaults to 50 summaries or 200 full rows").option("--full", "Use the legacy full-row list response for compatibility").addHelpText("after", formatExamplesAndCautions({
|
|
14144
14158
|
examples: [
|
|
14145
14159
|
{
|
|
14146
14160
|
description: "Find recent failures for one agent before opening transcripts:",
|
|
@@ -14159,8 +14173,13 @@ function registerRunsCommands(program) {
|
|
|
14159
14173
|
try {
|
|
14160
14174
|
assertSingleSkillFilter(opts);
|
|
14161
14175
|
const ctx = resolveCommandContext(opts, { requireCompany: true });
|
|
14162
|
-
|
|
14163
|
-
|
|
14176
|
+
if (opts.full) {
|
|
14177
|
+
const rows = await ctx.api.get(`/api/run-intelligence/orgs/${ctx.orgId}/runs?${buildRunsListQuery(opts)}`) ?? [];
|
|
14178
|
+
printOutput(ctx.json ? rows : rows.map(formatRunListRow), { json: ctx.json });
|
|
14179
|
+
return;
|
|
14180
|
+
}
|
|
14181
|
+
const page = await ctx.api.get(`/api/run-intelligence/orgs/${ctx.orgId}/runs?${buildRunsListQuery(opts)}`);
|
|
14182
|
+
printOutput(ctx.json ? page : formatRunSummaryPage(page), { json: ctx.json });
|
|
14164
14183
|
} catch (err) {
|
|
14165
14184
|
handleCommandError(err);
|
|
14166
14185
|
}
|
|
@@ -14168,13 +14187,19 @@ function registerRunsCommands(program) {
|
|
|
14168
14187
|
{ includeCompany: false }
|
|
14169
14188
|
);
|
|
14170
14189
|
addCommonClientOptions(
|
|
14171
|
-
runs.command("by-skill").description(getAgentCliCapabilityById("runs.by-skill").description).argument("<skill>", "Skill key or display name").option("-O, --org-id <id>", "Organization ID").option("--evidence <used|loaded>", "Evidence type to match; defaults to used", "used").option("--agent-id <id>", "Filter by agent ID").option("--status <status>", "Filter by run status").option("--runtime <type>", "Filter by runtime type").option("--issue-id <id>", "Filter by linked issue ID").option("--created-before <iso>", "Only runs created before this timestamp").option("--limit <n>", "Maximum rows", "50").action(async (skill, opts) => {
|
|
14190
|
+
runs.command("by-skill").description(getAgentCliCapabilityById("runs.by-skill").description).argument("<skill>", "Skill key or display name").option("-O, --org-id <id>", "Organization ID").option("--evidence <used|loaded>", "Evidence type to match; defaults to used", "used").option("--agent-id <id>", "Filter by agent ID").option("--status <status>", "Filter by run status").option("--runtime <type>", "Filter by runtime type").option("--issue-id <id>", "Filter by linked issue ID").option("--created-before <iso>", "Only runs created before this timestamp").option("--cursor <cursor>", "Stable summary cursor returned in page.nextCursor").option("--limit <n>", "Maximum rows", "50").option("--full", "Use the legacy full-row list response for compatibility").action(async (skill, opts) => {
|
|
14172
14191
|
try {
|
|
14173
14192
|
const evidenceType = parseSkillEvidenceType(opts.evidence);
|
|
14174
14193
|
const ctx = resolveCommandContext(opts, { requireCompany: true });
|
|
14175
14194
|
const params = buildRunsBySkillQuery(skill, opts, evidenceType);
|
|
14176
|
-
|
|
14177
|
-
|
|
14195
|
+
if (opts.full) {
|
|
14196
|
+
const rows = await ctx.api.get(`/api/run-intelligence/orgs/${ctx.orgId}/runs?${params}`) ?? [];
|
|
14197
|
+
const report2 = buildSkillRunReport(skill, evidenceType, rows);
|
|
14198
|
+
printOutput(ctx.json ? report2 : formatSkillRunReport(report2), { json: ctx.json });
|
|
14199
|
+
return;
|
|
14200
|
+
}
|
|
14201
|
+
const page = await ctx.api.get(`/api/run-intelligence/orgs/${ctx.orgId}/runs?${params}`);
|
|
14202
|
+
const report = buildSkillRunReport(skill, evidenceType, page?.items ?? [], page?.page);
|
|
14178
14203
|
printOutput(ctx.json ? report : formatSkillRunReport(report), { json: ctx.json });
|
|
14179
14204
|
} catch (err) {
|
|
14180
14205
|
handleCommandError(err);
|
|
@@ -14194,21 +14219,33 @@ function registerRunsCommands(program) {
|
|
|
14194
14219
|
})
|
|
14195
14220
|
);
|
|
14196
14221
|
addCommonClientOptions(
|
|
14197
|
-
runs.command("events").description(getAgentCliCapabilityById("runs.events").description).argument("<runId>", "Run ID or short run ID").action(async (runId, opts) => {
|
|
14222
|
+
runs.command("events").description(getAgentCliCapabilityById("runs.events").description).argument("<runId>", "Run ID or short run ID").option("--after-seq <n>", "Return events after this sequence number", "0").option("--limit <n>", "Maximum events to return", "200").action(async (runId, opts) => {
|
|
14198
14223
|
try {
|
|
14199
14224
|
const ctx = resolveCommandContext(opts);
|
|
14200
|
-
const
|
|
14201
|
-
|
|
14225
|
+
const params = new URLSearchParams({
|
|
14226
|
+
afterSeq: String(parseNonNegativeInteger(opts.afterSeq, 0)),
|
|
14227
|
+
limit: String(parseLimit2(opts.limit, 200))
|
|
14228
|
+
});
|
|
14229
|
+
const page = await ctx.api.get(
|
|
14230
|
+
`/api/run-intelligence/runs/${encodeURIComponent(runId)}/events?${params}`
|
|
14231
|
+
);
|
|
14232
|
+
printOutput(ctx.json ? page : (page?.items ?? []).map(formatRunEvent), { json: ctx.json });
|
|
14202
14233
|
} catch (err) {
|
|
14203
14234
|
handleCommandError(err);
|
|
14204
14235
|
}
|
|
14205
14236
|
})
|
|
14206
14237
|
);
|
|
14207
14238
|
addCommonClientOptions(
|
|
14208
|
-
runs.command("log").description(getAgentCliCapabilityById("runs.log").description).argument("<runId>", "Run ID or short run ID").option("--max-chars <n>", "Maximum log characters for human output", "12000").action(async (runId, opts) => {
|
|
14239
|
+
runs.command("log").description(getAgentCliCapabilityById("runs.log").description).argument("<runId>", "Run ID or short run ID").option("--max-chars <n>", "Maximum log characters for human output", "12000").option("--offset <n>", "Start reading at this byte offset", "0").option("--limit-bytes <n>", "Maximum log bytes to return", "256000").action(async (runId, opts) => {
|
|
14209
14240
|
try {
|
|
14210
14241
|
const ctx = resolveCommandContext(opts);
|
|
14211
|
-
const
|
|
14242
|
+
const params = new URLSearchParams({
|
|
14243
|
+
offset: String(parseNonNegativeInteger(opts.offset, 0)),
|
|
14244
|
+
limitBytes: String(parseLimit2(opts.limitBytes, 256e3))
|
|
14245
|
+
});
|
|
14246
|
+
const row = await ctx.api.get(
|
|
14247
|
+
`/api/run-intelligence/runs/${encodeURIComponent(runId)}/log?${params}`
|
|
14248
|
+
);
|
|
14212
14249
|
if (ctx.json) {
|
|
14213
14250
|
printOutput(row, { json: true });
|
|
14214
14251
|
} else {
|
|
@@ -14308,6 +14345,7 @@ function registerRunsCommands(program) {
|
|
|
14308
14345
|
}
|
|
14309
14346
|
function buildRunsListQuery(opts) {
|
|
14310
14347
|
const params = new URLSearchParams();
|
|
14348
|
+
params.set("projection", opts.full ? "full" : "summary");
|
|
14311
14349
|
if (opts.updatedAfter) params.set("updatedAfter", opts.updatedAfter);
|
|
14312
14350
|
if (opts.runIdPrefix) params.set("runIdPrefix", opts.runIdPrefix);
|
|
14313
14351
|
if (opts.agentId) params.set("agentId", opts.agentId);
|
|
@@ -14317,18 +14355,21 @@ function buildRunsListQuery(opts) {
|
|
|
14317
14355
|
if (opts.usedSkill) params.set("usedSkill", opts.usedSkill);
|
|
14318
14356
|
if (opts.loadedSkill) params.set("loadedSkill", opts.loadedSkill);
|
|
14319
14357
|
if (opts.createdBefore) params.set("createdBefore", opts.createdBefore);
|
|
14320
|
-
if (opts.
|
|
14358
|
+
if (!opts.full && opts.cursor) params.set("cursor", opts.cursor);
|
|
14359
|
+
params.set("limit", opts.limit ?? (opts.full ? "200" : "50"));
|
|
14321
14360
|
return params.toString();
|
|
14322
14361
|
}
|
|
14323
14362
|
function buildRunsBySkillQuery(skill, opts, evidenceType) {
|
|
14324
14363
|
const params = new URLSearchParams();
|
|
14364
|
+
params.set("projection", opts.full ? "full" : "summary");
|
|
14325
14365
|
params.set(evidenceType === "used" ? "usedSkill" : "loadedSkill", skill);
|
|
14326
14366
|
if (opts.agentId) params.set("agentId", opts.agentId);
|
|
14327
14367
|
if (opts.status) params.set("status", opts.status);
|
|
14328
14368
|
if (opts.runtime) params.set("runtime", opts.runtime);
|
|
14329
14369
|
if (opts.issueId) params.set("issueId", opts.issueId);
|
|
14330
14370
|
if (opts.createdBefore) params.set("createdBefore", opts.createdBefore);
|
|
14331
|
-
if (opts.
|
|
14371
|
+
if (!opts.full && opts.cursor) params.set("cursor", opts.cursor);
|
|
14372
|
+
params.set("limit", opts.limit ?? "50");
|
|
14332
14373
|
return params.toString();
|
|
14333
14374
|
}
|
|
14334
14375
|
function assertSingleSkillFilter(opts) {
|
|
@@ -14356,22 +14397,22 @@ function buildTranscriptQuery(opts, output) {
|
|
|
14356
14397
|
return params.toString();
|
|
14357
14398
|
}
|
|
14358
14399
|
function formatRunListRow(row) {
|
|
14359
|
-
const runId = formatCliRunId(row
|
|
14400
|
+
const runId = formatCliRunId(runIdOf(row));
|
|
14360
14401
|
return {
|
|
14361
14402
|
id: runId,
|
|
14362
|
-
status: row
|
|
14363
|
-
agent: row.agentName ?? row
|
|
14364
|
-
runtime: row
|
|
14403
|
+
status: runStatusOf(row),
|
|
14404
|
+
agent: row.agentName ?? runAgentIdOf(row),
|
|
14405
|
+
runtime: runRuntimeOf(row),
|
|
14365
14406
|
issue: formatIssueRef(row.issue),
|
|
14366
|
-
createdAt: row
|
|
14367
|
-
finishedAt: row
|
|
14407
|
+
createdAt: runCreatedAtOf(row),
|
|
14408
|
+
finishedAt: runFinishedAtOf(row) ?? "-",
|
|
14368
14409
|
evidence: row.skillEvidence?.evidenceType ?? "-",
|
|
14369
14410
|
skill: row.skillEvidence?.matchedSkillKey ?? "-",
|
|
14370
|
-
error: row
|
|
14371
|
-
next: row
|
|
14411
|
+
error: runErrorOf(row) ?? "-",
|
|
14412
|
+
next: runStatusOf(row) === "failed" ? `rudder runs errors ${runId}` : `rudder runs transcript ${runId}`
|
|
14372
14413
|
};
|
|
14373
14414
|
}
|
|
14374
|
-
function buildSkillRunReport(skill, evidenceType, rows) {
|
|
14415
|
+
function buildSkillRunReport(skill, evidenceType, rows, page) {
|
|
14375
14416
|
const statusCounts = {
|
|
14376
14417
|
succeeded: 0,
|
|
14377
14418
|
failed: 0,
|
|
@@ -14385,7 +14426,7 @@ function buildSkillRunReport(skill, evidenceType, rows) {
|
|
|
14385
14426
|
const issues = /* @__PURE__ */ new Map();
|
|
14386
14427
|
const errors = /* @__PURE__ */ new Map();
|
|
14387
14428
|
for (const row of rows) {
|
|
14388
|
-
const status = row
|
|
14429
|
+
const status = runStatusOf(row);
|
|
14389
14430
|
if (status === "succeeded") statusCounts.succeeded += 1;
|
|
14390
14431
|
else if (status === "failed") statusCounts.failed += 1;
|
|
14391
14432
|
else if (status === "cancelled") statusCounts.cancelled += 1;
|
|
@@ -14393,7 +14434,8 @@ function buildSkillRunReport(skill, evidenceType, rows) {
|
|
|
14393
14434
|
else if (status === "running") statusCounts.running += 1;
|
|
14394
14435
|
else if (status === "queued") statusCounts.queued += 1;
|
|
14395
14436
|
else statusCounts.other += 1;
|
|
14396
|
-
const
|
|
14437
|
+
const agentId = runAgentIdOf(row);
|
|
14438
|
+
const agent = agents.get(agentId) ?? { id: agentId, name: row.agentName, count: 0 };
|
|
14397
14439
|
agent.count += 1;
|
|
14398
14440
|
agents.set(agent.id, agent);
|
|
14399
14441
|
if (row.issue) {
|
|
@@ -14401,7 +14443,7 @@ function buildSkillRunReport(skill, evidenceType, rows) {
|
|
|
14401
14443
|
issue.count += 1;
|
|
14402
14444
|
issues.set(issue.id, issue);
|
|
14403
14445
|
}
|
|
14404
|
-
const error = row
|
|
14446
|
+
const error = runErrorOf(row)?.trim();
|
|
14405
14447
|
if (error) errors.set(error, (errors.get(error) ?? 0) + 1);
|
|
14406
14448
|
}
|
|
14407
14449
|
return {
|
|
@@ -14414,9 +14456,10 @@ function buildSkillRunReport(skill, evidenceType, rows) {
|
|
|
14414
14456
|
commonErrors: [...errors.entries()].map(([summary, count]) => ({ summary, count })).sort((a, b) => b.count - a.count).slice(0, 5)
|
|
14415
14457
|
},
|
|
14416
14458
|
rows,
|
|
14459
|
+
...page ? { page } : {},
|
|
14417
14460
|
nextCommands: rows.slice(0, 5).map((row) => {
|
|
14418
|
-
const runId = formatCliRunId(row
|
|
14419
|
-
return row
|
|
14461
|
+
const runId = formatCliRunId(runIdOf(row));
|
|
14462
|
+
return runStatusOf(row) === "failed" ? `rudder runs errors ${runId}` : `rudder runs transcript ${runId}`;
|
|
14420
14463
|
})
|
|
14421
14464
|
};
|
|
14422
14465
|
}
|
|
@@ -14434,34 +14477,68 @@ function formatSkillRunReport(report) {
|
|
|
14434
14477
|
lines.push(`commonErrors=${report.summary.commonErrors.map((error) => `${clip2(error.summary, 80)}:${error.count}`).join(" | ")}`);
|
|
14435
14478
|
}
|
|
14436
14479
|
lines.push(...report.rows.map((row) => formatInlineSkillRun(row)));
|
|
14480
|
+
if (report.page?.hasMore && report.page.nextCursor) {
|
|
14481
|
+
lines.push(`more: hasMore=true nextCursor=${report.page.nextCursor}`);
|
|
14482
|
+
}
|
|
14437
14483
|
if (report.nextCommands.length > 0) {
|
|
14438
14484
|
lines.push("next:");
|
|
14439
14485
|
lines.push(...report.nextCommands.map((command) => ` ${command}`));
|
|
14440
14486
|
}
|
|
14441
14487
|
return lines;
|
|
14442
14488
|
}
|
|
14489
|
+
function formatRunSummaryPage(page) {
|
|
14490
|
+
const lines = (page?.items ?? []).map(formatRunListRow);
|
|
14491
|
+
if (page?.page.hasMore && page.page.nextCursor) {
|
|
14492
|
+
lines.push(`more: hasMore=true nextCursor=${page.page.nextCursor}`);
|
|
14493
|
+
}
|
|
14494
|
+
return lines;
|
|
14495
|
+
}
|
|
14443
14496
|
function formatInlineSkillRun(row) {
|
|
14444
|
-
const runId = formatCliRunId(row
|
|
14497
|
+
const runId = formatCliRunId(runIdOf(row));
|
|
14445
14498
|
const issue = formatIssueRef(row.issue);
|
|
14446
14499
|
const label = row.skillEvidence?.matchedSkillLabel && row.skillEvidence.matchedSkillLabel !== row.skillEvidence.matchedSkillKey ? ` label=${row.skillEvidence.matchedSkillLabel}` : "";
|
|
14447
14500
|
return [
|
|
14448
14501
|
`id=${runId}`,
|
|
14449
|
-
`status=${row
|
|
14450
|
-
`agent=${row.agentName ?? row
|
|
14502
|
+
`status=${runStatusOf(row)}`,
|
|
14503
|
+
`agent=${row.agentName ?? runAgentIdOf(row)}`,
|
|
14451
14504
|
`issue=${issue}`,
|
|
14452
|
-
`runtime=${row
|
|
14453
|
-
`createdAt=${row
|
|
14454
|
-
`finishedAt=${row
|
|
14505
|
+
`runtime=${runRuntimeOf(row)}`,
|
|
14506
|
+
`createdAt=${runCreatedAtOf(row)}`,
|
|
14507
|
+
`finishedAt=${runFinishedAtOf(row) ?? "-"}`,
|
|
14455
14508
|
`evidence=${row.skillEvidence?.evidenceType ?? "-"}`,
|
|
14456
14509
|
`skill=${row.skillEvidence?.matchedSkillKey ?? "-"}${label}`,
|
|
14457
|
-
`error=${row
|
|
14458
|
-
`next=${row
|
|
14510
|
+
`error=${runErrorOf(row) ?? "-"}`,
|
|
14511
|
+
`next=${runStatusOf(row) === "failed" ? `rudder runs errors ${runId}` : `rudder runs transcript ${runId}`}`
|
|
14459
14512
|
].join(" ");
|
|
14460
14513
|
}
|
|
14461
14514
|
function formatIssueRef(issue) {
|
|
14462
14515
|
if (!issue) return "-";
|
|
14463
14516
|
return issue.identifier && issue.title ? `${issue.identifier} ${issue.title}` : issue.identifier ?? issue.title ?? issue.id;
|
|
14464
14517
|
}
|
|
14518
|
+
function isRunSummary(row) {
|
|
14519
|
+
return "id" in row;
|
|
14520
|
+
}
|
|
14521
|
+
function runIdOf(row) {
|
|
14522
|
+
return isRunSummary(row) ? row.id : row.run.id;
|
|
14523
|
+
}
|
|
14524
|
+
function runAgentIdOf(row) {
|
|
14525
|
+
return isRunSummary(row) ? row.agentId : row.run.agentId;
|
|
14526
|
+
}
|
|
14527
|
+
function runStatusOf(row) {
|
|
14528
|
+
return isRunSummary(row) ? row.status : row.run.status;
|
|
14529
|
+
}
|
|
14530
|
+
function runRuntimeOf(row) {
|
|
14531
|
+
return isRunSummary(row) ? row.runtime : row.bundle.agentRuntimeType;
|
|
14532
|
+
}
|
|
14533
|
+
function runCreatedAtOf(row) {
|
|
14534
|
+
return isRunSummary(row) ? row.createdAt : row.run.createdAt;
|
|
14535
|
+
}
|
|
14536
|
+
function runFinishedAtOf(row) {
|
|
14537
|
+
return isRunSummary(row) ? row.finishedAt : row.run.finishedAt;
|
|
14538
|
+
}
|
|
14539
|
+
function runErrorOf(row) {
|
|
14540
|
+
return isRunSummary(row) ? row.error : row.errorSummary;
|
|
14541
|
+
}
|
|
14465
14542
|
function formatRunEvent(row) {
|
|
14466
14543
|
return {
|
|
14467
14544
|
seq: row.seq,
|
|
@@ -14502,6 +14579,11 @@ function parseLimit2(value, fallback) {
|
|
|
14502
14579
|
if (!Number.isFinite(parsed) || parsed <= 0) return fallback;
|
|
14503
14580
|
return Math.floor(parsed);
|
|
14504
14581
|
}
|
|
14582
|
+
function parseNonNegativeInteger(value, fallback) {
|
|
14583
|
+
const parsed = Number(value ?? fallback);
|
|
14584
|
+
if (!Number.isFinite(parsed) || parsed < 0) return fallback;
|
|
14585
|
+
return Math.floor(parsed);
|
|
14586
|
+
}
|
|
14505
14587
|
function clip2(value, maxChars) {
|
|
14506
14588
|
if (value.length <= maxChars) return value;
|
|
14507
14589
|
return `${value.slice(0, Math.max(0, maxChars - 1))}\u2026`;
|