// The events of the knowledge module. A write procedure publishes the request; the module's own // subscriber (running in the worker's outbox relay) enqueues the job, which is how a web request // never waits on chunking, embeddings or a vector store. import { defineEvent } from "@conusai-kit/core" import { z } from "zod" const inProject = { orgId: z.string(), workspaceId: z.string(), projectId: z.string(), } /** A document was asked to be indexed: the subscriber enqueues the index job. */ export const documentIndexRequested = defineEvent( "knowledge.documentIndexRequested", z.object({ ...inProject, documentId: z.string(), collectionName: z.string(), fileId: z.string(), }), ) /** A document was asked to be removed: the subscriber enqueues the remove job. */ export const documentRemoveRequested = defineEvent( "knowledge.documentRemoveRequested", z.object({ ...inProject, documentId: z.string(), collectionName: z.string(), fileId: z.string(), }), ) export const KNOWLEDGE_EVENTS = [documentIndexRequested, documentRemoveRequested]