@zyro-sec/gui-plugins 0.0.0-stage → 1.0.4
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 +116 -0
- package/README.md +874 -3
- package/bunfig.toml +3 -0
- package/happydom.ts +77 -0
- package/package.json +63 -4
- package/src/browser/activation-delay.ts +134 -0
- package/src/browser/address-machine.ts +468 -0
- package/src/browser/address.ts +111 -0
- package/src/browser/agent-rendering.ts +61 -0
- package/src/browser/analysis.ts +260 -0
- package/src/browser/artifact-link.ts +69 -0
- package/src/browser/artifact-links.ts +55 -0
- package/src/browser/artifact-preview.ts +61 -0
- package/src/browser/assets/viewport-device-chevron.svg +5 -0
- package/src/browser/assets/viewport-rotate.svg +7 -0
- package/src/browser/bar.css +562 -0
- package/src/browser/capture.ts +158 -0
- package/src/browser/cdp.ts +97 -0
- package/src/browser/child-targets.ts +30 -0
- package/src/browser/choices.tsx +42 -0
- package/src/browser/chromium.ts +3018 -0
- package/src/browser/comment.css +38 -0
- package/src/browser/comment.ts +98 -0
- package/src/browser/connection.ts +122 -0
- package/src/browser/default-browser.ts +59 -0
- package/src/browser/diagnostics-machine.ts +522 -0
- package/src/browser/diagnostics.ts +317 -0
- package/src/browser/dialog-machine.ts +268 -0
- package/src/browser/disk/contained-file.ts +43 -0
- package/src/browser/disk/handle-path.fixture.ts +99 -0
- package/src/browser/disk/handle-path.ts +122 -0
- package/src/browser/disk/index.ts +5 -0
- package/src/browser/disk/preview-scope.ts +90 -0
- package/src/browser/electron-address.fixture.ts +143 -0
- package/src/browser/electron-app-badge.fixture.ts +97 -0
- package/src/browser/electron-crash.fixture.ts +216 -0
- package/src/browser/electron-dialogs.fixture.ts +114 -0
- package/src/browser/electron-history.fixture.ts +61 -0
- package/src/browser/electron-icon.fixture.ts +145 -0
- package/src/browser/electron-import-choice.fixture.ts +58 -0
- package/src/browser/electron-links.fixture.ts +549 -0
- package/src/browser/electron-main.ts +85 -0
- package/src/browser/electron-media.fixture.ts +66 -0
- package/src/browser/electron-open.fixture.ts +351 -0
- package/src/browser/electron-page.fixture.ts +253 -0
- package/src/browser/electron-restore.fixture.ts +135 -0
- package/src/browser/electron-run.ts +184 -0
- package/src/browser/electron-sign-in-copy.fixture.ts +365 -0
- package/src/browser/electron-webauthn.fixture.ts +229 -0
- package/src/browser/electron-workers.fixture.ts +54 -0
- package/src/browser/errors.ts +175 -0
- package/src/browser/failure-view.tsx +92 -0
- package/src/browser/failure.ts +174 -0
- package/src/browser/field-value.ts +60 -0
- package/src/browser/file-choosers.ts +42 -0
- package/src/browser/file-verification.ts +18 -0
- package/src/browser/files.ts +134 -0
- package/src/browser/find-bar.tsx +80 -0
- package/src/browser/find-machine.ts +43 -0
- package/src/browser/history/earlier.ts +23 -0
- package/src/browser/history/index.ts +5 -0
- package/src/browser/history/ipc.ts +44 -0
- package/src/browser/history/match.ts +196 -0
- package/src/browser/history/page.ts +86 -0
- package/src/browser/history/search.ts +209 -0
- package/src/browser/history/store.ts +272 -0
- package/src/browser/history/suggest.ts +51 -0
- package/src/browser/history/visits.ts +59 -0
- package/src/browser/host-display.ts +32 -0
- package/src/browser/i18n/am.ts +42 -0
- package/src/browser/i18n/ar.ts +46 -0
- package/src/browser/i18n/az.ts +42 -0
- package/src/browser/i18n/bg.ts +42 -0
- package/src/browser/i18n/bn.ts +42 -0
- package/src/browser/i18n/br.ts +44 -0
- package/src/browser/i18n/bs.ts +43 -0
- package/src/browser/i18n/ca.ts +44 -0
- package/src/browser/i18n/cs.ts +44 -0
- package/src/browser/i18n/da.ts +42 -0
- package/src/browser/i18n/de.ts +43 -0
- package/src/browser/i18n/dv.ts +43 -0
- package/src/browser/i18n/dz.ts +42 -0
- package/src/browser/i18n/el.ts +44 -0
- package/src/browser/i18n/en.ts +455 -0
- package/src/browser/i18n/es.ts +44 -0
- package/src/browser/i18n/et.ts +42 -0
- package/src/browser/i18n/fa.ts +42 -0
- package/src/browser/i18n/fi.ts +42 -0
- package/src/browser/i18n/fo.ts +42 -0
- package/src/browser/i18n/fr.ts +45 -0
- package/src/browser/i18n/he.ts +43 -0
- package/src/browser/i18n/hi.ts +42 -0
- package/src/browser/i18n/hr.ts +43 -0
- package/src/browser/i18n/hu.ts +43 -0
- package/src/browser/i18n/hy.ts +42 -0
- package/src/browser/i18n/id.ts +42 -0
- package/src/browser/i18n/is.ts +42 -0
- package/src/browser/i18n/it.ts +44 -0
- package/src/browser/i18n/ja.ts +42 -0
- package/src/browser/i18n/ka.ts +42 -0
- package/src/browser/i18n/km.ts +42 -0
- package/src/browser/i18n/ko.ts +42 -0
- package/src/browser/i18n/lo.ts +42 -0
- package/src/browser/i18n/lt.ts +44 -0
- package/src/browser/i18n/lv.ts +43 -0
- package/src/browser/i18n/mk.ts +42 -0
- package/src/browser/i18n/mn.ts +42 -0
- package/src/browser/i18n/ms.ts +42 -0
- package/src/browser/i18n/my.ts +43 -0
- package/src/browser/i18n/ne.ts +42 -0
- package/src/browser/i18n/nl.ts +42 -0
- package/src/browser/i18n/no.ts +42 -0
- package/src/browser/i18n/pa.ts +42 -0
- package/src/browser/i18n/pl.ts +44 -0
- package/src/browser/i18n/ro.ts +43 -0
- package/src/browser/i18n/ru.ts +44 -0
- package/src/browser/i18n/si.ts +42 -0
- package/src/browser/i18n/sk.ts +44 -0
- package/src/browser/i18n/sl.ts +44 -0
- package/src/browser/i18n/sq.ts +43 -0
- package/src/browser/i18n/sr.ts +43 -0
- package/src/browser/i18n/sv.ts +42 -0
- package/src/browser/i18n/tg.ts +42 -0
- package/src/browser/i18n/th.ts +42 -0
- package/src/browser/i18n/tk.ts +42 -0
- package/src/browser/i18n/tr.ts +42 -0
- package/src/browser/i18n/uk.ts +44 -0
- package/src/browser/i18n/ur.ts +42 -0
- package/src/browser/i18n/uz.ts +42 -0
- package/src/browser/i18n/vi.ts +42 -0
- package/src/browser/i18n/zh.ts +42 -0
- package/src/browser/i18n/zht.ts +42 -0
- package/src/browser/icon-image.ts +110 -0
- package/src/browser/icon-samples.ts +110 -0
- package/src/browser/icon.ts +72 -0
- package/src/browser/import-prompt.tsx +265 -0
- package/src/browser/index.ts +97 -0
- package/src/browser/ipc.ts +304 -0
- package/src/browser/jobs-machine.ts +181 -0
- package/src/browser/jobs.ts +373 -0
- package/src/browser/keys.ts +109 -0
- package/src/browser/lighthouse.ts +103 -0
- package/src/browser/link.ts +19 -0
- package/src/browser/machine.ts +1522 -0
- package/src/browser/main-machine.ts +99 -0
- package/src/browser/main.ts +394 -0
- package/src/browser/media-gate.ts +131 -0
- package/src/browser/mobile-emulation.ts +121 -0
- package/src/browser/model-machine.ts +93 -0
- package/src/browser/model.ts +1173 -0
- package/src/browser/native-page-menu.ts +189 -0
- package/src/browser/navigation-deadline.ts +20 -0
- package/src/browser/navigation-turn.ts +118 -0
- package/src/browser/network.ts +140 -0
- package/src/browser/notice-actions.ts +52 -0
- package/src/browser/overlay-machine.ts +330 -0
- package/src/browser/page-find.ts +71 -0
- package/src/browser/page-icon.tsx +27 -0
- package/src/browser/page-log.ts +276 -0
- package/src/browser/page-machine.ts +329 -0
- package/src/browser/page-menu.ts +158 -0
- package/src/browser/page-prompts.ts +753 -0
- package/src/browser/pane-machine.ts +664 -0
- package/src/browser/pane.ts +1335 -0
- package/src/browser/panel.fixture.tsx +2046 -0
- package/src/browser/panel.stories.tsx +147 -0
- package/src/browser/panel.tsx +2029 -0
- package/src/browser/passkey-groups.ts +34 -0
- package/src/browser/picker-machine.ts +214 -0
- package/src/browser/plugin-tabs.ts +26 -0
- package/src/browser/policy.ts +439 -0
- package/src/browser/preview.ts +40 -0
- package/src/browser/profile/chromium.ts +198 -0
- package/src/browser/profile/compatibility.ts +177 -0
- package/src/browser/profile/cookie.ts +215 -0
- package/src/browser/profile/database.ts +116 -0
- package/src/browser/profile/electron-import.fixture.ts +43 -0
- package/src/browser/profile/electron-link.fixture.ts +137 -0
- package/src/browser/profile/extension-api/action.ts +276 -0
- package/src/browser/profile/extension-api/api.ts +112 -0
- package/src/browser/profile/extension-api/app-badge.js +19 -0
- package/src/browser/profile/extension-api/context-menus.ts +327 -0
- package/src/browser/profile/extension-api/cookies.ts +192 -0
- package/src/browser/profile/extension-api/event-page.ts +73 -0
- package/src/browser/profile/extension-api/frame-styles.js +46 -0
- package/src/browser/profile/extension-api/host.ts +291 -0
- package/src/browser/profile/extension-api/index.ts +119 -0
- package/src/browser/profile/extension-api/label.ts +4 -0
- package/src/browser/profile/extension-api/manifest.ts +76 -0
- package/src/browser/profile/extension-api/match-pattern.ts +98 -0
- package/src/browser/profile/extension-api/notifications.ts +100 -0
- package/src/browser/profile/extension-api/permissions.ts +51 -0
- package/src/browser/profile/extension-api/popup.ts +200 -0
- package/src/browser/profile/extension-api/preload.js +203 -0
- package/src/browser/profile/extension-api/resource.ts +36 -0
- package/src/browser/profile/extension-api/storage-sync.ts +167 -0
- package/src/browser/profile/extension-api/stubs.ts +152 -0
- package/src/browser/profile/extension-api/styles.ts +230 -0
- package/src/browser/profile/extension-api/tab-activity.ts +23 -0
- package/src/browser/profile/extension-api/tabs.ts +545 -0
- package/src/browser/profile/extension-api/web-navigation.ts +172 -0
- package/src/browser/profile/extension-api/worker-events.ts +114 -0
- package/src/browser/profile/extensions.ts +491 -0
- package/src/browser/profile/filter-startup.fixture.ts +111 -0
- package/src/browser/profile/filter-startup.ts +178 -0
- package/src/browser/profile/firefox.ts +119 -0
- package/src/browser/profile/history.ts +146 -0
- package/src/browser/profile/import.ts +37 -0
- package/src/browser/profile/index.ts +694 -0
- package/src/browser/profile/install.ts +131 -0
- package/src/browser/profile/integrity.ts +56 -0
- package/src/browser/profile/ipc.ts +306 -0
- package/src/browser/profile/link-machine.ts +183 -0
- package/src/browser/profile/link.ts +335 -0
- package/src/browser/profile/made-up-firefox.fixture.ts +67 -0
- package/src/browser/profile/previews.ts +70 -0
- package/src/browser/profile/probe.ts +43 -0
- package/src/browser/profile/range.ts +14 -0
- package/src/browser/profile/review.ts +38 -0
- package/src/browser/profile/safari.ts +77 -0
- package/src/browser/profile/serve.ts +117 -0
- package/src/browser/profile/sites.ts +74 -0
- package/src/browser/profile/sources.ts +682 -0
- package/src/browser/profiling-machine.ts +554 -0
- package/src/browser/profiling.ts +404 -0
- package/src/browser/prompt-gate.ts +41 -0
- package/src/browser/prompt-keys.ts +120 -0
- package/src/browser/prompt-machine.ts +242 -0
- package/src/browser/prompts.tsx +594 -0
- package/src/browser/refs.ts +65 -0
- package/src/browser/refusal-bar.tsx +163 -0
- package/src/browser/refusal-notice.ts +60 -0
- package/src/browser/remote-address.ts +1 -0
- package/src/browser/remote-preview.ts +56 -0
- package/src/browser/renderer.tsx +683 -0
- package/src/browser/restore.ts +77 -0
- package/src/browser/saved-tabs.ts +135 -0
- package/src/browser/scheme.ts +1 -0
- package/src/browser/session-guard.ts +94 -0
- package/src/browser/settings-view.ts +49 -0
- package/src/browser/settings.fixture.tsx +306 -0
- package/src/browser/settings.tsx +1036 -0
- package/src/browser/site-auth.ts +58 -0
- package/src/browser/site-chooser.fixture.tsx +222 -0
- package/src/browser/site-chooser.tsx +778 -0
- package/src/browser/site-keys.ts +35 -0
- package/src/browser/site-machine.ts +134 -0
- package/src/browser/site-permissions.ts +239 -0
- package/src/browser/site-search.ts +26 -0
- package/src/browser/snapshot.ts +440 -0
- package/src/browser/system-media.ts +80 -0
- package/src/browser/tab-openers.ts +65 -0
- package/src/browser/tabs.css +20 -0
- package/src/browser/viewport-controls-machine.ts +134 -0
- package/src/browser/viewport-controls.tsx +170 -0
- package/src/browser/viewport-handles.tsx +119 -0
- package/src/browser/viewport-layout.ts +24 -0
- package/src/browser/viewport-native.ts +99 -0
- package/src/browser/viewport-preset-menu.tsx +69 -0
- package/src/browser/viewport-presets.ts +28 -0
- package/src/browser/viewport-toolbar-machine.ts +94 -0
- package/src/browser/webauthn-gate.ts +222 -0
- package/src/browser/window-open.ts +143 -0
- package/src/browser/wire.ts +20 -0
- package/src/browser/workspace-file.ts +126 -0
- package/src/browser/workspace-pages.ts +156 -0
- package/src/btw/i18n/en.ts +12 -0
- package/src/btw/index.ts +31 -0
- package/src/btw/machine.ts +341 -0
- package/src/btw/model.ts +222 -0
- package/src/btw/panel.tsx +229 -0
- package/src/btw/renderer.tsx +125 -0
- package/src/context/catalog-machine.ts +153 -0
- package/src/context/catalog.ts +123 -0
- package/src/context/export.ts +57 -0
- package/src/context/format.ts +32 -0
- package/src/context/i18n/am.ts +31 -0
- package/src/context/i18n/ar.ts +31 -0
- package/src/context/i18n/az.ts +31 -0
- package/src/context/i18n/bg.ts +31 -0
- package/src/context/i18n/bn.ts +31 -0
- package/src/context/i18n/br.ts +31 -0
- package/src/context/i18n/bs.ts +31 -0
- package/src/context/i18n/ca.ts +31 -0
- package/src/context/i18n/cs.ts +31 -0
- package/src/context/i18n/da.ts +31 -0
- package/src/context/i18n/de.ts +31 -0
- package/src/context/i18n/dv.ts +31 -0
- package/src/context/i18n/dz.ts +31 -0
- package/src/context/i18n/el.ts +31 -0
- package/src/context/i18n/en.ts +31 -0
- package/src/context/i18n/es.ts +31 -0
- package/src/context/i18n/et.ts +31 -0
- package/src/context/i18n/fa.ts +31 -0
- package/src/context/i18n/fi.ts +31 -0
- package/src/context/i18n/fo.ts +31 -0
- package/src/context/i18n/fr.ts +31 -0
- package/src/context/i18n/he.ts +31 -0
- package/src/context/i18n/hi.ts +31 -0
- package/src/context/i18n/hr.ts +31 -0
- package/src/context/i18n/hu.ts +31 -0
- package/src/context/i18n/hy.ts +31 -0
- package/src/context/i18n/id.ts +31 -0
- package/src/context/i18n/is.ts +31 -0
- package/src/context/i18n/it.ts +31 -0
- package/src/context/i18n/ja.ts +31 -0
- package/src/context/i18n/ka.ts +31 -0
- package/src/context/i18n/km.ts +31 -0
- package/src/context/i18n/ko.ts +31 -0
- package/src/context/i18n/lo.ts +31 -0
- package/src/context/i18n/lt.ts +31 -0
- package/src/context/i18n/lv.ts +31 -0
- package/src/context/i18n/mk.ts +31 -0
- package/src/context/i18n/mn.ts +31 -0
- package/src/context/i18n/ms.ts +31 -0
- package/src/context/i18n/my.ts +31 -0
- package/src/context/i18n/ne.ts +31 -0
- package/src/context/i18n/nl.ts +31 -0
- package/src/context/i18n/no.ts +31 -0
- package/src/context/i18n/pa.ts +31 -0
- package/src/context/i18n/pl.ts +31 -0
- package/src/context/i18n/ro.ts +31 -0
- package/src/context/i18n/ru.ts +31 -0
- package/src/context/i18n/si.ts +31 -0
- package/src/context/i18n/sk.ts +31 -0
- package/src/context/i18n/sl.ts +31 -0
- package/src/context/i18n/sq.ts +31 -0
- package/src/context/i18n/sr.ts +31 -0
- package/src/context/i18n/sv.ts +31 -0
- package/src/context/i18n/tg.ts +31 -0
- package/src/context/i18n/th.ts +31 -0
- package/src/context/i18n/tk.ts +31 -0
- package/src/context/i18n/tr.ts +31 -0
- package/src/context/i18n/uk.ts +31 -0
- package/src/context/i18n/ur.ts +31 -0
- package/src/context/i18n/uz.ts +31 -0
- package/src/context/i18n/vi.ts +31 -0
- package/src/context/i18n/zh.ts +31 -0
- package/src/context/i18n/zht.ts +31 -0
- package/src/context/index.ts +71 -0
- package/src/context/indicator.tsx +199 -0
- package/src/context/machine.ts +271 -0
- package/src/context/renderer.tsx +72 -0
- package/src/context/tab.tsx +439 -0
- package/src/debug/bar.tsx +409 -0
- package/src/debug/contract.ts +45 -0
- package/src/debug/focus-machine.ts +84 -0
- package/src/debug/heap-machine.ts +229 -0
- package/src/debug/i18n/am.ts +50 -0
- package/src/debug/i18n/ar.ts +50 -0
- package/src/debug/i18n/az.ts +50 -0
- package/src/debug/i18n/bg.ts +53 -0
- package/src/debug/i18n/bn.ts +50 -0
- package/src/debug/i18n/br.ts +51 -0
- package/src/debug/i18n/bs.ts +52 -0
- package/src/debug/i18n/ca.ts +53 -0
- package/src/debug/i18n/cs.ts +52 -0
- package/src/debug/i18n/da.ts +51 -0
- package/src/debug/i18n/de.ts +50 -0
- package/src/debug/i18n/dv.ts +51 -0
- package/src/debug/i18n/dz.ts +52 -0
- package/src/debug/i18n/el.ts +54 -0
- package/src/debug/i18n/en.ts +50 -0
- package/src/debug/i18n/es.ts +52 -0
- package/src/debug/i18n/et.ts +50 -0
- package/src/debug/i18n/fa.ts +50 -0
- package/src/debug/i18n/fi.ts +50 -0
- package/src/debug/i18n/fo.ts +50 -0
- package/src/debug/i18n/fr.ts +52 -0
- package/src/debug/i18n/he.ts +50 -0
- package/src/debug/i18n/hi.ts +50 -0
- package/src/debug/i18n/hr.ts +52 -0
- package/src/debug/i18n/hu.ts +52 -0
- package/src/debug/i18n/hy.ts +52 -0
- package/src/debug/i18n/id.ts +51 -0
- package/src/debug/i18n/is.ts +50 -0
- package/src/debug/i18n/it.ts +52 -0
- package/src/debug/i18n/ja.ts +50 -0
- package/src/debug/i18n/ka.ts +50 -0
- package/src/debug/i18n/km.ts +50 -0
- package/src/debug/i18n/ko.ts +50 -0
- package/src/debug/i18n/lo.ts +50 -0
- package/src/debug/i18n/lt.ts +51 -0
- package/src/debug/i18n/lv.ts +50 -0
- package/src/debug/i18n/mk.ts +53 -0
- package/src/debug/i18n/mn.ts +52 -0
- package/src/debug/i18n/ms.ts +51 -0
- package/src/debug/i18n/my.ts +53 -0
- package/src/debug/i18n/ne.ts +50 -0
- package/src/debug/i18n/nl.ts +50 -0
- package/src/debug/i18n/no.ts +50 -0
- package/src/debug/i18n/pa.ts +50 -0
- package/src/debug/i18n/pl.ts +51 -0
- package/src/debug/i18n/ro.ts +52 -0
- package/src/debug/i18n/ru.ts +51 -0
- package/src/debug/i18n/si.ts +50 -0
- package/src/debug/i18n/sk.ts +52 -0
- package/src/debug/i18n/sl.ts +50 -0
- package/src/debug/i18n/sq.ts +52 -0
- package/src/debug/i18n/sr.ts +52 -0
- package/src/debug/i18n/sv.ts +51 -0
- package/src/debug/i18n/tg.ts +51 -0
- package/src/debug/i18n/th.ts +50 -0
- package/src/debug/i18n/tk.ts +51 -0
- package/src/debug/i18n/tr.ts +50 -0
- package/src/debug/i18n/uk.ts +50 -0
- package/src/debug/i18n/ur.ts +50 -0
- package/src/debug/i18n/uz.ts +51 -0
- package/src/debug/i18n/vi.ts +51 -0
- package/src/debug/i18n/zh.ts +49 -0
- package/src/debug/i18n/zht.ts +50 -0
- package/src/debug/index.ts +79 -0
- package/src/debug/main.ts +417 -0
- package/src/debug/memory-infra.ts +159 -0
- package/src/debug/memory-log.ts +65 -0
- package/src/debug/memory-machine.ts +151 -0
- package/src/debug/memory-record.ts +36 -0
- package/src/debug/motion-machine.ts +229 -0
- package/src/debug/motion.tsx +697 -0
- package/src/debug/options.ts +15 -0
- package/src/debug/renderer.tsx +185 -0
- package/src/debug/server-heap.ts +63 -0
- package/src/debug/signal.ts +13 -0
- package/src/details/config-action-machine.ts +107 -0
- package/src/details/config-file.ts +43 -0
- package/src/details/details.css +555 -0
- package/src/details/flyout-machine.ts +252 -0
- package/src/details/flyout-motion.ts +26 -0
- package/src/details/i18n/am.ts +68 -0
- package/src/details/i18n/ar.ts +71 -0
- package/src/details/i18n/az.ts +71 -0
- package/src/details/i18n/bg.ts +73 -0
- package/src/details/i18n/bn.ts +71 -0
- package/src/details/i18n/br.ts +71 -0
- package/src/details/i18n/bs.ts +72 -0
- package/src/details/i18n/ca.ts +72 -0
- package/src/details/i18n/cs.ts +71 -0
- package/src/details/i18n/da.ts +71 -0
- package/src/details/i18n/de.ts +73 -0
- package/src/details/i18n/dv.ts +73 -0
- package/src/details/i18n/dz.ts +72 -0
- package/src/details/i18n/el.ts +73 -0
- package/src/details/i18n/en.ts +71 -0
- package/src/details/i18n/es.ts +72 -0
- package/src/details/i18n/et.ts +72 -0
- package/src/details/i18n/fa.ts +71 -0
- package/src/details/i18n/fi.ts +71 -0
- package/src/details/i18n/fo.ts +72 -0
- package/src/details/i18n/fr.ts +73 -0
- package/src/details/i18n/he.ts +71 -0
- package/src/details/i18n/hi.ts +71 -0
- package/src/details/i18n/hr.ts +72 -0
- package/src/details/i18n/hu.ts +72 -0
- package/src/details/i18n/hy.ts +72 -0
- package/src/details/i18n/id.ts +71 -0
- package/src/details/i18n/is.ts +71 -0
- package/src/details/i18n/it.ts +73 -0
- package/src/details/i18n/ja.ts +71 -0
- package/src/details/i18n/ka.ts +72 -0
- package/src/details/i18n/km.ts +72 -0
- package/src/details/i18n/ko.ts +71 -0
- package/src/details/i18n/lo.ts +72 -0
- package/src/details/i18n/lt.ts +72 -0
- package/src/details/i18n/lv.ts +72 -0
- package/src/details/i18n/mk.ts +73 -0
- package/src/details/i18n/mn.ts +71 -0
- package/src/details/i18n/ms.ts +71 -0
- package/src/details/i18n/my.ts +72 -0
- package/src/details/i18n/ne.ts +71 -0
- package/src/details/i18n/nl.ts +71 -0
- package/src/details/i18n/no.ts +71 -0
- package/src/details/i18n/pa.ts +71 -0
- package/src/details/i18n/pl.ts +72 -0
- package/src/details/i18n/ro.ts +72 -0
- package/src/details/i18n/ru.ts +72 -0
- package/src/details/i18n/si.ts +71 -0
- package/src/details/i18n/sk.ts +71 -0
- package/src/details/i18n/sl.ts +73 -0
- package/src/details/i18n/sq.ts +71 -0
- package/src/details/i18n/sr.ts +72 -0
- package/src/details/i18n/sv.ts +72 -0
- package/src/details/i18n/tg.ts +71 -0
- package/src/details/i18n/th.ts +72 -0
- package/src/details/i18n/tk.ts +72 -0
- package/src/details/i18n/tr.ts +71 -0
- package/src/details/i18n/uk.ts +71 -0
- package/src/details/i18n/ur.ts +71 -0
- package/src/details/i18n/uz.ts +72 -0
- package/src/details/i18n/vi.ts +71 -0
- package/src/details/i18n/zh.ts +69 -0
- package/src/details/i18n/zht.ts +70 -0
- package/src/details/index.ts +71 -0
- package/src/details/location-menu.tsx +82 -0
- package/src/details/location-workspace.tsx +39 -0
- package/src/details/mcp-machine.ts +278 -0
- package/src/details/panel.tsx +27 -0
- package/src/details/paths.ts +17 -0
- package/src/details/popover-machine.ts +97 -0
- package/src/details/popover.tsx +179 -0
- package/src/details/renderer.tsx +99 -0
- package/src/details/server-panel.tsx +1632 -0
- package/src/details/service-load-machine.ts +246 -0
- package/src/details/workspace-menu.tsx +490 -0
- package/src/details/workspace-move-machine.ts +643 -0
- package/src/file/apps.ts +25 -0
- package/src/file/arrival-guard-machine.ts +59 -0
- package/src/file/artifact-toolbar.tsx +161 -0
- package/src/file/artifact-view-machine.ts +396 -0
- package/src/file/artifact-view.css +336 -0
- package/src/file/artifact-view.tsx +1031 -0
- package/src/file/artifact.ts +225 -0
- package/src/file/browser.stories.tsx +57 -0
- package/src/file/browser.tsx +502 -0
- package/src/file/context.ts +67 -0
- package/src/file/contract.ts +10 -0
- package/src/file/drag.ts +35 -0
- package/src/file/find.tsx +376 -0
- package/src/file/i18n/am.ts +56 -0
- package/src/file/i18n/ar.ts +64 -0
- package/src/file/i18n/az.ts +56 -0
- package/src/file/i18n/bg.ts +56 -0
- package/src/file/i18n/bn.ts +56 -0
- package/src/file/i18n/br.ts +58 -0
- package/src/file/i18n/bs.ts +58 -0
- package/src/file/i18n/ca.ts +58 -0
- package/src/file/i18n/cs.ts +60 -0
- package/src/file/i18n/da.ts +56 -0
- package/src/file/i18n/de.ts +56 -0
- package/src/file/i18n/dv.ts +56 -0
- package/src/file/i18n/dz.ts +56 -0
- package/src/file/i18n/el.ts +56 -0
- package/src/file/i18n/en.ts +63 -0
- package/src/file/i18n/es.ts +58 -0
- package/src/file/i18n/et.ts +56 -0
- package/src/file/i18n/fa.ts +56 -0
- package/src/file/i18n/fi.ts +56 -0
- package/src/file/i18n/fo.ts +56 -0
- package/src/file/i18n/fr.ts +58 -0
- package/src/file/i18n/he.ts +58 -0
- package/src/file/i18n/hi.ts +56 -0
- package/src/file/i18n/hr.ts +58 -0
- package/src/file/i18n/hu.ts +56 -0
- package/src/file/i18n/hy.ts +56 -0
- package/src/file/i18n/id.ts +56 -0
- package/src/file/i18n/is.ts +56 -0
- package/src/file/i18n/it.ts +58 -0
- package/src/file/i18n/ja.ts +56 -0
- package/src/file/i18n/ka.ts +56 -0
- package/src/file/i18n/km.ts +56 -0
- package/src/file/i18n/ko.ts +56 -0
- package/src/file/i18n/lo.ts +56 -0
- package/src/file/i18n/lt.ts +60 -0
- package/src/file/i18n/lv.ts +58 -0
- package/src/file/i18n/mk.ts +56 -0
- package/src/file/i18n/mn.ts +56 -0
- package/src/file/i18n/ms.ts +56 -0
- package/src/file/i18n/my.ts +56 -0
- package/src/file/i18n/ne.ts +56 -0
- package/src/file/i18n/nl.ts +56 -0
- package/src/file/i18n/no.ts +56 -0
- package/src/file/i18n/pa.ts +56 -0
- package/src/file/i18n/pl.ts +60 -0
- package/src/file/i18n/ro.ts +58 -0
- package/src/file/i18n/ru.ts +60 -0
- package/src/file/i18n/si.ts +56 -0
- package/src/file/i18n/sk.ts +60 -0
- package/src/file/i18n/sl.ts +60 -0
- package/src/file/i18n/sq.ts +56 -0
- package/src/file/i18n/sr.ts +58 -0
- package/src/file/i18n/sv.ts +56 -0
- package/src/file/i18n/tg.ts +56 -0
- package/src/file/i18n/th.ts +56 -0
- package/src/file/i18n/tk.ts +56 -0
- package/src/file/i18n/tr.ts +56 -0
- package/src/file/i18n/uk.ts +60 -0
- package/src/file/i18n/ur.ts +57 -0
- package/src/file/i18n/uz.ts +56 -0
- package/src/file/i18n/vi.ts +56 -0
- package/src/file/i18n/zh.ts +56 -0
- package/src/file/i18n/zht.ts +56 -0
- package/src/file/index.ts +76 -0
- package/src/file/label.tsx +22 -0
- package/src/file/link-exists-machine.ts +137 -0
- package/src/file/link-open-machine.ts +249 -0
- package/src/file/list.tsx +224 -0
- package/src/file/mobile.css +35 -0
- package/src/file/mobile.tsx +116 -0
- package/src/file/open-in-app-machine.ts +185 -0
- package/src/file/open-in-app.tsx +395 -0
- package/src/file/path.ts +43 -0
- package/src/file/picker-machine.ts +190 -0
- package/src/file/pierre-tree-machine.ts +679 -0
- package/src/file/pierre-tree.tsx +503 -0
- package/src/file/renderer.tsx +1030 -0
- package/src/file/resolve-link.ts +152 -0
- package/src/file/scroll-machine.ts +272 -0
- package/src/file/search-machine.ts +202 -0
- package/src/file/styles.ts +5 -0
- package/src/file/tabs.css +15 -0
- package/src/file/tree-focus.css +6 -0
- package/src/file/tree-model.ts +239 -0
- package/src/file/view.tsx +572 -0
- package/src/goal/goal.css +43 -0
- package/src/goal/i18n/en.ts +12 -0
- package/src/goal/icons/active.svg +13 -0
- package/src/goal/icons/complete.svg +4 -0
- package/src/goal/icons/paused.svg +4 -0
- package/src/goal/index.ts +9 -0
- package/src/goal/machine.ts +364 -0
- package/src/goal/renderer.tsx +287 -0
- package/src/icon-name.typecheck.ts +9 -0
- package/src/main.ts +35 -0
- package/src/microsoft-office/document.tsx +436 -0
- package/src/microsoft-office/document.worker.ts +360 -0
- package/src/microsoft-office/fonts-cjk.ts +3 -0
- package/src/microsoft-office/fonts.ts +75 -0
- package/src/microsoft-office/i18n/en.ts +22 -0
- package/src/microsoft-office/index.ts +7 -0
- package/src/microsoft-office/links.ts +22 -0
- package/src/microsoft-office/office-worker.ts +124 -0
- package/src/microsoft-office/pages-machine.ts +356 -0
- package/src/microsoft-office/pages.tsx +387 -0
- package/src/microsoft-office/paper.ts +2 -0
- package/src/microsoft-office/presentation.tsx +303 -0
- package/src/microsoft-office/presentation.worker.ts +373 -0
- package/src/microsoft-office/renderer.tsx +57 -0
- package/src/microsoft-office/sheet-activate.ts +35 -0
- package/src/microsoft-office/sheet-cells.ts +188 -0
- package/src/microsoft-office/sheet-frame-machine.ts +286 -0
- package/src/microsoft-office/sheet-frame.ts +158 -0
- package/src/microsoft-office/sheet-paint.ts +357 -0
- package/src/microsoft-office/sheet-pick-machine.ts +138 -0
- package/src/microsoft-office/sheet-pointer-machine.ts +169 -0
- package/src/microsoft-office/sheet-protocol.ts +88 -0
- package/src/microsoft-office/slide-fonts-machine.ts +290 -0
- package/src/microsoft-office/slide-fonts.ts +157 -0
- package/src/microsoft-office/slide-paint-machine.ts +322 -0
- package/src/microsoft-office/slide-protocol.ts +50 -0
- package/src/microsoft-office/slide-text.ts +334 -0
- package/src/microsoft-office/spreadsheet.tsx +1165 -0
- package/src/microsoft-office/spreadsheet.worker.ts +259 -0
- package/src/microsoft-office/word-images.ts +105 -0
- package/src/microsoft-office/word-layout-machine.ts +219 -0
- package/src/microsoft-office/word-paint-machine.ts +174 -0
- package/src/microsoft-office/word-protocol.ts +78 -0
- package/src/microsoft-office/word-text.ts +260 -0
- package/src/microsoft-office/worker-machine.ts +111 -0
- package/src/microsoft-office/worker-rpc-machine.ts +336 -0
- package/src/microsoft-office/worker-rpc.fixture.ts +90 -0
- package/src/microsoft-office/worker-rpc.ts +292 -0
- package/src/pairing/contract.ts +24 -0
- package/src/pairing/copy-machine.ts +107 -0
- package/src/pairing/dialog.stories.tsx +69 -0
- package/src/pairing/dispatch.ts +42 -0
- package/src/pairing/i18n/en.ts +28 -0
- package/src/pairing/icons/pair.svg +4 -0
- package/src/pairing/index.ts +5 -0
- package/src/pairing/machine.ts +869 -0
- package/src/pairing/main-machine.ts +239 -0
- package/src/pairing/main.ts +130 -0
- package/src/pairing/page.stories.tsx +108 -0
- package/src/pairing/page.tsx +486 -0
- package/src/pairing/remote.ts +7 -0
- package/src/pairing/renderer.tsx +66 -0
- package/src/renderer.ts +55 -0
- package/src/review/contract.ts +31 -0
- package/src/review/detail-machine.ts +250 -0
- package/src/review/folder-machine.ts +404 -0
- package/src/review/i18n/am.ts +23 -0
- package/src/review/i18n/ar.ts +35 -0
- package/src/review/i18n/az.ts +23 -0
- package/src/review/i18n/bg.ts +23 -0
- package/src/review/i18n/bn.ts +23 -0
- package/src/review/i18n/br.ts +27 -0
- package/src/review/i18n/bs.ts +26 -0
- package/src/review/i18n/ca.ts +27 -0
- package/src/review/i18n/cs.ts +29 -0
- package/src/review/i18n/da.ts +23 -0
- package/src/review/i18n/de.ts +23 -0
- package/src/review/i18n/dv.ts +24 -0
- package/src/review/i18n/dz.ts +24 -0
- package/src/review/i18n/el.ts +23 -0
- package/src/review/i18n/en.ts +28 -0
- package/src/review/i18n/es.ts +27 -0
- package/src/review/i18n/et.ts +23 -0
- package/src/review/i18n/fa.ts +23 -0
- package/src/review/i18n/fi.ts +23 -0
- package/src/review/i18n/fo.ts +23 -0
- package/src/review/i18n/fr.ts +27 -0
- package/src/review/i18n/he.ts +26 -0
- package/src/review/i18n/hi.ts +23 -0
- package/src/review/i18n/hr.ts +26 -0
- package/src/review/i18n/hu.ts +23 -0
- package/src/review/i18n/hy.ts +23 -0
- package/src/review/i18n/id.ts +24 -0
- package/src/review/i18n/is.ts +23 -0
- package/src/review/i18n/it.ts +27 -0
- package/src/review/i18n/ja.ts +23 -0
- package/src/review/i18n/ka.ts +23 -0
- package/src/review/i18n/km.ts +23 -0
- package/src/review/i18n/ko.ts +23 -0
- package/src/review/i18n/lo.ts +23 -0
- package/src/review/i18n/lt.ts +29 -0
- package/src/review/i18n/lv.ts +26 -0
- package/src/review/i18n/mk.ts +23 -0
- package/src/review/i18n/mn.ts +23 -0
- package/src/review/i18n/ms.ts +24 -0
- package/src/review/i18n/my.ts +24 -0
- package/src/review/i18n/ne.ts +23 -0
- package/src/review/i18n/nl.ts +23 -0
- package/src/review/i18n/no.ts +23 -0
- package/src/review/i18n/pa.ts +23 -0
- package/src/review/i18n/pl.ts +29 -0
- package/src/review/i18n/ro.ts +26 -0
- package/src/review/i18n/ru.ts +29 -0
- package/src/review/i18n/si.ts +23 -0
- package/src/review/i18n/sk.ts +29 -0
- package/src/review/i18n/sl.ts +29 -0
- package/src/review/i18n/sq.ts +24 -0
- package/src/review/i18n/sr.ts +27 -0
- package/src/review/i18n/sv.ts +23 -0
- package/src/review/i18n/tg.ts +23 -0
- package/src/review/i18n/th.ts +23 -0
- package/src/review/i18n/tk.ts +23 -0
- package/src/review/i18n/tr.ts +23 -0
- package/src/review/i18n/uk.ts +30 -0
- package/src/review/i18n/ur.ts +23 -0
- package/src/review/i18n/uz.ts +23 -0
- package/src/review/i18n/vi.ts +24 -0
- package/src/review/i18n/zh.ts +23 -0
- package/src/review/i18n/zht.ts +23 -0
- package/src/review/index.ts +138 -0
- package/src/review/init-git-machine.ts +152 -0
- package/src/review/kinds.ts +191 -0
- package/src/review/machine.ts +274 -0
- package/src/review/mobile.tsx +91 -0
- package/src/review/model.ts +1123 -0
- package/src/review/panel.stories.tsx +50 -0
- package/src/review/panel.tsx +516 -0
- package/src/review/parts.tsx +141 -0
- package/src/review/render-machine.ts +74 -0
- package/src/review/renderer.tsx +403 -0
- package/src/review/screen-machine.ts +199 -0
- package/src/review/scroll-machine.ts +265 -0
- package/src/review/settings.tsx +28 -0
- package/src/schemes.ts +9 -0
- package/src/sources/i18n/en.ts +3 -0
- package/src/sources/index.ts +4 -0
- package/src/sources/panel.tsx +36 -0
- package/src/sources/renderer.tsx +95 -0
- package/src/ssh/add-machine.ts +63 -0
- package/src/ssh/askpass.ts +94 -0
- package/src/ssh/bootstrap.ts +160 -0
- package/src/ssh/command.ts +243 -0
- package/src/ssh/contract.ts +89 -0
- package/src/ssh/controller.ts +345 -0
- package/src/ssh/cover.tsx +66 -0
- package/src/ssh/dialog-machine.ts +249 -0
- package/src/ssh/dialog.stories.tsx +348 -0
- package/src/ssh/dialog.tsx +236 -0
- package/src/ssh/i18n/am.ts +37 -0
- package/src/ssh/i18n/ar.ts +38 -0
- package/src/ssh/i18n/az.ts +43 -0
- package/src/ssh/i18n/bg.ts +42 -0
- package/src/ssh/i18n/bn.ts +41 -0
- package/src/ssh/i18n/br.ts +43 -0
- package/src/ssh/i18n/bs.ts +43 -0
- package/src/ssh/i18n/ca.ts +43 -0
- package/src/ssh/i18n/cs.ts +43 -0
- package/src/ssh/i18n/da.ts +43 -0
- package/src/ssh/i18n/de.ts +44 -0
- package/src/ssh/i18n/dv.ts +43 -0
- package/src/ssh/i18n/dz.ts +43 -0
- package/src/ssh/i18n/el.ts +45 -0
- package/src/ssh/i18n/en.ts +40 -0
- package/src/ssh/i18n/es.ts +43 -0
- package/src/ssh/i18n/et.ts +41 -0
- package/src/ssh/i18n/fa.ts +39 -0
- package/src/ssh/i18n/fi.ts +40 -0
- package/src/ssh/i18n/fo.ts +41 -0
- package/src/ssh/i18n/fr.ts +43 -0
- package/src/ssh/i18n/he.ts +37 -0
- package/src/ssh/i18n/hi.ts +40 -0
- package/src/ssh/i18n/hr.ts +43 -0
- package/src/ssh/i18n/hu.ts +43 -0
- package/src/ssh/i18n/hy.ts +41 -0
- package/src/ssh/i18n/id.ts +42 -0
- package/src/ssh/i18n/is.ts +40 -0
- package/src/ssh/i18n/it.ts +43 -0
- package/src/ssh/i18n/ja.ts +43 -0
- package/src/ssh/i18n/ka.ts +43 -0
- package/src/ssh/i18n/km.ts +41 -0
- package/src/ssh/i18n/ko.ts +40 -0
- package/src/ssh/i18n/lo.ts +39 -0
- package/src/ssh/i18n/lt.ts +41 -0
- package/src/ssh/i18n/lv.ts +42 -0
- package/src/ssh/i18n/mk.ts +43 -0
- package/src/ssh/i18n/mn.ts +41 -0
- package/src/ssh/i18n/ms.ts +40 -0
- package/src/ssh/i18n/my.ts +41 -0
- package/src/ssh/i18n/ne.ts +39 -0
- package/src/ssh/i18n/nl.ts +43 -0
- package/src/ssh/i18n/no.ts +42 -0
- package/src/ssh/i18n/pa.ts +40 -0
- package/src/ssh/i18n/pl.ts +42 -0
- package/src/ssh/i18n/ro.ts +44 -0
- package/src/ssh/i18n/ru.ts +42 -0
- package/src/ssh/i18n/si.ts +41 -0
- package/src/ssh/i18n/sk.ts +42 -0
- package/src/ssh/i18n/sl.ts +41 -0
- package/src/ssh/i18n/sq.ts +43 -0
- package/src/ssh/i18n/sr.ts +41 -0
- package/src/ssh/i18n/sv.ts +43 -0
- package/src/ssh/i18n/tg.ts +43 -0
- package/src/ssh/i18n/th.ts +38 -0
- package/src/ssh/i18n/tk.ts +41 -0
- package/src/ssh/i18n/tr.ts +42 -0
- package/src/ssh/i18n/uk.ts +40 -0
- package/src/ssh/i18n/ur.ts +40 -0
- package/src/ssh/i18n/uz.ts +43 -0
- package/src/ssh/i18n/vi.ts +42 -0
- package/src/ssh/i18n/zh.ts +36 -0
- package/src/ssh/i18n/zht.ts +36 -0
- package/src/ssh/index.ts +71 -0
- package/src/ssh/main-machine.ts +532 -0
- package/src/ssh/main.ts +75 -0
- package/src/ssh/name.ts +28 -0
- package/src/ssh/remote-cli.ts +137 -0
- package/src/ssh/renderer.tsx +254 -0
- package/src/ssh/row.tsx +97 -0
- package/src/ssh/ssh.css +35 -0
- package/src/ssh/state.ts +217 -0
- package/src/ssh/window-machine.ts +533 -0
- package/src/terminal/connection-machine.ts +285 -0
- package/src/terminal/connection.ts +112 -0
- package/src/terminal/dispatch.ts +44 -0
- package/src/terminal/focus-machine.ts +112 -0
- package/src/terminal/focus.ts +23 -0
- package/src/terminal/hover-label.ts +20 -0
- package/src/terminal/i18n/am.ts +28 -0
- package/src/terminal/i18n/ar.ts +28 -0
- package/src/terminal/i18n/az.ts +29 -0
- package/src/terminal/i18n/bg.ts +29 -0
- package/src/terminal/i18n/bn.ts +28 -0
- package/src/terminal/i18n/br.ts +29 -0
- package/src/terminal/i18n/bs.ts +29 -0
- package/src/terminal/i18n/ca.ts +28 -0
- package/src/terminal/i18n/cs.ts +28 -0
- package/src/terminal/i18n/da.ts +28 -0
- package/src/terminal/i18n/de.ts +29 -0
- package/src/terminal/i18n/dv.ts +28 -0
- package/src/terminal/i18n/dz.ts +28 -0
- package/src/terminal/i18n/el.ts +30 -0
- package/src/terminal/i18n/en.ts +30 -0
- package/src/terminal/i18n/es.ts +28 -0
- package/src/terminal/i18n/et.ts +28 -0
- package/src/terminal/i18n/fa.ts +28 -0
- package/src/terminal/i18n/fi.ts +29 -0
- package/src/terminal/i18n/fo.ts +28 -0
- package/src/terminal/i18n/fr.ts +29 -0
- package/src/terminal/i18n/he.ts +28 -0
- package/src/terminal/i18n/hi.ts +28 -0
- package/src/terminal/i18n/hr.ts +28 -0
- package/src/terminal/i18n/hu.ts +28 -0
- package/src/terminal/i18n/hy.ts +29 -0
- package/src/terminal/i18n/id.ts +28 -0
- package/src/terminal/i18n/is.ts +28 -0
- package/src/terminal/i18n/it.ts +28 -0
- package/src/terminal/i18n/ja.ts +29 -0
- package/src/terminal/i18n/ka.ts +29 -0
- package/src/terminal/i18n/km.ts +28 -0
- package/src/terminal/i18n/ko.ts +28 -0
- package/src/terminal/i18n/lo.ts +28 -0
- package/src/terminal/i18n/lt.ts +29 -0
- package/src/terminal/i18n/lv.ts +28 -0
- package/src/terminal/i18n/mk.ts +29 -0
- package/src/terminal/i18n/mn.ts +30 -0
- package/src/terminal/i18n/ms.ts +28 -0
- package/src/terminal/i18n/my.ts +29 -0
- package/src/terminal/i18n/ne.ts +28 -0
- package/src/terminal/i18n/nl.ts +28 -0
- package/src/terminal/i18n/no.ts +28 -0
- package/src/terminal/i18n/pa.ts +28 -0
- package/src/terminal/i18n/pl.ts +28 -0
- package/src/terminal/i18n/ro.ts +28 -0
- package/src/terminal/i18n/ru.ts +28 -0
- package/src/terminal/i18n/si.ts +28 -0
- package/src/terminal/i18n/sk.ts +28 -0
- package/src/terminal/i18n/sl.ts +28 -0
- package/src/terminal/i18n/sq.ts +29 -0
- package/src/terminal/i18n/sr.ts +28 -0
- package/src/terminal/i18n/sv.ts +28 -0
- package/src/terminal/i18n/tg.ts +29 -0
- package/src/terminal/i18n/th.ts +28 -0
- package/src/terminal/i18n/tk.ts +29 -0
- package/src/terminal/i18n/tr.ts +29 -0
- package/src/terminal/i18n/uk.ts +28 -0
- package/src/terminal/i18n/ur.ts +28 -0
- package/src/terminal/i18n/uz.ts +29 -0
- package/src/terminal/i18n/vi.ts +28 -0
- package/src/terminal/i18n/zh.ts +28 -0
- package/src/terminal/i18n/zht.ts +28 -0
- package/src/terminal/index.ts +74 -0
- package/src/terminal/inline-rename.ts +93 -0
- package/src/terminal/label.tsx +71 -0
- package/src/terminal/machine.ts +767 -0
- package/src/terminal/model.ts +661 -0
- package/src/terminal/pane-machine.ts +260 -0
- package/src/terminal/panel.tsx +280 -0
- package/src/terminal/props.ts +16 -0
- package/src/terminal/quote-machine.ts +381 -0
- package/src/terminal/quote.css +7 -0
- package/src/terminal/quote.tsx +218 -0
- package/src/terminal/rename-machine.ts +98 -0
- package/src/terminal/renderer.tsx +298 -0
- package/src/terminal/runtime-adapters.ts +34 -0
- package/src/terminal/surface-machine.ts +186 -0
- package/src/terminal/tab.tsx +112 -0
- package/src/terminal/terminal-key-event.ts +58 -0
- package/src/terminal/terminal.fixture.tsx +71 -0
- package/src/terminal/terminal.tsx +652 -0
- package/src/terminal/title.ts +41 -0
- package/src/terminal/writer.ts +87 -0
- package/src/updater/action.ts +37 -0
- package/src/updater/actions.tsx +110 -0
- package/src/updater/i18n/am.ts +40 -0
- package/src/updater/i18n/ar.ts +40 -0
- package/src/updater/i18n/az.ts +41 -0
- package/src/updater/i18n/bg.ts +40 -0
- package/src/updater/i18n/bn.ts +41 -0
- package/src/updater/i18n/br.ts +40 -0
- package/src/updater/i18n/bs.ts +41 -0
- package/src/updater/i18n/ca.ts +41 -0
- package/src/updater/i18n/cs.ts +41 -0
- package/src/updater/i18n/da.ts +40 -0
- package/src/updater/i18n/de.ts +41 -0
- package/src/updater/i18n/dv.ts +41 -0
- package/src/updater/i18n/dz.ts +42 -0
- package/src/updater/i18n/el.ts +42 -0
- package/src/updater/i18n/en.ts +42 -0
- package/src/updater/i18n/es.ts +40 -0
- package/src/updater/i18n/et.ts +40 -0
- package/src/updater/i18n/fa.ts +40 -0
- package/src/updater/i18n/fi.ts +41 -0
- package/src/updater/i18n/fo.ts +40 -0
- package/src/updater/i18n/fr.ts +41 -0
- package/src/updater/i18n/he.ts +40 -0
- package/src/updater/i18n/hi.ts +40 -0
- package/src/updater/i18n/hr.ts +41 -0
- package/src/updater/i18n/hu.ts +40 -0
- package/src/updater/i18n/hy.ts +41 -0
- package/src/updater/i18n/id.ts +41 -0
- package/src/updater/i18n/is.ts +40 -0
- package/src/updater/i18n/it.ts +40 -0
- package/src/updater/i18n/ja.ts +41 -0
- package/src/updater/i18n/ka.ts +40 -0
- package/src/updater/i18n/km.ts +40 -0
- package/src/updater/i18n/ko.ts +40 -0
- package/src/updater/i18n/lo.ts +40 -0
- package/src/updater/i18n/lt.ts +41 -0
- package/src/updater/i18n/lv.ts +40 -0
- package/src/updater/i18n/mk.ts +41 -0
- package/src/updater/i18n/mn.ts +40 -0
- package/src/updater/i18n/ms.ts +41 -0
- package/src/updater/i18n/my.ts +40 -0
- package/src/updater/i18n/ne.ts +40 -0
- package/src/updater/i18n/nl.ts +41 -0
- package/src/updater/i18n/no.ts +40 -0
- package/src/updater/i18n/pa.ts +40 -0
- package/src/updater/i18n/pl.ts +41 -0
- package/src/updater/i18n/ro.ts +41 -0
- package/src/updater/i18n/ru.ts +40 -0
- package/src/updater/i18n/si.ts +40 -0
- package/src/updater/i18n/sk.ts +41 -0
- package/src/updater/i18n/sl.ts +40 -0
- package/src/updater/i18n/sq.ts +40 -0
- package/src/updater/i18n/sr.ts +41 -0
- package/src/updater/i18n/sv.ts +40 -0
- package/src/updater/i18n/tg.ts +41 -0
- package/src/updater/i18n/th.ts +40 -0
- package/src/updater/i18n/tk.ts +40 -0
- package/src/updater/i18n/tr.ts +40 -0
- package/src/updater/i18n/uk.ts +40 -0
- package/src/updater/i18n/ur.ts +40 -0
- package/src/updater/i18n/uz.ts +41 -0
- package/src/updater/i18n/vi.ts +41 -0
- package/src/updater/i18n/zh.ts +40 -0
- package/src/updater/i18n/zht.ts +40 -0
- package/src/updater/index.ts +94 -0
- package/src/updater/log.ts +41 -0
- package/src/updater/machine.ts +919 -0
- package/src/updater/main.ts +138 -0
- package/src/updater/platform.ts +160 -0
- package/src/updater/renderer.tsx +203 -0
- package/src/updater/section.tsx +65 -0
- package/src/updater/web-driver.ts +200 -0
- package/src/updater/web-machine.ts +222 -0
- package/src/updater/web.tsx +103 -0
- package/src/updater/whats-new-machine.ts +97 -0
- package/src/updater/whats-new.stories.tsx +38 -0
- package/src/updater/whats-new.tsx +304 -0
- package/src/updater/window-machine.ts +73 -0
- package/src/wsl/add-machine.ts +56 -0
- package/src/wsl/contract.ts +104 -0
- package/src/wsl/dialog-machine.ts +322 -0
- package/src/wsl/dialog.css +372 -0
- package/src/wsl/dialog.tsx +492 -0
- package/src/wsl/i18n/am.ts +53 -0
- package/src/wsl/i18n/ar.ts +55 -0
- package/src/wsl/i18n/az.ts +57 -0
- package/src/wsl/i18n/bg.ts +58 -0
- package/src/wsl/i18n/bn.ts +56 -0
- package/src/wsl/i18n/br.ts +58 -0
- package/src/wsl/i18n/bs.ts +58 -0
- package/src/wsl/i18n/ca.ts +58 -0
- package/src/wsl/i18n/cs.ts +57 -0
- package/src/wsl/i18n/da.ts +57 -0
- package/src/wsl/i18n/de.ts +59 -0
- package/src/wsl/i18n/dv.ts +58 -0
- package/src/wsl/i18n/dz.ts +59 -0
- package/src/wsl/i18n/el.ts +57 -0
- package/src/wsl/i18n/en.ts +55 -0
- package/src/wsl/i18n/es.ts +58 -0
- package/src/wsl/i18n/et.ts +55 -0
- package/src/wsl/i18n/fa.ts +56 -0
- package/src/wsl/i18n/fi.ts +57 -0
- package/src/wsl/i18n/fo.ts +56 -0
- package/src/wsl/i18n/fr.ts +57 -0
- package/src/wsl/i18n/he.ts +54 -0
- package/src/wsl/i18n/hi.ts +57 -0
- package/src/wsl/i18n/hr.ts +58 -0
- package/src/wsl/i18n/hu.ts +58 -0
- package/src/wsl/i18n/hy.ts +57 -0
- package/src/wsl/i18n/id.ts +56 -0
- package/src/wsl/i18n/is.ts +55 -0
- package/src/wsl/i18n/it.ts +57 -0
- package/src/wsl/i18n/ja.ts +57 -0
- package/src/wsl/i18n/ka.ts +56 -0
- package/src/wsl/i18n/km.ts +57 -0
- package/src/wsl/i18n/ko.ts +56 -0
- package/src/wsl/i18n/lo.ts +54 -0
- package/src/wsl/i18n/lt.ts +57 -0
- package/src/wsl/i18n/lv.ts +57 -0
- package/src/wsl/i18n/mk.ts +57 -0
- package/src/wsl/i18n/mn.ts +58 -0
- package/src/wsl/i18n/ms.ts +57 -0
- package/src/wsl/i18n/my.ts +57 -0
- package/src/wsl/i18n/ne.ts +57 -0
- package/src/wsl/i18n/nl.ts +57 -0
- package/src/wsl/i18n/no.ts +57 -0
- package/src/wsl/i18n/pa.ts +57 -0
- package/src/wsl/i18n/pl.ts +58 -0
- package/src/wsl/i18n/ro.ts +56 -0
- package/src/wsl/i18n/ru.ts +57 -0
- package/src/wsl/i18n/si.ts +56 -0
- package/src/wsl/i18n/sk.ts +57 -0
- package/src/wsl/i18n/sl.ts +57 -0
- package/src/wsl/i18n/sq.ts +56 -0
- package/src/wsl/i18n/sr.ts +57 -0
- package/src/wsl/i18n/sv.ts +58 -0
- package/src/wsl/i18n/tg.ts +57 -0
- package/src/wsl/i18n/th.ts +57 -0
- package/src/wsl/i18n/tk.ts +56 -0
- package/src/wsl/i18n/tr.ts +57 -0
- package/src/wsl/i18n/uk.ts +57 -0
- package/src/wsl/i18n/ur.ts +57 -0
- package/src/wsl/i18n/uz.ts +57 -0
- package/src/wsl/i18n/vi.ts +56 -0
- package/src/wsl/i18n/zh.ts +53 -0
- package/src/wsl/i18n/zht.ts +53 -0
- package/src/wsl/index.ts +72 -0
- package/src/wsl/local.ts +41 -0
- package/src/wsl/machine.ts +652 -0
- package/src/wsl/main.ts +95 -0
- package/src/wsl/model.ts +369 -0
- package/src/wsl/probe-machine.ts +143 -0
- package/src/wsl/probes.ts +107 -0
- package/src/wsl/remote-cli.ts +49 -0
- package/src/wsl/renderer.tsx +164 -0
- package/src/wsl/row-view.ts +25 -0
- package/src/wsl/row.tsx +76 -0
- package/src/wsl/runtime.ts +441 -0
- package/src/wsl/servers.ts +330 -0
- package/src/wsl/sidecar.ts +186 -0
- package/tsconfig.json +21 -0
|
@@ -0,0 +1,1632 @@
|
|
|
1
|
+
import type { PluginInfo } from "@zyro-sec/client"
|
|
2
|
+
import { Button } from "@zyro-sec/ui/button"
|
|
3
|
+
import { Dialog, DialogBody, DialogHeader, DialogTitleGroup } from "@zyro-sec/ui/dialog"
|
|
4
|
+
import { ErrorDetails } from "@zyro-sec/ui/error-details"
|
|
5
|
+
import { Icon } from "@zyro-sec/ui/icon"
|
|
6
|
+
import { Loader } from "@zyro-sec/ui/loader"
|
|
7
|
+
import { createMcpSignIn, type McpSignInFailure } from "@zyro-sec/ui/mcp-sign-in"
|
|
8
|
+
import { MenuScroll } from "@zyro-sec/ui/menu-scroll"
|
|
9
|
+
import { RedirectPasteForm } from "@zyro-sec/ui/redirect-paste"
|
|
10
|
+
import { Switch } from "@zyro-sec/ui/switch"
|
|
11
|
+
import { showToast } from "@zyro-sec/ui/toast"
|
|
12
|
+
import { Tooltip } from "@zyro-sec/ui/tooltip"
|
|
13
|
+
import { TruncatedText } from "@zyro-sec/ui/truncated-text"
|
|
14
|
+
import {
|
|
15
|
+
children,
|
|
16
|
+
createMemo,
|
|
17
|
+
createSignal,
|
|
18
|
+
createUniqueId,
|
|
19
|
+
For,
|
|
20
|
+
Index,
|
|
21
|
+
onCleanup,
|
|
22
|
+
Show,
|
|
23
|
+
untrack,
|
|
24
|
+
type Accessor,
|
|
25
|
+
type Component,
|
|
26
|
+
type JSX,
|
|
27
|
+
} from "solid-js"
|
|
28
|
+
import { createStore } from "solid-js/store"
|
|
29
|
+
import { createKeyed, useDrawer, usePlugin, type MountedSession, type ServerRef } from "@zyro-sec/plugin/gui"
|
|
30
|
+
import { globalConfigDirectory, serviceConfigFile } from "./config-file"
|
|
31
|
+
import { builtinContext } from "@zyro-sec/plugin/gui/builtin"
|
|
32
|
+
import { createFlyoutMotion } from "./flyout-motion"
|
|
33
|
+
import {
|
|
34
|
+
configActionView,
|
|
35
|
+
initialConfigActionState,
|
|
36
|
+
transitionConfigAction,
|
|
37
|
+
type ConfigActionEffect,
|
|
38
|
+
type ConfigActionEvent,
|
|
39
|
+
type ConfigActionState,
|
|
40
|
+
} from "./config-action-machine"
|
|
41
|
+
import {
|
|
42
|
+
flyoutActive,
|
|
43
|
+
flyoutAnchor,
|
|
44
|
+
flyoutPane,
|
|
45
|
+
initialFlyoutState,
|
|
46
|
+
sameAnchor,
|
|
47
|
+
transitionFlyout,
|
|
48
|
+
type FlyoutAnchor,
|
|
49
|
+
type FlyoutEvent,
|
|
50
|
+
type FlyoutState,
|
|
51
|
+
type Service,
|
|
52
|
+
} from "./flyout-machine"
|
|
53
|
+
import {
|
|
54
|
+
initialMcpState,
|
|
55
|
+
mcpDialogView,
|
|
56
|
+
mcpRowView,
|
|
57
|
+
transitionMcp,
|
|
58
|
+
type McpEffect,
|
|
59
|
+
type McpEvent,
|
|
60
|
+
type McpServerStatus,
|
|
61
|
+
type McpState,
|
|
62
|
+
} from "./mcp-machine"
|
|
63
|
+
import {
|
|
64
|
+
initialServiceLoadState,
|
|
65
|
+
serviceLoadView,
|
|
66
|
+
transitionServiceLoad,
|
|
67
|
+
type ServiceLoadEffect,
|
|
68
|
+
type ServiceLoadEvent,
|
|
69
|
+
type ServiceLoadState,
|
|
70
|
+
type ServiceLoadView,
|
|
71
|
+
} from "./service-load-machine"
|
|
72
|
+
|
|
73
|
+
const services = [
|
|
74
|
+
{ type: "mcp", icon: "mcp", label: "mcp" },
|
|
75
|
+
{ type: "plugins", icon: "cube", label: "plugins" },
|
|
76
|
+
{ type: "skills", icon: "post-skill", label: "skills" },
|
|
77
|
+
] as const satisfies readonly { type: Service; icon: string; label: string }[]
|
|
78
|
+
|
|
79
|
+
type ServiceProps = {
|
|
80
|
+
session: MountedSession
|
|
81
|
+
directory: string
|
|
82
|
+
shown: boolean
|
|
83
|
+
/** Closes the details popover, once an action opened something beside it. */
|
|
84
|
+
onClose?: () => void
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** One service's list: its load state, what its row summarises, and the list itself. */
|
|
88
|
+
type ServiceSource = {
|
|
89
|
+
readonly view: ServiceLoadView<unknown>
|
|
90
|
+
readonly count: number
|
|
91
|
+
readonly failed: boolean
|
|
92
|
+
/** Loads the list again when it opens; joins a load that runs. */
|
|
93
|
+
refresh: () => void
|
|
94
|
+
retry: () => void
|
|
95
|
+
Body: Component
|
|
96
|
+
/** The actions under the list, outside its scroll box so they stay in view. */
|
|
97
|
+
Footer: Component
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function SessionServerPanel(props: ServiceProps & { mobile?: boolean; mcp: McpControllers }) {
|
|
101
|
+
const ctx = usePlugin()
|
|
102
|
+
const name = () => (ctx.servers.list().length < 2 ? ctx.t("server") : props.session.server.name)
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<Show
|
|
106
|
+
when={props.directory}
|
|
107
|
+
keyed
|
|
108
|
+
fallback={
|
|
109
|
+
<section class="session-summary-card" data-section="server">
|
|
110
|
+
<ServerHeading name={name()} />
|
|
111
|
+
</section>
|
|
112
|
+
}
|
|
113
|
+
>
|
|
114
|
+
{(directory) => (
|
|
115
|
+
// Another server starts its lists and flyout afresh.
|
|
116
|
+
<Show when={props.session.server.id} keyed>
|
|
117
|
+
<ServiceMenu
|
|
118
|
+
session={props.session}
|
|
119
|
+
directory={directory}
|
|
120
|
+
shown={props.shown}
|
|
121
|
+
mobile={props.mobile}
|
|
122
|
+
name={name()}
|
|
123
|
+
mcp={props.mcp}
|
|
124
|
+
onClose={props.onClose}
|
|
125
|
+
/>
|
|
126
|
+
</Show>
|
|
127
|
+
)}
|
|
128
|
+
</Show>
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function ServerHeading(props: { name: string }) {
|
|
133
|
+
return (
|
|
134
|
+
<h2 class="session-summary-row session-summary-heading">
|
|
135
|
+
<span dir="auto" class="session-summary-label">
|
|
136
|
+
{props.name}
|
|
137
|
+
</span>
|
|
138
|
+
</h2>
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function ServiceMenu(props: ServiceProps & { mobile?: boolean; name: string; mcp: McpControllers }) {
|
|
143
|
+
const ctx = usePlugin()
|
|
144
|
+
const drawer = useDrawer()
|
|
145
|
+
const id = createUniqueId()
|
|
146
|
+
const motion = createFlyoutMotion()
|
|
147
|
+
|
|
148
|
+
const [flyoutState, setFlyoutState] = createSignal<FlyoutState>(initialFlyoutState)
|
|
149
|
+
|
|
150
|
+
// Each list's measured height, and whether it scrolls.
|
|
151
|
+
const [sizes, setSizes] = createStore<{
|
|
152
|
+
heights: Partial<Record<Service, number>>
|
|
153
|
+
overflow: Partial<Record<Service, boolean>>
|
|
154
|
+
}>({ heights: {}, overflow: {} })
|
|
155
|
+
|
|
156
|
+
const sources: Record<Service, ServiceSource> = {
|
|
157
|
+
mcp: useMcp(props, props.mcp, () => dispatch({ type: "close", focusRow: false })),
|
|
158
|
+
plugins: usePlugins(props),
|
|
159
|
+
skills: useSkills(props),
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Memos, so a pointer aiming across rows, which replaces the state on each new target, rewrites nothing on screen.
|
|
163
|
+
const active = createMemo(() => flyoutActive(flyoutState()))
|
|
164
|
+
const pane = createMemo(() => flyoutPane(flyoutState()))
|
|
165
|
+
const anchor = createMemo(() => flyoutAnchor(flyoutState()), undefined, { equals: sameAnchor })
|
|
166
|
+
|
|
167
|
+
const height = () => {
|
|
168
|
+
const current = pane()
|
|
169
|
+
|
|
170
|
+
return (current ? (sizes.heights[current] ?? 0) : 0) + 4
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Beside its row, kept inside the viewport.
|
|
174
|
+
const offset = () => Math.max(-anchor().above, Math.min(anchor().row - 2, anchor().below - height()))
|
|
175
|
+
|
|
176
|
+
const rows: Partial<Record<Service, HTMLButtonElement>> = {}
|
|
177
|
+
const panes: Partial<Record<Service, HTMLElement>> = {}
|
|
178
|
+
const scrollers: Partial<Record<Service, HTMLElement>> = {}
|
|
179
|
+
let flyout: HTMLDivElement | undefined
|
|
180
|
+
let surface: HTMLDivElement | undefined
|
|
181
|
+
// The flyout's containing block in the viewport, measured when a list opens and on scroll or resize, so pointer
|
|
182
|
+
// moves never read layout.
|
|
183
|
+
const bounds = { left: 0, right: 0, top: 0 }
|
|
184
|
+
// The two latest pointer positions at least 2px apart, which give the pointer's heading.
|
|
185
|
+
const trail = { x: 0, y: 0, px: 0, py: 0 }
|
|
186
|
+
let aimTimer: ReturnType<typeof setTimeout> | undefined
|
|
187
|
+
|
|
188
|
+
// Places the flyout beside a row: where the row sits in the containing block, and the room around it. Undefined
|
|
189
|
+
// while the flyout or the row is not laid out.
|
|
190
|
+
const measure = (service: Service): FlyoutAnchor | undefined => {
|
|
191
|
+
const row = rows[service]
|
|
192
|
+
const box = flyout?.offsetParent
|
|
193
|
+
|
|
194
|
+
if (!row || !box || !surface) return
|
|
195
|
+
const base = box.getBoundingClientRect()
|
|
196
|
+
|
|
197
|
+
bounds.left = base.left
|
|
198
|
+
bounds.right = base.right
|
|
199
|
+
bounds.top = base.top
|
|
200
|
+
|
|
201
|
+
return {
|
|
202
|
+
row: row.getBoundingClientRect().top - base.top,
|
|
203
|
+
above: base.top - 16,
|
|
204
|
+
below: window.innerHeight - 16 - base.top,
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const dispatch = (event: FlyoutEvent) => {
|
|
209
|
+
const previous = untrack(flyoutState)
|
|
210
|
+
const next = transitionFlyout(previous, event)
|
|
211
|
+
|
|
212
|
+
// Focus returns to the row before the list goes inert, so it never falls to the document.
|
|
213
|
+
next.effects.forEach((effect) => {
|
|
214
|
+
if (effect.type === "focus-row") rows[effect.service]?.focus()
|
|
215
|
+
})
|
|
216
|
+
|
|
217
|
+
if (next.state !== previous)
|
|
218
|
+
commit(
|
|
219
|
+
next.state,
|
|
220
|
+
next.effects.some((effect) => effect.type === "snap-open"),
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
next.effects.forEach((effect) => {
|
|
224
|
+
if (effect.type === "schedule-aim") {
|
|
225
|
+
clearTimeout(aimTimer)
|
|
226
|
+
aimTimer = setTimeout(
|
|
227
|
+
() => dispatch({ type: "aim.due", attempt: effect.attempt, anchor: measure(effect.target) }),
|
|
228
|
+
effect.delayMs,
|
|
229
|
+
)
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (effect.type === "cancel-aim") clearTimeout(aimTimer)
|
|
233
|
+
|
|
234
|
+
if (effect.type === "refresh") sources[effect.service].refresh()
|
|
235
|
+
|
|
236
|
+
if (effect.type === "focus-pane") {
|
|
237
|
+
const element = panes[effect.service]
|
|
238
|
+
|
|
239
|
+
if (element) (focusables(element)[0] ?? element).focus()
|
|
240
|
+
}
|
|
241
|
+
})
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// The first open lands beside its row at its list's height; later switches glide and resize.
|
|
245
|
+
const commit = (state: FlyoutState, snap: boolean) => {
|
|
246
|
+
if (!snap || !flyout || !surface) return void setFlyoutState(state)
|
|
247
|
+
flyout.style.transition = "none"
|
|
248
|
+
surface.style.transition = "none"
|
|
249
|
+
setFlyoutState(state)
|
|
250
|
+
void flyout.offsetHeight
|
|
251
|
+
flyout.style.removeProperty("transition")
|
|
252
|
+
surface.style.removeProperty("transition")
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Moving between rows switches at once, except while the pointer heads for the open flyout across other rows.
|
|
256
|
+
const hover = (event: PointerEvent) => {
|
|
257
|
+
if (event.pointerType === "touch") return
|
|
258
|
+
|
|
259
|
+
if (Math.hypot(event.clientX - trail.x, event.clientY - trail.y) >= 2) {
|
|
260
|
+
trail.px = trail.x
|
|
261
|
+
trail.py = trail.y
|
|
262
|
+
trail.x = event.clientX
|
|
263
|
+
trail.y = event.clientY
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const current = active()
|
|
267
|
+
|
|
268
|
+
// A closed flyout opens when the pointer enters a row, so a pointer resting where Escape closed it stays put.
|
|
269
|
+
if (!current) return
|
|
270
|
+
const target = event.target
|
|
271
|
+
|
|
272
|
+
const service =
|
|
273
|
+
target instanceof Node ? services.find((item) => rows[item.type]?.contains(target))?.type : undefined
|
|
274
|
+
|
|
275
|
+
const heading = !!service && service !== current && aiming(event)
|
|
276
|
+
|
|
277
|
+
dispatch({
|
|
278
|
+
type: "row.moved",
|
|
279
|
+
service,
|
|
280
|
+
aiming: heading,
|
|
281
|
+
anchor: service && service !== current && !heading ? measure(service) : undefined,
|
|
282
|
+
})
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// Whether the pointer's last step points into the open flyout: inside the triangle from its previous position to
|
|
286
|
+
// the flyout's near edge.
|
|
287
|
+
const aiming = (event: PointerEvent) => {
|
|
288
|
+
// The flyout sits against the containing block's inline start, where it is heading rather than where it is.
|
|
289
|
+
const edge = ctx.locale.direction() === "rtl" ? bounds.right : bounds.left
|
|
290
|
+
const top = bounds.top + offset()
|
|
291
|
+
|
|
292
|
+
return insideTriangle(
|
|
293
|
+
{ x: event.clientX, y: event.clientY },
|
|
294
|
+
{ x: trail.px, y: trail.py },
|
|
295
|
+
{ x: edge, y: top - 8 },
|
|
296
|
+
{ x: edge, y: top + height() + 8 },
|
|
297
|
+
)
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
const keydown = (event: KeyboardEvent) => {
|
|
301
|
+
const target = event.target
|
|
302
|
+
|
|
303
|
+
if (!(target instanceof HTMLElement)) return
|
|
304
|
+
const rtl = ctx.locale.direction() === "rtl"
|
|
305
|
+
const into = rtl ? "ArrowLeft" : "ArrowRight"
|
|
306
|
+
const back = rtl ? "ArrowRight" : "ArrowLeft"
|
|
307
|
+
const row = services.findIndex((item) => rows[item.type] === target)
|
|
308
|
+
|
|
309
|
+
if (row !== -1) {
|
|
310
|
+
if (event.key === into) {
|
|
311
|
+
event.preventDefault()
|
|
312
|
+
const service = services[row].type
|
|
313
|
+
dispatch({ type: "row.activated", service, focus: true, shown: props.shown, anchor: measure(service) })
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if (event.key !== "ArrowDown" && event.key !== "ArrowUp") return
|
|
317
|
+
event.preventDefault()
|
|
318
|
+
const next = services[(row + (event.key === "ArrowDown" ? 1 : services.length - 1)) % services.length].type
|
|
319
|
+
rows[next]?.focus()
|
|
320
|
+
// An open flyout follows the focused row.
|
|
321
|
+
dispatch({ type: "row.moved", service: next, aiming: false, anchor: active() ? measure(next) : undefined })
|
|
322
|
+
|
|
323
|
+
return
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
const current = pane()
|
|
327
|
+
const element = current ? panes[current] : undefined
|
|
328
|
+
|
|
329
|
+
if (!element?.contains(target)) return
|
|
330
|
+
|
|
331
|
+
if (event.key === back) {
|
|
332
|
+
event.preventDefault()
|
|
333
|
+
dispatch({ type: "close", focusRow: true })
|
|
334
|
+
|
|
335
|
+
return
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
if (event.key !== "ArrowDown" && event.key !== "ArrowUp") return
|
|
339
|
+
event.preventDefault()
|
|
340
|
+
const items = focusables(element)
|
|
341
|
+
const index = items.findIndex((item) => item === target || item.contains(target))
|
|
342
|
+
const step = event.key === "ArrowDown" ? 1 : -1
|
|
343
|
+
items[index === -1 ? 0 : (index + step + items.length) % items.length]?.focus()
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// Hiding the details closes the flyout, so a pending aim cannot reopen it and each list refreshes on the next open.
|
|
347
|
+
createKeyed(
|
|
348
|
+
() => props.shown,
|
|
349
|
+
() => undefined,
|
|
350
|
+
{ otherwise: () => dispatch({ type: "hidden" }) },
|
|
351
|
+
)
|
|
352
|
+
onCleanup(() => dispatch({ type: "disposed" }))
|
|
353
|
+
|
|
354
|
+
// While a list is open: Escape closes only the flyout, before the details popover's own Escape handling sees it,
|
|
355
|
+
// and scrolling or resizing measures the flyout's place again.
|
|
356
|
+
createKeyed(
|
|
357
|
+
() => active() !== undefined,
|
|
358
|
+
() => {
|
|
359
|
+
const remeasure = () => {
|
|
360
|
+
const service = active()
|
|
361
|
+
|
|
362
|
+
if (service) dispatch({ type: "remeasured", anchor: measure(service) })
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
const escape = (event: KeyboardEvent) => {
|
|
366
|
+
const focused = document.activeElement
|
|
367
|
+
|
|
368
|
+
if (event.key !== "Escape" || !focused || !flyout?.offsetParent?.contains(focused)) return
|
|
369
|
+
event.preventDefault()
|
|
370
|
+
event.stopPropagation()
|
|
371
|
+
dispatch({ type: "close", focusRow: !!flyout?.contains(focused) })
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
document.addEventListener("keydown", escape, true)
|
|
375
|
+
document.addEventListener("scroll", remeasure, { capture: true, passive: true })
|
|
376
|
+
window.addEventListener("resize", remeasure)
|
|
377
|
+
onCleanup(() => {
|
|
378
|
+
document.removeEventListener("keydown", escape, true)
|
|
379
|
+
document.removeEventListener("scroll", remeasure, true)
|
|
380
|
+
window.removeEventListener("resize", remeasure)
|
|
381
|
+
})
|
|
382
|
+
},
|
|
383
|
+
)
|
|
384
|
+
|
|
385
|
+
// Measures each list, so the flyout clips to the one on show and knows when it scrolls.
|
|
386
|
+
const observer = new ResizeObserver((entries) =>
|
|
387
|
+
entries.forEach((entry) => {
|
|
388
|
+
const service = services.find((item) => panes[item.type]?.contains(entry.target))?.type
|
|
389
|
+
const element = service ? panes[service] : undefined
|
|
390
|
+
const scroller = service ? scrollers[service] : undefined
|
|
391
|
+
|
|
392
|
+
if (!service || !element || !scroller) return
|
|
393
|
+
setSizes("heights", service, element.offsetHeight)
|
|
394
|
+
setSizes("overflow", service, scroller.scrollHeight > scroller.clientHeight + 1)
|
|
395
|
+
}),
|
|
396
|
+
)
|
|
397
|
+
|
|
398
|
+
onCleanup(() => observer.disconnect())
|
|
399
|
+
|
|
400
|
+
if (props.mobile && drawer) {
|
|
401
|
+
return (
|
|
402
|
+
<section class="session-summary-card" data-section="server">
|
|
403
|
+
<ServerHeading name={props.name} />
|
|
404
|
+
<div class="session-summary-rows">
|
|
405
|
+
<For each={services}>
|
|
406
|
+
{(service) => {
|
|
407
|
+
const source = sources[service.type]
|
|
408
|
+
// In a narrow-screen drawer the service list replaces the drawer's view.
|
|
409
|
+
|
|
410
|
+
const content = children(() => (
|
|
411
|
+
<div class="session-summary-card session-service-drawer" aria-busy={source.view.busy}>
|
|
412
|
+
<ServiceBody source={source}>
|
|
413
|
+
<source.Body />
|
|
414
|
+
</ServiceBody>
|
|
415
|
+
<ServiceFooter source={source} />
|
|
416
|
+
</div>
|
|
417
|
+
))
|
|
418
|
+
|
|
419
|
+
return (
|
|
420
|
+
<button
|
|
421
|
+
type="button"
|
|
422
|
+
class="session-summary-row"
|
|
423
|
+
onClick={(event) => {
|
|
424
|
+
source.refresh()
|
|
425
|
+
drawer.open({ title: ctx.t(service.label), content: content(), trigger: event.currentTarget })
|
|
426
|
+
}}
|
|
427
|
+
>
|
|
428
|
+
<Icon name={service.icon} class="shrink-0 text-v2-icon-icon-muted" />
|
|
429
|
+
<span class="session-summary-label">{ctx.t(service.label)}</span>
|
|
430
|
+
<Icon name="chevron-right" class="session-summary-menu-indicator shrink-0 text-v2-icon-icon-muted" />
|
|
431
|
+
</button>
|
|
432
|
+
)
|
|
433
|
+
}}
|
|
434
|
+
</For>
|
|
435
|
+
</div>
|
|
436
|
+
</section>
|
|
437
|
+
)
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
return (
|
|
441
|
+
<>
|
|
442
|
+
<section class="session-summary-card" data-section="server" onKeyDown={keydown}>
|
|
443
|
+
<ServerHeading name={props.name} />
|
|
444
|
+
<div
|
|
445
|
+
class="session-summary-rows"
|
|
446
|
+
onPointerMove={hover}
|
|
447
|
+
onPointerLeave={() => dispatch({ type: "aim.cancelled" })}
|
|
448
|
+
>
|
|
449
|
+
<For each={services}>
|
|
450
|
+
{(service) => {
|
|
451
|
+
const source = sources[service.type]
|
|
452
|
+
|
|
453
|
+
return (
|
|
454
|
+
<button
|
|
455
|
+
ref={(element) => (rows[service.type] = element)}
|
|
456
|
+
type="button"
|
|
457
|
+
class="session-summary-row session-service-trigger"
|
|
458
|
+
data-expanded={active() === service.type || undefined}
|
|
459
|
+
aria-expanded={active() === service.type}
|
|
460
|
+
aria-controls={`${id}-${service.type}`}
|
|
461
|
+
onPointerEnter={(event) => {
|
|
462
|
+
if (event.pointerType === "touch" || active() !== undefined) return
|
|
463
|
+
dispatch({
|
|
464
|
+
type: "row.entered",
|
|
465
|
+
service: service.type,
|
|
466
|
+
shown: props.shown,
|
|
467
|
+
anchor: measure(service.type),
|
|
468
|
+
})
|
|
469
|
+
}}
|
|
470
|
+
onClick={(event) =>
|
|
471
|
+
dispatch({
|
|
472
|
+
type: "row.activated",
|
|
473
|
+
service: service.type,
|
|
474
|
+
focus: event.detail === 0,
|
|
475
|
+
shown: props.shown,
|
|
476
|
+
anchor: measure(service.type),
|
|
477
|
+
})
|
|
478
|
+
}
|
|
479
|
+
>
|
|
480
|
+
<Icon name={service.icon} class="shrink-0 text-v2-icon-icon-muted" />
|
|
481
|
+
<span class="session-summary-label">{ctx.t(service.label)}</span>
|
|
482
|
+
<Show when={source.view.status === "ready"}>
|
|
483
|
+
<Show when={source.failed}>
|
|
484
|
+
<span class="session-service-dot" data-status="failed" aria-hidden="true" />
|
|
485
|
+
</Show>
|
|
486
|
+
<Show when={source.count}>
|
|
487
|
+
<span class="session-service-count" aria-hidden="true">
|
|
488
|
+
{source.count}
|
|
489
|
+
</span>
|
|
490
|
+
</Show>
|
|
491
|
+
</Show>
|
|
492
|
+
<Icon
|
|
493
|
+
name="chevron-right"
|
|
494
|
+
class="session-summary-menu-indicator session-service-chevron shrink-0 text-v2-icon-icon-muted"
|
|
495
|
+
/>
|
|
496
|
+
</button>
|
|
497
|
+
)
|
|
498
|
+
}}
|
|
499
|
+
</For>
|
|
500
|
+
</div>
|
|
501
|
+
</section>
|
|
502
|
+
<div
|
|
503
|
+
ref={flyout}
|
|
504
|
+
class="session-service-flyout"
|
|
505
|
+
data-open={active() !== undefined || undefined}
|
|
506
|
+
data-motion={motion() || undefined}
|
|
507
|
+
inert={active() === undefined || undefined}
|
|
508
|
+
style={{ transform: `translateY(${offset()}px)` }}
|
|
509
|
+
onKeyDown={keydown}
|
|
510
|
+
onPointerEnter={() => dispatch({ type: "aim.cancelled" })}
|
|
511
|
+
>
|
|
512
|
+
<div class="session-service-flyout-body">
|
|
513
|
+
<div ref={surface} class="session-service-flyout-surface" style={{ "--flyout-height": `${height()}px` }}>
|
|
514
|
+
<For each={services}>
|
|
515
|
+
{(service) => {
|
|
516
|
+
const source = sources[service.type]
|
|
517
|
+
|
|
518
|
+
return (
|
|
519
|
+
<div
|
|
520
|
+
ref={(element) => {
|
|
521
|
+
panes[service.type] = element
|
|
522
|
+
observer.observe(element)
|
|
523
|
+
}}
|
|
524
|
+
id={`${id}-${service.type}`}
|
|
525
|
+
class="session-service-pane"
|
|
526
|
+
role="group"
|
|
527
|
+
tabIndex={-1}
|
|
528
|
+
aria-label={ctx.t(service.label)}
|
|
529
|
+
aria-busy={source.view.busy}
|
|
530
|
+
data-service={service.type}
|
|
531
|
+
data-active={pane() === service.type || undefined}
|
|
532
|
+
data-overflow={sizes.overflow[service.type] || undefined}
|
|
533
|
+
inert={pane() !== service.type || undefined}
|
|
534
|
+
>
|
|
535
|
+
<MenuScroll
|
|
536
|
+
class="min-h-0"
|
|
537
|
+
viewportClass="session-service-scroll"
|
|
538
|
+
viewportRef={(element) => (scrollers[service.type] = element)}
|
|
539
|
+
>
|
|
540
|
+
<div ref={(element) => observer.observe(element)} class="session-service-pane-content">
|
|
541
|
+
<ServiceBody source={source}>
|
|
542
|
+
<source.Body />
|
|
543
|
+
</ServiceBody>
|
|
544
|
+
</div>
|
|
545
|
+
</MenuScroll>
|
|
546
|
+
<ServiceFooter source={source} />
|
|
547
|
+
</div>
|
|
548
|
+
)
|
|
549
|
+
}}
|
|
550
|
+
</For>
|
|
551
|
+
</div>
|
|
552
|
+
</div>
|
|
553
|
+
</div>
|
|
554
|
+
</>
|
|
555
|
+
)
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
function useMcp(props: ServiceProps, controllers: McpControllers, close: () => void): ServiceSource {
|
|
559
|
+
const ctx = usePlugin()
|
|
560
|
+
const data = () => props.session.server.data
|
|
561
|
+
const mcp = useMcpController(controllers, props.session.server, props.directory)
|
|
562
|
+
|
|
563
|
+
const list = () => data().location.mcp.server.list({ directory: props.directory })
|
|
564
|
+
|
|
565
|
+
// The list lives in the server's data store; the machine tracks only whether it loaded.
|
|
566
|
+
const load = useServiceLoad(props, {
|
|
567
|
+
cached: () => (list() === undefined ? undefined : true),
|
|
568
|
+
retain: false,
|
|
569
|
+
task: async () => {
|
|
570
|
+
const current = data()
|
|
571
|
+
const directory = props.directory
|
|
572
|
+
|
|
573
|
+
current.location.mcp.server.invalidate({ directory })
|
|
574
|
+
await current.location.mcp.server.sync({ directory })
|
|
575
|
+
|
|
576
|
+
return true
|
|
577
|
+
},
|
|
578
|
+
})
|
|
579
|
+
|
|
580
|
+
const servers = createMemo(() => (list() ?? []).toSorted((a, b) => a.name.localeCompare(b.name)))
|
|
581
|
+
|
|
582
|
+
return {
|
|
583
|
+
get view() {
|
|
584
|
+
return load.view()
|
|
585
|
+
},
|
|
586
|
+
get count() {
|
|
587
|
+
return servers().length
|
|
588
|
+
},
|
|
589
|
+
get failed() {
|
|
590
|
+
return servers().some((server) => server.status.status === "failed")
|
|
591
|
+
},
|
|
592
|
+
refresh: load.refresh,
|
|
593
|
+
retry: load.retry,
|
|
594
|
+
Body: () => (
|
|
595
|
+
<Show when={servers().length} fallback={<ServiceEmpty title={ctx.t("mcp.empty")} />}>
|
|
596
|
+
<Index each={servers()}>
|
|
597
|
+
{(server) => {
|
|
598
|
+
const enabled = () => server().status.status !== "disabled"
|
|
599
|
+
const view = createMemo(() => mcpRowView(mcp.state(), server().name, server().status.status))
|
|
600
|
+
const pending = () => view().pending
|
|
601
|
+
const busy = () => view().busy
|
|
602
|
+
|
|
603
|
+
const failure = () => {
|
|
604
|
+
const status = server().status
|
|
605
|
+
|
|
606
|
+
return status.status === "failed" ? status.error : undefined
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
const signIn = () => server().status.status === "needs_auth" && !!server().integrationID
|
|
610
|
+
|
|
611
|
+
// The dot shows the status; the words stay for assistive technology.
|
|
612
|
+
const label = () => {
|
|
613
|
+
const status = server().status.status
|
|
614
|
+
|
|
615
|
+
if (status === "pending") return ctx.t("connecting")
|
|
616
|
+
|
|
617
|
+
if (status === "needs_auth") return ctx.t("needsAuth")
|
|
618
|
+
|
|
619
|
+
if (status === "failed") return ctx.t("failed")
|
|
620
|
+
|
|
621
|
+
return ctx.t(status === "connected" ? "mcp.connected" : "mcp.disabled")
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
const change = (value: boolean) =>
|
|
625
|
+
mcp.dispatch({
|
|
626
|
+
type: "toggle.requested",
|
|
627
|
+
name: server().name,
|
|
628
|
+
enabled: value,
|
|
629
|
+
status: server().status.status,
|
|
630
|
+
})
|
|
631
|
+
|
|
632
|
+
const showError = () => {
|
|
633
|
+
const error = failure()
|
|
634
|
+
|
|
635
|
+
if (error) mcp.dispatch({ type: "error.opened", name: server().name, error })
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
const follow = () => {
|
|
639
|
+
if (failure()) return showError()
|
|
640
|
+
change(server().status.status === "needs_auth" || !enabled())
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
return (
|
|
644
|
+
<div
|
|
645
|
+
class="session-mcp-row"
|
|
646
|
+
data-status={server().status.status}
|
|
647
|
+
data-disabled={pending() || undefined}
|
|
648
|
+
onClick={follow}
|
|
649
|
+
>
|
|
650
|
+
<span class="session-mcp-name">
|
|
651
|
+
<StatusDot
|
|
652
|
+
status={server().status.status}
|
|
653
|
+
error={failure()}
|
|
654
|
+
label={ctx.t("mcp.error.actionLabel", { name: server().name })}
|
|
655
|
+
onClick={showError}
|
|
656
|
+
/>
|
|
657
|
+
<TruncatedText text={server().name} class="session-summary-label" />
|
|
658
|
+
</span>
|
|
659
|
+
<span class="session-mcp-trailing" onClick={(event) => event.stopPropagation()}>
|
|
660
|
+
<Show
|
|
661
|
+
when={signIn()}
|
|
662
|
+
fallback={
|
|
663
|
+
<Switch
|
|
664
|
+
checked={enabled()}
|
|
665
|
+
readOnly={pending()}
|
|
666
|
+
aria-disabled={pending()}
|
|
667
|
+
aria-busy={busy()}
|
|
668
|
+
description={label()}
|
|
669
|
+
class="[&_[data-slot=switch-description]]:sr-only"
|
|
670
|
+
onChange={change}
|
|
671
|
+
>
|
|
672
|
+
<span class="sr-only">{server().name}</span>
|
|
673
|
+
</Switch>
|
|
674
|
+
}
|
|
675
|
+
>
|
|
676
|
+
<Button
|
|
677
|
+
size="small"
|
|
678
|
+
variant="ghost-muted"
|
|
679
|
+
class="session-mcp-sign-in"
|
|
680
|
+
disabled={pending()}
|
|
681
|
+
aria-busy={busy()}
|
|
682
|
+
aria-label={ctx.t("mcp.signIn.open", { name: server().name })}
|
|
683
|
+
onClick={follow}
|
|
684
|
+
>
|
|
685
|
+
{ctx.t(busy() ? "mcp.signingIn" : "mcp.signIn")}
|
|
686
|
+
</Button>
|
|
687
|
+
</Show>
|
|
688
|
+
</span>
|
|
689
|
+
</div>
|
|
690
|
+
)
|
|
691
|
+
}}
|
|
692
|
+
</Index>
|
|
693
|
+
</Show>
|
|
694
|
+
),
|
|
695
|
+
Footer: () => (
|
|
696
|
+
<Show when={servers().length} fallback={<ServiceEmptyFooter owner={props} service="mcp" />}>
|
|
697
|
+
<div class="session-service-footer">
|
|
698
|
+
<span class="session-service-config-separator" role="separator" />
|
|
699
|
+
<ServiceConfigLink owner={props} service="mcp" />
|
|
700
|
+
<button
|
|
701
|
+
type="button"
|
|
702
|
+
class="session-service-config"
|
|
703
|
+
onClick={() => {
|
|
704
|
+
close()
|
|
705
|
+
builtinContext(ctx).layout.command("mcp.toggle")
|
|
706
|
+
}}
|
|
707
|
+
>
|
|
708
|
+
<Icon name="mcp" class="shrink-0 text-v2-icon-icon-muted" />
|
|
709
|
+
<span class="min-w-0 truncate">{ctx.t("mcp.manage")}</span>
|
|
710
|
+
</button>
|
|
711
|
+
</div>
|
|
712
|
+
</Show>
|
|
713
|
+
),
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
type CatalogItem = {
|
|
718
|
+
readonly name: string
|
|
719
|
+
readonly status: string | undefined
|
|
720
|
+
readonly error: string | undefined
|
|
721
|
+
readonly path: string | undefined
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
function usePlugins(props: ServiceProps): ServiceSource {
|
|
725
|
+
const load = useServiceLoad(props, {
|
|
726
|
+
cached: () => undefined,
|
|
727
|
+
// Only the machine holds the list, so a new data store keeps it on show while it loads again.
|
|
728
|
+
retain: true,
|
|
729
|
+
task: async (signal) => {
|
|
730
|
+
const result = await props.session.server.client.plugin.list(
|
|
731
|
+
{ location: { directory: props.directory } },
|
|
732
|
+
{ signal },
|
|
733
|
+
)
|
|
734
|
+
|
|
735
|
+
return result.data
|
|
736
|
+
.filter((plugin) => plugin.source.type !== "builtin")
|
|
737
|
+
.map(
|
|
738
|
+
(plugin): CatalogItem => ({
|
|
739
|
+
name: pluginLabel(plugin),
|
|
740
|
+
status: plugin.state.status,
|
|
741
|
+
error: plugin.state.status === "failed" ? plugin.state.error : undefined,
|
|
742
|
+
path: undefined,
|
|
743
|
+
}),
|
|
744
|
+
)
|
|
745
|
+
},
|
|
746
|
+
})
|
|
747
|
+
|
|
748
|
+
return useCatalog(props, "plugins", load, () => load.view().value ?? [])
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
function useSkills(props: ServiceProps): ServiceSource {
|
|
752
|
+
const data = () => props.session.server.data
|
|
753
|
+
const list = () => data().location.skill.list({ directory: props.directory })
|
|
754
|
+
|
|
755
|
+
// The list lives in the server's data store; the machine tracks only whether it loaded.
|
|
756
|
+
const load = useServiceLoad(props, {
|
|
757
|
+
cached: () => (list() === undefined ? undefined : true),
|
|
758
|
+
retain: false,
|
|
759
|
+
task: async () => {
|
|
760
|
+
const current = data()
|
|
761
|
+
const directory = props.directory
|
|
762
|
+
|
|
763
|
+
current.location.skill.invalidate({ directory })
|
|
764
|
+
await current.location.skill.sync({ directory })
|
|
765
|
+
|
|
766
|
+
return true
|
|
767
|
+
},
|
|
768
|
+
})
|
|
769
|
+
|
|
770
|
+
return useCatalog(props, "skills", load, () =>
|
|
771
|
+
(list() ?? []).map(
|
|
772
|
+
(skill): CatalogItem => ({ name: skill.name, status: undefined, error: undefined, path: skill.path }),
|
|
773
|
+
),
|
|
774
|
+
)
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
function useCatalog(
|
|
778
|
+
props: ServiceProps,
|
|
779
|
+
service: "plugins" | "skills",
|
|
780
|
+
load: ServiceLoad<unknown>,
|
|
781
|
+
items: () => readonly CatalogItem[],
|
|
782
|
+
): ServiceSource {
|
|
783
|
+
const ctx = usePlugin()
|
|
784
|
+
const list = createMemo(() => items().toSorted((a, b) => a.name.localeCompare(b.name)))
|
|
785
|
+
|
|
786
|
+
createKeyed(
|
|
787
|
+
() => props.session.server.data,
|
|
788
|
+
(current) =>
|
|
789
|
+
onCleanup(
|
|
790
|
+
current.on(service === "plugins" ? "plugin.updated" : "skill.updated", (event) => {
|
|
791
|
+
if (event.location?.directory === props.directory) load.invalidate()
|
|
792
|
+
}),
|
|
793
|
+
),
|
|
794
|
+
)
|
|
795
|
+
|
|
796
|
+
return {
|
|
797
|
+
get view() {
|
|
798
|
+
return load.view()
|
|
799
|
+
},
|
|
800
|
+
refresh: load.refresh,
|
|
801
|
+
retry: load.retry,
|
|
802
|
+
get count() {
|
|
803
|
+
return list().length
|
|
804
|
+
},
|
|
805
|
+
get failed() {
|
|
806
|
+
return list().some((item) => item.status === "failed")
|
|
807
|
+
},
|
|
808
|
+
Body: () => (
|
|
809
|
+
<Show
|
|
810
|
+
when={list().length}
|
|
811
|
+
fallback={<ServiceEmpty title={ctx.t(service === "plugins" ? "plugins.empty" : "skills.empty")} />}
|
|
812
|
+
>
|
|
813
|
+
<For each={list()}>
|
|
814
|
+
{(item) => (
|
|
815
|
+
<Show
|
|
816
|
+
when={item.path}
|
|
817
|
+
fallback={
|
|
818
|
+
<div class="session-service-row" data-status={item.status}>
|
|
819
|
+
<Show when={item.status}>
|
|
820
|
+
{(status) => (
|
|
821
|
+
<>
|
|
822
|
+
<StatusDot status={status()} error={item.error} />
|
|
823
|
+
<Show when={status() === "failed"}>
|
|
824
|
+
<span class="sr-only">{ctx.t("failed")}</span>
|
|
825
|
+
</Show>
|
|
826
|
+
</>
|
|
827
|
+
)}
|
|
828
|
+
</Show>
|
|
829
|
+
<TruncatedText text={item.name} class="session-summary-label" />
|
|
830
|
+
</div>
|
|
831
|
+
}
|
|
832
|
+
>
|
|
833
|
+
{(path) => (
|
|
834
|
+
// A skill opens its SKILL.md in a side tab.
|
|
835
|
+
<button
|
|
836
|
+
type="button"
|
|
837
|
+
class="session-service-row session-service-file"
|
|
838
|
+
onClick={() => {
|
|
839
|
+
if (ctx.links.open({ href: path(), session: props.session })) props.onClose?.()
|
|
840
|
+
}}
|
|
841
|
+
>
|
|
842
|
+
<Icon name="file-document" class="shrink-0 text-v2-icon-icon-muted" />
|
|
843
|
+
<TruncatedText text={item.name} class="session-summary-label" />
|
|
844
|
+
</button>
|
|
845
|
+
)}
|
|
846
|
+
</Show>
|
|
847
|
+
)}
|
|
848
|
+
</For>
|
|
849
|
+
</Show>
|
|
850
|
+
),
|
|
851
|
+
Footer: () => (
|
|
852
|
+
<Show when={list().length} fallback={<ServiceEmptyFooter owner={props} service={service} />}>
|
|
853
|
+
<div class="session-service-footer">
|
|
854
|
+
<span class="session-service-config-separator" role="separator" />
|
|
855
|
+
<Show when={service === "skills"}>
|
|
856
|
+
<ServiceSetup owner={props} service={service} />
|
|
857
|
+
</Show>
|
|
858
|
+
<ServiceConfigLink owner={props} service={service} />
|
|
859
|
+
</div>
|
|
860
|
+
</Show>
|
|
861
|
+
),
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
// A status dot. A failed one shows its error on hover and, given an action, opens the full error.
|
|
866
|
+
function StatusDot(props: { status: string; error?: string; label?: string; onClick?: () => void }) {
|
|
867
|
+
return (
|
|
868
|
+
<Show
|
|
869
|
+
when={props.error}
|
|
870
|
+
fallback={<span class="session-service-dot" data-status={props.status} aria-hidden="true" />}
|
|
871
|
+
>
|
|
872
|
+
{(error) => (
|
|
873
|
+
<Tooltip
|
|
874
|
+
value={<span class="session-service-error">{error()}</span>}
|
|
875
|
+
placement="top"
|
|
876
|
+
openDelay={0}
|
|
877
|
+
class="session-service-dot-tip"
|
|
878
|
+
>
|
|
879
|
+
<Show
|
|
880
|
+
when={props.onClick}
|
|
881
|
+
fallback={<span class="session-service-dot" data-status={props.status} aria-hidden="true" />}
|
|
882
|
+
>
|
|
883
|
+
<button
|
|
884
|
+
type="button"
|
|
885
|
+
class="session-service-dot"
|
|
886
|
+
data-status={props.status}
|
|
887
|
+
aria-label={props.label}
|
|
888
|
+
onClick={(event) => {
|
|
889
|
+
event.stopPropagation()
|
|
890
|
+
props.onClick?.()
|
|
891
|
+
}}
|
|
892
|
+
/>
|
|
893
|
+
</Show>
|
|
894
|
+
</Tooltip>
|
|
895
|
+
)}
|
|
896
|
+
</Show>
|
|
897
|
+
)
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
function ServiceBody(props: { source: ServiceSource; children: JSX.Element }) {
|
|
901
|
+
const ctx = usePlugin()
|
|
902
|
+
|
|
903
|
+
return (
|
|
904
|
+
<Show
|
|
905
|
+
when={props.source.view.status !== "loading"}
|
|
906
|
+
fallback={
|
|
907
|
+
<div class="session-service-message" role="status">
|
|
908
|
+
{ctx.t("common.loading")}
|
|
909
|
+
</div>
|
|
910
|
+
}
|
|
911
|
+
>
|
|
912
|
+
<Show
|
|
913
|
+
when={props.source.view.status === "ready"}
|
|
914
|
+
fallback={
|
|
915
|
+
<div class="session-service-message" role="alert">
|
|
916
|
+
<p>{ctx.t("common.requestFailed")}</p>
|
|
917
|
+
<button type="button" class="session-summary-row" onClick={() => props.source.retry()}>
|
|
918
|
+
{ctx.t("retry")}
|
|
919
|
+
</button>
|
|
920
|
+
</div>
|
|
921
|
+
}
|
|
922
|
+
>
|
|
923
|
+
{props.children}
|
|
924
|
+
</Show>
|
|
925
|
+
</Show>
|
|
926
|
+
)
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
// Shown once the list is, as ServiceBody shows it.
|
|
930
|
+
function ServiceFooter(props: { source: ServiceSource }) {
|
|
931
|
+
return (
|
|
932
|
+
<Show when={props.source.view.status === "ready"}>
|
|
933
|
+
<props.source.Footer />
|
|
934
|
+
</Show>
|
|
935
|
+
)
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
function ServiceConfigLink(props: { owner: ServiceProps; service: Service }) {
|
|
939
|
+
const ctx = usePlugin()
|
|
940
|
+
const system = ctx.system
|
|
941
|
+
const local = () => props.owner.session.server.local
|
|
942
|
+
const label = () => ctx.t(local() ? "configure" : "copyConfigPath")
|
|
943
|
+
|
|
944
|
+
const action = useConfigAction(props.owner, async (signal) => {
|
|
945
|
+
const session = props.owner.session
|
|
946
|
+
|
|
947
|
+
const entries = await session.server.client.config.get(
|
|
948
|
+
{ location: { directory: props.owner.directory } },
|
|
949
|
+
{ signal },
|
|
950
|
+
)
|
|
951
|
+
|
|
952
|
+
const path = serviceConfigFile(entries, props.service)
|
|
953
|
+
|
|
954
|
+
if (!path) throw new Error(ctx.t("configFileMissing"))
|
|
955
|
+
signal.throwIfAborted()
|
|
956
|
+
|
|
957
|
+
// A local file opens in a side tab beside the session, inside the workspace or not.
|
|
958
|
+
if (local()) {
|
|
959
|
+
if (ctx.links.open({ href: path, session })) return { type: "opened", close: true }
|
|
960
|
+
await ctx.desktop?.reveal(path)
|
|
961
|
+
|
|
962
|
+
return { type: "opened", close: false }
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
await system.copy(path)
|
|
966
|
+
|
|
967
|
+
return { type: "copied" }
|
|
968
|
+
})
|
|
969
|
+
|
|
970
|
+
return (
|
|
971
|
+
<Tooltip
|
|
972
|
+
inactive={local()}
|
|
973
|
+
value={ctx.t(action.view().copied ? "ui.message.copied" : "ui.message.copy")}
|
|
974
|
+
placement="top"
|
|
975
|
+
getAnchorRect={(anchor) => anchor?.querySelector("svg")?.getBoundingClientRect()}
|
|
976
|
+
forceOpen={action.view().copied ? true : undefined}
|
|
977
|
+
class="w-full"
|
|
978
|
+
>
|
|
979
|
+
<button
|
|
980
|
+
type="button"
|
|
981
|
+
class="session-service-config"
|
|
982
|
+
disabled={action.view().disabled}
|
|
983
|
+
onMouseDown={(event) => {
|
|
984
|
+
if (!local()) event.preventDefault()
|
|
985
|
+
}}
|
|
986
|
+
onClick={action.activate}
|
|
987
|
+
>
|
|
988
|
+
<Icon
|
|
989
|
+
name={local() ? "settings-gear" : action.view().copied ? "check" : "copy"}
|
|
990
|
+
class="shrink-0 text-v2-icon-icon-muted"
|
|
991
|
+
/>
|
|
992
|
+
<span class="session-summary-label">{label()}</span>
|
|
993
|
+
</button>
|
|
994
|
+
</Tooltip>
|
|
995
|
+
)
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
// Starts a draft session in the global configuration's directory that asks OpenCode to set the service up.
|
|
999
|
+
function ServiceSetup(props: { owner: ServiceProps; service: Service }) {
|
|
1000
|
+
const ctx = usePlugin()
|
|
1001
|
+
|
|
1002
|
+
const action = useConfigAction(props.owner, async (signal) => {
|
|
1003
|
+
const session = props.owner.session
|
|
1004
|
+
|
|
1005
|
+
const entries = await session.server.client.config.get(
|
|
1006
|
+
{ location: { directory: props.owner.directory } },
|
|
1007
|
+
{ signal },
|
|
1008
|
+
)
|
|
1009
|
+
|
|
1010
|
+
signal.throwIfAborted()
|
|
1011
|
+
ctx.layout.draft({
|
|
1012
|
+
server: session.server.id,
|
|
1013
|
+
directory: globalConfigDirectory(entries, props.owner.directory),
|
|
1014
|
+
prompt: ctx.t(`setup.${props.service}.prompt`),
|
|
1015
|
+
})
|
|
1016
|
+
|
|
1017
|
+
return { type: "opened", close: true }
|
|
1018
|
+
})
|
|
1019
|
+
|
|
1020
|
+
return (
|
|
1021
|
+
<button type="button" class="session-service-config" disabled={action.view().disabled} onClick={action.activate}>
|
|
1022
|
+
<Icon name="plus" class="shrink-0 text-v2-icon-icon-muted" />
|
|
1023
|
+
<span class="session-summary-label">{ctx.t(`setup.${props.service}`)}</span>
|
|
1024
|
+
</button>
|
|
1025
|
+
)
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
type ServiceLoad<T> = {
|
|
1029
|
+
readonly view: Accessor<ServiceLoadView<T>>
|
|
1030
|
+
refresh: () => void
|
|
1031
|
+
retry: () => void
|
|
1032
|
+
/** The server announced a change to the list. */
|
|
1033
|
+
invalidate: () => void
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
// Loads a service's list through its machine while the popover or drawer shows it: one load at a time, bounded by a
|
|
1037
|
+
// timeout, and ended when the list hides, the server's data store changes, or the list unmounts.
|
|
1038
|
+
function useServiceLoad<T>(
|
|
1039
|
+
owner: ServiceProps,
|
|
1040
|
+
input: {
|
|
1041
|
+
/** The list the server's data store already holds, for a list that lives there. */
|
|
1042
|
+
cached: () => T | undefined
|
|
1043
|
+
/** Keeps the loaded list across a new data store, for a list that lives only in the machine. */
|
|
1044
|
+
retain: boolean
|
|
1045
|
+
task: (signal: AbortSignal) => Promise<T>
|
|
1046
|
+
},
|
|
1047
|
+
): ServiceLoad<T> {
|
|
1048
|
+
const ctx = usePlugin()
|
|
1049
|
+
const [loadState, setLoadState] = createSignal<ServiceLoadState<T>>(initialServiceLoadState())
|
|
1050
|
+
const runs = new Map<number, { controller: AbortController; timer: ReturnType<typeof setTimeout> }>()
|
|
1051
|
+
|
|
1052
|
+
const dispatch = (event: ServiceLoadEvent<T>) => {
|
|
1053
|
+
const previous = untrack(loadState)
|
|
1054
|
+
const next = transitionServiceLoad(previous, event)
|
|
1055
|
+
|
|
1056
|
+
if (next.state !== previous) setLoadState(() => next.state)
|
|
1057
|
+
next.effects.forEach(run)
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
const run = (effect: ServiceLoadEffect) => {
|
|
1061
|
+
if (effect.type === "run") {
|
|
1062
|
+
const attempt = effect.attempt
|
|
1063
|
+
const controller = new AbortController()
|
|
1064
|
+
|
|
1065
|
+
runs.set(attempt, {
|
|
1066
|
+
controller,
|
|
1067
|
+
timer: setTimeout(() => dispatch({ type: "load.timed-out", attempt }), effect.timeoutMs),
|
|
1068
|
+
})
|
|
1069
|
+
void Promise.try(() => input.task(AbortSignal.any([ctx.signal, controller.signal]))).then(
|
|
1070
|
+
(value) => dispatch({ type: "load.succeeded", attempt, value }),
|
|
1071
|
+
() => dispatch({ type: "load.failed", attempt }),
|
|
1072
|
+
)
|
|
1073
|
+
|
|
1074
|
+
return
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
const handle = runs.get(effect.attempt)
|
|
1078
|
+
runs.delete(effect.attempt)
|
|
1079
|
+
clearTimeout(handle?.timer)
|
|
1080
|
+
handle?.controller.abort()
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
// Follows whether the list shows, the server's data store, and whether that store already holds the list.
|
|
1084
|
+
createKeyed(
|
|
1085
|
+
() => ({ shown: owner.shown, source: owner.session.server.data, cached: input.cached() }),
|
|
1086
|
+
(current) =>
|
|
1087
|
+
dispatch({
|
|
1088
|
+
type: "context.changed",
|
|
1089
|
+
shown: current.shown,
|
|
1090
|
+
source: current.source,
|
|
1091
|
+
cached: current.cached,
|
|
1092
|
+
retain: input.retain,
|
|
1093
|
+
}),
|
|
1094
|
+
{
|
|
1095
|
+
equals: (previous, next) =>
|
|
1096
|
+
previous.shown === next.shown && previous.source === next.source && previous.cached === next.cached,
|
|
1097
|
+
},
|
|
1098
|
+
)
|
|
1099
|
+
onCleanup(() => dispatch({ type: "disposed" }))
|
|
1100
|
+
|
|
1101
|
+
return {
|
|
1102
|
+
view: createMemo(() => serviceLoadView(loadState())),
|
|
1103
|
+
refresh: () => dispatch({ type: "refresh.requested" }),
|
|
1104
|
+
retry: () => dispatch({ type: "retry.requested" }),
|
|
1105
|
+
invalidate: () => dispatch({ type: "invalidated" }),
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
type ConfigActionResult = { readonly type: "opened"; readonly close: boolean } | { readonly type: "copied" }
|
|
1110
|
+
|
|
1111
|
+
// Runs a footer action through its machine: one run at a time, bounded by a timeout, and ended with the popover.
|
|
1112
|
+
function useConfigAction(owner: ServiceProps, task: (signal: AbortSignal) => Promise<ConfigActionResult>) {
|
|
1113
|
+
const ctx = usePlugin()
|
|
1114
|
+
const [actionState, setActionState] = createSignal<ConfigActionState>(initialConfigActionState)
|
|
1115
|
+
const runs = new Map<number, { controller: AbortController; timer: ReturnType<typeof setTimeout> }>()
|
|
1116
|
+
let reset: ReturnType<typeof setTimeout> | undefined
|
|
1117
|
+
|
|
1118
|
+
const dispatch = (event: ConfigActionEvent) => {
|
|
1119
|
+
const previous = untrack(actionState)
|
|
1120
|
+
const next = transitionConfigAction(previous, event)
|
|
1121
|
+
|
|
1122
|
+
if (next.state !== previous) setActionState(next.state)
|
|
1123
|
+
next.effects.forEach(run)
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
const run = (effect: ConfigActionEffect) => {
|
|
1127
|
+
if (effect.type === "run") {
|
|
1128
|
+
const attempt = effect.attempt
|
|
1129
|
+
const controller = new AbortController()
|
|
1130
|
+
|
|
1131
|
+
runs.set(attempt, {
|
|
1132
|
+
controller,
|
|
1133
|
+
timer: setTimeout(() => dispatch({ type: "timed-out", attempt }), effect.timeoutMs),
|
|
1134
|
+
})
|
|
1135
|
+
void task(AbortSignal.any([ctx.signal, controller.signal])).then(
|
|
1136
|
+
(result) => dispatch({ ...result, attempt }),
|
|
1137
|
+
(error) => dispatch({ type: "failed", attempt, error: error instanceof Error ? error.message : String(error) }),
|
|
1138
|
+
)
|
|
1139
|
+
|
|
1140
|
+
return
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
if (effect.type === "abort") {
|
|
1144
|
+
const handle = runs.get(effect.attempt)
|
|
1145
|
+
runs.delete(effect.attempt)
|
|
1146
|
+
clearTimeout(handle?.timer)
|
|
1147
|
+
handle?.controller.abort()
|
|
1148
|
+
|
|
1149
|
+
return
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
if (effect.type === "schedule-reset") {
|
|
1153
|
+
const attempt = effect.attempt
|
|
1154
|
+
clearTimeout(reset)
|
|
1155
|
+
reset = setTimeout(() => dispatch({ type: "copied.expired", attempt }), effect.delayMs)
|
|
1156
|
+
|
|
1157
|
+
return
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
if (effect.type === "cancel-reset") return clearTimeout(reset)
|
|
1161
|
+
|
|
1162
|
+
if (effect.type === "close-owner") return owner.onClose?.()
|
|
1163
|
+
|
|
1164
|
+
showToast({
|
|
1165
|
+
variant: "error",
|
|
1166
|
+
title: ctx.t("common.requestFailed"),
|
|
1167
|
+
description: effect.type === "toast-failed" ? effect.error : ctx.t("timedOut"),
|
|
1168
|
+
})
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
// Hiding the popover or drawer drops the copied mark, so its tooltip does not stay open over nothing.
|
|
1172
|
+
createKeyed(
|
|
1173
|
+
() => owner.shown,
|
|
1174
|
+
() => undefined,
|
|
1175
|
+
{ otherwise: () => dispatch({ type: "hidden" }) },
|
|
1176
|
+
)
|
|
1177
|
+
onCleanup(() => dispatch({ type: "disposed" }))
|
|
1178
|
+
|
|
1179
|
+
return { view: () => configActionView(actionState()), activate: () => dispatch({ type: "activate" }) }
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
function ServiceEmpty(props: { title: string }) {
|
|
1183
|
+
return (
|
|
1184
|
+
<div class="session-service-empty">
|
|
1185
|
+
<strong>{props.title}</strong>
|
|
1186
|
+
</div>
|
|
1187
|
+
)
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
function ServiceEmptyFooter(props: { owner: ServiceProps; service: Service }) {
|
|
1191
|
+
return (
|
|
1192
|
+
<div class="session-service-footer">
|
|
1193
|
+
<span class="session-service-config-separator" role="separator" />
|
|
1194
|
+
<ServiceSetup owner={props.owner} service={props.service} />
|
|
1195
|
+
<ServiceConfigLink owner={props.owner} service={props.service} />
|
|
1196
|
+
</div>
|
|
1197
|
+
)
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
function pluginLabel(plugin: PluginInfo) {
|
|
1201
|
+
if (plugin.id) return plugin.id
|
|
1202
|
+
|
|
1203
|
+
if (plugin.source.type === "package") return plugin.source.target
|
|
1204
|
+
|
|
1205
|
+
if (plugin.source.type === "local") return plugin.source.path
|
|
1206
|
+
|
|
1207
|
+
return plugin.source.type
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
function focusables(root: HTMLElement) {
|
|
1211
|
+
return [
|
|
1212
|
+
...root.querySelectorAll<HTMLElement>(
|
|
1213
|
+
"button:not(:disabled), input:not(:disabled), a[href], [tabindex]:not([tabindex='-1'])",
|
|
1214
|
+
),
|
|
1215
|
+
]
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
type Point = { x: number; y: number }
|
|
1219
|
+
|
|
1220
|
+
function insideTriangle(point: Point, a: Point, b: Point, c: Point) {
|
|
1221
|
+
const side = (p: Point, q: Point) => (q.x - p.x) * (point.y - p.y) - (q.y - p.y) * (point.x - p.x)
|
|
1222
|
+
const sides = [side(a, b), side(b, c), side(c, a)]
|
|
1223
|
+
|
|
1224
|
+
return sides.every((value) => value >= 0) || sides.every((value) => value <= 0)
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
type McpController = {
|
|
1228
|
+
readonly state: () => McpState
|
|
1229
|
+
dispatch: (event: McpEvent) => void
|
|
1230
|
+
/** Reports that an error dialog closed, by the user or by the controller. */
|
|
1231
|
+
dismiss: (attempt: number) => void
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
/**
|
|
1235
|
+
* The plugin instance's MCP controllers, by server and directory, so a popover or drawer that mounts again finds the
|
|
1236
|
+
* toggles and the error dialog the previous one left running.
|
|
1237
|
+
*/
|
|
1238
|
+
export type McpControllers = Map<string, McpController>
|
|
1239
|
+
|
|
1240
|
+
// The controller for the server and directory, shared with every other mount and the error dialog, for as long as
|
|
1241
|
+
// this mount lives.
|
|
1242
|
+
function useMcpController(controllers: McpControllers, server: ServerRef, directory: string) {
|
|
1243
|
+
const key = JSON.stringify([server.id, directory])
|
|
1244
|
+
const current = controllers.get(key)
|
|
1245
|
+
|
|
1246
|
+
const mcp =
|
|
1247
|
+
current && untrack(current.state).status !== "disposed"
|
|
1248
|
+
? current
|
|
1249
|
+
: createMcpController(server, directory, () => {
|
|
1250
|
+
if (controllers.get(key) === mcp) controllers.delete(key)
|
|
1251
|
+
})
|
|
1252
|
+
|
|
1253
|
+
controllers.set(key, mcp)
|
|
1254
|
+
mcp.dispatch({ type: "mounted" })
|
|
1255
|
+
onCleanup(() => mcp.dispatch({ type: "unmounted" }))
|
|
1256
|
+
|
|
1257
|
+
return mcp
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
// Connects, disconnects, or starts sign-in for one server's MCPs in one directory, like the app's MCP toggle, and shows
|
|
1261
|
+
// their errors. It ends once no popover lists it, no toggle runs and no error dialog shows, or with the plugin.
|
|
1262
|
+
function createMcpController(server: ServerRef, directory: string, release: () => void): McpController {
|
|
1263
|
+
const ctx = usePlugin()
|
|
1264
|
+
const [mcpState, setMcpState] = createSignal<McpState>(initialMcpState)
|
|
1265
|
+
const runs = new Map<number, { controller: AbortController; timer: ReturnType<typeof setTimeout> }>()
|
|
1266
|
+
const dialogs = new Map<number, { close: () => void }>()
|
|
1267
|
+
const dispose = () => dispatch({ type: "disposed" })
|
|
1268
|
+
|
|
1269
|
+
const dispatch = (event: McpEvent) => {
|
|
1270
|
+
const previous = untrack(mcpState)
|
|
1271
|
+
const next = transitionMcp(previous, event)
|
|
1272
|
+
|
|
1273
|
+
if (next.state !== previous) setMcpState(next.state)
|
|
1274
|
+
|
|
1275
|
+
if (next.state.status === "disposed" && previous.status !== "disposed") {
|
|
1276
|
+
ctx.signal.removeEventListener("abort", dispose)
|
|
1277
|
+
release()
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
next.effects.forEach(run)
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
const mcp: McpController = {
|
|
1284
|
+
state: mcpState,
|
|
1285
|
+
dispatch,
|
|
1286
|
+
dismiss: (attempt) => {
|
|
1287
|
+
dialogs.delete(attempt)
|
|
1288
|
+
dispatch({ type: "error.dismissed", attempt })
|
|
1289
|
+
},
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
const run = (effect: McpEffect) => {
|
|
1293
|
+
if (effect.type === "run-toggle") {
|
|
1294
|
+
const name = effect.name
|
|
1295
|
+
const attempt = effect.attempt
|
|
1296
|
+
const controller = new AbortController()
|
|
1297
|
+
|
|
1298
|
+
runs.set(attempt, {
|
|
1299
|
+
controller,
|
|
1300
|
+
timer: setTimeout(() => dispatch({ type: "toggle.timed-out", name, attempt }), effect.timeoutMs),
|
|
1301
|
+
})
|
|
1302
|
+
void toggle(effect, controller.signal).then(dispatch, (error) =>
|
|
1303
|
+
dispatch({
|
|
1304
|
+
type: "toggle.failed",
|
|
1305
|
+
name,
|
|
1306
|
+
attempt,
|
|
1307
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1308
|
+
server: false,
|
|
1309
|
+
}),
|
|
1310
|
+
)
|
|
1311
|
+
|
|
1312
|
+
return
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
if (effect.type === "abort-toggle") {
|
|
1316
|
+
const handle = runs.get(effect.attempt)
|
|
1317
|
+
runs.delete(effect.attempt)
|
|
1318
|
+
clearTimeout(handle?.timer)
|
|
1319
|
+
handle?.controller.abort()
|
|
1320
|
+
|
|
1321
|
+
return
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
if (effect.type === "open-external") return ctx.system.openExternal(effect.url)
|
|
1325
|
+
|
|
1326
|
+
if (effect.type === "open-sign-in") {
|
|
1327
|
+
const signIn = effect.signIn
|
|
1328
|
+
const ref = { directory }
|
|
1329
|
+
|
|
1330
|
+
ctx.dialogs.open((dialog) => (
|
|
1331
|
+
<McpSignInDialog
|
|
1332
|
+
server={server}
|
|
1333
|
+
name={effect.name}
|
|
1334
|
+
integrationID={signIn.integrationID}
|
|
1335
|
+
attemptID={signIn.attemptID}
|
|
1336
|
+
url={signIn.url}
|
|
1337
|
+
lifetime={signIn.lifetime}
|
|
1338
|
+
directory={directory}
|
|
1339
|
+
onSync={async () => {
|
|
1340
|
+
const latest = server.data
|
|
1341
|
+
latest.location.mcp.server.invalidate(ref)
|
|
1342
|
+
latest.location.mcp.resource.invalidate(ref)
|
|
1343
|
+
await Promise.all([latest.location.mcp.server.sync(ref), latest.location.mcp.resource.sync(ref)])
|
|
1344
|
+
}}
|
|
1345
|
+
onClose={() => dialog.close()}
|
|
1346
|
+
/>
|
|
1347
|
+
))
|
|
1348
|
+
|
|
1349
|
+
return
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
if (effect.type === "open-dialog") {
|
|
1353
|
+
dialogs.set(
|
|
1354
|
+
effect.attempt,
|
|
1355
|
+
ctx.dialogs.open(() => (
|
|
1356
|
+
<McpErrorDialog mcp={mcp} attempt={effect.attempt} name={effect.name} server={server} directory={directory} />
|
|
1357
|
+
)),
|
|
1358
|
+
)
|
|
1359
|
+
|
|
1360
|
+
return
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
if (effect.type === "close-dialog") {
|
|
1364
|
+
const handle = dialogs.get(effect.attempt)
|
|
1365
|
+
dialogs.delete(effect.attempt)
|
|
1366
|
+
handle?.close()
|
|
1367
|
+
|
|
1368
|
+
return
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
showToast({
|
|
1372
|
+
variant: "error",
|
|
1373
|
+
title: ctx.t("common.requestFailed"),
|
|
1374
|
+
description: effect.type === "toast-failed" ? effect.message : ctx.t("mcp.timedOut", { name: effect.name }),
|
|
1375
|
+
})
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
const toggle = async (effect: Extract<McpEffect, { type: "run-toggle" }>, signal: AbortSignal): Promise<McpEvent> => {
|
|
1379
|
+
const client = server.client
|
|
1380
|
+
const source = server.data
|
|
1381
|
+
const ref = { directory }
|
|
1382
|
+
const name = effect.name
|
|
1383
|
+
const attempt = effect.attempt
|
|
1384
|
+
const found = (await client.mcp.list({ location: ref }, { signal })).data.find((item) => item.name === name)
|
|
1385
|
+
|
|
1386
|
+
if (!found) return { type: "toggle.succeeded", name, attempt }
|
|
1387
|
+
|
|
1388
|
+
if (!effect.enabled) await client.experimental.mcp.disconnect({ server: name, location: ref }, { signal })
|
|
1389
|
+
|
|
1390
|
+
if (effect.enabled && found.status.status !== "needs_auth")
|
|
1391
|
+
await client.experimental.mcp.connect({ server: name, location: ref }, { signal })
|
|
1392
|
+
|
|
1393
|
+
source.location.mcp.server.invalidate(ref)
|
|
1394
|
+
await source.location.mcp.server.sync(ref)
|
|
1395
|
+
const current = source.location.mcp.server.list(ref)?.find((item) => item.name === name)
|
|
1396
|
+
const integrationID = current?.integrationID
|
|
1397
|
+
|
|
1398
|
+
if (effect.enabled && current?.status.status === "needs_auth" && integrationID) {
|
|
1399
|
+
const integration = await client.integration.get({ integrationID, location: ref }, { signal })
|
|
1400
|
+
const method = integration.data?.methods.find((item) => item.type === "oauth" && !item.form?.length)
|
|
1401
|
+
|
|
1402
|
+
if (!method || method.type !== "oauth") throw new Error(ctx.t("mcp.interactiveAuth", { name }))
|
|
1403
|
+
|
|
1404
|
+
const started = await client.integration.oauth.connect(
|
|
1405
|
+
{ integrationID, methodID: method.id, location: ref },
|
|
1406
|
+
{ signal },
|
|
1407
|
+
)
|
|
1408
|
+
|
|
1409
|
+
dispatch({
|
|
1410
|
+
type: "toggle.authorizing",
|
|
1411
|
+
name,
|
|
1412
|
+
attempt,
|
|
1413
|
+
url: started.data.url,
|
|
1414
|
+
signIn: started.data.paste
|
|
1415
|
+
? {
|
|
1416
|
+
integrationID,
|
|
1417
|
+
attemptID: started.data.attemptID,
|
|
1418
|
+
url: started.data.url,
|
|
1419
|
+
lifetime: started.data.time.expires - started.data.time.created,
|
|
1420
|
+
}
|
|
1421
|
+
: undefined,
|
|
1422
|
+
})
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
source.location.mcp.resource.invalidate(ref)
|
|
1426
|
+
await source.location.mcp.resource.sync(ref)
|
|
1427
|
+
// A successful HTTP response can still leave the MCP connection in a failed state.
|
|
1428
|
+
const status = current?.status
|
|
1429
|
+
|
|
1430
|
+
if (status?.status === "failed") return { type: "toggle.failed", name, attempt, error: status.error, server: true }
|
|
1431
|
+
|
|
1432
|
+
return { type: "toggle.succeeded", name, attempt }
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
// The plugin's end ends the toggles and dialogs that outlived the popover.
|
|
1436
|
+
ctx.signal.addEventListener("abort", dispose, { once: true })
|
|
1437
|
+
|
|
1438
|
+
return mcp
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
// The MCPs dialog's error view, for a server the popover lists. Its controller outlives the popover that opened it.
|
|
1442
|
+
function McpErrorDialog(props: {
|
|
1443
|
+
mcp: McpController
|
|
1444
|
+
attempt: number
|
|
1445
|
+
name: string
|
|
1446
|
+
server: ServerRef
|
|
1447
|
+
directory: string
|
|
1448
|
+
}) {
|
|
1449
|
+
const ctx = usePlugin()
|
|
1450
|
+
const list = () => props.server.data.location.mcp.server.list({ directory: props.directory })
|
|
1451
|
+
const status = () => list()?.find((item) => item.name === props.name)?.status
|
|
1452
|
+
const view = createMemo(() => mcpDialogView(props.mcp.state(), props.attempt, status()?.status))
|
|
1453
|
+
|
|
1454
|
+
// Follows the server's status, which changes here and anywhere else: a reconnect or a removal closes the dialog, and
|
|
1455
|
+
// a new failure replaces its error.
|
|
1456
|
+
createKeyed(
|
|
1457
|
+
() => ({ loaded: list() !== undefined, status: status() }),
|
|
1458
|
+
(synced) =>
|
|
1459
|
+
props.mcp.dispatch({
|
|
1460
|
+
type: "server.synced",
|
|
1461
|
+
attempt: props.attempt,
|
|
1462
|
+
loaded: synced.loaded,
|
|
1463
|
+
status: synced.status,
|
|
1464
|
+
}),
|
|
1465
|
+
{
|
|
1466
|
+
equals: (previous, next) =>
|
|
1467
|
+
previous.loaded === next.loaded &&
|
|
1468
|
+
previous.status?.status === next.status?.status &&
|
|
1469
|
+
statusError(previous.status) === statusError(next.status),
|
|
1470
|
+
},
|
|
1471
|
+
)
|
|
1472
|
+
onCleanup(() => props.mcp.dismiss(props.attempt))
|
|
1473
|
+
|
|
1474
|
+
const toggle = (enabled: boolean) =>
|
|
1475
|
+
props.mcp.dispatch({ type: "toggle.requested", name: props.name, enabled, status: status()?.status })
|
|
1476
|
+
|
|
1477
|
+
const copy = (name: string, error: string) =>
|
|
1478
|
+
void ctx.system.copy(ctx.t("mcp.error.details", { name, error })).then(
|
|
1479
|
+
() => props.mcp.dispatch({ type: "error.copied", attempt: props.attempt, error }),
|
|
1480
|
+
(cause) =>
|
|
1481
|
+
showToast({
|
|
1482
|
+
variant: "error",
|
|
1483
|
+
title: ctx.t("mcp.error.copyFailed"),
|
|
1484
|
+
description: cause instanceof Error ? cause.message : String(cause),
|
|
1485
|
+
}),
|
|
1486
|
+
)
|
|
1487
|
+
|
|
1488
|
+
return (
|
|
1489
|
+
<Show when={view()}>
|
|
1490
|
+
{(current) => (
|
|
1491
|
+
<Dialog class="session-mcp-error">
|
|
1492
|
+
<DialogHeader>
|
|
1493
|
+
<DialogTitleGroup
|
|
1494
|
+
title={
|
|
1495
|
+
<span dir="auto" class="[overflow-wrap:anywhere]">
|
|
1496
|
+
{current().name}
|
|
1497
|
+
</span>
|
|
1498
|
+
}
|
|
1499
|
+
description={ctx.t("mcp.error.status")}
|
|
1500
|
+
/>
|
|
1501
|
+
</DialogHeader>
|
|
1502
|
+
<DialogBody class="session-mcp-error-body">
|
|
1503
|
+
<ErrorDetails error={current().error}>
|
|
1504
|
+
<Button
|
|
1505
|
+
class="error-details-copy"
|
|
1506
|
+
variant="ghost-muted"
|
|
1507
|
+
icon={current().copied ? "check" : "copy"}
|
|
1508
|
+
onClick={() => copy(current().name, current().error)}
|
|
1509
|
+
>
|
|
1510
|
+
{ctx.t(current().copied ? "common.copied" : "mcp.error.copy")}
|
|
1511
|
+
</Button>
|
|
1512
|
+
<Button variant="ghost" disabled={current().busy} onClick={() => toggle(false)}>
|
|
1513
|
+
{ctx.t("mcp.error.disable")}
|
|
1514
|
+
</Button>
|
|
1515
|
+
<Button variant="neutral" disabled={current().busy} onClick={() => toggle(true)}>
|
|
1516
|
+
{ctx.t("common.retry")}
|
|
1517
|
+
</Button>
|
|
1518
|
+
</ErrorDetails>
|
|
1519
|
+
</DialogBody>
|
|
1520
|
+
</Dialog>
|
|
1521
|
+
)}
|
|
1522
|
+
</Show>
|
|
1523
|
+
)
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
function statusError(status: McpServerStatus | undefined) {
|
|
1527
|
+
return status?.status === "failed" || status?.status === "needs_auth" ? status.error : undefined
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
// Waits for an MCP sign-in that also accepts the redirect URL pasted from the browser, for when the browser cannot
|
|
1531
|
+
// reach the machine running the server (SSH, a remote desktop connection, a container). Like the app's MCPs dialog.
|
|
1532
|
+
function McpSignInDialog(props: {
|
|
1533
|
+
server: ServerRef
|
|
1534
|
+
name: string
|
|
1535
|
+
integrationID: string
|
|
1536
|
+
attemptID: string
|
|
1537
|
+
url: string
|
|
1538
|
+
/** The attempt's lifetime in milliseconds, from the server's `time`; the two clocks may disagree. */
|
|
1539
|
+
lifetime: number
|
|
1540
|
+
directory: string
|
|
1541
|
+
/** Reloads the MCP server and resource lists once the sign-in succeeded. */
|
|
1542
|
+
onSync: () => Promise<void>
|
|
1543
|
+
onClose: () => void
|
|
1544
|
+
}) {
|
|
1545
|
+
const ctx = usePlugin()
|
|
1546
|
+
|
|
1547
|
+
const attempt = () => ({
|
|
1548
|
+
integrationID: props.integrationID,
|
|
1549
|
+
attemptID: props.attemptID,
|
|
1550
|
+
location: { directory: props.directory },
|
|
1551
|
+
})
|
|
1552
|
+
|
|
1553
|
+
// Reads the server's client on every call, so a restarted server's new client answers.
|
|
1554
|
+
const signIn = createMcpSignIn({
|
|
1555
|
+
url: props.url,
|
|
1556
|
+
lifetime: props.lifetime,
|
|
1557
|
+
status: (signal) =>
|
|
1558
|
+
props.server.client.integration.oauth.status(attempt(), { signal }).then((response) => response.data),
|
|
1559
|
+
complete: (code, signal) => props.server.client.integration.oauth.complete({ ...attempt(), code }, { signal }),
|
|
1560
|
+
cancel: () => props.server.client.integration.oauth.cancel(attempt()),
|
|
1561
|
+
sync: props.onSync,
|
|
1562
|
+
openExternal: (url) => ctx.system.openExternal(url),
|
|
1563
|
+
close: props.onClose,
|
|
1564
|
+
message: (error) => error.message,
|
|
1565
|
+
})
|
|
1566
|
+
|
|
1567
|
+
const view = signIn.view
|
|
1568
|
+
const dispatch = signIn.dispatch
|
|
1569
|
+
|
|
1570
|
+
const failure = (value: McpSignInFailure) => {
|
|
1571
|
+
if (value.type === "auth-expired") return ctx.t("mcp.signIn.failed", { error: ctx.t("mcp.signIn.expired") })
|
|
1572
|
+
|
|
1573
|
+
if (value.type === "auth-failed") return ctx.t("mcp.signIn.failed", { error: value.message })
|
|
1574
|
+
|
|
1575
|
+
if (value.type === "sync-failed") return ctx.t("mcp.signIn.syncFailed", { name: props.name, error: value.message })
|
|
1576
|
+
|
|
1577
|
+
return ctx.t("mcp.timedOut", { name: props.name })
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
return (
|
|
1581
|
+
<Dialog>
|
|
1582
|
+
<DialogHeader>
|
|
1583
|
+
<DialogTitleGroup title={ctx.t("mcp.signIn.open", { name: props.name })} />
|
|
1584
|
+
</DialogHeader>
|
|
1585
|
+
<DialogBody>
|
|
1586
|
+
<div class="flex flex-col gap-5 px-3 pb-3 text-[13px] font-[440] leading-5 tracking-[-0.04px] text-v2-text-text-muted">
|
|
1587
|
+
<div>{ctx.t("mcp.signIn.description", { name: props.name })}</div>
|
|
1588
|
+
<Show
|
|
1589
|
+
when={view().failure}
|
|
1590
|
+
fallback={
|
|
1591
|
+
<div class="flex items-center gap-2">
|
|
1592
|
+
<Loader class="size-4 shrink-0 text-v2-icon-icon-muted" />
|
|
1593
|
+
<span>{ctx.t("mcp.signIn.waiting")}</span>
|
|
1594
|
+
</div>
|
|
1595
|
+
}
|
|
1596
|
+
>
|
|
1597
|
+
{(current) => (
|
|
1598
|
+
<div role="alert" class="text-v2-state-fg-danger">
|
|
1599
|
+
{failure(current())}
|
|
1600
|
+
</div>
|
|
1601
|
+
)}
|
|
1602
|
+
</Show>
|
|
1603
|
+
<Show when={view().showOpenBrowser || view().canRetry}>
|
|
1604
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
1605
|
+
<Show when={view().showOpenBrowser}>
|
|
1606
|
+
<Button variant="neutral" icon="arrow-up-right" onClick={() => dispatch({ type: "browser.open" })}>
|
|
1607
|
+
{ctx.t("mcp.signIn.openBrowser")}
|
|
1608
|
+
</Button>
|
|
1609
|
+
</Show>
|
|
1610
|
+
<Show when={view().canRetry}>
|
|
1611
|
+
<Button variant="neutral" onClick={() => dispatch({ type: "retry.requested" })}>
|
|
1612
|
+
{ctx.t("common.retry")}
|
|
1613
|
+
</Button>
|
|
1614
|
+
</Show>
|
|
1615
|
+
</div>
|
|
1616
|
+
</Show>
|
|
1617
|
+
<Show when={view().showForm}>
|
|
1618
|
+
<RedirectPasteForm
|
|
1619
|
+
value={view().value}
|
|
1620
|
+
error={view().entryError}
|
|
1621
|
+
locked={view().locked}
|
|
1622
|
+
submitting={view().submitting}
|
|
1623
|
+
autofocus
|
|
1624
|
+
onInput={(value) => dispatch({ type: "paste.changed", value })}
|
|
1625
|
+
onSubmit={() => dispatch({ type: "paste.submitted" })}
|
|
1626
|
+
/>
|
|
1627
|
+
</Show>
|
|
1628
|
+
</div>
|
|
1629
|
+
</DialogBody>
|
|
1630
|
+
</Dialog>
|
|
1631
|
+
)
|
|
1632
|
+
}
|