@myagentroam/agent 0.11.33 → 0.11.35

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 (862) hide show
  1. package/dist/cli/catalog-file.d.ts +78 -0
  2. package/dist/cli/catalog-file.js +102 -0
  3. package/dist/cli/codex-auth-file.d.ts +1 -1
  4. package/dist/cli/codex-auth-file.js +9 -10
  5. package/dist/cli/main.js +44 -54
  6. package/dist/error.d.ts +15 -0
  7. package/dist/error.js +74 -0
  8. package/dist/extensions/agents.d.ts +100 -0
  9. package/dist/extensions/agents.js +121 -0
  10. package/dist/extensions/capabilities.d.ts +4 -0
  11. package/dist/extensions/commands.d.ts +23 -0
  12. package/dist/extensions/commands.js +45 -0
  13. package/dist/extensions/compaction.d.ts +36 -0
  14. package/dist/extensions/contracts.d.ts +147 -0
  15. package/dist/extensions/data.d.ts +81 -0
  16. package/dist/extensions/data.js +78 -0
  17. package/dist/extensions/environment.d.ts +39 -0
  18. package/dist/extensions/environment.js +52 -0
  19. package/dist/extensions/files.d.ts +68 -0
  20. package/dist/extensions/files.js +26 -0
  21. package/dist/extensions/hooks.d.ts +32 -0
  22. package/dist/extensions/host-ports.d.ts +24 -0
  23. package/dist/extensions/manager.d.ts +42 -0
  24. package/dist/extensions/manager.js +457 -0
  25. package/dist/extensions/mcp.d.ts +116 -0
  26. package/dist/extensions/mcp.js +434 -0
  27. package/dist/extensions/model-request.d.ts +65 -0
  28. package/dist/extensions/model-request.js +197 -0
  29. package/dist/extensions/model-stream.d.ts +18 -0
  30. package/dist/extensions/model-stream.js +108 -0
  31. package/dist/extensions/models.d.ts +46 -0
  32. package/dist/extensions/models.js +7 -0
  33. package/dist/extensions/network.d.ts +40 -0
  34. package/dist/extensions/network.js +97 -0
  35. package/dist/extensions/operation.d.ts +32 -0
  36. package/dist/extensions/processes.d.ts +64 -0
  37. package/dist/extensions/processes.js +284 -0
  38. package/dist/extensions/prompt-composition.d.ts +38 -0
  39. package/dist/extensions/prompt-composition.js +100 -0
  40. package/dist/extensions/prompt-input.d.ts +30 -0
  41. package/dist/extensions/prompt-input.js +48 -0
  42. package/dist/extensions/prompts.d.ts +31 -0
  43. package/dist/extensions/prompts.js +88 -0
  44. package/dist/extensions/resources.d.ts +26 -0
  45. package/dist/extensions/resources.js +221 -0
  46. package/dist/extensions/services.d.ts +31 -0
  47. package/dist/extensions/services.js +61 -0
  48. package/dist/extensions/session-api.d.ts +6 -0
  49. package/dist/extensions/session-api.js +52 -0
  50. package/dist/extensions/session-input.d.ts +184 -0
  51. package/dist/extensions/session-input.js +422 -0
  52. package/dist/extensions/session-messages.d.ts +41 -0
  53. package/dist/extensions/session-messages.js +76 -0
  54. package/dist/extensions/session-tools.d.ts +32 -0
  55. package/dist/extensions/session-tools.js +208 -0
  56. package/dist/extensions/session.d.ts +60 -0
  57. package/dist/extensions/session.js +265 -0
  58. package/dist/extensions/settings.d.ts +76 -0
  59. package/dist/extensions/settings.js +115 -0
  60. package/dist/extensions/store.d.ts +10 -0
  61. package/dist/extensions/store.js +131 -0
  62. package/dist/extensions/tool-runtime.d.ts +16 -0
  63. package/dist/extensions/tools.d.ts +80 -0
  64. package/dist/extensions/tools.js +270 -0
  65. package/dist/extensions.d.ts +22 -0
  66. package/dist/host/contracts.d.ts +58 -0
  67. package/dist/host/contracts.js +18 -0
  68. package/dist/host/description.d.ts +19 -0
  69. package/dist/host/local-agent-host.d.ts +96 -0
  70. package/dist/host/local-agent-host.js +429 -0
  71. package/dist/host/local-exec-tool.d.ts +26 -0
  72. package/dist/host/local-exec-tool.js +686 -0
  73. package/dist/host/local-file-access.d.ts +30 -0
  74. package/dist/host/local-file-access.js +107 -0
  75. package/dist/host/local-network-access.d.ts +6 -0
  76. package/dist/host/local-network-access.js +101 -0
  77. package/dist/host/local-process-executor.d.ts +5 -0
  78. package/dist/host/local-process-executor.js +17 -0
  79. package/dist/host/local-session-environment.d.ts +18 -0
  80. package/dist/host/local-shell.d.ts +3 -0
  81. package/dist/host/local-tool-registry.d.ts +34 -0
  82. package/dist/host/local-tool-registry.js +134 -0
  83. package/dist/host/network.d.ts +5 -0
  84. package/dist/host/network.js +42 -0
  85. package/dist/host/process-control.d.ts +2 -0
  86. package/dist/host/process-control.js +26 -0
  87. package/dist/host/skill-contract.d.ts +6 -0
  88. package/dist/host.d.ts +17 -0
  89. package/dist/host.js +3 -0
  90. package/dist/index.d.ts +26 -51
  91. package/dist/index.js +9 -12
  92. package/dist/model/anthropic-messages.d.ts +10 -0
  93. package/dist/model/anthropic-messages.js +692 -0
  94. package/dist/model/anthropic-thinking.js +33 -0
  95. package/dist/model/configuration.d.ts +111 -0
  96. package/dist/model/configuration.js +201 -0
  97. package/dist/model/contracts.d.ts +229 -0
  98. package/dist/model/http.d.ts +13 -0
  99. package/dist/model/http.js +119 -0
  100. package/dist/model/image-contract.d.ts +10 -0
  101. package/dist/model/image.d.ts +9 -0
  102. package/dist/model/inline-media-budget.d.ts +7 -0
  103. package/dist/model/inline-media-budget.js +36 -0
  104. package/dist/model/input-images.d.ts +3 -0
  105. package/dist/model/input-images.js +16 -0
  106. package/dist/model/openai-responses.d.ts +59 -0
  107. package/dist/model/openai-responses.js +1586 -0
  108. package/dist/model/recovery.js +80 -0
  109. package/dist/model/request-configuration.d.ts +17 -0
  110. package/dist/model/request-configuration.js +47 -0
  111. package/dist/model/responses-event-projection.d.ts +24 -0
  112. package/dist/model/responses-event-projection.js +194 -0
  113. package/dist/model/responses-request.d.ts +5 -0
  114. package/dist/model/responses-request.js +363 -0
  115. package/dist/model/responses-session-cache.d.ts +33 -0
  116. package/dist/model/responses-session-cache.js +64 -0
  117. package/dist/model/runtime-credential.d.ts +1 -0
  118. package/dist/model/runtime-credential.js +1 -0
  119. package/dist/model/sse.js +281 -0
  120. package/dist/model/text-blocks.js +40 -0
  121. package/dist/model/tool-declarations.d.ts +4 -0
  122. package/dist/model/tool-definition-projection.d.ts +6 -0
  123. package/dist/model/tool-definition-projection.js +11 -0
  124. package/dist/model/tool-schema.d.ts +2 -0
  125. package/dist/model/tool-schema.js +17 -0
  126. package/dist/model/transport-test.d.ts +10 -0
  127. package/dist/model/transport-test.js +27 -0
  128. package/dist/model/usage-observer.d.ts +5 -0
  129. package/dist/model/usage.d.ts +40 -0
  130. package/dist/network/credential-runtime.d.ts +8 -0
  131. package/dist/network/credential-runtime.js +72 -0
  132. package/dist/network/credentials.d.ts +20 -0
  133. package/dist/network/credentials.js +18 -0
  134. package/dist/network/http.d.ts +20 -0
  135. package/dist/network/http.js +421 -0
  136. package/dist/network/product-user-agent.d.ts +5 -0
  137. package/dist/network/product-user-agent.js +22 -0
  138. package/dist/network/transport-error.d.ts +5 -0
  139. package/dist/network/transport-error.js +31 -0
  140. package/dist/process/contracts.d.ts +26 -0
  141. package/dist/prompts/index.d.ts +20 -0
  142. package/dist/prompts/index.js +49 -0
  143. package/dist/prompts/prompt-sections.d.ts +6 -0
  144. package/dist/prompts/prompt-sections.js +6 -0
  145. package/dist/prompts/read-context.js +152 -0
  146. package/dist/runtime/compaction/contracts.d.ts +23 -0
  147. package/dist/runtime/compaction/coordinator.js +88 -0
  148. package/dist/runtime/compaction/generate.d.ts +31 -0
  149. package/dist/runtime/compaction/generate.js +84 -0
  150. package/dist/runtime/compaction/history.d.ts +16 -0
  151. package/dist/runtime/compaction/operation.d.ts +30 -0
  152. package/dist/runtime/compaction/operation.js +131 -0
  153. package/dist/runtime/compaction/requests.d.ts +16 -0
  154. package/dist/runtime/compaction/requests.js +114 -0
  155. package/dist/runtime/compaction/retained-context.d.ts +6 -0
  156. package/dist/runtime/compaction/retained-context.js +48 -0
  157. package/dist/runtime/compaction/smart.d.ts +14 -0
  158. package/dist/runtime/compaction/smart.js +59 -0
  159. package/dist/runtime/context/contextual-blocks.d.ts +31 -0
  160. package/dist/runtime/context/contextual-blocks.js +158 -0
  161. package/dist/runtime/context/environment.d.ts +5 -0
  162. package/dist/runtime/context/gc-candidates-code.d.ts +6 -0
  163. package/dist/runtime/context/gc-candidates-code.js +102 -0
  164. package/dist/runtime/context/gc-candidates-exec.d.ts +6 -0
  165. package/dist/runtime/context/gc-candidates-exec.js +131 -0
  166. package/dist/runtime/context/gc-candidates-read-patch.d.ts +7 -0
  167. package/dist/runtime/context/gc-candidates-read-patch.js +118 -0
  168. package/dist/runtime/context/gc-candidates-subagent.d.ts +6 -0
  169. package/dist/runtime/context/gc-candidates-subagent.js +100 -0
  170. package/dist/runtime/context/gc-candidates-web.d.ts +6 -0
  171. package/dist/runtime/context/gc-candidates-web.js +58 -0
  172. package/dist/runtime/context/gc-candidates.d.ts +12 -0
  173. package/dist/runtime/context/gc-candidates.js +192 -0
  174. package/dist/runtime/context/gc-contracts.d.ts +57 -0
  175. package/dist/runtime/context/gc-economics.d.ts +48 -0
  176. package/dist/runtime/context/gc-economics.js +161 -0
  177. package/dist/runtime/context/gc-runtime.d.ts +43 -0
  178. package/dist/runtime/context/gc-tokens.d.ts +26 -0
  179. package/dist/runtime/context/gc-tokens.js +106 -0
  180. package/dist/runtime/context/gc.d.ts +7 -0
  181. package/dist/runtime/context/gc.js +552 -0
  182. package/dist/runtime/context/instructions.d.ts +37 -0
  183. package/dist/runtime/context/instructions.js +297 -0
  184. package/dist/runtime/context/normalize.d.ts +5 -0
  185. package/dist/runtime/context/projection.d.ts +23 -0
  186. package/dist/runtime/context/projection.js +284 -0
  187. package/dist/runtime/context/request-budget.d.ts +5 -0
  188. package/dist/runtime/context/request-budget.js +25 -0
  189. package/dist/runtime/context/restore.d.ts +27 -0
  190. package/dist/runtime/context/restore.js +186 -0
  191. package/dist/runtime/context/usage.d.ts +17 -0
  192. package/dist/runtime/context/usage.js +124 -0
  193. package/dist/runtime/context/world-state.d.ts +34 -0
  194. package/dist/runtime/context/world-state.js +232 -0
  195. package/dist/runtime/contracts.d.ts +29 -0
  196. package/dist/runtime/event-projection.d.ts +14 -0
  197. package/dist/runtime/event-projection.js +87 -0
  198. package/dist/runtime/events.d.ts +195 -0
  199. package/dist/runtime/execution-handle.d.ts +12 -0
  200. package/dist/runtime/execution-handle.js +1 -0
  201. package/dist/runtime/execution.d.ts +55 -0
  202. package/dist/runtime/execution.js +444 -0
  203. package/dist/runtime/model-progress.js +85 -0
  204. package/dist/runtime/resource-publication.d.ts +27 -0
  205. package/dist/runtime/resource-publication.js +60 -0
  206. package/dist/runtime/tool-round-contract.d.ts +19 -0
  207. package/dist/runtime/tool-round-contract.js +1 -0
  208. package/dist/runtime/wait.js +82 -0
  209. package/dist/sandbox/linux/bubblewrap-sandbox-executor.d.ts +1 -1
  210. package/dist/sandbox/linux/bubblewrap-sandbox-executor.js +8 -8
  211. package/dist/sdk/agent.d.ts +7 -0
  212. package/dist/sdk/agent.js +321 -0
  213. package/dist/sdk/execution-code-mode.d.ts +18 -0
  214. package/dist/sdk/execution-code-mode.js +51 -0
  215. package/dist/sdk/execution-compact-commit.d.ts +23 -0
  216. package/dist/sdk/execution-compact-commit.js +41 -0
  217. package/dist/sdk/execution-compact-extension.d.ts +12 -0
  218. package/dist/sdk/execution-compact-extension.js +46 -0
  219. package/dist/sdk/execution-compact-generation.d.ts +17 -0
  220. package/dist/sdk/execution-compact-generation.js +30 -0
  221. package/dist/sdk/execution-compaction-flight.d.ts +31 -0
  222. package/dist/sdk/execution-compaction-flight.js +50 -0
  223. package/dist/sdk/execution-compaction.d.ts +47 -0
  224. package/dist/sdk/execution-compaction.js +121 -0
  225. package/dist/sdk/execution-context-coordinator.d.ts +56 -0
  226. package/dist/sdk/execution-context-coordinator.js +102 -0
  227. package/dist/sdk/execution-input.d.ts +58 -0
  228. package/dist/sdk/execution-input.js +266 -0
  229. package/dist/sdk/execution-model-context.d.ts +52 -0
  230. package/dist/sdk/execution-model-context.js +156 -0
  231. package/dist/sdk/execution-model-lifecycle.d.ts +39 -0
  232. package/dist/sdk/execution-model-lifecycle.js +73 -0
  233. package/dist/sdk/execution-model-request.d.ts +40 -0
  234. package/dist/sdk/execution-model-request.js +45 -0
  235. package/dist/sdk/execution-round-preparation.d.ts +11 -0
  236. package/dist/sdk/execution-round-preparation.js +18 -0
  237. package/dist/sdk/execution-round-request.d.ts +30 -0
  238. package/dist/sdk/execution-round-request.js +31 -0
  239. package/dist/sdk/execution-tool-catalog.d.ts +46 -0
  240. package/dist/sdk/execution-tool-catalog.js +103 -0
  241. package/dist/sdk/execution-tool-scope.d.ts +67 -0
  242. package/dist/sdk/execution-tool-scope.js +147 -0
  243. package/dist/sdk/extension-agent-controller.d.ts +3 -0
  244. package/dist/sdk/extension-agent-controller.js +69 -0
  245. package/dist/sdk/extension-agents.d.ts +9 -0
  246. package/dist/sdk/extension-agents.js +58 -0
  247. package/dist/sdk/extension-models.d.ts +17 -0
  248. package/dist/sdk/extension-models.js +142 -0
  249. package/dist/sdk/extension-session-launch.d.ts +18 -0
  250. package/dist/sdk/extension-session-launch.js +73 -0
  251. package/dist/sdk/extension-session.d.ts +30 -0
  252. package/dist/sdk/extension-session.js +107 -0
  253. package/dist/sdk/extension-tool-runtime.d.ts +2 -0
  254. package/dist/sdk/extension-tool-runtime.js +14 -0
  255. package/dist/sdk/extension-tools.d.ts +16 -0
  256. package/dist/sdk/extension-tools.js +126 -0
  257. package/dist/sdk/model-input-projection.d.ts +4 -0
  258. package/dist/sdk/model-input-projection.js +27 -0
  259. package/dist/sdk/model-runtime.d.ts +21 -0
  260. package/dist/sdk/model-runtime.js +91 -0
  261. package/dist/sdk/native-steer.d.ts +20 -0
  262. package/dist/sdk/native-steer.js +84 -0
  263. package/dist/sdk/request-preparation.d.ts +9 -0
  264. package/dist/sdk/resource-input.d.ts +33 -0
  265. package/dist/sdk/resource-input.js +402 -0
  266. package/dist/sdk/session-catalog.d.ts +2 -0
  267. package/dist/sdk/session-catalog.js +12 -0
  268. package/dist/sdk/session-composition.d.ts +54 -0
  269. package/dist/sdk/session-composition.js +1 -0
  270. package/dist/sdk/session-execution-factory.d.ts +43 -0
  271. package/dist/sdk/session-execution-factory.js +937 -0
  272. package/dist/sdk/session-execution.d.ts +163 -0
  273. package/dist/sdk/session-execution.js +388 -0
  274. package/dist/sdk/session-extension-messages.d.ts +16 -0
  275. package/dist/sdk/session-extension-messages.js +64 -0
  276. package/dist/sdk/session-extension-prompt.d.ts +35 -0
  277. package/dist/sdk/session-extension-prompt.js +62 -0
  278. package/dist/sdk/session-maintenance.d.ts +25 -0
  279. package/dist/sdk/session-maintenance.js +205 -0
  280. package/dist/sdk/session-model-adapters.d.ts +28 -0
  281. package/dist/sdk/session-model-adapters.js +96 -0
  282. package/dist/sdk/session-open.d.ts +22 -0
  283. package/dist/sdk/session-open.js +44 -0
  284. package/dist/sdk/session-registry.d.ts +17 -0
  285. package/dist/sdk/session-registry.js +83 -0
  286. package/dist/sdk/session-runtime.d.ts +72 -0
  287. package/dist/sdk/session-runtime.js +205 -0
  288. package/dist/sdk/session.d.ts +3 -0
  289. package/dist/sdk/session.js +313 -0
  290. package/dist/sdk/subagent-backend.d.ts +3 -0
  291. package/dist/sdk/subagent-backend.js +49 -0
  292. package/dist/sdk/types.d.ts +80 -0
  293. package/dist/sdk/types.js +1 -0
  294. package/dist/session/catalog.d.ts +70 -0
  295. package/dist/session/catalog.js +194 -0
  296. package/dist/session/code-observation-contract.d.ts +40 -0
  297. package/dist/session/code-observation-contract.js +1 -0
  298. package/dist/session/code-observation-projection.d.ts +54 -0
  299. package/dist/session/code-observation-projection.js +165 -0
  300. package/dist/session/code-state.d.ts +27 -0
  301. package/dist/session/code-state.js +89 -0
  302. package/dist/session/context-gc-checkpoint.d.ts +26 -0
  303. package/dist/session/context-gc-checkpoint.js +935 -0
  304. package/dist/session/context-gc-contract.d.ts +141 -0
  305. package/dist/session/context-gc-contract.js +1 -0
  306. package/dist/session/context-gc-observations.d.ts +58 -0
  307. package/dist/session/context-gc-observations.js +187 -0
  308. package/dist/session/context-gc-replacements.d.ts +63 -0
  309. package/dist/session/context-gc-subagent.d.ts +54 -0
  310. package/dist/session/deferred-input.d.ts +5 -0
  311. package/dist/session/deferred-input.js +74 -0
  312. package/dist/session/extension-checkpoint.d.ts +8 -0
  313. package/dist/session/extension-checkpoint.js +30 -0
  314. package/dist/session/history-input-limits.d.ts +4 -0
  315. package/dist/session/history-input-limits.js +4 -0
  316. package/dist/session/inline-media-contract.d.ts +16 -0
  317. package/dist/session/inline-media-contract.js +1 -0
  318. package/dist/session/inline-media.d.ts +26 -0
  319. package/dist/session/inline-media.js +138 -0
  320. package/dist/session/model-request.d.ts +14 -0
  321. package/dist/session/model-request.js +1 -0
  322. package/dist/session/record-contract.d.ts +19 -0
  323. package/dist/session/record-contract.js +1 -0
  324. package/dist/session/record-projection.d.ts +6 -0
  325. package/dist/session/record-projection.js +80 -0
  326. package/dist/session/resource-contract.d.ts +9 -0
  327. package/dist/session/resource-contract.js +1 -0
  328. package/dist/session/rollback.d.ts +13 -0
  329. package/dist/session/rollback.js +46 -0
  330. package/dist/session/store/contracts.d.ts +160 -0
  331. package/dist/session/store/contracts.js +1 -0
  332. package/dist/session/store/current-state.d.ts +17 -0
  333. package/dist/session/store/current-state.js +53 -0
  334. package/dist/session/store/execution-state.d.ts +13 -0
  335. package/dist/session/store/execution-state.js +103 -0
  336. package/dist/session/store/index.d.ts +4 -0
  337. package/dist/session/store/index.js +2 -0
  338. package/dist/session/store/jsonl/directory-index.d.ts +26 -0
  339. package/dist/session/store/jsonl/directory-index.js +283 -0
  340. package/dist/session/store/jsonl/fork-session.d.ts +19 -0
  341. package/dist/session/store/jsonl/fork-session.js +142 -0
  342. package/dist/session/store/jsonl/fs-durability.d.ts +3 -0
  343. package/dist/session/store/jsonl/fs-durability.js +17 -0
  344. package/dist/session/store/jsonl/history-replacement.d.ts +48 -0
  345. package/dist/session/store/jsonl/history-replacement.js +147 -0
  346. package/dist/session/store/jsonl/history.d.ts +25 -0
  347. package/dist/session/store/jsonl/history.js +181 -0
  348. package/dist/session/store/jsonl/images.d.ts +19 -0
  349. package/dist/session/store/jsonl/images.js +122 -0
  350. package/dist/session/store/jsonl/index-transaction.d.ts +13 -0
  351. package/dist/session/store/jsonl/index-transaction.js +87 -0
  352. package/dist/session/store/jsonl/jsonl-admission.d.ts +10 -0
  353. package/dist/session/store/jsonl/jsonl-admission.js +205 -0
  354. package/dist/session/store/jsonl/jsonl-codec.d.ts +11 -0
  355. package/dist/session/store/jsonl/jsonl-codec.js +138 -0
  356. package/dist/session/store/jsonl/jsonl-migration.d.ts +12 -0
  357. package/dist/session/store/jsonl/jsonl-migration.js +105 -0
  358. package/dist/session/store/jsonl/jsonl-store.d.ts +171 -0
  359. package/dist/session/store/jsonl/jsonl-store.js +2395 -0
  360. package/dist/session/store/jsonl/open-recovery.d.ts +13 -0
  361. package/dist/session/store/jsonl/open-recovery.js +131 -0
  362. package/dist/session/store/jsonl/read-pins.d.ts +4 -0
  363. package/dist/session/store/jsonl/read-pins.js +131 -0
  364. package/dist/session/store/jsonl/record-append.d.ts +16 -0
  365. package/dist/session/store/jsonl/record-append.js +49 -0
  366. package/dist/session/store/jsonl/records.d.ts +30 -0
  367. package/dist/session/store/jsonl/records.js +313 -0
  368. package/dist/session/store/jsonl/resources.d.ts +19 -0
  369. package/dist/session/store/jsonl/resources.js +209 -0
  370. package/dist/session/store/jsonl/store-pool.d.ts +12 -0
  371. package/dist/session/store/jsonl/store-pool.js +55 -0
  372. package/dist/session/store/jsonl/transaction-recovery.d.ts +48 -0
  373. package/dist/session/store/jsonl/transaction-recovery.js +374 -0
  374. package/dist/session/store/jsonl/tree-maintenance.d.ts +12 -0
  375. package/dist/session/store/jsonl/tree-maintenance.js +59 -0
  376. package/dist/session/store/types.d.ts +69 -0
  377. package/dist/session/store/types.js +1 -0
  378. package/dist/session/summary.d.ts +18 -0
  379. package/dist/session/summary.js +1 -0
  380. package/dist/session/todo.d.ts +11 -0
  381. package/dist/session/todo.js +30 -0
  382. package/dist/session/tool-result-resources.d.ts +27 -0
  383. package/dist/session/tool-result-resources.js +255 -0
  384. package/dist/session/types.js +1 -0
  385. package/dist/session/user-history.d.ts +17 -0
  386. package/dist/session/user-history.js +1 -0
  387. package/dist/session-store.d.ts +2 -0
  388. package/dist/session-store.js +1 -0
  389. package/dist/shared/auto-title.d.ts +3 -3
  390. package/dist/shared/auto-title.js +6 -6
  391. package/dist/shared/model-text.d.ts +8 -8
  392. package/dist/shared/model-text.js +8 -7
  393. package/dist/storage/file-lock.js +83 -0
  394. package/dist/subagent/contracts.d.ts +107 -0
  395. package/dist/subagent/contracts.js +1 -0
  396. package/dist/subagent/limits.d.ts +17 -0
  397. package/dist/subagent/limits.js +17 -0
  398. package/dist/subagent/model-update.js +81 -0
  399. package/dist/subagent/session-controller.d.ts +87 -0
  400. package/dist/subagent/session-controller.js +1343 -0
  401. package/dist/subagent/task.d.ts +134 -0
  402. package/dist/subagent/task.js +436 -0
  403. package/dist/subagent/turn-contracts.d.ts +64 -0
  404. package/dist/subagent/turn-contracts.js +1 -0
  405. package/dist/subagent/wait-targets.d.ts +10 -0
  406. package/dist/subagent/wait-targets.js +26 -0
  407. package/dist/subagent/wait.d.ts +26 -0
  408. package/dist/subagent/wait.js +73 -0
  409. package/dist/tools/agent/agent-cancel.d.ts +7 -0
  410. package/dist/tools/agent/agent-cancel.js +29 -0
  411. package/dist/tools/agent/agent-message.d.ts +7 -0
  412. package/dist/tools/agent/agent-message.js +57 -0
  413. package/dist/tools/agent/agent-start.d.ts +12 -0
  414. package/dist/tools/agent/agent-start.js +106 -0
  415. package/dist/tools/agent/agent-wait.d.ts +7 -0
  416. package/dist/tools/agent/agent-wait.js +91 -0
  417. package/dist/tools/agent/question.d.ts +7 -0
  418. package/dist/tools/agent/question.js +125 -0
  419. package/dist/tools/agent/skill.d.ts +11 -0
  420. package/dist/tools/agent/skill.js +38 -0
  421. package/dist/tools/agent/sleep.d.ts +9 -0
  422. package/dist/tools/agent/sleep.js +54 -0
  423. package/dist/tools/agent/smart-compact.d.ts +9 -0
  424. package/dist/tools/agent/smart-compact.js +23 -0
  425. package/dist/tools/agent/todo-read.d.ts +14 -0
  426. package/dist/tools/agent/todo-write.d.ts +14 -0
  427. package/dist/tools/agent/todo-write.js +66 -0
  428. package/dist/tools/agent/todo.d.ts +25 -0
  429. package/dist/tools/agent/todo.js +32 -0
  430. package/dist/tools/callers.d.ts +7 -0
  431. package/dist/tools/callers.js +39 -0
  432. package/dist/tools/code-mode/cells.d.ts +29 -0
  433. package/dist/tools/code-mode/cells.js +338 -0
  434. package/dist/tools/code-mode/dispatch.d.ts +20 -0
  435. package/dist/tools/code-mode/dispatch.js +80 -0
  436. package/dist/tools/code-mode/engine.d.ts +60 -0
  437. package/dist/tools/code-mode/engine.js +1 -0
  438. package/dist/tools/code-mode/index.d.ts +31 -0
  439. package/dist/tools/code-mode/index.js +751 -0
  440. package/dist/tools/code-mode/observations.d.ts +8 -0
  441. package/dist/tools/code-mode/observations.js +64 -0
  442. package/dist/tools/code-mode/worker.d.ts +1 -0
  443. package/dist/tools/contracts.d.ts +193 -0
  444. package/dist/tools/contracts.js +1 -0
  445. package/dist/tools/definition-projection.d.ts +1 -0
  446. package/dist/tools/definition-projection.js +1 -0
  447. package/dist/tools/execution-limits.d.ts +69 -0
  448. package/dist/tools/execution-limits.js +58 -0
  449. package/dist/tools/execution.d.ts +30 -0
  450. package/dist/tools/execution.js +191 -0
  451. package/dist/tools/local/apply-patch-parser.js +177 -0
  452. package/dist/tools/local/apply-patch.d.ts +19 -0
  453. package/dist/tools/local/apply-patch.js +489 -0
  454. package/dist/tools/local/exec.d.ts +28 -0
  455. package/dist/tools/local/exec.js +194 -0
  456. package/dist/tools/local/image-processing.js +146 -0
  457. package/dist/tools/local/read.d.ts +43 -0
  458. package/dist/tools/local/read.js +470 -0
  459. package/dist/tools/local/view-image.d.ts +15 -0
  460. package/dist/tools/local/view-image.js +317 -0
  461. package/dist/tools/mcp/catalog.js +220 -0
  462. package/dist/tools/mcp/history.d.ts +4 -0
  463. package/dist/tools/mcp/tool-search.d.ts +45 -0
  464. package/dist/tools/mcp/tool-search.js +294 -0
  465. package/dist/tools/output-projection.d.ts +18 -0
  466. package/dist/tools/output-projection.js +341 -0
  467. package/dist/tools/permission-contract.d.ts +25 -0
  468. package/dist/tools/permission-contract.js +1 -0
  469. package/dist/tools/permissions.d.ts +61 -0
  470. package/dist/tools/permissions.js +237 -0
  471. package/dist/tools/registry.d.ts +7 -0
  472. package/dist/tools/result-extension-contract.d.ts +37 -0
  473. package/dist/tools/result-extension-contract.js +32 -0
  474. package/dist/tools/result-extensions.d.ts +12 -0
  475. package/dist/tools/result-extensions.js +104 -0
  476. package/dist/tools/runtime-context.d.ts +89 -0
  477. package/dist/tools/runtime-context.js +1 -0
  478. package/dist/tools/runtime-resource-handles.js +28 -0
  479. package/dist/tools/runtime.js +77 -0
  480. package/dist/tools/scheduler.d.ts +12 -0
  481. package/dist/tools/shared/path-resolver.js +133 -0
  482. package/dist/tools/wait.d.ts +1 -0
  483. package/dist/tools/wait.js +1 -0
  484. package/package.json +15 -3
  485. package/dist/agent-core/error.d.ts +0 -15
  486. package/dist/agent-core/error.js +0 -74
  487. package/dist/agent-core/extensions/agents.d.ts +0 -79
  488. package/dist/agent-core/extensions/agents.js +0 -186
  489. package/dist/agent-core/extensions/compaction.d.ts +0 -48
  490. package/dist/agent-core/extensions/contracts.d.ts +0 -265
  491. package/dist/agent-core/extensions/data.d.ts +0 -84
  492. package/dist/agent-core/extensions/data.js +0 -83
  493. package/dist/agent-core/extensions/environment.d.ts +0 -27
  494. package/dist/agent-core/extensions/environment.js +0 -52
  495. package/dist/agent-core/extensions/files.d.ts +0 -64
  496. package/dist/agent-core/extensions/files.js +0 -26
  497. package/dist/agent-core/extensions/hooks.d.ts +0 -32
  498. package/dist/agent-core/extensions/manager.d.ts +0 -39
  499. package/dist/agent-core/extensions/manager.js +0 -458
  500. package/dist/agent-core/extensions/mcp.d.ts +0 -99
  501. package/dist/agent-core/extensions/mcp.js +0 -433
  502. package/dist/agent-core/extensions/model-request.d.ts +0 -56
  503. package/dist/agent-core/extensions/model-request.js +0 -197
  504. package/dist/agent-core/extensions/model-stream.d.ts +0 -9
  505. package/dist/agent-core/extensions/model-stream.js +0 -108
  506. package/dist/agent-core/extensions/models.d.ts +0 -43
  507. package/dist/agent-core/extensions/network.d.ts +0 -32
  508. package/dist/agent-core/extensions/network.js +0 -97
  509. package/dist/agent-core/extensions/operation.d.ts +0 -30
  510. package/dist/agent-core/extensions/processes.d.ts +0 -52
  511. package/dist/agent-core/extensions/processes.js +0 -284
  512. package/dist/agent-core/extensions/prompt-composition.d.ts +0 -24
  513. package/dist/agent-core/extensions/prompt-composition.js +0 -106
  514. package/dist/agent-core/extensions/prompt-input.d.ts +0 -23
  515. package/dist/agent-core/extensions/prompt-input.js +0 -48
  516. package/dist/agent-core/extensions/resources.d.ts +0 -27
  517. package/dist/agent-core/extensions/resources.js +0 -221
  518. package/dist/agent-core/extensions/services.d.ts +0 -31
  519. package/dist/agent-core/extensions/services.js +0 -61
  520. package/dist/agent-core/extensions/session-input.d.ts +0 -163
  521. package/dist/agent-core/extensions/session-input.js +0 -411
  522. package/dist/agent-core/extensions/session-messages.d.ts +0 -41
  523. package/dist/agent-core/extensions/session-messages.js +0 -76
  524. package/dist/agent-core/extensions/session.d.ts +0 -69
  525. package/dist/agent-core/extensions/session.js +0 -607
  526. package/dist/agent-core/extensions/settings.d.ts +0 -59
  527. package/dist/agent-core/extensions/settings.js +0 -115
  528. package/dist/agent-core/extensions/store.d.ts +0 -10
  529. package/dist/agent-core/extensions/store.js +0 -131
  530. package/dist/agent-core/extensions/tools.d.ts +0 -61
  531. package/dist/agent-core/extensions/tools.js +0 -269
  532. package/dist/agent-core/host/contracts.d.ts +0 -100
  533. package/dist/agent-core/host/contracts.js +0 -18
  534. package/dist/agent-core/host/local-agent-host.d.ts +0 -96
  535. package/dist/agent-core/host/local-agent-host.js +0 -425
  536. package/dist/agent-core/host/local-file-access.d.ts +0 -30
  537. package/dist/agent-core/host/local-file-access.js +0 -107
  538. package/dist/agent-core/host/local-network-access.d.ts +0 -6
  539. package/dist/agent-core/host/local-network-access.js +0 -101
  540. package/dist/agent-core/host/local-process-executor.d.ts +0 -29
  541. package/dist/agent-core/host/local-process-executor.js +0 -41
  542. package/dist/agent-core/host/local-session-environment.d.ts +0 -18
  543. package/dist/agent-core/host/local-shell.d.ts +0 -3
  544. package/dist/agent-core/host/network.d.ts +0 -4
  545. package/dist/agent-core/host/network.js +0 -6
  546. package/dist/agent-core/model/anthropic-messages.d.ts +0 -10
  547. package/dist/agent-core/model/anthropic-messages.js +0 -707
  548. package/dist/agent-core/model/anthropic-thinking.js +0 -33
  549. package/dist/agent-core/model/catalog-file.d.ts +0 -80
  550. package/dist/agent-core/model/catalog-file.js +0 -103
  551. package/dist/agent-core/model/configuration.d.ts +0 -127
  552. package/dist/agent-core/model/configuration.js +0 -168
  553. package/dist/agent-core/model/contracts.d.ts +0 -229
  554. package/dist/agent-core/model/http.d.ts +0 -27
  555. package/dist/agent-core/model/http.js +0 -534
  556. package/dist/agent-core/model/image.d.ts +0 -17
  557. package/dist/agent-core/model/openai-responses.d.ts +0 -77
  558. package/dist/agent-core/model/openai-responses.js +0 -2123
  559. package/dist/agent-core/model/product-user-agent.d.ts +0 -5
  560. package/dist/agent-core/model/product-user-agent.js +0 -22
  561. package/dist/agent-core/model/recovery.js +0 -80
  562. package/dist/agent-core/model/request-configuration.d.ts +0 -17
  563. package/dist/agent-core/model/request-configuration.js +0 -47
  564. package/dist/agent-core/model/runtime-credential.d.ts +0 -8
  565. package/dist/agent-core/model/runtime-credential.js +0 -72
  566. package/dist/agent-core/model/sse.js +0 -281
  567. package/dist/agent-core/model/text-blocks.js +0 -40
  568. package/dist/agent-core/model/tool-declarations.d.ts +0 -4
  569. package/dist/agent-core/model/transport-test.d.ts +0 -3
  570. package/dist/agent-core/model/transport-test.js +0 -23
  571. package/dist/agent-core/model/usage-observer.d.ts +0 -31
  572. package/dist/agent-core/prompts/index.d.ts +0 -20
  573. package/dist/agent-core/prompts/index.js +0 -49
  574. package/dist/agent-core/runtime/compaction/coordinator.js +0 -88
  575. package/dist/agent-core/runtime/compaction/generate.d.ts +0 -28
  576. package/dist/agent-core/runtime/compaction/generate.js +0 -84
  577. package/dist/agent-core/runtime/compaction/history.d.ts +0 -16
  578. package/dist/agent-core/runtime/compaction/operation.d.ts +0 -29
  579. package/dist/agent-core/runtime/compaction/operation.js +0 -131
  580. package/dist/agent-core/runtime/compaction/requests.d.ts +0 -16
  581. package/dist/agent-core/runtime/compaction/requests.js +0 -114
  582. package/dist/agent-core/runtime/compaction/retained-context.d.ts +0 -6
  583. package/dist/agent-core/runtime/compaction/retained-context.js +0 -47
  584. package/dist/agent-core/runtime/compaction/smart.d.ts +0 -14
  585. package/dist/agent-core/runtime/compaction/smart.js +0 -59
  586. package/dist/agent-core/runtime/context/contextual-blocks.d.ts +0 -30
  587. package/dist/agent-core/runtime/context/contextual-blocks.js +0 -146
  588. package/dist/agent-core/runtime/context/environment.d.ts +0 -5
  589. package/dist/agent-core/runtime/context/gc-runtime.d.ts +0 -38
  590. package/dist/agent-core/runtime/context/gc-tokens.d.ts +0 -25
  591. package/dist/agent-core/runtime/context/gc-tokens.js +0 -103
  592. package/dist/agent-core/runtime/context/gc.d.ts +0 -75
  593. package/dist/agent-core/runtime/context/gc.js +0 -1386
  594. package/dist/agent-core/runtime/context/instructions.d.ts +0 -37
  595. package/dist/agent-core/runtime/context/instructions.js +0 -297
  596. package/dist/agent-core/runtime/context/normalize.d.ts +0 -5
  597. package/dist/agent-core/runtime/context/projection.d.ts +0 -23
  598. package/dist/agent-core/runtime/context/projection.js +0 -284
  599. package/dist/agent-core/runtime/context/request-budget.d.ts +0 -4
  600. package/dist/agent-core/runtime/context/request-budget.js +0 -25
  601. package/dist/agent-core/runtime/context/restore.d.ts +0 -25
  602. package/dist/agent-core/runtime/context/restore.js +0 -186
  603. package/dist/agent-core/runtime/context/usage.d.ts +0 -17
  604. package/dist/agent-core/runtime/context/usage.js +0 -124
  605. package/dist/agent-core/runtime/context/world-state.d.ts +0 -33
  606. package/dist/agent-core/runtime/context/world-state.js +0 -232
  607. package/dist/agent-core/runtime/contracts.d.ts +0 -41
  608. package/dist/agent-core/runtime/event-projection.d.ts +0 -14
  609. package/dist/agent-core/runtime/event-projection.js +0 -87
  610. package/dist/agent-core/runtime/events.d.ts +0 -197
  611. package/dist/agent-core/runtime/execution-handle.d.ts +0 -12
  612. package/dist/agent-core/runtime/execution.d.ts +0 -50
  613. package/dist/agent-core/runtime/execution.js +0 -445
  614. package/dist/agent-core/runtime/model-progress.js +0 -85
  615. package/dist/agent-core/runtime/resource-publication.d.ts +0 -8
  616. package/dist/agent-core/runtime/resource-publication.js +0 -60
  617. package/dist/agent-core/sdk/agent.d.ts +0 -11
  618. package/dist/agent-core/sdk/agent.js +0 -474
  619. package/dist/agent-core/sdk/extension-agents.d.ts +0 -9
  620. package/dist/agent-core/sdk/extension-agents.js +0 -58
  621. package/dist/agent-core/sdk/extension-models.d.ts +0 -13
  622. package/dist/agent-core/sdk/extension-models.js +0 -137
  623. package/dist/agent-core/sdk/extension-session.d.ts +0 -30
  624. package/dist/agent-core/sdk/extension-session.js +0 -105
  625. package/dist/agent-core/sdk/extension-tools.d.ts +0 -16
  626. package/dist/agent-core/sdk/extension-tools.js +0 -126
  627. package/dist/agent-core/sdk/model-runtime.d.ts +0 -18
  628. package/dist/agent-core/sdk/model-runtime.js +0 -93
  629. package/dist/agent-core/sdk/native-steer.d.ts +0 -20
  630. package/dist/agent-core/sdk/native-steer.js +0 -84
  631. package/dist/agent-core/sdk/request-preparation.d.ts +0 -7
  632. package/dist/agent-core/sdk/resource-input.d.ts +0 -32
  633. package/dist/agent-core/sdk/resource-input.js +0 -403
  634. package/dist/agent-core/sdk/session.d.ts +0 -94
  635. package/dist/agent-core/sdk/session.js +0 -2377
  636. package/dist/agent-core/sdk/subagent-backend.d.ts +0 -3
  637. package/dist/agent-core/sdk/subagent-backend.js +0 -49
  638. package/dist/agent-core/sdk/types.d.ts +0 -81
  639. package/dist/agent-core/session/catalog.d.ts +0 -99
  640. package/dist/agent-core/session/catalog.js +0 -200
  641. package/dist/agent-core/session/context-gc-checkpoint.d.ts +0 -165
  642. package/dist/agent-core/session/context-gc-checkpoint.js +0 -935
  643. package/dist/agent-core/session/context-gc-observations.d.ts +0 -60
  644. package/dist/agent-core/session/context-gc-observations.js +0 -187
  645. package/dist/agent-core/session/context-gc-replacements.d.ts +0 -62
  646. package/dist/agent-core/session/context-gc-subagent.d.ts +0 -53
  647. package/dist/agent-core/session/deferred-input.d.ts +0 -5
  648. package/dist/agent-core/session/deferred-input.js +0 -74
  649. package/dist/agent-core/session/inline-media.d.ts +0 -45
  650. package/dist/agent-core/session/inline-media.js +0 -163
  651. package/dist/agent-core/session/rollback.d.ts +0 -13
  652. package/dist/agent-core/session/rollback.js +0 -46
  653. package/dist/agent-core/session/store/contracts.d.ts +0 -158
  654. package/dist/agent-core/session/store/current-state.d.ts +0 -17
  655. package/dist/agent-core/session/store/current-state.js +0 -53
  656. package/dist/agent-core/session/store/directory-index.d.ts +0 -18
  657. package/dist/agent-core/session/store/directory-index.js +0 -169
  658. package/dist/agent-core/session/store/execution-state.d.ts +0 -18
  659. package/dist/agent-core/session/store/execution-state.js +0 -175
  660. package/dist/agent-core/session/store/history.d.ts +0 -25
  661. package/dist/agent-core/session/store/history.js +0 -181
  662. package/dist/agent-core/session/store/images.d.ts +0 -19
  663. package/dist/agent-core/session/store/images.js +0 -110
  664. package/dist/agent-core/session/store/index.d.ts +0 -4
  665. package/dist/agent-core/session/store/index.js +0 -2
  666. package/dist/agent-core/session/store/jsonl-store.d.ts +0 -171
  667. package/dist/agent-core/session/store/jsonl-store.js +0 -2078
  668. package/dist/agent-core/session/store/records.d.ts +0 -23
  669. package/dist/agent-core/session/store/records.js +0 -261
  670. package/dist/agent-core/session/store/resources.d.ts +0 -26
  671. package/dist/agent-core/session/store/resources.js +0 -197
  672. package/dist/agent-core/session/store/types.d.ts +0 -82
  673. package/dist/agent-core/session/tool-result-resources.d.ts +0 -26
  674. package/dist/agent-core/session/tool-result-resources.js +0 -256
  675. package/dist/agent-core/session/transaction-recovery.d.ts +0 -16
  676. package/dist/agent-core/session/transaction-recovery.js +0 -135
  677. package/dist/agent-core/storage/file-lock.js +0 -83
  678. package/dist/agent-core/subagent/contracts.d.ts +0 -117
  679. package/dist/agent-core/subagent/model-update.js +0 -81
  680. package/dist/agent-core/subagent/scheduler.d.ts +0 -135
  681. package/dist/agent-core/subagent/scheduler.js +0 -369
  682. package/dist/agent-core/subagent/session-controller.d.ts +0 -138
  683. package/dist/agent-core/subagent/session-controller.js +0 -1594
  684. package/dist/agent-core/subagent/wait.d.ts +0 -14
  685. package/dist/agent-core/subagent/wait.js +0 -32
  686. package/dist/agent-core/tools/agent/agent-cancel.d.ts +0 -7
  687. package/dist/agent-core/tools/agent/agent-cancel.js +0 -29
  688. package/dist/agent-core/tools/agent/agent-message.d.ts +0 -7
  689. package/dist/agent-core/tools/agent/agent-message.js +0 -57
  690. package/dist/agent-core/tools/agent/agent-start.d.ts +0 -12
  691. package/dist/agent-core/tools/agent/agent-start.js +0 -106
  692. package/dist/agent-core/tools/agent/agent-wait.d.ts +0 -7
  693. package/dist/agent-core/tools/agent/agent-wait.js +0 -91
  694. package/dist/agent-core/tools/agent/question.d.ts +0 -7
  695. package/dist/agent-core/tools/agent/question.js +0 -125
  696. package/dist/agent-core/tools/agent/skill.d.ts +0 -11
  697. package/dist/agent-core/tools/agent/skill.js +0 -38
  698. package/dist/agent-core/tools/agent/sleep.d.ts +0 -12
  699. package/dist/agent-core/tools/agent/sleep.js +0 -54
  700. package/dist/agent-core/tools/agent/smart-compact.d.ts +0 -9
  701. package/dist/agent-core/tools/agent/smart-compact.js +0 -23
  702. package/dist/agent-core/tools/agent/todo-read.d.ts +0 -14
  703. package/dist/agent-core/tools/agent/todo-write.d.ts +0 -14
  704. package/dist/agent-core/tools/agent/todo-write.js +0 -66
  705. package/dist/agent-core/tools/agent/todo.d.ts +0 -26
  706. package/dist/agent-core/tools/agent/todo.js +0 -60
  707. package/dist/agent-core/tools/callers.d.ts +0 -6
  708. package/dist/agent-core/tools/callers.js +0 -39
  709. package/dist/agent-core/tools/code-mode/cells.d.ts +0 -29
  710. package/dist/agent-core/tools/code-mode/cells.js +0 -337
  711. package/dist/agent-core/tools/code-mode/dispatch.d.ts +0 -20
  712. package/dist/agent-core/tools/code-mode/dispatch.js +0 -80
  713. package/dist/agent-core/tools/code-mode/engine.d.ts +0 -60
  714. package/dist/agent-core/tools/code-mode/index.d.ts +0 -29
  715. package/dist/agent-core/tools/code-mode/index.js +0 -749
  716. package/dist/agent-core/tools/code-mode/observations.d.ts +0 -98
  717. package/dist/agent-core/tools/code-mode/observations.js +0 -228
  718. package/dist/agent-core/tools/code-mode/state.d.ts +0 -9
  719. package/dist/agent-core/tools/code-mode/state.js +0 -82
  720. package/dist/agent-core/tools/contracts.d.ts +0 -211
  721. package/dist/agent-core/tools/definition-projection.d.ts +0 -7
  722. package/dist/agent-core/tools/definition-projection.js +0 -26
  723. package/dist/agent-core/tools/execution-limits.d.ts +0 -69
  724. package/dist/agent-core/tools/execution-limits.js +0 -69
  725. package/dist/agent-core/tools/execution.d.ts +0 -46
  726. package/dist/agent-core/tools/execution.js +0 -191
  727. package/dist/agent-core/tools/local/apply-patch-parser.js +0 -177
  728. package/dist/agent-core/tools/local/apply-patch.d.ts +0 -19
  729. package/dist/agent-core/tools/local/apply-patch.js +0 -489
  730. package/dist/agent-core/tools/local/exec.d.ts +0 -53
  731. package/dist/agent-core/tools/local/exec.js +0 -877
  732. package/dist/agent-core/tools/local/image-processing.js +0 -146
  733. package/dist/agent-core/tools/local/read-context.js +0 -152
  734. package/dist/agent-core/tools/local/read.d.ts +0 -43
  735. package/dist/agent-core/tools/local/read.js +0 -470
  736. package/dist/agent-core/tools/local/registry.d.ts +0 -34
  737. package/dist/agent-core/tools/local/registry.js +0 -132
  738. package/dist/agent-core/tools/local/view-image.d.ts +0 -15
  739. package/dist/agent-core/tools/local/view-image.js +0 -317
  740. package/dist/agent-core/tools/local/workspace-tools.d.ts +0 -12
  741. package/dist/agent-core/tools/local/workspace-tools.js +0 -28
  742. package/dist/agent-core/tools/mcp/catalog.js +0 -220
  743. package/dist/agent-core/tools/mcp/history.d.ts +0 -4
  744. package/dist/agent-core/tools/mcp/tool-search.d.ts +0 -45
  745. package/dist/agent-core/tools/mcp/tool-search.js +0 -294
  746. package/dist/agent-core/tools/output-projection.d.ts +0 -18
  747. package/dist/agent-core/tools/output-projection.js +0 -341
  748. package/dist/agent-core/tools/permissions.d.ts +0 -85
  749. package/dist/agent-core/tools/permissions.js +0 -237
  750. package/dist/agent-core/tools/registry.d.ts +0 -7
  751. package/dist/agent-core/tools/result-extensions.d.ts +0 -46
  752. package/dist/agent-core/tools/result-extensions.js +0 -134
  753. package/dist/agent-core/tools/runtime-context.d.ts +0 -74
  754. package/dist/agent-core/tools/runtime-resource-handles.js +0 -28
  755. package/dist/agent-core/tools/runtime.js +0 -77
  756. package/dist/agent-core/tools/scheduler.d.ts +0 -12
  757. package/dist/agent-core/tools/shared/path-resolver.js +0 -133
  758. package/dist/agent-core/tools/wait.js +0 -82
  759. /package/dist/{agent-core/extensions/models.js → extensions/capabilities.js} +0 -0
  760. /package/dist/{agent-core/extensions → extensions}/compaction.js +0 -0
  761. /package/dist/{agent-core/model → extensions}/contracts.js +0 -0
  762. /package/dist/{agent-core/extensions → extensions}/hooks.js +0 -0
  763. /package/dist/{agent-core/runtime/context/contracts.js → extensions/host-ports.js} +0 -0
  764. /package/dist/{agent-core/extensions → extensions}/operation.js +0 -0
  765. /package/dist/{agent-core/runtime/contracts.js → extensions/tool-runtime.js} +0 -0
  766. /package/dist/{agent-core/extensions/contracts.js → extensions.js} +0 -0
  767. /package/dist/{agent-core/runtime/events.js → host/description.js} +0 -0
  768. /package/dist/{agent-core/host → host}/local-session-environment.js +0 -0
  769. /package/dist/{agent-core/host → host}/local-shell.js +0 -0
  770. /package/dist/{agent-core/runtime/execution-handle.js → host/skill-contract.js} +0 -0
  771. /package/dist/{agent-core/model → model}/anthropic-thinking.d.ts +0 -0
  772. /package/dist/{agent-core/model → model}/attempt-diagnostics.d.ts +0 -0
  773. /package/dist/{agent-core/model → model}/attempt-diagnostics.js +0 -0
  774. /package/dist/{agent-core/session/store → model}/contracts.js +0 -0
  775. /package/dist/{agent-core/sdk/types.js → model/image-contract.js} +0 -0
  776. /package/dist/{agent-core/model → model}/image.js +0 -0
  777. /package/dist/{agent-core/model → model}/native-context.d.ts +0 -0
  778. /package/dist/{agent-core/model → model}/native-context.js +0 -0
  779. /package/dist/{agent-core/model → model}/recovery.d.ts +0 -0
  780. /package/dist/{agent-core/model → model}/sse.d.ts +0 -0
  781. /package/dist/{agent-core/model → model}/text-blocks.d.ts +0 -0
  782. /package/dist/{agent-core/model → model}/tool-declarations.js +0 -0
  783. /package/dist/{agent-core/model → model}/tool-input.d.ts +0 -0
  784. /package/dist/{agent-core/model → model}/tool-input.js +0 -0
  785. /package/dist/{agent-core/model → model}/usage-observer.js +0 -0
  786. /package/dist/{agent-core/session/store/types.js → model/usage.js} +0 -0
  787. /package/dist/{agent-core/subagent → process}/contracts.js +0 -0
  788. /package/dist/{agent-core/prompts → prompts}/compact.d.ts +0 -0
  789. /package/dist/{agent-core/prompts → prompts}/compact.js +0 -0
  790. /package/dist/{agent-core/prompts → prompts}/core.d.ts +0 -0
  791. /package/dist/{agent-core/prompts → prompts}/core.js +0 -0
  792. /package/dist/{agent-core/prompts → prompts}/markup.d.ts +0 -0
  793. /package/dist/{agent-core/prompts → prompts}/markup.js +0 -0
  794. /package/dist/{agent-core/prompts → prompts}/modes.d.ts +0 -0
  795. /package/dist/{agent-core/prompts → prompts}/modes.js +0 -0
  796. /package/dist/{agent-core/prompts → prompts}/output.d.ts +0 -0
  797. /package/dist/{agent-core/prompts → prompts}/output.js +0 -0
  798. /package/dist/{agent-core/prompts → prompts}/permissions.d.ts +0 -0
  799. /package/dist/{agent-core/prompts → prompts}/permissions.js +0 -0
  800. /package/dist/{agent-core/tools/local → prompts}/read-context.d.ts +0 -0
  801. /package/dist/{agent-core/prompts → prompts}/resources.d.ts +0 -0
  802. /package/dist/{agent-core/prompts → prompts}/resources.js +0 -0
  803. /package/dist/{agent-core/prompts → prompts}/subagent.d.ts +0 -0
  804. /package/dist/{agent-core/prompts → prompts}/subagent.js +0 -0
  805. /package/dist/{agent-core/prompts → prompts}/workflow.d.ts +0 -0
  806. /package/dist/{agent-core/prompts → prompts}/workflow.js +0 -0
  807. /package/dist/{agent-core/runtime → runtime}/async-queue.d.ts +0 -0
  808. /package/dist/{agent-core/runtime → runtime}/async-queue.js +0 -0
  809. /package/dist/{agent-core/tools → runtime/compaction}/contracts.js +0 -0
  810. /package/dist/{agent-core/runtime → runtime}/compaction/coordinator.d.ts +0 -0
  811. /package/dist/{agent-core/runtime → runtime}/compaction/history.js +0 -0
  812. /package/dist/{agent-core/runtime → runtime}/context/contracts.d.ts +0 -0
  813. /package/dist/{agent-core/session/types.js → runtime/context/contracts.js} +0 -0
  814. /package/dist/{agent-core/runtime → runtime}/context/environment.js +0 -0
  815. /package/dist/{agent-core/tools/code-mode/engine.js → runtime/context/gc-contracts.js} +0 -0
  816. /package/dist/{agent-core/runtime → runtime}/context/gc-runtime.js +0 -0
  817. /package/dist/{agent-core/runtime → runtime}/context/normalize.js +0 -0
  818. /package/dist/{agent-core/tools/code-mode/worker.d.ts → runtime/contracts.js} +0 -0
  819. /package/dist/{agent-core/tools/runtime-context.js → runtime/events.js} +0 -0
  820. /package/dist/{agent-core/runtime → runtime}/execution-policy.d.ts +0 -0
  821. /package/dist/{agent-core/runtime → runtime}/execution-policy.js +0 -0
  822. /package/dist/{agent-core/runtime → runtime}/model-generation-timing.d.ts +0 -0
  823. /package/dist/{agent-core/runtime → runtime}/model-generation-timing.js +0 -0
  824. /package/dist/{agent-core/runtime → runtime}/model-progress.d.ts +0 -0
  825. /package/dist/{agent-core/runtime → runtime}/plan-output.d.ts +0 -0
  826. /package/dist/{agent-core/runtime → runtime}/plan-output.js +0 -0
  827. /package/dist/{agent-core/tools/public-metadata.d.ts → runtime/public-tool-metadata.d.ts} +0 -0
  828. /package/dist/{agent-core/tools/public-metadata.js → runtime/public-tool-metadata.js} +0 -0
  829. /package/dist/{agent-core/runtime → runtime}/token-budget.d.ts +0 -0
  830. /package/dist/{agent-core/runtime → runtime}/token-budget.js +0 -0
  831. /package/dist/{agent-core/tools → runtime}/wait.d.ts +0 -0
  832. /package/dist/{agent-core/sdk → sdk}/request-preparation.js +0 -0
  833. /package/dist/{agent-core/session → session}/context-gc-markup.d.ts +0 -0
  834. /package/dist/{agent-core/session → session}/context-gc-markup.js +0 -0
  835. /package/dist/{agent-core/session → session}/context-gc-replacements.js +0 -0
  836. /package/dist/{agent-core/session → session}/context-gc-subagent.js +0 -0
  837. /package/dist/{agent-core/session → session}/types.d.ts +0 -0
  838. /package/dist/{agent-core/storage → storage}/file-lock.d.ts +0 -0
  839. /package/dist/{agent-core/subagent → subagent}/model-update.d.ts +0 -0
  840. /package/dist/{agent-core/tools → tools}/agent/todo-read.js +0 -0
  841. /package/dist/{agent-core/tools → tools}/code-mode/quickjs-engine.d.ts +0 -0
  842. /package/dist/{agent-core/tools → tools}/code-mode/quickjs-engine.js +0 -0
  843. /package/dist/{agent-core/tools → tools}/code-mode/text-output.d.ts +0 -0
  844. /package/dist/{agent-core/tools → tools}/code-mode/text-output.js +0 -0
  845. /package/dist/{agent-core/tools → tools}/code-mode/worker.js +0 -0
  846. /package/dist/{agent-core/tools → tools}/file-change-diff.d.ts +0 -0
  847. /package/dist/{agent-core/tools → tools}/file-change-diff.js +0 -0
  848. /package/dist/{agent-core/tools → tools}/input-diagnostics/source-preview.d.ts +0 -0
  849. /package/dist/{agent-core/tools → tools}/input-diagnostics/source-preview.js +0 -0
  850. /package/dist/{agent-core/tools → tools}/input.d.ts +0 -0
  851. /package/dist/{agent-core/tools → tools}/input.js +0 -0
  852. /package/dist/{agent-core/tools → tools}/local/apply-patch-parser.d.ts +0 -0
  853. /package/dist/{agent-core/tools → tools}/local/image-processing.d.ts +0 -0
  854. /package/dist/{agent-core/tools → tools}/mcp/catalog.d.ts +0 -0
  855. /package/dist/{agent-core/tools → tools}/mcp/history.js +0 -0
  856. /package/dist/{agent-core/tools → tools}/registry.js +0 -0
  857. /package/dist/{agent-core/tools → tools}/runtime-resource-handles.d.ts +0 -0
  858. /package/dist/{agent-core/tools → tools}/runtime.d.ts +0 -0
  859. /package/dist/{agent-core/tools → tools}/scheduler.js +0 -0
  860. /package/dist/{agent-core/tools → tools}/shared/patch-result.d.ts +0 -0
  861. /package/dist/{agent-core/tools → tools}/shared/patch-result.js +0 -0
  862. /package/dist/{agent-core/tools → tools}/shared/path-resolver.d.ts +0 -0
@@ -0,0 +1,78 @@
1
+ import { type AgentModelConfiguration, type ModelCatalog } from '../index.js';
2
+ export type CliModelCredentialSource = 'CODEX_AUTH_FILE';
3
+ export interface CliModelConfiguration extends AgentModelConfiguration {
4
+ credentialSource?: CliModelCredentialSource;
5
+ }
6
+ export interface CliModelCatalog extends Omit<ModelCatalog, 'models'> {
7
+ models: readonly CliModelConfiguration[];
8
+ }
9
+ export declare const modelCatalogPath: (home: string) => string;
10
+ export declare function readModelCatalog(home: string): Promise<CliModelCatalog>;
11
+ export declare function writeModelCatalog(home: string, catalog: CliModelCatalog): Promise<void>;
12
+ export declare function serializeModel(model: CliModelConfiguration): {
13
+ apiKey: string;
14
+ conversationModel?: boolean;
15
+ useResourceUrl?: boolean;
16
+ responsesConfigurationUpdates?: boolean;
17
+ responsesTransport?: import("../index.js").ResponsesTransport;
18
+ responsesPreviousResponseId?: boolean;
19
+ id: string;
20
+ name: string;
21
+ protocol: "OPENAI_RESPONSES" | "ANTHROPIC_MESSAGES";
22
+ baseUrl: string;
23
+ modelId: string;
24
+ contextWindowTokens: number;
25
+ maxOutputTokens: number;
26
+ inputCapabilities: ("TEXT" | "IMAGE")[];
27
+ outputCapabilities: ["TEXT"];
28
+ reasoningEfforts: ("low" | "medium" | "high" | "xhigh" | "max" | "ultra")[];
29
+ defaultReasoningEffort?: "low" | "medium" | "high" | "xhigh" | "max" | "ultra" | undefined;
30
+ titleGeneration: boolean;
31
+ codeMode: boolean;
32
+ fastMode?: boolean | undefined;
33
+ serviceTier?: "default" | "auto" | "flex" | "priority" | "fast" | "ultrafast" | undefined;
34
+ hostedWebSearch: boolean;
35
+ responsesToolNamespace?: string | undefined;
36
+ responsesOptionalParameters?: {
37
+ reasoningEffort: boolean;
38
+ reasoningSummary: boolean;
39
+ textVerbosity: boolean;
40
+ promptCacheKey: boolean;
41
+ nativeTools?: boolean | undefined;
42
+ } | undefined;
43
+ enabled: boolean;
44
+ } | {
45
+ credential: {
46
+ type: "CODEX_AUTH_FILE";
47
+ };
48
+ conversationModel?: boolean;
49
+ useResourceUrl?: boolean;
50
+ responsesConfigurationUpdates?: boolean;
51
+ responsesTransport?: import("../index.js").ResponsesTransport;
52
+ responsesPreviousResponseId?: boolean;
53
+ id: string;
54
+ name: string;
55
+ protocol: "OPENAI_RESPONSES" | "ANTHROPIC_MESSAGES";
56
+ baseUrl: string;
57
+ modelId: string;
58
+ contextWindowTokens: number;
59
+ maxOutputTokens: number;
60
+ inputCapabilities: ("TEXT" | "IMAGE")[];
61
+ outputCapabilities: ["TEXT"];
62
+ reasoningEfforts: ("low" | "medium" | "high" | "xhigh" | "max" | "ultra")[];
63
+ defaultReasoningEffort?: "low" | "medium" | "high" | "xhigh" | "max" | "ultra" | undefined;
64
+ titleGeneration: boolean;
65
+ codeMode: boolean;
66
+ fastMode?: boolean | undefined;
67
+ serviceTier?: "default" | "auto" | "flex" | "priority" | "fast" | "ultrafast" | undefined;
68
+ hostedWebSearch: boolean;
69
+ responsesToolNamespace?: string | undefined;
70
+ responsesOptionalParameters?: {
71
+ reasoningEffort: boolean;
72
+ reasoningSummary: boolean;
73
+ textVerbosity: boolean;
74
+ promptCacheKey: boolean;
75
+ nativeTools?: boolean | undefined;
76
+ } | undefined;
77
+ enabled: boolean;
78
+ };
@@ -0,0 +1,102 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { mkdir, readFile, rename, writeFile } from 'node:fs/promises';
3
+ import { join } from 'node:path';
4
+ import { AgentError, parseModelCatalog } from '../index.js';
5
+ export const modelCatalogPath = (home) => join(home, '.mar', 'agent', 'models.json');
6
+ export async function readModelCatalog(home) {
7
+ try {
8
+ return parseCliModelCatalog(JSON.parse(await readFile(modelCatalogPath(home), 'utf8')), {
9
+ allowLoopbackHttp: true
10
+ });
11
+ }
12
+ catch (cause) {
13
+ if (cause instanceof AgentError)
14
+ throw cause;
15
+ if (cause.code === 'ENOENT')
16
+ return { version: 1, models: [] };
17
+ throw new AgentError('MAR_AGENT_MODEL_CONFIG_INVALID', 'Model catalog cannot be read.', {
18
+ cause
19
+ });
20
+ }
21
+ }
22
+ export async function writeModelCatalog(home, catalog) {
23
+ const path = modelCatalogPath(home);
24
+ await mkdir(join(home, '.mar', 'agent'), { recursive: true });
25
+ const raw = {
26
+ version: 1,
27
+ ...(catalog.defaultModelId ? { defaultModelId: catalog.defaultModelId } : {}),
28
+ models: catalog.models.map(serializeModel)
29
+ };
30
+ parseCliModelCatalog(raw, { allowLoopbackHttp: true });
31
+ const temporary = `${path}.${randomUUID()}.tmp`;
32
+ await writeFile(temporary, `${JSON.stringify(raw, null, 2)}\n`, { mode: 0o600 });
33
+ await rename(temporary, path);
34
+ }
35
+ export function serializeModel(model) {
36
+ const { apiKey, credentialProvider, credentialSource, ...configuration } = model;
37
+ if (apiKey !== undefined) {
38
+ if (credentialProvider !== undefined || credentialSource !== undefined)
39
+ throw new AgentError('MAR_AGENT_MODEL_CONFIG_INVALID', 'Model credential sources are ambiguous.');
40
+ return { ...configuration, apiKey: apiKey.reveal() };
41
+ }
42
+ if (credentialSource !== undefined)
43
+ return {
44
+ ...configuration,
45
+ credential: { type: credentialSource }
46
+ };
47
+ throw new AgentError('MAR_AGENT_MODEL_CONFIG_INVALID', 'Dynamic model credentials cannot be persisted without an external credential marker.');
48
+ }
49
+ function parseCliModelCatalog(input, options = {}) {
50
+ if (!isRecord(input) || !Array.isArray(input.models))
51
+ return parseModelCatalog(input, options);
52
+ const externalCredentialModels = new Set();
53
+ const normalizedModels = input.models.map((model, index) => {
54
+ if (isRecord(model) && Object.hasOwn(model, 'highDensityCompaction')) {
55
+ if (typeof model.highDensityCompaction !== 'boolean')
56
+ throw invalidCatalog();
57
+ const { highDensityCompaction: _compaction, ...configuration } = model;
58
+ void _compaction;
59
+ model = configuration;
60
+ }
61
+ if (isRecord(model) && Object.hasOwn(model, 'responsesEncoding')) {
62
+ if (model.protocol !== 'OPENAI_RESPONSES' ||
63
+ (model.responsesEncoding !== 'STANDARD' && model.responsesEncoding !== 'LITE'))
64
+ throw invalidCatalog();
65
+ const { responsesEncoding: _encoding, ...configuration } = model;
66
+ void _encoding;
67
+ model = configuration;
68
+ }
69
+ if (!isRecord(model) || !Object.hasOwn(model, 'credential'))
70
+ return model;
71
+ const credential = model.credential;
72
+ if (!isRecord(credential) ||
73
+ credential.type !== 'CODEX_AUTH_FILE' ||
74
+ Object.keys(credential).length !== 1)
75
+ throw invalidCatalog();
76
+ if (Object.hasOwn(model, 'apiKey'))
77
+ throw invalidCatalog();
78
+ externalCredentialModels.add(index);
79
+ const { credential: _credential, ...configuration } = model;
80
+ void _credential;
81
+ return { ...configuration, apiKey: '__MAR_AGENT_EXTERNAL_CREDENTIAL__' };
82
+ });
83
+ const parsed = parseModelCatalog({ ...input, models: normalizedModels }, options);
84
+ return {
85
+ ...parsed,
86
+ models: parsed.models.map((model, index) => {
87
+ if (!externalCredentialModels.has(index))
88
+ return model;
89
+ if (model.protocol !== 'OPENAI_RESPONSES')
90
+ throw invalidCatalog();
91
+ const { apiKey: _apiKey, ...configuration } = model;
92
+ void _apiKey;
93
+ return { ...configuration, credentialSource: 'CODEX_AUTH_FILE' };
94
+ })
95
+ };
96
+ }
97
+ function isRecord(value) {
98
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
99
+ }
100
+ function invalidCatalog() {
101
+ return new AgentError('MAR_AGENT_MODEL_CONFIG_INVALID', 'Model catalog is invalid.');
102
+ }
@@ -1,4 +1,4 @@
1
- import { type ModelCredential, type ModelCredentialAcquireReason, type ModelCredentialProvider } from '../agent-core/model/configuration.js';
1
+ import { type ModelCredential, type ModelCredentialAcquireReason, type ModelCredentialProvider } from '../index.js';
2
2
  export declare class CodexAuthFileCredentialProvider implements ModelCredentialProvider {
3
3
  #private;
4
4
  constructor(path: string);
@@ -3,9 +3,8 @@ import { constants } from 'node:fs';
3
3
  import { lstat, open } from 'node:fs/promises';
4
4
  import { promisify } from 'node:util';
5
5
  import { z } from 'zod';
6
- import { MarAgentError } from '../agent-core/error.js';
7
- import { SecretValue } from '../agent-core/model/configuration.js';
8
- import { productUserAgent } from '../agent-core/model/product-user-agent.js';
6
+ import { AgentError, SecretValue } from '../index.js';
7
+ import { productUserAgent } from '../network/product-user-agent.js';
9
8
  const MAX_AUTH_FILE_BYTES = 1024 * 1024;
10
9
  const TOKEN_MAX_BYTES = 131_072;
11
10
  const AUTH_FALLBACK_LIFETIME_MS = 8 * 24 * 60 * 60 * 1000;
@@ -32,12 +31,12 @@ export class CodexAuthFileCredentialProvider {
32
31
  #closed = false;
33
32
  constructor(path) {
34
33
  if (!path)
35
- throw new MarAgentError('MAR_AGENT_CREDENTIAL_FILE_INVALID', 'Codex auth file path is required.');
34
+ throw new AgentError('MAR_AGENT_CREDENTIAL_FILE_INVALID', 'Codex auth file path is required.');
36
35
  this.#path = path;
37
36
  }
38
37
  async acquire(reason) {
39
38
  if (this.#closed)
40
- throw new MarAgentError('MAR_AGENT_CREDENTIAL_FILE_INVALID', 'Codex auth file provider is closed.');
39
+ throw new AgentError('MAR_AGENT_CREDENTIAL_FILE_INVALID', 'Codex auth file provider is closed.');
41
40
  const file = await readSecureAuthFile(this.#path);
42
41
  const force = reason === 'UNAUTHORIZED' ||
43
42
  (this.#cached !== undefined &&
@@ -184,7 +183,7 @@ foreach ($rule in $acl.Access) {
184
183
  throw unsafeFile();
185
184
  }
186
185
  catch (cause) {
187
- if (cause instanceof MarAgentError)
186
+ if (cause instanceof AgentError)
188
187
  throw cause;
189
188
  throw unsafeFile(cause);
190
189
  }
@@ -217,7 +216,7 @@ function parseAuthFile(content) {
217
216
  if (expiresAt === undefined)
218
217
  throw invalidFile();
219
218
  if (expiresAt <= Date.now())
220
- throw new MarAgentError('MAR_AGENT_MODEL_AUTH_FAILED', 'Codex auth file access credential is expired.');
219
+ throw new AgentError('MAR_AGENT_MODEL_AUTH_FAILED', 'Codex auth file access credential is expired.');
221
220
  void result.data.tokens.refresh_token;
222
221
  return {
223
222
  accessToken: result.data.tokens.access_token,
@@ -237,7 +236,7 @@ function jwtClaims(token) {
237
236
  return record(value);
238
237
  }
239
238
  catch (cause) {
240
- if (cause instanceof MarAgentError)
239
+ if (cause instanceof AgentError)
241
240
  throw cause;
242
241
  throw invalidFile(cause);
243
242
  }
@@ -265,8 +264,8 @@ function record(value) {
265
264
  : {};
266
265
  }
267
266
  function unsafeFile(cause) {
268
- return new MarAgentError('MAR_AGENT_CREDENTIAL_FILE_UNSAFE', 'Codex auth file permissions or file type are unsafe.', cause === undefined ? {} : { cause });
267
+ return new AgentError('MAR_AGENT_CREDENTIAL_FILE_UNSAFE', 'Codex auth file permissions or file type are unsafe.', cause === undefined ? {} : { cause });
269
268
  }
270
269
  function invalidFile(cause) {
271
- return new MarAgentError('MAR_AGENT_CREDENTIAL_FILE_INVALID', 'Codex auth file is invalid.', cause === undefined ? {} : { cause });
270
+ return new AgentError('MAR_AGENT_CREDENTIAL_FILE_INVALID', 'Codex auth file is invalid.', cause === undefined ? {} : { cause });
272
271
  }
package/dist/cli/main.js CHANGED
@@ -3,14 +3,10 @@ import { homedir } from 'node:os';
3
3
  import { resolve } from 'node:path';
4
4
  import { stdin, stdout } from 'node:process';
5
5
  import { createInterface } from 'node:readline/promises';
6
- import { describeMarAgentError, MarAgentError } from '../agent-core/error.js';
7
- import { LocalAgentHost } from '../agent-core/host/local-agent-host.js';
8
- import { AnthropicMessagesAdapter } from '../agent-core/model/anthropic-messages.js';
9
- import { readModelCatalog, writeModelCatalog } from '../agent-core/model/catalog-file.js';
10
- import { marAgentReasoningEffortSchema, resolveModelDefaultReasoningEffort, SecretValue } from '../agent-core/model/configuration.js';
11
- import { OpenAiResponsesAdapter } from '../agent-core/model/openai-responses.js';
12
- import { DEFAULT_COMPACTION_FOCUS } from '../agent-core/runtime/compaction/history.js';
13
- import { createMarAgent } from '../agent-core/sdk/agent.js';
6
+ import { describeAgentError } from '../error.js';
7
+ import { LocalAgentHost } from '../host.js';
8
+ import { readModelCatalog, writeModelCatalog } from './catalog-file.js';
9
+ import { AgentError, createAgent, agentReasoningEffortSchema, resolveModelDefaultReasoningEffort, SecretValue, testAgentModelTransport } from '../index.js';
14
10
  import { CodexAuthFileCredentialProvider } from './codex-auth-file.js';
15
11
  import { generateSessionTitle } from '../shared/auto-title.js';
16
12
  const HELP = `maragent - MAR coding agent
@@ -27,10 +23,10 @@ function takeOption(arguments_, name) {
27
23
  if (index < 0)
28
24
  return undefined;
29
25
  if (arguments_.indexOf(name, index + 1) >= 0)
30
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', `${name} cannot be repeated.`);
26
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', `${name} cannot be repeated.`);
31
27
  const value = arguments_[index + 1];
32
28
  if (!value)
33
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', `${name} requires a value.`);
29
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', `${name} requires a value.`);
34
30
  arguments_.splice(index, 2);
35
31
  return value;
36
32
  }
@@ -48,26 +44,26 @@ function booleanFlag(arguments_, enabled, disabled, fallback) {
48
44
  const on = takeFlag(arguments_, enabled);
49
45
  const off = takeFlag(arguments_, disabled);
50
46
  if (on && off)
51
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', `${enabled} and ${disabled} cannot be combined.`);
47
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', `${enabled} and ${disabled} cannot be combined.`);
52
48
  return on ? true : off ? false : fallback;
53
49
  }
54
50
  async function readApiKey() {
55
51
  if (stdin.isTTY)
56
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', '--api-key-stdin requires piped stdin.');
52
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', '--api-key-stdin requires piped stdin.');
57
53
  stdin.setEncoding('utf8');
58
54
  let value = '';
59
55
  for await (const chunk of stdin)
60
56
  value += chunk;
61
57
  if (!value.trim())
62
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', 'API key stdin was empty.');
58
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', 'API key stdin was empty.');
63
59
  return value.trim();
64
60
  }
65
61
  async function modelsCommand(home, arguments_, codexAuthFile) {
66
62
  if (arguments_.includes('--high-density-compaction') ||
67
63
  arguments_.includes('--no-high-density-compaction'))
68
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', 'High-density compaction is no longer a model option.');
64
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', 'High-density compaction is no longer a model option.');
69
65
  if (arguments_.includes('--responses-encoding'))
70
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', 'Responses encoding is no longer configurable.');
66
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', 'Responses encoding is no longer configurable.');
71
67
  const action = arguments_[1];
72
68
  const catalog = await loadCatalog(home);
73
69
  if (action === 'list') {
@@ -77,13 +73,13 @@ async function modelsCommand(home, arguments_, codexAuthFile) {
77
73
  }
78
74
  const id = arguments_[2];
79
75
  if (!id)
80
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', 'Model id is required.');
76
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', 'Model id is required.');
81
77
  const existing = catalog.models.find((model) => model.id === id);
82
78
  if (action === 'remove') {
83
79
  if (!existing)
84
- throw new MarAgentError('MAR_AGENT_MODEL_NOT_FOUND', 'Model was not found.');
80
+ throw new AgentError('MAR_AGENT_MODEL_NOT_FOUND', 'Model was not found.');
85
81
  if (!takeFlag(arguments_, '--yes') && !stdin.isTTY)
86
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', 'Non-interactive removal requires --yes.');
82
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', 'Non-interactive removal requires --yes.');
87
83
  await writeModelCatalog(home, {
88
84
  version: 1,
89
85
  models: catalog.models.filter((model) => model.id !== id),
@@ -95,17 +91,11 @@ async function modelsCommand(home, arguments_, codexAuthFile) {
95
91
  }
96
92
  if (action === 'test') {
97
93
  if (!existing)
98
- throw new MarAgentError('MAR_AGENT_MODEL_NOT_FOUND', 'Model was not found.');
94
+ throw new AgentError('MAR_AGENT_MODEL_NOT_FOUND', 'Model was not found.');
99
95
  assertExternalCredentialAvailable(existing, codexAuthFile);
100
96
  const runtime = runtimeModels([existing], codexAuthFile);
101
- const adapter = existing.protocol === 'OPENAI_RESPONSES'
102
- ? new OpenAiResponsesAdapter(runtime.models[0])
103
- : new AnthropicMessagesAdapter(runtime.models[0]);
104
97
  try {
105
- let response = '';
106
- for await (const event of adapter.start({ system: 'Reply OK.', messages: [{ role: 'user', content: 'Reply OK.' }], tools: [] }, AbortSignal.timeout(30_000)))
107
- if (event.type === 'text.completed')
108
- response = event.text;
98
+ const { response } = await testAgentModelTransport(runtime.models[0], AbortSignal.timeout(30_000), { system: 'Reply OK.', prompt: 'Reply OK.' });
109
99
  stdout.write(`${JSON.stringify({ success: true, modelId: id, response: response.slice(0, 80) })}\n`);
110
100
  return;
111
101
  }
@@ -114,37 +104,37 @@ async function modelsCommand(home, arguments_, codexAuthFile) {
114
104
  }
115
105
  }
116
106
  if (action !== 'add' && action !== 'edit')
117
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', 'Unknown model command.');
107
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', 'Unknown model command.');
118
108
  if (action === 'add' && existing)
119
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', 'Model id already exists.');
109
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', 'Model id already exists.');
120
110
  if (action === 'edit' && !existing)
121
- throw new MarAgentError('MAR_AGENT_MODEL_NOT_FOUND', 'Model was not found.');
111
+ throw new AgentError('MAR_AGENT_MODEL_NOT_FOUND', 'Model was not found.');
122
112
  const option = (name, fallback) => takeOption(arguments_, name) ?? fallback;
123
113
  const integer = (name, fallback) => {
124
114
  const raw = takeOption(arguments_, name);
125
115
  const value = raw === undefined ? fallback : Number(raw);
126
116
  if (!Number.isSafeInteger(value) || value <= 0)
127
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', `${name} is invalid.`);
117
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', `${name} is invalid.`);
128
118
  return value;
129
119
  };
130
120
  const protocol = option('--protocol', existing?.protocol ?? 'ANTHROPIC_MESSAGES');
131
121
  if (protocol !== 'OPENAI_RESPONSES' && protocol !== 'ANTHROPIC_MESSAGES')
132
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', '--protocol is invalid.');
122
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', '--protocol is invalid.');
133
123
  const required = (value, name) => {
134
124
  if (!value)
135
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', `${name} is required.`);
125
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', `${name} is required.`);
136
126
  return value;
137
127
  };
138
128
  const credential = option('--credential', existing?.credentialSource === 'CODEX_AUTH_FILE' ? 'codex-auth-file' : 'api-key') ?? 'api-key';
139
129
  if (credential !== 'api-key' && credential !== 'codex-auth-file')
140
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', '--credential is invalid.');
130
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', '--credential is invalid.');
141
131
  const hasFastModeOption = arguments_.includes('--fast-mode') || arguments_.includes('--no-fast-mode');
142
132
  const fastMode = booleanFlag(arguments_, '--fast-mode', '--no-fast-mode', credential === 'codex-auth-file' ? (existing?.fastMode ?? false) : false);
143
133
  if (hasFastModeOption && (protocol !== 'OPENAI_RESPONSES' || credential !== 'codex-auth-file'))
144
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', '--fast-mode requires Codex.');
134
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', '--fast-mode requires Codex.');
145
135
  const readsApiKey = takeFlag(arguments_, '--api-key-stdin');
146
136
  if (credential === 'codex-auth-file' && readsApiKey)
147
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', '--api-key-stdin cannot be combined with an external credential.');
137
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', '--api-key-stdin cannot be combined with an external credential.');
148
138
  const responsesTransport = parseResponsesTransport(option('--responses-transport'), protocol, existing?.responsesTransport);
149
139
  const reasoningEffortsOption = option('--reasoning-efforts');
150
140
  const reasoningEfforts = reasoningEffortsOption === undefined
@@ -208,15 +198,15 @@ async function modelsCommand(home, arguments_, codexAuthFile) {
208
198
  });
209
199
  }
210
200
  function parseReasoningEffort(value, optionName) {
211
- const parsed = marAgentReasoningEffortSchema.safeParse(value.trim());
201
+ const parsed = agentReasoningEffortSchema.safeParse(value.trim());
212
202
  if (!parsed.success)
213
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', `${optionName} is invalid.`);
203
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', `${optionName} is invalid.`);
214
204
  return parsed.data;
215
205
  }
216
206
  function parseResponsesTransport(value, protocol, existing) {
217
207
  if (protocol !== 'OPENAI_RESPONSES') {
218
208
  if (value !== undefined)
219
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', '--responses-transport requires OPENAI_RESPONSES.');
209
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', '--responses-transport requires OPENAI_RESPONSES.');
220
210
  return undefined;
221
211
  }
222
212
  const selected = value?.toLowerCase();
@@ -228,7 +218,7 @@ function parseResponsesTransport(value, protocol, existing) {
228
218
  return { transport: 'HTTP', httpVersion: '2' };
229
219
  if (selected === 'http1' || selected === 'http1.1')
230
220
  return { transport: 'HTTP', httpVersion: '1.1' };
231
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', '--responses-transport is invalid.');
221
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', '--responses-transport is invalid.');
232
222
  }
233
223
  async function main() {
234
224
  const arguments_ = process.argv.slice(2);
@@ -254,17 +244,17 @@ async function main() {
254
244
  if (permissionModeOption !== undefined &&
255
245
  permissionModeOption !== 'auto' &&
256
246
  permissionModeOption !== 'full-access')
257
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', '--permission-mode must be auto or full-access.');
247
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', '--permission-mode must be auto or full-access.');
258
248
  const permissionMode = permissionModeOption;
259
249
  if (legacyAccess !== undefined && legacyAccess !== 'full-access')
260
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', 'The deprecated --access option only accepts full-access.');
250
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', 'The deprecated --access option only accepts full-access.');
261
251
  const format = takeOption(arguments_, '--format') ?? 'text';
262
252
  const command = arguments_[0];
263
253
  const selectedModel = catalog.models.find((model) => model.id === modelId && model.enabled && model.conversationModel !== false);
264
254
  if (selectedModel !== undefined)
265
255
  assertExternalCredentialAvailable(selectedModel, codexAuthFile);
266
256
  if (reasoningEffort && selectedModel && !selectedModel.reasoningEfforts.includes(reasoningEffort))
267
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', `Reasoning effort "${reasoningEffort}" is not supported by model "${selectedModel.id}".`);
257
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', `Reasoning effort "${reasoningEffort}" is not supported by model "${selectedModel.id}".`);
268
258
  const interactive = command !== 'run';
269
259
  let prompt = command === 'run' ? arguments_.slice(1).join(' ') : '';
270
260
  // `run` does not need stdin until a question occurs. Create
@@ -277,7 +267,7 @@ async function main() {
277
267
  workspace,
278
268
  question: async (request) => {
279
269
  if (!stdin.isTTY)
280
- throw new MarAgentError('MAR_AGENT_USER_INPUT_UNAVAILABLE', 'Interactive input is unavailable.');
270
+ throw new AgentError('MAR_AGENT_USER_INPUT_UNAVAILABLE', 'Interactive input is unavailable.');
281
271
  const answers = {};
282
272
  for (const question of request.questions) {
283
273
  const value = question;
@@ -288,7 +278,7 @@ async function main() {
288
278
  }
289
279
  });
290
280
  const runtime = runtimeModels(catalog.models, codexAuthFile);
291
- const agent = await createMarAgent({
281
+ const agent = await createAgent({
292
282
  mode: 'normal',
293
283
  host,
294
284
  models: runtime.models,
@@ -301,22 +291,22 @@ async function main() {
301
291
  }
302
292
  if (command === 'sessions' && arguments_[1] === 'delete' && arguments_[2]) {
303
293
  if (!takeFlag(arguments_, '--yes') && !stdin.isTTY)
304
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', 'Non-interactive deletion requires --yes.');
294
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', 'Non-interactive deletion requires --yes.');
305
295
  await agent.deleteSession(arguments_[2]);
306
296
  return;
307
297
  }
308
298
  if (command === 'sessions')
309
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', 'Unknown sessions command.');
299
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', 'Unknown sessions command.');
310
300
  let resumeId = command === 'resume' ? arguments_[1] : undefined;
311
301
  if (command === 'resume' && !resumeId) {
312
302
  if (!stdin.isTTY)
313
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', 'resume requires a session id.');
303
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', 'resume requires a session id.');
314
304
  const listed = (await agent.listSessions());
315
305
  for (const item of listed.sessions ?? [])
316
306
  stdout.write(`${item.id}\t${item.title}\t${item.lastActivityAt}\n`);
317
307
  resumeId = (await requireTerminal().question('Session ID: ')).trim();
318
308
  if (!resumeId)
319
- throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', 'Session id is required.');
309
+ throw new AgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', 'Session id is required.');
320
310
  }
321
311
  const session = resumeId
322
312
  ? await agent.openSession(resumeId)
@@ -346,12 +336,12 @@ async function main() {
346
336
  if (!prompt.trim())
347
337
  break;
348
338
  const invocation = parseExecutionInvocation(prompt);
349
- const runInput = {
339
+ const executionOptions = {
350
340
  ...(permissionMode === undefined ? {} : { permissionMode }),
351
- prompt: invocation.prompt,
352
341
  ...(modelId === undefined ? {} : { modelId }),
353
342
  ...(reasoningEffort === undefined ? {} : { reasoningEffort })
354
343
  };
344
+ const runInput = { ...executionOptions, prompt: invocation.prompt };
355
345
  const metadata = !resumeId && invocation.mode !== 'compact'
356
346
  ? await agent.getSession(session.id).catch(() => undefined)
357
347
  : undefined;
@@ -360,7 +350,7 @@ async function main() {
360
350
  const handle = invocation.mode === 'plan'
361
351
  ? session.plan(runInput)
362
352
  : invocation.mode === 'compact'
363
- ? session.compact(runInput)
353
+ ? session.compact(invocation.prompt ? runInput : executionOptions)
364
354
  : session.run(runInput);
365
355
  activeHandle = handle;
366
356
  for await (const event of handle) {
@@ -441,7 +431,7 @@ function runtimeModels(models, codexAuthFile) {
441
431
  }
442
432
  function assertExternalCredentialAvailable(model, codexAuthFile) {
443
433
  if (model.credentialSource === 'CODEX_AUTH_FILE' && codexAuthFile === undefined)
444
- throw new MarAgentError('MAR_AGENT_MODEL_AUTH_FAILED', 'Codex auth file is required for the selected model.');
434
+ throw new AgentError('MAR_AGENT_MODEL_AUTH_FAILED', 'Codex auth file is required for the selected model.');
445
435
  }
446
436
  function cliExitCode(code) {
447
437
  if (code === undefined)
@@ -468,11 +458,11 @@ function parseExecutionInvocation(input) {
468
458
  prompt: argument ||
469
459
  (mode === 'plan'
470
460
  ? 'Investigate the current objective, resolve discoverable uncertainty, and produce an executable implementation and verification plan without claiming the work is complete.'
471
- : DEFAULT_COMPACTION_FOCUS)
461
+ : '')
472
462
  };
473
463
  }
474
464
  main().catch((error) => {
475
- const diagnostic = describeMarAgentError(error, 'MAR_AGENT_CLI_FAILED', 'CLI command failed.');
465
+ const diagnostic = describeAgentError(error, 'MAR_AGENT_CLI_FAILED', 'CLI command failed.');
476
466
  process.stderr.write(`${diagnostic.code}: ${diagnostic.message}\n`);
477
467
  process.exitCode = cliExitCode(diagnostic.code);
478
468
  });
@@ -0,0 +1,15 @@
1
+ export declare class AgentError extends Error {
2
+ readonly code: string;
3
+ readonly publicMessage: string;
4
+ readonly details: Readonly<Record<string, unknown>> | undefined;
5
+ readonly retryable: boolean;
6
+ constructor(code: string, message: string, options?: {
7
+ details?: Readonly<Record<string, unknown>>;
8
+ retryable?: boolean;
9
+ cause?: unknown;
10
+ });
11
+ }
12
+ export declare function describeAgentError(error: unknown, fallbackCode: string, fallbackMessage?: string, includeCauses?: boolean): {
13
+ code: string;
14
+ message: string;
15
+ };
package/dist/error.js ADDED
@@ -0,0 +1,74 @@
1
+ export class AgentError extends Error {
2
+ code;
3
+ publicMessage;
4
+ details;
5
+ retryable;
6
+ constructor(code, message, options = {}) {
7
+ super(`${code}: ${message}`, { cause: options.cause });
8
+ this.name = 'MarAgentError';
9
+ this.code = code;
10
+ this.publicMessage = message;
11
+ this.details = options.details;
12
+ this.retryable = options.retryable ?? false;
13
+ }
14
+ }
15
+ const MAX_ERROR_MESSAGE_CHARACTERS = 1_000;
16
+ export function describeAgentError(error, fallbackCode, fallbackMessage = 'MAR Agent operation failed.', includeCauses = true) {
17
+ const code = diagnosticCode(error) ?? fallbackCode;
18
+ const messages = [];
19
+ const seen = new Set();
20
+ let current = error;
21
+ while (current !== undefined && current !== null && !seen.has(current) && messages.length < 4) {
22
+ seen.add(current);
23
+ const currentCode = diagnosticCode(current);
24
+ const message = diagnosticMessage(current, currentCode);
25
+ const summary = message && currentCode !== undefined && currentCode !== code
26
+ ? `${currentCode}: ${message}`
27
+ : message;
28
+ if (summary && !messages.includes(summary))
29
+ messages.push(summary);
30
+ if (!includeCauses)
31
+ break;
32
+ current = diagnosticCause(current);
33
+ }
34
+ return {
35
+ code,
36
+ message: truncateErrorMessage(messages.join(' Caused by: ') || fallbackMessage)
37
+ };
38
+ }
39
+ function diagnosticCode(value) {
40
+ if (value instanceof AgentError)
41
+ return value.code;
42
+ if (value === null || typeof value !== 'object' || !('code' in value))
43
+ return undefined;
44
+ const code = value.code;
45
+ return typeof code === 'string' && code.trim().length > 0 ? code.trim().slice(0, 80) : undefined;
46
+ }
47
+ function diagnosticMessage(value, code) {
48
+ const message = value instanceof AgentError
49
+ ? value.publicMessage
50
+ : value instanceof Error
51
+ ? value.message
52
+ : value !== null &&
53
+ typeof value === 'object' &&
54
+ 'message' in value &&
55
+ typeof value.message === 'string'
56
+ ? value.message
57
+ : typeof value === 'string'
58
+ ? value
59
+ : undefined;
60
+ const normalized = message?.trim();
61
+ if (!normalized)
62
+ return undefined;
63
+ return code !== undefined && normalized.startsWith(`${code}: `)
64
+ ? normalized.slice(code.length + 2)
65
+ : normalized;
66
+ }
67
+ function diagnosticCause(value) {
68
+ if (value === null || typeof value !== 'object' || !('cause' in value))
69
+ return undefined;
70
+ return value.cause;
71
+ }
72
+ function truncateErrorMessage(value) {
73
+ return [...value].slice(0, MAX_ERROR_MESSAGE_CHARACTERS).join('');
74
+ }