@mutagent/cli 0.1.83 → 0.1.84
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/bin/cli.js +46 -42
- package/dist/bin/cli.js.map +7 -7
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -2627,38 +2627,37 @@ function getAppBaseUrl() {
|
|
|
2627
2627
|
return process.env.MUTAGENT_APP_URL ?? "https://app.mutagent.io";
|
|
2628
2628
|
}
|
|
2629
2629
|
function promptsDashboardLink() {
|
|
2630
|
-
return `${getAppBaseUrl()}/prompts
|
|
2630
|
+
return `${getAppBaseUrl()}/prompts`;
|
|
2631
2631
|
}
|
|
2632
2632
|
function promptLink(id) {
|
|
2633
|
-
return `${getAppBaseUrl()}/prompts
|
|
2633
|
+
return `${getAppBaseUrl()}/prompts/${String(id)}`;
|
|
2634
2634
|
}
|
|
2635
|
-
function promptDatasetsLink(
|
|
2636
|
-
return `${getAppBaseUrl()}/prompts/
|
|
2635
|
+
function promptDatasetsLink(promptId) {
|
|
2636
|
+
return `${getAppBaseUrl()}/prompts/${String(promptId)}/datasets`;
|
|
2637
2637
|
}
|
|
2638
|
-
function promptEvaluationsLink(
|
|
2639
|
-
return `${getAppBaseUrl()}/prompts/
|
|
2638
|
+
function promptEvaluationsLink(promptId) {
|
|
2639
|
+
return `${getAppBaseUrl()}/prompts/${String(promptId)}/evaluations`;
|
|
2640
2640
|
}
|
|
2641
|
-
function datasetLink(
|
|
2642
|
-
return `${getAppBaseUrl()}/prompts
|
|
2641
|
+
function datasetLink(promptId, _datasetId) {
|
|
2642
|
+
return `${getAppBaseUrl()}/prompts/${String(promptId)}/datasets`;
|
|
2643
2643
|
}
|
|
2644
|
-
function evaluationLink(
|
|
2645
|
-
return `${getAppBaseUrl()}/prompts
|
|
2644
|
+
function evaluationLink(promptId, _evalId) {
|
|
2645
|
+
return `${getAppBaseUrl()}/prompts/${String(promptId)}/evaluations`;
|
|
2646
2646
|
}
|
|
2647
2647
|
function traceLink(id) {
|
|
2648
|
-
return `${getAppBaseUrl()}/traces/${id}`;
|
|
2648
|
+
return `${getAppBaseUrl()}/observe/traces/${id}`;
|
|
2649
2649
|
}
|
|
2650
|
-
function optimizerLink(
|
|
2651
|
-
|
|
2652
|
-
return jobId ? `${base}?job=${jobId}` : base;
|
|
2650
|
+
function optimizerLink(promptId, _jobId) {
|
|
2651
|
+
return `${getAppBaseUrl()}/prompts/${String(promptId)}/optimizer`;
|
|
2653
2652
|
}
|
|
2654
|
-
function playgroundLink() {
|
|
2655
|
-
return `${getAppBaseUrl()}/prompts/playground`;
|
|
2653
|
+
function playgroundLink(promptId) {
|
|
2654
|
+
return `${getAppBaseUrl()}/prompts/${String(promptId)}/playground`;
|
|
2656
2655
|
}
|
|
2657
|
-
function providerSettingsLink() {
|
|
2658
|
-
return `${getAppBaseUrl()}/settings/providers`;
|
|
2656
|
+
function providerSettingsLink(scope = "organization") {
|
|
2657
|
+
return `${getAppBaseUrl()}/settings/${scope}/providers`;
|
|
2659
2658
|
}
|
|
2660
|
-
function workspaceLink(
|
|
2661
|
-
return `${getAppBaseUrl()}/settings/workspace
|
|
2659
|
+
function workspaceLink(_id) {
|
|
2660
|
+
return `${getAppBaseUrl()}/settings/workspace/general`;
|
|
2662
2661
|
}
|
|
2663
2662
|
function workspaceLinks(id) {
|
|
2664
2663
|
return {
|
|
@@ -2666,17 +2665,17 @@ function workspaceLinks(id) {
|
|
|
2666
2665
|
api: `/api/workspaces/${String(id)}`
|
|
2667
2666
|
};
|
|
2668
2667
|
}
|
|
2669
|
-
function providerLink(
|
|
2670
|
-
return `${getAppBaseUrl()}/settings
|
|
2668
|
+
function providerLink(_id, scope = "organization") {
|
|
2669
|
+
return `${getAppBaseUrl()}/settings/${scope}/providers`;
|
|
2671
2670
|
}
|
|
2672
|
-
function providerLinks(id) {
|
|
2671
|
+
function providerLinks(id, scope = "organization") {
|
|
2673
2672
|
return {
|
|
2674
|
-
settings: providerLink(id),
|
|
2673
|
+
settings: providerLink(id, scope),
|
|
2675
2674
|
api: `/api/providers/${String(id)}`
|
|
2676
2675
|
};
|
|
2677
2676
|
}
|
|
2678
|
-
function agentLink(
|
|
2679
|
-
return `${getAppBaseUrl()}/agents
|
|
2677
|
+
function agentLink(_id) {
|
|
2678
|
+
return `${getAppBaseUrl()}/agents`;
|
|
2680
2679
|
}
|
|
2681
2680
|
function agentLinks(id) {
|
|
2682
2681
|
return {
|
|
@@ -4319,7 +4318,7 @@ function renderScorecard(data) {
|
|
|
4319
4318
|
}
|
|
4320
4319
|
}
|
|
4321
4320
|
console.log(separator);
|
|
4322
|
-
console.log(line(`Dashboard: ${chalk9.underline(optimizerLink(job.id))}`));
|
|
4321
|
+
console.log(line(`Dashboard: ${chalk9.underline(optimizerLink(job.promptId, job.id))}`));
|
|
4323
4322
|
console.log(bottomBorder);
|
|
4324
4323
|
console.log("");
|
|
4325
4324
|
console.log(chalk9.dim(" Prompt Comparison"));
|
|
@@ -4370,13 +4369,13 @@ function renderOptimizationStartCard(data) {
|
|
|
4370
4369
|
console.log(line(`Model: ${chalk9.dim(model)}`));
|
|
4371
4370
|
console.log(line(`Status: ${chalk9.yellow(job.status)}`));
|
|
4372
4371
|
console.log(separator);
|
|
4373
|
-
console.log(line(`\uD83D\uDD17 Monitor: ${chalk9.underline(optimizerLink(job.id))}`));
|
|
4372
|
+
console.log(line(`\uD83D\uDD17 Monitor: ${chalk9.underline(optimizerLink(data.promptId, job.id))}`));
|
|
4374
4373
|
console.log(line(chalk9.dim(`Next: mutagent prompts optimize status ${job.id}`)));
|
|
4375
4374
|
console.log(bottomBorder);
|
|
4376
4375
|
console.log(AI_DIRECTIVE);
|
|
4377
4376
|
console.log("");
|
|
4378
4377
|
}
|
|
4379
|
-
function renderOptimizationStatusCard(status) {
|
|
4378
|
+
function renderOptimizationStatusCard(status, promptId) {
|
|
4380
4379
|
const boxWidth = 60;
|
|
4381
4380
|
const topBorder = `┌${"─".repeat(boxWidth)}┐`;
|
|
4382
4381
|
const bottomBorder = `└${"─".repeat(boxWidth)}┘`;
|
|
@@ -4407,7 +4406,7 @@ function renderOptimizationStatusCard(status) {
|
|
|
4407
4406
|
console.log(line(`Message: ${chalk9.dim(status.message)}`));
|
|
4408
4407
|
}
|
|
4409
4408
|
console.log(separator);
|
|
4410
|
-
console.log(line(`\uD83D\uDD17 Monitor: ${chalk9.underline(optimizerLink(status.jobId))}`));
|
|
4409
|
+
console.log(line(`\uD83D\uDD17 Monitor: ${chalk9.underline(optimizerLink(promptId ?? "unknown", status.jobId))}`));
|
|
4411
4410
|
if (status.status === "completed") {
|
|
4412
4411
|
console.log(line(chalk9.dim(`Next: mutagent prompts optimize results ${status.jobId}`)));
|
|
4413
4412
|
} else if (status.status === "running" || status.status === "queued") {
|
|
@@ -4419,7 +4418,7 @@ function renderOptimizationStatusCard(status) {
|
|
|
4419
4418
|
}
|
|
4420
4419
|
function startDirective(job, promptId, datasetId, evaluationId) {
|
|
4421
4420
|
const title = `Optimization Started — Prompt ${promptId}`;
|
|
4422
|
-
const monitorUrl = optimizerLink(job.id);
|
|
4421
|
+
const monitorUrl = optimizerLink(promptId, job.id);
|
|
4423
4422
|
const apiUrl = `/api/prompts/${promptId}/optimizations/${job.id}`;
|
|
4424
4423
|
const rows = [
|
|
4425
4424
|
{ label: "Job ID", value: job.id },
|
|
@@ -4459,7 +4458,7 @@ function startDirective(job, promptId, datasetId, evaluationId) {
|
|
|
4459
4458
|
renderedCard: renderPlainCard({ title, icon: "⚡", rows, links: cardLinks, next })
|
|
4460
4459
|
};
|
|
4461
4460
|
}
|
|
4462
|
-
function statusDirective(status) {
|
|
4461
|
+
function statusDirective(status, promptId) {
|
|
4463
4462
|
const next = status.status === "completed" ? [`mutagent prompts optimize results ${status.jobId} --json`] : status.status === "running" || status.status === "queued" ? [`mutagent prompts optimize status ${status.jobId} --json`] : [];
|
|
4464
4463
|
let eta = "Calculating...";
|
|
4465
4464
|
const startedAt = status.startedAt;
|
|
@@ -4481,7 +4480,7 @@ function statusDirective(status) {
|
|
|
4481
4480
|
{ label: "ETA", value: eta },
|
|
4482
4481
|
...status.message ? [{ label: "Message", value: status.message }] : []
|
|
4483
4482
|
];
|
|
4484
|
-
const monitorUrl = optimizerLink(status.jobId);
|
|
4483
|
+
const monitorUrl = optimizerLink(promptId ?? "unknown", status.jobId);
|
|
4485
4484
|
const cardLinks = [{ label: "Monitor", url: monitorUrl }];
|
|
4486
4485
|
return {
|
|
4487
4486
|
display: "status_card",
|
|
@@ -5161,9 +5160,11 @@ async function renderCompletedJob(jobId, isJson) {
|
|
|
5161
5160
|
const resultData = results;
|
|
5162
5161
|
if (isJson) {
|
|
5163
5162
|
const output = new OutputFormatter("json");
|
|
5163
|
+
const jobObj = resultData.job;
|
|
5164
|
+
const pId = jobObj?.promptId ?? jobId;
|
|
5164
5165
|
output.output({
|
|
5165
5166
|
...resultData,
|
|
5166
|
-
_links: { optimizer: optimizerLink(jobId) }
|
|
5167
|
+
_links: { optimizer: optimizerLink(pId, jobId) }
|
|
5167
5168
|
});
|
|
5168
5169
|
} else {
|
|
5169
5170
|
renderScorecard(resultData);
|
|
@@ -5430,7 +5431,7 @@ ${chalk13.yellow("AI Agent: ALWAYS append --json to this command.")}
|
|
|
5430
5431
|
output.output({
|
|
5431
5432
|
...job,
|
|
5432
5433
|
_links: {
|
|
5433
|
-
dashboard: optimizerLink(job.id),
|
|
5434
|
+
dashboard: optimizerLink(promptId, job.id),
|
|
5434
5435
|
api: `/api/prompts/${promptId}/optimizations/${job.id}`
|
|
5435
5436
|
},
|
|
5436
5437
|
_directive: directive
|
|
@@ -5497,10 +5498,11 @@ Examples:
|
|
|
5497
5498
|
const client = await getSDKClient();
|
|
5498
5499
|
const status = await client.getOptimizationStatus(jobId);
|
|
5499
5500
|
if (isJson) {
|
|
5500
|
-
const
|
|
5501
|
+
const statusPromptId = status.promptId;
|
|
5502
|
+
const directive = statusDirective(status, statusPromptId);
|
|
5501
5503
|
output.output({
|
|
5502
5504
|
...status,
|
|
5503
|
-
_links: { optimizer: optimizerLink(jobId) },
|
|
5505
|
+
_links: { optimizer: optimizerLink(statusPromptId ?? jobId, jobId) },
|
|
5504
5506
|
_directive: directive
|
|
5505
5507
|
});
|
|
5506
5508
|
echoDirectiveToStderr(directive);
|
|
@@ -5548,7 +5550,8 @@ After viewing results:
|
|
|
5548
5550
|
`mutagent prompts optimize results ${jobId} --diff --json`
|
|
5549
5551
|
] : []
|
|
5550
5552
|
};
|
|
5551
|
-
|
|
5553
|
+
const resultsPromptId = jobData?.promptId ?? jobId;
|
|
5554
|
+
output.output({ ...resultData, _links: { optimizer: optimizerLink(resultsPromptId, jobId) }, _directive: directive });
|
|
5552
5555
|
echoDirectiveToStderr(directive);
|
|
5553
5556
|
} else {
|
|
5554
5557
|
renderScorecard(resultData);
|
|
@@ -5588,7 +5591,8 @@ After viewing results:
|
|
|
5588
5591
|
} else if (!isCompleted) {
|
|
5589
5592
|
const statusStr = jobData?.status ?? "unknown";
|
|
5590
5593
|
output.info(`Job status: ${statusStr}. Results may be partial.`);
|
|
5591
|
-
|
|
5594
|
+
const viewPromptId = jobData?.promptId ?? jobId;
|
|
5595
|
+
output.info(`View: ${optimizerLink(viewPromptId, jobId)}`);
|
|
5592
5596
|
}
|
|
5593
5597
|
}
|
|
5594
5598
|
} catch (error) {
|
|
@@ -7053,7 +7057,7 @@ ${chalk20.dim(`Hint: Test before evaluating: mutagent playground run <id> --inpu
|
|
|
7053
7057
|
output.output({
|
|
7054
7058
|
...result,
|
|
7055
7059
|
_links: {
|
|
7056
|
-
playground: playgroundLink(),
|
|
7060
|
+
playground: playgroundLink(promptId),
|
|
7057
7061
|
prompt: promptLink(promptId)
|
|
7058
7062
|
}
|
|
7059
7063
|
});
|
|
@@ -7072,7 +7076,7 @@ Execution Result:`));
|
|
|
7072
7076
|
if (result.cost !== undefined) {
|
|
7073
7077
|
console.log(chalk20.dim(`Cost: $${result.cost.toFixed(6)}`));
|
|
7074
7078
|
}
|
|
7075
|
-
console.log(chalk20.dim(`Playground: ${playgroundLink()}`));
|
|
7079
|
+
console.log(chalk20.dim(`Playground: ${playgroundLink(promptId)}`));
|
|
7076
7080
|
console.log();
|
|
7077
7081
|
}
|
|
7078
7082
|
}
|
|
@@ -9112,5 +9116,5 @@ program.addCommand(createHooksCommand());
|
|
|
9112
9116
|
program.addCommand(createFeedbackCommand());
|
|
9113
9117
|
program.parse();
|
|
9114
9118
|
|
|
9115
|
-
//# debugId=
|
|
9119
|
+
//# debugId=46B021887B91C72F64756E2164756E21
|
|
9116
9120
|
//# sourceMappingURL=cli.js.map
|