@littlebigbrain/client 0.1.0 → 0.2.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/LICENSE +56 -0
- package/README.md +57 -15
- package/dist/client.d.ts +208 -433
- package/dist/client.js +368 -318
- package/dist/index.d.ts +1 -1
- package/dist/namespaces.d.ts +201 -0
- package/dist/namespaces.js +482 -0
- package/dist/schema.d.ts +10653 -3600
- package/dist/transport.d.ts +44 -0
- package/dist/transport.js +93 -0
- package/dist/types.d.ts +314 -0
- package/dist/types.js +47 -0
- package/package.json +34 -5
- package/dist/client.test.d.ts +0 -1
- package/dist/client.test.js +0 -591
- package/dist/contract-routes.test.d.ts +0 -1
- package/dist/contract-routes.test.js +0 -74
- package/src/client.test.ts +0 -673
- package/src/client.ts +0 -1428
- package/src/contract-routes.test.ts +0 -91
- package/src/index.ts +0 -16
- package/src/node-test-shim.d.ts +0 -16
- package/src/schema.ts +0 -13865
package/dist/client.d.ts
CHANGED
|
@@ -1,296 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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>;
|
|
1
|
+
import type { ImportLine, LbbAdminSessionResponse, LbbAdminStackCreateRequest, LbbAdminStackDeleteResponse, LbbAdminStackResponse, LbbClientOptions, LbbStackActivityResponse, LbbStackActivityWindow, ListResponse, RawLbbResponse, Schemas, SparqlResults } from "./types.js";
|
|
2
|
+
import { type RequestOptions } from "./transport.js";
|
|
3
|
+
import { AdminNamespace, 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, LbbAdminSessionResponse, LbbAdminStackCreateRequest, LbbAdminStackDeleteResponse, LbbAdminStackResponse, LbbClientOptions, LbbRequestEvent, LbbResponseEvent, LbbErrorPayload, LbbStackActivityResponse, LbbStackActivityWindow, LbbStackView, ListResponse, RawLbbResponse, 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 { AdminNamespace, ContextNamespace, EntityNamespace, FactsNamespace, GraphNamespace, IndexNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace, } from "./namespaces.js";
|
|
294
10
|
/**
|
|
295
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
|
|
@@ -306,10 +22,17 @@ 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 admin: AdminNamespace;
|
|
29
|
+
readonly context: ContextNamespace;
|
|
309
30
|
readonly search: SearchNamespace;
|
|
310
31
|
readonly indexes: IndexNamespace;
|
|
311
32
|
readonly entities: EntityNamespace;
|
|
312
33
|
readonly schema: SchemaNamespace;
|
|
34
|
+
readonly ontology: OntologyNamespace;
|
|
35
|
+
readonly query: QueryNamespace;
|
|
313
36
|
constructor(options: LbbClientOptions);
|
|
314
37
|
graph(name: string, opts?: {
|
|
315
38
|
branch?: string;
|
|
@@ -348,11 +71,19 @@ export declare class LbbClient {
|
|
|
348
71
|
* bounded internal commits server-side, so a whole dataset loads in one
|
|
349
72
|
* streamed request without a single oversized commit. Pass `lines` as an array
|
|
350
73
|
* (serialized to NDJSON here) or a pre-built NDJSON string.
|
|
74
|
+
*
|
|
75
|
+
* Set `index: true` to run one full index build after the last batch, so the
|
|
76
|
+
* data is served from the persisted runs (not just the ephemeral snapshot
|
|
77
|
+
* fallback) by the time the call returns — the "bulk load, queryable on return"
|
|
78
|
+
* path. Prefer this over indexing per batch (which serializes builds and races
|
|
79
|
+
* the throttle): import the whole dataset, index once. The response's `index`
|
|
80
|
+
* object reports whether the build ran or was skipped.
|
|
351
81
|
*/
|
|
352
82
|
import(lines: ImportLine[] | string, opts?: {
|
|
353
83
|
batch?: number;
|
|
354
84
|
strict?: boolean;
|
|
355
85
|
observedAt?: string;
|
|
86
|
+
index?: boolean;
|
|
356
87
|
idempotencyKey?: string;
|
|
357
88
|
}): Promise<Schemas["GraphImportResponse"]>;
|
|
358
89
|
/**
|
|
@@ -381,6 +112,23 @@ export declare class LbbClient {
|
|
|
381
112
|
createGraph(): Promise<Schemas["CreateGraphResponse"]>;
|
|
382
113
|
/** Fork the scoped branch from an existing branch in the same graph. */
|
|
383
114
|
createBranch(body: Schemas["GraphBranchCreateRequest"]): Promise<Schemas["GraphBranchCreateResponse"]>;
|
|
115
|
+
/**
|
|
116
|
+
* WS16 validate-then-merge: replay `from_branch`'s post-fork commits onto the
|
|
117
|
+
* SCOPED branch (its fork parent) as one new commit. A write — sends an
|
|
118
|
+
* Idempotency-Key so a retry replays instead of re-applying.
|
|
119
|
+
*/
|
|
120
|
+
mergeBranch(body: Schemas["GraphBranchMergeRequest"], opts?: {
|
|
121
|
+
idempotencyKey?: string;
|
|
122
|
+
}): Promise<Schemas["GraphBranchMergeResponse"]>;
|
|
123
|
+
/**
|
|
124
|
+
* WS15 observe: store a conversation episode verbatim as EPISODE evidence,
|
|
125
|
+
* anchor + gate extracted facts on an observe branch, and optionally
|
|
126
|
+
* auto-merge when validation is clean. Flag-gated server-side
|
|
127
|
+
* (`--enable-observe`). A write — carries an Idempotency-Key.
|
|
128
|
+
*/
|
|
129
|
+
observe(body: Schemas["ObserveRequest"], opts?: {
|
|
130
|
+
idempotencyKey?: string;
|
|
131
|
+
}): Promise<Schemas["ObserveResponse"]>;
|
|
384
132
|
/**
|
|
385
133
|
* Delete every object under the scoped graph/branch — a destructive reset.
|
|
386
134
|
* `confirm` must equal the scoped graph id; the next commit re-initializes the
|
|
@@ -389,10 +137,176 @@ export declare class LbbClient {
|
|
|
389
137
|
deleteGraph(opts: {
|
|
390
138
|
confirm: string;
|
|
391
139
|
}): Promise<unknown>;
|
|
140
|
+
/**
|
|
141
|
+
* The graph's grounding vocabulary as byte-sorted, deduped string sections —
|
|
142
|
+
* the canonical input for a decoder-side automaton (FST/trie) and the
|
|
143
|
+
* vocabulary half of an export bundle.
|
|
144
|
+
*/
|
|
145
|
+
vocabExport(opts?: {
|
|
146
|
+
sections?: string[];
|
|
147
|
+
limit?: number;
|
|
148
|
+
}): Promise<Schemas["VocabExportResponse"]>;
|
|
149
|
+
/**
|
|
150
|
+
* Captured signals by flush-seq range, oldest first — the flywheel training
|
|
151
|
+
* feed. The `seq` on each signal is the temporal-split coordinate (train ≤ T,
|
|
152
|
+
* eval > T).
|
|
153
|
+
*/
|
|
154
|
+
readSignals(opts?: {
|
|
155
|
+
from?: number;
|
|
156
|
+
to?: number;
|
|
157
|
+
limit?: number;
|
|
158
|
+
}): Promise<Schemas["SignalReadResponse"]>;
|
|
159
|
+
/**
|
|
160
|
+
* Record one immutable model-as-run manifest; runs number sequentially per
|
|
161
|
+
* kind. Trainers MUST train on data ≤ `trained_at_commit_seq` and evaluate
|
|
162
|
+
* past it — `modelSplitAudit` verifies the recorded lineage.
|
|
163
|
+
*/
|
|
164
|
+
recordModelRun(body: Schemas["ModelRunManifest"]): Promise<{
|
|
165
|
+
run: number;
|
|
166
|
+
}>;
|
|
167
|
+
/** CAS-promote a recorded run to CURRENT for its kind (replay is a no-op). */
|
|
168
|
+
promoteModelRun(opts: {
|
|
169
|
+
kind: string;
|
|
170
|
+
run: number;
|
|
171
|
+
}): Promise<unknown>;
|
|
172
|
+
/** A kind's model runs, newest first, with effective promotion state. */
|
|
173
|
+
modelRegistry(opts: {
|
|
174
|
+
kind: string;
|
|
175
|
+
}): Promise<Schemas["ModelRegistryResponse"]>;
|
|
176
|
+
/** GC run prefixes beyond the promoted run + the last `keep`; reports deletions. */
|
|
177
|
+
modelRegistryGc(opts: {
|
|
178
|
+
kind: string;
|
|
179
|
+
keep?: number;
|
|
180
|
+
}): Promise<unknown>;
|
|
181
|
+
/** Verify a run's temporal-split obligation from its recorded lineage. */
|
|
182
|
+
modelSplitAudit(opts: {
|
|
183
|
+
kind: string;
|
|
184
|
+
run: number;
|
|
185
|
+
}): Promise<Schemas["ModelSplitAudit"]>;
|
|
186
|
+
/**
|
|
187
|
+
* Champion vs challenger retrieval over one pinned snapshot. Returns
|
|
188
|
+
* promotion evidence (hit-rate@k, latency, overlap); never promotes.
|
|
189
|
+
*/
|
|
190
|
+
shadowEval(body: Schemas["ShadowEvalRequest"]): Promise<Schemas["ShadowEvalResponse"]>;
|
|
191
|
+
/**
|
|
192
|
+
* Execution-verified QA probes generated from the graph's current edges —
|
|
193
|
+
* labels are the executed projections, so they are verified by construction.
|
|
194
|
+
* Feeds `shadowEval` directly.
|
|
195
|
+
*/
|
|
196
|
+
syntheticEval(opts?: {
|
|
197
|
+
limit?: number;
|
|
198
|
+
}): Promise<Schemas["SyntheticEvalResponse"]>;
|
|
199
|
+
/** The doubling retrain policy: is a retrain due for this model kind? */
|
|
200
|
+
modelCadence(opts: {
|
|
201
|
+
kind: string;
|
|
202
|
+
}): Promise<Schemas["ModelCadenceResponse"]>;
|
|
203
|
+
/**
|
|
204
|
+
* One deterministic trainer tick: build a probe set (execution-verified
|
|
205
|
+
* synthetic pairs, or bring your own), search a bounded candidate space on
|
|
206
|
+
* the train slice, gate the winner against the champion on the held-out
|
|
207
|
+
* eval slice, record the run either way, and promote only when the gate
|
|
208
|
+
* passes. The same tick the `auto_train` cadence fires — always safe to
|
|
209
|
+
* call by hand.
|
|
210
|
+
*/
|
|
211
|
+
trainTick(body: Schemas["TrainModelRequest"]): Promise<Schemas["TrainModelResponse"]>;
|
|
212
|
+
/** The graph's automatic-training configuration (default: off). */
|
|
213
|
+
trainingConfig(): Promise<Schemas["ModelTrainingConfig"]>;
|
|
214
|
+
/** Set the automatic-training configuration (`auto_train` toggle + kinds). */
|
|
215
|
+
setTrainingConfig(body: Schemas["ModelTrainingConfig"]): Promise<Schemas["ModelTrainingConfig"]>;
|
|
216
|
+
/**
|
|
217
|
+
* Verdict on an ask (`accepted` | `rejected` | `corrected` + the right
|
|
218
|
+
* plan), joined to the ask's trace by `ask_id` — the planner fine-tune's
|
|
219
|
+
* explicit feedback capture. `accepted: false` in the response means
|
|
220
|
+
* signal capture is off on this deployment (the contract is identical).
|
|
221
|
+
*/
|
|
222
|
+
askFeedback(body: Schemas["AskFeedbackRequest"]): Promise<Schemas["AskFeedbackResponse"]>;
|
|
223
|
+
/**
|
|
224
|
+
* The planner fine-tune's training feed: accepted/corrected feedback
|
|
225
|
+
* joined to its traces (signals ≤ the split pin), topped up with
|
|
226
|
+
* execution-verified synthetic plans.
|
|
227
|
+
*/
|
|
228
|
+
plannerDataset(opts?: {
|
|
229
|
+
limit?: number;
|
|
230
|
+
splitSeq?: number;
|
|
231
|
+
}): Promise<Schemas["PlannerDatasetResponse"]>;
|
|
232
|
+
/**
|
|
233
|
+
* The DPO pass's training feed: preference pairs from corrected verdicts,
|
|
234
|
+
* paired rejections, and synthetic corrupted-slot pairs.
|
|
235
|
+
*/
|
|
236
|
+
plannerPreferenceDataset(opts?: {
|
|
237
|
+
limit?: number;
|
|
238
|
+
splitSeq?: number;
|
|
239
|
+
}): Promise<Schemas["PlannerPreferenceDatasetResponse"]>;
|
|
240
|
+
/**
|
|
241
|
+
* The suggest-ranker trainer's probe feed: `suggestion_adopted` signals
|
|
242
|
+
* (typed prefix + adopted text) ≤ the split pin, topped up with
|
|
243
|
+
* execution-verified synthetic vocabulary pairs.
|
|
244
|
+
*/
|
|
245
|
+
suggestDataset(opts?: {
|
|
246
|
+
limit?: number;
|
|
247
|
+
splitSeq?: number;
|
|
248
|
+
}): Promise<Schemas["SuggestDatasetResponse"]>;
|
|
249
|
+
/**
|
|
250
|
+
* The extractor fine-tune's training feed: EPISODE transcripts joined to
|
|
251
|
+
* the facts the observe pipeline committed from them.
|
|
252
|
+
*/
|
|
253
|
+
extractorDataset(opts?: {
|
|
254
|
+
limit?: number;
|
|
255
|
+
splitSeq?: number;
|
|
256
|
+
}): Promise<Schemas["ExtractorDatasetResponse"]>;
|
|
257
|
+
/**
|
|
258
|
+
* Promote a finished `extractor_lora` training run: gated on held-out fact
|
|
259
|
+
* F1, recorded as a WS9 `kind=extractor` run whose adapter resident
|
|
260
|
+
* extraction then serves.
|
|
261
|
+
*/
|
|
262
|
+
promoteExtractor(opts: {
|
|
263
|
+
runId: string;
|
|
264
|
+
allowRegression?: boolean;
|
|
265
|
+
}): Promise<unknown>;
|
|
266
|
+
/**
|
|
267
|
+
* Promote a finished `planner_lora` training run: gated on held-out slot
|
|
268
|
+
* exactness, recorded as a WS9 `kind=planner` run whose adapter `/v1/ask`
|
|
269
|
+
* then serves.
|
|
270
|
+
*/
|
|
271
|
+
promotePlanner(opts: {
|
|
272
|
+
runId: string;
|
|
273
|
+
allowRegression?: boolean;
|
|
274
|
+
}): Promise<unknown>;
|
|
392
275
|
/** Full semantic hybrid search from a request body (`POST /v1/graph/search`). */
|
|
393
276
|
graphSearch(body: Schemas["SemanticGraphSearchRequest"]): Promise<Schemas["SemanticGraphSearchResponse"]>;
|
|
394
277
|
/** Reciprocal-rank-fusion across sub-queries. */
|
|
395
278
|
multiSearch(body: Schemas["HybridMultiSearchRequest"]): Promise<Schemas["HybridMultiSearchResponse"]>;
|
|
279
|
+
/**
|
|
280
|
+
* Grounded prefix completion from the index vocabulary + ontology. Optionally
|
|
281
|
+
* narrow relation completions by a type-signature `context` (WS10) — a type
|
|
282
|
+
* pair that admits a single relation flags `signature_forced`.
|
|
283
|
+
*/
|
|
284
|
+
suggest(body: Schemas["SearchSuggestRequest"]): Promise<Schemas["SearchSuggestResponse"]>;
|
|
285
|
+
/**
|
|
286
|
+
* Snap free text to the nearest real vocabulary item (WS11). Embedding cosine
|
|
287
|
+
* on a managed graph, else lexical; never fabricates a term.
|
|
288
|
+
*/
|
|
289
|
+
resolveTerm(body: Schemas["ResolveTermRequest"]): Promise<Schemas["ResolveTermResponse"]>;
|
|
290
|
+
/**
|
|
291
|
+
* Ground a natural-language question to the graph's real vocabulary, retrieve
|
|
292
|
+
* against the pinned snapshot, and answer with citations (WS12, `/v1/ask`).
|
|
293
|
+
*/
|
|
294
|
+
ask(body: Schemas["AskRequest"]): Promise<Schemas["AskResponse"]>;
|
|
295
|
+
/**
|
|
296
|
+
* Name the relation between two entities (`/v1/decode`): the DB narrows the
|
|
297
|
+
* candidates to the type pair's admissible relations (WS10), answers alone
|
|
298
|
+
* when the pair forces a single relation, and otherwise decodes it with the
|
|
299
|
+
* graph-native fine-tuned model — the "DB narrows, cheap model decodes" call.
|
|
300
|
+
*/
|
|
301
|
+
decode(body: Schemas["DecodeRequest"]): Promise<Schemas["DecodeResponse"]>;
|
|
302
|
+
/**
|
|
303
|
+
* Report which completion mechanisms will carry on this graph (WS13):
|
|
304
|
+
* signature sparsity, name semantics, sampled narrowing recall, and a
|
|
305
|
+
* narrow / narrow+finetune / lexical-first recommendation.
|
|
306
|
+
*/
|
|
307
|
+
groundability(opts?: {
|
|
308
|
+
sample?: number;
|
|
309
|
+
}): Promise<Schemas["GroundabilityReport"]>;
|
|
396
310
|
/**
|
|
397
311
|
* Append relevance labels for a set of search results — how Little Big Brain
|
|
398
312
|
* gathers customer-specific qrels. Grade results (3 ideal/good, 1 partial,
|
|
@@ -617,148 +531,9 @@ export declare class LbbClient {
|
|
|
617
531
|
* co-located service uses it (with `?stack=<slug>`) to call the data plane on
|
|
618
532
|
* the account's behalf without handling the stack's mode-bearing stack key.
|
|
619
533
|
*/
|
|
620
|
-
adminMintSession(accountId: string): Promise<LbbAdminSessionResponse>;
|
|
534
|
+
adminMintSession(accountId: string, ttlSeconds?: number): Promise<LbbAdminSessionResponse>;
|
|
621
535
|
/** Customer-visible activity for one database stack. */
|
|
622
536
|
adminStackActivity(slug: string, window?: LbbStackActivityWindow): Promise<LbbStackActivityResponse>;
|
|
623
537
|
/** Activity for the stack selected by the bearer stack key or session. */
|
|
624
538
|
stackActivity(window?: LbbStackActivityWindow): Promise<LbbStackActivityResponse>;
|
|
625
539
|
}
|
|
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 {};
|