@kortexya/reasoninglayer 1.24.0 → 1.25.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 +164 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +595 -18
- package/dist/index.d.ts +595 -18
- package/dist/index.js +164 -5
- package/dist/index.js.map +1 -1
- package/package.json +5 -3
package/dist/index.cjs
CHANGED
|
@@ -7,7 +7,7 @@ var __export = (target, all) => {
|
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
// src/config.ts
|
|
10
|
-
var SDK_VERSION = "1.
|
|
10
|
+
var SDK_VERSION = "1.25.0";
|
|
11
11
|
function resolveConfig(config) {
|
|
12
12
|
if (!config.baseUrl) {
|
|
13
13
|
throw new Error("ClientConfig.baseUrl is required");
|
|
@@ -8440,6 +8440,23 @@ var Functions = class {
|
|
|
8440
8440
|
constructor(http) {
|
|
8441
8441
|
this.http = http;
|
|
8442
8442
|
}
|
|
8443
|
+
/**
|
|
8444
|
+
* @description # The disposition is the caller's `?callers=refuse` (the default) refuses while anything calls the function and names every caller; `?callers=orphan` withdraws it anyway and reports the callers left naming something that no longer resolves. A withdrawal that silently orphans its callers is the state the missing route already produced. # Authorization Requires `X-Tenant-Id`. The function store is tenant-keyed, so another tenant's function is `404` rather than forbidden. Every request is captured by the audit middleware.
|
|
8445
|
+
*
|
|
8446
|
+
* @tags functions
|
|
8447
|
+
* @name DeleteFunction
|
|
8448
|
+
* @summary Withdraw a registered function.
|
|
8449
|
+
* @request DELETE:/api/v1/functions/{name}
|
|
8450
|
+
* @secure
|
|
8451
|
+
*/
|
|
8452
|
+
deleteFunction = (name, query, params = {}) => this.http.request({
|
|
8453
|
+
path: `/api/v1/functions/${name}`,
|
|
8454
|
+
method: "DELETE",
|
|
8455
|
+
query,
|
|
8456
|
+
secure: true,
|
|
8457
|
+
format: "json",
|
|
8458
|
+
...params
|
|
8459
|
+
});
|
|
8443
8460
|
/**
|
|
8444
8461
|
* @description Never writes to the KB — returns a validated draft for human review.
|
|
8445
8462
|
*
|
|
@@ -8510,6 +8527,24 @@ var Functions = class {
|
|
|
8510
8527
|
format: "json",
|
|
8511
8528
|
...params
|
|
8512
8529
|
});
|
|
8530
|
+
/**
|
|
8531
|
+
* @description # Why this is not `POST /functions/register` Registration already replaces by name — silently, reporting nothing about what it displaced. `PUT` is the operation that says so: it refuses when nothing is registered under the name (that is registration's job), and answers with the previous signature, the new one, whether the arity moved, and everything that calls the function. # The arity is the hazard A function's identity is its NAME, so a replacement keeps every caller's reference valid — nothing dangles. That is exactly why an arity change is dangerous rather than merely breaking: every call still resolves, and one passing the old number of arguments starts failing at evaluation time. Reported, not refused: the caller may be replacing the function precisely because its signature was wrong. # Authorization Identical to `DELETE`: tenant-keyed, plugin-owned functions refused, audited.
|
|
8532
|
+
*
|
|
8533
|
+
* @tags functions
|
|
8534
|
+
* @name ReplaceFunction
|
|
8535
|
+
* @summary Replace a registered function's definition.
|
|
8536
|
+
* @request PUT:/api/v1/functions/{name}
|
|
8537
|
+
* @secure
|
|
8538
|
+
*/
|
|
8539
|
+
replaceFunction = (name, data, params = {}) => this.http.request({
|
|
8540
|
+
path: `/api/v1/functions/${name}`,
|
|
8541
|
+
method: "PUT",
|
|
8542
|
+
body: data,
|
|
8543
|
+
secure: true,
|
|
8544
|
+
type: "application/json",
|
|
8545
|
+
format: "json",
|
|
8546
|
+
...params
|
|
8547
|
+
});
|
|
8513
8548
|
};
|
|
8514
8549
|
|
|
8515
8550
|
// src/api-spec/generated/WebhookActions.ts
|
|
@@ -14332,7 +14367,13 @@ function RuleEntryDtoFromApiToFront(dto) {
|
|
|
14332
14367
|
ruleId: dto.rule_id,
|
|
14333
14368
|
head: PsiTermDtoFromApiToFront(dto.head),
|
|
14334
14369
|
body: dto.body.map(PsiTermDtoFromApiToFront),
|
|
14335
|
-
certainty: dto.certainty ?? void 0
|
|
14370
|
+
certainty: dto.certainty ?? void 0,
|
|
14371
|
+
origin: dto.origin,
|
|
14372
|
+
withdrawable: dto.withdrawable,
|
|
14373
|
+
notWithdrawable: dto.not_withdrawable ? {
|
|
14374
|
+
code: dto.not_withdrawable.code,
|
|
14375
|
+
reason: dto.not_withdrawable.reason
|
|
14376
|
+
} : void 0
|
|
14336
14377
|
};
|
|
14337
14378
|
}
|
|
14338
14379
|
function GetRulesResponseFromApiToFront(dto) {
|
|
@@ -15231,7 +15272,8 @@ function FindBySortRequestFromFrontToApi(model) {
|
|
|
15231
15272
|
return {
|
|
15232
15273
|
sort_id: model.sortId ?? void 0,
|
|
15233
15274
|
sort_name: model.sortName ?? void 0,
|
|
15234
|
-
filter: model.filter ?? void 0
|
|
15275
|
+
filter: model.filter ?? void 0,
|
|
15276
|
+
limit: model.limit ?? void 0
|
|
15235
15277
|
};
|
|
15236
15278
|
}
|
|
15237
15279
|
function OsfSearchRequestFromFrontToApi(model) {
|
|
@@ -17403,7 +17445,7 @@ var ConstraintsClient = class {
|
|
|
17403
17445
|
type: "application/json",
|
|
17404
17446
|
format: "json"
|
|
17405
17447
|
});
|
|
17406
|
-
return response.data;
|
|
17448
|
+
return ConstraintGraphResponseFromApiToFront(response.data);
|
|
17407
17449
|
}
|
|
17408
17450
|
// --- Session Management ---
|
|
17409
17451
|
/**
|
|
@@ -23478,9 +23520,11 @@ function StructuredIngestionStatsDtoFromApiToFront(dto) {
|
|
|
23478
23520
|
elapsedMs: dto.elapsed_ms,
|
|
23479
23521
|
entitiesCreated: dto.entities_created,
|
|
23480
23522
|
entitiesExtracted: dto.entities_extracted,
|
|
23523
|
+
recordsAvailable: dto.records_available,
|
|
23481
23524
|
recordsProcessed: dto.records_processed,
|
|
23482
23525
|
relationsCreated: dto.relations_created,
|
|
23483
23526
|
relationsDiscovered: dto.relations_discovered,
|
|
23527
|
+
rowsCollapsed: dto.rows_collapsed,
|
|
23484
23528
|
sortsCreated: dto.sorts_created,
|
|
23485
23529
|
tablesDiscovered: dto.tables_discovered,
|
|
23486
23530
|
termsCreated: dto.terms_created,
|
|
@@ -26337,6 +26381,34 @@ function DraftFunctionResponseFromApiToFront(dto) {
|
|
|
26337
26381
|
warnings: dto.warnings
|
|
26338
26382
|
};
|
|
26339
26383
|
}
|
|
26384
|
+
function FunctionCallerFromApiToFront(dto) {
|
|
26385
|
+
return {
|
|
26386
|
+
kind: dto.kind,
|
|
26387
|
+
name: dto.name,
|
|
26388
|
+
termId: dto.term_id ?? void 0
|
|
26389
|
+
};
|
|
26390
|
+
}
|
|
26391
|
+
function FunctionWithdrawalReportFromApiToFront(dto) {
|
|
26392
|
+
return {
|
|
26393
|
+
name: dto.name,
|
|
26394
|
+
functionId: dto.function_id,
|
|
26395
|
+
carrierDeleted: dto.carrier_deleted,
|
|
26396
|
+
deregistered: dto.deregistered,
|
|
26397
|
+
// The wire omits the field when nothing was orphaned; the SDK always
|
|
26398
|
+
// hands back an array, so a caller never has to guard the read.
|
|
26399
|
+
callersOrphaned: (dto.callers_orphaned ?? []).map(FunctionCallerFromApiToFront)
|
|
26400
|
+
};
|
|
26401
|
+
}
|
|
26402
|
+
function ReplaceFunctionResponseFromApiToFront(dto) {
|
|
26403
|
+
return {
|
|
26404
|
+
name: dto.name,
|
|
26405
|
+
functionId: dto.function_id,
|
|
26406
|
+
previous: FunctionSummaryDtoFromApiToFront(dto.previous),
|
|
26407
|
+
current: FunctionSummaryDtoFromApiToFront(dto.current),
|
|
26408
|
+
arityChanged: dto.arity_changed,
|
|
26409
|
+
callers: (dto.callers ?? []).map(FunctionCallerFromApiToFront)
|
|
26410
|
+
};
|
|
26411
|
+
}
|
|
26340
26412
|
|
|
26341
26413
|
// src/resources/functions.ts
|
|
26342
26414
|
var FunctionsClient = class {
|
|
@@ -26481,6 +26553,85 @@ var FunctionsClient = class {
|
|
|
26481
26553
|
const response = await this.api.listFunctions();
|
|
26482
26554
|
return ListFunctionsResponseFromApiToFront(response.data);
|
|
26483
26555
|
}
|
|
26556
|
+
/**
|
|
26557
|
+
* Withdraw a registered function.
|
|
26558
|
+
*
|
|
26559
|
+
* @param name - The registered function's name — its identity.
|
|
26560
|
+
* @param options - `callers` decides what happens to the things that call
|
|
26561
|
+
* it. Defaults to `'refuse'`.
|
|
26562
|
+
* @returns What the withdrawal removed, in each representation that held it.
|
|
26563
|
+
* @throws {ApiError} 400 if something still calls the function under the
|
|
26564
|
+
* default `'refuse'` (the body carries `code: 'function_has_callers'` and
|
|
26565
|
+
* the caller list); 403 for a plugin-contributed function; 404 if nothing
|
|
26566
|
+
* is registered under that name.
|
|
26567
|
+
*
|
|
26568
|
+
* @remarks
|
|
26569
|
+
* A function is carried twice — the durable `meta.function` carrier that is
|
|
26570
|
+
* the source of truth, and the evaluator's own registry used for dispatch
|
|
26571
|
+
* and recursive cross-calls — and the report names both, because forgetting
|
|
26572
|
+
* either leaves it half-alive: still evaluable, or back after a restart.
|
|
26573
|
+
*
|
|
26574
|
+
* `'refuse'` names every caller; `'orphan'` withdraws anyway and reports the
|
|
26575
|
+
* callers left naming something that no longer resolves.
|
|
26576
|
+
*
|
|
26577
|
+
* @example
|
|
26578
|
+
* ```typescript
|
|
26579
|
+
* const report = await client.functions.deleteFunction('scale', { callers: 'orphan' });
|
|
26580
|
+
* for (const orphan of report.callersOrphaned) {
|
|
26581
|
+
* console.warn(`${orphan.kind} ${orphan.name} now calls a function that is gone`);
|
|
26582
|
+
* }
|
|
26583
|
+
* ```
|
|
26584
|
+
*/
|
|
26585
|
+
async deleteFunction(name, options) {
|
|
26586
|
+
const response = await this.api.deleteFunction(
|
|
26587
|
+
name,
|
|
26588
|
+
options?.callers === void 0 ? void 0 : { callers: options.callers }
|
|
26589
|
+
);
|
|
26590
|
+
return FunctionWithdrawalReportFromApiToFront(response.data);
|
|
26591
|
+
}
|
|
26592
|
+
/**
|
|
26593
|
+
* Replace a registered function's definition.
|
|
26594
|
+
*
|
|
26595
|
+
* @param name - The registered function's name. Unchanged by the
|
|
26596
|
+
* replacement — the name IS the identity.
|
|
26597
|
+
* @param request - The replacement's arity and clauses.
|
|
26598
|
+
* @returns Both signatures, whether the arity moved, and everything that
|
|
26599
|
+
* calls the function.
|
|
26600
|
+
* @throws {ApiError} 400 if the replacement's clauses are rejected — in
|
|
26601
|
+
* which case the registration is left exactly as it was; 403 for a
|
|
26602
|
+
* plugin-contributed function; 404 if nothing is registered under that
|
|
26603
|
+
* name (creating one is {@link FunctionsClient.registerFunction}'s job).
|
|
26604
|
+
*
|
|
26605
|
+
* @remarks
|
|
26606
|
+
* `registerFunction` already replaces by name — silently, reporting nothing
|
|
26607
|
+
* about what it displaced. This is the operation that says so.
|
|
26608
|
+
*
|
|
26609
|
+
* A function's identity is its NAME, so a replacement keeps every caller's
|
|
26610
|
+
* reference valid: nothing dangles. That is exactly why an arity change is
|
|
26611
|
+
* the dangerous edit — every call still resolves, and one passing the old
|
|
26612
|
+
* argument count starts failing at evaluation time. `arityChanged` is
|
|
26613
|
+
* reported rather than refused, because a caller may be replacing the
|
|
26614
|
+
* function precisely because its signature was wrong.
|
|
26615
|
+
*
|
|
26616
|
+
* @example
|
|
26617
|
+
* ```typescript
|
|
26618
|
+
* const result = await client.functions.replaceFunction('scale', {
|
|
26619
|
+
* arity: 2,
|
|
26620
|
+
* clauses: [multiplyClause],
|
|
26621
|
+
* });
|
|
26622
|
+
* if (result.arityChanged) {
|
|
26623
|
+
* console.warn(`arity ${result.previous.arity} -> ${result.current.arity};`,
|
|
26624
|
+
* `${result.callers.length} caller(s) were written against the old one`);
|
|
26625
|
+
* }
|
|
26626
|
+
* ```
|
|
26627
|
+
*/
|
|
26628
|
+
async replaceFunction(name, request) {
|
|
26629
|
+
const response = await this.api.replaceFunction(name, {
|
|
26630
|
+
arity: request.arity,
|
|
26631
|
+
clauses: request.clauses.map(FunctionClauseDtoFromFrontToApi)
|
|
26632
|
+
});
|
|
26633
|
+
return ReplaceFunctionResponseFromApiToFront(response.data);
|
|
26634
|
+
}
|
|
26484
26635
|
/**
|
|
26485
26636
|
* Draft a user-defined function from a natural-language description.
|
|
26486
26637
|
*
|
|
@@ -27734,6 +27885,7 @@ function ClearTenantResponseFromApiToFront(dto) {
|
|
|
27734
27885
|
sortsDeleted: dto.sorts_deleted,
|
|
27735
27886
|
inferenceStateCleared: dto.inference_state_cleared,
|
|
27736
27887
|
cacheInvalidated: dto.cache_invalidated,
|
|
27888
|
+
vectorsDeleted: dto.vectors_deleted,
|
|
27737
27889
|
pluginInstallsDeleted: dto.plugin_installs_deleted
|
|
27738
27890
|
};
|
|
27739
27891
|
}
|
|
@@ -32898,7 +33050,14 @@ function BindingSummaryDtoFromApiToFront(dto) {
|
|
|
32898
33050
|
keyColumns: dto.key_columns,
|
|
32899
33051
|
sortId: dto.sort_id,
|
|
32900
33052
|
sourceId: dto.source_id,
|
|
32901
|
-
tableName: dto.table_name
|
|
33053
|
+
tableName: dto.table_name,
|
|
33054
|
+
keyProvenance: {
|
|
33055
|
+
source: dto.key_provenance.source,
|
|
33056
|
+
chosenBy: dto.key_provenance.chosen_by,
|
|
33057
|
+
explanation: dto.key_provenance.explanation,
|
|
33058
|
+
guaranteedUnique: dto.key_provenance.guaranteed_unique,
|
|
33059
|
+
durability: dto.key_provenance.durability
|
|
33060
|
+
}
|
|
32902
33061
|
};
|
|
32903
33062
|
}
|
|
32904
33063
|
function ListBindingsResponseFromApiToFront(dto) {
|