akm-cli 0.9.5 → 0.9.6
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 +105 -0
- package/dist/commands/env/env-cli.js +1 -2
- package/dist/commands/env/secret-cli.js +1 -5
- package/dist/commands/feedback-cli.js +0 -4
- package/dist/commands/health/checks.js +0 -32
- package/dist/commands/health/surfaces.js +2 -2
- package/dist/commands/health.js +6 -15
- package/dist/commands/improve/autonomy-gate.js +1 -1
- package/dist/commands/improve/consolidate.js +25 -26
- package/dist/commands/improve/distill.js +2 -2
- package/dist/commands/improve/extract.js +8 -1
- package/dist/commands/improve/improve.js +3 -5
- package/dist/commands/improve/locks.js +13 -5
- package/dist/commands/improve/loop-stages.js +8 -9
- package/dist/commands/improve/memory/memory-contradiction-detect.js +1 -19
- package/dist/commands/improve/outcome-loop.js +0 -6
- package/dist/commands/improve/reflect.js +20 -9
- package/dist/commands/lint/index.js +4 -6
- package/dist/commands/proposal/validators/proposal-quality-validators.js +0 -7
- package/dist/commands/sources/bundle-config-ops.js +9 -4
- package/dist/commands/sources/info.js +14 -10
- package/dist/commands/tasks/tasks.js +12 -16
- package/dist/commands/workflow-cli.js +2 -2
- package/dist/core/common.js +61 -24
- package/dist/core/config/config-io.js +2 -2
- package/dist/core/config/config-sources.js +32 -2
- package/dist/core/config/config.js +1 -1
- package/dist/core/config/schema/engines.js +9 -7
- package/dist/core/config/schema/primitives.js +0 -5
- package/dist/core/config/schema/search.js +2 -1
- package/dist/core/file-lock.js +2 -1
- package/dist/core/maintenance-barrier.js +2 -14
- package/dist/core/paths.js +0 -3
- package/dist/core/redaction.js +2 -2
- package/dist/core/spawn-env.js +8 -12
- package/dist/core/state/migrations.js +1 -12
- package/dist/core/state-db.js +9 -27
- package/dist/core/write-source.js +12 -19
- package/dist/execution/directory-identity.js +36 -10
- package/dist/indexer/graph/graph-boost.js +0 -4
- package/dist/indexer/index-writer-lock.js +43 -24
- package/dist/indexer/index-written-assets.js +5 -6
- package/dist/indexer/indexer.js +2 -39
- package/dist/indexer/materialize-embeddings.js +85 -41
- package/dist/indexer/search/db-search.js +15 -48
- package/dist/indexer/search/ranking-contributors.js +0 -25
- package/dist/indexer/search/ranking.js +3 -13
- package/dist/integrations/agent/builder-shared.js +0 -25
- package/dist/integrations/agent/model-map.js +2 -60
- package/dist/integrations/harnesses/aider/agent-builder.js +1 -3
- package/dist/integrations/harnesses/amazonq/agent-builder.js +2 -7
- package/dist/integrations/harnesses/claude/agent-builder.js +1 -4
- package/dist/integrations/harnesses/codex/agent-builder.js +1 -4
- package/dist/integrations/harnesses/copilot/agent-builder.js +2 -6
- package/dist/integrations/harnesses/gemini/agent-builder.js +2 -7
- package/dist/integrations/harnesses/opencode/agent-builder.js +1 -4
- package/dist/integrations/harnesses/opencode-sdk/sdk-runner.js +2 -16
- package/dist/integrations/harnesses/openhands/agent-builder.js +1 -3
- package/dist/integrations/harnesses/pi/agent-builder.js +2 -4
- package/dist/integrations/session-logs/index.js +0 -9
- package/dist/llm/client.js +75 -42
- package/dist/llm/embedder.js +7 -3
- package/dist/llm/embedders/remote.js +141 -42
- package/dist/registry/network.js +5 -37
- package/dist/runtime.js +2 -10
- package/dist/scripts/akm-migrate-node.js +60 -126
- package/dist/scripts/akm-migrate.js +60 -126
- package/dist/setup/engine-config.js +2 -5
- package/dist/setup/registry-stash-loader.js +0 -8
- package/dist/setup/setup.js +9 -46
- package/dist/setup/steps/connection-shared.js +10 -13
- package/dist/sources/providers/git-install.js +1 -1
- package/dist/storage/engines/sqlite-migrations.js +20 -1
- package/dist/storage/repositories/index-entries-repository.js +0 -15
- package/dist/tasks/backends/launchd.js +15 -20
- package/dist/tasks/backends/schtasks.js +18 -8
- package/dist/tasks/run/run-native-task.js +8 -6
- package/dist/tasks/source/bounded-document.js +2 -4
- package/dist/tasks/source/task-source-v3-frozen.js +5 -7
- package/dist/tasks/source/task-source-v4.js +5 -10
- package/dist/tasks/source/task-to-v3.js +5 -10
- package/dist/tasks/source/task-to-v4.js +1 -4
- package/dist/tasks/source-v3.js +6 -6
- package/dist/workflows/exec/native-executor.js +21 -31
- package/dist/workflows/exec/run-workflow.js +5 -6
- package/dist/workflows/exec/scheduler.js +3 -19
- package/dist/workflows/exec/step-work.js +1 -4
- package/dist/workflows/exec/unit-dispatch.js +2 -2
- package/dist/workflows/exec/worktree.js +1 -13
- package/dist/workflows/freeze/targets/child-workflow.js +2 -10
- package/dist/workflows/ir/plan-hash.js +4 -6
- package/dist/workflows/ir/schema-v4.js +0 -12
- package/dist/workflows/ir/schema.js +20 -31
- package/dist/workflows/parser.js +11 -52
- package/dist/workflows/renderer.js +2 -3
- package/dist/workflows/resource-limits.js +11 -41
- package/dist/workflows/runtime/runs.js +3 -4
- package/dist/workflows/source-ir/schema.js +14 -30
- package/dist/workflows/validator.js +1 -7
- package/docs/reference/configuration.md +1 -1
- package/package.json +1 -1
- package/schemas/akm-config.json +4 -23
- package/schemas/akm-task.json +1 -2
- package/schemas/akm-workflow.json +1 -13
- package/dist/indexer/search/semantic-status.js +0 -142
|
@@ -1,142 +0,0 @@
|
|
|
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
|
-
import fs from "node:fs";
|
|
5
|
-
import { writeFileAtomic } from "../../core/common.js";
|
|
6
|
-
import { getCacheDir, getSemanticStatusPath } from "../../core/paths.js";
|
|
7
|
-
import { DETERMINISTIC_EMBED_MODEL_ID, isDeterministicEmbedEnabled } from "../../llm/embedders/deterministic.js";
|
|
8
|
-
import { DEFAULT_LOCAL_MODEL } from "../../llm/embedders/local.js";
|
|
9
|
-
let semanticStatusMutationForTests;
|
|
10
|
-
/** TEST-ONLY. Inject a semantic-status filesystem publication fault. */
|
|
11
|
-
export function _setSemanticStatusMutationForTests(mutation) {
|
|
12
|
-
semanticStatusMutationForTests = mutation;
|
|
13
|
-
}
|
|
14
|
-
export function deriveSemanticProviderFingerprint(embedding) {
|
|
15
|
-
if (isDeterministicEmbedEnabled()) {
|
|
16
|
-
return `deterministic:${DETERMINISTIC_EMBED_MODEL_ID}`;
|
|
17
|
-
}
|
|
18
|
-
if (embedding?.endpoint) {
|
|
19
|
-
// Fingerprint keys on vector identity only (model + dimension). The endpoint
|
|
20
|
-
// is transport/routing and has no bearing on vector compatibility, so moving
|
|
21
|
-
// the same model+dimension to a different host must not force a full re-embed.
|
|
22
|
-
return `remote:${embedding.model}|${embedding.dimension ?? "default"}`;
|
|
23
|
-
}
|
|
24
|
-
return `local:${embedding?.localModel ?? DEFAULT_LOCAL_MODEL}`;
|
|
25
|
-
}
|
|
26
|
-
export function readSemanticStatus() {
|
|
27
|
-
try {
|
|
28
|
-
const raw = JSON.parse(fs.readFileSync(getSemanticStatusPath(), "utf8"));
|
|
29
|
-
if ((raw.status === "pending" ||
|
|
30
|
-
raw.status === "ready-js" ||
|
|
31
|
-
raw.status === "ready-vec" ||
|
|
32
|
-
raw.status === "blocked") &&
|
|
33
|
-
typeof raw.providerFingerprint === "string" &&
|
|
34
|
-
typeof raw.lastCheckedAt === "string") {
|
|
35
|
-
const status = {
|
|
36
|
-
status: raw.status,
|
|
37
|
-
providerFingerprint: raw.providerFingerprint,
|
|
38
|
-
lastCheckedAt: raw.lastCheckedAt,
|
|
39
|
-
};
|
|
40
|
-
if (typeof raw.reason === "string")
|
|
41
|
-
status.reason = raw.reason;
|
|
42
|
-
if (typeof raw.message === "string")
|
|
43
|
-
status.message = raw.message;
|
|
44
|
-
if (typeof raw.entryCount === "number")
|
|
45
|
-
status.entryCount = raw.entryCount;
|
|
46
|
-
if (typeof raw.embeddingCount === "number")
|
|
47
|
-
status.embeddingCount = raw.embeddingCount;
|
|
48
|
-
return status;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
catch {
|
|
52
|
-
// ignore corrupt or missing semantic status
|
|
53
|
-
}
|
|
54
|
-
return undefined;
|
|
55
|
-
}
|
|
56
|
-
export function writeSemanticStatus(status) {
|
|
57
|
-
semanticStatusMutationForTests?.("write");
|
|
58
|
-
const dir = getCacheDir();
|
|
59
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
60
|
-
writeFileAtomic(getSemanticStatusPath(), `${JSON.stringify(status, null, 2)}\n`);
|
|
61
|
-
}
|
|
62
|
-
export function clearSemanticStatus() {
|
|
63
|
-
semanticStatusMutationForTests?.("clear");
|
|
64
|
-
try {
|
|
65
|
-
fs.unlinkSync(getSemanticStatusPath());
|
|
66
|
-
}
|
|
67
|
-
catch {
|
|
68
|
-
// ignore missing file
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
/** How long a "blocked" status is retained before the system retries. 24 hours. */
|
|
72
|
-
export const BLOCKED_TTL_MS = 24 * 60 * 60 * 1000;
|
|
73
|
-
export function getEffectiveSemanticStatus(config, status = readSemanticStatus()) {
|
|
74
|
-
if (config.semanticSearchMode === "off")
|
|
75
|
-
return "disabled";
|
|
76
|
-
if (!status)
|
|
77
|
-
return "pending";
|
|
78
|
-
const fingerprint = deriveSemanticProviderFingerprint(config.embedding);
|
|
79
|
-
if (status.providerFingerprint !== fingerprint)
|
|
80
|
-
return "pending";
|
|
81
|
-
// Auto-recovery: if blocked status is older than BLOCKED_TTL_MS, treat as pending
|
|
82
|
-
// so the next index run will re-attempt semantic setup.
|
|
83
|
-
if (status.status === "blocked") {
|
|
84
|
-
const checkedAt = new Date(status.lastCheckedAt).getTime();
|
|
85
|
-
if (Number.isNaN(checkedAt) || Date.now() - checkedAt > BLOCKED_TTL_MS) {
|
|
86
|
-
return "pending";
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return status.status;
|
|
90
|
-
}
|
|
91
|
-
export function isSemanticRuntimeReady(status) {
|
|
92
|
-
return status === "ready-js" || status === "ready-vec";
|
|
93
|
-
}
|
|
94
|
-
export function classifySemanticFailure(message) {
|
|
95
|
-
const lower = message.toLowerCase();
|
|
96
|
-
if (lower.includes("401") || lower.includes("403") || lower.includes("auth") || lower.includes("unauthorized")) {
|
|
97
|
-
return "remote-auth";
|
|
98
|
-
}
|
|
99
|
-
if (lower.includes("429") || lower.includes("rate limit") || lower.includes("quota")) {
|
|
100
|
-
return "remote-rate-limit";
|
|
101
|
-
}
|
|
102
|
-
if (lower.includes("eacces") || lower.includes("permission denied")) {
|
|
103
|
-
return "permission-denied";
|
|
104
|
-
}
|
|
105
|
-
// Native library / linker errors must be checked before the generic ONNX
|
|
106
|
-
// match because Alpine/musl linker errors often contain "onnxruntime" in
|
|
107
|
-
// the library path (e.g. onnxruntime_binding.node).
|
|
108
|
-
if (lower.includes("shared library") ||
|
|
109
|
-
lower.includes("glibc") ||
|
|
110
|
-
lower.includes("musl") ||
|
|
111
|
-
lower.includes("libc.so")) {
|
|
112
|
-
return "native-lib-missing";
|
|
113
|
-
}
|
|
114
|
-
if (lower.includes("onnx") || lower.includes("onnxruntime")) {
|
|
115
|
-
return "onnx-runtime-failed";
|
|
116
|
-
}
|
|
117
|
-
if (lower.includes("404") || lower.includes("model not found") || lower.includes("bad request")) {
|
|
118
|
-
return "remote-model";
|
|
119
|
-
}
|
|
120
|
-
if (lower.includes("transformers") ||
|
|
121
|
-
lower.includes("missing-package") ||
|
|
122
|
-
lower.includes("local embedding dependency is unavailable")) {
|
|
123
|
-
return "missing-package";
|
|
124
|
-
}
|
|
125
|
-
if (lower.includes("download")) {
|
|
126
|
-
return "local-model-download";
|
|
127
|
-
}
|
|
128
|
-
if (lower.includes("dimension mismatch")) {
|
|
129
|
-
return "dimension-mismatch";
|
|
130
|
-
}
|
|
131
|
-
if (lower.includes("db") || lower.includes("sqlite") || lower.includes("cache dir")) {
|
|
132
|
-
return "db-open";
|
|
133
|
-
}
|
|
134
|
-
if (lower.includes("timeout") ||
|
|
135
|
-
lower.includes("unreachable") ||
|
|
136
|
-
lower.includes("refused") ||
|
|
137
|
-
lower.includes("network") ||
|
|
138
|
-
lower.includes("fetch")) {
|
|
139
|
-
return "remote-network";
|
|
140
|
-
}
|
|
141
|
-
return "unknown";
|
|
142
|
-
}
|