Compare commits

...
Sign in to create a new pull request.

2 commits

10 changed files with 416 additions and 419 deletions

View file

@ -5,7 +5,7 @@ import { InstallationVersion } from "@/installation/version"
import { iife } from "@/util/iife" import { iife } from "@/util/iife"
import { Log } from "../../util" import { Log } from "../../util"
import { setTimeout as sleep } from "node:timers/promises" import { setTimeout as sleep } from "node:timers/promises"
import { CopilotModels } from "./models" import * as CopilotModels from "./models"
import { MessageV2 } from "@/session/message-v2" import { MessageV2 } from "@/session/message-v2"
const log = Log.create({ service: "plugin.copilot" }) const log = Log.create({ service: "plugin.copilot" })

View file

@ -1,7 +1,6 @@
import { z } from "zod" import { z } from "zod"
import type { Model } from "@opencode-ai/sdk/v2" import type { Model } from "@opencode-ai/sdk/v2"
export namespace CopilotModels {
export const schema = z.object({ export const schema = z.object({
data: z.array( data: z.array(
z.object({ z.object({
@ -143,4 +142,4 @@ export namespace CopilotModels {
return result return result
} }
} export * as CopilotModels from "./models"

View file

@ -11,7 +11,6 @@ import {
import { ConfigPlugin } from "@/config/plugin" import { ConfigPlugin } from "@/config/plugin"
import { InstallationVersion } from "@/installation/version" import { InstallationVersion } from "@/installation/version"
export namespace PluginLoader {
export type Plan = { export type Plan = {
spec: string spec: string
options: ConfigPlugin.Options | undefined options: ConfigPlugin.Options | undefined
@ -171,4 +170,4 @@ export namespace PluginLoader {
for (const item of out) if (item !== undefined) ready.push(item) for (const item of out) if (item !== undefined) ready.push(item)
return ready return ready
} }
} export * as PluginLoader from "./loader"

View file

@ -8,7 +8,6 @@ import { Flock } from "@opencode-ai/shared/util/flock"
import { parsePluginSpecifier, pluginSource } from "./shared" import { parsePluginSpecifier, pluginSource } from "./shared"
export namespace PluginMeta {
type Source = "file" | "npm" type Source = "file" | "npm"
export type Theme = { export type Theme = {
@ -185,4 +184,4 @@ export namespace PluginMeta {
const file = storePath() const file = storePath()
return Flock.withLock(lock(file), async () => read(file)) return Flock.withLock(lock(file), async () => read(file))
} }
} export * as PluginMeta from "./meta"

View file

@ -21,7 +21,7 @@ import { Effect, Layer, Context, Stream } from "effect"
import { EffectBridge } from "@/effect" import { EffectBridge } from "@/effect"
import { InstanceState } from "@/effect" import { InstanceState } from "@/effect"
import { errorMessage } from "@/util/error" import { errorMessage } from "@/util/error"
import { PluginLoader } from "./loader" import * as PluginLoader from "./loader"
import { parsePluginSpecifier, readPluginId, readV1Plugin, resolvePluginId } from "./shared" import { parsePluginSpecifier, readPluginId, readV1Plugin, resolvePluginId } from "./shared"
import { registerAdaptor } from "@/control-plane/adaptors" import { registerAdaptor } from "@/control-plane/adaptors"
import type { WorkspaceAdaptor } from "@/control-plane/types" import type { WorkspaceAdaptor } from "@/control-plane/types"

View file

@ -14,6 +14,6 @@ if (typeof msg.id !== "string") throw new Error("Invalid worker payload")
process.env.OPENCODE_PLUGIN_META_FILE = msg.file process.env.OPENCODE_PLUGIN_META_FILE = msg.file
const { PluginMeta } = await import("../../src/plugin/meta") const PluginMeta = await import("../../src/plugin/meta")
await PluginMeta.touch(msg.spec, msg.target, msg.id) await PluginMeta.touch(msg.spec, msg.target, msg.id)

View file

@ -1,5 +1,5 @@
import { afterEach, expect, mock, test } from "bun:test" import { afterEach, expect, mock, test } from "bun:test"
import { CopilotModels } from "@/plugin/github-copilot/models" import { CopilotModels } from "../../src/plugin/github-copilot/models"
import { CopilotAuthPlugin } from "@/plugin/github-copilot/copilot" import { CopilotAuthPlugin } from "@/plugin/github-copilot/copilot"
const originalFetch = globalThis.fetch const originalFetch = globalThis.fetch

View file

@ -10,7 +10,7 @@ const disableDefault = process.env.OPENCODE_DISABLE_DEFAULT_PLUGINS
process.env.OPENCODE_DISABLE_DEFAULT_PLUGINS = "1" process.env.OPENCODE_DISABLE_DEFAULT_PLUGINS = "1"
const { Plugin } = await import("../../src/plugin/index") const { Plugin } = await import("../../src/plugin/index")
const { PluginLoader } = await import("../../src/plugin/loader") const PluginLoader = await import("../../src/plugin/loader")
const { readPackageThemes } = await import("../../src/plugin/shared") const { readPackageThemes } = await import("../../src/plugin/shared")
const { Instance } = await import("../../src/project/instance") const { Instance } = await import("../../src/project/instance")
const { Npm } = await import("../../src/npm") const { Npm } = await import("../../src/npm")

View file

@ -7,7 +7,7 @@ import { tmpdir } from "../fixture/fixture"
import { Process } from "../../src/util" import { Process } from "../../src/util"
import { Filesystem } from "../../src/util" import { Filesystem } from "../../src/util"
const { PluginMeta } = await import("../../src/plugin/meta") const PluginMeta = await import("../../src/plugin/meta")
const root = path.join(import.meta.dir, "../..") const root = path.join(import.meta.dir, "../..")
const worker = path.join(import.meta.dir, "../fixture/plugin-meta-worker.ts") const worker = path.join(import.meta.dir, "../fixture/plugin-meta-worker.ts")