refactor(opencode): roll out serviceUse proxy across 14 services + tests (#28576)

This commit is contained in:
Kit Langton
2026-05-20 23:36:27 -04:00
committed by GitHub
parent 69eee26f30
commit 39ea816a72
48 changed files with 640 additions and 622 deletions

View File

@@ -46,8 +46,8 @@ function testAgent(input: {
it.instance("[#26514] subagent spawned from plan mode inherits read-only restriction (edit denied)", () =>
Effect.gen(function* () {
const planAgent = yield* Agent.Service.use((svc) => svc.get("plan"))
const generalAgent = yield* Agent.Service.use((svc) => svc.get("general"))
const planAgent = yield* Agent.use.get("plan")
const generalAgent = yield* Agent.use.get("general")
expect(planAgent).toBeDefined()
expect(generalAgent).toBeDefined()
@@ -83,8 +83,8 @@ it.instance("[#26514] explore subagent launched from plan mode also stays read-o
// should propagate the parent **agent** permissions, not just deny edit
// when the subagent happens to already deny it.
Effect.gen(function* () {
const planAgent = yield* Agent.Service.use((svc) => svc.get("plan"))
const explore = yield* Agent.Service.use((svc) => svc.get("explore"))
const planAgent = yield* Agent.use.get("plan")
const explore = yield* Agent.use.get("explore")
expect(planAgent).toBeDefined()
expect(explore).toBeDefined()
@@ -108,8 +108,8 @@ it.instance(
// be able to edit when the parent agent is `plan`.
() =>
Effect.gen(function* () {
const planAgent = yield* Agent.Service.use((svc) => svc.get("plan"))
const my = yield* Agent.Service.use((svc) => svc.get("my_subagent"))
const planAgent = yield* Agent.use.get("plan")
const my = yield* Agent.use.get("my_subagent")
expect(planAgent).toBeDefined()
expect(my).toBeDefined()

View File

@@ -51,7 +51,7 @@ it.instance(
() =>
Effect.gen(function* () {
yield* Plugin.Service.use((p) => p.init())
const agents = yield* Agent.Service.use((svc) => svc.list())
const agents = yield* Agent.use.list()
const added = agents.find((agent) => agent.name === PLUGIN_AGENT.name)
expect(added?.description).toBe(PLUGIN_AGENT.description)
expect(added?.mode).toBe(PLUGIN_AGENT.mode)