chore: generate
This commit is contained in:
@@ -392,7 +392,12 @@ export const layer = Layer.effect(
|
|||||||
if (!listed) {
|
if (!listed) {
|
||||||
return yield* Effect.fail(new Error("Failed to get tools"))
|
return yield* Effect.fail(new Error("Failed to get tools"))
|
||||||
}
|
}
|
||||||
return { mcpClient, status, defs: listed, instructions: mcpClient.getInstructions()?.trim() } satisfies CreateResult
|
return {
|
||||||
|
mcpClient,
|
||||||
|
status,
|
||||||
|
defs: listed,
|
||||||
|
instructions: mcpClient.getInstructions()?.trim(),
|
||||||
|
} satisfies CreateResult
|
||||||
}).pipe(
|
}).pipe(
|
||||||
Effect.catchCause((cause) =>
|
Effect.catchCause((cause) =>
|
||||||
Effect.tryPromise(() => mcpClient.close()).pipe(Effect.ignore, Effect.andThen(Effect.failCause(cause))),
|
Effect.tryPromise(() => mcpClient.close()).pipe(Effect.ignore, Effect.andThen(Effect.failCause(cause))),
|
||||||
|
|||||||
@@ -168,10 +168,7 @@ const blockingProcessor = Layer.succeed(
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
function makePrompt(input?: {
|
function makePrompt(input?: { mcpInstructions?: MCP.ServerInstructions[]; processor?: "blocking" }) {
|
||||||
mcpInstructions?: MCP.ServerInstructions[]
|
|
||||||
processor?: "blocking"
|
|
||||||
}) {
|
|
||||||
const deps = Layer.mergeAll(
|
const deps = Layer.mergeAll(
|
||||||
Session.defaultLayer,
|
Session.defaultLayer,
|
||||||
Snapshot.defaultLayer,
|
Snapshot.defaultLayer,
|
||||||
@@ -243,17 +240,11 @@ function makePrompt(input?: {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeHttp(input?: {
|
function makeHttp(input?: { mcpInstructions?: MCP.ServerInstructions[]; processor?: "blocking" }) {
|
||||||
mcpInstructions?: MCP.ServerInstructions[]
|
|
||||||
processor?: "blocking"
|
|
||||||
}) {
|
|
||||||
return Layer.mergeAll(TestLLMServer.layer, makePrompt(input))
|
return Layer.mergeAll(TestLLMServer.layer, makePrompt(input))
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeHttpNoLLMServer(input?: {
|
function makeHttpNoLLMServer(input?: { mcpInstructions?: MCP.ServerInstructions[]; processor?: "blocking" }) {
|
||||||
mcpInstructions?: MCP.ServerInstructions[]
|
|
||||||
processor?: "blocking"
|
|
||||||
}) {
|
|
||||||
return makePrompt(input)
|
return makePrompt(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -537,27 +528,29 @@ it.instance("loop calls LLM and returns assistant message", () =>
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
withMcpInstructions.instance("loop includes MCP instructions in model system context", () =>
|
withMcpInstructions.instance(
|
||||||
Effect.gen(function* () {
|
"loop includes MCP instructions in model system context",
|
||||||
const { llm } = yield* useServerConfig(providerCfg)
|
() =>
|
||||||
const prompt = yield* SessionPrompt.Service
|
Effect.gen(function* () {
|
||||||
const sessions = yield* Session.Service
|
const { llm } = yield* useServerConfig(providerCfg)
|
||||||
const chat = yield* sessions.create({
|
const prompt = yield* SessionPrompt.Service
|
||||||
title: "Pinned",
|
const sessions = yield* Session.Service
|
||||||
permission: [{ permission: "*", pattern: "*", action: "allow" }],
|
const chat = yield* sessions.create({
|
||||||
})
|
title: "Pinned",
|
||||||
yield* llm.hang
|
permission: [{ permission: "*", pattern: "*", action: "allow" }],
|
||||||
yield* user(chat.id, "hello")
|
})
|
||||||
|
yield* llm.hang
|
||||||
|
yield* user(chat.id, "hello")
|
||||||
|
|
||||||
const fiber = yield* prompt.loop({ sessionID: chat.id }).pipe(Effect.forkChild)
|
const fiber = yield* prompt.loop({ sessionID: chat.id }).pipe(Effect.forkChild)
|
||||||
yield* awaitWithTimeout(llm.wait(1), "timed out waiting for MCP instruction request", "10 seconds")
|
yield* awaitWithTimeout(llm.wait(1), "timed out waiting for MCP instruction request", "10 seconds")
|
||||||
|
|
||||||
const hits = yield* llm.hits
|
const hits = yield* llm.hits
|
||||||
const body = JSON.stringify(hits[0]?.body)
|
const body = JSON.stringify(hits[0]?.body)
|
||||||
expect(body).toContain('<server name=\\"guide-server\\">')
|
expect(body).toContain('<server name=\\"guide-server\\">')
|
||||||
expect(body).toContain("Use lookup before mutate.")
|
expect(body).toContain("Use lookup before mutate.")
|
||||||
yield* Fiber.interrupt(fiber)
|
yield* Fiber.interrupt(fiber)
|
||||||
}),
|
}),
|
||||||
15_000,
|
15_000,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user