@kortexya/reasoninglayer 3.0.1 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +896 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1579 -47
- package/dist/index.d.ts +1579 -47
- package/dist/index.js +895 -43
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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 = "3.0
|
|
10
|
+
var SDK_VERSION = "3.2.0";
|
|
11
11
|
function resolveConfig(config) {
|
|
12
12
|
if (!config.baseUrl) {
|
|
13
13
|
throw new Error("ClientConfig.baseUrl is required");
|
|
@@ -167,6 +167,21 @@ var OsfqlError = class extends ApiError {
|
|
|
167
167
|
this.sortDeleteRefusal = failure.sortDeleteRefusal;
|
|
168
168
|
}
|
|
169
169
|
};
|
|
170
|
+
var NamedConstraintViolationError = class extends ApiError {
|
|
171
|
+
name = "NamedConstraintViolationError";
|
|
172
|
+
/** The feature whose constraint refused the write, when the engine names it. */
|
|
173
|
+
feature;
|
|
174
|
+
/** The constraint's name, when its author gave one. */
|
|
175
|
+
constraintName;
|
|
176
|
+
/** The constraint's message, when its author gave one. */
|
|
177
|
+
constraintMessage;
|
|
178
|
+
constructor(message, body, headers, refusal, errorCode) {
|
|
179
|
+
super(message, 422, body, headers, errorCode);
|
|
180
|
+
this.feature = refusal.feature;
|
|
181
|
+
this.constraintName = refusal.constraintName;
|
|
182
|
+
this.constraintMessage = refusal.constraintMessage;
|
|
183
|
+
}
|
|
184
|
+
};
|
|
170
185
|
var RateLimitError = class extends ApiError {
|
|
171
186
|
name = "RateLimitError";
|
|
172
187
|
/** Seconds to wait before retrying, or null if not specified. */
|
|
@@ -290,6 +305,10 @@ function createApiError(status, body, headers) {
|
|
|
290
305
|
if (rows !== null) {
|
|
291
306
|
return new BulkRefusedError(message, body, headers, rows, errorCode);
|
|
292
307
|
}
|
|
308
|
+
const named = namedConstraintRefusal(body);
|
|
309
|
+
if (named !== null) {
|
|
310
|
+
return new NamedConstraintViolationError(message, body, headers, named, errorCode);
|
|
311
|
+
}
|
|
293
312
|
return new ApiError(message, status, body, headers, errorCode);
|
|
294
313
|
}
|
|
295
314
|
case 429: {
|
|
@@ -341,7 +360,9 @@ function bulkRefusalRows(body) {
|
|
|
341
360
|
rows.push({
|
|
342
361
|
index: row.index,
|
|
343
362
|
message: row.message,
|
|
344
|
-
...typeof row.feature === "string" ? { feature: row.feature } : {}
|
|
363
|
+
...typeof row.feature === "string" ? { feature: row.feature } : {},
|
|
364
|
+
...typeof row.constraint_name === "string" ? { constraintName: row.constraint_name } : {},
|
|
365
|
+
...typeof row.constraint_message === "string" ? { constraintMessage: row.constraint_message } : {}
|
|
345
366
|
});
|
|
346
367
|
}
|
|
347
368
|
return rows.length > 0 ? rows : null;
|
|
@@ -369,6 +390,18 @@ function derivedFactRefusal(body) {
|
|
|
369
390
|
repairs
|
|
370
391
|
};
|
|
371
392
|
}
|
|
393
|
+
function namedConstraintRefusal(body) {
|
|
394
|
+
if (typeof body !== "object" || body === null) return null;
|
|
395
|
+
const obj = body;
|
|
396
|
+
const constraintName = typeof obj.constraint_name === "string" ? obj.constraint_name : void 0;
|
|
397
|
+
const constraintMessage = typeof obj.constraint_message === "string" ? obj.constraint_message : void 0;
|
|
398
|
+
if (constraintName === void 0 && constraintMessage === void 0) return null;
|
|
399
|
+
return {
|
|
400
|
+
...typeof obj.feature === "string" ? { feature: obj.feature } : {},
|
|
401
|
+
...constraintName !== void 0 ? { constraintName } : {},
|
|
402
|
+
...constraintMessage !== void 0 ? { constraintMessage } : {}
|
|
403
|
+
};
|
|
404
|
+
}
|
|
372
405
|
function isConstraintViolationBody(body) {
|
|
373
406
|
if (!isErrorBody(body)) return false;
|
|
374
407
|
if (!("details" in body)) return false;
|
|
@@ -1276,6 +1309,24 @@ var Sorts = class {
|
|
|
1276
1309
|
format: "json",
|
|
1277
1310
|
...params
|
|
1278
1311
|
});
|
|
1312
|
+
/**
|
|
1313
|
+
* @description A `Proposed` sort becomes `Active`; a sort only flagged `needs_review` has the flag cleared. Anything else is not awaiting approval (409). Requires `Manage` on the sort under a gateway policy. Separation of duties is enforced here, by the engine that holds the proposal record: the acting user (`X-Authenticated-User`) who is the sort's recorded proposer (`SortStatus::Proposed { submitted_by }`) is refused with a coded 403 (`code: "separation_of_duties"`) naming the sort, and the refusal is recorded in the oversight ledger as a `rejected` decision on the action `sort.approve.refused` (#398). The gateway checks the steward permission at the project, where the roles live.
|
|
1314
|
+
*
|
|
1315
|
+
* @tags sorts
|
|
1316
|
+
* @name ApproveSort
|
|
1317
|
+
* @summary Approve a candidate sort
|
|
1318
|
+
* @request POST:/api/v1/sorts/{id}/approve
|
|
1319
|
+
* @secure
|
|
1320
|
+
*/
|
|
1321
|
+
approveSort = (id, data, params = {}) => this.http.request({
|
|
1322
|
+
path: `/api/v1/sorts/${id}/approve`,
|
|
1323
|
+
method: "POST",
|
|
1324
|
+
body: data,
|
|
1325
|
+
secure: true,
|
|
1326
|
+
type: "application/json",
|
|
1327
|
+
format: "json",
|
|
1328
|
+
...params
|
|
1329
|
+
});
|
|
1279
1330
|
/**
|
|
1280
1331
|
* @description POST /api/v1/sorts/bulk Creates multiple sorts in a single request, automatically resolving parent references by name. Sorts are topologically sorted to ensure parents are created before children. This is much faster than individual requests for large hierarchies. # Authorization Requires X-Tenant-Id header. The tenant_id field in the request body is ignored.
|
|
1281
1332
|
*
|
|
@@ -1375,6 +1426,60 @@ var Sorts = class {
|
|
|
1375
1426
|
format: "json",
|
|
1376
1427
|
...params
|
|
1377
1428
|
});
|
|
1429
|
+
/**
|
|
1430
|
+
* @description Retires the sort, optionally in favour of a replacement (whose id or name is given), with a mandatory reason. Used both to reject a candidate after materialize and to retire an established concept.
|
|
1431
|
+
*
|
|
1432
|
+
* @tags sorts
|
|
1433
|
+
* @name DeprecateSort
|
|
1434
|
+
* @summary Deprecate (reject) a sort
|
|
1435
|
+
* @request POST:/api/v1/sorts/{id}/deprecate
|
|
1436
|
+
* @secure
|
|
1437
|
+
*/
|
|
1438
|
+
deprecateSort = (id, data, params = {}) => this.http.request({
|
|
1439
|
+
path: `/api/v1/sorts/${id}/deprecate`,
|
|
1440
|
+
method: "POST",
|
|
1441
|
+
body: data,
|
|
1442
|
+
secure: true,
|
|
1443
|
+
type: "application/json",
|
|
1444
|
+
format: "json",
|
|
1445
|
+
...params
|
|
1446
|
+
});
|
|
1447
|
+
/**
|
|
1448
|
+
* @description The steward's edit of where a concept sits: `add` and `remove` name parents by id or by name, and the sort keeps every other parent in its current order (added ones go last). The move itself is the one `PUT /api/v1/sorts/{id}/parents` runs (#292): the sort keeps its id and record, its subtree moves with it, the inherited declarations and the subsumption caches (GLB/LUB included) are repaired, and a refused move changes nothing. Requires `Manage` on the sort and on every parent added or removed under a gateway policy: a move changes who inherits access to the sort through a descendant grant. A change appends an `OversightDecision{modified}` to the audit ledger naming the reviewer. # Refused (422), with nothing changed An unknown parent, a parent to remove that is not one, an empty edit, the sort itself, a parent below the sort (a cycle), and every state the move would make contradictory (⊥): two cells of one disjoint facet, an inherited declaration no value satisfies, an own declaration weaker than a new ancestor's, a bound constraint left without its feature.
|
|
1449
|
+
*
|
|
1450
|
+
* @tags sorts
|
|
1451
|
+
* @name EditSortParents
|
|
1452
|
+
* @summary Add and remove parents of a sort
|
|
1453
|
+
* @request POST:/api/v1/sorts/{id}/parents
|
|
1454
|
+
* @secure
|
|
1455
|
+
*/
|
|
1456
|
+
editSortParents = (id, data, params = {}) => this.http.request({
|
|
1457
|
+
path: `/api/v1/sorts/${id}/parents`,
|
|
1458
|
+
method: "POST",
|
|
1459
|
+
body: data,
|
|
1460
|
+
secure: true,
|
|
1461
|
+
type: "application/json",
|
|
1462
|
+
format: "json",
|
|
1463
|
+
...params
|
|
1464
|
+
});
|
|
1465
|
+
/**
|
|
1466
|
+
* @description Formal Concept Analysis over sort × feature declaration, each declaration taken whole (name, range or type, constraint, requiredness, bound): every set of at least `min_sorts` sorts sharing at least two identical declarations is a candidate mixin. Deterministic; never writes. Accepting a proposal is creating the mixin (as a `proposed` sort) and re-parenting the members — the caller's decision: `POST /api/v1/scenarios/materialize` with the mixin and each member naming it as a parent does both, the moves going through the governed door of `POST /api/v1/sorts/{id}/parents`. A declaration a sort restates identically to an ancestor's is factored already and is never proposed again.
|
|
1467
|
+
*
|
|
1468
|
+
* @tags sorts
|
|
1469
|
+
* @name FactorSortShapes
|
|
1470
|
+
* @summary Propose mixin parents for shapes several sorts repeat unchanged
|
|
1471
|
+
* @request POST:/api/v1/sorts/discovery/factor
|
|
1472
|
+
* @secure
|
|
1473
|
+
*/
|
|
1474
|
+
factorSortShapes = (data, params = {}) => this.http.request({
|
|
1475
|
+
path: `/api/v1/sorts/discovery/factor`,
|
|
1476
|
+
method: "POST",
|
|
1477
|
+
body: data,
|
|
1478
|
+
secure: true,
|
|
1479
|
+
type: "application/json",
|
|
1480
|
+
format: "json",
|
|
1481
|
+
...params
|
|
1482
|
+
});
|
|
1378
1483
|
/**
|
|
1379
1484
|
* No description
|
|
1380
1485
|
*
|
|
@@ -1723,7 +1828,7 @@ var Sorts = class {
|
|
|
1723
1828
|
...params
|
|
1724
1829
|
});
|
|
1725
1830
|
/**
|
|
1726
|
-
* @description The body's `parents` REPLACES the sort's parent set; an empty list makes it a root. The sort keeps its id and its whole record — features, bounds, SKOS fields, annotations, status, provenance — and its subtree moves with it. Nothing is deleted and nothing is re-created. What depends on the ancestors is repaired for the sort and every subsort: the subsumption encoding, and the INHERITED feature declarations (a feature inherited from an old ancestor goes, one from a new ancestor comes; a declaration the sort makes itself is never touched). The response reports those changes, the terms whose sort now has different ancestors, and the rules naming a moved sort. The OSFQL spelling is `ALTER SORT <name> PARENTS (<parent>, …);` — the same move. # Refused, with nothing changed An unknown parent (or another tenant's), the sort itself, a parent below the sort (a cycle), a move past the depth cap, a facet violation, an own declaration weaker than a new ancestor's, a bound constraint left naming a feature a sort would stop inheriting, a declaration contradiction inherited from two new ancestors, a shared or authorization-schema sort, and a sort with more than 512 persisted subsorts. # Errors - 400 Bad Request: the move was refused; the message names the cause - 404 Not Found: no such sort for this tenant
|
|
1831
|
+
* @description The body's `parents` REPLACES the sort's parent set; an empty list makes it a root. The sort keeps its id and its whole record — features, bounds, SKOS fields, annotations, status, provenance — and its subtree moves with it. Nothing is deleted and nothing is re-created. What depends on the ancestors is repaired for the sort and every subsort: the subsumption encoding, and the INHERITED feature declarations (a feature inherited from an old ancestor goes, one from a new ancestor comes; a declaration the sort makes itself is never touched). The response reports those changes, the terms whose sort now has different ancestors, and the rules naming a moved sort. The OSFQL spelling is `ALTER SORT <name> PARENTS (<parent>, …);` — the same move. # Governed Requires `Manage` on the sort and on every parent the move adds or removes, and a move that changes anything appends an `OversightDecision{modified}` naming the reviewer — the same door `POST /sorts/{id}/parents` and OSFQL go through. # Refused, with nothing changed An unknown parent (or another tenant's), the sort itself, a parent below the sort (a cycle), a move past the depth cap, a facet violation, an own declaration weaker than a new ancestor's, a bound constraint left naming a feature a sort would stop inheriting, a declaration contradiction inherited from two new ancestors, a shared or authorization-schema sort, and a sort with more than 512 persisted subsorts. # Errors - 400 Bad Request: the move was refused; the message names the cause - 404 Not Found: no such sort for this tenant
|
|
1727
1832
|
*
|
|
1728
1833
|
* @tags sorts
|
|
1729
1834
|
* @name ReparentSort
|
|
@@ -2593,6 +2698,24 @@ var Inference = class {
|
|
|
2593
2698
|
format: "json",
|
|
2594
2699
|
...params
|
|
2595
2700
|
});
|
|
2701
|
+
/**
|
|
2702
|
+
* @description Takes the body `POST /api/v1/inference/rules` takes and runs every check that write runs — sorts and referenced terms resolve, guard bounds compare with their declared types, nested negation, binders, range restriction (every conclusion variable bound by a POSITIVE antecedent), aggregator, and the homoiconic encoding itself — by building the rule into a scratch copy of the tenant's store. Nothing is written, persisted, or propagated. Stratification included: a rule that closes a NEW cycle through negation against the existing program is refused by both (a cycle the program already had is not blamed on it). `ok` is exactly whether the write would accept the rule; `refusals` names why not, with the status the write would answer. `warnings` adds what the write accepts but the program may not mean: variables only a `NOT` mentions (NAF safety).
|
|
2703
|
+
*
|
|
2704
|
+
* @tags inference
|
|
2705
|
+
* @name ValidateRule
|
|
2706
|
+
* @summary Validate a rule without writing it
|
|
2707
|
+
* @request POST:/api/v1/inference/rules/validate
|
|
2708
|
+
* @secure
|
|
2709
|
+
*/
|
|
2710
|
+
validateRule = (data, params = {}) => this.http.request({
|
|
2711
|
+
path: `/api/v1/inference/rules/validate`,
|
|
2712
|
+
method: "POST",
|
|
2713
|
+
body: data,
|
|
2714
|
+
secure: true,
|
|
2715
|
+
type: "application/json",
|
|
2716
|
+
format: "json",
|
|
2717
|
+
...params
|
|
2718
|
+
});
|
|
2596
2719
|
};
|
|
2597
2720
|
|
|
2598
2721
|
// src/api-spec/generated/Cognitive.ts
|
|
@@ -3202,11 +3325,11 @@ var CognitiveAgentsMessaging = class {
|
|
|
3202
3325
|
* No description
|
|
3203
3326
|
*
|
|
3204
3327
|
* @tags Cognitive Agents - Messaging
|
|
3205
|
-
* @name
|
|
3328
|
+
* @name GetAgentInbox
|
|
3206
3329
|
* @summary Get an agent's inbox.
|
|
3207
3330
|
* @request POST:/api/v1/cognitive/agents/messages/inbox
|
|
3208
3331
|
*/
|
|
3209
|
-
|
|
3332
|
+
getAgentInbox = (data, params = {}) => this.http.request({
|
|
3210
3333
|
path: `/api/v1/cognitive/agents/messages/inbox`,
|
|
3211
3334
|
method: "POST",
|
|
3212
3335
|
body: data,
|
|
@@ -8721,7 +8844,7 @@ var Scenarios = class {
|
|
|
8721
8844
|
...params
|
|
8722
8845
|
});
|
|
8723
8846
|
/**
|
|
8724
|
-
* @description Materializes an already-generated GeneratedScenario verbatim (no LLM call): sorts, belief instances, rules, goal, and the ontology-declared engine pipeline. Used by the studio's build wizard to persist exactly what was reviewed so it is immediately queryable in chat.
|
|
8847
|
+
* @description Materializes an already-generated GeneratedScenario verbatim (no LLM call): sorts, belief instances, rules, goal, and the ontology-declared engine pipeline. Used by the studio's build wizard to persist exactly what was reviewed so it is immediately queryable in chat. An existing sort is reused and moved under any parent the scenario newly names for it, through the governed move of POST /sorts/{id}/parents; a refused move is reported in `warnings` and leaves the sort where it was.
|
|
8725
8848
|
*
|
|
8726
8849
|
* @tags scenarios
|
|
8727
8850
|
* @name MaterializeScenario
|
|
@@ -9326,7 +9449,7 @@ var Synthetic = class {
|
|
|
9326
9449
|
...params
|
|
9327
9450
|
});
|
|
9328
9451
|
/**
|
|
9329
|
-
* @description Uses principled strategies to create training examples that are negative (invalid) for specific, documented reasons: sort incompatibility, feature perturbation, cross-sort confusion, missing required features, and feature type mismatch. # Authorization Requires X-Tenant-Id header for tenant-scoped operations.
|
|
9452
|
+
* @description Uses principled strategies to create training examples that are negative (invalid) for specific, documented reasons: a violation of each declared feature constraint (named in `violated_constraint`), sort incompatibility, feature perturbation, cross-sort confusion, missing required features, and feature type mismatch. Proposed sorts are included — negatives exist to test a model before it is approved; deprecated sorts are not. # Authorization Requires X-Tenant-Id header for tenant-scoped operations.
|
|
9330
9453
|
*
|
|
9331
9454
|
* @tags synthetic
|
|
9332
9455
|
* @name GenerateNegatives
|
|
@@ -10225,6 +10348,23 @@ var Ontology = class {
|
|
|
10225
10348
|
format: "json",
|
|
10226
10349
|
...params
|
|
10227
10350
|
});
|
|
10351
|
+
/**
|
|
10352
|
+
* @description The fluent term about `of` with the latest `valid_from` not after `at` (default: now). 404 when the sort is unknown or no state is recorded by then.
|
|
10353
|
+
*
|
|
10354
|
+
* @tags ontology
|
|
10355
|
+
* @name CurrentFluentValue
|
|
10356
|
+
* @summary Current value of a fluent
|
|
10357
|
+
* @request GET:/api/v1/fluents/current
|
|
10358
|
+
* @secure
|
|
10359
|
+
*/
|
|
10360
|
+
currentFluentValue = (query, params = {}) => this.http.request({
|
|
10361
|
+
path: `/api/v1/fluents/current`,
|
|
10362
|
+
method: "GET",
|
|
10363
|
+
query,
|
|
10364
|
+
secure: true,
|
|
10365
|
+
format: "json",
|
|
10366
|
+
...params
|
|
10367
|
+
});
|
|
10228
10368
|
/**
|
|
10229
10369
|
* No description
|
|
10230
10370
|
*
|
|
@@ -10277,6 +10417,22 @@ var Ontology = class {
|
|
|
10277
10417
|
format: "json",
|
|
10278
10418
|
...params
|
|
10279
10419
|
});
|
|
10420
|
+
/**
|
|
10421
|
+
* No description
|
|
10422
|
+
*
|
|
10423
|
+
* @tags ontology
|
|
10424
|
+
* @name GetOntologyScope
|
|
10425
|
+
* @summary Read the ontology's scope.
|
|
10426
|
+
* @request GET:/api/v1/ontology/scope
|
|
10427
|
+
* @secure
|
|
10428
|
+
*/
|
|
10429
|
+
getOntologyScope = (params = {}) => this.http.request({
|
|
10430
|
+
path: `/api/v1/ontology/scope`,
|
|
10431
|
+
method: "GET",
|
|
10432
|
+
secure: true,
|
|
10433
|
+
format: "json",
|
|
10434
|
+
...params
|
|
10435
|
+
});
|
|
10280
10436
|
/**
|
|
10281
10437
|
* No description
|
|
10282
10438
|
*
|
|
@@ -10325,6 +10481,24 @@ var Ontology = class {
|
|
|
10325
10481
|
format: "json",
|
|
10326
10482
|
...params
|
|
10327
10483
|
});
|
|
10484
|
+
/**
|
|
10485
|
+
* No description
|
|
10486
|
+
*
|
|
10487
|
+
* @tags ontology
|
|
10488
|
+
* @name PutOntologyScope
|
|
10489
|
+
* @summary Set the ontology's scope (replaces it).
|
|
10490
|
+
* @request PUT:/api/v1/ontology/scope
|
|
10491
|
+
* @secure
|
|
10492
|
+
*/
|
|
10493
|
+
putOntologyScope = (data, params = {}) => this.http.request({
|
|
10494
|
+
path: `/api/v1/ontology/scope`,
|
|
10495
|
+
method: "PUT",
|
|
10496
|
+
body: data,
|
|
10497
|
+
secure: true,
|
|
10498
|
+
type: "application/json",
|
|
10499
|
+
format: "json",
|
|
10500
|
+
...params
|
|
10501
|
+
});
|
|
10328
10502
|
/**
|
|
10329
10503
|
* No description
|
|
10330
10504
|
*
|
|
@@ -10343,6 +10517,19 @@ var Ontology = class {
|
|
|
10343
10517
|
format: "json",
|
|
10344
10518
|
...params
|
|
10345
10519
|
});
|
|
10520
|
+
/**
|
|
10521
|
+
* No description
|
|
10522
|
+
*
|
|
10523
|
+
* @tags ontology
|
|
10524
|
+
* @name UpperOntology
|
|
10525
|
+
* @summary Serve an embedded upper-ontology seed (`bfo-2020` or `cco-facility`) — the same OWL the lattice-grounding aligner uses, offered to the guided builder's vocabulary stage as an anchor to reuse rather than reinvent.
|
|
10526
|
+
* @request GET:/api/v1/ontology/upper/{name}
|
|
10527
|
+
*/
|
|
10528
|
+
upperOntology = (name, params = {}) => this.http.request({
|
|
10529
|
+
path: `/api/v1/ontology/upper/${name}`,
|
|
10530
|
+
method: "GET",
|
|
10531
|
+
...params
|
|
10532
|
+
});
|
|
10346
10533
|
};
|
|
10347
10534
|
|
|
10348
10535
|
// src/api-spec/generated/Generation.ts
|
|
@@ -13632,6 +13819,31 @@ var OntologyExport = class {
|
|
|
13632
13819
|
});
|
|
13633
13820
|
};
|
|
13634
13821
|
|
|
13822
|
+
// src/api-spec/generated/Argumentation.ts
|
|
13823
|
+
var Argumentation = class {
|
|
13824
|
+
http;
|
|
13825
|
+
constructor(http) {
|
|
13826
|
+
this.http = http;
|
|
13827
|
+
}
|
|
13828
|
+
/**
|
|
13829
|
+
* No description
|
|
13830
|
+
*
|
|
13831
|
+
* @tags argumentation
|
|
13832
|
+
* @name EvaluateArgumentation
|
|
13833
|
+
* @request POST:/api/v1/argumentation/evaluate
|
|
13834
|
+
* @secure
|
|
13835
|
+
*/
|
|
13836
|
+
evaluateArgumentation = (data, params = {}) => this.http.request({
|
|
13837
|
+
path: `/api/v1/argumentation/evaluate`,
|
|
13838
|
+
method: "POST",
|
|
13839
|
+
body: data,
|
|
13840
|
+
secure: true,
|
|
13841
|
+
type: "application/json",
|
|
13842
|
+
format: "json",
|
|
13843
|
+
...params
|
|
13844
|
+
});
|
|
13845
|
+
};
|
|
13846
|
+
|
|
13635
13847
|
// src/api-spec/generated/Embeddings.ts
|
|
13636
13848
|
var Embeddings = class {
|
|
13637
13849
|
http;
|
|
@@ -15088,7 +15300,9 @@ function BulkRowRefusalFromApiToFront(dto) {
|
|
|
15088
15300
|
return {
|
|
15089
15301
|
index: dto.index,
|
|
15090
15302
|
message: dto.message,
|
|
15091
|
-
...dto.feature ? { feature: dto.feature } : {}
|
|
15303
|
+
...dto.feature ? { feature: dto.feature } : {},
|
|
15304
|
+
...dto.constraint_name != null ? { constraintName: dto.constraint_name } : {},
|
|
15305
|
+
...dto.constraint_message != null ? { constraintMessage: dto.constraint_message } : {}
|
|
15092
15306
|
};
|
|
15093
15307
|
}
|
|
15094
15308
|
function ClearTermsResponseFromApiToFront(dto) {
|
|
@@ -15204,6 +15418,7 @@ function TermVersionDtoFromApiToFront(dto) {
|
|
|
15204
15418
|
if (dto.diff != null) out.diff = VersionDiffDtoFromApiToFront(dto.diff);
|
|
15205
15419
|
if (dto.follows_a_gap !== void 0) out.followsAGap = dto.follows_a_gap;
|
|
15206
15420
|
if (dto.forked_to != null) out.forkedTo = dto.forked_to;
|
|
15421
|
+
if (dto.seeded !== void 0) out.seeded = dto.seeded;
|
|
15207
15422
|
return out;
|
|
15208
15423
|
}
|
|
15209
15424
|
function TermVersionsResponseFromApiToFront(dto) {
|
|
@@ -15244,6 +15459,8 @@ function ConstraintDtoFromFrontToApi(model) {
|
|
|
15244
15459
|
function FeatureDescriptorDtoFromApiToFront(dto) {
|
|
15245
15460
|
return {
|
|
15246
15461
|
name: dto.name,
|
|
15462
|
+
description: dto.description ?? void 0,
|
|
15463
|
+
index: dto.index ?? void 0,
|
|
15247
15464
|
expectedSort: dto.expected_sort ?? void 0,
|
|
15248
15465
|
expectedTypeHint: dto.expected_type_hint ?? void 0,
|
|
15249
15466
|
// The spec made this optional and documents the default explicitly:
|
|
@@ -15254,31 +15471,33 @@ function FeatureDescriptorDtoFromApiToFront(dto) {
|
|
|
15254
15471
|
// `undefined` for a question the wire already answers.
|
|
15255
15472
|
required: dto.required ?? false,
|
|
15256
15473
|
constraint: dto.constraint ? ConstraintDtoFromApiToFront(dto.constraint) : void 0,
|
|
15474
|
+
constraintName: dto.constraint_name ?? void 0,
|
|
15475
|
+
constraintMessage: dto.constraint_message ?? void 0,
|
|
15257
15476
|
key: dto.key,
|
|
15258
15477
|
expectedSortName: dto.expected_sort_name ?? void 0,
|
|
15259
15478
|
minCount: dto.min_count ?? void 0,
|
|
15260
15479
|
maxCount: dto.max_count ?? void 0,
|
|
15261
15480
|
cardinalityOrigin: dto.cardinality_origin ?? void 0,
|
|
15262
|
-
annotations: definedRecord2(dto.annotations)
|
|
15263
|
-
description: dto.description ?? void 0,
|
|
15264
|
-
index: dto.index ?? void 0
|
|
15481
|
+
annotations: definedRecord2(dto.annotations)
|
|
15265
15482
|
};
|
|
15266
15483
|
}
|
|
15267
15484
|
function FeatureDescriptorDtoFromFrontToApi(model) {
|
|
15268
15485
|
return {
|
|
15269
15486
|
name: model.name,
|
|
15487
|
+
description: model.description ?? void 0,
|
|
15488
|
+
index: model.index ?? void 0,
|
|
15270
15489
|
expected_sort: model.expectedSort ?? void 0,
|
|
15271
15490
|
expected_type_hint: model.expectedTypeHint ?? void 0,
|
|
15272
15491
|
required: model.required,
|
|
15273
15492
|
constraint: model.constraint ? ConstraintDtoFromFrontToApi(model.constraint) : void 0,
|
|
15493
|
+
constraint_name: model.constraintName ?? void 0,
|
|
15494
|
+
constraint_message: model.constraintMessage ?? void 0,
|
|
15274
15495
|
key: model.key,
|
|
15275
15496
|
expected_sort_name: model.expectedSortName ?? void 0,
|
|
15276
15497
|
min_count: model.minCount ?? void 0,
|
|
15277
15498
|
max_count: model.maxCount ?? void 0,
|
|
15278
15499
|
cardinality_origin: model.cardinalityOrigin ?? void 0,
|
|
15279
|
-
annotations: model.annotations
|
|
15280
|
-
description: model.description ?? void 0,
|
|
15281
|
-
index: model.index ?? void 0
|
|
15500
|
+
annotations: model.annotations
|
|
15282
15501
|
};
|
|
15283
15502
|
}
|
|
15284
15503
|
function CoextensiveDefinitionDtoFromApiToFront(dto) {
|
|
@@ -15385,6 +15604,12 @@ function SortInfoDtoFromApiToFront(dto) {
|
|
|
15385
15604
|
name: dto.name ?? void 0
|
|
15386
15605
|
};
|
|
15387
15606
|
}
|
|
15607
|
+
function SortResponseFromApiToFront(dto) {
|
|
15608
|
+
return {
|
|
15609
|
+
sort: SortDtoFromApiToFront(dto.sort),
|
|
15610
|
+
wokenResiduations: dto.woken_residuations ?? void 0
|
|
15611
|
+
};
|
|
15612
|
+
}
|
|
15388
15613
|
function SortListResponseFromApiToFront(dto) {
|
|
15389
15614
|
return {
|
|
15390
15615
|
sorts: dto.sorts.map(SortDtoFromApiToFront),
|
|
@@ -15723,11 +15948,38 @@ function SortIndexStatusResponseFromApiToFront(dto) {
|
|
|
15723
15948
|
if (dto.last_indexed_count != null) out.lastIndexedCount = dto.last_indexed_count;
|
|
15724
15949
|
return out;
|
|
15725
15950
|
}
|
|
15726
|
-
function
|
|
15727
|
-
const out = {
|
|
15951
|
+
function ApproveSortRequestFromFrontToApi(model) {
|
|
15952
|
+
const out = {};
|
|
15728
15953
|
if (model.reason !== void 0) out.reason = model.reason;
|
|
15729
15954
|
return out;
|
|
15730
15955
|
}
|
|
15956
|
+
function DeprecateSortRequestFromFrontToApi(model) {
|
|
15957
|
+
const out = { reason: model.reason };
|
|
15958
|
+
if (model.replacement !== void 0) out.replacement = model.replacement;
|
|
15959
|
+
return out;
|
|
15960
|
+
}
|
|
15961
|
+
function FactorSortsRequestFromFrontToApi(model) {
|
|
15962
|
+
const out = {};
|
|
15963
|
+
if (model.sortIds !== void 0) out.sort_ids = model.sortIds;
|
|
15964
|
+
if (model.minSorts !== void 0) out.min_sorts = model.minSorts;
|
|
15965
|
+
return out;
|
|
15966
|
+
}
|
|
15967
|
+
function FactorSharedFeatureFromApiToFront(dto) {
|
|
15968
|
+
const out = { name: dto.name, required: dto.required };
|
|
15969
|
+
if (dto.expected_sort != null) out.expectedSort = dto.expected_sort;
|
|
15970
|
+
if (dto.expected_type_hint != null) out.expectedTypeHint = dto.expected_type_hint;
|
|
15971
|
+
if (dto.constraint != null) out.constraint = ConstraintDtoFromApiToFront(dto.constraint);
|
|
15972
|
+
return out;
|
|
15973
|
+
}
|
|
15974
|
+
function FactorSortsResponseFromApiToFront(dto) {
|
|
15975
|
+
return {
|
|
15976
|
+
proposals: dto.proposals.map((p) => ({
|
|
15977
|
+
memberSorts: p.member_sorts.map((m) => ({ id: m.id, name: m.name })),
|
|
15978
|
+
sharedFeatures: p.shared_features.map(FactorSharedFeatureFromApiToFront),
|
|
15979
|
+
suggestedName: p.suggested_name
|
|
15980
|
+
}))
|
|
15981
|
+
};
|
|
15982
|
+
}
|
|
15731
15983
|
function PatchSortRequestFromFrontToApi(model) {
|
|
15732
15984
|
const out = {};
|
|
15733
15985
|
if (model.name !== void 0) out.name = model.name;
|
|
@@ -15739,10 +15991,6 @@ function PatchSortRequestFromFrontToApi(model) {
|
|
|
15739
15991
|
if (model.scopeNote !== void 0) out.scope_note = model.scopeNote;
|
|
15740
15992
|
if (model.annotations !== void 0) out.annotations = model.annotations;
|
|
15741
15993
|
if (model.worldMode !== void 0) out.world_mode = model.worldMode;
|
|
15742
|
-
if (model.approveProposed !== void 0) out.approve_proposed = model.approveProposed;
|
|
15743
|
-
if (model.deprecate !== void 0) {
|
|
15744
|
-
out.deprecate = model.deprecate === null ? null : DeprecateSortRequestFromFrontToApi(model.deprecate);
|
|
15745
|
-
}
|
|
15746
15994
|
return out;
|
|
15747
15995
|
}
|
|
15748
15996
|
function DeleteSortOptionsFromFrontToApi(options) {
|
|
@@ -15765,6 +16013,14 @@ function DeleteSortResponseFromApiToFront(dto) {
|
|
|
15765
16013
|
if (dto.rules_orphaned !== void 0) {
|
|
15766
16014
|
out.rulesOrphaned = dto.rules_orphaned.map(SortReferencingRuleDtoFromApiToFront);
|
|
15767
16015
|
}
|
|
16016
|
+
if (dto.sorts_deleted !== void 0) out.sortsDeleted = dto.sorts_deleted;
|
|
16017
|
+
return out;
|
|
16018
|
+
}
|
|
16019
|
+
function EditSortParentsRequestFromFrontToApi(model) {
|
|
16020
|
+
const out = {};
|
|
16021
|
+
if (model.add !== void 0) out.add = model.add;
|
|
16022
|
+
if (model.remove !== void 0) out.remove = model.remove;
|
|
16023
|
+
if (model.reason !== void 0) out.reason = model.reason;
|
|
15768
16024
|
return out;
|
|
15769
16025
|
}
|
|
15770
16026
|
function SortReferencingRuleDtoFromApiToFront(dto) {
|
|
@@ -15932,8 +16188,8 @@ var SortsClient = class {
|
|
|
15932
16188
|
return SortDtoFromApiToFront(response.data.sort);
|
|
15933
16189
|
}
|
|
15934
16190
|
/**
|
|
15935
|
-
* Curate a sort's vocabulary
|
|
15936
|
-
*
|
|
16191
|
+
* Curate a sort's vocabulary: rename, describe, label, relate, annotate it,
|
|
16192
|
+
* or change its world mode.
|
|
15937
16193
|
*
|
|
15938
16194
|
* @param sortId - Sort UUID.
|
|
15939
16195
|
* @param request - The fields to change. Only present fields mutate.
|
|
@@ -15970,6 +16226,109 @@ var SortsClient = class {
|
|
|
15970
16226
|
);
|
|
15971
16227
|
return SortDtoFromApiToFront(response.data.sort);
|
|
15972
16228
|
}
|
|
16229
|
+
/**
|
|
16230
|
+
* Approve a candidate sort: promote it from `Proposed` to `Active`.
|
|
16231
|
+
*
|
|
16232
|
+
* @param sortId - Sort UUID.
|
|
16233
|
+
* @param request - Optionally, why the steward accepted it.
|
|
16234
|
+
* @returns The approved sort, and how much suspended work its declaration
|
|
16235
|
+
* released (`wokenResiduations`).
|
|
16236
|
+
* @throws {ForbiddenError} 403 when the caller holds no Manage grant on the
|
|
16237
|
+
* sort, or — with `code: "separation_of_duties"` in the body (see
|
|
16238
|
+
* `SortApprovalErrorCode`; read it with `errorBodyCode`) — when the
|
|
16239
|
+
* acting user (`authenticatedUser`) is the sort's recorded proposer.
|
|
16240
|
+
* Another steward can approve it.
|
|
16241
|
+
* @throws {NotFoundError} 404 when the sort does not exist.
|
|
16242
|
+
* @throws {ApiError} 409 when the sort is not awaiting approval.
|
|
16243
|
+
*
|
|
16244
|
+
* @remarks
|
|
16245
|
+
* Appends an approval decision to the compliance ledger, with the
|
|
16246
|
+
* authenticated user as reviewer. This replaced `approveProposed` on
|
|
16247
|
+
* {@link SortsClient.patchSort}, which the engine now refuses.
|
|
16248
|
+
*
|
|
16249
|
+
* Separation of duties is enforced by the engine: the proposer's own
|
|
16250
|
+
* approval is refused with the coded 403 and recorded in the oversight
|
|
16251
|
+
* ledger as a `rejected` decision on `sort.approve.refused`.
|
|
16252
|
+
*
|
|
16253
|
+
* @example
|
|
16254
|
+
* ```typescript
|
|
16255
|
+
* try {
|
|
16256
|
+
* const { sort, wokenResiduations } = await client.sorts.approveSort(sortId, {
|
|
16257
|
+
* reason: 'Matches the order lifecycle use case',
|
|
16258
|
+
* });
|
|
16259
|
+
* } catch (error) {
|
|
16260
|
+
* if (errorBodyCode(error) === 'separation_of_duties') {
|
|
16261
|
+
* // The acting user proposed this sort: ask another steward to approve it.
|
|
16262
|
+
* }
|
|
16263
|
+
* }
|
|
16264
|
+
* ```
|
|
16265
|
+
*/
|
|
16266
|
+
async approveSort(sortId, request = {}, requestOptions) {
|
|
16267
|
+
const response = await this.sorts.approveSort(
|
|
16268
|
+
sortId,
|
|
16269
|
+
ApproveSortRequestFromFrontToApi(request),
|
|
16270
|
+
toRequestParams(requestOptions)
|
|
16271
|
+
);
|
|
16272
|
+
return SortResponseFromApiToFront(response.data);
|
|
16273
|
+
}
|
|
16274
|
+
/**
|
|
16275
|
+
* Deprecate a sort: reject a candidate, or retire an active concept,
|
|
16276
|
+
* optionally in favour of a replacement.
|
|
16277
|
+
*
|
|
16278
|
+
* @param sortId - Sort UUID.
|
|
16279
|
+
* @param request - Why (required), and the replacement's id or name.
|
|
16280
|
+
* @returns The deprecated sort.
|
|
16281
|
+
* @throws {BadRequestError} 400 when `reason` is empty or the replacement does not exist.
|
|
16282
|
+
* @throws {ForbiddenError} 403 when the caller holds no Manage grant on the sort.
|
|
16283
|
+
* @throws {NotFoundError} 404 when the sort does not exist.
|
|
16284
|
+
*
|
|
16285
|
+
* @remarks
|
|
16286
|
+
* Appends a rejection decision to the compliance ledger. `replacement`
|
|
16287
|
+
* accepts a sort id or a sort name in this tenant. This replaced the
|
|
16288
|
+
* `deprecate` arm of {@link SortsClient.patchSort}, which the engine now
|
|
16289
|
+
* refuses.
|
|
16290
|
+
*
|
|
16291
|
+
* @example
|
|
16292
|
+
* ```typescript
|
|
16293
|
+
* await client.sorts.deprecateSort(sortId, {
|
|
16294
|
+
* reason: 'Duplicate of customer',
|
|
16295
|
+
* replacement: 'customer',
|
|
16296
|
+
* });
|
|
16297
|
+
* ```
|
|
16298
|
+
*/
|
|
16299
|
+
async deprecateSort(sortId, request, requestOptions) {
|
|
16300
|
+
const response = await this.sorts.deprecateSort(
|
|
16301
|
+
sortId,
|
|
16302
|
+
DeprecateSortRequestFromFrontToApi(request),
|
|
16303
|
+
toRequestParams(requestOptions)
|
|
16304
|
+
);
|
|
16305
|
+
return SortResponseFromApiToFront(response.data);
|
|
16306
|
+
}
|
|
16307
|
+
/**
|
|
16308
|
+
* Propose mixin parents for feature shapes several sorts repeat unchanged.
|
|
16309
|
+
*
|
|
16310
|
+
* @param request - Which sorts to analyse (default: all), and the least
|
|
16311
|
+
* number of sorts a proposal must cover (default and floor: 2).
|
|
16312
|
+
* @returns Candidate parents, most shared declarations first.
|
|
16313
|
+
* @throws {ApiError} If the request fails.
|
|
16314
|
+
*
|
|
16315
|
+
* @remarks
|
|
16316
|
+
* Deterministic and read-only: it groups sorts over identical feature +
|
|
16317
|
+
* constraint declarations. `suggestedName` is a placeholder to rename
|
|
16318
|
+
* before creating the parent.
|
|
16319
|
+
*
|
|
16320
|
+
* @example
|
|
16321
|
+
* ```typescript
|
|
16322
|
+
* const { proposals } = await client.sorts.factorSorts({ minSorts: 3 });
|
|
16323
|
+
* ```
|
|
16324
|
+
*/
|
|
16325
|
+
async factorSorts(request = {}, requestOptions) {
|
|
16326
|
+
const response = await this.sorts.factorSortShapes(
|
|
16327
|
+
FactorSortsRequestFromFrontToApi(request),
|
|
16328
|
+
toRequestParams(requestOptions)
|
|
16329
|
+
);
|
|
16330
|
+
return FactorSortsResponseFromApiToFront(response.data);
|
|
16331
|
+
}
|
|
15973
16332
|
/**
|
|
15974
16333
|
* Delete a sort by ID.
|
|
15975
16334
|
*
|
|
@@ -16081,6 +16440,47 @@ var SortsClient = class {
|
|
|
16081
16440
|
);
|
|
16082
16441
|
return SortDeletePreviewResponseFromApiToFront(response.data);
|
|
16083
16442
|
}
|
|
16443
|
+
/**
|
|
16444
|
+
* Add and remove parents of a sort — a steward's governed move in the lattice.
|
|
16445
|
+
*
|
|
16446
|
+
* @param sortId - Sort UUID.
|
|
16447
|
+
* @param request - Parents to add and to remove (by id or by name), and why.
|
|
16448
|
+
* @returns The move's report — what moved, what each sort's inheritance
|
|
16449
|
+
* gained and lost, the terms and rules concerned — with the sort as it now
|
|
16450
|
+
* stands.
|
|
16451
|
+
* @throws {ForbiddenError} 403 without `Manage` on the sort and on every
|
|
16452
|
+
* parent added or removed.
|
|
16453
|
+
* @throws {NotFoundError} 404 when the sort does not exist.
|
|
16454
|
+
* @throws {ApiError} 422, with nothing changed, for an unknown parent, a
|
|
16455
|
+
* parent to remove that is not one, an empty edit, the sort itself, a
|
|
16456
|
+
* parent below the sort (a cycle), or any state the move would make
|
|
16457
|
+
* contradictory (⊥).
|
|
16458
|
+
*
|
|
16459
|
+
* @remarks
|
|
16460
|
+
* The sort keeps every other parent in its current order; added ones go last.
|
|
16461
|
+
* The move is the one {@link SortsClient.reparentSort} runs: the sort keeps
|
|
16462
|
+
* its id and record, its subtree moves with it, inherited declarations and
|
|
16463
|
+
* the subsumption caches are repaired. A change appends an oversight
|
|
16464
|
+
* decision to the audit ledger naming the reviewer.
|
|
16465
|
+
*
|
|
16466
|
+
* @example
|
|
16467
|
+
* ```typescript
|
|
16468
|
+
* const moved = await client.sorts.editSortParents(sortId, {
|
|
16469
|
+
* add: ['vehicle'],
|
|
16470
|
+
* remove: ['thing'],
|
|
16471
|
+
* reason: 'A truck is a vehicle',
|
|
16472
|
+
* });
|
|
16473
|
+
* console.log(moved.inheritanceChanges);
|
|
16474
|
+
* ```
|
|
16475
|
+
*/
|
|
16476
|
+
async editSortParents(sortId, request, requestOptions) {
|
|
16477
|
+
const response = await this.sorts.editSortParents(
|
|
16478
|
+
sortId,
|
|
16479
|
+
EditSortParentsRequestFromFrontToApi(request),
|
|
16480
|
+
toRequestParams(requestOptions)
|
|
16481
|
+
);
|
|
16482
|
+
return SortReparentResponseFromApiToFront(response.data);
|
|
16483
|
+
}
|
|
16084
16484
|
/**
|
|
16085
16485
|
* Move a sort in the lattice: replace its parent set.
|
|
16086
16486
|
*
|
|
@@ -17938,6 +18338,21 @@ function ResidualDerivationDtoFromApiToFront(dto) {
|
|
|
17938
18338
|
function AddRuleResponseFromApiToFront(dto) {
|
|
17939
18339
|
return { term: PsiTermDtoFromApiToFront(dto.term) };
|
|
17940
18340
|
}
|
|
18341
|
+
function RuleValidationResponseFromApiToFront(dto) {
|
|
18342
|
+
const issue = (i) => ({
|
|
18343
|
+
kind: i.kind,
|
|
18344
|
+
message: i.message,
|
|
18345
|
+
...i.status != null ? { status: i.status } : {}
|
|
18346
|
+
});
|
|
18347
|
+
const out = {
|
|
18348
|
+
ok: dto.ok,
|
|
18349
|
+
refusals: dto.refusals.map(issue),
|
|
18350
|
+
warnings: dto.warnings.map(issue)
|
|
18351
|
+
};
|
|
18352
|
+
if (dto.rule !== void 0)
|
|
18353
|
+
out.rule = dto.rule === null ? null : PsiTermDtoFromApiToFront(dto.rule);
|
|
18354
|
+
return out;
|
|
18355
|
+
}
|
|
17941
18356
|
function AddFactResponseFromApiToFront(dto) {
|
|
17942
18357
|
return { term: PsiTermDtoFromApiToFront(dto.term) };
|
|
17943
18358
|
}
|
|
@@ -18483,7 +18898,8 @@ function RuleTermDraftDtoFromApiToFront(dto) {
|
|
|
18483
18898
|
// The engine types each value as a scalar (`RuleDraftFeatureValueDto`) and
|
|
18484
18899
|
// refuses a draft carrying anything else, so the map passes through; only
|
|
18485
18900
|
// the generated `Partial` is narrowed to a total record.
|
|
18486
|
-
features: definedRecordOrNullish(dto.features)
|
|
18901
|
+
features: definedRecordOrNullish(dto.features),
|
|
18902
|
+
...dto.negated === true ? { negated: true } : {}
|
|
18487
18903
|
};
|
|
18488
18904
|
}
|
|
18489
18905
|
function RuleDraftDtoFromApiToFront(dto) {
|
|
@@ -18557,11 +18973,23 @@ var InferenceClient = class {
|
|
|
18557
18973
|
* @param request - Rule definition using TermInputDto. Set `aggregator` to declare an
|
|
18558
18974
|
* engine-side head aggregator (see {@link RuleAggregatorDto}).
|
|
18559
18975
|
* @returns The created rule wrapped in an AddRuleResponse.
|
|
18560
|
-
* @throws {ApiError} If the rule is rejected or the request fails
|
|
18976
|
+
* @throws {ApiError} If the rule is rejected or the request fails — 422 when
|
|
18977
|
+
* it is unusable as written: a head or body antecedent naming a sort or
|
|
18978
|
+
* term that does not exist (the message names it and its position — `the
|
|
18979
|
+
* head (conclusion)` or `body antecedent N`), a guard bound the declared
|
|
18980
|
+
* type cannot compare, a binder on the conclusion, or a rule that closes a
|
|
18981
|
+
* NEW cycle through negation (no stratification would order the program; a
|
|
18982
|
+
* cycle the program already had is not blamed on it). The refusal is a
|
|
18983
|
+
* plain {@link ApiError} with `status` 422 — not a `BadRequestError`
|
|
18984
|
+
* (earlier engines answered an unknown head sort with 400), and not a
|
|
18985
|
+
* `NamedConstraintViolationError`, which is reserved for a feature
|
|
18986
|
+
* constraint's refusal.
|
|
18561
18987
|
*
|
|
18562
18988
|
* @remarks
|
|
18563
18989
|
* **Serialization format**: untagged `TermInputDto` / `FeatureInputValueDto`.
|
|
18564
18990
|
*
|
|
18991
|
+
* Ask {@link InferenceClient.validateRule} first to learn every reason the
|
|
18992
|
+
* write would refuse, without writing.
|
|
18565
18993
|
* A `{ termId }` reference to a term that is durable but not yet loaded
|
|
18566
18994
|
* into the engine process resolves: the route loads the terms the request
|
|
18567
18995
|
* names before it converts them.
|
|
@@ -18588,6 +19016,45 @@ var InferenceClient = class {
|
|
|
18588
19016
|
);
|
|
18589
19017
|
return AddRuleResponseFromApiToFront(response.data);
|
|
18590
19018
|
}
|
|
19019
|
+
/**
|
|
19020
|
+
* Run every check {@link InferenceClient.addRule} runs — without writing.
|
|
19021
|
+
*
|
|
19022
|
+
* @param request - The same rule `addRule` takes.
|
|
19023
|
+
* @returns Whether the write would accept it (`ok`), every refusal with the
|
|
19024
|
+
* status the write would answer, the NAF-safety warnings, and the rule as
|
|
19025
|
+
* the write would build it.
|
|
19026
|
+
* @throws {ApiError} If the request itself fails.
|
|
19027
|
+
*
|
|
19028
|
+
* @remarks
|
|
19029
|
+
* The rule is built into a scratch copy of the tenant's store: sorts and
|
|
19030
|
+
* referenced terms resolve, guard bounds compare with their declared types,
|
|
19031
|
+
* nested negation, binders, range restriction, the aggregator, the
|
|
19032
|
+
* homoiconic encoding, and stratification (a NEW cycle through negation is
|
|
19033
|
+
* an `unstratifiable` refusal). Nothing is written, persisted or propagated.
|
|
19034
|
+
* **Serialization format**: untagged `TermInputDto` / `FeatureInputValueDto`.
|
|
19035
|
+
*
|
|
19036
|
+
* @example
|
|
19037
|
+
* ```typescript
|
|
19038
|
+
* const check = await client.inference.validateRule({
|
|
19039
|
+
* term: psi('adult', { name: Var('N') }),
|
|
19040
|
+
* antecedents: [psi('person', { name: Var('N') })],
|
|
19041
|
+
* });
|
|
19042
|
+
* if (!check.ok) for (const r of check.refusals) console.warn(r.kind, r.message);
|
|
19043
|
+
* ```
|
|
19044
|
+
*/
|
|
19045
|
+
async validateRule(request, requestOptions) {
|
|
19046
|
+
const wireRequest = {
|
|
19047
|
+
term: convertTermArg(request.term),
|
|
19048
|
+
antecedents: request.antecedents?.map(convertTermArg),
|
|
19049
|
+
certainty: request.certainty,
|
|
19050
|
+
aggregator: request.aggregator
|
|
19051
|
+
};
|
|
19052
|
+
const response = await this.api.validateRule(
|
|
19053
|
+
AddRuleRequestFromFrontToApi(wireRequest),
|
|
19054
|
+
toRequestParams(requestOptions)
|
|
19055
|
+
);
|
|
19056
|
+
return RuleValidationResponseFromApiToFront(response.data);
|
|
19057
|
+
}
|
|
18591
19058
|
/**
|
|
18592
19059
|
* Add a fact.
|
|
18593
19060
|
*
|
|
@@ -18624,7 +19091,9 @@ var InferenceClient = class {
|
|
|
18624
19091
|
* its index in `request.rules`, with the engine's reason (for example
|
|
18625
19092
|
* `rule head term did not resolve: it names sort \`x\`, which this
|
|
18626
19093
|
* tenant's sort hierarchy does not define`). `rulesAdded` plus
|
|
18627
|
-
* `rejected.length` equals the number submitted.
|
|
19094
|
+
* `rejected.length` equals the number submitted. A rule that closes a NEW
|
|
19095
|
+
* cycle through negation is refused the same way (the reason names the
|
|
19096
|
+
* cycle's sorts), decided for every row before any row is written.
|
|
18628
19097
|
*
|
|
18629
19098
|
* @example
|
|
18630
19099
|
* ```typescript
|
|
@@ -19164,7 +19633,10 @@ var InferenceClient = class {
|
|
|
19164
19633
|
* `{"type": "String", "value": "..."}` envelope. The engine refuses a model answer that
|
|
19165
19634
|
* carries one, re-prompts, and answers 422 when the model keeps producing it. Each
|
|
19166
19635
|
* {@link RuleTermDraftDto} maps directly onto a `TermInputDto` inline-by-sort-name
|
|
19167
|
-
* term, so an approved draft can be handed straight to {@link addRule}
|
|
19636
|
+
* term, so an approved draft can be handed straight to {@link addRule} — except an
|
|
19637
|
+
* antecedent with `negated: true`, which must be wrapped in the `negation` carrier
|
|
19638
|
+
* (`not(psi(sortName, features))`); sent bare, it would assert the positive
|
|
19639
|
+
* condition.
|
|
19168
19640
|
*
|
|
19169
19641
|
* Drafting is multi-turn: if `status` is `'needs_clarification'`, answer each question
|
|
19170
19642
|
* and call again with the echoed `sessionId` and an `answers` map keyed by the question's
|
|
@@ -19407,6 +19879,7 @@ function NlQueryRequestFromFrontToApi(model) {
|
|
|
19407
19879
|
mode: model.mode,
|
|
19408
19880
|
tenant_id: model.tenantId,
|
|
19409
19881
|
conversation_history: model.conversationHistory ?? void 0,
|
|
19882
|
+
focus_sorts: model.focusSorts ?? void 0,
|
|
19410
19883
|
session_id: model.sessionId ?? void 0,
|
|
19411
19884
|
exclude_domains: model.excludeDomains ?? void 0,
|
|
19412
19885
|
focus_proposal: model.focusProposal ?? void 0,
|
|
@@ -19712,6 +20185,10 @@ var QueryClient = class {
|
|
|
19712
20185
|
* @remarks
|
|
19713
20186
|
* Plain JSON, no tagged/untagged value serialization.
|
|
19714
20187
|
*
|
|
20188
|
+
* In llm mode, `focusSorts` names the sorts the question is about: each is
|
|
20189
|
+
* always in the schema the translator sees, even a sort built a moment ago
|
|
20190
|
+
* with no records, which the record-count ranking would otherwise cut.
|
|
20191
|
+
*
|
|
19715
20192
|
* TRIZ mode (`mode: "triz"`) is multi-turn:
|
|
19716
20193
|
* 1. A request with no `sessionId` opens a session, structures the problem
|
|
19717
20194
|
* (reading any `images` first) and solves it. The response names the
|
|
@@ -21113,13 +21590,23 @@ var CognitiveClient = class {
|
|
|
21113
21590
|
* Uses POST `/api/v1/cognitive/agents/messages/inbox`. The inbox is per-agent;
|
|
21114
21591
|
* aggregate across a roster by calling this for each agent.
|
|
21115
21592
|
*/
|
|
21116
|
-
async
|
|
21117
|
-
const response = await this.messaging.
|
|
21593
|
+
async getAgentInbox(request, requestOptions) {
|
|
21594
|
+
const response = await this.messaging.getAgentInbox(
|
|
21118
21595
|
GetInboxRequestFromFrontToApi({ ...request, tenantId: this.tenantId }),
|
|
21119
21596
|
toRequestParams(requestOptions)
|
|
21120
21597
|
);
|
|
21121
21598
|
return GetInboxResponseFromApiToFront(response.data);
|
|
21122
21599
|
}
|
|
21600
|
+
/**
|
|
21601
|
+
* Get an agent's inbox.
|
|
21602
|
+
*
|
|
21603
|
+
* @deprecated Renamed to {@link CognitiveClient.getAgentInbox} when the engine
|
|
21604
|
+
* renamed the operation (`get_inbox` → `get_agent_inbox`); kept so existing
|
|
21605
|
+
* callers keep compiling. Same request, same response.
|
|
21606
|
+
*/
|
|
21607
|
+
async getInbox(request, requestOptions) {
|
|
21608
|
+
return this.getAgentInbox(request, requestOptions);
|
|
21609
|
+
}
|
|
21123
21610
|
// --- Feedback ---
|
|
21124
21611
|
/**
|
|
21125
21612
|
* Provide feedback on an agent result.
|
|
@@ -30775,6 +31262,8 @@ function GetScenarioResponseFromApiToFront(dto) {
|
|
|
30775
31262
|
}
|
|
30776
31263
|
function MaterializeScenarioRequestFromFrontToApi(model) {
|
|
30777
31264
|
return {
|
|
31265
|
+
// Accepted: the scenario is opaque user data sent verbatim (RAW_BODY_HEADER,
|
|
31266
|
+
// #39); the engine validates its shape, so the SDK does not re-type it.
|
|
30778
31267
|
scenario: model.scenario
|
|
30779
31268
|
};
|
|
30780
31269
|
}
|
|
@@ -30788,7 +31277,11 @@ function MaterializeScenarioResponseFromApiToFront(dto) {
|
|
|
30788
31277
|
rulesCreated: dto.rules_created,
|
|
30789
31278
|
sensorPointsCreated: dto.sensor_points_created,
|
|
30790
31279
|
sortsCreated: dto.sorts_created,
|
|
30791
|
-
warnings: dto.warnings
|
|
31280
|
+
warnings: dto.warnings,
|
|
31281
|
+
...dto.competency_questions_created !== void 0 ? { competencyQuestionsCreated: dto.competency_questions_created } : {},
|
|
31282
|
+
...dto.computed_features_created !== void 0 ? { computedFeaturesCreated: dto.computed_features_created } : {},
|
|
31283
|
+
...dto.fluents_created !== void 0 ? { fluentsCreated: dto.fluents_created } : {},
|
|
31284
|
+
...dto.proposed_sort_ids !== void 0 ? { proposedSortIds: dto.proposed_sort_ids } : {}
|
|
30792
31285
|
};
|
|
30793
31286
|
}
|
|
30794
31287
|
function UpdateScenarioRequestFromFrontToApi(model) {
|
|
@@ -30908,6 +31401,19 @@ var ScenariosClient = class {
|
|
|
30908
31401
|
* written. No value-level serialization split applies. Response fields are
|
|
30909
31402
|
* normalized from snake_case to camelCase.
|
|
30910
31403
|
*
|
|
31404
|
+
* Staged builder: sorts marked `proposed: true` land as `Proposed` candidates
|
|
31405
|
+
* (their ids in `proposedSortIds`, awaiting a steward's approval), and the
|
|
31406
|
+
* scenario's use cases and competency questions are recorded as `proposed`
|
|
31407
|
+
* competency questions.
|
|
31408
|
+
*
|
|
31409
|
+
* A sort (or fluent) may carry `provenance` — see {@link ScenarioSortProvenance} —
|
|
31410
|
+
* recorded as its origin; without it the sort is credited to the caller.
|
|
31411
|
+
*
|
|
31412
|
+
* An existing sort is reused, and moved under any parent the scenario newly names
|
|
31413
|
+
* for it through the same governed move as `SortsClient.editSortParents`. A move the
|
|
31414
|
+
* engine refuses leaves the sort where it was and is reported in `warnings`, not
|
|
31415
|
+
* as an error — read `warnings` after every call.
|
|
31416
|
+
*
|
|
30911
31417
|
* @example
|
|
30912
31418
|
* ```typescript
|
|
30913
31419
|
* const result = await client.scenarios.materializeScenario({ scenario: generated });
|
|
@@ -32633,7 +33139,8 @@ function StartExplorationRequestFromFrontToApi(model) {
|
|
|
32633
33139
|
max_concepts: model.maxConcepts,
|
|
32634
33140
|
min_extent_size: model.minExtentSize,
|
|
32635
33141
|
min_intent_size: model.minIntentSize,
|
|
32636
|
-
max_terms: model.maxTerms
|
|
33142
|
+
max_terms: model.maxTerms,
|
|
33143
|
+
...model.sortNames !== void 0 ? { sort_names: model.sortNames } : {}
|
|
32637
33144
|
};
|
|
32638
33145
|
}
|
|
32639
33146
|
function StartExplorationResponseFromApiToFront(dto) {
|
|
@@ -33915,17 +34422,30 @@ function CheckDiversityResponseFromApiToFront(dto) {
|
|
|
33915
34422
|
termsCompared: dto.terms_compared
|
|
33916
34423
|
};
|
|
33917
34424
|
}
|
|
34425
|
+
function ViolatedConstraintDtoFromApiToFront(dto) {
|
|
34426
|
+
return {
|
|
34427
|
+
feature: dto.feature,
|
|
34428
|
+
kind: dto.kind,
|
|
34429
|
+
...dto.constraint_name != null ? { constraintName: dto.constraint_name } : {},
|
|
34430
|
+
...dto.constraint_message != null ? { constraintMessage: dto.constraint_message } : {}
|
|
34431
|
+
};
|
|
34432
|
+
}
|
|
33918
34433
|
function NegativeExampleDtoFromApiToFront(dto) {
|
|
33919
34434
|
return {
|
|
33920
34435
|
explanation: dto.explanation,
|
|
33921
34436
|
rejectionReason: dto.rejection_reason,
|
|
33922
34437
|
sortId: dto.sort_id,
|
|
33923
34438
|
strategy: dto.strategy,
|
|
33924
|
-
termId: dto.term_id
|
|
34439
|
+
termId: dto.term_id,
|
|
34440
|
+
...dto.sort != null ? { sort: dto.sort } : {},
|
|
34441
|
+
...dto.features != null ? { features: Object.fromEntries(Object.entries(dto.features)) } : {},
|
|
34442
|
+
...dto.world_mode != null ? { worldMode: dto.world_mode } : {},
|
|
34443
|
+
...dto.violated_constraint != null ? { violatedConstraint: ViolatedConstraintDtoFromApiToFront(dto.violated_constraint) } : {}
|
|
33925
34444
|
};
|
|
33926
34445
|
}
|
|
33927
34446
|
function GenerateNegativesRequestFromFrontToApi(model) {
|
|
33928
34447
|
return {
|
|
34448
|
+
enable_constraint_violation: model.enableConstraintViolation,
|
|
33929
34449
|
enable_cross_sort_confusion: model.enableCrossSortConfusion,
|
|
33930
34450
|
enable_feature_perturbation: model.enableFeaturePerturbation,
|
|
33931
34451
|
enable_sort_incompatibility: model.enableSortIncompatibility,
|
|
@@ -34202,6 +34722,30 @@ var SyntheticClient = class {
|
|
|
34202
34722
|
* @param request - Negative generation parameters including target sorts and strategy flags.
|
|
34203
34723
|
* @returns Generated negative examples with provenance.
|
|
34204
34724
|
* @throws {ApiError} If the request fails.
|
|
34725
|
+
*
|
|
34726
|
+
* @remarks
|
|
34727
|
+
* Each negative is invalid for a documented reason, named by its
|
|
34728
|
+
* `strategy`: a violation of each declared feature constraint
|
|
34729
|
+
* (`ConstraintViolation`, one negative per enum / range / pattern /
|
|
34730
|
+
* maximum-cardinality constraint, with the constraint in
|
|
34731
|
+
* `violatedConstraint`), sort incompatibility, feature perturbation,
|
|
34732
|
+
* cross-sort confusion, a missing required feature, or a feature type
|
|
34733
|
+
* mismatch. Set `enableConstraintViolation: false` to skip the first.
|
|
34734
|
+
*
|
|
34735
|
+
* Proposed sorts are included — negatives exist to test a model before it
|
|
34736
|
+
* is approved; deprecated sorts are not.
|
|
34737
|
+
*
|
|
34738
|
+
* @example
|
|
34739
|
+
* ```typescript
|
|
34740
|
+
* const { negatives } = await client.synthetic.generateNegatives({
|
|
34741
|
+
* targetSorts: [pizzaSortId],
|
|
34742
|
+
* });
|
|
34743
|
+
* for (const n of negatives) {
|
|
34744
|
+
* if (n.violatedConstraint) {
|
|
34745
|
+
* console.log(n.violatedConstraint.feature, n.violatedConstraint.constraintMessage);
|
|
34746
|
+
* }
|
|
34747
|
+
* }
|
|
34748
|
+
* ```
|
|
34205
34749
|
*/
|
|
34206
34750
|
async generateNegatives(request, requestOptions) {
|
|
34207
34751
|
const response = await this.api.generateNegatives(
|
|
@@ -35442,12 +35986,15 @@ var ImageExtractionClient = class {
|
|
|
35442
35986
|
|
|
35443
35987
|
// src/normalizers/ontology.ts
|
|
35444
35988
|
function GenerateOntologyRequestFromFrontToApi(model) {
|
|
35445
|
-
|
|
35989
|
+
const out = {
|
|
35446
35990
|
answers: model.answers,
|
|
35447
35991
|
prompt: model.prompt,
|
|
35448
35992
|
session_id: model.sessionId,
|
|
35449
35993
|
tenant_id: model.tenantId
|
|
35450
35994
|
};
|
|
35995
|
+
if (model.stage !== void 0) out.stage = model.stage;
|
|
35996
|
+
if (model.draft !== void 0) out.draft = model.draft;
|
|
35997
|
+
return out;
|
|
35451
35998
|
}
|
|
35452
35999
|
function GenerateOntologyResponseFromApiToFront(dto) {
|
|
35453
36000
|
if (dto.status === "needs_clarification") {
|
|
@@ -35458,6 +36005,15 @@ function GenerateOntologyResponseFromApiToFront(dto) {
|
|
|
35458
36005
|
understood: dto.understood
|
|
35459
36006
|
};
|
|
35460
36007
|
}
|
|
36008
|
+
if (dto.status === "patch") {
|
|
36009
|
+
const out = {
|
|
36010
|
+
stage: dto.stage,
|
|
36011
|
+
patch: dto.patch,
|
|
36012
|
+
status: dto.status
|
|
36013
|
+
};
|
|
36014
|
+
if (dto.notes != null) out.notes = dto.notes;
|
|
36015
|
+
return out;
|
|
36016
|
+
}
|
|
35461
36017
|
return {
|
|
35462
36018
|
existingSortsCount: dto.existing_sorts_count,
|
|
35463
36019
|
generationTimeMs: dto.generation_time_ms,
|
|
@@ -35519,18 +36075,28 @@ function PipelineStatusResponseFromApiToFront(dto) {
|
|
|
35519
36075
|
};
|
|
35520
36076
|
}
|
|
35521
36077
|
function CompetencyQuestionFromApiToFront(dto) {
|
|
35522
|
-
|
|
36078
|
+
const out = {
|
|
35523
36079
|
key: dto.key,
|
|
35524
36080
|
question: dto.question,
|
|
35525
|
-
osfql: dto.osfql,
|
|
35526
36081
|
kind: dto.kind,
|
|
35527
36082
|
origin: dto.origin,
|
|
35528
|
-
|
|
35529
|
-
expected: dto.expected
|
|
36083
|
+
osfql: dto.osfql,
|
|
36084
|
+
expected: dto.expected,
|
|
36085
|
+
status: dto.status
|
|
35530
36086
|
};
|
|
36087
|
+
if (dto.description != null) out.description = dto.description;
|
|
36088
|
+
if (dto.use_case != null) out.useCase = dto.use_case;
|
|
36089
|
+
if (dto.sorts !== void 0) out.sorts = dto.sorts;
|
|
36090
|
+
return out;
|
|
35531
36091
|
}
|
|
35532
36092
|
function CreateCompetencyQuestionRequestFromFrontToApi(model) {
|
|
35533
|
-
|
|
36093
|
+
const out = { question: model.question };
|
|
36094
|
+
if (model.kind !== void 0) out.kind = model.kind;
|
|
36095
|
+
if (model.osfql !== void 0) out.osfql = model.osfql;
|
|
36096
|
+
if (model.description !== void 0) out.description = model.description;
|
|
36097
|
+
if (model.useCase !== void 0) out.use_case = model.useCase;
|
|
36098
|
+
if (model.sorts !== void 0) out.sorts = model.sorts;
|
|
36099
|
+
return out;
|
|
35534
36100
|
}
|
|
35535
36101
|
function ListCompetencyQuestionsResponseFromApiToFront(dto) {
|
|
35536
36102
|
return {
|
|
@@ -35644,6 +36210,44 @@ function EnrichOntologyResponseFromApiToFront(dto) {
|
|
|
35644
36210
|
applied: dto.applied
|
|
35645
36211
|
};
|
|
35646
36212
|
}
|
|
36213
|
+
function OntologyScopeFromFrontToApi(model) {
|
|
36214
|
+
const out = {
|
|
36215
|
+
purpose: model.purpose,
|
|
36216
|
+
dynamics: model.dynamics,
|
|
36217
|
+
write_mode: model.writeMode
|
|
36218
|
+
};
|
|
36219
|
+
if (model.inScope !== void 0) out.in_scope = model.inScope;
|
|
36220
|
+
if (model.outOfScope !== void 0) out.out_of_scope = model.outOfScope;
|
|
36221
|
+
if (model.deferred !== void 0) out.deferred = model.deferred;
|
|
36222
|
+
if (model.notes !== void 0) out.notes = model.notes;
|
|
36223
|
+
return out;
|
|
36224
|
+
}
|
|
36225
|
+
function OntologyScopeResponseFromApiToFront(dto) {
|
|
36226
|
+
const out = {
|
|
36227
|
+
purpose: dto.purpose,
|
|
36228
|
+
inScope: dto.in_scope ?? [],
|
|
36229
|
+
outOfScope: dto.out_of_scope ?? [],
|
|
36230
|
+
deferred: dto.deferred ?? [],
|
|
36231
|
+
dynamics: dto.dynamics,
|
|
36232
|
+
writeMode: dto.write_mode,
|
|
36233
|
+
updatedAt: dto.updated_at
|
|
36234
|
+
};
|
|
36235
|
+
if (dto.notes != null) out.notes = dto.notes;
|
|
36236
|
+
if (dto.updated_by != null) out.updatedBy = dto.updated_by;
|
|
36237
|
+
return out;
|
|
36238
|
+
}
|
|
36239
|
+
function CurrentFluentResponseFromApiToFront(dto) {
|
|
36240
|
+
const out = {
|
|
36241
|
+
sort: dto.sort,
|
|
36242
|
+
of: dto.of,
|
|
36243
|
+
at: dto.at,
|
|
36244
|
+
termId: dto.term_id,
|
|
36245
|
+
value: dto.value,
|
|
36246
|
+
validFrom: dto.valid_from
|
|
36247
|
+
};
|
|
36248
|
+
if (dto.generated_by != null) out.generatedBy = dto.generated_by;
|
|
36249
|
+
return out;
|
|
36250
|
+
}
|
|
35647
36251
|
|
|
35648
36252
|
// src/resources/ontology.ts
|
|
35649
36253
|
var OntologyClient = class {
|
|
@@ -35665,6 +36269,13 @@ var OntologyClient = class {
|
|
|
35665
36269
|
* If the response status is `"needs_clarification"`, supply `sessionId`
|
|
35666
36270
|
* and `answers` on the next call to complete the generation.
|
|
35667
36271
|
*
|
|
36272
|
+
* Staged builder: with `stage` (and the current `draft`), the response is
|
|
36273
|
+
* `{ status: 'patch', stage, patch, notes? }` — that stage's scenario keys
|
|
36274
|
+
* alone, to merge into the draft.
|
|
36275
|
+
*
|
|
36276
|
+
* The body is sent verbatim (no key re-casing): `draft` is scenario JSON
|
|
36277
|
+
* whose nested keys include the user's own feature names.
|
|
36278
|
+
*
|
|
35668
36279
|
* @example
|
|
35669
36280
|
* ```typescript
|
|
35670
36281
|
* // First call -- may need clarification
|
|
@@ -35680,12 +36291,20 @@ var OntologyClient = class {
|
|
|
35680
36291
|
* answers: { priority_levels: '3' },
|
|
35681
36292
|
* });
|
|
35682
36293
|
* }
|
|
36294
|
+
*
|
|
36295
|
+
* // Staged: one stage's patch over the current draft
|
|
36296
|
+
* const step = await client.ontology.generate({
|
|
36297
|
+
* prompt: 'Build a customer support ticket system',
|
|
36298
|
+
* stage: 'sorts',
|
|
36299
|
+
* draft,
|
|
36300
|
+
* });
|
|
36301
|
+
* if (step.status === 'patch') Object.assign(draft, step.patch);
|
|
35683
36302
|
* ```
|
|
35684
36303
|
*/
|
|
35685
36304
|
async generate(request, requestOptions) {
|
|
35686
36305
|
const response = await this.api.generate(
|
|
35687
36306
|
GenerateOntologyRequestFromFrontToApi(request),
|
|
35688
|
-
|
|
36307
|
+
mergeRequestParams({ headers: { [RAW_BODY_HEADER]: "1" } }, requestOptions)
|
|
35689
36308
|
);
|
|
35690
36309
|
return GenerateOntologyResponseFromApiToFront(response.data);
|
|
35691
36310
|
}
|
|
@@ -35885,6 +36504,118 @@ var OntologyClient = class {
|
|
|
35885
36504
|
);
|
|
35886
36505
|
return EnrichOntologyResponseFromApiToFront(response.data);
|
|
35887
36506
|
}
|
|
36507
|
+
/**
|
|
36508
|
+
* Read the ontology's scope.
|
|
36509
|
+
*
|
|
36510
|
+
* @returns The stored scope, or `null` when none has been set.
|
|
36511
|
+
* @throws {ApiError} If the request fails for a reason other than "no scope".
|
|
36512
|
+
*
|
|
36513
|
+
* @remarks
|
|
36514
|
+
* One scope per tenant, or per namespace when `X-Namespace-Id` is sent. The
|
|
36515
|
+
* engine answers 404 when none was set; that is an expected state for a new
|
|
36516
|
+
* ontology, so it reads as `null` rather than an error.
|
|
36517
|
+
*
|
|
36518
|
+
* @example
|
|
36519
|
+
* ```typescript
|
|
36520
|
+
* const scope = await client.ontology.getScope();
|
|
36521
|
+
* if (scope === null) {
|
|
36522
|
+
* // first visit: ask the user what the ontology is for
|
|
36523
|
+
* }
|
|
36524
|
+
* ```
|
|
36525
|
+
*/
|
|
36526
|
+
async getScope(requestOptions) {
|
|
36527
|
+
try {
|
|
36528
|
+
const response = await this.api.getOntologyScope(toRequestParams(requestOptions));
|
|
36529
|
+
return OntologyScopeResponseFromApiToFront(response.data);
|
|
36530
|
+
} catch (error) {
|
|
36531
|
+
if (error instanceof ApiError && error.status === 404) {
|
|
36532
|
+
return null;
|
|
36533
|
+
}
|
|
36534
|
+
throw error;
|
|
36535
|
+
}
|
|
36536
|
+
}
|
|
36537
|
+
/**
|
|
36538
|
+
* Set the ontology's scope, replacing the stored one.
|
|
36539
|
+
*
|
|
36540
|
+
* @param scope - Purpose, coverage, dynamics and write mode.
|
|
36541
|
+
* @returns The stored scope with its provenance.
|
|
36542
|
+
* @throws {BadRequestError} If `purpose` is empty.
|
|
36543
|
+
*
|
|
36544
|
+
* @example
|
|
36545
|
+
* ```typescript
|
|
36546
|
+
* await client.ontology.putScope({
|
|
36547
|
+
* purpose: 'Answer questions about late deliveries',
|
|
36548
|
+
* inScope: ['orders', 'shipments'],
|
|
36549
|
+
* dynamics: 'dynamic',
|
|
36550
|
+
* writeMode: 'append',
|
|
36551
|
+
* });
|
|
36552
|
+
* ```
|
|
36553
|
+
*/
|
|
36554
|
+
async putScope(scope, requestOptions) {
|
|
36555
|
+
const response = await this.api.putOntologyScope(
|
|
36556
|
+
OntologyScopeFromFrontToApi(scope),
|
|
36557
|
+
toRequestParams(requestOptions)
|
|
36558
|
+
);
|
|
36559
|
+
return OntologyScopeResponseFromApiToFront(response.data);
|
|
36560
|
+
}
|
|
36561
|
+
/**
|
|
36562
|
+
* Fetch an embedded upper-ontology seed as OWL RDF/XML.
|
|
36563
|
+
*
|
|
36564
|
+
* @param name - `bfo-2020` or `cco-facility`.
|
|
36565
|
+
* @returns The OWL document, as text.
|
|
36566
|
+
* @throws {NotFoundError} If the name is not an embedded upper ontology.
|
|
36567
|
+
*
|
|
36568
|
+
* @remarks
|
|
36569
|
+
* The same OWL the lattice-grounding aligner uses, offered as an anchor to
|
|
36570
|
+
* reuse rather than reinvent. The response is `application/rdf+xml`, not JSON.
|
|
36571
|
+
*
|
|
36572
|
+
* @example
|
|
36573
|
+
* ```typescript
|
|
36574
|
+
* const owl = await client.ontology.getUpperOntology('bfo-2020');
|
|
36575
|
+
* ```
|
|
36576
|
+
*/
|
|
36577
|
+
async getUpperOntology(name, requestOptions) {
|
|
36578
|
+
const response = await this.api.http.request({
|
|
36579
|
+
...toRequestParams(requestOptions),
|
|
36580
|
+
path: `/api/v1/ontology/upper/${encodeURIComponent(name)}`,
|
|
36581
|
+
method: "GET",
|
|
36582
|
+
format: "text"
|
|
36583
|
+
});
|
|
36584
|
+
return response.data;
|
|
36585
|
+
}
|
|
36586
|
+
/**
|
|
36587
|
+
* Read the state a fluent holds for an entity at an instant.
|
|
36588
|
+
*
|
|
36589
|
+
* @param query - The fluent sort, the entity's term id, and the instant (default now).
|
|
36590
|
+
* @returns The latest fluent term with `validFrom <= at`.
|
|
36591
|
+
* @throws {NotFoundError} If the fluent sort is unknown, or no state was recorded by `at`.
|
|
36592
|
+
* @throws {BadRequestError} If `at` is not RFC 3339.
|
|
36593
|
+
*
|
|
36594
|
+
* @remarks
|
|
36595
|
+
* The engine answers the same 404 for an unknown fluent sort and for an
|
|
36596
|
+
* entity with no state yet, so this throws rather than returning `null`:
|
|
36597
|
+
* the two cannot be told apart.
|
|
36598
|
+
*
|
|
36599
|
+
* @example
|
|
36600
|
+
* ```typescript
|
|
36601
|
+
* const status = await client.ontology.getCurrentFluent({
|
|
36602
|
+
* sort: 'order_status',
|
|
36603
|
+
* of: orderId,
|
|
36604
|
+
* });
|
|
36605
|
+
* console.log(status.value, status.validFrom);
|
|
36606
|
+
* ```
|
|
36607
|
+
*/
|
|
36608
|
+
async getCurrentFluent(query, requestOptions) {
|
|
36609
|
+
const response = await this.api.currentFluentValue(
|
|
36610
|
+
{
|
|
36611
|
+
sort: query.sort,
|
|
36612
|
+
of: query.of,
|
|
36613
|
+
...query.at !== void 0 ? { at: query.at } : {}
|
|
36614
|
+
},
|
|
36615
|
+
toRequestParams(requestOptions)
|
|
36616
|
+
);
|
|
36617
|
+
return CurrentFluentResponseFromApiToFront(response.data);
|
|
36618
|
+
}
|
|
35888
36619
|
};
|
|
35889
36620
|
|
|
35890
36621
|
// src/normalizers/generation.ts
|
|
@@ -38104,6 +38835,7 @@ function UIActionResponseFromApiToFront(dto) {
|
|
|
38104
38835
|
error: dto.error ?? void 0,
|
|
38105
38836
|
pendingReviewId: dto.pending_review_id ?? void 0,
|
|
38106
38837
|
producedTermIds: dto.produced_term_ids,
|
|
38838
|
+
...dto.retracted_term_ids !== void 0 ? { retractedTermIds: dto.retracted_term_ids } : {},
|
|
38107
38839
|
requiresApproval: dto.requires_approval,
|
|
38108
38840
|
requiresConfirmation: dto.requires_confirmation,
|
|
38109
38841
|
retractedTermIds: dto.retracted_term_ids,
|
|
@@ -38481,15 +39213,20 @@ function TurnDtoFromApiToFront(dto) {
|
|
|
38481
39213
|
claimAnnotations: dto.claim_annotations?.map(ClaimAnnotationDtoFromApiToFront),
|
|
38482
39214
|
// Rows go through the same narrowing as the message response, so a reloaded
|
|
38483
39215
|
// turn keeps its table with the same value types a live turn has.
|
|
38484
|
-
queryResults: dto.query_results?.map(osfqlRowFromApiToFront) ?? void 0
|
|
39216
|
+
queryResults: dto.query_results?.map(osfqlRowFromApiToFront) ?? void 0,
|
|
39217
|
+
...dto.payload !== void 0 && dto.payload !== null ? { payload: dto.payload } : {}
|
|
38485
39218
|
};
|
|
38486
39219
|
}
|
|
38487
39220
|
function RecordTurnRequestFromFrontToApi(model) {
|
|
38488
|
-
|
|
39221
|
+
const out = {
|
|
38489
39222
|
role: model.role,
|
|
38490
39223
|
content: model.content,
|
|
38491
39224
|
osfql: model.osfql
|
|
38492
39225
|
};
|
|
39226
|
+
if (model.payload !== void 0) out.payload = model.payload;
|
|
39227
|
+
if (model.conversationKind !== void 0) out.conversation_kind = model.conversationKind;
|
|
39228
|
+
if (model.title !== void 0) out.title = model.title;
|
|
39229
|
+
return out;
|
|
38493
39230
|
}
|
|
38494
39231
|
function RecordTurnResponseFromApiToFront(dto) {
|
|
38495
39232
|
return {
|
|
@@ -38502,7 +39239,9 @@ function ConversationSummaryDtoFromApiToFront(dto) {
|
|
|
38502
39239
|
id: dto.id,
|
|
38503
39240
|
sessionId: dto.session_id ?? void 0,
|
|
38504
39241
|
createdAt: dto.created_at,
|
|
38505
|
-
turnCount: dto.turn_count
|
|
39242
|
+
turnCount: dto.turn_count,
|
|
39243
|
+
...dto.kind != null ? { kind: dto.kind } : {},
|
|
39244
|
+
...dto.title != null ? { title: dto.title } : {}
|
|
38506
39245
|
};
|
|
38507
39246
|
}
|
|
38508
39247
|
function ListConversationsResponseFromApiToFront(dto) {
|
|
@@ -38788,6 +39527,11 @@ var ConversationClient = class {
|
|
|
38788
39527
|
* Request and response bodies use plain JSON scalars; no tagged/untagged value
|
|
38789
39528
|
* serialization is involved. Turns recorded here are returned by {@link getTurns}.
|
|
38790
39529
|
*
|
|
39530
|
+
* `payload` is opaque structured card state (drafts, questions, findings…),
|
|
39531
|
+
* stored verbatim and returned on the turn — so the body is sent without key
|
|
39532
|
+
* re-casing. `conversationKind` and `title` apply when the conversation is
|
|
39533
|
+
* created (`title` also later, while it has none); a surface uses
|
|
39534
|
+
* `conversationKind` to partition the shared history list.
|
|
38791
39535
|
* The engine also offers each turn to the tenant's long-term memory. A turn the
|
|
38792
39536
|
* memory policy refuses (for example text over 500 characters) is still
|
|
38793
39537
|
* recorded and still answers `200`; it only does not enter memory.
|
|
@@ -38806,11 +39550,21 @@ var ConversationClient = class {
|
|
|
38806
39550
|
* content: 'Done — split it into `auth/session.rs` and `auth/token.rs`.',
|
|
38807
39551
|
* osfql: 'MATCH module(name: ?N);',
|
|
38808
39552
|
* });
|
|
39553
|
+
*
|
|
39554
|
+
* // A surface with richer turns: its own history partition and card state.
|
|
39555
|
+
* await client.conversation.recordTurn('new', {
|
|
39556
|
+
* role: 'assistant',
|
|
39557
|
+
* content: 'Here is a draft scope.',
|
|
39558
|
+
* conversationKind: 'guided_ontology',
|
|
39559
|
+
* title: 'Pizza ontology',
|
|
39560
|
+
* payload: { card: 'scope_draft', draft: { purpose: 'Take pizza orders' } },
|
|
39561
|
+
* });
|
|
38809
39562
|
* ```
|
|
38810
39563
|
*/
|
|
38811
39564
|
async recordTurn(conversationId, request, requestOptions) {
|
|
38812
39565
|
const response = await this.http.request({
|
|
38813
39566
|
...toRequestParams(requestOptions),
|
|
39567
|
+
headers: mergeRequestHeaders({ [RAW_BODY_HEADER]: "1" }, requestOptions),
|
|
38814
39568
|
path: `/api/v1/conversation/${encodeURIComponent(conversationId)}/turns`,
|
|
38815
39569
|
method: "POST",
|
|
38816
39570
|
body: RecordTurnRequestFromFrontToApi(request),
|
|
@@ -47366,6 +48120,96 @@ var OntologyExportClient = class {
|
|
|
47366
48120
|
}
|
|
47367
48121
|
};
|
|
47368
48122
|
|
|
48123
|
+
// src/normalizers/argumentation.ts
|
|
48124
|
+
function ArgumentationEvaluateRequestFromFrontToApi(model) {
|
|
48125
|
+
const out = {
|
|
48126
|
+
claims: model.claims.map((c) => ({
|
|
48127
|
+
term_id: c.termId,
|
|
48128
|
+
...c.id !== void 0 ? { id: c.id } : {}
|
|
48129
|
+
}))
|
|
48130
|
+
};
|
|
48131
|
+
if (model.preferences !== void 0) {
|
|
48132
|
+
out.preferences = model.preferences.map((p) => ({ preferred: p.preferred, over: p.over }));
|
|
48133
|
+
}
|
|
48134
|
+
if (model.retracted !== void 0) out.retracted = model.retracted;
|
|
48135
|
+
if (model.enableDerivation !== void 0) out.enable_derivation = model.enableDerivation;
|
|
48136
|
+
if (model.useTenantRules !== void 0) out.use_tenant_rules = model.useTenantRules;
|
|
48137
|
+
if (model.rulesOsfql !== void 0) out.rules_osfql = model.rulesOsfql;
|
|
48138
|
+
if (model.matchThreshold !== void 0) out.match_threshold = model.matchThreshold;
|
|
48139
|
+
return out;
|
|
48140
|
+
}
|
|
48141
|
+
function ArgumentationEvaluateResponseFromApiToFront(dto) {
|
|
48142
|
+
return {
|
|
48143
|
+
arguments: dto.arguments.map((a) => ({
|
|
48144
|
+
id: a.id,
|
|
48145
|
+
index: a.index,
|
|
48146
|
+
termId: a.term_id,
|
|
48147
|
+
text: a.text,
|
|
48148
|
+
label: a.label
|
|
48149
|
+
})),
|
|
48150
|
+
attacks: dto.attacks.map((a) => ({
|
|
48151
|
+
from: a.from,
|
|
48152
|
+
to: a.to,
|
|
48153
|
+
kind: a.kind,
|
|
48154
|
+
reason: a.reason,
|
|
48155
|
+
proved: a.proved
|
|
48156
|
+
})),
|
|
48157
|
+
grounded: {
|
|
48158
|
+
accepted: dto.grounded.accepted,
|
|
48159
|
+
rejected: dto.grounded.rejected,
|
|
48160
|
+
undecided: dto.grounded.undecided
|
|
48161
|
+
},
|
|
48162
|
+
questions: dto.questions.map((q) => ({ a: q.a, b: q.b, prompt: q.prompt })),
|
|
48163
|
+
warnings: dto.warnings ?? []
|
|
48164
|
+
};
|
|
48165
|
+
}
|
|
48166
|
+
|
|
48167
|
+
// src/resources/argumentation.ts
|
|
48168
|
+
var ArgumentationClient = class {
|
|
48169
|
+
/** @internal */
|
|
48170
|
+
api;
|
|
48171
|
+
/** @internal */
|
|
48172
|
+
constructor(api) {
|
|
48173
|
+
this.api = api;
|
|
48174
|
+
}
|
|
48175
|
+
/**
|
|
48176
|
+
* Evaluate a set of claims: label each argument and surface the conflicts
|
|
48177
|
+
* only the user can resolve.
|
|
48178
|
+
*
|
|
48179
|
+
* @param request - The claims, and the resolutions and retractions so far.
|
|
48180
|
+
* @returns Labelled arguments, evidence-carrying attacks, the grounded
|
|
48181
|
+
* extension, and one question per unresolved conflict.
|
|
48182
|
+
* @throws {BadRequestError} 400 when there are no claims, or a term or
|
|
48183
|
+
* preference id is unknown.
|
|
48184
|
+
* @throws {ApiError} 422 when `rulesOsfql` fails to parse, compile, or execute.
|
|
48185
|
+
*
|
|
48186
|
+
* @remarks
|
|
48187
|
+
* Multi-turn: answer a question by adding a {@link ArgumentPreference} and
|
|
48188
|
+
* evaluate again with the same argument ids; each preference deletes one
|
|
48189
|
+
* attack. Plain JSON on the wire — no tagged/untagged value split applies.
|
|
48190
|
+
*
|
|
48191
|
+
* @example
|
|
48192
|
+
* ```typescript
|
|
48193
|
+
* const turn = await client.argumentation.evaluate({
|
|
48194
|
+
* claims: [{ termId: a, id: 'a' }, { termId: b, id: 'b' }],
|
|
48195
|
+
* });
|
|
48196
|
+
* for (const q of turn.questions) console.log(q.prompt);
|
|
48197
|
+
*
|
|
48198
|
+
* const settled = await client.argumentation.evaluate({
|
|
48199
|
+
* claims: [{ termId: a, id: 'a' }, { termId: b, id: 'b' }],
|
|
48200
|
+
* preferences: [{ preferred: 'a', over: 'b' }],
|
|
48201
|
+
* });
|
|
48202
|
+
* ```
|
|
48203
|
+
*/
|
|
48204
|
+
async evaluate(request, requestOptions) {
|
|
48205
|
+
const response = await this.api.evaluateArgumentation(
|
|
48206
|
+
ArgumentationEvaluateRequestFromFrontToApi(request),
|
|
48207
|
+
toRequestParams(requestOptions)
|
|
48208
|
+
);
|
|
48209
|
+
return ArgumentationEvaluateResponseFromApiToFront(response.data);
|
|
48210
|
+
}
|
|
48211
|
+
};
|
|
48212
|
+
|
|
47369
48213
|
// src/normalizers/demo.ts
|
|
47370
48214
|
function DemoSeedRequestFromFrontToApi(model) {
|
|
47371
48215
|
const dto = {};
|
|
@@ -50397,6 +51241,8 @@ var ReasoningLayerClient = class {
|
|
|
50397
51241
|
agui;
|
|
50398
51242
|
/** Ontology export — OWL ontology and SHACL shapes projected from the sort lattice. */
|
|
50399
51243
|
ontologyExport;
|
|
51244
|
+
/** Grounded argumentation — label conflicting claims and surface the questions only the user can settle. */
|
|
51245
|
+
argumentation;
|
|
50400
51246
|
/** Demo substrate seeding — full SUMO + demo scenarios into the tenant substrate. */
|
|
50401
51247
|
demo;
|
|
50402
51248
|
/** Execution-free reward scoring for candidate queries (recall / precision). */
|
|
@@ -50538,7 +51384,8 @@ var ReasoningLayerClient = class {
|
|
|
50538
51384
|
forecast: this.forecast,
|
|
50539
51385
|
corpus: this.corpus,
|
|
50540
51386
|
osfDiff: this.osfDiff,
|
|
50541
|
-
conformance: this.conformance
|
|
51387
|
+
conformance: this.conformance,
|
|
51388
|
+
argumentation: this.argumentation
|
|
50542
51389
|
};
|
|
50543
51390
|
}
|
|
50544
51391
|
/** Data ingestion and extraction operations — documents, sources, collections, images. */
|
|
@@ -50671,6 +51518,7 @@ var ReasoningLayerClient = class {
|
|
|
50671
51518
|
const generatedGuardrail = encodePathParams(new Guardrail(generatedHttp));
|
|
50672
51519
|
const generatedAgui = encodePathParams(new Agui(generatedHttp));
|
|
50673
51520
|
const generatedOntologyExport = encodePathParams(new OntologyExport(generatedHttp));
|
|
51521
|
+
const generatedArgumentation = encodePathParams(new Argumentation(generatedHttp));
|
|
50674
51522
|
this.sorts = new SortsClient(generatedSorts, generatedTypes, resolved.tenantId);
|
|
50675
51523
|
this.terms = new TermsClient(generatedTerms);
|
|
50676
51524
|
this.inference = new InferenceClient(generatedInference, resolved.tenantId);
|
|
@@ -50802,6 +51650,7 @@ var ReasoningLayerClient = class {
|
|
|
50802
51650
|
this.guardrail = new GuardrailClient(generatedGuardrail);
|
|
50803
51651
|
this.agui = new AguiClient(generatedAgui);
|
|
50804
51652
|
this.ontologyExport = new OntologyExportClient(generatedOntologyExport);
|
|
51653
|
+
this.argumentation = new ArgumentationClient(generatedArgumentation);
|
|
50805
51654
|
this.demo = new DemoClient(encodePathParams(new Demo(generatedHttp)));
|
|
50806
51655
|
this.reward = new RewardClient(encodePathParams(new Reward(generatedHttp)));
|
|
50807
51656
|
this.translation = new TranslationClient(
|
|
@@ -51133,6 +51982,9 @@ var speech_exports = {};
|
|
|
51133
51982
|
// src/types/connectors.ts
|
|
51134
51983
|
var connectors_exports = {};
|
|
51135
51984
|
|
|
51985
|
+
// src/types/argumentation.ts
|
|
51986
|
+
var argumentation_exports = {};
|
|
51987
|
+
|
|
51136
51988
|
// src/types/cron.ts
|
|
51137
51989
|
var cron_exports = {};
|
|
51138
51990
|
|
|
@@ -52743,6 +53595,7 @@ exports.Agui = agui_exports;
|
|
|
52743
53595
|
exports.Analysis = analysis_exports;
|
|
52744
53596
|
exports.Anonymization = anonymization_exports;
|
|
52745
53597
|
exports.ApiError = ApiError;
|
|
53598
|
+
exports.Argumentation = argumentation_exports;
|
|
52746
53599
|
exports.Audit = audit_exports;
|
|
52747
53600
|
exports.AuthenticationError = AuthenticationError;
|
|
52748
53601
|
exports.Authz = authz_exports;
|
|
@@ -52808,6 +53661,7 @@ exports.LTN = ltn_exports;
|
|
|
52808
53661
|
exports.Marketplace = marketplace_exports;
|
|
52809
53662
|
exports.Memory = memory_exports;
|
|
52810
53663
|
exports.Metrics = metrics_exports;
|
|
53664
|
+
exports.NamedConstraintViolationError = NamedConstraintViolationError;
|
|
52811
53665
|
exports.Namespaces = namespaces_exports;
|
|
52812
53666
|
exports.NetworkError = NetworkError;
|
|
52813
53667
|
exports.NeuroSymbolic = neuro_symbolic_exports;
|