@kortexya/reasoninglayer 3.0.0 → 3.1.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 +822 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1308 -34
- package/dist/index.d.ts +1308 -34
- package/dist/index.js +821 -39
- 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 = "3.
|
|
8
|
+
var SDK_VERSION = "3.1.0";
|
|
9
9
|
function resolveConfig(config) {
|
|
10
10
|
if (!config.baseUrl) {
|
|
11
11
|
throw new Error("ClientConfig.baseUrl is required");
|
|
@@ -165,6 +165,21 @@ var OsfqlError = class extends ApiError {
|
|
|
165
165
|
this.sortDeleteRefusal = failure.sortDeleteRefusal;
|
|
166
166
|
}
|
|
167
167
|
};
|
|
168
|
+
var NamedConstraintViolationError = class extends ApiError {
|
|
169
|
+
name = "NamedConstraintViolationError";
|
|
170
|
+
/** The feature whose constraint refused the write, when the engine names it. */
|
|
171
|
+
feature;
|
|
172
|
+
/** The constraint's name, when its author gave one. */
|
|
173
|
+
constraintName;
|
|
174
|
+
/** The constraint's message, when its author gave one. */
|
|
175
|
+
constraintMessage;
|
|
176
|
+
constructor(message, body, headers, refusal, errorCode) {
|
|
177
|
+
super(message, 422, body, headers, errorCode);
|
|
178
|
+
this.feature = refusal.feature;
|
|
179
|
+
this.constraintName = refusal.constraintName;
|
|
180
|
+
this.constraintMessage = refusal.constraintMessage;
|
|
181
|
+
}
|
|
182
|
+
};
|
|
168
183
|
var RateLimitError = class extends ApiError {
|
|
169
184
|
name = "RateLimitError";
|
|
170
185
|
/** Seconds to wait before retrying, or null if not specified. */
|
|
@@ -288,6 +303,10 @@ function createApiError(status, body, headers) {
|
|
|
288
303
|
if (rows !== null) {
|
|
289
304
|
return new BulkRefusedError(message, body, headers, rows, errorCode);
|
|
290
305
|
}
|
|
306
|
+
const named = namedConstraintRefusal(body);
|
|
307
|
+
if (named !== null) {
|
|
308
|
+
return new NamedConstraintViolationError(message, body, headers, named, errorCode);
|
|
309
|
+
}
|
|
291
310
|
return new ApiError(message, status, body, headers, errorCode);
|
|
292
311
|
}
|
|
293
312
|
case 429: {
|
|
@@ -339,7 +358,9 @@ function bulkRefusalRows(body) {
|
|
|
339
358
|
rows.push({
|
|
340
359
|
index: row.index,
|
|
341
360
|
message: row.message,
|
|
342
|
-
...typeof row.feature === "string" ? { feature: row.feature } : {}
|
|
361
|
+
...typeof row.feature === "string" ? { feature: row.feature } : {},
|
|
362
|
+
...typeof row.constraint_name === "string" ? { constraintName: row.constraint_name } : {},
|
|
363
|
+
...typeof row.constraint_message === "string" ? { constraintMessage: row.constraint_message } : {}
|
|
343
364
|
});
|
|
344
365
|
}
|
|
345
366
|
return rows.length > 0 ? rows : null;
|
|
@@ -367,6 +388,18 @@ function derivedFactRefusal(body) {
|
|
|
367
388
|
repairs
|
|
368
389
|
};
|
|
369
390
|
}
|
|
391
|
+
function namedConstraintRefusal(body) {
|
|
392
|
+
if (typeof body !== "object" || body === null) return null;
|
|
393
|
+
const obj = body;
|
|
394
|
+
const constraintName = typeof obj.constraint_name === "string" ? obj.constraint_name : void 0;
|
|
395
|
+
const constraintMessage = typeof obj.constraint_message === "string" ? obj.constraint_message : void 0;
|
|
396
|
+
if (constraintName === void 0 && constraintMessage === void 0) return null;
|
|
397
|
+
return {
|
|
398
|
+
...typeof obj.feature === "string" ? { feature: obj.feature } : {},
|
|
399
|
+
...constraintName !== void 0 ? { constraintName } : {},
|
|
400
|
+
...constraintMessage !== void 0 ? { constraintMessage } : {}
|
|
401
|
+
};
|
|
402
|
+
}
|
|
370
403
|
function isConstraintViolationBody(body) {
|
|
371
404
|
if (!isErrorBody(body)) return false;
|
|
372
405
|
if (!("details" in body)) return false;
|
|
@@ -1274,6 +1307,24 @@ var Sorts = class {
|
|
|
1274
1307
|
format: "json",
|
|
1275
1308
|
...params
|
|
1276
1309
|
});
|
|
1310
|
+
/**
|
|
1311
|
+
* @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; the gateway's `approve_sort` rule additionally refuses the sort's own proposer.
|
|
1312
|
+
*
|
|
1313
|
+
* @tags sorts
|
|
1314
|
+
* @name ApproveSort
|
|
1315
|
+
* @summary Approve a candidate sort
|
|
1316
|
+
* @request POST:/api/v1/sorts/{id}/approve
|
|
1317
|
+
* @secure
|
|
1318
|
+
*/
|
|
1319
|
+
approveSort = (id, data, params = {}) => this.http.request({
|
|
1320
|
+
path: `/api/v1/sorts/${id}/approve`,
|
|
1321
|
+
method: "POST",
|
|
1322
|
+
body: data,
|
|
1323
|
+
secure: true,
|
|
1324
|
+
type: "application/json",
|
|
1325
|
+
format: "json",
|
|
1326
|
+
...params
|
|
1327
|
+
});
|
|
1277
1328
|
/**
|
|
1278
1329
|
* @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.
|
|
1279
1330
|
*
|
|
@@ -1373,6 +1424,60 @@ var Sorts = class {
|
|
|
1373
1424
|
format: "json",
|
|
1374
1425
|
...params
|
|
1375
1426
|
});
|
|
1427
|
+
/**
|
|
1428
|
+
* @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.
|
|
1429
|
+
*
|
|
1430
|
+
* @tags sorts
|
|
1431
|
+
* @name DeprecateSort
|
|
1432
|
+
* @summary Deprecate (reject) a sort
|
|
1433
|
+
* @request POST:/api/v1/sorts/{id}/deprecate
|
|
1434
|
+
* @secure
|
|
1435
|
+
*/
|
|
1436
|
+
deprecateSort = (id, data, params = {}) => this.http.request({
|
|
1437
|
+
path: `/api/v1/sorts/${id}/deprecate`,
|
|
1438
|
+
method: "POST",
|
|
1439
|
+
body: data,
|
|
1440
|
+
secure: true,
|
|
1441
|
+
type: "application/json",
|
|
1442
|
+
format: "json",
|
|
1443
|
+
...params
|
|
1444
|
+
});
|
|
1445
|
+
/**
|
|
1446
|
+
* @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.
|
|
1447
|
+
*
|
|
1448
|
+
* @tags sorts
|
|
1449
|
+
* @name EditSortParents
|
|
1450
|
+
* @summary Add and remove parents of a sort
|
|
1451
|
+
* @request POST:/api/v1/sorts/{id}/parents
|
|
1452
|
+
* @secure
|
|
1453
|
+
*/
|
|
1454
|
+
editSortParents = (id, data, params = {}) => this.http.request({
|
|
1455
|
+
path: `/api/v1/sorts/${id}/parents`,
|
|
1456
|
+
method: "POST",
|
|
1457
|
+
body: data,
|
|
1458
|
+
secure: true,
|
|
1459
|
+
type: "application/json",
|
|
1460
|
+
format: "json",
|
|
1461
|
+
...params
|
|
1462
|
+
});
|
|
1463
|
+
/**
|
|
1464
|
+
* @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.
|
|
1465
|
+
*
|
|
1466
|
+
* @tags sorts
|
|
1467
|
+
* @name FactorSortShapes
|
|
1468
|
+
* @summary Propose mixin parents for shapes several sorts repeat unchanged
|
|
1469
|
+
* @request POST:/api/v1/sorts/discovery/factor
|
|
1470
|
+
* @secure
|
|
1471
|
+
*/
|
|
1472
|
+
factorSortShapes = (data, params = {}) => this.http.request({
|
|
1473
|
+
path: `/api/v1/sorts/discovery/factor`,
|
|
1474
|
+
method: "POST",
|
|
1475
|
+
body: data,
|
|
1476
|
+
secure: true,
|
|
1477
|
+
type: "application/json",
|
|
1478
|
+
format: "json",
|
|
1479
|
+
...params
|
|
1480
|
+
});
|
|
1376
1481
|
/**
|
|
1377
1482
|
* No description
|
|
1378
1483
|
*
|
|
@@ -1721,7 +1826,7 @@ var Sorts = class {
|
|
|
1721
1826
|
...params
|
|
1722
1827
|
});
|
|
1723
1828
|
/**
|
|
1724
|
-
* @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
|
|
1829
|
+
* @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
|
|
1725
1830
|
*
|
|
1726
1831
|
* @tags sorts
|
|
1727
1832
|
* @name ReparentSort
|
|
@@ -2591,6 +2696,24 @@ var Inference = class {
|
|
|
2591
2696
|
format: "json",
|
|
2592
2697
|
...params
|
|
2593
2698
|
});
|
|
2699
|
+
/**
|
|
2700
|
+
* @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).
|
|
2701
|
+
*
|
|
2702
|
+
* @tags inference
|
|
2703
|
+
* @name ValidateRule
|
|
2704
|
+
* @summary Validate a rule without writing it
|
|
2705
|
+
* @request POST:/api/v1/inference/rules/validate
|
|
2706
|
+
* @secure
|
|
2707
|
+
*/
|
|
2708
|
+
validateRule = (data, params = {}) => this.http.request({
|
|
2709
|
+
path: `/api/v1/inference/rules/validate`,
|
|
2710
|
+
method: "POST",
|
|
2711
|
+
body: data,
|
|
2712
|
+
secure: true,
|
|
2713
|
+
type: "application/json",
|
|
2714
|
+
format: "json",
|
|
2715
|
+
...params
|
|
2716
|
+
});
|
|
2594
2717
|
};
|
|
2595
2718
|
|
|
2596
2719
|
// src/api-spec/generated/Cognitive.ts
|
|
@@ -3200,11 +3323,11 @@ var CognitiveAgentsMessaging = class {
|
|
|
3200
3323
|
* No description
|
|
3201
3324
|
*
|
|
3202
3325
|
* @tags Cognitive Agents - Messaging
|
|
3203
|
-
* @name
|
|
3326
|
+
* @name GetAgentInbox
|
|
3204
3327
|
* @summary Get an agent's inbox.
|
|
3205
3328
|
* @request POST:/api/v1/cognitive/agents/messages/inbox
|
|
3206
3329
|
*/
|
|
3207
|
-
|
|
3330
|
+
getAgentInbox = (data, params = {}) => this.http.request({
|
|
3208
3331
|
path: `/api/v1/cognitive/agents/messages/inbox`,
|
|
3209
3332
|
method: "POST",
|
|
3210
3333
|
body: data,
|
|
@@ -10223,6 +10346,23 @@ var Ontology = class {
|
|
|
10223
10346
|
format: "json",
|
|
10224
10347
|
...params
|
|
10225
10348
|
});
|
|
10349
|
+
/**
|
|
10350
|
+
* @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.
|
|
10351
|
+
*
|
|
10352
|
+
* @tags ontology
|
|
10353
|
+
* @name CurrentFluentValue
|
|
10354
|
+
* @summary Current value of a fluent
|
|
10355
|
+
* @request GET:/api/v1/fluents/current
|
|
10356
|
+
* @secure
|
|
10357
|
+
*/
|
|
10358
|
+
currentFluentValue = (query, params = {}) => this.http.request({
|
|
10359
|
+
path: `/api/v1/fluents/current`,
|
|
10360
|
+
method: "GET",
|
|
10361
|
+
query,
|
|
10362
|
+
secure: true,
|
|
10363
|
+
format: "json",
|
|
10364
|
+
...params
|
|
10365
|
+
});
|
|
10226
10366
|
/**
|
|
10227
10367
|
* No description
|
|
10228
10368
|
*
|
|
@@ -10275,6 +10415,22 @@ var Ontology = class {
|
|
|
10275
10415
|
format: "json",
|
|
10276
10416
|
...params
|
|
10277
10417
|
});
|
|
10418
|
+
/**
|
|
10419
|
+
* No description
|
|
10420
|
+
*
|
|
10421
|
+
* @tags ontology
|
|
10422
|
+
* @name GetOntologyScope
|
|
10423
|
+
* @summary Read the ontology's scope.
|
|
10424
|
+
* @request GET:/api/v1/ontology/scope
|
|
10425
|
+
* @secure
|
|
10426
|
+
*/
|
|
10427
|
+
getOntologyScope = (params = {}) => this.http.request({
|
|
10428
|
+
path: `/api/v1/ontology/scope`,
|
|
10429
|
+
method: "GET",
|
|
10430
|
+
secure: true,
|
|
10431
|
+
format: "json",
|
|
10432
|
+
...params
|
|
10433
|
+
});
|
|
10278
10434
|
/**
|
|
10279
10435
|
* No description
|
|
10280
10436
|
*
|
|
@@ -10323,6 +10479,24 @@ var Ontology = class {
|
|
|
10323
10479
|
format: "json",
|
|
10324
10480
|
...params
|
|
10325
10481
|
});
|
|
10482
|
+
/**
|
|
10483
|
+
* No description
|
|
10484
|
+
*
|
|
10485
|
+
* @tags ontology
|
|
10486
|
+
* @name PutOntologyScope
|
|
10487
|
+
* @summary Set the ontology's scope (replaces it).
|
|
10488
|
+
* @request PUT:/api/v1/ontology/scope
|
|
10489
|
+
* @secure
|
|
10490
|
+
*/
|
|
10491
|
+
putOntologyScope = (data, params = {}) => this.http.request({
|
|
10492
|
+
path: `/api/v1/ontology/scope`,
|
|
10493
|
+
method: "PUT",
|
|
10494
|
+
body: data,
|
|
10495
|
+
secure: true,
|
|
10496
|
+
type: "application/json",
|
|
10497
|
+
format: "json",
|
|
10498
|
+
...params
|
|
10499
|
+
});
|
|
10326
10500
|
/**
|
|
10327
10501
|
* No description
|
|
10328
10502
|
*
|
|
@@ -10341,6 +10515,19 @@ var Ontology = class {
|
|
|
10341
10515
|
format: "json",
|
|
10342
10516
|
...params
|
|
10343
10517
|
});
|
|
10518
|
+
/**
|
|
10519
|
+
* No description
|
|
10520
|
+
*
|
|
10521
|
+
* @tags ontology
|
|
10522
|
+
* @name UpperOntology
|
|
10523
|
+
* @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.
|
|
10524
|
+
* @request GET:/api/v1/ontology/upper/{name}
|
|
10525
|
+
*/
|
|
10526
|
+
upperOntology = (name, params = {}) => this.http.request({
|
|
10527
|
+
path: `/api/v1/ontology/upper/${name}`,
|
|
10528
|
+
method: "GET",
|
|
10529
|
+
...params
|
|
10530
|
+
});
|
|
10344
10531
|
};
|
|
10345
10532
|
|
|
10346
10533
|
// src/api-spec/generated/Generation.ts
|
|
@@ -13630,6 +13817,31 @@ var OntologyExport = class {
|
|
|
13630
13817
|
});
|
|
13631
13818
|
};
|
|
13632
13819
|
|
|
13820
|
+
// src/api-spec/generated/Argumentation.ts
|
|
13821
|
+
var Argumentation = class {
|
|
13822
|
+
http;
|
|
13823
|
+
constructor(http) {
|
|
13824
|
+
this.http = http;
|
|
13825
|
+
}
|
|
13826
|
+
/**
|
|
13827
|
+
* No description
|
|
13828
|
+
*
|
|
13829
|
+
* @tags argumentation
|
|
13830
|
+
* @name EvaluateArgumentation
|
|
13831
|
+
* @request POST:/api/v1/argumentation/evaluate
|
|
13832
|
+
* @secure
|
|
13833
|
+
*/
|
|
13834
|
+
evaluateArgumentation = (data, params = {}) => this.http.request({
|
|
13835
|
+
path: `/api/v1/argumentation/evaluate`,
|
|
13836
|
+
method: "POST",
|
|
13837
|
+
body: data,
|
|
13838
|
+
secure: true,
|
|
13839
|
+
type: "application/json",
|
|
13840
|
+
format: "json",
|
|
13841
|
+
...params
|
|
13842
|
+
});
|
|
13843
|
+
};
|
|
13844
|
+
|
|
13633
13845
|
// src/api-spec/generated/Embeddings.ts
|
|
13634
13846
|
var Embeddings = class {
|
|
13635
13847
|
http;
|
|
@@ -15086,7 +15298,9 @@ function BulkRowRefusalFromApiToFront(dto) {
|
|
|
15086
15298
|
return {
|
|
15087
15299
|
index: dto.index,
|
|
15088
15300
|
message: dto.message,
|
|
15089
|
-
...dto.feature ? { feature: dto.feature } : {}
|
|
15301
|
+
...dto.feature ? { feature: dto.feature } : {},
|
|
15302
|
+
...dto.constraint_name != null ? { constraintName: dto.constraint_name } : {},
|
|
15303
|
+
...dto.constraint_message != null ? { constraintMessage: dto.constraint_message } : {}
|
|
15090
15304
|
};
|
|
15091
15305
|
}
|
|
15092
15306
|
function ClearTermsResponseFromApiToFront(dto) {
|
|
@@ -15202,6 +15416,7 @@ function TermVersionDtoFromApiToFront(dto) {
|
|
|
15202
15416
|
if (dto.diff != null) out.diff = VersionDiffDtoFromApiToFront(dto.diff);
|
|
15203
15417
|
if (dto.follows_a_gap !== void 0) out.followsAGap = dto.follows_a_gap;
|
|
15204
15418
|
if (dto.forked_to != null) out.forkedTo = dto.forked_to;
|
|
15419
|
+
if (dto.seeded !== void 0) out.seeded = dto.seeded;
|
|
15205
15420
|
return out;
|
|
15206
15421
|
}
|
|
15207
15422
|
function TermVersionsResponseFromApiToFront(dto) {
|
|
@@ -15242,6 +15457,8 @@ function ConstraintDtoFromFrontToApi(model) {
|
|
|
15242
15457
|
function FeatureDescriptorDtoFromApiToFront(dto) {
|
|
15243
15458
|
return {
|
|
15244
15459
|
name: dto.name,
|
|
15460
|
+
description: dto.description ?? void 0,
|
|
15461
|
+
index: dto.index ?? void 0,
|
|
15245
15462
|
expectedSort: dto.expected_sort ?? void 0,
|
|
15246
15463
|
expectedTypeHint: dto.expected_type_hint ?? void 0,
|
|
15247
15464
|
// The spec made this optional and documents the default explicitly:
|
|
@@ -15252,31 +15469,33 @@ function FeatureDescriptorDtoFromApiToFront(dto) {
|
|
|
15252
15469
|
// `undefined` for a question the wire already answers.
|
|
15253
15470
|
required: dto.required ?? false,
|
|
15254
15471
|
constraint: dto.constraint ? ConstraintDtoFromApiToFront(dto.constraint) : void 0,
|
|
15472
|
+
constraintName: dto.constraint_name ?? void 0,
|
|
15473
|
+
constraintMessage: dto.constraint_message ?? void 0,
|
|
15255
15474
|
key: dto.key,
|
|
15256
15475
|
expectedSortName: dto.expected_sort_name ?? void 0,
|
|
15257
15476
|
minCount: dto.min_count ?? void 0,
|
|
15258
15477
|
maxCount: dto.max_count ?? void 0,
|
|
15259
15478
|
cardinalityOrigin: dto.cardinality_origin ?? void 0,
|
|
15260
|
-
annotations: definedRecord2(dto.annotations)
|
|
15261
|
-
description: dto.description ?? void 0,
|
|
15262
|
-
index: dto.index ?? void 0
|
|
15479
|
+
annotations: definedRecord2(dto.annotations)
|
|
15263
15480
|
};
|
|
15264
15481
|
}
|
|
15265
15482
|
function FeatureDescriptorDtoFromFrontToApi(model) {
|
|
15266
15483
|
return {
|
|
15267
15484
|
name: model.name,
|
|
15485
|
+
description: model.description ?? void 0,
|
|
15486
|
+
index: model.index ?? void 0,
|
|
15268
15487
|
expected_sort: model.expectedSort ?? void 0,
|
|
15269
15488
|
expected_type_hint: model.expectedTypeHint ?? void 0,
|
|
15270
15489
|
required: model.required,
|
|
15271
15490
|
constraint: model.constraint ? ConstraintDtoFromFrontToApi(model.constraint) : void 0,
|
|
15491
|
+
constraint_name: model.constraintName ?? void 0,
|
|
15492
|
+
constraint_message: model.constraintMessage ?? void 0,
|
|
15272
15493
|
key: model.key,
|
|
15273
15494
|
expected_sort_name: model.expectedSortName ?? void 0,
|
|
15274
15495
|
min_count: model.minCount ?? void 0,
|
|
15275
15496
|
max_count: model.maxCount ?? void 0,
|
|
15276
15497
|
cardinality_origin: model.cardinalityOrigin ?? void 0,
|
|
15277
|
-
annotations: model.annotations
|
|
15278
|
-
description: model.description ?? void 0,
|
|
15279
|
-
index: model.index ?? void 0
|
|
15498
|
+
annotations: model.annotations
|
|
15280
15499
|
};
|
|
15281
15500
|
}
|
|
15282
15501
|
function CoextensiveDefinitionDtoFromApiToFront(dto) {
|
|
@@ -15383,6 +15602,12 @@ function SortInfoDtoFromApiToFront(dto) {
|
|
|
15383
15602
|
name: dto.name ?? void 0
|
|
15384
15603
|
};
|
|
15385
15604
|
}
|
|
15605
|
+
function SortResponseFromApiToFront(dto) {
|
|
15606
|
+
return {
|
|
15607
|
+
sort: SortDtoFromApiToFront(dto.sort),
|
|
15608
|
+
wokenResiduations: dto.woken_residuations ?? void 0
|
|
15609
|
+
};
|
|
15610
|
+
}
|
|
15386
15611
|
function SortListResponseFromApiToFront(dto) {
|
|
15387
15612
|
return {
|
|
15388
15613
|
sorts: dto.sorts.map(SortDtoFromApiToFront),
|
|
@@ -15721,11 +15946,38 @@ function SortIndexStatusResponseFromApiToFront(dto) {
|
|
|
15721
15946
|
if (dto.last_indexed_count != null) out.lastIndexedCount = dto.last_indexed_count;
|
|
15722
15947
|
return out;
|
|
15723
15948
|
}
|
|
15724
|
-
function
|
|
15725
|
-
const out = {
|
|
15949
|
+
function ApproveSortRequestFromFrontToApi(model) {
|
|
15950
|
+
const out = {};
|
|
15726
15951
|
if (model.reason !== void 0) out.reason = model.reason;
|
|
15727
15952
|
return out;
|
|
15728
15953
|
}
|
|
15954
|
+
function DeprecateSortRequestFromFrontToApi(model) {
|
|
15955
|
+
const out = { reason: model.reason };
|
|
15956
|
+
if (model.replacement !== void 0) out.replacement = model.replacement;
|
|
15957
|
+
return out;
|
|
15958
|
+
}
|
|
15959
|
+
function FactorSortsRequestFromFrontToApi(model) {
|
|
15960
|
+
const out = {};
|
|
15961
|
+
if (model.sortIds !== void 0) out.sort_ids = model.sortIds;
|
|
15962
|
+
if (model.minSorts !== void 0) out.min_sorts = model.minSorts;
|
|
15963
|
+
return out;
|
|
15964
|
+
}
|
|
15965
|
+
function FactorSharedFeatureFromApiToFront(dto) {
|
|
15966
|
+
const out = { name: dto.name, required: dto.required };
|
|
15967
|
+
if (dto.expected_sort != null) out.expectedSort = dto.expected_sort;
|
|
15968
|
+
if (dto.expected_type_hint != null) out.expectedTypeHint = dto.expected_type_hint;
|
|
15969
|
+
if (dto.constraint != null) out.constraint = ConstraintDtoFromApiToFront(dto.constraint);
|
|
15970
|
+
return out;
|
|
15971
|
+
}
|
|
15972
|
+
function FactorSortsResponseFromApiToFront(dto) {
|
|
15973
|
+
return {
|
|
15974
|
+
proposals: dto.proposals.map((p) => ({
|
|
15975
|
+
memberSorts: p.member_sorts.map((m) => ({ id: m.id, name: m.name })),
|
|
15976
|
+
sharedFeatures: p.shared_features.map(FactorSharedFeatureFromApiToFront),
|
|
15977
|
+
suggestedName: p.suggested_name
|
|
15978
|
+
}))
|
|
15979
|
+
};
|
|
15980
|
+
}
|
|
15729
15981
|
function PatchSortRequestFromFrontToApi(model) {
|
|
15730
15982
|
const out = {};
|
|
15731
15983
|
if (model.name !== void 0) out.name = model.name;
|
|
@@ -15737,10 +15989,6 @@ function PatchSortRequestFromFrontToApi(model) {
|
|
|
15737
15989
|
if (model.scopeNote !== void 0) out.scope_note = model.scopeNote;
|
|
15738
15990
|
if (model.annotations !== void 0) out.annotations = model.annotations;
|
|
15739
15991
|
if (model.worldMode !== void 0) out.world_mode = model.worldMode;
|
|
15740
|
-
if (model.approveProposed !== void 0) out.approve_proposed = model.approveProposed;
|
|
15741
|
-
if (model.deprecate !== void 0) {
|
|
15742
|
-
out.deprecate = model.deprecate === null ? null : DeprecateSortRequestFromFrontToApi(model.deprecate);
|
|
15743
|
-
}
|
|
15744
15992
|
return out;
|
|
15745
15993
|
}
|
|
15746
15994
|
function DeleteSortOptionsFromFrontToApi(options) {
|
|
@@ -15763,6 +16011,14 @@ function DeleteSortResponseFromApiToFront(dto) {
|
|
|
15763
16011
|
if (dto.rules_orphaned !== void 0) {
|
|
15764
16012
|
out.rulesOrphaned = dto.rules_orphaned.map(SortReferencingRuleDtoFromApiToFront);
|
|
15765
16013
|
}
|
|
16014
|
+
if (dto.sorts_deleted !== void 0) out.sortsDeleted = dto.sorts_deleted;
|
|
16015
|
+
return out;
|
|
16016
|
+
}
|
|
16017
|
+
function EditSortParentsRequestFromFrontToApi(model) {
|
|
16018
|
+
const out = {};
|
|
16019
|
+
if (model.add !== void 0) out.add = model.add;
|
|
16020
|
+
if (model.remove !== void 0) out.remove = model.remove;
|
|
16021
|
+
if (model.reason !== void 0) out.reason = model.reason;
|
|
15766
16022
|
return out;
|
|
15767
16023
|
}
|
|
15768
16024
|
function SortReferencingRuleDtoFromApiToFront(dto) {
|
|
@@ -15930,8 +16186,8 @@ var SortsClient = class {
|
|
|
15930
16186
|
return SortDtoFromApiToFront(response.data.sort);
|
|
15931
16187
|
}
|
|
15932
16188
|
/**
|
|
15933
|
-
* Curate a sort's vocabulary
|
|
15934
|
-
*
|
|
16189
|
+
* Curate a sort's vocabulary: rename, describe, label, relate, annotate it,
|
|
16190
|
+
* or change its world mode.
|
|
15935
16191
|
*
|
|
15936
16192
|
* @param sortId - Sort UUID.
|
|
15937
16193
|
* @param request - The fields to change. Only present fields mutate.
|
|
@@ -15968,6 +16224,97 @@ var SortsClient = class {
|
|
|
15968
16224
|
);
|
|
15969
16225
|
return SortDtoFromApiToFront(response.data.sort);
|
|
15970
16226
|
}
|
|
16227
|
+
/**
|
|
16228
|
+
* Approve a candidate sort: promote it from `Proposed` to `Active`.
|
|
16229
|
+
*
|
|
16230
|
+
* @param sortId - Sort UUID.
|
|
16231
|
+
* @param request - Optionally, why the steward accepted it.
|
|
16232
|
+
* @returns The approved sort, and how much suspended work its declaration
|
|
16233
|
+
* released (`wokenResiduations`).
|
|
16234
|
+
* @throws {ForbiddenError} 403 when the caller holds no Manage grant on the
|
|
16235
|
+
* sort — including the proposer approving their own candidate, which the
|
|
16236
|
+
* gateway denies.
|
|
16237
|
+
* @throws {NotFoundError} 404 when the sort does not exist.
|
|
16238
|
+
* @throws {ApiError} 409 when the sort is not awaiting approval.
|
|
16239
|
+
*
|
|
16240
|
+
* @remarks
|
|
16241
|
+
* Appends an approval decision to the compliance ledger, with the
|
|
16242
|
+
* authenticated user as reviewer. This replaced `approveProposed` on
|
|
16243
|
+
* {@link SortsClient.patchSort}, which the engine now refuses.
|
|
16244
|
+
*
|
|
16245
|
+
* @example
|
|
16246
|
+
* ```typescript
|
|
16247
|
+
* const { sort, wokenResiduations } = await client.sorts.approveSort(sortId, {
|
|
16248
|
+
* reason: 'Matches the order lifecycle use case',
|
|
16249
|
+
* });
|
|
16250
|
+
* ```
|
|
16251
|
+
*/
|
|
16252
|
+
async approveSort(sortId, request = {}, requestOptions) {
|
|
16253
|
+
const response = await this.sorts.approveSort(
|
|
16254
|
+
sortId,
|
|
16255
|
+
ApproveSortRequestFromFrontToApi(request),
|
|
16256
|
+
toRequestParams(requestOptions)
|
|
16257
|
+
);
|
|
16258
|
+
return SortResponseFromApiToFront(response.data);
|
|
16259
|
+
}
|
|
16260
|
+
/**
|
|
16261
|
+
* Deprecate a sort: reject a candidate, or retire an active concept,
|
|
16262
|
+
* optionally in favour of a replacement.
|
|
16263
|
+
*
|
|
16264
|
+
* @param sortId - Sort UUID.
|
|
16265
|
+
* @param request - Why (required), and the replacement's id or name.
|
|
16266
|
+
* @returns The deprecated sort.
|
|
16267
|
+
* @throws {BadRequestError} 400 when `reason` is empty or the replacement does not exist.
|
|
16268
|
+
* @throws {ForbiddenError} 403 when the caller holds no Manage grant on the sort.
|
|
16269
|
+
* @throws {NotFoundError} 404 when the sort does not exist.
|
|
16270
|
+
*
|
|
16271
|
+
* @remarks
|
|
16272
|
+
* Appends a rejection decision to the compliance ledger. `replacement`
|
|
16273
|
+
* accepts a sort id or a sort name in this tenant. This replaced the
|
|
16274
|
+
* `deprecate` arm of {@link SortsClient.patchSort}, which the engine now
|
|
16275
|
+
* refuses.
|
|
16276
|
+
*
|
|
16277
|
+
* @example
|
|
16278
|
+
* ```typescript
|
|
16279
|
+
* await client.sorts.deprecateSort(sortId, {
|
|
16280
|
+
* reason: 'Duplicate of customer',
|
|
16281
|
+
* replacement: 'customer',
|
|
16282
|
+
* });
|
|
16283
|
+
* ```
|
|
16284
|
+
*/
|
|
16285
|
+
async deprecateSort(sortId, request, requestOptions) {
|
|
16286
|
+
const response = await this.sorts.deprecateSort(
|
|
16287
|
+
sortId,
|
|
16288
|
+
DeprecateSortRequestFromFrontToApi(request),
|
|
16289
|
+
toRequestParams(requestOptions)
|
|
16290
|
+
);
|
|
16291
|
+
return SortResponseFromApiToFront(response.data);
|
|
16292
|
+
}
|
|
16293
|
+
/**
|
|
16294
|
+
* Propose mixin parents for feature shapes several sorts repeat unchanged.
|
|
16295
|
+
*
|
|
16296
|
+
* @param request - Which sorts to analyse (default: all), and the least
|
|
16297
|
+
* number of sorts a proposal must cover (default and floor: 2).
|
|
16298
|
+
* @returns Candidate parents, most shared declarations first.
|
|
16299
|
+
* @throws {ApiError} If the request fails.
|
|
16300
|
+
*
|
|
16301
|
+
* @remarks
|
|
16302
|
+
* Deterministic and read-only: it groups sorts over identical feature +
|
|
16303
|
+
* constraint declarations. `suggestedName` is a placeholder to rename
|
|
16304
|
+
* before creating the parent.
|
|
16305
|
+
*
|
|
16306
|
+
* @example
|
|
16307
|
+
* ```typescript
|
|
16308
|
+
* const { proposals } = await client.sorts.factorSorts({ minSorts: 3 });
|
|
16309
|
+
* ```
|
|
16310
|
+
*/
|
|
16311
|
+
async factorSorts(request = {}, requestOptions) {
|
|
16312
|
+
const response = await this.sorts.factorSortShapes(
|
|
16313
|
+
FactorSortsRequestFromFrontToApi(request),
|
|
16314
|
+
toRequestParams(requestOptions)
|
|
16315
|
+
);
|
|
16316
|
+
return FactorSortsResponseFromApiToFront(response.data);
|
|
16317
|
+
}
|
|
15971
16318
|
/**
|
|
15972
16319
|
* Delete a sort by ID.
|
|
15973
16320
|
*
|
|
@@ -16079,6 +16426,47 @@ var SortsClient = class {
|
|
|
16079
16426
|
);
|
|
16080
16427
|
return SortDeletePreviewResponseFromApiToFront(response.data);
|
|
16081
16428
|
}
|
|
16429
|
+
/**
|
|
16430
|
+
* Add and remove parents of a sort — a steward's governed move in the lattice.
|
|
16431
|
+
*
|
|
16432
|
+
* @param sortId - Sort UUID.
|
|
16433
|
+
* @param request - Parents to add and to remove (by id or by name), and why.
|
|
16434
|
+
* @returns The move's report — what moved, what each sort's inheritance
|
|
16435
|
+
* gained and lost, the terms and rules concerned — with the sort as it now
|
|
16436
|
+
* stands.
|
|
16437
|
+
* @throws {ForbiddenError} 403 without `Manage` on the sort and on every
|
|
16438
|
+
* parent added or removed.
|
|
16439
|
+
* @throws {NotFoundError} 404 when the sort does not exist.
|
|
16440
|
+
* @throws {ApiError} 422, with nothing changed, for an unknown parent, a
|
|
16441
|
+
* parent to remove that is not one, an empty edit, the sort itself, a
|
|
16442
|
+
* parent below the sort (a cycle), or any state the move would make
|
|
16443
|
+
* contradictory (⊥).
|
|
16444
|
+
*
|
|
16445
|
+
* @remarks
|
|
16446
|
+
* The sort keeps every other parent in its current order; added ones go last.
|
|
16447
|
+
* The move is the one {@link SortsClient.reparentSort} runs: the sort keeps
|
|
16448
|
+
* its id and record, its subtree moves with it, inherited declarations and
|
|
16449
|
+
* the subsumption caches are repaired. A change appends an oversight
|
|
16450
|
+
* decision to the audit ledger naming the reviewer.
|
|
16451
|
+
*
|
|
16452
|
+
* @example
|
|
16453
|
+
* ```typescript
|
|
16454
|
+
* const moved = await client.sorts.editSortParents(sortId, {
|
|
16455
|
+
* add: ['vehicle'],
|
|
16456
|
+
* remove: ['thing'],
|
|
16457
|
+
* reason: 'A truck is a vehicle',
|
|
16458
|
+
* });
|
|
16459
|
+
* console.log(moved.inheritanceChanges);
|
|
16460
|
+
* ```
|
|
16461
|
+
*/
|
|
16462
|
+
async editSortParents(sortId, request, requestOptions) {
|
|
16463
|
+
const response = await this.sorts.editSortParents(
|
|
16464
|
+
sortId,
|
|
16465
|
+
EditSortParentsRequestFromFrontToApi(request),
|
|
16466
|
+
toRequestParams(requestOptions)
|
|
16467
|
+
);
|
|
16468
|
+
return SortReparentResponseFromApiToFront(response.data);
|
|
16469
|
+
}
|
|
16082
16470
|
/**
|
|
16083
16471
|
* Move a sort in the lattice: replace its parent set.
|
|
16084
16472
|
*
|
|
@@ -17936,6 +18324,21 @@ function ResidualDerivationDtoFromApiToFront(dto) {
|
|
|
17936
18324
|
function AddRuleResponseFromApiToFront(dto) {
|
|
17937
18325
|
return { term: PsiTermDtoFromApiToFront(dto.term) };
|
|
17938
18326
|
}
|
|
18327
|
+
function RuleValidationResponseFromApiToFront(dto) {
|
|
18328
|
+
const issue = (i) => ({
|
|
18329
|
+
kind: i.kind,
|
|
18330
|
+
message: i.message,
|
|
18331
|
+
...i.status != null ? { status: i.status } : {}
|
|
18332
|
+
});
|
|
18333
|
+
const out = {
|
|
18334
|
+
ok: dto.ok,
|
|
18335
|
+
refusals: dto.refusals.map(issue),
|
|
18336
|
+
warnings: dto.warnings.map(issue)
|
|
18337
|
+
};
|
|
18338
|
+
if (dto.rule !== void 0)
|
|
18339
|
+
out.rule = dto.rule === null ? null : PsiTermDtoFromApiToFront(dto.rule);
|
|
18340
|
+
return out;
|
|
18341
|
+
}
|
|
17939
18342
|
function AddFactResponseFromApiToFront(dto) {
|
|
17940
18343
|
return { term: PsiTermDtoFromApiToFront(dto.term) };
|
|
17941
18344
|
}
|
|
@@ -18555,11 +18958,16 @@ var InferenceClient = class {
|
|
|
18555
18958
|
* @param request - Rule definition using TermInputDto. Set `aggregator` to declare an
|
|
18556
18959
|
* engine-side head aggregator (see {@link RuleAggregatorDto}).
|
|
18557
18960
|
* @returns The created rule wrapped in an AddRuleResponse.
|
|
18558
|
-
* @throws {ApiError} If the rule is rejected or the request fails
|
|
18961
|
+
* @throws {ApiError} If the rule is rejected or the request fails — 422 when
|
|
18962
|
+
* it is unusable as written, including a rule that closes a NEW cycle
|
|
18963
|
+
* through negation (no stratification would order the program; a cycle
|
|
18964
|
+
* the program already had is not blamed on it).
|
|
18559
18965
|
*
|
|
18560
18966
|
* @remarks
|
|
18561
18967
|
* **Serialization format**: untagged `TermInputDto` / `FeatureInputValueDto`.
|
|
18562
18968
|
*
|
|
18969
|
+
* Ask {@link InferenceClient.validateRule} first to learn every reason the
|
|
18970
|
+
* write would refuse, without writing.
|
|
18563
18971
|
* A `{ termId }` reference to a term that is durable but not yet loaded
|
|
18564
18972
|
* into the engine process resolves: the route loads the terms the request
|
|
18565
18973
|
* names before it converts them.
|
|
@@ -18586,6 +18994,45 @@ var InferenceClient = class {
|
|
|
18586
18994
|
);
|
|
18587
18995
|
return AddRuleResponseFromApiToFront(response.data);
|
|
18588
18996
|
}
|
|
18997
|
+
/**
|
|
18998
|
+
* Run every check {@link InferenceClient.addRule} runs — without writing.
|
|
18999
|
+
*
|
|
19000
|
+
* @param request - The same rule `addRule` takes.
|
|
19001
|
+
* @returns Whether the write would accept it (`ok`), every refusal with the
|
|
19002
|
+
* status the write would answer, the NAF-safety warnings, and the rule as
|
|
19003
|
+
* the write would build it.
|
|
19004
|
+
* @throws {ApiError} If the request itself fails.
|
|
19005
|
+
*
|
|
19006
|
+
* @remarks
|
|
19007
|
+
* The rule is built into a scratch copy of the tenant's store: sorts and
|
|
19008
|
+
* referenced terms resolve, guard bounds compare with their declared types,
|
|
19009
|
+
* nested negation, binders, range restriction, the aggregator, the
|
|
19010
|
+
* homoiconic encoding, and stratification (a NEW cycle through negation is
|
|
19011
|
+
* an `unstratifiable` refusal). Nothing is written, persisted or propagated.
|
|
19012
|
+
* **Serialization format**: untagged `TermInputDto` / `FeatureInputValueDto`.
|
|
19013
|
+
*
|
|
19014
|
+
* @example
|
|
19015
|
+
* ```typescript
|
|
19016
|
+
* const check = await client.inference.validateRule({
|
|
19017
|
+
* term: psi('adult', { name: Var('N') }),
|
|
19018
|
+
* antecedents: [psi('person', { name: Var('N') })],
|
|
19019
|
+
* });
|
|
19020
|
+
* if (!check.ok) for (const r of check.refusals) console.warn(r.kind, r.message);
|
|
19021
|
+
* ```
|
|
19022
|
+
*/
|
|
19023
|
+
async validateRule(request, requestOptions) {
|
|
19024
|
+
const wireRequest = {
|
|
19025
|
+
term: convertTermArg(request.term),
|
|
19026
|
+
antecedents: request.antecedents?.map(convertTermArg),
|
|
19027
|
+
certainty: request.certainty,
|
|
19028
|
+
aggregator: request.aggregator
|
|
19029
|
+
};
|
|
19030
|
+
const response = await this.api.validateRule(
|
|
19031
|
+
AddRuleRequestFromFrontToApi(wireRequest),
|
|
19032
|
+
toRequestParams(requestOptions)
|
|
19033
|
+
);
|
|
19034
|
+
return RuleValidationResponseFromApiToFront(response.data);
|
|
19035
|
+
}
|
|
18589
19036
|
/**
|
|
18590
19037
|
* Add a fact.
|
|
18591
19038
|
*
|
|
@@ -18622,7 +19069,9 @@ var InferenceClient = class {
|
|
|
18622
19069
|
* its index in `request.rules`, with the engine's reason (for example
|
|
18623
19070
|
* `rule head term did not resolve: it names sort \`x\`, which this
|
|
18624
19071
|
* tenant's sort hierarchy does not define`). `rulesAdded` plus
|
|
18625
|
-
* `rejected.length` equals the number submitted.
|
|
19072
|
+
* `rejected.length` equals the number submitted. A rule that closes a NEW
|
|
19073
|
+
* cycle through negation is refused the same way (the reason names the
|
|
19074
|
+
* cycle's sorts), decided for every row before any row is written.
|
|
18626
19075
|
*
|
|
18627
19076
|
* @example
|
|
18628
19077
|
* ```typescript
|
|
@@ -21111,13 +21560,23 @@ var CognitiveClient = class {
|
|
|
21111
21560
|
* Uses POST `/api/v1/cognitive/agents/messages/inbox`. The inbox is per-agent;
|
|
21112
21561
|
* aggregate across a roster by calling this for each agent.
|
|
21113
21562
|
*/
|
|
21114
|
-
async
|
|
21115
|
-
const response = await this.messaging.
|
|
21563
|
+
async getAgentInbox(request, requestOptions) {
|
|
21564
|
+
const response = await this.messaging.getAgentInbox(
|
|
21116
21565
|
GetInboxRequestFromFrontToApi({ ...request, tenantId: this.tenantId }),
|
|
21117
21566
|
toRequestParams(requestOptions)
|
|
21118
21567
|
);
|
|
21119
21568
|
return GetInboxResponseFromApiToFront(response.data);
|
|
21120
21569
|
}
|
|
21570
|
+
/**
|
|
21571
|
+
* Get an agent's inbox.
|
|
21572
|
+
*
|
|
21573
|
+
* @deprecated Renamed to {@link CognitiveClient.getAgentInbox} when the engine
|
|
21574
|
+
* renamed the operation (`get_inbox` → `get_agent_inbox`); kept so existing
|
|
21575
|
+
* callers keep compiling. Same request, same response.
|
|
21576
|
+
*/
|
|
21577
|
+
async getInbox(request, requestOptions) {
|
|
21578
|
+
return this.getAgentInbox(request, requestOptions);
|
|
21579
|
+
}
|
|
21121
21580
|
// --- Feedback ---
|
|
21122
21581
|
/**
|
|
21123
21582
|
* Provide feedback on an agent result.
|
|
@@ -30773,6 +31232,8 @@ function GetScenarioResponseFromApiToFront(dto) {
|
|
|
30773
31232
|
}
|
|
30774
31233
|
function MaterializeScenarioRequestFromFrontToApi(model) {
|
|
30775
31234
|
return {
|
|
31235
|
+
// Accepted: the scenario is opaque user data sent verbatim (RAW_BODY_HEADER,
|
|
31236
|
+
// #39); the engine validates its shape, so the SDK does not re-type it.
|
|
30776
31237
|
scenario: model.scenario
|
|
30777
31238
|
};
|
|
30778
31239
|
}
|
|
@@ -30786,7 +31247,11 @@ function MaterializeScenarioResponseFromApiToFront(dto) {
|
|
|
30786
31247
|
rulesCreated: dto.rules_created,
|
|
30787
31248
|
sensorPointsCreated: dto.sensor_points_created,
|
|
30788
31249
|
sortsCreated: dto.sorts_created,
|
|
30789
|
-
warnings: dto.warnings
|
|
31250
|
+
warnings: dto.warnings,
|
|
31251
|
+
...dto.competency_questions_created !== void 0 ? { competencyQuestionsCreated: dto.competency_questions_created } : {},
|
|
31252
|
+
...dto.computed_features_created !== void 0 ? { computedFeaturesCreated: dto.computed_features_created } : {},
|
|
31253
|
+
...dto.fluents_created !== void 0 ? { fluentsCreated: dto.fluents_created } : {},
|
|
31254
|
+
...dto.proposed_sort_ids !== void 0 ? { proposedSortIds: dto.proposed_sort_ids } : {}
|
|
30790
31255
|
};
|
|
30791
31256
|
}
|
|
30792
31257
|
function UpdateScenarioRequestFromFrontToApi(model) {
|
|
@@ -30906,6 +31371,11 @@ var ScenariosClient = class {
|
|
|
30906
31371
|
* written. No value-level serialization split applies. Response fields are
|
|
30907
31372
|
* normalized from snake_case to camelCase.
|
|
30908
31373
|
*
|
|
31374
|
+
* Staged builder: sorts marked `proposed: true` land as `Proposed` candidates
|
|
31375
|
+
* (their ids in `proposedSortIds`, awaiting a steward's approval), and the
|
|
31376
|
+
* scenario's use cases and competency questions are recorded as `proposed`
|
|
31377
|
+
* competency questions.
|
|
31378
|
+
*
|
|
30909
31379
|
* @example
|
|
30910
31380
|
* ```typescript
|
|
30911
31381
|
* const result = await client.scenarios.materializeScenario({ scenario: generated });
|
|
@@ -32631,7 +33101,8 @@ function StartExplorationRequestFromFrontToApi(model) {
|
|
|
32631
33101
|
max_concepts: model.maxConcepts,
|
|
32632
33102
|
min_extent_size: model.minExtentSize,
|
|
32633
33103
|
min_intent_size: model.minIntentSize,
|
|
32634
|
-
max_terms: model.maxTerms
|
|
33104
|
+
max_terms: model.maxTerms,
|
|
33105
|
+
...model.sortNames !== void 0 ? { sort_names: model.sortNames } : {}
|
|
32635
33106
|
};
|
|
32636
33107
|
}
|
|
32637
33108
|
function StartExplorationResponseFromApiToFront(dto) {
|
|
@@ -33919,7 +34390,10 @@ function NegativeExampleDtoFromApiToFront(dto) {
|
|
|
33919
34390
|
rejectionReason: dto.rejection_reason,
|
|
33920
34391
|
sortId: dto.sort_id,
|
|
33921
34392
|
strategy: dto.strategy,
|
|
33922
|
-
termId: dto.term_id
|
|
34393
|
+
termId: dto.term_id,
|
|
34394
|
+
...dto.sort != null ? { sort: dto.sort } : {},
|
|
34395
|
+
...dto.features != null ? { features: Object.fromEntries(Object.entries(dto.features)) } : {},
|
|
34396
|
+
...dto.world_mode != null ? { worldMode: dto.world_mode } : {}
|
|
33923
34397
|
};
|
|
33924
34398
|
}
|
|
33925
34399
|
function GenerateNegativesRequestFromFrontToApi(model) {
|
|
@@ -35440,12 +35914,15 @@ var ImageExtractionClient = class {
|
|
|
35440
35914
|
|
|
35441
35915
|
// src/normalizers/ontology.ts
|
|
35442
35916
|
function GenerateOntologyRequestFromFrontToApi(model) {
|
|
35443
|
-
|
|
35917
|
+
const out = {
|
|
35444
35918
|
answers: model.answers,
|
|
35445
35919
|
prompt: model.prompt,
|
|
35446
35920
|
session_id: model.sessionId,
|
|
35447
35921
|
tenant_id: model.tenantId
|
|
35448
35922
|
};
|
|
35923
|
+
if (model.stage !== void 0) out.stage = model.stage;
|
|
35924
|
+
if (model.draft !== void 0) out.draft = model.draft;
|
|
35925
|
+
return out;
|
|
35449
35926
|
}
|
|
35450
35927
|
function GenerateOntologyResponseFromApiToFront(dto) {
|
|
35451
35928
|
if (dto.status === "needs_clarification") {
|
|
@@ -35456,6 +35933,15 @@ function GenerateOntologyResponseFromApiToFront(dto) {
|
|
|
35456
35933
|
understood: dto.understood
|
|
35457
35934
|
};
|
|
35458
35935
|
}
|
|
35936
|
+
if (dto.status === "patch") {
|
|
35937
|
+
const out = {
|
|
35938
|
+
stage: dto.stage,
|
|
35939
|
+
patch: dto.patch,
|
|
35940
|
+
status: dto.status
|
|
35941
|
+
};
|
|
35942
|
+
if (dto.notes != null) out.notes = dto.notes;
|
|
35943
|
+
return out;
|
|
35944
|
+
}
|
|
35459
35945
|
return {
|
|
35460
35946
|
existingSortsCount: dto.existing_sorts_count,
|
|
35461
35947
|
generationTimeMs: dto.generation_time_ms,
|
|
@@ -35517,18 +36003,28 @@ function PipelineStatusResponseFromApiToFront(dto) {
|
|
|
35517
36003
|
};
|
|
35518
36004
|
}
|
|
35519
36005
|
function CompetencyQuestionFromApiToFront(dto) {
|
|
35520
|
-
|
|
36006
|
+
const out = {
|
|
35521
36007
|
key: dto.key,
|
|
35522
36008
|
question: dto.question,
|
|
35523
|
-
osfql: dto.osfql,
|
|
35524
36009
|
kind: dto.kind,
|
|
35525
36010
|
origin: dto.origin,
|
|
35526
|
-
|
|
35527
|
-
expected: dto.expected
|
|
36011
|
+
osfql: dto.osfql,
|
|
36012
|
+
expected: dto.expected,
|
|
36013
|
+
status: dto.status
|
|
35528
36014
|
};
|
|
36015
|
+
if (dto.description != null) out.description = dto.description;
|
|
36016
|
+
if (dto.use_case != null) out.useCase = dto.use_case;
|
|
36017
|
+
if (dto.sorts !== void 0) out.sorts = dto.sorts;
|
|
36018
|
+
return out;
|
|
35529
36019
|
}
|
|
35530
36020
|
function CreateCompetencyQuestionRequestFromFrontToApi(model) {
|
|
35531
|
-
|
|
36021
|
+
const out = { question: model.question };
|
|
36022
|
+
if (model.kind !== void 0) out.kind = model.kind;
|
|
36023
|
+
if (model.osfql !== void 0) out.osfql = model.osfql;
|
|
36024
|
+
if (model.description !== void 0) out.description = model.description;
|
|
36025
|
+
if (model.useCase !== void 0) out.use_case = model.useCase;
|
|
36026
|
+
if (model.sorts !== void 0) out.sorts = model.sorts;
|
|
36027
|
+
return out;
|
|
35532
36028
|
}
|
|
35533
36029
|
function ListCompetencyQuestionsResponseFromApiToFront(dto) {
|
|
35534
36030
|
return {
|
|
@@ -35642,6 +36138,44 @@ function EnrichOntologyResponseFromApiToFront(dto) {
|
|
|
35642
36138
|
applied: dto.applied
|
|
35643
36139
|
};
|
|
35644
36140
|
}
|
|
36141
|
+
function OntologyScopeFromFrontToApi(model) {
|
|
36142
|
+
const out = {
|
|
36143
|
+
purpose: model.purpose,
|
|
36144
|
+
dynamics: model.dynamics,
|
|
36145
|
+
write_mode: model.writeMode
|
|
36146
|
+
};
|
|
36147
|
+
if (model.inScope !== void 0) out.in_scope = model.inScope;
|
|
36148
|
+
if (model.outOfScope !== void 0) out.out_of_scope = model.outOfScope;
|
|
36149
|
+
if (model.deferred !== void 0) out.deferred = model.deferred;
|
|
36150
|
+
if (model.notes !== void 0) out.notes = model.notes;
|
|
36151
|
+
return out;
|
|
36152
|
+
}
|
|
36153
|
+
function OntologyScopeResponseFromApiToFront(dto) {
|
|
36154
|
+
const out = {
|
|
36155
|
+
purpose: dto.purpose,
|
|
36156
|
+
inScope: dto.in_scope ?? [],
|
|
36157
|
+
outOfScope: dto.out_of_scope ?? [],
|
|
36158
|
+
deferred: dto.deferred ?? [],
|
|
36159
|
+
dynamics: dto.dynamics,
|
|
36160
|
+
writeMode: dto.write_mode,
|
|
36161
|
+
updatedAt: dto.updated_at
|
|
36162
|
+
};
|
|
36163
|
+
if (dto.notes != null) out.notes = dto.notes;
|
|
36164
|
+
if (dto.updated_by != null) out.updatedBy = dto.updated_by;
|
|
36165
|
+
return out;
|
|
36166
|
+
}
|
|
36167
|
+
function CurrentFluentResponseFromApiToFront(dto) {
|
|
36168
|
+
const out = {
|
|
36169
|
+
sort: dto.sort,
|
|
36170
|
+
of: dto.of,
|
|
36171
|
+
at: dto.at,
|
|
36172
|
+
termId: dto.term_id,
|
|
36173
|
+
value: dto.value,
|
|
36174
|
+
validFrom: dto.valid_from
|
|
36175
|
+
};
|
|
36176
|
+
if (dto.generated_by != null) out.generatedBy = dto.generated_by;
|
|
36177
|
+
return out;
|
|
36178
|
+
}
|
|
35645
36179
|
|
|
35646
36180
|
// src/resources/ontology.ts
|
|
35647
36181
|
var OntologyClient = class {
|
|
@@ -35663,6 +36197,13 @@ var OntologyClient = class {
|
|
|
35663
36197
|
* If the response status is `"needs_clarification"`, supply `sessionId`
|
|
35664
36198
|
* and `answers` on the next call to complete the generation.
|
|
35665
36199
|
*
|
|
36200
|
+
* Staged builder: with `stage` (and the current `draft`), the response is
|
|
36201
|
+
* `{ status: 'patch', stage, patch, notes? }` — that stage's scenario keys
|
|
36202
|
+
* alone, to merge into the draft.
|
|
36203
|
+
*
|
|
36204
|
+
* The body is sent verbatim (no key re-casing): `draft` is scenario JSON
|
|
36205
|
+
* whose nested keys include the user's own feature names.
|
|
36206
|
+
*
|
|
35666
36207
|
* @example
|
|
35667
36208
|
* ```typescript
|
|
35668
36209
|
* // First call -- may need clarification
|
|
@@ -35678,12 +36219,20 @@ var OntologyClient = class {
|
|
|
35678
36219
|
* answers: { priority_levels: '3' },
|
|
35679
36220
|
* });
|
|
35680
36221
|
* }
|
|
36222
|
+
*
|
|
36223
|
+
* // Staged: one stage's patch over the current draft
|
|
36224
|
+
* const step = await client.ontology.generate({
|
|
36225
|
+
* prompt: 'Build a customer support ticket system',
|
|
36226
|
+
* stage: 'sorts',
|
|
36227
|
+
* draft,
|
|
36228
|
+
* });
|
|
36229
|
+
* if (step.status === 'patch') Object.assign(draft, step.patch);
|
|
35681
36230
|
* ```
|
|
35682
36231
|
*/
|
|
35683
36232
|
async generate(request, requestOptions) {
|
|
35684
36233
|
const response = await this.api.generate(
|
|
35685
36234
|
GenerateOntologyRequestFromFrontToApi(request),
|
|
35686
|
-
|
|
36235
|
+
mergeRequestParams({ headers: { [RAW_BODY_HEADER]: "1" } }, requestOptions)
|
|
35687
36236
|
);
|
|
35688
36237
|
return GenerateOntologyResponseFromApiToFront(response.data);
|
|
35689
36238
|
}
|
|
@@ -35883,6 +36432,118 @@ var OntologyClient = class {
|
|
|
35883
36432
|
);
|
|
35884
36433
|
return EnrichOntologyResponseFromApiToFront(response.data);
|
|
35885
36434
|
}
|
|
36435
|
+
/**
|
|
36436
|
+
* Read the ontology's scope.
|
|
36437
|
+
*
|
|
36438
|
+
* @returns The stored scope, or `null` when none has been set.
|
|
36439
|
+
* @throws {ApiError} If the request fails for a reason other than "no scope".
|
|
36440
|
+
*
|
|
36441
|
+
* @remarks
|
|
36442
|
+
* One scope per tenant, or per namespace when `X-Namespace-Id` is sent. The
|
|
36443
|
+
* engine answers 404 when none was set; that is an expected state for a new
|
|
36444
|
+
* ontology, so it reads as `null` rather than an error.
|
|
36445
|
+
*
|
|
36446
|
+
* @example
|
|
36447
|
+
* ```typescript
|
|
36448
|
+
* const scope = await client.ontology.getScope();
|
|
36449
|
+
* if (scope === null) {
|
|
36450
|
+
* // first visit: ask the user what the ontology is for
|
|
36451
|
+
* }
|
|
36452
|
+
* ```
|
|
36453
|
+
*/
|
|
36454
|
+
async getScope(requestOptions) {
|
|
36455
|
+
try {
|
|
36456
|
+
const response = await this.api.getOntologyScope(toRequestParams(requestOptions));
|
|
36457
|
+
return OntologyScopeResponseFromApiToFront(response.data);
|
|
36458
|
+
} catch (error) {
|
|
36459
|
+
if (error instanceof ApiError && error.status === 404) {
|
|
36460
|
+
return null;
|
|
36461
|
+
}
|
|
36462
|
+
throw error;
|
|
36463
|
+
}
|
|
36464
|
+
}
|
|
36465
|
+
/**
|
|
36466
|
+
* Set the ontology's scope, replacing the stored one.
|
|
36467
|
+
*
|
|
36468
|
+
* @param scope - Purpose, coverage, dynamics and write mode.
|
|
36469
|
+
* @returns The stored scope with its provenance.
|
|
36470
|
+
* @throws {BadRequestError} If `purpose` is empty.
|
|
36471
|
+
*
|
|
36472
|
+
* @example
|
|
36473
|
+
* ```typescript
|
|
36474
|
+
* await client.ontology.putScope({
|
|
36475
|
+
* purpose: 'Answer questions about late deliveries',
|
|
36476
|
+
* inScope: ['orders', 'shipments'],
|
|
36477
|
+
* dynamics: 'dynamic',
|
|
36478
|
+
* writeMode: 'append',
|
|
36479
|
+
* });
|
|
36480
|
+
* ```
|
|
36481
|
+
*/
|
|
36482
|
+
async putScope(scope, requestOptions) {
|
|
36483
|
+
const response = await this.api.putOntologyScope(
|
|
36484
|
+
OntologyScopeFromFrontToApi(scope),
|
|
36485
|
+
toRequestParams(requestOptions)
|
|
36486
|
+
);
|
|
36487
|
+
return OntologyScopeResponseFromApiToFront(response.data);
|
|
36488
|
+
}
|
|
36489
|
+
/**
|
|
36490
|
+
* Fetch an embedded upper-ontology seed as OWL RDF/XML.
|
|
36491
|
+
*
|
|
36492
|
+
* @param name - `bfo-2020` or `cco-facility`.
|
|
36493
|
+
* @returns The OWL document, as text.
|
|
36494
|
+
* @throws {NotFoundError} If the name is not an embedded upper ontology.
|
|
36495
|
+
*
|
|
36496
|
+
* @remarks
|
|
36497
|
+
* The same OWL the lattice-grounding aligner uses, offered as an anchor to
|
|
36498
|
+
* reuse rather than reinvent. The response is `application/rdf+xml`, not JSON.
|
|
36499
|
+
*
|
|
36500
|
+
* @example
|
|
36501
|
+
* ```typescript
|
|
36502
|
+
* const owl = await client.ontology.getUpperOntology('bfo-2020');
|
|
36503
|
+
* ```
|
|
36504
|
+
*/
|
|
36505
|
+
async getUpperOntology(name, requestOptions) {
|
|
36506
|
+
const response = await this.api.http.request({
|
|
36507
|
+
...toRequestParams(requestOptions),
|
|
36508
|
+
path: `/api/v1/ontology/upper/${encodeURIComponent(name)}`,
|
|
36509
|
+
method: "GET",
|
|
36510
|
+
format: "text"
|
|
36511
|
+
});
|
|
36512
|
+
return response.data;
|
|
36513
|
+
}
|
|
36514
|
+
/**
|
|
36515
|
+
* Read the state a fluent holds for an entity at an instant.
|
|
36516
|
+
*
|
|
36517
|
+
* @param query - The fluent sort, the entity's term id, and the instant (default now).
|
|
36518
|
+
* @returns The latest fluent term with `validFrom <= at`.
|
|
36519
|
+
* @throws {NotFoundError} If the fluent sort is unknown, or no state was recorded by `at`.
|
|
36520
|
+
* @throws {BadRequestError} If `at` is not RFC 3339.
|
|
36521
|
+
*
|
|
36522
|
+
* @remarks
|
|
36523
|
+
* The engine answers the same 404 for an unknown fluent sort and for an
|
|
36524
|
+
* entity with no state yet, so this throws rather than returning `null`:
|
|
36525
|
+
* the two cannot be told apart.
|
|
36526
|
+
*
|
|
36527
|
+
* @example
|
|
36528
|
+
* ```typescript
|
|
36529
|
+
* const status = await client.ontology.getCurrentFluent({
|
|
36530
|
+
* sort: 'order_status',
|
|
36531
|
+
* of: orderId,
|
|
36532
|
+
* });
|
|
36533
|
+
* console.log(status.value, status.validFrom);
|
|
36534
|
+
* ```
|
|
36535
|
+
*/
|
|
36536
|
+
async getCurrentFluent(query, requestOptions) {
|
|
36537
|
+
const response = await this.api.currentFluentValue(
|
|
36538
|
+
{
|
|
36539
|
+
sort: query.sort,
|
|
36540
|
+
of: query.of,
|
|
36541
|
+
...query.at !== void 0 ? { at: query.at } : {}
|
|
36542
|
+
},
|
|
36543
|
+
toRequestParams(requestOptions)
|
|
36544
|
+
);
|
|
36545
|
+
return CurrentFluentResponseFromApiToFront(response.data);
|
|
36546
|
+
}
|
|
35886
36547
|
};
|
|
35887
36548
|
|
|
35888
36549
|
// src/normalizers/generation.ts
|
|
@@ -38102,6 +38763,7 @@ function UIActionResponseFromApiToFront(dto) {
|
|
|
38102
38763
|
error: dto.error ?? void 0,
|
|
38103
38764
|
pendingReviewId: dto.pending_review_id ?? void 0,
|
|
38104
38765
|
producedTermIds: dto.produced_term_ids,
|
|
38766
|
+
...dto.retracted_term_ids !== void 0 ? { retractedTermIds: dto.retracted_term_ids } : {},
|
|
38105
38767
|
requiresApproval: dto.requires_approval,
|
|
38106
38768
|
requiresConfirmation: dto.requires_confirmation,
|
|
38107
38769
|
retractedTermIds: dto.retracted_term_ids,
|
|
@@ -38479,15 +39141,20 @@ function TurnDtoFromApiToFront(dto) {
|
|
|
38479
39141
|
claimAnnotations: dto.claim_annotations?.map(ClaimAnnotationDtoFromApiToFront),
|
|
38480
39142
|
// Rows go through the same narrowing as the message response, so a reloaded
|
|
38481
39143
|
// turn keeps its table with the same value types a live turn has.
|
|
38482
|
-
queryResults: dto.query_results?.map(osfqlRowFromApiToFront) ?? void 0
|
|
39144
|
+
queryResults: dto.query_results?.map(osfqlRowFromApiToFront) ?? void 0,
|
|
39145
|
+
...dto.payload !== void 0 && dto.payload !== null ? { payload: dto.payload } : {}
|
|
38483
39146
|
};
|
|
38484
39147
|
}
|
|
38485
39148
|
function RecordTurnRequestFromFrontToApi(model) {
|
|
38486
|
-
|
|
39149
|
+
const out = {
|
|
38487
39150
|
role: model.role,
|
|
38488
39151
|
content: model.content,
|
|
38489
39152
|
osfql: model.osfql
|
|
38490
39153
|
};
|
|
39154
|
+
if (model.payload !== void 0) out.payload = model.payload;
|
|
39155
|
+
if (model.conversationKind !== void 0) out.conversation_kind = model.conversationKind;
|
|
39156
|
+
if (model.title !== void 0) out.title = model.title;
|
|
39157
|
+
return out;
|
|
38491
39158
|
}
|
|
38492
39159
|
function RecordTurnResponseFromApiToFront(dto) {
|
|
38493
39160
|
return {
|
|
@@ -38500,7 +39167,9 @@ function ConversationSummaryDtoFromApiToFront(dto) {
|
|
|
38500
39167
|
id: dto.id,
|
|
38501
39168
|
sessionId: dto.session_id ?? void 0,
|
|
38502
39169
|
createdAt: dto.created_at,
|
|
38503
|
-
turnCount: dto.turn_count
|
|
39170
|
+
turnCount: dto.turn_count,
|
|
39171
|
+
...dto.kind != null ? { kind: dto.kind } : {},
|
|
39172
|
+
...dto.title != null ? { title: dto.title } : {}
|
|
38504
39173
|
};
|
|
38505
39174
|
}
|
|
38506
39175
|
function ListConversationsResponseFromApiToFront(dto) {
|
|
@@ -38786,6 +39455,11 @@ var ConversationClient = class {
|
|
|
38786
39455
|
* Request and response bodies use plain JSON scalars; no tagged/untagged value
|
|
38787
39456
|
* serialization is involved. Turns recorded here are returned by {@link getTurns}.
|
|
38788
39457
|
*
|
|
39458
|
+
* `payload` is opaque structured card state (drafts, questions, findings…),
|
|
39459
|
+
* stored verbatim and returned on the turn — so the body is sent without key
|
|
39460
|
+
* re-casing. `conversationKind` and `title` apply when the conversation is
|
|
39461
|
+
* created (`title` also later, while it has none); a surface uses
|
|
39462
|
+
* `conversationKind` to partition the shared history list.
|
|
38789
39463
|
* The engine also offers each turn to the tenant's long-term memory. A turn the
|
|
38790
39464
|
* memory policy refuses (for example text over 500 characters) is still
|
|
38791
39465
|
* recorded and still answers `200`; it only does not enter memory.
|
|
@@ -38804,11 +39478,21 @@ var ConversationClient = class {
|
|
|
38804
39478
|
* content: 'Done — split it into `auth/session.rs` and `auth/token.rs`.',
|
|
38805
39479
|
* osfql: 'MATCH module(name: ?N);',
|
|
38806
39480
|
* });
|
|
39481
|
+
*
|
|
39482
|
+
* // A surface with richer turns: its own history partition and card state.
|
|
39483
|
+
* await client.conversation.recordTurn('new', {
|
|
39484
|
+
* role: 'assistant',
|
|
39485
|
+
* content: 'Here is a draft scope.',
|
|
39486
|
+
* conversationKind: 'guided_ontology',
|
|
39487
|
+
* title: 'Pizza ontology',
|
|
39488
|
+
* payload: { card: 'scope_draft', draft: { purpose: 'Take pizza orders' } },
|
|
39489
|
+
* });
|
|
38807
39490
|
* ```
|
|
38808
39491
|
*/
|
|
38809
39492
|
async recordTurn(conversationId, request, requestOptions) {
|
|
38810
39493
|
const response = await this.http.request({
|
|
38811
39494
|
...toRequestParams(requestOptions),
|
|
39495
|
+
headers: mergeRequestHeaders({ [RAW_BODY_HEADER]: "1" }, requestOptions),
|
|
38812
39496
|
path: `/api/v1/conversation/${encodeURIComponent(conversationId)}/turns`,
|
|
38813
39497
|
method: "POST",
|
|
38814
39498
|
body: RecordTurnRequestFromFrontToApi(request),
|
|
@@ -47364,6 +48048,96 @@ var OntologyExportClient = class {
|
|
|
47364
48048
|
}
|
|
47365
48049
|
};
|
|
47366
48050
|
|
|
48051
|
+
// src/normalizers/argumentation.ts
|
|
48052
|
+
function ArgumentationEvaluateRequestFromFrontToApi(model) {
|
|
48053
|
+
const out = {
|
|
48054
|
+
claims: model.claims.map((c) => ({
|
|
48055
|
+
term_id: c.termId,
|
|
48056
|
+
...c.id !== void 0 ? { id: c.id } : {}
|
|
48057
|
+
}))
|
|
48058
|
+
};
|
|
48059
|
+
if (model.preferences !== void 0) {
|
|
48060
|
+
out.preferences = model.preferences.map((p) => ({ preferred: p.preferred, over: p.over }));
|
|
48061
|
+
}
|
|
48062
|
+
if (model.retracted !== void 0) out.retracted = model.retracted;
|
|
48063
|
+
if (model.enableDerivation !== void 0) out.enable_derivation = model.enableDerivation;
|
|
48064
|
+
if (model.useTenantRules !== void 0) out.use_tenant_rules = model.useTenantRules;
|
|
48065
|
+
if (model.rulesOsfql !== void 0) out.rules_osfql = model.rulesOsfql;
|
|
48066
|
+
if (model.matchThreshold !== void 0) out.match_threshold = model.matchThreshold;
|
|
48067
|
+
return out;
|
|
48068
|
+
}
|
|
48069
|
+
function ArgumentationEvaluateResponseFromApiToFront(dto) {
|
|
48070
|
+
return {
|
|
48071
|
+
arguments: dto.arguments.map((a) => ({
|
|
48072
|
+
id: a.id,
|
|
48073
|
+
index: a.index,
|
|
48074
|
+
termId: a.term_id,
|
|
48075
|
+
text: a.text,
|
|
48076
|
+
label: a.label
|
|
48077
|
+
})),
|
|
48078
|
+
attacks: dto.attacks.map((a) => ({
|
|
48079
|
+
from: a.from,
|
|
48080
|
+
to: a.to,
|
|
48081
|
+
kind: a.kind,
|
|
48082
|
+
reason: a.reason,
|
|
48083
|
+
proved: a.proved
|
|
48084
|
+
})),
|
|
48085
|
+
grounded: {
|
|
48086
|
+
accepted: dto.grounded.accepted,
|
|
48087
|
+
rejected: dto.grounded.rejected,
|
|
48088
|
+
undecided: dto.grounded.undecided
|
|
48089
|
+
},
|
|
48090
|
+
questions: dto.questions.map((q) => ({ a: q.a, b: q.b, prompt: q.prompt })),
|
|
48091
|
+
warnings: dto.warnings ?? []
|
|
48092
|
+
};
|
|
48093
|
+
}
|
|
48094
|
+
|
|
48095
|
+
// src/resources/argumentation.ts
|
|
48096
|
+
var ArgumentationClient = class {
|
|
48097
|
+
/** @internal */
|
|
48098
|
+
api;
|
|
48099
|
+
/** @internal */
|
|
48100
|
+
constructor(api) {
|
|
48101
|
+
this.api = api;
|
|
48102
|
+
}
|
|
48103
|
+
/**
|
|
48104
|
+
* Evaluate a set of claims: label each argument and surface the conflicts
|
|
48105
|
+
* only the user can resolve.
|
|
48106
|
+
*
|
|
48107
|
+
* @param request - The claims, and the resolutions and retractions so far.
|
|
48108
|
+
* @returns Labelled arguments, evidence-carrying attacks, the grounded
|
|
48109
|
+
* extension, and one question per unresolved conflict.
|
|
48110
|
+
* @throws {BadRequestError} 400 when there are no claims, or a term or
|
|
48111
|
+
* preference id is unknown.
|
|
48112
|
+
* @throws {ApiError} 422 when `rulesOsfql` fails to parse, compile, or execute.
|
|
48113
|
+
*
|
|
48114
|
+
* @remarks
|
|
48115
|
+
* Multi-turn: answer a question by adding a {@link ArgumentPreference} and
|
|
48116
|
+
* evaluate again with the same argument ids; each preference deletes one
|
|
48117
|
+
* attack. Plain JSON on the wire — no tagged/untagged value split applies.
|
|
48118
|
+
*
|
|
48119
|
+
* @example
|
|
48120
|
+
* ```typescript
|
|
48121
|
+
* const turn = await client.argumentation.evaluate({
|
|
48122
|
+
* claims: [{ termId: a, id: 'a' }, { termId: b, id: 'b' }],
|
|
48123
|
+
* });
|
|
48124
|
+
* for (const q of turn.questions) console.log(q.prompt);
|
|
48125
|
+
*
|
|
48126
|
+
* const settled = await client.argumentation.evaluate({
|
|
48127
|
+
* claims: [{ termId: a, id: 'a' }, { termId: b, id: 'b' }],
|
|
48128
|
+
* preferences: [{ preferred: 'a', over: 'b' }],
|
|
48129
|
+
* });
|
|
48130
|
+
* ```
|
|
48131
|
+
*/
|
|
48132
|
+
async evaluate(request, requestOptions) {
|
|
48133
|
+
const response = await this.api.evaluateArgumentation(
|
|
48134
|
+
ArgumentationEvaluateRequestFromFrontToApi(request),
|
|
48135
|
+
toRequestParams(requestOptions)
|
|
48136
|
+
);
|
|
48137
|
+
return ArgumentationEvaluateResponseFromApiToFront(response.data);
|
|
48138
|
+
}
|
|
48139
|
+
};
|
|
48140
|
+
|
|
47367
48141
|
// src/normalizers/demo.ts
|
|
47368
48142
|
function DemoSeedRequestFromFrontToApi(model) {
|
|
47369
48143
|
const dto = {};
|
|
@@ -50395,6 +51169,8 @@ var ReasoningLayerClient = class {
|
|
|
50395
51169
|
agui;
|
|
50396
51170
|
/** Ontology export — OWL ontology and SHACL shapes projected from the sort lattice. */
|
|
50397
51171
|
ontologyExport;
|
|
51172
|
+
/** Grounded argumentation — label conflicting claims and surface the questions only the user can settle. */
|
|
51173
|
+
argumentation;
|
|
50398
51174
|
/** Demo substrate seeding — full SUMO + demo scenarios into the tenant substrate. */
|
|
50399
51175
|
demo;
|
|
50400
51176
|
/** Execution-free reward scoring for candidate queries (recall / precision). */
|
|
@@ -50536,7 +51312,8 @@ var ReasoningLayerClient = class {
|
|
|
50536
51312
|
forecast: this.forecast,
|
|
50537
51313
|
corpus: this.corpus,
|
|
50538
51314
|
osfDiff: this.osfDiff,
|
|
50539
|
-
conformance: this.conformance
|
|
51315
|
+
conformance: this.conformance,
|
|
51316
|
+
argumentation: this.argumentation
|
|
50540
51317
|
};
|
|
50541
51318
|
}
|
|
50542
51319
|
/** Data ingestion and extraction operations — documents, sources, collections, images. */
|
|
@@ -50669,6 +51446,7 @@ var ReasoningLayerClient = class {
|
|
|
50669
51446
|
const generatedGuardrail = encodePathParams(new Guardrail(generatedHttp));
|
|
50670
51447
|
const generatedAgui = encodePathParams(new Agui(generatedHttp));
|
|
50671
51448
|
const generatedOntologyExport = encodePathParams(new OntologyExport(generatedHttp));
|
|
51449
|
+
const generatedArgumentation = encodePathParams(new Argumentation(generatedHttp));
|
|
50672
51450
|
this.sorts = new SortsClient(generatedSorts, generatedTypes, resolved.tenantId);
|
|
50673
51451
|
this.terms = new TermsClient(generatedTerms);
|
|
50674
51452
|
this.inference = new InferenceClient(generatedInference, resolved.tenantId);
|
|
@@ -50800,6 +51578,7 @@ var ReasoningLayerClient = class {
|
|
|
50800
51578
|
this.guardrail = new GuardrailClient(generatedGuardrail);
|
|
50801
51579
|
this.agui = new AguiClient(generatedAgui);
|
|
50802
51580
|
this.ontologyExport = new OntologyExportClient(generatedOntologyExport);
|
|
51581
|
+
this.argumentation = new ArgumentationClient(generatedArgumentation);
|
|
50803
51582
|
this.demo = new DemoClient(encodePathParams(new Demo(generatedHttp)));
|
|
50804
51583
|
this.reward = new RewardClient(encodePathParams(new Reward(generatedHttp)));
|
|
50805
51584
|
this.translation = new TranslationClient(
|
|
@@ -51131,6 +51910,9 @@ var speech_exports = {};
|
|
|
51131
51910
|
// src/types/connectors.ts
|
|
51132
51911
|
var connectors_exports = {};
|
|
51133
51912
|
|
|
51913
|
+
// src/types/argumentation.ts
|
|
51914
|
+
var argumentation_exports = {};
|
|
51915
|
+
|
|
51134
51916
|
// src/types/cron.ts
|
|
51135
51917
|
var cron_exports = {};
|
|
51136
51918
|
|
|
@@ -52731,6 +53513,6 @@ function errorBodyCode(error) {
|
|
|
52731
53513
|
return typeof code === "string" ? code : void 0;
|
|
52732
53514
|
}
|
|
52733
53515
|
|
|
52734
|
-
export { ANY_ROLE, AUDIT_CAUSAL_REQUEST_HEADERS, AUDIT_RESPONSE_HEADERS, action_reviews_exports as ActionReviews, actions_exports as Actions, admin_exports as Admin, agui_exports as Agui, analysis_exports as Analysis, anonymization_exports as Anonymization, ApiError, audit_exports as Audit, AuthenticationError, authz_exports as Authz, BadRequestError, batch_exports as Batch, BulkRefusedError, cdl_exports as CDL, causal_exports as Causal, channels_exports as Channels, chase_exports as Chase, cognitive_exports as Cognitive, coherence_exports as Coherence, collections_exports as Collections, communities_exports as Communities, compliance_exports as Compliance, compliance_markings_exports as ComplianceMarkings, conformal_exports as Conformal, conformance_exports as Conformance, connectors_exports as Connectors, Constraint, ConstraintViolationError, constraints_exports as Constraints, control_exports as Control, conversation_exports as Conversation, corpus_exports as Corpus, cron_exports as Cron, dl_exports as DL, DeadlineExceededError, demo_exports as Demo, DerivedFactWriteError, discovery_exports as Discovery, document_check_exports as DocumentCheck, documents_exports as Documents, embeddings_exports as Embeddings, execution_exports as Execution, extract_exports as Extract, feasibility_exports as Feasibility, Flow, flow_networks_exports as FlowNetworks, ForbiddenError, forecast_exports as Forecast, functions_exports as Functions, fuzzy_exports as Fuzzy, FuzzyShape, generation_exports as Generation, Geometry, guardrail_exports as Guardrail, health_exports as Health, homoiconic_exports as Homoiconic, ilp_exports as ILP, image_extraction_exports as ImageExtraction, inbox_exports as Inbox, inference_exports as Inference, ingestion_exports as Ingestion, IngestionBatchSession, IngestionFailedError, IngestionQueueUnavailableError, IngestionSession, IngestionSessionHandle, InternalServerError, LP, ltn_exports as LTN, marketplace_exports as Marketplace, memory_exports as Memory, metrics_exports as Metrics, namespaces_exports as Namespaces, NetworkError, neuro_symbolic_exports as NeuroSymbolic, NotFoundError, ontology_exports as Ontology, ontology_alignment_exports as OntologyAlignment, ontology_bridge_exports as OntologyBridge, ontology_export_exports as OntologyExport, ontology_facade_exports as OntologyFacade, operations_exports as Operations, optimize_exports as Optimize, osf_diff_exports as OsfDiff, osfql_exports as Osfql, OsfqlError, oversight_exports as Oversight, pairing_exports as Pairing, plain_values_exports as PlainValues, platform_exports as Platform, plugins_exports as Plugins, PreconditionFailedError, PreconditionRequiredError, preferences_exports as Preferences, proof_engine_exports as ProofEngine, property_graph_exports as PropertyGraph, query_exports as Query, rag_exports as RAG, RateLimitError, reasoning_exports as Reasoning, ReasoningLayerClient, ReasoningLayerError, research_exports as Research, reviews_exports as Reviews, reward_exports as Reward, row_exports as Row, SDK_VERSION, sat_exports as Sat, scenarios_exports as Scenarios, scheduling_exports as Scheduling, ServiceUnavailableError, smt_exports as Smt, snapshots_exports as Snapshots, solver_exports as Solver, SortBuilder, sorts_exports as Sorts, sources_exports as Sources, spaces_exports as Spaces, sparql_exports as Sparql, speakers_exports as Speakers, speech_exports as Speech, statistical_exports as Statistical, streaming_exports as Streaming, subscriptions_exports as Subscriptions, synthetic_exports as Synthetic, temporal_exports as Temporal, terms_exports as Terms, thomas_exports as Thomas, TimeoutError, translation_exports as Translation, ui_exports as UI, USER_DATA_FIELDS, utilities_exports as Utilities, ValidationError, Value, values_exports as Values, verification_exports as Verification, vision_exports as Vision, visualization_exports as Visualization, WebSocketClient, WebSocketConnection, webhook_actions_exports as WebhookActions, aggregate, allen, bind, causalRequestHeaders, collect, constrained, decodeConversationMessage, discriminateFeatureValue, errorBodyCode, guard, isConstrainedPlainVar, isPsiTermInput, isTaggedValueDto, isUuid, not, paginateByOffset, paginateByPage, psi, readAuditHeaders, readCausalRefusal, sealPreimage, sortDeleteRefusalOf, toTaggedFeatures, toTaggedValue, toTermInputDto, toUntaggedFeatures, toUntaggedValue };
|
|
53516
|
+
export { ANY_ROLE, AUDIT_CAUSAL_REQUEST_HEADERS, AUDIT_RESPONSE_HEADERS, action_reviews_exports as ActionReviews, actions_exports as Actions, admin_exports as Admin, agui_exports as Agui, analysis_exports as Analysis, anonymization_exports as Anonymization, ApiError, argumentation_exports as Argumentation, audit_exports as Audit, AuthenticationError, authz_exports as Authz, BadRequestError, batch_exports as Batch, BulkRefusedError, cdl_exports as CDL, causal_exports as Causal, channels_exports as Channels, chase_exports as Chase, cognitive_exports as Cognitive, coherence_exports as Coherence, collections_exports as Collections, communities_exports as Communities, compliance_exports as Compliance, compliance_markings_exports as ComplianceMarkings, conformal_exports as Conformal, conformance_exports as Conformance, connectors_exports as Connectors, Constraint, ConstraintViolationError, constraints_exports as Constraints, control_exports as Control, conversation_exports as Conversation, corpus_exports as Corpus, cron_exports as Cron, dl_exports as DL, DeadlineExceededError, demo_exports as Demo, DerivedFactWriteError, discovery_exports as Discovery, document_check_exports as DocumentCheck, documents_exports as Documents, embeddings_exports as Embeddings, execution_exports as Execution, extract_exports as Extract, feasibility_exports as Feasibility, Flow, flow_networks_exports as FlowNetworks, ForbiddenError, forecast_exports as Forecast, functions_exports as Functions, fuzzy_exports as Fuzzy, FuzzyShape, generation_exports as Generation, Geometry, guardrail_exports as Guardrail, health_exports as Health, homoiconic_exports as Homoiconic, ilp_exports as ILP, image_extraction_exports as ImageExtraction, inbox_exports as Inbox, inference_exports as Inference, ingestion_exports as Ingestion, IngestionBatchSession, IngestionFailedError, IngestionQueueUnavailableError, IngestionSession, IngestionSessionHandle, InternalServerError, LP, ltn_exports as LTN, marketplace_exports as Marketplace, memory_exports as Memory, metrics_exports as Metrics, NamedConstraintViolationError, namespaces_exports as Namespaces, NetworkError, neuro_symbolic_exports as NeuroSymbolic, NotFoundError, ontology_exports as Ontology, ontology_alignment_exports as OntologyAlignment, ontology_bridge_exports as OntologyBridge, ontology_export_exports as OntologyExport, ontology_facade_exports as OntologyFacade, operations_exports as Operations, optimize_exports as Optimize, osf_diff_exports as OsfDiff, osfql_exports as Osfql, OsfqlError, oversight_exports as Oversight, pairing_exports as Pairing, plain_values_exports as PlainValues, platform_exports as Platform, plugins_exports as Plugins, PreconditionFailedError, PreconditionRequiredError, preferences_exports as Preferences, proof_engine_exports as ProofEngine, property_graph_exports as PropertyGraph, query_exports as Query, rag_exports as RAG, RateLimitError, reasoning_exports as Reasoning, ReasoningLayerClient, ReasoningLayerError, research_exports as Research, reviews_exports as Reviews, reward_exports as Reward, row_exports as Row, SDK_VERSION, sat_exports as Sat, scenarios_exports as Scenarios, scheduling_exports as Scheduling, ServiceUnavailableError, smt_exports as Smt, snapshots_exports as Snapshots, solver_exports as Solver, SortBuilder, sorts_exports as Sorts, sources_exports as Sources, spaces_exports as Spaces, sparql_exports as Sparql, speakers_exports as Speakers, speech_exports as Speech, statistical_exports as Statistical, streaming_exports as Streaming, subscriptions_exports as Subscriptions, synthetic_exports as Synthetic, temporal_exports as Temporal, terms_exports as Terms, thomas_exports as Thomas, TimeoutError, translation_exports as Translation, ui_exports as UI, USER_DATA_FIELDS, utilities_exports as Utilities, ValidationError, Value, values_exports as Values, verification_exports as Verification, vision_exports as Vision, visualization_exports as Visualization, WebSocketClient, WebSocketConnection, webhook_actions_exports as WebhookActions, aggregate, allen, bind, causalRequestHeaders, collect, constrained, decodeConversationMessage, discriminateFeatureValue, errorBodyCode, guard, isConstrainedPlainVar, isPsiTermInput, isTaggedValueDto, isUuid, not, paginateByOffset, paginateByPage, psi, readAuditHeaders, readCausalRefusal, sealPreimage, sortDeleteRefusalOf, toTaggedFeatures, toTaggedValue, toTermInputDto, toUntaggedFeatures, toUntaggedValue };
|
|
52735
53517
|
//# sourceMappingURL=index.js.map
|
|
52736
53518
|
//# sourceMappingURL=index.js.map
|