@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.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/config.ts
|
|
2
|
-
var SDK_VERSION = "0.
|
|
2
|
+
var SDK_VERSION = "0.18.0";
|
|
3
3
|
function resolveConfig(config) {
|
|
4
4
|
if (!config.baseUrl) {
|
|
5
5
|
throw new Error("ClientConfig.baseUrl is required");
|
|
@@ -5109,6 +5109,42 @@ var Query = class {
|
|
|
5109
5109
|
format: "json",
|
|
5110
5110
|
...params
|
|
5111
5111
|
});
|
|
5112
|
+
/**
|
|
5113
|
+
* @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.
|
|
5114
|
+
*
|
|
5115
|
+
* @tags query
|
|
5116
|
+
* @name TrizInvent
|
|
5117
|
+
* @summary Handle `POST /api/v1/triz/invent` — deterministic TRIZ invention.
|
|
5118
|
+
* @request POST:/api/v1/triz/invent
|
|
5119
|
+
* @secure
|
|
5120
|
+
*/
|
|
5121
|
+
trizInvent = (data, params = {}) => this.http.request({
|
|
5122
|
+
path: `/api/v1/triz/invent`,
|
|
5123
|
+
method: "POST",
|
|
5124
|
+
body: data,
|
|
5125
|
+
secure: true,
|
|
5126
|
+
type: "application/json" /* Json */,
|
|
5127
|
+
format: "json",
|
|
5128
|
+
...params
|
|
5129
|
+
});
|
|
5130
|
+
/**
|
|
5131
|
+
* No description
|
|
5132
|
+
*
|
|
5133
|
+
* @tags query
|
|
5134
|
+
* @name TrizRecordOutcome
|
|
5135
|
+
* @summary Handle `POST /api/v1/triz/record-outcome` — persist a measured outcome for a previously-emitted TRIZ proposal and learn from it.
|
|
5136
|
+
* @request POST:/api/v1/triz/record-outcome
|
|
5137
|
+
* @secure
|
|
5138
|
+
*/
|
|
5139
|
+
trizRecordOutcome = (data, params = {}) => this.http.request({
|
|
5140
|
+
path: `/api/v1/triz/record-outcome`,
|
|
5141
|
+
method: "POST",
|
|
5142
|
+
body: data,
|
|
5143
|
+
secure: true,
|
|
5144
|
+
type: "application/json" /* Json */,
|
|
5145
|
+
format: "json",
|
|
5146
|
+
...params
|
|
5147
|
+
});
|
|
5112
5148
|
/**
|
|
5113
5149
|
* @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
|
|
5114
5150
|
*
|
|
@@ -7341,6 +7377,30 @@ var Health = class {
|
|
|
7341
7377
|
});
|
|
7342
7378
|
};
|
|
7343
7379
|
|
|
7380
|
+
// src/api-spec/generated/Scheduling.ts
|
|
7381
|
+
var Scheduling = class {
|
|
7382
|
+
http;
|
|
7383
|
+
constructor(http) {
|
|
7384
|
+
this.http = http;
|
|
7385
|
+
}
|
|
7386
|
+
/**
|
|
7387
|
+
* @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.
|
|
7388
|
+
*
|
|
7389
|
+
* @tags scheduling
|
|
7390
|
+
* @name Feasibility
|
|
7391
|
+
* @summary `POST /api/v1/scheduling/feasibility`
|
|
7392
|
+
* @request POST:/api/v1/scheduling/feasibility
|
|
7393
|
+
*/
|
|
7394
|
+
feasibility = (data, params = {}) => this.http.request({
|
|
7395
|
+
path: `/api/v1/scheduling/feasibility`,
|
|
7396
|
+
method: "POST",
|
|
7397
|
+
body: data,
|
|
7398
|
+
type: "application/json" /* Json */,
|
|
7399
|
+
format: "json",
|
|
7400
|
+
...params
|
|
7401
|
+
});
|
|
7402
|
+
};
|
|
7403
|
+
|
|
7344
7404
|
// src/api-spec/generated/Admin.ts
|
|
7345
7405
|
var Admin = class {
|
|
7346
7406
|
http;
|
|
@@ -20402,6 +20462,99 @@ function extractNumericValue(features, featureName) {
|
|
|
20402
20462
|
return null;
|
|
20403
20463
|
}
|
|
20404
20464
|
|
|
20465
|
+
// src/normalizers/scheduling.ts
|
|
20466
|
+
function AgentSpecFromFrontToApi(spec) {
|
|
20467
|
+
const dto = {
|
|
20468
|
+
id: spec.id,
|
|
20469
|
+
max_assignments: spec.maxAssignments
|
|
20470
|
+
};
|
|
20471
|
+
if (spec.roles !== void 0) {
|
|
20472
|
+
dto.roles = spec.roles;
|
|
20473
|
+
}
|
|
20474
|
+
if (spec.unavailableDays !== void 0) {
|
|
20475
|
+
dto.unavailable_days = spec.unavailableDays;
|
|
20476
|
+
}
|
|
20477
|
+
if (spec.restrictedToShift !== void 0 && spec.restrictedToShift !== null) {
|
|
20478
|
+
dto.restricted_to_shift = spec.restrictedToShift;
|
|
20479
|
+
}
|
|
20480
|
+
return dto;
|
|
20481
|
+
}
|
|
20482
|
+
function ShiftDemandFromFrontToApi(demand) {
|
|
20483
|
+
const dto = {
|
|
20484
|
+
day: demand.day,
|
|
20485
|
+
shift: demand.shift,
|
|
20486
|
+
total: demand.total
|
|
20487
|
+
};
|
|
20488
|
+
if (demand.roleMinimums !== void 0) {
|
|
20489
|
+
dto.role_minimums = demand.roleMinimums;
|
|
20490
|
+
}
|
|
20491
|
+
return dto;
|
|
20492
|
+
}
|
|
20493
|
+
function PinFromFrontToApi(pin) {
|
|
20494
|
+
return {
|
|
20495
|
+
agent_id: pin.agentId,
|
|
20496
|
+
day: pin.day,
|
|
20497
|
+
shift: pin.shift
|
|
20498
|
+
};
|
|
20499
|
+
}
|
|
20500
|
+
function SchedulingFeasibilityRequestFromFrontToApi(request) {
|
|
20501
|
+
const dto = {
|
|
20502
|
+
agents: request.agents.map(AgentSpecFromFrontToApi),
|
|
20503
|
+
days: request.days,
|
|
20504
|
+
shifts_per_day: request.shiftsPerDay,
|
|
20505
|
+
demands: request.demands.map(ShiftDemandFromFrontToApi)
|
|
20506
|
+
};
|
|
20507
|
+
if (request.pins !== void 0) {
|
|
20508
|
+
dto.pins = request.pins.map(PinFromFrontToApi);
|
|
20509
|
+
}
|
|
20510
|
+
return dto;
|
|
20511
|
+
}
|
|
20512
|
+
function AssignmentFromApiToFront(dto) {
|
|
20513
|
+
return {
|
|
20514
|
+
agentId: dto.agent_id,
|
|
20515
|
+
day: dto.day,
|
|
20516
|
+
shift: dto.shift,
|
|
20517
|
+
status: dto.status
|
|
20518
|
+
};
|
|
20519
|
+
}
|
|
20520
|
+
function SchedulingFeasibilityResponseFromApiToFront(dto) {
|
|
20521
|
+
return {
|
|
20522
|
+
status: dto.status,
|
|
20523
|
+
assignments: dto.assignments.map(AssignmentFromApiToFront)
|
|
20524
|
+
};
|
|
20525
|
+
}
|
|
20526
|
+
|
|
20527
|
+
// src/resources/scheduling.ts
|
|
20528
|
+
var SchedulingClient = class {
|
|
20529
|
+
/** @internal */
|
|
20530
|
+
api;
|
|
20531
|
+
/** @internal */
|
|
20532
|
+
constructor(api) {
|
|
20533
|
+
this.api = api;
|
|
20534
|
+
}
|
|
20535
|
+
/**
|
|
20536
|
+
* Classify every `(agent, day, shift)` cell in the input grid as
|
|
20537
|
+
* `confirmed_true`, `confirmed_false`, or `free`.
|
|
20538
|
+
*
|
|
20539
|
+
* @param request - the scheduling problem to analyse.
|
|
20540
|
+
* @returns a {@link SchedulingFeasibilityResponse} with per-cell classifications.
|
|
20541
|
+
* @throws If the backend rejects the input (HTTP 400): duplicate agent
|
|
20542
|
+
* IDs, pins referencing unknown agents, role minima exceeding total
|
|
20543
|
+
* demand, out-of-range day/shift indices, etc.
|
|
20544
|
+
*
|
|
20545
|
+
* @remarks
|
|
20546
|
+
* Infeasibility of a well-formed problem is a **valid answer** (HTTP 200
|
|
20547
|
+
* with `status === "infeasible"`), not an error. Only malformed input
|
|
20548
|
+
* raises.
|
|
20549
|
+
*/
|
|
20550
|
+
async feasibility(request) {
|
|
20551
|
+
const response = await this.api.feasibility(
|
|
20552
|
+
SchedulingFeasibilityRequestFromFrontToApi(request)
|
|
20553
|
+
);
|
|
20554
|
+
return SchedulingFeasibilityResponseFromApiToFront(response.data);
|
|
20555
|
+
}
|
|
20556
|
+
};
|
|
20557
|
+
|
|
20405
20558
|
// src/normalizers/osfql.ts
|
|
20406
20559
|
function OsfqlResponseFromApiToFront(dto) {
|
|
20407
20560
|
return {
|
|
@@ -21552,6 +21705,8 @@ var ReasoningLayerClient = class {
|
|
|
21552
21705
|
rag;
|
|
21553
21706
|
/** Linear program optimization (CLP(Q) simplex solver via backward chaining). */
|
|
21554
21707
|
optimize;
|
|
21708
|
+
/** Scheduling feasibility via capacitated bipartite b-matching (staff rostering, assignment problems). */
|
|
21709
|
+
scheduling;
|
|
21555
21710
|
/** OSFQL execution operations. */
|
|
21556
21711
|
osfql;
|
|
21557
21712
|
/** Conversational AI operations (NL → OSFQL with self-correction). */
|
|
@@ -21627,10 +21782,11 @@ var ReasoningLayerClient = class {
|
|
|
21627
21782
|
rlTraining: this.rlTraining
|
|
21628
21783
|
};
|
|
21629
21784
|
}
|
|
21630
|
-
/** Advanced reasoning operations — optimization, ILP, CDL, execution, preferences, discovery. */
|
|
21785
|
+
/** Advanced reasoning operations — optimization, ILP, CDL, execution, preferences, discovery, scheduling. */
|
|
21631
21786
|
get reasoningOps() {
|
|
21632
21787
|
return this._reasoning ??= {
|
|
21633
21788
|
optimize: this.optimize,
|
|
21789
|
+
scheduling: this.scheduling,
|
|
21634
21790
|
ilp: this.ilp,
|
|
21635
21791
|
cdl: this.cdl,
|
|
21636
21792
|
execution: this.execution,
|
|
@@ -21785,6 +21941,7 @@ var ReasoningLayerClient = class {
|
|
|
21785
21941
|
this.generation = new GenerationClient(generatedGeneration);
|
|
21786
21942
|
this.rag = new RagClient(generatedRag);
|
|
21787
21943
|
this.optimize = new OptimizeClient(generatedInference, generatedSorts, generatedQuery, generatedTerms, resolved.tenantId);
|
|
21944
|
+
this.scheduling = new SchedulingClient(new Scheduling(generatedHttp));
|
|
21788
21945
|
this.osfql = new OsfqlClient(generatedOsfql);
|
|
21789
21946
|
this.conversation = new ConversationClient(generatedHttp);
|
|
21790
21947
|
this.research = new ResearchClient(generatedHttp);
|
|
@@ -21929,6 +22086,9 @@ var rag_exports = {};
|
|
|
21929
22086
|
// src/types/optimize.ts
|
|
21930
22087
|
var optimize_exports = {};
|
|
21931
22088
|
|
|
22089
|
+
// src/types/scheduling.ts
|
|
22090
|
+
var scheduling_exports = {};
|
|
22091
|
+
|
|
21932
22092
|
// src/types/ilp.ts
|
|
21933
22093
|
var ilp_exports = {};
|
|
21934
22094
|
|
|
@@ -22618,6 +22778,6 @@ function discriminateFeatureValue(value) {
|
|
|
22618
22778
|
);
|
|
22619
22779
|
}
|
|
22620
22780
|
|
|
22621
|
-
export { action_reviews_exports as ActionReviews, admin_exports as Admin, analysis_exports as Analysis, ApiError, AuthenticationError, BadRequestError, cdl_exports as CDL, causal_exports as Causal, cognitive_exports as Cognitive, collections_exports as Collections, communities_exports as Communities, ConstraintViolationError, constraints_exports as Constraints, control_exports as Control, conversation_exports as Conversation, discovery_exports as Discovery, execution_exports as Execution, extract_exports as Extract, ForbiddenError, functions_exports as Functions, fuzzy_exports as Fuzzy, FuzzyShape, generation_exports as Generation, health_exports as Health, homoiconic_exports as Homoiconic, ilp_exports as ILP, image_extraction_exports as ImageExtraction, inference_exports as Inference, ingestion_exports as Ingestion, IngestionFailedError, IngestionSession, InternalServerError, LP, namespaces_exports as Namespaces, NetworkError, neuro_symbolic_exports as NeuroSymbolic, NotFoundError, ontology_exports as Ontology, optimize_exports as Optimize, osfql_exports as Osfql, oversight_exports as Oversight, plain_values_exports as PlainValues, preferences_exports as Preferences, proof_engine_exports as ProofEngine, query_exports as Query, rag_exports as RAG, RateLimitError, reasoning_exports as Reasoning, ReasoningLayerClient, ReasoningLayerError, research_exports as Research, reviews_exports as Reviews, row_exports as Row, SDK_VERSION, scenarios_exports as Scenarios, SortBuilder, sorts_exports as Sorts, sources_exports as Sources, spaces_exports as Spaces, statistical_exports as Statistical, synthetic_exports as Synthetic, terms_exports as Terms, TimeoutError, utilities_exports as Utilities, ValidationError, Value, values_exports as Values, visualization_exports as Visualization, WebSocketClient, WebSocketConnection, webhook_actions_exports as WebhookActions, allen, constrained, discriminateFeatureValue, guard, isConstrainedPlainVar, isPsiTermInput, isTaggedValueDto, isUuid, psi, toTaggedFeatures, toTaggedValue, toTermInputDto, toUntaggedFeatures, toUntaggedValue };
|
|
22781
|
+
export { action_reviews_exports as ActionReviews, admin_exports as Admin, analysis_exports as Analysis, ApiError, AuthenticationError, BadRequestError, cdl_exports as CDL, causal_exports as Causal, cognitive_exports as Cognitive, collections_exports as Collections, communities_exports as Communities, ConstraintViolationError, constraints_exports as Constraints, control_exports as Control, conversation_exports as Conversation, discovery_exports as Discovery, execution_exports as Execution, extract_exports as Extract, ForbiddenError, functions_exports as Functions, fuzzy_exports as Fuzzy, FuzzyShape, generation_exports as Generation, health_exports as Health, homoiconic_exports as Homoiconic, ilp_exports as ILP, image_extraction_exports as ImageExtraction, inference_exports as Inference, ingestion_exports as Ingestion, IngestionFailedError, IngestionSession, InternalServerError, LP, namespaces_exports as Namespaces, NetworkError, neuro_symbolic_exports as NeuroSymbolic, NotFoundError, ontology_exports as Ontology, optimize_exports as Optimize, osfql_exports as Osfql, oversight_exports as Oversight, plain_values_exports as PlainValues, preferences_exports as Preferences, proof_engine_exports as ProofEngine, query_exports as Query, rag_exports as RAG, RateLimitError, reasoning_exports as Reasoning, ReasoningLayerClient, ReasoningLayerError, research_exports as Research, reviews_exports as Reviews, row_exports as Row, SDK_VERSION, scenarios_exports as Scenarios, scheduling_exports as Scheduling, SortBuilder, sorts_exports as Sorts, sources_exports as Sources, spaces_exports as Spaces, statistical_exports as Statistical, synthetic_exports as Synthetic, terms_exports as Terms, TimeoutError, utilities_exports as Utilities, ValidationError, Value, values_exports as Values, visualization_exports as Visualization, WebSocketClient, WebSocketConnection, webhook_actions_exports as WebhookActions, allen, constrained, discriminateFeatureValue, guard, isConstrainedPlainVar, isPsiTermInput, isTaggedValueDto, isUuid, psi, toTaggedFeatures, toTaggedValue, toTermInputDto, toUntaggedFeatures, toUntaggedValue };
|
|
22622
22782
|
//# sourceMappingURL=index.js.map
|
|
22623
22783
|
//# sourceMappingURL=index.js.map
|