nolo-cli 0.49.1 → 0.50.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 (131) hide show
  1. package/{_executeModel-KE4PQSZ3.js → _executeModel-JKEH7ACW.js} +48 -42
  2. package/{action-IU6ON7ZB.js → action-VSG2IYP3.js} +8 -8
  3. package/{addContentAction-5V5CCI3I.js → addContentAction-2HJJITDI.js} +8 -7
  4. package/{addDialogAgentAction-KF3KZZNZ.js → addDialogAgentAction-7BSQVVL5.js} +10 -9
  5. package/{agentDeleteCommand-Z67TJG3W.js → agentDeleteCommand-SVXKS5SC.js} +30 -28
  6. package/{agentEmailCommands-7LPIK7JE.js → agentEmailCommands-WN7QBTP3.js} +57 -52
  7. package/{agentListCommands-5J2IM3IT.js → agentListCommands-2BEBOQIG.js} +42 -33
  8. package/{agentMachineCommands-YXH6FXUQ.js → agentMachineCommands-WALP3ONU.js} +30 -28
  9. package/{agentRecordCommands-GZLCDVUS.js → agentRecordCommands-E652SW57.js} +55 -50
  10. package/{agentRunCommand-WYH5Q54Q.js → agentRunCommand-6VXWXKCS.js} +60 -53
  11. package/{agentRunControl-4GHHSXFZ.js → agentRunControl-LJVFDJGU.js} +3 -1
  12. package/{agentRuntimeLocal-A6EF3RUY.js → agentRuntimeLocal-SBG7BDFQ.js} +30 -26
  13. package/{agentSlice-ARTDF6VD.js → agentSlice-3WYXIGEO.js} +8 -8
  14. package/{agentSuperviseCommands-VB6BUS5H.js → agentSuperviseCommands-F3RFAL7K.js} +2 -2
  15. package/{appDeleteCommands-V2B7ZCLC.js → appDeleteCommands-NTUNMEXY.js} +31 -29
  16. package/{appDeployCommands-AXQU44RD.js → appDeployCommands-DISWXRTL.js} +31 -29
  17. package/{appDeployStatusCommands-FWGSC2UM.js → appDeployStatusCommands-IKRA6B6F.js} +31 -29
  18. package/{appGetCommands-67R3RFZK.js → appGetCommands-UMOP2DFV.js} +31 -29
  19. package/{appListCommands-TTASJPGV.js → appListCommands-ZKFD2AKS.js} +31 -29
  20. package/{authCommand-QOPOEYEK.js → authCommand-BS3CQC6I.js} +11 -11
  21. package/{chatQueueReduxAdapter-6CAHUQ4O.js → chatQueueReduxAdapter-A3YH4MT4.js} +24 -21
  22. package/{chunk-76UA7376.js → chunk-273FJUYI.js} +6 -6
  23. package/{chunk-7CH6U3FL.js → chunk-2GRGFCF6.js} +2 -4
  24. package/{chunk-T27IEBNQ.js → chunk-2QDDKFG5.js} +74 -1
  25. package/{chunk-IRJVFYOH.js → chunk-2TLYVDTN.js} +321 -1100
  26. package/{chunk-6BYAXNH5.js → chunk-3QOCS5IF.js} +11 -2
  27. package/chunk-6IGD47IC.js +19 -0
  28. package/{chunk-GFD7TIZU.js → chunk-6TUT5ZJD.js} +4 -6
  29. package/chunk-6YTOJY35.js +352 -0
  30. package/{chunk-B54WOZ77.js → chunk-7H7GQL6V.js} +2 -2
  31. package/{chunk-OYNDYVSE.js → chunk-B45YNDAE.js} +1 -1
  32. package/{chunk-UQWFIWHX.js → chunk-BKIDF5LV.js} +1 -1
  33. package/{chunk-5XCW6RQG.js → chunk-BUBPRCIU.js} +1 -1
  34. package/chunk-BYXBJQAS.js +0 -0
  35. package/{chunk-X7S7OFUX.js → chunk-CEVCRRHU.js} +4 -4
  36. package/{chunk-SP3DPVBH.js → chunk-DEIGUGP6.js} +2 -2
  37. package/{chunk-V2IPBG5U.js → chunk-DGEPT6FH.js} +1 -1
  38. package/{chunk-3AOLVADY.js → chunk-DVINR3PL.js} +1 -1
  39. package/{chunk-NN3AMBY3.js → chunk-DXOELY7S.js} +64 -69
  40. package/{chunk-OFZPJ3NT.js → chunk-E4MARS3Q.js} +1 -1
  41. package/{chunk-QUCSAM43.js → chunk-EAYBPWHX.js} +87 -66
  42. package/{chunk-DQLYEGP7.js → chunk-EGVY3GMT.js} +1 -1
  43. package/{chunk-2JYSSXLY.js → chunk-EJFW7TRP.js} +5 -26
  44. package/{chunk-HPZL4IBN.js → chunk-FGRCSLPV.js} +34 -45
  45. package/{chunk-WL3UOGYO.js → chunk-G4WSLTQF.js} +31 -97
  46. package/{chunk-HR5XDXYM.js → chunk-G5SQVIFZ.js} +3 -3
  47. package/{chunk-J3UALFHL.js → chunk-GHE5XMVR.js} +1 -1
  48. package/{chunk-6SMMK7MD.js → chunk-GKB4AZKV.js} +440 -2981
  49. package/{chunk-IKSFDJXB.js → chunk-GKNGRBE6.js} +150 -27
  50. package/{chunk-Q24S4NDF.js → chunk-HQTK2SFT.js} +1 -1
  51. package/{chunk-GDGIEGHV.js → chunk-IPTZ5TVU.js} +7 -6
  52. package/{chunk-4RXXP6WD.js → chunk-J7KDNHUO.js} +5 -64
  53. package/{chunk-QDHZCAH3.js → chunk-KNQ5LYVZ.js} +57 -2
  54. package/{chunk-VRJUIUIY.js → chunk-KVVNC5V3.js} +2 -2
  55. package/{chunk-CVT7L2WZ.js → chunk-LVCAWHI5.js} +4 -4
  56. package/{chunk-WX5E6HZS.js → chunk-N6SLQMSA.js} +6 -6
  57. package/{chunk-SQTVMYMU.js → chunk-NTZO3KX2.js} +3 -3
  58. package/{chunk-LGUQHYAL.js → chunk-O5FLGN2L.js} +3 -2
  59. package/{chunk-WKOEOQCI.js → chunk-OSUZKICS.js} +1600 -190
  60. package/{chunk-EXDR5D6X.js → chunk-Q2QN2RHG.js} +7 -7
  61. package/{chunk-L3JWI7WX.js → chunk-QOKAKDPE.js} +15 -11
  62. package/{chunk-757BGY6Y.js → chunk-RFYXK6KI.js} +1 -1
  63. package/chunk-RQSN75DW.js +1766 -0
  64. package/{chunk-HCMFFI2G.js → chunk-S3JNURSO.js} +2 -2
  65. package/{chunk-YZ2WE6CW.js → chunk-SAJSBPI2.js} +2 -2
  66. package/{chunk-WHVQA7PJ.js → chunk-SCBBGS2N.js} +23 -5
  67. package/chunk-SGSJBBKP.js +297 -0
  68. package/{chunk-GFUOVFQA.js → chunk-TUBNQ3OF.js} +2 -2
  69. package/{chunk-BANYWEYY.js → chunk-TY3ADTX5.js} +1 -1
  70. package/chunk-UAD2WT54.js +64 -0
  71. package/{chunk-SW7RCUGA.js → chunk-UEV5WVQV.js} +3 -3
  72. package/{chunk-EURF2SV6.js → chunk-UMCMW5R3.js} +51 -34
  73. package/{chunk-K524MUQC.js → chunk-VFDRZHPM.js} +16 -16
  74. package/{chunk-5WADL4O7.js → chunk-W22UTILW.js} +3 -3
  75. package/{chunk-IKTHA3JH.js → chunk-WERPP2S7.js} +2 -2
  76. package/{chunk-GBADO3SM.js → chunk-WSUHBABG.js} +1 -1
  77. package/{chunk-U5Z7LFZF.js → chunk-X3OGKR5Q.js} +4 -4
  78. package/{chunk-AVKUDHJO.js → chunk-X5LRMXTS.js} +10 -10
  79. package/{chunk-DIQCV4FR.js → chunk-X665UCNM.js} +1 -1
  80. package/{chunk-HCBQVVFZ.js → chunk-X7P6EJUY.js} +4 -4
  81. package/{chunk-HHBXCRJS.js → chunk-XOJRZUPF.js} +4 -4
  82. package/{chunk-MRWGHF56.js → chunk-YDH3FDFQ.js} +12 -356
  83. package/{chunk-TNPCQNGQ.js → chunk-YEFRCO5N.js} +4 -9
  84. package/{chunk-RO2IUWZE.js → chunk-YUKTCDVN.js} +1 -1
  85. package/{chunk-56W233KG.js → chunk-YWY25N4V.js} +1 -1
  86. package/{chunk-RU5D3B22.js → chunk-ZDS63Y4O.js} +2 -2
  87. package/chunk-ZJ7UHBJS.js +89 -0
  88. package/{chunk-SG65C33A.js → chunk-ZLMG6NRV.js} +4 -4
  89. package/{codingSkills-BYQI6EPT.js → codingSkills-FQPCEIWL.js} +2 -2
  90. package/contentThunks-J33BZB3E.js +71 -0
  91. package/{createAgentAutomationAction-7BBF5YXN.js → createAgentAutomationAction-HTMTGX6Q.js} +25 -21
  92. package/{createDialogAction-B5URPHP4.js → createDialogAction-WYQBSN6A.js} +27 -23
  93. package/{createPageAction-ISJKM5Q3.js → createPageAction-ICRRK3SA.js} +27 -22
  94. package/{dbSlice-FWF5F4L7.js → dbSlice-YORO4VL4.js} +6 -6
  95. package/{deleteFile-NPZ64DFN.js → deleteFile-JYKRT7C3.js} +4 -4
  96. package/{dialogCommands-XHH4MVA4.js → dialogCommands-FRSIAPKY.js} +31 -29
  97. package/{dialogSlice-NRAN5X7F.js → dialogSlice-5KPVIAWH.js} +24 -21
  98. package/{docCreateCommands-FUN2Z7HQ.js → docCreateCommands-DBRJMPDX.js} +30 -28
  99. package/{docDeleteCommands-OZDPFXPF.js → docDeleteCommands-BCYPLWXN.js} +31 -29
  100. package/{docReadCommands-FIPK7LE3.js → docReadCommands-L5JX4Q7G.js} +30 -28
  101. package/{docStore-LUS7SWC3.js → docStore-34NXLCEO.js} +8 -33
  102. package/{docUpdateCommands-BZ5GKAN4.js → docUpdateCommands-RELG7XJD.js} +30 -28
  103. package/fetchMessages-KZQVBXKY.js +1 -1
  104. package/{getPricing-HAU62AFM.js → getPricing-FM7TJZFV.js} +4 -4
  105. package/{handleSendMessageAction-RA4OD2ZH.js → handleSendMessageAction-MEYK7RPD.js} +25 -22
  106. package/index.js +64 -64
  107. package/{machineCommands-WDAYEFBE.js → machineCommands-YSXTOWHQ.js} +59 -54
  108. package/{machineWsRunDispatch-TPQ2FQVS.js → machineWsRunDispatch-DNAYOPQT.js} +54 -49
  109. package/memberThunks-KVPBG4V7.js +638 -0
  110. package/{models-4QF4BJVY.js → models-CW5EL6Z7.js} +2 -2
  111. package/package.json +2 -3
  112. package/{read-J7RVVCHH.js → read-NIOV5F7W.js} +4 -4
  113. package/{readDocTool-G2WBM4IH.js → readDocTool-ULKJ5BEM.js} +1 -1
  114. package/{readlineWorkspace-HN44KGIF.js → readlineWorkspace-KZ3LPQG2.js} +829 -393
  115. package/{removeDialogAgentAction-RMPISD42.js → removeDialogAgentAction-JGSCPML3.js} +12 -11
  116. package/{runAgentClientLoop-ZYUI22EA.js → runAgentClientLoop-O2AUHIJT.js} +46 -40
  117. package/{setDialogExtraReferencesAction-7BUTHDAL.js → setDialogExtraReferencesAction-CORU64NM.js} +9 -8
  118. package/{setPrimaryDialogAgentAction-WCYIBGZ4.js → setPrimaryDialogAgentAction-5VS2VKLZ.js} +12 -11
  119. package/{settingSlice-7NN2MI6Y.js → settingSlice-3GNGTC2T.js} +7 -7
  120. package/{skillDiscovery-COX56OBO.js → skillDiscovery-CYUCJMAG.js} +3 -3
  121. package/{spaceCommands-OJ2567D4.js → spaceCommands-OI7RIB2T.js} +30 -28
  122. package/{streamAgentChatTurn-FNFMMGNN.js → streamAgentChatTurn-TA3PGS6C.js} +61 -54
  123. package/{switchDialogAgentAction-WGMMQHDI.js → switchDialogAgentAction-LP433X4D.js} +10 -9
  124. package/{tableCommands-P2TXJ3CF.js → tableCommands-R6WFRDYF.js} +1 -1
  125. package/{toolApiClient-B2MFXMEG.js → toolApiClient-53U4UDFF.js} +3 -2
  126. package/{tools-QCDR3UMD.js → tools-6ZPQ75XA.js} +37 -32
  127. package/{tuiSummaryLlmCaller-LCGT62QC.js → tuiSummaryLlmCaller-YKYQB4ZL.js} +17 -15
  128. package/{updateDialogTitleAction-Y3OGJWDB.js → updateDialogTitleAction-LRJ7NSOS.js} +26 -22
  129. package/chunk-EUG45QJR.js +0 -6104
  130. package/spaceSlice-F7JCOZEF.js +0 -127
  131. package/{chunk-NQ4N4IGO.js → chunk-CS6TCJ7E.js} +3 -3
@@ -40,13 +40,22 @@ var STREAM_USAGE_PROVIDERS = /* @__PURE__ */ new Set([
40
40
  // RunInfra hosted fallback channel: OpenAI-compatible chat.completions
41
41
  // endpoint, supports stream_options.include_usage (measured to return
42
42
  // prompt_tokens_details.cached_tokens).
43
- "runinfra"
43
+ "runinfra",
44
+ // Kimi For Coding subscription (api.kimi.com/coding/v1): OpenAI-compatible
45
+ // chat.completions streaming that only emits the terminal usage frame when
46
+ // stream_options.include_usage is requested (measured; the official
47
+ // kimi-code CLI also sends include_usage). Custom agents pointing at the
48
+ // same endpoint are covered by the endpoint check below, not here.
49
+ "kimi-code"
44
50
  ]);
51
+ var KIMI_CODE_ENDPOINT_MARKER = "api.kimi.com";
52
+ var isKimiCodeEndpoint = (endpoint) => typeof endpoint === "string" && endpoint.includes(KIMI_CODE_ENDPOINT_MARKER);
45
53
  var EXTRA_USAGE_FIELD_PROVIDERS = /* @__PURE__ */ new Set(["openrouter"]);
46
54
  var normalizeProviderName = (providerName) => asTrimmedLowercaseString(providerName);
47
55
  var getUsageRequestOptions = (providerName, options) => {
48
56
  const normalizedProvider = normalizeProviderName(providerName);
49
57
  const api = options?.api ?? "chat-completions";
58
+ const shouldRequestStreamUsage = STREAM_USAGE_PROVIDERS.has(normalizedProvider) || normalizedProvider === "custom" && isKimiCodeEndpoint(options?.endpoint);
50
59
  if (api === "responses") {
51
60
  return EXTRA_USAGE_FIELD_PROVIDERS.has(normalizedProvider) ? {
52
61
  usage: {
@@ -55,7 +64,7 @@ var getUsageRequestOptions = (providerName, options) => {
55
64
  } : {};
56
65
  }
57
66
  return {
58
- ...STREAM_USAGE_PROVIDERS.has(normalizedProvider) ? {
67
+ ...shouldRequestStreamUsage ? {
59
68
  stream_options: {
60
69
  include_usage: true
61
70
  }
@@ -0,0 +1,19 @@
1
+ // packages/agent-runtime/responseGuidelines.ts
2
+ var buildResponseGuidelines = (isMobile) => {
3
+ if (isMobile) {
4
+ return `--- \u54CD\u5E94\u5C55\u793A\u6307\u5357\uFF08\u7A84\u5C4F / TUI / \u79FB\u52A8\u7AEF\uFF09 ---
5
+ \u5F53\u524D\u5904\u4E8E\u7A84\u5C4F\u6216\u7EC8\u7AEF\u89C6\u56FE\uFF0C\u91C7\u7528\u7D27\u51D1\u3001\u9AD8\u626B\u63CF\u7387\u6392\u7248\uFF1A\u7ED3\u8BBA/\u5173\u952E\u72B6\u6001\u7F6E\u9876\uFF0C\u77ED\u6BB5\u843D\uFF082-4 \u53E5\uFF09\u5E76\u4FDD\u6301\u7A7A\u884C\uFF0C\u62D2\u7EDD\u6587\u5B57\u5899\u3002
6
+ - \u5217\u8868\u9879\u7528\u300C- **\u6838\u5FC3\u8BCD**\uFF1A\u8BF4\u660E\u300D\uFF1B\u5D4C\u5957\u6700\u591A 2 \u5C42\uFF0C\u5B50\u5217\u8868\u7F29\u8FDB 2 \u7A7A\u683C\uFF1B\u5E76\u5217\u7528\u65E0\u5E8F\u5217\u8868\uFF0C\u6B65\u9AA4\u7528\u6709\u5E8F\u5217\u8868\u3002
7
+ - **\u8868\u683C\u964D\u7EA7**\uFF1A\u4E25\u7981\u4F7F\u7528 \u22654 \u5217\u7684\u5927\u5BBD\u8868\uFF08\u7A84\u5C4F/\u7EC8\u7AEF\u6298\u884C\u4E25\u91CD\u9519\u4F4D\uFF09\uFF0C\u6539\u7528\u952E\u503C\u6E05\u5355\u6216\u7EB5\u5411\u5361\u7247\u3002
8
+ - \u514B\u5236\u5206\u5272\u7EBF\uFF08\u4EC5\u5927\u4E3B\u9898\u5207\u6362\u6216\u7ED3\u8BBA\u524D\uFF0C\u524D\u540E\u7559\u7A7A\u884C\uFF09\uFF1B\u8DEF\u5F84\u3001\u547D\u4EE4\u4E0E\u53C2\u6570\u7528\u53CD\u5F15\u53F7 \` \` \u5305\u88F9\uFF1B\u4EE3\u7801\u5757\u6807\u660E\u8BED\u8A00\u4E14\u907F\u514D\u6A2A\u5411\u8D85\u957F\u884C\uFF1B\u514B\u5236 Emoji\u3002`;
9
+ }
10
+ return `--- \u54CD\u5E94\u5C55\u793A\u6307\u5357\uFF08\u5BBD\u5C4F / \u684C\u9762\u7AEF\uFF09 ---
11
+ \u5F53\u524D\u5904\u4E8E\u5927\u5C4F\u89C6\u56FE\uFF1A\u5C42\u6B21\u6E05\u6670\u7684\u5168\u666F\u7ED3\u6784\uFF0C\u91CD\u8981\u6A21\u5757\u7528\u4E8C\u7EA7/\u4E09\u7EA7\u6807\u9898\u5212\u5206\uFF1B\u6BB5\u843D 2-4 \u53E5\u5E76\u7559\u7A7A\u884C\uFF0C\u76F4\u5954\u4E3B\u9898\u3002
12
+ - \u5217\u8868\u9879\u7528\u300C- **\u6838\u5FC3\u8BCD**\uFF1A\u8BF4\u660E\u300D\uFF1B\u5D4C\u5957\u6700\u591A 2 \u5C42\uFF0C\u5B50\u5217\u8868\u7F29\u8FDB 2 \u7A7A\u683C\uFF1B\u5E76\u5217\u7528\u65E0\u5E8F\u5217\u8868\uFF0C\u6B65\u9AA4\u7528\u6709\u5E8F\u5217\u8868\u3002
13
+ - **\u8868\u683C\u4E0E\u5BF9\u6BD4**\uFF1A\u5BBD\u5C4F\u4E0B\u53EF\u9002\u5EA6\u4F7F\u7528 Markdown \u591A\u5217\u8868\u683C\u505A\u65B9\u6848\u5BF9\u6BD4\u3001\u53C2\u6570\u6C47\u603B\u6216\u77E9\u9635\u5206\u6790\u3002
14
+ - \u53EF\u5C55\u793A\u66F4\u5B8C\u6574\u7684\u4EE3\u7801\u4E0A\u4E0B\u6587\u4E0E\u591A\u6B65\u6267\u884C\u793A\u4F8B\uFF1B\u8DEF\u5F84\u3001\u547D\u4EE4\u4E0E\u53C2\u6570\u7528\u53CD\u5F15\u53F7 \` \` \u5305\u88F9\uFF0C\u4EE3\u7801\u5757\u6807\u660E\u8BED\u8A00\uFF1B\u514B\u5236\u5206\u5272\u7EBF\u4E0E Emoji\u3002`;
15
+ };
16
+
17
+ export {
18
+ buildResponseGuidelines
19
+ };
@@ -1,19 +1,16 @@
1
- import {
2
- updateContentTitle
3
- } from "./chunk-6SMMK7MD.js";
4
1
  import {
5
2
  require_date_fns
6
3
  } from "./chunk-M76ECQRD.js";
7
4
  import {
8
5
  require_react
9
- } from "./chunk-MRWGHF56.js";
6
+ } from "./chunk-YDH3FDFQ.js";
10
7
  import {
11
8
  toErrorMessage
12
9
  } from "./chunk-HNMXYYJR.js";
13
10
  import {
14
11
  patch,
15
12
  readAndWait
16
- } from "./chunk-76UA7376.js";
13
+ } from "./chunk-273FJUYI.js";
17
14
  import {
18
15
  asOptionalTrimmedString
19
16
  } from "./chunk-G3SUCT4W.js";
@@ -329,6 +326,7 @@ async function saveDocState(arg, { dispatch, getState }) {
329
326
  ).unwrap();
330
327
  if (dbSpaceId) {
331
328
  try {
329
+ const { updateContentTitle } = await import("./contentThunks-J33BZB3E.js");
332
330
  await dispatch(
333
331
  updateContentTitle({
334
332
  spaceId: dbSpaceId,
@@ -367,7 +365,7 @@ async function saveDocState(arg, { dispatch, getState }) {
367
365
  }
368
366
  }
369
367
  async function createDocState(args, thunkApi) {
370
- const { createPageAction } = await import("./createPageAction-ISJKM5Q3.js");
368
+ const { createPageAction } = await import("./createPageAction-ICRRK3SA.js");
371
369
  return createPageAction(args, thunkApi);
372
370
  }
373
371
  function subscribe(listener) {
@@ -0,0 +1,352 @@
1
+ import {
2
+ require_react
3
+ } from "./chunk-YDH3FDFQ.js";
4
+ import {
5
+ __toESM
6
+ } from "./chunk-4VNS5WPM.js";
7
+
8
+ // packages/chat/dialog/dialogRuntimeTypes.ts
9
+ var GLOBAL_DIALOG_RUNTIME_KEY = "__global__";
10
+
11
+ // packages/chat/dialog/dialogRuntimeStore.ts
12
+ var import_react = __toESM(require_react());
13
+ var createEmptyTokenStats = () => ({
14
+ inputTokens: 0,
15
+ outputTokens: 0,
16
+ totalCost: 0
17
+ });
18
+ var createEmptyDialogRuntimeState = () => ({
19
+ tokens: createEmptyTokenStats(),
20
+ pendingFiles: [],
21
+ activeControllers: {},
22
+ pendingRawData: {},
23
+ loopStopReason: null,
24
+ pendingUserInputQueue: []
25
+ });
26
+ var activeDialogKey = null;
27
+ var configError = null;
28
+ var runtimeByKey = {
29
+ [GLOBAL_DIALOG_RUNTIME_KEY]: createEmptyDialogRuntimeState()
30
+ };
31
+ var listeners = /* @__PURE__ */ new Set();
32
+ var version = 0;
33
+ var notify = () => {
34
+ version += 1;
35
+ for (const listener of listeners) {
36
+ try {
37
+ listener();
38
+ } catch {
39
+ }
40
+ }
41
+ };
42
+ var action = (type, payload) => ({ type, payload });
43
+ function setActiveDialogKey(key) {
44
+ activeDialogKey = key;
45
+ configError = null;
46
+ notify();
47
+ }
48
+ function getActiveDialogKey() {
49
+ return activeDialogKey;
50
+ }
51
+ function setDialogConfigError(error) {
52
+ configError = error;
53
+ notify();
54
+ }
55
+ function getDialogConfigError() {
56
+ return configError;
57
+ }
58
+ var resolveDialogRuntimeKey = (dialogKey) => dialogKey ?? activeDialogKey ?? GLOBAL_DIALOG_RUNTIME_KEY;
59
+ var ensureDialogRuntimeState = (dialogKey) => {
60
+ const runtimeKey = resolveDialogRuntimeKey(dialogKey);
61
+ if (!runtimeByKey[runtimeKey]) {
62
+ runtimeByKey[runtimeKey] = createEmptyDialogRuntimeState();
63
+ }
64
+ return runtimeByKey[runtimeKey];
65
+ };
66
+ function resetDialogRuntimeSessionState(dialogKey) {
67
+ const runtime = ensureDialogRuntimeState(dialogKey);
68
+ runtime.tokens = createEmptyTokenStats();
69
+ runtime.loopStopReason = null;
70
+ runtime.pendingUserInputQueue = [];
71
+ notify();
72
+ }
73
+ function addPendingFile(payload) {
74
+ const targetRuntimeKey = payload.targetDialogKey ?? payload.runtimeDialogKey ?? (payload.type === "dialog" ? activeDialogKey : payload.dialogKey);
75
+ const runtime = ensureDialogRuntimeState(targetRuntimeKey);
76
+ if (!runtime.pendingFiles.some((f) => f.id === payload.id)) {
77
+ runtime.pendingFiles.push(payload);
78
+ notify();
79
+ }
80
+ return action("dialogRuntime/addPendingFile", payload);
81
+ }
82
+ function removePendingFile(fileId) {
83
+ const runtime = ensureDialogRuntimeState();
84
+ const fileToRemove = runtime.pendingFiles.find((f) => f.id === fileId);
85
+ if (fileToRemove) {
86
+ if (fileToRemove.pageKey) {
87
+ delete runtime.pendingRawData[fileToRemove.pageKey];
88
+ }
89
+ runtime.pendingFiles = runtime.pendingFiles.filter(
90
+ (file) => file.id !== fileId
91
+ );
92
+ notify();
93
+ }
94
+ return action("dialogRuntime/removePendingFile", fileId);
95
+ }
96
+ function clearPendingAttachments(payload) {
97
+ if (payload?.all) {
98
+ Object.values(runtimeByKey).forEach((runtime2) => {
99
+ runtime2.pendingFiles = [];
100
+ runtime2.pendingRawData = {};
101
+ });
102
+ notify();
103
+ return action("dialogRuntime/clearPendingAttachments", payload);
104
+ }
105
+ const runtime = ensureDialogRuntimeState(payload?.dialogKey);
106
+ runtime.pendingFiles = [];
107
+ runtime.pendingRawData = {};
108
+ notify();
109
+ return action("dialogRuntime/clearPendingAttachments", payload);
110
+ }
111
+ function setLoopStopReason(payload) {
112
+ const runtime = ensureDialogRuntimeState(payload.dialogKey);
113
+ runtime.loopStopReason = payload.reason;
114
+ notify();
115
+ return action("dialogRuntime/setLoopStopReason", payload);
116
+ }
117
+ function clearDialogRuntimeState(payload) {
118
+ delete runtimeByKey[payload.dialogKey];
119
+ notify();
120
+ return action("dialogRuntime/clearDialogRuntimeState", payload);
121
+ }
122
+ function addActiveController(payload) {
123
+ const runtime = ensureDialogRuntimeState(payload.dialogKey);
124
+ runtime.activeControllers[payload.messageId] = payload.controller;
125
+ notify();
126
+ return action("dialogRuntime/addActiveController", payload);
127
+ }
128
+ function removeActiveController(payload) {
129
+ const normalized = typeof payload === "string" ? { messageId: payload } : payload;
130
+ const runtime = ensureDialogRuntimeState(normalized.dialogKey);
131
+ delete runtime.activeControllers[normalized.messageId];
132
+ notify();
133
+ return action("dialogRuntime/removeActiveController", normalized);
134
+ }
135
+ function clearActiveControllers(payload) {
136
+ if (payload?.all) {
137
+ Object.values(runtimeByKey).forEach((runtime2) => {
138
+ runtime2.activeControllers = {};
139
+ });
140
+ notify();
141
+ return action("dialogRuntime/clearActiveControllers", payload);
142
+ }
143
+ const runtime = ensureDialogRuntimeState(payload?.dialogKey);
144
+ runtime.activeControllers = {};
145
+ notify();
146
+ return action("dialogRuntime/clearActiveControllers", payload);
147
+ }
148
+ function enqueueUserInput(payload) {
149
+ const normalized = typeof payload === "string" ? { text: payload } : payload;
150
+ const runtime = ensureDialogRuntimeState(normalized.dialogKey);
151
+ runtime.pendingUserInputQueue.push(normalized.text);
152
+ notify();
153
+ return action("dialogRuntime/enqueueUserInput", normalized);
154
+ }
155
+ function dequeueUserInput(payload) {
156
+ const runtime = ensureDialogRuntimeState(payload?.dialogKey);
157
+ runtime.pendingUserInputQueue.shift();
158
+ notify();
159
+ return action("dialogRuntime/dequeueUserInput", payload);
160
+ }
161
+ function clearPendingUserInputQueue(payload) {
162
+ if (payload?.all) {
163
+ Object.values(runtimeByKey).forEach((runtime2) => {
164
+ runtime2.pendingUserInputQueue = [];
165
+ });
166
+ notify();
167
+ return action("dialogRuntime/clearPendingUserInputQueue", payload);
168
+ }
169
+ const runtime = ensureDialogRuntimeState(payload?.dialogKey);
170
+ runtime.pendingUserInputQueue = [];
171
+ notify();
172
+ return action("dialogRuntime/clearPendingUserInputQueue", payload);
173
+ }
174
+ function tokenUsageLiveUpdate(payload) {
175
+ const runtime = ensureDialogRuntimeState(payload.dialogKey);
176
+ runtime.tokens.inputTokens += payload.input_tokens;
177
+ runtime.tokens.outputTokens += payload.output_tokens;
178
+ runtime.tokens.totalCost += payload.cost ?? 0;
179
+ notify();
180
+ return action("dialogRuntime/tokenUsageLiveUpdate", payload);
181
+ }
182
+ function addPageReferenceToRuntime(payload) {
183
+ const runtime = ensureDialogRuntimeState(payload.dialogKey);
184
+ runtime.pendingFiles.push(payload.reference);
185
+ if (payload.rawData?.pageKey) {
186
+ runtime.pendingRawData[payload.rawData.pageKey] = payload.rawData;
187
+ }
188
+ notify();
189
+ }
190
+ function applyUpdateTokensFulfilled(payload) {
191
+ const runtime = runtimeByKey[payload.dialogKey];
192
+ if (!runtime) return;
193
+ runtime.tokens.inputTokens = Math.max(
194
+ 0,
195
+ runtime.tokens.inputTokens - (payload.input_tokens ?? 0)
196
+ );
197
+ runtime.tokens.outputTokens = Math.max(
198
+ 0,
199
+ runtime.tokens.outputTokens - (payload.output_tokens ?? 0)
200
+ );
201
+ runtime.tokens.totalCost = Math.max(
202
+ 0,
203
+ runtime.tokens.totalCost - (payload.cost ?? 0)
204
+ );
205
+ notify();
206
+ }
207
+ function applyClearDialogStateRuntime() {
208
+ const previousDialogKey = activeDialogKey;
209
+ const previousRuntime = previousDialogKey ? runtimeByKey[previousDialogKey] : null;
210
+ const globalRuntime = ensureDialogRuntimeState(GLOBAL_DIALOG_RUNTIME_KEY);
211
+ if (previousRuntime) {
212
+ if (previousRuntime.pendingFiles.length > 0) {
213
+ globalRuntime.pendingFiles = previousRuntime.pendingFiles;
214
+ previousRuntime.pendingFiles = [];
215
+ }
216
+ previousRuntime.pendingRawData = {};
217
+ previousRuntime.pendingUserInputQueue = [];
218
+ }
219
+ activeDialogKey = null;
220
+ configError = null;
221
+ globalRuntime.pendingRawData = {};
222
+ globalRuntime.pendingUserInputQueue = [];
223
+ notify();
224
+ }
225
+ function deleteDialogRuntime(dialogKey) {
226
+ delete runtimeByKey[dialogKey];
227
+ notify();
228
+ }
229
+ function abortActiveControllers(args) {
230
+ const runtimes = args?.all ? Object.values(runtimeByKey) : [ensureDialogRuntimeState(args?.dialogKey)];
231
+ runtimes.forEach((runtime) => {
232
+ Object.values(runtime.activeControllers).forEach(
233
+ (controller) => controller.abort()
234
+ );
235
+ });
236
+ }
237
+ function getDialogRuntimeState(dialogKey) {
238
+ return runtimeByKey[resolveDialogRuntimeKey(dialogKey)] ?? createEmptyDialogRuntimeState();
239
+ }
240
+ function getPendingFiles(dialogKey) {
241
+ return getDialogRuntimeState(dialogKey).pendingFiles;
242
+ }
243
+ function getActiveControllers(dialogKey) {
244
+ return getDialogRuntimeState(dialogKey).activeControllers;
245
+ }
246
+ function getPendingRawData(dialogKey) {
247
+ return getDialogRuntimeState(dialogKey).pendingRawData;
248
+ }
249
+ function getDialogRuntimeTokens(dialogKey) {
250
+ return getDialogRuntimeState(dialogKey).tokens;
251
+ }
252
+ function getPendingRawDataByPageKey(pageKey) {
253
+ return getDialogRuntimeState().pendingRawData[pageKey];
254
+ }
255
+ function getPendingUserInputQueue(dialogKey) {
256
+ return getDialogRuntimeState(dialogKey).pendingUserInputQueue;
257
+ }
258
+ function getLoopStopReason(dialogKey) {
259
+ return getDialogRuntimeState(dialogKey).loopStopReason;
260
+ }
261
+ var selectDialogRuntimeByKey = (_state, dialogKey) => getDialogRuntimeState(dialogKey);
262
+ var selectPendingFiles = (_state, dialogKey) => getPendingFiles(dialogKey);
263
+ var selectActiveControllers = (_state, dialogKey) => getActiveControllers(dialogKey);
264
+ var selectPendingRawData = (_state, dialogKey) => getPendingRawData(dialogKey);
265
+ var selectDialogRuntimeTokens = (_state, dialogKey) => getDialogRuntimeTokens(dialogKey);
266
+ var selectPendingRawDataByPageKey = (_state, pageKey) => getPendingRawDataByPageKey(pageKey);
267
+ var selectPendingUserInputQueue = (_state, dialogKey) => getPendingUserInputQueue(dialogKey);
268
+ var selectLoopStopReason = (_state, dialogKey) => getLoopStopReason(dialogKey);
269
+ var selectCurrentDialogKey = (_state) => getActiveDialogKey();
270
+ var selectConfigError = (_state) => getDialogConfigError();
271
+ function subscribe(listener) {
272
+ listeners.add(listener);
273
+ return () => {
274
+ listeners.delete(listener);
275
+ };
276
+ }
277
+ function getSnapshot() {
278
+ return version;
279
+ }
280
+ function usePendingFiles(dialogKey) {
281
+ (0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
282
+ return getPendingFiles(dialogKey);
283
+ }
284
+ function useActiveControllers(dialogKey) {
285
+ (0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
286
+ return getActiveControllers(dialogKey);
287
+ }
288
+ function usePendingUserInputQueue(dialogKey) {
289
+ (0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
290
+ return getPendingUserInputQueue(dialogKey);
291
+ }
292
+ function useLoopStopReason(dialogKey) {
293
+ (0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
294
+ return getLoopStopReason(dialogKey);
295
+ }
296
+ function useDialogRuntimeTokens(dialogKey) {
297
+ (0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
298
+ return getDialogRuntimeTokens(dialogKey);
299
+ }
300
+ function useCurrentDialogKey() {
301
+ (0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
302
+ return getActiveDialogKey();
303
+ }
304
+ function useDialogConfigError() {
305
+ (0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
306
+ return getDialogConfigError();
307
+ }
308
+
309
+ export {
310
+ GLOBAL_DIALOG_RUNTIME_KEY,
311
+ setActiveDialogKey,
312
+ getActiveDialogKey,
313
+ setDialogConfigError,
314
+ resetDialogRuntimeSessionState,
315
+ addPendingFile,
316
+ removePendingFile,
317
+ clearPendingAttachments,
318
+ setLoopStopReason,
319
+ clearDialogRuntimeState,
320
+ addActiveController,
321
+ removeActiveController,
322
+ clearActiveControllers,
323
+ enqueueUserInput,
324
+ dequeueUserInput,
325
+ clearPendingUserInputQueue,
326
+ tokenUsageLiveUpdate,
327
+ addPageReferenceToRuntime,
328
+ applyUpdateTokensFulfilled,
329
+ applyClearDialogStateRuntime,
330
+ deleteDialogRuntime,
331
+ abortActiveControllers,
332
+ getDialogRuntimeTokens,
333
+ getPendingUserInputQueue,
334
+ getLoopStopReason,
335
+ selectDialogRuntimeByKey,
336
+ selectPendingFiles,
337
+ selectActiveControllers,
338
+ selectPendingRawData,
339
+ selectDialogRuntimeTokens,
340
+ selectPendingRawDataByPageKey,
341
+ selectPendingUserInputQueue,
342
+ selectLoopStopReason,
343
+ selectCurrentDialogKey,
344
+ selectConfigError,
345
+ usePendingFiles,
346
+ useActiveControllers,
347
+ usePendingUserInputQueue,
348
+ useLoopStopReason,
349
+ useDialogRuntimeTokens,
350
+ useCurrentDialogKey,
351
+ useDialogConfigError
352
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  readDbRecord,
3
3
  writeAgentRecord
4
- } from "./chunk-DQLYEGP7.js";
4
+ } from "./chunk-EGVY3GMT.js";
5
5
  import {
6
6
  buildSkillSummaryMarker
7
7
  } from "./chunk-VF4K2QE6.js";
@@ -13,7 +13,7 @@ import {
13
13
  } from "./chunk-A7GB5UGH.js";
14
14
  import {
15
15
  createSpaceKey
16
- } from "./chunk-4RXXP6WD.js";
16
+ } from "./chunk-UAD2WT54.js";
17
17
  import {
18
18
  asTrimmedLowercaseString
19
19
  } from "./chunk-QSJ3HFEF.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  buildAgentRuntimeAgentLookupKeys,
3
3
  shouldFetchAgentRuntimeRecordRemotely
4
- } from "./chunk-TNPCQNGQ.js";
4
+ } from "./chunk-YEFRCO5N.js";
5
5
 
6
6
  // packages/cli/client/localAgentRecords.ts
7
7
  var buildLocalAgentLookupKeys = buildAgentRuntimeAgentLookupKeys;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  fetchReferenceContents,
3
3
  resolveReferenceAssets
4
- } from "./chunk-HPZL4IBN.js";
4
+ } from "./chunk-FGRCSLPV.js";
5
5
 
6
6
  // packages/ai/agent/fetchAgentContexts.ts
7
7
  async function fetchAgentContexts(references, dispatch) {
@@ -199,7 +199,7 @@ async function readDocFunc(args, thunkApi) {
199
199
  throw new Error(`\u65E0\u6548\u7684\u9875\u9762 ID: ${id}\u3002\u9875\u9762 ID \u901A\u5E38\u4EE5 "page-" \u5F00\u5934\u3002`);
200
200
  }
201
201
  try {
202
- const { readAction } = await import("./read-J7RVVCHH.js");
202
+ const { readAction } = await import("./read-NIOV5F7W.js");
203
203
  const pageData = await readAction({ dbKey: id }, thunkApi);
204
204
  if (!pageData) {
205
205
  throw new Error(`\u672A\u627E\u5230 ID \u4E3A ${id} \u7684\u9875\u9762\u3002`);
File without changes
@@ -13,7 +13,7 @@ import {
13
13
  toTimestampMs,
14
14
  upsert,
15
15
  write
16
- } from "./chunk-76UA7376.js";
16
+ } from "./chunk-273FJUYI.js";
17
17
  import {
18
18
  createUserKey,
19
19
  createUserPreferenceKey,
@@ -24,7 +24,7 @@ import {
24
24
  } from "./chunk-QSJ3HFEF.js";
25
25
  import {
26
26
  BUILTIN_NOLO_AGENT_KEY
27
- } from "./chunk-2JYSSXLY.js";
27
+ } from "./chunk-EJFW7TRP.js";
28
28
  import {
29
29
  asyncThunkCreator,
30
30
  buildCreateSlice,
@@ -32,12 +32,12 @@ import {
32
32
  createAsyncThunk,
33
33
  createSelector,
34
34
  selectIdentityUserId
35
- } from "./chunk-HHBXCRJS.js";
35
+ } from "./chunk-XOJRZUPF.js";
36
36
  import {
37
37
  getAllServers,
38
38
  getIsDesktopApp,
39
39
  isProduction
40
- } from "./chunk-L3JWI7WX.js";
40
+ } from "./chunk-QOKAKDPE.js";
41
41
  import {
42
42
  SERVERS
43
43
  } from "./chunk-LCBAMY2M.js";
@@ -3,12 +3,12 @@ import {
3
3
  resolvePlatformChatCompletionsEndpoint,
4
4
  resolvePlatformHostedCredentialProvider,
5
5
  resolvePlatformResponsesEndpoint
6
- } from "./chunk-VRJUIUIY.js";
6
+ } from "./chunk-KVVNC5V3.js";
7
7
  import {
8
8
  CLIENT_VERSION_TOO_OLD_CODE,
9
9
  buildClientVersionGateErrorDetail,
10
10
  evaluatePlatformHostedClientVersionGate
11
- } from "./chunk-WL3UOGYO.js";
11
+ } from "./chunk-G4WSLTQF.js";
12
12
  import {
13
13
  asTrimmedLowercaseString
14
14
  } from "./chunk-QSJ3HFEF.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  TOOL_PACKS,
3
3
  buildCodeWorkDiscipline
4
- } from "./chunk-LGUQHYAL.js";
4
+ } from "./chunk-O5FLGN2L.js";
5
5
  import {
6
6
  buildSkillDocMarkdown,
7
7
  resolvePageSkillMetadata
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  MEMORY_USE_GUIDANCE,
3
3
  wrapHistoricalSummaryWithReplayGuard
4
- } from "./chunk-7CH6U3FL.js";
4
+ } from "./chunk-2GRGFCF6.js";
5
5
 
6
6
  // packages/agent-runtime/turnContext.ts
7
7
  var DEFAULT_RECENT_CONTENT_LIMIT = 10;