mirror of
https://github.com/getpaseo/paseo.git
synced 2026-12-01 04:36:26 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
35a4f0d4a5 |
@@ -213,6 +213,49 @@ function createFakeCodexAppServerProcess(spawn: () => ChildProcessWithoutNullStr
|
||||
};
|
||||
}
|
||||
|
||||
test.each(["create", "resume"] as const)(
|
||||
"keeps Paseo caller identity in the Codex shell policy on %s",
|
||||
async (operation) => {
|
||||
const appServer = createFakeCodexAppServer();
|
||||
const processPort = createFakeCodexAppServerProcess(() => appServer.child);
|
||||
let spawnArgs: string[] | undefined;
|
||||
const provider = new CodexAppServerAgentClient(createTestLogger(), undefined, {
|
||||
appServerProcess: {
|
||||
...processPort,
|
||||
spawn: ({ args }) => {
|
||||
spawnArgs = args;
|
||||
return appServer.child;
|
||||
},
|
||||
},
|
||||
});
|
||||
const internals = castInternals<{
|
||||
goalsEnabledPromise: Promise<boolean> | null;
|
||||
autoReviewEnabledPromise: Promise<boolean> | null;
|
||||
}>(provider);
|
||||
internals.goalsEnabledPromise = Promise.resolve(false);
|
||||
internals.autoReviewEnabledPromise = Promise.resolve(false);
|
||||
const agentId = "00000000-0000-4000-8000-000000000301";
|
||||
const launchContext = { agentId, env: { PASEO_AGENT_ID: agentId } };
|
||||
const session =
|
||||
operation === "create"
|
||||
? await provider.createSession(createConfig(), launchContext)
|
||||
: await provider.resumeSession(
|
||||
{ sessionId: "saved-thread" },
|
||||
createConfig(),
|
||||
launchContext,
|
||||
);
|
||||
try {
|
||||
expect(spawnArgs).toEqual([
|
||||
"app-server",
|
||||
"-c",
|
||||
`shell_environment_policy.set.PASEO_AGENT_ID="${agentId}"`,
|
||||
]);
|
||||
} finally {
|
||||
await session.close();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
async function startPublicSteeringSession(
|
||||
appServer: FakeCodexAppServer,
|
||||
resolveSlashCommandInvocation?: (prompt: AgentPromptInput) => Promise<{
|
||||
|
||||
@@ -8390,6 +8390,13 @@ export class CodexAppServerAgentClient implements AgentClient {
|
||||
const processPort = this.deps.appServerProcess ?? defaultCodexAppServerProcess;
|
||||
const launchPrefix = await processPort.resolvePrefix({ runtimeSettings: this.runtimeSettings });
|
||||
const args = [...launchPrefix.args, "app-server"];
|
||||
if (options.agentId) {
|
||||
// Codex shell inheritance can filter the caller ID out of tool subprocesses.
|
||||
args.push(
|
||||
"-c",
|
||||
`shell_environment_policy.set.PASEO_AGENT_ID=${JSON.stringify(options.agentId)}`,
|
||||
);
|
||||
}
|
||||
if (options.goalsEnabled) {
|
||||
args.push("--enable", "goals");
|
||||
}
|
||||
|
||||
@@ -87,6 +87,7 @@ test("daemon resolves human and managed CLI workspace ownership", async () => {
|
||||
});
|
||||
expect(attachedAgent.workspaceId).toBe(firstWorkspaceId);
|
||||
expect(attachedAgent.cwd).toBe(cwd);
|
||||
expect(attachedAgent.labels[PARENT_AGENT_ID_LABEL]).toBeUndefined();
|
||||
expect(await workspaceIds(client)).toEqual(idsBeforeAttach);
|
||||
|
||||
await expect(
|
||||
@@ -119,6 +120,12 @@ test("daemon resolves human and managed CLI workspace ownership", async () => {
|
||||
expect(crossWorkspaceChild.workspaceId).toBe(secondWorkspaceId);
|
||||
expect(crossWorkspaceChild.cwd).toBe(otherCwd);
|
||||
expect(crossWorkspaceChild.labels[PARENT_AGENT_ID_LABEL]).toBe(firstAgent.id);
|
||||
|
||||
const { entries } = await client.fetchAgents();
|
||||
const childIds = entries
|
||||
.filter(({ agent }) => agent.labels[PARENT_AGENT_ID_LABEL] === firstAgent.id)
|
||||
.map(({ agent }) => agent.id);
|
||||
expect(new Set(childIds)).toEqual(new Set([sameWorkspaceChild.id, crossWorkspaceChild.id]));
|
||||
} finally {
|
||||
await client.close().catch(() => undefined);
|
||||
await daemon.close();
|
||||
|
||||
@@ -58,7 +58,7 @@ Pass through any remaining arguments after the skill name as the skill's own inp
|
||||
|
||||
## Launch and synthesize
|
||||
|
||||
Create the advisor agent via Paseo with a `[Advisor] <topic>` title and the briefing as the initial prompt. Wait for it to finish. Read its response. Synthesize for the user — the advisor's verdict + your recommendation.
|
||||
Create the advisor agent via Paseo with a `[Advisor] <topic>` title and the briefing as the initial prompt. Follow **Agent delegation** in the **paseo** skill to verify parentage. Wait for the result and synthesize the advisor's verdict and your recommendation.
|
||||
|
||||
## Persistent advisor
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ If the user names profiles, use those. If fewer than two suitable profiles are c
|
||||
## Workflow
|
||||
|
||||
1. Write a problem-level prompt
|
||||
2. Create both agents in parallel via Paseo with `[Committee] <task>` titles and the same prompt
|
||||
2. Create both agents in parallel via Paseo with `[Committee] <task>` titles and the same prompt. Follow **Agent delegation** in the **paseo** skill to verify each member's parentage.
|
||||
3. Wait for both responses
|
||||
4. Resolve disagreements by passing their arguments between each other
|
||||
5. Keep going until they converge into a response
|
||||
|
||||
@@ -57,7 +57,7 @@ The receiving agent has zero context. Include:
|
||||
Prepare the handoff in a dedicated workspace:
|
||||
|
||||
1. Select the current workspace or call `create_workspace` with the requested isolation.
|
||||
2. Call `create_agent` with a `[Handoff] <task>` title, the briefing as initial prompt, and the selected `workspaceId` when explicit placement is needed.
|
||||
2. Call `create_agent` with a `[Handoff] <task>` title, the briefing as initial prompt, and the selected `workspaceId` when explicit placement is needed. Follow **Agent delegation** in the **paseo** skill to verify parentage before returning the agent.
|
||||
3. Return the agent and workspace to the user, explaining that it remains in your subagent track until they detach it manually.
|
||||
|
||||
Do not encode independence as a create mode and do not invoke CLI or wire-level detach operations. Detach is a user gesture in the subagents track.
|
||||
|
||||
@@ -92,6 +92,12 @@ Agent-scoped `create_agent` defaults `notifyOnFinish` to true. Set it to `false`
|
||||
|
||||
**`archive_agent`** — `{ agentId }`. Interrupts if running, removes from active list.
|
||||
|
||||
### Agent delegation
|
||||
|
||||
- Create a managed child from its intended Paseo parent using agent-scoped `create_agent`. Use `workspaceId` to place the child in another workspace. If a provider-native child cannot confirm its Paseo caller scope, have the intended parent make the call.
|
||||
- Before delegating with the CLI, verify that `PASEO_AGENT_ID` identifies the intended parent on the target daemon. If the ID is missing or differs, have the intended parent make an agent-scoped call. User-initiated top-level launches can run without a caller.
|
||||
- Read the created child on its host. Compare `get_agent_status` → `snapshot.labels["paseo.parent-agent-id"]` or `paseo agent inspect <child-id> --json` → `ParentAgentId` with the intended parent ID. If the relationship cannot be verified, report the child ID and observed state and pause creation retries until the existing child is accounted for.
|
||||
|
||||
## Sending prompts to agents
|
||||
|
||||
**`send_agent_prompt`** — `{ agentId, prompt, activeTurnBehavior? }`. Sends a follow-up to an existing agent and returns at once.
|
||||
|
||||
Reference in New Issue
Block a user