akm-cli 0.9.0-rc.0 → 0.9.0-rc.2
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/CHANGELOG.md +339 -2
- package/SECURITY.md +23 -24
- package/dist/assets/help/help-improve.md +10 -10
- package/dist/assets/hints/cli-hints-full.md +44 -10
- package/dist/assets/hints/cli-hints-short.md +6 -2
- package/dist/assets/{profiles → improve-strategies}/default.json +1 -0
- package/dist/assets/{profiles → improve-strategies}/graph-refresh.json +1 -1
- package/dist/assets/{profiles → improve-strategies}/proactive-maintenance.json +2 -3
- package/dist/assets/{profiles → improve-strategies}/reflect-distill.json +3 -4
- package/dist/assets/prompts/workflow-unit-preamble.md +26 -0
- package/dist/assets/stash-skeleton/README.md +28 -0
- package/dist/assets/stash-skeleton/facts/conventions/assets/agent.md +6 -0
- package/dist/assets/stash-skeleton/facts/conventions/assets/command.md +6 -0
- package/dist/assets/stash-skeleton/facts/conventions/assets/fact.md +12 -1
- package/dist/assets/stash-skeleton/facts/conventions/assets/knowledge.md +11 -1
- package/dist/assets/stash-skeleton/facts/conventions/assets/lesson.md +6 -0
- package/dist/assets/stash-skeleton/facts/conventions/assets/memory.md +9 -0
- package/dist/assets/stash-skeleton/facts/conventions/assets/script.md +7 -0
- package/dist/assets/stash-skeleton/facts/conventions/assets/skill.md +7 -0
- package/dist/assets/stash-skeleton/facts/conventions/assets/workflow.md +6 -0
- package/dist/assets/stash-skeleton/facts/conventions/backlinks.md +98 -0
- package/dist/assets/stash-skeleton/facts/conventions/domains.md +63 -0
- package/dist/assets/stash-skeleton/facts/conventions/organization.md +127 -0
- package/dist/assets/tasks/core/backup.yml +1 -0
- package/dist/assets/tasks/core/extract.yml +1 -0
- package/dist/assets/tasks/core/improve.yml +1 -0
- package/dist/assets/tasks/core/index-refresh.yml +1 -0
- package/dist/assets/tasks/core/sync.yml +1 -0
- package/dist/assets/tasks/core/version-check.yml +1 -0
- package/dist/assets/tasks/graph-refresh-weekly.yml +4 -4
- package/dist/assets/templates/html/health.html +5 -1
- package/dist/cli/config-migrate.js +31 -138
- package/dist/cli/config-validate.js +10 -8
- package/dist/cli.js +48 -14
- package/dist/commands/agent/agent-dispatch.js +17 -16
- package/dist/commands/agent/agent-support.js +0 -24
- package/dist/commands/agent/contribute-cli.js +5 -15
- package/dist/commands/backup-cli.js +54 -0
- package/dist/commands/config-cli.js +45 -159
- package/dist/commands/env/env-binding.js +95 -0
- package/dist/commands/env/env-cli.js +8 -65
- package/dist/commands/env/secret.js +8 -5
- package/dist/commands/health/checks.js +130 -83
- package/dist/commands/health/html-report.js +4 -0
- package/dist/commands/health/improve-metrics.js +30 -32
- package/dist/commands/health/llm-usage.js +19 -19
- package/dist/commands/health/md-report.js +4 -0
- package/dist/commands/health/metrics.js +2 -1
- package/dist/commands/health/surfaces.js +5 -4
- package/dist/commands/health.js +1 -1
- package/dist/commands/improve/consolidate/chunking.js +2 -2
- package/dist/commands/improve/consolidate.js +28 -25
- package/dist/commands/improve/distill/promote-memory.js +5 -12
- package/dist/commands/improve/distill/quality-gate.js +5 -7
- package/dist/commands/improve/distill.js +16 -5
- package/dist/commands/improve/eligibility.js +22 -12
- package/dist/commands/improve/extract-cli.js +47 -19
- package/dist/commands/improve/extract.js +110 -62
- package/dist/commands/improve/improve-cli.js +38 -16
- package/dist/commands/improve/improve-result-file.js +30 -24
- package/dist/commands/improve/improve-strategies.js +137 -0
- package/dist/commands/improve/improve.js +60 -30
- package/dist/commands/improve/locks.js +66 -45
- package/dist/commands/improve/loop-stages.js +75 -33
- package/dist/commands/improve/memory/memory-belief.js +79 -7
- package/dist/commands/improve/memory/memory-contradiction-detect.js +12 -4
- package/dist/commands/improve/preparation.js +71 -73
- package/dist/commands/improve/procedural.js +3 -2
- package/dist/commands/improve/recombine.js +2 -1
- package/dist/commands/improve/reflect.js +119 -214
- package/dist/commands/improve/shared.js +11 -5
- package/dist/commands/lint/base-linter.js +152 -42
- package/dist/commands/mv-cli.js +809 -0
- package/dist/commands/proposal/proposal-cli.js +18 -8
- package/dist/commands/proposal/propose.js +64 -69
- package/dist/commands/read/knowledge.js +436 -4
- package/dist/commands/read/remember-cli.js +39 -2
- package/dist/commands/read/search-cli.js +6 -1
- package/dist/commands/registry-cli.js +29 -14
- package/dist/commands/remember.js +2 -0
- package/dist/commands/sources/init.js +13 -14
- package/dist/commands/sources/migration-help.js +7 -4
- package/dist/commands/sources/schema-repair.js +2 -4
- package/dist/commands/sources/source-add.js +62 -73
- package/dist/commands/sources/source-manage.js +50 -46
- package/dist/commands/sources/stash-cli.js +41 -4
- package/dist/commands/tasks/default-tasks.js +12 -12
- package/dist/commands/tasks/tasks-cli.js +7 -3
- package/dist/commands/tasks/tasks.js +113 -18
- package/dist/commands/wiki-cli.js +9 -10
- package/dist/commands/workflow-cli.js +276 -12
- package/dist/core/asset/asset-spec.js +58 -1
- package/dist/core/asset/frontmatter.js +12 -2
- package/dist/core/common.js +5 -3
- package/dist/core/config/config-io.js +28 -17
- package/dist/core/config/config-schema.js +379 -66
- package/dist/core/config/config-types.js +3 -3
- package/dist/core/config/config-version.js +29 -0
- package/dist/core/config/config-walker.js +98 -27
- package/dist/core/config/config.js +132 -266
- package/dist/core/config/deep-merge.js +41 -0
- package/dist/core/config/engine-semantics.js +32 -0
- package/dist/core/errors.js +2 -2
- package/dist/core/extra-params.js +61 -0
- package/dist/core/file-lock.js +201 -56
- package/dist/core/improve-result.js +178 -0
- package/dist/core/json-schema.js +142 -0
- package/dist/core/maintenance-barrier.js +119 -0
- package/dist/core/migration-backup.js +416 -0
- package/dist/core/paths.js +3 -0
- package/dist/core/redaction.js +358 -0
- package/dist/core/state/migrations.js +17 -2
- package/dist/core/state-db.js +44 -1
- package/dist/indexer/db/db.js +118 -2
- package/dist/indexer/graph/graph-extraction.js +28 -16
- package/dist/indexer/index-writer-lock.js +31 -24
- package/dist/indexer/index-written-assets.js +15 -6
- package/dist/indexer/indexer.js +47 -2
- package/dist/indexer/passes/memory-inference.js +10 -6
- package/dist/indexer/passes/metadata.js +250 -0
- package/dist/indexer/search/db-search.js +111 -44
- package/dist/indexer/search/fts-query.js +41 -0
- package/dist/indexer/search/ranking-contributors.js +48 -0
- package/dist/indexer/search/ranking.js +36 -23
- package/dist/indexer/search/search-fields.js +11 -1
- package/dist/indexer/walk/matchers.js +39 -0
- package/dist/integrations/agent/builder-shared.js +7 -0
- package/dist/integrations/agent/builders.js +5 -50
- package/dist/integrations/agent/config.js +3 -143
- package/dist/integrations/agent/detect.js +17 -2
- package/dist/integrations/agent/engine-resolution.js +202 -0
- package/dist/integrations/agent/index.js +1 -2
- package/dist/integrations/agent/model-aliases.js +16 -2
- package/dist/integrations/agent/profiles.js +36 -62
- package/dist/integrations/agent/runner-dispatch.js +91 -4
- package/dist/integrations/agent/runner.js +76 -207
- package/dist/integrations/agent/spawn.js +141 -20
- package/dist/integrations/harnesses/aider/agent-builder.js +112 -0
- package/dist/integrations/harnesses/aider/index.js +57 -0
- package/dist/integrations/harnesses/aider/result-extractor.js +53 -0
- package/dist/integrations/harnesses/amazonq/agent-builder.js +152 -0
- package/dist/integrations/harnesses/amazonq/index.js +58 -0
- package/dist/integrations/harnesses/amazonq/result-extractor.js +48 -0
- package/dist/integrations/harnesses/claude/agent-builder.js +46 -8
- package/dist/integrations/harnesses/claude/index.js +25 -25
- package/dist/integrations/harnesses/claude/result-extractor.js +52 -0
- package/dist/integrations/harnesses/codex/agent-builder.js +136 -0
- package/dist/integrations/harnesses/codex/index.js +62 -0
- package/dist/integrations/harnesses/codex/result-extractor.js +73 -0
- package/dist/integrations/harnesses/copilot/agent-builder.js +121 -0
- package/dist/integrations/harnesses/copilot/index.js +59 -0
- package/dist/integrations/harnesses/copilot/result-extractor.js +151 -0
- package/dist/integrations/harnesses/gemini/agent-builder.js +120 -0
- package/dist/integrations/harnesses/gemini/index.js +59 -0
- package/dist/integrations/harnesses/gemini/result-extractor.js +121 -0
- package/dist/integrations/harnesses/index.js +27 -28
- package/dist/integrations/harnesses/opencode/agent-builder.js +2 -3
- package/dist/integrations/harnesses/opencode/index.js +15 -22
- package/dist/integrations/harnesses/opencode-sdk/harness.js +60 -0
- package/dist/integrations/harnesses/opencode-sdk/index.js +8 -32
- package/dist/integrations/harnesses/opencode-sdk/sdk-runner.js +681 -108
- package/dist/integrations/harnesses/openhands/agent-builder.js +125 -0
- package/dist/integrations/harnesses/openhands/index.js +57 -0
- package/dist/integrations/harnesses/openhands/result-extractor.js +103 -0
- package/dist/integrations/harnesses/pi/agent-builder.js +103 -0
- package/dist/integrations/harnesses/pi/index.js +57 -0
- package/dist/integrations/harnesses/pi/result-extractor.js +135 -0
- package/dist/integrations/harnesses/types.js +8 -32
- package/dist/integrations/lockfile.js +32 -21
- package/dist/integrations/session-logs/index.js +24 -11
- package/dist/llm/client.js +48 -14
- package/dist/llm/feature-gate.js +15 -47
- package/dist/llm/graph-extract.js +1 -1
- package/dist/llm/index-passes.js +8 -42
- package/dist/llm/memory-infer-impl.js +1 -1
- package/dist/llm/usage-persist.js +4 -0
- package/dist/llm/usage-telemetry.js +35 -5
- package/dist/output/renderers.js +3 -2
- package/dist/output/shapes/helpers.js +2 -1
- package/dist/output/shapes/passthrough.js +6 -0
- package/dist/output/text/helpers.js +215 -2
- package/dist/output/text/workflow.js +3 -1
- package/dist/schemas/akm-config.json +16638 -0
- package/dist/schemas/akm-task.json +87 -0
- package/dist/schemas/akm-workflow.json +372 -0
- package/dist/scripts/migrate-storage.js +10944 -8801
- package/dist/scripts/migrations/import-fs-improve-runs-to-db.js +9247 -350
- package/dist/setup/detected-engines.js +142 -0
- package/dist/setup/engine-config.js +89 -0
- package/dist/setup/setup.js +236 -132
- package/dist/setup/steps/connection.js +61 -32
- package/dist/setup/steps/platforms.js +4 -4
- package/dist/setup/steps.js +3 -2
- package/dist/storage/database.js +13 -1
- package/dist/storage/engines/sqlite-migrations.js +1 -0
- package/dist/storage/repositories/improve-runs-repository.js +5 -5
- package/dist/storage/repositories/task-history-repository.js +78 -0
- package/dist/storage/repositories/workflow-runs-repository.js +190 -1
- package/dist/tasks/parser.js +138 -52
- package/dist/tasks/runner.js +71 -75
- package/dist/tasks/schema.js +1 -1
- package/dist/tasks/validator.js +11 -6
- package/dist/text-import-hook.mjs +1 -1
- package/dist/wiki/wiki.js +9 -8
- package/dist/workflows/authoring/authoring.js +123 -10
- package/dist/workflows/authoring/workflow-program-template.yaml +31 -0
- package/dist/workflows/cli.js +4 -0
- package/dist/workflows/concurrency-policy.js +15 -0
- package/dist/workflows/db.js +200 -13
- package/dist/workflows/exec/brief.js +478 -0
- package/dist/workflows/exec/frozen-judge.js +47 -0
- package/dist/workflows/exec/native-executor.js +1034 -0
- package/dist/workflows/exec/param-secrets.js +115 -0
- package/dist/workflows/exec/report.js +1355 -0
- package/dist/workflows/exec/run-workflow.js +609 -0
- package/dist/workflows/exec/scheduler.js +71 -0
- package/dist/workflows/exec/step-work.js +1212 -0
- package/dist/workflows/exec/unit-writer.js +23 -0
- package/dist/workflows/exec/watch.js +116 -0
- package/dist/workflows/exec/worktree.js +171 -0
- package/dist/workflows/ir/compile.js +375 -0
- package/dist/workflows/ir/freeze.js +243 -0
- package/dist/workflows/ir/params.js +54 -0
- package/dist/workflows/ir/plan-hash.js +68 -0
- package/dist/workflows/ir/schema.js +545 -0
- package/dist/workflows/parser.js +10 -1
- package/dist/workflows/program/expressions.js +369 -0
- package/dist/workflows/program/parser.js +869 -0
- package/dist/workflows/program/project.js +104 -0
- package/dist/workflows/program/schema.js +54 -0
- package/dist/workflows/renderer.js +82 -5
- package/dist/workflows/resource-limits.js +20 -0
- package/dist/workflows/runtime/agent-identity.js +59 -14
- package/dist/workflows/runtime/plan-classifier.js +187 -0
- package/dist/workflows/runtime/runs.js +246 -69
- package/dist/workflows/runtime/unit-checkin.js +45 -0
- package/dist/workflows/runtime/workflow-asset-loader.js +42 -1
- package/dist/workflows/validate-summary.js +24 -3
- package/dist/workflows/validator.js +26 -1
- package/docs/data-and-telemetry.md +4 -3
- package/docs/migration/release-notes/0.6.0.md +1 -1
- package/docs/migration/release-notes/0.7.0.md +5 -4
- package/docs/migration/release-notes/0.9.0-beta.60.md +19 -0
- package/docs/migration/v0.8-to-v0.9.md +401 -0
- package/package.json +4 -2
- package/schemas/akm-config.json +16638 -0
- package/schemas/akm-task.json +87 -0
- package/schemas/akm-workflow.json +372 -0
- package/dist/commands/improve/improve-profiles.js +0 -168
- package/dist/core/config/config-migration.js +0 -602
- package/dist/core/deep-merge.js +0 -38
- package/dist/llm/call-ai.js +0 -62
- package/dist/setup/legacy-config.js +0 -106
- package/docs/README.md +0 -104
- /package/dist/assets/{profiles → improve-strategies}/catchup.json +0 -0
- /package/dist/assets/{profiles → improve-strategies}/consolidate.json +0 -0
- /package/dist/assets/{profiles → improve-strategies}/frequent.json +0 -0
- /package/dist/assets/{profiles → improve-strategies}/memory-focus.json +0 -0
- /package/dist/assets/{profiles → improve-strategies}/quick.json +0 -0
- /package/dist/assets/{profiles → improve-strategies}/recombine-only.json +0 -0
- /package/dist/assets/{profiles → improve-strategies}/synthesize.json +0 -0
- /package/dist/assets/{profiles → improve-strategies}/thorough.json +0 -0
|
@@ -17,9 +17,22 @@
|
|
|
17
17
|
* harness in #563/#564; this step only owns ids + capability membership and
|
|
18
18
|
* wires the existing call sites to consult it (behaviour-preserving).
|
|
19
19
|
*/
|
|
20
|
+
import { AiderHarness } from "./aider/index.js";
|
|
21
|
+
import { AmazonqHarness } from "./amazonq/index.js";
|
|
20
22
|
import { ClaudeHarness } from "./claude/index.js";
|
|
23
|
+
import { CodexHarness } from "./codex/index.js";
|
|
24
|
+
import { CopilotHarness } from "./copilot/index.js";
|
|
25
|
+
import { GeminiHarness } from "./gemini/index.js";
|
|
21
26
|
import { OpencodeHarness } from "./opencode/index.js";
|
|
22
|
-
|
|
27
|
+
// Import the descriptor from its LEAF module, not the per-harness barrel: the
|
|
28
|
+
// barrel re-exports `./sdk-runner` (which imports `core/config`, and
|
|
29
|
+
// `core/config/config-types` derives `VALID_HARNESS_IDS` back from this file).
|
|
30
|
+
// Importing the class through the barrel would form an initialization cycle
|
|
31
|
+
// that throws a TDZ error when the barrel is the first module loaded in a fresh
|
|
32
|
+
// graph (see ./opencode-sdk/harness.ts). This keeps the registry a config-leaf.
|
|
33
|
+
import { OpencodeSdkHarness } from "./opencode-sdk/harness.js";
|
|
34
|
+
import { OpenhandsHarness } from "./openhands/index.js";
|
|
35
|
+
import { PiHarness } from "./pi/index.js";
|
|
23
36
|
// Each harness descriptor (ClaudeHarness, OpencodeHarness, OpencodeSdkHarness)
|
|
24
37
|
// lives in its own per-harness directory alongside that harness's session-log
|
|
25
38
|
// reader, agent builder, config importer, and/or SDK runner (#563/#564). They
|
|
@@ -33,13 +46,22 @@ import { OpencodeSdkHarness } from "./opencode-sdk/index.js";
|
|
|
33
46
|
* `z.enum(...)`, and the `platform` union all need the literal types.
|
|
34
47
|
*/
|
|
35
48
|
// Order is significant: VALID_HARNESS_IDS derives from this array and feeds the
|
|
36
|
-
// committed JSON-schema enum order.
|
|
37
|
-
//
|
|
38
|
-
//
|
|
49
|
+
// committed JSON-schema enum order. The original [opencode, claude,
|
|
50
|
+
// opencode-sdk] prefix is preserved so the pre-unification portion of the
|
|
51
|
+
// generated schema enum does not reorder (#562); the seven P2 harness adapters
|
|
52
|
+
// (plan §"Capability matrix") are appended after it, which extends the enum
|
|
53
|
+
// additively (schemas/akm-config.json is regenerated in lockstep).
|
|
39
54
|
export const HARNESS_REGISTRY = Object.freeze([
|
|
40
55
|
new OpencodeHarness(),
|
|
41
56
|
new ClaudeHarness(),
|
|
42
57
|
new OpencodeSdkHarness(),
|
|
58
|
+
new CodexHarness(),
|
|
59
|
+
new CopilotHarness(),
|
|
60
|
+
new PiHarness(),
|
|
61
|
+
new GeminiHarness(),
|
|
62
|
+
new AiderHarness(),
|
|
63
|
+
new AmazonqHarness(),
|
|
64
|
+
new OpenhandsHarness(),
|
|
43
65
|
]);
|
|
44
66
|
/** Lookup by canonical id. */
|
|
45
67
|
export const HARNESS_BY_ID = new Map(HARNESS_REGISTRY.map((h) => [h.id, h]));
|
|
@@ -60,7 +82,7 @@ const HARNESS_BY_ANY_ID = (() => {
|
|
|
60
82
|
})();
|
|
61
83
|
/**
|
|
62
84
|
* Canonical, ordered list of valid harness / platform ids. The Zod
|
|
63
|
-
* `AgentPlatformSchema` enum, the
|
|
85
|
+
* `AgentPlatformSchema` enum, the agent-engine platform union, and
|
|
64
86
|
* setup's `DetectedHarness` union all derive from this so they cannot drift.
|
|
65
87
|
*/
|
|
66
88
|
export const VALID_HARNESS_IDS = Object.freeze(HARNESS_REGISTRY.map((h) => h.id));
|
|
@@ -90,29 +112,6 @@ export function getHarness(id) {
|
|
|
90
112
|
export function normalizeHarnessId(id) {
|
|
91
113
|
return HARNESS_BY_ANY_ID.get(id)?.id ?? id;
|
|
92
114
|
}
|
|
93
|
-
/**
|
|
94
|
-
* Resolve a legacy v1 agent-profile name to its v2 platform id (#566).
|
|
95
|
-
*
|
|
96
|
-
* v1 agent profiles never carried an explicit `platform`; it had to be inferred
|
|
97
|
-
* from the profile name. This is the SINGLE registry-backed resolver that
|
|
98
|
-
* replaces both the old standalone `guessAgentPlatform()` in config-migration
|
|
99
|
-
* and the `name.includes("claude") ? "claude" : "opencode"` heuristic in setup.
|
|
100
|
-
* Each harness owns its own `matchesV1ProfileName()`; an unknown name matches no
|
|
101
|
-
* harness and returns `undefined`, so the caller drops it instead of silently
|
|
102
|
-
* defaulting to `'opencode'`.
|
|
103
|
-
*
|
|
104
|
-
* Harnesses are consulted most-specific-id-first (longest id wins) so a
|
|
105
|
-
* decorated name like `"opencode-sdk-fast"` resolves to `'opencode-sdk'` rather
|
|
106
|
-
* than being over-matched by OpenCode's `"opencode"` prefix.
|
|
107
|
-
*/
|
|
108
|
-
const V1_RESOLUTION_ORDER = [...HARNESS_REGISTRY].sort((a, b) => b.id.length - a.id.length);
|
|
109
|
-
export function v1ProfilePlatform(name) {
|
|
110
|
-
for (const h of V1_RESOLUTION_ORDER) {
|
|
111
|
-
if (h.matchesV1ProfileName(name))
|
|
112
|
-
return h.id;
|
|
113
|
-
}
|
|
114
|
-
return undefined;
|
|
115
|
-
}
|
|
116
115
|
/**
|
|
117
116
|
* Default agent-profile name for a detected harness id (#566).
|
|
118
117
|
*
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
* pre-migration `opencodeBuilder`. The builder's `platform` stays `'opencode'`
|
|
15
15
|
* (the canonical harness id).
|
|
16
16
|
*/
|
|
17
|
-
import { assertNotFlag } from "../../agent/builder-shared.js";
|
|
18
|
-
import { resolveModel } from "../../agent/model-aliases.js";
|
|
17
|
+
import { assertNotFlag, resolveDispatchModel } from "../../agent/builder-shared.js";
|
|
19
18
|
/**
|
|
20
19
|
* OpenCode builder.
|
|
21
20
|
* Command shape: opencode run [--system-prompt "..."] [--model <m>] "<prompt>"
|
|
@@ -33,7 +32,7 @@ export const opencodeBuilder = {
|
|
|
33
32
|
args.push("--system-prompt", req.systemPrompt);
|
|
34
33
|
}
|
|
35
34
|
if (req.model) {
|
|
36
|
-
const resolved =
|
|
35
|
+
const resolved = resolveDispatchModel(req, profile, "opencode");
|
|
37
36
|
args.push("--model", resolved);
|
|
38
37
|
}
|
|
39
38
|
args.push("--");
|
|
@@ -1,24 +1,9 @@
|
|
|
1
1
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
2
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
3
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
-
/**
|
|
5
|
-
* OpenCode harness (#564).
|
|
6
|
-
*
|
|
7
|
-
* Per-harness barrel that gathers the OpenCode integration surfaces previously
|
|
8
|
-
* scattered across the codebase:
|
|
9
|
-
* - session-log reader → ./session-log.ts (OpenCodeProvider)
|
|
10
|
-
* - agent command builder → ./agent-builder.ts (opencodeBuilder)
|
|
11
|
-
* - config importer → ./config-import.ts (openCodeImporter)
|
|
12
|
-
*
|
|
13
|
-
* It also defines {@link OpencodeHarness}, the {@link AkmHarness} descriptor
|
|
14
|
-
* that `HARNESS_REGISTRY` registers.
|
|
15
|
-
*
|
|
16
|
-
* id normalization: OpenCode's canonical id (`'opencode'`) is also its runtime
|
|
17
|
-
* identity and session-log provider name — there is no historical split (unlike
|
|
18
|
-
* Claude Code's 'claude' vs 'claude-code'), so no alias bridge is needed.
|
|
19
|
-
*/
|
|
20
4
|
import { BaseHarness } from "../types.js";
|
|
21
5
|
import { opencodeBuilder } from "./agent-builder.js";
|
|
6
|
+
import { OpenCodeProvider } from "./session-log.js";
|
|
22
7
|
export { opencodeBuilder } from "./agent-builder.js";
|
|
23
8
|
export { openCodeImporter } from "./config-import.js";
|
|
24
9
|
export { OpenCodeProvider } from "./session-log.js";
|
|
@@ -29,7 +14,6 @@ function caps(c) {
|
|
|
29
14
|
detection: false,
|
|
30
15
|
configImport: false,
|
|
31
16
|
runtimeIdentity: false,
|
|
32
|
-
v1Migration: false,
|
|
33
17
|
...c,
|
|
34
18
|
};
|
|
35
19
|
}
|
|
@@ -45,17 +29,26 @@ export class OpencodeHarness extends BaseHarness {
|
|
|
45
29
|
// Home-relative config dir scanned by `akm setup` (#567). OpenCode has a
|
|
46
30
|
// session-log provider, so offering it as a stash source is functional.
|
|
47
31
|
setupDetectionDir = ".config/opencode";
|
|
48
|
-
// Decorated v1 profile names like "opencode-fast" still belong to OpenCode.
|
|
49
|
-
// `v1ProfilePlatform()` resolves most-specific-id-first, so "opencode-sdk-*"
|
|
50
|
-
// is claimed by OpencodeSdkHarness before this prefix can over-match it.
|
|
51
|
-
v1ProfilePrefixes = ["opencode"];
|
|
52
32
|
agentBuilder = opencodeBuilder;
|
|
33
|
+
// ── Workflow-engine descriptor (plan §"Capability matrix", P2) ────────────
|
|
34
|
+
// This entry is the CLI spawn path (`opencode run …`): akm launches the
|
|
35
|
+
// harness locally per unit ⇒ local-runner. (The SDK path is the separate
|
|
36
|
+
// `opencode-sdk` harness.)
|
|
37
|
+
pattern = "local-runner";
|
|
38
|
+
// The CLI path emits plain text — no JSON stream akm consumes — so the
|
|
39
|
+
// engine uses the prompt-injected schema + embedded-JSON extraction tier
|
|
40
|
+
// (the matrix's "via prompt+validate"). The SDK entry is native-json.
|
|
41
|
+
structuredOutput = "none";
|
|
42
|
+
// `opencode run --session <id>` continues a previous session.
|
|
43
|
+
resume = { flag: "--session", takesSessionId: true };
|
|
44
|
+
// Session-id env marker for run attribution.
|
|
45
|
+
identityEnv = ["OPENCODE_SESSION_ID"];
|
|
46
|
+
sessionLogProvider = () => new OpenCodeProvider();
|
|
53
47
|
capabilities = caps({
|
|
54
48
|
sessionLogs: true,
|
|
55
49
|
agentDispatch: true,
|
|
56
50
|
detection: true,
|
|
57
51
|
configImport: true,
|
|
58
52
|
runtimeIdentity: true,
|
|
59
|
-
v1Migration: true,
|
|
60
53
|
});
|
|
61
54
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
+
/**
|
|
5
|
+
* OpenCode SDK harness DESCRIPTOR (#564).
|
|
6
|
+
*
|
|
7
|
+
* This module is a dependency-graph LEAF: it imports only the harness base
|
|
8
|
+
* types (`../types`) and nothing from `core/config` or the SDK runner. Keeping
|
|
9
|
+
* the descriptor separate from the runtime runner (`./sdk-runner`, which pulls
|
|
10
|
+
* `core/config`) is load-bearing: `HARNESS_REGISTRY` in `../index.ts` imports
|
|
11
|
+
* this class from HERE, not from the per-harness barrel (`./index.ts`). The
|
|
12
|
+
* barrel additionally re-exports `runOpencodeSdk`/`closeServer` from
|
|
13
|
+
* `./sdk-runner`; that re-export makes the barrel transitively depend on
|
|
14
|
+
* `core/config`, and `core/config/config-types` derives `VALID_HARNESS_IDS`
|
|
15
|
+
* back from `../index.ts`. If the registry imported the class through the
|
|
16
|
+
* barrel, that cycle would evaluate `../index.ts` (and `new
|
|
17
|
+
* OpencodeSdkHarness()`) while the barrel — and hence this class binding — was
|
|
18
|
+
* still initializing, throwing a temporal-dead-zone "Cannot access
|
|
19
|
+
* 'OpencodeSdkHarness' before initialization" whenever the barrel is the first
|
|
20
|
+
* module loaded in a fresh graph (e.g. the workflow-exec subprocess entry).
|
|
21
|
+
* Importing the descriptor from this leaf keeps the registry a config-leaf and
|
|
22
|
+
* breaks the cycle.
|
|
23
|
+
*/
|
|
24
|
+
import { BaseHarness } from "../types.js";
|
|
25
|
+
function caps(c) {
|
|
26
|
+
return {
|
|
27
|
+
sessionLogs: false,
|
|
28
|
+
agentDispatch: false,
|
|
29
|
+
detection: false,
|
|
30
|
+
configImport: false,
|
|
31
|
+
runtimeIdentity: false,
|
|
32
|
+
...c,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* OpenCode SDK (embedded-SDK dispatch path).
|
|
37
|
+
*
|
|
38
|
+
* Dispatch-only: no native session logs, but detected at setup.
|
|
39
|
+
*/
|
|
40
|
+
export class OpencodeSdkHarness extends BaseHarness {
|
|
41
|
+
id = "opencode-sdk";
|
|
42
|
+
displayName = "OpenCode SDK";
|
|
43
|
+
aliases = [];
|
|
44
|
+
// ── Workflow-engine descriptor (plan §"Capability matrix", P2) ────────────
|
|
45
|
+
// Embedded-SDK dispatch on this machine ⇒ local-runner (the matrix's
|
|
46
|
+
// "local (sdk/cli)" row, SDK half).
|
|
47
|
+
pattern = "local-runner";
|
|
48
|
+
// `session.prompt` returns structured SDK events/messages; akm extracts the
|
|
49
|
+
// final message then validates against the node schema ⇒ native-json tier.
|
|
50
|
+
structuredOutput = "native-json";
|
|
51
|
+
// No `resume` flag: session reuse is programmatic — the SDK session id is
|
|
52
|
+
// stored opportunistically on the unit row and passed back to
|
|
53
|
+
// `session.prompt`, not replayed via a CLI flag.
|
|
54
|
+
// No `identityEnv`: the SDK runs in-process; it does not mark a child
|
|
55
|
+
// process environment with a session id of its own.
|
|
56
|
+
capabilities = caps({
|
|
57
|
+
agentDispatch: true,
|
|
58
|
+
detection: true,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
@@ -5,10 +5,15 @@
|
|
|
5
5
|
* OpenCode SDK harness (#564).
|
|
6
6
|
*
|
|
7
7
|
* Per-harness barrel for the SDK-mode dispatch path:
|
|
8
|
+
* - descriptor → ./harness.ts ({@link OpencodeSdkHarness}, the
|
|
9
|
+
* {@link AkmHarness} that `HARNESS_REGISTRY` registers)
|
|
8
10
|
* - agent runner → ./sdk-runner.ts (runOpencodeSdk)
|
|
9
11
|
*
|
|
10
|
-
*
|
|
11
|
-
* that
|
|
12
|
+
* The descriptor lives in its own leaf module (`./harness.ts`) rather than
|
|
13
|
+
* here so that the registry can import the class WITHOUT pulling in
|
|
14
|
+
* `./sdk-runner` (and its `core/config` dependency) — see the header of
|
|
15
|
+
* `./harness.ts` for the temporal-dead-zone cycle this avoids. This barrel is
|
|
16
|
+
* the runtime entry point that re-exports both.
|
|
12
17
|
*
|
|
13
18
|
* Unlike the CLI harnesses, the SDK path has no native session logs of its own
|
|
14
19
|
* (`capabilities.sessionLogs = false`): it dispatches via the embedded
|
|
@@ -16,34 +21,5 @@
|
|
|
16
21
|
* session files. It is still detected at setup and migrated from v1 profile
|
|
17
22
|
* names. Canonical id is `'opencode-sdk'` with no alias.
|
|
18
23
|
*/
|
|
19
|
-
|
|
24
|
+
export { OpencodeSdkHarness } from "./harness.js";
|
|
20
25
|
export { closeServer, runOpencodeSdk } from "./sdk-runner.js";
|
|
21
|
-
function caps(c) {
|
|
22
|
-
return {
|
|
23
|
-
sessionLogs: false,
|
|
24
|
-
agentDispatch: false,
|
|
25
|
-
detection: false,
|
|
26
|
-
configImport: false,
|
|
27
|
-
runtimeIdentity: false,
|
|
28
|
-
v1Migration: false,
|
|
29
|
-
...c,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* OpenCode SDK (embedded-SDK dispatch path).
|
|
34
|
-
*
|
|
35
|
-
* Dispatch-only: no native session logs, but detected at setup and migrated
|
|
36
|
-
* from v1 profile names.
|
|
37
|
-
*/
|
|
38
|
-
export class OpencodeSdkHarness extends BaseHarness {
|
|
39
|
-
id = "opencode-sdk";
|
|
40
|
-
displayName = "OpenCode SDK";
|
|
41
|
-
aliases = [];
|
|
42
|
-
// Decorated v1 profile names like "opencode-sdk-fast" belong to the SDK path.
|
|
43
|
-
v1ProfilePrefixes = ["opencode-sdk"];
|
|
44
|
-
capabilities = caps({
|
|
45
|
-
agentDispatch: true,
|
|
46
|
-
detection: true,
|
|
47
|
-
v1Migration: true,
|
|
48
|
-
});
|
|
49
|
-
}
|