reasonix 0.52.0 → 0.53.0

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 (143) hide show
  1. package/README.md +1 -0
  2. package/README.zh-CN.md +1 -0
  3. package/dashboard/dist/app.css +1 -1
  4. package/dashboard/dist/app.js +13 -13
  5. package/dashboard/dist/app.js.map +1 -1
  6. package/dist/cli/{acp-NEUYWGUU.js → acp-ABNDGEYC.js} +63 -30
  7. package/dist/cli/acp-ABNDGEYC.js.map +1 -0
  8. package/dist/cli/chat-377YZV56.js +49 -0
  9. package/dist/cli/{chunk-FY5UERSG.js → chunk-2WZT27GR.js} +9 -9
  10. package/dist/cli/{chunk-B4MOGWHW.js → chunk-4EHRIP5U.js} +7 -7
  11. package/dist/cli/chunk-4EHRIP5U.js.map +1 -0
  12. package/dist/cli/{chunk-RCC73DWQ.js → chunk-4SBXAHR6.js} +4 -4
  13. package/dist/cli/{chunk-5YLEKX2V.js → chunk-4V4TKQMB.js} +4 -4
  14. package/dist/cli/{chunk-5YLEKX2V.js.map → chunk-4V4TKQMB.js.map} +1 -1
  15. package/dist/cli/chunk-7ZO6H6ZK.js +54 -0
  16. package/dist/cli/chunk-7ZO6H6ZK.js.map +1 -0
  17. package/dist/cli/{chunk-3OXD5CBM.js → chunk-A6GSOADP.js} +17870 -16070
  18. package/dist/cli/chunk-A6GSOADP.js.map +1 -0
  19. package/dist/cli/{chunk-Z663GVUB.js → chunk-APOSDBAU.js} +3 -3
  20. package/dist/cli/{chunk-CTRM32BP.js → chunk-B5JISV5I.js} +2 -2
  21. package/dist/cli/{chunk-HNZ4727T.js → chunk-DFHI2MRB.js} +412 -152
  22. package/dist/cli/chunk-DFHI2MRB.js.map +1 -0
  23. package/dist/cli/{chunk-CGVW5W7N.js → chunk-EPIHGOM3.js} +14 -14
  24. package/dist/cli/{chunk-CGVW5W7N.js.map → chunk-EPIHGOM3.js.map} +1 -1
  25. package/dist/cli/{chunk-77JIQ7SL.js → chunk-EQFZIHKJ.js} +8 -8
  26. package/dist/cli/chunk-EQFZIHKJ.js.map +1 -0
  27. package/dist/cli/{chunk-XNMXVL6C.js → chunk-FB27YXPX.js} +2 -2
  28. package/dist/cli/{chunk-ARBGTNHM.js → chunk-FK7NXDRP.js} +2 -2
  29. package/dist/cli/{chunk-AOYUW3HR.js → chunk-GCNBIWK7.js} +22 -2
  30. package/dist/cli/chunk-GCNBIWK7.js.map +1 -0
  31. package/dist/cli/{chunk-XBYHNZ5Z.js → chunk-GMQVINZK.js} +13 -5
  32. package/dist/cli/chunk-GMQVINZK.js.map +1 -0
  33. package/dist/cli/{chunk-MVLPXZAA.js → chunk-GOASYYZ4.js} +43 -11
  34. package/dist/cli/{chunk-MVLPXZAA.js.map → chunk-GOASYYZ4.js.map} +1 -1
  35. package/dist/cli/{chunk-WPY7AFS6.js → chunk-I4SH5Z7S.js} +2 -2
  36. package/dist/cli/{chunk-MW64SQUE.js → chunk-J26XOB2T.js} +2 -2
  37. package/dist/cli/{chunk-DLTE4GBY.js → chunk-J4MYMBJ7.js} +3 -3
  38. package/dist/cli/{chunk-CFJY64UA.js → chunk-LRO63VNK.js} +2 -2
  39. package/dist/cli/{chunk-XUZHBQSM.js → chunk-MQJR7YQ2.js} +2 -2
  40. package/dist/cli/{chunk-CPCUMMSR.js → chunk-NVI4XPOQ.js} +3 -3
  41. package/dist/cli/{chunk-RHQOGG43.js → chunk-OHSVEXFF.js} +3 -3
  42. package/dist/cli/chunk-OHSVEXFF.js.map +1 -0
  43. package/dist/cli/{chunk-AMSK3ZLB.js → chunk-P5SUHDUQ.js} +2 -2
  44. package/dist/cli/{chunk-GFJJEW3Z.js → chunk-QSKDP3OS.js} +55 -5
  45. package/dist/cli/chunk-QSKDP3OS.js.map +1 -0
  46. package/dist/cli/{chunk-D6WRFR6V.js → chunk-R7JMQMLD.js} +6 -5
  47. package/dist/cli/chunk-R7JMQMLD.js.map +1 -0
  48. package/dist/cli/{chunk-VVPV5HU6.js → chunk-RRZIIMAF.js} +2 -2
  49. package/dist/cli/{chunk-GNRKXRRE.js → chunk-S3QII236.js} +369 -359
  50. package/dist/cli/{chunk-GNRKXRRE.js.map → chunk-S3QII236.js.map} +1 -1
  51. package/dist/cli/{chunk-HI6THNAZ.js → chunk-TGP7JGHN.js} +32 -14
  52. package/dist/cli/chunk-TGP7JGHN.js.map +1 -0
  53. package/dist/cli/{chunk-CLHMV6OL.js → chunk-U7G72DHQ.js} +83 -42
  54. package/dist/cli/chunk-U7G72DHQ.js.map +1 -0
  55. package/dist/cli/{chunk-OMNRXZNA.js → chunk-URAI4YRL.js} +2 -2
  56. package/dist/cli/{chunk-6QBUXA73.js → chunk-V4AXMN4X.js} +2 -2
  57. package/dist/cli/{chunk-2W4F3RIZ.js → chunk-XHP6NYOT.js} +3 -2
  58. package/dist/cli/{chunk-2W4F3RIZ.js.map → chunk-XHP6NYOT.js.map} +1 -1
  59. package/dist/cli/{code-WN6D4VZO.js → code-JPFZJYVW.js} +34 -34
  60. package/dist/cli/{commands-DHETOY7O.js → commands-IUL2CLKH.js} +4 -4
  61. package/dist/cli/{commit-BBUYAKZV.js → commit-JT7LYBTL.js} +3 -3
  62. package/dist/cli/{config-KV7VV5LG.js → config-T4RWI5NG.js} +6 -2
  63. package/dist/cli/{desktop-LJVXWXNF.js → desktop-AUBW2SLL.js} +122 -38
  64. package/dist/cli/desktop-AUBW2SLL.js.map +1 -0
  65. package/dist/cli/devtools-O5HOMAGZ.js +3 -0
  66. package/dist/cli/diff-NINZHUJR.js +165 -0
  67. package/dist/cli/diff-NINZHUJR.js.map +1 -0
  68. package/dist/cli/{doctor-GI5LOEZL.js → doctor-OMAYGY4F.js} +10 -10
  69. package/dist/cli/{events-LBKMLFM4.js → events-5IVFJ4H3.js} +5 -5
  70. package/dist/cli/index.js +38 -38
  71. package/dist/cli/{mcp-DKEJK5ND.js → mcp-ECGJACAP.js} +3 -3
  72. package/dist/cli/{mcp-browse-V7KWDY32.js → mcp-browse-NGEOHVJB.js} +15 -15
  73. package/dist/cli/mcp-browse-NGEOHVJB.js.map +1 -0
  74. package/dist/cli/{mcp-inspect-MTABNHVM.js → mcp-inspect-ZIMNRG7G.js} +5 -5
  75. package/dist/cli/{prompt-ATI7DKHF.js → prompt-JCC3A7AA.js} +5 -5
  76. package/dist/cli/{prune-sessions-YQQSZTZS.js → prune-sessions-TE4BJYO2.js} +4 -4
  77. package/dist/cli/{replay-ZJQ4I4CJ.js → replay-2UUTCRTG.js} +29 -29
  78. package/dist/cli/replay-2UUTCRTG.js.map +1 -0
  79. package/dist/cli/{run-HFPRNWJY.js → run-ABQYOPVM.js} +22 -22
  80. package/dist/cli/{server-UHKO2VVM.js → server-MPCXIW2O.js} +27 -25
  81. package/dist/cli/{server-UHKO2VVM.js.map → server-MPCXIW2O.js.map} +1 -1
  82. package/dist/cli/{sessions-IQEWWUH3.js → sessions-YBPRGIAF.js} +16 -16
  83. package/dist/cli/{setup-5BYKCL62.js → setup-A34LF2QE.js} +42 -42
  84. package/dist/cli/setup-A34LF2QE.js.map +1 -0
  85. package/dist/cli/{stats-OFCGOQMZ.js → stats-GKG5JZQX.js} +6 -6
  86. package/dist/cli/stats-GKG5JZQX.js.map +1 -0
  87. package/dist/cli/{version-EODUFAAI.js → version-JD6QSM4X.js} +16 -16
  88. package/dist/index.d.ts +36 -5
  89. package/dist/index.js +443 -73
  90. package/dist/index.js.map +1 -1
  91. package/package.json +7 -2
  92. package/dist/cli/acp-NEUYWGUU.js.map +0 -1
  93. package/dist/cli/chat-QA6IVFJD.js +0 -49
  94. package/dist/cli/chunk-3OXD5CBM.js.map +0 -1
  95. package/dist/cli/chunk-77JIQ7SL.js.map +0 -1
  96. package/dist/cli/chunk-AOYUW3HR.js.map +0 -1
  97. package/dist/cli/chunk-B4MOGWHW.js.map +0 -1
  98. package/dist/cli/chunk-CLHMV6OL.js.map +0 -1
  99. package/dist/cli/chunk-D6WRFR6V.js.map +0 -1
  100. package/dist/cli/chunk-GFJJEW3Z.js.map +0 -1
  101. package/dist/cli/chunk-HI6THNAZ.js.map +0 -1
  102. package/dist/cli/chunk-HNZ4727T.js.map +0 -1
  103. package/dist/cli/chunk-I3NE5S63.js +0 -54
  104. package/dist/cli/chunk-I3NE5S63.js.map +0 -1
  105. package/dist/cli/chunk-RHQOGG43.js.map +0 -1
  106. package/dist/cli/chunk-XBYHNZ5Z.js.map +0 -1
  107. package/dist/cli/desktop-LJVXWXNF.js.map +0 -1
  108. package/dist/cli/diff-2JHMQAHI.js +0 -165
  109. package/dist/cli/diff-2JHMQAHI.js.map +0 -1
  110. package/dist/cli/mcp-browse-V7KWDY32.js.map +0 -1
  111. package/dist/cli/replay-ZJQ4I4CJ.js.map +0 -1
  112. package/dist/cli/setup-5BYKCL62.js.map +0 -1
  113. /package/dist/cli/{chat-QA6IVFJD.js.map → chat-377YZV56.js.map} +0 -0
  114. /package/dist/cli/{chunk-FY5UERSG.js.map → chunk-2WZT27GR.js.map} +0 -0
  115. /package/dist/cli/{chunk-RCC73DWQ.js.map → chunk-4SBXAHR6.js.map} +0 -0
  116. /package/dist/cli/{chunk-Z663GVUB.js.map → chunk-APOSDBAU.js.map} +0 -0
  117. /package/dist/cli/{chunk-CTRM32BP.js.map → chunk-B5JISV5I.js.map} +0 -0
  118. /package/dist/cli/{chunk-XNMXVL6C.js.map → chunk-FB27YXPX.js.map} +0 -0
  119. /package/dist/cli/{chunk-ARBGTNHM.js.map → chunk-FK7NXDRP.js.map} +0 -0
  120. /package/dist/cli/{chunk-WPY7AFS6.js.map → chunk-I4SH5Z7S.js.map} +0 -0
  121. /package/dist/cli/{chunk-MW64SQUE.js.map → chunk-J26XOB2T.js.map} +0 -0
  122. /package/dist/cli/{chunk-DLTE4GBY.js.map → chunk-J4MYMBJ7.js.map} +0 -0
  123. /package/dist/cli/{chunk-CFJY64UA.js.map → chunk-LRO63VNK.js.map} +0 -0
  124. /package/dist/cli/{chunk-XUZHBQSM.js.map → chunk-MQJR7YQ2.js.map} +0 -0
  125. /package/dist/cli/{chunk-CPCUMMSR.js.map → chunk-NVI4XPOQ.js.map} +0 -0
  126. /package/dist/cli/{chunk-AMSK3ZLB.js.map → chunk-P5SUHDUQ.js.map} +0 -0
  127. /package/dist/cli/{chunk-VVPV5HU6.js.map → chunk-RRZIIMAF.js.map} +0 -0
  128. /package/dist/cli/{chunk-OMNRXZNA.js.map → chunk-URAI4YRL.js.map} +0 -0
  129. /package/dist/cli/{chunk-6QBUXA73.js.map → chunk-V4AXMN4X.js.map} +0 -0
  130. /package/dist/cli/{code-WN6D4VZO.js.map → code-JPFZJYVW.js.map} +0 -0
  131. /package/dist/cli/{commands-DHETOY7O.js.map → commands-IUL2CLKH.js.map} +0 -0
  132. /package/dist/cli/{commit-BBUYAKZV.js.map → commit-JT7LYBTL.js.map} +0 -0
  133. /package/dist/cli/{config-KV7VV5LG.js.map → config-T4RWI5NG.js.map} +0 -0
  134. /package/dist/cli/{doctor-GI5LOEZL.js.map → devtools-O5HOMAGZ.js.map} +0 -0
  135. /package/dist/cli/{prompt-ATI7DKHF.js.map → doctor-OMAYGY4F.js.map} +0 -0
  136. /package/dist/cli/{events-LBKMLFM4.js.map → events-5IVFJ4H3.js.map} +0 -0
  137. /package/dist/cli/{mcp-DKEJK5ND.js.map → mcp-ECGJACAP.js.map} +0 -0
  138. /package/dist/cli/{mcp-inspect-MTABNHVM.js.map → mcp-inspect-ZIMNRG7G.js.map} +0 -0
  139. /package/dist/cli/{stats-OFCGOQMZ.js.map → prompt-JCC3A7AA.js.map} +0 -0
  140. /package/dist/cli/{prune-sessions-YQQSZTZS.js.map → prune-sessions-TE4BJYO2.js.map} +0 -0
  141. /package/dist/cli/{run-HFPRNWJY.js.map → run-ABQYOPVM.js.map} +0 -0
  142. /package/dist/cli/{sessions-IQEWWUH3.js.map → sessions-YBPRGIAF.js.map} +0 -0
  143. /package/dist/cli/{version-EODUFAAI.js.map → version-JD6QSM4X.js.map} +0 -0
@@ -3,22 +3,22 @@ import { createRequire as __cr } from 'node:module'; if (typeof globalThis.requi
3
3
  import {
4
4
  collectMemoryEntriesForWorkspace,
5
5
  readMemoryEntryDetail
6
- } from "./chunk-CTRM32BP.js";
6
+ } from "./chunk-B5JISV5I.js";
7
7
  import {
8
8
  QQChannel,
9
9
  createMcpRuntime
10
- } from "./chunk-MVLPXZAA.js";
10
+ } from "./chunk-GOASYYZ4.js";
11
11
  import {
12
12
  applyPlanMode,
13
13
  buildCodeToolset
14
- } from "./chunk-FY5UERSG.js";
15
- import "./chunk-OMNRXZNA.js";
14
+ } from "./chunk-2WZT27GR.js";
15
+ import "./chunk-URAI4YRL.js";
16
16
  import {
17
17
  Eventizer,
18
18
  autoResolveVerdict
19
- } from "./chunk-XBYHNZ5Z.js";
20
- import "./chunk-CFJY64UA.js";
21
- import "./chunk-XUZHBQSM.js";
19
+ } from "./chunk-GMQVINZK.js";
20
+ import "./chunk-LRO63VNK.js";
21
+ import "./chunk-MQJR7YQ2.js";
22
22
  import {
23
23
  CacheFirstLoop,
24
24
  ImmutablePrefix,
@@ -26,27 +26,38 @@ import {
26
26
  listFilesWithStatsAsync,
27
27
  parseAtQuery,
28
28
  rankPickerCandidates
29
- } from "./chunk-HNZ4727T.js";
30
- import "./chunk-MW64SQUE.js";
31
- import "./chunk-D6WRFR6V.js";
32
- import "./chunk-RCC73DWQ.js";
29
+ } from "./chunk-DFHI2MRB.js";
30
+ import "./chunk-4SBXAHR6.js";
31
+ import "./chunk-J26XOB2T.js";
32
+ import "./chunk-R7JMQMLD.js";
33
33
  import {
34
34
  pauseGate,
35
35
  toApprovalPrompt
36
- } from "./chunk-5YLEKX2V.js";
36
+ } from "./chunk-4V4TKQMB.js";
37
+ import "./chunk-FK7NXDRP.js";
38
+ import "./chunk-V4AXMN4X.js";
37
39
  import {
38
40
  codeSystemPrompt
39
- } from "./chunk-2W4F3RIZ.js";
41
+ } from "./chunk-XHP6NYOT.js";
40
42
  import {
41
43
  SkillStore
42
- } from "./chunk-DLTE4GBY.js";
44
+ } from "./chunk-J4MYMBJ7.js";
43
45
  import "./chunk-PLHAZOLZ.js";
44
46
  import "./chunk-L3VPEESB.js";
45
- import "./chunk-WPY7AFS6.js";
47
+ import "./chunk-I4SH5Z7S.js";
46
48
  import {
47
49
  countTokensBounded
48
50
  } from "./chunk-BOWSNGQC.js";
49
- import "./chunk-CPCUMMSR.js";
51
+ import {
52
+ DeepSeekClient,
53
+ pickPrimaryBalance
54
+ } from "./chunk-QSKDP3OS.js";
55
+ import "./chunk-25T6CVUP.js";
56
+ import {
57
+ formatHookOutcomeMessage,
58
+ loadHooks,
59
+ runHooks
60
+ } from "./chunk-NVI4XPOQ.js";
50
61
  import "./chunk-6UNHNVJR.js";
51
62
  import {
52
63
  deleteSession,
@@ -60,21 +71,14 @@ import {
60
71
  sessionPath,
61
72
  sessionsDir,
62
73
  timestampSuffix
63
- } from "./chunk-AMSK3ZLB.js";
74
+ } from "./chunk-P5SUHDUQ.js";
64
75
  import {
65
76
  VERSION
66
77
  } from "./chunk-XXC2BYTV.js";
67
- import {
68
- DeepSeekClient,
69
- pickPrimaryBalance
70
- } from "./chunk-GFJJEW3Z.js";
71
- import "./chunk-25T6CVUP.js";
72
78
  import {
73
79
  loadDotenv
74
80
  } from "./chunk-2UQP6H6T.js";
75
- import "./chunk-ARBGTNHM.js";
76
- import "./chunk-6QBUXA73.js";
77
- import "./chunk-CLHMV6OL.js";
81
+ import "./chunk-U7G72DHQ.js";
78
82
  import {
79
83
  DEFAULT_MODEL,
80
84
  bridgeEndpointEnv,
@@ -82,6 +86,7 @@ import {
82
86
  isPlausibleKey,
83
87
  isReasoningEffort,
84
88
  loadApiKey,
89
+ loadBraveApiKey,
85
90
  loadDesktopOpenTabs,
86
91
  loadEditMode,
87
92
  loadEditor,
@@ -89,6 +94,7 @@ import {
89
94
  loadExaApiKey,
90
95
  loadMetasoApiKey,
91
96
  loadModel,
97
+ loadOllamaApiKey,
92
98
  loadPerplexityApiKey,
93
99
  loadQQConfig,
94
100
  loadReasoningEffort,
@@ -114,7 +120,7 @@ import {
114
120
  saveWorkspaceDir,
115
121
  webSearchEngine,
116
122
  writeConfig
117
- } from "./chunk-AOYUW3HR.js";
123
+ } from "./chunk-GCNBIWK7.js";
118
124
  import "./chunk-TUK7OWJA.js";
119
125
 
120
126
  // src/cli/commands/desktop.ts
@@ -636,6 +642,9 @@ function oneLine(text, max) {
636
642
  }
637
643
 
638
644
  // src/cli/commands/desktop.ts
645
+ function desktopUserAbortLoopOptions() {
646
+ return void 0;
647
+ }
639
648
  var desktopQqRuntimeSnapshot = {
640
649
  runtimeState: "disconnected"
641
650
  };
@@ -763,7 +772,9 @@ function collectWebSearchApiKeyPrefixes() {
763
772
  metaso: maskApiKey(loadMetasoApiKey()),
764
773
  tavily: maskApiKey(loadTavilyApiKey()),
765
774
  perplexity: maskApiKey(loadPerplexityApiKey()),
766
- exa: maskApiKey(loadExaApiKey())
775
+ exa: maskApiKey(loadExaApiKey()),
776
+ ollama: maskApiKey(loadOllamaApiKey()),
777
+ brave: maskApiKey(loadBraveApiKey())
767
778
  };
768
779
  }
769
780
  function emitSettings(tab) {
@@ -811,12 +822,19 @@ async function emitBalance(tab) {
811
822
  if (!bal) return;
812
823
  const primary = pickPrimaryBalance(bal.balance_infos);
813
824
  if (!primary) return;
825
+ const balanceInfos = bal.balance_infos.map((info) => ({
826
+ currency: info.currency,
827
+ total: Number(info.total_balance),
828
+ granted: info.granted_balance ? Number(info.granted_balance) : void 0,
829
+ toppedUp: info.topped_up_balance ? Number(info.topped_up_balance) : void 0
830
+ }));
814
831
  emit(
815
832
  {
816
833
  type: "$balance",
817
834
  currency: primary.currency,
818
835
  total: Number(primary.total_balance),
819
- isAvailable: bal.is_available
836
+ isAvailable: bal.is_available,
837
+ balanceInfos
820
838
  },
821
839
  tab.id
822
840
  );
@@ -872,6 +890,7 @@ function loadSessionIntoTab(tab, name, actions) {
872
890
  },
873
891
  tab.id
874
892
  );
893
+ emitCtxBreakdown(tab);
875
894
  if (backfilledWorkspace) emitSessions(tab);
876
895
  }
877
896
  function summarizeMcpSpec(raw) {
@@ -925,15 +944,29 @@ function emitMemory(tab) {
925
944
  emit({ type: "$error", message: `memory_get failed: ${err.message}` }, tab.id);
926
945
  }
927
946
  }
947
+ function countTokensForMeter(text) {
948
+ try {
949
+ return countTokensBounded(text);
950
+ } catch {
951
+ return text.length === 0 ? 0 : Math.max(1, Math.ceil(text.length * 0.3));
952
+ }
953
+ }
928
954
  function emitCtxBreakdown(tab) {
929
955
  if (!tab.runtime) return;
956
+ const sys = countTokensForMeter(tab.runtime.loop.prefix.system);
957
+ const tools = countTokensForMeter(JSON.stringify(tab.runtime.loop.prefix.toolSpecs));
958
+ let logTokens = 0;
930
959
  try {
931
- const sys = countTokensBounded(tab.runtime.loop.prefix.system);
932
- const tools = countTokensBounded(JSON.stringify(tab.runtime.loop.prefix.toolSpecs));
933
- const logTokens = tab.runtime.loop.getCurrentLogTokens();
934
- emit({ type: "$ctx_breakdown", reservedTokens: sys + tools, logTokens }, tab.id);
960
+ logTokens = tab.runtime.loop.getCurrentLogTokens();
935
961
  } catch {
962
+ for (const msg of tab.runtime.loop.log.toMessages()) {
963
+ logTokens += countTokensForMeter(typeof msg.content === "string" ? msg.content : "");
964
+ if (msg.role === "assistant" && Array.isArray(msg.tool_calls) && msg.tool_calls.length > 0) {
965
+ logTokens += countTokensForMeter(JSON.stringify(msg.tool_calls));
966
+ }
967
+ }
936
968
  }
969
+ emit({ type: "$ctx_breakdown", reservedTokens: sys + tools, logTokens }, tab.id);
937
970
  }
938
971
  function emitSkills(tab) {
939
972
  try {
@@ -983,7 +1016,9 @@ function buildRuntimeFor(tab) {
983
1016
  model: tab.currentModel,
984
1017
  budgetUsd: tab.budgetUsd,
985
1018
  session: tab.currentSession,
986
- reasoningEffort
1019
+ reasoningEffort,
1020
+ hooks: tab.hooks,
1021
+ hookCwd: tab.rootDir
987
1022
  });
988
1023
  const eventizer = new Eventizer();
989
1024
  const ctx = { model: tab.currentModel, prefixHash: prefix.fingerprint, reasoningEffort };
@@ -1423,7 +1458,8 @@ ${optionsList}${p.allowCustom ? "\n\n(You can also reply with custom text.)" : "
1423
1458
  planTotalSteps: 0,
1424
1459
  mcpRuntime: null,
1425
1460
  mcpStatuses: /* @__PURE__ */ new Map(),
1426
- switching: false
1461
+ switching: false,
1462
+ hooks: loadHooks({ projectRoot: dir })
1427
1463
  };
1428
1464
  tab.currentSession = mintSessionFor(dir);
1429
1465
  tabs.set(tab.id, tab);
@@ -1542,13 +1578,37 @@ ${optionsList}${p.allowCustom ? "\n\n(You can also reply with custom text.)" : "
1542
1578
  }
1543
1579
  }
1544
1580
  }
1581
+ if (tab.hooks.some((h) => h.event === "UserPromptSubmit")) {
1582
+ const report = await runHooks({
1583
+ hooks: tab.hooks,
1584
+ payload: { event: "UserPromptSubmit", cwd: tab.rootDir, prompt: text }
1585
+ });
1586
+ for (const o of report.outcomes) {
1587
+ if (o.decision === "pass") continue;
1588
+ emit({ type: "$error", message: formatHookOutcomeMessage(o) }, tab.id);
1589
+ }
1590
+ if (report.blocked) {
1591
+ tab.aborter = null;
1592
+ emit({ type: "$turn_complete" }, tab.id);
1593
+ if (fromQQ) markQQTurnFinished(qqRuntime.routing, tab.id);
1594
+ return;
1595
+ }
1596
+ }
1545
1597
  await tabContext.run(tab.id, async () => {
1546
1598
  try {
1599
+ let emittedTurnContext = false;
1547
1600
  for await (const ev of rt.loop.step(text)) {
1601
+ if (!emittedTurnContext) {
1602
+ emittedTurnContext = true;
1603
+ emitCtxBreakdown(tab);
1604
+ }
1548
1605
  if (ev.role === "assistant_final" && ev.content) {
1549
1606
  lastAssistantText = ev.content;
1550
1607
  }
1551
1608
  for (const kev of rt.eventizer.consume(ev, rt.ctx)) emit(kev, tab.id);
1609
+ if (ev.role === "assistant_final" || ev.role === "tool") {
1610
+ emitCtxBreakdown(tab);
1611
+ }
1552
1612
  if (ev.role === "tool" && (ev.toolName === "remember" || ev.toolName === "forget")) {
1553
1613
  emitMemory(tab);
1554
1614
  }
@@ -1575,6 +1635,21 @@ ${optionsList}${p.allowCustom ? "\n\n(You can also reply with custom text.)" : "
1575
1635
  }
1576
1636
  emitSessions(tab);
1577
1637
  void emitBalance(tab);
1638
+ if (tab.hooks.some((h) => h.event === "Stop")) {
1639
+ const stopReport = await runHooks({
1640
+ hooks: tab.hooks,
1641
+ payload: {
1642
+ event: "Stop",
1643
+ cwd: tab.rootDir,
1644
+ lastAssistantText,
1645
+ turn: rt.loop.stats.summary().turns
1646
+ }
1647
+ });
1648
+ for (const o of stopReport.outcomes) {
1649
+ if (o.decision === "pass") continue;
1650
+ emit({ type: "$error", message: formatHookOutcomeMessage(o) }, tab.id);
1651
+ }
1652
+ }
1578
1653
  }
1579
1654
  if (fromQQ) markQQTurnFinished(qqRuntime.routing, tab.id);
1580
1655
  tab.switching = false;
@@ -1606,6 +1681,7 @@ ${optionsList}${p.allowCustom ? "\n\n(You can also reply with custom text.)" : "
1606
1681
  tab.symbolIndex = null;
1607
1682
  tab.symbolBuilding = null;
1608
1683
  tab.recentMentions.length = 0;
1684
+ tab.hooks = loadHooks({ projectRoot: target });
1609
1685
  tab.currentSession = mintSessionFor(target);
1610
1686
  tab.toolset = await buildCodeToolset({
1611
1687
  rootDir: target,
@@ -1630,7 +1706,7 @@ ${optionsList}${p.allowCustom ? "\n\n(You can also reply with custom text.)" : "
1630
1706
  }
1631
1707
  function abortTurn(tab, opts2 = {}) {
1632
1708
  tab.aborter?.abort();
1633
- tab.runtime?.loop.abort(opts2.discardCurrentTurn ? { discardCurrentTurn: true } : void 0);
1709
+ tab.runtime?.loop.abort(opts2);
1634
1710
  }
1635
1711
  function tabSessionLabel(tab) {
1636
1712
  if (tab.currentSession) {
@@ -2075,6 +2151,7 @@ ${optionsList}${p.allowCustom ? "\n\n(You can also reply with custom text.)" : "
2075
2151
  } catch {
2076
2152
  }
2077
2153
  }
2154
+ emitCtxBreakdown(t);
2078
2155
  }
2079
2156
  return;
2080
2157
  }
@@ -2099,7 +2176,7 @@ ${optionsList}${p.allowCustom ? "\n\n(You can also reply with custom text.)" : "
2099
2176
  return;
2100
2177
  }
2101
2178
  if (msg.cmd === "abort") {
2102
- abortTurn(tab, { discardCurrentTurn: true });
2179
+ abortTurn(tab, desktopUserAbortLoopOptions());
2103
2180
  cancelPendingGates(tab);
2104
2181
  return;
2105
2182
  }
@@ -2338,7 +2415,7 @@ ${found.body}${argsLine}`;
2338
2415
  }
2339
2416
  if (msg.editor !== void 0) saveEditor(msg.editor);
2340
2417
  if (msg.showSystemEvents !== void 0) saveShowSystemEvents(msg.showSystemEvents);
2341
- if (msg.webSearchEngine !== void 0 || msg.webSearchEndpoint !== void 0 || msg.metasoApiKey !== void 0 || msg.tavilyApiKey !== void 0 || msg.perplexityApiKey !== void 0 || msg.exaApiKey !== void 0) {
2418
+ if (msg.webSearchEngine !== void 0 || msg.webSearchEndpoint !== void 0 || msg.metasoApiKey !== void 0 || msg.tavilyApiKey !== void 0 || msg.perplexityApiKey !== void 0 || msg.exaApiKey !== void 0 || msg.ollamaApiKey !== void 0 || msg.braveApiKey !== void 0) {
2342
2419
  const cfg = readConfig();
2343
2420
  if (msg.webSearchEngine !== void 0) cfg.webSearchEngine = msg.webSearchEngine;
2344
2421
  if (msg.webSearchEndpoint !== void 0) {
@@ -2356,6 +2433,12 @@ ${found.body}${argsLine}`;
2356
2433
  if (msg.exaApiKey !== void 0) {
2357
2434
  cfg.exaApiKey = msg.exaApiKey?.trim() || void 0;
2358
2435
  }
2436
+ if (msg.ollamaApiKey !== void 0) {
2437
+ cfg.ollamaApiKey = msg.ollamaApiKey?.trim() || void 0;
2438
+ }
2439
+ if (msg.braveApiKey !== void 0) {
2440
+ cfg.braveApiKey = msg.braveApiKey?.trim() || void 0;
2441
+ }
2359
2442
  writeConfig(cfg);
2360
2443
  }
2361
2444
  if (msg.subagentModels !== void 0) {
@@ -2608,8 +2691,9 @@ ${found.body}${argsLine}`;
2608
2691
  export {
2609
2692
  buildLoadedMessages,
2610
2693
  desktopCommand,
2694
+ desktopUserAbortLoopOptions,
2611
2695
  installDesktopCrashGuards,
2612
2696
  normalizeSessionTitle,
2613
2697
  writeAllSync
2614
2698
  };
2615
- //# sourceMappingURL=desktop-LJVXWXNF.js.map
2699
+ //# sourceMappingURL=desktop-AUBW2SLL.js.map