feat(workflows): add explicit session targeting (#3557)

This commit is contained in:
Carlos Florêncio
2026-09-10 16:32:41 +01:00
committed by GitHub
parent 65d64f6fa9
commit 004a7a55db
119 changed files with 7289 additions and 711 deletions
+7
View File
@@ -11,6 +11,7 @@ import type {
AgentProfileRecentUseApiRecord,
WorkflowProfileSessionStartPolicy,
WorkflowProfileSessionEndPolicy,
WorkflowSessionTarget,
TaskPriority,
SidebarTaskColorPatchApi,
} from "../../lib/types/http";
@@ -198,6 +199,7 @@ type CreateTaskOpts = {
workflow_id?: string;
workflow_step_id?: string;
agent_profile_id?: string;
session_target?: WorkflowSessionTarget | null;
executor_profile_id?: string;
repository_ids?: string[];
repositories?: TaskRepositoryInput[];
@@ -266,6 +268,7 @@ function buildCreateTaskBody(
setIf(body, "workflow_id", options.workflow_id);
setIf(body, "workflow_step_id", options.workflow_step_id);
setIf(body, "agent_profile_id", options.agent_profile_id);
if (options.session_target !== undefined) body.session_target = options.session_target;
setIf(body, "executor_profile_id", options.executor_profile_id);
setIf(body, "metadata", buildTaskMetadata(options));
setIf(
@@ -492,6 +495,7 @@ export class ApiClient {
workflow_step_id?: string;
/** Stored in task.Metadata so auto_start_agent can pick it up on on_enter. */
agent_profile_id?: string;
session_target?: WorkflowSessionTarget | null;
/** Executor profile used when the task session is prepared. */
executor_profile_id?: string;
/** Repository IDs to associate with the task (required for agent execution). */
@@ -819,6 +823,7 @@ export class ApiClient {
opts?: {
is_start_step?: boolean;
agent_profile_id?: string;
session_target?: WorkflowSessionTarget | null;
profile_session_start_policy?: WorkflowProfileSessionStartPolicy;
profile_session_end_policy?: WorkflowProfileSessionEndPolicy;
complete_task_on_enter?: boolean;
@@ -835,6 +840,7 @@ export class ApiClient {
position,
...(opts?.is_start_step != null ? { is_start_step: opts.is_start_step } : {}),
...(opts?.agent_profile_id ? { agent_profile_id: opts.agent_profile_id } : {}),
...(opts?.session_target !== undefined ? { session_target: opts.session_target } : {}),
...(opts?.profile_session_start_policy
? { profile_session_start_policy: opts.profile_session_start_policy }
: {}),
@@ -1279,6 +1285,7 @@ export class ApiClient {
stage_type?: "work" | "review" | "approval" | "custom";
profile_session_start_policy?: WorkflowProfileSessionStartPolicy;
profile_session_end_policy?: WorkflowProfileSessionEndPolicy;
session_target?: WorkflowSessionTarget | null;
},
): Promise<void> {
await this.request("PUT", `/api/v1/workflow/steps/${stepId}`, { id: stepId, ...updates });