feat(remote): support per-conversation working directories in listener mode (#1323)

This commit is contained in:
Charles Packer
2026-03-10 13:42:42 -07:00
committed by GitHub
parent e82a2d33f8
commit 4c9f63c4e2
13 changed files with 482 additions and 45 deletions

View File

@@ -242,14 +242,11 @@ export function ConversationSelector({
let defaultConversation: EnrichedConversation | null = null;
if (!afterCursor) {
try {
const defaultMessages = await client.conversations.messages.list(
"default",
{
limit: 20,
order: "desc",
agent_id: agentId,
},
);
const defaultMessages = await client.agents.messages.list(agentId, {
conversation_id: "default",
limit: 20,
order: "desc",
});
const defaultMsgItems = defaultMessages.getPaginatedItems();
if (defaultMsgItems.length > 0) {
const defaultStats = getMessageStats(

View File

@@ -24,6 +24,7 @@ export type ClassifyApprovalsOptions<TContext = ApprovalContext | null> = {
getContext?: (
toolName: string,
parsedArgs: Record<string, unknown>,
workingDirectory?: string,
) => Promise<TContext>;
alwaysRequiresUserInput?: (toolName: string) => boolean;
treatAskAsDeny?: boolean;
@@ -31,6 +32,7 @@ export type ClassifyApprovalsOptions<TContext = ApprovalContext | null> = {
missingNameReason?: string;
requireArgsForAutoApprove?: boolean;
missingArgsReason?: (missing: string[]) => string;
workingDirectory?: string;
};
export async function getMissingRequiredArgs(
@@ -74,9 +76,13 @@ export async function classifyApprovals<TContext = ApprovalContext | null>(
approval.toolArgs || "{}",
{},
);
const permission = await checkToolPermission(toolName, parsedArgs);
const permission = await checkToolPermission(
toolName,
parsedArgs,
opts.workingDirectory,
);
const context = opts.getContext
? await opts.getContext(toolName, parsedArgs)
? await opts.getContext(toolName, parsedArgs, opts.workingDirectory)
: null;
let decision = permission.decision;

View File

@@ -159,12 +159,12 @@ export async function runMessagesSubcommand(argv: string[]): Promise<number> {
return 1;
}
const response = await client.conversations.messages.list("default", {
const response = await client.agents.messages.list(agentId, {
conversation_id: "default",
limit: parseLimit(parsed.values.limit, 20),
after: parsed.values.after,
before: parsed.values.before,
order,
agent_id: agentId,
});
const messages = response.getPaginatedItems() ?? [];