docdex 0.2.44 → 0.2.46
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 +6 -0
- package/assets/agents.md +6 -1
- package/lib/postinstall_setup.js +70 -32
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.46
|
|
4
|
+
- Bump release metadata to 0.2.46.
|
|
5
|
+
|
|
6
|
+
## 0.2.45
|
|
7
|
+
- Update packaged agent docs with FD-hardening guidance and bump release metadata to 0.2.45.
|
|
8
|
+
|
|
3
9
|
## 0.2.44
|
|
4
10
|
- Fix MCP tool schema compatibility with Claude Code by removing top-level anyOf from `docdex_dag_export`.
|
|
5
11
|
- Bump release metadata to 0.2.44.
|
package/assets/agents.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
---- START OF DOCDEX INFO V0.2.
|
|
1
|
+
---- START OF DOCDEX INFO V0.2.46 ----
|
|
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
|
|
|
@@ -111,6 +112,8 @@ For mcoda agents, also consider:
|
|
|
111
112
|
- `usage`: best-fit role (for example `code_writer` or `code_reviewer`); use this for quick matching.
|
|
112
113
|
- `reasoning_rating`: reasoning score out of 10; prefer higher for complex reasoning tasks.
|
|
113
114
|
- `health_status`: only use agents marked `healthy` (treat `-` as unknown).
|
|
115
|
+
- Docdex refreshes mcoda inventory via `mcoda agent list --json --refresh-health`; it retries with legacy `mcoda agent list --json` if the refresh flag is unavailable.
|
|
116
|
+
- Supported mcoda local CLI adapters include `claude-cli` in addition to `codex-cli`/`gemini-cli`/`openai-cli`/`ollama-cli`.
|
|
114
117
|
Table output shows `USAGE`, `COMPLEXITY`, `RATING`, `REASON`, `COST/$1M`, and `HEALTH` for mcoda agents (`-` means unknown).
|
|
115
118
|
- When `llm.delegation.re_evaluate = true` (default), Docdex reviews successful local mcoda runs using the primary agent when available and writes updated ratings to `~/.mcoda/mcoda.db` (disable with `DOCDEX_DELEGATION_REEVALUATE=0`).
|
|
116
119
|
Use `agent: model:<ollama-model>` to force a specific local model (for example, `model:phi3.5:3.8b`).
|
|
@@ -164,6 +167,7 @@ Use these only when MCP tools cannot be called (e.g., blocked sandbox networking
|
|
|
164
167
|
- `docdexd search --repo <path> --query "<q>"`: /search equivalent (HTTP/local).
|
|
165
168
|
- `docdexd delegation savings`: delegation telemetry (JSON: offloaded count, local/primary tokens & costs, savings).
|
|
166
169
|
- `docdexd delegation agents --json`: list local delegation targets and capabilities (mcoda agents include `max_complexity`, `rating`, `cost_per_million`, `usage`, `reasoning_rating`, `health_status`).
|
|
170
|
+
- `mcoda agent list --json --refresh-health`: preferred machine-consumer inventory command for fresh health; fallback to plain `--json` for older mcoda versions.
|
|
167
171
|
- `docdexd open --repo <path> --file <rel>`: safe file slice read (head/start/end/clamp).
|
|
168
172
|
- `docdexd file ensure-newline|write --repo <path> --file <rel>`: minimal file edits.
|
|
169
173
|
- `docdexd test run-node --repo <path> --file <rel> --args "..."`: run Node scripts.
|
|
@@ -225,6 +229,7 @@ Common params:
|
|
|
225
229
|
Notes:
|
|
226
230
|
- `skip_local_search=true` effectively forces web discovery (Tier 2).
|
|
227
231
|
- If DOCDEX_WEB_ENABLED=1, web discovery can be slow; plan timeouts accordingly.
|
|
232
|
+
- Responses include `meta.dag_session_id`; pass it to `/v1/dag/export` or `docdex_dag_export` to export the same trace.
|
|
228
233
|
|
|
229
234
|
### 3a) Capabilities (HTTP)
|
|
230
235
|
|
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
|
};
|