@kortexya/reasoninglayer 0.16.0 → 0.18.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 +163 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +468 -6
- package/dist/index.d.ts +468 -6
- package/dist/index.js +163 -3
- 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.18.0";
|
|
5
5
|
function resolveConfig(config) {
|
|
6
6
|
if (!config.baseUrl) {
|
|
7
7
|
throw new Error("ClientConfig.baseUrl is required");
|
|
@@ -5111,6 +5111,42 @@ var Query = class {
|
|
|
5111
5111
|
format: "json",
|
|
5112
5112
|
...params
|
|
5113
5113
|
});
|
|
5114
|
+
/**
|
|
5115
|
+
* @description Skips the NL → structured-problem LLM hop entirely. Caller must have seeded the tenant KB with ≥ 3 successful + ≥ 2 limited Ψ-terms per domain (`/api/v1/terms/bulk` or `/api/v1/inference/facts/bulk`). Returns the same `NlQueryResponse` shape as the NL route so the UI can render either output uniformly.
|
|
5116
|
+
*
|
|
5117
|
+
* @tags query
|
|
5118
|
+
* @name TrizInvent
|
|
5119
|
+
* @summary Handle `POST /api/v1/triz/invent` — deterministic TRIZ invention.
|
|
5120
|
+
* @request POST:/api/v1/triz/invent
|
|
5121
|
+
* @secure
|
|
5122
|
+
*/
|
|
5123
|
+
trizInvent = (data, params = {}) => this.http.request({
|
|
5124
|
+
path: `/api/v1/triz/invent`,
|
|
5125
|
+
method: "POST",
|
|
5126
|
+
body: data,
|
|
5127
|
+
secure: true,
|
|
5128
|
+
type: "application/json" /* Json */,
|
|
5129
|
+
format: "json",
|
|
5130
|
+
...params
|
|
5131
|
+
});
|
|
5132
|
+
/**
|
|
5133
|
+
* No description
|
|
5134
|
+
*
|
|
5135
|
+
* @tags query
|
|
5136
|
+
* @name TrizRecordOutcome
|
|
5137
|
+
* @summary Handle `POST /api/v1/triz/record-outcome` — persist a measured outcome for a previously-emitted TRIZ proposal and learn from it.
|
|
5138
|
+
* @request POST:/api/v1/triz/record-outcome
|
|
5139
|
+
* @secure
|
|
5140
|
+
*/
|
|
5141
|
+
trizRecordOutcome = (data, params = {}) => this.http.request({
|
|
5142
|
+
path: `/api/v1/triz/record-outcome`,
|
|
5143
|
+
method: "POST",
|
|
5144
|
+
body: data,
|
|
5145
|
+
secure: true,
|
|
5146
|
+
type: "application/json" /* Json */,
|
|
5147
|
+
format: "json",
|
|
5148
|
+
...params
|
|
5149
|
+
});
|
|
5114
5150
|
/**
|
|
5115
5151
|
* @description This performs unification AND validates the result against the GLB sort's witnesses. ## How It Differs from Regular Unification **Regular `/api/v1/term-store/sessions/:id/unify` (POST)**: - Computes GLB and unifies terms - Validates sort constraints (required features, type hints) - Does NOT check witnesses **This endpoint `/api/v1/query/validated-unify` (POST)**: - Computes GLB and unifies terms - Validates sort constraints - ALSO checks witnesses on the result - Returns proof of validity ## Example Unifying `person(name => "Alice")` with `grandparent(grandchild => "Charlie")`: 1. Computes GLB of person and grandparent 2. Creates unified term with both features 3. Checks grandparent witnesses: ∃Y. parent(Alice,Y) ∧ parent(Y,Charlie) 4. Returns unified term + witness proof
|
|
5116
5152
|
*
|
|
@@ -7343,6 +7379,30 @@ var Health = class {
|
|
|
7343
7379
|
});
|
|
7344
7380
|
};
|
|
7345
7381
|
|
|
7382
|
+
// src/api-spec/generated/Scheduling.ts
|
|
7383
|
+
var Scheduling = class {
|
|
7384
|
+
http;
|
|
7385
|
+
constructor(http) {
|
|
7386
|
+
this.http = http;
|
|
7387
|
+
}
|
|
7388
|
+
/**
|
|
7389
|
+
* @description Classify every `(agent, day, shift)` cell in the input grid as confirmed-true, confirmed-false, or free. Input validation errors (duplicate agent IDs, out-of-range pins, role minima exceeding total demand, etc.) return HTTP 400. Infeasibility of a well-formed problem is a valid answer and returns HTTP 200 with `status = "infeasible"` and an empty `assignments` list.
|
|
7390
|
+
*
|
|
7391
|
+
* @tags scheduling
|
|
7392
|
+
* @name Feasibility
|
|
7393
|
+
* @summary `POST /api/v1/scheduling/feasibility`
|
|
7394
|
+
* @request POST:/api/v1/scheduling/feasibility
|
|
7395
|
+
*/
|
|
7396
|
+
feasibility = (data, params = {}) => this.http.request({
|
|
7397
|
+
path: `/api/v1/scheduling/feasibility`,
|
|
7398
|
+
method: "POST",
|
|
7399
|
+
body: data,
|
|
7400
|
+
type: "application/json" /* Json */,
|
|
7401
|
+
format: "json",
|
|
7402
|
+
...params
|
|
7403
|
+
});
|
|
7404
|
+
};
|
|
7405
|
+
|
|
7346
7406
|
// src/api-spec/generated/Admin.ts
|
|
7347
7407
|
var Admin = class {
|
|
7348
7408
|
http;
|
|
@@ -20404,6 +20464,99 @@ function extractNumericValue(features, featureName) {
|
|
|
20404
20464
|
return null;
|
|
20405
20465
|
}
|
|
20406
20466
|
|
|
20467
|
+
// src/normalizers/scheduling.ts
|
|
20468
|
+
function AgentSpecFromFrontToApi(spec) {
|
|
20469
|
+
const dto = {
|
|
20470
|
+
id: spec.id,
|
|
20471
|
+
max_assignments: spec.maxAssignments
|
|
20472
|
+
};
|
|
20473
|
+
if (spec.roles !== void 0) {
|
|
20474
|
+
dto.roles = spec.roles;
|
|
20475
|
+
}
|
|
20476
|
+
if (spec.unavailableDays !== void 0) {
|
|
20477
|
+
dto.unavailable_days = spec.unavailableDays;
|
|
20478
|
+
}
|
|
20479
|
+
if (spec.restrictedToShift !== void 0 && spec.restrictedToShift !== null) {
|
|
20480
|
+
dto.restricted_to_shift = spec.restrictedToShift;
|
|
20481
|
+
}
|
|
20482
|
+
return dto;
|
|
20483
|
+
}
|
|
20484
|
+
function ShiftDemandFromFrontToApi(demand) {
|
|
20485
|
+
const dto = {
|
|
20486
|
+
day: demand.day,
|
|
20487
|
+
shift: demand.shift,
|
|
20488
|
+
total: demand.total
|
|
20489
|
+
};
|
|
20490
|
+
if (demand.roleMinimums !== void 0) {
|
|
20491
|
+
dto.role_minimums = demand.roleMinimums;
|
|
20492
|
+
}
|
|
20493
|
+
return dto;
|
|
20494
|
+
}
|
|
20495
|
+
function PinFromFrontToApi(pin) {
|
|
20496
|
+
return {
|
|
20497
|
+
agent_id: pin.agentId,
|
|
20498
|
+
day: pin.day,
|
|
20499
|
+
shift: pin.shift
|
|
20500
|
+
};
|
|
20501
|
+
}
|
|
20502
|
+
function SchedulingFeasibilityRequestFromFrontToApi(request) {
|
|
20503
|
+
const dto = {
|
|
20504
|
+
agents: request.agents.map(AgentSpecFromFrontToApi),
|
|
20505
|
+
days: request.days,
|
|
20506
|
+
shifts_per_day: request.shiftsPerDay,
|
|
20507
|
+
demands: request.demands.map(ShiftDemandFromFrontToApi)
|
|
20508
|
+
};
|
|
20509
|
+
if (request.pins !== void 0) {
|
|
20510
|
+
dto.pins = request.pins.map(PinFromFrontToApi);
|
|
20511
|
+
}
|
|
20512
|
+
return dto;
|
|
20513
|
+
}
|
|
20514
|
+
function AssignmentFromApiToFront(dto) {
|
|
20515
|
+
return {
|
|
20516
|
+
agentId: dto.agent_id,
|
|
20517
|
+
day: dto.day,
|
|
20518
|
+
shift: dto.shift,
|
|
20519
|
+
status: dto.status
|
|
20520
|
+
};
|
|
20521
|
+
}
|
|
20522
|
+
function SchedulingFeasibilityResponseFromApiToFront(dto) {
|
|
20523
|
+
return {
|
|
20524
|
+
status: dto.status,
|
|
20525
|
+
assignments: dto.assignments.map(AssignmentFromApiToFront)
|
|
20526
|
+
};
|
|
20527
|
+
}
|
|
20528
|
+
|
|
20529
|
+
// src/resources/scheduling.ts
|
|
20530
|
+
var SchedulingClient = class {
|
|
20531
|
+
/** @internal */
|
|
20532
|
+
api;
|
|
20533
|
+
/** @internal */
|
|
20534
|
+
constructor(api) {
|
|
20535
|
+
this.api = api;
|
|
20536
|
+
}
|
|
20537
|
+
/**
|
|
20538
|
+
* Classify every `(agent, day, shift)` cell in the input grid as
|
|
20539
|
+
* `confirmed_true`, `confirmed_false`, or `free`.
|
|
20540
|
+
*
|
|
20541
|
+
* @param request - the scheduling problem to analyse.
|
|
20542
|
+
* @returns a {@link SchedulingFeasibilityResponse} with per-cell classifications.
|
|
20543
|
+
* @throws If the backend rejects the input (HTTP 400): duplicate agent
|
|
20544
|
+
* IDs, pins referencing unknown agents, role minima exceeding total
|
|
20545
|
+
* demand, out-of-range day/shift indices, etc.
|
|
20546
|
+
*
|
|
20547
|
+
* @remarks
|
|
20548
|
+
* Infeasibility of a well-formed problem is a **valid answer** (HTTP 200
|
|
20549
|
+
* with `status === "infeasible"`), not an error. Only malformed input
|
|
20550
|
+
* raises.
|
|
20551
|
+
*/
|
|
20552
|
+
async feasibility(request) {
|
|
20553
|
+
const response = await this.api.feasibility(
|
|
20554
|
+
SchedulingFeasibilityRequestFromFrontToApi(request)
|
|
20555
|
+
);
|
|
20556
|
+
return SchedulingFeasibilityResponseFromApiToFront(response.data);
|
|
20557
|
+
}
|
|
20558
|
+
};
|
|
20559
|
+
|
|
20407
20560
|
// src/normalizers/osfql.ts
|
|
20408
20561
|
function OsfqlResponseFromApiToFront(dto) {
|
|
20409
20562
|
return {
|
|
@@ -21554,6 +21707,8 @@ var ReasoningLayerClient = class {
|
|
|
21554
21707
|
rag;
|
|
21555
21708
|
/** Linear program optimization (CLP(Q) simplex solver via backward chaining). */
|
|
21556
21709
|
optimize;
|
|
21710
|
+
/** Scheduling feasibility via capacitated bipartite b-matching (staff rostering, assignment problems). */
|
|
21711
|
+
scheduling;
|
|
21557
21712
|
/** OSFQL execution operations. */
|
|
21558
21713
|
osfql;
|
|
21559
21714
|
/** Conversational AI operations (NL → OSFQL with self-correction). */
|
|
@@ -21629,10 +21784,11 @@ var ReasoningLayerClient = class {
|
|
|
21629
21784
|
rlTraining: this.rlTraining
|
|
21630
21785
|
};
|
|
21631
21786
|
}
|
|
21632
|
-
/** Advanced reasoning operations — optimization, ILP, CDL, execution, preferences, discovery. */
|
|
21787
|
+
/** Advanced reasoning operations — optimization, ILP, CDL, execution, preferences, discovery, scheduling. */
|
|
21633
21788
|
get reasoningOps() {
|
|
21634
21789
|
return this._reasoning ??= {
|
|
21635
21790
|
optimize: this.optimize,
|
|
21791
|
+
scheduling: this.scheduling,
|
|
21636
21792
|
ilp: this.ilp,
|
|
21637
21793
|
cdl: this.cdl,
|
|
21638
21794
|
execution: this.execution,
|
|
@@ -21787,6 +21943,7 @@ var ReasoningLayerClient = class {
|
|
|
21787
21943
|
this.generation = new GenerationClient(generatedGeneration);
|
|
21788
21944
|
this.rag = new RagClient(generatedRag);
|
|
21789
21945
|
this.optimize = new OptimizeClient(generatedInference, generatedSorts, generatedQuery, generatedTerms, resolved.tenantId);
|
|
21946
|
+
this.scheduling = new SchedulingClient(new Scheduling(generatedHttp));
|
|
21790
21947
|
this.osfql = new OsfqlClient(generatedOsfql);
|
|
21791
21948
|
this.conversation = new ConversationClient(generatedHttp);
|
|
21792
21949
|
this.research = new ResearchClient(generatedHttp);
|
|
@@ -21931,6 +22088,9 @@ var rag_exports = {};
|
|
|
21931
22088
|
// src/types/optimize.ts
|
|
21932
22089
|
var optimize_exports = {};
|
|
21933
22090
|
|
|
22091
|
+
// src/types/scheduling.ts
|
|
22092
|
+
var scheduling_exports = {};
|
|
22093
|
+
|
|
21934
22094
|
// src/types/ilp.ts
|
|
21935
22095
|
var ilp_exports = {};
|
|
21936
22096
|
|
|
@@ -22675,6 +22835,7 @@ exports.Reviews = reviews_exports;
|
|
|
22675
22835
|
exports.Row = row_exports;
|
|
22676
22836
|
exports.SDK_VERSION = SDK_VERSION;
|
|
22677
22837
|
exports.Scenarios = scenarios_exports;
|
|
22838
|
+
exports.Scheduling = scheduling_exports;
|
|
22678
22839
|
exports.SortBuilder = SortBuilder;
|
|
22679
22840
|
exports.Sorts = sorts_exports;
|
|
22680
22841
|
exports.Sources = sources_exports;
|