docdex 0.2.46 → 0.2.48

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.48
4
+ - Exclude paid or expensive mcoda agents from automatic local delegation target selection.
5
+ - Document the zero-cost local delegation rule in the packaged agent guidance.
6
+
7
+ ## 0.2.47
8
+ - Bump release metadata to 0.2.47.
9
+
3
10
  ## 0.2.46
4
11
  - Bump release metadata to 0.2.46.
5
12
 
package/assets/agents.md CHANGED
@@ -1,4 +1,4 @@
1
- ---- START OF DOCDEX INFO V0.2.46 ----
1
+ ---- START OF DOCDEX INFO V0.2.48 ----
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`).
@@ -109,6 +109,7 @@ For mcoda agents, also consider:
109
109
  - `max_complexity`: do not assign tasks above this ceiling.
110
110
  - `rating`: prefer higher-rated agents for reliability.
111
111
  - `cost_per_million`: USD per 1M tokens; prefer lower cost when ratings/complexity match.
112
+ - Automatic local target selection must exclude mcoda agents that are paid (`cost_per_million > 0`) or otherwise matched by `docs/expensive_models.json`, unless the user explicitly overrides the target.
112
113
  - `usage`: best-fit role (for example `code_writer` or `code_reviewer`); use this for quick matching.
113
114
  - `reasoning_rating`: reasoning score out of 10; prefer higher for complex reasoning tasks.
114
115
  - `health_status`: only use agents marked `healthy` (treat `-` as unknown).
@@ -388,7 +389,7 @@ Delegation is mandatory for eligible tasks. If you are expensive and delegation
388
389
  - Enforces the product's cost-control policy; skipping delegation is a regression.
389
390
 
390
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.
391
- 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). If uncertain, attempt delegation and handle the error.
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.
392
393
  3. Choose task type: Use one of `GENERATE_TESTS`, `WRITE_DOCSTRING`, `SCAFFOLD_BOILERPLATE`, `REFACTOR_SIMPLE`, `FORMAT_CODE`.
393
394
  4. Call the tool: `docdex_local_completion` with `task_type`, `instruction`, and minimal `context` (smallest necessary snippet).
394
395
  5. Validate output: If the local output is invalid or empty, fall back to the primary agent or handle with the paid model.
@@ -2475,8 +2475,27 @@ function registerStartup({ binaryPath, port, repoRoot, logger, distBaseDir, star
2475
2475
  return { ok: false, reason: "unsupported_platform" };
2476
2476
  }
2477
2477
 
2478
- async function startDaemonWithHealthCheck({ binaryPath, port, host, logger, distBaseDir, startNow = true }) {
2479
- const startup = registerStartup({
2478
+ async function startDaemonWithHealthCheck({
2479
+ binaryPath,
2480
+ port,
2481
+ host,
2482
+ logger,
2483
+ distBaseDir,
2484
+ startNow = true,
2485
+ deps
2486
+ }) {
2487
+ const helpers = {
2488
+ registerStartup,
2489
+ waitForDaemonHealthy,
2490
+ stopDaemonService,
2491
+ stopDaemonFromLock,
2492
+ stopDaemonByName,
2493
+ clearDaemonLocks
2494
+ };
2495
+ if (deps && typeof deps === "object") {
2496
+ Object.assign(helpers, deps);
2497
+ }
2498
+ const startup = helpers.registerStartup({
2480
2499
  binaryPath,
2481
2500
  port,
2482
2501
  repoRoot: daemonRootPath(),
@@ -2491,16 +2510,18 @@ async function startDaemonWithHealthCheck({ binaryPath, port, host, logger, dist
2491
2510
  if (!startNow) {
2492
2511
  return { ok: true, reason: "registered" };
2493
2512
  }
2494
- startDaemonService({ logger });
2495
- const healthy = await waitForDaemonHealthy({ host, port });
2513
+ // `registerStartup(..., startNow: true)` already starts the service on all
2514
+ // supported platforms. Starting it again here can interrupt the first boot
2515
+ // and leave the daemon stuck behind its own lock file.
2516
+ const healthy = await helpers.waitForDaemonHealthy({ host, port });
2496
2517
  if (healthy) {
2497
2518
  return { ok: true, reason: "healthy" };
2498
2519
  }
2499
2520
  logger?.warn?.(`[docdex] daemon failed health check on ${host}:${port}`);
2500
- stopDaemonService({ logger });
2501
- stopDaemonFromLock({ logger });
2502
- stopDaemonByName({ logger });
2503
- clearDaemonLocks();
2521
+ helpers.stopDaemonService({ logger });
2522
+ helpers.stopDaemonFromLock({ logger });
2523
+ helpers.stopDaemonByName({ logger });
2524
+ helpers.clearDaemonLocks();
2504
2525
  return { ok: false, reason: "health_failed" };
2505
2526
  }
2506
2527
 
@@ -2858,6 +2879,7 @@ module.exports = {
2858
2879
  applyAgentInstructions,
2859
2880
  buildDaemonEnv,
2860
2881
  buildLaunchAgentPlist,
2882
+ startDaemonWithHealthCheck,
2861
2883
  resolveDaemonPortState,
2862
2884
  normalizeVersion
2863
2885
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docdex",
3
- "version": "0.2.46",
3
+ "version": "0.2.48",
4
4
  "mcpName": "io.github.bekirdag/docdex",
5
5
  "description": "Local-first documentation and code indexer with HTTP/MCP search, AST, and agent memory.",
6
6
  "bin": {