GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — refactor(session): yield instance context in system prompt (#25207) · Level0r0s/opencode@5984d91

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/opencode/src/session
    • prompt.ts
    • system.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/opencode/src/session/prompt.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/src/session/prompt.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1443,7 +1443,7 @@ NOTE: At any point in time through this workflow you should feel free to ask the
14431443

14441444
const [skills, env, instructions, modelMsgs] = yield* Effect.all([
14451445
sys.skills(agent),
1446-
Effect.sync(() => sys.environment(model)),
1446+
sys.environment(model),
14471447
instruction.system().pipe(Effect.orDie),
14481448
MessageV2.toModelMessagesEffect(msgs, model),
14491449
])
Collapse file

‎packages/opencode/src/session/system.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/src/session/system.ts
+8-8Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Context, Effect, Layer } from "effect"
22

3-
import { Instance } from "../project/instance"
3+
import { InstanceState } from "@/effect/instance-state"
44

55
import PROMPT_ANTHROPIC from "./prompt/anthropic.txt"
66
import PROMPT_DEFAULT from "./prompt/default.txt"
@@ -33,7 +33,7 @@ export function provider(model: Provider.Model) {
3333
}
3434

3535
export interface Interface {
36-
readonly environment: (model: Provider.Model) => string[]
36+
readonly environment: (model: Provider.Model) => Effect.Effect<string[]>
3737
readonly skills: (agent: Agent.Info) => Effect.Effect<string | undefined>
3838
}
3939

@@ -45,22 +45,22 @@ export const layer = Layer.effect(
4545
const skill = yield* Skill.Service
4646

4747
return Service.of({
48-
environment(model) {
49-
const project = Instance.project
48+
environment: Effect.fn("SystemPrompt.environment")(function* (model: Provider.Model) {
49+
const ctx = yield* InstanceState.context
5050
return [
5151
[
5252
`You are powered by the model named ${model.api.id}. The exact model ID is ${model.providerID}/${model.api.id}`,
5353
`Here is some useful information about the environment you are running in:`,
5454
`<env>`,
55-
` Working directory: ${Instance.directory}`,
56-
` Workspace root folder: ${Instance.worktree}`,
57-
` Is directory a git repo: ${project.vcs === "git" ? "yes" : "no"}`,
55+
` Working directory: ${ctx.directory}`,
56+
` Workspace root folder: ${ctx.worktree}`,
57+
` Is directory a git repo: ${ctx.project.vcs === "git" ? "yes" : "no"}`,
5858
` Platform: ${process.platform}`,
5959
` Today's date: ${new Date().toDateString()}`,
6060
`</env>`,
6161
].join("\n"),
6262
]
63-
},
63+
}),
6464

6565
skills: Effect.fn("SystemPrompt.skills")(function* (agent: Agent.Info) {
6666
if (Permission.disabled(["skill"], agent.permission).has("skill")) return

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.