Move to threads based system.
This commit is contained in:
@@ -13,21 +13,28 @@ const reasoningEffort = v.union(
|
||||
v.literal('xhigh'),
|
||||
);
|
||||
|
||||
const agentModel = v.union(
|
||||
v.literal('gpt-5.1-codex'),
|
||||
v.literal('gpt-5.5'),
|
||||
v.literal('gpt-5.5-pro'),
|
||||
v.literal('gpt-5.4'),
|
||||
v.literal('gpt-5.4-mini'),
|
||||
const runtime = v.literal('opencode');
|
||||
|
||||
const envFilePath = v.union(
|
||||
v.literal('.env'),
|
||||
v.literal('.env.local'),
|
||||
v.literal('.env.production'),
|
||||
v.literal('.env.production.local'),
|
||||
v.literal('custom'),
|
||||
);
|
||||
|
||||
const defaults = {
|
||||
enabled: true,
|
||||
runtime: 'opencode' as const,
|
||||
branchPrefix: 'spoon/agent',
|
||||
agentModel: 'gpt-5.1-codex',
|
||||
reasoningEffort: 'high' as const,
|
||||
agentModel: '',
|
||||
reasoningEffort: 'medium' as const,
|
||||
maxJobDurationMs: 1_800_000,
|
||||
maxOutputBytes: 200_000,
|
||||
envFilePath: '.env.local' as const,
|
||||
materializeEnvFileByDefault: false,
|
||||
autoDetectCommands: true,
|
||||
allowUserFileEditing: true,
|
||||
};
|
||||
|
||||
export const getForSpoon = query({
|
||||
@@ -60,10 +67,18 @@ export const update = mutation({
|
||||
installCommand: v.optional(v.string()),
|
||||
checkCommand: v.optional(v.string()),
|
||||
testCommand: v.optional(v.string()),
|
||||
agentModel: v.optional(agentModel),
|
||||
runtime: v.optional(runtime),
|
||||
agentModel: v.optional(v.string()),
|
||||
reasoningEffort: v.optional(reasoningEffort),
|
||||
maxJobDurationMs: v.optional(v.number()),
|
||||
maxOutputBytes: v.optional(v.number()),
|
||||
envFilePath: v.optional(envFilePath),
|
||||
customEnvFilePath: v.optional(v.string()),
|
||||
materializeEnvFileByDefault: v.optional(v.boolean()),
|
||||
autoDetectCommands: v.optional(v.boolean()),
|
||||
allowUserFileEditing: v.optional(v.boolean()),
|
||||
aiProviderProfileId: v.optional(v.id('aiProviderProfiles')),
|
||||
clearAiProviderProfile: v.optional(v.boolean()),
|
||||
},
|
||||
handler: async (ctx, args) => {
|
||||
const ownerId = await getRequiredUserId(ctx);
|
||||
@@ -107,6 +122,9 @@ export const update = mutation({
|
||||
if (args.testCommand !== undefined) {
|
||||
patch.testCommand = optionalText(args.testCommand);
|
||||
}
|
||||
if (args.runtime !== undefined) {
|
||||
patch.runtime = 'opencode';
|
||||
}
|
||||
if (args.agentModel !== undefined) {
|
||||
patch.agentModel = optionalText(args.agentModel) ?? defaults.agentModel;
|
||||
}
|
||||
@@ -119,6 +137,31 @@ export const update = mutation({
|
||||
if (args.maxOutputBytes !== undefined) {
|
||||
patch.maxOutputBytes = Math.max(10_000, args.maxOutputBytes);
|
||||
}
|
||||
if (args.envFilePath !== undefined) {
|
||||
patch.envFilePath = args.envFilePath;
|
||||
}
|
||||
if (args.customEnvFilePath !== undefined) {
|
||||
patch.customEnvFilePath = optionalText(args.customEnvFilePath);
|
||||
}
|
||||
if (args.materializeEnvFileByDefault !== undefined) {
|
||||
patch.materializeEnvFileByDefault = args.materializeEnvFileByDefault;
|
||||
}
|
||||
if (args.autoDetectCommands !== undefined) {
|
||||
patch.autoDetectCommands = args.autoDetectCommands;
|
||||
}
|
||||
if (args.allowUserFileEditing !== undefined) {
|
||||
patch.allowUserFileEditing = args.allowUserFileEditing;
|
||||
}
|
||||
if (args.aiProviderProfileId !== undefined) {
|
||||
const profile = await ctx.db.get(args.aiProviderProfileId);
|
||||
if (profile?.ownerId !== ownerId) {
|
||||
throw new Error('AI provider profile not found.');
|
||||
}
|
||||
patch.aiProviderProfileId = args.aiProviderProfileId;
|
||||
}
|
||||
if (args.clearAiProviderProfile) {
|
||||
patch.aiProviderProfileId = undefined;
|
||||
}
|
||||
|
||||
await ctx.db.patch(settings._id, patch);
|
||||
return { success: true };
|
||||
|
||||
Reference in New Issue
Block a user