@littlebigbrain/client 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.d.ts CHANGED
@@ -1,298 +1,14 @@
1
- import type { components } from "./schema.js";
2
- /** Request/response types, generated from the committed OpenAPI spec. */
3
- export type Schemas = components["schemas"];
1
+ import type { ImportLine, LbbClientOptions, LbbStackActivityResponse, LbbStackActivityWindow, ListResponse, RawLbbResponse, RdfExportOptions, RdfImportOptions, Schemas, SparqlResults } from "./types.js";
2
+ import { type RequestOptions } from "./transport.js";
3
+ import { ContextNamespace, EntityNamespace, GraphNamespace, IndexNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace } from "./namespaces.js";
4
+ export { parseSparqlResults } from "./types.js";
5
+ export type { AttributeFilter, AttributeFilterOp, AttributeFilterValue, EntityAttributeFilterOptions, EntityPropertiesLine, FetchLike, FlatProperties, ImportLine, LbbClientOptions, LbbRequestEvent, LbbResponseEvent, LbbErrorPayload, LbbStackActivityResponse, LbbStackActivityWindow, ListResponse, RawLbbResponse, RdfExportOptions, RdfImportOptions, Schemas, SparqlResults, SparqlResultsJson, SparqlTerm, AskRequest, AskResponse, CommitRequest, CommitResponse, Entity, EntitySelector, GraphMetadata, GraphSummary, SchemaView, SearchRequest, SearchResponse, SearchResult, Snapshot, } from "./types.js";
6
+ export { LbbError } from "./transport.js";
7
+ export type { CallOptions, Query, QueryValue, RequestOptions, } from "./transport.js";
8
+ export type { EntityListOptions, HybridSearchOptions } from "./namespaces.js";
9
+ export { ContextNamespace, EntityNamespace, FactsNamespace, GraphNamespace, IndexNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace, } from "./namespaces.js";
4
10
  /**
5
- * The unified list-response envelope returned by every collection read
6
- * (`/v1/graph/entities`, `/v1/graph/edges`, `/v1/graph/observations`): the rows
7
- * in `data`, plus `next_cursor` (echo back as `cursor` for the next page) and
8
- * the pre-page `total_count`. Walk pages with {@link LbbClient.listAll}.
9
- */
10
- export interface ListResponse<T> {
11
- object: "list";
12
- data: T[];
13
- has_more: boolean;
14
- next_cursor: string | null;
15
- snapshot: Schemas["SnapshotView"];
16
- total_count: number;
17
- }
18
- /**
19
- * A flat `{ field: value }` property map. Values are coerced to each field's
20
- * declared type server-side, so a string like `"2026-06-26"` lands in a
21
- * `date_time` field and `"52"` in an `i64` field. The verbose
22
- * `Schemas["PropertyInput"][]` form is also accepted.
23
- */
24
- export type FlatProperties = Record<string, string | number | boolean>;
25
- /** A single entity-properties record for commit/import, with flat or verbose properties. */
26
- export type EntityPropertiesLine = {
27
- type: string;
28
- name: string;
29
- /** Optional stable external key; identity becomes `(type, key)`. */
30
- key?: string;
31
- properties: FlatProperties | Schemas["PropertyInput"][];
32
- };
33
- /** One bulk-import line: a triplet, or an entity-properties record. */
34
- export type ImportLine = Schemas["TripletInput"] | EntityPropertiesLine;
35
- export type AttributeFilterOp = "eq" | "ne" | "lt" | "le" | "gt" | "ge";
36
- export type AttributeFilterValue = string | number | boolean | {
37
- dateTime: string;
38
- } | {
39
- entity: Schemas["EntitySelector"];
40
- };
41
- export interface AttributeFilter {
42
- /** Query variable whose typed property should be compared. Defaults to the first bound pattern variable. */
43
- var?: string;
44
- /** Ontology property field name, e.g. `status`, `score`, or `committed_at`. */
45
- field: string;
46
- /** Comparison operator. Defaults to `eq`. */
47
- op?: AttributeFilterOp;
48
- value: AttributeFilterValue;
49
- }
50
- export interface EntityAttributeFilterOptions {
51
- /** Relation patterns that bind the entity variable(s) before attribute filters run. */
52
- patterns: Schemas["AnalyticTriplePattern"][];
53
- /** One or more typed-property comparisons. */
54
- where: AttributeFilter | AttributeFilter[];
55
- /** Additional raw structured-SPARQL filters to AND with `where`. */
56
- filters?: Schemas["SparqlFilter"][];
57
- select?: string[];
58
- limit?: number;
59
- offset?: number;
60
- asOfValidTime?: string;
61
- asOfCommitSeq?: number;
62
- orderBy?: Schemas["SparqlOrderBy"][];
63
- reason?: boolean;
64
- maxSolutions?: number;
65
- maxObjectReads?: number;
66
- maxFetchedBytes?: number;
67
- }
68
- /**
69
- * Minimal structural shape of `fetch`, so the client depends on neither the DOM
70
- * lib nor a specific runtime. Native `fetch` (Node 18+, browsers, workers)
71
- * satisfies it; tests can pass a fake.
72
- */
73
- export type FetchLike = (input: string, init?: {
74
- method?: string;
75
- headers?: Record<string, string>;
76
- body?: string;
77
- }) => Promise<{
78
- ok: boolean;
79
- status: number;
80
- headers?: {
81
- get(name: string): string | null;
82
- };
83
- text(): Promise<string>;
84
- }>;
85
- /** One term in a SPARQL result binding (the standard results-JSON term object). */
86
- export interface SparqlTerm {
87
- type: "uri" | "literal" | "bnode" | "typed-literal";
88
- value: string;
89
- datatype?: string;
90
- "xml:lang"?: string;
91
- }
92
- /** The standard SPARQL 1.1 Query Results JSON document. */
93
- export interface SparqlResultsJson {
94
- head: {
95
- vars?: string[];
96
- link?: string[];
97
- };
98
- results?: {
99
- bindings: Record<string, SparqlTerm>[];
100
- };
101
- boolean?: boolean;
102
- }
103
- /** Parsed SPARQL results: the head vars, the ASK boolean (or null), the raw
104
- * typed bindings, and the bindings flattened to `{ variable: lexicalValue }`. */
105
- export interface SparqlResults {
106
- vars: string[];
107
- boolean: boolean | null;
108
- bindings: Record<string, SparqlTerm>[];
109
- rows: Record<string, string>[];
110
- }
111
- /**
112
- * Parse a {@link Schemas.SparqlTextResponse} (whose `results` field carries the
113
- * SPARQL Results document as a JSON *string*) into typed bindings plus flat
114
- * `{ variable: lexicalValue }` rows — the form most callers want, so they never
115
- * have to `JSON.parse` and zip `head.vars` with binding values by hand.
116
- */
117
- export declare function parseSparqlResults(response: Schemas["SparqlTextResponse"]): SparqlResults;
118
- export interface LbbClientOptions {
119
- /** Base URL of the Little Big Brain server, e.g. `https://db.eu.littlebigbrain.com`. */
120
- baseUrl: string;
121
- /** Stack API key (`lbb_sk_test_…` / `lbb_sk_live_…`) or single-mode token. */
122
- apiKey?: string;
123
- /** Graph name (sent as `?graph=`; server default is `main`). */
124
- graph?: string;
125
- /** Branch name (sent as `?branch=`; server default is `main`). */
126
- branch?: string;
127
- /**
128
- * Stack slug (sent as `?stack=`). Needed only with a session-token `apiKey`
129
- * (`lbb_ses_…`), which authorizes an account rather than a single stack; a
130
- * stack API key (`lbb_sk_test_…` / `lbb_sk_live_…`) already fixes the stack and ignores this.
131
- */
132
- stack?: string;
133
- /** Override the fetch implementation (defaults to the global `fetch`). */
134
- fetch?: FetchLike;
135
- /** API version header sent on every request. Defaults to the beta reset contract. */
136
- apiVersion?: string;
137
- /** Retry count for 429/5xx responses and network failures. Defaults to 2. */
138
- maxRetries?: number;
139
- /** Base delay between retries. Defaults to 100ms. Tests can set 0. */
140
- retryDelayMs?: number;
141
- }
142
- export interface LbbStackView {
143
- stack_id: string;
144
- owner_id?: string;
145
- name: string;
146
- slug: string;
147
- tenant_id: string;
148
- default_graph: string;
149
- default_branch: string;
150
- created_at_micros: number;
151
- api_key_hint: string;
152
- api_key_rotated_at_micros: number;
153
- }
154
- export interface LbbAdminStackCreateRequest {
155
- owner_id: string;
156
- name: string;
157
- slug?: string;
158
- }
159
- export interface LbbAdminStackResponse {
160
- ok: true;
161
- stack: LbbStackView;
162
- api_key?: string;
163
- active_api_key_count?: number;
164
- }
165
- export type LbbStackActivityWindow = "1h" | "4h" | "12h" | "24h";
166
- export interface LbbStackActivityResponse {
167
- ok: true;
168
- stack: {
169
- slug: string;
170
- name?: string;
171
- };
172
- window: {
173
- range: LbbStackActivityWindow;
174
- from_micros: number;
175
- to_micros: number;
176
- bucket_seconds: number;
177
- freshness_seconds: number;
178
- };
179
- totals: {
180
- requests: number;
181
- errors: number;
182
- p50_latency_ms: number;
183
- p95_latency_ms: number;
184
- p99_latency_ms: number;
185
- storage_read_ops: number;
186
- storage_read_bytes: number;
187
- storage_write_ops: number;
188
- storage_write_bytes: number;
189
- index_read_ops: number;
190
- index_read_bytes: number;
191
- };
192
- details: {
193
- total_bucket_count: number;
194
- active_bucket_count: number;
195
- error_rate: number;
196
- storage_total_ops: number;
197
- storage_total_bytes: number;
198
- non_index_storage_read_ops: number;
199
- non_index_storage_read_bytes: number;
200
- index_read_share: number;
201
- first_activity_bucket_start_micros?: number;
202
- last_activity_bucket_start_micros?: number;
203
- };
204
- series: Array<{
205
- bucket_start_micros: number;
206
- requests: number;
207
- errors: number;
208
- p50_latency_ms: number;
209
- p95_latency_ms: number;
210
- p99_latency_ms: number;
211
- storage_read_ops: number;
212
- storage_read_bytes: number;
213
- storage_write_ops: number;
214
- storage_write_bytes: number;
215
- index_read_ops: number;
216
- index_read_bytes: number;
217
- }>;
218
- routes: Array<{
219
- family: string;
220
- requests: number;
221
- errors: number;
222
- error_rate: number;
223
- request_share: number;
224
- p50_latency_ms: number;
225
- p95_latency_ms: number;
226
- p99_latency_ms: number;
227
- }>;
228
- storage: Array<{
229
- family: string;
230
- read_ops: number;
231
- read_bytes: number;
232
- write_ops: number;
233
- write_bytes: number;
234
- total_ops: number;
235
- total_bytes: number;
236
- op_share: number;
237
- byte_share: number;
238
- }>;
239
- partial: boolean;
240
- }
241
- export interface LbbAdminSessionResponse {
242
- ok: true;
243
- /** A `lbb_ses_…` session token scoped to the account. */
244
- token: string;
245
- expires_at_micros: number;
246
- }
247
- export interface LbbAdminStackDeleteResponse {
248
- ok: true;
249
- deleted_stack: LbbStackView;
250
- tenant_prefix: string;
251
- objects_deleted: number;
252
- bytes_deleted: number;
253
- }
254
- export interface LbbErrorPayload {
255
- type?: string;
256
- code?: string;
257
- message?: string;
258
- param?: string | null;
259
- request_id?: string | null;
260
- doc_url?: string | null;
261
- }
262
- export interface RawLbbResponse<T> {
263
- data: T;
264
- status: number;
265
- requestId?: string;
266
- version?: string;
267
- headers?: {
268
- get(name: string): string | null;
269
- };
270
- }
271
- export interface RequestOptions {
272
- query?: Query;
273
- body?: unknown;
274
- /** Pre-serialized request body (e.g. NDJSON). Takes precedence over `body`. */
275
- rawBody?: string;
276
- /** Overrides the default `application/json` content type (used with `rawBody`). */
277
- contentType?: string;
278
- idempotencyKey?: string;
279
- }
280
- /** Thrown when the server responds with a non-2xx status. */
281
- export declare class LbbError extends Error {
282
- readonly status: number;
283
- readonly body: string;
284
- readonly error?: LbbErrorPayload | undefined;
285
- readonly type?: string;
286
- readonly code?: string;
287
- readonly param?: string | null;
288
- readonly requestId?: string | null;
289
- readonly docUrl?: string | null;
290
- constructor(status: number, body: string, error?: LbbErrorPayload | undefined);
291
- }
292
- type QueryValue = string | number | boolean | undefined;
293
- type Query = Record<string, QueryValue>;
294
- /**
295
- * A typed HTTP client for a Little Big Brain graph server. One instance is scoped to a
11
+ * A typed HTTP client for a little big brain graph server. One instance is scoped to a
296
12
  * single graph/branch; construct another for a different scope. All methods
297
13
  * return the parsed JSON response and throw {@link LbbError} on failure.
298
14
  */
@@ -306,10 +22,16 @@ export declare class LbbClient {
306
22
  private readonly apiVersion;
307
23
  private readonly maxRetries;
308
24
  private readonly retryDelayMs;
25
+ private readonly timeoutMs;
26
+ private readonly onRequest?;
27
+ private readonly onResponse?;
28
+ readonly context: ContextNamespace;
309
29
  readonly search: SearchNamespace;
310
30
  readonly indexes: IndexNamespace;
311
31
  readonly entities: EntityNamespace;
312
32
  readonly schema: SchemaNamespace;
33
+ readonly ontology: OntologyNamespace;
34
+ readonly query: QueryNamespace;
313
35
  constructor(options: LbbClientOptions);
314
36
  graph(name: string, opts?: {
315
37
  branch?: string;
@@ -348,26 +70,29 @@ export declare class LbbClient {
348
70
  * bounded internal commits server-side, so a whole dataset loads in one
349
71
  * streamed request without a single oversized commit. Pass `lines` as an array
350
72
  * (serialized to NDJSON here) or a pre-built NDJSON string.
73
+ *
74
+ * Set `index: true` to run one full index build after the last batch, so the
75
+ * data is served from the persisted runs (not just the ephemeral snapshot
76
+ * fallback) by the time the call returns — the "bulk load, queryable on return"
77
+ * path. Prefer this over indexing per batch (which serializes builds and races
78
+ * the throttle): import the whole dataset, index once. The response's `index`
79
+ * object reports whether the build ran or was skipped.
351
80
  */
352
81
  import(lines: ImportLine[] | string, opts?: {
353
82
  batch?: number;
354
83
  strict?: boolean;
355
84
  observedAt?: string;
85
+ index?: boolean;
356
86
  idempotencyKey?: string;
357
87
  }): Promise<Schemas["GraphImportResponse"]>;
358
88
  /**
359
- * Bulk-ingest N-Triples without client-side conversion. Resource-object
89
+ * Bulk-ingest N-Triples, Turtle, N-Quads, or TriG without client-side conversion. Resource-object
360
90
  * triples become keyed Resource edges; literal-object triples become text
361
91
  * properties on the subject Resource.
362
92
  */
363
- importRdf(ntriples: string, opts?: {
364
- batch?: number;
365
- strict?: boolean;
366
- observedAt?: string;
367
- resourceType?: string;
368
- edgeIdempotency?: "append" | "skip_unchanged";
369
- idempotencyKey?: string;
370
- }): Promise<Schemas["GraphRdfImportResponse"]>;
93
+ importRdf(rdf: string, opts?: RdfImportOptions): Promise<Schemas["GraphRdfImportResponse"]>;
94
+ /** Export the snapshot-visible RDF projection as Turtle, N-Triples, TriG, or N-Quads. */
95
+ exportRdf(opts?: RdfExportOptions): Promise<string>;
371
96
  /**
372
97
  * Retract specific edges and/or every edge touching given entities. Appends
373
98
  * superseding retract events rather than deleting — history stays visible in an
@@ -381,6 +106,23 @@ export declare class LbbClient {
381
106
  createGraph(): Promise<Schemas["CreateGraphResponse"]>;
382
107
  /** Fork the scoped branch from an existing branch in the same graph. */
383
108
  createBranch(body: Schemas["GraphBranchCreateRequest"]): Promise<Schemas["GraphBranchCreateResponse"]>;
109
+ /**
110
+ * Validate-then-merge: replay `from_branch`'s post-fork commits onto the
111
+ * SCOPED branch (its fork parent) as one new commit. A write — sends an
112
+ * Idempotency-Key so a retry replays instead of re-applying.
113
+ */
114
+ mergeBranch(body: Schemas["GraphBranchMergeRequest"], opts?: {
115
+ idempotencyKey?: string;
116
+ }): Promise<Schemas["GraphBranchMergeResponse"]>;
117
+ /**
118
+ * Observe: store a conversation episode verbatim as EPISODE evidence,
119
+ * anchor + gate extracted facts on an observe branch, and optionally
120
+ * auto-merge when validation is clean. Flag-gated server-side
121
+ * (`--enable-observe`). A write — carries an Idempotency-Key.
122
+ */
123
+ observe(body: Schemas["ObserveRequest"], opts?: {
124
+ idempotencyKey?: string;
125
+ }): Promise<Schemas["ObserveResponse"]>;
384
126
  /**
385
127
  * Delete every object under the scoped graph/branch — a destructive reset.
386
128
  * `confirm` must equal the scoped graph id; the next commit re-initializes the
@@ -389,12 +131,178 @@ export declare class LbbClient {
389
131
  deleteGraph(opts: {
390
132
  confirm: string;
391
133
  }): Promise<unknown>;
134
+ /**
135
+ * The graph's grounding vocabulary as byte-sorted, deduped string sections —
136
+ * the canonical input for a decoder-side automaton (FST/trie) and the
137
+ * vocabulary half of an export bundle.
138
+ */
139
+ vocabExport(opts?: {
140
+ sections?: string[];
141
+ limit?: number;
142
+ }): Promise<Schemas["VocabExportResponse"]>;
143
+ /**
144
+ * Captured signals by flush-seq range, oldest first — the model-training
145
+ * feed. The `seq` on each signal is the temporal-split coordinate (train ≤ T,
146
+ * eval > T).
147
+ */
148
+ readSignals(opts?: {
149
+ from?: number;
150
+ to?: number;
151
+ limit?: number;
152
+ }): Promise<Schemas["SignalReadResponse"]>;
153
+ /**
154
+ * Record one immutable model-as-run manifest; runs number sequentially per
155
+ * kind. Trainers MUST train on data ≤ `trained_at_commit_seq` and evaluate
156
+ * past it — `modelSplitAudit` verifies the recorded lineage.
157
+ */
158
+ recordModelRun(body: Schemas["ModelRunManifest"]): Promise<{
159
+ run: number;
160
+ }>;
161
+ /** CAS-promote a recorded run to CURRENT for its kind (replay is a no-op). */
162
+ promoteModelRun(opts: {
163
+ kind: string;
164
+ run: number;
165
+ }): Promise<unknown>;
166
+ /** A kind's model runs, newest first, with effective promotion state. */
167
+ modelRegistry(opts: {
168
+ kind: string;
169
+ }): Promise<Schemas["ModelRegistryResponse"]>;
170
+ /** GC run prefixes beyond the promoted run + the last `keep`; reports deletions. */
171
+ modelRegistryGc(opts: {
172
+ kind: string;
173
+ keep?: number;
174
+ }): Promise<unknown>;
175
+ /** Verify a run's temporal-split obligation from its recorded lineage. */
176
+ modelSplitAudit(opts: {
177
+ kind: string;
178
+ run: number;
179
+ }): Promise<Schemas["ModelSplitAudit"]>;
180
+ /**
181
+ * Champion vs challenger retrieval over one pinned snapshot. Returns
182
+ * promotion evidence (hit-rate@k, latency, overlap); never promotes.
183
+ */
184
+ shadowEval(body: Schemas["ShadowEvalRequest"]): Promise<Schemas["ShadowEvalResponse"]>;
185
+ /**
186
+ * Execution-verified QA probes generated from the graph's current edges —
187
+ * labels are the executed projections, so they are verified by construction.
188
+ * Feeds `shadowEval` directly.
189
+ */
190
+ syntheticEval(opts?: {
191
+ limit?: number;
192
+ }): Promise<Schemas["SyntheticEvalResponse"]>;
193
+ /** The doubling retrain policy: is a retrain due for this model kind? */
194
+ modelCadence(opts: {
195
+ kind: string;
196
+ }): Promise<Schemas["ModelCadenceResponse"]>;
197
+ /**
198
+ * One deterministic trainer tick: build a probe set (execution-verified
199
+ * synthetic pairs, or bring your own), search a bounded candidate space on
200
+ * the train slice, gate the winner against the champion on the held-out
201
+ * eval slice, record the run either way, and promote only when the gate
202
+ * passes. The same tick the `auto_train` cadence fires — always safe to
203
+ * call by hand.
204
+ */
205
+ trainTick(body: Schemas["TrainModelRequest"]): Promise<Schemas["TrainModelResponse"]>;
206
+ /** The graph's automatic-training configuration (default: off). */
207
+ trainingConfig(): Promise<Schemas["ModelTrainingConfig"]>;
208
+ /** Set the automatic-training configuration (`auto_train` toggle + kinds). */
209
+ setTrainingConfig(body: Schemas["ModelTrainingConfig"]): Promise<Schemas["ModelTrainingConfig"]>;
210
+ /**
211
+ * Verdict on an ask (`accepted` | `rejected` | `corrected` + the right
212
+ * plan), joined to the ask's trace by `ask_id` — the planner fine-tune's
213
+ * explicit feedback capture. `accepted: false` in the response means
214
+ * signal capture is off on this deployment (the contract is identical).
215
+ */
216
+ askFeedback(body: Schemas["AskFeedbackRequest"]): Promise<Schemas["AskFeedbackResponse"]>;
217
+ /**
218
+ * The planner fine-tune's training feed: accepted/corrected feedback
219
+ * joined to its traces (signals ≤ the split pin), topped up with
220
+ * execution-verified synthetic plans.
221
+ */
222
+ plannerDataset(opts?: {
223
+ limit?: number;
224
+ splitSeq?: number;
225
+ }): Promise<Schemas["PlannerDatasetResponse"]>;
226
+ /**
227
+ * The DPO pass's training feed: preference pairs from corrected verdicts,
228
+ * paired rejections, and synthetic corrupted-slot pairs.
229
+ */
230
+ plannerPreferenceDataset(opts?: {
231
+ limit?: number;
232
+ splitSeq?: number;
233
+ }): Promise<Schemas["PlannerPreferenceDatasetResponse"]>;
234
+ /**
235
+ * The suggest-ranker trainer's probe feed: `suggestion_adopted` signals
236
+ * (typed prefix + adopted text) ≤ the split pin, topped up with
237
+ * execution-verified synthetic vocabulary pairs.
238
+ */
239
+ suggestDataset(opts?: {
240
+ limit?: number;
241
+ splitSeq?: number;
242
+ }): Promise<Schemas["SuggestDatasetResponse"]>;
243
+ /**
244
+ * The extractor fine-tune's training feed: EPISODE transcripts joined to
245
+ * the facts the observe pipeline committed from them.
246
+ */
247
+ extractorDataset(opts?: {
248
+ limit?: number;
249
+ splitSeq?: number;
250
+ }): Promise<Schemas["ExtractorDatasetResponse"]>;
251
+ /**
252
+ * Promote a finished `extractor_lora` training run: gated on held-out fact
253
+ * F1, recorded as a `kind=extractor` training run whose adapter resident
254
+ * extraction then serves.
255
+ */
256
+ promoteExtractor(opts: {
257
+ runId: string;
258
+ allowRegression?: boolean;
259
+ }): Promise<unknown>;
260
+ /**
261
+ * Promote a finished `planner_lora` training run: gated on held-out slot
262
+ * exactness, recorded as a `kind=planner` training run whose adapter `/v1/ask`
263
+ * then serves.
264
+ */
265
+ promotePlanner(opts: {
266
+ runId: string;
267
+ allowRegression?: boolean;
268
+ }): Promise<unknown>;
392
269
  /** Full semantic hybrid search from a request body (`POST /v1/graph/search`). */
393
270
  graphSearch(body: Schemas["SemanticGraphSearchRequest"]): Promise<Schemas["SemanticGraphSearchResponse"]>;
394
271
  /** Reciprocal-rank-fusion across sub-queries. */
395
272
  multiSearch(body: Schemas["HybridMultiSearchRequest"]): Promise<Schemas["HybridMultiSearchResponse"]>;
396
273
  /**
397
- * Append relevance labels for a set of search results — how Little Big Brain
274
+ * Grounded prefix completion from the index vocabulary + ontology. Optionally
275
+ * narrow relation completions by a type-signature `context` — a type
276
+ * pair that admits a single relation flags `signature_forced`.
277
+ */
278
+ suggest(body: Schemas["SearchSuggestRequest"]): Promise<Schemas["SearchSuggestResponse"]>;
279
+ /**
280
+ * Snap free text to the nearest real vocabulary item. Embedding cosine
281
+ * on a managed graph, else lexical; never fabricates a term.
282
+ */
283
+ resolveTerm(body: Schemas["ResolveTermRequest"]): Promise<Schemas["ResolveTermResponse"]>;
284
+ /**
285
+ * Ground a natural-language question to the graph's real vocabulary, retrieve
286
+ * against the pinned snapshot, and answer with citations (`/v1/ask`).
287
+ */
288
+ ask(body: Schemas["AskRequest"]): Promise<Schemas["AskResponse"]>;
289
+ /**
290
+ * Name the relation between two entities (`/v1/decode`): the DB narrows the
291
+ * candidates to the type pair's admissible relations, answers alone
292
+ * when the pair forces a single relation, and otherwise decodes it with the
293
+ * graph-native fine-tuned model — the "DB narrows, cheap model decodes" call.
294
+ */
295
+ decode(body: Schemas["DecodeRequest"]): Promise<Schemas["DecodeResponse"]>;
296
+ /**
297
+ * Report which completion mechanisms will carry on this graph:
298
+ * signature sparsity, name semantics, sampled narrowing recall, and a
299
+ * narrow / narrow+finetune / lexical-first recommendation.
300
+ */
301
+ groundability(opts?: {
302
+ sample?: number;
303
+ }): Promise<Schemas["GroundabilityReport"]>;
304
+ /**
305
+ * Append relevance labels for a set of search results — how little big brain
398
306
  * gathers customer-specific qrels. Grade results (3 ideal/good, 1 partial,
399
307
  * 0 bad), referencing the search response's `search_id` so labels tie back to
400
308
  * that ranking. Stored apart from customer facts and exported via
@@ -529,7 +437,7 @@ export declare class LbbClient {
529
437
  /** The rule set stored on the scoped graph branch (version + rules). */
530
438
  graphRules(): Promise<Schemas["RuleSet"]>;
531
439
  /**
532
- * Stage G — derive edges from calibrated retrieval matches (preview): each
440
+ * Derive edges from calibrated retrieval matches (preview): each
533
441
  * candidate scored `P >= threshold` becomes a derived edge `(anchor, relation,
534
442
  * matched)` with a typed `Retrieval` provenance leaf. Pass either explicit
535
443
  * `candidates` or a `query` the server runs as BM25 entity retrieval.
@@ -604,161 +512,6 @@ export declare class LbbClient {
604
512
  summary(): Promise<Schemas["GraphSummaryResponse"]>;
605
513
  /** List the graphs (and branches) under the scoped tenant. */
606
514
  listGraphs(): Promise<Schemas["GraphListResponse"]>;
607
- /** Create a database stack and return its one-time stack API key. */
608
- adminCreateStack(body: LbbAdminStackCreateRequest): Promise<LbbAdminStackResponse>;
609
- /** Inspect a database stack without returning secret key material. */
610
- adminStack(slug: string): Promise<LbbAdminStackResponse>;
611
- /** Rotate a database stack key and return the new one-time API key. */
612
- adminRotateStackKey(slug: string): Promise<LbbAdminStackResponse>;
613
- /** Delete a database stack after confirming the slug. */
614
- adminDeleteStack(slug: string): Promise<LbbAdminStackDeleteResponse>;
615
- /**
616
- * Mint a short-lived `lbb_ses_…` session token for an account. A trusted
617
- * co-located service uses it (with `?stack=<slug>`) to call the data plane on
618
- * the account's behalf without handling the stack's mode-bearing stack key.
619
- */
620
- adminMintSession(accountId: string): Promise<LbbAdminSessionResponse>;
621
- /** Customer-visible activity for one database stack. */
622
- adminStackActivity(slug: string, window?: LbbStackActivityWindow): Promise<LbbStackActivityResponse>;
623
515
  /** Activity for the stack selected by the bearer stack key or session. */
624
516
  stackActivity(window?: LbbStackActivityWindow): Promise<LbbStackActivityResponse>;
625
517
  }
626
- export declare class GraphNamespace {
627
- private readonly client;
628
- readonly facts: FactsNamespace;
629
- constructor(client: LbbClient);
630
- branch(name: string): GraphNamespace;
631
- create(): Promise<Schemas["CreateGraphResponse"]>;
632
- delete(opts: {
633
- confirm: string;
634
- }): Promise<unknown>;
635
- /** Retract edges/entities from the scoped graph. See {@link LbbClient.retract}. */
636
- retract(body: Schemas["GraphRetractRequest"], opts?: {
637
- idempotencyKey?: string;
638
- }): Promise<Schemas["GraphRetractResponse"]>;
639
- }
640
- export declare class FactsNamespace {
641
- private readonly client;
642
- constructor(client: LbbClient);
643
- create(body: Schemas["TripletCommitFile"], opts?: {
644
- idempotencyKey?: string;
645
- }): Promise<Schemas["GraphCommitResponse"]>;
646
- /** Bulk-load a dataset as NDJSON. See {@link LbbClient.import}. */
647
- import(lines: ImportLine[] | string, opts?: {
648
- batch?: number;
649
- strict?: boolean;
650
- observedAt?: string;
651
- idempotencyKey?: string;
652
- }): Promise<Schemas["GraphImportResponse"]>;
653
- /**
654
- * Bulk-load N-Triples through the native RDF import endpoint.
655
- *
656
- * Statements are committed through the fixed RDF_TRIPLE relation; source RDF
657
- * predicates and literal term details are preserved as edge metadata.
658
- */
659
- importRdf(ntriples: string, opts?: {
660
- batch?: number;
661
- strict?: boolean;
662
- observedAt?: string;
663
- resourceType?: string;
664
- edgeIdempotency?: "append" | "skip_unchanged";
665
- idempotencyKey?: string;
666
- }): Promise<Schemas["GraphRdfImportResponse"]>;
667
- }
668
- export declare class SearchNamespace {
669
- private readonly client;
670
- constructor(client: LbbClient);
671
- hybrid(query: string, opts?: {
672
- topK?: number;
673
- source?: string;
674
- consistency?: string;
675
- lexical?: boolean;
676
- bm25?: boolean;
677
- vector?: boolean;
678
- targets?: string[];
679
- profile?: string;
680
- /** Opt-in impression logging (L1): durably record this search's full
681
- * ranking context, keyed by `search_id`, so a later feedback label on it
682
- * carries the ranking it was judged against. Off by default. */
683
- logImpression?: boolean;
684
- }): Promise<Schemas["SemanticGraphSearchResponse"]>;
685
- hybrid(body: Schemas["SemanticGraphSearchRequest"]): Promise<Schemas["SemanticGraphSearchResponse"]>;
686
- multi(body: Schemas["HybridMultiSearchRequest"]): Promise<Schemas["HybridMultiSearchResponse"]>;
687
- feedback(body: Schemas["SearchFeedbackRequest"], opts?: {
688
- idempotencyKey?: string;
689
- }): Promise<Schemas["SearchFeedbackResponse"]>;
690
- feedbackExport(): Promise<Schemas["SearchFeedbackExportResponse"]>;
691
- fullText(body: Schemas["FullTextSearchRequest"]): Promise<Schemas["FullTextSearchResponse"]>;
692
- vector(body: Schemas["EmbeddingSearchRequest"]): Promise<Schemas["EmbeddingSearchResponse"]>;
693
- }
694
- export declare class SchemaNamespace {
695
- private readonly client;
696
- constructor(client: LbbClient);
697
- /** Active graph schema bundle: ontology plus activated SHACL shapes. */
698
- view(opts?: {
699
- audit?: boolean;
700
- }): Promise<Schemas["SchemaBundleView"]>;
701
- /** Preview a proposed RDF/SHACL schema bundle and audit current data. */
702
- preview(body: Schemas["SchemaPreviewRequest"]): Promise<Schemas["SchemaPreviewResponse"]>;
703
- /** Activate a previewed SHACL schema bundle for this graph branch. */
704
- publish(body: Schemas["SchemaPublishRequest"]): Promise<Schemas["SchemaPublishResponse"]>;
705
- /** Audit current data against the active SHACL schema bundle. */
706
- audit(): Promise<Schemas["SchemaAuditReport"]>;
707
- }
708
- export declare class IndexNamespace {
709
- private readonly client;
710
- constructor(client: LbbClient);
711
- run(opts?: {
712
- wait?: boolean;
713
- background?: boolean;
714
- body?: unknown;
715
- }): Promise<unknown>;
716
- build(): Promise<unknown>;
717
- delta(): Promise<Schemas["IndexDeltaResponse"]>;
718
- gc(opts?: {
719
- keepRuns?: number;
720
- dryRun?: boolean;
721
- }): Promise<Schemas["IndexGcResponse"]>;
722
- }
723
- export declare class EntityNamespace {
724
- private readonly client;
725
- constructor(client: LbbClient);
726
- /**
727
- * Browse entities as the unified list envelope. Pass `fields` (names or `*`)
728
- * to inline each row's typed attributes as native JSON (under `attributes`) —
729
- * "list entities and their titles" in one call instead of a list plus N point
730
- * lookups — or `ids`
731
- * to fetch a specific set. Page with `cursor` from the previous `next_cursor`.
732
- */
733
- list(opts?: {
734
- type?: string;
735
- limit?: number;
736
- cursor?: string | number;
737
- /** @deprecated Legacy alias for `cursor`. */
738
- offset?: number;
739
- query?: string;
740
- /** Property names to inline per row (or `"*"` / `["*"]` for all). */
741
- fields?: string | string[];
742
- /** Specific entity ids to fetch in one call (bulk lookup). */
743
- ids?: string | string[];
744
- }): Promise<ListResponse<Schemas["EntityExplorerRow"]>>;
745
- get(opts: {
746
- id?: string;
747
- type?: string;
748
- name?: string;
749
- asOf?: string;
750
- }): Promise<Schemas["EntityMetadataResponse"]>;
751
- detail(opts: {
752
- id?: string;
753
- type?: string;
754
- name?: string;
755
- }): Promise<Schemas["EntityDetailResponse"]>;
756
- /**
757
- * Filter entities already bound by relation patterns using typed attributes,
758
- * without writing RDF property IRIs by hand. This is a convenience wrapper over
759
- * the structured SPARQL route: relation `patterns` bind variables, and `where`
760
- * compares ontology property fields on those bound variables.
761
- */
762
- filterByAttributes(opts: EntityAttributeFilterOptions): Promise<Schemas["SparqlSelectResponse"]>;
763
- }
764
- export {};