@jini-ai/agent-runtime 0.7.1 → 0.7.3-next.1

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 (397) hide show
  1. package/CHANGELOG.md +3 -3
  2. package/README.md +1 -0
  3. package/dist/acp-model-probe.d.ts +2 -3
  4. package/dist/acp-model-probe.js +1 -1
  5. package/dist/agent-protocol/acp/account-failure.d.ts +3 -1
  6. package/dist/agent-protocol/acp/account-failure.js +1 -1
  7. package/dist/agent-protocol/acp/constants.d.ts +3 -1
  8. package/dist/agent-protocol/acp/constants.js +2 -0
  9. package/dist/agent-protocol/acp/index.d.ts +2 -1
  10. package/dist/agent-protocol/acp/index.js +2 -1
  11. package/dist/agent-protocol/acp/json.d.ts +26 -7
  12. package/dist/agent-protocol/acp/json.js +11 -11
  13. package/dist/agent-protocol/acp/models.d.ts +26 -6
  14. package/dist/agent-protocol/acp/models.js +157 -129
  15. package/dist/agent-protocol/acp/rpc.d.ts +37 -9
  16. package/dist/agent-protocol/acp/rpc.js +19 -16
  17. package/dist/agent-protocol/acp/session-params.d.ts +4 -1
  18. package/dist/agent-protocol/acp/session-params.js +1 -1
  19. package/dist/agent-protocol/acp/session-permission.d.ts +13 -0
  20. package/dist/agent-protocol/acp/session-permission.js +110 -0
  21. package/dist/agent-protocol/acp/session-results.d.ts +61 -0
  22. package/dist/agent-protocol/acp/session-results.js +226 -0
  23. package/dist/agent-protocol/acp/session-run.d.ts +92 -0
  24. package/dist/agent-protocol/acp/session-run.js +555 -0
  25. package/dist/agent-protocol/acp/session-state.d.ts +9 -0
  26. package/dist/agent-protocol/acp/session-state.js +29 -0
  27. package/dist/agent-protocol/acp/session-text-updates.d.ts +56 -0
  28. package/dist/agent-protocol/acp/session-text-updates.js +119 -0
  29. package/dist/agent-protocol/acp/session-tool-updates.d.ts +21 -0
  30. package/dist/agent-protocol/acp/session-tool-updates.js +90 -0
  31. package/dist/agent-protocol/acp/session-types.d.ts +166 -0
  32. package/dist/agent-protocol/acp/session-types.js +4 -0
  33. package/dist/agent-protocol/acp/session.d.ts +4 -280
  34. package/dist/agent-protocol/acp/session.js +65 -998
  35. package/dist/agent-protocol/acp/text-suppression.d.ts +5 -1
  36. package/dist/agent-protocol/acp/text-suppression.js +1 -1
  37. package/dist/agent-protocol/acp/updates.d.ts +43 -12
  38. package/dist/agent-protocol/acp/updates.js +34 -34
  39. package/dist/agent-protocol/core/json-line-stream.d.ts +133 -36
  40. package/dist/agent-protocol/core/json-line-stream.js +62 -62
  41. package/dist/agent-protocol/pi-rpc/events.d.ts +14 -4
  42. package/dist/agent-protocol/pi-rpc/events.js +14 -14
  43. package/dist/agent-protocol/pi-rpc/internal.d.ts +9 -3
  44. package/dist/agent-protocol/pi-rpc/internal.js +3 -3
  45. package/dist/agent-protocol/pi-rpc/models.d.ts +3 -17
  46. package/dist/agent-protocol/pi-rpc/models.js +1 -45
  47. package/dist/agent-protocol/pi-rpc/session.d.ts +36 -12
  48. package/dist/agent-protocol/pi-rpc/session.js +134 -122
  49. package/dist/amr-model-cache.d.ts +1 -1
  50. package/dist/anthropic-live-models.d.ts +8 -3
  51. package/dist/anthropic-live-models.js +0 -0
  52. package/dist/auth-common.d.ts +2 -0
  53. package/dist/auth-common.js +2 -0
  54. package/dist/auth.d.ts +7 -34
  55. package/dist/auth.js +25 -139
  56. package/dist/capabilities.d.ts +1 -1
  57. package/dist/claude-code-models.d.ts +13 -5
  58. package/dist/claude-code-models.js +12 -10
  59. package/dist/claude-filesystem-policy.d.ts +1 -1
  60. package/dist/claude-stream-frames.d.ts +125 -0
  61. package/dist/claude-stream-frames.js +327 -0
  62. package/dist/claude-stream-handler.d.ts +19 -0
  63. package/dist/claude-stream-handler.js +480 -0
  64. package/dist/claude-stream.d.ts +3 -72
  65. package/dist/claude-stream.js +2 -801
  66. package/dist/core/model-discovery-shared.d.ts +14 -8
  67. package/dist/core/model-discovery-shared.js +6 -9
  68. package/dist/core/omit-keys.d.ts +4 -1
  69. package/dist/core/omit-keys.js +1 -1
  70. package/dist/defs/aider/executable.d.ts +2 -0
  71. package/dist/defs/aider/executable.js +2 -0
  72. package/dist/defs/aider/model-discovery.d.ts +3 -0
  73. package/dist/defs/aider/model-discovery.js +6 -0
  74. package/dist/defs/aider.d.ts +10 -10
  75. package/dist/defs/amp/index.d.ts +35 -0
  76. package/dist/defs/amp/index.js +75 -0
  77. package/dist/defs/amp.d.ts +1 -34
  78. package/dist/defs/amp.js +1 -74
  79. package/dist/defs/amr/executable-resolution.d.ts +7 -0
  80. package/dist/defs/amr/executable-resolution.js +50 -0
  81. package/dist/defs/amr/executable.d.ts +2 -0
  82. package/dist/defs/amr/executable.js +2 -0
  83. package/dist/defs/amr/index.d.ts +69 -0
  84. package/dist/defs/amr/index.js +279 -0
  85. package/dist/defs/amr/model-discovery.d.ts +3 -0
  86. package/dist/defs/amr/model-discovery.js +4 -0
  87. package/dist/defs/amr.d.ts +1 -68
  88. package/dist/defs/amr.js +1 -291
  89. package/dist/defs/antigravity/auth.d.ts +14 -0
  90. package/dist/defs/antigravity/auth.js +47 -0
  91. package/dist/defs/antigravity/index.d.ts +9 -9
  92. package/dist/defs/antigravity/index.js +3 -3
  93. package/dist/defs/antigravity/model-discovery.d.ts +3 -0
  94. package/dist/defs/antigravity/model-discovery.js +5 -0
  95. package/dist/defs/auggie/executable.d.ts +2 -0
  96. package/dist/defs/auggie/executable.js +2 -0
  97. package/dist/defs/auggie.d.ts +13 -13
  98. package/dist/defs/auggie.js +2 -9
  99. package/dist/defs/claude/auth.d.ts +15 -0
  100. package/dist/defs/claude/auth.js +47 -0
  101. package/dist/defs/claude/executable.d.ts +2 -0
  102. package/dist/defs/claude/executable.js +2 -0
  103. package/dist/defs/claude/model-discovery.d.ts +3 -0
  104. package/dist/defs/claude/model-discovery.js +20 -0
  105. package/dist/defs/claude-compatible-args.d.ts +10 -6
  106. package/dist/defs/claude-compatible-args.js +5 -5
  107. package/dist/defs/claude.d.ts +11 -11
  108. package/dist/defs/claude.js +5 -4
  109. package/dist/defs/cline/executable.d.ts +2 -0
  110. package/dist/defs/cline/executable.js +2 -0
  111. package/dist/defs/cline.d.ts +13 -13
  112. package/dist/defs/cline.js +2 -9
  113. package/dist/defs/codebuddy/executable.d.ts +2 -0
  114. package/dist/defs/codebuddy/executable.js +2 -0
  115. package/dist/defs/codebuddy/index.d.ts +48 -0
  116. package/dist/defs/codebuddy/index.js +121 -0
  117. package/dist/defs/codebuddy/model-discovery.d.ts +3 -0
  118. package/dist/defs/codebuddy/model-discovery.js +5 -0
  119. package/dist/defs/codebuddy.d.ts +1 -47
  120. package/dist/defs/codebuddy.js +1 -120
  121. package/dist/defs/codex/auth.d.ts +4 -0
  122. package/dist/defs/codex/auth.js +2 -0
  123. package/dist/defs/codex/event-stream.d.ts +10 -0
  124. package/dist/defs/codex/event-stream.js +353 -0
  125. package/dist/defs/codex/executable-resolution.d.ts +7 -0
  126. package/dist/defs/codex/executable-resolution.js +37 -0
  127. package/dist/defs/codex/executable.d.ts +2 -0
  128. package/dist/defs/codex/executable.js +2 -0
  129. package/dist/defs/codex/launch.d.ts +3 -0
  130. package/dist/defs/codex/launch.js +155 -0
  131. package/dist/defs/codex/model-discovery.d.ts +3 -0
  132. package/dist/defs/codex/model-discovery.js +11 -0
  133. package/dist/defs/codex/options.d.ts +11 -0
  134. package/dist/defs/codex/options.js +5 -0
  135. package/dist/defs/codex.d.ts +18 -11
  136. package/dist/defs/codex.js +32 -29
  137. package/dist/defs/crush/executable.d.ts +2 -0
  138. package/dist/defs/crush/executable.js +2 -0
  139. package/dist/defs/crush/model-discovery.d.ts +3 -0
  140. package/dist/defs/crush/model-discovery.js +6 -0
  141. package/dist/defs/crush.d.ts +10 -10
  142. package/dist/defs/cursor-agent/auth.d.ts +13 -0
  143. package/dist/defs/cursor-agent/auth.js +22 -0
  144. package/dist/defs/cursor-agent/event-stream.d.ts +8 -0
  145. package/dist/defs/cursor-agent/event-stream.js +104 -0
  146. package/dist/defs/cursor-agent/executable.d.ts +2 -0
  147. package/dist/defs/cursor-agent/executable.js +2 -0
  148. package/dist/defs/cursor-agent/model-discovery.d.ts +3 -0
  149. package/dist/defs/cursor-agent/model-discovery.js +5 -0
  150. package/dist/defs/cursor-agent.d.ts +11 -13
  151. package/dist/defs/cursor-agent.js +1 -1
  152. package/dist/defs/deepseek/auth.d.ts +13 -0
  153. package/dist/defs/deepseek/auth.js +18 -0
  154. package/dist/defs/deepseek/executable.d.ts +2 -0
  155. package/dist/defs/deepseek/executable.js +2 -0
  156. package/dist/defs/deepseek/model-discovery.d.ts +3 -0
  157. package/dist/defs/deepseek/model-discovery.js +5 -0
  158. package/dist/defs/deepseek.d.ts +10 -10
  159. package/dist/defs/devin/executable.d.ts +2 -0
  160. package/dist/defs/devin/executable.js +2 -0
  161. package/dist/defs/devin.d.ts +15 -15
  162. package/dist/defs/devin.js +3 -10
  163. package/dist/defs/droid/executable.d.ts +2 -0
  164. package/dist/defs/droid/executable.js +2 -0
  165. package/dist/defs/droid/model-discovery.d.ts +3 -0
  166. package/dist/defs/droid/model-discovery.js +5 -0
  167. package/dist/defs/droid.d.ts +10 -10
  168. package/dist/defs/gemini/event-stream.d.ts +14 -0
  169. package/dist/defs/gemini/event-stream.js +193 -0
  170. package/dist/defs/goose/executable.d.ts +2 -0
  171. package/dist/defs/goose/executable.js +2 -0
  172. package/dist/defs/goose.d.ts +13 -13
  173. package/dist/defs/goose.js +2 -9
  174. package/dist/defs/grok-build/model-discovery.d.ts +3 -0
  175. package/dist/defs/grok-build/model-discovery.js +5 -0
  176. package/dist/defs/grok-build.d.ts +10 -10
  177. package/dist/defs/hermes/executable.d.ts +2 -0
  178. package/dist/defs/hermes/executable.js +2 -0
  179. package/dist/defs/hermes/index.d.ts +34 -0
  180. package/dist/defs/hermes/index.js +57 -0
  181. package/dist/defs/hermes.d.ts +1 -33
  182. package/dist/defs/hermes.js +1 -56
  183. package/dist/defs/index.d.ts +1 -0
  184. package/dist/defs/index.js +1 -0
  185. package/dist/defs/kilo/executable.d.ts +2 -0
  186. package/dist/defs/kilo/executable.js +2 -0
  187. package/dist/defs/kilo.d.ts +13 -13
  188. package/dist/defs/kilo.js +2 -9
  189. package/dist/defs/kimi/event-stream.d.ts +3 -0
  190. package/dist/defs/kimi/event-stream.js +46 -0
  191. package/dist/defs/kimi/executable.d.ts +2 -0
  192. package/dist/defs/kimi/executable.js +2 -0
  193. package/dist/defs/kimi.d.ts +13 -13
  194. package/dist/defs/kimi.js +2 -9
  195. package/dist/defs/kiro/executable.d.ts +2 -0
  196. package/dist/defs/kiro/executable.js +2 -0
  197. package/dist/defs/kiro.d.ts +13 -13
  198. package/dist/defs/kiro.js +2 -9
  199. package/dist/defs/mimo/executable.d.ts +2 -0
  200. package/dist/defs/mimo/executable.js +2 -0
  201. package/dist/defs/mimo/model-discovery.d.ts +3 -0
  202. package/dist/defs/mimo/model-discovery.js +7 -0
  203. package/dist/defs/mimo.d.ts +10 -10
  204. package/dist/defs/opencode/event-stream.d.ts +8 -0
  205. package/dist/defs/opencode/event-stream.js +108 -0
  206. package/dist/defs/opencode/executable.d.ts +2 -0
  207. package/dist/defs/opencode/executable.js +2 -0
  208. package/dist/defs/opencode/model-discovery.d.ts +4 -0
  209. package/dist/defs/opencode/model-discovery.js +14 -0
  210. package/dist/defs/opencode-acp.d.ts +42 -0
  211. package/dist/defs/opencode-acp.js +23 -0
  212. package/dist/defs/opencode.d.ts +9 -9
  213. package/dist/defs/pi/executable.d.ts +2 -0
  214. package/dist/defs/pi/executable.js +2 -0
  215. package/dist/defs/pi/model-discovery.d.ts +4 -0
  216. package/dist/defs/pi/model-discovery.js +16 -0
  217. package/dist/defs/pi/options.d.ts +11 -0
  218. package/dist/defs/pi/options.js +5 -0
  219. package/dist/defs/pi.d.ts +10 -10
  220. package/dist/defs/qoder/executable.d.ts +2 -0
  221. package/dist/defs/qoder/executable.js +2 -0
  222. package/dist/defs/qoder/model-discovery.d.ts +3 -0
  223. package/dist/defs/qoder/model-discovery.js +7 -0
  224. package/dist/defs/qoder.d.ts +9 -9
  225. package/dist/defs/qwen/executable.d.ts +2 -0
  226. package/dist/defs/qwen/executable.js +2 -0
  227. package/dist/defs/qwen/model-discovery.d.ts +3 -0
  228. package/dist/defs/qwen/model-discovery.js +7 -0
  229. package/dist/defs/qwen.d.ts +10 -10
  230. package/dist/defs/reasonix/auth.d.ts +13 -0
  231. package/dist/defs/reasonix/auth.js +18 -0
  232. package/dist/defs/reasonix/executable.d.ts +2 -0
  233. package/dist/defs/reasonix/executable.js +2 -0
  234. package/dist/defs/reasonix.d.ts +13 -13
  235. package/dist/defs/reasonix.js +2 -9
  236. package/dist/defs/shared.d.ts +10 -2
  237. package/dist/defs/shared.js +5 -1
  238. package/dist/defs/trae-cli/executable.d.ts +2 -0
  239. package/dist/defs/trae-cli/executable.js +2 -0
  240. package/dist/defs/trae-cli.d.ts +15 -15
  241. package/dist/defs/trae-cli.js +2 -9
  242. package/dist/defs/vibe/executable.d.ts +2 -0
  243. package/dist/defs/vibe/executable.js +2 -0
  244. package/dist/defs/vibe.d.ts +13 -13
  245. package/dist/defs/vibe.js +2 -9
  246. package/dist/detection.d.ts +4 -3
  247. package/dist/detection.js +22 -22
  248. package/dist/diagnostics.d.ts +4 -4
  249. package/dist/diagnostics.js +2 -2
  250. package/dist/env.js +2 -1
  251. package/dist/executable-helpers.d.ts +21 -0
  252. package/dist/executable-helpers.js +2 -0
  253. package/dist/executables.d.ts +2 -2
  254. package/dist/executables.js +68 -114
  255. package/dist/index.d.ts +6 -2
  256. package/dist/index.js +5 -1
  257. package/dist/invocation.d.ts +22 -6
  258. package/dist/invocation.js +19 -17
  259. package/dist/json-event-stream-shared.d.ts +81 -0
  260. package/dist/json-event-stream-shared.js +147 -0
  261. package/dist/json-event-stream.d.ts +2 -4
  262. package/dist/json-event-stream.js +15 -940
  263. package/dist/launch.d.ts +1 -9
  264. package/dist/launch.js +6 -155
  265. package/dist/log-file.d.ts +2 -8
  266. package/dist/log-file.js +1 -1
  267. package/dist/mcp.d.ts +2 -2
  268. package/dist/mcp.js +1 -1
  269. package/dist/mmd-routes.d.ts +7 -7
  270. package/dist/mmd-routes.js +19 -27
  271. package/dist/model-discovery-adapters.d.ts +47 -11
  272. package/dist/model-discovery-adapters.js +47 -41
  273. package/dist/model-discovery-config-types.d.ts +44 -0
  274. package/dist/model-discovery-config-types.js +20 -0
  275. package/dist/model-discovery-config.d.ts +19 -11
  276. package/dist/model-discovery-config.js +64 -87
  277. package/dist/model-discovery-native.d.ts +2 -1
  278. package/dist/model-discovery-native.js +3 -3
  279. package/dist/model-discovery-sdk.d.ts +6 -2
  280. package/dist/model-discovery-sdk.js +2 -2
  281. package/dist/model-discovery-types.d.ts +1 -138
  282. package/dist/model-discovery-yaml.d.ts +3 -1
  283. package/dist/model-discovery-yaml.js +1 -1
  284. package/dist/model-discovery.d.ts +15 -5
  285. package/dist/model-discovery.js +119 -105
  286. package/dist/model-loading-state.d.ts +1 -1
  287. package/dist/model-loading-state.js +1 -1
  288. package/dist/model-registry.d.ts +5 -5
  289. package/dist/model-registry.js +7 -6
  290. package/dist/models.d.ts +4 -3
  291. package/dist/models.js +2 -2
  292. package/dist/native-permissions.d.ts +47 -0
  293. package/dist/native-permissions.js +80 -0
  294. package/dist/native-runtime.d.ts +11 -8
  295. package/dist/native-runtime.js +8 -4
  296. package/dist/native-tool-policy.d.ts +1 -40
  297. package/dist/opencode-log.d.ts +3 -3
  298. package/dist/opencode-log.js +5 -3
  299. package/dist/paths.d.ts +1 -1
  300. package/dist/paths.js +1 -1
  301. package/dist/pi-models.d.ts +12 -2
  302. package/dist/pi-models.js +11 -1
  303. package/dist/prompt-augmenter.d.ts +1 -37
  304. package/dist/prompt-augmenter.js +0 -6
  305. package/dist/prompt-budget.d.ts +3 -3
  306. package/dist/prompt-budget.js +2 -2
  307. package/dist/prompt-file.d.ts +2 -6
  308. package/dist/prompt-file.js +1 -1
  309. package/dist/providers/aihubmix.d.ts +8 -8
  310. package/dist/providers/aihubmix.js +8 -8
  311. package/dist/providers/anthropic-messages.d.ts +22 -23
  312. package/dist/providers/anthropic-messages.js +26 -53
  313. package/dist/providers/azure-chat.d.ts +7 -6
  314. package/dist/providers/azure-chat.js +9 -6
  315. package/dist/providers/connection-guard.d.ts +3 -9
  316. package/dist/providers/connection-guard.js +6 -14
  317. package/dist/providers/connection-test.d.ts +1 -2
  318. package/dist/providers/connection-test.js +51 -51
  319. package/dist/providers/credentials.d.ts +59 -0
  320. package/dist/providers/credentials.js +80 -0
  321. package/dist/providers/elevenlabs.d.ts +2 -6
  322. package/dist/providers/elevenlabs.js +2 -31
  323. package/dist/providers/google-messages.d.ts +11 -10
  324. package/dist/providers/google-messages.js +16 -35
  325. package/dist/providers/google-schema.d.ts +1 -1
  326. package/dist/providers/google-schema.js +1 -1
  327. package/dist/providers/google.d.ts +6 -6
  328. package/dist/providers/google.js +6 -6
  329. package/dist/providers/index.d.ts +5 -2
  330. package/dist/providers/index.js +5 -2
  331. package/dist/providers/model-catalog.d.ts +4 -9
  332. package/dist/providers/model-catalog.js +3 -11
  333. package/dist/providers/oauth-callback-server.js +93 -87
  334. package/dist/providers/oauth-provider.d.ts +1 -1
  335. package/dist/providers/oauth-provider.js +1 -1
  336. package/dist/providers/oauth-tokens.d.ts +5 -5
  337. package/dist/providers/oauth-tokens.js +8 -9
  338. package/dist/providers/ollama-chat.d.ts +13 -12
  339. package/dist/providers/ollama-chat.js +15 -24
  340. package/dist/providers/openai-chat-request.d.ts +34 -0
  341. package/dist/providers/openai-chat-request.js +152 -0
  342. package/dist/providers/openai-chat-stream.d.ts +48 -0
  343. package/dist/providers/openai-chat-stream.js +89 -0
  344. package/dist/providers/openai-chat-tool-results.d.ts +81 -0
  345. package/dist/providers/openai-chat-tool-results.js +124 -0
  346. package/dist/providers/openai-chat-types.d.ts +180 -0
  347. package/dist/providers/openai-chat-types.js +3 -0
  348. package/dist/providers/openai-chat.d.ts +5 -405
  349. package/dist/providers/openai-chat.js +9 -388
  350. package/dist/providers/pkce.d.ts +1 -1
  351. package/dist/providers/pkce.js +1 -1
  352. package/dist/providers/provider-url.d.ts +6 -0
  353. package/dist/providers/provider-url.js +9 -0
  354. package/dist/providers/response-text.d.ts +4 -0
  355. package/dist/providers/response-text.js +16 -0
  356. package/dist/providers/sse-decode.d.ts +4 -0
  357. package/dist/providers/sse-decode.js +11 -0
  358. package/dist/providers/token-params.d.ts +5 -5
  359. package/dist/providers/token-params.js +5 -5
  360. package/dist/providers/tool-loop-verdict.d.ts +1 -1
  361. package/dist/providers/tool-loop-verdict.js +1 -1
  362. package/dist/providers/tool-turn-types.d.ts +2 -1
  363. package/dist/providers/tool-turn.js +30 -50
  364. package/dist/providers/turn-end-guard.d.ts +4 -1
  365. package/dist/providers/turn-end-guard.js +1 -1
  366. package/dist/qoder-stream.d.ts +1 -1
  367. package/dist/qoder-stream.js +1 -1
  368. package/dist/registry.d.ts +5 -5
  369. package/dist/registry.js +4 -4
  370. package/dist/role-marker-guard.d.ts +13 -1
  371. package/dist/role-marker-guard.js +15 -1
  372. package/dist/runtime-def-binding.d.ts +15 -0
  373. package/dist/runtime-def-binding.js +19 -0
  374. package/dist/runtime-port-bindings.d.ts +181 -0
  375. package/dist/runtime-port-bindings.js +95 -0
  376. package/dist/runtime-state.d.ts +2 -11
  377. package/dist/runtime-state.js +0 -13
  378. package/dist/types.d.ts +1 -454
  379. package/package.json +27 -15
  380. package/dist/ai-trace/capture.d.ts +0 -17
  381. package/dist/ai-trace/capture.js +0 -43
  382. package/dist/ai-trace/classify.d.ts +0 -12
  383. package/dist/ai-trace/classify.js +0 -16
  384. package/dist/ai-trace/index.d.ts +0 -13
  385. package/dist/ai-trace/index.js +0 -6
  386. package/dist/ai-trace/recorder.d.ts +0 -64
  387. package/dist/ai-trace/recorder.js +0 -258
  388. package/dist/ai-trace/sinks.d.ts +0 -51
  389. package/dist/ai-trace/sinks.js +0 -153
  390. package/dist/ai-trace/types.d.ts +0 -123
  391. package/dist/ai-trace/types.js +0 -17
  392. package/dist/ai-trace/usage.d.ts +0 -13
  393. package/dist/ai-trace/usage.js +0 -45
  394. package/dist/model-contracts.d.ts +0 -29
  395. package/dist/model-contracts.js +0 -2
  396. package/dist/providers/types.d.ts +0 -36
  397. package/dist/providers/types.js +0 -13
@@ -1,5 +1,6 @@
1
1
  import type { runAnthropicToolTurn, AnthropicToolDef } from './anthropic-messages.js';
2
- import type { runOpenAiToolTurn, OpenAiFunctionToolDef } from './openai-chat.js';
2
+ import type { runOpenAiToolTurn } from './openai-chat.js';
3
+ import type { OpenAiFunctionToolDef } from './openai-chat-types.js';
3
4
  import type { runAzureToolTurn, AzureFunctionToolDef } from './azure-chat.js';
4
5
  import type { runGoogleToolTurn, GoogleToolDef } from './google-messages.js';
5
6
  import type { ProviderToolSnapshotOptions, ProviderSchemaFallback, ProviderProtocol } from './provider-tool-policy.js';
@@ -2,6 +2,7 @@ import { runAnthropicToolTurn } from './anthropic-messages.js';
2
2
  import { runAzureToolTurn } from './azure-chat.js';
3
3
  import { runGoogleToolTurn } from './google-messages.js';
4
4
  import { runOpenAiToolTurn } from './openai-chat.js';
5
+ import {} from './openai-chat-types.js';
5
6
  import { createToolNameMap } from '@jini-ai/core';
6
7
  import { compileOperationSchema } from './operation-schema.js';
7
8
  export { compileOperationSchema } from './operation-schema.js';
@@ -137,6 +138,26 @@ function createToolProjection(input, _options = {}) {
137
138
  },
138
139
  };
139
140
  }
141
+ /** Projects adapter events and retains the adapter end reason, which overrides the raw stop code. */
142
+ function forwardAdapterEvents({ input, projection }, { errorFromContentPrefix = false } = {}) {
143
+ let endReason = null;
144
+ const onEvent = (event) => {
145
+ if (event.type === 'fabricated_role_marker')
146
+ return;
147
+ if (event.type === 'end')
148
+ endReason = event.reason;
149
+ if (event.type === 'tool_result') {
150
+ const content = describeToolResultContent(event.content);
151
+ input.onEvent({ type: 'tool_result', toolUseId: event.toolUseId, content, isError: event.isError || (errorFromContentPrefix && content.startsWith(TOOL_ERROR_PREFIX.trimEnd())) });
152
+ return;
153
+ }
154
+ projection.onEvent(event);
155
+ };
156
+ return {
157
+ onEvent,
158
+ endReason: (_required = {}, _optional = {}) => endReason,
159
+ };
160
+ }
140
161
  function anthropicTools(tools) {
141
162
  return tools.map(({ name, description, operation }) => ({ name, ...(description !== undefined ? { description } : {}), input_schema: operation.schema, ...(operation.strict ? { strict: true } : {}) }));
142
163
  }
@@ -160,7 +181,7 @@ async function runAnthropicTurn(input) {
160
181
  const result = await projection.execute({ id: call.id, name: call.name, input: call.input });
161
182
  return { content: toAnthropicToolContent(result.content), ...(result.isError !== undefined ? { isError: result.isError } : {}) };
162
183
  };
163
- let capturedEndReason = null;
184
+ const forward = forwardAdapterEvents({ input, projection });
164
185
  const result = await (({ apiKey, model, messages, maxTokens, onEvent, ...optionalArgs }) => input.adapters.anthropic({ apiKey, model, messages, maxTokens, onEvent }, optionalArgs))({
165
186
  apiKey: input.apiKey,
166
187
  ...(input.baseUrl ? { baseUrl: input.baseUrl } : {}),
@@ -174,24 +195,9 @@ async function runAnthropicTurn(input) {
174
195
  ...(input.maxToolTurns !== undefined ? { maxToolTurns: input.maxToolTurns } : {}),
175
196
  executeTool,
176
197
  ...(input.signal ? { signal: input.signal } : {}),
177
- onEvent: (event) => {
178
- if (event.type === "fabricated_role_marker")
179
- return;
180
- if (event.type === "end")
181
- capturedEndReason = event.reason;
182
- if (event.type === "tool_result") {
183
- input.onEvent({
184
- type: "tool_result",
185
- toolUseId: event.toolUseId,
186
- content: describeToolResultContent(event.content),
187
- isError: event.isError,
188
- });
189
- return;
190
- }
191
- projection.onEvent(event);
192
- },
198
+ onEvent: forward.onEvent,
193
199
  });
194
- return normalizeTurnResult(result, capturedEndReason);
200
+ return normalizeTurnResult(result, forward.endReason());
195
201
  }
196
202
  /** OpenAI and Azure share message/tool projection; the selected adapter retains its native request semantics. */
197
203
  async function runOpenAiCompatibleTurn(input, _options = {}) {
@@ -208,7 +214,7 @@ async function runOpenAiCompatibleTurn(input, _options = {}) {
208
214
  const result = await projection.execute({ id: call.id, name: call.name, input: call.input });
209
215
  return { content: foldToolError(toOpenAiToolContent(result.content), result.isError) };
210
216
  };
211
- let capturedEndReason = null;
217
+ const forward = forwardAdapterEvents({ input, projection }, { errorFromContentPrefix: true });
212
218
  const result = await (({ apiKey, model, messages, onEvent, ...optionalArgs }) => {
213
219
  if (input.protocol === 'azure') {
214
220
  // runAzureTurn checks the required endpoint before any projection or adapter work.
@@ -228,20 +234,9 @@ async function runOpenAiCompatibleTurn(input, _options = {}) {
228
234
  ...(input.maxToolTurns !== undefined ? { maxToolTurns: input.maxToolTurns } : {}),
229
235
  executeTool,
230
236
  ...(input.signal ? { signal: input.signal } : {}),
231
- onEvent: (event) => {
232
- if (event.type === "fabricated_role_marker")
233
- return;
234
- if (event.type === "end")
235
- capturedEndReason = event.reason;
236
- if (event.type === "tool_result") {
237
- const content = describeToolResultContent(event.content);
238
- input.onEvent({ type: "tool_result", toolUseId: event.toolUseId, content, isError: event.isError || content.startsWith(TOOL_ERROR_PREFIX.trimEnd()) });
239
- return;
240
- }
241
- projection.onEvent(event);
242
- },
237
+ onEvent: forward.onEvent,
243
238
  });
244
- return normalizeTurnResult(result, capturedEndReason);
239
+ return normalizeTurnResult(result, forward.endReason());
245
240
  }
246
241
  async function runAzureTurn(input) {
247
242
  if (!input.baseUrl) {
@@ -263,7 +258,7 @@ async function runGoogleTurn(input) {
263
258
  const result = await projection.execute({ id: call.id, name: call.name, input: call.input });
264
259
  return { content: toGoogleToolContent(result.content), ...(result.isError !== undefined ? { isError: result.isError } : {}) };
265
260
  };
266
- let capturedEndReason = null;
261
+ const forward = forwardAdapterEvents({ input, projection });
267
262
  const result = await (({ apiKey, model, contents, onEvent, ...optionalArgs }) => input.adapters.google({ apiKey, model, contents, onEvent }, optionalArgs))({
268
263
  apiKey: input.apiKey,
269
264
  ...(input.baseUrl ? { baseUrl: input.baseUrl } : {}),
@@ -277,24 +272,9 @@ async function runGoogleTurn(input) {
277
272
  ...(input.maxToolTurns !== undefined ? { maxToolTurns: input.maxToolTurns } : {}),
278
273
  executeTool,
279
274
  ...(input.signal ? { signal: input.signal } : {}),
280
- onEvent: (event) => {
281
- if (event.type === "fabricated_role_marker")
282
- return;
283
- if (event.type === "end")
284
- capturedEndReason = event.reason;
285
- if (event.type === "tool_result") {
286
- input.onEvent({
287
- type: "tool_result",
288
- toolUseId: event.toolUseId,
289
- content: describeToolResultContent(event.content),
290
- isError: event.isError,
291
- });
292
- return;
293
- }
294
- projection.onEvent(event);
295
- },
275
+ onEvent: forward.onEvent,
296
276
  });
297
- return normalizeTurnResult(result, capturedEndReason);
277
+ return normalizeTurnResult(result, forward.endReason());
298
278
  }
299
279
  /** Runs one provider-neutral turn through the supplied adapters. The adapter end event takes precedence over a raw provider stop code.
300
280
  * Local mapping is proportional to the descriptors, expanded schemas and emitted result parts; request and loop cost belongs to the adapter ports.
@@ -33,5 +33,8 @@ export interface TurnEndGuard {
33
33
  readonly hasEnded: () => boolean;
34
34
  }
35
35
  /** Builds a fresh, single-use end guard. `makeEndEvent` lets each turn-runner's own event union shape (`AnthropicTurnEvent`/`OpenAiTurnEvent`) stay independent — this module has no opinion on it. */
36
- export declare function createTurnEndGuard<Event>(onEvent: (event: Event) => void, makeEndEvent: (reason: TurnEndReason) => Event): TurnEndGuard;
36
+ export declare function createTurnEndGuard<Event>({ onEvent, makeEndEvent }: {
37
+ onEvent: (event: Event) => void;
38
+ makeEndEvent: (reason: TurnEndReason) => Event;
39
+ }, _optional?: Record<string, never>): TurnEndGuard;
37
40
  //# sourceMappingURL=turn-end-guard.d.ts.map
@@ -25,7 +25,7 @@
25
25
  * artificial caller-side scenario just to trip it.
26
26
  */
27
27
  /** Builds a fresh, single-use end guard. `makeEndEvent` lets each turn-runner's own event union shape (`AnthropicTurnEvent`/`OpenAiTurnEvent`) stay independent — this module has no opinion on it. */
28
- export function createTurnEndGuard(onEvent, makeEndEvent) {
28
+ export function createTurnEndGuard({ onEvent, makeEndEvent }, _optional = {}) {
29
29
  let ended = false;
30
30
  return {
31
31
  emitEnd(reason) {
@@ -37,7 +37,7 @@ export type QoderEvent = {
37
37
  type QoderEventSink = (event: QoderEvent) => void;
38
38
  export declare function createQoderStreamHandler({ onEvent }: {
39
39
  onEvent: QoderEventSink;
40
- }): {
40
+ }, _optional?: Record<string, never>): {
41
41
  feed: ({ chunk }: {
42
42
  chunk: unknown;
43
43
  }) => void;
@@ -80,7 +80,7 @@ function usageEvent(obj) {
80
80
  isError: Boolean(obj.is_error),
81
81
  };
82
82
  }
83
- export function createQoderStreamHandler({ onEvent }) {
83
+ export function createQoderStreamHandler({ onEvent }, _optional = {}) {
84
84
  const lines = createBoundedLineStream({
85
85
  onLine: line => { const trimmed = line.trim(); if (trimmed)
86
86
  handleLine(trimmed); },
@@ -1,9 +1,9 @@
1
- import type { RuntimeAgentDef } from './types.js';
1
+ import type { RuntimeAgentDef } from '@jini-ai/core/contracts/agents';
2
2
  export declare const BASE_AGENT_DEFS: RuntimeAgentDef[];
3
3
  export declare const AGENT_DEFS: RuntimeAgentDef[];
4
4
  export declare function getAgentDef({ id }: {
5
5
  id: string;
6
- }): RuntimeAgentDef | null;
6
+ }, _optional?: Record<string, never>): RuntimeAgentDef | null;
7
7
  /**
8
8
  * Whether a caller can inject external MCP servers (the host application's or this engine's own
9
9
  * tools) into a session run by this
@@ -22,7 +22,7 @@ export declare function getAgentDef({ id }: {
22
22
  */
23
23
  export declare function runtimeSupportsExternalTools({ def }: {
24
24
  def: Pick<RuntimeAgentDef, 'externalMcpInjection'>;
25
- }): boolean;
25
+ }, _optional?: Record<string, never>): boolean;
26
26
  /**
27
27
  * Whether this def's CLI has a native subagent tool, per its own `supportsSubagents` declaration.
28
28
  * The single seam a host reads before steering a run toward delegation or rendering a
@@ -32,7 +32,7 @@ export declare function runtimeSupportsExternalTools({ def }: {
32
32
  */
33
33
  export declare function runtimeSupportsSubagents({ def }: {
34
34
  def: Pick<RuntimeAgentDef, 'supportsSubagents'>;
35
- }): boolean;
35
+ }, _optional?: Record<string, never>): boolean;
36
36
  /**
37
37
  * {@link runtimeSupportsSubagents} by agent id through the registry. An unknown id is unsupported.
38
38
  * `getDef` defaults to this package's {@link getAgentDef}; a host with its own runtime registry
@@ -55,7 +55,7 @@ export declare function agentSupportsSubagents({ agentId }: {
55
55
  */
56
56
  export declare function runtimeSupportsChromeIntegration({ def }: {
57
57
  def: Pick<RuntimeAgentDef, 'supportsChromeIntegration'>;
58
- }): boolean;
58
+ }, _optional?: Record<string, never>): boolean;
59
59
  /**
60
60
  * {@link runtimeSupportsChromeIntegration} by agent id; same lookup contract as {@link agentSupportsSubagents}.
61
61
  *
package/dist/registry.js CHANGED
@@ -57,7 +57,7 @@ for (const def of AGENT_DEFS) {
57
57
  }
58
58
  ids.add(def.id);
59
59
  }
60
- export function getAgentDef({ id }) {
60
+ export function getAgentDef({ id }, _optional = {}) {
61
61
  return AGENT_DEFS.find((a) => a.id === id) || null;
62
62
  }
63
63
  /**
@@ -76,7 +76,7 @@ export function getAgentDef({ id }) {
76
76
  *
77
77
  * @complexity Time/space: O(1).
78
78
  */
79
- export function runtimeSupportsExternalTools({ def }) {
79
+ export function runtimeSupportsExternalTools({ def }, _optional = {}) {
80
80
  return def.externalMcpInjection !== undefined;
81
81
  }
82
82
  /**
@@ -86,7 +86,7 @@ export function runtimeSupportsExternalTools({ def }) {
86
86
  *
87
87
  * @complexity Time/space: O(1).
88
88
  */
89
- export function runtimeSupportsSubagents({ def }) {
89
+ export function runtimeSupportsSubagents({ def }, _optional = {}) {
90
90
  return def.supportsSubagents === true;
91
91
  }
92
92
  /**
@@ -106,7 +106,7 @@ export function agentSupportsSubagents({ agentId }, { getDef = getAgentDef } = {
106
106
  *
107
107
  * @complexity Time/space: O(1).
108
108
  */
109
- export function runtimeSupportsChromeIntegration({ def }) {
109
+ export function runtimeSupportsChromeIntegration({ def }, _optional = {}) {
110
110
  return def.supportsChromeIntegration === true;
111
111
  }
112
112
  /**
@@ -49,5 +49,17 @@ export interface RoleMarkerGuard {
49
49
  */
50
50
  export declare function createRoleMarkerGuard({ messageId }: {
51
51
  messageId: string;
52
- }): RoleMarkerGuard;
52
+ }, _optional?: Record<string, never>): RoleMarkerGuard;
53
+ /** Emits the safe portion of a text delta and stops the caller after a role marker. */
54
+ export declare function emitGuardedTextDelta({ state, text, onEvent }: {
55
+ state: {
56
+ guard: ReturnType<typeof createRoleMarkerGuard>;
57
+ fullText: string;
58
+ };
59
+ text: string;
60
+ onEvent: (event: {
61
+ type: 'text_delta';
62
+ delta: string;
63
+ } | RoleMarkerWarningEvent) => void;
64
+ }, _optional?: Record<string, never>): 'continue' | 'break';
53
65
  //# sourceMappingURL=role-marker-guard.d.ts.map
@@ -145,7 +145,7 @@ const TAIL_BUFFER_SIZE = 64;
145
145
  * }
146
146
  * }
147
147
  */
148
- export function createRoleMarkerGuard({ messageId }) {
148
+ export function createRoleMarkerGuard({ messageId }, _optional = {}) {
149
149
  // Rolling tail of the bytes we have ALREADY EMITTED, capped at
150
150
  // TAIL_BUFFER_SIZE. Used as the prefix when matching against new
151
151
  // text so we catch markers that straddle a chunk boundary.
@@ -272,4 +272,18 @@ export function createRoleMarkerGuard({ messageId }) {
272
272
  },
273
273
  };
274
274
  }
275
+ /** Emits the safe portion of a text delta and stops the caller after a role marker. */
276
+ export function emitGuardedTextDelta({ state, text, onEvent }, _optional = {}) {
277
+ const safe = state.guard.feedText({ text });
278
+ if (safe.length > 0) {
279
+ state.fullText += safe;
280
+ onEvent({ type: 'text_delta', delta: safe });
281
+ }
282
+ if (!state.guard.contaminated)
283
+ return 'continue';
284
+ const warn = state.guard.warningEvent();
285
+ if (warn)
286
+ onEvent(warn);
287
+ return 'break';
288
+ }
275
289
  //# sourceMappingURL=role-marker-guard.js.map
@@ -0,0 +1,15 @@
1
+ /** @file Binds one agent definition to a host's runtime state. Lives beside `runtime-state.ts`, not in it:
2
+ * binding Codex needs the Codex argument builder, and the Codex definition's own imports reach `runtime-state.ts`. */
3
+ import type { RuntimeAgentDef } from '@jini-ai/core/contracts/agents';
4
+ import type { AgentRuntimeState } from './runtime-state.js';
5
+ import type { CodexDefOptions } from './defs/codex/options.js';
6
+ /** Bind model probes and the argument builder to the host transport, capability state and plugin policy.
7
+ * The Codex config reaches only the Codex definition, through its own argument; nothing vendor-specific is
8
+ * added to the neutral build options. Returns a definition copy without mutating the registry. @complexity O(1). */
9
+ export declare function bindRuntimeAgentDef({ def, state }: {
10
+ def: RuntimeAgentDef;
11
+ state: AgentRuntimeState;
12
+ }, { codex }?: {
13
+ codex?: CodexDefOptions;
14
+ }): RuntimeAgentDef;
15
+ //# sourceMappingURL=runtime-def-binding.d.ts.map
@@ -0,0 +1,19 @@
1
+ import { buildCodexArgs, codexAgentDef } from './defs/codex.js';
2
+ /** Bind model probes and the argument builder to the host transport, capability state and plugin policy.
3
+ * The Codex config reaches only the Codex definition, through its own argument; nothing vendor-specific is
4
+ * added to the neutral build options. Returns a definition copy without mutating the registry. @complexity O(1). */
5
+ export function bindRuntimeAgentDef({ def, state }, { codex } = {}) {
6
+ const fetchModels = def.fetchModels;
7
+ const boundFetchModels = fetchModels
8
+ ? (required, optional = {}) => fetchModels(required, {
9
+ ...optional, ...(state.acpModelProbe ? { acpModelProbe: state.acpModelProbe } : {}),
10
+ }) : undefined;
11
+ // Only the registry's own Codex builder takes the config: a host-supplied definition named `codex` keeps its builder.
12
+ const buildArgs = codex && def.buildArgs === codexAgentDef.buildArgs
13
+ ? (required, optional = {}) => buildCodexArgs(required, { ...optional, codex })
14
+ : def.buildArgs;
15
+ return { ...def, ...(boundFetchModels ? { fetchModels: boundFetchModels } : {}), buildArgs: (required, optional = {}) => buildArgs(required, {
16
+ ...optional, options: { ...optional.options, capabilities: state.capabilities.get(def.id) ?? {} },
17
+ }) };
18
+ }
19
+ //# sourceMappingURL=runtime-def-binding.js.map
@@ -0,0 +1,181 @@
1
+ /** @file One binding of the agent runtime to daemon's `AgentRuntimePort` shape, shared by every host (a product, the
2
+ * `server` preset). It imports nothing from daemon: the result is checked with `satisfies AgentRuntimePort` by the host.
3
+ * The runtime's state, host env and definition policies are closed over here, so a launcher never passes them. */
4
+ import type { AgentLaunchResolution, ModelDiscoveryContext, NativeToolPolicyInput, RunPlanHost, RuntimeAgentDef, RuntimeBuildOptions, RuntimeEnv } from '@jini-ai/core/contracts/agents';
5
+ import { type AttachAcpSessionOptions } from './agent-protocol/acp/session-types.js';
6
+ import { type PiRpcSessionOptions } from './agent-protocol/pi-rpc/session.js';
7
+ import { validateFilesystemLaunch } from './claude-filesystem-policy.js';
8
+ import { planRun } from './native-tool-policy.js';
9
+ import type { NativeAgentRuntime } from './native-runtime.js';
10
+ type StreamSink = (event: Record<string, unknown>) => void;
11
+ type LaunchProbe = {
12
+ agentId: string;
13
+ launchPath: string;
14
+ env: RuntimeEnv;
15
+ };
16
+ type PlanningDef = Parameters<typeof planRun>[0]['def'];
17
+ type AcpRequired = Pick<AttachAcpSessionOptions, 'child' | 'prompt' | 'send'>;
18
+ type PiRequired = Pick<PiRpcSessionOptions, 'child' | 'prompt' | 'send'>;
19
+ /** Bind a native runtime to the launcher's port shape. Every member forwards its arguments unchanged except where a
20
+ * comment above says what the binding adds. @example createAgentRuntimeBindings({ runtime }) satisfies AgentRuntimePort */
21
+ export declare function createAgentRuntimeBindings({ runtime }: {
22
+ runtime: NativeAgentRuntime;
23
+ }, _optional?: Record<string, never>): {
24
+ failures: {
25
+ startupMessage: (required: {
26
+ stage: string;
27
+ error: unknown;
28
+ }, optional?: {
29
+ exactSecrets?: readonly string[];
30
+ notice?: string;
31
+ }) => string;
32
+ };
33
+ sessions: {
34
+ attachAcp: (required: AcpRequired, optional?: Omit<AttachAcpSessionOptions, keyof AcpRequired>) => import("./index.js").AcpSessionController;
35
+ attachPiRpc: (required: PiRequired, optional?: Omit<PiRpcSessionOptions, keyof PiRequired | "gracefulShutdownMs">) => import("./index.js").PiRpcSession;
36
+ };
37
+ streams: {
38
+ claude: (required: {
39
+ onEvent: StreamSink;
40
+ }, optional?: {
41
+ costBasis?: "session" | "run";
42
+ suppressHtmlArtifactsAfterFileWrite?: boolean;
43
+ nowMs?: () => number;
44
+ }) => {
45
+ feed: ({ chunk }: {
46
+ chunk: string;
47
+ }) => void;
48
+ flush: () => void;
49
+ };
50
+ qoder: (required: {
51
+ onEvent: StreamSink;
52
+ }) => {
53
+ feed: ({ chunk }: {
54
+ chunk: unknown;
55
+ }) => void;
56
+ flush: () => void;
57
+ };
58
+ jsonEvents: (required: {
59
+ kind: string;
60
+ onEvent: StreamSink;
61
+ }) => {
62
+ feed: ({ chunk }: {
63
+ chunk: string;
64
+ }) => void;
65
+ flush: () => void;
66
+ };
67
+ };
68
+ defs: {
69
+ get: ({ id }: {
70
+ id: string;
71
+ }) => RuntimeAgentDef | null;
72
+ bind: ({ def }: {
73
+ def: RuntimeAgentDef;
74
+ }) => RuntimeAgentDef;
75
+ capabilities: ({ defId }: {
76
+ defId: string;
77
+ }) => import("@jini-ai/core/contracts/agents").RuntimeCapabilityMap | undefined;
78
+ ensureCapabilities: (required: {
79
+ def: RuntimeAgentDef;
80
+ launchPath: string;
81
+ env: RuntimeEnv;
82
+ }) => Promise<void>;
83
+ };
84
+ launch: {
85
+ resolve: (required: {
86
+ def: RuntimeAgentDef;
87
+ }, optional?: {
88
+ configuredEnv?: Record<string, string>;
89
+ env?: RuntimeEnv;
90
+ }) => AgentLaunchResolution;
91
+ applyEnv: (required: {
92
+ env: RuntimeEnv;
93
+ launch: Pick<AgentLaunchResolution, "childPathPrepend">;
94
+ }, optional?: {
95
+ nodeBinDir?: string;
96
+ appendPathDirs?: string[];
97
+ }) => NodeJS.ProcessEnv;
98
+ toolchainBinDirs: (_required: Record<string, never>, optional?: {
99
+ env?: RuntimeEnv;
100
+ }) => string[];
101
+ hostEnvNames: () => readonly string[];
102
+ planRun: (required: {
103
+ def: PlanningDef;
104
+ policy: NativeToolPolicyInput;
105
+ host?: RunPlanHost;
106
+ }) => import("@jini-ai/core/contracts/agents").RunPlan;
107
+ resolveNativeToolPolicy: (required: {
108
+ def: {
109
+ name?: string;
110
+ fullCliAccessOnly?: boolean;
111
+ };
112
+ policy: NativeToolPolicyInput;
113
+ }) => NativeToolPolicyInput;
114
+ promptArgvBudget: (required: {
115
+ def: RuntimeAgentDef;
116
+ composed: unknown;
117
+ }, optional?: {
118
+ platform?: NodeJS.Platform;
119
+ }) => import("@jini-ai/core/contracts/agents").RuntimePromptBudgetError | null;
120
+ windowsCmdShimBudget: (required: {
121
+ def: RuntimeAgentDef;
122
+ resolvedBin: unknown;
123
+ args: unknown;
124
+ }) => import("@jini-ai/core/contracts/agents").RuntimePromptBudgetError | null;
125
+ windowsDirectExeBudget: (required: {
126
+ def: RuntimeAgentDef;
127
+ resolvedBin: unknown;
128
+ args: unknown;
129
+ }) => import("@jini-ai/core/contracts/agents").RuntimePromptBudgetError | null;
130
+ preparePromptFile: (required: {
131
+ def: RuntimeAgentDef;
132
+ prompt: string;
133
+ label: string;
134
+ }) => Promise<import("@jini-ai/core/contracts/agents").PreparedPromptFile | null>;
135
+ prepareLogFile: (required: {
136
+ def: RuntimeAgentDef;
137
+ label: string;
138
+ }) => Promise<import("@jini-ai/core/contracts/agents").PreparedAgentLogFile | null>;
139
+ };
140
+ filesystem: {
141
+ validateLaunch: (required: Parameters<typeof validateFilesystemLaunch>[0]) => string;
142
+ validateReadOnlyExtraDirs: (required: {
143
+ filesystemRoot: string;
144
+ dirs: readonly string[];
145
+ }, optional?: {
146
+ homeDir?: string;
147
+ }) => string[];
148
+ assertSupport: (required: LaunchProbe) => Promise<boolean | void>;
149
+ createSupportProbe: () => (required: LaunchProbe) => Promise<boolean | void>;
150
+ runtimePaths: (required: {
151
+ launchPath: string;
152
+ }) => readonly string[];
153
+ settings: (required: {
154
+ options: RuntimeBuildOptions;
155
+ }, optional?: {
156
+ platform?: NodeJS.Platform;
157
+ homeDir?: string;
158
+ tempDir?: string;
159
+ uid?: number;
160
+ realpath?: (path: string) => string;
161
+ }) => string;
162
+ };
163
+ models: {
164
+ resolveForLaunch: (required: {
165
+ def: RuntimeAgentDef;
166
+ context: ModelDiscoveryContext;
167
+ effort?: string;
168
+ }, optional?: {
169
+ signal?: AbortSignal;
170
+ }) => Promise<{
171
+ model: string;
172
+ catalog: import("@jini-ai/core/contracts/agents").ModelCatalogSnapshot;
173
+ resolution: import("@jini-ai/core/contracts/agents").DefaultModelResolution;
174
+ }>;
175
+ identityKind: ({ id }: {
176
+ id: string;
177
+ }) => import("@jini-ai/core/contracts/agents").ModelIdentityKind;
178
+ };
179
+ };
180
+ export {};
181
+ //# sourceMappingURL=runtime-port-bindings.d.ts.map
@@ -0,0 +1,95 @@
1
+ import { attachAcpSession } from './agent-protocol/acp/session.js';
2
+ import {} from './agent-protocol/acp/session-types.js';
3
+ import { attachPiRpcSession } from './agent-protocol/pi-rpc/session.js';
4
+ import { claudeFilesystemRuntimePaths, claudeFilesystemSettings, createClaudeFilesystemSupportProbe, validateFilesystemLaunch, validateReadOnlyExtraDirs, } from './claude-filesystem-policy.js';
5
+ import { createClaudeStreamHandler } from './claude-stream.js';
6
+ import { modelIdentityKind } from './core/model-discovery-shared.js';
7
+ import { ensureAgentCapabilities } from './detection.js';
8
+ import { startupFailureMessage } from './diagnostics.js';
9
+ import { userToolchainBinDirs } from './executables.js';
10
+ import { createJsonEventStreamHandler } from './json-event-stream.js';
11
+ import { applyAgentLaunchEnv } from './launch.js';
12
+ import { prepareAgentLogFile } from './log-file.js';
13
+ import { getRuntimeModelDiscoveryDeps } from './model-discovery-adapters.js';
14
+ import { resolveModelForLaunch } from './model-discovery-native.js';
15
+ import { planRun, resolveNativeToolPolicy } from './native-tool-policy.js';
16
+ import { checkPromptArgvBudget, checkWindowsCmdShimCommandLineBudget, checkWindowsDirectExeCommandLineBudget } from './prompt-budget.js';
17
+ import { preparePromptFileForAgent } from './prompt-file.js';
18
+ import { createQoderStreamHandler } from './qoder-stream.js';
19
+ import { bindRuntimeAgentDef } from './runtime-def-binding.js';
20
+ function bindDefs({ runtime }, _optional = {}) {
21
+ const { state, codex } = runtime;
22
+ return {
23
+ get: ({ id }) => runtime.getAgentDef({ id }),
24
+ bind: ({ def }) => bindRuntimeAgentDef({ def, state }, { codex }),
25
+ capabilities: ({ defId }) => state.capabilities.get(defId),
26
+ ensureCapabilities: (required) => ensureAgentCapabilities(required, { state }),
27
+ };
28
+ }
29
+ function bindLaunch({ runtime }, _optional = {}) {
30
+ const { state, hostEnv } = runtime;
31
+ return {
32
+ resolve: (required, optional = {}) => runtime.resolveAgentLaunch(required, optional),
33
+ // The toolchain dirs come from this runtime's state and host env, never from the process defaults.
34
+ applyEnv: (required, optional = {}) => applyAgentLaunchEnv(required, { appendPathDirs: userToolchainBinDirs({}, { state, env: hostEnv }), ...optional }),
35
+ toolchainBinDirs: (_required, optional = {}) => userToolchainBinDirs({}, { env: hostEnv, ...optional, state }),
36
+ hostEnvNames: () => Object.values(state.executable.envNames),
37
+ planRun: (required) => planRun(required),
38
+ resolveNativeToolPolicy: (required) => resolveNativeToolPolicy(required),
39
+ promptArgvBudget: (required, optional = {}) => checkPromptArgvBudget(required, optional),
40
+ windowsCmdShimBudget: (required) => checkWindowsCmdShimCommandLineBudget(required),
41
+ windowsDirectExeBudget: (required) => checkWindowsDirectExeCommandLineBudget(required),
42
+ preparePromptFile: (required) => preparePromptFileForAgent(required),
43
+ prepareLogFile: (required) => prepareAgentLogFile(required),
44
+ };
45
+ }
46
+ /** Claude filesystem policy. One support-probe cache per bound runtime. */
47
+ function bindFilesystem(_required = {}, _optional = {}) {
48
+ const assertFilesystemSupport = createClaudeFilesystemSupportProbe({});
49
+ return {
50
+ validateLaunch: (required) => validateFilesystemLaunch(required),
51
+ validateReadOnlyExtraDirs: (required, optional = {}) => validateReadOnlyExtraDirs(required, optional),
52
+ assertSupport: (required) => assertFilesystemSupport(required),
53
+ createSupportProbe: () => {
54
+ const probe = createClaudeFilesystemSupportProbe({});
55
+ return (required) => probe(required);
56
+ },
57
+ runtimePaths: (required) => claudeFilesystemRuntimePaths(required),
58
+ settings: (required, optional = {}) => claudeFilesystemSettings(required, optional),
59
+ };
60
+ }
61
+ function bindSessionsAndStreams({ runtime }, _optional = {}) {
62
+ const { pi } = runtime;
63
+ // The runtime's Pi shutdown grace always applies (explicit host option, else PI_GRACEFUL_SHUTDOWN_MS, else 5000 ms).
64
+ const piGrace = pi.gracefulShutdownMs === undefined ? {} : { gracefulShutdownMs: pi.gracefulShutdownMs };
65
+ return {
66
+ sessions: {
67
+ attachAcp: (required, optional = {}) => attachAcpSession(required, optional),
68
+ attachPiRpc: (required, optional = {}) => attachPiRpcSession(required, { ...optional, ...piGrace }),
69
+ },
70
+ streams: {
71
+ claude: (required, optional = {}) => createClaudeStreamHandler(required, optional),
72
+ qoder: (required) => createQoderStreamHandler(required),
73
+ jsonEvents: (required) => createJsonEventStreamHandler(required),
74
+ },
75
+ };
76
+ }
77
+ /** Bind a native runtime to the launcher's port shape. Every member forwards its arguments unchanged except where a
78
+ * comment above says what the binding adds. @example createAgentRuntimeBindings({ runtime }) satisfies AgentRuntimePort */
79
+ export function createAgentRuntimeBindings({ runtime }, _optional = {}) {
80
+ const { state } = runtime;
81
+ return {
82
+ defs: bindDefs({ runtime }),
83
+ launch: bindLaunch({ runtime }),
84
+ filesystem: bindFilesystem({}),
85
+ models: {
86
+ resolveForLaunch: (required, optional = {}) => resolveModelForLaunch(required, { ...optional, deps: getRuntimeModelDiscoveryDeps({ state }) }),
87
+ identityKind: ({ id }) => modelIdentityKind({ id }),
88
+ },
89
+ ...bindSessionsAndStreams({ runtime }),
90
+ failures: {
91
+ startupMessage: (required, optional = {}) => startupFailureMessage(required, optional),
92
+ },
93
+ };
94
+ }
95
+ //# sourceMappingURL=runtime-port-bindings.js.map
@@ -1,7 +1,6 @@
1
1
  /** Mutable runtime data belongs to one host. Compatibility functions use defaultRuntimeState. */
2
- import type { AcpModelProbe } from './acp-model-probe.js';
3
- import type { RuntimeAgentDef, RuntimeCapabilityMap, RuntimeModelOption, DetectedAgent } from './types.js';
4
- import type { ModelCacheEntry, ModelDiscoveryDeps } from './model-discovery-types.js';
2
+ import type { AcpModelProbe, RuntimeCapabilityMap, RuntimeModelOption, ModelCacheEntry, ModelDiscoveryDeps } from '@jini-ai/core/contracts/agents';
3
+ import type { DetectedAgent } from './types.js';
5
4
  export interface AgentRuntimeState {
6
5
  /** One in-flight or settled detection per launch scope; catalog expiry refreshes only models. */
7
6
  readonly detections: Map<string, Promise<DetectedAgent>>;
@@ -35,12 +34,4 @@ export interface AgentRuntimeState {
35
34
  * Returns empty owned maps; no I/O. @complexity O(1) initialization; retained data grows with probes. */
36
35
  export declare function createAgentRuntimeState(_required: Record<string, never>, _optional?: Record<string, never>): AgentRuntimeState;
37
36
  export declare const defaultRuntimeState: AgentRuntimeState;
38
- /** Bind model probes and the argument builder to the host transport, capability state and plugin policy.
39
- * Returns a definition copy without mutating the registry. @complexity O(1). */
40
- export declare function bindRuntimeAgentDef({ def, state }: {
41
- def: RuntimeAgentDef;
42
- state: AgentRuntimeState;
43
- }, { codexDisablePlugins }?: {
44
- codexDisablePlugins?: boolean;
45
- }): RuntimeAgentDef;
46
37
  //# sourceMappingURL=runtime-state.d.ts.map