@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/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var __export = (target, all) => {
|
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
// src/config.ts
|
|
8
|
-
var SDK_VERSION = "4.1
|
|
8
|
+
var SDK_VERSION = "4.2.1";
|
|
9
9
|
function resolveConfig(config) {
|
|
10
10
|
if (!config.baseUrl) {
|
|
11
11
|
throw new Error("ClientConfig.baseUrl is required");
|
|
@@ -11005,7 +11005,7 @@ var Ui = class {
|
|
|
11005
11005
|
...params
|
|
11006
11006
|
});
|
|
11007
11007
|
/**
|
|
11008
|
-
* @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
|
|
11008
|
+
* @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
|
|
11009
11009
|
*
|
|
11010
11010
|
* @tags ui
|
|
11011
11011
|
* @name DescribeUiStream
|
|
@@ -12426,7 +12426,7 @@ var Conformal = class {
|
|
|
12426
12426
|
this.http = http;
|
|
12427
12427
|
}
|
|
12428
12428
|
/**
|
|
12429
|
-
* @description Compute a split-conformal non-conformity threshold from a labeled calibration set.
|
|
12429
|
+
* @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`.
|
|
12430
12430
|
*
|
|
12431
12431
|
* @tags conformal
|
|
12432
12432
|
* @name CalibrateConformal
|
|
@@ -12442,7 +12442,7 @@ var Conformal = class {
|
|
|
12442
12442
|
...params
|
|
12443
12443
|
});
|
|
12444
12444
|
/**
|
|
12445
|
-
* @description Apply a pre-computed conformal threshold to unlabeled test inputs and return prediction sets with
|
|
12445
|
+
* @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.
|
|
12446
12446
|
*
|
|
12447
12447
|
* @tags conformal
|
|
12448
12448
|
* @name Predict
|
|
@@ -17601,6 +17601,7 @@ var RESPONSE_COMPONENTS = {
|
|
|
17601
17601
|
algorithm: [1, 0],
|
|
17602
17602
|
alpha: [1, 0],
|
|
17603
17603
|
empirical_coverage: [1, 0],
|
|
17604
|
+
informative: [1, 0],
|
|
17604
17605
|
meets_target_coverage: [1, 0],
|
|
17605
17606
|
n_samples: [1, 0],
|
|
17606
17607
|
quantile_rank: [1, 0],
|
|
@@ -17609,7 +17610,7 @@ var RESPONSE_COMPONENTS = {
|
|
|
17609
17610
|
},
|
|
17610
17611
|
ConformalPredictResponse: {
|
|
17611
17612
|
object: {
|
|
17612
|
-
|
|
17613
|
+
calibration_parameters: [1, "SuppliedCalibrationParameters"],
|
|
17613
17614
|
predictions: [1, { array: "ConformalPrediction" }]
|
|
17614
17615
|
}
|
|
17615
17616
|
},
|
|
@@ -17784,6 +17785,7 @@ var RESPONSE_COMPONENTS = {
|
|
|
17784
17785
|
injection: [2, "InjectionSummaryDto"],
|
|
17785
17786
|
intent: [1, 0],
|
|
17786
17787
|
matched_templates: [2, { array: "QueryTemplateDto" }],
|
|
17788
|
+
notices: [1, { array: 0 }],
|
|
17787
17789
|
produced_term_ids: [1, { array: 0 }],
|
|
17788
17790
|
prompt_trace: [2, "PromptTraceDto"],
|
|
17789
17791
|
proof_trace: [2, "ProofTraceNodeDto"],
|
|
@@ -17845,15 +17847,6 @@ var RESPONSE_COMPONENTS = {
|
|
|
17845
17847
|
}
|
|
17846
17848
|
},
|
|
17847
17849
|
CounterfactualTraceDto: { object: { abduction: [1, 0], action: [1, 0], prediction: [1, 0] } },
|
|
17848
|
-
CoverageCertificate: {
|
|
17849
|
-
object: {
|
|
17850
|
-
algorithm: [1, 0],
|
|
17851
|
-
alpha: [1, 0],
|
|
17852
|
-
n_calibration_samples: [1, 0],
|
|
17853
|
-
nominal_coverage: [1, 0],
|
|
17854
|
-
threshold: [1, 0]
|
|
17855
|
-
}
|
|
17856
|
-
},
|
|
17857
17850
|
CoverageDetailDto: {
|
|
17858
17851
|
object: {
|
|
17859
17852
|
class_coverage: [1, 0],
|
|
@@ -17967,6 +17960,7 @@ var RESPONSE_COMPONENTS = {
|
|
|
17967
17960
|
explanation: [1, 0]
|
|
17968
17961
|
}
|
|
17969
17962
|
},
|
|
17963
|
+
DataLoadErrorDto: { object: { code: [1, 0], message: [1, 0], query: [1, 0] } },
|
|
17970
17964
|
DataMixingStatsDto: {
|
|
17971
17965
|
object: {
|
|
17972
17966
|
negative_count: [1, 0],
|
|
@@ -18436,6 +18430,7 @@ var RESPONSE_COMPONENTS = {
|
|
|
18436
18430
|
chunks_processed: [1, 0],
|
|
18437
18431
|
document_id: [1, 0],
|
|
18438
18432
|
entities_extracted: [1, 0],
|
|
18433
|
+
entities_refused: [1, { array: "RefusedEntityDto" }],
|
|
18439
18434
|
processing_time_ms: [1, 0],
|
|
18440
18435
|
relations_extracted: [1, 0],
|
|
18441
18436
|
relations_integrated: [1, 0],
|
|
@@ -21267,9 +21262,11 @@ var RESPONSE_COMPONENTS = {
|
|
|
21267
21262
|
}
|
|
21268
21263
|
},
|
|
21269
21264
|
PromptTraceDto: { object: { llm_context: [1, "LlmContextTraceDto"], system_prompt: [1, 0] } },
|
|
21265
|
+
ProofConclusionDto: { object: { features: [1, { object: {} }], sort_id: [1, 0] } },
|
|
21270
21266
|
ProofDto: {
|
|
21271
21267
|
object: {
|
|
21272
21268
|
certainty: [1, 0],
|
|
21269
|
+
conclusion: [0, "ProofConclusionDto"],
|
|
21273
21270
|
kind: [1, 0],
|
|
21274
21271
|
subproofs: [0, { array: "ProofDto" }],
|
|
21275
21272
|
substitution: [1, "HomoiconicSubstitutionDto"]
|
|
@@ -22338,6 +22335,7 @@ var RESPONSE_COMPONENTS = {
|
|
|
22338
22335
|
SolutionDto: {
|
|
22339
22336
|
object: {
|
|
22340
22337
|
certainty: [1, 0],
|
|
22338
|
+
conclusion: [2, "ProofConclusionDto"],
|
|
22341
22339
|
matched_sorts: [0, { array: 0 }],
|
|
22342
22340
|
proof: [2, "ProofDto"],
|
|
22343
22341
|
residuated_sorts: [0, { array: 0 }],
|
|
@@ -22745,6 +22743,17 @@ var RESPONSE_COMPONENTS = {
|
|
|
22745
22743
|
supervisor_active: [1, 0]
|
|
22746
22744
|
}
|
|
22747
22745
|
},
|
|
22746
|
+
SuppliedCalibrationParameters: {
|
|
22747
|
+
object: {
|
|
22748
|
+
algorithm: [1, 0],
|
|
22749
|
+
alpha: [1, 0],
|
|
22750
|
+
informative: [1, 0],
|
|
22751
|
+
n_calibration_samples: [1, 0],
|
|
22752
|
+
requested_coverage: [1, 0],
|
|
22753
|
+
threshold: [1, 0],
|
|
22754
|
+
verification: [1, 0]
|
|
22755
|
+
}
|
|
22756
|
+
},
|
|
22748
22757
|
SuspendedQueryDto: {
|
|
22749
22758
|
object: {
|
|
22750
22759
|
confidence: [1, 0],
|
|
@@ -23060,6 +23069,7 @@ var RESPONSE_COMPONENTS = {
|
|
|
23060
23069
|
UIAssemblyStatsDto: {
|
|
23061
23070
|
object: {
|
|
23062
23071
|
component_count: [1, 0],
|
|
23072
|
+
data_load_error: [2, "DataLoadErrorDto"],
|
|
23063
23073
|
included_features: [1, 0],
|
|
23064
23074
|
sort_name: [1, 0],
|
|
23065
23075
|
total_features: [1, 0],
|
|
@@ -23098,6 +23108,7 @@ var RESPONSE_COMPONENTS = {
|
|
|
23098
23108
|
UIGenerateResponse: {
|
|
23099
23109
|
object: {
|
|
23100
23110
|
data: [2, "DataPayloadDto"],
|
|
23111
|
+
data_load_errors: [0, { array: "DataLoadErrorDto" }],
|
|
23101
23112
|
data_sources: [0, { array: "DataSourcePayloadDto" }],
|
|
23102
23113
|
descriptor: [2, "UIDescriptorDto"],
|
|
23103
23114
|
diagnostics: [0, { array: 0 }],
|
|
@@ -24786,6 +24797,11 @@ var RESPONSE_OPERATIONS = {
|
|
|
24786
24797
|
path: "/api/v1/constraint-sessions/{session_id}",
|
|
24787
24798
|
responses: { 200: "ConstraintSessionStatusResponse" }
|
|
24788
24799
|
},
|
|
24800
|
+
getConversation: {
|
|
24801
|
+
method: "GET",
|
|
24802
|
+
path: "/api/v1/conversation/{id}",
|
|
24803
|
+
responses: { 200: "ConversationSummaryDto" }
|
|
24804
|
+
},
|
|
24789
24805
|
getConversationEntries: {
|
|
24790
24806
|
method: "GET",
|
|
24791
24807
|
path: "/api/v1/audit/entries/{conversation_id}",
|
|
@@ -29294,6 +29310,14 @@ function HomoiconicSubstitutionDtoFromApiToFront(dto) {
|
|
|
29294
29310
|
bindings: dto.bindings.map(BindingDtoFromApiToFront)
|
|
29295
29311
|
};
|
|
29296
29312
|
}
|
|
29313
|
+
function ProofConclusionDtoFromApiToFront(dto) {
|
|
29314
|
+
return {
|
|
29315
|
+
features: featuresFromApiToFront(dto.features),
|
|
29316
|
+
sortId: dto.sort_id,
|
|
29317
|
+
sortName: dto.sort_name ?? void 0,
|
|
29318
|
+
termId: dto.term_id ?? void 0
|
|
29319
|
+
};
|
|
29320
|
+
}
|
|
29297
29321
|
function ProofDtoFromApiToFront(dto) {
|
|
29298
29322
|
return {
|
|
29299
29323
|
kind: dto.kind,
|
|
@@ -29301,6 +29325,7 @@ function ProofDtoFromApiToFront(dto) {
|
|
|
29301
29325
|
ruleTermId: dto.rule_term_id,
|
|
29302
29326
|
ruleHeadTermId: dto.rule_head_term_id,
|
|
29303
29327
|
goalDisplay: dto.goal_display,
|
|
29328
|
+
conclusion: dto.conclusion ? ProofConclusionDtoFromApiToFront(dto.conclusion) : void 0,
|
|
29304
29329
|
ruleLabel: dto.rule_label,
|
|
29305
29330
|
substitution: HomoiconicSubstitutionDtoFromApiToFront(dto.substitution),
|
|
29306
29331
|
subproofs: dto.subproofs?.map(ProofDtoFromApiToFront),
|
|
@@ -29354,6 +29379,7 @@ function SolutionDtoFromApiToFront(dto) {
|
|
|
29354
29379
|
const solution = {
|
|
29355
29380
|
substitution: HomoiconicSubstitutionDtoFromApiToFront(dto.substitution),
|
|
29356
29381
|
proof: dto.proof ? ProofDtoFromApiToFront(dto.proof) : void 0,
|
|
29382
|
+
conclusion: dto.conclusion ? ProofConclusionDtoFromApiToFront(dto.conclusion) : void 0,
|
|
29357
29383
|
certainty: dto.certainty,
|
|
29358
29384
|
evidenceMatched: dto.evidence_matched ?? void 0,
|
|
29359
29385
|
evidenceRatio: dto.evidence_ratio ?? void 0,
|
|
@@ -30054,6 +30080,8 @@ var InferenceClient = class {
|
|
|
30054
30080
|
* engine-side head aggregator (see {@link RuleAggregatorDto}).
|
|
30055
30081
|
* @returns The created rule wrapped in an AddRuleResponse, with its
|
|
30056
30082
|
* {@link AddRuleResponse.etag} when the engine sends the `ETag` header.
|
|
30083
|
+
* @throws {@link ValidationError} before the request is sent, when `antecedents` is
|
|
30084
|
+
* not an array (a request built from untyped data) — `field` is `antecedents`.
|
|
30057
30085
|
* @throws {ApiError} If the rule is rejected or the request fails — 422 when
|
|
30058
30086
|
* it is unusable as written: a head or body antecedent naming a sort or
|
|
30059
30087
|
* term that does not exist (the message names it and its position — `the
|
|
@@ -30063,9 +30091,8 @@ var InferenceClient = class {
|
|
|
30063
30091
|
* cycle the program already had is not blamed on it), or a rule with no
|
|
30064
30092
|
* antecedents (`rule rejected: a rule needs at least one antecedent; a
|
|
30065
30093
|
* term with no antecedents is a fact — write it through POST
|
|
30066
|
-
* /api/v1/terms` — write a fact with `client.terms.createTerm`).
|
|
30067
|
-
*
|
|
30068
|
-
* plain-text 422. The refusal is a
|
|
30094
|
+
* /api/v1/terms` — write a fact with `client.terms.createTerm`). The
|
|
30095
|
+
* refusal is a
|
|
30069
30096
|
* plain {@link ApiError} with `status` 422 — not a `BadRequestError`
|
|
30070
30097
|
* (earlier engines answered an unknown head sort with 400), and not a
|
|
30071
30098
|
* `NamedConstraintViolationError`, which is reserved for a feature
|
|
@@ -30095,7 +30122,7 @@ var InferenceClient = class {
|
|
|
30095
30122
|
async addRule(request, requestOptions) {
|
|
30096
30123
|
const wireRequest = {
|
|
30097
30124
|
term: convertTermArg(request.term),
|
|
30098
|
-
antecedents: request.antecedents
|
|
30125
|
+
antecedents: convertAntecedents(request.antecedents, "antecedents"),
|
|
30099
30126
|
certainty: request.certainty,
|
|
30100
30127
|
aggregator: request.aggregator
|
|
30101
30128
|
};
|
|
@@ -30112,6 +30139,8 @@ var InferenceClient = class {
|
|
|
30112
30139
|
* @returns Whether the write would accept it (`ok`), every refusal with the
|
|
30113
30140
|
* status the write would answer, the NAF-safety warnings, and the rule as
|
|
30114
30141
|
* the write would build it.
|
|
30142
|
+
* @throws {@link ValidationError} before the request is sent, when `antecedents` is
|
|
30143
|
+
* not an array (a request built from untyped data) — `field` is `antecedents`.
|
|
30115
30144
|
* @throws {ApiError} If the request itself fails.
|
|
30116
30145
|
*
|
|
30117
30146
|
* @remarks
|
|
@@ -30136,7 +30165,7 @@ var InferenceClient = class {
|
|
|
30136
30165
|
async validateRule(request, requestOptions) {
|
|
30137
30166
|
const wireRequest = {
|
|
30138
30167
|
term: convertTermArg(request.term),
|
|
30139
|
-
antecedents: request.antecedents
|
|
30168
|
+
antecedents: convertAntecedents(request.antecedents, "antecedents"),
|
|
30140
30169
|
certainty: request.certainty,
|
|
30141
30170
|
aggregator: request.aggregator
|
|
30142
30171
|
};
|
|
@@ -30181,10 +30210,11 @@ var InferenceClient = class {
|
|
|
30181
30210
|
* @param requestOptions - Per-call request options.
|
|
30182
30211
|
* @returns What was written, and what was refused: `ruleTermIds` and
|
|
30183
30212
|
* `rulesAdded` for the accepted rules, `rejected` naming each refused one.
|
|
30184
|
-
* @throws {@link ApiError} 422 when the body is malformed
|
|
30185
|
-
*
|
|
30213
|
+
* @throws {@link ApiError} 422 when the body is malformed — a 422 never
|
|
30214
|
+
* means a refused row.
|
|
30186
30215
|
* @throws {@link ValidationError} before the request is sent, when a rule's
|
|
30187
|
-
* term cannot be encoded
|
|
30216
|
+
* term cannot be encoded, or a row has no `antecedents` array — `field`
|
|
30217
|
+
* names it as `rules[k].term`, `rules[k].antecedents` or
|
|
30188
30218
|
* `rules[k].antecedents[i]`.
|
|
30189
30219
|
*
|
|
30190
30220
|
* @remarks
|
|
@@ -30199,7 +30229,8 @@ var InferenceClient = class {
|
|
|
30199
30229
|
* number submitted. A row with an empty `antecedents` list is refused per
|
|
30200
30230
|
* row this way (`rule rejected: a rule needs at least one antecedent; …`)
|
|
30201
30231
|
* and is not counted in `rulesAdded` or `ruleTermIds`; a row with no
|
|
30202
|
-
* `antecedents`
|
|
30232
|
+
* `antecedents` array is refused before the request is sent, with a
|
|
30233
|
+
* `ValidationError` whose `field` is `rules[k].antecedents`. A rule that closes a
|
|
30203
30234
|
* NEW cycle through negation is refused the same way (the reason names the
|
|
30204
30235
|
* cycle's sorts), decided for every row before any row is written.
|
|
30205
30236
|
*
|
|
@@ -30213,9 +30244,9 @@ var InferenceClient = class {
|
|
|
30213
30244
|
*/
|
|
30214
30245
|
async bulkAddRules(request, requestOptions) {
|
|
30215
30246
|
const wireRequest = {
|
|
30216
|
-
rules: request.rules.map((r) => ({
|
|
30247
|
+
rules: request.rules.map((r, k) => ({
|
|
30217
30248
|
term: convertTermArg(r.term),
|
|
30218
|
-
antecedents: r.antecedents.
|
|
30249
|
+
antecedents: convertAntecedents(r.antecedents, `rules[${k}].antecedents`),
|
|
30219
30250
|
certainty: r.certainty,
|
|
30220
30251
|
aggregator: r.aggregator
|
|
30221
30252
|
}))
|
|
@@ -30401,7 +30432,8 @@ var InferenceClient = class {
|
|
|
30401
30432
|
* @throws {@link PreconditionRequiredError} 428 when `ifMatch` is omitted
|
|
30402
30433
|
* and the engine runs with `OSFKB_REQUIRE_IF_MATCH=1`.
|
|
30403
30434
|
* @throws {@link ValidationError} before the request is sent, when a term
|
|
30404
|
-
* cannot be encoded — `field` names it
|
|
30435
|
+
* cannot be encoded, or `antecedents` is not an array — `field` names it
|
|
30436
|
+
* (`term`, `antecedents`, `antecedents[i]`).
|
|
30405
30437
|
*
|
|
30406
30438
|
* @remarks
|
|
30407
30439
|
* A rule's id IS its conclusion term id, so an edit changes it by
|
|
@@ -30440,7 +30472,7 @@ var InferenceClient = class {
|
|
|
30440
30472
|
async replaceRule(ruleId, request, requestOptions) {
|
|
30441
30473
|
const wireRequest = {
|
|
30442
30474
|
term: convertTermArg(request.term),
|
|
30443
|
-
antecedents: request.antecedents
|
|
30475
|
+
antecedents: convertAntecedents(request.antecedents, "antecedents"),
|
|
30444
30476
|
certainty: request.certainty,
|
|
30445
30477
|
aggregator: request.aggregator
|
|
30446
30478
|
};
|
|
@@ -30950,6 +30982,12 @@ var InferenceClient = class {
|
|
|
30950
30982
|
function convertTermArg(input) {
|
|
30951
30983
|
return isPsiTermInput(input) ? toTermInputDto(input) : input;
|
|
30952
30984
|
}
|
|
30985
|
+
function convertAntecedents(antecedents, field) {
|
|
30986
|
+
if (!Array.isArray(antecedents)) {
|
|
30987
|
+
throw new ValidationError(`${field} must be an array of terms`, field);
|
|
30988
|
+
}
|
|
30989
|
+
return antecedents.map(convertTermArg);
|
|
30990
|
+
}
|
|
30953
30991
|
function withRuleEtag(body, headers) {
|
|
30954
30992
|
const etag = headers.get("etag");
|
|
30955
30993
|
return etag === null ? body : { ...body, etag };
|
|
@@ -37238,6 +37276,7 @@ function DocumentReceiptFromApiToFront(dto) {
|
|
|
37238
37276
|
function SessionDocumentFromApiToFront(dto) {
|
|
37239
37277
|
const out = { documentId: dto.document_id, status: dto.status };
|
|
37240
37278
|
if (dto.error != null) out.error = dto.error;
|
|
37279
|
+
if (dto.error_code != null) out.errorCode = dto.error_code;
|
|
37241
37280
|
if (dto.receipt != null) out.receipt = DocumentReceiptFromApiToFront(dto.receipt);
|
|
37242
37281
|
return out;
|
|
37243
37282
|
}
|
|
@@ -37351,6 +37390,7 @@ function DocumentStatsDtoFromApiToFront(dto) {
|
|
|
37351
37390
|
documentId: dto.document_id,
|
|
37352
37391
|
documentTermId: dto.document_term_id ?? void 0,
|
|
37353
37392
|
entitiesExtracted: dto.entities_extracted,
|
|
37393
|
+
entitiesRefused: dto.entities_refused.map(RefusedEntityDtoFromApiToFront),
|
|
37354
37394
|
processingTimeMs: dto.processing_time_ms,
|
|
37355
37395
|
relationsExtracted: dto.relations_extracted,
|
|
37356
37396
|
relationsIntegrated: dto.relations_integrated,
|
|
@@ -51200,10 +51240,14 @@ function LayoutSurfaceDtoFromApiToFront(dto) {
|
|
|
51200
51240
|
slots: dto.slots
|
|
51201
51241
|
};
|
|
51202
51242
|
}
|
|
51243
|
+
function DataLoadErrorFromApiToFront(dto) {
|
|
51244
|
+
return { code: dto.code, message: dto.message, query: dto.query };
|
|
51245
|
+
}
|
|
51203
51246
|
function UIAssemblyStatsDtoFromApiToFront(dto) {
|
|
51204
51247
|
return {
|
|
51205
51248
|
componentCount: dto.component_count,
|
|
51206
51249
|
dataRows: dto.data_rows ?? void 0,
|
|
51250
|
+
dataLoadError: dto.data_load_error ? DataLoadErrorFromApiToFront(dto.data_load_error) : void 0,
|
|
51207
51251
|
includedFeatures: dto.included_features,
|
|
51208
51252
|
osfqlExecuted: dto.osfql_executed ?? void 0,
|
|
51209
51253
|
sortName: dto.sort_name,
|
|
@@ -51352,6 +51396,9 @@ function UIGenerateResponseFromApiToFront(dto) {
|
|
|
51352
51396
|
if (dto.data_sources !== void 0) {
|
|
51353
51397
|
result.dataSources = dto.data_sources.map(UIDataSourcePayloadFromApiToFront);
|
|
51354
51398
|
}
|
|
51399
|
+
if (dto.data_load_errors !== void 0) {
|
|
51400
|
+
result.dataLoadErrors = dto.data_load_errors.map(DataLoadErrorFromApiToFront);
|
|
51401
|
+
}
|
|
51355
51402
|
if (dto.intents !== void 0) result.intents = dto.intents.map(UIGenerateIntentFromApiToFront);
|
|
51356
51403
|
if (dto.trace != null) result.trace = dto.trace.map(UIPipelineStageTraceFromApiToFront);
|
|
51357
51404
|
return result;
|
|
@@ -51599,6 +51646,34 @@ function ReasoningTraceDtoFromApiToFront(dto) {
|
|
|
51599
51646
|
llmCalls: dto.llm_calls
|
|
51600
51647
|
};
|
|
51601
51648
|
}
|
|
51649
|
+
function ConversationNoticeFromApiToFront(dto) {
|
|
51650
|
+
switch (dto.kind) {
|
|
51651
|
+
case "pruned_features":
|
|
51652
|
+
return {
|
|
51653
|
+
kind: dto.kind,
|
|
51654
|
+
message: dto.message,
|
|
51655
|
+
skipped: dto.skipped.map((s) => ({ feature: s.feature, sort: s.sort }))
|
|
51656
|
+
};
|
|
51657
|
+
case "value_grounding":
|
|
51658
|
+
return {
|
|
51659
|
+
kind: dto.kind,
|
|
51660
|
+
message: dto.message,
|
|
51661
|
+
substitutions: dto.substitutions.map((s) => ({
|
|
51662
|
+
feature: s.feature,
|
|
51663
|
+
from: s.from,
|
|
51664
|
+
sort: s.sort,
|
|
51665
|
+
to: s.to
|
|
51666
|
+
}))
|
|
51667
|
+
};
|
|
51668
|
+
case "retrieval_rescue":
|
|
51669
|
+
return {
|
|
51670
|
+
kind: dto.kind,
|
|
51671
|
+
message: dto.message,
|
|
51672
|
+
recordCount: dto.record_count,
|
|
51673
|
+
sorts: [...dto.sorts]
|
|
51674
|
+
};
|
|
51675
|
+
}
|
|
51676
|
+
}
|
|
51602
51677
|
function ConversationMessageResponseFromApiToFront(dto) {
|
|
51603
51678
|
return {
|
|
51604
51679
|
assistantMessage: dto.assistant_message,
|
|
@@ -51612,6 +51687,7 @@ function ConversationMessageResponseFromApiToFront(dto) {
|
|
|
51612
51687
|
producedTermIds: dto.produced_term_ids,
|
|
51613
51688
|
uiSortId: dto.ui_sort_id ?? void 0,
|
|
51614
51689
|
suggestions: dto.suggestions,
|
|
51690
|
+
notices: dto.notices.map(ConversationNoticeFromApiToFront),
|
|
51615
51691
|
claimAnnotations: dto.claim_annotations?.map(ClaimAnnotationDtoFromApiToFront) ?? void 0,
|
|
51616
51692
|
proofTrace: dto.proof_trace ? ProofTraceNodeDtoFromApiToFront(dto.proof_trace) : void 0,
|
|
51617
51693
|
uiCustomizations: dto.ui_customizations?.map(UICustomizationDtoFromApiToFront) ?? void 0,
|
|
@@ -51634,7 +51710,7 @@ function isJsonObject2(value) {
|
|
|
51634
51710
|
}
|
|
51635
51711
|
function isConversationMessageResponseDto(value) {
|
|
51636
51712
|
if (!isJsonObject2(value)) return false;
|
|
51637
|
-
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"));
|
|
51713
|
+
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"));
|
|
51638
51714
|
}
|
|
51639
51715
|
function decodeConversationMessage(payload) {
|
|
51640
51716
|
return isConversationMessageResponseDto(payload) ? ConversationMessageResponseFromApiToFront(payload) : null;
|
|
@@ -51987,6 +52063,37 @@ var ConversationClient = class {
|
|
|
51987
52063
|
});
|
|
51988
52064
|
return decodeResponse(response, ListConversationsResponseFromApiToFront);
|
|
51989
52065
|
}
|
|
52066
|
+
/**
|
|
52067
|
+
* Read one conversation's summary: the row {@link listConversations}
|
|
52068
|
+
* returns for it.
|
|
52069
|
+
*
|
|
52070
|
+
* @param conversationId - The conversation ID.
|
|
52071
|
+
* @param requestOptions - Per-call transport overrides.
|
|
52072
|
+
* @returns The summary, with its `kind` and `title`.
|
|
52073
|
+
* @throws {BadRequestError} `400` if the ID is malformed.
|
|
52074
|
+
* @throws {NotFoundError} `404` if the conversation is not the caller's.
|
|
52075
|
+
* @throws {ApiError} If the request fails.
|
|
52076
|
+
*
|
|
52077
|
+
* @remarks
|
|
52078
|
+
* Uses GET `/api/v1/conversation/{id}`. A caller that resumes a conversation
|
|
52079
|
+
* by ID learns its `kind` and `title` here without reading the whole listing.
|
|
52080
|
+
*
|
|
52081
|
+
* @example
|
|
52082
|
+
* ```typescript
|
|
52083
|
+
* const summary = await client.conversation.getConversation('conv-uuid');
|
|
52084
|
+
* console.log(`${summary.kind}: ${summary.title ?? '(untitled)'}`);
|
|
52085
|
+
* ```
|
|
52086
|
+
*/
|
|
52087
|
+
async getConversation(conversationId, requestOptions) {
|
|
52088
|
+
const response = await this.http.request({
|
|
52089
|
+
...toRequestParams(requestOptions),
|
|
52090
|
+
path: `/api/v1/conversation/${encodeURIComponent(conversationId)}`,
|
|
52091
|
+
method: "GET",
|
|
52092
|
+
secure: true,
|
|
52093
|
+
format: "json"
|
|
52094
|
+
});
|
|
52095
|
+
return decodeResponse(response, ConversationSummaryDtoFromApiToFront);
|
|
52096
|
+
}
|
|
51990
52097
|
/**
|
|
51991
52098
|
* List the registered comparison models so the UI can populate a
|
|
51992
52099
|
* selector / compare panel.
|
|
@@ -53534,10 +53641,12 @@ var UiClient = class {
|
|
|
53534
53641
|
* keys inside them — `params`, `props_override`, a `component`'s `props`
|
|
53535
53642
|
* (`dataKey`) and `initial_values` — reach the engine exactly as written.
|
|
53536
53643
|
*
|
|
53537
|
-
* The data load runs read-only OSFQL. A
|
|
53538
|
-
*
|
|
53539
|
-
*
|
|
53540
|
-
*
|
|
53644
|
+
* The data load runs read-only OSFQL. A load that fails, including a query
|
|
53645
|
+
* that writes the store, does not throw: the view renders without rows,
|
|
53646
|
+
* `stats.dataLoadError` carries the typed `code`, the `message` and the
|
|
53647
|
+
* `query`, and `stats.osfqlExecuted` is absent. Branch on `code`
|
|
53648
|
+
* (`data_load_writes`, `osfql_parse_error`, `osfql_compile_error`,
|
|
53649
|
+
* `osfql_execution_failed`), not on the message.
|
|
53541
53650
|
*
|
|
53542
53651
|
* A data view (table, graph, chart, map, timeline, matrix) names in
|
|
53543
53652
|
* `props.rowKey` the column in which each loaded row carries its term's id.
|
|
@@ -53577,8 +53686,8 @@ var UiClient = class {
|
|
|
53577
53686
|
* `delete_record` template, is not a UUID; if a `"sort_ref"` field's sort
|
|
53578
53687
|
* declares no entity range; if `sortName` names no sort of the tenant or
|
|
53579
53688
|
* contains a backtick; if `values` names a feature the sort does not
|
|
53580
|
-
* declare; if an `update_form`
|
|
53581
|
-
* `sortName
|
|
53689
|
+
* declare; if an `update_form` names a term the tenant does not hold, or a
|
|
53690
|
+
* term whose own sort `sortName` does not subsume; or if the request is malformed otherwise.
|
|
53582
53691
|
* @throws {ApiError} If the request fails otherwise.
|
|
53583
53692
|
*
|
|
53584
53693
|
* @remarks
|
|
@@ -53648,8 +53757,8 @@ var UiClient = class {
|
|
|
53648
53757
|
* endpoint abstains with live-schema suggestions. Data rows always come from OSFQL
|
|
53649
53758
|
* execution after certification — never from the model. The data source runs
|
|
53650
53759
|
* read-only OSFQL: a load query that writes the store is refused without an
|
|
53651
|
-
* exception, and the
|
|
53652
|
-
*
|
|
53760
|
+
* exception, and the failure is a `dataLoadErrors` entry (typed `code`,
|
|
53761
|
+
* `message`, `query`) instead of rows.
|
|
53653
53762
|
*
|
|
53654
53763
|
* A certified single-pattern data query is bound to its rows' term ids: the
|
|
53655
53764
|
* engine adds the identity binding to its root pattern (a note in
|
|
@@ -60797,8 +60906,9 @@ var AguiClient = class {
|
|
|
60797
60906
|
*
|
|
60798
60907
|
* A data load the run performs executes read-only OSFQL. A load query that
|
|
60799
60908
|
* writes the store is refused without an exception or a `RUN_ERROR`: the
|
|
60800
|
-
*
|
|
60801
|
-
*
|
|
60909
|
+
* run emits a `CUSTOM` event named `osfkb.data_load_error` whose `value` is
|
|
60910
|
+
* `{ code, message, query }`, and the `STATE_SNAPSHOT` carries the same
|
|
60911
|
+
* object at `osfkb.dataLoadError`; branch on `code`. No rows are loaded.
|
|
60802
60912
|
*
|
|
60803
60913
|
* @example
|
|
60804
60914
|
* ```typescript
|
|
@@ -61392,6 +61502,7 @@ function ConformalCalibrateResponseFromApiToFront(dto) {
|
|
|
61392
61502
|
algorithm: dto.algorithm,
|
|
61393
61503
|
alpha: dto.alpha,
|
|
61394
61504
|
empiricalCoverage: dto.empirical_coverage,
|
|
61505
|
+
informative: dto.informative,
|
|
61395
61506
|
meetsTargetCoverage: dto.meets_target_coverage,
|
|
61396
61507
|
nSamples: dto.n_samples,
|
|
61397
61508
|
quantileRank: dto.quantile_rank,
|
|
@@ -61406,13 +61517,15 @@ function ConformalPredictRequestFromFrontToApi(model) {
|
|
|
61406
61517
|
threshold: model.threshold
|
|
61407
61518
|
};
|
|
61408
61519
|
}
|
|
61409
|
-
function
|
|
61520
|
+
function SuppliedCalibrationParametersFromApiToFront(dto) {
|
|
61410
61521
|
return {
|
|
61411
61522
|
algorithm: dto.algorithm,
|
|
61412
61523
|
alpha: dto.alpha,
|
|
61524
|
+
informative: dto.informative,
|
|
61413
61525
|
nCalibrationSamples: dto.n_calibration_samples,
|
|
61414
|
-
|
|
61415
|
-
threshold: dto.threshold
|
|
61526
|
+
requestedCoverage: dto.requested_coverage,
|
|
61527
|
+
threshold: dto.threshold,
|
|
61528
|
+
verification: dto.verification
|
|
61416
61529
|
};
|
|
61417
61530
|
}
|
|
61418
61531
|
function ConformalPredictionFromApiToFront(dto) {
|
|
@@ -61426,7 +61539,7 @@ function ConformalPredictionFromApiToFront(dto) {
|
|
|
61426
61539
|
}
|
|
61427
61540
|
function ConformalPredictResponseFromApiToFront(dto) {
|
|
61428
61541
|
return {
|
|
61429
|
-
|
|
61542
|
+
calibrationParameters: SuppliedCalibrationParametersFromApiToFront(dto.calibration_parameters),
|
|
61430
61543
|
predictions: dto.predictions.map(ConformalPredictionFromApiToFront)
|
|
61431
61544
|
};
|
|
61432
61545
|
}
|
|
@@ -61445,11 +61558,22 @@ var ConformalClient = class {
|
|
|
61445
61558
|
*
|
|
61446
61559
|
* @param request - The calibration set (samples + target miscoverage
|
|
61447
61560
|
* `α`).
|
|
61448
|
-
* @
|
|
61449
|
-
*
|
|
61561
|
+
* @param requestOptions - Per-request transport options.
|
|
61562
|
+
* @returns The computed threshold `τ`, whether it is informative, and
|
|
61563
|
+
* in-sample coverage statistics.
|
|
61450
61564
|
*
|
|
61451
61565
|
* @throws {ApiError} `400` if `alpha` is outside `(0, 1)` or the
|
|
61452
|
-
* calibration set is empty.
|
|
61566
|
+
* calibration set is empty or contains invalid scores.
|
|
61567
|
+
* @remarks The request maps schema keys to snake_case and preserves class labels.
|
|
61568
|
+
* An unobserved rank returns threshold 1 and `informative: false`.
|
|
61569
|
+
* @example
|
|
61570
|
+
* ```ts
|
|
61571
|
+
* const calibration = await client.conformal.calibrate({
|
|
61572
|
+
* alpha: 0.05,
|
|
61573
|
+
* samples: labeledSamples,
|
|
61574
|
+
* });
|
|
61575
|
+
* console.log(calibration.informative, calibration.quantileRank);
|
|
61576
|
+
* ```
|
|
61453
61577
|
*/
|
|
61454
61578
|
async calibrate(request, requestOptions) {
|
|
61455
61579
|
const response = await this.api.calibrateConformal(
|
|
@@ -61460,15 +61584,30 @@ var ConformalClient = class {
|
|
|
61460
61584
|
}
|
|
61461
61585
|
/**
|
|
61462
61586
|
* Apply a pre-computed conformal threshold to unlabeled test inputs
|
|
61463
|
-
* and return prediction sets with
|
|
61587
|
+
* and return prediction sets with unverified calibration parameters.
|
|
61464
61588
|
*
|
|
61465
61589
|
* @param request - The threshold `τ`, calibration `α` and sample count
|
|
61466
61590
|
* (from a prior `calibrate` call), and the test inputs to predict
|
|
61467
61591
|
* for.
|
|
61468
|
-
* @
|
|
61469
|
-
*
|
|
61470
|
-
*
|
|
61471
|
-
*
|
|
61592
|
+
* @param requestOptions - Per-request transport options.
|
|
61593
|
+
* @returns Per-input prediction results in request order and the applied
|
|
61594
|
+
* parameters with `verification: 'unverified'`.
|
|
61595
|
+
*
|
|
61596
|
+
* @throws {ApiError} `400` for invalid scores, parameters, rank consistency,
|
|
61597
|
+
* or an empty or oversized test-input batch.
|
|
61598
|
+
* @remarks The request maps schema keys to snake_case and preserves class labels.
|
|
61599
|
+
* A nonempty prediction set can still be uninformative. Parameter consistency
|
|
61600
|
+
* does not establish calibration provenance or prediction correctness.
|
|
61601
|
+
* @example
|
|
61602
|
+
* ```ts
|
|
61603
|
+
* const result = await client.conformal.predict({
|
|
61604
|
+
* threshold: calibration.threshold,
|
|
61605
|
+
* alpha: calibration.alpha,
|
|
61606
|
+
* nCalibrationSamples: calibration.nSamples,
|
|
61607
|
+
* testInputs,
|
|
61608
|
+
* });
|
|
61609
|
+
* console.log(result.calibrationParameters.verification);
|
|
61610
|
+
* ```
|
|
61472
61611
|
*/
|
|
61473
61612
|
async predict(request, requestOptions) {
|
|
61474
61613
|
const response = await this.api.predict(
|