Skip to content

Commit 311302c

Browse files
committed
feat(gateway): task-suggestion acceptance modes with compact split-button card
- taskSuggestions.accept gains additive mode (worktree default | local | cloud | session) + cloudProfileId; operator.admin unchanged; worktree requests stay {taskId}-only for older gateways - local reuses the plain-cwd create; cloud mirrors the Control UI create-empty -> sessions.dispatch -> send sequence with pre-claim profile validation and full rollback; session delivers the prompt into the source session (steer single active run, plain turn when idle, ambiguous refused) and can only cancel the chip on failure, never touch the source session - Control UI card redesigned per owner reference: repo-basename eyebrow, clamped summary, instructions expander, split button with per-profile cloud items or a disabled "No cloud environment configured" hint - TUI gains the same modes as selector rows with capability gating and double-Enter arming Release-note context: operators now choose where an accepted follow-up runs — isolated worktree (default), the project checkout, a configured cloud worker, or as the next instruction in the current session — from a compact suggestion card.
1 parent ad1a2cd commit 311302c

29 files changed

Lines changed: 1488 additions & 283 deletions

‎apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9378,15 +9378,23 @@ public struct TaskSuggestion: Codable, Sendable {
93789378

93799379
public struct TaskSuggestionsAcceptParams: Codable, Sendable {
93809380
public let taskid: String
9381+
public let mode: String?
9382+
public let cloudprofileid: String?
93819383

93829384
public init(
9383-
taskid: String)
9385+
taskid: String,
9386+
mode: String? = nil,
9387+
cloudprofileid: String? = nil)
93849388
{
93859389
self.taskid = taskid
9390+
self.mode = mode
9391+
self.cloudprofileid = cloudprofileid
93869392
}
93879393

93889394
private enum CodingKeys: String, CodingKey {
93899395
case taskid = "taskId"
9396+
case mode
9397+
case cloudprofileid = "cloudProfileId"
93909398
}
93919399
}
93929400

‎docs/.generated/plugin-sdk-api-baseline.sha256‎

Lines changed: 37 additions & 37 deletions
Large diffs are not rendered by default.

‎docs/gateway/config-tools.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Local onboarding defaults new local configs to `tools.profile: "coding"` when un
4747
| `group:openclaw` | All built-in tools above except `read`/`write`/`edit`/`apply_patch`/`exec`/`process`/`canvas` (excludes plugin tools) |
4848
| `group:plugins` | Tools owned by loaded plugins, including configured MCP servers exposed through `bundle-mcp` |
4949

50-
`spawn_task` lets a coding agent propose confirmed follow-up work without starting it. The suggestion's project directory must be a git checkout; invalid suggestions, including a non-git directory or blank prompt, are rejected when the tool records them. The Control UI shows the title and summary as an actionable chip; a Gateway-backed TUI shows an equivalent interactive prompt. Accepting either creates a fresh managed-worktree session and sends the full prompt there while the current turn continues. `dismiss_task` withdraws a still-pending suggestion by the ephemeral `task_id` returned from `spawn_task`.
50+
`spawn_task` lets a coding agent propose confirmed follow-up work without starting it. The suggestion's project directory must be a git checkout; invalid suggestions, including a non-git directory or blank prompt, are rejected when the tool records them. The Control UI shows the title and summary as an actionable chip; a Gateway-backed TUI shows an equivalent interactive prompt. Accepting a suggestion can start it in a fresh managed worktree (the default), start it locally in a new session in the suggested checkout, send it to a cloud worker profile when one is configured, or deliver it into the source session. OpenClaw sends the full prompt to the selected destination while the current turn continues. `dismiss_task` withdraws a still-pending suggestion by the ephemeral `task_id` returned from `spawn_task`.
5151

5252
The tools are offered only when the initiating operator surface can receive and action Gateway task-suggestion events. Channel sessions and local/embedded TUI sessions do not receive them; channel transports need a portable typed task action before they can safely expose this flow. Suggestions are process-local and disappear when the Gateway restarts. Both tools remain in the `coding` profile and `group:sessions`, so normal `tools.allow` and `tools.deny` policy configures them automatically when the surface supports them.
5353

‎packages/gateway-protocol/src/schema/task-suggestions.ts‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ const TaskTldrSchema = Type.String({ minLength: 1, maxLength: 1_024, pattern: "\
1010
const TaskCwdSchema = Type.String({ minLength: 1, maxLength: 4_096 });
1111
const TaskSessionKeySchema = Type.String({ minLength: 1, maxLength: 512 });
1212
const TaskAgentIdSchema = Type.String({ minLength: 1, maxLength: 128 });
13+
const TaskSuggestionAcceptanceModeSchema = Type.Enum(
14+
{
15+
WORKTREE: "worktree",
16+
LOCAL: "local",
17+
CLOUD: "cloud",
18+
SESSION: "session",
19+
} as const,
20+
{ type: "string" },
21+
);
1322

1423
/** One model-proposed follow-up task waiting for operator action. */
1524
export const TaskSuggestionSchema = closedObject({
@@ -54,8 +63,12 @@ export const TaskSuggestionResolutionSchema = Type.Union([
5463
Type.Literal("expired"),
5564
]);
5665

57-
/** Atomically claims a pending suggestion and starts its server-owned worktree session. */
58-
export const TaskSuggestionsAcceptParamsSchema = closedObject({ taskId: TaskIdSchema });
66+
/** Atomically claims a pending suggestion and starts it in the requested execution mode. */
67+
export const TaskSuggestionsAcceptParamsSchema = closedObject({
68+
taskId: TaskIdSchema,
69+
mode: Type.Optional(TaskSuggestionAcceptanceModeSchema),
70+
cloudProfileId: Type.Optional(Type.String({ minLength: 1, maxLength: 128 })),
71+
});
5972

6073
export const TaskSuggestionsAcceptResultSchema = closedObject({
6174
taskId: TaskIdSchema,

‎src/gateway/server-methods/environments.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function listWorkerEnvironments(context: GatewayRequestContext): WorkerEnvironme
114114
return [];
115115
}
116116
}
117-
function listWorkerProfiles(context: GatewayRequestContext) {
117+
export function listWorkerProfiles(context: GatewayRequestContext) {
118118
if (!context.workerEnvironmentService || !context.workerPlacementDispatchService) {
119119
return [];
120120
}

0 commit comments

Comments
 (0)