Add agent workflows & stuff
Build and Push Next App / quality (push) Failing after 48s
Build and Push Next App / build-next (push) Has been skipped

This commit is contained in:
Gabriel Brown
2026-06-21 21:15:15 -05:00
parent cf7ff2ee4e
commit 2dfa97ee4f
102 changed files with 8488 additions and 161 deletions
+40
View File
@@ -20,6 +20,19 @@ export const listRecent = query({
},
});
export const listForSpoon = query({
args: { spoonId: v.id('spoons'), limit: v.optional(v.number()) },
handler: async (ctx, { spoonId, limit }) => {
const ownerId = await getRequiredUserId(ctx);
await getOwnedSpoon(ctx, spoonId, ownerId);
return await ctx.db
.query('agentRequests')
.withIndex('by_spoon', (q) => q.eq('spoonId', spoonId))
.order('desc')
.take(limit ?? 25);
},
});
export const create = mutation({
args: {
spoonId: v.id('spoons'),
@@ -35,6 +48,9 @@ export const create = mutation({
ownerId,
prompt: requireText(args.prompt, 'Prompt'),
status: 'queued',
requestType: 'future_code_change',
priority: 'normal',
source: 'user',
targetBranch: optionalText(args.targetBranch),
createdAt: now,
updatedAt: now,
@@ -42,6 +58,30 @@ export const create = mutation({
},
});
export const updatePrompt = mutation({
args: {
requestId: v.id('agentRequests'),
prompt: v.string(),
targetBranch: v.optional(v.string()),
},
handler: async (ctx, args) => {
const ownerId = await getRequiredUserId(ctx);
const request = await ctx.db.get(args.requestId);
if (request?.ownerId !== ownerId) {
throw new ConvexError('Agent request not found.');
}
if (request.status !== 'draft' && request.status !== 'queued') {
throw new ConvexError('Only draft or queued requests can be edited.');
}
await ctx.db.patch(args.requestId, {
prompt: requireText(args.prompt, 'Prompt'),
targetBranch: optionalText(args.targetBranch),
updatedAt: Date.now(),
});
return { success: true };
},
});
export const cancel = mutation({
args: { requestId: v.id('agentRequests') },
handler: async (ctx, { requestId }) => {