@kortexya/reasoninglayer 4.1.0 → 4.2.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 +1 -1
- package/dist/index.cjs +189 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +575 -165
- package/dist/index.d.ts +575 -165
- package/dist/index.js +189 -50
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -316,7 +316,7 @@ pnpm run docs:build # Build documentation site
|
|
|
316
316
|
|
|
317
317
|
| SDK Version | Min Backend Version | Node | Browser |
|
|
318
318
|
| ----------- | ------------------- | ---- | ------- |
|
|
319
|
-
| 4.
|
|
319
|
+
| 4.2.0 | engine `cfd780622` | 20+ | ES2022+ |
|
|
320
320
|
|
|
321
321
|
## License
|
|
322
322
|
|
package/dist/index.cjs
CHANGED
|
@@ -7,7 +7,7 @@ var __export = (target, all) => {
|
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
// src/config.ts
|
|
10
|
-
var SDK_VERSION = "4.1
|
|
10
|
+
var SDK_VERSION = "4.2.1";
|
|
11
11
|
function resolveConfig(config) {
|
|
12
12
|
if (!config.baseUrl) {
|
|
13
13
|
throw new Error("ClientConfig.baseUrl is required");
|
|
@@ -11007,7 +11007,7 @@ var Ui = class {
|
|
|
11007
11007
|
...params
|
|
11008
11008
|
});
|
|
11009
11009
|
/**
|
|
11010
|
-
* @description Events: - `layout_ready` — LayoutSurface JSON - `component_ready` — {slot_id, descriptor} JSON - `data_chunk` — {slot_id, data} JSON (if data was loaded) - `complete` — {} POST /api/v1/ui/describe/stream
|
|
11010
|
+
* @description Events: - `layout_ready` — LayoutSurface JSON - `component_ready` — {slot_id, descriptor} JSON - `data_chunk` — {slot_id, data} JSON (if data was loaded) - `data_load_error` — {slot_id, error} JSON (if the data load failed; the error carries the typed `code`, `message` and `query`, #475) - `complete` — {} POST /api/v1/ui/describe/stream
|
|
11011
11011
|
*
|
|
11012
11012
|
* @tags ui
|
|
11013
11013
|
* @name DescribeUiStream
|
|
@@ -12428,7 +12428,7 @@ var Conformal = class {
|
|
|
12428
12428
|
this.http = http;
|
|
12429
12429
|
}
|
|
12430
12430
|
/**
|
|
12431
|
-
* @description Compute a split-conformal non-conformity threshold from a labeled calibration set.
|
|
12431
|
+
* @description Compute a split-conformal non-conformity threshold from a labeled calibration set. Returns `τ` and an in-sample coverage check. The returned `threshold` should be passed verbatim to `POST /api/v1/conformal/predict`.
|
|
12432
12432
|
*
|
|
12433
12433
|
* @tags conformal
|
|
12434
12434
|
* @name CalibrateConformal
|
|
@@ -12444,7 +12444,7 @@ var Conformal = class {
|
|
|
12444
12444
|
...params
|
|
12445
12445
|
});
|
|
12446
12446
|
/**
|
|
12447
|
-
* @description Apply a pre-computed conformal threshold to unlabeled test inputs and return prediction sets with
|
|
12447
|
+
* @description Apply a pre-computed conformal threshold to unlabeled test inputs and return prediction sets with explicitly unverified supplied parameters. A class `y` is included in an input's prediction set iff `1 − class_scores[y] ≤ threshold`, evaluated in that score space. When no class meets this criterion the prediction set is empty and `abstains = true` is set on that input's result.
|
|
12448
12448
|
*
|
|
12449
12449
|
* @tags conformal
|
|
12450
12450
|
* @name Predict
|
|
@@ -17603,6 +17603,7 @@ var RESPONSE_COMPONENTS = {
|
|
|
17603
17603
|
algorithm: [1, 0],
|
|
17604
17604
|
alpha: [1, 0],
|
|
17605
17605
|
empirical_coverage: [1, 0],
|
|
17606
|
+
informative: [1, 0],
|
|
17606
17607
|
meets_target_coverage: [1, 0],
|
|
17607
17608
|
n_samples: [1, 0],
|
|
17608
17609
|
quantile_rank: [1, 0],
|
|
@@ -17611,7 +17612,7 @@ var RESPONSE_COMPONENTS = {
|
|
|
17611
17612
|
},
|
|
17612
17613
|
ConformalPredictResponse: {
|
|
17613
17614
|
object: {
|
|
17614
|
-
|
|
17615
|
+
calibration_parameters: [1, "SuppliedCalibrationParameters"],
|
|
17615
17616
|
predictions: [1, { array: "ConformalPrediction" }]
|
|
17616
17617
|
}
|
|
17617
17618
|
},
|
|
@@ -17786,6 +17787,7 @@ var RESPONSE_COMPONENTS = {
|
|
|
17786
17787
|
injection: [2, "InjectionSummaryDto"],
|
|
17787
17788
|
intent: [1, 0],
|
|
17788
17789
|
matched_templates: [2, { array: "QueryTemplateDto" }],
|
|
17790
|
+
notices: [1, { array: 0 }],
|
|
17789
17791
|
produced_term_ids: [1, { array: 0 }],
|
|
17790
17792
|
prompt_trace: [2, "PromptTraceDto"],
|
|
17791
17793
|
proof_trace: [2, "ProofTraceNodeDto"],
|
|
@@ -17847,15 +17849,6 @@ var RESPONSE_COMPONENTS = {
|
|
|
17847
17849
|
}
|
|
17848
17850
|
},
|
|
17849
17851
|
CounterfactualTraceDto: { object: { abduction: [1, 0], action: [1, 0], prediction: [1, 0] } },
|
|
17850
|
-
CoverageCertificate: {
|
|
17851
|
-
object: {
|
|
17852
|
-
algorithm: [1, 0],
|
|
17853
|
-
alpha: [1, 0],
|
|
17854
|
-
n_calibration_samples: [1, 0],
|
|
17855
|
-
nominal_coverage: [1, 0],
|
|
17856
|
-
threshold: [1, 0]
|
|
17857
|
-
}
|
|
17858
|
-
},
|
|
17859
17852
|
CoverageDetailDto: {
|
|
17860
17853
|
object: {
|
|
17861
17854
|
class_coverage: [1, 0],
|
|
@@ -17969,6 +17962,7 @@ var RESPONSE_COMPONENTS = {
|
|
|
17969
17962
|
explanation: [1, 0]
|
|
17970
17963
|
}
|
|
17971
17964
|
},
|
|
17965
|
+
DataLoadErrorDto: { object: { code: [1, 0], message: [1, 0], query: [1, 0] } },
|
|
17972
17966
|
DataMixingStatsDto: {
|
|
17973
17967
|
object: {
|
|
17974
17968
|
negative_count: [1, 0],
|
|
@@ -18438,6 +18432,7 @@ var RESPONSE_COMPONENTS = {
|
|
|
18438
18432
|
chunks_processed: [1, 0],
|
|
18439
18433
|
document_id: [1, 0],
|
|
18440
18434
|
entities_extracted: [1, 0],
|
|
18435
|
+
entities_refused: [1, { array: "RefusedEntityDto" }],
|
|
18441
18436
|
processing_time_ms: [1, 0],
|
|
18442
18437
|
relations_extracted: [1, 0],
|
|
18443
18438
|
relations_integrated: [1, 0],
|
|
@@ -21269,9 +21264,11 @@ var RESPONSE_COMPONENTS = {
|
|
|
21269
21264
|
}
|
|
21270
21265
|
},
|
|
21271
21266
|
PromptTraceDto: { object: { llm_context: [1, "LlmContextTraceDto"], system_prompt: [1, 0] } },
|
|
21267
|
+
ProofConclusionDto: { object: { features: [1, { object: {} }], sort_id: [1, 0] } },
|
|
21272
21268
|
ProofDto: {
|
|
21273
21269
|
object: {
|
|
21274
21270
|
certainty: [1, 0],
|
|
21271
|
+
conclusion: [0, "ProofConclusionDto"],
|
|
21275
21272
|
kind: [1, 0],
|
|
21276
21273
|
subproofs: [0, { array: "ProofDto" }],
|
|
21277
21274
|
substitution: [1, "HomoiconicSubstitutionDto"]
|
|
@@ -22340,6 +22337,7 @@ var RESPONSE_COMPONENTS = {
|
|
|
22340
22337
|
SolutionDto: {
|
|
22341
22338
|
object: {
|
|
22342
22339
|
certainty: [1, 0],
|
|
22340
|
+
conclusion: [2, "ProofConclusionDto"],
|
|
22343
22341
|
matched_sorts: [0, { array: 0 }],
|
|
22344
22342
|
proof: [2, "ProofDto"],
|
|
22345
22343
|
residuated_sorts: [0, { array: 0 }],
|
|
@@ -22747,6 +22745,17 @@ var RESPONSE_COMPONENTS = {
|
|
|
22747
22745
|
supervisor_active: [1, 0]
|
|
22748
22746
|
}
|
|
22749
22747
|
},
|
|
22748
|
+
SuppliedCalibrationParameters: {
|
|
22749
|
+
object: {
|
|
22750
|
+
algorithm: [1, 0],
|
|
22751
|
+
alpha: [1, 0],
|
|
22752
|
+
informative: [1, 0],
|
|
22753
|
+
n_calibration_samples: [1, 0],
|
|
22754
|
+
requested_coverage: [1, 0],
|
|
22755
|
+
threshold: [1, 0],
|
|
22756
|
+
verification: [1, 0]
|
|
22757
|
+
}
|
|
22758
|
+
},
|
|
22750
22759
|
SuspendedQueryDto: {
|
|
22751
22760
|
object: {
|
|
22752
22761
|
confidence: [1, 0],
|
|
@@ -23062,6 +23071,7 @@ var RESPONSE_COMPONENTS = {
|
|
|
23062
23071
|
UIAssemblyStatsDto: {
|
|
23063
23072
|
object: {
|
|
23064
23073
|
component_count: [1, 0],
|
|
23074
|
+
data_load_error: [2, "DataLoadErrorDto"],
|
|
23065
23075
|
included_features: [1, 0],
|
|
23066
23076
|
sort_name: [1, 0],
|
|
23067
23077
|
total_features: [1, 0],
|
|
@@ -23100,6 +23110,7 @@ var RESPONSE_COMPONENTS = {
|
|
|
23100
23110
|
UIGenerateResponse: {
|
|
23101
23111
|
object: {
|
|
23102
23112
|
data: [2, "DataPayloadDto"],
|
|
23113
|
+
data_load_errors: [0, { array: "DataLoadErrorDto" }],
|
|
23103
23114
|
data_sources: [0, { array: "DataSourcePayloadDto" }],
|
|
23104
23115
|
descriptor: [2, "UIDescriptorDto"],
|
|
23105
23116
|
diagnostics: [0, { array: 0 }],
|
|
@@ -24788,6 +24799,11 @@ var RESPONSE_OPERATIONS = {
|
|
|
24788
24799
|
path: "/api/v1/constraint-sessions/{session_id}",
|
|
24789
24800
|
responses: { 200: "ConstraintSessionStatusResponse" }
|
|
24790
24801
|
},
|
|
24802
|
+
getConversation: {
|
|
24803
|
+
method: "GET",
|
|
24804
|
+
path: "/api/v1/conversation/{id}",
|
|
24805
|
+
responses: { 200: "ConversationSummaryDto" }
|
|
24806
|
+
},
|
|
24791
24807
|
getConversationEntries: {
|
|
24792
24808
|
method: "GET",
|
|
24793
24809
|
path: "/api/v1/audit/entries/{conversation_id}",
|
|
@@ -29296,6 +29312,14 @@ function HomoiconicSubstitutionDtoFromApiToFront(dto) {
|
|
|
29296
29312
|
bindings: dto.bindings.map(BindingDtoFromApiToFront)
|
|
29297
29313
|
};
|
|
29298
29314
|
}
|
|
29315
|
+
function ProofConclusionDtoFromApiToFront(dto) {
|
|
29316
|
+
return {
|
|
29317
|
+
features: featuresFromApiToFront(dto.features),
|
|
29318
|
+
sortId: dto.sort_id,
|
|
29319
|
+
sortName: dto.sort_name ?? void 0,
|
|
29320
|
+
termId: dto.term_id ?? void 0
|
|
29321
|
+
};
|
|
29322
|
+
}
|
|
29299
29323
|
function ProofDtoFromApiToFront(dto) {
|
|
29300
29324
|
return {
|
|
29301
29325
|
kind: dto.kind,
|
|
@@ -29303,6 +29327,7 @@ function ProofDtoFromApiToFront(dto) {
|
|
|
29303
29327
|
ruleTermId: dto.rule_term_id,
|
|
29304
29328
|
ruleHeadTermId: dto.rule_head_term_id,
|
|
29305
29329
|
goalDisplay: dto.goal_display,
|
|
29330
|
+
conclusion: dto.conclusion ? ProofConclusionDtoFromApiToFront(dto.conclusion) : void 0,
|
|
29306
29331
|
ruleLabel: dto.rule_label,
|
|
29307
29332
|
substitution: HomoiconicSubstitutionDtoFromApiToFront(dto.substitution),
|
|
29308
29333
|
subproofs: dto.subproofs?.map(ProofDtoFromApiToFront),
|
|
@@ -29356,6 +29381,7 @@ function SolutionDtoFromApiToFront(dto) {
|
|
|
29356
29381
|
const solution = {
|
|
29357
29382
|
substitution: HomoiconicSubstitutionDtoFromApiToFront(dto.substitution),
|
|
29358
29383
|
proof: dto.proof ? ProofDtoFromApiToFront(dto.proof) : void 0,
|
|
29384
|
+
conclusion: dto.conclusion ? ProofConclusionDtoFromApiToFront(dto.conclusion) : void 0,
|
|
29359
29385
|
certainty: dto.certainty,
|
|
29360
29386
|
evidenceMatched: dto.evidence_matched ?? void 0,
|
|
29361
29387
|
evidenceRatio: dto.evidence_ratio ?? void 0,
|
|
@@ -30056,6 +30082,8 @@ var InferenceClient = class {
|
|
|
30056
30082
|
* engine-side head aggregator (see {@link RuleAggregatorDto}).
|
|
30057
30083
|
* @returns The created rule wrapped in an AddRuleResponse, with its
|
|
30058
30084
|
* {@link AddRuleResponse.etag} when the engine sends the `ETag` header.
|
|
30085
|
+
* @throws {@link ValidationError} before the request is sent, when `antecedents` is
|
|
30086
|
+
* not an array (a request built from untyped data) — `field` is `antecedents`.
|
|
30059
30087
|
* @throws {ApiError} If the rule is rejected or the request fails — 422 when
|
|
30060
30088
|
* it is unusable as written: a head or body antecedent naming a sort or
|
|
30061
30089
|
* term that does not exist (the message names it and its position — `the
|
|
@@ -30065,9 +30093,8 @@ var InferenceClient = class {
|
|
|
30065
30093
|
* cycle the program already had is not blamed on it), or a rule with no
|
|
30066
30094
|
* antecedents (`rule rejected: a rule needs at least one antecedent; a
|
|
30067
30095
|
* term with no antecedents is a fact — write it through POST
|
|
30068
|
-
* /api/v1/terms` — write a fact with `client.terms.createTerm`).
|
|
30069
|
-
*
|
|
30070
|
-
* plain-text 422. The refusal is a
|
|
30096
|
+
* /api/v1/terms` — write a fact with `client.terms.createTerm`). The
|
|
30097
|
+
* refusal is a
|
|
30071
30098
|
* plain {@link ApiError} with `status` 422 — not a `BadRequestError`
|
|
30072
30099
|
* (earlier engines answered an unknown head sort with 400), and not a
|
|
30073
30100
|
* `NamedConstraintViolationError`, which is reserved for a feature
|
|
@@ -30097,7 +30124,7 @@ var InferenceClient = class {
|
|
|
30097
30124
|
async addRule(request, requestOptions) {
|
|
30098
30125
|
const wireRequest = {
|
|
30099
30126
|
term: convertTermArg(request.term),
|
|
30100
|
-
antecedents: request.antecedents
|
|
30127
|
+
antecedents: convertAntecedents(request.antecedents, "antecedents"),
|
|
30101
30128
|
certainty: request.certainty,
|
|
30102
30129
|
aggregator: request.aggregator
|
|
30103
30130
|
};
|
|
@@ -30114,6 +30141,8 @@ var InferenceClient = class {
|
|
|
30114
30141
|
* @returns Whether the write would accept it (`ok`), every refusal with the
|
|
30115
30142
|
* status the write would answer, the NAF-safety warnings, and the rule as
|
|
30116
30143
|
* the write would build it.
|
|
30144
|
+
* @throws {@link ValidationError} before the request is sent, when `antecedents` is
|
|
30145
|
+
* not an array (a request built from untyped data) — `field` is `antecedents`.
|
|
30117
30146
|
* @throws {ApiError} If the request itself fails.
|
|
30118
30147
|
*
|
|
30119
30148
|
* @remarks
|
|
@@ -30138,7 +30167,7 @@ var InferenceClient = class {
|
|
|
30138
30167
|
async validateRule(request, requestOptions) {
|
|
30139
30168
|
const wireRequest = {
|
|
30140
30169
|
term: convertTermArg(request.term),
|
|
30141
|
-
antecedents: request.antecedents
|
|
30170
|
+
antecedents: convertAntecedents(request.antecedents, "antecedents"),
|
|
30142
30171
|
certainty: request.certainty,
|
|
30143
30172
|
aggregator: request.aggregator
|
|
30144
30173
|
};
|
|
@@ -30183,10 +30212,11 @@ var InferenceClient = class {
|
|
|
30183
30212
|
* @param requestOptions - Per-call request options.
|
|
30184
30213
|
* @returns What was written, and what was refused: `ruleTermIds` and
|
|
30185
30214
|
* `rulesAdded` for the accepted rules, `rejected` naming each refused one.
|
|
30186
|
-
* @throws {@link ApiError} 422 when the body is malformed
|
|
30187
|
-
*
|
|
30215
|
+
* @throws {@link ApiError} 422 when the body is malformed — a 422 never
|
|
30216
|
+
* means a refused row.
|
|
30188
30217
|
* @throws {@link ValidationError} before the request is sent, when a rule's
|
|
30189
|
-
* term cannot be encoded
|
|
30218
|
+
* term cannot be encoded, or a row has no `antecedents` array — `field`
|
|
30219
|
+
* names it as `rules[k].term`, `rules[k].antecedents` or
|
|
30190
30220
|
* `rules[k].antecedents[i]`.
|
|
30191
30221
|
*
|
|
30192
30222
|
* @remarks
|
|
@@ -30201,7 +30231,8 @@ var InferenceClient = class {
|
|
|
30201
30231
|
* number submitted. A row with an empty `antecedents` list is refused per
|
|
30202
30232
|
* row this way (`rule rejected: a rule needs at least one antecedent; …`)
|
|
30203
30233
|
* and is not counted in `rulesAdded` or `ruleTermIds`; a row with no
|
|
30204
|
-
* `antecedents`
|
|
30234
|
+
* `antecedents` array is refused before the request is sent, with a
|
|
30235
|
+
* `ValidationError` whose `field` is `rules[k].antecedents`. A rule that closes a
|
|
30205
30236
|
* NEW cycle through negation is refused the same way (the reason names the
|
|
30206
30237
|
* cycle's sorts), decided for every row before any row is written.
|
|
30207
30238
|
*
|
|
@@ -30215,9 +30246,9 @@ var InferenceClient = class {
|
|
|
30215
30246
|
*/
|
|
30216
30247
|
async bulkAddRules(request, requestOptions) {
|
|
30217
30248
|
const wireRequest = {
|
|
30218
|
-
rules: request.rules.map((r) => ({
|
|
30249
|
+
rules: request.rules.map((r, k) => ({
|
|
30219
30250
|
term: convertTermArg(r.term),
|
|
30220
|
-
antecedents: r.antecedents.
|
|
30251
|
+
antecedents: convertAntecedents(r.antecedents, `rules[${k}].antecedents`),
|
|
30221
30252
|
certainty: r.certainty,
|
|
30222
30253
|
aggregator: r.aggregator
|
|
30223
30254
|
}))
|
|
@@ -30403,7 +30434,8 @@ var InferenceClient = class {
|
|
|
30403
30434
|
* @throws {@link PreconditionRequiredError} 428 when `ifMatch` is omitted
|
|
30404
30435
|
* and the engine runs with `OSFKB_REQUIRE_IF_MATCH=1`.
|
|
30405
30436
|
* @throws {@link ValidationError} before the request is sent, when a term
|
|
30406
|
-
* cannot be encoded — `field` names it
|
|
30437
|
+
* cannot be encoded, or `antecedents` is not an array — `field` names it
|
|
30438
|
+
* (`term`, `antecedents`, `antecedents[i]`).
|
|
30407
30439
|
*
|
|
30408
30440
|
* @remarks
|
|
30409
30441
|
* A rule's id IS its conclusion term id, so an edit changes it by
|
|
@@ -30442,7 +30474,7 @@ var InferenceClient = class {
|
|
|
30442
30474
|
async replaceRule(ruleId, request, requestOptions) {
|
|
30443
30475
|
const wireRequest = {
|
|
30444
30476
|
term: convertTermArg(request.term),
|
|
30445
|
-
antecedents: request.antecedents
|
|
30477
|
+
antecedents: convertAntecedents(request.antecedents, "antecedents"),
|
|
30446
30478
|
certainty: request.certainty,
|
|
30447
30479
|
aggregator: request.aggregator
|
|
30448
30480
|
};
|
|
@@ -30952,6 +30984,12 @@ var InferenceClient = class {
|
|
|
30952
30984
|
function convertTermArg(input) {
|
|
30953
30985
|
return isPsiTermInput(input) ? toTermInputDto(input) : input;
|
|
30954
30986
|
}
|
|
30987
|
+
function convertAntecedents(antecedents, field) {
|
|
30988
|
+
if (!Array.isArray(antecedents)) {
|
|
30989
|
+
throw new ValidationError(`${field} must be an array of terms`, field);
|
|
30990
|
+
}
|
|
30991
|
+
return antecedents.map(convertTermArg);
|
|
30992
|
+
}
|
|
30955
30993
|
function withRuleEtag(body, headers) {
|
|
30956
30994
|
const etag = headers.get("etag");
|
|
30957
30995
|
return etag === null ? body : { ...body, etag };
|
|
@@ -37240,6 +37278,7 @@ function DocumentReceiptFromApiToFront(dto) {
|
|
|
37240
37278
|
function SessionDocumentFromApiToFront(dto) {
|
|
37241
37279
|
const out = { documentId: dto.document_id, status: dto.status };
|
|
37242
37280
|
if (dto.error != null) out.error = dto.error;
|
|
37281
|
+
if (dto.error_code != null) out.errorCode = dto.error_code;
|
|
37243
37282
|
if (dto.receipt != null) out.receipt = DocumentReceiptFromApiToFront(dto.receipt);
|
|
37244
37283
|
return out;
|
|
37245
37284
|
}
|
|
@@ -37353,6 +37392,7 @@ function DocumentStatsDtoFromApiToFront(dto) {
|
|
|
37353
37392
|
documentId: dto.document_id,
|
|
37354
37393
|
documentTermId: dto.document_term_id ?? void 0,
|
|
37355
37394
|
entitiesExtracted: dto.entities_extracted,
|
|
37395
|
+
entitiesRefused: dto.entities_refused.map(RefusedEntityDtoFromApiToFront),
|
|
37356
37396
|
processingTimeMs: dto.processing_time_ms,
|
|
37357
37397
|
relationsExtracted: dto.relations_extracted,
|
|
37358
37398
|
relationsIntegrated: dto.relations_integrated,
|
|
@@ -51202,10 +51242,14 @@ function LayoutSurfaceDtoFromApiToFront(dto) {
|
|
|
51202
51242
|
slots: dto.slots
|
|
51203
51243
|
};
|
|
51204
51244
|
}
|
|
51245
|
+
function DataLoadErrorFromApiToFront(dto) {
|
|
51246
|
+
return { code: dto.code, message: dto.message, query: dto.query };
|
|
51247
|
+
}
|
|
51205
51248
|
function UIAssemblyStatsDtoFromApiToFront(dto) {
|
|
51206
51249
|
return {
|
|
51207
51250
|
componentCount: dto.component_count,
|
|
51208
51251
|
dataRows: dto.data_rows ?? void 0,
|
|
51252
|
+
dataLoadError: dto.data_load_error ? DataLoadErrorFromApiToFront(dto.data_load_error) : void 0,
|
|
51209
51253
|
includedFeatures: dto.included_features,
|
|
51210
51254
|
osfqlExecuted: dto.osfql_executed ?? void 0,
|
|
51211
51255
|
sortName: dto.sort_name,
|
|
@@ -51354,6 +51398,9 @@ function UIGenerateResponseFromApiToFront(dto) {
|
|
|
51354
51398
|
if (dto.data_sources !== void 0) {
|
|
51355
51399
|
result.dataSources = dto.data_sources.map(UIDataSourcePayloadFromApiToFront);
|
|
51356
51400
|
}
|
|
51401
|
+
if (dto.data_load_errors !== void 0) {
|
|
51402
|
+
result.dataLoadErrors = dto.data_load_errors.map(DataLoadErrorFromApiToFront);
|
|
51403
|
+
}
|
|
51357
51404
|
if (dto.intents !== void 0) result.intents = dto.intents.map(UIGenerateIntentFromApiToFront);
|
|
51358
51405
|
if (dto.trace != null) result.trace = dto.trace.map(UIPipelineStageTraceFromApiToFront);
|
|
51359
51406
|
return result;
|
|
@@ -51601,6 +51648,34 @@ function ReasoningTraceDtoFromApiToFront(dto) {
|
|
|
51601
51648
|
llmCalls: dto.llm_calls
|
|
51602
51649
|
};
|
|
51603
51650
|
}
|
|
51651
|
+
function ConversationNoticeFromApiToFront(dto) {
|
|
51652
|
+
switch (dto.kind) {
|
|
51653
|
+
case "pruned_features":
|
|
51654
|
+
return {
|
|
51655
|
+
kind: dto.kind,
|
|
51656
|
+
message: dto.message,
|
|
51657
|
+
skipped: dto.skipped.map((s) => ({ feature: s.feature, sort: s.sort }))
|
|
51658
|
+
};
|
|
51659
|
+
case "value_grounding":
|
|
51660
|
+
return {
|
|
51661
|
+
kind: dto.kind,
|
|
51662
|
+
message: dto.message,
|
|
51663
|
+
substitutions: dto.substitutions.map((s) => ({
|
|
51664
|
+
feature: s.feature,
|
|
51665
|
+
from: s.from,
|
|
51666
|
+
sort: s.sort,
|
|
51667
|
+
to: s.to
|
|
51668
|
+
}))
|
|
51669
|
+
};
|
|
51670
|
+
case "retrieval_rescue":
|
|
51671
|
+
return {
|
|
51672
|
+
kind: dto.kind,
|
|
51673
|
+
message: dto.message,
|
|
51674
|
+
recordCount: dto.record_count,
|
|
51675
|
+
sorts: [...dto.sorts]
|
|
51676
|
+
};
|
|
51677
|
+
}
|
|
51678
|
+
}
|
|
51604
51679
|
function ConversationMessageResponseFromApiToFront(dto) {
|
|
51605
51680
|
return {
|
|
51606
51681
|
assistantMessage: dto.assistant_message,
|
|
@@ -51614,6 +51689,7 @@ function ConversationMessageResponseFromApiToFront(dto) {
|
|
|
51614
51689
|
producedTermIds: dto.produced_term_ids,
|
|
51615
51690
|
uiSortId: dto.ui_sort_id ?? void 0,
|
|
51616
51691
|
suggestions: dto.suggestions,
|
|
51692
|
+
notices: dto.notices.map(ConversationNoticeFromApiToFront),
|
|
51617
51693
|
claimAnnotations: dto.claim_annotations?.map(ClaimAnnotationDtoFromApiToFront) ?? void 0,
|
|
51618
51694
|
proofTrace: dto.proof_trace ? ProofTraceNodeDtoFromApiToFront(dto.proof_trace) : void 0,
|
|
51619
51695
|
uiCustomizations: dto.ui_customizations?.map(UICustomizationDtoFromApiToFront) ?? void 0,
|
|
@@ -51636,7 +51712,7 @@ function isJsonObject2(value) {
|
|
|
51636
51712
|
}
|
|
51637
51713
|
function isConversationMessageResponseDto(value) {
|
|
51638
51714
|
if (!isJsonObject2(value)) return false;
|
|
51639
|
-
return typeof Reflect.get(value, "assistant_message") === "string" && typeof Reflect.get(value, "conversation_id") === "string" && typeof Reflect.get(value, "intent") === "string" && typeof Reflect.get(value, "turn_id") === "string" && Array.isArray(Reflect.get(value, "produced_term_ids")) && Array.isArray(Reflect.get(value, "suggestions"));
|
|
51715
|
+
return typeof Reflect.get(value, "assistant_message") === "string" && typeof Reflect.get(value, "conversation_id") === "string" && typeof Reflect.get(value, "intent") === "string" && typeof Reflect.get(value, "turn_id") === "string" && Array.isArray(Reflect.get(value, "produced_term_ids")) && Array.isArray(Reflect.get(value, "suggestions")) && Array.isArray(Reflect.get(value, "notices"));
|
|
51640
51716
|
}
|
|
51641
51717
|
function decodeConversationMessage(payload) {
|
|
51642
51718
|
return isConversationMessageResponseDto(payload) ? ConversationMessageResponseFromApiToFront(payload) : null;
|
|
@@ -51989,6 +52065,37 @@ var ConversationClient = class {
|
|
|
51989
52065
|
});
|
|
51990
52066
|
return decodeResponse(response, ListConversationsResponseFromApiToFront);
|
|
51991
52067
|
}
|
|
52068
|
+
/**
|
|
52069
|
+
* Read one conversation's summary: the row {@link listConversations}
|
|
52070
|
+
* returns for it.
|
|
52071
|
+
*
|
|
52072
|
+
* @param conversationId - The conversation ID.
|
|
52073
|
+
* @param requestOptions - Per-call transport overrides.
|
|
52074
|
+
* @returns The summary, with its `kind` and `title`.
|
|
52075
|
+
* @throws {BadRequestError} `400` if the ID is malformed.
|
|
52076
|
+
* @throws {NotFoundError} `404` if the conversation is not the caller's.
|
|
52077
|
+
* @throws {ApiError} If the request fails.
|
|
52078
|
+
*
|
|
52079
|
+
* @remarks
|
|
52080
|
+
* Uses GET `/api/v1/conversation/{id}`. A caller that resumes a conversation
|
|
52081
|
+
* by ID learns its `kind` and `title` here without reading the whole listing.
|
|
52082
|
+
*
|
|
52083
|
+
* @example
|
|
52084
|
+
* ```typescript
|
|
52085
|
+
* const summary = await client.conversation.getConversation('conv-uuid');
|
|
52086
|
+
* console.log(`${summary.kind}: ${summary.title ?? '(untitled)'}`);
|
|
52087
|
+
* ```
|
|
52088
|
+
*/
|
|
52089
|
+
async getConversation(conversationId, requestOptions) {
|
|
52090
|
+
const response = await this.http.request({
|
|
52091
|
+
...toRequestParams(requestOptions),
|
|
52092
|
+
path: `/api/v1/conversation/${encodeURIComponent(conversationId)}`,
|
|
52093
|
+
method: "GET",
|
|
52094
|
+
secure: true,
|
|
52095
|
+
format: "json"
|
|
52096
|
+
});
|
|
52097
|
+
return decodeResponse(response, ConversationSummaryDtoFromApiToFront);
|
|
52098
|
+
}
|
|
51992
52099
|
/**
|
|
51993
52100
|
* List the registered comparison models so the UI can populate a
|
|
51994
52101
|
* selector / compare panel.
|
|
@@ -53536,10 +53643,12 @@ var UiClient = class {
|
|
|
53536
53643
|
* keys inside them — `params`, `props_override`, a `component`'s `props`
|
|
53537
53644
|
* (`dataKey`) and `initial_values` — reach the engine exactly as written.
|
|
53538
53645
|
*
|
|
53539
|
-
* The data load runs read-only OSFQL. A
|
|
53540
|
-
*
|
|
53541
|
-
*
|
|
53542
|
-
*
|
|
53646
|
+
* The data load runs read-only OSFQL. A load that fails, including a query
|
|
53647
|
+
* that writes the store, does not throw: the view renders without rows,
|
|
53648
|
+
* `stats.dataLoadError` carries the typed `code`, the `message` and the
|
|
53649
|
+
* `query`, and `stats.osfqlExecuted` is absent. Branch on `code`
|
|
53650
|
+
* (`data_load_writes`, `osfql_parse_error`, `osfql_compile_error`,
|
|
53651
|
+
* `osfql_execution_failed`), not on the message.
|
|
53543
53652
|
*
|
|
53544
53653
|
* A data view (table, graph, chart, map, timeline, matrix) names in
|
|
53545
53654
|
* `props.rowKey` the column in which each loaded row carries its term's id.
|
|
@@ -53579,8 +53688,8 @@ var UiClient = class {
|
|
|
53579
53688
|
* `delete_record` template, is not a UUID; if a `"sort_ref"` field's sort
|
|
53580
53689
|
* declares no entity range; if `sortName` names no sort of the tenant or
|
|
53581
53690
|
* contains a backtick; if `values` names a feature the sort does not
|
|
53582
|
-
* declare; if an `update_form`
|
|
53583
|
-
* `sortName
|
|
53691
|
+
* declare; if an `update_form` names a term the tenant does not hold, or a
|
|
53692
|
+
* term whose own sort `sortName` does not subsume; or if the request is malformed otherwise.
|
|
53584
53693
|
* @throws {ApiError} If the request fails otherwise.
|
|
53585
53694
|
*
|
|
53586
53695
|
* @remarks
|
|
@@ -53650,8 +53759,8 @@ var UiClient = class {
|
|
|
53650
53759
|
* endpoint abstains with live-schema suggestions. Data rows always come from OSFQL
|
|
53651
53760
|
* execution after certification — never from the model. The data source runs
|
|
53652
53761
|
* read-only OSFQL: a load query that writes the store is refused without an
|
|
53653
|
-
* exception, and the
|
|
53654
|
-
*
|
|
53762
|
+
* exception, and the failure is a `dataLoadErrors` entry (typed `code`,
|
|
53763
|
+
* `message`, `query`) instead of rows.
|
|
53655
53764
|
*
|
|
53656
53765
|
* A certified single-pattern data query is bound to its rows' term ids: the
|
|
53657
53766
|
* engine adds the identity binding to its root pattern (a note in
|
|
@@ -60799,8 +60908,9 @@ var AguiClient = class {
|
|
|
60799
60908
|
*
|
|
60800
60909
|
* A data load the run performs executes read-only OSFQL. A load query that
|
|
60801
60910
|
* writes the store is refused without an exception or a `RUN_ERROR`: the
|
|
60802
|
-
*
|
|
60803
|
-
*
|
|
60911
|
+
* run emits a `CUSTOM` event named `osfkb.data_load_error` whose `value` is
|
|
60912
|
+
* `{ code, message, query }`, and the `STATE_SNAPSHOT` carries the same
|
|
60913
|
+
* object at `osfkb.dataLoadError`; branch on `code`. No rows are loaded.
|
|
60804
60914
|
*
|
|
60805
60915
|
* @example
|
|
60806
60916
|
* ```typescript
|
|
@@ -61394,6 +61504,7 @@ function ConformalCalibrateResponseFromApiToFront(dto) {
|
|
|
61394
61504
|
algorithm: dto.algorithm,
|
|
61395
61505
|
alpha: dto.alpha,
|
|
61396
61506
|
empiricalCoverage: dto.empirical_coverage,
|
|
61507
|
+
informative: dto.informative,
|
|
61397
61508
|
meetsTargetCoverage: dto.meets_target_coverage,
|
|
61398
61509
|
nSamples: dto.n_samples,
|
|
61399
61510
|
quantileRank: dto.quantile_rank,
|
|
@@ -61408,13 +61519,15 @@ function ConformalPredictRequestFromFrontToApi(model) {
|
|
|
61408
61519
|
threshold: model.threshold
|
|
61409
61520
|
};
|
|
61410
61521
|
}
|
|
61411
|
-
function
|
|
61522
|
+
function SuppliedCalibrationParametersFromApiToFront(dto) {
|
|
61412
61523
|
return {
|
|
61413
61524
|
algorithm: dto.algorithm,
|
|
61414
61525
|
alpha: dto.alpha,
|
|
61526
|
+
informative: dto.informative,
|
|
61415
61527
|
nCalibrationSamples: dto.n_calibration_samples,
|
|
61416
|
-
|
|
61417
|
-
threshold: dto.threshold
|
|
61528
|
+
requestedCoverage: dto.requested_coverage,
|
|
61529
|
+
threshold: dto.threshold,
|
|
61530
|
+
verification: dto.verification
|
|
61418
61531
|
};
|
|
61419
61532
|
}
|
|
61420
61533
|
function ConformalPredictionFromApiToFront(dto) {
|
|
@@ -61428,7 +61541,7 @@ function ConformalPredictionFromApiToFront(dto) {
|
|
|
61428
61541
|
}
|
|
61429
61542
|
function ConformalPredictResponseFromApiToFront(dto) {
|
|
61430
61543
|
return {
|
|
61431
|
-
|
|
61544
|
+
calibrationParameters: SuppliedCalibrationParametersFromApiToFront(dto.calibration_parameters),
|
|
61432
61545
|
predictions: dto.predictions.map(ConformalPredictionFromApiToFront)
|
|
61433
61546
|
};
|
|
61434
61547
|
}
|
|
@@ -61447,11 +61560,22 @@ var ConformalClient = class {
|
|
|
61447
61560
|
*
|
|
61448
61561
|
* @param request - The calibration set (samples + target miscoverage
|
|
61449
61562
|
* `α`).
|
|
61450
|
-
* @
|
|
61451
|
-
*
|
|
61563
|
+
* @param requestOptions - Per-request transport options.
|
|
61564
|
+
* @returns The computed threshold `τ`, whether it is informative, and
|
|
61565
|
+
* in-sample coverage statistics.
|
|
61452
61566
|
*
|
|
61453
61567
|
* @throws {ApiError} `400` if `alpha` is outside `(0, 1)` or the
|
|
61454
|
-
* calibration set is empty.
|
|
61568
|
+
* calibration set is empty or contains invalid scores.
|
|
61569
|
+
* @remarks The request maps schema keys to snake_case and preserves class labels.
|
|
61570
|
+
* An unobserved rank returns threshold 1 and `informative: false`.
|
|
61571
|
+
* @example
|
|
61572
|
+
* ```ts
|
|
61573
|
+
* const calibration = await client.conformal.calibrate({
|
|
61574
|
+
* alpha: 0.05,
|
|
61575
|
+
* samples: labeledSamples,
|
|
61576
|
+
* });
|
|
61577
|
+
* console.log(calibration.informative, calibration.quantileRank);
|
|
61578
|
+
* ```
|
|
61455
61579
|
*/
|
|
61456
61580
|
async calibrate(request, requestOptions) {
|
|
61457
61581
|
const response = await this.api.calibrateConformal(
|
|
@@ -61462,15 +61586,30 @@ var ConformalClient = class {
|
|
|
61462
61586
|
}
|
|
61463
61587
|
/**
|
|
61464
61588
|
* Apply a pre-computed conformal threshold to unlabeled test inputs
|
|
61465
|
-
* and return prediction sets with
|
|
61589
|
+
* and return prediction sets with unverified calibration parameters.
|
|
61466
61590
|
*
|
|
61467
61591
|
* @param request - The threshold `τ`, calibration `α` and sample count
|
|
61468
61592
|
* (from a prior `calibrate` call), and the test inputs to predict
|
|
61469
61593
|
* for.
|
|
61470
|
-
* @
|
|
61471
|
-
*
|
|
61472
|
-
*
|
|
61473
|
-
*
|
|
61594
|
+
* @param requestOptions - Per-request transport options.
|
|
61595
|
+
* @returns Per-input prediction results in request order and the applied
|
|
61596
|
+
* parameters with `verification: 'unverified'`.
|
|
61597
|
+
*
|
|
61598
|
+
* @throws {ApiError} `400` for invalid scores, parameters, rank consistency,
|
|
61599
|
+
* or an empty or oversized test-input batch.
|
|
61600
|
+
* @remarks The request maps schema keys to snake_case and preserves class labels.
|
|
61601
|
+
* A nonempty prediction set can still be uninformative. Parameter consistency
|
|
61602
|
+
* does not establish calibration provenance or prediction correctness.
|
|
61603
|
+
* @example
|
|
61604
|
+
* ```ts
|
|
61605
|
+
* const result = await client.conformal.predict({
|
|
61606
|
+
* threshold: calibration.threshold,
|
|
61607
|
+
* alpha: calibration.alpha,
|
|
61608
|
+
* nCalibrationSamples: calibration.nSamples,
|
|
61609
|
+
* testInputs,
|
|
61610
|
+
* });
|
|
61611
|
+
* console.log(result.calibrationParameters.verification);
|
|
61612
|
+
* ```
|
|
61474
61613
|
*/
|
|
61475
61614
|
async predict(request, requestOptions) {
|
|
61476
61615
|
const response = await this.api.predict(
|