akm-cli 0.9.24 → 0.9.25-alpha.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/CHANGELOG.md +294 -0
- package/dist/commands/health/checks.js +10 -11
- package/dist/commands/improve/consolidate/pair-pass.js +3 -2
- package/dist/commands/improve/consolidate.js +3 -2
- package/dist/commands/improve/execution.js +4 -10
- package/dist/commands/improve/extract-prompt.js +4 -4
- package/dist/commands/improve/extract.js +10 -13
- package/dist/commands/improve/improve-cli.js +32 -33
- package/dist/commands/improve/improve-strategies.js +49 -43
- package/dist/commands/improve/improve-usage-report.js +8 -17
- package/dist/commands/improve/preparation.js +3 -1
- package/dist/commands/improve/reflect.js +108 -172
- package/dist/commands/improve/stage.js +69 -18
- package/dist/commands/proposal/drain.js +14 -2
- package/dist/commands/proposal/proposal-cli.js +1 -5
- package/dist/commands/proposal/propose-cli.js +2 -2
- package/dist/commands/proposal/propose.js +80 -83
- package/dist/commands/remember.js +3 -3
- package/dist/commands/sources/schema-repair.js +1 -1
- package/dist/core/config/config-schema.js +37 -60
- package/dist/core/config/engine-semantics.js +15 -11
- package/dist/core/config/schema/engines.js +33 -15
- package/dist/core/config/schema/improve-processes.js +2 -2
- package/dist/core/improve-result.js +3 -3
- package/dist/core/structured.js +10 -0
- package/dist/execution/source.js +14 -0
- package/dist/indexer/passes/memory-inference.js +2 -1
- package/dist/integrations/agent/builder-shared.js +15 -0
- package/dist/integrations/agent/config.js +2 -0
- package/dist/integrations/agent/engine-resolution.js +16 -31
- package/dist/integrations/agent/execution.js +46 -21
- package/dist/integrations/agent/index.js +1 -1
- package/dist/integrations/agent/model-map.js +16 -15
- package/dist/integrations/agent/prompts.js +53 -76
- package/dist/integrations/agent/request-lowering.js +20 -9
- package/dist/integrations/agent/runner-dispatch.js +103 -4
- package/dist/integrations/agent/runner.js +8 -2
- package/dist/integrations/harnesses/aider/agent-builder.js +11 -23
- package/dist/integrations/harnesses/aider/index.js +0 -5
- package/dist/integrations/harnesses/amazonq/agent-builder.js +10 -21
- package/dist/integrations/harnesses/amazonq/index.js +0 -5
- package/dist/integrations/harnesses/claude/agent-builder.js +61 -38
- package/dist/integrations/harnesses/claude/index.js +0 -14
- package/dist/integrations/harnesses/codex/agent-builder.js +4 -4
- package/dist/integrations/harnesses/codex/index.js +0 -4
- package/dist/integrations/harnesses/copilot/agent-builder.js +4 -13
- package/dist/integrations/harnesses/copilot/index.js +2 -7
- package/dist/integrations/harnesses/gemini/agent-builder.js +4 -13
- package/dist/integrations/harnesses/gemini/index.js +0 -5
- package/dist/integrations/harnesses/ids.js +18 -10
- package/dist/integrations/harnesses/opencode/agent-builder.js +52 -10
- package/dist/integrations/harnesses/opencode/index.js +0 -8
- package/dist/integrations/harnesses/opencode/model-config.js +80 -0
- package/dist/integrations/harnesses/opencode/model-work-agent.js +80 -0
- package/dist/integrations/harnesses/opencode-sdk/harness.js +6 -7
- package/dist/integrations/harnesses/opencode-sdk/sdk-runner.js +168 -24
- package/dist/integrations/harnesses/openhands/agent-builder.js +8 -21
- package/dist/integrations/harnesses/openhands/index.js +0 -5
- package/dist/integrations/harnesses/pi/agent-builder.js +8 -21
- package/dist/integrations/harnesses/pi/index.js +0 -5
- package/dist/llm/client.js +5 -0
- package/dist/llm/feature-gate.js +10 -4
- package/dist/llm/index-passes.js +3 -6
- package/dist/llm/memory-infer.js +6 -5
- package/dist/llm/structured-call.js +33 -11
- package/dist/scripts/akm-migrate-node.js +298 -204
- package/dist/scripts/akm-migrate.js +298 -204
- package/dist/workflows/exec/step-work.js +6 -5
- package/dist/workflows/freeze/step-values.js +1 -1
- package/docs/reference/cli.md +29 -11
- package/docs/reference/configuration.md +168 -11
- package/docs/reference/workflow-schema.md +13 -9
- package/package.json +1 -1
- package/schemas/akm-config.json +36 -0
|
@@ -27564,16 +27564,16 @@ var BUILTIN_IMPROVE_STRATEGY_NAMES = [
|
|
|
27564
27564
|
"reflect-distill",
|
|
27565
27565
|
"proactive-maintenance"
|
|
27566
27566
|
];
|
|
27567
|
-
var
|
|
27568
|
-
reflect
|
|
27569
|
-
distill
|
|
27570
|
-
consolidate
|
|
27571
|
-
memoryInference
|
|
27572
|
-
extract
|
|
27573
|
-
validation
|
|
27574
|
-
triage
|
|
27575
|
-
|
|
27576
|
-
|
|
27567
|
+
var IMPROVE_ENGINE_PROCESSES = [
|
|
27568
|
+
"reflect",
|
|
27569
|
+
"distill",
|
|
27570
|
+
"consolidate",
|
|
27571
|
+
"memoryInference",
|
|
27572
|
+
"extract",
|
|
27573
|
+
"validation",
|
|
27574
|
+
"triage"
|
|
27575
|
+
];
|
|
27576
|
+
var IMPROVE_PROCESS_NAMES = [...IMPROVE_ENGINE_PROCESSES, "proactiveMaintenance"];
|
|
27577
27577
|
|
|
27578
27578
|
// src/core/improve-result.ts
|
|
27579
27579
|
var COMMON_FIELDS = [
|
|
@@ -34781,6 +34781,27 @@ var coerce = {
|
|
|
34781
34781
|
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
|
34782
34782
|
};
|
|
34783
34783
|
var NEVER = INVALID;
|
|
34784
|
+
// src/integrations/harnesses/ids.ts
|
|
34785
|
+
var OPENCODE_INFERENCE = ["temperature", "maxTokens", "contextLength", "enableThinking", "reasoningEffort"];
|
|
34786
|
+
var HARNESS_ID_TABLE = [
|
|
34787
|
+
{ id: "opencode", agentDispatch: true, enforcesModelWorkTools: true, inference: OPENCODE_INFERENCE },
|
|
34788
|
+
{ id: "claude", agentDispatch: true, enforcesModelWorkTools: true, inference: ["reasoningEffort"] },
|
|
34789
|
+
{ id: "opencode-sdk", agentDispatch: true, enforcesModelWorkTools: true, inference: OPENCODE_INFERENCE },
|
|
34790
|
+
{ id: "codex", agentDispatch: true, enforcesModelWorkTools: false, inference: [] },
|
|
34791
|
+
{ id: "copilot", agentDispatch: true, enforcesModelWorkTools: false, inference: [] },
|
|
34792
|
+
{ id: "pi", agentDispatch: true, enforcesModelWorkTools: false, inference: [] },
|
|
34793
|
+
{ id: "gemini", agentDispatch: true, enforcesModelWorkTools: false, inference: [] },
|
|
34794
|
+
{ id: "aider", agentDispatch: true, enforcesModelWorkTools: false, inference: [] },
|
|
34795
|
+
{ id: "amazonq", agentDispatch: true, enforcesModelWorkTools: false, inference: [] },
|
|
34796
|
+
{ id: "openhands", agentDispatch: true, enforcesModelWorkTools: false, inference: [] }
|
|
34797
|
+
];
|
|
34798
|
+
var VALID_HARNESS_IDS = Object.freeze(HARNESS_ID_TABLE.map((h) => h.id));
|
|
34799
|
+
var HARNESS_AGENT_DISPATCH_IDS = new Set(HARNESS_ID_TABLE.filter((h) => h.agentDispatch).map((h) => h.id));
|
|
34800
|
+
var HARNESS_MODEL_WORK_IDS = new Set(HARNESS_ID_TABLE.filter((h) => h.enforcesModelWorkTools).map((h) => h.id));
|
|
34801
|
+
function harnessInferenceKeys(platform) {
|
|
34802
|
+
return HARNESS_ID_TABLE.find((h) => h.id === platform)?.inference ?? [];
|
|
34803
|
+
}
|
|
34804
|
+
|
|
34784
34805
|
// src/core/extra-params.ts
|
|
34785
34806
|
var EXTRA_PARAMS_PROTECTED_TOP_LEVEL_KEYS = [
|
|
34786
34807
|
"model",
|
|
@@ -35010,22 +35031,6 @@ var EmbeddingConnectionConfigSchema = exports_external.object({
|
|
|
35010
35031
|
concurrency: positiveInt.max(16).optional()
|
|
35011
35032
|
}).passthrough();
|
|
35012
35033
|
|
|
35013
|
-
// src/integrations/harnesses/ids.ts
|
|
35014
|
-
var HARNESS_ID_TABLE = [
|
|
35015
|
-
{ id: "opencode", agentDispatch: true },
|
|
35016
|
-
{ id: "claude", agentDispatch: true },
|
|
35017
|
-
{ id: "opencode-sdk", agentDispatch: true },
|
|
35018
|
-
{ id: "codex", agentDispatch: true },
|
|
35019
|
-
{ id: "copilot", agentDispatch: true },
|
|
35020
|
-
{ id: "pi", agentDispatch: true },
|
|
35021
|
-
{ id: "gemini", agentDispatch: true },
|
|
35022
|
-
{ id: "aider", agentDispatch: true },
|
|
35023
|
-
{ id: "amazonq", agentDispatch: true },
|
|
35024
|
-
{ id: "openhands", agentDispatch: true }
|
|
35025
|
-
];
|
|
35026
|
-
var VALID_HARNESS_IDS = Object.freeze(HARNESS_ID_TABLE.map((h) => h.id));
|
|
35027
|
-
var HARNESS_AGENT_DISPATCH_IDS = new Set(HARNESS_ID_TABLE.filter((h) => h.agentDispatch).map((h) => h.id));
|
|
35028
|
-
|
|
35029
35034
|
// src/execution/limits.ts
|
|
35030
35035
|
var EXECUTION_MAX_TIMEOUT_MS = 2 ** 31 - 1;
|
|
35031
35036
|
|
|
@@ -35100,6 +35105,13 @@ var LlmEngineSchema = exports_external.object({
|
|
|
35100
35105
|
});
|
|
35101
35106
|
}
|
|
35102
35107
|
});
|
|
35108
|
+
var AGENT_INFERENCE_KEYS = [
|
|
35109
|
+
"temperature",
|
|
35110
|
+
"maxTokens",
|
|
35111
|
+
"contextLength",
|
|
35112
|
+
"enableThinking",
|
|
35113
|
+
"reasoningEffort"
|
|
35114
|
+
];
|
|
35103
35115
|
var AgentEngineSchema = exports_external.object({
|
|
35104
35116
|
kind: exports_external.literal("agent"),
|
|
35105
35117
|
platform: AgentPlatformSchema.refine((platform) => HARNESS_AGENT_DISPATCH_IDS.has(platform), {
|
|
@@ -35110,25 +35122,27 @@ var AgentEngineSchema = exports_external.object({
|
|
|
35110
35122
|
workspace: nonEmptyString.optional(),
|
|
35111
35123
|
model: nonEmptyString.optional(),
|
|
35112
35124
|
timeoutMs: timeoutMsField,
|
|
35113
|
-
llmEngine: engineName.optional()
|
|
35125
|
+
llmEngine: engineName.optional(),
|
|
35126
|
+
temperature: exports_external.number().finite().optional(),
|
|
35127
|
+
maxTokens: positiveInt.optional(),
|
|
35128
|
+
contextLength: positiveInt.optional(),
|
|
35129
|
+
enableThinking: exports_external.boolean().optional(),
|
|
35130
|
+
reasoningEffort: nonEmptyString.optional()
|
|
35114
35131
|
}).passthrough().superRefine((value, ctx) => {
|
|
35115
|
-
for (const key of [
|
|
35116
|
-
"provider",
|
|
35117
|
-
"endpoint",
|
|
35118
|
-
"apiKey",
|
|
35119
|
-
"apiKeyFile",
|
|
35120
|
-
"temperature",
|
|
35121
|
-
"maxTokens",
|
|
35122
|
-
"concurrency",
|
|
35123
|
-
"extraParams",
|
|
35124
|
-
"contextLength",
|
|
35125
|
-
"enableThinking",
|
|
35126
|
-
"reasoningEffort",
|
|
35127
|
-
"modelAliases"
|
|
35128
|
-
]) {
|
|
35132
|
+
for (const key of ["provider", "endpoint", "apiKey", "apiKeyFile", "concurrency", "extraParams", "modelAliases"]) {
|
|
35129
35133
|
if (key in value)
|
|
35130
35134
|
ctx.addIssue({ code: exports_external.ZodIssueCode.custom, path: [key], message: `${key} is not valid on an agent engine` });
|
|
35131
35135
|
}
|
|
35136
|
+
const translated = harnessInferenceKeys(value.platform);
|
|
35137
|
+
for (const key of AGENT_INFERENCE_KEYS) {
|
|
35138
|
+
if (key in value && !translated.includes(key)) {
|
|
35139
|
+
ctx.addIssue({
|
|
35140
|
+
code: exports_external.ZodIssueCode.custom,
|
|
35141
|
+
path: [key],
|
|
35142
|
+
message: `${key} is not valid on a ${value.platform} engine: ${translated.length > 0 ? `the platform translates only ${translated.join(", ")}` : "the platform translates no inference fields"}`
|
|
35143
|
+
});
|
|
35144
|
+
}
|
|
35145
|
+
}
|
|
35132
35146
|
if (value.platform !== "opencode-sdk" && value.llmEngine !== undefined) {
|
|
35133
35147
|
ctx.addIssue({
|
|
35134
35148
|
code: exports_external.ZodIssueCode.custom,
|
|
@@ -35301,7 +35315,7 @@ var ImproveProfileProcessesSchema = exports_external.object({
|
|
|
35301
35315
|
});
|
|
35302
35316
|
}
|
|
35303
35317
|
for (const [name, process2] of Object.entries(val)) {
|
|
35304
|
-
if (!(name
|
|
35318
|
+
if (!IMPROVE_PROCESS_NAMES.includes(name) && !RETIRED_PROCESS_NAMES.has(name) && process2 !== null && typeof process2 === "object" && process2.enabled === true) {
|
|
35305
35319
|
ctx.addIssue({
|
|
35306
35320
|
code: exports_external.ZodIssueCode.custom,
|
|
35307
35321
|
path: [name],
|
|
@@ -35727,13 +35741,27 @@ var AkmConfigSchema = AkmConfigBaseSchema.superRefine((config, ctx) => {
|
|
|
35727
35741
|
message: "engine does not name a configured engine"
|
|
35728
35742
|
});
|
|
35729
35743
|
}
|
|
35730
|
-
const
|
|
35731
|
-
|
|
35732
|
-
|
|
35733
|
-
|
|
35734
|
-
|
|
35735
|
-
|
|
35736
|
-
|
|
35744
|
+
const confining = [...HARNESS_MODEL_WORK_IDS];
|
|
35745
|
+
const confiningPlatforms = `${confining.slice(0, -1).join(", ")} or ${confining.at(-1)}`;
|
|
35746
|
+
const modelWorkEngine = (name, path12) => {
|
|
35747
|
+
if (!name)
|
|
35748
|
+
return;
|
|
35749
|
+
const engine = config.engines?.[name];
|
|
35750
|
+
if (!engine) {
|
|
35751
|
+
ctx.addIssue({ code: exports_external.ZodIssueCode.custom, path: path12, message: "engine does not name a configured engine" });
|
|
35752
|
+
} else if (engine.kind !== "llm" && !HARNESS_MODEL_WORK_IDS.has(engine.platform)) {
|
|
35753
|
+
ctx.addIssue({
|
|
35754
|
+
code: exports_external.ZodIssueCode.custom,
|
|
35755
|
+
path: path12,
|
|
35756
|
+
message: `engine "${name}" (platform ${engine.platform}) cannot confine the model-work tool policy, which unattended model work requires. Use an LLM engine, or an agent engine on ${confiningPlatforms}.`
|
|
35757
|
+
});
|
|
35758
|
+
}
|
|
35759
|
+
};
|
|
35760
|
+
modelWorkEngine(config.defaults?.llmEngine, ["defaults", "llmEngine"]);
|
|
35761
|
+
for (const [passName, pass] of Object.entries(config.index ?? {})) {
|
|
35762
|
+
const engine = pass?.engine;
|
|
35763
|
+
if (typeof engine === "string")
|
|
35764
|
+
modelWorkEngine(engine, ["index", passName, "engine"]);
|
|
35737
35765
|
}
|
|
35738
35766
|
const workflowJudge = config.workflow?.judgeEngine;
|
|
35739
35767
|
if (workflowJudge && !config.engines?.[workflowJudge]) {
|
|
@@ -35752,64 +35780,24 @@ var AkmConfigSchema = AkmConfigBaseSchema.superRefine((config, ctx) => {
|
|
|
35752
35780
|
});
|
|
35753
35781
|
}
|
|
35754
35782
|
for (const [strategyName, strategy] of Object.entries(config.improve?.strategies ?? {})) {
|
|
35755
|
-
const
|
|
35756
|
-
|
|
35757
|
-
const engine = config.engines?.[strategyEngine];
|
|
35758
|
-
if (!engine || engine.kind !== "llm") {
|
|
35759
|
-
ctx.addIssue({
|
|
35760
|
-
code: exports_external.ZodIssueCode.custom,
|
|
35761
|
-
path: ["improve", "strategies", strategyName, "engine"],
|
|
35762
|
-
message: engine ? "strategy engine must be an LLM engine" : "engine does not name a configured engine"
|
|
35763
|
-
});
|
|
35764
|
-
}
|
|
35765
|
-
}
|
|
35783
|
+
const strategyPath = ["improve", "strategies", strategyName];
|
|
35784
|
+
modelWorkEngine(strategy.engine, [...strategyPath, "engine"]);
|
|
35766
35785
|
for (const [processName, process2] of Object.entries(strategy.processes ?? {})) {
|
|
35767
35786
|
const processConfig = process2;
|
|
35768
|
-
const
|
|
35769
|
-
if (processConfig.engine &&
|
|
35787
|
+
const processPath = [...strategyPath, "processes", processName];
|
|
35788
|
+
if (processConfig.engine && !IMPROVE_ENGINE_PROCESSES.includes(processName)) {
|
|
35770
35789
|
ctx.addIssue({
|
|
35771
35790
|
code: exports_external.ZodIssueCode.custom,
|
|
35772
|
-
path: [
|
|
35791
|
+
path: [...processPath, "engine"],
|
|
35773
35792
|
message: `${processName} does not dispatch an engine`
|
|
35774
35793
|
});
|
|
35775
35794
|
} else {
|
|
35776
|
-
|
|
35777
|
-
if (processEngine && capability === "llm") {
|
|
35778
|
-
const engine = config.engines?.[processEngine];
|
|
35779
|
-
if (!engine || engine.kind !== "llm") {
|
|
35780
|
-
ctx.addIssue({
|
|
35781
|
-
code: exports_external.ZodIssueCode.custom,
|
|
35782
|
-
path: ["improve", "strategies", strategyName, "processes", processName, "engine"],
|
|
35783
|
-
message: engine ? `${processName} requires an LLM engine` : "engine does not name a configured engine"
|
|
35784
|
-
});
|
|
35785
|
-
}
|
|
35786
|
-
} else if (processConfig.engine && capability === "runner" && !config.engines?.[processConfig.engine]) {
|
|
35787
|
-
ctx.addIssue({
|
|
35788
|
-
code: exports_external.ZodIssueCode.custom,
|
|
35789
|
-
path: ["improve", "strategies", strategyName, "processes", processName, "engine"],
|
|
35790
|
-
message: "engine does not name a configured engine"
|
|
35791
|
-
});
|
|
35792
|
-
}
|
|
35795
|
+
modelWorkEngine(processConfig.engine, [...processPath, "engine"]);
|
|
35793
35796
|
}
|
|
35794
|
-
|
|
35795
|
-
|
|
35796
|
-
const engine = config.engines?.[judgmentEngine];
|
|
35797
|
-
if (!engine) {
|
|
35798
|
-
ctx.addIssue({
|
|
35799
|
-
code: exports_external.ZodIssueCode.custom,
|
|
35800
|
-
path: ["improve", "strategies", strategyName, "processes", processName, "judgment", "engine"],
|
|
35801
|
-
message: "engine does not name a configured engine"
|
|
35802
|
-
});
|
|
35803
|
-
}
|
|
35804
|
-
}
|
|
35805
|
-
const gateEngine = processConfig.qualityGate?.engine;
|
|
35806
|
-
if (gateEngine && config.engines?.[gateEngine]?.kind !== "llm") {
|
|
35807
|
-
ctx.addIssue({
|
|
35808
|
-
code: exports_external.ZodIssueCode.custom,
|
|
35809
|
-
path: ["improve", "strategies", strategyName, "processes", processName, "qualityGate", "engine"],
|
|
35810
|
-
message: config.engines?.[gateEngine] ? "a quality-gate judge must be an LLM engine" : "engine does not name a configured engine"
|
|
35811
|
-
});
|
|
35797
|
+
if (processConfig.judgment?.enabled === true) {
|
|
35798
|
+
modelWorkEngine(processConfig.judgment.engine, [...processPath, "judgment", "engine"]);
|
|
35812
35799
|
}
|
|
35800
|
+
modelWorkEngine(processConfig.qualityGate?.engine, [...processPath, "qualityGate", "engine"]);
|
|
35813
35801
|
}
|
|
35814
35802
|
}
|
|
35815
35803
|
if (config.defaultWriteTarget !== undefined) {
|
|
@@ -39014,6 +39002,10 @@ import { createHash as createHash3 } from "crypto";
|
|
|
39014
39002
|
|
|
39015
39003
|
// src/execution/source.ts
|
|
39016
39004
|
var EXECUTION_SOURCE_SCHEMA_VERSION = 1;
|
|
39005
|
+
var MODEL_WORK_TOOLS = Object.freeze(["read", "edit", "akm search", "akm show"]);
|
|
39006
|
+
function isModelWorkTools(tools) {
|
|
39007
|
+
return Array.isArray(tools) && tools.length === MODEL_WORK_TOOLS.length && tools.every((tool, index) => tool === MODEL_WORK_TOOLS[index]);
|
|
39008
|
+
}
|
|
39017
39009
|
function requireRecord(value, path18) {
|
|
39018
39010
|
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
39019
39011
|
throw new TypeError(`${path18} must be an object`);
|
|
@@ -50941,6 +50933,17 @@ class BaseHarness {
|
|
|
50941
50933
|
function resolveDispatchModel(request, _profile, _platform) {
|
|
50942
50934
|
return request.model;
|
|
50943
50935
|
}
|
|
50936
|
+
function modelFromArgs(args) {
|
|
50937
|
+
let model;
|
|
50938
|
+
for (let index = 0;index < args.length; index += 1) {
|
|
50939
|
+
const arg = args[index];
|
|
50940
|
+
if (arg === "--model")
|
|
50941
|
+
model = args[index + 1];
|
|
50942
|
+
else if (arg?.startsWith("--model="))
|
|
50943
|
+
model = arg.slice("--model=".length);
|
|
50944
|
+
}
|
|
50945
|
+
return model;
|
|
50946
|
+
}
|
|
50944
50947
|
function normalizeTools(tools) {
|
|
50945
50948
|
if (typeof tools === "string")
|
|
50946
50949
|
return tools;
|
|
@@ -50949,6 +50952,14 @@ function normalizeTools(tools) {
|
|
|
50949
50952
|
return JSON.stringify(tools);
|
|
50950
50953
|
}
|
|
50951
50954
|
|
|
50955
|
+
// src/core/structured.ts
|
|
50956
|
+
function withSchemaInstruction(prompt, schema) {
|
|
50957
|
+
return `${prompt}
|
|
50958
|
+
|
|
50959
|
+
Respond with ONLY a JSON value matching this JSON Schema (no prose, no code fences):
|
|
50960
|
+
${JSON.stringify(schema)}`;
|
|
50961
|
+
}
|
|
50962
|
+
|
|
50952
50963
|
// src/integrations/agent/conversation-fallback.ts
|
|
50953
50964
|
var CONVERSATION_FALLBACK_BEGIN = "<AKM_CONVERSATION_JSON>";
|
|
50954
50965
|
var CONVERSATION_FALLBACK_END = "</AKM_CONVERSATION_JSON>";
|
|
@@ -51029,8 +51040,8 @@ function extensionFields(request) {
|
|
|
51029
51040
|
];
|
|
51030
51041
|
}
|
|
51031
51042
|
function createAgentRequestLowerer(options) {
|
|
51032
|
-
|
|
51033
|
-
|
|
51043
|
+
return (profile, request) => {
|
|
51044
|
+
const supportedInference = new Set(typeof options.inference === "function" ? options.inference(profile, request) : options.inference ?? []);
|
|
51034
51045
|
const notices = [];
|
|
51035
51046
|
const skip = (field) => {
|
|
51036
51047
|
notices.push(untranslated(options.adapter, field));
|
|
@@ -51061,6 +51072,10 @@ function createAgentRequestLowerer(options) {
|
|
|
51061
51072
|
}
|
|
51062
51073
|
dispatch.agent = request.agent;
|
|
51063
51074
|
}
|
|
51075
|
+
if (request.outputSchema) {
|
|
51076
|
+
prompt = withSchemaInstruction(prompt, request.outputSchema);
|
|
51077
|
+
dispatch.schema = request.outputSchema;
|
|
51078
|
+
}
|
|
51064
51079
|
dispatch.prompt = prompt;
|
|
51065
51080
|
if (request.model)
|
|
51066
51081
|
dispatch.model = request.model.resolved;
|
|
@@ -51070,15 +51085,16 @@ function createAgentRequestLowerer(options) {
|
|
|
51070
51085
|
if (!supportedInference.has(key))
|
|
51071
51086
|
skip(`inference.${key}`);
|
|
51072
51087
|
}
|
|
51073
|
-
if (typeof request.inference?.effort === "string")
|
|
51074
|
-
dispatch.effort = request.inference.effort;
|
|
51075
51088
|
}
|
|
51076
|
-
if (request.
|
|
51077
|
-
if (!options.
|
|
51078
|
-
|
|
51079
|
-
|
|
51080
|
-
|
|
51081
|
-
|
|
51089
|
+
if (isModelWorkTools(request.tools)) {
|
|
51090
|
+
if (!options.modelWorkTools) {
|
|
51091
|
+
throw new ConfigError(`The ${options.adapter} transport cannot enforce the model-work tool policy.`, "INVALID_CONFIG_FILE");
|
|
51092
|
+
}
|
|
51093
|
+
if (dispatch.agent) {
|
|
51094
|
+
throw new ConfigError(`The ${options.adapter} transport cannot run native agent ${JSON.stringify(dispatch.agent)} under the model-work tool policy.`, "INVALID_CONFIG_FILE");
|
|
51095
|
+
}
|
|
51096
|
+
dispatch.tools = request.tools;
|
|
51097
|
+
} else if (request.tools !== undefined) {
|
|
51082
51098
|
if (hasToolSelection(request.tools) && !translatesTools(options.tools, request.tools)) {
|
|
51083
51099
|
throw new ConfigError(`The ${options.adapter} transport cannot enforce the resolved tool policy.`, "INVALID_CONFIG_FILE");
|
|
51084
51100
|
}
|
|
@@ -51100,10 +51116,6 @@ function buildMessagePayload(req) {
|
|
|
51100
51116
|
if (req.systemPrompt)
|
|
51101
51117
|
sections.push(req.systemPrompt);
|
|
51102
51118
|
sections.push(req.prompt);
|
|
51103
|
-
if (req.schema) {
|
|
51104
|
-
sections.push(`Respond with ONLY a JSON value matching this JSON Schema (no prose, no code fences):
|
|
51105
|
-
${JSON.stringify(req.schema)}`);
|
|
51106
|
-
}
|
|
51107
51119
|
return sections.join(`
|
|
51108
51120
|
|
|
51109
51121
|
`);
|
|
@@ -51114,8 +51126,7 @@ var aiderBuilder = {
|
|
|
51114
51126
|
lower: createAgentRequestLowerer({
|
|
51115
51127
|
adapter: AIDER_PLATFORM,
|
|
51116
51128
|
personaChannel: "prompt",
|
|
51117
|
-
tools: "none"
|
|
51118
|
-
outputSchema: true
|
|
51129
|
+
tools: "none"
|
|
51119
51130
|
}),
|
|
51120
51131
|
build(profile, req) {
|
|
51121
51132
|
const args = [...profile.args];
|
|
@@ -51165,8 +51176,6 @@ class AiderHarness extends BaseHarness {
|
|
|
51165
51176
|
displayName = "Aider";
|
|
51166
51177
|
agentBuilder = aiderBuilder;
|
|
51167
51178
|
resultExtractor = aiderResultExtractor;
|
|
51168
|
-
pattern = "local-runner";
|
|
51169
|
-
structuredOutput = "none";
|
|
51170
51179
|
capabilities = caps({
|
|
51171
51180
|
agentDispatch: true,
|
|
51172
51181
|
detection: true
|
|
@@ -51189,10 +51198,6 @@ function buildPromptPayload(req) {
|
|
|
51189
51198
|
if (req.systemPrompt)
|
|
51190
51199
|
sections.push(req.systemPrompt);
|
|
51191
51200
|
sections.push(req.prompt);
|
|
51192
|
-
if (req.schema) {
|
|
51193
|
-
sections.push(`Respond with ONLY a JSON value matching this JSON Schema (no prose, no code fences):
|
|
51194
|
-
${JSON.stringify(req.schema)}`);
|
|
51195
|
-
}
|
|
51196
51201
|
return sections.join(`
|
|
51197
51202
|
|
|
51198
51203
|
`);
|
|
@@ -51203,8 +51208,7 @@ var amazonqBuilder = {
|
|
|
51203
51208
|
lower: createAgentRequestLowerer({
|
|
51204
51209
|
adapter: AMAZONQ_PLATFORM,
|
|
51205
51210
|
personaChannel: "prompt",
|
|
51206
|
-
tools: "flat"
|
|
51207
|
-
outputSchema: true
|
|
51211
|
+
tools: "flat"
|
|
51208
51212
|
}),
|
|
51209
51213
|
build(profile, req) {
|
|
51210
51214
|
const extra = profile.args[0] === "chat" ? profile.args.slice(1) : [...profile.args];
|
|
@@ -51261,8 +51265,6 @@ class AmazonqHarness extends BaseHarness {
|
|
|
51261
51265
|
displayName = "Amazon Q Developer CLI";
|
|
51262
51266
|
agentBuilder = amazonqBuilder;
|
|
51263
51267
|
resultExtractor = amazonqResultExtractor;
|
|
51264
|
-
pattern = "local-runner";
|
|
51265
|
-
structuredOutput = "none";
|
|
51266
51268
|
capabilities = caps({
|
|
51267
51269
|
agentDispatch: true,
|
|
51268
51270
|
detection: true
|
|
@@ -51270,14 +51272,16 @@ class AmazonqHarness extends BaseHarness {
|
|
|
51270
51272
|
}
|
|
51271
51273
|
|
|
51272
51274
|
// src/integrations/harnesses/claude/agent-builder.ts
|
|
51273
|
-
|
|
51274
|
-
|
|
51275
|
-
|
|
51276
|
-
|
|
51277
|
-
|
|
51278
|
-
|
|
51279
|
-
|
|
51280
|
-
|
|
51275
|
+
var MODEL_WORK_CLAUDE_FLAGS = Object.freeze([
|
|
51276
|
+
"--restricted",
|
|
51277
|
+
"--strict-mcp-config",
|
|
51278
|
+
"--tools",
|
|
51279
|
+
"Read,Edit,Bash",
|
|
51280
|
+
"--allowedTools",
|
|
51281
|
+
"Read,Edit,Bash(akm search *),Bash(akm show *)",
|
|
51282
|
+
"--permission-mode",
|
|
51283
|
+
"dontAsk"
|
|
51284
|
+
]);
|
|
51281
51285
|
var claudeBuilder = {
|
|
51282
51286
|
platform: "claude",
|
|
51283
51287
|
personaChannel: "native",
|
|
@@ -51286,10 +51290,12 @@ var claudeBuilder = {
|
|
|
51286
51290
|
personaChannel: "native",
|
|
51287
51291
|
nativeAgentSelector: true,
|
|
51288
51292
|
tools: "all",
|
|
51289
|
-
|
|
51293
|
+
modelWorkTools: true,
|
|
51294
|
+
inference: ["reasoningEffort"]
|
|
51290
51295
|
}),
|
|
51291
51296
|
build(profile, req) {
|
|
51292
|
-
const
|
|
51297
|
+
const modelWork = isModelWorkTools(req.tools);
|
|
51298
|
+
const args = modelWork ? [...MODEL_WORK_CLAUDE_FLAGS] : [...profile.args];
|
|
51293
51299
|
if (req.agent) {
|
|
51294
51300
|
args.push("--agent", req.agent);
|
|
51295
51301
|
}
|
|
@@ -51299,8 +51305,15 @@ var claudeBuilder = {
|
|
|
51299
51305
|
if (req.model) {
|
|
51300
51306
|
const resolved = resolveDispatchModel(req, profile, "claude");
|
|
51301
51307
|
args.push("--model", resolved);
|
|
51302
|
-
}
|
|
51303
|
-
|
|
51308
|
+
} else if (modelWork) {
|
|
51309
|
+
const model = modelFromArgs(profile.args);
|
|
51310
|
+
if (model)
|
|
51311
|
+
args.push("--model", model);
|
|
51312
|
+
}
|
|
51313
|
+
const effort = req.inference?.reasoningEffort;
|
|
51314
|
+
if (typeof effort === "string" && effort.length > 0)
|
|
51315
|
+
args.push("--effort", effort);
|
|
51316
|
+
if (req.tools && !modelWork) {
|
|
51304
51317
|
args.push("--allowedTools", normalizeTools(req.tools));
|
|
51305
51318
|
}
|
|
51306
51319
|
if (req.schema) {
|
|
@@ -51308,7 +51321,7 @@ var claudeBuilder = {
|
|
|
51308
51321
|
}
|
|
51309
51322
|
args.push("--print");
|
|
51310
51323
|
args.push("--");
|
|
51311
|
-
args.push(
|
|
51324
|
+
args.push(req.prompt);
|
|
51312
51325
|
return { argv: [profile.bin, ...args] };
|
|
51313
51326
|
}
|
|
51314
51327
|
};
|
|
@@ -51643,8 +51656,6 @@ class ClaudeHarness extends BaseHarness {
|
|
|
51643
51656
|
setupDetectionDir = ".claude";
|
|
51644
51657
|
agentBuilder = claudeBuilder;
|
|
51645
51658
|
resultExtractor = claudeResultExtractor;
|
|
51646
|
-
pattern = "in-harness";
|
|
51647
|
-
structuredOutput = "native-json";
|
|
51648
51659
|
identityEnv = ["CLAUDE_SESSION_ID"];
|
|
51649
51660
|
sessionLogProvider = () => new ClaudeCodeProvider;
|
|
51650
51661
|
capabilities = caps({
|
|
@@ -51679,8 +51690,7 @@ var codexBuilder = {
|
|
|
51679
51690
|
lower: createAgentRequestLowerer({
|
|
51680
51691
|
adapter: "codex",
|
|
51681
51692
|
personaChannel: "prompt",
|
|
51682
|
-
tools: "none"
|
|
51683
|
-
outputSchema: true
|
|
51693
|
+
tools: "none"
|
|
51684
51694
|
}),
|
|
51685
51695
|
build(profile, req) {
|
|
51686
51696
|
const extra = profile.args[0] === "exec" ? profile.args.slice(1) : [...profile.args];
|
|
@@ -51767,8 +51777,6 @@ class CodexHarness extends BaseHarness {
|
|
|
51767
51777
|
displayName = "OpenAI Codex CLI";
|
|
51768
51778
|
agentBuilder = codexBuilder;
|
|
51769
51779
|
resultExtractor = codexResultExtractor;
|
|
51770
|
-
pattern = "local-runner";
|
|
51771
|
-
structuredOutput = "native-schema";
|
|
51772
51780
|
presenceEnv = ["CODEX_SANDBOX"];
|
|
51773
51781
|
capabilities = caps({
|
|
51774
51782
|
agentDispatch: true,
|
|
@@ -51787,15 +51795,11 @@ function toolPolicyEntries2(tools) {
|
|
|
51787
51795
|
}
|
|
51788
51796
|
return;
|
|
51789
51797
|
}
|
|
51790
|
-
function
|
|
51798
|
+
function buildPromptPayload2(req) {
|
|
51791
51799
|
const sections = [];
|
|
51792
51800
|
if (req.systemPrompt)
|
|
51793
51801
|
sections.push(req.systemPrompt);
|
|
51794
51802
|
sections.push(req.prompt);
|
|
51795
|
-
if (req.schema) {
|
|
51796
|
-
sections.push(`Respond with ONLY a JSON value matching this JSON Schema (no prose, no code fences):
|
|
51797
|
-
${JSON.stringify(req.schema)}`);
|
|
51798
|
-
}
|
|
51799
51803
|
return sections.join(`
|
|
51800
51804
|
|
|
51801
51805
|
`);
|
|
@@ -51806,8 +51810,7 @@ var copilotBuilder = {
|
|
|
51806
51810
|
lower: createAgentRequestLowerer({
|
|
51807
51811
|
adapter: COPILOT_PLATFORM,
|
|
51808
51812
|
personaChannel: "prompt",
|
|
51809
|
-
tools: "flat"
|
|
51810
|
-
outputSchema: true
|
|
51813
|
+
tools: "flat"
|
|
51811
51814
|
}),
|
|
51812
51815
|
build(profile, req) {
|
|
51813
51816
|
const args = [...profile.args];
|
|
@@ -51826,7 +51829,7 @@ var copilotBuilder = {
|
|
|
51826
51829
|
if (req.schema) {
|
|
51827
51830
|
args.push("--output-format", "json");
|
|
51828
51831
|
}
|
|
51829
|
-
args.push("-p",
|
|
51832
|
+
args.push("-p", buildPromptPayload2(req));
|
|
51830
51833
|
return { argv: [profile.bin, ...args] };
|
|
51831
51834
|
}
|
|
51832
51835
|
};
|
|
@@ -51924,8 +51927,6 @@ class CopilotHarness extends BaseHarness {
|
|
|
51924
51927
|
displayName = "GitHub Copilot CLI";
|
|
51925
51928
|
agentBuilder = copilotBuilder;
|
|
51926
51929
|
resultExtractor = copilotResultExtractor;
|
|
51927
|
-
pattern = "local-runner";
|
|
51928
|
-
structuredOutput = "native-json";
|
|
51929
51930
|
identityEnv = ["COPILOT_SESSION_ID"];
|
|
51930
51931
|
capabilities = caps({
|
|
51931
51932
|
agentDispatch: true,
|
|
@@ -51944,15 +51945,11 @@ function toolPolicyEntries3(tools) {
|
|
|
51944
51945
|
}
|
|
51945
51946
|
return;
|
|
51946
51947
|
}
|
|
51947
|
-
function
|
|
51948
|
+
function buildPromptPayload3(req) {
|
|
51948
51949
|
const sections = [];
|
|
51949
51950
|
if (req.systemPrompt)
|
|
51950
51951
|
sections.push(req.systemPrompt);
|
|
51951
51952
|
sections.push(req.prompt);
|
|
51952
|
-
if (req.schema) {
|
|
51953
|
-
sections.push(`Respond with ONLY a JSON value matching this JSON Schema (no prose, no code fences):
|
|
51954
|
-
${JSON.stringify(req.schema)}`);
|
|
51955
|
-
}
|
|
51956
51953
|
return sections.join(`
|
|
51957
51954
|
|
|
51958
51955
|
`);
|
|
@@ -51963,8 +51960,7 @@ var geminiBuilder = {
|
|
|
51963
51960
|
lower: createAgentRequestLowerer({
|
|
51964
51961
|
adapter: GEMINI_PLATFORM,
|
|
51965
51962
|
personaChannel: "prompt",
|
|
51966
|
-
tools: "flat"
|
|
51967
|
-
outputSchema: true
|
|
51963
|
+
tools: "flat"
|
|
51968
51964
|
}),
|
|
51969
51965
|
build(profile, req) {
|
|
51970
51966
|
const args = [...profile.args];
|
|
@@ -51980,7 +51976,7 @@ var geminiBuilder = {
|
|
|
51980
51976
|
if (req.schema) {
|
|
51981
51977
|
args.push("--output-format", "json");
|
|
51982
51978
|
}
|
|
51983
|
-
args.push("-p",
|
|
51979
|
+
args.push("-p", buildPromptPayload3(req));
|
|
51984
51980
|
return { argv: [profile.bin, ...args] };
|
|
51985
51981
|
}
|
|
51986
51982
|
};
|
|
@@ -52071,8 +52067,6 @@ class GeminiHarness extends BaseHarness {
|
|
|
52071
52067
|
displayName = "Gemini CLI";
|
|
52072
52068
|
agentBuilder = geminiBuilder;
|
|
52073
52069
|
resultExtractor = geminiResultExtractor;
|
|
52074
|
-
pattern = "local-runner";
|
|
52075
|
-
structuredOutput = "native-json";
|
|
52076
52070
|
presenceEnv = ["GEMINI_CLI"];
|
|
52077
52071
|
capabilities = caps({
|
|
52078
52072
|
agentDispatch: true,
|
|
@@ -52080,18 +52074,141 @@ class GeminiHarness extends BaseHarness {
|
|
|
52080
52074
|
});
|
|
52081
52075
|
}
|
|
52082
52076
|
|
|
52077
|
+
// src/integrations/harnesses/opencode/model-config.ts
|
|
52078
|
+
var isPositiveInteger = (value) => typeof value === "number" && Number.isInteger(value) && value > 0;
|
|
52079
|
+
function carriedInference(inference) {
|
|
52080
|
+
const carried = {};
|
|
52081
|
+
const { temperature, reasoningEffort, enableThinking, maxTokens, contextLength } = inference ?? {};
|
|
52082
|
+
if (typeof temperature === "number" && Number.isFinite(temperature))
|
|
52083
|
+
carried.temperature = temperature;
|
|
52084
|
+
if (typeof reasoningEffort === "string" && reasoningEffort.length > 0)
|
|
52085
|
+
carried.reasoningEffort = reasoningEffort;
|
|
52086
|
+
if (typeof enableThinking === "boolean")
|
|
52087
|
+
carried.enableThinking = enableThinking;
|
|
52088
|
+
const limit = isPositiveInteger(maxTokens) && isPositiveInteger(contextLength);
|
|
52089
|
+
if (limit)
|
|
52090
|
+
carried.limit = { context: contextLength, output: maxTokens };
|
|
52091
|
+
const keys = [
|
|
52092
|
+
["temperature", carried.temperature !== undefined, temperature],
|
|
52093
|
+
["reasoningEffort", carried.reasoningEffort !== undefined, reasoningEffort],
|
|
52094
|
+
["enableThinking", carried.enableThinking !== undefined, enableThinking],
|
|
52095
|
+
["maxTokens", limit, maxTokens],
|
|
52096
|
+
["contextLength", limit, contextLength]
|
|
52097
|
+
].filter(([, isCarried, value]) => isCarried || value === null).map(([key]) => key);
|
|
52098
|
+
return { carried, keys };
|
|
52099
|
+
}
|
|
52100
|
+
function splitOpencodeModel(model) {
|
|
52101
|
+
const slash = model.indexOf("/");
|
|
52102
|
+
if (slash <= 0 || slash === model.length - 1)
|
|
52103
|
+
return;
|
|
52104
|
+
return { providerID: model.slice(0, slash), modelID: model.slice(slash + 1) };
|
|
52105
|
+
}
|
|
52106
|
+
function opencodeCarriedKeys(attachable, inference, modelWork) {
|
|
52107
|
+
const { keys } = carriedInference(inference);
|
|
52108
|
+
if (attachable)
|
|
52109
|
+
return keys;
|
|
52110
|
+
return modelWork ? keys.filter((key) => key !== "maxTokens" && key !== "contextLength") : [];
|
|
52111
|
+
}
|
|
52112
|
+
function opencodeInferenceConfig(inference, modelWork) {
|
|
52113
|
+
const { carried } = carriedInference(inference);
|
|
52114
|
+
const options = {};
|
|
52115
|
+
if (carried.temperature !== undefined)
|
|
52116
|
+
options.temperature = carried.temperature;
|
|
52117
|
+
if (carried.reasoningEffort !== undefined)
|
|
52118
|
+
options.reasoningEffort = carried.reasoningEffort;
|
|
52119
|
+
if (carried.enableThinking !== undefined) {
|
|
52120
|
+
options.chat_template_kwargs = { enable_thinking: carried.enableThinking };
|
|
52121
|
+
options.enable_thinking = carried.enableThinking;
|
|
52122
|
+
}
|
|
52123
|
+
const hasOptions = Object.keys(options).length > 0;
|
|
52124
|
+
return {
|
|
52125
|
+
entry: {
|
|
52126
|
+
...hasOptions && !modelWork ? { options } : {},
|
|
52127
|
+
...carried.limit ? { limit: { ...carried.limit } } : {}
|
|
52128
|
+
},
|
|
52129
|
+
...hasOptions && modelWork ? { agentOptions: options } : {}
|
|
52130
|
+
};
|
|
52131
|
+
}
|
|
52132
|
+
function opencodeModelConfig(model, entry) {
|
|
52133
|
+
const target = model === undefined ? undefined : splitOpencodeModel(model);
|
|
52134
|
+
if (!target || Object.keys(entry).length === 0)
|
|
52135
|
+
return;
|
|
52136
|
+
return { provider: { [target.providerID]: { models: { [target.modelID]: entry } } } };
|
|
52137
|
+
}
|
|
52138
|
+
|
|
52139
|
+
// src/integrations/harnesses/opencode/model-work-agent.ts
|
|
52140
|
+
var MODEL_WORK_OPENCODE_AGENT = "akm-model-work";
|
|
52141
|
+
var MODEL_WORK_STEPS = 8;
|
|
52142
|
+
var MODEL_WORK_PROMPT = "You do one bounded task for akm. Use tools only to check what the task needs, never repeat a tool call, and reply with exactly what the task asks for.";
|
|
52143
|
+
var MODEL_WORK_PERMISSION = {
|
|
52144
|
+
"*": "deny",
|
|
52145
|
+
read: "allow",
|
|
52146
|
+
edit: "allow",
|
|
52147
|
+
external_directory: "deny",
|
|
52148
|
+
bash: "deny",
|
|
52149
|
+
doom_loop: "deny",
|
|
52150
|
+
glob: "deny",
|
|
52151
|
+
grep: "deny",
|
|
52152
|
+
list: "deny",
|
|
52153
|
+
lsp: "deny",
|
|
52154
|
+
question: "deny",
|
|
52155
|
+
skill: "deny",
|
|
52156
|
+
task: "deny",
|
|
52157
|
+
todowrite: "deny",
|
|
52158
|
+
webfetch: "deny",
|
|
52159
|
+
websearch: "deny"
|
|
52160
|
+
};
|
|
52161
|
+
function modelWorkOpencodeConfig(options) {
|
|
52162
|
+
return {
|
|
52163
|
+
permission: { ...MODEL_WORK_PERMISSION },
|
|
52164
|
+
compaction: { auto: false },
|
|
52165
|
+
agent: {
|
|
52166
|
+
[MODEL_WORK_OPENCODE_AGENT]: {
|
|
52167
|
+
mode: "primary",
|
|
52168
|
+
description: "akm unattended model work: read and edit inside its working directory only.",
|
|
52169
|
+
prompt: MODEL_WORK_PROMPT,
|
|
52170
|
+
steps: MODEL_WORK_STEPS,
|
|
52171
|
+
...options ? { options } : {},
|
|
52172
|
+
permission: { ...MODEL_WORK_PERMISSION }
|
|
52173
|
+
}
|
|
52174
|
+
}
|
|
52175
|
+
};
|
|
52176
|
+
}
|
|
52177
|
+
|
|
52083
52178
|
// src/integrations/harnesses/opencode/agent-builder.ts
|
|
52084
52179
|
var opencodeBuilder = {
|
|
52085
52180
|
platform: "opencode",
|
|
52086
|
-
personaChannel: "
|
|
52181
|
+
personaChannel: "prompt",
|
|
52087
52182
|
lower: createAgentRequestLowerer({
|
|
52088
52183
|
adapter: "opencode",
|
|
52089
|
-
personaChannel: "
|
|
52184
|
+
personaChannel: "prompt",
|
|
52090
52185
|
nativeAgentSelector: true,
|
|
52091
52186
|
tools: "none",
|
|
52092
|
-
|
|
52187
|
+
modelWorkTools: true,
|
|
52188
|
+
inference: (profile, request) => {
|
|
52189
|
+
const model = request.model?.resolved ?? modelFromArgs(profile.args);
|
|
52190
|
+
return opencodeCarriedKeys(model !== undefined && splitOpencodeModel(model) !== undefined, request.inference, isModelWorkTools(request.tools));
|
|
52191
|
+
}
|
|
52093
52192
|
}),
|
|
52094
52193
|
build(profile, req) {
|
|
52194
|
+
const model = req.model ?? modelFromArgs(profile.args);
|
|
52195
|
+
const modelWork = isModelWorkTools(req.tools);
|
|
52196
|
+
const { entry, agentOptions } = opencodeInferenceConfig(req.inference, modelWork);
|
|
52197
|
+
const modelConfig = opencodeModelConfig(model, entry);
|
|
52198
|
+
if (modelWork) {
|
|
52199
|
+
return {
|
|
52200
|
+
argv: [
|
|
52201
|
+
profile.bin,
|
|
52202
|
+
"run",
|
|
52203
|
+
"--agent",
|
|
52204
|
+
MODEL_WORK_OPENCODE_AGENT,
|
|
52205
|
+
...model ? ["--model", model] : [],
|
|
52206
|
+
"--",
|
|
52207
|
+
req.prompt
|
|
52208
|
+
],
|
|
52209
|
+
env: { OPENCODE_CONFIG_CONTENT: JSON.stringify({ ...modelWorkOpencodeConfig(agentOptions), ...modelConfig }) }
|
|
52210
|
+
};
|
|
52211
|
+
}
|
|
52095
52212
|
const args = req.model ? [] : [...profile.args];
|
|
52096
52213
|
if (req.model) {
|
|
52097
52214
|
for (let index = 0;index < profile.args.length; index += 1) {
|
|
@@ -52105,9 +52222,6 @@ var opencodeBuilder = {
|
|
|
52105
52222
|
}
|
|
52106
52223
|
}
|
|
52107
52224
|
}
|
|
52108
|
-
if (req.systemPrompt) {
|
|
52109
|
-
args.push("--system-prompt", req.systemPrompt);
|
|
52110
|
-
}
|
|
52111
52225
|
if (req.agent) {
|
|
52112
52226
|
args.push("--agent", req.agent);
|
|
52113
52227
|
}
|
|
@@ -52117,7 +52231,10 @@ var opencodeBuilder = {
|
|
|
52117
52231
|
}
|
|
52118
52232
|
args.push("--");
|
|
52119
52233
|
args.push(req.prompt);
|
|
52120
|
-
return {
|
|
52234
|
+
return {
|
|
52235
|
+
argv: [profile.bin, ...args],
|
|
52236
|
+
...modelConfig ? { env: { OPENCODE_CONFIG_CONTENT: JSON.stringify(modelConfig) } } : {}
|
|
52237
|
+
};
|
|
52121
52238
|
}
|
|
52122
52239
|
};
|
|
52123
52240
|
|
|
@@ -52395,8 +52512,6 @@ class OpencodeHarness extends BaseHarness {
|
|
|
52395
52512
|
displayName = "OpenCode";
|
|
52396
52513
|
setupDetectionDir = ".config/opencode";
|
|
52397
52514
|
agentBuilder = opencodeBuilder;
|
|
52398
|
-
pattern = "local-runner";
|
|
52399
|
-
structuredOutput = "none";
|
|
52400
52515
|
identityEnv = ["OPENCODE_SESSION_ID"];
|
|
52401
52516
|
sessionLogProvider = () => new OpenCodeProvider;
|
|
52402
52517
|
capabilities = caps({
|
|
@@ -52411,8 +52526,6 @@ class OpencodeHarness extends BaseHarness {
|
|
|
52411
52526
|
class OpencodeSdkHarness extends BaseHarness {
|
|
52412
52527
|
id = "opencode-sdk";
|
|
52413
52528
|
displayName = "OpenCode SDK";
|
|
52414
|
-
pattern = "local-runner";
|
|
52415
|
-
structuredOutput = "native-json";
|
|
52416
52529
|
executionLowerer = {
|
|
52417
52530
|
platform: "opencode-sdk",
|
|
52418
52531
|
personaChannel: "native",
|
|
@@ -52421,7 +52534,8 @@ class OpencodeSdkHarness extends BaseHarness {
|
|
|
52421
52534
|
personaChannel: "native",
|
|
52422
52535
|
nativeAgentSelector: true,
|
|
52423
52536
|
tools: "sdk",
|
|
52424
|
-
|
|
52537
|
+
modelWorkTools: true,
|
|
52538
|
+
inference: (_profile, request) => opencodeCarriedKeys(Boolean(request.model?.resolved), request.inference, isModelWorkTools(request.tools))
|
|
52425
52539
|
})
|
|
52426
52540
|
};
|
|
52427
52541
|
capabilities = caps({
|
|
@@ -52438,10 +52552,6 @@ function buildTaskPayload(req) {
|
|
|
52438
52552
|
if (req.systemPrompt)
|
|
52439
52553
|
sections.push(req.systemPrompt);
|
|
52440
52554
|
sections.push(req.prompt);
|
|
52441
|
-
if (req.schema) {
|
|
52442
|
-
sections.push(`Respond with ONLY a JSON value matching this JSON Schema (no prose, no code fences):
|
|
52443
|
-
${JSON.stringify(req.schema)}`);
|
|
52444
|
-
}
|
|
52445
52555
|
return sections.join(`
|
|
52446
52556
|
|
|
52447
52557
|
`);
|
|
@@ -52452,8 +52562,7 @@ var openhandsBuilder = {
|
|
|
52452
52562
|
lower: createAgentRequestLowerer({
|
|
52453
52563
|
adapter: OPENHANDS_PLATFORM,
|
|
52454
52564
|
personaChannel: "prompt",
|
|
52455
|
-
tools: "none"
|
|
52456
|
-
outputSchema: true
|
|
52565
|
+
tools: "none"
|
|
52457
52566
|
}),
|
|
52458
52567
|
build(profile, req) {
|
|
52459
52568
|
const args = [...profile.args];
|
|
@@ -52537,8 +52646,6 @@ class OpenhandsHarness extends BaseHarness {
|
|
|
52537
52646
|
displayName = "OpenHands";
|
|
52538
52647
|
agentBuilder = openhandsBuilder;
|
|
52539
52648
|
resultExtractor = openhandsResultExtractor;
|
|
52540
|
-
pattern = "local-runner";
|
|
52541
|
-
structuredOutput = "native-json";
|
|
52542
52649
|
capabilities = caps({
|
|
52543
52650
|
agentDispatch: true,
|
|
52544
52651
|
detection: true
|
|
@@ -52547,24 +52654,13 @@ class OpenhandsHarness extends BaseHarness {
|
|
|
52547
52654
|
|
|
52548
52655
|
// src/integrations/harnesses/pi/agent-builder.ts
|
|
52549
52656
|
var PI_PLATFORM = "pi";
|
|
52550
|
-
function buildPromptPayload5(req) {
|
|
52551
|
-
const sections = [req.prompt];
|
|
52552
|
-
if (req.schema) {
|
|
52553
|
-
sections.push(`Respond with ONLY a JSON value matching this JSON Schema (no prose, no code fences):
|
|
52554
|
-
${JSON.stringify(req.schema)}`);
|
|
52555
|
-
}
|
|
52556
|
-
return sections.join(`
|
|
52557
|
-
|
|
52558
|
-
`);
|
|
52559
|
-
}
|
|
52560
52657
|
var piBuilder = {
|
|
52561
52658
|
platform: PI_PLATFORM,
|
|
52562
52659
|
personaChannel: "native",
|
|
52563
52660
|
lower: createAgentRequestLowerer({
|
|
52564
52661
|
adapter: PI_PLATFORM,
|
|
52565
52662
|
personaChannel: "native",
|
|
52566
|
-
tools: "none"
|
|
52567
|
-
outputSchema: true
|
|
52663
|
+
tools: "none"
|
|
52568
52664
|
}),
|
|
52569
52665
|
build(profile, req) {
|
|
52570
52666
|
const args = [...profile.args];
|
|
@@ -52580,7 +52676,7 @@ var piBuilder = {
|
|
|
52580
52676
|
}
|
|
52581
52677
|
args.push("-p");
|
|
52582
52678
|
args.push("--");
|
|
52583
|
-
args.push(
|
|
52679
|
+
args.push(req.prompt);
|
|
52584
52680
|
return { argv: [profile.bin, ...args] };
|
|
52585
52681
|
}
|
|
52586
52682
|
};
|
|
@@ -52682,8 +52778,6 @@ class PiHarness extends BaseHarness {
|
|
|
52682
52778
|
displayName = "Pi";
|
|
52683
52779
|
agentBuilder = piBuilder;
|
|
52684
52780
|
resultExtractor = piResultExtractor;
|
|
52685
|
-
pattern = "local-runner";
|
|
52686
|
-
structuredOutput = "native-json";
|
|
52687
52781
|
identityEnv = ["PI_SESSION_ID"];
|
|
52688
52782
|
capabilities = caps({
|
|
52689
52783
|
agentDispatch: true,
|
|
@@ -52718,6 +52812,11 @@ var VALID_HARNESS_IDS2 = Object.freeze(HARNESS_REGISTRY.map((h) => h.id));
|
|
|
52718
52812
|
var SESSION_LOG_HARNESSES = HARNESS_REGISTRY.filter(isSessionLogHarness);
|
|
52719
52813
|
var AGENT_DISPATCH_HARNESSES = HARNESS_REGISTRY.filter((h) => h.capabilities.agentDispatch);
|
|
52720
52814
|
|
|
52815
|
+
// src/integrations/agent/model-map.ts
|
|
52816
|
+
var ENGINE_KEY_PATTERN = new RegExp(ENGINE_NAME_PATTERN_SOURCE);
|
|
52817
|
+
var RESERVED_MAP_KEYS = new Set(["__proto__", "constructor", "prototype", "tostring"]);
|
|
52818
|
+
var PROFILE_FIELD_KEYS = new Set(["model", "inference", "engine"]);
|
|
52819
|
+
|
|
52721
52820
|
// src/core/spawn-env.ts
|
|
52722
52821
|
var COMMON_SPAWN_ENV_PASSTHROUGH = [
|
|
52723
52822
|
"HOME",
|
|
@@ -52819,11 +52918,6 @@ var FALLBACK_ANNOUNCEMENT = `No engine is configured; falling back to \`${FALLBA
|
|
|
52819
52918
|
var NO_ENGINE_MESSAGE_SUFFIX = `has no selected engine, and no usable \`${OPENCODE_SDK_SERVER_BIN}\` binary was found to fall back to.`;
|
|
52820
52919
|
var NO_ENGINE_REMEDY = "Run `akm setup` to detect an installed agent, or set one explicitly: " + '`akm config set engines.claude \'{"kind":"agent","platform":"claude"}\'` ' + "then `akm config set defaults.engine claude`. " + `Installing the \`${OPENCODE_SDK_SERVER_BIN}\` binary also works ` + "(`npm i -g opencode-ai`) \u2014 akm falls back to it automatically.";
|
|
52821
52920
|
|
|
52822
|
-
// src/integrations/agent/model-map.ts
|
|
52823
|
-
var ENGINE_KEY_PATTERN = new RegExp(ENGINE_NAME_PATTERN_SOURCE);
|
|
52824
|
-
var RESERVED_MAP_KEYS = new Set(["__proto__", "constructor", "prototype", "tostring"]);
|
|
52825
|
-
var PROFILE_FIELD_KEYS = new Set(["model", "inference", "engine"]);
|
|
52826
|
-
|
|
52827
52921
|
// src/storage/repositories/improve-ledger-repository.ts
|
|
52828
52922
|
var LEDGER_REJECTION_WINDOW_DAYS = Object.freeze({
|
|
52829
52923
|
reflect: 14,
|
|
@@ -52850,9 +52944,9 @@ var BUILTIN_STRATEGIES = {
|
|
|
52850
52944
|
if (BUILTIN_IMPROVE_STRATEGY_NAMES.some((name) => !(name in BUILTIN_STRATEGIES))) {
|
|
52851
52945
|
throw new Error("Built-in improve strategy names are out of sync with their assets");
|
|
52852
52946
|
}
|
|
52947
|
+
var MODEL_CALLING_PROCESSES = new Set(IMPROVE_ENGINE_PROCESSES.filter((name) => name !== "triage"));
|
|
52853
52948
|
|
|
52854
52949
|
// src/commands/improve/improve-usage-report.ts
|
|
52855
|
-
var LLM_BACKED_PROCESSES = new Set(Object.keys(IMPROVE_PROCESS_ENGINE_CAPABILITIES).filter((name) => IMPROVE_PROCESS_ENGINE_CAPABILITIES[name] === "llm"));
|
|
52856
52950
|
function renderFixedWidthTable(headers, rows) {
|
|
52857
52951
|
const widths = headers.map((header, index) => Math.max(header.length, ...rows.map((row) => row[index]?.length ?? 0)));
|
|
52858
52952
|
const renderRow = (cells) => cells.map((cell, index) => cell.padEnd(widths[index] ?? 0)).join(" ").trimEnd();
|