@bolloon/bolloon-agent 0.3.30 → 0.3.32

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 (220) hide show
  1. package/dist/agents/pi-sdk-tools.js +128 -0
  2. package/dist/cli/ink-app.js +345 -2
  3. package/dist/cli/mention-data.js +238 -0
  4. package/dist/constraint-runtime/_archive_helper.d.ts +1 -0
  5. package/dist/constraint-runtime/_archive_helper.js +9 -0
  6. package/dist/constraint-runtime/agent/coordinator.d.ts +19 -0
  7. package/dist/constraint-runtime/agent/coordinator.js +48 -0
  8. package/dist/constraint-runtime/agent/index.d.ts +1 -0
  9. package/dist/constraint-runtime/agent/index.js +1 -0
  10. package/dist/constraint-runtime/assistant/index.d.ts +11 -0
  11. package/dist/constraint-runtime/assistant/index.js +12 -0
  12. package/dist/constraint-runtime/bootstrap/index.d.ts +11 -0
  13. package/dist/constraint-runtime/bootstrap/index.js +12 -0
  14. package/dist/constraint-runtime/bootstrap_graph.d.ts +4 -0
  15. package/dist/constraint-runtime/bootstrap_graph.js +13 -0
  16. package/dist/constraint-runtime/bridge/index.d.ts +11 -0
  17. package/dist/constraint-runtime/bridge/index.js +12 -0
  18. package/dist/constraint-runtime/buddy/index.d.ts +11 -0
  19. package/dist/constraint-runtime/buddy/index.js +12 -0
  20. package/dist/constraint-runtime/cli/index.d.ts +11 -0
  21. package/dist/constraint-runtime/cli/index.js +12 -0
  22. package/dist/constraint-runtime/command_graph.d.ts +7 -0
  23. package/dist/constraint-runtime/command_graph.js +10 -0
  24. package/dist/constraint-runtime/commands.d.ts +15 -0
  25. package/dist/constraint-runtime/commands.js +60 -0
  26. package/dist/constraint-runtime/components/index.d.ts +11 -0
  27. package/dist/constraint-runtime/components/index.js +12 -0
  28. package/dist/constraint-runtime/constants/index.d.ts +11 -0
  29. package/dist/constraint-runtime/constants/index.js +12 -0
  30. package/dist/constraint-runtime/constraint/budget.d.ts +11 -0
  31. package/dist/constraint-runtime/constraint/budget.js +22 -0
  32. package/dist/constraint-runtime/constraint/index.d.ts +3 -0
  33. package/dist/constraint-runtime/constraint/index.js +2 -0
  34. package/dist/constraint-runtime/constraint/permission.d.ts +9 -0
  35. package/dist/constraint-runtime/constraint/permission.js +20 -0
  36. package/dist/constraint-runtime/context.d.ts +12 -0
  37. package/dist/constraint-runtime/context.js +30 -0
  38. package/dist/constraint-runtime/coordinator/index.d.ts +11 -0
  39. package/dist/constraint-runtime/coordinator/index.js +12 -0
  40. package/dist/constraint-runtime/cost_hook.d.ts +2 -0
  41. package/dist/constraint-runtime/cost_hook.js +4 -0
  42. package/dist/constraint-runtime/cost_tracker.d.ts +5 -0
  43. package/dist/constraint-runtime/cost_tracker.js +8 -0
  44. package/dist/constraint-runtime/deferred_init.d.ts +8 -0
  45. package/dist/constraint-runtime/deferred_init.js +10 -0
  46. package/dist/constraint-runtime/direct_modes.d.ts +7 -0
  47. package/dist/constraint-runtime/direct_modes.js +6 -0
  48. package/dist/constraint-runtime/dynamic-tool-loader.d.ts +13 -0
  49. package/dist/constraint-runtime/dynamic-tool-loader.js +85 -0
  50. package/dist/constraint-runtime/entrypoints/index.d.ts +11 -0
  51. package/dist/constraint-runtime/entrypoints/index.js +12 -0
  52. package/dist/constraint-runtime/execution_registry.d.ts +20 -0
  53. package/dist/constraint-runtime/execution_registry.js +44 -0
  54. package/dist/constraint-runtime/history.d.ts +9 -0
  55. package/dist/constraint-runtime/history.js +9 -0
  56. package/dist/constraint-runtime/hooks/index.d.ts +11 -0
  57. package/dist/constraint-runtime/hooks/index.js +12 -0
  58. package/dist/constraint-runtime/index.d.ts +26 -0
  59. package/dist/constraint-runtime/index.js +26 -0
  60. package/dist/constraint-runtime/ink.d.ts +1 -0
  61. package/dist/constraint-runtime/ink.js +4 -0
  62. package/dist/constraint-runtime/keybindings/index.d.ts +11 -0
  63. package/dist/constraint-runtime/keybindings/index.js +12 -0
  64. package/dist/constraint-runtime/memdir/index.d.ts +11 -0
  65. package/dist/constraint-runtime/memdir/index.js +12 -0
  66. package/dist/constraint-runtime/migrations/index.d.ts +11 -0
  67. package/dist/constraint-runtime/migrations/index.js +12 -0
  68. package/dist/constraint-runtime/models.d.ts +42 -0
  69. package/dist/constraint-runtime/models.js +1 -0
  70. package/dist/constraint-runtime/moreright/index.d.ts +11 -0
  71. package/dist/constraint-runtime/moreright/index.js +12 -0
  72. package/dist/constraint-runtime/native_ts/index.d.ts +11 -0
  73. package/dist/constraint-runtime/native_ts/index.js +12 -0
  74. package/dist/constraint-runtime/output_styles/index.d.ts +11 -0
  75. package/dist/constraint-runtime/output_styles/index.js +12 -0
  76. package/dist/constraint-runtime/parity_audit.d.ts +11 -0
  77. package/dist/constraint-runtime/parity_audit.js +12 -0
  78. package/dist/constraint-runtime/plugins/index.d.ts +11 -0
  79. package/dist/constraint-runtime/plugins/index.js +12 -0
  80. package/dist/constraint-runtime/port_manifest.d.ts +7 -0
  81. package/dist/constraint-runtime/port_manifest.js +11 -0
  82. package/dist/constraint-runtime/prefetch.d.ts +8 -0
  83. package/dist/constraint-runtime/prefetch.js +9 -0
  84. package/dist/constraint-runtime/query.d.ts +6 -0
  85. package/dist/constraint-runtime/query.js +1 -0
  86. package/dist/constraint-runtime/reference_data/archive_surface_snapshot.json +63 -0
  87. package/dist/constraint-runtime/reference_data/commands_snapshot.json +1037 -0
  88. package/dist/constraint-runtime/reference_data/subsystems/assistant.json +8 -0
  89. package/dist/constraint-runtime/reference_data/subsystems/bootstrap.json +8 -0
  90. package/dist/constraint-runtime/reference_data/subsystems/bridge.json +32 -0
  91. package/dist/constraint-runtime/reference_data/subsystems/buddy.json +13 -0
  92. package/dist/constraint-runtime/reference_data/subsystems/cli.json +26 -0
  93. package/dist/constraint-runtime/reference_data/subsystems/components.json +32 -0
  94. package/dist/constraint-runtime/reference_data/subsystems/constants.json +28 -0
  95. package/dist/constraint-runtime/reference_data/subsystems/coordinator.json +8 -0
  96. package/dist/constraint-runtime/reference_data/subsystems/entrypoints.json +15 -0
  97. package/dist/constraint-runtime/reference_data/subsystems/hooks.json +32 -0
  98. package/dist/constraint-runtime/reference_data/subsystems/keybindings.json +21 -0
  99. package/dist/constraint-runtime/reference_data/subsystems/memdir.json +15 -0
  100. package/dist/constraint-runtime/reference_data/subsystems/migrations.json +18 -0
  101. package/dist/constraint-runtime/reference_data/subsystems/moreright.json +8 -0
  102. package/dist/constraint-runtime/reference_data/subsystems/native_ts.json +11 -0
  103. package/dist/constraint-runtime/reference_data/subsystems/outputStyles.json +8 -0
  104. package/dist/constraint-runtime/reference_data/subsystems/plugins.json +9 -0
  105. package/dist/constraint-runtime/reference_data/subsystems/remote.json +11 -0
  106. package/dist/constraint-runtime/reference_data/subsystems/schemas.json +8 -0
  107. package/dist/constraint-runtime/reference_data/subsystems/screens.json +10 -0
  108. package/dist/constraint-runtime/reference_data/subsystems/server.json +10 -0
  109. package/dist/constraint-runtime/reference_data/subsystems/services.json +32 -0
  110. package/dist/constraint-runtime/reference_data/subsystems/skills.json +27 -0
  111. package/dist/constraint-runtime/reference_data/subsystems/state.json +13 -0
  112. package/dist/constraint-runtime/reference_data/subsystems/types.json +18 -0
  113. package/dist/constraint-runtime/reference_data/subsystems/upstreamproxy.json +9 -0
  114. package/dist/constraint-runtime/reference_data/subsystems/utils.json +32 -0
  115. package/dist/constraint-runtime/reference_data/subsystems/vim.json +12 -0
  116. package/dist/constraint-runtime/reference_data/subsystems/voice.json +8 -0
  117. package/dist/constraint-runtime/reference_data/tools_snapshot.json +922 -0
  118. package/dist/constraint-runtime/remote/index.d.ts +11 -0
  119. package/dist/constraint-runtime/remote/index.js +12 -0
  120. package/dist/constraint-runtime/remote_runtime.d.ts +8 -0
  121. package/dist/constraint-runtime/remote_runtime.js +9 -0
  122. package/dist/constraint-runtime/runtime/index.d.ts +1 -0
  123. package/dist/constraint-runtime/runtime/index.js +1 -0
  124. package/dist/constraint-runtime/runtime/session.d.ts +22 -0
  125. package/dist/constraint-runtime/runtime/session.js +35 -0
  126. package/dist/constraint-runtime/schemas/index.d.ts +11 -0
  127. package/dist/constraint-runtime/schemas/index.js +12 -0
  128. package/dist/constraint-runtime/screens/index.d.ts +11 -0
  129. package/dist/constraint-runtime/screens/index.js +12 -0
  130. package/dist/constraint-runtime/server/index.d.ts +11 -0
  131. package/dist/constraint-runtime/server/index.js +12 -0
  132. package/dist/constraint-runtime/services/index.d.ts +11 -0
  133. package/dist/constraint-runtime/services/index.js +12 -0
  134. package/dist/constraint-runtime/session_store.d.ts +8 -0
  135. package/dist/constraint-runtime/session_store.js +22 -0
  136. package/dist/constraint-runtime/setup.d.ts +19 -0
  137. package/dist/constraint-runtime/setup.js +30 -0
  138. package/dist/constraint-runtime/skills/index.d.ts +1 -0
  139. package/dist/constraint-runtime/skills/index.js +1 -0
  140. package/dist/constraint-runtime/skills/skill-registry.d.ts +14 -0
  141. package/dist/constraint-runtime/skills/skill-registry.js +28 -0
  142. package/dist/constraint-runtime/state/index.d.ts +11 -0
  143. package/dist/constraint-runtime/state/index.js +12 -0
  144. package/dist/constraint-runtime/system_init.d.ts +1 -0
  145. package/dist/constraint-runtime/system_init.js +20 -0
  146. package/dist/constraint-runtime/thinking/engine.d.ts +20 -0
  147. package/dist/constraint-runtime/thinking/engine.js +42 -0
  148. package/dist/constraint-runtime/thinking/index.d.ts +1 -0
  149. package/dist/constraint-runtime/thinking/index.js +1 -0
  150. package/dist/constraint-runtime/tool_pool.d.ts +8 -0
  151. package/dist/constraint-runtime/tool_pool.js +8 -0
  152. package/dist/constraint-runtime/tools/OpenCLI/execAdapter.d.ts +9 -0
  153. package/dist/constraint-runtime/tools/OpenCLI/execAdapter.js +7 -0
  154. package/dist/constraint-runtime/tools/OpenCLI/listAdapters.d.ts +5 -0
  155. package/dist/constraint-runtime/tools/OpenCLI/listAdapters.js +7 -0
  156. package/dist/constraint-runtime/tools/OpenCLI/runCommand.d.ts +10 -0
  157. package/dist/constraint-runtime/tools/OpenCLI/runCommand.js +7 -0
  158. package/dist/constraint-runtime/tools/PolymarketSDK/cancelOrder.d.ts +17 -0
  159. package/dist/constraint-runtime/{src/tools → tools}/PolymarketSDK/cancelOrder.js +4 -7
  160. package/dist/constraint-runtime/tools/PolymarketSDK/clobShared.d.ts +50 -0
  161. package/dist/constraint-runtime/tools/PolymarketSDK/clobShared.js +78 -0
  162. package/dist/constraint-runtime/tools/PolymarketSDK/createOrder.d.ts +31 -0
  163. package/dist/constraint-runtime/{src/tools → tools}/PolymarketSDK/createOrder.js +9 -12
  164. package/dist/constraint-runtime/tools/PolymarketSDK/getMarket.d.ts +10 -0
  165. package/dist/constraint-runtime/tools/PolymarketSDK/getMarket.js +16 -0
  166. package/dist/constraint-runtime/tools/PolymarketSDK/getOrders.d.ts +16 -0
  167. package/dist/constraint-runtime/tools/PolymarketSDK/getOrders.js +25 -0
  168. package/dist/constraint-runtime/tools/PolymarketSDK/listMarkets.d.ts +23 -0
  169. package/dist/constraint-runtime/tools/PolymarketSDK/listMarkets.js +24 -0
  170. package/dist/constraint-runtime/tools/SafeSDK/confirmTransaction.d.ts +10 -0
  171. package/dist/constraint-runtime/tools/SafeSDK/confirmTransaction.js +6 -0
  172. package/dist/constraint-runtime/tools/SafeSDK/createTransaction.d.ts +14 -0
  173. package/dist/constraint-runtime/tools/SafeSDK/createTransaction.js +8 -0
  174. package/dist/constraint-runtime/tools/SafeSDK/deploySafe.d.ts +10 -0
  175. package/dist/constraint-runtime/tools/SafeSDK/executeTransaction.d.ts +9 -0
  176. package/dist/constraint-runtime/tools/SafeSDK/executeTransaction.js +6 -0
  177. package/dist/constraint-runtime/tools/SafeSDK/getBalance.d.ts +7 -0
  178. package/dist/constraint-runtime/tools/SafeSDK/getBalance.js +6 -0
  179. package/dist/constraint-runtime/tools/SafeSDK/getPendingTransactions.d.ts +7 -0
  180. package/dist/constraint-runtime/tools/SafeSDK/getPendingTransactions.js +6 -0
  181. package/dist/constraint-runtime/tools/SafeSDK/proposeTransaction.d.ts +11 -0
  182. package/dist/constraint-runtime/tools/SafeSDK/proposeTransaction.js +6 -0
  183. package/dist/constraint-runtime/tools/WalletTools/autoPay.d.ts +26 -0
  184. package/dist/constraint-runtime/tools/WalletTools/createWallet.d.ts +7 -0
  185. package/dist/constraint-runtime/tools/WalletTools/getBalance.d.ts +11 -0
  186. package/dist/constraint-runtime/tools/WalletTools/importWallet.d.ts +10 -0
  187. package/dist/constraint-runtime/tools/WalletTools/sendTransaction.d.ts +20 -0
  188. package/dist/constraint-runtime/tools/WalletTools/signMessage.d.ts +10 -0
  189. package/dist/constraint-runtime/tools/WalletTools/transferToken.d.ts +17 -0
  190. package/dist/constraint-runtime/tools.d.ts +14 -0
  191. package/dist/constraint-runtime/tools.js +80 -0
  192. package/dist/constraint-runtime/transcript.d.ts +8 -0
  193. package/dist/constraint-runtime/transcript.js +19 -0
  194. package/dist/constraint-runtime/types/index.d.ts +11 -0
  195. package/dist/constraint-runtime/types/index.js +12 -0
  196. package/dist/constraint-runtime/upstream_proxy/index.d.ts +11 -0
  197. package/dist/constraint-runtime/upstream_proxy/index.js +12 -0
  198. package/dist/constraint-runtime/utils/index.d.ts +11 -0
  199. package/dist/constraint-runtime/utils/index.js +12 -0
  200. package/dist/constraint-runtime/vim/index.d.ts +11 -0
  201. package/dist/constraint-runtime/vim/index.js +12 -0
  202. package/dist/constraint-runtime/voice/index.d.ts +11 -0
  203. package/dist/constraint-runtime/voice/index.js +12 -0
  204. package/dist/index.js +7 -4
  205. package/dist/llm/config-store.js +39 -28
  206. package/dist/llm/pi-ai.js +64 -36
  207. package/dist/security/tool-gate.js +2 -0
  208. package/package.json +3 -2
  209. package/dist/constraint-runtime/src/tools/PolymarketSDK/clobShared.js +0 -104
  210. package/dist/constraint-runtime/src/tools/PolymarketSDK/getMarket.js +0 -5
  211. package/dist/constraint-runtime/src/tools/PolymarketSDK/getOrders.js +0 -19
  212. package/dist/constraint-runtime/src/tools/PolymarketSDK/listMarkets.js +0 -4
  213. /package/dist/constraint-runtime/{src/tools → tools}/SafeSDK/deploySafe.js +0 -0
  214. /package/dist/constraint-runtime/{src/tools → tools}/WalletTools/autoPay.js +0 -0
  215. /package/dist/constraint-runtime/{src/tools → tools}/WalletTools/createWallet.js +0 -0
  216. /package/dist/constraint-runtime/{src/tools → tools}/WalletTools/getBalance.js +0 -0
  217. /package/dist/constraint-runtime/{src/tools → tools}/WalletTools/importWallet.js +0 -0
  218. /package/dist/constraint-runtime/{src/tools → tools}/WalletTools/sendTransaction.js +0 -0
  219. /package/dist/constraint-runtime/{src/tools → tools}/WalletTools/signMessage.js +0 -0
  220. /package/dist/constraint-runtime/{src/tools → tools}/WalletTools/transferToken.js +0 -0
@@ -948,6 +948,134 @@ export function registerBuiltinTools(ctx) {
948
948
  }
949
949
  }
950
950
  });
951
+ // ============================================================
952
+ // Web 上网工具 (2026-08-04) — fetch_url + web_search
953
+ // 用 undici request (独立连接池, 与 pi-ai 一致, 避开全局 fetch 僵尸连接问题)
954
+ // ============================================================
955
+ ctx.tools.set('fetch_url', {
956
+ name: 'fetch_url',
957
+ description: '抓取一个 URL 的网页内容并转成纯文本. 适合查文档/新闻/API 页面. 返回前 4000 字符. HTML 自动去标签, JSON/文本原样返回. (走 curl, 兼容 TLS 指纹风控)',
958
+ parameters: { url: '完整 URL (必填, 含 https://)' },
959
+ execute: async (args) => {
960
+ try {
961
+ const url = String(args.url || '').trim();
962
+ if (!url)
963
+ return { success: false, error: 'url 必填' };
964
+ if (!/^https?:\/\//i.test(url))
965
+ return { success: false, error: 'url 必须以 http(s):// 开头' };
966
+ const { execFile } = await import('child_process');
967
+ const { promisify } = await import('util');
968
+ const pExecFile = promisify(execFile);
969
+ const { stdout, stderr } = await pExecFile('curl', [
970
+ '-sL', '--max-time', '25',
971
+ '-A', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0 Safari/537.36',
972
+ '-H', 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8',
973
+ url,
974
+ ], { maxBuffer: 2 * 1024 * 1024, timeout: 30_000 });
975
+ if (!stdout && stderr)
976
+ return { success: false, error: `fetch_url 失败: ${String(stderr).slice(0, 200)}` };
977
+ const raw = stdout.slice(0, 60_000);
978
+ const trimmed = raw.trimStart();
979
+ let text;
980
+ if (trimmed.startsWith('<!doctype') || trimmed.startsWith('<html') || /^<\?xml/i.test(trimmed)) {
981
+ text = raw
982
+ .replace(/<script[\s\S]*?<\/script>/gi, ' ')
983
+ .replace(/<style[\s\S]*?<\/style>/gi, ' ')
984
+ .replace(/<[^>]+>/g, ' ')
985
+ .replace(/&nbsp;/g, ' ').replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&quot;/g, '"').replace(/&#39;/g, "'")
986
+ .replace(/\s+/g, ' ')
987
+ .trim();
988
+ }
989
+ else {
990
+ text = raw;
991
+ }
992
+ const out = text.slice(0, 4000);
993
+ return { success: true, output: `🌐 ${url} (${raw.length} bytes):\n${out}${text.length > 4000 ? '\n...(截断, 共 ' + text.length + ' 字符)' : ''}` };
994
+ }
995
+ catch (e) {
996
+ return { success: false, error: `fetch_url 失败: ${String(e?.message || e).slice(0, 200)}` };
997
+ }
998
+ }
999
+ });
1000
+ ctx.tools.set('web_search', {
1001
+ name: 'web_search',
1002
+ description: '网页搜索. 无 key 时走 DuckDuckGo Instant Answer API + Wikipedia (知识/资讯查询可靠); 配置 TAVILY_API_KEY 时走 Tavily 完整搜索 (更全). 返回前 8 条标题+URL+摘要.',
1003
+ parameters: { query: '搜索词 (必填)' },
1004
+ execute: async (args) => {
1005
+ try {
1006
+ const query = String(args.query || '').trim();
1007
+ if (!query)
1008
+ return { success: false, error: 'query 必填' };
1009
+ const { execFile } = await import('child_process');
1010
+ const { promisify } = await import('util');
1011
+ const pExecFile = promisify(execFile);
1012
+ const UA = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36';
1013
+ const curlJson = async (url) => {
1014
+ const r = await pExecFile('curl', ['-s', '--max-time', '15', '-A', UA, url], { maxBuffer: 4 * 1024 * 1024, timeout: 20_000 });
1015
+ return JSON.parse(r.stdout);
1016
+ };
1017
+ // 引擎 0: Tavily (配了 TAVILY_API_KEY 时最完整)
1018
+ const tavilyKey = process.env.TAVILY_API_KEY || '';
1019
+ if (tavilyKey) {
1020
+ const r = await pExecFile('curl', [
1021
+ '-s', '--max-time', '20', '-A', UA,
1022
+ '-X', 'POST', 'https://api.tavily.com/search',
1023
+ '-H', 'Content-Type: application/json',
1024
+ '-d', JSON.stringify({ api_key: tavilyKey, query, max_results: 8, include_answer: true }),
1025
+ ], { maxBuffer: 4 * 1024 * 1024, timeout: 25_000 });
1026
+ const d = JSON.parse(r.stdout);
1027
+ const results = d.results || [];
1028
+ if (results.length > 0) {
1029
+ const lines = results.slice(0, 8).map((x, i) => `${i + 1}. ${x.title}\n ${x.url}${x.content ? '\n ' + String(x.content).replace(/\s+/g, ' ').slice(0, 150) : ''}`);
1030
+ const answer = d.answer ? `\n📌 ${d.answer}\n` : '';
1031
+ return { success: true, output: `🔎 "${query}" 结果 ${results.length} 条 (Tavily):${answer}\n\n${lines.join('\n\n')}` };
1032
+ }
1033
+ }
1034
+ // 引擎 1: DuckDuckGo Instant Answer API (摘要 + 相关主题)
1035
+ try {
1036
+ const ia = await curlJson(`https://api.duckduckgo.com/?q=${encodeURIComponent(query)}&format=json&no_html=1`);
1037
+ const out = [];
1038
+ if (ia.AbstractText && ia.AbstractURL) {
1039
+ out.push(`📖 ${ia.AbstractText.slice(0, 400)}\n ${ia.AbstractURL}`);
1040
+ }
1041
+ const topics = Array.isArray(ia.RelatedTopics) ? ia.RelatedTopics : [];
1042
+ for (const t of topics) {
1043
+ if (out.length >= 8)
1044
+ break;
1045
+ if (t.Topics) { // 分类组
1046
+ for (const sub of t.Topics) {
1047
+ if (out.length >= 8)
1048
+ break;
1049
+ if (sub.Text && sub.FirstURL)
1050
+ out.push(`${out.length + 1}. ${sub.Text.slice(0, 200)}\n ${sub.FirstURL}`);
1051
+ }
1052
+ }
1053
+ else if (t.Text && t.FirstURL) {
1054
+ out.push(`${out.length + 1}. ${t.Text.slice(0, 200)}\n ${t.FirstURL}`);
1055
+ }
1056
+ }
1057
+ if (out.length > 0) {
1058
+ return { success: true, output: `🔎 "${query}" (DuckDuckGo):\n\n${out.join('\n\n')}` };
1059
+ }
1060
+ }
1061
+ catch { /* fallback */ }
1062
+ // 引擎 2: Wikipedia 搜索 API
1063
+ try {
1064
+ const wiki = await curlJson(`https://zh.wikipedia.org/w/api.php?action=query&list=search&srsearch=${encodeURIComponent(query)}&format=json&srlimit=5`);
1065
+ const hits = wiki?.query?.search || [];
1066
+ if (hits.length > 0) {
1067
+ const lines = hits.map((h, i) => `${i + 1}. ${h.title}\n https://zh.wikipedia.org/wiki/${encodeURIComponent(h.title.replace(/ /g, '_'))}\n ${String(h.snippet || '').replace(/<[^>]+>/g, '').slice(0, 120)}`);
1068
+ return { success: true, output: `🔎 "${query}" (维基百科 ${hits.length} 条):\n\n${lines.join('\n\n')}` };
1069
+ }
1070
+ }
1071
+ catch { /* fallback */ }
1072
+ return { success: true, output: `🔎 "${query}" 无结果 (免费引擎无匹配, 可配 TAVILY_API_KEY 提升覆盖)` };
1073
+ }
1074
+ catch (e) {
1075
+ return { success: false, error: `web_search 失败: ${String(e?.message || e).slice(0, 200)}` };
1076
+ }
1077
+ }
1078
+ });
951
1079
  ctx.tools.set('git_log', {
952
1080
  name: 'git_log',
953
1081
  description: '查看 git log. 默认 --oneline -10. 支持过滤和范围.',
@@ -3,11 +3,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  * ink-app.tsx — Ink (React for CLI) 渲染入口
4
4
  *
5
5
  * 用 Yoga flexbox 布局实现: 内容置顶, 输入栏固定底部, 状态栏固定
6
+ *
7
+ * 2026-08-05: @ / # 弹出选择窗 — 输入 @ 命中智能体, / 命中命令+技能+插件, # 命中文件
8
+ * ↑/↓ 导航, Tab/Enter 选中, Esc 关闭, 弹出窗打开时 TextInput 让出焦点 (focus=false)
6
9
  */
7
- import { useState, useEffect, useCallback, useRef } from 'react';
10
+ import { useState, useEffect, useCallback, useRef, useMemo } from 'react';
8
11
  import { render, Box, Text, useInput, useApp } from 'ink';
9
12
  import TextInput from 'ink-text-input';
10
13
  import { brandArtLines, boxTop, boxRow, boxBottom, dispWidth } from './loading-tui.js';
14
+ import { loadAgents, loadCommands, loadSkills, loadPlugins, loadFiles, getMention, matchFileScore, } from './mention-data.js';
11
15
  // ─── 组件: Logo Box ──────────────────────────────────────────────────────────
12
16
  const LogoBox = ({ width }) => {
13
17
  const art = brandArtLines();
@@ -24,6 +28,17 @@ const Messages = ({ msgs }) => (_jsx(Box, { flexDirection: "column", flexGrow: 1
24
28
  const clean = m.replace(/\x1b\[[0-9;]*m/g, '');
25
29
  return clean.trim() ? _jsx(Text, { children: clean ? m : '' }, i) : null;
26
30
  }) }));
31
+ const MentionPopup = ({ title, items, sel, width, loading }) => {
32
+ const MAX_ROWS = 8;
33
+ const shown = items.slice(0, MAX_ROWS);
34
+ const innerW = Math.max(width - 2, 10);
35
+ return (_jsxs(Box, { flexDirection: "column", width: width, children: [_jsx(Text, { color: "cyan", bold: true, children: `╭─ ${title} ${'─'.repeat(Math.max(2, innerW - dispWidth(title) - 4))}╮` }), loading && items.length === 0 ? (_jsx(Text, { color: "dim", children: "\u2502 \u626B\u63CF\u4E2D..." })) : !loading && items.length === 0 ? (_jsx(Text, { color: "dim", children: "\u2502 \u65E0\u5339\u914D" })) : (shown.map((it, i) => {
36
+ const active = i === sel;
37
+ const label = it.kind === 'file' ? it.label : `${it.kind === 'skill' ? '⚡' : it.kind === 'plugin' ? '🔌' : ''}${it.label}`;
38
+ const hint = it.hint ? `${it.hint}` : it.kind === 'file' ? '文件' : '';
39
+ return (_jsxs(Box, { width: innerW, children: [_jsx(Text, { color: active ? 'black' : undefined, backgroundColor: active ? 'cyan' : undefined, children: `${active ? '❯ ' : ' '}${label}` }), _jsx(Text, { color: active ? 'black' : 'dim', backgroundColor: active ? 'cyan' : undefined, dimColor: !active, children: ` ${hint}` })] }, `${it.kind}:${it.label}`));
40
+ })), items.length > MAX_ROWS && (_jsxs(Text, { color: "dim", children: ["\u2502 \u8FD8\u6709 ", items.length - MAX_ROWS, " \u9879..."] })), _jsx(Text, { color: "cyan", children: `╰${'─'.repeat(innerW)}╯` })] }));
41
+ };
27
42
  const InkApp = ({ onPrompt, initialStatus, getStatusUpdate, terminalW, terminalH }) => {
28
43
  const [input, setInput] = useState('');
29
44
  const [msgs, setMsgs] = useState([]);
@@ -34,6 +49,206 @@ const InkApp = ({ onPrompt, initialStatus, getStatusUpdate, terminalW, terminalH
34
49
  // 双击 Esc 退出当前进程 (500ms 窗口内第二次按下)
35
50
  const lastEscRef = useRef(0);
36
51
  const C_WARN_ANSI = '\x1b[38;2;245;158;11m'; // #f59e0b
52
+ // ── @ / # 弹出窗状态 ──────────────────────────────────────────────────────
53
+ const mention = useMemo(() => getMention(input), [input]);
54
+ const mentionKey = mention ? `${mention.kind}:${mention.start}` : null;
55
+ const [items, setItems] = useState([]);
56
+ const [sel, setSel] = useState(0);
57
+ const [dismissed, setDismissed] = useState(null);
58
+ const [loadingFiles, setLoadingFiles] = useState(false);
59
+ // Tab 补齐弹窗 (非 @ / # 触发的普通 token 补齐): { start, items }
60
+ const [tabState, setTabState] = useState(null);
61
+ const agentCache = useRef(null);
62
+ const skillCache = useRef(null);
63
+ const pluginCache = useRef(null);
64
+ const fileCache = useRef(null);
65
+ // ── 输入历史 (↑/↓ 切换) ───────────────────────────────────────────────────
66
+ const historyRef = useRef([]);
67
+ const historyIdxRef = useRef(-1); // -1 = 正在编辑新草稿
68
+ const draftRef = useRef('');
69
+ // 加载当前 mention 的候选 (agent/command 缓存一次; file 每次打开重扫)
70
+ useEffect(() => {
71
+ if (tabState) {
72
+ setItems(tabState.items);
73
+ setSel(0);
74
+ return;
75
+ }
76
+ if (!mention || !mentionKey) {
77
+ setItems([]);
78
+ return;
79
+ }
80
+ if (dismissed === mentionKey) {
81
+ setItems([]);
82
+ return;
83
+ }
84
+ let cancelled = false;
85
+ if (mention.kind === 'agent') {
86
+ if (agentCache.current) {
87
+ setItems(agentCache.current);
88
+ }
89
+ else {
90
+ loadAgents()
91
+ .then(list => { agentCache.current = list; if (!cancelled)
92
+ setItems(list); })
93
+ .catch(() => { if (!cancelled)
94
+ setItems([]); });
95
+ }
96
+ }
97
+ else if (mention.kind === 'command') {
98
+ // 命令立即显示, 技能/插件异步合并
99
+ const base = loadCommands();
100
+ setItems(base);
101
+ const skillsP = skillCache.current
102
+ ? Promise.resolve(skillCache.current)
103
+ : loadSkills().then(s => { skillCache.current = s; return s; });
104
+ const pluginsP = pluginCache.current
105
+ ? Promise.resolve(pluginCache.current)
106
+ : loadPlugins().then(p => { pluginCache.current = p; return p; });
107
+ Promise.all([skillsP, pluginsP])
108
+ .then(([sk, pl]) => {
109
+ if (cancelled)
110
+ return;
111
+ const merged = [...base];
112
+ for (const it of [...sk, ...pl]) {
113
+ if (!merged.some(m => m.kind === it.kind && m.label === it.label))
114
+ merged.push(it);
115
+ }
116
+ setItems(merged);
117
+ })
118
+ .catch(() => { });
119
+ }
120
+ else {
121
+ // file: 每次打开重扫 (cwd 可能变化)
122
+ setLoadingFiles(true);
123
+ loadFiles(mention.query)
124
+ .then(list => { if (!cancelled) {
125
+ fileCache.current = list;
126
+ setItems(list);
127
+ setLoadingFiles(false);
128
+ } })
129
+ .catch(() => { if (!cancelled) {
130
+ setItems([]);
131
+ setLoadingFiles(false);
132
+ } });
133
+ }
134
+ setSel(0);
135
+ return () => { cancelled = true; };
136
+ }, [mentionKey, dismissed, tabState]);
137
+ // 按查询过滤 + 排序
138
+ const filtered = useMemo(() => {
139
+ if (tabState)
140
+ return items; // Tab 补齐: 已按前缀过滤好
141
+ if (!mention)
142
+ return [];
143
+ const q = mention.query.toLowerCase();
144
+ if (!q)
145
+ return items;
146
+ if (mention.kind === 'file') {
147
+ return items
148
+ .filter(it => matchFileScore(it.label.toLowerCase(), q) >= 0)
149
+ .sort((a, b) => matchFileScore(a.label.toLowerCase(), q) - matchFileScore(b.label.toLowerCase(), q));
150
+ }
151
+ return items.filter(it => it.label.toLowerCase().includes(q));
152
+ }, [items, mention, tabState]);
153
+ const popupOpen = !!(tabState || (mention && dismissed !== mentionKey));
154
+ const safeSel = Math.min(sel, Math.max(0, filtered.length - 1));
155
+ const popupTitle = tabState ? 'Tab 补齐'
156
+ : mention?.kind === 'agent' ? '@ 智能体'
157
+ : mention?.kind === 'file' ? '# 文件'
158
+ : '/ 命令 · 技能 · 插件';
159
+ // 在指定 start 位置插入补齐文本 (函数式更新, 闭包安全)
160
+ const insertAt = useCallback((start, it) => {
161
+ setInput(cur => {
162
+ if (start > cur.length)
163
+ return cur;
164
+ let insertText;
165
+ if (it.kind === 'agent')
166
+ insertText = '@' + it.insert + ' ';
167
+ else if (it.kind === 'file')
168
+ insertText = '#' + it.insert + ' ';
169
+ else if (it.kind === 'skill')
170
+ insertText = 'use_skill ' + it.insert + ' ';
171
+ else
172
+ insertText = '/' + it.insert + ' ';
173
+ return cur.slice(0, start) + insertText;
174
+ });
175
+ // TextInput 内部 cursorOffset 在值被重写后不重置 (2026-08-05 实测),
176
+ // 插入后强制重挂载让光标回到末尾; 仅此一处重挂载, 避免输入丢失窗口
177
+ setTiKey(k => k + 1);
178
+ }, []);
179
+ // 接受当前选中项 → 替换 token 插入输入
180
+ // 函数式更新 + 从最新 state 重新推导 mention (useInput 闭包可能陈旧, 2026-08-05)
181
+ const acceptMention = useCallback((it) => {
182
+ if (tabState) {
183
+ insertAt(tabState.start, it);
184
+ setTabState(null);
185
+ setDismissed(null);
186
+ return;
187
+ }
188
+ setInput(cur => {
189
+ const m = getMention(cur);
190
+ if (!m)
191
+ return cur;
192
+ let insertText;
193
+ if (it.kind === 'agent')
194
+ insertText = '@' + it.insert + ' ';
195
+ else if (it.kind === 'file')
196
+ insertText = '#' + it.insert + ' ';
197
+ else if (it.kind === 'skill')
198
+ insertText = 'use_skill ' + it.insert + ' ';
199
+ else
200
+ insertText = '/' + it.insert + ' ';
201
+ return cur.slice(0, m.start) + insertText;
202
+ });
203
+ setTiKey(k => k + 1);
204
+ setDismissed(null);
205
+ }, [tabState, insertAt]);
206
+ // Tab 命令补齐: 无触发符的普通 token 也补 (命令/技能/插件/智能体/文件)
207
+ const doTabCompletion = useCallback(() => {
208
+ const m = input.match(/(^|\s)([^\s]*)$/);
209
+ if (!m)
210
+ return;
211
+ const [, pre, token] = m;
212
+ const start = (m.index || 0) + pre.length;
213
+ const q = token.toLowerCase();
214
+ const items = [];
215
+ const add = (list) => {
216
+ for (const it of list) {
217
+ if (items.some(x => x.kind === it.kind && x.label === it.label))
218
+ continue;
219
+ if (it.label.toLowerCase().startsWith(q))
220
+ items.push(it);
221
+ }
222
+ };
223
+ if (q) {
224
+ add(loadCommands());
225
+ if (skillCache.current)
226
+ add(skillCache.current);
227
+ if (pluginCache.current)
228
+ add(pluginCache.current);
229
+ if (agentCache.current)
230
+ add(agentCache.current);
231
+ if (fileCache.current)
232
+ add(fileCache.current);
233
+ }
234
+ else {
235
+ // 空 token: 命令 + 技能 + 插件
236
+ add(loadCommands());
237
+ if (skillCache.current)
238
+ add(skillCache.current);
239
+ if (pluginCache.current)
240
+ add(pluginCache.current);
241
+ }
242
+ if (items.length === 1) {
243
+ insertAt(start, items[0]);
244
+ setTabState(null);
245
+ }
246
+ else if (items.length > 1) {
247
+ setTabState({ start, items });
248
+ setSel(0);
249
+ }
250
+ }, [input, insertAt]);
251
+ const [tiKey, setTiKey] = useState(0);
37
252
  // 全局: 思考动画控制
38
253
  useEffect(() => {
39
254
  globalThis.__inkSetThinking = (v) => setThinking(v);
@@ -53,6 +268,14 @@ const InkApp = ({ onPrompt, initialStatus, getStatusUpdate, terminalW, terminalH
53
268
  const trimmed = value.trim();
54
269
  if (!trimmed)
55
270
  return;
271
+ // 入历史 (去重最近一条, 上限 100)
272
+ const hist = historyRef.current;
273
+ if (hist[hist.length - 1] !== trimmed)
274
+ hist.push(trimmed);
275
+ if (hist.length > 100)
276
+ hist.shift();
277
+ historyIdxRef.current = -1;
278
+ draftRef.current = '';
56
279
  setInput('');
57
280
  // 用户消息由 processInput 统一通过 appendLine(renderUserMessage) 显示
58
281
  onPrompt(trimmed);
@@ -69,6 +292,97 @@ const InkApp = ({ onPrompt, initialStatus, getStatusUpdate, terminalW, terminalH
69
292
  requestExit();
70
293
  return;
71
294
  }
295
+ // ── 弹出窗打开: 全键接管 (TextInput focus=false 不处理) ──
296
+ if (popupOpen) {
297
+ if (key.upArrow) {
298
+ setSel(s => Math.max(0, s - 1));
299
+ return;
300
+ }
301
+ if (key.downArrow) {
302
+ setSel(s => Math.min(filtered.length - 1, s + 1));
303
+ return;
304
+ }
305
+ if ((key.tab || key.return) && filtered.length > 0) {
306
+ const it = filtered[safeSel];
307
+ if (it)
308
+ acceptMention(it);
309
+ return;
310
+ }
311
+ if (key.escape) {
312
+ if (tabState)
313
+ setTabState(null);
314
+ else
315
+ setDismissed(mentionKey);
316
+ return;
317
+ }
318
+ if (key.backspace || key.delete) {
319
+ setInput(cur => cur.slice(0, -1));
320
+ return;
321
+ }
322
+ // 粘贴/连发 chunk: Ink 把一次 stdin read 当单个 keypress (2026-08-05 实测)
323
+ // ① 连续退格 (\x7f×N) → 删 N 个字符
324
+ // ② 混合 chunk (退格+控制符, 含 ESC 序列) → 退格部分生效, ESC 序列忽略
325
+ // ③ 可打印 chunk (CJK/粘贴) → 整串追加
326
+ // 全部用函数式更新 — useInput 闭包可能陈旧 (实测), 函数式取最新 state
327
+ if (/^\x7f+$/.test(_input)) {
328
+ setInput(cur => cur.slice(0, Math.max(0, cur.length - _input.length)));
329
+ return;
330
+ }
331
+ if (/[\x00-\x1f\x7f]/.test(_input)) {
332
+ // 混合 chunk (退格+可打印): 逐字符处理; 含 ESC 序列 → 忽略整块 (箭头等由 TextInput 处理)
333
+ if (_input.includes('\u001b'))
334
+ return;
335
+ setInput(cur => {
336
+ let out = cur;
337
+ for (const ch of _input) {
338
+ if (ch === '\x7f')
339
+ out = out.slice(0, -1);
340
+ else if (/[\x00-\x1f]/.test(ch))
341
+ continue;
342
+ else
343
+ out += ch;
344
+ }
345
+ return out;
346
+ });
347
+ return;
348
+ }
349
+ if (_input && !key.ctrl && !key.meta) {
350
+ setInput(cur => cur + _input);
351
+ return;
352
+ }
353
+ return; // 其余键忽略
354
+ }
355
+ // ── 正常模式 ──
356
+ // Tab 命令补齐 (无触发符的普通 token 也补)
357
+ if (key.tab) {
358
+ doTabCompletion();
359
+ return;
360
+ }
361
+ // ↑/↓ 切换输入历史 (TextInput 本身忽略 up/down, 无冲突)
362
+ if (key.upArrow) {
363
+ const hist = historyRef.current;
364
+ if (hist.length === 0)
365
+ return;
366
+ if (historyIdxRef.current === -1)
367
+ draftRef.current = input;
368
+ if (historyIdxRef.current < hist.length - 1) {
369
+ historyIdxRef.current += 1;
370
+ setInput(hist[hist.length - 1 - historyIdxRef.current]);
371
+ setTiKey(k => k + 1);
372
+ }
373
+ return;
374
+ }
375
+ if (key.downArrow) {
376
+ if (historyIdxRef.current === -1)
377
+ return;
378
+ historyIdxRef.current -= 1;
379
+ if (historyIdxRef.current === -1)
380
+ setInput(draftRef.current);
381
+ else
382
+ setInput(historyRef.current[historyRef.current.length - 1 - historyIdxRef.current]);
383
+ setTiKey(k => k + 1);
384
+ return;
385
+ }
72
386
  // 双击 Esc 退出当前进程: 第一击提示, 500ms 内第二击退出
73
387
  if (key.escape) {
74
388
  const now = Date.now();
@@ -80,6 +394,21 @@ const InkApp = ({ onPrompt, initialStatus, getStatusUpdate, terminalW, terminalH
80
394
  inkAppendLine(`${C_WARN_ANSI}⚠ 再按一次 Esc 退出当前进程\x1b[0m`);
81
395
  }
82
396
  }
397
+ // 防御: 控制字符 chunk (TextInput 会把整 chunk 当字符追加, 2026-08-05 实测)
398
+ // setTimeout(0) 保证我们的纠正落在 TextInput 的 onChange 之后 (无论监听器顺序)
399
+ // \x7f×N → 先剥掉 TextInput 追加的垃圾, 再删 N 个真实字符
400
+ if (/^\x7f+$/.test(_input)) {
401
+ const n = _input.length;
402
+ setTimeout(() => setInput(cur => {
403
+ const cleaned = cur.replace(/[\x00-\x1f\x7f]+$/, '');
404
+ return cleaned.slice(0, Math.max(0, cleaned.length - n));
405
+ }), 0);
406
+ return;
407
+ }
408
+ if (/[\x00-\x1f\x7f]/.test(_input)) {
409
+ setTimeout(() => setInput(cur => cur.replace(/[\x00-\x1f\x7f]+$/, '')), 0);
410
+ return;
411
+ }
83
412
  // TextInput handles actual input; useInput only for Ctrl+C / Esc
84
413
  });
85
414
  // 自动更新状态栏 (每秒)
@@ -91,6 +420,19 @@ const InkApp = ({ onPrompt, initialStatus, getStatusUpdate, terminalW, terminalH
91
420
  }, 1000);
92
421
  return () => clearInterval(timer);
93
422
  }, [getStatusUpdate]);
423
+ // 调试/测试钩子: 输入变化时通知外部 (pty 测试用)
424
+ useEffect(() => {
425
+ globalThis.__inkOnInput?.(input);
426
+ }, [input]);
427
+ // 调试/测试钩子: 弹出窗状态 (pty 测试用)
428
+ useEffect(() => {
429
+ globalThis.__inkOnPopup?.({
430
+ open: popupOpen,
431
+ key: mentionKey,
432
+ count: filtered.length,
433
+ items: filtered.slice(0, 5).map(i => i.kind + ':' + i.label),
434
+ });
435
+ }, [popupOpen, mentionKey, filtered]);
94
436
  // 思考动画 — kaomoji 旋转
95
437
  const KAOMOJI = ['(`・ω・´)', '(´・_・`)', '(。•́︿•̀。)', 'ᕙ(▀̿̿Ĺ̯̿̿▀̿ ̿)ᕗ', '(◕‿◕)'];
96
438
  useEffect(() => {
@@ -101,8 +443,9 @@ const InkApp = ({ onPrompt, initialStatus, getStatusUpdate, terminalW, terminalH
101
443
  }, 600);
102
444
  return () => clearInterval(timer);
103
445
  }, [thinking]);
104
- return (_jsxs(Box, { flexDirection: "column", height: "100%", children: [_jsxs(Box, { flexGrow: 1, flexDirection: "column", justifyContent: "flex-start", children: [_jsx(LogoBox, { width: terminalW }), _jsx(Messages, { msgs: msgs }), thinking && (_jsx(Box, { children: _jsxs(Text, { color: "yellow", children: [KAOMOJI[thinkingIdx.current], " \u601D\u8003\u4E2D..."] }) }))] }), _jsx(Box, { children: _jsx(Text, { bold: true, color: "white", children: '─'.repeat(terminalW) }) }), _jsx(Box, { children: _jsx(Text, { children: status }) }), _jsx(Box, { children: _jsx(Text, { bold: true, color: "white", children: '─'.repeat(terminalW) }) }), _jsxs(Box, { children: [_jsx(Text, { bold: true, color: "green", children: "\u276F " }), _jsx(TextInput, { value: input, onChange: setInput, onSubmit: onSubmit, placeholder: "\u8F93\u5165\u6D88\u606F... Esc \u53CC\u51FB\u9000\u51FA \u00B7 /queue \u6392\u961F \u00B7 !\u7EC8\u7AEF\u547D\u4EE4" })] }), _jsx(Box, { children: _jsx(Text, { bold: true, color: "white", children: '─'.repeat(terminalW) }) })] }));
446
+ return (_jsxs(Box, { flexDirection: "column", height: "100%", children: [_jsxs(Box, { flexGrow: 1, flexDirection: "column", justifyContent: "flex-start", children: [_jsx(LogoBox, { width: terminalW }), _jsx(Messages, { msgs: msgs }), thinking && (_jsx(Box, { children: _jsxs(Text, { color: "yellow", children: [KAOMOJI[thinkingIdx.current], " \u601D\u8003\u4E2D..."] }) }))] }), _jsx(Box, { children: _jsx(Text, { bold: true, color: "white", children: '─'.repeat(terminalW) }) }), _jsx(Box, { children: _jsx(Text, { children: status }) }), _jsx(Box, { children: _jsx(Text, { bold: true, color: "white", children: '─'.repeat(terminalW) }) }), popupOpen && (tabState || mention) && (_jsx(MentionPopup, { title: popupTitle, items: filtered, sel: safeSel, width: terminalW, loading: loadingFiles })), _jsxs(Box, { children: [_jsx(Text, { bold: true, color: "green", children: "\u276F " }), _jsx(TextInput, { value: input, onChange: setInput, onSubmit: onSubmit, focus: !popupOpen, placeholder: "\u8F93\u5165\u6D88\u606F... @\u667A\u80FD\u4F53 /\u547D\u4EE4 #\u6587\u4EF6 \u00B7 Esc \u53CC\u51FB\u9000\u51FA \u00B7 /queue \u6392\u961F \u00B7 !\u7EC8\u7AEF\u547D\u4EE4" }, tiKey)] }), _jsx(Box, { children: _jsx(Text, { bold: true, color: "white", children: '─'.repeat(terminalW) }) })] }));
105
447
  };
448
+ export { InkApp };
106
449
  // ─── 启动 ────────────────────────────────────────────────────────────────────
107
450
  let _inkInstance = null;
108
451
  export function startInk(onPrompt, initialStatus, getStatusUpdate) {