@adecore/agents 0.0.1 → 0.17.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (348) hide show
  1. package/LICENSE +110 -0
  2. package/README.md +33 -0
  3. package/dist/async.d.ts +2 -0
  4. package/dist/async.js +31 -0
  5. package/dist/chat/attachment-store.d.ts +10 -0
  6. package/dist/chat/attachment-store.js +93 -0
  7. package/dist/chat/backend.d.ts +214 -0
  8. package/dist/chat/backend.js +1 -0
  9. package/dist/chat/background-work.d.ts +8 -0
  10. package/dist/chat/background-work.js +33 -0
  11. package/dist/chat/bookmark-store.d.ts +25 -0
  12. package/dist/chat/bookmark-store.js +141 -0
  13. package/dist/chat/chat-core.d.ts +311 -0
  14. package/dist/chat/chat-core.js +1025 -0
  15. package/dist/chat/chat-log.d.ts +33 -0
  16. package/dist/chat/chat-log.js +163 -0
  17. package/dist/chat/chat-process.d.ts +46 -0
  18. package/dist/chat/chat-process.js +190 -0
  19. package/dist/chat/chat-session.d.ts +209 -0
  20. package/dist/chat/chat-session.js +1511 -0
  21. package/dist/chat/chat-store.d.ts +37 -0
  22. package/dist/chat/chat-store.js +202 -0
  23. package/dist/chat/chat-title.d.ts +10 -0
  24. package/dist/chat/chat-title.js +74 -0
  25. package/dist/chat/claude-backend.d.ts +35 -0
  26. package/dist/chat/claude-backend.js +214 -0
  27. package/dist/chat/claude-protocol.d.ts +41 -0
  28. package/dist/chat/claude-protocol.js +642 -0
  29. package/dist/chat/claude-title.d.ts +11 -0
  30. package/dist/chat/claude-title.js +97 -0
  31. package/dist/chat/claude-transcript.d.ts +28 -0
  32. package/dist/chat/claude-transcript.js +211 -0
  33. package/dist/chat/codex-backend.d.ts +51 -0
  34. package/dist/chat/codex-backend.js +364 -0
  35. package/dist/chat/codex-protocol.d.ts +56 -0
  36. package/dist/chat/codex-protocol.js +767 -0
  37. package/dist/chat/codex-thread.d.ts +32 -0
  38. package/dist/chat/codex-thread.js +131 -0
  39. package/dist/chat/codex-transport.d.ts +42 -0
  40. package/dist/chat/codex-transport.js +188 -0
  41. package/dist/chat/composer-preferences.d.ts +15 -0
  42. package/dist/chat/composer-preferences.js +46 -0
  43. package/dist/chat/context-breakdown.d.ts +2 -0
  44. package/dist/chat/context-breakdown.js +74 -0
  45. package/dist/chat/delta-coalescer.d.ts +12 -0
  46. package/dist/chat/delta-coalescer.js +55 -0
  47. package/dist/chat/errors.d.ts +4 -0
  48. package/dist/chat/errors.js +4 -0
  49. package/dist/chat/fake-claude.d.ts +3 -0
  50. package/dist/chat/fake-claude.js +982 -0
  51. package/dist/chat/fake-cli.d.ts +25 -0
  52. package/dist/chat/fake-cli.js +157 -0
  53. package/dist/chat/fake-codex.d.ts +10 -0
  54. package/dist/chat/fake-codex.js +502 -0
  55. package/dist/chat/fixtures/claude-2.1.285-auto-fallback.json +24 -0
  56. package/dist/chat/fixtures/claude-2.1.285-native-children.json +6600 -0
  57. package/dist/chat/fixtures/claude-2.1.285-resume-direct-compact.json +202 -0
  58. package/dist/chat/fixtures/claude-2.1.285-resume-task-notification.json +57 -0
  59. package/dist/chat/fixtures/claude-projects/-work-demo/5f1c2a9e-0b7d-4c1e-9a53-3e2f8d6b7a10/subagents/agent-a4c2e8f10b3d5a7e9.jsonl +10 -0
  60. package/dist/chat/fixtures/claude-projects/-work-demo/5f1c2a9e-0b7d-4c1e-9a53-3e2f8d6b7a10/subagents/agent-a4c2e8f10b3d5a7e9.meta.json +1 -0
  61. package/dist/chat/fixtures/claude-projects/-work-demo/5f1c2a9e-0b7d-4c1e-9a53-3e2f8d6b7a10/subagents/agent-a9b8c7d6e5f4a3b21.jsonl +2 -0
  62. package/dist/chat/fixtures/claude-projects/-work-demo/5f1c2a9e-0b7d-4c1e-9a53-3e2f8d6b7a10/subagents/agent-a9b8c7d6e5f4a3b21.meta.json +1 -0
  63. package/dist/chat/fixtures/codex-0.159.2-native-approval.json +119 -0
  64. package/dist/chat/fixtures/codex-0.159.2-native-file-approval.json +136 -0
  65. package/dist/chat/fixtures/codex-0.159.2-native-interacted.json +220 -0
  66. package/dist/chat/fixtures/codex-0.159.2-usage-windows.json +74 -0
  67. package/dist/chat/input.d.ts +19 -0
  68. package/dist/chat/input.js +71 -0
  69. package/dist/chat/limit-resume.d.ts +11 -0
  70. package/dist/chat/limit-resume.js +68 -0
  71. package/dist/chat/projector.d.ts +60 -0
  72. package/dist/chat/projector.js +860 -0
  73. package/dist/chat/request-summary.d.ts +3 -0
  74. package/dist/chat/request-summary.js +143 -0
  75. package/dist/chat/subagent-projection.d.ts +8 -0
  76. package/dist/chat/subagent-projection.js +40 -0
  77. package/dist/chat/subagent-reader.d.ts +66 -0
  78. package/dist/chat/subagent-reader.js +396 -0
  79. package/dist/chat/subagent-settlement.d.ts +6 -0
  80. package/dist/chat/subagent-settlement.js +103 -0
  81. package/dist/chat/thread.d.ts +30 -0
  82. package/dist/chat/thread.js +147 -0
  83. package/dist/chat/wake-chat.d.ts +20 -0
  84. package/dist/chat/wake-chat.js +27 -0
  85. package/dist/client-sinks.d.ts +9 -0
  86. package/dist/client-sinks.js +34 -0
  87. package/dist/coded-error.d.ts +5 -0
  88. package/dist/coded-error.js +17 -0
  89. package/dist/context/argv.d.ts +11 -0
  90. package/dist/context/argv.js +58 -0
  91. package/dist/context/refusal.d.ts +9 -0
  92. package/dist/context/refusal.js +38 -0
  93. package/dist/context/verb.d.ts +85 -0
  94. package/dist/context/verb.js +233 -0
  95. package/dist/error-text.d.ts +5 -0
  96. package/dist/error-text.js +24 -0
  97. package/dist/events.d.ts +12 -0
  98. package/dist/events.js +1 -0
  99. package/dist/fs.d.ts +9 -0
  100. package/dist/fs.js +107 -0
  101. package/dist/host/agent-host.d.ts +28 -0
  102. package/dist/host/agent-host.js +105 -0
  103. package/dist/host/environment.d.ts +7 -0
  104. package/dist/host/environment.js +22 -0
  105. package/dist/host/handlers.d.ts +30 -0
  106. package/dist/host/handlers.js +111 -0
  107. package/dist/host/memory-port.d.ts +2 -0
  108. package/dist/host/memory-port.js +25 -0
  109. package/dist/host/wiring.d.ts +40 -0
  110. package/dist/host/wiring.js +120 -0
  111. package/dist/lineage.d.ts +44 -0
  112. package/dist/lineage.js +134 -0
  113. package/dist/messages/deliver-message.d.ts +21 -0
  114. package/dist/messages/deliver-message.js +42 -0
  115. package/dist/messages/deliver-notice.d.ts +25 -0
  116. package/dist/messages/deliver-notice.js +75 -0
  117. package/dist/messages/notice-notes.d.ts +15 -0
  118. package/dist/messages/notice-notes.js +26 -0
  119. package/dist/messages/notice-store.d.ts +30 -0
  120. package/dist/messages/notice-store.js +120 -0
  121. package/dist/modes.d.ts +11 -0
  122. package/dist/modes.js +28 -0
  123. package/dist/outbox/manual-clock.d.ts +10 -0
  124. package/dist/outbox/manual-clock.js +25 -0
  125. package/dist/outbox/outbox-worker.d.ts +44 -0
  126. package/dist/outbox/outbox-worker.js +173 -0
  127. package/dist/outbox/outbox.d.ts +37 -0
  128. package/dist/outbox/outbox.js +76 -0
  129. package/dist/providers/accounts/accounts.d.ts +20 -0
  130. package/dist/providers/accounts/accounts.js +158 -0
  131. package/dist/providers/accounts/launch.d.ts +17 -0
  132. package/dist/providers/accounts/launch.js +30 -0
  133. package/dist/providers/accounts/service.d.ts +87 -0
  134. package/dist/providers/accounts/service.js +538 -0
  135. package/dist/providers/accounts/shadow-home.d.ts +8 -0
  136. package/dist/providers/accounts/shadow-home.js +70 -0
  137. package/dist/providers/accounts/status.d.ts +12 -0
  138. package/dist/providers/accounts/status.js +85 -0
  139. package/dist/providers/accounts/store.d.ts +14 -0
  140. package/dist/providers/accounts/store.js +112 -0
  141. package/dist/providers/accounts/test-accounts.d.ts +12 -0
  142. package/dist/providers/accounts/test-accounts.js +38 -0
  143. package/dist/providers/accounts/variables.d.ts +27 -0
  144. package/dist/providers/accounts/variables.js +94 -0
  145. package/dist/providers/catalog.d.ts +17 -0
  146. package/dist/providers/catalog.js +76 -0
  147. package/dist/providers/claude-models.json +114 -0
  148. package/dist/providers/claude-provider.d.ts +4 -0
  149. package/dist/providers/claude-provider.js +29 -0
  150. package/dist/providers/claude.d.ts +15 -0
  151. package/dist/providers/claude.js +105 -0
  152. package/dist/providers/codex-models.json +135 -0
  153. package/dist/providers/codex-provider.d.ts +4 -0
  154. package/dist/providers/codex-provider.js +27 -0
  155. package/dist/providers/codex-rules.d.ts +9 -0
  156. package/dist/providers/codex-rules.js +35 -0
  157. package/dist/providers/codex.d.ts +14 -0
  158. package/dist/providers/codex.js +52 -0
  159. package/dist/providers/detect.d.ts +6 -0
  160. package/dist/providers/detect.js +30 -0
  161. package/dist/providers/provider.d.ts +25 -0
  162. package/dist/providers/provider.js +1 -0
  163. package/dist/providers/registry.d.ts +28 -0
  164. package/dist/providers/registry.js +118 -0
  165. package/dist/record-directory.d.ts +27 -0
  166. package/dist/record-directory.js +114 -0
  167. package/dist/run-process.d.ts +13 -0
  168. package/dist/run-process.js +42 -0
  169. package/dist/serializer.d.ts +9 -0
  170. package/dist/serializer.js +34 -0
  171. package/dist/skills.d.ts +21 -0
  172. package/dist/skills.js +174 -0
  173. package/dist/tasks/background-limit.d.ts +16 -0
  174. package/dist/tasks/background-limit.js +55 -0
  175. package/dist/tasks/end-children.d.ts +34 -0
  176. package/dist/tasks/end-children.js +53 -0
  177. package/dist/tasks/give-task.d.ts +14 -0
  178. package/dist/tasks/give-task.js +33 -0
  179. package/dist/tasks/task-coordinator.d.ts +52 -0
  180. package/dist/tasks/task-coordinator.js +323 -0
  181. package/dist/tasks/task-store.d.ts +49 -0
  182. package/dist/tasks/task-store.js +197 -0
  183. package/dist/tasks/task-work.d.ts +47 -0
  184. package/dist/tasks/task-work.js +28 -0
  185. package/dist/tasks/waiting-child.d.ts +51 -0
  186. package/dist/tasks/waiting-child.js +143 -0
  187. package/dist/tasks/wake-parent.d.ts +19 -0
  188. package/dist/tasks/wake-parent.js +109 -0
  189. package/dist/tasks/wiring.d.ts +51 -0
  190. package/dist/tasks/wiring.js +151 -0
  191. package/dist/title-file.d.ts +2 -0
  192. package/dist/title-file.js +55 -0
  193. package/dist/usage/accounts.d.ts +15 -0
  194. package/dist/usage/accounts.js +64 -0
  195. package/dist/usage/aggregate.d.ts +12 -0
  196. package/dist/usage/aggregate.js +154 -0
  197. package/dist/usage/exchange.d.ts +16 -0
  198. package/dist/usage/exchange.js +84 -0
  199. package/dist/usage/index-file.d.ts +15 -0
  200. package/dist/usage/index-file.js +123 -0
  201. package/dist/usage/limits/monitor.d.ts +50 -0
  202. package/dist/usage/limits/monitor.js +179 -0
  203. package/dist/usage/limits/normalize.d.ts +21 -0
  204. package/dist/usage/limits/normalize.js +160 -0
  205. package/dist/usage/limits/probe.d.ts +9 -0
  206. package/dist/usage/limits/probe.js +113 -0
  207. package/dist/usage/prices-snapshot.json +1071 -0
  208. package/dist/usage/pricing.d.ts +34 -0
  209. package/dist/usage/pricing.js +186 -0
  210. package/dist/usage/projects.d.ts +17 -0
  211. package/dist/usage/projects.js +49 -0
  212. package/dist/usage/readers/claude.d.ts +3 -0
  213. package/dist/usage/readers/claude.js +59 -0
  214. package/dist/usage/readers/codex.d.ts +23 -0
  215. package/dist/usage/readers/codex.js +155 -0
  216. package/dist/usage/record.d.ts +15 -0
  217. package/dist/usage/record.js +39 -0
  218. package/dist/usage/roots.d.ts +12 -0
  219. package/dist/usage/roots.js +29 -0
  220. package/dist/usage/scanner.d.ts +30 -0
  221. package/dist/usage/scanner.js +234 -0
  222. package/dist/usage/usage-service.d.ts +35 -0
  223. package/dist/usage/usage-service.js +130 -0
  224. package/dist/watch-seam.d.ts +29 -0
  225. package/dist/watch-seam.js +78 -0
  226. package/dist/watch-test-helpers.d.ts +28 -0
  227. package/dist/watch-test-helpers.js +86 -0
  228. package/package.json +42 -3
  229. package/src/async.ts +40 -0
  230. package/src/chat/attachment-store.ts +108 -0
  231. package/src/chat/backend.ts +199 -0
  232. package/src/chat/background-work.ts +42 -0
  233. package/src/chat/bookmark-store.ts +166 -0
  234. package/src/chat/chat-core.ts +1228 -0
  235. package/src/chat/chat-log.ts +187 -0
  236. package/src/chat/chat-process.ts +237 -0
  237. package/src/chat/chat-session.ts +1723 -0
  238. package/src/chat/chat-store.ts +261 -0
  239. package/src/chat/chat-title.ts +90 -0
  240. package/src/chat/claude-backend.ts +235 -0
  241. package/src/chat/claude-protocol.ts +684 -0
  242. package/src/chat/claude-title.ts +106 -0
  243. package/src/chat/claude-transcript.ts +233 -0
  244. package/src/chat/codex-backend.ts +397 -0
  245. package/src/chat/codex-protocol.ts +872 -0
  246. package/src/chat/codex-thread.ts +162 -0
  247. package/src/chat/codex-transport.ts +224 -0
  248. package/src/chat/composer-preferences.ts +67 -0
  249. package/src/chat/context-breakdown.ts +80 -0
  250. package/src/chat/delta-coalescer.ts +62 -0
  251. package/src/chat/errors.ts +25 -0
  252. package/src/chat/fake-claude.ts +1006 -0
  253. package/src/chat/fake-cli.ts +199 -0
  254. package/src/chat/fake-codex.ts +534 -0
  255. package/src/chat/fixtures/claude-2.1.285-auto-fallback.json +24 -0
  256. package/src/chat/fixtures/claude-2.1.285-native-children.json +6600 -0
  257. package/src/chat/fixtures/claude-2.1.285-resume-direct-compact.json +202 -0
  258. package/src/chat/fixtures/claude-2.1.285-resume-task-notification.json +57 -0
  259. package/src/chat/fixtures/claude-projects/-work-demo/5f1c2a9e-0b7d-4c1e-9a53-3e2f8d6b7a10/subagents/agent-a4c2e8f10b3d5a7e9.jsonl +10 -0
  260. package/src/chat/fixtures/claude-projects/-work-demo/5f1c2a9e-0b7d-4c1e-9a53-3e2f8d6b7a10/subagents/agent-a4c2e8f10b3d5a7e9.meta.json +1 -0
  261. package/src/chat/fixtures/claude-projects/-work-demo/5f1c2a9e-0b7d-4c1e-9a53-3e2f8d6b7a10/subagents/agent-a9b8c7d6e5f4a3b21.jsonl +2 -0
  262. package/src/chat/fixtures/claude-projects/-work-demo/5f1c2a9e-0b7d-4c1e-9a53-3e2f8d6b7a10/subagents/agent-a9b8c7d6e5f4a3b21.meta.json +1 -0
  263. package/src/chat/fixtures/codex-0.159.2-native-approval.json +119 -0
  264. package/src/chat/fixtures/codex-0.159.2-native-file-approval.json +136 -0
  265. package/src/chat/fixtures/codex-0.159.2-native-interacted.json +220 -0
  266. package/src/chat/fixtures/codex-0.159.2-usage-windows.json +74 -0
  267. package/src/chat/input.ts +89 -0
  268. package/src/chat/limit-resume.ts +74 -0
  269. package/src/chat/projector.ts +969 -0
  270. package/src/chat/request-summary.ts +168 -0
  271. package/src/chat/subagent-projection.ts +45 -0
  272. package/src/chat/subagent-reader.ts +469 -0
  273. package/src/chat/subagent-settlement.ts +111 -0
  274. package/src/chat/thread.ts +167 -0
  275. package/src/chat/wake-chat.ts +45 -0
  276. package/src/client-sinks.ts +39 -0
  277. package/src/coded-error.ts +18 -0
  278. package/src/context/argv.ts +61 -0
  279. package/src/context/refusal.ts +50 -0
  280. package/src/context/verb.ts +392 -0
  281. package/src/error-text.ts +28 -0
  282. package/src/events.ts +9 -0
  283. package/src/fs.ts +118 -0
  284. package/src/host/agent-host.ts +124 -0
  285. package/src/host/environment.ts +31 -0
  286. package/src/host/handlers.ts +142 -0
  287. package/src/host/memory-port.ts +27 -0
  288. package/src/host/wiring.ts +164 -0
  289. package/src/lineage.ts +159 -0
  290. package/src/messages/deliver-message.ts +61 -0
  291. package/src/messages/deliver-notice.ts +120 -0
  292. package/src/messages/notice-notes.ts +34 -0
  293. package/src/messages/notice-store.ts +142 -0
  294. package/src/modes.ts +38 -0
  295. package/src/outbox/manual-clock.ts +31 -0
  296. package/src/outbox/outbox-worker.ts +214 -0
  297. package/src/outbox/outbox.ts +106 -0
  298. package/src/providers/accounts/accounts.ts +192 -0
  299. package/src/providers/accounts/launch.ts +55 -0
  300. package/src/providers/accounts/service.ts +632 -0
  301. package/src/providers/accounts/shadow-home.ts +85 -0
  302. package/src/providers/accounts/status.ts +106 -0
  303. package/src/providers/accounts/store.ts +158 -0
  304. package/src/providers/accounts/test-accounts.ts +48 -0
  305. package/src/providers/accounts/variables.ts +132 -0
  306. package/src/providers/catalog.ts +90 -0
  307. package/src/providers/claude-models.json +114 -0
  308. package/src/providers/claude-provider.ts +32 -0
  309. package/src/providers/claude.ts +123 -0
  310. package/src/providers/codex-models.json +135 -0
  311. package/src/providers/codex-provider.ts +30 -0
  312. package/src/providers/codex-rules.ts +54 -0
  313. package/src/providers/codex.ts +69 -0
  314. package/src/providers/detect.ts +40 -0
  315. package/src/providers/provider.ts +46 -0
  316. package/src/providers/registry.ts +150 -0
  317. package/src/record-directory.ts +136 -0
  318. package/src/run-process.ts +61 -0
  319. package/src/serializer.ts +41 -0
  320. package/src/skills.ts +199 -0
  321. package/src/tasks/background-limit.ts +72 -0
  322. package/src/tasks/end-children.ts +100 -0
  323. package/src/tasks/give-task.ts +52 -0
  324. package/src/tasks/task-coordinator.ts +384 -0
  325. package/src/tasks/task-store.ts +236 -0
  326. package/src/tasks/task-work.ts +62 -0
  327. package/src/tasks/waiting-child.ts +203 -0
  328. package/src/tasks/wake-parent.ts +142 -0
  329. package/src/tasks/wiring.ts +231 -0
  330. package/src/title-file.ts +57 -0
  331. package/src/usage/accounts.ts +86 -0
  332. package/src/usage/aggregate.ts +220 -0
  333. package/src/usage/exchange.ts +93 -0
  334. package/src/usage/index-file.ts +178 -0
  335. package/src/usage/limits/monitor.ts +239 -0
  336. package/src/usage/limits/normalize.ts +188 -0
  337. package/src/usage/limits/probe.ts +120 -0
  338. package/src/usage/prices-snapshot.json +1071 -0
  339. package/src/usage/pricing.ts +236 -0
  340. package/src/usage/projects.ts +65 -0
  341. package/src/usage/readers/claude.ts +60 -0
  342. package/src/usage/readers/codex.ts +196 -0
  343. package/src/usage/record.ts +60 -0
  344. package/src/usage/roots.ts +39 -0
  345. package/src/usage/scanner.ts +265 -0
  346. package/src/usage/usage-service.ts +161 -0
  347. package/src/watch-seam.ts +111 -0
  348. package/src/watch-test-helpers.ts +102 -0
@@ -0,0 +1,220 @@
1
+ {
2
+ "version": "codex-cli 0.159.2",
3
+ "capturedAt": "2026-09-30",
4
+ "source": "Live app-server stdio. Root started one native child, waited for completion, then sent a follow-up to the same child and waited again. Only native activity frames retained.",
5
+ "rootThreadId": "01a0f1d2-e495-7fb0-bfbd-0756f51209c8",
6
+ "frames": [
7
+ {
8
+ "method": "item/started",
9
+ "params": {
10
+ "item": {
11
+ "type": "subAgentActivity",
12
+ "id": "call_k0Jt3qf9tgn9mI47m4IJUR33",
13
+ "kind": "started",
14
+ "agentThreadId": "01a0f1d3-101b-7122-bb83-37604ac8612c",
15
+ "agentPath": "/root/lifecycle_probe"
16
+ },
17
+ "threadId": "01a0f1d2-e495-7fb0-bfbd-0756f51209c8",
18
+ "turnId": "01a0f1d2-e4e5-7f23-bb50-dd2bf74d6d0d",
19
+ "startedAtMs": 1790763536427
20
+ },
21
+ "emittedAtMs": 1790763536427
22
+ },
23
+ {
24
+ "method": "item/completed",
25
+ "params": {
26
+ "item": {
27
+ "type": "subAgentActivity",
28
+ "id": "call_k0Jt3qf9tgn9mI47m4IJUR33",
29
+ "kind": "started",
30
+ "agentThreadId": "01a0f1d3-101b-7122-bb83-37604ac8612c",
31
+ "agentPath": "/root/lifecycle_probe"
32
+ },
33
+ "threadId": "01a0f1d2-e495-7fb0-bfbd-0756f51209c8",
34
+ "turnId": "01a0f1d2-e4e5-7f23-bb50-dd2bf74d6d0d",
35
+ "completedAtMs": 1790763536427
36
+ },
37
+ "emittedAtMs": 1790763536427
38
+ },
39
+ {
40
+ "method": "item/started",
41
+ "params": {
42
+ "item": {
43
+ "type": "collabAgentToolCall",
44
+ "id": "call_YtRZ7UDKyrnHgjoiR7IuFLSz",
45
+ "tool": "wait",
46
+ "status": "inProgress",
47
+ "senderThreadId": "01a0f1d2-e495-7fb0-bfbd-0756f51209c8",
48
+ "receiverThreadIds": [],
49
+ "prompt": null,
50
+ "model": null,
51
+ "reasoningEffort": null,
52
+ "agentsStates": {}
53
+ },
54
+ "threadId": "01a0f1d2-e495-7fb0-bfbd-0756f51209c8",
55
+ "turnId": "01a0f1d2-e4e5-7f23-bb50-dd2bf74d6d0d",
56
+ "startedAtMs": 1790763539654
57
+ },
58
+ "emittedAtMs": 1790763539654
59
+ },
60
+ {
61
+ "method": "item/started",
62
+ "params": {
63
+ "item": {
64
+ "type": "subAgentActivity",
65
+ "id": "subagent-completed-01a0f1d3-102b-7af0-9bcd-61b99f122d40",
66
+ "kind": "completed",
67
+ "agentThreadId": "01a0f1d3-101b-7122-bb83-37604ac8612c",
68
+ "agentPath": "/root/lifecycle_probe"
69
+ },
70
+ "threadId": "01a0f1d2-e495-7fb0-bfbd-0756f51209c8",
71
+ "turnId": "01a0f1d2-e4e5-7f23-bb50-dd2bf74d6d0d",
72
+ "startedAtMs": 1790763544490
73
+ },
74
+ "emittedAtMs": 1790763544490
75
+ },
76
+ {
77
+ "method": "item/completed",
78
+ "params": {
79
+ "item": {
80
+ "type": "subAgentActivity",
81
+ "id": "subagent-completed-01a0f1d3-102b-7af0-9bcd-61b99f122d40",
82
+ "kind": "completed",
83
+ "agentThreadId": "01a0f1d3-101b-7122-bb83-37604ac8612c",
84
+ "agentPath": "/root/lifecycle_probe"
85
+ },
86
+ "threadId": "01a0f1d2-e495-7fb0-bfbd-0756f51209c8",
87
+ "turnId": "01a0f1d2-e4e5-7f23-bb50-dd2bf74d6d0d",
88
+ "completedAtMs": 1790763544490
89
+ },
90
+ "emittedAtMs": 1790763544490
91
+ },
92
+ {
93
+ "method": "item/completed",
94
+ "params": {
95
+ "item": {
96
+ "type": "collabAgentToolCall",
97
+ "id": "call_YtRZ7UDKyrnHgjoiR7IuFLSz",
98
+ "tool": "wait",
99
+ "status": "completed",
100
+ "senderThreadId": "01a0f1d2-e495-7fb0-bfbd-0756f51209c8",
101
+ "receiverThreadIds": [],
102
+ "prompt": null,
103
+ "model": null,
104
+ "reasoningEffort": null,
105
+ "agentsStates": {}
106
+ },
107
+ "threadId": "01a0f1d2-e495-7fb0-bfbd-0756f51209c8",
108
+ "turnId": "01a0f1d2-e4e5-7f23-bb50-dd2bf74d6d0d",
109
+ "completedAtMs": 1790763544490
110
+ },
111
+ "emittedAtMs": 1790763544491
112
+ },
113
+ {
114
+ "method": "item/started",
115
+ "params": {
116
+ "item": {
117
+ "type": "subAgentActivity",
118
+ "id": "call_h6YPJZGuDhGHjLQJuLm6gMDK",
119
+ "kind": "interacted",
120
+ "agentThreadId": "01a0f1d3-101b-7122-bb83-37604ac8612c",
121
+ "agentPath": "/root/lifecycle_probe"
122
+ },
123
+ "threadId": "01a0f1d2-e495-7fb0-bfbd-0756f51209c8",
124
+ "turnId": "01a0f1d3-3a75-7201-90ce-6427a3cf6b3f",
125
+ "startedAtMs": 1790763552887
126
+ },
127
+ "emittedAtMs": 1790763552887
128
+ },
129
+ {
130
+ "method": "item/completed",
131
+ "params": {
132
+ "item": {
133
+ "type": "subAgentActivity",
134
+ "id": "call_h6YPJZGuDhGHjLQJuLm6gMDK",
135
+ "kind": "interacted",
136
+ "agentThreadId": "01a0f1d3-101b-7122-bb83-37604ac8612c",
137
+ "agentPath": "/root/lifecycle_probe"
138
+ },
139
+ "threadId": "01a0f1d2-e495-7fb0-bfbd-0756f51209c8",
140
+ "turnId": "01a0f1d3-3a75-7201-90ce-6427a3cf6b3f",
141
+ "completedAtMs": 1790763552887
142
+ },
143
+ "emittedAtMs": 1790763552888
144
+ },
145
+ {
146
+ "method": "item/started",
147
+ "params": {
148
+ "item": {
149
+ "type": "collabAgentToolCall",
150
+ "id": "call_aD4wqmZGY3JHHehDizgElfhK",
151
+ "tool": "wait",
152
+ "status": "inProgress",
153
+ "senderThreadId": "01a0f1d2-e495-7fb0-bfbd-0756f51209c8",
154
+ "receiverThreadIds": [],
155
+ "prompt": null,
156
+ "model": null,
157
+ "reasoningEffort": null,
158
+ "agentsStates": {}
159
+ },
160
+ "threadId": "01a0f1d2-e495-7fb0-bfbd-0756f51209c8",
161
+ "turnId": "01a0f1d3-3a75-7201-90ce-6427a3cf6b3f",
162
+ "startedAtMs": 1790763555263
163
+ },
164
+ "emittedAtMs": 1790763555263
165
+ },
166
+ {
167
+ "method": "item/started",
168
+ "params": {
169
+ "item": {
170
+ "type": "subAgentActivity",
171
+ "id": "subagent-completed-01a0f1d3-5077-7ab3-ab59-cdb575663b4f",
172
+ "kind": "completed",
173
+ "agentThreadId": "01a0f1d3-101b-7122-bb83-37604ac8612c",
174
+ "agentPath": "/root/lifecycle_probe"
175
+ },
176
+ "threadId": "01a0f1d2-e495-7fb0-bfbd-0756f51209c8",
177
+ "turnId": "01a0f1d3-3a75-7201-90ce-6427a3cf6b3f",
178
+ "startedAtMs": 1790763555749
179
+ },
180
+ "emittedAtMs": 1790763555749
181
+ },
182
+ {
183
+ "method": "item/completed",
184
+ "params": {
185
+ "item": {
186
+ "type": "subAgentActivity",
187
+ "id": "subagent-completed-01a0f1d3-5077-7ab3-ab59-cdb575663b4f",
188
+ "kind": "completed",
189
+ "agentThreadId": "01a0f1d3-101b-7122-bb83-37604ac8612c",
190
+ "agentPath": "/root/lifecycle_probe"
191
+ },
192
+ "threadId": "01a0f1d2-e495-7fb0-bfbd-0756f51209c8",
193
+ "turnId": "01a0f1d3-3a75-7201-90ce-6427a3cf6b3f",
194
+ "completedAtMs": 1790763555749
195
+ },
196
+ "emittedAtMs": 1790763555750
197
+ },
198
+ {
199
+ "method": "item/completed",
200
+ "params": {
201
+ "item": {
202
+ "type": "collabAgentToolCall",
203
+ "id": "call_aD4wqmZGY3JHHehDizgElfhK",
204
+ "tool": "wait",
205
+ "status": "completed",
206
+ "senderThreadId": "01a0f1d2-e495-7fb0-bfbd-0756f51209c8",
207
+ "receiverThreadIds": [],
208
+ "prompt": null,
209
+ "model": null,
210
+ "reasoningEffort": null,
211
+ "agentsStates": {}
212
+ },
213
+ "threadId": "01a0f1d2-e495-7fb0-bfbd-0756f51209c8",
214
+ "turnId": "01a0f1d3-3a75-7201-90ce-6427a3cf6b3f",
215
+ "completedAtMs": 1790763555750
216
+ },
217
+ "emittedAtMs": 1790763555750
218
+ }
219
+ ]
220
+ }
@@ -0,0 +1,74 @@
1
+ {
2
+ "version": "codex-cli 0.159.2",
3
+ "capturedAt": "2026-09-30T11:27:21.868Z",
4
+ "captureKind": "live-successful-turn",
5
+ "model": "gpt-6-astra",
6
+ "rootThreadId": "01a0f211-a052-7861-9810-745bd09593bf",
7
+ "note": "The live quota was 16 percent. This capture contains no exhausted-window error or reset. Credit balances and individual spend controls are omitted.",
8
+ "frames": [
9
+ {
10
+ "method": "turn/started",
11
+ "params": {
12
+ "threadId": "01a0f211-a052-7861-9810-745bd09593bf",
13
+ "turn": {
14
+ "id": "01a0f211-a0be-7212-94c7-39a8244ce58a",
15
+ "items": [],
16
+ "itemsView": "notLoaded",
17
+ "status": "inProgress",
18
+ "error": null,
19
+ "startedAt": 1790767636,
20
+ "completedAt": null,
21
+ "durationMs": null
22
+ }
23
+ },
24
+ "emittedAtMs": 1790767636675
25
+ },
26
+ {
27
+ "method": "account/rateLimits/updated",
28
+ "params": {
29
+ "rateLimits": {
30
+ "limitId": "codex",
31
+ "limitName": null,
32
+ "normalModelSlug": null,
33
+ "primary": {
34
+ "usedPercent": 16,
35
+ "windowDurationMins": 10080,
36
+ "resetsAt": 1791055009
37
+ },
38
+ "secondary": null,
39
+ "spendControlReached": null,
40
+ "planType": "pro",
41
+ "rateLimitReachedType": null
42
+ }
43
+ },
44
+ "emittedAtMs": 1790767641124
45
+ },
46
+ {
47
+ "method": "turn/completed",
48
+ "params": {
49
+ "threadId": "01a0f211-a052-7861-9810-745bd09593bf",
50
+ "turn": {
51
+ "id": "01a0f211-a0be-7212-94c7-39a8244ce58a",
52
+ "items": [
53
+ {
54
+ "type": "agentMessage",
55
+ "id": "msg_08e94bd26f7f2173016abcf218e25c87d2baf065fccee1c83c",
56
+ "text": "PONG",
57
+ "phase": "final_answer",
58
+ "memoryCitation": null,
59
+ "delivery": null,
60
+ "questions": null
61
+ }
62
+ ],
63
+ "itemsView": "summary",
64
+ "status": "completed",
65
+ "error": null,
66
+ "startedAt": 1790767636,
67
+ "completedAt": 1790767641,
68
+ "durationMs": 4463
69
+ }
70
+ },
71
+ "emittedAtMs": 1790767641137
72
+ }
73
+ ]
74
+ }
@@ -0,0 +1,89 @@
1
+ import type { ChatAttachment } from '@adecore/agent-contracts';
2
+
3
+ interface UserMessageInput {
4
+ promptId?: string;
5
+ text: string;
6
+ attachments?: ChatAttachment[];
7
+ // Written before the text, for what the CLI has no flag for (`ultrathink`).
8
+ prefix?: string;
9
+ // Skills the person picked with `$`; the CLI runs one, and only from its own last text block.
10
+ skills?: string[];
11
+ }
12
+
13
+ function isBoundary(char: string | undefined): boolean {
14
+ return char === undefined || /\s/.test(char);
15
+ }
16
+
17
+ function isTokenEnd(char: string | undefined): boolean {
18
+ return isBoundary(char) || /[.,;:!?)]/.test(char!);
19
+ }
20
+
21
+ /* Where a `$name` of a known skill sits in the text, as a whole token; -1 when it does not. */
22
+ function findSkillToken(text: string, name: string, from: number): number {
23
+ const token = `$${name}`;
24
+ let index = text.indexOf(token, from);
25
+ while (index >= 0) {
26
+ if (isBoundary(text[index - 1]) && isTokenEnd(text[index + token.length])) {
27
+ return index;
28
+ }
29
+ index = text.indexOf(token, index + 1);
30
+ }
31
+ return -1;
32
+ }
33
+
34
+ /* The last `$name` in the text that names one of the skills, longest name first on a tie. */
35
+ export function lastSkillToken(text: string, skills: string[]): { index: number; name: string } | null {
36
+ let best: { index: number; name: string } | null = null;
37
+ for (const name of [...new Set(skills)].sort((a, b) => b.length - a.length)) {
38
+ let index = findSkillToken(text, name, 0);
39
+ while (index >= 0) {
40
+ if (best === null || index > best.index) {
41
+ best = { index, name };
42
+ }
43
+ index = findSkillToken(text, name, index + 1);
44
+ }
45
+ }
46
+ return best;
47
+ }
48
+
49
+ /*
50
+ * The text blocks a prompt with skills becomes. Claude Code expands a skill only from a text block
51
+ * that starts with `/name` and is the last one in the message (verified against 2.1.267 with a
52
+ * skill that writes a marker file), so the last `$name` moves into a block of its own. Anything the
53
+ * person wrote before it stays a block in front, with the earlier `$x` written as `/x` so the model
54
+ * can still reach those through its Skill tool.
55
+ */
56
+ export function splitSkillPrompt(text: string, skills: string[]): { lead: string; invocation: string | null } {
57
+ const last = lastSkillToken(text, skills);
58
+ if (last === null) {
59
+ return { lead: text, invocation: null };
60
+ }
61
+ const lead = text.slice(0, last.index).replace(/\$([A-Za-z][A-Za-z0-9_:-]*)/g, (match, name: string) => (skills.includes(name) ? `/${name}` : match));
62
+ const rest = text.slice(last.index + last.name.length + 1).replace(/^[ \t]+/, '');
63
+ return { lead: lead.trimEnd(), invocation: rest === '' ? `/${last.name}` : `/${last.name} ${rest}` };
64
+ }
65
+
66
+ /* Paths stay in the prompt so the agent can also edit or copy the original attachments. */
67
+ export function attachmentNote(attachments: ChatAttachment[]): string {
68
+ return attachments.length === 0 ? '' : `Attached files:\n${attachments.map((attachment) => `- ${attachment.path} (${attachment.name})`).join('\n')}`;
69
+ }
70
+
71
+ /*
72
+ * The `user` frame the CLI reads on stdin. The message body is the Anthropic API shape: a content
73
+ * array of text blocks, which the CLI passes through unchanged (checked against claude 2.1.266).
74
+ * The attachments are named by path in the leading block, so the invocation of a skill stays last.
75
+ */
76
+ export function buildUserMessage({ text, attachments = [], prefix = '', skills = [], promptId }: UserMessageInput): Record<string, unknown> {
77
+ const content: unknown[] = [];
78
+ const { lead, invocation } = splitSkillPrompt(text, skills);
79
+ const note = attachmentNote(attachments);
80
+ // The prefix must be the first thing the model reads, so it joins the leading block.
81
+ const prompt = [`${prefix}${lead}`.trimEnd(), note].filter((part) => part.trim() !== '').join('\n\n');
82
+ if (prompt !== '') {
83
+ content.push({ type: 'text', text: prompt });
84
+ }
85
+ if (invocation !== null) {
86
+ content.push({ type: 'text', text: invocation });
87
+ }
88
+ return { type: 'user', message: { role: 'user', content }, parent_tool_use_id: null, session_id: '', ...(promptId ? { uuid: promptId } : {}) };
89
+ }
@@ -0,0 +1,74 @@
1
+ import type { ChatItem, ChatTurnItem, ChatTurnLimit } from '@adecore/agent-contracts';
2
+
3
+ /* How long the host waits before each next try of a turn that stopped on a limit; one more limited turn in a row than there are delays is an error like any other. */
4
+ export const LIMIT_RETRY_DELAYS_MS: readonly number[] = [60_000, 5 * 60_000, 15 * 60_000];
5
+
6
+ /* The last turn of a thread, when it stopped on a limit. */
7
+ export function limitedTurn(items: readonly ChatItem[]): (ChatTurnItem & { limit: ChatTurnLimit }) | null {
8
+ for (let i = items.length - 1; i >= 0; i--) {
9
+ const item = items[i]!;
10
+ if (item.kind === 'turn') {
11
+ return item.state === 'error' && item.limit !== undefined ? (item as ChatTurnItem & { limit: ChatTurnLimit }) : null;
12
+ }
13
+ }
14
+ return null;
15
+ }
16
+
17
+ /* How many turns in a row, up to and including this one, stopped on a limit: the tries a person did not step in between. */
18
+ function limitedInARow(items: readonly ChatItem[], turn: ChatTurnItem): number {
19
+ let count = 0;
20
+ let seen = false;
21
+ for (let i = items.length - 1; i >= 0; i--) {
22
+ const item = items[i]!;
23
+ if (item.kind !== 'turn') {
24
+ continue;
25
+ }
26
+ seen ||= item.id === turn.id;
27
+ if (!seen) {
28
+ continue;
29
+ }
30
+ if (item.state !== 'error' || item.limit === undefined) {
31
+ break;
32
+ }
33
+ count += 1;
34
+ }
35
+ return count;
36
+ }
37
+
38
+ /*
39
+ * When the host takes a limited turn up again, or null when it does not: a usage limit at its reset
40
+ * and an overload after 1, 5 and 15 minutes. A usage limit that holds past its reset waits those too,
41
+ * so a reset the plan did not keep never turns into a loop.
42
+ */
43
+ export function limitResumeAt(items: readonly ChatItem[], turn: ChatTurnItem, now: number): number | null {
44
+ if (turn.state !== 'error' || turn.limit === undefined) {
45
+ return null;
46
+ }
47
+ const tries = limitedInARow(items, turn);
48
+ const delay = LIMIT_RETRY_DELAYS_MS[tries - 1];
49
+ if (delay === undefined) {
50
+ return null;
51
+ }
52
+ if (turn.limit.kind === 'overload') {
53
+ return now + delay;
54
+ }
55
+ if (turn.limit.resetsAt === undefined) {
56
+ return null;
57
+ }
58
+ return tries === 1 ? turn.limit.resetsAt : Math.max(turn.limit.resetsAt, now + delay);
59
+ }
60
+
61
+ /* The turn the host opens to take a limited one up again: what the CLI is told, and what a person reads above it. */
62
+ export function limitResumeWake(kind: ChatTurnLimit['kind']): { text: string; label: string; note: string } {
63
+ return kind === 'usage'
64
+ ? {
65
+ text: 'Your previous turn stopped on a usage limit, which has reset now. Continue where you left off.',
66
+ label: 'Usage limit reset',
67
+ note: 'Resumed after the usage limit reset'
68
+ }
69
+ : {
70
+ text: 'Your previous turn stopped because the model was overloaded. Continue where you left off.',
71
+ label: 'Overloaded model',
72
+ note: 'Tried again after the model was overloaded'
73
+ };
74
+ }