Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/api/app-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,15 @@ export function createAppHelpers(deps: AppDeps, app: App) {
const claimed = await deps.runs.claimById(runId, "inline", deps.leaseTtlMs);
if (claimed) {
return withAdminLink(
await processRun({ runs: deps.runs, orchestrator: deps.orchestrator, leaseTtlMs: deps.leaseTtlMs }, claimed),
await processRun(
{
runs: deps.runs,
orchestrator: deps.orchestrator,
leaseTtlMs: deps.leaseTtlMs,
...(deps.messageApprovals ? { messageApprovals: deps.messageApprovals } : {}),
},
claimed,
),
);
}
const finished = await deps.runs.waitFor(runId, deps.runWaitMs);
Expand Down
5 changes: 4 additions & 1 deletion src/api/app-turn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ export function createTurnMethods(
...(typeof req.intakePreambleMs === "number" ? { intakePreambleMs: req.intakePreambleMs } : {}),
...(typeof req.clientSentAt === "number" ? { clientSentAt: req.clientSentAt } : {}),
...(req.approval ? { approval: req.approval } : {}),
...(req.messageApprovalContinuation
? { messageApprovalContinuation: structuredClone(req.messageApprovalContinuation) }
: {}),
...(sessionParticipantIds ? { sessionParticipantIds } : {}),
...(projectVersion ? { scopeVersion: projectVersion } : {}),
};
Expand Down Expand Up @@ -437,7 +440,7 @@ export function createTurnMethods(
deps.runs.enqueue({
sessionId: conversation.threadRef,
request,
maxAttempts: deps.maxAttempts,
maxAttempts: request.messageApprovalContinuation ? 1 : deps.maxAttempts,
...(dedupKey ? { dedupKey } : {}),
});
const enqueued = await withCurrentProjectRoster(enqueue);
Expand Down
2 changes: 2 additions & 0 deletions src/api/app-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import type { ProcessRegistry } from "../processes/process-registry.ts";
import type { MonitorStore } from "../monitors/monitor-store.ts";
import type { EngagedRegistry } from "../wake/engaged-registry.ts";
import type { Orchestrator } from "../core/orchestrator.ts";
import type { MessageApprovalService } from "../core/message-approval.ts";
import type { Run, RunDeliveryState, RunStore } from "../runs/run-store.ts";
import type { TurnStream } from "../runs/turn-stream.ts";
import type { SessionStateBus, SessionStateEvent } from "../runs/session-state-bus.ts";
Expand Down Expand Up @@ -510,6 +511,7 @@ export interface AppDeps {
publicWebUrl?: string;
sessions: SessionStore;
orchestrator: Orchestrator;
messageApprovals?: Pick<MessageApprovalService, "reconcileContinuation">;
runs: RunStore;
leaseTtlMs: number;
maxAttempts: number;
Expand Down
3 changes: 2 additions & 1 deletion src/api/routes/turns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ async function postTurn(ctx: ApiCtx): Promise<void> {
ownerKeychainUnion: _ownerKeychainUnion,
spawned: _spawned,
unattendedGrants: _unattendedGrants,
messageApprovalContinuation: _messageApprovalContinuation,
...safeBody
} = body;
} = body as TurnRequest & { messageApprovalContinuation?: unknown };
const resolvedOrigin = publicTurnOrigin(safeBody);
if (resolvedOrigin.error) return sendJson(res, 400, { error: "bad_request", message: resolvedOrigin.error });
const origin = resolvedOrigin.origin;
Expand Down
12 changes: 12 additions & 0 deletions src/api/slack-core-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ interface StoredApprovalView {
reason?: string;
purpose?: string;
summary?: string;
summaryDetail?: string;
matched?: string;
approvalKey?: string;
grantModes?: { session: boolean; always: boolean };
blocksInput?: boolean;
kind?: "approval" | "input";
request?: Record<string, unknown>;
}

Expand Down Expand Up @@ -302,8 +308,14 @@ export function createSlackCoreClient(deps: SlackCoreClientDeps): SlackCoreClien
requestId: record.requestId,
command: record.command,
...(record.reason !== undefined ? { reason: record.reason } : {}),
...(record.matched !== undefined ? { matched: record.matched } : {}),
...(record.purpose !== undefined ? { purpose: record.purpose } : {}),
...(record.summary !== undefined ? { summary: record.summary } : {}),
...(record.summaryDetail !== undefined ? { summaryDetail: record.summaryDetail } : {}),
...(record.approvalKey !== undefined ? { approvalKey: record.approvalKey } : {}),
...(record.grantModes !== undefined ? { grantModes: structuredClone(record.grantModes) } : {}),
...(record.blocksInput !== undefined ? { blocksInput: record.blocksInput } : {}),
...(record.kind !== undefined ? { kind: record.kind } : {}),
...(record.request !== undefined ? { request: record.request as unknown as Record<string, unknown> } : {}),
};
},
Expand Down
Loading