@littlebigbrain/client 0.14.0 → 0.16.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 +46 -43
- package/dist/client.js +62 -71
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/namespaces.d.ts +79 -18
- package/dist/namespaces.js +128 -22
- package/dist/schema.d.ts +11634 -6173
- package/dist/transport.d.ts +17 -2
- package/dist/transport.js +14 -0
- package/dist/types.d.ts +21 -1
- package/dist/types.js +21 -2
- package/dist/workflows.d.ts +207 -0
- package/dist/workflows.js +518 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { WorkflowNamespace } from "./workflows.js";
|
|
1
2
|
import type { DurableImportSource, ImportLine, LbbClientOptions, ListResponse, RawLbbResponse, ReadConsistencyOptions, RdfImportDocument, RdfImportManyResult, RdfImportOptions, Schemas, SearchConsistency, SparqlResults } from "./types.js";
|
|
2
|
-
import { type
|
|
3
|
+
import { type RequestOptions } from "./transport.js";
|
|
3
4
|
import { EntityNamespace, GraphNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace, EvalsNamespace, EmbeddingsNamespace } from "./namespaces.js";
|
|
4
5
|
export { parseSparqlResults } from "./types.js";
|
|
5
6
|
export type { AttributeFilter, AttributeFilterOp, AttributeFilterValue, EntityAttributeFilterOptions, EntityPropertiesLine, DurableImportLine, DurableImportSource, FetchLike, FlatProperties, ImportLine, LbbClientOptions, LbbRequestEvent, LbbResponseEvent, LbbRetryEvent, LbbErrorPayload, ListResponse, RawLbbResponse, ReadConsistencyOptions, RdfImportDocument, RdfImportManyResult, RdfImportOptions, Schemas, SearchConsistency, SparqlResults, SparqlResultsJson, SparqlTerm, CommitRequest, CommitResponse, Entity, EntitySelector, GraphMetadata, GraphSummary, SchemaView, Snapshot, } from "./types.js";
|
|
@@ -35,6 +36,7 @@ export declare class LbbClient {
|
|
|
35
36
|
readonly query: QueryNamespace;
|
|
36
37
|
readonly evals: EvalsNamespace;
|
|
37
38
|
readonly embeddings: EmbeddingsNamespace;
|
|
39
|
+
readonly workflows: WorkflowNamespace;
|
|
38
40
|
constructor(options: LbbClientOptions);
|
|
39
41
|
graph(name: string, opts?: {
|
|
40
42
|
stack?: string;
|
|
@@ -290,34 +292,6 @@ export declare class LbbClient {
|
|
|
290
292
|
}): Promise<Schemas["SearchFeedbackResponse"]>;
|
|
291
293
|
/** Export the stored relevance labels as qrels-style rows for training. */
|
|
292
294
|
searchFeedbackExport(): Promise<Schemas["SearchFeedbackExportResponse"]>;
|
|
293
|
-
/**
|
|
294
|
-
* Ranked incoming/outgoing neighborhood for a graph entity.
|
|
295
|
-
*
|
|
296
|
-
* `edges` caps the edges returned per direction (default 1000, maximum
|
|
297
|
-
* 10000). When a cap cuts a direction the response carries a `truncation`
|
|
298
|
-
* block; an uncut response omits it entirely.
|
|
299
|
-
*/
|
|
300
|
-
entityNeighborhood(opts: {
|
|
301
|
-
id?: string;
|
|
302
|
-
type?: string;
|
|
303
|
-
name?: string;
|
|
304
|
-
relations?: string[];
|
|
305
|
-
asOf?: string;
|
|
306
|
-
edges?: number;
|
|
307
|
-
}): Promise<Schemas["EntityNeighborhoodResponse"]>;
|
|
308
|
-
/** Exact type cardinality plus a bounded deterministic sample from Base. */
|
|
309
|
-
entityTypeSample(opts: {
|
|
310
|
-
type: string;
|
|
311
|
-
limit?: number;
|
|
312
|
-
} & CallOptions): Promise<Schemas["EntityTypeSampleResponse"]>;
|
|
313
|
-
/** Stored entity object-ref status and index-coverage metadata (no
|
|
314
|
-
* attributes — read those from `entityDetail`'s top-level `attributes`). */
|
|
315
|
-
entityMetadata(opts: {
|
|
316
|
-
id?: string;
|
|
317
|
-
type?: string;
|
|
318
|
-
name?: string;
|
|
319
|
-
asOf?: string;
|
|
320
|
-
}): Promise<Schemas["EntityMetadataResponse"]>;
|
|
321
295
|
/**
|
|
322
296
|
* Read projected attributes and current relationships from one RDF snapshot.
|
|
323
297
|
* Inspect `unavailable_sections` before interpreting legacy provenance arrays.
|
|
@@ -341,14 +315,6 @@ export declare class LbbClient {
|
|
|
341
315
|
* The caller supplies a bounded collection endpoint and its cursor.
|
|
342
316
|
*/
|
|
343
317
|
listAll<T>(fetchPage: (cursor?: string) => Promise<ListResponse<T>>): AsyncGenerator<T, void, unknown>;
|
|
344
|
-
/** Current state of an entity's relations, optionally as-of a timestamp. */
|
|
345
|
-
currentState(body: Schemas["CurrentStateRequest"]): Promise<Schemas["CurrentStateResponse"]>;
|
|
346
|
-
/** Full edge-event history for a relationship. */
|
|
347
|
-
history(body: Schemas["RelationshipHistoryRequest"]): Promise<Schemas["RelationshipHistoryResponse"]>;
|
|
348
|
-
/** Ordered state-transition log for an entity's relation, with dwell time. */
|
|
349
|
-
transitions(body: Schemas["EntityTransitionsRequest"]): Promise<Schemas["EntityTransitionsResponse"]>;
|
|
350
|
-
/** Lineage and evidence for a single edge. */
|
|
351
|
-
why(body: Schemas["WhyRequest"]): Promise<Schemas["WhyResponse"]>;
|
|
352
318
|
/**
|
|
353
319
|
* SPARQL-subset SELECT/ASK/aggregate query (FILTER, HAVING, ORDER BY, ASK,
|
|
354
320
|
* COUNT/SUM/AVG/MIN/MAX). GROUP BY is not limited to entity identity:
|
|
@@ -360,14 +326,27 @@ export declare class LbbClient {
|
|
|
360
326
|
* `groups[].keys`.
|
|
361
327
|
*/
|
|
362
328
|
sparql(body: Schemas["SparqlSelectRequest"], opts?: ReadConsistencyOptions): Promise<Schemas["SparqlSelectResponse"]>;
|
|
363
|
-
/**
|
|
329
|
+
/**
|
|
330
|
+
* SPARQL 1.1 query from text (SELECT/ASK) over the live graph; `results` is
|
|
331
|
+
* SPARQL 1.1 Query Results JSON. The text dialect carries
|
|
332
|
+
* `consistency`/`min_indexed_seq` on the URL; a floor with no explicit
|
|
333
|
+
* consistency implies a strong base-plus-delta read. `as_of_commit_seq` in
|
|
334
|
+
* the body reads the retained published generation of that exact commit.
|
|
335
|
+
*
|
|
336
|
+
* The query is read-only, so a retryable `429` (for example
|
|
337
|
+
* `read_your_writes_pending` while publication catches up to the floor) is
|
|
338
|
+
* retried within the retry budget. A `5xx` is not retried: a query that
|
|
339
|
+
* timed out would run again.
|
|
340
|
+
*/
|
|
364
341
|
sparqlText(body: Schemas["SparqlTextRequest"], opts?: ReadConsistencyOptions): Promise<Schemas["SparqlTextResponse"]>;
|
|
365
342
|
/**
|
|
366
343
|
* Run a SPARQL 1.1 text query and return parsed results — the ergonomic
|
|
367
344
|
* complement to {@link sparqlText} (which hands back the raw results string).
|
|
368
|
-
* Returns `{ vars, boolean, bindings, rows }` via
|
|
369
|
-
* `rows` is the bindings flattened to
|
|
370
|
-
* is the ASK answer (or `null` for a
|
|
345
|
+
* Returns `{ vars, boolean, bindings, rows, snapshot }` via
|
|
346
|
+
* {@link parseSparqlResults}: `rows` is the bindings flattened to
|
|
347
|
+
* `{ variable: lexicalValue }`, `boolean` is the ASK answer (or `null` for a
|
|
348
|
+
* SELECT), and `snapshot.served_at_seq` is the commit an eventual or pinned
|
|
349
|
+
* read answered from (`snapshot` is `null` for a plain strong read).
|
|
371
350
|
*/
|
|
372
351
|
sparqlRows(body: Schemas["SparqlTextRequest"], opts?: ReadConsistencyOptions): Promise<SparqlResults>;
|
|
373
352
|
/**
|
|
@@ -410,8 +389,6 @@ export declare class LbbClient {
|
|
|
410
389
|
* migration is needed — and a request that changes nothing is a no-op.
|
|
411
390
|
*/
|
|
412
391
|
evolveOntology(body: Schemas["OntologyEvolveRequest"]): Promise<Schemas["OntologyEvolveResponse"]>;
|
|
413
|
-
/** Suggest ontology additions from the current graph without mutating it. */
|
|
414
|
-
induceOntology(body: Schemas["OntologyInduceRequest"]): Promise<Schemas["OntologyInduceResponse"]>;
|
|
415
392
|
/** Fold the WAL tail into snapshot segments. */
|
|
416
393
|
compact(opts?: {
|
|
417
394
|
minTailCommits?: number;
|
|
@@ -425,9 +402,23 @@ export declare class LbbClient {
|
|
|
425
402
|
}): Promise<Schemas["GraphMetadataResponse"]>;
|
|
426
403
|
/** Automatic publication lifecycle, available before the first generation exists. */
|
|
427
404
|
publicationStatus(): Promise<Schemas["PublicationStatusResponse"]>;
|
|
405
|
+
/** Background work on the graph: publication, compaction, query
|
|
406
|
+
* statistics, validation, embeddings, and imports, exports, forks and
|
|
407
|
+
* index upgrades. One call reads at most 30 objects, so a status view can
|
|
408
|
+
* poll it every few seconds. Needs the server capability
|
|
409
|
+
* `graph_activity_v1`. */
|
|
410
|
+
activity(): Promise<Schemas["GraphActivityResponse"]>;
|
|
428
411
|
/** The managed models the platform uses per role (embedding, judge,
|
|
429
412
|
* rewriter): the operator's catalog, or the compiled defaults. */
|
|
430
413
|
managedModels(): Promise<Schemas["ManagedModelsResponse"]>;
|
|
414
|
+
/** What each managed model did for the stack in one month (`yyyy-mm`,
|
|
415
|
+
* UTC; the current month by default): totals, by day and by graph per
|
|
416
|
+
* feature (`index`, `search`, `fit`, `judge`, `training`) and model, the
|
|
417
|
+
* months with activity, and the model each feature uses now. A stack
|
|
418
|
+
* read: the graph scope is not used. */
|
|
419
|
+
modelActivity(opts?: {
|
|
420
|
+
month?: string;
|
|
421
|
+
}): Promise<Schemas["ModelActivityResponse"]>;
|
|
431
422
|
/** Wait until background reconciliation folds `targetSeq` into the RDF base. */
|
|
432
423
|
waitForPublished(targetSeq: number, opts?: {
|
|
433
424
|
timeoutMs?: number;
|
|
@@ -435,6 +426,18 @@ export declare class LbbClient {
|
|
|
435
426
|
}): Promise<Schemas["PublicationStatusResponse"]>;
|
|
436
427
|
/** Graph counts and type/relation buckets. Carries `consistency`/`min_indexed_seq` on the URL. */
|
|
437
428
|
summary(opts?: ReadConsistencyOptions): Promise<Schemas["GraphSummaryResponse"]>;
|
|
429
|
+
/**
|
|
430
|
+
* The SPARQL planner's statistics for the published generation latest reads
|
|
431
|
+
* use: per-predicate triple and distinct counts (by triple count, paged by
|
|
432
|
+
* `cursor`/`limit`, 200 by default and 500 at most), key-histogram,
|
|
433
|
+
* pair-count and trigram sidecars, and value-order index coverage. Read from
|
|
434
|
+
* the generation's manifest and sidecar metadata; nothing scans the graph.
|
|
435
|
+
* A graph with no published generation answers `served_at_seq: null`.
|
|
436
|
+
*/
|
|
437
|
+
plannerStats(opts?: {
|
|
438
|
+
cursor?: string;
|
|
439
|
+
limit?: number;
|
|
440
|
+
}): Promise<Schemas["PlannerStatsResponse"]>;
|
|
438
441
|
/** Pinned published read root and its query/conformance lag against one coherent head. */
|
|
439
442
|
readSnapshot(): Promise<Schemas["PublishedReadStatusResponse"]>;
|
|
440
443
|
/**
|
package/dist/client.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { WorkflowNamespace } from "./workflows.js";
|
|
2
|
+
import { parseSparqlResults, profileBody } from "./types.js";
|
|
3
|
+
import { bodyMarksTerminal, errorCodeFromBody, fullJitterBackoffMs, parseLbbError, parseResponseJson, retriesNetworkFailure, retriesStatus, retryAllowed, retryableStatus, retryDelayMs, sleep, } from "./transport.js";
|
|
3
4
|
import { LbbCapabilityError } from "./transport.js";
|
|
4
5
|
import { EntityNamespace, GraphNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace, EvalsNamespace, EmbeddingsNamespace, } from "./namespaces.js";
|
|
5
6
|
export { parseSparqlResults } from "./types.js";
|
|
@@ -111,6 +112,7 @@ export class LbbClient {
|
|
|
111
112
|
query;
|
|
112
113
|
evals;
|
|
113
114
|
embeddings;
|
|
115
|
+
workflows;
|
|
114
116
|
constructor(options) {
|
|
115
117
|
const baseUrl = options.baseUrl?.trim();
|
|
116
118
|
if (!baseUrl) {
|
|
@@ -154,6 +156,7 @@ export class LbbClient {
|
|
|
154
156
|
this.query = new QueryNamespace(this);
|
|
155
157
|
this.evals = new EvalsNamespace(this);
|
|
156
158
|
this.embeddings = new EmbeddingsNamespace(this);
|
|
159
|
+
this.workflows = new WorkflowNamespace(this);
|
|
157
160
|
}
|
|
158
161
|
graph(name, opts = {}) {
|
|
159
162
|
return new GraphNamespace(this.withScope({
|
|
@@ -237,7 +240,7 @@ export class LbbClient {
|
|
|
237
240
|
if (opts.idempotencyKey !== undefined)
|
|
238
241
|
headers["idempotency-key"] = opts.idempotencyKey;
|
|
239
242
|
Object.assign(headers, opts.headers ?? {});
|
|
240
|
-
const
|
|
243
|
+
const retry = opts.retry ?? retryAllowed(method, opts.idempotencyKey);
|
|
241
244
|
const body = opts.rawBody !== undefined
|
|
242
245
|
? opts.rawBody
|
|
243
246
|
: opts.body !== undefined
|
|
@@ -302,7 +305,9 @@ export class LbbClient {
|
|
|
302
305
|
cause: error,
|
|
303
306
|
}), { name: "TimeoutError" })
|
|
304
307
|
: error;
|
|
305
|
-
if (!callerAborted &&
|
|
308
|
+
if (!callerAborted &&
|
|
309
|
+
retriesNetworkFailure(retry) &&
|
|
310
|
+
attempt < maxRetries) {
|
|
306
311
|
const delayMs = fullJitterBackoffMs(this.retryDelayMs, attempt);
|
|
307
312
|
if (Date.now() + delayMs <= deadline) {
|
|
308
313
|
this.onRetry?.({
|
|
@@ -329,7 +334,7 @@ export class LbbClient {
|
|
|
329
334
|
attempt === maxRetries) {
|
|
330
335
|
break;
|
|
331
336
|
}
|
|
332
|
-
if (!
|
|
337
|
+
if (!retriesStatus(retry, response.status)) {
|
|
333
338
|
break;
|
|
334
339
|
}
|
|
335
340
|
// Honor the server's typed body verdict: a terminal error
|
|
@@ -804,45 +809,6 @@ export class LbbClient {
|
|
|
804
809
|
searchFeedbackExport() {
|
|
805
810
|
return this.request("GET", "/v1/search/feedback/export");
|
|
806
811
|
}
|
|
807
|
-
/**
|
|
808
|
-
* Ranked incoming/outgoing neighborhood for a graph entity.
|
|
809
|
-
*
|
|
810
|
-
* `edges` caps the edges returned per direction (default 1000, maximum
|
|
811
|
-
* 10000). When a cap cuts a direction the response carries a `truncation`
|
|
812
|
-
* block; an uncut response omits it entirely.
|
|
813
|
-
*/
|
|
814
|
-
entityNeighborhood(opts) {
|
|
815
|
-
return this.request("GET", "/v1/graph/entity/neighborhood", {
|
|
816
|
-
query: {
|
|
817
|
-
id: opts.id,
|
|
818
|
-
type: opts.type,
|
|
819
|
-
name: opts.name,
|
|
820
|
-
relations: opts.relations?.join(","),
|
|
821
|
-
as_of: opts.asOf,
|
|
822
|
-
edges: opts.edges,
|
|
823
|
-
},
|
|
824
|
-
});
|
|
825
|
-
}
|
|
826
|
-
/** Exact type cardinality plus a bounded deterministic sample from Base. */
|
|
827
|
-
entityTypeSample(opts) {
|
|
828
|
-
const { type, limit, ...request } = opts;
|
|
829
|
-
return this.request("GET", "/v1/graph/entities/sample", {
|
|
830
|
-
...request,
|
|
831
|
-
query: { type, limit },
|
|
832
|
-
});
|
|
833
|
-
}
|
|
834
|
-
/** Stored entity object-ref status and index-coverage metadata (no
|
|
835
|
-
* attributes — read those from `entityDetail`'s top-level `attributes`). */
|
|
836
|
-
entityMetadata(opts) {
|
|
837
|
-
return this.request("GET", "/v1/graph/entity/metadata", {
|
|
838
|
-
query: {
|
|
839
|
-
id: opts.id,
|
|
840
|
-
type: opts.type,
|
|
841
|
-
name: opts.name,
|
|
842
|
-
as_of: opts.asOf,
|
|
843
|
-
},
|
|
844
|
-
});
|
|
845
|
-
}
|
|
846
812
|
/**
|
|
847
813
|
* Read projected attributes and current relationships from one RDF snapshot.
|
|
848
814
|
* Inspect `unavailable_sections` before interpreting legacy provenance arrays.
|
|
@@ -879,23 +845,7 @@ export class LbbClient {
|
|
|
879
845
|
cursor = page.next_cursor;
|
|
880
846
|
}
|
|
881
847
|
}
|
|
882
|
-
// ---
|
|
883
|
-
/** Current state of an entity's relations, optionally as-of a timestamp. */
|
|
884
|
-
currentState(body) {
|
|
885
|
-
return this.request("POST", "/v1/query/state", { body });
|
|
886
|
-
}
|
|
887
|
-
/** Full edge-event history for a relationship. */
|
|
888
|
-
history(body) {
|
|
889
|
-
return this.request("POST", "/v1/query/history", { body });
|
|
890
|
-
}
|
|
891
|
-
/** Ordered state-transition log for an entity's relation, with dwell time. */
|
|
892
|
-
transitions(body) {
|
|
893
|
-
return this.request("POST", "/v1/query/transitions", { body });
|
|
894
|
-
}
|
|
895
|
-
/** Lineage and evidence for a single edge. */
|
|
896
|
-
why(body) {
|
|
897
|
-
return this.request("POST", "/v1/query/why", { body });
|
|
898
|
-
}
|
|
848
|
+
// --- query ---
|
|
899
849
|
/**
|
|
900
850
|
* SPARQL-subset SELECT/ASK/aggregate query (FILTER, HAVING, ORDER BY, ASK,
|
|
901
851
|
* COUNT/SUM/AVG/MIN/MAX). GROUP BY is not limited to entity identity:
|
|
@@ -908,22 +858,36 @@ export class LbbClient {
|
|
|
908
858
|
*/
|
|
909
859
|
sparql(body, opts) {
|
|
910
860
|
return this.request("POST", "/v1/query/sparql", {
|
|
911
|
-
body: this.mergeReadConsistency(body, opts),
|
|
861
|
+
body: profileBody(this.mergeReadConsistency(body, opts)),
|
|
912
862
|
});
|
|
913
863
|
}
|
|
914
|
-
/**
|
|
864
|
+
/**
|
|
865
|
+
* SPARQL 1.1 query from text (SELECT/ASK) over the live graph; `results` is
|
|
866
|
+
* SPARQL 1.1 Query Results JSON. The text dialect carries
|
|
867
|
+
* `consistency`/`min_indexed_seq` on the URL; a floor with no explicit
|
|
868
|
+
* consistency implies a strong base-plus-delta read. `as_of_commit_seq` in
|
|
869
|
+
* the body reads the retained published generation of that exact commit.
|
|
870
|
+
*
|
|
871
|
+
* The query is read-only, so a retryable `429` (for example
|
|
872
|
+
* `read_your_writes_pending` while publication catches up to the floor) is
|
|
873
|
+
* retried within the retry budget. A `5xx` is not retried: a query that
|
|
874
|
+
* timed out would run again.
|
|
875
|
+
*/
|
|
915
876
|
sparqlText(body, opts) {
|
|
916
877
|
return this.request("POST", "/v1/query/sparql-text", {
|
|
917
|
-
body,
|
|
878
|
+
body: profileBody(body),
|
|
918
879
|
query: this.readConsistencyQuery(opts),
|
|
880
|
+
retry: "rate_limited",
|
|
919
881
|
});
|
|
920
882
|
}
|
|
921
883
|
/**
|
|
922
884
|
* Run a SPARQL 1.1 text query and return parsed results — the ergonomic
|
|
923
885
|
* complement to {@link sparqlText} (which hands back the raw results string).
|
|
924
|
-
* Returns `{ vars, boolean, bindings, rows }` via
|
|
925
|
-
* `rows` is the bindings flattened to
|
|
926
|
-
* is the ASK answer (or `null` for a
|
|
886
|
+
* Returns `{ vars, boolean, bindings, rows, snapshot }` via
|
|
887
|
+
* {@link parseSparqlResults}: `rows` is the bindings flattened to
|
|
888
|
+
* `{ variable: lexicalValue }`, `boolean` is the ASK answer (or `null` for a
|
|
889
|
+
* SELECT), and `snapshot.served_at_seq` is the commit an eventual or pinned
|
|
890
|
+
* read answered from (`snapshot` is `null` for a plain strong read).
|
|
927
891
|
*/
|
|
928
892
|
async sparqlRows(body, opts) {
|
|
929
893
|
return parseSparqlResults(await this.sparqlText(body, opts));
|
|
@@ -983,10 +947,6 @@ export class LbbClient {
|
|
|
983
947
|
evolveOntology(body) {
|
|
984
948
|
return this.request("POST", "/v1/ontology/evolve", { body });
|
|
985
949
|
}
|
|
986
|
-
/** Suggest ontology additions from the current graph without mutating it. */
|
|
987
|
-
induceOntology(body) {
|
|
988
|
-
return this.request("POST", "/v1/ontology/induce", { body, retry: true });
|
|
989
|
-
}
|
|
990
950
|
/** Fold the WAL tail into snapshot segments. */
|
|
991
951
|
compact(opts = {}) {
|
|
992
952
|
return this.request("POST", "/v1/graph/compact", {
|
|
@@ -1013,11 +973,29 @@ export class LbbClient {
|
|
|
1013
973
|
publicationStatus() {
|
|
1014
974
|
return this.request("GET", "/v1/graph/publication-status");
|
|
1015
975
|
}
|
|
976
|
+
/** Background work on the graph: publication, compaction, query
|
|
977
|
+
* statistics, validation, embeddings, and imports, exports, forks and
|
|
978
|
+
* index upgrades. One call reads at most 30 objects, so a status view can
|
|
979
|
+
* poll it every few seconds. Needs the server capability
|
|
980
|
+
* `graph_activity_v1`. */
|
|
981
|
+
activity() {
|
|
982
|
+
return this.request("GET", "/v1/graph/activity");
|
|
983
|
+
}
|
|
1016
984
|
/** The managed models the platform uses per role (embedding, judge,
|
|
1017
985
|
* rewriter): the operator's catalog, or the compiled defaults. */
|
|
1018
986
|
managedModels() {
|
|
1019
987
|
return this.request("GET", "/v1/managed-models");
|
|
1020
988
|
}
|
|
989
|
+
/** What each managed model did for the stack in one month (`yyyy-mm`,
|
|
990
|
+
* UTC; the current month by default): totals, by day and by graph per
|
|
991
|
+
* feature (`index`, `search`, `fit`, `judge`, `training`) and model, the
|
|
992
|
+
* months with activity, and the model each feature uses now. A stack
|
|
993
|
+
* read: the graph scope is not used. */
|
|
994
|
+
modelActivity(opts = {}) {
|
|
995
|
+
return this.request("GET", "/v1/models/activity", {
|
|
996
|
+
query: { month: opts.month },
|
|
997
|
+
});
|
|
998
|
+
}
|
|
1021
999
|
/** Wait until background reconciliation folds `targetSeq` into the RDF base. */
|
|
1022
1000
|
async waitForPublished(targetSeq, opts = {}) {
|
|
1023
1001
|
if (!Number.isSafeInteger(targetSeq) || targetSeq < 0) {
|
|
@@ -1054,6 +1032,19 @@ export class LbbClient {
|
|
|
1054
1032
|
query: this.readConsistencyQuery(opts),
|
|
1055
1033
|
});
|
|
1056
1034
|
}
|
|
1035
|
+
/**
|
|
1036
|
+
* The SPARQL planner's statistics for the published generation latest reads
|
|
1037
|
+
* use: per-predicate triple and distinct counts (by triple count, paged by
|
|
1038
|
+
* `cursor`/`limit`, 200 by default and 500 at most), key-histogram,
|
|
1039
|
+
* pair-count and trigram sidecars, and value-order index coverage. Read from
|
|
1040
|
+
* the generation's manifest and sidecar metadata; nothing scans the graph.
|
|
1041
|
+
* A graph with no published generation answers `served_at_seq: null`.
|
|
1042
|
+
*/
|
|
1043
|
+
plannerStats(opts = {}) {
|
|
1044
|
+
return this.request("GET", "/v1/graph/planner-stats", {
|
|
1045
|
+
query: { cursor: opts.cursor, limit: opts.limit },
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
1057
1048
|
/** Pinned published read root and its query/conformance lag against one coherent head. */
|
|
1058
1049
|
readSnapshot() {
|
|
1059
1050
|
return this.request("GET", "/v1/graph/read-snapshot");
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { LbbCapabilityError, LbbClient, LbbError, parseSparqlResults, } from "./client.js";
|
|
2
2
|
export type { DurableImportLine, DurableImportSource, LbbClientOptions, CallOptions, RequestOptions, LbbRequestEvent, LbbResponseEvent, FetchLike, ReadConsistencyOptions, SearchConsistency, Schemas, SparqlResults, SparqlResultsJson, SparqlTerm, CommitRequest, CommitResponse, Entity, EntitySelector, GraphMetadata, GraphSummary, SchemaView, Snapshot, } from "./client.js";
|
|
3
3
|
export type { components, paths, operations } from "./schema.js";
|
|
4
|
+
export { workflow, WorkflowWorker, WorkflowHandle, WorkflowNamespace, WorkflowError, } from "./workflows.js";
|
|
5
|
+
export type { WorkflowContext, WorkflowStepOptions, WorkflowStepContext, WorkflowSignalResult, WorkflowDefinition, WorkflowResult, } from "./workflows.js";
|
package/dist/index.js
CHANGED
package/dist/namespaces.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import type { WorkflowNamespace } from "./workflows.js";
|
|
1
2
|
import type { LbbClient } from "./client.js";
|
|
2
3
|
import type { CallOptions } from "./transport.js";
|
|
3
4
|
import { type EntityAttributeFilterOptions, type ImportLine, type ReadConsistencyOptions, type RdfImportDocument, type RdfImportManyResult, type RdfImportOptions, type Schemas } from "./types.js";
|
|
5
|
+
/** Ask the server to return its measurements for one query. */
|
|
6
|
+
export interface ProfileOption {
|
|
7
|
+
/** Same as `profile: true` in the request body. */
|
|
8
|
+
profile?: boolean;
|
|
9
|
+
}
|
|
4
10
|
export declare class GraphNamespace {
|
|
5
11
|
private readonly client;
|
|
6
12
|
readonly facts: FactsNamespace;
|
|
@@ -11,9 +17,20 @@ export declare class GraphNamespace {
|
|
|
11
17
|
readonly search: SearchNamespace;
|
|
12
18
|
readonly evals: EvalsNamespace;
|
|
13
19
|
readonly embeddings: EmbeddingsNamespace;
|
|
20
|
+
readonly workflows: WorkflowNamespace;
|
|
14
21
|
constructor(client: LbbClient);
|
|
15
22
|
/** Publication lifecycle for this graph, including pre-first-publish state. */
|
|
16
23
|
publicationStatus(): Promise<Schemas["PublicationStatusResponse"]>;
|
|
24
|
+
/** Background work on this graph. See {@link LbbClient.activity}. */
|
|
25
|
+
activity(): Promise<Schemas["GraphActivityResponse"]>;
|
|
26
|
+
/**
|
|
27
|
+
* The SPARQL planner's statistics for the published generation latest reads
|
|
28
|
+
* use. See {@link LbbClient.plannerStats}.
|
|
29
|
+
*/
|
|
30
|
+
plannerStats(opts?: {
|
|
31
|
+
cursor?: string;
|
|
32
|
+
limit?: number;
|
|
33
|
+
}): Promise<Schemas["PlannerStatsResponse"]>;
|
|
17
34
|
/** Wait until this graph has an exact generation covering `targetSeq`. */
|
|
18
35
|
waitForPublished(targetSeq: number, opts?: {
|
|
19
36
|
timeoutMs?: number;
|
|
@@ -61,20 +78,6 @@ export declare class SearchNamespace {
|
|
|
61
78
|
export declare class EntityNamespace {
|
|
62
79
|
private readonly client;
|
|
63
80
|
constructor(client: LbbClient);
|
|
64
|
-
/**
|
|
65
|
-
* Return the exact type cardinality and a bounded deterministic sample from
|
|
66
|
-
* the Base family pinned by the published generation.
|
|
67
|
-
*/
|
|
68
|
-
sample(opts: {
|
|
69
|
-
type: string;
|
|
70
|
-
limit?: number;
|
|
71
|
-
} & CallOptions): Promise<Schemas["EntityTypeSampleResponse"]>;
|
|
72
|
-
get(opts: {
|
|
73
|
-
id?: string;
|
|
74
|
-
type?: string;
|
|
75
|
-
name?: string;
|
|
76
|
-
asOf?: string;
|
|
77
|
-
}): Promise<Schemas["EntityMetadataResponse"]>;
|
|
78
81
|
detail(opts: Parameters<LbbClient["entityDetail"]>[0]): Promise<Schemas["EntityDetailResponse"]>;
|
|
79
82
|
/**
|
|
80
83
|
* Filter entities already bound by relation patterns using typed attributes,
|
|
@@ -177,14 +180,67 @@ export declare class SchemaNamespace {
|
|
|
177
180
|
dryRun?: boolean;
|
|
178
181
|
}): Promise<Schemas["SchemaPublishResponse"]>;
|
|
179
182
|
}
|
|
183
|
+
/** Filters for {@link OntologySuggestionsNamespace.list}. */
|
|
184
|
+
export interface OntologySuggestionListOptions extends CallOptions {
|
|
185
|
+
status?: Schemas["OntologyChangeSuggestionStatus"];
|
|
186
|
+
originKind?: Schemas["SuggestionOriginKind"];
|
|
187
|
+
/** Producer id, for example an integration connection id. */
|
|
188
|
+
originId?: string;
|
|
189
|
+
/** Class, property or relation name. */
|
|
190
|
+
anchor?: string;
|
|
191
|
+
key?: string;
|
|
192
|
+
/** Default 100, maximum 500. */
|
|
193
|
+
limit?: number;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Ontology change suggestions: durable proposals from integrations,
|
|
197
|
+
* agents and people. People accept or dismiss them; accepting
|
|
198
|
+
* applies the change to the current ontology.
|
|
199
|
+
*/
|
|
200
|
+
export declare class OntologySuggestionsNamespace {
|
|
201
|
+
private readonly client;
|
|
202
|
+
constructor(client: LbbClient);
|
|
203
|
+
/** Newest update first, with counts per status over the whole graph. */
|
|
204
|
+
list(options?: OntologySuggestionListOptions): Promise<Schemas["OntologyChangeSuggestionList"]>;
|
|
205
|
+
/** One suggestion with its evidence, impact and discussion. */
|
|
206
|
+
get(suggestionId: string, opts?: CallOptions): Promise<Schemas["OntologyChangeSuggestion"]>;
|
|
207
|
+
/**
|
|
208
|
+
* File a suggestion, or update the one with the same `key`. The server
|
|
209
|
+
* dry-runs the change and never changes the ontology here, so a retry is
|
|
210
|
+
* safe.
|
|
211
|
+
*/
|
|
212
|
+
create(body: Schemas["OntologyChangeSuggestionCreateRequest"], opts?: CallOptions): Promise<Schemas["OntologyChangeSuggestion"]>;
|
|
213
|
+
/** Dry-run the change against the current ontology and store the impact. */
|
|
214
|
+
validate(suggestionId: string, opts?: CallOptions): Promise<Schemas["OntologyChangeSuggestion"]>;
|
|
215
|
+
/**
|
|
216
|
+
* Apply the change to the current ontology. Pass `change` to accept an
|
|
217
|
+
* edited change. Accepting twice returns the accepted suggestion.
|
|
218
|
+
*/
|
|
219
|
+
accept(suggestionId: string, body?: Schemas["OntologyChangeSuggestionAcceptRequest"], opts?: CallOptions): Promise<Schemas["OntologyChangeSuggestion"]>;
|
|
220
|
+
/** Decline with a reason. The ontology does not change. */
|
|
221
|
+
dismiss(suggestionId: string, body: Schemas["OntologyChangeSuggestionDecisionRequest"], opts?: CallOptions): Promise<Schemas["OntologyChangeSuggestion"]>;
|
|
222
|
+
/** Withdraw as the producer, for example when the source field is gone. */
|
|
223
|
+
supersede(suggestionId: string, body: Schemas["OntologyChangeSuggestionDecisionRequest"], opts?: CallOptions): Promise<Schemas["OntologyChangeSuggestion"]>;
|
|
224
|
+
/** Add a comment to the discussion. */
|
|
225
|
+
comment(suggestionId: string, body: Schemas["OntologyChangeSuggestionCommentRequest"], opts?: CallOptions): Promise<Schemas["OntologyChangeSuggestion"]>;
|
|
226
|
+
}
|
|
180
227
|
/** Ontology discovery and lifecycle operations. */
|
|
181
228
|
export declare class OntologyNamespace {
|
|
182
229
|
private readonly client;
|
|
230
|
+
/** Reviewable change suggestions from every producer. */
|
|
231
|
+
readonly suggestions: OntologySuggestionsNamespace;
|
|
183
232
|
constructor(client: LbbClient);
|
|
184
233
|
view(options?: {
|
|
185
234
|
counts?: boolean;
|
|
186
235
|
} & CallOptions): Promise<Schemas["OntologyView"]>;
|
|
187
|
-
|
|
236
|
+
/**
|
|
237
|
+
* Read the published SHACL conformance report. `limit` bounds the returned
|
|
238
|
+
* `results` (server default 200, maximum 2,000); `result_count` and
|
|
239
|
+
* `conforms` stay exact, and `truncated` says the window is partial.
|
|
240
|
+
*/
|
|
241
|
+
conformance(opts?: CallOptions & Pick<ReadConsistencyOptions, "consistency"> & {
|
|
242
|
+
limit?: number;
|
|
243
|
+
}): Promise<Schemas["SchemaAuditReport"]>;
|
|
188
244
|
search(body: Schemas["OntologySearchRequest"], opts?: CallOptions): Promise<Schemas["OntologySearchResponse"]>;
|
|
189
245
|
resolve(body: Schemas["OntologyResolveRequest"], opts?: CallOptions): Promise<Schemas["OntologyResolveResponse"]>;
|
|
190
246
|
/**
|
|
@@ -195,13 +251,18 @@ export declare class OntologyNamespace {
|
|
|
195
251
|
evolve(body: Schemas["OntologyEvolveRequest"], opts?: CallOptions & {
|
|
196
252
|
dryRun?: boolean;
|
|
197
253
|
}): Promise<Schemas["OntologyEvolveResponse"]>;
|
|
198
|
-
induce(body: Schemas["OntologyInduceRequest"], opts?: CallOptions): Promise<Schemas["OntologyInduceResponse"]>;
|
|
199
254
|
}
|
|
200
255
|
/** Structured and SPARQL-text query operations. */
|
|
201
256
|
export declare class QueryNamespace {
|
|
202
257
|
private readonly client;
|
|
203
258
|
constructor(client: LbbClient);
|
|
204
259
|
structured(body: Schemas["SparqlSelectRequest"], opts?: CallOptions & ReadConsistencyOptions): Promise<Schemas["SparqlSelectResponse"]>;
|
|
205
|
-
|
|
206
|
-
|
|
260
|
+
/**
|
|
261
|
+
* Run a SPARQL text query and parse its rows. `profile: true` (in `opts` or
|
|
262
|
+
* the body) returns the server's measurements in `profile`; a profiled
|
|
263
|
+
* request never uses the result cache.
|
|
264
|
+
*/
|
|
265
|
+
sparql(body: Schemas["SparqlTextRequest"], opts?: CallOptions & ReadConsistencyOptions & ProfileOption): Promise<import("./types.js").SparqlResults>;
|
|
266
|
+
/** As {@link sparql}, returning the raw response with its `results` string. */
|
|
267
|
+
sparqlRaw(body: Schemas["SparqlTextRequest"], opts?: CallOptions & ReadConsistencyOptions & ProfileOption): Promise<Schemas["SparqlTextResponse"]>;
|
|
207
268
|
}
|