mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-20 22:02:42 +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> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue