@lvce-editor/chat-view 6.13.0 → 6.15.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.
@@ -1118,14 +1118,14 @@ const create$2 = rpcId => {
1118
1118
  };
1119
1119
 
1120
1120
  const {
1121
- invoke: invoke$5,
1121
+ invoke: invoke$6,
1122
1122
  set: set$7
1123
1123
  } = create$2(6007);
1124
1124
  const getMathBlockDom = async node => {
1125
- return invoke$5('ChatMath.getMathBlockDom', node);
1125
+ return invoke$6('ChatMath.getMathBlockDom', node);
1126
1126
  };
1127
1127
  const getMathInlineDom = async node => {
1128
- return invoke$5('ChatMath.getMathInlineDom', node);
1128
+ return invoke$6('ChatMath.getMathInlineDom', node);
1129
1129
  };
1130
1130
 
1131
1131
  const Button$2 = 'button';
@@ -1218,23 +1218,27 @@ const SetPatches = 'Viewlet.setPatches';
1218
1218
  const FocusChatInput = 8000;
1219
1219
 
1220
1220
  const {
1221
- invoke: invoke$4,
1221
+ invoke: invoke$5,
1222
1222
  set: set$6
1223
1223
  } = create$2(ChatNetworkWorker);
1224
1224
 
1225
1225
  const {
1226
- invoke: invoke$3,
1226
+ invoke: invoke$4,
1227
1227
  set: set$5
1228
1228
  } = create$2(ChatToolWorker);
1229
1229
 
1230
1230
  const {
1231
- invoke: invoke$2,
1231
+ invoke: invoke$3,
1232
1232
  set: set$4
1233
1233
  } = create$2(ExtensionHostWorker);
1234
1234
 
1235
1235
  const {
1236
+ invoke: invoke$2,
1236
1237
  set: set$3
1237
1238
  } = create$2(OpenerWorker);
1239
+ const openExternal = async url => {
1240
+ return invoke$2('Open.openExternal', url);
1241
+ };
1238
1242
 
1239
1243
  const {
1240
1244
  invoke: invoke$1,
@@ -1275,9 +1279,6 @@ const activateByEvent$1 = (event, assetDir, platform) => {
1275
1279
  const getPreference = async key => {
1276
1280
  return await invoke$1('Preferences.get', key);
1277
1281
  };
1278
- const openExternal = async uri => {
1279
- await invoke$1('Open.openExternal', uri);
1280
- };
1281
1282
  const measureTextBlockHeight$1 = async (actualInput, fontFamily, fontSize, lineHeightPx, width) => {
1282
1283
  return invoke$1(`MeasureTextHeight.measureTextBlockHeight`, actualInput, fontFamily, fontSize, lineHeightPx, width);
1283
1284
  };
@@ -1486,6 +1487,12 @@ const backToChats = () => {
1486
1487
  const settings = () => {
1487
1488
  return i18nString('Settings');
1488
1489
  };
1490
+ const search = () => {
1491
+ return i18nString('Search');
1492
+ };
1493
+ const searchChats = () => {
1494
+ return i18nString('Search chats');
1495
+ };
1489
1496
  const loginToBackend = () => {
1490
1497
  return i18nString('Login to backend');
1491
1498
  };
@@ -1528,6 +1535,9 @@ const sendMessage = () => {
1528
1535
  const startVoiceDictation = () => {
1529
1536
  return i18nString('Start voice dictation');
1530
1537
  };
1538
+ const addContext = () => {
1539
+ return i18nString('Add Context');
1540
+ };
1531
1541
  const save = () => {
1532
1542
  return i18nString('Save');
1533
1543
  };
@@ -1652,6 +1662,7 @@ const createDefaultState = () => {
1652
1662
  const composerFontSize = 13;
1653
1663
  const composerLineHeight = 20;
1654
1664
  return {
1665
+ addContextButtonEnabled: false,
1655
1666
  aiSessionTitleGenerationEnabled: false,
1656
1667
  assetDir: '',
1657
1668
  authAccessToken: '',
@@ -1715,6 +1726,9 @@ const createDefaultState = () => {
1715
1726
  questionToolEnabled: false,
1716
1727
  renamingSessionId: '',
1717
1728
  runMode: 'local',
1729
+ searchEnabled: false,
1730
+ searchFieldVisible: false,
1731
+ searchValue: '',
1718
1732
  selectedModelId: defaultModelId,
1719
1733
  selectedProjectId: defaultProjectId,
1720
1734
  selectedSessionId: defaultSessionId,
@@ -2546,7 +2560,7 @@ const isEqualProjectExpandedIds = (a, b) => {
2546
2560
  return true;
2547
2561
  };
2548
2562
  const isEqual = (oldState, newState) => {
2549
- return oldState.authEnabled === newState.authEnabled && oldState.authErrorMessage === newState.authErrorMessage && oldState.authStatus === newState.authStatus && oldState.composerDropActive === newState.composerDropActive && oldState.composerDropEnabled === newState.composerDropEnabled && oldState.composerValue === newState.composerValue && oldState.initial === newState.initial && isEqualProjectExpandedIds(oldState.projectExpandedIds, newState.projectExpandedIds) && oldState.projectListScrollTop === newState.projectListScrollTop && oldState.renamingSessionId === newState.renamingSessionId && oldState.selectedModelId === newState.selectedModelId && oldState.selectedProjectId === newState.selectedProjectId && oldState.selectedSessionId === newState.selectedSessionId && oldState.showRunMode === newState.showRunMode && oldState.runMode === newState.runMode && oldState.sessions === newState.sessions && oldState.tokensMax === newState.tokensMax && oldState.tokensUsed === newState.tokensUsed && oldState.usageOverviewEnabled === newState.usageOverviewEnabled && oldState.useChatMathWorker === newState.useChatMathWorker && oldState.viewMode === newState.viewMode && oldState.voiceDictationEnabled === newState.voiceDictationEnabled;
2563
+ return oldState.addContextButtonEnabled === newState.addContextButtonEnabled && oldState.authEnabled === newState.authEnabled && oldState.authErrorMessage === newState.authErrorMessage && oldState.authStatus === newState.authStatus && oldState.composerDropActive === newState.composerDropActive && oldState.composerDropEnabled === newState.composerDropEnabled && oldState.composerValue === newState.composerValue && oldState.initial === newState.initial && isEqualProjectExpandedIds(oldState.projectExpandedIds, newState.projectExpandedIds) && oldState.projectListScrollTop === newState.projectListScrollTop && oldState.renamingSessionId === newState.renamingSessionId && oldState.selectedModelId === newState.selectedModelId && oldState.selectedProjectId === newState.selectedProjectId && oldState.selectedSessionId === newState.selectedSessionId && oldState.showRunMode === newState.showRunMode && oldState.runMode === newState.runMode && oldState.sessions === newState.sessions && oldState.tokensMax === newState.tokensMax && oldState.tokensUsed === newState.tokensUsed && oldState.usageOverviewEnabled === newState.usageOverviewEnabled && oldState.useChatMathWorker === newState.useChatMathWorker && oldState.viewMode === newState.viewMode && oldState.voiceDictationEnabled === newState.voiceDictationEnabled;
2550
2564
  };
2551
2565
 
2552
2566
  const diffScrollTop = (oldState, newState) => {
@@ -3351,10 +3365,10 @@ const getAiResponse$1 = async options => {
3351
3365
  };
3352
3366
 
3353
3367
  const execute = async (name, rawArguments, options) => {
3354
- return invoke$3('ChatTool.execute', name, rawArguments, options);
3368
+ return invoke$4('ChatTool.execute', name, rawArguments, options);
3355
3369
  };
3356
3370
  const getTools = async () => {
3357
- return invoke$3('ChatTool.getTools');
3371
+ return invoke$4('ChatTool.getTools');
3358
3372
  };
3359
3373
 
3360
3374
  const stringifyToolOutput = output => {
@@ -3854,7 +3868,7 @@ const executeProvider = async ({
3854
3868
  }) => {
3855
3869
  await activateByEvent(event, assetDir, platform);
3856
3870
  // @ts-ignore
3857
- const result = invoke$2(method, ...params);
3871
+ const result = invoke$3(method, ...params);
3858
3872
  return result;
3859
3873
  };
3860
3874
 
@@ -3986,10 +4000,10 @@ const getOpenApiApiEndpoint = openApiApiBaseUrl => {
3986
4000
  };
3987
4001
 
3988
4002
  const makeApiRequest = async options => {
3989
- return invoke$4('ChatNetwork.makeApiRequest', options);
4003
+ return invoke$5('ChatNetwork.makeApiRequest', options);
3990
4004
  };
3991
4005
  const makeStreamingApiRequest = async options => {
3992
- return invoke$4('ChatNetwork.makeStreamingApiRequest', options);
4006
+ return invoke$5('ChatNetwork.makeStreamingApiRequest', options);
3993
4007
  };
3994
4008
 
3995
4009
  const getTextContent = content => {
@@ -7667,13 +7681,16 @@ const handleClickSend = async state => {
7667
7681
  };
7668
7682
 
7669
7683
  const Composer = 'composer';
7684
+ const Search = 'search';
7670
7685
  const ComposerDropTarget = 'composer-drop-target';
7686
+ const AddContext = 'add-context';
7671
7687
  const Dictate = 'dictate';
7672
7688
  const Send = 'send';
7673
7689
  const Back = 'back';
7674
7690
  const Model = 'model';
7675
7691
  const RunMode = 'runMode';
7676
7692
  const ToggleChatFocus = 'toggle-chat-focus';
7693
+ const ToggleSearch = 'toggle-search';
7677
7694
  const CreateProject = 'create-project';
7678
7695
  const CreateSession = 'create-session';
7679
7696
  const CreateSessionInProjectPrefix = 'create-session-in-project:';
@@ -7852,6 +7869,12 @@ const handleClick = async (state, name, id = '') => {
7852
7869
  }
7853
7870
  case name === ToggleChatFocus:
7854
7871
  return toggleChatFocusMode(state);
7872
+ case name === ToggleSearch:
7873
+ return {
7874
+ ...state,
7875
+ searchFieldVisible: !state.searchFieldVisible,
7876
+ searchValue: state.searchFieldVisible ? '' : state.searchValue
7877
+ };
7855
7878
  case isProjectInputName(name):
7856
7879
  {
7857
7880
  const projectId = getProjectIdFromInputName(name);
@@ -8029,6 +8052,13 @@ const handleDropFiles = async (state, name, files = []) => {
8029
8052
  return nextState;
8030
8053
  };
8031
8054
 
8055
+ const handleSearchValueChange = (state, newValue) => {
8056
+ return {
8057
+ ...state,
8058
+ searchValue: newValue
8059
+ };
8060
+ };
8061
+
8032
8062
  const handleInput = async (state, name, value, inputSource = 'user') => {
8033
8063
  const {
8034
8064
  selectedSessionId
@@ -8045,6 +8075,9 @@ const handleInput = async (state, name, value, inputSource = 'user') => {
8045
8075
  openRouterApiKeyInput: value
8046
8076
  };
8047
8077
  }
8078
+ if (name === Search) {
8079
+ return handleSearchValueChange(state, value);
8080
+ }
8048
8081
  if (name !== Composer) {
8049
8082
  return state;
8050
8083
  }
@@ -8255,6 +8288,13 @@ const initialize = async () => {
8255
8288
  set$4(rpc);
8256
8289
  };
8257
8290
 
8291
+ const ensureBlankProject = (projects, fallbackBlankProject) => {
8292
+ if (projects.some(project => project.name === '_blank')) {
8293
+ return projects;
8294
+ }
8295
+ return [fallbackBlankProject, ...projects];
8296
+ };
8297
+
8258
8298
  const isObject$1 = value => {
8259
8299
  return typeof value === 'object' && value !== null;
8260
8300
  };
@@ -8272,6 +8312,32 @@ const getSavedChatListScrollTop = savedState => {
8272
8312
  return chatListScrollTop;
8273
8313
  };
8274
8314
 
8315
+ const getSavedComposerValue = savedState => {
8316
+ if (!isObject$1(savedState)) {
8317
+ return undefined;
8318
+ }
8319
+ const {
8320
+ composerValue
8321
+ } = savedState;
8322
+ if (typeof composerValue !== 'string') {
8323
+ return undefined;
8324
+ }
8325
+ return composerValue;
8326
+ };
8327
+
8328
+ const getSavedLastNormalViewMode = savedState => {
8329
+ if (!isObject$1(savedState)) {
8330
+ return undefined;
8331
+ }
8332
+ const {
8333
+ lastNormalViewMode
8334
+ } = savedState;
8335
+ if (lastNormalViewMode !== 'list' && lastNormalViewMode !== 'detail') {
8336
+ return undefined;
8337
+ }
8338
+ return lastNormalViewMode;
8339
+ };
8340
+
8275
8341
  const getSavedMessagesScrollTop = savedState => {
8276
8342
  if (!isObject$1(savedState)) {
8277
8343
  return undefined;
@@ -8285,6 +8351,58 @@ const getSavedMessagesScrollTop = savedState => {
8285
8351
  return messagesScrollTop;
8286
8352
  };
8287
8353
 
8354
+ const getSavedProjectExpandedIds = savedState => {
8355
+ if (!isObject$1(savedState)) {
8356
+ return undefined;
8357
+ }
8358
+ const {
8359
+ projectExpandedIds
8360
+ } = savedState;
8361
+ if (!Array.isArray(projectExpandedIds)) {
8362
+ return undefined;
8363
+ }
8364
+ const ids = projectExpandedIds.filter(id => typeof id === 'string');
8365
+ if (ids.length === 0) {
8366
+ return undefined;
8367
+ }
8368
+ return ids;
8369
+ };
8370
+
8371
+ const getSavedProjectListScrollTop = savedState => {
8372
+ if (!isObject$1(savedState)) {
8373
+ return undefined;
8374
+ }
8375
+ const {
8376
+ projectListScrollTop
8377
+ } = savedState;
8378
+ if (typeof projectListScrollTop !== 'number') {
8379
+ return undefined;
8380
+ }
8381
+ return projectListScrollTop;
8382
+ };
8383
+
8384
+ const getSavedProjects = savedState => {
8385
+ if (!isObject$1(savedState)) {
8386
+ return undefined;
8387
+ }
8388
+ const {
8389
+ projects
8390
+ } = savedState;
8391
+ if (!Array.isArray(projects)) {
8392
+ return undefined;
8393
+ }
8394
+ const validProjects = projects.filter(project => {
8395
+ if (!isObject$1(project)) {
8396
+ return false;
8397
+ }
8398
+ return typeof project.id === 'string' && typeof project.name === 'string' && typeof project.uri === 'string';
8399
+ });
8400
+ if (validProjects.length === 0) {
8401
+ return undefined;
8402
+ }
8403
+ return validProjects;
8404
+ };
8405
+
8288
8406
  const getSavedSelectedModelId = savedState => {
8289
8407
  if (!isObject$1(savedState)) {
8290
8408
  return undefined;
@@ -8298,6 +8416,19 @@ const getSavedSelectedModelId = savedState => {
8298
8416
  return selectedModelId;
8299
8417
  };
8300
8418
 
8419
+ const getSavedSelectedProjectId = savedState => {
8420
+ if (!isObject$1(savedState)) {
8421
+ return undefined;
8422
+ }
8423
+ const {
8424
+ selectedProjectId
8425
+ } = savedState;
8426
+ if (typeof selectedProjectId !== 'string') {
8427
+ return undefined;
8428
+ }
8429
+ return selectedProjectId;
8430
+ };
8431
+
8301
8432
  const getSavedSelectedSessionId = savedState => {
8302
8433
  if (!isObject$1(savedState)) {
8303
8434
  return undefined;
@@ -8435,6 +8566,15 @@ const loadPassIncludeObfuscation = async () => {
8435
8566
  }
8436
8567
  };
8437
8568
 
8569
+ const loadSearchEnabled = async () => {
8570
+ try {
8571
+ const savedSearchEnabled = await get('chatView.searchEnabled');
8572
+ return typeof savedSearchEnabled === 'boolean' ? savedSearchEnabled : false;
8573
+ } catch {
8574
+ return false;
8575
+ }
8576
+ };
8577
+
8438
8578
  const loadStreamingEnabled = async () => {
8439
8579
  try {
8440
8580
  const savedStreamingEnabled = await get('chatView.streamingEnabled');
@@ -8499,7 +8639,7 @@ const loadVoiceDictationEnabled = async () => {
8499
8639
  };
8500
8640
 
8501
8641
  const loadPreferences = async () => {
8502
- const [aiSessionTitleGenerationEnabled, authAccessToken, authEnabled, authRefreshToken, backendUrl, composerDropEnabled, openApiApiKey, openRouterApiKey, emitStreamingFunctionCallEvents, streamingEnabled, todoListToolEnabled, passIncludeObfuscation, useChatCoordinatorWorker, useChatMathWorker, useChatNetworkWorkerForRequests, useChatToolWorker, voiceDictationEnabled] = await Promise.all([loadAiSessionTitleGenerationEnabled(), loadBackendAccessToken(), loadAuthEnabled(), loadBackendRefreshToken(), loadBackendUrl(), loadComposerDropEnabled(), loadOpenApiApiKey(), loadOpenRouterApiKey(), loadEmitStreamingFunctionCallEvents(), loadStreamingEnabled(), loadTodoListToolEnabled(), loadPassIncludeObfuscation(), loadUseChatCoordinatorWorker(), loadUseChatMathWorker(), loadUseChatNetworkWorkerForRequests(), loadUseChatToolWorker(), loadVoiceDictationEnabled()]);
8642
+ const [aiSessionTitleGenerationEnabled, authAccessToken, authEnabled, authRefreshToken, backendUrl, composerDropEnabled, openApiApiKey, openRouterApiKey, emitStreamingFunctionCallEvents, searchEnabled, streamingEnabled, todoListToolEnabled, passIncludeObfuscation, useChatCoordinatorWorker, useChatMathWorker, useChatNetworkWorkerForRequests, useChatToolWorker, voiceDictationEnabled] = await Promise.all([loadAiSessionTitleGenerationEnabled(), loadBackendAccessToken(), loadAuthEnabled(), loadBackendRefreshToken(), loadBackendUrl(), loadComposerDropEnabled(), loadOpenApiApiKey(), loadOpenRouterApiKey(), loadEmitStreamingFunctionCallEvents(), loadSearchEnabled(), loadStreamingEnabled(), loadTodoListToolEnabled(), loadPassIncludeObfuscation(), loadUseChatCoordinatorWorker(), loadUseChatMathWorker(), loadUseChatNetworkWorkerForRequests(), loadUseChatToolWorker(), loadVoiceDictationEnabled()]);
8503
8643
  return {
8504
8644
  aiSessionTitleGenerationEnabled,
8505
8645
  authAccessToken,
@@ -8511,6 +8651,7 @@ const loadPreferences = async () => {
8511
8651
  openApiApiKey,
8512
8652
  openRouterApiKey,
8513
8653
  passIncludeObfuscation,
8654
+ searchEnabled,
8514
8655
  streamingEnabled,
8515
8656
  todoListToolEnabled,
8516
8657
  useChatCoordinatorWorker,
@@ -8551,97 +8692,7 @@ const toSummarySession = session => {
8551
8692
  projectId: session.projectId
8552
8693
  };
8553
8694
  };
8554
- const getSavedSelectedProjectId = savedState => {
8555
- if (!isObject$1(savedState)) {
8556
- return undefined;
8557
- }
8558
- const {
8559
- selectedProjectId
8560
- } = savedState;
8561
- if (typeof selectedProjectId !== 'string') {
8562
- return undefined;
8563
- }
8564
- return selectedProjectId;
8565
- };
8566
- const getSavedProjects = savedState => {
8567
- if (!isObject$1(savedState)) {
8568
- return undefined;
8569
- }
8570
- const {
8571
- projects
8572
- } = savedState;
8573
- if (!Array.isArray(projects)) {
8574
- return undefined;
8575
- }
8576
- const validProjects = projects.filter(project => {
8577
- if (!isObject$1(project)) {
8578
- return false;
8579
- }
8580
- return typeof project.id === 'string' && typeof project.name === 'string' && typeof project.uri === 'string';
8581
- });
8582
- if (validProjects.length === 0) {
8583
- return undefined;
8584
- }
8585
- return validProjects;
8586
- };
8587
- const ensureBlankProject = (projects, fallbackBlankProject) => {
8588
- if (projects.some(project => project.name === '_blank')) {
8589
- return projects;
8590
- }
8591
- return [fallbackBlankProject, ...projects];
8592
- };
8593
- const getSavedProjectListScrollTop = savedState => {
8594
- if (!isObject$1(savedState)) {
8595
- return undefined;
8596
- }
8597
- const {
8598
- projectListScrollTop
8599
- } = savedState;
8600
- if (typeof projectListScrollTop !== 'number') {
8601
- return undefined;
8602
- }
8603
- return projectListScrollTop;
8604
- };
8605
- const getSavedProjectExpandedIds = savedState => {
8606
- if (!isObject$1(savedState)) {
8607
- return undefined;
8608
- }
8609
- const {
8610
- projectExpandedIds
8611
- } = savedState;
8612
- if (!Array.isArray(projectExpandedIds)) {
8613
- return undefined;
8614
- }
8615
- const ids = projectExpandedIds.filter(id => typeof id === 'string');
8616
- if (ids.length === 0) {
8617
- return undefined;
8618
- }
8619
- return ids;
8620
- };
8621
- const getSavedLastNormalViewMode = savedState => {
8622
- if (!isObject$1(savedState)) {
8623
- return undefined;
8624
- }
8625
- const {
8626
- lastNormalViewMode
8627
- } = savedState;
8628
- if (lastNormalViewMode !== 'list' && lastNormalViewMode !== 'detail') {
8629
- return undefined;
8630
- }
8631
- return lastNormalViewMode;
8632
- };
8633
- const getSavedComposerValue = savedState => {
8634
- if (!isObject$1(savedState)) {
8635
- return undefined;
8636
- }
8637
- const {
8638
- composerValue
8639
- } = savedState;
8640
- if (typeof composerValue !== 'string') {
8641
- return undefined;
8642
- }
8643
- return composerValue;
8644
- };
8695
+
8645
8696
  const loadContent = async (state, savedState) => {
8646
8697
  const savedSelectedModelId = getSavedSelectedModelId(savedState);
8647
8698
  const savedViewMode = getSavedViewMode(savedState);
@@ -8657,6 +8708,7 @@ const loadContent = async (state, savedState) => {
8657
8708
  openApiApiKey,
8658
8709
  openRouterApiKey,
8659
8710
  passIncludeObfuscation,
8711
+ searchEnabled,
8660
8712
  streamingEnabled,
8661
8713
  todoListToolEnabled,
8662
8714
  useChatCoordinatorWorker,
@@ -8736,6 +8788,9 @@ const loadContent = async (state, savedState) => {
8736
8788
  projectExpandedIds,
8737
8789
  projectListScrollTop,
8738
8790
  projects,
8791
+ searchEnabled,
8792
+ searchFieldVisible: false,
8793
+ searchValue: '',
8739
8794
  selectedModelId,
8740
8795
  selectedProjectId,
8741
8796
  selectedSessionId,
@@ -8859,10 +8914,11 @@ const registerMockResponse = (state, mockResponse) => {
8859
8914
  };
8860
8915
 
8861
8916
  const getCss = (composerHeight, listItemHeight, chatMessageFontSize, chatMessageLineHeight, chatMessageFontFamily, textAreaPaddingTop, textAreaPaddingLeft, textAreaPaddingRight, textAreaPaddingBottom, chatSendAreaPaddingTop, chatSendAreaPaddingLeft, chatSendAreaPaddingRight, chatSendAreaPaddingBottom, renderHtmlCss) => {
8917
+ const chatSendAreaHeight = composerHeight + chatSendAreaPaddingTop + chatSendAreaPaddingBottom;
8862
8918
  const baseCss = `:root {
8863
8919
  --ChatInputBoxHeight: ${composerHeight}px;
8864
8920
  --ChatTextAreaHeight: ${composerHeight}px;
8865
- --ChatSendAreaHeight: ${composerHeight + 62}px;
8921
+ --ChatSendAreaHeight: ${chatSendAreaHeight}px;
8866
8922
  --ChatTextAreaPaddingTop: ${textAreaPaddingTop}px;
8867
8923
  --ChatTextAreaPaddingLeft: ${textAreaPaddingLeft}px;
8868
8924
  --ChatTextAreaPaddingRight: ${textAreaPaddingRight}px;
@@ -9177,6 +9233,7 @@ const TokenTag = 'TokenTag';
9177
9233
  const TokenAttribute = 'TokenAttribute';
9178
9234
  const TokenValue = 'TokenValue';
9179
9235
  const TokenProperty = 'TokenProperty';
9236
+ const SearchFieldContainer = 'SearchFieldContainer';
9180
9237
  const Select = 'Select';
9181
9238
  const StrikeThrough = 'StrikeThrough';
9182
9239
  const Viewlet = 'Viewlet';
@@ -9211,6 +9268,7 @@ const HandleProjectListContextMenu = 33;
9211
9268
  const HandleClickDictationButton = 34;
9212
9269
  const HandleMissingApiKeySubmit = 35;
9213
9270
  const HandleRunModeChange = 36;
9271
+ const HandleSearchInput = 37;
9214
9272
 
9215
9273
  const getModelLabel = model => {
9216
9274
  if (model.provider === 'openRouter') {
@@ -9297,6 +9355,18 @@ const getSendButtonDom = (isSendDisabled, voiceDictationEnabled) => {
9297
9355
  type: Div
9298
9356
  }];
9299
9357
  };
9358
+ const getAddContextButtonDom = () => {
9359
+ return [{
9360
+ childCount: 1,
9361
+ className: IconButton,
9362
+ name: AddContext,
9363
+ title: addContext(),
9364
+ type: Button$1
9365
+ }, {
9366
+ text: addContext(),
9367
+ type: Text
9368
+ }];
9369
+ };
9300
9370
 
9301
9371
  const clampToPercentage = (tokensUsed, tokensMax) => {
9302
9372
  if (tokensMax <= 0) {
@@ -9333,9 +9403,9 @@ const getUsageOverviewDom = (tokensUsed, tokensMax) => {
9333
9403
  }, text(usageLabel)];
9334
9404
  };
9335
9405
 
9336
- const getChatSendAreaDom = (composerValue, models, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, showRunMode, runMode, todoListToolEnabled, todoListItems, voiceDictationEnabled = false) => {
9406
+ const getChatSendAreaDom = (composerValue, models, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, addContextButtonEnabled, showRunMode, runMode, todoListToolEnabled, todoListItems, voiceDictationEnabled = false) => {
9337
9407
  const isSendDisabled = composerValue.trim() === '';
9338
- const controlsCount = 2 + (usageOverviewEnabled ? 1 : 0) + (showRunMode ? 1 : 0);
9408
+ const controlsCount = 2 + (usageOverviewEnabled ? 1 : 0) + (showRunMode ? 1 : 0) + (addContextButtonEnabled ? 1 : 0);
9339
9409
  const hasTodoList = todoListToolEnabled && todoListItems.length > 0;
9340
9410
  const todoHeaderText = `Todos (${todoListItems.filter(item => item.status === 'completed').length}/${todoListItems.length})`;
9341
9411
  const getTodoItemClassName = status => {
@@ -9387,7 +9457,7 @@ const getChatSendAreaDom = (composerValue, models, selectedModelId, usageOvervie
9387
9457
  childCount: voiceDictationEnabled ? controlsCount + 1 : controlsCount,
9388
9458
  className: ChatSendAreaBottom,
9389
9459
  type: Div
9390
- }, ...getChatSelectVirtualDom(models, selectedModelId), ...(showRunMode ? getRunModeSelectVirtualDom(runMode) : []), ...(usageOverviewEnabled ? getUsageOverviewDom(tokensUsed, tokensMax) : []), ...getSendButtonDom(isSendDisabled, voiceDictationEnabled)];
9460
+ }, ...getChatSelectVirtualDom(models, selectedModelId), ...(showRunMode ? getRunModeSelectVirtualDom(runMode) : []), ...(usageOverviewEnabled ? getUsageOverviewDom(tokensUsed, tokensMax) : []), ...(addContextButtonEnabled ? getAddContextButtonDom() : []), ...getSendButtonDom(isSendDisabled, voiceDictationEnabled)];
9391
9461
  };
9392
9462
 
9393
9463
  const getImageAltText = alt => {
@@ -9787,41 +9857,38 @@ const getMissingApiKeyDom = ({
9787
9857
  inputName,
9788
9858
  inputPattern,
9789
9859
  inputRequired = false,
9790
- inputValue,
9791
9860
  openSettingsButtonName,
9792
9861
  placeholder,
9793
9862
  saveButtonDisabled = false,
9794
9863
  saveButtonName,
9795
- saveButtonText = save(),
9796
- saveButtonType = 'button',
9797
- useForm = false
9864
+ saveButtonText = save()
9798
9865
  }) => {
9799
9866
  return [{
9800
9867
  childCount: 2,
9801
- method: useForm ? 'GET' : undefined,
9802
- onSubmit: useForm ? HandleMissingApiKeySubmit : undefined,
9803
- type: useForm ? Form : Div
9868
+ method: 'GET',
9869
+ onSubmit: HandleMissingApiKeySubmit,
9870
+ type: Form
9804
9871
  }, {
9805
9872
  childCount: 0,
9806
9873
  className: InputBox,
9807
9874
  name: inputName,
9808
9875
  onInput: HandleInput,
9809
- pattern: inputPattern,
9876
+ ...(inputPattern ? {
9877
+ pattern: inputPattern
9878
+ } : {}),
9810
9879
  placeholder,
9811
9880
  required: inputRequired,
9812
- type: Input,
9813
- value: inputValue
9881
+ type: Input
9814
9882
  }, {
9815
9883
  childCount: 2,
9816
9884
  className: Actions,
9817
9885
  type: Div
9818
9886
  }, {
9819
- buttonType: saveButtonType,
9820
9887
  childCount: 1,
9821
9888
  className: mergeClassNames(Button, ButtonPrimary),
9822
9889
  disabled: saveButtonDisabled,
9890
+ inputType: 'submit',
9823
9891
  name: saveButtonName,
9824
- onClick: useForm ? undefined : HandleClick,
9825
9892
  type: Button$1
9826
9893
  }, text(saveButtonText), {
9827
9894
  childCount: 1,
@@ -9833,34 +9900,28 @@ const getMissingApiKeyDom = ({
9833
9900
  }, text(getApiKeyText)];
9834
9901
  };
9835
9902
 
9836
- const getMissingOpenApiApiKeyDom = openApiApiKeyInput => {
9903
+ const getMissingOpenApiApiKeyDom = () => {
9837
9904
  return getMissingApiKeyDom({
9838
9905
  getApiKeyText: getOpenApiApiKey(),
9839
9906
  inputName: OpenApiApiKeyInput,
9840
9907
  inputPattern: '^sk-.+',
9841
9908
  inputRequired: true,
9842
- inputValue: openApiApiKeyInput,
9843
9909
  openSettingsButtonName: OpenOpenApiApiKeyWebsite,
9844
9910
  placeholder: openApiApiKeyPlaceholder(),
9845
- saveButtonName: SaveOpenApiApiKey,
9846
- saveButtonType: 'submit',
9847
- useForm: true
9911
+ saveButtonName: SaveOpenApiApiKey
9848
9912
  });
9849
9913
  };
9850
9914
 
9851
- const getMissingOpenRouterApiKeyDom = (openRouterApiKeyInput, openRouterApiKeyState = 'idle') => {
9915
+ const getMissingOpenRouterApiKeyDom = (openRouterApiKeyState = 'idle') => {
9852
9916
  const isSaving = openRouterApiKeyState === 'saving';
9853
9917
  return getMissingApiKeyDom({
9854
9918
  getApiKeyText: getOpenRouterApiKey(),
9855
9919
  inputName: OpenRouterApiKeyInput,
9856
- inputValue: openRouterApiKeyInput,
9857
9920
  openSettingsButtonName: OpenOpenRouterApiKeySettings,
9858
9921
  placeholder: openRouterApiKeyPlaceholder(),
9859
9922
  saveButtonDisabled: isSaving,
9860
9923
  saveButtonName: SaveOpenRouterApiKey,
9861
- saveButtonText: isSaving ? saving() : save(),
9862
- saveButtonType: 'submit',
9863
- useForm: true
9924
+ saveButtonText: isSaving ? saving() : save()
9864
9925
  });
9865
9926
  };
9866
9927
 
@@ -10534,6 +10595,7 @@ const getToolCallWriteFileVirtualDom = toolCall => {
10534
10595
  }
10535
10596
  const fileName = getFileNameFromUri(target.title);
10536
10597
  const statusLabel = getToolCallStatusLabel(toolCall);
10598
+ const showDiffStats = toolCall.status !== 'error' && toolCall.status !== 'not-found';
10537
10599
  const {
10538
10600
  linesAdded,
10539
10601
  linesDeleted
@@ -10543,7 +10605,7 @@ const getToolCallWriteFileVirtualDom = toolCall => {
10543
10605
  onClick: HandleClickReadFile
10544
10606
  } : {};
10545
10607
  return [{
10546
- childCount: statusLabel ? 6 : 5,
10608
+ childCount: showDiffStats ? statusLabel ? 6 : 5 : statusLabel ? 4 : 3,
10547
10609
  className: ChatOrderedListItem,
10548
10610
  title: target.title,
10549
10611
  type: Li
@@ -10560,7 +10622,7 @@ const getToolCallWriteFileVirtualDom = toolCall => {
10560
10622
  childCount: 1,
10561
10623
  className: ChatToolCallFileName,
10562
10624
  type: Span
10563
- }, text(fileName), {
10625
+ }, text(fileName), ...(showDiffStats ? [{
10564
10626
  childCount: 1,
10565
10627
  className: Insertion,
10566
10628
  type: Span
@@ -10568,7 +10630,7 @@ const getToolCallWriteFileVirtualDom = toolCall => {
10568
10630
  childCount: 1,
10569
10631
  className: Deletion,
10570
10632
  type: Span
10571
- }, text(` -${linesDeleted}`), ...(statusLabel ? [text(statusLabel)] : [])];
10633
+ }, text(` -${linesDeleted}`)] : []), ...(statusLabel ? [text(statusLabel)] : [])];
10572
10634
  };
10573
10635
 
10574
10636
  const getToolCallDom = toolCall => {
@@ -10635,7 +10697,7 @@ const getToolCallsDom = message => {
10635
10697
  }, ...message.toolCalls.flatMap(getToolCallDom)];
10636
10698
  };
10637
10699
 
10638
- const getChatMessageDom = (message, parsedMessageContent, openRouterApiKeyInput, openApiApiKeyInput = '', openRouterApiKeyState = 'idle', useChatMathWorker = false) => {
10700
+ const getChatMessageDom = (message, parsedMessageContent, _openRouterApiKeyInput, _openApiApiKeyInput = '', openRouterApiKeyState = 'idle', useChatMathWorker = false) => {
10639
10701
  const roleClassName = message.role === 'user' ? MessageUser : MessageAssistant;
10640
10702
  const isOpenApiApiKeyMissingMessage = message.role === 'assistant' && message.text === openApiApiKeyRequiredMessage;
10641
10703
  const isOpenRouterApiKeyMissingMessage = message.role === 'assistant' && message.text === openRouterApiKeyRequiredMessage;
@@ -10653,7 +10715,7 @@ const getChatMessageDom = (message, parsedMessageContent, openRouterApiKeyInput,
10653
10715
  childCount: extraChildCount,
10654
10716
  className: ChatMessageContent,
10655
10717
  type: Div
10656
- }, ...toolCallsDom, ...messageDom, ...(isOpenApiApiKeyMissingMessage ? getMissingOpenApiApiKeyDom(openApiApiKeyInput) : []), ...(isOpenRouterApiKeyMissingMessage ? getMissingOpenRouterApiKeyDom(openRouterApiKeyInput, openRouterApiKeyState) : []), ...(isOpenRouterRequestFailedMessage ? getOpenRouterRequestFailedDom() : []), ...(isOpenRouterTooManyRequestsMessage ? getOpenRouterTooManyRequestsDom() : [])];
10718
+ }, ...toolCallsDom, ...messageDom, ...(isOpenApiApiKeyMissingMessage ? getMissingOpenApiApiKeyDom() : []), ...(isOpenRouterApiKeyMissingMessage ? getMissingOpenRouterApiKeyDom(openRouterApiKeyState) : []), ...(isOpenRouterRequestFailedMessage ? getOpenRouterRequestFailedDom() : []), ...(isOpenRouterTooManyRequestsMessage ? getOpenRouterTooManyRequestsDom() : [])];
10657
10719
  };
10658
10720
 
10659
10721
  const getEmptyMessagesDom = () => {
@@ -10806,6 +10868,7 @@ const getProjectListDom = (projects, sessions, projectExpandedIds, selectedProje
10806
10868
  };
10807
10869
 
10808
10870
  const getChatModeChatFocusVirtualDom = ({
10871
+ addContextButtonEnabled,
10809
10872
  authEnabled = false,
10810
10873
  authErrorMessage = '',
10811
10874
  authStatus = 'signed-out',
@@ -10848,7 +10911,7 @@ const getChatModeChatFocusVirtualDom = ({
10848
10911
  onDragEnter: HandleDragEnterChatView,
10849
10912
  onDragOver: HandleDragOverChatView,
10850
10913
  type: Div
10851
- }, ...getProjectListDom(projects, sessions, projectExpandedIds, selectedProjectId, selectedSessionId, projectListScrollTop), ...getMessagesDom(messages, parsedMessages, openRouterApiKeyInput, openApiApiKeyInput, openRouterApiKeyState, messagesScrollTop, useChatMathWorker, true), ...getChatSendAreaDom(composerValue, models, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, showRunMode, runMode, todoListToolEnabled, todoListItems, voiceDictationEnabled), ...(isDropOverlayVisible ? [{
10914
+ }, ...getProjectListDom(projects, sessions, projectExpandedIds, selectedProjectId, selectedSessionId, projectListScrollTop), ...getMessagesDom(messages, parsedMessages, openRouterApiKeyInput, openApiApiKeyInput, openRouterApiKeyState, messagesScrollTop, useChatMathWorker, true), ...getChatSendAreaDom(composerValue, models, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, addContextButtonEnabled, showRunMode, runMode, todoListToolEnabled, todoListItems, voiceDictationEnabled), ...(isDropOverlayVisible ? [{
10852
10915
  childCount: 1,
10853
10916
  className: mergeClassNames(ChatViewDropOverlay, ChatViewDropOverlayActive),
10854
10917
  name: ComposerDropTarget,
@@ -10894,7 +10957,7 @@ const getHeaderActionVirtualDom = item => {
10894
10957
  }];
10895
10958
  };
10896
10959
 
10897
- const getChatHeaderActionsDom = (viewMode, authEnabled = false, authStatus = 'signed-out') => {
10960
+ const getChatHeaderActionsDom = (viewMode, authEnabled = false, authStatus = 'signed-out', searchEnabled = false) => {
10898
10961
  const toggleTitle = viewMode === 'chat-focus' ? normalChatMode() : chatFocusMode();
10899
10962
  const isSigningIn = authStatus === 'signing-in';
10900
10963
  const authAction = authEnabled && authStatus !== 'signed-in' ? {
@@ -10915,7 +10978,12 @@ const getChatHeaderActionsDom = (viewMode, authEnabled = false, authStatus = 'si
10915
10978
  name: ToggleChatFocus,
10916
10979
  onClick: HandleClick,
10917
10980
  title: toggleTitle
10918
- }, {
10981
+ }, ...(searchEnabled ? [{
10982
+ icon: 'MaskIcon MaskIconSearch',
10983
+ name: ToggleSearch,
10984
+ onClick: HandleClick,
10985
+ title: search()
10986
+ }] : []), {
10919
10987
  icon: 'MaskIcon MaskIconDebugPause',
10920
10988
  name: SessionDebug,
10921
10989
  onClick: HandleClickSessionDebug,
@@ -10965,6 +11033,7 @@ const getChatHeaderDomDetailMode = (selectedSessionTitle, authEnabled = false, a
10965
11033
  };
10966
11034
 
10967
11035
  const getChatModeDetailVirtualDom = ({
11036
+ addContextButtonEnabled,
10968
11037
  authEnabled = false,
10969
11038
  authErrorMessage = '',
10970
11039
  authStatus = 'signed-out',
@@ -11004,7 +11073,7 @@ const getChatModeDetailVirtualDom = ({
11004
11073
  onDragEnter: HandleDragEnterChatView,
11005
11074
  onDragOver: HandleDragOverChatView,
11006
11075
  type: Div
11007
- }, ...getChatHeaderDomDetailMode(selectedSessionTitle, authEnabled, authStatus, authErrorMessage), ...getMessagesDom(messages, parsedMessages, openRouterApiKeyInput, openApiApiKeyInput, openRouterApiKeyState, messagesScrollTop, useChatMathWorker), ...getChatSendAreaDom(composerValue, models, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, showRunMode, runMode, todoListToolEnabled, todoListItems, voiceDictationEnabled), ...(isDropOverlayVisible ? [{
11076
+ }, ...getChatHeaderDomDetailMode(selectedSessionTitle, authEnabled, authStatus, authErrorMessage), ...getMessagesDom(messages, parsedMessages, openRouterApiKeyInput, openApiApiKeyInput, openRouterApiKeyState, messagesScrollTop, useChatMathWorker), ...getChatSendAreaDom(composerValue, models, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, addContextButtonEnabled, showRunMode, runMode, todoListToolEnabled, todoListItems, voiceDictationEnabled), ...(isDropOverlayVisible ? [{
11008
11077
  childCount: 1,
11009
11078
  className: mergeClassNames(ChatViewDropOverlay, ChatViewDropOverlayActive),
11010
11079
  name: ComposerDropTarget,
@@ -11018,17 +11087,32 @@ const getChatModeDetailVirtualDom = ({
11018
11087
  }] : [])];
11019
11088
  };
11020
11089
 
11021
- const getChatHeaderListModeDom = (authEnabled = false, authStatus = 'signed-out', authErrorMessage = '') => {
11090
+ const getChatHeaderListModeDom = (authEnabled = false, authStatus = 'signed-out', authErrorMessage = '', searchEnabled = false, searchFieldVisible = false, searchValue = '') => {
11022
11091
  const hasAuthError = authEnabled && !!authErrorMessage;
11092
+ const hasSearchField = searchEnabled && searchFieldVisible;
11093
+ const headerChildCount = 2 + (hasAuthError ? 1 : 0) + (hasSearchField ? 1 : 0);
11023
11094
  return [{
11024
- childCount: hasAuthError ? 3 : 2,
11095
+ childCount: headerChildCount,
11025
11096
  className: ChatHeader,
11026
11097
  type: Div
11027
11098
  }, {
11028
11099
  childCount: 1,
11029
11100
  className: Label,
11030
11101
  type: Span
11031
- }, text(chats()), ...getChatHeaderActionsDom('list', authEnabled, authStatus), ...(hasAuthError ? [{
11102
+ }, text(chats()), ...getChatHeaderActionsDom('list', authEnabled, authStatus, searchEnabled), ...(hasSearchField ? [{
11103
+ childCount: 1,
11104
+ className: SearchFieldContainer,
11105
+ type: Div
11106
+ }, {
11107
+ childCount: 0,
11108
+ className: InputBox,
11109
+ inputType: 'search',
11110
+ name: Search,
11111
+ onInput: HandleSearchInput,
11112
+ placeholder: searchChats(),
11113
+ type: Input,
11114
+ value: searchValue
11115
+ }] : []), ...(hasAuthError ? [{
11032
11116
  childCount: 1,
11033
11117
  className: ChatAuthError,
11034
11118
  type: Span
@@ -11091,6 +11175,7 @@ const getChatListDom = (sessions, selectedSessionId, chatListScrollTop = 0) => {
11091
11175
  };
11092
11176
 
11093
11177
  const getChatModeListVirtualDom = ({
11178
+ addContextButtonEnabled,
11094
11179
  authEnabled = false,
11095
11180
  authErrorMessage = '',
11096
11181
  authStatus = 'signed-out',
@@ -11104,6 +11189,9 @@ const getChatModeListVirtualDom = ({
11104
11189
  composerValue,
11105
11190
  models,
11106
11191
  runMode,
11192
+ searchEnabled = false,
11193
+ searchFieldVisible = false,
11194
+ searchValue = '',
11107
11195
  selectedModelId,
11108
11196
  selectedSessionId,
11109
11197
  sessions,
@@ -11116,13 +11204,15 @@ const getChatModeListVirtualDom = ({
11116
11204
  voiceDictationEnabled = false
11117
11205
  }) => {
11118
11206
  const isDropOverlayVisible = composerDropEnabled && composerDropActive;
11207
+ const searchValueTrimmed = searchValue.trim().toLowerCase();
11208
+ const visibleSessions = searchEnabled && searchValueTrimmed ? sessions.filter(session => session.title.toLowerCase().includes(searchValueTrimmed)) : sessions;
11119
11209
  return [{
11120
11210
  childCount: isDropOverlayVisible ? 4 : 3,
11121
11211
  className: mergeClassNames(Viewlet, Chat),
11122
11212
  onDragEnter: HandleDragEnterChatView,
11123
11213
  onDragOver: HandleDragOverChatView,
11124
11214
  type: Div
11125
- }, ...getChatHeaderListModeDom(authEnabled, authStatus, authErrorMessage), ...getChatListDom(sessions, selectedSessionId, chatListScrollTop), ...getChatSendAreaDom(composerValue, models, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, showRunMode, runMode, todoListToolEnabled, todoListItems, voiceDictationEnabled), ...(isDropOverlayVisible ? [{
11215
+ }, ...getChatHeaderListModeDom(authEnabled, authStatus, authErrorMessage, searchEnabled, searchFieldVisible, searchValue), ...getChatListDom(visibleSessions, selectedSessionId, chatListScrollTop), ...getChatSendAreaDom(composerValue, models, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, addContextButtonEnabled, showRunMode, runMode, todoListToolEnabled, todoListItems, voiceDictationEnabled), ...(isDropOverlayVisible ? [{
11126
11216
  childCount: 1,
11127
11217
  className: mergeClassNames(ChatViewDropOverlay, ChatViewDropOverlayActive),
11128
11218
  name: ComposerDropTarget,
@@ -11217,6 +11307,7 @@ const getFallbackParsedMessages = sessions => {
11217
11307
  };
11218
11308
  const getChatVirtualDom = options => {
11219
11309
  const {
11310
+ addContextButtonEnabled,
11220
11311
  authEnabled = false,
11221
11312
  authErrorMessage = '',
11222
11313
  authStatus = 'signed-out',
@@ -11238,6 +11329,9 @@ const getChatVirtualDom = options => {
11238
11329
  projectListScrollTop = 0,
11239
11330
  projects = [],
11240
11331
  runMode,
11332
+ searchEnabled = false,
11333
+ searchFieldVisible = false,
11334
+ searchValue = '',
11241
11335
  selectedModelId,
11242
11336
  selectedProjectId = '',
11243
11337
  selectedSessionId,
@@ -11256,6 +11350,7 @@ const getChatVirtualDom = options => {
11256
11350
  switch (viewMode) {
11257
11351
  case 'chat-focus':
11258
11352
  return getChatModeChatFocusVirtualDom({
11353
+ addContextButtonEnabled,
11259
11354
  authEnabled,
11260
11355
  authErrorMessage,
11261
11356
  authStatus,
@@ -11291,6 +11386,7 @@ const getChatVirtualDom = options => {
11291
11386
  });
11292
11387
  case 'detail':
11293
11388
  return getChatModeDetailVirtualDom({
11389
+ addContextButtonEnabled,
11294
11390
  authEnabled,
11295
11391
  authErrorMessage,
11296
11392
  authStatus,
@@ -11322,6 +11418,7 @@ const getChatVirtualDom = options => {
11322
11418
  });
11323
11419
  case 'list':
11324
11420
  return getChatModeListVirtualDom({
11421
+ addContextButtonEnabled,
11325
11422
  authEnabled,
11326
11423
  authErrorMessage,
11327
11424
  authStatus,
@@ -11335,6 +11432,9 @@ const getChatVirtualDom = options => {
11335
11432
  composerValue,
11336
11433
  models,
11337
11434
  runMode,
11435
+ searchEnabled,
11436
+ searchFieldVisible,
11437
+ searchValue,
11338
11438
  selectedModelId,
11339
11439
  selectedSessionId,
11340
11440
  sessions,
@@ -11353,6 +11453,7 @@ const getChatVirtualDom = options => {
11353
11453
 
11354
11454
  const renderItems = (oldState, newState) => {
11355
11455
  const {
11456
+ addContextButtonEnabled,
11356
11457
  authEnabled,
11357
11458
  authErrorMessage,
11358
11459
  authStatus,
@@ -11375,6 +11476,9 @@ const renderItems = (oldState, newState) => {
11375
11476
  projectListScrollTop,
11376
11477
  projects,
11377
11478
  runMode,
11479
+ searchEnabled,
11480
+ searchFieldVisible,
11481
+ searchValue,
11378
11482
  selectedModelId,
11379
11483
  selectedProjectId,
11380
11484
  selectedSessionId,
@@ -11393,6 +11497,7 @@ const renderItems = (oldState, newState) => {
11393
11497
  return [SetDom2, uid, []];
11394
11498
  }
11395
11499
  const dom = getChatVirtualDom({
11500
+ addContextButtonEnabled,
11396
11501
  authEnabled,
11397
11502
  authErrorMessage,
11398
11503
  authStatus,
@@ -11414,6 +11519,9 @@ const renderItems = (oldState, newState) => {
11414
11519
  projectListScrollTop,
11415
11520
  projects,
11416
11521
  runMode,
11522
+ searchEnabled,
11523
+ searchFieldVisible,
11524
+ searchValue,
11417
11525
  selectedModelId,
11418
11526
  selectedProjectId,
11419
11527
  selectedSessionId,
@@ -11603,6 +11711,9 @@ const renderEventListeners = () => {
11603
11711
  }, {
11604
11712
  name: HandleInput,
11605
11713
  params: ['handleInput', TargetName, TargetValue]
11714
+ }, {
11715
+ name: HandleSearchInput,
11716
+ params: ['handleSearchValueChange', TargetValue]
11606
11717
  }, {
11607
11718
  name: HandleDragEnter,
11608
11719
  params: ['handleDragEnter', TargetName, 'Array.from(event.dataTransfer?.files || []).length > 0'],
@@ -11707,6 +11818,8 @@ const saveState = state => {
11707
11818
  projectListScrollTop,
11708
11819
  projects,
11709
11820
  renamingSessionId,
11821
+ searchFieldVisible,
11822
+ searchValue,
11710
11823
  selectedModelId,
11711
11824
  selectedProjectId,
11712
11825
  selectedSessionId,
@@ -11722,6 +11835,8 @@ const saveState = state => {
11722
11835
  projectListScrollTop,
11723
11836
  projects,
11724
11837
  renamingSessionId,
11838
+ searchFieldVisible,
11839
+ searchValue,
11725
11840
  selectedModelId,
11726
11841
  selectedProjectId,
11727
11842
  selectedSessionId,
@@ -11729,6 +11844,13 @@ const saveState = state => {
11729
11844
  };
11730
11845
  };
11731
11846
 
11847
+ const setAddContextButtonEnabled = (state, addContextButtonEnabled) => {
11848
+ return {
11849
+ ...state,
11850
+ addContextButtonEnabled
11851
+ };
11852
+ };
11853
+
11732
11854
  const setAuthEnabled = (state, authEnabled) => {
11733
11855
  return {
11734
11856
  ...state,
@@ -11759,9 +11881,12 @@ const dummySessions = [{
11759
11881
  const setChatList = state => {
11760
11882
  return {
11761
11883
  ...state,
11884
+ searchEnabled: true,
11885
+ searchFieldVisible: false,
11886
+ searchValue: '',
11762
11887
  selectedSessionId: dummySessions[0].id,
11763
11888
  sessions: dummySessions,
11764
- viewMode: 'detail'
11889
+ viewMode: 'list'
11765
11890
  };
11766
11891
  };
11767
11892
 
@@ -11779,6 +11904,15 @@ const setQuestionToolEnabled = (state, questionToolEnabled) => {
11779
11904
  };
11780
11905
  };
11781
11906
 
11907
+ const setSearchEnabled = (state, searchEnabled) => {
11908
+ return {
11909
+ ...state,
11910
+ searchEnabled,
11911
+ searchFieldVisible: searchEnabled ? state.searchFieldVisible : false,
11912
+ searchValue: searchEnabled ? state.searchValue : ''
11913
+ };
11914
+ };
11915
+
11782
11916
  const setShowRunMode = (state, showRunMode) => {
11783
11917
  return {
11784
11918
  ...state,
@@ -11890,6 +12024,7 @@ const commandMap = {
11890
12024
  'Chat.handleProjectListContextMenu': wrapCommand(handleProjectListContextMenu),
11891
12025
  'Chat.handleProjectListScroll': wrapCommand(handleProjectListScroll),
11892
12026
  'Chat.handleRunModeChange': wrapCommand(handleRunModeChange),
12027
+ 'Chat.handleSearchValueChange': wrapCommand(handleSearchValueChange),
11893
12028
  'Chat.handleSubmit': wrapCommand(handleSubmit),
11894
12029
  'Chat.initialize': initialize,
11895
12030
  'Chat.loadContent': wrapCommand(loadContent),
@@ -11910,12 +12045,14 @@ const commandMap = {
11910
12045
  'Chat.reset': wrapCommand(reset),
11911
12046
  'Chat.resize': wrapCommand(resize),
11912
12047
  'Chat.saveState': wrapGetter(saveState),
12048
+ 'Chat.setAddContextButtonEnabled': wrapCommand(setAddContextButtonEnabled),
11913
12049
  'Chat.setAuthEnabled': wrapCommand(setAuthEnabled),
11914
12050
  'Chat.setBackendUrl': wrapCommand(setBackendUrl),
11915
12051
  'Chat.setChatList': wrapCommand(setChatList),
11916
12052
  'Chat.setEmitStreamingFunctionCallEvents': wrapCommand(setEmitStreamingFunctionCallEvents),
11917
12053
  'Chat.setOpenRouterApiKey': wrapCommand(setOpenRouterApiKey),
11918
12054
  'Chat.setQuestionToolEnabled': wrapCommand(setQuestionToolEnabled),
12055
+ 'Chat.setSearchEnabled': wrapCommand(setSearchEnabled),
11919
12056
  'Chat.setShowRunMode': wrapCommand(setShowRunMode),
11920
12057
  'Chat.setStreamingEnabled': wrapCommand(setStreamingEnabled),
11921
12058
  'Chat.setTodoListToolEnabled': wrapCommand(setTodoListToolEnabled),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/chat-view",
3
- "version": "6.13.0",
3
+ "version": "6.15.0",
4
4
  "description": "Chat View Worker",
5
5
  "repository": {
6
6
  "type": "git",