docdex 0.2.53 → 0.2.55
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 -1
- package/README.md +4 -2
- package/assets/agents.md +7 -7
- package/lib/postinstall_setup.js +31 -17
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 0.2.
|
|
3
|
+
## 0.2.55
|
|
4
|
+
- Raise installer-managed Codex MCP `tool_timeout_sec` and `startup_timeout_sec` defaults to 300 seconds.
|
|
5
|
+
- Update packaged Codex MCP examples to show the 300-second timeout settings.
|
|
6
|
+
|
|
7
|
+
## 0.2.54
|
|
4
8
|
- Add a per-project actual cost savings table to `docdexd delegation savings --all`.
|
|
5
9
|
- Include optional per-project `projects` telemetry entries for `/v1/telemetry/delegation?all=true`, resolving persisted repo telemetry to canonical project paths with live mounted-repo fallback.
|
|
6
10
|
|
package/README.md
CHANGED
|
@@ -165,8 +165,10 @@ If you need to configure your client manually:
|
|
|
165
165
|
**TOML (Codex):**
|
|
166
166
|
|
|
167
167
|
```toml
|
|
168
|
-
[mcp_servers]
|
|
169
|
-
|
|
168
|
+
[mcp_servers.docdex]
|
|
169
|
+
url = "http://127.0.0.1:28491/v1/mcp"
|
|
170
|
+
tool_timeout_sec = 300
|
|
171
|
+
startup_timeout_sec = 300
|
|
170
172
|
|
|
171
173
|
```
|
|
172
174
|
|
package/assets/agents.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
---- START OF DOCDEX INFO V0.2.
|
|
1
|
+
---- START OF DOCDEX INFO V0.2.55 ----
|
|
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`).
|
|
@@ -92,14 +92,14 @@ Precision tools for structural analysis. Do not rely on text search for definiti
|
|
|
92
92
|
|
|
93
93
|
### D. Local Delegation (Cheap Models)
|
|
94
94
|
|
|
95
|
-
Use local delegation for low-complexity
|
|
95
|
+
Use local delegation for low-complexity code-writing tasks and lightweight general questions to reduce paid-model usage.
|
|
96
96
|
|
|
97
97
|
| MCP Tool / HTTP | Purpose |
|
|
98
98
|
| --- | --- |
|
|
99
99
|
| docdex_local_completion | Delegate small tasks to a local model with strict output formats. |
|
|
100
100
|
| HTTP /v1/delegate | HTTP endpoint for delegated completions with structured responses. |
|
|
101
101
|
|
|
102
|
-
Required fields: `task_type`, `instruction`, `context`. Optional: `max_tokens`, `timeout_ms`, `mode` (`draft_only` or `draft_then_refine`), `agent` (local agent id/slug or `model:<name>` to force an Ollama model; raw model names from `docdexd delegation agents` are also accepted).
|
|
102
|
+
Required fields: `task_type`, `instruction`, `context`. Optional: `max_tokens`, `timeout_ms`, `mode` (`draft_only` or `draft_then_refine`), `agent` (local agent id/slug or `model:<name>` to force an Ollama model; raw model names from `docdexd delegation agents` are also accepted). Use `general_question` for lightweight Q&A and the existing code-oriented task types for code writing/editing.
|
|
103
103
|
Expensive model library: `docs/expensive_models.json` (match by `agent_id`, `agent_slug`, `model`, or adapter type; case-insensitive).
|
|
104
104
|
To choose a local target, run `docdexd delegation agents` (or `--json`) and prefer:
|
|
105
105
|
- `code_writer` for scaffolding/boilerplate/docstrings.
|
|
@@ -144,7 +144,7 @@ Use these to verify index coverage, repo binding, and to read precise file slice
|
|
|
144
144
|
- docdex_open: Read narrow file slices after targets are identified.
|
|
145
145
|
- docdex_tree: Render a filtered folder tree (prefer this over `rg --files` / `find`).
|
|
146
146
|
- docdex_impact_diagnostics: Scan dynamic imports when imports are unclear or failing.
|
|
147
|
-
- docdex_local_completion: Delegate low-complexity
|
|
147
|
+
- docdex_local_completion: Delegate low-complexity local tasks such as codegen work or lightweight general questions.
|
|
148
148
|
- docdex_ast: Use AST queries for precise structure (class/function definitions, call sites, imports).
|
|
149
149
|
- docdex_symbols: Use symbols to confirm exact signatures/locations before edits.
|
|
150
150
|
- docdex_impact_graph: Mandatory before code changes to review inbound/outbound deps (use MCP/IPC if shell networking is blocked).
|
|
@@ -325,7 +325,7 @@ Do not guess fields; use these canonical shapes.
|
|
|
325
325
|
- `docdex_memory_recall`: `{ project_root, query, top_k? }`
|
|
326
326
|
- `docdex_get_profile`: `{ agent_id }`
|
|
327
327
|
- `docdex_save_preference`: `{ agent_id, category, content }`
|
|
328
|
-
- `docdex_local_completion`: `{ task_type, instruction, context, max_tokens?, timeout_ms?, mode?, max_context_chars?, agent?, caller_agent_id?, caller_model?, primary_cost_per_million? }`
|
|
328
|
+
- `docdex_local_completion`: `{ task_type, instruction, context, max_tokens?, timeout_ms?, mode?, max_context_chars?, agent?, caller_agent_id?, caller_model?, primary_cost_per_million?, project_root?, repo_path? }`
|
|
329
329
|
- `docdex_web_research`: `{ project_root, query, force_web, skip_local_search?, web_limit?, no_cache? }`
|
|
330
330
|
|
|
331
331
|
### 9) Common error fixes (do not guess)
|
|
@@ -371,7 +371,7 @@ Use these when results look incomplete or when the task is about recent changes.
|
|
|
371
371
|
|
|
372
372
|
### 4. Local Delegation Workflow (Cheap Models)
|
|
373
373
|
|
|
374
|
-
When you are an expensive/paid model, delegate eligible low-complexity tasks first unless the user opts out.
|
|
374
|
+
When you are an expensive/paid model, delegate eligible low-complexity code-writing tasks and lightweight general questions first unless the user opts out.
|
|
375
375
|
Delegation is mandatory for eligible tasks. If you are expensive and delegation is enabled (explicitly or auto-enabled with local candidates), you MUST attempt local delegation before doing the work yourself. Only skip when delegation is disabled, no local candidate exists, or local output fails validation after a retry/fallback.
|
|
376
376
|
|
|
377
377
|
#### Mandatory Delegation Triggers
|
|
@@ -390,7 +390,7 @@ Delegation is mandatory for eligible tasks. If you are expensive and delegation
|
|
|
390
390
|
|
|
391
391
|
1. Determine if you are expensive: load `docs/expensive_models.json` and match your `agent_id`, `agent_slug`, `model`, or adapter type. If you match, continue; if not and you are clearly local/cheap, skip delegation. If unsure, default to expensive.
|
|
392
392
|
2. Check config: Only delegate when `[llm.delegation].enabled` is true or `auto_enable` is true with an eligible local model/agent (and `task_type` is allowed). For automatic mcoda selection, eligible means healthy and not paid/expensive unless the user explicitly overrides the target. If uncertain, attempt delegation and handle the error.
|
|
393
|
-
3. Choose task type: Use one of `GENERATE_TESTS`, `WRITE_DOCSTRING`, `SCAFFOLD_BOILERPLATE`, `REFACTOR_SIMPLE`, `FORMAT_CODE`.
|
|
393
|
+
3. Choose task type: Use one of `GENERATE_TESTS`, `WRITE_DOCSTRING`, `SCAFFOLD_BOILERPLATE`, `REFACTOR_SIMPLE`, `FORMAT_CODE`, `GENERAL_QUESTION`.
|
|
394
394
|
4. Call the tool: `docdex_local_completion` with `task_type`, `instruction`, and minimal `context` (smallest necessary snippet).
|
|
395
395
|
5. Validate output: If the local output is invalid or empty, fall back to the primary agent or handle with the paid model.
|
|
396
396
|
6. Optional refine: If mode is `draft_then_refine`, refine the draft with the primary agent and return a final result.
|
package/lib/postinstall_setup.js
CHANGED
|
@@ -1145,6 +1145,7 @@ function upsertZedConfig(pathname, url) {
|
|
|
1145
1145
|
}
|
|
1146
1146
|
|
|
1147
1147
|
function upsertCodexConfig(pathname, url) {
|
|
1148
|
+
const codexTimeoutSec = 300;
|
|
1148
1149
|
const hasSection = (contents, section) =>
|
|
1149
1150
|
new RegExp(`^\\s*\\[${section}\\]\\s*$`, "m").test(contents);
|
|
1150
1151
|
const hasNestedMcpServers = (contents) =>
|
|
@@ -1213,13 +1214,20 @@ function upsertCodexConfig(pathname, url) {
|
|
|
1213
1214
|
};
|
|
1214
1215
|
|
|
1215
1216
|
const upsertDocdexNested = (contents, urlValue) => {
|
|
1217
|
+
const desiredEntries = [
|
|
1218
|
+
["url", `"${urlValue}"`],
|
|
1219
|
+
["tool_timeout_sec", `${codexTimeoutSec}`],
|
|
1220
|
+
["startup_timeout_sec", `${codexTimeoutSec}`]
|
|
1221
|
+
];
|
|
1216
1222
|
const lines = contents.split(/\r?\n/);
|
|
1217
1223
|
const headerRe = /^\s*\[mcp_servers\.docdex\]\s*$/;
|
|
1218
1224
|
let start = lines.findIndex((line) => headerRe.test(line));
|
|
1219
1225
|
if (start === -1) {
|
|
1220
1226
|
if (lines.length && lines[lines.length - 1].trim()) lines.push("");
|
|
1221
1227
|
lines.push("[mcp_servers.docdex]");
|
|
1222
|
-
|
|
1228
|
+
for (const [key, value] of desiredEntries) {
|
|
1229
|
+
lines.push(`${key} = ${value}`);
|
|
1230
|
+
}
|
|
1223
1231
|
return { contents: lines.join("\n"), updated: true };
|
|
1224
1232
|
}
|
|
1225
1233
|
let end = start + 1;
|
|
@@ -1227,31 +1235,37 @@ function upsertCodexConfig(pathname, url) {
|
|
|
1227
1235
|
end += 1;
|
|
1228
1236
|
}
|
|
1229
1237
|
let updated = false;
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1238
|
+
for (const [key, value] of desiredEntries) {
|
|
1239
|
+
const lineValue = `${key} = ${value}`;
|
|
1240
|
+
let keyIndex = -1;
|
|
1241
|
+
for (let i = start + 1; i < end; i += 1) {
|
|
1242
|
+
if (new RegExp(`^\\s*${key}\\s*=`).test(lines[i])) {
|
|
1243
|
+
keyIndex = i;
|
|
1244
|
+
break;
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
if (keyIndex === -1) {
|
|
1248
|
+
lines.splice(end, 0, lineValue);
|
|
1249
|
+
end += 1;
|
|
1250
|
+
updated = true;
|
|
1251
|
+
} else if (lines[keyIndex].trim() !== lineValue) {
|
|
1252
|
+
lines[keyIndex] = lineValue;
|
|
1253
|
+
updated = true;
|
|
1235
1254
|
}
|
|
1236
|
-
}
|
|
1237
|
-
if (urlIndex === -1) {
|
|
1238
|
-
lines.splice(start + 1, 0, `url = "${urlValue}"`);
|
|
1239
|
-
updated = true;
|
|
1240
|
-
} else if (!lines[urlIndex].includes(`"${urlValue}"`)) {
|
|
1241
|
-
lines[urlIndex] = `url = "${urlValue}"`;
|
|
1242
|
-
updated = true;
|
|
1243
1255
|
}
|
|
1244
1256
|
return { contents: lines.join("\n"), updated };
|
|
1245
1257
|
};
|
|
1246
1258
|
|
|
1247
1259
|
const upsertDocdexRoot = (contents, urlValue) => {
|
|
1260
|
+
const entryLine =
|
|
1261
|
+
`docdex = { url = "${urlValue}", tool_timeout_sec = ${codexTimeoutSec}, startup_timeout_sec = ${codexTimeoutSec} }`;
|
|
1248
1262
|
const lines = contents.split(/\r?\n/);
|
|
1249
1263
|
const headerRe = /^\s*\[mcp_servers\]\s*$/;
|
|
1250
1264
|
const start = lines.findIndex((line) => headerRe.test(line));
|
|
1251
1265
|
if (start === -1) {
|
|
1252
1266
|
if (lines.length && lines[lines.length - 1].trim()) lines.push("");
|
|
1253
1267
|
lines.push("[mcp_servers]");
|
|
1254
|
-
lines.push(
|
|
1268
|
+
lines.push(entryLine);
|
|
1255
1269
|
return { contents: lines.join("\n"), updated: true };
|
|
1256
1270
|
}
|
|
1257
1271
|
let end = start + 1;
|
|
@@ -1267,10 +1281,10 @@ function upsertCodexConfig(pathname, url) {
|
|
|
1267
1281
|
}
|
|
1268
1282
|
}
|
|
1269
1283
|
if (docdexLine === -1) {
|
|
1270
|
-
lines.splice(end, 0,
|
|
1284
|
+
lines.splice(end, 0, entryLine);
|
|
1271
1285
|
updated = true;
|
|
1272
|
-
} else if (
|
|
1273
|
-
lines[docdexLine] =
|
|
1286
|
+
} else if (lines[docdexLine].trim() !== entryLine) {
|
|
1287
|
+
lines[docdexLine] = entryLine;
|
|
1274
1288
|
updated = true;
|
|
1275
1289
|
}
|
|
1276
1290
|
return { contents: lines.join("\n"), updated };
|