@xopcai/xopc 0.0.307 → 0.0.309
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.
- package/dist/browser-ext/_locales/en/messages.json +8 -0
- package/dist/browser-ext/_locales/zh_CN/messages.json +8 -0
- package/dist/browser-ext/dist/assets/{sidepanel-BbSQr-6P.css → sidepanel-DD6GEMvc.css} +16 -0
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +537 -96
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-wgSB2HYK.js → activity-store-XKNYlFUI.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CZeQo09T.js → agent-avatar-dicebear-1S2TFECE.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-f0-YFMUz.js +1 -0
- package/dist/gateway/static/root/assets/{agents-BlrHMbRx.js → agents-CPqUMtCL.js} +1 -1
- package/dist/gateway/static/root/assets/{api-BKHmTb0w.js → api-BEUEE4f2.js} +1 -1
- package/dist/gateway/static/root/assets/api-CN4id43t.js +1 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-Bzw4fQP8.js → app-management-settings-panel-CgVBSqzu.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-8GZpUXva.js → appearance-settings-CoWdCokb.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-BkQQtIxH.js → apps-page-CexHOcWg.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-CQ2NaoHb.js → archive-plugin-C3ZA6LRS.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-BFi1H7yJ.js → attachment-load-CdgS6_zy.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CDBXcii_.js → automations-page-BtHL2hpg.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-onJPfmO6.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-D07eWmOx.js → binary-plugins-CiDhtq_H.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CtVnjyYU.js → block-editor-Br00T83w.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-BzkJog8e.js → browser-automation-inputs-D2tILykA.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-DyrSbDdG.js → browser-automations-page-BVuEmryB.js} +1 -1
- package/dist/gateway/static/root/assets/browser-settings-page-BgVTyPFY.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-Dra8wj1S.js +8 -0
- package/dist/gateway/static/root/assets/{channels-settings-DAD9qE3J.js → channels-settings-CkxiMDJ4.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-status-swr-B2JwuTjG.js → channels-status-swr-Dtder4G_.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-B62SZdAo.js → chat-terminal-dock-JsMtzDao.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-ClSresNq.js → computer-settings-page-DHerePwo.js} +1 -1
- package/dist/gateway/static/root/assets/connector-service-page-DZFNUTiN.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-cl9ZrV4D.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-CTMi_tql.js → cron-expression-DAhdv_Xv.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-B71AJK50.js → date-picker-PacO1m3a.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-DlyGK-kA.js → dependency-picker-B-BcuG1y.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DGkbTE8_.js → desktop-pet-CdBBhhdY.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BY8r9j66.js → desktop-pet-settings-Gy03NgMI.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-DzRrgd59.js → device-pairing-wizard-aV25nKag.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-L8Mm1n3A.js → extension-debug-page-BFp5eKtY.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CFc4vSNU.js → extension-page-DL3vyyH6.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-B5zWyHr3.js → extension-settings-page-BXtvdAsY.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-B6wHa6ZI.js → gateway-config-swr-xAOGtenO.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-B53R0CA4.js → gateway-realtime-BuaTsMSi.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-BG95uGVW.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-settings-D7qmTH4R.js → gateway-settings-Dcr2Ikeh.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DRzGnEV-.js → gateway-startup-retry-BwDxKHd4.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-Glsl3X5b.js → heartbeat-settings-DOy3alvT.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-CDm3dGVy.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-Ck_pyDom.js → image-generation-api-wGMeI_yW.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-ByBX7ome.js → imports-page-zexFT5Rq.js} +1 -1
- package/dist/gateway/static/root/assets/index-D-vczw_0.css +1 -0
- package/dist/gateway/static/root/assets/index-DJo4DimT.js +79 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-C45RlO8a.js → keyboard-shortcuts-settings-CutG9zLh.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-DP0x2jpR.js → local-app-workbench-page-CwLvTwjn.js} +2 -2
- package/dist/gateway/static/root/assets/{local-apps-page-C_AQc2bI.js → local-apps-page-CJy6I7Dt.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-msTfRK8P.js → locale-store-DPZ79W1-.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-DvM8Pyok.js → logs-page-egGcPHNi.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-D1uwSutV.js → management-settings-BQhIOELc.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-BInabSKf.js → markdown-view-p2P5hP1U.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-C4mhf13f.js → media-plugins-CsBylqlN.js} +1 -1
- package/dist/gateway/static/root/assets/messages-BiYTyLJr.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-c2k5Uz6X.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-BLQWJMhf.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-1go_BtX1.js → page-tabs-ChQ4jJFs.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-DmoSC0j1.js → preview-open-alternatives-9B5W7nVE.js} +1 -1
- package/dist/gateway/static/root/assets/{proactive-page-xAjKTIID.js → proactive-page-iOjI0d_e.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-gmi5LLwM.js → product-open-page-BADxWEdP.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-BcxbQn2M.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BuSvld0O.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BSWtko7U.js → registry-api-B_e_nZSN.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CFS8LQKW.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-ClkOoxDl.js → runtime-tools-settings-panel-D-pwiIyp.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-BuEmLiaU.js → schema-form-IWmb05DX.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DZjc__ok.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-C1SM5B93.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-Dor39QON.js → settings-form-section-B0veRBZs.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-Xj-yvIc8.js → settings-page-CxRWyWYe.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-D9Rl7Tec.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BFWZoXdm.js → share-preview-page-CirpgkfD.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-CwCThBs0.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DG6VGbOX.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-BdRJ2vnL.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-Ii8qeXhs.js → skills-page.utils-B42mpWKV.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-Di6OSO-0.js → system-settings-panel-DXIZpAvU.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-QXo9LJly.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-1SZ-HFHX.js → theme-store-BFbj_2Tu.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-DDOlOYlj.js → tunnel-api-Db2guRdW.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-CQ8uWNnB.js → use-autosave-DDY9qoXZ.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-CzPmMkaO.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-COTzshjL.js → voice-api-key-field-BZbKQ8HT.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-DgJML_uM.js → voice-config-api-SKCeQLrH.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-_URrXbi4.js → work-discovery-overlay-BRVTTXNG.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CALs-1nd.js → workflow-run-setup-panel-D2kuwv5e.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-CQXtiYtq.js +6 -0
- package/dist/gateway/static/root/index.html +12 -12
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/notifications.js +1 -1
- package/dist/packages/gateway-contract/src/sessions.js +6 -1
- package/dist/src/agent/agent-manager.js +29 -4
- package/dist/src/agent/background-review/prompts.js +3 -1
- package/dist/src/agent/child-agent-factory.d.ts +1 -0
- package/dist/src/agent/child-agent-factory.js +18 -4
- package/dist/src/agent/coding/repository-instructions.d.ts +4 -0
- package/dist/src/agent/coding/repository-instructions.js +46 -2
- package/dist/src/agent/context/execution-context.js +4 -4
- package/dist/src/agent/data-acquisition/git.d.ts +17 -0
- package/dist/src/agent/data-acquisition/git.js +100 -0
- package/dist/src/agent/data-acquisition/render.d.ts +7 -0
- package/dist/src/agent/data-acquisition/render.js +79 -0
- package/dist/src/agent/data-acquisition/scheduler.d.ts +12 -0
- package/dist/src/agent/data-acquisition/scheduler.js +53 -0
- package/dist/src/agent/data-acquisition/schema.d.ts +75 -0
- package/dist/src/agent/data-acquisition/schema.js +206 -0
- package/dist/src/agent/data-acquisition/service.d.ts +10 -0
- package/dist/src/agent/data-acquisition/service.js +292 -0
- package/dist/src/agent/data-acquisition/types.d.ts +37 -0
- package/dist/src/agent/data-acquisition/types.js +5 -0
- package/dist/src/agent/embedded/run-turn.js +16 -4
- package/dist/src/agent/embedded/session-runner.d.ts +1 -0
- package/dist/src/agent/embedded/session-runner.js +3 -0
- package/dist/src/agent/embedded/tool-result-truncation.js +11 -0
- package/dist/src/agent/embedded/xopc-tools-bridge.js +2 -1
- package/dist/src/agent/external-tools/composio-provider.js +12 -1
- package/dist/src/agent/external-tools/gateway-tools.js +2 -1
- package/dist/src/agent/external-tools/index.js +8 -1
- package/dist/src/agent/external-tools/read-policy.d.ts +6 -0
- package/dist/src/agent/external-tools/read-policy.js +21 -0
- package/dist/src/agent/external-tools/service.d.ts +1 -0
- package/dist/src/agent/external-tools/service.js +4 -1
- package/dist/src/agent/external-tools/types.d.ts +2 -0
- package/dist/src/agent/memory/compaction-promotion.d.ts +1 -1
- package/dist/src/agent/memory/compaction-promotion.js +4 -3
- package/dist/src/agent/orchestration/agent-turn-policy.js +25 -10
- package/dist/src/agent/orchestration/delegation-scope.d.ts +9 -0
- package/dist/src/agent/orchestration/delegation-scope.js +11 -0
- package/dist/src/agent/prompt/sections/tooling.js +3 -1
- package/dist/src/agent/prompt/subagent-context.js +4 -2
- package/dist/src/agent/sandbox/fileAccess.d.ts +2 -0
- package/dist/src/agent/sandbox/fileAccess.js +31 -2
- package/dist/src/agent/tools/dataBatch.d.ts +4 -0
- package/dist/src/agent/tools/dataBatch.js +50 -0
- package/dist/src/agent/tools/delegate-tool.d.ts +6 -3
- package/dist/src/agent/tools/delegate-tool.js +65 -48
- package/dist/src/agent/tools/delegation-parent-policy.d.ts +7 -0
- package/dist/src/agent/tools/delegation-parent-policy.js +41 -0
- package/dist/src/agent/tools/delegation-policy.d.ts +16 -0
- package/dist/src/agent/tools/delegation-policy.js +93 -0
- package/dist/src/agent/tools/factory.d.ts +2 -0
- package/dist/src/agent/tools/factory.js +42 -3
- package/dist/src/agent/tools/fetch-text.d.ts +7 -0
- package/dist/src/agent/tools/fetch-text.js +86 -0
- package/dist/src/agent/tools/find.js +1 -1
- package/dist/src/agent/tools/grep.js +11 -23
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/agent/tools/knowledge-memory-tool.d.ts +1 -1
- package/dist/src/agent/tools/knowledge-memory-tool.js +13 -5
- package/dist/src/agent/tools/read.js +7 -5
- package/dist/src/agent/tools/repository-search.d.ts +12 -2
- package/dist/src/agent/tools/repository-search.js +127 -74
- package/dist/src/agent/tools/user-context-tool.js +17 -7
- package/dist/src/agent/tools/web.js +19 -28
- package/dist/src/agent/workflow/subagent-runner.js +25 -3
- package/dist/src/agent/workflow/workflow-child-tools.js +13 -8
- package/dist/src/agent-config/schema.d.ts +7 -0
- package/dist/src/agent-config/schema.js +2 -0
- package/dist/src/chat-commands/builtins/understanding.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/config/schema.d.ts +6 -4
- package/dist/src/config/schema.js +2 -2
- package/dist/src/connectors/connected-source-understanding.d.ts +1 -0
- package/dist/src/connectors/connected-source-understanding.js +1 -0
- package/dist/src/connectors/learning-coordinator.js +31 -9
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/heartbeat/service.js +2 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +4 -2
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/context-sources.js +0 -23
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/projects.js +8 -0
- package/dist/src/gateway/hono/routes/sessions.js +141 -13
- package/dist/src/gateway/hono/routes/user-model-refresh.d.ts +5 -0
- package/dist/src/gateway/hono/routes/user-model-refresh.js +128 -0
- package/dist/src/gateway/hono/routes/user-model.js +12 -5
- package/dist/src/gateway/hono/routes/work-discovery.js +0 -30
- package/dist/src/gateway/service.js +6 -6
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/infra/update-restart.js +1 -1
- package/dist/src/knowledge/connected-knowledge-pipeline.js +1 -1
- package/dist/src/knowledge-memory/index.js +2 -2
- package/dist/src/knowledge-memory/repository.d.ts +7 -0
- package/dist/src/knowledge-memory/repository.js +58 -8
- package/dist/src/memory-maintenance/service.js +61 -31
- package/dist/src/migrations/memory-config.d.ts +2 -0
- package/dist/src/migrations/memory-config.js +77 -0
- package/dist/src/migrations/runner.js +2 -2
- package/dist/src/notifications/planner.js +5 -5
- package/dist/src/notifications/service.d.ts +2 -2
- package/dist/src/notifications/service.js +1 -1
- package/dist/src/storage/sqlite/index.d.ts +1 -0
- package/dist/src/storage/sqlite/index.js +2 -1
- package/dist/src/storage/sqlite/migrations/184_memory_suppressions.sql +12 -0
- package/dist/src/storage/sqlite/migrations/185_understanding_refresh_batches.sql +6 -0
- package/dist/src/storage/sqlite/migrations/186_sidebar_layout.sql +16 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/sidebar-layout-repository.d.ts +12 -0
- package/dist/src/storage/sqlite/sidebar-layout-repository.js +53 -0
- package/dist/src/user-context/config.d.ts +4 -9
- package/dist/src/user-context/config.js +7 -27
- package/dist/src/user-context/memory-suppression.d.ts +7 -0
- package/dist/src/user-context/memory-suppression.js +23 -0
- package/dist/src/user-context/relationship-continuity.js +1 -1
- package/dist/src/user-context/sources/refresh-service.d.ts +48 -0
- package/dist/src/user-context/sources/refresh-service.js +221 -0
- package/dist/src/user-context/sources/repository.js +1 -1
- package/dist/src/user-model/bootstrap.js +27 -24
- package/dist/src/user-model/capture/executor.d.ts +1 -1
- package/dist/src/user-model/capture/executor.js +17 -11
- package/dist/src/user-model/capture/semantic.js +1 -1
- package/dist/src/user-model/domain.d.ts +6 -2
- package/dist/src/user-model/index.js +3 -3
- package/dist/src/user-model/profile.js +1 -1
- package/dist/src/user-model/repository.d.ts +4 -1
- package/dist/src/user-model/repository.js +96 -6
- package/dist/src/user-model/usage-policy.d.ts +2 -0
- package/dist/src/user-model/usage-policy.js +6 -2
- package/dist/src/work-discovery/project-understanding.js +2 -1
- package/dist/src/work-discovery/service.d.ts +8 -24
- package/dist/src/work-discovery/service.js +138 -180
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BPsRb9Ck.js +0 -1
- package/dist/gateway/static/root/assets/api-DFOlahZv.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-CUpiTTiY.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CqTxLpil.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BZ_-pnS6.js +0 -8
- package/dist/gateway/static/root/assets/connector-service-page-CPqVmNvx.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-BUQyg3CW.js +0 -2
- package/dist/gateway/static/root/assets/gateway-realtime-store-BLDgrJ30.js +0 -1
- package/dist/gateway/static/root/assets/home-page-s9hDQ8Hc.js +0 -1
- package/dist/gateway/static/root/assets/index-RBCkv8a_.js +0 -79
- package/dist/gateway/static/root/assets/index-cFU4S35z.css +0 -1
- package/dist/gateway/static/root/assets/messages-F74LVAiU.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-D35sErp2.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-8jCDklDn.js +0 -8
- package/dist/gateway/static/root/assets/project-detail-page-BUMQHy_N.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-DT-Mt7XR.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Clz3byir.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-tQRwktKm.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DqWg9XS5.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BB_sMB7P.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-oDALm4b6.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DmwelnfK.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BE9JXz4U.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-D1AWszc7.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-C00i4ea0.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-BUiBjz6m.js +0 -6
- package/dist/src/migrations/knowledge-memory-read-policy-config.d.ts +0 -2
- package/dist/src/migrations/knowledge-memory-read-policy-config.js +0 -48
|
@@ -1,5 +1,132 @@
|
|
|
1
1
|
import { x as t, M as MAX_BROWSER_CONTEXTS_PER_TURN, c as browserPageContextsInputSchema, l as gatewayFetch, k as extensionLocale, o as openDatabase, a as RealtimeClient, R as REALTIME_PROTOCOL_VERSION, b as activeTabId, h as currentTabDescriptor, T as TAB_BINDING_PREFIX, m as getAccessProfile, u as runWithTabSiteAccess, P as PENDING_CONTEXT_KEY, f as captureTabWithPermission, p as pairGateway, w as setAutoConnectEnabled, r as readPendingBrowserPairing, q as readProfile, i as discoverLocalGateway, v as saveExtensionLocalePreference, t as revokeAndForgetProfile, d as cancelPendingBrowserPairing, n as loadExtensionLocalePreference } from './assets/auth-C3yV1y_l.js';
|
|
2
2
|
|
|
3
|
+
const OTHER_ACTIVITY = {
|
|
4
|
+
category: "other",
|
|
5
|
+
action: "use",
|
|
6
|
+
source: "unknown",
|
|
7
|
+
sensitivity: "normal"
|
|
8
|
+
};
|
|
9
|
+
const TOOL_ACTIVITY_CATALOG = {
|
|
10
|
+
memory_search: {
|
|
11
|
+
category: "memory",
|
|
12
|
+
action: "search",
|
|
13
|
+
source: "memory",
|
|
14
|
+
sensitivity: "personal",
|
|
15
|
+
purpose: "personal_context"
|
|
16
|
+
},
|
|
17
|
+
memory_get: {
|
|
18
|
+
category: "memory",
|
|
19
|
+
action: "read",
|
|
20
|
+
source: "memory",
|
|
21
|
+
sensitivity: "personal",
|
|
22
|
+
purpose: "personal_context"
|
|
23
|
+
},
|
|
24
|
+
knowledge_search: {
|
|
25
|
+
category: "memory",
|
|
26
|
+
action: "search",
|
|
27
|
+
source: "memory",
|
|
28
|
+
sensitivity: "personal",
|
|
29
|
+
purpose: "personal_context"
|
|
30
|
+
},
|
|
31
|
+
knowledge_get: {
|
|
32
|
+
category: "memory",
|
|
33
|
+
action: "read",
|
|
34
|
+
source: "memory",
|
|
35
|
+
sensitivity: "personal",
|
|
36
|
+
purpose: "personal_context"
|
|
37
|
+
},
|
|
38
|
+
knowledge_write: {
|
|
39
|
+
category: "memory",
|
|
40
|
+
action: "write",
|
|
41
|
+
source: "memory",
|
|
42
|
+
sensitivity: "personal",
|
|
43
|
+
purpose: "personal_context"
|
|
44
|
+
},
|
|
45
|
+
user_context_search: {
|
|
46
|
+
category: "memory",
|
|
47
|
+
action: "search",
|
|
48
|
+
source: "memory",
|
|
49
|
+
sensitivity: "personal",
|
|
50
|
+
purpose: "personal_context"
|
|
51
|
+
},
|
|
52
|
+
user_context_get: {
|
|
53
|
+
category: "memory",
|
|
54
|
+
action: "read",
|
|
55
|
+
source: "memory",
|
|
56
|
+
sensitivity: "personal",
|
|
57
|
+
purpose: "personal_context"
|
|
58
|
+
},
|
|
59
|
+
user_context_update: {
|
|
60
|
+
category: "memory",
|
|
61
|
+
action: "edit",
|
|
62
|
+
source: "memory",
|
|
63
|
+
sensitivity: "personal",
|
|
64
|
+
purpose: "personal_context"
|
|
65
|
+
},
|
|
66
|
+
web_search: { category: "web", action: "search", source: "internet", sensitivity: "normal" },
|
|
67
|
+
brave_search: { category: "web", action: "search", source: "internet", sensitivity: "normal" },
|
|
68
|
+
image_query: { category: "web", action: "search", source: "internet", sensitivity: "normal" },
|
|
69
|
+
web_fetch: { category: "web", action: "read", source: "internet", sensitivity: "normal" },
|
|
70
|
+
fetch_url: { category: "web", action: "read", source: "internet", sensitivity: "normal" },
|
|
71
|
+
open_url: { category: "navigation", action: "open", source: "internet", sensitivity: "normal" },
|
|
72
|
+
browser_use: { category: "navigation", action: "open", source: "internet", sensitivity: "normal" },
|
|
73
|
+
grep: { category: "code", action: "search", source: "workspace", sensitivity: "normal" },
|
|
74
|
+
find: { category: "code", action: "search", source: "workspace", sensitivity: "normal" },
|
|
75
|
+
glob: { category: "code", action: "search", source: "workspace", sensitivity: "normal" },
|
|
76
|
+
find_files: { category: "code", action: "search", source: "workspace", sensitivity: "normal" },
|
|
77
|
+
session_search: { category: "other", action: "search", source: "runtime", sensitivity: "normal" },
|
|
78
|
+
search: { category: "other", action: "search", source: "unknown", sensitivity: "normal" },
|
|
79
|
+
read_file: { category: "file", action: "read", source: "workspace", sensitivity: "normal" },
|
|
80
|
+
"review.prepare_diff": { category: "file", action: "read", source: "workspace", sensitivity: "normal" },
|
|
81
|
+
list_dir: { category: "file", action: "list", source: "workspace", sensitivity: "normal" },
|
|
82
|
+
ls: { category: "file", action: "list", source: "workspace", sensitivity: "normal" },
|
|
83
|
+
write_file: { category: "file", action: "write", source: "workspace", sensitivity: "normal" },
|
|
84
|
+
apply_patch: { category: "file", action: "edit", source: "workspace", sensitivity: "normal" },
|
|
85
|
+
exec_command: { category: "command", action: "execute", source: "runtime", sensitivity: "normal" },
|
|
86
|
+
run_command: { category: "command", action: "execute", source: "runtime", sensitivity: "normal" },
|
|
87
|
+
update_plan: { category: "planning", action: "plan", source: "runtime", sensitivity: "normal" }
|
|
88
|
+
};
|
|
89
|
+
function toolActivityId(name) {
|
|
90
|
+
const normalized = name.trim().toLowerCase().replace(/-/g, "_");
|
|
91
|
+
const namespaced = normalized.split("__").at(-1) ?? normalized;
|
|
92
|
+
return namespaced.split(".").at(-1) ?? namespaced;
|
|
93
|
+
}
|
|
94
|
+
function resolveToolActivityDefinition(name) {
|
|
95
|
+
const normalized = name.trim().toLowerCase().replace(/-/g, "_");
|
|
96
|
+
return TOOL_ACTIVITY_CATALOG[normalized] ?? TOOL_ACTIVITY_CATALOG[toolActivityId(normalized)] ?? OTHER_ACTIVITY;
|
|
97
|
+
}
|
|
98
|
+
function asRecord(value) {
|
|
99
|
+
if (typeof value === "string") {
|
|
100
|
+
try {
|
|
101
|
+
return asRecord(JSON.parse(value));
|
|
102
|
+
} catch {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
107
|
+
}
|
|
108
|
+
function resultCount(result) {
|
|
109
|
+
const record = asRecord(result);
|
|
110
|
+
const details = asRecord(record?.details);
|
|
111
|
+
const results = details?.results ?? record?.results;
|
|
112
|
+
return Array.isArray(results) ? results.length : void 0;
|
|
113
|
+
}
|
|
114
|
+
function resultHasError(result) {
|
|
115
|
+
const record = asRecord(result);
|
|
116
|
+
const details = asRecord(record?.details);
|
|
117
|
+
return typeof (details?.error ?? record?.error) === "string";
|
|
118
|
+
}
|
|
119
|
+
function resolveToolActivity(name, status, result) {
|
|
120
|
+
const definition = resolveToolActivityDefinition(name);
|
|
121
|
+
const count = resultCount(result);
|
|
122
|
+
const resolvedStatus = status === "completed" && resultHasError(result) ? "failed" : status === "completed" && count === 0 ? "empty" : status;
|
|
123
|
+
return {
|
|
124
|
+
...definition,
|
|
125
|
+
status: resolvedStatus,
|
|
126
|
+
...count === void 0 ? {} : { count }
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
3
130
|
true &&(function polyfill() {
|
|
4
131
|
const relList = document.createElement("link").relList;
|
|
5
132
|
if (relList && relList.supports && relList.supports("modulepreload")) {
|
|
@@ -18041,6 +18168,233 @@ function ComposerPreviewDialog({ preview, onClose }) {
|
|
|
18041
18168
|
] });
|
|
18042
18169
|
}
|
|
18043
18170
|
|
|
18171
|
+
function toolStatusLabel(tool) {
|
|
18172
|
+
if (tool.status === "running") return t("toolRunning");
|
|
18173
|
+
if (tool.status === "error") return t("toolFailed");
|
|
18174
|
+
return t("toolCompleted");
|
|
18175
|
+
}
|
|
18176
|
+
function toolDuration(tool) {
|
|
18177
|
+
if (tool.startedAt === void 0 || tool.completedAt === void 0) return "";
|
|
18178
|
+
const milliseconds = Math.max(0, tool.completedAt - tool.startedAt);
|
|
18179
|
+
return milliseconds < 1e3 ? `${milliseconds} ms` : `${(milliseconds / 1e3).toFixed(1)} s`;
|
|
18180
|
+
}
|
|
18181
|
+
function AssistantActivity({
|
|
18182
|
+
message,
|
|
18183
|
+
detail,
|
|
18184
|
+
streaming
|
|
18185
|
+
}) {
|
|
18186
|
+
const [open, setOpen] = reactExports.useState(streaming && detail === "stream");
|
|
18187
|
+
const blocks = message.blocks.filter((block) => block.type === "tool" || block.type === "thinking" && detail !== "off");
|
|
18188
|
+
if (!blocks.length) return null;
|
|
18189
|
+
const toolCount = blocks.filter((block) => block.type === "tool").length;
|
|
18190
|
+
const running = blocks.some((block) => block.type === "thinking" && block.streaming || block.type === "tool" && block.status === "running");
|
|
18191
|
+
const summary = running ? t("activityRunning") : toolCount > 0 ? t("activitySteps", String(toolCount)) : t("activityThoughts");
|
|
18192
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("details", { className: "assistant-activity", open, onToggle: (event) => setOpen(event.currentTarget.open), children: [
|
|
18193
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("summary", { children: [
|
|
18194
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `activity-status${running ? " running" : ""}` }),
|
|
18195
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: summary })
|
|
18196
|
+
] }),
|
|
18197
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "activity-list", children: blocks.map((block, index) => block.type === "thinking" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "activity-thinking", children: [
|
|
18198
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("strong", { children: block.streaming ? t("thinkingRunning") : t("thinking") }),
|
|
18199
|
+
block.text ? /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: block.text }) : null
|
|
18200
|
+
] }, `thinking:${index}`) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `activity-tool ${block.status}`, children: [
|
|
18201
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "tool-status-mark" }),
|
|
18202
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "tool-name", children: block.name }),
|
|
18203
|
+
block.activity?.count !== void 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("small", { children: block.activity.count }) : null,
|
|
18204
|
+
toolDuration(block) ? /* @__PURE__ */ jsxRuntimeExports.jsx("small", { children: toolDuration(block) }) : null,
|
|
18205
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("small", { children: toolStatusLabel(block) })
|
|
18206
|
+
] }, block.toolCallId)) })
|
|
18207
|
+
] });
|
|
18208
|
+
}
|
|
18209
|
+
|
|
18210
|
+
function messageText(message) {
|
|
18211
|
+
return message.blocks.filter((block) => block.type === "text").map((block) => block.text).join("");
|
|
18212
|
+
}
|
|
18213
|
+
function hasMessageContent(message) {
|
|
18214
|
+
return message.blocks.some((block) => block.type === "tool" || block.text.trim().length > 0) || Boolean(message.attachments?.length);
|
|
18215
|
+
}
|
|
18216
|
+
function record(value) {
|
|
18217
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
18218
|
+
}
|
|
18219
|
+
function timestamp(value) {
|
|
18220
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
18221
|
+
if (typeof value !== "string") return void 0;
|
|
18222
|
+
const parsed = Date.parse(value);
|
|
18223
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
18224
|
+
}
|
|
18225
|
+
function blockId(value, index) {
|
|
18226
|
+
const id = value.toolCallId ?? value.tool_call_id ?? value.id;
|
|
18227
|
+
return typeof id === "string" && id ? id : `tool:${index}`;
|
|
18228
|
+
}
|
|
18229
|
+
function parseBlocks(value, startedAt) {
|
|
18230
|
+
if (typeof value === "string") return value ? [{ type: "text", text: value }] : [];
|
|
18231
|
+
if (!Array.isArray(value)) return [];
|
|
18232
|
+
return value.flatMap((item, index) => {
|
|
18233
|
+
const block = record(item);
|
|
18234
|
+
if (!block || typeof block.type !== "string") return [];
|
|
18235
|
+
if (block.type === "text" && typeof block.text === "string") {
|
|
18236
|
+
return [{ type: "text", text: block.text }];
|
|
18237
|
+
}
|
|
18238
|
+
if (block.type === "thinking") {
|
|
18239
|
+
const text = typeof block.thinking === "string" ? block.thinking : typeof block.text === "string" ? block.text : "";
|
|
18240
|
+
return [{ type: "thinking", text, streaming: false }];
|
|
18241
|
+
}
|
|
18242
|
+
if (block.type === "tool_use" || block.type === "tool_call" || block.type === "toolCall") {
|
|
18243
|
+
const fn = record(block.function);
|
|
18244
|
+
const name = typeof block.name === "string" ? block.name : typeof fn?.name === "string" ? fn.name : "unknown";
|
|
18245
|
+
const result = block.result;
|
|
18246
|
+
return [{
|
|
18247
|
+
type: "tool",
|
|
18248
|
+
toolCallId: blockId(block, index),
|
|
18249
|
+
name,
|
|
18250
|
+
status: block.isError === true ? "error" : "done",
|
|
18251
|
+
input: block.input ?? block.args ?? block.arguments ?? fn?.arguments,
|
|
18252
|
+
result,
|
|
18253
|
+
details: block.details,
|
|
18254
|
+
activity: resolveToolActivity(name, block.isError === true ? "failed" : "completed", result),
|
|
18255
|
+
startedAt,
|
|
18256
|
+
completedAt: startedAt
|
|
18257
|
+
}];
|
|
18258
|
+
}
|
|
18259
|
+
return [];
|
|
18260
|
+
});
|
|
18261
|
+
}
|
|
18262
|
+
function parseAttachments(value) {
|
|
18263
|
+
if (!Array.isArray(value)) return [];
|
|
18264
|
+
return value.flatMap((item) => {
|
|
18265
|
+
const media = record(item);
|
|
18266
|
+
if (!media) return [];
|
|
18267
|
+
const mimeType = typeof media.mimeType === "string" ? media.mimeType : void 0;
|
|
18268
|
+
const name = typeof media.name === "string" && media.name.trim() ? media.name.trim() : "Attachment";
|
|
18269
|
+
return [{
|
|
18270
|
+
type: media.type === "image" || media.type === "photo" || mimeType?.startsWith("image/") ? "image" : "file",
|
|
18271
|
+
name,
|
|
18272
|
+
...mimeType ? { mimeType } : {},
|
|
18273
|
+
...typeof media.size === "number" && Number.isFinite(media.size) ? { size: media.size } : {}
|
|
18274
|
+
}];
|
|
18275
|
+
});
|
|
18276
|
+
}
|
|
18277
|
+
function parseSourceContexts(value) {
|
|
18278
|
+
const metadata = record(value);
|
|
18279
|
+
if (!Array.isArray(metadata?.sourceContexts)) return void 0;
|
|
18280
|
+
const contexts = metadata.sourceContexts.flatMap((item) => {
|
|
18281
|
+
const source = record(item);
|
|
18282
|
+
if (!source || source.kind !== "note" && source.kind !== "browser_page" || typeof source.title !== "string") return [];
|
|
18283
|
+
return [{
|
|
18284
|
+
kind: source.kind,
|
|
18285
|
+
title: source.title,
|
|
18286
|
+
...typeof source.url === "string" ? { url: source.url } : {},
|
|
18287
|
+
...source.truncated === true ? { truncated: true } : {}
|
|
18288
|
+
}];
|
|
18289
|
+
});
|
|
18290
|
+
return contexts.length ? contexts : void 0;
|
|
18291
|
+
}
|
|
18292
|
+
function appendDeclaredTools(blocks, row, startedAt) {
|
|
18293
|
+
const declarations = [
|
|
18294
|
+
...Array.isArray(row.tool_calls) ? row.tool_calls : [],
|
|
18295
|
+
...Array.isArray(row.toolCalls) ? row.toolCalls : []
|
|
18296
|
+
];
|
|
18297
|
+
for (let index = 0; index < declarations.length; index += 1) {
|
|
18298
|
+
const declaration = record(declarations[index]);
|
|
18299
|
+
if (!declaration) continue;
|
|
18300
|
+
const fn = record(declaration.function);
|
|
18301
|
+
const id = blockId(declaration, index);
|
|
18302
|
+
const name = typeof declaration.name === "string" ? declaration.name : typeof fn?.name === "string" ? fn.name : "unknown";
|
|
18303
|
+
const existing = blocks.find((block) => block.type === "tool" && block.toolCallId === id);
|
|
18304
|
+
const result = declaration.result;
|
|
18305
|
+
const failed = declaration.isError === true;
|
|
18306
|
+
if (existing) {
|
|
18307
|
+
if (result !== void 0) {
|
|
18308
|
+
existing.status = failed ? "error" : "done";
|
|
18309
|
+
existing.result = result;
|
|
18310
|
+
existing.completedAt = startedAt;
|
|
18311
|
+
}
|
|
18312
|
+
existing.details = declaration.details ?? existing.details;
|
|
18313
|
+
continue;
|
|
18314
|
+
}
|
|
18315
|
+
blocks.push({
|
|
18316
|
+
type: "tool",
|
|
18317
|
+
toolCallId: id,
|
|
18318
|
+
name,
|
|
18319
|
+
input: declaration.args ?? declaration.arguments ?? fn?.arguments,
|
|
18320
|
+
status: result === void 0 ? "running" : failed ? "error" : "done",
|
|
18321
|
+
result,
|
|
18322
|
+
details: declaration.details,
|
|
18323
|
+
activity: resolveToolActivity(name, result === void 0 ? "running" : failed ? "failed" : "completed", result),
|
|
18324
|
+
startedAt,
|
|
18325
|
+
...result === void 0 ? {} : { completedAt: startedAt }
|
|
18326
|
+
});
|
|
18327
|
+
}
|
|
18328
|
+
}
|
|
18329
|
+
function mergeAssistantBlocks(target, incoming) {
|
|
18330
|
+
for (const block of incoming) {
|
|
18331
|
+
if (block.type === "tool") {
|
|
18332
|
+
const index = target.findIndex((candidate) => candidate.type === "tool" && candidate.toolCallId === block.toolCallId);
|
|
18333
|
+
if (index >= 0) {
|
|
18334
|
+
target[index] = block;
|
|
18335
|
+
continue;
|
|
18336
|
+
}
|
|
18337
|
+
}
|
|
18338
|
+
const previous = target.at(-1);
|
|
18339
|
+
if (block.type === "thinking" && previous?.type === "thinking" && previous.text === block.text) continue;
|
|
18340
|
+
target.push(block);
|
|
18341
|
+
}
|
|
18342
|
+
}
|
|
18343
|
+
function applyToolResult(messages, row) {
|
|
18344
|
+
const assistant = [...messages].reverse().find((message) => message.role === "assistant");
|
|
18345
|
+
if (!assistant) return;
|
|
18346
|
+
const id = row.toolCallId ?? row.tool_call_id;
|
|
18347
|
+
if (typeof id !== "string") return;
|
|
18348
|
+
const tool = assistant.blocks.find((block) => block.type === "tool" && block.toolCallId === id);
|
|
18349
|
+
if (!tool) return;
|
|
18350
|
+
const result = typeof row.content === "string" ? row.content : Array.isArray(row.content) ? row.content.flatMap((item) => {
|
|
18351
|
+
const block = record(item);
|
|
18352
|
+
return block?.type === "text" && typeof block.text === "string" ? [block.text] : [];
|
|
18353
|
+
}).join("") : "";
|
|
18354
|
+
const failed = row.isError === true;
|
|
18355
|
+
tool.status = failed ? "error" : "done";
|
|
18356
|
+
tool.result = result;
|
|
18357
|
+
tool.details = row.details;
|
|
18358
|
+
tool.completedAt = timestamp(row.timestamp);
|
|
18359
|
+
tool.activity = resolveToolActivity(tool.name, failed ? "failed" : "completed", { result, details: row.details });
|
|
18360
|
+
}
|
|
18361
|
+
function normalizeChatMessages(values) {
|
|
18362
|
+
const messages = [];
|
|
18363
|
+
for (let index = 0; index < values.length; index += 1) {
|
|
18364
|
+
const row = record(values[index]);
|
|
18365
|
+
if (!row) continue;
|
|
18366
|
+
if (row.role === "tool" || row.role === "toolResult") {
|
|
18367
|
+
applyToolResult(messages, row);
|
|
18368
|
+
continue;
|
|
18369
|
+
}
|
|
18370
|
+
if (row.role !== "user" && row.role !== "assistant" && row.role !== "system") continue;
|
|
18371
|
+
const startedAt = timestamp(row.timestamp);
|
|
18372
|
+
const rawBlocks = parseBlocks(row.rawContent, startedAt);
|
|
18373
|
+
const blocks = rawBlocks.length ? rawBlocks : parseBlocks(row.content, startedAt);
|
|
18374
|
+
if (row.role === "assistant") appendDeclaredTools(blocks, row, startedAt);
|
|
18375
|
+
const attachments = [...parseAttachments(row.media), ...parseAttachments(row.attachments)];
|
|
18376
|
+
const sourceContexts = parseSourceContexts(row.metadata);
|
|
18377
|
+
const message = {
|
|
18378
|
+
id: typeof row.id === "string" ? row.id : `${row.role}:${index}`,
|
|
18379
|
+
role: row.role,
|
|
18380
|
+
blocks,
|
|
18381
|
+
...startedAt === void 0 ? {} : { timestamp: startedAt },
|
|
18382
|
+
...attachments.length ? { attachments } : {},
|
|
18383
|
+
...sourceContexts ? { sourceContexts } : {}
|
|
18384
|
+
};
|
|
18385
|
+
if (!hasMessageContent(message)) continue;
|
|
18386
|
+
const previous = messages.at(-1);
|
|
18387
|
+
if (message.role === "assistant" && previous?.role === "assistant") {
|
|
18388
|
+
mergeAssistantBlocks(previous.blocks, message.blocks);
|
|
18389
|
+
previous.timestamp = message.timestamp ?? previous.timestamp;
|
|
18390
|
+
if (message.attachments?.length) previous.attachments = [...previous.attachments ?? [], ...message.attachments];
|
|
18391
|
+
} else {
|
|
18392
|
+
messages.push(message);
|
|
18393
|
+
}
|
|
18394
|
+
}
|
|
18395
|
+
return messages;
|
|
18396
|
+
}
|
|
18397
|
+
|
|
18044
18398
|
const OUTBOX_STORE = "outbox";
|
|
18045
18399
|
function transactionResult(database, mode, createRequest) {
|
|
18046
18400
|
return new Promise((resolve, reject) => {
|
|
@@ -18085,6 +18439,121 @@ async function deleteBrowserOutbox(conversationId) {
|
|
|
18085
18439
|
}
|
|
18086
18440
|
}
|
|
18087
18441
|
|
|
18442
|
+
function appendWithOverlap(base, incoming) {
|
|
18443
|
+
if (!incoming || base.endsWith(incoming)) return base;
|
|
18444
|
+
const max = Math.min(base.length, incoming.length, 512);
|
|
18445
|
+
for (let length = max; length > 0; length -= 1) {
|
|
18446
|
+
if (base.slice(-length) === incoming.slice(0, length)) {
|
|
18447
|
+
return base + incoming.slice(length);
|
|
18448
|
+
}
|
|
18449
|
+
}
|
|
18450
|
+
return base + incoming;
|
|
18451
|
+
}
|
|
18452
|
+
function closeThinking(blocks) {
|
|
18453
|
+
const last = blocks.at(-1);
|
|
18454
|
+
if (last?.type === "thinking") last.streaming = false;
|
|
18455
|
+
}
|
|
18456
|
+
function mergeDetails(previous, next) {
|
|
18457
|
+
if (!next || typeof next !== "object" || Array.isArray(next)) return next;
|
|
18458
|
+
const incoming = next;
|
|
18459
|
+
if (typeof incoming.textDelta !== "string") return next;
|
|
18460
|
+
const current = previous && typeof previous === "object" && !Array.isArray(previous) ? previous : {};
|
|
18461
|
+
return { ...current, text: appendWithOverlap(String(current.text ?? ""), incoming.textDelta) };
|
|
18462
|
+
}
|
|
18463
|
+
function activity(value) {
|
|
18464
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
18465
|
+
return value;
|
|
18466
|
+
}
|
|
18467
|
+
function toolId(payload, fallback) {
|
|
18468
|
+
return typeof payload.toolCallId === "string" && payload.toolCallId ? payload.toolCallId : fallback;
|
|
18469
|
+
}
|
|
18470
|
+
function createStreamingMessage(runId, timestamp = Date.now()) {
|
|
18471
|
+
return { id: `stream:${runId}`, role: "assistant", blocks: [], timestamp };
|
|
18472
|
+
}
|
|
18473
|
+
function reduceRunEvent(current, input) {
|
|
18474
|
+
const message = current ? { ...current, blocks: current.blocks.map((block) => ({ ...block })) } : createStreamingMessage(input.runId, input.timestamp);
|
|
18475
|
+
const { event, payload } = input;
|
|
18476
|
+
if (event === "assistant_delta" && typeof payload.delta === "string" && payload.delta) {
|
|
18477
|
+
closeThinking(message.blocks);
|
|
18478
|
+
const messageId = typeof payload.messageId === "string" ? payload.messageId : void 0;
|
|
18479
|
+
const last = message.blocks.at(-1);
|
|
18480
|
+
if (last?.type === "text" && last.messageId === messageId) {
|
|
18481
|
+
last.text = appendWithOverlap(last.text, payload.delta);
|
|
18482
|
+
} else {
|
|
18483
|
+
message.blocks.push({ type: "text", text: payload.delta, ...messageId ? { messageId } : {} });
|
|
18484
|
+
}
|
|
18485
|
+
} else if (event === "thinking_delta" && typeof payload.delta === "string" && payload.delta) {
|
|
18486
|
+
const last = message.blocks.at(-1);
|
|
18487
|
+
if (last?.type === "thinking" && last.streaming) {
|
|
18488
|
+
last.text = appendWithOverlap(last.text, payload.delta);
|
|
18489
|
+
} else {
|
|
18490
|
+
message.blocks.push({ type: "thinking", text: payload.delta, streaming: true });
|
|
18491
|
+
}
|
|
18492
|
+
} else if (event === "thinking_end" || event === "assistant_message_end") {
|
|
18493
|
+
closeThinking(message.blocks);
|
|
18494
|
+
} else if (event === "tool_start") {
|
|
18495
|
+
closeThinking(message.blocks);
|
|
18496
|
+
const name = typeof payload.toolName === "string" && payload.toolName ? payload.toolName : "unknown";
|
|
18497
|
+
if (name !== "clarify") {
|
|
18498
|
+
const id = toolId(payload, `tool:${message.blocks.length}`);
|
|
18499
|
+
if (!message.blocks.some((block) => block.type === "tool" && block.toolCallId === id)) {
|
|
18500
|
+
message.blocks.push({
|
|
18501
|
+
type: "tool",
|
|
18502
|
+
toolCallId: id,
|
|
18503
|
+
name,
|
|
18504
|
+
status: "running",
|
|
18505
|
+
input: payload.args,
|
|
18506
|
+
activity: activity(payload.activity) ?? resolveToolActivity(name, "running"),
|
|
18507
|
+
startedAt: input.timestamp
|
|
18508
|
+
});
|
|
18509
|
+
}
|
|
18510
|
+
}
|
|
18511
|
+
} else if (event === "tool_update") {
|
|
18512
|
+
const id = toolId(payload, "");
|
|
18513
|
+
const block = [...message.blocks].reverse().find((candidate) => candidate.type === "tool" && (id ? candidate.toolCallId === id : candidate.name === payload.toolName));
|
|
18514
|
+
if (block) {
|
|
18515
|
+
if (payload.details !== void 0) block.details = mergeDetails(block.details, payload.details);
|
|
18516
|
+
if (typeof payload.textDelta === "string" && payload.textDelta) {
|
|
18517
|
+
block.details = mergeDetails(block.details, { textDelta: payload.textDelta });
|
|
18518
|
+
}
|
|
18519
|
+
}
|
|
18520
|
+
} else if (event === "tool_end") {
|
|
18521
|
+
const name = typeof payload.toolName === "string" && payload.toolName ? payload.toolName : "unknown";
|
|
18522
|
+
if (name !== "clarify") {
|
|
18523
|
+
const id = toolId(payload, `tool:${message.blocks.length}`);
|
|
18524
|
+
let block = [...message.blocks].reverse().find((candidate) => candidate.type === "tool" && candidate.toolCallId === id);
|
|
18525
|
+
if (!block) {
|
|
18526
|
+
block = { type: "tool", toolCallId: id, name, status: "running", startedAt: input.timestamp };
|
|
18527
|
+
message.blocks.push(block);
|
|
18528
|
+
}
|
|
18529
|
+
const failed = payload.status === "error" || payload.status === "cancelled";
|
|
18530
|
+
block.status = failed ? "error" : "done";
|
|
18531
|
+
block.result = payload.result;
|
|
18532
|
+
block.activity = activity(payload.activity) ?? resolveToolActivity(name, failed ? "failed" : "completed", payload.result);
|
|
18533
|
+
block.completedAt = input.timestamp;
|
|
18534
|
+
}
|
|
18535
|
+
}
|
|
18536
|
+
return message;
|
|
18537
|
+
}
|
|
18538
|
+
function finalizeStreamingMessage(message, failed = false) {
|
|
18539
|
+
return {
|
|
18540
|
+
...message,
|
|
18541
|
+
blocks: message.blocks.map((block) => {
|
|
18542
|
+
if (block.type === "thinking") {
|
|
18543
|
+
return { ...block, text: block.text.trim(), streaming: false };
|
|
18544
|
+
}
|
|
18545
|
+
if (block.type === "tool" && block.status === "running") {
|
|
18546
|
+
return {
|
|
18547
|
+
...block,
|
|
18548
|
+
status: failed ? "error" : "done",
|
|
18549
|
+
activity: resolveToolActivity(block.name, failed ? "failed" : "completed")
|
|
18550
|
+
};
|
|
18551
|
+
}
|
|
18552
|
+
return { ...block };
|
|
18553
|
+
})
|
|
18554
|
+
};
|
|
18555
|
+
}
|
|
18556
|
+
|
|
18088
18557
|
const CLIENT_ID_KEY = "xopc.browser.client-id";
|
|
18089
18558
|
const ACTIVE_CHAT_KEY = "xopc.browser.active-chat";
|
|
18090
18559
|
const CURSOR_PREFIX = "xopc.browser.cursor.";
|
|
@@ -18120,53 +18589,10 @@ async function json(response) {
|
|
|
18120
18589
|
function isRetryableDeliveryError(cause) {
|
|
18121
18590
|
return !(cause instanceof GatewayRequestError) || cause.status === 408 || cause.status === 429 || cause.status >= 500;
|
|
18122
18591
|
}
|
|
18123
|
-
function
|
|
18124
|
-
|
|
18125
|
-
|
|
18126
|
-
return value
|
|
18127
|
-
if (!block || typeof block !== "object") return [];
|
|
18128
|
-
const row = block;
|
|
18129
|
-
return row.type === "text" && typeof row.text === "string" ? [row.text] : [];
|
|
18130
|
-
}).join("");
|
|
18131
|
-
}
|
|
18132
|
-
function mapMessage(value, index) {
|
|
18133
|
-
if (!value || typeof value !== "object") return void 0;
|
|
18134
|
-
const row = value;
|
|
18135
|
-
if (row.role !== "user" && row.role !== "assistant" && row.role !== "system") return void 0;
|
|
18136
|
-
const text = textContent(row.content);
|
|
18137
|
-
const attachments = Array.isArray(row.media) ? row.media.flatMap((value2) => {
|
|
18138
|
-
if (!value2 || typeof value2 !== "object") return [];
|
|
18139
|
-
const media = value2;
|
|
18140
|
-
const mimeType = typeof media.mimeType === "string" ? media.mimeType : void 0;
|
|
18141
|
-
const name = typeof media.name === "string" && media.name.trim() ? media.name.trim() : t("attachment");
|
|
18142
|
-
return [{
|
|
18143
|
-
type: media.type === "image" || media.type === "photo" || mimeType?.startsWith("image/") ? "image" : "file",
|
|
18144
|
-
name,
|
|
18145
|
-
...mimeType ? { mimeType } : {},
|
|
18146
|
-
...typeof media.size === "number" && Number.isFinite(media.size) ? { size: media.size } : {}
|
|
18147
|
-
}];
|
|
18148
|
-
}) : [];
|
|
18149
|
-
if (!text && !attachments.length) return void 0;
|
|
18150
|
-
return {
|
|
18151
|
-
id: typeof row.id === "string" ? row.id : `${row.role}-${index}`,
|
|
18152
|
-
role: row.role,
|
|
18153
|
-
text,
|
|
18154
|
-
...typeof row.timestamp === "number" ? { timestamp: row.timestamp } : {},
|
|
18155
|
-
...attachments.length ? { attachments } : {},
|
|
18156
|
-
...row.metadata && typeof row.metadata === "object" && Array.isArray(row.metadata.sourceContexts) ? {
|
|
18157
|
-
sourceContexts: row.metadata.sourceContexts.flatMap((value2) => {
|
|
18158
|
-
if (!value2 || typeof value2 !== "object") return [];
|
|
18159
|
-
const source = value2;
|
|
18160
|
-
if (source.kind !== "note" && source.kind !== "browser_page" || typeof source.title !== "string") return [];
|
|
18161
|
-
return [{
|
|
18162
|
-
kind: source.kind,
|
|
18163
|
-
title: source.title,
|
|
18164
|
-
...typeof source.url === "string" ? { url: source.url } : {},
|
|
18165
|
-
...source.truncated === true ? { truncated: true } : {}
|
|
18166
|
-
}];
|
|
18167
|
-
})
|
|
18168
|
-
} : {}
|
|
18169
|
-
};
|
|
18592
|
+
function activityDetail(config, fallback = "on") {
|
|
18593
|
+
const detail = config.activityDetail && typeof config.activityDetail === "object" ? config.activityDetail : void 0;
|
|
18594
|
+
const value = detail?.effective ?? config.reasoningLevel;
|
|
18595
|
+
return value === "off" || value === "on" || value === "stream" ? value : fallback;
|
|
18170
18596
|
}
|
|
18171
18597
|
function mapClarification(value, conversationId) {
|
|
18172
18598
|
if (!value || typeof value !== "object") return void 0;
|
|
@@ -18219,7 +18645,6 @@ class BrowserChatClient {
|
|
|
18219
18645
|
pendingDelivery: false,
|
|
18220
18646
|
sessions: [],
|
|
18221
18647
|
messages: [],
|
|
18222
|
-
streamingText: "",
|
|
18223
18648
|
models: []
|
|
18224
18649
|
};
|
|
18225
18650
|
subscribe(listener) {
|
|
@@ -18396,7 +18821,7 @@ ${endpointId}`;
|
|
|
18396
18821
|
conversationId,
|
|
18397
18822
|
transcriptId: this.snapshot.sessions.find((candidate) => candidate.key === conversationId)?.transcriptId,
|
|
18398
18823
|
messages: [],
|
|
18399
|
-
|
|
18824
|
+
streamingMessage: void 0,
|
|
18400
18825
|
runId: void 0,
|
|
18401
18826
|
stopping: false,
|
|
18402
18827
|
sessionLoading: true,
|
|
@@ -18487,7 +18912,7 @@ ${endpointId}`;
|
|
|
18487
18912
|
messages: this.snapshot.runId ? this.snapshot.messages : [...this.snapshot.messages, {
|
|
18488
18913
|
id: clientMessageId,
|
|
18489
18914
|
role: "user",
|
|
18490
|
-
text,
|
|
18915
|
+
blocks: text ? [{ type: "text", text }] : [],
|
|
18491
18916
|
...attachments.length ? {
|
|
18492
18917
|
attachments: attachments.map((attachment) => ({
|
|
18493
18918
|
type: attachment.type,
|
|
@@ -18497,7 +18922,7 @@ ${endpointId}`;
|
|
|
18497
18922
|
}))
|
|
18498
18923
|
} : {}
|
|
18499
18924
|
}],
|
|
18500
|
-
...this.snapshot.runId ? {} : {
|
|
18925
|
+
...this.snapshot.runId ? {} : { streamingMessage: void 0 },
|
|
18501
18926
|
error: void 0
|
|
18502
18927
|
});
|
|
18503
18928
|
const response = await json(
|
|
@@ -18605,7 +19030,7 @@ ${endpointId}`;
|
|
|
18605
19030
|
else {
|
|
18606
19031
|
if (this.runTopic) this.realtime?.unsubscribe(this.runTopic);
|
|
18607
19032
|
this.runTopic = void 0;
|
|
18608
|
-
this.update({ runId: void 0,
|
|
19033
|
+
this.update({ runId: void 0, streamingMessage: void 0, stopping: false });
|
|
18609
19034
|
}
|
|
18610
19035
|
}
|
|
18611
19036
|
}
|
|
@@ -18739,7 +19164,7 @@ ${endpointId}`;
|
|
|
18739
19164
|
const stored = await chrome.storage.session.get(`${CURSOR_PREFIX}${runId}`);
|
|
18740
19165
|
if (this.snapshot.conversationId !== conversationId || this.runTopic !== topic) return;
|
|
18741
19166
|
const cursor = typeof stored[`${CURSOR_PREFIX}${runId}`] === "number" ? stored[`${CURSOR_PREFIX}${runId}`] : void 0;
|
|
18742
|
-
this.update({ runId,
|
|
19167
|
+
this.update({ runId, streamingMessage: createStreamingMessage(runId) });
|
|
18743
19168
|
this.realtime?.subscribe(topic, cursor);
|
|
18744
19169
|
}
|
|
18745
19170
|
async onRealtimeEvent(topic, seq, event, data) {
|
|
@@ -18759,12 +19184,23 @@ ${endpointId}`;
|
|
|
18759
19184
|
}
|
|
18760
19185
|
if (topic !== this.runTopic) return;
|
|
18761
19186
|
const runId = topic.slice("run:".length);
|
|
18762
|
-
|
|
18763
|
-
const payload =
|
|
18764
|
-
if (event
|
|
18765
|
-
this.update({
|
|
19187
|
+
const envelope = data && typeof data === "object" ? data : {};
|
|
19188
|
+
const payload = envelope.payload && typeof envelope.payload === "object" ? envelope.payload : {};
|
|
19189
|
+
if (event !== "run_end" && event !== "error") {
|
|
19190
|
+
this.update({ streamingMessage: reduceRunEvent(this.snapshot.streamingMessage, {
|
|
19191
|
+
event,
|
|
19192
|
+
payload,
|
|
19193
|
+
runId,
|
|
19194
|
+
timestamp: typeof envelope.timestamp === "number" ? envelope.timestamp : Date.now()
|
|
19195
|
+
}) });
|
|
18766
19196
|
}
|
|
19197
|
+
await chrome.storage.session.set({ [`${CURSOR_PREFIX}${runId}`]: seq });
|
|
18767
19198
|
if (event === "run_end" || event === "error") {
|
|
19199
|
+
if (this.snapshot.streamingMessage) {
|
|
19200
|
+
this.update({
|
|
19201
|
+
streamingMessage: finalizeStreamingMessage(this.snapshot.streamingMessage, event === "error")
|
|
19202
|
+
});
|
|
19203
|
+
}
|
|
18768
19204
|
this.realtime?.unsubscribe(topic);
|
|
18769
19205
|
this.runTopic = void 0;
|
|
18770
19206
|
await chrome.storage.session.remove(`${CURSOR_PREFIX}${runId}`);
|
|
@@ -18772,7 +19208,7 @@ ${endpointId}`;
|
|
|
18772
19208
|
await this.reloadMessages();
|
|
18773
19209
|
} finally {
|
|
18774
19210
|
if (topic === this.runTopic || this.snapshot.runId === runId) {
|
|
18775
|
-
this.update({ runId: void 0,
|
|
19211
|
+
this.update({ runId: void 0, streamingMessage: void 0, stopping: false });
|
|
18776
19212
|
}
|
|
18777
19213
|
}
|
|
18778
19214
|
}
|
|
@@ -18781,10 +19217,7 @@ ${endpointId}`;
|
|
|
18781
19217
|
const conversationId = this.snapshot.conversationId;
|
|
18782
19218
|
if (!conversationId) return;
|
|
18783
19219
|
const result = await json(await gatewayFetch(`/api/sessions/${encodeURIComponent(conversationId)}/messages?limit=200`));
|
|
18784
|
-
const messages = (result.payload.messages ?? [])
|
|
18785
|
-
const message = mapMessage(value, index);
|
|
18786
|
-
return message ? [message] : [];
|
|
18787
|
-
});
|
|
19220
|
+
const messages = normalizeChatMessages(result.payload.messages ?? []);
|
|
18788
19221
|
if (this.snapshot.conversationId !== conversationId) return;
|
|
18789
19222
|
const session = this.snapshot.sessions.find((candidate) => candidate.key === conversationId);
|
|
18790
19223
|
this.update({ messages, transcriptId: session?.transcriptId });
|
|
@@ -18824,6 +19257,7 @@ ${endpointId}`;
|
|
|
18824
19257
|
this.update({ modelConfig: {
|
|
18825
19258
|
model: config.model,
|
|
18826
19259
|
thinkingLevel: config.thinkingLevel,
|
|
19260
|
+
activityDetail: activityDetail(config),
|
|
18827
19261
|
...typeof config.configVersion === "number" ? { configVersion: config.configVersion } : {},
|
|
18828
19262
|
fixedModel: config.fixedModel === true
|
|
18829
19263
|
} });
|
|
@@ -18848,6 +19282,7 @@ ${endpointId}`;
|
|
|
18848
19282
|
this.update({ modelConfig: {
|
|
18849
19283
|
model: config.model,
|
|
18850
19284
|
thinkingLevel: config.thinkingLevel,
|
|
19285
|
+
activityDetail: activityDetail(config, current.activityDetail),
|
|
18851
19286
|
...typeof config.configVersion === "number" ? { configVersion: config.configVersion } : {},
|
|
18852
19287
|
fixedModel: config.fixedModel === true
|
|
18853
19288
|
} });
|
|
@@ -18905,7 +19340,7 @@ ${endpointId}`;
|
|
|
18905
19340
|
await this.reloadMessages();
|
|
18906
19341
|
} finally {
|
|
18907
19342
|
if (this.snapshot.conversationId === conversationId) {
|
|
18908
|
-
this.update({ runId: void 0,
|
|
19343
|
+
this.update({ runId: void 0, streamingMessage: void 0, stopping: false });
|
|
18909
19344
|
}
|
|
18910
19345
|
}
|
|
18911
19346
|
return;
|
|
@@ -27658,7 +28093,6 @@ const EMPTY = {
|
|
|
27658
28093
|
pendingDelivery: false,
|
|
27659
28094
|
sessions: [],
|
|
27660
28095
|
messages: [],
|
|
27661
|
-
streamingText: "",
|
|
27662
28096
|
models: []
|
|
27663
28097
|
};
|
|
27664
28098
|
function formatMessageTime(timestamp) {
|
|
@@ -27816,7 +28250,7 @@ function ChatPanel({ gatewayId }) {
|
|
|
27816
28250
|
}, [client]);
|
|
27817
28251
|
reactExports.useEffect(() => {
|
|
27818
28252
|
if (followingTail.current) scrollToBottom();
|
|
27819
|
-
}, [scrollToBottom, snapshot.messages, snapshot.
|
|
28253
|
+
}, [scrollToBottom, snapshot.messages, snapshot.streamingMessage]);
|
|
27820
28254
|
reactExports.useEffect(() => {
|
|
27821
28255
|
followingTail.current = true;
|
|
27822
28256
|
setAtBottom(true);
|
|
@@ -28172,7 +28606,7 @@ function ChatPanel({ gatewayId }) {
|
|
|
28172
28606
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", {}),
|
|
28173
28607
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", {})
|
|
28174
28608
|
] }) : null,
|
|
28175
|
-
!snapshot.sessionLoading && !snapshot.messages.length && !snapshot.
|
|
28609
|
+
!snapshot.sessionLoading && !snapshot.messages.length && !snapshot.streamingMessage ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "empty-chat", children: [
|
|
28176
28610
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "empty-mark", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SparkleIcon, {}) }),
|
|
28177
28611
|
/* @__PURE__ */ jsxRuntimeExports.jsx("h1", { children: t("emptyChatTitle") }),
|
|
28178
28612
|
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: t("emptyChatDescription") }),
|
|
@@ -28191,39 +28625,46 @@ function ChatPanel({ gatewayId }) {
|
|
|
28191
28625
|
] })
|
|
28192
28626
|
] })
|
|
28193
28627
|
] }) : null,
|
|
28194
|
-
snapshot.messages.map((message) =>
|
|
28195
|
-
|
|
28196
|
-
|
|
28197
|
-
|
|
28198
|
-
|
|
28199
|
-
|
|
28200
|
-
|
|
28201
|
-
|
|
28202
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
|
|
28203
|
-
source.
|
|
28204
|
-
|
|
28205
|
-
|
|
28206
|
-
|
|
28207
|
-
|
|
28208
|
-
|
|
28209
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
|
|
28210
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
28211
|
-
|
|
28212
|
-
|
|
28213
|
-
|
|
28214
|
-
|
|
28215
|
-
|
|
28216
|
-
|
|
28217
|
-
|
|
28218
|
-
|
|
28219
|
-
|
|
28220
|
-
|
|
28221
|
-
|
|
28628
|
+
snapshot.messages.map((message) => {
|
|
28629
|
+
const text = messageText(message);
|
|
28630
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("article", { className: `message ${message.role}`, children: [
|
|
28631
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "message-heading", children: [
|
|
28632
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "message-author", children: message.role === "user" ? t("you") : message.role === "assistant" ? "xopc" : t("system") }),
|
|
28633
|
+
formatMessageTime(message.timestamp) ? /* @__PURE__ */ jsxRuntimeExports.jsx("time", { children: formatMessageTime(message.timestamp) }) : null
|
|
28634
|
+
] }),
|
|
28635
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "message-body", children: [
|
|
28636
|
+
message.sourceContexts?.length ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "message-sources", children: message.sourceContexts.map((source, index) => /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "source-badge", title: source.url, children: [
|
|
28637
|
+
source.kind === "browser_page" ? /* @__PURE__ */ jsxRuntimeExports.jsx(PageIcon, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(FileIcon, {}),
|
|
28638
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
|
|
28639
|
+
source.title,
|
|
28640
|
+
source.truncated ? ` · ${t("truncated")}` : ""
|
|
28641
|
+
] })
|
|
28642
|
+
] }, `${source.title}-${index}`)) }) : null,
|
|
28643
|
+
message.attachments?.length ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "message-attachments", children: message.attachments.map((attachment, index) => /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "message-attachment", title: attachment.mimeType, children: [
|
|
28644
|
+
attachment.type === "image" ? /* @__PURE__ */ jsxRuntimeExports.jsx(CameraIcon, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(FileIcon, {}),
|
|
28645
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
|
|
28646
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("strong", { children: attachment.name }),
|
|
28647
|
+
formatFileSize(attachment.size) ? /* @__PURE__ */ jsxRuntimeExports.jsx("small", { children: formatFileSize(attachment.size) }) : null
|
|
28648
|
+
] })
|
|
28649
|
+
] }, `${attachment.name}-${index}`)) }) : null,
|
|
28650
|
+
message.role === "assistant" ? /* @__PURE__ */ jsxRuntimeExports.jsx(AssistantActivity, { message, detail: snapshot.modelConfig?.activityDetail ?? "on", streaming: false }) : null,
|
|
28651
|
+
text ? message.role === "assistant" ? /* @__PURE__ */ jsxRuntimeExports.jsx(MarkdownContent, { children: text }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "plain-message-content", children: text }) : null
|
|
28652
|
+
] }),
|
|
28653
|
+
message.role === "assistant" && text ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "message-actions", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { type: "button", "aria-label": t("copyResponse"), title: t("copyResponse"), onClick: () => void copyMessage(message.id, text), children: [
|
|
28654
|
+
copiedMessageId === message.id ? /* @__PURE__ */ jsxRuntimeExports.jsx(CheckIcon, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, {}),
|
|
28655
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: copiedMessageId === message.id ? t("copied") : t("copy") })
|
|
28656
|
+
] }) }) : null
|
|
28657
|
+
] }, message.id);
|
|
28658
|
+
}),
|
|
28659
|
+
snapshot.streamingMessage ? /* @__PURE__ */ jsxRuntimeExports.jsxs("article", { className: "message assistant streaming", children: [
|
|
28222
28660
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "message-heading", children: [
|
|
28223
28661
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "message-author", children: "xopc" }),
|
|
28224
28662
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "responding-label", children: t("responding") })
|
|
28225
28663
|
] }),
|
|
28226
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
28664
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "message-body", children: [
|
|
28665
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(AssistantActivity, { message: snapshot.streamingMessage, detail: snapshot.modelConfig?.activityDetail ?? "on", streaming: true }),
|
|
28666
|
+
messageText(snapshot.streamingMessage) ? /* @__PURE__ */ jsxRuntimeExports.jsx(MarkdownContent, { streaming: true, children: messageText(snapshot.streamingMessage) }) : null
|
|
28667
|
+
] })
|
|
28227
28668
|
] }) : null
|
|
28228
28669
|
] }),
|
|
28229
28670
|
!atBottom ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "scroll-bottom-button", type: "button", "aria-label": t("scrollLatest"), title: t("scrollLatest"), onClick: () => scrollToBottom(true), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ArrowDownIcon, {}) }) : null
|
|
@@ -28468,7 +28909,7 @@ ${pageContext.context.selection ?? pageContext.context.text ?? ""}` }), children
|
|
|
28468
28909
|
const input = event.currentTarget;
|
|
28469
28910
|
const walk = historyWalk.current;
|
|
28470
28911
|
if (walk || event.key === "ArrowUp" && input.selectionStart === 0 && input.selectionEnd === 0) {
|
|
28471
|
-
const history = walk ?? { items: snapshot.messages.filter((message) => message.role === "user" && message.
|
|
28912
|
+
const history = walk ?? { items: snapshot.messages.filter((message) => message.role === "user" && messageText(message).trim()).map(messageText).reverse(), index: -1, draft };
|
|
28472
28913
|
const index = event.key === "ArrowUp" ? Math.min(history.index + 1, history.items.length - 1) : history.index - 1;
|
|
28473
28914
|
if (index >= 0 || walk) {
|
|
28474
28915
|
event.preventDefault();
|