nolo-cli 0.8.0-alpha.14 → 0.8.0-alpha.19

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 (98) hide show
  1. package/README.md +1 -1
  2. package/{_executeModel-KBMAUV6G.js → _executeModel-BOMQGOZC.js} +33 -30
  3. package/{action-SQGI5JY5.js → action-AEHDRQHP.js} +4 -4
  4. package/{addContentAction-ZX2PUS3X.js → addContentAction-OL5YQ6LW.js} +3 -3
  5. package/{addDialogAgentAction-ULADQX2Q.js → addDialogAgentAction-XU5Y2E2X.js} +2 -2
  6. package/{agentDeleteCommand-GNVYHOGZ.js → agentDeleteCommand-5DD2IM3J.js} +12 -11
  7. package/{agentEmailCommands-QETL62SU.js → agentEmailCommands-SE7MBTAG.js} +35 -32
  8. package/{agentListCommands-FM4OWXYT.js → agentListCommands-I6KZYCIG.js} +13 -12
  9. package/{agentMachineCommands-LDHJBWQO.js → agentMachineCommands-SBYN6EXT.js} +13 -12
  10. package/{agentRecordCommands-UW76EZ25.js → agentRecordCommands-F74NBFOZ.js} +35 -32
  11. package/{agentRunCommand-UFBOW4ZF.js → agentRunCommand-3DGDK4Y3.js} +41 -36
  12. package/{agentRuntimeLocal-XL5PLRJV.js → agentRuntimeLocal-ZYEIPTY4.js} +9 -8
  13. package/{agentSlice-2IBSFH4O.js → agentSlice-XEH6Y334.js} +3 -3
  14. package/{authCommand-PXFX6JDT.js → authCommand-EB5JSOX5.js} +3 -3
  15. package/{authCommands-356AYWEK.js → authCommands-XPEHTKSM.js} +2 -2
  16. package/{chunk-QTFSBLCF.js → chunk-2BIV3FMX.js} +25 -236
  17. package/{chunk-ZDXZSXYQ.js → chunk-2NNJ6S5U.js} +1 -1
  18. package/{chunk-6A3LI5TZ.js → chunk-2T2C6CNY.js} +2 -2
  19. package/{chunk-2IRF4LEX.js → chunk-4NDK6NWB.js} +87 -114
  20. package/{chunk-SRLZ7IVA.js → chunk-4P2MDGKS.js} +78 -211
  21. package/{chunk-MXLQWBVM.js → chunk-4QEWT7KD.js} +33 -3
  22. package/{chunk-DSNONPGW.js → chunk-5KLGBAAR.js} +1 -1
  23. package/{chunk-6CBN7GGH.js → chunk-64AAZRGY.js} +4 -4
  24. package/{chunk-QKRUUZCL.js → chunk-6RSAUKSQ.js} +24 -13
  25. package/{chunk-TWPGVS2U.js → chunk-7DAJ4AI4.js} +2 -2
  26. package/{chunk-RLCFUU46.js → chunk-7KCUSYT2.js} +4 -10
  27. package/chunk-AFON4QUU.js +112 -0
  28. package/chunk-AGFH73SK.js +239 -0
  29. package/{chunk-572EKYLF.js → chunk-BBYVOSU2.js} +1 -1
  30. package/{chunk-2MALU52L.js → chunk-C3RUNRHT.js} +1 -1
  31. package/{chunk-SL35K7AH.js → chunk-C4FTUXVF.js} +2 -82
  32. package/{chunk-JRPR5M4O.js → chunk-C77B4AFC.js} +2 -2
  33. package/{chunk-USZMK5UT.js → chunk-DCOA4QSN.js} +1 -1
  34. package/{chunk-BKPVTIEK.js → chunk-FVYY6MCS.js} +3 -3
  35. package/{chunk-3TZDXYSF.js → chunk-HNW7IJSK.js} +1 -1
  36. package/{chunk-B6DFDN4R.js → chunk-IEKTE4JQ.js} +2 -2
  37. package/{chunk-BR2WP3DF.js → chunk-IWX4UW2E.js} +9 -9
  38. package/{chunk-MMRAIO5Y.js → chunk-IX4C5TCO.js} +3 -3
  39. package/{chunk-6XKX2N2E.js → chunk-JRCUAPXX.js} +1 -1
  40. package/{chunk-XDVAYP26.js → chunk-JRKKFRAV.js} +1 -1
  41. package/{chunk-V2AISYMA.js → chunk-KPSWSDUF.js} +2 -2
  42. package/chunk-LTRXGFMS.js +83 -0
  43. package/{chunk-PCWC3JTN.js → chunk-MTU75CZ2.js} +1 -1
  44. package/{chunk-DGFWICQJ.js → chunk-N54XAP77.js} +1 -1
  45. package/{chunk-SACYB45H.js → chunk-O2ZNTTET.js} +5 -5
  46. package/{chunk-SH2CFQOH.js → chunk-O4BU24WZ.js} +2 -181
  47. package/{chunk-PFUCDPUH.js → chunk-OFM4S5P3.js} +13 -13
  48. package/{chunk-VH4YK6KZ.js → chunk-OI54SUZ7.js} +6 -6
  49. package/{chunk-QO4YO77G.js → chunk-OZNNTJM7.js} +2 -2
  50. package/{chunk-DG7AAAR3.js → chunk-P3PKED2I.js} +62 -2
  51. package/{chunk-JW43YCM5.js → chunk-PY4NLIAF.js} +1 -1
  52. package/{chunk-7IPLJUYC.js → chunk-RL776AGR.js} +1 -1
  53. package/{chunk-EQHI2AR3.js → chunk-RM7KF6OT.js} +41 -22
  54. package/{chunk-RJKDVL4L.js → chunk-SDJDLO5W.js} +2 -2
  55. package/{chunk-RTZFUR3V.js → chunk-SHAFJ4TI.js} +3 -3
  56. package/{chunk-YYUCRDOK.js → chunk-SOTZ6RDN.js} +1 -1
  57. package/chunk-VC6OZXO5.js +298 -0
  58. package/{chunk-EXTIQUCI.js → chunk-VVX233PH.js} +1 -1
  59. package/{chunk-ZQ2UM4KG.js → chunk-WZSRQNQG.js} +1 -292
  60. package/{chunk-Q2YZULBH.js → chunk-XENYHRUE.js} +1 -1
  61. package/{chunk-VQ2AJRGD.js → chunk-YPRZSPF3.js} +1 -1
  62. package/{chunk-I6DI7SGU.js → chunk-YRG2GO6E.js} +222 -63
  63. package/{cliExecutor-DNE7TCC4.js → cliExecutor-K3F7DMRO.js} +2 -2
  64. package/{createAgentAutomationAction-CSWOQOY5.js → createAgentAutomationAction-MBUL3ALA.js} +12 -12
  65. package/{createDialogAction-6VWL2TDI.js → createDialogAction-3JLD4VED.js} +16 -15
  66. package/{createPageAction-INRC4MH2.js → createPageAction-Z2AOWGIW.js} +17 -16
  67. package/{dbSlice-TO2TSMWM.js → dbSlice-LSKJDY2R.js} +2 -2
  68. package/{dialogCommands-DWSE4PMW.js → dialogCommands-4IX4XIZE.js} +14 -13
  69. package/{dialogSlice-CELFVS3F.js → dialogSlice-NRQ5WIJO.js} +12 -12
  70. package/{docCreateCommands-UFJL5PUM.js → docCreateCommands-SIL3NPGT.js} +14 -12
  71. package/{docDeleteCommands-XHEIBAB2.js → docDeleteCommands-7IOMLUS4.js} +16 -14
  72. package/{docReadCommands-PEDIC2CW.js → docReadCommands-FNFXUA5L.js} +14 -12
  73. package/{docStore-Q5AFYT6G.js → docStore-DBFNPMHU.js} +13 -13
  74. package/{docUpdateCommands-WBRODQ7P.js → docUpdateCommands-X2HNDVUC.js} +14 -12
  75. package/{fetchMessages-U6ZHN56A.js → fetchMessages-KTNM7QAR.js} +2 -2
  76. package/{getPricing-PWPJ6MNV.js → getPricing-3E6UNPKL.js} +3 -3
  77. package/{handleSendMessageAction-PPIGKCBQ.js → handleSendMessageAction-G3WLT6I7.js} +12 -12
  78. package/index.js +45 -45
  79. package/{localDialogRead-Z5UTAJPU.js → localDialogRead-2VRI24F4.js} +1 -1
  80. package/{machineCommands-3D7JMHUP.js → machineCommands-GPEWO27H.js} +37 -34
  81. package/{machineWsRunDispatch-PA5BR4AX.js → machineWsRunDispatch-2LSYCV4S.js} +34 -31
  82. package/{models-XLEOET3E.js → models-4OPOOLFS.js} +2 -2
  83. package/package.json +3 -2
  84. package/{readlineWorkspace-7WPA5OUS.js → readlineWorkspace-UL4LXWHX.js} +252 -78
  85. package/{removeDialogAgentAction-3MUQGFZX.js → removeDialogAgentAction-U3CP2M2H.js} +4 -4
  86. package/{runAgentClientLoop-DRAXPP6R.js → runAgentClientLoop-KKV7BWWC.js} +27 -24
  87. package/{setDialogExtraReferencesAction-MXHX2HPK.js → setDialogExtraReferencesAction-S7GUFLTN.js} +2 -2
  88. package/{setPrimaryDialogAgentAction-7DLDZHDT.js → setPrimaryDialogAgentAction-5SF7G5OS.js} +4 -4
  89. package/{settingSlice-PNLASZGI.js → settingSlice-EXYZ5EFP.js} +3 -3
  90. package/skillDiscovery-UGSQGX2U.js +16 -0
  91. package/{spaceCommands-ORSFAWEY.js → spaceCommands-E7VOF4LO.js} +16 -19
  92. package/{spaceSlice-5F2CDP2O.js → spaceSlice-KIDVQWOV.js} +16 -14
  93. package/{streamAgentChatTurn-ROOB5RLM.js → streamAgentChatTurn-YQH6ZGE6.js} +41 -36
  94. package/{tools-BAWXW4F6.js → tools-5C7OGJEW.js} +21 -19
  95. package/{tuiSummaryLlmCaller-JSI4GL6W.js → tuiSummaryLlmCaller-RV3THLZF.js} +4 -4
  96. package/{understanding-GQKNDDWM.js → understanding-3CUQQ6SV.js} +3 -3
  97. package/{updateDialogTitleAction-KJM65IGF.js → updateDialogTitleAction-JHAVYVIP.js} +12 -12
  98. package/{chunk-X7W4TNB4.js → chunk-CMKUBIGW.js} +3 -3
@@ -3,13 +3,12 @@ import {
3
3
  normalizeDialogRecord,
4
4
  readDialogSnapshot,
5
5
  sortDialogs
6
- } from "./chunk-BKPVTIEK.js";
6
+ } from "./chunk-FVYY6MCS.js";
7
7
  import {
8
8
  CLI_AUTO_TIER_AGENT_KEY_TABLE,
9
9
  CLI_IMAGE_AGENT_KEY,
10
10
  THEME_PALETTES,
11
11
  buildSkillContextBlocks,
12
- buildSkillDiscoveryContextBlock,
13
12
  classifyCliAutoRoute,
14
13
  dimCliText,
15
14
  formatAssistantDisplay,
@@ -37,76 +36,77 @@ import {
37
36
  t,
38
37
  themeColorSequence,
39
38
  themeText
40
- } from "./chunk-2IRF4LEX.js";
39
+ } from "./chunk-4NDK6NWB.js";
40
+ import "./chunk-6HYVJV7B.js";
41
41
  import "./chunk-2FTTDCD4.js";
42
42
  import {
43
43
  listFavoriteAgentIdsAcrossServers,
44
44
  listLocalCachedAgents,
45
45
  listRemoteAgents,
46
46
  listRemoteAgentsAcrossServers
47
- } from "./chunk-TWPGVS2U.js";
47
+ } from "./chunk-7DAJ4AI4.js";
48
48
  import "./chunk-4CQLVGRV.js";
49
- import "./chunk-DZ3XJVET.js";
50
- import "./chunk-EQHI2AR3.js";
51
- import "./chunk-EHLHSX7R.js";
52
49
  import {
53
50
  listUserRecordsFromServers
54
- } from "./chunk-7IPLJUYC.js";
51
+ } from "./chunk-RL776AGR.js";
52
+ import "./chunk-DZ3XJVET.js";
53
+ import "./chunk-RM7KF6OT.js";
54
+ import "./chunk-EHLHSX7R.js";
55
55
  import {
56
56
  getReadableCliDb
57
57
  } from "./chunk-W4NVOSFF.js";
58
58
  import {
59
59
  queryUserRecords,
60
60
  readDbRecord
61
- } from "./chunk-RJKDVL4L.js";
62
- import "./chunk-DGFWICQJ.js";
61
+ } from "./chunk-SDJDLO5W.js";
62
+ import "./chunk-N54XAP77.js";
63
63
  import {
64
64
  resolveCliAgentKeyInput
65
65
  } from "./chunk-VHBWHNVT.js";
66
- import "./chunk-SL35K7AH.js";
67
- import "./chunk-6XKX2N2E.js";
68
- import "./chunk-X7W4TNB4.js";
69
- import "./chunk-ATNTHIZI.js";
70
- import "./chunk-6HYVJV7B.js";
66
+ import "./chunk-LTRXGFMS.js";
67
+ import "./chunk-JRCUAPXX.js";
68
+ import "./chunk-CMKUBIGW.js";
71
69
  import "./chunk-JBTJAPUF.js";
70
+ import "./chunk-ATNTHIZI.js";
72
71
  import "./chunk-JEXVIMYZ.js";
73
- import "./chunk-JRPR5M4O.js";
74
- import "./chunk-KKY4B2Q2.js";
75
- import "./chunk-2MALU52L.js";
76
- import "./chunk-I6DI7SGU.js";
72
+ import "./chunk-C77B4AFC.js";
73
+ import "./chunk-C3RUNRHT.js";
74
+ import "./chunk-YRG2GO6E.js";
77
75
  import "./chunk-GAKEBQD6.js";
78
76
  import "./chunk-KQHGZWSV.js";
79
77
  import "./chunk-XKIMRZO2.js";
80
78
  import "./chunk-3LY4F7SV.js";
81
79
  import "./chunk-VP4WJWKW.js";
82
80
  import "./chunk-63W5N6P3.js";
83
- import "./chunk-MMRAIO5Y.js";
84
- import "./chunk-VH4YK6KZ.js";
85
- import "./chunk-ZQ2UM4KG.js";
81
+ import "./chunk-VF4K2QE6.js";
82
+ import "./chunk-IX4C5TCO.js";
83
+ import "./chunk-OI54SUZ7.js";
84
+ import "./chunk-VC6OZXO5.js";
86
85
  import "./chunk-OWOHNGCN.js";
87
- import "./chunk-3TZDXYSF.js";
88
- import "./chunk-Q2YZULBH.js";
86
+ import "./chunk-OZNNTJM7.js";
87
+ import "./chunk-HNW7IJSK.js";
88
+ import "./chunk-XENYHRUE.js";
89
89
  import {
90
90
  DEFAULT_CONTEXT_WINDOW,
91
91
  extractReferenceKeysFromMessage,
92
92
  getModelContextWindow,
93
93
  planCompression,
94
94
  serializeMessageContent
95
- } from "./chunk-SRLZ7IVA.js";
95
+ } from "./chunk-4P2MDGKS.js";
96
96
  import {
97
97
  buildBuiltinSummaryContent
98
98
  } from "./chunk-4ZDM73SD.js";
99
99
  import "./chunk-MRC4Q34M.js";
100
- import "./chunk-PCWC3JTN.js";
100
+ import "./chunk-MTU75CZ2.js";
101
101
  import "./chunk-CWMSB67P.js";
102
- import "./chunk-QKRUUZCL.js";
103
- import "./chunk-6A3LI5TZ.js";
102
+ import "./chunk-6RSAUKSQ.js";
103
+ import "./chunk-2T2C6CNY.js";
104
104
  import "./chunk-Z4NR32XR.js";
105
105
  import "./chunk-M76ECQRD.js";
106
- import "./chunk-YYUCRDOK.js";
107
- import "./chunk-ZDXZSXYQ.js";
106
+ import "./chunk-SOTZ6RDN.js";
107
+ import "./chunk-2NNJ6S5U.js";
108
108
  import "./chunk-UAD2WT54.js";
109
- import "./chunk-USZMK5UT.js";
109
+ import "./chunk-DCOA4QSN.js";
110
110
  import {
111
111
  runSelfUpdate
112
112
  } from "./chunk-CKOJQDKR.js";
@@ -127,26 +127,33 @@ import {
127
127
  import {
128
128
  DEFAULT_NOLO_SERVER_URL
129
129
  } from "./chunk-OLZBQWZU.js";
130
+ import {
131
+ buildSkillDiscoveryContextBlock
132
+ } from "./chunk-AFON4QUU.js";
133
+ import "./chunk-C4FTUXVF.js";
134
+ import "./chunk-KKY4B2Q2.js";
135
+ import "./chunk-WZSRQNQG.js";
130
136
  import {
131
137
  getProcessRegistry
132
- } from "./chunk-SACYB45H.js";
133
- import "./chunk-DSNONPGW.js";
138
+ } from "./chunk-O2ZNTTET.js";
139
+ import "./chunk-5KLGBAAR.js";
134
140
  import "./chunk-ZNFJWEN4.js";
135
141
  import "./chunk-TILFE6LV.js";
136
142
  import {
137
143
  readCommandActionGatePayload,
138
144
  resolveAgentImageInputSupport
139
- } from "./chunk-MXLQWBVM.js";
145
+ } from "./chunk-4QEWT7KD.js";
140
146
  import "./chunk-OPZYGHUC.js";
141
- import "./chunk-XDVAYP26.js";
142
- import "./chunk-DG7AAAR3.js";
147
+ import "./chunk-AGFH73SK.js";
148
+ import "./chunk-JRKKFRAV.js";
149
+ import "./chunk-P3PKED2I.js";
143
150
  import {
144
151
  clipCompactText
145
152
  } from "./chunk-5MMAK75Q.js";
146
- import "./chunk-572EKYLF.js";
153
+ import "./chunk-BBYVOSU2.js";
147
154
  import "./chunk-5CS33IBL.js";
148
155
  import "./chunk-JZPBVBIY.js";
149
- import "./chunk-BR2WP3DF.js";
156
+ import "./chunk-IWX4UW2E.js";
150
157
  import "./chunk-5MIDPSSK.js";
151
158
  import {
152
159
  extractCustomId
@@ -160,16 +167,13 @@ import {
160
167
  } from "./chunk-HNMXYYJR.js";
161
168
  import "./chunk-H33743XH.js";
162
169
  import "./chunk-LM6IYQ3F.js";
163
- import "./chunk-QO4YO77G.js";
164
- import "./chunk-6CBN7GGH.js";
170
+ import "./chunk-64AAZRGY.js";
165
171
  import "./chunk-Y5GCAMGP.js";
166
- import "./chunk-V2AISYMA.js";
172
+ import "./chunk-KPSWSDUF.js";
167
173
  import "./chunk-AZPCASRE.js";
168
174
  import "./chunk-2EISRLRC.js";
169
175
  import "./chunk-KX6YBIHG.js";
170
- import {
171
- require_index_umd
172
- } from "./chunk-SH2CFQOH.js";
176
+ import "./chunk-O4BU24WZ.js";
173
177
  import "./chunk-I42VC5KR.js";
174
178
  import "./chunk-WWC7I6TA.js";
175
179
  import {
@@ -188,9 +192,7 @@ import {
188
192
  asOptionalTrimmedString
189
193
  } from "./chunk-G3SUCT4W.js";
190
194
  import "./chunk-KUG52IAP.js";
191
- import {
192
- __toESM
193
- } from "./chunk-4VNS5WPM.js";
195
+ import "./chunk-4VNS5WPM.js";
194
196
 
195
197
  // packages/cli/tui/readlineWorkspace.ts
196
198
  import { createInterface } from "node:readline";
@@ -199,7 +201,7 @@ import { existsSync as existsSync2, readFileSync } from "node:fs";
199
201
  import { join } from "node:path";
200
202
 
201
203
  // packages/cli/client/compactDialog.ts
202
- var import_ulid = __toESM(require_index_umd(), 1);
204
+ import { ulid } from "ulid";
203
205
  var DB_PATH = "/api/v1/db";
204
206
  function parseTokenUserId(token) {
205
207
  try {
@@ -271,7 +273,7 @@ var FORKED_CARRY_FIELDS = [
271
273
  "compressionCount"
272
274
  ];
273
275
  function buildForkedDialogRecord(current, userId) {
274
- const newId = (0, import_ulid.ulid)();
276
+ const newId = ulid();
275
277
  const dbKey = `dialog-${userId}-${newId}`;
276
278
  const now = (/* @__PURE__ */ new Date()).toISOString();
277
279
  const carried = {};
@@ -1308,13 +1310,16 @@ async function runAskChoiceDialog(args) {
1308
1310
  text: qs.otherText.slice(0, -1)
1309
1311
  };
1310
1312
  }
1311
- } else if (sequence.length === 1 && sequence.charCodeAt(0) >= 32) {
1313
+ } else if (sequence.length >= 1 && sequence.charCodeAt(0) >= 32 && !sequence.startsWith("\x1B")) {
1312
1314
  const qs = state.questionStates[state.activeIndex];
1313
1315
  if (qs.otherFocused) {
1314
- action = {
1315
- type: "SET_OTHER_TEXT",
1316
- text: qs.otherText + sequence
1317
- };
1316
+ const cleaned = sequence.replace(/[\x00-\x1f\x7f]/g, "");
1317
+ if (cleaned) {
1318
+ action = {
1319
+ type: "SET_OTHER_TEXT",
1320
+ text: qs.otherText + cleaned
1321
+ };
1322
+ }
1318
1323
  }
1319
1324
  }
1320
1325
  if (action) {
@@ -2679,16 +2684,103 @@ function renderKnownAgents(colorEnabled = resolveCliColorEnabled()) {
2679
2684
  ].join("\n");
2680
2685
  }
2681
2686
 
2687
+ // packages/core/collapsedPaste.ts
2688
+ var COLLAPSE_PASTE_MIN_LINES = 8;
2689
+ var COLLAPSE_PASTE_MIN_CHARS = 400;
2690
+ var COLLAPSED_PASTE_PLACEHOLDER_RE = /\[paste #(\d+) · (\d+) lines\]/g;
2691
+ function countTextLines(text) {
2692
+ if (text.length === 0) return 0;
2693
+ let lines = 1;
2694
+ for (let i = 0; i < text.length; i += 1) {
2695
+ if (text.charCodeAt(i) === 10) lines += 1;
2696
+ }
2697
+ return lines;
2698
+ }
2699
+ function shouldCollapsePaste(text, threshold = {}) {
2700
+ const minLines = threshold.minLines ?? COLLAPSE_PASTE_MIN_LINES;
2701
+ const minChars = threshold.minChars ?? COLLAPSE_PASTE_MIN_CHARS;
2702
+ if (text.length === 0) return false;
2703
+ if (text.length >= minChars) return true;
2704
+ return countTextLines(text) >= minLines;
2705
+ }
2706
+ function formatCollapsedPastePlaceholder(id, text) {
2707
+ const lines = countTextLines(text);
2708
+ return `[paste #${id} \xB7 ${lines} lines]`;
2709
+ }
2710
+ function createCollapsedPasteStore() {
2711
+ return { nextId: 1, items: /* @__PURE__ */ new Map() };
2712
+ }
2713
+ function allocateCollapsedPaste(store, text) {
2714
+ const id = store.nextId;
2715
+ store.nextId += 1;
2716
+ store.items.set(id, text);
2717
+ return { id, placeholder: formatCollapsedPastePlaceholder(id, text) };
2718
+ }
2719
+ function releaseCollapsedPaste(store, id) {
2720
+ store.items.delete(id);
2721
+ }
2722
+ function clearCollapsedPasteStore(store) {
2723
+ store.items.clear();
2724
+ store.nextId = 1;
2725
+ }
2726
+ function expandCollapsedPastes(buffer, store) {
2727
+ if (store.items.size === 0) return buffer;
2728
+ COLLAPSED_PASTE_PLACEHOLDER_RE.lastIndex = 0;
2729
+ return buffer.replace(COLLAPSED_PASTE_PLACEHOLDER_RE, (match, idRaw) => {
2730
+ const id = Number(idRaw);
2731
+ const full = store.items.get(id);
2732
+ return full === void 0 ? match : full;
2733
+ });
2734
+ }
2735
+ function expandRangeToCollapsedPasteChips(buffer, start, end) {
2736
+ let s = Math.max(0, Math.min(start, end));
2737
+ let e = Math.max(s, Math.max(start, end));
2738
+ if (s === e) return { start: s, end: e };
2739
+ COLLAPSED_PASTE_PLACEHOLDER_RE.lastIndex = 0;
2740
+ let match;
2741
+ while ((match = COLLAPSED_PASTE_PLACEHOLDER_RE.exec(buffer)) !== null) {
2742
+ const chipStart = match.index;
2743
+ const chipEnd = chipStart + match[0].length;
2744
+ if (chipStart < e && chipEnd > s) {
2745
+ if (chipStart < s) s = chipStart;
2746
+ if (chipEnd > e) e = chipEnd;
2747
+ }
2748
+ }
2749
+ return { start: s, end: e };
2750
+ }
2751
+ function findCollapsedPasteSpanAt(buffer, pos, opts = {}) {
2752
+ COLLAPSED_PASTE_PLACEHOLDER_RE.lastIndex = 0;
2753
+ let match;
2754
+ while ((match = COLLAPSED_PASTE_PLACEHOLDER_RE.exec(buffer)) !== null) {
2755
+ const start = match.index;
2756
+ const end = start + match[0].length;
2757
+ const inside = pos > start && pos < end;
2758
+ const atEnd = opts.preferLeft && pos === end;
2759
+ const atStart = !opts.preferLeft && pos === start;
2760
+ if (inside || atEnd || atStart) {
2761
+ return { id: Number(match[1]), start, end };
2762
+ }
2763
+ }
2764
+ return null;
2765
+ }
2766
+
2682
2767
  // packages/cli/tui/sessionInput.ts
2683
2768
  var PASTE_TOKEN_PREFIX = "\0PASTE\0";
2684
- function applyTuiInputKey(buffer, sequence, key = {}, cursorPos) {
2769
+ function applyTuiInputKey(buffer, sequence, key = {}, cursorPos, options) {
2685
2770
  const seq = sequence ?? "";
2686
2771
  const curPos = Math.max(0, Math.min(buffer.length, cursorPos ?? buffer.length));
2772
+ const pasteStore = options?.pasteStore;
2687
2773
  if (seq.startsWith(PASTE_TOKEN_PREFIX)) {
2688
2774
  const rawPayload = seq.slice(PASTE_TOKEN_PREFIX.length);
2689
2775
  const normalized = rawPayload.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
2690
- const nextBuf2 = buffer.slice(0, curPos) + normalized + buffer.slice(curPos);
2691
- return { buffer: nextBuf2, cursorPos: curPos + normalized.length };
2776
+ const insertAt2 = snapCursorOutsidePasteChip(buffer, curPos);
2777
+ if (pasteStore && shouldCollapsePaste(normalized)) {
2778
+ const { placeholder } = allocateCollapsedPaste(pasteStore, normalized);
2779
+ const nextBuf3 = buffer.slice(0, insertAt2) + placeholder + buffer.slice(insertAt2);
2780
+ return { buffer: nextBuf3, cursorPos: insertAt2 + placeholder.length };
2781
+ }
2782
+ const nextBuf2 = buffer.slice(0, insertAt2) + normalized + buffer.slice(insertAt2);
2783
+ return { buffer: nextBuf2, cursorPos: insertAt2 + normalized.length };
2692
2784
  }
2693
2785
  if (seq === "" || key.ctrl && key.name === "c") {
2694
2786
  return { buffer, cursorPos: curPos, abort: true };
@@ -2697,16 +2789,25 @@ function applyTuiInputKey(buffer, sequence, key = {}, cursorPos) {
2697
2789
  return { buffer, cursorPos: curPos, copyView: true };
2698
2790
  }
2699
2791
  if (seq === "\x1B[13;2~" || seq === "\x1B[27;2;13~" || seq === "\x1B\r" || key.shift && (key.name === "enter" || key.name === "return") || seq === "\n" || key.ctrl && key.name === "j") {
2700
- const nextBuf2 = buffer.slice(0, curPos) + "\n" + buffer.slice(curPos);
2701
- return { buffer: nextBuf2, cursorPos: curPos + 1 };
2792
+ const insertAt2 = snapCursorOutsidePasteChip(buffer, curPos);
2793
+ const nextBuf2 = buffer.slice(0, insertAt2) + "\n" + buffer.slice(insertAt2);
2794
+ return { buffer: nextBuf2, cursorPos: insertAt2 + 1 };
2702
2795
  }
2703
2796
  if (key.name === "enter" || key.name === "return" || seq === "\r") {
2704
2797
  return { buffer: "", cursorPos: 0, submit: buffer };
2705
2798
  }
2706
2799
  if (isLeftArrowSequence(seq, key)) {
2800
+ const span = findCollapsedPasteSpanAt(buffer, curPos, { preferLeft: true });
2801
+ if (span && curPos > span.start && curPos <= span.end) {
2802
+ return { buffer, cursorPos: span.start };
2803
+ }
2707
2804
  return { buffer, cursorPos: Math.max(0, curPos - 1) };
2708
2805
  }
2709
2806
  if (isRightArrowSequence(seq, key)) {
2807
+ const span = findCollapsedPasteSpanAt(buffer, curPos);
2808
+ if (span && curPos >= span.start && curPos < span.end) {
2809
+ return { buffer, cursorPos: span.end };
2810
+ }
2710
2811
  return { buffer, cursorPos: Math.min(buffer.length, curPos + 1) };
2711
2812
  }
2712
2813
  if (isHomeSequence(seq, key)) {
@@ -2717,24 +2818,33 @@ function applyTuiInputKey(buffer, sequence, key = {}, cursorPos) {
2717
2818
  }
2718
2819
  if (isDeleteWordSequence(seq, key)) {
2719
2820
  if (curPos === 0) return { buffer, cursorPos: curPos };
2821
+ const pasteSpan = findCollapsedPasteSpanAt(buffer, curPos, {
2822
+ preferLeft: true
2823
+ });
2824
+ if (pasteSpan && (curPos === pasteSpan.end || curPos > pasteSpan.start && curPos < pasteSpan.end)) {
2825
+ return removePasteSpan(buffer, pasteSpan, pasteStore);
2826
+ }
2720
2827
  const cutIdx = findWordStartLeft(buffer, curPos);
2721
- const nextBuf2 = buffer.slice(0, cutIdx) + buffer.slice(curPos);
2722
- return { buffer: nextBuf2, cursorPos: cutIdx };
2828
+ return deleteBufferRange(buffer, cutIdx, curPos, pasteStore);
2723
2829
  }
2724
2830
  if (isKillToLineStartSequence(seq, key)) {
2725
2831
  if (curPos === 0) return { buffer, cursorPos: curPos };
2726
2832
  const lineStart = buffer.lastIndexOf("\n", curPos - 1) + 1;
2727
- const nextBuf2 = buffer.slice(0, lineStart) + buffer.slice(curPos);
2728
- return { buffer: nextBuf2, cursorPos: lineStart };
2833
+ return deleteBufferRange(buffer, lineStart, curPos, pasteStore);
2729
2834
  }
2730
2835
  if (isKillToLineEndSequence(seq, key)) {
2731
2836
  const nlIdx = buffer.indexOf("\n", curPos);
2732
2837
  const lineEnd = nlIdx === -1 ? buffer.length : nlIdx;
2733
- const nextBuf2 = buffer.slice(0, curPos) + buffer.slice(lineEnd);
2734
- return { buffer: nextBuf2, cursorPos: curPos };
2838
+ return deleteBufferRange(buffer, curPos, lineEnd, pasteStore);
2735
2839
  }
2736
2840
  if (isBackspaceSequence(seq, key)) {
2737
2841
  if (curPos > 0) {
2842
+ const pasteSpan = findCollapsedPasteSpanAt(buffer, curPos, {
2843
+ preferLeft: true
2844
+ });
2845
+ if (pasteSpan && (curPos === pasteSpan.end || curPos > pasteSpan.start && curPos < pasteSpan.end)) {
2846
+ return removePasteSpan(buffer, pasteSpan, pasteStore);
2847
+ }
2738
2848
  const nextBuf2 = buffer.slice(0, curPos - 1) + buffer.slice(curPos);
2739
2849
  return { buffer: nextBuf2, cursorPos: curPos - 1 };
2740
2850
  }
@@ -2742,6 +2852,10 @@ function applyTuiInputKey(buffer, sequence, key = {}, cursorPos) {
2742
2852
  }
2743
2853
  if (isForwardDeleteSequence(seq, key)) {
2744
2854
  if (curPos < buffer.length) {
2855
+ const pasteSpan = findCollapsedPasteSpanAt(buffer, curPos);
2856
+ if (pasteSpan && (curPos === pasteSpan.start || curPos > pasteSpan.start && curPos < pasteSpan.end)) {
2857
+ return removePasteSpan(buffer, pasteSpan, pasteStore);
2858
+ }
2745
2859
  const nextBuf2 = buffer.slice(0, curPos) + buffer.slice(curPos + 1);
2746
2860
  return { buffer: nextBuf2, cursorPos: curPos };
2747
2861
  }
@@ -2758,8 +2872,14 @@ function applyTuiInputKey(buffer, sequence, key = {}, cursorPos) {
2758
2872
  if (!seq || key.ctrl || key.meta || seq.startsWith("\x1B")) {
2759
2873
  return { buffer, cursorPos: curPos };
2760
2874
  }
2761
- const nextBuf = buffer.slice(0, curPos) + seq + buffer.slice(curPos);
2762
- return { buffer: nextBuf, cursorPos: curPos + seq.length };
2875
+ const insertAt = snapCursorOutsidePasteChip(buffer, curPos);
2876
+ const nextBuf = buffer.slice(0, insertAt) + seq + buffer.slice(insertAt);
2877
+ return { buffer: nextBuf, cursorPos: insertAt + seq.length };
2878
+ }
2879
+ function snapCursorOutsidePasteChip(buffer, pos) {
2880
+ const span = findCollapsedPasteSpanAt(buffer, pos);
2881
+ if (span && pos > span.start && pos < span.end) return span.end;
2882
+ return pos;
2763
2883
  }
2764
2884
  function isLeftArrowSequence(seq, key) {
2765
2885
  if (key.name === "left") return true;
@@ -2783,13 +2903,44 @@ function isEndSequence(seq, key) {
2783
2903
  if (seq === "" || seq === "\x1B[F" || seq === "\x1B[4~" || seq === "\x1B[8~" || seq === "\x1BOF") return true;
2784
2904
  return false;
2785
2905
  }
2906
+ function removePasteSpan(buffer, span, pasteStore) {
2907
+ if (pasteStore) releaseCollapsedPaste(pasteStore, span.id);
2908
+ const nextBuf = buffer.slice(0, span.start) + buffer.slice(span.end);
2909
+ return { buffer: nextBuf, cursorPos: span.start };
2910
+ }
2911
+ function deleteBufferRange(buffer, start, end, pasteStore) {
2912
+ if (start >= end) return { buffer, cursorPos: start };
2913
+ const range = expandRangeToCollapsedPasteChips(buffer, start, end);
2914
+ releasePastesInRange(buffer, range.start, range.end, pasteStore);
2915
+ const nextBuf = buffer.slice(0, range.start) + buffer.slice(range.end);
2916
+ return { buffer: nextBuf, cursorPos: range.start };
2917
+ }
2918
+ function releasePastesInRange(buffer, start, end, pasteStore) {
2919
+ if (!pasteStore || start >= end) return;
2920
+ const slice = buffer.slice(start, end);
2921
+ const re = /\[paste #(\d+) · (\d+) lines\]/g;
2922
+ let match;
2923
+ while ((match = re.exec(slice)) !== null) {
2924
+ releaseCollapsedPaste(pasteStore, Number(match[1]));
2925
+ }
2926
+ }
2786
2927
  var CJK_CHAR = /[\u4e00-\u9fff\u3000-\u303f\uff00-\uffef]/;
2787
2928
  function findWordStartLeft(buffer, curPos) {
2788
2929
  let i = curPos;
2789
2930
  while (i > 0 && /\s/.test(buffer[i - 1])) i--;
2790
2931
  if (i === 0) return 0;
2932
+ const spanAtCursor = findCollapsedPasteSpanAt(buffer, i, {
2933
+ preferLeft: true
2934
+ });
2935
+ if (spanAtCursor && (i === spanAtCursor.end || i > spanAtCursor.start && i < spanAtCursor.end)) {
2936
+ return spanAtCursor.start;
2937
+ }
2791
2938
  if (CJK_CHAR.test(buffer[i - 1])) return i - 1;
2792
- while (i > 0 && !/\s/.test(buffer[i - 1]) && !CJK_CHAR.test(buffer[i - 1])) i--;
2939
+ while (i > 0 && !/\s/.test(buffer[i - 1]) && !CJK_CHAR.test(buffer[i - 1])) {
2940
+ const span = findCollapsedPasteSpanAt(buffer, i, { preferLeft: true });
2941
+ if (span && i === span.end) break;
2942
+ i--;
2943
+ }
2793
2944
  return i;
2794
2945
  }
2795
2946
  function isDeleteWordSequence(seq, key) {
@@ -2939,6 +3090,14 @@ function applyAgentSwitch(state, target) {
2939
3090
  output: `Switched to ${target.name}. ${state.dialogId ? `Dialog kept: ${state.dialogId}` : "Dialog kept: new"}`
2940
3091
  };
2941
3092
  }
3093
+ function formatAttachedSkillLine(skillRef) {
3094
+ const colorEnabled = resolveCliColorEnabled();
3095
+ if (!colorEnabled) return `\u25CF Attached skill: ${skillRef}`;
3096
+ const bullet = themeText("\u25CF", "success", true);
3097
+ const label = themeText("Attached skill:", "muted", true);
3098
+ const name = themeText(skillRef, "chrome", true);
3099
+ return `${bullet} ${label} ${name}`;
3100
+ }
2942
3101
  function handleTuiInput(input, state) {
2943
3102
  const trimmed = input.trim();
2944
3103
  if (!trimmed) {
@@ -3323,7 +3482,7 @@ Use /switch, /switch list, /switch minimax-m3, or a full agent key.`
3323
3482
  const attachedSkills = state.attachedSkills.includes(skillRef) ? state.attachedSkills : [...state.attachedSkills, skillRef];
3324
3483
  return {
3325
3484
  nextState: { ...state, attachedSkills },
3326
- output: `Attached skill: ${skillRef}`
3485
+ output: formatAttachedSkillLine(skillRef)
3327
3486
  };
3328
3487
  }
3329
3488
  if (sub === "detach") {
@@ -3913,6 +4072,14 @@ function applyScrollAction(history, action, output, inputLines) {
3913
4072
  }
3914
4073
 
3915
4074
  // packages/cli/tui/tuiRawInput.ts
4075
+ function styleCollapsedPastePlaceholders(text, colorEnabled) {
4076
+ if (!colorEnabled || !text.includes("[paste #")) return text;
4077
+ COLLAPSED_PASTE_PLACEHOLDER_RE.lastIndex = 0;
4078
+ return text.replace(
4079
+ COLLAPSED_PASTE_PLACEHOLDER_RE,
4080
+ (match) => themeText(match, "accent", true)
4081
+ );
4082
+ }
3916
4083
  function createNoopFixedInput() {
3917
4084
  return {
3918
4085
  active: false,
@@ -4006,7 +4173,9 @@ function createFixedInput(output, config) {
4006
4173
  for (let j = 0; j < rows.length; j += 1) {
4007
4174
  const rowPrefix = j === 0 ? prefix : " ".repeat(promptWidth);
4008
4175
  const rowText = rows[j] ?? "";
4009
- sections.push(`${rowPrefix}${rowText}`);
4176
+ sections.push(
4177
+ `${rowPrefix}${styleCollapsedPastePlaceholders(rowText, colorEnabled)}`
4178
+ );
4010
4179
  const rowLen = rowText.length;
4011
4180
  if (!cursorFound) {
4012
4181
  if (targetPos <= charOffset + rowLen || j === rows.length - 1 && i === logicalLines.length - 1) {
@@ -4598,6 +4767,7 @@ async function startTuiWorkspace(options) {
4598
4767
  let fixedInput = createNoopFixedInput();
4599
4768
  let buffer = "";
4600
4769
  let cursorPos = 0;
4770
+ const pasteStore = createCollapsedPasteStore();
4601
4771
  let activeTurnAbort = null;
4602
4772
  const activityIndicator = createActivityIndicator({
4603
4773
  isTurnActive: () => activeTurnAbort !== null,
@@ -5209,7 +5379,9 @@ ${err.message}` : ""}`
5209
5379
  activeTurnAbort.abort();
5210
5380
  return;
5211
5381
  }
5212
- const result = applyTuiInputKey(buffer, sequence, {}, cursorPos2);
5382
+ const result = applyTuiInputKey(buffer, sequence, {}, cursorPos2, {
5383
+ pasteStore
5384
+ });
5213
5385
  if (result.copyView) {
5214
5386
  if (busyLock) return;
5215
5387
  busy = true;
@@ -5230,14 +5402,14 @@ ${err.message}` : ""}`
5230
5402
  return;
5231
5403
  }
5232
5404
  if (result.submit !== void 0) {
5405
+ const submittedText = expandCollapsedPastes(result.submit, pasteStore);
5233
5406
  if (busyLock) {
5234
- const submittedText2 = result.submit;
5235
- const trimmedText = submittedText2.trim();
5407
+ const trimmedText = submittedText.trim();
5236
5408
  const busySlashCommand = trimmedText.split(/\s+/)[0]?.toLowerCase();
5237
5409
  const isBusyLocalSlash = busySlashCommand === "/context" || busySlashCommand === "/ctx" || busySlashCommand === "/switch";
5238
5410
  if (isBusyLocalSlash) {
5239
5411
  const beforeAgentKey = state.agentKey;
5240
- const res = handleTuiInput(submittedText2, state);
5412
+ const res = handleTuiInput(submittedText, state);
5241
5413
  if (res.action) {
5242
5414
  output.write(
5243
5415
  "Model picker isn't available while a reply is running. Use `/switch <name>` to switch now (takes effect on the next turn), or wait for the reply to finish.\n"
@@ -5255,6 +5427,7 @@ ${hint}` : hint;
5255
5427
  `);
5256
5428
  }
5257
5429
  }
5430
+ clearCollapsedPasteStore(pasteStore);
5258
5431
  buffer = "";
5259
5432
  cursorPos2 = 0;
5260
5433
  if (fixedInput.active) fixedInput.repaint(buffer, cursorPos2);
@@ -5289,16 +5462,17 @@ ${hint}` : hint;
5289
5462
  }
5290
5463
  );
5291
5464
  const decision = binding.resolveSubmit({
5292
- text: submittedText2,
5465
+ text: submittedText,
5293
5466
  isRunning: true
5294
5467
  });
5295
5468
  if (decision.kind === "queue-text") {
5469
+ clearCollapsedPasteStore(pasteStore);
5296
5470
  binding.enqueue(decision.text);
5297
5471
  buffer = "";
5298
5472
  cursorPos2 = 0;
5299
5473
  fixedInput.repaint(buffer, cursorPos2);
5300
5474
  } else if (decision.kind === "queue-blocked") {
5301
- } else if (decision.kind === "noop" && !submittedText2.trim() && binding.queueLength() > 0) {
5475
+ } else if (decision.kind === "noop" && !submittedText.trim() && binding.queueLength() > 0) {
5302
5476
  if (binding.preemptForDrain()) {
5303
5477
  if (activeTurnAbort) {
5304
5478
  activeTurnAbort.abort();
@@ -5307,7 +5481,7 @@ ${hint}` : hint;
5307
5481
  }
5308
5482
  return;
5309
5483
  }
5310
- if (!result.submit.trim() && chatQueueBinding && chatQueueBinding.queueLength() > 0) {
5484
+ if (!submittedText.trim() && chatQueueBinding && chatQueueBinding.queueLength() > 0) {
5311
5485
  const actionGateHandler = async (gate) => {
5312
5486
  modalOwnsKeyboard = true;
5313
5487
  try {
@@ -5367,8 +5541,8 @@ ${err.message}` : ""}`
5367
5541
  return;
5368
5542
  }
5369
5543
  }
5544
+ clearCollapsedPasteStore(pasteStore);
5370
5545
  busy = true;
5371
- const submittedText = result.submit;
5372
5546
  buffer = "";
5373
5547
  cursorPos2 = 0;
5374
5548
  fixedInput.enterOutputMode(submittedText);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  cleanupCliSessionForDialog
3
- } from "./chunk-6A3LI5TZ.js";
3
+ } from "./chunk-2T2C6CNY.js";
4
4
  import {
5
5
  getPrimaryDialogAgentId,
6
6
  removeDialogAgentId
@@ -11,16 +11,16 @@ import {
11
11
  import {
12
12
  getActiveDialogKey
13
13
  } from "./chunk-3ASDTTEI.js";
14
- import "./chunk-6CBN7GGH.js";
14
+ import "./chunk-64AAZRGY.js";
15
15
  import "./chunk-Y5GCAMGP.js";
16
16
  import {
17
17
  patch,
18
18
  selectById
19
- } from "./chunk-V2AISYMA.js";
19
+ } from "./chunk-KPSWSDUF.js";
20
20
  import "./chunk-AZPCASRE.js";
21
21
  import "./chunk-2EISRLRC.js";
22
22
  import "./chunk-KX6YBIHG.js";
23
- import "./chunk-SH2CFQOH.js";
23
+ import "./chunk-O4BU24WZ.js";
24
24
  import "./chunk-I42VC5KR.js";
25
25
  import "./chunk-WWC7I6TA.js";
26
26
  import "./chunk-QSJ3HFEF.js";