comisai 1.0.28 → 1.0.30

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 (241) hide show
  1. package/node_modules/@comis/agent/dist/bootstrap/sections/tool-descriptions.js +62 -8
  2. package/node_modules/@comis/agent/dist/bootstrap/sections/tooling-sections.js +3 -1
  3. package/node_modules/@comis/agent/dist/bridge/pi-event-bridge.d.ts +7 -0
  4. package/node_modules/@comis/agent/dist/bridge/pi-event-bridge.js +26 -0
  5. package/node_modules/@comis/agent/dist/context-engine/signature-replay-scrubber.d.ts +21 -0
  6. package/node_modules/@comis/agent/dist/context-engine/signature-replay-scrubber.js +29 -9
  7. package/node_modules/@comis/agent/dist/context-engine/signature-surrogate-guard.d.ts +10 -2
  8. package/node_modules/@comis/agent/dist/context-engine/signature-surrogate-guard.js +15 -9
  9. package/node_modules/@comis/agent/dist/context-engine/thinking-block-cleaner.d.ts +17 -2
  10. package/node_modules/@comis/agent/dist/context-engine/thinking-block-cleaner.js +19 -8
  11. package/node_modules/@comis/agent/dist/executor/executor-prompt-runner.js +28 -0
  12. package/node_modules/@comis/agent/dist/executor/executor-response-filter.js +3 -0
  13. package/node_modules/@comis/agent/dist/executor/executor-tool-assembly.js +3 -1
  14. package/node_modules/@comis/agent/dist/executor/phase-filter.d.ts +20 -4
  15. package/node_modules/@comis/agent/dist/executor/phase-filter.js +62 -19
  16. package/node_modules/@comis/agent/dist/executor/pi-executor.js +6 -0
  17. package/node_modules/@comis/agent/dist/executor/stream-wrappers/config-resolver.js +2 -3
  18. package/node_modules/@comis/agent/dist/executor/stream-wrappers/request-body-injector.js +2 -3
  19. package/node_modules/@comis/agent/dist/executor/ttl-guard.js +2 -3
  20. package/node_modules/@comis/agent/dist/index.d.ts +4 -2
  21. package/node_modules/@comis/agent/dist/index.js +3 -2
  22. package/node_modules/@comis/agent/dist/model/compaction-model-resolver.d.ts +41 -0
  23. package/node_modules/@comis/agent/dist/model/compaction-model-resolver.js +51 -0
  24. package/node_modules/@comis/agent/dist/model/model-registry-adapter.js +113 -26
  25. package/node_modules/@comis/agent/dist/model/model-scanner.d.ts +27 -0
  26. package/node_modules/@comis/agent/dist/model/model-scanner.js +64 -23
  27. package/node_modules/@comis/agent/dist/model/operation-model-defaults.d.ts +37 -15
  28. package/node_modules/@comis/agent/dist/model/operation-model-defaults.js +70 -25
  29. package/node_modules/@comis/agent/dist/model/operation-model-resolver.d.ts +2 -2
  30. package/node_modules/@comis/agent/dist/model/operation-model-resolver.js +12 -8
  31. package/node_modules/@comis/agent/dist/provider/capabilities.d.ts +21 -0
  32. package/node_modules/@comis/agent/dist/provider/capabilities.js +28 -0
  33. package/node_modules/@comis/agent/dist/session/orphaned-message-repair.js +61 -1
  34. package/node_modules/@comis/agent/dist/workspace/templates.js +1 -1
  35. package/node_modules/@comis/agent/package.json +1 -1
  36. package/node_modules/@comis/channels/dist/shared/channel-manager.d.ts +19 -1
  37. package/node_modules/@comis/channels/dist/shared/channel-manager.js +59 -3
  38. package/node_modules/@comis/channels/dist/shared/deliver-to-channel.d.ts +10 -0
  39. package/node_modules/@comis/channels/dist/shared/deliver-to-channel.js +25 -10
  40. package/node_modules/@comis/channels/dist/shared/execution-deliver.d.ts +1 -1
  41. package/node_modules/@comis/channels/dist/shared/execution-deliver.js +1 -1
  42. package/node_modules/@comis/channels/dist/shared/execution-pipeline.d.ts +8 -0
  43. package/node_modules/@comis/channels/dist/shared/inbound-pipeline.d.ts +8 -0
  44. package/node_modules/@comis/channels/dist/shared/inbound-route.d.ts +1 -1
  45. package/node_modules/@comis/channels/dist/shared/inbound-route.js +1 -0
  46. package/node_modules/@comis/channels/package.json +1 -1
  47. package/node_modules/@comis/cli/package.json +1 -1
  48. package/node_modules/@comis/core/dist/config/schema-agent.d.ts +15 -3
  49. package/node_modules/@comis/core/dist/config/schema-agent.js +6 -2
  50. package/node_modules/@comis/core/dist/config/schema-integrations.d.ts +4 -4
  51. package/node_modules/@comis/core/dist/config/schema-integrations.js +3 -3
  52. package/node_modules/@comis/core/dist/config/schema-models.d.ts +4 -2
  53. package/node_modules/@comis/core/dist/config/schema-models.js +4 -2
  54. package/node_modules/@comis/core/package.json +1 -1
  55. package/node_modules/@comis/daemon/dist/daemon.js +51 -8
  56. package/node_modules/@comis/daemon/dist/rpc/agent-handlers.js +40 -9
  57. package/node_modules/@comis/daemon/dist/rpc/builtin-provider-guard.d.ts +16 -0
  58. package/node_modules/@comis/daemon/dist/rpc/builtin-provider-guard.js +60 -0
  59. package/node_modules/@comis/daemon/dist/rpc/config-handlers.js +59 -0
  60. package/node_modules/@comis/daemon/dist/rpc/credential-resolver.d.ts +17 -0
  61. package/node_modules/@comis/daemon/dist/rpc/credential-resolver.js +99 -0
  62. package/node_modules/@comis/daemon/dist/rpc/message-handlers.d.ts +5 -0
  63. package/node_modules/@comis/daemon/dist/rpc/message-handlers.js +25 -4
  64. package/node_modules/@comis/daemon/dist/rpc/model-handlers.d.ts +4 -3
  65. package/node_modules/@comis/daemon/dist/rpc/model-handlers.js +21 -3
  66. package/node_modules/@comis/daemon/dist/rpc/provider-handlers.js +82 -6
  67. package/node_modules/@comis/daemon/dist/rpc/rpc-dispatch.d.ts +4 -0
  68. package/node_modules/@comis/daemon/dist/wiring/inbound-message-id-resolver.d.ts +48 -0
  69. package/node_modules/@comis/daemon/dist/wiring/inbound-message-id-resolver.js +58 -0
  70. package/node_modules/@comis/daemon/dist/wiring/setup-agents.d.ts +18 -6
  71. package/node_modules/@comis/daemon/dist/wiring/setup-agents.js +98 -46
  72. package/node_modules/@comis/daemon/dist/wiring/setup-channels.d.ts +13 -1
  73. package/node_modules/@comis/daemon/dist/wiring/setup-channels.js +2 -1
  74. package/node_modules/@comis/daemon/dist/wiring/setup-gateway-rpc.js +1 -1
  75. package/node_modules/@comis/daemon/package.json +2 -2
  76. package/node_modules/@comis/gateway/package.json +1 -1
  77. package/node_modules/@comis/infra/package.json +1 -1
  78. package/node_modules/@comis/memory/package.json +1 -1
  79. package/node_modules/@comis/scheduler/package.json +1 -1
  80. package/node_modules/@comis/shared/package.json +1 -1
  81. package/node_modules/@comis/skills/dist/bridge/mcp-tool-bridge.d.ts +1 -1
  82. package/node_modules/@comis/skills/dist/bridge/mcp-tool-bridge.js +1 -1
  83. package/node_modules/@comis/skills/dist/bridge/tool-audit.js +1 -1
  84. package/node_modules/@comis/skills/dist/builtin/exec-tool.d.ts +12 -11
  85. package/node_modules/@comis/skills/dist/builtin/exec-tool.js +1 -1
  86. package/node_modules/@comis/skills/dist/builtin/file/apply-patch-tool.d.ts +3 -2
  87. package/node_modules/@comis/skills/dist/builtin/file/apply-patch-tool.js +1 -1
  88. package/node_modules/@comis/skills/dist/builtin/file-tools/edit-tool.d.ts +7 -6
  89. package/node_modules/@comis/skills/dist/builtin/file-tools/edit-tool.js +1 -1
  90. package/node_modules/@comis/skills/dist/builtin/file-tools/find-tool.d.ts +6 -5
  91. package/node_modules/@comis/skills/dist/builtin/file-tools/find-tool.js +1 -1
  92. package/node_modules/@comis/skills/dist/builtin/file-tools/grep-tool.d.ts +16 -15
  93. package/node_modules/@comis/skills/dist/builtin/file-tools/grep-tool.js +1 -1
  94. package/node_modules/@comis/skills/dist/builtin/file-tools/ls-tool.d.ts +4 -3
  95. package/node_modules/@comis/skills/dist/builtin/file-tools/ls-tool.js +1 -1
  96. package/node_modules/@comis/skills/dist/builtin/file-tools/notebook-edit-tool.d.ts +7 -6
  97. package/node_modules/@comis/skills/dist/builtin/file-tools/notebook-edit-tool.js +1 -1
  98. package/node_modules/@comis/skills/dist/builtin/file-tools/read-tool.d.ts +6 -5
  99. package/node_modules/@comis/skills/dist/builtin/file-tools/read-tool.js +1 -1
  100. package/node_modules/@comis/skills/dist/builtin/file-tools/write-tool.d.ts +5 -4
  101. package/node_modules/@comis/skills/dist/builtin/file-tools/write-tool.js +1 -1
  102. package/node_modules/@comis/skills/dist/builtin/platform/admin-manage-factory.d.ts +1 -1
  103. package/node_modules/@comis/skills/dist/builtin/platform/agents-manage-tool.d.ts +28 -27
  104. package/node_modules/@comis/skills/dist/builtin/platform/agents-manage-tool.js +1 -1
  105. package/node_modules/@comis/skills/dist/builtin/platform/background-tasks-tool.d.ts +4 -3
  106. package/node_modules/@comis/skills/dist/builtin/platform/background-tasks-tool.js +1 -1
  107. package/node_modules/@comis/skills/dist/builtin/platform/browser-tool-schema.d.ts +67 -66
  108. package/node_modules/@comis/skills/dist/builtin/platform/browser-tool-schema.js +1 -1
  109. package/node_modules/@comis/skills/dist/builtin/platform/channels-manage-tool.d.ts +6 -5
  110. package/node_modules/@comis/skills/dist/builtin/platform/channels-manage-tool.js +1 -1
  111. package/node_modules/@comis/skills/dist/builtin/platform/cron-tool.d.ts +20 -19
  112. package/node_modules/@comis/skills/dist/builtin/platform/cron-tool.js +1 -1
  113. package/node_modules/@comis/skills/dist/builtin/platform/ctx-expand-tool.d.ts +4 -3
  114. package/node_modules/@comis/skills/dist/builtin/platform/ctx-expand-tool.js +1 -1
  115. package/node_modules/@comis/skills/dist/builtin/platform/ctx-inspect-tool.d.ts +3 -2
  116. package/node_modules/@comis/skills/dist/builtin/platform/ctx-inspect-tool.js +1 -1
  117. package/node_modules/@comis/skills/dist/builtin/platform/ctx-recall-tool.d.ts +6 -5
  118. package/node_modules/@comis/skills/dist/builtin/platform/ctx-recall-tool.js +1 -1
  119. package/node_modules/@comis/skills/dist/builtin/platform/ctx-search-tool.d.ts +6 -5
  120. package/node_modules/@comis/skills/dist/builtin/platform/ctx-search-tool.js +1 -1
  121. package/node_modules/@comis/skills/dist/builtin/platform/describe-video-tool.d.ts +4 -3
  122. package/node_modules/@comis/skills/dist/builtin/platform/describe-video-tool.js +1 -1
  123. package/node_modules/@comis/skills/dist/builtin/platform/discord-action-tool.d.ts +2 -1
  124. package/node_modules/@comis/skills/dist/builtin/platform/discord-action-tool.js +1 -1
  125. package/node_modules/@comis/skills/dist/builtin/platform/extract-document-tool.d.ts +4 -3
  126. package/node_modules/@comis/skills/dist/builtin/platform/extract-document-tool.js +1 -1
  127. package/node_modules/@comis/skills/dist/builtin/platform/gateway-tool.d.ts +12 -11
  128. package/node_modules/@comis/skills/dist/builtin/platform/gateway-tool.js +1 -1
  129. package/node_modules/@comis/skills/dist/builtin/platform/heartbeat-manage-tool.d.ts +23 -22
  130. package/node_modules/@comis/skills/dist/builtin/platform/heartbeat-manage-tool.js +1 -1
  131. package/node_modules/@comis/skills/dist/builtin/platform/image-generate-tool.d.ts +4 -3
  132. package/node_modules/@comis/skills/dist/builtin/platform/image-generate-tool.js +1 -1
  133. package/node_modules/@comis/skills/dist/builtin/platform/image-tool.d.ts +8 -7
  134. package/node_modules/@comis/skills/dist/builtin/platform/image-tool.js +1 -1
  135. package/node_modules/@comis/skills/dist/builtin/platform/mcp-manage-tool.d.ts +9 -8
  136. package/node_modules/@comis/skills/dist/builtin/platform/mcp-manage-tool.js +1 -1
  137. package/node_modules/@comis/skills/dist/builtin/platform/memory-get-tool.d.ts +5 -4
  138. package/node_modules/@comis/skills/dist/builtin/platform/memory-get-tool.js +1 -1
  139. package/node_modules/@comis/skills/dist/builtin/platform/memory-manage-tool.d.ts +12 -11
  140. package/node_modules/@comis/skills/dist/builtin/platform/memory-manage-tool.js +1 -1
  141. package/node_modules/@comis/skills/dist/builtin/platform/memory-search-tool.d.ts +4 -3
  142. package/node_modules/@comis/skills/dist/builtin/platform/memory-search-tool.js +1 -1
  143. package/node_modules/@comis/skills/dist/builtin/platform/memory-store-tool.d.ts +4 -3
  144. package/node_modules/@comis/skills/dist/builtin/platform/memory-store-tool.js +1 -1
  145. package/node_modules/@comis/skills/dist/builtin/platform/message-tool.d.ts +32 -31
  146. package/node_modules/@comis/skills/dist/builtin/platform/message-tool.js +1 -1
  147. package/node_modules/@comis/skills/dist/builtin/platform/messaging-factory.d.ts +1 -1
  148. package/node_modules/@comis/skills/dist/builtin/platform/models-manage-tool.d.ts +4 -3
  149. package/node_modules/@comis/skills/dist/builtin/platform/models-manage-tool.js +11 -4
  150. package/node_modules/@comis/skills/dist/builtin/platform/notify-tool.d.ts +6 -5
  151. package/node_modules/@comis/skills/dist/builtin/platform/notify-tool.js +1 -1
  152. package/node_modules/@comis/skills/dist/builtin/platform/obs-query-tool.d.ts +11 -10
  153. package/node_modules/@comis/skills/dist/builtin/platform/obs-query-tool.js +1 -1
  154. package/node_modules/@comis/skills/dist/builtin/platform/pipeline-tool.d.ts +37 -36
  155. package/node_modules/@comis/skills/dist/builtin/platform/pipeline-tool.js +1 -1
  156. package/node_modules/@comis/skills/dist/builtin/platform/platform-action-tool.d.ts +1 -1
  157. package/node_modules/@comis/skills/dist/builtin/platform/providers-manage-tool.d.ts +21 -20
  158. package/node_modules/@comis/skills/dist/builtin/platform/providers-manage-tool.js +1 -1
  159. package/node_modules/@comis/skills/dist/builtin/platform/session-search-tool.d.ts +6 -5
  160. package/node_modules/@comis/skills/dist/builtin/platform/session-search-tool.js +1 -1
  161. package/node_modules/@comis/skills/dist/builtin/platform/session-status-tool.d.ts +3 -2
  162. package/node_modules/@comis/skills/dist/builtin/platform/session-status-tool.js +1 -1
  163. package/node_modules/@comis/skills/dist/builtin/platform/sessions-history-tool.d.ts +5 -4
  164. package/node_modules/@comis/skills/dist/builtin/platform/sessions-history-tool.js +1 -1
  165. package/node_modules/@comis/skills/dist/builtin/platform/sessions-list-tool.d.ts +4 -3
  166. package/node_modules/@comis/skills/dist/builtin/platform/sessions-list-tool.js +1 -1
  167. package/node_modules/@comis/skills/dist/builtin/platform/sessions-manage-tool.d.ts +5 -4
  168. package/node_modules/@comis/skills/dist/builtin/platform/sessions-manage-tool.js +1 -1
  169. package/node_modules/@comis/skills/dist/builtin/platform/sessions-send-tool.d.ts +7 -6
  170. package/node_modules/@comis/skills/dist/builtin/platform/sessions-send-tool.js +1 -1
  171. package/node_modules/@comis/skills/dist/builtin/platform/sessions-spawn-tool.d.ts +15 -14
  172. package/node_modules/@comis/skills/dist/builtin/platform/sessions-spawn-tool.js +1 -1
  173. package/node_modules/@comis/skills/dist/builtin/platform/skills-manage-tool.d.ts +8 -7
  174. package/node_modules/@comis/skills/dist/builtin/platform/skills-manage-tool.js +1 -1
  175. package/node_modules/@comis/skills/dist/builtin/platform/slack-action-tool.d.ts +2 -1
  176. package/node_modules/@comis/skills/dist/builtin/platform/slack-action-tool.js +1 -1
  177. package/node_modules/@comis/skills/dist/builtin/platform/subagents-tool.d.ts +7 -6
  178. package/node_modules/@comis/skills/dist/builtin/platform/subagents-tool.js +1 -1
  179. package/node_modules/@comis/skills/dist/builtin/platform/telegram-action-tool.d.ts +2 -1
  180. package/node_modules/@comis/skills/dist/builtin/platform/telegram-action-tool.js +1 -1
  181. package/node_modules/@comis/skills/dist/builtin/platform/tokens-manage-tool.d.ts +5 -4
  182. package/node_modules/@comis/skills/dist/builtin/platform/tokens-manage-tool.js +1 -1
  183. package/node_modules/@comis/skills/dist/builtin/platform/transcribe-audio-tool.d.ts +4 -3
  184. package/node_modules/@comis/skills/dist/builtin/platform/transcribe-audio-tool.js +1 -1
  185. package/node_modules/@comis/skills/dist/builtin/platform/tts-tool.d.ts +6 -5
  186. package/node_modules/@comis/skills/dist/builtin/platform/tts-tool.js +1 -1
  187. package/node_modules/@comis/skills/dist/builtin/platform/unified-context-tool.d.ts +13 -12
  188. package/node_modules/@comis/skills/dist/builtin/platform/unified-context-tool.js +1 -1
  189. package/node_modules/@comis/skills/dist/builtin/platform/unified-memory-tool.d.ts +18 -17
  190. package/node_modules/@comis/skills/dist/builtin/platform/unified-memory-tool.js +1 -1
  191. package/node_modules/@comis/skills/dist/builtin/platform/unified-session-tool.d.ts +11 -10
  192. package/node_modules/@comis/skills/dist/builtin/platform/unified-session-tool.js +1 -1
  193. package/node_modules/@comis/skills/dist/builtin/platform/whatsapp-action-tool.d.ts +2 -1
  194. package/node_modules/@comis/skills/dist/builtin/platform/whatsapp-action-tool.js +1 -1
  195. package/node_modules/@comis/skills/dist/builtin/process-tool.d.ts +6 -5
  196. package/node_modules/@comis/skills/dist/builtin/process-tool.js +1 -1
  197. package/node_modules/@comis/skills/dist/builtin/web-fetch-tool.d.ts +5 -4
  198. package/node_modules/@comis/skills/dist/builtin/web-fetch-tool.js +1 -1
  199. package/node_modules/@comis/skills/dist/builtin/web-search-tool.d.ts +9 -8
  200. package/node_modules/@comis/skills/dist/builtin/web-search-tool.js +1 -1
  201. package/node_modules/@comis/skills/package.json +1 -1
  202. package/node_modules/@comis/web/dist/assets/{agent-detail-DqL6Artv.js → agent-detail-71BSbSfD.js} +1 -1
  203. package/node_modules/@comis/web/dist/assets/{agent-editor-CNM_h94Y.js → agent-editor-CTSDZhwT.js} +1 -1
  204. package/node_modules/@comis/web/dist/assets/{agent-list-Dbh-xD_F.js → agent-list-BEhni2ea.js} +1 -1
  205. package/node_modules/@comis/web/dist/assets/{billing-view-C1DmtyzK.js → billing-view-DVP1IvVs.js} +1 -1
  206. package/node_modules/@comis/web/dist/assets/{channel-detail-CtCH22N1.js → channel-detail-N_YK74xC.js} +1 -1
  207. package/node_modules/@comis/web/dist/assets/{channel-list-C7xXn-60.js → channel-list-DRk6ZJaF.js} +1 -1
  208. package/node_modules/@comis/web/dist/assets/{chat-console-C51pjFwk.js → chat-console-Dm-GtSf9.js} +1 -1
  209. package/node_modules/@comis/web/dist/assets/{config-editor-BLArYRB7.js → config-editor-CIferYX6.js} +1 -1
  210. package/node_modules/@comis/web/dist/assets/{context-dag-browser-fuyMinNI.js → context-dag-browser-CL84rXXM.js} +1 -1
  211. package/node_modules/@comis/web/dist/assets/{context-engine-Bngf2bH0.js → context-engine-B1HOTEZv.js} +1 -1
  212. package/node_modules/@comis/web/dist/assets/{delivery-view-C80hucxX.js → delivery-view-Y6JKYVFw.js} +1 -1
  213. package/node_modules/@comis/web/dist/assets/{diagnostics-view-Cl4VbHZ6.js → diagnostics-view-DWV1UQjz.js} +1 -1
  214. package/node_modules/@comis/web/dist/assets/{ic-chat-message-ByFUoMm6.js → ic-chat-message-DfSERzzg.js} +1 -1
  215. package/node_modules/@comis/web/dist/assets/{ic-connection-dot-C4nDHgY2.js → ic-connection-dot-CXyhlJup.js} +1 -1
  216. package/node_modules/@comis/web/dist/assets/{ic-tool-call-Bh5kq-yY.js → ic-tool-call-DNmwTjek.js} +1 -1
  217. package/node_modules/@comis/web/dist/assets/{index-BBkuC-EU.js → index-CBr0Tm9_.js} +2 -2
  218. package/node_modules/@comis/web/dist/assets/{mcp-management-DB-phOo7.js → mcp-management-BaH2-vox.js} +1 -1
  219. package/node_modules/@comis/web/dist/assets/{media-config-CRqZ1ZUH.js → media-config-CZLshJoN.js} +1 -1
  220. package/node_modules/@comis/web/dist/assets/{media-test-C9vE20Oy.js → media-test-C9NUWgo_.js} +1 -1
  221. package/node_modules/@comis/web/dist/assets/{memory-inspector-CeqfnxMZ.js → memory-inspector-D_fmTcRN.js} +1 -1
  222. package/node_modules/@comis/web/dist/assets/{message-center-Daup7Mof.js → message-center-BBFlNCZn.js} +1 -1
  223. package/node_modules/@comis/web/dist/assets/{models-DLYnEU8E.js → models-BytGLm99.js} +1 -1
  224. package/node_modules/@comis/web/dist/assets/{observe-view-BTSt_PO5.js → observe-view-VXtHqaqq.js} +1 -1
  225. package/node_modules/@comis/web/dist/assets/{pipeline-builder-DknfzyLt.js → pipeline-builder-CfXczlfJ.js} +1 -1
  226. package/node_modules/@comis/web/dist/assets/{pipeline-history-JnHZdeU_.js → pipeline-history-CPmXFnbe.js} +1 -1
  227. package/node_modules/@comis/web/dist/assets/{pipeline-history-detail-Dg4knsEb.js → pipeline-history-detail-DcueTMs9.js} +1 -1
  228. package/node_modules/@comis/web/dist/assets/{pipeline-list-AEnibjsp.js → pipeline-list-B-xG5WZh.js} +1 -1
  229. package/node_modules/@comis/web/dist/assets/{pipeline-monitor-DG7RbIOO.js → pipeline-monitor-pnIOYaSY.js} +1 -1
  230. package/node_modules/@comis/web/dist/assets/{scheduler-uL1fYKAT.js → scheduler-BtUIFHhA.js} +1 -1
  231. package/node_modules/@comis/web/dist/assets/{security-C3DywRLH.js → security-C8mWRq2y.js} +1 -1
  232. package/node_modules/@comis/web/dist/assets/{session-detail-BtqCNWXV.js → session-detail-DgdkO5ka.js} +1 -1
  233. package/node_modules/@comis/web/dist/assets/{session-list-CJXWa2XT.js → session-list-DcylcfTn.js} +1 -1
  234. package/node_modules/@comis/web/dist/assets/{setup-wizard-ywn7oJvu.js → setup-wizard-BP5yjsuL.js} +75 -39
  235. package/node_modules/@comis/web/dist/assets/{skills-DX0KYnWD.js → skills-DXt1bX8Z.js} +1 -1
  236. package/node_modules/@comis/web/dist/assets/{subagents-B8p5YJEB.js → subagents-C7YbUHXY.js} +1 -1
  237. package/node_modules/@comis/web/dist/assets/{workspace-manager-CgzNIrw1.js → workspace-manager-DP6pW4wa.js} +1 -1
  238. package/node_modules/@comis/web/dist/index.html +1 -1
  239. package/node_modules/@comis/web/package.json +1 -1
  240. package/npm-shrinkwrap.json +6126 -0
  241. package/package.json +74 -74
@@ -775,6 +775,12 @@ export function createPiExecutor(config, deps) {
775
775
  session.abortCompaction();
776
776
  suppressError(session.abort(), "session abort on compaction cancel");
777
777
  },
778
+ // 260501-dkl: cancel the SDK's internal auto-retry loop when the
779
+ // bridge classifies the auto_retry_start error as `rate_limited`.
780
+ // Rate-limit windows (per-minute) outlast the SDK's retry budget
781
+ // (~30s), so retrying within the window cannot succeed.
782
+ // `abortRetry()` is sync void -- no error suppression needed.
783
+ onAbortRetry: () => session.abortRetry(),
778
784
  getContextUsage: () => {
779
785
  // Defensive try-catch: upstream estimateTokens() in pi-coding-agent
780
786
  // crashes with "message.content is not iterable" when an assistant
@@ -7,11 +7,10 @@
7
7
  *
8
8
  * @module
9
9
  */
10
+ import { isAnthropicFamily } from "../../provider/capabilities.js";
10
11
  // ---------------------------------------------------------------------------
11
12
  // Internal helpers
12
13
  // ---------------------------------------------------------------------------
13
- /** Anthropic-family providers that support cache_control breakpoints. */
14
- const ANTHROPIC_FAMILY = new Set(["anthropic", "anthropic-vertex", "amazon-bedrock"]);
15
14
  /** SYS-BOUNDARY: Deterministic marker between static and dynamic system prompt blocks.
16
15
  * Enables cache break diagnostics to identify whether changes are in the
17
16
  * stable or dynamic portion. Appended to staticPrefix block. */
@@ -64,7 +63,7 @@ export function createConfigResolver(config, logger) {
64
63
  }
65
64
  // Inject cacheRetention for Anthropic-family providers when truthy
66
65
  // Resolve dynamic getter for per-execution cache retention override
67
- if (ANTHROPIC_FAMILY.has(model.provider)) {
66
+ if (isAnthropicFamily(model.provider)) {
68
67
  const retention = typeof config.cacheRetention === "function"
69
68
  ? config.cacheRetention()
70
69
  : config.cacheRetention;
@@ -15,6 +15,7 @@
15
15
  import { SYSTEM_PROMPT_DYNAMIC_BOUNDARY, resolveBreakpointStrategy } from "./config-resolver.js";
16
16
  import { createAccumulativeLatch } from "../session-latch.js";
17
17
  import { MIN_CACHEABLE_TOKENS, DEFAULT_MIN_CACHEABLE_TOKENS, CHARS_PER_TOKEN_RATIO, CHARS_PER_TOKEN_RATIO_STRUCTURED, CACHE_LOOKBACK_WINDOW } from "../../context-engine/index.js";
18
+ import { isAnthropicFamily } from "../../provider/capabilities.js";
18
19
  import { estimateContextChars } from "../../safety/token-estimator.js";
19
20
  import { computeHash, djb2 } from "../cache-break-detection.js";
20
21
  import { supportsToolSearch } from "../tool-deferral.js";
@@ -83,8 +84,6 @@ export function resolveCacheRetention(modelId, agentRetention, overrides) {
83
84
  // ---------------------------------------------------------------------------
84
85
  /** Anthropic beta header for 1M context window. */
85
86
  const CONTEXT_1M_BETA = "context-1m-2025-08-07";
86
- /** Anthropic-family providers that support cache_control breakpoints. */
87
- const ANTHROPIC_FAMILY = new Set(["anthropic", "anthropic-vertex", "amazon-bedrock"]);
88
87
  /** Check if a model uses the OpenAI Responses API. */
89
88
  function isResponsesApiProvider(model) {
90
89
  return model.api === "openai-responses" || model.api === "azure-openai-responses";
@@ -861,7 +860,7 @@ export function estimateBlockTokens(block) {
861
860
  export function createRequestBodyInjector(config, logger) {
862
861
  return function requestBodyInjector(next) {
863
862
  return (model, context, options) => {
864
- const needsCacheBreakpoints = ANTHROPIC_FAMILY.has(model.provider);
863
+ const needsCacheBreakpoints = isAnthropicFamily(model.provider);
865
864
  const needsResponsesApiInjection = isResponsesApiProvider(model);
866
865
  if (!needsCacheBreakpoints && !needsResponsesApiInjection) {
867
866
  return next(model, context, options);
@@ -11,11 +11,10 @@
11
11
  *
12
12
  * @module
13
13
  */
14
+ import { isAnthropicFamily } from "../provider/capabilities.js";
14
15
  // ---------------------------------------------------------------------------
15
16
  // Constants
16
17
  // ---------------------------------------------------------------------------
17
- /** Anthropic-family providers that support cache_control breakpoints. */
18
- const ANTHROPIC_FAMILY = new Set(["anthropic", "anthropic-vertex", "amazon-bedrock"]);
19
18
  /** TTL boundaries in milliseconds, keyed by CacheRetention value.
20
19
  * "short" = 5 minutes, "long" = 60 minutes. */
21
20
  const TTL_BOUNDARIES = {
@@ -42,7 +41,7 @@ export function createTtlGuard(config) {
42
41
  return function ttlGuard(next) {
43
42
  return (model, context, options) => {
44
43
  // Non-Anthropic providers skip TTL check entirely
45
- if (!ANTHROPIC_FAMILY.has(model.provider)) {
44
+ if (!isAnthropicFamily(model.provider)) {
46
45
  return next(model, context, options);
47
46
  }
48
47
  // Cold-start: no prior timestamp for this session
@@ -172,7 +172,8 @@ export { computeTokenBudget } from "./context-engine/index.js";
172
172
  export type { ContextEngine, ContextEngineDeps, ContextLayer, TokenBudget, ContextEngineMetrics, AssembledContext, LayerCircuitBreaker, } from "./context-engine/index.js";
173
173
  export { reconcileJsonlToDag, installDagIngestionHook, createDagContextEngine, runLeafPass, runCondensedPass, resolveFreshTailBoundary, shouldCompact, markAncestorsDirty, recomputeDescendantCounts, runDagCompaction, checkIntegrity, CHARS_PER_TOKEN_RATIO, } from "./context-engine/index.js";
174
174
  export type { ReconciliationResult, DagContextEngineDeps, CompactionDeps, DagCompactionConfig, DagCompactionDeps, IntegrityCheckDeps, IntegrityReport, IntegrityIssue, } from "./context-engine/index.js";
175
- export { DEFAULTS as PROVIDER_CAPABILITY_DEFAULTS, resolveProviderCapabilities, normalizeProviderId, isAnthropicFamily, isOpenAiFamily, shouldDropThinkingBlocks, resolveToolCallIdMode, } from "./provider/capabilities.js";
175
+ export { DEFAULTS as PROVIDER_CAPABILITY_DEFAULTS, resolveProviderCapabilities, normalizeProviderId, isAnthropicFamily, isOpenAiFamily, shouldDropThinkingBlocks, resolveToolCallIdMode, validateProviderOverrides, } from "./provider/capabilities.js";
176
+ export type { ProviderOverridesValidatorLogger } from "./provider/capabilities.js";
176
177
  export { normalizeModelCompat } from "./provider/model-compat.js";
177
178
  export { normalizeModelId } from "./provider/model-id-normalize.js";
178
179
  export type { ModelIdNormalizationResult } from "./provider/model-id-normalize.js";
@@ -185,7 +186,8 @@ export { createThinkingTagFilter } from "./response-filter/thinking-tag-filter.j
185
186
  export type { ThinkingTagFilter, ThinkingTagFilterOptions } from "./response-filter/thinking-tag-filter.js";
186
187
  export { resolveOperationModel, resolveProviderFamily } from "./model/operation-model-resolver.js";
187
188
  export type { OperationModelResolution } from "./model/operation-model-resolver.js";
188
- export { OPERATION_MODEL_DEFAULTS, OPERATION_TIER_MAP, OPERATION_TIMEOUT_DEFAULTS, OPERATION_CACHE_DEFAULTS } from "./model/operation-model-defaults.js";
189
+ export { resolveOperationDefaults, OPERATION_TIER_MAP, OPERATION_TIMEOUT_DEFAULTS, OPERATION_CACHE_DEFAULTS } from "./model/operation-model-defaults.js";
190
+ export { resolveCompactionModel } from "./model/compaction-model-resolver.js";
189
191
  export { createSessionLatch } from "./executor/session-latch.js";
190
192
  export type { SessionLatch } from "./executor/session-latch.js";
191
193
  export * from "./background/index.js";
@@ -173,7 +173,7 @@ export { computeTokenBudget } from "./context-engine/index.js";
173
173
  // DAG reconciliation, compaction, integrity, and assembler (Phases 411-414)
174
174
  export { reconcileJsonlToDag, installDagIngestionHook, createDagContextEngine, runLeafPass, runCondensedPass, resolveFreshTailBoundary, shouldCompact, markAncestorsDirty, recomputeDescendantCounts, runDagCompaction, checkIntegrity, CHARS_PER_TOKEN_RATIO, } from "./context-engine/index.js";
175
175
  // Provider capabilities
176
- export { DEFAULTS as PROVIDER_CAPABILITY_DEFAULTS, resolveProviderCapabilities, normalizeProviderId, isAnthropicFamily, isOpenAiFamily, shouldDropThinkingBlocks, resolveToolCallIdMode, } from "./provider/capabilities.js";
176
+ export { DEFAULTS as PROVIDER_CAPABILITY_DEFAULTS, resolveProviderCapabilities, normalizeProviderId, isAnthropicFamily, isOpenAiFamily, shouldDropThinkingBlocks, resolveToolCallIdMode, validateProviderOverrides, } from "./provider/capabilities.js";
177
177
  // Model compatibility auto-detection (xAI compat flags)
178
178
  export { normalizeModelCompat } from "./provider/model-compat.js";
179
179
  // Model ID normalization ()
@@ -187,7 +187,8 @@ export { findCodeRegions, isInsideCode } from "./response-filter/code-regions.js
187
187
  export { createThinkingTagFilter } from "./response-filter/thinking-tag-filter.js";
188
188
  // Operation model resolver
189
189
  export { resolveOperationModel, resolveProviderFamily } from "./model/operation-model-resolver.js";
190
- export { OPERATION_MODEL_DEFAULTS, OPERATION_TIER_MAP, OPERATION_TIMEOUT_DEFAULTS, OPERATION_CACHE_DEFAULTS } from "./model/operation-model-defaults.js";
190
+ export { resolveOperationDefaults, OPERATION_TIER_MAP, OPERATION_TIMEOUT_DEFAULTS, OPERATION_CACHE_DEFAULTS } from "./model/operation-model-defaults.js";
191
+ export { resolveCompactionModel } from "./model/compaction-model-resolver.js";
191
192
  // SessionLatch utility
192
193
  export { createSessionLatch } from "./executor/session-latch.js";
193
194
  // Background task infrastructure
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Compaction-model resolver: runtime-resolves the `compactionModel`
3
+ * configuration field from the pi-ai catalog when the schema default
4
+ * is the empty string.
5
+ *
6
+ * Why this exists:
7
+ * The `compactionModel` field used to default to a hardcoded Anthropic
8
+ * literal ("anthropic:claude-haiku-4-5-20250929"). When operators
9
+ * switched their primary provider to OpenRouter, Google, etc., compaction
10
+ * still routed to Claude Haiku, defeating the cost-tiering intent and
11
+ * causing cross-provider auth confusion (no Anthropic API key configured).
12
+ *
13
+ * Phase 2C-2 changes the schema default to "" and resolves at runtime:
14
+ * pick the fast-tier model from `resolveOperationDefaults(primaryProvider)`,
15
+ * with `getModels(primaryProvider)[0]` as the catalog-fallback.
16
+ *
17
+ * Note: explicit `compactionModel` values from existing YAML configs win
18
+ * unchanged (length > 0 short-circuits the resolver). No backward-compat
19
+ * shim per `feedback_no_backward_compat.md`.
20
+ *
21
+ * @module
22
+ */
23
+ /**
24
+ * Resolve the effective compaction model id, in "provider:modelId" format.
25
+ *
26
+ * Resolution rules:
27
+ * 1. If `configValue` is non-empty, return it unchanged (operator explicit).
28
+ * 2. Otherwise, derive the fast-tier model from `resolveOperationDefaults`
29
+ * for the agent's primary provider; fall back to first catalog model
30
+ * id if cost-tiering returned nothing (custom YAML provider).
31
+ * 3. If neither tiering nor catalog produces a candidate (unknown provider
32
+ * with empty catalog), return "" so the consumer can fall through to
33
+ * session model — graceful degradation.
34
+ *
35
+ * Pure function — no side effects, no async. Safe to call per-execute.
36
+ *
37
+ * @param configValue - Raw `contextEngine.compactionModel` from agent config
38
+ * @param primaryProvider - Agent's primary provider (e.g. "anthropic", "openrouter")
39
+ * @returns Resolved model in "provider:modelId" format, or "" for graceful fallback
40
+ */
41
+ export declare function resolveCompactionModel(configValue: string, primaryProvider: string): string;
@@ -0,0 +1,51 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ /**
3
+ * Compaction-model resolver: runtime-resolves the `compactionModel`
4
+ * configuration field from the pi-ai catalog when the schema default
5
+ * is the empty string.
6
+ *
7
+ * Why this exists:
8
+ * The `compactionModel` field used to default to a hardcoded Anthropic
9
+ * literal ("anthropic:claude-haiku-4-5-20250929"). When operators
10
+ * switched their primary provider to OpenRouter, Google, etc., compaction
11
+ * still routed to Claude Haiku, defeating the cost-tiering intent and
12
+ * causing cross-provider auth confusion (no Anthropic API key configured).
13
+ *
14
+ * Phase 2C-2 changes the schema default to "" and resolves at runtime:
15
+ * pick the fast-tier model from `resolveOperationDefaults(primaryProvider)`,
16
+ * with `getModels(primaryProvider)[0]` as the catalog-fallback.
17
+ *
18
+ * Note: explicit `compactionModel` values from existing YAML configs win
19
+ * unchanged (length > 0 short-circuits the resolver). No backward-compat
20
+ * shim per `feedback_no_backward_compat.md`.
21
+ *
22
+ * @module
23
+ */
24
+ import { getModels } from "@mariozechner/pi-ai";
25
+ import { resolveOperationDefaults } from "./operation-model-defaults.js";
26
+ /**
27
+ * Resolve the effective compaction model id, in "provider:modelId" format.
28
+ *
29
+ * Resolution rules:
30
+ * 1. If `configValue` is non-empty, return it unchanged (operator explicit).
31
+ * 2. Otherwise, derive the fast-tier model from `resolveOperationDefaults`
32
+ * for the agent's primary provider; fall back to first catalog model
33
+ * id if cost-tiering returned nothing (custom YAML provider).
34
+ * 3. If neither tiering nor catalog produces a candidate (unknown provider
35
+ * with empty catalog), return "" so the consumer can fall through to
36
+ * session model — graceful degradation.
37
+ *
38
+ * Pure function — no side effects, no async. Safe to call per-execute.
39
+ *
40
+ * @param configValue - Raw `contextEngine.compactionModel` from agent config
41
+ * @param primaryProvider - Agent's primary provider (e.g. "anthropic", "openrouter")
42
+ * @returns Resolved model in "provider:modelId" format, or "" for graceful fallback
43
+ */
44
+ export function resolveCompactionModel(configValue, primaryProvider) {
45
+ if (configValue.length > 0)
46
+ return configValue;
47
+ const tier = resolveOperationDefaults(primaryProvider);
48
+ const firstId = getModels(primaryProvider)[0]?.id;
49
+ const modelId = tier.fast ?? firstId;
50
+ return modelId ? `${primaryProvider}:${modelId}` : "";
51
+ }
@@ -21,13 +21,6 @@ import { getModels, getProviders } from "@mariozechner/pi-ai";
21
21
  export function createModelRegistryAdapter(authStorage) {
22
22
  return ModelRegistry.inMemory(authStorage);
23
23
  }
24
- /**
25
- * YAML provider type → pi-ai API identifier. Mirrors the
26
- * `OPENAI_COMPATIBLE_TYPES` set in `model-scanner.ts`. Unknown types
27
- * default to `openai-completions` so arbitrary OpenAI-compatible
28
- * proxies (NVIDIA NIM, Together, ollama, lm-studio, etc.) work without
29
- * code changes.
30
- */
31
24
  /**
32
25
  * Provider types that can register without an API key.
33
26
  *
@@ -40,19 +33,45 @@ export function createModelRegistryAdapter(authStorage) {
40
33
  * Ollama ignores Authorization unless `OLLAMA_API_KEY` is set server-side.
41
34
  */
42
35
  const KEYLESS_PROVIDER_TYPES = new Set(["ollama"]);
43
- const PROVIDER_TYPE_TO_API = {
44
- openai: "openai-completions",
45
- groq: "openai-completions",
46
- mistral: "openai-completions",
36
+ const _builtInProviders = new Set(getProviders());
37
+ /**
38
+ * Infer pi-ai wire API from the live catalog.
39
+ *
40
+ * For any provider name that pi-ai exposes via `getProviders()`, read the
41
+ * `api` field from the first registered model. This is the single source of
42
+ * truth: when pi-ai adds a provider with a new wire format (e.g. a future
43
+ * `xyz-streaming` API), this helper picks it up automatically without any
44
+ * comis code change.
45
+ *
46
+ * Returns `undefined` when the type is not in the native catalog -- callers
47
+ * should chain to `FALLBACK_API_FOR_CUSTOM_TYPES` and finally to the
48
+ * `openai-completions` default for arbitrary OpenAI-compatible proxies.
49
+ */
50
+ function inferApiFromCatalog(type) {
51
+ if (!_builtInProviders.has(type))
52
+ return undefined;
53
+ const models = getModels(type);
54
+ return models[0]?.api;
55
+ }
56
+ /**
57
+ * Tiny fallback table for custom provider types pi-ai does NOT ship in its
58
+ * native catalog. These are local inference servers and legacy aliases that
59
+ * speak OpenAI-compatible wire format but have no provider entry in
60
+ * `models.generated.ts`. Everything else falls through to
61
+ * `"openai-completions"` -- the safe default for arbitrary OpenAI-compatible
62
+ * proxies (NVIDIA NIM, Fireworks, Perplexity, vLLM, llama.cpp, etc.).
63
+ */
64
+ const FALLBACK_API_FOR_CUSTOM_TYPES = {
65
+ ollama: "openai-completions",
66
+ "lm-studio": "openai-completions",
47
67
  together: "openai-completions",
48
- deepseek: "openai-completions",
49
- cerebras: "openai-completions",
50
- xai: "openai-completions",
51
- openrouter: "openai-completions",
52
- anthropic: "anthropic-messages",
53
- google: "google-generative-ai",
54
68
  };
55
- const _builtInProviders = new Set(getProviders());
69
+ /**
70
+ * API resolution model for `entry.type`:
71
+ * 1. catalog-first -- `inferApiFromCatalog(type)` reads the live pi-ai catalog
72
+ * 2. fallback-second -- `FALLBACK_API_FOR_CUSTOM_TYPES[type]` for legacy custom types
73
+ * 3. default-final -- `"openai-completions"` for arbitrary OpenAI-compatible proxies
74
+ */
56
75
  function getBuiltInBaseUrl(type) {
57
76
  if (!_builtInProviders.has(type))
58
77
  return undefined;
@@ -94,15 +113,81 @@ export function registerCustomProviders(registry, entries, secretManager, logger
94
113
  if (isBuiltInType && providerName !== entry.type) {
95
114
  providerAliases.set(providerName, entry.type);
96
115
  }
97
- const customModels = isBuiltInType
98
- ? entry.models.filter((m) => !builtInIds.has(m.id))
99
- : [...entry.models];
100
- if (isBuiltInType && customModels.length < entry.models.length) {
101
- const skipped = entry.models.length - customModels.length;
102
- logger.debug({ providerName, type: entry.type, skipped, remaining: customModels.length }, "Skipped built-in models already in pi SDK catalog");
116
+ // Layer 1B (260430-vwt): catalog-aware model enrichment.
117
+ //
118
+ // Before computing customModels, decide whether to inherit the full
119
+ // pi-ai catalog or to enrich the user's sparse list with catalog
120
+ // metadata.
121
+ //
122
+ // Inherit branch (empty list + built-in type + no baseUrl override):
123
+ // user wants the full native catalog under this provider name --
124
+ // bypass the dedup filter below; the inherited list is intentional.
125
+ // Enrich branch (sparse list + built-in type):
126
+ // for each user model, fill missing fields from the catalog when an
127
+ // ID match is found. The dedup filter still applies after enrichment
128
+ // so that user-supplied IDs already in pi-ai's built-in catalog are
129
+ // served via the built-in path (not redundantly registered).
130
+ const hasBaseUrlOverride = !!entry.baseUrl;
131
+ const shouldInheritCatalog = entry.models.length === 0 && isBuiltInType && !hasBaseUrlOverride;
132
+ let workingModels;
133
+ if (shouldInheritCatalog) {
134
+ // Inherit the full native catalog -- no dedup, no fallback values.
135
+ const catalogModels = getModels(entry.type);
136
+ workingModels = catalogModels.map((m) => ({
137
+ id: m.id,
138
+ name: m.name,
139
+ contextWindow: m.contextWindow,
140
+ maxTokens: m.maxTokens,
141
+ reasoning: m.reasoning,
142
+ input: m.input,
143
+ cost: m.cost,
144
+ }));
145
+ logger.debug({ providerName, type: entry.type, inherited: workingModels.length }, "Inherited full pi-ai native catalog (empty user list)");
103
146
  }
147
+ else if (isBuiltInType) {
148
+ // Sparse list: enrich each user model with catalog data, then dedup.
149
+ const catalog = getModels(entry.type);
150
+ const enriched = entry.models.map((m) => {
151
+ const cat = catalog.find((c) => c.id === m.id);
152
+ if (!cat) {
153
+ return {
154
+ id: m.id,
155
+ name: m.name,
156
+ contextWindow: m.contextWindow,
157
+ maxTokens: m.maxTokens,
158
+ reasoning: m.reasoning,
159
+ input: m.input,
160
+ cost: m.cost,
161
+ };
162
+ }
163
+ return {
164
+ id: m.id,
165
+ name: m.name ?? cat.name,
166
+ contextWindow: m.contextWindow ?? cat.contextWindow,
167
+ maxTokens: m.maxTokens ?? cat.maxTokens,
168
+ reasoning: m.reasoning ?? cat.reasoning,
169
+ input: m.input ?? cat.input,
170
+ cost: {
171
+ input: m.cost?.input ?? cat.cost?.input,
172
+ output: m.cost?.output ?? cat.cost?.output,
173
+ cacheRead: m.cost?.cacheRead ?? cat.cost?.cacheRead,
174
+ cacheWrite: m.cost?.cacheWrite ?? cat.cost?.cacheWrite,
175
+ },
176
+ };
177
+ });
178
+ // Dedup: filter out built-in IDs (already served via pi-ai's built-in path).
179
+ workingModels = enriched.filter((m) => !builtInIds.has(m.id));
180
+ if (workingModels.length < entry.models.length) {
181
+ const skipped = entry.models.length - workingModels.length;
182
+ logger.debug({ providerName, type: entry.type, skipped, remaining: workingModels.length }, "Skipped built-in models already in pi SDK catalog");
183
+ }
184
+ }
185
+ else {
186
+ // Custom (non-catalog) type: user-supplied list as-is.
187
+ workingModels = [...entry.models];
188
+ }
189
+ const customModels = workingModels;
104
190
  const hasModels = customModels.length > 0;
105
- const hasBaseUrlOverride = !!entry.baseUrl;
106
191
  if (!hasModels && !hasBaseUrlOverride) {
107
192
  logger.debug({ providerName }, "Custom provider skipped (no custom models and no baseUrl override)");
108
193
  continue;
@@ -118,7 +203,9 @@ export function registerCustomProviders(registry, entries, secretManager, logger
118
203
  }, "Custom provider has models but no API key -- skipping registration");
119
204
  continue;
120
205
  }
121
- const api = PROVIDER_TYPE_TO_API[entry.type] ?? "openai-completions";
206
+ const api = inferApiFromCatalog(entry.type)
207
+ ?? FALLBACK_API_FOR_CUSTOM_TYPES[entry.type]
208
+ ?? "openai-completions";
122
209
  const headersResolved = Object.keys(entry.headers).length > 0 ? entry.headers : undefined;
123
210
  const resolvedApiKey = apiKey ?? (isKeylessType ? "ollama-no-auth" : undefined);
124
211
  if (resolvedApiKey === "ollama-no-auth") {
@@ -50,6 +50,33 @@ export interface ModelScanner {
50
50
  /** Scan all configured providers in parallel. */
51
51
  scanAll(providers: Record<string, ProviderScanAllEntry>, resolveKey: (keyName: string) => string | undefined): Promise<ScanResult[]>;
52
52
  }
53
+ /**
54
+ * Read the baseUrl for a provider type from the live pi-ai catalog.
55
+ * Returns undefined when the type is not in the native catalog.
56
+ *
57
+ * Exported for testing -- in production, callers should use `buildEndpoint`
58
+ * which chains catalog-first → user-supplied baseUrl → hardcoded fallback.
59
+ */
60
+ export declare function getCatalogBaseUrl(type: string): string | undefined;
61
+ /**
62
+ * Whether a provider type should be scanned with the OpenAI-compatible
63
+ * /v1/models endpoint shape.
64
+ *
65
+ * Anthropic and Google have their own dedicated scan paths. Every other
66
+ * type -- whether it's a native pi-ai provider with an `openai-completions`
67
+ * primary api (groq, openrouter, cerebras, xai, ...), a native provider
68
+ * whose primary api is something like `openai-responses` or
69
+ * `mistral-conversations` (these still typically expose /v1/models for
70
+ * compat), or a custom non-catalog type (NVIDIA NIM, Together, Fireworks,
71
+ * Ollama, vLLM, ...) -- is scanned via the OpenAI-compatible shape.
72
+ *
73
+ * This is intentionally permissive: the scanner's job is API-key
74
+ * validation, and most providers expose /v1/models regardless of their
75
+ * primary wire format.
76
+ *
77
+ * Exported for testing.
78
+ */
79
+ export declare function isOpenAICompatibleType(type: string): boolean;
53
80
  /**
54
81
  * Create a model scanner with injectable fetch and timeout.
55
82
  *
@@ -12,36 +12,75 @@
12
12
  *
13
13
  * @module
14
14
  */
15
+ import { getModels, getProviders } from "@mariozechner/pi-ai";
15
16
  // ---------------------------------------------------------------------------
16
- // Provider-specific endpoint builders
17
+ // Catalog-driven endpoint resolution (Layer 1E -- 260430-vwt)
17
18
  // ---------------------------------------------------------------------------
18
- /** Default base URLs per provider type. */
19
- const DEFAULT_BASE_URLS = {
20
- openai: "https://api.openai.com",
21
- anthropic: "https://api.anthropic.com",
22
- google: "https://generativelanguage.googleapis.com",
23
- };
24
- /** OpenAI-compatible provider types. */
25
- const OPENAI_COMPATIBLE_TYPES = new Set([
26
- "openai",
27
- "groq",
28
- "mistral",
29
- "together",
30
- "deepseek",
31
- "cerebras",
32
- "xai",
33
- "openrouter",
34
- ]);
19
+ /**
20
+ * Native pi-ai providers from the live catalog. Used to source baseUrls
21
+ * for scanner endpoints when the user has not supplied an explicit
22
+ * baseUrl override.
23
+ */
24
+ const _nativeProviders = new Set(getProviders());
25
+ /**
26
+ * Hardcoded fallback base URLs for the three "first-party" provider
27
+ * families. These remain only as last-resort defaults when pi-ai's catalog
28
+ * returns nothing for a given type (e.g., a custom proxy named "openai"
29
+ * with type:"openai" but no baseUrl). The catalog is the source of truth;
30
+ * these constants are explicit, discoverable backstops.
31
+ */
32
+ const OPENAI_FALLBACK_BASE_URL = "https://api.openai.com";
33
+ const ANTHROPIC_FALLBACK_BASE_URL = "https://api.anthropic.com";
34
+ const GOOGLE_FALLBACK_BASE_URL = "https://generativelanguage.googleapis.com";
35
+ /**
36
+ * Read the baseUrl for a provider type from the live pi-ai catalog.
37
+ * Returns undefined when the type is not in the native catalog.
38
+ *
39
+ * Exported for testing -- in production, callers should use `buildEndpoint`
40
+ * which chains catalog-first → user-supplied baseUrl → hardcoded fallback.
41
+ */
42
+ export function getCatalogBaseUrl(type) {
43
+ if (!_nativeProviders.has(type))
44
+ return undefined;
45
+ return getModels(type)[0]?.baseUrl;
46
+ }
47
+ /**
48
+ * Whether a provider type should be scanned with the OpenAI-compatible
49
+ * /v1/models endpoint shape.
50
+ *
51
+ * Anthropic and Google have their own dedicated scan paths. Every other
52
+ * type -- whether it's a native pi-ai provider with an `openai-completions`
53
+ * primary api (groq, openrouter, cerebras, xai, ...), a native provider
54
+ * whose primary api is something like `openai-responses` or
55
+ * `mistral-conversations` (these still typically expose /v1/models for
56
+ * compat), or a custom non-catalog type (NVIDIA NIM, Together, Fireworks,
57
+ * Ollama, vLLM, ...) -- is scanned via the OpenAI-compatible shape.
58
+ *
59
+ * This is intentionally permissive: the scanner's job is API-key
60
+ * validation, and most providers expose /v1/models regardless of their
61
+ * primary wire format.
62
+ *
63
+ * Exported for testing.
64
+ */
65
+ export function isOpenAICompatibleType(type) {
66
+ if (type === "anthropic" || type === "google")
67
+ return false;
68
+ return true;
69
+ }
35
70
  function buildEndpoint(providerType, baseUrl, apiKey) {
36
- if (OPENAI_COMPATIBLE_TYPES.has(providerType)) {
37
- const base = baseUrl || DEFAULT_BASE_URLS["openai"];
71
+ if (isOpenAICompatibleType(providerType)) {
72
+ const base = baseUrl
73
+ || getCatalogBaseUrl(providerType)
74
+ || OPENAI_FALLBACK_BASE_URL;
38
75
  return {
39
76
  url: `${base}/v1/models`,
40
77
  headers: { Authorization: `Bearer ${apiKey}` },
41
78
  };
42
79
  }
43
80
  if (providerType === "anthropic") {
44
- const base = baseUrl || DEFAULT_BASE_URLS["anthropic"];
81
+ const base = baseUrl
82
+ || getCatalogBaseUrl(providerType)
83
+ || ANTHROPIC_FALLBACK_BASE_URL;
45
84
  return {
46
85
  url: `${base}/v1/models`,
47
86
  headers: {
@@ -51,7 +90,9 @@ function buildEndpoint(providerType, baseUrl, apiKey) {
51
90
  };
52
91
  }
53
92
  if (providerType === "google") {
54
- const base = baseUrl || DEFAULT_BASE_URLS["google"];
93
+ const base = baseUrl
94
+ || getCatalogBaseUrl(providerType)
95
+ || GOOGLE_FALLBACK_BASE_URL;
55
96
  return {
56
97
  url: `${base}/v1beta/models?key=${apiKey}`,
57
98
  headers: {},
@@ -63,7 +104,7 @@ function buildEndpoint(providerType, baseUrl, apiKey) {
63
104
  // Response parsers
64
105
  // ---------------------------------------------------------------------------
65
106
  function parseModelIds(providerType, body) {
66
- if (OPENAI_COMPATIBLE_TYPES.has(providerType) || providerType === "anthropic") {
107
+ if (isOpenAICompatibleType(providerType) || providerType === "anthropic") {
67
108
  const data = body?.data;
68
109
  if (!Array.isArray(data))
69
110
  return [];
@@ -1,28 +1,50 @@
1
1
  /**
2
- * Operation model defaults: static maps for provider-family model tiering.
2
+ * Operation model defaults: catalog-derived per-provider model tiering.
3
3
  *
4
- * These maps define the zero-config smart defaults for non-interactive
5
- * operations. When no explicit operationModels config is set, the resolver
6
- * uses these to select cost-appropriate models per provider family.
4
+ * Replaces the previous hardcoded `OPERATION_MODEL_DEFAULTS` table (which
5
+ * pinned `mid`/`fast` model IDs per provider family) with a pure function
6
+ * that reads the live pi-ai catalog at call time. Two design properties:
7
7
  *
8
- * Default model IDs are verified against pi-ai SDK registry v0.65.0.
9
- * Do NOT call normalizeModelId() on these -- they are already valid
10
- * registry IDs that bypass normalization.
8
+ * 1. Pi-ai SDK upgrades automatically light up new providers/models — no
9
+ * per-release source edits to bump `OPERATION_MODEL_DEFAULTS` literals.
10
+ * 2. Closes the latent bug where switching primary to a non-Anthropic
11
+ * provider left cron/heartbeat/compaction routed to Claude Sonnet
12
+ * (because the old map was Anthropic/OpenAI/Google only).
13
+ *
14
+ * Tier picking: filter to text-capable models with non-zero cost, sort
15
+ * ascending by total cost (input + output), pick 10th-percentile = `fast`,
16
+ * 50th-percentile = `mid`. All-free-models providers (e.g. local Ollama,
17
+ * Z.AI most models) fall back to "first text-capable id" for both slots.
11
18
  *
12
19
  * @module
13
20
  */
14
21
  import type { ModelOperationType } from "@comis/core";
15
22
  /**
16
- * Per-provider-family default models for mid-tier and fast-tier operations.
23
+ * Resolve cost-tier model defaults for a given native pi-ai provider.
24
+ *
25
+ * Returns `{ fast, mid }` model IDs (without provider prefix) selected from
26
+ * the catalog by ascending total cost. Both undefined fields when the
27
+ * provider is unknown to pi-ai (e.g. custom YAML providers like Ollama).
28
+ *
29
+ * Algorithm:
30
+ * 1. Fetch `getModels(provider)` -> all models for that provider.
31
+ * 2. Filter to models supporting text input (`m.input.includes("text")`).
32
+ * 3. Filter to non-zero cost (eliminates free/local-only models from
33
+ * ranking — they won't be reachable in production).
34
+ * 4. Sort ascending by total cost.
35
+ * 5. `fast` = 10th percentile, `mid` = 50th percentile.
36
+ * 6. If post-filter set is empty (all-free provider), use the first
37
+ * text-capable model id for both slots.
38
+ *
39
+ * Pure function — no async, no side effects. Re-callable per request.
17
40
  *
18
- * - anthropic: Sonnet 4.6 (mid) for tool-using ops, Haiku 4.5 (fast) for classification
19
- * - google: Gemini 3 Flash (mid) for tool-using ops, Gemini 2.5 Flash Lite (fast) for classification
20
- * - openai: GPT-5.4-mini (mid) for tool-using ops, GPT-5.4-nano (fast) for classification
41
+ * @param provider - Provider name to resolve (e.g. "anthropic", "openrouter")
42
+ * @returns `{ fast?: string, mid?: string }` empty object for unknown providers
21
43
  */
22
- export declare const OPERATION_MODEL_DEFAULTS: Record<string, {
23
- mid: string;
24
- fast: string;
25
- }>;
44
+ export declare function resolveOperationDefaults(provider: string): {
45
+ fast?: string;
46
+ mid?: string;
47
+ };
26
48
  /**
27
49
  * Maps each operation type to its cost tier.
28
50
  *