@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
package/dist/models.d.ts CHANGED
@@ -3,7 +3,8 @@ import { type AgentRuntimeState } from './runtime-state.js';
3
3
  * @module models
4
4
  * Model-option defaults, a per-agent last-surfaced live-model cache and model-id sanitization.
5
5
  */
6
- import type { DetectedAgent, RuntimeAgentDef, RuntimeModelOption } from './types.js';
6
+ import type { DetectedAgent } from './types.js';
7
+ import type { RuntimeAgentDef, RuntimeModelOption } from '@jini-ai/core/contracts/agents';
7
8
  type SelectableAgent = Pick<DetectedAgent, 'id' | 'available' | 'models' | 'modelsSource' | 'reasoningOptions' | 'reasoningInModelId' | 'authStatus' | 'supportsConcreteModelSelection' | 'defaultModelResolution'>;
8
9
  /** Validate an explicit selection against the same discovered inventory the picker displays.
9
10
  * Empty model/effort means the runtime default. Refusals include the current choices rather
@@ -33,7 +34,7 @@ export declare function getRememberedLiveModels({ agentId }: {
33
34
  export declare function preferFreshLiveModels({ freshModels, rememberedModels }: {
34
35
  freshModels: RuntimeModelOption[];
35
36
  rememberedModels: RuntimeModelOption[];
36
- }): RuntimeModelOption[];
37
+ }, _optional?: Record<string, never>): RuntimeModelOption[];
37
38
  export declare function isKnownModel({ def, modelId }: {
38
39
  def: RuntimeAgentDef;
39
40
  modelId: string | null | undefined;
@@ -51,6 +52,6 @@ export declare function resolveModelForAgent({ def, resolved }: {
51
52
  }): string | null;
52
53
  export declare function sanitizeCustomModel({ id }: {
53
54
  id: string | null | undefined;
54
- }): string | null;
55
+ }, _optional?: Record<string, never>): string | null;
55
56
  export {};
56
57
  //# sourceMappingURL=models.d.ts.map
package/dist/models.js CHANGED
@@ -52,7 +52,7 @@ export function getRememberedLiveModels({ agentId }, { scope, state = defaultRun
52
52
  const ids = state.liveModelOrder.get(liveModelCacheKey(agentId, scope)) ?? [];
53
53
  return ids.map((id) => ({ id, label: id }));
54
54
  }
55
- export function preferFreshLiveModels({ freshModels, rememberedModels }) {
55
+ export function preferFreshLiveModels({ freshModels, rememberedModels }, _optional = {}) {
56
56
  return freshModels.length > 0 ? freshModels : rememberedModels;
57
57
  }
58
58
  export function isKnownModel({ def, modelId }, { scope, state = defaultRuntimeState } = {}) {
@@ -111,7 +111,7 @@ export function resolveModelForAgent({ def, resolved }, { env = process.env, liv
111
111
  // as a child-process arg — not a shell string — so injection isn't a
112
112
  // concern, but we still reject anything that could be misread as a flag
113
113
  // by a downstream CLI or that contains whitespace / control chars.
114
- export function sanitizeCustomModel({ id }) {
114
+ export function sanitizeCustomModel({ id }, _optional = {}) {
115
115
  if (typeof id !== 'string')
116
116
  return null;
117
117
  const trimmed = id.trim();
@@ -0,0 +1,47 @@
1
+ /** Generic native-capability snapshots. Hosts own grant gates, persistence and migration. */
2
+ export interface NativeAgentPermissions<K extends string> {
3
+ enabled?: boolean;
4
+ capabilities?: Partial<Record<K, boolean>>;
5
+ }
6
+ export interface NativePermissionSet<K extends string> {
7
+ enabled: boolean;
8
+ capabilities: Record<K, boolean>;
9
+ byAgent?: Record<string, NativeAgentPermissions<K>>;
10
+ }
11
+ /** A malformed permission snapshot; the host supplies the safe refusal text. */
12
+ export declare class InvalidNativePermissionsError extends Error {
13
+ constructor({ message }: {
14
+ message: string;
15
+ });
16
+ }
17
+ /** The master supplies every default; explicit capability choices remain independent.
18
+ * Returns a fresh snapshot, including independent copies of per-agent choices, without effects.
19
+ * @complexity O(k + a + p) time/space for k keys, a agents and p per-agent capability entries.
20
+ */
21
+ export declare function fillNativePermissions<K extends string>(required: {
22
+ capabilityKeys: readonly K[];
23
+ enabled: boolean;
24
+ capabilities?: Partial<Record<K, boolean>>;
25
+ byAgent?: Record<string, NativeAgentPermissions<K>>;
26
+ }, _optional?: Record<string, never>): NativePermissionSet<K>;
27
+ /** Validate every known capability and the master flag before filling an untrusted snapshot.
28
+ * Extra top-level capability keys are accepted; per-agent keys must be known.
29
+ * @throws InvalidNativePermissionsError with only the host message, never a snapshot value.
30
+ * @complexity O(k + a + p*k) time, O(k + a + p) space for k keys, a agents and p override entries.
31
+ */
32
+ export declare function validateNativePermissionSnapshot<K extends string>(required: {
33
+ value: unknown;
34
+ capabilityKeys: readonly K[];
35
+ }, optional?: {
36
+ message?: string;
37
+ }): NativePermissionSet<K>;
38
+ /** Project one agent's choices after the host's grant gate; the master remains a default.
39
+ * Returns a fresh snapshot with merged capabilities and no mutation or I/O.
40
+ * @complexity O(k + a + p) time/space for k keys, a agents and p per-agent capability entries.
41
+ */
42
+ export declare function projectNativePermissions<K extends string>(required: {
43
+ settings: NativePermissionSet<K>;
44
+ capabilityKeys: readonly K[];
45
+ agentId?: string;
46
+ }, _optional?: Record<string, never>): NativePermissionSet<K>;
47
+ //# sourceMappingURL=native-permissions.d.ts.map
@@ -0,0 +1,80 @@
1
+ /** A malformed permission snapshot; the host supplies the safe refusal text. */
2
+ export class InvalidNativePermissionsError extends Error {
3
+ constructor({ message }) {
4
+ super(message);
5
+ this.name = 'InvalidNativePermissionsError';
6
+ }
7
+ }
8
+ /** The master supplies every default; explicit capability choices remain independent.
9
+ * Returns a fresh snapshot, including independent copies of per-agent choices, without effects.
10
+ * @complexity O(k + a + p) time/space for k keys, a agents and p per-agent capability entries.
11
+ */
12
+ export function fillNativePermissions(required, _optional = {}) {
13
+ const { capabilityKeys, enabled, capabilities, byAgent } = required;
14
+ return {
15
+ enabled,
16
+ capabilities: Object.fromEntries(capabilityKeys.map(key => [key, capabilities?.[key] ?? enabled])),
17
+ ...(byAgent ? { byAgent: copyAgentPermissions({ byAgent }) } : {}),
18
+ };
19
+ }
20
+ function copyAgentPermissions({ byAgent }) {
21
+ return Object.fromEntries(Object.entries(byAgent).map(([id, entry]) => [id, {
22
+ ...entry,
23
+ ...(entry.capabilities ? { capabilities: { ...entry.capabilities } } : {}),
24
+ }]));
25
+ }
26
+ function isRecord(value) {
27
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
28
+ }
29
+ /** Reject malformed per-agent overrides before any grant can reach a launch. */
30
+ function validateAgentPermissions({ value, capabilityKeys, message }) {
31
+ if (value === undefined)
32
+ return undefined;
33
+ if (!isRecord(value))
34
+ throw new InvalidNativePermissionsError({ message });
35
+ for (const entry of Object.values(value))
36
+ validateAgentPermission({ value: entry, capabilityKeys, message });
37
+ return value;
38
+ }
39
+ function validateAgentPermission({ value, capabilityKeys, message }) {
40
+ if (!isRecord(value))
41
+ throw new InvalidNativePermissionsError({ message });
42
+ if (value.enabled !== undefined && typeof value.enabled !== 'boolean')
43
+ throw new InvalidNativePermissionsError({ message });
44
+ validateAgentCapabilities({ value: value.capabilities, capabilityKeys, message });
45
+ }
46
+ function validateAgentCapabilities({ value, capabilityKeys, message }) {
47
+ if (value === undefined)
48
+ return;
49
+ if (!isRecord(value) || Object.entries(value).some(([key, entry]) => typeof entry !== 'boolean' || !capabilityKeys.some(known => known === key)))
50
+ throw new InvalidNativePermissionsError({ message });
51
+ }
52
+ /** Validate every known capability and the master flag before filling an untrusted snapshot.
53
+ * Extra top-level capability keys are accepted; per-agent keys must be known.
54
+ * @throws InvalidNativePermissionsError with only the host message, never a snapshot value.
55
+ * @complexity O(k + a + p*k) time, O(k + a + p) space for k keys, a agents and p override entries.
56
+ */
57
+ export function validateNativePermissionSnapshot(required, optional = {}) {
58
+ const { value, capabilityKeys } = required;
59
+ const message = optional.message ?? 'Invalid native permissions';
60
+ if (!isRecord(value))
61
+ throw new InvalidNativePermissionsError({ message });
62
+ const { enabled, capabilities, byAgent } = value;
63
+ if (typeof enabled !== 'boolean' || !isRecord(capabilities) ||
64
+ !capabilityKeys.every(key => typeof capabilities[key] === 'boolean'))
65
+ throw new InvalidNativePermissionsError({ message });
66
+ const agents = validateAgentPermissions({ value: byAgent, capabilityKeys, message });
67
+ return fillNativePermissions({ capabilityKeys, enabled, capabilities: capabilities,
68
+ ...(agents ? { byAgent: agents } : {}) });
69
+ }
70
+ /** Project one agent's choices after the host's grant gate; the master remains a default.
71
+ * Returns a fresh snapshot with merged capabilities and no mutation or I/O.
72
+ * @complexity O(k + a + p) time/space for k keys, a agents and p per-agent capability entries.
73
+ */
74
+ export function projectNativePermissions(required, _optional = {}) {
75
+ const { settings, capabilityKeys, agentId } = required;
76
+ const override = agentId ? settings.byAgent?.[agentId] : undefined;
77
+ return fillNativePermissions({ ...settings, capabilityKeys, enabled: override?.enabled ?? settings.enabled,
78
+ capabilities: { ...settings.capabilities, ...override?.capabilities } });
79
+ }
80
+ //# sourceMappingURL=native-permissions.js.map
@@ -1,15 +1,18 @@
1
- /** Native host composition: one state and transport, with environment policies resolved once. */
2
- import { type AcpModelProbe } from './acp-model-probe.js';
1
+ import { type AcpModelProbe } from '@jini-ai/core/contracts/agents';
3
2
  import { detectAgents, probeAgentModels } from './detection.js';
4
3
  import { resolveAgentLaunch } from './launch.js';
5
4
  import { getAgentDef } from './registry.js';
6
5
  import { type AgentRuntimeState } from './runtime-state.js';
7
- import type { RuntimeEnv } from './types.js';
6
+ import { type CodexDefOptions } from './defs/codex/options.js';
7
+ import { type PiDefOptions } from './defs/pi/options.js';
8
+ import type { RuntimeEnv } from '@jini-ai/core/contracts/agents';
8
9
  export interface NativeAgentRuntime {
9
10
  readonly state: AgentRuntimeState;
10
11
  readonly hostEnv: RuntimeEnv;
11
- readonly codexDisablePlugins: boolean;
12
- readonly piGracefulShutdownMs: number;
12
+ /** Codex definition config; the runtime-port binding closes over it, hosts never read it. */
13
+ readonly codex: CodexDefOptions;
14
+ /** Pi definition config; the runtime-port binding's PI session member closes over it. */
15
+ readonly pi: PiDefOptions;
13
16
  readonly detectAgents: typeof detectAgents;
14
17
  readonly probeAgentModels: typeof probeAgentModels;
15
18
  readonly resolveAgentLaunch: typeof resolveAgentLaunch;
@@ -26,10 +29,10 @@ export interface NativeAgentRuntime {
26
29
  */
27
30
  export declare function createNativeAgentRuntime({ env }: {
28
31
  env: RuntimeEnv;
29
- }, { state, acpModelProbe, codexDisablePlugins, piGracefulShutdownMs, }?: {
32
+ }, { state, acpModelProbe, codex, pi, }?: {
30
33
  state?: AgentRuntimeState;
31
34
  acpModelProbe?: AcpModelProbe;
32
- codexDisablePlugins?: boolean;
33
- piGracefulShutdownMs?: number;
35
+ codex?: CodexDefOptions;
36
+ pi?: PiDefOptions;
34
37
  }): NativeAgentRuntime;
35
38
  //# sourceMappingURL=native-runtime.d.ts.map
@@ -1,10 +1,14 @@
1
1
  /** Native host composition: one state and transport, with environment policies resolved once. */
2
2
  import { nativeAcpModelProbe } from './acp-model-probe.js';
3
+ import {} from '@jini-ai/core/contracts/agents';
3
4
  import { detectAgents, probeAgentModels } from './detection.js';
4
5
  import { resolveAgentLaunch } from './launch.js';
5
6
  import { getAgentDef } from './registry.js';
6
7
  import { createAcpDiscoveryAdapter } from './model-discovery-adapters.js';
7
- import { bindRuntimeAgentDef, createAgentRuntimeState } from './runtime-state.js';
8
+ import { createAgentRuntimeState } from './runtime-state.js';
9
+ import { bindRuntimeAgentDef } from './runtime-def-binding.js';
10
+ import { codexDefOptionsFromEnv } from './defs/codex/options.js';
11
+ import { piDefOptionsFromEnv } from './defs/pi/options.js';
8
12
  /** Bind existing runtime owners to a host; copies env without performing I/O.
9
13
  * @param required - The host's selected environment, used instead of ambient process configuration.
10
14
  * @param optional - An existing state, ACP transport, or explicit policies overriding env defaults.
@@ -12,7 +16,7 @@ import { bindRuntimeAgentDef, createAgentRuntimeState } from './runtime-state.js
12
16
  * Discovery after disposal rejects with `InvalidStateError`; native probe failures retain their existing outcomes.
13
17
  * @example const runtime = createNativeAgentRuntime({ env: process.env });
14
18
  */
15
- export function createNativeAgentRuntime({ env }, { state = createAgentRuntimeState({}), acpModelProbe = state.acpModelProbe ?? nativeAcpModelProbe, codexDisablePlugins = env.CODEX_DISABLE_PLUGINS === '1', piGracefulShutdownMs = Number(env.PI_GRACEFUL_SHUTDOWN_MS) || 5000, } = {}) {
19
+ export function createNativeAgentRuntime({ env }, { state = createAgentRuntimeState({}), acpModelProbe = state.acpModelProbe ?? nativeAcpModelProbe, codex = codexDefOptionsFromEnv({ env }), pi = piDefOptionsFromEnv({ env }), } = {}) {
16
20
  const hostEnv = { ...env };
17
21
  if (state.discoveryDeps && state.acpModelProbe !== acpModelProbe) {
18
22
  state.discoveryDeps = { ...state.discoveryDeps, acp: createAcpDiscoveryAdapter({ probe: acpModelProbe }) };
@@ -30,13 +34,13 @@ export function createNativeAgentRuntime({ env }, { state = createAgentRuntimeSt
30
34
  return result;
31
35
  }
32
36
  return {
33
- state, hostEnv, codexDisablePlugins, piGracefulShutdownMs,
37
+ state, hostEnv, codex, pi,
34
38
  detectAgents: (required, optional = {}) => track(() => detectAgents(required, { ...optional, state, env: hostEnv })),
35
39
  probeAgentModels: (required, optional = {}) => track(() => probeAgentModels(required, { ...optional, state, env: hostEnv })),
36
40
  resolveAgentLaunch: (required, optional = {}) => resolveAgentLaunch(required, { ...optional, state, env: hostEnv }),
37
41
  getAgentDef: (required, _optional = {}) => {
38
42
  const def = getAgentDef(required);
39
- return def ? bindRuntimeAgentDef({ def, state }, { codexDisablePlugins }) : def;
43
+ return def ? bindRuntimeAgentDef({ def, state }, { codex }) : def;
40
44
  },
41
45
  dispose(_required, _optional = {}) {
42
46
  disposal ??= (async () => {
@@ -1,16 +1,6 @@
1
+ import type { NativeCapabilities, NativeToolPolicyInput, RunPlan, RunPlanHost } from '@jini-ai/core/contracts/agents';
1
2
  /** Native fallback tools, independent of a host's catalog and identity policy. */
2
3
  export declare const NATIVE_FALLBACK_TOOLS: readonly string[];
3
- /** Independent native CLI dimensions; hosts own identity, defaults and persistence. */
4
- export interface NativeCapabilities {
5
- shell: boolean;
6
- fileWrite: boolean;
7
- userMcp: boolean;
8
- subagents: boolean;
9
- userSettings: boolean;
10
- web: boolean;
11
- workflows: boolean;
12
- loginEnvironment: boolean;
13
- }
14
4
  /** Append explicit capability denies AFTER resolving the legacy all-or-nothing grant.
15
5
  * An unrelated ON permission must never erase an individual OFF. Pure, bounded tool list.
16
6
  */
@@ -26,13 +16,6 @@ export declare function resolveNativeToolDenies(required: {
26
16
  enabled: boolean | undefined;
27
17
  denied?: readonly string[];
28
18
  }, _optional?: Record<string, never>): readonly string[];
29
- /** Current run limits, shared by launch enforcement and browser preflight. */
30
- export interface NativeToolPolicyInput {
31
- nativeToolAccess?: boolean;
32
- nativeCapabilities?: Partial<NativeCapabilities>;
33
- cliParity?: boolean;
34
- permissionMode?: 'bypass' | 'restricted';
35
- }
36
19
  /** Resolve without granting authority: runtimes requiring full access need explicit host consent.
37
20
  * Pure O(1); a definition is never an authorization decision.
38
21
  */
@@ -54,22 +37,6 @@ export declare function assessNativeToolPolicy({ def, policy }: {
54
37
  };
55
38
  policy: NativeToolPolicyInput;
56
39
  }, _options?: Record<string, never>): string | null;
57
- /** Consent keys are the existing master switch and independently stored native capabilities. */
58
- export type RunConsentKey = 'enabled' | keyof NativeCapabilities;
59
- export type RunPlan = {
60
- verdict: 'RUN';
61
- loadsOwn: boolean;
62
- bridged: boolean;
63
- } | {
64
- verdict: 'ASK';
65
- keys: RunConsentKey[];
66
- why?: 'isolation_blocked';
67
- } | {
68
- verdict: 'SETUP';
69
- reason: 'not_installed' | 'not_signed_in' | 'host_locked';
70
- keys?: RunConsentKey[];
71
- lock?: string;
72
- };
73
40
  type PlanningDef = {
74
41
  name: string;
75
42
  supportsNativeToolAccess?: boolean;
@@ -79,12 +46,6 @@ type PlanningDef = {
79
46
  externalMcpInjection?: string;
80
47
  mcpHttp?: boolean;
81
48
  };
82
- export interface RunPlanHost {
83
- installed?: boolean;
84
- auth?: 'ok' | 'missing' | 'unknown';
85
- locked?: string;
86
- isolationBlocked?: boolean;
87
- }
88
49
  /** Pure launch decision, before credentials, config repair or spawn. Unknown auth proceeds;
89
50
  * unknown isolation requires consent. Fixed capability work, no filesystem or credential reads.
90
51
  */
@@ -1,4 +1,4 @@
1
- import { type AgentServiceFailureCode } from './auth.js';
1
+ import { type AgentServiceFailureCode } from '@jini-ai/core/contracts/agents';
2
2
  export interface OpenCodeServiceFailure {
3
3
  code: AgentServiceFailureCode;
4
4
  message: string;
@@ -6,7 +6,7 @@ export interface OpenCodeServiceFailure {
6
6
  }
7
7
  export declare function resolveOpenCodeLogDir({ env }: {
8
8
  env: Record<string, string | undefined>;
9
- }): string | null;
9
+ }, _optional?: Record<string, never>): string | null;
10
10
  export declare function readLatestOpenCodeLogTail({ logDir }: {
11
11
  logDir: string;
12
12
  }, options?: {
@@ -15,7 +15,7 @@ export declare function readLatestOpenCodeLogTail({ logDir }: {
15
15
  }): string | null;
16
16
  export declare function extractOpenCodeServiceFailure({ logTail }: {
17
17
  logTail: string;
18
- }): OpenCodeServiceFailure | null;
18
+ }, _optional?: Record<string, never>): OpenCodeServiceFailure | null;
19
19
  export declare function readOpenCodeServiceFailure({ env }: {
20
20
  env: Record<string, string | undefined>;
21
21
  }, options?: {
@@ -13,11 +13,12 @@
13
13
  import { readdirSync, readFileSync, statSync } from 'node:fs';
14
14
  import path from 'node:path';
15
15
  import { classifyAgentServiceFailure } from './auth.js';
16
+ import {} from '@jini-ai/core/contracts/agents';
16
17
  // OpenCode resolves its data dir as `$XDG_DATA_HOME/opencode` (when set) or
17
18
  // `$HOME/.local/share/opencode`, with session logs under `log/`. Mirror that
18
19
  // so we read the same files the spawned CLI wrote. Null when neither var is
19
20
  // set (we have no basis to guess a path).
20
- export function resolveOpenCodeLogDir({ env }) {
21
+ export function resolveOpenCodeLogDir({ env }, _optional = {}) {
21
22
  const xdg = typeof env.XDG_DATA_HOME === 'string' ? env.XDG_DATA_HOME.trim() : '';
22
23
  const home = typeof env.HOME === 'string' ? env.HOME.trim() : '';
23
24
  const base = xdg || (home ? path.join(home, '.local', 'share') : '');
@@ -150,14 +151,15 @@ function findLatestLlmErrorLine({ lines }) {
150
151
  }
151
152
  return null;
152
153
  }
153
- export function extractOpenCodeServiceFailure({ logTail }) {
154
+ function statusCodeFromMatch(match) { return match ? Number(match[1]) : null; }
155
+ export function extractOpenCodeServiceFailure({ logTail }, _optional = {}) {
154
156
  if (!logTail || !logTail.trim())
155
157
  return null;
156
158
  const line = findLatestLlmErrorLine({ lines: logTail.split(/\r?\n/) });
157
159
  if (!line)
158
160
  return null;
159
161
  const statusMatch = /"statusCode":\s*(\d{3})/.exec(line);
160
- const statusCode = statusMatch ? Number(statusMatch[1]) : null;
162
+ const statusCode = statusCodeFromMatch(statusMatch);
161
163
  const message = pickServiceErrorMessage(line);
162
164
  const statusDerived = statusCode != null ? codeFromStatus(statusCode) : null;
163
165
  const code = statusDerived ?? (message ? classifyAgentServiceFailure({ text: message }) : null);
package/dist/paths.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export declare function expandConfiguredEnv({ configuredEnv }: {
2
2
  configuredEnv: unknown;
3
- }): Record<string, string>;
3
+ }, _optional?: Record<string, never>): Record<string, string>;
4
4
  export declare function expandHomePath({ value }: {
5
5
  value: string;
6
6
  }, { home }?: {
package/dist/paths.js CHANGED
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import path from 'node:path';
6
6
  import { homedir } from 'node:os';
7
- export function expandConfiguredEnv({ configuredEnv }) {
7
+ export function expandConfiguredEnv({ configuredEnv }, _optional = {}) {
8
8
  const out = {};
9
9
  if (!configuredEnv || typeof configuredEnv !== 'object')
10
10
  return out;
@@ -2,8 +2,18 @@
2
2
  * @module pi-models
3
3
  * Parse the pi --list-models whitespace table into model options, independently of the stdio transport.
4
4
  */
5
- import type { RuntimeModelOption } from './types.js';
5
+ import type { RuntimeModelOption } from '@jini-ai/core/contracts/agents';
6
+ /**
7
+ * Parses the tabular stdout of `pi --list-models` into an array of model options.
8
+ * The first entry is always the `default` sentinel ("Default (CLI config)").
9
+ * Provider/model pairs are de-duplicated; the header line is skipped.
10
+ * Returns `null` when the output is empty or contains no parseable rows beyond
11
+ * the header.
12
+ *
13
+ * @param stdout - Raw stdout captured from `pi --list-models`, as a string or Buffer.
14
+ * @returns Parsed model array (at least 2 entries), or `null` when nothing is found.
15
+ */
6
16
  export declare function parsePiModels({ stdout }: {
7
17
  stdout: unknown;
8
- }): RuntimeModelOption[] | null;
18
+ }, _optional?: Record<string, never>): RuntimeModelOption[] | null;
9
19
  //# sourceMappingURL=pi-models.d.ts.map
package/dist/pi-models.js CHANGED
@@ -1,4 +1,14 @@
1
- export function parsePiModels({ stdout }) {
1
+ /**
2
+ * Parses the tabular stdout of `pi --list-models` into an array of model options.
3
+ * The first entry is always the `default` sentinel ("Default (CLI config)").
4
+ * Provider/model pairs are de-duplicated; the header line is skipped.
5
+ * Returns `null` when the output is empty or contains no parseable rows beyond
6
+ * the header.
7
+ *
8
+ * @param stdout - Raw stdout captured from `pi --list-models`, as a string or Buffer.
9
+ * @returns Parsed model array (at least 2 entries), or `null` when nothing is found.
10
+ */
11
+ export function parsePiModels({ stdout }, _optional = {}) {
2
12
  const lines = String(stdout || '')
3
13
  .split('\n')
4
14
  .map((l) => l.trim())
@@ -4,43 +4,7 @@
4
4
  * The engine composes a base prompt and generic RunContextSelection, then calls this port rather
5
5
  * than depending on a product's design/annotation/workspace model.
6
6
  */
7
- /** A single item in the run's attached/selected workspace context. `kind` is host-defined — the engine treats it as an opaque string. */
8
- export interface WorkspaceContextItem {
9
- id: string;
10
- kind: string;
11
- label: string;
12
- }
13
- export interface RunContextSelection {
14
- items: WorkspaceContextItem[];
15
- }
16
- export interface PromptAugmenter {
17
- /**
18
- * Which workspace-context `kind` strings this consumer recognizes (OD:
19
- * design-system, design-files, live-artifact, …). The engine itself only
20
- * knows generic kinds: file, folder, browser, terminal, project,
21
- * local-code.
22
- */
23
- contextKinds(): readonly string[];
24
- /**
25
- * Inject product context blocks (design-system selection, skills, brand,
26
- * …) into the composed user request. The engine passes the base prompt +
27
- * selection; the adapter returns the augmented text.
28
- */
29
- augmentUserRequest(input: {
30
- basePrompt: string;
31
- selection: RunContextSelection;
32
- agentId: string;
33
- hasPriorAssistantTurn: boolean;
34
- }): Promise<string> | string;
35
- /**
36
- * Optional system-prompt overlay. Product-specific discovery /
37
- * question-form protocols live here, not in the engine.
38
- */
39
- systemOverlay?(input: {
40
- agentId: string;
41
- turnIndex: number;
42
- }): string | null;
43
- }
7
+ import type { PromptAugmenter } from '@jini-ai/core/contracts/agents';
44
8
  /** Passes the base prompt through unchanged and adds no system overlay. */
45
9
  export declare const noopPromptAugmenter: PromptAugmenter;
46
10
  //# sourceMappingURL=prompt-augmenter.d.ts.map
@@ -1,9 +1,3 @@
1
- /**
2
- * @module prompt-augmenter
3
- * Product context, artifact conventions, research contracts and system overlays are host-owned.
4
- * The engine composes a base prompt and generic RunContextSelection, then calls this port rather
5
- * than depending on a product's design/annotation/workspace model.
6
- */
7
1
  /** Passes the base prompt through unchanged and adds no system overlay. */
8
2
  export const noopPromptAugmenter = {
9
3
  contextKinds: () => ['file', 'folder', 'browser', 'terminal', 'project', 'local-code'],
@@ -13,7 +13,7 @@
13
13
  * message doesn't assume a design-system-shaped host. Mechanics (byte
14
14
  * budgets, Windows quote-doubling math) are unchanged. See `archived provenance ledger`.
15
15
  */
16
- import type { RuntimeAgentDef, RuntimePromptBudgetError } from './types.js';
16
+ import type { RuntimeAgentDef, RuntimePromptBudgetError } from '@jini-ai/core/contracts/agents';
17
17
  export declare function checkPromptArgvBudget({ def, composed }: {
18
18
  def: RuntimeAgentDef | null | undefined;
19
19
  composed: unknown;
@@ -24,10 +24,10 @@ export declare function checkWindowsCmdShimCommandLineBudget({ def, resolvedBin,
24
24
  def: RuntimeAgentDef | null | undefined;
25
25
  resolvedBin: unknown;
26
26
  args: unknown;
27
- }): RuntimePromptBudgetError | null;
27
+ }, _optional?: Record<string, never>): RuntimePromptBudgetError | null;
28
28
  export declare function checkWindowsDirectExeCommandLineBudget({ def, resolvedBin, args }: {
29
29
  def: RuntimeAgentDef | null | undefined;
30
30
  resolvedBin: unknown;
31
31
  args: unknown;
32
- }): RuntimePromptBudgetError | null;
32
+ }, _optional?: Record<string, never>): RuntimePromptBudgetError | null;
33
33
  //# sourceMappingURL=prompt-budget.d.ts.map
@@ -124,7 +124,7 @@ const WINDOWS_CREATE_PROCESS_HEADROOM = 256;
124
124
  // Pure: takes `resolvedBin` explicitly so a test on macOS can pass a fake
125
125
  // `C:\\…\\deepseek.cmd` path and exercise the same math the daemon would
126
126
  // run on Windows.
127
- export function checkWindowsCmdShimCommandLineBudget({ def, resolvedBin, args }) {
127
+ export function checkWindowsCmdShimCommandLineBudget({ def, resolvedBin, args }, _optional = {}) {
128
128
  if (!def || typeof def.maxPromptArgBytes !== 'number')
129
129
  return null;
130
130
  if (typeof resolvedBin !== 'string' || !/\.(bat|cmd)$/i.test(resolvedBin))
@@ -192,7 +192,7 @@ function looksLikeWindowsPath(p) {
192
192
  // pass a fake `C:\…\deepseek.exe` and exercise the same math the daemon
193
193
  // would run on Windows. The libuv quoting math lives in
194
194
  // `quoteForWindowsDirectExe` above.
195
- export function checkWindowsDirectExeCommandLineBudget({ def, resolvedBin, args }) {
195
+ export function checkWindowsDirectExeCommandLineBudget({ def, resolvedBin, args }, _optional = {}) {
196
196
  if (!def || typeof def.maxPromptArgBytes !== 'number')
197
197
  return null;
198
198
  if (typeof resolvedBin !== 'string' || resolvedBin.length === 0)
@@ -1,11 +1,7 @@
1
- import type { RuntimeAgentDef } from './types.js';
2
- export type PreparedPromptFile = {
3
- path: string;
4
- cleanup: () => Promise<void>;
5
- };
1
+ import type { PreparedPromptFile, RuntimeAgentDef } from '@jini-ai/core/contracts/agents';
6
2
  export declare function preparePromptFileForAgent({ def, prompt, label }: {
7
3
  def: RuntimeAgentDef | null | undefined;
8
4
  prompt: string;
9
5
  label: string;
10
- }): Promise<PreparedPromptFile | null>;
6
+ }, _optional?: Record<string, never>): Promise<PreparedPromptFile | null>;
11
7
  //# sourceMappingURL=prompt-file.d.ts.map
@@ -10,7 +10,7 @@
10
10
  import { promises as fs } from 'node:fs';
11
11
  import os from 'node:os';
12
12
  import path from 'node:path';
13
- export async function preparePromptFileForAgent({ def, prompt, label }) {
13
+ export async function preparePromptFileForAgent({ def, prompt, label }, _optional = {}) {
14
14
  if (!def?.promptViaFile)
15
15
  return null;
16
16
  const safeLabel = label.replace(/[^a-zA-Z0-9_.-]/g, '-').slice(0, 80) || 'prompt';
@@ -31,7 +31,7 @@ export declare const AIHUBMIX_DEFAULT_BASE_URL = "https://aihubmix.com/v1";
31
31
  */
32
32
  export declare function aihubmixHeaders({ apiKey }: {
33
33
  apiKey: string;
34
- }): Record<string, string>;
34
+ }, _optional?: Record<string, never>): Record<string, string>;
35
35
  /**
36
36
  * The APP-Code attribution header on its own (no auth). For the Anthropic /
37
37
  * Gemini routes, which carry their own auth header (`x-api-key` /
@@ -46,7 +46,7 @@ export declare function aihubmixAppCodeHeader(): Record<string, string>;
46
46
  export type AIHubMixProtocol = 'openai' | 'anthropic' | 'gemini';
47
47
  export declare function classifyAIHubMixModel({ model }: {
48
48
  model: string;
49
- }): AIHubMixProtocol;
49
+ }, _optional?: Record<string, never>): AIHubMixProtocol;
50
50
  /**
51
51
  * Origin of the configured AIHubMix base URL — the three protocol clients all
52
52
  * derive their endpoint from it:
@@ -56,12 +56,12 @@ export declare function classifyAIHubMixModel({ model }: {
56
56
  */
57
57
  export declare function aihubmixOriginFromBase({ baseUrl }: {
58
58
  baseUrl: string;
59
- }): string;
59
+ }, _optional?: Record<string, never>): string;
60
60
  /** Gemini-native generateContent endpoint for an AIHubMix image model. */
61
61
  export declare function aihubmixGeminiImageUrl({ baseUrl, wireModel }: {
62
62
  baseUrl: string;
63
63
  wireModel: string;
64
- }): string;
64
+ }, _optional?: Record<string, never>): string;
65
65
  export interface AIHubMixGeminiImageRequest {
66
66
  baseUrl: string;
67
67
  apiKey: string;
@@ -88,19 +88,19 @@ export declare function aihubmixGeminiImageBytes({ req, doFetch }: {
88
88
  url: string;
89
89
  init: RequestInit;
90
90
  }) => Promise<Response>;
91
- }): Promise<Buffer>;
91
+ }, _optional?: Record<string, never>): Promise<Buffer>;
92
92
  export declare function aihubmixWireModel({ catalogId }: {
93
93
  catalogId: string;
94
- }): string;
94
+ }, _optional?: Record<string, never>): string;
95
95
  export declare function aihubmixVideoSeconds({ wireModel, requested }: {
96
96
  wireModel: string;
97
97
  requested: number;
98
- }): string;
98
+ }, _optional?: Record<string, never>): string;
99
99
  export type AIHubMixCatalogType = 'llm' | 'image_generation' | 'tts' | 'video';
100
100
  export declare function aihubmixCatalogUrl({ baseUrl, type }: {
101
101
  baseUrl: string;
102
102
  type: AIHubMixCatalogType;
103
- }): string;
103
+ }, _optional?: Record<string, never>): string;
104
104
  export interface AIHubMixCatalogModel {
105
105
  id: string;
106
106
  label: string;