mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-21 07:45:38 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a9e9a0d32 |
@@ -38,6 +38,7 @@ import {
|
||||
requireProviderCapabilities,
|
||||
type ProviderCatalog,
|
||||
type ProviderCapability,
|
||||
type ProviderCommand,
|
||||
type ProviderConfigState,
|
||||
type ProviderConnectRequest,
|
||||
type ProviderConnection,
|
||||
@@ -1398,11 +1399,18 @@ class AcpRuntime {
|
||||
return;
|
||||
}
|
||||
if (update.sessionUpdate === "available_commands_update") {
|
||||
const commands = update.availableCommands.map((command) => ({
|
||||
name: command.name,
|
||||
description: command.description,
|
||||
argumentHint: command.input?.hint,
|
||||
}));
|
||||
const context = { sessionId: this.options.boundarySessionId };
|
||||
const commands = update.availableCommands.map((command) => {
|
||||
let entry: ProviderCommand = {
|
||||
name: command.name,
|
||||
description: command.description,
|
||||
argumentHint: command.input?.hint,
|
||||
};
|
||||
for (const transformer of this.transformers) {
|
||||
entry = transformer.command?.(entry, context) ?? entry;
|
||||
}
|
||||
return entry;
|
||||
});
|
||||
this.emit({ type: "session.commands", sessionId: this.options.boundarySessionId, commands });
|
||||
this.receivedInitialCommands = true;
|
||||
this.commandWaiter?.();
|
||||
|
||||
@@ -136,6 +136,8 @@ export interface AcpTransformer {
|
||||
configure?(change: AcpConfigChange, context: AcpConfigureContext): Promise<"handled" | "pass">;
|
||||
/** Rewrites every session config snapshot before Paseo sees it. */
|
||||
config?(state: ProviderConfigState, context: AcpContext): ProviderConfigState;
|
||||
/** Rewrites each advertised ACP slash command before Paseo sees it. */
|
||||
command?(command: ProviderCommand, context: AcpContext): ProviderCommand;
|
||||
notification?(
|
||||
notification: { method: string; params: JsonValue },
|
||||
context: AcpContext,
|
||||
|
||||
@@ -488,6 +488,7 @@ export interface ProviderCommand {
|
||||
name: string;
|
||||
description: string;
|
||||
argumentHint?: string;
|
||||
kind?: "command" | "skill";
|
||||
}
|
||||
|
||||
export interface ProviderError {
|
||||
@@ -1214,7 +1215,12 @@ const noticeSchema = z
|
||||
})
|
||||
.strip();
|
||||
const commandSchema = z
|
||||
.object({ name: idSchema, description: z.string(), argumentHint: z.string().optional() })
|
||||
.object({
|
||||
name: idSchema,
|
||||
description: z.string(),
|
||||
argumentHint: z.string().optional(),
|
||||
kind: z.enum(["command", "skill"]).optional(),
|
||||
})
|
||||
.strip();
|
||||
const usageSchema = z
|
||||
.object({
|
||||
|
||||
@@ -258,6 +258,38 @@ function eventsOfType(events: AgentStreamEvent[], type: AgentStreamEvent["type"]
|
||||
return events.filter((event) => event.type === type);
|
||||
}
|
||||
|
||||
test("preserves skills in a plugin session's command list", 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: tmpdir(),
|
||||
});
|
||||
try {
|
||||
const open = harness.inputs.find((input) => input.type === "session.open")!;
|
||||
harness.emit({
|
||||
type: "session.commands",
|
||||
sessionId: open.sessionId,
|
||||
commands: [
|
||||
{ name: "compact", description: "Compact the conversation" },
|
||||
{ name: "diagnose", description: "Diagnose a bug", kind: "skill" },
|
||||
],
|
||||
});
|
||||
await expect(session.listCommands!()).resolves.toEqual([
|
||||
{
|
||||
name: "compact",
|
||||
description: "Compact the conversation",
|
||||
argumentHint: "",
|
||||
kind: "command",
|
||||
},
|
||||
{ name: "diagnose", description: "Diagnose a bug", argumentHint: "", kind: "skill" },
|
||||
]);
|
||||
} finally {
|
||||
await session.close();
|
||||
}
|
||||
});
|
||||
|
||||
function createRewindProviderHarness(
|
||||
options: {
|
||||
reuseAnswerId?: boolean;
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
type ProviderLaunch,
|
||||
requireProviderCapabilities,
|
||||
type ProviderCapability,
|
||||
type ProviderCommand,
|
||||
type ProviderConfigChanges,
|
||||
type ProviderConfigState,
|
||||
type ProviderConnection,
|
||||
@@ -663,7 +664,7 @@ class ProviderRuntimeSession {
|
||||
private closedByProvider = false;
|
||||
private closePromise: Promise<void> | null = null;
|
||||
config: ProviderConfigState = { models: [], modes: [], thinkingOptions: [] };
|
||||
commands: Array<{ name: string; description: string; argumentHint?: string }> = [];
|
||||
commands: ProviderCommand[] = [];
|
||||
persistence: ProviderPersistence | null = null;
|
||||
|
||||
constructor(
|
||||
@@ -1501,7 +1502,7 @@ class PluginAgentSession implements AgentSession {
|
||||
return this.bridge.commands.map((command) => ({
|
||||
...command,
|
||||
argumentHint: command.argumentHint ?? "",
|
||||
kind: "command",
|
||||
kind: command.kind ?? "command",
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,73 @@ it("reports a CLI without the acp subcommand as unavailable", async () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("publishes Antigravity skills separately from built-in commands", async () => {
|
||||
const { directory, launch } = await launchAgent(`
|
||||
const { createInterface } = require("node:readline");
|
||||
const send = (message) => process.stdout.write(JSON.stringify({ jsonrpc: "2.0", ...message }) + "\\n");
|
||||
createInterface({ input: process.stdin }).on("line", (line) => {
|
||||
const { id, method } = JSON.parse(line);
|
||||
if (method === "initialize") {
|
||||
send({ id, result: { protocolVersion: 1 } });
|
||||
}
|
||||
if (method === "session/new") {
|
||||
send({ id, result: { sessionId: "native" } });
|
||||
send({ method: "session/update", params: { sessionId: "native", update: {
|
||||
sessionUpdate: "available_commands_update",
|
||||
availableCommands: ["goal", "compact", "schedule", "browser", "plan", "grill-me",
|
||||
"teamwork", "learn", "boost", "agy-customizations", "antigravity-guide", "diagnose"]
|
||||
.map(name => ({ name, description: name })),
|
||||
} } });
|
||||
}
|
||||
});
|
||||
`);
|
||||
const connection = await createAntigravityProvider().connect({
|
||||
launch,
|
||||
versions: [1],
|
||||
capabilities: [],
|
||||
});
|
||||
const events: ProviderEvent[] = [];
|
||||
connection.onEvent((event) => events.push(event));
|
||||
try {
|
||||
await connection.send({
|
||||
type: "session.open",
|
||||
requestId: "new",
|
||||
sessionId: "test",
|
||||
history: "skip",
|
||||
config: { cwd: directory, env: {}, mcpServers: {}, settings: {}, persist: false },
|
||||
});
|
||||
await expect
|
||||
.poll(() =>
|
||||
events.find(
|
||||
(event) => event.type === "session.commands" || event.type === "request.failed",
|
||||
),
|
||||
)
|
||||
.toMatchObject({ type: "session.commands" });
|
||||
await expect
|
||||
.poll(() => events.find((event) => event.type === "session.commands")?.commands)
|
||||
.toEqual([
|
||||
...[
|
||||
"goal",
|
||||
"compact",
|
||||
"schedule",
|
||||
"browser",
|
||||
"plan",
|
||||
"grill-me",
|
||||
"teamwork",
|
||||
"learn",
|
||||
"boost",
|
||||
].map((name) => ({ name, description: name, kind: "command" })),
|
||||
...["agy-customizations", "antigravity-guide", "diagnose"].map((name) => ({
|
||||
name,
|
||||
description: name,
|
||||
kind: "skill",
|
||||
})),
|
||||
]);
|
||||
} finally {
|
||||
await connection.close();
|
||||
}
|
||||
});
|
||||
|
||||
it.each([true, false])(
|
||||
"loads a saved stream-JSON session with ACP system prompt support %s",
|
||||
async (supportsSystemPrompt) => {
|
||||
|
||||
@@ -17,7 +17,23 @@ const systemPromptCapability = z.object({
|
||||
|
||||
const fileWrite = z.object({ Path: z.string(), Content: z.string().optional() });
|
||||
|
||||
// agy 1.5.13 advertises these built-in commands and its invocable skills in one ACP list.
|
||||
const builtInCommands = new Set([
|
||||
"goal",
|
||||
"compact",
|
||||
"schedule",
|
||||
"browser",
|
||||
"plan",
|
||||
"grill-me",
|
||||
"teamwork",
|
||||
"learn",
|
||||
"boost",
|
||||
]);
|
||||
|
||||
const antigravity: AcpTransformer = {
|
||||
command(command) {
|
||||
return { ...command, kind: builtInCommands.has(command.name) ? "command" : "skill" };
|
||||
},
|
||||
toolCall(call) {
|
||||
if (call.name === "write_file") {
|
||||
const input = fileWrite.safeParse(call.input);
|
||||
|
||||
@@ -442,6 +442,15 @@ Use `config(state, context)` to return the configuration snapshot that Paseo dis
|
||||
Paseo calls this synchronous hook for initial, notification, and committed configuration snapshots.
|
||||
Use `configure` to send changes to the agent.
|
||||
|
||||
Publish `session.commands` to advertise slash commands and skills. Each entry carries `name`,
|
||||
`description`, and optional `argumentHint` and `kind`. The composer suggests both kinds at the
|
||||
start of a prompt. Use `kind: "skill"` if the agent accepts the skill inline as part of a normal
|
||||
message. The default kind is `"command"`.
|
||||
|
||||
In the ACP shim, use `command(entry, context)` to return a rewritten entry for each advertised
|
||||
slash command. For example, a plugin with a vendor skill registry can set the kind with
|
||||
`return { ...entry, kind: skills.has(entry.name) ? "skill" : "command" }`.
|
||||
|
||||
`ProviderRegistration.icon` is a file path relative to the plugin directory, such as `icon.svg`.
|
||||
It must resolve inside that directory to a regular file that follows the
|
||||
[SVG icon rules](#svg-rules). Paseo reads and validates the file when the plugin starts; the string
|
||||
|
||||
Reference in New Issue
Block a user