Capability first · transport second

DBOPFSDocumentLibrary.js

Application-defined complete document corpus bootstrap, caller-source evaluation, atomic DBOPFS generations, lexical search, and request-context construction.

SDK 0.5.18Runtime 0.8.12Protocol arcane/1
On this page

Overview

Application-defined complete document corpus bootstrap, caller-source evaluation, atomic DBOPFS generations, lexical search, and request-context construction.

  • Artifact
    DBOPFSDocumentLibrary.js · esm
  • Classification
    public first party
  • Availability
    Browser or compatible host with an existing DBOPFS-style database adapter
  • Normalization
    Preserves DBOPFS method semantics, commits a completion manifest last, rejects malformed stored generations, exposes explicit reject or default preserve-readable read-failure policy, and returns complete mutable context.

Import and lifecycle

JavaScript
import * as module from '/arcane/modules/DBOPFSDocumentLibrary.js';

Construction only validates options and binds an existing DBOPFS-compatible adapter. bootstrap is the sole corpus writer: it reads complete selected sources with caller-configured concurrency, writes a new generation, commits the completion manifest last, and then removes stale generation files. search and buildContext read only the completed generation. evaluate reads complete caller-owned sources without persisting their bodies.

Application-facing behavior: DBOPFSDocumentLibrary, createDBOPFSDocumentLibrary(), normalizeDBOPFSDocumentSchema(); schema, bootstrap(), search(), evaluate(), buildContext(), and createContextBuilder().

Protocol and host implementation

Existing DBOPFS get/set/getAllKeys/delete methods; no new storage protocol This detail does not widen the application-facing API or grant authority.

Exports, signatures, parameters, and results

BindingFormDeclaration or signatureParameter syntax
DBOPFSDocumentLibraryclassclass DBOPFSDocumentLibrary
createDBOPFSDocumentLibraryfunctionfunction createDBOPFSDocumentLibrary(options)options
normalizeDBOPFSDocumentSchemaalias · functionfunction normalizeSchema(input)input
defaultdefault · classclass DBOPFSDocumentLibrary
CallableKindExact public signatureParameter syntax
createDBOPFSDocumentLibraryexported-functionfunction createDBOPFSDocumentLibrary(options)options
normalizeDBOPFSDocumentSchemaexported-functionfunction normalizeSchema(input)input
DBOPFSDocumentLibrary.bootstrappublic-memberasync bootstrap(options={})options={}
DBOPFSDocumentLibrary.searchpublic-memberasync search(query,options={})query,options={}
DBOPFSDocumentLibrary.evaluatepublic-memberasync evaluate(query,options={})query,options={}
DBOPFSDocumentLibrary.buildContextpublic-memberasync buildContext(query,options={})query,options={}
DBOPFSDocumentLibrary.createContextBuilderpublic-membercreateContextBuilder(options={})options={}
MemberKindExact public declarationParameter syntax
DBOPFSDocumentLibrary.constructorconstructorconstructor(options={})options={}
DBOPFSDocumentLibrary.schemagetget schema()
DBOPFSDocumentLibrary.bootstrapasync methodasync bootstrap(options={})options={}
DBOPFSDocumentLibrary.searchasync methodasync search(query,options={})query,options={}
DBOPFSDocumentLibrary.evaluateasync methodasync evaluate(query,options={})query,options={}
DBOPFSDocumentLibrary.buildContextasync methodasync buildContext(query,options={})query,options={}
DBOPFSDocumentLibrary.createContextBuildermethodcreateContextBuilder(options={})options={}

Parameter meanings and results

new DBOPFSDocumentLibrary({concurrency=4,db=globalThis.dbopfs,schema}); bootstrap({files,onProgress?,read?,readFailurePolicy?,signal?}) resolves a mutable manifest and optional partial readCoverage; search(query,{kinds?,signal?,tags?}) resolves complete {failures,matches,total}; evaluate(query,{sources,read,kinds?,tags?,readFailurePolicy?,onProgress?,signal?}) persists no caller-owned body and resolves mutable {authority:'sources',characters,coverage,documents,failures,query,text}. The default preserve-readable policy reports source failures while retaining every readable source; readFailurePolicy:'reject' opts into whole-operation rejection. buildContext() resolves complete persisted context; createContextBuilder() returns a ConfiguredAIChatSession-compatible async builder.

Events, side effects, and errors

Source-literal CustomEvent dispatches

No source-literal CustomEvent dispatch is part of this artifact.

Lifecycle and event flow

  • optional bootstrap onProgress phases: reading, writing, cleanup, complete
  • optional evaluate onProgress phases: preparing, reading, read-complete, ranking, assembling, complete

Direct coded failures

This artifact directly assigns no stable coded failure.

Exported Error subclasses

This artifact exports no Error subclass.

Documented failure behavior

  • DBOPFS_DOCUMENT_INVALID
  • DBOPFS_DOCUMENT_INVALID_LIMIT
  • DBOPFS_DOCUMENT_STORAGE_UNAVAILABLE
  • DBOPFS_DOCUMENT_BUSY
  • DBOPFS_DOCUMENT_NOT_BOOTSTRAPPED
  • DBOPFS_DOCUMENT_INCOMPLETE
  • DBOPFS_DOCUMENT_CASE_COLLISION
  • DBOPFS_DOCUMENT_BOOTSTRAP_FAILED
  • DBOPFS_DOCUMENT_READ_FAILED
  • DBOPFS_DOCUMENT_LIMIT
  • DBOPFS_DOCUMENT_ABORTED
  • preserved read failures without a usable source code use failures[].code DBOPFS_DOCUMENT_ERROR

Availability and capabilities

Browser or compatible host with an existing DBOPFS-style database adapter. Preserves DBOPFS method semantics, commits a completion manifest last, rejects malformed stored generations, exposes explicit reject or default preserve-readable read-failure policy, and returns complete mutable context.

Portable app-owned storage/search mechanism. It preserves existing DBOPFS method names and semantics and needs no Core RPC; the host-specific boundary is the injected storage adapter.

Contract example

JavaScript
import {createDBOPFSDocumentLibrary} from '/arcane/modules/DBOPFSDocumentLibrary.js';

async function replaceHelpCorpusAfterUserChoice(){
    const library=createDBOPFSDocumentLibrary({
        db:globalThis.dbopfs,
        schema:{id:'help',version:'1',table:'help_documents'}
    });
    await library.bootstrap({files:[{
        id:'welcome',title:'Welcome',body:'Arcane apps are portable.',path:'welcome.md'
    }]});
    console.log(await library.search('portable'));
}

No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.