@sireai/optimus 0.1.5 → 0.1.6
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/cli/optimus.js +56 -22
- package/dist/cli/optimus.js.map +1 -1
- package/dist/integrations/jira/jira-client.js +13 -5
- package/dist/integrations/jira/jira-client.js.map +1 -1
- package/dist/problem-solving-core/codex/codex-runner.d.ts +4 -0
- package/dist/problem-solving-core/codex/codex-runner.js +49 -3
- package/dist/problem-solving-core/codex/codex-runner.js.map +1 -1
- package/dist/task-environment/delivery/feishu-card-renderer.js +9 -0
- package/dist/task-environment/delivery/feishu-card-renderer.js.map +1 -1
- package/dist/task-environment/delivery/feishu-content/feishu-content-renderer.d.ts +1 -0
- package/dist/task-environment/delivery/feishu-content/feishu-content-renderer.js +5 -0
- package/dist/task-environment/delivery/feishu-content/feishu-content-renderer.js.map +1 -1
- package/dist/task-environment/delivery/feishu-notifier.js +1 -0
- package/dist/task-environment/delivery/feishu-notifier.js.map +1 -1
- package/dist/task-environment/delivery/feishu-templates/analysis-message-template.js +4 -0
- package/dist/task-environment/delivery/feishu-templates/analysis-message-template.js.map +1 -1
- package/dist/task-environment/delivery/feishu-templates/bugfix-message-template.js +4 -0
- package/dist/task-environment/delivery/feishu-templates/bugfix-message-template.js.map +1 -1
- package/dist/task-environment/delivery/feishu-templates/default-message-template.js +4 -0
- package/dist/task-environment/delivery/feishu-templates/default-message-template.js.map +1 -1
- package/dist/task-environment/delivery/feishu-templates/patch-message-template.js +4 -0
- package/dist/task-environment/delivery/feishu-templates/patch-message-template.js.map +1 -1
- package/dist/task-environment/delivery/feishu-templates/sentry-bugfix-message-template.js +4 -0
- package/dist/task-environment/delivery/feishu-templates/sentry-bugfix-message-template.js.map +1 -1
- package/dist/task-environment/delivery/feishu-templates/template-types.d.ts +1 -0
- package/dist/task-environment/delivery/sentry-feishu-card-renderer.js +5 -0
- package/dist/task-environment/delivery/sentry-feishu-card-renderer.js.map +1 -1
- package/dist/task-environment/delivery/task-delivery-service.js +4 -1
- package/dist/task-environment/delivery/task-delivery-service.js.map +1 -1
- package/dist/task-environment/delivery/task-publication-service.d.ts +0 -1
- package/dist/task-environment/delivery/task-publication-service.js +0 -43
- package/dist/task-environment/delivery/task-publication-service.js.map +1 -1
- package/dist/task-environment/execution-addresses.d.ts +1 -0
- package/dist/task-environment/execution-addresses.js +82 -1
- package/dist/task-environment/execution-addresses.js.map +1 -1
- package/dist/task-environment/observability/execution-metrics.d.ts +11 -0
- package/dist/task-environment/observability/execution-metrics.js +110 -0
- package/dist/task-environment/observability/execution-metrics.js.map +1 -0
- package/dist/task-environment/observability/runtime-panel.d.ts +1 -0
- package/dist/task-environment/observability/runtime-panel.js +32 -2
- package/dist/task-environment/observability/runtime-panel.js.map +1 -1
- package/dist/task-environment/storage/sqlite-task-store.d.ts +5 -1
- package/dist/task-environment/storage/sqlite-task-store.js +65 -6
- package/dist/task-environment/storage/sqlite-task-store.js.map +1 -1
- package/dist/types.d.ts +14 -0
- package/package.json +1 -1
package/dist/cli/optimus.js
CHANGED
|
@@ -23,6 +23,7 @@ import { TriageRunner } from "../task-environment/orchestration/triage-runner.js
|
|
|
23
23
|
import { OptimusRuntime } from "../task-environment/runtime/optimus-runtime.js";
|
|
24
24
|
import { SQLiteTaskStore } from "../task-environment/storage/sqlite-task-store.js";
|
|
25
25
|
import { SQLiteEventStore } from "../task-environment/storage/sqlite-event-store.js";
|
|
26
|
+
import { buildTaskExecutionMetrics, formatExecutionMetricsCompact } from "../task-environment/observability/execution-metrics.js";
|
|
26
27
|
import { FeishuNotifier } from "../task-environment/delivery/feishu-notifier.js";
|
|
27
28
|
import { TaskDeliveryDispatcher } from "../task-environment/delivery/task-delivery-dispatcher.js";
|
|
28
29
|
import { TaskDeliveryService } from "../task-environment/delivery/task-delivery-service.js";
|
|
@@ -924,12 +925,24 @@ async function promptSetupAnswers(defaults) {
|
|
|
924
925
|
}
|
|
925
926
|
return rl.question(prompt);
|
|
926
927
|
};
|
|
928
|
+
const printSetupSection = (title, detail) => {
|
|
929
|
+
console.log(`\n[${title}]`);
|
|
930
|
+
if (detail) {
|
|
931
|
+
console.log(detail);
|
|
932
|
+
}
|
|
933
|
+
};
|
|
934
|
+
const renderSetupPrompt = (label, promptLabel, defaultValue) => {
|
|
935
|
+
const suffix = defaultValue !== undefined ? ` [${defaultValue}]` : "";
|
|
936
|
+
return `[${label}] ${promptLabel}${suffix}: `;
|
|
937
|
+
};
|
|
927
938
|
try {
|
|
928
939
|
if (await pathExists(configPath)) {
|
|
929
940
|
console.log(`Existing config found at ${configPath}. Press Enter to keep current values.`);
|
|
930
941
|
}
|
|
931
|
-
|
|
932
|
-
const
|
|
942
|
+
printSetupSection("Repository", "Register the primary local repository used by Optimus.");
|
|
943
|
+
const repoPath = (await ask(renderSetupPrompt("Required", "Repository path", defaults.repoPath))).trim() || defaults.repoPath;
|
|
944
|
+
const repoAlias = (await ask(renderSetupPrompt("Required", "Repository alias", defaults.repoAlias))).trim() || defaults.repoAlias;
|
|
945
|
+
printSetupSection("Codex", "Choose one authentication mode, then fill the fields that follow.");
|
|
933
946
|
const codexAuthMode = await askSetupCodexAuthMode({ ask, defaultMode: defaults.codexAuthMode });
|
|
934
947
|
let codexApiKey;
|
|
935
948
|
let codexProviderId;
|
|
@@ -937,54 +950,57 @@ async function promptSetupAnswers(defaults) {
|
|
|
937
950
|
let codexProviderBaseUrl;
|
|
938
951
|
let codexProviderApiKeyEnvName;
|
|
939
952
|
if (codexAuthMode === "openai_api_key") {
|
|
940
|
-
codexApiKey = (await ask("OpenAI API key for OPENAI_API_KEY
|
|
953
|
+
codexApiKey = (await ask(renderSetupPrompt("Optional", "OpenAI API key for OPENAI_API_KEY", "leave blank to keep existing"))).trim() || undefined;
|
|
941
954
|
}
|
|
942
955
|
else if (codexAuthMode === "model_provider") {
|
|
943
|
-
codexProviderId = (await ask(
|
|
944
|
-
codexProviderDisplayName = (await ask(
|
|
945
|
-
codexProviderBaseUrl = (await ask(
|
|
946
|
-
codexProviderApiKeyEnvName = (await ask(
|
|
956
|
+
codexProviderId = (await ask(renderSetupPrompt("Required", "Provider id", defaults.codexProviderId ?? ""))).trim() || defaults.codexProviderId;
|
|
957
|
+
codexProviderDisplayName = (await ask(renderSetupPrompt("Required", "Provider display name", defaults.codexProviderDisplayName ?? ""))).trim() || defaults.codexProviderDisplayName;
|
|
958
|
+
codexProviderBaseUrl = (await ask(renderSetupPrompt("Required", "Provider base URL", defaults.codexProviderBaseUrl ?? ""))).trim() || defaults.codexProviderBaseUrl;
|
|
959
|
+
codexProviderApiKeyEnvName = (await ask(renderSetupPrompt("Required", "Provider API key env name", defaults.codexProviderApiKeyEnvName ?? ""))).trim() || defaults.codexProviderApiKeyEnvName;
|
|
947
960
|
const providerKeyLabel = codexProviderApiKeyEnvName || defaults.codexProviderApiKeyEnvName || "the configured provider env";
|
|
948
|
-
codexApiKey = (await ask(`Provider API key value for ${providerKeyLabel}
|
|
961
|
+
codexApiKey = (await ask(renderSetupPrompt("Optional", `Provider API key value for ${providerKeyLabel}`, "leave blank to keep existing"))).trim() || undefined;
|
|
949
962
|
}
|
|
950
|
-
|
|
963
|
+
printSetupSection("Feishu", "Enable this module when task notifications should be sent to Feishu.");
|
|
964
|
+
const enableFeishuInput = (await ask(renderSetupPrompt("Optional module", "Enable Feishu delivery", defaults.enableFeishu ? "Y/n" : "y/N"))).trim().toLowerCase();
|
|
951
965
|
const enableFeishu = enableFeishuInput.length === 0
|
|
952
966
|
? defaults.enableFeishu
|
|
953
967
|
: ["y", "yes"].includes(enableFeishuInput);
|
|
954
968
|
const feishuWebhook = enableFeishu
|
|
955
|
-
? (await ask(
|
|
969
|
+
? (await ask(renderSetupPrompt("Required", "Feishu webhook", defaults.feishuWebhook ? "configured" : ""))).trim() || defaults.feishuWebhook
|
|
956
970
|
: undefined;
|
|
957
971
|
const feishuSecret = enableFeishu
|
|
958
|
-
? (await ask(
|
|
972
|
+
? (await ask(renderSetupPrompt("Optional", "Feishu secret", defaults.feishuSecret ? "configured" : ""))).trim() || defaults.feishuSecret
|
|
959
973
|
: undefined;
|
|
960
|
-
|
|
974
|
+
printSetupSection("Jira", "Enable this module when Optimus should read issues or comment back to Jira.");
|
|
975
|
+
const enableJiraInput = (await ask(renderSetupPrompt("Optional module", "Enable Jira integration", defaults.enableJira ? "Y/n" : "y/N"))).trim().toLowerCase();
|
|
961
976
|
const enableJira = enableJiraInput.length === 0
|
|
962
977
|
? defaults.enableJira
|
|
963
978
|
: ["y", "yes"].includes(enableJiraInput);
|
|
964
979
|
const jiraBaseUrl = enableJira
|
|
965
|
-
? (await ask(
|
|
980
|
+
? (await ask(renderSetupPrompt("Required", "Jira base URL", defaults.jiraBaseUrl ?? ""))).trim() || defaults.jiraBaseUrl
|
|
966
981
|
: undefined;
|
|
967
982
|
const jiraMcpUrl = enableJira
|
|
968
|
-
? (await ask(
|
|
983
|
+
? (await ask(renderSetupPrompt("Required", "Jira MCP URL", defaults.jiraMcpUrl ?? ""))).trim() || defaults.jiraMcpUrl
|
|
969
984
|
: undefined;
|
|
970
985
|
const jiraUsername = enableJira
|
|
971
|
-
? (await ask(
|
|
986
|
+
? (await ask(renderSetupPrompt("Required", "Jira username", defaults.jiraUsername ?? ""))).trim() || defaults.jiraUsername
|
|
972
987
|
: undefined;
|
|
973
988
|
const jiraPersonalToken = enableJira
|
|
974
|
-
? (await ask(
|
|
989
|
+
? (await ask(renderSetupPrompt("Required", "Jira personal token", defaults.jiraPersonalToken ? "configured" : ""))).trim() || defaults.jiraPersonalToken
|
|
975
990
|
: undefined;
|
|
976
|
-
|
|
991
|
+
printSetupSection("Sentry", "Enable this module when tasks can be created from Sentry events.");
|
|
992
|
+
const enableSentryInput = (await ask(renderSetupPrompt("Optional module", "Enable Sentry integration", defaults.enableSentry ? "Y/n" : "y/N"))).trim().toLowerCase();
|
|
977
993
|
const enableSentry = enableSentryInput.length === 0
|
|
978
994
|
? defaults.enableSentry
|
|
979
995
|
: ["y", "yes"].includes(enableSentryInput);
|
|
980
996
|
const sentryBaseUrl = enableSentry
|
|
981
|
-
? (await ask(
|
|
997
|
+
? (await ask(renderSetupPrompt("Required", "Sentry base URL", defaults.sentryBaseUrl ?? ""))).trim() || defaults.sentryBaseUrl
|
|
982
998
|
: undefined;
|
|
983
999
|
const sentryOrg = enableSentry
|
|
984
|
-
? (await ask(
|
|
1000
|
+
? (await ask(renderSetupPrompt("Required", "Sentry org", defaults.sentryOrg ?? ""))).trim() || defaults.sentryOrg
|
|
985
1001
|
: undefined;
|
|
986
1002
|
const sentryAuthToken = enableSentry
|
|
987
|
-
? (await ask(
|
|
1003
|
+
? (await ask(renderSetupPrompt("Required", "Sentry auth token", defaults.sentryAuthToken ? "configured" : ""))).trim() || defaults.sentryAuthToken
|
|
988
1004
|
: undefined;
|
|
989
1005
|
return {
|
|
990
1006
|
repoPath,
|
|
@@ -1079,7 +1095,7 @@ function normalizeSetupCodexAuthMode(value) {
|
|
|
1079
1095
|
}
|
|
1080
1096
|
function renderSetupCodexAuthModePrompt(defaultMode) {
|
|
1081
1097
|
const defaultIndex = SETUP_CODEX_AUTH_MODE_OPTIONS.find((option) => option.mode === defaultMode)?.index ?? "1";
|
|
1082
|
-
const lines = ["Codex auth mode:"];
|
|
1098
|
+
const lines = ["[Required] Codex auth mode:"];
|
|
1083
1099
|
for (const option of SETUP_CODEX_AUTH_MODE_OPTIONS) {
|
|
1084
1100
|
const defaultSuffix = option.index === defaultIndex ? " (default)" : "";
|
|
1085
1101
|
lines.push(`${option.index}. ${option.label} [${option.mode}]${defaultSuffix}`);
|
|
@@ -2389,6 +2405,7 @@ async function main() {
|
|
|
2389
2405
|
const taskRuns = runs.filter((run) => run.taskId === task.taskId);
|
|
2390
2406
|
const activeRun = runs.find((run) => run.runId === task.activeRunId) ?? taskRuns.slice(-1)[0];
|
|
2391
2407
|
const timing = activeRun ? buildRunTimingSnapshot(activeRun, config) : { elapsedMs: 0, idleMs: 0, timeoutKind: null };
|
|
2408
|
+
const activeMetrics = activeRun ? buildTaskExecutionMetrics(activeRun) : undefined;
|
|
2392
2409
|
return {
|
|
2393
2410
|
taskId: task.taskId,
|
|
2394
2411
|
taskPackageId: task.taskPackageId,
|
|
@@ -2415,9 +2432,14 @@ async function main() {
|
|
|
2415
2432
|
elapsedMs: activeRun ? timing.elapsedMs : null,
|
|
2416
2433
|
idleMs: activeRun ? timing.idleMs : null,
|
|
2417
2434
|
timeoutKind: activeRun ? timing.timeoutKind : null,
|
|
2435
|
+
metrics: activeMetrics ? {
|
|
2436
|
+
...activeMetrics,
|
|
2437
|
+
display: formatExecutionMetricsCompact(activeMetrics)
|
|
2438
|
+
} : null,
|
|
2418
2439
|
nextAction: buildTaskNextAction(task.status, activeRun?.failureCategory),
|
|
2419
2440
|
runs: taskRuns.slice(-3).map((run) => {
|
|
2420
2441
|
const timing = buildRunTimingSnapshot(run, config);
|
|
2442
|
+
const metrics = buildTaskExecutionMetrics(run);
|
|
2421
2443
|
return {
|
|
2422
2444
|
runId: run.runId,
|
|
2423
2445
|
status: run.status,
|
|
@@ -2444,7 +2466,11 @@ async function main() {
|
|
|
2444
2466
|
cancelRequestedAt: run.cancelRequestedAt ?? null,
|
|
2445
2467
|
elapsedMs: timing.elapsedMs,
|
|
2446
2468
|
idleMs: timing.idleMs,
|
|
2447
|
-
timeoutKind: timing.timeoutKind
|
|
2469
|
+
timeoutKind: timing.timeoutKind,
|
|
2470
|
+
metrics: metrics ? {
|
|
2471
|
+
...metrics,
|
|
2472
|
+
display: formatExecutionMetricsCompact(metrics)
|
|
2473
|
+
} : null
|
|
2448
2474
|
};
|
|
2449
2475
|
})
|
|
2450
2476
|
};
|
|
@@ -3119,6 +3145,10 @@ function renderTaskResultReport(input) {
|
|
|
3119
3145
|
if (latestRun.endedAt) {
|
|
3120
3146
|
lines.push(`Ended At: ${latestRun.endedAt}`);
|
|
3121
3147
|
}
|
|
3148
|
+
const metrics = formatExecutionMetricsCompact(buildTaskExecutionMetrics(latestRun));
|
|
3149
|
+
if (metrics) {
|
|
3150
|
+
lines.push(`Metrics: ${metrics}`);
|
|
3151
|
+
}
|
|
3122
3152
|
}
|
|
3123
3153
|
lines.push("");
|
|
3124
3154
|
lines.push("Summary");
|
|
@@ -3142,6 +3172,10 @@ function renderTaskResultReport(input) {
|
|
|
3142
3172
|
lines.push("Delivery");
|
|
3143
3173
|
lines.push(`Outcome: ${input.deliveryBundle.outcome}`);
|
|
3144
3174
|
lines.push(`Decision: ${input.deliveryBundle.summary.decision}`);
|
|
3175
|
+
const metrics = formatExecutionMetricsCompact(input.deliveryBundle.metrics);
|
|
3176
|
+
if (metrics) {
|
|
3177
|
+
lines.push(`Metrics: ${metrics}`);
|
|
3178
|
+
}
|
|
3145
3179
|
if (input.deliveryBundle.warnings?.length) {
|
|
3146
3180
|
lines.push(`Warnings: ${input.deliveryBundle.warnings.join(", ")}`);
|
|
3147
3181
|
}
|