feat(core): add command registry (#30624)

This commit is contained in:
Dax
2026-06-04 02:57:43 -04:00
committed by GitHub
parent 70bb710715
commit 1ff19103a2
150 changed files with 4753 additions and 2657 deletions

View File

@@ -36,6 +36,7 @@ import { ToolJsonSchema } from "@/tool/json-schema"
import { MessageID, SessionID } from "@/session/schema"
import { RuntimeFlags } from "@/effect/runtime-flags"
import { ProviderV2 } from "@opencode-ai/core/provider"
import { ModelV2 } from "@opencode-ai/core/model"
const node = CrossSpawnSpawner.defaultLayer
const configLayer = TestConfig.layer({
@@ -124,7 +125,7 @@ describe("tool.registry", () => {
if (!build) throw new Error("build agent not found")
const task = (yield* registry.tools({
providerID: ProviderV2.ID.opencode,
modelID: ProviderV2.ModelID.make("test"),
modelID: ModelV2.ID.make("test"),
agent: build,
})).find((tool) => tool.id === "task")
@@ -302,7 +303,7 @@ describe("tool.registry", () => {
const agents = yield* Agent.Service
const promptTools = yield* registry.tools({
providerID: ProviderV2.ID.opencode,
modelID: ProviderV2.ModelID.make("test"),
modelID: ModelV2.ID.make("test"),
agent: yield* agents.defaultInfo(),
})
const promptTool = promptTools.find((tool) => tool.id === "sql")

View File

@@ -21,6 +21,7 @@ import { RuntimeFlags } from "@/effect/runtime-flags"
import { disposeAllInstances } from "../fixture/fixture"
import { testEffect } from "../lib/effect"
import { ProviderV2 } from "@opencode-ai/core/provider"
import { ModelV2 } from "@opencode-ai/core/model"
afterEach(async () => {
await disposeAllInstances()
@@ -28,7 +29,7 @@ afterEach(async () => {
const ref = {
providerID: ProviderV2.ID.make("test"),
modelID: ProviderV2.ModelID.make("test-model"),
modelID: ModelV2.ID.make("test-model"),
}
const layer = (flags: Partial<RuntimeFlags.Info> = {}) =>