akm-cli 0.10.261016-beta → 0.10.261018-beta
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 +144 -0
- package/README.md +8 -10
- package/SECURITY.md +7 -99
- package/STABILITY.md +57 -98
- package/dist/assets/opencode/akm-plugin.js +103 -1
- package/dist/assets/stash-skeleton/facts/conventions/backlinks.md +2 -2
- package/dist/assets/stash-skeleton/facts/conventions/organization.md +11 -17
- package/dist/cli.js +32 -41
- package/dist/commands/feedback-cli.js +5 -4
- package/dist/commands/health.js +15 -16
- package/dist/commands/proposal/proposal-cli.js +1 -1
- package/dist/commands/read/registry-search.js +4 -1
- package/dist/commands/read/search.js +6 -6
- package/dist/commands/sources/self-update.js +9 -5
- package/dist/commands/tasks/tasks.js +12 -13
- package/dist/core/adapter/adapters/agent-skills-adapter.js +7 -7
- package/dist/core/adapter/adapters/akm-task-adapter.js +1 -1
- package/dist/core/adapter/adapters/akm-workflow-adapter.js +1 -1
- package/dist/core/adapter/adapters/claude-adapter.js +1 -1
- package/dist/core/adapter/adapters/dotenv-adapter.js +1 -1
- package/dist/core/adapter/adapters/generic-files-adapter.js +1 -1
- package/dist/core/adapter/adapters/llm-wiki-adapter.js +1 -1
- package/dist/core/adapter/adapters/opencode-adapter.js +1 -1
- package/dist/core/adapter/adapters/website-snapshot-adapter.js +1 -1
- package/dist/core/bundle-rename.js +17 -7
- package/dist/core/config/convert-engine-references.js +23 -7
- package/dist/core/config/convert-engines.js +94 -28
- package/dist/core/config/convert-models-overlay.js +14 -2
- package/dist/indexer/bundle-identity-guard.js +6 -6
- package/dist/indexer/index-written-assets.js +3 -3
- package/dist/indexer/indexer.js +12 -8
- package/dist/indexer/materialize-embeddings.js +12 -2
- package/dist/indexer/passes/metadata.js +103 -46
- package/dist/indexer/search/ranking.js +7 -3
- package/dist/indexer/search/search-fields.js +1 -1
- package/dist/indexer/usage/usage-events.js +30 -8
- package/dist/indexer/walk/walker.js +1 -1
- package/dist/integrations/agent/spawn.js +7 -2
- package/dist/integrations/harnesses/opencode/agent-builder.js +10 -1
- package/dist/integrations/harnesses/opencode/runtime/binary.js +6 -3
- package/dist/integrations/harnesses/opencode/runtime/index.js +18 -9
- package/dist/integrations/harnesses/opencode/session-log-v2.js +11 -1
- package/dist/output/shapes/helpers.js +3 -3
- package/dist/output/text/command-format.js +5 -6
- package/dist/scripts/akm-migrate-node.js +122 -36
- package/dist/scripts/akm-migrate.js +122 -36
- package/dist/sources/providers/git-provider.js +2 -4
- package/dist/sources/providers/provider-utils.js +8 -13
- package/dist/sources/snapshot-fetchers/website-ingest.js +6 -7
- package/dist/storage/repositories/events-repository.js +15 -0
- package/dist/storage/repositories/improve-ledger-repository.js +13 -0
- package/dist/storage/repositories/index-entries-repository.js +43 -5
- package/dist/storage/repositories/outcome-repository.js +12 -0
- package/dist/storage/repositories/proposals-repository.js +5 -5
- package/dist/storage/repositories/salience-repository.js +13 -0
- package/dist/storage/repositories/task-history-repository.js +8 -7
- package/dist/storage/repositories/workflow-runs-repository.js +10 -8
- package/docs/README.md +24 -60
- package/docs/agents/README.md +3 -8
- package/docs/architecture/README.md +18 -20
- package/docs/architecture/adapters.md +40 -43
- package/docs/architecture/architecture.md +180 -154
- package/docs/architecture/improvement.md +95 -91
- package/docs/architecture/internals/classification.md +101 -119
- package/docs/architecture/internals/fresh-host-rebuild-runbook.md +33 -35
- package/docs/architecture/internals/health-advisories.md +59 -46
- package/docs/architecture/internals/improve-workflow.md +166 -693
- package/docs/architecture/internals/indexing.md +65 -465
- package/docs/architecture/internals/storage-locations.md +301 -848
- package/docs/architecture/persisted-data-compat.md +6 -6
- package/docs/architecture/specs/okf-support.md +67 -95
- package/docs/architecture/specs/ref.md +67 -125
- package/docs/architecture/testing/testing-workflow.md +108 -168
- package/docs/architecture/workflow-engine.md +34 -33
- package/docs/guides/README.md +5 -5
- package/docs/guides/author-bundles.md +72 -98
- package/docs/guides/author-workflows.md +11 -18
- package/docs/guides/bundles.md +91 -123
- package/docs/guides/capture-knowledge.md +10 -9
- package/docs/guides/concepts.md +45 -30
- package/docs/guides/discover-and-load.md +39 -32
- package/docs/guides/getting-started.md +24 -24
- package/docs/guides/improve-the-library.md +98 -80
- package/docs/guides/recipes/headless-install.md +4 -4
- package/docs/guides/recipes/website-source.md +9 -5
- package/docs/guides/run-workflows.md +10 -11
- package/docs/guides/scheduling.md +11 -17
- package/docs/guides/use-with-any-agent.md +15 -14
- package/docs/guides/wikis.md +6 -9
- package/docs/integration/bundling-akm.md +21 -26
- package/docs/maintainers/README.md +2 -2
- package/docs/maintainers/local-development.md +3 -16
- package/docs/migration/README.md +2 -1
- package/docs/migration/release-notes/0.10.0.md +196 -23
- package/docs/migration/release-notes/README.md +2 -2
- package/docs/migration/v0.9-to-v0.10.md +103 -12
- package/docs/product-surface.md +10 -8
- package/docs/reference/README.md +26 -15
- package/docs/reference/asset-types.md +11 -12
- package/docs/reference/bundle-types.md +6 -5
- package/docs/reference/cli.md +52 -28
- package/docs/reference/configuration.md +91 -73
- package/docs/reference/data-and-telemetry.md +204 -421
- package/docs/reference/env-and-secrets.md +80 -83
- package/docs/reference/memory.md +1 -1
- package/docs/reference/refs.md +23 -36
- package/docs/reference/registry.md +138 -348
- package/docs/reference/supported-formats.md +8 -8
- package/docs/reference/tasks.md +13 -19
- package/docs/reference/website-sources.md +23 -15
- package/docs/reference/workflow-schema.md +28 -47
- package/docs/reference/workflows.md +33 -37
- package/package.json +1 -1
|
@@ -30476,6 +30476,7 @@ function modelWorkConfig() {
|
|
|
30476
30476
|
}
|
|
30477
30477
|
const config2 = {
|
|
30478
30478
|
...user,
|
|
30479
|
+
plugins: [...Array.isArray(user?.plugins) ? user.plugins : [], WITHOUT_BROWSER_PLUGIN],
|
|
30479
30480
|
agents: { ...asRecord(user?.agents), [MODEL_WORK_AGENT]: MODEL_WORK_AGENT_DEFINITION }
|
|
30480
30481
|
};
|
|
30481
30482
|
const legacy = asRecord(user?.agent);
|
|
@@ -30508,7 +30509,7 @@ function withEnvReferences(content) {
|
|
|
30508
30509
|
return replaced(true);
|
|
30509
30510
|
}
|
|
30510
30511
|
}
|
|
30511
|
-
var MODEL_WORK_AGENT = "akm-model-work", MODEL_WORK_AGENT_DEFINITION, CONFIG_CONTENT_ENV = "OPENCODE_CONFIG_CONTENT", NO_FREE_MODELS, opencodeBuilder;
|
|
30512
|
+
var MODEL_WORK_AGENT = "akm-model-work", MODEL_WORK_AGENT_DEFINITION, CONFIG_CONTENT_ENV = "OPENCODE_CONFIG_CONTENT", WITHOUT_BROWSER_PLUGIN = "-opencode.browser", NO_FREE_MODELS, opencodeBuilder;
|
|
30512
30513
|
var init_agent_builder = __esm(() => {
|
|
30513
30514
|
init_common();
|
|
30514
30515
|
init_warn();
|
|
@@ -32114,13 +32115,22 @@ function improveStrategyDefault(out, defaults, improve) {
|
|
|
32114
32115
|
out.improve = { ...isRecord(improve) ? improve : {} };
|
|
32115
32116
|
out.improve.strategy ??= defaults.improveStrategy;
|
|
32116
32117
|
}
|
|
32117
|
-
function dropJudgeEngine(out, conversion) {
|
|
32118
|
+
function dropJudgeEngine(out, conversion, target, defaultEngine, judge) {
|
|
32118
32119
|
const workflow = out.workflow;
|
|
32119
|
-
|
|
32120
|
-
|
|
32121
|
-
|
|
32122
|
-
|
|
32123
|
-
|
|
32120
|
+
const named = isRecord(workflow) && "judgeEngine" in workflow;
|
|
32121
|
+
const engine = named ? str(workflow.judgeEngine) : defaultEngine;
|
|
32122
|
+
if (named) {
|
|
32123
|
+
delete workflow.judgeEngine;
|
|
32124
|
+
conversion.changed = true;
|
|
32125
|
+
}
|
|
32126
|
+
const became = engine === undefined ? undefined : target(engine);
|
|
32127
|
+
const stays = became !== undefined && judge !== undefined && isDeepStrictEqual(became, judge);
|
|
32128
|
+
const kind = judge === undefined ? undefined : ("connection" in judge) ? "connection" : "harness";
|
|
32129
|
+
if (named) {
|
|
32130
|
+
conversion.notes.push(stays ? `workflow.judgeEngine: "${engine}" is the default ${kind}, where a gate's judge runs now; the setting is dropped.` : `workflow.judgeEngine${engine === undefined ? "" : ` "${engine}"`}: dropped. A gate's judge runs on the default connection, else the default harness, so a judge that ran on another engine has moved; to keep it, make that engine the default.`);
|
|
32131
|
+
} else if (became !== undefined && judge !== undefined && !stays) {
|
|
32132
|
+
conversion.notes.push(`workflow: with no workflow.judgeEngine, a gate's judge ran on the default engine "${engine}"; it is model work now and runs on the default ${kind}, "${"connection" in judge ? judge.connection : judge.harness}".`);
|
|
32133
|
+
}
|
|
32124
32134
|
}
|
|
32125
32135
|
function convertIndexEngines(out, conversion, retarget) {
|
|
32126
32136
|
const index = out.index;
|
|
@@ -32187,6 +32197,8 @@ function foldModelsOverlay(modelsOverlay, fold) {
|
|
|
32187
32197
|
const writtenHarnesses = written.harnesses;
|
|
32188
32198
|
const configNames = (own2, base, name, alias) => hasModel(own2[name], alias) || hasModel(base[name], alias);
|
|
32189
32199
|
const platformOf = (name) => String((mergedHarnesses[name] ?? inheritedHarnesses[name])?.platform ?? name);
|
|
32200
|
+
const columnOf = (name) => renamed.sdkHarness.includes(name) ? "opencode-sdk" : platformOf(name);
|
|
32201
|
+
const notedOwn = new Set;
|
|
32190
32202
|
let folded = false;
|
|
32191
32203
|
for (const { alias, column, profile } of overlayRows(modelsOverlay)) {
|
|
32192
32204
|
const p = typeof profile === "string" ? { model: profile } : isRecord(profile) ? profile : {};
|
|
@@ -32198,13 +32210,18 @@ function foldModelsOverlay(modelsOverlay, fold) {
|
|
|
32198
32210
|
continue;
|
|
32199
32211
|
}
|
|
32200
32212
|
const candidates = column === "*" ? [...new Set([...Object.keys(mergedConnections), ...Object.keys(inheritedConnections)])] : column === "opencode-sdk" ? [...renamed.runtime] : renamed.connection(column) !== undefined ? [renamed.connection(column)] : (column in writtenConnections) || (column in inheritedConnections) ? [column] : [];
|
|
32201
|
-
const harnessNamed = [...new Set([...Object.keys(mergedHarnesses), ...Object.keys(inheritedHarnesses)])].filter((name) =>
|
|
32213
|
+
const harnessNamed = [...new Set([...Object.keys(mergedHarnesses), ...Object.keys(inheritedHarnesses)])].filter((name) => columnOf(name) === column);
|
|
32202
32214
|
if (candidates.length === 0 && harnessNamed.length === 0) {
|
|
32203
32215
|
notes2.push(`${where}: names no configured connection or harness, so it is not carried over.`);
|
|
32204
32216
|
continue;
|
|
32205
32217
|
}
|
|
32206
32218
|
const connectionNames = candidates.filter((name) => !configNames(writtenConnections, inheritedConnections, name, alias) && !(column === "*" && hasModel(mergedConnections[name], alias)));
|
|
32207
|
-
const
|
|
32219
|
+
const unnamed = harnessNamed.filter((name) => !configNames(writtenHarnesses, inheritedHarnesses, name, alias));
|
|
32220
|
+
const harnessNames = unnamed.filter((name) => !ownModels.harnesses.has(name));
|
|
32221
|
+
for (const name of unnamed.filter((n) => ownModels.harnesses.has(n) && !notedOwn.has(`${column}:${n}`))) {
|
|
32222
|
+
notedOwn.add(`${column}:${name}`);
|
|
32223
|
+
notes2.push(`models.json (${column === "*" ? "all" : column}): harness "${name}" has a model of its own, which names every alias, so the column is not carried over.`);
|
|
32224
|
+
}
|
|
32208
32225
|
if (connectionNames.length === 0 && harnessNames.length === 0) {
|
|
32209
32226
|
const keptByConfig = candidates.some((name) => configNames(writtenConnections, inheritedConnections, name, alias)) || harnessNamed.some((name) => configNames(writtenHarnesses, inheritedHarnesses, name, alias));
|
|
32210
32227
|
if (keptByConfig)
|
|
@@ -32264,15 +32281,23 @@ function implicitKeyVariables(name, defaults) {
|
|
|
32264
32281
|
const own2 = `AKM_ENGINE_${name.toUpperCase().replaceAll("-", "_")}_API_KEY`;
|
|
32265
32282
|
return name === str(defaults.llmEngine) ? [own2, "AKM_LLM_API_KEY"] : [own2];
|
|
32266
32283
|
}
|
|
32267
|
-
function runtimeEngine(name, engine, converted, conversion) {
|
|
32268
|
-
converted.runtimes.set(name,
|
|
32269
|
-
|
|
32270
|
-
}
|
|
32271
|
-
|
|
32272
|
-
|
|
32284
|
+
function runtimeEngine(name, engine, llmEngine, converted, conversion) {
|
|
32285
|
+
converted.runtimes.set(name, llmEngine);
|
|
32286
|
+
const dropped = ["model", "timeoutMs", "workspace", "bin", "agent"].filter((key) => engine[key] !== undefined);
|
|
32287
|
+
const gone = dropped.length === 0 ? "" : `; its ${dropped.join(", ")} ${dropped.length === 1 ? "is" : "are"} dropped`;
|
|
32288
|
+
conversion.notes.push(`engines.${name}: opencode-sdk over llmEngine "${llmEngine}" is akm's own runtime over connection "${llmEngine}" now, with no entry of its own${gone}.`);
|
|
32289
|
+
}
|
|
32290
|
+
function agentEngineToHarness(name, engine, converted, conversion) {
|
|
32291
|
+
const sdk = engine.platform === "opencode-sdk";
|
|
32292
|
+
const harness = { platform: sdk ? "opencode" : engine.platform };
|
|
32293
|
+
if (sdk)
|
|
32294
|
+
converted.sdkHarnesses.add(name);
|
|
32273
32295
|
for (const key of ["bin", "args", "workspace", "agent", "timeoutMs"])
|
|
32274
|
-
if (engine[key] !== undefined)
|
|
32296
|
+
if (engine[key] !== undefined && !(sdk && key === "args"))
|
|
32275
32297
|
harness[key] = engine[key];
|
|
32298
|
+
if (sdk && engine.args !== undefined) {
|
|
32299
|
+
conversion.notes.push(`engines.${name}: args is dropped. 0.9 did not pass it to OpenCode, and the opencode harness would pass it in place of \`run\`.`);
|
|
32300
|
+
}
|
|
32276
32301
|
const model = str(engine.model);
|
|
32277
32302
|
if (model !== undefined)
|
|
32278
32303
|
converted.ownModelOf.push({ kind: "harnesses", engine: name, model });
|
|
@@ -32323,6 +32348,7 @@ function convertEngines(engines, defaults, env, conversion) {
|
|
|
32323
32348
|
connections: {},
|
|
32324
32349
|
harnesses: {},
|
|
32325
32350
|
runtimes: new Map,
|
|
32351
|
+
sdkHarnesses: new Set,
|
|
32326
32352
|
keyHolders: [],
|
|
32327
32353
|
ownModelOf: []
|
|
32328
32354
|
};
|
|
@@ -32332,12 +32358,13 @@ function convertEngines(engines, defaults, env, conversion) {
|
|
|
32332
32358
|
const unknown2 = Object.keys(engine).filter((k) => !(engine.kind === "agent" ? AGENT_ENGINE_KEYS : LLM_ENGINE_KEYS).has(k));
|
|
32333
32359
|
if (unknown2.length > 0)
|
|
32334
32360
|
conversion.notes.push(`engines.${name}: dropped ${unknown2.join(", ")}, which akm does not read.`);
|
|
32361
|
+
const llmEngine = str(engine.llmEngine);
|
|
32335
32362
|
if (engine.kind !== "agent")
|
|
32336
32363
|
llmEngineToConnection(name, engine, defaults, env, converted, conversion);
|
|
32337
|
-
else if (engine.platform === "opencode-sdk")
|
|
32338
|
-
runtimeEngine(name, engine, converted, conversion);
|
|
32364
|
+
else if (engine.platform === "opencode-sdk" && llmEngine !== undefined)
|
|
32365
|
+
runtimeEngine(name, engine, llmEngine, converted, conversion);
|
|
32339
32366
|
else
|
|
32340
|
-
agentEngineToHarness(name, engine, converted);
|
|
32367
|
+
agentEngineToHarness(name, engine, converted, conversion);
|
|
32341
32368
|
}
|
|
32342
32369
|
return converted;
|
|
32343
32370
|
}
|
|
@@ -32355,11 +32382,21 @@ function renameMap(names, taken, from) {
|
|
|
32355
32382
|
}
|
|
32356
32383
|
return (name) => moved.get(name) ?? name;
|
|
32357
32384
|
}
|
|
32385
|
+
function agentWorkMoved(defaultEngine, runtimes, harness) {
|
|
32386
|
+
if (defaultEngine !== undefined) {
|
|
32387
|
+
return runtimes.has(defaultEngine) && harness !== undefined ? `Agent work ran on akm's own runtime (engines.${defaultEngine}); with the harness "${harness}" configured it now runs there. Remove that harness to keep agent work on akm's runtime.` : undefined;
|
|
32388
|
+
}
|
|
32389
|
+
const ran = "Without defaults.engine, agent work ran on your own OpenCode (the implicit fallback), when it was installed";
|
|
32390
|
+
return harness !== undefined ? `${ran}; with the harness "${harness}" configured it now runs there.` : `${ran}; it now runs on akm's own runtime. To keep it on your OpenCode, enable the harness: \`akm setup --harness opencode\`.`;
|
|
32391
|
+
}
|
|
32358
32392
|
function nameDefaults(defaults, converted, conversion, written) {
|
|
32359
|
-
const { connections, harnesses, runtimes, keyHolders } = converted;
|
|
32360
|
-
const
|
|
32393
|
+
const { connections, harnesses, runtimes, sdkHarnesses, keyHolders } = converted;
|
|
32394
|
+
const implicit = sdkHarnesses.has(IMPLICIT_AGENT_ENGINE) || runtimes.has(IMPLICIT_AGENT_ENGINE);
|
|
32395
|
+
const defaultEngine = str(defaults.engine) ?? (implicit ? IMPLICIT_AGENT_ENGINE : undefined);
|
|
32396
|
+
const modelWorkEngine = str(defaults.llmEngine);
|
|
32361
32397
|
const runtimeLlm = defaultEngine === undefined ? undefined : runtimes.get(defaultEngine);
|
|
32362
|
-
const
|
|
32398
|
+
const modelWorkRuntimeLlm = modelWorkEngine === undefined ? undefined : runtimes.get(modelWorkEngine);
|
|
32399
|
+
const defaultConnection = [modelWorkEngine, modelWorkRuntimeLlm, defaultEngine, runtimeLlm].find((n) => n !== undefined && (n in connections));
|
|
32363
32400
|
const defaultHarness = defaultEngine !== undefined && defaultEngine in harnesses && Object.keys(harnesses).length > 1 ? defaultEngine : undefined;
|
|
32364
32401
|
const connectionName = renameMap(Object.keys(connections), Object.keys(written.connections), defaultConnection);
|
|
32365
32402
|
const harnessName = renameMap(Object.keys(harnesses), Object.keys(written.harnesses), defaultHarness);
|
|
@@ -32368,9 +32405,16 @@ function nameDefaults(defaults, converted, conversion, written) {
|
|
|
32368
32405
|
connections: renamed(connections, connectionName),
|
|
32369
32406
|
harnesses: renamed(harnesses, harnessName)
|
|
32370
32407
|
};
|
|
32371
|
-
const defaultHarnessName =
|
|
32372
|
-
|
|
32373
|
-
|
|
32408
|
+
const defaultHarnessName = defaultName(named.harnesses);
|
|
32409
|
+
const hasEngines = Object.keys(connections).length + Object.keys(harnesses).length + runtimes.size > 0;
|
|
32410
|
+
const moved = hasEngines ? agentWorkMoved(defaultEngine, runtimes, defaultHarnessName) : undefined;
|
|
32411
|
+
if (moved !== undefined)
|
|
32412
|
+
conversion.notes.push(moved);
|
|
32413
|
+
if (modelWorkEngine !== undefined && modelWorkEngine in harnesses) {
|
|
32414
|
+
const now = harnessName(modelWorkEngine);
|
|
32415
|
+
if (defaultName({ ...named.connections, ...written.connections }) !== undefined || defaultHarnessName !== now) {
|
|
32416
|
+
conversion.notes.push(`defaults.llmEngine "${modelWorkEngine}" named an agent engine, which ran akm's model work. Model work now runs on the default connection, else the default harness; to keep it on the harness "${now}", set improve.harness to it.`);
|
|
32417
|
+
}
|
|
32374
32418
|
}
|
|
32375
32419
|
for (const [kind, rename] of [
|
|
32376
32420
|
["connections", connectionName],
|
|
@@ -32382,10 +32426,9 @@ function nameDefaults(defaults, converted, conversion, written) {
|
|
|
32382
32426
|
conversion.notes.push(`engines.default is now ${kind}.${aside}, and "default" names another engine: an engine: default key is rewritten by \`akm migrate apply\` where it can be, but a script or scheduled command that passes --engine default now reaches the new "default"; change it to the name ${aside}.`);
|
|
32383
32427
|
}
|
|
32384
32428
|
const target = (engine) => {
|
|
32385
|
-
|
|
32386
|
-
|
|
32387
|
-
return runtime
|
|
32388
|
-
}
|
|
32429
|
+
const runtime = runtimes.get(engine);
|
|
32430
|
+
if (runtime !== undefined)
|
|
32431
|
+
return runtime in connections ? { connection: connectionName(runtime) } : undefined;
|
|
32389
32432
|
if (engine in harnesses)
|
|
32390
32433
|
return { harness: harnessName(engine) };
|
|
32391
32434
|
if (engine in connections)
|
|
@@ -32397,7 +32440,7 @@ function nameDefaults(defaults, converted, conversion, written) {
|
|
|
32397
32440
|
connection: connectionName(engine),
|
|
32398
32441
|
field
|
|
32399
32442
|
}));
|
|
32400
|
-
return { defaultConnection, defaultHarness, connectionName, harnessName, ...named, keys, target };
|
|
32443
|
+
return { defaultEngine, defaultConnection, defaultHarness, connectionName, harnessName, ...named, keys, target };
|
|
32401
32444
|
}
|
|
32402
32445
|
function mergeWritten(out, naming) {
|
|
32403
32446
|
for (const [name, harness] of Object.entries(naming.harnesses)) {
|
|
@@ -32416,6 +32459,19 @@ function ownModelsOf(converted, naming) {
|
|
|
32416
32459
|
}
|
|
32417
32460
|
return ownModels;
|
|
32418
32461
|
}
|
|
32462
|
+
function modelWorkTarget(defaults, naming, merged, inherited, conversion) {
|
|
32463
|
+
const connection = defaultName({ ...inherited?.connections, ...merged.connections });
|
|
32464
|
+
if (connection !== undefined)
|
|
32465
|
+
return { connection };
|
|
32466
|
+
const harness = defaultName({ ...inherited?.harnesses, ...merged.harnesses });
|
|
32467
|
+
const entry = harness === undefined ? undefined : merged.harnesses[harness];
|
|
32468
|
+
if (harness === undefined || !isRecord(entry))
|
|
32469
|
+
return;
|
|
32470
|
+
if (str(defaults.llmEngine) === undefined && harness in naming.harnesses && entry.modelWork === undefined) {
|
|
32471
|
+
conversion.notes.push(`harnesses.${harness}: akm's own model work (improve, index passes, extraction, judges) now runs on this harness, the default for it with no connection. Without defaults.llmEngine, 0.9 ran none of it unless a setting named an engine (a workflow gate's judge ran on defaults.engine). To keep the 0.9 behaviour, set \`modelWork: false\` on this harness: a call that names it still runs there, but a workflow gate's judge then needs a connection (\`akm setup --endpoint URL\`).`);
|
|
32472
|
+
}
|
|
32473
|
+
return entry.modelWork === false ? undefined : { harness };
|
|
32474
|
+
}
|
|
32419
32475
|
function convertEngineConfig(raw, options = {}) {
|
|
32420
32476
|
const out = structuredClone(raw);
|
|
32421
32477
|
const engines = asDict(out.engines);
|
|
@@ -32438,7 +32494,8 @@ function convertEngineConfig(raw, options = {}) {
|
|
|
32438
32494
|
written: { connections: asDict(out.connections), harnesses: asDict(out.harnesses) },
|
|
32439
32495
|
inherited: { connections: options.inherited?.connections ?? {}, harnesses: options.inherited?.harnesses ?? {} },
|
|
32440
32496
|
renamed: {
|
|
32441
|
-
runtime: [...converted.runtimes.values()].filter((name) =>
|
|
32497
|
+
runtime: [...converted.runtimes.values()].filter((name) => (name in converted.connections)).map((name) => naming.connectionName(name)),
|
|
32498
|
+
sdkHarness: [...converted.sdkHarnesses].map((name) => naming.harnessName(name)),
|
|
32442
32499
|
connection: (engine) => (engine in converted.connections) ? naming.connectionName(engine) : undefined
|
|
32443
32500
|
}
|
|
32444
32501
|
});
|
|
@@ -32448,7 +32505,8 @@ function convertEngineConfig(raw, options = {}) {
|
|
|
32448
32505
|
if (isRecord(improve))
|
|
32449
32506
|
moveStrategyExecution(improve, conversion, retarget);
|
|
32450
32507
|
improveStrategyDefault(out, defaults, improve);
|
|
32451
|
-
|
|
32508
|
+
const judge = modelWorkTarget(defaults, naming, merged, options.inherited, conversion);
|
|
32509
|
+
dropJudgeEngine(out, conversion, naming.target, naming.defaultEngine, judge);
|
|
32452
32510
|
convertIndexEngines(out, conversion, retarget);
|
|
32453
32511
|
const config2 = {};
|
|
32454
32512
|
let placed = false;
|
|
@@ -32479,7 +32537,7 @@ function convertEngineConfig(raw, options = {}) {
|
|
|
32479
32537
|
targets
|
|
32480
32538
|
};
|
|
32481
32539
|
}
|
|
32482
|
-
var LLM_ENGINE_KEYS, AGENT_ENGINE_KEYS, CARRIED;
|
|
32540
|
+
var LLM_ENGINE_KEYS, AGENT_ENGINE_KEYS, CARRIED, defaultName = (entries) => ("default" in entries) ? "default" : Object.keys(entries).length === 1 ? Object.keys(entries)[0] : undefined, IMPLICIT_AGENT_ENGINE = "opencode-sdk";
|
|
32483
32541
|
var init_convert_engines = __esm(() => {
|
|
32484
32542
|
init_common();
|
|
32485
32543
|
init_convert_engine_references();
|
|
@@ -34568,6 +34626,27 @@ function isMarkdownFenceClosing(line, fence) {
|
|
|
34568
34626
|
return false;
|
|
34569
34627
|
return /^[\t ]*$/.test(line.slice(cursor));
|
|
34570
34628
|
}
|
|
34629
|
+
function fencedCodeIdentifiers(line) {
|
|
34630
|
+
const cleaned = line.replace(/(["'`])((?:\\.|(?!\1).)*)\1(\s*:)?/g, (match, _quote, body, colon, offset) => {
|
|
34631
|
+
if (colon)
|
|
34632
|
+
return /^\s*["'`]/.test(line.slice(offset + match.length)) ? ` ${body} ` : ` ${body}: `;
|
|
34633
|
+
return /^\/[\w./-]+$/.test(body) ? ` ${body} ` : " ";
|
|
34634
|
+
}).replace(/([A-Za-z_][A-Za-z0-9_.-]*\s*[:=]\s*)((?:[Bb]earer|[Bb]asic|[Tt]oken|[Dd]igest)\s+\S+|\S+)/g, (_match, name, value) => /^[!(]*[A-Za-z_][\w$]*(?:\.[A-Za-z_][\w$]*)+[()\]}]*[,;]?$/.test(value) ? `${name} ${value}` : name).replace(/(?<![\w.-])[A-Za-z0-9+/=]{20,}(?![\w.-])/g, (run) => /[a-z]/.test(run) && /[A-Z]/.test(run) && /\d/.test(run) ? " " : run);
|
|
34635
|
+
const words = [];
|
|
34636
|
+
for (let token of cleaned.match(/--?[A-Za-z][A-Za-z0-9-]*|[A-Za-z_][A-Za-z0-9_.-]*/g) ?? []) {
|
|
34637
|
+
token = token.replace(/[.-]+$/, "");
|
|
34638
|
+
const bare = token.replace(/^-+/, "");
|
|
34639
|
+
if (bare.length < 2)
|
|
34640
|
+
continue;
|
|
34641
|
+
if (bare.length >= TOKEN_LIKE_MIN_LENGTH && /\d/.test(bare))
|
|
34642
|
+
continue;
|
|
34643
|
+
words.push(token);
|
|
34644
|
+
const parts = bare.split(/[_.-]|(?<=[a-z0-9])(?=[A-Z])/).filter((part) => part.length > 1);
|
|
34645
|
+
if (parts.length > 1)
|
|
34646
|
+
words.push(...parts);
|
|
34647
|
+
}
|
|
34648
|
+
return words.join(" ");
|
|
34649
|
+
}
|
|
34571
34650
|
function stripMarkdownHtmlComments(line, state) {
|
|
34572
34651
|
let cursor = 0;
|
|
34573
34652
|
let visible = "";
|
|
@@ -34733,6 +34812,7 @@ function projectMarkdownContent(body, truncationInfo) {
|
|
|
34733
34812
|
const innerBlock = findInnerFrontmatterBlock(lines);
|
|
34734
34813
|
const start = innerBlock && isFrontmatterShaped(lines, innerBlock) ? innerBlock.close + 1 : 0;
|
|
34735
34814
|
const projected = [];
|
|
34815
|
+
const fenced = [];
|
|
34736
34816
|
forEachVisibleMarkdownLine(lines, start, (_index, visible) => {
|
|
34737
34817
|
let trimmed = visible.trim();
|
|
34738
34818
|
if (!trimmed || /^(-{3,}|\*{3,}|_{3,}|=+)$/.test(trimmed))
|
|
@@ -34750,15 +34830,19 @@ function projectMarkdownContent(body, truncationInfo) {
|
|
|
34750
34830
|
trimmed = trimmed.replace(/\s+/g, " ").trim();
|
|
34751
34831
|
if (trimmed)
|
|
34752
34832
|
projected.push(trimmed);
|
|
34833
|
+
}, (_index, fencedLine) => {
|
|
34834
|
+
const identifiers = fencedCodeIdentifiers(fencedLine);
|
|
34835
|
+
if (identifiers)
|
|
34836
|
+
fenced.push(identifiers);
|
|
34753
34837
|
});
|
|
34754
|
-
const text2 = projected.join(" ").replace(/\s+/g, " ").trim();
|
|
34838
|
+
const text2 = [...projected, ...fenced].join(" ").replace(/\s+/g, " ").trim();
|
|
34755
34839
|
if (!text2)
|
|
34756
34840
|
return;
|
|
34757
34841
|
if (truncationInfo)
|
|
34758
34842
|
truncationInfo.truncated = text2.length > MARKDOWN_CONTENT_MAX_CHARS;
|
|
34759
34843
|
return truncateUnicodeSafe(text2, MARKDOWN_CONTENT_MAX_CHARS);
|
|
34760
34844
|
}
|
|
34761
|
-
function forEachVisibleMarkdownLine(lines, start, visit3) {
|
|
34845
|
+
function forEachVisibleMarkdownLine(lines, start, visit3, visitFenced) {
|
|
34762
34846
|
let fence;
|
|
34763
34847
|
const htmlComment = { inComment: false };
|
|
34764
34848
|
for (let index = start;index < lines.length; index += 1) {
|
|
@@ -34766,6 +34850,8 @@ function forEachVisibleMarkdownLine(lines, start, visit3) {
|
|
|
34766
34850
|
if (fence) {
|
|
34767
34851
|
if (isMarkdownFenceClosing(rawLine, fence))
|
|
34768
34852
|
fence = undefined;
|
|
34853
|
+
else
|
|
34854
|
+
visitFenced?.(index, rawLine);
|
|
34769
34855
|
continue;
|
|
34770
34856
|
}
|
|
34771
34857
|
const leadingFence = htmlComment.inComment ? undefined : parseMarkdownFenceOpening(rawLine);
|
|
@@ -34936,7 +35022,7 @@ function extractDirTagsFromName(name) {
|
|
|
34936
35022
|
}
|
|
34937
35023
|
return Array.from(tags);
|
|
34938
35024
|
}
|
|
34939
|
-
var SCOPE_KEYS, KNOWN_QUALITY_VALUES, warnedUnknownQualityValues, COMMENT_TAGS, MARKDOWN_CONTENT_MAX_CHARS = 1e6, MAX_MARKDOWN_LINK_NESTING = 32, markdownFragmentContentByEntry, markdownFragmentProjectionEntries;
|
|
35025
|
+
var SCOPE_KEYS, KNOWN_QUALITY_VALUES, warnedUnknownQualityValues, COMMENT_TAGS, MARKDOWN_CONTENT_MAX_CHARS = 1e6, TOKEN_LIKE_MIN_LENGTH = 20, MAX_MARKDOWN_LINK_NESTING = 32, markdownFragmentContentByEntry, markdownFragmentProjectionEntries;
|
|
34940
35026
|
var init_metadata = __esm(() => {
|
|
34941
35027
|
init_asset_ref();
|
|
34942
35028
|
init_frontmatter();
|