Generation Management API (internal-api/generations.ts)

giselle · ai, AI / Agents, generation, api, server, workspace

Server‑side helpers to fetch, list, cancel, and update AI generations with workspace access enforcement.

// Source: https://github.com/mperkins0155/giselle | License: Apache-2.0 | Copyright 2024 ROUTE06, Inc
// Provided via justclaw.it.com; keep this notice with the code.
"use server";

import type {
	Generation,
	GenerationId,
	GenerationOrigin,
	NodeId,
	QueuedGeneration,
} from "@giselles-ai/protocol";
import { isQueuedGeneration } from "@giselles-ai/protocol";
import { giselle } from "@/app/giselle";
import { assertGenerationResourceAccess } from "@/lib/assert-generation-resource-access";
import { assertWorkspaceAccess } from "@/lib/assert-workspace-access";

export async function getGeneration(input: { generationId: GenerationId }) {
	const generation = await giselle.getGeneration(input.generationId);
	await assertWorkspaceAccess(generation.context.origin.workspaceId);
	return generation

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key