25 lines
1.2 KiB
TypeScript
25 lines
1.2 KiB
TypeScript
// The Convex profile binding of the knowledge module, shipped fail-closed for a future wiring:
|
|
// the integration review kept the module Postgres-only because the search effect, the
|
|
// index/remove jobs and the enablement flow all leave the process and have no composed Convex
|
|
// Node actions yet (see README.md). Knowledge indexing needs the Node runtime boundary (the AI
|
|
// gateway SDK, the vector adapter), exactly like documents' OCR: the job handlers here fail
|
|
// closed so the work can only reach the platform SDKs through a composed Node action, never the
|
|
// transaction dispatcher.
|
|
|
|
import { defineModule, internal, type JobDef } from "@conusai-kit/core"
|
|
import { type DocumentJobPayload, documentPayload } from "./adapters/jobs.js"
|
|
import { INDEX_JOB, REMOVE_JOB } from "./contract/index.js"
|
|
import { KNOWLEDGE_MODULE_BASE } from "./module.shared.js"
|
|
|
|
const actionOnly = (name: string): JobDef<DocumentJobPayload> => ({
|
|
payload: documentPayload,
|
|
async handler() {
|
|
throw internal(`${name} must run through the Convex Node action boundary`)
|
|
},
|
|
})
|
|
|
|
export const convexKnowledgeModule = defineModule({
|
|
...KNOWLEDGE_MODULE_BASE,
|
|
jobs: { [INDEX_JOB]: actionOnly(INDEX_JOB), [REMOVE_JOB]: actionOnly(REMOVE_JOB) },
|
|
})
|