docdex 0.2.43 → 0.2.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -2
- package/README.md +2 -1
- package/assets/agents.md +44 -1
- package/lib/postinstall_setup.js +70 -32
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 0.2.
|
|
3
|
+
## 0.2.45
|
|
4
|
+
- Update packaged agent docs with FD-hardening guidance and bump release metadata to 0.2.45.
|
|
5
|
+
|
|
6
|
+
## 0.2.44
|
|
4
7
|
- Fix MCP tool schema compatibility with Claude Code by removing top-level anyOf from `docdex_dag_export`.
|
|
5
|
-
- Bump release metadata to 0.2.
|
|
8
|
+
- Bump release metadata to 0.2.44.
|
|
6
9
|
|
|
7
10
|
## 0.2.42
|
|
8
11
|
- Bump release metadata to 0.2.42.
|
package/README.md
CHANGED
|
@@ -231,8 +231,9 @@ DOCDEX_OLLAMA_BASE_URL=http://127.0.0.1:11434 docdexd daemon --host 127.0.0.1 --
|
|
|
231
231
|
Docdex runs as a local daemon serving:
|
|
232
232
|
|
|
233
233
|
* **CLI Commands:** `docdexd chat`
|
|
234
|
-
* **HTTP API:** `/search`, `/v1/ast`, `/v1/graph/impact`
|
|
234
|
+
* **HTTP API:** `/search`, `/v1/capabilities`, `/v1/search/rerank`, `/v1/search/batch`, `/v1/ast`, `/v1/graph/impact`
|
|
235
235
|
* **MCP Endpoints:** `/v1/mcp` and `/v1/mcp/sse`
|
|
236
|
+
* **Capability Negotiation Tools:** `docdex_capabilities`, `docdex_rerank`, `docdex_batch_search`
|
|
236
237
|
|
|
237
238
|
### Multi-Repo Setup
|
|
238
239
|
|
package/assets/agents.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
---- START OF DOCDEX INFO V0.2.
|
|
1
|
+
---- START OF DOCDEX INFO V0.2.45 ----
|
|
2
2
|
Docdex URL: http://127.0.0.1:28491
|
|
3
3
|
Use this base URL for Docdex HTTP endpoints.
|
|
4
4
|
Health check endpoint: `GET /healthz` (not `/v1/health`).
|
|
@@ -16,6 +16,7 @@ Health check endpoint: `GET /healthz` (not `/v1/health`).
|
|
|
16
16
|
- When a Docdex feature makes a task easier/safer, you MUST use it instead of ad-hoc inspection. Examples: `docdex_search` for context, `docdex_open`/`/v1/snippet` for file slices, `docdex_symbols`/`docdex_ast` for structure, `docdex_impact_graph`/`docdex_impact_diagnostics` for dependency safety, and `docdex_dag_export` to review session traces.
|
|
17
17
|
- For dependency/library docs, run `docdexd libs discover`/`docdexd libs fetch` and search with `include_libs` rather than web searching.
|
|
18
18
|
- For test execution, use `docdexd run-tests` (or `docdexd test run-node`) instead of ad-hoc commands when feasible.
|
|
19
|
+
- For daemon stability triage, prioritize FD hardening checks: startup nofile warning threshold (`DOCDEX_MIN_NOFILE_SOFT`), profile lock retry knobs (`DOCDEX_PROFILE_LOCK_MAX_ATTEMPTS`, `DOCDEX_PROFILE_LOCK_RETRY_BASE_MS`), installer pressure defaults (`DOCDEX_REPO_IDLE_SECONDS`, `DOCDEX_REPO_HIBERNATE_SECONDS`, `DOCDEX_REPO_CLEANUP_INTERVAL_SECONDS`), and `docs/ops/fd_exhaustion_playbook.md`.
|
|
19
20
|
- For staged-change validation, use `docdexd hook pre-commit`.
|
|
20
21
|
- For MCP client registration, use `docdexd mcp add` (or `--all`) instead of editing configs by hand.
|
|
21
22
|
|
|
@@ -146,6 +147,10 @@ Use these to verify index coverage, repo binding, and to read precise file slice
|
|
|
146
147
|
- docdex_impact_graph: Mandatory before code changes to review inbound/outbound deps (use MCP/IPC if shell networking is blocked).
|
|
147
148
|
- docdex_dag_export: Export dependency graph to plan change order.
|
|
148
149
|
- HTTP /v1/initialize: Mount/bind a repo for HTTP daemon mode. Request JSON uses rootUri/root_uri (NOT repo_root).
|
|
150
|
+
- HTTP /v1/capabilities: Read optional retrieval feature flags and bounded limits before using optional flows.
|
|
151
|
+
- HTTP /v1/search/rerank: Rerank a candidate hit set; use when capability negotiation says rerank is available.
|
|
152
|
+
- HTTP /v1/search/batch: Execute bounded multi-query retrieval in one request.
|
|
153
|
+
- MCP tools `docdex_capabilities`, `docdex_rerank`, `docdex_batch_search`: optional capability/flow surfaces for Codali integration.
|
|
149
154
|
- HTTP /v1/snippet: Fetch exact line-safe snippets for a doc_id returned by search.
|
|
150
155
|
- HTTP /v1/impact/diagnostics: Inspect unresolved/dynamic imports when impact graphs look incomplete.
|
|
151
156
|
|
|
@@ -222,6 +227,41 @@ Notes:
|
|
|
222
227
|
- `skip_local_search=true` effectively forces web discovery (Tier 2).
|
|
223
228
|
- If DOCDEX_WEB_ENABLED=1, web discovery can be slow; plan timeouts accordingly.
|
|
224
229
|
|
|
230
|
+
### 3a) Capabilities (HTTP)
|
|
231
|
+
|
|
232
|
+
`GET /v1/capabilities`
|
|
233
|
+
|
|
234
|
+
Returns the optional-feature capability contract and current limit values for retrieval extensions.
|
|
235
|
+
|
|
236
|
+
### 3b) Rerank (HTTP)
|
|
237
|
+
|
|
238
|
+
`POST /v1/search/rerank`
|
|
239
|
+
|
|
240
|
+
Required JSON fields:
|
|
241
|
+
- `query` (string)
|
|
242
|
+
- `candidates` (array of search hits)
|
|
243
|
+
|
|
244
|
+
Common optional fields:
|
|
245
|
+
- `limit`, `repo_id`
|
|
246
|
+
|
|
247
|
+
Notes:
|
|
248
|
+
- Candidate sets are deterministically truncated to the rerank limit exposed by `/v1/capabilities`.
|
|
249
|
+
- Response includes `returned_count`, `input_count`, `limit`, and `truncated`.
|
|
250
|
+
|
|
251
|
+
### 3c) Batch search (HTTP)
|
|
252
|
+
|
|
253
|
+
`POST /v1/search/batch`
|
|
254
|
+
|
|
255
|
+
Required JSON fields:
|
|
256
|
+
- `queries` (array of query strings)
|
|
257
|
+
|
|
258
|
+
Common optional fields:
|
|
259
|
+
- `limit`, `include_libs`, `repo_id`
|
|
260
|
+
|
|
261
|
+
Notes:
|
|
262
|
+
- Query lists are deterministically truncated to the batch limit exposed by `/v1/capabilities`.
|
|
263
|
+
- Response includes `query_count`, `effective_query_count`, `results`, and `truncated`.
|
|
264
|
+
|
|
225
265
|
### 4) Snippet (HTTP)
|
|
226
266
|
|
|
227
267
|
`GET /snippet/:doc_id`
|
|
@@ -263,6 +303,9 @@ Notes:
|
|
|
263
303
|
Do not guess fields; use these canonical shapes.
|
|
264
304
|
|
|
265
305
|
- `docdex_search`: `{ project_root, query, limit?, diff?, repo_only?, force_web? }`
|
|
306
|
+
- `docdex_capabilities`: `{ project_root? }`
|
|
307
|
+
- `docdex_rerank`: `{ project_root?, query, candidates, limit? }`
|
|
308
|
+
- `docdex_batch_search`: `{ project_root?, queries, limit?, include_libs? }`
|
|
266
309
|
- `docdex_open`: `{ project_root, path, start_line?, end_line?, head?, clamp? }` (range must be valid unless clamp/head used)
|
|
267
310
|
- `docdex_files`: `{ project_root, limit?, offset? }`
|
|
268
311
|
- `docdex_stats`: `{ project_root }`
|
package/lib/postinstall_setup.js
CHANGED
|
@@ -36,6 +36,16 @@ const AGENTS_DOC_FILENAME = "agents.md";
|
|
|
36
36
|
const DOCDEX_INFO_START_PREFIX = "---- START OF DOCDEX INFO V";
|
|
37
37
|
const DOCDEX_INFO_END = "---- END OF DOCDEX INFO -----";
|
|
38
38
|
const DOCDEX_INFO_END_LEGACY = "---- END OF DOCDEX INFO ----";
|
|
39
|
+
const LAUNCHD_NOFILE_SOFT = "65536";
|
|
40
|
+
const LAUNCHD_NOFILE_HARD = "200000";
|
|
41
|
+
const DAEMON_ENV_DEFAULTS = Object.freeze([
|
|
42
|
+
["DOCDEX_BROWSER_AUTO_INSTALL", "0"],
|
|
43
|
+
["DOCDEX_REPO_IDLE_SECONDS", "300"],
|
|
44
|
+
["DOCDEX_REPO_HIBERNATE_SECONDS", "1800"],
|
|
45
|
+
["DOCDEX_REPO_CLEANUP_INTERVAL_SECONDS", "60"],
|
|
46
|
+
["DOCDEX_WEB_MAX_CONCURRENT_BROWSER_FETCHES", "1"],
|
|
47
|
+
["DOCDEX_WEB_MAX_CONCURRENT_LLM", "1"]
|
|
48
|
+
]);
|
|
39
49
|
|
|
40
50
|
function defaultConfigPath() {
|
|
41
51
|
return path.join(os.homedir(), ".docdex", "config.toml");
|
|
@@ -2247,13 +2257,65 @@ function isTempPath(value, osModule = os) {
|
|
|
2247
2257
|
}
|
|
2248
2258
|
|
|
2249
2259
|
function buildDaemonEnvPairs() {
|
|
2250
|
-
return [[
|
|
2260
|
+
return DAEMON_ENV_DEFAULTS.map(([key, value]) => [key, value]);
|
|
2251
2261
|
}
|
|
2252
2262
|
|
|
2253
2263
|
function buildDaemonEnv() {
|
|
2254
2264
|
return Object.fromEntries(buildDaemonEnvPairs());
|
|
2255
2265
|
}
|
|
2256
2266
|
|
|
2267
|
+
function buildLaunchAgentPlist({
|
|
2268
|
+
programArgs,
|
|
2269
|
+
envPairs,
|
|
2270
|
+
workingDir,
|
|
2271
|
+
logDir,
|
|
2272
|
+
nofileSoft = LAUNCHD_NOFILE_SOFT,
|
|
2273
|
+
nofileHard = LAUNCHD_NOFILE_HARD
|
|
2274
|
+
} = {}) {
|
|
2275
|
+
const envVars = (envPairs || []).flatMap(([key, value]) => [
|
|
2276
|
+
` <key>${key}</key>\n`,
|
|
2277
|
+
` <string>${value}</string>\n`
|
|
2278
|
+
]);
|
|
2279
|
+
const args = (programArgs || []).map((arg) => ` <string>${arg}</string>\n`).join("");
|
|
2280
|
+
return `<?xml version="1.0" encoding="UTF-8"?>\n` +
|
|
2281
|
+
`<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n` +
|
|
2282
|
+
`<plist version="1.0">\n` +
|
|
2283
|
+
`<dict>\n` +
|
|
2284
|
+
` <key>Label</key>\n` +
|
|
2285
|
+
` <string>com.docdex.daemon</string>\n` +
|
|
2286
|
+
` <key>EnvironmentVariables</key>\n` +
|
|
2287
|
+
` <dict>\n` +
|
|
2288
|
+
envVars.join("") +
|
|
2289
|
+
` </dict>\n` +
|
|
2290
|
+
` <key>ProgramArguments</key>\n` +
|
|
2291
|
+
` <array>\n` +
|
|
2292
|
+
args +
|
|
2293
|
+
` </array>\n` +
|
|
2294
|
+
(workingDir
|
|
2295
|
+
? ` <key>WorkingDirectory</key>\n` + ` <string>${workingDir}</string>\n`
|
|
2296
|
+
: "") +
|
|
2297
|
+
` <key>RunAtLoad</key>\n` +
|
|
2298
|
+
` <true/>\n` +
|
|
2299
|
+
` <key>KeepAlive</key>\n` +
|
|
2300
|
+
` <true/>\n` +
|
|
2301
|
+
` <key>SoftResourceLimits</key>\n` +
|
|
2302
|
+
` <dict>\n` +
|
|
2303
|
+
` <key>NumberOfFiles</key>\n` +
|
|
2304
|
+
` <integer>${nofileSoft}</integer>\n` +
|
|
2305
|
+
` </dict>\n` +
|
|
2306
|
+
` <key>HardResourceLimits</key>\n` +
|
|
2307
|
+
` <dict>\n` +
|
|
2308
|
+
` <key>NumberOfFiles</key>\n` +
|
|
2309
|
+
` <integer>${nofileHard}</integer>\n` +
|
|
2310
|
+
` </dict>\n` +
|
|
2311
|
+
` <key>StandardOutPath</key>\n` +
|
|
2312
|
+
` <string>${path.join(logDir, "daemon.out.log")}</string>\n` +
|
|
2313
|
+
` <key>StandardErrorPath</key>\n` +
|
|
2314
|
+
` <string>${path.join(logDir, "daemon.err.log")}</string>\n` +
|
|
2315
|
+
`</dict>\n` +
|
|
2316
|
+
`</plist>\n`;
|
|
2317
|
+
}
|
|
2318
|
+
|
|
2257
2319
|
function escapeCmdArg(value) {
|
|
2258
2320
|
return `"${String(value).replace(/"/g, "\"\"")}"`;
|
|
2259
2321
|
}
|
|
@@ -2323,37 +2385,12 @@ function registerStartup({ binaryPath, port, repoRoot, logger, distBaseDir, star
|
|
|
2323
2385
|
const logDir = path.join(os.homedir(), ".docdex", "logs");
|
|
2324
2386
|
fs.mkdirSync(logDir, { recursive: true });
|
|
2325
2387
|
const programArgs = [binaryPath, ...args];
|
|
2326
|
-
const
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
`<plist version="1.0">\n` +
|
|
2333
|
-
`<dict>\n` +
|
|
2334
|
-
` <key>Label</key>\n` +
|
|
2335
|
-
` <string>com.docdex.daemon</string>\n` +
|
|
2336
|
-
` <key>EnvironmentVariables</key>\n` +
|
|
2337
|
-
` <dict>\n` +
|
|
2338
|
-
envVars.join("") +
|
|
2339
|
-
` </dict>\n` +
|
|
2340
|
-
` <key>ProgramArguments</key>\n` +
|
|
2341
|
-
` <array>\n` +
|
|
2342
|
-
programArgs.map((arg) => ` <string>${arg}</string>\n`).join("") +
|
|
2343
|
-
` </array>\n` +
|
|
2344
|
-
(workingDir
|
|
2345
|
-
? ` <key>WorkingDirectory</key>\n` + ` <string>${workingDir}</string>\n`
|
|
2346
|
-
: "") +
|
|
2347
|
-
` <key>RunAtLoad</key>\n` +
|
|
2348
|
-
` <true/>\n` +
|
|
2349
|
-
` <key>KeepAlive</key>\n` +
|
|
2350
|
-
` <true/>\n` +
|
|
2351
|
-
` <key>StandardOutPath</key>\n` +
|
|
2352
|
-
` <string>${path.join(logDir, "daemon.out.log")}</string>\n` +
|
|
2353
|
-
` <key>StandardErrorPath</key>\n` +
|
|
2354
|
-
` <string>${path.join(logDir, "daemon.err.log")}</string>\n` +
|
|
2355
|
-
`</dict>\n` +
|
|
2356
|
-
`</plist>\n`;
|
|
2388
|
+
const plist = buildLaunchAgentPlist({
|
|
2389
|
+
programArgs,
|
|
2390
|
+
envPairs,
|
|
2391
|
+
workingDir,
|
|
2392
|
+
logDir
|
|
2393
|
+
});
|
|
2357
2394
|
fs.mkdirSync(path.dirname(plistPath), { recursive: true });
|
|
2358
2395
|
fs.writeFileSync(plistPath, plist);
|
|
2359
2396
|
if (!startNow) return { ok: true };
|
|
@@ -2820,6 +2857,7 @@ module.exports = {
|
|
|
2820
2857
|
launchSetupWizard,
|
|
2821
2858
|
applyAgentInstructions,
|
|
2822
2859
|
buildDaemonEnv,
|
|
2860
|
+
buildLaunchAgentPlist,
|
|
2823
2861
|
resolveDaemonPortState,
|
|
2824
2862
|
normalizeVersion
|
|
2825
2863
|
};
|