@sireai/optimus 0.1.42 → 0.1.44
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 +59 -39
- package/dist/cli/optimus.js.map +1 -1
- package/dist/integrations/feishu/feishu-doc-service.d.ts +14 -2
- package/dist/integrations/feishu/feishu-doc-service.js +33 -12
- package/dist/integrations/feishu/feishu-doc-service.js.map +1 -1
- package/dist/integrations/feishu/feishu-document-reader.d.ts +33 -0
- package/dist/integrations/feishu/feishu-document-reader.js +597 -0
- package/dist/integrations/feishu/feishu-document-reader.js.map +1 -0
- package/dist/problem-solving-core/codex/codex-runner.d.ts +8 -0
- package/dist/problem-solving-core/codex/codex-runner.js +210 -5
- package/dist/problem-solving-core/codex/codex-runner.js.map +1 -1
- package/dist/task-environment/delivery/delivery-warning-copy.d.ts +2 -0
- package/dist/task-environment/delivery/delivery-warning-copy.js +17 -0
- package/dist/task-environment/delivery/delivery-warning-copy.js.map +1 -0
- package/dist/task-environment/delivery/feishu-analysis-doc-service.d.ts +32 -2
- package/dist/task-environment/delivery/feishu-analysis-doc-service.js +343 -17
- package/dist/task-environment/delivery/feishu-analysis-doc-service.js.map +1 -1
- package/dist/task-environment/delivery/feishu-card-primitives.d.ts +33 -0
- package/dist/task-environment/delivery/feishu-card-primitives.js +95 -0
- package/dist/task-environment/delivery/feishu-card-primitives.js.map +1 -0
- package/dist/task-environment/delivery/feishu-card-renderer.d.ts +1 -0
- package/dist/task-environment/delivery/feishu-card-renderer.js +34 -71
- package/dist/task-environment/delivery/feishu-card-renderer.js.map +1 -1
- package/dist/task-environment/delivery/feishu-content/feishu-copy-config.js +1 -0
- package/dist/task-environment/delivery/feishu-content/feishu-copy-config.js.map +1 -1
- package/dist/task-environment/delivery/feishu-notifier.js +4 -0
- package/dist/task-environment/delivery/feishu-notifier.js.map +1 -1
- package/dist/task-environment/delivery/pm-feishu-card-renderer.d.ts +21 -0
- package/dist/task-environment/delivery/pm-feishu-card-renderer.js +203 -0
- package/dist/task-environment/delivery/pm-feishu-card-renderer.js.map +1 -0
- package/dist/task-environment/delivery/sentry-feishu-card-renderer.d.ts +1 -0
- package/dist/task-environment/delivery/sentry-feishu-card-renderer.js +33 -70
- package/dist/task-environment/delivery/sentry-feishu-card-renderer.js.map +1 -1
- package/dist/task-environment/delivery/task-delivery-service.d.ts +3 -1
- package/dist/task-environment/delivery/task-delivery-service.js +28 -7
- package/dist/task-environment/delivery/task-delivery-service.js.map +1 -1
- package/dist/task-environment/observability/logger.js +2 -0
- package/dist/task-environment/observability/logger.js.map +1 -1
- package/dist/task-environment/orchestration/task-orchestrator.js +2 -1
- package/dist/task-environment/orchestration/task-orchestrator.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/package.json +2 -2
- package/task-harnesses/bugfix/ACCEPT.md +3 -2
- package/task-harnesses/bugfix/CONSTRAINTS.md +10 -4
- package/task-harnesses/bugfix/EVOLUTION.md +2 -8
- package/task-harnesses/bugfix/ROLE.md +7 -11
- package/task-harnesses/bugfix/STANDARD.md +82 -0
- package/task-harnesses/pm/ACCEPT.md +27 -57
- package/task-harnesses/pm/CONSTRAINTS.md +35 -39
- package/task-harnesses/pm/CONTEXT.md +31 -41
- package/task-harnesses/pm/EVOLUTION.md +61 -27
- package/task-harnesses/pm/ROLE.md +25 -27
- package/task-harnesses/pm/STANDARD.md +305 -130
- package/task-harnesses/pm/ANNOTATION_PATTERN.md +0 -58
package/dist/cli/optimus.js
CHANGED
|
@@ -26,9 +26,11 @@ import { buildTaskExecutionMetrics, formatExecutionMetricsCompact } from "../tas
|
|
|
26
26
|
import { FeishuNotifier } from "../task-environment/delivery/feishu-notifier.js";
|
|
27
27
|
import { TaskDeliveryDispatcher } from "../task-environment/delivery/task-delivery-dispatcher.js";
|
|
28
28
|
import { TaskDeliveryService } from "../task-environment/delivery/task-delivery-service.js";
|
|
29
|
+
import { formatDeliveryWarningsWithDescriptions } from "../task-environment/delivery/delivery-warning-copy.js";
|
|
29
30
|
import { FeishuAnalysisDocService } from "../task-environment/delivery/feishu-analysis-doc-service.js";
|
|
30
31
|
import { TaskPublicationService } from "../task-environment/delivery/task-publication-service.js";
|
|
31
32
|
import { FeishuClient } from "../integrations/feishu/feishu-client.js";
|
|
33
|
+
import { FeishuDocumentReader, mergeFeishuReferenceMaterials } from "../integrations/feishu/feishu-document-reader.js";
|
|
32
34
|
import { FeishuUserService } from "../integrations/feishu/feishu-user-service.js";
|
|
33
35
|
import { createFeedbackReport } from "./feedback.js";
|
|
34
36
|
import { DEFAULT_FEEDBACK_RECIPIENT_EMAIL, FeishuFeedbackDeliveryService, persistFeedbackDeliveryResult, resolveDefaultFeedbackRecipientFallbackOpenId } from "./feedback-delivery.js";
|
|
@@ -2172,6 +2174,8 @@ function mergeReplayBundle(rebuilt, existing) {
|
|
|
2172
2174
|
...existing.summary,
|
|
2173
2175
|
...rebuilt.summary,
|
|
2174
2176
|
...(rebuilt.summary.analysisDocUrl ? {} : existing.summary.analysisDocUrl ? { analysisDocUrl: existing.summary.analysisDocUrl } : {}),
|
|
2177
|
+
...(rebuilt.summary.prototypePreviewUrl ? {} : existing.summary.prototypePreviewUrl ? { prototypePreviewUrl: existing.summary.prototypePreviewUrl } : {}),
|
|
2178
|
+
...(rebuilt.summary.prototypeDownloadUrl ? {} : existing.summary.prototypeDownloadUrl ? { prototypeDownloadUrl: existing.summary.prototypeDownloadUrl } : {}),
|
|
2175
2179
|
...(rebuilt.summary.repo ? {} : existing.summary.repo ? { repo: existing.summary.repo } : {}),
|
|
2176
2180
|
...(rebuilt.summary.sourceSystem ? {} : existing.summary.sourceSystem ? { sourceSystem: existing.summary.sourceSystem } : {}),
|
|
2177
2181
|
...(rebuilt.summary.sourceRef ? {} : existing.summary.sourceRef ? { sourceRef: existing.summary.sourceRef } : {}),
|
|
@@ -2226,6 +2230,7 @@ const TASK_EVENT_EXPLANATIONS = {
|
|
|
2226
2230
|
"execution.completed": "任务执行已结束并完成收口。",
|
|
2227
2231
|
"execution.failed": "任务执行已失败并完成收口。",
|
|
2228
2232
|
"execution.canceled": "任务执行已取消并完成收口。",
|
|
2233
|
+
"execution.review_subagent.skipped": "独立 reviewer subagent 调用失败,本轮已跳过 review 并继续按现有产物收口。",
|
|
2229
2234
|
"task.needs_human": "任务需要人工补充信息或接手处理。",
|
|
2230
2235
|
"task.delivery_bundle.warning": "交付产物存在需要关注的告警,通常表示结果文档缺少关键标准字段。",
|
|
2231
2236
|
};
|
|
@@ -2245,6 +2250,7 @@ const DOCTOR_IMPORTANT_EVENT_TYPES = [
|
|
|
2245
2250
|
"task.failed",
|
|
2246
2251
|
"task.canceled",
|
|
2247
2252
|
"task.timed_out",
|
|
2253
|
+
"task.review_subagent.skipped",
|
|
2248
2254
|
"task.fallback",
|
|
2249
2255
|
"task.needs_human",
|
|
2250
2256
|
"task.retry_enqueued",
|
|
@@ -2543,46 +2549,60 @@ async function resolveTaskTextFromUrl(url) {
|
|
|
2543
2549
|
if (!isFeishuDocumentUrl(trimmedUrl)) {
|
|
2544
2550
|
throw new Error("submit currently supports document URLs from Feishu/Lark only.");
|
|
2545
2551
|
}
|
|
2546
|
-
|
|
2552
|
+
const reader = new FeishuDocumentReader();
|
|
2547
2553
|
try {
|
|
2548
|
-
const
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2554
|
+
const resolved = await reader.readFromUrl(trimmedUrl);
|
|
2555
|
+
const referenceMaterials = mergeFeishuReferenceMaterials(extractFeishuReferenceMaterials(resolved.content, undefined, trimmedUrl), resolved.referenceMaterials);
|
|
2556
|
+
return {
|
|
2557
|
+
content: resolved.content,
|
|
2558
|
+
...(resolved.title ? { title: resolved.title } : {}),
|
|
2559
|
+
sourceType: resolved.sourceType,
|
|
2560
|
+
...(resolved.sourceDocumentType ? { sourceDocumentType: resolved.sourceDocumentType } : {}),
|
|
2561
|
+
...(referenceMaterials ? { referenceMaterials } : {})
|
|
2562
|
+
};
|
|
2552
2563
|
}
|
|
2553
|
-
catch (
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2564
|
+
catch (builtinError) {
|
|
2565
|
+
let stdout;
|
|
2566
|
+
try {
|
|
2567
|
+
const result = await execFileAsync("feishu", ["fetch", trimmedUrl], {
|
|
2568
|
+
maxBuffer: 10 * 1024 * 1024
|
|
2569
|
+
});
|
|
2570
|
+
stdout = result.stdout;
|
|
2557
2571
|
}
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2572
|
+
catch (error) {
|
|
2573
|
+
const execError = error;
|
|
2574
|
+
const cliDetail = execError?.code === "ENOENT"
|
|
2575
|
+
? "the `feishu` CLI is not installed or not on PATH"
|
|
2576
|
+
: execError?.stderr?.trim() || execError?.stdout?.trim() || execError?.message || "unknown error";
|
|
2577
|
+
const builtinDetail = builtinError instanceof Error ? builtinError.message : String(builtinError);
|
|
2578
|
+
throw new Error(`submit could not fetch the Feishu document via built-in app (${builtinDetail}) or via \`feishu fetch\` (${cliDetail}).`);
|
|
2579
|
+
}
|
|
2580
|
+
let payload;
|
|
2581
|
+
try {
|
|
2582
|
+
payload = JSON.parse(stdout);
|
|
2583
|
+
}
|
|
2584
|
+
catch {
|
|
2585
|
+
throw new Error("submit received non-JSON output from `feishu fetch`.");
|
|
2586
|
+
}
|
|
2587
|
+
if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
|
|
2588
|
+
throw new Error("submit received an invalid response from `feishu fetch`.");
|
|
2589
|
+
}
|
|
2590
|
+
const record = payload;
|
|
2591
|
+
const markdown = typeof record.markdown === "string" ? record.markdown.trim() : "";
|
|
2592
|
+
const title = (typeof record.title === "string" ? record.title.trim() : "") || extractTitleFromMarkdown(markdown);
|
|
2593
|
+
const sourceDocumentType = typeof record.type === "string" ? record.type.trim() : undefined;
|
|
2594
|
+
const referenceMaterials = extractFeishuReferenceMaterials(markdown, record.media, trimmedUrl);
|
|
2595
|
+
if (!markdown) {
|
|
2596
|
+
throw new Error("submit fetched the document URL, but it did not return readable markdown content.");
|
|
2597
|
+
}
|
|
2598
|
+
return {
|
|
2599
|
+
content: markdown,
|
|
2600
|
+
...(title ? { title } : {}),
|
|
2601
|
+
sourceType: "feishu_doc",
|
|
2602
|
+
...(sourceDocumentType ? { sourceDocumentType } : {}),
|
|
2603
|
+
...(referenceMaterials ? { referenceMaterials } : {})
|
|
2604
|
+
};
|
|
2578
2605
|
}
|
|
2579
|
-
return {
|
|
2580
|
-
content: markdown,
|
|
2581
|
-
...(title ? { title } : {}),
|
|
2582
|
-
sourceType: "feishu_doc",
|
|
2583
|
-
...(sourceDocumentType ? { sourceDocumentType } : {}),
|
|
2584
|
-
...(referenceMaterials ? { referenceMaterials } : {})
|
|
2585
|
-
};
|
|
2586
2606
|
}
|
|
2587
2607
|
async function main() {
|
|
2588
2608
|
const argv = process.argv.slice(2);
|
|
@@ -2799,7 +2819,7 @@ async function main() {
|
|
|
2799
2819
|
}
|
|
2800
2820
|
else {
|
|
2801
2821
|
try {
|
|
2802
|
-
const remote = await resolveTaskTextFromUrl(url);
|
|
2822
|
+
const remote = await runWithTerminalLoading("Resolving remote requirement document", async () => await resolveTaskTextFromUrl(url));
|
|
2803
2823
|
description = remote.content;
|
|
2804
2824
|
resolvedTitle = resolvedTitle || remote.title;
|
|
2805
2825
|
remoteSourceType = remote.sourceType;
|
|
@@ -4031,7 +4051,7 @@ function renderTaskResultReport(input) {
|
|
|
4031
4051
|
lines.push(`Metrics: ${metrics}`);
|
|
4032
4052
|
}
|
|
4033
4053
|
if (input.deliveryBundle.warnings?.length) {
|
|
4034
|
-
lines.push(`Warnings: ${input.deliveryBundle.warnings
|
|
4054
|
+
lines.push(`Warnings: ${formatDeliveryWarningsWithDescriptions(input.deliveryBundle.warnings)}`);
|
|
4035
4055
|
}
|
|
4036
4056
|
if (input.deliveryBundle.publication) {
|
|
4037
4057
|
lines.push(`Publication: ${input.deliveryBundle.publication.action}${input.deliveryBundle.publication.reason ? ` (${input.deliveryBundle.publication.reason})` : ""}`);
|
|
@@ -4144,7 +4164,7 @@ function renderDeliveryStatusReport(input) {
|
|
|
4144
4164
|
lines.push(`Decision: ${input.deliveryBundle.summary.decision}`);
|
|
4145
4165
|
lines.push(`Created At: ${input.deliveryBundle.createdAt}`);
|
|
4146
4166
|
if (input.deliveryBundle.warnings?.length) {
|
|
4147
|
-
lines.push(`Warnings: ${input.deliveryBundle.warnings
|
|
4167
|
+
lines.push(`Warnings: ${formatDeliveryWarningsWithDescriptions(input.deliveryBundle.warnings)}`);
|
|
4148
4168
|
}
|
|
4149
4169
|
}
|
|
4150
4170
|
else {
|