mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-17 06:04:56 +00:00
Fix Foundry handoff creation flow
This commit is contained in:
parent
6d7e67fe72
commit
5e733e8b37
9 changed files with 30 additions and 15 deletions
|
|
@ -51,6 +51,7 @@ export interface HandoffInput {
|
|||
agentType: AgentType | null;
|
||||
explicitTitle: string | null;
|
||||
explicitBranchName: string | null;
|
||||
initialPrompt: string | null;
|
||||
}
|
||||
|
||||
interface InitializeCommand {
|
||||
|
|
@ -129,6 +130,7 @@ export const handoff = actor({
|
|||
agentType: input.agentType,
|
||||
explicitTitle: input.explicitTitle,
|
||||
explicitBranchName: input.explicitBranchName,
|
||||
initialPrompt: input.initialPrompt,
|
||||
initialized: false,
|
||||
previousStatus: null as string | null,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -413,7 +413,10 @@ export async function initCreateSessionActivity(
|
|||
: undefined;
|
||||
|
||||
return await sandboxInstance.createSession({
|
||||
prompt: buildAgentPrompt(loopCtx.state.task),
|
||||
prompt:
|
||||
typeof loopCtx.state.initialPrompt === "string"
|
||||
? loopCtx.state.initialPrompt
|
||||
: buildAgentPrompt(loopCtx.state.task),
|
||||
cwd,
|
||||
agent: (loopCtx.state.agentType ?? config.default_agent) as any
|
||||
});
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ interface CreateHandoffCommand {
|
|||
agentType: AgentType | null;
|
||||
explicitTitle: string | null;
|
||||
explicitBranchName: string | null;
|
||||
initialPrompt: string | null;
|
||||
onBranch: string | null;
|
||||
}
|
||||
|
||||
|
|
@ -387,7 +388,8 @@ async function createHandoffMutation(c: any, cmd: CreateHandoffCommand): Promise
|
|||
providerId: cmd.providerId,
|
||||
agentType: cmd.agentType,
|
||||
explicitTitle: onBranch ? null : cmd.explicitTitle,
|
||||
explicitBranchName: onBranch ? null : cmd.explicitBranchName
|
||||
explicitBranchName: onBranch ? null : cmd.explicitBranchName,
|
||||
initialPrompt: cmd.initialPrompt,
|
||||
});
|
||||
} catch (error) {
|
||||
if (onBranch) {
|
||||
|
|
|
|||
|
|
@ -295,6 +295,7 @@ async function createHandoffMutation(c: any, input: CreateHandoffInput): Promise
|
|||
agentType: input.agentType ?? null,
|
||||
explicitTitle: input.explicitTitle ?? null,
|
||||
explicitBranchName: input.explicitBranchName ?? null,
|
||||
initialPrompt: input.initialPrompt ?? null,
|
||||
onBranch: input.onBranch ?? null
|
||||
});
|
||||
|
||||
|
|
@ -312,9 +313,10 @@ async function createHandoffMutation(c: any, input: CreateHandoffInput): Promise
|
|||
|
||||
const handoff = getHandoff(c, c.state.workspaceId, repoId, created.handoffId);
|
||||
await handoff.provision({ providerId });
|
||||
const provisioned = await handoff.get();
|
||||
|
||||
await workspaceActions.notifyWorkbenchUpdated(c);
|
||||
return created;
|
||||
return provisioned;
|
||||
}
|
||||
|
||||
async function refreshProviderProfilesMutation(c: any, command?: RefreshProviderProfilesCommand): Promise<void> {
|
||||
|
|
@ -440,16 +442,20 @@ export const workspaceActions = {
|
|||
c.broadcast("workbenchUpdated", { at: Date.now() });
|
||||
},
|
||||
|
||||
async createWorkbenchHandoff(c: any, input: HandoffWorkbenchCreateHandoffInput): Promise<{ handoffId: string }> {
|
||||
async createWorkbenchHandoff(c: any, input: HandoffWorkbenchCreateHandoffInput): Promise<{ handoffId: string; tabId?: string }> {
|
||||
const created = await workspaceActions.createHandoff(c, {
|
||||
workspaceId: c.state.workspaceId,
|
||||
repoId: input.repoId,
|
||||
task: input.task,
|
||||
...(input.title ? { explicitTitle: input.title } : {}),
|
||||
...(input.branch ? { explicitBranchName: input.branch } : {}),
|
||||
...(input.initialPrompt !== undefined ? { initialPrompt: input.initialPrompt } : {}),
|
||||
...(input.model ? { agentType: agentTypeForModel(input.model) } : {})
|
||||
});
|
||||
return { handoffId: created.handoffId };
|
||||
return {
|
||||
handoffId: created.handoffId,
|
||||
...(created.activeSessionId ? { tabId: created.activeSessionId } : {}),
|
||||
};
|
||||
},
|
||||
|
||||
async markWorkbenchUnread(c: any, input: HandoffWorkbenchSelectInput): Promise<void> {
|
||||
|
|
|
|||
|
|
@ -661,19 +661,13 @@ export function MockLayout({ workspaceId, selectedHandoffId, selectedSessionId }
|
|||
throw new Error("Cannot create a handoff without an available repo");
|
||||
}
|
||||
|
||||
const task = window.prompt("Describe the handoff task", "Investigate and implement the requested change");
|
||||
if (!task) {
|
||||
return;
|
||||
}
|
||||
|
||||
const title = window.prompt("Optional handoff title", "")?.trim() || undefined;
|
||||
const branch = window.prompt("Optional branch name", "")?.trim() || undefined;
|
||||
const task = "New task";
|
||||
const { handoffId, tabId } = await handoffWorkbenchClient.createHandoff({
|
||||
repoId,
|
||||
task,
|
||||
title: task,
|
||||
model: "gpt-4o",
|
||||
...(title ? { title } : {}),
|
||||
...(branch ? { branch } : {}),
|
||||
initialPrompt: "",
|
||||
});
|
||||
await navigate({
|
||||
to: "/workspaces/$workspaceId/handoffs/$handoffId",
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ export const CreateHandoffInputSchema = z.object({
|
|||
task: z.string().min(1),
|
||||
explicitTitle: z.string().trim().min(1).optional(),
|
||||
explicitBranchName: z.string().trim().min(1).optional(),
|
||||
initialPrompt: z.string().optional(),
|
||||
providerId: ProviderIdSchema.optional(),
|
||||
agentType: AgentTypeSchema.optional(),
|
||||
onBranch: z.string().trim().min(1).optional()
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@ export interface HandoffWorkbenchCreateHandoffInput {
|
|||
title?: string;
|
||||
branch?: string;
|
||||
model?: WorkbenchModelId;
|
||||
initialPrompt?: string;
|
||||
}
|
||||
|
||||
export interface HandoffWorkbenchRenameInput {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue