apps/gateway/src/routes/execute.ts
Metadata
- Purpose: Gateway HTTP route handlers and request/response behavior.
- Domain:
applications - Language:
ts - Bytes: 15124
- Lines: 396
- Content hash (short):
f307ced1 - Source (start): apps/gateway/src/routes/execute.ts:1
- Source (end): apps/gateway/src/routes/execute.ts:396
Indexed Symbols
No indexed functions/methods detected in this file.
Markdown Headings (if applicable)
No markdown headings detected.
Source Preview
import type { FastifyPluginAsync } from "fastify";
import { createHmac, randomUUID, timingSafeEqual } from "node:crypto";
import { executeAgentRequestSchema, workflowControlRequestSchema } from "@anchor/contracts";
import { env } from "../config/env.js";
import { enqueueAgentExecution } from "../services/agentfield-client.js";
import { buildAuditCredential } from "../services/audit.js";
import { getEffectivePlatformSettings, resolveSecretValue } from "../services/runtime-config.js";
import { recordWebhookReceipt } from "../services/webhook-repository.js";
import {
cancelWorkflowExecution,
getWorkflowExecutionById,
listWorkflowCallbacks,
listAuditCredentials,
listWorkflowExecutions,
persistAuditCredential,
persistWorkflowCompletion,
persistWorkflowExecution
} from "../services/workflow-repository.js";
import { getIdempotencyKey, getIdempotencyRouteScope } from "../utils/idempotency.js";
import { getWorkspaceIdFromHeaders } from "../utils/workspace.js";
import { ensureRoles } from "../utils/authorization.js";
export const executionRoutes: FastifyPluginAsync = async (app) => {
app.get("/api/v1/workflow-executions", async (request, reply) => {
if (!ensureRoles(request, reply, ["msp_admin", "ops_engineer", "viewer", "automation_operator"])) {