@caspian2026/agent-sdk 0.0.19 → 0.0.21

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 (214) hide show
  1. package/dist/{chunk-v311af96.js → chunk-06xmvpv7.js} +17 -17
  2. package/dist/{chunk-pgs47kqs.js → chunk-079tw1d6.js} +13 -13
  3. package/dist/{chunk-1ts9qapj.js → chunk-08prz7zp.js} +6 -6
  4. package/dist/{chunk-e2nwdr09.js → chunk-0hqv6vq3.js} +15 -15
  5. package/dist/{chunk-hszdxe8f.js → chunk-0rbxzwnb.js} +15 -15
  6. package/dist/{chunk-dnb45dhp.js → chunk-102ee39t.js} +13 -13
  7. package/dist/{chunk-dn00fcy7.js → chunk-1058brys.js} +2 -2
  8. package/dist/{chunk-fvm8gehr.js → chunk-14qkwgmf.js} +3 -3
  9. package/dist/{chunk-6mqmk16a.js → chunk-1871fy77.js} +13 -13
  10. package/dist/{chunk-a2v77s0p.js → chunk-1ksywqf6.js} +2 -2
  11. package/dist/{chunk-qzf23s30.js → chunk-1q2taz28.js} +2 -2
  12. package/dist/{chunk-0rs4m3ya.js → chunk-24q2kxjm.js} +1 -1
  13. package/dist/{chunk-3t7kecay.js → chunk-25s7wwvz.js} +15 -15
  14. package/dist/{chunk-hav5hw2k.js → chunk-26b7qsct.js} +13 -13
  15. package/dist/{chunk-v4162e76.js → chunk-26sypsqa.js} +3 -4
  16. package/dist/{chunk-5cj7yfg1.js → chunk-26vzce3s.js} +19 -19
  17. package/dist/{chunk-3t2pkmek.js → chunk-27dhfb9v.js} +1 -1
  18. package/dist/{chunk-9hd3p970.js → chunk-2mdzhnxj.js} +14 -14
  19. package/dist/{chunk-gw9291xk.js → chunk-2qghgd3d.js} +3 -3
  20. package/dist/{chunk-xtanrzac.js → chunk-2qkcx6gx.js} +9 -9
  21. package/dist/{chunk-m86p6rs2.js → chunk-2xes6j9k.js} +24 -24
  22. package/dist/{chunk-7hfzfe98.js → chunk-33e7y2ye.js} +1 -1
  23. package/dist/{chunk-d4q90j1w.js → chunk-3csagva2.js} +13 -13
  24. package/dist/{chunk-kwp6116t.js → chunk-3jwpbxxx.js} +15 -15
  25. package/dist/{chunk-0r04e4ap.js → chunk-3mqgy4d8.js} +2 -2
  26. package/dist/{chunk-5xkp0tnb.js → chunk-3pm48qgm.js} +21 -21
  27. package/dist/{chunk-hpd100ja.js → chunk-3tx97a7z.js} +17 -17
  28. package/dist/{chunk-nc7kjfxk.js → chunk-3w6dvw7z.js} +13 -13
  29. package/dist/{chunk-vj9segre.js → chunk-40p1xyv4.js} +7 -7
  30. package/dist/{chunk-dhfag5m0.js → chunk-4621eys4.js} +3 -3
  31. package/dist/{chunk-ngc2r6jc.js → chunk-46y1vrxs.js} +1 -1
  32. package/dist/{chunk-a5cj5yk1.js → chunk-49ce42vr.js} +1 -1
  33. package/dist/{chunk-1hg8ktay.js → chunk-4bjfp2cp.js} +14 -14
  34. package/dist/{chunk-dmahh26f.js → chunk-4nyewkpd.js} +1 -1
  35. package/dist/{chunk-p81gg65v.js → chunk-4sk0ekmh.js} +9253 -2390
  36. package/dist/{chunk-110c7hek.js → chunk-4th9sgzv.js} +2 -2
  37. package/dist/{chunk-zt86q6j5.js → chunk-50cqjkgy.js} +14 -14
  38. package/dist/{chunk-3jp8zgek.js → chunk-530bp1wc.js} +1 -1
  39. package/dist/{chunk-qpaeatmf.js → chunk-59564wn5.js} +13 -13
  40. package/dist/{chunk-qwa7xy95.js → chunk-5e4jj4hd.js} +13 -13
  41. package/dist/{chunk-w328d3yn.js → chunk-5jkawn33.js} +3 -3
  42. package/dist/{chunk-40gj4vgn.js → chunk-5wnkq46y.js} +2 -2
  43. package/dist/{chunk-5h1wfdk2.js → chunk-65w2019d.js} +8 -8
  44. package/dist/{chunk-03jc62cq.js → chunk-66wbs5de.js} +13 -13
  45. package/dist/{chunk-ft4dxnwq.js → chunk-68ypktng.js} +1 -1
  46. package/dist/{chunk-nsbtda9y.js → chunk-69bms9eh.js} +14 -14
  47. package/dist/{chunk-m626yecd.js → chunk-7641fj0b.js} +13 -13
  48. package/dist/{chunk-1j0n05rf.js → chunk-7gy9xrjc.js} +1 -1
  49. package/dist/{chunk-0zprysa2.js → chunk-7k74bhsg.js} +13 -13
  50. package/dist/{chunk-bdb81673.js → chunk-7pz9rdg8.js} +1 -1
  51. package/dist/{chunk-ntztbz5t.js → chunk-7ry9qp54.js} +13 -13
  52. package/dist/{chunk-6fes9049.js → chunk-7v902gw4.js} +4 -4
  53. package/dist/{chunk-vtjgsgyf.js → chunk-7vhfhyq0.js} +13 -13
  54. package/dist/{chunk-d564dtpq.js → chunk-7w4n7zr8.js} +21 -21
  55. package/dist/{chunk-kde61fqf.js → chunk-86fwp0mg.js} +62 -62
  56. package/dist/{chunk-bamjc1k5.js → chunk-8knpmkt5.js} +1 -1
  57. package/dist/{chunk-f0eqte4j.js → chunk-8mpv3j7b.js} +13 -13
  58. package/dist/{chunk-ypsecc1v.js → chunk-8scyf6tf.js} +14 -14
  59. package/dist/chunk-92cczfwx.js +903 -0
  60. package/dist/{chunk-rtbrh4ac.js → chunk-9r16nw6z.js} +19 -19
  61. package/dist/{chunk-3jh2z27c.js → chunk-9rm2hczd.js} +13 -13
  62. package/dist/{chunk-2e8ybf05.js → chunk-9shyda79.js} +2 -2
  63. package/dist/{chunk-rtbar3a1.js → chunk-9t8650e0.js} +13 -13
  64. package/dist/{chunk-t300xs2e.js → chunk-9znd08ha.js} +5 -5
  65. package/dist/{chunk-drqk484j.js → chunk-a0qftggg.js} +1 -1
  66. package/dist/{chunk-t5jqejqk.js → chunk-ab78zrxc.js} +22 -22
  67. package/dist/{chunk-fkr3tfcs.js → chunk-acj1j3dw.js} +3 -3
  68. package/dist/{chunk-1vyfr81c.js → chunk-aj7nt1ae.js} +1 -1
  69. package/dist/{chunk-xq0q4bky.js → chunk-akd5hjav.js} +2 -2
  70. package/dist/{chunk-4ce75svs.js → chunk-ang6j1ma.js} +5 -5
  71. package/dist/{chunk-302xme7e.js → chunk-arrvgw6z.js} +51 -50
  72. package/dist/{chunk-f84vvk41.js → chunk-as3pvrmw.js} +4 -4
  73. package/dist/{chunk-eqj42wkk.js → chunk-b08zb0sw.js} +15 -15
  74. package/dist/{chunk-844zmnw6.js → chunk-ba473zak.js} +13 -13
  75. package/dist/{chunk-z0pmdn8s.js → chunk-bgzwt111.js} +2 -2
  76. package/dist/{chunk-7wg82yq4.js → chunk-bpes1x7d.js} +63 -63
  77. package/dist/{chunk-czsjnagp.js → chunk-brbrrj03.js} +21 -21
  78. package/dist/{chunk-hca6b2e5.js → chunk-bs975312.js} +15 -15
  79. package/dist/{chunk-yrr23vr1.js → chunk-bww6hm2e.js} +2 -2
  80. package/dist/{chunk-qs3g8f9e.js → chunk-c67ypsa8.js} +1 -1
  81. package/dist/{chunk-s6cxke3j.js → chunk-cgy9g4wp.js} +14 -14
  82. package/dist/{chunk-gmdt7w5d.js → chunk-cmtvwbwf.js} +1 -1
  83. package/dist/{chunk-sqckd5nx.js → chunk-cpywwph7.js} +14 -14
  84. package/dist/{chunk-6rvr3wwq.js → chunk-crcrnd8y.js} +4 -4
  85. package/dist/{chunk-srkc8pwp.js → chunk-crfk7ed8.js} +2 -2
  86. package/dist/{chunk-c073acgz.js → chunk-crvwmrey.js} +2 -2
  87. package/dist/{chunk-rn7w9k0a.js → chunk-d6kvya9n.js} +9 -9
  88. package/dist/{chunk-pd0yqtm8.js → chunk-daqd8kee.js} +24 -24
  89. package/dist/{chunk-v6qvcajp.js → chunk-db2awvr6.js} +1 -1
  90. package/dist/{chunk-bpkpy613.js → chunk-dhk2dt7n.js} +14 -14
  91. package/dist/{chunk-c33r7wby.js → chunk-dq94esjd.js} +1 -1
  92. package/dist/{chunk-d6eym4sa.js → chunk-dw1x0kzg.js} +13 -13
  93. package/dist/{chunk-1fb0jqty.js → chunk-e28pnfmr.js} +15 -15
  94. package/dist/{chunk-w022zpyz.js → chunk-effhh1pw.js} +1 -1
  95. package/dist/{chunk-xk89d6vy.js → chunk-efrjt26j.js} +3 -3
  96. package/dist/{chunk-readr4t2.js → chunk-em7h8kqy.js} +15 -15
  97. package/dist/{chunk-k6bpr2zz.js → chunk-enkgx9p5.js} +13 -13
  98. package/dist/{chunk-hz31bs21.js → chunk-f99jr604.js} +2 -2
  99. package/dist/{chunk-c2nnhgr2.js → chunk-f9mnmjf4.js} +2 -2
  100. package/dist/{chunk-mccjtnrw.js → chunk-fc8mescd.js} +13 -2
  101. package/dist/{chunk-wn3zb71r.js → chunk-fddfa07d.js} +14 -14
  102. package/dist/{chunk-g0x0gksg.js → chunk-ffcwak1t.js} +14 -14
  103. package/dist/{chunk-jqn60wdn.js → chunk-fgmmtj9k.js} +8 -8
  104. package/dist/{chunk-txn11vtv.js → chunk-fj3a38w3.js} +1 -1
  105. package/dist/{chunk-a1gwg4fx.js → chunk-fk60d1qf.js} +2 -2
  106. package/dist/{chunk-knbjqnc7.js → chunk-fnxysrtm.js} +2 -2
  107. package/dist/{chunk-bjwdqabf.js → chunk-fq24vgdm.js} +21 -21
  108. package/dist/{chunk-tz9r44d9.js → chunk-fs7jna05.js} +14 -14
  109. package/dist/{chunk-a6328ts5.js → chunk-g0wv2y40.js} +2 -2
  110. package/dist/{chunk-f6xzr8q2.js → chunk-g3gr434c.js} +13 -13
  111. package/dist/{chunk-hr9c2w99.js → chunk-g3zgsm5x.js} +1 -1
  112. package/dist/{chunk-p1sn36ax.js → chunk-g9q2patf.js} +1 -1
  113. package/dist/{chunk-5bs3xf11.js → chunk-ge8zt73c.js} +13 -13
  114. package/dist/{chunk-rnajq3vk.js → chunk-gk8dvdsw.js} +14 -14
  115. package/dist/{chunk-0075f5sb.js → chunk-gw6kn54v.js} +2 -2
  116. package/dist/{chunk-65j4q40b.js → chunk-gzt1cd1y.js} +14 -14
  117. package/dist/{chunk-36akc07b.js → chunk-hcwcwa84.js} +1 -1
  118. package/dist/{chunk-7yp1ra14.js → chunk-hf96emr1.js} +1 -1
  119. package/dist/{chunk-7s3g2nbw.js → chunk-hgteysah.js} +3 -3
  120. package/dist/{chunk-vc12yftf.js → chunk-hszppxh0.js} +1 -1
  121. package/dist/{chunk-ajrrg4t1.js → chunk-hvbnh0ht.js} +16 -16
  122. package/dist/{chunk-rjsfkzty.js → chunk-hwyp85fa.js} +3 -3
  123. package/dist/{chunk-v8twrmnw.js → chunk-jagq2tcw.js} +22 -22
  124. package/dist/{chunk-yvvgfb9f.js → chunk-jgwfkvdk.js} +14 -14
  125. package/dist/{chunk-q9t2n7d1.js → chunk-jhrshs1y.js} +14 -14
  126. package/dist/{chunk-pywnxth6.js → chunk-jjnmcaeb.js} +6 -6
  127. package/dist/{chunk-m8wxbjg3.js → chunk-jtjqrrtq.js} +2 -2
  128. package/dist/{chunk-9ed7v1qq.js → chunk-jtx7ka0g.js} +13 -13
  129. package/dist/{chunk-k2p273gs.js → chunk-jvdhwjth.js} +15 -15
  130. package/dist/{chunk-5c980jax.js → chunk-k4xyha98.js} +2 -2
  131. package/dist/{chunk-hgdxffqr.js → chunk-k6tvcn37.js} +2 -2
  132. package/dist/{chunk-q0kafg58.js → chunk-kbqx20y8.js} +13 -13
  133. package/dist/{chunk-e8s2e141.js → chunk-khnqc2x8.js} +1 -1
  134. package/dist/{chunk-brqy29g9.js → chunk-kqc0x8w6.js} +18 -18
  135. package/dist/{chunk-dfszv6kn.js → chunk-m1ergjg5.js} +2 -2
  136. package/dist/{chunk-t04tpqda.js → chunk-m4k4mve9.js} +14 -14
  137. package/dist/{chunk-4e708nwk.js → chunk-mfdqvcr5.js} +2 -2
  138. package/dist/{chunk-eert2day.js → chunk-mgv4r1af.js} +3 -3
  139. package/dist/{chunk-6s68m1dg.js → chunk-mh52m71p.js} +3 -3
  140. package/dist/{chunk-a1s9n17m.js → chunk-mjcxt56a.js} +3 -3
  141. package/dist/{chunk-kc8am0nn.js → chunk-mpc6f96q.js} +13 -13
  142. package/dist/{chunk-a5ry85ct.js → chunk-mra3tr23.js} +2 -2
  143. package/dist/{chunk-k737m0z6.js → chunk-mxt0a1ab.js} +14 -14
  144. package/dist/{chunk-0e495v4y.js → chunk-mympkkbw.js} +13 -13
  145. package/dist/{chunk-3kf30xba.js → chunk-mzrxzmpm.js} +16 -16
  146. package/dist/{chunk-b9t57m67.js → chunk-n0zd06za.js} +3 -3
  147. package/dist/{chunk-e83tfqyt.js → chunk-n22k5xdw.js} +1 -1
  148. package/dist/{chunk-w2qjc4dy.js → chunk-n9ftnh2y.js} +4 -4
  149. package/dist/{chunk-6g0hnb1k.js → chunk-nd39ny9k.js} +13 -13
  150. package/dist/{chunk-8457y05z.js → chunk-nd7zx01p.js} +3 -3
  151. package/dist/{chunk-4wx02mba.js → chunk-pajqjgkr.js} +3 -3
  152. package/dist/{chunk-b3q5g3x5.js → chunk-pe824pp5.js} +1 -1
  153. package/dist/{chunk-89vrm4ae.js → chunk-phr23vzw.js} +1 -1
  154. package/dist/{chunk-t3se5crr.js → chunk-pqe0s3es.js} +14 -14
  155. package/dist/{chunk-e4vx828d.js → chunk-px0z9762.js} +15 -15
  156. package/dist/{chunk-bbc9f5q9.js → chunk-q4wj3v8n.js} +4 -4
  157. package/dist/{chunk-mys37bb4.js → chunk-qr516hqj.js} +13 -13
  158. package/dist/{chunk-2vj1ta7d.js → chunk-qswz887n.js} +13 -13
  159. package/dist/{chunk-sa1pvh58.js → chunk-r1w3jrs8.js} +15 -15
  160. package/dist/{chunk-xrb6mn8j.js → chunk-r5q49139.js} +15 -15
  161. package/dist/{chunk-3f2ryn4p.js → chunk-rs4yvre8.js} +4 -4
  162. package/dist/{chunk-adtgferq.js → chunk-s07p92v4.js} +13 -13
  163. package/dist/{chunk-pzxz2an7.js → chunk-s8hykxf5.js} +14 -14
  164. package/dist/{chunk-5gjwp5bc.js → chunk-scz7dzwq.js} +25 -25
  165. package/dist/{chunk-7d24zw5w.js → chunk-sncz1ag3.js} +13 -13
  166. package/dist/{chunk-py5ytxp4.js → chunk-ssec5007.js} +1 -1
  167. package/dist/{chunk-q3w82drt.js → chunk-t32ddjb3.js} +2 -2
  168. package/dist/{chunk-2ewarpza.js → chunk-t7j96x8z.js} +14 -14
  169. package/dist/{chunk-d9e7ndag.js → chunk-tgafrp5a.js} +4 -4
  170. package/dist/{chunk-f3ychkjd.js → chunk-tgnbeeyx.js} +2 -2
  171. package/dist/{chunk-d5eckc42.js → chunk-tndhag9g.js} +3 -3
  172. package/dist/{chunk-0n4n14c1.js → chunk-tr9zera9.js} +4 -4
  173. package/dist/{chunk-1e1rjstz.js → chunk-tz3td6hy.js} +13 -13
  174. package/dist/{chunk-arhmkw0v.js → chunk-v17y7qay.js} +13 -13
  175. package/dist/{chunk-qh5p43j4.js → chunk-v5brqghz.js} +2 -2
  176. package/dist/{chunk-ywhmg8xp.js → chunk-vbmdqx87.js} +3 -3
  177. package/dist/{chunk-a2hq2yt9.js → chunk-vcwzs8xk.js} +1 -1
  178. package/dist/{chunk-ahxpxdqg.js → chunk-vf9320w1.js} +14 -14
  179. package/dist/{chunk-nc0ve25x.js → chunk-vneepj82.js} +3 -3
  180. package/dist/{chunk-8bxm9bv1.js → chunk-vr96pznr.js} +15 -15
  181. package/dist/{chunk-7eb2qp91.js → chunk-vszex7fm.js} +16 -16
  182. package/dist/{chunk-rs4yayw6.js → chunk-vv7kzavx.js} +1 -1
  183. package/dist/{chunk-2tb0e476.js → chunk-vwxpwg2r.js} +24 -24
  184. package/dist/{chunk-s7x8ajv3.js → chunk-vzzsjg7m.js} +4 -4
  185. package/dist/{chunk-hnwg3k83.js → chunk-w0dz2sa5.js} +1 -1
  186. package/dist/{chunk-wc67aegv.js → chunk-w1fb9aqj.js} +1 -1
  187. package/dist/{chunk-1cpeddhv.js → chunk-w43b6749.js} +3 -3
  188. package/dist/{chunk-1pjgxfeq.js → chunk-w9a226y4.js} +13 -13
  189. package/dist/{chunk-rshp5b43.js → chunk-wf16jx1f.js} +2 -2
  190. package/dist/{chunk-eady4fzn.js → chunk-wkny3k77.js} +1 -1
  191. package/dist/{chunk-vffwxpad.js → chunk-wsfq03qa.js} +16 -16
  192. package/dist/{chunk-z2npjf0h.js → chunk-x12h3n65.js} +650 -52
  193. package/dist/{chunk-j03zh8dy.js → chunk-x1dw8vry.js} +15 -15
  194. package/dist/{chunk-8svj497n.js → chunk-x5wgbcme.js} +1 -1
  195. package/dist/{chunk-y6x9kgba.js → chunk-x70f036b.js} +4 -4
  196. package/dist/{chunk-qatqd4rk.js → chunk-xca0q5ap.js} +1 -1
  197. package/dist/{chunk-c0vhnnct.js → chunk-xg08qv1e.js} +13 -13
  198. package/dist/{chunk-by2e46kd.js → chunk-xv78ch6z.js} +16 -16
  199. package/dist/{chunk-3dx4h9pq.js → chunk-xy94q6qg.js} +14 -14
  200. package/dist/{chunk-gy4se0z5.js → chunk-y4d1sgf4.js} +14 -14
  201. package/dist/{chunk-mq451b1k.js → chunk-y9ffgh1g.js} +22 -22
  202. package/dist/{chunk-py7pm42n.js → chunk-ycs5r2ef.js} +3 -3
  203. package/dist/{chunk-7n6tk7rw.js → chunk-yde1e32y.js} +6 -6
  204. package/dist/{chunk-w28zrffk.js → chunk-yfztvfhh.js} +22 -22
  205. package/dist/{chunk-m2yqqry6.js → chunk-yjk0f08a.js} +85 -85
  206. package/dist/{chunk-7m3a6kb8.js → chunk-zcq3r82m.js} +13 -13
  207. package/dist/{chunk-4xwfsejb.js → chunk-zecx4x3b.js} +2 -2
  208. package/dist/{chunk-f9wnty9x.js → chunk-zpdzhck8.js} +1 -1
  209. package/dist/{chunk-670trxyg.js → chunk-zpw4ny96.js} +1 -1
  210. package/dist/{chunk-nzdz8raj.js → chunk-zv1frw5e.js} +13 -13
  211. package/dist/cli.js +6 -6
  212. package/dist/gateway/worker.js +161802 -158117
  213. package/package.json +1 -1
  214. package/dist/chunk-ggg97179.js +0 -7442
@@ -13,19 +13,19 @@ import {
13
13
  permissionPromptToolResultToPermissionDecision,
14
14
  processUserInput,
15
15
  reconcileMarketplaces
16
- } from "./chunk-pywnxth6.js";
16
+ } from "./chunk-jjnmcaeb.js";
17
17
  import {
18
18
  detectAndUninstallDelistedPlugins
19
- } from "./chunk-fvm8gehr.js";
19
+ } from "./chunk-14qkwgmf.js";
20
20
  import {
21
21
  restoreAgentFromSession,
22
22
  restoreSessionStateFromLog,
23
23
  skillChangeDetector
24
- } from "./chunk-t300xs2e.js";
24
+ } from "./chunk-9znd08ha.js";
25
25
  import"./chunk-21jaw3mt.js";
26
26
  import {
27
27
  externalMetadataToAppState
28
- } from "./chunk-fkr3tfcs.js";
28
+ } from "./chunk-acj1j3dw.js";
29
29
  import {
30
30
  getSessionState,
31
31
  notifySessionMetadataChanged,
@@ -33,23 +33,23 @@ import {
33
33
  setPermissionModeChangedListener,
34
34
  setSessionMetadataChangedListener,
35
35
  setSessionStateChangedListener
36
- } from "./chunk-e83tfqyt.js";
36
+ } from "./chunk-n22k5xdw.js";
37
37
  import {
38
38
  init_toolPool,
39
39
  mergeAndFilterTools
40
- } from "./chunk-hgdxffqr.js";
41
- import"./chunk-b3q5g3x5.js";
40
+ } from "./chunk-k6tvcn37.js";
41
+ import"./chunk-pe824pp5.js";
42
42
  import {
43
43
  init_settingsSync
44
- } from "./chunk-ywhmg8xp.js";
44
+ } from "./chunk-vbmdqx87.js";
45
45
  import {
46
46
  init_refresh,
47
47
  refreshActivePlugins
48
- } from "./chunk-txn11vtv.js";
48
+ } from "./chunk-fj3a38w3.js";
49
49
  import {
50
50
  generateSessionTitle,
51
51
  init_sessionTitle
52
- } from "./chunk-py5ytxp4.js";
52
+ } from "./chunk-ssec5007.js";
53
53
  import {
54
54
  init_systemTheme,
55
55
  resolveThemeSetting
@@ -60,12 +60,12 @@ import {
60
60
  toInternalMessages,
61
61
  toSDKCompactMetadata,
62
62
  toSDKRateLimitInfo
63
- } from "./chunk-vc12yftf.js";
63
+ } from "./chunk-hszppxh0.js";
64
64
  import {
65
65
  checkGroveForNonInteractive,
66
66
  init_grove,
67
67
  isQualifiedForGrove
68
- } from "./chunk-xq0q4bky.js";
68
+ } from "./chunk-akd5hjav.js";
69
69
  import {
70
70
  ChannelMessageNotificationSchema,
71
71
  findChannelEntry,
@@ -75,17 +75,17 @@ import {
75
75
  init_omit,
76
76
  omit_default,
77
77
  wrapChannelMessage
78
- } from "./chunk-a5ry85ct.js";
79
- import"./chunk-rjsfkzty.js";
80
- import"./chunk-q3w82drt.js";
78
+ } from "./chunk-mra3tr23.js";
79
+ import"./chunk-hwyp85fa.js";
80
+ import"./chunk-t32ddjb3.js";
81
81
  import {
82
82
  collectContextData,
83
83
  init_context_noninteractive
84
- } from "./chunk-dfszv6kn.js";
84
+ } from "./chunk-m1ergjg5.js";
85
85
  import {
86
86
  init_sideQuestion,
87
87
  runSideQuestion
88
- } from "./chunk-3jp8zgek.js";
88
+ } from "./chunk-530bp1wc.js";
89
89
  import"./chunk-rn0v1hk8.js";
90
90
  import {
91
91
  CircularBuffer,
@@ -243,6 +243,7 @@ import {
243
243
  init_sessionStart,
244
244
  init_sessionStorage,
245
245
  init_shellToolUtils,
246
+ init_sideQuery,
246
247
  init_stopTask,
247
248
  init_systemPromptType,
248
249
  init_teammateMailbox,
@@ -312,6 +313,7 @@ import {
312
313
  setupSdkMcpClients,
313
314
  setupVscodeSdkMcp,
314
315
  shouldEnableThinkingByDefault,
316
+ sideQuery,
315
317
  startQueryProfile,
316
318
  statusListeners,
317
319
  stopTask,
@@ -324,17 +326,17 @@ import {
324
326
  unregisterSessionActivityCallback,
325
327
  updateUsage,
326
328
  validateUuid
327
- } from "./chunk-p81gg65v.js";
329
+ } from "./chunk-4sk0ekmh.js";
328
330
  import"./chunk-mcws22k3.js";
329
331
  import"./chunk-jzthz1bx.js";
330
- import"./chunk-0rs4m3ya.js";
332
+ import"./chunk-24q2kxjm.js";
331
333
  import"./chunk-hwfknpxv.js";
332
334
  import"./chunk-1gx78081.js";
333
335
  import"./chunk-ehtwnxpg.js";
334
- import"./chunk-0r04e4ap.js";
336
+ import"./chunk-3mqgy4d8.js";
335
337
  import {
336
338
  init_commitAttribution
337
- } from "./chunk-e8s2e141.js";
339
+ } from "./chunk-khnqc2x8.js";
338
340
  import"./chunk-x47h283a.js";
339
341
  import {
340
342
  hasActiveInProcessTeammates,
@@ -346,7 +348,7 @@ import {
346
348
  removeTeammateFromTeamFile,
347
349
  unassignTeammateTasks,
348
350
  waitForTeammatesToBecomeIdle
349
- } from "./chunk-7yp1ra14.js";
351
+ } from "./chunk-hf96emr1.js";
350
352
  import"./chunk-2gzv8nrw.js";
351
353
  import"./chunk-e0abab5b.js";
352
354
  import"./chunk-cgfdkzhb.js";
@@ -358,15 +360,17 @@ import {
358
360
  init_fileStateCache,
359
361
  mergeFileStateCaches
360
362
  } from "./chunk-j5bth84e.js";
361
- import"./chunk-qatqd4rk.js";
363
+ import"./chunk-xca0q5ap.js";
362
364
  import"./chunk-68ffk5qa.js";
363
365
  import"./chunk-ps49ymvj.js";
364
366
  import {
365
367
  init_betas,
366
368
  init_cost_tracker,
367
369
  modelSupportsAutoMode
368
- } from "./chunk-v4162e76.js";
370
+ } from "./chunk-26sypsqa.js";
369
371
  import {
372
+ calculateCostFromTokens,
373
+ calculateUSDCost,
370
374
  ensureModelStringsInitialized,
371
375
  getAPIProvider,
372
376
  getDefaultMainLoopModel,
@@ -374,6 +378,7 @@ import {
374
378
  getMainLoopModel,
375
379
  init_fastMode,
376
380
  init_model,
381
+ init_modelCost,
377
382
  init_modelStrings,
378
383
  init_providers,
379
384
  isFastModeAvailable,
@@ -381,7 +386,7 @@ import {
381
386
  isFastModeSupportedByModel,
382
387
  modelDisplayString,
383
388
  parseUserSpecifiedModel
384
- } from "./chunk-mccjtnrw.js";
389
+ } from "./chunk-fc8mescd.js";
385
390
  import {
386
391
  createAxiosInstance,
387
392
  getWebSocketProxyAgent,
@@ -390,11 +395,11 @@ import {
390
395
  init_mtls,
391
396
  init_proxy
392
397
  } from "./chunk-pgtnj1mt.js";
393
- import"./chunk-ft4dxnwq.js";
398
+ import"./chunk-68ypktng.js";
394
399
  import"./chunk-p7vkh4wx.js";
395
400
  import"./chunk-y9bhjjdz.js";
396
- import"./chunk-bdb81673.js";
397
- import"./chunk-1j0n05rf.js";
401
+ import"./chunk-7pz9rdg8.js";
402
+ import"./chunk-7gy9xrjc.js";
398
403
  import"./chunk-dfzkwynj.js";
399
404
  import"./chunk-xeb6075z.js";
400
405
  import"./chunk-fcynwjpm.js";
@@ -403,7 +408,7 @@ import {
403
408
  ElicitationCompleteNotificationSchema,
404
409
  init_types
405
410
  } from "./chunk-v4t6dyyh.js";
406
- import"./chunk-89vrm4ae.js";
411
+ import"./chunk-phr23vzw.js";
407
412
  import"./chunk-v8kjswxt.js";
408
413
  import {
409
414
  AGENT_TOOL_NAME,
@@ -435,7 +440,7 @@ import {
435
440
  initializeGrowthBook,
436
441
  isExtractModeActive,
437
442
  runWithWorkload
438
- } from "./chunk-bbc9f5q9.js";
443
+ } from "./chunk-q4wj3v8n.js";
439
444
  import {
440
445
  init_json,
441
446
  safeParseJSON
@@ -2665,6 +2670,516 @@ init_cost_tracker();
2665
2670
  init_memdir();
2666
2671
  init_paths();
2667
2672
  init_query();
2673
+ import { randomUUID as randomUUID3 } from "crypto";
2674
+
2675
+ // src/utils/autoMode/runtime.ts
2676
+ init_modelCost();
2677
+
2678
+ // src/utils/taskCompletion/controlMessage.ts
2679
+ function createCompletionControlMessage(content, origin) {
2680
+ return {
2681
+ type: "user",
2682
+ message: { role: "user", content },
2683
+ isMeta: true,
2684
+ origin,
2685
+ uuid: crypto.randomUUID(),
2686
+ timestamp: new Date().toISOString()
2687
+ };
2688
+ }
2689
+
2690
+ // src/utils/autoMode/controlMessage.ts
2691
+ function createAutoModeControlMessage(content) {
2692
+ return createCompletionControlMessage(content, "auto_mode_control");
2693
+ }
2694
+
2695
+ // src/utils/taskCompletion/judge.ts
2696
+ init_modelCost();
2697
+ init_sideQuery();
2698
+ var VERDICT_TOOL_NAME = "auto_mode_verdict";
2699
+ var MAX_EVIDENCE_CHARS = 1e5;
2700
+ var MAX_BLOCK_CHARS = 8000;
2701
+ var VERDICT_TOOL = {
2702
+ name: VERDICT_TOOL_NAME,
2703
+ description: "Report whether the original task is complete or impossible based only on transcript evidence.",
2704
+ input_schema: {
2705
+ type: "object",
2706
+ properties: {
2707
+ done: { type: "boolean" },
2708
+ impossible: { type: "boolean" },
2709
+ reason: { type: "string" },
2710
+ nextStep: { type: "string" }
2711
+ },
2712
+ required: ["done", "impossible", "reason", "nextStep"],
2713
+ additionalProperties: false
2714
+ }
2715
+ };
2716
+ var JUDGE_SYSTEM_PROMPT = `You are an independent completion judge for an automated coding task.
2717
+ Use only concrete transcript evidence. The assistant's claim that work is complete is not evidence.
2718
+ Set done=true only when the original request is fully satisfied and verification evidence is present when appropriate.
2719
+ Set impossible=true only when the transcript proves that continued autonomous work cannot make progress.
2720
+ Otherwise set both flags false and provide one concise next step. Always call the provided verdict tool.`;
2721
+ function logJudgeVerdict(label, detail) {
2722
+ console.warn(`[${label}] ${detail}`);
2723
+ }
2724
+ function truncate(value) {
2725
+ return value.length <= MAX_BLOCK_CHARS ? value : `${value.slice(0, MAX_BLOCK_CHARS)}...[truncated]`;
2726
+ }
2727
+ function serializeContent(content) {
2728
+ if (typeof content === "string")
2729
+ return truncate(content);
2730
+ if (!Array.isArray(content))
2731
+ return content;
2732
+ return content.map((block) => {
2733
+ if (!block || typeof block !== "object")
2734
+ return block;
2735
+ if ("type" in block && block.type === "image")
2736
+ return { type: "image", omitted: true };
2737
+ if ("content" in block && typeof block.content === "string") {
2738
+ return { ...block, content: truncate(block.content) };
2739
+ }
2740
+ if ("text" in block && typeof block.text === "string") {
2741
+ return { ...block, text: truncate(block.text) };
2742
+ }
2743
+ return block;
2744
+ });
2745
+ }
2746
+ function serializeJudgeEvidence(originalRequest, messages) {
2747
+ const entries = [
2748
+ { type: "original_request", content: serializeContent(originalRequest) }
2749
+ ];
2750
+ for (const message of messages) {
2751
+ if (message.type !== "user" && message.type !== "assistant")
2752
+ continue;
2753
+ entries.push({
2754
+ type: message.type === "user" && message.isMeta ? message.origin ?? "completion_control" : message.type,
2755
+ content: serializeContent(message.message?.content)
2756
+ });
2757
+ }
2758
+ const originalEntry = entries[0];
2759
+ const boundedEntries = [originalEntry];
2760
+ let serializedLength = JSON.stringify([originalEntry]).length;
2761
+ const tailEntries = [];
2762
+ let truncated = false;
2763
+ for (let index = entries.length - 1;index >= 1; index--) {
2764
+ const entry = entries[index];
2765
+ const serializedEntry = JSON.stringify(entry);
2766
+ if (serializedLength + serializedEntry.length + 1 > MAX_EVIDENCE_CHARS) {
2767
+ truncated = true;
2768
+ break;
2769
+ }
2770
+ tailEntries.unshift(entry);
2771
+ serializedLength += serializedEntry.length + 1;
2772
+ }
2773
+ if (truncated)
2774
+ boundedEntries.push({ type: "evidence_truncated" });
2775
+ boundedEntries.push(...tailEntries);
2776
+ return JSON.stringify(boundedEntries);
2777
+ }
2778
+ function parseVerdict(message) {
2779
+ const block = message.content.find((candidate) => candidate.type === "tool_use" && candidate.name === VERDICT_TOOL_NAME);
2780
+ if (!block || block.type !== "tool_use" || !block.input || typeof block.input !== "object") {
2781
+ throw new Error("Judge did not return the required verdict tool call");
2782
+ }
2783
+ const input = block.input;
2784
+ if (typeof input.done !== "boolean" || typeof input.impossible !== "boolean" || typeof input.reason !== "string" || typeof input.nextStep !== "string" || input.done && input.impossible) {
2785
+ throw new Error("Judge returned a malformed verdict");
2786
+ }
2787
+ return {
2788
+ done: input.done,
2789
+ impossible: input.impossible,
2790
+ reason: truncate(input.reason),
2791
+ nextStep: truncate(input.nextStep)
2792
+ };
2793
+ }
2794
+ function usageDelta(usage, usd) {
2795
+ return {
2796
+ inputTokens: usage.input_tokens,
2797
+ outputTokens: usage.output_tokens,
2798
+ cacheReadInputTokens: usage.cache_read_input_tokens ?? 0,
2799
+ cacheCreationInputTokens: usage.cache_creation_input_tokens ?? 0,
2800
+ usd
2801
+ };
2802
+ }
2803
+
2804
+ class TaskCompletionJudge {
2805
+ controller;
2806
+ dependencies;
2807
+ runSideQuery;
2808
+ calculateCost;
2809
+ diagnosticLabel;
2810
+ modeLabel;
2811
+ constructor(controller, dependencies) {
2812
+ this.controller = controller;
2813
+ this.dependencies = dependencies;
2814
+ this.runSideQuery = dependencies.sideQuery ?? sideQuery;
2815
+ this.calculateCost = dependencies.calculateCost ?? calculateUSDCost;
2816
+ this.diagnosticLabel = dependencies.diagnosticLabel ?? "task_completion_judge";
2817
+ this.modeLabel = dependencies.modeLabel ?? "Task completion";
2818
+ }
2819
+ async beforeTerminal(messages) {
2820
+ if (this.dependencies.signal?.aborted) {
2821
+ this.controller.cancel(`${this.modeLabel} judge aborted`);
2822
+ return { action: "terminal" };
2823
+ }
2824
+ if (!this.controller.hasBudgetFor()) {
2825
+ this.controller.markBudgetExhausted();
2826
+ return { action: "terminal" };
2827
+ }
2828
+ if (!this.controller.beginJudgeAttempt())
2829
+ return { action: "terminal" };
2830
+ try {
2831
+ const run = this.controller.getRun();
2832
+ if (!run)
2833
+ throw new Error("No completion judge run is active");
2834
+ const response = await this.runSideQuery({
2835
+ querySource: "auto_mode_judge",
2836
+ model: this.dependencies.model,
2837
+ system: JUDGE_SYSTEM_PROMPT,
2838
+ messages: [
2839
+ {
2840
+ role: "user",
2841
+ content: serializeJudgeEvidence(run.originalRequest, messages)
2842
+ }
2843
+ ],
2844
+ tools: [VERDICT_TOOL],
2845
+ tool_choice: { type: "tool", name: VERDICT_TOOL_NAME },
2846
+ temperature: 0,
2847
+ thinking: false,
2848
+ max_tokens: 512,
2849
+ signal: this.dependencies.signal,
2850
+ skipSystemPromptPrefix: true
2851
+ });
2852
+ const cost = this.calculateCost(this.dependencies.model, response.usage);
2853
+ this.controller.recordJudgeUsage(usageDelta(response.usage, cost));
2854
+ if (!this.controller.hasBudgetFor()) {
2855
+ this.controller.markBudgetExhausted();
2856
+ return { action: "terminal" };
2857
+ }
2858
+ const verdict = parseVerdict(response);
2859
+ if (verdict.done) {
2860
+ logJudgeVerdict(this.diagnosticLabel, `verdict=done reason=${verdict.reason.slice(0, 200)}`);
2861
+ this.controller.complete(verdict.reason);
2862
+ return { action: "terminal" };
2863
+ }
2864
+ if (verdict.impossible) {
2865
+ logJudgeVerdict(this.diagnosticLabel, `verdict=impossible reason=${verdict.reason.slice(0, 200)}`);
2866
+ this.controller.needsReview(verdict.reason || "Judge determined the task is impossible");
2867
+ return { action: "terminal" };
2868
+ }
2869
+ if (!verdict.nextStep.trim()) {
2870
+ throw new Error("Judge requested continuation without a next step");
2871
+ }
2872
+ logJudgeVerdict(this.diagnosticLabel, `verdict=continue nextStep=${verdict.nextStep.slice(0, 200)}`);
2873
+ return {
2874
+ action: "continue",
2875
+ reason: verdict.reason,
2876
+ nextStep: verdict.nextStep
2877
+ };
2878
+ } catch (error) {
2879
+ const detail = error instanceof Error ? error.message : String(error);
2880
+ if (this.dependencies.signal?.aborted) {
2881
+ logJudgeVerdict(this.diagnosticLabel, `aborted: ${detail.slice(0, 200)}`);
2882
+ this.controller.cancel(`${this.modeLabel} judge aborted`);
2883
+ } else {
2884
+ logJudgeVerdict(this.diagnosticLabel, `failed: ${detail.slice(0, 200)}`);
2885
+ this.controller.needsReview(`${this.modeLabel} judge failed: ${detail}`);
2886
+ }
2887
+ return { action: "terminal" };
2888
+ }
2889
+ }
2890
+ }
2891
+
2892
+ // src/utils/autoMode/judge.ts
2893
+ class AutoModeJudge {
2894
+ judge;
2895
+ constructor(controller, dependencies) {
2896
+ this.judge = new TaskCompletionJudge(controller, {
2897
+ ...dependencies,
2898
+ diagnosticLabel: "auto_mode_judge",
2899
+ modeLabel: "Auto mode"
2900
+ });
2901
+ }
2902
+ async beforeTerminal(messages) {
2903
+ const decision = await this.judge.beforeTerminal(messages);
2904
+ if (decision.action === "terminal")
2905
+ return decision;
2906
+ return {
2907
+ action: "continue",
2908
+ message: createAutoModeControlMessage(`Auto mode review found remaining work. Reason: ${decision.reason}
2909
+ Next step: ${decision.nextStep}`)
2910
+ };
2911
+ }
2912
+ }
2913
+
2914
+ // src/utils/autoMode/loopDetector.ts
2915
+ import { createHash } from "crypto";
2916
+ var REPEAT_THRESHOLD = 3;
2917
+ var TOOL_WINDOW_SIZE = 12;
2918
+ var TEXT_WINDOW_SIZE = 12;
2919
+ var TEXT_NGRAM_SIZE = 5;
2920
+ var MAX_TEXT_WORDS = 200;
2921
+ function canonicalize(value) {
2922
+ if (Array.isArray(value))
2923
+ return value.map(canonicalize);
2924
+ if (value && typeof value === "object") {
2925
+ return Object.fromEntries(Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, entry]) => [key, canonicalize(entry)]));
2926
+ }
2927
+ return value;
2928
+ }
2929
+ function stableFingerprint(value) {
2930
+ return createHash("sha256").update(JSON.stringify(canonicalize(value))).digest("hex");
2931
+ }
2932
+ function getContent(message) {
2933
+ const content = message.message?.content;
2934
+ return Array.isArray(content) ? content : [];
2935
+ }
2936
+ function resultCategory(toolUseId, toolResults) {
2937
+ for (const result of toolResults) {
2938
+ for (const block of getContent(result)) {
2939
+ if (block && typeof block === "object" && "type" in block && block.type === "tool_result" && "tool_use_id" in block && block.tool_use_id === toolUseId) {
2940
+ return "is_error" in block && block.is_error ? "error" : "success";
2941
+ }
2942
+ }
2943
+ }
2944
+ return "missing";
2945
+ }
2946
+ function visibleText(messages) {
2947
+ const texts = [];
2948
+ for (const message of messages) {
2949
+ for (const block of getContent(message)) {
2950
+ if (block && typeof block === "object" && "type" in block && block.type === "text" && "text" in block && typeof block.text === "string") {
2951
+ texts.push(block.text);
2952
+ }
2953
+ }
2954
+ }
2955
+ return texts.join(" ");
2956
+ }
2957
+ function textNgrams(text) {
2958
+ const normalized = text.toLowerCase().replace(/[^\p{L}\p{N}_]+/gu, " ").trim();
2959
+ const words = (normalized.match(/\p{Script=Han}|[\p{L}\p{N}_]+/gu) ?? []).slice(0, MAX_TEXT_WORDS);
2960
+ if (words.length < TEXT_NGRAM_SIZE)
2961
+ return [];
2962
+ const hashes = [];
2963
+ for (let index = 0;index <= words.length - TEXT_NGRAM_SIZE; index++) {
2964
+ hashes.push(stableFingerprint(words.slice(index, index + TEXT_NGRAM_SIZE)));
2965
+ }
2966
+ return [...new Set(hashes)];
2967
+ }
2968
+
2969
+ class StepLoopDetector {
2970
+ toolFingerprints = [];
2971
+ textNgramCounts = new Map;
2972
+ textNgramsByStep = [];
2973
+ emptyStepCount = 0;
2974
+ observeStep({
2975
+ assistantMessages,
2976
+ toolResults
2977
+ }) {
2978
+ try {
2979
+ let observedContent = false;
2980
+ for (const message of assistantMessages) {
2981
+ for (const block of getContent(message)) {
2982
+ if (!block || typeof block !== "object" || !("type" in block) || block.type !== "tool_use" || !("name" in block) || typeof block.name !== "string") {
2983
+ continue;
2984
+ }
2985
+ observedContent = true;
2986
+ const toolUseId = "id" in block && typeof block.id === "string" ? block.id : "";
2987
+ const input = "input" in block ? block.input : undefined;
2988
+ const fingerprint = `${block.name}:${stableFingerprint(input)}:${resultCategory(toolUseId, toolResults)}`;
2989
+ this.toolFingerprints.push(fingerprint);
2990
+ if (this.toolFingerprints.length > TOOL_WINDOW_SIZE)
2991
+ this.toolFingerprints.shift();
2992
+ const occurrences = this.toolFingerprints.filter((value) => value === fingerprint).length;
2993
+ if (occurrences >= REPEAT_THRESHOLD) {
2994
+ this.emptyStepCount = 0;
2995
+ return {
2996
+ kind: "tool_repeat",
2997
+ summary: `Repeated tool fingerprint ${stableFingerprint(fingerprint).slice(0, 12)}`
2998
+ };
2999
+ }
3000
+ }
3001
+ }
3002
+ const text = visibleText(assistantMessages);
3003
+ if (text.trim()) {
3004
+ observedContent = true;
3005
+ const stepNgrams = textNgrams(text);
3006
+ this.textNgramsByStep.push(stepNgrams);
3007
+ if (this.textNgramsByStep.length > TEXT_WINDOW_SIZE) {
3008
+ const expired = this.textNgramsByStep.shift() ?? [];
3009
+ for (const ngram of expired) {
3010
+ const nextCount = (this.textNgramCounts.get(ngram) ?? 1) - 1;
3011
+ if (nextCount <= 0)
3012
+ this.textNgramCounts.delete(ngram);
3013
+ else
3014
+ this.textNgramCounts.set(ngram, nextCount);
3015
+ }
3016
+ }
3017
+ for (const ngram of stepNgrams) {
3018
+ const count = (this.textNgramCounts.get(ngram) ?? 0) + 1;
3019
+ this.textNgramCounts.set(ngram, count);
3020
+ if (count >= REPEAT_THRESHOLD) {
3021
+ this.emptyStepCount = 0;
3022
+ return {
3023
+ kind: "text_repeat",
3024
+ summary: `Repeated assistant text ngram ${ngram.slice(0, 12)}`
3025
+ };
3026
+ }
3027
+ }
3028
+ }
3029
+ if (observedContent || toolResults.length > 0) {
3030
+ this.emptyStepCount = 0;
3031
+ return;
3032
+ }
3033
+ this.emptyStepCount++;
3034
+ if (this.emptyStepCount >= REPEAT_THRESHOLD) {
3035
+ return {
3036
+ kind: "empty_step",
3037
+ summary: "Repeated empty assistant step"
3038
+ };
3039
+ }
3040
+ return;
3041
+ } catch {
3042
+ return {
3043
+ kind: "detector_error",
3044
+ summary: "Auto mode loop detector failed"
3045
+ };
3046
+ }
3047
+ }
3048
+ }
3049
+
3050
+ // src/utils/autoMode/runtime.ts
3051
+ class AutoModeRuntime {
3052
+ controller;
3053
+ options;
3054
+ detector;
3055
+ judge;
3056
+ constructor(controller, options) {
3057
+ this.controller = controller;
3058
+ this.options = options;
3059
+ this.detector = options.detector ?? new StepLoopDetector;
3060
+ this.judge = options.judge ?? new AutoModeJudge(controller, {
3061
+ model: options.model,
3062
+ signal: options.signal
3063
+ });
3064
+ }
3065
+ beforeTerminal(messages) {
3066
+ if (this.controller.getResult()) {
3067
+ return Promise.resolve({ action: "terminal" });
3068
+ }
3069
+ return this.judge.beforeTerminal(messages);
3070
+ }
3071
+ async observeStep({
3072
+ assistantMessages,
3073
+ toolResults,
3074
+ messages
3075
+ }) {
3076
+ if (this.controller.getResult())
3077
+ return { action: "terminal" };
3078
+ const signal = this.detector.observeStep({ assistantMessages, toolResults });
3079
+ if (!signal)
3080
+ return { action: "proceed" };
3081
+ if (signal.kind === "detector_error") {
3082
+ this.controller.needsReview(signal.summary);
3083
+ return { action: "terminal" };
3084
+ }
3085
+ const recoveryLevel = this.controller.beginLoopRecovery();
3086
+ if (recoveryLevel === undefined)
3087
+ return { action: "terminal" };
3088
+ const loopMessage = createAutoModeControlMessage(`Auto mode detected a repeated execution pattern (${signal.kind}). Signal: ${signal.summary}. Reassess progress without repeating the same action.`);
3089
+ if (recoveryLevel === 1) {
3090
+ return { action: "continue", message: loopMessage };
3091
+ }
3092
+ return this.judge.beforeTerminal([...messages, loopMessage]);
3093
+ }
3094
+ recordMainUsage(usage) {
3095
+ const tokens = {
3096
+ inputTokens: usage.input_tokens ?? 0,
3097
+ outputTokens: usage.output_tokens ?? 0,
3098
+ cacheReadInputTokens: usage.cache_read_input_tokens ?? 0,
3099
+ cacheCreationInputTokens: usage.cache_creation_input_tokens ?? 0
3100
+ };
3101
+ this.controller.recordUsage({
3102
+ ...tokens,
3103
+ usd: (this.options.calculateCost ?? calculateCostFromTokens)(this.options.model, tokens)
3104
+ });
3105
+ }
3106
+ recordControlUsage(usage) {
3107
+ const { model, ...tokens } = usage;
3108
+ this.controller.recordUsage({
3109
+ ...tokens,
3110
+ usd: (this.options.calculateCost ?? calculateCostFromTokens)(model, tokens)
3111
+ });
3112
+ }
3113
+ markNeedsReview(reason) {
3114
+ if (this.controller.getRun()?.status === "running") {
3115
+ this.controller.needsReview(reason);
3116
+ }
3117
+ }
3118
+ markBudgetExhausted() {
3119
+ if (this.controller.getRun()?.status === "running") {
3120
+ this.controller.markBudgetExhausted();
3121
+ }
3122
+ }
3123
+ cancel(reason) {
3124
+ this.controller.cancel(reason);
3125
+ }
3126
+ getResult() {
3127
+ return this.controller.getResult();
3128
+ }
3129
+ getUsage() {
3130
+ return this.controller.getUsage();
3131
+ }
3132
+ hasBudget() {
3133
+ return this.controller.hasBudgetFor();
3134
+ }
3135
+ }
3136
+
3137
+ // src/utils/taskCompletion/runtime.ts
3138
+ class TaskCompletionRuntime {
3139
+ controller;
3140
+ judge;
3141
+ constructor(controller, options) {
3142
+ this.controller = controller;
3143
+ if (options.getBaseCostUsd) {
3144
+ controller.setBaseCostUsdSource(options.getBaseCostUsd);
3145
+ }
3146
+ this.judge = options.judge ?? new TaskCompletionJudge(controller, options);
3147
+ }
3148
+ async beforeTerminal(messages) {
3149
+ if (this.controller.getResult())
3150
+ return { action: "terminal" };
3151
+ const decision = await this.judge.beforeTerminal(messages);
3152
+ if (decision.action === "terminal")
3153
+ return decision;
3154
+ return {
3155
+ action: "continue",
3156
+ message: createCompletionControlMessage(`Task completion review found remaining work. Reason: ${decision.reason}
3157
+ Next step: ${decision.nextStep}`, "task_completion_control")
3158
+ };
3159
+ }
3160
+ markNeedsReview(reason) {
3161
+ if (this.controller.getRun()?.status === "running") {
3162
+ this.controller.needsReview(reason);
3163
+ }
3164
+ }
3165
+ cancel(reason) {
3166
+ this.controller.cancel(reason);
3167
+ }
3168
+ getResult() {
3169
+ return this.controller.getResult();
3170
+ }
3171
+ getJudgeUsage() {
3172
+ return this.controller.getJudgeUsage();
3173
+ }
3174
+ hasBudget() {
3175
+ return this.controller.hasBudgetFor();
3176
+ }
3177
+ markBudgetExhausted() {
3178
+ this.controller.markBudgetExhausted();
3179
+ }
3180
+ }
3181
+
3182
+ // src/QueryEngine.ts
2668
3183
  init_errors2();
2669
3184
  init_Tool();
2670
3185
  init_SyntheticOutputTool();
@@ -2681,7 +3196,6 @@ init_log();
2681
3196
  init_messages();
2682
3197
  init_model();
2683
3198
  init_pluginLoader();
2684
- import { randomUUID as randomUUID3 } from "crypto";
2685
3199
 
2686
3200
  // src/utils/queryContext.ts
2687
3201
  init_prompts();
@@ -2804,7 +3318,7 @@ function buildSystemInitMessage(inputs) {
2804
3318
  slash_commands: inputs.commands.filter((c) => c.userInvocable !== false).map((c) => c.name),
2805
3319
  apiKeySource: getAnthropicApiKeyWithSource().source,
2806
3320
  betas: getSdkBetas(),
2807
- claude_code_version: "2.1.888",
3321
+ claude_code_version: "0.0.21",
2808
3322
  output_style: outputStyle,
2809
3323
  agents: inputs.agents.map((agent) => agent.agentType),
2810
3324
  skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
@@ -2868,7 +3382,9 @@ class QueryEngine {
2868
3382
  includePartialMessages = false,
2869
3383
  agents = [],
2870
3384
  setSDKStatus,
2871
- orphanedPermission
3385
+ orphanedPermission,
3386
+ autoModeController,
3387
+ taskCompletionController
2872
3388
  } = this.config;
2873
3389
  this.discoveredSkillNames.clear();
2874
3390
  setCwd(cwd);
@@ -3018,6 +3534,16 @@ class QueryEngine {
3018
3534
  }
3019
3535
  }));
3020
3536
  const mainLoopModel = modelFromUserInput ?? initialMainLoopModel;
3537
+ const autoModeRuntime = autoModeController?.isActive() && autoModeController.getRun()?.status === "running" ? new AutoModeRuntime(autoModeController, {
3538
+ model: mainLoopModel,
3539
+ signal: this.abortController.signal
3540
+ }) : undefined;
3541
+ const taskCompletionRuntime = taskCompletionController?.isActive() && taskCompletionController.getRun()?.status === "running" ? new TaskCompletionRuntime(taskCompletionController, {
3542
+ model: mainLoopModel,
3543
+ signal: this.abortController.signal,
3544
+ getBaseCostUsd: getTotalCostUSD
3545
+ }) : undefined;
3546
+ const completionJudgeRuntime = taskCompletionRuntime ?? autoModeRuntime;
3021
3547
  processUserInputContext = {
3022
3548
  messages,
3023
3549
  setMessages: () => {},
@@ -3043,6 +3569,8 @@ class QueryEngine {
3043
3569
  getAppState,
3044
3570
  setAppState,
3045
3571
  abortController: this.abortController,
3572
+ onAutoModeUsage: (usage) => autoModeRuntime?.recordControlUsage(usage),
3573
+ onAutoModeHandoff: (reason) => autoModeRuntime?.markNeedsReview(reason),
3046
3574
  readFileState: this.readFileState,
3047
3575
  nestedMemoryAttachmentTriggers: new Set,
3048
3576
  loadedNestedMemoryPaths: this.loadedNestedMemoryPaths,
@@ -3138,6 +3666,43 @@ class QueryEngine {
3138
3666
  }, message.uuid);
3139
3667
  });
3140
3668
  }
3669
+ const getResultCost = () => autoModeRuntime?.getUsage()?.usd ?? getTotalCostUSD() + (taskCompletionRuntime?.getJudgeUsage()?.usd ?? 0);
3670
+ const getResultUsage = () => {
3671
+ const usage = autoModeRuntime?.getUsage();
3672
+ if (usage) {
3673
+ return {
3674
+ ...EMPTY_USAGE,
3675
+ input_tokens: usage.inputTokens,
3676
+ output_tokens: usage.outputTokens,
3677
+ cache_read_input_tokens: usage.cacheReadInputTokens,
3678
+ cache_creation_input_tokens: usage.cacheCreationInputTokens
3679
+ };
3680
+ }
3681
+ const judgeUsage = taskCompletionRuntime?.getJudgeUsage();
3682
+ if (!judgeUsage)
3683
+ return this.totalUsage;
3684
+ return {
3685
+ ...this.totalUsage,
3686
+ input_tokens: this.totalUsage.input_tokens + judgeUsage.inputTokens,
3687
+ output_tokens: this.totalUsage.output_tokens + judgeUsage.outputTokens,
3688
+ cache_read_input_tokens: this.totalUsage.cache_read_input_tokens + judgeUsage.cacheReadInputTokens,
3689
+ cache_creation_input_tokens: this.totalUsage.cache_creation_input_tokens + judgeUsage.cacheCreationInputTokens
3690
+ };
3691
+ };
3692
+ const getCompletionResultMetadata = () => {
3693
+ const autoModeResult = autoModeRuntime?.getResult();
3694
+ if (autoModeResult)
3695
+ return { auto_mode: autoModeResult };
3696
+ const taskCompletionResult = taskCompletionRuntime?.getResult();
3697
+ if (!taskCompletionResult)
3698
+ return {};
3699
+ return {
3700
+ task_completion: {
3701
+ ...taskCompletionResult,
3702
+ status: taskCompletionResult.status === "budget_exhausted" ? "needs_review" : taskCompletionResult.status
3703
+ }
3704
+ };
3705
+ };
3141
3706
  let currentMessageUsage = EMPTY_USAGE;
3142
3707
  let turnCount = 1;
3143
3708
  let hasAcknowledgedInitialMessages = false;
@@ -3155,7 +3720,9 @@ class QueryEngine {
3155
3720
  fallbackModel,
3156
3721
  querySource: "sdk",
3157
3722
  maxTurns,
3158
- taskBudget
3723
+ taskBudget,
3724
+ autoMode: autoModeRuntime,
3725
+ completionJudge: completionJudgeRuntime
3159
3726
  })) {
3160
3727
  if (this.destroyed)
3161
3728
  return;
@@ -3243,6 +3810,7 @@ class QueryEngine {
3243
3810
  }
3244
3811
  if (event.type === "message_stop") {
3245
3812
  this.totalUsage = accumulateUsage(this.totalUsage, currentMessageUsage);
3813
+ autoModeRuntime?.recordMainUsage(currentMessageUsage);
3246
3814
  }
3247
3815
  if (includePartialMessages) {
3248
3816
  yield {
@@ -3280,15 +3848,16 @@ class QueryEngine {
3280
3848
  num_turns: attachment.turnCount,
3281
3849
  stop_reason: lastStopReason,
3282
3850
  session_id: getSessionId(),
3283
- total_cost_usd: getTotalCostUSD(),
3284
- usage: this.totalUsage,
3851
+ total_cost_usd: getResultCost(),
3852
+ usage: getResultUsage(),
3285
3853
  modelUsage: getModelUsage(),
3286
3854
  permission_denials: this.permissionDenials,
3287
3855
  fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
3288
3856
  uuid: randomUUID3(),
3289
3857
  errors: [
3290
3858
  `Reached maximum number of turns (${attachment.maxTurns})`
3291
- ]
3859
+ ],
3860
+ ...getCompletionResultMetadata()
3292
3861
  };
3293
3862
  return;
3294
3863
  } else if (replayUserMessages && attachment.type === "queued_command") {
@@ -3366,7 +3935,9 @@ class QueryEngine {
3366
3935
  break;
3367
3936
  }
3368
3937
  }
3369
- if (maxBudgetUsd !== undefined && getTotalCostUSD() >= maxBudgetUsd) {
3938
+ if (maxBudgetUsd !== undefined && (autoModeRuntime ? !autoModeRuntime.hasBudget() : taskCompletionRuntime ? !taskCompletionRuntime.hasBudget() : getTotalCostUSD() >= maxBudgetUsd)) {
3939
+ autoModeRuntime?.markBudgetExhausted();
3940
+ taskCompletionRuntime?.markBudgetExhausted();
3370
3941
  if (persistSession) {
3371
3942
  if (isEnvTruthy(process.env.CLAUDE_CODE_EAGER_FLUSH) || isEnvTruthy(process.env.CLAUDE_CODE_IS_COWORK)) {
3372
3943
  await flushSessionStorage();
@@ -3381,13 +3952,14 @@ class QueryEngine {
3381
3952
  num_turns: turnCount,
3382
3953
  stop_reason: lastStopReason,
3383
3954
  session_id: getSessionId(),
3384
- total_cost_usd: getTotalCostUSD(),
3385
- usage: this.totalUsage,
3955
+ total_cost_usd: getResultCost(),
3956
+ usage: getResultUsage(),
3386
3957
  modelUsage: getModelUsage(),
3387
3958
  permission_denials: this.permissionDenials,
3388
3959
  fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
3389
3960
  uuid: randomUUID3(),
3390
- errors: [`Reached maximum budget ($${maxBudgetUsd})`]
3961
+ errors: [`Reached maximum budget ($${maxBudgetUsd})`],
3962
+ ...getCompletionResultMetadata()
3391
3963
  };
3392
3964
  return;
3393
3965
  }
@@ -3396,6 +3968,8 @@ class QueryEngine {
3396
3968
  const callsThisQuery = currentCalls - initialStructuredOutputCalls;
3397
3969
  const maxRetries = parseInt(process.env.MAX_STRUCTURED_OUTPUT_RETRIES || "5", 10);
3398
3970
  if (callsThisQuery >= maxRetries) {
3971
+ autoModeRuntime?.markNeedsReview("Structured output retry limit reached during auto mode execution");
3972
+ taskCompletionRuntime?.markNeedsReview("Structured output retry limit reached before task completion could be judged");
3399
3973
  if (persistSession) {
3400
3974
  if (isEnvTruthy(process.env.CLAUDE_CODE_EAGER_FLUSH) || isEnvTruthy(process.env.CLAUDE_CODE_IS_COWORK)) {
3401
3975
  await flushSessionStorage();
@@ -3410,15 +3984,16 @@ class QueryEngine {
3410
3984
  num_turns: turnCount,
3411
3985
  stop_reason: lastStopReason,
3412
3986
  session_id: getSessionId(),
3413
- total_cost_usd: getTotalCostUSD(),
3414
- usage: this.totalUsage,
3987
+ total_cost_usd: getResultCost(),
3988
+ usage: getResultUsage(),
3415
3989
  modelUsage: getModelUsage(),
3416
3990
  permission_denials: this.permissionDenials,
3417
3991
  fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
3418
3992
  uuid: randomUUID3(),
3419
3993
  errors: [
3420
3994
  `Failed to provide valid structured output after ${maxRetries} attempts`
3421
- ]
3995
+ ],
3996
+ ...getCompletionResultMetadata()
3422
3997
  };
3423
3998
  return;
3424
3999
  }
@@ -3427,12 +4002,26 @@ class QueryEngine {
3427
4002
  const result = messages.findLast((m) => m.type === "assistant" || m.type === "user");
3428
4003
  const edeResultType = result?.type ?? "undefined";
3429
4004
  const edeLastContentType = result?.type === "assistant" ? last_default(result.message.content)?.type ?? "none" : "n/a";
4005
+ const edeIsApiError = result?.type === "assistant" && result.isApiErrorMessage === true;
4006
+ const edeApiErrorDetail = (() => {
4007
+ if (result?.type !== "assistant")
4008
+ return "";
4009
+ const block = last_default(result.message.content);
4010
+ return block?.type === "text" ? String(block.text ?? "").slice(0, 200) : "";
4011
+ })();
3430
4012
  if (persistSession) {
3431
4013
  if (isEnvTruthy(process.env.CLAUDE_CODE_EAGER_FLUSH) || isEnvTruthy(process.env.CLAUDE_CODE_IS_COWORK)) {
3432
4014
  await flushSessionStorage();
3433
4015
  }
3434
4016
  }
3435
4017
  if (!isResultSuccessful(result, lastStopReason)) {
4018
+ if (edeIsApiError) {
4019
+ autoModeRuntime?.cancel(`Auto mode aborted: API error (${edeApiErrorDetail || lastStopReason || "unknown"})`);
4020
+ taskCompletionRuntime?.cancel(`Task completion judging aborted: API error (${edeApiErrorDetail || lastStopReason || "unknown"})`);
4021
+ } else {
4022
+ autoModeRuntime?.markNeedsReview("Auto mode execution ended without a successful terminal result");
4023
+ taskCompletionRuntime?.markNeedsReview("Execution ended without a successful terminal result");
4024
+ }
3436
4025
  yield {
3437
4026
  type: "result",
3438
4027
  subtype: "error_during_execution",
@@ -3442,8 +4031,8 @@ class QueryEngine {
3442
4031
  num_turns: turnCount,
3443
4032
  stop_reason: lastStopReason,
3444
4033
  session_id: getSessionId(),
3445
- total_cost_usd: getTotalCostUSD(),
3446
- usage: this.totalUsage,
4034
+ total_cost_usd: getResultCost(),
4035
+ usage: getResultUsage(),
3447
4036
  modelUsage: getModelUsage(),
3448
4037
  permission_denials: this.permissionDenials,
3449
4038
  fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
@@ -3455,7 +4044,8 @@ class QueryEngine {
3455
4044
  `[ede_diagnostic] result_type=${edeResultType} last_content_type=${edeLastContentType} stop_reason=${lastStopReason}`,
3456
4045
  ...all.slice(start).map((_) => _.error)
3457
4046
  ];
3458
- })()
4047
+ })(),
4048
+ ...getCompletionResultMetadata()
3459
4049
  };
3460
4050
  return;
3461
4051
  }
@@ -3468,6 +4058,13 @@ class QueryEngine {
3468
4058
  }
3469
4059
  isApiError = Boolean(result.isApiErrorMessage);
3470
4060
  }
4061
+ if (isApiError) {
4062
+ autoModeRuntime?.cancel(`Auto mode aborted: API error (${textResult || "no error detail"})`);
4063
+ taskCompletionRuntime?.cancel(`Task completion judging aborted: API error (${textResult || "no error detail"})`);
4064
+ } else {
4065
+ autoModeRuntime?.markNeedsReview("Auto mode execution ended without a completion verdict");
4066
+ taskCompletionRuntime?.markNeedsReview("Execution ended without a task completion verdict");
4067
+ }
3471
4068
  yield {
3472
4069
  type: "result",
3473
4070
  subtype: "success",
@@ -3478,13 +4075,14 @@ class QueryEngine {
3478
4075
  result: textResult,
3479
4076
  stop_reason: lastStopReason,
3480
4077
  session_id: getSessionId(),
3481
- total_cost_usd: getTotalCostUSD(),
3482
- usage: this.totalUsage,
4078
+ total_cost_usd: getResultCost(),
4079
+ usage: getResultUsage(),
3483
4080
  modelUsage: getModelUsage(),
3484
4081
  permission_denials: this.permissionDenials,
3485
4082
  structured_output: structuredOutputFromTool,
3486
4083
  fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
3487
- uuid: randomUUID3()
4084
+ uuid: randomUUID3(),
4085
+ ...getCompletionResultMetadata()
3488
4086
  };
3489
4087
  }
3490
4088
  interrupt() {
@@ -4699,7 +5297,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
4699
5297
  }
4700
5298
  pluginInstallPromise = null;
4701
5299
  await refreshPluginState();
4702
- const { setupPluginHookHotReload } = await import("./chunk-dnb45dhp.js");
5300
+ const { setupPluginHookHotReload } = await import("./chunk-102ee39t.js");
4703
5301
  setupPluginHookHotReload();
4704
5302
  }
4705
5303
  const isMainThread = (cmd) => cmd.agentId === undefined;
@@ -6374,7 +6972,7 @@ async function loadInitialMessages(setAppState, options) {
6374
6972
  processMessagesForTeleportResume,
6375
6973
  teleportResumeCodeSession,
6376
6974
  validateGitState
6377
- } = await import("./chunk-f0eqte4j.js");
6975
+ } = await import("./chunk-8mpv3j7b.js");
6378
6976
  await validateGitState();
6379
6977
  const teleportResult = await teleportResumeCodeSession(options.teleport);
6380
6978
  const { branchError } = await checkOutTeleportedSessionBranch(teleportResult.branch);