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 — chore: generate · soequelle/opencode@2684293

File tree

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

‎packages/opencode/src/mcp/index.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/src/mcp/index.ts
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,12 @@ export const layer = Layer.effect(
392392
if (!listed) {
393393
return yield* Effect.fail(new Error("Failed to get tools"))
394394
}
395-
return { mcpClient, status, defs: listed, instructions: mcpClient.getInstructions()?.trim() } satisfies CreateResult
395+
return {
396+
mcpClient,
397+
status,
398+
defs: listed,
399+
instructions: mcpClient.getInstructions()?.trim(),
400+
} satisfies CreateResult
396401
}).pipe(
397402
Effect.catchCause((cause) =>
398403
Effect.tryPromise(() => mcpClient.close()).pipe(Effect.ignore, Effect.andThen(Effect.failCause(cause))),
Collapse file

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

Copy file name to clipboardExpand all lines: packages/opencode/test/session/prompt.test.ts
+24-31Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,7 @@ const blockingProcessor = Layer.succeed(
168168
}),
169169
)
170170

171-
function makePrompt(input?: {
172-
mcpInstructions?: MCP.ServerInstructions[]
173-
processor?: "blocking"
174-
}) {
171+
function makePrompt(input?: { mcpInstructions?: MCP.ServerInstructions[]; processor?: "blocking" }) {
175172
const deps = Layer.mergeAll(
176173
Session.defaultLayer,
177174
Snapshot.defaultLayer,
@@ -243,17 +240,11 @@ function makePrompt(input?: {
243240
)
244241
}
245242

246-
function makeHttp(input?: {
247-
mcpInstructions?: MCP.ServerInstructions[]
248-
processor?: "blocking"
249-
}) {
243+
function makeHttp(input?: { mcpInstructions?: MCP.ServerInstructions[]; processor?: "blocking" }) {
250244
return Layer.mergeAll(TestLLMServer.layer, makePrompt(input))
251245
}
252246

253-
function makeHttpNoLLMServer(input?: {
254-
mcpInstructions?: MCP.ServerInstructions[]
255-
processor?: "blocking"
256-
}) {
247+
function makeHttpNoLLMServer(input?: { mcpInstructions?: MCP.ServerInstructions[]; processor?: "blocking" }) {
257248
return makePrompt(input)
258249
}
259250

@@ -537,27 +528,29 @@ it.instance("loop calls LLM and returns assistant message", () =>
537528
}),
538529
)
539530

540-
withMcpInstructions.instance("loop includes MCP instructions in model system context", () =>
541-
Effect.gen(function* () {
542-
const { llm } = yield* useServerConfig(providerCfg)
543-
const prompt = yield* SessionPrompt.Service
544-
const sessions = yield* Session.Service
545-
const chat = yield* sessions.create({
546-
title: "Pinned",
547-
permission: [{ permission: "*", pattern: "*", action: "allow" }],
548-
})
549-
yield* llm.hang
550-
yield* user(chat.id, "hello")
531+
withMcpInstructions.instance(
532+
"loop includes MCP instructions in model system context",
533+
() =>
534+
Effect.gen(function* () {
535+
const { llm } = yield* useServerConfig(providerCfg)
536+
const prompt = yield* SessionPrompt.Service
537+
const sessions = yield* Session.Service
538+
const chat = yield* sessions.create({
539+
title: "Pinned",
540+
permission: [{ permission: "*", pattern: "*", action: "allow" }],
541+
})
542+
yield* llm.hang
543+
yield* user(chat.id, "hello")
551544

552-
const fiber = yield* prompt.loop({ sessionID: chat.id }).pipe(Effect.forkChild)
553-
yield* awaitWithTimeout(llm.wait(1), "timed out waiting for MCP instruction request", "10 seconds")
545+
const fiber = yield* prompt.loop({ sessionID: chat.id }).pipe(Effect.forkChild)
546+
yield* awaitWithTimeout(llm.wait(1), "timed out waiting for MCP instruction request", "10 seconds")
554547

555-
const hits = yield* llm.hits
556-
const body = JSON.stringify(hits[0]?.body)
557-
expect(body).toContain('<server name=\\"guide-server\\">')
558-
expect(body).toContain("Use lookup before mutate.")
559-
yield* Fiber.interrupt(fiber)
560-
}),
548+
const hits = yield* llm.hits
549+
const body = JSON.stringify(hits[0]?.body)
550+
expect(body).toContain('<server name=\\"guide-server\\">')
551+
expect(body).toContain("Use lookup before mutate.")
552+
yield* Fiber.interrupt(fiber)
553+
}),
561554
15_000,
562555
)
563556

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.