@0xmaxma/claude-gateway 2.0.20 → 2.0.21

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 (261) hide show
  1. package/README.md +1 -0
  2. package/config.template.json +3 -2
  3. package/dist/agent/builtin-commands.d.ts +4 -0
  4. package/dist/agent/builtin-commands.d.ts.map +1 -1
  5. package/dist/agent/builtin-commands.js +11 -4
  6. package/dist/agent/builtin-commands.js.map +1 -1
  7. package/dist/agent/command-help.d.ts +11 -2
  8. package/dist/agent/command-help.d.ts.map +1 -1
  9. package/dist/agent/command-help.js +27 -8
  10. package/dist/agent/command-help.js.map +1 -1
  11. package/dist/agent/model-registry.d.ts +48 -0
  12. package/dist/agent/model-registry.d.ts.map +1 -0
  13. package/dist/agent/model-registry.js +144 -0
  14. package/dist/agent/model-registry.js.map +1 -0
  15. package/dist/agent/runner.d.ts +60 -42
  16. package/dist/agent/runner.d.ts.map +1 -1
  17. package/dist/agent/runner.js +304 -113
  18. package/dist/agent/runner.js.map +1 -1
  19. package/dist/agent/session-confirmations.d.ts +1 -1
  20. package/dist/agent/session-confirmations.d.ts.map +1 -1
  21. package/dist/agent/session-confirmations.js +5 -3
  22. package/dist/agent/session-confirmations.js.map +1 -1
  23. package/dist/agent/skill-learning/reviewer.d.ts.map +1 -1
  24. package/dist/agent/skill-learning/reviewer.js +2 -1
  25. package/dist/agent/skill-learning/reviewer.js.map +1 -1
  26. package/dist/agent/turn-stream.d.ts +2 -1
  27. package/dist/agent/turn-stream.d.ts.map +1 -1
  28. package/dist/agent/turn-stream.js.map +1 -1
  29. package/dist/api/gateway-router.d.ts.map +1 -1
  30. package/dist/api/gateway-router.js +4 -0
  31. package/dist/api/gateway-router.js.map +1 -1
  32. package/dist/api/manifest-sources.d.ts.map +1 -1
  33. package/dist/api/manifest-sources.js +3 -0
  34. package/dist/api/manifest-sources.js.map +1 -1
  35. package/dist/api/pstack-router.d.ts +14 -0
  36. package/dist/api/pstack-router.d.ts.map +1 -0
  37. package/dist/api/pstack-router.js +93 -0
  38. package/dist/api/pstack-router.js.map +1 -0
  39. package/dist/api/router.d.ts.map +1 -1
  40. package/dist/api/router.js +29 -24
  41. package/dist/api/router.js.map +1 -1
  42. package/dist/automation/computer-use.d.ts.map +1 -1
  43. package/dist/automation/computer-use.js +8 -1
  44. package/dist/automation/computer-use.js.map +1 -1
  45. package/dist/build-provenance.json +4 -4
  46. package/dist/cli/commands.generated.d.ts.map +1 -1
  47. package/dist/cli/commands.generated.js +36 -1
  48. package/dist/cli/commands.generated.js.map +1 -1
  49. package/dist/config/loader.d.ts.map +1 -1
  50. package/dist/config/loader.js +7 -0
  51. package/dist/config/loader.js.map +1 -1
  52. package/dist/config/reload-policy.js +1 -1
  53. package/dist/config/reload-policy.js.map +1 -1
  54. package/dist/config/watcher.d.ts.map +1 -1
  55. package/dist/config/watcher.js +2 -0
  56. package/dist/config/watcher.js.map +1 -1
  57. package/dist/orchestration/agent-tool-schemas.js +1 -1
  58. package/dist/orchestration/agent-tool-schemas.js.map +1 -1
  59. package/dist/orchestration/bridge.d.ts +6 -2
  60. package/dist/orchestration/bridge.d.ts.map +1 -1
  61. package/dist/orchestration/bridge.js +120 -5
  62. package/dist/orchestration/bridge.js.map +1 -1
  63. package/dist/orchestration/capabilities.d.ts.map +1 -1
  64. package/dist/orchestration/capabilities.js +10 -3
  65. package/dist/orchestration/capabilities.js.map +1 -1
  66. package/dist/orchestration/capacity.d.ts +9 -2
  67. package/dist/orchestration/capacity.d.ts.map +1 -1
  68. package/dist/orchestration/capacity.js +18 -7
  69. package/dist/orchestration/capacity.js.map +1 -1
  70. package/dist/orchestration/cli-skills.d.ts.map +1 -1
  71. package/dist/orchestration/cli-skills.js +4 -2
  72. package/dist/orchestration/cli-skills.js.map +1 -1
  73. package/dist/orchestration/config.d.ts +17 -0
  74. package/dist/orchestration/config.d.ts.map +1 -1
  75. package/dist/orchestration/config.js +21 -1
  76. package/dist/orchestration/config.js.map +1 -1
  77. package/dist/orchestration/dashboard-reader-worker.js +5 -3
  78. package/dist/orchestration/dashboard-reader-worker.js.map +1 -1
  79. package/dist/orchestration/decisions.d.ts.map +1 -1
  80. package/dist/orchestration/decisions.js +4 -2
  81. package/dist/orchestration/decisions.js.map +1 -1
  82. package/dist/orchestration/delivery.d.ts.map +1 -1
  83. package/dist/orchestration/delivery.js +1 -0
  84. package/dist/orchestration/delivery.js.map +1 -1
  85. package/dist/orchestration/gateway-tasks/computer.d.ts +2 -0
  86. package/dist/orchestration/gateway-tasks/computer.d.ts.map +1 -1
  87. package/dist/orchestration/gateway-tasks/computer.js +68 -28
  88. package/dist/orchestration/gateway-tasks/computer.js.map +1 -1
  89. package/dist/orchestration/gateway-tasks/controller.d.ts +6 -6
  90. package/dist/orchestration/gateway-tasks/controller.d.ts.map +1 -1
  91. package/dist/orchestration/input-batch.d.ts +8 -2
  92. package/dist/orchestration/input-batch.d.ts.map +1 -1
  93. package/dist/orchestration/input-batch.js +28 -8
  94. package/dist/orchestration/input-batch.js.map +1 -1
  95. package/dist/orchestration/mutation-recovery.js +1 -1
  96. package/dist/orchestration/mutation-recovery.js.map +1 -1
  97. package/dist/orchestration/notification-mailbox.d.ts.map +1 -1
  98. package/dist/orchestration/notification-mailbox.js +4 -2
  99. package/dist/orchestration/notification-mailbox.js.map +1 -1
  100. package/dist/orchestration/process-turn.d.ts +6 -1
  101. package/dist/orchestration/process-turn.d.ts.map +1 -1
  102. package/dist/orchestration/process-turn.js +9 -5
  103. package/dist/orchestration/process-turn.js.map +1 -1
  104. package/dist/orchestration/recovery.d.ts.map +1 -1
  105. package/dist/orchestration/recovery.js +21 -0
  106. package/dist/orchestration/recovery.js.map +1 -1
  107. package/dist/orchestration/response-errors.d.ts +5 -0
  108. package/dist/orchestration/response-errors.d.ts.map +1 -1
  109. package/dist/orchestration/response-errors.js +25 -0
  110. package/dist/orchestration/response-errors.js.map +1 -1
  111. package/dist/orchestration/runtime.d.ts +15 -1
  112. package/dist/orchestration/runtime.d.ts.map +1 -1
  113. package/dist/orchestration/runtime.js +148 -29
  114. package/dist/orchestration/runtime.js.map +1 -1
  115. package/dist/orchestration/speech.d.ts +3 -0
  116. package/dist/orchestration/speech.d.ts.map +1 -1
  117. package/dist/orchestration/speech.js +4 -1
  118. package/dist/orchestration/speech.js.map +1 -1
  119. package/dist/orchestration/store.d.ts +5 -0
  120. package/dist/orchestration/store.d.ts.map +1 -1
  121. package/dist/orchestration/store.js +13 -5
  122. package/dist/orchestration/store.js.map +1 -1
  123. package/dist/orchestration/subagent-tool-schemas.d.ts +12 -0
  124. package/dist/orchestration/subagent-tool-schemas.d.ts.map +1 -0
  125. package/dist/orchestration/subagent-tool-schemas.js +23 -0
  126. package/dist/orchestration/subagent-tool-schemas.js.map +1 -0
  127. package/dist/orchestration/task-controls.d.ts.map +1 -1
  128. package/dist/orchestration/task-controls.js +2 -1
  129. package/dist/orchestration/task-controls.js.map +1 -1
  130. package/dist/orchestration/task-questions.d.ts.map +1 -1
  131. package/dist/orchestration/task-questions.js +3 -1
  132. package/dist/orchestration/task-questions.js.map +1 -1
  133. package/dist/orchestration/tasks/automation-session.d.ts +12 -0
  134. package/dist/orchestration/tasks/automation-session.d.ts.map +1 -1
  135. package/dist/orchestration/tasks/automation-session.js +26 -1
  136. package/dist/orchestration/tasks/automation-session.js.map +1 -1
  137. package/dist/orchestration/tasks/driver.d.ts.map +1 -1
  138. package/dist/orchestration/tasks/driver.js +54 -14
  139. package/dist/orchestration/tasks/driver.js.map +1 -1
  140. package/dist/orchestration/tasks/scheduler.d.ts.map +1 -1
  141. package/dist/orchestration/tasks/scheduler.js +17 -3
  142. package/dist/orchestration/tasks/scheduler.js.map +1 -1
  143. package/dist/orchestration/tasks/service.d.ts +110 -34
  144. package/dist/orchestration/tasks/service.d.ts.map +1 -1
  145. package/dist/orchestration/tasks/service.js +234 -19
  146. package/dist/orchestration/tasks/service.js.map +1 -1
  147. package/dist/orchestration/tasks/task-directive.d.ts.map +1 -1
  148. package/dist/orchestration/tasks/task-directive.js +5 -1
  149. package/dist/orchestration/tasks/task-directive.js.map +1 -1
  150. package/dist/orchestration/telegram-tool-status.d.ts +8 -1
  151. package/dist/orchestration/telegram-tool-status.d.ts.map +1 -1
  152. package/dist/orchestration/telegram-tool-status.js +57 -6
  153. package/dist/orchestration/telegram-tool-status.js.map +1 -1
  154. package/dist/orchestration/token-ledger.d.ts +14 -0
  155. package/dist/orchestration/token-ledger.d.ts.map +1 -1
  156. package/dist/orchestration/token-ledger.js +28 -2
  157. package/dist/orchestration/token-ledger.js.map +1 -1
  158. package/dist/orchestration/token-usage.d.ts +14 -0
  159. package/dist/orchestration/token-usage.d.ts.map +1 -1
  160. package/dist/orchestration/token-usage.js +16 -2
  161. package/dist/orchestration/token-usage.js.map +1 -1
  162. package/dist/orchestration/tool-name.d.ts.map +1 -1
  163. package/dist/orchestration/tool-name.js +5 -1
  164. package/dist/orchestration/tool-name.js.map +1 -1
  165. package/dist/orchestration/types.d.ts +29 -0
  166. package/dist/orchestration/types.d.ts.map +1 -1
  167. package/dist/orchestration/types.js +11 -0
  168. package/dist/orchestration/types.js.map +1 -1
  169. package/dist/orchestration/worker-harness.d.ts.map +1 -1
  170. package/dist/orchestration/worker-harness.js +5 -2
  171. package/dist/orchestration/worker-harness.js.map +1 -1
  172. package/dist/pstack/config.d.ts +48 -0
  173. package/dist/pstack/config.d.ts.map +1 -0
  174. package/dist/pstack/config.js +147 -0
  175. package/dist/pstack/config.js.map +1 -0
  176. package/dist/pstack/menu.d.ts +71 -0
  177. package/dist/pstack/menu.d.ts.map +1 -0
  178. package/dist/pstack/menu.js +286 -0
  179. package/dist/pstack/menu.js.map +1 -0
  180. package/dist/pstack/overlay.d.ts +30 -0
  181. package/dist/pstack/overlay.d.ts.map +1 -0
  182. package/dist/pstack/overlay.js +121 -0
  183. package/dist/pstack/overlay.js.map +1 -0
  184. package/dist/pstack/plugin-info.d.ts +36 -0
  185. package/dist/pstack/plugin-info.d.ts.map +1 -0
  186. package/dist/pstack/plugin-info.js +51 -0
  187. package/dist/pstack/plugin-info.js.map +1 -0
  188. package/dist/pstack/reflect.d.ts +14 -0
  189. package/dist/pstack/reflect.d.ts.map +1 -0
  190. package/dist/pstack/reflect.js +49 -0
  191. package/dist/pstack/reflect.js.map +1 -0
  192. package/dist/pstack/setup.d.ts +17 -0
  193. package/dist/pstack/setup.d.ts.map +1 -0
  194. package/dist/pstack/setup.js +47 -0
  195. package/dist/pstack/setup.js.map +1 -0
  196. package/dist/pstack/sheet.d.ts +19 -0
  197. package/dist/pstack/sheet.d.ts.map +1 -0
  198. package/dist/pstack/sheet.js +44 -0
  199. package/dist/pstack/sheet.js.map +1 -0
  200. package/dist/pstack/templates.d.ts +14 -0
  201. package/dist/pstack/templates.d.ts.map +1 -0
  202. package/dist/pstack/templates.js +41 -0
  203. package/dist/pstack/templates.js.map +1 -0
  204. package/dist/session/codex-process.d.ts +0 -3
  205. package/dist/session/codex-process.d.ts.map +1 -1
  206. package/dist/session/codex-process.js +8 -3
  207. package/dist/session/codex-process.js.map +1 -1
  208. package/dist/session/compactor.d.ts.map +1 -1
  209. package/dist/session/compactor.js +2 -1
  210. package/dist/session/compactor.js.map +1 -1
  211. package/dist/session/process-diagnostics.d.ts +3 -0
  212. package/dist/session/process-diagnostics.d.ts.map +1 -1
  213. package/dist/session/process-diagnostics.js +10 -0
  214. package/dist/session/process-diagnostics.js.map +1 -1
  215. package/dist/session/process.d.ts.map +1 -1
  216. package/dist/session/process.js +9 -4
  217. package/dist/session/process.js.map +1 -1
  218. package/dist/session/provider-refusal.d.ts +36 -0
  219. package/dist/session/provider-refusal.d.ts.map +1 -0
  220. package/dist/session/provider-refusal.js +109 -0
  221. package/dist/session/provider-refusal.js.map +1 -0
  222. package/dist/session/runtime-profile.d.ts +13 -2
  223. package/dist/session/runtime-profile.d.ts.map +1 -1
  224. package/dist/session/runtime-profile.js +35 -2
  225. package/dist/session/runtime-profile.js.map +1 -1
  226. package/dist/session/worker-extensions.d.ts +5 -2
  227. package/dist/session/worker-extensions.d.ts.map +1 -1
  228. package/dist/session/worker-extensions.js +10 -5
  229. package/dist/session/worker-extensions.js.map +1 -1
  230. package/dist/types.d.ts +3 -0
  231. package/dist/types.d.ts.map +1 -1
  232. package/dist/ui/dashboard-client.d.ts.map +1 -1
  233. package/dist/ui/dashboard-client.js +14 -4
  234. package/dist/ui/dashboard-client.js.map +1 -1
  235. package/dist/ui/dashboard-presentation.d.ts +29 -0
  236. package/dist/ui/dashboard-presentation.d.ts.map +1 -1
  237. package/dist/ui/dashboard-presentation.js +26 -1
  238. package/dist/ui/dashboard-presentation.js.map +1 -1
  239. package/dist/ui/token-report.d.ts +3 -0
  240. package/dist/ui/token-report.d.ts.map +1 -1
  241. package/dist/ui/token-report.js +1 -1
  242. package/dist/ui/token-report.js.map +1 -1
  243. package/dist/voice/errors.d.ts +6 -1
  244. package/dist/voice/errors.d.ts.map +1 -1
  245. package/dist/voice/errors.js +8 -1
  246. package/dist/voice/errors.js.map +1 -1
  247. package/dist/voice/managed-quota.d.ts +29 -3
  248. package/dist/voice/managed-quota.d.ts.map +1 -1
  249. package/dist/voice/managed-quota.js +68 -23
  250. package/dist/voice/managed-quota.js.map +1 -1
  251. package/dist/voice/notes.d.ts +27 -3
  252. package/dist/voice/notes.d.ts.map +1 -1
  253. package/dist/voice/notes.js +59 -10
  254. package/dist/voice/notes.js.map +1 -1
  255. package/mcp/lazy-tools.ts +4 -2
  256. package/mcp/server.ts +6 -2
  257. package/mcp/tools/tasks/module.ts +3 -1
  258. package/mcp/tools/telegram/pstack-menu.ts +22 -0
  259. package/mcp/tools/telegram/pure.ts +40 -0
  260. package/mcp/tools/telegram/receiver-server.ts +63 -6
  261. package/package.json +1 -1
package/README.md CHANGED
@@ -18,6 +18,7 @@ Claude Gateway keeps conversations responsive while Claude Code workers execute
18
18
 
19
19
  - 🔥 **Agent orchestration** — keep conversations responsive while reusable workers execute durable tasks, report progress, accept follow-up instructions, and support cancellation. See [orchestration and tasks](https://0xmaxma.github.io/claude-gateway/guide/orchestration.html).
20
20
  - ⚙️ **Worker harnesses** — automatically route GPT workers to native Codex when ready, with Claude Code fallback before dispatch on the host or inside app containers. Conversational agents remain on Claude Code. See [worker harnesses](https://0xmaxma.github.io/claude-gateway/guide/worker-harnesses.html).
21
+ - 🧰 **pstack** — load the [pstack-claude](https://github.com/michael-denyer/pstack-claude) Claude Code plugin only for agents you set up with `/pstack-setup`, with per-agent model sheets, subagents as gateway tasks and live review-panel status. See [pstack](https://0xmaxma.github.io/claude-gateway/guide/pstack.html).
21
22
  - 🎙️ **Voice conversations** — speech recognition and spoken replies with per-agent models and voices, direct or upstream providers, live or recorded speech input, and audio replay. See [voice setup](https://0xmaxma.github.io/claude-gateway/guide/voice.html).
22
23
  - 🧠 **Skill self-improvement** — agents learn reusable skills from their own work: after a substantive turn a background reviewer creates or updates a skill, hot-reloaded for the next turn. Provenance-guarded (never overwrites human-written skills), capped per day, and audited to `SKILLS_LEARNED.md`. See [`gateway.skillLearning`](https://0xmaxma.github.io/claude-gateway/reference/memory-settings.html#gateway-skilllearning)
23
24
  - 📚 **Knowledge base (two-lane memory)** — per-agent SQLite/FTS5 searchable archive exposed through `memory_search` / `memory_get` MCP tools, so agents recall notes that don't fit the always-injected core; chunks carry fail-closed provenance and the index is refreshed off the gateway event loop. See [`gateway.knowledge`](https://0xmaxma.github.io/claude-gateway/reference/memory-settings.html#gateway-knowledge)
@@ -10,7 +10,7 @@
10
10
  "claude.dangerouslySkipPermissions"
11
11
  ]
12
12
  },
13
- "configVersion": "1.0.35",
13
+ "configVersion": "1.0.36",
14
14
  "gateway": {
15
15
  "orchestration": true,
16
16
  "logDir": "~/.claude-gateway/logs",
@@ -33,7 +33,8 @@
33
33
  { "id": "claude-sonnet-5-5", "label": "Sonnet 5.5", "alias": "sonnet", "contextWindow": 200000 },
34
34
  { "id": "claude-sonnet-5", "label": "Sonnet 5", "alias": "sonnet5", "contextWindow": 200000 },
35
35
  { "id": "claude-sonnet-4-6", "label": "Sonnet 4.6", "alias": "sonnet46", "contextWindow": 200000 },
36
- { "id": "claude-haiku-4-5-20251001", "label": "Haiku 4.5", "alias": "haiku", "contextWindow": 200000 },
36
+ { "id": "claude-haiku-5-5", "label": "Haiku 5.5", "alias": "haiku", "contextWindow": 200000 },
37
+ { "id": "claude-haiku-4-5-20251001", "label": "Haiku 4.5", "alias": "haiku45", "contextWindow": 200000 },
37
38
  { "id": "gpt-6-sol[1m]", "label": "GPT 6 Sol", "alias": "gpt6sol", "contextWindow": 1050000 },
38
39
  { "id": "gpt-6-astra[1m]", "label": "GPT 6 Astra", "alias": "gpt6astra", "contextWindow": 1050000 },
39
40
  { "id": "gpt-6-luna[1m]", "label": "GPT 6 Luna", "alias": "gpt6luna", "contextWindow": 1050000 },
@@ -4,6 +4,10 @@ interface CommandDef {
4
4
  channels: CommandChannel[];
5
5
  /** word-boundary check: true (default) = /^\/cmd\b/, false = /^\/cmd(\s|$)/ */
6
6
  wordBoundary?: boolean;
7
+ /** Another spelling, matched like the name but not listed: Telegram command names cannot contain `-`. */
8
+ alias?: string;
9
+ /** Matched but never listed in help or the command picker (`/orch <token>` comes from a reply's actions). */
10
+ hidden?: boolean;
7
11
  }
8
12
  export declare const BUILTIN_COMMANDS: Record<string, CommandDef>;
9
13
  export declare function isBuiltinCommand(content: string, channel: CommandChannel): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"builtin-commands.d.ts","sourceRoot":"","sources":["../../src/agent/builtin-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAExE,MAAM,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAE9C,UAAU,UAAU;IAClB,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,+EAA+E;IAC/E,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAcvD,CAAC;AA0BF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAElF"}
1
+ {"version":3,"file":"builtin-commands.d.ts","sourceRoot":"","sources":["../../src/agent/builtin-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAExE,MAAM,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAE9C,UAAU,UAAU;IAClB,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,+EAA+E;IAC/E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,yGAAyG;IACzG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6GAA6G;IAC7G,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAqBvD,CAAC;AA0BF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAElF"}
@@ -6,23 +6,30 @@ const types_1 = require("../history/types");
6
6
  exports.BUILTIN_COMMANDS = {
7
7
  session: { channels: [...types_1.CHAT_CHANNELS, 'api'] },
8
8
  sessions: { channels: [...types_1.CHAT_CHANNELS, 'api'] },
9
- new: { channels: ['telegram', 'discord'], wordBoundary: false },
10
- rename: { channels: ['telegram'], wordBoundary: false },
9
+ new: { channels: ['telegram', 'discord', 'api'], wordBoundary: false },
10
+ rename: { channels: ['telegram', 'api'], wordBoundary: false },
11
11
  clear: { channels: [...types_1.CHAT_CHANNELS, 'api'] },
12
12
  compact: { channels: [...types_1.CHAT_CHANNELS, 'api'] },
13
13
  stop: { channels: [...types_1.CHAT_CHANNELS, 'api'], wordBoundary: false },
14
14
  model: { channels: ['telegram', 'discord', 'line', 'api'] },
15
- models: { channels: ['telegram', 'discord', 'line'] },
15
+ models: { channels: ['telegram', 'discord', 'line', 'api'] },
16
+ 'pstack-setup': { channels: ['telegram', 'discord', 'line', 'api'], alias: 'pstack_setup' },
16
17
  restart: { channels: [...types_1.CHAT_CHANNELS, 'api'], wordBoundary: false },
17
18
  start: { channels: ['telegram'] },
18
19
  help: { channels: [...types_1.CHAT_CHANNELS, 'api'] },
19
20
  status: { channels: ['telegram'] },
21
+ // Chat channels route these through their own orchestration controls before this gate.
22
+ // Whole words only, so `/voice-memo` or `/tasks-report` still reaches the agent.
23
+ tasks: { channels: ['api'], wordBoundary: false },
24
+ voice: { channels: ['api'], hidden: true, wordBoundary: false },
25
+ voices: { channels: ['api'], hidden: true, wordBoundary: false },
26
+ orch: { channels: ['api'], hidden: true, wordBoundary: false },
20
27
  };
21
28
  const _cache = new Map();
22
29
  function buildRegex(channel) {
23
30
  const parts = Object.entries(exports.BUILTIN_COMMANDS)
24
31
  .filter(([, def]) => def.channels.includes(channel))
25
- .map(([cmd, def]) => def.wordBoundary === false ? `^\/${cmd}(\\s|$)` : `^\/${cmd}\\b`);
32
+ .flatMap(([cmd, def]) => [cmd, ...(def.alias ? [def.alias] : [])].map(name => def.wordBoundary === false ? `^\/${name}(\\s|$)` : `^\/${name}\\b`));
26
33
  // No commands registered for this channel (e.g. 'line') → match nothing.
27
34
  // `new RegExp('')` matches EVERY string, which would misroute all messages
28
35
  // into the command handler so they'd never reach the agent.
@@ -1 +1 @@
1
- {"version":3,"file":"builtin-commands.js","sourceRoot":"","sources":["../../src/agent/builtin-commands.ts"],"names":[],"mappings":";;;AAkDA,4CAEC;AApDD,4CAAwE;AAU3D,QAAA,gBAAgB,GAA+B;IAC1D,OAAO,EAAG,EAAE,QAAQ,EAAE,CAAC,GAAG,qBAAa,EAAE,KAAK,CAAC,EAAE;IACjD,QAAQ,EAAE,EAAE,QAAQ,EAAE,CAAC,GAAG,qBAAa,EAAE,KAAK,CAAC,EAAE;IACjD,GAAG,EAAO,EAAE,QAAQ,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,EAAE,YAAY,EAAE,K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EAAE,CAAC;AACZ,CAAC;AAED,SAAgB,gBAAgB,CAAC,OAAe,EAAE,OAAuB;IACvE,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;AAChD,CAAC"}
@@ -1,9 +1,18 @@
1
1
  import { type CommandChannel } from './builtin-commands';
2
- /** Shared discoverable built-ins for help, session shortcuts and the API picker. */
3
- export declare function commandCatalog(channel: CommandChannel): Array<{
2
+ /**
3
+ * Shared discoverable built-ins for help, session shortcuts and the API picker.
4
+ * `orchestration` is the agent's mode where one is known; the agent-free API
5
+ * picker leaves it out and says /tasks needs it.
6
+ */
7
+ export declare function commandCatalog(channel: CommandChannel, orchestration?: boolean): Array<{
4
8
  name: string;
5
9
  description: string;
6
10
  }>;
7
11
  /** Channel-specific help shares the runner command registry instead of a second partial list. */
8
12
  export declare function commandHelp(channel: CommandChannel, orchestration?: boolean, interactive?: boolean): string;
13
+ /** A button on an API command reply: send `command` back as the message, to the same session with the same key. */
14
+ export interface CommandAction {
15
+ label: string;
16
+ command: string;
17
+ }
9
18
  //# sourceMappingURL=command-help.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"command-help.d.ts","sourceRoot":"","sources":["../../src/agent/command-help.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAa3E,oFAAoF;AACpF,wBAAgB,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAC,CAAC,CAIlG;AAED,iGAAiG;AACjG,wBAAgB,WAAW,CAAC,OAAO,EAAE,cAAc,EAAE,aAAa,UAAQ,EAAE,WAAW,UAAQ,GAAG,MAAM,CAkBvG"}
1
+ {"version":3,"file":"command-help.d.ts","sourceRoot":"","sources":["../../src/agent/command-help.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAe3E;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,cAAc,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAC,CAAC,CAM3H;AAED,iGAAiG;AACjG,wBAAgB,WAAW,CAAC,OAAO,EAAE,cAAc,EAAE,aAAa,UAAQ,EAAE,WAAW,UAAQ,GAAG,MAAM,CAyBvG;AAED,mHAAmH;AACnH,MAAM,WAAW,aAAa;IAAG,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE"}
@@ -10,27 +10,46 @@ const descriptions = {
10
10
  clear: 'Reset model context; keep chat history and load the latest 50 messages next time',
11
11
  compact: 'Compact Claude Code context; keep chat history',
12
12
  stop: 'Stop the current reply', model: 'Show the model', models: 'List and select a model',
13
+ 'pstack-setup': 'Set up pstack for this agent: /pstack-setup [on|off|<role>: <model-id>]',
13
14
  restart: 'Restart the session process; keep history (does not restart the gateway or app)',
14
15
  start: 'Show pairing instructions', status: 'Show pairing status', help: 'Show available commands',
16
+ tasks: 'View tasks, progress and cancellation controls',
15
17
  };
16
- /** Shared discoverable built-ins for help, session shortcuts and the API picker. */
17
- function commandCatalog(channel) {
18
+ /**
19
+ * Shared discoverable built-ins for help, session shortcuts and the API picker.
20
+ * `orchestration` is the agent's mode where one is known; the agent-free API
21
+ * picker leaves it out and says /tasks needs it.
22
+ */
23
+ function commandCatalog(channel, orchestration) {
18
24
  return Object.entries(builtin_commands_1.BUILTIN_COMMANDS)
19
- .filter(([, definition]) => definition.channels.includes(channel))
20
- .map(([name]) => ({ name: `/${name}`, description: descriptions[name] }));
25
+ .filter(([name, definition]) => definition.channels.includes(channel) && !definition.hidden && !(name === 'tasks' && orchestration === false))
26
+ // The web /models only lists; its model picker or the REST call switches.
27
+ .map(([name]) => ({ name: `/${name}`, description: name === 'models' && channel === 'api' ? 'List the models; switch with the model picker or PUT /api/v1/agents/:agentId/model'
28
+ : name === 'tasks' && orchestration === undefined ? `${descriptions[name]} (agents in orchestration mode)` : descriptions[name] }));
21
29
  }
22
30
  /** Channel-specific help shares the runner command registry instead of a second partial list. */
23
31
  function commandHelp(channel, orchestration = false, interactive = false) {
24
- const lines = commandCatalog(channel).map(command => {
32
+ const lines = commandCatalog(channel, orchestration).map(command => {
25
33
  const name = command.name.slice(1);
26
34
  let description = command.description;
27
- if (name === 'model' && ['telegram', 'discord', 'line'].includes(channel))
35
+ // Telegram's receiver answers /model itself and only shows it; its /models buttons switch.
36
+ if (name === 'model' && channel === 'telegram')
37
+ description = 'Show the current model; switch with /models';
38
+ if (name === 'model' && ['discord', 'line'].includes(channel))
28
39
  description = 'Show the model; change it in a private chat: /model [model ID]';
40
+ if (name === 'new' && channel === 'api')
41
+ description = 'Create a session: /new [name] (the reply carries its session ID)';
29
42
  if (name === 'stop' && orchestration)
30
43
  description = 'Stop the reply and choose a task to cancel';
31
- if (name === 'compact' && channel !== 'api')
44
+ // Every channel asks before /compact and /restart; only Telegram and the web ask before /clear.
45
+ if (['compact', 'restart'].includes(name) || (name === 'clear' && ['telegram', 'api'].includes(channel)))
32
46
  description += '; confirmation required';
33
- return `/${name} — ${description}`;
47
+ if (name === 'pstack-setup' && channel === 'telegram')
48
+ description = 'Set up pstack for this agent with buttons (direct message)';
49
+ if (name === 'pstack-setup' && channel === 'api')
50
+ description = 'Show the pstack setup; change it with /pstack-setup <role>: <model-id> (needs write access to this agent)';
51
+ // A tapped Telegram command stops at the first character outside [a-z0-9_].
52
+ return `/${channel === 'telegram' ? builtin_commands_1.BUILTIN_COMMANDS[name].alias ?? name : name} — ${description}`;
34
53
  });
35
54
  if (orchestration && channel !== 'api') {
36
55
  lines.push('/tasks — View tasks, progress and cancellation controls', '/task_question — Open a pending task question (use the command supplied with the question)');
@@ -1 +1 @@
1
- {"version":3,"file":"command-help.js","source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AI,IAAI,CAAC,CAAC,CAAC,IAAI,MAAM,WAAW,EAAE,CAAC;IACrG,CAAC,CAAC,CAAC;IACH,IAAI,aAAa,IAAI,OAAO,KAAK,KAAK,EAAE,CAAC;QACvC,KAAK,CAAC,IAAI,CAAC,yDAAyD,EAAE,4FAA4F,CAAC,CAAC;QACpK,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,0CAA0C,EAAE,kCAAkC,CAAC,CAAC;QAC3J,IAAI,OAAO,KAAK,UAAU;YAAE,KAAK,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;IACtG,CAAC;IACD,IAAI,OAAO,KAAK,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;IACvF,IAAI,WAAW,IAAI,CAAC,OAAO,KAAK,UAAU,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,CAAC,aAAa,CAAC,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;IAC7I,IAAI,OAAO,KAAK,KAAK;QAAE,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,qCAAqC,EAAE,sDAAsD,EAAE,kFAAkF,EAAE,4EAA4E,EAAE,4GAA4G,CAAC,CAAC;IACrZ,OAAO,wBAAwB,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrD,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * The gateway's model registry, shared by `/models`, `/model`,
3
+ * `GET /api/v1/models` and orchestration (`task_spawn`), so every entry point
4
+ * lists and resolves the same models.
5
+ */
6
+ import type { ModelConfig } from '../types';
7
+ export declare const DEFAULT_MODELS: ModelConfig[];
8
+ /** Reasoning effort levels, as Claude Code's `--effort` and Codex's `model_reasoning_effort` spell them. */
9
+ export declare const EFFORT_LEVELS: readonly ["low", "medium", "high", "xhigh", "max"];
10
+ export type Effort = typeof EFFORT_LEVELS[number];
11
+ export declare const isEffort: (value: unknown) => value is Effort;
12
+ /**
13
+ * The model list this gateway offers: the live catalog when one is reachable,
14
+ * the configured/static list otherwise (issue #409). Cached upstream, so
15
+ * callers that only want one model's context window pay for at most one fetch
16
+ * a minute between them.
17
+ */
18
+ export declare function availableModels(configured: ModelConfig[] | undefined): Promise<ModelConfig[]>;
19
+ /**
20
+ * Models a name may resolve to: what the catalog offers, plus the configured
21
+ * list.
22
+ *
23
+ * The union is only for *resolution*, never for the `/models` listing — the
24
+ * listing has to reflect what upstream actually offers, or a model removed
25
+ * upstream would linger in the picker forever, which is the bug this all
26
+ * started from. Without the union a user who switches to a live-only model
27
+ * is trapped: their previous configured model is no longer nameable.
28
+ */
29
+ export declare function selectableModels(configured: ModelConfig[] | undefined): Promise<ModelConfig[]>;
30
+ /** `/model` and `task_spawn`: an id or an alias, case-insensitive. */
31
+ export declare function findModel(models: ModelConfig[], name: string): ModelConfig | undefined;
32
+ export declare class ModelResolutionError extends Error {
33
+ readonly code: 'UNKNOWN_MODEL' | 'MODEL_ALIAS_NOT_ALLOWED';
34
+ constructor(code: 'UNKNOWN_MODEL' | 'MODEL_ALIAS_NOT_ALLOWED', message: string);
35
+ }
36
+ /**
37
+ * Resolve a full model ID, rejecting aliases. Used where a config must name
38
+ * one model that never changes when an alias moves (pstack roles,
39
+ * `subagent_spawn`). Matching is exact and case-insensitive. A context suffix
40
+ * (`[1m]`, `[200k]`) on an id the catalog lists without it still resolves:
41
+ * the suffix selects the context window, not a different model. `[1m]` needs a
42
+ * model with a 1M window.
43
+ *
44
+ * `where` names the config path in the error, e.g.
45
+ * `agents[a].pstack.roles["bug-fix"]`.
46
+ */
47
+ export declare function resolveModelId(models: ModelConfig[], value: string, where?: string): ModelConfig;
48
+ //# sourceMappingURL=model-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-registry.d.ts","sourceRoot":"","sources":["../../src/agent/model-registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAkC5C,eAAO,MAAM,cAAc,EAAE,WAAW,EA0BvC,CAAC;AAEF,4GAA4G;AAC5G,eAAO,MAAM,aAAa,oDAAqD,CAAC;AAChF,MAAM,MAAM,MAAM,GAAG,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;AAClD,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAiD,CAAC;AAErG;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,UAAU,EAAE,WAAW,EAAE,GAAG,SAAS,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAGnG;AAED;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,WAAW,EAAE,GAAG,SAAS,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAIpG;AAED,sEAAsE;AACtE,wBAAgB,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAGtF;AAED,qBAAa,oBAAqB,SAAQ,KAAK;IACjC,QAAQ,CAAC,IAAI,EAAE,eAAe,GAAG,yBAAyB;gBAAjD,IAAI,EAAE,eAAe,GAAG,yBAAyB,EAAE,OAAO,EAAE,MAAM;CAIxF;AAID;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,WAAW,CAahG"}
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ /**
3
+ * The gateway's model registry, shared by `/models`, `/model`,
4
+ * `GET /api/v1/models` and orchestration (`task_spawn`), so every entry point
5
+ * lists and resolves the same models.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.ModelResolutionError = exports.isEffort = exports.EFFORT_LEVELS = exports.DEFAULT_MODELS = void 0;
9
+ exports.availableModels = availableModels;
10
+ exports.selectableModels = selectableModels;
11
+ exports.findModel = findModel;
12
+ exports.resolveModelId = resolveModelId;
13
+ const model_catalog_1 = require("./model-catalog");
14
+ // Fable 5.1 takes the bare `fable` alias and Fable 5 is demoted to `fable5`,
15
+ // following the "bare alias = newest of the family" convention the rest of this
16
+ // list uses — the same demotion Opus 4.8 took to `opus48` when Opus 5 landed.
17
+ //
18
+ // Note that `fable` therefore points at a model not every provider has
19
+ // entitled yet; ours answers `400 model not supported` for it today, until
20
+ // Crown-Labs/getpod#2538 adds it to the catalog. This only affects someone
21
+ // typing `/model fable` from now on: selection stores the resolved id, not the
22
+ // alias, so an agent already on Fable 5 stays on claude-fable-5 and existing
23
+ // configs have their claude-fable-5 row rewritten to `fable5` by
24
+ // migrateModels(). Nobody is moved onto 5.1 by this change.
25
+ //
26
+ // Both Fable 5.x entries carry the same 200k/1M split as the rest: their CLI
27
+ // catalog entry says `native_1m`, but native 1M only applies when the base URL
28
+ // is api.anthropic.com. Behind a proxy the `[1m]` id suffix and the
29
+ // `context-1m-2025-08-07` beta header are what actually buy the larger window,
30
+ // which is exactly what the paired rows below encode.
31
+ //
32
+ // Opus 5.5 (`claude-opus-5-5`) follows the same convention on its own family:
33
+ // it takes the bare `opus` alias and Opus 5 is demoted to `opus5`, mirroring
34
+ // the Opus 5 -> Opus 4.8 demotion above and the Fable 5.1 -> Fable 5 one.
35
+ // Selection still stores the resolved id, so an agent already on Opus 5 stays
36
+ // on claude-opus-5 — only `/model opus` from now on resolves to 5.5.
37
+ //
38
+ // Sonnet 5.5 (`claude-sonnet-5-5`) does the same on the Sonnet family: it takes
39
+ // `sonnet` / `sonnet[1m]` and Sonnet 5 is demoted to `sonnet5` / `sonnet5[1m]`;
40
+ // Sonnet 4.6 keeps `sonnet46`. An agent already on Sonnet 5 stays on
41
+ // claude-sonnet-5.
42
+ //
43
+ // Haiku 5.5 (`claude-haiku-5-5`) takes the bare `haiku` alias and Haiku 4.5 is
44
+ // demoted to `haiku45`. An agent already on Haiku 4.5 stays on
45
+ // claude-haiku-4-5-20251001.
46
+ exports.DEFAULT_MODELS = [
47
+ { id: 'claude-fable-5-1[1m]', label: 'Fable 5.1 (1M)', alias: 'fable[1m]', contextWindow: 1000000 },
48
+ { id: 'claude-fable-5[1m]', label: 'Fable 5 (1M)', alias: 'fable5[1m]', contextWindow: 1000000 },
49
+ { id: 'claude-opus-5-5[1m]', label: 'Opus 5.5 (1M)', alias: 'opus[1m]', contextWindow: 1000000 },
50
+ { id: 'claude-opus-5[1m]', label: 'Opus 5 (1M)', alias: 'opus5[1m]', contextWindow: 1000000 },
51
+ { id: 'claude-opus-4-8[1m]', label: 'Opus 4.8 (1M)', alias: 'opus48[1m]', contextWindow: 1000000 },
52
+ { id: 'claude-sonnet-5-5[1m]', label: 'Sonnet 5.5 (1M)', alias: 'sonnet[1m]', contextWindow: 1000000 },
53
+ { id: 'claude-sonnet-5[1m]', label: 'Sonnet 5 (1M)', alias: 'sonnet5[1m]', contextWindow: 1000000 },
54
+ { id: 'claude-fable-5-1', label: 'Fable 5.1', alias: 'fable', contextWindow: 200000 },
55
+ { id: 'claude-fable-5', label: 'Fable 5', alias: 'fable5', contextWindow: 200000 },
56
+ { id: 'claude-opus-5-5', label: 'Opus 5.5', alias: 'opus', contextWindow: 200000 },
57
+ { id: 'claude-opus-5', label: 'Opus 5', alias: 'opus5', contextWindow: 200000 },
58
+ { id: 'claude-opus-4-8', label: 'Opus 4.8', alias: 'opus48', contextWindow: 200000 },
59
+ { id: 'claude-opus-4-6', label: 'Opus 4.6', alias: 'opus46', contextWindow: 200000 },
60
+ { id: 'claude-sonnet-5-5', label: 'Sonnet 5.5', alias: 'sonnet', contextWindow: 200000 },
61
+ { id: 'claude-sonnet-5', label: 'Sonnet 5', alias: 'sonnet5', contextWindow: 200000 },
62
+ { id: 'claude-sonnet-4-6', label: 'Sonnet 4.6', alias: 'sonnet46', contextWindow: 200000 },
63
+ { id: 'claude-haiku-5-5', label: 'Haiku 5.5', alias: 'haiku', contextWindow: 200000 },
64
+ { id: 'claude-haiku-4-5-20251001', label: 'Haiku 4.5', alias: 'haiku45', contextWindow: 200000 },
65
+ { id: 'gpt-6-sol[1m]', label: 'GPT 6 Sol', alias: 'gpt6sol', contextWindow: 1050000 },
66
+ { id: 'gpt-6-astra[1m]', label: 'GPT 6 Astra', alias: 'gpt6astra', contextWindow: 1050000 },
67
+ { id: 'gpt-6-luna[1m]', label: 'GPT 6 Luna', alias: 'gpt6luna', contextWindow: 1050000 },
68
+ { id: 'gpt-5.6-sol[1m]', label: 'GPT 5.6 Sol', alias: 'gpt56sol', contextWindow: 1050000 },
69
+ { id: 'gpt-5.6-terra[1m]', label: 'GPT 5.6 Terra', alias: 'gpt56terra', contextWindow: 1050000 },
70
+ { id: 'gpt-5.6-luna[1m]', label: 'GPT 5.6 Luna', alias: 'gpt56luna', contextWindow: 1050000 },
71
+ { id: 'gpt-5.5[1m]', label: 'GPT 5.5', alias: 'gpt55', contextWindow: 1050000 },
72
+ ];
73
+ /** Reasoning effort levels, as Claude Code's `--effort` and Codex's `model_reasoning_effort` spell them. */
74
+ exports.EFFORT_LEVELS = ['low', 'medium', 'high', 'xhigh', 'max'];
75
+ const isEffort = (value) => exports.EFFORT_LEVELS.includes(value);
76
+ exports.isEffort = isEffort;
77
+ /**
78
+ * The model list this gateway offers: the live catalog when one is reachable,
79
+ * the configured/static list otherwise (issue #409). Cached upstream, so
80
+ * callers that only want one model's context window pay for at most one fetch
81
+ * a minute between them.
82
+ */
83
+ async function availableModels(configured) {
84
+ const staticModels = configured ?? exports.DEFAULT_MODELS;
85
+ return (await (0, model_catalog_1.fetchModelCatalog)(staticModels)) ?? staticModels;
86
+ }
87
+ /**
88
+ * Models a name may resolve to: what the catalog offers, plus the configured
89
+ * list.
90
+ *
91
+ * The union is only for *resolution*, never for the `/models` listing — the
92
+ * listing has to reflect what upstream actually offers, or a model removed
93
+ * upstream would linger in the picker forever, which is the bug this all
94
+ * started from. Without the union a user who switches to a live-only model
95
+ * is trapped: their previous configured model is no longer nameable.
96
+ */
97
+ async function selectableModels(configured) {
98
+ const live = await availableModels(configured);
99
+ const ids = new Set(live.map((m) => m.id));
100
+ return [...live, ...(configured ?? exports.DEFAULT_MODELS).filter((m) => !ids.has(m.id))];
101
+ }
102
+ /** `/model` and `task_spawn`: an id or an alias, case-insensitive. */
103
+ function findModel(models, name) {
104
+ const wanted = name.toLowerCase();
105
+ return models.find((m) => m.id.toLowerCase() === wanted || m.alias.toLowerCase() === wanted);
106
+ }
107
+ class ModelResolutionError extends Error {
108
+ constructor(code, message) {
109
+ super(message);
110
+ this.code = code;
111
+ this.name = 'ModelResolutionError';
112
+ }
113
+ }
114
+ exports.ModelResolutionError = ModelResolutionError;
115
+ const CONTEXT_SUFFIX = /\[(?:1m|200k)\]$/i;
116
+ /**
117
+ * Resolve a full model ID, rejecting aliases. Used where a config must name
118
+ * one model that never changes when an alias moves (pstack roles,
119
+ * `subagent_spawn`). Matching is exact and case-insensitive. A context suffix
120
+ * (`[1m]`, `[200k]`) on an id the catalog lists without it still resolves:
121
+ * the suffix selects the context window, not a different model. `[1m]` needs a
122
+ * model with a 1M window.
123
+ *
124
+ * `where` names the config path in the error, e.g.
125
+ * `agents[a].pstack.roles["bug-fix"]`.
126
+ */
127
+ function resolveModelId(models, value, where) {
128
+ const wanted = value.toLowerCase();
129
+ const exact = models.find((m) => m.id.toLowerCase() === wanted);
130
+ if (exact)
131
+ return exact;
132
+ const suffix = CONTEXT_SUFFIX.exec(wanted)?.[0];
133
+ const base = suffix && models.find((m) => m.id.toLowerCase() === wanted.slice(0, -suffix.length) && !CONTEXT_SUFFIX.test(m.id));
134
+ // `[1m]` only where the model has a 1M window; a Claude model that does lists its own `[1m]` row.
135
+ if (base && (suffix !== '[1m]' || base.contextWindow >= 1000000))
136
+ return { ...base, id: base.id + suffix };
137
+ const at = where ? ` at ${where}` : '';
138
+ const valid = `Valid IDs: ${models.map((m) => m.id).join(', ')} — see /models.`;
139
+ const alias = models.find((m) => m.alias.toLowerCase() === wanted);
140
+ if (alias)
141
+ throw new ModelResolutionError('MODEL_ALIAS_NOT_ALLOWED', `"${value}"${at} is an alias; use the model ID "${alias.id}". ${valid}`);
142
+ throw new ModelResolutionError('UNKNOWN_MODEL', `Unknown model "${value}"${at}. ${valid}`);
143
+ }
144
+ //# sourceMappingURL=model-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-registry.js","sourceRoot":"","sources":["../../src/agent/model-registry.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AA4EH,0CAGC;AAYD,4CAIC;AAGD,8BAGC;AAsBD,wCAaC;AAtID,mDAAoD;AAGpD,6EAA6E;AAC7E,gFAAgF;AAChF,8EAA8E;AAC9E,EAAE;AACF,uEAAuE;AACvE,2EAA2E;AAC3E,2EAA2E;AAC3E,+EAA+E;AAC/E,6EAA6E;AAC7E,iEAAiE;AACjE,4DAA4D;AAC5D,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,oEAAoE;AACpE,+EAA+E;AAC/E,sDAAsD;AACtD,EAAE;AACF,8EAA8E;AAC9E,6EAA6E;AAC7E,0EAA0E;AAC1E,8EAA8E;AAC9E,qEAAqE;AACrE,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,qEAAqE;AACrE,mBAAmB;AACnB,EAAE;AACF,+EAA+E;AAC/E,+DAA+D;AAC/D,6BAA6B;AAChB,QAAA,cAAc,GAAkB;IAC3C,EAAE,EAAE,EAAE,sBAAsB,EAAO,KAAK,EAAE,gBAAgB,EAAI,KAAK,EAAE,WAAW,EAAI,aAAa,EAAE,OAAO,EAAE;IAC5G,EAAE,EAAE,EAAE,oBAAoB,EAAS,KAAK,EAAE,cAAc,EAAM,KAAK,EAAE,YAAY,EAAG,aAAa,EAAE,OAAO,EAAE;IAC5G,EAAE,EAAE,EAAE,qBAAqB,EAAQ,KAAK,EAAE,eAAe,EAAK,KAAK,EAAE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C,EAAE,CAAC;IACvC,MAAM,KAAK,GAAG,cAAc,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC;IAChF,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,CAAC;IACnE,IAAI,KAAK;QAAE,MAAM,IAAI,oBAAoB,CAAC,yBAAyB,EAAE,IAAI,KAAK,IAAI,EAAE,mCAAmC,KAAK,CAAC,EAAE,MAAM,KAAK,EAAE,CAAC,CAAC;IAC9I,MAAM,IAAI,oBAAoB,CAAC,eAAe,EAAE,kBAAkB,KAAK,IAAI,EAAE,KAAK,KAAK,EAAE,CAAC,CAAC;AAC7F,CAAC"}
@@ -1,16 +1,17 @@
1
1
  import { EventEmitter } from 'events';
2
- import { AgentConfig, CustomConnectorEntry, GatewayConfig, Logger, ModelConfig, ApiAttachment, ImageParams, VideoParams } from '../types';
2
+ import { AgentConfig, CustomConnectorEntry, GatewayConfig, Logger, ApiAttachment, ImageParams, VideoParams } from '../types';
3
3
  import { SessionProcess } from '../session/process';
4
4
  import { type WhatsAppStatus } from '../whatsapp/manager';
5
5
  import { type WeChatStatus } from '../wechat/manager';
6
6
  import { type SkillRegistry } from '../skills';
7
+ import { type CommandAction } from './command-help';
7
8
  import { type ApiStreamCallbacks, type TurnSink } from './turn-stream';
8
9
  import { type CliChannel } from '../cli-viewer/pairing-store';
9
10
  import { HistoryDB } from '../history/db';
10
11
  import type { ChatChannel } from '../history/types';
11
12
  import type { SkillLearningManager } from './skill-learning';
12
13
  export declare const MAX_IMAGE_SIZE_BYTES: number;
13
- export declare const DEFAULT_MODELS: ModelConfig[];
14
+ export { DEFAULT_MODELS } from './model-registry';
14
15
  /**
15
16
  * One-line reminder injected into every `whatsapp_cloud` turn's <channel>
16
17
  * block (see buildChannelXml) — the 24h customer-service window is a
@@ -314,43 +315,52 @@ export declare class AgentRunner extends EventEmitter {
314
315
  questionId: string | undefined;
315
316
  updatedAt: number;
316
317
  canStop: boolean;
318
+ readonly?: boolean | undefined;
319
+ capabilities: import("../orchestration/types").ExecutionCapabilities;
320
+ model?: string | undefined;
321
+ result?: import("../orchestration/types").TaskResult | undefined;
322
+ createdAt: number;
323
+ agentId: string;
324
+ conversationId: string;
325
+ continueTaskId?: string | undefined;
326
+ agentSessionId: string;
317
327
  queuedCommands?: Array<{
318
328
  id: string;
319
329
  text: string;
320
330
  at: number;
321
- }>;
331
+ }> | undefined;
322
332
  actionLog?: Array<{
323
333
  revision: number;
324
334
  command: string;
325
335
  result: string;
326
- }>;
336
+ }> | undefined;
327
337
  gatewayDispatch?: {
328
338
  requestId: string;
329
339
  submittedAt: number;
330
- };
340
+ } | undefined;
331
341
  computerRevocation?: {
332
342
  requestId: string;
333
343
  requestedAt: number;
334
- };
335
- continueTaskId?: string;
336
- continuationPolicy?: "after_success" | "after_terminal";
337
- workstreamId?: string;
338
- workerId?: string;
339
- skill?: import("../orchestration/skills").TaskSkill;
340
- model?: string;
344
+ } | undefined;
345
+ continuationPolicy?: "after_success" | "after_terminal" | undefined;
346
+ workstreamId?: string | undefined;
347
+ workerId?: string | undefined;
348
+ requestedModel?: string | undefined;
349
+ effort?: import("./model-registry").Effort | undefined;
350
+ parentTaskId?: string | undefined;
351
+ rootTaskId?: string | undefined;
352
+ depth?: number | undefined;
353
+ subagentType?: string | undefined;
341
354
  resourceProfile?: {
342
355
  projectRoot: string;
343
356
  mode: "isolated-worktree" | "shared-lock" | "host" | "container";
344
- };
345
- conversationId: string;
346
- agentId: string;
347
- agentSessionId: string;
357
+ } | undefined;
348
358
  ownerPrincipalId: string;
349
359
  initiatingInputId: string;
350
360
  targetProfile: string;
351
361
  stateVersion: number;
352
- providerWaiting?: import("../orchestration/provider-admission").ProviderWaiting;
353
- activeAttemptId?: string;
362
+ providerWaiting?: import("../orchestration/provider-admission").ProviderWaiting | undefined;
363
+ activeAttemptId?: string | undefined;
354
364
  workspaceEvidence?: {
355
365
  registered: Array<{
356
366
  mode: string;
@@ -359,28 +369,26 @@ export declare class AgentRunner extends EventEmitter {
359
369
  }>;
360
370
  observedFilePaths: string[];
361
371
  currentFilesystemVerified: false;
362
- };
372
+ } | undefined;
363
373
  recentTools?: Array<{
364
374
  name: string;
365
375
  description?: string;
366
376
  type: string;
367
377
  isError?: boolean;
368
378
  occurredAt: number;
369
- }>;
370
- workflow?: import("../orchestration/workflow").TaskWorkflow;
379
+ }> | undefined;
380
+ workflow?: import("../orchestration/workflow").TaskWorkflow | undefined;
371
381
  latestProgress?: {
372
382
  text: string;
373
383
  observedAt: number;
374
384
  source: "worker" | "runtime";
375
- };
385
+ } | undefined;
376
386
  pendingQuestion?: {
377
387
  questionId: string;
378
388
  text: string;
379
389
  revision: number;
380
- };
381
- result?: import("../orchestration/types").TaskResult;
382
- capabilities: import("../orchestration/types").ExecutionCapabilities;
383
- createdAt: number;
390
+ } | undefined;
391
+ skill?: import("../orchestration/types").PublicTaskSkill;
384
392
  currentInstructions?: string;
385
393
  }>;
386
394
  /** Provisional: returns the pause id so releaseVoicePause can undo it if the speech yields no command. */
@@ -708,6 +716,28 @@ export declare class AgentRunner extends EventEmitter {
708
716
  * exactly that state before this.
709
717
  */
710
718
  private handleCommandModels;
719
+ /** The /models list: configured models, then live-only ones, each marked when current. */
720
+ private modelList;
721
+ /**
722
+ * /pstack-setup — the gateway's counterpart of pstack's own setup-pstack:
723
+ * decides whether this agent's workers load pstack, and with which models.
724
+ * Arguments are pstack-models.md lines, one per line (`<role>: <model-id>`,
725
+ * `<role>: default` to drop an override, `<role> += <model-id>` / `<role> -= <model-id>`
726
+ * to edit a panel list, `default effort: <level>`); `on`
727
+ * sets the agent up with the skill defaults and `off` removes it. Changes
728
+ * apply to the next worker. Direct messages only, like /model; the bare
729
+ * form too, so a group is not shown the agent's setup.
730
+ */
731
+ private handleCommandPstackSetup;
732
+ /** The bare /pstack-setup reply for channels without buttons: status, every role's current model, the syntax and the model IDs. */
733
+ private pstackSetupText;
734
+ private pstackMenuState;
735
+ /** Change the saved pstack block (`undefined` removes it) through the same path as the API. */
736
+ private updatePstack;
737
+ /** Apply `/pstack-setup <arg>` (on, off, or pstack-models.md lines) and describe the outcome. */
738
+ private applyPstackSetup;
739
+ /** One /pstack-setup button (Telegram): apply its change, if any, and render the next screen. */
740
+ private pstackMenu;
711
741
  /**
712
742
  * /model — show the current model, or switch to one from the catalog.
713
743
  *
@@ -1421,9 +1451,13 @@ export declare class AgentRunner extends EventEmitter {
1421
1451
  displayCommand?: string;
1422
1452
  clientMessageId?: string;
1423
1453
  executionTaskId?: string;
1454
+ canWriteAgent?: boolean;
1455
+ /** The caller sent no session_id: `sessionId` is a fresh one made for this command. */
1456
+ implicitSession?: boolean;
1424
1457
  }): Promise<{
1425
1458
  result: Record<string, unknown>;
1426
1459
  responseText: string;
1460
+ actions: CommandAction[];
1427
1461
  }>;
1428
1462
  /**
1429
1463
  * Whether an inbound channel message came from a 1:1 chat with the bot.
@@ -1453,12 +1487,6 @@ export declare class AgentRunner extends EventEmitter {
1453
1487
  * must finish with the model they started with. Returns whether anything restarted.
1454
1488
  */
1455
1489
  private restartChannelSessions;
1456
- /**
1457
- * The model list this gateway offers: the live catalog when one is reachable,
1458
- * the configured/static list otherwise (issue #409). Cached upstream, so the
1459
- * six callers that only want one model's context window pay for at most one
1460
- * fetch a minute between them.
1461
- */
1462
1490
  private availableModels;
1463
1491
  /**
1464
1492
  * Context window for a model id. Resolving this through the live catalog is
@@ -1467,16 +1495,6 @@ export declare class AgentRunner extends EventEmitter {
1467
1495
  * through to the 200k default no matter how large its real window.
1468
1496
  */
1469
1497
  private contextWindowFor;
1470
- /**
1471
- * Models `/model <arg>` may switch to: what the catalog offers, plus the
1472
- * configured list.
1473
- *
1474
- * The union is only for *resolution*, never for the `/models` listing — the
1475
- * listing has to reflect what upstream actually offers, or a model removed
1476
- * upstream would linger in the picker forever, which is the bug this all
1477
- * started from. Without the union a user who switches to a live-only model
1478
- * is trapped: their previous configured model is no longer nameable.
1479
- */
1480
1498
  private selectableModels;
1481
1499
  setModel(newModel: string): Promise<void>;
1482
1500
  listApiSessions(chatId: string): Promise<import('../types').SessionIndex>;