@aroman22/codegraph-vba-darwin-arm64 1.6.3 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/dist/extraction/vba/call-sweep.d.ts.map +1 -1
- package/lib/dist/extraction/vba/call-sweep.js +49 -1
- package/lib/dist/extraction/vba/call-sweep.js.map +1 -1
- package/lib/dist/extraction/vba/calls.d.ts +6 -2
- package/lib/dist/extraction/vba/calls.d.ts.map +1 -1
- package/lib/dist/extraction/vba/calls.js +55 -7
- package/lib/dist/extraction/vba/calls.js.map +1 -1
- package/lib/dist/extraction/vba/controls.d.ts +17 -0
- package/lib/dist/extraction/vba/controls.d.ts.map +1 -1
- package/lib/dist/extraction/vba/controls.js +40 -2
- package/lib/dist/extraction/vba/controls.js.map +1 -1
- package/lib/dist/extraction/vba/docmd.js +1 -1
- package/lib/dist/extraction/vba/docmd.js.map +1 -1
- package/lib/dist/mcp/daemon-watchdog.d.ts +84 -0
- package/lib/dist/mcp/daemon-watchdog.d.ts.map +1 -0
- package/lib/dist/mcp/daemon-watchdog.js +244 -0
- package/lib/dist/mcp/daemon-watchdog.js.map +1 -0
- package/lib/dist/mcp/index.d.ts +1 -0
- package/lib/dist/mcp/index.d.ts.map +1 -1
- package/lib/dist/mcp/index.js +15 -0
- package/lib/dist/mcp/index.js.map +1 -1
- package/lib/dist/mcp/server-instructions.d.ts +1 -1
- package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
- package/lib/dist/mcp/server-instructions.js +2 -0
- package/lib/dist/mcp/server-instructions.js.map +1 -1
- package/lib/dist/resolution/index.d.ts +12 -0
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +58 -20
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/vba-runtime-objects.d.ts +40 -0
- package/lib/dist/resolution/vba-runtime-objects.d.ts.map +1 -0
- package/lib/dist/resolution/vba-runtime-objects.js +68 -0
- package/lib/dist/resolution/vba-runtime-objects.js.map +1 -0
- package/lib/dist/types.d.ts +33 -1
- package/lib/dist/types.d.ts.map +1 -1
- package/lib/dist/types.js +37 -0
- package/lib/dist/types.js.map +1 -1
- package/lib/dist/upgrade/index.d.ts +64 -0
- package/lib/dist/upgrade/index.d.ts.map +1 -1
- package/lib/dist/upgrade/index.js +189 -6
- package/lib/dist/upgrade/index.js.map +1 -1
- package/lib/node_modules/.modules.yaml +1 -1
- package/lib/node_modules/.pnpm-workspace-state-v1.json +1 -1
- package/lib/package.json +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Daemon liveness watchdog — issue #116.
|
|
4
|
+
*
|
|
5
|
+
* The MCP server (or any long-lived host) registers project roots it serves.
|
|
6
|
+
* Every `intervalMs`, the watchdog checks each root's daemon (via the
|
|
7
|
+
* {@link listDaemons} discovery index + liveness probe). If a daemon that
|
|
8
|
+
* SHOULD exist is dead (kill -9, Stop-Process, crash, …), the watchdog
|
|
9
|
+
* respawns it with the same spawnDetachedDaemon recipe the launcher uses
|
|
10
|
+
* (`process.execPath` + `process.execArgv` + `scriptPath serve --mcp --path <root>`).
|
|
11
|
+
*
|
|
12
|
+
* Why a watchdog (vs. spawn-on-demand at MCP request time): the issue's repro
|
|
13
|
+
* is `Stop-Process -Id <pid>` while the MCP keeps serving — file edits are
|
|
14
|
+
* missed until the user manually runs `codegraph-vba sync`. The watchdog
|
|
15
|
+
* closes that gap in <intervalMs>.
|
|
16
|
+
*
|
|
17
|
+
* Spawned detaches (own session/process group) so closing the MCP process
|
|
18
|
+
* does not take the watchdog down with it.
|
|
19
|
+
*/
|
|
20
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
23
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
24
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
25
|
+
}
|
|
26
|
+
Object.defineProperty(o, k2, desc);
|
|
27
|
+
}) : (function(o, m, k, k2) {
|
|
28
|
+
if (k2 === undefined) k2 = k;
|
|
29
|
+
o[k2] = m[k];
|
|
30
|
+
}));
|
|
31
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
32
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
33
|
+
}) : function(o, v) {
|
|
34
|
+
o["default"] = v;
|
|
35
|
+
});
|
|
36
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
37
|
+
var ownKeys = function(o) {
|
|
38
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
39
|
+
var ar = [];
|
|
40
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
41
|
+
return ar;
|
|
42
|
+
};
|
|
43
|
+
return ownKeys(o);
|
|
44
|
+
};
|
|
45
|
+
return function (mod) {
|
|
46
|
+
if (mod && mod.__esModule) return mod;
|
|
47
|
+
var result = {};
|
|
48
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
49
|
+
__setModuleDefault(result, mod);
|
|
50
|
+
return result;
|
|
51
|
+
};
|
|
52
|
+
})();
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.DaemonWatchdog = void 0;
|
|
55
|
+
const child_process_1 = require("child_process");
|
|
56
|
+
const fs = __importStar(require("fs"));
|
|
57
|
+
const path = __importStar(require("path"));
|
|
58
|
+
const directory_1 = require("../directory");
|
|
59
|
+
const daemon_paths_1 = require("./daemon-paths");
|
|
60
|
+
const daemon_registry_1 = require("./daemon-registry");
|
|
61
|
+
const DAEMON_INTERNAL_ENV = 'CODEGRAPH_DAEMON_INTERNAL';
|
|
62
|
+
const HOST_PPID_ENV = 'CODEGRAPH_HOST_PPID';
|
|
63
|
+
const DEFAULT_INTERVAL_MS = 30_000;
|
|
64
|
+
/**
|
|
65
|
+
* Default spawn implementation: spawn the daemon detached and unref so it
|
|
66
|
+
* survives the launcher's exit. Extracted so tests can inject a stub.
|
|
67
|
+
*/
|
|
68
|
+
function defaultSpawnFn(nodePath, args, opts) {
|
|
69
|
+
const child = (0, child_process_1.spawn)(nodePath, args, {
|
|
70
|
+
detached: opts.detached,
|
|
71
|
+
stdio: opts.stdio,
|
|
72
|
+
windowsHide: opts.windowsHide,
|
|
73
|
+
env: opts.env,
|
|
74
|
+
});
|
|
75
|
+
child.unref();
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* How long the watchdog waits for a freshly-spawned daemon to bind its socket
|
|
80
|
+
* before declaring the spawn a failure (next poll retries). Same ~6s budget
|
|
81
|
+
* the launcher uses for cold start.
|
|
82
|
+
*/
|
|
83
|
+
const SPAWN_BIND_MAX_RETRIES = 240;
|
|
84
|
+
const SPAWN_BIND_RETRY_DELAY_MS = 25;
|
|
85
|
+
/**
|
|
86
|
+
* Per-project daemon liveness watchdog. Registers roots; polls every
|
|
87
|
+
* `intervalMs`; respawns a daemon if the live one dies.
|
|
88
|
+
*/
|
|
89
|
+
class DaemonWatchdog {
|
|
90
|
+
roots = new Set();
|
|
91
|
+
interval = null;
|
|
92
|
+
intervalMs;
|
|
93
|
+
scriptPath;
|
|
94
|
+
nodePath;
|
|
95
|
+
spawnFn;
|
|
96
|
+
constructor(opts = {}) {
|
|
97
|
+
this.intervalMs = opts.intervalMs ?? DEFAULT_INTERVAL_MS;
|
|
98
|
+
// Resolve the spawn target at construction time. `process.argv[1]` is the
|
|
99
|
+
// script that the launcher used; reusing it keeps the detached daemon
|
|
100
|
+
// launch identical to the launcher's spawn.
|
|
101
|
+
this.scriptPath = opts.scriptPath ?? process.argv[1] ?? '';
|
|
102
|
+
this.nodePath = opts.nodePath ?? process.execPath;
|
|
103
|
+
this.spawnFn = opts.spawnFn ?? defaultSpawnFn;
|
|
104
|
+
}
|
|
105
|
+
/** Watch a project root: if its daemon dies, respawn it. Idempotent. */
|
|
106
|
+
watch(root) {
|
|
107
|
+
this.roots.add(path.resolve(root));
|
|
108
|
+
}
|
|
109
|
+
/** Stop watching a root. Idempotent. */
|
|
110
|
+
unwatch(root) {
|
|
111
|
+
this.roots.delete(path.resolve(root));
|
|
112
|
+
}
|
|
113
|
+
/** Number of roots currently being watched. */
|
|
114
|
+
size() {
|
|
115
|
+
return this.roots.size;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Start the polling loop. No-op if already running. Detached from any caller;
|
|
119
|
+
* safe to call from a request handler.
|
|
120
|
+
*/
|
|
121
|
+
start() {
|
|
122
|
+
if (this.interval)
|
|
123
|
+
return;
|
|
124
|
+
// Fire one check immediately so the user doesn't wait `intervalMs` for
|
|
125
|
+
// the first round after restart.
|
|
126
|
+
void this.tick();
|
|
127
|
+
this.interval = setInterval(() => void this.tick(), this.intervalMs);
|
|
128
|
+
// unref so the watchdog never keeps the event loop alive on its own.
|
|
129
|
+
this.interval.unref?.();
|
|
130
|
+
}
|
|
131
|
+
/** Stop the polling loop. Idempotent. */
|
|
132
|
+
stop() {
|
|
133
|
+
if (this.interval) {
|
|
134
|
+
clearInterval(this.interval);
|
|
135
|
+
this.interval = null;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Run one round: for each watched root, check daemon liveness and respawn
|
|
140
|
+
* if missing. Exposed for tests + manual triggers.
|
|
141
|
+
*/
|
|
142
|
+
async tick() {
|
|
143
|
+
for (const root of this.roots) {
|
|
144
|
+
await this.checkAndRespawn(root);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* If no live daemon serves `root`, spawn one. Exposed for tests + manual
|
|
149
|
+
* triggers. Resolves to `true` if a daemon was spawned, `false` if one
|
|
150
|
+
* was already running or no `.codegraph/` is reachable from `root`.
|
|
151
|
+
*/
|
|
152
|
+
async checkAndRespawn(root) {
|
|
153
|
+
// We can't trust `listDaemons` to surface a dead daemon for us — it filters
|
|
154
|
+
// out dead entries from its return value (even with `prune: false`, see
|
|
155
|
+
// daemon-registry.ts). So we check the pidfile directly: it IS the
|
|
156
|
+
// authoritative pointer (the registry is a discovery index, the lockfile
|
|
157
|
+
// is the source of truth).
|
|
158
|
+
if (this.hasLiveDaemon(root))
|
|
159
|
+
return false;
|
|
160
|
+
// Only spawn if the project has a `.codegraph/` — no point spawning a
|
|
161
|
+
// daemon for an uninitialized project.
|
|
162
|
+
if (!(0, directory_1.findNearestCodeGraphRoot)(root))
|
|
163
|
+
return false;
|
|
164
|
+
return this.spawn(root);
|
|
165
|
+
}
|
|
166
|
+
/** Spawn a fresh daemon for `root`. Detached; safe to call from any context. */
|
|
167
|
+
spawn(root) {
|
|
168
|
+
if (!this.scriptPath)
|
|
169
|
+
return false;
|
|
170
|
+
const logPath = path.join((0, directory_1.getCodeGraphDir)(root), 'daemon.log');
|
|
171
|
+
let logFd = null;
|
|
172
|
+
let stdio = 'ignore';
|
|
173
|
+
try {
|
|
174
|
+
logFd = fs.openSync(logPath, 'a');
|
|
175
|
+
stdio = ['ignore', logFd, logFd];
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
stdio = 'ignore';
|
|
179
|
+
}
|
|
180
|
+
try {
|
|
181
|
+
// Don't leak the watchdog's host pid into the daemon (would trip its PPID
|
|
182
|
+
// watchdog on this very process). Scrub it on spawn.
|
|
183
|
+
const env = { ...process.env, [DAEMON_INTERNAL_ENV]: '1' };
|
|
184
|
+
delete env[HOST_PPID_ENV];
|
|
185
|
+
this.spawnFn(this.nodePath, [...process.execArgv, this.scriptPath, 'serve', '--mcp', '--path', root], {
|
|
186
|
+
detached: true,
|
|
187
|
+
windowsHide: true,
|
|
188
|
+
env,
|
|
189
|
+
stdio,
|
|
190
|
+
});
|
|
191
|
+
return true;
|
|
192
|
+
}
|
|
193
|
+
catch {
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
finally {
|
|
197
|
+
if (logFd !== null) {
|
|
198
|
+
try {
|
|
199
|
+
fs.closeSync(logFd);
|
|
200
|
+
}
|
|
201
|
+
catch { /* ignore */ }
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Wait for a daemon's socket to appear at one of the candidate paths under
|
|
207
|
+
* `root`. Used by callers that want a synchronous spawn-then-use flow; not
|
|
208
|
+
* required by the watchdog itself (which only needs liveness, not binding).
|
|
209
|
+
*/
|
|
210
|
+
async waitForSocket(root, maxRetries = SPAWN_BIND_MAX_RETRIES) {
|
|
211
|
+
const candidates = (0, daemon_paths_1.getDaemonSocketCandidates)(root);
|
|
212
|
+
for (let i = 0; i < maxRetries; i++) {
|
|
213
|
+
for (const candidate of candidates) {
|
|
214
|
+
try {
|
|
215
|
+
// Any successful stat means the socket/pipe exists. The launcher
|
|
216
|
+
// does a real connect on top of this; we only need existence.
|
|
217
|
+
fs.statSync(candidate);
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
catch {
|
|
221
|
+
/* not yet */
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
await new Promise((r) => setTimeout(r, SPAWN_BIND_RETRY_DELAY_MS));
|
|
225
|
+
}
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
/** True if a daemon's pid file at `root` points at a live process. */
|
|
229
|
+
hasLiveDaemon(root) {
|
|
230
|
+
let raw;
|
|
231
|
+
try {
|
|
232
|
+
raw = fs.readFileSync((0, daemon_paths_1.getDaemonPidPath)(root), 'utf8');
|
|
233
|
+
}
|
|
234
|
+
catch {
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
const info = (0, daemon_paths_1.decodeLockInfo)(raw);
|
|
238
|
+
if (!info)
|
|
239
|
+
return false;
|
|
240
|
+
return (0, daemon_registry_1.isProcessAlive)(info.pid);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
exports.DaemonWatchdog = DaemonWatchdog;
|
|
244
|
+
//# sourceMappingURL=daemon-watchdog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daemon-watchdog.js","sourceRoot":"","sources":["../../src/mcp/daemon-watchdog.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iDAAsC;AACtC,uCAAyB;AACzB,2CAA6B;AAC7B,4CAAyE;AACzE,iDAA6F;AAC7F,uDAAmD;AAEnD,MAAM,mBAAmB,GAAG,2BAA2B,CAAC;AACxD,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAE5C,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAEnC;;;GAGG;AACH,SAAS,cAAc,CACrB,QAAgB,EAChB,IAAc,EACd,IAA2H;IAE3H,MAAM,KAAK,GAAG,IAAA,qBAAK,EAAC,QAAQ,EAAE,IAAI,EAAE;QAClC,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,GAAG,EAAE,IAAI,CAAC,GAAG;KACd,CAAC,CAAC;IACH,KAAK,CAAC,KAAK,EAAE,CAAC;IACd,OAAO,IAAI,CAAC;AACd,CAAC;AAgBD;;;;GAIG;AACH,MAAM,sBAAsB,GAAG,GAAG,CAAC;AACnC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAErC;;;GAGG;AACH,MAAa,cAAc;IACR,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,QAAQ,GAA0B,IAAI,CAAC;IAC9B,UAAU,CAAS;IACnB,UAAU,CAAS;IACnB,QAAQ,CAAS;IACjB,OAAO,CAA6K;IAErM,YAAY,OAA8B,EAAE;QAC1C,IAAI,CAAC,UAAU,GAAG,I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ACtE,aAAa,CAAC,IAAY;QACxB,IAAI,GAAW,CAAC;QAChB,IAAI,CAAC;YACH,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,IAAA,+BAAgB,EAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;QACxD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;QACD,MAAM,IAAI,GAAG,IAAA,6BAAc,EAAC,GAAG,CAAC,CAAC;QACjC,IAAI,CAAC,IAAI;YAAE,OAAO,KAAK,CAAC;QACxB,OAAO,IAAA,gCAAc,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;CACF;AA3JD,wCA2JC"}
|
package/lib/dist/mcp/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAgJH;;;;;;;;;;GAUG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,WAAW,CAAgB;IAGnC,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,YAAY,CAA+C;IAGnE,OAAO,CAAC,gBAAgB,CAA+B;IAKvD,OAAO,CAAC,cAAc,CAA+B;IAIrD,OAAO,CAAC,YAAY,CAAsB;IAC1C,OAAO,CAAC,QAAQ,CAA4D;IAE5E,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,IAAI,CAA4D;gBAE5D,WAAW,CAAC,EAAE,MAAM;IAIhC;;;;;;;;;;;;OAYG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAwD5B;;;;OAIG;IACH,IAAI,IAAI,IAAI;IA+BZ,uEAAuE;YACzD,WAAW;IA0CzB;;;;;;;;OAQG;YACW,kBAAkB;IAqChC;;;;;;;OAOG;YACW,0BAA0B;IAqCxC,iFAAiF;IACjF,OAAO,CAAC,qBAAqB;IAK7B;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;CAoB5B;AAWD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC"}
|
package/lib/dist/mcp/index.js
CHANGED
|
@@ -84,6 +84,7 @@ const update_check_1 = require("../upgrade/update-check");
|
|
|
84
84
|
const early_ppid_1 = require("./early-ppid");
|
|
85
85
|
const ppid_watchdog_1 = require("./ppid-watchdog");
|
|
86
86
|
const liveness_watchdog_1 = require("./liveness-watchdog");
|
|
87
|
+
const daemon_watchdog_1 = require("./daemon-watchdog");
|
|
87
88
|
const startup_handshake_1 = require("./startup-handshake");
|
|
88
89
|
const stdin_teardown_1 = require("./stdin-teardown");
|
|
89
90
|
const wasm_runtime_flags_1 = require("../extraction/wasm-runtime-flags");
|
|
@@ -226,6 +227,11 @@ class MCPServer {
|
|
|
226
227
|
// Worker-thread liveness watchdog (#850). Long-lived modes only; SIGKILLs the
|
|
227
228
|
// process if the main thread wedges in a non-yielding sync loop.
|
|
228
229
|
livenessWatchdog = null;
|
|
230
|
+
// Per-project daemon liveness watchdog (#116). Started in proxy mode: polls
|
|
231
|
+
// the daemon for the root we serve every `intervalMs` and respawns it if it
|
|
232
|
+
// dies (e.g. Stop-Process, kill -9) — so the incremental file-watcher
|
|
233
|
+
// recovers without the user manually running `codegraph-vba sync`.
|
|
234
|
+
daemonWatchdog = null;
|
|
229
235
|
// PPID watchdog baseline — from the CLI entry's earliest-possible capture
|
|
230
236
|
// (early-ppid.ts). Capturing here (construction) already lost the race when
|
|
231
237
|
// the launcher was killed during module loading (#1185).
|
|
@@ -285,6 +291,11 @@ class MCPServer {
|
|
|
285
291
|
// Runs until the host disconnects; the proxy installs its own watchdog and
|
|
286
292
|
// falls back to an in-process engine if the daemon never comes up.
|
|
287
293
|
this.mode = 'proxy';
|
|
294
|
+
// #116: if the daemon dies while the proxy is up (Stop-Process, kill -9,
|
|
295
|
+
// crash), the file-watcher dies with it. Watchdog respawns it.
|
|
296
|
+
this.daemonWatchdog = new daemon_watchdog_1.DaemonWatchdog();
|
|
297
|
+
this.daemonWatchdog.watch(root);
|
|
298
|
+
this.daemonWatchdog.start();
|
|
288
299
|
await this.runProxyWithLocalHandshake(root);
|
|
289
300
|
return;
|
|
290
301
|
}
|
|
@@ -313,6 +324,10 @@ class MCPServer {
|
|
|
313
324
|
this.livenessWatchdog.stop();
|
|
314
325
|
this.livenessWatchdog = null;
|
|
315
326
|
}
|
|
327
|
+
if (this.daemonWatchdog) {
|
|
328
|
+
this.daemonWatchdog.stop();
|
|
329
|
+
this.daemonWatchdog = null;
|
|
330
|
+
}
|
|
316
331
|
if (this.daemon) {
|
|
317
332
|
void this.daemon.stop('stop()');
|
|
318
333
|
// Daemon.stop calls process.exit; nothing else to do.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,2CAA6B;AAC7B,iDAAoD;AACpD,4CAAyE;AACzE,2CAA6C;AAC7C,qCAAqC;AACrC,uCAAuC;AACvC,qCAKkB;AAClB,mCAAmE;AACnE,iDAA2D;AAC3D,4CAA4C;AAC5C,0DAAqE;AACrE,6CAA0C;AAC1C,mDAAwF;AACxF,2DAAgF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AI,MAAM,IAAI,CAAC;YAAE,OAAO;QACxB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC,GAAG,EAAE;YACnC,MAAM,MAAM,GAAG,IAAA,qCAAqB,EAAC;gBACnC,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,WAAW,EAAE,OAAO,CAAC,IAAI;gBACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,OAAO,EAAE,uBAAc;aACxB,CAAC,CAAC;YACH,IAAI,MAAM,EAAE,CAAC;gBACX,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,0CAA0C,MAAM,qBAAqB,CACtE,CAAC;gBACF,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,CAAC;QACH,CAAC,EAAE,MAAM,CAAC,CAAC;QACX,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;CACF;AA3SD,8BA2SC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,6EAA6E;IAC7E,4EAA4E;IAC5E,6EAA6E;IAC7E,qDAAqD;IACrD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,GAAG,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC;AAED,wBAAwB;AACxB,yCAA6C;AAApC,2GAAA,cAAc,OAAA;AACvB,iCAA6C;AAApC,8FAAA,KAAK,OAAA;AAAE,oGAAA,WAAW,OAAA;AAC3B,0DAA0D;AAC1D,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,qCAAoD;AAA3C,kHAAA,uBAAuB,OAAA"}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* tools (node/search/callers/…) stay defined and are re-enablable via
|
|
18
18
|
* CODEGRAPH_MCP_TOOLS, but they are NOT listed to agents, so don't name them.
|
|
19
19
|
*/
|
|
20
|
-
export declare const SERVER_INSTRUCTIONS = "# Codegraph \u2014 code intelligence over an indexed knowledge graph\n\nCodegraph is a SQLite knowledge graph of every symbol, edge, and file in\nthe workspace \u2014 pre-computed structure you would otherwise re-derive by\nreading files (cached intelligence: thousands of parse/trace decisions you\ndon't pay to re-reason each run). Reads are sub-millisecond; the index lags\nwrites by ~1s through the file watcher. Reach for it BEFORE *and* while\nwriting or editing code \u2014 not just for questions: one call returns the\nverbatim source PLUS who calls it and what it affects, so you edit with the\nblast radius in view. More accurate context, in far fewer tokens and\nround-trips than reading files yourself.\n\n## One tool: codegraph_explore \u2014 use it instead of reading files\n\nThere is a single tool, `codegraph_explore`, and it is Read-equivalent. It\ntakes either a natural-language question or a bag of symbol/file names and\nreturns the **verbatim, line-numbered source** of the relevant symbols\ngrouped by file \u2014 the same `<n>\\t<line>` shape `Read` gives you, safe to\n`Edit` from \u2014 PLUS the call path among them (including dynamic-dispatch hops\nlike callbacks, React re-render, and JSX children that grep can't follow) and\na blast-radius summary of what depends on them.\n\nWhether you're answering \"how does X work\" or implementing a change (fixing a\nbug, adding a feature), call `codegraph_explore` before you Read. ONE call\nusually answers the whole question. Codegraph IS the pre-built search index \u2014\nso running your own grep + read loop, or delegating the lookup to a separate\nfile-reading sub-task/agent, repeats work codegraph already did and costs more\nfor the same answer. A direct codegraph answer is typically one to a few\ncalls; a grep/read exploration is dozens.\n\n## How to query\n\n- **Almost any question \u2014 \"how does X work\", architecture, a bug, \"what/where is X\", or surveying an area** \u2192 `codegraph_explore` with a natural-language question or the relevant names. ONE capped call returns the verbatim source grouped by file; most often the ONLY call you need.\n- **\"How does X reach/become Y? / the flow / the path from X to Y\"** \u2192 `codegraph_explore`, naming the symbols that span the flow (e.g. `mutateElement renderScene`) \u2014 it surfaces the call path among them, riding dynamic-dispatch hops, and returns their source.\n- **Reading or editing a file/symbol you can name** \u2192 put its name or file path in the `codegraph_explore` query \u2014 it returns that current line-numbered source (safe to `Edit` from) with the call path and blast radius attached, so you don't Read it separately. For an overloaded name it returns every matching definition's body in one call.\n- **Need more?** Call `codegraph_explore` again with more specific names \u2014 treat the source it returns as already Read.\n\n## Anti-patterns\n\n- **Trust codegraph's results \u2014 don't re-verify them with grep.** They come from a full AST parse; re-checking with grep is slower, less accurate, and wastes context.\n- **Don't grep or Read first** to find or understand indexed code \u2014 ONE `codegraph_explore` returns the relevant symbols' source together in a single round-trip. Reach for raw `Read`/`Grep` only to confirm a specific detail codegraph didn't cover, or for what codegraph doesn't index (configs, docs).\n- **Don't reconstruct a flow by hand** \u2014 name the endpoints in one `codegraph_explore` and it surfaces the path between them, dynamic-dispatch hops included.\n- **After editing, check the staleness banner.** When a tool response starts with \"\u26A0\uFE0F Some files referenced below were edited since the last index sync\u2026\", the listed files are pending re-index \u2014 Read those specific files for accurate content. Every file NOT in that banner is fresh, so still trust codegraph. A different, rarer banner \u2014 \"\u26A0\uFE0F CodeGraph auto-sync is DISABLED\u2026\" \u2014 means live watching stopped entirely (the whole index is frozen, not just a few files); until it's resolved, Read files directly to confirm anything that may have changed.\n\n## Limitations\n\n- If a tool reports a project isn't indexed (no `.codegraph/`), stop calling codegraph tools for that project for the rest of the session and use your built-in tools there instead. Indexing is the user's decision \u2014 mention they can run `codegraph init` if it comes up, but don't run it yourself.\n- Index lags file writes by ~1 second.\n- Cross-file resolution is best-effort name matching; ambiguous calls may return multiple candidates.\n- No live correctness validation \u2014 that's still the TypeScript compiler / test suite / linter's job. Codegraph supplements those with structural context they don't have.\n\n## Supported Languages\n\nThe indexer recognizes a fixed set of languages; if you ask about symbols in a\nfile with an unsupported extension, codegraph will report the project isn't\nindexed for that file and you should fall back to Read/Grep. The fork-specific\naddition beyond upstream codegraph is **VBA / Access** (Dysflow export\nformat):\n\n- **VBA / Access** - Dysflow exports Access/VBA source as `.bas`/`.cls`/\n `.form.txt`/`.report.txt`. Codegraph extracts `.bas`/`.cls` as `module`/\n `class`/`function` nodes with `calls`/`implements`/`references` edges\n (procedural-level; regex-based, not full AST). Cross-module calls, qualified\n `Dim As`, `WithEvents`, and SQL table references inside string literals\n emit synthesized edges tagged `metadata.synthesizedBy` (`vba-name-resolution`,\n `vba-withevents`, `vba-sql-table`). `.form.txt` and `.report.txt` are\n extracted as a `module` plus one `property` per Access control - **no**\n `function`/`sub`/`class` nodes come from form files; the canonical code\n lives in the sibling `.cls`, parsed by the same extractor on that file.\n Dysflow test manifests (`tests.*.json`) link each registered `Test_*`\n procedure to its manifest with a `references` edge tagged\n `vba-test-manifest` carrying the test name + tags, so `getCallers` of a\n production symbol reaches its covering test atoms with the manifest and tags\n to run.\n Pass `projectPath` to a codegraph index that includes VBA files.\n";
|
|
20
|
+
export declare const SERVER_INSTRUCTIONS = "# Codegraph \u2014 code intelligence over an indexed knowledge graph\n\nCodegraph is a SQLite knowledge graph of every symbol, edge, and file in\nthe workspace \u2014 pre-computed structure you would otherwise re-derive by\nreading files (cached intelligence: thousands of parse/trace decisions you\ndon't pay to re-reason each run). Reads are sub-millisecond; the index lags\nwrites by ~1s through the file watcher. Reach for it BEFORE *and* while\nwriting or editing code \u2014 not just for questions: one call returns the\nverbatim source PLUS who calls it and what it affects, so you edit with the\nblast radius in view. More accurate context, in far fewer tokens and\nround-trips than reading files yourself.\n\n## One tool: codegraph_explore \u2014 use it instead of reading files\n\nThere is a single tool, `codegraph_explore`, and it is Read-equivalent. It\ntakes either a natural-language question or a bag of symbol/file names and\nreturns the **verbatim, line-numbered source** of the relevant symbols\ngrouped by file \u2014 the same `<n>\\t<line>` shape `Read` gives you, safe to\n`Edit` from \u2014 PLUS the call path among them (including dynamic-dispatch hops\nlike callbacks, React re-render, and JSX children that grep can't follow) and\na blast-radius summary of what depends on them.\n\nWhether you're answering \"how does X work\" or implementing a change (fixing a\nbug, adding a feature), call `codegraph_explore` before you Read. ONE call\nusually answers the whole question. Codegraph IS the pre-built search index \u2014\nso running your own grep + read loop, or delegating the lookup to a separate\nfile-reading sub-task/agent, repeats work codegraph already did and costs more\nfor the same answer. A direct codegraph answer is typically one to a few\ncalls; a grep/read exploration is dozens.\n\n## How to query\n\n- **Almost any question \u2014 \"how does X work\", architecture, a bug, \"what/where is X\", or surveying an area** \u2192 `codegraph_explore` with a natural-language question or the relevant names. ONE capped call returns the verbatim source grouped by file; most often the ONLY call you need.\n- **\"How does X reach/become Y? / the flow / the path from X to Y\"** \u2192 `codegraph_explore`, naming the symbols that span the flow (e.g. `mutateElement renderScene`) \u2014 it surfaces the call path among them, riding dynamic-dispatch hops, and returns their source.\n- **Reading or editing a file/symbol you can name** \u2192 put its name or file path in the `codegraph_explore` query \u2014 it returns that current line-numbered source (safe to `Edit` from) with the call path and blast radius attached, so you don't Read it separately. For an overloaded name it returns every matching definition's body in one call.\n- **Need more?** Call `codegraph_explore` again with more specific names \u2014 treat the source it returns as already Read.\n\n## Anti-patterns\n\n- **Trust codegraph's results \u2014 don't re-verify them with grep.** They come from a full AST parse; re-checking with grep is slower, less accurate, and wastes context.\n- **Don't grep or Read first** to find or understand indexed code \u2014 ONE `codegraph_explore` returns the relevant symbols' source together in a single round-trip. Reach for raw `Read`/`Grep` only to confirm a specific detail codegraph didn't cover, or for what codegraph doesn't index (configs, docs).\n- **Don't reconstruct a flow by hand** \u2014 name the endpoints in one `codegraph_explore` and it surfaces the path between them, dynamic-dispatch hops included.\n- **After editing, check the staleness banner.** When a tool response starts with \"\u26A0\uFE0F Some files referenced below were edited since the last index sync\u2026\", the listed files are pending re-index \u2014 Read those specific files for accurate content. Every file NOT in that banner is fresh, so still trust codegraph. A different, rarer banner \u2014 \"\u26A0\uFE0F CodeGraph auto-sync is DISABLED\u2026\" \u2014 means live watching stopped entirely (the whole index is frozen, not just a few files); until it's resolved, Read files directly to confirm anything that may have changed.\n\n## Limitations\n\n- If a tool reports a project isn't indexed (no `.codegraph/`), stop calling codegraph tools for that project for the rest of the session and use your built-in tools there instead. Indexing is the user's decision \u2014 mention they can run `codegraph init` if it comes up, but don't run it yourself.\n- Index lags file writes by ~1 second.\n- Cross-file resolution is best-effort name matching; ambiguous calls may return multiple candidates.\n- No live correctness validation \u2014 that's still the TypeScript compiler / test suite / linter's job. Codegraph supplements those with structural context they don't have.\n\n## Supported Languages\n\nThe indexer recognizes a fixed set of languages; if you ask about symbols in a\nfile with an unsupported extension, codegraph will report the project isn't\nindexed for that file and you should fall back to Read/Grep. The fork-specific\naddition beyond upstream codegraph is **VBA / Access** (Dysflow export\nformat):\n\n- **VBA / Access** - Dysflow exports Access/VBA source as `.bas`/`.cls`/\n `.form.txt`/`.report.txt`. Codegraph extracts `.bas`/`.cls` as `module`/\n `class`/`function` nodes with `calls`/`implements`/`references` edges\n (procedural-level; regex-based, not full AST). Cross-module calls, qualified\n `Dim As`, `WithEvents`, and SQL table references inside string literals\n emit synthesized edges tagged `metadata.synthesizedBy` (`vba-name-resolution`,\n `vba-withevents`, `vba-sql-table`). `.form.txt` and `.report.txt` are\n extracted as a `module` plus one `property` per Access control - **no**\n `function`/`sub`/`class` nodes come from form files; the canonical code\n lives in the sibling `.cls`, parsed by the same extractor on that file.\n Dysflow test manifests (`tests.*.json`) link each registered `Test_*`\n procedure to its manifest with a `references` edge tagged\n `vba-test-manifest` carrying the test name + tags, so `getCallers` of a\n production symbol reaches its covering test atoms with the manifest and tags\n to run.\n Pass `projectPath` to a codegraph index that includes VBA files.\n- **VBA unresolved refs carry syntactic shape** (v1.7+). `unresolved_refs.reference_kind` is no longer the literal string `\"references\"` \u2014 it reports what the syntactic shape actually was. Values: `call` (paren-form or statement-form call site), `qualified-call` (`obj.Foo(...)` with runtime receiver), `property-get` / `property-set` (`Me.Name`, `obj.Prop = value`), `bang-get` / `bang-set` (`Me!SubCtl`, `obj!Field = value`), `unqualified-ident` (bare identifier like `HayErrorEnRiesgo` in an `If` condition), `member-with` (`.Member` inside a `With` block), `dao-query` (`DoCmd.OpenQuery \"X\"` argument). The legacy value `references` is retained on any path the round did not reclassify, so older SQL filters that key on it keep working. To find real missing callees, filter `WHERE reference_kind IN ('call','qualified-call','unqualified-ident','member-with','bang-get')` \u2014 that set has <10% false positives (DAO-field accesses, form-property reads, and bang refs no longer pollute the bucket).\n- **Post-extraction stub resolver** (v1.7+). Edges with `metadata.synthesizedBy='vba-name-resolution'` start life pointing at a synthetic function node; the resolver at `src/resolution/index.ts:resolveVbaCallStubs` (invoked from `indexAll` and `sync`) walks them and repoints each `target` to the real `nodes.id` when one exists. Runtime-object calls (`DAO.*`, `fso.*`, `ListBox.*`, `Collection.*`, `err.*`, `VBA.*`, `Application.*`, `Screen.*`, `DoCmd.*`, `CurrentDb.*`, `Forms`, `Reports`, `Debug`, `Modules`, `References`, `CommandBars`, `SysCmd`, `CreateObject`, `GetObject`, `Fields`) are explicitly declined \u2014 they remain `stub:true` because they can never link to user code. Shadow user classes (e.g. a user class actually named `DAO` with an `Execute` method) are preserved and linked normally. Every stub edge carries `metadata.repointDecision` with one of `reponted-to-real` (linked to a real `nodes.id`), `declined-runtime` (runtime object \u2014 never user code, filter OUT), `declined-ambiguous` (multiple real candidates \u2014 investigate), or `declined-not-found` (genuinely missing callee \u2014 this is the actionable signal). Consumers detecting \"missing callees\" MUST filter on `repointDecision='declined-not-found'`, NOT on the raw `stub=true` count \u2014 the raw count is dominated by runtime-object noise. See `docs/vba-stub-repoint-decision.md` for the full contract.\n";
|
|
21
21
|
/**
|
|
22
22
|
* Instructions variant sent when the server's own root has NO codegraph index.
|
|
23
23
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-instructions.d.ts","sourceRoot":"","sources":["../../src/mcp/server-instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"server-instructions.d.ts","sourceRoot":"","sources":["../../src/mcp/server-instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,mBAAmB,s/QA6E/B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iCAAiC,4pCAmB7C,CAAC"}
|
|
@@ -95,6 +95,8 @@ format):
|
|
|
95
95
|
production symbol reaches its covering test atoms with the manifest and tags
|
|
96
96
|
to run.
|
|
97
97
|
Pass \`projectPath\` to a codegraph index that includes VBA files.
|
|
98
|
+
- **VBA unresolved refs carry syntactic shape** (v1.7+). \`unresolved_refs.reference_kind\` is no longer the literal string \`"references"\` — it reports what the syntactic shape actually was. Values: \`call\` (paren-form or statement-form call site), \`qualified-call\` (\`obj.Foo(...)\` with runtime receiver), \`property-get\` / \`property-set\` (\`Me.Name\`, \`obj.Prop = value\`), \`bang-get\` / \`bang-set\` (\`Me!SubCtl\`, \`obj!Field = value\`), \`unqualified-ident\` (bare identifier like \`HayErrorEnRiesgo\` in an \`If\` condition), \`member-with\` (\`.Member\` inside a \`With\` block), \`dao-query\` (\`DoCmd.OpenQuery "X"\` argument). The legacy value \`references\` is retained on any path the round did not reclassify, so older SQL filters that key on it keep working. To find real missing callees, filter \`WHERE reference_kind IN ('call','qualified-call','unqualified-ident','member-with','bang-get')\` — that set has <10% false positives (DAO-field accesses, form-property reads, and bang refs no longer pollute the bucket).
|
|
99
|
+
- **Post-extraction stub resolver** (v1.7+). Edges with \`metadata.synthesizedBy='vba-name-resolution'\` start life pointing at a synthetic function node; the resolver at \`src/resolution/index.ts:resolveVbaCallStubs\` (invoked from \`indexAll\` and \`sync\`) walks them and repoints each \`target\` to the real \`nodes.id\` when one exists. Runtime-object calls (\`DAO.*\`, \`fso.*\`, \`ListBox.*\`, \`Collection.*\`, \`err.*\`, \`VBA.*\`, \`Application.*\`, \`Screen.*\`, \`DoCmd.*\`, \`CurrentDb.*\`, \`Forms\`, \`Reports\`, \`Debug\`, \`Modules\`, \`References\`, \`CommandBars\`, \`SysCmd\`, \`CreateObject\`, \`GetObject\`, \`Fields\`) are explicitly declined — they remain \`stub:true\` because they can never link to user code. Shadow user classes (e.g. a user class actually named \`DAO\` with an \`Execute\` method) are preserved and linked normally. Every stub edge carries \`metadata.repointDecision\` with one of \`reponted-to-real\` (linked to a real \`nodes.id\`), \`declined-runtime\` (runtime object — never user code, filter OUT), \`declined-ambiguous\` (multiple real candidates — investigate), or \`declined-not-found\` (genuinely missing callee — this is the actionable signal). Consumers detecting "missing callees" MUST filter on \`repointDecision='declined-not-found'\`, NOT on the raw \`stub=true\` count — the raw count is dominated by runtime-object noise. See \`docs/vba-stub-repoint-decision.md\` for the full contract.
|
|
98
100
|
`;
|
|
99
101
|
/**
|
|
100
102
|
* Instructions variant sent when the server's own root has NO codegraph index.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-instructions.js","sourceRoot":"","sources":["../../src/mcp/server-instructions.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACU,QAAA,mBAAmB,GAAG
|
|
1
|
+
{"version":3,"file":"server-instructions.js","sourceRoot":"","sources":["../../src/mcp/server-instructions.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACU,QAAA,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6ElC,CAAC;AAEF;;;;;;;;;;;GAWG;AACU,QAAA,iCAAiC,GAAG;;;;;;;;;;;;;;;;;;;CAmBhD,CAAC"}
|
|
@@ -7,6 +7,18 @@ import { UnresolvedReference, Edge } from '../types';
|
|
|
7
7
|
import { QueryBuilder } from '../db/queries';
|
|
8
8
|
import { UnresolvedRef, ResolvedRef, ResolutionResult } from './types';
|
|
9
9
|
import { type MaybeYield } from './cooperative-yield';
|
|
10
|
+
/**
|
|
11
|
+
* Outcome of resolving a single VBA call-stub (issue #110). Recorded on the
|
|
12
|
+
* stub's incoming `calls` edge as `metadata.repointDecision` for
|
|
13
|
+
* observability so a consumer can tell a runtime-object decline apart from a
|
|
14
|
+
* genuinely-missing callee:
|
|
15
|
+
* - `reponted-to-real` — a real user target was found; edge repointed (stub:false).
|
|
16
|
+
* - `declined-runtime` — receiver is a runtime object with no user shadow; kept stub:true.
|
|
17
|
+
* - `declined-ambiguous` — 2+ real candidates; can't safely pick one; kept stub:true.
|
|
18
|
+
* - `declined-not-found` — no real target and not a runtime object (genuine miss); kept stub:true.
|
|
19
|
+
* (The `reponted-to-real` spelling is the wire value consumers already key on.)
|
|
20
|
+
*/
|
|
21
|
+
export type RepointDecision = 'reponted-to-real' | 'declined-runtime' | 'declined-ambiguous' | 'declined-not-found';
|
|
10
22
|
export * from './types';
|
|
11
23
|
/**
|
|
12
24
|
* Reference Resolver
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resolution/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAkB,mBAAmB,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resolution/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAkB,mBAAmB,EAAE,IAAI,EAAqB,MAAM,UAAU,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EACL,aAAa,EACb,WAAW,EACX,gBAAgB,EAIjB,MAAM,SAAS,CAAC;AAKjB,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AASrE;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GACvB,kBAAkB,GAClB,kBAAkB,GAClB,oBAAoB,GACpB,oBAAoB,CAAC;AA6CzB,cAAc,SAAS,CAAC;AAkIxB;;;;GAIG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,UAAU,CAA2B;IAM7C,OAAO,CAAC,iBAAiB,CAAuB;IAKhD,OAAO,CAAC,sBAAsB,CAAuB;IAIrD,OAAO,CAAC,gBAAgB,CAA+B;IAIvD,OAAO,CAAC,SAAS,CAA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AAC,YAAY;IASpB;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,qBAAqB;CAO9B;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,iBAAiB,CAI5F"}
|
|
@@ -45,6 +45,7 @@ exports.ReferenceResolver = void 0;
|
|
|
45
45
|
exports.createResolver = createResolver;
|
|
46
46
|
const fs = __importStar(require("fs"));
|
|
47
47
|
const path = __importStar(require("path"));
|
|
48
|
+
const types_1 = require("../types");
|
|
48
49
|
const name_matcher_1 = require("./name-matcher");
|
|
49
50
|
const import_resolver_1 = require("./import-resolver");
|
|
50
51
|
const frameworks_1 = require("./frameworks");
|
|
@@ -55,6 +56,7 @@ const go_module_1 = require("./go-module");
|
|
|
55
56
|
const workspace_packages_1 = require("./workspace-packages");
|
|
56
57
|
const errors_1 = require("../errors");
|
|
57
58
|
const lru_cache_1 = require("./lru-cache");
|
|
59
|
+
const vba_runtime_objects_1 = require("./vba-runtime-objects");
|
|
58
60
|
/** Node kinds that can declare supertypes (extends/implements). */
|
|
59
61
|
const SUPERTYPE_BEARING_KINDS = new Set([
|
|
60
62
|
'class', 'struct', 'interface', 'trait', 'protocol', 'enum',
|
|
@@ -920,7 +922,21 @@ class ReferenceResolver {
|
|
|
920
922
|
// by metadata.resolvedBy === 'function-ref'. callers/impact already
|
|
921
923
|
// traverse `references`, so registration sites surface with no
|
|
922
924
|
// graph-layer changes.
|
|
923
|
-
|
|
925
|
+
//
|
|
926
|
+
// Round-3 (issue #108): the new shape-based classifiers
|
|
927
|
+
// (`call`, `qualified-call`, `property-get`, …) are unresolved-ref
|
|
928
|
+
// metadata — the SQL filter `WHERE reference_kind IN (...)` keys off
|
|
929
|
+
// them. Edge shape still uses `EdgeKind` (the row-level kind is the
|
|
930
|
+
// `calls`/`references` family), so any non-EdgeKind literal falls
|
|
931
|
+
// back to `'references'` here. The shape is preserved on the
|
|
932
|
+
// unresolved-ref row and on `edge.metadata.synthesizedBy` already,
|
|
933
|
+
// so graph traversal isn't affected.
|
|
934
|
+
const refKind = ref.original.referenceKind;
|
|
935
|
+
let kind = refKind === 'function_ref'
|
|
936
|
+
? 'references'
|
|
937
|
+
: (0, types_1.isEdgeKindLiteral)(refKind)
|
|
938
|
+
? refKind
|
|
939
|
+
: 'references';
|
|
924
940
|
// Promote "extends" to "implements" when a class/struct targets an interface
|
|
925
941
|
if (kind === 'extends') {
|
|
926
942
|
const targetNode = this.queries.getNodeById(ref.targetNodeId);
|
|
@@ -1777,12 +1793,24 @@ class ReferenceResolver {
|
|
|
1777
1793
|
const seenTuples = new Set();
|
|
1778
1794
|
let repointedCount = 0;
|
|
1779
1795
|
for (const stub of stubs) {
|
|
1780
|
-
const
|
|
1796
|
+
const resolution = this.resolveVbaCallStubTarget(stub, stubIds);
|
|
1781
1797
|
const incoming = this.queries.getIncomingEdges(stub.id, ['calls']);
|
|
1782
|
-
if (!target) {
|
|
1783
|
-
//
|
|
1798
|
+
if (resolution.decision !== 'reponted-to-real' || !resolution.target) {
|
|
1799
|
+
// #110: declined — stamp WHY on each incoming edge for observability
|
|
1800
|
+
// (runtime-object vs ambiguous vs genuine miss) and keep the edge
|
|
1801
|
+
// `stub:true` pointing at the synthetic node. Re-pointing the edge to
|
|
1802
|
+
// its EXISTING target is a metadata-only update. The stub node stays
|
|
1803
|
+
// in the graph as the (still-unresolved) call target; a consumer's
|
|
1804
|
+
// `stub=true` lint now sees a clean, classified signal.
|
|
1805
|
+
for (const edge of incoming) {
|
|
1806
|
+
if (edge.id === undefined)
|
|
1807
|
+
continue;
|
|
1808
|
+
const meta = { ...(edge.metadata ?? {}), repointDecision: resolution.decision };
|
|
1809
|
+
this.queries.repointEdgeTarget(edge.id, edge.target, JSON.stringify(meta));
|
|
1810
|
+
}
|
|
1784
1811
|
continue;
|
|
1785
1812
|
}
|
|
1813
|
+
const target = resolution.target;
|
|
1786
1814
|
for (const edge of incoming) {
|
|
1787
1815
|
if (edge.id === undefined)
|
|
1788
1816
|
continue; // defensive — DB reads always set it
|
|
@@ -1797,8 +1825,8 @@ class ReferenceResolver {
|
|
|
1797
1825
|
seenTuples.add(tupleKey);
|
|
1798
1826
|
// F5: clear the stub flag but KEEP synthesizedBy/receiverType/member
|
|
1799
1827
|
// — the edge is still a heuristic VBA-name-resolution edge, just no
|
|
1800
|
-
// longer a dead end.
|
|
1801
|
-
const meta = { ...(edge.metadata ?? {}), stub: false };
|
|
1828
|
+
// longer a dead end. #110: record the repoint decision too.
|
|
1829
|
+
const meta = { ...(edge.metadata ?? {}), stub: false, repointDecision: 'reponted-to-real' };
|
|
1802
1830
|
this.queries.repointEdgeTarget(edge.id, target.id, JSON.stringify(meta));
|
|
1803
1831
|
repointedCount++;
|
|
1804
1832
|
}
|
|
@@ -1879,28 +1907,36 @@ class ReferenceResolver {
|
|
|
1879
1907
|
!stubIds.has(n.id) &&
|
|
1880
1908
|
n.kind === 'function' &&
|
|
1881
1909
|
n.language === 'vba';
|
|
1910
|
+
// `stub.qualifiedName` is `${receiver}.${member}`. The receiver drives the
|
|
1911
|
+
// runtime-object classification when no real target is found (#110).
|
|
1912
|
+
const dot = stub.qualifiedName.indexOf('.');
|
|
1913
|
+
const receiver = dot > 0 ? stub.qualifiedName.slice(0, dot) : stub.qualifiedName;
|
|
1914
|
+
// #110: the two-step name resolution runs FIRST. A runtime-object receiver
|
|
1915
|
+
// that ALSO has a real user declaration (a "shadow" class/module named,
|
|
1916
|
+
// e.g., `DAO`) is repointed here like any other real symbol (FR-2.1) — so
|
|
1917
|
+
// the runtime-object skip below only fires when NO real target exists,
|
|
1918
|
+
// which is exactly the noise the consumer's `stub=true` lint wants gone.
|
|
1919
|
+
const decline = () => ({
|
|
1920
|
+
decision: (0, vba_runtime_objects_1.isRuntimeObject)(receiver) ? 'declined-runtime' : 'declined-not-found',
|
|
1921
|
+
});
|
|
1882
1922
|
// Step 1: exact qualifiedName match (class-typed stubs land here — see
|
|
1883
1923
|
// #12a's resolved-type rename).
|
|
1884
1924
|
const exact = this.queries
|
|
1885
1925
|
.getNodesByQualifiedNameExact(stub.qualifiedName)
|
|
1886
1926
|
.filter(isRealCandidate);
|
|
1887
1927
|
if (exact.length === 1)
|
|
1888
|
-
return exact[0];
|
|
1928
|
+
return { decision: 'reponted-to-real', target: exact[0] };
|
|
1889
1929
|
if (exact.length >= 2)
|
|
1890
|
-
return
|
|
1891
|
-
// Step 2: `.bas`-qualified fallback. `
|
|
1892
|
-
// `${receiver}.${member}` where `receiver` didn't resolve to a
|
|
1930
|
+
return { decision: 'declined-ambiguous' };
|
|
1931
|
+
// Step 2: `.bas`-qualified fallback. The `receiver` didn't resolve to a
|
|
1893
1932
|
// project-class type at extraction time (kept as raw receiver text —
|
|
1894
1933
|
// the `.bas`-qualified-call case, since the extractor's
|
|
1895
|
-
// `resolveReceiverType` only substitutes for DECLARED local class
|
|
1896
|
-
// vars).
|
|
1897
|
-
const dot = stub.qualifiedName.indexOf('.');
|
|
1934
|
+
// `resolveReceiverType` only substitutes for DECLARED local class vars).
|
|
1898
1935
|
if (dot <= 0)
|
|
1899
|
-
return
|
|
1900
|
-
const receiver = stub.qualifiedName.slice(0, dot);
|
|
1936
|
+
return decline();
|
|
1901
1937
|
const member = stub.qualifiedName.slice(dot + 1);
|
|
1902
1938
|
if (!member)
|
|
1903
|
-
return
|
|
1939
|
+
return decline();
|
|
1904
1940
|
// Bare-name candidates in ANY `.bas` file — real `.bas` function
|
|
1905
1941
|
// qualifiedNames carry no module prefix (unlike `.cls` methods), so a
|
|
1906
1942
|
// bare-name lookup is the only way to find them.
|
|
@@ -1908,7 +1944,7 @@ class ReferenceResolver {
|
|
|
1908
1944
|
.getNodesByName(member)
|
|
1909
1945
|
.filter((n) => isRealCandidate(n) && n.filePath.toLowerCase().endsWith('.bas'));
|
|
1910
1946
|
if (memberCandidates.length === 0)
|
|
1911
|
-
return
|
|
1947
|
+
return decline();
|
|
1912
1948
|
// Narrow to the `.bas` file(s) whose module identity (VB_Name, i.e. the
|
|
1913
1949
|
// sibling `module` node's name) equals `receiver`, case-insensitive —
|
|
1914
1950
|
// `.bas` calls are always `Module.Member`, so `receiver` IS the target
|
|
@@ -1918,11 +1954,13 @@ class ReferenceResolver {
|
|
|
1918
1954
|
.filter((n) => n.kind === 'module' && n.language === 'vba')
|
|
1919
1955
|
.map((n) => n.filePath));
|
|
1920
1956
|
if (moduleFiles.size === 0)
|
|
1921
|
-
return
|
|
1957
|
+
return decline();
|
|
1922
1958
|
const narrowed = memberCandidates.filter((n) => moduleFiles.has(n.filePath));
|
|
1923
1959
|
if (narrowed.length === 1)
|
|
1924
|
-
return narrowed[0];
|
|
1925
|
-
|
|
1960
|
+
return { decision: 'reponted-to-real', target: narrowed[0] };
|
|
1961
|
+
if (narrowed.length >= 2)
|
|
1962
|
+
return { decision: 'declined-ambiguous' };
|
|
1963
|
+
return decline(); // 0 after narrowing — runtime-object or genuine miss
|
|
1926
1964
|
}
|
|
1927
1965
|
gateLanguage(result, ref) {
|
|
1928
1966
|
if (!result)
|