refactor(core): rename guidance modules (#37207)

This commit is contained in:
Kit Langton 2026-07-16 10:05:09 -04:00 committed by GitHub
commit a5b28c2af2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 103 additions and 97 deletions

View file

@ -27,13 +27,13 @@ import { Pty } from "./pty"
import { QuestionV2 } from "./question"
import { Shell } from "./shell"
import { Reference } from "./reference"
import { ReferenceGuidance } from "./reference/guidance"
import { ReferenceInstructions } from "./reference/instructions"
import { SessionRunnerLLM } from "./session/runner/llm"
import { SessionRunnerModel } from "./session/runner/model"
import { SessionCompaction } from "./session/compaction"
import { SessionTitle } from "./session/title"
import { SkillV2 } from "./skill"
import { SkillGuidance } from "./skill/guidance"
import { SkillInstructions } from "./skill/instructions"
import { Snapshot } from "./snapshot"
import { InstructionDiscovery } from "./instruction-discovery"
import { InstructionBuiltIns } from "./instructions/builtins"
@ -75,8 +75,8 @@ const locationServiceNodes = [
ToolRegistry.node,
ToolRegistry.toolsNode,
Image.node,
SkillGuidance.node,
ReferenceGuidance.node,
SkillInstructions.node,
ReferenceInstructions.node,
InstructionEntry.node,
Form.node,
QuestionV2.node,

View file

@ -1,4 +1,4 @@
export * as McpGuidance from "./guidance"
export * as McpInstructions from "./instructions"
import { makeLocationNode } from "../effect/app-node"
import { Context, Effect, Layer, Schema } from "effect"
@ -54,7 +54,7 @@ export interface Interface {
readonly load: (agent: AgentV2.Selection) => Effect.Effect<Instructions.Instructions>
}
export class Service extends Context.Service<Service, Interface>()("@opencode/v2/McpGuidance") {}
export class Service extends Context.Service<Service, Interface>()("@opencode/v2/McpInstructions") {}
export const layer = Layer.effect(
Service,
@ -62,7 +62,7 @@ export const layer = Layer.effect(
const mcp = yield* MCP.Service
return Service.of({
load: Effect.fn("McpGuidance.load")(function* (selection) {
load: Effect.fn("McpInstructions.load")(function* (selection) {
const agent = selection.info
if (!agent) return Instructions.empty
const source = (value: ReadonlyArray<Summary> | Instructions.Removed) =>

View file

@ -1,4 +1,4 @@
export * as ReferenceGuidance from "./guidance"
export * as ReferenceInstructions from "./instructions"
import { makeLocationNode } from "../effect/app-node"
import { Context, Effect, Layer, Schema } from "effect"
@ -57,7 +57,7 @@ export interface Interface {
readonly load: () => Effect.Effect<Instructions.Instructions>
}
export class Service extends Context.Service<Service, Interface>()("@opencode/v2/ReferenceGuidance") {}
export class Service extends Context.Service<Service, Interface>()("@opencode/v2/ReferenceInstructions") {}
const layer = Layer.effect(
Service,
@ -65,7 +65,7 @@ const layer = Layer.effect(
const references = yield* Reference.Service
return Service.of({
load: Effect.fn("ReferenceGuidance.load")(function* () {
load: Effect.fn("ReferenceInstructions.load")(function* () {
const available = (yield* references.list())
.filter((reference) => reference.description !== undefined)
.map((reference) => ({

View file

@ -8,10 +8,10 @@ import { InstructionDiscovery } from "../instruction-discovery"
import { Instructions } from "../instructions/index"
import { InstructionBuiltIns } from "../instructions/builtins"
import { Location } from "../location"
import { McpGuidance } from "../mcp/guidance"
import { McpInstructions } from "../mcp/instructions"
import { PluginSupervisor } from "../plugin/supervisor"
import { ReferenceGuidance } from "../reference/guidance"
import { SkillGuidance } from "../skill/guidance"
import { ReferenceInstructions } from "../reference/instructions"
import { SkillInstructions } from "../skill/instructions"
import { AgentNotFoundError } from "./error"
import { SessionHistory } from "./history"
import { InstructionEntry } from "./instruction-entry"
@ -52,11 +52,11 @@ const layer = Layer.effect(
const discovery = yield* InstructionDiscovery.Service
const entries = yield* InstructionEntry.Service
const location = yield* Location.Service
const mcpGuidance = yield* McpGuidance.Service
const mcpInstructions = yield* McpInstructions.Service
const models = yield* SessionRunnerModel.Service
const plugins = yield* PluginSupervisor.Service
const referenceGuidance = yield* ReferenceGuidance.Service
const skillGuidance = yield* SkillGuidance.Service
const referenceInstructions = yield* ReferenceInstructions.Service
const skillInstructions = yield* SkillInstructions.Service
const store = yield* SessionStore.Service
const select = Effect.fn("SessionContext.select")(function* (sessionID: SessionSchema.ID) {
@ -72,9 +72,9 @@ const layer = Layer.effect(
[
builtins.load(sessionID),
discovery.load(),
skillGuidance.load(agent),
referenceGuidance.load(),
mcpGuidance.load(agent),
skillInstructions.load(agent),
referenceInstructions.load(),
mcpInstructions.load(agent),
entries.load(sessionID),
],
{ concurrency: "unbounded" },
@ -108,11 +108,11 @@ export const node = makeLocationNode({
InstructionDiscovery.node,
InstructionEntry.node,
Location.node,
McpGuidance.node,
McpInstructions.node,
PluginSupervisor.node,
ReferenceGuidance.node,
ReferenceInstructions.node,
SessionRunnerModel.node,
SessionStore.node,
SkillGuidance.node,
SkillInstructions.node,
],
})

View file

@ -1,4 +1,4 @@
export * as SkillGuidance from "./guidance"
export * as SkillInstructions from "./instructions"
import { makeLocationNode } from "../effect/app-node"
import { Context, Effect, Layer, Schema } from "effect"
@ -60,7 +60,7 @@ export interface Interface {
readonly load: (agent: AgentV2.Selection) => Effect.Effect<Instructions.Instructions>
}
export class Service extends Context.Service<Service, Interface>()("@opencode/v2/SkillGuidance") {}
export class Service extends Context.Service<Service, Interface>()("@opencode/v2/SkillInstructions") {}
const layer = Layer.effect(
Service,
@ -68,7 +68,7 @@ const layer = Layer.effect(
const skills = yield* SkillV2.Service
return Service.of({
load: Effect.fn("SkillGuidance.load")(function* (selection) {
load: Effect.fn("SkillInstructions.load")(function* (selection) {
const agent = selection.info
if (!agent) return Instructions.empty
const permitted = SkillV2.available(yield* skills.list(), agent)