@jingyi0605/codingns4dsh 0.2.1-beta.11 → 0.2.1-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +7 -5
- package/README.md +9 -5
- package/data/build/dist/bootstrap/dsh-connection-adapter.d.ts +1 -1
- package/data/build/dist/bootstrap/index.d.ts +1 -1
- package/data/build/dist/client/account-bar.d.ts.map +1 -1
- package/data/build/dist/client/account-bar.js +24 -70
- package/data/build/dist/client/account-bar.js.map +1 -1
- package/data/build/dist/client/adapter-catalog-watch.d.ts +1 -1
- package/data/build/dist/client/adapter-catalog-watch.d.ts.map +1 -1
- package/data/build/dist/client/adapter-catalog-watch.js +2 -2
- package/data/build/dist/client/adapter-catalog-watch.js.map +1 -1
- package/data/build/dist/client/bundle.js +35978 -21117
- package/data/build/dist/client/bundle.js.map +1 -1
- package/data/build/dist/client/cli-management-dialog.d.ts +21 -0
- package/data/build/dist/client/cli-management-dialog.d.ts.map +1 -0
- package/data/build/dist/client/cli-management-dialog.js +215 -0
- package/data/build/dist/client/cli-management-dialog.js.map +1 -0
- package/data/build/dist/client/cli-management-terminal.d.ts +9 -0
- package/data/build/dist/client/cli-management-terminal.d.ts.map +1 -0
- package/data/build/dist/client/cli-management-terminal.js +30 -0
- package/data/build/dist/client/cli-management-terminal.js.map +1 -0
- package/data/build/dist/client/cli-settings-dialog.d.ts +9 -0
- package/data/build/dist/client/cli-settings-dialog.d.ts.map +1 -0
- package/data/build/dist/client/cli-settings-dialog.js +45 -0
- package/data/build/dist/client/cli-settings-dialog.js.map +1 -0
- package/data/build/dist/client/cli-settings-rpc.js +1 -1
- package/data/build/dist/client/cli-settings-rpc.js.map +1 -1
- package/data/build/dist/client/cli-slots.d.ts +7 -2
- package/data/build/dist/client/cli-slots.d.ts.map +1 -1
- package/data/build/dist/client/cli-slots.js +44 -12
- package/data/build/dist/client/cli-slots.js.map +1 -1
- package/data/build/dist/client/client.assistant-configuration-view.js +5 -5
- package/data/build/dist/client/client.assistant-configuration-view.js.map +1 -1
- package/data/build/dist/client/client.editor-engine.js +4 -1
- package/data/build/dist/client/client.editor-engine.js.map +1 -1
- package/data/build/dist/client/client.moss-voice-output.js +0 -166
- package/data/build/dist/client/client.moss-voice-output.js.map +1 -1
- package/data/build/dist/client/client.native-workspace-store.js +4 -4
- package/data/build/dist/client/client.native-workspace-store.js.map +1 -1
- package/data/build/dist/client/client.primitives-adapter.js +53 -0
- package/data/build/dist/client/client.primitives-adapter.js.map +1 -1
- package/data/build/dist/client/client.react-dom.js +166 -0
- package/data/build/dist/client/client.react-dom.js.map +1 -1
- package/data/build/dist/client/client.session-translation.js +25 -1
- package/data/build/dist/client/client.session-translation.js.map +1 -1
- package/data/build/dist/client/client.transport.js +503 -42
- package/data/build/dist/client/client.transport.js.map +1 -1
- package/data/build/dist/client/conversation-translation-settings.d.ts +11 -0
- package/data/build/dist/client/conversation-translation-settings.d.ts.map +1 -0
- package/data/build/dist/client/conversation-translation-settings.js +54 -0
- package/data/build/dist/client/conversation-translation-settings.js.map +1 -0
- package/data/build/dist/client/desktop-assistant.js +967 -479
- package/data/build/dist/client/editor-engine.d.ts +1 -1
- package/data/build/dist/client/editor-engine.d.ts.map +1 -1
- package/data/build/dist/client/editor-engine.js +4 -1
- package/data/build/dist/client/editor-engine.js.map +1 -1
- package/data/build/dist/client/features/cli-adapters.d.ts +3 -1
- package/data/build/dist/client/features/cli-adapters.d.ts.map +1 -1
- package/data/build/dist/client/features/cli-adapters.js +182 -106
- package/data/build/dist/client/features/cli-adapters.js.map +1 -1
- package/data/build/dist/client/features/file-management.d.ts.map +1 -1
- package/data/build/dist/client/features/file-management.js +2 -0
- package/data/build/dist/client/features/file-management.js.map +1 -1
- package/data/build/dist/client/features/index.d.ts.map +1 -1
- package/data/build/dist/client/features/index.js +2 -0
- package/data/build/dist/client/features/index.js.map +1 -1
- package/data/build/dist/client/features/peer-host.d.ts.map +1 -1
- package/data/build/dist/client/features/peer-host.js +3 -0
- package/data/build/dist/client/features/peer-host.js.map +1 -1
- package/data/build/dist/client/features/quick-apps.d.ts +3 -0
- package/data/build/dist/client/features/quick-apps.d.ts.map +1 -0
- package/data/build/dist/client/features/quick-apps.js +14 -0
- package/data/build/dist/client/features/quick-apps.js.map +1 -0
- package/data/build/dist/client/features/session-translation.d.ts.map +1 -1
- package/data/build/dist/client/features/session-translation.js +7 -1
- package/data/build/dist/client/features/session-translation.js.map +1 -1
- package/data/build/dist/client/html-workspace-files.d.ts +4 -0
- package/data/build/dist/client/html-workspace-files.d.ts.map +1 -0
- package/data/build/dist/client/html-workspace-files.js +114 -0
- package/data/build/dist/client/html-workspace-files.js.map +1 -0
- package/data/build/dist/client/locale.d.ts.map +1 -1
- package/data/build/dist/client/locale.js +6 -0
- package/data/build/dist/client/locale.js.map +1 -1
- package/data/build/dist/client/locales/cliManagement.d.ts +3 -0
- package/data/build/dist/client/locales/cliManagement.d.ts.map +1 -0
- package/data/build/dist/client/locales/cliManagement.js +139 -0
- package/data/build/dist/client/locales/cliManagement.js.map +1 -0
- package/data/build/dist/client/locales/fileWorkspace.d.ts.map +1 -1
- package/data/build/dist/client/locales/fileWorkspace.js +4 -0
- package/data/build/dist/client/locales/fileWorkspace.js.map +1 -1
- package/data/build/dist/client/locales/panels.d.ts.map +1 -1
- package/data/build/dist/client/locales/panels.js +46 -0
- package/data/build/dist/client/locales/panels.js.map +1 -1
- package/data/build/dist/client/locales/quickApps.d.ts +130 -0
- package/data/build/dist/client/locales/quickApps.d.ts.map +1 -0
- package/data/build/dist/client/locales/quickApps.js +150 -0
- package/data/build/dist/client/locales/quickApps.js.map +1 -0
- package/data/build/dist/client/native-model-translation-menu.d.ts.map +1 -1
- package/data/build/dist/client/native-model-translation-menu.js +3 -1
- package/data/build/dist/client/native-model-translation-menu.js.map +1 -1
- package/data/build/dist/client/quick-apps/client.d.ts +29 -0
- package/data/build/dist/client/quick-apps/client.d.ts.map +1 -0
- package/data/build/dist/client/quick-apps/client.js +68 -0
- package/data/build/dist/client/quick-apps/client.js.map +1 -0
- package/data/build/dist/client/quick-apps/document.d.ts +26 -0
- package/data/build/dist/client/quick-apps/document.d.ts.map +1 -0
- package/data/build/dist/client/quick-apps/document.js +110 -0
- package/data/build/dist/client/quick-apps/document.js.map +1 -0
- package/data/build/dist/client/quick-apps/file-picker.d.ts +14 -0
- package/data/build/dist/client/quick-apps/file-picker.d.ts.map +1 -0
- package/data/build/dist/client/quick-apps/file-picker.js +51 -0
- package/data/build/dist/client/quick-apps/file-picker.js.map +1 -0
- package/data/build/dist/client/quick-apps/launcher.d.ts +7 -0
- package/data/build/dist/client/quick-apps/launcher.d.ts.map +1 -0
- package/data/build/dist/client/quick-apps/launcher.js +252 -0
- package/data/build/dist/client/quick-apps/launcher.js.map +1 -0
- package/data/build/dist/client/quick-apps/presentation.d.ts +16 -0
- package/data/build/dist/client/quick-apps/presentation.d.ts.map +1 -0
- package/data/build/dist/client/quick-apps/presentation.js +31 -0
- package/data/build/dist/client/quick-apps/presentation.js.map +1 -0
- package/data/build/dist/client/quick-apps/reorder-animation.d.ts +6 -0
- package/data/build/dist/client/quick-apps/reorder-animation.d.ts.map +1 -0
- package/data/build/dist/client/quick-apps/reorder-animation.js +50 -0
- package/data/build/dist/client/quick-apps/reorder-animation.js.map +1 -0
- package/data/build/dist/client/quick-apps/reorder.d.ts +26 -0
- package/data/build/dist/client/quick-apps/reorder.d.ts.map +1 -0
- package/data/build/dist/client/quick-apps/reorder.js +128 -0
- package/data/build/dist/client/quick-apps/reorder.js.map +1 -0
- package/data/build/dist/client/quick-apps/styles.d.ts +3 -0
- package/data/build/dist/client/quick-apps/styles.d.ts.map +1 -0
- package/data/build/dist/client/quick-apps/styles.js +143 -0
- package/data/build/dist/client/quick-apps/styles.js.map +1 -0
- package/data/build/dist/client/quick-apps/ui.d.ts +20 -0
- package/data/build/dist/client/quick-apps/ui.d.ts.map +1 -0
- package/data/build/dist/client/quick-apps/ui.js +21 -0
- package/data/build/dist/client/quick-apps/ui.js.map +1 -0
- package/data/build/dist/client/quick-apps/viewer.d.ts +16 -0
- package/data/build/dist/client/quick-apps/viewer.d.ts.map +1 -0
- package/data/build/dist/client/quick-apps/viewer.js +155 -0
- package/data/build/dist/client/quick-apps/viewer.js.map +1 -0
- package/data/build/dist/client/quick-apps/workspace-picker.d.ts +19 -0
- package/data/build/dist/client/quick-apps/workspace-picker.d.ts.map +1 -0
- package/data/build/dist/client/quick-apps/workspace-picker.js +30 -0
- package/data/build/dist/client/quick-apps/workspace-picker.js.map +1 -0
- package/data/build/dist/client/session-translation-chat.d.ts +10 -4
- package/data/build/dist/client/session-translation-chat.d.ts.map +1 -1
- package/data/build/dist/client/session-translation-chat.js +154 -52
- package/data/build/dist/client/session-translation-chat.js.map +1 -1
- package/data/build/dist/client/session-translation-pending-dom.d.ts +1 -1
- package/data/build/dist/client/session-translation-pending-dom.d.ts.map +1 -1
- package/data/build/dist/client/session-translation-pending-dom.js +4 -4
- package/data/build/dist/client/session-translation-pending-dom.js.map +1 -1
- package/data/build/dist/client/session-translation-retry.d.ts +16 -0
- package/data/build/dist/client/session-translation-retry.d.ts.map +1 -0
- package/data/build/dist/client/session-translation-retry.js +66 -0
- package/data/build/dist/client/session-translation-retry.js.map +1 -0
- package/data/build/dist/client/session-translation-rules.d.ts +13 -0
- package/data/build/dist/client/session-translation-rules.d.ts.map +1 -0
- package/data/build/dist/client/session-translation-rules.js +58 -0
- package/data/build/dist/client/session-translation-rules.js.map +1 -0
- package/data/build/dist/client/sidebar-footer-style.d.ts +13 -0
- package/data/build/dist/client/sidebar-footer-style.d.ts.map +1 -0
- package/data/build/dist/client/sidebar-footer-style.js +54 -0
- package/data/build/dist/client/sidebar-footer-style.js.map +1 -0
- package/data/build/dist/client/style.css +276 -276
- package/data/build/dist/client/terminal/model.d.ts.map +1 -1
- package/data/build/dist/client/terminal/model.js +2 -1
- package/data/build/dist/client/terminal/model.js.map +1 -1
- package/data/build/dist/dsh-capabilities/client/composer-slot-selectors.d.ts +4 -0
- package/data/build/dist/dsh-capabilities/client/composer-slot-selectors.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/client/composer-slot-selectors.js +8 -0
- package/data/build/dist/dsh-capabilities/client/composer-slot-selectors.js.map +1 -0
- package/data/build/dist/dsh-capabilities/client/interaction-presentation-adapter.d.ts.map +1 -1
- package/data/build/dist/dsh-capabilities/client/interaction-presentation-adapter.js +4 -13
- package/data/build/dist/dsh-capabilities/client/interaction-presentation-adapter.js.map +1 -1
- package/data/build/dist/dsh-capabilities/client/interaction-text-dom.js +1 -1
- package/data/build/dist/dsh-capabilities/client/interaction-text-dom.js.map +1 -1
- package/data/build/dist/dsh-capabilities/client/message-presentation-adapter.d.ts +19 -0
- package/data/build/dist/dsh-capabilities/client/message-presentation-adapter.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/client/message-presentation-adapter.js +39 -0
- package/data/build/dist/dsh-capabilities/client/message-presentation-adapter.js.map +1 -0
- package/data/build/dist/dsh-capabilities/client/primitives-adapter.d.ts +18 -0
- package/data/build/dist/dsh-capabilities/client/primitives-adapter.d.ts.map +1 -1
- package/data/build/dist/dsh-capabilities/client/primitives-adapter.js +21 -0
- package/data/build/dist/dsh-capabilities/client/primitives-adapter.js.map +1 -1
- package/data/build/dist/dsh-capabilities/client/quick-app-footer-adapter.d.ts +18 -0
- package/data/build/dist/dsh-capabilities/client/quick-app-footer-adapter.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/client/quick-app-footer-adapter.js +11 -0
- package/data/build/dist/dsh-capabilities/client/quick-app-footer-adapter.js.map +1 -0
- package/data/build/dist/dsh-capabilities/client/session-performance-adapter.d.ts +8 -0
- package/data/build/dist/dsh-capabilities/client/session-performance-adapter.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/client/session-performance-adapter.js +100 -0
- package/data/build/dist/dsh-capabilities/client/session-performance-adapter.js.map +1 -0
- package/data/build/dist/dsh-capabilities/client/sidebar-footer-icon-adapter.d.ts +3 -0
- package/data/build/dist/dsh-capabilities/client/sidebar-footer-icon-adapter.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/client/sidebar-footer-icon-adapter.js +22 -0
- package/data/build/dist/dsh-capabilities/client/sidebar-footer-icon-adapter.js.map +1 -0
- package/data/build/dist/dsh-capabilities/client/slot-presentation-mirror.d.ts +2 -0
- package/data/build/dist/dsh-capabilities/client/slot-presentation-mirror.d.ts.map +1 -1
- package/data/build/dist/dsh-capabilities/client/slot-presentation-mirror.js +28 -0
- package/data/build/dist/dsh-capabilities/client/slot-presentation-mirror.js.map +1 -1
- package/data/build/dist/dsh-capabilities/host/connection-peer-adapter.d.ts +10 -0
- package/data/build/dist/dsh-capabilities/host/connection-peer-adapter.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/host/connection-peer-adapter.js +34 -0
- package/data/build/dist/dsh-capabilities/host/connection-peer-adapter.js.map +1 -0
- package/data/build/dist/dsh-capabilities/host/native-dispatch-adapter.d.ts +21 -0
- package/data/build/dist/dsh-capabilities/host/native-dispatch-adapter.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/host/native-dispatch-adapter.js +11 -0
- package/data/build/dist/dsh-capabilities/host/native-dispatch-adapter.js.map +1 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-credentials.d.ts +11 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-credentials.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-credentials.js +97 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-credentials.js.map +1 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-https-provider.d.ts +36 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-https-provider.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-https-provider.js +164 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-https-provider.js.map +1 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-lan-ports.d.ts +44 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-lan-ports.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-lan-ports.js +240 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-lan-ports.js.map +1 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-origin-adapter.d.ts +37 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-origin-adapter.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-origin-adapter.js +35 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-origin-adapter.js.map +1 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-proxy-adapter.d.ts +13 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-proxy-adapter.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-proxy-adapter.js +30 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-proxy-adapter.js.map +1 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-proxy-provider.d.ts +21 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-proxy-provider.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-proxy-provider.js +132 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-proxy-provider.js.map +1 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-transport.d.ts +10 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-transport.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-transport.js +33 -0
- package/data/build/dist/dsh-capabilities/host/quick-app-transport.js.map +1 -0
- package/data/build/dist/dsh-capabilities/host/session-activation-adapter.d.ts +17 -0
- package/data/build/dist/dsh-capabilities/host/session-activation-adapter.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/host/session-activation-adapter.js +37 -0
- package/data/build/dist/dsh-capabilities/host/session-activation-adapter.js.map +1 -0
- package/data/build/dist/dsh-capabilities/host/session-model-selection-adapter.d.ts +17 -0
- package/data/build/dist/dsh-capabilities/host/session-model-selection-adapter.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/host/session-model-selection-adapter.js +45 -0
- package/data/build/dist/dsh-capabilities/host/session-model-selection-adapter.js.map +1 -0
- package/data/build/dist/dsh-capabilities/host/session-performance-adapter.d.ts +7 -0
- package/data/build/dist/dsh-capabilities/host/session-performance-adapter.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/host/session-performance-adapter.js +18 -0
- package/data/build/dist/dsh-capabilities/host/session-performance-adapter.js.map +1 -0
- package/data/build/dist/dsh-capabilities/host/session-prompt-adapter.d.ts +28 -0
- package/data/build/dist/dsh-capabilities/host/session-prompt-adapter.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/host/session-prompt-adapter.js +31 -0
- package/data/build/dist/dsh-capabilities/host/session-prompt-adapter.js.map +1 -0
- package/data/build/dist/dsh-capabilities/host/workspace-directory-adapter.d.ts +13 -0
- package/data/build/dist/dsh-capabilities/host/workspace-directory-adapter.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/host/workspace-directory-adapter.js +24 -0
- package/data/build/dist/dsh-capabilities/host/workspace-directory-adapter.js.map +1 -0
- package/data/build/dist/dsh-capabilities/matrix.d.ts.map +1 -1
- package/data/build/dist/dsh-capabilities/matrix.js +19 -5
- package/data/build/dist/dsh-capabilities/matrix.js.map +1 -1
- package/data/build/dist/dsh-capabilities/routes.d.ts +1 -0
- package/data/build/dist/dsh-capabilities/routes.d.ts.map +1 -1
- package/data/build/dist/dsh-capabilities/routes.js +41 -5
- package/data/build/dist/dsh-capabilities/routes.js.map +1 -1
- package/data/build/dist/dsh-capabilities/types.d.ts +1 -1
- package/data/build/dist/dsh-capabilities/types.d.ts.map +1 -1
- package/data/build/dist/dsh-capabilities/types.js.map +1 -1
- package/data/build/dist/host/cli-adapters/antigravity-driver.js +1 -1
- package/data/build/dist/host/cli-adapters/antigravity-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/attachment-utils.d.ts +4 -3
- package/data/build/dist/host/cli-adapters/attachment-utils.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/attachment-utils.js +9 -8
- package/data/build/dist/host/cli-adapters/attachment-utils.js.map +1 -1
- package/data/build/dist/host/cli-adapters/binary-detection.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/binary-detection.js +7 -3
- package/data/build/dist/host/cli-adapters/binary-detection.js.map +1 -1
- package/data/build/dist/host/cli-adapters/claude-driver.d.ts +1 -0
- package/data/build/dist/host/cli-adapters/claude-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/claude-driver.js +180 -21
- package/data/build/dist/host/cli-adapters/claude-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/codex-driver.d.ts +18 -0
- package/data/build/dist/host/cli-adapters/codex-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/codex-driver.js +97 -5
- package/data/build/dist/host/cli-adapters/codex-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/codex-performance-projection.d.ts +91 -0
- package/data/build/dist/host/cli-adapters/codex-performance-projection.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/codex-performance-projection.js +8 -0
- package/data/build/dist/host/cli-adapters/codex-performance-projection.js.map +1 -0
- package/data/build/dist/host/cli-adapters/codex-performance.d.ts +16 -0
- package/data/build/dist/host/cli-adapters/codex-performance.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/codex-performance.js +81 -0
- package/data/build/dist/host/cli-adapters/codex-performance.js.map +1 -0
- package/data/build/dist/host/cli-adapters/command-code-driver.js +1 -1
- package/data/build/dist/host/cli-adapters/command-code-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/driver.d.ts +2 -0
- package/data/build/dist/host/cli-adapters/driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/dsh-message-projector.d.ts +2 -0
- package/data/build/dist/host/cli-adapters/dsh-message-projector.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/dsh-message-projector.js +28 -7
- package/data/build/dist/host/cli-adapters/dsh-message-projector.js.map +1 -1
- package/data/build/dist/host/cli-adapters/feature.d.ts +2 -0
- package/data/build/dist/host/cli-adapters/feature.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/feature.js +186 -71
- package/data/build/dist/host/cli-adapters/feature.js.map +1 -1
- package/data/build/dist/host/cli-adapters/gemini-driver.js +1 -1
- package/data/build/dist/host/cli-adapters/gemini-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/grok-driver.d.ts +3 -0
- package/data/build/dist/host/cli-adapters/grok-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/grok-driver.js +277 -53
- package/data/build/dist/host/cli-adapters/grok-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/grok-performance-projection.d.ts +123 -0
- package/data/build/dist/host/cli-adapters/grok-performance-projection.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/grok-performance-projection.js +47 -0
- package/data/build/dist/host/cli-adapters/grok-performance-projection.js.map +1 -0
- package/data/build/dist/host/cli-adapters/grok-usage.d.ts +45 -0
- package/data/build/dist/host/cli-adapters/grok-usage.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/grok-usage.js +197 -0
- package/data/build/dist/host/cli-adapters/grok-usage.js.map +1 -0
- package/data/build/dist/host/cli-adapters/kimi-driver.js +2 -2
- package/data/build/dist/host/cli-adapters/kimi-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/management-installation.d.ts +5 -0
- package/data/build/dist/host/cli-adapters/management-installation.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/management-installation.js +131 -0
- package/data/build/dist/host/cli-adapters/management-installation.js.map +1 -0
- package/data/build/dist/host/cli-adapters/management-methods.d.ts +32 -0
- package/data/build/dist/host/cli-adapters/management-methods.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/management-methods.js +135 -0
- package/data/build/dist/host/cli-adapters/management-methods.js.map +1 -0
- package/data/build/dist/host/cli-adapters/management-process.d.ts +7 -0
- package/data/build/dist/host/cli-adapters/management-process.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/management-process.js +51 -0
- package/data/build/dist/host/cli-adapters/management-process.js.map +1 -0
- package/data/build/dist/host/cli-adapters/management.d.ts +32 -0
- package/data/build/dist/host/cli-adapters/management.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/management.js +172 -0
- package/data/build/dist/host/cli-adapters/management.js.map +1 -0
- package/data/build/dist/host/cli-adapters/mcode-driver.js +1 -1
- package/data/build/dist/host/cli-adapters/mcode-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/model-catalog.d.ts +1 -0
- package/data/build/dist/host/cli-adapters/model-catalog.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/model-catalog.js +62 -0
- package/data/build/dist/host/cli-adapters/model-catalog.js.map +1 -1
- package/data/build/dist/host/cli-adapters/native-team-subagent.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/native-team-subagent.js +2 -1
- package/data/build/dist/host/cli-adapters/native-team-subagent.js.map +1 -1
- package/data/build/dist/host/cli-adapters/opencode-driver.d.ts +22 -0
- package/data/build/dist/host/cli-adapters/opencode-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/opencode-driver.js +105 -17
- package/data/build/dist/host/cli-adapters/opencode-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/pi-driver.js +1 -1
- package/data/build/dist/host/cli-adapters/pi-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/process-utils.d.ts +2 -0
- package/data/build/dist/host/cli-adapters/process-utils.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/process-utils.js +16 -11
- package/data/build/dist/host/cli-adapters/process-utils.js.map +1 -1
- package/data/build/dist/host/cli-adapters/registry.d.ts +3 -0
- package/data/build/dist/host/cli-adapters/registry.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/registry.js +56 -21
- package/data/build/dist/host/cli-adapters/registry.js.map +1 -1
- package/data/build/dist/host/cli-adapters/session-performance-projection.d.ts +74 -0
- package/data/build/dist/host/cli-adapters/session-performance-projection.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/session-performance-projection.js +83 -0
- package/data/build/dist/host/cli-adapters/session-performance-projection.js.map +1 -0
- package/data/build/dist/host/cli-adapters/stream-normalizer.d.ts +3 -1
- package/data/build/dist/host/cli-adapters/stream-normalizer.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/stream-normalizer.js +2 -0
- package/data/build/dist/host/cli-adapters/stream-normalizer.js.map +1 -1
- package/data/build/dist/host/cli-adapters/update-check.d.ts +34 -0
- package/data/build/dist/host/cli-adapters/update-check.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/update-check.js +263 -0
- package/data/build/dist/host/cli-adapters/update-check.js.map +1 -0
- package/data/build/dist/host/cli-adapters/zcode-driver.js +1 -1
- package/data/build/dist/host/cli-adapters/zcode-driver.js.map +1 -1
- package/data/build/dist/host/features/file-management.d.ts.map +1 -1
- package/data/build/dist/host/features/file-management.js +8 -0
- package/data/build/dist/host/features/file-management.js.map +1 -1
- package/data/build/dist/host/features/global-voice-rpc.d.ts.map +1 -1
- package/data/build/dist/host/features/global-voice-rpc.js +2 -3
- package/data/build/dist/host/features/global-voice-rpc.js.map +1 -1
- package/data/build/dist/host/features/index.d.ts.map +1 -1
- package/data/build/dist/host/features/index.js +2 -0
- package/data/build/dist/host/features/index.js.map +1 -1
- package/data/build/dist/host/features/lan-access-dsh.js +1 -1
- package/data/build/dist/host/features/lan-access-dsh.js.map +1 -1
- package/data/build/dist/host/features/peer-host.d.ts.map +1 -1
- package/data/build/dist/host/features/peer-host.js +13 -6
- package/data/build/dist/host/features/peer-host.js.map +1 -1
- package/data/build/dist/host/features/quick-apps.d.ts +4 -0
- package/data/build/dist/host/features/quick-apps.d.ts.map +1 -0
- package/data/build/dist/host/features/quick-apps.js +158 -0
- package/data/build/dist/host/features/quick-apps.js.map +1 -0
- package/data/build/dist/host/features/session-prompt-translation.d.ts +10 -0
- package/data/build/dist/host/features/session-prompt-translation.d.ts.map +1 -0
- package/data/build/dist/host/features/session-prompt-translation.js +198 -0
- package/data/build/dist/host/features/session-prompt-translation.js.map +1 -0
- package/data/build/dist/host/features/session-translation-protection.d.ts +12 -1
- package/data/build/dist/host/features/session-translation-protection.d.ts.map +1 -1
- package/data/build/dist/host/features/session-translation-protection.js +44 -5
- package/data/build/dist/host/features/session-translation-protection.js.map +1 -1
- package/data/build/dist/host/features/session-translation-recovery.d.ts +21 -0
- package/data/build/dist/host/features/session-translation-recovery.d.ts.map +1 -0
- package/data/build/dist/host/features/session-translation-recovery.js +125 -0
- package/data/build/dist/host/features/session-translation-recovery.js.map +1 -0
- package/data/build/dist/host/features/session-translation-service.d.ts +8 -2
- package/data/build/dist/host/features/session-translation-service.d.ts.map +1 -1
- package/data/build/dist/host/features/session-translation-service.js +69 -19
- package/data/build/dist/host/features/session-translation-service.js.map +1 -1
- package/data/build/dist/host/features/session-translation.d.ts.map +1 -1
- package/data/build/dist/host/features/session-translation.js +4 -1
- package/data/build/dist/host/features/session-translation.js.map +1 -1
- package/data/build/dist/host/features/types.d.ts +10 -0
- package/data/build/dist/host/features/types.d.ts.map +1 -1
- package/data/build/dist/host/html-workspace-files.d.ts +3 -0
- package/data/build/dist/host/html-workspace-files.d.ts.map +1 -0
- package/data/build/dist/host/html-workspace-files.js +135 -0
- package/data/build/dist/host/html-workspace-files.js.map +1 -0
- package/data/build/dist/host/index.d.ts.map +1 -1
- package/data/build/dist/host/index.js +27 -2
- package/data/build/dist/host/index.js.map +1 -1
- package/data/build/dist/host/lan-access-dsh.d.ts +5 -1
- package/data/build/dist/host/lan-access-dsh.d.ts.map +1 -1
- package/data/build/dist/host/lan-access-dsh.js +43 -2
- package/data/build/dist/host/lan-access-dsh.js.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-native-dispatch.d.ts +2 -2
- package/data/build/dist/host/modules/peer-host/peer-host-native-dispatch.d.ts.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-native-dispatch.js +10 -9
- package/data/build/dist/host/modules/peer-host/peer-host-native-dispatch.js.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-native-streams.d.ts +3 -3
- package/data/build/dist/host/modules/peer-host/peer-host-native-streams.d.ts.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-native-streams.js +26 -14
- package/data/build/dist/host/modules/peer-host/peer-host-native-streams.js.map +1 -1
- package/data/build/dist/host/modules/peer-host/quick-app-gateway.d.ts +5 -0
- package/data/build/dist/host/modules/peer-host/quick-app-gateway.d.ts.map +1 -0
- package/data/build/dist/host/modules/peer-host/quick-app-gateway.js +27 -0
- package/data/build/dist/host/modules/peer-host/quick-app-gateway.js.map +1 -0
- package/data/build/dist/host/modules/quick-apps/browse.d.ts +5 -0
- package/data/build/dist/host/modules/quick-apps/browse.d.ts.map +1 -0
- package/data/build/dist/host/modules/quick-apps/browse.js +37 -0
- package/data/build/dist/host/modules/quick-apps/browse.js.map +1 -0
- package/data/build/dist/host/modules/quick-apps/code-revision.d.ts +4 -0
- package/data/build/dist/host/modules/quick-apps/code-revision.d.ts.map +1 -0
- package/data/build/dist/host/modules/quick-apps/code-revision.js +39 -0
- package/data/build/dist/host/modules/quick-apps/code-revision.js.map +1 -0
- package/data/build/dist/host/modules/quick-apps/documents.d.ts +14 -0
- package/data/build/dist/host/modules/quick-apps/documents.d.ts.map +1 -0
- package/data/build/dist/host/modules/quick-apps/documents.js +87 -0
- package/data/build/dist/host/modules/quick-apps/documents.js.map +1 -0
- package/data/build/dist/host/modules/quick-apps/errors.d.ts +8 -0
- package/data/build/dist/host/modules/quick-apps/errors.d.ts.map +1 -0
- package/data/build/dist/host/modules/quick-apps/errors.js +15 -0
- package/data/build/dist/host/modules/quick-apps/errors.js.map +1 -0
- package/data/build/dist/host/modules/quick-apps/file-api.d.ts +30 -0
- package/data/build/dist/host/modules/quick-apps/file-api.d.ts.map +1 -0
- package/data/build/dist/host/modules/quick-apps/file-api.js +149 -0
- package/data/build/dist/host/modules/quick-apps/file-api.js.map +1 -0
- package/data/build/dist/host/modules/quick-apps/launches.d.ts +35 -0
- package/data/build/dist/host/modules/quick-apps/launches.d.ts.map +1 -0
- package/data/build/dist/host/modules/quick-apps/launches.js +80 -0
- package/data/build/dist/host/modules/quick-apps/launches.js.map +1 -0
- package/data/build/dist/host/modules/quick-apps/paths.d.ts +14 -0
- package/data/build/dist/host/modules/quick-apps/paths.d.ts.map +1 -0
- package/data/build/dist/host/modules/quick-apps/paths.js +72 -0
- package/data/build/dist/host/modules/quick-apps/paths.js.map +1 -0
- package/data/build/dist/host/modules/quick-apps/registry.d.ts +30 -0
- package/data/build/dist/host/modules/quick-apps/registry.d.ts.map +1 -0
- package/data/build/dist/host/modules/quick-apps/registry.js +186 -0
- package/data/build/dist/host/modules/quick-apps/registry.js.map +1 -0
- package/data/build/dist/host/modules/quick-apps/remote.d.ts +38 -0
- package/data/build/dist/host/modules/quick-apps/remote.d.ts.map +1 -0
- package/data/build/dist/host/modules/quick-apps/remote.js +237 -0
- package/data/build/dist/host/modules/quick-apps/remote.js.map +1 -0
- package/data/build/dist/host/modules/quick-apps/service.d.ts +27 -0
- package/data/build/dist/host/modules/quick-apps/service.d.ts.map +1 -0
- package/data/build/dist/host/modules/quick-apps/service.js +170 -0
- package/data/build/dist/host/modules/quick-apps/service.js.map +1 -0
- package/data/build/dist/host/modules/quick-apps/static-handler.d.ts +8 -0
- package/data/build/dist/host/modules/quick-apps/static-handler.d.ts.map +1 -0
- package/data/build/dist/host/modules/quick-apps/static-handler.js +181 -0
- package/data/build/dist/host/modules/quick-apps/static-handler.js.map +1 -0
- package/data/build/dist/host/native-session-bridge.d.ts +7 -1
- package/data/build/dist/host/native-session-bridge.d.ts.map +1 -1
- package/data/build/dist/host/native-session-bridge.js +8 -13
- package/data/build/dist/host/native-session-bridge.js.map +1 -1
- package/data/build/dist/host/rpc.d.ts.map +1 -1
- package/data/build/dist/host/rpc.js +21 -10
- package/data/build/dist/host/rpc.js.map +1 -1
- package/data/build/dist/host/settings.d.ts.map +1 -1
- package/data/build/dist/host/settings.js +18 -1
- package/data/build/dist/host/settings.js.map +1 -1
- package/data/build/dist/host/workspace-file-mutations.d.ts +2 -0
- package/data/build/dist/host/workspace-file-mutations.d.ts.map +1 -0
- package/data/build/dist/host/workspace-file-mutations.js +15 -0
- package/data/build/dist/host/workspace-file-mutations.js.map +1 -0
- package/data/build/dist/shared/attachment-prompts.d.ts +11 -0
- package/data/build/dist/shared/attachment-prompts.d.ts.map +1 -0
- package/data/build/dist/shared/attachment-prompts.js +17 -0
- package/data/build/dist/shared/attachment-prompts.js.map +1 -0
- package/data/build/dist/shared/codex-performance.d.ts +3 -0
- package/data/build/dist/shared/codex-performance.d.ts.map +1 -0
- package/data/build/dist/shared/codex-performance.js +2 -0
- package/data/build/dist/shared/codex-performance.js.map +1 -0
- package/data/build/dist/shared/contracts/cli-adapter.d.ts +33 -1
- package/data/build/dist/shared/contracts/cli-adapter.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/cli-management.d.ts +29 -0
- package/data/build/dist/shared/contracts/cli-management.d.ts.map +1 -0
- package/data/build/dist/shared/contracts/cli-management.js +2 -0
- package/data/build/dist/shared/contracts/cli-management.js.map +1 -0
- package/data/build/dist/shared/contracts/config.d.ts +2 -0
- package/data/build/dist/shared/contracts/config.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/config.js.map +1 -1
- package/data/build/dist/shared/contracts/errors.d.ts +2 -2
- package/data/build/dist/shared/contracts/quick-apps.d.ts +68 -0
- package/data/build/dist/shared/contracts/quick-apps.d.ts.map +1 -0
- package/data/build/dist/shared/contracts/quick-apps.js +4 -0
- package/data/build/dist/shared/contracts/quick-apps.js.map +1 -0
- package/data/build/dist/shared/contracts/session-translation.d.ts +20 -2
- package/data/build/dist/shared/contracts/session-translation.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/session-translation.js +24 -0
- package/data/build/dist/shared/contracts/session-translation.js.map +1 -1
- package/data/build/dist/shared/contracts/version.d.ts +4 -4
- package/data/build/dist/shared/contracts/version.js +3 -3
- package/data/build/dist/shared/peer-host-http-routes.d.ts +4 -0
- package/data/build/dist/shared/peer-host-http-routes.d.ts.map +1 -1
- package/data/build/dist/shared/peer-host-http-routes.js +4 -0
- package/data/build/dist/shared/peer-host-http-routes.js.map +1 -1
- package/data/build/dist/shared/quick-app-proxy-path.d.ts +6 -0
- package/data/build/dist/shared/quick-app-proxy-path.d.ts.map +1 -0
- package/data/build/dist/shared/quick-app-proxy-path.js +18 -0
- package/data/build/dist/shared/quick-app-proxy-path.js.map +1 -0
- package/data/build/dist/shared/quick-apps-bootstrap-locale.d.ts +7 -0
- package/data/build/dist/shared/quick-apps-bootstrap-locale.d.ts.map +1 -0
- package/data/build/dist/shared/quick-apps-bootstrap-locale.js +10 -0
- package/data/build/dist/shared/quick-apps-bootstrap-locale.js.map +1 -0
- package/data/build/dist/shared/request-performance.d.ts +15 -0
- package/data/build/dist/shared/request-performance.d.ts.map +1 -0
- package/data/build/dist/shared/request-performance.js +3 -0
- package/data/build/dist/shared/request-performance.js.map +1 -0
- package/package.json +35 -34
- package/profile/README.md +2 -2
- package/profile/package.json +3 -3
- package/profile/version.json +3 -3
- package/version.json +3 -3
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { WorkspaceDirectoryBrowser } from '../../../dsh-capabilities/host/workspace-directory-adapter.js';
|
|
2
|
+
import type { QuickAppDirectory } from '../../../shared/contracts/quick-apps.js';
|
|
3
|
+
/** Management-only browsing: the Host resolves identity before handing a root to its native browser. */
|
|
4
|
+
export declare function browseQuickAppDirectory(workspaceRoot: (id: string) => string | null, browser: WorkspaceDirectoryBrowser | undefined, workspaceId: unknown, requestedPath: unknown, signal: AbortSignal): Promise<QuickAppDirectory>;
|
|
5
|
+
//# sourceMappingURL=browse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browse.d.ts","sourceRoot":"","sources":["../../../../../../src/host/modules/quick-apps/browse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+DAA+D,CAAA;AAC9G,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAA;AAIhF,wGAAwG;AACxG,wBAAsB,uBAAuB,CAC3C,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,yBAAyB,GAAG,SAAS,EAC5F,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,GAChE,OAAO,CAAC,iBAAiB,CAAC,CAoB5B"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { realpath } from 'node:fs/promises';
|
|
2
|
+
import { appPath, publicPath, resolveAppPath } from './paths.js';
|
|
3
|
+
import { deny, QuickAppError } from './errors.js';
|
|
4
|
+
/** Management-only browsing: the Host resolves identity before handing a root to its native browser. */
|
|
5
|
+
export async function browseQuickAppDirectory(workspaceRoot, browser, workspaceId, requestedPath, signal) {
|
|
6
|
+
signal.throwIfAborted();
|
|
7
|
+
if (typeof workspaceId !== 'string' || !workspaceId)
|
|
8
|
+
deny();
|
|
9
|
+
const root = workspaceRoot(workspaceId);
|
|
10
|
+
if (!root)
|
|
11
|
+
throw new QuickAppError(404, 'QUICK_APP_WORKSPACE_UNAVAILABLE', 'The exact workspace is unavailable.');
|
|
12
|
+
const path = appPath(requestedPath ?? '');
|
|
13
|
+
if (!publicPath(path))
|
|
14
|
+
deny();
|
|
15
|
+
const canonical = await realpath(root);
|
|
16
|
+
const directory = await resolveAppPath(root, path);
|
|
17
|
+
if (!browser)
|
|
18
|
+
throw new QuickAppError(503, 'QUICK_APP_BROWSE_UNAVAILABLE', 'The native Host file browser is unavailable.');
|
|
19
|
+
const listing = await browser.list(canonical, path, signal);
|
|
20
|
+
signal.throwIfAborted();
|
|
21
|
+
// A removed/retargeted workspace or replaced directory must not publish an old listing.
|
|
22
|
+
if (workspaceRoot(workspaceId) !== root || await realpath(root) !== canonical || await resolveAppPath(root, path) !== directory)
|
|
23
|
+
deny();
|
|
24
|
+
const entries = listing.entries.slice(0, 1000).flatMap(entry => {
|
|
25
|
+
if (!['file', 'directory'].includes(entry.type) || entry.name.includes('/') || !publicPath(entry.name))
|
|
26
|
+
return [];
|
|
27
|
+
try {
|
|
28
|
+
appPath(entry.name, false);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
return [{ name: entry.name, path: path ? `${path}/${entry.name}` : entry.name, kind: entry.type }];
|
|
34
|
+
});
|
|
35
|
+
return { path, entries, truncated: listing.truncated || listing.entries.length > 1000 };
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=browse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browse.js","sourceRoot":"","sources":["../../../../../../src/host/modules/quick-apps/browse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAG3C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAChE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEjD,wGAAwG;AACxG,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,aAA4C,EAAE,OAA8C,EAC5F,WAAoB,EAAE,aAAsB,EAAE,MAAmB;IAEjE,MAAM,CAAC,cAAc,EAAE,CAAA;IACvB,IAAI,OAAO,WAAW,KAAK,QAAQ,IAAI,CAAC,WAAW;QAAE,IAAI,EAAE,CAAA;IAC3D,MAAM,IAAI,GAAG,aAAa,CAAC,WAAW,CAAC,CAAA;IACvC,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,aAAa,CAAC,GAAG,EAAE,iCAAiC,EAAE,qCAAqC,CAAC,CAAA;IACjH,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,IAAI,EAAE,CAAC,CAAA;IACzC,IAAI,CAAC,UAAU,CAAC,IAAI,CAA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C,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,IAA4B,EAAE,CAAC,CAAA;IAC5H,CAAC,CAAC,CAAA;IACF,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,IAAI,EAAE,CAAA;AACzF,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { QuickApp } from '../../../shared/contracts/quick-apps.js';
|
|
2
|
+
/** Bounded, request-time trust check. No watcher or background workspace scan is installed. */
|
|
3
|
+
export declare function quickAppCodeRevision(workspace: string, app: QuickApp): Promise<string>;
|
|
4
|
+
//# sourceMappingURL=code-revision.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-revision.d.ts","sourceRoot":"","sources":["../../../../../../src/host/modules/quick-apps/code-revision.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAA;AAMvE,+FAA+F;AAC/F,wBAAsB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAwB5F"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { lstat, opendir, realpath } from 'node:fs/promises';
|
|
3
|
+
import { extname, join } from 'node:path';
|
|
4
|
+
import { publicPath, resolveAppPath } from './paths.js';
|
|
5
|
+
import { QuickAppError } from './errors.js';
|
|
6
|
+
const codeExtensions = new Set(['.html', '.htm', '.js', '.mjs', '.css', '.svg', '.wasm']);
|
|
7
|
+
/** Bounded, request-time trust check. No watcher or background workspace scan is installed. */
|
|
8
|
+
export async function quickAppCodeRevision(workspace, app) {
|
|
9
|
+
const root = await realpath(workspace);
|
|
10
|
+
const entries = [];
|
|
11
|
+
const visited = new Set();
|
|
12
|
+
let count = 0;
|
|
13
|
+
const visit = async (path, depth) => {
|
|
14
|
+
if (visited.has(path))
|
|
15
|
+
return;
|
|
16
|
+
visited.add(path);
|
|
17
|
+
if (++count > 4096 || depth > 32)
|
|
18
|
+
throw new QuickAppError(413, 'QUICK_APP_TOO_LARGE', 'File permissions require an application folder with at most 4096 entries and 32 directory levels.');
|
|
19
|
+
const physical = join(root, path);
|
|
20
|
+
const info = await lstat(physical);
|
|
21
|
+
if (info.isSymbolicLink())
|
|
22
|
+
return; // Such paths cannot be served by the HTTP handler.
|
|
23
|
+
if (info.isDirectory()) {
|
|
24
|
+
const directory = await opendir(physical);
|
|
25
|
+
for await (const entry of directory)
|
|
26
|
+
if (publicPath(entry.name))
|
|
27
|
+
await visit([path, entry.name].filter(Boolean).join('/'), depth + 1);
|
|
28
|
+
}
|
|
29
|
+
else if (info.isFile() && codeExtensions.has(extname(path).toLowerCase())) {
|
|
30
|
+
entries.push(JSON.stringify([path, info.dev, info.ino, info.size, info.mtimeMs, info.ctimeMs]));
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
for (const path of [app.documentRoot, ...app.mounts.map(mount => mount.workspacePath)]) {
|
|
34
|
+
await resolveAppPath(root, path);
|
|
35
|
+
await visit(path, 0);
|
|
36
|
+
}
|
|
37
|
+
return createHash('sha256').update(entries.sort().join('\n')).digest('hex');
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=code-revision.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-revision.js","sourceRoot":"","sources":["../../../../../../src/host/modules/quick-apps/code-revision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEzC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,Y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AC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;QACvI,CAAC;aAAM,IAAI,IAAI,CAAC,MAAM,EAAE,IAAI,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;YAC5E,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;QACjG,CAAC;IACH,CAAC,CAAA;IACD,KAAK,MAAM,IAAI,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC;QACvF,MAAM,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QAChC,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;IACtB,CAAC;IACD,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC7E,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { QuickAppDocument } from '../../../shared/contracts/quick-apps.js';
|
|
2
|
+
import type { QuickAppFileApi } from './file-api.js';
|
|
3
|
+
import type { QuickAppLaunch, QuickAppLaunches } from './launches.js';
|
|
4
|
+
/** Trusted UI document operations. HTML pages cannot use this authenticated management channel. */
|
|
5
|
+
export declare class QuickAppDocuments {
|
|
6
|
+
private readonly launches;
|
|
7
|
+
private readonly files;
|
|
8
|
+
private active;
|
|
9
|
+
constructor(launches: QuickAppLaunches, files: QuickAppFileApi);
|
|
10
|
+
handle(id: string, principal: string, input: Record<string, unknown>): Promise<unknown>;
|
|
11
|
+
read(launch: QuickAppLaunch, path: string): Promise<QuickAppDocument>;
|
|
12
|
+
private image;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=documents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../../../../../src/host/modules/quick-apps/documents.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAA;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAMrE,mGAAmG;AACnG,qBAAa,iBAAiB;IAEhB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAAoB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAD/E,OAAO,CAAC,MAAM,CAAI;gBACW,QAAQ,EAAE,gBAAgB,EAAmB,KAAK,EAAE,eAAe;IAE1F,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IA4BvF,IAAI,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;YAK7D,KAAK;CAsBpB"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { constants } from 'node:fs';
|
|
2
|
+
import { open } from 'node:fs/promises';
|
|
3
|
+
import { extname } from 'node:path';
|
|
4
|
+
import { appPath, publicPath, resolveAppPath, withinScope } from './paths.js';
|
|
5
|
+
import { deny, QuickAppError } from './errors.js';
|
|
6
|
+
const imageTypes = { '.png': 'image/png', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.gif': 'image/gif', '.webp': 'image/webp', '.avif': 'image/avif' };
|
|
7
|
+
/** Trusted UI document operations. HTML pages cannot use this authenticated management channel. */
|
|
8
|
+
export class QuickAppDocuments {
|
|
9
|
+
launches;
|
|
10
|
+
files;
|
|
11
|
+
active = 0;
|
|
12
|
+
constructor(launches, files) {
|
|
13
|
+
this.launches = launches;
|
|
14
|
+
this.files = files;
|
|
15
|
+
}
|
|
16
|
+
async handle(id, principal, input) {
|
|
17
|
+
if (this.active >= 8)
|
|
18
|
+
throw new QuickAppError(429, 'QUICK_APP_LIMIT', 'Too many document requests.');
|
|
19
|
+
this.active++;
|
|
20
|
+
try {
|
|
21
|
+
const launch = this.launches.requireOwner(id, principal);
|
|
22
|
+
if (launch.app.kind !== 'text')
|
|
23
|
+
deny();
|
|
24
|
+
await this.launches.validateWorkspace(launch);
|
|
25
|
+
const path = appPath(input.path ?? launch.app.entryPath, false);
|
|
26
|
+
if (!publicPath(path) || !withinScope(launch.app.documentRoot, path))
|
|
27
|
+
deny();
|
|
28
|
+
if (input.operation === 'image')
|
|
29
|
+
return await this.image(launch, path);
|
|
30
|
+
if (input.operation === 'read')
|
|
31
|
+
return await this.read(launch, path);
|
|
32
|
+
if (input.operation === 'allow-edit') {
|
|
33
|
+
await this.files.read(launch, path);
|
|
34
|
+
this.launches.authorize(launch);
|
|
35
|
+
// Explicit user approval grants this file only, for this launch's lifetime. No delete/create grant.
|
|
36
|
+
launch.permissions = { ...launch.permissions, write: [...new Set([...launch.permissions.write, path])] };
|
|
37
|
+
return { ok: true };
|
|
38
|
+
}
|
|
39
|
+
if (input.operation === 'save') {
|
|
40
|
+
if (typeof input.content !== 'string')
|
|
41
|
+
deny();
|
|
42
|
+
if (Buffer.from(input.content, 'utf8').toString('utf8') !== input.content)
|
|
43
|
+
deny('The document must contain valid Unicode text.');
|
|
44
|
+
const result = await this.files.mutate(launch, 'PUT', path, input.content, typeof input.version === 'string' ? input.version : undefined, undefined, launch.abort.signal);
|
|
45
|
+
return { path, content: input.content, version: result.version, canWrite: true };
|
|
46
|
+
}
|
|
47
|
+
throw new QuickAppError(404, 'CODINGNS_RPC_NOT_FOUND', 'Unknown document operation.');
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
this.active--;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async read(launch, path) {
|
|
54
|
+
const result = await this.files.read(launch, path);
|
|
55
|
+
return { ...result, path, canWrite: launch.permissions.write.some(scope => withinScope(scope, path)) };
|
|
56
|
+
}
|
|
57
|
+
async image(launch, path) {
|
|
58
|
+
const mime = imageTypes[extname(path).toLowerCase()];
|
|
59
|
+
if (!mime)
|
|
60
|
+
deny('Only raster document images are supported.');
|
|
61
|
+
const file = await open(await resolveAppPath(launch.workspaceRoot, path), constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
62
|
+
try {
|
|
63
|
+
const info = await file.stat();
|
|
64
|
+
const limit = 2 * 1024 * 1024;
|
|
65
|
+
if (!info.isFile() || info.size > limit)
|
|
66
|
+
throw new QuickAppError(413, 'QUICK_APP_TOO_LARGE', 'Document images must be at most 2 MiB.');
|
|
67
|
+
const bytes = Buffer.alloc(limit + 1);
|
|
68
|
+
let length = 0;
|
|
69
|
+
while (length < bytes.length) {
|
|
70
|
+
const result = await file.read(bytes, length, bytes.length - length, length);
|
|
71
|
+
if (!result.bytesRead)
|
|
72
|
+
break;
|
|
73
|
+
length += result.bytesRead;
|
|
74
|
+
}
|
|
75
|
+
if (length > limit)
|
|
76
|
+
throw new QuickAppError(413, 'QUICK_APP_TOO_LARGE', 'Document images must be at most 2 MiB.');
|
|
77
|
+
await this.launches.validateWorkspace(launch);
|
|
78
|
+
await resolveAppPath(launch.workspaceRoot, path);
|
|
79
|
+
this.launches.authorize(launch);
|
|
80
|
+
return { url: `data:${mime};base64,${bytes.subarray(0, length).toString('base64')}` };
|
|
81
|
+
}
|
|
82
|
+
finally {
|
|
83
|
+
await file.close();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=documents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documents.js","sourceRoot":"","sources":["../../../../../../src/host/modules/quick-apps/documents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAInC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAC7E,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEjD,MAAM,UAAU,GAA2B,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,CAAA;AAElL,mGAAmG;AACnG,MAAM,OAAO,iBAAiB;IAEC;IAA6C;IADlE,MAAM,GAAG,CAAC,CAAA;IAClB,YAA6B,QAA0B,EAAmB,KAAsB;QAAnE,aAAQ,GAAR,QAAQ,CAAkB;QAAmB,UAAK,GAAL,KAAK,CAAiB;IAAG,CAAC;IAEpG,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,SAAiB,EAAE,KAA8B;QACxE,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC;YAAE,MAAM,IAAI,aAAa,CAAC,GAAG,EAAE,iBAAiB,EAAE,6BAA6B,CAAC,CAAA;QACpG,IAAI,CAAC,MAAM,EAAE,CAAA;QACb,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,EAAE,SAAS,CAAC,CAAA;YACxD,IAAI,MAAM,CAAC,G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;YAC/B,OAAO,EAAE,GAAG,EAAE,QAAQ,IAAI,WAAW,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAA;QACvF,CAAC;gBAAS,CAAC;YAAC,MAAM,IAAI,CAAC,KAAK,EAAE,CAAA;QAAC,CAAC;IAClC,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CodingNsRpcError } from '../../rpc-table.js';
|
|
2
|
+
export declare class QuickAppError extends CodingNsRpcError {
|
|
3
|
+
readonly status: number;
|
|
4
|
+
constructor(status: number, code: string, message: string);
|
|
5
|
+
}
|
|
6
|
+
export declare function deny(message?: string): never;
|
|
7
|
+
export declare function conflict(): never;
|
|
8
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../../../src/host/modules/quick-apps/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,qBAAa,aAAc,SAAQ,gBAAgB;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM;gBAAd,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CACnE;AAED,wBAAgB,IAAI,CAAC,OAAO,SAAqD,GAAG,KAAK,CAExF;AAED,wBAAgB,QAAQ,IAAI,KAAK,CAEhC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CodingNsRpcError } from '../../rpc-table.js';
|
|
2
|
+
export class QuickAppError extends CodingNsRpcError {
|
|
3
|
+
status;
|
|
4
|
+
constructor(status, code, message) {
|
|
5
|
+
super(code, message);
|
|
6
|
+
this.status = status;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export function deny(message = 'The requested path or operation is not approved.') {
|
|
10
|
+
throw new QuickAppError(403, 'QUICK_APP_ACCESS_DENIED', message);
|
|
11
|
+
}
|
|
12
|
+
export function conflict() {
|
|
13
|
+
throw new QuickAppError(412, 'QUICK_APP_CONFLICT', 'The file or shortcut changed. Reload it before retrying.');
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../../../src/host/modules/quick-apps/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,MAAM,OAAO,aAAc,SAAQ,gBAAgB;IAC5B;IAArB,YAAqB,MAAc,EAAE,IAAY,EAAE,OAAe;QAAI,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAArE,WAAM,GAAN,MAAM,CAAQ;IAAwD,CAAC;CAC7F;AAED,MAAM,UAAU,IAAI,CAAC,OAAO,GAAG,kDAAkD;IAC/E,MAAM,IAAI,aAAa,CAAC,GAAG,EAAE,yBAAyB,EAAE,OAAO,CAAC,CAAA;AAClE,CAAC;AAED,MAAM,UAAU,QAAQ;IACtB,MAAM,IAAI,aAAa,CAAC,GAAG,EAAE,oBAAoB,EAAE,0DAA0D,CAAC,CAAA;AAChH,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { QuickAppLaunch, QuickAppLaunches } from './launches.js';
|
|
2
|
+
export declare function readVersionedText(path: string): Promise<{
|
|
3
|
+
content: string;
|
|
4
|
+
version: string;
|
|
5
|
+
}>;
|
|
6
|
+
export declare function tooLarge(): never;
|
|
7
|
+
/** Global physical-file ordering with per-service pending work for lifecycle cleanup. */
|
|
8
|
+
export declare class QuickAppFileApi {
|
|
9
|
+
private readonly launches;
|
|
10
|
+
private readonly mutations;
|
|
11
|
+
constructor(launches: QuickAppLaunches);
|
|
12
|
+
private target;
|
|
13
|
+
read(launch: QuickAppLaunch, path: string): Promise<{
|
|
14
|
+
content: string;
|
|
15
|
+
version: string;
|
|
16
|
+
}>;
|
|
17
|
+
list(launch: QuickAppLaunch, path: string): Promise<{
|
|
18
|
+
items: readonly {
|
|
19
|
+
name: string;
|
|
20
|
+
kind: string;
|
|
21
|
+
}[];
|
|
22
|
+
}>;
|
|
23
|
+
mutate(launch: QuickAppLaunch, method: 'PUT' | 'DELETE', path: string, content: string, ifMatch?: string, ifNoneMatch?: string, signal?: AbortSignal): Promise<{
|
|
24
|
+
ok: true;
|
|
25
|
+
version?: string;
|
|
26
|
+
}>;
|
|
27
|
+
drain(): Promise<void>;
|
|
28
|
+
get pending(): number;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=file-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-api.d.ts","sourceRoot":"","sources":["../../../../../../src/host/modules/quick-apps/file-api.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAMrE,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAqBnG;AAED,wBAAgB,QAAQ,IAAI,KAAK,CAAoF;AAErH,yFAAyF;AACzF,qBAAa,eAAe;IAEd,OAAO,CAAC,QAAQ,CAAC,QAAQ;IADrC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA8B;gBAC3B,QAAQ,EAAE,gBAAgB;YAEzC,MAAM;IAQd,IAAI,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAKzF,IAAI,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,SAAS;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAAE,CAAC;IAUzG,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,GAAG,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,IAAI,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAgD9L,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAC5B,IAAI,OAAO,IAAI,MAAM,CAA+B;CACrD"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
2
|
+
import { constants } from 'node:fs';
|
|
3
|
+
import { link, open, opendir, rename, stat, unlink } from 'node:fs/promises';
|
|
4
|
+
import { basename, dirname, join } from 'node:path';
|
|
5
|
+
import { QUICK_APP_LIMITS } from '../../../shared/contracts/quick-apps.js';
|
|
6
|
+
import { appPath, publicPath, resolveAppPath, withinScope } from './paths.js';
|
|
7
|
+
import { conflict, deny, QuickAppError } from './errors.js';
|
|
8
|
+
import { serializeWorkspaceMutation } from '../../workspace-file-mutations.js';
|
|
9
|
+
export async function readVersionedText(path) {
|
|
10
|
+
const file = await open(path, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
11
|
+
try {
|
|
12
|
+
const info = await file.stat();
|
|
13
|
+
if (!info.isFile())
|
|
14
|
+
deny('Only regular text files are supported.');
|
|
15
|
+
if (info.size > QUICK_APP_LIMITS.textBytes)
|
|
16
|
+
tooLarge();
|
|
17
|
+
const bytes = Buffer.alloc(QUICK_APP_LIMITS.textBytes + 1);
|
|
18
|
+
let length = 0;
|
|
19
|
+
while (length < bytes.length) {
|
|
20
|
+
const read = await file.read(bytes, length, bytes.length - length, length);
|
|
21
|
+
if (!read.bytesRead)
|
|
22
|
+
break;
|
|
23
|
+
length += read.bytesRead;
|
|
24
|
+
}
|
|
25
|
+
if (length > QUICK_APP_LIMITS.textBytes)
|
|
26
|
+
tooLarge();
|
|
27
|
+
const after = await file.stat();
|
|
28
|
+
if (after.mtimeMs !== info.mtimeMs || after.ctimeMs !== info.ctimeMs || after.size !== info.size)
|
|
29
|
+
conflict();
|
|
30
|
+
let content;
|
|
31
|
+
try {
|
|
32
|
+
content = new TextDecoder('utf-8', { fatal: true }).decode(bytes.subarray(0, length));
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
deny('The file is not UTF-8 text.');
|
|
36
|
+
}
|
|
37
|
+
const version = `"${createHash('sha256').update(bytes.subarray(0, length)).update(`${info.ino}:${info.mtimeMs}:${info.ctimeMs}`).digest('hex')}"`;
|
|
38
|
+
return { content, version };
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
await file.close();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export function tooLarge() { throw new QuickAppError(413, 'QUICK_APP_TOO_LARGE', 'The text limit is 4 MiB.'); }
|
|
45
|
+
/** Global physical-file ordering with per-service pending work for lifecycle cleanup. */
|
|
46
|
+
export class QuickAppFileApi {
|
|
47
|
+
launches;
|
|
48
|
+
mutations = new Set();
|
|
49
|
+
constructor(launches) {
|
|
50
|
+
this.launches = launches;
|
|
51
|
+
}
|
|
52
|
+
async target(launch, operation, path, missing = false) {
|
|
53
|
+
await this.launches.validateWorkspace(launch);
|
|
54
|
+
await launch.validateCode?.();
|
|
55
|
+
this.launches.authorize(launch);
|
|
56
|
+
const normalized = appPath(path);
|
|
57
|
+
if (!publicPath(normalized) || !launch.permissions[operation].some(scope => withinScope(scope, normalized)))
|
|
58
|
+
deny();
|
|
59
|
+
return resolveAppPath(launch.workspaceRoot, normalized, missing);
|
|
60
|
+
}
|
|
61
|
+
async read(launch, path) {
|
|
62
|
+
const result = await readVersionedText(await this.target(launch, 'read', path));
|
|
63
|
+
this.launches.authorize(launch);
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
async list(launch, path) {
|
|
67
|
+
const directory = await opendir(await this.target(launch, 'read', path));
|
|
68
|
+
const items = [];
|
|
69
|
+
for await (const item of directory) {
|
|
70
|
+
this.launches.authorize(launch);
|
|
71
|
+
if (items.length >= 1000)
|
|
72
|
+
throw new QuickAppError(413, 'QUICK_APP_TOO_LARGE', 'Directory listing exceeds 1000 entries.');
|
|
73
|
+
if (!item.isSymbolicLink() && publicPath(item.name) && (item.isFile() || item.isDirectory()))
|
|
74
|
+
items.push({ name: item.name, kind: item.isFile() ? 'file' : 'directory' });
|
|
75
|
+
}
|
|
76
|
+
return { items };
|
|
77
|
+
}
|
|
78
|
+
async mutate(launch, method, path, content, ifMatch, ifNoneMatch, signal) {
|
|
79
|
+
if (Buffer.byteLength(content) > QUICK_APP_LIMITS.textBytes)
|
|
80
|
+
tooLarge();
|
|
81
|
+
const create = method === 'PUT' && ifNoneMatch === '*';
|
|
82
|
+
if ((create && ifMatch !== undefined) || (!create && (!ifMatch || ifMatch === '*' || ifNoneMatch !== undefined))) {
|
|
83
|
+
throw new QuickAppError(428, 'QUICK_APP_PRECONDITION_REQUIRED', 'Use the exact If-Match version, or If-None-Match: * to create a new file.');
|
|
84
|
+
}
|
|
85
|
+
const operation = method === 'DELETE' ? 'delete' : 'write';
|
|
86
|
+
const key = await this.target(launch, operation, path, create);
|
|
87
|
+
const next = serializeWorkspaceMutation(key, async () => {
|
|
88
|
+
signal?.throwIfAborted();
|
|
89
|
+
const target = await this.target(launch, operation, path, create);
|
|
90
|
+
if (target !== key)
|
|
91
|
+
deny();
|
|
92
|
+
if (!create && (await readVersionedText(target)).version !== ifMatch)
|
|
93
|
+
conflict();
|
|
94
|
+
if (method === 'DELETE') {
|
|
95
|
+
await this.target(launch, operation, path);
|
|
96
|
+
if ((await readVersionedText(target)).version !== ifMatch)
|
|
97
|
+
conflict();
|
|
98
|
+
signal?.throwIfAborted();
|
|
99
|
+
this.launches.authorize(launch);
|
|
100
|
+
await unlink(target);
|
|
101
|
+
return { ok: true };
|
|
102
|
+
}
|
|
103
|
+
// Parent directories must already exist. Never recursively create through an unvalidated ancestor.
|
|
104
|
+
const temporary = join(dirname(target), `.${basename(target)}.quickapp-${randomUUID()}`);
|
|
105
|
+
const mode = create ? 0o600 : (await stat(target)).mode & 0o777;
|
|
106
|
+
const file = await open(temporary, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, mode);
|
|
107
|
+
try {
|
|
108
|
+
await file.writeFile(content, 'utf8');
|
|
109
|
+
await file.sync();
|
|
110
|
+
await file.close();
|
|
111
|
+
await this.target(launch, operation, path, create);
|
|
112
|
+
if (!create && (await readVersionedText(target)).version !== ifMatch)
|
|
113
|
+
conflict();
|
|
114
|
+
signal?.throwIfAborted();
|
|
115
|
+
this.launches.authorize(launch);
|
|
116
|
+
if (create) {
|
|
117
|
+
try {
|
|
118
|
+
await link(temporary, target);
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
if (error.code === 'EEXIST')
|
|
122
|
+
conflict();
|
|
123
|
+
throw error;
|
|
124
|
+
}
|
|
125
|
+
// Removing the temporary hard link changes ctime. Return the version only after that cleanup.
|
|
126
|
+
await unlink(temporary);
|
|
127
|
+
}
|
|
128
|
+
else
|
|
129
|
+
await rename(temporary, target);
|
|
130
|
+
return { ok: true, version: (await readVersionedText(target)).version };
|
|
131
|
+
}
|
|
132
|
+
finally {
|
|
133
|
+
await file.close().catch(() => undefined);
|
|
134
|
+
await unlink(temporary).catch(error => { if (error.code !== 'ENOENT')
|
|
135
|
+
throw error; });
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
this.mutations.add(next);
|
|
139
|
+
try {
|
|
140
|
+
return await next;
|
|
141
|
+
}
|
|
142
|
+
finally {
|
|
143
|
+
this.mutations.delete(next);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
async drain() { await Promise.allSettled(this.mutations); }
|
|
147
|
+
get pending() { return this.mutations.size; }
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=file-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-api.js","sourceRoot":"","sources":["../../../../../../src/host/modules/quick-apps/file-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAC5E,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAA;AAC1E,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAC7E,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAA;AAE9E,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,IAAY;IAClD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,UAAU,CAAC,CAAA;IACxE,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAA;QAC9B,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAAE,IAAI,CAAC,wCAAwC,CAAC,CAAA;QAClE,IAAI,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC,SAAS;YAAE,QAAQ,EAAE,CAAA;QACtD,MAAM,KAAK,GAAG,MAAM,CAAC,K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AC,MAAM,KAAK,CAAA;oBAAC,CAAC;oBACvI,8FAA8F;oBAC9F,MAAM,MAAM,CAAC,SAAS,CAAC,CAAA;gBACzB,CAAC;;oBACI,MAAM,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;gBACpC,OAAO,EAAE,EAAE,EAAE,IAAa,EAAE,OAAO,EAAE,CAAC,MAAM,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAA;YAClF,CAAC;oBAAS,CAAC;gBACT,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;gBACzC,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,GAAG,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;oBAAE,MAAM,KAAK,CAAA,CAAC,CAAC,CAAC,CAAA;YACjH,CAAC;QACH,CAAC,CAAC,CAAA;QACF,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACxB,IAAI,CAAC;YAAC,OAAO,MAAM,IAAI,CAAA;QAAC,CAAC;gBAAS,CAAC;YAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QAAC,CAAC;IACnE,CAAC;IACD,KAAK,CAAC,KAAK,KAAoB,MAAM,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA,CAAC,CAAC;IACzE,IAAI,OAAO,KAAa,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAA,CAAC,CAAC;CACrD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { QuickApp, QuickAppPermissions } from '../../../shared/contracts/quick-apps.js';
|
|
2
|
+
import { type QuickAppRegistry } from './registry.js';
|
|
3
|
+
export interface QuickAppLaunch {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly app: QuickApp;
|
|
6
|
+
readonly principal: string;
|
|
7
|
+
readonly workspaceRoot: string;
|
|
8
|
+
readonly workspaceReference: string;
|
|
9
|
+
permissions: QuickAppPermissions;
|
|
10
|
+
readonly expiresAt: number;
|
|
11
|
+
readonly credentialDigest: Buffer;
|
|
12
|
+
readonly abort: AbortController;
|
|
13
|
+
dispose: () => Promise<void>;
|
|
14
|
+
validateCode?: () => Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export declare class QuickAppLaunches {
|
|
17
|
+
private readonly registry;
|
|
18
|
+
private readonly now;
|
|
19
|
+
private readonly launches;
|
|
20
|
+
private stopped;
|
|
21
|
+
constructor(registry: QuickAppRegistry, now?: () => number);
|
|
22
|
+
create(app: QuickApp, principal: string, permissions: QuickAppPermissions): Promise<{
|
|
23
|
+
launch: QuickAppLaunch;
|
|
24
|
+
credential: string;
|
|
25
|
+
}>;
|
|
26
|
+
authorize(launch: QuickAppLaunch, credential?: string): void;
|
|
27
|
+
validateWorkspace(launch: QuickAppLaunch): Promise<void>;
|
|
28
|
+
requireOwner(id: string, principal: string): QuickAppLaunch;
|
|
29
|
+
revoke(id: string): Promise<void>;
|
|
30
|
+
revokeApp(id: string): Promise<void>;
|
|
31
|
+
prune(): Promise<void>;
|
|
32
|
+
dispose(): Promise<void>;
|
|
33
|
+
get size(): number;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=launches.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launches.d.ts","sourceRoot":"","sources":["../../../../../../src/host/modules/quick-apps/launches.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AAE5F,OAAO,EAAyB,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAG5E,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAA;IACtB,QAAQ,CAAC,SA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AI,CAAC;IAC9B,IAAI,IAAI,IAAI,MAAM,CAA8B;CACjD"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { createHash, randomBytes, randomUUID, timingSafeEqual } from 'node:crypto';
|
|
2
|
+
import { realpath } from 'node:fs/promises';
|
|
3
|
+
import { QUICK_APP_LIMITS } from '../../../shared/contracts/quick-apps.js';
|
|
4
|
+
import { quickAppDefinitionKey } from './registry.js';
|
|
5
|
+
import { deny, QuickAppError } from './errors.js';
|
|
6
|
+
export class QuickAppLaunches {
|
|
7
|
+
registry;
|
|
8
|
+
now;
|
|
9
|
+
launches = new Map();
|
|
10
|
+
stopped = false;
|
|
11
|
+
constructor(registry, now = Date.now) {
|
|
12
|
+
this.registry = registry;
|
|
13
|
+
this.now = now;
|
|
14
|
+
}
|
|
15
|
+
async create(app, principal, permissions) {
|
|
16
|
+
const workspaceReference = this.registry.root(app);
|
|
17
|
+
const workspaceRoot = await realpath(workspaceReference);
|
|
18
|
+
await this.prune();
|
|
19
|
+
if (this.stopped)
|
|
20
|
+
throw new QuickAppError(410, 'QUICK_APP_REVOKED', 'Quick Apps is disabled.');
|
|
21
|
+
if (this.launches.size >= QUICK_APP_LIMITS.launches)
|
|
22
|
+
throw new QuickAppError(429, 'QUICK_APP_LIMIT', 'Too many active launches.');
|
|
23
|
+
const credential = randomBytes(32).toString('base64url');
|
|
24
|
+
const launch = { id: randomUUID(), app: structuredClone(app), principal, workspaceRoot, workspaceReference,
|
|
25
|
+
permissions: structuredClone(permissions), expiresAt: this.now() + QUICK_APP_LIMITS.lifetimeMs,
|
|
26
|
+
credentialDigest: digest(credential), abort: new AbortController(), dispose: async () => undefined };
|
|
27
|
+
this.launches.set(launch.id, launch);
|
|
28
|
+
return { launch, credential };
|
|
29
|
+
}
|
|
30
|
+
authorize(launch, credential) {
|
|
31
|
+
if (credential !== undefined && !timingSafeEqual(launch.credentialDigest, digest(credential)))
|
|
32
|
+
throw new QuickAppError(401, 'QUICK_APP_UNAUTHENTICATED', 'App authentication required.');
|
|
33
|
+
if (this.stopped || this.launches.get(launch.id) !== launch || launch.abort.signal.aborted)
|
|
34
|
+
throw new QuickAppError(410, 'QUICK_APP_REVOKED', 'This launch has been revoked.');
|
|
35
|
+
if (launch.expiresAt <= this.now()) {
|
|
36
|
+
void this.revoke(launch.id).catch(() => undefined);
|
|
37
|
+
throw new QuickAppError(410, 'QUICK_APP_LAUNCH_EXPIRED', 'This launch has expired.');
|
|
38
|
+
}
|
|
39
|
+
let current;
|
|
40
|
+
try {
|
|
41
|
+
current = this.registry.get(launch.app.id);
|
|
42
|
+
this.registry.root(current);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
void this.revoke(launch.id).catch(() => undefined);
|
|
46
|
+
throw new QuickAppError(410, 'QUICK_APP_REVOKED', 'The shortcut was removed.');
|
|
47
|
+
}
|
|
48
|
+
if (quickAppDefinitionKey(current) !== quickAppDefinitionKey(launch.app) || this.registry.root(current) !== launch.workspaceReference) {
|
|
49
|
+
void this.revoke(launch.id).catch(() => undefined);
|
|
50
|
+
throw new QuickAppError(410, 'QUICK_APP_REVOKED', 'The shortcut or workspace changed.');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async validateWorkspace(launch) {
|
|
54
|
+
this.authorize(launch);
|
|
55
|
+
if (await realpath(launch.workspaceReference) !== launch.workspaceRoot) {
|
|
56
|
+
void this.revoke(launch.id).catch(() => undefined);
|
|
57
|
+
throw new QuickAppError(410, 'QUICK_APP_REVOKED', 'The workspace location changed.');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
requireOwner(id, principal) {
|
|
61
|
+
const launch = this.launches.get(id);
|
|
62
|
+
if (!launch || launch.principal !== principal)
|
|
63
|
+
deny();
|
|
64
|
+
return launch;
|
|
65
|
+
}
|
|
66
|
+
async revoke(id) {
|
|
67
|
+
const launch = this.launches.get(id);
|
|
68
|
+
if (!launch)
|
|
69
|
+
return;
|
|
70
|
+
this.launches.delete(id);
|
|
71
|
+
launch.abort.abort();
|
|
72
|
+
await launch.dispose();
|
|
73
|
+
}
|
|
74
|
+
async revokeApp(id) { await Promise.all([...this.launches.values()].filter(launch => launch.app.id === id).map(launch => this.revoke(launch.id))); }
|
|
75
|
+
async prune() { await Promise.all([...this.launches.values()].filter(launch => launch.expiresAt <= this.now()).map(launch => this.revoke(launch.id))); }
|
|
76
|
+
async dispose() { this.stopped = true; await Promise.all([...this.launches.keys()].map(id => this.revoke(id))); }
|
|
77
|
+
get size() { return this.launches.size; }
|
|
78
|
+
}
|
|
79
|
+
function digest(value) { return createHash('sha256').update(value).digest(); }
|
|
80
|
+
//# sourceMappingURL=launches.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launches.js","sourceRoot":"","sources":["../../../../../../src/host/modules/quick-apps/launches.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClF,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAA;AAC1E,OAAO,EAAE,qBAAqB,EAAyB,MAAM,eAAe,CAAA;AAC5E,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAgBjD,MAAM,OAAO,gBAAgB;IAGE;IAA6C;IAFzD,QAAQ,GAAG,IAAI,GAAG,EAA0B,CAAA;IACrD,OAAO,GAAG,KAAK,CAAA;IACvB,YAA6B,QAA0B,EAAmB,MAAM,IAAI,CAAC,GAAG;QAA3D,aAAQ,GAAR,QAAQ,CAAkB;QAAmB,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAE5F,KAAK,CAAC,MAAM,CAAC,GAAa,EAAE,SAAiB,EAAE,WAAgC;QAC7E,MAAM,kBAAkB,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAClD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CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC;IAC1K,KAAK,CAAC,KAAK,KAAoB,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC;IACtK,KAAK,CAAC,OAAO,KAAoB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC;IAC/H,IAAI,IAAI,KAAa,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAA,CAAC,CAAC;CACjD;AAED,SAAS,MAAM,CAAC,KAAa,IAAY,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAA,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Paths have one representation on every platform; no URL decoding in filesystem code. */
|
|
2
|
+
export declare function appPath(value: unknown, allowRoot?: boolean): string;
|
|
3
|
+
export declare function insidePath(root: string, path: string): boolean;
|
|
4
|
+
export declare function withinScope(scope: string, path: string): boolean;
|
|
5
|
+
export declare function publicPath(path: string): boolean;
|
|
6
|
+
/** Reject all symlinks, including in-root aliases; this also keeps mutation queue keys unique. */
|
|
7
|
+
export declare function resolveAppPath(workspace: string, path: string, allowMissingLeaf?: boolean): Promise<string>;
|
|
8
|
+
/** Inspect the raw request target before WHATWG URL can erase traversal segments. */
|
|
9
|
+
export declare function decodeResourceTarget(target: string): {
|
|
10
|
+
path: string;
|
|
11
|
+
query: string;
|
|
12
|
+
trailingSlash: boolean;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../../../../../src/host/modules/quick-apps/paths.ts"],"names":[],"mappings":"AAIA,2FAA2F;AAC3F,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,UAAO,GAAG,MAAM,CAKhE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAG9D;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAEhE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGhD;AAED,kGAAkG;AAClG,wBAAsB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,gBAAgB,UAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAkB/G;AAED,qFAAqF;AACrF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,OAAO,CAAA;CAAE,CAU5G"}
|