comisai 1.0.36 → 1.0.37

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 (239) hide show
  1. package/node_modules/@comis/agent/dist/background/auto-background-middleware.js +9 -0
  2. package/node_modules/@comis/agent/dist/background/background-task-manager.d.ts +22 -2
  3. package/node_modules/@comis/agent/dist/background/background-task-manager.js +48 -41
  4. package/node_modules/@comis/agent/dist/background/background-task-persistence.js +28 -5
  5. package/node_modules/@comis/agent/dist/background/background-task-types.d.ts +49 -0
  6. package/node_modules/@comis/agent/dist/background/completion-dispatcher.d.ts +130 -0
  7. package/node_modules/@comis/agent/dist/background/completion-dispatcher.js +215 -0
  8. package/node_modules/@comis/agent/dist/background/completion-runner.d.ts +10 -1
  9. package/node_modules/@comis/agent/dist/background/completion-runner.js +98 -15
  10. package/node_modules/@comis/agent/dist/background/index.d.ts +6 -1
  11. package/node_modules/@comis/agent/dist/background/index.js +2 -0
  12. package/node_modules/@comis/agent/dist/background/session-resolver.d.ts +85 -0
  13. package/node_modules/@comis/agent/dist/background/session-resolver.js +78 -0
  14. package/node_modules/@comis/agent/dist/bootstrap/sections/messaging-sections.js +1 -0
  15. package/node_modules/@comis/agent/dist/bootstrap/sections/tool-descriptions.js +3 -3
  16. package/node_modules/@comis/agent/dist/bootstrap/sections/tooling-sections.d.ts +30 -2
  17. package/node_modules/@comis/agent/dist/bootstrap/sections/tooling-sections.js +51 -2
  18. package/node_modules/@comis/agent/dist/bootstrap/system-prompt-assembler.d.ts +22 -0
  19. package/node_modules/@comis/agent/dist/bootstrap/system-prompt-assembler.js +2 -2
  20. package/node_modules/@comis/agent/dist/bridge/bridge-event-handlers.d.ts +1 -5
  21. package/node_modules/@comis/agent/dist/bridge/bridge-event-handlers.js +2 -14
  22. package/node_modules/@comis/agent/dist/bridge/bridge-metrics.d.ts +26 -0
  23. package/node_modules/@comis/agent/dist/bridge/bridge-metrics.js +3 -0
  24. package/node_modules/@comis/agent/dist/bridge/pi-event-bridge.d.ts +9 -0
  25. package/node_modules/@comis/agent/dist/bridge/pi-event-bridge.js +73 -2
  26. package/node_modules/@comis/agent/dist/context-engine/signature-surrogate-guard.d.ts +10 -10
  27. package/node_modules/@comis/agent/dist/context-engine/signature-surrogate-guard.js +14 -14
  28. package/node_modules/@comis/agent/dist/context-engine/thinking-block-cleaner.d.ts +11 -13
  29. package/node_modules/@comis/agent/dist/context-engine/thinking-block-cleaner.js +14 -15
  30. package/node_modules/@comis/agent/dist/executor/capability-index-context.d.ts +72 -0
  31. package/node_modules/@comis/agent/dist/executor/capability-index-context.js +329 -0
  32. package/node_modules/@comis/agent/dist/executor/drain-helper.d.ts +122 -0
  33. package/node_modules/@comis/agent/dist/executor/drain-helper.js +173 -0
  34. package/node_modules/@comis/agent/dist/executor/error-classifier.js +2 -2
  35. package/node_modules/@comis/agent/dist/executor/executor-post-execution.d.ts +48 -4
  36. package/node_modules/@comis/agent/dist/executor/executor-post-execution.js +134 -31
  37. package/node_modules/@comis/agent/dist/executor/executor-prompt-runner.d.ts +7 -0
  38. package/node_modules/@comis/agent/dist/executor/executor-prompt-runner.js +25 -4
  39. package/node_modules/@comis/agent/dist/executor/executor-tool-assembly.d.ts +18 -1
  40. package/node_modules/@comis/agent/dist/executor/executor-tool-assembly.js +19 -16
  41. package/node_modules/@comis/agent/dist/executor/jit-guide-injector.d.ts +11 -2
  42. package/node_modules/@comis/agent/dist/executor/jit-guide-injector.js +16 -2
  43. package/node_modules/@comis/agent/dist/executor/pi-executor.d.ts +8 -2
  44. package/node_modules/@comis/agent/dist/executor/pi-executor.js +25 -12
  45. package/node_modules/@comis/agent/dist/executor/prompt-assembly.d.ts +9 -1
  46. package/node_modules/@comis/agent/dist/executor/prompt-assembly.js +15 -1
  47. package/node_modules/@comis/agent/dist/executor/tool-deferral.d.ts +18 -27
  48. package/node_modules/@comis/agent/dist/executor/tool-deferral.js +29 -38
  49. package/node_modules/@comis/agent/dist/model/model-registry-adapter.js +1 -1
  50. package/node_modules/@comis/agent/dist/model/model-scanner.js +1 -1
  51. package/node_modules/@comis/agent/dist/safety/tool-retry-breaker.d.ts +11 -1
  52. package/node_modules/@comis/agent/dist/safety/tool-retry-breaker.js +19 -22
  53. package/node_modules/@comis/agent/dist/session/comis-session-manager.d.ts +16 -2
  54. package/node_modules/@comis/agent/dist/spawn/pi-mono-adapters.d.ts +1 -1
  55. package/node_modules/@comis/agent/dist/spawn/pi-mono-adapters.js +5 -5
  56. package/node_modules/@comis/agent/dist/workspace/data-env.d.ts +38 -0
  57. package/node_modules/@comis/agent/dist/workspace/data-env.js +56 -0
  58. package/node_modules/@comis/agent/dist/workspace/index.d.ts +1 -0
  59. package/node_modules/@comis/agent/dist/workspace/index.js +1 -0
  60. package/node_modules/@comis/agent/dist/workspace/templates.js +5 -1
  61. package/node_modules/@comis/agent/package.json +1 -1
  62. package/node_modules/@comis/channels/dist/index.d.ts +1 -1
  63. package/node_modules/@comis/channels/dist/index.js +1 -1
  64. package/node_modules/@comis/channels/dist/shared/channel-manager.d.ts +9 -3
  65. package/node_modules/@comis/channels/dist/shared/inbound-gate.d.ts +1 -1
  66. package/node_modules/@comis/channels/dist/shared/inbound-gate.js +22 -7
  67. package/node_modules/@comis/channels/dist/shared/inbound-pipeline.d.ts +10 -3
  68. package/node_modules/@comis/channels/dist/shared/inbound-route.d.ts +1 -1
  69. package/node_modules/@comis/channels/dist/shared/inbound-route.js +13 -2
  70. package/node_modules/@comis/channels/dist/shared/response-filter.d.ts +11 -24
  71. package/node_modules/@comis/channels/dist/shared/response-filter.js +25 -53
  72. package/node_modules/@comis/channels/package.json +1 -1
  73. package/node_modules/@comis/cli/dist/commands/providers.d.ts +1 -2
  74. package/node_modules/@comis/cli/dist/commands/providers.js +5 -6
  75. package/node_modules/@comis/cli/package.json +1 -1
  76. package/node_modules/@comis/core/dist/config/field-metadata.js +2 -0
  77. package/node_modules/@comis/core/dist/config/immutable-keys.js +4 -1
  78. package/node_modules/@comis/core/dist/config/index.d.ts +4 -0
  79. package/node_modules/@comis/core/dist/config/index.js +2 -0
  80. package/node_modules/@comis/core/dist/config/schema-agent.d.ts +0 -792
  81. package/node_modules/@comis/core/dist/config/schema-approvals.d.ts +0 -14
  82. package/node_modules/@comis/core/dist/config/schema-auto-reply-engine.d.ts +0 -6
  83. package/node_modules/@comis/core/dist/config/schema-background-tasks.d.ts +0 -12
  84. package/node_modules/@comis/core/dist/config/schema-browser.d.ts +0 -18
  85. package/node_modules/@comis/core/dist/config/schema-channel.d.ts +0 -158
  86. package/node_modules/@comis/core/dist/config/schema-coalescer.d.ts +0 -5
  87. package/node_modules/@comis/core/dist/config/schema-daemon.d.ts +0 -32
  88. package/node_modules/@comis/core/dist/config/schema-delivery.d.ts +0 -18
  89. package/node_modules/@comis/core/dist/config/schema-documentation.d.ts +0 -12
  90. package/node_modules/@comis/core/dist/config/schema-embedding.d.ts +0 -20
  91. package/node_modules/@comis/core/dist/config/schema-envelope.d.ts +0 -15
  92. package/node_modules/@comis/core/dist/config/schema-gateway.d.ts +0 -37
  93. package/node_modules/@comis/core/dist/config/schema-gemini-cache.d.ts +0 -2
  94. package/node_modules/@comis/core/dist/config/schema-integrations.d.ts +0 -318
  95. package/node_modules/@comis/core/dist/config/schema-lifecycle-reactions.d.ts +0 -18
  96. package/node_modules/@comis/core/dist/config/schema-memory-review.d.ts +0 -7
  97. package/node_modules/@comis/core/dist/config/schema-memory.d.ts +0 -16
  98. package/node_modules/@comis/core/dist/config/schema-messages.d.ts +0 -8
  99. package/node_modules/@comis/core/dist/config/schema-models.d.ts +0 -15
  100. package/node_modules/@comis/core/dist/config/schema-notification.d.ts +0 -5
  101. package/node_modules/@comis/core/dist/config/schema-oauth.d.ts +0 -5
  102. package/node_modules/@comis/core/dist/config/schema-observability.d.ts +0 -38
  103. package/node_modules/@comis/core/dist/config/schema-output-retention.d.ts +34 -0
  104. package/node_modules/@comis/core/dist/config/schema-output-retention.js +48 -0
  105. package/node_modules/@comis/core/dist/config/schema-plugins.d.ts +0 -8
  106. package/node_modules/@comis/core/dist/config/schema-providers.d.ts +0 -64
  107. package/node_modules/@comis/core/dist/config/schema-queue.d.ts +0 -58
  108. package/node_modules/@comis/core/dist/config/schema-response-prefix.d.ts +0 -2
  109. package/node_modules/@comis/core/dist/config/schema-retry.d.ts +0 -6
  110. package/node_modules/@comis/core/dist/config/schema-scheduler.d.ts +0 -39
  111. package/node_modules/@comis/core/dist/config/schema-secrets.d.ts +0 -3
  112. package/node_modules/@comis/core/dist/config/schema-security.d.ts +0 -18
  113. package/node_modules/@comis/core/dist/config/schema-send-policy.d.ts +0 -13
  114. package/node_modules/@comis/core/dist/config/schema-sender-trust-display.d.ts +0 -5
  115. package/node_modules/@comis/core/dist/config/schema-serializer.js +2 -0
  116. package/node_modules/@comis/core/dist/config/schema-skills.d.ts +0 -61
  117. package/node_modules/@comis/core/dist/config/schema-streaming.d.ts +0 -38
  118. package/node_modules/@comis/core/dist/config/schema-telegram-file-guard.d.ts +0 -3
  119. package/node_modules/@comis/core/dist/config/schema-tooling.d.ts +87 -0
  120. package/node_modules/@comis/core/dist/config/schema-tooling.js +152 -0
  121. package/node_modules/@comis/core/dist/config/schema-verbosity.d.ts +0 -12
  122. package/node_modules/@comis/core/dist/config/schema-webhooks.d.ts +0 -40
  123. package/node_modules/@comis/core/dist/config/schema.d.ts +41 -38
  124. package/node_modules/@comis/core/dist/config/schema.js +6 -0
  125. package/node_modules/@comis/core/dist/context/context.d.ts +0 -4
  126. package/node_modules/@comis/core/dist/domain/approval-request.d.ts +0 -17
  127. package/node_modules/@comis/core/dist/domain/background-task-origin.d.ts +0 -10
  128. package/node_modules/@comis/core/dist/domain/delivery-origin.d.ts +0 -5
  129. package/node_modules/@comis/core/dist/domain/execution-graph.d.ts +0 -48
  130. package/node_modules/@comis/core/dist/domain/memory-entry.d.ts +0 -3
  131. package/node_modules/@comis/core/dist/domain/model-compat.d.ts +0 -4
  132. package/node_modules/@comis/core/dist/domain/normalized-message.d.ts +0 -15
  133. package/node_modules/@comis/core/dist/domain/provider-capabilities.d.ts +0 -6
  134. package/node_modules/@comis/core/dist/domain/rich-message.d.ts +0 -14
  135. package/node_modules/@comis/core/dist/domain/subagent-context-config.d.ts +0 -22
  136. package/node_modules/@comis/core/dist/domain/subagent-context-types.d.ts +0 -8
  137. package/node_modules/@comis/core/dist/event-bus/events-agent.d.ts +31 -0
  138. package/node_modules/@comis/core/dist/event-bus/events-infra.d.ts +5 -0
  139. package/node_modules/@comis/core/dist/exports/config.d.ts +2 -2
  140. package/node_modules/@comis/core/dist/exports/config.js +3 -1
  141. package/node_modules/@comis/core/dist/exports/hooks.d.ts +1 -1
  142. package/node_modules/@comis/core/dist/exports/ports.d.ts +2 -2
  143. package/node_modules/@comis/core/dist/exports/ports.js +1 -1
  144. package/node_modules/@comis/core/dist/ports/channel-plugin.d.ts +0 -13
  145. package/node_modules/@comis/core/dist/ports/index.d.ts +2 -0
  146. package/node_modules/@comis/core/dist/ports/index.js +4 -0
  147. package/node_modules/@comis/core/dist/ports/no-op-tool-capability.d.ts +30 -0
  148. package/node_modules/@comis/core/dist/ports/no-op-tool-capability.js +47 -0
  149. package/node_modules/@comis/core/dist/ports/tool-capability.d.ts +165 -0
  150. package/node_modules/@comis/core/dist/ports/tool-capability.js +15 -0
  151. package/node_modules/@comis/core/dist/security/audit.d.ts +0 -11
  152. package/node_modules/@comis/core/dist/tool-metadata.d.ts +21 -1
  153. package/node_modules/@comis/core/dist/tool-metadata.js +1 -1
  154. package/node_modules/@comis/core/package.json +1 -1
  155. package/node_modules/@comis/daemon/bundled-skills/skill-creator/scripts/validate-skill.py +1 -1
  156. package/node_modules/@comis/daemon/dist/daemon.js +89 -14
  157. package/node_modules/@comis/daemon/dist/rpc/agent-inline-workspace.d.ts +1 -1
  158. package/node_modules/@comis/daemon/dist/rpc/agent-inline-workspace.js +1 -1
  159. package/node_modules/@comis/daemon/dist/rpc/builtin-provider-guard.js +2 -2
  160. package/node_modules/@comis/daemon/dist/rpc/credential-resolver.js +1 -1
  161. package/node_modules/@comis/daemon/dist/rpc/model-handlers.d.ts +1 -1
  162. package/node_modules/@comis/daemon/dist/rpc/model-handlers.js +2 -2
  163. package/node_modules/@comis/daemon/dist/sub-agent-runner.d.ts +18 -0
  164. package/node_modules/@comis/daemon/dist/sub-agent-runner.js +41 -9
  165. package/node_modules/@comis/daemon/dist/wiring/index.d.ts +2 -0
  166. package/node_modules/@comis/daemon/dist/wiring/index.js +1 -0
  167. package/node_modules/@comis/daemon/dist/wiring/setup-agents.d.ts +36 -2
  168. package/node_modules/@comis/daemon/dist/wiring/setup-agents.js +45 -8
  169. package/node_modules/@comis/daemon/dist/wiring/setup-background-completion-runner.d.ts +28 -9
  170. package/node_modules/@comis/daemon/dist/wiring/setup-background-completion-runner.js +36 -9
  171. package/node_modules/@comis/daemon/dist/wiring/setup-background-tasks.js +2 -2
  172. package/node_modules/@comis/daemon/dist/wiring/setup-channels.d.ts +9 -2
  173. package/node_modules/@comis/daemon/dist/wiring/setup-channels.js +15 -9
  174. package/node_modules/@comis/daemon/dist/wiring/setup-cross-session.d.ts +20 -5
  175. package/node_modules/@comis/daemon/dist/wiring/setup-cross-session.js +20 -15
  176. package/node_modules/@comis/daemon/dist/wiring/setup-delivery.js +14 -2
  177. package/node_modules/@comis/daemon/dist/wiring/setup-gateway.d.ts +4 -6
  178. package/node_modules/@comis/daemon/dist/wiring/setup-gateway.js +3 -5
  179. package/node_modules/@comis/daemon/dist/wiring/setup-heartbeat.d.ts +20 -5
  180. package/node_modules/@comis/daemon/dist/wiring/setup-heartbeat.js +11 -2
  181. package/node_modules/@comis/daemon/dist/wiring/setup-output-retention.d.ts +89 -0
  182. package/node_modules/@comis/daemon/dist/wiring/setup-output-retention.js +212 -0
  183. package/node_modules/@comis/daemon/dist/wiring/setup-tools.d.ts +18 -4
  184. package/node_modules/@comis/daemon/dist/wiring/setup-tools.js +29 -10
  185. package/node_modules/@comis/daemon/dist/wiring/tool-capability-adapter.d.ts +75 -0
  186. package/node_modules/@comis/daemon/dist/wiring/tool-capability-adapter.js +253 -0
  187. package/node_modules/@comis/daemon/package.json +1 -1
  188. package/node_modules/@comis/gateway/dist/webhook/webhook-endpoint.d.ts +0 -4
  189. package/node_modules/@comis/gateway/package.json +1 -1
  190. package/node_modules/@comis/infra/package.json +1 -1
  191. package/node_modules/@comis/memory/package.json +1 -1
  192. package/node_modules/@comis/scheduler/dist/cron/cron-types.d.ts +0 -42
  193. package/node_modules/@comis/scheduler/dist/heartbeat/agent-heartbeat-source.d.ts +29 -8
  194. package/node_modules/@comis/scheduler/dist/heartbeat/agent-heartbeat-source.js +19 -7
  195. package/node_modules/@comis/scheduler/dist/system-events/system-event-types.d.ts +0 -3
  196. package/node_modules/@comis/scheduler/dist/tasks/task-types.d.ts +0 -17
  197. package/node_modules/@comis/scheduler/package.json +1 -1
  198. package/node_modules/@comis/shared/dist/index.d.ts +3 -0
  199. package/node_modules/@comis/shared/dist/index.js +4 -0
  200. package/node_modules/@comis/shared/dist/mcp-tool-name.d.ts +78 -0
  201. package/node_modules/@comis/shared/dist/mcp-tool-name.js +92 -0
  202. package/node_modules/@comis/shared/dist/silent-tokens.d.ts +38 -0
  203. package/node_modules/@comis/shared/dist/silent-tokens.js +51 -0
  204. package/node_modules/@comis/shared/dist/visible-delivery.d.ts +28 -0
  205. package/node_modules/@comis/shared/dist/visible-delivery.js +16 -0
  206. package/node_modules/@comis/shared/package.json +1 -1
  207. package/node_modules/@comis/skills/dist/bridge/mcp-tool-bridge.d.ts +2 -13
  208. package/node_modules/@comis/skills/dist/bridge/mcp-tool-bridge.js +3 -21
  209. package/node_modules/@comis/skills/dist/bridge/tool-metadata-enforcement.js +1 -1
  210. package/node_modules/@comis/skills/dist/bridge/tool-metadata-registry.js +4 -4
  211. package/node_modules/@comis/skills/dist/builtin/exec-tool.d.ts +55 -9
  212. package/node_modules/@comis/skills/dist/builtin/exec-tool.js +383 -19
  213. package/node_modules/@comis/skills/dist/builtin/install-detour.d.ts +67 -0
  214. package/node_modules/@comis/skills/dist/builtin/install-detour.js +342 -0
  215. package/node_modules/@comis/skills/dist/builtin/platform/admin-manage-factory.js +5 -5
  216. package/node_modules/@comis/skills/dist/builtin/platform/agents-manage-tool.d.ts +2 -2
  217. package/node_modules/@comis/skills/dist/builtin/platform/agents-manage-tool.js +2 -2
  218. package/node_modules/@comis/skills/dist/builtin/platform/message-tool.js +18 -0
  219. package/node_modules/@comis/skills/dist/builtin/platform/messaging-factory.d.ts +18 -1
  220. package/node_modules/@comis/skills/dist/builtin/platform/messaging-factory.js +18 -2
  221. package/node_modules/@comis/skills/dist/builtin/platform/models-manage-tool.js +3 -3
  222. package/node_modules/@comis/skills/dist/builtin/process-registry.d.ts +14 -0
  223. package/node_modules/@comis/skills/dist/builtin/process-tool.d.ts +24 -4
  224. package/node_modules/@comis/skills/dist/builtin/process-tool.js +25 -7
  225. package/node_modules/@comis/skills/dist/builtin/sandbox/bwrap-provider.d.ts +1 -1
  226. package/node_modules/@comis/skills/dist/builtin/sandbox/bwrap-provider.js +9 -0
  227. package/node_modules/@comis/skills/dist/index.d.ts +4 -1
  228. package/node_modules/@comis/skills/dist/index.js +3 -1
  229. package/node_modules/@comis/skills/dist/manifest/capability-parser.d.ts +44 -0
  230. package/node_modules/@comis/skills/dist/manifest/capability-parser.js +68 -0
  231. package/node_modules/@comis/skills/dist/manifest/schema.d.ts +44 -37
  232. package/node_modules/@comis/skills/dist/manifest/schema.js +35 -0
  233. package/node_modules/@comis/skills/dist/registry/discovery.d.ts +8 -0
  234. package/node_modules/@comis/skills/dist/registry/discovery.js +10 -3
  235. package/node_modules/@comis/skills/dist/registry/skill-registry.d.ts +45 -1
  236. package/node_modules/@comis/skills/dist/registry/skill-registry.js +70 -7
  237. package/node_modules/@comis/skills/package.json +1 -1
  238. package/node_modules/@comis/web/package.json +1 -1
  239. package/package.json +21 -21
@@ -0,0 +1,165 @@
1
+ /**
2
+ * ToolCapabilityPort -- hexagonal architecture boundary for the v1.1 capability layer.
3
+ *
4
+ * Provides both a static config-derived view (clusters, hints, aliases) AND a
5
+ * live runtime view (connected MCP servers, visible prompt skills). One port,
6
+ * two views -- exec runs per-tool-call (not per-turn) and needs a live getter.
7
+ *
8
+ * Adapters: live daemon-side adapter, createNoOpCapabilityPort (production
9
+ * no-op, this package), test-only stub factory (lives in `__test-helpers/` --
10
+ * production source MUST NOT import).
11
+ *
12
+ * @module
13
+ */
14
+ /**
15
+ * Capability source reference -- discriminated union pointing at either a
16
+ * connected MCP server or a visible prompt skill. Used in the package-alias
17
+ * map to resolve "import yfinance" or "pip install pandas" back to a connected
18
+ * tool/skill that should be preferred over the install.
19
+ */
20
+ export type CapabilitySourceRef = {
21
+ readonly type: "mcp";
22
+ readonly name: string;
23
+ } | {
24
+ readonly type: "skill";
25
+ readonly name: string;
26
+ };
27
+ /**
28
+ * Merged capability view of a single visible prompt skill.
29
+ *
30
+ * All operator overrides, manifest `comis.capability` values, and skill-key
31
+ * fallbacks are pre-merged in the adapter (precedence:
32
+ * operator(skillKey) > operator(skillName) > comis.capability > fallback).
33
+ * Consumers see the final merged shape.
34
+ */
35
+ export interface PromptSkillCapability {
36
+ /** Stable skill identifier used by the agent runtime. */
37
+ readonly name: string;
38
+ /** Optional canonical key (`<author>::<slug>`) for cross-host portability. */
39
+ readonly skillKey?: string;
40
+ /** Human-readable description (falls back to manifest description if no override). */
41
+ readonly description: string;
42
+ /** Cluster ID for capability-index grouping (e.g. "data-fetching-financial"). */
43
+ readonly cluster?: string;
44
+ /** Operator-tunable display summary; falls back to description when absent. */
45
+ readonly summary?: string;
46
+ /** Package names this skill replaces (for install-detour overlap detection). */
47
+ readonly replacesPackages: readonly string[];
48
+ /** Where the skill was discovered from. */
49
+ readonly source?: "bundled" | "workspace" | "local";
50
+ }
51
+ /**
52
+ * Cluster metadata used by the capability-index renderer.
53
+ */
54
+ export interface ClusterConfig {
55
+ readonly label: string;
56
+ readonly priority: number;
57
+ readonly preferOverInstalls: boolean;
58
+ }
59
+ /**
60
+ * Hint metadata for a connected MCP server.
61
+ */
62
+ export interface McpServerHint {
63
+ readonly cluster: string;
64
+ readonly description: string;
65
+ readonly replacesPackages: readonly string[];
66
+ }
67
+ /**
68
+ * Hint metadata for a visible prompt skill (operator-supplied overrides).
69
+ */
70
+ export interface SkillHint {
71
+ readonly cluster: string;
72
+ readonly description?: string;
73
+ readonly replacesPackages: readonly string[];
74
+ }
75
+ /**
76
+ * The capability port. Covers both the static config-derived view and a live
77
+ * runtime view. Adapter implementation lives in @comis/daemon; the in-package
78
+ * createNoOpCapabilityPort serves as the production no-op.
79
+ *
80
+ * Adapters: createNoOpCapabilityPort (production no-op, this package),
81
+ * test-only stub factory in `__test-helpers/`, live daemon-side adapter.
82
+ */
83
+ export interface ToolCapabilityPort {
84
+ /**
85
+ * Whether the per-turn capability index renderer should fire at all. When
86
+ * false, the renderer returns empty text and the executor-prompt-runner
87
+ * filters it out.
88
+ *
89
+ * @returns `true` if the operator has enabled the capability index.
90
+ */
91
+ isCapabilityIndexEnabled(): boolean;
92
+ /**
93
+ * Install-detour mode for pip/npm/pnpm/yarn detection.
94
+ * - `observe`: log only, no agent-visible response.
95
+ * - `advise`: emit a non-blocking advisory next turn.
96
+ * - `soft-stop`: refuse the exec call with an operator-overridable message.
97
+ *
98
+ * @returns The currently-configured mode.
99
+ */
100
+ getInstallDetourMode(): "observe" | "advise" | "soft-stop";
101
+ /**
102
+ * Cluster ID for a builtin tool (exec, read, write, ...).
103
+ *
104
+ * @param toolName - The builtin tool's registered name.
105
+ * @returns The cluster ID, or undefined if the tool is uncategorized.
106
+ */
107
+ getBuiltinCluster(toolName: string): string | undefined;
108
+ /**
109
+ * Cluster metadata (label, priority, preferOverInstalls flag).
110
+ *
111
+ * @param clusterId - The cluster identifier.
112
+ * @returns The cluster config, or undefined if the cluster is unknown.
113
+ */
114
+ getClusterConfig(clusterId: string): ClusterConfig | undefined;
115
+ /**
116
+ * Hint metadata for a connected MCP server (operator-supplied overrides).
117
+ *
118
+ * @param serverName - The MCP server name (sanitized form).
119
+ * @returns The hint, or undefined if no operator override exists.
120
+ */
121
+ getMcpServerHint(serverName: string): McpServerHint | undefined;
122
+ /**
123
+ * Hint metadata for a visible prompt skill (operator-supplied overrides).
124
+ *
125
+ * @param skillName - The skill's runtime name.
126
+ * @param skillKey - Optional canonical key (`<author>::<slug>`).
127
+ * @returns The hint, or undefined if no operator override exists.
128
+ */
129
+ getSkillHint(skillName: string, skillKey?: string): SkillHint | undefined;
130
+ /**
131
+ * Pre-normalized package alias map (PEP-503-like keys for Python:
132
+ * lowercase, `_` and `.` collapsed to `-`).
133
+ *
134
+ * Build fresh on each call (no memoization in v1.1) -- visible skills can
135
+ * change mid-session (skill discovery, allow/deny edits), connected MCP
136
+ * servers can connect/disconnect, capturing at construction would freeze
137
+ * stale state.
138
+ *
139
+ * @returns A read-only map keyed by normalized package name pointing at
140
+ * the matching MCP server or prompt skill.
141
+ */
142
+ getPackageAliasMap(): ReadonlyMap<string, CapabilitySourceRef>;
143
+ /**
144
+ * Currently-connected MCP server names (sanitized form).
145
+ *
146
+ * @returns A read-only array of server names. Order is undefined.
147
+ */
148
+ getConnectedMcpServers(): readonly string[];
149
+ /**
150
+ * Visible eligible prompt skills with merged capability metadata.
151
+ * Filters: allowedSkills/deniedSkills, runtime eligibility (os/bins/env),
152
+ * AND `disableModelInvocation !== true`.
153
+ * Merging: operator(skillKey) > operator(skillName) > comis.capability > fallback.
154
+ *
155
+ * IMPORTANT -- cache fence:
156
+ * This method MUST NOT be consumed by `assembleRichSystemPrompt`'s
157
+ * `assemblerParams` in `packages/agent/src/executor/prompt-assembly.ts`.
158
+ * If a skill discovery sweep runs between turns, the cached system-prompt
159
+ * prefix MUST stay byte-identical. Consumers: per-turn capability index
160
+ * renderer + install-detour parser ONLY.
161
+ *
162
+ * @returns A read-only array of merged capability views.
163
+ */
164
+ getPromptSkillCapabilities(): readonly PromptSkillCapability[];
165
+ }
@@ -0,0 +1,15 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ /**
3
+ * ToolCapabilityPort -- hexagonal architecture boundary for the v1.1 capability layer.
4
+ *
5
+ * Provides both a static config-derived view (clusters, hints, aliases) AND a
6
+ * live runtime view (connected MCP servers, visible prompt skills). One port,
7
+ * two views -- exec runs per-tool-call (not per-turn) and needs a live getter.
8
+ *
9
+ * Adapters: live daemon-side adapter, createNoOpCapabilityPort (production
10
+ * no-op, this package), test-only stub factory (lives in `__test-helpers/` --
11
+ * production source MUST NOT import).
12
+ *
13
+ * @module
14
+ */
15
+ export {};
@@ -7,35 +7,24 @@ import type { ActionClassification } from "./action-classifier.js";
7
7
  * classification, outcome, tracing, and timing information.
8
8
  */
9
9
  export declare const AuditEventSchema: z.ZodObject<{
10
- /** Unique event identifier (UUIDv4). */
11
10
  id: z.ZodGUID;
12
- /** ISO 8601 timestamp of when the event occurred. */
13
11
  timestamp: z.ZodISODateTime;
14
- /** Tenant identifier for multi-tenant isolation. */
15
12
  tenantId: z.ZodString;
16
- /** Agent that performed the action (may be system). */
17
13
  agentId: z.ZodString;
18
- /** User who triggered or owns the action (may be "system"). */
19
14
  userId: z.ZodString;
20
- /** The action that was performed (e.g., "file.delete"). */
21
15
  actionType: z.ZodString;
22
- /** Risk classification of the action. */
23
16
  classification: z.ZodEnum<{
24
17
  read: "read";
25
18
  mutate: "mutate";
26
19
  destructive: "destructive";
27
20
  }>;
28
- /** Whether the action succeeded or failed. */
29
21
  outcome: z.ZodEnum<{
30
22
  success: "success";
31
23
  failure: "failure";
32
24
  denied: "denied";
33
25
  }>;
34
- /** Arbitrary metadata about the event. */
35
26
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
36
- /** Distributed tracing identifier for correlating events. */
37
27
  traceId: z.ZodOptional<z.ZodString>;
38
- /** Duration of the action in milliseconds. */
39
28
  duration: z.ZodOptional<z.ZodNumber>;
40
29
  }, z.core.$strict>;
41
30
  /** TypeScript type inferred from the AuditEvent Zod schema. */
@@ -8,6 +8,24 @@
8
8
  * Registry supports incremental registration via spread-merge semantics:
9
9
  * different sources can register different fields for the same tool.
10
10
  */
11
+ /**
12
+ * Capability metadata for a builtin/platform tool -- used by the v1.1 capability
13
+ * layer to route tools into clusters and detect install-detour overlap.
14
+ *
15
+ * All fields optional. Operators may override `cluster` per-tool via
16
+ * `tooling.capabilityClusters.builtinAssignments[toolName]`. The metadata
17
+ * default applies when no operator override is present.
18
+ *
19
+ * `getBuiltinCluster` precedence: operator override > metadata default > undefined.
20
+ */
21
+ export interface ToolCapabilityMetadata {
22
+ /** Cluster ID this tool belongs to (e.g., "data-fetching-financial"). */
23
+ readonly cluster?: string;
24
+ /** Operator-tunable display summary; falls back to tool description if absent. */
25
+ readonly summary?: string;
26
+ /** Package names this tool replaces (for install-detour overlap detection). */
27
+ readonly replacesPackages?: readonly string[];
28
+ }
11
29
  /** Per-tool metadata stored in the side-channel registry. All fields optional. */
12
30
  export interface ComisToolMetadata {
13
31
  /** Per-tool result size cap in characters. */
@@ -44,10 +62,12 @@ export interface ComisToolMetadata {
44
62
  requiredByAction?: Readonly<Record<string, readonly string[]>>;
45
63
  /** Pre-flight input validator. Returns error string on failure, undefined on success. */
46
64
  validateInput?: (params: Record<string, unknown>) => string | undefined | Promise<string | undefined>;
65
+ /** Capability metadata for tool-first routing (v1.1). */
66
+ capability?: ToolCapabilityMetadata;
47
67
  }
48
68
  /**
49
69
  * Register metadata for a tool. Merges with any existing metadata via spread,
50
- * allowing incremental registration from different phases.
70
+ * allowing incremental registration from different sources.
51
71
  */
52
72
  export declare function registerToolMetadata(name: string, meta: ComisToolMetadata): void;
53
73
  /**
@@ -15,7 +15,7 @@
15
15
  const registry = new Map();
16
16
  /**
17
17
  * Register metadata for a tool. Merges with any existing metadata via spread,
18
- * allowing incremental registration from different phases.
18
+ * allowing incremental registration from different sources.
19
19
  */
20
20
  export function registerToolMetadata(name, meta) {
21
21
  registry.set(name, { ...registry.get(name), ...meta });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@comis/core",
3
3
  "private": true,
4
- "version": "1.0.36",
4
+ "version": "1.0.37",
5
5
  "author": "Moshe Anconina",
6
6
  "license": "Apache-2.0",
7
7
  "description": "Core domain types, ports, event bus, security, and config for Comis",
@@ -31,7 +31,7 @@ VALID_TOP_FIELDS = {
31
31
  }
32
32
 
33
33
  VALID_COMIS_FIELDS = {
34
- "os", "requires", "skill-key", "primary-env", "command-dispatch",
34
+ "os", "requires", "skill-key", "primary-env", "command-dispatch", "capability",
35
35
  }
36
36
 
37
37
  VALID_PERMISSIONS_FIELDS = {"fsRead", "fsWrite", "net", "env"}
@@ -7,9 +7,9 @@ import { bootstrap, loadEnvFile, createApprovalGate, parseFormattedSessionKey, c
7
7
  import { setupSecrets as _setupSecretsImpl, createSqliteSecretStore, createNamedGraphStore, createContextStore, createObservabilityStore } from "@comis/memory";
8
8
  import { ok, err, suppressError } from "@comis/shared";
9
9
  import { createGatewayServer } from "@comis/gateway";
10
- import { setupLogging, setupObservability, setupHealth, setupMemory, setupAgents, setupSchedulers, setupChannels, setupMedia, setupCrossSession, setupMcp, setupTools, setupMonitoring, setupHeartbeat, setupTaskExtraction, setupShutdown, setupGateway, setupRpcBridge, setupDeliveryQueue, setupDeliveryMirror, setupNotifications, setupBackgroundTasks, setupBackgroundCompletionRunner, } from "./wiring/index.js";
10
+ import { setupLogging, setupObservability, setupHealth, setupMemory, setupAgents, setupSchedulers, setupChannels, setupMedia, setupCrossSession, setupMcp, setupTools, setupMonitoring, setupHeartbeat, setupTaskExtraction, setupShutdown, setupGateway, setupRpcBridge, setupDeliveryQueue, setupDeliveryMirror, setupNotifications, setupBackgroundTasks, setupBackgroundCompletionRunner, setupOutputRetention, } from "./wiring/index.js";
11
11
  import { setupSingleAgent } from "./wiring/setup-agents.js";
12
- import { createActiveRunRegistry, createModelCatalog, wireSessionStateCleanup, wireMcpDisconnectCleanup, createGeminiCacheManager, wireGeminiCacheCleanup, createSessionTrackerRegistry, validateProviderOverrides } from "@comis/agent";
12
+ import { createActiveRunRegistry, createBackgroundSessionResolver, createModelCatalog, wireSessionStateCleanup, wireMcpDisconnectCleanup, createGeminiCacheManager, wireGeminiCacheCleanup, createSessionTrackerRegistry, validateProviderOverrides, resolveWorkspaceDir } from "@comis/agent";
13
13
  import { detectSandboxProvider, createImageGenProvider, createImageGenRateLimiter, createFileStateTracker } from "@comis/skills";
14
14
  import { createGraphCoordinator, createNodeTypeRegistry } from "./graph/index.js";
15
15
  import { createChannelHealthMonitor } from "@comis/channels";
@@ -387,6 +387,11 @@ export async function main(overrides = {}) {
387
387
  // Created once and injected into both setupAgents (PiExecutor registration)
388
388
  // and setupChannels (inbound pipeline routing).
389
389
  const activeRunRegistry = createActiveRunRegistry();
390
+ // Composite-key resolver wraps the registry for production lookups.
391
+ // The raw registry is still threaded for register/deregister calls in
392
+ // pi-executor and executor-post-execution; the resolver supersedes
393
+ // single-arg `.has()`/`.get()` everywhere.
394
+ const sessionResolver = createBackgroundSessionResolver({ activeRunRegistry });
390
395
  // Derive canary fallback secret from tenantId.
391
396
  // Used when CANARY_SECRET env var is not configured. The per-agent derivation
392
397
  // in setup-agents.ts uses this as a base combined with agentId for uniqueness.
@@ -471,10 +476,39 @@ export async function main(overrides = {}) {
471
476
  }
472
477
  // 6.6. Agents
473
478
  const agents = container.config.agents;
474
- const { sessionManager, executors, workspaceDirs, costTrackers, budgetGuards, stepCounters, defaultAgentId, defaultWorkspaceDir, getExecutor, piSessionAdapters, skillWatcherHandles, skillRegistries, lockCleanupTimer, singleAgentDeps, providerHealth,
479
+ // defaultWorkspaceDir hoisted upfront so setupMcp can run BEFORE
480
+ // setupAgents (it consumes defaultWorkspaceDir as defaultCwd; per-agent
481
+ // ToolCapabilityPort adapters constructed inside setupSingleAgent close
482
+ // over the daemon-global mcpClientManager). Mirrors the per-agent
483
+ // computation in setup-agents.ts (`resolveWorkspaceDir(effectiveConfig,
484
+ // agentId)` for the agent's own workspace).
485
+ const defaultAgentId = container.config.routing.defaultAgentId;
486
+ const defaultAgentConfig = agents[defaultAgentId] ??
487
+ agents.default ??
488
+ {};
489
+ const defaultWorkspaceDir = resolveWorkspaceDir(defaultAgentConfig, defaultAgentId);
490
+ // setupMcp runs before setupAgents so per-agent ToolCapabilityPort
491
+ // adapter construction inside setupSingleAgent can close over
492
+ // mcpClientManager. createMcpClientManager is a pure in-memory state
493
+ // holder (no I/O) -- the manager is constructed before any server-connect
494
+ // attempts, so the ordering is safe.
495
+ const { mcpClientManager } = await setupMcp({
496
+ servers: container.config.integrations.mcp.servers,
497
+ logger: skillsLogger,
498
+ callToolTimeoutMs: container.config.integrations.mcp.callToolTimeoutMs,
499
+ defaultCwd: defaultWorkspaceDir,
500
+ eventBus: container.eventBus,
501
+ stdioDefaultConcurrency: container.config.integrations.mcp.stdioDefaultConcurrency,
502
+ httpDefaultConcurrency: container.config.integrations.mcp.httpDefaultConcurrency,
503
+ });
504
+ const { sessionManager, executors, workspaceDirs, costTrackers, budgetGuards, stepCounters, getExecutor, piSessionAdapters, skillWatcherHandles, skillRegistries, lockCleanupTimer, singleAgentDeps, providerHealth,
475
505
  // Daemon-level OAuth credential store, threaded into RpcDispatchDeps
476
506
  // below so agents.update can validate oauthProfiles patches via has().
477
- oauthCredentialStore, } = await setupAgents({
507
+ oauthCredentialStore,
508
+ // Per-agent live ToolCapabilityPort adapters; daemon.ts threads
509
+ // getCapabilityPortForAgent into setupTools and mutates this map on
510
+ // hot-add / hot-remove.
511
+ toolCapabilityPorts, } = await setupAgents({
478
512
  container, memoryAdapter, sessionStore, agentLogger, outboundMediaEnabled: true,
479
513
  autonomousMediaEnabled: !container.config.integrations.media.transcription.autoTranscribe
480
514
  || !container.config.integrations.media.vision.enabled
@@ -505,6 +539,9 @@ export async function main(overrides = {}) {
505
539
  // better-sqlite3 connection (no dual-handle).
506
540
  secretsCrypto,
507
541
  secretsDb,
542
+ // Daemon-global MCP manager threaded into setupSingleAgent for
543
+ // per-agent ToolCapabilityPort adapter construction.
544
+ mcpClientManager,
508
545
  });
509
546
  // Log operation model resolutions at startup (dry-run validation)
510
547
  logOperationModelDryRun({
@@ -682,6 +719,8 @@ export async function main(overrides = {}) {
682
719
  queueConfig: container.config.queue,
683
720
  // steer+followup inbound routing
684
721
  activeRunRegistry,
722
+ // Composite-key resolver for active-session lookup
723
+ sessionResolver,
685
724
  // /config chat command handling via deferred RPC dispatch
686
725
  rpcCall,
687
726
  // Task extraction callback (gated by config.scheduler.tasks.enabled)
@@ -761,6 +800,24 @@ export async function main(overrides = {}) {
761
800
  container.eventBus.on("system:shutdown", () => { shutdownMirror(); });
762
801
  // Structured logging for delivery queue lifecycle events
763
802
  setupDeliveryQueueLogging({ eventBus: container.eventBus, logger: daemonLogger });
803
+ // Output retention housekeeper.
804
+ // Mirrors the delivery-queue/mirror prune pattern — single-tick gate +
805
+ // .unref() interval. Scans <defaultWorkspaceDir>/output/<className>/,
806
+ // deletes leaf files older than the class's retentionMs. Operators can
807
+ // disable via outputRetention.enabled: false. Per AGENTS §6.6
808
+ // (security/daemon): file deletion is destructive; the destructive
809
+ // path is gated on enabled + per-class retentionMs.
810
+ if (defaultWorkspaceDir) {
811
+ const outputRetentionHandle = setupOutputRetention({
812
+ config: container.config.outputRetention,
813
+ workspaceDir: defaultWorkspaceDir,
814
+ logger: daemonLogger,
815
+ });
816
+ container.eventBus.on("system:shutdown", () => { outputRetentionHandle.shutdown(); });
817
+ }
818
+ else {
819
+ daemonLogger.debug({ hint: "No defaultWorkspaceDir; output retention housekeeper skipped" }, "Output retention: skipped (no default workspace)");
820
+ }
764
821
  // 6.6.8.0.1. Notification system
765
822
  // setupNotifications creates the NotificationService and SessionTracker.
766
823
  // The factory is already complete -- this call wires it into the daemon.
@@ -839,15 +896,11 @@ export async function main(overrides = {}) {
839
896
  // Structured logging for channel health state transitions
840
897
  setupChannelHealthLogging({ eventBus: container.eventBus, logger: daemonLogger });
841
898
  // 6.6.8.7. MCP server connections (external tool servers)
842
- const { mcpClientManager } = await setupMcp({
843
- servers: container.config.integrations.mcp.servers,
844
- logger: skillsLogger,
845
- callToolTimeoutMs: container.config.integrations.mcp.callToolTimeoutMs,
846
- defaultCwd: defaultWorkspaceDir,
847
- eventBus: container.eventBus,
848
- stdioDefaultConcurrency: container.config.integrations.mcp.stdioDefaultConcurrency,
849
- httpDefaultConcurrency: container.config.integrations.mcp.httpDefaultConcurrency,
850
- });
899
+ // setupMcp is called earlier (before setupAgents @ line ~600) so per-agent
900
+ // ToolCapabilityPort adapter construction inside setupSingleAgent can
901
+ // close over mcpClientManager. The mcpClientManager const declared at the
902
+ // earlier site is in lexical scope here; no additional wiring needed at
903
+ // this section anchor.
851
904
  // Detect sandbox provider once at startup
852
905
  const sandboxProvider = detectSandboxProvider(skillsLogger);
853
906
  if (sandboxProvider) {
@@ -869,6 +922,21 @@ export async function main(overrides = {}) {
869
922
  else {
870
923
  skillsLogger.warn({ err: imageGenResult.error, hint: "Check image generation config provider value", errorKind: "config" }, "Image generation provider creation failed");
871
924
  }
925
+ // Per-agent ToolCapabilityPort resolver. Falls back to the default
926
+ // agent's port for unknown agentIds (mirrors the setup-tools.ts:327
927
+ // `agents[agentId] ?? agents[defaultAgentId]` convention). Throws if
928
+ // neither exists -- this fires both for an initialization-order bug AND
929
+ // for runtime hot-remove paths (agent + default both removed; stale
930
+ // cron/graph/heartbeat caller carrying a since-removed agentId). The
931
+ // message stays scenario-agnostic so the operator can diagnose either
932
+ // cause.
933
+ const getCapabilityPortForAgent = (agentId) => {
934
+ const port = toolCapabilityPorts.get(agentId) ?? toolCapabilityPorts.get(defaultAgentId);
935
+ if (!port) {
936
+ throw new Error(`No ToolCapabilityPort registered for agent '${agentId}' and no default agent ('${defaultAgentId}') fallback available -- the agent may have been removed or the daemon failed to initialize.`);
937
+ }
938
+ return port;
939
+ };
872
940
  // 6.6.8.5. Tools + message preprocessing
873
941
  const { assembleToolsForAgent, preprocessMessageText } = setupTools({
874
942
  rpcCall, agents, defaultAgentId, workspaceDirs, defaultWorkspaceDir,
@@ -884,6 +952,7 @@ export async function main(overrides = {}) {
884
952
  imageGenProvider, // Conditional: only registered when API key is present
885
953
  backgroundTaskManager, // Background_tasks tool registration
886
954
  sessionTrackerRegistry,
955
+ getCapabilityPortForAgent,
887
956
  });
888
957
  // Wire deferred tool assembler ref now that setupTools has returned
889
958
  toolAssemblerRef.ref = assembleToolsForAgent;
@@ -896,6 +965,9 @@ export async function main(overrides = {}) {
896
965
  memoryAdapter,
897
966
  gatewaySend: gatewaySendRef,
898
967
  activeRunRegistry,
968
+ // Composite-key resolver supersedes activeRunRegistry.get(sessionKey)
969
+ // for sub-agent-runner abort paths.
970
+ sessionResolver,
899
971
  deliveryQueue,
900
972
  });
901
973
  // Rolling prompt timeout counter (sliding 5-minute window).
@@ -980,7 +1052,8 @@ export async function main(overrides = {}) {
980
1052
  executors,
981
1053
  assembleToolsForAgent,
982
1054
  workspaceDirs,
983
- activeRunRegistry,
1055
+ // Composite-key resolver replaces single-arg .has()
1056
+ sessionResolver,
984
1057
  duplicateDetector,
985
1058
  adaptersByType,
986
1059
  systemEventQueue,
@@ -1077,6 +1150,7 @@ export async function main(overrides = {}) {
1077
1150
  skillWatcherHandles.set(agentId, result.skillWatcherHandle);
1078
1151
  }
1079
1152
  skillRegistries.set(agentId, result.skillRegistry);
1153
+ toolCapabilityPorts.set(agentId, result.toolCapabilityPort);
1080
1154
  container.eventBus.emit("agent:hot_added", { agentId, timestamp: Date.now() });
1081
1155
  daemonLogger.info({ agentId, durationMs: Date.now() - startMs }, "Agent hot-added to running daemon");
1082
1156
  };
@@ -1104,6 +1178,7 @@ export async function main(overrides = {}) {
1104
1178
  stepCounters.delete(agentId);
1105
1179
  piSessionAdapters.delete(agentId);
1106
1180
  skillRegistries.delete(agentId);
1181
+ toolCapabilityPorts.delete(agentId);
1107
1182
  container.eventBus.emit("agent:hot_removed", { agentId, timestamp: Date.now() });
1108
1183
  daemonLogger.info({ agentId, durationMs: Date.now() - startMs }, "Agent hot-removed from running daemon");
1109
1184
  };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Best-effort writer for inline ROLE.md / IDENTITY.md content supplied via
3
- * the L2 single-call agents.create path (260428-vyf).
3
+ * the L2 single-call agents.create path.
4
4
  *
5
5
  * Collapses the previous 3-call agent-creation workflow
6
6
  * (`agents_manage.create` -> `write(ROLE.md)` -> `write(IDENTITY.md)`)
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  /**
3
3
  * Best-effort writer for inline ROLE.md / IDENTITY.md content supplied via
4
- * the L2 single-call agents.create path (260428-vyf).
4
+ * the L2 single-call agents.create path.
5
5
  *
6
6
  * Collapses the previous 3-call agent-creation workflow
7
7
  * (`agents_manage.create` -> `write(ROLE.md)` -> `write(IDENTITY.md)`)
@@ -1,6 +1,6 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  /**
3
- * Built-in provider redundancy guard for providers.create (260501-gyy FIX 2).
3
+ * Built-in provider redundancy guard for providers.create.
4
4
  *
5
5
  * Rejects providers_manage create attempts that would shadow pi-ai's
6
6
  * dynamic catalog with a redundant custom entry. A built-in provider
@@ -16,7 +16,7 @@
16
16
  * in the source template (catalog-agnostic). Pinned by source-grep
17
17
  * regression test in builtin-provider-guard.test.ts.
18
18
  *
19
- * Mirrors credential-resolver.ts shape (260501-2pz precedent).
19
+ * Mirrors credential-resolver.ts shape.
20
20
  *
21
21
  * @module
22
22
  */
@@ -16,7 +16,7 @@
16
16
  * injected oauthProfileLoader (the OAuthCredentialStorePort handle held by
17
17
  * the daemon, adapted to a synchronous has-check at the call site).
18
18
  *
19
- * Note on synchronous loader facade (quick-260504-irq): `OAuthCredentialStorePort.has`
19
+ * Note on synchronous loader facade: `OAuthCredentialStorePort.has`
20
20
  * is async (returns Promise<Result<boolean, Error>>). To avoid an async cascade
21
21
  * through every call site, this resolver remains SYNCHRONOUS and accepts a
22
22
  * sync facade (`oauthProfileLoader: { has(profileId: string): boolean }`).
@@ -3,7 +3,7 @@
3
3
  * Handles model catalog query methods:
4
4
  * models.list -- List available models (optionally filtered by provider)
5
5
  * models.test -- Check provider configuration and catalog status
6
- * models.list_providers -- Live native pi-ai catalog provider list (Layer 1F)
6
+ * models.list_providers -- Live native pi-ai catalog provider list
7
7
  * All handlers are read-only -- no approval gate required.
8
8
  * @module
9
9
  */
@@ -4,7 +4,7 @@
4
4
  * Handles model catalog query methods:
5
5
  * models.list -- List available models (optionally filtered by provider)
6
6
  * models.test -- Check provider configuration and catalog status
7
- * models.list_providers -- Live native pi-ai catalog provider list (Layer 1F)
7
+ * models.list_providers -- Live native pi-ai catalog provider list
8
8
  * All handlers are read-only -- no approval gate required.
9
9
  * @module
10
10
  */
@@ -64,7 +64,7 @@ export function createModelHandlers(deps) {
64
64
  };
65
65
  },
66
66
  // -----------------------------------------------------------------------
67
- // List native pi-ai catalog providers (Layer 1F -- 260430-vwt)
67
+ // List native pi-ai catalog providers
68
68
  //
69
69
  // Live self-discovery for the agent: returns the de-duplicated, sorted
70
70
  // list of provider names from the pi-ai native catalog. Pairs with the
@@ -139,6 +139,24 @@ export interface SubAgentRunnerDeps {
139
139
  abort(): Promise<void>;
140
140
  } | undefined;
141
141
  };
142
+ /**
143
+ * Optional composite-key resolver (R3, B37). When provided, supersedes
144
+ * `activeRunRegistry.get(sessionKey)` for production aborts: the resolver
145
+ * accepts `{ agentId, channelType, channelId }` so multi-agent /
146
+ * multi-channel sessions are distinguishable. Locally re-declared to a
147
+ * structural minimum (avoids a daemon -> agent type-only import cycle in
148
+ * this leaf module). The daemon wires it via
149
+ * `createBackgroundSessionResolver({activeRunRegistry})`.
150
+ */
151
+ sessionResolver?: {
152
+ resolveActiveSession(key: {
153
+ agentId: string;
154
+ channelType: string;
155
+ channelId: string;
156
+ }): {
157
+ abort(): Promise<void>;
158
+ } | undefined;
159
+ };
142
160
  /** Optional result condenser for compressing subagent output */
143
161
  resultCondenser?: {
144
162
  condense(params: {