reasonix 0.43.0 → 0.44.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 (169) hide show
  1. package/README.md +49 -11
  2. package/README.zh-CN.md +35 -7
  3. package/dashboard/app.css +225 -4
  4. package/dashboard/dist/app.js +6441 -6080
  5. package/dashboard/dist/app.js.map +1 -1
  6. package/data/deepseek-tokenizer.json.gz +0 -0
  7. package/dist/cli/{acp-DAGPCVFZ.js → acp-TYZ2CTDL.js} +28 -30
  8. package/dist/cli/acp-TYZ2CTDL.js.map +1 -0
  9. package/dist/cli/chat-TH7VNNCJ.js +51 -0
  10. package/dist/cli/chunk-2425HK6U.js +0 -0
  11. package/dist/cli/chunk-25T6CVUP.js +0 -0
  12. package/dist/cli/chunk-2UQP6H6T.js +0 -0
  13. package/dist/cli/{chunk-3Z6IBU3D.js → chunk-2V6EAEUW.js} +95 -31
  14. package/dist/cli/chunk-2V6EAEUW.js.map +1 -0
  15. package/dist/cli/{chunk-XCGGEJTI.js → chunk-4CTDEJUF.js} +2 -2
  16. package/dist/cli/chunk-4QUNBQQ2.js +0 -0
  17. package/dist/cli/{chunk-74EX7SUH.js → chunk-5QCB62C4.js} +33 -7
  18. package/dist/cli/{chunk-74EX7SUH.js.map → chunk-5QCB62C4.js.map} +1 -1
  19. package/dist/cli/chunk-6OWJV3YW.js +390 -0
  20. package/dist/cli/chunk-6OWJV3YW.js.map +1 -0
  21. package/dist/cli/chunk-6PBZN4VI.js +0 -0
  22. package/dist/cli/{chunk-7O5ALB4C.js → chunk-7CIGMZT3.js} +2 -2
  23. package/dist/cli/{chunk-H6PS7IUE.js → chunk-7UCMM425.js} +7 -3
  24. package/dist/cli/chunk-7UCMM425.js.map +1 -0
  25. package/dist/cli/{chunk-TJX6BFZZ.js → chunk-AB2RED3C.js} +3 -3
  26. package/dist/cli/{chunk-XPDVG52A.js → chunk-AVFXO2EZ.js} +361 -13
  27. package/dist/cli/chunk-AVFXO2EZ.js.map +1 -0
  28. package/dist/cli/{chunk-FHOGSSCH.js → chunk-C53JQES5.js} +3 -3
  29. package/dist/cli/{chunk-RE4RAVFF.js → chunk-CGDR2ELH.js} +92 -30
  30. package/dist/cli/chunk-CGDR2ELH.js.map +1 -0
  31. package/dist/cli/{chunk-OSZC7C6F.js → chunk-CWZKQ5FE.js} +7 -4
  32. package/dist/cli/chunk-CWZKQ5FE.js.map +1 -0
  33. package/dist/cli/{devtools-YECO25QO.js → chunk-FEZK652I.js} +10 -85
  34. package/dist/cli/chunk-FEZK652I.js.map +1 -0
  35. package/dist/cli/{chunk-45U62RI3.js → chunk-HNXDZGC6.js} +104 -2
  36. package/dist/cli/chunk-HNXDZGC6.js.map +1 -0
  37. package/dist/cli/chunk-J5XJHLWM.js +0 -0
  38. package/dist/cli/chunk-JMBMLOBP.js +0 -0
  39. package/dist/cli/{chunk-5JJRUIPA.js → chunk-JNAQYELD.js} +16 -8
  40. package/dist/cli/{chunk-5JJRUIPA.js.map → chunk-JNAQYELD.js.map} +1 -1
  41. package/dist/cli/{chunk-YFGF5NKA.js → chunk-KGBG6M2X.js} +19 -15
  42. package/dist/cli/chunk-KGBG6M2X.js.map +1 -0
  43. package/dist/cli/{chunk-3BXRZFWS.js → chunk-KLQTAZIY.js} +12 -4
  44. package/dist/cli/chunk-KLQTAZIY.js.map +1 -0
  45. package/dist/cli/{chunk-VK5HG73G.js → chunk-KM465GST.js} +9 -9
  46. package/dist/cli/{chunk-DOYHN4KB.js → chunk-LIR2HBQH.js} +2 -2
  47. package/dist/cli/{chunk-YYQAUTTN.js → chunk-MJ6W5UN3.js} +2 -2
  48. package/dist/cli/{chunk-6PZ3CXBP.js → chunk-MRHHQJAQ.js} +5 -4
  49. package/dist/cli/chunk-MRHHQJAQ.js.map +1 -0
  50. package/dist/cli/{chunk-PQXPXJBJ.js → chunk-NVURFF27.js} +16 -5
  51. package/dist/cli/chunk-NVURFF27.js.map +1 -0
  52. package/dist/cli/{chunk-2R4QCDOZ.js → chunk-OPFUUYHL.js} +540 -287
  53. package/dist/cli/chunk-OPFUUYHL.js.map +1 -0
  54. package/dist/cli/chunk-PLHAZOLZ.js +0 -0
  55. package/dist/cli/{chunk-HFEAY5DT.js → chunk-R3CTO2HM.js} +2 -2
  56. package/dist/cli/{chunk-O52OLQL3.js → chunk-RDRC3XDT.js} +136 -38
  57. package/dist/cli/chunk-RDRC3XDT.js.map +1 -0
  58. package/dist/cli/chunk-S4XVGLRW.js +0 -0
  59. package/dist/cli/chunk-SZ5XES2N.js +0 -0
  60. package/dist/cli/{chunk-2K65GZBT.js → chunk-TEUDEGX2.js} +64 -19
  61. package/dist/cli/chunk-TEUDEGX2.js.map +1 -0
  62. package/dist/cli/{chunk-2Z35JOA4.js → chunk-TKVXTQ3T.js} +4 -4
  63. package/dist/cli/{chunk-2Z35JOA4.js.map → chunk-TKVXTQ3T.js.map} +1 -1
  64. package/dist/cli/chunk-TUK7OWJA.js +0 -0
  65. package/dist/cli/{chunk-32TIKD5U.js → chunk-TXJMRPIL.js} +3 -3
  66. package/dist/cli/{chunk-2KDUS647.js → chunk-V26WPN3J.js} +7 -4
  67. package/dist/cli/chunk-V26WPN3J.js.map +1 -0
  68. package/dist/cli/{chunk-F3PXYSNN.js → chunk-WK3UFQY3.js} +2 -2
  69. package/dist/cli/{chunk-6G3CUUFG.js → chunk-X53B3JIX.js} +3 -3
  70. package/dist/cli/{chunk-6G3CUUFG.js.map → chunk-X53B3JIX.js.map} +1 -1
  71. package/dist/cli/chunk-XJXDHAES.js +0 -0
  72. package/dist/cli/{chunk-6AK4EY3D.js → chunk-XSU4QVFW.js} +1 -81
  73. package/dist/cli/chunk-XSU4QVFW.js.map +1 -0
  74. package/dist/cli/chunk-XXC2BYTV.js +0 -0
  75. package/dist/cli/{chunk-P7EKE5ZQ.js → chunk-Z4S7EYXG.js} +4482 -1310
  76. package/dist/cli/chunk-Z4S7EYXG.js.map +1 -0
  77. package/dist/cli/chunk-ZZM6QJ4W.js +0 -0
  78. package/dist/cli/{chunk-YQ6NTIIE.js → chunk-ZZYBBX5N.js} +13 -5
  79. package/dist/cli/chunk-ZZYBBX5N.js.map +1 -0
  80. package/dist/cli/{code-SMKEW6CD.js → code-PSVJ3KEN.js} +48 -36
  81. package/dist/cli/code-PSVJ3KEN.js.map +1 -0
  82. package/dist/cli/{commands-FVVB5FZF.js → commands-OCU42XG4.js} +4 -4
  83. package/dist/cli/{commit-HE4VSPZ7.js → commit-XCQIQCYG.js} +3 -3
  84. package/dist/cli/{desktop-Q7NDXCON.js → desktop-KWGR4BNE.js} +210 -69
  85. package/dist/cli/desktop-KWGR4BNE.js.map +1 -0
  86. package/dist/cli/devtools-HW3WDT3Q.js +91 -0
  87. package/dist/cli/devtools-HW3WDT3Q.js.map +1 -0
  88. package/dist/cli/{diff-435UTPC5.js → diff-NHANTNC3.js} +9 -9
  89. package/dist/cli/{doctor-OT7KH75K.js → doctor-CC5CLOGG.js} +10 -10
  90. package/dist/cli/events-XEFAD5VX.js +0 -0
  91. package/dist/cli/index.js +132 -94
  92. package/dist/cli/index.js.map +1 -1
  93. package/dist/cli/{mcp-WUL2WO75.js → mcp-MPVGBBJF.js} +2 -2
  94. package/dist/cli/{mcp-browse-RR7R4XET.js → mcp-browse-4XOTC3FJ.js} +3 -3
  95. package/dist/cli/{mcp-inspect-REGLYBWT.js → mcp-inspect-CEMGKKAH.js} +14 -9
  96. package/dist/cli/mcp-inspect-CEMGKKAH.js.map +1 -0
  97. package/dist/cli/{prompt-UW6EFLVR.js → prompt-2D7ID24X.js} +4 -4
  98. package/dist/cli/prune-sessions-3RWUBYRS.js +0 -0
  99. package/dist/cli/{replay-YOURXV4C.js → replay-SR44E6RS.js} +10 -10
  100. package/dist/cli/{run-Q6BUXV66.js → run-MDGL27WL.js} +35 -36
  101. package/dist/cli/run-MDGL27WL.js.map +1 -0
  102. package/dist/cli/{server-XGDBRWMB.js → server-27ARQXIZ.js} +67 -24
  103. package/dist/cli/server-27ARQXIZ.js.map +1 -0
  104. package/dist/cli/{sessions-FH7QVYSY.js → sessions-CKQXCYGP.js} +18 -18
  105. package/dist/cli/sessions-CKQXCYGP.js.map +1 -0
  106. package/dist/cli/{setup-VDS6SVEP.js → setup-TPAGSVXO.js} +6 -6
  107. package/dist/cli/{stats-MQVI2XQH.js → stats-DPUBZNVX.js} +6 -4
  108. package/dist/cli/update-6ITLPRDV.js +0 -0
  109. package/dist/cli/{version-DAHGZY5N.js → version-2X3BHVVK.js} +15 -15
  110. package/dist/index.d.ts +181 -53
  111. package/dist/index.js +1322 -533
  112. package/dist/index.js.map +1 -1
  113. package/package.json +21 -8
  114. package/dist/cli/.-3G6VX5S7.js +0 -327
  115. package/dist/cli/.-6YRPB2C7.js +0 -329
  116. package/dist/cli/.-EYSVINK3.js +0 -317
  117. package/dist/cli/acp-DAGPCVFZ.js.map +0 -1
  118. package/dist/cli/chat-7ES4IBNH.js +0 -50
  119. package/dist/cli/chunk-2K65GZBT.js.map +0 -1
  120. package/dist/cli/chunk-2KDUS647.js.map +0 -1
  121. package/dist/cli/chunk-2R4QCDOZ.js.map +0 -1
  122. package/dist/cli/chunk-3BXRZFWS.js.map +0 -1
  123. package/dist/cli/chunk-3Z6IBU3D.js.map +0 -1
  124. package/dist/cli/chunk-45U62RI3.js.map +0 -1
  125. package/dist/cli/chunk-6AK4EY3D.js.map +0 -1
  126. package/dist/cli/chunk-6PZ3CXBP.js.map +0 -1
  127. package/dist/cli/chunk-H6PS7IUE.js.map +0 -1
  128. package/dist/cli/chunk-O52OLQL3.js.map +0 -1
  129. package/dist/cli/chunk-OSZC7C6F.js.map +0 -1
  130. package/dist/cli/chunk-P7EKE5ZQ.js.map +0 -1
  131. package/dist/cli/chunk-PQXPXJBJ.js.map +0 -1
  132. package/dist/cli/chunk-PV55UMTO.js +0 -200
  133. package/dist/cli/chunk-PV55UMTO.js.map +0 -1
  134. package/dist/cli/chunk-RE4RAVFF.js.map +0 -1
  135. package/dist/cli/chunk-XPDVG52A.js.map +0 -1
  136. package/dist/cli/chunk-YFGF5NKA.js.map +0 -1
  137. package/dist/cli/chunk-YQ6NTIIE.js.map +0 -1
  138. package/dist/cli/code-SMKEW6CD.js.map +0 -1
  139. package/dist/cli/desktop-Q7NDXCON.js.map +0 -1
  140. package/dist/cli/devtools-YECO25QO.js.map +0 -1
  141. package/dist/cli/doctor-OT7KH75K.js.map +0 -1
  142. package/dist/cli/mcp-inspect-REGLYBWT.js.map +0 -1
  143. package/dist/cli/prompt-UW6EFLVR.js.map +0 -1
  144. package/dist/cli/run-Q6BUXV66.js.map +0 -1
  145. package/dist/cli/server-XGDBRWMB.js.map +0 -1
  146. package/dist/cli/sessions-FH7QVYSY.js.map +0 -1
  147. package/dist/cli/stats-MQVI2XQH.js.map +0 -1
  148. /package/dist/cli/{.-3G6VX5S7.js.map → chat-TH7VNNCJ.js.map} +0 -0
  149. /package/dist/cli/{chunk-XCGGEJTI.js.map → chunk-4CTDEJUF.js.map} +0 -0
  150. /package/dist/cli/{chunk-7O5ALB4C.js.map → chunk-7CIGMZT3.js.map} +0 -0
  151. /package/dist/cli/{chunk-TJX6BFZZ.js.map → chunk-AB2RED3C.js.map} +0 -0
  152. /package/dist/cli/{chunk-FHOGSSCH.js.map → chunk-C53JQES5.js.map} +0 -0
  153. /package/dist/cli/{chunk-VK5HG73G.js.map → chunk-KM465GST.js.map} +0 -0
  154. /package/dist/cli/{chunk-DOYHN4KB.js.map → chunk-LIR2HBQH.js.map} +0 -0
  155. /package/dist/cli/{chunk-YYQAUTTN.js.map → chunk-MJ6W5UN3.js.map} +0 -0
  156. /package/dist/cli/{chunk-HFEAY5DT.js.map → chunk-R3CTO2HM.js.map} +0 -0
  157. /package/dist/cli/{chunk-32TIKD5U.js.map → chunk-TXJMRPIL.js.map} +0 -0
  158. /package/dist/cli/{chunk-F3PXYSNN.js.map → chunk-WK3UFQY3.js.map} +0 -0
  159. /package/dist/cli/{commands-FVVB5FZF.js.map → commands-OCU42XG4.js.map} +0 -0
  160. /package/dist/cli/{commit-HE4VSPZ7.js.map → commit-XCQIQCYG.js.map} +0 -0
  161. /package/dist/cli/{diff-435UTPC5.js.map → diff-NHANTNC3.js.map} +0 -0
  162. /package/dist/cli/{.-6YRPB2C7.js.map → doctor-CC5CLOGG.js.map} +0 -0
  163. /package/dist/cli/{mcp-WUL2WO75.js.map → mcp-MPVGBBJF.js.map} +0 -0
  164. /package/dist/cli/{mcp-browse-RR7R4XET.js.map → mcp-browse-4XOTC3FJ.js.map} +0 -0
  165. /package/dist/cli/{.-EYSVINK3.js.map → prompt-2D7ID24X.js.map} +0 -0
  166. /package/dist/cli/{replay-YOURXV4C.js.map → replay-SR44E6RS.js.map} +0 -0
  167. /package/dist/cli/{setup-VDS6SVEP.js.map → setup-TPAGSVXO.js.map} +0 -0
  168. /package/dist/cli/{chat-7ES4IBNH.js.map → stats-DPUBZNVX.js.map} +0 -0
  169. /package/dist/cli/{version-DAHGZY5N.js.map → version-2X3BHVVK.js.map} +0 -0
@@ -1,27 +1,29 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __cr } from 'node:module'; if (typeof globalThis.require === 'undefined') { globalThis.require = __cr(import.meta.url); }
3
- import "./chunk-2R4QCDOZ.js";
4
- import "./chunk-F3PXYSNN.js";
5
- import "./chunk-FHOGSSCH.js";
6
- import "./chunk-6AK4EY3D.js";
7
- import "./chunk-5JJRUIPA.js";
8
- import "./chunk-PV55UMTO.js";
9
- import "./chunk-2KDUS647.js";
3
+ import "./chunk-OPFUUYHL.js";
4
+ import "./chunk-WK3UFQY3.js";
5
+ import "./chunk-C53JQES5.js";
6
+ import "./chunk-XSU4QVFW.js";
7
+ import "./chunk-JNAQYELD.js";
8
+ import "./chunk-6OWJV3YW.js";
9
+ import "./chunk-V26WPN3J.js";
10
10
  import "./chunk-25T6CVUP.js";
11
11
  import "./chunk-2UQP6H6T.js";
12
- import "./chunk-O52OLQL3.js";
13
- import "./chunk-2K65GZBT.js";
14
- import "./chunk-7O5ALB4C.js";
12
+ import "./chunk-RDRC3XDT.js";
13
+ import "./chunk-TEUDEGX2.js";
14
+ import "./chunk-7CIGMZT3.js";
15
15
  import "./chunk-S4XVGLRW.js";
16
16
  import {
17
17
  listSessions,
18
18
  loadSessionMessages,
19
19
  sessionPath
20
20
  } from "./chunk-6PBZN4VI.js";
21
- import "./chunk-RE4RAVFF.js";
22
- import "./chunk-XPDVG52A.js";
23
- import "./chunk-HFEAY5DT.js";
24
- import "./chunk-YQ6NTIIE.js";
21
+ import "./chunk-R3CTO2HM.js";
22
+ import "./chunk-ZZYBBX5N.js";
23
+ import {
24
+ t
25
+ } from "./chunk-CGDR2ELH.js";
26
+ import "./chunk-AVFXO2EZ.js";
25
27
  import "./chunk-XXC2BYTV.js";
26
28
  import "./chunk-TUK7OWJA.js";
27
29
 
@@ -36,9 +38,7 @@ function sessionsCommand(opts) {
36
38
  function listAll() {
37
39
  const items = listSessions();
38
40
  if (items.length === 0) {
39
- console.log(
40
- "no saved sessions yet \u2014 run `reasonix chat` (sessions are auto-saved unless --no-session)."
41
- );
41
+ console.log(t("sessions.emptyHint"));
42
42
  return;
43
43
  }
44
44
  console.log("Saved sessions (~/.reasonix/sessions/):");
@@ -103,4 +103,4 @@ function truncate(s, max) {
103
103
  export {
104
104
  sessionsCommand
105
105
  };
106
- //# sourceMappingURL=sessions-FH7QVYSY.js.map
106
+ //# sourceMappingURL=sessions-CKQXCYGP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/cli/commands/sessions.ts"],"sourcesContent":["import { t } from \"../../i18n/index.js\";\nimport { listSessions, loadSessionMessages, sessionPath } from \"../../index.js\";\nimport type { ChatMessage } from \"../../index.js\";\n\nexport interface SessionsOptions {\n /** When present, inspect that session instead of listing. */\n name?: string;\n /** Include assistant tool-call metadata in the inspect output. */\n verbose?: boolean;\n}\n\nexport function sessionsCommand(opts: SessionsOptions): void {\n if (opts.name) {\n inspectSession(opts.name, !!opts.verbose);\n } else {\n listAll();\n }\n}\n\nfunction listAll(): void {\n const items = listSessions();\n if (items.length === 0) {\n console.log(t(\"sessions.emptyHint\"));\n return;\n }\n console.log(\"Saved sessions (~/.reasonix/sessions/):\");\n console.log(\"\");\n console.log(` ${\"name\".padEnd(22)} ${\"msgs\".padStart(6)} ${\"size\".padStart(8)} modified`);\n console.log(` ${\"─\".repeat(60)}`);\n for (const s of items) {\n const sizeKb = `${(s.size / 1024).toFixed(1)} KB`;\n const when = s.mtime.toISOString().replace(\"T\", \" \").slice(0, 16);\n console.log(\n ` ${s.name.padEnd(22)} ${String(s.messageCount).padStart(6)} ${sizeKb.padStart(8)} ${when}`,\n );\n }\n console.log(\"\");\n console.log(\"Inspect: reasonix sessions <name>\");\n console.log(\"Resume: reasonix chat --session <name>\");\n}\n\nfunction inspectSession(name: string, verbose: boolean): void {\n const path = sessionPath(name);\n const messages = loadSessionMessages(name);\n if (messages.length === 0) {\n console.error(`no session named \"${name}\" (or it's empty).`);\n console.error(`looked at: ${path}`);\n process.exit(1);\n }\n\n console.log(`[session] ${name} ${messages.length} messages ${path}`);\n console.log(\"\");\n\n let turnIndex = 0;\n for (const msg of messages) {\n renderMessage(msg, turnIndex, verbose);\n // Roughly bump \"turn\" after each user message so the reader can follow\n // the conversation shape without the transcript's richer turn numbering.\n if (msg.role === \"user\") turnIndex++;\n }\n}\n\nfunction renderMessage(msg: ChatMessage, turnIdx: number, verbose: boolean): void {\n const turn = turnIdx > 0 ? `[t${turnIdx}]` : \"[start]\";\n const content = typeof msg.content === \"string\" ? msg.content : \"\";\n const flat = oneLine(content);\n\n if (msg.role === \"user\") {\n console.log(`${turn} USER: ${flat}`);\n } else if (msg.role === \"assistant\") {\n console.log(`${turn} AGENT: ${flat || \"(tool call only)\"}`);\n if (verbose && msg.tool_calls?.length) {\n for (const tc of msg.tool_calls) {\n console.log(\n ` → call ${tc.function?.name} ${truncate(tc.function?.arguments ?? \"\", 80)}`,\n );\n }\n }\n } else if (msg.role === \"tool\") {\n console.log(`${turn} TOOL ${msg.name ?? \"?\"}: ${truncate(flat, 160)}`);\n } else if (msg.role === \"system\") {\n if (verbose) console.log(`${turn} SYSTEM: ${truncate(flat, 160)}`);\n // otherwise suppress — session's system prompt is usually session-wide\n // boilerplate.\n }\n}\n\nfunction oneLine(s: string, max = 200): string {\n const collapsed = s.replace(/\\s+/g, \" \").trim();\n return collapsed.length > max ? `${collapsed.slice(0, max)}…` : collapsed;\n}\n\nfunction truncate(s: string, max: number): string {\n return s.length <= max ? s : `${s.slice(0, max)}…`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWO,SAAS,gBAAgB,MAA6B;AAC3D,MAAI,KAAK,MAAM;AACb,mBAAe,KAAK,MAAM,CAAC,CAAC,KAAK,OAAO;AAAA,EAC1C,OAAO;AACL,YAAQ;AAAA,EACV;AACF;AAEA,SAAS,UAAgB;AACvB,QAAM,QAAQ,aAAa;AAC3B,MAAI,MAAM,WAAW,GAAG;AACtB,YAAQ,IAAI,EAAE,oBAAoB,CAAC;AACnC;AAAA,EACF;AACA,UAAQ,IAAI,yCAAyC;AACrD,UAAQ,IAAI,EAAE;AACd,UAAQ,IAAI,KAAK,OAAO,OAAO,EAAE,CAAC,IAAI,OAAO,SAAS,CAAC,CAAC,KAAK,OAAO,SAAS,CAAC,CAAC,YAAY;AAC3F,UAAQ,IAAI,KAAK,SAAI,OAAO,EAAE,CAAC,EAAE;AACjC,aAAW,KAAK,OAAO;AACrB,UAAM,SAAS,IAAI,EAAE,OAAO,MAAM,QAAQ,CAAC,CAAC;AAC5C,UAAM,OAAO,EAAE,MAAM,YAAY,EAAE,QAAQ,KAAK,GAAG,EAAE,MAAM,GAAG,EAAE;AAChE,YAAQ;AAAA,MACN,KAAK,EAAE,KAAK,OAAO,EAAE,CAAC,IAAI,OAAO,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC,KAAK,OAAO,SAAS,CAAC,CAAC,KAAK,IAAI;AAAA,IAC9F;AAAA,EACF;AACA,UAAQ,IAAI,EAAE;AACd,UAAQ,IAAI,oCAAoC;AAChD,UAAQ,IAAI,0CAA0C;AACxD;AAEA,SAAS,eAAe,MAAc,SAAwB;AAC5D,QAAM,OAAO,YAAY,IAAI;AAC7B,QAAM,WAAW,oBAAoB,IAAI;AACzC,MAAI,SAAS,WAAW,GAAG;AACzB,YAAQ,MAAM,qBAAqB,IAAI,oBAAoB;AAC3D,YAAQ,MAAM,cAAc,IAAI,EAAE;AAClC,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,UAAQ,IAAI,aAAa,IAAI,MAAM,SAAS,MAAM,eAAe,IAAI,EAAE;AACvE,UAAQ,IAAI,EAAE;AAEd,MAAI,YAAY;AAChB,aAAW,OAAO,UAAU;AAC1B,kBAAc,KAAK,WAAW,OAAO;AAGrC,QAAI,IAAI,SAAS,OAAQ;AAAA,EAC3B;AACF;AAEA,SAAS,cAAc,KAAkB,SAAiB,SAAwB;AAChF,QAAM,OAAO,UAAU,IAAI,KAAK,OAAO,MAAM;AAC7C,QAAM,UAAU,OAAO,IAAI,YAAY,WAAW,IAAI,UAAU;AAChE,QAAM,OAAO,QAAQ,OAAO;AAE5B,MAAI,IAAI,SAAS,QAAQ;AACvB,YAAQ,IAAI,GAAG,IAAI,UAAU,IAAI,EAAE;AAAA,EACrC,WAAW,IAAI,SAAS,aAAa;AACnC,YAAQ,IAAI,GAAG,IAAI,WAAW,QAAQ,kBAAkB,EAAE;AAC1D,QAAI,WAAW,IAAI,YAAY,QAAQ;AACrC,iBAAW,MAAM,IAAI,YAAY;AAC/B,gBAAQ;AAAA,UACN,wBAAmB,GAAG,UAAU,IAAI,IAAI,SAAS,GAAG,UAAU,aAAa,IAAI,EAAE,CAAC;AAAA,QACpF;AAAA,MACF;AAAA,IACF;AAAA,EACF,WAAW,IAAI,SAAS,QAAQ;AAC9B,YAAQ,IAAI,GAAG,IAAI,SAAS,IAAI,QAAQ,GAAG,KAAK,SAAS,MAAM,GAAG,CAAC,EAAE;AAAA,EACvE,WAAW,IAAI,SAAS,UAAU;AAChC,QAAI,QAAS,SAAQ,IAAI,GAAG,IAAI,YAAY,SAAS,MAAM,GAAG,CAAC,EAAE;AAAA,EAGnE;AACF;AAEA,SAAS,QAAQ,GAAW,MAAM,KAAa;AAC7C,QAAM,YAAY,EAAE,QAAQ,QAAQ,GAAG,EAAE,KAAK;AAC9C,SAAO,UAAU,SAAS,MAAM,GAAG,UAAU,MAAM,GAAG,GAAG,CAAC,WAAM;AAClE;AAEA,SAAS,SAAS,GAAW,KAAqB;AAChD,SAAO,EAAE,UAAU,MAAM,IAAI,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;AACjD;","names":[]}
@@ -3,11 +3,11 @@ import { createRequire as __cr } from 'node:module'; if (typeof globalThis.requi
3
3
  import {
4
4
  MultiSelect,
5
5
  SingleSelect
6
- } from "./chunk-6PZ3CXBP.js";
6
+ } from "./chunk-MRHHQJAQ.js";
7
7
  import {
8
8
  ThemeProvider,
9
9
  useTheme
10
- } from "./chunk-TJX6BFZZ.js";
10
+ } from "./chunk-AB2RED3C.js";
11
11
  import {
12
12
  Box_default,
13
13
  Text,
@@ -16,7 +16,7 @@ import {
16
16
  source_default,
17
17
  use_app_default,
18
18
  use_input_default
19
- } from "./chunk-6G3CUUFG.js";
19
+ } from "./chunk-X53B3JIX.js";
20
20
  import {
21
21
  PRESET_DESCRIPTIONS
22
22
  } from "./chunk-2425HK6U.js";
@@ -34,7 +34,7 @@ import {
34
34
  onLanguageChange,
35
35
  setLanguage,
36
36
  t
37
- } from "./chunk-RE4RAVFF.js";
37
+ } from "./chunk-CGDR2ELH.js";
38
38
  import {
39
39
  defaultConfigPath,
40
40
  isPlausibleKey,
@@ -46,7 +46,7 @@ import {
46
46
  redactKey,
47
47
  resolveThemePreference,
48
48
  writeConfig
49
- } from "./chunk-XPDVG52A.js";
49
+ } from "./chunk-AVFXO2EZ.js";
50
50
  import {
51
51
  __toESM
52
52
  } from "./chunk-TUK7OWJA.js";
@@ -615,4 +615,4 @@ async function setupCommand(opts = {}) {
615
615
  export {
616
616
  setupCommand
617
617
  };
618
- //# sourceMappingURL=setup-VDS6SVEP.js.map
618
+ //# sourceMappingURL=setup-TPAGSVXO.js.map
@@ -3,12 +3,14 @@ import { createRequire as __cr } from 'node:module'; if (typeof globalThis.requi
3
3
  import {
4
4
  renderDashboard,
5
5
  statsCommand
6
- } from "./chunk-OSZC7C6F.js";
7
- import "./chunk-HFEAY5DT.js";
8
- import "./chunk-YQ6NTIIE.js";
6
+ } from "./chunk-CWZKQ5FE.js";
7
+ import "./chunk-R3CTO2HM.js";
8
+ import "./chunk-ZZYBBX5N.js";
9
+ import "./chunk-CGDR2ELH.js";
10
+ import "./chunk-AVFXO2EZ.js";
9
11
  import "./chunk-TUK7OWJA.js";
10
12
  export {
11
13
  renderDashboard,
12
14
  statsCommand
13
15
  };
14
- //# sourceMappingURL=stats-MQVI2XQH.js.map
16
+ //# sourceMappingURL=stats-DPUBZNVX.js.map
File without changes
@@ -1,23 +1,23 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __cr } from 'node:module'; if (typeof globalThis.require === 'undefined') { globalThis.require = __cr(import.meta.url); }
3
- import "./chunk-2R4QCDOZ.js";
4
- import "./chunk-F3PXYSNN.js";
5
- import "./chunk-FHOGSSCH.js";
6
- import "./chunk-6AK4EY3D.js";
7
- import "./chunk-5JJRUIPA.js";
8
- import "./chunk-PV55UMTO.js";
9
- import "./chunk-2KDUS647.js";
3
+ import "./chunk-OPFUUYHL.js";
4
+ import "./chunk-WK3UFQY3.js";
5
+ import "./chunk-C53JQES5.js";
6
+ import "./chunk-XSU4QVFW.js";
7
+ import "./chunk-JNAQYELD.js";
8
+ import "./chunk-6OWJV3YW.js";
9
+ import "./chunk-V26WPN3J.js";
10
10
  import "./chunk-25T6CVUP.js";
11
11
  import "./chunk-2UQP6H6T.js";
12
- import "./chunk-O52OLQL3.js";
13
- import "./chunk-2K65GZBT.js";
14
- import "./chunk-7O5ALB4C.js";
12
+ import "./chunk-RDRC3XDT.js";
13
+ import "./chunk-TEUDEGX2.js";
14
+ import "./chunk-7CIGMZT3.js";
15
15
  import "./chunk-S4XVGLRW.js";
16
16
  import "./chunk-6PBZN4VI.js";
17
- import "./chunk-RE4RAVFF.js";
18
- import "./chunk-XPDVG52A.js";
19
- import "./chunk-HFEAY5DT.js";
20
- import "./chunk-YQ6NTIIE.js";
17
+ import "./chunk-R3CTO2HM.js";
18
+ import "./chunk-ZZYBBX5N.js";
19
+ import "./chunk-CGDR2ELH.js";
20
+ import "./chunk-AVFXO2EZ.js";
21
21
  import {
22
22
  VERSION
23
23
  } from "./chunk-XXC2BYTV.js";
@@ -30,4 +30,4 @@ function versionCommand() {
30
30
  export {
31
31
  versionCommand
32
32
  };
33
- //# sourceMappingURL=version-DAHGZY5N.js.map
33
+ //# sourceMappingURL=version-2X3BHVVK.js.map
package/dist/index.d.ts CHANGED
@@ -497,6 +497,8 @@ interface TruncationRepairResult {
497
497
  repaired: string;
498
498
  changed: boolean;
499
499
  notes: string[];
500
+ /** True when all repair attempts failed and the result falls back to "{}" — the original args are unrecoverable. */
501
+ fallback: boolean;
500
502
  }
501
503
  declare function repairTruncatedJson(input: string): TruncationRepairResult;
502
504
 
@@ -590,6 +592,7 @@ declare class SessionStats {
590
592
  cacheMissTokens?: number;
591
593
  lastPromptTokens?: number;
592
594
  }): void;
595
+ reset(): void;
593
596
  record(turn: number, model: string, usage: Usage): TurnStats;
594
597
  get totalCost(): number;
595
598
  get totalClaudeEquivalent(): number;
@@ -605,10 +608,10 @@ type EventRole = "assistant_delta" | "assistant_final"
605
608
  | "tool_call_delta"
606
609
  /** Pre-dispatch ping so the TUI can show a spinner during long tool awaits. */
607
610
  | "tool_start" | "tool" | "done" | "error" | "warning"
608
- /** Loop reached its pause interval; state is on disk under `sessionName`, caller may resume. */
609
- | "paused"
610
611
  /** Transient indicator for silent phases; UI clears on next primary event. */
611
- | "status";
612
+ | "status"
613
+ /** Mid-turn steer injected as a user utterance without aborting the current turn. */
614
+ | "steer";
612
615
  interface LoopEvent {
613
616
  turn: number;
614
617
  role: EventRole;
@@ -630,12 +633,6 @@ interface LoopEvent {
630
633
  error?: string;
631
634
  /** Display-only — code-mode applier MUST skip SEARCH/REPLACE in forced-summary text. */
632
635
  forcedSummary?: boolean;
633
- /** Set on `role === "paused"` — the session name caller passes back as `resume_session` to continue. */
634
- sessionName?: string;
635
- /** Set on `role === "paused"` — iter count consumed before pausing. */
636
- pausedAtIter?: number;
637
- /** Set on `role === "paused"` — one-shot no-tools summary of progress / remaining / blockers, for the parent's resume decision. */
638
- partialSummary?: string;
639
636
  }
640
637
 
641
638
  interface ImmutablePrefixOptions {
@@ -762,7 +759,6 @@ interface CacheFirstLoopOptions {
762
759
  prefix: ImmutablePrefix;
763
760
  tools?: ToolRegistry;
764
761
  model?: string;
765
- maxToolIters?: number;
766
762
  stream?: boolean;
767
763
  reasoningEffort?: "high" | "max";
768
764
  autoEscalate?: boolean;
@@ -779,8 +775,6 @@ interface CacheFirstLoopOptions {
779
775
  confirmationGate?: PauseGate;
780
776
  /** Re-runs the prompt builder (applyMemoryStack / codeSystemPrompt) on /new so REASONIX.md edits take effect without a restart. Accepting a cache miss is the price. */
781
777
  rebuildSystem?: () => string;
782
- /** What to do when the per-step iter budget is exhausted. "summarize" (default) fires a no-tools call so the user sees an answer — right for top-level chat. "pause" yields a `paused` event leaving the session intact — right for subagents whose parent can decide to resume or accept partial state. */
783
- onIterBudgetExhausted?: "summarize" | "pause";
784
778
  }
785
779
  interface ReconfigurableOptions {
786
780
  model?: string;
@@ -794,7 +788,6 @@ declare class CacheFirstLoop {
794
788
  readonly client: DeepSeekClient;
795
789
  readonly prefix: ImmutablePrefix;
796
790
  readonly tools: ToolRegistry;
797
- readonly maxToolIters: number;
798
791
  readonly log: AppendOnlyLog;
799
792
  readonly scratch: VolatileScratch;
800
793
  readonly stats: SessionStats;
@@ -807,7 +800,6 @@ declare class CacheFirstLoop {
807
800
  /** One-shot 80% warning latch — cleared by setBudget so a bump re-arms at the new boundary. */
808
801
  private _budgetWarned;
809
802
  sessionName: string | null;
810
- readonly onIterBudgetExhausted: "summarize" | "pause";
811
803
  hooks: ResolvedHook[];
812
804
  hookCwd: string;
813
805
  /** PauseGate bridge — defaults to singleton, injectable for tests. */
@@ -821,12 +813,20 @@ declare class CacheFirstLoop {
821
813
  private _turnAbort;
822
814
  /** Authoritative running-id set — UI cards consult this instead of trusting end-event delivery. Insert at dispatch entry, delete in finally. */
823
815
  private readonly _inflight;
816
+ /** Typeahead steer message set by the UI; step() consumes it at the next iter boundary. */
817
+ private _steer;
818
+ /** Set true when a steer was consumed this turn; cleared on next step() entry. */
819
+ private _steerConsumed;
820
+ /** UI calls this to inject a mid-turn steer message without aborting the current turn.
821
+ * New text resets steerConsumed — a fresh steer hasn't been consumed yet. */
822
+ steer(text: string | null): void;
823
+ /** True when a steer was consumed this turn (UI gate to avoid double-submit). */
824
+ get steerConsumed(): boolean;
824
825
  private _proArmedForNextTurn;
825
826
  private _escalateThisTurn;
826
827
  private readonly _turnFailures;
827
828
  private _turnSelfCorrected;
828
829
  private _foldedThisTurn;
829
- private _toolDispatchesThisStep;
830
830
  private context;
831
831
  /** Subscribe API so UI hooks can derive `running` from finally-guaranteed insertions. */
832
832
  get inflight(): InflightSet;
@@ -850,6 +850,13 @@ declare class CacheFirstLoop {
850
850
  archived: string | null;
851
851
  systemRebuilt: boolean;
852
852
  };
853
+ /** `/cwd` follow-through — archives the previous session, drops in-memory state, repoints sessionName, and rebuilds the system prompt against whatever the rebuilder closure now resolves (the caller is expected to have already updated the root the closure reads). */
854
+ switchWorkspace(opts: {
855
+ sessionName: string;
856
+ }): {
857
+ dropped: number;
858
+ archived: string | null;
859
+ };
853
860
  configure(opts: ReconfigurableOptions): void;
854
861
  /** `null` disables the cap; any change re-arms the 80% warning. */
855
862
  setBudget(usd: number | null): void;
@@ -1046,6 +1053,31 @@ interface IndexUserConfig {
1046
1053
  maxFileBytes?: number;
1047
1054
  }
1048
1055
 
1056
+ /** Plain http:// stays HTTP+SSE for back-compat; Streamable HTTP is opt-in via the `streamable+` URL prefix. */
1057
+ interface StdioMcpSpec {
1058
+ transport: "stdio";
1059
+ /** Namespace prefix applied to each registered tool, or null if anonymous. */
1060
+ name: string | null;
1061
+ /** Argv[0]. */
1062
+ command: string;
1063
+ /** Remaining argv. */
1064
+ args: string[];
1065
+ }
1066
+ interface SseMcpSpec {
1067
+ transport: "sse";
1068
+ name: string | null;
1069
+ /** Fully qualified SSE endpoint URL. */
1070
+ url: string;
1071
+ }
1072
+ interface StreamableHttpMcpSpec {
1073
+ transport: "streamable-http";
1074
+ name: string | null;
1075
+ /** Fully qualified Streamable HTTP endpoint URL (no `streamable+` prefix). */
1076
+ url: string;
1077
+ }
1078
+ type McpSpec = StdioMcpSpec | SseMcpSpec | StreamableHttpMcpSpec;
1079
+ declare function parseMcpSpec(input: string): McpSpec;
1080
+
1049
1081
  /** Library reads only DEEPSEEK_API_KEY from env; the CLI bridges config.json → env var. */
1050
1082
 
1051
1083
  /** Legacy `fast|smart|max` kept for back-compat with existing config.json files. */
@@ -1069,6 +1101,21 @@ interface SemanticEmbeddingUserConfig {
1069
1101
  ollama?: OllamaEmbeddingUserConfig;
1070
1102
  openaiCompat?: OpenAICompatEmbeddingUserConfig;
1071
1103
  }
1104
+ interface McpServerConfig {
1105
+ command?: string;
1106
+ args?: string[];
1107
+ env?: Record<string, string>;
1108
+ transport?: "stdio" | "sse" | "streamable-http";
1109
+ url?: string;
1110
+ headers?: Record<string, string>;
1111
+ disabled?: boolean;
1112
+ }
1113
+ interface QQBotConfig {
1114
+ appId?: string;
1115
+ appSecret?: string;
1116
+ sandbox?: boolean;
1117
+ enabled?: boolean;
1118
+ }
1072
1119
  interface ReasonixConfig {
1073
1120
  apiKey?: string;
1074
1121
  baseUrl?: string;
@@ -1077,11 +1124,15 @@ interface ReasonixConfig {
1077
1124
  editMode?: EditMode;
1078
1125
  editModeHintShown?: boolean;
1079
1126
  mouseClipboardHintShown?: boolean;
1127
+ /** When false, skip the boot splash animation and show the main UI immediately. Default true. */
1128
+ banner?: boolean;
1080
1129
  reasoningEffort?: ReasoningEffort;
1081
1130
  /** Default workspace root for the desktop client. CLI uses cwd. */
1082
1131
  workspaceDir?: string;
1083
1132
  /** Last N workspace paths the desktop client has opened, most recent first. */
1084
1133
  recentWorkspaces?: string[];
1134
+ /** Desktop only — workspace dir per open tab in tab order, persisted so restart restores every tab (issue #933). Empty/absent → boot with a single default tab. */
1135
+ desktopOpenTabs?: string[];
1085
1136
  /** Desktop only — `openWith` value for clicking file links. Empty/undefined = OS default app. Examples: "code", "cursor", "C:\\path\\to\\editor.exe". */
1086
1137
  editor?: string;
1087
1138
  theme?: ThemeName | "auto";
@@ -1091,16 +1142,24 @@ interface ReasonixConfig {
1091
1142
  mcpDisabled?: string[];
1092
1143
  /** Env overlay per MCP server name (matches the `name=` prefix of the spec). Stdio transports merge this over process.env; SSE/HTTP ignore it. */
1093
1144
  mcpEnv?: Record<string, Record<string, string>>;
1145
+ /** Canonical MCP server configuration — merges with and overrides legacy `mcp`/`mcpEnv`/`mcpDisabled`. */
1146
+ mcpServers?: Record<string, McpServerConfig>;
1094
1147
  session?: string | null;
1095
1148
  setupCompleted?: boolean;
1096
1149
  search?: boolean;
1097
- /** Web search engine backend: "mojeek" (default, scrapes Mojeek) or "searxng" (self-hosted SearXNG). */
1098
- webSearchEngine?: "mojeek" | "searxng";
1150
+ /** Web search engine backend: "mojeek" (default, scrapes Mojeek), "searxng" (self-hosted SearXNG), or "metaso" (Metaso API). */
1151
+ webSearchEngine?: "mojeek" | "searxng" | "metaso";
1099
1152
  /** Base URL for SearXNG instance (default http://localhost:8080). */
1100
1153
  webSearchEndpoint?: string;
1154
+ /** Metaso API key. Falls back to METASO_API_KEY env var, then a built-in default. */
1155
+ metasoApiKey?: string;
1101
1156
  dashboard?: {
1102
1157
  /** Pin the embedded dashboard to a fixed port — required for stable SSH tunnels. 0/absent → ephemeral. */
1103
1158
  port?: number;
1159
+ /** Bind address (#968). Defaults to 127.0.0.1 (loopback only). Set to 0.0.0.0 / :: / a LAN IP to expose to other devices; the URL token is then the only auth, so keep it secret. */
1160
+ host?: string;
1161
+ /** Stable URL token (#968). If unset, a fresh token is minted each boot. Min 16 chars enforced at load time. */
1162
+ token?: string;
1104
1163
  };
1105
1164
  escalation?: {
1106
1165
  /** Per-turn repair/error signal count required to escalate flash→pro. Defaults to 3. Out-of-range → default. */
@@ -1123,12 +1182,25 @@ interface ReasonixConfig {
1123
1182
  pathAllowed?: string[];
1124
1183
  };
1125
1184
  };
1185
+ /** Issue #259 — user-configurable sensitive-path prefixes and filename patterns.
1186
+ * Commands touching these paths are demoted to the confirm gate even when allowlisted. */
1187
+ sensitivePaths?: {
1188
+ /** Path prefixes (tilde-relative or absolute) that trigger confirmation. */
1189
+ prefixes?: string[];
1190
+ /** Glob-style filename patterns (matched against basename, case-insensitive). */
1191
+ patterns?: string[];
1192
+ };
1126
1193
  index?: IndexUserConfig;
1127
1194
  semantic?: SemanticEmbeddingUserConfig;
1195
+ skills?: {
1196
+ paths?: string[];
1197
+ };
1128
1198
  /** User-declared extensions to the built-in memory types (#709). Unknown types round-trip even without a declaration; declaring one lets you attach a default priority + lifecycle. */
1129
1199
  memory?: {
1130
1200
  customTypes?: CustomMemoryTypeConfig[];
1131
1201
  };
1202
+ /** QQ Bot configuration */
1203
+ qq?: QQBotConfig;
1132
1204
  }
1133
1205
  interface CustomMemoryTypeConfig {
1134
1206
  name: string;
@@ -1136,6 +1208,7 @@ interface CustomMemoryTypeConfig {
1136
1208
  priority?: "low" | "medium" | "high";
1137
1209
  expires?: "project_end";
1138
1210
  }
1211
+ declare function loadMetasoApiKey(path?: string): string;
1139
1212
  declare function defaultConfigPath(): string;
1140
1213
  declare function readConfig(path?: string): ReasonixConfig;
1141
1214
  declare function writeConfig(cfg: ReasonixConfig, path?: string): void;
@@ -1226,7 +1299,10 @@ declare function applyUserMemory(basePrompt: string, opts?: {
1226
1299
  projectRoot?: string;
1227
1300
  cfg?: ReasonixConfig;
1228
1301
  }): string;
1229
- declare function applyMemoryStack(basePrompt: string, rootDir: string): string;
1302
+ declare function applyMemoryStack(basePrompt: string, rootDir: string, opts?: {
1303
+ homeDir?: string;
1304
+ cfg?: ReasonixConfig;
1305
+ }): string;
1230
1306
 
1231
1307
  /** Native FS tools — sandbox enforced here, not delegated. `edit_file` takes a single SEARCH/REPLACE string. */
1232
1308
 
@@ -1235,8 +1311,8 @@ interface FilesystemToolsOptions {
1235
1311
  rootDir: string;
1236
1312
  /** false → register only read-side tools. Default true. */
1237
1313
  allowWriting?: boolean;
1238
- /** Per-read byte cap; floor against OOM on a multi-GB blob. */
1239
- maxReadBytes?: number;
1314
+ /** Files at or under this size get full content; larger go to outline mode. Default 512 KiB. */
1315
+ outlineThresholdBytes?: number;
1240
1316
  /** Cap on total bytes from listing/grep tools — bounds tree-as-one-string accidents. */
1241
1317
  maxListBytes?: number;
1242
1318
  }
@@ -1360,20 +1436,87 @@ interface SubagentEvent {
1360
1436
  interface SubagentSink {
1361
1437
  current: ((ev: SubagentEvent) => void) | null;
1362
1438
  }
1439
+ interface SubagentResult {
1440
+ success: boolean;
1441
+ output: string;
1442
+ error?: string;
1443
+ turns: number;
1444
+ toolIters: number;
1445
+ elapsedMs: number;
1446
+ costUsd: number;
1447
+ model: string;
1448
+ skillName?: string;
1449
+ /** Zero-filled when no API calls landed so consumers always see a valid shape. */
1450
+ usage: Usage;
1451
+ /** True when the child terminated via forceSummaryAfterIterLimit (storm-breaker / context-guard) — `output` carries the partial synthesis the model managed to produce; not a full answer. User-abort forced summaries do NOT set this (their content is a UX placeholder, routed to `error`). */
1452
+ forcedSummary?: boolean;
1453
+ }
1363
1454
  interface SubagentToolOptions {
1364
1455
  client: DeepSeekClient;
1365
1456
  defaultSystem?: string;
1366
1457
  projectRoot?: string;
1367
1458
  defaultModel?: string;
1368
- maxToolIters?: number;
1369
1459
  maxResultChars?: number;
1370
1460
  sink?: SubagentSink;
1461
+ /** Fires once per spawn, after `spawnSubagent` returns and before its result is formatted for the parent. Bind a `SubagentTelemetry.record` here for automatic distillation capture. */
1462
+ onSpawnComplete?: (result: SubagentResult) => void;
1371
1463
  }
1372
1464
  /** Library surface only — `reasonix code` uses Skills `runAs: subagent` as the user-facing path. */
1373
1465
  declare function registerSubagentTool(parentRegistry: ToolRegistry, opts: SubagentToolOptions): ToolRegistry;
1374
1466
  /** Plan-mode state propagates — a subagent spawned under `/plan` MUST NOT escape it. */
1375
1467
  declare function forkRegistryExcluding(parent: ToolRegistry, exclude: ReadonlySet<string>): ToolRegistry;
1376
1468
 
1469
+ /** Distillation telemetry — measures parent-log growth avoided per spawn. */
1470
+ /** Minimum shape `computeSpawnDistillation` needs. `SubagentResult` matches structurally; declaring a local interface avoids a stats ↔ subagent ↔ loop import cycle. */
1471
+ interface SubagentResultLike {
1472
+ output: string;
1473
+ costUsd: number;
1474
+ usage: {
1475
+ completionTokens: number;
1476
+ };
1477
+ }
1478
+ interface SpawnDistillation {
1479
+ completionTokens: number;
1480
+ outputTokens: number;
1481
+ /** `completionTokens − outputTokens`, clamped to 0. Lower bound — ignores tool-result tokens that would also have landed in the parent log inline. */
1482
+ savingsTokens: number;
1483
+ /** `outputTokens / completionTokens`; 1 when completion is 0. Lower is more distilled; ≥1 means writes / passthrough. */
1484
+ compressionRatio: number;
1485
+ /** True iff `output.trim().length > 0`. */
1486
+ hasOutput: boolean;
1487
+ costUsd: number;
1488
+ }
1489
+ declare function computeSpawnDistillation(result: SubagentResultLike): SpawnDistillation;
1490
+ interface SubagentSessionSummary {
1491
+ spawnCount: number;
1492
+ usefulSpawnCount: number;
1493
+ /** `usefulSpawnCount / spawnCount`; 0 when no spawns. */
1494
+ successRate: number;
1495
+ totalCompletionTokens: number;
1496
+ totalOutputTokens: number;
1497
+ totalSavingsTokens: number;
1498
+ /** Weighted by completion tokens — fair vs. naive mean of ratios. */
1499
+ aggregateCompressionRatio: number;
1500
+ totalCostUsd: number;
1501
+ }
1502
+ declare function summarizeSubagentSession(spawns: SpawnDistillation[]): SubagentSessionSummary;
1503
+ declare const DEFAULT_SPAWN_STORM_THRESHOLD = 3;
1504
+ declare function countSpawnStorms(spawnsByTurn: ReadonlyArray<ReadonlyArray<SpawnDistillation>>, threshold?: number): number;
1505
+ /** Live collector — append every spawn result, query aggregates whenever. Bind `record` and pass as `onSpawnComplete` to `registerSubagentTool` for automatic capture. */
1506
+ declare class SubagentTelemetry {
1507
+ private readonly _spawns;
1508
+ private readonly _byTurn;
1509
+ private _currentTurn;
1510
+ /** Bound for ergonomic use as a callback. */
1511
+ readonly record: (result: SubagentResultLike) => SpawnDistillation;
1512
+ /** Mark the start of a new parent turn so subsequent records group into a new bucket — call from the parent loop when its turn counter advances. */
1513
+ startTurn(turn: number): void;
1514
+ get spawns(): readonly SpawnDistillation[];
1515
+ get spawnsByTurn(): ReadonlyArray<ReadonlyArray<SpawnDistillation>>;
1516
+ get summary(): SubagentSessionSummary;
1517
+ stormCount(threshold?: number): number;
1518
+ }
1519
+
1377
1520
  /** Background process registry for never-exiting commands; ready-signal detection short-circuits the startup wait. */
1378
1521
  interface JobStartOptions {
1379
1522
  /** Absolute path to cwd for the spawned child. */
@@ -1492,8 +1635,12 @@ declare function quoteForCmdExe(arg: string): string;
1492
1635
  declare function tokenizeCommand(cmd: string): string[];
1493
1636
  /** Up-front detection — without it, `dir | findstr foo` quotes `|` literal and pipe silently fails. */
1494
1637
  declare function detectShellOperator(cmd: string): string | null;
1495
- /** Allowlist match on leading argv tokens; demoted by `RISKY_ARGS` when a destructive flag appears in the tail. */
1496
- declare function isAllowed(cmd: string, extra?: readonly string[]): boolean;
1638
+ /** Allowlist match on leading argv tokens; demoted by `RISKY_ARGS` when a destructive flag appears in the tail,
1639
+ * or by `SENSITIVE_PATHS` when a path argument targets a sensitive location (#259). */
1640
+ declare function isAllowed(cmd: string, extra?: readonly string[], projectRoot?: string, sensitivePathConfig?: {
1641
+ prefixes?: readonly string[];
1642
+ patterns?: readonly string[];
1643
+ }): boolean;
1497
1644
 
1498
1645
  /** cwd pinned to root; non-allowlisted commands throw to a UI confirm gate; spawn is `shell: false`, tokenized argv only. */
1499
1646
 
@@ -1508,6 +1655,12 @@ interface ShellToolsOptions {
1508
1655
  /** Getter form lets `editMode === "yolo"` flip mid-session without re-registering tools. */
1509
1656
  allowAll?: boolean | (() => boolean);
1510
1657
  jobs?: JobRegistry;
1658
+ /** Fired after `run_background` / `stop_job` mutate the registry — used by the desktop popover for near-real-time updates without polling. */
1659
+ onJobsChanged?: () => void;
1660
+ sensitivePaths?: {
1661
+ prefixes?: readonly string[];
1662
+ patterns?: readonly string[];
1663
+ };
1511
1664
  }
1512
1665
  /** Error thrown by `run_command` when the command isn't allowlisted. */
1513
1666
  declare class NeedsConfirmationError extends Error {
@@ -1541,8 +1694,8 @@ interface WebFetchOptions {
1541
1694
  interface WebSearchOptions {
1542
1695
  topK?: number;
1543
1696
  signal?: AbortSignal;
1544
- /** Backend engine: "mojeek" (scrapes Mojeek HTML) or "searxng" (self-hosted SearXNG JSON API). */
1545
- engine?: "mojeek" | "searxng";
1697
+ /** Backend engine: "mojeek" (scrapes Mojeek HTML), "searxng" (self-hosted SearXNG JSON API), or "metaso" (Metaso API). */
1698
+ engine?: "mojeek" | "searxng" | "metaso";
1546
1699
  /** Base URL for SearXNG. Default http://localhost:8080. */
1547
1700
  endpoint?: string;
1548
1701
  }
@@ -1559,8 +1712,8 @@ interface WebToolsOptions {
1559
1712
  defaultTopK?: number;
1560
1713
  /** Byte cap for `web_fetch` extracted text. */
1561
1714
  maxFetchChars?: number;
1562
- /** Backend engine: "mojeek" (default, scrapes Mojeek) or "searxng" (self-hosted SearXNG). */
1563
- webSearchEngine?: "mojeek" | "searxng";
1715
+ /** Backend engine: "mojeek" (default, scrapes Mojeek), "searxng" (self-hosted SearXNG), or "metaso" (Metaso API). */
1716
+ webSearchEngine?: "mojeek" | "searxng" | "metaso";
1564
1717
  /** Base URL for SearXNG (default http://localhost:8080). */
1565
1718
  webSearchEndpoint?: string;
1566
1719
  }
@@ -2120,31 +2273,6 @@ declare function truncateForModel(s: string, maxChars: number): string;
2120
2273
  /** Never tokenizes full input — pathological repetitive text (`AAAA…`) costs 30s+ on the pure-TS BPE port. */
2121
2274
  declare function truncateForModelByTokens(s: string, maxTokens: number): string;
2122
2275
 
2123
- /** Plain http:// stays HTTP+SSE for back-compat; Streamable HTTP is opt-in via the `streamable+` URL prefix. */
2124
- interface StdioMcpSpec {
2125
- transport: "stdio";
2126
- /** Namespace prefix applied to each registered tool, or null if anonymous. */
2127
- name: string | null;
2128
- /** Argv[0]. */
2129
- command: string;
2130
- /** Remaining argv. */
2131
- args: string[];
2132
- }
2133
- interface SseMcpSpec {
2134
- transport: "sse";
2135
- name: string | null;
2136
- /** Fully qualified SSE endpoint URL. */
2137
- url: string;
2138
- }
2139
- interface StreamableHttpMcpSpec {
2140
- transport: "streamable-http";
2141
- name: string | null;
2142
- /** Fully qualified Streamable HTTP endpoint URL (no `streamable+` prefix). */
2143
- url: string;
2144
- }
2145
- type McpSpec = StdioMcpSpec | SseMcpSpec | StreamableHttpMcpSpec;
2146
- declare function parseMcpSpec(input: string): McpSpec;
2147
-
2148
2276
  /** Unsupported list methods surface as `{supported:false}` instead of throwing — minimal servers still get a clean report. */
2149
2277
 
2150
2278
  interface InspectionReport {
@@ -2376,4 +2504,4 @@ declare function aggregateUsage(records: UsageRecord[], opts?: AggregateOptions)
2376
2504
  /** File-size helper for the stats header — "1.2 MB" etc. Returns "" if missing. */
2377
2505
  declare function formatLogSize(path?: string): string;
2378
2506
 
2379
- export { AT_MENTION_PATTERN, AT_PICKER_PREFIX, type AggregateOptions, AppendOnlyLog, type AppendUsageInput, type ApplyResult, type ApplyStatus, type AtMentionExpansion, type AtMentionOptions, type BridgeOptions, type BridgeResult, CODE_SYSTEM_PROMPT, CacheFirstLoop, type CacheFirstLoopOptions, type CallToolResult, type ChatMessage, type ChatResponse, type ChoiceOption, ChoiceRequestedError, type ChoiceToolOptions, type CodeSystemPromptOptions, DEFAULT_AT_DIR_MAX_ENTRIES, DEFAULT_AT_MENTION_MAX_BYTES, DEFAULT_MAX_RESULT_CHARS, DEFAULT_MAX_RESULT_TOKENS, DEFAULT_PICKER_IGNORE_DIRS, DeepSeekClient, type DeepSeekClientOptions, type RenderOptions as DiffRenderOptions, type DiffReport, type DiffSide, type DirEntry, type EditBlock, type EditSnapshot, type EventRole, type FileWithStats, type FilesystemToolsOptions, type FlattenDecision, type FlattenOptions, type GetLatestVersionOptions, type GetPromptResult, HOOK_EVENTS, HOOK_SETTINGS_DIRNAME, HOOK_SETTINGS_FILENAME, type HookConfig, type HookEvent, type HookOutcome, type HookPayload, type HookReport, type HookScope, type HookSettings, type HookSpawnInput, type HookSpawnResult, type HookSpawner, ImmutablePrefix, type ImmutablePrefixOptions, type InitializeResult, type InspectionReport, type InstallSource, type JSONSchema, type JsonRpcMessage, type JsonRpcRequest, type JsonRpcResponse, LATEST_CACHE_TTL_MS, LATEST_FETCH_TIMEOUT_MS, type ListDirectoryOptions, type ListFilesOptions, type ListPromptsResult, type ListResourcesResult, type ListToolsResult, type LoadHookSettingsOptions, type LoopEvent, MCP_PROTOCOL_VERSION, MEMORY_INDEX_FILE, MEMORY_INDEX_MAX_CHARS, McpClient, type McpClientOptions, type McpContentBlock, type McpProgressHandler, type McpProgressInfo, type McpPrompt, type McpPromptArgument, type McpPromptMessage, type McpPromptResourceBlock, type McpResource, type McpResourceContents, type McpResourceContentsBlob, type McpResourceContentsText, type McpSpec, type McpTool, type McpToolSchema, type McpTransport, type MemoryEntry, type MemoryScope, MemoryStore, type MemoryStoreOptions, type MemoryToolsOptions, type MemoryType, type WriteInput as MemoryWriteInput, NeedsConfirmationError, PROJECT_MEMORY_FILE, PROJECT_MEMORY_FILES, PROJECT_MEMORY_MAX_CHARS, type PageContent, type ParsedAtQuery, type PickerCandidate, PlanProposedError, PlanRevisionProposedError, type PlanStep, type PlanStepRisk, type PlanToolOptions, type ProgressNotificationParams, type ProjectMemory, type RankPickerOptions, type ReadResourceResult, type ReadTranscriptResult, type ReasonixConfig, type ReconfigurableOptions, type RepairReport, type ReplayStats, type ResolvedHook, type RetryInfo, type RetryOptions, type Role, type RunCommandResult, type RunHooksOptions, type ScavengeOptions, type ScavengeResult, type SearchResult, type SectionResult, type SessionInfo, SessionStats, type SessionSummary, type ShellToolsOptions, type SseMcpSpec, SseTransport, type SseTransportOptions, type StdioMcpSpec, StdioTransport, type StdioTransportOptions, type StepCompletion, StormBreaker, type StreamChunk, type StreamWalkOptions, type StreamableHttpMcpSpec, StreamableHttpTransport, type StreamableHttpTransportOptions, type SubagentEvent, type SubagentSink, type SubagentToolOptions, type TodoItem, type TodoStatus, type TodoToolOptions, type ToolCall, type ToolCallContext, ToolCallRepair, type ToolCallRepairOptions, type ToolDefinition, type ToolFunctionSpec, ToolRegistry, type ToolSpec, type TranscriptMeta, type TranscriptRecord, type TruncationRepairResult, type TurnPair, type TurnStats, USER_MEMORY_DIR, Usage, type UsageAggregate, type UsageBucket, type UsageRecord, VERSION, VolatileScratch, type WebFetchOptions, type WebSearchOptions, type WebToolsOptions, aggregateUsage, analyzeSchema, appendSessionMessage, appendUsage, applyEditBlock, applyEditBlocks, applyMemoryStack, applyProjectMemory, applyUserMemory, bridgeMcpTools, bucketCacheHitRatio, bucketSavingsFraction, claudeEquivalentCost, codeSystemPrompt, compareVersions, computeReplayStats, costUsd, decideOutcome, defaultConfigPath, defaultUsageLogPath, deleteSession, detectAtPicker, detectInstallSource, detectNpmInstallPrefix, detectShellOperator, diffTranscripts, expandAtMentions, fetchWithRetry, findProjectMemoryPath, fixToolCallPairing, flattenMcpResult, flattenSchema, forkRegistryExcluding, formatCommandResult, formatHookOutcomeMessage, formatLogSize, formatLoopError, formatSearchResults, getLatestVersion, globalSettingsPath, healLoadedMessages, healLoadedMessagesByTokens, htmlToText, injectPowerShellUtf8, inputCostUsd, inspectMcpServer, isAllowed, isJsonRpcError, isNpxInstall, isPlausibleKey, listDirectory, listFilesSync, listFilesWithStatsAsync, listFilesWithStatsSync, listSessions, loadApiKey, loadBaseUrl, loadDotenv, loadHooks, loadSessionMessages, matchesTool, memoryEnabled, nestArguments, openTranscriptFile, outputCostUsd, parseAtQuery, parseEditBlocks, parseMcpSpec, parseMojeekResults, parseSearxngHtmlResults, parseTranscript, prepareSpawn, projectHash, projectSettingsPath, quoteForCmdExe, rankPickerCandidates, readConfig, readProjectMemory, readTranscript, readUsageLog, recordFromLoopEvent, redactKey, registerChoiceTool, registerFilesystemTools, registerMemoryTools, registerPlanTool, registerShellTools, registerSubagentTool, registerTodoTool, registerWebTools, renderMarkdown as renderDiffMarkdown, renderSummaryTable as renderDiffSummary, repairTruncatedJson, replayFromFile, resolveExecutable, resolveProjectMemoryWritePath, restoreSnapshots, runCommand, runHooks, sanitizeMemoryName, sanitizeName as sanitizeSessionName, saveApiKey, saveBaseUrl, scavengeToolCalls, sessionPath, sessionsDir, similarity, snapshotBeforeEdits, stripHallucinatedToolMarkup, tokenizeCommand, truncateForModel, truncateForModelByTokens, walkFilesStream, webFetch, webSearch, withUtf8Codepage, writeConfig, writeMeta, writeRecord };
2507
+ export { AT_MENTION_PATTERN, AT_PICKER_PREFIX, type AggregateOptions, AppendOnlyLog, type AppendUsageInput, type ApplyResult, type ApplyStatus, type AtMentionExpansion, type AtMentionOptions, type BridgeOptions, type BridgeResult, CODE_SYSTEM_PROMPT, CacheFirstLoop, type CacheFirstLoopOptions, type CallToolResult, type ChatMessage, type ChatResponse, type ChoiceOption, ChoiceRequestedError, type ChoiceToolOptions, type CodeSystemPromptOptions, DEFAULT_AT_DIR_MAX_ENTRIES, DEFAULT_AT_MENTION_MAX_BYTES, DEFAULT_MAX_RESULT_CHARS, DEFAULT_MAX_RESULT_TOKENS, DEFAULT_PICKER_IGNORE_DIRS, DEFAULT_SPAWN_STORM_THRESHOLD, DeepSeekClient, type DeepSeekClientOptions, type RenderOptions as DiffRenderOptions, type DiffReport, type DiffSide, type DirEntry, type EditBlock, type EditSnapshot, type EventRole, type FileWithStats, type FilesystemToolsOptions, type FlattenDecision, type FlattenOptions, type GetLatestVersionOptions, type GetPromptResult, HOOK_EVENTS, HOOK_SETTINGS_DIRNAME, HOOK_SETTINGS_FILENAME, type HookConfig, type HookEvent, type HookOutcome, type HookPayload, type HookReport, type HookScope, type HookSettings, type HookSpawnInput, type HookSpawnResult, type HookSpawner, ImmutablePrefix, type ImmutablePrefixOptions, type InitializeResult, type InspectionReport, type InstallSource, type JSONSchema, type JsonRpcMessage, type JsonRpcRequest, type JsonRpcResponse, LATEST_CACHE_TTL_MS, LATEST_FETCH_TIMEOUT_MS, type ListDirectoryOptions, type ListFilesOptions, type ListPromptsResult, type ListResourcesResult, type ListToolsResult, type LoadHookSettingsOptions, type LoopEvent, MCP_PROTOCOL_VERSION, MEMORY_INDEX_FILE, MEMORY_INDEX_MAX_CHARS, McpClient, type McpClientOptions, type McpContentBlock, type McpProgressHandler, type McpProgressInfo, type McpPrompt, type McpPromptArgument, type McpPromptMessage, type McpPromptResourceBlock, type McpResource, type McpResourceContents, type McpResourceContentsBlob, type McpResourceContentsText, type McpSpec, type McpTool, type McpToolSchema, type McpTransport, type MemoryEntry, type MemoryScope, MemoryStore, type MemoryStoreOptions, type MemoryToolsOptions, type MemoryType, type WriteInput as MemoryWriteInput, NeedsConfirmationError, PROJECT_MEMORY_FILE, PROJECT_MEMORY_FILES, PROJECT_MEMORY_MAX_CHARS, type PageContent, type ParsedAtQuery, type PickerCandidate, PlanProposedError, PlanRevisionProposedError, type PlanStep, type PlanStepRisk, type PlanToolOptions, type ProgressNotificationParams, type ProjectMemory, type RankPickerOptions, type ReadResourceResult, type ReadTranscriptResult, type ReasonixConfig, type ReconfigurableOptions, type RepairReport, type ReplayStats, type ResolvedHook, type RetryInfo, type RetryOptions, type Role, type RunCommandResult, type RunHooksOptions, type ScavengeOptions, type ScavengeResult, type SearchResult, type SectionResult, type SessionInfo, SessionStats, type SessionSummary, type ShellToolsOptions, type SpawnDistillation, type SseMcpSpec, SseTransport, type SseTransportOptions, type StdioMcpSpec, StdioTransport, type StdioTransportOptions, type StepCompletion, StormBreaker, type StreamChunk, type StreamWalkOptions, type StreamableHttpMcpSpec, StreamableHttpTransport, type StreamableHttpTransportOptions, type SubagentEvent, type SubagentResult, type SubagentResultLike, type SubagentSessionSummary, type SubagentSink, SubagentTelemetry, type SubagentToolOptions, type TodoItem, type TodoStatus, type TodoToolOptions, type ToolCall, type ToolCallContext, ToolCallRepair, type ToolCallRepairOptions, type ToolDefinition, type ToolFunctionSpec, ToolRegistry, type ToolSpec, type TranscriptMeta, type TranscriptRecord, type TruncationRepairResult, type TurnPair, type TurnStats, USER_MEMORY_DIR, Usage, type UsageAggregate, type UsageBucket, type UsageRecord, VERSION, VolatileScratch, type WebFetchOptions, type WebSearchOptions, type WebToolsOptions, aggregateUsage, analyzeSchema, appendSessionMessage, appendUsage, applyEditBlock, applyEditBlocks, applyMemoryStack, applyProjectMemory, applyUserMemory, bridgeMcpTools, bucketCacheHitRatio, bucketSavingsFraction, claudeEquivalentCost, codeSystemPrompt, compareVersions, computeReplayStats, computeSpawnDistillation, costUsd, countSpawnStorms, decideOutcome, defaultConfigPath, defaultUsageLogPath, deleteSession, detectAtPicker, detectInstallSource, detectNpmInstallPrefix, detectShellOperator, diffTranscripts, expandAtMentions, fetchWithRetry, findProjectMemoryPath, fixToolCallPairing, flattenMcpResult, flattenSchema, forkRegistryExcluding, formatCommandResult, formatHookOutcomeMessage, formatLogSize, formatLoopError, formatSearchResults, getLatestVersion, globalSettingsPath, healLoadedMessages, healLoadedMessagesByTokens, htmlToText, injectPowerShellUtf8, inputCostUsd, inspectMcpServer, isAllowed, isJsonRpcError, isNpxInstall, isPlausibleKey, listDirectory, listFilesSync, listFilesWithStatsAsync, listFilesWithStatsSync, listSessions, loadApiKey, loadBaseUrl, loadDotenv, loadHooks, loadMetasoApiKey, loadSessionMessages, matchesTool, memoryEnabled, nestArguments, openTranscriptFile, outputCostUsd, parseAtQuery, parseEditBlocks, parseMcpSpec, parseMojeekResults, parseSearxngHtmlResults, parseTranscript, prepareSpawn, projectHash, projectSettingsPath, quoteForCmdExe, rankPickerCandidates, readConfig, readProjectMemory, readTranscript, readUsageLog, recordFromLoopEvent, redactKey, registerChoiceTool, registerFilesystemTools, registerMemoryTools, registerPlanTool, registerShellTools, registerSubagentTool, registerTodoTool, registerWebTools, renderMarkdown as renderDiffMarkdown, renderSummaryTable as renderDiffSummary, repairTruncatedJson, replayFromFile, resolveExecutable, resolveProjectMemoryWritePath, restoreSnapshots, runCommand, runHooks, sanitizeMemoryName, sanitizeName as sanitizeSessionName, saveApiKey, saveBaseUrl, scavengeToolCalls, sessionPath, sessionsDir, similarity, snapshotBeforeEdits, stripHallucinatedToolMarkup, summarizeSubagentSession, tokenizeCommand, truncateForModel, truncateForModelByTokens, walkFilesStream, webFetch, webSearch, withUtf8Codepage, writeConfig, writeMeta, writeRecord };