Skip to content

gitflarePublicPartly agent-ready50

cf-workflows-pipeline

Durable content pipeline on Cloudflare Workflows: ingest, extract, summarise with Workers AI via AI Gateway, human approval, publish.

Fix pipeline runs failing at ingest (steps.attempt NOT NULL)629b2fa
TypeScript8 lines483 B
/** Deterministic extractive summary: first N sentences of the text. */export function extractiveSummary(text: string, length: "short" | "medium" | "long"): string {  const n = length === "short" ? 2 : length === "long" ? 8 : 4;  const sentences = text.replace(/\s+/g, " ").trim().match(/[^.!?]+[.!?]+(\s|$)|[^.!?]+$/g) ?? [];  const out = sentences.slice(0, n).map((s) => s.trim()).join(" ");  return (out || text.trim()).slice(0, 1500) || "No text available to summarise.";}