@jingyi0605/codingns4dsh 0.2.1-beta.12 → 0.2.1-beta.14
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 +5 -5
- package/README.md +6 -9
- package/data/build/dist/bootstrap/dsh-connection-adapter.d.ts +1 -1
- package/data/build/dist/bootstrap/dsh-connection-adapter.d.ts.map +1 -1
- package/data/build/dist/bootstrap/index.d.ts +1 -1
- package/data/build/dist/bootstrap/index.d.ts.map +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 +40225 -25580
- 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 +4 -0
- package/data/build/dist/client/cli-slots.d.ts.map +1 -1
- package/data/build/dist/client/cli-slots.js +26 -10
- package/data/build/dist/client/cli-slots.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.model-catalog-cache.js +9 -1
- package/data/build/dist/client/client.model-catalog-cache.js.map +1 -1
- package/data/build/dist/client/client.native-workspace-store.js +9 -15
- 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.session-translation.js +16 -0
- package/data/build/dist/client/client.session-translation.js.map +1 -1
- package/data/build/dist/client/client.transport.js +487 -44
- package/data/build/dist/client/client.transport.js.map +1 -1
- package/data/build/dist/client/conversation-translation-settings.d.ts +2 -1
- package/data/build/dist/client/conversation-translation-settings.d.ts.map +1 -1
- package/data/build/dist/client/conversation-translation-settings.js +7 -5
- package/data/build/dist/client/conversation-translation-settings.js.map +1 -1
- package/data/build/dist/client/desktop-assistant.js +595 -152
- 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 +183 -105
- 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/mobile-access.d.ts.map +1 -1
- package/data/build/dist/client/features/mobile-access.js +7 -0
- package/data/build/dist/client/features/mobile-access.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/workspace-session-enhancement.d.ts.map +1 -1
- package/data/build/dist/client/features/workspace-session-enhancement.js +6 -0
- package/data/build/dist/client/features/workspace-session-enhancement.js.map +1 -1
- package/data/build/dist/client/git-management.d.ts.map +1 -1
- package/data/build/dist/client/git-management.js +11 -30
- package/data/build/dist/client/git-management.js.map +1 -1
- package/data/build/dist/client/git-panel-styles.d.ts +4 -0
- package/data/build/dist/client/git-panel-styles.d.ts.map +1 -1
- package/data/build/dist/client/git-panel-styles.js +14 -0
- package/data/build/dist/client/git-panel-styles.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 +14 -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 +155 -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.js +2 -2
- package/data/build/dist/client/locales/panels.js.map +1 -1
- package/data/build/dist/client/locales/quickApps.d.ts +132 -0
- package/data/build/dist/client/locales/quickApps.d.ts.map +1 -0
- package/data/build/dist/client/locales/quickApps.js +154 -0
- package/data/build/dist/client/locales/quickApps.js.map +1 -0
- package/data/build/dist/client/mobile-team-panel-dom.d.ts +14 -0
- package/data/build/dist/client/mobile-team-panel-dom.d.ts.map +1 -0
- package/data/build/dist/client/mobile-team-panel-dom.js +164 -0
- package/data/build/dist/client/mobile-team-panel-dom.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/provider-icons.d.ts.map +1 -1
- package/data/build/dist/client/provider-icons.js +3 -1
- package/data/build/dist/client/provider-icons.js.map +1 -1
- package/data/build/dist/client/quick-apps/browser-storage.d.ts +24 -0
- package/data/build/dist/client/quick-apps/browser-storage.d.ts.map +1 -0
- package/data/build/dist/client/quick-apps/browser-storage.js +114 -0
- package/data/build/dist/client/quick-apps/browser-storage.js.map +1 -0
- package/data/build/dist/client/quick-apps/client.d.ts +31 -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 +165 -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 +1 -1
- package/data/build/dist/client/session-translation-chat.d.ts.map +1 -1
- package/data/build/dist/client/session-translation-chat.js +26 -22
- package/data/build/dist/client/session-translation-chat.js.map +1 -1
- 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 +219 -219
- 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/client/workspace-session-rightbar-dom.d.ts.map +1 -1
- package/data/build/dist/client/workspace-session-rightbar-dom.js +12 -21
- package/data/build/dist/client/workspace-session-rightbar-dom.js.map +1 -1
- package/data/build/dist/client/workspace-session-visibility-dom.d.ts +3 -0
- package/data/build/dist/client/workspace-session-visibility-dom.d.ts.map +1 -1
- package/data/build/dist/client/workspace-session-visibility-dom.js +5 -4
- package/data/build/dist/client/workspace-session-visibility-dom.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/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/host/agent-team-adapter.d.ts +52 -0
- package/data/build/dist/dsh-capabilities/host/agent-team-adapter.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/host/agent-team-adapter.js +109 -0
- package/data/build/dist/dsh-capabilities/host/agent-team-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-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/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 +16 -8
- 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 +27 -6
- 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/acp-cli-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/acp-cli-driver.js +6 -3
- package/data/build/dist/host/cli-adapters/acp-cli-driver.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 +183 -20
- 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 +110 -11
- 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-acp-loader.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/command-code-acp-loader.js +11 -1
- package/data/build/dist/host/cli-adapters/command-code-acp-loader.js.map +1 -1
- package/data/build/dist/host/cli-adapters/command-code-driver.js +3 -2
- package/data/build/dist/host/cli-adapters/command-code-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/desktop-app-runtime.d.ts +3 -1
- package/data/build/dist/host/cli-adapters/desktop-app-runtime.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/desktop-app-runtime.js +41 -4
- package/data/build/dist/host/cli-adapters/desktop-app-runtime.js.map +1 -1
- 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 +19 -5
- package/data/build/dist/host/cli-adapters/dsh-message-projector.js.map +1 -1
- package/data/build/dist/host/cli-adapters/dsh-virtual-providers.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/dsh-virtual-providers.js +3 -2
- package/data/build/dist/host/cli-adapters/dsh-virtual-providers.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 +164 -34
- package/data/build/dist/host/cli-adapters/feature.js.map +1 -1
- package/data/build/dist/host/cli-adapters/gemini-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/gemini-driver.js +4 -2
- package/data/build/dist/host/cli-adapters/gemini-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/grok-driver.d.ts +6 -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 +327 -30
- 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 +48 -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/legacy-session-adapter.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/legacy-session-adapter.js +20 -3
- package/data/build/dist/host/cli-adapters/legacy-session-adapter.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 +37 -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 +144 -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 +62 -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 +177 -0
- package/data/build/dist/host/cli-adapters/management.js.map +1 -0
- package/data/build/dist/host/cli-adapters/mcode-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/mcode-driver.js +11 -4
- 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-subagent-dispatch.d.ts +1 -1
- package/data/build/dist/host/cli-adapters/native-subagent-dispatch.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/native-subagent-dispatch.js +11 -3
- package/data/build/dist/host/cli-adapters/native-subagent-dispatch.js.map +1 -1
- package/data/build/dist/host/cli-adapters/native-team-subagent.d.ts +7 -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 +4 -2
- 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/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 +7 -1
- package/data/build/dist/host/cli-adapters/registry.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/registry.js +98 -30
- 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/standard-stream-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/standard-stream-driver.js +4 -0
- package/data/build/dist/host/cli-adapters/standard-stream-driver.js.map +1 -1
- 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/subagent-tool.js +1 -1
- package/data/build/dist/host/cli-adapters/subagent-tool.js.map +1 -1
- package/data/build/dist/host/cli-adapters/team-input.d.ts +17 -0
- package/data/build/dist/host/cli-adapters/team-input.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/team-input.js +67 -0
- package/data/build/dist/host/cli-adapters/team-input.js.map +1 -0
- 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.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/zcode-driver.js +6 -1
- package/data/build/dist/host/cli-adapters/zcode-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/zcode-update.d.ts +8 -0
- package/data/build/dist/host/cli-adapters/zcode-update.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/zcode-update.js +149 -0
- package/data/build/dist/host/cli-adapters/zcode-update.js.map +1 -0
- package/data/build/dist/host/cli-bridge/bridge-holder.d.ts +14 -0
- package/data/build/dist/host/cli-bridge/bridge-holder.d.ts.map +1 -1
- package/data/build/dist/host/cli-bridge/bridge-holder.js +53 -6
- package/data/build/dist/host/cli-bridge/bridge-holder.js.map +1 -1
- package/data/build/dist/host/cli-bridge/bridge-server.d.ts +4 -0
- package/data/build/dist/host/cli-bridge/bridge-server.d.ts.map +1 -1
- package/data/build/dist/host/cli-bridge/bridge-server.js +34 -6
- package/data/build/dist/host/cli-bridge/bridge-server.js.map +1 -1
- package/data/build/dist/host/cli-bridge/command-code-mod.d.ts.map +1 -1
- package/data/build/dist/host/cli-bridge/command-code-mod.js +43 -0
- package/data/build/dist/host/cli-bridge/command-code-mod.js.map +1 -1
- package/data/build/dist/host/cli-bridge/dispatch.js +1 -1
- package/data/build/dist/host/cli-bridge/dispatch.js.map +1 -1
- package/data/build/dist/host/cli-bridge/injections.d.ts +3 -0
- package/data/build/dist/host/cli-bridge/injections.d.ts.map +1 -1
- package/data/build/dist/host/cli-bridge/injections.js +23 -7
- package/data/build/dist/host/cli-bridge/injections.js.map +1 -1
- package/data/build/dist/host/cli-bridge/mcp-stdio-entry.js +22 -3
- package/data/build/dist/host/cli-bridge/mcp-stdio-entry.js.map +1 -1
- package/data/build/dist/host/cli-bridge/team-adapters.d.ts +11 -0
- package/data/build/dist/host/cli-bridge/team-adapters.d.ts.map +1 -0
- package/data/build/dist/host/cli-bridge/team-adapters.js +22 -0
- package/data/build/dist/host/cli-bridge/team-adapters.js.map +1 -0
- package/data/build/dist/host/cli-bridge/team-dispatch.d.ts +28 -0
- package/data/build/dist/host/cli-bridge/team-dispatch.d.ts.map +1 -0
- package/data/build/dist/host/cli-bridge/team-dispatch.js +208 -0
- package/data/build/dist/host/cli-bridge/team-dispatch.js.map +1 -0
- package/data/build/dist/host/cli-bridge/team-tool.d.ts +3 -0
- package/data/build/dist/host/cli-bridge/team-tool.d.ts.map +1 -0
- package/data/build/dist/host/cli-bridge/team-tool.js +18 -0
- package/data/build/dist/host/cli-bridge/team-tool.js.map +1 -0
- 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/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 +7 -0
- 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 +1 -1
- package/data/build/dist/host/features/session-prompt-translation.d.ts.map +1 -1
- package/data/build/dist/host/features/session-prompt-translation.js +13 -4
- package/data/build/dist/host/features/session-prompt-translation.js.map +1 -1
- package/data/build/dist/host/features/session-translation-protection.d.ts +6 -0
- package/data/build/dist/host/features/session-translation-protection.d.ts.map +1 -1
- package/data/build/dist/host/features/session-translation-protection.js +21 -0
- package/data/build/dist/host/features/session-translation-protection.js.map +1 -1
- package/data/build/dist/host/features/session-translation-recovery.d.ts +3 -2
- package/data/build/dist/host/features/session-translation-recovery.d.ts.map +1 -1
- package/data/build/dist/host/features/session-translation-recovery.js +6 -3
- package/data/build/dist/host/features/session-translation-recovery.js.map +1 -1
- package/data/build/dist/host/features/session-translation-service.d.ts +3 -0
- package/data/build/dist/host/features/session-translation-service.d.ts.map +1 -1
- package/data/build/dist/host/features/session-translation-service.js +14 -8
- package/data/build/dist/host/features/session-translation-service.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/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 +238 -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 +174 -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 +190 -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 +5 -0
- package/data/build/dist/host/native-session-bridge.d.ts.map +1 -1
- package/data/build/dist/host/native-session-bridge.js +3 -0
- 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 +8 -3
- package/data/build/dist/host/rpc.js.map +1 -1
- package/data/build/dist/host/session-migration-repair.js +48 -35
- package/data/build/dist/host/session-migration-repair.js.map +1 -1
- package/data/build/dist/host/settings.d.ts.map +1 -1
- package/data/build/dist/host/settings.js +13 -0
- 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/cli-provider-route.d.ts +7 -0
- package/data/build/dist/shared/cli-provider-route.d.ts.map +1 -0
- package/data/build/dist/shared/cli-provider-route.js +13 -0
- package/data/build/dist/shared/cli-provider-route.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/agent-team.d.ts +14 -0
- package/data/build/dist/shared/contracts/agent-team.d.ts.map +1 -0
- package/data/build/dist/shared/contracts/agent-team.js +48 -0
- package/data/build/dist/shared/contracts/agent-team.js.map +1 -0
- package/data/build/dist/shared/contracts/cli-adapter.d.ts +35 -0
- 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/errors.d.ts.map +1 -1
- 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 +8 -3
- package/data/build/dist/shared/contracts/session-translation.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/session-translation.js +14 -0
- package/data/build/dist/shared/contracts/session-translation.js.map +1 -1
- package/data/build/dist/shared/contracts/version.d.ts +9 -15
- package/data/build/dist/shared/contracts/version.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/version.js +8 -14
- package/data/build/dist/shared/contracts/version.js.map +1 -1
- 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-browser-storage.d.ts +33 -0
- package/data/build/dist/shared/quick-app-browser-storage.d.ts.map +1 -0
- package/data/build/dist/shared/quick-app-browser-storage.js +33 -0
- package/data/build/dist/shared/quick-app-browser-storage.js.map +1 -0
- 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-app-storage-bootstrap.d.ts +9 -0
- package/data/build/dist/shared/quick-app-storage-bootstrap.d.ts.map +1 -0
- package/data/build/dist/shared/quick-app-storage-bootstrap.js +186 -0
- package/data/build/dist/shared/quick-app-storage-bootstrap.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 +32 -32
- package/profile/README.md +2 -2
- package/profile/package.json +3 -3
- package/profile/version.json +3 -3
- package/version.json +3 -3
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { runAsyncCommand } from './process-utils.js';
|
|
2
2
|
import { spawn, spawnSync } from 'node:child_process';
|
|
3
|
+
import { lstatSync, readFileSync, realpathSync } from 'node:fs';
|
|
3
4
|
import { randomUUID } from 'node:crypto';
|
|
4
5
|
import { homedir } from 'node:os';
|
|
5
6
|
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
@@ -9,13 +10,15 @@ import { GROK_CATALOG, isProviderDefaultModel } from './model-catalog.js';
|
|
|
9
10
|
import { isRegularFile, probeStoredSession, resolveSessionDirectory } from './session-probe.js';
|
|
10
11
|
import { firstToolText, isToolRecord, normalizeToolStatus, serializeToolValue } from './tool-observation.js';
|
|
11
12
|
import { buildAcpPromptBlocks } from './attachment-utils.js';
|
|
12
|
-
import { acpBridgeMcpServers } from '../cli-bridge/injections.js';
|
|
13
|
+
import { acpBridgeMcpServers, bridgeSessionGuidance, subagentBridgeActive, teamBridgeToken } from '../cli-bridge/injections.js';
|
|
14
|
+
import { getSubagentBridge } from '../cli-bridge/bridge-holder.js';
|
|
13
15
|
import { reasoningText } from './reasoning-content.js';
|
|
14
16
|
import { ACP_FORM_CLIENT_CAPABILITIES, acpElicitationResponse, readAcpElicitationRequest } from './acp-elicitation.js';
|
|
15
17
|
import { readAgentQuestions } from './interaction-events.js';
|
|
16
18
|
import { commandEnvironment, WINDOWS } from './process-utils.js';
|
|
17
19
|
import { imageArtifactPathsFromValue, stripImageMarkdown } from '../image-artifact-store.js';
|
|
18
20
|
import { advanceCodingNsSegment, createCodingNsSegmentState, decorateCodingNsSegmentEvent } from './stream-normalizer.js';
|
|
21
|
+
import { GrokContextUsage, GrokPromptUsage } from './grok-usage.js';
|
|
19
22
|
/** Grok Build 的 ACP stdio 驱动。ACP 会话和权限细节只在 Host 进程内处理。 */
|
|
20
23
|
export class GrokBuildDriver {
|
|
21
24
|
descriptor = { id: 'grok', name: 'Grok Build', protocol: 'acp', capabilities: ['models', 'skills', 'stream', 'tool-events', 'reasoning', 'usage', 'permission', 'questions'] };
|
|
@@ -24,6 +27,8 @@ export class GrokBuildDriver {
|
|
|
24
27
|
runSpawnSync;
|
|
25
28
|
runSpawn;
|
|
26
29
|
sessionRoots;
|
|
30
|
+
modelCachePath;
|
|
31
|
+
now;
|
|
27
32
|
cachedBinary = null;
|
|
28
33
|
processes = new Set();
|
|
29
34
|
sessions = new Map();
|
|
@@ -31,7 +36,9 @@ export class GrokBuildDriver {
|
|
|
31
36
|
this.binaries = options.binaries ?? ['grok', 'grok-build'];
|
|
32
37
|
this.runSpawnSync = options.spawnSync ?? spawnSync;
|
|
33
38
|
this.runSpawn = options.spawn ?? spawn;
|
|
39
|
+
this.now = options.now ?? Date.now;
|
|
34
40
|
this.sessionRoots = options.sessionRoots ?? [join(process.env.GROK_HOME ?? join(homedir(), '.grok'), 'sessions')];
|
|
41
|
+
this.modelCachePath = options.modelCachePath ?? join(process.env.GROK_HOME ?? join(homedir(), '.grok'), 'models_cache.json');
|
|
35
42
|
}
|
|
36
43
|
async detect() {
|
|
37
44
|
const result = await detectBinary({ binaries: this.binaries, spawnSync: this.runSpawnSync });
|
|
@@ -43,6 +50,8 @@ export class GrokBuildDriver {
|
|
|
43
50
|
const command = this.cachedBinary ?? (await this.detect()).command;
|
|
44
51
|
if (command === null)
|
|
45
52
|
return emptyCatalog();
|
|
53
|
+
const native = this.nativeModels(command);
|
|
54
|
+
let catalog = GROK_CATALOG;
|
|
46
55
|
const rpc = new JsonRpcProcess({ command, args: ['agent', '--no-leader', 'stdio'], env: grokRuntimeEnvironment(), spawn: this.runSpawn });
|
|
47
56
|
try {
|
|
48
57
|
await rpc.request('initialize', {
|
|
@@ -55,14 +64,48 @@ export class GrokBuildDriver {
|
|
|
55
64
|
rpc.notify('initialized', {});
|
|
56
65
|
const session = await rpc.request('session/new', { cwd: process.cwd(), mcpServers: [] });
|
|
57
66
|
const parsed = parseGrokCatalog(session);
|
|
58
|
-
|
|
67
|
+
if (parsed.groups.length > 0)
|
|
68
|
+
catalog = parsed;
|
|
59
69
|
}
|
|
60
70
|
catch {
|
|
61
|
-
|
|
71
|
+
// Retain the compatibility catalog when ACP discovery is unavailable.
|
|
62
72
|
}
|
|
63
73
|
finally {
|
|
64
74
|
rpc.dispose();
|
|
65
75
|
}
|
|
76
|
+
const listed = await native;
|
|
77
|
+
if (!listed)
|
|
78
|
+
return catalog;
|
|
79
|
+
const existing = new Map(catalog.groups.flatMap(group => group.models).map(model => [model.id, model]));
|
|
80
|
+
const cached = readGrokModelMetadata(this.modelCachePath);
|
|
81
|
+
const models = listed.ids.map(id => {
|
|
82
|
+
const metadata = cached.get(id);
|
|
83
|
+
return { id, name: existing.get(id)?.name ?? metadata?.name ?? id,
|
|
84
|
+
efforts: metadata?.efforts ?? existing.get(id)?.efforts ?? [] };
|
|
85
|
+
});
|
|
86
|
+
const providerDefault = GROK_CATALOG.groups.flatMap(group => group.models).find(model => model.id === 'provider-default');
|
|
87
|
+
return { groups: [{ id: 'grok', name: 'Grok', models: [providerDefault, ...models] }], currentModel: listed.current, currentEffort: null };
|
|
88
|
+
}
|
|
89
|
+
/** The models command waits for the fetched catalog; session/new may return its bootstrap snapshot. */
|
|
90
|
+
async nativeModels(command) {
|
|
91
|
+
try {
|
|
92
|
+
const result = await runAsyncCommand(this.runSpawnSync, command, ['models'], {
|
|
93
|
+
cwd: process.cwd(), encoding: 'utf8', timeout: 10_000, maxBuffer: 1024 * 1024,
|
|
94
|
+
windowsHide: true, shell: WINDOWS, env: grokRuntimeEnvironment(command),
|
|
95
|
+
});
|
|
96
|
+
if (result.status !== 0)
|
|
97
|
+
return undefined;
|
|
98
|
+
const text = String(result.stdout).replace(/\u001b\[[0-9;]*m/gu, '');
|
|
99
|
+
const section = text.split('Available models:')[1];
|
|
100
|
+
if (!section)
|
|
101
|
+
return undefined;
|
|
102
|
+
const ids = [...new Set([...section.matchAll(/^\s*[-*]\s+([A-Za-z0-9][A-Za-z0-9._:/-]*)(?:\s+\(default\))?\s*$/gmu)].map(match => match[1]))];
|
|
103
|
+
const current = text.match(/^Default model:\s*(\S+)\s*$/mu)?.[1] ?? null;
|
|
104
|
+
return ids.length ? { ids, current: current && ids.includes(current) ? current : null } : undefined;
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
66
109
|
}
|
|
67
110
|
/** Grok 的原生目录同时应用信任、禁用、兼容来源和插件命名规则。 */
|
|
68
111
|
async listSkills(input) {
|
|
@@ -114,27 +157,48 @@ export class GrokBuildDriver {
|
|
|
114
157
|
const segmentState = createCodingNsSegmentState();
|
|
115
158
|
let stepPhase;
|
|
116
159
|
let stepStreamId;
|
|
117
|
-
const activeTools = new
|
|
160
|
+
const activeTools = new Map();
|
|
161
|
+
const streamedToolInputs = new Map();
|
|
162
|
+
const permissionTools = new Map();
|
|
118
163
|
try {
|
|
119
164
|
if (providerSessionId === '') {
|
|
120
165
|
const session = await rpc.request('session/new', {
|
|
121
166
|
cwd: input.cwd ?? process.cwd(),
|
|
122
167
|
mcpServers: acpBridgeMcpServers(input.sessionId, this.descriptor.id),
|
|
123
|
-
...(!isProviderDefaultModel(input.modelId) ? { model: input.modelId } : {}),
|
|
124
168
|
}, { signal: input.signal });
|
|
125
169
|
providerSessionId = readSessionId(session) ?? input.sessionId;
|
|
170
|
+
state.contextUsage.observe(session);
|
|
126
171
|
state.providerSessionId = providerSessionId;
|
|
127
172
|
this.sessions.set(input.sessionId, state);
|
|
128
173
|
this.sessions.set(providerSessionId, state);
|
|
129
174
|
}
|
|
130
175
|
yield { type: 'session-binding', providerSessionId };
|
|
176
|
+
// Grok 1.0.52 ignores the model field on session/new. Apply explicit
|
|
177
|
+
// selections after both creation and restoration, including reused sessions.
|
|
178
|
+
if (input.modelId && !isProviderDefaultModel(input.modelId)) {
|
|
179
|
+
const selected = await rpc.request('session/set_model', { sessionId: providerSessionId, modelId: input.modelId }, { signal: input.signal });
|
|
180
|
+
state.contextUsage.modelId = input.modelId;
|
|
181
|
+
state.contextUsage.observe(selected);
|
|
182
|
+
}
|
|
183
|
+
if (input.effortId) {
|
|
184
|
+
await rpc.request('session/set_config_option', { sessionId: providerSessionId, configId: 'reasoning_effort', value: input.effortId }, { signal: input.signal });
|
|
185
|
+
}
|
|
131
186
|
// Skill 斜杠命令由 Grok 在用户输入开头解析,不能把普通提示插到命令前。
|
|
132
187
|
const nativeCommand = /^\s*\/[A-Za-z0-9][A-Za-z0-9._:-]*(?:\s|$)/u.test(input.prompt);
|
|
133
188
|
const prompt = [
|
|
134
189
|
...(nativeCommand ? [] : [{ type: 'text', text: GROK_QUESTION_GUIDANCE }]),
|
|
190
|
+
...(nativeCommand || !subagentBridgeActive(input.sessionId) ? [] : [{ type: 'text', text: bridgeSessionGuidance(input.sessionId, 'codingns__agent_subagent') }]),
|
|
135
191
|
...await buildAcpPromptBlocks(input.prompt, input.attachments ?? []),
|
|
136
192
|
];
|
|
193
|
+
const usage = new GrokPromptUsage(promptId, state.contextUsage, this.now);
|
|
137
194
|
stream = streamGrokPrompt(rpc, providerSessionId, promptId, prompt, input.signal, (notification) => {
|
|
195
|
+
usage.observe(notification);
|
|
196
|
+
const params = isRecord(notification.params) ? notification.params : {};
|
|
197
|
+
const update = isRecord(params.update) ? params.update : {};
|
|
198
|
+
const callId = firstToolText(update.toolCallId, update.tool_call_id);
|
|
199
|
+
if (callId && update.sessionUpdate === 'tool_call') {
|
|
200
|
+
permissionTools.set(callId, { name: firstToolText(update.name, update.title) ?? '', input: update.rawInput });
|
|
201
|
+
}
|
|
138
202
|
const elicitation = readAcpElicitationRequest(notification);
|
|
139
203
|
if (elicitation !== null)
|
|
140
204
|
state.questions.set(elicitation.requestId, elicitation);
|
|
@@ -145,8 +209,12 @@ export class GrokBuildDriver {
|
|
|
145
209
|
// 已回答的问题被重新登记。tool_call 可以先显示问题卡并暂存用户答案。
|
|
146
210
|
const requestId = interactionRequestId(notification);
|
|
147
211
|
if (requestId !== null && notification.id !== undefined && notification.id !== null)
|
|
148
|
-
state.requests.set(requestId, {
|
|
149
|
-
|
|
212
|
+
state.requests.set(requestId, {
|
|
213
|
+
rpcId: notification.id, callId: permissionCallId(notification), ...permissionOptions(notification),
|
|
214
|
+
autoApproved: isAdmittedGrokPermission(notification, input, state, permissionTools),
|
|
215
|
+
});
|
|
216
|
+
return usage.takeObservation();
|
|
217
|
+
}, response => { usage.observeResponse(response); return usage.takeObservation(); });
|
|
150
218
|
let finishResult;
|
|
151
219
|
while (true) {
|
|
152
220
|
const item = await stream.next();
|
|
@@ -154,13 +222,26 @@ export class GrokBuildDriver {
|
|
|
154
222
|
finishResult = item.value;
|
|
155
223
|
break;
|
|
156
224
|
}
|
|
225
|
+
if (item.value.codingnsGrokObservation !== undefined)
|
|
226
|
+
yield item.value.codingnsGrokObservation;
|
|
157
227
|
const streamId = grokStreamId(item.value);
|
|
158
|
-
for (const rawChunk of acpMessageToChunks(item.value)) {
|
|
159
|
-
|
|
228
|
+
for (const rawChunk of grokToolInputChunks(item.value, streamedToolInputs) ?? acpMessageToChunks(item.value)) {
|
|
229
|
+
if (rawChunk.type === 'permission-request' && state.requests.get(rawChunk.requestId)?.autoApproved)
|
|
230
|
+
continue;
|
|
231
|
+
// Settle native turn accounting once, after the terminal drain. Per-call
|
|
232
|
+
// usage is retained by the RPC observer solely for timing and fallback.
|
|
233
|
+
if (rawChunk.type === 'usage')
|
|
234
|
+
continue;
|
|
235
|
+
let resolved = rawChunk.type === 'image-artifact'
|
|
160
236
|
? await resolveGrokImageArtifact(rawChunk, state, this.sessionRoots)
|
|
161
237
|
: rawChunk;
|
|
162
238
|
if (resolved === null)
|
|
163
239
|
continue;
|
|
240
|
+
if (resolved.type === 'tool-event' && resolved.status === 'failed' && resolved.callId) {
|
|
241
|
+
const denial = state.permissionDenials.get(resolved.callId);
|
|
242
|
+
if (denial !== undefined)
|
|
243
|
+
resolved = { ...resolved, error: denial, output: denial, outputMode: 'snapshot' };
|
|
244
|
+
}
|
|
164
245
|
const chunk = decorateCodingNsSegmentEvent(resolved, input, segmentState, this.descriptor.id);
|
|
165
246
|
if (chunk.type === 'question-request' && state.grokQuestionCallIds.has(chunk.requestId)) {
|
|
166
247
|
if (state.grokQuestionEventIds.has(chunk.requestId))
|
|
@@ -189,7 +270,7 @@ export class GrokBuildDriver {
|
|
|
189
270
|
if (chunk.status === 'completed' || chunk.status === 'failed')
|
|
190
271
|
activeTools.delete(callId);
|
|
191
272
|
else
|
|
192
|
-
activeTools.
|
|
273
|
+
activeTools.set(callId, chunk.toolName === 'tool' ? activeTools.get(callId) ?? chunk.toolName : chunk.toolName);
|
|
193
274
|
}
|
|
194
275
|
yield chunk;
|
|
195
276
|
advanceCodingNsSegment(chunk, segmentState);
|
|
@@ -197,7 +278,30 @@ export class GrokBuildDriver {
|
|
|
197
278
|
segmentState.segment += 1;
|
|
198
279
|
}
|
|
199
280
|
}
|
|
200
|
-
|
|
281
|
+
const settledUsage = usage.finish();
|
|
282
|
+
if (settledUsage !== undefined) {
|
|
283
|
+
const { requestPerformance: _observed, ...accounting } = settledUsage;
|
|
284
|
+
yield accounting;
|
|
285
|
+
}
|
|
286
|
+
if (finishResult.failure?.code === 'PERMISSION_DENIED') {
|
|
287
|
+
const denial = [...state.permissionDenials.values()].at(-1);
|
|
288
|
+
if (denial !== undefined)
|
|
289
|
+
finishResult = { ...finishResult, failure: { message: denial, code: 'PERMISSION_DENIED' } };
|
|
290
|
+
}
|
|
291
|
+
// A normal prompt stop does not confirm pending tool execution. Keep the
|
|
292
|
+
// observed arguments and make the unknown outcome explicit without retrying.
|
|
293
|
+
if (activeTools.size > 0) {
|
|
294
|
+
for (const [callId, toolName] of activeTools) {
|
|
295
|
+
const error = 'Grok ended the turn without reporting a final result for this tool; its outcome is unconfirmed.';
|
|
296
|
+
yield decorateCodingNsSegmentEvent({ type: 'tool-event', callId, toolName, status: 'failed', error, output: error, outputMode: 'snapshot' }, input, segmentState, this.descriptor.id);
|
|
297
|
+
}
|
|
298
|
+
if (finishResult.reason === 'stop')
|
|
299
|
+
finishResult = {
|
|
300
|
+
reason: 'error',
|
|
301
|
+
failure: { message: 'Grok ended the turn before all tool results were confirmed.', code: 'INCOMPLETE_TOOL_RESULT' },
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
reusable = finishResult.reason === 'stop' && !input.signal?.aborted;
|
|
201
305
|
yield { type: 'finish', reason: finishResult.reason, ...(finishResult.failure === undefined ? {} : { failure: finishResult.failure }) };
|
|
202
306
|
}
|
|
203
307
|
finally {
|
|
@@ -213,7 +317,8 @@ export class GrokBuildDriver {
|
|
|
213
317
|
state.grokQuestionEventIds.clear();
|
|
214
318
|
state.questions.clear();
|
|
215
319
|
state.requests.clear();
|
|
216
|
-
|
|
320
|
+
state.permissionDenials.clear();
|
|
321
|
+
if (!reusable) {
|
|
217
322
|
// An abandoned prompt can keep producing updates without prompt metadata.
|
|
218
323
|
// Reload its persisted session on a fresh transport before accepting new input.
|
|
219
324
|
await rpc.disposeAndWait();
|
|
@@ -230,7 +335,10 @@ export class GrokBuildDriver {
|
|
|
230
335
|
throw new Error('The Grok permission request does not exist');
|
|
231
336
|
state.requests.delete(response.requestId);
|
|
232
337
|
const optionId = response.approved ? pending.allowOptionId : pending.rejectOptionId;
|
|
233
|
-
|
|
338
|
+
if (!response.approved || optionId === undefined) {
|
|
339
|
+
state.permissionDenials.set(pending.callId ?? response.requestId, response.reason ?? (response.approved ? 'Grok did not offer a one-time approval option.' : 'Grok tool execution was denied.'));
|
|
340
|
+
}
|
|
341
|
+
state.rpc.respond(pending.rpcId, { outcome: optionId === undefined ? { outcome: 'cancelled' } : { outcome: 'selected', optionId } });
|
|
234
342
|
}
|
|
235
343
|
respondQuestion(sessionId, response) {
|
|
236
344
|
const state = this.sessions.get(sessionId);
|
|
@@ -252,33 +360,53 @@ export class GrokBuildDriver {
|
|
|
252
360
|
dispose() { for (const process of this.processes)
|
|
253
361
|
process.dispose(); this.processes.clear(); this.sessions.clear(); this.cachedBinary = null; }
|
|
254
362
|
async getSession(input, command) {
|
|
363
|
+
const alwaysApprove = input.permission?.sandboxMode === 'danger-full-access' && input.permission.approvalPolicy === 'never';
|
|
255
364
|
const previous = this.sessions.get(input.sessionId);
|
|
256
|
-
|
|
365
|
+
const teamToken = teamBridgeToken(input.sessionId);
|
|
366
|
+
const bridgeToken = getSubagentBridge()?.token;
|
|
367
|
+
if (previous !== undefined && previous.cwd === input.cwd && previous.alwaysApprove === alwaysApprove && previous.teamToken === teamToken && previous.bridgeToken === bridgeToken && !previous.rpc.isClosed)
|
|
257
368
|
return previous;
|
|
258
369
|
if (previous !== undefined) {
|
|
259
370
|
await previous.rpc.disposeAndWait();
|
|
260
371
|
this.processes.delete(previous.rpc);
|
|
261
372
|
}
|
|
262
373
|
const resumeId = input.providerSessionId ?? (previous?.cwd === input.cwd ? previous?.providerSessionId : undefined);
|
|
263
|
-
const rpc = new JsonRpcProcess({ command, args: ['agent', '--no-leader', 'stdio'], cwd: input.cwd, env: grokRuntimeEnvironment(), spawn: this.runSpawn });
|
|
374
|
+
const rpc = new JsonRpcProcess({ command, args: ['agent', '--no-leader', ...(alwaysApprove ? ['--always-approve'] : []), 'stdio'], cwd: input.cwd, env: grokRuntimeEnvironment(), spawn: this.runSpawn });
|
|
264
375
|
this.processes.add(rpc);
|
|
265
|
-
const state = { rpc, cwd: input.cwd, rawStoreRef: input.rawStoreRef, providerSessionId: '', requests: new Map(), questions: new Map(), grokQuestions: new Map(), grokQuestionCallIds: new Set(), grokQuestionEventIds: new Set() };
|
|
266
|
-
|
|
376
|
+
const state = { teamToken, bridgeToken, rpc, contextUsage: new GrokContextUsage(), cwd: input.cwd, rawStoreRef: input.rawStoreRef, alwaysApprove, providerSessionId: '', requests: new Map(), permissionDenials: new Map(), questions: new Map(), grokQuestions: new Map(), grokQuestionCallIds: new Set(), grokQuestionEventIds: new Set() };
|
|
377
|
+
rpc.addNotificationListener(message => {
|
|
378
|
+
const params = isRecord(message.params) ? message.params : {};
|
|
379
|
+
const owner = state.providerSessionId || resumeId;
|
|
380
|
+
if (owner && typeof params.sessionId === 'string' && params.sessionId !== owner)
|
|
381
|
+
return;
|
|
382
|
+
state.contextUsage.observe(message);
|
|
383
|
+
});
|
|
384
|
+
const initialized = await rpc.request('initialize', {
|
|
267
385
|
protocolVersion: 1,
|
|
268
386
|
clientInfo: { name: 'codingns4dsh', version: '0.1.1' },
|
|
269
387
|
// 旧版 Grok 读取 capabilities;标准 ACP 读取 clientCapabilities。
|
|
270
388
|
capabilities: ACP_FORM_CLIENT_CAPABILITIES,
|
|
271
389
|
clientCapabilities: ACP_FORM_CLIENT_CAPABILITIES,
|
|
272
390
|
});
|
|
391
|
+
state.contextUsage.observe(initialized);
|
|
273
392
|
rpc.notify('initialized', {});
|
|
274
393
|
if (resumeId) {
|
|
275
394
|
try {
|
|
276
395
|
const loaded = await rpc.request('session/load', { sessionId: resumeId, cwd: input.cwd ?? process.cwd(), mcpServers: acpBridgeMcpServers(input.sessionId, this.descriptor.id) });
|
|
396
|
+
state.contextUsage.observe(loaded);
|
|
277
397
|
state.providerSessionId = readSessionId(loaded) ?? resumeId;
|
|
278
398
|
}
|
|
279
|
-
catch {
|
|
399
|
+
catch (error) {
|
|
400
|
+
if (teamToken) {
|
|
401
|
+
rpc.dispose();
|
|
402
|
+
this.processes.delete(rpc);
|
|
403
|
+
throw error;
|
|
404
|
+
}
|
|
405
|
+
// Ordinary legacy ACP sessions keep their existing new-session fallback.
|
|
406
|
+
}
|
|
280
407
|
}
|
|
281
|
-
//
|
|
408
|
+
// Admitted file/bridge requests retain existing authority. Other requests
|
|
409
|
+
// wait for native approval using the original RPC id.
|
|
282
410
|
rpc.setServerRequestHandler((message) => {
|
|
283
411
|
const elicitation = readAcpElicitationRequest(message);
|
|
284
412
|
if (elicitation !== null) {
|
|
@@ -303,7 +431,11 @@ export class GrokBuildDriver {
|
|
|
303
431
|
const requestId = interactionRequestId(message);
|
|
304
432
|
if (requestId === null || message.id === undefined || message.id === null)
|
|
305
433
|
return { outcome: { outcome: 'cancelled' } };
|
|
306
|
-
state.requests.
|
|
434
|
+
const pending = state.requests.get(requestId);
|
|
435
|
+
if (pending?.autoApproved && pending.allowOptionId !== undefined) {
|
|
436
|
+
return { outcome: { outcome: 'selected', optionId: pending.allowOptionId } };
|
|
437
|
+
}
|
|
438
|
+
state.requests.set(requestId, { rpcId: message.id, callId: permissionCallId(message), ...permissionOptions(message) });
|
|
307
439
|
return new Promise(() => undefined);
|
|
308
440
|
});
|
|
309
441
|
this.sessions.set(input.sessionId, state);
|
|
@@ -326,6 +458,7 @@ const GROK_QUESTION_GUIDANCE = [
|
|
|
326
458
|
'<codingns_host_capabilities>',
|
|
327
459
|
'The DSH host provides Grok Build\'s built-in ask_user_question tool. It displays a native question card and returns the user\'s structured answer.',
|
|
328
460
|
'ask_user_question is a grok_build built-in tool and does not depend on an MCP server. MCP connection notices only describe the MCP servers listed in the prompt.',
|
|
461
|
+
'Use the built-in read/read_file tool to inspect files. Shell commands may require approval even when workspace file writes are already allowed; do not replace a file read with a shell command.',
|
|
329
462
|
'When the user explicitly asks to use a question component, or when a question card is needed to collect a choice, call ask_user_question directly, wait for the user\'s answer, and then continue.',
|
|
330
463
|
'</codingns_host_capabilities>',
|
|
331
464
|
].join('\n');
|
|
@@ -333,7 +466,7 @@ const GROK_QUESTION_GUIDANCE = [
|
|
|
333
466
|
* Grok 可能先返回 prompt 响应,再补发最后一批 session/update。
|
|
334
467
|
* 响应或终态任一先到都会启动固定排空窗口,窗口内的文本和错误仍会被消费。
|
|
335
468
|
*/
|
|
336
|
-
async function* streamGrokPrompt(rpc, sessionId, promptId, prompt, signal, onNotification) {
|
|
469
|
+
async function* streamGrokPrompt(rpc, sessionId, promptId, prompt, signal, onNotification, onResponse) {
|
|
337
470
|
const queue = [];
|
|
338
471
|
const requestController = new AbortController();
|
|
339
472
|
let wake;
|
|
@@ -350,8 +483,8 @@ async function* streamGrokPrompt(rpc, sessionId, promptId, prompt, signal, onNot
|
|
|
350
483
|
const listener = (message) => {
|
|
351
484
|
if (!isGrokPromptMessage(message, sessionId, promptId))
|
|
352
485
|
return;
|
|
353
|
-
|
|
354
|
-
|
|
486
|
+
const observation = onNotification(message);
|
|
487
|
+
queue.push(observation === undefined ? message : { ...message, codingnsGrokObservation: observation });
|
|
355
488
|
const notificationReason = grokNotificationReason(message);
|
|
356
489
|
if (notificationReason === null) {
|
|
357
490
|
notify();
|
|
@@ -383,9 +516,15 @@ async function* streamGrokPrompt(rpc, sessionId, promptId, prompt, signal, onNot
|
|
|
383
516
|
prompt,
|
|
384
517
|
_meta: { promptId },
|
|
385
518
|
}, { signal: requestController.signal, killOnAbort: false }).then((response) => {
|
|
519
|
+
if (signal?.aborted)
|
|
520
|
+
return;
|
|
521
|
+
const observation = onResponse(response);
|
|
522
|
+
if (observation !== undefined)
|
|
523
|
+
queue.push({ method: 'codingns/grok-observation', codingnsGrokObservation: observation });
|
|
386
524
|
const responseReason = grokPromptReason(response);
|
|
387
525
|
if (responseReason !== null)
|
|
388
526
|
terminalReason = mergeGrokReason(terminalReason, responseReason);
|
|
527
|
+
failure ??= grokPermissionFailure(response);
|
|
389
528
|
beginDrain();
|
|
390
529
|
}, () => {
|
|
391
530
|
if (requestController.signal.aborted)
|
|
@@ -436,9 +575,43 @@ function isGrokPromptMessage(message, sessionId, promptId) {
|
|
|
436
575
|
return false;
|
|
437
576
|
const update = isRecord(params.update) ? params.update : params;
|
|
438
577
|
const meta = isRecord(params._meta) ? params._meta : {};
|
|
578
|
+
if (meta.isReplay === true)
|
|
579
|
+
return false;
|
|
439
580
|
const owner = firstToolText(update.prompt_id, update.promptId, meta.promptId);
|
|
440
581
|
return owner === undefined || owner === promptId;
|
|
441
582
|
}
|
|
583
|
+
function grokToolInputChunks(message, inputs) {
|
|
584
|
+
const params = isRecord(message.params) ? message.params : message;
|
|
585
|
+
const update = isRecord(params.update) ? params.update : params;
|
|
586
|
+
if (update.sessionUpdate !== 'tool_call_delta_chunk' || !Number.isInteger(update.tool_index))
|
|
587
|
+
return null;
|
|
588
|
+
const index = update.tool_index;
|
|
589
|
+
const callId = firstToolText(update.tool_call_id, update.toolCallId);
|
|
590
|
+
// Argument fragments omit the call id; a new id resets a reused model-call index.
|
|
591
|
+
let pending = inputs.get(index);
|
|
592
|
+
const started = callId !== undefined && pending?.callId !== callId;
|
|
593
|
+
if (started) {
|
|
594
|
+
pending = { callId, toolName: firstToolText(update.name, update.title) ?? 'tool', arguments: '' };
|
|
595
|
+
inputs.set(index, pending);
|
|
596
|
+
}
|
|
597
|
+
if (pending === undefined)
|
|
598
|
+
return [];
|
|
599
|
+
if (typeof update.arguments_delta === 'string')
|
|
600
|
+
pending.arguments += update.arguments_delta;
|
|
601
|
+
let input;
|
|
602
|
+
try {
|
|
603
|
+
const parsed = JSON.parse(pending.arguments);
|
|
604
|
+
if (isRecord(parsed))
|
|
605
|
+
input = JSON.stringify(parsed);
|
|
606
|
+
}
|
|
607
|
+
catch { /* Do not persist incomplete JSON as a tool's final arguments. */ }
|
|
608
|
+
if (!started && input === undefined)
|
|
609
|
+
return [];
|
|
610
|
+
return [{
|
|
611
|
+
type: 'tool-event', callId: pending.callId, toolName: pending.toolName, status: 'running',
|
|
612
|
+
...(input === undefined ? {} : { input }),
|
|
613
|
+
}];
|
|
614
|
+
}
|
|
442
615
|
function grokPromptReason(value) {
|
|
443
616
|
if (!isRecord(value))
|
|
444
617
|
return null;
|
|
@@ -446,9 +619,15 @@ function grokPromptReason(value) {
|
|
|
446
619
|
if (reason === undefined)
|
|
447
620
|
return null;
|
|
448
621
|
if (reason === 'cancelled' || reason === 'canceled')
|
|
449
|
-
return 'cancel';
|
|
622
|
+
return grokPermissionFailure(value) === undefined ? 'cancel' : 'error';
|
|
450
623
|
return reason === 'error' || reason === 'failed' ? 'error' : 'stop';
|
|
451
624
|
}
|
|
625
|
+
function grokPermissionFailure(value) {
|
|
626
|
+
if (!isRecord(value) || !isRecord(value._meta) || value._meta.cancellationCategory !== 'PermissionRejected')
|
|
627
|
+
return undefined;
|
|
628
|
+
const context = isRecord(value._meta.cancellationContext) ? value._meta.cancellationContext : {};
|
|
629
|
+
return { message: firstToolText(context.reason) ?? 'Grok tool execution was denied.', code: 'PERMISSION_DENIED' };
|
|
630
|
+
}
|
|
452
631
|
function mergeGrokReason(current, next) {
|
|
453
632
|
if (current === 'error' || next === 'error')
|
|
454
633
|
return 'error';
|
|
@@ -466,13 +645,18 @@ function grokNotificationReason(message) {
|
|
|
466
645
|
: '';
|
|
467
646
|
if (['turn_error', 'turn_failed', 'error', 'failed'].includes(type))
|
|
468
647
|
return 'error';
|
|
469
|
-
if (['turn_completed', 'turn_complete', 'prompt_complete', 'completed', 'done'].includes(type))
|
|
470
|
-
|
|
648
|
+
if (['turn_completed', 'turn_complete', 'prompt_complete', 'completed', 'done'].includes(type)) {
|
|
649
|
+
const reason = grokPromptReason(update) ?? 'stop';
|
|
650
|
+
return reason === 'cancel' && grokPermissionFailure(params) !== undefined ? 'error' : reason;
|
|
651
|
+
}
|
|
471
652
|
return null;
|
|
472
653
|
}
|
|
473
654
|
function grokFailure(message) {
|
|
474
655
|
const params = isRecord(message.params) ? message.params : message;
|
|
475
656
|
const update = isRecord(params.update) ? params.update : params;
|
|
657
|
+
const permissionFailure = grokPermissionFailure(update) ?? grokPermissionFailure(params);
|
|
658
|
+
if (permissionFailure !== undefined)
|
|
659
|
+
return permissionFailure;
|
|
476
660
|
const error = isRecord(update.error) ? update.error : update;
|
|
477
661
|
const detail = firstToolText(error.message, error.errorMessage, error.error_message, error.detail, error.reason);
|
|
478
662
|
if (detail === undefined)
|
|
@@ -622,13 +806,19 @@ function acpMessageToChunks(message) {
|
|
|
622
806
|
if (!name && !callId)
|
|
623
807
|
return [];
|
|
624
808
|
const input = serializeToolValue(tool.rawInput ?? tool.input ?? tool.arguments ?? tool.args ?? update.rawInput);
|
|
625
|
-
|
|
809
|
+
// ACP tool results can contain nested text blocks without a rawOutput field.
|
|
810
|
+
const content = tool.content ?? update.content;
|
|
811
|
+
const contentText = Array.isArray(content)
|
|
812
|
+
? content.flatMap((block) => isRecord(block) ? textValue(block.content ?? block) ?? [] : []).join('\n') || undefined
|
|
813
|
+
: undefined;
|
|
814
|
+
const rawOutput = serializeToolValue(tool.rawOutput ?? tool.output ?? tool.result ?? update.rawOutput);
|
|
815
|
+
const output = rawOutput ?? contentText;
|
|
626
816
|
const error = serializeToolValue(tool.error ?? update.error);
|
|
627
817
|
const agentId = firstToolText(tool.agentId, tool.agent_id, update.agentId, update.agent_id);
|
|
628
818
|
const detail = serializeToolValue(tool.detail ?? update.detail ?? update.content);
|
|
629
819
|
const fallback = error !== undefined || type.includes('error') || type.includes('fail')
|
|
630
820
|
? 'failed'
|
|
631
|
-
:
|
|
821
|
+
: rawOutput !== undefined || type.includes('result') || type.includes('complete')
|
|
632
822
|
? 'completed'
|
|
633
823
|
: 'running';
|
|
634
824
|
return [...imageEvents, {
|
|
@@ -675,6 +865,99 @@ function containedPath(root, child) {
|
|
|
675
865
|
const outside = relative(base, candidate);
|
|
676
866
|
return outside === '' || outside === '..' || outside.startsWith(`..${sep}`) || isAbsolute(outside) ? [] : [candidate];
|
|
677
867
|
}
|
|
868
|
+
/** Admit existing file/bridge authority; shells and unknown requests retain native approval. */
|
|
869
|
+
function isAdmittedGrokPermission(message, input, state, tools) {
|
|
870
|
+
if (message.method !== 'session/request_permission' || input.plan === true)
|
|
871
|
+
return false;
|
|
872
|
+
const mode = input.permission?.sandboxMode;
|
|
873
|
+
if (mode !== 'workspace-write' && mode !== 'danger-full-access')
|
|
874
|
+
return false;
|
|
875
|
+
const params = isRecord(message.params) ? message.params : {};
|
|
876
|
+
const tool = isToolRecord(params.toolCall) ? params.toolCall : {};
|
|
877
|
+
const metadata = isRecord(params._meta) ? params._meta : {};
|
|
878
|
+
if (metadata.risk !== undefined || tool.risk !== undefined)
|
|
879
|
+
return false;
|
|
880
|
+
// Never substitute a persistent grant or invent an option absent from the request.
|
|
881
|
+
if (!Array.isArray(params.options) || !params.options.some(option => isRecord(option)
|
|
882
|
+
&& firstToolText(option.kind, option.type)?.toLowerCase() === 'allow_once'
|
|
883
|
+
&& firstToolText(option.optionId, option.option_id, option.id) !== undefined))
|
|
884
|
+
return false;
|
|
885
|
+
const observed = tools.get(permissionCallId(message) ?? '');
|
|
886
|
+
// Titles become human-readable labels such as "Write `/path`". Keep the
|
|
887
|
+
// canonical identity from the matching call, while MCP wrappers name their
|
|
888
|
+
// inner bridge tool in the permission request itself.
|
|
889
|
+
const title = firstToolText(tool.title);
|
|
890
|
+
const bridgeTitle = title === 'codingns__agent_team' || title === 'codingns__agent_subagent' ? title : undefined;
|
|
891
|
+
const name = firstToolText(tool.name, tool.toolName, tool.tool_name) ?? bridgeTitle ?? observed?.name ?? title;
|
|
892
|
+
if (name === 'codingns__agent_team')
|
|
893
|
+
return Boolean(state.teamToken && teamBridgeToken(input.sessionId) === state.teamToken);
|
|
894
|
+
if (name === 'codingns__agent_subagent')
|
|
895
|
+
return Boolean(!state.teamToken && state.bridgeToken && getSubagentBridge()?.token === state.bridgeToken);
|
|
896
|
+
if (name !== 'write' && name !== 'edit')
|
|
897
|
+
return false;
|
|
898
|
+
if (observed && observed.name !== name)
|
|
899
|
+
return false;
|
|
900
|
+
const raw = tool.rawInput ?? observed?.input;
|
|
901
|
+
if (!isRecord(raw))
|
|
902
|
+
return false;
|
|
903
|
+
const paths = ['file_path', 'target_file', 'path'].flatMap(key => raw[key] === undefined ? [] : [raw[key]]);
|
|
904
|
+
if (!paths.length || paths.some(path => typeof path !== 'string' || !path.trim() || path.includes('\0')))
|
|
905
|
+
return false;
|
|
906
|
+
if (!input.cwd || !isAbsolute(input.cwd))
|
|
907
|
+
return false;
|
|
908
|
+
const root = canonicalGrokPath(input.cwd);
|
|
909
|
+
if (!root)
|
|
910
|
+
return false;
|
|
911
|
+
return paths.every(path => {
|
|
912
|
+
// Keep dot segments until realpath resolves existing symlink ancestors.
|
|
913
|
+
const target = canonicalGrokPath(isAbsolute(path) ? path : `${input.cwd}${sep}${path}`);
|
|
914
|
+
if (!target)
|
|
915
|
+
return false;
|
|
916
|
+
const outside = relative(root, target);
|
|
917
|
+
return mode === 'danger-full-access' || outside !== '' && outside !== '..' && !outside.startsWith(`..${sep}`) && !isAbsolute(outside);
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
/** Resolve existing ancestors, rejecting broken links and non-missing filesystem errors. */
|
|
921
|
+
function canonicalGrokPath(path) {
|
|
922
|
+
const suffix = [];
|
|
923
|
+
let current = path;
|
|
924
|
+
for (;;) {
|
|
925
|
+
try {
|
|
926
|
+
lstatSync(current);
|
|
927
|
+
}
|
|
928
|
+
catch (error) {
|
|
929
|
+
if (error.code !== 'ENOENT' || dirname(current) === current)
|
|
930
|
+
return undefined;
|
|
931
|
+
suffix.unshift(basename(current));
|
|
932
|
+
current = dirname(current);
|
|
933
|
+
continue;
|
|
934
|
+
}
|
|
935
|
+
try {
|
|
936
|
+
return resolve(realpathSync.native(current), ...suffix);
|
|
937
|
+
}
|
|
938
|
+
catch {
|
|
939
|
+
return undefined;
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
/** Cache metadata enriches only IDs admitted by the native CLI's filtered list. */
|
|
944
|
+
function readGrokModelMetadata(path) {
|
|
945
|
+
const result = new Map();
|
|
946
|
+
try {
|
|
947
|
+
const value = JSON.parse(readFileSync(path, 'utf8'));
|
|
948
|
+
if (!isRecord(value) || !isRecord(value.models))
|
|
949
|
+
return result;
|
|
950
|
+
for (const entry of Object.values(value.models)) {
|
|
951
|
+
if (!isRecord(entry) || !isRecord(entry.info) || typeof entry.info.id !== 'string')
|
|
952
|
+
continue;
|
|
953
|
+
const info = entry.info;
|
|
954
|
+
const efforts = Array.isArray(info.reasoning_efforts) ? info.reasoning_efforts.flatMap(effort => typeof effort === 'string' ? [effort] : isRecord(effort) && typeof effort.id === 'string' ? [effort.id] : []) : [];
|
|
955
|
+
result.set(info.id, { name: typeof info.name === 'string' ? info.name : info.id, efforts });
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
catch { /* Metadata is optional and never adds selectable model IDs. */ }
|
|
959
|
+
return result;
|
|
960
|
+
}
|
|
678
961
|
function permissionRequestId(message) {
|
|
679
962
|
const params = isRecord(message.params) ? message.params : message;
|
|
680
963
|
const update = isRecord(params.update) ? params.update : params;
|
|
@@ -687,6 +970,12 @@ function permissionRequestId(message) {
|
|
|
687
970
|
function interactionRequestId(message) {
|
|
688
971
|
return permissionRequestId(message);
|
|
689
972
|
}
|
|
973
|
+
function permissionCallId(message) {
|
|
974
|
+
const params = isRecord(message.params) ? message.params : message;
|
|
975
|
+
const update = isRecord(params.update) ? params.update : params;
|
|
976
|
+
const tool = isRecord(update.toolCall) ? update.toolCall : isRecord(update.tool_call) ? update.tool_call : update;
|
|
977
|
+
return firstToolText(tool.toolCallId, tool.tool_call_id, tool.callId, tool.call_id);
|
|
978
|
+
}
|
|
690
979
|
function permissionOptions(message) {
|
|
691
980
|
const params = isRecord(message.params) ? message.params : {};
|
|
692
981
|
const options = Array.isArray(params.options) ? params.options : [];
|
|
@@ -698,9 +987,17 @@ function permissionOptions(message) {
|
|
|
698
987
|
return [];
|
|
699
988
|
return [{ id, kind: firstToolText(option.kind, option.type)?.toLowerCase() ?? '' }];
|
|
700
989
|
});
|
|
990
|
+
if (ids.length === 0)
|
|
991
|
+
return { allowOptionId: 'allow-once', rejectOptionId: 'reject-once' };
|
|
992
|
+
// Grok lists allow_always before allow_once. A DSH one-time approval must
|
|
993
|
+
// never become a persistent grant merely because of provider option order.
|
|
701
994
|
return {
|
|
702
|
-
allowOptionId: ids.find((option) =>
|
|
703
|
-
|
|
995
|
+
allowOptionId: ids.find((option) => option.kind === 'allow_once')?.id
|
|
996
|
+
?? ids.find((option) => /^(allow|approve|accept)$/u.test(option.kind))?.id
|
|
997
|
+
?? (ids[0]?.kind === '' ? ids[0].id : undefined),
|
|
998
|
+
rejectOptionId: ids.find((option) => option.kind === 'reject_once')?.id
|
|
999
|
+
?? ids.find((option) => /^(reject|deny|decline|cancel)$/u.test(option.kind))?.id
|
|
1000
|
+
?? (ids[1]?.kind === '' ? ids[1].id : undefined),
|
|
704
1001
|
};
|
|
705
1002
|
}
|
|
706
1003
|
function readSessionId(value) {
|