@sireai/optimus 0.1.1
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/.env.example +16 -0
- package/LICENSE +21 -0
- package/README.md +104 -0
- package/dist/cli/optimus.d.ts +2 -0
- package/dist/cli/optimus.js +2951 -0
- package/dist/cli/optimus.js.map +1 -0
- package/dist/cli/self-update.d.ts +49 -0
- package/dist/cli/self-update.js +264 -0
- package/dist/cli/self-update.js.map +1 -0
- package/dist/config/load-config.d.ts +3 -0
- package/dist/config/load-config.js +321 -0
- package/dist/config/load-config.js.map +1 -0
- package/dist/config/optimus-paths.d.ts +13 -0
- package/dist/config/optimus-paths.js +44 -0
- package/dist/config/optimus-paths.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/jira/jira-cli.d.ts +1 -0
- package/dist/integrations/jira/jira-cli.js +278 -0
- package/dist/integrations/jira/jira-cli.js.map +1 -0
- package/dist/integrations/jira/jira-client.d.ts +99 -0
- package/dist/integrations/jira/jira-client.js +521 -0
- package/dist/integrations/jira/jira-client.js.map +1 -0
- package/dist/integrations/jira/jira-submit.d.ts +71 -0
- package/dist/integrations/jira/jira-submit.js +351 -0
- package/dist/integrations/jira/jira-submit.js.map +1 -0
- package/dist/problem-solving-core/codex/codex-auth-resolver.d.ts +23 -0
- package/dist/problem-solving-core/codex/codex-auth-resolver.js +136 -0
- package/dist/problem-solving-core/codex/codex-auth-resolver.js.map +1 -0
- package/dist/problem-solving-core/codex/codex-connectivity-checks.d.ts +6 -0
- package/dist/problem-solving-core/codex/codex-connectivity-checks.js +81 -0
- package/dist/problem-solving-core/codex/codex-connectivity-checks.js.map +1 -0
- package/dist/problem-solving-core/codex/codex-failure-classifier.d.ts +2 -0
- package/dist/problem-solving-core/codex/codex-failure-classifier.js +49 -0
- package/dist/problem-solving-core/codex/codex-failure-classifier.js.map +1 -0
- package/dist/problem-solving-core/codex/codex-global-config.d.ts +17 -0
- package/dist/problem-solving-core/codex/codex-global-config.js +100 -0
- package/dist/problem-solving-core/codex/codex-global-config.js.map +1 -0
- package/dist/problem-solving-core/codex/codex-preflight.d.ts +13 -0
- package/dist/problem-solving-core/codex/codex-preflight.js +142 -0
- package/dist/problem-solving-core/codex/codex-preflight.js.map +1 -0
- package/dist/problem-solving-core/codex/codex-provider-profile.d.ts +14 -0
- package/dist/problem-solving-core/codex/codex-provider-profile.js +68 -0
- package/dist/problem-solving-core/codex/codex-provider-profile.js.map +1 -0
- package/dist/problem-solving-core/codex/codex-required-env.d.ts +3 -0
- package/dist/problem-solving-core/codex/codex-required-env.js +21 -0
- package/dist/problem-solving-core/codex/codex-required-env.js.map +1 -0
- package/dist/problem-solving-core/codex/codex-runner.d.ts +37 -0
- package/dist/problem-solving-core/codex/codex-runner.js +926 -0
- package/dist/problem-solving-core/codex/codex-runner.js.map +1 -0
- package/dist/problem-solving-core/codex/evolution-skill-guard.d.ts +36 -0
- package/dist/problem-solving-core/codex/evolution-skill-guard.js +143 -0
- package/dist/problem-solving-core/codex/evolution-skill-guard.js.map +1 -0
- package/dist/problem-solving-core/codex/repo-memory-service.d.ts +24 -0
- package/dist/problem-solving-core/codex/repo-memory-service.js +114 -0
- package/dist/problem-solving-core/codex/repo-memory-service.js.map +1 -0
- package/dist/problem-solving-core/codex/skill-sync-service.d.ts +35 -0
- package/dist/problem-solving-core/codex/skill-sync-service.js +280 -0
- package/dist/problem-solving-core/codex/skill-sync-service.js.map +1 -0
- package/dist/task-environment/cancellation/task-abort-registry.d.ts +17 -0
- package/dist/task-environment/cancellation/task-abort-registry.js +51 -0
- package/dist/task-environment/cancellation/task-abort-registry.js.map +1 -0
- package/dist/task-environment/cancellation/task-cancellation-service.d.ts +25 -0
- package/dist/task-environment/cancellation/task-cancellation-service.js +54 -0
- package/dist/task-environment/cancellation/task-cancellation-service.js.map +1 -0
- package/dist/task-environment/cancellation/task-cleanup-service.d.ts +22 -0
- package/dist/task-environment/cancellation/task-cleanup-service.js +67 -0
- package/dist/task-environment/cancellation/task-cleanup-service.js.map +1 -0
- package/dist/task-environment/delivery/commit-message/bugfix-commit-message-template.d.ts +13 -0
- package/dist/task-environment/delivery/commit-message/bugfix-commit-message-template.js +83 -0
- package/dist/task-environment/delivery/commit-message/bugfix-commit-message-template.js.map +1 -0
- package/dist/task-environment/delivery/commit-message/commit-message-builder.d.ts +6 -0
- package/dist/task-environment/delivery/commit-message/commit-message-builder.js +15 -0
- package/dist/task-environment/delivery/commit-message/commit-message-builder.js.map +1 -0
- package/dist/task-environment/delivery/commit-message/commit-message-template-types.d.ts +16 -0
- package/dist/task-environment/delivery/commit-message/commit-message-template-types.js +2 -0
- package/dist/task-environment/delivery/commit-message/commit-message-template-types.js.map +1 -0
- package/dist/task-environment/delivery/feishu-analysis-doc-service.d.ts +50 -0
- package/dist/task-environment/delivery/feishu-analysis-doc-service.js +454 -0
- package/dist/task-environment/delivery/feishu-analysis-doc-service.js.map +1 -0
- package/dist/task-environment/delivery/feishu-card-renderer.d.ts +38 -0
- package/dist/task-environment/delivery/feishu-card-renderer.js +449 -0
- package/dist/task-environment/delivery/feishu-card-renderer.js.map +1 -0
- package/dist/task-environment/delivery/feishu-content/feishu-content-renderer.d.ts +34 -0
- package/dist/task-environment/delivery/feishu-content/feishu-content-renderer.js +201 -0
- package/dist/task-environment/delivery/feishu-content/feishu-content-renderer.js.map +1 -0
- package/dist/task-environment/delivery/feishu-content/feishu-copy-config.d.ts +27 -0
- package/dist/task-environment/delivery/feishu-content/feishu-copy-config.js +74 -0
- package/dist/task-environment/delivery/feishu-content/feishu-copy-config.js.map +1 -0
- package/dist/task-environment/delivery/feishu-notifier.d.ts +45 -0
- package/dist/task-environment/delivery/feishu-notifier.js +250 -0
- package/dist/task-environment/delivery/feishu-notifier.js.map +1 -0
- package/dist/task-environment/delivery/feishu-templates/analysis-message-template.d.ts +6 -0
- package/dist/task-environment/delivery/feishu-templates/analysis-message-template.js +39 -0
- package/dist/task-environment/delivery/feishu-templates/analysis-message-template.js.map +1 -0
- package/dist/task-environment/delivery/feishu-templates/bugfix-message-template.d.ts +6 -0
- package/dist/task-environment/delivery/feishu-templates/bugfix-message-template.js +40 -0
- package/dist/task-environment/delivery/feishu-templates/bugfix-message-template.js.map +1 -0
- package/dist/task-environment/delivery/feishu-templates/default-message-template.d.ts +6 -0
- package/dist/task-environment/delivery/feishu-templates/default-message-template.js +33 -0
- package/dist/task-environment/delivery/feishu-templates/default-message-template.js.map +1 -0
- package/dist/task-environment/delivery/feishu-templates/patch-message-template.d.ts +6 -0
- package/dist/task-environment/delivery/feishu-templates/patch-message-template.js +40 -0
- package/dist/task-environment/delivery/feishu-templates/patch-message-template.js.map +1 -0
- package/dist/task-environment/delivery/feishu-templates/template-registry.d.ts +2 -0
- package/dist/task-environment/delivery/feishu-templates/template-registry.js +11 -0
- package/dist/task-environment/delivery/feishu-templates/template-registry.js.map +1 -0
- package/dist/task-environment/delivery/feishu-templates/template-types.d.ts +20 -0
- package/dist/task-environment/delivery/feishu-templates/template-types.js +2 -0
- package/dist/task-environment/delivery/feishu-templates/template-types.js.map +1 -0
- package/dist/task-environment/delivery/task-delivery-dispatcher.d.ts +14 -0
- package/dist/task-environment/delivery/task-delivery-dispatcher.js +109 -0
- package/dist/task-environment/delivery/task-delivery-dispatcher.js.map +1 -0
- package/dist/task-environment/delivery/task-delivery-service.d.ts +33 -0
- package/dist/task-environment/delivery/task-delivery-service.js +432 -0
- package/dist/task-environment/delivery/task-delivery-service.js.map +1 -0
- package/dist/task-environment/delivery/task-publication-service.d.ts +97 -0
- package/dist/task-environment/delivery/task-publication-service.js +1369 -0
- package/dist/task-environment/delivery/task-publication-service.js.map +1 -0
- package/dist/task-environment/execution-addresses.d.ts +40 -0
- package/dist/task-environment/execution-addresses.js +63 -0
- package/dist/task-environment/execution-addresses.js.map +1 -0
- package/dist/task-environment/intake/cli-file-intake.d.ts +12 -0
- package/dist/task-environment/intake/cli-file-intake.js +56 -0
- package/dist/task-environment/intake/cli-file-intake.js.map +1 -0
- package/dist/task-environment/intake/manual-problem-intake.d.ts +3 -0
- package/dist/task-environment/intake/manual-problem-intake.js +57 -0
- package/dist/task-environment/intake/manual-problem-intake.js.map +1 -0
- package/dist/task-environment/intake/polling-problem-intake.d.ts +14 -0
- package/dist/task-environment/intake/polling-problem-intake.js +232 -0
- package/dist/task-environment/intake/polling-problem-intake.js.map +1 -0
- package/dist/task-environment/observability/logger.d.ts +76 -0
- package/dist/task-environment/observability/logger.js +604 -0
- package/dist/task-environment/observability/logger.js.map +1 -0
- package/dist/task-environment/observability/runtime-panel.d.ts +82 -0
- package/dist/task-environment/observability/runtime-panel.js +1008 -0
- package/dist/task-environment/observability/runtime-panel.js.map +1 -0
- package/dist/task-environment/observability/sound-notifier.d.ts +18 -0
- package/dist/task-environment/observability/sound-notifier.js +71 -0
- package/dist/task-environment/observability/sound-notifier.js.map +1 -0
- package/dist/task-environment/orchestration/execution-context-assembler.d.ts +41 -0
- package/dist/task-environment/orchestration/execution-context-assembler.js +464 -0
- package/dist/task-environment/orchestration/execution-context-assembler.js.map +1 -0
- package/dist/task-environment/orchestration/git-change-classifier.d.ts +19 -0
- package/dist/task-environment/orchestration/git-change-classifier.js +106 -0
- package/dist/task-environment/orchestration/git-change-classifier.js.map +1 -0
- package/dist/task-environment/orchestration/harness-registry.d.ts +27 -0
- package/dist/task-environment/orchestration/harness-registry.js +116 -0
- package/dist/task-environment/orchestration/harness-registry.js.map +1 -0
- package/dist/task-environment/orchestration/harness-resolver.d.ts +8 -0
- package/dist/task-environment/orchestration/harness-resolver.js +39 -0
- package/dist/task-environment/orchestration/harness-resolver.js.map +1 -0
- package/dist/task-environment/orchestration/task-orchestrator.d.ts +45 -0
- package/dist/task-environment/orchestration/task-orchestrator.js +1122 -0
- package/dist/task-environment/orchestration/task-orchestrator.js.map +1 -0
- package/dist/task-environment/orchestration/task-package-assembler.d.ts +4 -0
- package/dist/task-environment/orchestration/task-package-assembler.js +10 -0
- package/dist/task-environment/orchestration/task-package-assembler.js.map +1 -0
- package/dist/task-environment/orchestration/triage-agent.d.ts +54 -0
- package/dist/task-environment/orchestration/triage-agent.js +636 -0
- package/dist/task-environment/orchestration/triage-agent.js.map +1 -0
- package/dist/task-environment/orchestration/triage-runner.d.ts +65 -0
- package/dist/task-environment/orchestration/triage-runner.js +655 -0
- package/dist/task-environment/orchestration/triage-runner.js.map +1 -0
- package/dist/task-environment/publication-target.d.ts +12 -0
- package/dist/task-environment/publication-target.js +174 -0
- package/dist/task-environment/publication-target.js.map +1 -0
- package/dist/task-environment/runtime/blocking-event-queue.d.ts +7 -0
- package/dist/task-environment/runtime/blocking-event-queue.js +27 -0
- package/dist/task-environment/runtime/blocking-event-queue.js.map +1 -0
- package/dist/task-environment/runtime/optimus-runtime.d.ts +69 -0
- package/dist/task-environment/runtime/optimus-runtime.js +751 -0
- package/dist/task-environment/runtime/optimus-runtime.js.map +1 -0
- package/dist/task-environment/storage/sqlite-event-store.d.ts +52 -0
- package/dist/task-environment/storage/sqlite-event-store.js +288 -0
- package/dist/task-environment/storage/sqlite-event-store.js.map +1 -0
- package/dist/task-environment/storage/sqlite-task-store.d.ts +122 -0
- package/dist/task-environment/storage/sqlite-task-store.js +1182 -0
- package/dist/task-environment/storage/sqlite-task-store.js.map +1 -0
- package/dist/types.d.ts +629 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/embedded-skills/shared/repo-inspection/SKILL.md +9 -0
- package/embedded-skills/shared/repo-inspection/skill.json +5 -0
- package/embedded-skills/task/bugfix/android-debug-protocol/SKILL.md +10 -0
- package/embedded-skills/task/bugfix/android-debug-protocol/skill.json +6 -0
- package/harness/AGENTS.md +30 -0
- package/harness/CHECKLIST.md +44 -0
- package/harness/CONSTRAINTS.md +60 -0
- package/harness/FRAMEWORK.md +28 -0
- package/harness/GOAL.md +28 -0
- package/harness/HANDOFF.md +45 -0
- package/harness/TASK_PLAN.md +79 -0
- package/optimus.config.template.json +34 -0
- package/package.json +109 -0
- package/task-harnesses/bugfix/ACCEPT.md +47 -0
- package/task-harnesses/bugfix/CONSTRAINTS.md +46 -0
- package/task-harnesses/bugfix/CONTEXT.md +29 -0
- package/task-harnesses/bugfix/EVOLUTION.md +82 -0
- package/task-harnesses/bugfix/ROLE.md +29 -0
- package/task-harnesses/bugfix/STANDARD.md +250 -0
- package/task-harnesses/bugfix/manifest.json +13 -0
- package/task-harnesses/registry.json +8 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
const ALLOWED_MANIFEST_KEYS = new Set(["id", "triageRules", "executionRules"]);
|
|
4
|
+
// HarnessRegistry is intentionally narrow.
|
|
5
|
+
// It catalogs which harness exists and where its rule documents live, while the actual semantics remain in Markdown.
|
|
6
|
+
// This keeps task-type registration declarative and makes triage/execution document discovery follow one manifest contract.
|
|
7
|
+
export class HarnessRegistry {
|
|
8
|
+
definitions = new Map();
|
|
9
|
+
manifestsByDir = new Map();
|
|
10
|
+
fallbackDefinition;
|
|
11
|
+
constructor(config) {
|
|
12
|
+
const registryPath = join(config.runtime.taskHarnessRootDir, "registry.json");
|
|
13
|
+
const registryFile = this.readRegistryFile(registryPath);
|
|
14
|
+
const seenTaskTypes = new Set();
|
|
15
|
+
const seenHarnessDirs = new Set();
|
|
16
|
+
for (const definition of registryFile.harnesses) {
|
|
17
|
+
this.assertValidDefinition(definition, registryPath);
|
|
18
|
+
this.assertUnique(definition.taskType, seenTaskTypes, `Duplicate taskType ${definition.taskType} in ${registryPath}.`);
|
|
19
|
+
this.assertUnique(definition.dir, seenHarnessDirs, `Duplicate dir ${definition.dir} in ${registryPath}.`);
|
|
20
|
+
const manifest = this.readAndValidateHarnessManifest(config, definition, registryPath);
|
|
21
|
+
this.definitions.set(definition.taskType, definition);
|
|
22
|
+
this.manifestsByDir.set(definition.dir, manifest);
|
|
23
|
+
}
|
|
24
|
+
const bugfixDefinition = this.definitions.get("bugfix");
|
|
25
|
+
if (!bugfixDefinition) {
|
|
26
|
+
throw new Error(`Harness registry ${registryPath} must include a bugfix definition.`);
|
|
27
|
+
}
|
|
28
|
+
this.fallbackDefinition = {
|
|
29
|
+
...bugfixDefinition
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
get(taskType) {
|
|
33
|
+
return this.definitions.get(taskType) ?? this.fallbackDefinition;
|
|
34
|
+
}
|
|
35
|
+
getManifest(taskType) {
|
|
36
|
+
const definition = this.get(taskType);
|
|
37
|
+
const manifest = this.manifestsByDir.get(definition.dir);
|
|
38
|
+
if (!manifest) {
|
|
39
|
+
throw new Error(`Harness manifest not loaded for taskType ${taskType} (dir=${definition.dir}).`);
|
|
40
|
+
}
|
|
41
|
+
return manifest;
|
|
42
|
+
}
|
|
43
|
+
list() {
|
|
44
|
+
return Array.from(this.definitions.values());
|
|
45
|
+
}
|
|
46
|
+
listTaskTypes() {
|
|
47
|
+
return this.list().map((definition) => definition.taskType);
|
|
48
|
+
}
|
|
49
|
+
readRegistryFile(registryPath) {
|
|
50
|
+
const raw = readFileSync(registryPath, "utf8");
|
|
51
|
+
const parsed = JSON.parse(raw);
|
|
52
|
+
if (!Array.isArray(parsed.harnesses) || parsed.harnesses.length === 0) {
|
|
53
|
+
throw new Error(`Harness registry ${registryPath} must contain a non-empty harnesses array.`);
|
|
54
|
+
}
|
|
55
|
+
return parsed;
|
|
56
|
+
}
|
|
57
|
+
assertValidDefinition(definition, registryPath) {
|
|
58
|
+
if (!definition.taskType || !definition.dir) {
|
|
59
|
+
throw new Error(`Invalid harness definition in ${registryPath}: taskType and dir are required.`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
readAndValidateHarnessManifest(config, definition, registryPath) {
|
|
63
|
+
const harnessDir = join(config.runtime.taskHarnessRootDir, definition.dir);
|
|
64
|
+
const manifestPath = join(harnessDir, "manifest.json");
|
|
65
|
+
if (!existsSync(manifestPath)) {
|
|
66
|
+
throw new Error(`Harness ${definition.taskType} in ${registryPath} points to missing manifest ${manifestPath}.`);
|
|
67
|
+
}
|
|
68
|
+
const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
69
|
+
for (const key of Object.keys(manifest)) {
|
|
70
|
+
if (!ALLOWED_MANIFEST_KEYS.has(key)) {
|
|
71
|
+
throw new Error(`Harness manifest ${manifestPath} contains unsupported key ${key}; only id, triageRules, and executionRules are allowed.`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (typeof manifest.id !== "string" || manifest.id.trim().length === 0) {
|
|
75
|
+
throw new Error(`Harness manifest ${manifestPath} must declare a non-empty id.`);
|
|
76
|
+
}
|
|
77
|
+
if (manifest.id !== definition.dir) {
|
|
78
|
+
throw new Error(`Harness manifest ${manifestPath} id=${manifest.id} does not match dir=${definition.dir}.`);
|
|
79
|
+
}
|
|
80
|
+
const triageRules = this.validateManifestRuleList(manifestPath, harnessDir, manifest.triageRules, "triageRules");
|
|
81
|
+
const executionRules = this.validateManifestRuleList(manifestPath, harnessDir, manifest.executionRules, "executionRules");
|
|
82
|
+
return {
|
|
83
|
+
id: manifest.id,
|
|
84
|
+
triageRules,
|
|
85
|
+
executionRules,
|
|
86
|
+
harnessDir,
|
|
87
|
+
manifestPath
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
// The manifest explicitly separates triage-time admission rules from execution-time operating rules.
|
|
91
|
+
// This avoids one generic files array whose purpose has to be inferred by each consumer.
|
|
92
|
+
validateManifestRuleList(manifestPath, harnessDir, value, fieldName) {
|
|
93
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
94
|
+
throw new Error(`Harness manifest ${manifestPath} must declare a non-empty ${fieldName} array.`);
|
|
95
|
+
}
|
|
96
|
+
const normalized = value.map((entry) => {
|
|
97
|
+
if (typeof entry !== "string" || entry.trim().length === 0) {
|
|
98
|
+
throw new Error(`Harness manifest ${manifestPath} contains an invalid ${fieldName} entry.`);
|
|
99
|
+
}
|
|
100
|
+
const fileName = entry.trim();
|
|
101
|
+
const targetPath = join(harnessDir, fileName);
|
|
102
|
+
if (!existsSync(targetPath)) {
|
|
103
|
+
throw new Error(`Harness manifest ${manifestPath} references missing ${fieldName} file ${targetPath}.`);
|
|
104
|
+
}
|
|
105
|
+
return fileName;
|
|
106
|
+
});
|
|
107
|
+
return normalized;
|
|
108
|
+
}
|
|
109
|
+
assertUnique(value, seen, message) {
|
|
110
|
+
if (seen.has(value)) {
|
|
111
|
+
throw new Error(message);
|
|
112
|
+
}
|
|
113
|
+
seen.add(value);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=harness-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harness-registry.js","sourceRoot":"","sources":["../../../src/task-environment/orchestration/harness-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,aAAa,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAyB/E,2CAA2C;AAC3C,qHAAqH;AACrH,4HAA4H;AAC5H,MAAM,OAAO,eAAe;IACT,WAAW,GAAG,IAAI,GAAG,EAA6B,CAAC;IACnD,cAAc,GAAG,IAAI,GAAG,EAA2B,CAAC;IACpD,kBAAkB,CAAoB;IAEvD,YAAmB,MAAqB;QACtC,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC;QAC9E,MAAM,YAAY,GAAG,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;QACzD,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;QACxC,MAAM,eAAe,GAAG,IAAI,GAAG,EAAU,CAAC;QAE1C,KAAK,MAAM,UAAU,IAAI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1
|
+
import type { OptimusConfig, ResolvedHarness, TaskPackage } from "../../types.js";
|
|
2
|
+
export declare class HarnessResolver {
|
|
3
|
+
private readonly config;
|
|
4
|
+
private readonly registry;
|
|
5
|
+
constructor(config: OptimusConfig);
|
|
6
|
+
resolve(taskPackage: TaskPackage): ResolvedHarness;
|
|
7
|
+
private readRequiredExecutionDocument;
|
|
8
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { HarnessRegistry } from "./harness-registry.js";
|
|
4
|
+
// HarnessResolver turns a triaged TaskPackage into the concrete execution documents consumed by the runner.
|
|
5
|
+
// It no longer duplicates objective, constraints, or result contract in code; those semantics live in the harness Markdown files.
|
|
6
|
+
export class HarnessResolver {
|
|
7
|
+
config;
|
|
8
|
+
registry;
|
|
9
|
+
constructor(config) {
|
|
10
|
+
this.config = config;
|
|
11
|
+
this.registry = new HarnessRegistry(config);
|
|
12
|
+
}
|
|
13
|
+
resolve(taskPackage) {
|
|
14
|
+
const manifest = this.registry.getManifest(taskPackage.taskType);
|
|
15
|
+
return {
|
|
16
|
+
taskType: taskPackage.taskType,
|
|
17
|
+
roleDocument: this.readRequiredExecutionDocument(manifest.harnessDir, manifest.executionRules, "ROLE.md"),
|
|
18
|
+
constraintsDocument: this.readRequiredExecutionDocument(manifest.harnessDir, manifest.executionRules, "CONSTRAINTS.md"),
|
|
19
|
+
contextDocument: this.readRequiredExecutionDocument(manifest.harnessDir, manifest.executionRules, "CONTEXT.md"),
|
|
20
|
+
standardDocument: this.readRequiredExecutionDocument(manifest.harnessDir, manifest.executionRules, "STANDARD.md"),
|
|
21
|
+
evolutionDocument: this.readRequiredExecutionDocument(manifest.harnessDir, manifest.executionRules, "EVOLUTION.md")
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
// Execution semantics must come from the harness documents themselves.
|
|
25
|
+
// Resolver only guarantees the required document set exists and is materialized for the runner.
|
|
26
|
+
readRequiredExecutionDocument(harnessDir, executionRules, fileName) {
|
|
27
|
+
const matchedFile = executionRules.find((entry) => entry.toUpperCase() === fileName.toUpperCase());
|
|
28
|
+
if (!matchedFile) {
|
|
29
|
+
throw new Error(`Harness ${harnessDir} is missing required execution document ${fileName}.`);
|
|
30
|
+
}
|
|
31
|
+
const targetPath = join(harnessDir, matchedFile);
|
|
32
|
+
return {
|
|
33
|
+
fileName: matchedFile,
|
|
34
|
+
title: matchedFile.replace(/\.md$/i, ""),
|
|
35
|
+
content: readFileSync(targetPath, "utf8")
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=harness-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harness-resolver.js","sourceRoot":"","sources":["../../../src/task-environment/orchestration/harness-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,4GAA4G;AAC5G,kIAAkI;AAClI,MAAM,OAAO,eAAe;IAGU;IAFnB,QAAQ,CAAkB;IAE3C,YAAoC,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;QACvD,IAAI,CAAC,QAAQ,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAEM,OAAO,CAAC,WAAwB;QACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAEjE,OAAO;YACL,QAAQ,EAAE,WAAW,CAAC,QAAQ;YAC9B,YAAY,EAAE,IAAI,CAAC,6BAA6B,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,cAAc,EAAE,SAAS,CAAC;YACzG,mBAAmB,EAAE,IAAI,CAAC,6BAA6B,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,cAAc,EAAE,gBAAgB,CAAC;YACvH,eAAe,EAAE,IAAI,CAAC,6BAA6B,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,cAAc,EAAE,YAAY,CAAC;YAC/G,gBAAgB,EAAE,IAAI,CAAC,6BAA6B,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,cAAc,EAAE,aAAa,CAAC;YACjH,iBAAiB,EAAE,IAAI,CAAC,6BAA6B,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;SACpH,CAAC;IACJ,CAAC;IAED,uEAAuE;IACvE,gGAAgG;IACxF,6BAA6B,CAAC,UAAkB,EAAE,cAAwB,EAAE,QAAgB;QAClG,MAAM,WAAW,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;QACnG,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,WAAW,UAAU,2CAA2C,QAAQ,GAAG,CAAC,CAAC;QAC/F,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;QACjD,OAAO;YACL,QAAQ,EAAE,WAAW;YACrB,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;YACxC,OAAO,EAAE,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC;SAC1C,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { CodexRunner } from "../../problem-solving-core/codex/codex-runner.js";
|
|
2
|
+
import type { OptimusConfig, OrchestratorTask } from "../../types.js";
|
|
3
|
+
import { SQLiteTaskStore } from "../storage/sqlite-task-store.js";
|
|
4
|
+
export declare class TaskOrchestrator {
|
|
5
|
+
private readonly store;
|
|
6
|
+
private readonly codexRunner;
|
|
7
|
+
private readonly config;
|
|
8
|
+
private readonly logger;
|
|
9
|
+
private readonly harnessResolver;
|
|
10
|
+
private readonly executionContextAssembler;
|
|
11
|
+
private readonly evolutionSkillGuard;
|
|
12
|
+
private readonly repoMemoryService;
|
|
13
|
+
private readonly taskDeliveryDispatcher;
|
|
14
|
+
private readonly taskDeliveryService;
|
|
15
|
+
private readonly feishuAnalysisDocService;
|
|
16
|
+
private readonly taskPublicationService;
|
|
17
|
+
constructor(store: SQLiteTaskStore, codexRunner: CodexRunner, config: OptimusConfig);
|
|
18
|
+
run(task: OrchestratorTask): Promise<void>;
|
|
19
|
+
private resolveTerminalLogEvent;
|
|
20
|
+
private cleanupResidualRepoManagedTempBranches;
|
|
21
|
+
private listRepoManagedProjectDirs;
|
|
22
|
+
private findNestedGitRepositories;
|
|
23
|
+
private cleanupRepoManagedProjectBranches;
|
|
24
|
+
private detachFromResidualTempBranch;
|
|
25
|
+
private prepareExecutionContext;
|
|
26
|
+
private prepareExecutionRequest;
|
|
27
|
+
private persistRepoMemoryIfChanged;
|
|
28
|
+
private validateTaskResultContract;
|
|
29
|
+
private validateExecutionIsolation;
|
|
30
|
+
private writePatchArtifactIfNeeded;
|
|
31
|
+
private cleanupCopyWorkspace;
|
|
32
|
+
private readGitStatusEntries;
|
|
33
|
+
private readRepoWorkspaceStatusReports;
|
|
34
|
+
private buildBusinessPatchContent;
|
|
35
|
+
private buildRepoManagedBusinessPatchContent;
|
|
36
|
+
private prefixPatchPaths;
|
|
37
|
+
private buildUntrackedFilePatch;
|
|
38
|
+
private isRepoManagedWorkspace;
|
|
39
|
+
private runCommand;
|
|
40
|
+
private readCommand;
|
|
41
|
+
private renderExecError;
|
|
42
|
+
private resolveFailureCategory;
|
|
43
|
+
private buildTaskEventOptions;
|
|
44
|
+
private buildCompleteTaskRunOptions;
|
|
45
|
+
}
|