@kortexya/reasoninglayer 0.2.9 → 0.3.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 +909 -632
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6297 -5001
- package/dist/index.d.ts +6297 -5001
- package/dist/index.js +853 -631
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// src/config.ts
|
|
4
|
-
var SDK_VERSION = "0.
|
|
4
|
+
var SDK_VERSION = "0.3.0";
|
|
5
5
|
function resolveConfig(config) {
|
|
6
6
|
if (!config.baseUrl) {
|
|
7
7
|
throw new Error("ClientConfig.baseUrl is required");
|
|
@@ -54,6 +54,18 @@ var BadRequestError = class extends ApiError {
|
|
|
54
54
|
super(message, 400, body, headers, errorCode);
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
|
+
var AuthenticationError = class extends ApiError {
|
|
58
|
+
name = "AuthenticationError";
|
|
59
|
+
constructor(message, body, headers, errorCode) {
|
|
60
|
+
super(message, 401, body, headers, errorCode);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var ForbiddenError = class extends ApiError {
|
|
64
|
+
name = "ForbiddenError";
|
|
65
|
+
constructor(message, body, headers, errorCode) {
|
|
66
|
+
super(message, 403, body, headers, errorCode);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
57
69
|
var NotFoundError = class extends ApiError {
|
|
58
70
|
name = "NotFoundError";
|
|
59
71
|
constructor(message, body, headers, errorCode) {
|
|
@@ -139,6 +151,10 @@ function createApiError(status, body, headers) {
|
|
|
139
151
|
switch (status) {
|
|
140
152
|
case 400:
|
|
141
153
|
return new BadRequestError(message, body, headers, errorCode);
|
|
154
|
+
case 401:
|
|
155
|
+
return new AuthenticationError(message, body, headers, errorCode);
|
|
156
|
+
case 403:
|
|
157
|
+
return new ForbiddenError(message, body, headers, errorCode);
|
|
142
158
|
case 404:
|
|
143
159
|
return new NotFoundError(message, body, headers, errorCode);
|
|
144
160
|
case 409: {
|
|
@@ -356,7 +372,8 @@ var WebSocketClient = class {
|
|
|
356
372
|
const queryParams = new URLSearchParams({ tenant_id: this.config.tenantId });
|
|
357
373
|
if (params) {
|
|
358
374
|
for (const [key, value] of Object.entries(params)) {
|
|
359
|
-
|
|
375
|
+
const wireKey = key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
|
|
376
|
+
queryParams.set(wireKey, value);
|
|
360
377
|
}
|
|
361
378
|
}
|
|
362
379
|
return `${baseUrl}${path}?${queryParams.toString()}`;
|
|
@@ -508,6 +525,45 @@ var HttpClient = class {
|
|
|
508
525
|
};
|
|
509
526
|
};
|
|
510
527
|
|
|
528
|
+
// src/serialization.ts
|
|
529
|
+
function camelToSnake(str) {
|
|
530
|
+
return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
|
|
531
|
+
}
|
|
532
|
+
function snakeToCamel(str) {
|
|
533
|
+
return str.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
534
|
+
}
|
|
535
|
+
function isPlainObject(value) {
|
|
536
|
+
if (value === null || typeof value !== "object") return false;
|
|
537
|
+
const proto = Object.getPrototypeOf(value);
|
|
538
|
+
return proto === Object.prototype || proto === null;
|
|
539
|
+
}
|
|
540
|
+
function toSnakeCase(input) {
|
|
541
|
+
if (Array.isArray(input)) {
|
|
542
|
+
return input.map((item) => toSnakeCase(item));
|
|
543
|
+
}
|
|
544
|
+
if (!isPlainObject(input)) {
|
|
545
|
+
return input;
|
|
546
|
+
}
|
|
547
|
+
const result = {};
|
|
548
|
+
for (const key of Object.keys(input)) {
|
|
549
|
+
result[camelToSnake(key)] = toSnakeCase(input[key]);
|
|
550
|
+
}
|
|
551
|
+
return result;
|
|
552
|
+
}
|
|
553
|
+
function toCamelCase(input) {
|
|
554
|
+
if (Array.isArray(input)) {
|
|
555
|
+
return input.map((item) => toCamelCase(item));
|
|
556
|
+
}
|
|
557
|
+
if (!isPlainObject(input)) {
|
|
558
|
+
return input;
|
|
559
|
+
}
|
|
560
|
+
const result = {};
|
|
561
|
+
for (const key of Object.keys(input)) {
|
|
562
|
+
result[snakeToCamel(key)] = toCamelCase(input[key]);
|
|
563
|
+
}
|
|
564
|
+
return result;
|
|
565
|
+
}
|
|
566
|
+
|
|
511
567
|
// src/generated-bridge.ts
|
|
512
568
|
function createGeneratedHttpClient(config) {
|
|
513
569
|
return new HttpClient({
|
|
@@ -529,8 +585,40 @@ function buildAuthHeaders(config) {
|
|
|
529
585
|
if (config.authenticatedUser) headers["X-Authenticated-User"] = config.authenticatedUser;
|
|
530
586
|
return headers;
|
|
531
587
|
}
|
|
588
|
+
function transformRequestInit(init) {
|
|
589
|
+
if (!init?.body || typeof init.body !== "string") return init;
|
|
590
|
+
try {
|
|
591
|
+
const parsed = JSON.parse(init.body);
|
|
592
|
+
const snaked = toSnakeCase(parsed);
|
|
593
|
+
return { ...init, body: JSON.stringify(snaked) };
|
|
594
|
+
} catch {
|
|
595
|
+
return init;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
async function wrapResponseWithCamelCase(response) {
|
|
599
|
+
if (response.status === 204 || response.status === 304) {
|
|
600
|
+
return new Response(null, {
|
|
601
|
+
status: response.status,
|
|
602
|
+
statusText: response.statusText,
|
|
603
|
+
headers: response.headers
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
const text = await response.text();
|
|
607
|
+
let transformedBody = text;
|
|
608
|
+
try {
|
|
609
|
+
const parsed = JSON.parse(text);
|
|
610
|
+
transformedBody = JSON.stringify(toCamelCase(parsed));
|
|
611
|
+
} catch {
|
|
612
|
+
}
|
|
613
|
+
return new Response(transformedBody, {
|
|
614
|
+
status: response.status,
|
|
615
|
+
statusText: response.statusText,
|
|
616
|
+
headers: response.headers
|
|
617
|
+
});
|
|
618
|
+
}
|
|
532
619
|
function createCustomFetch(config) {
|
|
533
620
|
return async (input, init) => {
|
|
621
|
+
const transformedInit = transformRequestInit(init);
|
|
534
622
|
const maxRetries = config.maxRetries;
|
|
535
623
|
const timeoutMs = config.timeoutMs;
|
|
536
624
|
let lastError;
|
|
@@ -539,8 +627,8 @@ function createCustomFetch(config) {
|
|
|
539
627
|
await sleep(calculateRetryDelay(attempt, lastError));
|
|
540
628
|
}
|
|
541
629
|
try {
|
|
542
|
-
const response = await executeFetch(input,
|
|
543
|
-
if (response.ok) return response;
|
|
630
|
+
const response = await executeFetch(input, transformedInit, timeoutMs, config);
|
|
631
|
+
if (response.ok) return await wrapResponseWithCamelCase(response);
|
|
544
632
|
let body;
|
|
545
633
|
try {
|
|
546
634
|
body = await response.clone().json();
|
|
@@ -7164,6 +7252,20 @@ var Admin = class {
|
|
|
7164
7252
|
format: "json",
|
|
7165
7253
|
...params
|
|
7166
7254
|
});
|
|
7255
|
+
/**
|
|
7256
|
+
* @description Destructive operation that wipes all PostgreSQL rows, in-memory inference state, and cache entries for the specified tenant. Other tenants are unaffected. Use for tenant offboarding or testing.
|
|
7257
|
+
*
|
|
7258
|
+
* @tags admin
|
|
7259
|
+
* @name ClearTenantData
|
|
7260
|
+
* @summary Clear all data for a specific tenant
|
|
7261
|
+
* @request POST:/api/v1/admin/clear-tenant/{tenant_id}
|
|
7262
|
+
*/
|
|
7263
|
+
clearTenantData = (tenantId, params = {}) => this.http.request({
|
|
7264
|
+
path: `/api/v1/admin/clear-tenant/${tenantId}`,
|
|
7265
|
+
method: "POST",
|
|
7266
|
+
format: "json",
|
|
7267
|
+
...params
|
|
7268
|
+
});
|
|
7167
7269
|
/**
|
|
7168
7270
|
* @description Returns all tenant IDs that have terms or ingestion sessions, with counts. No X-Tenant-Id header required. Works in both PostgreSQL and in-memory modes.
|
|
7169
7271
|
*
|
|
@@ -7358,7 +7460,7 @@ var SortsClient = class {
|
|
|
7358
7460
|
*/
|
|
7359
7461
|
async isSubtype(childId, parentId) {
|
|
7360
7462
|
const response = await this.sorts.isSubtype(childId, parentId);
|
|
7361
|
-
return response.data.
|
|
7463
|
+
return response.data.isSubtype;
|
|
7362
7464
|
}
|
|
7363
7465
|
/**
|
|
7364
7466
|
* Compute the Greatest Lower Bound (GLB) of two sorts — the most specific type
|
|
@@ -7405,7 +7507,7 @@ var SortsClient = class {
|
|
|
7405
7507
|
* @see computeGlb
|
|
7406
7508
|
*/
|
|
7407
7509
|
async findCommonSubtype(sortId1, sortId2) {
|
|
7408
|
-
return this.computeGlb({
|
|
7510
|
+
return this.computeGlb({ sort1Id: sortId1, sort2Id: sortId2 });
|
|
7409
7511
|
}
|
|
7410
7512
|
/**
|
|
7411
7513
|
* Find the most general type that covers both types.
|
|
@@ -7417,7 +7519,7 @@ var SortsClient = class {
|
|
|
7417
7519
|
* @see computeLub
|
|
7418
7520
|
*/
|
|
7419
7521
|
async findCommonSupertype(sortId1, sortId2) {
|
|
7420
|
-
return this.computeLub({
|
|
7522
|
+
return this.computeLub({ sort1Id: sortId1, sort2Id: sortId2 });
|
|
7421
7523
|
}
|
|
7422
7524
|
/**
|
|
7423
7525
|
* Get a human-readable explanation of how two types relate.
|
|
@@ -7429,7 +7531,7 @@ var SortsClient = class {
|
|
|
7429
7531
|
* @see decodeGlb
|
|
7430
7532
|
*/
|
|
7431
7533
|
async explainCommonSubtype(sortId1, sortId2) {
|
|
7432
|
-
return this.decodeGlb({
|
|
7534
|
+
return this.decodeGlb({ sort1Id: sortId1, sort2Id: sortId2 });
|
|
7433
7535
|
}
|
|
7434
7536
|
/**
|
|
7435
7537
|
* Get direct children of a sort.
|
|
@@ -7489,7 +7591,7 @@ var SortsClient = class {
|
|
|
7489
7591
|
* @returns Comparison result.
|
|
7490
7592
|
*/
|
|
7491
7593
|
async compareSorts(request) {
|
|
7492
|
-
const response = await this.types.compareSorts({ ...request,
|
|
7594
|
+
const response = await this.types.compareSorts({ ...request, tenantId: this.tenantId });
|
|
7493
7595
|
return response.data;
|
|
7494
7596
|
}
|
|
7495
7597
|
/**
|
|
@@ -7522,8 +7624,8 @@ var SortsClient = class {
|
|
|
7522
7624
|
* @example
|
|
7523
7625
|
* ```typescript
|
|
7524
7626
|
* const result = await client.sorts.getSortSimilarity({
|
|
7525
|
-
*
|
|
7526
|
-
*
|
|
7627
|
+
* sort1Id: 'uuid-1',
|
|
7628
|
+
* sort2Id: 'uuid-2',
|
|
7527
7629
|
* });
|
|
7528
7630
|
* console.log(result.degree); // 0.85
|
|
7529
7631
|
* ```
|
|
@@ -7547,8 +7649,8 @@ var SortsClient = class {
|
|
|
7547
7649
|
* @example
|
|
7548
7650
|
* ```typescript
|
|
7549
7651
|
* const result = await client.sorts.setSortSimilarity({
|
|
7550
|
-
*
|
|
7551
|
-
*
|
|
7652
|
+
* sort1Id: 'uuid-1',
|
|
7653
|
+
* sort2Id: 'uuid-2',
|
|
7552
7654
|
* degree: 0.85,
|
|
7553
7655
|
* });
|
|
7554
7656
|
* console.log(result.success); // true
|
|
@@ -7574,11 +7676,11 @@ var SortsClient = class {
|
|
|
7574
7676
|
* ```typescript
|
|
7575
7677
|
* const result = await client.sorts.bulkSetSimilarities({
|
|
7576
7678
|
* similarities: [
|
|
7577
|
-
* {
|
|
7578
|
-
* {
|
|
7679
|
+
* { sort1Id: 'uuid-1', sort2Id: 'uuid-2', degree: 0.85 },
|
|
7680
|
+
* { sort1Id: 'uuid-3', sort2Id: 'uuid-4', degree: 0.70 },
|
|
7579
7681
|
* ],
|
|
7580
7682
|
* });
|
|
7581
|
-
* console.log(result.
|
|
7683
|
+
* console.log(result.setCount); // 2
|
|
7582
7684
|
* ```
|
|
7583
7685
|
*/
|
|
7584
7686
|
async bulkSetSimilarities(request) {
|
|
@@ -7606,8 +7708,8 @@ var SortsClient = class {
|
|
|
7606
7708
|
* @example
|
|
7607
7709
|
* ```typescript
|
|
7608
7710
|
* const result = await client.sorts.getPreorderDegree({
|
|
7609
|
-
*
|
|
7610
|
-
*
|
|
7711
|
+
* sort1Id: 'uuid-1',
|
|
7712
|
+
* sort2Id: 'uuid-2',
|
|
7611
7713
|
* });
|
|
7612
7714
|
* console.log(result.degree); // 0.72
|
|
7613
7715
|
* ```
|
|
@@ -7631,8 +7733,8 @@ var SortsClient = class {
|
|
|
7631
7733
|
* @example
|
|
7632
7734
|
* ```typescript
|
|
7633
7735
|
* const result = await client.sorts.getEquivalenceClasses();
|
|
7634
|
-
* for (const ec of result.
|
|
7635
|
-
* console.log(`Class of ${ec.size} sorts:`, ec.
|
|
7736
|
+
* for (const ec of result.equivalenceClasses) {
|
|
7737
|
+
* console.log(`Class of ${ec.size} sorts:`, ec.sortIds);
|
|
7636
7738
|
* }
|
|
7637
7739
|
* ```
|
|
7638
7740
|
*/
|
|
@@ -7680,8 +7782,147 @@ var SortsClient = class {
|
|
|
7680
7782
|
const response = await this.sorts.rejectLearnedSimilarity(request);
|
|
7681
7783
|
return response.data;
|
|
7682
7784
|
}
|
|
7785
|
+
// ─── Friendly Aliases ─────────────────────────────────────────────
|
|
7786
|
+
/**
|
|
7787
|
+
* Create multiple types in a single request.
|
|
7788
|
+
* Alias for {@link bulkCreateSorts}.
|
|
7789
|
+
*
|
|
7790
|
+
* @param request - Bulk sort definitions.
|
|
7791
|
+
* @returns Bulk creation result.
|
|
7792
|
+
*
|
|
7793
|
+
* @see bulkCreateSorts
|
|
7794
|
+
*/
|
|
7795
|
+
async createMany(request) {
|
|
7796
|
+
return this.bulkCreateSorts(request);
|
|
7797
|
+
}
|
|
7683
7798
|
};
|
|
7684
7799
|
|
|
7800
|
+
// src/utils/convert.ts
|
|
7801
|
+
var TAGGED_VALUE_TYPES = /* @__PURE__ */ new Set([
|
|
7802
|
+
"String",
|
|
7803
|
+
"Integer",
|
|
7804
|
+
"Real",
|
|
7805
|
+
"Boolean",
|
|
7806
|
+
"Uninstantiated",
|
|
7807
|
+
"Reference",
|
|
7808
|
+
"List",
|
|
7809
|
+
"FuzzyScalar",
|
|
7810
|
+
"FuzzyNumber",
|
|
7811
|
+
"Set"
|
|
7812
|
+
]);
|
|
7813
|
+
function isPsiTermInput(value) {
|
|
7814
|
+
return typeof value === "object" && value !== null && "__psiTerm" in value && value.__psiTerm === true;
|
|
7815
|
+
}
|
|
7816
|
+
function isConstrainedPlainVar(value) {
|
|
7817
|
+
return typeof value === "object" && value !== null && "__constrainedVar" in value && value.__constrainedVar === true;
|
|
7818
|
+
}
|
|
7819
|
+
function isTaggedValueDto(value) {
|
|
7820
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
7821
|
+
const obj = value;
|
|
7822
|
+
return typeof obj.type === "string" && TAGGED_VALUE_TYPES.has(obj.type);
|
|
7823
|
+
}
|
|
7824
|
+
function toTaggedValue(value) {
|
|
7825
|
+
if (value === null) {
|
|
7826
|
+
return { type: "Uninstantiated" };
|
|
7827
|
+
}
|
|
7828
|
+
if (typeof value === "string") {
|
|
7829
|
+
return { type: "String", value };
|
|
7830
|
+
}
|
|
7831
|
+
if (typeof value === "number") {
|
|
7832
|
+
return Number.isInteger(value) ? { type: "Integer", value } : { type: "Real", value };
|
|
7833
|
+
}
|
|
7834
|
+
if (typeof value === "boolean") {
|
|
7835
|
+
return { type: "Boolean", value };
|
|
7836
|
+
}
|
|
7837
|
+
if (Array.isArray(value)) {
|
|
7838
|
+
return { type: "List", value: value.map(toTaggedValue) };
|
|
7839
|
+
}
|
|
7840
|
+
if (isPsiTermInput(value)) {
|
|
7841
|
+
throw new ValidationError(
|
|
7842
|
+
"PsiTermInput cannot be used in tagged value format (term CRUD). Use Value.reference(termId) to reference another term."
|
|
7843
|
+
);
|
|
7844
|
+
}
|
|
7845
|
+
if (isConstrainedPlainVar(value)) {
|
|
7846
|
+
throw new ValidationError(
|
|
7847
|
+
"ConstrainedPlainVar cannot be used in tagged value format (term CRUD). Constrained variables are only valid in inference contexts."
|
|
7848
|
+
);
|
|
7849
|
+
}
|
|
7850
|
+
if (isTaggedValueDto(value)) {
|
|
7851
|
+
return value;
|
|
7852
|
+
}
|
|
7853
|
+
throw new ValidationError(
|
|
7854
|
+
`Cannot convert value to tagged ValueDto format: ${JSON.stringify(value)}. Use plain JS values (string, number, boolean, null) or Value.* builders.`
|
|
7855
|
+
);
|
|
7856
|
+
}
|
|
7857
|
+
function toTaggedFeatures(features) {
|
|
7858
|
+
const result = {};
|
|
7859
|
+
for (const [key, value] of Object.entries(features)) {
|
|
7860
|
+
result[key] = toTaggedValue(value);
|
|
7861
|
+
}
|
|
7862
|
+
return result;
|
|
7863
|
+
}
|
|
7864
|
+
var VARIABLE_PATTERN = /^\?[A-Z]/;
|
|
7865
|
+
var REFERENCE_PATTERN = /^!/;
|
|
7866
|
+
function toUntaggedValue(value) {
|
|
7867
|
+
if (value === null) {
|
|
7868
|
+
return null;
|
|
7869
|
+
}
|
|
7870
|
+
if (typeof value === "string") {
|
|
7871
|
+
if (VARIABLE_PATTERN.test(value)) {
|
|
7872
|
+
return { name: value };
|
|
7873
|
+
}
|
|
7874
|
+
if (REFERENCE_PATTERN.test(value)) {
|
|
7875
|
+
return { termId: value.slice(1) };
|
|
7876
|
+
}
|
|
7877
|
+
return value;
|
|
7878
|
+
}
|
|
7879
|
+
if (typeof value === "number") {
|
|
7880
|
+
return value;
|
|
7881
|
+
}
|
|
7882
|
+
if (typeof value === "boolean") {
|
|
7883
|
+
return value;
|
|
7884
|
+
}
|
|
7885
|
+
if (Array.isArray(value)) {
|
|
7886
|
+
return value.map(toUntaggedValue);
|
|
7887
|
+
}
|
|
7888
|
+
if (isConstrainedPlainVar(value)) {
|
|
7889
|
+
const constraint = isPsiTermInput(value.constraint) ? toTermInputDto(value.constraint) : value.constraint;
|
|
7890
|
+
return { name: value.name, constraint };
|
|
7891
|
+
}
|
|
7892
|
+
if (isPsiTermInput(value)) {
|
|
7893
|
+
if (!value.features) {
|
|
7894
|
+
return { sortName: value.sortName };
|
|
7895
|
+
}
|
|
7896
|
+
return {
|
|
7897
|
+
sortName: value.sortName,
|
|
7898
|
+
features: toUntaggedFeatures(value.features)
|
|
7899
|
+
};
|
|
7900
|
+
}
|
|
7901
|
+
if (isTaggedValueDto(value)) {
|
|
7902
|
+
return value;
|
|
7903
|
+
}
|
|
7904
|
+
return value;
|
|
7905
|
+
}
|
|
7906
|
+
function toUntaggedFeatures(features) {
|
|
7907
|
+
const result = {};
|
|
7908
|
+
for (const [key, value] of Object.entries(features)) {
|
|
7909
|
+
result[key] = toUntaggedValue(value);
|
|
7910
|
+
}
|
|
7911
|
+
return result;
|
|
7912
|
+
}
|
|
7913
|
+
function toTermInputDto(input) {
|
|
7914
|
+
if (!isPsiTermInput(input)) {
|
|
7915
|
+
return input;
|
|
7916
|
+
}
|
|
7917
|
+
if (!input.features) {
|
|
7918
|
+
return { sortName: input.sortName };
|
|
7919
|
+
}
|
|
7920
|
+
return {
|
|
7921
|
+
sortName: input.sortName,
|
|
7922
|
+
features: toUntaggedFeatures(input.features)
|
|
7923
|
+
};
|
|
7924
|
+
}
|
|
7925
|
+
|
|
7685
7926
|
// src/resources/terms.ts
|
|
7686
7927
|
var TermsClient = class {
|
|
7687
7928
|
/** @internal */
|
|
@@ -7693,11 +7934,44 @@ var TermsClient = class {
|
|
|
7693
7934
|
/**
|
|
7694
7935
|
* Create a new record.
|
|
7695
7936
|
*
|
|
7696
|
-
* @param request - Term creation parameters.
|
|
7937
|
+
* @param request - Term creation parameters. Features can be plain JS values
|
|
7938
|
+
* (auto-converted to tagged `ValueDto`) or explicit `Value.*` builder output.
|
|
7697
7939
|
* @returns The created term with validation state.
|
|
7940
|
+
*
|
|
7941
|
+
* @remarks
|
|
7942
|
+
* **Serialization format: Tagged (`ValueDto`).**
|
|
7943
|
+
*
|
|
7944
|
+
* Plain value conversion:
|
|
7945
|
+
* - `string` → `{ type: "String", value: "..." }`
|
|
7946
|
+
* - `number` → `{ type: "Integer" | "Real", value: n }`
|
|
7947
|
+
* - `boolean` → `{ type: "Boolean", value: b }`
|
|
7948
|
+
* - `null` → `{ type: "Uninstantiated" }`
|
|
7949
|
+
* - `[...]` → `{ type: "List", value: [...] }`
|
|
7950
|
+
* - Existing `Value.*` output passes through unchanged.
|
|
7951
|
+
*
|
|
7952
|
+
* @example
|
|
7953
|
+
* ```typescript
|
|
7954
|
+
* // Plain values (recommended):
|
|
7955
|
+
* await client.terms.createTerm({
|
|
7956
|
+
* sortId: "sort-uuid",
|
|
7957
|
+
* ownerId: "owner-uuid",
|
|
7958
|
+
* features: { name: "Alice", age: 30, active: true },
|
|
7959
|
+
* });
|
|
7960
|
+
*
|
|
7961
|
+
* // Explicit Value builders (still works):
|
|
7962
|
+
* await client.terms.createTerm({
|
|
7963
|
+
* sortId: "sort-uuid",
|
|
7964
|
+
* ownerId: "owner-uuid",
|
|
7965
|
+
* features: { name: Value.string("Alice") },
|
|
7966
|
+
* });
|
|
7967
|
+
* ```
|
|
7698
7968
|
*/
|
|
7699
7969
|
async createTerm(request) {
|
|
7700
|
-
const
|
|
7970
|
+
const wireRequest = {
|
|
7971
|
+
...request,
|
|
7972
|
+
features: convertFeatures(request.features)
|
|
7973
|
+
};
|
|
7974
|
+
const response = await this.api.addTerm(wireRequest);
|
|
7701
7975
|
return response.data;
|
|
7702
7976
|
}
|
|
7703
7977
|
/**
|
|
@@ -7718,7 +7992,11 @@ var TermsClient = class {
|
|
|
7718
7992
|
* @returns The updated term with validation state.
|
|
7719
7993
|
*/
|
|
7720
7994
|
async updateTerm(termId, request) {
|
|
7721
|
-
const
|
|
7995
|
+
const wireRequest = {
|
|
7996
|
+
...request,
|
|
7997
|
+
features: convertFeatures(request.features)
|
|
7998
|
+
};
|
|
7999
|
+
const response = await this.api.updateTerm(termId, wireRequest);
|
|
7722
8000
|
return response.data;
|
|
7723
8001
|
}
|
|
7724
8002
|
/**
|
|
@@ -7754,7 +8032,13 @@ var TermsClient = class {
|
|
|
7754
8032
|
* @returns Bulk creation result with term UUIDs.
|
|
7755
8033
|
*/
|
|
7756
8034
|
async bulkCreateTerms(request) {
|
|
7757
|
-
const
|
|
8035
|
+
const wireRequest = {
|
|
8036
|
+
terms: request.terms.map((t) => ({
|
|
8037
|
+
...t,
|
|
8038
|
+
features: convertFeatures(t.features)
|
|
8039
|
+
}))
|
|
8040
|
+
};
|
|
8041
|
+
const response = await this.api.bulkAddTerms(wireRequest);
|
|
7758
8042
|
return response.data;
|
|
7759
8043
|
}
|
|
7760
8044
|
/**
|
|
@@ -7773,7 +8057,7 @@ var TermsClient = class {
|
|
|
7773
8057
|
* const result = await client.terms.listTerms();
|
|
7774
8058
|
* console.log(`Found ${result.count} terms`);
|
|
7775
8059
|
* for (const term of result.terms) {
|
|
7776
|
-
* console.log(term.id, term.
|
|
8060
|
+
* console.log(term.id, term.sortName);
|
|
7777
8061
|
* }
|
|
7778
8062
|
* ```
|
|
7779
8063
|
*/
|
|
@@ -7795,14 +8079,34 @@ var TermsClient = class {
|
|
|
7795
8079
|
* @example
|
|
7796
8080
|
* ```typescript
|
|
7797
8081
|
* const result = await client.terms.clearTerms();
|
|
7798
|
-
* console.log(`${result.
|
|
8082
|
+
* console.log(`${result.termsCleared} terms cleared`);
|
|
7799
8083
|
* ```
|
|
7800
8084
|
*/
|
|
7801
8085
|
async clearTerms() {
|
|
7802
8086
|
const response = await this.api.clearTerms();
|
|
7803
8087
|
return response.data;
|
|
7804
8088
|
}
|
|
8089
|
+
// ─── Friendly Aliases ─────────────────────────────────────────────
|
|
8090
|
+
/**
|
|
8091
|
+
* Create multiple records in a single request.
|
|
8092
|
+
* Alias for {@link bulkCreateTerms}.
|
|
8093
|
+
*
|
|
8094
|
+
* @param request - Bulk creation request.
|
|
8095
|
+
* @returns Bulk creation result with term UUIDs.
|
|
8096
|
+
*
|
|
8097
|
+
* @see bulkCreateTerms
|
|
8098
|
+
*/
|
|
8099
|
+
async createMany(request) {
|
|
8100
|
+
return this.bulkCreateTerms(request);
|
|
8101
|
+
}
|
|
7805
8102
|
};
|
|
8103
|
+
function convertFeatures(features) {
|
|
8104
|
+
const values = Object.values(features);
|
|
8105
|
+
if (values.length > 0 && values.every(isTaggedValueDto)) {
|
|
8106
|
+
return features;
|
|
8107
|
+
}
|
|
8108
|
+
return toTaggedFeatures(features);
|
|
8109
|
+
}
|
|
7806
8110
|
|
|
7807
8111
|
// src/resources/inference.ts
|
|
7808
8112
|
var InferenceClient = class {
|
|
@@ -7822,7 +8126,12 @@ var InferenceClient = class {
|
|
|
7822
8126
|
* @returns The created rule wrapped in an AddRuleResponse.
|
|
7823
8127
|
*/
|
|
7824
8128
|
async addRule(request) {
|
|
7825
|
-
const
|
|
8129
|
+
const wireRequest = {
|
|
8130
|
+
term: convertTermArg(request.term),
|
|
8131
|
+
antecedents: request.antecedents?.map(convertTermArg),
|
|
8132
|
+
certainty: request.certainty
|
|
8133
|
+
};
|
|
8134
|
+
const response = await this.api.addRule(wireRequest);
|
|
7826
8135
|
return response.data;
|
|
7827
8136
|
}
|
|
7828
8137
|
/**
|
|
@@ -7832,7 +8141,10 @@ var InferenceClient = class {
|
|
|
7832
8141
|
* @returns The created fact wrapped in an AddFactResponse.
|
|
7833
8142
|
*/
|
|
7834
8143
|
async addFact(request) {
|
|
7835
|
-
const
|
|
8144
|
+
const wireRequest = {
|
|
8145
|
+
term: convertTermArg(request.term)
|
|
8146
|
+
};
|
|
8147
|
+
const response = await this.api.addFact(wireRequest);
|
|
7836
8148
|
return response.data;
|
|
7837
8149
|
}
|
|
7838
8150
|
/**
|
|
@@ -7842,7 +8154,14 @@ var InferenceClient = class {
|
|
|
7842
8154
|
* @returns Bulk creation result with rule_term_ids and rules_added count.
|
|
7843
8155
|
*/
|
|
7844
8156
|
async bulkAddRules(request) {
|
|
7845
|
-
const
|
|
8157
|
+
const wireRequest = {
|
|
8158
|
+
rules: request.rules.map((r) => ({
|
|
8159
|
+
term: convertTermArg(r.term),
|
|
8160
|
+
antecedents: r.antecedents?.map(convertTermArg),
|
|
8161
|
+
certainty: r.certainty
|
|
8162
|
+
}))
|
|
8163
|
+
};
|
|
8164
|
+
const response = await this.api.bulkAddRules(wireRequest);
|
|
7846
8165
|
return response.data;
|
|
7847
8166
|
}
|
|
7848
8167
|
/**
|
|
@@ -7852,7 +8171,10 @@ var InferenceClient = class {
|
|
|
7852
8171
|
* @returns Bulk creation result with term_ids and facts_added count.
|
|
7853
8172
|
*/
|
|
7854
8173
|
async bulkAddFacts(request) {
|
|
7855
|
-
const
|
|
8174
|
+
const wireRequest = {
|
|
8175
|
+
facts: request.facts.map(convertTermArg)
|
|
8176
|
+
};
|
|
8177
|
+
const response = await this.api.bulkAddFacts(wireRequest);
|
|
7856
8178
|
return response.data;
|
|
7857
8179
|
}
|
|
7858
8180
|
/**
|
|
@@ -7887,7 +8209,11 @@ var InferenceClient = class {
|
|
|
7887
8209
|
* When it fires, the backend returns whatever solutions have been found so far.
|
|
7888
8210
|
*/
|
|
7889
8211
|
async backwardChain(request) {
|
|
7890
|
-
const
|
|
8212
|
+
const wireRequest = {
|
|
8213
|
+
...request,
|
|
8214
|
+
goal: request.goal ? convertTermArg(request.goal) : request.goal
|
|
8215
|
+
};
|
|
8216
|
+
const response = await this.api.backwardChain(wireRequest);
|
|
7891
8217
|
return response.data;
|
|
7892
8218
|
}
|
|
7893
8219
|
/**
|
|
@@ -7903,7 +8229,11 @@ var InferenceClient = class {
|
|
|
7903
8229
|
* If `persist_derived` is true, derived facts are permanently saved to the database.
|
|
7904
8230
|
*/
|
|
7905
8231
|
async forwardChain(request) {
|
|
7906
|
-
const
|
|
8232
|
+
const wireRequest = {
|
|
8233
|
+
...request,
|
|
8234
|
+
initialFacts: request.initialFacts?.map(convertTermArg)
|
|
8235
|
+
};
|
|
8236
|
+
const response = await this.api.forwardChain(wireRequest);
|
|
7907
8237
|
return response.data;
|
|
7908
8238
|
}
|
|
7909
8239
|
/**
|
|
@@ -7927,7 +8257,11 @@ var InferenceClient = class {
|
|
|
7927
8257
|
* @returns Fuzzy solutions with truth degrees.
|
|
7928
8258
|
*/
|
|
7929
8259
|
async fuzzyProve(request) {
|
|
7930
|
-
const
|
|
8260
|
+
const wireRequest = {
|
|
8261
|
+
...request,
|
|
8262
|
+
goal: request.goal ? convertTermArg(request.goal) : request.goal
|
|
8263
|
+
};
|
|
8264
|
+
const response = await this.api.fuzzyProve(wireRequest);
|
|
7931
8265
|
return response.data;
|
|
7932
8266
|
}
|
|
7933
8267
|
/**
|
|
@@ -7940,7 +8274,11 @@ var InferenceClient = class {
|
|
|
7940
8274
|
* Reduces latency via single HTTP round-trip, shared hierarchy, and rules across all goals.
|
|
7941
8275
|
*/
|
|
7942
8276
|
async bulkFuzzyProve(request) {
|
|
7943
|
-
const
|
|
8277
|
+
const wireRequest = {
|
|
8278
|
+
...request,
|
|
8279
|
+
goals: request.goals?.map(convertTermArg)
|
|
8280
|
+
};
|
|
8281
|
+
const response = await this.api.bulkFuzzyProve(wireRequest);
|
|
7944
8282
|
return response.data;
|
|
7945
8283
|
}
|
|
7946
8284
|
/**
|
|
@@ -7950,7 +8288,11 @@ var InferenceClient = class {
|
|
|
7950
8288
|
* @returns Predictions with posterior probabilities.
|
|
7951
8289
|
*/
|
|
7952
8290
|
async bayesianPredict(request) {
|
|
7953
|
-
const
|
|
8291
|
+
const wireRequest = {
|
|
8292
|
+
...request,
|
|
8293
|
+
goal: request.goal ? convertTermArg(request.goal) : request.goal
|
|
8294
|
+
};
|
|
8295
|
+
const response = await this.api.bayesianPredict(wireRequest);
|
|
7954
8296
|
return response.data;
|
|
7955
8297
|
}
|
|
7956
8298
|
/**
|
|
@@ -7985,7 +8327,11 @@ var InferenceClient = class {
|
|
|
7985
8327
|
* @returns The created goal with ID, PsiTerm, and clause/constraint counts.
|
|
7986
8328
|
*/
|
|
7987
8329
|
async createGoal(request) {
|
|
7988
|
-
const
|
|
8330
|
+
const wireRequest = {
|
|
8331
|
+
...request,
|
|
8332
|
+
clauses: request.clauses.map(convertTermArg)
|
|
8333
|
+
};
|
|
8334
|
+
const response = await this.api.createGoal(wireRequest);
|
|
7989
8335
|
return response.data;
|
|
7990
8336
|
}
|
|
7991
8337
|
/**
|
|
@@ -8026,7 +8372,47 @@ var InferenceClient = class {
|
|
|
8026
8372
|
const response = await this.api.getMetaSorts();
|
|
8027
8373
|
return response.data;
|
|
8028
8374
|
}
|
|
8375
|
+
// ─── Friendly Aliases ─────────────────────────────────────────────
|
|
8376
|
+
/**
|
|
8377
|
+
* Search for solutions by querying rules and facts backwards from a goal.
|
|
8378
|
+
* Alias for {@link backwardChain}.
|
|
8379
|
+
*
|
|
8380
|
+
* @param request - Backward chaining request.
|
|
8381
|
+
* @returns Solutions matching the goal.
|
|
8382
|
+
*
|
|
8383
|
+
* @see backwardChain
|
|
8384
|
+
*/
|
|
8385
|
+
async query(request) {
|
|
8386
|
+
return this.backwardChain(request);
|
|
8387
|
+
}
|
|
8388
|
+
/**
|
|
8389
|
+
* Derive new facts by applying rules to existing facts.
|
|
8390
|
+
* Alias for {@link forwardChain}.
|
|
8391
|
+
*
|
|
8392
|
+
* @param request - Forward chaining request.
|
|
8393
|
+
* @returns Derived facts and statistics.
|
|
8394
|
+
*
|
|
8395
|
+
* @see forwardChain
|
|
8396
|
+
*/
|
|
8397
|
+
async derive(request) {
|
|
8398
|
+
return this.forwardChain(request);
|
|
8399
|
+
}
|
|
8400
|
+
/**
|
|
8401
|
+
* Assert a fact into the knowledge base.
|
|
8402
|
+
* Alias for {@link addFact}.
|
|
8403
|
+
*
|
|
8404
|
+
* @param request - Fact definition.
|
|
8405
|
+
* @returns The created fact.
|
|
8406
|
+
*
|
|
8407
|
+
* @see addFact
|
|
8408
|
+
*/
|
|
8409
|
+
async assertFact(request) {
|
|
8410
|
+
return this.addFact(request);
|
|
8411
|
+
}
|
|
8029
8412
|
};
|
|
8413
|
+
function convertTermArg(input) {
|
|
8414
|
+
return isPsiTermInput(input) ? toTermInputDto(input) : input;
|
|
8415
|
+
}
|
|
8030
8416
|
|
|
8031
8417
|
// src/resources/query.ts
|
|
8032
8418
|
var QueryClient = class {
|
|
@@ -8039,13 +8425,18 @@ var QueryClient = class {
|
|
|
8039
8425
|
/**
|
|
8040
8426
|
* Find terms that unify with a given pattern.
|
|
8041
8427
|
*
|
|
8042
|
-
* @param request - Unifiable query with term input.
|
|
8428
|
+
* @param request - Unifiable query with term input. Features can be plain JS values
|
|
8429
|
+
* (auto-converted to tagged `ValueDto`) or explicit `Value.*` builder output.
|
|
8043
8430
|
* @returns Array of matching terms (tagged ValueDto format).
|
|
8044
8431
|
*
|
|
8045
8432
|
* @see findMatching — friendlier alias for this method.
|
|
8046
8433
|
*/
|
|
8047
8434
|
async findUnifiable(request) {
|
|
8048
|
-
const
|
|
8435
|
+
const wireRequest = {
|
|
8436
|
+
...request,
|
|
8437
|
+
pattern: convertPattern(request.pattern)
|
|
8438
|
+
};
|
|
8439
|
+
const response = await this.api.findUnifiable(wireRequest);
|
|
8049
8440
|
return response.data.results;
|
|
8050
8441
|
}
|
|
8051
8442
|
/**
|
|
@@ -8062,7 +8453,7 @@ var QueryClient = class {
|
|
|
8062
8453
|
/**
|
|
8063
8454
|
* Execute an Order-Sorted Feature search.
|
|
8064
8455
|
*
|
|
8065
|
-
* @param request - OSF search request with pattern.
|
|
8456
|
+
* @param request - OSF search request with pattern. Features can be plain JS values.
|
|
8066
8457
|
* @returns Structured search results including entities, relations, and suspended query information.
|
|
8067
8458
|
*
|
|
8068
8459
|
* @remarks
|
|
@@ -8072,26 +8463,36 @@ var QueryClient = class {
|
|
|
8072
8463
|
* @see search — friendlier alias for this method.
|
|
8073
8464
|
*/
|
|
8074
8465
|
async osfSearch(request) {
|
|
8075
|
-
const
|
|
8466
|
+
const wireRequest = {
|
|
8467
|
+
...request,
|
|
8468
|
+
pattern: convertPattern(request.pattern)
|
|
8469
|
+
};
|
|
8470
|
+
const response = await this.api.osfSearch(wireRequest);
|
|
8076
8471
|
return response.data;
|
|
8077
8472
|
}
|
|
8078
8473
|
/**
|
|
8079
8474
|
* Validate a term against its sort's type witnesses.
|
|
8080
8475
|
*
|
|
8081
|
-
* @param request - Term validation request with sort_id and
|
|
8476
|
+
* @param request - Term validation request with sort_id and features.
|
|
8477
|
+
* Features can be plain JS values (auto-converted to tagged `ValueDto`).
|
|
8082
8478
|
* @returns Validation result with witness satisfaction status.
|
|
8083
8479
|
*
|
|
8084
8480
|
* @remarks
|
|
8085
8481
|
* Uses tagged `ValueDto` format for features (same as term CRUD).
|
|
8086
8482
|
*/
|
|
8087
8483
|
async validateTerm(request) {
|
|
8088
|
-
const
|
|
8484
|
+
const wireRequest = {
|
|
8485
|
+
...request,
|
|
8486
|
+
term: convertPattern(request.term)
|
|
8487
|
+
};
|
|
8488
|
+
const response = await this.api.validateTerm(wireRequest);
|
|
8089
8489
|
return response.data;
|
|
8090
8490
|
}
|
|
8091
8491
|
/**
|
|
8092
8492
|
* Perform validated unification of two terms.
|
|
8093
8493
|
*
|
|
8094
8494
|
* @param request - Validated unification request with two terms to unify.
|
|
8495
|
+
* Features can be plain JS values (auto-converted to tagged `ValueDto`).
|
|
8095
8496
|
* @returns Unification result with GLB sort and witness validation.
|
|
8096
8497
|
*
|
|
8097
8498
|
* @remarks
|
|
@@ -8100,10 +8501,15 @@ var QueryClient = class {
|
|
|
8100
8501
|
* and validates the result against the GLB sort's type witnesses.
|
|
8101
8502
|
*/
|
|
8102
8503
|
async validatedUnify(request) {
|
|
8504
|
+
const wireRequest = {
|
|
8505
|
+
...request,
|
|
8506
|
+
...request.term1 ? { term1: convertPattern(request.term1) } : {},
|
|
8507
|
+
...request.term2 ? { term2: convertPattern(request.term2) } : {}
|
|
8508
|
+
};
|
|
8103
8509
|
const response = await this.api.http.request({
|
|
8104
8510
|
path: "/api/v1/query/validated-unify",
|
|
8105
8511
|
method: "POST",
|
|
8106
|
-
body:
|
|
8512
|
+
body: wireRequest,
|
|
8107
8513
|
type: "application/json" /* Json */,
|
|
8108
8514
|
format: "json"
|
|
8109
8515
|
});
|
|
@@ -8144,6 +8550,16 @@ var QueryClient = class {
|
|
|
8144
8550
|
return this.findUnifiable(request);
|
|
8145
8551
|
}
|
|
8146
8552
|
};
|
|
8553
|
+
function convertPattern(pattern) {
|
|
8554
|
+
const values = Object.values(pattern.features);
|
|
8555
|
+
if (values.length > 0 && values.every(isTaggedValueDto)) {
|
|
8556
|
+
return pattern;
|
|
8557
|
+
}
|
|
8558
|
+
return {
|
|
8559
|
+
sortId: pattern.sortId,
|
|
8560
|
+
features: toTaggedFeatures(pattern.features)
|
|
8561
|
+
};
|
|
8562
|
+
}
|
|
8147
8563
|
|
|
8148
8564
|
// src/resources/cognitive.ts
|
|
8149
8565
|
var CognitiveClient = class {
|
|
@@ -8179,7 +8595,7 @@ var CognitiveClient = class {
|
|
|
8179
8595
|
* @returns The created agent response.
|
|
8180
8596
|
*/
|
|
8181
8597
|
async createAgent(request) {
|
|
8182
|
-
const response = await this.api.createAgent({ ...request,
|
|
8598
|
+
const response = await this.api.createAgent({ ...request, tenantId: this.tenantId });
|
|
8183
8599
|
return response.data;
|
|
8184
8600
|
}
|
|
8185
8601
|
/**
|
|
@@ -8225,7 +8641,7 @@ var CognitiveClient = class {
|
|
|
8225
8641
|
* Uses POST with agent_id/tenant_id in the body (same pattern as other cognitive endpoints).
|
|
8226
8642
|
*/
|
|
8227
8643
|
async getState(request) {
|
|
8228
|
-
const response = await this.api.getAgentState({ ...request,
|
|
8644
|
+
const response = await this.api.getAgentState({ ...request, tenantId: this.tenantId });
|
|
8229
8645
|
return response.data.agent;
|
|
8230
8646
|
}
|
|
8231
8647
|
/**
|
|
@@ -8239,7 +8655,7 @@ var CognitiveClient = class {
|
|
|
8239
8655
|
* Returns drives, deficits, curiosity targets, and the dominant drive.
|
|
8240
8656
|
*/
|
|
8241
8657
|
async getAgentDrives(request) {
|
|
8242
|
-
const response = await this.api.getAgentDrives(request.
|
|
8658
|
+
const response = await this.api.getAgentDrives(request.agentId, {
|
|
8243
8659
|
tenant_id: this.tenantId
|
|
8244
8660
|
});
|
|
8245
8661
|
return response.data;
|
|
@@ -8255,7 +8671,7 @@ var CognitiveClient = class {
|
|
|
8255
8671
|
* Uses GET with agent_id as path parameter and tenant_id as query parameter.
|
|
8256
8672
|
*/
|
|
8257
8673
|
async getExtendedAgentState(request) {
|
|
8258
|
-
const response = await this.api.getExtendedAgentState(request.
|
|
8674
|
+
const response = await this.api.getExtendedAgentState(request.agentId, {
|
|
8259
8675
|
tenant_id: this.tenantId
|
|
8260
8676
|
});
|
|
8261
8677
|
return response.data.agent;
|
|
@@ -8268,7 +8684,7 @@ var CognitiveClient = class {
|
|
|
8268
8684
|
* @returns The cycle outcome.
|
|
8269
8685
|
*/
|
|
8270
8686
|
async runCycle(request) {
|
|
8271
|
-
const response = await this.api.runCycle({ ...request,
|
|
8687
|
+
const response = await this.api.runCycle({ ...request, tenantId: this.tenantId });
|
|
8272
8688
|
return response.data;
|
|
8273
8689
|
}
|
|
8274
8690
|
// --- Beliefs ---
|
|
@@ -8279,7 +8695,7 @@ var CognitiveClient = class {
|
|
|
8279
8695
|
* @returns The created belief response.
|
|
8280
8696
|
*/
|
|
8281
8697
|
async addBelief(request) {
|
|
8282
|
-
const response = await this.api.addBelief({ ...request,
|
|
8698
|
+
const response = await this.api.addBelief({ ...request, tenantId: this.tenantId });
|
|
8283
8699
|
return response.data;
|
|
8284
8700
|
}
|
|
8285
8701
|
// --- Goals ---
|
|
@@ -8290,7 +8706,7 @@ var CognitiveClient = class {
|
|
|
8290
8706
|
* @returns The created goal response.
|
|
8291
8707
|
*/
|
|
8292
8708
|
async addGoal(request) {
|
|
8293
|
-
const response = await this.api.addGoal({ ...request,
|
|
8709
|
+
const response = await this.api.addGoal({ ...request, tenantId: this.tenantId });
|
|
8294
8710
|
return response.data;
|
|
8295
8711
|
}
|
|
8296
8712
|
// --- Cognitive Registry ---
|
|
@@ -8301,7 +8717,7 @@ var CognitiveClient = class {
|
|
|
8301
8717
|
* @returns The created rule response.
|
|
8302
8718
|
*/
|
|
8303
8719
|
async addRule(request) {
|
|
8304
|
-
const response = await this.api.addCognitiveRule({ ...request,
|
|
8720
|
+
const response = await this.api.addCognitiveRule({ ...request, tenantId: this.tenantId });
|
|
8305
8721
|
return response.data;
|
|
8306
8722
|
}
|
|
8307
8723
|
/**
|
|
@@ -8311,7 +8727,7 @@ var CognitiveClient = class {
|
|
|
8311
8727
|
* @returns The created sort response.
|
|
8312
8728
|
*/
|
|
8313
8729
|
async addSort(request) {
|
|
8314
|
-
const response = await this.api.createCognitiveSort({ ...request,
|
|
8730
|
+
const response = await this.api.createCognitiveSort({ ...request, tenantId: this.tenantId });
|
|
8315
8731
|
return response.data;
|
|
8316
8732
|
}
|
|
8317
8733
|
// --- Adaptive Modification ---
|
|
@@ -8326,7 +8742,7 @@ var CognitiveClient = class {
|
|
|
8326
8742
|
* inference, not just at API boundaries. Uses POST to `/api/v1/cognitive/agents/adapt`.
|
|
8327
8743
|
*/
|
|
8328
8744
|
async adaptiveModify(request) {
|
|
8329
|
-
const response = await this.api.adaptiveModify({ ...request,
|
|
8745
|
+
const response = await this.api.adaptiveModify({ ...request, tenantId: this.tenantId });
|
|
8330
8746
|
return response.data;
|
|
8331
8747
|
}
|
|
8332
8748
|
// --- Episodic Memory ---
|
|
@@ -8337,7 +8753,7 @@ var CognitiveClient = class {
|
|
|
8337
8753
|
* @returns Recalled episodes sorted by similarity/recency.
|
|
8338
8754
|
*/
|
|
8339
8755
|
async recallEpisodes(request) {
|
|
8340
|
-
const response = await this.episodicMemory.recallEpisodes({ ...request,
|
|
8756
|
+
const response = await this.episodicMemory.recallEpisodes({ ...request, tenantId: this.tenantId });
|
|
8341
8757
|
return response.data;
|
|
8342
8758
|
}
|
|
8343
8759
|
/**
|
|
@@ -8351,7 +8767,7 @@ var CognitiveClient = class {
|
|
|
8351
8767
|
* unlike the original SDK which used GET with a path parameter.
|
|
8352
8768
|
*/
|
|
8353
8769
|
async getEpisodeStats(request) {
|
|
8354
|
-
const response = await this.episodicMemory.getEpisodeStats({ ...request,
|
|
8770
|
+
const response = await this.episodicMemory.getEpisodeStats({ ...request, tenantId: this.tenantId });
|
|
8355
8771
|
return response.data;
|
|
8356
8772
|
}
|
|
8357
8773
|
// --- HTN Planning ---
|
|
@@ -8362,7 +8778,7 @@ var CognitiveClient = class {
|
|
|
8362
8778
|
* @returns The created method response.
|
|
8363
8779
|
*/
|
|
8364
8780
|
async addHtnMethod(request) {
|
|
8365
|
-
const response = await this.htn.addHtnMethod({ ...request,
|
|
8781
|
+
const response = await this.htn.addHtnMethod({ ...request, tenantId: this.tenantId });
|
|
8366
8782
|
return response.data;
|
|
8367
8783
|
}
|
|
8368
8784
|
// --- Messaging ---
|
|
@@ -8373,7 +8789,7 @@ var CognitiveClient = class {
|
|
|
8373
8789
|
* @returns The send result.
|
|
8374
8790
|
*/
|
|
8375
8791
|
async sendMessage(request) {
|
|
8376
|
-
const response = await this.messaging.sendMessage({ ...request,
|
|
8792
|
+
const response = await this.messaging.sendMessage({ ...request, tenantId: this.tenantId });
|
|
8377
8793
|
return response.data;
|
|
8378
8794
|
}
|
|
8379
8795
|
/**
|
|
@@ -8383,7 +8799,7 @@ var CognitiveClient = class {
|
|
|
8383
8799
|
* @returns The broadcast result.
|
|
8384
8800
|
*/
|
|
8385
8801
|
async broadcastMessage(request) {
|
|
8386
|
-
const response = await this.messaging.broadcastMessage({ ...request,
|
|
8802
|
+
const response = await this.messaging.broadcastMessage({ ...request, tenantId: this.tenantId });
|
|
8387
8803
|
return response.data;
|
|
8388
8804
|
}
|
|
8389
8805
|
/**
|
|
@@ -8393,7 +8809,7 @@ var CognitiveClient = class {
|
|
|
8393
8809
|
* @returns The result.
|
|
8394
8810
|
*/
|
|
8395
8811
|
async markMessagesRead(request) {
|
|
8396
|
-
const response = await this.messaging.markMessagesRead({ ...request,
|
|
8812
|
+
const response = await this.messaging.markMessagesRead({ ...request, tenantId: this.tenantId });
|
|
8397
8813
|
return response.data;
|
|
8398
8814
|
}
|
|
8399
8815
|
// --- Feedback ---
|
|
@@ -8404,7 +8820,7 @@ var CognitiveClient = class {
|
|
|
8404
8820
|
* @returns The feedback result.
|
|
8405
8821
|
*/
|
|
8406
8822
|
async provideFeedback(request) {
|
|
8407
|
-
const response = await this.api.provideFeedback({ ...request,
|
|
8823
|
+
const response = await this.api.provideFeedback({ ...request, tenantId: this.tenantId });
|
|
8408
8824
|
return response.data;
|
|
8409
8825
|
}
|
|
8410
8826
|
/**
|
|
@@ -8419,7 +8835,7 @@ var CognitiveClient = class {
|
|
|
8419
8835
|
* Uses POST to `/api/v1/cognitive/learn_correction`.
|
|
8420
8836
|
*/
|
|
8421
8837
|
async learnFromCorrection(request) {
|
|
8422
|
-
const response = await this.api.learnFromCorrection({ ...request,
|
|
8838
|
+
const response = await this.api.learnFromCorrection({ ...request, tenantId: this.tenantId });
|
|
8423
8839
|
return response.data;
|
|
8424
8840
|
}
|
|
8425
8841
|
/**
|
|
@@ -8434,7 +8850,7 @@ var CognitiveClient = class {
|
|
|
8434
8850
|
* Uses POST to `/api/v1/cognitive/agents/reflect`.
|
|
8435
8851
|
*/
|
|
8436
8852
|
async reflectionQuery(request) {
|
|
8437
|
-
const response = await this.api.reflectionQuery({ ...request,
|
|
8853
|
+
const response = await this.api.reflectionQuery({ ...request, tenantId: this.tenantId });
|
|
8438
8854
|
return response.data;
|
|
8439
8855
|
}
|
|
8440
8856
|
// --- Integrated Cycle ---
|
|
@@ -8445,7 +8861,7 @@ var CognitiveClient = class {
|
|
|
8445
8861
|
* @returns The integrated cycle outcome with duration.
|
|
8446
8862
|
*/
|
|
8447
8863
|
async integratedCycle(request) {
|
|
8448
|
-
const response = await this.api.runIntegratedCycle({ ...request,
|
|
8864
|
+
const response = await this.api.runIntegratedCycle({ ...request, tenantId: this.tenantId });
|
|
8449
8865
|
return response.data;
|
|
8450
8866
|
}
|
|
8451
8867
|
// --- KB Subscription ---
|
|
@@ -8456,7 +8872,7 @@ var CognitiveClient = class {
|
|
|
8456
8872
|
* @returns Subscription ID.
|
|
8457
8873
|
*/
|
|
8458
8874
|
async subscribeToKb(request) {
|
|
8459
|
-
const response = await this.api.subscribeToKb({ ...request,
|
|
8875
|
+
const response = await this.api.subscribeToKb({ ...request, tenantId: this.tenantId });
|
|
8460
8876
|
return response.data;
|
|
8461
8877
|
}
|
|
8462
8878
|
// --- Episode Recording ---
|
|
@@ -8467,7 +8883,7 @@ var CognitiveClient = class {
|
|
|
8467
8883
|
* @returns The created episode ID.
|
|
8468
8884
|
*/
|
|
8469
8885
|
async recordEpisode(request) {
|
|
8470
|
-
const response = await this.episodicMemory.recordEpisode({ ...request,
|
|
8886
|
+
const response = await this.episodicMemory.recordEpisode({ ...request, tenantId: this.tenantId });
|
|
8471
8887
|
return response.data;
|
|
8472
8888
|
}
|
|
8473
8889
|
// --- Plan Library ---
|
|
@@ -8481,7 +8897,7 @@ var CognitiveClient = class {
|
|
|
8481
8897
|
* Stores a successful action sequence as a reusable plan template.
|
|
8482
8898
|
*/
|
|
8483
8899
|
async storePlan(request) {
|
|
8484
|
-
const response = await this.planLibrary.storePlan({ ...request,
|
|
8900
|
+
const response = await this.planLibrary.storePlan({ ...request, tenantId: this.tenantId });
|
|
8485
8901
|
return response.data;
|
|
8486
8902
|
}
|
|
8487
8903
|
/**
|
|
@@ -8494,7 +8910,7 @@ var CognitiveClient = class {
|
|
|
8494
8910
|
* Searches the plan library for plans that match the given goal.
|
|
8495
8911
|
*/
|
|
8496
8912
|
async findPlans(request) {
|
|
8497
|
-
const response = await this.planLibrary.findPlans({ ...request,
|
|
8913
|
+
const response = await this.planLibrary.findPlans({ ...request, tenantId: this.tenantId });
|
|
8498
8914
|
return response.data;
|
|
8499
8915
|
}
|
|
8500
8916
|
/**
|
|
@@ -8504,7 +8920,7 @@ var CognitiveClient = class {
|
|
|
8504
8920
|
* @returns Whether the plan was deleted.
|
|
8505
8921
|
*/
|
|
8506
8922
|
async deletePlan(request) {
|
|
8507
|
-
const response = await this.planLibrary.deletePlan(request.
|
|
8923
|
+
const response = await this.planLibrary.deletePlan(request.planId, {
|
|
8508
8924
|
tenant_id: this.tenantId
|
|
8509
8925
|
});
|
|
8510
8926
|
return response.data;
|
|
@@ -8516,7 +8932,7 @@ var CognitiveClient = class {
|
|
|
8516
8932
|
* @returns Updated success rate and use count.
|
|
8517
8933
|
*/
|
|
8518
8934
|
async updatePlanStats(request) {
|
|
8519
|
-
const response = await this.planLibrary.updatePlanStats({ ...request,
|
|
8935
|
+
const response = await this.planLibrary.updatePlanStats({ ...request, tenantId: this.tenantId });
|
|
8520
8936
|
return response.data;
|
|
8521
8937
|
}
|
|
8522
8938
|
// --- WebSocket Subscriptions ---
|
|
@@ -8591,8 +9007,8 @@ var FuzzyClient = class {
|
|
|
8591
9007
|
*/
|
|
8592
9008
|
async compareSimilarity(term1Id, term2Id, options) {
|
|
8593
9009
|
return this.fuzzyUnify({
|
|
8594
|
-
|
|
8595
|
-
|
|
9010
|
+
term1Id,
|
|
9011
|
+
term2Id,
|
|
8596
9012
|
...options
|
|
8597
9013
|
});
|
|
8598
9014
|
}
|
|
@@ -8777,7 +9193,7 @@ var ConstraintsClient = class {
|
|
|
8777
9193
|
* ```ts
|
|
8778
9194
|
* const sessions = await client.constraints.listSessions();
|
|
8779
9195
|
* for (const session of sessions) {
|
|
8780
|
-
* console.log(`${session.
|
|
9196
|
+
* console.log(`${session.sessionId}: ${session.status}`);
|
|
8781
9197
|
* }
|
|
8782
9198
|
* ```
|
|
8783
9199
|
*/
|
|
@@ -11152,7 +11568,7 @@ var NeuroSymbolicClient = class {
|
|
|
11152
11568
|
* @example
|
|
11153
11569
|
* ```ts
|
|
11154
11570
|
* const result = await client.neuroSymbolic.trainFromTraces();
|
|
11155
|
-
* console.log(`Triggered: ${result.triggered}, Loss: ${result.loss}, Traces: ${result.
|
|
11571
|
+
* console.log(`Triggered: ${result.triggered}, Loss: ${result.loss}, Traces: ${result.tracesConsumed}`);
|
|
11156
11572
|
* ```
|
|
11157
11573
|
* @remarks Uses untagged serialization. POST /api/v1/admin/neuro-symbolic/train/from-traces
|
|
11158
11574
|
*/
|
|
@@ -11358,7 +11774,7 @@ var FunctionsClient = class {
|
|
|
11358
11774
|
* },
|
|
11359
11775
|
* ],
|
|
11360
11776
|
* });
|
|
11361
|
-
* console.log(result.
|
|
11777
|
+
* console.log(result.functionId); // UUID of the registered function
|
|
11362
11778
|
* ```
|
|
11363
11779
|
*/
|
|
11364
11780
|
async registerFunction(request) {
|
|
@@ -11388,7 +11804,7 @@ var FunctionsClient = class {
|
|
|
11388
11804
|
* arguments: [{ type: 'Integer', value: 5 }],
|
|
11389
11805
|
* tenant_id: 'my-tenant-uuid',
|
|
11390
11806
|
* });
|
|
11391
|
-
* if (result.
|
|
11807
|
+
* if (result.resultType === 'Value') {
|
|
11392
11808
|
* console.log(result.value); // { type: 'Integer', value: 120 }
|
|
11393
11809
|
* } else {
|
|
11394
11810
|
* console.log('Suspended:', result.reason);
|
|
@@ -11433,7 +11849,7 @@ var WebhookActionsClient = class {
|
|
|
11433
11849
|
* outputs: ['message_id', 'sent_at'],
|
|
11434
11850
|
* tenant_id: 'my-tenant-uuid',
|
|
11435
11851
|
* });
|
|
11436
|
-
* console.log(result.
|
|
11852
|
+
* console.log(result.actionId, result.sortId);
|
|
11437
11853
|
* ```
|
|
11438
11854
|
*/
|
|
11439
11855
|
async register(request) {
|
|
@@ -11460,7 +11876,7 @@ var WebhookActionsClient = class {
|
|
|
11460
11876
|
* inputs: { to: 'user@example.com', subject: 'Hello', body: 'World' },
|
|
11461
11877
|
* tenant_id: 'my-tenant-uuid',
|
|
11462
11878
|
* });
|
|
11463
|
-
* console.log(result.
|
|
11879
|
+
* console.log(result.invocationId, result.callbackUrl);
|
|
11464
11880
|
* ```
|
|
11465
11881
|
*/
|
|
11466
11882
|
async invoke(name, request) {
|
|
@@ -11486,7 +11902,7 @@ var WebhookActionsClient = class {
|
|
|
11486
11902
|
* status: 'success',
|
|
11487
11903
|
* outputs: { message_id: 'msg-456', sent_at: '2024-01-15T10:30:00Z' },
|
|
11488
11904
|
* });
|
|
11489
|
-
* console.log(result.
|
|
11905
|
+
* console.log(result.demonsFired, result.termUpdated);
|
|
11490
11906
|
* ```
|
|
11491
11907
|
*/
|
|
11492
11908
|
async completeInvocation(invocationId, request) {
|
|
@@ -11507,7 +11923,7 @@ var WebhookActionsClient = class {
|
|
|
11507
11923
|
* const result = await client.webhookActions.listActions();
|
|
11508
11924
|
* console.log(`Found ${result.total} actions`);
|
|
11509
11925
|
* for (const action of result.actions) {
|
|
11510
|
-
* console.log(action.name, action.
|
|
11926
|
+
* console.log(action.name, action.webhookUrl);
|
|
11511
11927
|
* }
|
|
11512
11928
|
* ```
|
|
11513
11929
|
*/
|
|
@@ -11528,9 +11944,9 @@ var WebhookActionsClient = class {
|
|
|
11528
11944
|
* @example
|
|
11529
11945
|
* ```typescript
|
|
11530
11946
|
* const result = await client.webhookActions.listPendingInvocations();
|
|
11531
|
-
* console.log(`${result.
|
|
11947
|
+
* console.log(`${result.totalPending} pending invocations`);
|
|
11532
11948
|
* for (const inv of result.invocations) {
|
|
11533
|
-
* console.log(inv.
|
|
11949
|
+
* console.log(inv.invocationId, inv.actionName, inv.status);
|
|
11534
11950
|
* }
|
|
11535
11951
|
* ```
|
|
11536
11952
|
*/
|
|
@@ -11568,8 +11984,8 @@ var SyntheticClient = class {
|
|
|
11568
11984
|
* term_id: 'term-uuid',
|
|
11569
11985
|
* schema_sort_ids: ['sort-uuid-1', 'sort-uuid-2'],
|
|
11570
11986
|
* });
|
|
11571
|
-
* console.log(result.
|
|
11572
|
-
* console.log(result.
|
|
11987
|
+
* console.log(result.fullPrompt);
|
|
11988
|
+
* console.log(result.stablePrefix); // cacheable across calls
|
|
11573
11989
|
* ```
|
|
11574
11990
|
*/
|
|
11575
11991
|
async buildGenerationPrompt(request) {
|
|
@@ -11596,9 +12012,9 @@ var SyntheticClient = class {
|
|
|
11596
12012
|
* ],
|
|
11597
12013
|
* sort_names: { 'sort-uuid': 'Employee' },
|
|
11598
12014
|
* });
|
|
11599
|
-
* console.log(`Global ECE: ${report.
|
|
11600
|
-
* for (const target of report.
|
|
11601
|
-
* console.log(`${target.
|
|
12015
|
+
* console.log(`Global ECE: ${report.globalEce}`);
|
|
12016
|
+
* for (const target of report.augmentationTargets) {
|
|
12017
|
+
* console.log(`${target.sortName} needs ${target.recommendedExamples} more examples`);
|
|
11602
12018
|
* }
|
|
11603
12019
|
* ```
|
|
11604
12020
|
*/
|
|
@@ -11626,7 +12042,7 @@ var SyntheticClient = class {
|
|
|
11626
12042
|
* existing_term_ids: ['term-uuid-1', 'term-uuid-2'],
|
|
11627
12043
|
* min_diversity_score: 0.3,
|
|
11628
12044
|
* });
|
|
11629
|
-
* console.log(`Novel: ${result.
|
|
12045
|
+
* console.log(`Novel: ${result.isDiverse}, score: ${result.noveltyScore}`);
|
|
11630
12046
|
* ```
|
|
11631
12047
|
*/
|
|
11632
12048
|
async checkDiversity(request) {
|
|
@@ -11652,7 +12068,7 @@ var SyntheticClient = class {
|
|
|
11652
12068
|
* target_sorts: ['sort-uuid'],
|
|
11653
12069
|
* max_terms_per_sort: 50,
|
|
11654
12070
|
* });
|
|
11655
|
-
* console.log(`Exported ${result.
|
|
12071
|
+
* console.log(`Exported ${result.exampleCount} examples`);
|
|
11656
12072
|
* // Write JSONL to file for fine-tuning
|
|
11657
12073
|
* ```
|
|
11658
12074
|
*/
|
|
@@ -11714,8 +12130,8 @@ var SyntheticClient = class {
|
|
|
11714
12130
|
* enable_verbalization: true,
|
|
11715
12131
|
* seed: 42,
|
|
11716
12132
|
* });
|
|
11717
|
-
* console.log(`Generated ${result.
|
|
11718
|
-
* console.log(`Report: ${result.report.
|
|
12133
|
+
* console.log(`Generated ${result.trainingPairsCount} training pairs`);
|
|
12134
|
+
* console.log(`Report: ${result.report.termsGenerated} terms generated`);
|
|
11719
12135
|
* ```
|
|
11720
12136
|
*/
|
|
11721
12137
|
async generateSynthetic(request) {
|
|
@@ -11797,7 +12213,7 @@ var SyntheticClient = class {
|
|
|
11797
12213
|
* extracted: [{ sort_id: 'sort-uuid', features: { name: 'Alice' } }],
|
|
11798
12214
|
* min_faithfulness_score: 0.5,
|
|
11799
12215
|
* });
|
|
11800
|
-
* console.log(`Passed: ${result.passed}, Score: ${result.
|
|
12216
|
+
* console.log(`Passed: ${result.passed}, Score: ${result.faithfulnessScore}`);
|
|
11801
12217
|
* ```
|
|
11802
12218
|
*/
|
|
11803
12219
|
async verifyRoundTrip(request) {
|
|
@@ -11831,7 +12247,7 @@ var ProofEngineClient = class {
|
|
|
11831
12247
|
* const session = await client.proofEngine.createRuleStoreSession({
|
|
11832
12248
|
* tenant_id: 'tenant-uuid',
|
|
11833
12249
|
* });
|
|
11834
|
-
* console.log(session.
|
|
12250
|
+
* console.log(session.storeId);
|
|
11835
12251
|
* ```
|
|
11836
12252
|
*/
|
|
11837
12253
|
async createRuleStoreSession(request) {
|
|
@@ -11851,7 +12267,7 @@ var ProofEngineClient = class {
|
|
|
11851
12267
|
* @example
|
|
11852
12268
|
* ```typescript
|
|
11853
12269
|
* const session = await client.proofEngine.getRuleStoreSession('store-uuid');
|
|
11854
|
-
* console.log(`${session.
|
|
12270
|
+
* console.log(`${session.ruleCount} rules in store`);
|
|
11855
12271
|
* ```
|
|
11856
12272
|
*/
|
|
11857
12273
|
async getRuleStoreSession(storeId) {
|
|
@@ -11877,7 +12293,7 @@ var ProofEngineClient = class {
|
|
|
11877
12293
|
* head: { constraints: [{ type: 'sort', var_name: 'X', sort_id: 'person-uuid' }] },
|
|
11878
12294
|
* body: [],
|
|
11879
12295
|
* });
|
|
11880
|
-
* console.log(`Rule ${result.
|
|
12296
|
+
* console.log(`Rule ${result.ruleId} asserted, ${result.ruleCount} total`);
|
|
11881
12297
|
* ```
|
|
11882
12298
|
*/
|
|
11883
12299
|
async assertRule(storeId, request) {
|
|
@@ -11902,7 +12318,7 @@ var ProofEngineClient = class {
|
|
|
11902
12318
|
* const result = await client.proofEngine.retractRule('store-uuid', {
|
|
11903
12319
|
* rule_id: 'rule-uuid',
|
|
11904
12320
|
* });
|
|
11905
|
-
* console.log(`${result.
|
|
12321
|
+
* console.log(`${result.retractedCount} rules retracted`);
|
|
11906
12322
|
* ```
|
|
11907
12323
|
*/
|
|
11908
12324
|
async retractRule(storeId, request) {
|
|
@@ -11925,7 +12341,7 @@ var ProofEngineClient = class {
|
|
|
11925
12341
|
* const result = await client.proofEngine.findRules('store-uuid', {
|
|
11926
12342
|
* pattern: { constraints: [{ type: 'sort', var_name: 'X', sort_id: 'person-uuid' }] },
|
|
11927
12343
|
* });
|
|
11928
|
-
* console.log(`Found ${result.
|
|
12344
|
+
* console.log(`Found ${result.matchingRules.length} matching rules`);
|
|
11929
12345
|
* ```
|
|
11930
12346
|
*/
|
|
11931
12347
|
async findRules(storeId, request) {
|
|
@@ -11947,7 +12363,7 @@ var ProofEngineClient = class {
|
|
|
11947
12363
|
* @example
|
|
11948
12364
|
* ```typescript
|
|
11949
12365
|
* const marker = await client.proofEngine.markRuleStore('store-uuid', {});
|
|
11950
|
-
* console.log(`Checkpoint at index ${marker.
|
|
12366
|
+
* console.log(`Checkpoint at index ${marker.markerIndex}`);
|
|
11951
12367
|
* ```
|
|
11952
12368
|
*/
|
|
11953
12369
|
async markRuleStore(storeId, request) {
|
|
@@ -11970,7 +12386,7 @@ var ProofEngineClient = class {
|
|
|
11970
12386
|
* const result = await client.proofEngine.undoRuleStore('store-uuid', {
|
|
11971
12387
|
* marker_index: 0,
|
|
11972
12388
|
* });
|
|
11973
|
-
* console.log(`Undo ${result.success ? 'succeeded' : 'failed'}, ${result.
|
|
12389
|
+
* console.log(`Undo ${result.success ? 'succeeded' : 'failed'}, ${result.ruleCount} rules`);
|
|
11974
12390
|
* ```
|
|
11975
12391
|
*/
|
|
11976
12392
|
async undoRuleStore(storeId, request) {
|
|
@@ -11994,7 +12410,7 @@ var ProofEngineClient = class {
|
|
|
11994
12410
|
* const session = await client.proofEngine.createTermStoreSession({
|
|
11995
12411
|
* tenant_id: 'tenant-uuid',
|
|
11996
12412
|
* });
|
|
11997
|
-
* console.log(session.
|
|
12413
|
+
* console.log(session.sessionId);
|
|
11998
12414
|
* ```
|
|
11999
12415
|
*/
|
|
12000
12416
|
async createTermStoreSession(request) {
|
|
@@ -12014,7 +12430,7 @@ var ProofEngineClient = class {
|
|
|
12014
12430
|
* @example
|
|
12015
12431
|
* ```typescript
|
|
12016
12432
|
* const session = await client.proofEngine.getTermStoreSession('session-uuid');
|
|
12017
|
-
* console.log(`${session.
|
|
12433
|
+
* console.log(`${session.termCount} terms, ${session.variableCount} variables`);
|
|
12018
12434
|
* ```
|
|
12019
12435
|
*/
|
|
12020
12436
|
async getTermStoreSession(sessionId) {
|
|
@@ -12038,7 +12454,7 @@ var ProofEngineClient = class {
|
|
|
12038
12454
|
* sort_id: 'person-uuid',
|
|
12039
12455
|
* features: { name: "Alice" },
|
|
12040
12456
|
* });
|
|
12041
|
-
* console.log(`Created term ${term.
|
|
12457
|
+
* console.log(`Created term ${term.termId}`);
|
|
12042
12458
|
* ```
|
|
12043
12459
|
*/
|
|
12044
12460
|
async createStoreTerm(sessionId, request) {
|
|
@@ -12061,7 +12477,7 @@ var ProofEngineClient = class {
|
|
|
12061
12477
|
* const variable = await client.proofEngine.createStoreVariable('session-uuid', {
|
|
12062
12478
|
* sort_id: 'person-uuid',
|
|
12063
12479
|
* });
|
|
12064
|
-
* console.log(`Created variable ${variable.
|
|
12480
|
+
* console.log(`Created variable ${variable.termId}, is_variable: ${variable.isVariable}`);
|
|
12065
12481
|
* ```
|
|
12066
12482
|
*/
|
|
12067
12483
|
async createStoreVariable(sessionId, request) {
|
|
@@ -12086,7 +12502,7 @@ var ProofEngineClient = class {
|
|
|
12086
12502
|
* variable_id: 'var-uuid',
|
|
12087
12503
|
* target_id: 'term-uuid',
|
|
12088
12504
|
* });
|
|
12089
|
-
* console.log(`Bound ${result.
|
|
12505
|
+
* console.log(`Bound ${result.variableId} to ${result.boundTo}`);
|
|
12090
12506
|
* ```
|
|
12091
12507
|
*/
|
|
12092
12508
|
async bindStoreVariable(sessionId, request) {
|
|
@@ -12110,7 +12526,7 @@ var ProofEngineClient = class {
|
|
|
12110
12526
|
* const result = await client.proofEngine.dereferenceStoreTerm('session-uuid', {
|
|
12111
12527
|
* term_id: 'var-uuid',
|
|
12112
12528
|
* });
|
|
12113
|
-
* console.log(`${result.
|
|
12529
|
+
* console.log(`${result.originalId} -> ${result.dereferencedId} (bound: ${result.isBound})`);
|
|
12114
12530
|
* ```
|
|
12115
12531
|
*/
|
|
12116
12532
|
async dereferenceStoreTerm(sessionId, request) {
|
|
@@ -12134,7 +12550,7 @@ var ProofEngineClient = class {
|
|
|
12134
12550
|
* const term = await client.proofEngine.getStoreTerm('session-uuid', {
|
|
12135
12551
|
* term_id: 'term-uuid',
|
|
12136
12552
|
* });
|
|
12137
|
-
* console.log(`Sort: ${term.
|
|
12553
|
+
* console.log(`Sort: ${term.sortId}, features:`, term.features);
|
|
12138
12554
|
* ```
|
|
12139
12555
|
*/
|
|
12140
12556
|
async getStoreTerm(sessionId, request) {
|
|
@@ -12185,9 +12601,9 @@ var ProofEngineClient = class {
|
|
|
12185
12601
|
* term2_id: 'term2-uuid',
|
|
12186
12602
|
* });
|
|
12187
12603
|
* if (result.success) {
|
|
12188
|
-
* console.log(`Unified as ${result.
|
|
12604
|
+
* console.log(`Unified as ${result.unifiedTermId}`);
|
|
12189
12605
|
* } else {
|
|
12190
|
-
* console.log(`Failed: ${result.
|
|
12606
|
+
* console.log(`Failed: ${result.failureReason}`);
|
|
12191
12607
|
* }
|
|
12192
12608
|
* ```
|
|
12193
12609
|
*/
|
|
@@ -12210,7 +12626,7 @@ var ProofEngineClient = class {
|
|
|
12210
12626
|
* @example
|
|
12211
12627
|
* ```typescript
|
|
12212
12628
|
* const marker = await client.proofEngine.markTermStore('session-uuid', {});
|
|
12213
|
-
* console.log(`Marker at index ${marker.
|
|
12629
|
+
* console.log(`Marker at index ${marker.markerIndex}, trail length ${marker.trailLength}`);
|
|
12214
12630
|
* ```
|
|
12215
12631
|
*/
|
|
12216
12632
|
async markTermStore(sessionId, request) {
|
|
@@ -12234,7 +12650,7 @@ var ProofEngineClient = class {
|
|
|
12234
12650
|
* const result = await client.proofEngine.backtrackTermStore('session-uuid', {
|
|
12235
12651
|
* marker_index: 0,
|
|
12236
12652
|
* });
|
|
12237
|
-
* console.log(`Backtrack ${result.success ? 'succeeded' : 'failed'}, undid ${result.
|
|
12653
|
+
* console.log(`Backtrack ${result.success ? 'succeeded' : 'failed'}, undid ${result.undoneEntries} entries`);
|
|
12238
12654
|
* ```
|
|
12239
12655
|
*/
|
|
12240
12656
|
async backtrackTermStore(sessionId, request) {
|
|
@@ -12315,7 +12731,7 @@ var HealthClient = class {
|
|
|
12315
12731
|
* ```typescript
|
|
12316
12732
|
* const health = await client.health.check();
|
|
12317
12733
|
* console.log(health.status); // "healthy"
|
|
12318
|
-
* console.log(health.
|
|
12734
|
+
* console.log(health.buildInfo.version); // "1.2.3"
|
|
12319
12735
|
* for (const component of health.components) {
|
|
12320
12736
|
* console.log(`${component.name}: ${component.status}`);
|
|
12321
12737
|
* }
|
|
@@ -12350,14 +12766,38 @@ var AdminClient = class {
|
|
|
12350
12766
|
* ```typescript
|
|
12351
12767
|
* const result = await client.admin.clearAllData();
|
|
12352
12768
|
* console.log(result.message);
|
|
12353
|
-
* console.log(`Tables cleared: ${result.
|
|
12354
|
-
* console.log(`Qdrant collections deleted: ${result.
|
|
12769
|
+
* console.log(`Tables cleared: ${result.postgresTablesCleared}`);
|
|
12770
|
+
* console.log(`Qdrant collections deleted: ${result.qdrantCollectionsDeleted}`);
|
|
12355
12771
|
* ```
|
|
12356
12772
|
*/
|
|
12357
12773
|
async clearAllData() {
|
|
12358
12774
|
const response = await this.api.clearAllData();
|
|
12359
12775
|
return response.data;
|
|
12360
12776
|
}
|
|
12777
|
+
/**
|
|
12778
|
+
* Clear all data for a specific tenant.
|
|
12779
|
+
*
|
|
12780
|
+
* @param tenantId - The UUID of the tenant whose data should be cleared.
|
|
12781
|
+
* @returns Confirmation of what was wiped, including record counts and cache status.
|
|
12782
|
+
* @throws {ApiError} If the request fails.
|
|
12783
|
+
*
|
|
12784
|
+
* @remarks
|
|
12785
|
+
* Destructive operation that wipes all PostgreSQL rows, in-memory inference state,
|
|
12786
|
+
* and cache entries for the specified tenant. Other tenants are unaffected.
|
|
12787
|
+
* Use for tenant offboarding or testing.
|
|
12788
|
+
*
|
|
12789
|
+
* @example
|
|
12790
|
+
* ```typescript
|
|
12791
|
+
* const result = await client.admin.clearTenantData('550e8400-e29b-41d4-a716-446655440000');
|
|
12792
|
+
* console.log(result.message);
|
|
12793
|
+
* console.log(`Terms deleted: ${result.termsDeleted}`);
|
|
12794
|
+
* console.log(`Sessions deleted: ${result.sessionsDeleted}`);
|
|
12795
|
+
* ```
|
|
12796
|
+
*/
|
|
12797
|
+
async clearTenantData(tenantId) {
|
|
12798
|
+
const response = await this.api.clearTenantData(tenantId);
|
|
12799
|
+
return response.data;
|
|
12800
|
+
}
|
|
12361
12801
|
/**
|
|
12362
12802
|
* List all tenants that have data in the system.
|
|
12363
12803
|
*
|
|
@@ -12372,7 +12812,7 @@ var AdminClient = class {
|
|
|
12372
12812
|
* ```typescript
|
|
12373
12813
|
* const result = await client.admin.listTenants();
|
|
12374
12814
|
* for (const tenant of result.tenants) {
|
|
12375
|
-
* console.log(`${tenant.
|
|
12815
|
+
* console.log(`${tenant.tenantId}: ${tenant.termCount} terms, ${tenant.sessionCount} sessions`);
|
|
12376
12816
|
* }
|
|
12377
12817
|
* ```
|
|
12378
12818
|
*/
|
|
@@ -12452,7 +12892,7 @@ var OntologyClient = class {
|
|
|
12452
12892
|
* // Answer the questions and call again
|
|
12453
12893
|
* const completed = await client.ontology.generate({
|
|
12454
12894
|
* prompt: 'Build a customer support ticket system',
|
|
12455
|
-
* session_id: result.
|
|
12895
|
+
* session_id: result.sessionId,
|
|
12456
12896
|
* answers: { priority_levels: '3' },
|
|
12457
12897
|
* });
|
|
12458
12898
|
* }
|
|
@@ -12542,11 +12982,11 @@ var RagClient = class {
|
|
|
12542
12982
|
* include_related: true,
|
|
12543
12983
|
* });
|
|
12544
12984
|
*
|
|
12545
|
-
* for (const concept of result.
|
|
12546
|
-
* console.log(`${concept.
|
|
12985
|
+
* for (const concept of result.primaryConcepts) {
|
|
12986
|
+
* console.log(`${concept.canonicalName} (${concept.matchDegree})`);
|
|
12547
12987
|
* }
|
|
12548
12988
|
*
|
|
12549
|
-
* console.log(`Found ${result.stats.
|
|
12989
|
+
* console.log(`Found ${result.stats.emergentDiscovered} emergent relations`);
|
|
12550
12990
|
* ```
|
|
12551
12991
|
*/
|
|
12552
12992
|
async ontologyRag(request) {
|
|
@@ -12558,7 +12998,7 @@ var RagClient = class {
|
|
|
12558
12998
|
// src/builders/lp.ts
|
|
12559
12999
|
function numericTerm(n) {
|
|
12560
13000
|
return {
|
|
12561
|
-
|
|
13001
|
+
sortName: Number.isInteger(n) ? "integer_type" : "real_type",
|
|
12562
13002
|
features: { value: n }
|
|
12563
13003
|
};
|
|
12564
13004
|
}
|
|
@@ -12678,7 +13118,7 @@ function compileLP(problem, solutionSortName) {
|
|
|
12678
13118
|
const ref = varRefs[varName];
|
|
12679
13119
|
if (bounds.min !== void 0 && bounds.max !== void 0) {
|
|
12680
13120
|
allAntecedents.push({
|
|
12681
|
-
|
|
13121
|
+
sortName: "real_between_constraint",
|
|
12682
13122
|
features: {
|
|
12683
13123
|
var: ref,
|
|
12684
13124
|
lower: numericTerm(bounds.min),
|
|
@@ -12688,7 +13128,7 @@ function compileLP(problem, solutionSortName) {
|
|
|
12688
13128
|
} else {
|
|
12689
13129
|
if (bounds.min !== void 0) {
|
|
12690
13130
|
allAntecedents.push({
|
|
12691
|
-
|
|
13131
|
+
sortName: "real_ge_constraint",
|
|
12692
13132
|
features: {
|
|
12693
13133
|
left: ref,
|
|
12694
13134
|
right: numericTerm(bounds.min)
|
|
@@ -12697,7 +13137,7 @@ function compileLP(problem, solutionSortName) {
|
|
|
12697
13137
|
}
|
|
12698
13138
|
if (bounds.max !== void 0) {
|
|
12699
13139
|
allAntecedents.push({
|
|
12700
|
-
|
|
13140
|
+
sortName: "real_le_constraint",
|
|
12701
13141
|
features: {
|
|
12702
13142
|
left: ref,
|
|
12703
13143
|
right: numericTerm(bounds.max)
|
|
@@ -12712,7 +13152,7 @@ function compileLP(problem, solutionSortName) {
|
|
|
12712
13152
|
allAntecedents.push(...compiled.antecedents);
|
|
12713
13153
|
const sortName = constraintOpToSort(constraint.op);
|
|
12714
13154
|
allAntecedents.push({
|
|
12715
|
-
|
|
13155
|
+
sortName,
|
|
12716
13156
|
features: {
|
|
12717
13157
|
left: compiled.resultRef,
|
|
12718
13158
|
right: numericTerm(constraint.rhs)
|
|
@@ -12729,7 +13169,7 @@ function compileLP(problem, solutionSortName) {
|
|
|
12729
13169
|
if (typeof objectiveRef === "number") {
|
|
12730
13170
|
const objVar = { name: "?_lp_objective" };
|
|
12731
13171
|
allAntecedents.push({
|
|
12732
|
-
|
|
13172
|
+
sortName: "real_eq_constraint",
|
|
12733
13173
|
features: {
|
|
12734
13174
|
left: objVar,
|
|
12735
13175
|
right: numericTerm(objectiveRef)
|
|
@@ -12739,7 +13179,7 @@ function compileLP(problem, solutionSortName) {
|
|
|
12739
13179
|
}
|
|
12740
13180
|
const objectiveSortName = problem.objective.direction === "maximize" ? "maximize_objective" : "minimize_objective";
|
|
12741
13181
|
allAntecedents.push({
|
|
12742
|
-
|
|
13182
|
+
sortName: objectiveSortName,
|
|
12743
13183
|
features: {
|
|
12744
13184
|
expression: objectiveRef,
|
|
12745
13185
|
name: "objective"
|
|
@@ -12749,7 +13189,7 @@ function compileLP(problem, solutionSortName) {
|
|
|
12749
13189
|
(name) => varRefs[name]
|
|
12750
13190
|
);
|
|
12751
13191
|
allAntecedents.push({
|
|
12752
|
-
|
|
13192
|
+
sortName: "real_labeling_constraint",
|
|
12753
13193
|
features: {
|
|
12754
13194
|
variables: variableRefList
|
|
12755
13195
|
}
|
|
@@ -12760,7 +13200,7 @@ function compileLP(problem, solutionSortName) {
|
|
|
12760
13200
|
}
|
|
12761
13201
|
solutionFeatures["_objective"] = objectiveRef;
|
|
12762
13202
|
const solutionTerm = {
|
|
12763
|
-
|
|
13203
|
+
sortName: solutionSortName,
|
|
12764
13204
|
features: solutionFeatures
|
|
12765
13205
|
};
|
|
12766
13206
|
return { solutionTerm, antecedents: allAntecedents };
|
|
@@ -12794,7 +13234,7 @@ function compileLinearExpression(expression, varRefs, nextVar) {
|
|
|
12794
13234
|
} else {
|
|
12795
13235
|
const resultVar = { name: nextVar() };
|
|
12796
13236
|
antecedents.push({
|
|
12797
|
-
|
|
13237
|
+
sortName: "real_times_constraint",
|
|
12798
13238
|
features: {
|
|
12799
13239
|
coefficient: numericTerm(coefficient),
|
|
12800
13240
|
variable: varRef,
|
|
@@ -12814,7 +13254,7 @@ function compileLinearExpression(expression, varRefs, nextVar) {
|
|
|
12814
13254
|
for (let i = 1; i < termResults.length; i++) {
|
|
12815
13255
|
const sumVar = { name: nextVar() };
|
|
12816
13256
|
antecedents.push({
|
|
12817
|
-
|
|
13257
|
+
sortName: "real_plus_constraint",
|
|
12818
13258
|
features: {
|
|
12819
13259
|
left: current,
|
|
12820
13260
|
right: termResults[i],
|
|
@@ -12903,29 +13343,30 @@ var OptimizeClient = class {
|
|
|
12903
13343
|
const sortResponse = await this.sortsApi.bulkCreateSorts({
|
|
12904
13344
|
sorts: [{ name: solutionSortName, parents: ["thing"] }]
|
|
12905
13345
|
});
|
|
12906
|
-
|
|
13346
|
+
const sortIdsMap = sortResponse.data.sortIds;
|
|
13347
|
+
sortId = Object.values(sortIdsMap)[0];
|
|
12907
13348
|
const ruleResponse = await this.inferenceApi.addRule({
|
|
12908
13349
|
term: compiled.solutionTerm,
|
|
12909
13350
|
antecedents: compiled.antecedents,
|
|
12910
13351
|
certainty: 1
|
|
12911
13352
|
});
|
|
12912
|
-
ruleTermId = ruleResponse.data.term.
|
|
13353
|
+
ruleTermId = ruleResponse.data.term.termId;
|
|
12913
13354
|
const bcResponse = await this.inferenceApi.backwardChain({
|
|
12914
|
-
goal: {
|
|
12915
|
-
|
|
12916
|
-
|
|
12917
|
-
|
|
13355
|
+
goal: { sortName: solutionSortName },
|
|
13356
|
+
maxSolutions: 1,
|
|
13357
|
+
maxDepth,
|
|
13358
|
+
timeoutMs
|
|
12918
13359
|
});
|
|
12919
|
-
const queryTimeMs = bcResponse.data.
|
|
13360
|
+
const queryTimeMs = bcResponse.data.queryTimeMs;
|
|
12920
13361
|
if (bcResponse.data.solutions.length === 0) {
|
|
12921
13362
|
return { status: "infeasible", solveTimeMs: queryTimeMs };
|
|
12922
13363
|
}
|
|
12923
13364
|
const solution = bcResponse.data.solutions[0];
|
|
12924
13365
|
const variables = {};
|
|
12925
13366
|
for (const binding of solution.substitution.bindings) {
|
|
12926
|
-
const varName = binding.
|
|
13367
|
+
const varName = binding.variableName;
|
|
12927
13368
|
if (!varName) continue;
|
|
12928
|
-
const value = parseFloat(binding.
|
|
13369
|
+
const value = parseFloat(binding.boundToDisplay);
|
|
12929
13370
|
if (isNaN(value)) continue;
|
|
12930
13371
|
if (varName.startsWith("?") && !varName.startsWith("?_lp_")) {
|
|
12931
13372
|
variables[varName.slice(1)] = value;
|
|
@@ -12988,7 +13429,7 @@ var OptimizeClient = class {
|
|
|
12988
13429
|
async fromKnowledgeBase(config, options) {
|
|
12989
13430
|
const sortId = await this.resolveSortName(config.variables.sort);
|
|
12990
13431
|
const queryResponse = await this.queryApi.findBySort({
|
|
12991
|
-
|
|
13432
|
+
sortId
|
|
12992
13433
|
});
|
|
12993
13434
|
const terms = queryResponse.data.terms;
|
|
12994
13435
|
if (terms.length === 0) {
|
|
@@ -13197,6 +13638,121 @@ var ReasoningLayerClient = class {
|
|
|
13197
13638
|
rag;
|
|
13198
13639
|
/** Linear program optimization (CLP(Q) simplex solver via backward chaining). */
|
|
13199
13640
|
optimize;
|
|
13641
|
+
// ─── Group Caches ─────────────────────────────────────────────────
|
|
13642
|
+
_core;
|
|
13643
|
+
_ai;
|
|
13644
|
+
_reasoning;
|
|
13645
|
+
_analysis;
|
|
13646
|
+
_data;
|
|
13647
|
+
_workflow;
|
|
13648
|
+
_system;
|
|
13649
|
+
// ─── Friendly Aliases ─────────────────────────────────────────────
|
|
13650
|
+
/**
|
|
13651
|
+
* Type hierarchy operations.
|
|
13652
|
+
* Alias for {@link sorts} — "sort" is domain jargon for "type" in order-sorted algebras.
|
|
13653
|
+
*/
|
|
13654
|
+
get types() {
|
|
13655
|
+
return this.sorts;
|
|
13656
|
+
}
|
|
13657
|
+
/**
|
|
13658
|
+
* Record CRUD operations.
|
|
13659
|
+
* Alias for {@link terms} — "term" is logic programming jargon for a data record.
|
|
13660
|
+
*/
|
|
13661
|
+
get records() {
|
|
13662
|
+
return this.terms;
|
|
13663
|
+
}
|
|
13664
|
+
/**
|
|
13665
|
+
* Rule and fact operations (backward/forward chaining, fuzzy, Bayesian, NAF).
|
|
13666
|
+
* Alias for {@link inference}.
|
|
13667
|
+
*/
|
|
13668
|
+
get rules() {
|
|
13669
|
+
return this.inference;
|
|
13670
|
+
}
|
|
13671
|
+
/**
|
|
13672
|
+
* Cognitive agent operations (BDI cycle, beliefs, goals, messaging).
|
|
13673
|
+
* Alias for {@link cognitive}.
|
|
13674
|
+
*/
|
|
13675
|
+
get agents() {
|
|
13676
|
+
return this.cognitive;
|
|
13677
|
+
}
|
|
13678
|
+
// ─── Domain Groups ───────────────────────────────────────────────
|
|
13679
|
+
/** Core knowledge base operations — types, records, rules, functions, constraints, and queries. */
|
|
13680
|
+
get core() {
|
|
13681
|
+
return this._core ??= {
|
|
13682
|
+
types: this.sorts,
|
|
13683
|
+
records: this.terms,
|
|
13684
|
+
rules: this.inference,
|
|
13685
|
+
functions: this.functions,
|
|
13686
|
+
constraints: this.constraints,
|
|
13687
|
+
query: this.query
|
|
13688
|
+
};
|
|
13689
|
+
}
|
|
13690
|
+
/** AI and machine learning operations — agents, oversight, neuro-symbolic, RAG, generation. */
|
|
13691
|
+
get ai() {
|
|
13692
|
+
return this._ai ??= {
|
|
13693
|
+
agents: this.cognitive,
|
|
13694
|
+
oversight: this.oversight,
|
|
13695
|
+
neuroSymbolic: this.neuroSymbolic,
|
|
13696
|
+
rag: this.rag,
|
|
13697
|
+
generation: this.generation,
|
|
13698
|
+
synthetic: this.synthetic,
|
|
13699
|
+
proofEngine: this.proofEngine
|
|
13700
|
+
};
|
|
13701
|
+
}
|
|
13702
|
+
/** Advanced reasoning operations — optimization, ILP, CDL, execution, preferences, discovery. */
|
|
13703
|
+
get reasoningOps() {
|
|
13704
|
+
return this._reasoning ??= {
|
|
13705
|
+
optimize: this.optimize,
|
|
13706
|
+
ilp: this.ilp,
|
|
13707
|
+
cdl: this.cdl,
|
|
13708
|
+
execution: this.execution,
|
|
13709
|
+
reasoning: this.reasoning,
|
|
13710
|
+
preferences: this.preferences,
|
|
13711
|
+
discovery: this.discovery
|
|
13712
|
+
};
|
|
13713
|
+
}
|
|
13714
|
+
/** Analysis operations — causal, statistical, fuzzy, scenarios, communities, visualization. */
|
|
13715
|
+
get analysisOps() {
|
|
13716
|
+
return this._analysis ??= {
|
|
13717
|
+
causal: this.causal,
|
|
13718
|
+
statistical: this.statistical,
|
|
13719
|
+
fuzzy: this.fuzzy,
|
|
13720
|
+
scenarios: this.scenarios,
|
|
13721
|
+
communities: this.communities,
|
|
13722
|
+
visualization: this.visualization
|
|
13723
|
+
};
|
|
13724
|
+
}
|
|
13725
|
+
/** Data ingestion and extraction operations — documents, sources, collections, images. */
|
|
13726
|
+
get data() {
|
|
13727
|
+
return this._data ??= {
|
|
13728
|
+
ingestion: this.ingestion,
|
|
13729
|
+
extraction: this.extract,
|
|
13730
|
+
sources: this.sources,
|
|
13731
|
+
collections: this.collections,
|
|
13732
|
+
imageExtraction: this.imageExtraction,
|
|
13733
|
+
row: this.row
|
|
13734
|
+
};
|
|
13735
|
+
}
|
|
13736
|
+
/** Workflow operations — control flow, reviews, action reviews, webhooks. */
|
|
13737
|
+
get workflow() {
|
|
13738
|
+
return this._workflow ??= {
|
|
13739
|
+
control: this.control,
|
|
13740
|
+
reviews: this.reviews,
|
|
13741
|
+
actionReviews: this.actionReviews,
|
|
13742
|
+
webhookActions: this.webhookActions
|
|
13743
|
+
};
|
|
13744
|
+
}
|
|
13745
|
+
/** System administration — health, admin, spaces, namespaces, utilities, ontology. */
|
|
13746
|
+
get system() {
|
|
13747
|
+
return this._system ??= {
|
|
13748
|
+
health: this.health,
|
|
13749
|
+
admin: this.admin,
|
|
13750
|
+
spaces: this.spaces,
|
|
13751
|
+
namespaces: this.namespaces,
|
|
13752
|
+
utilities: this.utilities,
|
|
13753
|
+
ontology: this.ontology
|
|
13754
|
+
};
|
|
13755
|
+
}
|
|
13200
13756
|
/**
|
|
13201
13757
|
* Create a new ReasoningLayerClient.
|
|
13202
13758
|
*
|
|
@@ -13303,100 +13859,146 @@ var ReasoningLayerClient = class {
|
|
|
13303
13859
|
}
|
|
13304
13860
|
};
|
|
13305
13861
|
|
|
13862
|
+
// src/types/sorts.ts
|
|
13863
|
+
var sorts_exports = {};
|
|
13864
|
+
|
|
13865
|
+
// src/types/terms.ts
|
|
13866
|
+
var terms_exports = {};
|
|
13867
|
+
|
|
13868
|
+
// src/types/inference.ts
|
|
13869
|
+
var inference_exports = {};
|
|
13870
|
+
|
|
13871
|
+
// src/types/cognitive.ts
|
|
13872
|
+
var cognitive_exports = {};
|
|
13873
|
+
|
|
13874
|
+
// src/types/causal.ts
|
|
13875
|
+
var causal_exports = {};
|
|
13876
|
+
|
|
13877
|
+
// src/types/fuzzy.ts
|
|
13878
|
+
var fuzzy_exports = {};
|
|
13879
|
+
|
|
13880
|
+
// src/types/constraints.ts
|
|
13881
|
+
var constraints_exports = {};
|
|
13882
|
+
|
|
13883
|
+
// src/types/query.ts
|
|
13884
|
+
var query_exports = {};
|
|
13885
|
+
|
|
13886
|
+
// src/types/values.ts
|
|
13887
|
+
var values_exports = {};
|
|
13888
|
+
|
|
13889
|
+
// src/types/homoiconic.ts
|
|
13890
|
+
var homoiconic_exports = {};
|
|
13891
|
+
|
|
13892
|
+
// src/types/execution.ts
|
|
13893
|
+
var execution_exports = {};
|
|
13894
|
+
|
|
13895
|
+
// src/types/control.ts
|
|
13896
|
+
var control_exports = {};
|
|
13897
|
+
|
|
13898
|
+
// src/types/spaces.ts
|
|
13899
|
+
var spaces_exports = {};
|
|
13900
|
+
|
|
13901
|
+
// src/types/row.ts
|
|
13902
|
+
var row_exports = {};
|
|
13903
|
+
|
|
13904
|
+
// src/types/namespaces.ts
|
|
13905
|
+
var namespaces_exports = {};
|
|
13906
|
+
|
|
13907
|
+
// src/types/collections.ts
|
|
13908
|
+
var collections_exports = {};
|
|
13909
|
+
|
|
13910
|
+
// src/types/visualization.ts
|
|
13911
|
+
var visualization_exports = {};
|
|
13912
|
+
|
|
13913
|
+
// src/types/statistical.ts
|
|
13914
|
+
var statistical_exports = {};
|
|
13915
|
+
|
|
13916
|
+
// src/types/reasoning.ts
|
|
13917
|
+
var reasoning_exports = {};
|
|
13918
|
+
|
|
13919
|
+
// src/types/ingestion.ts
|
|
13920
|
+
var ingestion_exports = {};
|
|
13921
|
+
|
|
13922
|
+
// src/types/reviews.ts
|
|
13923
|
+
var reviews_exports = {};
|
|
13924
|
+
|
|
13925
|
+
// src/types/sources.ts
|
|
13926
|
+
var sources_exports = {};
|
|
13927
|
+
|
|
13928
|
+
// src/types/communities.ts
|
|
13929
|
+
var communities_exports = {};
|
|
13930
|
+
|
|
13931
|
+
// src/types/utilities.ts
|
|
13932
|
+
var utilities_exports = {};
|
|
13933
|
+
|
|
13934
|
+
// src/types/scenarios.ts
|
|
13935
|
+
var scenarios_exports = {};
|
|
13936
|
+
|
|
13937
|
+
// src/types/action-reviews.ts
|
|
13938
|
+
var action_reviews_exports = {};
|
|
13939
|
+
|
|
13940
|
+
// src/types/discovery.ts
|
|
13941
|
+
var discovery_exports = {};
|
|
13942
|
+
|
|
13943
|
+
// src/types/extract.ts
|
|
13944
|
+
var extract_exports = {};
|
|
13945
|
+
|
|
13946
|
+
// src/types/oversight.ts
|
|
13947
|
+
var oversight_exports = {};
|
|
13948
|
+
|
|
13949
|
+
// src/types/cdl.ts
|
|
13950
|
+
var cdl_exports = {};
|
|
13951
|
+
|
|
13952
|
+
// src/types/neuro-symbolic.ts
|
|
13953
|
+
var neuro_symbolic_exports = {};
|
|
13954
|
+
|
|
13955
|
+
// src/types/analysis.ts
|
|
13956
|
+
var analysis_exports = {};
|
|
13957
|
+
|
|
13958
|
+
// src/types/preferences.ts
|
|
13959
|
+
var preferences_exports = {};
|
|
13960
|
+
|
|
13961
|
+
// src/types/functions.ts
|
|
13962
|
+
var functions_exports = {};
|
|
13963
|
+
|
|
13964
|
+
// src/types/webhook-actions.ts
|
|
13965
|
+
var webhook_actions_exports = {};
|
|
13966
|
+
|
|
13967
|
+
// src/types/proof-engine.ts
|
|
13968
|
+
var proof_engine_exports = {};
|
|
13969
|
+
|
|
13970
|
+
// src/types/synthetic.ts
|
|
13971
|
+
var synthetic_exports = {};
|
|
13972
|
+
|
|
13973
|
+
// src/types/health.ts
|
|
13974
|
+
var health_exports = {};
|
|
13975
|
+
|
|
13976
|
+
// src/types/admin.ts
|
|
13977
|
+
var admin_exports = {};
|
|
13978
|
+
|
|
13979
|
+
// src/types/image-extraction.ts
|
|
13980
|
+
var image_extraction_exports = {};
|
|
13981
|
+
|
|
13982
|
+
// src/types/ontology.ts
|
|
13983
|
+
var ontology_exports = {};
|
|
13984
|
+
|
|
13985
|
+
// src/types/generation.ts
|
|
13986
|
+
var generation_exports = {};
|
|
13987
|
+
|
|
13988
|
+
// src/types/rag.ts
|
|
13989
|
+
var rag_exports = {};
|
|
13990
|
+
|
|
13991
|
+
// src/types/optimize.ts
|
|
13992
|
+
var optimize_exports = {};
|
|
13993
|
+
|
|
13994
|
+
// src/types/ilp.ts
|
|
13995
|
+
var ilp_exports = {};
|
|
13996
|
+
|
|
13997
|
+
// src/types/plain-values.ts
|
|
13998
|
+
var plain_values_exports = {};
|
|
13999
|
+
|
|
13306
14000
|
// src/builders/value.ts
|
|
13307
14001
|
var Value = {
|
|
13308
|
-
/**
|
|
13309
|
-
* Create a string value.
|
|
13310
|
-
*
|
|
13311
|
-
* @param s - The string value.
|
|
13312
|
-
* @returns A tagged `StringValue`: `{"type": "String", "value": "hello"}`.
|
|
13313
|
-
*
|
|
13314
|
-
* @remarks
|
|
13315
|
-
* Serialization format: Tagged (ValueDto). Use with term CRUD, queries, fuzzy operations.
|
|
13316
|
-
* Do NOT use with homoiconic inference endpoints.
|
|
13317
|
-
*
|
|
13318
|
-
* @example
|
|
13319
|
-
* ```typescript
|
|
13320
|
-
* Value.string("Alice") // {"type": "String", "value": "Alice"}
|
|
13321
|
-
* ```
|
|
13322
|
-
*/
|
|
13323
|
-
string(s) {
|
|
13324
|
-
return { type: "String", value: s };
|
|
13325
|
-
},
|
|
13326
|
-
/**
|
|
13327
|
-
* Create an integer value.
|
|
13328
|
-
*
|
|
13329
|
-
* @param n - The integer value (i64 on backend).
|
|
13330
|
-
* @returns A tagged `IntegerValue`: `{"type": "Integer", "value": 42}`.
|
|
13331
|
-
*
|
|
13332
|
-
* @remarks
|
|
13333
|
-
* Serialization format: Tagged (ValueDto). Use with term CRUD, queries, fuzzy operations.
|
|
13334
|
-
* Do NOT use with homoiconic inference endpoints.
|
|
13335
|
-
*
|
|
13336
|
-
* @example
|
|
13337
|
-
* ```typescript
|
|
13338
|
-
* Value.integer(42) // {"type": "Integer", "value": 42}
|
|
13339
|
-
* ```
|
|
13340
|
-
*/
|
|
13341
|
-
integer(n) {
|
|
13342
|
-
return { type: "Integer", value: n };
|
|
13343
|
-
},
|
|
13344
|
-
/**
|
|
13345
|
-
* Create a real (floating-point) value.
|
|
13346
|
-
*
|
|
13347
|
-
* @param n - The real value (f64 on backend).
|
|
13348
|
-
* @returns A tagged `RealValue`: `{"type": "Real", "value": 3.14}`.
|
|
13349
|
-
*
|
|
13350
|
-
* @remarks
|
|
13351
|
-
* Serialization format: Tagged (ValueDto). Use with term CRUD, queries, fuzzy operations.
|
|
13352
|
-
* Do NOT use with homoiconic inference endpoints.
|
|
13353
|
-
*
|
|
13354
|
-
* @example
|
|
13355
|
-
* ```typescript
|
|
13356
|
-
* Value.real(3.14) // {"type": "Real", "value": 3.14}
|
|
13357
|
-
* ```
|
|
13358
|
-
*/
|
|
13359
|
-
real(n) {
|
|
13360
|
-
return { type: "Real", value: n };
|
|
13361
|
-
},
|
|
13362
|
-
/**
|
|
13363
|
-
* Create a boolean value.
|
|
13364
|
-
*
|
|
13365
|
-
* @param b - The boolean value.
|
|
13366
|
-
* @returns A tagged `BooleanValue`: `{"type": "Boolean", "value": true}`.
|
|
13367
|
-
*
|
|
13368
|
-
* @remarks
|
|
13369
|
-
* Serialization format: Tagged (ValueDto). Use with term CRUD, queries, fuzzy operations.
|
|
13370
|
-
* Do NOT use with homoiconic inference endpoints.
|
|
13371
|
-
*
|
|
13372
|
-
* @example
|
|
13373
|
-
* ```typescript
|
|
13374
|
-
* Value.boolean(true) // {"type": "Boolean", "value": true}
|
|
13375
|
-
* ```
|
|
13376
|
-
*/
|
|
13377
|
-
boolean(b) {
|
|
13378
|
-
return { type: "Boolean", value: b };
|
|
13379
|
-
},
|
|
13380
|
-
/**
|
|
13381
|
-
* Create an uninstantiated (unknown) value.
|
|
13382
|
-
*
|
|
13383
|
-
* @returns A tagged `UninstantiatedValue`: `{"type": "Uninstantiated"}`.
|
|
13384
|
-
*
|
|
13385
|
-
* @remarks
|
|
13386
|
-
* Serialization format: Tagged (ValueDto). Use with term CRUD, queries, fuzzy operations.
|
|
13387
|
-
* Do NOT use with homoiconic inference endpoints.
|
|
13388
|
-
*
|
|
13389
|
-
* Represents a feature whose value has not yet been determined.
|
|
13390
|
-
* In the untagged format, this corresponds to `null`.
|
|
13391
|
-
*
|
|
13392
|
-
* @example
|
|
13393
|
-
* ```typescript
|
|
13394
|
-
* Value.uninstantiated() // {"type": "Uninstantiated"}
|
|
13395
|
-
* ```
|
|
13396
|
-
*/
|
|
13397
|
-
uninstantiated() {
|
|
13398
|
-
return { type: "Uninstantiated" };
|
|
13399
|
-
},
|
|
13400
14002
|
/**
|
|
13401
14003
|
* Create a reference to another term by UUID.
|
|
13402
14004
|
*
|
|
@@ -13405,7 +14007,6 @@ var Value = {
|
|
|
13405
14007
|
*
|
|
13406
14008
|
* @remarks
|
|
13407
14009
|
* Serialization format: Tagged (ValueDto). Use with term CRUD, queries, fuzzy operations.
|
|
13408
|
-
* Do NOT use with homoiconic inference endpoints.
|
|
13409
14010
|
*
|
|
13410
14011
|
* @example
|
|
13411
14012
|
* ```typescript
|
|
@@ -13415,24 +14016,6 @@ var Value = {
|
|
|
13415
14016
|
reference(id) {
|
|
13416
14017
|
return { type: "Reference", value: id };
|
|
13417
14018
|
},
|
|
13418
|
-
/**
|
|
13419
|
-
* Create a list of values.
|
|
13420
|
-
*
|
|
13421
|
-
* @param items - The list items as `ValueDto` values.
|
|
13422
|
-
* @returns A tagged `ListValue`: `{"type": "List", "value": [...]}`.
|
|
13423
|
-
*
|
|
13424
|
-
* @remarks
|
|
13425
|
-
* Serialization format: Tagged (ValueDto). Use with term CRUD, queries, fuzzy operations.
|
|
13426
|
-
* Do NOT use with homoiconic inference endpoints.
|
|
13427
|
-
*
|
|
13428
|
-
* @example
|
|
13429
|
-
* ```typescript
|
|
13430
|
-
* Value.list([Value.integer(1), Value.integer(2), Value.integer(3)])
|
|
13431
|
-
* ```
|
|
13432
|
-
*/
|
|
13433
|
-
list(items) {
|
|
13434
|
-
return { type: "List", value: items };
|
|
13435
|
-
},
|
|
13436
14019
|
/**
|
|
13437
14020
|
* Create a fuzzy scalar with a value and membership degree.
|
|
13438
14021
|
*
|
|
@@ -13442,7 +14025,6 @@ var Value = {
|
|
|
13442
14025
|
*
|
|
13443
14026
|
* @remarks
|
|
13444
14027
|
* Serialization format: Tagged (ValueDto). Use with term CRUD, queries, fuzzy operations.
|
|
13445
|
-
* Do NOT use with homoiconic inference endpoints.
|
|
13446
14028
|
*
|
|
13447
14029
|
* @example
|
|
13448
14030
|
* ```typescript
|
|
@@ -13460,7 +14042,6 @@ var Value = {
|
|
|
13460
14042
|
*
|
|
13461
14043
|
* @remarks
|
|
13462
14044
|
* Serialization format: Tagged (ValueDto). Use with term CRUD, queries, fuzzy operations.
|
|
13463
|
-
* Do NOT use with homoiconic inference endpoints.
|
|
13464
14045
|
*
|
|
13465
14046
|
* Note: The `FuzzyShapeDto` uses `"kind"` as its discriminator, NOT `"type"`.
|
|
13466
14047
|
*
|
|
@@ -13483,7 +14064,6 @@ var Value = {
|
|
|
13483
14064
|
*
|
|
13484
14065
|
* @remarks
|
|
13485
14066
|
* Serialization format: Tagged (ValueDto). Use with term CRUD, queries, fuzzy operations.
|
|
13486
|
-
* Do NOT use with homoiconic inference endpoints.
|
|
13487
14067
|
*
|
|
13488
14068
|
* Represents partial information about set membership using Smyth powerdomain semantics.
|
|
13489
14069
|
*
|
|
@@ -13498,7 +14078,7 @@ var Value = {
|
|
|
13498
14078
|
value: {
|
|
13499
14079
|
lower,
|
|
13500
14080
|
upper,
|
|
13501
|
-
|
|
14081
|
+
sortConstraint: sortConstraint ?? null
|
|
13502
14082
|
}
|
|
13503
14083
|
};
|
|
13504
14084
|
}
|
|
@@ -13514,12 +14094,10 @@ var FuzzyShape = {
|
|
|
13514
14094
|
*
|
|
13515
14095
|
* @remarks
|
|
13516
14096
|
* Serialization format: Tagged by `"kind"` (FuzzyShapeDto).
|
|
13517
|
-
* The discriminator field is `"kind"`, NOT `"type"`.
|
|
13518
14097
|
*
|
|
13519
14098
|
* @example
|
|
13520
14099
|
* ```typescript
|
|
13521
14100
|
* FuzzyShape.triangular(20, 22, 24)
|
|
13522
|
-
* // {"kind": "Triangular", "a": 20, "b": 22, "c": 24}
|
|
13523
14101
|
* ```
|
|
13524
14102
|
*/
|
|
13525
14103
|
triangular(a, b, c) {
|
|
@@ -13532,16 +14110,14 @@ var FuzzyShape = {
|
|
|
13532
14110
|
* @param b - Left shoulder (membership reaches 1).
|
|
13533
14111
|
* @param c - Right shoulder (membership starts falling from 1).
|
|
13534
14112
|
* @param d - Right foot (membership returns to 0).
|
|
13535
|
-
* @returns A `TrapezoidalShape
|
|
14113
|
+
* @returns A `TrapezoidalShape`.
|
|
13536
14114
|
*
|
|
13537
14115
|
* @remarks
|
|
13538
14116
|
* Serialization format: Tagged by `"kind"` (FuzzyShapeDto).
|
|
13539
|
-
* The discriminator field is `"kind"`, NOT `"type"`.
|
|
13540
14117
|
*
|
|
13541
14118
|
* @example
|
|
13542
14119
|
* ```typescript
|
|
13543
14120
|
* FuzzyShape.trapezoidal(18, 20, 24, 26)
|
|
13544
|
-
* // {"kind": "Trapezoidal", "a": 18, "b": 20, "c": 24, "d": 26}
|
|
13545
14121
|
* ```
|
|
13546
14122
|
*/
|
|
13547
14123
|
trapezoidal(a, b, c, d) {
|
|
@@ -13552,20 +14128,18 @@ var FuzzyShape = {
|
|
|
13552
14128
|
*
|
|
13553
14129
|
* @param mean - Center of the Gaussian curve (membership = 1).
|
|
13554
14130
|
* @param stdDev - Standard deviation controlling width.
|
|
13555
|
-
* @returns A `GaussianShape
|
|
14131
|
+
* @returns A `GaussianShape`.
|
|
13556
14132
|
*
|
|
13557
14133
|
* @remarks
|
|
13558
14134
|
* Serialization format: Tagged by `"kind"` (FuzzyShapeDto).
|
|
13559
|
-
* The discriminator field is `"kind"`, NOT `"type"`.
|
|
13560
14135
|
*
|
|
13561
14136
|
* @example
|
|
13562
14137
|
* ```typescript
|
|
13563
14138
|
* FuzzyShape.gaussian(100, 15)
|
|
13564
|
-
* // {"kind": "Gaussian", "mean": 100, "std_dev": 15}
|
|
13565
14139
|
* ```
|
|
13566
14140
|
*/
|
|
13567
14141
|
gaussian(mean, stdDev) {
|
|
13568
|
-
return { kind: "Gaussian", mean,
|
|
14142
|
+
return { kind: "Gaussian", mean, stdDev };
|
|
13569
14143
|
},
|
|
13570
14144
|
/**
|
|
13571
14145
|
* Create a cyclic Gaussian fuzzy membership function with periodic wrapping.
|
|
@@ -13573,323 +14147,25 @@ var FuzzyShape = {
|
|
|
13573
14147
|
* @param mean - Center of the Gaussian curve.
|
|
13574
14148
|
* @param stdDev - Standard deviation controlling width.
|
|
13575
14149
|
* @param period - Period of the cyclic wrapping (e.g., 360 for degrees).
|
|
13576
|
-
* @returns A `CyclicGaussianShape
|
|
14150
|
+
* @returns A `CyclicGaussianShape`.
|
|
13577
14151
|
*
|
|
13578
14152
|
* @remarks
|
|
13579
14153
|
* Serialization format: Tagged by `"kind"` (FuzzyShapeDto).
|
|
13580
|
-
* The discriminator field is `"kind"`, NOT `"type"`.
|
|
13581
14154
|
*
|
|
13582
14155
|
* @example
|
|
13583
14156
|
* ```typescript
|
|
13584
14157
|
* FuzzyShape.cyclicGaussian(180, 30, 360)
|
|
13585
|
-
* // {"kind": "CyclicGaussian", "mean": 180, "std_dev": 30, "period": 360}
|
|
13586
14158
|
* ```
|
|
13587
14159
|
*/
|
|
13588
14160
|
cyclicGaussian(mean, stdDev, period) {
|
|
13589
|
-
return { kind: "CyclicGaussian", mean,
|
|
13590
|
-
}
|
|
13591
|
-
};
|
|
13592
|
-
|
|
13593
|
-
// src/builders/feature-input.ts
|
|
13594
|
-
var FeatureInput = {
|
|
13595
|
-
/**
|
|
13596
|
-
* Create an untagged string value.
|
|
13597
|
-
*
|
|
13598
|
-
* @param s - The string value.
|
|
13599
|
-
* @returns The raw string: `"hello"`.
|
|
13600
|
-
*
|
|
13601
|
-
* @remarks
|
|
13602
|
-
* Serialization format: Untagged (FeatureInputValueDto). Use with homoiconic inference endpoints.
|
|
13603
|
-
* Do NOT use with term CRUD endpoints.
|
|
13604
|
-
*
|
|
13605
|
-
* @example
|
|
13606
|
-
* ```typescript
|
|
13607
|
-
* FeatureInput.string("Alice") // "Alice"
|
|
13608
|
-
* ```
|
|
13609
|
-
*/
|
|
13610
|
-
string(s) {
|
|
13611
|
-
return s;
|
|
13612
|
-
},
|
|
13613
|
-
/**
|
|
13614
|
-
* Create an untagged integer value.
|
|
13615
|
-
*
|
|
13616
|
-
* @param n - The integer value.
|
|
13617
|
-
* @returns The raw number: `42`.
|
|
13618
|
-
*
|
|
13619
|
-
* @remarks
|
|
13620
|
-
* Serialization format: Untagged (FeatureInputValueDto). Use with homoiconic inference endpoints.
|
|
13621
|
-
* Do NOT use with term CRUD endpoints.
|
|
13622
|
-
*
|
|
13623
|
-
* The backend distinguishes integers from reals. Use `FeatureInput.real()` for floating-point.
|
|
13624
|
-
*
|
|
13625
|
-
* @example
|
|
13626
|
-
* ```typescript
|
|
13627
|
-
* FeatureInput.integer(42) // 42
|
|
13628
|
-
* ```
|
|
13629
|
-
*/
|
|
13630
|
-
integer(n) {
|
|
13631
|
-
return n;
|
|
13632
|
-
},
|
|
13633
|
-
/**
|
|
13634
|
-
* Create an untagged real (floating-point) value.
|
|
13635
|
-
*
|
|
13636
|
-
* @param n - The real value.
|
|
13637
|
-
* @returns The raw number: `3.14`.
|
|
13638
|
-
*
|
|
13639
|
-
* @remarks
|
|
13640
|
-
* Serialization format: Untagged (FeatureInputValueDto). Use with homoiconic inference endpoints.
|
|
13641
|
-
* Do NOT use with term CRUD endpoints.
|
|
13642
|
-
*
|
|
13643
|
-
* The backend distinguishes integers from reals. Use `FeatureInput.integer()` for whole numbers.
|
|
13644
|
-
*
|
|
13645
|
-
* @example
|
|
13646
|
-
* ```typescript
|
|
13647
|
-
* FeatureInput.real(3.14) // 3.14
|
|
13648
|
-
* ```
|
|
13649
|
-
*/
|
|
13650
|
-
real(n) {
|
|
13651
|
-
return n;
|
|
13652
|
-
},
|
|
13653
|
-
/**
|
|
13654
|
-
* Create an untagged boolean value.
|
|
13655
|
-
*
|
|
13656
|
-
* @param b - The boolean value.
|
|
13657
|
-
* @returns The raw boolean: `true` or `false`.
|
|
13658
|
-
*
|
|
13659
|
-
* @remarks
|
|
13660
|
-
* Serialization format: Untagged (FeatureInputValueDto). Use with homoiconic inference endpoints.
|
|
13661
|
-
* Do NOT use with term CRUD endpoints.
|
|
13662
|
-
*
|
|
13663
|
-
* @example
|
|
13664
|
-
* ```typescript
|
|
13665
|
-
* FeatureInput.boolean(true) // true
|
|
13666
|
-
* ```
|
|
13667
|
-
*/
|
|
13668
|
-
boolean(b) {
|
|
13669
|
-
return b;
|
|
13670
|
-
},
|
|
13671
|
-
/**
|
|
13672
|
-
* Create an untagged null value representing an uninstantiated feature.
|
|
13673
|
-
*
|
|
13674
|
-
* @returns `null`.
|
|
13675
|
-
*
|
|
13676
|
-
* @remarks
|
|
13677
|
-
* Serialization format: Untagged (FeatureInputValueDto). Use with homoiconic inference endpoints.
|
|
13678
|
-
* Do NOT use with term CRUD endpoints.
|
|
13679
|
-
*
|
|
13680
|
-
* Equivalent to `Value.uninstantiated()` in the tagged format.
|
|
13681
|
-
*
|
|
13682
|
-
* @example
|
|
13683
|
-
* ```typescript
|
|
13684
|
-
* FeatureInput.uninstantiated() // null
|
|
13685
|
-
* ```
|
|
13686
|
-
*/
|
|
13687
|
-
uninstantiated() {
|
|
13688
|
-
return null;
|
|
13689
|
-
},
|
|
13690
|
-
/**
|
|
13691
|
-
* Create a reference to an existing term by UUID.
|
|
13692
|
-
*
|
|
13693
|
-
* @param termId - The UUID of the referenced term.
|
|
13694
|
-
* @returns An object: `{term_id: "uuid"}`.
|
|
13695
|
-
*
|
|
13696
|
-
* @remarks
|
|
13697
|
-
* Serialization format: Untagged (FeatureInputValueDto). Use with homoiconic inference endpoints.
|
|
13698
|
-
* Do NOT use with term CRUD endpoints.
|
|
13699
|
-
*
|
|
13700
|
-
* @example
|
|
13701
|
-
* ```typescript
|
|
13702
|
-
* FeatureInput.ref("550e8400-e29b-41d4-a716-446655440000")
|
|
13703
|
-
* // {term_id: "550e8400-e29b-41d4-a716-446655440000"}
|
|
13704
|
-
* ```
|
|
13705
|
-
*/
|
|
13706
|
-
ref(termId) {
|
|
13707
|
-
return { term_id: termId };
|
|
13708
|
-
},
|
|
13709
|
-
/**
|
|
13710
|
-
* Create an unconstrained variable.
|
|
13711
|
-
*
|
|
13712
|
-
* @param name - Variable name (conventionally prefixed with `?`, e.g., `"?X"`).
|
|
13713
|
-
* @returns An object: `{name: "?X"}`.
|
|
13714
|
-
*
|
|
13715
|
-
* @remarks
|
|
13716
|
-
* Serialization format: Untagged (FeatureInputValueDto). Use with homoiconic inference endpoints.
|
|
13717
|
-
* Do NOT use with term CRUD endpoints.
|
|
13718
|
-
*
|
|
13719
|
-
* For constrained variables, use {@link FeatureInput.constrainedVar} instead.
|
|
13720
|
-
*
|
|
13721
|
-
* @example
|
|
13722
|
-
* ```typescript
|
|
13723
|
-
* FeatureInput.variable("?X") // {name: "?X"}
|
|
13724
|
-
* ```
|
|
13725
|
-
*/
|
|
13726
|
-
variable(name) {
|
|
13727
|
-
return { name };
|
|
13728
|
-
},
|
|
13729
|
-
/**
|
|
13730
|
-
* Create a constrained variable with a constraint as a `TermInputDto`.
|
|
13731
|
-
*
|
|
13732
|
-
* @param name - Variable name (conventionally prefixed with `?`, e.g., `"?Salary"`).
|
|
13733
|
-
* @param constraint - The constraint as a `TermInputDto` (typically a guard sort).
|
|
13734
|
-
* @returns An object: `{name: "?Salary", constraint: {...}}`.
|
|
13735
|
-
*
|
|
13736
|
-
* @remarks
|
|
13737
|
-
* Serialization format: Untagged (FeatureInputValueDto). Use with homoiconic inference endpoints.
|
|
13738
|
-
* Do NOT use with term CRUD endpoints.
|
|
13739
|
-
*
|
|
13740
|
-
* The most common constraint is a guard, which can be created with the `guard()` builder:
|
|
13741
|
-
* ```typescript
|
|
13742
|
-
* FeatureInput.constrainedVar("?Salary", guard("gt", 100))
|
|
13743
|
-
* ```
|
|
13744
|
-
*
|
|
13745
|
-
* **Critical ordering note**: `ConstrainedVariable` (with `name` + `constraint`) must serialize
|
|
13746
|
-
* before `Variable` (with only `name`) in the Rust `serde(untagged)` deserialization order.
|
|
13747
|
-
* The builder ensures the `constraint` field is always present.
|
|
13748
|
-
*
|
|
13749
|
-
* @example
|
|
13750
|
-
* ```typescript
|
|
13751
|
-
* FeatureInput.constrainedVar("?Salary", guard("gt", 100))
|
|
13752
|
-
* // {name: "?Salary", constraint: {sort_name: "guard_constraint", features: {op: "gt", right: 100}}}
|
|
13753
|
-
* ```
|
|
13754
|
-
*/
|
|
13755
|
-
constrainedVar(name, constraint) {
|
|
13756
|
-
return { name, constraint };
|
|
13757
|
-
},
|
|
13758
|
-
/**
|
|
13759
|
-
* Create an inline term by sort UUID in a feature value position.
|
|
13760
|
-
*
|
|
13761
|
-
* @param sortId - The sort UUID.
|
|
13762
|
-
* @param features - Optional features for the inline term.
|
|
13763
|
-
* @returns An object: `{sort_id: "uuid", features: {...}}`.
|
|
13764
|
-
*
|
|
13765
|
-
* @remarks
|
|
13766
|
-
* Serialization format: Untagged (FeatureInputValueDto). Use with homoiconic inference endpoints.
|
|
13767
|
-
* Do NOT use with term CRUD endpoints.
|
|
13768
|
-
*
|
|
13769
|
-
* @example
|
|
13770
|
-
* ```typescript
|
|
13771
|
-
* FeatureInput.inlineTerm("sort-uuid", { name: FeatureInput.string("Alice") })
|
|
13772
|
-
* ```
|
|
13773
|
-
*/
|
|
13774
|
-
inlineTerm(sortId, features) {
|
|
13775
|
-
return features !== void 0 ? { sort_id: sortId, features } : { sort_id: sortId };
|
|
13776
|
-
},
|
|
13777
|
-
/**
|
|
13778
|
-
* Create an inline term by sort name in a feature value position.
|
|
13779
|
-
*
|
|
13780
|
-
* @param sortName - The sort name (resolved server-side).
|
|
13781
|
-
* @param features - Optional features for the inline term.
|
|
13782
|
-
* @returns An object: `{sort_name: "person", features: {...}}`.
|
|
13783
|
-
*
|
|
13784
|
-
* @remarks
|
|
13785
|
-
* Serialization format: Untagged (FeatureInputValueDto). Use with homoiconic inference endpoints.
|
|
13786
|
-
* Do NOT use with term CRUD endpoints.
|
|
13787
|
-
*
|
|
13788
|
-
* @example
|
|
13789
|
-
* ```typescript
|
|
13790
|
-
* FeatureInput.inlineTermByName("person", { name: FeatureInput.string("Alice") })
|
|
13791
|
-
* ```
|
|
13792
|
-
*/
|
|
13793
|
-
inlineTermByName(sortName, features) {
|
|
13794
|
-
return features !== void 0 ? { sort_name: sortName, features } : { sort_name: sortName };
|
|
13795
|
-
},
|
|
13796
|
-
/**
|
|
13797
|
-
* Create a list of feature input values.
|
|
13798
|
-
*
|
|
13799
|
-
* @param items - The list items as `FeatureInputValueDto` values.
|
|
13800
|
-
* @returns A raw JSON array: `[...]`.
|
|
13801
|
-
*
|
|
13802
|
-
* @remarks
|
|
13803
|
-
* Serialization format: Untagged (FeatureInputValueDto). Use with homoiconic inference endpoints.
|
|
13804
|
-
* Do NOT use with term CRUD endpoints.
|
|
13805
|
-
*
|
|
13806
|
-
* @example
|
|
13807
|
-
* ```typescript
|
|
13808
|
-
* FeatureInput.list([FeatureInput.string("a"), FeatureInput.string("b")])
|
|
13809
|
-
* // ["a", "b"]
|
|
13810
|
-
* ```
|
|
13811
|
-
*/
|
|
13812
|
-
list(items) {
|
|
13813
|
-
return items;
|
|
13814
|
-
}
|
|
13815
|
-
};
|
|
13816
|
-
|
|
13817
|
-
// src/builders/term-input.ts
|
|
13818
|
-
var TermInput = {
|
|
13819
|
-
/**
|
|
13820
|
-
* Reference an existing term by UUID.
|
|
13821
|
-
*
|
|
13822
|
-
* @param termId - The UUID of the existing term.
|
|
13823
|
-
* @returns A reference input: `{term_id: "uuid"}`.
|
|
13824
|
-
*
|
|
13825
|
-
* @remarks
|
|
13826
|
-
* Serialization format: Untagged (TermInputDto). Use as top-level goal or rule head/body
|
|
13827
|
-
* in inference requests.
|
|
13828
|
-
*
|
|
13829
|
-
* @example
|
|
13830
|
-
* ```typescript
|
|
13831
|
-
* TermInput.ref("550e8400-e29b-41d4-a716-446655440000")
|
|
13832
|
-
* // {term_id: "550e8400-e29b-41d4-a716-446655440000"}
|
|
13833
|
-
* ```
|
|
13834
|
-
*/
|
|
13835
|
-
ref(termId) {
|
|
13836
|
-
return { term_id: termId };
|
|
13837
|
-
},
|
|
13838
|
-
/**
|
|
13839
|
-
* Define a term inline using a sort UUID and features.
|
|
13840
|
-
*
|
|
13841
|
-
* @param sortId - The sort UUID.
|
|
13842
|
-
* @param features - Feature map with `FeatureInputValueDto` values.
|
|
13843
|
-
* @returns An inline input: `{sort_id: "uuid", features: {...}}`.
|
|
13844
|
-
*
|
|
13845
|
-
* @remarks
|
|
13846
|
-
* Serialization format: Untagged (TermInputDto). Use as top-level goal or rule head/body
|
|
13847
|
-
* in inference requests.
|
|
13848
|
-
*
|
|
13849
|
-
* The `features` field is required for the sort_id variant per the backend schema.
|
|
13850
|
-
*
|
|
13851
|
-
* @example
|
|
13852
|
-
* ```typescript
|
|
13853
|
-
* TermInput.byId("sort-uuid", {
|
|
13854
|
-
* name: FeatureInput.string("Alice"),
|
|
13855
|
-
* })
|
|
13856
|
-
* ```
|
|
13857
|
-
*/
|
|
13858
|
-
byId(sortId, features) {
|
|
13859
|
-
return { sort_id: sortId, features };
|
|
13860
|
-
},
|
|
13861
|
-
/**
|
|
13862
|
-
* Define a term inline using a sort name and optional features.
|
|
13863
|
-
*
|
|
13864
|
-
* @param sortName - The sort name (resolved server-side to a sort UUID).
|
|
13865
|
-
* @param features - Optional feature map with `FeatureInputValueDto` values.
|
|
13866
|
-
* @returns An inline input: `{sort_name: "person", features: {...}}`.
|
|
13867
|
-
*
|
|
13868
|
-
* @remarks
|
|
13869
|
-
* Serialization format: Untagged (TermInputDto). Use as top-level goal or rule head/body
|
|
13870
|
-
* in inference requests.
|
|
13871
|
-
*
|
|
13872
|
-
* Sort name resolution happens server-side. The name must match an existing sort
|
|
13873
|
-
* in the tenant's sort hierarchy.
|
|
13874
|
-
*
|
|
13875
|
-
* @example
|
|
13876
|
-
* ```typescript
|
|
13877
|
-
* TermInput.byName("person", {
|
|
13878
|
-
* name: FeatureInput.string("Alice"),
|
|
13879
|
-
* age: FeatureInput.integer(30),
|
|
13880
|
-
* })
|
|
13881
|
-
* // {sort_name: "person", features: {name: "Alice", age: 30}}
|
|
13882
|
-
* ```
|
|
13883
|
-
*/
|
|
13884
|
-
byName(sortName, features) {
|
|
13885
|
-
return features !== void 0 ? { sort_name: sortName, features } : { sort_name: sortName };
|
|
14161
|
+
return { kind: "CyclicGaussian", mean, stdDev, period };
|
|
13886
14162
|
}
|
|
13887
14163
|
};
|
|
13888
14164
|
|
|
13889
14165
|
// src/builders/guard.ts
|
|
13890
14166
|
function guard(op, right) {
|
|
13891
14167
|
return {
|
|
13892
|
-
|
|
14168
|
+
sortName: "guard_constraint",
|
|
13893
14169
|
features: { op, right }
|
|
13894
14170
|
};
|
|
13895
14171
|
}
|
|
@@ -14002,7 +14278,7 @@ var SortBuilder = class _SortBuilder {
|
|
|
14002
14278
|
* builder.boundConstraint({
|
|
14003
14279
|
* constraint_type: "upper",
|
|
14004
14280
|
* target: "end_date",
|
|
14005
|
-
* source_path: "company.
|
|
14281
|
+
* source_path: "company.dissolutionDate",
|
|
14006
14282
|
* })
|
|
14007
14283
|
* ```
|
|
14008
14284
|
*/
|
|
@@ -14054,7 +14330,7 @@ var SortBuilder = class _SortBuilder {
|
|
|
14054
14330
|
request.features = this._features;
|
|
14055
14331
|
}
|
|
14056
14332
|
if (this._boundConstraints.length > 0) {
|
|
14057
|
-
request.
|
|
14333
|
+
request.boundConstraints = this._boundConstraints;
|
|
14058
14334
|
}
|
|
14059
14335
|
if (this._description !== null) {
|
|
14060
14336
|
request.description = this._description;
|
|
@@ -14064,80 +14340,26 @@ var SortBuilder = class _SortBuilder {
|
|
|
14064
14340
|
};
|
|
14065
14341
|
|
|
14066
14342
|
// src/builders/psi.ts
|
|
14067
|
-
function isPlainObject(v) {
|
|
14068
|
-
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
14069
|
-
}
|
|
14070
|
-
function coerceObjectFeatures(obj) {
|
|
14071
|
-
const rawFeatures = obj.features;
|
|
14072
|
-
if (!isPlainObject(rawFeatures)) {
|
|
14073
|
-
return void 0;
|
|
14074
|
-
}
|
|
14075
|
-
const coerced = {};
|
|
14076
|
-
for (const [k, v] of Object.entries(rawFeatures)) {
|
|
14077
|
-
coerced[k] = coerceFeatureValue(v);
|
|
14078
|
-
}
|
|
14079
|
-
return coerced;
|
|
14080
|
-
}
|
|
14081
|
-
function coerceFeatureValue(value) {
|
|
14082
|
-
if (value === null) {
|
|
14083
|
-
throw new ValidationError("null is not a valid feature value in psi() shorthand. Use FeatureInput.uninstantiated() for null values.");
|
|
14084
|
-
}
|
|
14085
|
-
if (typeof value === "string") {
|
|
14086
|
-
return value;
|
|
14087
|
-
}
|
|
14088
|
-
if (typeof value === "number") {
|
|
14089
|
-
return value;
|
|
14090
|
-
}
|
|
14091
|
-
if (typeof value === "boolean") {
|
|
14092
|
-
return value;
|
|
14093
|
-
}
|
|
14094
|
-
if (Array.isArray(value)) {
|
|
14095
|
-
return value.map(coerceFeatureValue);
|
|
14096
|
-
}
|
|
14097
|
-
if (isPlainObject(value)) {
|
|
14098
|
-
if ("term_id" in value && typeof value.term_id === "string") {
|
|
14099
|
-
return { term_id: value.term_id };
|
|
14100
|
-
}
|
|
14101
|
-
if ("name" in value && typeof value.name === "string" && "constraint" in value) {
|
|
14102
|
-
return { name: value.name, constraint: value.constraint };
|
|
14103
|
-
}
|
|
14104
|
-
if ("name" in value && typeof value.name === "string") {
|
|
14105
|
-
return { name: value.name };
|
|
14106
|
-
}
|
|
14107
|
-
if ("sort_name" in value && typeof value.sort_name === "string") {
|
|
14108
|
-
const features = coerceObjectFeatures(value);
|
|
14109
|
-
if (features) {
|
|
14110
|
-
return { sort_name: value.sort_name, features };
|
|
14111
|
-
}
|
|
14112
|
-
return { sort_name: value.sort_name };
|
|
14113
|
-
}
|
|
14114
|
-
if ("sort_id" in value && typeof value.sort_id === "string") {
|
|
14115
|
-
const features = coerceObjectFeatures(value);
|
|
14116
|
-
if (features) {
|
|
14117
|
-
return { sort_id: value.sort_id, features };
|
|
14118
|
-
}
|
|
14119
|
-
return { sort_id: value.sort_id };
|
|
14120
|
-
}
|
|
14121
|
-
}
|
|
14122
|
-
throw new ValidationError(`Cannot coerce value of type ${typeof value} to FeatureInputValueDto`);
|
|
14123
|
-
}
|
|
14124
14343
|
function psi(sortName, features) {
|
|
14125
14344
|
if (!features) {
|
|
14126
|
-
return {
|
|
14127
|
-
}
|
|
14128
|
-
const coerced = {};
|
|
14129
|
-
for (const [key, value] of Object.entries(features)) {
|
|
14130
|
-
coerced[key] = coerceFeatureValue(value);
|
|
14345
|
+
return { __psiTerm: true, sortName };
|
|
14131
14346
|
}
|
|
14132
|
-
return {
|
|
14347
|
+
return {
|
|
14348
|
+
__psiTerm: true,
|
|
14349
|
+
sortName,
|
|
14350
|
+
features
|
|
14351
|
+
};
|
|
14352
|
+
}
|
|
14353
|
+
function constrained(name, constraint) {
|
|
14354
|
+
return { __constrainedVar: true, name, constraint };
|
|
14133
14355
|
}
|
|
14134
14356
|
|
|
14135
14357
|
// src/builders/allen.ts
|
|
14136
14358
|
function allen(relation, intervalA, intervalBTermId) {
|
|
14137
14359
|
return {
|
|
14138
14360
|
type: "Allen",
|
|
14139
|
-
|
|
14140
|
-
|
|
14361
|
+
intervalA,
|
|
14362
|
+
intervalBTermId,
|
|
14141
14363
|
relation
|
|
14142
14364
|
};
|
|
14143
14365
|
}
|
|
@@ -14168,30 +14390,85 @@ function discriminateFeatureValue(value) {
|
|
|
14168
14390
|
);
|
|
14169
14391
|
}
|
|
14170
14392
|
|
|
14393
|
+
exports.ActionReviews = action_reviews_exports;
|
|
14394
|
+
exports.Admin = admin_exports;
|
|
14395
|
+
exports.Analysis = analysis_exports;
|
|
14171
14396
|
exports.ApiError = ApiError;
|
|
14397
|
+
exports.AuthenticationError = AuthenticationError;
|
|
14172
14398
|
exports.BadRequestError = BadRequestError;
|
|
14399
|
+
exports.CDL = cdl_exports;
|
|
14400
|
+
exports.Causal = causal_exports;
|
|
14401
|
+
exports.Cognitive = cognitive_exports;
|
|
14402
|
+
exports.Collections = collections_exports;
|
|
14403
|
+
exports.Communities = communities_exports;
|
|
14173
14404
|
exports.ConstraintViolationError = ConstraintViolationError;
|
|
14174
|
-
exports.
|
|
14405
|
+
exports.Constraints = constraints_exports;
|
|
14406
|
+
exports.Control = control_exports;
|
|
14407
|
+
exports.Discovery = discovery_exports;
|
|
14408
|
+
exports.Execution = execution_exports;
|
|
14409
|
+
exports.Extract = extract_exports;
|
|
14410
|
+
exports.ForbiddenError = ForbiddenError;
|
|
14411
|
+
exports.Functions = functions_exports;
|
|
14412
|
+
exports.Fuzzy = fuzzy_exports;
|
|
14175
14413
|
exports.FuzzyShape = FuzzyShape;
|
|
14414
|
+
exports.Generation = generation_exports;
|
|
14415
|
+
exports.Health = health_exports;
|
|
14416
|
+
exports.Homoiconic = homoiconic_exports;
|
|
14417
|
+
exports.ILP = ilp_exports;
|
|
14418
|
+
exports.ImageExtraction = image_extraction_exports;
|
|
14419
|
+
exports.Inference = inference_exports;
|
|
14420
|
+
exports.Ingestion = ingestion_exports;
|
|
14176
14421
|
exports.InternalServerError = InternalServerError;
|
|
14177
14422
|
exports.LP = LP;
|
|
14423
|
+
exports.Namespaces = namespaces_exports;
|
|
14178
14424
|
exports.NetworkError = NetworkError;
|
|
14425
|
+
exports.NeuroSymbolic = neuro_symbolic_exports;
|
|
14179
14426
|
exports.NotFoundError = NotFoundError;
|
|
14427
|
+
exports.Ontology = ontology_exports;
|
|
14428
|
+
exports.Optimize = optimize_exports;
|
|
14429
|
+
exports.Oversight = oversight_exports;
|
|
14430
|
+
exports.PlainValues = plain_values_exports;
|
|
14431
|
+
exports.Preferences = preferences_exports;
|
|
14432
|
+
exports.ProofEngine = proof_engine_exports;
|
|
14433
|
+
exports.Query = query_exports;
|
|
14434
|
+
exports.RAG = rag_exports;
|
|
14180
14435
|
exports.RateLimitError = RateLimitError;
|
|
14436
|
+
exports.Reasoning = reasoning_exports;
|
|
14181
14437
|
exports.ReasoningLayerClient = ReasoningLayerClient;
|
|
14182
14438
|
exports.ReasoningLayerError = ReasoningLayerError;
|
|
14439
|
+
exports.Reviews = reviews_exports;
|
|
14440
|
+
exports.Row = row_exports;
|
|
14183
14441
|
exports.SDK_VERSION = SDK_VERSION;
|
|
14442
|
+
exports.Scenarios = scenarios_exports;
|
|
14184
14443
|
exports.SortBuilder = SortBuilder;
|
|
14185
|
-
exports.
|
|
14444
|
+
exports.Sorts = sorts_exports;
|
|
14445
|
+
exports.Sources = sources_exports;
|
|
14446
|
+
exports.Spaces = spaces_exports;
|
|
14447
|
+
exports.Statistical = statistical_exports;
|
|
14448
|
+
exports.Synthetic = synthetic_exports;
|
|
14449
|
+
exports.Terms = terms_exports;
|
|
14186
14450
|
exports.TimeoutError = TimeoutError;
|
|
14451
|
+
exports.Utilities = utilities_exports;
|
|
14187
14452
|
exports.ValidationError = ValidationError;
|
|
14188
14453
|
exports.Value = Value;
|
|
14454
|
+
exports.Values = values_exports;
|
|
14455
|
+
exports.Visualization = visualization_exports;
|
|
14189
14456
|
exports.WebSocketClient = WebSocketClient;
|
|
14190
14457
|
exports.WebSocketConnection = WebSocketConnection;
|
|
14458
|
+
exports.WebhookActions = webhook_actions_exports;
|
|
14191
14459
|
exports.allen = allen;
|
|
14460
|
+
exports.constrained = constrained;
|
|
14192
14461
|
exports.discriminateFeatureValue = discriminateFeatureValue;
|
|
14193
14462
|
exports.guard = guard;
|
|
14463
|
+
exports.isConstrainedPlainVar = isConstrainedPlainVar;
|
|
14464
|
+
exports.isPsiTermInput = isPsiTermInput;
|
|
14465
|
+
exports.isTaggedValueDto = isTaggedValueDto;
|
|
14194
14466
|
exports.isUuid = isUuid;
|
|
14195
14467
|
exports.psi = psi;
|
|
14468
|
+
exports.toTaggedFeatures = toTaggedFeatures;
|
|
14469
|
+
exports.toTaggedValue = toTaggedValue;
|
|
14470
|
+
exports.toTermInputDto = toTermInputDto;
|
|
14471
|
+
exports.toUntaggedFeatures = toUntaggedFeatures;
|
|
14472
|
+
exports.toUntaggedValue = toUntaggedValue;
|
|
14196
14473
|
//# sourceMappingURL=index.cjs.map
|
|
14197
14474
|
//# sourceMappingURL=index.cjs.map
|