feat(FN-1524): add POST /routines/:id/trigger endpoint

- Add POST /routines/:id/trigger as canonical endpoint for manual routine triggers
- Keep POST /routines/:id/run as backward-compatible alias
- Remove duplicate recordRun calls from routine route handlers (persistence handled by RoutineRunner)
- Update webhook auth to return 401 instead of 403 for signature failures
- Fix TypeScript types for promptOverrides to support null values (delete semantics)
- Fix API endpoint to return empty diff stats when worktree doesn't exist
This commit is contained in:
gsxdsm
2026-04-14 09:28:05 -07:00
parent 2d7da656e4
commit 0363450dff
6 changed files with 22 additions and 23 deletions

View File

@@ -15,9 +15,9 @@
import { randomUUID } from "node:crypto";
// Dynamic import for @fusion/core to get prompt override resolution
type PromptOverrideMap = Record<string, string | undefined>;
type PromptOverrideMap = Record<string, string | null>;
type ResolvePromptFn = (key: string, overrides?: PromptOverrideMap) => string;
let resolvePrompt: ResolvePromptFn = () => "";
let promptCatalogReady = false;
@@ -414,7 +414,7 @@ export function parseGenerationResponse(text: string): AgentGenerationSpec {
*
* @param ip - Client IP for rate limiting
* @param roleDescription - The user's description of the desired agent role
* @returns Session object (without spec call generateAgentSpec to populate)
* @returns Session object (without spec - call generateAgentSpec to populate)
*/
export async function startAgentGeneration(
ip: string,