ConusAI vendor v0.1.0-beta.114
ci / gate (push) Waiting to run

This commit is contained in:
ConusAI vendor v0.1.0-beta.114
2026-11-14 09:56:45 +00:00
commit 1ce8d23c35
867 changed files with 122104 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
// The platform service's readiness, on its own so the status read can ask it without the search service
// (`KNOWLEDGE_READINESS`): the search adapter answers the same way, from here.
import { type Knowledge, KnowledgeError } from "@conusai-kit/platform"
import type { KnowledgeReadiness } from "../core/ports.js"
import { refusalOfReason, stateOfRefusal } from "./refusals.js"
/**
* The platform's managed service answers for itself. A refusal is the service's answer, as a typed code
* the page shows in the reader's language; a failure to ask it is its being unavailable.
*/
export const platformKnowledgeReadiness = (client: Pick<Knowledge, "readiness">): KnowledgeReadiness => ({
async readiness() {
try {
const answer = await client.readiness()
return { state: answer.state, reasons: [...answer.reasons] }
} catch (error) {
if (error instanceof KnowledgeError) {
const refusal = refusalOfReason(error.reason)
return { state: stateOfRefusal(refusal), reasons: [], ...(refusal === undefined ? {} : { refusal }) }
}
return { state: "unavailable", reasons: [], refusal: "runtime_unavailable" }
}
},
})