@remnic/core 9.3.693 → 9.3.694
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/dist/access-boundary.d.ts +6 -6
- package/dist/access-boundary.js +10 -8
- package/dist/access-cli.js +23 -21
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.d.ts +5 -5
- package/dist/access-http.js +13 -11
- package/dist/access-mcp.d.ts +12 -5
- package/dist/access-mcp.js +12 -10
- package/dist/access-operations.d.ts +49 -7
- package/dist/access-operations.js +39 -9
- package/dist/{access-service-DxCpgyVW.d.ts → access-service-Ceq4TdPO.d.ts} +86 -3
- package/dist/access-service.d.ts +5 -5
- package/dist/access-service.js +9 -7
- package/dist/access-surface-catalog.d.ts +5 -5
- package/dist/access-surface-catalog.js +15 -0
- package/dist/access-surface-catalog.js.map +1 -1
- package/dist/action-confidence.d.ts +1 -1
- package/dist/active-memory-bridge.d.ts +1 -1
- package/dist/active-recall.d.ts +1 -1
- package/dist/active-recall.js +1 -1
- package/dist/behavior-learner.d.ts +1 -1
- package/dist/behavior-signals.d.ts +1 -1
- package/dist/bootstrap.d.ts +4 -4
- package/dist/briefing.d.ts +1 -1
- package/dist/briefing.js +3 -3
- package/dist/buffer-surprise-report.d.ts +1 -1
- package/dist/buffer.d.ts +1 -1
- package/dist/calibration.d.ts +1 -1
- package/dist/capabilities.d.ts +1 -1
- package/dist/{catalog-BEWLjdOr.d.ts → catalog-Tkb991rg.d.ts} +1 -1
- package/dist/causal-behavior.d.ts +1 -1
- package/dist/causal-consolidation.d.ts +1 -1
- package/dist/causal-consolidation.js +4 -4
- package/dist/{chunk-ADUAF5EV.js → chunk-24FCDBJV.js} +2 -2
- package/dist/{chunk-MQTPUPLP.js → chunk-5A35EGHM.js} +806 -23
- package/dist/chunk-5A35EGHM.js.map +1 -0
- package/dist/{chunk-3VVH6ZQW.js → chunk-5S53ZBPH.js} +2 -2
- package/dist/{chunk-RHWFMBO5.js → chunk-6C4WHMKV.js} +94 -5
- package/dist/chunk-6C4WHMKV.js.map +1 -0
- package/dist/{chunk-2D27ODNX.js → chunk-B55EAZNF.js} +2 -2
- package/dist/{chunk-F7BVJ3IE.js → chunk-C5AOVGVC.js} +14 -14
- package/dist/chunk-CDOIDOTQ.js +381 -0
- package/dist/chunk-CDOIDOTQ.js.map +1 -0
- package/dist/{chunk-UOCLRM74.js → chunk-D7PQ7HZL.js} +2 -2
- package/dist/{chunk-HXNMDPHN.js → chunk-DT2ZGQT7.js} +2 -2
- package/dist/{chunk-QFG23CRE.js → chunk-EPVIBPVE.js} +2 -2
- package/dist/{chunk-THKNO6OX.js → chunk-FCH766FX.js} +19 -18
- package/dist/chunk-FCH766FX.js.map +1 -0
- package/dist/{chunk-U2OBZSGG.js → chunk-IZLNJYLX.js} +2 -2
- package/dist/{chunk-KYH53EFD.js → chunk-JIKBEDSB.js} +6 -6
- package/dist/{chunk-3BRA3N5A.js → chunk-KCRV3HVN.js} +2 -2
- package/dist/{chunk-AFWEUTMS.js → chunk-MOGFK2DU.js} +2 -2
- package/dist/{chunk-SAC5V6JT.js → chunk-MSUA4KAK.js} +2 -2
- package/dist/{chunk-VFVG4NS2.js → chunk-NXNUG7IA.js} +2 -2
- package/dist/{chunk-66HROLW5.js → chunk-P7IDNF7H.js} +2 -2
- package/dist/{chunk-FM7KLRKN.js → chunk-PILLH262.js} +2 -2
- package/dist/{chunk-UTUYAPLY.js → chunk-PNW4KKJX.js} +12 -3
- package/dist/{chunk-UTUYAPLY.js.map → chunk-PNW4KKJX.js.map} +1 -1
- package/dist/{chunk-5HGPDRQZ.js → chunk-PQP6MFPL.js} +2 -2
- package/dist/chunk-PQP6MFPL.js.map +1 -0
- package/dist/{chunk-6C2BMUZA.js → chunk-QXWQ5V24.js} +2 -2
- package/dist/{chunk-WYB44HHV.js → chunk-SJGTY2TW.js} +19 -7
- package/dist/chunk-SJGTY2TW.js.map +1 -0
- package/dist/{chunk-4IQNAOP3.js → chunk-SN5DFE34.js} +2 -2
- package/dist/{chunk-DQHZA7Y3.js → chunk-U62ZGWU7.js} +1 -1
- package/dist/chunk-U62ZGWU7.js.map +1 -0
- package/dist/{chunk-WIKNVFBS.js → chunk-UX5QTAFE.js} +2 -2
- package/dist/chunk-VQ7B2Q6M.js +112 -0
- package/dist/chunk-VQ7B2Q6M.js.map +1 -0
- package/dist/{chunk-MCV2DD6F.js → chunk-WVTNZUER.js} +2 -2
- package/dist/{chunk-ZLXGFAML.js → chunk-YI3KC2B5.js} +2 -2
- package/dist/{chunk-W4ELOUNX.js → chunk-YWYZPKK3.js} +2 -2
- package/dist/{chunk-NUZ3N445.js → chunk-YXZPKBFW.js} +3 -3
- package/dist/{chunk-GCOSQBQ2.js → chunk-ZKD3UVEO.js} +3 -3
- package/dist/{cli-DoQsv4ut.d.ts → cli-CxtZyBLl.d.ts} +3 -3
- package/dist/cli.d.ts +6 -6
- package/dist/cli.js +27 -25
- package/dist/coding/optional-coding-graph.js +7 -104
- package/dist/coding/optional-coding-graph.js.map +1 -1
- package/dist/compounding/engine.d.ts +1 -1
- package/dist/compounding/engine.js +3 -3
- package/dist/compounding/preference-consolidator.d.ts +1 -1
- package/dist/compression-optimizer.d.ts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +1 -1
- package/dist/connectors/codex-materialize-runner.d.ts +1 -1
- package/dist/connectors/codex-materialize-runner.js +3 -3
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.js +3 -3
- package/dist/consolidation-provenance-check.d.ts +1 -1
- package/dist/consolidation-undo.d.ts +1 -1
- package/dist/contradiction/index.d.ts +1 -1
- package/dist/conversation-index/backend.d.ts +1 -1
- package/dist/conversation-index/chunker.d.ts +1 -1
- package/dist/conversation-index/faiss-adapter.d.ts +1 -1
- package/dist/conversation-index/indexer.d.ts +1 -1
- package/dist/conversation-index/search.d.ts +1 -1
- package/dist/day-summary.d.ts +1 -1
- package/dist/delinearize.d.ts +1 -1
- package/dist/direct-answer-wiring.d.ts +1 -1
- package/dist/direct-answer.d.ts +1 -1
- package/dist/embedding-fallback.d.ts +1 -1
- package/dist/enrichment/index.d.ts +1 -1
- package/dist/entity-retrieval.d.ts +1 -1
- package/dist/entity-retrieval.js +3 -3
- package/dist/entity-schema.d.ts +1 -1
- package/dist/explicit-capture.d.ts +4 -4
- package/dist/extraction-judge-telemetry.d.ts +1 -1
- package/dist/extraction-judge-training.d.ts +1 -1
- package/dist/extraction-judge.d.ts +1 -1
- package/dist/extraction.d.ts +1 -1
- package/dist/fallback-llm.d.ts +1 -1
- package/dist/identity-continuity.d.ts +1 -1
- package/dist/importance.d.ts +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.js +36 -35
- package/dist/index.js.map +1 -1
- package/dist/intent.d.ts +1 -1
- package/dist/lcm/engine.d.ts +1 -1
- package/dist/lcm/index.d.ts +1 -1
- package/dist/lcm/tools.d.ts +1 -1
- package/dist/lifecycle.d.ts +1 -1
- package/dist/live-connectors-runner.d.ts +1 -1
- package/dist/local-llm.d.ts +1 -1
- package/dist/maintenance/memory-governance.d.ts +1 -1
- package/dist/maintenance/memory-governance.js +3 -3
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +3 -3
- package/dist/maintenance/rebuild-memory-projection.js +4 -4
- package/dist/mcp-memory-inspector-app.d.ts +5 -5
- package/dist/memory-action-policy.d.ts +1 -1
- package/dist/memory-cache.d.ts +1 -1
- package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
- package/dist/memory-projection-store.d.ts +1 -1
- package/dist/memory-provenance.d.ts +1 -1
- package/dist/memory-worth-outcomes.d.ts +1 -1
- package/dist/models-json.d.ts +1 -1
- package/dist/namespaces/migrate.d.ts +2 -2
- package/dist/namespaces/migrate.js +4 -4
- package/dist/namespaces/principal.d.ts +1 -1
- package/dist/namespaces/search.d.ts +1 -1
- package/dist/namespaces/storage.d.ts +2 -2
- package/dist/namespaces/storage.js +3 -3
- package/dist/native-knowledge.d.ts +1 -1
- package/dist/operator-toolkit.d.ts +1 -1
- package/dist/operator-toolkit.js +9 -9
- package/dist/orchestration/maintenance.d.ts +2 -2
- package/dist/orchestration/maintenance.js +5 -5
- package/dist/{orchestrator-CNJCYjZ1.d.ts → orchestrator-CnbxRQs8.d.ts} +3 -3
- package/dist/orchestrator.d.ts +4 -4
- package/dist/orchestrator.js +15 -15
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/policy-runtime.d.ts +1 -1
- package/dist/provenance.d.ts +1 -1
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd.d.ts +1 -1
- package/dist/recall-disclosure-escalation.d.ts +1 -1
- package/dist/recall-explain-renderer.d.ts +1 -1
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-planner-llm.d.ts +1 -1
- package/dist/recall-state.d.ts +1 -1
- package/dist/recall-tag-filter.d.ts +1 -1
- package/dist/recall-xray-cli.d.ts +1 -1
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.d.ts +1 -1
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.d.ts +1 -1
- package/dist/recall-xray.js +2 -2
- package/dist/resolve-auth-token.d.ts +1 -1
- package/dist/resume-bundles.js +2 -2
- package/dist/retrieval-agents.d.ts +1 -1
- package/dist/retrieval-tiers.d.ts +1 -1
- package/dist/routing/engine.d.ts +1 -1
- package/dist/routing/store.d.ts +1 -1
- package/dist/search/embed-helper.d.ts +1 -1
- package/dist/search/factory.d.ts +1 -1
- package/dist/search/index.d.ts +1 -1
- package/dist/search/lancedb-backend.d.ts +1 -1
- package/dist/search/meilisearch-backend.d.ts +1 -1
- package/dist/search/noop-backend.d.ts +1 -1
- package/dist/search/orama-backend.d.ts +1 -1
- package/dist/search/port.d.ts +1 -1
- package/dist/search/remote-backend.d.ts +1 -1
- package/dist/{semantic-consolidation-D5U0Mrdb.d.ts → semantic-consolidation-DXmtQ_4B.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +4 -4
- package/dist/semantic-rule-promotion.js +3 -3
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +3 -3
- package/dist/session-observer-bands.d.ts +1 -1
- package/dist/session-observer-state.d.ts +1 -1
- package/dist/shared-context/manager.d.ts +1 -1
- package/dist/signal.d.ts +1 -1
- package/dist/storage.d.ts +1 -1
- package/dist/storage.js +2 -2
- package/dist/summarizer.d.ts +1 -1
- package/dist/summary-snapshot.d.ts +1 -1
- package/dist/temporal-supersession.d.ts +1 -1
- package/dist/temporal-validity.d.ts +1 -1
- package/dist/threading.d.ts +1 -1
- package/dist/tier-migration.d.ts +1 -1
- package/dist/tier-routing.d.ts +1 -1
- package/dist/topics.d.ts +1 -1
- package/dist/transcript.d.ts +1 -1
- package/dist/{types-2NoBoRBM.d.ts → types-CEWBmjCH.d.ts} +14 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/utility-runtime.d.ts +1 -1
- package/dist/verified-recall.js +3 -3
- package/package.json +2 -2
- package/src/access-boundary.ts +17 -0
- package/src/access-http.ts +27 -3
- package/src/access-mcp.ts +99 -2
- package/src/access-operations.ts +259 -0
- package/src/access-service.ts +82 -0
- package/src/access-surface-catalog.test.ts +1 -1
- package/src/access-surface-catalog.ts +15 -0
- package/src/cli.ts +1 -0
- package/src/coding/architecture-surfaces.test.ts +2 -0
- package/src/coding/codegraph-runtime.ts +773 -0
- package/src/coding/codegraph-surfaces.test.ts +880 -0
- package/src/coding/codegraph-surfaces.ts +771 -0
- package/src/coding/coding-knowledge-config.ts +7 -0
- package/src/coding/decision-surfaces.test.ts +2 -0
- package/src/coding/session-delta-surfaces.test.ts +2 -0
- package/src/config.test.ts +2 -0
- package/src/types.ts +14 -0
- package/dist/chunk-5HGPDRQZ.js.map +0 -1
- package/dist/chunk-DQHZA7Y3.js.map +0 -1
- package/dist/chunk-JNKH2XWQ.js +0 -183
- package/dist/chunk-JNKH2XWQ.js.map +0 -1
- package/dist/chunk-MQTPUPLP.js.map +0 -1
- package/dist/chunk-RHWFMBO5.js.map +0 -1
- package/dist/chunk-THKNO6OX.js.map +0 -1
- package/dist/chunk-WYB44HHV.js.map +0 -1
- /package/dist/{chunk-ADUAF5EV.js.map → chunk-24FCDBJV.js.map} +0 -0
- /package/dist/{chunk-3VVH6ZQW.js.map → chunk-5S53ZBPH.js.map} +0 -0
- /package/dist/{chunk-2D27ODNX.js.map → chunk-B55EAZNF.js.map} +0 -0
- /package/dist/{chunk-F7BVJ3IE.js.map → chunk-C5AOVGVC.js.map} +0 -0
- /package/dist/{chunk-UOCLRM74.js.map → chunk-D7PQ7HZL.js.map} +0 -0
- /package/dist/{chunk-HXNMDPHN.js.map → chunk-DT2ZGQT7.js.map} +0 -0
- /package/dist/{chunk-QFG23CRE.js.map → chunk-EPVIBPVE.js.map} +0 -0
- /package/dist/{chunk-U2OBZSGG.js.map → chunk-IZLNJYLX.js.map} +0 -0
- /package/dist/{chunk-KYH53EFD.js.map → chunk-JIKBEDSB.js.map} +0 -0
- /package/dist/{chunk-3BRA3N5A.js.map → chunk-KCRV3HVN.js.map} +0 -0
- /package/dist/{chunk-AFWEUTMS.js.map → chunk-MOGFK2DU.js.map} +0 -0
- /package/dist/{chunk-SAC5V6JT.js.map → chunk-MSUA4KAK.js.map} +0 -0
- /package/dist/{chunk-VFVG4NS2.js.map → chunk-NXNUG7IA.js.map} +0 -0
- /package/dist/{chunk-66HROLW5.js.map → chunk-P7IDNF7H.js.map} +0 -0
- /package/dist/{chunk-FM7KLRKN.js.map → chunk-PILLH262.js.map} +0 -0
- /package/dist/{chunk-6C2BMUZA.js.map → chunk-QXWQ5V24.js.map} +0 -0
- /package/dist/{chunk-4IQNAOP3.js.map → chunk-SN5DFE34.js.map} +0 -0
- /package/dist/{chunk-WIKNVFBS.js.map → chunk-UX5QTAFE.js.map} +0 -0
- /package/dist/{chunk-MCV2DD6F.js.map → chunk-WVTNZUER.js.map} +0 -0
- /package/dist/{chunk-ZLXGFAML.js.map → chunk-YI3KC2B5.js.map} +0 -0
- /package/dist/{chunk-W4ELOUNX.js.map → chunk-YWYZPKK3.js.map} +0 -0
- /package/dist/{chunk-NUZ3N445.js.map → chunk-YXZPKBFW.js.map} +0 -0
- /package/dist/{chunk-GCOSQBQ2.js.map → chunk-ZKD3UVEO.js.map} +0 -0
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "./chunk-ARV3AUOM.js";
|
|
12
12
|
import {
|
|
13
13
|
toRecallExplainJson
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-B55EAZNF.js";
|
|
15
15
|
import {
|
|
16
16
|
applyTagFilter,
|
|
17
17
|
normalizeTags,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
} from "./chunk-FF4KLI5W.js";
|
|
47
47
|
import {
|
|
48
48
|
estimateRecallTokens
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-MOGFK2DU.js";
|
|
50
50
|
import {
|
|
51
51
|
recordObjectiveStateSnapshotsFromObservedMessages
|
|
52
52
|
} from "./chunk-BMFZLLNI.js";
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
listMemoryGovernanceRuns,
|
|
61
61
|
readMemoryGovernanceRunArtifact,
|
|
62
62
|
runMemoryGovernance
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-MSUA4KAK.js";
|
|
64
64
|
import {
|
|
65
65
|
namespaceCollectionName
|
|
66
66
|
} from "./chunk-E6BOD3UJ.js";
|
|
@@ -103,17 +103,17 @@ import {
|
|
|
103
103
|
buildBriefing,
|
|
104
104
|
parseBriefingFocus,
|
|
105
105
|
parseBriefingWindow
|
|
106
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-P7IDNF7H.js";
|
|
107
107
|
import {
|
|
108
108
|
parseEntityFile
|
|
109
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-NXNUG7IA.js";
|
|
110
110
|
import {
|
|
111
111
|
stripAttributesSuffix
|
|
112
112
|
} from "./chunk-SVOZFLIQ.js";
|
|
113
113
|
import {
|
|
114
114
|
DEFAULT_RECALL_DISCLOSURE,
|
|
115
115
|
isRecallDisclosure
|
|
116
|
-
} from "./chunk-
|
|
116
|
+
} from "./chunk-U62ZGWU7.js";
|
|
117
117
|
import {
|
|
118
118
|
normalizeProjectionPreview,
|
|
119
119
|
normalizeProjectionTags
|
|
@@ -175,7 +175,8 @@ import {
|
|
|
175
175
|
import { stat as stat2 } from "fs/promises";
|
|
176
176
|
import * as nodeFs from "fs/promises";
|
|
177
177
|
import { constants as fsConstants } from "fs";
|
|
178
|
-
import {
|
|
178
|
+
import { readdirSync, unlinkSync } from "fs";
|
|
179
|
+
import { createHash as createHash3 } from "crypto";
|
|
179
180
|
import { ZodError } from "zod";
|
|
180
181
|
|
|
181
182
|
// src/coding/decision-records.ts
|
|
@@ -1160,9 +1161,726 @@ function createArchitectureVersioningHook(enabled, maxVersionsPerPage, sidecarDi
|
|
|
1160
1161
|
};
|
|
1161
1162
|
}
|
|
1162
1163
|
|
|
1164
|
+
// src/coding/codegraph-runtime.ts
|
|
1165
|
+
import path2 from "path";
|
|
1166
|
+
import { createHash } from "crypto";
|
|
1167
|
+
var CODEGRAPH_SPECIFIER = "@remnic/coding-graph";
|
|
1168
|
+
function codegraphSurfaceVisible(config) {
|
|
1169
|
+
const ck = config.codingKnowledge;
|
|
1170
|
+
if (ck === void 0 || ck === null) return false;
|
|
1171
|
+
return ck.enabled === true && ck.codegraphTools === true;
|
|
1172
|
+
}
|
|
1173
|
+
function resolveCodegraphRoot(config, memoryDir) {
|
|
1174
|
+
const rawDir = config.codingKnowledge.codegraphDbDir.trim();
|
|
1175
|
+
const root = rawDir.length > 0 ? expandTildePath(rawDir) : path2.join(memoryDir, "codegraph");
|
|
1176
|
+
if (!path2.isAbsolute(root)) {
|
|
1177
|
+
throw new CodegraphRuntimeError(
|
|
1178
|
+
"store_error",
|
|
1179
|
+
"codegraph DB root must be an absolute path; set codingKnowledge.codegraphDbDir (or memoryDir) to an absolute path"
|
|
1180
|
+
);
|
|
1181
|
+
}
|
|
1182
|
+
return root;
|
|
1183
|
+
}
|
|
1184
|
+
function resolveCodegraphDbPath(params) {
|
|
1185
|
+
const { config, memoryDir, principal, projectId } = params;
|
|
1186
|
+
const root = resolveCodegraphRoot(config, memoryDir);
|
|
1187
|
+
const principalSafe = sanitizePathSegment(principal);
|
|
1188
|
+
const projectSafe = sanitizePathSegment(projectId);
|
|
1189
|
+
return path2.join(root, principalSafe, `${projectSafe}.sqlite`);
|
|
1190
|
+
}
|
|
1191
|
+
function sanitizePathSegment(input) {
|
|
1192
|
+
const trimmed = (input ?? "").trim();
|
|
1193
|
+
if (trimmed.length === 0) return "_";
|
|
1194
|
+
const sanitized = trimmed.replace(/[^A-Za-z0-9._:-]+/g, "_");
|
|
1195
|
+
return sanitized.replace(/^\.+/, "").replace(/[/\\]+/g, "_") || "_";
|
|
1196
|
+
}
|
|
1197
|
+
var storeCache = /* @__PURE__ */ new Map();
|
|
1198
|
+
var cachedModule;
|
|
1199
|
+
var moduleLoadPromise = null;
|
|
1200
|
+
function storeCacheKey(principalSafe, projectSafe, dbPath) {
|
|
1201
|
+
return `${principalSafe}::${projectSafe}::${dbPath}`;
|
|
1202
|
+
}
|
|
1203
|
+
async function loadCodegraphModule() {
|
|
1204
|
+
if (cachedModule !== void 0) return cachedModule;
|
|
1205
|
+
if (moduleLoadPromise === null) {
|
|
1206
|
+
moduleLoadPromise = (async () => {
|
|
1207
|
+
try {
|
|
1208
|
+
const mod = await import(CODEGRAPH_SPECIFIER);
|
|
1209
|
+
if (mod && typeof mod === "object" && mod.GraphStore && typeof mod.GraphStore.open === "function") {
|
|
1210
|
+
cachedModule = mod;
|
|
1211
|
+
return cachedModule;
|
|
1212
|
+
}
|
|
1213
|
+
cachedModule = null;
|
|
1214
|
+
return null;
|
|
1215
|
+
} catch {
|
|
1216
|
+
cachedModule = null;
|
|
1217
|
+
return null;
|
|
1218
|
+
}
|
|
1219
|
+
})();
|
|
1220
|
+
}
|
|
1221
|
+
return moduleLoadPromise;
|
|
1222
|
+
}
|
|
1223
|
+
async function getCodegraphStore(params) {
|
|
1224
|
+
const { config, memoryDir, principal, projectId, repoRoot } = params;
|
|
1225
|
+
if (!codegraphSurfaceVisible(config)) {
|
|
1226
|
+
throw new CodegraphRuntimeError(
|
|
1227
|
+
"disabled",
|
|
1228
|
+
"codegraph tools are disabled (codingKnowledge.enabled or codingKnowledge.codegraphTools is false)"
|
|
1229
|
+
);
|
|
1230
|
+
}
|
|
1231
|
+
const mod = await loadCodegraphModule();
|
|
1232
|
+
if (mod === null) {
|
|
1233
|
+
throw new CodegraphRuntimeError(
|
|
1234
|
+
"package_missing",
|
|
1235
|
+
"The @remnic/coding-graph package is not installed; install it to use codegraph tools."
|
|
1236
|
+
);
|
|
1237
|
+
}
|
|
1238
|
+
const principalSafe = sanitizePathSegment(principal);
|
|
1239
|
+
const projectSafe = sanitizePathSegment(projectId);
|
|
1240
|
+
const dbPath = resolveCodegraphDbPath({ config, memoryDir, principal, projectId });
|
|
1241
|
+
const key = storeCacheKey(principalSafe, projectSafe, dbPath);
|
|
1242
|
+
const cached = storeCache.get(key);
|
|
1243
|
+
if (cached !== void 0) {
|
|
1244
|
+
if (repoRoot !== void 0 && cached.repoRoot === void 0) {
|
|
1245
|
+
storeCache.delete(key);
|
|
1246
|
+
try {
|
|
1247
|
+
await cached.store.close();
|
|
1248
|
+
} catch {
|
|
1249
|
+
}
|
|
1250
|
+
const store2 = await mod.GraphStore.open({ dbPath, repoRoot });
|
|
1251
|
+
storeCache.set(key, { store: store2, repoRoot, openedAt: Date.now() });
|
|
1252
|
+
return store2;
|
|
1253
|
+
}
|
|
1254
|
+
if (repoRoot !== void 0 && cached.repoRoot !== void 0 && cached.repoRoot !== repoRoot) {
|
|
1255
|
+
throw new CodegraphRuntimeError(
|
|
1256
|
+
"repo_root_conflict",
|
|
1257
|
+
`codegraph store for project ${projectId} is already bound to repo root ${cached.repoRoot}; refusing to rebind to ${repoRoot}`
|
|
1258
|
+
);
|
|
1259
|
+
}
|
|
1260
|
+
return cached.store;
|
|
1261
|
+
}
|
|
1262
|
+
const store = await mod.GraphStore.open({ dbPath, repoRoot });
|
|
1263
|
+
storeCache.set(key, { store, repoRoot, openedAt: Date.now() });
|
|
1264
|
+
return store;
|
|
1265
|
+
}
|
|
1266
|
+
function listCodegraphProjects(params) {
|
|
1267
|
+
const { config, memoryDir, principal, listDir } = params;
|
|
1268
|
+
if (!codegraphSurfaceVisible(config)) return [];
|
|
1269
|
+
let root;
|
|
1270
|
+
try {
|
|
1271
|
+
root = resolveCodegraphRoot(config, memoryDir);
|
|
1272
|
+
} catch {
|
|
1273
|
+
return [];
|
|
1274
|
+
}
|
|
1275
|
+
const principalSafe = sanitizePathSegment(principal);
|
|
1276
|
+
const principalDir = path2.join(root, principalSafe);
|
|
1277
|
+
let entries;
|
|
1278
|
+
try {
|
|
1279
|
+
entries = listDir(principalDir);
|
|
1280
|
+
} catch {
|
|
1281
|
+
return [];
|
|
1282
|
+
}
|
|
1283
|
+
const projects = [];
|
|
1284
|
+
for (const entry of entries) {
|
|
1285
|
+
if (entry.endsWith(".sqlite")) {
|
|
1286
|
+
projects.push(entry.slice(0, -".sqlite".length));
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
return projects;
|
|
1290
|
+
}
|
|
1291
|
+
async function deleteCodegraphProject(params) {
|
|
1292
|
+
const { config, memoryDir, principal, projectId, confirm, removeFile } = params;
|
|
1293
|
+
if (!confirm) {
|
|
1294
|
+
throw new CodegraphRuntimeError(
|
|
1295
|
+
"confirm_required",
|
|
1296
|
+
"codegraph_delete_project requires confirm: true; destructive operations are never defaulted to proceed (rule 48)"
|
|
1297
|
+
);
|
|
1298
|
+
}
|
|
1299
|
+
if (!codegraphSurfaceVisible(config)) {
|
|
1300
|
+
throw new CodegraphRuntimeError("disabled", "codegraph tools are disabled");
|
|
1301
|
+
}
|
|
1302
|
+
const principalSafe = sanitizePathSegment(principal);
|
|
1303
|
+
const projectSafe = sanitizePathSegment(projectId);
|
|
1304
|
+
const dbPath = resolveCodegraphDbPath({ config, memoryDir, principal, projectId });
|
|
1305
|
+
const key = storeCacheKey(principalSafe, projectSafe, dbPath);
|
|
1306
|
+
const cached = storeCache.get(key);
|
|
1307
|
+
if (cached !== void 0) {
|
|
1308
|
+
storeCache.delete(key);
|
|
1309
|
+
try {
|
|
1310
|
+
await cached.store.close();
|
|
1311
|
+
} catch {
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
let deleted = false;
|
|
1315
|
+
try {
|
|
1316
|
+
removeFile(dbPath);
|
|
1317
|
+
deleted = true;
|
|
1318
|
+
} catch (err) {
|
|
1319
|
+
const code = err?.code;
|
|
1320
|
+
if (code === "ENOENT") {
|
|
1321
|
+
deleted = true;
|
|
1322
|
+
} else {
|
|
1323
|
+
deleted = false;
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
return { deleted, projectId };
|
|
1327
|
+
}
|
|
1328
|
+
function makeCodegraphRuntimeDelegates() {
|
|
1329
|
+
return {
|
|
1330
|
+
runReindex: (store, repoRoot, mode) => runCodegraphReindex({ store, repoRoot, mode }),
|
|
1331
|
+
reportIndexStatus: (store, repoRoot) => reportCodegraphIndexStatus({ store, repoRoot }),
|
|
1332
|
+
detectChanges: (store, repoRoot, head) => detectCodegraphChanges({ store, repoRoot, head }),
|
|
1333
|
+
ingestTraces: (store, traces) => ingestCodegraphTraces({ store, traces })
|
|
1334
|
+
};
|
|
1335
|
+
}
|
|
1336
|
+
async function runCodegraphReindex(params) {
|
|
1337
|
+
const mod = await loadCodegraphModule();
|
|
1338
|
+
if (mod === null) {
|
|
1339
|
+
return { ok: false, code: "package_missing", message: "The @remnic/coding-graph package is not installed." };
|
|
1340
|
+
}
|
|
1341
|
+
if (typeof mod.executeReindex !== "function" || typeof mod.defaultCodingGitInvoker !== "function") {
|
|
1342
|
+
return { ok: false, code: "runtime_unavailable", message: "executeReindex is not available in the installed @remnic/coding-graph." };
|
|
1343
|
+
}
|
|
1344
|
+
const git = mod.defaultCodingGitInvoker();
|
|
1345
|
+
let engine;
|
|
1346
|
+
try {
|
|
1347
|
+
if (typeof mod.createCodingGraphEngine !== "function") {
|
|
1348
|
+
return { ok: false, code: "engine_unavailable", message: "createCodingGraphEngine is not exported by @remnic/coding-graph." };
|
|
1349
|
+
}
|
|
1350
|
+
engine = mod.createCodingGraphEngine();
|
|
1351
|
+
} catch (err) {
|
|
1352
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
1353
|
+
return { ok: false, code: "engine_unavailable", message: `The coding-graph engine is not ready: ${msg}` };
|
|
1354
|
+
}
|
|
1355
|
+
let candidatePaths = [];
|
|
1356
|
+
try {
|
|
1357
|
+
const tracked = git.listTrackedFiles(params.repoRoot);
|
|
1358
|
+
if (tracked.ok) {
|
|
1359
|
+
candidatePaths = tracked.paths;
|
|
1360
|
+
}
|
|
1361
|
+
} catch {
|
|
1362
|
+
}
|
|
1363
|
+
try {
|
|
1364
|
+
const result = await mod.executeReindex({
|
|
1365
|
+
store: params.store,
|
|
1366
|
+
git,
|
|
1367
|
+
repoRoot: params.repoRoot,
|
|
1368
|
+
parseFile: (input) => engine.parseFile(input),
|
|
1369
|
+
candidatePaths
|
|
1370
|
+
});
|
|
1371
|
+
if (result && result.ok === true) {
|
|
1372
|
+
return { ok: true, mode: result.mode ?? "auto", filesIngested: result.filesIngested ?? 0, head: result.head ?? null };
|
|
1373
|
+
}
|
|
1374
|
+
return {
|
|
1375
|
+
ok: false,
|
|
1376
|
+
code: result?.code ?? "store_error",
|
|
1377
|
+
message: result?.message ?? "executeReindex reported a failure."
|
|
1378
|
+
};
|
|
1379
|
+
} catch (err) {
|
|
1380
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
1381
|
+
return { ok: false, code: "store_error", message: msg };
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
async function reportCodegraphIndexStatus(params) {
|
|
1385
|
+
const mod = await loadCodegraphModule();
|
|
1386
|
+
if (mod === null) {
|
|
1387
|
+
return { ok: false, code: "package_missing", message: "The @remnic/coding-graph package is not installed." };
|
|
1388
|
+
}
|
|
1389
|
+
if (typeof mod.getIndexStatus !== "function" || typeof mod.defaultCodingGitInvoker !== "function") {
|
|
1390
|
+
return { ok: false, code: "runtime_unavailable", message: "getIndexStatus is not available in the installed @remnic/coding-graph." };
|
|
1391
|
+
}
|
|
1392
|
+
const git = mod.defaultCodingGitInvoker();
|
|
1393
|
+
try {
|
|
1394
|
+
const status = mod.getIndexStatus(params.store, git, params.repoRoot);
|
|
1395
|
+
return { ok: true, status };
|
|
1396
|
+
} catch (err) {
|
|
1397
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
1398
|
+
return { ok: false, code: "store_error", message: msg };
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
async function detectCodegraphChanges(params) {
|
|
1402
|
+
const mod = await loadCodegraphModule();
|
|
1403
|
+
if (mod === null) {
|
|
1404
|
+
return { ok: false, code: "package_missing", message: "The @remnic/coding-graph package is not installed." };
|
|
1405
|
+
}
|
|
1406
|
+
if (typeof mod.computeBlastRadius !== "function") {
|
|
1407
|
+
return { ok: false, code: "runtime_unavailable", message: "computeBlastRadius is not available in the installed @remnic/coding-graph." };
|
|
1408
|
+
}
|
|
1409
|
+
let engine;
|
|
1410
|
+
try {
|
|
1411
|
+
if (typeof mod.createCodingGraphEngine !== "function") {
|
|
1412
|
+
return { ok: false, code: "engine_unavailable", message: "createCodingGraphEngine is not exported by @remnic/coding-graph." };
|
|
1413
|
+
}
|
|
1414
|
+
engine = mod.createCodingGraphEngine();
|
|
1415
|
+
} catch (err) {
|
|
1416
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
1417
|
+
return { ok: false, code: "engine_unavailable", message: `The coding-graph engine is not ready: ${msg}` };
|
|
1418
|
+
}
|
|
1419
|
+
void engine;
|
|
1420
|
+
void params;
|
|
1421
|
+
try {
|
|
1422
|
+
const result = mod.computeBlastRadius(params.store, /* @__PURE__ */ new Set());
|
|
1423
|
+
if (result && result.ok === true) {
|
|
1424
|
+
return { ok: true, affected: result.affected ?? [] };
|
|
1425
|
+
}
|
|
1426
|
+
return { ok: false, code: result?.code ?? "store_error", message: "computeBlastRadius reported a failure." };
|
|
1427
|
+
} catch (err) {
|
|
1428
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
1429
|
+
return { ok: false, code: "store_error", message: msg };
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
async function ingestCodegraphTraces(params) {
|
|
1433
|
+
if (typeof params.store.upsertEdges !== "function") {
|
|
1434
|
+
return {
|
|
1435
|
+
ok: false,
|
|
1436
|
+
code: "runtime_unavailable",
|
|
1437
|
+
message: "The installed @remnic/coding-graph does not expose upsertEdges; traces cannot be persisted."
|
|
1438
|
+
};
|
|
1439
|
+
}
|
|
1440
|
+
const edges = [];
|
|
1441
|
+
let accepted = 0;
|
|
1442
|
+
for (const trace of params.traces) {
|
|
1443
|
+
const t = trace;
|
|
1444
|
+
if (typeof t?.caller !== "string" || typeof t?.callee !== "string") {
|
|
1445
|
+
continue;
|
|
1446
|
+
}
|
|
1447
|
+
accepted += 1;
|
|
1448
|
+
edges.push({
|
|
1449
|
+
srcQualifiedName: t.caller,
|
|
1450
|
+
dstQualifiedName: t.callee,
|
|
1451
|
+
type: "HTTP_CALLS",
|
|
1452
|
+
confidence: typeof t.confidence === "number" && t.confidence >= 0 && t.confidence <= 1 ? t.confidence : 0.5,
|
|
1453
|
+
provenance: "trace"
|
|
1454
|
+
});
|
|
1455
|
+
}
|
|
1456
|
+
try {
|
|
1457
|
+
const result = await params.store.upsertEdges(edges);
|
|
1458
|
+
if (result.ok === true) {
|
|
1459
|
+
return { ok: true, accepted, persisted: result.persisted, skipped: result.skipped };
|
|
1460
|
+
}
|
|
1461
|
+
return { ok: false, code: result.code, message: "store.upsertEdges reported a failure." };
|
|
1462
|
+
} catch (err) {
|
|
1463
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
1464
|
+
return { ok: false, code: "store_error", message: msg };
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
function deriveCodegraphProjectId(repoRoot) {
|
|
1468
|
+
return `root:${createHash("sha256").update(repoRoot).digest("hex").slice(0, 16)}`;
|
|
1469
|
+
}
|
|
1470
|
+
function resolveCodegraphProjectId(params) {
|
|
1471
|
+
const { request, getCodingContext } = params;
|
|
1472
|
+
const explicit = typeof request.project === "string" ? request.project.trim() : "";
|
|
1473
|
+
if (explicit.length > 0) return explicit;
|
|
1474
|
+
const sessionKey = typeof request.sessionKey === "string" ? request.sessionKey.trim() : "";
|
|
1475
|
+
if (sessionKey.length > 0) {
|
|
1476
|
+
const cc = getCodingContext(sessionKey);
|
|
1477
|
+
if (cc !== null) return cc.projectId;
|
|
1478
|
+
}
|
|
1479
|
+
const repoRoot = typeof request.repoRoot === "string" ? request.repoRoot.trim() : "";
|
|
1480
|
+
if (repoRoot.length > 0) return deriveCodegraphProjectId(repoRoot);
|
|
1481
|
+
throw new CodegraphRuntimeError(
|
|
1482
|
+
"project_required",
|
|
1483
|
+
"codegraph: project must be supplied explicitly, via a session coding context, or alongside a repoRoot"
|
|
1484
|
+
);
|
|
1485
|
+
}
|
|
1486
|
+
var CodegraphRuntimeError = class extends Error {
|
|
1487
|
+
code;
|
|
1488
|
+
constructor(code, message) {
|
|
1489
|
+
super(message);
|
|
1490
|
+
this.name = "CodegraphRuntimeError";
|
|
1491
|
+
this.code = code;
|
|
1492
|
+
}
|
|
1493
|
+
};
|
|
1494
|
+
|
|
1495
|
+
// src/coding/codegraph-surfaces.ts
|
|
1496
|
+
var CODEGRAPH_TOOL_NAMES = [
|
|
1497
|
+
"index",
|
|
1498
|
+
"list_projects",
|
|
1499
|
+
"delete_project",
|
|
1500
|
+
"index_status",
|
|
1501
|
+
"search_graph",
|
|
1502
|
+
"trace_path",
|
|
1503
|
+
"detect_changes",
|
|
1504
|
+
"query_graph",
|
|
1505
|
+
"get_schema",
|
|
1506
|
+
"get_snippet",
|
|
1507
|
+
"get_architecture",
|
|
1508
|
+
"search_code",
|
|
1509
|
+
"manage_adr",
|
|
1510
|
+
"ingest_traces"
|
|
1511
|
+
];
|
|
1512
|
+
var TOOL_NAME_SET = new Set(CODEGRAPH_TOOL_NAMES);
|
|
1513
|
+
function isCodegraphToolName(value) {
|
|
1514
|
+
return typeof value === "string" && TOOL_NAME_SET.has(value);
|
|
1515
|
+
}
|
|
1516
|
+
var TRACE_DIRECTIONS = ["inbound", "outbound", "both"];
|
|
1517
|
+
var TRACE_DIRECTION_SET = new Set(TRACE_DIRECTIONS);
|
|
1518
|
+
var INDEX_MODES = ["auto", "full", "incremental"];
|
|
1519
|
+
var INDEX_MODE_SET = new Set(INDEX_MODES);
|
|
1520
|
+
var MANAGE_ADR_SUBCOMMANDS = DECISION_SUBCOMMANDS;
|
|
1521
|
+
async function handleCodegraphTool(request, ctx) {
|
|
1522
|
+
if (!codegraphSurfaceVisible(ctx.config)) {
|
|
1523
|
+
return disabledResponse(request.tool, "codegraph tools are disabled in config");
|
|
1524
|
+
}
|
|
1525
|
+
switch (request.tool) {
|
|
1526
|
+
case "list_projects":
|
|
1527
|
+
return handleListProjects(request, ctx);
|
|
1528
|
+
case "get_schema":
|
|
1529
|
+
return withStore(request, ctx, (store) => handleGetSchema(store, request.tool));
|
|
1530
|
+
case "search_graph":
|
|
1531
|
+
return withStore(request, ctx, (store) => handleSearchGraph(store, request, ctx));
|
|
1532
|
+
case "search_code":
|
|
1533
|
+
return withStore(request, ctx, (store) => handleSearchCode(store, request, ctx));
|
|
1534
|
+
case "trace_path":
|
|
1535
|
+
return withStore(request, ctx, (store) => handleTracePath(store, request, ctx));
|
|
1536
|
+
case "get_snippet":
|
|
1537
|
+
return withStore(request, ctx, (store) => handleGetSnippet(store, request, ctx));
|
|
1538
|
+
case "query_graph":
|
|
1539
|
+
return withStore(request, ctx, (store) => handleQueryGraph(store, request, ctx));
|
|
1540
|
+
case "index_status":
|
|
1541
|
+
return withStore(request, ctx, (store) => handleIndexStatus(store, request, ctx));
|
|
1542
|
+
case "detect_changes":
|
|
1543
|
+
return withStore(request, ctx, (store) => handleDetectChanges(store, request, ctx));
|
|
1544
|
+
case "index":
|
|
1545
|
+
return handleIndex(request, ctx);
|
|
1546
|
+
case "delete_project":
|
|
1547
|
+
return handleDeleteProject(request, ctx);
|
|
1548
|
+
case "get_architecture":
|
|
1549
|
+
return handleGetArchitecture(request, ctx);
|
|
1550
|
+
case "manage_adr":
|
|
1551
|
+
return handleManageAdr(request, ctx);
|
|
1552
|
+
case "ingest_traces":
|
|
1553
|
+
return withStore(request, ctx, (store) => handleIngestTraces(store, request, ctx));
|
|
1554
|
+
default: {
|
|
1555
|
+
const _exhaustive = request.tool;
|
|
1556
|
+
void _exhaustive;
|
|
1557
|
+
ctx.throwInputError(`unknown codegraph tool: ${request.tool}`);
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
function disabledResponse(tool, message) {
|
|
1562
|
+
return { tool, ok: false, code: "disabled", message };
|
|
1563
|
+
}
|
|
1564
|
+
async function withStore(request, ctx, fn) {
|
|
1565
|
+
let store;
|
|
1566
|
+
try {
|
|
1567
|
+
store = await ctx.resolveStore(request);
|
|
1568
|
+
} catch (err) {
|
|
1569
|
+
if (err instanceof CodegraphRuntimeError) {
|
|
1570
|
+
return { tool: request.tool, ok: false, code: err.code, message: err.message };
|
|
1571
|
+
}
|
|
1572
|
+
throw err;
|
|
1573
|
+
}
|
|
1574
|
+
return fn(store);
|
|
1575
|
+
}
|
|
1576
|
+
async function handleListProjects(request, ctx) {
|
|
1577
|
+
const projects = listCodegraphProjects({
|
|
1578
|
+
config: ctx.config,
|
|
1579
|
+
memoryDir: ctx.memoryDir,
|
|
1580
|
+
principal: ctx.principal,
|
|
1581
|
+
listDir: ctx.listDirs
|
|
1582
|
+
});
|
|
1583
|
+
return { tool: request.tool, ok: true, result: { projects } };
|
|
1584
|
+
}
|
|
1585
|
+
async function handleGetSchema(store, tool) {
|
|
1586
|
+
const stats = store.schemaStats();
|
|
1587
|
+
if (!stats.ok) {
|
|
1588
|
+
return { tool, ok: false, code: stats.code, message: "schemaStats failed" };
|
|
1589
|
+
}
|
|
1590
|
+
return { tool, ok: true, result: stats };
|
|
1591
|
+
}
|
|
1592
|
+
async function handleSearchGraph(store, request, ctx) {
|
|
1593
|
+
const query = requireString2(request.query, "query", ctx);
|
|
1594
|
+
const limit = clampPositiveInteger(request.limit, 50, "limit", ctx);
|
|
1595
|
+
const result = store.searchGraph({ namePattern: query, limit });
|
|
1596
|
+
if (!result.ok) {
|
|
1597
|
+
return { tool: request.tool, ok: false, code: result.code, message: "searchGraph failed" };
|
|
1598
|
+
}
|
|
1599
|
+
return { tool: request.tool, ok: true, result };
|
|
1600
|
+
}
|
|
1601
|
+
var SEARCH_CODE_KINDS = ["function", "class", "method"];
|
|
1602
|
+
async function handleSearchCode(store, request, ctx) {
|
|
1603
|
+
const query = requireString2(request.query, "query", ctx);
|
|
1604
|
+
const limit = clampPositiveInteger(request.limit, 50, "limit", ctx);
|
|
1605
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1606
|
+
const merged = [];
|
|
1607
|
+
for (const kind of SEARCH_CODE_KINDS) {
|
|
1608
|
+
if (merged.length >= limit) break;
|
|
1609
|
+
const result = store.searchGraph({ label: kind, namePattern: query, limit });
|
|
1610
|
+
if (!result.ok) {
|
|
1611
|
+
return { tool: request.tool, ok: false, code: result.code, message: "searchGraph failed" };
|
|
1612
|
+
}
|
|
1613
|
+
for (const hit of result.hits) {
|
|
1614
|
+
const id = typeof hit?.nodeId === "string" ? hit.nodeId : JSON.stringify(hit);
|
|
1615
|
+
if (seen.has(id)) continue;
|
|
1616
|
+
seen.add(id);
|
|
1617
|
+
merged.push(hit);
|
|
1618
|
+
if (merged.length >= limit) break;
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
return { tool: request.tool, ok: true, result: { hits: merged } };
|
|
1622
|
+
}
|
|
1623
|
+
async function handleTracePath(store, request, ctx) {
|
|
1624
|
+
const start = requireString2(request.start, "start", ctx);
|
|
1625
|
+
const direction = request.direction ?? "outbound";
|
|
1626
|
+
if (!TRACE_DIRECTION_SET.has(direction)) {
|
|
1627
|
+
ctx.throwInputError(
|
|
1628
|
+
`direction must be one of ${TRACE_DIRECTIONS.join(", ")}; got ${JSON.stringify(direction)}`
|
|
1629
|
+
);
|
|
1630
|
+
}
|
|
1631
|
+
const depth = clampPositiveInteger(request.depth ?? 2, 2, "depth", ctx);
|
|
1632
|
+
const storeDirection = direction === "outbound" ? "outgoing" : direction === "inbound" ? "incoming" : direction;
|
|
1633
|
+
const result = store.traverse({ start, direction: storeDirection, maxDepth: depth });
|
|
1634
|
+
if (!result.ok) {
|
|
1635
|
+
return { tool: request.tool, ok: false, code: result.code, message: "traverse failed" };
|
|
1636
|
+
}
|
|
1637
|
+
return { tool: request.tool, ok: true, result };
|
|
1638
|
+
}
|
|
1639
|
+
async function handleGetSnippet(store, request, ctx) {
|
|
1640
|
+
const qualifiedName = requireString2(request.qualifiedName, "qualifiedName", ctx);
|
|
1641
|
+
const result = await store.snippetFor({ qualifiedName });
|
|
1642
|
+
if (!result.ok) {
|
|
1643
|
+
return { tool: request.tool, ok: false, code: result.code, message: "snippetFor failed" };
|
|
1644
|
+
}
|
|
1645
|
+
return { tool: request.tool, ok: true, result };
|
|
1646
|
+
}
|
|
1647
|
+
async function handleQueryGraph(store, request, ctx) {
|
|
1648
|
+
if (typeof request.query === "string" && isLikelyCypher(request.query)) {
|
|
1649
|
+
ctx.throwInputError(
|
|
1650
|
+
"codegraph_query_graph does not accept Cypher text; pass a structured query via structuredQuery (issue #1554 rejection table)"
|
|
1651
|
+
);
|
|
1652
|
+
}
|
|
1653
|
+
if (request.structuredQuery === void 0) {
|
|
1654
|
+
ctx.throwInputError("codegraph_query_graph requires structuredQuery");
|
|
1655
|
+
}
|
|
1656
|
+
const result = store.searchGraph(request.structuredQuery);
|
|
1657
|
+
if (!result.ok) {
|
|
1658
|
+
return { tool: request.tool, ok: false, code: result.code, message: "searchGraph failed" };
|
|
1659
|
+
}
|
|
1660
|
+
return { tool: request.tool, ok: true, result };
|
|
1661
|
+
}
|
|
1662
|
+
async function handleIndexStatus(store, request, ctx) {
|
|
1663
|
+
const repoRoot = resolveRepoRoot(request, ctx);
|
|
1664
|
+
if (!ctx.reportIndexStatus) {
|
|
1665
|
+
return {
|
|
1666
|
+
tool: request.tool,
|
|
1667
|
+
ok: false,
|
|
1668
|
+
code: "runtime_unavailable",
|
|
1669
|
+
message: "index_status requires @remnic/coding-graph; the runtime is unavailable."
|
|
1670
|
+
};
|
|
1671
|
+
}
|
|
1672
|
+
void store;
|
|
1673
|
+
const outcome = await ctx.reportIndexStatus(store, repoRoot);
|
|
1674
|
+
if (!outcome.ok) {
|
|
1675
|
+
return { tool: request.tool, ok: false, code: outcome.code, message: outcome.message };
|
|
1676
|
+
}
|
|
1677
|
+
return { tool: request.tool, ok: true, result: outcome.status };
|
|
1678
|
+
}
|
|
1679
|
+
async function handleDetectChanges(store, request, ctx) {
|
|
1680
|
+
const head = requireString2(request.head, "head", ctx);
|
|
1681
|
+
if (!ctx.detectChanges) {
|
|
1682
|
+
return {
|
|
1683
|
+
tool: request.tool,
|
|
1684
|
+
ok: false,
|
|
1685
|
+
code: "runtime_unavailable",
|
|
1686
|
+
message: "detect_changes requires @remnic/coding-graph; the runtime is unavailable."
|
|
1687
|
+
};
|
|
1688
|
+
}
|
|
1689
|
+
const repoRoot = resolveRepoRoot(request, ctx);
|
|
1690
|
+
void store;
|
|
1691
|
+
const outcome = await ctx.detectChanges(store, repoRoot, head);
|
|
1692
|
+
if (!outcome.ok) {
|
|
1693
|
+
return { tool: request.tool, ok: false, code: outcome.code, message: outcome.message };
|
|
1694
|
+
}
|
|
1695
|
+
return { tool: request.tool, ok: true, result: { head, affected: outcome.affected } };
|
|
1696
|
+
}
|
|
1697
|
+
async function handleIndex(request, ctx) {
|
|
1698
|
+
const repoRoot = requireString2(request.repoRoot, "repoRoot", ctx);
|
|
1699
|
+
const modeRaw = request.mode ?? "auto";
|
|
1700
|
+
if (!INDEX_MODE_SET.has(modeRaw)) {
|
|
1701
|
+
ctx.throwInputError(`mode must be one of ${INDEX_MODES.join(", ")}; got ${JSON.stringify(modeRaw)}`);
|
|
1702
|
+
}
|
|
1703
|
+
const resolveReq = { ...request, repoRoot };
|
|
1704
|
+
let store;
|
|
1705
|
+
try {
|
|
1706
|
+
store = await ctx.resolveStore(resolveReq);
|
|
1707
|
+
} catch (err) {
|
|
1708
|
+
if (err instanceof CodegraphRuntimeError) {
|
|
1709
|
+
return { tool: request.tool, ok: false, code: err.code, message: err.message };
|
|
1710
|
+
}
|
|
1711
|
+
throw err;
|
|
1712
|
+
}
|
|
1713
|
+
if (!ctx.runReindex) {
|
|
1714
|
+
return {
|
|
1715
|
+
tool: request.tool,
|
|
1716
|
+
ok: false,
|
|
1717
|
+
code: "runtime_unavailable",
|
|
1718
|
+
message: "index requires @remnic/coding-graph's reindex executor; the runtime is unavailable."
|
|
1719
|
+
};
|
|
1720
|
+
}
|
|
1721
|
+
const outcome = await ctx.runReindex(store, repoRoot, modeRaw);
|
|
1722
|
+
if (!outcome.ok) {
|
|
1723
|
+
return { tool: request.tool, ok: false, code: outcome.code, message: outcome.message };
|
|
1724
|
+
}
|
|
1725
|
+
const stats = store.schemaStats();
|
|
1726
|
+
return {
|
|
1727
|
+
tool: request.tool,
|
|
1728
|
+
ok: true,
|
|
1729
|
+
result: {
|
|
1730
|
+
repoRoot,
|
|
1731
|
+
mode: outcome.mode,
|
|
1732
|
+
filesIngested: outcome.filesIngested,
|
|
1733
|
+
head: outcome.head,
|
|
1734
|
+
stats
|
|
1735
|
+
}
|
|
1736
|
+
};
|
|
1737
|
+
}
|
|
1738
|
+
async function handleDeleteProject(request, ctx) {
|
|
1739
|
+
const projectId = resolveProjectId(request, ctx);
|
|
1740
|
+
if (request.confirm !== true) {
|
|
1741
|
+
return {
|
|
1742
|
+
tool: request.tool,
|
|
1743
|
+
ok: false,
|
|
1744
|
+
code: "confirm_required",
|
|
1745
|
+
message: "codegraph_delete_project requires confirm: true (rule 48)"
|
|
1746
|
+
};
|
|
1747
|
+
}
|
|
1748
|
+
try {
|
|
1749
|
+
const result = await deleteCodegraphProject({
|
|
1750
|
+
config: ctx.config,
|
|
1751
|
+
memoryDir: ctx.memoryDir,
|
|
1752
|
+
principal: ctx.principal,
|
|
1753
|
+
projectId,
|
|
1754
|
+
confirm: true,
|
|
1755
|
+
removeFile: ctx.removeFile
|
|
1756
|
+
});
|
|
1757
|
+
return { tool: request.tool, ok: true, result };
|
|
1758
|
+
} catch (err) {
|
|
1759
|
+
if (err instanceof CodegraphRuntimeError) {
|
|
1760
|
+
return { tool: request.tool, ok: false, code: err.code, message: err.message };
|
|
1761
|
+
}
|
|
1762
|
+
throw err;
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
async function handleGetArchitecture(request, ctx) {
|
|
1766
|
+
const codingContext = resolveCodingContext(request, ctx);
|
|
1767
|
+
const repoRoot = request.repoRoot ?? codingContext.rootPath;
|
|
1768
|
+
const card = await ctx.buildArchitectureCard(repoRoot);
|
|
1769
|
+
let stats;
|
|
1770
|
+
try {
|
|
1771
|
+
const store = await ctx.resolveStore(request);
|
|
1772
|
+
stats = store.schemaStats();
|
|
1773
|
+
} catch (err) {
|
|
1774
|
+
if (err instanceof CodegraphRuntimeError) {
|
|
1775
|
+
stats = { ok: false, code: err.code };
|
|
1776
|
+
} else {
|
|
1777
|
+
throw err;
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
return {
|
|
1781
|
+
tool: request.tool,
|
|
1782
|
+
ok: true,
|
|
1783
|
+
result: { card, graphStats: stats }
|
|
1784
|
+
};
|
|
1785
|
+
}
|
|
1786
|
+
async function handleManageAdr(request, ctx) {
|
|
1787
|
+
const subcommand = request.subcommand;
|
|
1788
|
+
if (typeof subcommand !== "string" || !MANAGE_ADR_SUBCOMMANDS.includes(subcommand)) {
|
|
1789
|
+
ctx.throwInputError(
|
|
1790
|
+
`manage_adr subcommand must be one of ${MANAGE_ADR_SUBCOMMANDS.join(", ")}; got ${JSON.stringify(subcommand)}`
|
|
1791
|
+
);
|
|
1792
|
+
}
|
|
1793
|
+
const codingContext = resolveCodingContext(request, ctx);
|
|
1794
|
+
if (!isDecisionRecordSurfaceEnabled(ctx.config.codingKnowledge, codingContext)) {
|
|
1795
|
+
return disabledResponse(
|
|
1796
|
+
request.tool,
|
|
1797
|
+
"manage_adr requires codingKnowledge.enabled + decisionRecords + an attached coding context"
|
|
1798
|
+
);
|
|
1799
|
+
}
|
|
1800
|
+
const decisionRequest = {
|
|
1801
|
+
subcommand,
|
|
1802
|
+
sessionKey: request.sessionKey,
|
|
1803
|
+
id: request.id,
|
|
1804
|
+
title: request.title,
|
|
1805
|
+
status: request.status,
|
|
1806
|
+
context: request.context,
|
|
1807
|
+
decision: request.decision,
|
|
1808
|
+
consequences: request.consequences,
|
|
1809
|
+
entityRefs: request.entityRefs,
|
|
1810
|
+
supersedesId: request.supersedesId
|
|
1811
|
+
};
|
|
1812
|
+
const result = await ctx.delegateDecisionRecord(decisionRequest);
|
|
1813
|
+
return { tool: request.tool, ok: true, result };
|
|
1814
|
+
}
|
|
1815
|
+
async function handleIngestTraces(store, request, ctx) {
|
|
1816
|
+
if (!Array.isArray(request.traces)) {
|
|
1817
|
+
ctx.throwInputError("codegraph_ingest_traces requires traces: an array of call-site observations");
|
|
1818
|
+
}
|
|
1819
|
+
if (!ctx.ingestTraces) {
|
|
1820
|
+
return {
|
|
1821
|
+
tool: request.tool,
|
|
1822
|
+
ok: false,
|
|
1823
|
+
code: "runtime_unavailable",
|
|
1824
|
+
message: "ingest_traces requires @remnic/coding-graph's store write path; the runtime is unavailable."
|
|
1825
|
+
};
|
|
1826
|
+
}
|
|
1827
|
+
const outcome = await ctx.ingestTraces(store, request.traces);
|
|
1828
|
+
if (!outcome.ok) {
|
|
1829
|
+
return { tool: request.tool, ok: false, code: outcome.code, message: outcome.message };
|
|
1830
|
+
}
|
|
1831
|
+
return {
|
|
1832
|
+
tool: request.tool,
|
|
1833
|
+
ok: true,
|
|
1834
|
+
result: {
|
|
1835
|
+
accepted: outcome.accepted,
|
|
1836
|
+
persisted: outcome.persisted
|
|
1837
|
+
}
|
|
1838
|
+
};
|
|
1839
|
+
}
|
|
1840
|
+
function requireString2(value, field, ctx) {
|
|
1841
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
1842
|
+
ctx.throwInputError(`codegraph: ${field} is required and must be a non-empty string`);
|
|
1843
|
+
}
|
|
1844
|
+
return value;
|
|
1845
|
+
}
|
|
1846
|
+
function clampPositiveInteger(value, defaultValue, field, ctx) {
|
|
1847
|
+
if (value === void 0) return defaultValue;
|
|
1848
|
+
if (typeof value !== "number" || !Number.isFinite(value) || !Number.isInteger(value) || value < 1) {
|
|
1849
|
+
ctx.throwInputError(`codegraph: ${field} must be a positive integer; got ${JSON.stringify(value)}`);
|
|
1850
|
+
}
|
|
1851
|
+
return Math.min(value, 200);
|
|
1852
|
+
}
|
|
1853
|
+
function resolveCodingContext(request, ctx) {
|
|
1854
|
+
if (!request.sessionKey) {
|
|
1855
|
+
ctx.throwInputError("codegraph tool requires a sessionKey with an attached coding context");
|
|
1856
|
+
}
|
|
1857
|
+
const codingContext = ctx.getCodingContext(request.sessionKey);
|
|
1858
|
+
if (codingContext === null) {
|
|
1859
|
+
ctx.throwInputError(
|
|
1860
|
+
`no coding context attached to session ${request.sessionKey}; attach one via set_coding_context first`
|
|
1861
|
+
);
|
|
1862
|
+
}
|
|
1863
|
+
return codingContext;
|
|
1864
|
+
}
|
|
1865
|
+
function resolveProjectId(request, ctx) {
|
|
1866
|
+
if (typeof request.project === "string" && request.project.trim().length > 0) {
|
|
1867
|
+
return request.project.trim();
|
|
1868
|
+
}
|
|
1869
|
+
return resolveCodingContext(request, ctx).projectId;
|
|
1870
|
+
}
|
|
1871
|
+
function resolveRepoRoot(request, ctx) {
|
|
1872
|
+
if (typeof request.repoRoot === "string" && request.repoRoot.trim().length > 0) {
|
|
1873
|
+
return request.repoRoot.trim();
|
|
1874
|
+
}
|
|
1875
|
+
return resolveCodingContext(request, ctx).rootPath;
|
|
1876
|
+
}
|
|
1877
|
+
function isLikelyCypher(input) {
|
|
1878
|
+
return /^\s*(MATCH|RETURN|WHERE|CREATE|MERGE|DELETE|WITH|OPTIONAL|CALL|YIELD|UNWIND)\b/i.test(input);
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1163
1881
|
// src/coding/session-delta.ts
|
|
1164
1882
|
import { readFile as readFile2, writeFile, mkdir, rename } from "fs/promises";
|
|
1165
|
-
import
|
|
1883
|
+
import path3 from "path";
|
|
1166
1884
|
var MAX_DELTA_COMMITS = 20;
|
|
1167
1885
|
var MAX_DELTA_FILES = 50;
|
|
1168
1886
|
function computeSessionDelta(lastSeen, current) {
|
|
@@ -1215,10 +1933,10 @@ function formatSinceDate(iso) {
|
|
|
1215
1933
|
const match = /^(\d{4}-\d{2}-\d{2})/.exec(iso);
|
|
1216
1934
|
return match ? match[1] : iso;
|
|
1217
1935
|
}
|
|
1218
|
-
var CODING_KNOWLEDGE_STATE_DIR =
|
|
1936
|
+
var CODING_KNOWLEDGE_STATE_DIR = path3.join("state", "coding-knowledge");
|
|
1219
1937
|
function sessionDeltaStatePath(memoryDir, namespace) {
|
|
1220
1938
|
const safe = sanitizeFragment(namespace) || "default";
|
|
1221
|
-
return
|
|
1939
|
+
return path3.join(memoryDir, CODING_KNOWLEDGE_STATE_DIR, `${safe}.json`);
|
|
1222
1940
|
}
|
|
1223
1941
|
async function readLastSeenState(statePath) {
|
|
1224
1942
|
try {
|
|
@@ -1240,7 +1958,7 @@ async function writeLastSeenState(statePath, state) {
|
|
|
1240
1958
|
`writeLastSeenState: invalid state (head=${JSON.stringify(state.head)}, at=${JSON.stringify(state.at)})`
|
|
1241
1959
|
);
|
|
1242
1960
|
}
|
|
1243
|
-
const dir =
|
|
1961
|
+
const dir = path3.dirname(statePath);
|
|
1244
1962
|
await mkdir(dir, { recursive: true });
|
|
1245
1963
|
const tmp = `${statePath}.tmp-${process.pid}-${Date.now()}`;
|
|
1246
1964
|
await writeFile(tmp, JSON.stringify(state, null, 2), "utf8");
|
|
@@ -1402,9 +2120,9 @@ async function deltaGet(request, ctx, codingContext) {
|
|
|
1402
2120
|
}
|
|
1403
2121
|
|
|
1404
2122
|
// src/procedural/procedure-miner.ts
|
|
1405
|
-
import { createHash } from "crypto";
|
|
2123
|
+
import { createHash as createHash2 } from "crypto";
|
|
1406
2124
|
import { mkdir as mkdir2, rm, stat } from "fs/promises";
|
|
1407
|
-
import
|
|
2125
|
+
import path4 from "path";
|
|
1408
2126
|
var PROCEDURE_CLUSTER_ATTR_MAX = 500;
|
|
1409
2127
|
var PROCEDURE_CLUSTER_LOCK_STALE_MS = 12e4;
|
|
1410
2128
|
var PROCEDURE_CLUSTER_LOCK_TIMEOUT_MS = 3e4;
|
|
@@ -1415,7 +2133,7 @@ function clusterKey(record) {
|
|
|
1415
2133
|
return `${goal}|${refs.join(",")}`;
|
|
1416
2134
|
}
|
|
1417
2135
|
function clusterKeyHash(cluster) {
|
|
1418
|
-
return
|
|
2136
|
+
return createHash2("sha256").update(cluster).digest("hex");
|
|
1419
2137
|
}
|
|
1420
2138
|
function isErrnoCode(error, code) {
|
|
1421
2139
|
return typeof error === "object" && error !== null && "code" in error && error.code === code;
|
|
@@ -1424,8 +2142,8 @@ function sleep(ms) {
|
|
|
1424
2142
|
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
1425
2143
|
}
|
|
1426
2144
|
async function acquireClusterWriteLock(memoryDir, clusterHash) {
|
|
1427
|
-
const lockRoot =
|
|
1428
|
-
const lockDir =
|
|
2145
|
+
const lockRoot = path4.join(path4.resolve(memoryDir), "state", "procedure-miner-locks");
|
|
2146
|
+
const lockDir = path4.join(lockRoot, `${clusterHash}.lock`);
|
|
1429
2147
|
await mkdir2(lockRoot, { recursive: true });
|
|
1430
2148
|
const startedAt = Date.now();
|
|
1431
2149
|
let attempts = 0;
|
|
@@ -1456,7 +2174,7 @@ async function acquireClusterWriteLock(memoryDir, clusterHash) {
|
|
|
1456
2174
|
}
|
|
1457
2175
|
}
|
|
1458
2176
|
async function withClusterWriteLock(memoryDir, clusterHash, fn) {
|
|
1459
|
-
const inProcessKey = `${
|
|
2177
|
+
const inProcessKey = `${path4.resolve(memoryDir)}:${clusterHash}`;
|
|
1460
2178
|
const previous = inProcessClusterWriteLocks.get(inProcessKey) ?? Promise.resolve();
|
|
1461
2179
|
let releaseInProcess;
|
|
1462
2180
|
const current = previous.catch(() => void 0).then(
|
|
@@ -2404,7 +3122,7 @@ var EngramAccessService = class {
|
|
|
2404
3122
|
const snapshotForSerialization = {
|
|
2405
3123
|
sessionKey: options.sessionKey ?? "",
|
|
2406
3124
|
recordedAt: new Date(options.snapshot.capturedAt).toISOString(),
|
|
2407
|
-
queryHash:
|
|
3125
|
+
queryHash: createHash3("sha256").update(options.query).digest("hex"),
|
|
2408
3126
|
queryLen: options.query.length,
|
|
2409
3127
|
memoryIds,
|
|
2410
3128
|
namespace,
|
|
@@ -4013,6 +4731,62 @@ var EngramAccessService = class {
|
|
|
4013
4731
|
memory: this.serializeMemory(memory)
|
|
4014
4732
|
};
|
|
4015
4733
|
}
|
|
4734
|
+
/**
|
|
4735
|
+
* Codegraph parity tool delegate (issue #1554). All three surfaces (MCP,
|
|
4736
|
+
* HTTP, CLI) arrive here via the codegraph_* boundary operations. The
|
|
4737
|
+
* handler lives in coding/codegraph-surfaces.ts; this method just wires
|
|
4738
|
+
* the context. Memory dir + principal + coding-context lookup come from
|
|
4739
|
+
* the orchestrator/access-service fabric -- no handler-side state.
|
|
4740
|
+
*/
|
|
4741
|
+
async codegraphTool(request, authenticatedPrincipal) {
|
|
4742
|
+
const principal = authenticatedPrincipal ?? "default";
|
|
4743
|
+
const memoryDir = this.orchestrator.config.memoryDir;
|
|
4744
|
+
const ctx = {
|
|
4745
|
+
config: this.orchestrator.config,
|
|
4746
|
+
memoryDir,
|
|
4747
|
+
principal,
|
|
4748
|
+
getCodingContext: (sk) => this.orchestrator.getCodingContextForSession(sk),
|
|
4749
|
+
// Project resolution chokepoint lives in codegraph-runtime.ts so every
|
|
4750
|
+
// store-backed tool derives the same id and the tagged error flows back
|
|
4751
|
+
// as a structured response (issue #1554 threads 7/9/11). Thin wiring.
|
|
4752
|
+
resolveStore: async (req) => {
|
|
4753
|
+
const projectId = resolveCodegraphProjectId({
|
|
4754
|
+
request: req,
|
|
4755
|
+
getCodingContext: (sk) => this.orchestrator.getCodingContextForSession(sk)
|
|
4756
|
+
});
|
|
4757
|
+
return getCodegraphStore({
|
|
4758
|
+
config: this.orchestrator.config,
|
|
4759
|
+
memoryDir,
|
|
4760
|
+
principal,
|
|
4761
|
+
projectId,
|
|
4762
|
+
repoRoot: req.repoRoot
|
|
4763
|
+
});
|
|
4764
|
+
},
|
|
4765
|
+
listDirs: (dir) => {
|
|
4766
|
+
try {
|
|
4767
|
+
return readdirSync(dir);
|
|
4768
|
+
} catch {
|
|
4769
|
+
return [];
|
|
4770
|
+
}
|
|
4771
|
+
},
|
|
4772
|
+
removeFile: (filePath) => unlinkSync(filePath),
|
|
4773
|
+
// propagate failures → deleteCodegraphProject classifies (thread 7)
|
|
4774
|
+
throwInputError: (msg) => {
|
|
4775
|
+
throw new EngramAccessInputError(msg);
|
|
4776
|
+
},
|
|
4777
|
+
delegateDecisionRecord: async (decisionRequest) => {
|
|
4778
|
+
return this.codingDecision(decisionRequest, authenticatedPrincipal);
|
|
4779
|
+
},
|
|
4780
|
+
buildArchitectureCard: async (repoRoot) => {
|
|
4781
|
+
return buildArchitectureCard(repoRoot, {
|
|
4782
|
+
llmSummary: this.orchestrator.config.codingKnowledge?.architectureCardLlmSummary === true,
|
|
4783
|
+
summariser: createArchitectureCardSummariser(this.fallbackLlmRef ?? this.localLlmRef)
|
|
4784
|
+
});
|
|
4785
|
+
},
|
|
4786
|
+
...makeCodegraphRuntimeDelegates()
|
|
4787
|
+
};
|
|
4788
|
+
return handleCodegraphTool(request, ctx);
|
|
4789
|
+
}
|
|
4016
4790
|
/** Whether the coding_decision tool should appear in tools/list (rule 39). */
|
|
4017
4791
|
get decisionRecordSurfaceVisible() {
|
|
4018
4792
|
return this.orchestrator.config.codingKnowledge?.enabled === true && this.orchestrator.config.codingKnowledge?.decisionRecords === true;
|
|
@@ -4051,6 +4825,14 @@ var EngramAccessService = class {
|
|
|
4051
4825
|
get architectureCardSurfaceVisible() {
|
|
4052
4826
|
return this.orchestrator.config.codingKnowledge?.enabled === true && this.orchestrator.config.codingKnowledge?.architectureCard === true;
|
|
4053
4827
|
}
|
|
4828
|
+
/**
|
|
4829
|
+
* Whether the 14 codegraph parity tools should appear in tools/list
|
|
4830
|
+
* (rule 39). Config-only -- runtime availability is checked at call time.
|
|
4831
|
+
* When false the tools array is byte-identical to pre-feature.
|
|
4832
|
+
*/
|
|
4833
|
+
get codegraphSurfaceVisible() {
|
|
4834
|
+
return codegraphSurfaceVisible(this.orchestrator.config);
|
|
4835
|
+
}
|
|
4054
4836
|
/**
|
|
4055
4837
|
* Thin delegate — handler logic in coding/architecture-surfaces.ts (#1548 PR3).
|
|
4056
4838
|
* All three surfaces (MCP/HTTP/CLI) arrive here via the boundary operation.
|
|
@@ -6177,7 +6959,7 @@ ${next}`);
|
|
|
6177
6959
|
sourceSessionKey: request.sessionKey,
|
|
6178
6960
|
inputSummary: inputSummaryParts.length > 0 ? inputSummaryParts.join(" | ").slice(0, 500) : void 0,
|
|
6179
6961
|
dryRun: request.dryRun === true,
|
|
6180
|
-
promptHash: typeof request.sourcePrompt === "string" && request.sourcePrompt.length > 0 ?
|
|
6962
|
+
promptHash: typeof request.sourcePrompt === "string" && request.sourcePrompt.length > 0 ? createHash3("sha256").update(request.sourcePrompt).digest("hex") : void 0
|
|
6181
6963
|
};
|
|
6182
6964
|
const preview = this.orchestrator.previewMemoryActionEvent(event);
|
|
6183
6965
|
if (request.dryRun === true) {
|
|
@@ -6654,7 +7436,7 @@ ${next}`);
|
|
|
6654
7436
|
async offlineSyncSnapshot(options = {}) {
|
|
6655
7437
|
const resolvedNamespace = this.resolveReadableNamespace(options.namespace, options.principal);
|
|
6656
7438
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
6657
|
-
const storageHash =
|
|
7439
|
+
const storageHash = createHash3("sha256").update(storage.dir).digest("hex").slice(0, 16);
|
|
6658
7440
|
const snapshotBuilder = options.includeContent === false && options.baseFiles && options.baseFiles.length > 0 ? buildOfflineSyncSnapshotFromBase : buildOfflineSyncSnapshot;
|
|
6659
7441
|
const snapshot = await snapshotBuilder({
|
|
6660
7442
|
root: storage.dir,
|
|
@@ -6674,7 +7456,7 @@ ${next}`);
|
|
|
6674
7456
|
async offlineSyncSnapshotStream(options = {}) {
|
|
6675
7457
|
const resolvedNamespace = this.resolveReadableNamespace(options.namespace, options.principal);
|
|
6676
7458
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
6677
|
-
const storageHash =
|
|
7459
|
+
const storageHash = createHash3("sha256").update(storage.dir).digest("hex").slice(0, 16);
|
|
6678
7460
|
return {
|
|
6679
7461
|
namespace: resolvedNamespace,
|
|
6680
7462
|
format: OFFLINE_SYNC_SNAPSHOT_FORMAT,
|
|
@@ -6695,7 +7477,7 @@ ${next}`);
|
|
|
6695
7477
|
async offlineSyncFiles(options) {
|
|
6696
7478
|
const resolvedNamespace = this.resolveReadableNamespace(options.namespace, options.principal);
|
|
6697
7479
|
const storage = await this.orchestrator.getStorage(resolvedNamespace);
|
|
6698
|
-
const storageHash =
|
|
7480
|
+
const storageHash = createHash3("sha256").update(storage.dir).digest("hex").slice(0, 16);
|
|
6699
7481
|
try {
|
|
6700
7482
|
const snapshot = await buildOfflineSyncSnapshotForPaths({
|
|
6701
7483
|
root: storage.dir,
|
|
@@ -6932,6 +7714,7 @@ ${next}`);
|
|
|
6932
7714
|
|
|
6933
7715
|
export {
|
|
6934
7716
|
DECISION_SUBCOMMANDS,
|
|
7717
|
+
isCodegraphToolName,
|
|
6935
7718
|
DELTA_SUBCOMMANDS,
|
|
6936
7719
|
computeProcedureStats,
|
|
6937
7720
|
formatProcedureStatsText,
|
|
@@ -6940,4 +7723,4 @@ export {
|
|
|
6940
7723
|
shapeMemorySummary,
|
|
6941
7724
|
EngramAccessService
|
|
6942
7725
|
};
|
|
6943
|
-
//# sourceMappingURL=chunk-
|
|
7726
|
+
//# sourceMappingURL=chunk-5A35EGHM.js.map
|