@botiverse/oar 0.71.0 → 0.72.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -4
- package/assets/brands/NOTICE.md +12 -2
- package/{LICENSE → assets/brands/QWEN-LICENSE.txt} +3 -2
- package/assets/brands/qoder-on-dark.svg +1 -0
- package/assets/brands/qoder-on-light.svg +1 -0
- package/assets/brands/qoder.svg +1 -0
- package/assets/brands/qwen-on-dark.svg +6 -0
- package/assets/brands/qwen-on-light.svg +6 -0
- package/assets/brands/qwen.svg +6 -0
- package/dist/brands.d.ts +16 -0
- package/dist/brands.d.ts.map +1 -1
- package/dist/brands.js +9 -0
- package/dist/brands.js.map +1 -1
- package/dist/community/morph/console.js +1 -1
- package/dist/community/morph/console.js.map +1 -1
- package/dist/community/morph/session.d.ts.map +1 -1
- package/dist/community/morph/session.js +1 -0
- package/dist/community/morph/session.js.map +1 -1
- package/dist/contracts/deliver.d.ts +27 -5
- package/dist/contracts/deliver.d.ts.map +1 -1
- package/dist/contracts/index.d.ts +3 -2
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js.map +1 -1
- package/dist/contracts/login.d.ts +12 -4
- package/dist/contracts/login.d.ts.map +1 -1
- package/dist/contracts/orientation.d.ts +67 -0
- package/dist/contracts/orientation.d.ts.map +1 -0
- package/dist/contracts/orientation.js +2 -0
- package/dist/contracts/orientation.js.map +1 -0
- package/dist/contracts/provider-auth.d.ts +15 -5
- package/dist/contracts/provider-auth.d.ts.map +1 -1
- package/dist/contracts/records.d.ts +1 -0
- package/dist/contracts/records.d.ts.map +1 -1
- package/dist/contracts/runtime-failure-error.d.ts +6 -2
- package/dist/contracts/runtime-failure-error.d.ts.map +1 -1
- package/dist/contracts/runtime-failure-error.js +6 -2
- package/dist/contracts/runtime-failure-error.js.map +1 -1
- package/dist/contracts/runtime.d.ts +9 -5
- package/dist/contracts/runtime.d.ts.map +1 -1
- package/dist/contracts/runtime.js.map +1 -1
- package/dist/contracts/session-options.d.ts +17 -3
- package/dist/contracts/session-options.d.ts.map +1 -1
- package/dist/contracts/session.d.ts +10 -4
- package/dist/contracts/session.d.ts.map +1 -1
- package/dist/index.d.ts +11 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/dist/observe/conversation.d.ts +2 -0
- package/dist/observe/conversation.d.ts.map +1 -1
- package/dist/observe/conversation.js +56 -5
- package/dist/observe/conversation.js.map +1 -1
- package/dist/observe/index.d.ts +1 -0
- package/dist/observe/index.d.ts.map +1 -1
- package/dist/observe/index.js +1 -0
- package/dist/observe/index.js.map +1 -1
- package/dist/observe/input-carries.d.ts +5 -0
- package/dist/observe/input-carries.d.ts.map +1 -0
- package/dist/observe/input-carries.js +13 -0
- package/dist/observe/input-carries.js.map +1 -0
- package/dist/observe/session-view-inputs.d.ts.map +1 -1
- package/dist/observe/session-view-inputs.js +17 -5
- package/dist/observe/session-view-inputs.js.map +1 -1
- package/dist/observe/usability.d.ts +4 -0
- package/dist/observe/usability.d.ts.map +1 -0
- package/dist/observe/usability.js +102 -0
- package/dist/observe/usability.js.map +1 -0
- package/dist/runtimes/antigravity/options.d.ts.map +1 -1
- package/dist/runtimes/antigravity/options.js +1 -0
- package/dist/runtimes/antigravity/options.js.map +1 -1
- package/dist/runtimes/claude/auth-status.d.ts.map +1 -1
- package/dist/runtimes/claude/auth-status.js +4 -0
- package/dist/runtimes/claude/auth-status.js.map +1 -1
- package/dist/runtimes/claude/launch.d.ts +1 -1
- package/dist/runtimes/claude/launch.d.ts.map +1 -1
- package/dist/runtimes/claude/launch.js +36 -22
- package/dist/runtimes/claude/launch.js.map +1 -1
- package/dist/runtimes/claude/list-models.d.ts.map +1 -1
- package/dist/runtimes/claude/list-models.js +12 -0
- package/dist/runtimes/claude/list-models.js.map +1 -1
- package/dist/runtimes/claude/projection.d.ts +11 -76
- package/dist/runtimes/claude/projection.d.ts.map +1 -1
- package/dist/runtimes/claude/projection.js +36 -148
- package/dist/runtimes/claude/projection.js.map +1 -1
- package/dist/runtimes/claude/prompt-files.d.ts +7 -0
- package/dist/runtimes/claude/prompt-files.d.ts.map +1 -0
- package/dist/runtimes/claude/prompt-files.js +32 -0
- package/dist/runtimes/claude/prompt-files.js.map +1 -0
- package/dist/runtimes/claude/service-tier.d.ts +2 -2
- package/dist/runtimes/claude/service-tier.d.ts.map +1 -1
- package/dist/runtimes/claude/service-tier.js +4 -4
- package/dist/runtimes/claude/service-tier.js.map +1 -1
- package/dist/runtimes/claude/session.d.ts +1 -0
- package/dist/runtimes/claude/session.d.ts.map +1 -1
- package/dist/runtimes/claude/session.js +17 -249
- package/dist/runtimes/claude/session.js.map +1 -1
- package/dist/runtimes/claude/user-configuration.d.ts +9 -0
- package/dist/runtimes/claude/user-configuration.d.ts.map +1 -0
- package/dist/runtimes/claude/user-configuration.js +83 -0
- package/dist/runtimes/claude/user-configuration.js.map +1 -0
- package/dist/runtimes/codex/index.d.ts +3 -2
- package/dist/runtimes/codex/index.d.ts.map +1 -1
- package/dist/runtimes/codex/index.js +2 -0
- package/dist/runtimes/codex/index.js.map +1 -1
- package/dist/runtimes/codex/login.d.ts +3 -2
- package/dist/runtimes/codex/login.d.ts.map +1 -1
- package/dist/runtimes/codex/login.js +13 -3
- package/dist/runtimes/codex/login.js.map +1 -1
- package/dist/runtimes/codex/open.d.ts.map +1 -1
- package/dist/runtimes/codex/open.js +7 -1
- package/dist/runtimes/codex/open.js.map +1 -1
- package/dist/runtimes/codex/options.d.ts +3 -0
- package/dist/runtimes/codex/options.d.ts.map +1 -0
- package/dist/runtimes/codex/options.js +4 -0
- package/dist/runtimes/codex/options.js.map +1 -0
- package/dist/runtimes/cursor/auth-status.d.ts +1 -1
- package/dist/runtimes/cursor/auth-status.d.ts.map +1 -1
- package/dist/runtimes/cursor/auth-status.js +10 -2
- package/dist/runtimes/cursor/auth-status.js.map +1 -1
- package/dist/runtimes/cursor/index.d.ts +1 -0
- package/dist/runtimes/cursor/index.d.ts.map +1 -1
- package/dist/runtimes/cursor/index.js +1 -0
- package/dist/runtimes/cursor/index.js.map +1 -1
- package/dist/runtimes/cursor/model.d.ts.map +1 -1
- package/dist/runtimes/cursor/model.js +6 -1
- package/dist/runtimes/cursor/model.js.map +1 -1
- package/dist/runtimes/cursor/native-environment.d.ts +12 -0
- package/dist/runtimes/cursor/native-environment.d.ts.map +1 -0
- package/dist/runtimes/cursor/native-environment.js +24 -0
- package/dist/runtimes/cursor/native-environment.js.map +1 -0
- package/dist/runtimes/cursor/sdk.d.ts +1 -0
- package/dist/runtimes/cursor/sdk.d.ts.map +1 -1
- package/dist/runtimes/cursor/sdk.js +14 -32
- package/dist/runtimes/cursor/sdk.js.map +1 -1
- package/dist/runtimes/grok/options.d.ts.map +1 -1
- package/dist/runtimes/grok/options.js +1 -0
- package/dist/runtimes/grok/options.js.map +1 -1
- package/dist/runtimes/kimi/options.d.ts.map +1 -1
- package/dist/runtimes/kimi/options.js +1 -0
- package/dist/runtimes/kimi/options.js.map +1 -1
- package/dist/runtimes/opencode/options.d.ts.map +1 -1
- package/dist/runtimes/opencode/options.js +1 -0
- package/dist/runtimes/opencode/options.js.map +1 -1
- package/dist/runtimes/pi/auth.d.ts.map +1 -1
- package/dist/runtimes/pi/auth.js +9 -1
- package/dist/runtimes/pi/auth.js.map +1 -1
- package/dist/runtimes/pi/index.d.ts +12 -20
- package/dist/runtimes/pi/index.d.ts.map +1 -1
- package/dist/runtimes/pi/index.js +33 -15
- package/dist/runtimes/pi/index.js.map +1 -1
- package/dist/runtimes/pi/inventory.d.ts +3 -1
- package/dist/runtimes/pi/inventory.d.ts.map +1 -1
- package/dist/runtimes/pi/inventory.js +14 -5
- package/dist/runtimes/pi/inventory.js.map +1 -1
- package/dist/runtimes/pi/lifecycle.d.ts +2 -2
- package/dist/runtimes/pi/lifecycle.d.ts.map +1 -1
- package/dist/runtimes/pi/lifecycle.js +19 -8
- package/dist/runtimes/pi/lifecycle.js.map +1 -1
- package/dist/runtimes/pi/list-models.d.ts +2 -0
- package/dist/runtimes/pi/list-models.d.ts.map +1 -1
- package/dist/runtimes/pi/list-models.js +6 -2
- package/dist/runtimes/pi/list-models.js.map +1 -1
- package/dist/runtimes/pi/open.d.ts +4 -1
- package/dist/runtimes/pi/open.d.ts.map +1 -1
- package/dist/runtimes/pi/open.js +13 -7
- package/dist/runtimes/pi/open.js.map +1 -1
- package/dist/runtimes/pi/options.d.ts +21 -0
- package/dist/runtimes/pi/options.d.ts.map +1 -0
- package/dist/runtimes/pi/options.js +2 -0
- package/dist/runtimes/pi/options.js.map +1 -0
- package/dist/runtimes/pi/project.d.ts +7 -0
- package/dist/runtimes/pi/project.d.ts.map +1 -0
- package/dist/runtimes/pi/project.js +40 -0
- package/dist/runtimes/pi/project.js.map +1 -0
- package/dist/runtimes/pi/resolve.d.ts.map +1 -1
- package/dist/runtimes/pi/resolve.js +19 -2
- package/dist/runtimes/pi/resolve.js.map +1 -1
- package/dist/runtimes/pi/rpc/control.d.ts +7 -0
- package/dist/runtimes/pi/rpc/control.d.ts.map +1 -0
- package/dist/runtimes/pi/rpc/control.js +53 -0
- package/dist/runtimes/pi/rpc/control.js.map +1 -0
- package/dist/runtimes/pi/rpc/credentials.d.ts +4 -0
- package/dist/runtimes/pi/rpc/credentials.d.ts.map +1 -0
- package/dist/runtimes/pi/rpc/credentials.js +24 -0
- package/dist/runtimes/pi/rpc/credentials.js.map +1 -0
- package/dist/runtimes/pi/rpc/extension.d.ts +6 -0
- package/dist/runtimes/pi/rpc/extension.d.ts.map +1 -0
- package/dist/runtimes/pi/rpc/extension.js +68 -0
- package/dist/runtimes/pi/rpc/extension.js.map +1 -0
- package/dist/runtimes/pi/rpc/launch.d.ts +7 -0
- package/dist/runtimes/pi/rpc/launch.d.ts.map +1 -0
- package/dist/runtimes/pi/rpc/launch.js +26 -0
- package/dist/runtimes/pi/rpc/launch.js.map +1 -0
- package/dist/runtimes/pi/rpc/open.d.ts +19 -0
- package/dist/runtimes/pi/rpc/open.d.ts.map +1 -0
- package/dist/runtimes/pi/rpc/open.js +132 -0
- package/dist/runtimes/pi/rpc/open.js.map +1 -0
- package/dist/runtimes/pi/rpc/prompt-files.d.ts +4 -0
- package/dist/runtimes/pi/rpc/prompt-files.d.ts.map +1 -0
- package/dist/runtimes/pi/rpc/prompt-files.js +27 -0
- package/dist/runtimes/pi/rpc/prompt-files.js.map +1 -0
- package/dist/runtimes/pi/rpc/session.d.ts +5 -0
- package/dist/runtimes/pi/rpc/session.d.ts.map +1 -0
- package/dist/runtimes/pi/rpc/session.js +217 -0
- package/dist/runtimes/pi/rpc/session.js.map +1 -0
- package/dist/runtimes/pi/rpc/version.d.ts +3 -0
- package/dist/runtimes/pi/rpc/version.d.ts.map +1 -0
- package/dist/runtimes/pi/rpc/version.js +23 -0
- package/dist/runtimes/pi/rpc/version.js.map +1 -0
- package/dist/runtimes/pi/session.d.ts +2 -0
- package/dist/runtimes/pi/session.d.ts.map +1 -1
- package/dist/runtimes/pi/session.js +6 -8
- package/dist/runtimes/pi/session.js.map +1 -1
- package/dist/runtimes/pi-durable/options.d.ts.map +1 -1
- package/dist/runtimes/pi-durable/options.js +7 -2
- package/dist/runtimes/pi-durable/options.js.map +1 -1
- package/dist/runtimes/qoder/auth-status.d.ts +6 -0
- package/dist/runtimes/qoder/auth-status.d.ts.map +1 -0
- package/dist/runtimes/qoder/auth-status.js +22 -0
- package/dist/runtimes/qoder/auth-status.js.map +1 -0
- package/dist/runtimes/qoder/control.d.ts +14 -0
- package/dist/runtimes/qoder/control.d.ts.map +1 -0
- package/dist/runtimes/qoder/control.js +79 -0
- package/dist/runtimes/qoder/control.js.map +1 -0
- package/dist/runtimes/qoder/index.d.ts +22 -0
- package/dist/runtimes/qoder/index.d.ts.map +1 -0
- package/dist/runtimes/qoder/index.js +16 -0
- package/dist/runtimes/qoder/index.js.map +1 -0
- package/dist/runtimes/qoder/install.d.ts +6 -0
- package/dist/runtimes/qoder/install.d.ts.map +1 -0
- package/dist/runtimes/qoder/install.js +15 -0
- package/dist/runtimes/qoder/install.js.map +1 -0
- package/dist/runtimes/qoder/installation.d.ts +2 -0
- package/dist/runtimes/qoder/installation.d.ts.map +1 -0
- package/dist/runtimes/qoder/installation.js +5 -0
- package/dist/runtimes/qoder/installation.js.map +1 -0
- package/dist/runtimes/qoder/launch.d.ts +7 -0
- package/dist/runtimes/qoder/launch.d.ts.map +1 -0
- package/dist/runtimes/qoder/launch.js +76 -0
- package/dist/runtimes/qoder/launch.js.map +1 -0
- package/dist/runtimes/qoder/list-models.d.ts +6 -0
- package/dist/runtimes/qoder/list-models.d.ts.map +1 -0
- package/dist/runtimes/qoder/list-models.js +49 -0
- package/dist/runtimes/qoder/list-models.js.map +1 -0
- package/dist/runtimes/qoder/login.d.ts +6 -0
- package/dist/runtimes/qoder/login.d.ts.map +1 -0
- package/dist/runtimes/qoder/login.js +83 -0
- package/dist/runtimes/qoder/login.js.map +1 -0
- package/dist/runtimes/qoder/options.d.ts +4 -0
- package/dist/runtimes/qoder/options.d.ts.map +1 -0
- package/dist/runtimes/qoder/options.js +19 -0
- package/dist/runtimes/qoder/options.js.map +1 -0
- package/dist/runtimes/qoder/projection.d.ts +13 -0
- package/dist/runtimes/qoder/projection.d.ts.map +1 -0
- package/dist/runtimes/qoder/projection.js +42 -0
- package/dist/runtimes/qoder/projection.js.map +1 -0
- package/dist/runtimes/qoder/session.d.ts +3 -0
- package/dist/runtimes/qoder/session.d.ts.map +1 -0
- package/dist/runtimes/qoder/session.js +68 -0
- package/dist/runtimes/qoder/session.js.map +1 -0
- package/dist/runtimes/qwen/close.d.ts +4 -0
- package/dist/runtimes/qwen/close.d.ts.map +1 -0
- package/dist/runtimes/qwen/close.js +12 -0
- package/dist/runtimes/qwen/close.js.map +1 -0
- package/dist/runtimes/qwen/control.d.ts +15 -0
- package/dist/runtimes/qwen/control.d.ts.map +1 -0
- package/dist/runtimes/qwen/control.js +66 -0
- package/dist/runtimes/qwen/control.js.map +1 -0
- package/dist/runtimes/qwen/index.d.ts +20 -0
- package/dist/runtimes/qwen/index.d.ts.map +1 -0
- package/dist/runtimes/qwen/index.js +22 -0
- package/dist/runtimes/qwen/index.js.map +1 -0
- package/dist/runtimes/qwen/install-paths.d.ts +6 -0
- package/dist/runtimes/qwen/install-paths.d.ts.map +1 -0
- package/dist/runtimes/qwen/install-paths.js +13 -0
- package/dist/runtimes/qwen/install-paths.js.map +1 -0
- package/dist/runtimes/qwen/install.d.ts +6 -0
- package/dist/runtimes/qwen/install.d.ts.map +1 -0
- package/dist/runtimes/qwen/install.js +18 -0
- package/dist/runtimes/qwen/install.js.map +1 -0
- package/dist/runtimes/qwen/installation.d.ts +2 -0
- package/dist/runtimes/qwen/installation.d.ts.map +1 -0
- package/dist/runtimes/qwen/installation.js +5 -0
- package/dist/runtimes/qwen/installation.js.map +1 -0
- package/dist/runtimes/qwen/launch.d.ts +5 -0
- package/dist/runtimes/qwen/launch.d.ts.map +1 -0
- package/dist/runtimes/qwen/launch.js +25 -0
- package/dist/runtimes/qwen/launch.js.map +1 -0
- package/dist/runtimes/qwen/list-models.d.ts +6 -0
- package/dist/runtimes/qwen/list-models.d.ts.map +1 -0
- package/dist/runtimes/qwen/list-models.js +46 -0
- package/dist/runtimes/qwen/list-models.js.map +1 -0
- package/dist/runtimes/qwen/options.d.ts +5 -0
- package/dist/runtimes/qwen/options.d.ts.map +1 -0
- package/dist/runtimes/qwen/options.js +27 -0
- package/dist/runtimes/qwen/options.js.map +1 -0
- package/dist/runtimes/qwen/projection.d.ts +14 -0
- package/dist/runtimes/qwen/projection.d.ts.map +1 -0
- package/dist/runtimes/qwen/projection.js +41 -0
- package/dist/runtimes/qwen/projection.js.map +1 -0
- package/dist/runtimes/qwen/session.d.ts +8 -0
- package/dist/runtimes/qwen/session.d.ts.map +1 -0
- package/dist/runtimes/qwen/session.js +73 -0
- package/dist/runtimes/qwen/session.js.map +1 -0
- package/dist/shared/acp/terminal.d.ts.map +1 -1
- package/dist/shared/acp/terminal.js +13 -3
- package/dist/shared/acp/terminal.js.map +1 -1
- package/dist/shared/control-input.d.ts +3 -1
- package/dist/shared/control-input.d.ts.map +1 -1
- package/dist/shared/control-input.js +11 -0
- package/dist/shared/control-input.js.map +1 -1
- package/dist/shared/deliver-interrupt.d.ts +49 -0
- package/dist/shared/deliver-interrupt.d.ts.map +1 -0
- package/dist/shared/deliver-interrupt.js +195 -0
- package/dist/shared/deliver-interrupt.js.map +1 -0
- package/dist/shared/deliver.d.ts.map +1 -1
- package/dist/shared/deliver.js +17 -2
- package/dist/shared/deliver.js.map +1 -1
- package/dist/shared/executable/process-tree.d.ts +1 -1
- package/dist/shared/executable/process-tree.d.ts.map +1 -1
- package/dist/shared/executable/process-tree.js +25 -2
- package/dist/shared/executable/process-tree.js.map +1 -1
- package/dist/shared/executable/process.d.ts +10 -5
- package/dist/shared/executable/process.d.ts.map +1 -1
- package/dist/shared/executable/process.js +25 -12
- package/dist/shared/executable/process.js.map +1 -1
- package/dist/shared/executable/run.d.ts.map +1 -1
- package/dist/shared/executable/run.js +7 -2
- package/dist/shared/executable/run.js.map +1 -1
- package/dist/shared/orientation/budget.d.ts +12 -0
- package/dist/shared/orientation/budget.d.ts.map +1 -0
- package/dist/shared/orientation/budget.js +61 -0
- package/dist/shared/orientation/budget.js.map +1 -0
- package/dist/shared/orientation/customization.d.ts +8 -0
- package/dist/shared/orientation/customization.d.ts.map +1 -0
- package/dist/shared/orientation/customization.js +57 -0
- package/dist/shared/orientation/customization.js.map +1 -0
- package/dist/shared/orientation/index.d.ts +5 -0
- package/dist/shared/orientation/index.d.ts.map +1 -0
- package/dist/shared/orientation/index.js +88 -0
- package/dist/shared/orientation/index.js.map +1 -0
- package/dist/shared/orientation/slots.d.ts +6 -0
- package/dist/shared/orientation/slots.d.ts.map +1 -0
- package/dist/shared/orientation/slots.js +26 -0
- package/dist/shared/orientation/slots.js.map +1 -0
- package/dist/shared/seal-session.d.ts.map +1 -1
- package/dist/shared/seal-session.js.map +1 -1
- package/dist/shared/session-kernel.d.ts.map +1 -1
- package/dist/shared/session-kernel.js +36 -8
- package/dist/shared/session-kernel.js.map +1 -1
- package/dist/shared/session-options.d.ts +1 -1
- package/dist/shared/session-options.d.ts.map +1 -1
- package/dist/shared/session-options.js +5 -2
- package/dist/shared/session-options.js.map +1 -1
- package/dist/{runtimes/claude → shared/stream-json}/content.d.ts +5 -5
- package/dist/shared/stream-json/content.d.ts.map +1 -0
- package/dist/{runtimes/claude → shared/stream-json}/content.js +16 -10
- package/dist/shared/stream-json/content.js.map +1 -0
- package/dist/shared/stream-json/input-lifecycle.d.ts +24 -0
- package/dist/shared/stream-json/input-lifecycle.d.ts.map +1 -0
- package/dist/{runtimes/claude → shared/stream-json}/input-lifecycle.js +15 -11
- package/dist/shared/stream-json/input-lifecycle.js.map +1 -0
- package/dist/shared/stream-json/profile.d.ts +55 -0
- package/dist/shared/stream-json/profile.d.ts.map +1 -0
- package/dist/shared/stream-json/profile.js +2 -0
- package/dist/shared/stream-json/profile.js.map +1 -0
- package/dist/shared/stream-json/projection.d.ts +28 -0
- package/dist/shared/stream-json/projection.d.ts.map +1 -0
- package/dist/shared/stream-json/projection.js +122 -0
- package/dist/shared/stream-json/projection.js.map +1 -0
- package/dist/shared/stream-json/session.d.ts +8 -0
- package/dist/shared/stream-json/session.d.ts.map +1 -0
- package/dist/shared/stream-json/session.js +270 -0
- package/dist/shared/stream-json/session.js.map +1 -0
- package/dist/shared/stream-json/state.d.ts +25 -0
- package/dist/shared/stream-json/state.d.ts.map +1 -0
- package/dist/shared/stream-json/state.js +17 -0
- package/dist/shared/stream-json/state.js.map +1 -0
- package/package.json +1 -1
- package/dist/runtimes/claude/content.d.ts.map +0 -1
- package/dist/runtimes/claude/content.js.map +0 -1
- package/dist/runtimes/claude/input-lifecycle.d.ts +0 -24
- package/dist/runtimes/claude/input-lifecycle.d.ts.map +0 -1
- package/dist/runtimes/claude/input-lifecycle.js.map +0 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { asRecord } from "../../shared/json.js";
|
|
3
|
+
/** Native process startup is part of every query, including model listing. */
|
|
4
|
+
export const QWEN_CONTROL_TIMEOUT_MS = 30_000;
|
|
5
|
+
/** Private setup/readbacks; native account/configuration responses stay outside session records. */
|
|
6
|
+
export function qwenControl(child, timeoutMs = QWEN_CONTROL_TIMEOUT_MS) {
|
|
7
|
+
const pending = new Map();
|
|
8
|
+
const privateIds = new Set();
|
|
9
|
+
let exited = false;
|
|
10
|
+
const exitError = () => {
|
|
11
|
+
const diagnostic = child.diagnostics();
|
|
12
|
+
return new Error(`Qwen exited before answering a control request: ${diagnostic.stderr}`);
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
consume(message) {
|
|
16
|
+
const response = asRecord(message.response);
|
|
17
|
+
const id = message.type === "control_response" && typeof response?.request_id === "string" ? response.request_id : null;
|
|
18
|
+
if (id === null || !privateIds.has(id)) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
pending.get(id)?.(message);
|
|
22
|
+
return true;
|
|
23
|
+
},
|
|
24
|
+
end() {
|
|
25
|
+
exited = true;
|
|
26
|
+
for (const resolve of pending.values()) {
|
|
27
|
+
resolve(exitError());
|
|
28
|
+
}
|
|
29
|
+
pending.clear();
|
|
30
|
+
},
|
|
31
|
+
async request(request) {
|
|
32
|
+
const id = `oar-${randomUUID()}`;
|
|
33
|
+
const { promise, resolve } = Promise.withResolvers();
|
|
34
|
+
const timer = setTimeout(() => { resolve(new Error(`Qwen did not answer ${String(request.subtype)} within ${String(timeoutMs)} ms`)); }, timeoutMs);
|
|
35
|
+
pending.set(id, resolve);
|
|
36
|
+
privateIds.add(id);
|
|
37
|
+
try {
|
|
38
|
+
if (exited) {
|
|
39
|
+
resolve(exitError());
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
child.write(`${JSON.stringify({ type: "control_request", request_id: id, request })}\n`);
|
|
43
|
+
}
|
|
44
|
+
const answer = await promise;
|
|
45
|
+
if (answer instanceof Error) {
|
|
46
|
+
throw answer;
|
|
47
|
+
}
|
|
48
|
+
const response = asRecord(answer.response);
|
|
49
|
+
if (response?.subtype !== "success") {
|
|
50
|
+
throw new Error(`Qwen refused ${String(request.subtype)}: ${JSON.stringify(response?.error ?? "no success response")}`);
|
|
51
|
+
}
|
|
52
|
+
return answer;
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
clearTimeout(timer);
|
|
56
|
+
pending.delete(id);
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/** The actual Qwen permission dialect, verified with a native can_use_tool request. */
|
|
62
|
+
export function qwenPermissionResponse(requestId, request) {
|
|
63
|
+
return { type: "control_response", response: { subtype: "success", request_id: requestId,
|
|
64
|
+
response: { behavior: "allow", ...(request.input === undefined ? {} : { updatedInput: request.input }) } } };
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control.js","sourceRoot":"","sources":["../../../src/runtimes/qwen/control.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAmB,MAAM,sBAAsB,CAAC;AAEjE,8EAA8E;AAC9E,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAQ9C,oGAAoG;AACpG,MAAM,UAAU,WAAW,CAAC,KAAkB,EAAE,SAAS,GAAG,uBAAuB;IACjF,MAAM,OAAO,GAAG,IAAI,GAAG,EAAgD,CAAC;IACxE,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;IACrC,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,MAAM,SAAS,GAAG,GAAU,EAAE;QAC5B,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QACvC,OAAO,IAAI,KA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C,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;AACjH,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const qwenRuntime: {
|
|
2
|
+
readonly id: "qwen";
|
|
3
|
+
readonly brand: {
|
|
4
|
+
readonly name: "Qwen Code";
|
|
5
|
+
readonly icon: `data:image/svg+xml,${string}`;
|
|
6
|
+
readonly icons: {
|
|
7
|
+
readonly light: `data:image/svg+xml,${string}`;
|
|
8
|
+
readonly dark: `data:image/svg+xml,${string}`;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
readonly refusedSessionOptions: Readonly<Partial<Record<import("../../contracts/runtime.js").RefusableSessionOption, string>>>;
|
|
12
|
+
readonly installation: import("../../browser.js").InstallationProbe;
|
|
13
|
+
readonly installPlan: import("../../browser.js").InstallPlanner;
|
|
14
|
+
readonly install: import("../../browser.js").Installer;
|
|
15
|
+
readonly listModels: (installation: import("../../browser.js").AvailableInstallation, options?: import("../../browser.js").ListModelsOptions | undefined) => Promise<import("../../browser.js").ListModelsResult>;
|
|
16
|
+
readonly session: (installation: import("../../browser.js").AvailableInstallation, options: import("../../browser.js").SessionOptions) => Promise<import("../../browser.js").Session>;
|
|
17
|
+
} & import("../../browser.js").RuntimeInventories & {
|
|
18
|
+
readonly brand: import("../../brands.js").RuntimeBrand;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtimes/qwen/index.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;CActB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { runtimeBrands } from "../../brands.js";
|
|
2
|
+
import { defineRuntime } from "../../contracts/runtime.js";
|
|
3
|
+
import { onFirstCall } from "../../shared/lazy.js";
|
|
4
|
+
import { qwenInstallation } from "./installation.js";
|
|
5
|
+
import { qwenInstall, qwenInstallPlan } from "./install.js";
|
|
6
|
+
import { qwenRefusedSessionOptions } from "./options.js";
|
|
7
|
+
export const qwenRuntime = defineRuntime({
|
|
8
|
+
id: "qwen", brand: runtimeBrands.qwen,
|
|
9
|
+
refusedSessionOptions: qwenRefusedSessionOptions,
|
|
10
|
+
installation: qwenInstallation,
|
|
11
|
+
installPlan: qwenInstallPlan,
|
|
12
|
+
install: qwenInstall,
|
|
13
|
+
listModels: onFirstCall(async () => {
|
|
14
|
+
const { qwenListModels } = await import("./list-models.js");
|
|
15
|
+
return qwenListModels;
|
|
16
|
+
}),
|
|
17
|
+
session: onFirstCall(async () => {
|
|
18
|
+
const { qwenSession } = await import("./session.js");
|
|
19
|
+
return qwenSession;
|
|
20
|
+
}),
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtimes/qwen/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC;IACvC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,CAAC,IAAI;IACrC,qBAAqB,EAAE,yBAAyB;IAChD,YAAY,EAAE,gBAAgB;IAC9B,WAAW,EAAE,eAAe;IAC5B,OAAO,EAAE,WAAW;IACpB,UAAU,EAAE,WAAW,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAC5D,OAAO,cAAc,CAAC;IACxB,CAAC,CAAC;IACF,OAAO,EAAE,WAAW,CAAC,KAAK,IAAI,EAAE;QAC9B,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,CAAC;QACrD,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-paths.d.ts","sourceRoot":"","sources":["../../../src/runtimes/qwen/install-paths.ts"],"names":[],"mappings":"AAIA,mGAAmG;AACnG,wBAAgB,gBAAgB,IAAI;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAOrF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { installDir } from "../../shared/install.js";
|
|
4
|
+
/** The standalone installer's location variables also apply to discovery and permission checks. */
|
|
5
|
+
export function qwenInstallPaths() {
|
|
6
|
+
const root = installDir(process.env.QWEN_INSTALL_ROOT, path.join(homedir(), ".local"));
|
|
7
|
+
const parent = installDir(process.env.QWEN_INSTALL_LIB_PARENT, path.join(root, "lib"));
|
|
8
|
+
return {
|
|
9
|
+
bin: installDir(process.env.QWEN_INSTALL_BIN_DIR, path.join(root, "bin")),
|
|
10
|
+
library: installDir(process.env.QWEN_INSTALL_LIB_DIR, path.join(parent, "qwen-code")),
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=install-paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-paths.js","sourceRoot":"","sources":["../../../src/runtimes/qwen/install-paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,mGAAmG;AACnG,MAAM,UAAU,gBAAgB;IAC9B,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;IACvF,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;IACvF,OAAO;QACL,GAAG,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACzE,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;KACtF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ScriptInstallMethod } from "../../shared/install.js";
|
|
2
|
+
/** Require the standalone archive and preserve shell profiles; the vendor verifies the archive's checksum. */
|
|
3
|
+
export declare const qwenInstallMethod: ScriptInstallMethod;
|
|
4
|
+
export declare const qwenInstallPlan: import("../../browser.js").InstallPlanner;
|
|
5
|
+
export declare const qwenInstall: import("../../browser.js").Installer;
|
|
6
|
+
//# sourceMappingURL=install.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/runtimes/qwen/install.ts"],"names":[],"mappings":"AACA,OAAO,EAAoC,KAAK,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAIrG,8GAA8G;AAC9G,eAAO,MAAM,iBAAiB,EAAE,mBAS/B,CAAC;AAEF,eAAO,MAAM,eAAe,2CAAuC,CAAC;AACpE,eAAO,MAAM,WAAW,sCAAmD,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { planInstaller, scriptInstallPlan } from "../../shared/install.js";
|
|
3
|
+
import { qwenInstallation } from "./installation.js";
|
|
4
|
+
import { qwenInstallPaths } from "./install-paths.js";
|
|
5
|
+
/** Require the standalone archive and preserve shell profiles; the vendor verifies the archive's checksum. */
|
|
6
|
+
export const qwenInstallMethod = {
|
|
7
|
+
source: "https://qwenlm.github.io/qwen-code-docs/en/users/quickstart/",
|
|
8
|
+
line: "curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen-standalone.sh | bash -s -- --method standalone --no-modify-path",
|
|
9
|
+
tools: ["curl", "bash"],
|
|
10
|
+
writes: () => {
|
|
11
|
+
const paths = qwenInstallPaths();
|
|
12
|
+
return [paths.bin, path.dirname(paths.library)];
|
|
13
|
+
},
|
|
14
|
+
windows: "Follow the official PowerShell installer at https://qwenlm.github.io/qwen-code-docs/en/users/quickstart/",
|
|
15
|
+
};
|
|
16
|
+
export const qwenInstallPlan = scriptInstallPlan(qwenInstallMethod);
|
|
17
|
+
export const qwenInstall = planInstaller(qwenInstallation, qwenInstallPlan);
|
|
18
|
+
//# sourceMappingURL=install.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../../src/runtimes/qwen/install.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAA4B,MAAM,yBAAyB,CAAC;AACrG,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,8GAA8G;AAC9G,MAAM,CAAC,MAAM,iBAAiB,GAAwB;IACpD,MAAM,EAAE,8DAA8D;IACtE,IAAI,EAAE,4JAA4J;IAClK,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,GAAG,EAAE;QACX,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,EAAE,0GAA0G;CACpH,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;AACpE,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installation.d.ts","sourceRoot":"","sources":["../../../src/runtimes/qwen/installation.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,8CAC2D,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { executableInstallation } from "../../shared/installation.js";
|
|
3
|
+
import { qwenInstallPaths } from "./install-paths.js";
|
|
4
|
+
export const qwenInstallation = executableInstallation("OAR_QWEN_BIN", "qwen", () => process.platform === "win32" ? [] : [path.join(qwenInstallPaths().bin, "qwen")]);
|
|
5
|
+
//# sourceMappingURL=installation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installation.js","sourceRoot":"","sources":["../../../src/runtimes/qwen/installation.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAAsB,CAAC,cAAc,EAAE,MAAM,EAC3E,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SessionOptions } from "../../contracts/session.js";
|
|
2
|
+
import { type LineProcess } from "../../shared/executable/index.js";
|
|
3
|
+
/** Qwen 0.26.0's own SDK channel; credentials and MCP configuration never enter argv. */
|
|
4
|
+
export declare function launchQwen(command: string, sessionId: string, options: SessionOptions): Promise<LineProcess>;
|
|
5
|
+
//# sourceMappingURL=launch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launch.d.ts","sourceRoot":"","sources":["../../../src/runtimes/qwen/launch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGjE,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAItF,yFAAyF;AACzF,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,CAiBlH"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { resolvedAdditionalDirectories } from "../../shared/additional-directories.js";
|
|
2
|
+
import { sessionEnvironment } from "../../shared/environment.js";
|
|
3
|
+
import { spawnLineProcess } from "../../shared/executable/index.js";
|
|
4
|
+
import { refuseSessionOptions } from "../../shared/session-options.js";
|
|
5
|
+
import { checkQwenLaunchArgs, qwenRefusedSessionOptions } from "./options.js";
|
|
6
|
+
/** Qwen 0.26.0's own SDK channel; credentials and MCP configuration never enter argv. */
|
|
7
|
+
export async function launchQwen(command, sessionId, options) {
|
|
8
|
+
refuseSessionOptions(qwenRefusedSessionOptions, options);
|
|
9
|
+
checkQwenLaunchArgs(options.launchArgs);
|
|
10
|
+
const directories = resolvedAdditionalDirectories(options);
|
|
11
|
+
const child = spawnLineProcess(command, [
|
|
12
|
+
"--input-format", "stream-json", "--output-format", "stream-json", "--channel=SDK",
|
|
13
|
+
"--include-partial-messages", "--approval-mode", "yolo",
|
|
14
|
+
...(options.resume === undefined ? ["--session-id", sessionId] : ["--resume", sessionId]),
|
|
15
|
+
...(options.model === undefined ? [] : ["--model", options.model]),
|
|
16
|
+
...(options.systemPrompt === undefined ? [] : ["--system-prompt", options.systemPrompt]),
|
|
17
|
+
...(options.appendSystemPrompt === undefined ? [] : ["--append-system-prompt", options.appendSystemPrompt]),
|
|
18
|
+
...options.launchArgs ?? [],
|
|
19
|
+
...(directories.length === 0 ? [] : ["--include-directories", ...directories]),
|
|
20
|
+
...((options.disallowedTools?.length ?? 0) === 0 ? [] : ["--exclude-tools", ...options.disallowedTools ?? []]),
|
|
21
|
+
], { cwd: options.cwd, env: sessionEnvironment(options.env), killTree: true });
|
|
22
|
+
await child.spawned;
|
|
23
|
+
return child;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=launch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launch.js","sourceRoot":"","sources":["../../../src/runtimes/qwen/launch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAoB,MAAM,kCAAkC,CAAC;AACtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAE9E,yFAAyF;AACzF,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAAe,EAAE,SAAiB,EAAE,OAA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AAO,CAAC,eAAe,IAAI,EAAE,CAAC,CAAC;KAC/G,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,kBAAkB,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/E,MAAM,KAAK,CAAC,OAAO,CAAC;IACpB,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ModelEntry, ModelLister } from "../../contracts/list-models.js";
|
|
2
|
+
export declare function projectQwenModels(payload: unknown): ModelEntry[];
|
|
3
|
+
/** Native catalog query; the environment parameter also lets the native harness isolate HOME. */
|
|
4
|
+
export declare function readQwenModels(command: string, cwd: string, timeoutMs?: number, env?: Readonly<Record<string, string>>): Promise<ModelEntry[]>;
|
|
5
|
+
export declare const qwenListModels: ModelLister;
|
|
6
|
+
//# sourceMappingURL=list-models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-models.d.ts","sourceRoot":"","sources":["../../../src/runtimes/qwen/list-models.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAQ9E,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,EAAE,CAWhE;AAED,iGAAiG;AACjG,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,SAA0B,EAAE,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAUrK;AAED,eAAO,MAAM,cAAc,EAAE,WAG5B,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { effortLevelsOf } from "../../shared/effort-levels.js";
|
|
3
|
+
import { asRecord, asRecordList, parseJson } from "../../shared/json.js";
|
|
4
|
+
import { listingCwd } from "../../shared/listing-cwd.js";
|
|
5
|
+
import { closeQwen } from "./close.js";
|
|
6
|
+
import { launchQwen } from "./launch.js";
|
|
7
|
+
import { qwenControl, QWEN_CONTROL_TIMEOUT_MS } from "./control.js";
|
|
8
|
+
export function projectQwenModels(payload) {
|
|
9
|
+
return asRecordList(asRecord(payload)?.models).flatMap((model) => {
|
|
10
|
+
if (typeof model.id !== "string" || model.id.length === 0) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
const reasoning = asRecord(asRecord(model.capabilities)?.reasoning);
|
|
14
|
+
const effortLevels = effortLevelsOf(reasoning?.efforts);
|
|
15
|
+
return [{ id: model.id,
|
|
16
|
+
...(typeof model.label === "string" ? { displayName: model.label } : {}),
|
|
17
|
+
...(effortLevels === undefined ? {} : { effortLevels }),
|
|
18
|
+
...(typeof reasoning?.defaultEffort === "string" ? { defaultEffort: reasoning.defaultEffort } : {}),
|
|
19
|
+
}];
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
/** Native catalog query; the environment parameter also lets the native harness isolate HOME. */
|
|
23
|
+
export async function readQwenModels(command, cwd, timeoutMs = QWEN_CONTROL_TIMEOUT_MS, env) {
|
|
24
|
+
const child = await launchQwen(command, randomUUID(), { cwd, ...(env === undefined ? {} : { env }) });
|
|
25
|
+
const control = qwenControl(child, timeoutMs);
|
|
26
|
+
child.onLine((line) => { const value = asRecord(parseJson(line)); if (value !== null) {
|
|
27
|
+
control.consume(value);
|
|
28
|
+
} });
|
|
29
|
+
child.onExit(() => { control.end(); });
|
|
30
|
+
try {
|
|
31
|
+
await control.request({ subtype: "initialize" });
|
|
32
|
+
const answer = await control.request({ subtype: "get_available_models" });
|
|
33
|
+
return projectQwenModels(asRecord(answer.response)?.response);
|
|
34
|
+
}
|
|
35
|
+
finally {
|
|
36
|
+
control.end();
|
|
37
|
+
await closeQwen(child);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export const qwenListModels = async (installation, options = {}) => {
|
|
41
|
+
if (installation.via !== "executable") {
|
|
42
|
+
return { kind: "unsupported", reason: "Qwen model listing requires its executable" };
|
|
43
|
+
}
|
|
44
|
+
return { kind: "ok", models: await readQwenModels(installation.command, listingCwd(options), options.timeoutMs) };
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=list-models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-models.js","sourceRoot":"","sources":["../../../src/runtimes/qwen/list-models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEpE,MAAM,UAAU,iBAAiB,CAAC,OAAgB;IAChD,OAAO,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QAC/D,IAAI,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ,IAAI,KAAK,CAAC,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAAC,OAAO,EAAE,CAAC;QAAC,CAAC;QACzE,MAAM,SAAS,GAAG,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,SAAS,CAAC,CAAC;QACpE,MAAM,YAAY,GAAG,cAAc,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACxD,OAAO,CA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ACvC,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;QACjD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,sBAAsB,EAAE,CAAC,CAAC;QAC1E,OAAO,iBAAiB,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC;IAChE,CAAC;YAAS,CAAC;QAAC,OAAO,CAAC,GAAG,EAAE,CAAC;QAAC,MAAM,SAAS,CAAC,KAAK,CAAC,CAAC;IAAC,CAAC;AACtD,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAgB,KAAK,EAAE,YAAY,EAAE,OAAO,GAAG,EAAE,EAAE,EAAE;IAC9E,IAAI,YAAY,CAAC,GAAG,KAAK,YAAY,EAAE,CAAC;QAAC,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,4CAA4C,EAAE,CAAC;IAAC,CAAC;IAChI,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC,YAAY,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;AACpH,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { RefusedSessionOptions } from "../../contracts/runtime.js";
|
|
2
|
+
export declare const qwenRefusedSessionOptions: RefusedSessionOptions;
|
|
3
|
+
/** A second protocol, identity, or approval selector would invalidate the session OAR opens. */
|
|
4
|
+
export declare function checkQwenLaunchArgs(args: readonly string[] | undefined): void;
|
|
5
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/runtimes/qwen/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAGxE,eAAO,MAAM,yBAAyB,EAAE,qBAKvC,CAAC;AAEF,gGAAgG;AAChG,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GAAG,IAAI,CAiB7E"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { UnsupportedOptionError } from "../../contracts/errors.js";
|
|
2
|
+
export const qwenRefusedSessionOptions = {
|
|
3
|
+
userConfiguration: "qwen has no verified separation of user configuration from its native login",
|
|
4
|
+
serviceTier: "Qwen's stream-json interface does not expose a service-tier setting",
|
|
5
|
+
outputSchema: "Qwen rejects --json-schema with its long-lived stream-json input protocol",
|
|
6
|
+
name: "Qwen's stream-json interface does not expose a session-name readback",
|
|
7
|
+
};
|
|
8
|
+
/** A second protocol, identity, or approval selector would invalidate the session OAR opens. */
|
|
9
|
+
export function checkQwenLaunchArgs(args) {
|
|
10
|
+
const managed = new Set([
|
|
11
|
+
"--input-format", "--output-format", "--channel", "--approval-mode", "--yolo", "-y",
|
|
12
|
+
"--session-id", "--resume", "-r", "--continue", "-c", "--fork-session", "--acp",
|
|
13
|
+
"--prompt", "-p", "--json-schema", "-o", "--prompt-interactive", "-i",
|
|
14
|
+
"--experimental-acp", "--json-fd", "--json-file", "--input-file",
|
|
15
|
+
"--sandbox-session-id", "--list-extensions", "-l", "--",
|
|
16
|
+
]);
|
|
17
|
+
for (const arg of args ?? []) {
|
|
18
|
+
const name = arg.split("=", 1)[0] ?? arg;
|
|
19
|
+
const flag = name.startsWith("--")
|
|
20
|
+
? name.replaceAll(/[A-Z]/gu, (letter) => `-${letter.toLowerCase()}`)
|
|
21
|
+
: name.slice(0, 2);
|
|
22
|
+
if (managed.has(flag)) {
|
|
23
|
+
throw new UnsupportedOptionError("launchArgs", `Qwen launchArgs cannot override ${flag}; OAR owns the stream-json protocol, session identity, approval mode and output schema`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
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QACrB,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,sBAAsB,CAAC,YAAY,EAAE,mCAAmC,IAAI,wFAAwF,CAAC,CAAC;QAClL,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TokenTotals } from "../../contracts/session.js";
|
|
2
|
+
import { type JsonRecord } from "../../shared/json.js";
|
|
3
|
+
import { type StreamJsonProjectionState } from "../../shared/stream-json/state.js";
|
|
4
|
+
import type { StreamJsonProjectionProfile } from "../../shared/stream-json/profile.js";
|
|
5
|
+
export interface QwenProjection extends StreamJsonProjectionState {
|
|
6
|
+
/** A new process can restore historical totals; no session-scoped baseline query exists in 0.26.0. */
|
|
7
|
+
readonly usageKnown: boolean;
|
|
8
|
+
readonly usage: TokenTotals;
|
|
9
|
+
}
|
|
10
|
+
export declare function initialQwenProjection(resume?: boolean): QwenProjection;
|
|
11
|
+
/** Qwen result.usage is cumulative across the native conversation, cache reads already included. */
|
|
12
|
+
export declare function qwenUsage(message: JsonRecord): TokenTotals | null;
|
|
13
|
+
export declare const qwenProjectionProfile: StreamJsonProjectionProfile<QwenProjection>;
|
|
14
|
+
//# sourceMappingURL=projection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../../../src/runtimes/qwen/projection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,WAAW,EAAe,MAAM,4BAA4B,CAAC;AAC7F,OAAO,EAAsB,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAA+B,KAAK,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAChH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAGvF,MAAM,WAAW,cAAe,SAAQ,yBAAyB;IAC/D,sGAAsG;IACtG,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AACD,wBAAgB,qBAAqB,CAAC,MAAM,UAAQ,GAAG,cAAc,CAEpE;AAED,oGAAoG;AACpG,wBAAgB,SAAS,CAAC,OAAO,EAAE,UAAU,GAAG,WAAW,GAAG,IAAI,CAKjE;AAYD,eAAO,MAAM,qBAAqB,EAAE,2BAA2B,CAAC,cAAc,CAY7E,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { asNumber, asRecord } from "../../shared/json.js";
|
|
2
|
+
import { initialStreamJsonProjection } from "../../shared/stream-json/state.js";
|
|
3
|
+
import { cacheParts, noTokens } from "../../shared/token-totals.js";
|
|
4
|
+
export function initialQwenProjection(resume = false) {
|
|
5
|
+
return { ...initialStreamJsonProjection, usageKnown: !resume, usage: noTokens };
|
|
6
|
+
}
|
|
7
|
+
/** Qwen result.usage is cumulative across the native conversation, cache reads already included. */
|
|
8
|
+
export function qwenUsage(message) {
|
|
9
|
+
const usage = asRecord(message.usage);
|
|
10
|
+
const input = asNumber(usage?.input_tokens);
|
|
11
|
+
const output = asNumber(usage?.output_tokens);
|
|
12
|
+
if (usage === null || input === null || output === null) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return { input, output, ...cacheParts(usage, { read: "cache_read_input_tokens", write: "cache_creation_input_tokens" }) };
|
|
16
|
+
}
|
|
17
|
+
function outcome(state, message) {
|
|
18
|
+
if (state.abortRequested) {
|
|
19
|
+
return { kind: "aborted" };
|
|
20
|
+
}
|
|
21
|
+
if (message.is_error !== true) {
|
|
22
|
+
return { kind: "completed", ...("structured_result" in message ? { structuredOutput: message.structured_result } : {}) };
|
|
23
|
+
}
|
|
24
|
+
const error = asRecord(message.error);
|
|
25
|
+
return { kind: "failed", failure: message.subtype === "error_max_turns" ? "limit_reached" : "unknown",
|
|
26
|
+
reason: typeof error?.message === "string" ? error.message : `Qwen result: ${String(message.subtype)}` };
|
|
27
|
+
}
|
|
28
|
+
export const qwenProjectionProfile = {
|
|
29
|
+
name: "qwen", duplicateReason: "Qwen refused the input", commandLifecycle: false,
|
|
30
|
+
assistant: (state) => state,
|
|
31
|
+
result: (state, message, agentPath) => {
|
|
32
|
+
const usage = agentPath.length === 0 && state.usageKnown ? qwenUsage(message) : null;
|
|
33
|
+
const before = usage === null ? [] : [{ kind: "usage", usage: { total: usage } }];
|
|
34
|
+
return { state: usage === null ? state : { ...state, usage }, outcome: outcome(state, message), before, after: [] };
|
|
35
|
+
},
|
|
36
|
+
init: () => [],
|
|
37
|
+
compacted: (state) => state,
|
|
38
|
+
system: (state) => ({ state, events: [] }),
|
|
39
|
+
other: (state) => ({ state, events: [] }),
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=projection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection.js","sourceRoot":"","sources":["../../../src/runtimes/qwen/projection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAmB,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,2BAA2B,EAAkC,MAAM,mCAAmC,CAAC;AAEhH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAOpE,MAAM,UAAU,qBAAqB,CAAC,MAAM,GAAG,KAAK;IAClD,OAAO,EAAE,GAAG,2BAA2B,EAAE,UAAU,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAClF,CAAC;AAED,oGAAoG;AACpG,MAAM,UAAU,SAAS,CAAC,OAAmB;IAC3C,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACtC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IAAC,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IAC3F,IAAI,KAAK,KAAK,IAAI,I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AAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE;QACpC,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACrF,MAAM,MAAM,GAAuB,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QACtG,OAAO,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IACtH,CAAC;IACD,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE;IACd,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;IAC3B,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IAC1C,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;CAC1C,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { McpServer, RuntimeEventBody, StartSession } from "../../contracts/session.js";
|
|
2
|
+
import { type JsonRecord } from "../../shared/json.js";
|
|
3
|
+
/** Qwen's initialize is the in-memory SDK configuration channel, not its persistent mcp add command. */
|
|
4
|
+
export declare function qwenMcpConfig(servers: readonly McpServer[]): JsonRecord;
|
|
5
|
+
/** Only report the level the runtime says it applied; absent does not become a requested-value echo. */
|
|
6
|
+
export declare function qwenEffort(answer: JsonRecord, requested?: string): readonly RuntimeEventBody[];
|
|
7
|
+
export declare const qwenSession: StartSession;
|
|
8
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/runtimes/qwen/session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG5F,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAOjE,wGAAwG;AACxG,wBAAgB,aAAa,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,GAAG,UAAU,CAKvE;AAED,wGAAwG;AACxG,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,gBAAgB,EAAE,CAO9F;AAED,eAAO,MAAM,WAAW,EAAE,YA8BxB,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { withSessionCredentials } from "../../shared/session-credentials.js";
|
|
3
|
+
import { checkMcpServerNames, isHttpMcpServer } from "../../shared/mcp-servers.js";
|
|
4
|
+
import { asRecord } from "../../shared/json.js";
|
|
5
|
+
import { streamJsonSession } from "../../shared/stream-json/session.js";
|
|
6
|
+
import { closeQwen } from "./close.js";
|
|
7
|
+
import { launchQwen } from "./launch.js";
|
|
8
|
+
import { qwenControl, qwenPermissionResponse } from "./control.js";
|
|
9
|
+
import { initialQwenProjection, qwenProjectionProfile } from "./projection.js";
|
|
10
|
+
/** Qwen's initialize is the in-memory SDK configuration channel, not its persistent mcp add command. */
|
|
11
|
+
export function qwenMcpConfig(servers) {
|
|
12
|
+
checkMcpServerNames(servers);
|
|
13
|
+
return Object.fromEntries(servers.map((server) => [server.name, isHttpMcpServer(server)
|
|
14
|
+
? { httpUrl: server.url, ...(server.headers === undefined ? {} : { headers: server.headers }) }
|
|
15
|
+
: { command: server.command, args: server.args ?? [], ...(server.env === undefined ? {} : { env: server.env }) }]));
|
|
16
|
+
}
|
|
17
|
+
/** Only report the level the runtime says it applied; absent does not become a requested-value echo. */
|
|
18
|
+
export function qwenEffort(answer, requested) {
|
|
19
|
+
const response = asRecord(asRecord(answer.response)?.response);
|
|
20
|
+
const status = asRecord(response?.effort_status);
|
|
21
|
+
if (requested !== undefined && (status?.effort !== requested || status.applied !== true || status.override !== null)) {
|
|
22
|
+
throw new Error(`Qwen could not apply effort ${JSON.stringify(requested)}: ${JSON.stringify(status)}`);
|
|
23
|
+
}
|
|
24
|
+
return status?.applied === true && status.override === null && typeof status.effort === "string" ? [{ kind: "effort", effort: status.effort }] : [];
|
|
25
|
+
}
|
|
26
|
+
export const qwenSession = withSessionCredentials(async (installation, options, credentials) => {
|
|
27
|
+
if (installation.via !== "executable") {
|
|
28
|
+
throw new Error("The Qwen session adapter needs an executable installation");
|
|
29
|
+
}
|
|
30
|
+
const sessionId = options.resume ?? randomUUID();
|
|
31
|
+
const mcpServers = qwenMcpConfig(options.mcpServers ?? []);
|
|
32
|
+
const child = await launchQwen(installation.command, sessionId, options);
|
|
33
|
+
const control = qwenControl(child);
|
|
34
|
+
try {
|
|
35
|
+
return await streamJsonSession(child, sessionId, credentials, {
|
|
36
|
+
projection: qwenProjectionProfile, initial: initialQwenProjection(options.resume !== undefined),
|
|
37
|
+
capabilities: { queue: { durable: false }, attribution: "attributed", images: false },
|
|
38
|
+
steer: false,
|
|
39
|
+
userMessage: (text, inputId) => `${JSON.stringify({ type: "user", uuid: inputId ?? randomUUID(), session_id: sessionId, parent_tool_use_id: null,
|
|
40
|
+
message: { role: "user", content: [{ type: "text", text }] } })}\n`,
|
|
41
|
+
consume: (message) => control.consume(message),
|
|
42
|
+
open: async (projection) => {
|
|
43
|
+
// FIRST stdin frame must be initialize; a user frame first disables the control dispatcher.
|
|
44
|
+
const answer = await control.request({ subtype: "initialize", mcpServers, ...(options.effort === undefined ? {} : { effort: options.effort }) }).catch((error) => {
|
|
45
|
+
if (options.effort !== undefined) {
|
|
46
|
+
throw new Error(`Qwen could not confirm effort ${JSON.stringify(options.effort)}: ${String(error)}`, { cause: error });
|
|
47
|
+
}
|
|
48
|
+
throw error;
|
|
49
|
+
});
|
|
50
|
+
const native = asRecord(asRecord(answer.response)?.response);
|
|
51
|
+
if (native?.session_id !== sessionId) {
|
|
52
|
+
throw new Error(`Qwen initialized a different session: ${String(native?.session_id)}`);
|
|
53
|
+
}
|
|
54
|
+
const events = qwenEffort(answer, options.effort);
|
|
55
|
+
projection.report({ type: "control_response", native: answer, events });
|
|
56
|
+
},
|
|
57
|
+
exited: () => { control.end(); }, disposing: () => { control.end(); },
|
|
58
|
+
permissionResponse: qwenPermissionResponse,
|
|
59
|
+
close: async (active) => { if (active) {
|
|
60
|
+
child.kill();
|
|
61
|
+
await child.exited;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
await closeQwen(child);
|
|
65
|
+
} },
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
await closeQwen(child);
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/runtimes/qwen/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnF,OAAO,EAAE,QAAQ,EAAmB,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,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M,EAAE,mBAAmB,GAAG,oBAAoB,CAAC;IACxD,OAAO,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAC1E,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;CACjC;AAsED,0EAA0E;AAC1E,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,MAAM,CAAC,UAAU,EAC9B,OAAO,GAAE,sBAA2B,GACnC,eAAe,CAgIjB"}
|
|
@@ -4,7 +4,7 @@ import { randomUUID } from "node:crypto";
|
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { StringDecoder } from "node:string_decoder";
|
|
6
6
|
import spawn from "cross-spawn";
|
|
7
|
-
import { OWN_PROCESS_GROUP, signalProcessGroup, trackOwnedProcess } from "../executable/index.js";
|
|
7
|
+
import { killProcessTree, OWN_PROCESS_GROUP, signalProcessGroup, trackOwnedProcess } from "../executable/index.js";
|
|
8
8
|
const DEFAULT_OUTPUT_LIMIT = 4 * 1024 * 1024;
|
|
9
9
|
const MAX_OUTPUT_LIMIT = 16 * 1024 * 1024;
|
|
10
10
|
function invalid(message) {
|
|
@@ -59,7 +59,12 @@ async function stopTerminal(state) {
|
|
|
59
59
|
// a process it started (a shell's children). Killing the group reaches
|
|
60
60
|
// them all, so the pipes close and the wait below ends.
|
|
61
61
|
if (state.exitStatus === null) {
|
|
62
|
-
|
|
62
|
+
if (process.platform === "win32") {
|
|
63
|
+
killProcessTree(state.child);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
signalProcessGroup(state.child, "SIGKILL");
|
|
67
|
+
}
|
|
63
68
|
}
|
|
64
69
|
await state.exited;
|
|
65
70
|
}
|
|
@@ -153,7 +158,12 @@ export function createAcpTerminalHost(cwd, environment, options = {}) {
|
|
|
153
158
|
const kill = (params) => {
|
|
154
159
|
const state = terminalFor(terminals, params);
|
|
155
160
|
if (state.exitStatus === null) {
|
|
156
|
-
|
|
161
|
+
if (process.platform === "win32") {
|
|
162
|
+
killProcessTree(state.child);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
signalProcessGroup(state.child, "SIGTERM");
|
|
166
|
+
}
|
|
157
167
|
}
|
|
158
168
|
return {};
|
|
159
169
|
};
|