@xopcai/xopc 0.0.303 → 0.0.307
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/README.md +4 -4
- package/README.zh-CN.md +4 -4
- package/dist/browser-ext/dist/assets/{auth-B_9ZuGDx.js → auth-C3yV1y_l.js} +67 -22
- package/dist/browser-ext/dist/background.js +4 -4
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +3 -3
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/xopc.extension.json +0 -3
- package/dist/extensions/telegram/xopc.extension.json +1 -4
- package/dist/extensions/weixin/xopc.extension.json +0 -3
- package/dist/gateway/static/root/assets/{activity-store-DCi5rh4e.js → activity-store-wgSB2HYK.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Ch3DzUvP.js → agent-avatar-dicebear-CZeQo09T.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BPsRb9Ck.js +1 -0
- package/dist/gateway/static/root/assets/{agents-DXHD-ST3.js → agents-BlrHMbRx.js} +1 -1
- package/dist/gateway/static/root/assets/{api-CAV9PN9i.js → api-BKHmTb0w.js} +1 -1
- package/dist/gateway/static/root/assets/api-DFOlahZv.js +1 -0
- package/dist/gateway/static/root/assets/app-management-settings-panel-Bzw4fQP8.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-8GZpUXva.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-BkQQtIxH.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BKGzaVvM.js → archive-plugin-CQ2NaoHb.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-8bARdLnp.js → attachment-load-BFi1H7yJ.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BAEenyzx.js → automations-page-CDBXcii_.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-CUpiTTiY.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-Cv3GS9Eo.js → binary-plugins-D07eWmOx.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-D4ZIVQbk.css → block-editor-BdOTO0Yo.css} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DUeb92LG.js → block-editor-CtVnjyYU.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-BGT0xoTv.js → browser-automation-inputs-BzkJog8e.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-D1O22WIf.js → browser-automations-page-DyrSbDdG.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-CqTxLpil.js +3 -0
- package/dist/gateway/static/root/assets/button-CS04eWY9.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BZ_-pnS6.js +8 -0
- package/dist/gateway/static/root/assets/channels-settings-DAD9qE3J.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-C_icwbWj.js → channels-status-swr-B2JwuTjG.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-D-JYPVYl.js → chat-terminal-dock-B62SZdAo.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-Bcfp948A.js → computer-settings-page-ClSresNq.js} +1 -1
- package/dist/gateway/static/root/assets/connector-service-page-CPqVmNvx.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-BUQyg3CW.js +2 -0
- package/dist/gateway/static/root/assets/cron-expression-CTMi_tql.js +2 -0
- package/dist/gateway/static/root/assets/date-picker-B71AJK50.js +1 -0
- package/dist/gateway/static/root/assets/{dependency-picker-UtoUm57Q.js → dependency-picker-DlyGK-kA.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Bryx7gRM.js → desktop-pet-DGkbTE8_.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-BY8r9j66.js +1 -0
- package/dist/gateway/static/root/assets/device-pairing-wizard-DzRrgd59.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DQlFTVBx.js → extension-debug-page-L8Mm1n3A.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BSsqRDXh.js → extension-page-CFc4vSNU.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DbVZv9ve.js → extension-settings-page-B5zWyHr3.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-D5AM8cyQ.js → gateway-config-swr-B6wHa6ZI.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-B53R0CA4.js +1 -0
- package/dist/gateway/static/root/assets/gateway-realtime-store-BLDgrJ30.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-D7qmTH4R.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CSJWdnFs.js → gateway-startup-retry-DRzGnEV-.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-Cxowc29b.js → heartbeat-settings-Glsl3X5b.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-s9hDQ8Hc.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-BNh604hw.js → image-generation-api-Ck_pyDom.js} +1 -1
- package/dist/gateway/static/root/assets/imports-page-ByBX7ome.js +1 -0
- package/dist/gateway/static/root/assets/index-RBCkv8a_.js +79 -0
- package/dist/gateway/static/root/assets/index-cFU4S35z.css +1 -0
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-C45RlO8a.js +1 -0
- package/dist/gateway/static/root/assets/local-app-workbench-page-DP0x2jpR.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-CXPaPDGm.js → local-apps-page-C_AQc2bI.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DLK05Y1a.js → locale-store-msTfRK8P.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DvM8Pyok.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-D1uwSutV.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-B8maDRWh.js → markdown-view-BInabSKf.js} +2 -2
- package/dist/gateway/static/root/assets/{media-plugins-tSJ0CvcX.js → media-plugins-C4mhf13f.js} +1 -1
- package/dist/gateway/static/root/assets/messages-F74LVAiU.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-D35sErp2.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-8jCDklDn.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-CQx6H-GS.js → page-tabs-1go_BtX1.js} +1 -1
- package/dist/gateway/static/root/assets/{popover-select-DldSX8GX.js → popover-select-9i-ZtHXL.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-A3-bVtdy.js → preview-open-alternatives-DmoSC0j1.js} +1 -1
- package/dist/gateway/static/root/assets/{proactive-page-D46cR3sf.js → proactive-page-xAjKTIID.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-CujZXOea.js → product-open-page-gmi5LLwM.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-BUMQHy_N.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DT-Mt7XR.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BMFL4vis.js → registry-api-BSWtko7U.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Clz3byir.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CR0qvq9C.js → runtime-tools-settings-panel-ClkOoxDl.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-BUD9lLEE.js → schema-form-BuEmLiaU.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-tQRwktKm.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DqWg9XS5.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BZPCUH6a.js → settings-form-section-Dor39QON.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-XoHmqIdm.js → settings-page-Xj-yvIc8.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BB_sMB7P.js +1 -0
- package/dist/gateway/static/root/assets/share-preview-page-BFWZoXdm.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-oDALm4b6.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DmwelnfK.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-BE9JXz4U.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-CH-quGxZ.js → skills-page.utils-Ii8qeXhs.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CGC7eBso.js → system-settings-panel-Di6OSO-0.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-D1AWszc7.js +1 -0
- package/dist/gateway/static/root/assets/theme-store-1SZ-HFHX.js +1 -0
- package/dist/gateway/static/root/assets/tunnel-api-DDOlOYlj.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-BydB6x2K.js → use-autosave-CQ8uWNnB.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-C00i4ea0.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-CPUDBcag.js → voice-api-key-field-COTzshjL.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-bZqN8-UF.js → voice-config-api-DgJML_uM.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-D_FmJbGH.js → work-discovery-overlay-_URrXbi4.js} +1 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-CALs-1nd.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-BUiBjz6m.js +6 -0
- package/dist/gateway/static/root/channel-icons/feishu.svg +6 -12
- package/dist/gateway/static/root/connector-icons/SOURCES.md +12 -0
- package/dist/gateway/static/root/connector-icons/dingtalk-mark.svg +1 -0
- package/dist/gateway/static/root/connector-icons/tencent-meeting-mark.svg +37 -0
- package/dist/gateway/static/root/connector-icons/wps-calendar.svg +14 -0
- package/dist/gateway/static/root/connector-icons/wps-docs.svg +14 -0
- package/dist/gateway/static/root/connector-icons/wps-mail.svg +7 -0
- package/dist/gateway/static/root/index.html +14 -12
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/device-pairing.js +100 -7
- package/dist/packages/gateway-contract/src/gateway-scopes.js +53 -0
- package/dist/packages/gateway-contract/src/index.js +2 -0
- package/dist/packages/realtime-client/src/index.js +14 -2
- package/dist/packages/realtime-protocol/src/index.js +18 -14
- package/dist/src/agent/agent-instance-gateway.d.ts +2 -0
- package/dist/src/agent/agent-manager.d.ts +2 -0
- package/dist/src/agent/agent-manager.js +40 -12
- package/dist/src/agent/agent-scope.d.ts +4 -1
- package/dist/src/agent/agent-scope.js +19 -3
- package/dist/src/agent/commands/command-isolation.js +11 -9
- package/dist/src/agent/commands/command-registry.js +18 -33
- package/dist/src/agent/context/audit.js +12 -2
- package/dist/src/agent/context/coordinator.d.ts +13 -3
- package/dist/src/agent/context/coordinator.js +27 -11
- package/dist/src/agent/context/execution-context.js +42 -22
- package/dist/src/agent/context/execution-context.types.d.ts +4 -2
- package/dist/src/agent/context/execution-scope.d.ts +2 -2
- package/dist/src/agent/context/execution-scope.js +1 -1
- package/dist/src/agent/context/project-context.d.ts +2 -2
- package/dist/src/agent/context/project-context.js +3 -3
- package/dist/src/agent/embedded/run-for-session.d.ts +1 -0
- package/dist/src/agent/embedded/run-for-session.js +7 -1
- package/dist/src/agent/external-tools/composio-provider.js +83 -20
- package/dist/src/agent/external-tools/gateway-tools.js +2 -1
- package/dist/src/agent/inbound/attachment-pipeline.d.ts +2 -0
- package/dist/src/agent/inbound/attachment-pipeline.js +3 -3
- package/dist/src/agent/inbound/inbound-loop.js +1 -0
- package/dist/src/agent/inbound/turn-dispatcher.js +3 -3
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
- package/dist/src/agent/mcp/mcp-stdio-transport.js +5 -2
- package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +1 -1
- package/dist/src/agent/memory/compaction-promotion.js +7 -2
- package/dist/src/agent/memory/create-memory-manager.js +1 -0
- package/dist/src/agent/memory/manager.d.ts +6 -0
- package/dist/src/agent/memory/manager.js +74 -39
- package/dist/src/agent/memory/runtime.d.ts +3 -3
- package/dist/src/agent/memory/runtime.js +11 -4
- package/dist/src/agent/orchestration/agent-orchestrator.js +4 -1
- package/dist/src/agent/prompt/cache-boundary.d.ts +2 -0
- package/dist/src/agent/prompt/cache-boundary.js +10 -1
- package/dist/src/agent/service/build-direct-message-content.d.ts +1 -0
- package/dist/src/agent/service/build-direct-message-content.js +2 -1
- package/dist/src/agent/service/direct-turn-helpers.js +3 -2
- package/dist/src/agent/service/process-direct-streaming.d.ts +3 -1
- package/dist/src/agent/service/process-direct-streaming.js +3 -2
- package/dist/src/agent/service/webchat-tts.d.ts +0 -4
- package/dist/src/agent/service/webchat-tts.js +20 -19
- package/dist/src/agent/tools/factory.js +3 -3
- package/dist/src/agent/tools/knowledge-memory-tool.d.ts +2 -2
- package/dist/src/agent/tools/knowledge-memory-tool.js +7 -7
- package/dist/src/browser/native-messaging-host.js +2 -2
- package/dist/src/channels/attachments/voice-stt-webchat.d.ts +3 -0
- package/dist/src/channels/attachments/voice-stt-webchat.js +22 -9
- package/dist/src/cli/commands/agent.js +2 -0
- package/dist/src/cli/commands/config.js +8 -9
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +69 -44
- package/dist/src/cli/commands/extension-pack.js +0 -2
- package/dist/src/cli/commands/extension.js +4 -25
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/onboard/gateway.js +2 -1
- package/dist/src/cli/utils/init-workspace-core.js +5 -2
- package/dist/src/config/index.js +2 -2
- package/dist/src/config/loader.d.ts +1 -0
- package/dist/src/config/loader.js +14 -1
- package/dist/src/config/schema.d.ts +22 -3
- package/dist/src/config/schema.js +13 -3
- package/dist/src/connectors/account-access.d.ts +4 -0
- package/dist/src/connectors/account-access.js +23 -0
- package/dist/src/connectors/approval-resume.d.ts +4 -0
- package/dist/src/connectors/approval-resume.js +23 -0
- package/dist/src/connectors/auth-provider-registry.d.ts +1 -0
- package/dist/src/connectors/auth-provider-registry.js +2 -1
- package/dist/src/connectors/authorization-attempts.d.ts +21 -0
- package/dist/src/connectors/authorization-attempts.js +33 -0
- package/dist/src/connectors/builtin-catalog.js +1 -3
- package/dist/src/connectors/catalog.js +2 -1
- package/dist/src/connectors/china-catalog.d.ts +2 -0
- package/dist/src/connectors/china-catalog.js +430 -0
- package/dist/src/connectors/composio-backends.d.ts +26 -0
- package/dist/src/connectors/composio-backends.js +65 -0
- package/dist/src/connectors/composio-catalog.js +2 -1
- package/dist/src/connectors/composio-managed-client.js +3 -1
- package/dist/src/connectors/composio-managed-events.js +5 -2
- package/dist/src/connectors/composio-session-types.d.ts +2 -0
- package/dist/src/connectors/composio-sessions.d.ts +11 -2
- package/dist/src/connectors/composio-sessions.js +137 -35
- package/dist/src/connectors/composio-triggers.js +4 -2
- package/dist/src/connectors/composio.d.ts +11 -8
- package/dist/src/connectors/composio.js +68 -84
- package/dist/src/connectors/connected-source-ingestion.js +4 -3
- package/dist/src/connectors/connection-recovery-service.js +25 -13
- package/dist/src/connectors/connector-identity.d.ts +2 -0
- package/dist/src/connectors/connector-identity.js +18 -5
- package/dist/src/connectors/content-enrichment.js +1 -1
- package/dist/src/connectors/instances.js +1 -7
- package/dist/src/connectors/learning-coordinator.js +4 -3
- package/dist/src/connectors/materialize.js +14 -1
- package/dist/src/connectors/policy.d.ts +1 -1
- package/dist/src/connectors/policy.js +1 -1
- package/dist/src/connectors/principal.js +24 -3
- package/dist/src/connectors/providers.d.ts +1 -0
- package/dist/src/connectors/providers.js +14 -2
- package/dist/src/connectors/runtime-adapter-registry.js +4 -9
- package/dist/src/connectors/secret-store.d.ts +4 -1
- package/dist/src/connectors/secret-store.js +7 -3
- package/dist/src/connectors/source-change-publisher.js +4 -2
- package/dist/src/connectors/types.d.ts +16 -11
- package/dist/src/connectors/workflow-preflight.d.ts +2 -1
- package/dist/src/connectors/workflow-preflight.js +20 -3
- package/dist/src/execution-environments/local-worktree-manager.js +17 -15
- package/dist/src/execution-environments/store.js +4 -2
- package/dist/src/execution-environments/types.d.ts +3 -0
- package/dist/src/execution-environments/types.js +2 -1
- package/dist/src/execution-environments/worktree-safety.d.ts +8 -0
- package/dist/src/execution-environments/worktree-safety.js +43 -0
- package/dist/src/extensions/activation-planner.d.ts +1 -1
- package/dist/src/extensions/activation-planner.js +1 -1
- package/dist/src/extensions/api-version.d.ts +4 -0
- package/dist/src/extensions/api-version.js +15 -0
- package/dist/src/extensions/api.d.ts +3 -9
- package/dist/src/extensions/api.js +26 -32
- package/dist/src/extensions/config-validation.d.ts +8 -0
- package/dist/src/extensions/config-validation.js +25 -0
- package/dist/src/extensions/extension-registry-impl.d.ts +20 -9
- package/dist/src/extensions/extension-registry-impl.js +79 -11
- package/dist/src/extensions/hooks.d.ts +1 -1
- package/dist/src/extensions/index.d.ts +2 -1
- package/dist/src/extensions/install-transaction.d.ts +2 -0
- package/dist/src/extensions/install-transaction.js +32 -21
- package/dist/src/extensions/install.js +18 -1
- package/dist/src/extensions/loader.d.ts +5 -5
- package/dist/src/extensions/loader.js +109 -47
- package/dist/src/extensions/lockfile.d.ts +3 -5
- package/dist/src/extensions/lockfile.js +41 -14
- package/dist/src/extensions/normalize-manifest.js +6 -60
- package/dist/src/extensions/sdk/index.d.ts +3 -2
- package/dist/src/extensions/sdk/index.js +2 -2
- package/dist/src/extensions/sdk/testing.js +0 -4
- package/dist/src/extensions/security.js +5 -7
- package/dist/src/extensions/types/core.d.ts +0 -5
- package/dist/src/extensions/types/index.d.ts +1 -1
- package/dist/src/extensions/types/manifest.d.ts +1 -25
- package/dist/src/extensions/types/providers.d.ts +1 -1
- package/dist/src/extensions/types/registration.d.ts +0 -12
- package/dist/src/extensions/update.js +71 -30
- package/dist/src/gateway/heartbeat/service.js +2 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +3 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +47 -10
- package/dist/src/gateway/hono/routes/connectors.js +208 -17
- package/dist/src/gateway/hono/routes/context-sources.js +1 -1
- package/dist/src/gateway/hono/routes/devices.js +10 -7
- package/dist/src/gateway/hono/routes/endpoint-compatibility.js +6 -0
- package/dist/src/gateway/hono/routes/extension-gateway.js +0 -33
- package/dist/src/gateway/hono/routes/home.js +4 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +0 -1
- package/dist/src/gateway/hono/routes/mcp.js +1 -1
- package/dist/src/gateway/hono/routes/realtime.js +30 -8
- package/dist/src/gateway/hono/routes/user-model.js +25 -6
- package/dist/src/gateway/index.js +4 -1
- package/dist/src/gateway/lock.d.ts +2 -0
- package/dist/src/gateway/lock.js +31 -14
- package/dist/src/gateway/run-loop.js +2 -1
- package/dist/src/gateway/security/gateway-scopes.d.ts +2 -5
- package/dist/src/gateway/security/gateway-scopes.js +3 -45
- package/dist/src/gateway/security/index.js +2 -1
- package/dist/src/gateway/service.js +11 -7
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/imports/importService.d.ts +1 -1
- package/dist/src/imports/inventory.js +16 -2
- package/dist/src/imports/productImport.js +5 -5
- package/dist/src/imports/types.d.ts +3 -3
- package/dist/src/infra/exec.d.ts +2 -2
- package/dist/src/infra/exec.js +32 -27
- package/dist/src/infra/run-command.js +15 -50
- package/dist/src/infra/update-restart.js +1 -1
- package/dist/src/knowledge/connected-knowledge-pipeline.js +13 -3
- package/dist/src/knowledge-memory/domain.d.ts +17 -1
- package/dist/src/knowledge-memory/index.js +2 -2
- package/dist/src/knowledge-memory/repository.d.ts +26 -4
- package/dist/src/knowledge-memory/repository.js +171 -36
- package/dist/src/mcp/channel-bridge.js +7 -3
- package/dist/src/media-understanding/registry.js +6 -1
- package/dist/src/migrations/knowledge-memory-read-policy-config.d.ts +2 -0
- package/dist/src/migrations/knowledge-memory-read-policy-config.js +48 -0
- package/dist/src/migrations/runner.js +2 -1
- package/dist/src/proactive/follow-ups.js +2 -1
- package/dist/src/process/bounded-output.d.ts +10 -0
- package/dist/src/process/bounded-output.js +41 -0
- package/dist/src/process/kill-tree.d.ts +6 -17
- package/dist/src/process/kill-tree.js +43 -75
- package/dist/src/process/process-spec.d.ts +39 -0
- package/dist/src/process/process-spec.js +13 -0
- package/dist/src/process/run-process.d.ts +4 -0
- package/dist/src/process/run-process.js +97 -0
- package/dist/src/providers/plugin-registry.d.ts +1 -1
- package/dist/src/providers/plugin-registry.js +6 -0
- package/dist/src/realtime/runtime.js +3 -1
- package/dist/src/session/store.js +1 -1
- package/dist/src/storage/sqlite/connection-wait-repository.d.ts +3 -0
- package/dist/src/storage/sqlite/connection-wait-repository.js +63 -2
- package/dist/src/storage/sqlite/connector-account-repository.d.ts +6 -0
- package/dist/src/storage/sqlite/connector-account-repository.js +35 -7
- package/dist/src/storage/sqlite/connector-repository.js +15 -10
- package/dist/src/storage/sqlite/connector-sync-policy-repository.js +1 -1
- package/dist/src/storage/sqlite/device-pairing-approval.js +1 -1
- package/dist/src/storage/sqlite/index.d.ts +1 -1
- package/dist/src/storage/sqlite/index.js +6 -4
- package/dist/src/storage/sqlite/migrations/180_execution_environment_ownership.sql +7 -0
- package/dist/src/storage/sqlite/migrations/181_knowledge_item_status_events.sql +12 -0
- package/dist/src/storage/sqlite/migrations/182_connector_account_policies.sql +92 -0
- package/dist/src/storage/sqlite/migrations/183_connector_backend_consistency.sql +20 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +7 -7
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +13 -0
- package/dist/src/storage/sqlite/transcript-repository.d.ts +4 -0
- package/dist/src/storage/sqlite/transcript-repository.js +36 -1
- package/dist/src/tasks/home-query-service.js +3 -3
- package/dist/src/tui/backends/embedded-backend.d.ts +24 -8
- package/dist/src/tui/backends/embedded-backend.js +114 -10
- package/dist/src/tui/backends/gateway-realtime-backend.d.ts +18 -0
- package/dist/src/tui/backends/gateway-realtime-backend.js +31 -4
- package/dist/src/tui/components/assistant-message.d.ts +4 -1
- package/dist/src/tui/components/assistant-message.js +10 -2
- package/dist/src/tui/components/cell-render-mode.d.ts +4 -0
- package/dist/src/tui/components/cell-render-mode.js +1 -0
- package/dist/src/tui/components/chat-log.d.ts +17 -4
- package/dist/src/tui/components/chat-log.js +68 -50
- package/dist/src/tui/components/custom-editor.d.ts +2 -2
- package/dist/src/tui/components/custom-editor.js +5 -1
- package/dist/src/tui/components/pending-input-preview.d.ts +9 -0
- package/dist/src/tui/components/pending-input-preview.js +33 -0
- package/dist/src/tui/components/semantic-cell.d.ts +17 -0
- package/dist/src/tui/components/semantic-cell.js +29 -0
- package/dist/src/tui/components/tool-execution.d.ts +5 -1
- package/dist/src/tui/components/tool-execution.js +33 -10
- package/dist/src/tui/components/transcript-overlay.d.ts +29 -0
- package/dist/src/tui/components/transcript-overlay.js +114 -0
- package/dist/src/tui/components/tui-bottom-bar.js +3 -1
- package/dist/src/tui/components/user-message.d.ts +5 -1
- package/dist/src/tui/components/user-message.js +12 -1
- package/dist/src/tui/extension-host/load-extensions.d.ts +1 -1
- package/dist/src/tui/extension-host/runtime-context.js +2 -1
- package/dist/src/tui/extension-host/runtime.d.ts +1 -1
- package/dist/src/tui/format-tui-hotkeys.js +8 -1
- package/dist/src/tui/tui-agent-events.js +31 -0
- package/dist/src/tui/tui-backend.d.ts +23 -11
- package/dist/src/tui/tui-backend.js +1 -9
- package/dist/src/tui/tui-chat-input-state.d.ts +25 -0
- package/dist/src/tui/tui-chat-input-state.js +36 -0
- package/dist/src/tui/tui-command-formatters.js +2 -1
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui-types.d.ts +2 -1
- package/dist/src/tui/tui-types.js +2 -1
- package/dist/src/tui/tui.js +122 -30
- package/dist/src/tui/xopc-tui-keybindings.d.ts +23 -3
- package/dist/src/tui/xopc-tui-keybindings.js +22 -2
- package/dist/src/user-context/access-policy.d.ts +2 -2
- package/dist/src/user-context/access-policy.js +10 -2
- package/dist/src/user-context/config.d.ts +23 -6
- package/dist/src/user-context/config.js +54 -7
- package/dist/src/voice/platform-streams.js +11 -1
- package/dist/src/voice/realtime/omniEngine.js +13 -1
- package/dist/src/voice/realtime/runtime.js +2 -1
- package/dist/src/voice/tts/audio.js +1 -1
- package/dist/src/voice/tts/speech-registry.js +6 -1
- package/dist/src/workflows/domain/definition.d.ts +1 -0
- package/dist/src/workflows/domain/validation.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +14 -0
- package/dist/src/workflows/service/workflow-session-bridge.d.ts +1 -0
- package/dist/src/workflows/service/workflow-session-bridge.js +1 -0
- package/package.json +5 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-4oGrNj3m.js +0 -1
- package/dist/gateway/static/root/assets/api-fPapljyb.js +0 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-CdXnNtTg.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-izNAyDhW.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-BQb3RCga.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-5vTl4x0h.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CH9prS-f.js +0 -3
- package/dist/gateway/static/root/assets/button-CGlRPNzi.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DMURlZbj.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-CFBS3Yqy.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DI1c3BMz.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-BJMBFKCh.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-BFRIn5y9.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-DFsyEJUr.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-C3TQVPRy.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-DUqVsB3X.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CLkumXdN.js +0 -1
- package/dist/gateway/static/root/assets/imports-page-DXNfRmk9.js +0 -1
- package/dist/gateway/static/root/assets/index-BLRIcVQa.css +0 -1
- package/dist/gateway/static/root/assets/index-gheM453N.js +0 -79
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-5Hcec8Xf.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-BDg1-fcw.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-BWZc5jwO.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-COa3PhMs.js +0 -1
- package/dist/gateway/static/root/assets/messages-C9h8SImu.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-D_YGzNcR.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-D1f2oI2-.js +0 -8
- package/dist/gateway/static/root/assets/project-detail-page-CRlD_Rwv.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-mmX0SavY.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Cqr3K6T5.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-CPkvbdJP.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-Cu0DAbeH.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-D8fQF1jZ.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-BgHqwTuT.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-Id4vRHzI.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BB2Fj_di.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BAwF4LpS.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-BVjw812D.js +0 -1
- package/dist/gateway/static/root/assets/theme-store-KfFEGMlp.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-Do98Xk05.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-Nv68a4ak.js +0 -2
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-1lZ_btki.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-DFOhccm3.js +0 -6
- package/dist/src/extensions/when-context.d.ts +0 -6
- package/dist/src/extensions/when-context.js +0 -26
- package/dist/src/extensions/when-expression.d.ts +0 -11
- package/dist/src/extensions/when-expression.js +0 -213
|
@@ -8,9 +8,9 @@ import { CompactionSummaryComponent } from "./compaction-summary.js";
|
|
|
8
8
|
import { CustomMessageComponent } from "./custom-message.js";
|
|
9
9
|
import { ToolExecutionComponent } from "./tool-execution.js";
|
|
10
10
|
import { UserMessageComponent } from "./user-message.js";
|
|
11
|
+
import { SemanticCellComponent } from "./semantic-cell.js";
|
|
11
12
|
import { Container, Spacer, Text } from "@earendil-works/pi-tui";
|
|
12
13
|
//#region src/tui/components/chat-log.ts
|
|
13
|
-
const MAX_COMPONENTS = 180;
|
|
14
14
|
function assistantPlainText(message) {
|
|
15
15
|
const content = message.content;
|
|
16
16
|
if (typeof content === "string") return content;
|
|
@@ -28,11 +28,12 @@ var ChatLog = class extends Container {
|
|
|
28
28
|
branchBlocks = [];
|
|
29
29
|
branchMessageBlocks = [];
|
|
30
30
|
customBlocks = [];
|
|
31
|
+
semanticCells = /* @__PURE__ */ new Map();
|
|
31
32
|
customMessageRenderers = /* @__PURE__ */ new Map();
|
|
32
33
|
assistantMessages = [];
|
|
33
|
-
|
|
34
|
+
activeAssistantByRun = /* @__PURE__ */ new Map();
|
|
34
35
|
/** After finalizeAssistant, late tool execution events can still arrive; keep the bubble to link tools. */
|
|
35
|
-
|
|
36
|
+
committedAssistantByRun = /* @__PURE__ */ new Map();
|
|
36
37
|
runsWithTools = /* @__PURE__ */ new Set();
|
|
37
38
|
toolsExpanded = false;
|
|
38
39
|
showThinking = true;
|
|
@@ -45,44 +46,22 @@ var ChatLog = class extends Container {
|
|
|
45
46
|
entryRecords = [];
|
|
46
47
|
viewportRowsProvider;
|
|
47
48
|
historyViewDisplayIndex = null;
|
|
49
|
+
renderMode = "compact";
|
|
50
|
+
activeCells = /* @__PURE__ */ new Set();
|
|
51
|
+
committedCells = /* @__PURE__ */ new Set();
|
|
48
52
|
constructor(keybindings) {
|
|
49
53
|
super();
|
|
50
54
|
this.keybindings = keybindings;
|
|
51
55
|
if (keybindings) this.toolImageOptions.keybindings = keybindings;
|
|
52
56
|
}
|
|
53
|
-
|
|
54
|
-
while (this.children.length > MAX_COMPONENTS) {
|
|
55
|
-
const oldest = this.children[0];
|
|
56
|
-
if (!oldest) return;
|
|
57
|
-
this.removeChild(oldest);
|
|
58
|
-
this.dropReferences(oldest);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
dropReferences(component) {
|
|
62
|
-
for (const [id, tool] of this.toolById.entries()) if (tool === component) this.toolById.delete(id);
|
|
63
|
-
for (const [runId, msg] of this.streamingRuns.entries()) if (msg === component) this.streamingRuns.delete(runId);
|
|
64
|
-
for (const [runId, msg] of this.assistantAnchorByRunId.entries()) if (msg === component) this.assistantAnchorByRunId.delete(runId);
|
|
65
|
-
this.bashBlocks = this.bashBlocks.filter((entry) => entry !== component);
|
|
66
|
-
this.compactionBlocks = this.compactionBlocks.filter((entry) => entry !== component);
|
|
67
|
-
this.branchBlocks = this.branchBlocks.filter((entry) => entry !== component);
|
|
68
|
-
this.branchMessageBlocks = this.branchMessageBlocks.filter((entry) => entry !== component);
|
|
69
|
-
this.customBlocks = this.customBlocks.filter((entry) => entry !== component);
|
|
70
|
-
this.assistantMessages = this.assistantMessages.filter((entry) => entry !== component);
|
|
71
|
-
if (this.lastStatusEntry === component) {
|
|
72
|
-
this.lastStatusEntry = null;
|
|
73
|
-
this.lastStatusText = null;
|
|
74
|
-
}
|
|
75
|
-
for (const [runId, status] of this.workflowStatusByRunId.entries()) if (status.entry === component) this.workflowStatusByRunId.delete(runId);
|
|
76
|
-
this.entryRecords = this.entryRecords.filter((entry) => entry.component !== component);
|
|
77
|
-
if (!this.findEntryRecord(this.historyViewDisplayIndex)) this.historyViewDisplayIndex = null;
|
|
78
|
-
}
|
|
79
|
-
append(component, meta) {
|
|
57
|
+
append(component, meta, lifecycle = "committed") {
|
|
80
58
|
this.addChild(component);
|
|
59
|
+
(lifecycle === "active" ? this.activeCells : this.committedCells).add(component);
|
|
81
60
|
if (meta) this.entryRecords.push({
|
|
82
61
|
component,
|
|
83
62
|
...meta
|
|
84
63
|
});
|
|
85
|
-
this.
|
|
64
|
+
this.applyRenderMode(component);
|
|
86
65
|
}
|
|
87
66
|
clearAll() {
|
|
88
67
|
this.clear();
|
|
@@ -92,9 +71,10 @@ var ChatLog = class extends Container {
|
|
|
92
71
|
this.branchBlocks = [];
|
|
93
72
|
this.branchMessageBlocks = [];
|
|
94
73
|
this.customBlocks = [];
|
|
74
|
+
this.semanticCells.clear();
|
|
95
75
|
this.assistantMessages = [];
|
|
96
|
-
this.
|
|
97
|
-
this.
|
|
76
|
+
this.activeAssistantByRun.clear();
|
|
77
|
+
this.committedAssistantByRun.clear();
|
|
98
78
|
this.runsWithTools.clear();
|
|
99
79
|
this.lastAssistantText = "";
|
|
100
80
|
this.lastStatusEntry = null;
|
|
@@ -102,6 +82,8 @@ var ChatLog = class extends Container {
|
|
|
102
82
|
this.workflowStatusByRunId.clear();
|
|
103
83
|
this.entryRecords = [];
|
|
104
84
|
this.historyViewDisplayIndex = null;
|
|
85
|
+
this.activeCells.clear();
|
|
86
|
+
this.committedCells.clear();
|
|
105
87
|
}
|
|
106
88
|
createAssistantMessage(message) {
|
|
107
89
|
const component = new AssistantMessageComponent(message, {
|
|
@@ -159,31 +141,42 @@ var ChatLog = class extends Container {
|
|
|
159
141
|
this.append(component);
|
|
160
142
|
}
|
|
161
143
|
addBranchMessageSummary(summary) {
|
|
162
|
-
this.
|
|
144
|
+
this.committedAssistantByRun.clear();
|
|
163
145
|
const component = new BranchMessageSummaryComponent(summary, this.keybindings);
|
|
164
146
|
component.setExpanded(this.toolsExpanded);
|
|
165
147
|
this.branchMessageBlocks.push(component);
|
|
166
148
|
this.append(component);
|
|
167
149
|
}
|
|
168
150
|
addCustomMessage(summary) {
|
|
169
|
-
this.
|
|
151
|
+
this.committedAssistantByRun.clear();
|
|
170
152
|
const component = new CustomMessageComponent(summary, this.customMessageRenderers.get(summary.customType));
|
|
171
153
|
component.setExpanded(this.toolsExpanded);
|
|
172
154
|
this.customBlocks.push(component);
|
|
173
155
|
this.append(component);
|
|
174
156
|
}
|
|
157
|
+
upsertSemanticCell(id, data) {
|
|
158
|
+
const existing = this.semanticCells.get(id);
|
|
159
|
+
if (existing) {
|
|
160
|
+
existing.update(data);
|
|
161
|
+
existing.invalidate();
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const component = new SemanticCellComponent(data);
|
|
165
|
+
this.semanticCells.set(id, component);
|
|
166
|
+
this.append(component);
|
|
167
|
+
}
|
|
175
168
|
setCustomMessageRenderer(customType, renderer) {
|
|
176
169
|
if (renderer) this.customMessageRenderers.set(customType, renderer);
|
|
177
170
|
else this.customMessageRenderers.delete(customType);
|
|
178
171
|
for (const block of this.customBlocks) if (block.matchesCustomType(customType)) block.setRenderer(renderer);
|
|
179
172
|
}
|
|
180
173
|
addUser(text, meta) {
|
|
181
|
-
this.
|
|
174
|
+
this.committedAssistantByRun.clear();
|
|
182
175
|
this.append(new UserMessageComponent(text), meta);
|
|
183
176
|
}
|
|
184
177
|
/** Stream local `!command` output in a bordered block. */
|
|
185
178
|
addBashExecution(command, ui, excludeFromContext) {
|
|
186
|
-
this.
|
|
179
|
+
this.committedAssistantByRun.clear();
|
|
187
180
|
const component = new BashExecutionComponent(command, ui, excludeFromContext, this.keybindings);
|
|
188
181
|
component.setExpanded(this.toolsExpanded);
|
|
189
182
|
this.bashBlocks.push(component);
|
|
@@ -192,7 +185,7 @@ var ChatLog = class extends Container {
|
|
|
192
185
|
}
|
|
193
186
|
/** Replay a completed shell execution from persisted transcript history. */
|
|
194
187
|
addBashSummary(summary) {
|
|
195
|
-
this.
|
|
188
|
+
this.committedAssistantByRun.clear();
|
|
196
189
|
const component = new BashSummaryComponent(summary, this.keybindings);
|
|
197
190
|
component.setExpanded(this.toolsExpanded);
|
|
198
191
|
this.bashBlocks.push(component);
|
|
@@ -201,7 +194,7 @@ var ChatLog = class extends Container {
|
|
|
201
194
|
startAssistant(message, runId) {
|
|
202
195
|
const text = assistantPlainText(message);
|
|
203
196
|
if (text.trim()) this.lastAssistantText = text;
|
|
204
|
-
const existing = this.
|
|
197
|
+
const existing = this.activeAssistantByRun.get(runId);
|
|
205
198
|
if (existing) {
|
|
206
199
|
existing.updateContent(message);
|
|
207
200
|
existing.setHasToolCalls(this.runsWithTools.has(runId));
|
|
@@ -209,13 +202,13 @@ var ChatLog = class extends Container {
|
|
|
209
202
|
}
|
|
210
203
|
const component = this.createAssistantMessage(message);
|
|
211
204
|
component.setHasToolCalls(this.runsWithTools.has(runId));
|
|
212
|
-
this.
|
|
213
|
-
this.append(component);
|
|
205
|
+
this.activeAssistantByRun.set(runId, component);
|
|
206
|
+
this.append(component, void 0, "active");
|
|
214
207
|
}
|
|
215
208
|
updateAssistant(message, runId) {
|
|
216
209
|
const text = assistantPlainText(message);
|
|
217
210
|
if (text.trim()) this.lastAssistantText = text;
|
|
218
|
-
const existing = this.
|
|
211
|
+
const existing = this.activeAssistantByRun.get(runId);
|
|
219
212
|
if (!existing) {
|
|
220
213
|
this.startAssistant(message, runId);
|
|
221
214
|
return;
|
|
@@ -226,24 +219,26 @@ var ChatLog = class extends Container {
|
|
|
226
219
|
finalizeAssistant(message, runId, meta) {
|
|
227
220
|
const text = assistantPlainText(message);
|
|
228
221
|
if (text.trim()) this.lastAssistantText = text;
|
|
229
|
-
const existing = this.
|
|
222
|
+
const existing = this.activeAssistantByRun.get(runId);
|
|
230
223
|
if (existing) {
|
|
231
224
|
existing.updateContent(message);
|
|
232
225
|
existing.setHasToolCalls(this.runsWithTools.has(runId));
|
|
233
|
-
this.
|
|
234
|
-
this.
|
|
226
|
+
this.activeAssistantByRun.delete(runId);
|
|
227
|
+
this.committedAssistantByRun.set(runId, existing);
|
|
228
|
+
this.commitCell(existing);
|
|
235
229
|
return;
|
|
236
230
|
}
|
|
237
231
|
const finalMessage = this.createAssistantMessage(message);
|
|
238
232
|
finalMessage.setHasToolCalls(this.runsWithTools.has(runId));
|
|
239
233
|
this.append(finalMessage, meta);
|
|
240
|
-
if (text.trim()) this.
|
|
234
|
+
if (text.trim()) this.committedAssistantByRun.set(runId, finalMessage);
|
|
241
235
|
}
|
|
242
236
|
dropAssistant(runId) {
|
|
243
|
-
const existing = this.
|
|
237
|
+
const existing = this.activeAssistantByRun.get(runId);
|
|
244
238
|
if (!existing) return;
|
|
245
239
|
this.removeChild(existing);
|
|
246
|
-
this.
|
|
240
|
+
this.activeAssistantByRun.delete(runId);
|
|
241
|
+
this.activeCells.delete(existing);
|
|
247
242
|
}
|
|
248
243
|
startTool(toolCallId, toolName, args, runId) {
|
|
249
244
|
const existing = this.toolById.get(toolCallId);
|
|
@@ -255,8 +250,8 @@ var ChatLog = class extends Container {
|
|
|
255
250
|
const component = new ToolExecutionComponent(toolName, toolCallId, args, { ...this.toolImageOptions });
|
|
256
251
|
component.setExpanded(this.toolsExpanded);
|
|
257
252
|
this.toolById.set(toolCallId, component);
|
|
258
|
-
(this.
|
|
259
|
-
this.append(component);
|
|
253
|
+
(this.activeAssistantByRun.get(runId) ?? this.committedAssistantByRun.get(runId))?.setHasToolCalls(true);
|
|
254
|
+
this.append(component, void 0, "active");
|
|
260
255
|
}
|
|
261
256
|
markToolExecutionStarted(toolCallId) {
|
|
262
257
|
const existing = this.toolById.get(toolCallId);
|
|
@@ -272,6 +267,7 @@ var ChatLog = class extends Container {
|
|
|
272
267
|
const existing = this.toolById.get(toolCallId);
|
|
273
268
|
if (!existing) return;
|
|
274
269
|
existing.updateResult(result, isPartial, isError);
|
|
270
|
+
if (!isPartial) this.commitCell(existing);
|
|
275
271
|
}
|
|
276
272
|
updateToolDetails(toolCallId, details) {
|
|
277
273
|
const existing = this.toolById.get(toolCallId);
|
|
@@ -307,6 +303,28 @@ var ChatLog = class extends Container {
|
|
|
307
303
|
};
|
|
308
304
|
for (const tool of this.toolById.values()) tool.setImageOptions(this.toolImageOptions);
|
|
309
305
|
}
|
|
306
|
+
setRenderMode(mode) {
|
|
307
|
+
if (this.renderMode === mode) return;
|
|
308
|
+
this.renderMode = mode;
|
|
309
|
+
for (const child of this.children) this.applyRenderMode(child);
|
|
310
|
+
this.invalidate();
|
|
311
|
+
}
|
|
312
|
+
getRenderMode() {
|
|
313
|
+
return this.renderMode;
|
|
314
|
+
}
|
|
315
|
+
applyRenderMode(component) {
|
|
316
|
+
component.setRenderMode?.(this.renderMode);
|
|
317
|
+
}
|
|
318
|
+
getCellLifecycleCounts() {
|
|
319
|
+
return {
|
|
320
|
+
active: this.activeCells.size,
|
|
321
|
+
committed: this.committedCells.size
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
commitCell(component) {
|
|
325
|
+
if (!this.activeCells.delete(component)) return;
|
|
326
|
+
this.committedCells.add(component);
|
|
327
|
+
}
|
|
310
328
|
getLastAssistantText() {
|
|
311
329
|
return this.lastAssistantText;
|
|
312
330
|
}
|
|
@@ -5,14 +5,14 @@ import type { XopcTuiAppKeybinding } from '../xopc-tui-keybindings.js';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare class CustomEditor extends Editor {
|
|
7
7
|
private readonly keybindings;
|
|
8
|
-
readonly actionHandlers: Map<XopcTuiAppKeybinding, () => void>;
|
|
8
|
+
readonly actionHandlers: Map<XopcTuiAppKeybinding, () => boolean | void>;
|
|
9
9
|
onEscape?: () => void;
|
|
10
10
|
onCtrlD?: () => void;
|
|
11
11
|
onCtrlC?: () => void;
|
|
12
12
|
onPasteImage?: () => void;
|
|
13
13
|
onExtensionShortcut?: (data: string) => boolean;
|
|
14
14
|
constructor(tui: TUI, theme: EditorTheme, keybindings: KeybindingsManager, options?: EditorOptions);
|
|
15
|
-
onAction(action: XopcTuiAppKeybinding, handler: () => void): void;
|
|
15
|
+
onAction(action: XopcTuiAppKeybinding, handler: () => boolean | void): void;
|
|
16
16
|
replaceHistory(itemsNewestFirst: string[]): void;
|
|
17
17
|
handleInput(data: string): void;
|
|
18
18
|
}
|
|
@@ -51,7 +51,11 @@ var CustomEditor = class extends Editor {
|
|
|
51
51
|
for (const [action, handler] of this.actionHandlers) {
|
|
52
52
|
if (action === "app.interrupt" || action === "app.exit") continue;
|
|
53
53
|
if (this.keybindings.matches(data, action)) {
|
|
54
|
-
(action === "app.
|
|
54
|
+
if (action === "app.message.followUp" && this.isShowingAutocomplete()) {
|
|
55
|
+
super.handleInput(data);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if ((action === "app.clear" ? this.onCtrlC ?? handler : handler)() === false) super.handleInput(data);
|
|
55
59
|
return;
|
|
56
60
|
}
|
|
57
61
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Component, KeybindingsManager } from '@earendil-works/pi-tui';
|
|
2
|
+
import { type TuiChatInputState } from '../tui-chat-input-state.js';
|
|
3
|
+
export declare class PendingInputPreview implements Component {
|
|
4
|
+
private readonly getState;
|
|
5
|
+
private readonly keybindings;
|
|
6
|
+
constructor(getState: () => TuiChatInputState, keybindings: KeybindingsManager);
|
|
7
|
+
invalidate(): void;
|
|
8
|
+
render(width: number): string[];
|
|
9
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { theme } from "../theme.js";
|
|
2
|
+
import { formatKeyIds } from "../format-tui-hotkeys.js";
|
|
3
|
+
import { findLastEditableChatInput, isPendingChatInput } from "../tui-chat-input-state.js";
|
|
4
|
+
import { sanitizeStatusText } from "./tui-bottom-bar.js";
|
|
5
|
+
import { truncateToWidth } from "@earendil-works/pi-tui";
|
|
6
|
+
//#region src/tui/components/pending-input-preview.ts
|
|
7
|
+
function labelForInput(input) {
|
|
8
|
+
if (input.status === "injecting") return "Steering";
|
|
9
|
+
if (input.requestedDelivery === "steer" && input.effectiveDelivery === "next") return "Deferred steer";
|
|
10
|
+
if (input.status === "interrupted") return "Interrupted";
|
|
11
|
+
return "Follow-up";
|
|
12
|
+
}
|
|
13
|
+
var PendingInputPreview = class {
|
|
14
|
+
constructor(getState, keybindings) {
|
|
15
|
+
this.getState = getState;
|
|
16
|
+
this.keybindings = keybindings;
|
|
17
|
+
}
|
|
18
|
+
invalidate() {}
|
|
19
|
+
render(width) {
|
|
20
|
+
const state = this.getState();
|
|
21
|
+
const inputs = state.inputs.filter(isPendingChatInput);
|
|
22
|
+
if (inputs.length === 0) return [];
|
|
23
|
+
const actions = findLastEditableChatInput(state) ? ` · ${formatKeyIds(this.keybindings, "app.message.editQueued", { capitalize: true })} edit last · ${formatKeyIds(this.keybindings, "app.message.deleteQueued", { capitalize: true })} remove last` : "";
|
|
24
|
+
const lines = [truncateToWidth(theme.dim(`Pending inputs (${inputs.length})${actions}`), width, theme.dim("…"))];
|
|
25
|
+
for (const input of inputs) {
|
|
26
|
+
const content = sanitizeStatusText(input.content) || "(empty)";
|
|
27
|
+
lines.push(truncateToWidth(theme.dim(` ${labelForInput(input)}: ${content}`), width, theme.dim("…")));
|
|
28
|
+
}
|
|
29
|
+
return lines;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { PendingInputPreview };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Container } from '@earendil-works/pi-tui';
|
|
2
|
+
import type { CellRenderMode, ModeAwareCell } from './cell-render-mode.js';
|
|
3
|
+
export type SemanticCellKind = 'plan' | 'web' | 'approval' | 'question' | 'mcp';
|
|
4
|
+
export interface SemanticCellData {
|
|
5
|
+
kind: SemanticCellKind;
|
|
6
|
+
title: string;
|
|
7
|
+
lines?: string[];
|
|
8
|
+
raw?: unknown;
|
|
9
|
+
}
|
|
10
|
+
export declare class SemanticCellComponent extends Container implements ModeAwareCell {
|
|
11
|
+
private data;
|
|
12
|
+
private renderMode;
|
|
13
|
+
constructor(data: SemanticCellData);
|
|
14
|
+
update(data: SemanticCellData): void;
|
|
15
|
+
setRenderMode(mode: CellRenderMode): void;
|
|
16
|
+
render(width: number): string[];
|
|
17
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { theme } from "../theme.js";
|
|
2
|
+
import { Container, Spacer, Text } from "@earendil-works/pi-tui";
|
|
3
|
+
//#region src/tui/components/semantic-cell.ts
|
|
4
|
+
var SemanticCellComponent = class extends Container {
|
|
5
|
+
renderMode = "compact";
|
|
6
|
+
constructor(data) {
|
|
7
|
+
super();
|
|
8
|
+
this.data = data;
|
|
9
|
+
}
|
|
10
|
+
update(data) {
|
|
11
|
+
this.data = data;
|
|
12
|
+
}
|
|
13
|
+
setRenderMode(mode) {
|
|
14
|
+
this.renderMode = mode;
|
|
15
|
+
}
|
|
16
|
+
render(width) {
|
|
17
|
+
if (this.renderMode === "raw") return new Text(JSON.stringify(this.data.raw ?? this.data, null, 2), 0, 0).render(width);
|
|
18
|
+
const body = new Container();
|
|
19
|
+
body.addChild(new Spacer(1));
|
|
20
|
+
body.addChild(new Text(theme.bold(theme.accent(`${this.data.kind.toUpperCase()} · ${this.data.title}`)), 1, 0));
|
|
21
|
+
const lines = this.data.lines ?? [];
|
|
22
|
+
const visible = this.renderMode === "compact" ? lines.slice(0, 4) : lines;
|
|
23
|
+
for (const line of visible) body.addChild(new Text(theme.dim(line), 3, 0));
|
|
24
|
+
if (visible.length < lines.length) body.addChild(new Text(theme.dim(`… ${lines.length - visible.length} more`), 3, 0));
|
|
25
|
+
return body.render(width);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
29
|
+
export { SemanticCellComponent };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Container, type KeybindingsManager } from '@earendil-works/pi-tui';
|
|
2
2
|
import type { AgentToolResult } from '@earendil-works/pi-agent-core';
|
|
3
3
|
import { type TuiToolContentBlock } from '../tui-tool-result.js';
|
|
4
|
+
import type { CellRenderMode, ModeAwareCell } from './cell-render-mode.js';
|
|
4
5
|
export interface ToolExecutionOptions {
|
|
5
6
|
showImages?: boolean;
|
|
6
7
|
imageWidthCells?: number;
|
|
@@ -12,7 +13,7 @@ export declare function getToolResultDisplayText(content: TuiToolContentBlock[],
|
|
|
12
13
|
showImages: boolean;
|
|
13
14
|
supportsInlineImages: boolean;
|
|
14
15
|
}): string;
|
|
15
|
-
export declare class ToolExecutionComponent extends Container {
|
|
16
|
+
export declare class ToolExecutionComponent extends Container implements ModeAwareCell {
|
|
16
17
|
private contentContainer;
|
|
17
18
|
private contentText;
|
|
18
19
|
private collapsedOutputComponent;
|
|
@@ -45,11 +46,14 @@ export declare class ToolExecutionComponent extends Container {
|
|
|
45
46
|
private executionStarted;
|
|
46
47
|
private startedAt;
|
|
47
48
|
private completedAt;
|
|
49
|
+
private renderMode;
|
|
48
50
|
constructor(toolName: string, toolCallId: string, args: unknown, options?: ToolExecutionOptions);
|
|
49
51
|
setArgs(args: unknown): void;
|
|
50
52
|
markExecutionStarted(): void;
|
|
51
53
|
setArgsComplete(): void;
|
|
52
54
|
setExpanded(expanded: boolean): void;
|
|
55
|
+
setRenderMode(mode: CellRenderMode): void;
|
|
56
|
+
render(width: number): string[];
|
|
53
57
|
updateResult(result: AgentToolResult<any> | unknown, isPartial?: boolean, isError?: boolean): void;
|
|
54
58
|
setImageOptions(options: ToolExecutionOptions): void;
|
|
55
59
|
setPartialDetails(details: unknown): void;
|
|
@@ -15,6 +15,10 @@ function sanitize(text) {
|
|
|
15
15
|
function trimTrailingBlankDisplayLines(text) {
|
|
16
16
|
return text.replace(/(?:\r?\n[ \t]*)+$/g, "");
|
|
17
17
|
}
|
|
18
|
+
function semanticToolLabel(toolName) {
|
|
19
|
+
if (toolName === "web_search" || toolName === "web_fetch" || toolName === "web_extract") return "WEB";
|
|
20
|
+
if (toolName.startsWith("mcp:") || toolName.includes("__")) return "MCP";
|
|
21
|
+
}
|
|
18
22
|
function getToolResultDisplayText(content, options) {
|
|
19
23
|
const parts = [];
|
|
20
24
|
for (const block of content) {
|
|
@@ -66,6 +70,7 @@ var ToolExecutionComponent = class extends Container {
|
|
|
66
70
|
executionStarted = false;
|
|
67
71
|
startedAt = Date.now();
|
|
68
72
|
completedAt;
|
|
73
|
+
renderMode = "compact";
|
|
69
74
|
constructor(toolName, toolCallId, args, options = {}) {
|
|
70
75
|
super();
|
|
71
76
|
this.toolName = toolName;
|
|
@@ -100,6 +105,24 @@ var ToolExecutionComponent = class extends Container {
|
|
|
100
105
|
this.expanded = expanded;
|
|
101
106
|
this.refresh();
|
|
102
107
|
}
|
|
108
|
+
setRenderMode(mode) {
|
|
109
|
+
if (this.renderMode === mode) return;
|
|
110
|
+
this.renderMode = mode;
|
|
111
|
+
this.refresh();
|
|
112
|
+
}
|
|
113
|
+
render(width) {
|
|
114
|
+
if (this.renderMode === "raw") return new Text(JSON.stringify({
|
|
115
|
+
type: "tool",
|
|
116
|
+
toolName: this.toolName,
|
|
117
|
+
toolCallId: this.toolCallId,
|
|
118
|
+
args: this.args,
|
|
119
|
+
result: this.resultContent ?? this.resultText,
|
|
120
|
+
details: this.resultDetails,
|
|
121
|
+
isError: this.isError,
|
|
122
|
+
isPartial: this.isPartial
|
|
123
|
+
}, null, 2), 0, 0).render(width);
|
|
124
|
+
return super.render(width);
|
|
125
|
+
}
|
|
103
126
|
updateResult(result, isPartial = false, isError = false) {
|
|
104
127
|
const parsed = parseTuiToolResult(result);
|
|
105
128
|
this.resultText = sanitize(parsed.text);
|
|
@@ -231,13 +254,13 @@ var ToolExecutionComponent = class extends Container {
|
|
|
231
254
|
argsComplete: this.argsComplete,
|
|
232
255
|
isError: this.isError,
|
|
233
256
|
isPartial: this.isPartial,
|
|
234
|
-
expanded: this.expanded,
|
|
257
|
+
expanded: this.renderMode === "transcript" || this.expanded,
|
|
235
258
|
showImages: this.showImages
|
|
236
259
|
};
|
|
237
260
|
}
|
|
238
261
|
formatToolCallFallback() {
|
|
239
262
|
const argsStr = formatArgsSummary(this.args, this.toolName);
|
|
240
|
-
const titleParts = [theme.dim(this.toolStatusLabel()), theme.toolTitle(theme.bold(displayToolName(this.toolName)))];
|
|
263
|
+
const titleParts = [theme.dim(this.toolStatusLabel()), theme.toolTitle(theme.bold([semanticToolLabel(this.toolName), displayToolName(this.toolName)].filter(Boolean).join(" · ")))];
|
|
241
264
|
if (argsStr) titleParts.push(theme.dim(`(${argsStr})`));
|
|
242
265
|
const duration = this.toolDurationLabel();
|
|
243
266
|
if (duration) titleParts.push(theme.dim(duration));
|
|
@@ -251,9 +274,9 @@ var ToolExecutionComponent = class extends Container {
|
|
|
251
274
|
const expandKey = this.keybindings ? formatKeyIds(this.keybindings, "app.tools.expand", { capitalize: true }) : "Ctrl+O";
|
|
252
275
|
const lineCount = output.split("\n").length;
|
|
253
276
|
const useDiff = isDiffFriendlyTool(this.toolName) && looksLikeUnifiedDiff(output);
|
|
254
|
-
if (this.expanded && useDiff) text += renderPatchSummary(output) ?? renderUnifiedDiff(output);
|
|
255
|
-
else if (this.expanded && isExecStyleTool(this.toolName)) this.refreshExpandedOutput(theme.toolOutput(formatExecExpandedOutput(output, this.resultDetails)));
|
|
256
|
-
else if (this.expanded) this.refreshExpandedOutput(theme.toolOutput(output));
|
|
277
|
+
if ((this.renderMode === "transcript" || this.expanded) && useDiff) text += renderPatchSummary(output) ?? renderUnifiedDiff(output);
|
|
278
|
+
else if ((this.renderMode === "transcript" || this.expanded) && isExecStyleTool(this.toolName)) this.refreshExpandedOutput(theme.toolOutput(formatExecExpandedOutput(output, this.resultDetails)));
|
|
279
|
+
else if (this.renderMode === "transcript" || this.expanded) this.refreshExpandedOutput(theme.toolOutput(output));
|
|
257
280
|
else if (useDiff) text += theme.dim("preview");
|
|
258
281
|
else if (getToolSummaryKind(this.toolName) !== "generic") text += this.collapsedSpecializedSummary(output, expandKey);
|
|
259
282
|
else {
|
|
@@ -269,7 +292,7 @@ var ToolExecutionComponent = class extends Container {
|
|
|
269
292
|
}
|
|
270
293
|
formatToolExecution() {
|
|
271
294
|
const argsStr = formatArgsSummary(this.args, this.toolName);
|
|
272
|
-
const titleParts = [theme.dim(this.toolStatusLabel()), theme.toolTitle(theme.bold(displayToolName(this.toolName)))];
|
|
295
|
+
const titleParts = [theme.dim(this.toolStatusLabel()), theme.toolTitle(theme.bold([semanticToolLabel(this.toolName), displayToolName(this.toolName)].filter(Boolean).join(" · ")))];
|
|
273
296
|
if (argsStr) titleParts.push(theme.dim(`(${argsStr})`));
|
|
274
297
|
const duration = this.toolDurationLabel();
|
|
275
298
|
if (duration) titleParts.push(theme.dim(duration));
|
|
@@ -279,9 +302,9 @@ var ToolExecutionComponent = class extends Container {
|
|
|
279
302
|
const expandKey = this.keybindings ? formatKeyIds(this.keybindings, "app.tools.expand", { capitalize: true }) : "Ctrl+O";
|
|
280
303
|
const lineCount = output.split("\n").length;
|
|
281
304
|
const useDiff = isDiffFriendlyTool(this.toolName) && looksLikeUnifiedDiff(output);
|
|
282
|
-
if (this.expanded && useDiff) text += `\n${renderPatchSummary(output) ?? renderUnifiedDiff(output)}`;
|
|
283
|
-
else if (this.expanded && isExecStyleTool(this.toolName)) this.refreshExpandedOutput(theme.toolOutput(formatExecExpandedOutput(output, this.resultDetails)));
|
|
284
|
-
else if (this.expanded) this.refreshExpandedOutput(theme.toolOutput(output));
|
|
305
|
+
if ((this.renderMode === "transcript" || this.expanded) && useDiff) text += `\n${renderPatchSummary(output) ?? renderUnifiedDiff(output)}`;
|
|
306
|
+
else if ((this.renderMode === "transcript" || this.expanded) && isExecStyleTool(this.toolName)) this.refreshExpandedOutput(theme.toolOutput(formatExecExpandedOutput(output, this.resultDetails)));
|
|
307
|
+
else if (this.renderMode === "transcript" || this.expanded) this.refreshExpandedOutput(theme.toolOutput(output));
|
|
285
308
|
else if (useDiff) {
|
|
286
309
|
const suffix = output.split("\n").length > COLLAPSED_RESULT_VISUAL_LINES ? theme.dim(` (${output.split("\n").length} lines; ${expandKey} to expand)`) : "";
|
|
287
310
|
text += `\n${theme.dim(`preview${suffix}`)}`;
|
|
@@ -323,7 +346,7 @@ var ToolExecutionComponent = class extends Container {
|
|
|
323
346
|
}));
|
|
324
347
|
}
|
|
325
348
|
shouldRenderDetailsPreview() {
|
|
326
|
-
return this.expanded && this.resultDetails !== void 0 && !isExecStyleTool(this.toolName);
|
|
349
|
+
return (this.renderMode === "transcript" || this.expanded) && this.resultDetails !== void 0 && !isExecStyleTool(this.toolName);
|
|
327
350
|
}
|
|
328
351
|
getDisplayResultText() {
|
|
329
352
|
if (!this.resultContent) return trimTrailingBlankDisplayLines(this.resultText);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Container, type Focusable, type KeybindingsManager } from '@earendil-works/pi-tui';
|
|
2
|
+
import type { TuiHistoryWindow } from '../tui-backend.js';
|
|
3
|
+
import type { CellRenderMode } from './cell-render-mode.js';
|
|
4
|
+
export interface TranscriptOverlayOptions {
|
|
5
|
+
keybindings: KeybindingsManager;
|
|
6
|
+
loadWindow: (rowNumber: number) => Promise<TuiHistoryWindow>;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
onRender: () => void;
|
|
9
|
+
viewportRows: () => number;
|
|
10
|
+
initialMode?: Exclude<CellRenderMode, 'compact'>;
|
|
11
|
+
}
|
|
12
|
+
export declare class TranscriptOverlay extends Container implements Focusable {
|
|
13
|
+
private readonly options;
|
|
14
|
+
private readonly log;
|
|
15
|
+
private messages;
|
|
16
|
+
private startRowNumber;
|
|
17
|
+
private totalRows;
|
|
18
|
+
private scrollOffset;
|
|
19
|
+
private loading;
|
|
20
|
+
private mode;
|
|
21
|
+
private _focused;
|
|
22
|
+
constructor(options: TranscriptOverlayOptions);
|
|
23
|
+
get focused(): boolean;
|
|
24
|
+
set focused(value: boolean);
|
|
25
|
+
initialize(): Promise<void>;
|
|
26
|
+
handleInput(data: string): void;
|
|
27
|
+
render(width: number): string[];
|
|
28
|
+
private loadPage;
|
|
29
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { theme } from "../theme.js";
|
|
2
|
+
import { appendHistoryToChatLog } from "../chat-history.js";
|
|
3
|
+
import { ChatLog } from "./chat-log.js";
|
|
4
|
+
import { Container } from "@earendil-works/pi-tui";
|
|
5
|
+
//#region src/tui/components/transcript-overlay.ts
|
|
6
|
+
var TranscriptOverlay = class extends Container {
|
|
7
|
+
log;
|
|
8
|
+
messages = [];
|
|
9
|
+
startRowNumber = 0;
|
|
10
|
+
totalRows = 0;
|
|
11
|
+
scrollOffset = 0;
|
|
12
|
+
loading = false;
|
|
13
|
+
mode;
|
|
14
|
+
_focused = false;
|
|
15
|
+
constructor(options) {
|
|
16
|
+
super();
|
|
17
|
+
this.options = options;
|
|
18
|
+
this.mode = options.initialMode ?? "transcript";
|
|
19
|
+
this.log = new ChatLog(options.keybindings);
|
|
20
|
+
this.log.setRenderMode(this.mode);
|
|
21
|
+
}
|
|
22
|
+
get focused() {
|
|
23
|
+
return this._focused;
|
|
24
|
+
}
|
|
25
|
+
set focused(value) {
|
|
26
|
+
this._focused = value;
|
|
27
|
+
}
|
|
28
|
+
async initialize() {
|
|
29
|
+
await this.loadPage(Number.MAX_SAFE_INTEGER, false);
|
|
30
|
+
}
|
|
31
|
+
handleInput(data) {
|
|
32
|
+
if (this.options.keybindings.matches(data, "tui.select.cancel") || data === "\x1B") {
|
|
33
|
+
this.options.onClose();
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (this.options.keybindings.matches(data, "app.transcript.open")) {
|
|
37
|
+
this.options.onClose();
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (this.options.keybindings.matches(data, "app.transcript.raw")) {
|
|
41
|
+
this.mode = this.mode === "raw" ? "transcript" : "raw";
|
|
42
|
+
this.log.setRenderMode(this.mode);
|
|
43
|
+
this.options.onRender();
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const page = Math.max(4, this.options.viewportRows() - 5);
|
|
47
|
+
if (data === "\x1B[5~") {
|
|
48
|
+
this.scrollOffset += page;
|
|
49
|
+
if (this.startRowNumber > 1) this.loadPage(this.startRowNumber - 1, true);
|
|
50
|
+
this.options.onRender();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (data === "\x1B[6~") {
|
|
54
|
+
this.scrollOffset = Math.max(0, this.scrollOffset - page);
|
|
55
|
+
this.options.onRender();
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (this.options.keybindings.matches(data, "tui.select.up")) {
|
|
59
|
+
this.scrollOffset++;
|
|
60
|
+
this.options.onRender();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (this.options.keybindings.matches(data, "tui.select.down")) {
|
|
64
|
+
this.scrollOffset = Math.max(0, this.scrollOffset - 1);
|
|
65
|
+
this.options.onRender();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
render(width) {
|
|
69
|
+
const viewportRows = Math.max(6, this.options.viewportRows() - 3);
|
|
70
|
+
const content = this.log.render(width);
|
|
71
|
+
this.scrollOffset = Math.min(this.scrollOffset, Math.max(0, content.length - viewportRows));
|
|
72
|
+
const end = Math.max(0, content.length - this.scrollOffset);
|
|
73
|
+
const start = Math.max(0, end - viewportRows);
|
|
74
|
+
const position = this.totalRows > 0 ? `${this.startRowNumber}-${this.totalRows}` : "empty";
|
|
75
|
+
return [
|
|
76
|
+
theme.bold(theme.accent(`Transcript · ${this.mode} · rows ${position}`)),
|
|
77
|
+
theme.dim("↑/↓ scroll · PgUp/PgDn page · Alt+R raw · Ctrl+T/Esc close"),
|
|
78
|
+
...this.loading ? [theme.dim("Loading SQLite transcript…")] : [],
|
|
79
|
+
...content.slice(start, end)
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
async loadPage(rowNumber, prepend) {
|
|
83
|
+
if (this.loading) return;
|
|
84
|
+
this.loading = true;
|
|
85
|
+
this.options.onRender();
|
|
86
|
+
try {
|
|
87
|
+
const page = await this.options.loadWindow(rowNumber);
|
|
88
|
+
const merged = prepend ? [...page.messages, ...this.messages] : page.messages;
|
|
89
|
+
const seen = /* @__PURE__ */ new Set();
|
|
90
|
+
this.messages = merged.filter((message) => {
|
|
91
|
+
const key = message.id ? `id:${message.id}` : JSON.stringify([
|
|
92
|
+
message.kind,
|
|
93
|
+
message.role,
|
|
94
|
+
message.timestamp,
|
|
95
|
+
message.content
|
|
96
|
+
]);
|
|
97
|
+
if (seen.has(key)) return false;
|
|
98
|
+
seen.add(key);
|
|
99
|
+
return true;
|
|
100
|
+
});
|
|
101
|
+
this.startRowNumber = page.startRowNumber;
|
|
102
|
+
this.totalRows = page.totalRows;
|
|
103
|
+
this.log.clearAll();
|
|
104
|
+
appendHistoryToChatLog(this.log, this.messages, true, true);
|
|
105
|
+
this.log.setRenderMode(this.mode);
|
|
106
|
+
if (prepend) this.scrollOffset = Number.MAX_SAFE_INTEGER;
|
|
107
|
+
} finally {
|
|
108
|
+
this.loading = false;
|
|
109
|
+
this.options.onRender();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
//#endregion
|
|
114
|
+
export { TranscriptOverlay };
|