@lvce-editor/chat-view 6.18.0 → 6.21.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.
@@ -1252,6 +1252,10 @@ const showContextMenu2 = async (uid, menuId, x, y, args) => {
1252
1252
  number(y);
1253
1253
  await invoke$2('ContextMenu.show2', uid, menuId, x, y, args);
1254
1254
  };
1255
+ const sendMessagePortToClipBoardWorker$1 = async (port, rpcId) => {
1256
+ const command = 'ClipBoard.handleMessagePort';
1257
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToClipBoardWorker', port, command, rpcId);
1258
+ };
1255
1259
  const sendMessagePortToOpenerWorker$1 = async (port, rpcId) => {
1256
1260
  const command = 'HandleMessagePort.handleMessagePort';
1257
1261
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToOpenerWorker', port, command, rpcId);
@@ -1457,6 +1461,19 @@ const clearInput = async state => {
1457
1461
  };
1458
1462
  };
1459
1463
 
1464
+ let text$1 = '';
1465
+ const writeText = async value => {
1466
+ text$1 = value;
1467
+ };
1468
+ const readText = async () => {
1469
+ return text$1;
1470
+ };
1471
+
1472
+ const copyInput = async state => {
1473
+ await writeText(state.composerValue);
1474
+ return state;
1475
+ };
1476
+
1460
1477
  const emptyObject = {};
1461
1478
  const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
1462
1479
  const i18nString = (key, placeholders = emptyObject) => {
@@ -1473,7 +1490,7 @@ const chatTitle = () => {
1473
1490
  return i18nString('Chat');
1474
1491
  };
1475
1492
  const chats = () => {
1476
- return i18nString('Chats');
1493
+ return i18nString('Chat');
1477
1494
  };
1478
1495
  const newChat = () => {
1479
1496
  return i18nString('New Chat');
@@ -1551,7 +1568,7 @@ const getOpenApiApiKey = () => {
1551
1568
  return i18nString('Get API Key');
1552
1569
  };
1553
1570
  const deleteChatSession$1 = () => {
1554
- return i18nString('Delete chat session');
1571
+ return i18nString('Archive');
1555
1572
  };
1556
1573
  const defaultSessionTitle = () => {
1557
1574
  return i18nString('Chat 1');
@@ -1794,6 +1811,11 @@ const create = (uid, x, y, width, height, platform, assetDir) => {
1794
1811
  set$1(uid, state, state);
1795
1812
  };
1796
1813
 
1814
+ const cutInput = async state => {
1815
+ await writeText(state.composerValue);
1816
+ return clearInput(state);
1817
+ };
1818
+
1797
1819
  const invoke$1 = async (method, ...params) => {
1798
1820
  {
1799
1821
  throw new Error('ChatStorageWorker is not initialized');
@@ -2971,6 +2993,7 @@ const OpenContainingFolder = 'Open Containing Folder';
2971
2993
  const OpenInIntegratedTerminal = 'Open in integrated Terminal';
2972
2994
  const Paste = 'Paste';
2973
2995
  const Rename = 'Rename';
2996
+ const Archive = 'Archive';
2974
2997
 
2975
2998
  const openContainingFolder = () => {
2976
2999
  return i18nString(OpenContainingFolder);
@@ -2996,10 +3019,32 @@ const copyRelativePath = () => {
2996
3019
  const rename = () => {
2997
3020
  return i18nString(Rename);
2998
3021
  };
3022
+ const archive = () => {
3023
+ return i18nString(Archive);
3024
+ };
2999
3025
  const deleteItem = () => {
3000
3026
  return i18nString(Delete);
3001
3027
  };
3002
3028
 
3029
+ const getMenuEntriesChatList = () => {
3030
+ return [{
3031
+ command: 'Chat.handleClickRename',
3032
+ flags: None,
3033
+ id: 'rename',
3034
+ label: rename()
3035
+ }, {
3036
+ command: 'Chat.handleClickArchive',
3037
+ flags: None,
3038
+ id: 'archive',
3039
+ label: archive()
3040
+ }];
3041
+ };
3042
+
3043
+ const MenuChatList = 2178;
3044
+ const getMenuEntryIds = () => {
3045
+ return [Chat$1, MenuChatList];
3046
+ };
3047
+
3003
3048
  const menuEntrySeparator = {
3004
3049
  command: '',
3005
3050
  flags: Separator,
@@ -3070,12 +3115,13 @@ const menuEntryDelete = {
3070
3115
  const getMenuEntriesFile = () => {
3071
3116
  return [menuEntryCopyAsE2eTest, menuEntryOpenContainingFolder, menuEntryOpenInIntegratedTerminal, menuEntrySeparator, menuEntryCut, menuEntryCopy, menuEntryPaste, menuEntrySeparator, menuEntryCopyPath, menuEntryCopyRelativePath, menuEntrySeparator, menuEntryRename, menuEntryDelete];
3072
3117
  };
3073
- const getMenuEntries = () => {
3074
- return getMenuEntriesFile();
3075
- };
3076
-
3077
- const getMenuEntryIds = () => {
3078
- return [Chat$1];
3118
+ const getMenuEntries = menuId => {
3119
+ switch (menuId) {
3120
+ case MenuChatList:
3121
+ return getMenuEntriesChatList();
3122
+ default:
3123
+ return getMenuEntriesFile();
3124
+ }
3079
3125
  };
3080
3126
 
3081
3127
  const getQuickPickMenuEntries = () => {
@@ -3086,6 +3132,14 @@ const getSelectedSessionId = state => {
3086
3132
  return state.selectedSessionId;
3087
3133
  };
3088
3134
 
3135
+ const handleChatHeaderContextMenu = async state => {
3136
+ return state;
3137
+ };
3138
+
3139
+ const handleChatInputContextMenu = async state => {
3140
+ return state;
3141
+ };
3142
+
3089
3143
  const getListIndex = (state, eventX, eventY) => {
3090
3144
  const {
3091
3145
  headerHeight,
@@ -3103,18 +3157,29 @@ const getListIndex = (state, eventX, eventY) => {
3103
3157
  return Math.floor(relativeY / listItemHeight);
3104
3158
  };
3105
3159
 
3106
- const CHAT_LIST_ITEM_CONTEXT_MENU = 'ChatListItemContextMenu';
3107
3160
  const handleChatListContextMenu = async (state, eventX, eventY) => {
3161
+ const {
3162
+ selectedProjectId,
3163
+ sessions,
3164
+ uid
3165
+ } = state;
3108
3166
  const index = getListIndex(state, eventX, eventY);
3109
3167
  if (index === -1) {
3110
3168
  return state;
3111
3169
  }
3112
- const visibleSessions = getVisibleSessions(state.sessions, state.selectedProjectId);
3170
+ const visibleSessions = getVisibleSessions(sessions, selectedProjectId);
3113
3171
  const item = visibleSessions[index];
3114
3172
  if (!item) {
3115
3173
  return state;
3116
3174
  }
3117
- await invoke$2('ContextMenu.show', eventX, eventY, CHAT_LIST_ITEM_CONTEXT_MENU, item.id);
3175
+ await showContextMenu2(uid, -1, eventX, eventY, {
3176
+ menuId: -1,
3177
+ sessionId: item.id
3178
+ });
3179
+ return state;
3180
+ };
3181
+
3182
+ const handleChatWelcomeContextMenu = async state => {
3118
3183
  return state;
3119
3184
  };
3120
3185
 
@@ -8029,6 +8094,10 @@ const handleClickSettings = async () => {
8029
8094
  await invoke$2('Main.openUri', 'app://settings.json');
8030
8095
  };
8031
8096
 
8097
+ const handleContextMenuChatSendAreaBottom = async state => {
8098
+ return state;
8099
+ };
8100
+
8032
8101
  const handleDragEnter = async (state, name, hasFiles = true) => {
8033
8102
  if (name !== ComposerDropTarget) {
8034
8103
  return state;
@@ -8990,6 +9059,11 @@ const openMockSession = async (state, mockSessionId, mockChatMessages) => {
8990
9059
  };
8991
9060
  };
8992
9061
 
9062
+ const pasteInput = async state => {
9063
+ const text = await readText();
9064
+ return handleInput(state, Composer, text, 'script');
9065
+ };
9066
+
8993
9067
  const registerMockResponse = (state, mockResponse) => {
8994
9068
  reset$2();
8995
9069
  pushChunk(mockResponse.text);
@@ -8997,6 +9071,7 @@ const registerMockResponse = (state, mockResponse) => {
8997
9071
  return state;
8998
9072
  };
8999
9073
 
9074
+ /* eslint-disable @cspell/spellchecker */
9000
9075
  const getCss = (composerHeight, listItemHeight, chatMessageFontSize, chatMessageLineHeight, chatMessageFontFamily, textAreaPaddingTop, textAreaPaddingLeft, textAreaPaddingRight, textAreaPaddingBottom, chatSendAreaPaddingTop, chatSendAreaPaddingLeft, chatSendAreaPaddingRight, chatSendAreaPaddingBottom, renderHtmlCss) => {
9001
9076
  const buttonsHeight = 20;
9002
9077
  const gap = 10;
@@ -9023,6 +9098,50 @@ const getCss = (composerHeight, listItemHeight, chatMessageFontSize, chatMessage
9023
9098
  .ChatSendAreaBottom{
9024
9099
  height: ${buttonsHeight}px;
9025
9100
  }
9101
+
9102
+ .ChatSendArea:focus-within{
9103
+ border-color: darkcyan;
9104
+ }
9105
+
9106
+ .ChatListItem{
9107
+ display:flex;
9108
+ align-items:center;
9109
+ }
9110
+
9111
+ .ChatMessageContent p + p{
9112
+ margin-top: 0.75em;
9113
+ }
9114
+
9115
+ .ChatListItemStatusRow{
9116
+ width: 16px;
9117
+ min-width: 16px;
9118
+ display:flex;
9119
+ align-items:center;
9120
+ justify-content:center;
9121
+ }
9122
+
9123
+ .ChatListItemStatusIcon{
9124
+ font-size: 10px;
9125
+ }
9126
+
9127
+ .ChatListItemStatusStopped{
9128
+ color: var(--vscode-disabledForeground);
9129
+ }
9130
+
9131
+ .ChatListItemStatusInProgress{
9132
+ color: var(--vscode-charts-blue);
9133
+ }
9134
+
9135
+ .ChatListItemStatusFinished{
9136
+ color: var(--vscode-testing-iconPassed);
9137
+ .ChatListItem .SessionArchiveButton{
9138
+ opacity: 0;
9139
+ }
9140
+
9141
+ .ChatListItem:hover .SessionArchiveButton,
9142
+ .ChatListItem:focus-within .SessionArchiveButton{
9143
+ opacity: 1;
9144
+ }
9026
9145
  `;
9027
9146
  return `${baseCss}
9028
9147
 
@@ -9122,7 +9241,13 @@ const LabelDetail = 'LabelDetail';
9122
9241
  const ChatList = 'ChatList';
9123
9242
  const ChatListEmpty = 'ChatListEmpty';
9124
9243
  const ChatListItem = 'ChatListItem';
9244
+ const ChatListItemStatusRow = 'ChatListItemStatusRow';
9245
+ const ChatListItemStatusIcon = 'ChatListItemStatusIcon';
9246
+ const ChatListItemStatusStopped = 'ChatListItemStatusStopped';
9247
+ const ChatListItemStatusInProgress = 'ChatListItemStatusInProgress';
9248
+ const ChatListItemStatusFinished = 'ChatListItemStatusFinished';
9125
9249
  const ChatListItemLabel = 'ChatListItemLabel';
9250
+ const SessionArchiveButton = 'SessionArchiveButton';
9126
9251
  const ProjectAddButton = 'ProjectAddButton';
9127
9252
  const ProjectList = 'ProjectList';
9128
9253
  const ProjectListChevron = 'ProjectListChevron';
@@ -9210,6 +9335,10 @@ const HandleClickDictationButton = 34;
9210
9335
  const HandleMissingApiKeySubmit = 35;
9211
9336
  const HandleRunModeChange = 36;
9212
9337
  const HandleSearchInput = 37;
9338
+ const HandleChatWelcomeContextMenu = 39;
9339
+ const HandleChatHeaderContextMenu = 40;
9340
+ const HandleChatInputContextMenu = 41;
9341
+ const HandleContextMenuChatSendAreaBottom = 42;
9213
9342
 
9214
9343
  const getModelLabel = model => {
9215
9344
  if (model.provider === 'openRouter') {
@@ -9449,6 +9578,7 @@ const getChatSendAreaDom = (composerValue, modelPickerOpen, modelPickerSearchVal
9449
9578
  childCount: 0,
9450
9579
  className: MultilineInputBox,
9451
9580
  name: Composer,
9581
+ onContextMenu: HandleChatInputContextMenu,
9452
9582
  onFocus: HandleFocus,
9453
9583
  onInput: HandleInput,
9454
9584
  placeholder: composePlaceholder(),
@@ -9457,6 +9587,7 @@ const getChatSendAreaDom = (composerValue, modelPickerOpen, modelPickerSearchVal
9457
9587
  }, {
9458
9588
  childCount: voiceDictationEnabled ? controlsCount + 1 : controlsCount,
9459
9589
  className: ChatSendAreaBottom,
9590
+ onContextMenu: HandleContextMenuChatSendAreaBottom,
9460
9591
  type: Div
9461
9592
  }, ...(newChatModelPickerEnabled ? getChatModelPickerVirtualDom(models, selectedModelId, modelPickerOpen, modelPickerSearchValue) : getChatSelectVirtualDom(models, selectedModelId)), ...(showRunMode ? getRunModeSelectVirtualDom(runMode) : []), ...(usageOverviewEnabled ? getUsageOverviewDom(tokensUsed, tokensMax) : []), ...(addContextButtonEnabled ? getAddContextButtonDom() : []), ...getSendButtonDom(isSendDisabled, voiceDictationEnabled)];
9462
9593
  };
@@ -10742,6 +10873,7 @@ const getEmptyMessagesDom = () => {
10742
10873
  return [{
10743
10874
  childCount: 1,
10744
10875
  className: ChatWelcomeMessage,
10876
+ onContextMenu: HandleChatWelcomeContextMenu,
10745
10877
  type: Div
10746
10878
  }, text(startConversation())];
10747
10879
  };
@@ -11030,6 +11162,7 @@ const getChatHeaderActionsDom = (viewMode, authEnabled = false, authStatus = 'si
11030
11162
  return [{
11031
11163
  childCount: items.length,
11032
11164
  className: ChatActions,
11165
+ role: 'toolbar',
11033
11166
  type: Div
11034
11167
  }, ...items.flatMap(getHeaderActionVirtualDom)];
11035
11168
  };
@@ -11039,6 +11172,7 @@ const getChatHeaderDomDetailMode = (selectedSessionTitle, authEnabled = false, a
11039
11172
  return [{
11040
11173
  childCount: hasAuthError ? 3 : 2,
11041
11174
  className: ChatHeader,
11175
+ onContextMenu: HandleChatHeaderContextMenu,
11042
11176
  type: Div
11043
11177
  }, {
11044
11178
  childCount: 2,
@@ -11120,6 +11254,7 @@ const getChatHeaderListModeDom = (authEnabled = false, authStatus = 'signed-out'
11120
11254
  return [{
11121
11255
  childCount: headerChildCount,
11122
11256
  className: ChatHeader,
11257
+ onContextMenu: HandleChatHeaderContextMenu,
11123
11258
  type: Div
11124
11259
  }, {
11125
11260
  childCount: 1,
@@ -11157,18 +11292,37 @@ const getEmptyChatSessionsDom = () => {
11157
11292
  }, text(clickToOpenNewChat())];
11158
11293
  };
11159
11294
 
11295
+ const getSessionStatusClassName = session => {
11296
+ const hasInProgressAssistantMessage = session.messages.some(message => message.role === 'assistant' && message.inProgress);
11297
+ if (hasInProgressAssistantMessage) {
11298
+ return ChatListItemStatusInProgress;
11299
+ }
11300
+ const hasAssistantMessage = session.messages.some(message => message.role === 'assistant');
11301
+ if (hasAssistantMessage) {
11302
+ return ChatListItemStatusFinished;
11303
+ }
11304
+ return ChatListItemStatusStopped;
11305
+ };
11160
11306
  const getSessionDom = session => {
11161
11307
  const sessionClassName = ChatListItem;
11308
+ const sessionStatusClassName = getSessionStatusClassName(session);
11162
11309
  return [{
11163
- childCount: 2,
11310
+ childCount: 3,
11164
11311
  className: sessionClassName,
11165
11312
  type: Li
11313
+ }, {
11314
+ childCount: 1,
11315
+ className: ChatListItemStatusRow,
11316
+ type: Div
11317
+ }, {
11318
+ childCount: 0,
11319
+ className: `${ChatListItemStatusIcon} codicon codicon-circle-filled ${sessionStatusClassName}`,
11320
+ type: Div
11166
11321
  }, {
11167
11322
  childCount: 1,
11168
11323
  className: ChatListItemLabel,
11169
11324
  name: getSessionInputName(session.id),
11170
11325
  onContextMenu: HandleListContextMenu,
11171
- tabIndex: 0,
11172
11326
  type: Div
11173
11327
  }, text(session.title), {
11174
11328
  childCount: 1,
@@ -11176,14 +11330,18 @@ const getSessionDom = session => {
11176
11330
  type: Div
11177
11331
  }, {
11178
11332
  childCount: 1,
11179
- className: IconButton,
11333
+ className: mergeClassNames(IconButton, SessionArchiveButton),
11180
11334
  'data-id': session.id,
11181
11335
  name: SessionDelete,
11182
11336
  onClick: HandleClickDelete,
11183
11337
  tabIndex: 0,
11184
11338
  title: deleteChatSession$1(),
11185
11339
  type: Button$1
11186
- }, text('🗑')];
11340
+ }, {
11341
+ childCount: 0,
11342
+ className: 'MaskIcon MaskIconTrash',
11343
+ type: Div
11344
+ }];
11187
11345
  };
11188
11346
 
11189
11347
  const getChatListDom = (sessions, selectedSessionId, chatListScrollTop = 0) => {
@@ -11811,9 +11969,24 @@ const renderEventListeners = () => {
11811
11969
  name: HandleMessagesContextMenu,
11812
11970
  params: ['handleMessagesContextMenu'],
11813
11971
  preventDefault: true
11972
+ }, {
11973
+ name: HandleChatWelcomeContextMenu,
11974
+ params: ['handleChatWelcomeContextMenu']
11975
+ }, {
11976
+ name: HandleChatHeaderContextMenu,
11977
+ params: ['handleChatHeaderContextMenu'],
11978
+ preventDefault: true
11814
11979
  }, {
11815
11980
  name: HandleFocus,
11816
11981
  params: ['handleInputFocus', TargetName]
11982
+ }, {
11983
+ name: HandleChatInputContextMenu,
11984
+ params: ['handleChatInputContextMenu'],
11985
+ preventDefault: true
11986
+ }, {
11987
+ name: HandleContextMenuChatSendAreaBottom,
11988
+ params: ['handleContextMenuChatSendAreaBottom'],
11989
+ preventDefault: true
11817
11990
  }, {
11818
11991
  name: HandleKeyDown,
11819
11992
  params: ['handleKeyDown', Key, ShiftKey]
@@ -12061,7 +12234,9 @@ const useMockApi = (state, value, mockApiCommandId = defaultMockApiCommandId) =>
12061
12234
 
12062
12235
  const commandMap = {
12063
12236
  'Chat.clearInput': wrapCommand(clearInput),
12237
+ 'Chat.copyInput': wrapCommand(copyInput),
12064
12238
  'Chat.create': create,
12239
+ 'Chat.cutInput': wrapCommand(cutInput),
12065
12240
  'Chat.deleteSessionAtIndex': wrapCommand(deleteSessionAtIndex),
12066
12241
  'Chat.diff2': diff2,
12067
12242
  'Chat.enterNewLine': wrapCommand(handleNewline),
@@ -12072,8 +12247,11 @@ const commandMap = {
12072
12247
  'Chat.getMenuEntryIds': getMenuEntryIds,
12073
12248
  'Chat.getQuickPickMenuEntries': getQuickPickMenuEntries,
12074
12249
  'Chat.getSelectedSessionId': wrapGetter(getSelectedSessionId),
12075
- 'Chat.handleChatListContextMenu': handleChatListContextMenu,
12250
+ 'Chat.handleChatHeaderContextMenu': wrapCommand(handleChatHeaderContextMenu),
12251
+ 'Chat.handleChatInputContextMenu': wrapCommand(handleChatInputContextMenu),
12252
+ 'Chat.handleChatListContextMenu': wrapCommand(handleChatListContextMenu),
12076
12253
  'Chat.handleChatListScroll': wrapCommand(handleChatListScroll),
12254
+ 'Chat.handleChatWelcomeContextMenu': wrapCommand(handleChatWelcomeContextMenu),
12077
12255
  'Chat.handleClick': wrapCommand(handleClick),
12078
12256
  'Chat.handleClickBack': wrapCommand(handleClickBack),
12079
12257
  'Chat.handleClickClose': handleClickClose,
@@ -12085,6 +12263,7 @@ const commandMap = {
12085
12263
  'Chat.handleClickReadFile': handleClickFileName,
12086
12264
  'Chat.handleClickSessionDebug': wrapCommand(handleClickSessionDebug),
12087
12265
  'Chat.handleClickSettings': handleClickSettings,
12266
+ 'Chat.handleContextMenuChatSendAreaBottom': wrapCommand(handleContextMenuChatSendAreaBottom),
12088
12267
  'Chat.handleDragEnter': wrapCommand(handleDragEnter),
12089
12268
  'Chat.handleDragLeave': wrapCommand(handleDragLeave),
12090
12269
  'Chat.handleDragOver': wrapCommand(handleDragOver),
@@ -12113,6 +12292,7 @@ const commandMap = {
12113
12292
  'Chat.mockOpenApiStreamPushChunk': wrapCommand(mockOpenApiStreamPushChunk),
12114
12293
  'Chat.mockOpenApiStreamReset': wrapCommand(mockOpenApiStreamReset),
12115
12294
  'Chat.openMockSession': wrapCommand(openMockSession),
12295
+ 'Chat.pasteInput': wrapCommand(pasteInput),
12116
12296
  'Chat.registerMockResponse': wrapCommand(registerMockResponse),
12117
12297
  'Chat.render2': render2,
12118
12298
  'Chat.renderEventListeners': renderEventListeners,
@@ -12197,6 +12377,17 @@ const initializeChatToolWorker = async () => {
12197
12377
  set$5(rpc);
12198
12378
  };
12199
12379
 
12380
+ const sendMessagePortToClipBoardWorker = async port => {
12381
+ await sendMessagePortToClipBoardWorker$1(port, 0);
12382
+ };
12383
+ const initializeClipBoardWorker = async () => {
12384
+ const rpc = await create$4({
12385
+ commandMap: {},
12386
+ send: sendMessagePortToClipBoardWorker
12387
+ });
12388
+ set$3(rpc);
12389
+ };
12390
+
12200
12391
  const sendMessagePortToOpenerWorker = async port => {
12201
12392
  await sendMessagePortToOpenerWorker$1(port, 0);
12202
12393
  };
@@ -12214,7 +12405,7 @@ const listen = async () => {
12214
12405
  commandMap: commandMap
12215
12406
  });
12216
12407
  set$2(rpc);
12217
- await Promise.all([initializeChatNetworkWorker(), initializeChatMathWorker(), initializeChatCoordinatorWorker(), initializeChatToolWorker(), initializeOpenerWorker(), initializeChatStorageWorker()]);
12408
+ await Promise.all([initializeChatCoordinatorWorker(), initializeChatMathWorker(), initializeChatNetworkWorker(), initializeChatStorageWorker(), initializeChatToolWorker(), initializeClipBoardWorker(), initializeOpenerWorker()]);
12218
12409
  };
12219
12410
 
12220
12411
  const main = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/chat-view",
3
- "version": "6.18.0",
3
+ "version": "6.21.0",
4
4
  "description": "Chat View Worker",
5
5
  "repository": {
6
6
  "type": "git",