node v2 cli support (#36309)
This commit is contained in:
parent
27e1692848
commit
a1b274e6f8
75 changed files with 1502 additions and 367 deletions
3
packages/cli/src/node/index.ts
Normal file
3
packages/cli/src/node/index.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import "./plugin-runtime.promise"
|
||||
import "./plugin-runtime.effect"
|
||||
import "../index"
|
||||
28
packages/cli/src/node/plugin-runtime.effect.ts
Normal file
28
packages/cli/src/node/plugin-runtime.effect.ts
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import {
|
||||
Agent,
|
||||
Command,
|
||||
Connection,
|
||||
Credential,
|
||||
Integration,
|
||||
Model,
|
||||
Plugin,
|
||||
Provider,
|
||||
Reference,
|
||||
Skill,
|
||||
} from "@opencode-ai/plugin/v2/effect"
|
||||
import { Tool } from "@opencode-ai/plugin/v2/effect/tool"
|
||||
|
||||
const key = Symbol.for("opencode.plugin.v2.effect")
|
||||
;(globalThis as typeof globalThis & { [key]?: unknown })[key] = {
|
||||
Agent,
|
||||
Command,
|
||||
Connection,
|
||||
Credential,
|
||||
Integration,
|
||||
Model,
|
||||
Plugin,
|
||||
Provider,
|
||||
Reference,
|
||||
Skill,
|
||||
Tool,
|
||||
}
|
||||
26
packages/cli/src/node/plugin-runtime.promise.ts
Normal file
26
packages/cli/src/node/plugin-runtime.promise.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import {
|
||||
Agent,
|
||||
Command,
|
||||
Connection,
|
||||
Credential,
|
||||
Integration,
|
||||
Model,
|
||||
Plugin,
|
||||
Provider,
|
||||
Reference,
|
||||
Skill,
|
||||
} from "@opencode-ai/plugin/v2"
|
||||
|
||||
const key = Symbol.for("opencode.plugin.v2.promise")
|
||||
;(globalThis as typeof globalThis & { [key]?: unknown })[key] = {
|
||||
Agent,
|
||||
Command,
|
||||
Connection,
|
||||
Credential,
|
||||
Integration,
|
||||
Model,
|
||||
Plugin,
|
||||
Provider,
|
||||
Reference,
|
||||
Skill,
|
||||
}
|
||||
34
packages/cli/src/node/target.ts
Normal file
34
packages/cli/src/node/target.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
const platforms = ["darwin", "linux", "win32"] as const
|
||||
|
||||
export type NodeTarget = ReturnType<typeof nodeTarget>
|
||||
|
||||
export function nodeTarget(platform: string, arch: string) {
|
||||
if (!platforms.includes(platform as (typeof platforms)[number]) || (arch !== "arm64" && arch !== "x64")) {
|
||||
throw new Error(`Unsupported Node executable target: ${platform}-${arch}`)
|
||||
}
|
||||
|
||||
const targetPlatform = platform as (typeof platforms)[number]
|
||||
const targetArch = arch as "arm64" | "x64"
|
||||
const nodePtyPackage = `@lydell/node-pty-${targetPlatform}-${targetArch}`
|
||||
const parcelWatcherPackage = `@parcel/watcher-${targetPlatform}-${targetArch}${targetPlatform === "linux" ? "-glibc" : ""}`
|
||||
|
||||
return {
|
||||
platform: targetPlatform,
|
||||
arch: targetArch,
|
||||
nodePtyPackage,
|
||||
nodePtyEntryAsset: `${nodePtyPackage}/lib/index.js`,
|
||||
parcelWatcherPackage,
|
||||
parcelWatcherAsset: `${parcelWatcherPackage}/watcher.node`,
|
||||
}
|
||||
}
|
||||
|
||||
export const photonWasmAsset = "@silvia-odwyer/photon-node/photon_rs_bg.wasm"
|
||||
export const nodeExecArgv = ["--experimental-ffi", "--use-system-ca", "--disable-warning=ExperimentalWarning"] as const
|
||||
|
||||
export const attentionSoundAssets = [
|
||||
"@opencode-ai/ui/audio/bip-bop-01.mp3",
|
||||
"@opencode-ai/ui/audio/bip-bop-03.mp3",
|
||||
"@opencode-ai/ui/audio/staplebops-06.mp3",
|
||||
"@opencode-ai/ui/audio/nope-03.mp3",
|
||||
"@opencode-ai/ui/audio/yup-01.mp3",
|
||||
] as const
|
||||
Loading…
Add table
Add a link
Reference in a new issue