Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| The artifacts service is services/artifacts, the Worker g1t-artifacts, bound as ARTIFACTS by the API, the site and the agents; its live rooms move to it with a Durable Object transfer from g1t-docs-service, and its database, bucket, indexes and queue keep their names. The git store's binding and settings are GITSTORE, its ops scripts gitstore-*, and workflow run artifacts keep their compatible API under run_artifacts modules. The deploy tool puts a Worker that has never deployed before the Workers in its stage that bind to it, and the deploy guide gives the cutover runbook. | 1 | /** |
| 2 | * What the artifacts service tells the rest of g1t about folios: `folio.*` | |
| 3 | * events on the bus (packages/contracts events.ts, `FolioEventData`). | |
| 4 | * Published with no `repoId`, so a folio never reaches a repository's | |
| 5 | * timeline or webhooks, and with a title only when the whole workspace | |
| 6 | * can read the folio. Never throws: an event that can't be told is | |
| 7 | * logged, and the change it is about still happened. | |
| 8 | */ | |
| 9 | import { eventsClient, type EventPayloads, type FolioEventData, type ServiceBinding } from "@g1t/contracts"; | |
| 10 | ||
| 11 | import { actorOf } from "../events.ts"; | |
| 12 | ||
| 13 | export type FolioEventType = "folio.created" | "folio.updated" | "folio.trashed" | "folio.restored" | "folio.shared" | "folio.stale"; | |
| 14 | ||
| 15 | export async function publishFolioEvent<T extends FolioEventType>(events: ServiceBinding | undefined, type: T, data: EventPayloads[T] & FolioEventData, actor: string | null): Promise<void> { | |
| 16 | if (!events) return; | |
| 17 | try { | |
| 18 | await eventsClient(events).publish([{ type, source: "docs", repoId: null, actor: actorOf(actor), data } as never]); | |
| 19 | } catch (error) { | |
| 20 | console.error("folios could not publish", type, String(error)); | |
| 21 | } | |
| 22 | } |