@zyro-sec/app 0.0.0-stage → 1.0.1
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/AGENTS.md +234 -0
- package/README.md +106 -2
- package/bunfig.toml +3 -0
- package/component-tests/activity-chips.spec.ts +47 -0
- package/component-tests/browser-pane-restore.spec.ts +1294 -0
- package/component-tests/browser-pane.spec.ts +2338 -0
- package/component-tests/browser-settings.spec.ts +315 -0
- package/component-tests/browser-site-chooser.spec.ts +628 -0
- package/component-tests/components-lab.spec.ts +24 -0
- package/component-tests/composer.spec.ts +876 -0
- package/component-tests/debug-bar.spec.ts +237 -0
- package/component-tests/dialog-popups.spec.ts +49 -0
- package/component-tests/file-icon.spec.ts +14 -0
- package/component-tests/focus-rescue.fixture.tsx +30 -0
- package/component-tests/focus-rescue.spec.ts +83 -0
- package/component-tests/focus-ring.spec.ts +112 -0
- package/component-tests/fork-dialog.spec.ts +61 -0
- package/component-tests/grow.fixture.tsx +42 -0
- package/component-tests/grow.spec.ts +74 -0
- package/component-tests/image-preview.spec.ts +157 -0
- package/component-tests/input-surfaces.spec.ts +351 -0
- package/component-tests/line-comment.spec.ts +118 -0
- package/component-tests/list.spec.ts +7 -0
- package/component-tests/model-picker.spec.ts +45 -0
- package/component-tests/new-session-wordmark.spec.ts +135 -0
- package/component-tests/open-in-border.spec.ts +18 -0
- package/component-tests/pairing.spec.ts +40 -0
- package/component-tests/panel-sidebar-side.spec.ts +103 -0
- package/component-tests/plugin-graph.spec.ts +61 -0
- package/component-tests/plugin-host.fixture.tsx +995 -0
- package/component-tests/plugin-host.spec.ts +2362 -0
- package/component-tests/presence.fixture.tsx +59 -0
- package/component-tests/presence.spec.ts +104 -0
- package/component-tests/session-containment.fixture.tsx +79 -0
- package/component-tests/session-containment.spec.ts +145 -0
- package/component-tests/session-location-missing.spec.ts +52 -0
- package/component-tests/session-question-dock.spec.ts +1655 -0
- package/component-tests/sources-experiment.spec.ts +98 -0
- package/component-tests/ssh-reconnect.spec.ts +97 -0
- package/component-tests/subagent-bar.spec.ts +29 -0
- package/component-tests/terminal.spec.ts +148 -0
- package/component-tests/timeline-detail.spec.ts +311 -0
- package/component-tests/timeline-virtualizer.fixture.tsx +272 -0
- package/component-tests/timeline-virtualizer.spec.ts +269 -0
- package/component-tests/toast.spec.ts +23 -0
- package/component-tests/tooltip.spec.ts +169 -0
- package/component-tests/websearch.spec.ts +86 -0
- package/e2e/AGENTS.md +25 -0
- package/e2e/QUARANTINE.md +12 -0
- package/e2e/regression/background-read-failure.spec.ts +43 -0
- package/e2e/regression/btw-sidebar.spec.ts +339 -0
- package/e2e/regression/command-palette.spec.ts +822 -0
- package/e2e/regression/composer.spec.ts +1727 -0
- package/e2e/regression/directory-picker.spec.ts +133 -0
- package/e2e/regression/home.spec.ts +779 -0
- package/e2e/regression/mcp-workspace-toggle.spec.ts +695 -0
- package/e2e/regression/menu-scrollbars.spec.ts +78 -0
- package/e2e/regression/mobile-composer-submit-focus.spec.ts +88 -0
- package/e2e/regression/mobile-model-pickers.spec.ts +433 -0
- package/e2e/regression/mobile-plugin-drawers.spec.ts +194 -0
- package/e2e/regression/mobile-plugins.spec.ts +309 -0
- package/e2e/regression/mobile-session-options.spec.ts +101 -0
- package/e2e/regression/mobile-session.spec.ts +442 -0
- package/e2e/regression/mobile-timeline-scroll.spec.ts +919 -0
- package/e2e/regression/multi-server.spec.ts +498 -0
- package/e2e/regression/new-session.spec.ts +1666 -0
- package/e2e/regression/panel-edges.spec.ts +79 -0
- package/e2e/regression/patch-border.spec.ts +69 -0
- package/e2e/regression/patch-sticky-header.spec.ts +320 -0
- package/e2e/regression/review.spec.ts +2397 -0
- package/e2e/regression/session-header.spec.ts +1020 -0
- package/e2e/regression/session-location-sync.spec.ts +412 -0
- package/e2e/regression/session-notice-truncation.spec.ts +92 -0
- package/e2e/regression/session-panel-scrollbar.spec.ts +46 -0
- package/e2e/regression/session-queue.spec.ts +1704 -0
- package/e2e/regression/session-request-docks.spec.ts +719 -0
- package/e2e/regression/session-summary.spec.ts +1092 -0
- package/e2e/regression/session-timeline-accessibility.spec.ts +216 -0
- package/e2e/regression/session-timeline-locale-projection.spec.ts +24 -0
- package/e2e/regression/session-timeline-reducer-projection.spec.ts +53 -0
- package/e2e/regression/session-timeline-tool-projection.spec.ts +94 -0
- package/e2e/regression/session-websearch-dock.spec.ts +122 -0
- package/e2e/regression/settings-search.spec.ts +516 -0
- package/e2e/regression/settings-wsl.spec.ts +433 -0
- package/e2e/regression/settings.spec.ts +2901 -0
- package/e2e/regression/shell-panel-spacing.spec.ts +95 -0
- package/e2e/regression/side-panels.spec.ts +524 -0
- package/e2e/regression/subagent-child-navigation.spec.ts +540 -0
- package/e2e/regression/tabs.spec.ts +3294 -0
- package/e2e/regression/terminal.spec.ts +691 -0
- package/e2e/regression/timeline-cache.spec.ts +798 -0
- package/e2e/regression/timeline-geometry.spec.ts +1204 -0
- package/e2e/regression/timeline-history.spec.ts +1073 -0
- package/e2e/regression/timeline-stream.spec.ts +3409 -0
- package/e2e/regression/whats-new.spec.ts +242 -0
- package/e2e/reproduction/timeline-suspense/index.html +34 -0
- package/e2e/reproduction/timeline-suspense/main.tsx +335 -0
- package/e2e/reproduction/timeline-suspense/playwright.config.ts +34 -0
- package/e2e/reproduction/timeline-suspense/timeline-suspense.repro.ts +182 -0
- package/e2e/reproduction/timeline-suspense/vite.config.ts +7 -0
- package/e2e/screenshots/session-project-menu.png +0 -0
- package/e2e/service-worker/cache.spec.ts +573 -0
- package/e2e/service-worker/playwright.config.ts +14 -0
- package/e2e/stability/README.md +61 -0
- package/e2e/stability/adverse.spec.ts +279 -0
- package/e2e/stability/environment-matrix.spec.ts +128 -0
- package/e2e/stability/file-matrix.spec.ts +133 -0
- package/e2e/stability/file-mutation.spec.ts +126 -0
- package/e2e/stability/fixture.test.ts +80 -0
- package/e2e/stability/interaction.spec.ts +232 -0
- package/e2e/stability/lifecycle.spec.ts +175 -0
- package/e2e/stability/oracle-browser.spec.ts +81 -0
- package/e2e/stability/oracle.test.ts +388 -0
- package/e2e/stability/playwright.config.ts +31 -0
- package/e2e/stability/scroll-interaction.spec.ts +520 -0
- package/e2e/stability/shell-matrix.spec.ts +299 -0
- package/e2e/stability/tool-mutation.spec.ts +58 -0
- package/e2e/stability/tools.spec.ts +232 -0
- package/e2e/stability/transition-matrix.spec.ts +214 -0
- package/e2e/tsconfig.json +11 -0
- package/e2e/user-story/model-selection-flow.spec.ts +216 -0
- package/e2e/utils/app-direction.fixture.tsx +105 -0
- package/e2e/utils/app-direction.html +25 -0
- package/e2e/utils/app.ts +227 -0
- package/e2e/utils/command-palette.ts +62 -0
- package/e2e/utils/console.ts +23 -0
- package/e2e/utils/direction.ts +28 -0
- package/e2e/utils/drafts.ts +52 -0
- package/e2e/utils/errors.ts +14 -0
- package/e2e/utils/markdown-sessions.ts +120 -0
- package/e2e/utils/mock-api.ts +570 -0
- package/e2e/utils/mock-server.ts +1726 -0
- package/e2e/utils/notifications.ts +51 -0
- package/e2e/utils/persistent-pty.ts +546 -0
- package/e2e/utils/prompt-motion.ts +116 -0
- package/e2e/utils/serve.ts +65 -0
- package/e2e/utils/session-fixture.ts +472 -0
- package/e2e/utils/settings-wsl.fixture.tsx +416 -0
- package/e2e/utils/settings-wsl.html +27 -0
- package/e2e/utils/side-panel.ts +41 -0
- package/e2e/utils/sse-transport.ts +352 -0
- package/e2e/utils/terminal.ts +31 -0
- package/e2e/utils/timeline.ts +1141 -0
- package/e2e/utils/visual-stability/analyzer.ts +259 -0
- package/e2e/utils/visual-stability/capture.ts +57 -0
- package/e2e/utils/visual-stability/index.ts +15 -0
- package/e2e/utils/visual-stability/invariant.ts +113 -0
- package/e2e/utils/visual-stability/model.ts +47 -0
- package/e2e/utils/visual-stability/probe.ts +261 -0
- package/e2e/utils/visual-stability/regions.ts +18 -0
- package/e2e/utils/visual-stability/reporter.ts +71 -0
- package/e2e/utils/visual-stability/scenario.ts +21 -0
- package/e2e/utils/visual-stability.ts +52 -0
- package/e2e/utils/waits.ts +25 -0
- package/e2e/utils/windows-menu.fixture.tsx +99 -0
- package/e2e/utils/windows-menu.html +22 -0
- package/e2e/utils/workspace.ts +222 -0
- package/happydom.ts +77 -0
- package/index.html +29 -0
- package/manifest.json +36 -0
- package/package.json +83 -4
- package/perf/README.md +190 -0
- package/perf/composer.bench.ts +107 -0
- package/perf/desktop.bench.ts +22 -0
- package/perf/diff.bench.ts +104 -0
- package/perf/docks.bench.ts +109 -0
- package/perf/fixtures/composer.ts +166 -0
- package/perf/fixtures/diffs.ts +165 -0
- package/perf/fixtures/drag.ts +73 -0
- package/perf/fixtures/events.ts +106 -0
- package/perf/fixtures/home.ts +274 -0
- package/perf/fixtures/mock.ts +118 -0
- package/perf/fixtures/review.ts +33 -0
- package/perf/fixtures/scripts.ts +37 -0
- package/perf/fixtures/storage.ts +29 -0
- package/perf/fixtures/tabs.ts +21 -0
- package/perf/fixtures/timeline.ts +458 -0
- package/perf/home.bench.ts +74 -0
- package/perf/model-picker.bench.ts +168 -0
- package/perf/navigation.bench.ts +310 -0
- package/perf/question.bench.ts +85 -0
- package/perf/review.bench.ts +109 -0
- package/perf/send.bench.ts +54 -0
- package/perf/stream.bench.ts +108 -0
- package/perf/subagent-pill.bench.ts +348 -0
- package/perf/tabs.bench.ts +229 -0
- package/perf/timeline.bench.ts +167 -0
- package/playwright.components.config.ts +7 -0
- package/playwright.config.ts +85 -0
- package/public/_headers +28 -0
- package/public/assets/Inter.ttf +0 -0
- package/public/assets/JetBrainsMonoNerdFontMono-Bold.woff2 +0 -0
- package/public/assets/JetBrainsMonoNerdFontMono-Regular.woff2 +0 -0
- package/public/oc-theme-preload.js +33 -0
- package/src/app.tsx +142 -0
- package/src/components-lab/browser.tsx +745 -0
- package/src/components-lab/catalog.test.ts +58 -0
- package/src/components-lab/catalog.ts +195 -0
- package/src/components-lab/dialog-story-runtime.tsx +840 -0
- package/src/components-lab/focus-rings.stories.tsx +710 -0
- package/src/components-lab/focus-visibility.stories.tsx +2669 -0
- package/src/components-lab/force-focus.ts +52 -0
- package/src/components-lab/inspector.css +28 -0
- package/src/components-lab/lab.tsx +114 -0
- package/src/components-lab/machine.test.ts +177 -0
- package/src/components-lab/machine.ts +229 -0
- package/src/components-lab/motion.test.ts +17 -0
- package/src/components-lab/motion.ts +100 -0
- package/src/composer/adapter.ts +151 -0
- package/src/composer/attachments/attachments.css +123 -0
- package/src/composer/attachments/attachments.ts +363 -0
- package/src/composer/attachments/destination.ts +81 -0
- package/src/composer/attachments/upload-machine.ts +185 -0
- package/src/composer/attachments/uploads.test.ts +127 -0
- package/src/composer/attachments/uploads.tsx +228 -0
- package/src/composer/client-slash-command.test.ts +20 -0
- package/src/composer/client-slash-command.ts +28 -0
- package/src/composer/commands.tsx +175 -0
- package/src/composer/comment-focus-machine.test.ts +112 -0
- package/src/composer/comment-focus-machine.ts +141 -0
- package/src/composer/comment-note.test.ts +82 -0
- package/src/composer/comment-note.ts +127 -0
- package/src/composer/comments.test.ts +109 -0
- package/src/composer/comments.tsx +279 -0
- package/src/composer/composer-touch.stories.tsx +298 -0
- package/src/composer/composer.stories.tsx +765 -0
- package/src/composer/composer.tsx +244 -0
- package/src/composer/dropzone.tsx +92 -0
- package/src/composer/editor/actions.test.ts +176 -0
- package/src/composer/editor/actions.ts +191 -0
- package/src/composer/editor/dom.test.ts +168 -0
- package/src/composer/editor/dom.ts +274 -0
- package/src/composer/editor/editor.css +101 -0
- package/src/composer/editor/editor.tsx +1764 -0
- package/src/composer/editor/interaction.test.ts +13 -0
- package/src/composer/editor/interaction.ts +838 -0
- package/src/composer/editor/machine.test.ts +47 -0
- package/src/composer/editor/machine.ts +63 -0
- package/src/composer/editor/mention-search-machine.test.ts +111 -0
- package/src/composer/editor/mention-search-machine.ts +226 -0
- package/src/composer/editor/quote-comment.stories.tsx +133 -0
- package/src/composer/editor/quote-comment.tsx +191 -0
- package/src/composer/history/entry.test.ts +100 -0
- package/src/composer/history/entry.ts +140 -0
- package/src/composer/history/store.ts +83 -0
- package/src/composer/machine.test.ts +459 -0
- package/src/composer/machine.ts +561 -0
- package/src/composer/media.ts +18 -0
- package/src/composer/model-chip-machine.test.ts +96 -0
- package/src/composer/model-chip-machine.ts +82 -0
- package/src/composer/model-label.test.ts +177 -0
- package/src/composer/model-label.ts +120 -0
- package/src/composer/model.ts +683 -0
- package/src/composer/persistence.tsx +163 -0
- package/src/composer/prompt-parts.ts +52 -0
- package/src/composer/prompt-status-machine.test.ts +76 -0
- package/src/composer/prompt-status-machine.ts +48 -0
- package/src/composer/prompt.test.ts +320 -0
- package/src/composer/prompt.ts +334 -0
- package/src/composer/quote-comment-machine.test.ts +154 -0
- package/src/composer/quote-comment-machine.ts +211 -0
- package/src/composer/quote-position.ts +32 -0
- package/src/composer/quote-source.ts +48 -0
- package/src/composer/reload-machine.ts +51 -0
- package/src/composer/request.test.ts +360 -0
- package/src/composer/request.ts +245 -0
- package/src/composer/retry.test.ts +107 -0
- package/src/composer/retry.ts +63 -0
- package/src/composer/schema.test.ts +317 -0
- package/src/composer/schema.ts +424 -0
- package/src/composer/selection.ts +354 -0
- package/src/composer/session-match.test.ts +20 -0
- package/src/composer/session-match.ts +18 -0
- package/src/composer/state.ts +271 -0
- package/src/composer/submission-state.ts +3 -0
- package/src/composer/submit.test.ts +1785 -0
- package/src/composer/submit.ts +1073 -0
- package/src/composer/suggestions/machine.test.ts +420 -0
- package/src/composer/suggestions/machine.ts +573 -0
- package/src/composer/types.ts +60 -0
- package/src/desktop.ts +25 -0
- package/src/entry.tsx +119 -0
- package/src/env.d.ts +41 -0
- package/src/home/home.standalone.stories.tsx +260 -0
- package/src/home/machine.test.ts +286 -0
- package/src/home/machine.ts +344 -0
- package/src/home/model.ts +162 -0
- package/src/home/projects/actions.tsx +189 -0
- package/src/home/projects/add.ts +10 -0
- package/src/home/projects/browse-view.tsx +264 -0
- package/src/home/projects/browse.tsx +33 -0
- package/src/home/projects/controller.tsx +109 -0
- package/src/home/projects/file-manager.ts +26 -0
- package/src/home/projects/import-machine.test.ts +117 -0
- package/src/home/projects/import-machine.ts +133 -0
- package/src/home/projects/landing.tsx +77 -0
- package/src/home/projects/menu.tsx +70 -0
- package/src/home/projects/region.tsx +63 -0
- package/src/home/projects/reveal.ts +39 -0
- package/src/home/projects/start.ts +114 -0
- package/src/home/projects/view.css +79 -0
- package/src/home/projects/view.tsx +763 -0
- package/src/home/route.tsx +177 -0
- package/src/home/scroll.ts +180 -0
- package/src/home/sessions/alt-hold.test.ts +45 -0
- package/src/home/sessions/alt-hold.ts +20 -0
- package/src/home/sessions/archive.test.ts +51 -0
- package/src/home/sessions/archive.ts +25 -0
- package/src/home/sessions/controller.tsx +669 -0
- package/src/home/sessions/delete-dialog.stories.tsx +70 -0
- package/src/home/sessions/index.test.ts +171 -0
- package/src/home/sessions/index.ts +60 -0
- package/src/home/sessions/load-machine.test.ts +223 -0
- package/src/home/sessions/load-machine.ts +430 -0
- package/src/home/sessions/open.test.ts +16 -0
- package/src/home/sessions/open.ts +18 -0
- package/src/home/sessions/queries.ts +95 -0
- package/src/home/sessions/records.test.ts +85 -0
- package/src/home/sessions/records.ts +58 -0
- package/src/home/sessions/region.tsx +66 -0
- package/src/home/sessions/row-machine.test.ts +203 -0
- package/src/home/sessions/row-machine.ts +365 -0
- package/src/home/sessions/search-machine.test.ts +117 -0
- package/src/home/sessions/search-machine.ts +181 -0
- package/src/home/sessions/search.ts +218 -0
- package/src/home/sessions/view.css +101 -0
- package/src/home/sessions/view.tsx +1123 -0
- package/src/home/start/command-palette.tsx +88 -0
- package/src/index.css +419 -0
- package/src/index.ts +5 -0
- package/src/new-session/brick-breaker-machine.test.ts +120 -0
- package/src/new-session/brick-breaker-machine.ts +110 -0
- package/src/new-session/brick-breaker.tsx +551 -0
- package/src/new-session/commands.tsx +61 -0
- package/src/new-session/composer-adapter.ts +309 -0
- package/src/new-session/draft.standalone.stories.tsx +214 -0
- package/src/new-session/layout.ts +2 -0
- package/src/new-session/location/dialog.css +204 -0
- package/src/new-session/location/dialog.standalone.stories.tsx +122 -0
- package/src/new-session/location/dialog.tsx +677 -0
- package/src/new-session/location/machine.test.ts +180 -0
- package/src/new-session/location/machine.ts +239 -0
- package/src/new-session/machine.test.ts +344 -0
- package/src/new-session/machine.ts +293 -0
- package/src/new-session/mcp.ts +132 -0
- package/src/new-session/pin-board-machine.test.ts +116 -0
- package/src/new-session/pin-board-machine.ts +188 -0
- package/src/new-session/pin-board.tsx +1072 -0
- package/src/new-session/pin-quads.ts +252 -0
- package/src/new-session/pin-sound.ts +193 -0
- package/src/new-session/project/controller.ts +111 -0
- package/src/new-session/project/selector.test.tsx +101 -0
- package/src/new-session/project/selector.tsx +108 -0
- package/src/new-session/route.tsx +115 -0
- package/src/new-session/screen.tsx +107 -0
- package/src/new-session/view.tsx +424 -0
- package/src/new-session/wordmark-machine.test.ts +236 -0
- package/src/new-session/wordmark-machine.ts +237 -0
- package/src/new-session/wordmark.css +71 -0
- package/src/new-session/wordmark.stories.tsx +109 -0
- package/src/new-session/wordmark.tsx +1222 -0
- package/src/new-session/workspace/branch-machine.test.ts +243 -0
- package/src/new-session/workspace/branch-machine.ts +233 -0
- package/src/new-session/workspace/checkout-machine.test.ts +73 -0
- package/src/new-session/workspace/checkout-machine.ts +69 -0
- package/src/new-session/workspace/controller.test.ts +82 -0
- package/src/new-session/workspace/controller.ts +291 -0
- package/src/new-session/workspace/selector.tsx +230 -0
- package/src/providers/catalog/console-settle.ts +80 -0
- package/src/providers/catalog/console.test.ts +21 -0
- package/src/providers/catalog/console.ts +37 -0
- package/src/providers/catalog/integrations.ts +30 -0
- package/src/providers/catalog/order.ts +10 -0
- package/src/providers/catalog/plugin.ts +15 -0
- package/src/providers/catalog/providers.ts +111 -0
- package/src/providers/catalog/settle-machine.test.ts +123 -0
- package/src/providers/catalog/settle-machine.ts +109 -0
- package/src/providers/connect/chatgpt-usage-limit.stories.tsx +25 -0
- package/src/providers/connect/chatgpt-usage-limit.tsx +83 -0
- package/src/providers/connect/chatgpt-welcome.stories.tsx +23 -0
- package/src/providers/connect/chatgpt-welcome.tsx +37 -0
- package/src/providers/connect/console.tsx +67 -0
- package/src/providers/connect/controller.ts +672 -0
- package/src/providers/connect/dialog-machine.test.ts +654 -0
- package/src/providers/connect/dialog-machine.ts +875 -0
- package/src/providers/connect/dialog.standalone.stories.tsx +187 -0
- package/src/providers/connect/dialog.tsx +1564 -0
- package/src/providers/connect/form-machine.test.ts +200 -0
- package/src/providers/connect/form-machine.ts +419 -0
- package/src/providers/connect/go-upsell-hero-art.test.ts +194 -0
- package/src/providers/connect/go-upsell-hero-art.ts +749 -0
- package/src/providers/connect/go-upsell-hero-machine.test.ts +88 -0
- package/src/providers/connect/go-upsell-hero-machine.ts +68 -0
- package/src/providers/connect/go-upsell-hero.tsx +17 -0
- package/src/providers/connect/machine.test.ts +513 -0
- package/src/providers/connect/machine.ts +644 -0
- package/src/providers/connect/mcp-dialog.stories.tsx +89 -0
- package/src/providers/connect/mcp-dialog.tsx +316 -0
- package/src/providers/connect/mcp-machine.test.ts +239 -0
- package/src/providers/connect/mcp-machine.ts +328 -0
- package/src/providers/connect/mcp-sign-in.tsx +112 -0
- package/src/providers/connect/mcp.tsx +298 -0
- package/src/providers/connect/models.css +71 -0
- package/src/providers/connect/remote.test.ts +50 -0
- package/src/providers/connect/remote.tsx +10 -0
- package/src/providers/connect/step-actions.tsx +18 -0
- package/src/providers/connect/tip.tsx +110 -0
- package/src/providers/connect/usage-exceeded.tsx +62 -0
- package/src/providers/custom-managed-provider.svg +31 -0
- package/src/providers/models/agent.test.ts +25 -0
- package/src/providers/models/agent.ts +7 -0
- package/src/providers/models/configured.ts +33 -0
- package/src/providers/models/details.tsx +168 -0
- package/src/providers/models/manage.css +97 -0
- package/src/providers/models/manage.standalone.stories.tsx +59 -0
- package/src/providers/models/manage.tsx +170 -0
- package/src/providers/models/models.test.ts +55 -0
- package/src/providers/models/models.tsx +279 -0
- package/src/providers/models/provider-group.tsx +293 -0
- package/src/providers/models/search.test.ts +13 -0
- package/src/providers/models/search.ts +20 -0
- package/src/providers/models/select-dialog-machine.test.ts +455 -0
- package/src/providers/models/select-dialog-machine.ts +702 -0
- package/src/providers/models/select-dialog.css +240 -0
- package/src/providers/models/select-dialog.standalone.stories.tsx +225 -0
- package/src/providers/models/select-dialog.tsx +1359 -0
- package/src/providers/models/selection-machine.test.ts +290 -0
- package/src/providers/models/selection-machine.ts +408 -0
- package/src/providers/models/selection.tsx +787 -0
- package/src/providers/models/speed.test.ts +17 -0
- package/src/providers/models/speed.ts +17 -0
- package/src/providers/models/tooltip.tsx +152 -0
- package/src/providers/models/unpaid.standalone.stories.tsx +76 -0
- package/src/providers/models/unpaid.tsx +199 -0
- package/src/providers/models/variant.test.ts +79 -0
- package/src/providers/models/variant.ts +74 -0
- package/src/providers/opencode-logo.tsx +17 -0
- package/src/runtime/animated-presence.ts +66 -0
- package/src/runtime/array-move.test.ts +19 -0
- package/src/runtime/array-move.ts +8 -0
- package/src/runtime/i18n/am.ts +1409 -0
- package/src/runtime/i18n/ar.ts +1560 -0
- package/src/runtime/i18n/az.ts +1481 -0
- package/src/runtime/i18n/bg.ts +1491 -0
- package/src/runtime/i18n/bn.ts +1477 -0
- package/src/runtime/i18n/br.ts +1527 -0
- package/src/runtime/i18n/bs.ts +1561 -0
- package/src/runtime/i18n/ca.ts +1523 -0
- package/src/runtime/i18n/cs.ts +1520 -0
- package/src/runtime/i18n/da.ts +1527 -0
- package/src/runtime/i18n/de.ts +1517 -0
- package/src/runtime/i18n/desktop-native.test.ts +84 -0
- package/src/runtime/i18n/desktop-native.ts +366 -0
- package/src/runtime/i18n/dv.ts +1519 -0
- package/src/runtime/i18n/dz.ts +1504 -0
- package/src/runtime/i18n/el.ts +1509 -0
- package/src/runtime/i18n/en.ts +1560 -0
- package/src/runtime/i18n/es.ts +1583 -0
- package/src/runtime/i18n/et.ts +1456 -0
- package/src/runtime/i18n/fa.ts +1470 -0
- package/src/runtime/i18n/fi.ts +1472 -0
- package/src/runtime/i18n/fo.ts +1469 -0
- package/src/runtime/i18n/fr.ts +1543 -0
- package/src/runtime/i18n/he.ts +1455 -0
- package/src/runtime/i18n/hi.ts +1475 -0
- package/src/runtime/i18n/hr.ts +1506 -0
- package/src/runtime/i18n/hu.ts +1492 -0
- package/src/runtime/i18n/hy.ts +1478 -0
- package/src/runtime/i18n/id.ts +1541 -0
- package/src/runtime/i18n/is.ts +1468 -0
- package/src/runtime/i18n/it.ts +1517 -0
- package/src/runtime/i18n/ja.ts +1484 -0
- package/src/runtime/i18n/ka.ts +1476 -0
- package/src/runtime/i18n/km.ts +1461 -0
- package/src/runtime/i18n/ko.ts +1469 -0
- package/src/runtime/i18n/language.test.ts +35 -0
- package/src/runtime/i18n/language.tsx +468 -0
- package/src/runtime/i18n/lo.ts +1454 -0
- package/src/runtime/i18n/lt.ts +1529 -0
- package/src/runtime/i18n/lv.ts +1509 -0
- package/src/runtime/i18n/machine.test.ts +148 -0
- package/src/runtime/i18n/machine.ts +164 -0
- package/src/runtime/i18n/mk.ts +1488 -0
- package/src/runtime/i18n/mn.ts +1485 -0
- package/src/runtime/i18n/ms.ts +1480 -0
- package/src/runtime/i18n/my.ts +1489 -0
- package/src/runtime/i18n/ne.ts +1478 -0
- package/src/runtime/i18n/nl.ts +1491 -0
- package/src/runtime/i18n/no.ts +1536 -0
- package/src/runtime/i18n/pa.ts +1478 -0
- package/src/runtime/i18n/pl.ts +1540 -0
- package/src/runtime/i18n/ro.ts +1511 -0
- package/src/runtime/i18n/ru.ts +1596 -0
- package/src/runtime/i18n/si.ts +1477 -0
- package/src/runtime/i18n/sk.ts +1526 -0
- package/src/runtime/i18n/sl.ts +1527 -0
- package/src/runtime/i18n/sq.ts +1480 -0
- package/src/runtime/i18n/sr.ts +1502 -0
- package/src/runtime/i18n/sv.ts +1478 -0
- package/src/runtime/i18n/tg.ts +1493 -0
- package/src/runtime/i18n/th.ts +1505 -0
- package/src/runtime/i18n/tk.ts +1472 -0
- package/src/runtime/i18n/tr.ts +1550 -0
- package/src/runtime/i18n/uk.ts +1598 -0
- package/src/runtime/i18n/ur.ts +1488 -0
- package/src/runtime/i18n/uz.ts +1490 -0
- package/src/runtime/i18n/vi.ts +1473 -0
- package/src/runtime/i18n/zh.ts +1474 -0
- package/src/runtime/i18n/zht.ts +1468 -0
- package/src/runtime/persistence/README.md +151 -0
- package/src/runtime/persistence/base64.ts +11 -0
- package/src/runtime/persistence/consumers.test.ts +168 -0
- package/src/runtime/persistence/drafts-machine.test.ts +214 -0
- package/src/runtime/persistence/drafts-machine.ts +385 -0
- package/src/runtime/persistence/drafts.test.ts +515 -0
- package/src/runtime/persistence/drafts.ts +687 -0
- package/src/runtime/persistence/equality.ts +9 -0
- package/src/runtime/persistence/namespace-machine.test.ts +232 -0
- package/src/runtime/persistence/namespace-machine.ts +304 -0
- package/src/runtime/persistence/namespace.test.ts +304 -0
- package/src/runtime/persistence/namespace.ts +126 -0
- package/src/runtime/persistence/persist-machine.test.ts +185 -0
- package/src/runtime/persistence/persist-machine.ts +192 -0
- package/src/runtime/persistence/persist.test.ts +243 -0
- package/src/runtime/persistence/persist.ts +159 -0
- package/src/runtime/persistence/schema.test.ts +208 -0
- package/src/runtime/persistence/schema.ts +130 -0
- package/src/runtime/persistence/storage-machine.test.ts +61 -0
- package/src/runtime/persistence/storage-machine.ts +57 -0
- package/src/runtime/persistence/storage.test.ts +70 -0
- package/src/runtime/persistence/storage.ts +707 -0
- package/src/runtime/platform/base-path-router.tsx +66 -0
- package/src/runtime/platform/base-path.test.ts +50 -0
- package/src/runtime/platform/base-path.ts +28 -0
- package/src/runtime/platform/drag-out.test.ts +58 -0
- package/src/runtime/platform/drag-out.ts +53 -0
- package/src/runtime/platform/external-link.tsx +21 -0
- package/src/runtime/platform/keyboard.ts +41 -0
- package/src/runtime/platform/platform.tsx +185 -0
- package/src/runtime/platform/pwa.ts +50 -0
- package/src/runtime/platform/web.ts +63 -0
- package/src/runtime/plugin/app-links.test.ts +17 -0
- package/src/runtime/plugin/app-links.ts +88 -0
- package/src/runtime/plugin/attach-machine.test.ts +174 -0
- package/src/runtime/plugin/attach-machine.ts +152 -0
- package/src/runtime/plugin/attachment.ts +15 -0
- package/src/runtime/plugin/builtins.ts +15 -0
- package/src/runtime/plugin/closed-tabs-view.tsx +315 -0
- package/src/runtime/plugin/closed-tabs.test.ts +82 -0
- package/src/runtime/plugin/closed-tabs.ts +196 -0
- package/src/runtime/plugin/commands.test.ts +23 -0
- package/src/runtime/plugin/commands.tsx +86 -0
- package/src/runtime/plugin/composer-write-machine.test.ts +151 -0
- package/src/runtime/plugin/composer-write-machine.ts +111 -0
- package/src/runtime/plugin/deferred-menu-machine.test.ts +127 -0
- package/src/runtime/plugin/deferred-menu-machine.ts +163 -0
- package/src/runtime/plugin/dialog-machine.test.ts +62 -0
- package/src/runtime/plugin/dialog-machine.ts +81 -0
- package/src/runtime/plugin/dialogs.stories.tsx +66 -0
- package/src/runtime/plugin/dialogs.tsx +177 -0
- package/src/runtime/plugin/embed-flight-machine.test.ts +350 -0
- package/src/runtime/plugin/embed-flight-machine.ts +468 -0
- package/src/runtime/plugin/embed-geometry.test.ts +18 -0
- package/src/runtime/plugin/embed-geometry.ts +19 -0
- package/src/runtime/plugin/embed-snapshot-machine.test.ts +242 -0
- package/src/runtime/plugin/embed-snapshot-machine.ts +267 -0
- package/src/runtime/plugin/embeds.tsx +773 -0
- package/src/runtime/plugin/extension-plugins.tsx +299 -0
- package/src/runtime/plugin/hmr.tsx +33 -0
- package/src/runtime/plugin/host-apis.tsx +1315 -0
- package/src/runtime/plugin/host-layout-machine.test.ts +214 -0
- package/src/runtime/plugin/host-layout-machine.ts +269 -0
- package/src/runtime/plugin/host.tsx +1106 -0
- package/src/runtime/plugin/instance-machine.test.ts +387 -0
- package/src/runtime/plugin/instance-machine.ts +409 -0
- package/src/runtime/plugin/ipc-machine.test.ts +172 -0
- package/src/runtime/plugin/ipc-machine.ts +213 -0
- package/src/runtime/plugin/ipc.test.ts +166 -0
- package/src/runtime/plugin/ipc.ts +220 -0
- package/src/runtime/plugin/link-check-machine.test.ts +115 -0
- package/src/runtime/plugin/link-check-machine.ts +142 -0
- package/src/runtime/plugin/link-check.ts +82 -0
- package/src/runtime/plugin/located-machine.test.ts +124 -0
- package/src/runtime/plugin/located-machine.ts +125 -0
- package/src/runtime/plugin/located.ts +82 -0
- package/src/runtime/plugin/machine.test.ts +222 -0
- package/src/runtime/plugin/machine.ts +318 -0
- package/src/runtime/plugin/menubar-items.ts +28 -0
- package/src/runtime/plugin/mobile.tsx +199 -0
- package/src/runtime/plugin/module.test.ts +57 -0
- package/src/runtime/plugin/module.ts +64 -0
- package/src/runtime/plugin/mounted-session.ts +420 -0
- package/src/runtime/plugin/new-tab-machine.test.ts +207 -0
- package/src/runtime/plugin/new-tab-machine.ts +240 -0
- package/src/runtime/plugin/pane-drag-machine.test.ts +217 -0
- package/src/runtime/plugin/pane-drag-machine.ts +263 -0
- package/src/runtime/plugin/pane-drag.tsx +290 -0
- package/src/runtime/plugin/panel-keys.ts +15 -0
- package/src/runtime/plugin/panel-menu.ts +29 -0
- package/src/runtime/plugin/panel-trigger.tsx +180 -0
- package/src/runtime/plugin/panels.tsx +733 -0
- package/src/runtime/plugin/plugin-gui-machine.test.ts +186 -0
- package/src/runtime/plugin/plugin-gui-machine.ts +178 -0
- package/src/runtime/plugin/plugins.tsx +137 -0
- package/src/runtime/plugin/prompt-gate.test.ts +113 -0
- package/src/runtime/plugin/prompt-gate.ts +36 -0
- package/src/runtime/plugin/render.tsx +348 -0
- package/src/runtime/plugin/root.tsx +141 -0
- package/src/runtime/plugin/server-shell.tsx +113 -0
- package/src/runtime/plugin/servers.tsx +270 -0
- package/src/runtime/plugin/session-store-machine.test.ts +82 -0
- package/src/runtime/plugin/session-store-machine.ts +140 -0
- package/src/runtime/plugin/settings-page-view.tsx +53 -0
- package/src/runtime/plugin/settings-pages.ts +23 -0
- package/src/runtime/plugin/side-region.tsx +635 -0
- package/src/runtime/plugin/startup.ts +107 -0
- package/src/runtime/plugin/store-machine.test.ts +69 -0
- package/src/runtime/plugin/store-machine.ts +139 -0
- package/src/runtime/plugin/stores.ts +339 -0
- package/src/runtime/plugin/tab-strip-scroll.test.ts +40 -0
- package/src/runtime/plugin/tab-strip-scroll.ts +130 -0
- package/src/runtime/plugin/titlebar-items.css +20 -0
- package/src/runtime/plugin/titlebar-items.stories.tsx +97 -0
- package/src/runtime/plugin/titlebar-items.tsx +96 -0
- package/src/runtime/plugin/ui.tsx +292 -0
- package/src/runtime/plugin/web-href.test.ts +11 -0
- package/src/runtime/plugin/web-href.ts +10 -0
- package/src/runtime/polyfills.test.ts +61 -0
- package/src/runtime/polyfills.ts +39 -0
- package/src/runtime/presence-machine.test.ts +260 -0
- package/src/runtime/presence-machine.ts +329 -0
- package/src/runtime/presence.ts +165 -0
- package/src/runtime/server/api.test.ts +64 -0
- package/src/runtime/server/api.ts +58 -0
- package/src/runtime/server/client.test.ts +131 -0
- package/src/runtime/server/client.tsx +308 -0
- package/src/runtime/server/current.tsx +55 -0
- package/src/runtime/server/data.test.ts +440 -0
- package/src/runtime/server/data.ts +286 -0
- package/src/runtime/server/errors.test.ts +151 -0
- package/src/runtime/server/errors.ts +135 -0
- package/src/runtime/server/global-sync/bootstrap.test.ts +179 -0
- package/src/runtime/server/global-sync/bootstrap.ts +96 -0
- package/src/runtime/server/global-sync/child-store.test.ts +47 -0
- package/src/runtime/server/global-sync/child-store.ts +206 -0
- package/src/runtime/server/global-sync/machine.test.ts +96 -0
- package/src/runtime/server/global-sync/machine.ts +84 -0
- package/src/runtime/server/global-sync/types.ts +46 -0
- package/src/runtime/server/global-sync/utils.test.ts +154 -0
- package/src/runtime/server/global-sync/utils.ts +165 -0
- package/src/runtime/server/health-machine.test.ts +227 -0
- package/src/runtime/server/health-machine.ts +357 -0
- package/src/runtime/server/health.test.ts +169 -0
- package/src/runtime/server/health.ts +236 -0
- package/src/runtime/server/image.test.ts +214 -0
- package/src/runtime/server/image.ts +40 -0
- package/src/runtime/server/loopback.test.ts +17 -0
- package/src/runtime/server/loopback.ts +22 -0
- package/src/runtime/server/machine.test.ts +162 -0
- package/src/runtime/server/machine.ts +275 -0
- package/src/runtime/server/media.ts +88 -0
- package/src/runtime/server/persistence.test.ts +117 -0
- package/src/runtime/server/persistence.ts +105 -0
- package/src/runtime/server/plugin-machine.test.ts +128 -0
- package/src/runtime/server/plugin-machine.ts +170 -0
- package/src/runtime/server/refcount.test.ts +30 -0
- package/src/runtime/server/refcount.ts +37 -0
- package/src/runtime/server/registry.test.ts +152 -0
- package/src/runtime/server/registry.tsx +363 -0
- package/src/runtime/server/request-queue-machine.test.ts +151 -0
- package/src/runtime/server/request-queue-machine.ts +307 -0
- package/src/runtime/server/request-queue.test.ts +315 -0
- package/src/runtime/server/request-queue.ts +173 -0
- package/src/runtime/server/runtime.tsx +396 -0
- package/src/runtime/server/scope.test.ts +52 -0
- package/src/runtime/server/scope.ts +69 -0
- package/src/runtime/server/scoped-cache.test.ts +72 -0
- package/src/runtime/server/scoped-cache.ts +119 -0
- package/src/runtime/server/server-sync/connection.ts +34 -0
- package/src/runtime/server/server-sync/endpoint-machine.test.ts +87 -0
- package/src/runtime/server/server-sync/endpoint-machine.ts +62 -0
- package/src/runtime/server/server-sync/machine.test.ts +86 -0
- package/src/runtime/server/server-sync/machine.ts +70 -0
- package/src/runtime/server/session-index.ts +23 -0
- package/src/runtime/server/sync.tsx +206 -0
- package/src/runtime/server/types.ts +151 -0
- package/src/servers/connect/browser.ts +15 -0
- package/src/servers/connect/connect.fixture.tsx +222 -0
- package/src/servers/connect/controller.ts +237 -0
- package/src/servers/connect/dialog.stories.tsx +67 -0
- package/src/servers/connect/dialog.tsx +255 -0
- package/src/servers/connect/machine.test.ts +487 -0
- package/src/servers/connect/machine.ts +427 -0
- package/src/servers/connect/method.tsx +31 -0
- package/src/servers/connect/pairing.test.ts +67 -0
- package/src/servers/connect/pairing.ts +134 -0
- package/src/servers/connect/redeem.ts +50 -0
- package/src/servers/connect/scanner-machine.test.ts +114 -0
- package/src/servers/connect/scanner-machine.ts +164 -0
- package/src/servers/connect/scanner.css +47 -0
- package/src/servers/connect/scanner.tsx +173 -0
- package/src/servers/connect/screen.css +108 -0
- package/src/servers/connect/screen.stories.tsx +63 -0
- package/src/servers/connect/screen.tsx +164 -0
- package/src/servers/registry/add-menu.tsx +62 -0
- package/src/servers/registry/controller.test.ts +26 -0
- package/src/servers/registry/controller.ts +86 -0
- package/src/servers/registry/label.tsx +23 -0
- package/src/servers/registry/management.test.ts +40 -0
- package/src/servers/registry/management.ts +17 -0
- package/src/servers/registry/plugin-row.tsx +57 -0
- package/src/servers/registry/row-items.tsx +18 -0
- package/src/servers/registry/row-menu.tsx +152 -0
- package/src/servers/registry/row.stories.tsx +51 -0
- package/src/servers/registry/row.tsx +47 -0
- package/src/session/commands/dialog-jump-to-message.tsx +197 -0
- package/src/session/commands/export-machine.test.ts +99 -0
- package/src/session/commands/export-machine.ts +117 -0
- package/src/session/commands/export-session.tsx +108 -0
- package/src/session/commands/export.test.ts +105 -0
- package/src/session/commands/export.ts +89 -0
- package/src/session/commands/fork-dialog.stories.tsx +68 -0
- package/src/session/commands/fork-dialog.tsx +198 -0
- package/src/session/commands/jump-to-message-machine.test.ts +123 -0
- package/src/session/commands/jump-to-message-machine.ts +161 -0
- package/src/session/commands/jump-to-message.stories.tsx +226 -0
- package/src/session/commands/jump-to-message.tsx +161 -0
- package/src/session/commands/machine.test.ts +305 -0
- package/src/session/commands/machine.ts +272 -0
- package/src/session/commands/rename-session.ts +31 -0
- package/src/session/commands/use-session-commands.tsx +813 -0
- package/src/session/composer/activity-chips.css +242 -0
- package/src/session/composer/activity-chips.stories.tsx +280 -0
- package/src/session/composer/activity-chips.tsx +485 -0
- package/src/session/composer/adapter.ts +74 -0
- package/src/session/composer/composer-docks.stories.tsx +278 -0
- package/src/session/composer/composer-lane.css +93 -0
- package/src/session/composer/composer-lane.tsx +45 -0
- package/src/session/composer/controller.ts +86 -0
- package/src/session/composer/focus-machine.test.ts +285 -0
- package/src/session/composer/focus-machine.ts +212 -0
- package/src/session/composer/focus.tsx +161 -0
- package/src/session/composer/free-limit-panel.standalone.stories.tsx +45 -0
- package/src/session/composer/free-limit-panel.tsx +133 -0
- package/src/session/composer/go-limit-tray.tsx +137 -0
- package/src/session/composer/location-missing-machine.test.ts +97 -0
- package/src/session/composer/location-missing-machine.ts +144 -0
- package/src/session/composer/location-missing.css +73 -0
- package/src/session/composer/location-missing.standalone.stories.tsx +161 -0
- package/src/session/composer/location-missing.tsx +193 -0
- package/src/session/composer/plugin-pills.tsx +215 -0
- package/src/session/composer/queue-machine.test.ts +565 -0
- package/src/session/composer/queue-machine.ts +934 -0
- package/src/session/composer/queue-panel-machine.test.ts +121 -0
- package/src/session/composer/queue-panel-machine.ts +229 -0
- package/src/session/composer/queue-panel.css +10 -0
- package/src/session/composer/queue-panel.stories.tsx +86 -0
- package/src/session/composer/queue-panel.tsx +314 -0
- package/src/session/composer/queue.test.ts +314 -0
- package/src/session/composer/queue.ts +610 -0
- package/src/session/composer/recovery-story.tsx +38 -0
- package/src/session/composer/region.tsx +689 -0
- package/src/session/composer/selection.test.ts +28 -0
- package/src/session/composer/selection.ts +28 -0
- package/src/session/composer/session-composer-region-controller.ts +28 -0
- package/src/session/composer/session-composer-region.tsx +115 -0
- package/src/session/composer/shell-panel-machine.test.ts +261 -0
- package/src/session/composer/shell-panel-machine.ts +338 -0
- package/src/session/composer/shell-panel.ts +181 -0
- package/src/session/composer/spring-height-machine.test.ts +380 -0
- package/src/session/composer/spring-height-machine.ts +489 -0
- package/src/session/composer/spring-height.tsx +586 -0
- package/src/session/composer/subagent-bar.tsx +116 -0
- package/src/session/composer/timeline-actions.ts +49 -0
- package/src/session/composer/todo-pill.css +32 -0
- package/src/session/composer/todo-pill.stories.tsx +158 -0
- package/src/session/composer/todo-pill.tsx +157 -0
- package/src/session/composer/todos.ts +43 -0
- package/src/session/delete-machine.test.ts +83 -0
- package/src/session/delete-machine.ts +128 -0
- package/src/session/fork-machine.test.ts +152 -0
- package/src/session/fork-machine.ts +169 -0
- package/src/session/fork.ts +164 -0
- package/src/session/handoff-machine.test.ts +262 -0
- package/src/session/handoff-machine.ts +256 -0
- package/src/session/handoff.ts +112 -0
- package/src/session/header/drag-area.tsx +86 -0
- package/src/session/header/fit-machine.test.ts +143 -0
- package/src/session/header/fit-machine.ts +95 -0
- package/src/session/header/fit.ts +134 -0
- package/src/session/header/separator.tsx +22 -0
- package/src/session/header/session-header-actions.stories.tsx +45 -0
- package/src/session/header/session-header-actions.tsx +89 -0
- package/src/session/header/session-header.tsx +12 -0
- package/src/session/header/session-working-indicator.tsx +44 -0
- package/src/session/helpers.ts +42 -0
- package/src/session/list.test.ts +64 -0
- package/src/session/list.ts +18 -0
- package/src/session/message-id-from-hash.test.ts +10 -0
- package/src/session/message-id-from-hash.ts +8 -0
- package/src/session/model.ts +150 -0
- package/src/session/preparing-composer.tsx +72 -0
- package/src/session/question-switch.stories.tsx +380 -0
- package/src/session/requests/auto-approve-machine.test.ts +345 -0
- package/src/session/requests/auto-approve-machine.ts +247 -0
- package/src/session/requests/auto-approve.ts +274 -0
- package/src/session/requests/background.ts +312 -0
- package/src/session/requests/elicitation-controller.ts +129 -0
- package/src/session/requests/elicitation-machine.test.ts +209 -0
- package/src/session/requests/elicitation-machine.ts +277 -0
- package/src/session/requests/job-list.test.ts +18 -0
- package/src/session/requests/model.ts +348 -0
- package/src/session/requests/permission-machine.test.ts +130 -0
- package/src/session/requests/permission-machine.ts +105 -0
- package/src/session/requests/question-controller.ts +130 -0
- package/src/session/requests/question-keys.test.ts +106 -0
- package/src/session/requests/question-keys.ts +81 -0
- package/src/session/requests/question-machine.test.ts +257 -0
- package/src/session/requests/question-machine.ts +293 -0
- package/src/session/requests/question-motion.ts +26 -0
- package/src/session/requests/question-state.ts +21 -0
- package/src/session/requests/question-switch-machine.test.ts +114 -0
- package/src/session/requests/question-switch-machine.ts +130 -0
- package/src/session/requests/session-elicitation-dock.css +49 -0
- package/src/session/requests/session-elicitation-dock.tsx +223 -0
- package/src/session/requests/session-permission-dock.tsx +108 -0
- package/src/session/requests/session-question-dock-classic.tsx +726 -0
- package/src/session/requests/session-question-dock-experimental.tsx +1510 -0
- package/src/session/requests/session-question-dock.tsx +15 -0
- package/src/session/requests/session-request-tree.test.ts +119 -0
- package/src/session/requests/session-request-tree.ts +87 -0
- package/src/session/requests/session-websearch-dock.css +61 -0
- package/src/session/requests/session-websearch-dock.tsx +112 -0
- package/src/session/requests/steer-background.test.ts +66 -0
- package/src/session/requests/steer-background.ts +28 -0
- package/src/session/requests/websearch-machine.test.ts +425 -0
- package/src/session/requests/websearch-machine.ts +627 -0
- package/src/session/requests/websearch.ts +152 -0
- package/src/session/resolution-machine.test.ts +414 -0
- package/src/session/resolution-machine.ts +330 -0
- package/src/session/revert-machine.test.ts +365 -0
- package/src/session/revert-machine.ts +345 -0
- package/src/session/revert.ts +340 -0
- package/src/session/route-error.tsx +73 -0
- package/src/session/route.tsx +299 -0
- package/src/session/screen-layout.ts +147 -0
- package/src/session/screen.tsx +625 -0
- package/src/session/search.ts +3 -0
- package/src/session/server-unavailable-panel.standalone.stories.tsx +88 -0
- package/src/session/server-unavailable-panel.tsx +86 -0
- package/src/session/session-domain.test.ts +57 -0
- package/src/session/session-domain.ts +33 -0
- package/src/session/session-frame.tsx +28 -0
- package/src/session/session-identity-header.css +142 -0
- package/src/session/session-identity-header.tsx +674 -0
- package/src/session/session-layout.ts +73 -0
- package/src/session/session-model-helpers.test.ts +29 -0
- package/src/session/session-model-helpers.ts +33 -0
- package/src/session/session-panel-width.test.ts +25 -0
- package/src/session/session-panel-width.ts +58 -0
- package/src/session/session-read-menu-item.tsx +54 -0
- package/src/session/session-reference-menu.tsx +106 -0
- package/src/session/session-resolution.ts +141 -0
- package/src/session/session-screen.stories.tsx +363 -0
- package/src/session/sizing-machine.test.ts +89 -0
- package/src/session/sizing-machine.ts +74 -0
- package/src/session/story-model.tsx +420 -0
- package/src/session/timeline/background-work.stories.tsx +27 -0
- package/src/session/timeline/cache-machine.test.ts +50 -0
- package/src/session/timeline/cache-machine.ts +37 -0
- package/src/session/timeline/cache.ts +200 -0
- package/src/session/timeline/cold-mount.test.ts +162 -0
- package/src/session/timeline/cold-mount.ts +179 -0
- package/src/session/timeline/controller-projection.test.ts +305 -0
- package/src/session/timeline/controller-projection.ts +131 -0
- package/src/session/timeline/controller.tsx +467 -0
- package/src/session/timeline/cursor-machine.test.ts +398 -0
- package/src/session/timeline/cursor-machine.ts +433 -0
- package/src/session/timeline/cursor.ts +207 -0
- package/src/session/timeline/follow.ts +40 -0
- package/src/session/timeline/header-actions-machine.test.ts +126 -0
- package/src/session/timeline/header-actions-machine.ts +204 -0
- package/src/session/timeline/history-machine.test.ts +304 -0
- package/src/session/timeline/history-machine.ts +296 -0
- package/src/session/timeline/inline-quotes.ts +4 -0
- package/src/session/timeline/interaction.ts +474 -0
- package/src/session/timeline/machine.test.ts +290 -0
- package/src/session/timeline/machine.ts +271 -0
- package/src/session/timeline/message-timeline.tsx +779 -0
- package/src/session/timeline/model.test.ts +393 -0
- package/src/session/timeline/model.ts +201 -0
- package/src/session/timeline/observe-element-offset.test.ts +323 -0
- package/src/session/timeline/observe-element-offset.ts +106 -0
- package/src/session/timeline/projection.ts +7 -0
- package/src/session/timeline/quote-background.ts +141 -0
- package/src/session/timeline/quote-highlight.ts +203 -0
- package/src/session/timeline/quote-machine.test.ts +277 -0
- package/src/session/timeline/quote-machine.ts +360 -0
- package/src/session/timeline/quote-text.ts +332 -0
- package/src/session/timeline/quote.stories.tsx +88 -0
- package/src/session/timeline/quote.tsx +547 -0
- package/src/session/timeline/reconnect-machine.test.ts +115 -0
- package/src/session/timeline/reconnect-machine.ts +130 -0
- package/src/session/timeline/search-bar.css +19 -0
- package/src/session/timeline/search-bar.stories.tsx +122 -0
- package/src/session/timeline/search-bar.tsx +94 -0
- package/src/session/timeline/search-controller.ts +364 -0
- package/src/session/timeline/search-machine.test.ts +320 -0
- package/src/session/timeline/search-machine.ts +342 -0
- package/src/session/timeline/selected-effect.ts +19 -0
- package/src/session/timeline/sources.stories.tsx +352 -0
- package/src/session/timeline/sync-machine.ts +265 -0
- package/src/session/timeline/turn-diff-machine.ts +115 -0
- package/src/session/timeline/turn-diffs.test.ts +178 -0
- package/src/session/timeline/turn-diffs.ts +67 -0
- package/src/session/timeline/virtual-items.ts +3 -0
- package/src/session/timeline/virtualizer.tsx +1321 -0
- package/src/session/timeline/voice-delegation.test.ts +69 -0
- package/src/session/timeline/voice-delegation.ts +38 -0
- package/src/session/title.ts +15 -0
- package/src/session/usage-exceeded-dialogs.test.ts +41 -0
- package/src/session/usage-exceeded-dialogs.tsx +158 -0
- package/src/session/viewed-machine.test.ts +27 -0
- package/src/session/viewed-machine.ts +24 -0
- package/src/settings/about/about.tsx +199 -0
- package/src/settings/about/animated-wordmark.tsx +85 -0
- package/src/settings/about/anomaly-brush.svg +1 -0
- package/src/settings/about/contributors.test.ts +17 -0
- package/src/settings/about/contributors.ts +27 -0
- package/src/settings/about/legal.svg +9 -0
- package/src/settings/about/machine.test.ts +90 -0
- package/src/settings/about/machine.ts +119 -0
- package/src/settings/about/notices/apache-2.0.txt +201 -0
- package/src/settings/about/notices/betteroffice-notice.txt +2 -0
- package/src/settings/about/notices/crates.ts +770 -0
- package/src/settings/about/notices/dialog.tsx +113 -0
- package/src/settings/about/notices/fonts/OFL-1.1.txt +91 -0
- package/src/settings/about/notices/fonts.ts +107 -0
- package/src/settings/about/notices/notices.ts +37 -0
- package/src/settings/appearance/appearance.tsx +176 -0
- package/src/settings/command.tsx +29 -0
- package/src/settings/experimental/experimental.tsx +93 -0
- package/src/settings/extension-load-machine.test.ts +117 -0
- package/src/settings/extension-load-machine.ts +158 -0
- package/src/settings/extension-load.tsx +85 -0
- package/src/settings/general/behavior.ts +102 -0
- package/src/settings/general/controllers.test.ts +56 -0
- package/src/settings/general/controllers.ts +271 -0
- package/src/settings/general/general.tsx +404 -0
- package/src/settings/general/interface-mode.css +261 -0
- package/src/settings/general/interface-mode.tsx +190 -0
- package/src/settings/general/machine.test.ts +188 -0
- package/src/settings/general/machine.ts +224 -0
- package/src/settings/general/sound-preview-machine.test.ts +114 -0
- package/src/settings/general/sound-preview-machine.ts +109 -0
- package/src/settings/keybinds/keybinds.tsx +624 -0
- package/src/settings/keybinds/machine.test.ts +142 -0
- package/src/settings/keybinds/machine.ts +149 -0
- package/src/settings/keybinds/migration.ts +42 -0
- package/src/settings/list.tsx +10 -0
- package/src/settings/model.test.ts +249 -0
- package/src/settings/model.tsx +685 -0
- package/src/settings/models/machine.test.ts +123 -0
- package/src/settings/models/machine.ts +161 -0
- package/src/settings/models/models.tsx +285 -0
- package/src/settings/navigation.tsx +223 -0
- package/src/settings/notifications/notifications.tsx +160 -0
- package/src/settings/pages.ts +33 -0
- package/src/settings/palette.ts +44 -0
- package/src/settings/providers/account-actions.ts +112 -0
- package/src/settings/providers/account-name.tsx +46 -0
- package/src/settings/providers/accounts.test.ts +29 -0
- package/src/settings/providers/accounts.ts +11 -0
- package/src/settings/providers/console-extensions.test.ts +103 -0
- package/src/settings/providers/console-extensions.ts +110 -0
- package/src/settings/providers/console-link.tsx +121 -0
- package/src/settings/providers/extensions.tsx +425 -0
- package/src/settings/providers/machine.test.ts +270 -0
- package/src/settings/providers/machine.ts +357 -0
- package/src/settings/providers/plugin-update-machine.test.ts +155 -0
- package/src/settings/providers/plugin-update-machine.ts +151 -0
- package/src/settings/providers/providers.tsx +702 -0
- package/src/settings/rename-machine.test.ts +123 -0
- package/src/settings/rename-machine.ts +167 -0
- package/src/settings/rename.ts +120 -0
- package/src/settings/route.test.ts +117 -0
- package/src/settings/route.ts +160 -0
- package/src/settings/row.tsx +21 -0
- package/src/settings/scroller.ts +6 -0
- package/src/settings/search-catalog.ts +319 -0
- package/src/settings/search-empty.tsx +87 -0
- package/src/settings/search-field.tsx +101 -0
- package/src/settings/search-index.ts +193 -0
- package/src/settings/search-machine.test.ts +249 -0
- package/src/settings/search-machine.ts +308 -0
- package/src/settings/search-results.test.ts +151 -0
- package/src/settings/search-results.ts +75 -0
- package/src/settings/search-reveal.ts +76 -0
- package/src/settings/search.css +168 -0
- package/src/settings/search.tsx +283 -0
- package/src/settings/server-scope.tsx +12 -0
- package/src/settings/servers/inventory.test.ts +50 -0
- package/src/settings/servers/inventory.ts +100 -0
- package/src/settings/servers/machine.test.ts +148 -0
- package/src/settings/servers/machine.ts +176 -0
- package/src/settings/servers/servers.tsx +178 -0
- package/src/settings/servers/switcher.tsx +77 -0
- package/src/settings/servers/unavailable.tsx +99 -0
- package/src/settings/settings.css +2478 -0
- package/src/settings/shell.standalone.stories.tsx +60 -0
- package/src/settings/shell.tsx +434 -0
- package/src/settings/surface.tsx +297 -0
- package/src/settings/tab-header.ts +12 -0
- package/src/settings/timeline-detail.css +334 -0
- package/src/settings/timeline-detail.stories.tsx +54 -0
- package/src/settings/timeline-detail.tsx +221 -0
- package/src/settings/workspaces/delete-machine.test.ts +298 -0
- package/src/settings/workspaces/delete-machine.ts +392 -0
- package/src/settings/workspaces/project-extensions.tsx +537 -0
- package/src/settings/workspaces/project-folder-missing.tsx +29 -0
- package/src/settings/workspaces/project-lsp.test.ts +65 -0
- package/src/settings/workspaces/project-lsp.ts +31 -0
- package/src/settings/workspaces/project-machine.test.ts +285 -0
- package/src/settings/workspaces/project-machine.ts +374 -0
- package/src/settings/workspaces/project-model.ts +201 -0
- package/src/settings/workspaces/project-options.tsx +81 -0
- package/src/settings/workspaces/project-row.tsx +121 -0
- package/src/settings/workspaces/project.css +397 -0
- package/src/settings/workspaces/project.tsx +266 -0
- package/src/settings/workspaces/projects.tsx +199 -0
- package/src/settings/workspaces/queries.ts +66 -0
- package/src/settings/workspaces/workspaces.tsx +705 -0
- package/src/shell/commands/command-search.tsx +41 -0
- package/src/shell/commands/command.test.ts +118 -0
- package/src/shell/commands/command.tsx +584 -0
- package/src/shell/commands/desktop-menu.test.ts +48 -0
- package/src/shell/commands/desktop-menu.ts +322 -0
- package/src/shell/commands/desktop.tsx +27 -0
- package/src/shell/commands/dialog.css +263 -0
- package/src/shell/commands/dialog.standalone.stories.tsx +247 -0
- package/src/shell/commands/dialog.tsx +318 -0
- package/src/shell/commands/highlight-machine.test.ts +64 -0
- package/src/shell/commands/highlight-machine.ts +54 -0
- package/src/shell/commands/key-sequence.tsx +38 -0
- package/src/shell/commands/keymap.test.ts +219 -0
- package/src/shell/commands/keymap.ts +275 -0
- package/src/shell/commands/palette.ts +466 -0
- package/src/shell/commands/safe-triangle.ts +64 -0
- package/src/shell/commands/search-machine.test.ts +218 -0
- package/src/shell/commands/search-machine.ts +274 -0
- package/src/shell/commands/search.ts +136 -0
- package/src/shell/commands/session-search.tsx +111 -0
- package/src/shell/commands/suspend-machine.test.ts +59 -0
- package/src/shell/commands/suspend-machine.ts +46 -0
- package/src/shell/deep-links/deep-links.ts +65 -0
- package/src/shell/deep-links/machine.test.ts +67 -0
- package/src/shell/deep-links/machine.ts +67 -0
- package/src/shell/errors/description.test.ts +32 -0
- package/src/shell/errors/description.ts +32 -0
- package/src/shell/errors/error.tsx +515 -0
- package/src/shell/errors/machine.test.ts +178 -0
- package/src/shell/errors/machine.ts +217 -0
- package/src/shell/layout/helpers.test.ts +76 -0
- package/src/shell/layout/helpers.ts +78 -0
- package/src/shell/layout/project-avatar-state.ts +157 -0
- package/src/shell/layout/project-icon.tsx +31 -0
- package/src/shell/layout/project-icons.tsx +34 -0
- package/src/shell/layout/session-tab-avatar.tsx +28 -0
- package/src/shell/mobile-drawer.css +90 -0
- package/src/shell/mobile-drawer.tsx +53 -0
- package/src/shell/mobile-panel-drawer.css +34 -0
- package/src/shell/mobile-panel-drawer.tsx +98 -0
- package/src/shell/notifications/coordinator.ts +160 -0
- package/src/shell/notifications/focus-lock-machine.test.ts +79 -0
- package/src/shell/notifications/focus-lock-machine.ts +76 -0
- package/src/shell/notifications/machine.test.ts +297 -0
- package/src/shell/notifications/machine.ts +313 -0
- package/src/shell/notifications/notification.test.ts +28 -0
- package/src/shell/notifications/notification.tsx +526 -0
- package/src/shell/notifications/sound.ts +113 -0
- package/src/shell/notifications/toast.tsx +53 -0
- package/src/shell/palette-menu.css +105 -0
- package/src/shell/panel-motion-machine.test.ts +167 -0
- package/src/shell/panel-motion-machine.ts +217 -0
- package/src/shell/panel-motion.test.ts +26 -0
- package/src/shell/panel-motion.ts +435 -0
- package/src/shell/project-navigation.ts +21 -0
- package/src/shell/routes/routes.tsx +140 -0
- package/src/shell/routes/session-reference-lookup-machine.test.ts +111 -0
- package/src/shell/routes/session-reference-lookup-machine.ts +86 -0
- package/src/shell/routes/session-ui-navigate-machine.test.ts +124 -0
- package/src/shell/routes/session-ui-navigate-machine.ts +127 -0
- package/src/shell/routes/session-ui-provider.tsx +267 -0
- package/src/shell/routes/session.test.ts +46 -0
- package/src/shell/routes/session.ts +30 -0
- package/src/shell/search-list.css +366 -0
- package/src/shell/shell.tsx +340 -0
- package/src/shell/sidebar-peek-machine.test.ts +240 -0
- package/src/shell/sidebar-peek-machine.ts +331 -0
- package/src/shell/sidebar-peek.css +28 -0
- package/src/shell/sidebar-peek.ts +482 -0
- package/src/shell/sidebar-toggle.tsx +255 -0
- package/src/shell/state/helpers.ts +69 -0
- package/src/shell/state/intent-machine.test.ts +155 -0
- package/src/shell/state/intent-machine.ts +216 -0
- package/src/shell/state/layout.test.ts +169 -0
- package/src/shell/state/layout.tsx +794 -0
- package/src/shell/state/scoped-machine.test.ts +69 -0
- package/src/shell/state/scoped-machine.ts +77 -0
- package/src/shell/state/scroll-machine.test.ts +109 -0
- package/src/shell/state/scroll-machine.ts +94 -0
- package/src/shell/state/scroll.test.ts +83 -0
- package/src/shell/state/scroll.ts +124 -0
- package/src/shell/state/session-preferences.ts +62 -0
- package/src/shell/state/session-tabs.test.ts +188 -0
- package/src/shell/state/session-tabs.ts +257 -0
- package/src/shell/tabs/closed.ts +83 -0
- package/src/shell/tabs/hydration-machine.test.ts +98 -0
- package/src/shell/tabs/hydration-machine.ts +115 -0
- package/src/shell/tabs/memory.ts +41 -0
- package/src/shell/tabs/navigation-switch.ts +75 -0
- package/src/shell/tabs/pins.test.ts +68 -0
- package/src/shell/tabs/pins.ts +194 -0
- package/src/shell/tabs/preview-machine.test.ts +89 -0
- package/src/shell/tabs/preview-machine.ts +46 -0
- package/src/shell/tabs/preview.test.ts +153 -0
- package/src/shell/tabs/preview.ts +102 -0
- package/src/shell/tabs/project-sessions.ts +60 -0
- package/src/shell/tabs/promotion-machine.test.ts +203 -0
- package/src/shell/tabs/promotion-machine.ts +194 -0
- package/src/shell/tabs/schema.ts +86 -0
- package/src/shell/tabs/tabs.test.ts +331 -0
- package/src/shell/tabs/tabs.tsx +927 -0
- package/src/shell/time.test.ts +23 -0
- package/src/shell/time.ts +31 -0
- package/src/shell/titlebar/auto-tab-groups.test.ts +76 -0
- package/src/shell/titlebar/auto-tab-groups.ts +88 -0
- package/src/shell/titlebar/auto-tab-sections.tsx +207 -0
- package/src/shell/titlebar/history-machine.test.ts +184 -0
- package/src/shell/titlebar/history-machine.ts +149 -0
- package/src/shell/titlebar/history.ts +64 -0
- package/src/shell/titlebar/inbox-branch-machine.test.ts +146 -0
- package/src/shell/titlebar/inbox-branch-machine.ts +265 -0
- package/src/shell/titlebar/inbox-card.stories.tsx +197 -0
- package/src/shell/titlebar/inbox-list.stories.tsx +342 -0
- package/src/shell/titlebar/inbox-model.ts +539 -0
- package/src/shell/titlebar/inbox-settle-machine.test.ts +108 -0
- package/src/shell/titlebar/inbox-settle-machine.ts +141 -0
- package/src/shell/titlebar/inbox-working.test.ts +26 -0
- package/src/shell/titlebar/inbox-working.ts +22 -0
- package/src/shell/titlebar/inbox.tsx +985 -0
- package/src/shell/titlebar/mobile-tabs-machine.test.ts +105 -0
- package/src/shell/titlebar/mobile-tabs-machine.ts +102 -0
- package/src/shell/titlebar/navigation-story.tsx +207 -0
- package/src/shell/titlebar/pinned-area.css +164 -0
- package/src/shell/titlebar/pinned-area.tsx +629 -0
- package/src/shell/titlebar/project-session-row.tsx +334 -0
- package/src/shell/titlebar/recent-sessions-model.test.ts +657 -0
- package/src/shell/titlebar/recent-sessions-model.ts +469 -0
- package/src/shell/titlebar/recent-sessions.tsx +1415 -0
- package/src/shell/titlebar/recent-view-menu.tsx +147 -0
- package/src/shell/titlebar/recent-view.test.ts +99 -0
- package/src/shell/titlebar/recent-view.ts +183 -0
- package/src/shell/titlebar/recently-closed-tabs-menu.css +25 -0
- package/src/shell/titlebar/recently-closed-tabs-menu.tsx +260 -0
- package/src/shell/titlebar/route-machine.test.ts +259 -0
- package/src/shell/titlebar/route-machine.ts +206 -0
- package/src/shell/titlebar/route-sync.ts +191 -0
- package/src/shell/titlebar/session-events.test.ts +23 -0
- package/src/shell/titlebar/session-events.ts +41 -0
- package/src/shell/titlebar/session-rename-dialog-machine.test.ts +151 -0
- package/src/shell/titlebar/session-rename-dialog-machine.ts +159 -0
- package/src/shell/titlebar/sidebar-customized.standalone.stories.tsx +16 -0
- package/src/shell/titlebar/sidebar-customized.tsx +747 -0
- package/src/shell/titlebar/sidebar-pins.tsx +462 -0
- package/src/shell/titlebar/sidebar-sessions.test.ts +96 -0
- package/src/shell/titlebar/sidebar-sessions.ts +29 -0
- package/src/shell/titlebar/sidebar-view-menu.tsx +191 -0
- package/src/shell/titlebar/sidebar-view.test.ts +185 -0
- package/src/shell/titlebar/sidebar-view.ts +208 -0
- package/src/shell/titlebar/tab-group-drag-machine.ts +1479 -0
- package/src/shell/titlebar/tab-groups-ui.tsx +1246 -0
- package/src/shell/titlebar/tab-groups.css +269 -0
- package/src/shell/titlebar/tab-groups.test.ts +667 -0
- package/src/shell/titlebar/tab-groups.ts +496 -0
- package/src/shell/titlebar/tab-hints-machine.test.ts +97 -0
- package/src/shell/titlebar/tab-hints-machine.ts +79 -0
- package/src/shell/titlebar/tab-load-machine.test.ts +178 -0
- package/src/shell/titlebar/tab-load-machine.ts +233 -0
- package/src/shell/titlebar/tab-nav.css +581 -0
- package/src/shell/titlebar/tab-nav.tsx +891 -0
- package/src/shell/titlebar/tab-order.test.ts +22 -0
- package/src/shell/titlebar/tab-order.ts +24 -0
- package/src/shell/titlebar/tab-popover-machine.test.ts +79 -0
- package/src/shell/titlebar/tab-popover-machine.ts +92 -0
- package/src/shell/titlebar/tab-popover.css +129 -0
- package/src/shell/titlebar/tab-popover.tsx +144 -0
- package/src/shell/titlebar/tab-rename-machine.test.ts +206 -0
- package/src/shell/titlebar/tab-rename-machine.ts +297 -0
- package/src/shell/titlebar/tab-strip.standalone.stories.tsx +19 -0
- package/src/shell/titlebar/tab-strip.tsx +1228 -0
- package/src/shell/titlebar/tab-title.test.ts +14 -0
- package/src/shell/titlebar/tab-title.ts +6 -0
- package/src/shell/titlebar/titlebar.css +197 -0
- package/src/shell/titlebar/titlebar.tsx +1075 -0
- package/src/shell/titlebar/windows-menu.test.ts +20 -0
- package/src/shell/titlebar/windows-menu.tsx +193 -0
- package/src/sst-env.d.ts +12 -0
- package/src/theme-preload.test.ts +56 -0
- package/src/tips/model.ts +155 -0
- package/src/tips/queue.test.ts +43 -0
- package/src/tips/queue.ts +46 -0
- package/src/usage/dialog.css +8 -0
- package/src/usage/dialog.standalone.stories.tsx +137 -0
- package/src/usage/dialog.tsx +570 -0
- package/src/usage/format.ts +39 -0
- package/src/usage/limits.test.ts +141 -0
- package/src/usage/limits.ts +189 -0
- package/src/usage/machine.test.ts +128 -0
- package/src/usage/machine.ts +159 -0
- package/src/usage/model.tsx +55 -0
- package/src/voice/call-machine.test.ts +245 -0
- package/src/voice/call-machine.ts +327 -0
- package/src/voice/call.ts +362 -0
- package/src/voice/composer.tsx +300 -0
- package/src/voice/context.tsx +152 -0
- package/src/voice/coordination.test.ts +58 -0
- package/src/voice/fixtures/history.ts +51 -0
- package/src/voice/gate-machine.test.ts +91 -0
- package/src/voice/gate-machine.ts +148 -0
- package/src/voice/handoff.test.ts +35 -0
- package/src/voice/handoff.ts +20 -0
- package/src/voice/machine.test.ts +303 -0
- package/src/voice/machine.ts +349 -0
- package/src/voice/messages.test.ts +49 -0
- package/src/voice/messages.ts +15 -0
- package/src/voice/panel-machine.test.ts +106 -0
- package/src/voice/panel-machine.ts +167 -0
- package/src/voice/protocol.ts +62 -0
- package/src/voice/replies.ts +71 -0
- package/src/voice/reply-machine.test.ts +290 -0
- package/src/voice/reply-machine.ts +303 -0
- package/src/voice/search.test.ts +35 -0
- package/src/voice/search.ts +134 -0
- package/src/voice/spec.ts +114 -0
- package/src/voice/tail-machine.test.ts +124 -0
- package/src/voice/tail-machine.ts +155 -0
- package/src/voice/tail.ts +55 -0
- package/src/voice/tools.test.ts +320 -0
- package/src/voice/tools.ts +336 -0
- package/src/voice/transport-machine.test.ts +295 -0
- package/src/voice/transport-machine.ts +338 -0
- package/src/voice/transport.test.ts +295 -0
- package/src/voice/transport.ts +313 -0
- package/src/voice/voice.css +84 -0
- package/src/workspaces/create.test.ts +120 -0
- package/src/workspaces/create.ts +23 -0
- package/src/workspaces/files/artifact.test.ts +103 -0
- package/src/workspaces/files/artifact.ts +74 -0
- package/src/workspaces/files/content-cache-accounting.test.ts +79 -0
- package/src/workspaces/files/content-cache.ts +74 -0
- package/src/workspaces/files/content-machine.test.ts +269 -0
- package/src/workspaces/files/content-machine.ts +243 -0
- package/src/workspaces/files/model.tsx +423 -0
- package/src/workspaces/files/path.test.ts +76 -0
- package/src/workspaces/files/path.ts +143 -0
- package/src/workspaces/files/tree-machine.test.ts +300 -0
- package/src/workspaces/files/tree-machine.ts +286 -0
- package/src/workspaces/files/tree-store.ts +142 -0
- package/src/workspaces/files/types.ts +85 -0
- package/src/workspaces/files/view-cache.ts +164 -0
- package/src/workspaces/files/watcher.test.ts +114 -0
- package/src/workspaces/files/watcher.ts +42 -0
- package/src/workspaces/inventory.test.ts +151 -0
- package/src/workspaces/inventory.ts +64 -0
- package/src/workspaces/location-machine.test.ts +135 -0
- package/src/workspaces/location-machine.ts +159 -0
- package/src/workspaces/location.tsx +111 -0
- package/src/workspaces/path-key.ts +5 -0
- package/src/workspaces/paths.test.ts +193 -0
- package/src/workspaces/paths.ts +123 -0
- package/src/workspaces/selection/combobox-machine.test.ts +286 -0
- package/src/workspaces/selection/combobox-machine.ts +331 -0
- package/src/workspaces/selection/dialog.css +234 -0
- package/src/workspaces/selection/dialog.standalone.stories.tsx +66 -0
- package/src/workspaces/selection/dialog.tsx +867 -0
- package/src/workspaces/selection/domain.test.ts +603 -0
- package/src/workspaces/selection/domain.ts +609 -0
- package/src/workspaces/selection/picker.test.ts +37 -0
- package/src/workspaces/selection/picker.tsx +77 -0
- package/src/workspaces/selection/policy.ts +8 -0
- package/src/workspaces/selection/queue-machine.test.ts +116 -0
- package/src/workspaces/selection/queue-machine.ts +203 -0
- package/src/workspaces/selection/tree-machine.test.ts +293 -0
- package/src/workspaces/selection/tree-machine.ts +506 -0
- package/test-browser/animated-presence-state.test.ts +134 -0
- package/test-browser/auto-scroll.test.ts +111 -0
- package/test-browser/browser-pane-model.test.ts +522 -0
- package/test-browser/child-store-eviction.test.ts +86 -0
- package/test-browser/command-palette-search.test.ts +157 -0
- package/test-browser/command-palette.test.ts +262 -0
- package/test-browser/composer-attachment-errors.test.tsx +140 -0
- package/test-browser/composer-attachment-ownership.test.tsx +132 -0
- package/test-browser/composer-drag-cancel.test.tsx +41 -0
- package/test-browser/composer-file-search.test.ts +183 -0
- package/test-browser/composer-ime.test.ts +58 -0
- package/test-browser/composer-submit-loading.test.ts +235 -0
- package/test-browser/composer-write-batch.test.ts +201 -0
- package/test-browser/draft-history-cache.test.ts +139 -0
- package/test-browser/elicitation-dock.test.ts +110 -0
- package/test-browser/file-tree-store.test.ts +113 -0
- package/test-browser/fixtures/model-selection.ts +646 -0
- package/test-browser/message-page-publication.test.ts +46 -0
- package/test-browser/model-selection.test.ts +25 -0
- package/test-browser/motion-dom.test.ts +367 -0
- package/test-browser/motion-spring.test.ts +75 -0
- package/test-browser/pane-drag.test.tsx +136 -0
- package/test-browser/panel-motion.test.ts +398 -0
- package/test-browser/persisted-consumers.test.ts +40 -0
- package/test-browser/playwright-config.test.ts +72 -0
- package/test-browser/plugin-catalog.test.ts +67 -0
- package/test-browser/plugin-link-check.test.ts +102 -0
- package/test-browser/plugin-migrations.test.ts +170 -0
- package/test-browser/plugin-primitives.test.ts +616 -0
- package/test-browser/plugin-server-stream.test.ts +88 -0
- package/test-browser/presence.test.ts +236 -0
- package/test-browser/project-avatar-hover.test.ts +143 -0
- package/test-browser/prompt-motion.test.ts +10 -0
- package/test-browser/prompt-persistence.test.ts +312 -0
- package/test-browser/prompt-scope.test.ts +15 -0
- package/test-browser/provider-catalog.test.ts +54 -0
- package/test-browser/pwa-route.test.ts +96 -0
- package/test-browser/question-dock.test.ts +128 -0
- package/test-browser/schema-persistence.test.ts +294 -0
- package/test-browser/selected-effect.test.ts +36 -0
- package/test-browser/server-connection-sync.test.ts +34 -0
- package/test-browser/server-notification-state.test.ts +662 -0
- package/test-browser/session-activity-elapsed.test.ts +62 -0
- package/test-browser/session-background.test.ts +377 -0
- package/test-browser/session-message-handoffs.test.ts +118 -0
- package/test-browser/session-resolution.test.ts +385 -0
- package/test-browser/settings-keybinds.test.ts +196 -0
- package/test-browser/shell-panel.test.ts +219 -0
- package/test-browser/sidebar-peek.test.ts +149 -0
- package/test-browser/solid-router-cleanup.test.ts +66 -0
- package/test-browser/solid-runtime.test.ts +95 -0
- package/test-browser/solid-virtual.test.ts +249 -0
- package/test-browser/ssh-composer.test.ts +41 -0
- package/test-browser/ssh-health.test.ts +142 -0
- package/test-browser/theme-preload.test.ts +9 -0
- package/test-browser/timeline-cache.test.ts +571 -0
- package/test-browser/timeline-projection.test.ts +363 -0
- package/test-browser/toast-owner.test.ts +66 -0
- package/test-browser/websearch-request.test.ts +277 -0
- package/tsconfig.json +35 -0
- package/vite.config.ts +62 -0
- package/vite.icons.test.ts +133 -0
- package/vite.icons.ts +65 -0
- package/vite.js +142 -0
- package/vite.pwa.ts +69 -0
|
@@ -0,0 +1,1321 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createVirtualizer,
|
|
3
|
+
defaultRangeExtractor,
|
|
4
|
+
elementScroll,
|
|
5
|
+
observeElementRect,
|
|
6
|
+
type Range,
|
|
7
|
+
type VirtualItem,
|
|
8
|
+
} from "@tanstack/solid-virtual"
|
|
9
|
+
import { isScrollKeyTarget, scrollKey, scrollKeyOwner, ScrollView } from "@zyro-sec/ui/scroll-view"
|
|
10
|
+
import { Predicate } from "effect"
|
|
11
|
+
import { Timeline, TimelineRow } from "@zyro-sec/session-ui/timeline/projection"
|
|
12
|
+
import { useLanguage } from "@/runtime/i18n/language"
|
|
13
|
+
import {
|
|
14
|
+
batch,
|
|
15
|
+
createEffect,
|
|
16
|
+
createMemo,
|
|
17
|
+
createSignal,
|
|
18
|
+
on,
|
|
19
|
+
onCleanup,
|
|
20
|
+
onMount,
|
|
21
|
+
Show,
|
|
22
|
+
untrack,
|
|
23
|
+
type Accessor,
|
|
24
|
+
type JSX,
|
|
25
|
+
} from "solid-js"
|
|
26
|
+
import { createStore, reconcile } from "solid-js/store"
|
|
27
|
+
import { Key } from "@solid-primitives/keyed"
|
|
28
|
+
import { createMediaQuery } from "@solid-primitives/media"
|
|
29
|
+
import type { createTimelineProjection } from "./projection"
|
|
30
|
+
import { observeElementOffsetReconnectAware } from "./observe-element-offset"
|
|
31
|
+
import { filterVirtualIndexes } from "./virtual-items"
|
|
32
|
+
import {
|
|
33
|
+
ACTIVATED,
|
|
34
|
+
CHECK_REQUESTED,
|
|
35
|
+
COLD_REVEAL_TIMEOUT,
|
|
36
|
+
coldMountFlushing,
|
|
37
|
+
coldMountHidden,
|
|
38
|
+
coldMountTailOnly,
|
|
39
|
+
createColdMountState,
|
|
40
|
+
DEACTIVATED,
|
|
41
|
+
DISPOSED,
|
|
42
|
+
SIZES_FLUSHED,
|
|
43
|
+
SIZES_FLUSHING,
|
|
44
|
+
transitionColdMount,
|
|
45
|
+
type ColdMountEffect,
|
|
46
|
+
type ColdMountEvent,
|
|
47
|
+
type ColdMountSample,
|
|
48
|
+
} from "./cold-mount"
|
|
49
|
+
import { prefersReducedMotion } from "@zyro-sec/ui/motion"
|
|
50
|
+
import { holdLandingWidth } from "@/shell/panel-motion"
|
|
51
|
+
import type { TimelineFollow } from "./follow"
|
|
52
|
+
import {
|
|
53
|
+
CONTACT_LOST_EVENT,
|
|
54
|
+
defersAdjustments,
|
|
55
|
+
END_EPSILON,
|
|
56
|
+
isTouchHeld,
|
|
57
|
+
MIN_OVERFLOW,
|
|
58
|
+
needsEndProbe,
|
|
59
|
+
ZOOM_SLACK,
|
|
60
|
+
} from "./machine"
|
|
61
|
+
|
|
62
|
+
const fallbackItemSize = 60
|
|
63
|
+
|
|
64
|
+
const pendingMarkdown = '[data-component="markdown"]:not([data-markdown-ready])'
|
|
65
|
+
|
|
66
|
+
const upwardKeys = new Set(["up", "page-up", "home"])
|
|
67
|
+
|
|
68
|
+
const settledEvent = { type: "scroll.settled", atReachableEnd: false } as const
|
|
69
|
+
|
|
70
|
+
const settledAtEndEvent = { type: "scroll.settled", atReachableEnd: true } as const
|
|
71
|
+
|
|
72
|
+
const touchStartEvent = { type: "touch.start", nested: false } as const
|
|
73
|
+
|
|
74
|
+
const nestedTouchStartEvent = { type: "touch.start", nested: true } as const
|
|
75
|
+
|
|
76
|
+
const touchEndEvent = { type: "touch.end", scrolling: false } as const
|
|
77
|
+
|
|
78
|
+
const touchMomentumEvent = { type: "touch.end", scrolling: true } as const
|
|
79
|
+
|
|
80
|
+
const pointerDownEvent = { type: "pointer.down" } as const
|
|
81
|
+
|
|
82
|
+
const pointerUpEvent = { type: "pointer.up" } as const
|
|
83
|
+
|
|
84
|
+
/** A row on screen: its key, the row it draws and where TanStack places it. */
|
|
85
|
+
type MountedRow = { key: string; row: TimelineRow.TimelineRow; item: VirtualItem }
|
|
86
|
+
|
|
87
|
+
const cache = new Map<
|
|
88
|
+
string,
|
|
89
|
+
{
|
|
90
|
+
measurements: VirtualItem[]
|
|
91
|
+
toolOpen: Record<string, boolean | undefined>
|
|
92
|
+
patchGroupKeys: Map<string, string>
|
|
93
|
+
presentationKey?: string
|
|
94
|
+
}
|
|
95
|
+
>()
|
|
96
|
+
|
|
97
|
+
type Projection = Pick<
|
|
98
|
+
ReturnType<typeof createTimelineProjection>,
|
|
99
|
+
"activeMessageID" | "messageByID" | "messageLastRowIndex" | "messageRowIndex" | "rowByKey" | "rows"
|
|
100
|
+
>
|
|
101
|
+
|
|
102
|
+
type Input = {
|
|
103
|
+
active?: Accessor<boolean>
|
|
104
|
+
sessionKey: Accessor<string>
|
|
105
|
+
presentationKey?: Accessor<string>
|
|
106
|
+
/** Whether what the user opened or closed survives a change of detail setting, as in the New timeline. */
|
|
107
|
+
keepsDisclosure?: boolean
|
|
108
|
+
projection: Projection
|
|
109
|
+
showHeader: Accessor<boolean>
|
|
110
|
+
/** Whether the timeline follows the newest content. Drives every anchoring decision. */
|
|
111
|
+
follow: TimelineFollow
|
|
112
|
+
scroll: Accessor<{ overflow: boolean; jump: boolean }>
|
|
113
|
+
onResumeScroll: (behavior?: ScrollBehavior) => void
|
|
114
|
+
focusComposer?: () => void
|
|
115
|
+
setScrollRef: (element: HTMLDivElement | undefined) => void
|
|
116
|
+
/** The rows' content changed height. */
|
|
117
|
+
onContentResize: () => void
|
|
118
|
+
/** Height of the composer region floating over the timeline's bottom edge, where the timeline fades out. */
|
|
119
|
+
bottomInset?: Accessor<number>
|
|
120
|
+
/** Room the status line needs past the 36px lane, so it keeps its gap to the activity pill. */
|
|
121
|
+
tailExtra?: Accessor<number>
|
|
122
|
+
setVisibleRef?: (element: HTMLDivElement | undefined) => void
|
|
123
|
+
onScheduleScrollState: (element: HTMLDivElement) => void
|
|
124
|
+
onUserScroll: (target?: EventTarget | null) => void
|
|
125
|
+
onHistoryScroll: () => void
|
|
126
|
+
canRenderImmediately?: (
|
|
127
|
+
row: TimelineRow.TimelineRow,
|
|
128
|
+
disclosure: Readonly<Record<string, boolean | undefined>>,
|
|
129
|
+
) => boolean
|
|
130
|
+
setRevealMessage?: (fn: (id: string, partID?: string) => void) => void
|
|
131
|
+
setScrollToEnd?: (fn: (behavior?: ScrollBehavior) => void) => void
|
|
132
|
+
/** Pages the timeline for keys pressed outside it, such as PageUp in the composer. */
|
|
133
|
+
setPage?: (fn: (direction: 1 | -1) => void) => void
|
|
134
|
+
reveal?: TimelineRouteReveal
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** A tool call the route asks this timeline to open on; `consume` marks its history entry attempted. */
|
|
138
|
+
export type TimelineRouteReveal = {
|
|
139
|
+
pending: () => { readonly entryKey: string; readonly target: string } | undefined
|
|
140
|
+
consume: (entryKey: string) => void
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
type ViewProps = {
|
|
144
|
+
header: JSX.Element
|
|
145
|
+
headerInset?: JSX.Element
|
|
146
|
+
bottomSpacer?: JSX.Element
|
|
147
|
+
deferred: (row: TimelineRow.TimelineRow) => boolean
|
|
148
|
+
renderRow: (row: Accessor<TimelineRow.TimelineRow>, onSizeChange?: () => void) => JSX.Element
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function createTimelineVirtualizer(input: Input) {
|
|
152
|
+
const language = useLanguage()
|
|
153
|
+
const active = () => input.active?.() !== false
|
|
154
|
+
const isDesktop = createMediaQuery("(min-width: 768px)")
|
|
155
|
+
const topOffset = () => (input.showHeader() ? 64 : isDesktop() ? 0 : 16)
|
|
156
|
+
// Reserved below the last row: a 36px lane for the live status row and its background hint, a 14px gap, then the
|
|
157
|
+
// activity pill and its 10px composer gap. Without hover the pill grows from 32px to its 44px touch size
|
|
158
|
+
// (composer-lane.css), and the tail grows with it. Both come and go inside it, so neither moves the rows above.
|
|
159
|
+
const touch = createMediaQuery("(hover: none)")
|
|
160
|
+
const tailSize = () => (touch() ? 104 : 92) + (input.tailExtra?.() ?? 0)
|
|
161
|
+
const ownerSessionKey = input.sessionKey()
|
|
162
|
+
const entry = cache.get(ownerSessionKey)
|
|
163
|
+
const cached = entry?.presentationKey === input.presentationKey?.() ? entry : undefined
|
|
164
|
+
const initialMeasurements = cached?.measurements
|
|
165
|
+
|
|
166
|
+
const [coldMount, setColdMount] = createSignal(
|
|
167
|
+
createColdMountState(!initialMeasurements?.length && input.follow.following()),
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
// Each flips once per mount, so the many hidden-phase transitions do not reach the rows or the range.
|
|
171
|
+
const coldHidden = createMemo(() => coldMountHidden(coldMount()))
|
|
172
|
+
const coldTailOnly = createMemo(() => coldMountTailOnly(coldMount()))
|
|
173
|
+
const [listRoot, setListRoot] = createSignal<HTMLDivElement>()
|
|
174
|
+
const [visibleArea, setVisibleArea] = createSignal<HTMLDivElement>()
|
|
175
|
+
const [viewRoot, setViewRoot] = createSignal<HTMLDivElement>()
|
|
176
|
+
const bottomInset = () => input.bottomInset?.() ?? 0
|
|
177
|
+
|
|
178
|
+
const [toolOpen, setToolOpen] = createStore<Record<string, boolean | undefined>>(
|
|
179
|
+
(input.keepsDisclosure ? entry : cached)?.toolOpen ?? {},
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
const patchGroupKeys = cached?.patchGroupKeys ?? new Map<string, string>()
|
|
183
|
+
createEffect(
|
|
184
|
+
on(
|
|
185
|
+
() => input.presentationKey?.(),
|
|
186
|
+
() => {
|
|
187
|
+
patchGroupKeys.clear()
|
|
188
|
+
|
|
189
|
+
if (!input.keepsDisclosure) setToolOpen(reconcile({}))
|
|
190
|
+
},
|
|
191
|
+
{ defer: true },
|
|
192
|
+
),
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
const [rendering, setRendering] = createStore({ scrollAdjustment: 0 })
|
|
196
|
+
|
|
197
|
+
const rows = input.projection.rows
|
|
198
|
+
const rowByKey = input.projection.rowByKey
|
|
199
|
+
|
|
200
|
+
const rowKeys = createMemo(() => rows().map(TimelineRow.key), undefined, {
|
|
201
|
+
equals: (previous, next) => previous.length === next.length && previous.every((key, index) => key === next[index]),
|
|
202
|
+
})
|
|
203
|
+
|
|
204
|
+
const knownKeys = new Set(rowKeys())
|
|
205
|
+
const addedKeys = new Set<string>()
|
|
206
|
+
|
|
207
|
+
const getItemKey = createMemo(() => {
|
|
208
|
+
const keys = rowKeys()
|
|
209
|
+
keys
|
|
210
|
+
.filter((key) => !knownKeys.has(key))
|
|
211
|
+
.forEach((key) => {
|
|
212
|
+
knownKeys.add(key)
|
|
213
|
+
addedKeys.add(key)
|
|
214
|
+
})
|
|
215
|
+
|
|
216
|
+
return (index: number) => keys[index] ?? `removed:${index}`
|
|
217
|
+
})
|
|
218
|
+
|
|
219
|
+
const rangeExtractor = createMemo(() => {
|
|
220
|
+
const id = input.projection.activeMessageID()
|
|
221
|
+
const active = id ? (input.projection.messageLastRowIndex().get(id) ?? -1) : -1
|
|
222
|
+
const initialTail = coldTailOnly() && input.follow.following()
|
|
223
|
+
const anchor = input.follow.anchor()
|
|
224
|
+
const anchored = anchor ? rowKeys().indexOf(anchor.key) : -1
|
|
225
|
+
|
|
226
|
+
return (range: Range) => {
|
|
227
|
+
// Batch a bounded cheap suffix, but stop before unknown/large content.
|
|
228
|
+
// A large tail still mounts alone before estimates expose earlier history.
|
|
229
|
+
const start = Math.max(0, range.startIndex - 2)
|
|
230
|
+
|
|
231
|
+
const boundary = initialTail
|
|
232
|
+
? rows()
|
|
233
|
+
.slice(start, range.count)
|
|
234
|
+
.findLastIndex(
|
|
235
|
+
(row) =>
|
|
236
|
+
!(
|
|
237
|
+
Predicate.isTagged(row, "AssistantPart") &&
|
|
238
|
+
row.group.type === "context" &&
|
|
239
|
+
row.group.refs.length <= 64 &&
|
|
240
|
+
!toolOpen[`context:${row.group.key}`]
|
|
241
|
+
) && !input.canRenderImmediately?.(row, toolOpen),
|
|
242
|
+
)
|
|
243
|
+
: -1
|
|
244
|
+
|
|
245
|
+
const first = Math.min(range.count - 1, start + boundary + 1)
|
|
246
|
+
|
|
247
|
+
const indexes = initialTail
|
|
248
|
+
? Array.from({ length: range.count - first }, (_, index) => first + index)
|
|
249
|
+
: defaultRangeExtractor({ ...range, overscan: 2 })
|
|
250
|
+
|
|
251
|
+
return filterVirtualIndexes(
|
|
252
|
+
[...new Set([...indexes, ...[active, anchored].filter((index) => index >= 0)])].sort((a, b) => a - b),
|
|
253
|
+
range.count,
|
|
254
|
+
)
|
|
255
|
+
}
|
|
256
|
+
})
|
|
257
|
+
|
|
258
|
+
const measuredElements = new WeakSet<Element>()
|
|
259
|
+
// The finger's last position, a measurement only: whether it is down is the follow machine's `isTouchHeld`.
|
|
260
|
+
let lastTouchY = 0
|
|
261
|
+
let touchTarget: EventTarget | null = null
|
|
262
|
+
// Size compensation deferred during one resize delivery, committed or dropped before the delivery ends.
|
|
263
|
+
let touchAdjustment = 0
|
|
264
|
+
let maxScroll = 0
|
|
265
|
+
let virtualContent: HTMLDivElement | undefined
|
|
266
|
+
let rowLayer: HTMLDivElement | undefined
|
|
267
|
+
// While a sidebar's spring moves the timeline's edge, rows keep the width they land at, centred on the timeline, so
|
|
268
|
+
// their text wraps once instead of on every frame. The first column in view (turn gaps span the row) keeps its start
|
|
269
|
+
// edge where it was.
|
|
270
|
+
holdLandingWidth(
|
|
271
|
+
() => rowLayer,
|
|
272
|
+
() => {
|
|
273
|
+
const top = listRoot()?.getBoundingClientRect().top ?? 0
|
|
274
|
+
|
|
275
|
+
return [
|
|
276
|
+
...(rowLayer?.querySelectorAll<HTMLElement>(
|
|
277
|
+
'[data-timeline-key] [data-timeline-row]:not([data-timeline-row="TurnGap"])',
|
|
278
|
+
) ?? []),
|
|
279
|
+
].find((row) => row.getBoundingClientRect().bottom > top)
|
|
280
|
+
},
|
|
281
|
+
)
|
|
282
|
+
let scrollTop = 0
|
|
283
|
+
// Reused for every scroll: the transition only reads it, so a scroll allocates nothing.
|
|
284
|
+
const scrollEvent = { type: "scroll" as const, scrollTop: 0, previousTop: 0, maxScroll: 0, previousMaxScroll: 0 }
|
|
285
|
+
const intentEvent = { type: "scroll.intent" as const, upward: false, overflow: false }
|
|
286
|
+
const touchDragEvent = { type: "touch.drag" as const, overflow: false }
|
|
287
|
+
let reportOffset: ((offset: number, scrolling: boolean) => void) | undefined
|
|
288
|
+
let reportRect: ((rect: { width: number; height: number }) => void) | undefined
|
|
289
|
+
// TanStack corrects the scroll position once for every row it resizes above the view, and each native write forces a
|
|
290
|
+
// layout. While a batch of sizes is applied, a request replaces the one before it, and the last is written once.
|
|
291
|
+
let scrollHeld = false
|
|
292
|
+
let heldScroll: (() => void) | undefined
|
|
293
|
+
const [headerHeight, setHeaderHeight] = createSignal(48)
|
|
294
|
+
|
|
295
|
+
const virtualizer = createVirtualizer<HTMLDivElement, HTMLDivElement>({
|
|
296
|
+
get count() {
|
|
297
|
+
return rows().length
|
|
298
|
+
},
|
|
299
|
+
getScrollElement: () => listRoot() ?? null,
|
|
300
|
+
// The viewport runs on under the composer region. The virtualizer sees only the part above it, which the
|
|
301
|
+
// inset spacer below the rows keeps consistent with the native scroll range.
|
|
302
|
+
observeElementRect: (instance, callback) => {
|
|
303
|
+
reportRect = (rect) => {
|
|
304
|
+
const root = listRoot()
|
|
305
|
+
batch(() => {
|
|
306
|
+
// The container-responsive header can be 48px or 80px.
|
|
307
|
+
setHeaderHeight(
|
|
308
|
+
root ? parseFloat(getComputedStyle(root).getPropertyValue("--session-header-height")) || 48 : 48,
|
|
309
|
+
)
|
|
310
|
+
callback({ width: rect.width, height: Math.max(0, rect.height - bottomInset()) })
|
|
311
|
+
})
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
return observeElementRect(instance, (rect) => {
|
|
315
|
+
if (active()) reportRect?.(rect)
|
|
316
|
+
})
|
|
317
|
+
},
|
|
318
|
+
// Route navigation detaches and reattaches the scroll element, which drops its offset.
|
|
319
|
+
observeElementOffset: (instance, callback) => {
|
|
320
|
+
reportOffset = (offset, scrolling) => {
|
|
321
|
+
if (!active()) return
|
|
322
|
+
// Rows and the sizer use the opposite translation while native touch
|
|
323
|
+
// scrolling keeps its own offset. Range selection uses the logical offset.
|
|
324
|
+
batch(() => {
|
|
325
|
+
const logicalOffset = offset + rendering.scrollAdjustment
|
|
326
|
+
callback(rendering.scrollAdjustment ? Math.max(0, logicalOffset) : offset, scrolling)
|
|
327
|
+
// Reconcile both start boundaries in one native write. Gradually
|
|
328
|
+
// clamping row translations lets the compositor paint between
|
|
329
|
+
// corrections and makes the content oscillate at the top.
|
|
330
|
+
const root = listRoot()
|
|
331
|
+
|
|
332
|
+
if (
|
|
333
|
+
rendering.scrollAdjustment !== 0 &&
|
|
334
|
+
root &&
|
|
335
|
+
(logicalOffset <= 0 || offset <= 0 || (isTouchHeld(input.follow.peek()) && offset <= root.clientHeight))
|
|
336
|
+
)
|
|
337
|
+
flushTouchAdjustment()
|
|
338
|
+
|
|
339
|
+
if (scrolling) return
|
|
340
|
+
|
|
341
|
+
if (!isTouchHeld(input.follow.peek())) flushTouchAdjustment()
|
|
342
|
+
input.follow.dispatch(
|
|
343
|
+
root && needsEndProbe(input.follow.peek()) && atReachableEnd(root) ? settledAtEndEvent : settledEvent,
|
|
344
|
+
)
|
|
345
|
+
})
|
|
346
|
+
dispatchCold(CHECK_REQUESTED)
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
return observeElementOffsetReconnectAware(instance, reportOffset, () => {
|
|
350
|
+
if (!active()) return
|
|
351
|
+
virtualContent?.querySelectorAll<HTMLDivElement>("[data-index]").forEach(virtualizer.measureElement)
|
|
352
|
+
|
|
353
|
+
if (input.follow.following()) virtualizer.scrollToEnd()
|
|
354
|
+
dispatchCold(CHECK_REQUESTED)
|
|
355
|
+
})
|
|
356
|
+
},
|
|
357
|
+
initialOffset: () => (input.follow.following() ? Number.MAX_SAFE_INTEGER : 0),
|
|
358
|
+
initialMeasurementsCache: initialMeasurements,
|
|
359
|
+
estimateSize: () => fallbackItemSize,
|
|
360
|
+
// A newly observed element gets a real ResizeObserver box before paint. Reuse
|
|
361
|
+
// its snapshot on attachment, but later explicit measurements must read layout
|
|
362
|
+
// so deferred/rewrapped content cannot keep stale, clipped heights (TanStack/virtual#1183).
|
|
363
|
+
measureElement: (element, entry, instance) => {
|
|
364
|
+
if (!active() || !element.isConnected)
|
|
365
|
+
return (
|
|
366
|
+
instance.itemSizeCache.get(instance.options.getItemKey(instance.indexFromElement(element))) ??
|
|
367
|
+
fallbackItemSize
|
|
368
|
+
)
|
|
369
|
+
const initial = !measuredElements.has(element)
|
|
370
|
+
measuredElements.add(element)
|
|
371
|
+
const box = entry?.borderBoxSize[0]
|
|
372
|
+
|
|
373
|
+
if (box) return Math.round(box.blockSize)
|
|
374
|
+
|
|
375
|
+
if (initial) {
|
|
376
|
+
const size = instance.itemSizeCache.get(instance.options.getItemKey(instance.indexFromElement(element)))
|
|
377
|
+
|
|
378
|
+
if (size !== undefined || untrack(coldHidden)) return size ?? fallbackItemSize
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
return element.offsetHeight
|
|
382
|
+
},
|
|
383
|
+
scrollToFn: (offset, options, instance) => {
|
|
384
|
+
if (!active()) return
|
|
385
|
+
|
|
386
|
+
if (coldMountFlushing(untrack(coldMount)) && input.follow.following()) return
|
|
387
|
+
touchAdjustment = 0
|
|
388
|
+
setRendering("scrollAdjustment", 0)
|
|
389
|
+
|
|
390
|
+
const write = () => {
|
|
391
|
+
if (virtualContent) virtualContent.style.height = `${instance.getTotalSize()}px`
|
|
392
|
+
elementScroll(offset, options, instance)
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
if (!scrollHeld) return write()
|
|
396
|
+
heldScroll = write
|
|
397
|
+
},
|
|
398
|
+
get getItemKey() {
|
|
399
|
+
return getItemKey()
|
|
400
|
+
},
|
|
401
|
+
get anchorTo() {
|
|
402
|
+
return input.follow.following() ? "end" : "start"
|
|
403
|
+
},
|
|
404
|
+
get followOnAppend() {
|
|
405
|
+
return input.follow.following()
|
|
406
|
+
},
|
|
407
|
+
scrollEndThreshold: 80,
|
|
408
|
+
get scrollMargin() {
|
|
409
|
+
// Empty projections still need the bottom spacer for running status.
|
|
410
|
+
return rows().length > 0 ? topOffset() : 0
|
|
411
|
+
},
|
|
412
|
+
get paddingEnd() {
|
|
413
|
+
return tailSize()
|
|
414
|
+
},
|
|
415
|
+
// Revealed prompts sit below the solid header and its 16px fade.
|
|
416
|
+
get scrollPaddingStart() {
|
|
417
|
+
return input.showHeader() ? headerHeight() + 16 : 0
|
|
418
|
+
},
|
|
419
|
+
get rangeExtractor() {
|
|
420
|
+
return rangeExtractor()
|
|
421
|
+
},
|
|
422
|
+
})
|
|
423
|
+
|
|
424
|
+
const resizeItem = virtualizer.resizeItem
|
|
425
|
+
const pendingSizes = new Map<number, { key: string; size: number }>()
|
|
426
|
+
let resizeScheduled = false
|
|
427
|
+
|
|
428
|
+
const flushHeldScroll = () => {
|
|
429
|
+
const write = heldScroll
|
|
430
|
+
heldScroll = undefined
|
|
431
|
+
write?.()
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// Read the whole measurement delivery before committing reactive row sizes.
|
|
435
|
+
// Otherwise each row can render and force layout before the next is measured.
|
|
436
|
+
virtualizer.resizeItem = (index, size) => {
|
|
437
|
+
if (!active()) return
|
|
438
|
+
const row = rows()[index]
|
|
439
|
+
|
|
440
|
+
if (!row) return
|
|
441
|
+
const key = TimelineRow.key(row)
|
|
442
|
+
|
|
443
|
+
if ((virtualizer.itemSizeCache.get(key) ?? fallbackItemSize) === size) {
|
|
444
|
+
pendingSizes.delete(index)
|
|
445
|
+
|
|
446
|
+
return
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
pendingSizes.set(index, { key, size })
|
|
450
|
+
|
|
451
|
+
if (resizeScheduled) return
|
|
452
|
+
resizeScheduled = true
|
|
453
|
+
queueMicrotask(() => {
|
|
454
|
+
resizeScheduled = false
|
|
455
|
+
|
|
456
|
+
if (!pendingSizes.size) return
|
|
457
|
+
const sizes = [...pendingSizes]
|
|
458
|
+
pendingSizes.clear()
|
|
459
|
+
|
|
460
|
+
if (!active()) {
|
|
461
|
+
touchAdjustment = 0
|
|
462
|
+
|
|
463
|
+
return
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
// The hidden pinned mount needs one bottom write after the whole batch,
|
|
467
|
+
// not a layout-forcing scroll adjustment for every measured row.
|
|
468
|
+
dispatchCold(SIZES_FLUSHING)
|
|
469
|
+
batch(() => {
|
|
470
|
+
scrollHeld = true
|
|
471
|
+
|
|
472
|
+
try {
|
|
473
|
+
sizes.forEach(([index, value]) => {
|
|
474
|
+
const row = rows()[index]
|
|
475
|
+
|
|
476
|
+
if (!row || TimelineRow.key(row) !== value.key) return
|
|
477
|
+
resizeItem(index, value.size)
|
|
478
|
+
|
|
479
|
+
// TanStack recalculates its range after each resize. Advance the
|
|
480
|
+
// logical fold before deciding whether the next row needs anchoring.
|
|
481
|
+
if (!touchAdjustment) return
|
|
482
|
+
const delta = touchAdjustment
|
|
483
|
+
touchAdjustment = 0
|
|
484
|
+
|
|
485
|
+
// A delta deferred under momentum that has since ended is dropped rather than translating the rows.
|
|
486
|
+
if (!defersAdjustments(input.follow.peek())) return
|
|
487
|
+
setRendering("scrollAdjustment", (value) => value + delta)
|
|
488
|
+
const root = listRoot()
|
|
489
|
+
|
|
490
|
+
if (!root) return
|
|
491
|
+
// The native offset is read next, so it has to include any correction still held.
|
|
492
|
+
flushHeldScroll()
|
|
493
|
+
reportOffset?.(root.scrollTop, virtualizer.isScrolling)
|
|
494
|
+
})
|
|
495
|
+
} finally {
|
|
496
|
+
scrollHeld = false
|
|
497
|
+
// Inside the batch, so what reacts to the new sizes reads the corrected offset, as it did with one write a row.
|
|
498
|
+
flushHeldScroll()
|
|
499
|
+
}
|
|
500
|
+
})
|
|
501
|
+
dispatchCold(SIZES_FLUSHED)
|
|
502
|
+
pinAnchor()
|
|
503
|
+
|
|
504
|
+
if (untrack(coldHidden)) pinColdBottom()
|
|
505
|
+
dispatchCold(CHECK_REQUESTED)
|
|
506
|
+
|
|
507
|
+
if (untrack(coldHidden) || !input.follow.following()) return
|
|
508
|
+
const root = listRoot()
|
|
509
|
+
|
|
510
|
+
// Reopening a settled scroll-to-end operation can fight subsequent keyboard scrolling.
|
|
511
|
+
if (root && !atReachableEnd(root)) virtualizer.scrollToEnd()
|
|
512
|
+
})
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
onCleanup(() => pendingSizes.clear())
|
|
516
|
+
virtualizer.shouldAdjustScrollPositionOnItemSizeChange = (item, delta, instance) => {
|
|
517
|
+
// Prepended rows can resize more than once as deferred content mounts. Keep
|
|
518
|
+
// compensating while they remain entirely above the visible content fold.
|
|
519
|
+
const first = instance.range?.startIndex
|
|
520
|
+
|
|
521
|
+
const adjust = addedKeys.has(String(item.key))
|
|
522
|
+
? item.end <= (instance.scrollOffset ?? 0) + instance.scrollAdjustments + instance.options.scrollMargin
|
|
523
|
+
: first !== undefined && item.index < first
|
|
524
|
+
|
|
525
|
+
if (!defersAdjustments(input.follow.peek())) return adjust
|
|
526
|
+
|
|
527
|
+
// iOS defers native scroll writes until momentum ends. Keep the same visual
|
|
528
|
+
// anchor now, rather than moving rows now and snapping the viewport back later.
|
|
529
|
+
if (adjust) touchAdjustment += delta
|
|
530
|
+
|
|
531
|
+
return false
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
// Scrolls to a tool call, named by its ID or by the shell ID a backgrounded shell call reports, and expands it and
|
|
535
|
+
// the collapsed context group that hides it. Returns whether the call is in the list.
|
|
536
|
+
function revealPart(target: string) {
|
|
537
|
+
if (!active()) return false
|
|
538
|
+
|
|
539
|
+
const matches = (ref: { messageID: string; partID: string }) => {
|
|
540
|
+
const content = Timeline.resolveContent(input.projection.messageByID().get(ref.messageID), ref.partID)
|
|
541
|
+
|
|
542
|
+
return (
|
|
543
|
+
content?.type === "tool" &&
|
|
544
|
+
(content.id === target || (content.state.status !== "streaming" && content.state.metadata?.shellID === target))
|
|
545
|
+
)
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
const found = rows()
|
|
549
|
+
.flatMap((row, index) =>
|
|
550
|
+
Predicate.isTagged(row, "AssistantPart")
|
|
551
|
+
? (row.group.type === "part" ? [row.group.ref] : row.group.refs).flatMap((ref) =>
|
|
552
|
+
matches(ref) ? [{ group: row.group, index, partID: ref.partID }] : [],
|
|
553
|
+
)
|
|
554
|
+
: [],
|
|
555
|
+
)
|
|
556
|
+
.at(-1)
|
|
557
|
+
|
|
558
|
+
if (!found) return false
|
|
559
|
+
|
|
560
|
+
const key = found.group.key
|
|
561
|
+
|
|
562
|
+
prepareNavigation()
|
|
563
|
+
// Opening the group and anchoring its row render the tool synchronously, wherever the row is.
|
|
564
|
+
batch(() => {
|
|
565
|
+
setToolOpen(
|
|
566
|
+
found.group.type === "context"
|
|
567
|
+
? { [`context:${key}`]: true, [`${key}:tool:${found.partID}`]: true }
|
|
568
|
+
: { [key]: true },
|
|
569
|
+
)
|
|
570
|
+
input.follow.dispatch({
|
|
571
|
+
type: "anchor",
|
|
572
|
+
anchor: { key: TimelineRow.key(rows()[found.index]!), partID: found.partID },
|
|
573
|
+
})
|
|
574
|
+
})
|
|
575
|
+
// Until its ResizeObserver delivers, the opened row keeps its collapsed size, so the timeline may not scroll yet
|
|
576
|
+
// or ends above the tool. Commit the real size first.
|
|
577
|
+
const opened = virtualContent?.querySelector<HTMLElement>(`[data-index="${found.index}"]`)
|
|
578
|
+
|
|
579
|
+
if (opened) resizeItem(found.index, opened.offsetHeight)
|
|
580
|
+
pinAnchor()
|
|
581
|
+
|
|
582
|
+
return true
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
// Puts the anchored row's top edge at its scroll margin, just below the headers that stick above it. Its own
|
|
586
|
+
// growth extends downward, so only size changes at or above its row can move it; each of those calls this again.
|
|
587
|
+
function pinAnchor() {
|
|
588
|
+
const anchor = input.follow.anchor()
|
|
589
|
+
const root = listRoot()
|
|
590
|
+
|
|
591
|
+
if (!anchor || !root || !active()) return
|
|
592
|
+
|
|
593
|
+
if (!rowByKey().has(anchor.key)) return input.follow.dispatch({ type: "release" })
|
|
594
|
+
const row = virtualContent?.querySelector<HTMLElement>(`[data-timeline-key="${CSS.escape(anchor.key)}"]`)
|
|
595
|
+
|
|
596
|
+
// A row that has not mounted yet pins once its first measurement lands.
|
|
597
|
+
if (!row) return
|
|
598
|
+
|
|
599
|
+
// A tool inside a group of several names them all on the group; pin the group, or else the row.
|
|
600
|
+
const element =
|
|
601
|
+
row.querySelector<HTMLElement>(`[data-timeline-part-id="${CSS.escape(anchor.partID)}"]`) ??
|
|
602
|
+
[...row.querySelectorAll<HTMLElement>("[data-timeline-part-ids]")].find((group) =>
|
|
603
|
+
group.dataset.timelinePartIds!.split(",").includes(anchor.partID),
|
|
604
|
+
) ??
|
|
605
|
+
row
|
|
606
|
+
|
|
607
|
+
const offset = Math.min(
|
|
608
|
+
root.scrollHeight - root.clientHeight,
|
|
609
|
+
Math.max(
|
|
610
|
+
0,
|
|
611
|
+
root.scrollTop +
|
|
612
|
+
element.getBoundingClientRect().top -
|
|
613
|
+
root.getBoundingClientRect().top -
|
|
614
|
+
parseFloat(getComputedStyle(element).scrollMarginTop),
|
|
615
|
+
),
|
|
616
|
+
)
|
|
617
|
+
|
|
618
|
+
// Hand over every pin, even one the scroll already reaches: TanStack lands exactly on its last target once the
|
|
619
|
+
// scroll is within a pixel of it, which would undo a compensation for a row above that resized since.
|
|
620
|
+
virtualizer.scrollToOffset(offset)
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
// An anchored row that leaves the list lets its anchor go. Reads the rows only while anchored, never while scrolling.
|
|
624
|
+
createEffect(() => {
|
|
625
|
+
const anchor = input.follow.anchor()
|
|
626
|
+
|
|
627
|
+
if (anchor && active() && !rowByKey().has(anchor.key)) input.follow.dispatch({ type: "release" })
|
|
628
|
+
})
|
|
629
|
+
|
|
630
|
+
function prepareNavigation() {
|
|
631
|
+
input.follow.dispatch({ type: "release" })
|
|
632
|
+
flushTouchAdjustment()
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
function flushTouchAdjustment() {
|
|
636
|
+
touchAdjustment = 0
|
|
637
|
+
const adjustment = rendering.scrollAdjustment
|
|
638
|
+
const root = listRoot()
|
|
639
|
+
|
|
640
|
+
if (!adjustment || !root) return
|
|
641
|
+
// Transfer the translation into the native offset in the same paint.
|
|
642
|
+
batch(() => {
|
|
643
|
+
setRendering("scrollAdjustment", 0)
|
|
644
|
+
|
|
645
|
+
if (virtualContent) virtualContent.style.height = `${virtualizer.getTotalSize()}px`
|
|
646
|
+
elementScroll(Math.max(0, root.scrollTop + adjustment), {}, virtualizer)
|
|
647
|
+
})
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
// A row mounts with the row and the place it draws, so it never has to find either. TanStack lists the rows it last
|
|
651
|
+
// read, which one flush can replace before it reads them again; a listed key the projection dropped is not a row.
|
|
652
|
+
// One row mounts per key: a turn interrupted twice has two dividers under one key, and one measurement.
|
|
653
|
+
const mountedRows = createMemo(() => [
|
|
654
|
+
...new Map(
|
|
655
|
+
virtualizer.getVirtualItems().flatMap((item): [string, MountedRow][] => {
|
|
656
|
+
const key = String(item.key)
|
|
657
|
+
const row = rowByKey().get(key)
|
|
658
|
+
|
|
659
|
+
return row ? [[key, { key, row, item }]] : []
|
|
660
|
+
}),
|
|
661
|
+
).values(),
|
|
662
|
+
])
|
|
663
|
+
|
|
664
|
+
createEffect(() => {
|
|
665
|
+
if (!active()) return
|
|
666
|
+
const root = listRoot()
|
|
667
|
+
|
|
668
|
+
if (root) input.setScrollRef(root)
|
|
669
|
+
input.setVisibleRef?.(visibleArea())
|
|
670
|
+
queueMicrotask(() => {
|
|
671
|
+
if (!active() || !root?.isConnected) return
|
|
672
|
+
// A detached view can miss its nonzero ResizeObserver delivery. Publish
|
|
673
|
+
// its real viewport before restoring the offset and admitting rows.
|
|
674
|
+
reportRect?.({ width: root.offsetWidth, height: root.offsetHeight })
|
|
675
|
+
|
|
676
|
+
// A route can open this timeline on a tool call, e.g. a shell picked from inside a subagent, instead of its end.
|
|
677
|
+
// It is attempted once per history entry: a call that is not in the list is not looked for again on reattach.
|
|
678
|
+
const reveal = input.reveal?.pending()
|
|
679
|
+
const revealed = !!reveal && revealPart(reveal.target)
|
|
680
|
+
|
|
681
|
+
if (reveal) input.reveal?.consume(reveal.entryKey)
|
|
682
|
+
|
|
683
|
+
if (!revealed && input.follow.following()) virtualizer.scrollToEnd()
|
|
684
|
+
|
|
685
|
+
reportOffset?.(root.scrollTop, false)
|
|
686
|
+
dispatchCold(CHECK_REQUESTED)
|
|
687
|
+
})
|
|
688
|
+
input.setRevealMessage?.((id, partID) => {
|
|
689
|
+
if (!active()) return
|
|
690
|
+
|
|
691
|
+
const partIndex = partID
|
|
692
|
+
? rows().findIndex(
|
|
693
|
+
(row) =>
|
|
694
|
+
Predicate.isTagged(row, "AssistantPart") && row.group.type === "part" && row.group.ref.partID === partID,
|
|
695
|
+
)
|
|
696
|
+
: -1
|
|
697
|
+
|
|
698
|
+
const promptIndex = rows().findIndex((row) => Predicate.isTagged(row, "UserMessage") && row.userMessageID === id)
|
|
699
|
+
|
|
700
|
+
const index =
|
|
701
|
+
partIndex >= 0 ? partIndex : promptIndex >= 0 ? promptIndex : input.projection.messageRowIndex().get(id)
|
|
702
|
+
|
|
703
|
+
if (index === undefined) return
|
|
704
|
+
prepareNavigation()
|
|
705
|
+
virtualizer.scrollToIndex(index, { align: partIndex >= 0 ? "center" : "start" })
|
|
706
|
+
})
|
|
707
|
+
input.setScrollToEnd?.((behavior) => {
|
|
708
|
+
const root = listRoot()
|
|
709
|
+
|
|
710
|
+
if (!active() || !root?.isConnected) return
|
|
711
|
+
flushTouchAdjustment()
|
|
712
|
+
input.follow.dispatch({ type: "follow" })
|
|
713
|
+
|
|
714
|
+
// Glide only the final screen. Crossing the whole history smoothly would stream every row through the virtualizer.
|
|
715
|
+
if (behavior === "smooth")
|
|
716
|
+
virtualizer.scrollToOffset(Math.max(root.scrollTop, root.scrollHeight - root.clientHeight * 2))
|
|
717
|
+
virtualizer.scrollToEnd({ behavior })
|
|
718
|
+
})
|
|
719
|
+
input.setPage?.((direction) => {
|
|
720
|
+
const root = listRoot()
|
|
721
|
+
|
|
722
|
+
if (!active() || !root?.isConnected) return
|
|
723
|
+
prepareNavigation()
|
|
724
|
+
input.onUserScroll(root)
|
|
725
|
+
dispatchIntent(direction < 0)
|
|
726
|
+
// Like the timeline's own PageUp: 80% of a page, measured above the composer that covers its bottom. The scroll
|
|
727
|
+
// event then pins at the end or loads older history near the top, as a wheel scroll does.
|
|
728
|
+
virtualizer.scrollToOffset(root.scrollTop + direction * (visibleArea()?.clientHeight || root.clientHeight) * 0.8)
|
|
729
|
+
})
|
|
730
|
+
})
|
|
731
|
+
|
|
732
|
+
createEffect(
|
|
733
|
+
on(
|
|
734
|
+
bottomInset,
|
|
735
|
+
() => {
|
|
736
|
+
const root = listRoot()
|
|
737
|
+
|
|
738
|
+
if (active() && root?.isConnected) reportRect?.({ width: root.offsetWidth, height: root.offsetHeight })
|
|
739
|
+
},
|
|
740
|
+
{ defer: true },
|
|
741
|
+
),
|
|
742
|
+
)
|
|
743
|
+
|
|
744
|
+
// The content is as tall as the rows the virtualizer sizes, so it reports that height rather than the session
|
|
745
|
+
// observing the element. A ResizeObserver there sees the height a row's own observer commits during its delivery, and
|
|
746
|
+
// Chrome reports every such frame as "ResizeObserver loop completed with undelivered notifications."
|
|
747
|
+
createEffect(
|
|
748
|
+
on([active, () => virtualizer.getTotalSize() - rendering.scrollAdjustment], () => {
|
|
749
|
+
if (active()) input.onContentResize()
|
|
750
|
+
}),
|
|
751
|
+
)
|
|
752
|
+
|
|
753
|
+
// Only the viewport carries the inset as a variable, for its fade and scroll padding. The variable does not inherit
|
|
754
|
+
// (see index.css): the inset changes on every frame while the composer region grows, and an inherited variable would
|
|
755
|
+
// restyle every rendered row each time.
|
|
756
|
+
createEffect(() => listRoot()?.style.setProperty("--session-timeline-inset", `${bottomInset()}px`))
|
|
757
|
+
|
|
758
|
+
let contentObserver: MutationObserver | undefined
|
|
759
|
+
let viewportObserver: ResizeObserver | undefined
|
|
760
|
+
let revealTimer: ReturnType<typeof setTimeout> | undefined
|
|
761
|
+
|
|
762
|
+
// Within the zoom slack only a write finds the end the browser reaches: one that does not move proves the view is
|
|
763
|
+
// already there, and one that does is undone before anything paints.
|
|
764
|
+
function atReachableEnd(root: HTMLDivElement) {
|
|
765
|
+
const top = root.scrollTop
|
|
766
|
+
const distance = root.scrollHeight - root.clientHeight - top
|
|
767
|
+
|
|
768
|
+
if (distance <= END_EPSILON) return true
|
|
769
|
+
|
|
770
|
+
if (distance > ZOOM_SLACK) return false
|
|
771
|
+
root.scrollTop = root.scrollHeight
|
|
772
|
+
|
|
773
|
+
if (root.scrollTop === top) return true
|
|
774
|
+
root.scrollTop = top
|
|
775
|
+
|
|
776
|
+
return false
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
// Returns whether the view now rests at its end with that offset reported.
|
|
780
|
+
const pinColdBottom = () => {
|
|
781
|
+
if (!active()) return false
|
|
782
|
+
const root = listRoot()
|
|
783
|
+
|
|
784
|
+
if (!input.follow.following() || !virtualContent || !root) return false
|
|
785
|
+
// scrollToEnd computes its target from the DOM, not the new size cache.
|
|
786
|
+
virtualContent.style.height = `${virtualizer.getTotalSize()}px`
|
|
787
|
+
|
|
788
|
+
if (!atReachableEnd(root)) virtualizer.scrollToEnd()
|
|
789
|
+
|
|
790
|
+
// Report after core size adjustments finish so they cannot apply a delta
|
|
791
|
+
// twice. This avoids waiting a frame for the native scroll event.
|
|
792
|
+
if (virtualizer.scrollOffset !== root.scrollTop) reportOffset?.(root.scrollTop, false)
|
|
793
|
+
|
|
794
|
+
return true
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
const pendingMeasurements = () => {
|
|
798
|
+
const items = virtualizer.getVirtualItems()
|
|
799
|
+
|
|
800
|
+
return (
|
|
801
|
+
(rows().length > 0 && items.length === 0) ||
|
|
802
|
+
items.some((item) => !virtualizer.elementsCache.get(item.key)?.isConnected)
|
|
803
|
+
)
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
// The machine decides; this only runs what it asks for. Its state is set before any effect runs, so a check
|
|
807
|
+
// requested again from inside a pin joins the running one.
|
|
808
|
+
function dispatchCold(event: ColdMountEvent) {
|
|
809
|
+
const current = untrack(coldMount)
|
|
810
|
+
const next = transitionColdMount(current, event)
|
|
811
|
+
|
|
812
|
+
if (next.state !== current) setColdMount(next.state)
|
|
813
|
+
next.effects.forEach(runColdEffect)
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
function runColdEffect(effect: ColdMountEffect) {
|
|
817
|
+
if (effect.type === "observe") {
|
|
818
|
+
if (!virtualContent) return
|
|
819
|
+
contentObserver = new MutationObserver(() => dispatchCold(CHECK_REQUESTED))
|
|
820
|
+
contentObserver.observe(virtualContent, {
|
|
821
|
+
childList: true,
|
|
822
|
+
subtree: true,
|
|
823
|
+
attributes: true,
|
|
824
|
+
attributeFilter: ["data-markdown-ready"],
|
|
825
|
+
})
|
|
826
|
+
viewportObserver = new ResizeObserver(() => dispatchCold(CHECK_REQUESTED))
|
|
827
|
+
const root = listRoot()
|
|
828
|
+
|
|
829
|
+
if (root) viewportObserver.observe(root)
|
|
830
|
+
|
|
831
|
+
return
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
if (effect.type === "timer.start") {
|
|
835
|
+
clearTimeout(revealTimer)
|
|
836
|
+
revealTimer = setTimeout(() => dispatchCold({ type: "timeout", attempt: effect.attempt }), COLD_REVEAL_TIMEOUT)
|
|
837
|
+
|
|
838
|
+
return
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
if (effect.type === "timer.cancel") {
|
|
842
|
+
clearTimeout(revealTimer)
|
|
843
|
+
|
|
844
|
+
return
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
if (effect.type === "check.schedule") {
|
|
848
|
+
queueMicrotask(() => dispatchCold({ type: "check.ready", attempt: effect.attempt }))
|
|
849
|
+
|
|
850
|
+
return
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
if (effect.type === "check.sample") {
|
|
854
|
+
dispatchCold({ type: "check.sampled", attempt: effect.attempt, sample: sampleColdMount() })
|
|
855
|
+
|
|
856
|
+
return
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
// The fallback reveals whatever has rendered, at the end a pinned view follows.
|
|
860
|
+
if (effect.type === "pin") {
|
|
861
|
+
pinColdBottom()
|
|
862
|
+
|
|
863
|
+
return
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
clearTimeout(revealTimer)
|
|
867
|
+
contentObserver?.disconnect()
|
|
868
|
+
viewportObserver?.disconnect()
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
function sampleColdMount(): ColdMountSample {
|
|
872
|
+
const root = listRoot()
|
|
873
|
+
|
|
874
|
+
if (!virtualContent?.isConnected || !root || virtualContent.querySelector(pendingMarkdown) || !root.clientHeight)
|
|
875
|
+
return "waiting"
|
|
876
|
+
// Markdown can finish before ResizeObserver delivers its new box. The
|
|
877
|
+
// normal measureElement path skips reads while scrolling; this gate needs
|
|
878
|
+
// current boxes before expanding the estimated range or revealing it.
|
|
879
|
+
virtualizer.elementsCache.forEach((element) => {
|
|
880
|
+
if (element.isConnected) virtualizer.resizeItem(virtualizer.indexFromElement(element), element.offsetHeight)
|
|
881
|
+
})
|
|
882
|
+
|
|
883
|
+
if (pendingSizes.size || pendingMeasurements()) return "waiting"
|
|
884
|
+
const pinned = input.follow.following()
|
|
885
|
+
|
|
886
|
+
// A pinned view rests at the end pinColdBottom reaches. Under page zoom that end can be more than a pixel short
|
|
887
|
+
// of scrollHeight - clientHeight, and TanStack keeps the offset it wrote rather than the one reached. Waiting
|
|
888
|
+
// for either distance to close never ends: each pass reported the offset again, which queued the next pass as
|
|
889
|
+
// a microtask, and the renderer froze.
|
|
890
|
+
if (pinned && !pinColdBottom()) return "waiting"
|
|
891
|
+
|
|
892
|
+
// The scroll event must update the range before newly exposed rows can reveal.
|
|
893
|
+
if (
|
|
894
|
+
!pinned &&
|
|
895
|
+
root.scrollHeight > root.clientHeight &&
|
|
896
|
+
Math.abs((virtualizer.scrollOffset ?? 0) - root.scrollTop) > 1
|
|
897
|
+
)
|
|
898
|
+
return "waiting"
|
|
899
|
+
|
|
900
|
+
if (pendingSizes.size || pendingMeasurements() || virtualContent.querySelector(pendingMarkdown)) return "pinned"
|
|
901
|
+
|
|
902
|
+
return "settled"
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
onMount(() => dispatchCold({ type: "mounted", active: active() }))
|
|
906
|
+
createEffect(
|
|
907
|
+
on(
|
|
908
|
+
active,
|
|
909
|
+
(value) => {
|
|
910
|
+
dispatchCold(value ? ACTIVATED : DEACTIVATED)
|
|
911
|
+
|
|
912
|
+
if (value) return
|
|
913
|
+
// A view that goes inactive mid-touch never sees its finger lift; its translation would outlive the gesture.
|
|
914
|
+
clearTouchTarget()
|
|
915
|
+
flushTouchAdjustment()
|
|
916
|
+
setRendering("scrollAdjustment", 0)
|
|
917
|
+
|
|
918
|
+
if (input.sessionKey() === ownerSessionKey) input.follow.dispatch(CONTACT_LOST_EVENT)
|
|
919
|
+
},
|
|
920
|
+
{ defer: true },
|
|
921
|
+
),
|
|
922
|
+
)
|
|
923
|
+
|
|
924
|
+
let measuredSessionKey = input.sessionKey()
|
|
925
|
+
createEffect(() => {
|
|
926
|
+
const key = input.sessionKey()
|
|
927
|
+
|
|
928
|
+
if (measuredSessionKey !== key) {
|
|
929
|
+
measuredSessionKey = key
|
|
930
|
+
virtualizer.measure()
|
|
931
|
+
}
|
|
932
|
+
})
|
|
933
|
+
|
|
934
|
+
const bindListRoot = (root: HTMLDivElement) => {
|
|
935
|
+
if (root === listRoot()) return
|
|
936
|
+
// TanStack owns anchoring; browser scroll anchoring would fight its adjustments.
|
|
937
|
+
root.style.overflowAnchor = "none"
|
|
938
|
+
setListRoot(root)
|
|
939
|
+
scrollTop = root.scrollTop
|
|
940
|
+
maxScroll = root.scrollHeight - root.clientHeight
|
|
941
|
+
|
|
942
|
+
if (active()) input.setScrollRef(root)
|
|
943
|
+
viewportObserver?.observe(root)
|
|
944
|
+
dispatchCold(CHECK_REQUESTED)
|
|
945
|
+
// The scrollbar thumb sits beside the viewport and stops its pointerdown from propagating, so
|
|
946
|
+
// listen on the ScrollView root in the capture phase: thumb drags are user scrolls too.
|
|
947
|
+
const scrollView = root.parentElement
|
|
948
|
+
|
|
949
|
+
if (!scrollView) return
|
|
950
|
+
scrollView.addEventListener("pointerdown", handleListPointerDown, { capture: true })
|
|
951
|
+
onCleanup(() => scrollView.removeEventListener("pointerdown", handleListPointerDown, { capture: true }))
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
// Upward input is the one intent geometry cannot recover: nudging up while still a pixel from
|
|
955
|
+
// the end must stop following, even though the resulting position still looks like the end.
|
|
956
|
+
// Only an upward intent reads the scroll range, as content that does not overflow cannot move.
|
|
957
|
+
function dispatchIntent(upward: boolean) {
|
|
958
|
+
const root = listRoot()
|
|
959
|
+
intentEvent.upward = upward
|
|
960
|
+
intentEvent.overflow = upward && !!root && root.scrollHeight - root.clientHeight > MIN_OVERFLOW
|
|
961
|
+
input.follow.dispatch(intentEvent)
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
const handleListWheel = (event: WheelEvent) => {
|
|
965
|
+
if (!active()) return
|
|
966
|
+
input.onUserScroll(event.target)
|
|
967
|
+
dispatchIntent(event.deltaY < 0)
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
const handleListTouchStart = (event: TouchEvent) => {
|
|
971
|
+
clearTouchTarget()
|
|
972
|
+
|
|
973
|
+
const touch = event.touches[0]
|
|
974
|
+
|
|
975
|
+
if (!active() || !touch) return
|
|
976
|
+
input.onUserScroll(event.target)
|
|
977
|
+
lastTouchY = touch.clientY
|
|
978
|
+
const root = listRoot()
|
|
979
|
+
const nested = event.target instanceof Element ? event.target.closest<HTMLElement>("[data-scrollable]") : null
|
|
980
|
+
|
|
981
|
+
input.follow.dispatch(
|
|
982
|
+
nested && nested !== root && nested.scrollHeight > nested.clientHeight ? nestedTouchStartEvent : touchStartEvent,
|
|
983
|
+
)
|
|
984
|
+
// Native touch events keep their original target, even when streaming or
|
|
985
|
+
// virtualization detaches it. Listen there instead of relying on bubbling.
|
|
986
|
+
touchTarget = event.target
|
|
987
|
+
touchTarget?.addEventListener("touchmove", handleListTouchMove, { passive: true })
|
|
988
|
+
touchTarget?.addEventListener("touchend", handleListTouchEnd, { passive: true })
|
|
989
|
+
touchTarget?.addEventListener("touchcancel", handleListTouchEnd, { passive: true })
|
|
990
|
+
|
|
991
|
+
if (root) reportOffset?.(root.scrollTop, virtualizer.isScrolling)
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
const handleListTouchMove = (event: Event) => {
|
|
995
|
+
if (!(event instanceof TouchEvent)) return
|
|
996
|
+
const current = event.touches[0]?.clientY
|
|
997
|
+
|
|
998
|
+
if (current === undefined) return
|
|
999
|
+
const previous = lastTouchY
|
|
1000
|
+
lastTouchY = current
|
|
1001
|
+
|
|
1002
|
+
// A retained target can outlive its whole session view. Only the active timeline may change the shared follow
|
|
1003
|
+
// state, and only while the finger it started with is still down; release still cleans up below.
|
|
1004
|
+
if (!active() || !isTouchHeld(input.follow.peek())) return
|
|
1005
|
+
|
|
1006
|
+
// Dragging the content downward reveals earlier messages.
|
|
1007
|
+
if (current <= previous) return
|
|
1008
|
+
const root = listRoot()
|
|
1009
|
+
touchDragEvent.overflow = !!root && root.scrollHeight - root.clientHeight > MIN_OVERFLOW
|
|
1010
|
+
input.follow.dispatch(touchDragEvent)
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
const handleListTouchEnd = () => {
|
|
1014
|
+
clearTouchTarget()
|
|
1015
|
+
touchAdjustment = 0
|
|
1016
|
+
|
|
1017
|
+
if (!active()) return
|
|
1018
|
+
input.follow.dispatch(virtualizer.isScrolling ? touchMomentumEvent : touchEndEvent)
|
|
1019
|
+
|
|
1020
|
+
if (!virtualizer.isScrolling) flushTouchAdjustment()
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
function clearTouchTarget() {
|
|
1024
|
+
touchTarget?.removeEventListener("touchmove", handleListTouchMove)
|
|
1025
|
+
touchTarget?.removeEventListener("touchend", handleListTouchEnd)
|
|
1026
|
+
touchTarget?.removeEventListener("touchcancel", handleListTouchEnd)
|
|
1027
|
+
touchTarget = null
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
onCleanup(clearTouchTarget)
|
|
1031
|
+
|
|
1032
|
+
// Drag-selecting past the edge and dragging the scrollbar both scroll without a wheel or key,
|
|
1033
|
+
// so a held pointer is what separates those from the virtualizer's own measurement adjustments.
|
|
1034
|
+
// Not the secondary button: it opens a context menu that can swallow its release. The middle button stays, as its
|
|
1035
|
+
// drag autoscrolls on Windows and Linux.
|
|
1036
|
+
const handleListPointerDown = (event: PointerEvent) => {
|
|
1037
|
+
if (!active() || event.button === 2) return
|
|
1038
|
+
input.onUserScroll(event.target)
|
|
1039
|
+
input.follow.dispatch(pointerDownEvent)
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
// A release only ends a pointer gesture, so every view may report it, including one that went inactive mid-press.
|
|
1043
|
+
// On touch devices it also fires beside touchend, which owns the touch gesture.
|
|
1044
|
+
const releasePointer = () => input.follow.dispatch(pointerUpEvent)
|
|
1045
|
+
|
|
1046
|
+
// A window that loses focus or hides mid-press may never see the release, of a pointer or of a finger. Every view may
|
|
1047
|
+
// report it, as the window lost all contact.
|
|
1048
|
+
const loseContact = () => {
|
|
1049
|
+
clearTouchTarget()
|
|
1050
|
+
touchAdjustment = 0
|
|
1051
|
+
|
|
1052
|
+
if (active()) flushTouchAdjustment()
|
|
1053
|
+
input.follow.dispatch(CONTACT_LOST_EVENT)
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
const loseHiddenContact = () => {
|
|
1057
|
+
if (document.visibilityState === "hidden") loseContact()
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
onMount(() => {
|
|
1061
|
+
window.addEventListener("pointerup", releasePointer)
|
|
1062
|
+
window.addEventListener("pointercancel", releasePointer)
|
|
1063
|
+
window.addEventListener("blur", loseContact)
|
|
1064
|
+
document.addEventListener("visibilitychange", loseHiddenContact)
|
|
1065
|
+
})
|
|
1066
|
+
onCleanup(() => {
|
|
1067
|
+
window.removeEventListener("pointerup", releasePointer)
|
|
1068
|
+
window.removeEventListener("pointercancel", releasePointer)
|
|
1069
|
+
window.removeEventListener("blur", loseContact)
|
|
1070
|
+
document.removeEventListener("visibilitychange", loseHiddenContact)
|
|
1071
|
+
})
|
|
1072
|
+
|
|
1073
|
+
const handleListKeyDown = (event: KeyboardEvent & { currentTarget: HTMLDivElement }) => {
|
|
1074
|
+
const key = scrollKey(event)
|
|
1075
|
+
|
|
1076
|
+
if (!key) return
|
|
1077
|
+
|
|
1078
|
+
if (!isScrollKeyTarget(event.target, key)) return
|
|
1079
|
+
|
|
1080
|
+
if (scrollKeyOwner(event.currentTarget, event.target, key) !== event.currentTarget) return
|
|
1081
|
+
input.onUserScroll(event.currentTarget)
|
|
1082
|
+
dispatchIntent(upwardKeys.has(key))
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
const handleListScroll = (event: Event & { currentTarget: HTMLDivElement }) => {
|
|
1086
|
+
if (!active()) return
|
|
1087
|
+
const root = event.currentTarget
|
|
1088
|
+
scrollEvent.previousTop = scrollTop
|
|
1089
|
+
scrollEvent.previousMaxScroll = maxScroll
|
|
1090
|
+
scrollTop = root.scrollTop
|
|
1091
|
+
maxScroll = root.scrollHeight - root.clientHeight
|
|
1092
|
+
scrollEvent.scrollTop = scrollTop
|
|
1093
|
+
scrollEvent.maxScroll = maxScroll
|
|
1094
|
+
input.follow.dispatch(scrollEvent)
|
|
1095
|
+
dispatchCold(CHECK_REQUESTED)
|
|
1096
|
+
input.onScheduleScrollState(root)
|
|
1097
|
+
input.onHistoryScroll()
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
function View(props: ViewProps) {
|
|
1101
|
+
// `mounted` only ever holds this row's own key, up to the update that unmounts it.
|
|
1102
|
+
function VirtualRow(rowProps: { mounted: Accessor<MountedRow> }) {
|
|
1103
|
+
let element: HTMLDivElement
|
|
1104
|
+
const initial = rowProps.mounted()
|
|
1105
|
+
const item = createMemo(() => rowProps.mounted().item)
|
|
1106
|
+
const row = createMemo(() => rowProps.mounted().row)
|
|
1107
|
+
const [ready, setReady] = createSignal(initial.item.size <= fallbackItemSize || !props.deferred(initial.row))
|
|
1108
|
+
let contentMeasureFrame: number | undefined
|
|
1109
|
+
|
|
1110
|
+
onMount(() => virtualizer.measureElement(element))
|
|
1111
|
+
// Prepending history changes data-index, not the keyed element's identity.
|
|
1112
|
+
// Its observer reads the current index and delivers any actual size change.
|
|
1113
|
+
onCleanup(() => {
|
|
1114
|
+
if (contentMeasureFrame !== undefined) cancelAnimationFrame(contentMeasureFrame)
|
|
1115
|
+
|
|
1116
|
+
// A row that leaves the mounted range takes its focused control with it, and Chromium then leaves focus on
|
|
1117
|
+
// <body>. The focus rescue would move it to a control in another row, and focusing that scrolls the timeline
|
|
1118
|
+
// to it. The viewport takes focus instead, without scrolling, so the scroll keys keep working.
|
|
1119
|
+
if (element.contains(document.activeElement)) listRoot()?.focus({ preventScroll: true })
|
|
1120
|
+
queueMicrotask(() => virtualizer.measureElement(null))
|
|
1121
|
+
})
|
|
1122
|
+
|
|
1123
|
+
return (
|
|
1124
|
+
<div
|
|
1125
|
+
data-timeline-key={initial.key}
|
|
1126
|
+
style={{
|
|
1127
|
+
position: "absolute",
|
|
1128
|
+
top: `${item().start - topOffset() - rendering.scrollAdjustment}px`,
|
|
1129
|
+
left: "0",
|
|
1130
|
+
width: "100%",
|
|
1131
|
+
height: `${item().size}px`,
|
|
1132
|
+
overflow: "clip",
|
|
1133
|
+
// Room for paint rounding, card shadows and a focus ring (2px at a 2px offset) on a control at the row edge.
|
|
1134
|
+
"overflow-clip-margin": Predicate.isTagged(row(), "TurnGap") ? undefined : "5px",
|
|
1135
|
+
}}
|
|
1136
|
+
>
|
|
1137
|
+
<div
|
|
1138
|
+
ref={(value) => {
|
|
1139
|
+
element = value
|
|
1140
|
+
|
|
1141
|
+
if (
|
|
1142
|
+
!Predicate.isTagged(row(), "UserMessage") ||
|
|
1143
|
+
!addedKeys.has(initial.key) ||
|
|
1144
|
+
!input.follow.following() ||
|
|
1145
|
+
coldHidden()
|
|
1146
|
+
)
|
|
1147
|
+
return
|
|
1148
|
+
// The optimistic row can paint before ResizeObserver corrects the tail estimates.
|
|
1149
|
+
// Measure the mounted tail and pin it in this render's microtask instead.
|
|
1150
|
+
queueMicrotask(() => {
|
|
1151
|
+
if (!input.follow.following() || !virtualContent?.isConnected) return
|
|
1152
|
+
virtualizer.elementsCache.forEach((item) => {
|
|
1153
|
+
if (item.isConnected) virtualizer.resizeItem(virtualizer.indexFromElement(item), item.offsetHeight)
|
|
1154
|
+
})
|
|
1155
|
+
virtualizer.resizeItem(item().index, element.offsetHeight)
|
|
1156
|
+
virtualContent.style.height = `${virtualizer.getTotalSize()}px`
|
|
1157
|
+
virtualizer.scrollToEnd()
|
|
1158
|
+
})
|
|
1159
|
+
}}
|
|
1160
|
+
data-index={item().index}
|
|
1161
|
+
style={{ "min-height": ready() ? undefined : `${initial.item.size}px` }}
|
|
1162
|
+
>
|
|
1163
|
+
{props.renderRow(row, () => {
|
|
1164
|
+
setReady(true)
|
|
1165
|
+
|
|
1166
|
+
if (contentMeasureFrame !== undefined) cancelAnimationFrame(contentMeasureFrame)
|
|
1167
|
+
contentMeasureFrame = requestAnimationFrame(() => {
|
|
1168
|
+
contentMeasureFrame = undefined
|
|
1169
|
+
|
|
1170
|
+
if (active() && element.isConnected) virtualizer.measureElement(element)
|
|
1171
|
+
})
|
|
1172
|
+
})}
|
|
1173
|
+
</div>
|
|
1174
|
+
</div>
|
|
1175
|
+
)
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
return (
|
|
1179
|
+
<div ref={setViewRoot} class="relative w-full h-full min-w-0">
|
|
1180
|
+
<div
|
|
1181
|
+
class="absolute left-1/2 -translate-x-1/2 z-[60] pointer-events-none transition-[opacity,translate]"
|
|
1182
|
+
classList={{
|
|
1183
|
+
"opacity-100 translate-y-0 duration-150 ease-[cubic-bezier(.2,.8,.2,1)]":
|
|
1184
|
+
input.scroll().overflow && input.scroll().jump,
|
|
1185
|
+
"opacity-0 translate-y-1 motion-reduce:translate-y-0 duration-[110ms] ease-[cubic-bezier(.4,0,1,1)]":
|
|
1186
|
+
!input.scroll().overflow || !input.scroll().jump,
|
|
1187
|
+
}}
|
|
1188
|
+
style={{ bottom: `${bottomInset() + 32}px` }}
|
|
1189
|
+
inert={!input.scroll().overflow || !input.scroll().jump}
|
|
1190
|
+
>
|
|
1191
|
+
<button
|
|
1192
|
+
type="button"
|
|
1193
|
+
aria-label={language.t("session.messages.jumpToLatest")}
|
|
1194
|
+
class="pointer-events-auto flex items-center justify-center w-8 h-7 px-2 py-1.5 rounded-lg border-none cursor-pointer text-v2-text-text-base backdrop-blur-[2px] hover:bg-[linear-gradient(var(--v2-overlay-simple-overlay-hover),var(--v2-overlay-simple-overlay-hover))] active:bg-[linear-gradient(var(--v2-overlay-simple-overlay-pressed),var(--v2-overlay-simple-overlay-pressed))]"
|
|
1195
|
+
style={{
|
|
1196
|
+
"background-color": "color-mix(in srgb, var(--v2-background-bg-base) 92%, transparent)",
|
|
1197
|
+
"box-shadow": "var(--v2-elevation-raised), 0px 2px 8px var(--v2-background-bg-base)",
|
|
1198
|
+
}}
|
|
1199
|
+
onClick={(event) => {
|
|
1200
|
+
input.onResumeScroll(prefersReducedMotion() ? "auto" : "smooth")
|
|
1201
|
+
|
|
1202
|
+
// From the keyboard, the button hides under its own focus; the prompt is where the session continues.
|
|
1203
|
+
if (event.detail === 0) input.focusComposer?.()
|
|
1204
|
+
}}
|
|
1205
|
+
>
|
|
1206
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
1207
|
+
<path
|
|
1208
|
+
d="M12.3333 8.66665L8 13L3.66667 8.66665M8 12.6667V2.83332"
|
|
1209
|
+
stroke="currentColor"
|
|
1210
|
+
stroke-linecap="square"
|
|
1211
|
+
/>
|
|
1212
|
+
</svg>
|
|
1213
|
+
</button>
|
|
1214
|
+
</div>
|
|
1215
|
+
<Show when={input.showHeader()}>
|
|
1216
|
+
{/* The scroll viewport's fade masks anything outside the chat, including the review toggle when open. */}
|
|
1217
|
+
<div class="pointer-events-none absolute inset-x-0 top-0 z-30">{props.header}</div>
|
|
1218
|
+
</Show>
|
|
1219
|
+
<ScrollView
|
|
1220
|
+
data-slot="session-timeline-scroll"
|
|
1221
|
+
data-focus-scope
|
|
1222
|
+
viewportRef={bindListRoot}
|
|
1223
|
+
thumbContainer={visibleArea()}
|
|
1224
|
+
thumbHoverTarget={viewRoot()}
|
|
1225
|
+
onBeforeScroll={prepareNavigation}
|
|
1226
|
+
verticalScrollAdjustment={rendering.scrollAdjustment}
|
|
1227
|
+
onWheel={handleListWheel}
|
|
1228
|
+
onTouchStart={handleListTouchStart}
|
|
1229
|
+
onKeyDown={handleListKeyDown}
|
|
1230
|
+
onScroll={handleListScroll}
|
|
1231
|
+
onClick={() => {
|
|
1232
|
+
// Following would scroll a selection away.
|
|
1233
|
+
if (window.getSelection()?.toString()) input.follow.dispatch({ type: "detach" })
|
|
1234
|
+
}}
|
|
1235
|
+
class="relative min-w-0 w-full h-full"
|
|
1236
|
+
style={{ "--sticky-accordion-top": input.showHeader() ? "var(--session-header-height, 48px)" : "0px" }}
|
|
1237
|
+
>
|
|
1238
|
+
<Show when={input.showHeader()} fallback={<div aria-hidden="true" class="h-4 md:hidden" />}>
|
|
1239
|
+
{props.headerInset}
|
|
1240
|
+
</Show>
|
|
1241
|
+
<div
|
|
1242
|
+
data-timeline-virtual-content
|
|
1243
|
+
ref={virtualContent}
|
|
1244
|
+
style={{
|
|
1245
|
+
height: `${virtualizer.getTotalSize() - rendering.scrollAdjustment}px`,
|
|
1246
|
+
position: "relative",
|
|
1247
|
+
width: "100%",
|
|
1248
|
+
// Rows held wider than the timeline mid-flight don't scroll it sideways.
|
|
1249
|
+
"overflow-x": "clip",
|
|
1250
|
+
visibility: coldHidden() ? "hidden" : undefined,
|
|
1251
|
+
}}
|
|
1252
|
+
>
|
|
1253
|
+
<div
|
|
1254
|
+
ref={rowLayer}
|
|
1255
|
+
class="absolute inset-y-0"
|
|
1256
|
+
style={{
|
|
1257
|
+
left: "calc((100% - var(--panel-hold-width, 100%)) / 2)",
|
|
1258
|
+
width: "var(--panel-hold-width, 100%)",
|
|
1259
|
+
}}
|
|
1260
|
+
>
|
|
1261
|
+
<Key each={mountedRows()} by={(mounted) => mounted.key}>
|
|
1262
|
+
{(mounted) => <VirtualRow mounted={mounted} />}
|
|
1263
|
+
</Key>
|
|
1264
|
+
</div>
|
|
1265
|
+
<div
|
|
1266
|
+
data-timeline-row="bottom-spacer"
|
|
1267
|
+
class="absolute top-0 left-0 w-full"
|
|
1268
|
+
style={{
|
|
1269
|
+
height: `${tailSize()}px`,
|
|
1270
|
+
transform: `translateY(${virtualizer.getTotalSize() - tailSize() - rendering.scrollAdjustment}px)`,
|
|
1271
|
+
}}
|
|
1272
|
+
>
|
|
1273
|
+
{props.bottomSpacer}
|
|
1274
|
+
</div>
|
|
1275
|
+
</div>
|
|
1276
|
+
<div aria-hidden="true" data-timeline-inset class="shrink-0" style={{ height: `${bottomInset()}px` }} />
|
|
1277
|
+
</ScrollView>
|
|
1278
|
+
<div
|
|
1279
|
+
ref={setVisibleArea}
|
|
1280
|
+
data-slot="session-timeline-visible"
|
|
1281
|
+
class="pointer-events-none absolute inset-x-0 top-0"
|
|
1282
|
+
style={{ bottom: `${bottomInset()}px` }}
|
|
1283
|
+
/>
|
|
1284
|
+
</div>
|
|
1285
|
+
)
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
onCleanup(() => {
|
|
1289
|
+
cache.delete(ownerSessionKey)
|
|
1290
|
+
cache.set(ownerSessionKey, {
|
|
1291
|
+
measurements: virtualizer.takeSnapshot(),
|
|
1292
|
+
toolOpen: { ...toolOpen },
|
|
1293
|
+
patchGroupKeys,
|
|
1294
|
+
presentationKey: input.presentationKey?.(),
|
|
1295
|
+
})
|
|
1296
|
+
|
|
1297
|
+
while (cache.size > 16) cache.delete(cache.keys().next().value!)
|
|
1298
|
+
dispatchCold(DISPOSED)
|
|
1299
|
+
|
|
1300
|
+
if (active()) {
|
|
1301
|
+
input.setScrollRef(undefined)
|
|
1302
|
+
input.setRevealMessage?.(() => {})
|
|
1303
|
+
input.setScrollToEnd?.(() => {})
|
|
1304
|
+
input.setPage?.(() => {})
|
|
1305
|
+
}
|
|
1306
|
+
})
|
|
1307
|
+
|
|
1308
|
+
return {
|
|
1309
|
+
disclosure: {
|
|
1310
|
+
patchGroupKeys,
|
|
1311
|
+
value: (key: string) => toolOpen[key],
|
|
1312
|
+
set: (key: string, open: boolean) => {
|
|
1313
|
+
// Following the end would scroll an opened user message's top away; it stays where it was pressed.
|
|
1314
|
+
if (open && key.startsWith("user-expanded:")) input.follow.dispatch({ type: "detach" })
|
|
1315
|
+
setToolOpen(key, open)
|
|
1316
|
+
},
|
|
1317
|
+
},
|
|
1318
|
+
revealPart,
|
|
1319
|
+
View,
|
|
1320
|
+
}
|
|
1321
|
+
}
|