mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-18 07:12:35 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0464264c62 |
@@ -1246,6 +1246,49 @@ describe("runAcpProvider streamed chunks without messageId (#4699)", () => {
|
||||
messageId?: string;
|
||||
}
|
||||
|
||||
it("keeps reasoning separate from a reply sharing its native message ID", async () => {
|
||||
const harness = connectorHarness({
|
||||
promptUpdates: () => [
|
||||
textChunk("private reasoning", "agent_thought_chunk", "shared-id"),
|
||||
textChunk("public reply", "agent_message_chunk", "shared-id"),
|
||||
],
|
||||
});
|
||||
const registration = runAcpProvider({
|
||||
id: "chunk-acp",
|
||||
label: "Chunk ACP",
|
||||
connector: harness.connector,
|
||||
});
|
||||
const connection = await registration.connect({
|
||||
versions: [1],
|
||||
capabilities: ["prompt.message"],
|
||||
});
|
||||
const events: ProviderEvent[] = [];
|
||||
connection.onEvent((event) => events.push(event));
|
||||
try {
|
||||
await connection.send(openInput());
|
||||
await waitForEvent(events, (event) => event.type === "session.ready");
|
||||
await connection.send({
|
||||
type: "session.prompt",
|
||||
sessionId: "session-1",
|
||||
prompt: {
|
||||
clientMessageId: "same-id",
|
||||
delivery: "auto",
|
||||
input: { type: "message", content: [{ type: "text", text: "hello" }] },
|
||||
},
|
||||
});
|
||||
await waitForEvent(
|
||||
events,
|
||||
(event) => event.type === "session.turn" && event.state === "completed",
|
||||
);
|
||||
const reply = events.findLast(
|
||||
(event) => event.type === "timeline.item" && event.item.type === "assistant_message",
|
||||
);
|
||||
expect(reply).toMatchObject({ item: { text: "public reply" } });
|
||||
} finally {
|
||||
await connection.close();
|
||||
}
|
||||
});
|
||||
|
||||
it("continues one timeline item per turn instead of one per chunk", async () => {
|
||||
const chunksByPrompt: Record<string, Chunk[]> = {
|
||||
first: [
|
||||
|
||||
@@ -287,6 +287,45 @@ function expectNestedChildren(events: AgentStreamEvent[]) {
|
||||
}
|
||||
|
||||
describe("PluginAgentClientRegistry", () => {
|
||||
test("returns unavailable when steering a provider without prompt.steer capability", async () => {
|
||||
const harness = createProviderHarness();
|
||||
const registry = new PluginAgentClientRegistry(createTestLogger());
|
||||
registry.replace([harness.registration]);
|
||||
const session = await registry.clients()[harness.registration.id]!.createSession({
|
||||
provider: harness.registration.id,
|
||||
cwd: "/tmp",
|
||||
});
|
||||
try {
|
||||
await expect(
|
||||
session.steerActiveTurn!("follow up", { expectedTurnId: "turn-1" }),
|
||||
).resolves.toEqual({ status: "unavailable" });
|
||||
expect(harness.inputs.filter((input) => input.type === "session.prompt")).toHaveLength(0);
|
||||
} finally {
|
||||
await session.close();
|
||||
registry.replace([]);
|
||||
}
|
||||
});
|
||||
|
||||
test("resumes a native ACP handle after the same provider ID moves to a plugin", async () => {
|
||||
const harness = createProviderHarness();
|
||||
const registry = new PluginAgentClientRegistry(createTestLogger());
|
||||
registry.replace([harness.registration]);
|
||||
try {
|
||||
const session = await registry.clients()[harness.registration.id]!.resumeSession(
|
||||
{
|
||||
provider: harness.registration.id,
|
||||
sessionId: "native-session-id",
|
||||
nativeHandle: "native-session-id",
|
||||
metadata: { provider: "acp", cwd: "/tmp" },
|
||||
},
|
||||
{ provider: harness.registration.id, cwd: "/tmp" },
|
||||
);
|
||||
await session.close();
|
||||
} finally {
|
||||
registry.replace([]);
|
||||
}
|
||||
});
|
||||
|
||||
test("stores only agent options while the plugin receives merged defaults", async () => {
|
||||
const logger = createTestLogger();
|
||||
const harness = createProviderHarness();
|
||||
|
||||
Reference in New Issue
Block a user