@geminilight/mindos 1.1.25 → 1.1.28

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 (359) hide show
  1. package/dist/agent/bridges/index.d.ts +3 -0
  2. package/dist/agent/bridges/index.d.ts.map +1 -0
  3. package/dist/agent/bridges/index.js +3 -0
  4. package/dist/agent/bridges/index.js.map +1 -0
  5. package/dist/agent/bridges/runtime-permission-bridge.d.ts +34 -0
  6. package/dist/agent/bridges/runtime-permission-bridge.d.ts.map +1 -0
  7. package/dist/agent/bridges/runtime-permission-bridge.js +284 -0
  8. package/dist/agent/bridges/runtime-permission-bridge.js.map +1 -0
  9. package/dist/agent/bridges/user-question-bridge.d.ts +90 -0
  10. package/dist/agent/bridges/user-question-bridge.d.ts.map +1 -0
  11. package/dist/agent/bridges/user-question-bridge.js +260 -0
  12. package/dist/agent/bridges/user-question-bridge.js.map +1 -0
  13. package/dist/agent/index.d.ts +6 -7
  14. package/dist/agent/index.d.ts.map +1 -1
  15. package/dist/agent/index.js +6 -7
  16. package/dist/agent/index.js.map +1 -1
  17. package/dist/agent/ledger/index.d.ts +5 -0
  18. package/dist/agent/ledger/index.d.ts.map +1 -0
  19. package/dist/agent/ledger/index.js +5 -0
  20. package/dist/agent/ledger/index.js.map +1 -0
  21. package/dist/agent/ledger/run-cancellation.d.ts +13 -0
  22. package/dist/agent/ledger/run-cancellation.d.ts.map +1 -0
  23. package/dist/agent/ledger/run-cancellation.js +97 -0
  24. package/dist/agent/ledger/run-cancellation.js.map +1 -0
  25. package/dist/agent/ledger/run-ledger-types.d.ts +197 -0
  26. package/dist/agent/ledger/run-ledger-types.d.ts.map +1 -0
  27. package/dist/agent/ledger/run-ledger-types.js +9 -0
  28. package/dist/agent/ledger/run-ledger-types.js.map +1 -0
  29. package/dist/agent/ledger/run-ledger.d.ts +44 -0
  30. package/dist/agent/ledger/run-ledger.d.ts.map +1 -0
  31. package/dist/agent/ledger/run-ledger.js +814 -0
  32. package/dist/agent/ledger/run-ledger.js.map +1 -0
  33. package/dist/agent/ledger/run-timeline-events.d.ts +3 -0
  34. package/dist/agent/ledger/run-timeline-events.d.ts.map +1 -0
  35. package/dist/agent/ledger/run-timeline-events.js +239 -0
  36. package/dist/agent/ledger/run-timeline-events.js.map +1 -0
  37. package/dist/agent/mindos-pi/extension/extension-tools.d.ts +16 -0
  38. package/dist/agent/mindos-pi/extension/extension-tools.d.ts.map +1 -0
  39. package/dist/agent/mindos-pi/extension/extension-tools.js +115 -0
  40. package/dist/agent/mindos-pi/extension/extension-tools.js.map +1 -0
  41. package/dist/agent/mindos-pi/extension/index.d.ts +3 -0
  42. package/dist/agent/mindos-pi/extension/index.d.ts.map +1 -0
  43. package/dist/agent/mindos-pi/extension/index.js +3 -0
  44. package/dist/agent/mindos-pi/extension/index.js.map +1 -0
  45. package/dist/agent/mindos-pi/extension/kb-extension.d.ts +38 -0
  46. package/dist/agent/mindos-pi/extension/kb-extension.d.ts.map +1 -0
  47. package/dist/agent/mindos-pi/extension/kb-extension.js +140 -0
  48. package/dist/agent/mindos-pi/extension/kb-extension.js.map +1 -0
  49. package/dist/agent/mindos-pi/index.d.ts +5 -0
  50. package/dist/agent/mindos-pi/index.d.ts.map +1 -0
  51. package/dist/agent/mindos-pi/index.js +5 -0
  52. package/dist/agent/mindos-pi/index.js.map +1 -0
  53. package/dist/agent/mindos-pi/prompt.d.ts +3 -0
  54. package/dist/agent/mindos-pi/prompt.d.ts.map +1 -0
  55. package/dist/agent/mindos-pi/prompt.js +22 -0
  56. package/dist/agent/mindos-pi/prompt.js.map +1 -0
  57. package/dist/agent/mindos-pi/resource-types.d.ts +27 -0
  58. package/dist/agent/mindos-pi/resource-types.d.ts.map +1 -0
  59. package/dist/agent/mindos-pi/resource-types.js +2 -0
  60. package/dist/agent/mindos-pi/resource-types.js.map +1 -0
  61. package/dist/agent/mindos-pi/runtime.d.ts +10 -0
  62. package/dist/agent/mindos-pi/runtime.d.ts.map +1 -0
  63. package/dist/agent/mindos-pi/runtime.js +31 -0
  64. package/dist/agent/mindos-pi/runtime.js.map +1 -0
  65. package/dist/agent/pi/extension-tools.d.ts +2 -0
  66. package/dist/agent/pi/extension-tools.d.ts.map +1 -0
  67. package/dist/agent/pi/extension-tools.js +2 -0
  68. package/dist/agent/pi/extension-tools.js.map +1 -0
  69. package/dist/agent/pi/index.d.ts +2 -0
  70. package/dist/agent/pi/index.d.ts.map +1 -0
  71. package/dist/agent/pi/index.js +2 -0
  72. package/dist/agent/pi/index.js.map +1 -0
  73. package/dist/agent/pi/resource-types.d.ts +2 -0
  74. package/dist/agent/pi/resource-types.d.ts.map +1 -0
  75. package/dist/agent/pi/resource-types.js +2 -0
  76. package/dist/agent/pi/resource-types.js.map +1 -0
  77. package/dist/agent/pi/runtime.d.ts +2 -0
  78. package/dist/agent/pi/runtime.d.ts.map +1 -0
  79. package/dist/agent/pi/runtime.js +2 -0
  80. package/dist/agent/pi/runtime.js.map +1 -0
  81. package/dist/agent/prompt/base-prompt.d.ts.map +1 -1
  82. package/dist/agent/prompt/base-prompt.js +24 -6
  83. package/dist/agent/prompt/base-prompt.js.map +1 -1
  84. package/dist/agent/prompt/context-prompt.d.ts +24 -0
  85. package/dist/agent/prompt/context-prompt.d.ts.map +1 -1
  86. package/dist/agent/prompt/context-prompt.js +15 -38
  87. package/dist/agent/prompt/context-prompt.js.map +1 -1
  88. package/dist/agent/prompt/index.d.ts +1 -1
  89. package/dist/agent/prompt/index.d.ts.map +1 -1
  90. package/dist/agent/prompt/index.js +1 -1
  91. package/dist/agent/prompt/index.js.map +1 -1
  92. package/dist/agent/result-reducer.d.ts +1 -1
  93. package/dist/agent/result-reducer.d.ts.map +1 -1
  94. package/dist/agent/run-cancellation.d.ts +1 -12
  95. package/dist/agent/run-cancellation.d.ts.map +1 -1
  96. package/dist/agent/run-cancellation.js +1 -96
  97. package/dist/agent/run-cancellation.js.map +1 -1
  98. package/dist/agent/run-ledger-types.d.ts +1 -196
  99. package/dist/agent/run-ledger-types.d.ts.map +1 -1
  100. package/dist/agent/run-ledger-types.js +1 -8
  101. package/dist/agent/run-ledger-types.js.map +1 -1
  102. package/dist/agent/run-ledger.d.ts +1 -43
  103. package/dist/agent/run-ledger.d.ts.map +1 -1
  104. package/dist/agent/run-ledger.js +1 -813
  105. package/dist/agent/run-ledger.js.map +1 -1
  106. package/dist/agent/run-timeline-events.d.ts +1 -2
  107. package/dist/agent/run-timeline-events.d.ts.map +1 -1
  108. package/dist/agent/run-timeline-events.js +1 -238
  109. package/dist/agent/run-timeline-events.js.map +1 -1
  110. package/dist/agent/runtime/adapters/index.d.ts +2 -0
  111. package/dist/agent/runtime/adapters/index.d.ts.map +1 -0
  112. package/dist/agent/runtime/adapters/index.js +2 -0
  113. package/dist/agent/runtime/adapters/index.js.map +1 -0
  114. package/dist/agent/runtime/adapters/mindos.d.ts +21 -0
  115. package/dist/agent/runtime/adapters/mindos.d.ts.map +1 -0
  116. package/dist/agent/runtime/adapters/mindos.js +14 -0
  117. package/dist/agent/runtime/adapters/mindos.js.map +1 -0
  118. package/dist/agent/runtime/attachments.d.ts +37 -0
  119. package/dist/agent/runtime/attachments.d.ts.map +1 -0
  120. package/dist/agent/runtime/attachments.js +187 -0
  121. package/dist/agent/runtime/attachments.js.map +1 -0
  122. package/dist/agent/runtime/capabilities.d.ts +10 -0
  123. package/dist/agent/runtime/capabilities.d.ts.map +1 -0
  124. package/dist/agent/runtime/capabilities.js +100 -0
  125. package/dist/agent/runtime/capabilities.js.map +1 -0
  126. package/dist/agent/runtime/child-process.d.ts +21 -0
  127. package/dist/agent/runtime/child-process.d.ts.map +1 -0
  128. package/dist/agent/runtime/child-process.js +29 -0
  129. package/dist/agent/runtime/child-process.js.map +1 -0
  130. package/dist/agent/runtime/claude-code-cli.d.ts +40 -0
  131. package/dist/agent/runtime/claude-code-cli.d.ts.map +1 -0
  132. package/dist/agent/runtime/claude-code-cli.js +288 -0
  133. package/dist/agent/runtime/claude-code-cli.js.map +1 -0
  134. package/dist/agent/runtime/claude-code-sdk.d.ts +62 -0
  135. package/dist/agent/runtime/claude-code-sdk.d.ts.map +1 -0
  136. package/dist/agent/runtime/claude-code-sdk.js +613 -0
  137. package/dist/agent/runtime/claude-code-sdk.js.map +1 -0
  138. package/dist/agent/runtime/codex-app-server.d.ts +172 -0
  139. package/dist/agent/runtime/codex-app-server.d.ts.map +1 -0
  140. package/dist/agent/runtime/codex-app-server.js +700 -0
  141. package/dist/agent/runtime/codex-app-server.js.map +1 -0
  142. package/dist/agent/runtime/codex-env.d.ts +42 -0
  143. package/dist/agent/runtime/codex-env.d.ts.map +1 -0
  144. package/dist/agent/runtime/codex-env.js +290 -0
  145. package/dist/agent/runtime/codex-env.js.map +1 -0
  146. package/dist/agent/runtime/descriptors.d.ts +19 -0
  147. package/dist/agent/runtime/descriptors.d.ts.map +1 -0
  148. package/dist/agent/runtime/descriptors.js +143 -0
  149. package/dist/agent/runtime/descriptors.js.map +1 -0
  150. package/dist/agent/runtime/detection.d.ts +15 -0
  151. package/dist/agent/runtime/detection.d.ts.map +1 -0
  152. package/dist/agent/runtime/detection.js +124 -0
  153. package/dist/agent/runtime/detection.js.map +1 -0
  154. package/dist/agent/runtime/index.d.ts +15 -0
  155. package/dist/agent/runtime/index.d.ts.map +1 -0
  156. package/dist/agent/runtime/index.js +15 -0
  157. package/dist/agent/runtime/index.js.map +1 -0
  158. package/dist/agent/runtime/registry.d.ts +152 -0
  159. package/dist/agent/runtime/registry.d.ts.map +1 -0
  160. package/dist/agent/runtime/registry.js +84 -0
  161. package/dist/agent/runtime/registry.js.map +1 -0
  162. package/dist/agent/runtime/run.d.ts +129 -0
  163. package/dist/agent/runtime/run.d.ts.map +1 -0
  164. package/dist/agent/runtime/run.js +739 -0
  165. package/dist/agent/runtime/run.js.map +1 -0
  166. package/dist/agent/runtime/runtime-env.d.ts +28 -0
  167. package/dist/agent/runtime/runtime-env.d.ts.map +1 -0
  168. package/dist/agent/runtime/runtime-env.js +66 -0
  169. package/dist/agent/runtime/runtime-env.js.map +1 -0
  170. package/dist/agent/runtime/runtime-errors.d.ts +20 -0
  171. package/dist/agent/runtime/runtime-errors.d.ts.map +1 -0
  172. package/dist/agent/runtime/runtime-errors.js +95 -0
  173. package/dist/agent/runtime/runtime-errors.js.map +1 -0
  174. package/dist/agent/runtime-permission-bridge.d.ts +1 -33
  175. package/dist/agent/runtime-permission-bridge.d.ts.map +1 -1
  176. package/dist/agent/runtime-permission-bridge.js +1 -283
  177. package/dist/agent/runtime-permission-bridge.js.map +1 -1
  178. package/dist/agent/selected-skills.d.ts +8 -0
  179. package/dist/agent/selected-skills.d.ts.map +1 -0
  180. package/dist/agent/selected-skills.js +27 -0
  181. package/dist/agent/selected-skills.js.map +1 -0
  182. package/dist/agent/session/index.d.ts +618 -0
  183. package/dist/agent/session/index.d.ts.map +1 -0
  184. package/dist/agent/session/index.js +1330 -0
  185. package/dist/agent/session/index.js.map +1 -0
  186. package/dist/agent/session/redaction.d.ts +3 -0
  187. package/dist/agent/session/redaction.d.ts.map +1 -0
  188. package/dist/agent/session/redaction.js +47 -0
  189. package/dist/agent/session/redaction.js.map +1 -0
  190. package/dist/agent/stream/index.d.ts +3 -0
  191. package/dist/agent/stream/index.d.ts.map +1 -0
  192. package/dist/agent/stream/index.js +3 -0
  193. package/dist/agent/stream/index.js.map +1 -0
  194. package/dist/agent/stream/stream-consumer.d.ts +65 -0
  195. package/dist/agent/stream/stream-consumer.d.ts.map +1 -0
  196. package/dist/agent/stream/stream-consumer.js +664 -0
  197. package/dist/agent/stream/stream-consumer.js.map +1 -0
  198. package/dist/agent/stream/stream-message-types.d.ts +128 -0
  199. package/dist/agent/stream/stream-message-types.d.ts.map +1 -0
  200. package/dist/agent/stream/stream-message-types.js +14 -0
  201. package/dist/agent/stream/stream-message-types.js.map +1 -0
  202. package/dist/agent/stream-consumer.d.ts +1 -64
  203. package/dist/agent/stream-consumer.d.ts.map +1 -1
  204. package/dist/agent/stream-consumer.js +1 -663
  205. package/dist/agent/stream-consumer.js.map +1 -1
  206. package/dist/agent/stream-message-types.d.ts +1 -137
  207. package/dist/agent/stream-message-types.d.ts.map +1 -1
  208. package/dist/agent/stream-message-types.js +1 -13
  209. package/dist/agent/stream-message-types.js.map +1 -1
  210. package/dist/agent/subagent/index.d.ts +3 -0
  211. package/dist/agent/subagent/index.d.ts.map +1 -0
  212. package/dist/agent/subagent/index.js +3 -0
  213. package/dist/agent/subagent/index.js.map +1 -0
  214. package/dist/agent/subagent/subagent-ledger-extension.d.ts +36 -0
  215. package/dist/agent/subagent/subagent-ledger-extension.d.ts.map +1 -0
  216. package/dist/agent/subagent/subagent-ledger-extension.js +572 -0
  217. package/dist/agent/subagent/subagent-ledger-extension.js.map +1 -0
  218. package/dist/agent/subagent/subagent-orchestrator.d.ts +62 -0
  219. package/dist/agent/subagent/subagent-orchestrator.d.ts.map +1 -0
  220. package/dist/agent/subagent/subagent-orchestrator.js +350 -0
  221. package/dist/agent/subagent/subagent-orchestrator.js.map +1 -0
  222. package/dist/agent/subagent-ledger-extension.d.ts +1 -35
  223. package/dist/agent/subagent-ledger-extension.d.ts.map +1 -1
  224. package/dist/agent/subagent-ledger-extension.js +1 -571
  225. package/dist/agent/subagent-ledger-extension.js.map +1 -1
  226. package/dist/agent/subagent-orchestrator.d.ts +1 -61
  227. package/dist/agent/subagent-orchestrator.d.ts.map +1 -1
  228. package/dist/agent/subagent-orchestrator.js +1 -349
  229. package/dist/agent/subagent-orchestrator.js.map +1 -1
  230. package/dist/agent/tool/executable-tool.d.ts +12 -0
  231. package/dist/agent/tool/executable-tool.d.ts.map +1 -0
  232. package/dist/agent/tool/executable-tool.js +2 -0
  233. package/dist/agent/tool/executable-tool.js.map +1 -0
  234. package/dist/agent/tool/index.d.ts +1 -1
  235. package/dist/agent/tool/index.d.ts.map +1 -1
  236. package/dist/agent/tool/index.js +1 -1
  237. package/dist/agent/tool/index.js.map +1 -1
  238. package/dist/agent/tool/kb-extension.d.ts +1 -37
  239. package/dist/agent/tool/kb-extension.d.ts.map +1 -1
  240. package/dist/agent/tool/kb-extension.js +1 -139
  241. package/dist/agent/tool/kb-extension.js.map +1 -1
  242. package/dist/agent/tool/permission-policy.d.ts +1 -1
  243. package/dist/agent/tool/permission-policy.d.ts.map +1 -1
  244. package/dist/agent/tool/permission-policy.js +0 -1
  245. package/dist/agent/tool/permission-policy.js.map +1 -1
  246. package/dist/agent/user-question-bridge.d.ts +1 -89
  247. package/dist/agent/user-question-bridge.d.ts.map +1 -1
  248. package/dist/agent/user-question-bridge.js +1 -259
  249. package/dist/agent/user-question-bridge.js.map +1 -1
  250. package/dist/agent-runtime/adapters/index.d.ts +2 -0
  251. package/dist/agent-runtime/adapters/index.d.ts.map +1 -0
  252. package/dist/agent-runtime/adapters/index.js +2 -0
  253. package/dist/agent-runtime/adapters/index.js.map +1 -0
  254. package/dist/agent-runtime/adapters/mindos.d.ts +2 -0
  255. package/dist/agent-runtime/adapters/mindos.d.ts.map +1 -0
  256. package/dist/agent-runtime/adapters/mindos.js +2 -0
  257. package/dist/agent-runtime/adapters/mindos.js.map +1 -0
  258. package/dist/agent-runtime/capabilities.d.ts +1 -9
  259. package/dist/agent-runtime/capabilities.d.ts.map +1 -1
  260. package/dist/agent-runtime/capabilities.js +1 -99
  261. package/dist/agent-runtime/capabilities.js.map +1 -1
  262. package/dist/agent-runtime/child-process.d.ts +1 -20
  263. package/dist/agent-runtime/child-process.d.ts.map +1 -1
  264. package/dist/agent-runtime/child-process.js +1 -28
  265. package/dist/agent-runtime/child-process.js.map +1 -1
  266. package/dist/agent-runtime/claude-code-cli.d.ts +1 -35
  267. package/dist/agent-runtime/claude-code-cli.d.ts.map +1 -1
  268. package/dist/agent-runtime/claude-code-cli.js +1 -287
  269. package/dist/agent-runtime/claude-code-cli.js.map +1 -1
  270. package/dist/agent-runtime/claude-code-sdk.d.ts +1 -40
  271. package/dist/agent-runtime/claude-code-sdk.d.ts.map +1 -1
  272. package/dist/agent-runtime/claude-code-sdk.js +1 -571
  273. package/dist/agent-runtime/claude-code-sdk.js.map +1 -1
  274. package/dist/agent-runtime/codex-app-server.d.ts +1 -157
  275. package/dist/agent-runtime/codex-app-server.d.ts.map +1 -1
  276. package/dist/agent-runtime/codex-app-server.js +1 -665
  277. package/dist/agent-runtime/codex-app-server.js.map +1 -1
  278. package/dist/agent-runtime/codex-env.d.ts +1 -41
  279. package/dist/agent-runtime/codex-env.d.ts.map +1 -1
  280. package/dist/agent-runtime/codex-env.js +1 -289
  281. package/dist/agent-runtime/codex-env.js.map +1 -1
  282. package/dist/agent-runtime/descriptors.d.ts +1 -18
  283. package/dist/agent-runtime/descriptors.d.ts.map +1 -1
  284. package/dist/agent-runtime/descriptors.js +1 -142
  285. package/dist/agent-runtime/descriptors.js.map +1 -1
  286. package/dist/agent-runtime/detection.d.ts +1 -14
  287. package/dist/agent-runtime/detection.d.ts.map +1 -1
  288. package/dist/agent-runtime/detection.js +1 -123
  289. package/dist/agent-runtime/detection.js.map +1 -1
  290. package/dist/agent-runtime/index.d.ts +1 -8
  291. package/dist/agent-runtime/index.d.ts.map +1 -1
  292. package/dist/agent-runtime/index.js +1 -8
  293. package/dist/agent-runtime/index.js.map +1 -1
  294. package/dist/agent-runtime/registry.d.ts +1 -151
  295. package/dist/agent-runtime/registry.d.ts.map +1 -1
  296. package/dist/agent-runtime/registry.js +1 -83
  297. package/dist/agent-runtime/registry.js.map +1 -1
  298. package/dist/agent-runtime/run.d.ts +1 -124
  299. package/dist/agent-runtime/run.d.ts.map +1 -1
  300. package/dist/agent-runtime/run.js +1 -720
  301. package/dist/agent-runtime/run.js.map +1 -1
  302. package/dist/agent-runtime/runtime-env.d.ts +1 -27
  303. package/dist/agent-runtime/runtime-env.d.ts.map +1 -1
  304. package/dist/agent-runtime/runtime-env.js +1 -65
  305. package/dist/agent-runtime/runtime-env.js.map +1 -1
  306. package/dist/agent-runtime/runtime-errors.d.ts +1 -19
  307. package/dist/agent-runtime/runtime-errors.d.ts.map +1 -1
  308. package/dist/agent-runtime/runtime-errors.js +1 -94
  309. package/dist/agent-runtime/runtime-errors.js.map +1 -1
  310. package/dist/agent-runtime.d.ts +1 -1
  311. package/dist/agent-runtime.js +1 -1
  312. package/dist/client.d.ts +8 -4
  313. package/dist/client.d.ts.map +1 -1
  314. package/dist/client.js.map +1 -1
  315. package/dist/foundation/config/schema.d.ts +1 -1
  316. package/dist/server/handlers/agent-runtime-codex.d.ts +1 -1
  317. package/dist/server/handlers/agent-runtime-codex.js +2 -2
  318. package/dist/server/handlers/agent-runtimes.d.ts +3 -3
  319. package/dist/server/handlers/agent-runtimes.js +5 -5
  320. package/dist/server/handlers/ask.d.ts +8 -4
  321. package/dist/server/handlers/ask.d.ts.map +1 -1
  322. package/dist/server/handlers/ask.js +7 -1
  323. package/dist/server/handlers/ask.js.map +1 -1
  324. package/dist/server/handlers/inbox-source.d.ts +1 -1
  325. package/dist/server/handlers/inbox-source.d.ts.map +1 -1
  326. package/dist/server/handlers/inbox-source.js +22 -0
  327. package/dist/server/handlers/inbox-source.js.map +1 -1
  328. package/dist/server/handlers/settings.d.ts +1 -1
  329. package/dist/server/handlers/settings.js +1 -1
  330. package/dist/server/handlers/setup.d.ts +2 -1
  331. package/dist/server/handlers/setup.d.ts.map +1 -1
  332. package/dist/server/handlers/setup.js +1 -0
  333. package/dist/server/handlers/setup.js.map +1 -1
  334. package/dist/server/index.d.ts +1 -1
  335. package/dist/server/index.d.ts.map +1 -1
  336. package/dist/server/index.js +1 -1
  337. package/dist/server/index.js.map +1 -1
  338. package/dist/server/runtime.d.ts +1 -1
  339. package/dist/session/index.d.ts +1 -644
  340. package/dist/session/index.d.ts.map +1 -1
  341. package/dist/session/index.js +1 -1318
  342. package/dist/session/index.js.map +1 -1
  343. package/dist/session/pi-coding-agent-runtime.d.ts +1 -9
  344. package/dist/session/pi-coding-agent-runtime.d.ts.map +1 -1
  345. package/dist/session/pi-coding-agent-runtime.js +1 -30
  346. package/dist/session/pi-coding-agent-runtime.js.map +1 -1
  347. package/dist/session/redaction.d.ts +1 -2
  348. package/dist/session/redaction.d.ts.map +1 -1
  349. package/dist/session/redaction.js +1 -46
  350. package/dist/session/redaction.js.map +1 -1
  351. package/dist/session.d.ts +1 -1
  352. package/dist/session.d.ts.map +1 -1
  353. package/dist/session.js +1 -1
  354. package/dist/session.js.map +1 -1
  355. package/dist/setup/index.d.ts +24 -3
  356. package/dist/setup/index.d.ts.map +1 -1
  357. package/dist/setup/index.js +102 -2
  358. package/dist/setup/index.js.map +1 -1
  359. package/package.json +97 -9
@@ -1,666 +1,2 @@
1
- import { spawn } from 'node:child_process';
2
- import { createInterface } from 'node:readline';
3
- import { appendBoundedLog, killChildWithEscalation } from './child-process.js';
4
- import { redactSensitiveText, sanitizeToolArgs, sanitizeToolOutput, } from '../session/index.js';
5
- import { buildCodexAppServerEnv } from './codex-env.js';
6
- import { compactRuntimeFailureMessage } from './runtime-errors.js';
7
- const DEFAULT_REQUEST_TIMEOUT_MS = 60_000;
8
- class AsyncQueue {
9
- values = [];
10
- readers = [];
11
- closed = false;
12
- push(value) {
13
- if (this.closed)
14
- return;
15
- const reader = this.readers.shift();
16
- if (reader) {
17
- reader({ value, done: false });
18
- return;
19
- }
20
- this.values.push(value);
21
- }
22
- close() {
23
- if (this.closed)
24
- return;
25
- this.closed = true;
26
- for (const reader of this.readers.splice(0)) {
27
- reader({ value: undefined, done: true });
28
- }
29
- }
30
- [Symbol.asyncIterator]() {
31
- return {
32
- next: () => {
33
- const value = this.values.shift();
34
- if (value !== undefined)
35
- return Promise.resolve({ value, done: false });
36
- if (this.closed)
37
- return Promise.resolve({ value: undefined, done: true });
38
- return new Promise((resolve) => this.readers.push(resolve));
39
- },
40
- };
41
- }
42
- }
43
- export function createCodexAppServerClient(transport, options = {}) {
44
- const clientInfo = options.clientInfo ?? {
45
- name: 'codex-mindos',
46
- title: 'Codex MindOS',
47
- version: '0.1.0',
48
- };
49
- const capabilities = options.capabilities ?? {
50
- experimentalApi: true,
51
- };
52
- const pending = new Map();
53
- const notifications = new AsyncQueue();
54
- let nextId = 1;
55
- let readStarted = false;
56
- const startReadLoop = (signal) => {
57
- if (readStarted)
58
- return;
59
- readStarted = true;
60
- void (async () => {
61
- try {
62
- for await (const message of transport.read(signal)) {
63
- if (isCodexResponse(message)) {
64
- const request = pending.get(message.id);
65
- if (!request)
66
- continue;
67
- pending.delete(message.id);
68
- request.cleanup();
69
- if (message.error) {
70
- request.reject(new Error(formatCodexJsonRpcError(request.method, message.error)));
71
- }
72
- else {
73
- request.resolve(message.result);
74
- }
75
- continue;
76
- }
77
- if (isCodexServerRequest(message)) {
78
- void respondToServerRequest(message).catch((error) => {
79
- const err = error instanceof Error ? error : new Error(String(error));
80
- notifications.push({
81
- method: 'error',
82
- params: { message: `Codex app-server request ${message.method} failed: ${err.message}` },
83
- });
84
- });
85
- continue;
86
- }
87
- if (isCodexNotification(message))
88
- notifications.push(message);
89
- }
90
- }
91
- catch (error) {
92
- const err = error instanceof Error ? error : new Error(String(error));
93
- for (const request of pending.values()) {
94
- request.cleanup();
95
- request.reject(err);
96
- }
97
- pending.clear();
98
- }
99
- finally {
100
- notifications.close();
101
- }
102
- })();
103
- };
104
- const request = async (method, params = {}, signal) => {
105
- startReadLoop(signal);
106
- if (signal?.aborted)
107
- throw new Error(`Codex app-server ${method} aborted.`);
108
- const id = nextId++;
109
- let timer;
110
- let abortListener;
111
- const response = new Promise((resolve, reject) => {
112
- const cleanup = () => {
113
- if (timer)
114
- clearTimeout(timer);
115
- if (abortListener)
116
- signal?.removeEventListener('abort', abortListener);
117
- };
118
- const rejectPending = (error) => {
119
- const pendingRequest = pending.get(id);
120
- if (!pendingRequest)
121
- return;
122
- pending.delete(id);
123
- pendingRequest.cleanup();
124
- pendingRequest.reject(error);
125
- };
126
- abortListener = () => rejectPending(new Error(`Codex app-server ${method} aborted.`));
127
- timer = setTimeout(() => {
128
- rejectPending(new Error(`Codex app-server ${method} timed out after ${DEFAULT_REQUEST_TIMEOUT_MS}ms.`));
129
- }, DEFAULT_REQUEST_TIMEOUT_MS);
130
- signal?.addEventListener('abort', abortListener, { once: true });
131
- pending.set(id, { method, resolve, reject, cleanup });
132
- });
133
- try {
134
- await transport.send({ method, id, params });
135
- }
136
- catch (error) {
137
- const pendingRequest = pending.get(id);
138
- if (pendingRequest) {
139
- pending.delete(id);
140
- pendingRequest.cleanup();
141
- pendingRequest.reject(error instanceof Error ? error : new Error(String(error)));
142
- }
143
- }
144
- return response;
145
- };
146
- const notify = async (method, params = {}) => {
147
- await transport.send({ method, params });
148
- };
149
- const respondToServerRequest = async (message) => {
150
- try {
151
- const result = options.handleServerRequest
152
- ? await options.handleServerRequest(message)
153
- : defaultCodexServerRequestResult(message);
154
- await transport.send({ id: message.id, result });
155
- }
156
- catch (error) {
157
- const err = error instanceof Error ? error : new Error(String(error));
158
- await transport.send({
159
- id: message.id,
160
- error: {
161
- code: -32000,
162
- message: err.message || `Codex app-server request ${message.method} failed`,
163
- },
164
- });
165
- }
166
- };
167
- return {
168
- async initialize(options = {}) {
169
- await request('initialize', { clientInfo, capabilities }, options.signal);
170
- await notify('initialized');
171
- },
172
- async startThread(input = {}, options = {}) {
173
- const params = pruneUndefined({
174
- model: input.model,
175
- cwd: input.cwd,
176
- });
177
- const result = await request('thread/start', params, options.signal);
178
- return { threadId: getThreadId(result, 'thread/start') };
179
- },
180
- async resumeThread(input, options = {}) {
181
- const result = await request('thread/resume', { threadId: input.threadId }, options.signal);
182
- return { threadId: getThreadId(result, 'thread/resume') ?? input.threadId };
183
- },
184
- async listThreads(input = {}) {
185
- const result = await request('thread/list', pruneUndefined(input));
186
- return getThreadListResult(result, 'thread/list');
187
- },
188
- async readThread(input) {
189
- const result = await request('thread/read', {
190
- threadId: input.threadId,
191
- ...(typeof input.includeTurns === 'boolean' ? { includeTurns: input.includeTurns } : {}),
192
- });
193
- return { thread: getThread(result, 'thread/read') };
194
- },
195
- async forkThread(input) {
196
- const result = await request('thread/fork', pruneUndefined(input));
197
- const record = asRecord(result);
198
- return {
199
- ...(record ?? {}),
200
- thread: getThread(result, 'thread/fork'),
201
- };
202
- },
203
- async archiveThread(input) {
204
- await request('thread/archive', { threadId: input.threadId });
205
- },
206
- async unarchiveThread(input) {
207
- const result = await request('thread/unarchive', { threadId: input.threadId });
208
- return { thread: getThread(result, 'thread/unarchive') };
209
- },
210
- async *startTurn(input) {
211
- const params = {
212
- threadId: input.threadId,
213
- input: input.input,
214
- ...(input.cwd ? { cwd: input.cwd } : {}),
215
- ...(input.model ? { model: input.model } : {}),
216
- ...(input.effort ? { effort: input.effort } : {}),
217
- ...(input.approvalPolicy ? { approvalPolicy: input.approvalPolicy } : {}),
218
- ...(input.sandbox ? { sandbox: input.sandbox } : {}),
219
- };
220
- await request('turn/start', params, input.signal);
221
- for await (const notification of notifications) {
222
- yield notification;
223
- if (isCodexTerminalTurnNotification(notification))
224
- break;
225
- }
226
- },
227
- async interruptTurn(input) {
228
- await request('turn/interrupt', {
229
- threadId: input.threadId,
230
- ...(input.turnId ? { turnId: input.turnId } : {}),
231
- });
232
- },
233
- close: () => transport.close?.(),
234
- };
235
- }
236
- export function createCodexAppServerStdioTransport(options = {}) {
237
- const command = options.command ?? 'codex';
238
- const args = options.args ?? ['app-server'];
239
- const child = spawn(command, args, {
240
- stdio: ['pipe', 'pipe', 'pipe'],
241
- ...(options.cwd ? { cwd: options.cwd } : {}),
242
- env: buildCodexAppServerEnv({ overrideEnv: options.env }),
243
- });
244
- const lines = createInterface({ input: child.stdout });
245
- let stderr = '';
246
- let spawnError = null;
247
- let closedByUs = false;
248
- // Without an error listener, a write racing the child's exit raises an
249
- // unhandled 'error' event (EPIPE) and crashes the whole process.
250
- child.stdin.on('error', () => { });
251
- child.stderr.on('data', (chunk) => {
252
- stderr = appendBoundedLog(stderr, chunk);
253
- });
254
- child.once('error', (error) => {
255
- spawnError = error;
256
- });
257
- const childClose = new Promise((resolve) => {
258
- child.once('close', (code, signal) => resolve({ code, signal }));
259
- });
260
- return {
261
- send(message) {
262
- if (closedByUs || child.exitCode !== null || child.signalCode !== null || !child.stdin.writable) {
263
- throw new Error(stderr.trim() || 'Codex app-server is not running (stdin is closed).');
264
- }
265
- child.stdin.write(`${JSON.stringify(message)}\n`);
266
- },
267
- async *read() {
268
- try {
269
- for await (const line of lines) {
270
- if (typeof line !== 'string' || !line.trim())
271
- continue;
272
- // Startup noise or partial writes on stdout must not kill the session.
273
- let message = null;
274
- try {
275
- const parsed = JSON.parse(line);
276
- if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
277
- message = parsed;
278
- }
279
- }
280
- catch {
281
- continue;
282
- }
283
- if (message)
284
- yield message;
285
- }
286
- const result = await childClose;
287
- if (spawnError)
288
- throw spawnError;
289
- if (result.code && result.code !== 0) {
290
- throw new Error(stderr.trim() || `Codex app-server exited with code ${result.code}`);
291
- }
292
- if (result.signal && !closedByUs) {
293
- throw new Error(stderr.trim() || `Codex app-server was killed by signal ${result.signal}`);
294
- }
295
- }
296
- catch (error) {
297
- const err = error instanceof Error ? error : new Error(String(error));
298
- if (err.message)
299
- throw err;
300
- throw new Error(stderr.trim() || 'Codex app-server stopped unexpectedly');
301
- }
302
- },
303
- close() {
304
- closedByUs = true;
305
- lines.close();
306
- killChildWithEscalation(child);
307
- },
308
- };
309
- }
310
- export function mapCodexAppServerNotificationToSseEvents(notification) {
311
- const toolEvents = mapCodexRuntimeToolNotification(notification);
312
- if (toolEvents.length > 0)
313
- return toolEvents;
314
- if (notification.method === 'error') {
315
- return [{
316
- type: 'error',
317
- message: compactRuntimeFailureMessage(redactSensitiveText(getCodexErrorMessage(notification.params, 'Codex app-server error')), { runtime: 'codex', fallback: 'Codex app-server error' }),
318
- }];
319
- }
320
- if (notification.method === 'item/agentMessage/delta') {
321
- const delta = getStringParam(notification.params, 'delta') ?? getStringParam(notification.params, 'text');
322
- return delta ? [{ type: 'text_delta', delta }] : [];
323
- }
324
- if (notification.method === 'item/thinking/delta') {
325
- const delta = getStringParam(notification.params, 'delta') ?? getStringParam(notification.params, 'text');
326
- return delta ? [{ type: 'thinking_delta', delta }] : [];
327
- }
328
- if (notification.method === 'item/reasoning/textDelta'
329
- || notification.method === 'item/reasoning/summaryTextDelta'
330
- || notification.method === 'item/reasoning/summaryPartAdded') {
331
- const delta = getStringParam(notification.params, 'delta')
332
- ?? getStringParam(notification.params, 'text')
333
- ?? getStringParam(notification.params, 'summary');
334
- return delta ? [{ type: 'thinking_delta', delta }] : [];
335
- }
336
- if (notification.method === 'turn/completed') {
337
- const status = getCodexTurnStatus(notification.params);
338
- if (status && status !== 'completed' && status !== 'success') {
339
- return [{
340
- type: 'error',
341
- message: compactRuntimeFailureMessage(redactSensitiveText(getCodexErrorMessage(notification.params, `Codex turn ${status}`)), { runtime: 'codex', fallback: `Codex turn ${status}` }),
342
- }];
343
- }
344
- return [{ type: 'done' }];
345
- }
346
- if (notification.method === 'turn/failed') {
347
- return [{
348
- type: 'error',
349
- message: compactRuntimeFailureMessage(redactSensitiveText(getCodexErrorMessage(notification.params, 'Codex turn failed')), { runtime: 'codex', fallback: 'Codex turn failed' }),
350
- }];
351
- }
352
- return [];
353
- }
354
- function mapCodexRuntimeToolNotification(notification) {
355
- const method = notification.method;
356
- const lower = method.toLowerCase();
357
- const params = notification.params ?? {};
358
- const officialItemEvents = mapCodexOfficialItemNotification(method, params);
359
- if (officialItemEvents.length > 0)
360
- return officialItemEvents;
361
- if (!/(tool|command|exec|approval|permission|patch)/.test(lower))
362
- return [];
363
- const toolCallId = getCodexToolCallId(method, params);
364
- const toolName = getCodexToolName(method, params);
365
- if (!toolCallId || !toolName)
366
- return [];
367
- if (/outputdelta|output_delta/.test(lower)) {
368
- const delta = getStringParam(params, 'delta')
369
- ?? getStringParam(params, 'output')
370
- ?? getStringParam(params, 'text');
371
- return delta ? [{
372
- type: 'tool_delta',
373
- toolCallId,
374
- toolName,
375
- delta: redactSensitiveText(delta),
376
- runtime: 'codex',
377
- }] : [];
378
- }
379
- if (/(end|ended|complete|completed|result|output|failed|error|rejected|denied|approved|allowed)/.test(lower)) {
380
- return [{
381
- type: 'tool_end',
382
- toolCallId,
383
- toolName,
384
- output: sanitizeToolOutput(getCodexToolOutput(params)),
385
- isError: /(failed|error|rejected|denied)/.test(lower) || params.isError === true || params.error !== undefined,
386
- runtime: 'codex',
387
- }];
388
- }
389
- if (/(start|started|begin|began|added|call|request|requested|created)/.test(lower)) {
390
- return [{
391
- type: 'tool_start',
392
- toolCallId,
393
- toolName,
394
- args: sanitizeToolArgs(toolName, getCodexToolInput(params)),
395
- runtime: 'codex',
396
- }];
397
- }
398
- return [];
399
- }
400
- function mapCodexOfficialItemNotification(method, params) {
401
- if (method === 'item/commandExecution/outputDelta') {
402
- const toolCallId = getCodexToolCallId(method, params);
403
- const delta = getStringParam(params, 'delta')
404
- ?? getStringParam(params, 'output')
405
- ?? getStringParam(params, 'text');
406
- if (!toolCallId || !delta)
407
- return [];
408
- return [{
409
- type: 'tool_delta',
410
- toolCallId,
411
- toolName: getCodexToolName(method, params),
412
- delta: redactSensitiveText(delta),
413
- runtime: 'codex',
414
- }];
415
- }
416
- if (method !== 'item/started' && method !== 'item/completed')
417
- return [];
418
- const item = getCodexItem(params);
419
- if (!item || !isCodexRuntimeToolItem(item))
420
- return [];
421
- const toolCallId = getCodexToolCallId(method, params);
422
- const toolName = getCodexToolName(method, params);
423
- if (!toolCallId || !toolName)
424
- return [];
425
- if (method === 'item/started') {
426
- return [{
427
- type: 'tool_start',
428
- toolCallId,
429
- toolName,
430
- args: sanitizeToolArgs(toolName, getCodexToolInput(params)),
431
- runtime: 'codex',
432
- }];
433
- }
434
- const status = getStringField(item, 'status') ?? getStringParam(params, 'status');
435
- return [{
436
- type: 'tool_end',
437
- toolCallId,
438
- toolName,
439
- output: sanitizeToolOutput(getCodexToolOutput(params)),
440
- isError: status === 'failed'
441
- || status === 'error'
442
- || status === 'declined'
443
- || params.isError === true
444
- || params.error !== undefined
445
- || item.error !== undefined,
446
- runtime: 'codex',
447
- }];
448
- }
449
- function formatCodexJsonRpcError(method, error) {
450
- const parts = [
451
- error.message?.trim() || `Codex app-server ${method} failed`,
452
- typeof error.code === 'number' ? `method=${method} code=${error.code}` : `method=${method}`,
453
- error.data !== undefined ? `data=${safeJson(error.data)}` : '',
454
- ].filter(Boolean);
455
- return parts.join(' ');
456
- }
457
- function safeJson(value) {
458
- try {
459
- return JSON.stringify(value);
460
- }
461
- catch {
462
- return String(value);
463
- }
464
- }
465
- function isCodexResponse(message) {
466
- return typeof message.id === 'number'
467
- && typeof message.method !== 'string';
468
- }
469
- function isCodexNotification(message) {
470
- return typeof message.method === 'string'
471
- && typeof message.id !== 'number';
472
- }
473
- function isCodexServerRequest(message) {
474
- return typeof message.id === 'number'
475
- && typeof message.method === 'string';
476
- }
477
- function isCodexTerminalTurnNotification(notification) {
478
- return (notification.method === 'error'
479
- || notification.method === 'turn/completed'
480
- || notification.method === 'turn/failed');
481
- }
482
- function asRecord(value) {
483
- return value && typeof value === 'object' ? value : null;
484
- }
485
- function getThreadId(result, method) {
486
- return getThread(result, method).id;
487
- }
488
- function getThread(result, method) {
489
- const record = asRecord(result);
490
- const thread = asRecord(record?.thread);
491
- const id = thread?.id;
492
- if (typeof id !== 'string' || !id) {
493
- throw new Error(`Codex app-server ${method} did not return a thread id`);
494
- }
495
- return { ...thread, id };
496
- }
497
- function getThreadListResult(result, method) {
498
- const record = asRecord(result);
499
- if (!record || !Array.isArray(record.data)) {
500
- throw new Error(`Codex app-server ${method} did not return a thread list`);
501
- }
502
- return {
503
- data: record.data.map((item) => {
504
- const thread = asRecord(item);
505
- const id = thread?.id;
506
- if (typeof id !== 'string' || !id) {
507
- throw new Error(`Codex app-server ${method} returned a thread without an id`);
508
- }
509
- return { ...thread, id };
510
- }),
511
- nextCursor: typeof record.nextCursor === 'string' ? record.nextCursor : null,
512
- backwardsCursor: typeof record.backwardsCursor === 'string' ? record.backwardsCursor : null,
513
- };
514
- }
515
- function pruneUndefined(value) {
516
- return Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== undefined));
517
- }
518
- function getStringParam(params, key) {
519
- const value = params?.[key];
520
- return typeof value === 'string' ? value : undefined;
521
- }
522
- function getCodexItem(params) {
523
- return asRecord(params.item) ?? params;
524
- }
525
- function getCodexItemType(item) {
526
- return getStringField(item, 'type') ?? getStringField(item, 'kind') ?? '';
527
- }
528
- function isCodexRuntimeToolItem(item) {
529
- const type = getCodexItemType(item).toLowerCase();
530
- return type.includes('command')
531
- || type.includes('filechange')
532
- || type.includes('file_change')
533
- || type.includes('tool')
534
- || type.includes('dynamic')
535
- || Boolean(getStringField(item, 'command'))
536
- || Boolean(getStringField(item, 'toolName'))
537
- || Boolean(getStringField(item, 'name'));
538
- }
539
- function getCodexToolCallId(method, params) {
540
- const direct = getStringParam(params, 'toolCallId')
541
- ?? getStringParam(params, 'callId')
542
- ?? getStringParam(params, 'itemId')
543
- ?? getStringParam(params, 'requestId')
544
- ?? getStringParam(params, 'id');
545
- if (direct)
546
- return direct;
547
- const item = asRecord(params.item);
548
- const nested = getStringField(item, 'id') ?? getStringField(item, 'callId');
549
- return nested ?? `codex-${method}`;
550
- }
551
- function getCodexToolName(method, params) {
552
- const direct = getStringParam(params, 'toolName')
553
- ?? getStringParam(params, 'name')
554
- ?? getStringParam(params, 'tool')
555
- ?? getStringParam(params, 'commandName');
556
- if (direct)
557
- return direct;
558
- if (getStringParam(params, 'command'))
559
- return 'Bash';
560
- if (method.toLowerCase().includes('commandexecution'))
561
- return 'Bash';
562
- if (method.toLowerCase().includes('approval') || method.toLowerCase().includes('permission'))
563
- return 'approval_request';
564
- const item = getCodexItem(params);
565
- const itemType = getCodexItemType(item).toLowerCase();
566
- const itemTool = asRecord(item?.tool) ?? asRecord(item?.mcpTool) ?? asRecord(item?.dynamicTool);
567
- const itemServer = asRecord(item?.server) ?? asRecord(item?.mcpServer);
568
- if (getStringField(item, 'command'))
569
- return 'Bash';
570
- if (itemType.includes('command'))
571
- return 'Bash';
572
- if (itemType.includes('filechange') || itemType.includes('file_change'))
573
- return 'file_change';
574
- const nestedToolName = getStringField(itemTool, 'name')
575
- ?? getStringField(itemTool, 'toolName')
576
- ?? getStringField(item, 'serverToolName');
577
- const serverName = getStringField(itemServer, 'name') ?? getStringField(itemServer, 'serverName');
578
- if (serverName && nestedToolName)
579
- return `${serverName}.${nestedToolName}`;
580
- return getStringField(item, 'name')
581
- ?? getStringField(item, 'toolName')
582
- ?? nestedToolName
583
- ?? method.split('/').at(-1)
584
- ?? method;
585
- }
586
- function getCodexToolInput(params) {
587
- const item = getCodexItem(params);
588
- const itemTool = asRecord(item?.tool) ?? asRecord(item?.mcpTool) ?? asRecord(item?.dynamicTool);
589
- return params.input
590
- ?? params.arguments
591
- ?? params.args
592
- ?? params.command
593
- ?? item?.input
594
- ?? item?.arguments
595
- ?? item?.args
596
- ?? item?.command
597
- ?? itemTool?.input
598
- ?? itemTool?.arguments
599
- ?? itemTool?.args
600
- ?? params;
601
- }
602
- function getCodexToolOutput(params) {
603
- const direct = getStringParam(params, 'output')
604
- ?? getStringParam(params, 'result')
605
- ?? getStringParam(params, 'message')
606
- ?? getStringParam(params, 'text');
607
- if (direct)
608
- return direct;
609
- const error = asRecord(params.error);
610
- const errorMessage = getStringField(error, 'message') ?? getStringField(error, 'detail');
611
- if (errorMessage)
612
- return errorMessage;
613
- const item = getCodexItem(params);
614
- const itemOutput = getStringField(item, 'output') ?? getStringField(item, 'result');
615
- if (itemOutput)
616
- return itemOutput;
617
- const itemTool = asRecord(item?.tool) ?? asRecord(item?.mcpTool) ?? asRecord(item?.dynamicTool);
618
- const toolOutput = getStringField(itemTool, 'output') ?? getStringField(itemTool, 'result');
619
- if (toolOutput)
620
- return toolOutput;
621
- const itemError = asRecord(item?.error);
622
- const itemErrorMessage = getStringField(itemError, 'message') ?? getStringField(itemError, 'detail');
623
- if (itemErrorMessage)
624
- return itemErrorMessage;
625
- const status = getStringField(item, 'status') ?? getStringParam(params, 'status');
626
- if (status)
627
- return `Codex item ${status}`;
628
- return safeJson(params);
629
- }
630
- function getCodexTurnStatus(params) {
631
- const direct = getStringParam(params, 'status');
632
- if (direct)
633
- return direct;
634
- const turn = asRecord(params?.turn);
635
- const nested = turn?.status;
636
- return typeof nested === 'string' ? nested : undefined;
637
- }
638
- function getCodexErrorMessage(params, fallback) {
639
- const direct = getStringParam(params, 'message') ?? getStringParam(params, 'errorMessage');
640
- if (direct)
641
- return direct;
642
- const error = asRecord(params?.error);
643
- const errorMessage = getStringField(error, 'message') ?? getStringField(error, 'detail');
644
- if (errorMessage)
645
- return errorMessage;
646
- const turn = asRecord(params?.turn);
647
- const turnError = asRecord(turn?.error);
648
- const turnMessage = getStringField(turnError, 'message')
649
- ?? getStringField(turnError, 'detail')
650
- ?? getStringField(turn, 'message');
651
- if (turnMessage)
652
- return turnMessage;
653
- const status = getCodexTurnStatus(params);
654
- return status ? `${fallback}: ${status}` : fallback;
655
- }
656
- function getStringField(record, key) {
657
- const value = record?.[key];
658
- return typeof value === 'string' && value ? value : undefined;
659
- }
660
- function defaultCodexServerRequestResult(request) {
661
- if (/requestApproval|approval|permission/i.test(request.method)) {
662
- return { decision: 'cancel' };
663
- }
664
- throw new Error(`Unhandled Codex app-server request: ${request.method}`);
665
- }
1
+ export * from '../agent/runtime/codex-app-server.js';
666
2
  //# sourceMappingURL=codex-app-server.js.map