@littlebigbrain/client 0.8.0 → 0.8.1
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/README.md +11 -5
- package/dist/client.d.ts +30 -175
- package/dist/client.js +36 -233
- package/dist/index.d.ts +1 -1
- package/dist/namespaces.d.ts +15 -84
- package/dist/namespaces.js +31 -190
- package/dist/schema.d.ts +973 -5668
- package/dist/types.d.ts +2 -17
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { parseSparqlResults } from "./types.js";
|
|
2
2
|
import { bodyMarksTerminal, errorCodeFromBody, fullJitterBackoffMs, parseLbbError, parseResponseJson, retryAllowed, retryableStatus, retryDelayMs, sleep, } from "./transport.js";
|
|
3
|
-
import { ContextNamespace, EntityNamespace, GraphNamespace,
|
|
3
|
+
import { ContextNamespace, EntityNamespace, GraphNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace, } from "./namespaces.js";
|
|
4
4
|
export { parseSparqlResults } from "./types.js";
|
|
5
5
|
export { LbbError } from "./transport.js";
|
|
6
|
-
export { ContextNamespace, EntityNamespace, FactsNamespace, GraphNamespace,
|
|
6
|
+
export { ContextNamespace, EntityNamespace, FactsNamespace, GraphNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace, } from "./namespaces.js";
|
|
7
7
|
/**
|
|
8
8
|
* A typed HTTP client for a little big brain graph server. One instance is scoped to a
|
|
9
9
|
* single graph/branch; construct another for a different scope. All methods
|
|
@@ -28,7 +28,6 @@ export class LbbClient {
|
|
|
28
28
|
defaultConsistency;
|
|
29
29
|
context;
|
|
30
30
|
search;
|
|
31
|
-
indexes;
|
|
32
31
|
entities;
|
|
33
32
|
schema;
|
|
34
33
|
ontology;
|
|
@@ -43,7 +42,7 @@ export class LbbClient {
|
|
|
43
42
|
this.graphName = options.graph;
|
|
44
43
|
this.branchName = options.branch;
|
|
45
44
|
this.stack = options.stack;
|
|
46
|
-
this.apiVersion = options.apiVersion ?? "2026-
|
|
45
|
+
this.apiVersion = options.apiVersion ?? "2026-07-23";
|
|
47
46
|
this.maxRetries = options.maxRetries ?? 6;
|
|
48
47
|
this.retryDelayMs = options.retryDelayMs ?? 100;
|
|
49
48
|
this.retryBudgetMs = options.retryBudgetMs ?? 60_000;
|
|
@@ -72,7 +71,6 @@ export class LbbClient {
|
|
|
72
71
|
this.fetchImpl = chosen;
|
|
73
72
|
this.context = new ContextNamespace(this);
|
|
74
73
|
this.search = new SearchNamespace(this);
|
|
75
|
-
this.indexes = new IndexNamespace(this);
|
|
76
74
|
this.entities = new EntityNamespace(this);
|
|
77
75
|
this.schema = new SchemaNamespace(this);
|
|
78
76
|
this.ontology = new OntologyNamespace(this);
|
|
@@ -354,12 +352,10 @@ export class LbbClient {
|
|
|
354
352
|
* streamed request without a single oversized commit. Pass `lines` as an array
|
|
355
353
|
* (serialized to NDJSON here) or a pre-built NDJSON string.
|
|
356
354
|
*
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
* the throttle): import the whole dataset, index once. The response's `index`
|
|
362
|
-
* object reports whether the build ran or was skipped.
|
|
355
|
+
* A successful import durably enqueues one complete published-generation
|
|
356
|
+
* build after the final batch. It does not build index families or wait for
|
|
357
|
+
* visibility; the response's `published_generation` object carries the
|
|
358
|
+
* durable job and due sequence to observe.
|
|
363
359
|
*/
|
|
364
360
|
async import(lines, opts = {}) {
|
|
365
361
|
const ndjson = typeof lines === "string"
|
|
@@ -372,7 +368,6 @@ export class LbbClient {
|
|
|
372
368
|
batch: opts.batch,
|
|
373
369
|
strict: opts.strict,
|
|
374
370
|
observed_at: opts.observedAt,
|
|
375
|
-
index: opts.index,
|
|
376
371
|
},
|
|
377
372
|
idempotencyKey: opts.idempotencyKey ?? this.idempotencyKey("import"),
|
|
378
373
|
});
|
|
@@ -410,19 +405,6 @@ export class LbbClient {
|
|
|
410
405
|
idempotencyKey: opts.idempotencyKey ?? this.idempotencyKey("import-rdf"),
|
|
411
406
|
});
|
|
412
407
|
}
|
|
413
|
-
/** Export the snapshot-visible RDF projection as Turtle, N-Triples, TriG, or N-Quads. */
|
|
414
|
-
exportRdf(opts = {}) {
|
|
415
|
-
return this.request("GET", "/v1/graph/export/rdf", {
|
|
416
|
-
query: {
|
|
417
|
-
format: opts.format === "ntriples" ? "nt" : opts.format,
|
|
418
|
-
max_triples: opts.maxTriples,
|
|
419
|
-
as_of_valid_time: opts.asOfValidTime,
|
|
420
|
-
as_of_commit_seq: opts.asOfCommitSeq,
|
|
421
|
-
entailment: opts.entailment,
|
|
422
|
-
reason: opts.reason,
|
|
423
|
-
},
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
408
|
/**
|
|
427
409
|
* Retract specific edges and/or every edge touching given entities. Appends
|
|
428
410
|
* superseding retract events rather than deleting — history stays visible in an
|
|
@@ -640,23 +622,19 @@ export class LbbClient {
|
|
|
640
622
|
query: { kind: opts.kind, run: opts.run },
|
|
641
623
|
});
|
|
642
624
|
}
|
|
643
|
-
/**
|
|
644
|
-
* Champion vs challenger retrieval over one pinned snapshot. Returns
|
|
645
|
-
* promotion evidence (hit-rate@k, latency, overlap); never promotes.
|
|
646
|
-
*/
|
|
647
|
-
shadowEval(body) {
|
|
648
|
-
return this.request("POST", "/v1/models/shadow-eval", { body });
|
|
649
|
-
}
|
|
650
|
-
/**
|
|
651
|
-
* Execution-verified QA probes generated from the graph's current edges —
|
|
652
|
-
* labels are the executed projections, so they are verified by construction.
|
|
653
|
-
* Feeds `shadowEval` directly.
|
|
654
|
-
*/
|
|
625
|
+
/** Execution-verified QA probes generated from the graph's current edges. */
|
|
655
626
|
syntheticEval(opts = {}) {
|
|
656
627
|
return this.request("GET", "/v1/models/synthetic-eval", {
|
|
657
628
|
query: { limit: opts.limit },
|
|
658
629
|
});
|
|
659
630
|
}
|
|
631
|
+
/**
|
|
632
|
+
* Compare champion and challenger retrieval over one pinned published
|
|
633
|
+
* snapshot. The endpoint returns promotion evidence but never promotes.
|
|
634
|
+
*/
|
|
635
|
+
shadowEval(body) {
|
|
636
|
+
return this.request("POST", "/v1/models/shadow-eval", { body });
|
|
637
|
+
}
|
|
660
638
|
/** The doubling retrain policy: is a retrain due for this model kind? */
|
|
661
639
|
modelCadence(opts) {
|
|
662
640
|
return this.request("GET", "/v1/models/cadence", {
|
|
@@ -682,18 +660,6 @@ export class LbbClient {
|
|
|
682
660
|
setTrainingConfig(body) {
|
|
683
661
|
return this.request("POST", "/v1/models/training-config", { body });
|
|
684
662
|
}
|
|
685
|
-
/**
|
|
686
|
-
* Verdict on an ask (`accepted` | `rejected` | `corrected` + the right
|
|
687
|
-
* plan), joined to the ask's trace by `ask_id` — the planner fine-tune's
|
|
688
|
-
* explicit feedback capture. `accepted: false` in the response means
|
|
689
|
-
* signal capture is off on this deployment (the contract is identical).
|
|
690
|
-
*/
|
|
691
|
-
askFeedback(body, opts = {}) {
|
|
692
|
-
return this.request("POST", "/v1/ask/feedback", {
|
|
693
|
-
body,
|
|
694
|
-
idempotencyKey: opts.idempotencyKey ?? this.idempotencyKey("ask-feedback"),
|
|
695
|
-
});
|
|
696
|
-
}
|
|
697
663
|
ingestSignals(body, opts = {}) {
|
|
698
664
|
return this.request("POST", "/v1/signals", {
|
|
699
665
|
body,
|
|
@@ -718,39 +684,25 @@ export class LbbClient {
|
|
|
718
684
|
],
|
|
719
685
|
}, opts);
|
|
720
686
|
}
|
|
721
|
-
/**
|
|
722
|
-
* The planner fine-tune's training feed: accepted/corrected feedback
|
|
723
|
-
* joined to its traces (signals ≤ the split pin), topped up with
|
|
724
|
-
* execution-verified synthetic plans.
|
|
725
|
-
*/
|
|
687
|
+
/** Planner training examples at or before an optional signal split. */
|
|
726
688
|
plannerDataset(opts = {}) {
|
|
727
689
|
return this.request("GET", "/v1/models/planner-dataset", {
|
|
728
690
|
query: { limit: opts.limit, split_seq: opts.splitSeq },
|
|
729
691
|
});
|
|
730
692
|
}
|
|
731
|
-
/**
|
|
732
|
-
* The DPO pass's training feed: preference pairs from corrected verdicts,
|
|
733
|
-
* paired rejections, and synthetic corrupted-slot pairs.
|
|
734
|
-
*/
|
|
693
|
+
/** Planner preference pairs at or before an optional signal split. */
|
|
735
694
|
plannerPreferenceDataset(opts = {}) {
|
|
736
695
|
return this.request("GET", "/v1/models/planner-preference-dataset", {
|
|
737
696
|
query: { limit: opts.limit, split_seq: opts.splitSeq },
|
|
738
697
|
});
|
|
739
698
|
}
|
|
740
|
-
/**
|
|
741
|
-
* The suggest-ranker trainer's probe feed: `suggestion_adopted` signals
|
|
742
|
-
* (typed prefix + adopted text) ≤ the split pin, topped up with
|
|
743
|
-
* execution-verified synthetic vocabulary pairs.
|
|
744
|
-
*/
|
|
699
|
+
/** Suggest-ranker examples at or before an optional signal split. */
|
|
745
700
|
suggestDataset(opts = {}) {
|
|
746
701
|
return this.request("GET", "/v1/models/suggest-dataset", {
|
|
747
702
|
query: { limit: opts.limit, split_seq: opts.splitSeq },
|
|
748
703
|
});
|
|
749
704
|
}
|
|
750
|
-
/**
|
|
751
|
-
* The extractor fine-tune's training feed: EPISODE transcripts joined to
|
|
752
|
-
* the facts the observe pipeline committed from them.
|
|
753
|
-
*/
|
|
705
|
+
/** Extractor examples at or before an optional signal split. */
|
|
754
706
|
extractorDataset(opts = {}) {
|
|
755
707
|
return this.request("GET", "/v1/models/extractor-dataset", {
|
|
756
708
|
query: { limit: opts.limit, split_seq: opts.splitSeq },
|
|
@@ -768,8 +720,7 @@ export class LbbClient {
|
|
|
768
720
|
}
|
|
769
721
|
/**
|
|
770
722
|
* Promote a finished `planner_lora` training run: gated on held-out slot
|
|
771
|
-
* exactness
|
|
772
|
-
* then serves.
|
|
723
|
+
* exactness and recorded as a `kind=planner` training run.
|
|
773
724
|
*/
|
|
774
725
|
promotePlanner(opts) {
|
|
775
726
|
return this.request("POST", "/v1/models/promote-planner", {
|
|
@@ -800,37 +751,18 @@ export class LbbClient {
|
|
|
800
751
|
suggest(body) {
|
|
801
752
|
return this.request("POST", "/v1/search/suggest", { body });
|
|
802
753
|
}
|
|
803
|
-
/**
|
|
804
|
-
* Snap free text to the nearest real vocabulary item. Embedding cosine
|
|
805
|
-
* on a managed graph, else lexical; never fabricates a term.
|
|
806
|
-
*/
|
|
754
|
+
/** Snap free text to the nearest term in the pinned published vocabulary. */
|
|
807
755
|
resolveTerm(body) {
|
|
808
756
|
return this.request("POST", "/v1/search/resolve-term", { body });
|
|
809
757
|
}
|
|
810
|
-
/**
|
|
811
|
-
* Ground a natural-language question to the graph's real vocabulary, retrieve
|
|
812
|
-
* against the pinned snapshot, and answer with citations (`/v1/ask`).
|
|
813
|
-
*/
|
|
814
|
-
ask(body) {
|
|
815
|
-
return this.request("POST", "/v1/ask", { body });
|
|
816
|
-
}
|
|
817
|
-
/**
|
|
818
|
-
* Name the relation between two entities (`/v1/decode`): the DB narrows the
|
|
819
|
-
* candidates to the type pair's admissible relations, answers alone
|
|
820
|
-
* when the pair forces a single relation, and otherwise decodes it with the
|
|
821
|
-
* graph-native fine-tuned model — the "DB narrows, cheap model decodes" call.
|
|
822
|
-
*/
|
|
758
|
+
/** Decode a relation from the graph's admissible published vocabulary. */
|
|
823
759
|
decode(body) {
|
|
824
760
|
return this.request("POST", "/v1/decode", { body });
|
|
825
761
|
}
|
|
826
|
-
/**
|
|
827
|
-
* Report which completion mechanisms will carry on this graph:
|
|
828
|
-
* signature sparsity, name semantics, sampled narrowing recall, and a
|
|
829
|
-
* narrow / narrow+finetune / lexical-first recommendation.
|
|
830
|
-
*/
|
|
762
|
+
/** Report completion strategy fitness for the pinned published graph. */
|
|
831
763
|
groundability(opts = {}) {
|
|
832
764
|
return this.request("GET", "/v1/graph/groundability", {
|
|
833
|
-
query: opts.sample
|
|
765
|
+
query: opts.sample == null ? undefined : { sample: opts.sample },
|
|
834
766
|
});
|
|
835
767
|
}
|
|
836
768
|
/**
|
|
@@ -880,7 +812,6 @@ export class LbbClient {
|
|
|
880
812
|
name: opts.name,
|
|
881
813
|
relations: opts.relations?.join(","),
|
|
882
814
|
as_of: opts.asOf,
|
|
883
|
-
indexed: opts.indexed,
|
|
884
815
|
},
|
|
885
816
|
});
|
|
886
817
|
}
|
|
@@ -920,39 +851,11 @@ export class LbbClient {
|
|
|
920
851
|
},
|
|
921
852
|
});
|
|
922
853
|
}
|
|
923
|
-
/**
|
|
924
|
-
* Paged edge listing. Scope to one node with `id` (or `type`+`name`) and a
|
|
925
|
-
* `direction` (`out`/`in`/`both`) to walk **every** edge of a high-degree node
|
|
926
|
-
* — `entityDetail` returns the full set but is awkward to page; this carries
|
|
927
|
-
* `offset`/`limit` and reports `total_count`. Optional `relation`/`q` filters
|
|
928
|
-
* and an `asOf`/`asOfCommitSeq` snapshot pin. Each row carries `valid_time`, so
|
|
929
|
-
* the page is enough to reconstruct a per-edge timeline.
|
|
930
|
-
*/
|
|
931
|
-
graphEdges(opts = {}) {
|
|
932
|
-
return this.request("GET", "/v1/graph/edges", {
|
|
933
|
-
query: {
|
|
934
|
-
id: opts.id,
|
|
935
|
-
type: opts.type,
|
|
936
|
-
name: opts.name,
|
|
937
|
-
direction: opts.direction,
|
|
938
|
-
relation: opts.relation,
|
|
939
|
-
q: opts.q,
|
|
940
|
-
limit: opts.limit,
|
|
941
|
-
cursor: opts.cursor,
|
|
942
|
-
offset: opts.offset,
|
|
943
|
-
as_of: opts.asOf,
|
|
944
|
-
as_of_commit_seq: opts.asOfCommitSeq,
|
|
945
|
-
},
|
|
946
|
-
});
|
|
947
|
-
}
|
|
948
854
|
/**
|
|
949
855
|
* Page through every row of a list endpoint, following `next_cursor` until
|
|
950
856
|
* exhausted. Pass a fetcher that takes a cursor and returns a
|
|
951
857
|
* {@link ListResponse}:
|
|
952
|
-
*
|
|
953
|
-
* for await (const e of client.listAll((cursor) =>
|
|
954
|
-
* client.entities.list({ cursor, fields: "title" }))) { … }
|
|
955
|
-
* ```
|
|
858
|
+
* The caller supplies a bounded collection endpoint and its cursor.
|
|
956
859
|
*/
|
|
957
860
|
async *listAll(fetchPage) {
|
|
958
861
|
let cursor;
|
|
@@ -982,10 +885,6 @@ export class LbbClient {
|
|
|
982
885
|
why(body) {
|
|
983
886
|
return this.request("POST", "/v1/query/why", { body });
|
|
984
887
|
}
|
|
985
|
-
/** SHACL-style shape/pattern query. */
|
|
986
|
-
shacl(body) {
|
|
987
|
-
return this.request("POST", "/v1/query/shacl", { body });
|
|
988
|
-
}
|
|
989
888
|
/**
|
|
990
889
|
* SPARQL-subset SELECT/ASK/aggregate query (FILTER, HAVING, ORDER BY, ASK,
|
|
991
890
|
* COUNT/SUM/AVG/MIN/MAX). GROUP BY is not limited to entity identity:
|
|
@@ -1028,36 +927,6 @@ export class LbbClient {
|
|
|
1028
927
|
analytics(body) {
|
|
1029
928
|
return this.request("POST", "/v1/query/analytics", { body });
|
|
1030
929
|
}
|
|
1031
|
-
/**
|
|
1032
|
-
* Run inference rules (SHACL-AF `sh:TripleRule` shape) to a bounded fixpoint
|
|
1033
|
-
* and return the derived edges as a **preview** — derived facts are never
|
|
1034
|
-
* written to the asserted graph. Each rule is a BGP `body`/`where` plus a
|
|
1035
|
-
* `head` triple template instantiated per binding.
|
|
1036
|
-
*/
|
|
1037
|
-
infer(body) {
|
|
1038
|
-
return this.request("POST", "/v1/inference/run", { body });
|
|
1039
|
-
}
|
|
1040
|
-
/**
|
|
1041
|
-
* Define (replace) the versioned rule set stored on the scoped graph branch.
|
|
1042
|
-
* The stored set is what SHACL `include_derived` and `infer` use when a
|
|
1043
|
-
* request carries no inline rules. Returns the new `rules_version`.
|
|
1044
|
-
*/
|
|
1045
|
-
defineRules(body) {
|
|
1046
|
-
return this.request("POST", "/v1/inference/rules", { body });
|
|
1047
|
-
}
|
|
1048
|
-
/** The rule set stored on the scoped graph branch (version + rules). */
|
|
1049
|
-
graphRules() {
|
|
1050
|
-
return this.request("GET", "/v1/inference/rules");
|
|
1051
|
-
}
|
|
1052
|
-
/**
|
|
1053
|
-
* Derive edges from calibrated retrieval matches (preview): each
|
|
1054
|
-
* candidate scored `P >= threshold` becomes a derived edge `(anchor, relation,
|
|
1055
|
-
* matched)` with a typed `Retrieval` provenance leaf. Pass either explicit
|
|
1056
|
-
* `candidates` or a `query` the server runs as BM25 entity retrieval.
|
|
1057
|
-
*/
|
|
1058
|
-
retrievalPremises(body) {
|
|
1059
|
-
return this.request("POST", "/v1/inference/retrieval-premises", { body });
|
|
1060
|
-
}
|
|
1061
930
|
// --- ontology ---
|
|
1062
931
|
/**
|
|
1063
932
|
* The active ontology (entity types and relations) for the scoped graph.
|
|
@@ -1074,12 +943,13 @@ export class LbbClient {
|
|
|
1074
943
|
* Audit the current snapshot against the ontology's *implied* constraints —
|
|
1075
944
|
* capped `cardinality` derived as `sh:maxCount` — returning a SHACL-shaped
|
|
1076
945
|
* report. Whole-snapshot and never blocks a write. Unlike
|
|
1077
|
-
*
|
|
1078
|
-
*
|
|
1079
|
-
* {@link ontologyView} for which decorations are enforced.
|
|
946
|
+
* The report is referenced by the pinned published read root and carries its
|
|
947
|
+
* own validation watermark and ontology/shapes provenance.
|
|
1080
948
|
*/
|
|
1081
|
-
ontologyConformance() {
|
|
1082
|
-
return this.request("GET", "/v1/ontology/conformance"
|
|
949
|
+
ontologyConformance(opts) {
|
|
950
|
+
return this.request("GET", "/v1/ontology/conformance", {
|
|
951
|
+
query: { consistency: this.resolveConsistency(opts) },
|
|
952
|
+
});
|
|
1083
953
|
}
|
|
1084
954
|
/** Discover ontology concepts, terms, and relations. */
|
|
1085
955
|
ontologySearch(body) {
|
|
@@ -1106,75 +976,6 @@ export class LbbClient {
|
|
|
1106
976
|
induceOntology(body) {
|
|
1107
977
|
return this.request("POST", "/v1/ontology/induce", { body, retry: true });
|
|
1108
978
|
}
|
|
1109
|
-
// --- index lifecycle ---
|
|
1110
|
-
/**
|
|
1111
|
-
* Build default ANN + BM25 indexes. With `{ background: true }` the build
|
|
1112
|
-
* runs detached on the server and the call returns immediately — use it for
|
|
1113
|
-
* large corpora whose synchronous build would exceed a fronting gateway's
|
|
1114
|
-
* timeout (a 504), then poll `metadata()` for completion.
|
|
1115
|
-
*/
|
|
1116
|
-
indexBuild(opts = {}) {
|
|
1117
|
-
return this.request("POST", "/v1/index/build", {
|
|
1118
|
-
query: { background: opts.background || undefined },
|
|
1119
|
-
});
|
|
1120
|
-
}
|
|
1121
|
-
/**
|
|
1122
|
-
* Build BM25, ANN/vector, and adjacency index families. With
|
|
1123
|
-
* `{ background: true }` the build runs detached on the server and the call
|
|
1124
|
-
* returns immediately — use it for large corpora whose synchronous build would
|
|
1125
|
-
* exceed a fronting gateway's timeout, then poll `metadata()` for completion.
|
|
1126
|
-
*/
|
|
1127
|
-
indexRun(opts = {}) {
|
|
1128
|
-
return this.request("POST", "/v1/index/run", {
|
|
1129
|
-
query: { background: opts.background || undefined },
|
|
1130
|
-
});
|
|
1131
|
-
}
|
|
1132
|
-
/** Submit a durable full-index build. Requires a reconnect-safe idempotency key. */
|
|
1133
|
-
indexSubmit(body = {}, opts) {
|
|
1134
|
-
return this.request("POST", "/v1/index/jobs", {
|
|
1135
|
-
body,
|
|
1136
|
-
idempotencyKey: opts.idempotencyKey,
|
|
1137
|
-
});
|
|
1138
|
-
}
|
|
1139
|
-
/** Poll a durable full-index build. */
|
|
1140
|
-
indexJob(jobId) {
|
|
1141
|
-
return this.request("GET", "/v1/index/jobs", { query: { job_id: jobId } });
|
|
1142
|
-
}
|
|
1143
|
-
/** Cancel a durable full-index build. Repeated cancellation returns its current terminal status. */
|
|
1144
|
-
cancelIndexJob(jobId) {
|
|
1145
|
-
return this.request("DELETE", "/v1/index/jobs", {
|
|
1146
|
-
query: { job_id: jobId },
|
|
1147
|
-
});
|
|
1148
|
-
}
|
|
1149
|
-
/** Append a BM25 delta segment for the unindexed WAL tail. */
|
|
1150
|
-
indexDelta() {
|
|
1151
|
-
return this.request("POST", "/v1/index/delta");
|
|
1152
|
-
}
|
|
1153
|
-
/** Preview or delete superseded persisted index runs. */
|
|
1154
|
-
indexGc(opts = {}) {
|
|
1155
|
-
return this.request("POST", "/v1/index/gc", {
|
|
1156
|
-
query: { keep_runs: opts.keepRuns, dry_run: opts.dryRun },
|
|
1157
|
-
});
|
|
1158
|
-
}
|
|
1159
|
-
/** Submit durable, cancellable index garbage collection. */
|
|
1160
|
-
indexGcSubmit(body = {}, opts) {
|
|
1161
|
-
return this.request("POST", "/v1/index/gc-jobs", {
|
|
1162
|
-
body,
|
|
1163
|
-
idempotencyKey: opts.idempotencyKey,
|
|
1164
|
-
});
|
|
1165
|
-
}
|
|
1166
|
-
/** Poll exact planning/deletion progress for durable index garbage collection. */
|
|
1167
|
-
indexGcJob(jobId) {
|
|
1168
|
-
return this.request("GET", "/v1/index/gc-jobs", {
|
|
1169
|
-
query: { job_id: jobId },
|
|
1170
|
-
});
|
|
1171
|
-
}
|
|
1172
|
-
/** Cancel durable index garbage collection. */
|
|
1173
|
-
cancelIndexGcJob(jobId) {
|
|
1174
|
-
return this.request("DELETE", "/v1/index/gc-jobs", {
|
|
1175
|
-
query: { job_id: jobId },
|
|
1176
|
-
});
|
|
1177
|
-
}
|
|
1178
979
|
/** Fold the WAL tail into snapshot segments. */
|
|
1179
980
|
compact(opts = {}) {
|
|
1180
981
|
return this.request("POST", "/v1/graph/compact", {
|
|
@@ -1189,13 +990,11 @@ export class LbbClient {
|
|
|
1189
990
|
status() {
|
|
1190
991
|
return this.request("GET", "/v1/status");
|
|
1191
992
|
}
|
|
1192
|
-
/** Graph footprint, WAL tail, and index coverage.
|
|
993
|
+
/** Graph footprint, WAL tail, and published-index coverage. */
|
|
1193
994
|
metadata(opts = {}) {
|
|
1194
995
|
return this.request("GET", "/v1/graph/metadata", {
|
|
1195
996
|
query: {
|
|
1196
|
-
include_objects: opts.includeObjects,
|
|
1197
997
|
include_indexes: opts.includeIndexes,
|
|
1198
|
-
include_temporal_coverage: opts.includeTemporalCoverage,
|
|
1199
998
|
},
|
|
1200
999
|
});
|
|
1201
1000
|
}
|
|
@@ -1236,6 +1035,10 @@ export class LbbClient {
|
|
|
1236
1035
|
query: this.readConsistencyQuery(opts),
|
|
1237
1036
|
});
|
|
1238
1037
|
}
|
|
1038
|
+
/** Pinned published read root and its query/conformance lag against one coherent head. */
|
|
1039
|
+
readSnapshot() {
|
|
1040
|
+
return this.request("GET", "/v1/graph/read-snapshot");
|
|
1041
|
+
}
|
|
1239
1042
|
/** List the graphs (and branches) under the scoped tenant. */
|
|
1240
1043
|
listGraphs() {
|
|
1241
1044
|
return this.request("GET", "/v1/graphs");
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { LbbClient, LbbError, parseSparqlResults } from "./client.js";
|
|
2
|
-
export type { LbbClientOptions, CallOptions, RequestOptions,
|
|
2
|
+
export type { LbbClientOptions, CallOptions, RequestOptions, HybridSearchOptions, LbbRequestEvent, LbbResponseEvent, FetchLike, ReadConsistencyOptions, SearchConsistency, Schemas, SparqlResults, SparqlResultsJson, SparqlTerm, CommitRequest, CommitResponse, Entity, EntitySelector, GraphMetadata, GraphSummary, SchemaView, SearchRequest, SearchResponse, SearchResult, Snapshot, } from "./client.js";
|
|
3
3
|
export type { components, paths, operations } from "./schema.js";
|
package/dist/namespaces.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { LbbClient } from "./client.js";
|
|
2
2
|
import type { CallOptions } from "./transport.js";
|
|
3
|
-
import { type EntityAttributeFilterOptions, type ImportLine, type
|
|
3
|
+
import { type EntityAttributeFilterOptions, type ImportLine, type ReadConsistencyOptions, type RdfImportOptions, type Schemas } from "./types.js";
|
|
4
4
|
export interface HybridSearchOptions extends CallOptions {
|
|
5
5
|
topK?: number;
|
|
6
|
-
source?: string;
|
|
7
6
|
consistency?: string;
|
|
8
7
|
/** A5 read-your-writes floor (`min_indexed_seq`): the committed sequence a
|
|
9
8
|
* write returned; under eventual, an uncovered floor yields a retryable
|
|
@@ -14,10 +13,6 @@ export interface HybridSearchOptions extends CallOptions {
|
|
|
14
13
|
vector?: boolean;
|
|
15
14
|
targets?: string[];
|
|
16
15
|
profile?: string;
|
|
17
|
-
/** Valid-time cursor (RFC 3339): results reflect facts true at this instant. */
|
|
18
|
-
asOf?: string;
|
|
19
|
-
/** Snapshot pin: results reproduce the graph as of this commit sequence. */
|
|
20
|
-
asOfCommitSeq?: number;
|
|
21
16
|
/** Opt-in impression logging for later relevance feedback. */
|
|
22
17
|
logImpression?: boolean;
|
|
23
18
|
}
|
|
@@ -26,7 +21,6 @@ export declare class GraphNamespace {
|
|
|
26
21
|
readonly facts: FactsNamespace;
|
|
27
22
|
readonly context: ContextNamespace;
|
|
28
23
|
readonly entities: EntityNamespace;
|
|
29
|
-
readonly indexes: IndexNamespace;
|
|
30
24
|
readonly ontology: OntologyNamespace;
|
|
31
25
|
readonly query: QueryNamespace;
|
|
32
26
|
readonly schema: SchemaNamespace;
|
|
@@ -68,8 +62,6 @@ export declare class GraphNamespace {
|
|
|
68
62
|
}): Promise<Schemas["ManagedEmbeddingPromoteResponse"]>;
|
|
69
63
|
/** Retract edges/entities from the scoped graph. See {@link LbbClient.retract}. */
|
|
70
64
|
retract(body: Schemas["GraphRetractRequest"], opts?: CallOptions): Promise<Schemas["GraphRetractResponse"]>;
|
|
71
|
-
/** Export this graph's current snapshot as Turtle, N-Triples, TriG, or N-Quads. */
|
|
72
|
-
exportRdf(opts?: RdfExportOptions): Promise<string>;
|
|
73
65
|
}
|
|
74
66
|
export declare class FactsNamespace {
|
|
75
67
|
private readonly client;
|
|
@@ -80,7 +72,6 @@ export declare class FactsNamespace {
|
|
|
80
72
|
batch?: number;
|
|
81
73
|
strict?: boolean;
|
|
82
74
|
observedAt?: string;
|
|
83
|
-
index?: boolean;
|
|
84
75
|
idempotencyKey?: string;
|
|
85
76
|
}): Promise<Schemas["GraphImportResponse"]>;
|
|
86
77
|
/**
|
|
@@ -103,71 +94,18 @@ export declare class SearchNamespace {
|
|
|
103
94
|
fullText(body: Schemas["FullTextSearchRequest"], opts?: CallOptions & ReadConsistencyOptions): Promise<Schemas["FullTextSearchResponse"]>;
|
|
104
95
|
vector(body: Schemas["EmbeddingSearchRequest"], opts?: CallOptions & ReadConsistencyOptions): Promise<Schemas["EmbeddingSearchResponse"]>;
|
|
105
96
|
}
|
|
106
|
-
export declare class SchemaNamespace {
|
|
107
|
-
private readonly client;
|
|
108
|
-
constructor(client: LbbClient);
|
|
109
|
-
/** Active graph schema bundle: ontology plus activated SHACL shapes. */
|
|
110
|
-
view(opts?: {
|
|
111
|
-
audit?: boolean;
|
|
112
|
-
} & CallOptions): Promise<Schemas["SchemaBundleView"]>;
|
|
113
|
-
/** Preview a proposed RDF/SHACL schema bundle and audit current data. */
|
|
114
|
-
preview(body: Schemas["SchemaPreviewRequest"], opts?: CallOptions): Promise<Schemas["SchemaPreviewResponse"]>;
|
|
115
|
-
/** Activate a previewed SHACL schema bundle for this graph branch. */
|
|
116
|
-
publish(body: Schemas["SchemaPublishRequest"], opts?: CallOptions): Promise<Schemas["SchemaPublishResponse"]>;
|
|
117
|
-
/** Audit current data against the active SHACL schema bundle. */
|
|
118
|
-
audit(opts?: CallOptions): Promise<Schemas["SchemaAuditReport"]>;
|
|
119
|
-
}
|
|
120
|
-
export declare class IndexNamespace {
|
|
121
|
-
private readonly client;
|
|
122
|
-
constructor(client: LbbClient);
|
|
123
|
-
run(opts?: {
|
|
124
|
-
wait?: boolean;
|
|
125
|
-
background?: boolean;
|
|
126
|
-
body?: unknown;
|
|
127
|
-
} & CallOptions): Promise<unknown>;
|
|
128
|
-
build(opts?: {
|
|
129
|
-
background?: boolean;
|
|
130
|
-
} & CallOptions): Promise<unknown>;
|
|
131
|
-
delta(opts?: CallOptions): Promise<Schemas["IndexDeltaResponse"]>;
|
|
132
|
-
submit(body: Partial<Schemas["IndexBuildOptions"]> | undefined, opts: CallOptions & {
|
|
133
|
-
idempotencyKey: string;
|
|
134
|
-
}): Promise<Schemas["SearchIndexJobStatusResponse"]>;
|
|
135
|
-
job(jobId: string, opts?: CallOptions): Promise<Schemas["SearchIndexJobStatusResponse"]>;
|
|
136
|
-
cancel(jobId: string, opts?: CallOptions): Promise<Schemas["SearchIndexJobStatusResponse"]>;
|
|
137
|
-
gc(opts?: {
|
|
138
|
-
keepRuns?: number;
|
|
139
|
-
dryRun?: boolean;
|
|
140
|
-
} & CallOptions): Promise<Schemas["IndexGcResponse"]>;
|
|
141
|
-
submitGc(body: Schemas["IndexGcRequest"] | undefined, opts: CallOptions & {
|
|
142
|
-
idempotencyKey: string;
|
|
143
|
-
}): Promise<Schemas["IndexGcJobStatusResponse"]>;
|
|
144
|
-
gcJob(jobId: string, opts?: CallOptions): Promise<Schemas["IndexGcJobStatusResponse"]>;
|
|
145
|
-
cancelGc(jobId: string, opts?: CallOptions): Promise<Schemas["IndexGcJobStatusResponse"]>;
|
|
146
|
-
}
|
|
147
97
|
export declare class EntityNamespace {
|
|
148
98
|
private readonly client;
|
|
149
99
|
constructor(client: LbbClient);
|
|
150
100
|
/**
|
|
151
101
|
* Return the exact type cardinality and a bounded deterministic sample from
|
|
152
|
-
* the ranged adjacency
|
|
153
|
-
* falling back to an exhaustive
|
|
102
|
+
* the ranged adjacency family pinned by the published generation. A missing
|
|
103
|
+
* family fails closed rather than falling back to an exhaustive scan.
|
|
154
104
|
*/
|
|
155
105
|
sample(opts: {
|
|
156
106
|
type: string;
|
|
157
107
|
limit?: number;
|
|
158
108
|
} & CallOptions): Promise<Schemas["EntityTypeSampleResponse"]>;
|
|
159
|
-
/**
|
|
160
|
-
* Browse entities as the unified list envelope. Pass `fields` (names or `*`)
|
|
161
|
-
* to inline each row's typed attributes as native JSON (under `attributes`) —
|
|
162
|
-
* "list entities and their titles" in one call instead of a list plus N point
|
|
163
|
-
* lookups — or `ids`
|
|
164
|
-
* to fetch a specific set. Page with `cursor` from the previous `next_cursor`.
|
|
165
|
-
*/
|
|
166
|
-
list(opts?: EntityListOptions): Promise<ListResponse<Schemas["EntityExplorerRow"]>>;
|
|
167
|
-
/** Yield list envelopes while following `next_cursor` until exhaustion. */
|
|
168
|
-
pages(opts?: EntityListOptions): AsyncGenerator<ListResponse<Schemas["EntityExplorerRow"]>>;
|
|
169
|
-
/** Yield entities directly while following the server's stable cursor. */
|
|
170
|
-
iterate(opts?: EntityListOptions): AsyncGenerator<Schemas["EntityExplorerRow"]>;
|
|
171
109
|
get(opts: {
|
|
172
110
|
id?: string;
|
|
173
111
|
type?: string;
|
|
@@ -187,23 +125,10 @@ export declare class EntityNamespace {
|
|
|
187
125
|
*/
|
|
188
126
|
filterByAttributes(opts: EntityAttributeFilterOptions): Promise<Schemas["SparqlSelectResponse"]>;
|
|
189
127
|
}
|
|
190
|
-
|
|
191
|
-
type?: string;
|
|
192
|
-
limit?: number;
|
|
193
|
-
cursor?: string | number;
|
|
194
|
-
/** @deprecated Legacy alias for `cursor`. */
|
|
195
|
-
offset?: number;
|
|
196
|
-
query?: string;
|
|
197
|
-
/** Property names to inline per row (or `"*"` / `["*"]` for all). */
|
|
198
|
-
fields?: string | string[];
|
|
199
|
-
/** Specific entity ids to fetch in one call (bulk lookup). */
|
|
200
|
-
ids?: string | string[];
|
|
201
|
-
}
|
|
202
|
-
/** Grounding and answer operations over the graph's real vocabulary. */
|
|
128
|
+
/** Grounding operations over one pinned published vocabulary. */
|
|
203
129
|
export declare class ContextNamespace {
|
|
204
130
|
private readonly client;
|
|
205
131
|
constructor(client: LbbClient);
|
|
206
|
-
ask(body: Schemas["AskRequest"], opts?: CallOptions): Promise<Schemas["AskResponse"]>;
|
|
207
132
|
suggest(body: Schemas["SearchSuggestRequest"], opts?: CallOptions): Promise<Schemas["SearchSuggestResponse"]>;
|
|
208
133
|
resolve(body: Schemas["ResolveTermRequest"], opts?: CallOptions): Promise<Schemas["ResolveTermResponse"]>;
|
|
209
134
|
decode(body: Schemas["DecodeRequest"], opts?: CallOptions): Promise<Schemas["DecodeResponse"]>;
|
|
@@ -211,6 +136,15 @@ export declare class ContextNamespace {
|
|
|
211
136
|
sample?: number;
|
|
212
137
|
} & CallOptions): Promise<Schemas["GroundabilityReport"]>;
|
|
213
138
|
}
|
|
139
|
+
/** Active ontology/SHACL bundle metadata and atomic publication. */
|
|
140
|
+
export declare class SchemaNamespace {
|
|
141
|
+
private readonly client;
|
|
142
|
+
constructor(client: LbbClient);
|
|
143
|
+
/** Read active metadata without running request-time validation. */
|
|
144
|
+
view(opts?: CallOptions): Promise<Schemas["SchemaBundleView"]>;
|
|
145
|
+
/** Atomically publish a bundle; conformance is produced asynchronously. */
|
|
146
|
+
publish(body: Schemas["SchemaPublishRequest"], opts?: CallOptions): Promise<Schemas["SchemaPublishResponse"]>;
|
|
147
|
+
}
|
|
214
148
|
/** Ontology discovery and lifecycle operations. */
|
|
215
149
|
export declare class OntologyNamespace {
|
|
216
150
|
private readonly client;
|
|
@@ -218,14 +152,14 @@ export declare class OntologyNamespace {
|
|
|
218
152
|
view(options?: {
|
|
219
153
|
counts?: boolean;
|
|
220
154
|
} & CallOptions): Promise<Schemas["OntologyView"]>;
|
|
221
|
-
conformance(opts?: CallOptions): Promise<Schemas["SchemaAuditReport"]>;
|
|
155
|
+
conformance(opts?: CallOptions & Pick<ReadConsistencyOptions, "consistency">): Promise<Schemas["SchemaAuditReport"]>;
|
|
222
156
|
search(body: Schemas["OntologySearchRequest"], opts?: CallOptions): Promise<Schemas["OntologySearchResponse"]>;
|
|
223
157
|
resolve(body: Schemas["OntologyResolveRequest"], opts?: CallOptions): Promise<Schemas["OntologyResolveResponse"]>;
|
|
224
158
|
define(body: Schemas["OntologyDefineRequest"], opts?: CallOptions): Promise<Schemas["OntologyDefineResponse"]>;
|
|
225
159
|
evolve(body: Schemas["OntologyEvolveRequest"], opts?: CallOptions): Promise<Schemas["OntologyEvolveResponse"]>;
|
|
226
160
|
induce(body: Schemas["OntologyInduceRequest"], opts?: CallOptions): Promise<Schemas["OntologyInduceResponse"]>;
|
|
227
161
|
}
|
|
228
|
-
/** Structured, SPARQL-text,
|
|
162
|
+
/** Structured, SPARQL-text, and analytical query operations. */
|
|
229
163
|
export declare class QueryNamespace {
|
|
230
164
|
private readonly client;
|
|
231
165
|
constructor(client: LbbClient);
|
|
@@ -233,7 +167,4 @@ export declare class QueryNamespace {
|
|
|
233
167
|
sparql(body: Schemas["SparqlTextRequest"], opts?: CallOptions & ReadConsistencyOptions): Promise<import("./types.js").SparqlResults>;
|
|
234
168
|
sparqlRaw(body: Schemas["SparqlTextRequest"], opts?: CallOptions & ReadConsistencyOptions): Promise<Schemas["SparqlTextResponse"]>;
|
|
235
169
|
analytics(body: Schemas["AnalyticQueryRequest"], opts?: CallOptions): Promise<Schemas["AnalyticQueryResponse"]>;
|
|
236
|
-
shacl(body: Schemas["ShaclQueryRequest"], opts?: CallOptions): Promise<Schemas["ShaclQueryResponse"]>;
|
|
237
|
-
infer(body: Schemas["InferenceRunRequest"], opts?: CallOptions): Promise<Schemas["InferenceRunResponse"]>;
|
|
238
|
-
premises(body: Schemas["RetrievalPremiseRequest"], opts?: CallOptions): Promise<Schemas["RetrievalPremiseResponse"]>;
|
|
239
170
|
}
|