mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-17 05:00:20 +00:00
wip(foundry): capture remaining local changes
This commit is contained in:
parent
6f85b59f31
commit
40bed3b0a1
6 changed files with 25 additions and 43 deletions
|
|
@ -32,7 +32,6 @@ CREATE TABLE \`task_index\` (
|
||||||
--> statement-breakpoint
|
--> statement-breakpoint
|
||||||
CREATE TABLE \`tasks\` (
|
CREATE TABLE \`tasks\` (
|
||||||
\`task_id\` text PRIMARY KEY NOT NULL,
|
\`task_id\` text PRIMARY KEY NOT NULL,
|
||||||
\`repo_id\` text NOT NULL,
|
|
||||||
\`title\` text NOT NULL,
|
\`title\` text NOT NULL,
|
||||||
\`status\` text NOT NULL,
|
\`status\` text NOT NULL,
|
||||||
\`repo_name\` text NOT NULL,
|
\`repo_name\` text NOT NULL,
|
||||||
|
|
|
||||||
|
|
@ -41,19 +41,3 @@ export const tasks = sqliteTable("tasks", {
|
||||||
pullRequestJson: text("pull_request_json"),
|
pullRequestJson: text("pull_request_json"),
|
||||||
sessionsSummaryJson: text("sessions_summary_json").notNull().default("[]"),
|
sessionsSummaryJson: text("sessions_summary_json").notNull().default("[]"),
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* Materialized task summary projection owned by the repository coordinator.
|
|
||||||
* Task actors push updates here; organization reads fan in through repositories.
|
|
||||||
*/
|
|
||||||
export const tasks = sqliteTable("tasks", {
|
|
||||||
taskId: text("task_id").notNull().primaryKey(),
|
|
||||||
repoId: text("repo_id").notNull(),
|
|
||||||
title: text("title").notNull(),
|
|
||||||
status: text("status").notNull(),
|
|
||||||
repoName: text("repo_name").notNull(),
|
|
||||||
updatedAtMs: integer("updated_at_ms").notNull(),
|
|
||||||
branch: text("branch"),
|
|
||||||
pullRequestJson: text("pull_request_json"),
|
|
||||||
sessionsSummaryJson: text("sessions_summary_json").notNull().default("[]"),
|
|
||||||
});
|
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ interface TaskActionCommand {
|
||||||
|
|
||||||
interface TaskSessionCommand {
|
interface TaskSessionCommand {
|
||||||
sessionId: string;
|
sessionId: string;
|
||||||
|
authSessionId?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface TaskStatusSyncCommand {
|
interface TaskStatusSyncCommand {
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ const commandHandlers: Record<TaskQueueName, WorkflowHandler> = {
|
||||||
},
|
},
|
||||||
|
|
||||||
"task.command.workspace.mark_unread": async (loopCtx, msg) => {
|
"task.command.workspace.mark_unread": async (loopCtx, msg) => {
|
||||||
await loopCtx.step("workspace-mark-unread", async () => markWorkspaceUnread(loopCtx));
|
await loopCtx.step("workspace-mark-unread", async () => markWorkspaceUnread(loopCtx, msg.body?.authSessionId));
|
||||||
await msg.complete({ ok: true });
|
await msg.complete({ ok: true });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -127,7 +127,7 @@ const commandHandlers: Record<TaskQueueName, WorkflowHandler> = {
|
||||||
const created = await loopCtx.step({
|
const created = await loopCtx.step({
|
||||||
name: "workspace-create-session",
|
name: "workspace-create-session",
|
||||||
timeout: 5 * 60_000,
|
timeout: 5 * 60_000,
|
||||||
run: async () => createWorkspaceSession(loopCtx, msg.body?.model),
|
run: async () => createWorkspaceSession(loopCtx, msg.body?.model, msg.body?.authSessionId),
|
||||||
});
|
});
|
||||||
await msg.complete(created);
|
await msg.complete(created);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
@ -140,12 +140,12 @@ const commandHandlers: Record<TaskQueueName, WorkflowHandler> = {
|
||||||
const created = await loopCtx.step({
|
const created = await loopCtx.step({
|
||||||
name: "workspace-create-session-for-send",
|
name: "workspace-create-session-for-send",
|
||||||
timeout: 5 * 60_000,
|
timeout: 5 * 60_000,
|
||||||
run: async () => createWorkspaceSession(loopCtx, msg.body?.model),
|
run: async () => createWorkspaceSession(loopCtx, msg.body?.model, msg.body?.authSessionId),
|
||||||
});
|
});
|
||||||
await loopCtx.step({
|
await loopCtx.step({
|
||||||
name: "workspace-send-initial-message",
|
name: "workspace-send-initial-message",
|
||||||
timeout: 5 * 60_000,
|
timeout: 5 * 60_000,
|
||||||
run: async () => sendWorkspaceMessage(loopCtx, created.sessionId, msg.body.text, []),
|
run: async () => sendWorkspaceMessage(loopCtx, created.sessionId, msg.body.text, [], msg.body?.authSessionId),
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logActorWarning("task.workflow", "create_session_and_send failed", {
|
logActorWarning("task.workflow", "create_session_and_send failed", {
|
||||||
|
|
@ -159,7 +159,7 @@ const commandHandlers: Record<TaskQueueName, WorkflowHandler> = {
|
||||||
await loopCtx.step({
|
await loopCtx.step({
|
||||||
name: "workspace-ensure-session",
|
name: "workspace-ensure-session",
|
||||||
timeout: 5 * 60_000,
|
timeout: 5 * 60_000,
|
||||||
run: async () => ensureWorkspaceSession(loopCtx, msg.body.sessionId, msg.body?.model),
|
run: async () => ensureWorkspaceSession(loopCtx, msg.body.sessionId, msg.body?.model, msg.body?.authSessionId),
|
||||||
});
|
});
|
||||||
await msg.complete({ ok: true });
|
await msg.complete({ ok: true });
|
||||||
},
|
},
|
||||||
|
|
@ -170,12 +170,16 @@ const commandHandlers: Record<TaskQueueName, WorkflowHandler> = {
|
||||||
},
|
},
|
||||||
|
|
||||||
"task.command.workspace.set_session_unread": async (loopCtx, msg) => {
|
"task.command.workspace.set_session_unread": async (loopCtx, msg) => {
|
||||||
await loopCtx.step("workspace-set-session-unread", async () => setWorkspaceSessionUnread(loopCtx, msg.body.sessionId, msg.body.unread));
|
await loopCtx.step("workspace-set-session-unread", async () =>
|
||||||
|
setWorkspaceSessionUnread(loopCtx, msg.body.sessionId, msg.body.unread, msg.body?.authSessionId),
|
||||||
|
);
|
||||||
await msg.complete({ ok: true });
|
await msg.complete({ ok: true });
|
||||||
},
|
},
|
||||||
|
|
||||||
"task.command.workspace.update_draft": async (loopCtx, msg) => {
|
"task.command.workspace.update_draft": async (loopCtx, msg) => {
|
||||||
await loopCtx.step("workspace-update-draft", async () => updateWorkspaceDraft(loopCtx, msg.body.sessionId, msg.body.text, msg.body.attachments));
|
await loopCtx.step("workspace-update-draft", async () =>
|
||||||
|
updateWorkspaceDraft(loopCtx, msg.body.sessionId, msg.body.text, msg.body.attachments, msg.body?.authSessionId),
|
||||||
|
);
|
||||||
await msg.complete({ ok: true });
|
await msg.complete({ ok: true });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -189,7 +193,7 @@ const commandHandlers: Record<TaskQueueName, WorkflowHandler> = {
|
||||||
await loopCtx.step({
|
await loopCtx.step({
|
||||||
name: "workspace-send-message",
|
name: "workspace-send-message",
|
||||||
timeout: 10 * 60_000,
|
timeout: 10 * 60_000,
|
||||||
run: async () => sendWorkspaceMessage(loopCtx, msg.body.sessionId, msg.body.text, msg.body.attachments),
|
run: async () => sendWorkspaceMessage(loopCtx, msg.body.sessionId, msg.body.text, msg.body.attachments, msg.body?.authSessionId),
|
||||||
});
|
});
|
||||||
await msg.complete({ ok: true });
|
await msg.complete({ ok: true });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
@ -233,7 +237,7 @@ const commandHandlers: Record<TaskQueueName, WorkflowHandler> = {
|
||||||
await loopCtx.step({
|
await loopCtx.step({
|
||||||
name: "workspace-close-session",
|
name: "workspace-close-session",
|
||||||
timeout: 5 * 60_000,
|
timeout: 5 * 60_000,
|
||||||
run: async () => closeWorkspaceSession(loopCtx, msg.body.sessionId),
|
run: async () => closeWorkspaceSession(loopCtx, msg.body.sessionId, msg.body?.authSessionId),
|
||||||
});
|
});
|
||||||
await msg.complete({ ok: true });
|
await msg.complete({ ok: true });
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1328,14 +1328,6 @@ export async function publishWorkspacePr(c: any): Promise<void> {
|
||||||
githubToken: auth?.githubToken ?? null,
|
githubToken: auth?.githubToken ?? null,
|
||||||
baseBranch: metadata.defaultBranch ?? undefined,
|
baseBranch: metadata.defaultBranch ?? undefined,
|
||||||
});
|
});
|
||||||
await c.db
|
|
||||||
.update(taskTable)
|
|
||||||
.set({
|
|
||||||
prSubmitted: 1,
|
|
||||||
updatedAt: Date.now(),
|
|
||||||
})
|
|
||||||
.where(eq(taskTable.id, 1))
|
|
||||||
.run();
|
|
||||||
await broadcastTaskUpdate(c);
|
await broadcastTaskUpdate(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,15 +104,16 @@ export interface WorkspaceParsedDiffLine {
|
||||||
|
|
||||||
export interface WorkspacePullRequestSummary {
|
export interface WorkspacePullRequestSummary {
|
||||||
number: number;
|
number: number;
|
||||||
title: string;
|
status: "draft" | "ready";
|
||||||
state: string;
|
title?: string;
|
||||||
url: string;
|
state?: string;
|
||||||
headRefName: string;
|
url?: string;
|
||||||
baseRefName: string;
|
headRefName?: string;
|
||||||
repoFullName: string;
|
baseRefName?: string;
|
||||||
authorLogin: string | null;
|
repoFullName?: string;
|
||||||
isDraft: boolean;
|
authorLogin?: string | null;
|
||||||
updatedAtMs: number;
|
isDraft?: boolean;
|
||||||
|
updatedAtMs?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WorkspaceSandboxSummary {
|
export interface WorkspaceSandboxSummary {
|
||||||
|
|
@ -241,6 +242,7 @@ export interface TaskWorkspaceRenameInput {
|
||||||
repoId: string;
|
repoId: string;
|
||||||
taskId: string;
|
taskId: string;
|
||||||
value: string;
|
value: string;
|
||||||
|
authSessionId?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaskWorkspaceSendMessageInput {
|
export interface TaskWorkspaceSendMessageInput {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue