@remnic/core 9.3.671 → 9.3.673
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-audit.js +2 -2
- package/dist/access-cli.js +27 -25
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.js +12 -12
- package/dist/access-mcp.js +11 -11
- package/dist/access-schema.d.ts +36 -36
- package/dist/access-schema.js +3 -3
- package/dist/access-service.js +9 -9
- package/dist/active-recall.js +3 -1
- package/dist/active-recall.js.map +1 -1
- package/dist/chunk-3BQOQYRB.js +33 -0
- package/dist/chunk-3BQOQYRB.js.map +1 -0
- package/dist/{chunk-UOBLE67F.js → chunk-3IE22DJ2.js} +4 -4
- package/dist/chunk-52LZ42LI.js +25 -0
- package/dist/chunk-52LZ42LI.js.map +1 -0
- package/dist/{chunk-CRO4LCQ6.js → chunk-7OGJQP7T.js} +5 -5
- package/dist/{chunk-23EBQ27U.js → chunk-B55KFEGS.js} +2 -2
- package/dist/{chunk-BTLNC5YM.js → chunk-GNAMDNGT.js} +5 -13
- package/dist/chunk-GNAMDNGT.js.map +1 -0
- package/dist/{chunk-KQAFEZQX.js → chunk-IPLYGWQF.js} +5 -5
- package/dist/{chunk-MLVMBV2C.js → chunk-IUZWBCJX.js} +8 -40
- package/dist/chunk-IUZWBCJX.js.map +1 -0
- package/dist/{chunk-PYTATYUV.js → chunk-ODWI5XU2.js} +2 -2
- package/dist/{chunk-F7OWUP3G.js → chunk-OG7A6AZX.js} +4 -4
- package/dist/{chunk-XS2CWEHZ.js → chunk-Q6MIDQEL.js} +2 -2
- package/dist/{chunk-UDJLF3BO.js → chunk-QLRYXOAD.js} +2 -2
- package/dist/chunk-QO3AILZN.js +89 -0
- package/dist/chunk-QO3AILZN.js.map +1 -0
- package/dist/{chunk-ZI6A7X4V.js → chunk-R37A3BEW.js} +26 -26
- package/dist/{chunk-CPVV2UEL.js → chunk-SDLJ2W7S.js} +6 -6
- package/dist/{chunk-Z4GALEO3.js → chunk-SF45RQDX.js} +3 -3
- package/dist/{chunk-LXVOZ2O6.js → chunk-T2AOOHDA.js} +2 -2
- package/dist/{chunk-7K5Q6COX.js → chunk-TVVEYCNW.js} +4 -4
- package/dist/{chunk-32RD3GIW.js → chunk-XVVEKF5I.js} +19 -19
- package/dist/{chunk-TGN4M5MB.js → chunk-ZLINDOBG.js} +4 -4
- package/dist/cli.js +24 -22
- package/dist/coding/optional-coding-graph.d.ts +63 -0
- package/dist/coding/optional-coding-graph.js +119 -0
- package/dist/coding/optional-coding-graph.js.map +1 -0
- package/dist/coding-graph-types-Dd2tGrnm.d.ts +106 -0
- package/dist/config.d.ts +1 -1
- package/dist/config.js +3 -1
- package/dist/connectors/index.d.ts +6 -2
- package/dist/connectors/index.js +6 -2
- package/dist/conversation-index/backend.js +2 -2
- package/dist/emit-legacy-tools.d.ts +61 -0
- package/dist/emit-legacy-tools.js +12 -0
- package/dist/emit-legacy-tools.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +54 -46
- package/dist/index.js.map +1 -1
- package/dist/lcm/engine.js +2 -2
- package/dist/lcm/index.js +2 -2
- package/dist/namespaces/migrate.js +5 -5
- package/dist/namespaces/search.js +4 -4
- package/dist/operator-toolkit.js +10 -8
- package/dist/orchestrator.js +16 -16
- package/dist/resume-bundles.js +4 -2
- package/dist/schemas.d.ts +42 -42
- package/dist/search/factory.js +3 -3
- package/dist/search/index.js +3 -3
- package/dist/shared-context/manager.d.ts +2 -2
- package/dist/transfer/autodetect.js +1 -1
- package/dist/transfer/backup.js +1 -1
- package/dist/transfer/capsule-export.js +2 -2
- package/package.json +19 -1
- package/src/coding/coding-graph-types.ts +180 -0
- package/src/coding/optional-coding-graph-cache.test.ts +86 -0
- package/src/coding/optional-coding-graph-cacheread.test.ts +78 -0
- package/src/coding/optional-coding-graph-concurrent.test.ts +48 -0
- package/src/coding/optional-coding-graph-incompatible.test.ts +98 -0
- package/src/coding/optional-coding-graph-probe.test.ts +34 -0
- package/src/coding/optional-coding-graph.test.ts +117 -0
- package/src/coding/optional-coding-graph.ts +370 -0
- package/src/config.test.ts +408 -6
- package/src/config.ts +12 -56
- package/src/connectors/index.ts +2 -15
- package/src/connectors/paths.ts +50 -0
- package/src/emit-legacy-tools.test.ts +297 -0
- package/src/emit-legacy-tools.ts +204 -0
- package/src/index.ts +22 -0
- package/dist/chunk-BTLNC5YM.js.map +0 -1
- package/dist/chunk-MLVMBV2C.js.map +0 -1
- /package/dist/{chunk-UOBLE67F.js.map → chunk-3IE22DJ2.js.map} +0 -0
- /package/dist/{chunk-CRO4LCQ6.js.map → chunk-7OGJQP7T.js.map} +0 -0
- /package/dist/{chunk-23EBQ27U.js.map → chunk-B55KFEGS.js.map} +0 -0
- /package/dist/{chunk-KQAFEZQX.js.map → chunk-IPLYGWQF.js.map} +0 -0
- /package/dist/{chunk-PYTATYUV.js.map → chunk-ODWI5XU2.js.map} +0 -0
- /package/dist/{chunk-F7OWUP3G.js.map → chunk-OG7A6AZX.js.map} +0 -0
- /package/dist/{chunk-XS2CWEHZ.js.map → chunk-Q6MIDQEL.js.map} +0 -0
- /package/dist/{chunk-UDJLF3BO.js.map → chunk-QLRYXOAD.js.map} +0 -0
- /package/dist/{chunk-ZI6A7X4V.js.map → chunk-R37A3BEW.js.map} +0 -0
- /package/dist/{chunk-CPVV2UEL.js.map → chunk-SDLJ2W7S.js.map} +0 -0
- /package/dist/{chunk-Z4GALEO3.js.map → chunk-SF45RQDX.js.map} +0 -0
- /package/dist/{chunk-LXVOZ2O6.js.map → chunk-T2AOOHDA.js.map} +0 -0
- /package/dist/{chunk-7K5Q6COX.js.map → chunk-TVVEYCNW.js.map} +0 -0
- /package/dist/{chunk-32RD3GIW.js.map → chunk-XVVEKF5I.js.map} +0 -0
- /package/dist/{chunk-TGN4M5MB.js.map → chunk-ZLINDOBG.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -90,11 +90,12 @@ import {
|
|
|
90
90
|
runWorkProductStatusCliCommand,
|
|
91
91
|
runWorkProjectCliCommand,
|
|
92
92
|
runWorkTaskCliCommand
|
|
93
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-XVVEKF5I.js";
|
|
94
|
+
import "./chunk-7F7Z6MOS.js";
|
|
94
95
|
import "./chunk-MC4FJXPA.js";
|
|
95
96
|
import "./chunk-LQHDIS7L.js";
|
|
96
|
-
import "./chunk-7F7Z6MOS.js";
|
|
97
97
|
import "./chunk-JJEJJ7RK.js";
|
|
98
|
+
import "./chunk-UP6MOYCB.js";
|
|
98
99
|
import "./chunk-7VFZTJ7K.js";
|
|
99
100
|
import "./chunk-HDDRVXX4.js";
|
|
100
101
|
import "./chunk-AGNBY3VG.js";
|
|
@@ -104,7 +105,6 @@ import "./chunk-2DL3OFLD.js";
|
|
|
104
105
|
import "./chunk-G4IAEX6D.js";
|
|
105
106
|
import "./chunk-2NLLXCJG.js";
|
|
106
107
|
import "./chunk-765K3SAT.js";
|
|
107
|
-
import "./chunk-UP6MOYCB.js";
|
|
108
108
|
import "./chunk-EEC4PCG5.js";
|
|
109
109
|
import "./chunk-PYIFUBRK.js";
|
|
110
110
|
import "./chunk-HOJZMQ4J.js";
|
|
@@ -121,10 +121,10 @@ import "./chunk-GQL52GQ5.js";
|
|
|
121
121
|
import "./chunk-EVWIEEKZ.js";
|
|
122
122
|
import "./chunk-3OKWZT7F.js";
|
|
123
123
|
import "./chunk-TGQ2NTWH.js";
|
|
124
|
-
import "./chunk-
|
|
124
|
+
import "./chunk-ODWI5XU2.js";
|
|
125
125
|
import "./chunk-GSTYVG5L.js";
|
|
126
|
-
import "./chunk-
|
|
127
|
-
import "./chunk-
|
|
126
|
+
import "./chunk-SDLJ2W7S.js";
|
|
127
|
+
import "./chunk-T2AOOHDA.js";
|
|
128
128
|
import "./chunk-3T74IZB3.js";
|
|
129
129
|
import "./chunk-HL4DB7TO.js";
|
|
130
130
|
import "./chunk-EZ25VE3G.js";
|
|
@@ -133,11 +133,12 @@ import "./chunk-AUDJPF4N.js";
|
|
|
133
133
|
import "./chunk-Y4Z4I6WK.js";
|
|
134
134
|
import "./chunk-6T4LTI2F.js";
|
|
135
135
|
import "./chunk-YBPYIAA5.js";
|
|
136
|
+
import "./chunk-CMTINOFS.js";
|
|
136
137
|
import "./chunk-X6IRLNOO.js";
|
|
137
138
|
import "./chunk-2PRQG7PV.js";
|
|
139
|
+
import "./chunk-NXBXM7Q6.js";
|
|
138
140
|
import "./chunk-2F6NP3NT.js";
|
|
139
141
|
import "./chunk-TERNBNJB.js";
|
|
140
|
-
import "./chunk-NXBXM7Q6.js";
|
|
141
142
|
import "./chunk-W4RVMTHR.js";
|
|
142
143
|
import "./chunk-LVTTO3VC.js";
|
|
143
144
|
import "./chunk-ZRWB5D4H.js";
|
|
@@ -147,11 +148,10 @@ import "./chunk-SFQ6QNL7.js";
|
|
|
147
148
|
import "./chunk-33JBK2XP.js";
|
|
148
149
|
import "./chunk-LZSMQHXC.js";
|
|
149
150
|
import "./chunk-KFY3SGN7.js";
|
|
150
|
-
import "./chunk-CMTINOFS.js";
|
|
151
151
|
import "./chunk-TQNRI55H.js";
|
|
152
152
|
import "./chunk-6GUG4YNM.js";
|
|
153
|
-
import "./chunk-JXS5PDQ7.js";
|
|
154
153
|
import "./chunk-AV5ZEH4M.js";
|
|
154
|
+
import "./chunk-JXS5PDQ7.js";
|
|
155
155
|
import "./chunk-AJU4PJGY.js";
|
|
156
156
|
import "./chunk-BEUDU7Y4.js";
|
|
157
157
|
import "./chunk-3PY7VHV7.js";
|
|
@@ -160,14 +160,16 @@ import "./chunk-LMDRGRJ2.js";
|
|
|
160
160
|
import "./chunk-OKTXM5H4.js";
|
|
161
161
|
import "./chunk-3UXOZBHV.js";
|
|
162
162
|
import "./chunk-UQ7RN5HK.js";
|
|
163
|
-
import "./chunk-
|
|
163
|
+
import "./chunk-IUZWBCJX.js";
|
|
164
164
|
import "./chunk-PHK3HARR.js";
|
|
165
165
|
import "./chunk-NDAH7BJ5.js";
|
|
166
166
|
import "./chunk-Z5LAYHGJ.js";
|
|
167
|
+
import "./chunk-QO3AILZN.js";
|
|
168
|
+
import "./chunk-3BQOQYRB.js";
|
|
167
169
|
import "./chunk-LBJBNWS2.js";
|
|
168
170
|
import "./chunk-HQ6NIBL6.js";
|
|
169
171
|
import "./chunk-OADWQ5CR.js";
|
|
170
|
-
import "./chunk-
|
|
172
|
+
import "./chunk-OG7A6AZX.js";
|
|
171
173
|
import "./chunk-SEDEKFYQ.js";
|
|
172
174
|
import "./chunk-JBPKEARU.js";
|
|
173
175
|
import "./chunk-TMSXWOBZ.js";
|
|
@@ -176,10 +178,10 @@ import "./chunk-RSUYKGGZ.js";
|
|
|
176
178
|
import "./chunk-42NQ7AVG.js";
|
|
177
179
|
import "./chunk-7RXCMVFQ.js";
|
|
178
180
|
import "./chunk-7WV3F5DQ.js";
|
|
179
|
-
import "./chunk-
|
|
181
|
+
import "./chunk-SF45RQDX.js";
|
|
180
182
|
import "./chunk-T4WDJPEZ.js";
|
|
181
183
|
import "./chunk-D24OXEPB.js";
|
|
182
|
-
import "./chunk-
|
|
184
|
+
import "./chunk-ZLINDOBG.js";
|
|
183
185
|
import "./chunk-GDASG7NC.js";
|
|
184
186
|
import "./chunk-GDB4J2H3.js";
|
|
185
187
|
import "./chunk-ARV3AUOM.js";
|
|
@@ -193,8 +195,8 @@ import "./chunk-RS25QOKZ.js";
|
|
|
193
195
|
import "./chunk-JGSKJHF7.js";
|
|
194
196
|
import "./chunk-FF4KLI5W.js";
|
|
195
197
|
import "./chunk-6VP3YUCS.js";
|
|
196
|
-
import "./chunk-
|
|
197
|
-
import "./chunk-
|
|
198
|
+
import "./chunk-Q6MIDQEL.js";
|
|
199
|
+
import "./chunk-B55KFEGS.js";
|
|
198
200
|
import "./chunk-OUWAQVDJ.js";
|
|
199
201
|
import "./chunk-DOCTITOP.js";
|
|
200
202
|
import "./chunk-CYEPCZN5.js";
|
|
@@ -204,10 +206,10 @@ import "./chunk-AER6MT24.js";
|
|
|
204
206
|
import "./chunk-RN7MUWON.js";
|
|
205
207
|
import "./chunk-CINZGPSJ.js";
|
|
206
208
|
import "./chunk-ZFXCQPNO.js";
|
|
207
|
-
import "./chunk-
|
|
208
|
-
import "./chunk-7DTASS5T.js";
|
|
209
|
+
import "./chunk-7OGJQP7T.js";
|
|
209
210
|
import "./chunk-E6ZDCOHM.js";
|
|
210
211
|
import "./chunk-OIF36KGD.js";
|
|
212
|
+
import "./chunk-7DTASS5T.js";
|
|
211
213
|
import "./chunk-6RHNCKHG.js";
|
|
212
214
|
import "./chunk-YNQ6DFSV.js";
|
|
213
215
|
import "./chunk-EIR5VLIH.js";
|
|
@@ -257,15 +259,15 @@ import "./chunk-2ODBA7MQ.js";
|
|
|
257
259
|
import "./chunk-PVGDJXVK.js";
|
|
258
260
|
import "./chunk-A2IYSXDQ.js";
|
|
259
261
|
import "./chunk-LPSF4OQH.js";
|
|
260
|
-
import "./chunk-
|
|
261
|
-
import "./chunk-LBLXEFWK.js";
|
|
262
|
+
import "./chunk-TVVEYCNW.js";
|
|
262
263
|
import "./chunk-RFYAYKTD.js";
|
|
264
|
+
import "./chunk-LBLXEFWK.js";
|
|
263
265
|
import "./chunk-VFUEZZBS.js";
|
|
264
|
-
import "./chunk-
|
|
265
|
-
import "./chunk-
|
|
266
|
+
import "./chunk-QLRYXOAD.js";
|
|
267
|
+
import "./chunk-IPLYGWQF.js";
|
|
268
|
+
import "./chunk-J4EB7DNW.js";
|
|
266
269
|
import "./chunk-WEHSQBFR.js";
|
|
267
270
|
import "./chunk-X7Y7WX73.js";
|
|
268
|
-
import "./chunk-J4EB7DNW.js";
|
|
269
271
|
import "./chunk-PWWWLD7D.js";
|
|
270
272
|
import "./chunk-UI3NYK34.js";
|
|
271
273
|
import "./chunk-GCGJW34D.js";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { C as CreateCodingGraphEngineOptions, a as CodingGraphEngine, b as CodingGraphLanguage, c as CodingGraphErrorCode } from '../coding-graph-types-Dd2tGrnm.js';
|
|
2
|
+
export { d as CODING_GRAPH_ENGINE_VERSION, F as FileIR, P as ParseFileInput, e as ParseResult, S as SymbolIR, T as TIER_1_LANGUAGES } from '../coding-graph-types-Dd2tGrnm.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Structural minimal shape of `@remnic/coding-graph`'s public surface,
|
|
6
|
+
* as seen by core after a successful dynamic import. We narrow to
|
|
7
|
+
* `unknown` first (since the dynamic import returns `any` at runtime)
|
|
8
|
+
* and then to this interface only after the runtime check below.
|
|
9
|
+
*/
|
|
10
|
+
interface LoadedCodingGraphModule {
|
|
11
|
+
ENGINE_VERSION: string;
|
|
12
|
+
TIER_1_LANGUAGES: readonly CodingGraphLanguage[];
|
|
13
|
+
CodingGraphError: new (code: CodingGraphErrorCode, message: string, engineVersion?: string) => Error;
|
|
14
|
+
createCodingGraphEngine: (options?: CreateCodingGraphEngineOptions) => CodingGraphEngine;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Build the user-facing install hint message. Exported so tests can assert
|
|
18
|
+
* on the exact text (CLAUDE.md rule 51 / issue #1551 prove-fail-before).
|
|
19
|
+
*/
|
|
20
|
+
declare function buildCodingGraphInstallHint(): string;
|
|
21
|
+
/**
|
|
22
|
+
* Return true when `err` is a module-not-found failure for exactly the
|
|
23
|
+
* `@remnic/coding-graph` specifier. Same boundary-aware regex as
|
|
24
|
+
* packages/remnic-cli/src/optional-module-loader.ts so transitive
|
|
25
|
+
* misses (a broken @remnic/coding-graph release) bubble up rather than
|
|
26
|
+
* being mis-reported as "run npm install".
|
|
27
|
+
*
|
|
28
|
+
* Exported for tests; the production loaders call the internal alias
|
|
29
|
+
* below.
|
|
30
|
+
*/
|
|
31
|
+
declare function isSpecifierNotFoundErrorForCodingGraph(err: unknown, specifier?: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Load `@remnic/coding-graph` if installed and return its
|
|
34
|
+
* `createCodingGraphEngine` factory. Throws a user-facing diagnostic
|
|
35
|
+
* that distinguishes three failure modes:
|
|
36
|
+
* - missing → install hint (canonical "npm install ..." message).
|
|
37
|
+
* - incompatible → "package shape mismatch" diagnostic.
|
|
38
|
+
* - broken → rethrows the original import error.
|
|
39
|
+
*
|
|
40
|
+
* Reuses the cached success path so repeated calls in the same
|
|
41
|
+
* process do not re-import. On success the resolved module is cached
|
|
42
|
+
* and shared with the try* helpers; a failure never poisons the cache
|
|
43
|
+
* so each call attempts a fresh import.
|
|
44
|
+
*/
|
|
45
|
+
declare function loadCodingGraphEngineFactory(): Promise<(options?: CreateCodingGraphEngineOptions) => CodingGraphEngine>;
|
|
46
|
+
/**
|
|
47
|
+
* Return `true` only when `@remnic/coding-graph` is installed AND
|
|
48
|
+
* importable in a usable shape. Returns `false` for missing, broken,
|
|
49
|
+
* or incompatible installs. Never throws.
|
|
50
|
+
*/
|
|
51
|
+
declare function isCodingGraphInstalled(): Promise<boolean>;
|
|
52
|
+
/**
|
|
53
|
+
* Return the engine factory module if `@remnic/coding-graph` is
|
|
54
|
+
* installed AND importable in a usable shape, or `null` otherwise.
|
|
55
|
+
* Use this for graceful-degradation code paths. Never throws.
|
|
56
|
+
*
|
|
57
|
+
* Uses an in-flight-promise slot so concurrent callers share the same
|
|
58
|
+
* import attempt, then caches the successful result so subsequent
|
|
59
|
+
* loadFactory calls skip the import.
|
|
60
|
+
*/
|
|
61
|
+
declare function tryLoadCodingGraphModule(): Promise<LoadedCodingGraphModule | null>;
|
|
62
|
+
|
|
63
|
+
export { CodingGraphEngine, CodingGraphErrorCode, CodingGraphLanguage, CreateCodingGraphEngineOptions, buildCodingGraphInstallHint, isCodingGraphInstalled, isSpecifierNotFoundErrorForCodingGraph, loadCodingGraphEngineFactory, tryLoadCodingGraphModule };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CODING_GRAPH_ENGINE_VERSION,
|
|
3
|
+
TIER_1_LANGUAGES
|
|
4
|
+
} from "../chunk-52LZ42LI.js";
|
|
5
|
+
import "../chunk-PZ5AY32C.js";
|
|
6
|
+
|
|
7
|
+
// src/coding/optional-coding-graph.ts
|
|
8
|
+
var SPECIFIER = "@remnic/coding-graph";
|
|
9
|
+
function buildCodingGraphInstallHint() {
|
|
10
|
+
return "The `@remnic/coding-graph` engine is optional and not installed in this environment.\n\nInstall it alongside @remnic/core to enable codebase-graph features:\n npm install @remnic/coding-graph\n\nOr add it to a project (pnpm / yarn):\n pnpm add @remnic/coding-graph\n yarn add @remnic/coding-graph\n";
|
|
11
|
+
}
|
|
12
|
+
function notInstalledError() {
|
|
13
|
+
return new Error(buildCodingGraphInstallHint());
|
|
14
|
+
}
|
|
15
|
+
function incompatibleModuleError(actual) {
|
|
16
|
+
const keys = actual && typeof actual === "object" ? Object.keys(actual).slice(0, 8).join(", ") || "(none)" : typeof actual;
|
|
17
|
+
return new Error(
|
|
18
|
+
`\`@remnic/coding-graph\` is present but its module shape does not match the expected contract. The installed build may be stale, broken, or from an incompatible version. Try reinstalling it (\`npm install --force @remnic/coding-graph\`) or pinning to a known working version. Detected exports: ${keys}.`
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
function isSpecifierNotFoundErrorForCodingGraph(err, specifier = SPECIFIER) {
|
|
22
|
+
if (!err || typeof err !== "object") {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
const code = err.code;
|
|
26
|
+
if (code !== "ERR_MODULE_NOT_FOUND" && code !== "MODULE_NOT_FOUND") {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
const message = err.message;
|
|
30
|
+
if (typeof message !== "string") {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
if (message.includes(`'${specifier}'`)) return true;
|
|
34
|
+
if (message.includes(`"${specifier}"`)) return true;
|
|
35
|
+
const escaped = specifier.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
36
|
+
const boundaryRegex = new RegExp(
|
|
37
|
+
`(?:^|[\\s"'\`\\(])${escaped}(?:[\\s"'\`\\)]|$)`
|
|
38
|
+
);
|
|
39
|
+
return boundaryRegex.test(message);
|
|
40
|
+
}
|
|
41
|
+
function isLoadedCodingGraphModule(value) {
|
|
42
|
+
if (!value || typeof value !== "object") return false;
|
|
43
|
+
const candidate = value;
|
|
44
|
+
return typeof candidate.createCodingGraphEngine === "function" && typeof candidate.CodingGraphError === "function" && typeof candidate.ENGINE_VERSION === "string" && Array.isArray(candidate.TIER_1_LANGUAGES);
|
|
45
|
+
}
|
|
46
|
+
async function tryImportCodingGraphModule() {
|
|
47
|
+
let mod;
|
|
48
|
+
try {
|
|
49
|
+
mod = await import(SPECIFIER);
|
|
50
|
+
} catch (err) {
|
|
51
|
+
if (isSpecifierNotFoundErrorForCodingGraph(err)) {
|
|
52
|
+
return { kind: "missing" };
|
|
53
|
+
}
|
|
54
|
+
return { kind: "broken", cause: err };
|
|
55
|
+
}
|
|
56
|
+
if (!isLoadedCodingGraphModule(mod)) {
|
|
57
|
+
return { kind: "incompatible", actual: mod };
|
|
58
|
+
}
|
|
59
|
+
return { kind: "ok", module: mod };
|
|
60
|
+
}
|
|
61
|
+
async function loadCodingGraphEngineFactory() {
|
|
62
|
+
if (cachedLoadResult !== void 0 && cachedLoadResult !== null) {
|
|
63
|
+
return cachedLoadResult.createCodingGraphEngine;
|
|
64
|
+
}
|
|
65
|
+
const outcome = await tryImportCodingGraphModule();
|
|
66
|
+
switch (outcome.kind) {
|
|
67
|
+
case "ok":
|
|
68
|
+
cachedLoadResult = outcome.module;
|
|
69
|
+
return outcome.module.createCodingGraphEngine;
|
|
70
|
+
case "missing":
|
|
71
|
+
throw notInstalledError();
|
|
72
|
+
case "incompatible":
|
|
73
|
+
throw incompatibleModuleError(outcome.actual);
|
|
74
|
+
case "broken":
|
|
75
|
+
throw outcome.cause instanceof Error ? outcome.cause : new Error(`@remnic/coding-graph failed to load: ${String(outcome.cause)}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function startProbeOnce() {
|
|
79
|
+
if (inFlightProbe !== null) {
|
|
80
|
+
return inFlightProbe;
|
|
81
|
+
}
|
|
82
|
+
const p = tryImportCodingGraphModule().then((outcome) => {
|
|
83
|
+
if (outcome.kind === "ok") {
|
|
84
|
+
cachedLoadResult = outcome.module;
|
|
85
|
+
return outcome.module;
|
|
86
|
+
}
|
|
87
|
+
return null;
|
|
88
|
+
}).catch(() => {
|
|
89
|
+
return null;
|
|
90
|
+
});
|
|
91
|
+
inFlightProbe = p;
|
|
92
|
+
p.finally(() => {
|
|
93
|
+
if (inFlightProbe === p) {
|
|
94
|
+
inFlightProbe = null;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
return p;
|
|
98
|
+
}
|
|
99
|
+
var cachedLoadResult;
|
|
100
|
+
var inFlightProbe = null;
|
|
101
|
+
async function isCodingGraphInstalled() {
|
|
102
|
+
return await tryLoadCodingGraphModule() !== null;
|
|
103
|
+
}
|
|
104
|
+
async function tryLoadCodingGraphModule() {
|
|
105
|
+
if (cachedLoadResult !== void 0 && cachedLoadResult !== null) {
|
|
106
|
+
return cachedLoadResult;
|
|
107
|
+
}
|
|
108
|
+
return startProbeOnce();
|
|
109
|
+
}
|
|
110
|
+
export {
|
|
111
|
+
CODING_GRAPH_ENGINE_VERSION,
|
|
112
|
+
TIER_1_LANGUAGES,
|
|
113
|
+
buildCodingGraphInstallHint,
|
|
114
|
+
isCodingGraphInstalled,
|
|
115
|
+
isSpecifierNotFoundErrorForCodingGraph,
|
|
116
|
+
loadCodingGraphEngineFactory,
|
|
117
|
+
tryLoadCodingGraphModule
|
|
118
|
+
};
|
|
119
|
+
//# sourceMappingURL=optional-coding-graph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/coding/optional-coding-graph.ts"],"sourcesContent":["// Lazy loader for the optional @remnic/coding-graph package.\n//\n// Remnic's core is installed à-la-carte: users who only need memory\n// features should not have to install codebase-graph tooling, so\n// @remnic/coding-graph is an optional peer dependency, not a bundled\n// dependency. Any code path that actually needs the graph engine calls\n// loadCodingGraphEngineFactory() or one of the try* helpers; the loader\n// either returns the engine factory or throws a user-facing install hint.\n//\n// Justification for the dynamic import:\n// CLAUDE.md rule 57 / AGENTS.md rule 44 require à-la-carte optional\n// workspace packages to be loaded via a *computed-specifier* dynamic\n// import. Static `import \"@remnic/coding-graph\"` would either fail the\n// base install when the optional package is absent or — worse — force\n// the bundler to bundle it into @remnic/core's dist. Concat'ing the\n// specifier from string literals keeps the dynamic import a runtime\n// call. The same pattern is canonical in\n// packages/remnic-cli/src/optional-bench.ts and\n// packages/remnic-cli/src/optional-module-loader.ts; we mirror it here\n// because core, not the CLI, owns the engine entry point.\n//\n// Type-source direction:\n// The CodingGraphEngine interface and supporting IR types live in\n// packages/remnic-core/src/coding/coding-graph-types.ts (a local\n// types-only module). They are owned by core; @remnic/coding-graph\n// imports them and implements against them. This breaks the type\n// cycle that would otherwise require core to resolve\n// @remnic/coding-graph at compile time. Core's tsup DTS phase emits\n// declarations against the package's compiled output — this would\n// fail in CI's fresh base install where the optional peer is not\n// symlinked. With the types owned locally, the loader types its\n// dynamic-import result through the local shape (validated at runtime\n// via a structural check, not via TS) so the base install compiles.\n//\n// Failure-mode policy:\n// - Missing optional package → install hint (loadCodingGraphEngineFactory\n// throws the canonical user-facing message).\n// - Present-but-mismatched install (the optional package resolves to a\n// module that does not satisfy the structural contract) →\n// `module_load_failed` Error on the loadFactory path; probe paths\n// return null with no throw (graceful degradation). User sees a\n// real diagnostic telling them the install is broken — NOT the\n// \"npm install @remnic/coding-graph\" install hint, which would\n// mislead users into re-installing a package that is already there.\n// - Present-but-broken install (transitive dep missing, loader\n// fault, etc.) → underlying import error is rethrown on the\n// loadFactory path; probe paths swallow and return null.\n// - Three separate cache slots, kept strictly disjoint:\n// (a) `cachedLoadResult` — successful-module cache, read by both\n// loadFactory and tryLoad. Never populated on missing or\n// broken installs (preserves the \"users see the real\n// diagnostic\" invariant).\n// (b) `inFlightProbe` — in-flight promise slot shared by concurrent\n// probe callers; cleared once settled.\n// (c) (No \"absent result\" cache.) loadFactory ALWAYS attempts a\n// fresh import on a fresh call — never serves a stale\n// decision from a previous attempt.\n\nimport {\n CODING_GRAPH_ENGINE_VERSION,\n TIER_1_LANGUAGES,\n type CodingGraphEngine,\n type CodingGraphErrorCode,\n type CodingGraphLanguage,\n type CreateCodingGraphEngineOptions,\n type FileIR,\n type ParseFileInput,\n type ParseResult,\n type SymbolIR,\n} from \"./coding-graph-types.js\";\n\nconst SPECIFIER = \"@remnic/\" + \"coding-graph\";\n\n/**\n * Structural minimal shape of `@remnic/coding-graph`'s public surface,\n * as seen by core after a successful dynamic import. We narrow to\n * `unknown` first (since the dynamic import returns `any` at runtime)\n * and then to this interface only after the runtime check below.\n */\ninterface LoadedCodingGraphModule {\n ENGINE_VERSION: string;\n TIER_1_LANGUAGES: readonly CodingGraphLanguage[];\n CodingGraphError: new (\n code: CodingGraphErrorCode,\n message: string,\n engineVersion?: string,\n ) => Error;\n createCodingGraphEngine: (\n options?: CreateCodingGraphEngineOptions,\n ) => CodingGraphEngine;\n}\n\n/**\n * Outcome of a single import attempt. The probe path collapses\n * \"missing\" and \"incompatible\" into `null` (graceful degradation);\n * the loader path distinguishes the two so users get an accurate\n * diagnostic instead of a misleading install hint on a broken install.\n */\ntype ImportAttemptOutcome =\n | { readonly kind: \"ok\"; readonly module: LoadedCodingGraphModule }\n | { readonly kind: \"missing\" }\n | { readonly kind: \"incompatible\"; readonly actual: unknown }\n | { readonly kind: \"broken\"; readonly cause: unknown };\n\n/**\n * Build the user-facing install hint message. Exported so tests can assert\n * on the exact text (CLAUDE.md rule 51 / issue #1551 prove-fail-before).\n */\nexport function buildCodingGraphInstallHint(): string {\n return (\n \"The `@remnic/coding-graph` engine is optional and not installed in this environment.\\n\" +\n \"\\n\" +\n \"Install it alongside @remnic/core to enable codebase-graph features:\\n\" +\n \" npm install @remnic/coding-graph\\n\" +\n \"\\n\" +\n \"Or add it to a project (pnpm / yarn):\\n\" +\n \" pnpm add @remnic/coding-graph\\n\" +\n \" yarn add @remnic/coding-graph\\n\"\n );\n}\n\nfunction notInstalledError(): Error {\n return new Error(buildCodingGraphInstallHint());\n}\n\n/**\n * Build the present-but-incompatible diagnostic. The user has the\n * package installed but it does not satisfy the structural contract;\n * \"npm install @remnic/coding-graph\" would NOT help them (the package\n * is already there). Tell them to reinstall or open an issue.\n */\nfunction incompatibleModuleError(actual: unknown): Error {\n const keys =\n actual && typeof actual === \"object\"\n ? Object.keys(actual).slice(0, 8).join(\", \") || \"(none)\"\n : typeof actual;\n return new Error(\n \"`@remnic/coding-graph` is present but its module shape does not match \" +\n \"the expected contract. The installed build may be stale, broken, or \" +\n \"from an incompatible version. Try reinstalling it \" +\n \"(`npm install --force @remnic/coding-graph`) or pinning to a known \" +\n `working version. Detected exports: ${keys}.`,\n );\n}\n\n/**\n * Return true when `err` is a module-not-found failure for exactly the\n * `@remnic/coding-graph` specifier. Same boundary-aware regex as\n * packages/remnic-cli/src/optional-module-loader.ts so transitive\n * misses (a broken @remnic/coding-graph release) bubble up rather than\n * being mis-reported as \"run npm install\".\n *\n * Exported for tests; the production loaders call the internal alias\n * below.\n */\nexport function isSpecifierNotFoundErrorForCodingGraph(\n err: unknown,\n specifier: string = SPECIFIER,\n): boolean {\n if (!err || typeof err !== \"object\") {\n return false;\n }\n const code = (err as { code?: unknown }).code;\n if (code !== \"ERR_MODULE_NOT_FOUND\" && code !== \"MODULE_NOT_FOUND\") {\n return false;\n }\n const message = (err as { message?: unknown }).message;\n if (typeof message !== \"string\") {\n return false;\n }\n if (message.includes(`'${specifier}'`)) return true;\n if (message.includes(`\"${specifier}\"`)) return true;\n // Boundary guard so \"@remnic/coding-graph\" does not match\n // \"@remnic/coding-graph-foo\".\n const escaped = specifier.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const boundaryRegex = new RegExp(\n `(?:^|[\\\\s\"'\\`\\\\(])${escaped}(?:[\\\\s\"'\\`\\\\)]|$)`,\n );\n return boundaryRegex.test(message);\n}\n\n/**\n * Narrow a dynamic import result to the local LoadedCodingGraphModule\n * shape via a runtime structural check (never inline-as casting).\n * The cast-through-unknown double-step satisfies the rule that\n * \"unchecked casts\" must be justified; here the check is the runtime\n * predicate below.\n */\nfunction isLoadedCodingGraphModule(value: unknown): value is LoadedCodingGraphModule {\n if (!value || typeof value !== \"object\") return false;\n const candidate = value as Record<string, unknown>;\n return (\n typeof candidate.createCodingGraphEngine === \"function\" &&\n typeof candidate.CodingGraphError === \"function\" &&\n typeof candidate.ENGINE_VERSION === \"string\" &&\n Array.isArray(candidate.TIER_1_LANGUAGES)\n );\n}\n\n/**\n * Single import attempt. Returns a tagged-outcome object so callers\n * can distinguish \"not installed\" from \"incompatible build\" from\n * \"broken transitive dep\" — each gets its own diagnostic on the\n * user-facing path.\n *\n * Never reads from any cache; the calling function decides whether\n * to consult the success cache first.\n */\nasync function tryImportCodingGraphModule(): Promise<ImportAttemptOutcome> {\n // The dynamic `import()` with a runtime-concatenated specifier is the\n // documented à-la-carte loader pattern. See file header.\n let mod: unknown;\n try {\n // Cast through `unknown` is justified here: the dynamic import below\n // is the LOADING BOUNDARY between core (no compile-time dependency on\n // @remnic/coding-graph by design — see file header) and the optional\n // package whose shape we have documented locally. We validate the\n // structural shape before using any of the cast fields, so the cast\n // asserts the boundary, not specific fields.\n mod = (await import(SPECIFIER)) as unknown;\n } catch (err) {\n if (isSpecifierNotFoundErrorForCodingGraph(err)) {\n return { kind: \"missing\" };\n }\n // Non-specifier error (broken transitive dep, loader fault, etc.)\n // is wrapped so the loader can surface the diagnostic on a fresh\n // attempt and the probe path can still swallow.\n return { kind: \"broken\", cause: err };\n }\n if (!isLoadedCodingGraphModule(mod)) {\n return { kind: \"incompatible\", actual: mod };\n }\n return { kind: \"ok\", module: mod };\n}\n\n/**\n * Load `@remnic/coding-graph` if installed and return its\n * `createCodingGraphEngine` factory. Throws a user-facing diagnostic\n * that distinguishes three failure modes:\n * - missing → install hint (canonical \"npm install ...\" message).\n * - incompatible → \"package shape mismatch\" diagnostic.\n * - broken → rethrows the original import error.\n *\n * Reuses the cached success path so repeated calls in the same\n * process do not re-import. On success the resolved module is cached\n * and shared with the try* helpers; a failure never poisons the cache\n * so each call attempts a fresh import.\n */\nexport async function loadCodingGraphEngineFactory(): Promise<\n (options?: CreateCodingGraphEngineOptions) => CodingGraphEngine\n> {\n // Fast path: a previous successful load populated cachedLoadResult.\n // Reading it here matches the CLI `loadBenchModule` pattern and the\n // probe path's convention of sharing the success result (Cursor\n // Bugbot P3 round 5: \"Loader skips success cache\"). The fast path is\n // intentionally read-only — we never write the success cache from\n // the probe or fail-fast paths, so a probe that returned null cannot\n // convert into a stale loader result here.\n if (cachedLoadResult !== undefined && cachedLoadResult !== null) {\n return cachedLoadResult.createCodingGraphEngine;\n }\n // Fresh attempt — never inherited from a probe failure. Users see\n // the real diagnostic on broken installs.\n const outcome = await tryImportCodingGraphModule();\n switch (outcome.kind) {\n case \"ok\":\n cachedLoadResult = outcome.module;\n return outcome.module.createCodingGraphEngine;\n case \"missing\":\n throw notInstalledError();\n case \"incompatible\":\n throw incompatibleModuleError(outcome.actual);\n case \"broken\":\n throw outcome.cause instanceof Error\n ? outcome.cause\n : new Error(`@remnic/coding-graph failed to load: ${String(outcome.cause)}`);\n }\n}\n\n/**\n * Run the probe attempt with a Promise slot so concurrent callers\n * await the same in-flight import (Cursor Bugbot P2 round 4).\n * Successful results are also written into `cachedLoadResult` so a\n * SUBSEQUENT loadCodingGraphEngineFactory skips the import (the\n * success-cache fast path above). All non-ok outcomes (missing,\n * incompatible, broken) are collapsed to `null` so the probe stays\n * boolean-safe for gate-off consumers.\n */\nfunction startProbeOnce(): Promise<LoadedCodingGraphModule | null> {\n if (inFlightProbe !== null) {\n return inFlightProbe;\n }\n const p = tryImportCodingGraphModule()\n .then((outcome) => {\n if (outcome.kind === \"ok\") {\n cachedLoadResult = outcome.module;\n return outcome.module;\n }\n return null;\n })\n .catch(() => {\n // Defensive: tryImportCodingGraphModule does not reject in\n // practice (we wrap all throws), but a future refactor could\n // regress it — keep the probe boolean-safe.\n return null as LoadedCodingGraphModule | null;\n });\n inFlightProbe = p;\n // Once settled, clear the in-flight slot so a future call after a\n // long delay still re-attempts. The successful module result lives\n // on in cachedLoadResult if it succeeded.\n p.finally(() => {\n if (inFlightProbe === p) {\n inFlightProbe = null;\n }\n });\n return p;\n}\n\n// ---------------------------------------------------------------------------\n// Cache slots — see file header for the failure-mode policy that justifies\n// these being three separate slots.\n// ---------------------------------------------------------------------------\nlet cachedLoadResult: LoadedCodingGraphModule | null | undefined;\nlet inFlightProbe: Promise<LoadedCodingGraphModule | null> | null = null;\n\n/**\n * Return `true` only when `@remnic/coding-graph` is installed AND\n * importable in a usable shape. Returns `false` for missing, broken,\n * or incompatible installs. Never throws.\n */\nexport async function isCodingGraphInstalled(): Promise<boolean> {\n return (await tryLoadCodingGraphModule()) !== null;\n}\n\n/**\n * Return the engine factory module if `@remnic/coding-graph` is\n * installed AND importable in a usable shape, or `null` otherwise.\n * Use this for graceful-degradation code paths. Never throws.\n *\n * Uses an in-flight-promise slot so concurrent callers share the same\n * import attempt, then caches the successful result so subsequent\n * loadFactory calls skip the import.\n */\nexport async function tryLoadCodingGraphModule(): Promise<LoadedCodingGraphModule | null> {\n // Fast path: a previous loadFactory call stored a successful module.\n if (cachedLoadResult !== undefined && cachedLoadResult !== null) {\n return cachedLoadResult;\n }\n return startProbeOnce();\n}\n\n// ---------------------------------------------------------------------------\n// Re-export the engine contract types and stable constants so callers can\n// stay in `core` (no host prefix; the engine contract is owned by core).\n// ---------------------------------------------------------------------------\nexport {\n CODING_GRAPH_ENGINE_VERSION,\n TIER_1_LANGUAGES,\n};\n\nexport type {\n CodingGraphEngine,\n CodingGraphErrorCode,\n CodingGraphLanguage,\n CreateCodingGraphEngineOptions,\n FileIR,\n ParseFileInput,\n ParseResult,\n SymbolIR,\n};\n"],"mappings":";;;;;;;AAuEA,IAAM,YAAY;AAqCX,SAAS,8BAAsC;AACpD,SACE;AASJ;AAEA,SAAS,oBAA2B;AAClC,SAAO,IAAI,MAAM,4BAA4B,CAAC;AAChD;AAQA,SAAS,wBAAwB,QAAwB;AACvD,QAAM,OACJ,UAAU,OAAO,WAAW,WACxB,OAAO,KAAK,MAAM,EAAE,MAAM,GAAG,CAAC,EAAE,KAAK,IAAI,KAAK,WAC9C,OAAO;AACb,SAAO,IAAI;AAAA,IACT,ySAIwC,IAAI;AAAA,EAC9C;AACF;AAYO,SAAS,uCACd,KACA,YAAoB,WACX;AACT,MAAI,CAAC,OAAO,OAAO,QAAQ,UAAU;AACnC,WAAO;AAAA,EACT;AACA,QAAM,OAAQ,IAA2B;AACzC,MAAI,SAAS,0BAA0B,SAAS,oBAAoB;AAClE,WAAO;AAAA,EACT;AACA,QAAM,UAAW,IAA8B;AAC/C,MAAI,OAAO,YAAY,UAAU;AAC/B,WAAO;AAAA,EACT;AACA,MAAI,QAAQ,SAAS,IAAI,SAAS,GAAG,EAAG,QAAO;AAC/C,MAAI,QAAQ,SAAS,IAAI,SAAS,GAAG,EAAG,QAAO;AAG/C,QAAM,UAAU,UAAU,QAAQ,uBAAuB,MAAM;AAC/D,QAAM,gBAAgB,IAAI;AAAA,IACxB,qBAAqB,OAAO;AAAA,EAC9B;AACA,SAAO,cAAc,KAAK,OAAO;AACnC;AASA,SAAS,0BAA0B,OAAkD;AACnF,MAAI,CAAC,SAAS,OAAO,UAAU,SAAU,QAAO;AAChD,QAAM,YAAY;AAClB,SACE,OAAO,UAAU,4BAA4B,cAC7C,OAAO,UAAU,qBAAqB,cACtC,OAAO,UAAU,mBAAmB,YACpC,MAAM,QAAQ,UAAU,gBAAgB;AAE5C;AAWA,eAAe,6BAA4D;AAGzE,MAAI;AACJ,MAAI;AAOF,UAAO,MAAM,OAAO;AAAA,EACtB,SAAS,KAAK;AACZ,QAAI,uCAAuC,GAAG,GAAG;AAC/C,aAAO,EAAE,MAAM,UAAU;AAAA,IAC3B;AAIA,WAAO,EAAE,MAAM,UAAU,OAAO,IAAI;AAAA,EACtC;AACA,MAAI,CAAC,0BAA0B,GAAG,GAAG;AACnC,WAAO,EAAE,MAAM,gBAAgB,QAAQ,IAAI;AAAA,EAC7C;AACA,SAAO,EAAE,MAAM,MAAM,QAAQ,IAAI;AACnC;AAeA,eAAsB,+BAEpB;AAQA,MAAI,qBAAqB,UAAa,qBAAqB,MAAM;AAC/D,WAAO,iBAAiB;AAAA,EAC1B;AAGA,QAAM,UAAU,MAAM,2BAA2B;AACjD,UAAQ,QAAQ,MAAM;AAAA,IACpB,KAAK;AACH,yBAAmB,QAAQ;AAC3B,aAAO,QAAQ,OAAO;AAAA,IACxB,KAAK;AACH,YAAM,kBAAkB;AAAA,IAC1B,KAAK;AACH,YAAM,wBAAwB,QAAQ,MAAM;AAAA,IAC9C,KAAK;AACH,YAAM,QAAQ,iBAAiB,QAC3B,QAAQ,QACR,IAAI,MAAM,wCAAwC,OAAO,QAAQ,KAAK,CAAC,EAAE;AAAA,EACjF;AACF;AAWA,SAAS,iBAA0D;AACjE,MAAI,kBAAkB,MAAM;AAC1B,WAAO;AAAA,EACT;AACA,QAAM,IAAI,2BAA2B,EAClC,KAAK,CAAC,YAAY;AACjB,QAAI,QAAQ,SAAS,MAAM;AACzB,yBAAmB,QAAQ;AAC3B,aAAO,QAAQ;AAAA,IACjB;AACA,WAAO;AAAA,EACT,CAAC,EACA,MAAM,MAAM;AAIX,WAAO;AAAA,EACT,CAAC;AACH,kBAAgB;AAIhB,IAAE,QAAQ,MAAM;AACd,QAAI,kBAAkB,GAAG;AACvB,sBAAgB;AAAA,IAClB;AAAA,EACF,CAAC;AACD,SAAO;AACT;AAMA,IAAI;AACJ,IAAI,gBAAgE;AAOpE,eAAsB,yBAA2C;AAC/D,SAAQ,MAAM,yBAAyB,MAAO;AAChD;AAWA,eAAsB,2BAAoE;AAExF,MAAI,qBAAqB,UAAa,qBAAqB,MAAM;AAC/D,WAAO;AAAA,EACT;AACA,SAAO,eAAe;AACxB;","names":[]}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
declare const CODING_GRAPH_ENGINE_VERSION: "0.1.0-pr1";
|
|
2
|
+
declare const TIER_1_LANGUAGES: readonly ["typescript", "tsx", "javascript", "python", "go", "rust", "java", "c", "cpp", "csharp", "ruby", "php", "kotlin", "swift", "bash"];
|
|
3
|
+
type CodingGraphLanguage = (typeof TIER_1_LANGUAGES)[number];
|
|
4
|
+
type CodingGraphErrorCode = "not_implemented" | "module_load_failed";
|
|
5
|
+
interface CodingGraphEngine {
|
|
6
|
+
/** Engine version reported at construction time. */
|
|
7
|
+
readonly engineVersion: string;
|
|
8
|
+
/** Tier-1 languages this build supports (PR2 narrows by grammar availability). */
|
|
9
|
+
readonly supportedLanguages: readonly CodingGraphLanguage[];
|
|
10
|
+
/**
|
|
11
|
+
* Parse a single source file and emit its FileIR.
|
|
12
|
+
*
|
|
13
|
+
* PR1 throws `CodingGraphError("not_implemented", …)`. PR2 will return
|
|
14
|
+
* `ParseResult`; failure paths come back as
|
|
15
|
+
* `{ ok: false, code: "parse_failed", path, message }` (rule 44) rather
|
|
16
|
+
* than partial / silent IR.
|
|
17
|
+
*/
|
|
18
|
+
parseFile(input: ParseFileInput): Promise<ParseResult>;
|
|
19
|
+
/** Engine lifecycle — release any cached parsers/grammars. */
|
|
20
|
+
dispose(): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
interface ParseFileInput {
|
|
23
|
+
/** Repository-relative path (forward slashes; no leading `./`). */
|
|
24
|
+
readonly path: string;
|
|
25
|
+
/** Raw file bytes; hashing happens inside the engine (rule 23). */
|
|
26
|
+
readonly content: Uint8Array;
|
|
27
|
+
/**
|
|
28
|
+
* Optional override. When omitted the engine sniffs the language from
|
|
29
|
+
* `path` extensions against its built-in tier-1 list (PR2).
|
|
30
|
+
*/
|
|
31
|
+
readonly language?: CodingGraphLanguage;
|
|
32
|
+
}
|
|
33
|
+
type ParseResult = {
|
|
34
|
+
readonly ok: true;
|
|
35
|
+
readonly ir: FileIR;
|
|
36
|
+
} | {
|
|
37
|
+
readonly ok: false;
|
|
38
|
+
readonly code: "parse_failed";
|
|
39
|
+
readonly path: string;
|
|
40
|
+
readonly message: string;
|
|
41
|
+
};
|
|
42
|
+
interface FileIR {
|
|
43
|
+
readonly path: string;
|
|
44
|
+
readonly language: CodingGraphLanguage;
|
|
45
|
+
/** SHA-256 of the raw bytes; rule 23 — every consumer hashes the same form. */
|
|
46
|
+
readonly contentHash: string;
|
|
47
|
+
readonly symbols: readonly SymbolIR[];
|
|
48
|
+
readonly imports: readonly ImportIR[];
|
|
49
|
+
readonly exports: readonly ExportIR[];
|
|
50
|
+
readonly callSites: readonly CallSiteIR[];
|
|
51
|
+
readonly routes: readonly RouteIR[];
|
|
52
|
+
}
|
|
53
|
+
interface SymbolIR {
|
|
54
|
+
readonly kind: "function" | "class" | "method" | "interface" | "enum" | "type" | "module";
|
|
55
|
+
readonly name: string;
|
|
56
|
+
readonly qualifiedName: string;
|
|
57
|
+
/** Half-open byte span `[startByte, endByte)`. Rule 35. */
|
|
58
|
+
readonly span: {
|
|
59
|
+
readonly startByte: number;
|
|
60
|
+
readonly endByte: number;
|
|
61
|
+
};
|
|
62
|
+
readonly parentQualifiedName?: string;
|
|
63
|
+
}
|
|
64
|
+
interface ImportIR {
|
|
65
|
+
/** Raw module specifier as written in source. */
|
|
66
|
+
readonly module: string;
|
|
67
|
+
readonly importedNames: readonly string[];
|
|
68
|
+
readonly span: {
|
|
69
|
+
readonly startByte: number;
|
|
70
|
+
readonly endByte: number;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
interface ExportIR {
|
|
74
|
+
readonly name: string;
|
|
75
|
+
readonly span: {
|
|
76
|
+
readonly startByte: number;
|
|
77
|
+
readonly endByte: number;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
interface CallSiteIR {
|
|
81
|
+
readonly calleeNameCandidates: readonly string[];
|
|
82
|
+
readonly span: {
|
|
83
|
+
readonly startByte: number;
|
|
84
|
+
readonly endByte: number;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
interface RouteIR {
|
|
88
|
+
/** HTTP verb in upper-case, or framework-native verb (e.g. "ANY"). */
|
|
89
|
+
readonly verb: string;
|
|
90
|
+
readonly pathTemplate: string;
|
|
91
|
+
readonly handlerQualifiedName: string;
|
|
92
|
+
readonly span: {
|
|
93
|
+
readonly startByte: number;
|
|
94
|
+
readonly endByte: number;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Reserved for PR2. Declared now so the public surface is stable; the
|
|
99
|
+
* options object is intentionally empty in PR1.
|
|
100
|
+
*/
|
|
101
|
+
interface CreateCodingGraphEngineOptions {
|
|
102
|
+
/** Reserved for PR2: extra grammar directory supplied by the operator. */
|
|
103
|
+
readonly grammarDir?: never;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export { type CreateCodingGraphEngineOptions as C, type FileIR as F, type ParseFileInput as P, type SymbolIR as S, TIER_1_LANGUAGES as T, type CodingGraphEngine as a, type CodingGraphLanguage as b, type CodingGraphErrorCode as c, CODING_GRAPH_ENGINE_VERSION as d, type ParseResult as e };
|
package/dist/config.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ declare function isOpenaiApiKeyDisabled(value: unknown): boolean;
|
|
|
6
6
|
declare function resolveEnvVars(value: string): string;
|
|
7
7
|
declare const DEFAULT_REASONING_MODEL = "gpt-5.5";
|
|
8
8
|
declare const VALID_MEMORY_CATEGORIES: Set<string>;
|
|
9
|
-
declare function parseConfig(raw: unknown): PluginConfig;
|
|
9
|
+
declare function parseConfig(raw: unknown, rawOperatorConfig?: Record<string, unknown> | null, runtimeSet?: ReadonlySet<string>): PluginConfig;
|
|
10
10
|
|
|
11
11
|
export { DEFAULT_REASONING_MODEL, VALID_MEMORY_CATEGORIES, isOpenaiApiKeyDisabled, parseConfig, resolveEnvVars };
|
package/dist/config.js
CHANGED
|
@@ -4,10 +4,12 @@ import {
|
|
|
4
4
|
isOpenaiApiKeyDisabled,
|
|
5
5
|
parseConfig,
|
|
6
6
|
resolveEnvVars
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-IUZWBCJX.js";
|
|
8
8
|
import "./chunk-PHK3HARR.js";
|
|
9
9
|
import "./chunk-NDAH7BJ5.js";
|
|
10
10
|
import "./chunk-Z5LAYHGJ.js";
|
|
11
|
+
import "./chunk-QO3AILZN.js";
|
|
12
|
+
import "./chunk-3BQOQYRB.js";
|
|
11
13
|
import "./chunk-4DJQYKMN.js";
|
|
12
14
|
import "./chunk-EYIEWJNI.js";
|
|
13
15
|
import "./chunk-JUC24CTX.js";
|
|
@@ -12,6 +12,11 @@ import '../index-DJ9QWMw-.js';
|
|
|
12
12
|
*/
|
|
13
13
|
declare function coerceInstallExtension(value: unknown): boolean | undefined;
|
|
14
14
|
|
|
15
|
+
/** Path of the connector registry manifest file. */
|
|
16
|
+
declare function getRegistryPath(): string;
|
|
17
|
+
/** Directory holding one `<connector-id>.json` per installed connector. */
|
|
18
|
+
declare function getConnectorsDir(): string;
|
|
19
|
+
|
|
15
20
|
/**
|
|
16
21
|
* codex-marketplace.ts — Codex marketplace installation support (#418)
|
|
17
22
|
*
|
|
@@ -263,7 +268,6 @@ interface DoctorCheck {
|
|
|
263
268
|
detail: string;
|
|
264
269
|
}
|
|
265
270
|
|
|
266
|
-
declare function getRegistryPath(): string;
|
|
267
271
|
declare function loadRegistry(): ConnectorRegistry;
|
|
268
272
|
declare function saveRegistry(registry: ConnectorRegistry): void;
|
|
269
273
|
declare function listConnectors(): {
|
|
@@ -442,4 +446,4 @@ declare function buildWeCloneProxyConfig(args: {
|
|
|
442
446
|
authToken?: string;
|
|
443
447
|
}): WeCloneProxyConfig;
|
|
444
448
|
|
|
445
|
-
export { type CodexMemoryExtensionPaths, type ConnectorCapability, type ConnectorInstance, type ConnectorManifest, type ConnectorRegistry, type DoctorCheck, type DoctorResult, type InstallCodexMemoryExtensionOptions, type InstallCodexMemoryExtensionResult, type InstallOptions, type InstallResult, MARKETPLACE_MANIFEST_FILENAME, MARKETPLACE_SCHEMA_VERSION, type MarketplaceConfig, type MarketplaceEntry, type MarketplaceInstallResult, type MarketplaceInstallType, type MarketplaceLogger, type MarketplaceManifest, type MarketplaceValidation, type RemoveCodexMemoryExtensionOptions, type RemoveCodexMemoryExtensionResult, type RemoveResult, buildWeCloneProxyConfig, checkMarketplaceManifest, coerceInstallExtension, doctorConnector, generateMarketplaceManifest, getConnectorToken, getRegistryPath, installCodexMemoryExtension, installConnector, installFromMarketplace, listConnectors, loadRegistry, locatePluginCodexExtensionSource, removeCodexMemoryExtension, removeConnector, removeHermesConfig, resolveCodexHome, resolveCodexMemoryExtensionPaths, resolveWeCloneProxyConfigPath, saveRegistry, upsertHermesConfig, validateMarketplaceManifest, writeMarketplaceManifest };
|
|
449
|
+
export { type CodexMemoryExtensionPaths, type ConnectorCapability, type ConnectorInstance, type ConnectorManifest, type ConnectorRegistry, type DoctorCheck, type DoctorResult, type InstallCodexMemoryExtensionOptions, type InstallCodexMemoryExtensionResult, type InstallOptions, type InstallResult, MARKETPLACE_MANIFEST_FILENAME, MARKETPLACE_SCHEMA_VERSION, type MarketplaceConfig, type MarketplaceEntry, type MarketplaceInstallResult, type MarketplaceInstallType, type MarketplaceLogger, type MarketplaceManifest, type MarketplaceValidation, type RemoveCodexMemoryExtensionOptions, type RemoveCodexMemoryExtensionResult, type RemoveResult, buildWeCloneProxyConfig, checkMarketplaceManifest, coerceInstallExtension, doctorConnector, generateMarketplaceManifest, getConnectorToken, getConnectorsDir, getRegistryPath, installCodexMemoryExtension, installConnector, installFromMarketplace, listConnectors, loadRegistry, locatePluginCodexExtensionSource, removeCodexMemoryExtension, removeConnector, removeHermesConfig, resolveCodexHome, resolveCodexMemoryExtensionPaths, resolveWeCloneProxyConfigPath, saveRegistry, upsertHermesConfig, validateMarketplaceManifest, writeMarketplaceManifest };
|
package/dist/connectors/index.js
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
doctorConnector,
|
|
7
7
|
generateMarketplaceManifest,
|
|
8
8
|
getConnectorToken,
|
|
9
|
-
getRegistryPath,
|
|
10
9
|
installCodexMemoryExtension,
|
|
11
10
|
installConnector,
|
|
12
11
|
installFromMarketplace,
|
|
@@ -23,7 +22,7 @@ import {
|
|
|
23
22
|
upsertHermesConfig,
|
|
24
23
|
validateMarketplaceManifest,
|
|
25
24
|
writeMarketplaceManifest
|
|
26
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-GNAMDNGT.js";
|
|
27
26
|
import "../chunk-UG274TNV.js";
|
|
28
27
|
import {
|
|
29
28
|
runCodexMaterialize
|
|
@@ -47,6 +46,10 @@ import "../chunk-3UXOZBHV.js";
|
|
|
47
46
|
import {
|
|
48
47
|
coerceInstallExtension
|
|
49
48
|
} from "../chunk-PHK3HARR.js";
|
|
49
|
+
import {
|
|
50
|
+
getConnectorsDir,
|
|
51
|
+
getRegistryPath
|
|
52
|
+
} from "../chunk-3BQOQYRB.js";
|
|
50
53
|
import "../chunk-O75CRYGF.js";
|
|
51
54
|
import "../chunk-EUM7CZFM.js";
|
|
52
55
|
import "../chunk-M7XQSUBB.js";
|
|
@@ -90,6 +93,7 @@ export {
|
|
|
90
93
|
ensureSentinel,
|
|
91
94
|
generateMarketplaceManifest,
|
|
92
95
|
getConnectorToken,
|
|
96
|
+
getConnectorsDir,
|
|
93
97
|
getRegistryPath,
|
|
94
98
|
installCodexMemoryExtension,
|
|
95
99
|
installConnector,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createConversationIndexBackend
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-7DTASS5T.js";
|
|
3
|
+
} from "../chunk-7OGJQP7T.js";
|
|
5
4
|
import "../chunk-E6ZDCOHM.js";
|
|
6
5
|
import "../chunk-OIF36KGD.js";
|
|
6
|
+
import "../chunk-7DTASS5T.js";
|
|
7
7
|
import "../chunk-O75CRYGF.js";
|
|
8
8
|
import "../chunk-2ODBA7MQ.js";
|
|
9
9
|
import "../chunk-PZ5AY32C.js";
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* emit-legacy-tools — resolution cluster for the `emitLegacyTools` and
|
|
3
|
+
* `namespaceCatalogEnabled` config gates (issues #1427, #1499, #1550).
|
|
4
|
+
*
|
|
5
|
+
* Extracted from packages/remnic-core/src/config.ts (PR #1593, round 6)
|
|
6
|
+
* so the raw-vs-effective split, runtime-override precedence, and
|
|
7
|
+
* fileConfig-null normalization logic specific to these two gates
|
|
8
|
+
* stays out of the god-file `config.ts`. The export surface is exactly
|
|
9
|
+
* the two resolvers plus the `coerceBooleanLikeOrThrow` helper that
|
|
10
|
+
* wraps the local `coerceBooleanLike` — every other config gate in
|
|
11
|
+
* `parseConfig` keeps using its own inline coercion or the
|
|
12
|
+
* `coerceBooleanLike` already exported from
|
|
13
|
+
* `packages/remnic-core/src/connectors/coerce.ts`.
|
|
14
|
+
*
|
|
15
|
+
* Precedence (PR #1593 rounds 1-4, plus the null/loader hardening from
|
|
16
|
+
* rounds 3-5):
|
|
17
|
+
*
|
|
18
|
+
* 1. `configValue` (the first arg) is the MERGED config
|
|
19
|
+
* (runtime-over-file via the
|
|
20
|
+
* `{...fileConfig, ...api.pluginConfig}` spread in src/index.ts).
|
|
21
|
+
* If it's a real boolean, it represents what the operator wants,
|
|
22
|
+
* so honor it. We only fall through when it's the schema-default
|
|
23
|
+
* materialization with no operator authoring in raw.
|
|
24
|
+
* 2. `rawOperatorConfig` (the second arg) is the operator-supplied
|
|
25
|
+
* config block BEFORE the OpenClaw manifest layer applies schema
|
|
26
|
+
* defaults — i.e. the file-backed `loadPluginConfigFromFile` output.
|
|
27
|
+
* When raw has the key with a non-null/undefined value, the file
|
|
28
|
+
* layer authored it. The merged `configValue` reflects the full
|
|
29
|
+
* operator intent (file + runtime), so `configValue` is still
|
|
30
|
+
* authoritative. raw presence is used only as the "operator
|
|
31
|
+
* authored this key" signal — if raw is missing AND configValue
|
|
32
|
+
* equals the schema default, only the schema layer materialized the
|
|
33
|
+
* key (no operator intent anywhere) and we fall through to env /
|
|
34
|
+
* sticky-legacy.
|
|
35
|
+
* 3. Legacy callers (raw undefined): trust configValue as before to
|
|
36
|
+
* preserve the 121+ existing call sites that pass only one arg.
|
|
37
|
+
*
|
|
38
|
+
* Defensive normalization (PR #1593 round 3): JSON null on disk for the
|
|
39
|
+
* operator config block surfaces as `null` in rawOperatorConfig. Both
|
|
40
|
+
* resolvers normalize `null` to `{}` so the `"key" in rawOperatorConfig`
|
|
41
|
+
* check never throws. The file loader
|
|
42
|
+
* (`loadPluginConfigFromFile`) also normalizes null to undefined
|
|
43
|
+
* before reaching here.
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* Resolve the `emitLegacyTools` opt-out (issue #1427, defaults revised in
|
|
47
|
+
* #1550). Precedence: operator-set raw config, then merged (post-defaults)
|
|
48
|
+
* config, then the REMNIC_/ENGRAM_ env var, then a sticky-legacy default —
|
|
49
|
+
* `true` only when existing legacy connector entries are present on disk
|
|
50
|
+
* (`hasLegacyConnectorEntries`), `false` for fresh installs.
|
|
51
|
+
*/
|
|
52
|
+
declare function resolveEmitLegacyTools(configValue: unknown, rawOperatorConfig: Record<string, unknown> | undefined | null, runtimeSet?: ReadonlySet<string>): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Resolve the `namespaceCatalogEnabled` opt-out (issue #1499). Same
|
|
55
|
+
* raw-vs-effective split as `resolveEmitLegacyTools` — schema-default
|
|
56
|
+
* hardening at the helper level so adding a `false` default later cannot
|
|
57
|
+
* silently flip behavior on upgraded installs (#1550 class hardening).
|
|
58
|
+
*/
|
|
59
|
+
declare function resolveNamespaceCatalogEnabled(configValue: unknown, rawOperatorConfig: Record<string, unknown> | undefined | null, runtimeSet?: ReadonlySet<string>): boolean;
|
|
60
|
+
|
|
61
|
+
export { resolveEmitLegacyTools, resolveNamespaceCatalogEnabled };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveEmitLegacyTools,
|
|
3
|
+
resolveNamespaceCatalogEnabled
|
|
4
|
+
} from "./chunk-QO3AILZN.js";
|
|
5
|
+
import "./chunk-3BQOQYRB.js";
|
|
6
|
+
import "./chunk-JUC24CTX.js";
|
|
7
|
+
import "./chunk-PZ5AY32C.js";
|
|
8
|
+
export {
|
|
9
|
+
resolveEmitLegacyTools,
|
|
10
|
+
resolveNamespaceCatalogEnabled
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=emit-legacy-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|