@selesai/code 0.13.33 → 0.13.35

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/extensions/capability-gateway/catalog.ts +4 -1
  3. package/dist/extensions/capability-gateway/index.test.ts +93 -4
  4. package/dist/extensions/capability-gateway/index.ts +295 -59
  5. package/dist/extensions/capability-gateway/integration.test.ts +35 -0
  6. package/dist/extensions/capability-gateway/routing.test.ts +154 -1
  7. package/dist/extensions/capability-gateway/routing.ts +227 -45
  8. package/dist/extensions/jev/decisions.test.ts +37 -0
  9. package/dist/extensions/jev/decisions.ts +161 -43
  10. package/dist/extensions/jev-ask-tool.test.ts +501 -0
  11. package/dist/extensions/jev-ask-tool.ts +952 -0
  12. package/dist/extensions/package.json +1 -0
  13. package/dist/extensions/pi-hermes-memory/README.md +11 -36
  14. package/dist/extensions/pi-hermes-memory/src/config.ts +36 -8
  15. package/dist/extensions/pi-hermes-memory/src/constants.ts +5 -5
  16. package/dist/extensions/pi-hermes-memory/src/handlers/auto-consolidate.ts +60 -46
  17. package/dist/extensions/pi-hermes-memory/tests/config.test.ts +26 -2
  18. package/dist/extensions/pi-hermes-memory/tests/handlers/auto-consolidate.test.ts +7 -1
  19. package/dist/extensions/pi-intercom/index.ts +5 -1
  20. package/dist/extensions/pi-subagents/src/extension/public-execution.ts +6 -4
  21. package/dist/extensions/pi-subagents/src/extension/schemas.ts +1 -1
  22. package/dist/extensions/pi-subagents/src/runs/foreground/subagent-executor.ts +26 -1
  23. package/dist/extensions/pi-subagents/src/runs/shared/jev-subagent-routing.ts +255 -0
  24. package/dist/extensions/pi-subagents/test/unit/jev-subagent-routing.test.ts +117 -0
  25. package/dist/extensions/pi-subagents/test/unit/public-execution.test.ts +3 -1
  26. package/dist/extensions/rtk.test.ts +21 -13
  27. package/dist/extensions/tps.test.ts +32 -1
  28. package/dist/extensions/tps.ts +3 -1
  29. package/docs/settings.md +64 -7
  30. package/package.json +3 -3
package/docs/settings.md CHANGED
@@ -49,8 +49,8 @@ Use `/trust` in interactive mode to save a project trust decision for future ses
49
49
  ### Jev Advisory Routing
50
50
 
51
51
  The bundled `jev-advisory-routing` extension uses the Jev decisions model for bounded opt-in
52
- routing. Every route stays off until it is enabled in `jevAdvisory`; the two routes share one
53
- Jev provider/model pair:
52
+ routing. The host-side routes stay off until they are enabled in `jevAdvisory`; the agent's own
53
+ `ask` route is on by default. All routes share one Jev provider/model pair:
54
54
 
55
55
  - `memory` — only after an explicit durable-memory cue (for example “the convention we
56
56
  decided” or “don't repeat the past failure”), Jev chooses one read-only local
@@ -58,6 +58,29 @@ Jev provider/model pair:
58
58
  - `recommendations` — one discovered skill or prompt workflow that fits, or a proportionate
59
59
  verification level. Nothing is loaded, started, or executed: the recommendation is context for the
60
60
  agent, and required project/workflow gates are unchanged.
61
+ - `ask` — the agent-callable `ask_jev` tool (on by default). The agent decides when to call it: it
62
+ passes its own prose, file `paths`, and one `command`, and gets typed choice/score/noul answers back —
63
+ never the file contents or command output, so a verdict about code costs a few lines of context
64
+ instead of the files. Files must be inside the working directory, secret-named files (`.env`,
65
+ `*.pem`, `id_rsa*`, `auth.json`, …) are refused, and the command runs through the bash tool's local
66
+ shell. Whatever the agent passes is sent to Jev. Without Token-In credentials the tool is taken out
67
+ of the agent's loadout before each run (it returns after `/tokenin add`, no reload needed), and a call
68
+ that slips through reads no file and runs no command.
69
+
70
+ The same route also offers `jev_find`, a file finder: ripgrep gathers up to 48 candidate files
71
+ (those matching `pattern`, or every file under `path` filtered by `glob`, ranked by question words),
72
+ Jev judges each file's best-matching lines against the agent's `question` in parallel batches of 16,
73
+ and the agent gets ranked `path:lines (relevance)` pointers — never file contents. It respects
74
+ `.gitignore`, stays inside the working directory, skips secret-named files, and still returns the
75
+ unranked candidates when Jev is unavailable.
76
+ - `subagent` — sets up a single-child `subagent` call from the parent agent (off by default). Jev only
77
+ fills what the parent left open, and can only narrow: (1) when `agent` is omitted or generic
78
+ (`genericAgents`, default `["delegate"]`), it picks an agent by function from enabled native agents
79
+ inside the capability ceiling; (2) it may drop tools from that agent's declared `tools` for this run
80
+ (never `read` or supervision tools, and never adds one); (3) when `tiers` is set and the parent
81
+ passed no `model`, it picks `simple`, `complex`, or `reasoning` and launches that tier's model. Jev
82
+ sees only the task and agent descriptions. Any abstention launches exactly what was asked; an
83
+ agentless task that Jev cannot route is rejected with a request to name an agent.
61
84
 
62
85
  | Setting | Type | Default | Description |
63
86
  |---------|------|---------|-------------|
@@ -66,11 +89,18 @@ Jev provider/model pair:
66
89
  | `jevAdvisory.baseUrl` | string | inherited | Base URL override; defaults to any registered model of `provider` |
67
90
  | `jevAdvisory.routes.memory.enabled` | boolean | `false` | Enable the memory-lookup route |
68
91
  | `jevAdvisory.routes.recommendations.enabled` | boolean | `false` | Enable skill/workflow and verification recommendations |
69
- | `<route>.timeoutMs` | number | `8000` | Route request timeout (ms); memory is capped at 750ms |
92
+ | `jevAdvisory.routes.ask.enabled` | boolean | `true` | Offer the agent the `ask_jev` and `jev_find` tools; set `false` to turn both off |
93
+ | `jevAdvisory.routes.subagent.enabled` | boolean | `false` | Let Jev choose the agent, tools, and model tier of a subagent call |
94
+ | `jevAdvisory.routes.subagent.tiers` | object | unset | `{ "simple"?, "complex"?, "reasoning"? }` → `provider/id` model; tier routing needs at least two |
95
+ | `jevAdvisory.routes.subagent.genericAgents` | string[] | `["delegate"]` | Agents Jev may replace with a specialist |
96
+ | `<route>.timeoutMs` | number | `8000` | Route request timeout (ms); memory is capped at 750ms; `ask` defaults to `15000`, `subagent` to `5000` |
70
97
  | `<route>.minConfidence` | number | `0.6` | Below this Jev confidence the route abstains |
71
98
  | `<route>.contextTurns` | number | `4` | Prior user turns sent as recommendation context; memory sends only the current bounded prompt |
72
99
  | `<route>.contextChars` | number | `4000` | Character budget for recommendation context |
73
- | `<route>.payloadBytes` | number | `8192` | Hard cap on the serialized decision request |
100
+ | `<route>.payloadBytes` | number | `8192` | Hard cap on the serialized decision request; `ask` defaults to `32768`, `subagent` to `16384` |
101
+
102
+ `ask` ignores `minConfidence`, `contextTurns`, and `contextChars`: it returns every confidence to the
103
+ agent, and its context is whatever the agent put in the request.
74
104
 
75
105
  Only idle, top-level, interactive prompts are routed: queued steering/follow-up input, slash
76
106
  commands, and extension-injected turns are skipped, and each turn is routed at most once. The memory
@@ -99,16 +129,28 @@ needed: a compact `capability_catalog` lists them, `capability_discover` activat
99
129
  current run, and `capability_skill_show` loads one skill's full instructions. Set
100
130
  `SELESAI_CAPABILITY_GATEWAY=0` to disable the gateway and keep every tool visible.
101
131
 
102
- Routing has two rungs:
132
+ Routing has three rungs:
103
133
 
104
134
  1. A deterministic router activates a tool when the prompt uniquely matches its name, alias, or
105
135
  discovery summary. Skills are never auto-loaded or auto-selected.
106
136
  2. Default-on Jev tie-breaking: when the deterministic router returns an ambiguous lexical hint
107
137
  among optional tools, the Jev decisions model is asked which of two or three hinted tools (or
108
138
  `none`) should be exposed. Jev sees only the bounded current prompt and each hinted tool's compact
109
- discovery line — never conversation history, tool schemas, or the full catalog. A prompt with no
139
+ discovery line — never conversation history or tool schemas. A prompt with no
110
140
  lexical signal, a unique activation, and a skill-only match never reach Jev. Token-In credentials
111
141
  are required; without them, no Jev request is sent and Selesai prompts you to run `/tokenin add`.
142
+ 3. The agent-driven route: `capability_discover` also takes a `job` instead of a name. Tools and
143
+ skills are separate decisions — a tool is callable code from an extension or MCP server that the
144
+ agent may use many times, a skill is a written procedure it reads once — so one Jev request asks
145
+ two questions, each from catalog metadata only (never a schema or skill body), each allowed to
146
+ answer `none`. A chosen tool is activated for the run and its parameters are returned; a chosen
147
+ skill is named for `capability_skill_show`. Tools are offered first, so only skills can be left out
148
+ of an oversized catalog, and a `none` then says how many were not considered. A skill found in
149
+ several sources is offered once. While Jev has no credential, the `job` route is left out of the
150
+ agent's instructions and the agent is pointed at `capability_catalog` plus an exact `name`.
151
+
152
+ All Jev features share one warning per session, shown the first time one of them actually needs the
153
+ missing credential; a user without a subscription is not warned just for starting a session.
112
154
 
113
155
  | Setting | Type | Default | Description |
114
156
  |---------|------|---------|-------------|
@@ -117,8 +159,9 @@ Routing has two rungs:
117
159
  | `capabilityGateway.routing.jev.model` | string | `"jev-1.13"` | Decisions model the tie-breaker calls |
118
160
  | `capabilityGateway.routing.jev.baseUrl` | string | inherited | Base URL override; defaults to any registered model of `provider` |
119
161
  | `capabilityGateway.routing.jev.timeoutMs` | number | `1000` | Pre-turn request timeout (ms); hard-capped at `2000` |
162
+ | `capabilityGateway.routing.jev.discoverTimeoutMs` | number | `5000` | Timeout (ms) for `capability_discover({ job })`; hard-capped at `15000` |
120
163
  | `capabilityGateway.routing.jev.minConfidence` | number | `0.6` | Below this Jev confidence the tie-breaker abstains |
121
- | `capabilityGateway.routing.jev.payloadBytes` | number | `8192` | Hard cap on the serialized decision request |
164
+ | `capabilityGateway.routing.jev.payloadBytes` | number | `32768` | Hard cap on the serialized decision request; the pre-turn tie-break uses a few hundred bytes of it |
122
165
 
123
166
  This area is independent of `jevAdvisory`: gateway routing reads only
124
167
  `capabilityGateway.routing.jev` and shares just the Jev provider/model deployment identity. A
@@ -362,6 +405,20 @@ When selesai reads extensions from both `~/.selesai/agent/extensions/` and `~/.p
362
405
 
363
406
  Keys are top-level entry names (dir name for packaged extensions, file name for loose `.ts`). Values are `"selesai"` or `"pi"`. See [Shared Host Extensions](shared-host-extensions.md) for the full flow.
364
407
 
408
+ ## Bundled extension settings
409
+
410
+ The `pi-hermes-memory` extension reads its options from the `hermesMemory` object in global `~/.selesai/agent/settings.json`:
411
+
412
+ ```json
413
+ {
414
+ "hermesMemory": {
415
+ "llmThinkingOverride": "off",
416
+ "consolidationTimeoutMs": 300000
417
+ }
418
+ }
419
+ ```
420
+
421
+ These settings load at startup and take precedence over the legacy `hermes-memory-config.json` fallback. `llmModelOverride` is optional and uses `provider/model` format (for example, `tokenin/deepseek-v4.1-flash` if your account has access); leave it unset to use the active model. See the [memory extension configuration reference](../src/extensions/pi-hermes-memory/README.md#configuration) for all options.
365
422
 
366
423
  ## Example
367
424
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@selesai/code",
3
- "version": "0.13.33",
3
+ "version": "0.13.35",
4
4
  "description": "Maintained, extension-first Pi coding agent with built-in workflows, subagents, web research, questions, skills, and an enhanced terminal UI.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -55,8 +55,8 @@
55
55
  "clean": "shx rm -rf dist",
56
56
  "dev": "tsx src/cli.ts",
57
57
  "dev:print": "tsx src/cli.ts --print",
58
- "test": "vitest run src/__tests__/model-registry-completion.test.ts src/extensions/jev/decisions.test.ts src/extensions/capability-gateway/routing.test.ts src/core/settings-manager-auto-handoff.test.ts src/core/remote-catalog-provider.test.ts src/extensions/jev-advisory-memory.test.ts src/extensions/jev-advisory-recommendations.test.ts src/extensions/jev-advisory-lifecycle.test.ts src/extensions/undo.test.ts src/extensions/tps.test.ts src/extensions/pi-graft src/extensions/agent-browser.test.ts src/extensions/auto-session-name.test.ts src/extensions/context-compaction-reminder.test.ts src/extensions/copy-turn.test.ts src/extensions/grep-app/index.test.ts src/extensions/inline-skills.test.ts src/extensions/rtk.test.ts src/extensions/handoff-new.test.ts src/extensions/question/tests src/extensions/ponytail/test src/__tests__/tokenin-search.test.ts src/__tests__/tokenin-onboarding.test.ts src/__tests__/model-registry-defaults.test.ts src/core/system-prompt.test.ts src/core/session-format.test.ts test/settings-manager-compaction.test.ts test/suite/agent-session-runtime.test.ts test/suite/agent-session-prompt.test.ts test/suite/agent-session-queue.test.ts test/suite/agent-session-retry-events.test.ts test/suite/agent-session-compaction.test.ts test/suite/agent-session-compaction-model-overrides.test.ts test/suite/agent-session-bash-persistence.test.ts test/suite/agent-session-model-extension.test.ts test/clipboard.test.ts test/clipboard-command.test.ts test/clipboard-image.test.ts test/clipboard-image-bmp-conversion.test.ts test/clipboard-image-native-errors.test.ts src/cli/args.test.ts",
59
- "test:coverage": "vitest run --coverage src/__tests__/model-registry-completion.test.ts src/extensions/jev/decisions.test.ts src/extensions/capability-gateway/routing.test.ts src/core/settings-manager-auto-handoff.test.ts src/core/remote-catalog-provider.test.ts src/extensions/jev-advisory-memory.test.ts src/extensions/jev-advisory-recommendations.test.ts src/extensions/jev-advisory-lifecycle.test.ts src/extensions/undo.test.ts src/extensions/tps.test.ts src/extensions/agent-browser.test.ts src/extensions/auto-session-name.test.ts src/extensions/context-compaction-reminder.test.ts src/extensions/copy-turn.test.ts src/extensions/grep-app/index.test.ts src/extensions/inline-skills.test.ts src/extensions/rtk.test.ts src/extensions/handoff-new.test.ts src/extensions/question/tests src/extensions/ponytail/test src/__tests__/tokenin-search.test.ts src/__tests__/tokenin-onboarding.test.ts src/__tests__/model-registry-defaults.test.ts src/core/system-prompt.test.ts src/core/session-format.test.ts test/settings-manager-compaction.test.ts test/suite/agent-session-runtime.test.ts test/suite/agent-session-prompt.test.ts test/suite/agent-session-queue.test.ts test/suite/agent-session-retry-events.test.ts test/suite/agent-session-compaction.test.ts test/suite/agent-session-compaction-model-overrides.test.ts test/suite/agent-session-bash-persistence.test.ts test/suite/agent-session-model-extension.test.ts test/clipboard.test.ts test/clipboard-command.test.ts test/clipboard-image.test.ts test/clipboard-image-bmp-conversion.test.ts test/clipboard-image-native-errors.test.ts src/cli/args.test.ts",
58
+ "test": "vitest run src/__tests__/model-registry-completion.test.ts src/extensions/jev/decisions.test.ts src/extensions/capability-gateway/routing.test.ts src/core/settings-manager-auto-handoff.test.ts src/core/remote-catalog-provider.test.ts src/extensions/jev-advisory-memory.test.ts src/extensions/jev-advisory-recommendations.test.ts src/extensions/jev-ask-tool.test.ts src/extensions/jev-advisory-lifecycle.test.ts src/extensions/undo.test.ts src/extensions/tps.test.ts src/extensions/pi-graft src/extensions/agent-browser.test.ts src/extensions/auto-session-name.test.ts src/extensions/context-compaction-reminder.test.ts src/extensions/copy-turn.test.ts src/extensions/grep-app/index.test.ts src/extensions/inline-skills.test.ts src/extensions/rtk.test.ts src/extensions/handoff-new.test.ts src/extensions/question/tests src/extensions/ponytail/test src/__tests__/tokenin-search.test.ts src/__tests__/tokenin-onboarding.test.ts src/__tests__/model-registry-defaults.test.ts src/core/system-prompt.test.ts src/core/session-format.test.ts test/settings-manager-compaction.test.ts test/suite/agent-session-runtime.test.ts test/suite/agent-session-prompt.test.ts test/suite/agent-session-queue.test.ts test/suite/agent-session-retry-events.test.ts test/suite/agent-session-compaction.test.ts test/suite/agent-session-compaction-model-overrides.test.ts test/suite/agent-session-bash-persistence.test.ts test/suite/agent-session-model-extension.test.ts test/clipboard.test.ts test/clipboard-command.test.ts test/clipboard-image.test.ts test/clipboard-image-bmp-conversion.test.ts test/clipboard-image-native-errors.test.ts src/cli/args.test.ts",
59
+ "test:coverage": "vitest run --coverage src/__tests__/model-registry-completion.test.ts src/extensions/jev/decisions.test.ts src/extensions/capability-gateway/routing.test.ts src/core/settings-manager-auto-handoff.test.ts src/core/remote-catalog-provider.test.ts src/extensions/jev-advisory-memory.test.ts src/extensions/jev-advisory-recommendations.test.ts src/extensions/jev-ask-tool.test.ts src/extensions/jev-advisory-lifecycle.test.ts src/extensions/undo.test.ts src/extensions/tps.test.ts src/extensions/agent-browser.test.ts src/extensions/auto-session-name.test.ts src/extensions/context-compaction-reminder.test.ts src/extensions/copy-turn.test.ts src/extensions/grep-app/index.test.ts src/extensions/inline-skills.test.ts src/extensions/rtk.test.ts src/extensions/handoff-new.test.ts src/extensions/question/tests src/extensions/ponytail/test src/__tests__/tokenin-search.test.ts src/__tests__/tokenin-onboarding.test.ts src/__tests__/model-registry-defaults.test.ts src/core/system-prompt.test.ts src/core/session-format.test.ts test/settings-manager-compaction.test.ts test/suite/agent-session-runtime.test.ts test/suite/agent-session-prompt.test.ts test/suite/agent-session-queue.test.ts test/suite/agent-session-retry-events.test.ts test/suite/agent-session-compaction.test.ts test/suite/agent-session-compaction-model-overrides.test.ts test/suite/agent-session-bash-persistence.test.ts test/suite/agent-session-model-extension.test.ts test/clipboard.test.ts test/clipboard-command.test.ts test/clipboard-image.test.ts test/clipboard-image-bmp-conversion.test.ts test/clipboard-image-native-errors.test.ts src/cli/args.test.ts",
60
60
  "prepare": "npm run build",
61
61
  "build": "npm run clean && tsgo -p tsconfig.build.json && shx chmod +x dist/cli.js dist/rpc-entry.js && npm run copy-assets",
62
62
  "copy-assets": "shx mkdir -p dist/modes/interactive/theme && shx cp src/modes/interactive/theme/*.json dist/modes/interactive/theme/ && shx mkdir -p dist/modes/interactive/assets && shx cp src/modes/interactive/assets/*.png dist/modes/interactive/assets/ && shx mkdir -p dist/core/export-html/vendor && shx cp src/core/export-html/template.html src/core/export-html/template.css src/core/export-html/template.js dist/core/export-html/ && shx cp src/core/export-html/vendor/*.js dist/core/export-html/vendor/ && shx mkdir -p dist/defaults && shx cp src/defaults/* dist/defaults/ && shx mkdir -p dist/extensions && node scripts/copy-extensions.mjs && shx mkdir -p dist/themes && shx cp -r src/themes/. dist/themes/ && shx mkdir -p dist/skills && shx cp -r src/skills/. dist/skills/"