xkzoom 1.5.4 → 1.5.6

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 (423) hide show
  1. package/README.md +65 -0
  2. package/dist/{chunk-YPKHMAO4.mjs → chunk-22VRM3T3.mjs} +1 -1
  3. package/dist/{chunk-XL3MUGFG.mjs → chunk-2B3A3C2V.mjs} +1 -1
  4. package/dist/{chunk-UQLGVSQH.mjs → chunk-2F65KBU2.mjs} +8 -9
  5. package/dist/chunk-2L4VMCM2.mjs +15 -0
  6. package/dist/{chunk-WQSQXDUL.mjs → chunk-2LN3ODBA.mjs} +1 -1
  7. package/dist/{chunk-OBYPZT2S.mjs → chunk-2YB6BHIB.mjs} +9 -9
  8. package/dist/chunk-35SKU3FL.mjs +279 -0
  9. package/dist/{chunk-PETWGCGB.mjs → chunk-3JHD7MGZ.mjs} +2 -2
  10. package/dist/{chunk-PW3ULDNL.mjs → chunk-3QE7GUJC.mjs} +1 -1
  11. package/dist/{chunk-JI67TW4E.mjs → chunk-4XJFA7V3.mjs} +1 -1
  12. package/dist/{chunk-CQUISJWG.mjs → chunk-5G3UUQ36.mjs} +2 -2
  13. package/dist/{chunk-HYSOWPIC.mjs → chunk-6KCPL45H.mjs} +5 -5
  14. package/dist/{chunk-2IQAT3PE.mjs → chunk-6OY3GOUH.mjs} +6 -6
  15. package/dist/{chunk-LBZCBBHU.mjs → chunk-72IPGTJZ.mjs} +1 -1
  16. package/dist/{chunk-TVH4LII3.mjs → chunk-74S3DUNZ.mjs} +1 -1
  17. package/dist/{chunk-MPGMU75K.mjs → chunk-7C7HREZO.mjs} +12 -12
  18. package/dist/{chunk-BFSOQ5IG.mjs → chunk-7HQEB7IJ.mjs} +3 -3
  19. package/dist/{chunk-3VA3YDYL.mjs → chunk-7TKZKTS5.mjs} +1 -1
  20. package/dist/{chunk-M3ISDSQP.mjs → chunk-A4BZZNPW.mjs} +5 -5
  21. package/dist/{chunk-BJ6YI2DJ.mjs → chunk-AEE3DM6S.mjs} +1 -1
  22. package/dist/{chunk-4JXTPCOE.mjs → chunk-ANGNUW6F.mjs} +5 -5
  23. package/dist/{chunk-GZZ7KO57.mjs → chunk-BJFTC4GW.mjs} +21 -1
  24. package/dist/{chunk-GYZ4IXUD.mjs → chunk-CLN4OVFM.mjs} +3 -6
  25. package/dist/{chunk-3KJHUTOO.mjs → chunk-CLVSQ3FG.mjs} +2 -2
  26. package/dist/{chunk-IKQ7CLX3.mjs → chunk-CSKP6E6Y.mjs} +2 -2
  27. package/dist/{chunk-LWCO2YNI.mjs → chunk-CVWDLRQI.mjs} +1 -1
  28. package/dist/{chunk-FG6QCRVN.mjs → chunk-D4TNMY2O.mjs} +2 -2
  29. package/dist/{chunk-FLVJABFP.mjs → chunk-DODTDJSF.mjs} +10 -8
  30. package/dist/{chunk-MWRQORKQ.mjs → chunk-E36MAP7Y.mjs} +1 -1
  31. package/dist/{chunk-CFZVBILR.mjs → chunk-EHL345OC.mjs} +4 -4
  32. package/dist/chunk-F3Y7WDC6.mjs +108 -0
  33. package/dist/{chunk-Q33JD64H.mjs → chunk-FCK6QFJB.mjs} +1 -1
  34. package/dist/{chunk-3ZH273T7.mjs → chunk-FEEEY457.mjs} +71 -55
  35. package/dist/{chunk-MDZUWIBH.mjs → chunk-G3E2E6DD.mjs} +38 -38
  36. package/dist/{chunk-WXELBVXY.mjs → chunk-GC2H3KNZ.mjs} +1 -1
  37. package/dist/{chunk-5SE4JOKE.mjs → chunk-GHWAAAG6.mjs} +309 -262
  38. package/dist/{chunk-5YEFG7BF.mjs → chunk-GNDVHDPO.mjs} +52 -52
  39. package/dist/chunk-H4NINXMV.mjs +95 -0
  40. package/dist/{chunk-TQBVFKCT.mjs → chunk-H6W42R46.mjs} +194 -154
  41. package/dist/chunk-H7ILBOZU.mjs +48 -0
  42. package/dist/{chunk-7LEEVP5O.mjs → chunk-H7QNACAJ.mjs} +12 -12
  43. package/dist/chunk-HCYIE2PR.mjs +130 -0
  44. package/dist/{chunk-E2TTUY6R.mjs → chunk-HHPHIVCC.mjs} +11 -11
  45. package/dist/{chunk-P262PAGZ.mjs → chunk-HLYVEYML.mjs} +15 -2
  46. package/dist/{chunk-GZJMFCRG.mjs → chunk-HNYI45WM.mjs} +23 -4
  47. package/dist/{chunk-JFFBD5TV.mjs → chunk-HOII5XBJ.mjs} +17 -17
  48. package/dist/{chunk-T23H5D4O.mjs → chunk-HPZG5VVI.mjs} +3 -9
  49. package/dist/chunk-HQHICFPO.mjs +58 -0
  50. package/dist/{chunk-DRY7AJMM.mjs → chunk-HQPA2MV5.mjs} +7 -7
  51. package/dist/{chunk-NJAPWQ4D.mjs → chunk-ICKBF7KF.mjs} +2 -60
  52. package/dist/{chunk-HAI7DJD2.mjs → chunk-IEF2AMNW.mjs} +7 -7
  53. package/dist/{chunk-VIZQURO5.mjs → chunk-IGJFAE72.mjs} +9 -9
  54. package/dist/{chunk-IT2GAHAL.mjs → chunk-IHMPR5HT.mjs} +1 -1
  55. package/dist/{chunk-PJKLQF3K.mjs → chunk-INFZEMQK.mjs} +1 -1
  56. package/dist/{chunk-MKYCBV3H.mjs → chunk-J4FQVXEA.mjs} +7 -7
  57. package/dist/{chunk-27BXVTXH.mjs → chunk-JN5EMEXS.mjs} +1 -1
  58. package/dist/{chunk-4WWT6OC2.mjs → chunk-JTKSYLZE.mjs} +26 -48
  59. package/dist/{chunk-ZTKJR7OC.mjs → chunk-K5IQLMJQ.mjs} +4 -4
  60. package/dist/{chunk-GIAML5K5.mjs → chunk-K5JMXCH5.mjs} +1 -1
  61. package/dist/{chunk-JJKRD5DL.mjs → chunk-KBEY4ZQV.mjs} +4 -4
  62. package/dist/{chunk-EL6TOIFZ.mjs → chunk-KHQPC6I7.mjs} +1 -16
  63. package/dist/{chunk-VNEPNUBZ.mjs → chunk-L3PV2ZNB.mjs} +15 -15
  64. package/dist/{chunk-MQKREMOB.mjs → chunk-L7N2B4LX.mjs} +8 -8
  65. package/dist/{chunk-PS6X3CND.mjs → chunk-LKSRZTSL.mjs} +1 -0
  66. package/dist/{chunk-DCSERRXG.mjs → chunk-LNPOTNGJ.mjs} +1 -1
  67. package/dist/chunk-LOMDPHVQ.mjs +42 -0
  68. package/dist/chunk-LQHI5VK2.mjs +26 -0
  69. package/dist/{chunk-J5AXFEDQ.mjs → chunk-LTTSUVF5.mjs} +52 -52
  70. package/dist/{chunk-LESS4N25.mjs → chunk-LV3CI5A4.mjs} +5 -5
  71. package/dist/{chunk-JG3K4N5B.mjs → chunk-M3E2R3PT.mjs} +1 -1
  72. package/dist/{chunk-WPMJCKI2.mjs → chunk-M7DB4RAC.mjs} +9 -9
  73. package/dist/{chunk-COYZO24J.mjs → chunk-MCD5TOFD.mjs} +1 -1
  74. package/dist/{chunk-AP4WVS6L.mjs → chunk-MCJPAZBQ.mjs} +1 -1
  75. package/dist/{chunk-T6XDJ2QQ.mjs → chunk-MGIGU4G6.mjs} +119 -18
  76. package/dist/{chunk-ZMQ3UOGP.mjs → chunk-MMWLRPKT.mjs} +13 -1
  77. package/dist/{chunk-NIU6GWKB.mjs → chunk-MNLMVNF5.mjs} +5 -5
  78. package/dist/{chunk-W75Z6CZR.mjs → chunk-MXKSS63B.mjs} +2 -2
  79. package/dist/{chunk-TADSGGK2.mjs → chunk-N4X2MAF2.mjs} +14 -28
  80. package/dist/{chunk-E7BFLHLM.mjs → chunk-NDPDPELV.mjs} +1 -16
  81. package/dist/{chunk-24GJWXMG.mjs → chunk-NI2PDCVA.mjs} +3 -3
  82. package/dist/{chunk-BSG6WLML.mjs → chunk-NI4N35JN.mjs} +1 -1
  83. package/dist/{chunk-Z2JNJLJM.mjs → chunk-NLUF66E7.mjs} +1 -1
  84. package/dist/{chunk-RKZ56GST.mjs → chunk-NRPE77A3.mjs} +2 -2
  85. package/dist/{chunk-76TKUYY3.mjs → chunk-NTVWS2MO.mjs} +6 -6
  86. package/dist/{chunk-YYDDQEY4.mjs → chunk-NV7SYEH7.mjs} +2 -2
  87. package/dist/{chunk-6W4W5JLG.mjs → chunk-NXVXMXL5.mjs} +3 -3
  88. package/dist/{chunk-PINXXWFJ.mjs → chunk-OGT25PYJ.mjs} +1 -1
  89. package/dist/{chunk-3STOFADV.mjs → chunk-OHCBAEML.mjs} +1 -0
  90. package/dist/{chunk-L252ASZW.mjs → chunk-OPTSEYTI.mjs} +1 -1
  91. package/dist/{chunk-B4YKXZ5W.mjs → chunk-OQMIECO2.mjs} +1 -1
  92. package/dist/{chunk-D3N7EHB2.mjs → chunk-PH5QACOX.mjs} +19 -19
  93. package/dist/{chunk-6MOIFLPP.mjs → chunk-PKJLFQRF.mjs} +1 -1
  94. package/dist/{chunk-M5IU6U3O.mjs → chunk-POOU2U4R.mjs} +2 -2
  95. package/dist/{chunk-IGDJGBAI.mjs → chunk-PPMT66BN.mjs} +3 -3
  96. package/dist/{chunk-RZOILUDC.mjs → chunk-PSZPHCUP.mjs} +1 -1
  97. package/dist/{chunk-MXXTDG5V.mjs → chunk-PVSCARHF.mjs} +1 -1
  98. package/dist/chunk-PW6NSDMI.mjs +117 -0
  99. package/dist/{chunk-NHICONJ3.mjs → chunk-PZAMMLMJ.mjs} +3 -3
  100. package/dist/{chunk-IDQ5B572.mjs → chunk-QDN74R5G.mjs} +5 -5
  101. package/dist/{chunk-VWAUDB4X.mjs → chunk-QHIZRYTO.mjs} +2 -2
  102. package/dist/{chunk-2DR5RT3I.mjs → chunk-QITZ7SAD.mjs} +499 -943
  103. package/dist/{chunk-N2CMVW47.mjs → chunk-QRHBGABQ.mjs} +7 -3
  104. package/dist/{chunk-F35EHL5U.mjs → chunk-RM6GZ2SF.mjs} +7 -7
  105. package/dist/{chunk-JXDHNASC.mjs → chunk-RUMRGCYN.mjs} +85 -42
  106. package/dist/{chunk-K7RZQIPZ.mjs → chunk-S54MBJWY.mjs} +6 -4
  107. package/dist/{chunk-MBOWNG3A.mjs → chunk-S573TMN6.mjs} +2 -2
  108. package/dist/{chunk-UFV3WER4.mjs → chunk-SJ5LNKAH.mjs} +1 -1
  109. package/dist/chunk-SJWQGIQU.mjs +99 -0
  110. package/dist/{chunk-KWQEFCOY.mjs → chunk-SMHFMHQ2.mjs} +1 -1
  111. package/dist/{chunk-LGNLS7ZN.mjs → chunk-SPUVJNKO.mjs} +2 -2
  112. package/dist/{chunk-JBKRS62W.mjs → chunk-T3EJW65E.mjs} +6 -6
  113. package/dist/{chunk-6ZVXCJTG.mjs → chunk-TBLUKDLO.mjs} +91 -1
  114. package/dist/{chunk-76MFE24I.mjs → chunk-TKZWE5DB.mjs} +1 -1
  115. package/dist/{chunk-3CPVI6Y2.mjs → chunk-TRSW7QJW.mjs} +1 -1
  116. package/dist/{chunk-UXEZFEB3.mjs → chunk-TSS3NVRA.mjs} +18 -17
  117. package/dist/{chunk-WRZWEAMN.mjs → chunk-TU75ILAE.mjs} +1 -1
  118. package/dist/{chunk-E5LABIPO.mjs → chunk-U2NKGGVL.mjs} +3 -2
  119. package/dist/{chunk-KLQSTA6K.mjs → chunk-U7TPS3MS.mjs} +1 -1
  120. package/dist/chunk-UOCUHKR5.mjs +21 -0
  121. package/dist/{chunk-VA7SUI2L.mjs → chunk-VD4DIRCW.mjs} +1 -1
  122. package/dist/chunk-VHQ5WHXF.mjs +17 -0
  123. package/dist/{chunk-MRTQWCNC.mjs → chunk-VMRVJ2VF.mjs} +9 -9
  124. package/dist/{chunk-MJDJIPB4.mjs → chunk-VRG32WNZ.mjs} +1 -1
  125. package/dist/chunk-W5XO4T4J.mjs +63 -0
  126. package/dist/{chunk-5ZMY6RTR.mjs → chunk-WASHQYUB.mjs} +2 -2
  127. package/dist/{chunk-XNQJRIGR.mjs → chunk-WHP2GNEC.mjs} +66 -15
  128. package/dist/chunk-WI7PS7YW.mjs +79 -0
  129. package/dist/{chunk-GIC2RBVM.mjs → chunk-WMLZDHER.mjs} +51 -33
  130. package/dist/{chunk-4POYX4AW.mjs → chunk-WVTJXJY4.mjs} +1 -1
  131. package/dist/{chunk-KPDVZFJY.mjs → chunk-WYCMXDZT.mjs} +1 -1
  132. package/dist/{chunk-LFZAVCVW.mjs → chunk-XD5XGGQA.mjs} +1 -1
  133. package/dist/{chunk-NEDXMES6.mjs → chunk-YAGU7I25.mjs} +2 -2
  134. package/dist/{chunk-TRMEHTAT.mjs → chunk-YSI3ZONB.mjs} +1 -1
  135. package/dist/chunk-YTBKWX7J.mjs +102 -0
  136. package/dist/chunk-YYUB3HQR.mjs +119 -0
  137. package/dist/{chunk-CTKIQWTE.mjs → chunk-ZOJEC5RT.mjs} +1 -1
  138. package/dist/{chunk-2VSERWT6.mjs → chunk-ZXJY3JIP.mjs} +2 -2
  139. package/dist/index.js +7773 -6876
  140. package/dist/index.mjs +271 -256
  141. package/dist/mobile/action-planner.js +492 -389
  142. package/dist/mobile/action-planner.mjs +155 -155
  143. package/dist/mobile/agent-capabilities.js +492 -389
  144. package/dist/mobile/agent-capabilities.mjs +155 -155
  145. package/dist/mobile/agent-shop/handlers.mjs +5 -5
  146. package/dist/mobile/agents-watch.js +346 -0
  147. package/dist/mobile/agents-watch.mjs +13 -0
  148. package/dist/mobile/anthropic-incremental-deliver.mjs +4 -4
  149. package/dist/mobile/anthropic-messages-turn-runner.js +1160 -887
  150. package/dist/mobile/anthropic-messages-turn-runner.mjs +172 -170
  151. package/dist/mobile/anthropic-owned-tool-executor.js +542 -435
  152. package/dist/mobile/anthropic-owned-tool-executor.mjs +169 -169
  153. package/dist/mobile/anthropic-provider-adapter.js +23 -18
  154. package/dist/mobile/anthropic-provider-adapter.mjs +3 -2
  155. package/dist/mobile/api.js +236 -147
  156. package/dist/mobile/api.mjs +84 -83
  157. package/dist/mobile/auth.mjs +1 -1
  158. package/dist/mobile/bucket-events/emit-bucket-frame.js +327 -0
  159. package/dist/mobile/bucket-events/emit-bucket-frame.mjs +8 -3
  160. package/dist/mobile/bucket-events/register-bucket-gateway-bridge.js +320 -3
  161. package/dist/mobile/bucket-events/register-bucket-gateway-bridge.mjs +9 -4
  162. package/dist/mobile/channel.mjs +2 -2
  163. package/dist/mobile/chinese-monologue-deliver-partition.js +21 -1
  164. package/dist/mobile/chinese-monologue-deliver-partition.mjs +1 -1
  165. package/dist/mobile/context-compact/compact-artifact-enrich.mjs +18 -18
  166. package/dist/mobile/context-compact/compact-artifact-writer.mjs +3 -3
  167. package/dist/mobile/context-compact/compact-engine-artifacts.mjs +5 -5
  168. package/dist/mobile/context-compact/compact-memory-distill-job.mjs +3 -3
  169. package/dist/mobile/context-compact/compact-message-collector.mjs +2 -2
  170. package/dist/mobile/context-compact/compact-orchestrator.js +8 -22
  171. package/dist/mobile/context-compact/compact-orchestrator.mjs +41 -41
  172. package/dist/mobile/context-compact/compact-resume-prefetch.mjs +3 -3
  173. package/dist/mobile/context-compact/compact-summarizer-engine-artifact.mjs +20 -20
  174. package/dist/mobile/context-compact/compact-summarizer-llm-request.js +2 -1
  175. package/dist/mobile/context-compact/compact-summarizer-llm-request.mjs +11 -11
  176. package/dist/mobile/context-compact/compact-summarizer-llm.js +5 -19
  177. package/dist/mobile/context-compact/compact-summarizer-llm.mjs +12 -12
  178. package/dist/mobile/context-compact/compact-summarizer.js +5 -19
  179. package/dist/mobile/context-compact/compact-summarizer.mjs +17 -17
  180. package/dist/mobile/context-compact/compact-visible-tool-chain.mjs +2 -2
  181. package/dist/mobile/context-compact/compact-write-verifier.mjs +2 -2
  182. package/dist/mobile/context-compact/context-budget-gate.js +111 -84
  183. package/dist/mobile/context-compact/context-budget-gate.mjs +5 -5
  184. package/dist/mobile/context-compact/native-transcript-budget.js +151 -79
  185. package/dist/mobile/context-compact/native-transcript-budget.mjs +7 -3
  186. package/dist/mobile/context-compact/runtime-compact-hook.js +592 -468
  187. package/dist/mobile/context-compact/runtime-compact-hook.mjs +158 -158
  188. package/dist/mobile/dispatch/compact-resume-contract.js +567 -0
  189. package/dist/mobile/dispatch/compact-resume-contract.mjs +39 -0
  190. package/dist/mobile/dispatch/dispatch-context-assembly.js +588 -0
  191. package/dist/mobile/dispatch/dispatch-context-assembly.mjs +20 -0
  192. package/dist/mobile/dispatch/dispatch-route.js +547 -0
  193. package/dist/mobile/dispatch/dispatch-route.mjs +23 -0
  194. package/dist/mobile/dispatch/dispatch-streaming.js +51 -0
  195. package/dist/mobile/dispatch/dispatch-streaming.mjs +9 -0
  196. package/dist/mobile/dispatch/finalize-contract.js +147 -0
  197. package/dist/mobile/dispatch/finalize-contract.mjs +38 -0
  198. package/dist/mobile/dispatch/inbound-prep.js +671 -0
  199. package/dist/mobile/dispatch/inbound-prep.mjs +31 -0
  200. package/dist/mobile/dispatch/interrupted-snapshot.js +190 -0
  201. package/dist/mobile/dispatch/interrupted-snapshot.mjs +11 -0
  202. package/dist/mobile/dispatch/mobile-dispatch-error.js +41 -0
  203. package/dist/mobile/dispatch/mobile-dispatch-error.mjs +7 -0
  204. package/dist/mobile/dispatch/native-turn-executor.js +42662 -0
  205. package/dist/mobile/dispatch/native-turn-executor.mjs +320 -0
  206. package/dist/mobile/dispatch/native-turn-route.js +1465 -0
  207. package/dist/mobile/dispatch/native-turn-route.mjs +34 -0
  208. package/dist/mobile/dispatch/native-turn-transcript.js +1134 -0
  209. package/dist/mobile/dispatch/native-turn-transcript.mjs +29 -0
  210. package/dist/mobile/group/conductor-llm.js +5 -19
  211. package/dist/mobile/group/conductor-llm.mjs +15 -15
  212. package/dist/mobile/group/conductor-plan-llm.js +5 -19
  213. package/dist/mobile/group/conductor-plan-llm.mjs +22 -22
  214. package/dist/mobile/group/delivery-verification.js +61 -13
  215. package/dist/mobile/group/delivery-verification.mjs +4 -4
  216. package/dist/mobile/group/direct-chat-group-context.mjs +6 -6
  217. package/dist/mobile/group/execution-plan.js +61 -13
  218. package/dist/mobile/group/execution-plan.mjs +5 -5
  219. package/dist/mobile/group/floor-scheduler.mjs +9 -9
  220. package/dist/mobile/group/floor-state-store.mjs +6 -6
  221. package/dist/mobile/group/group-api-handlers.js +3 -0
  222. package/dist/mobile/group/group-api-handlers.mjs +61 -60
  223. package/dist/mobile/group/group-peer-private-context.mjs +5 -5
  224. package/dist/mobile/group/group-session.mjs +25 -25
  225. package/dist/mobile/group/index.js +63 -17
  226. package/dist/mobile/group/index.mjs +51 -50
  227. package/dist/mobile/group/memory-supplement.mjs +9 -9
  228. package/dist/mobile/group/mention.mjs +3 -3
  229. package/dist/mobile/group/normal-group-router.mjs +2 -2
  230. package/dist/mobile/group/orchestrator.js +62 -17
  231. package/dist/mobile/group/orchestrator.mjs +44 -44
  232. package/dist/mobile/group/pipeline-ceo-dept-mention-parse.mjs +3 -3
  233. package/dist/mobile/group/pipeline-handoff-verification.js +4 -10
  234. package/dist/mobile/group/pipeline-handoff-verification.mjs +3 -3
  235. package/dist/mobile/group/pipeline-turn-outcome.js +5 -14
  236. package/dist/mobile/group/pipeline-turn-outcome.mjs +2 -2
  237. package/dist/mobile/group/plan-runtime.js +61 -13
  238. package/dist/mobile/group/plan-runtime.mjs +26 -26
  239. package/dist/mobile/group/relation-distill.mjs +10 -10
  240. package/dist/mobile/group/remarks.mjs +4 -4
  241. package/dist/mobile/group/runtime-integration.js +65 -17
  242. package/dist/mobile/group/runtime-integration.mjs +59 -58
  243. package/dist/mobile/group/team-memory-runtime.mjs +3 -3
  244. package/dist/mobile/group/transcript-projection.js +1 -0
  245. package/dist/mobile/group/transcript-projection.mjs +4 -3
  246. package/dist/mobile/index.js +8046 -7126
  247. package/dist/mobile/index.mjs +256 -241
  248. package/dist/mobile/memory-contract-r1-prefetch.mjs +10 -10
  249. package/dist/mobile/memory-contract-r1.js +1 -1
  250. package/dist/mobile/memory-contract-r1.mjs +1 -1
  251. package/dist/mobile/memory-contract-r5-empty-result.mjs +11 -11
  252. package/dist/mobile/memory-runtime-v2/checkpoint-policy.js +1 -61
  253. package/dist/mobile/memory-runtime-v2/checkpoint-policy.mjs +2 -2
  254. package/dist/mobile/memory-runtime-v2/context-pack.js +16 -2
  255. package/dist/mobile/memory-runtime-v2/context-pack.mjs +2 -2
  256. package/dist/mobile/memory-runtime-v2/eval-runner.js +231 -145
  257. package/dist/mobile/memory-runtime-v2/eval-runner.mjs +20 -14
  258. package/dist/mobile/memory-runtime-v2/evidence-plan.js +233 -147
  259. package/dist/mobile/memory-runtime-v2/evidence-plan.mjs +22 -16
  260. package/dist/mobile/memory-runtime-v2/index.js +242 -147
  261. package/dist/mobile/memory-runtime-v2/index.mjs +58 -46
  262. package/dist/mobile/memory-runtime-v2/local-source-import.mjs +3 -3
  263. package/dist/mobile/memory-runtime-v2/long-run-guard.js +1 -119
  264. package/dist/mobile/memory-runtime-v2/long-run-guard.mjs +3 -3
  265. package/dist/mobile/memory-runtime-v2/memory-control-plane.js +233 -147
  266. package/dist/mobile/memory-runtime-v2/memory-control-plane.mjs +22 -16
  267. package/dist/mobile/memory-runtime-v2/memory-evidence-graph.mjs +2 -2
  268. package/dist/mobile/memory-runtime-v2/memory-readiness.js +232 -146
  269. package/dist/mobile/memory-runtime-v2/memory-readiness.mjs +22 -16
  270. package/dist/mobile/memory-runtime-v2/orchestrator.js +17 -3
  271. package/dist/mobile/memory-runtime-v2/orchestrator.mjs +7 -7
  272. package/dist/mobile/memory-runtime-v2/project-tool-event.mjs +2 -2
  273. package/dist/mobile/memory-runtime-v2/public-api.js +233 -147
  274. package/dist/mobile/memory-runtime-v2/public-api.mjs +23 -17
  275. package/dist/mobile/memory-runtime-v2/retrieval.mjs +2 -2
  276. package/dist/mobile/memory-runtime-v2/run-ledger.js +29 -48
  277. package/dist/mobile/memory-runtime-v2/run-ledger.mjs +7 -1
  278. package/dist/mobile/minimax-m3.js +2 -20
  279. package/dist/mobile/minimax-m3.mjs +3 -9
  280. package/dist/mobile/model-context-window-budget.js +19 -4
  281. package/dist/mobile/model-context-window-budget.mjs +7 -3
  282. package/dist/mobile/model-turn-runner.js +61 -2
  283. package/dist/mobile/model-turn-runner.mjs +12 -6
  284. package/dist/mobile/native-anthropic-messages-stream.js +7 -22
  285. package/dist/mobile/native-anthropic-messages-stream.mjs +12 -12
  286. package/dist/mobile/native-openai-text-stream.js +1 -2
  287. package/dist/mobile/native-openai-text-stream.mjs +3 -3
  288. package/dist/mobile/native-provider-api-key.js +2 -2
  289. package/dist/mobile/native-provider-api-key.mjs +1 -1
  290. package/dist/mobile/native-reply-route.js +25 -4
  291. package/dist/mobile/native-reply-route.mjs +13 -11
  292. package/dist/mobile/native-reply-system-prompt-layers.js +497 -392
  293. package/dist/mobile/native-reply-system-prompt-layers.mjs +155 -155
  294. package/dist/mobile/native-reply-system-prompt.js +1 -0
  295. package/dist/mobile/native-reply-system-prompt.mjs +1 -1
  296. package/dist/mobile/native-reply-transcript.js +125 -0
  297. package/dist/mobile/native-reply-transcript.mjs +7 -2
  298. package/dist/mobile/native-request-diagnostics.js +4 -2
  299. package/dist/mobile/native-request-diagnostics.mjs +3 -1
  300. package/dist/mobile/native-stream-block-emit.mjs +3 -3
  301. package/dist/mobile/openai-completions-turn-runner.js +874 -608
  302. package/dist/mobile/openai-completions-turn-runner.mjs +172 -170
  303. package/dist/mobile/reply-dispatch-warmup.mjs +5 -5
  304. package/dist/mobile/runtime.js +8272 -7353
  305. package/dist/mobile/runtime.mjs +253 -238
  306. package/dist/mobile/session-dispatch/mobile-session-agent-event-bridge.mjs +1 -1
  307. package/dist/mobile/store.mjs +3 -3
  308. package/dist/mobile/stream-inbound/mobile-text-stream-pipeline.js +321 -9
  309. package/dist/mobile/stream-inbound/mobile-text-stream-pipeline.mjs +11 -4
  310. package/dist/mobile/system-prompt-snapshot.mjs +4 -4
  311. package/dist/mobile/tool-result-final-summary.js +145 -0
  312. package/dist/mobile/tool-result-final-summary.mjs +11 -0
  313. package/dist/mobile/tool-use-input-normalize.js +492 -389
  314. package/dist/mobile/tool-use-input-normalize.mjs +158 -158
  315. package/dist/mobile/tools/mobile-compact-tool-bridge.js +492 -389
  316. package/dist/mobile/tools/mobile-compact-tool-bridge.mjs +157 -157
  317. package/dist/mobile/types.js +1 -0
  318. package/dist/mobile/types.mjs +1 -1
  319. package/dist/mobile/websocket.js +327 -0
  320. package/dist/mobile/websocket.mjs +7 -2
  321. package/dist/mobile/workspace-startup-pointer.js +1 -1
  322. package/dist/mobile/workspace-startup-pointer.mjs +1 -1
  323. package/dist/org/dept-context.mjs +4 -4
  324. package/dist/org/index.mjs +8 -8
  325. package/dist/owned-tools/agent-tool-config.mjs +2 -2
  326. package/dist/owned-tools/agents-list.mjs +6 -6
  327. package/dist/owned-tools/ceo-confirm-requirements.mjs +15 -15
  328. package/dist/owned-tools/ceo-decision.js +72 -18
  329. package/dist/owned-tools/ceo-decision.mjs +22 -22
  330. package/dist/owned-tools/ceo-ops-brief.mjs +15 -15
  331. package/dist/owned-tools/ceo-redirect.js +3 -0
  332. package/dist/owned-tools/ceo-redirect.mjs +60 -59
  333. package/dist/owned-tools/commit-stack-lesson.mjs +16 -16
  334. package/dist/owned-tools/compact/execute.js +492 -389
  335. package/dist/owned-tools/compact/execute.mjs +155 -155
  336. package/dist/owned-tools/compact/gateway-tool-factory.js +492 -389
  337. package/dist/owned-tools/compact/gateway-tool-factory.mjs +156 -156
  338. package/dist/owned-tools/compact/registry.js +492 -389
  339. package/dist/owned-tools/compact/registry.mjs +154 -154
  340. package/dist/owned-tools/context-compact.js +8 -22
  341. package/dist/owned-tools/context-compact.mjs +69 -63
  342. package/dist/owned-tools/edit.mjs +2 -2
  343. package/dist/owned-tools/exec-primitives.mjs +2 -2
  344. package/dist/owned-tools/exec.js +112 -9
  345. package/dist/owned-tools/exec.mjs +12 -8
  346. package/dist/owned-tools/groups-history.mjs +10 -10
  347. package/dist/owned-tools/handoff.mjs +21 -21
  348. package/dist/owned-tools/internal-tool-names.js +40 -0
  349. package/dist/owned-tools/internal-tool-names.mjs +9 -0
  350. package/dist/owned-tools/media-asset-library.mjs +2 -2
  351. package/dist/owned-tools/memory-control.mjs +24 -18
  352. package/dist/owned-tools/memory-get.js +7 -3
  353. package/dist/owned-tools/memory-get.mjs +1 -1
  354. package/dist/owned-tools/memory-runtime-eval.js +232 -146
  355. package/dist/owned-tools/memory-runtime-eval.mjs +23 -17
  356. package/dist/owned-tools/message.mjs +7 -7
  357. package/dist/owned-tools/models-list.mjs +2 -2
  358. package/dist/owned-tools/owned-reply.mjs +6 -6
  359. package/dist/owned-tools/owned-tool-payload-failure.js +3 -6
  360. package/dist/owned-tools/owned-tool-payload-failure.mjs +1 -1
  361. package/dist/owned-tools/process-registry.mjs +2 -2
  362. package/dist/owned-tools/process.mjs +3 -3
  363. package/dist/owned-tools/providers/minimax-video-generate.mjs +2 -2
  364. package/dist/owned-tools/providers/minimax-voice.mjs +2 -2
  365. package/dist/owned-tools/read.mjs +2 -2
  366. package/dist/owned-tools/register-owned-providers.mjs +12 -12
  367. package/dist/owned-tools/registry.js +497 -389
  368. package/dist/owned-tools/registry.mjs +158 -153
  369. package/dist/owned-tools/router.js +554 -451
  370. package/dist/owned-tools/router.mjs +154 -154
  371. package/dist/owned-tools/runtime-bridge.js +554 -451
  372. package/dist/owned-tools/runtime-bridge.mjs +156 -156
  373. package/dist/owned-tools/runtime-data.mjs +5 -5
  374. package/dist/owned-tools/session-status.mjs +7 -7
  375. package/dist/owned-tools/sessions-history-resolver.mjs +9 -9
  376. package/dist/owned-tools/sessions-history.mjs +8 -8
  377. package/dist/owned-tools/sessions-list.mjs +6 -6
  378. package/dist/owned-tools/sessions-send.mjs +7 -7
  379. package/dist/owned-tools/skills-create.mjs +6 -6
  380. package/dist/owned-tools/subagents.mjs +7 -7
  381. package/dist/owned-tools/tool-contract-prompt.js +497 -392
  382. package/dist/owned-tools/tool-contract-prompt.mjs +154 -154
  383. package/dist/owned-tools/tool-result-envelope.js +526 -405
  384. package/dist/owned-tools/tool-result-envelope.mjs +159 -159
  385. package/dist/owned-tools/tool-usage-guide.js +492 -389
  386. package/dist/owned-tools/tool-usage-guide.mjs +153 -153
  387. package/dist/owned-tools/tool-validation.mjs +2 -2
  388. package/dist/owned-tools/tts.mjs +6 -6
  389. package/dist/owned-tools/web-smoke.mjs +9 -9
  390. package/dist/owned-tools/write.mjs +2 -2
  391. package/dist/project/file-tool-scope-default.mjs +6 -6
  392. package/dist/project/file-tool-scope.js +1 -1
  393. package/dist/project/file-tool-scope.mjs +1 -1
  394. package/dist/project-pipeline/handlers.js +3 -0
  395. package/dist/project-pipeline/handlers.mjs +60 -59
  396. package/dist/project-pipeline/index.js +3 -0
  397. package/dist/project-pipeline/index.mjs +62 -61
  398. package/dist/project-pipeline/pipeline-routing.mjs +2 -2
  399. package/dist/project-pipeline/post-close-skill-evolution.mjs +5 -5
  400. package/dist/project-pipeline/project-store.mjs +5 -5
  401. package/gateway-core/runtime/reply/chinese-monologue-deliver-partition.cjs +27 -6
  402. package/package.json +2 -2
  403. package/dist/chunk-4IWTTXQE.mjs +0 -113
  404. package/dist/chunk-ETD5LGJY.mjs +0 -25
  405. package/gateway-core/README.md +0 -6
  406. package/dist/{chunk-MGWYJD5Q.mjs → chunk-2YNBEBKQ.mjs} +14 -14
  407. package/dist/{chunk-QM7MTC5Q.mjs → chunk-522D52FC.mjs} +3 -3
  408. package/dist/{chunk-QADC4VKT.mjs → chunk-5MXGINNQ.mjs} +4 -4
  409. package/dist/{chunk-BRJJML7A.mjs → chunk-5NFOBSYF.mjs} +3 -3
  410. package/dist/{chunk-NRJWLPTI.mjs → chunk-6AY6OPO5.mjs} +3 -3
  411. package/dist/{chunk-JA65ZG3H.mjs → chunk-BYGWNFCJ.mjs} +4 -4
  412. package/dist/{chunk-I7O5UR24.mjs → chunk-JX3URYQG.mjs} +4 -4
  413. package/dist/{chunk-2QCX6RPN.mjs → chunk-KCZIK3TH.mjs} +3 -3
  414. package/dist/{chunk-WPLDZLAL.mjs → chunk-L7PMYQN5.mjs} +3 -3
  415. package/dist/{chunk-H2UCPL5O.mjs → chunk-LY7M7Z7M.mjs} +3 -3
  416. package/dist/{chunk-UNZ3D3B3.mjs → chunk-MK32KUVI.mjs} +6 -6
  417. package/dist/{chunk-5LUTMHVL.mjs → chunk-NXKHSX4M.mjs} +3 -3
  418. package/dist/{chunk-QVEQRCOD.mjs → chunk-PIDPHIN6.mjs} +4 -4
  419. package/dist/{chunk-UR6LPERL.mjs → chunk-Q7NYATKS.mjs} +3 -3
  420. package/dist/{chunk-TQOUQIVS.mjs → chunk-V3XUPTZQ.mjs} +3 -3
  421. package/dist/{chunk-HWGRW6YP.mjs → chunk-VS2URZFN.mjs} +3 -3
  422. package/dist/{chunk-CVXJ45WI.mjs → chunk-WTOP2LEF.mjs} +5 -5
  423. package/dist/{chunk-FY2QAWA6.mjs → chunk-YI7E3RUY.mjs} +5 -5
@@ -36,18 +36,15 @@ function ownedToolPayloadIndicatesFailure(payload) {
36
36
  return false;
37
37
  }
38
38
  const record = payload;
39
+ if (record.is_error === true) {
40
+ return true;
41
+ }
39
42
  if (record.ok === false) {
40
43
  return true;
41
44
  }
42
45
  if (record.ok === true) {
43
46
  return false;
44
47
  }
45
- if (typeof record.exitCode === "number" && record.exitCode !== 0) {
46
- return true;
47
- }
48
- if (typeof record.error === "string" && record.error.trim()) {
49
- return true;
50
- }
51
48
  return false;
52
49
  }
53
50
  var init_owned_tool_payload_failure = __esm({
@@ -7689,7 +7686,7 @@ function formatRuntimeContextStateBlock(input) {
7689
7686
  lines.push("fileScopes: project | agent | memory");
7690
7687
  lines.push("defaultFileScope: agent (pipeline group chat or user project/repo intent \u2192 project at runtime)");
7691
7688
  lines.push(
7692
- "workspaceDiscipline: IDENTITY/SOUL/USER/MEMORY/AGENTS.md live ONLY under agentWorkspace \u2014 use scope=agent or scope=memory; never treat projectRoot as your identity directory."
7689
+ "workspaceDiscipline: IDENTITY/SOUL/USER/MEMORY/AGENTS.md live ONLY under agentWorkspace \u2014 use scope=agent (scope=memory only reads MEMORY.md/USER.md/memory/**); never treat projectRoot as your identity directory."
7693
7690
  );
7694
7691
  lines.push(
7695
7692
  "projectRoot is the active task codebase (scope=project only); agentWorkspace is your persona, memory, and user inbound attachments (media/inbound and file/inbound)."
@@ -7726,8 +7723,22 @@ var init_tool_result_compact = __esm({
7726
7723
  }
7727
7724
  });
7728
7725
 
7726
+ // src/owned-tools/internal-tool-names.ts
7727
+ var OWNED_INTERNAL_TOOL_NAMES;
7728
+ var init_internal_tool_names = __esm({
7729
+ "src/owned-tools/internal-tool-names.ts"() {
7730
+ "use strict";
7731
+ OWNED_INTERNAL_TOOL_NAMES = /* @__PURE__ */ new Set([
7732
+ "diary_search",
7733
+ "notes_search",
7734
+ "notes_get",
7735
+ "summarize"
7736
+ ]);
7737
+ }
7738
+ });
7739
+
7729
7740
  // src/mobile/native-reply-transcript.ts
7730
- var import_node_fs39, import_node_path37;
7741
+ var import_node_fs39, import_node_path37, IMAGE_BLOCK_BUDGET_BYTES;
7731
7742
  var init_native_reply_transcript = __esm({
7732
7743
  "src/mobile/native-reply-transcript.ts"() {
7733
7744
  "use strict";
@@ -7737,6 +7748,8 @@ var init_native_reply_transcript = __esm({
7737
7748
  init_chat_visible_text();
7738
7749
  init_transcript_media_sanitize();
7739
7750
  init_tool_result_compact();
7751
+ init_internal_tool_names();
7752
+ IMAGE_BLOCK_BUDGET_BYTES = 8 * 1024;
7740
7753
  }
7741
7754
  });
7742
7755
 
@@ -8244,6 +8257,241 @@ var init_memory_consolidate = __esm({
8244
8257
  }
8245
8258
  });
8246
8259
 
8260
+ // src/mobile/group/pipeline-turn-outcome.ts
8261
+ function parseHandoffPayload(raw) {
8262
+ const trimmed = raw?.trim();
8263
+ if (!trimmed) return null;
8264
+ try {
8265
+ const parsed = JSON.parse(trimmed);
8266
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
8267
+ return parsed;
8268
+ } catch {
8269
+ return null;
8270
+ }
8271
+ }
8272
+ function assessSingleHandoffToolCall(tc) {
8273
+ if (tc.isError || tc.status === "error") {
8274
+ return { kind: "failed" };
8275
+ }
8276
+ const envelope = parseHandoffPayload(tc.result ?? tc.partialResult);
8277
+ if (!envelope) {
8278
+ return { kind: "none" };
8279
+ }
8280
+ if (ownedToolPayloadIndicatesFailure(envelope)) {
8281
+ return { kind: "failed" };
8282
+ }
8283
+ const data = envelope.data && typeof envelope.data === "object" && !Array.isArray(envelope.data) ? envelope.data : envelope;
8284
+ const phase = typeof data.phase === "string" ? data.phase : void 0;
8285
+ return { kind: "succeeded", phase };
8286
+ }
8287
+ function assessPipelineHandoffFromToolCalls(toolCalls) {
8288
+ const handoffs = (toolCalls ?? []).filter((tc) => tc.name === "handoff");
8289
+ if (!handoffs.length) {
8290
+ return { kind: "none" };
8291
+ }
8292
+ let sawFailure = false;
8293
+ for (let i = handoffs.length - 1; i >= 0; i -= 1) {
8294
+ const outcome = assessSingleHandoffToolCall(handoffs[i]);
8295
+ if (outcome.kind === "succeeded") {
8296
+ return outcome;
8297
+ }
8298
+ if (outcome.kind === "failed") {
8299
+ sawFailure = true;
8300
+ }
8301
+ }
8302
+ return sawFailure ? { kind: "failed" } : { kind: "none" };
8303
+ }
8304
+ function assessSingleCeoDecisionToolCall(tc) {
8305
+ if (tc.isError || tc.status === "error") {
8306
+ return { kind: "failed" };
8307
+ }
8308
+ const envelope = parseHandoffPayload(tc.result ?? tc.partialResult);
8309
+ if (!envelope) {
8310
+ return { kind: "none" };
8311
+ }
8312
+ if (ownedToolPayloadIndicatesFailure(envelope)) {
8313
+ return { kind: "failed" };
8314
+ }
8315
+ const data = envelope.data && typeof envelope.data === "object" && !Array.isArray(envelope.data) ? envelope.data : envelope;
8316
+ const phase = typeof data.phase === "string" ? data.phase : void 0;
8317
+ return { kind: "succeeded", phase };
8318
+ }
8319
+ function assessPipelineCeoDecisionFromToolCalls(toolCalls) {
8320
+ const calls = (toolCalls ?? []).filter((tc) => tc.name === "ceo_decision");
8321
+ if (!calls.length) {
8322
+ return { kind: "none" };
8323
+ }
8324
+ let sawFailure = false;
8325
+ for (let i = calls.length - 1; i >= 0; i -= 1) {
8326
+ const outcome = assessSingleCeoDecisionToolCall(calls[i]);
8327
+ if (outcome.kind === "succeeded") {
8328
+ return outcome;
8329
+ }
8330
+ if (outcome.kind === "failed") {
8331
+ sawFailure = true;
8332
+ }
8333
+ }
8334
+ return sawFailure ? { kind: "failed" } : { kind: "none" };
8335
+ }
8336
+ function isPipelineAgentCeoTerminalPhase(project) {
8337
+ const phase = project?.phase;
8338
+ return (phase === "closed" || phase === "scope_change") && project?.ceoMode === "agent" && Boolean(project?.ceoAgentId?.trim());
8339
+ }
8340
+ function isPipelineCeoDispatchPhase(project) {
8341
+ const phase = project?.phase;
8342
+ return (phase === "ceo_dispatch" || phase === "created") && project?.ceoMode === "agent" && Boolean(project?.ceoAgentId?.trim());
8343
+ }
8344
+ function isPipelineAgentCeoInputPhase(project) {
8345
+ const phase = project?.phase;
8346
+ return (phase === "ceo_confirm" || phase === "ops_brief_draft") && project?.ceoMode === "agent" && Boolean(project?.ceoAgentId?.trim());
8347
+ }
8348
+ function isPipelineAgentCeoReview(project) {
8349
+ return project?.phase === "ceo_review" && project?.ceoMode === "agent" && Boolean(project?.ceoAgentId?.trim());
8350
+ }
8351
+ function isPipelineCeoActionablePhase(project) {
8352
+ return isPipelineAgentCeoInputPhase(project) || isPipelineCeoDispatchPhase(project) || isPipelineAgentCeoReview(project) || isPipelineAgentCeoTerminalPhase(project);
8353
+ }
8354
+ function isPipelineAwaitingCeoPhase(phase) {
8355
+ return phase === "ceo_review" || phase === "closed" || phase === "scope_change";
8356
+ }
8357
+ function hasPipelineActiveDepartment(phase) {
8358
+ if (!phase) return false;
8359
+ if (isDynamicDeptPhase(phase)) return true;
8360
+ return activeDepartmentForPhase(phase) !== null;
8361
+ }
8362
+ var init_pipeline_turn_outcome = __esm({
8363
+ "src/mobile/group/pipeline-turn-outcome.ts"() {
8364
+ "use strict";
8365
+ init_owned_tool_payload_failure();
8366
+ init_group_template();
8367
+ init_dynamic_phase();
8368
+ }
8369
+ });
8370
+
8371
+ // src/mobile/group/pipeline-handoff-verification.ts
8372
+ function hasPipelineHandoffClaim(text) {
8373
+ return PIPELINE_HANDOFF_CLAIM_PATTERN.test(text.trim());
8374
+ }
8375
+ function assessPipelineHandoffClaimVerification(text, toolCalls) {
8376
+ if (!hasPipelineHandoffClaim(text)) {
8377
+ return void 0;
8378
+ }
8379
+ const handoffOutcome = assessPipelineHandoffFromToolCalls(toolCalls);
8380
+ return handoffOutcome.kind === "succeeded" ? "verified" : "unverified";
8381
+ }
8382
+ function wroteDeptDeliverableWithoutHandoff(toolCalls) {
8383
+ const handoffOutcome = assessPipelineHandoffFromToolCalls(toolCalls);
8384
+ if (handoffOutcome.kind === "succeeded") {
8385
+ return false;
8386
+ }
8387
+ const deptDocPath = /docs\/(research|product|dev|audit)\//i;
8388
+ return (toolCalls ?? []).some((tc) => {
8389
+ if (tc.status !== "success" || tc.name !== "write" && tc.name !== "edit") {
8390
+ return false;
8391
+ }
8392
+ const args = tc.args ?? {};
8393
+ const pathCandidate = args.path ?? args.file_path ?? args.filePath ?? args.relativePath ?? args.target;
8394
+ if (typeof pathCandidate === "string" && deptDocPath.test(pathCandidate)) {
8395
+ return true;
8396
+ }
8397
+ return deptDocPath.test(String(tc.result ?? tc.partialResult ?? ""));
8398
+ });
8399
+ }
8400
+ function shouldTreatPipelineHandoffAsUnverified(params) {
8401
+ const claim = assessPipelineHandoffClaimVerification(params.replyText, params.toolCalls);
8402
+ if (claim === "unverified") {
8403
+ return true;
8404
+ }
8405
+ return wroteDeptDeliverableWithoutHandoff(params.toolCalls);
8406
+ }
8407
+ var PIPELINE_HANDOFF_CLAIM_PATTERN;
8408
+ var init_pipeline_handoff_verification = __esm({
8409
+ "src/mobile/group/pipeline-handoff-verification.ts"() {
8410
+ "use strict";
8411
+ init_pipeline_turn_outcome();
8412
+ PIPELINE_HANDOFF_CLAIM_PATTERN = /(?:已交接|已经完成交接|交接给|交给(?:产品|研发|审计|调研)|handoff(?:\s*工具)?(?:已|成功)|(?:product|research|dev|audit)_active|流水线(?:已|正常)推进|下游(?:部门)?已激活|补交\s*handoff)/i;
8413
+ }
8414
+ });
8415
+
8416
+ // src/mobile/group/delivery-verification.ts
8417
+ function parseToolResult(raw) {
8418
+ const trimmed = raw?.trim();
8419
+ if (!trimmed) {
8420
+ return void 0;
8421
+ }
8422
+ try {
8423
+ return JSON.parse(trimmed);
8424
+ } catch {
8425
+ return trimmed;
8426
+ }
8427
+ }
8428
+ function hasNonEmptyString(value) {
8429
+ return typeof value === "string" && value.trim().length > 0;
8430
+ }
8431
+ function recordHasEvidenceField(value, depth = 0) {
8432
+ if (!value || typeof value !== "object" || depth > 4) {
8433
+ return false;
8434
+ }
8435
+ if (Array.isArray(value)) {
8436
+ return value.some((entry) => recordHasEvidenceField(entry, depth + 1));
8437
+ }
8438
+ const record = value;
8439
+ for (const [key, fieldValue] of Object.entries(record)) {
8440
+ const normalizedKey = key.toLowerCase();
8441
+ const keyLooksLikeEvidence = normalizedKey === "path" || normalizedKey === "abspath" || normalizedKey === "filepath" || normalizedKey === "targetpath" || normalizedKey === "resolvedpath" || normalizedKey === "hash" || normalizedKey === "sha256" || normalizedKey === "digest" || normalizedKey === "checksum" || normalizedKey === "exitcode" || normalizedKey === "stdout" || normalizedKey === "stderr" || normalizedKey === "byteswritten" || normalizedKey === "sizebytes" || normalizedKey === "url" || normalizedKey === "mediaurl";
8442
+ if (keyLooksLikeEvidence && (hasNonEmptyString(fieldValue) || typeof fieldValue === "number" && Number.isFinite(fieldValue))) {
8443
+ return true;
8444
+ }
8445
+ if (recordHasEvidenceField(fieldValue, depth + 1)) {
8446
+ return true;
8447
+ }
8448
+ }
8449
+ return false;
8450
+ }
8451
+ function toolCallHasCompletionEvidence(tc) {
8452
+ if (tc.status !== "success" || tc.isError) {
8453
+ return false;
8454
+ }
8455
+ const result = parseToolResult(tc.result ?? tc.partialResult);
8456
+ const args = tc.args ?? {};
8457
+ const resultHasEvidence = recordHasEvidenceField(result);
8458
+ const argsHaveEvidence = recordHasEvidenceField(args);
8459
+ const tool = tc.name.trim().toLowerCase();
8460
+ if (tool === "exec") {
8461
+ return argsHaveEvidence || resultHasEvidence || hasNonEmptyString(args.command);
8462
+ }
8463
+ if (tool === "write" || tool === "edit" || tool === "read" || tool === "pdf") {
8464
+ return argsHaveEvidence || resultHasEvidence;
8465
+ }
8466
+ if (tool === "image_generate" || tool === "video_generate" || tool === "music_generate") {
8467
+ return argsHaveEvidence || resultHasEvidence;
8468
+ }
8469
+ return resultHasEvidence;
8470
+ }
8471
+ function assessGenericCompletionVerification(text, toolCalls) {
8472
+ const trimmed = text.trim();
8473
+ if (!trimmed || !COMPLETION_CLAIM_PATTERN.test(trimmed)) {
8474
+ return void 0;
8475
+ }
8476
+ const hasEvidenceBackedTool = (toolCalls ?? []).some((tc) => toolCallHasCompletionEvidence(tc));
8477
+ return hasEvidenceBackedTool ? "verified" : "unverified";
8478
+ }
8479
+ function assessDeliveryVerification(text, toolCalls) {
8480
+ const handoffClaim = assessPipelineHandoffClaimVerification(text, toolCalls);
8481
+ if (handoffClaim) {
8482
+ return handoffClaim;
8483
+ }
8484
+ return assessGenericCompletionVerification(text, toolCalls);
8485
+ }
8486
+ var COMPLETION_CLAIM_PATTERN;
8487
+ var init_delivery_verification = __esm({
8488
+ "src/mobile/group/delivery-verification.ts"() {
8489
+ "use strict";
8490
+ init_pipeline_handoff_verification();
8491
+ COMPLETION_CLAIM_PATTERN = /(?:已完成|已经完成|做完了|搞定了|修改成功|写入成功|创建成功|删除成功|已改成|已更新|已保存|已修改|已写入|已创建|已删除|已检查|已验证|跑完了|\d+\s*(?:个|件)?\s*(?:文件|目录|路径))/i;
8492
+ }
8493
+ });
8494
+
8247
8495
  // src/mobile/group/team-memory-runtime.ts
8248
8496
  function normalizeTeamId(teamId) {
8249
8497
  return teamId?.trim() || "";
@@ -8448,193 +8696,6 @@ var init_remarks = __esm({
8448
8696
  }
8449
8697
  });
8450
8698
 
8451
- // src/mobile/group/pipeline-turn-outcome.ts
8452
- function parseHandoffPayload(raw) {
8453
- const trimmed = raw?.trim();
8454
- if (!trimmed) return null;
8455
- try {
8456
- const parsed = JSON.parse(trimmed);
8457
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
8458
- return parsed;
8459
- } catch {
8460
- return null;
8461
- }
8462
- }
8463
- function assessSingleHandoffToolCall(tc) {
8464
- if (tc.isError || tc.status === "error") {
8465
- return { kind: "failed" };
8466
- }
8467
- const envelope = parseHandoffPayload(tc.result ?? tc.partialResult);
8468
- if (!envelope) {
8469
- return tc.status === "success" ? { kind: "succeeded" } : { kind: "none" };
8470
- }
8471
- if (ownedToolPayloadIndicatesFailure(envelope)) {
8472
- return { kind: "failed" };
8473
- }
8474
- const data = envelope.data && typeof envelope.data === "object" && !Array.isArray(envelope.data) ? envelope.data : envelope;
8475
- if (data.ok === false) {
8476
- return { kind: "failed" };
8477
- }
8478
- const phase = typeof data.phase === "string" ? data.phase : void 0;
8479
- return { kind: "succeeded", phase };
8480
- }
8481
- function assessPipelineHandoffFromToolCalls(toolCalls) {
8482
- const handoffs = (toolCalls ?? []).filter((tc) => tc.name === "handoff");
8483
- if (!handoffs.length) {
8484
- return { kind: "none" };
8485
- }
8486
- let sawFailure = false;
8487
- for (let i = handoffs.length - 1; i >= 0; i -= 1) {
8488
- const outcome = assessSingleHandoffToolCall(handoffs[i]);
8489
- if (outcome.kind === "succeeded") {
8490
- return outcome;
8491
- }
8492
- if (outcome.kind === "failed") {
8493
- sawFailure = true;
8494
- }
8495
- }
8496
- return sawFailure ? { kind: "failed" } : { kind: "none" };
8497
- }
8498
- function assessSingleCeoDecisionToolCall(tc) {
8499
- if (tc.isError || tc.status === "error") {
8500
- return { kind: "failed" };
8501
- }
8502
- const envelope = parseHandoffPayload(tc.result ?? tc.partialResult);
8503
- if (!envelope) {
8504
- return tc.status === "success" ? { kind: "succeeded" } : { kind: "none" };
8505
- }
8506
- if (ownedToolPayloadIndicatesFailure(envelope)) {
8507
- return { kind: "failed" };
8508
- }
8509
- const data = envelope.data && typeof envelope.data === "object" && !Array.isArray(envelope.data) ? envelope.data : envelope;
8510
- if (data.ok === false) {
8511
- return { kind: "failed" };
8512
- }
8513
- const phase = typeof data.phase === "string" ? data.phase : void 0;
8514
- return { kind: "succeeded", phase };
8515
- }
8516
- function assessPipelineCeoDecisionFromToolCalls(toolCalls) {
8517
- const calls = (toolCalls ?? []).filter((tc) => tc.name === "ceo_decision");
8518
- if (!calls.length) {
8519
- return { kind: "none" };
8520
- }
8521
- let sawFailure = false;
8522
- for (let i = calls.length - 1; i >= 0; i -= 1) {
8523
- const outcome = assessSingleCeoDecisionToolCall(calls[i]);
8524
- if (outcome.kind === "succeeded") {
8525
- return outcome;
8526
- }
8527
- if (outcome.kind === "failed") {
8528
- sawFailure = true;
8529
- }
8530
- }
8531
- return sawFailure ? { kind: "failed" } : { kind: "none" };
8532
- }
8533
- function isPipelineAgentCeoTerminalPhase(project) {
8534
- const phase = project?.phase;
8535
- return (phase === "closed" || phase === "scope_change") && project?.ceoMode === "agent" && Boolean(project?.ceoAgentId?.trim());
8536
- }
8537
- function isPipelineCeoDispatchPhase(project) {
8538
- const phase = project?.phase;
8539
- return (phase === "ceo_dispatch" || phase === "created") && project?.ceoMode === "agent" && Boolean(project?.ceoAgentId?.trim());
8540
- }
8541
- function isPipelineAgentCeoInputPhase(project) {
8542
- const phase = project?.phase;
8543
- return (phase === "ceo_confirm" || phase === "ops_brief_draft") && project?.ceoMode === "agent" && Boolean(project?.ceoAgentId?.trim());
8544
- }
8545
- function isPipelineAgentCeoReview(project) {
8546
- return project?.phase === "ceo_review" && project?.ceoMode === "agent" && Boolean(project?.ceoAgentId?.trim());
8547
- }
8548
- function isPipelineCeoActionablePhase(project) {
8549
- return isPipelineAgentCeoInputPhase(project) || isPipelineCeoDispatchPhase(project) || isPipelineAgentCeoReview(project) || isPipelineAgentCeoTerminalPhase(project);
8550
- }
8551
- function isPipelineAwaitingCeoPhase(phase) {
8552
- return phase === "ceo_review" || phase === "closed" || phase === "scope_change";
8553
- }
8554
- function hasPipelineActiveDepartment(phase) {
8555
- if (!phase) return false;
8556
- if (isDynamicDeptPhase(phase)) return true;
8557
- return activeDepartmentForPhase(phase) !== null;
8558
- }
8559
- var init_pipeline_turn_outcome = __esm({
8560
- "src/mobile/group/pipeline-turn-outcome.ts"() {
8561
- "use strict";
8562
- init_owned_tool_payload_failure();
8563
- init_group_template();
8564
- init_dynamic_phase();
8565
- }
8566
- });
8567
-
8568
- // src/mobile/group/pipeline-handoff-verification.ts
8569
- function hasPipelineHandoffClaim(text) {
8570
- return PIPELINE_HANDOFF_CLAIM_PATTERN.test(text.trim());
8571
- }
8572
- function assessPipelineHandoffClaimVerification(text, toolCalls) {
8573
- if (!hasPipelineHandoffClaim(text)) {
8574
- return void 0;
8575
- }
8576
- const handoffOutcome = assessPipelineHandoffFromToolCalls(toolCalls);
8577
- return handoffOutcome.kind === "succeeded" ? "verified" : "unverified";
8578
- }
8579
- function wroteDeptDeliverableWithoutHandoff(toolCalls) {
8580
- const handoffOutcome = assessPipelineHandoffFromToolCalls(toolCalls);
8581
- if (handoffOutcome.kind === "succeeded") {
8582
- return false;
8583
- }
8584
- const deptDocPath = /docs\/(research|product|dev|audit)\//i;
8585
- return (toolCalls ?? []).some((tc) => {
8586
- if (tc.status !== "success" || tc.name !== "write" && tc.name !== "edit") {
8587
- return false;
8588
- }
8589
- const args = tc.args ?? {};
8590
- const pathCandidate = args.path ?? args.file_path ?? args.filePath ?? args.relativePath ?? args.target;
8591
- if (typeof pathCandidate === "string" && deptDocPath.test(pathCandidate)) {
8592
- return true;
8593
- }
8594
- return deptDocPath.test(String(tc.result ?? tc.partialResult ?? ""));
8595
- });
8596
- }
8597
- function shouldTreatPipelineHandoffAsUnverified(params) {
8598
- const claim = assessPipelineHandoffClaimVerification(params.replyText, params.toolCalls);
8599
- if (claim === "unverified") {
8600
- return true;
8601
- }
8602
- return wroteDeptDeliverableWithoutHandoff(params.toolCalls);
8603
- }
8604
- var PIPELINE_HANDOFF_CLAIM_PATTERN;
8605
- var init_pipeline_handoff_verification = __esm({
8606
- "src/mobile/group/pipeline-handoff-verification.ts"() {
8607
- "use strict";
8608
- init_pipeline_turn_outcome();
8609
- PIPELINE_HANDOFF_CLAIM_PATTERN = /(?:已交接|已经完成交接|交接给|交给(?:产品|研发|审计|调研)|handoff(?:\s*工具)?(?:已|成功)|(?:product|research|dev|audit)_active|流水线(?:已|正常)推进|下游(?:部门)?已激活|补交\s*handoff)/i;
8610
- }
8611
- });
8612
-
8613
- // src/mobile/group/delivery-verification.ts
8614
- function assessGenericCompletionVerification(text, toolCalls) {
8615
- const trimmed = text.trim();
8616
- if (!trimmed || !COMPLETION_CLAIM_PATTERN.test(trimmed)) {
8617
- return void 0;
8618
- }
8619
- const hasSuccessTool = (toolCalls ?? []).some((tc) => tc.status === "success");
8620
- return hasSuccessTool ? "verified" : "unverified";
8621
- }
8622
- function assessDeliveryVerification(text, toolCalls) {
8623
- const handoffClaim = assessPipelineHandoffClaimVerification(text, toolCalls);
8624
- if (handoffClaim) {
8625
- return handoffClaim;
8626
- }
8627
- return assessGenericCompletionVerification(text, toolCalls);
8628
- }
8629
- var COMPLETION_CLAIM_PATTERN;
8630
- var init_delivery_verification = __esm({
8631
- "src/mobile/group/delivery-verification.ts"() {
8632
- "use strict";
8633
- init_pipeline_handoff_verification();
8634
- COMPLETION_CLAIM_PATTERN = /(?:已完成|已经完成|做完了|搞定了|修改成功|写入成功|创建成功|删除成功|已改成|已更新|已保存)/i;
8635
- }
8636
- });
8637
-
8638
8699
  // src/mobile/group/team-task-board.ts
8639
8700
  function resolvePath() {
8640
8701
  return (0, import_node_path48.join)(resolveXkzoomStateDirForProcess(), TASK_BOARD_FILE);
@@ -19626,6 +19687,7 @@ var minimaxOpenAiCompletionsAdapter = {
19626
19687
  };
19627
19688
 
19628
19689
  // src/mobile/native-request-diagnostics.ts
19690
+ var PROTOCOL_FALLBACK_MAX_TOKENS = 16384;
19629
19691
  var RETRYABLE_NATIVE_FETCH_RE = new RegExp(
19630
19692
  [
19631
19693
  "fetch failed",
@@ -19735,8 +19797,6 @@ function toolChoicePolicyToMinimaxAnthropicToolChoiceWire(policy) {
19735
19797
 
19736
19798
  // src/mobile/minimax-m3.ts
19737
19799
  var MINIMAX_M3_MODEL_ID = "MiniMax-M3";
19738
- var MINIMAX_M3_DEFAULT_MAX_TOKENS = 131072;
19739
- var MINIMAX_M3_MAX_TOKENS_ENV = "XKZOOM_MINIMAX_M3_MAX_TOKENS";
19740
19800
  function isMinimaxM3Model(modelId) {
19741
19801
  return (modelId ?? "").trim() === MINIMAX_M3_MODEL_ID;
19742
19802
  }
@@ -19748,16 +19808,6 @@ function resolveMinimaxM3AnthropicThinking(params) {
19748
19808
  if (params.reasoningMode === "off") return "disabled";
19749
19809
  return "adaptive";
19750
19810
  }
19751
- function resolveMinimaxM3DefaultMaxTokens(env = process.env) {
19752
- const raw = env[MINIMAX_M3_MAX_TOKENS_ENV];
19753
- if (typeof raw === "string" && raw.trim()) {
19754
- const n = Number.parseInt(raw.trim(), 10);
19755
- if (Number.isFinite(n) && n > 0) {
19756
- return n;
19757
- }
19758
- }
19759
- return MINIMAX_M3_DEFAULT_MAX_TOKENS;
19760
- }
19761
19811
  function normalizeMinimaxM3ThinkingType(value) {
19762
19812
  if (value && typeof value === "object" && !Array.isArray(value)) {
19763
19813
  const raw = typeof value.type === "string" ? value.type.trim().toLowerCase() : "";
@@ -19841,7 +19891,7 @@ var genericAnthropicAdapter = {
19841
19891
  return genericThinking(input);
19842
19892
  },
19843
19893
  defaultBodyExtras() {
19844
- return { max_tokens: 16384 };
19894
+ return { max_tokens: PROTOCOL_FALLBACK_MAX_TOKENS };
19845
19895
  },
19846
19896
  forcedToolChoiceSupported() {
19847
19897
  return true;
@@ -19909,11 +19959,8 @@ var minimaxAnthropicAdapter = {
19909
19959
  }
19910
19960
  return void 0;
19911
19961
  },
19912
- defaultBodyExtras(input) {
19913
- if (isMinimaxM3Model(input?.model)) {
19914
- return { max_tokens: resolveMinimaxM3DefaultMaxTokens(input?.env) };
19915
- }
19916
- return { max_tokens: 16384 };
19962
+ defaultBodyExtras() {
19963
+ return { max_tokens: PROTOCOL_FALLBACK_MAX_TOKENS };
19917
19964
  },
19918
19965
  forcedToolChoiceSupported() {
19919
19966
  return true;
@@ -19956,7 +20003,7 @@ function resolveAnthropicMessagesBodyExtras(provider) {
19956
20003
  }
19957
20004
  return isGatewayConfigRecord(raw) ? { ...raw } : {};
19958
20005
  }
19959
- return { max_tokens: 16384 };
20006
+ return { max_tokens: PROTOCOL_FALLBACK_MAX_TOKENS };
19960
20007
  }
19961
20008
  function resolveNativeAnthropicMessagesConfigFromGatewayConfig(cfg, options) {
19962
20009
  const slice = resolveProviderSliceFromGatewayConfig(cfg, {
@@ -22117,20 +22164,18 @@ function enqueueCompactMemoryDistill(agentId, artifact, cfg) {
22117
22164
  // src/project/project-context-prompt.ts
22118
22165
  init_current_project_context();
22119
22166
 
22120
- // src/mobile/context-compact/native-transcript-budget.ts
22167
+ // src/mobile/context-compact/context-budget-gate.ts
22121
22168
  init_native_reply_transcript();
22122
- init_transcript_media_sanitize();
22123
- var IMAGE_BLOCK_BUDGET_BYTES = 8 * 1024;
22124
22169
 
22125
22170
  // src/mobile/model-context-window-budget.ts
22126
22171
  var MIN_TRANSCRIPT_BUDGET_BYTES = 64 * 1024;
22127
- var DEFAULT_MAX_NATIVE_TRANSCRIPT_BUDGET_BYTES = 128 * 1024;
22172
+ var DEFAULT_TRANSCRIPT_BUDGET_BYTES = 512 * 1024;
22128
22173
  var HARD_MAX_TRANSCRIPT_BUDGET_BYTES = 4 * 1024 * 1024;
22129
22174
 
22130
22175
  // src/mobile/context-compact/context-budget-gate.ts
22131
22176
  function resolveContextBudgetSignalSource() {
22132
22177
  const raw = (process.env.XKZOOM_CONTEXT_BUDGET_SOURCE ?? "native").trim().toLowerCase();
22133
- if (raw === "legacy" || raw === "legacy" || raw === "jsonl") {
22178
+ if (raw === "legacy" || raw === "jsonl") {
22134
22179
  return "gateway-jsonl";
22135
22180
  }
22136
22181
  return "native-transcript";
@@ -23012,52 +23057,28 @@ function uniqueAppend(existing, incoming, max) {
23012
23057
  function normalizeEvidenceRefs(refs) {
23013
23058
  return uniqueAppend([], refs, 20);
23014
23059
  }
23015
- function hasRepeatedToolWithoutEvidence(events) {
23016
- const recent = events.filter((event) => event.kind === "tool").slice(-3);
23017
- if (recent.length < 3) {
23018
- return false;
23019
- }
23020
- const [first] = recent;
23021
- return recent.every(
23022
- (event) => event.kind === "tool" && event.toolName && event.toolName === first.toolName && event.toolArgsHash && event.toolArgsHash === first.toolArgsHash && event.newEvidence !== true
23023
- );
23024
- }
23025
- function hasRepeatedToolFailure(events) {
23026
- const recentFailures = events.filter((event) => event.kind === "tool" && event.outcome === "failed").slice(-3);
23027
- if (recentFailures.length < 3) {
23028
- return false;
23029
- }
23030
- const first = recentFailures[0];
23031
- return recentFailures.every(
23032
- (event) => event.toolName && event.toolName === first?.toolName && (!first?.toolArgsHash || event.toolArgsHash === first.toolArgsHash)
23033
- );
23034
- }
23035
- function hasRepeatedFailure(events) {
23036
- const recentFailures = events.filter((event) => event.kind === "failure").slice(-3);
23037
- if (recentFailures.length < 3) {
23038
- return false;
23039
- }
23040
- const firstSummary = recentFailures[0]?.summary.trim().toLowerCase();
23041
- return Boolean(firstSummary) && recentFailures.every((event) => event.summary.trim().toLowerCase() === firstSummary);
23042
- }
23043
- function evaluateLoopBreaker(events, at) {
23044
- if (hasRepeatedToolFailure(events)) {
23045
- return { tripped: true, reason: "repeated_tool_failure", at };
23046
- }
23047
- if (hasRepeatedToolWithoutEvidence(events)) {
23048
- return { tripped: true, reason: "repeated_tool_without_new_evidence", at };
23049
- }
23050
- if (hasRepeatedFailure(events)) {
23051
- return { tripped: true, reason: "repeated_failure", at };
23052
- }
23053
- return void 0;
23054
- }
23055
23060
  async function readRunLedger(taskId) {
23056
23061
  return readJsonFile(resolveRunLedgerPath(taskId));
23057
23062
  }
23058
23063
  async function readRunLedgerEvents(taskId, limit) {
23059
23064
  return readJsonLines(resolveRunLedgerEventLogPath(taskId), limit);
23060
23065
  }
23066
+ function readLegacyRunLedgerLoopMarker(ledger) {
23067
+ if (!ledger) return null;
23068
+ const marker = ledger.loopBreaker;
23069
+ if (!marker || typeof marker !== "object") return null;
23070
+ const record = marker;
23071
+ const reason = typeof record.reason === "string" ? record.reason.trim() : "";
23072
+ const at = typeof record.at === "string" ? record.at.trim() : "";
23073
+ return {
23074
+ tripped: record.tripped === true,
23075
+ reason: reason || "legacy_loop_marker",
23076
+ at: at || "unknown"
23077
+ };
23078
+ }
23079
+ function legacyRunLedgerLoopMarkerTripped(ledger) {
23080
+ return readLegacyRunLedgerLoopMarker(ledger)?.tripped === true;
23081
+ }
23061
23082
  async function updateRunLedger(input) {
23062
23083
  if (!input.taskId.trim()) {
23063
23084
  throw new Error("run_ledger.update requires taskId");
@@ -23111,12 +23132,7 @@ async function updateRunLedger(input) {
23111
23132
  openLoops,
23112
23133
  ...input.nextStep ? { nextStep: input.nextStep.trim() } : base.nextStep ? { nextStep: base.nextStep } : {}
23113
23134
  };
23114
- const loopBreaker = evaluateLoopBreaker(events, now);
23115
- if (loopBreaker) {
23116
- next.loopBreaker = loopBreaker;
23117
- } else if (base.loopBreaker?.tripped) {
23118
- next.loopBreaker = base.loopBreaker;
23119
- }
23135
+ delete next.loopBreaker;
23120
23136
  const logEntry = {
23121
23137
  schemaVersion: RUN_LEDGER_EVENT_SCHEMA_VERSION,
23122
23138
  taskId: input.taskId,
@@ -23142,8 +23158,9 @@ function formatRunLedgerBlock(ledger) {
23142
23158
  const failures = ledger.failures.slice(-5).map((failure) => `- ${failure}`);
23143
23159
  const artifacts = ledger.artifactRefs.slice(-6).map((artifact) => `- ${artifact}`);
23144
23160
  const loops = ledger.openLoops.slice(-6).map((loop) => `- ${loop}`);
23145
- const breaker = ledger.loopBreaker?.tripped ? `
23146
- Loop breaker: ${ledger.loopBreaker.reason} at ${ledger.loopBreaker.at}` : "";
23161
+ const legacyLoopMarker = readLegacyRunLedgerLoopMarker(ledger);
23162
+ const breaker = legacyLoopMarker?.tripped ? `
23163
+ Legacy loop marker (not a runtime blocker): ${legacyLoopMarker.reason} at ${legacyLoopMarker.at}` : "";
23147
23164
  return [
23148
23165
  "## Active Task Ledger",
23149
23166
  `Task: ${ledger.taskId}`,
@@ -25948,6 +25965,7 @@ var import_node_path47 = __toESM(require("path"));
25948
25965
  var import_node_crypto20 = require("crypto");
25949
25966
  var import_node_fs48 = require("fs");
25950
25967
  var import_node_path45 = __toESM(require("path"));
25968
+ init_delivery_verification();
25951
25969
  init_team_memory_runtime();
25952
25970
  init_memory_event();
25953
25971
  init_memory_consolidate();
@@ -25980,13 +25998,6 @@ function lastCheckpointAtMs(ledger) {
25980
25998
  }
25981
25999
  return parseIsoMs(ledger.createdAt);
25982
26000
  }
25983
- function hasCheckpointAfter(ledger, at) {
25984
- const atMs = parseIsoMs(at);
25985
- if (atMs === null) {
25986
- return false;
25987
- }
25988
- return ledger.events.some((event) => event.kind === "checkpoint" && (parseIsoMs(event.at) ?? 0) >= atMs);
25989
- }
25990
26001
  function evaluateRunLedgerCheckpoint(ledger, policy = {}, now = /* @__PURE__ */ new Date()) {
25991
26002
  const lastEvent = ledger.events.at(-1);
25992
26003
  const lastIdx = lastCheckpointIndex(ledger.events);
@@ -25998,14 +26009,6 @@ function evaluateRunLedgerCheckpoint(ledger, policy = {}, now = /* @__PURE__ */
25998
26009
  if (lastEvent?.kind === "checkpoint" || eventsSinceLastCheckpoint <= 0) {
25999
26010
  return { shouldCheckpoint: false, eventsSinceLastCheckpoint, msSinceLastCheckpoint };
26000
26011
  }
26001
- if (policy.forceOnLoopBreaker !== false && ledger.loopBreaker?.tripped && !hasCheckpointAfter(ledger, ledger.loopBreaker.at)) {
26002
- return {
26003
- shouldCheckpoint: true,
26004
- reason: "loop_breaker",
26005
- eventsSinceLastCheckpoint,
26006
- msSinceLastCheckpoint
26007
- };
26008
- }
26009
26012
  if (eventsSinceLastCheckpoint >= maxEvents) {
26010
26013
  return {
26011
26014
  shouldCheckpoint: true,
@@ -26072,15 +26075,6 @@ function stableNormalize(value, seen = /* @__PURE__ */ new WeakSet()) {
26072
26075
  function sha256Hex(value) {
26073
26076
  return (0, import_node_crypto18.createHash)("sha256").update(value).digest("hex");
26074
26077
  }
26075
- function lastNonCheckpointEvents(ledger, limit) {
26076
- return ledger.events.filter((event) => event.kind !== "checkpoint").slice(-limit);
26077
- }
26078
- function currentWouldRepeatNoEvidence(ledger, toolName, toolArgsHash) {
26079
- const recent = lastNonCheckpointEvents(ledger, 2);
26080
- return recent.length === 2 && recent.every(
26081
- (event) => event.kind === "tool" && event.toolName === toolName && event.toolArgsHash === toolArgsHash && event.newEvidence !== true
26082
- );
26083
- }
26084
26078
  function hasNewEvidence(outcome, resultContent) {
26085
26079
  return outcome === "ok" && typeof resultContent === "string" && resultContent.trim().length > 0;
26086
26080
  }
@@ -26097,55 +26091,6 @@ function deriveRunLedgerToolArgsHash(toolName, toolArgs) {
26097
26091
  async function assessLongRunToolCall(input) {
26098
26092
  const toolArgsHash = deriveRunLedgerToolArgsHash(input.toolName, input.toolArgs);
26099
26093
  const ledger = await readRunLedger(input.taskId);
26100
- if (ledger?.loopBreaker?.tripped) {
26101
- return {
26102
- allowed: false,
26103
- code: "RUN_LEDGER_LOOP_BREAKER",
26104
- reason: ledger.loopBreaker.reason,
26105
- detail: `RunLedger ${input.taskId} tripped loop breaker at ${ledger.loopBreaker.at}; checkpoint or change strategy before executing more tools.`,
26106
- toolArgsHash,
26107
- ledger,
26108
- checkpointed: false
26109
- };
26110
- }
26111
- if (ledger && currentWouldRepeatNoEvidence(ledger, input.toolName, toolArgsHash)) {
26112
- const updated = await updateRunLedger({
26113
- taskId: input.taskId,
26114
- agentId: input.agentId,
26115
- ...input.sessionId ? { sessionId: input.sessionId } : {},
26116
- ...input.teamId ? { teamId: input.teamId } : {},
26117
- goal: ledger.goal,
26118
- phase: "loop_breaker",
26119
- event: {
26120
- kind: "tool",
26121
- summary: `blocked repeated no-evidence tool call ${input.toolName}`,
26122
- toolName: input.toolName,
26123
- toolArgsHash,
26124
- outcome: "failed",
26125
- newEvidence: false,
26126
- evidenceRefs: input.evidenceRefs
26127
- },
26128
- artifactRefs: ledger.artifactRefs,
26129
- openLoops: [
26130
- ...ledger.openLoops,
26131
- `blocked repeated no-evidence tool call: ${input.toolName} args=${toolArgsHash}`
26132
- ],
26133
- nextStep: "Stop repeating the same tool arguments; inspect prior evidence, change strategy, or ask for clarification."
26134
- });
26135
- const checkpoint = await maybeCheckpointRunLedger({
26136
- ledger: updated,
26137
- policy: { forceOnLoopBreaker: true }
26138
- });
26139
- return {
26140
- allowed: false,
26141
- code: "RUN_LEDGER_REPEAT_TOOL_NO_EVIDENCE",
26142
- reason: "repeated_tool_without_new_evidence",
26143
- detail: `The previous two non-checkpoint ledger events already used ${input.toolName} with argsHash=${toolArgsHash} and no new evidence.`,
26144
- toolArgsHash,
26145
- ledger: checkpoint.ledger,
26146
- checkpointed: checkpoint.checkpointed
26147
- };
26148
- }
26149
26094
  return { allowed: true, toolArgsHash, ledger };
26150
26095
  }
26151
26096
  async function recordLongRunToolResult(input) {
@@ -26580,7 +26525,7 @@ async function evalProjectDetail(runId) {
26580
26525
  day: 2,
26581
26526
  category: "failure",
26582
26527
  query: "What Day 2 failure reason must be remembered for repeated tools?",
26583
- expected: "Day 2 failure shield: repeated same-tool no-evidence calls must trip RUN_LEDGER_REPEAT_TOOL_NO_EVIDENCE before another execution.",
26528
+ expected: "Day 2 failure shield: repeated same-tool no-evidence calls stay recorded in RunLedger, while maxTurns, prompt guidance, and is_error tool results steer recovery instead of a runtime blocker.",
26584
26529
  evidenceRef: "eval:project:day2:failure"
26585
26530
  },
26586
26531
  {
@@ -26814,6 +26759,53 @@ async function evalEvidenceTrace(runId) {
26814
26759
  }
26815
26760
  );
26816
26761
  }
26762
+ async function evalToolResultCompletionEvidence(_runId) {
26763
+ const verbalCompletionClaim = "\u5DF2\u5B8C\u6210\u4FEE\u6539\uFF0C\u5171\u5904\u7406 8 \u4E2A\u6587\u4EF6";
26764
+ const noToolResultVerification = assessDeliveryVerification(verbalCompletionClaim, []);
26765
+ const unrelatedSuccessToolCalls = [
26766
+ {
26767
+ toolCallId: "eval-agents-list-1",
26768
+ name: "agents_list",
26769
+ status: "success",
26770
+ result: JSON.stringify({ ok: true, data: [{ id: "dev" }] }),
26771
+ startedAt: "2026-01-01T00:00:00.000Z"
26772
+ }
26773
+ ];
26774
+ const unrelatedToolVerification = assessDeliveryVerification(verbalCompletionClaim, unrelatedSuccessToolCalls);
26775
+ const evidenceBackedToolCalls = [
26776
+ {
26777
+ toolCallId: "eval-write-1",
26778
+ name: "write",
26779
+ status: "success",
26780
+ args: { path: "docs/report.md" },
26781
+ result: JSON.stringify({
26782
+ ok: true,
26783
+ tool: "write",
26784
+ data: {
26785
+ path: "docs/report.md",
26786
+ bytesWritten: 128
26787
+ }
26788
+ }),
26789
+ startedAt: "2026-01-01T00:00:01.000Z"
26790
+ }
26791
+ ];
26792
+ const evidenceToolVerification = assessDeliveryVerification(verbalCompletionClaim, evidenceBackedToolCalls);
26793
+ return caseFromCheck(
26794
+ "tool-result-completion-evidence-boundary",
26795
+ "evidence_trace",
26796
+ noToolResultVerification === "unverified" && unrelatedToolVerification === "unverified" && evidenceToolVerification === "verified",
26797
+ "Verbal completion claims fail without matching tool_result evidence and pass only when an evidence-backed tool result is attached.",
26798
+ ["src/mobile/group/delivery-verification.ts", "eval:tool-result-completion-evidence"],
26799
+ {
26800
+ noToolResultVerification,
26801
+ unrelatedToolVerification,
26802
+ evidenceToolVerification,
26803
+ matchingToolResultCount: 0,
26804
+ unrelatedSuccessToolCount: unrelatedSuccessToolCalls.length,
26805
+ evidenceBackedToolCount: evidenceBackedToolCalls.length
26806
+ }
26807
+ );
26808
+ }
26817
26809
  async function evalTeamIsolation(runId, workspaceRoot) {
26818
26810
  const memberAgentIds = [
26819
26811
  `eval-agent-architect-${runId}`,
@@ -26956,7 +26948,7 @@ async function evalLongRun(runId) {
26956
26948
  evidenceRefs: ["eval:long-run:start"],
26957
26949
  newEvidence: true
26958
26950
  },
26959
- openLoops: ["verify checkpoint cadence", "verify idempotent side effects", "verify resume after loop breaker"],
26951
+ openLoops: ["verify checkpoint cadence", "verify idempotent side effects", "verify resume after repeated no-evidence telemetry"],
26960
26952
  nextStep: "Continue bounded multi-tool execution with durable ledger checkpoints."
26961
26953
  });
26962
26954
  for (let step = 0; step < totalSteps; step += 1) {
@@ -26967,7 +26959,7 @@ async function evalLongRun(runId) {
26967
26959
  shard: `shard-${step % 11}`,
26968
26960
  query: `memory-runtime-v2-long-run-${runId}-${step}`
26969
26961
  };
26970
- const guard = await assessLongRunToolCall({
26962
+ const guard2 = await assessLongRunToolCall({
26971
26963
  taskId,
26972
26964
  agentId,
26973
26965
  sessionId,
@@ -26975,15 +26967,6 @@ async function evalLongRun(runId) {
26975
26967
  toolArgs,
26976
26968
  evidenceRefs: [`eval:long-run:guard:${step}`]
26977
26969
  });
26978
- if (!guard.allowed) {
26979
- return failCase(
26980
- "long-run-7x24-recovery",
26981
- "long_run",
26982
- `Unexpected guard block during varied 7x24 run: ${guard.reason}`,
26983
- ["eval:long-run:unexpected-block"],
26984
- { step, guard }
26985
- );
26986
- }
26987
26970
  const result = await recordLongRunToolResult({
26988
26971
  taskId,
26989
26972
  agentId,
@@ -27045,13 +27028,13 @@ async function evalLongRun(runId) {
27045
27028
  evidenceRefs: [`eval:long-run:no-evidence:${i}`]
27046
27029
  });
27047
27030
  }
27048
- const blocked = await assessLongRunToolCall({
27031
+ const guard = await assessLongRunToolCall({
27049
27032
  taskId,
27050
27033
  agentId,
27051
27034
  sessionId,
27052
27035
  toolName: repeatedToolName,
27053
27036
  toolArgs: repeatedToolArgs,
27054
- evidenceRefs: ["eval:long-run:no-evidence:block"]
27037
+ evidenceRefs: ["eval:long-run:no-evidence:record"]
27055
27038
  });
27056
27039
  const resumedLedger = await readRunLedger(taskId);
27057
27040
  const eventLog = await readRunLedgerEvents(taskId);
@@ -27065,7 +27048,7 @@ async function evalLongRun(runId) {
27065
27048
  taskId,
27066
27049
  project: null,
27067
27050
  agentWorkspaceRoot: workspaceRootForLongRun(runId),
27068
- queryText: "resume after repeated no evidence loop breaker",
27051
+ queryText: "resume after repeated no-evidence telemetry without a runtime blocker",
27069
27052
  recentTurnsBlock: "Runtime resumes after a synthetic 7x24 tool loop without replaying the full event log.",
27070
27053
  budgetClass: "balanced"
27071
27054
  });
@@ -27074,13 +27057,14 @@ async function evalLongRun(runId) {
27074
27057
  const appendOnlyHasStart = eventLog.some((entry) => entry.event.summary.includes("Start synthetic 7x24"));
27075
27058
  const appendOnlyHasFinalStep = eventLog.some((entry) => entry.event.evidenceRefs.includes(`eval:long-run:step:${totalSteps - 1}`));
27076
27059
  const snapshotBounded = (resumedLedger?.events.length ?? Number.POSITIVE_INFINITY) <= 200;
27077
- const resumeContainsBreaker = renderedResume.includes("Loop breaker: repeated_tool_without_new_evidence") && renderedResume.includes("Stop repeating the same tool arguments");
27060
+ const resumeContainsRepeatedNoEvidence = renderedResume.includes("owned tool web_fetch outcome=inconclusive") || renderedResume.includes("same-empty-result");
27061
+ const legacyLoopMarkerTripped = legacyRunLedgerLoopMarkerTripped(resumedLedger);
27078
27062
  return caseFromCheck(
27079
27063
  "long-run-7x24-recovery",
27080
27064
  "long_run",
27081
- !blocked.allowed && blocked.code === "RUN_LEDGER_REPEAT_TOOL_NO_EVIDENCE" && blocked.checkpointed && checkpointCount >= 8 && checkpointEventCount >= checkpointCount && sideEffectExecuteCount === 1 && sideEffectReplayCount === 1 && snapshotBounded && eventLog.length > totalSteps && appendOnlyHasStart && appendOnlyHasFinalStep && recentEvents.at(-1)?.event.kind === "checkpoint" && resumedLedger?.loopBreaker?.reason === "repeated_tool_without_new_evidence" && resumeContainsBreaker,
27082
- "A 7x24 synthetic multi-tool run checkpoints durably, replays idempotent side effects, trips the loop breaker on repeated no-evidence calls, and resumes from bounded ledger state plus append-only event log.",
27083
- ["eval:long-run:start", `ledger:${taskId}`, "eval:long-run:idempotency:complete", "eval:long-run:no-evidence:block"],
27065
+ guard.allowed && checkpointCount >= 8 && checkpointEventCount >= checkpointCount && sideEffectExecuteCount === 1 && sideEffectReplayCount === 1 && snapshotBounded && eventLog.length > totalSteps && appendOnlyHasStart && appendOnlyHasFinalStep && recentEvents.at(-1)?.event.kind === "tool" && !legacyLoopMarkerTripped && resumeContainsRepeatedNoEvidence,
27066
+ "A 7x24 synthetic multi-tool run checkpoints durably, replays idempotent side effects, records repeated no-evidence calls without blocking execution, and resumes from bounded ledger state plus append-only event log.",
27067
+ ["eval:long-run:start", `ledger:${taskId}`, "eval:long-run:idempotency:complete", "eval:long-run:no-evidence:record"],
27084
27068
  {
27085
27069
  simulatedHours,
27086
27070
  totalToolSteps: totalSteps,
@@ -27090,13 +27074,12 @@ async function evalLongRun(runId) {
27090
27074
  checkpointEventCount,
27091
27075
  sideEffectExecuteCount,
27092
27076
  sideEffectReplayCount,
27093
- blockedCode: blocked.allowed ? null : blocked.code,
27094
- blockedReason: blocked.allowed ? null : blocked.reason,
27095
- blockedCheckpointed: blocked.allowed ? false : blocked.checkpointed,
27077
+ guardAllowed: guard.allowed,
27078
+ legacyLoopMarkerTripped,
27096
27079
  appendOnlyHasStart,
27097
27080
  appendOnlyHasFinalStep,
27098
27081
  latestRecentEventKind: recentEvents.at(-1)?.event.kind,
27099
- resumeContainsBreaker
27082
+ resumeContainsRepeatedNoEvidence
27100
27083
  }
27101
27084
  );
27102
27085
  }
@@ -27631,6 +27614,7 @@ async function runMemoryRuntimeV2SelfEval(input = {}) {
27631
27614
  evalContinuity,
27632
27615
  evalProjectDetail,
27633
27616
  evalEvidenceTrace,
27617
+ evalToolResultCompletionEvidence,
27634
27618
  evalTeamIsolation,
27635
27619
  evalLongRun,
27636
27620
  evalSideEffect,
@@ -28721,7 +28705,7 @@ function buildGates(input) {
28721
28705
  category: "long_run",
28722
28706
  title: "7x24 durable tool execution",
28723
28707
  status: casePassed(evalReport, "long_run") && casePassed(evalReport, "side_effect") ? "proven" : evalFailed ? "blocked" : "partial",
28724
- summary: "Long tasks must checkpoint, keep append-only event logs, replay idempotent side effects, and trip loop breakers on repeated no-evidence work.",
28708
+ summary: "Long tasks must checkpoint, keep append-only event logs, replay idempotent side effects, and preserve repeated no-evidence telemetry without blocking tool execution.",
28725
28709
  evidenceRefs: ["src/mobile/memory-runtime-v2/long-run-guard.ts", "src/mobile/memory-runtime-v2/tool-side-effect.ts", ...caseEvidence(evalReport, "long_run"), ...caseEvidence(evalReport, "side_effect")],
28726
28710
  blockers: evalFailed ? ["Latest long-run or side-effect eval did not pass."] : [],
28727
28711
  nextActions: casePassed(evalReport, "long_run") ? ["Add wall-clock soak and process-restart recovery evidence."] : ["Run the 7x24 synthetic long-run eval."]
@@ -30365,6 +30349,105 @@ function appendChainAbortNotice(stderr, command, exitCode) {
30365
30349
 
30366
30350
  ${notice}` : notice;
30367
30351
  }
30352
+ function extractProbeLeadingToken(command) {
30353
+ let cmd = command.trim();
30354
+ const psMatch = /^(?:powershell|pwsh)(?:\.exe)?\b[\s\S]*?\s-(?:c|command)\s+(.+)$/i.exec(cmd);
30355
+ if (psMatch?.[1]) {
30356
+ cmd = psMatch[1].trim().replace(/^["'&{}\s]+/, "");
30357
+ }
30358
+ const first = cmd.split(/[\s;|]+/, 1)[0] ?? "";
30359
+ return first.replace(/^["']+/, "").replace(/\.exe$/i, "").toLowerCase();
30360
+ }
30361
+ var PROBE_COMMAND_TOKENS = /* @__PURE__ */ new Set([
30362
+ "findstr",
30363
+ "find",
30364
+ "where",
30365
+ "grep",
30366
+ "rg",
30367
+ "egrep",
30368
+ "fgrep",
30369
+ "dir",
30370
+ "get-command",
30371
+ "get-childitem",
30372
+ "gci"
30373
+ ]);
30374
+ function execNonzeroIsBenignProbe(record) {
30375
+ if (record.exitCode !== 1) {
30376
+ return false;
30377
+ }
30378
+ if (String(record.stderr ?? "").trim()) {
30379
+ return false;
30380
+ }
30381
+ const token = extractProbeLeadingToken(record.command);
30382
+ if (PROBE_COMMAND_TOKENS.has(token)) {
30383
+ return true;
30384
+ }
30385
+ if (token === "pip" || token === "pip3") {
30386
+ return /\bpip3?\b[\s\S]*\b(show|index)\b/i.test(record.command);
30387
+ }
30388
+ return false;
30389
+ }
30390
+ function execExitZeroLooksInconclusive(record) {
30391
+ const stdout = String(record.stdout ?? "").trim();
30392
+ const stderr = String(record.stderr ?? "").trim();
30393
+ const psShellError = /CommandNotFoundException|无法将|is not recognized as an internal or external command/i.test(stderr);
30394
+ return !stdout && Boolean(stderr) || psShellError;
30395
+ }
30396
+ function classifyOwnedExecResultSemantic(result) {
30397
+ if (result.background === true) {
30398
+ return { isError: false, summary: "exec started (background)" };
30399
+ }
30400
+ const stdout = String(result.stdout ?? "").trim();
30401
+ const stderr = String(result.stderr ?? "").trim();
30402
+ if (result.exitCode === 0) {
30403
+ if (execExitZeroLooksInconclusive(result)) {
30404
+ return {
30405
+ isError: true,
30406
+ code: "EXEC_INCONCLUSIVE",
30407
+ error: "exec exit 0 but output inconclusive (stderr indicates shell failure)",
30408
+ detail: stderr || "empty stdout with stderr errors \u2014 not a verification"
30409
+ };
30410
+ }
30411
+ return {
30412
+ isError: false,
30413
+ summary: stdout ? `exit 0 \u2014 ${stdout.slice(0, 240)}` : "exit 0 (INCONCLUSIVE: empty stdout \u2014 exit 0 alone is not a verification)"
30414
+ };
30415
+ }
30416
+ if (execNonzeroIsBenignProbe(result)) {
30417
+ return {
30418
+ isError: false,
30419
+ summary: stdout ? `exit 1 (probe no match) \u2014 ${stdout.slice(0, 240)}` : "exit 1 (probe returned no match / not found \u2014 this is a valid empty result, not a command error)"
30420
+ };
30421
+ }
30422
+ if (result.exitCode === 124) {
30423
+ return {
30424
+ isError: true,
30425
+ code: "EXEC_TIMEOUT",
30426
+ error: `command timed out (exit ${result.exitCode})`,
30427
+ detail: stderr || stdout || void 0
30428
+ };
30429
+ }
30430
+ if (stderr.includes("[XKZOOM] command chain")) {
30431
+ return {
30432
+ isError: true,
30433
+ code: "EXEC_CHAIN_ABORT",
30434
+ error: `command chain aborted (exit ${result.exitCode})`,
30435
+ detail: stderr || stdout || void 0
30436
+ };
30437
+ }
30438
+ return {
30439
+ isError: true,
30440
+ code: "EXEC_NONZERO_EXIT",
30441
+ error: `command exited with code ${result.exitCode}`,
30442
+ detail: stderr || stdout || void 0
30443
+ };
30444
+ }
30445
+ function withOwnedExecSemantics(result) {
30446
+ return {
30447
+ ...result,
30448
+ semantic: result.semantic ?? classifyOwnedExecResultSemantic(result)
30449
+ };
30450
+ }
30368
30451
  function detectOutOfRootAbsolutePaths(command, root) {
30369
30452
  const rootAbs = path36.resolve(root);
30370
30453
  const out = [];
@@ -30389,7 +30472,7 @@ function readOwnedExecParams(params) {
30389
30472
  async function runOwnedExec(params) {
30390
30473
  const primitive = await runExecPrimitiveAction({ root: params.root, toolParams: params.toolParams });
30391
30474
  if (primitive) {
30392
- return primitive;
30475
+ return withOwnedExecSemantics(primitive);
30393
30476
  }
30394
30477
  const parsed = readOwnedExecParams(params.toolParams);
30395
30478
  if (!parsed.command?.trim()) throw new Error("command is required (or use action=route_smoke|npm_script)");
@@ -30444,7 +30527,7 @@ async function runOwnedExec(params) {
30444
30527
  spawnPty: params.spawnPty,
30445
30528
  now: params.now
30446
30529
  });
30447
- return {
30530
+ return withOwnedExecSemantics({
30448
30531
  command: effectiveCommand,
30449
30532
  cwd,
30450
30533
  activeRoot: rootAbs,
@@ -30455,7 +30538,7 @@ async function runOwnedExec(params) {
30455
30538
  sessionId: started.sessionId,
30456
30539
  ...started.pid !== void 0 ? { pid: started.pid } : {},
30457
30540
  ...warningList ? { warnings: warningList } : {}
30458
- };
30541
+ });
30459
30542
  }
30460
30543
  const timeoutSec = resolveForegroundExecTimeoutSec(effectiveCommand, parsed.timeoutSec);
30461
30544
  const timeoutMs = timeoutSec * 1e3;
@@ -30471,7 +30554,7 @@ async function runOwnedExec(params) {
30471
30554
  windowsHide: true,
30472
30555
  encoding: "utf8"
30473
30556
  });
30474
- return {
30557
+ return withOwnedExecSemantics({
30475
30558
  command: effectiveCommand,
30476
30559
  cwd,
30477
30560
  activeRoot: rootAbs,
@@ -30479,14 +30562,14 @@ async function runOwnedExec(params) {
30479
30562
  stdout: truncateCapture2(String(stdout ?? "")),
30480
30563
  stderr: truncateCapture2(String(stderr ?? "")),
30481
30564
  ...warningList ? { warnings: warningList } : {}
30482
- };
30565
+ });
30483
30566
  } catch (err) {
30484
30567
  const record = err;
30485
30568
  const exitCode = typeof record.code === "number" ? record.code : record.killed ? 124 : 1;
30486
30569
  const stderr = truncateCapture2(
30487
30570
  appendChainAbortNotice(String(record.stderr ?? ""), effectiveCommand, exitCode)
30488
30571
  );
30489
- return {
30572
+ return withOwnedExecSemantics({
30490
30573
  command: effectiveCommand,
30491
30574
  cwd,
30492
30575
  activeRoot: rootAbs,
@@ -30494,7 +30577,7 @@ async function runOwnedExec(params) {
30494
30577
  stdout: truncateCapture2(String(record.stdout ?? "")),
30495
30578
  stderr,
30496
30579
  ...warningList ? { warnings: warningList } : {}
30497
- };
30580
+ });
30498
30581
  }
30499
30582
  }
30500
30583
  var execTool = defineTool({
@@ -31175,8 +31258,12 @@ async function readOwnedMemoryFile(params) {
31175
31258
  const relPath = path38.relative(workspaceDir, absPath).replace(/\\/g, "/");
31176
31259
  const allowedWorkspace = relPath.length > 0 && !relPath.startsWith("..") && !path38.isAbsolute(relPath) && isMemoryPath(relPath);
31177
31260
  const allowedAdditional = allowedWorkspace ? false : await isAllowedAdditionalPath(workspaceDir, absPath, params.extraPaths);
31178
- if (!allowedWorkspace && !allowedAdditional) throw new Error("path required");
31179
- if (!absPath.endsWith(".md")) throw new Error("path required");
31261
+ if (!allowedWorkspace && !allowedAdditional) {
31262
+ throw new Error(
31263
+ "memory_get only reads MEMORY.md or memory/** \u2014 use read(scope=agent) for AGENTS.md/SOUL.md/USER.md."
31264
+ );
31265
+ }
31266
+ if (!absPath.endsWith(".md")) throw new Error("memory_get requires a .md path.");
31180
31267
  const stat4 = await statRegularFile(absPath);
31181
31268
  if (stat4.missing || !stat4.file) {
31182
31269
  return { text: "", path: relPath };
@@ -31203,7 +31290,7 @@ async function readOwnedMemoryFile(params) {
31203
31290
  }
31204
31291
  var memoryGetTool = defineTool({
31205
31292
  name: "memory_get",
31206
- doc: "Read a file from the agent's memory workspace (MEMORY.md, memory/**, USER.md).",
31293
+ doc: "Read a file from the agent's memory workspace (MEMORY.md or memory/**).",
31207
31294
  inputScope: "memory-workspace",
31208
31295
  properties: {
31209
31296
  path: { type: "string", description: "Memory file path, e.g. MEMORY.md or memory/notes/x.md." },
@@ -34321,6 +34408,9 @@ var skillsCreateTool = defineTool({
34321
34408
  }
34322
34409
  });
34323
34410
 
34411
+ // src/owned-tools/registry.ts
34412
+ init_internal_tool_names();
34413
+
34324
34414
  // src/owned-tools/lyrics-generate.ts
34325
34415
  init_tool_descriptor();
34326
34416
  init_workspace_fs();
@@ -35583,6 +35673,19 @@ var OWNED_TURN_TOOL_NAMES = OWNED_TURN_TOOLS.map((tool) => tool.name);
35583
35673
  function resolveOwnedToolNamesByTier(tier) {
35584
35674
  return OWNED_TURN_TOOL_CATALOG.filter((entry) => entry.routerTier === tier).map((entry) => entry.tool.name);
35585
35675
  }
35676
+ (() => {
35677
+ const derived = new Set(OWNED_INTERNAL_TOOL_CATALOG.map((entry) => entry.tool.name));
35678
+ for (const name of derived) {
35679
+ if (!OWNED_INTERNAL_TOOL_NAMES.has(name)) {
35680
+ throw new Error(`OWNED_INTERNAL_TOOL_NAMES missing internal tool: ${name}`);
35681
+ }
35682
+ }
35683
+ for (const name of OWNED_INTERNAL_TOOL_NAMES) {
35684
+ if (!derived.has(name)) {
35685
+ throw new Error(`OWNED_INTERNAL_TOOL_NAMES has stale internal tool: ${name}`);
35686
+ }
35687
+ }
35688
+ })();
35586
35689
 
35587
35690
  // src/owned-tools/router.ts
35588
35691
  var T1_OWNED_TOOL_NAMES = resolveOwnedToolNamesByTier("T1");
@@ -35687,6 +35790,40 @@ function classifyToolExecutionErrorMessage(message) {
35687
35790
  }
35688
35791
  return "EXEC_FAILED";
35689
35792
  }
35793
+ var OWNED_TOOL_RESULT_CODES = /* @__PURE__ */ new Set([
35794
+ "EMPTY_TOOL_INPUT",
35795
+ "PARTIAL_TOOL_INPUT",
35796
+ "UNPARSEABLE_TOOL_INPUT",
35797
+ "TOOL_NOT_AVAILABLE",
35798
+ "TOOL_CALL_GATE_DENIED",
35799
+ "VALIDATION_ERROR",
35800
+ "SIDE_EFFECT_PENDING",
35801
+ "SIDE_EFFECT_REPLAY_MISSING",
35802
+ "EXEC_FAILED",
35803
+ "EXEC_INCONCLUSIVE",
35804
+ "EXEC_NONZERO_EXIT",
35805
+ "EXEC_TIMEOUT",
35806
+ "EXEC_CHAIN_ABORT"
35807
+ ]);
35808
+ function readToolResultSemantic(record) {
35809
+ const raw = record.semantic;
35810
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
35811
+ return void 0;
35812
+ }
35813
+ const semantic = raw;
35814
+ if (typeof semantic.isError !== "boolean") {
35815
+ return void 0;
35816
+ }
35817
+ const rawCode = typeof semantic.code === "string" ? semantic.code : void 0;
35818
+ const code = rawCode && OWNED_TOOL_RESULT_CODES.has(rawCode) ? rawCode : void 0;
35819
+ return {
35820
+ isError: semantic.isError,
35821
+ ...typeof semantic.summary === "string" && semantic.summary.trim() ? { summary: semantic.summary.trim() } : {},
35822
+ ...code ? { code } : {},
35823
+ ...typeof semantic.error === "string" && semantic.error.trim() ? { error: semantic.error.trim() } : {},
35824
+ ...typeof semantic.detail === "string" && semantic.detail.trim() ? { detail: semantic.detail.trim() } : {}
35825
+ };
35826
+ }
35690
35827
  function inferOwnedToolResultIsError(content) {
35691
35828
  const trimmed = content.trim();
35692
35829
  if (!trimmed) {
@@ -35699,28 +35836,15 @@ function inferOwnedToolResultIsError(content) {
35699
35836
  return false;
35700
35837
  }
35701
35838
  }
35702
- function classifyExecFailureCode(record) {
35703
- const exitCode = typeof record.exitCode === "number" ? record.exitCode : 1;
35704
- const stderr = String(record.stderr ?? "");
35705
- if (exitCode === 124) {
35706
- return "EXEC_TIMEOUT";
35707
- }
35708
- if (stderr.includes("[XKZOOM] command chain")) {
35709
- return "EXEC_CHAIN_ABORT";
35710
- }
35711
- return "EXEC_NONZERO_EXIT";
35712
- }
35713
- function execExitZeroLooksInconclusive(record) {
35714
- const stdout = String(record.stdout ?? "").trim();
35715
- const stderr = String(record.stderr ?? "").trim();
35716
- const psShellError = /CommandNotFoundException|无法将|is not recognized as an internal or external command/i.test(stderr);
35717
- return !stdout && Boolean(stderr) || psShellError;
35718
- }
35719
35839
  function buildSuccessSummary(tool, data) {
35720
35840
  if (!data || typeof data !== "object" || Array.isArray(data)) {
35721
35841
  return void 0;
35722
35842
  }
35723
35843
  const record = data;
35844
+ const semantic = readToolResultSemantic(record);
35845
+ if (semantic?.summary) {
35846
+ return semantic.summary;
35847
+ }
35724
35848
  if (tool === "exec" && typeof record.exitCode === "number" && record.exitCode === 0) {
35725
35849
  if (record.background === true) {
35726
35850
  return "exec started (background)";
@@ -35769,29 +35893,26 @@ function normalizeOwnedToolExecuteOutcome(tool, result) {
35769
35893
  });
35770
35894
  return { envelope: envelope2, isError: true };
35771
35895
  }
35772
- if (tool === "exec" && typeof record.exitCode === "number" && record.exitCode === 0) {
35773
- if (execExitZeroLooksInconclusive(record)) {
35774
- const stderr = String(record.stderr ?? "").trim();
35896
+ const semantic = readToolResultSemantic(record);
35897
+ if (semantic) {
35898
+ if (semantic.isError) {
35775
35899
  const envelope2 = buildOwnedToolErrorEnvelope({
35776
35900
  tool,
35777
- code: "EXEC_NONZERO_EXIT",
35778
- error: "exec exit 0 but output inconclusive (stderr indicates shell failure)",
35779
- detail: stderr || "empty stdout with stderr errors \u2014 not a verification",
35901
+ code: semantic.code ?? "EXEC_FAILED",
35902
+ error: semantic.error ?? "tool execution failed",
35903
+ detail: semantic.detail,
35780
35904
  data: sanitized
35781
35905
  });
35782
35906
  return { envelope: envelope2, isError: true };
35783
35907
  }
35908
+ return { envelope: buildOwnedToolSuccessEnvelope(tool, sanitized), isError: false };
35784
35909
  }
35785
- if (typeof record.exitCode === "number" && record.exitCode !== 0) {
35786
- const stderr = String(record.stderr ?? "").trim();
35787
- const stdout = String(record.stdout ?? "").trim();
35788
- const code = tool === "exec" ? classifyExecFailureCode(record) : "EXEC_NONZERO_EXIT";
35789
- const error = code === "EXEC_TIMEOUT" ? `command timed out (exit ${record.exitCode})` : code === "EXEC_CHAIN_ABORT" ? `command chain aborted (exit ${record.exitCode})` : `command exited with code ${record.exitCode}`;
35910
+ if (tool === "exec" && typeof record.exitCode === "number") {
35790
35911
  const envelope2 = buildOwnedToolErrorEnvelope({
35791
35912
  tool,
35792
- code,
35793
- error,
35794
- detail: stderr || stdout || void 0,
35913
+ code: "EXEC_FAILED",
35914
+ error: "exec result missing semantic classification",
35915
+ detail: "exec.ts must attach semantic.isError before envelope normalization",
35795
35916
  data: sanitized
35796
35917
  });
35797
35918
  return { envelope: envelope2, isError: true };