@kortexya/reasoninglayer 0.20.0 → 0.22.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 +480 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +779 -4
- package/dist/index.d.ts +779 -4
- package/dist/index.js +480 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -109,7 +109,7 @@ type JsonValue$1 = string | number | boolean | null | JsonValue$1[] | object;
|
|
|
109
109
|
* This is the single source of truth for the version constant.
|
|
110
110
|
* The `scripts/release.sh` script updates this value alongside `package.json`.
|
|
111
111
|
*/
|
|
112
|
-
declare const SDK_VERSION = "0.
|
|
112
|
+
declare const SDK_VERSION = "0.22.0";
|
|
113
113
|
/**
|
|
114
114
|
* Configuration for the Reasoning Layer client.
|
|
115
115
|
*
|
|
@@ -571,6 +571,55 @@ interface AddPendingReviewResponse {
|
|
|
571
571
|
/** @format uuid */
|
|
572
572
|
review_id: string;
|
|
573
573
|
}
|
|
574
|
+
/**
|
|
575
|
+
* Request body for `POST /api/v1/scheduling/problems/{id}/pins`.
|
|
576
|
+
*
|
|
577
|
+
* Same shape as the `PinInput` used inside a problem-creation
|
|
578
|
+
* request, but carried alone — the URL identifies the target
|
|
579
|
+
* problem.
|
|
580
|
+
*/
|
|
581
|
+
interface AddPinRequest$1 {
|
|
582
|
+
agent_id: string;
|
|
583
|
+
/** @min 0 */
|
|
584
|
+
day: number;
|
|
585
|
+
role?: string | null;
|
|
586
|
+
/** @min 0 */
|
|
587
|
+
shift: number;
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Response from `POST /api/v1/scheduling/problems/{id}/pins`.
|
|
591
|
+
*
|
|
592
|
+
* `pin_id` is the [`TermId`] of the newly-created pin Ψ-term —
|
|
593
|
+
* the stable handle for subsequent removal via
|
|
594
|
+
* `DELETE /api/v1/scheduling/problems/{id}/pins/{pin_id}`.
|
|
595
|
+
*/
|
|
596
|
+
interface AddPinResponse$1 {
|
|
597
|
+
pin_id: string;
|
|
598
|
+
/**
|
|
599
|
+
* Problem version after the mutation.
|
|
600
|
+
* @format int64
|
|
601
|
+
*/
|
|
602
|
+
version: number;
|
|
603
|
+
}
|
|
604
|
+
/** Request body for `POST /api/v1/scheduling/problems/{id}/preferences`. */
|
|
605
|
+
interface AddPreferenceRequest$1 {
|
|
606
|
+
agent_id: string;
|
|
607
|
+
/** @min 0 */
|
|
608
|
+
day: number;
|
|
609
|
+
/** @format int64 */
|
|
610
|
+
score: number;
|
|
611
|
+
/** @min 0 */
|
|
612
|
+
shift: number;
|
|
613
|
+
}
|
|
614
|
+
/** Response from `POST /api/v1/scheduling/problems/{id}/preferences`. */
|
|
615
|
+
interface AddPreferenceResponse$1 {
|
|
616
|
+
preference_id: string;
|
|
617
|
+
/**
|
|
618
|
+
* Problem version after the mutation.
|
|
619
|
+
* @format int64
|
|
620
|
+
*/
|
|
621
|
+
version: number;
|
|
622
|
+
}
|
|
574
623
|
/** Request to add a rule (a term with antecedents). */
|
|
575
624
|
interface AddRuleRequest$1 {
|
|
576
625
|
/**
|
|
@@ -3417,6 +3466,34 @@ type CreateScenarioResponse$1 = {
|
|
|
3417
3466
|
/** @min 0 */
|
|
3418
3467
|
total_time_ms: number;
|
|
3419
3468
|
};
|
|
3469
|
+
/**
|
|
3470
|
+
* Request body for `POST /api/v1/scheduling/problems`.
|
|
3471
|
+
*
|
|
3472
|
+
* Same inline shape as [`SchedulingOptimizeRequest`]. The endpoint
|
|
3473
|
+
* freezes the inputs into a `scheduling.problem` Ψ-term snapshot
|
|
3474
|
+
* stored in the application-layer scheduling store and returns the
|
|
3475
|
+
* snapshot's `problem_id`. Re-solving reads only the snapshot,
|
|
3476
|
+
* matching the user's "snapshot mode" decision.
|
|
3477
|
+
*/
|
|
3478
|
+
interface CreateSchedulingProblemRequest$1 {
|
|
3479
|
+
agents: AgentInput[];
|
|
3480
|
+
/** @min 0 */
|
|
3481
|
+
days: number;
|
|
3482
|
+
demands: ShiftDemandInput[];
|
|
3483
|
+
pins?: PinInput[];
|
|
3484
|
+
preferences?: PreferenceInput[];
|
|
3485
|
+
/** @min 0 */
|
|
3486
|
+
shifts_per_day: number;
|
|
3487
|
+
}
|
|
3488
|
+
/** Response to `POST /api/v1/scheduling/problems`. */
|
|
3489
|
+
interface CreateSchedulingProblemResponse$1 {
|
|
3490
|
+
/**
|
|
3491
|
+
* UUID-formatted ID of the stored `scheduling.problem` snapshot
|
|
3492
|
+
* term. Use this in subsequent `/scheduling/problems/{id}/...`
|
|
3493
|
+
* calls.
|
|
3494
|
+
*/
|
|
3495
|
+
problem_id: string;
|
|
3496
|
+
}
|
|
3420
3497
|
/** Request to create a live oversight session. */
|
|
3421
3498
|
interface CreateSessionRequest {
|
|
3422
3499
|
/** Optional pipeline configuration overrides */
|
|
@@ -11487,6 +11564,17 @@ interface PendingReviewEntityDto {
|
|
|
11487
11564
|
/** Original text span that was extracted */
|
|
11488
11565
|
source_text?: string | null;
|
|
11489
11566
|
}
|
|
11567
|
+
/** Pin entry in [`SchedulingProblemDto`]. */
|
|
11568
|
+
interface PinEntryDto {
|
|
11569
|
+
agent_id: string;
|
|
11570
|
+
/** @min 0 */
|
|
11571
|
+
day: number;
|
|
11572
|
+
/** Stable ID for `DELETE /api/v1/scheduling/problems/{id}/pins/{pin_id}`. */
|
|
11573
|
+
pin_id: string;
|
|
11574
|
+
role?: string | null;
|
|
11575
|
+
/** @min 0 */
|
|
11576
|
+
shift: number;
|
|
11577
|
+
}
|
|
11490
11578
|
/**
|
|
11491
11579
|
* A pre-assigned `(agent, day, shift)` triple, optionally naming
|
|
11492
11580
|
* which role the pin covers.
|
|
@@ -11812,6 +11900,48 @@ interface PreferenceDto$1 {
|
|
|
11812
11900
|
/** Preference value. */
|
|
11813
11901
|
value: string;
|
|
11814
11902
|
}
|
|
11903
|
+
/** Preference entry in [`SchedulingProblemDto`]. */
|
|
11904
|
+
interface PreferenceEntryDto {
|
|
11905
|
+
agent_id: string;
|
|
11906
|
+
/** @min 0 */
|
|
11907
|
+
day: number;
|
|
11908
|
+
/** Stable ID for `DELETE /api/v1/scheduling/problems/{id}/preferences/{preference_id}`. */
|
|
11909
|
+
preference_id: string;
|
|
11910
|
+
/** @format int64 */
|
|
11911
|
+
score: number;
|
|
11912
|
+
/** @min 0 */
|
|
11913
|
+
shift: number;
|
|
11914
|
+
}
|
|
11915
|
+
/**
|
|
11916
|
+
* A soft preference: bias the optimizer toward (or against) assigning
|
|
11917
|
+
* `agent_id` to cell `(day, shift)`.
|
|
11918
|
+
*
|
|
11919
|
+
* `score` contributes to the objective when the cell is assigned in
|
|
11920
|
+
* the chosen schedule. Positive values pull the optimizer toward
|
|
11921
|
+
* the cell; negative values push it away.
|
|
11922
|
+
*
|
|
11923
|
+
* Preferences targeting a structurally infeasible cell (the agent
|
|
11924
|
+
* has a day-off on `day`, is restricted to a different shift, or
|
|
11925
|
+
* otherwise cannot occupy the slot) are silently ignored — the
|
|
11926
|
+
* agent cannot fill the cell, so the preference cannot fire.
|
|
11927
|
+
*
|
|
11928
|
+
* Preferences targeting a **pinned** cell *do* contribute to
|
|
11929
|
+
* `total_score`: pins force the agent into the cell, so the
|
|
11930
|
+
* preference is realised in the chosen schedule.
|
|
11931
|
+
*/
|
|
11932
|
+
interface PreferenceInput {
|
|
11933
|
+
agent_id: string;
|
|
11934
|
+
/** @min 0 */
|
|
11935
|
+
day: number;
|
|
11936
|
+
/**
|
|
11937
|
+
* Score contributed by this assignment to the optimizer's
|
|
11938
|
+
* objective. Positive = preferred, negative = avoided.
|
|
11939
|
+
* @format int64
|
|
11940
|
+
*/
|
|
11941
|
+
score: number;
|
|
11942
|
+
/** @min 0 */
|
|
11943
|
+
shift: number;
|
|
11944
|
+
}
|
|
11815
11945
|
/** Prediction result for a single term */
|
|
11816
11946
|
interface PreferencePrediction$1 {
|
|
11817
11947
|
/** @format double */
|
|
@@ -13700,6 +13830,22 @@ interface ScenarioSummaryDto$1 {
|
|
|
13700
13830
|
*/
|
|
13701
13831
|
sorts_created: number;
|
|
13702
13832
|
}
|
|
13833
|
+
/**
|
|
13834
|
+
* Response to `GET /api/v1/scheduling/problems/{id}/assignments`.
|
|
13835
|
+
*
|
|
13836
|
+
* One entry per `(agent, day, shift)` cell that was lifted from
|
|
13837
|
+
* the optimum's per-cell envelope, including `free` cells (per
|
|
13838
|
+
* the materialise decision so downstream rules can residuate).
|
|
13839
|
+
*/
|
|
13840
|
+
interface SchedulingAssignmentsResponse$1 {
|
|
13841
|
+
assignments: AssignmentDto[];
|
|
13842
|
+
/**
|
|
13843
|
+
* `total_score` of the most recent solve, or `0` when the
|
|
13844
|
+
* problem has never been solved.
|
|
13845
|
+
* @format int64
|
|
13846
|
+
*/
|
|
13847
|
+
total_score: number;
|
|
13848
|
+
}
|
|
13703
13849
|
/**
|
|
13704
13850
|
* A scheduling feasibility request.
|
|
13705
13851
|
*
|
|
@@ -13741,6 +13887,88 @@ interface SchedulingFeasibilityResponse$1 {
|
|
|
13741
13887
|
/** Top-level request status. */
|
|
13742
13888
|
status: SchedulingStatusDto;
|
|
13743
13889
|
}
|
|
13890
|
+
/**
|
|
13891
|
+
* Request body for `POST /api/v1/scheduling/optimize`.
|
|
13892
|
+
*
|
|
13893
|
+
* Same hard-constraint shape as
|
|
13894
|
+
* [`SchedulingFeasibilityRequest`], plus a list of soft
|
|
13895
|
+
* `preferences`. The engine returns the per-cell envelope across
|
|
13896
|
+
* the space of **optimal** schedules under the supplied
|
|
13897
|
+
* preferences.
|
|
13898
|
+
*/
|
|
13899
|
+
interface SchedulingOptimizeRequest$1 {
|
|
13900
|
+
agents: AgentInput[];
|
|
13901
|
+
/** @min 0 */
|
|
13902
|
+
days: number;
|
|
13903
|
+
demands: ShiftDemandInput[];
|
|
13904
|
+
pins?: PinInput[];
|
|
13905
|
+
/**
|
|
13906
|
+
* Soft preferences applied to the objective. Empty = unweighted
|
|
13907
|
+
* (every feasible schedule is "optimal").
|
|
13908
|
+
*/
|
|
13909
|
+
preferences?: PreferenceInput[];
|
|
13910
|
+
/** @min 0 */
|
|
13911
|
+
shifts_per_day: number;
|
|
13912
|
+
}
|
|
13913
|
+
/**
|
|
13914
|
+
* Response to [`SchedulingOptimizeRequest`].
|
|
13915
|
+
*
|
|
13916
|
+
* The per-cell `assignments` trichotomy classifies each cell over
|
|
13917
|
+
* the space of **optimal** schedules — strictly stronger than the
|
|
13918
|
+
* feasibility-only trichotomy returned by
|
|
13919
|
+
* `/api/v1/scheduling/feasibility`. When the un-pinned reduced
|
|
13920
|
+
* problem is infeasible, `status = "infeasible"`, `assignments` is
|
|
13921
|
+
* empty, and `total_score` is `0`.
|
|
13922
|
+
*/
|
|
13923
|
+
interface SchedulingOptimizeResponse$1 {
|
|
13924
|
+
/**
|
|
13925
|
+
* Empty when `status` is `infeasible`; otherwise one entry per
|
|
13926
|
+
* `(agent, day, shift)` triple in the input grid, with
|
|
13927
|
+
* trichotomy taken across the space of optimal schedules.
|
|
13928
|
+
*/
|
|
13929
|
+
assignments: AssignmentDto[];
|
|
13930
|
+
/** Top-level request status. */
|
|
13931
|
+
status: SchedulingStatusDto;
|
|
13932
|
+
/**
|
|
13933
|
+
* Sum of [`PreferenceInput::score`] over assigned cells in the
|
|
13934
|
+
* optimum. `0` when no preferences were supplied or the
|
|
13935
|
+
* problem is infeasible.
|
|
13936
|
+
* @format int64
|
|
13937
|
+
*/
|
|
13938
|
+
total_score: number;
|
|
13939
|
+
}
|
|
13940
|
+
/**
|
|
13941
|
+
* Response from `GET /api/v1/scheduling/problems/{id}`.
|
|
13942
|
+
*
|
|
13943
|
+
* Snapshot of the live problem state — agents and demands as
|
|
13944
|
+
* supplied at creation time, plus the *current* set of pins and
|
|
13945
|
+
* preferences (including their stable child IDs). Use the IDs
|
|
13946
|
+
* here when building DELETE calls.
|
|
13947
|
+
*/
|
|
13948
|
+
interface SchedulingProblemDto {
|
|
13949
|
+
/** @min 0 */
|
|
13950
|
+
days: number;
|
|
13951
|
+
/** Status of the most recent solve, or `None` if never solved. */
|
|
13952
|
+
latest_solve_status?: null | SchedulingStatusDto;
|
|
13953
|
+
/** Pins currently on the problem. */
|
|
13954
|
+
pins: PinEntryDto[];
|
|
13955
|
+
/** Preferences currently on the problem. */
|
|
13956
|
+
preferences: PreferenceEntryDto[];
|
|
13957
|
+
problem_id: string;
|
|
13958
|
+
/** @min 0 */
|
|
13959
|
+
shifts_per_day: number;
|
|
13960
|
+
/**
|
|
13961
|
+
* Score of the most recent solve, or `0` if never solved.
|
|
13962
|
+
* @format int64
|
|
13963
|
+
*/
|
|
13964
|
+
total_score: number;
|
|
13965
|
+
/**
|
|
13966
|
+
* Bumped on every input mutation (add/remove pin or preference).
|
|
13967
|
+
* Solving does not bump it.
|
|
13968
|
+
* @format int64
|
|
13969
|
+
*/
|
|
13970
|
+
version: number;
|
|
13971
|
+
}
|
|
13744
13972
|
/** Top-level request status. */
|
|
13745
13973
|
type SchedulingStatusDto = "feasible" | "infeasible";
|
|
13746
13974
|
/** Request to search communities */
|
|
@@ -14171,6 +14399,26 @@ interface SolveConstraintResponse$1 {
|
|
|
14171
14399
|
success: boolean;
|
|
14172
14400
|
suspended_constraints: string[];
|
|
14173
14401
|
}
|
|
14402
|
+
/**
|
|
14403
|
+
* Response to `POST /api/v1/scheduling/problems/{id}/solve`.
|
|
14404
|
+
*
|
|
14405
|
+
* Re-solving an already-solved problem replaces the previously
|
|
14406
|
+
* derived `scheduling.assignment` Ψ-terms. Per-cell trichotomy
|
|
14407
|
+
* must be fetched separately via
|
|
14408
|
+
* `GET /scheduling/problems/{id}/assignments` (so a successful
|
|
14409
|
+
* re-solve carries minimal payload).
|
|
14410
|
+
*/
|
|
14411
|
+
interface SolveSchedulingProblemResponse$1 {
|
|
14412
|
+
/** Top-level request status. */
|
|
14413
|
+
status: SchedulingStatusDto;
|
|
14414
|
+
/**
|
|
14415
|
+
* Sum of [`PreferenceInput::score`] over assigned cells in the
|
|
14416
|
+
* optimum. `0` when no preferences were supplied or the
|
|
14417
|
+
* problem is infeasible.
|
|
14418
|
+
* @format int64
|
|
14419
|
+
*/
|
|
14420
|
+
total_score: number;
|
|
14421
|
+
}
|
|
14174
14422
|
/** Response with ancestor sorts */
|
|
14175
14423
|
interface SortAncestorsResponse {
|
|
14176
14424
|
ancestors: SortInfoDto$1[];
|
|
@@ -16927,11 +17175,10 @@ declare class Sorts<SecurityDataType = unknown> {
|
|
|
16927
17175
|
*/
|
|
16928
17176
|
getSortSimilarity: (data: GetSortSimilarityRequest$1, params?: RequestParams) => Promise<HttpResponse<GetSortSimilarityResponse$1, any>>;
|
|
16929
17177
|
/**
|
|
16930
|
-
*
|
|
17178
|
+
* No description
|
|
16931
17179
|
*
|
|
16932
17180
|
* @tags sorts
|
|
16933
17181
|
* @name IndexSorts
|
|
16934
|
-
* @summary Index all sorts for a tenant into the vector store (Qdrant).
|
|
16935
17182
|
* @request POST:/api/v1/sorts/index
|
|
16936
17183
|
* @secure
|
|
16937
17184
|
*/
|
|
@@ -16988,6 +17235,12 @@ declare class Sorts<SecurityDataType = unknown> {
|
|
|
16988
17235
|
limit?: number | null;
|
|
16989
17236
|
/** Filter to only show LLM-extracted sorts */
|
|
16990
17237
|
llm_extracted?: boolean | null;
|
|
17238
|
+
/**
|
|
17239
|
+
* Filter to sorts whose name starts with this prefix.
|
|
17240
|
+
* Supports comma-separated multiple prefixes (e.g. "drug_,target_,pathway_,disease_").
|
|
17241
|
+
* Server-side filtering avoids transferring millions of irrelevant sorts.
|
|
17242
|
+
*/
|
|
17243
|
+
name_prefix?: string | null;
|
|
16991
17244
|
/** Filter to only show sorts needing review */
|
|
16992
17245
|
needs_review?: boolean | null;
|
|
16993
17246
|
/**
|
|
@@ -39289,6 +39542,33 @@ declare class OptimizeClient {
|
|
|
39289
39542
|
declare class Scheduling<SecurityDataType = unknown> {
|
|
39290
39543
|
http: HttpClient<SecurityDataType>;
|
|
39291
39544
|
constructor(http: HttpClient<SecurityDataType>);
|
|
39545
|
+
/**
|
|
39546
|
+
* No description
|
|
39547
|
+
*
|
|
39548
|
+
* @tags scheduling
|
|
39549
|
+
* @name AddPin
|
|
39550
|
+
* @summary `POST /api/v1/scheduling/problems/{id}/pins`
|
|
39551
|
+
* @request POST:/api/v1/scheduling/problems/{problem_id}/pins
|
|
39552
|
+
*/
|
|
39553
|
+
addPin: (problemId: string, data: AddPinRequest$1, params?: RequestParams) => Promise<HttpResponse<AddPinResponse$1, void>>;
|
|
39554
|
+
/**
|
|
39555
|
+
* No description
|
|
39556
|
+
*
|
|
39557
|
+
* @tags scheduling
|
|
39558
|
+
* @name AddPreference
|
|
39559
|
+
* @summary `POST /api/v1/scheduling/problems/{id}/preferences`
|
|
39560
|
+
* @request POST:/api/v1/scheduling/problems/{problem_id}/preferences
|
|
39561
|
+
*/
|
|
39562
|
+
addPreference: (problemId: string, data: AddPreferenceRequest$1, params?: RequestParams) => Promise<HttpResponse<AddPreferenceResponse$1, void>>;
|
|
39563
|
+
/**
|
|
39564
|
+
* @description Freeze the inline scheduling inputs into a `scheduling.problem` Ψ-term snapshot stored in the application-layer scheduling store, and return its ID. The endpoint does NOT solve — call `POST /api/v1/scheduling/problems/{id}/solve` to compute the optimum, then `GET /api/v1/scheduling/problems/{id}/assignments` to retrieve the per-cell trichotomy. Snapshot mode: subsequent re-solves read only the snapshot, not any source terms in the KB. This keeps the optimum reproducible and auditable from the moment the problem is created.
|
|
39565
|
+
*
|
|
39566
|
+
* @tags scheduling
|
|
39567
|
+
* @name CreateProblem
|
|
39568
|
+
* @summary `POST /api/v1/scheduling/problems`
|
|
39569
|
+
* @request POST:/api/v1/scheduling/problems
|
|
39570
|
+
*/
|
|
39571
|
+
createProblem: (data: CreateSchedulingProblemRequest$1, params?: RequestParams) => Promise<HttpResponse<CreateSchedulingProblemResponse$1, void>>;
|
|
39292
39572
|
/**
|
|
39293
39573
|
* @description Classify every `(agent, day, shift)` cell in the input grid as confirmed-true, confirmed-false, or free, and list the role(s) each cell could cover. Input validation errors (duplicate agent IDs, out-of-range pins, role minima exceeding total demand, pin role the agent doesn't have, pin on a multi-role agent where the role is ambiguous, 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.
|
|
39294
39574
|
*
|
|
@@ -39298,6 +39578,60 @@ declare class Scheduling<SecurityDataType = unknown> {
|
|
|
39298
39578
|
* @request POST:/api/v1/scheduling/feasibility
|
|
39299
39579
|
*/
|
|
39300
39580
|
feasibility: (data: SchedulingFeasibilityRequest$1, params?: RequestParams) => Promise<HttpResponse<SchedulingFeasibilityResponse$1, void>>;
|
|
39581
|
+
/**
|
|
39582
|
+
* No description
|
|
39583
|
+
*
|
|
39584
|
+
* @tags scheduling
|
|
39585
|
+
* @name GetProblem
|
|
39586
|
+
* @summary `GET /api/v1/scheduling/problems/{id}` — read the current state.
|
|
39587
|
+
* @request GET:/api/v1/scheduling/problems/{problem_id}
|
|
39588
|
+
*/
|
|
39589
|
+
getProblem: (problemId: string, params?: RequestParams) => Promise<HttpResponse<SchedulingProblemDto, void>>;
|
|
39590
|
+
/**
|
|
39591
|
+
* @description Retrieve the derived `scheduling.assignment` Ψ-terms produced by the most recent solve. Returns an empty list when the problem has never been solved, or when the problem ID isn't known for this tenant. Includes `free` cells (per the materialise decision) so consumers can residuate on them.
|
|
39592
|
+
*
|
|
39593
|
+
* @tags scheduling
|
|
39594
|
+
* @name ListAssignments
|
|
39595
|
+
* @summary `GET /api/v1/scheduling/problems/{id}/assignments`
|
|
39596
|
+
* @request GET:/api/v1/scheduling/problems/{problem_id}/assignments
|
|
39597
|
+
*/
|
|
39598
|
+
listAssignments: (problemId: string, params?: RequestParams) => Promise<HttpResponse<SchedulingAssignmentsResponse$1, void>>;
|
|
39599
|
+
/**
|
|
39600
|
+
* @description Same hard constraints as `/scheduling/feasibility` plus a list of soft `preferences` (each a per-cell score added to the optimizer's objective). Returns the per-cell trichotomy across the space of **optimal** schedules, plus `total_score` (sum of preference scores at chosen cells in the optimum). `confirmed_true` / `confirmed_false` here are stronger than in `/feasibility`: they hold across every optimum, not every feasible schedule. Cells with status `free` indicate ties — multiple optima exist and the cell varies between them. Preferences targeting structurally infeasible cells (agent has a day-off on the day, is restricted to a different shift, or otherwise cannot occupy the slot) are silently ignored — the preference cannot fire when the agent cannot be there. Preferences targeting **pinned** cells DO contribute to `total_score`: pins force the agent into the cell, so the preference is realised by the chosen schedule.
|
|
39601
|
+
*
|
|
39602
|
+
* @tags scheduling
|
|
39603
|
+
* @name Optimize
|
|
39604
|
+
* @summary `POST /api/v1/scheduling/optimize`
|
|
39605
|
+
* @request POST:/api/v1/scheduling/optimize
|
|
39606
|
+
*/
|
|
39607
|
+
optimize: (data: SchedulingOptimizeRequest$1, params?: RequestParams) => Promise<HttpResponse<SchedulingOptimizeResponse$1, void>>;
|
|
39608
|
+
/**
|
|
39609
|
+
* No description
|
|
39610
|
+
*
|
|
39611
|
+
* @tags scheduling
|
|
39612
|
+
* @name RemovePin
|
|
39613
|
+
* @summary `DELETE /api/v1/scheduling/problems/{id}/pins/{pin_id}`
|
|
39614
|
+
* @request DELETE:/api/v1/scheduling/problems/{problem_id}/pins/{pin_id}
|
|
39615
|
+
*/
|
|
39616
|
+
removePin: (problemId: string, pinId: string, params?: RequestParams) => Promise<HttpResponse<void, void>>;
|
|
39617
|
+
/**
|
|
39618
|
+
* No description
|
|
39619
|
+
*
|
|
39620
|
+
* @tags scheduling
|
|
39621
|
+
* @name RemovePreference
|
|
39622
|
+
* @summary `DELETE /api/v1/scheduling/problems/{id}/preferences/{preference_id}`
|
|
39623
|
+
* @request DELETE:/api/v1/scheduling/problems/{problem_id}/preferences/{preference_id}
|
|
39624
|
+
*/
|
|
39625
|
+
removePreference: (problemId: string, preferenceId: string, params?: RequestParams) => Promise<HttpResponse<void, void>>;
|
|
39626
|
+
/**
|
|
39627
|
+
* @description Re-solve the stored snapshot: project it back into a domain `SchedulingProblem`, run the optimizer, and lift the per-cell trichotomy into `scheduling.assignment` Ψ-terms (idempotent — previous derived assignments for this problem are replaced). Returns only `status` and `total_score`; fetch the per-cell trichotomy via `/assignments`.
|
|
39628
|
+
*
|
|
39629
|
+
* @tags scheduling
|
|
39630
|
+
* @name SolveProblem
|
|
39631
|
+
* @summary `POST /api/v1/scheduling/problems/{id}/solve`
|
|
39632
|
+
* @request POST:/api/v1/scheduling/problems/{problem_id}/solve
|
|
39633
|
+
*/
|
|
39634
|
+
solveProblem: (problemId: string, params?: RequestParams) => Promise<HttpResponse<SolveSchedulingProblemResponse$1, void>>;
|
|
39301
39635
|
}
|
|
39302
39636
|
|
|
39303
39637
|
/**
|
|
@@ -39456,18 +39790,279 @@ interface SchedulingFeasibilityResponse {
|
|
|
39456
39790
|
status: SchedulingStatus;
|
|
39457
39791
|
assignments: Assignment[];
|
|
39458
39792
|
}
|
|
39793
|
+
/**
|
|
39794
|
+
* A soft preference: bias the optimizer toward (or against) assigning
|
|
39795
|
+
* `agentId` to cell `(day, shift)`.
|
|
39796
|
+
*
|
|
39797
|
+
* @remarks
|
|
39798
|
+
* `score` contributes to the optimizer's objective when the cell is
|
|
39799
|
+
* assigned in the chosen schedule. Positive values pull the optimizer
|
|
39800
|
+
* toward the cell; negative values push it away.
|
|
39801
|
+
*
|
|
39802
|
+
* Preferences targeting a cell that is already pinned, blocked by a
|
|
39803
|
+
* day-off, restricted-to-shift, or otherwise structurally fixed are
|
|
39804
|
+
* silently ignored — those cells are not the optimizer's choice to
|
|
39805
|
+
* make.
|
|
39806
|
+
*
|
|
39807
|
+
* Common encodings:
|
|
39808
|
+
* - "Aisha prefers morning shifts" → `score = +5` on every
|
|
39809
|
+
* `(aisha, day, morning)` pair
|
|
39810
|
+
* - "Avoid weekend assignments" → `score = -3` on every
|
|
39811
|
+
* `(*, sat|sun, *)` pair
|
|
39812
|
+
* - "Honor day-off requests" → `score = -100` on
|
|
39813
|
+
* `(agent, requested_off_day, *)` (large negative penalty —
|
|
39814
|
+
* respects the request when feasible, lets the engine decide
|
|
39815
|
+
* when not)
|
|
39816
|
+
*/
|
|
39817
|
+
interface Preference {
|
|
39818
|
+
agentId: string;
|
|
39819
|
+
day: number;
|
|
39820
|
+
shift: number;
|
|
39821
|
+
/**
|
|
39822
|
+
* Score added to the objective when this cell is assigned in the
|
|
39823
|
+
* chosen schedule. Positive = preferred, negative = avoided.
|
|
39824
|
+
*/
|
|
39825
|
+
score: number;
|
|
39826
|
+
}
|
|
39827
|
+
/**
|
|
39828
|
+
* Input to {@link SchedulingClient.optimize}.
|
|
39829
|
+
*
|
|
39830
|
+
* @remarks
|
|
39831
|
+
* Same hard-constraint shape as {@link SchedulingFeasibilityRequest}
|
|
39832
|
+
* plus a list of soft `preferences`. The engine returns the per-cell
|
|
39833
|
+
* envelope across the space of **optimal** schedules under the
|
|
39834
|
+
* supplied preferences.
|
|
39835
|
+
*/
|
|
39836
|
+
interface SchedulingOptimizeRequest {
|
|
39837
|
+
agents: AgentSpec[];
|
|
39838
|
+
days: number;
|
|
39839
|
+
shiftsPerDay: number;
|
|
39840
|
+
demands: ShiftDemand[];
|
|
39841
|
+
/** Pre-assigned `(agent, day, shift)` triples. Defaults to empty. */
|
|
39842
|
+
pins?: Pin[];
|
|
39843
|
+
/**
|
|
39844
|
+
* Soft preferences applied to the objective. Empty (or omitted) =
|
|
39845
|
+
* unweighted: every feasible schedule is "optimal" and the result
|
|
39846
|
+
* coincides with {@link SchedulingClient.feasibility}.
|
|
39847
|
+
*/
|
|
39848
|
+
preferences?: Preference[];
|
|
39849
|
+
}
|
|
39850
|
+
/**
|
|
39851
|
+
* Response from {@link SchedulingClient.optimize}.
|
|
39852
|
+
*
|
|
39853
|
+
* @remarks
|
|
39854
|
+
* The per-cell `assignments` trichotomy classifies each cell over the
|
|
39855
|
+
* space of **optimal** schedules — strictly stronger than the
|
|
39856
|
+
* feasibility-only trichotomy from
|
|
39857
|
+
* {@link SchedulingClient.feasibility}:
|
|
39858
|
+
*
|
|
39859
|
+
* - `"confirmed_true"` — assigned in *every* optimal schedule.
|
|
39860
|
+
* - `"confirmed_false"` — assigned in *no* optimal schedule.
|
|
39861
|
+
* - `"free"` — varies across the (possibly multiple) optimal
|
|
39862
|
+
* schedules; the optimizer is indifferent.
|
|
39863
|
+
*
|
|
39864
|
+
* `totalScore` is the sum of {@link Preference.score} over assigned
|
|
39865
|
+
* cells in the optimum. It is `0` when no preferences were supplied
|
|
39866
|
+
* or the problem is infeasible.
|
|
39867
|
+
*/
|
|
39868
|
+
interface SchedulingOptimizeResponse {
|
|
39869
|
+
status: SchedulingStatus;
|
|
39870
|
+
/** Sum of preference scores at chosen cells in the optimum. */
|
|
39871
|
+
totalScore: number;
|
|
39872
|
+
/**
|
|
39873
|
+
* Empty when `status === "infeasible"`; otherwise one entry per
|
|
39874
|
+
* `(agent, day, shift)` triple in the input grid.
|
|
39875
|
+
*/
|
|
39876
|
+
assignments: Assignment[];
|
|
39877
|
+
}
|
|
39878
|
+
/**
|
|
39879
|
+
* Input to {@link SchedulingClient.createProblem}.
|
|
39880
|
+
*
|
|
39881
|
+
* @remarks
|
|
39882
|
+
* Same inline shape as {@link SchedulingOptimizeRequest}. The
|
|
39883
|
+
* server freezes the inputs into a `scheduling.problem` Ψ-term
|
|
39884
|
+
* snapshot, stores it under the caller's tenant, and returns the
|
|
39885
|
+
* snapshot's `problemId`. Subsequent re-solves
|
|
39886
|
+
* ({@link SchedulingClient.solveProblem}) read only the snapshot —
|
|
39887
|
+
* mutations to the source data after creation do not affect the
|
|
39888
|
+
* stored problem, keeping every solve reproducible and auditable.
|
|
39889
|
+
*/
|
|
39890
|
+
interface CreateSchedulingProblemRequest {
|
|
39891
|
+
agents: AgentSpec[];
|
|
39892
|
+
days: number;
|
|
39893
|
+
shiftsPerDay: number;
|
|
39894
|
+
demands: ShiftDemand[];
|
|
39895
|
+
/** Pre-assigned `(agent, day, shift)` triples. Defaults to empty. */
|
|
39896
|
+
pins?: Pin[];
|
|
39897
|
+
/** Soft preferences applied to the optimum's objective. Defaults to empty. */
|
|
39898
|
+
preferences?: Preference[];
|
|
39899
|
+
}
|
|
39900
|
+
/**
|
|
39901
|
+
* Response from {@link SchedulingClient.createProblem}.
|
|
39902
|
+
*/
|
|
39903
|
+
interface CreateSchedulingProblemResponse {
|
|
39904
|
+
/**
|
|
39905
|
+
* UUID of the stored `scheduling.problem` snapshot term. Use it
|
|
39906
|
+
* in subsequent `solveProblem` / `listAssignments` calls.
|
|
39907
|
+
*/
|
|
39908
|
+
problemId: string;
|
|
39909
|
+
}
|
|
39910
|
+
/**
|
|
39911
|
+
* Response from {@link SchedulingClient.solveProblem}.
|
|
39912
|
+
*
|
|
39913
|
+
* @remarks
|
|
39914
|
+
* Re-solving an already-solved problem replaces the previously
|
|
39915
|
+
* lifted `scheduling.assignment` Ψ-terms (idempotent). Per-cell
|
|
39916
|
+
* trichotomy must be fetched separately via
|
|
39917
|
+
* {@link SchedulingClient.listAssignments} so a successful
|
|
39918
|
+
* re-solve carries minimal payload.
|
|
39919
|
+
*/
|
|
39920
|
+
interface SolveSchedulingProblemResponse {
|
|
39921
|
+
status: SchedulingStatus;
|
|
39922
|
+
/**
|
|
39923
|
+
* Sum of {@link Preference.score} over chosen cells in the
|
|
39924
|
+
* optimum. `0` when no preferences were supplied or the problem
|
|
39925
|
+
* is infeasible.
|
|
39926
|
+
*/
|
|
39927
|
+
totalScore: number;
|
|
39928
|
+
}
|
|
39929
|
+
/**
|
|
39930
|
+
* Response from {@link SchedulingClient.listAssignments}.
|
|
39931
|
+
*
|
|
39932
|
+
* @remarks
|
|
39933
|
+
* One entry per `(agent, day, shift)` cell that was lifted from
|
|
39934
|
+
* the optimum — including `free` cells, so consumers can residuate
|
|
39935
|
+
* on cells the optimizer is indifferent about. Empty when the
|
|
39936
|
+
* problem has never been solved.
|
|
39937
|
+
*
|
|
39938
|
+
* `totalScore` mirrors the most recent solve's optimum value, or
|
|
39939
|
+
* `0` when the problem hasn't been solved yet.
|
|
39940
|
+
*/
|
|
39941
|
+
interface SchedulingAssignmentsResponse {
|
|
39942
|
+
totalScore: number;
|
|
39943
|
+
assignments: Assignment[];
|
|
39944
|
+
}
|
|
39945
|
+
/**
|
|
39946
|
+
* Input to {@link SchedulingClient.addPin}.
|
|
39947
|
+
*
|
|
39948
|
+
* @remarks
|
|
39949
|
+
* Same field set as {@link Pin}; the URL identifies the target
|
|
39950
|
+
* problem. Returns a `pinId` that callers retain for subsequent
|
|
39951
|
+
* removal.
|
|
39952
|
+
*/
|
|
39953
|
+
interface AddPinRequest {
|
|
39954
|
+
agentId: string;
|
|
39955
|
+
day: number;
|
|
39956
|
+
shift: number;
|
|
39957
|
+
role?: string;
|
|
39958
|
+
}
|
|
39959
|
+
interface AddPinResponse {
|
|
39960
|
+
/**
|
|
39961
|
+
* Stable handle for `removePin(problemId, pinId)`. UUID-formatted.
|
|
39962
|
+
*/
|
|
39963
|
+
pinId: string;
|
|
39964
|
+
/** Problem version after this mutation. */
|
|
39965
|
+
version: number;
|
|
39966
|
+
}
|
|
39967
|
+
/**
|
|
39968
|
+
* Input to {@link SchedulingClient.addPreference}.
|
|
39969
|
+
*/
|
|
39970
|
+
interface AddPreferenceRequest {
|
|
39971
|
+
agentId: string;
|
|
39972
|
+
day: number;
|
|
39973
|
+
shift: number;
|
|
39974
|
+
score: number;
|
|
39975
|
+
}
|
|
39976
|
+
interface AddPreferenceResponse {
|
|
39977
|
+
/**
|
|
39978
|
+
* Stable handle for
|
|
39979
|
+
* `removePreference(problemId, preferenceId)`. UUID-formatted.
|
|
39980
|
+
*/
|
|
39981
|
+
preferenceId: string;
|
|
39982
|
+
/** Problem version after this mutation. */
|
|
39983
|
+
version: number;
|
|
39984
|
+
}
|
|
39985
|
+
/**
|
|
39986
|
+
* One pin currently on the problem, as returned by
|
|
39987
|
+
* {@link SchedulingClient.getProblem}. Carries the stable
|
|
39988
|
+
* `pinId` to use when calling
|
|
39989
|
+
* {@link SchedulingClient.removePin}.
|
|
39990
|
+
*/
|
|
39991
|
+
interface PinEntry {
|
|
39992
|
+
pinId: string;
|
|
39993
|
+
agentId: string;
|
|
39994
|
+
day: number;
|
|
39995
|
+
shift: number;
|
|
39996
|
+
role?: string;
|
|
39997
|
+
}
|
|
39998
|
+
/**
|
|
39999
|
+
* One preference currently on the problem, as returned by
|
|
40000
|
+
* {@link SchedulingClient.getProblem}. Carries the stable
|
|
40001
|
+
* `preferenceId` to use when calling
|
|
40002
|
+
* {@link SchedulingClient.removePreference}.
|
|
40003
|
+
*/
|
|
40004
|
+
interface PreferenceEntry {
|
|
40005
|
+
preferenceId: string;
|
|
40006
|
+
agentId: string;
|
|
40007
|
+
day: number;
|
|
40008
|
+
shift: number;
|
|
40009
|
+
score: number;
|
|
40010
|
+
}
|
|
40011
|
+
/**
|
|
40012
|
+
* Current state of a stored problem returned by
|
|
40013
|
+
* {@link SchedulingClient.getProblem}.
|
|
40014
|
+
*
|
|
40015
|
+
* @remarks
|
|
40016
|
+
* `pins` and `preferences` carry the stable IDs needed for
|
|
40017
|
+
* subsequent removal. `version` is bumped on every input edit
|
|
40018
|
+
* (add/remove pin or preference); solving does NOT bump it —
|
|
40019
|
+
* solves are derivations, not edits. `latestSolveStatus` is
|
|
40020
|
+
* `undefined` until the first successful solve.
|
|
40021
|
+
*/
|
|
40022
|
+
interface SchedulingProblem {
|
|
40023
|
+
problemId: string;
|
|
40024
|
+
days: number;
|
|
40025
|
+
shiftsPerDay: number;
|
|
40026
|
+
version: number;
|
|
40027
|
+
pins: PinEntry[];
|
|
40028
|
+
preferences: PreferenceEntry[];
|
|
40029
|
+
/**
|
|
40030
|
+
* Score of the most recent solve, or `0` if the problem has
|
|
40031
|
+
* never been solved.
|
|
40032
|
+
*/
|
|
40033
|
+
totalScore: number;
|
|
40034
|
+
/**
|
|
40035
|
+
* Status of the most recent solve, or `undefined` if the
|
|
40036
|
+
* problem has never been solved.
|
|
40037
|
+
*/
|
|
40038
|
+
latestSolveStatus?: SchedulingStatus;
|
|
40039
|
+
}
|
|
39459
40040
|
|
|
39460
40041
|
declare const scheduling_ANY_ROLE: typeof ANY_ROLE;
|
|
40042
|
+
type scheduling_AddPinRequest = AddPinRequest;
|
|
40043
|
+
type scheduling_AddPinResponse = AddPinResponse;
|
|
40044
|
+
type scheduling_AddPreferenceRequest = AddPreferenceRequest;
|
|
40045
|
+
type scheduling_AddPreferenceResponse = AddPreferenceResponse;
|
|
39461
40046
|
type scheduling_AgentSpec = AgentSpec;
|
|
39462
40047
|
type scheduling_Assignment = Assignment;
|
|
39463
40048
|
type scheduling_AssignmentStatus = AssignmentStatus;
|
|
40049
|
+
type scheduling_CreateSchedulingProblemRequest = CreateSchedulingProblemRequest;
|
|
40050
|
+
type scheduling_CreateSchedulingProblemResponse = CreateSchedulingProblemResponse;
|
|
39464
40051
|
type scheduling_Pin = Pin;
|
|
40052
|
+
type scheduling_PinEntry = PinEntry;
|
|
40053
|
+
type scheduling_Preference = Preference;
|
|
40054
|
+
type scheduling_PreferenceEntry = PreferenceEntry;
|
|
40055
|
+
type scheduling_SchedulingAssignmentsResponse = SchedulingAssignmentsResponse;
|
|
39465
40056
|
type scheduling_SchedulingFeasibilityRequest = SchedulingFeasibilityRequest;
|
|
39466
40057
|
type scheduling_SchedulingFeasibilityResponse = SchedulingFeasibilityResponse;
|
|
40058
|
+
type scheduling_SchedulingOptimizeRequest = SchedulingOptimizeRequest;
|
|
40059
|
+
type scheduling_SchedulingOptimizeResponse = SchedulingOptimizeResponse;
|
|
40060
|
+
type scheduling_SchedulingProblem = SchedulingProblem;
|
|
39467
40061
|
type scheduling_SchedulingStatus = SchedulingStatus;
|
|
39468
40062
|
type scheduling_ShiftDemand = ShiftDemand;
|
|
40063
|
+
type scheduling_SolveSchedulingProblemResponse = SolveSchedulingProblemResponse;
|
|
39469
40064
|
declare namespace scheduling {
|
|
39470
|
-
export { scheduling_ANY_ROLE as ANY_ROLE, type scheduling_AgentSpec as AgentSpec, type scheduling_Assignment as Assignment, type scheduling_AssignmentStatus as AssignmentStatus, type scheduling_Pin as Pin, type scheduling_SchedulingFeasibilityRequest as SchedulingFeasibilityRequest, type scheduling_SchedulingFeasibilityResponse as SchedulingFeasibilityResponse, type scheduling_SchedulingStatus as SchedulingStatus, type scheduling_ShiftDemand as ShiftDemand };
|
|
40065
|
+
export { scheduling_ANY_ROLE as ANY_ROLE, type scheduling_AddPinRequest as AddPinRequest, type scheduling_AddPinResponse as AddPinResponse, type scheduling_AddPreferenceRequest as AddPreferenceRequest, type scheduling_AddPreferenceResponse as AddPreferenceResponse, type scheduling_AgentSpec as AgentSpec, type scheduling_Assignment as Assignment, type scheduling_AssignmentStatus as AssignmentStatus, type scheduling_CreateSchedulingProblemRequest as CreateSchedulingProblemRequest, type scheduling_CreateSchedulingProblemResponse as CreateSchedulingProblemResponse, type scheduling_Pin as Pin, type scheduling_PinEntry as PinEntry, type scheduling_Preference as Preference, type scheduling_PreferenceEntry as PreferenceEntry, type scheduling_SchedulingAssignmentsResponse as SchedulingAssignmentsResponse, type scheduling_SchedulingFeasibilityRequest as SchedulingFeasibilityRequest, type scheduling_SchedulingFeasibilityResponse as SchedulingFeasibilityResponse, type scheduling_SchedulingOptimizeRequest as SchedulingOptimizeRequest, type scheduling_SchedulingOptimizeResponse as SchedulingOptimizeResponse, type scheduling_SchedulingProblem as SchedulingProblem, type scheduling_SchedulingStatus as SchedulingStatus, type scheduling_ShiftDemand as ShiftDemand, type scheduling_SolveSchedulingProblemResponse as SolveSchedulingProblemResponse };
|
|
39471
40066
|
}
|
|
39472
40067
|
|
|
39473
40068
|
/**
|
|
@@ -39539,6 +40134,186 @@ declare class SchedulingClient {
|
|
|
39539
40134
|
* raises.
|
|
39540
40135
|
*/
|
|
39541
40136
|
feasibility(request: SchedulingFeasibilityRequest): Promise<SchedulingFeasibilityResponse>;
|
|
40137
|
+
/**
|
|
40138
|
+
* Solve the scheduling problem with **soft preferences** and
|
|
40139
|
+
* return the per-cell envelope across the space of *optimal*
|
|
40140
|
+
* schedules.
|
|
40141
|
+
*
|
|
40142
|
+
* @param request - the scheduling problem plus optional
|
|
40143
|
+
* `preferences` (per-cell scores added to the optimizer's
|
|
40144
|
+
* objective). Same hard-constraint shape as
|
|
40145
|
+
* {@link SchedulingClient.feasibility}.
|
|
40146
|
+
* @returns a {@link SchedulingOptimizeResponse} with `totalScore`
|
|
40147
|
+
* and per-cell trichotomy across optimal schedules.
|
|
40148
|
+
*
|
|
40149
|
+
* @throws HTTP 400 errors are surfaced when the input is malformed
|
|
40150
|
+
* (duplicate agent IDs, pins or preferences referencing unknown
|
|
40151
|
+
* agents, ambiguous pin role on multi-role agents, role minima
|
|
40152
|
+
* exceeding total demand, etc.).
|
|
40153
|
+
*
|
|
40154
|
+
* @remarks
|
|
40155
|
+
* The trichotomy returned here is **strictly stronger** than the
|
|
40156
|
+
* one from {@link SchedulingClient.feasibility}:
|
|
40157
|
+
*
|
|
40158
|
+
* - `"confirmed_true"` — assigned in *every* optimum.
|
|
40159
|
+
* - `"confirmed_false"` — assigned in *no* optimum.
|
|
40160
|
+
* - `"free"` — varies across the optima; the optimizer is indifferent
|
|
40161
|
+
* between equally-good choices.
|
|
40162
|
+
*
|
|
40163
|
+
* `totalScore` is the sum of {@link Preference.score} over assigned
|
|
40164
|
+
* cells in the optimum (`0` when no preferences are supplied or
|
|
40165
|
+
* the problem is infeasible).
|
|
40166
|
+
*
|
|
40167
|
+
* Preferences targeting structurally-fixed cells (pinned cells,
|
|
40168
|
+
* day-off / shift-only restricted cells, agents not in the grid)
|
|
40169
|
+
* are silently ignored — the optimizer has no choice to make there.
|
|
40170
|
+
*
|
|
40171
|
+
* Empty `preferences` is equivalent to calling
|
|
40172
|
+
* {@link SchedulingClient.feasibility} (every feasible schedule
|
|
40173
|
+
* is optimal under a zero objective), but slower; prefer
|
|
40174
|
+
* `feasibility()` when you only need the feasibility envelope.
|
|
40175
|
+
*
|
|
40176
|
+
* @example Score Aisha as a strong preference for emergency cover
|
|
40177
|
+
* ```typescript
|
|
40178
|
+
* const report = await client.scheduling.optimize({
|
|
40179
|
+
* agents: [
|
|
40180
|
+
* { id: 'aisha', roles: ['icu', 'emergency'], maxAssignments: 5 },
|
|
40181
|
+
* { id: 'bob', roles: ['general'], maxAssignments: 5 },
|
|
40182
|
+
* ],
|
|
40183
|
+
* days: 7,
|
|
40184
|
+
* shiftsPerDay: 3,
|
|
40185
|
+
* demands: [{ day: 0, shift: 0, total: 2, roleMinimums: { icu: 1 } }],
|
|
40186
|
+
* preferences: [
|
|
40187
|
+
* { agentId: 'aisha', day: 0, shift: 0, score: 10 },
|
|
40188
|
+
* ],
|
|
40189
|
+
* });
|
|
40190
|
+
*
|
|
40191
|
+
* console.log(report.totalScore); // 10 if Aisha is in the optimum
|
|
40192
|
+
* console.log(report.status); // 'feasible' | 'infeasible'
|
|
40193
|
+
* ```
|
|
40194
|
+
*/
|
|
40195
|
+
optimize(request: SchedulingOptimizeRequest): Promise<SchedulingOptimizeResponse>;
|
|
40196
|
+
/**
|
|
40197
|
+
* Freeze the inline scheduling inputs into a `scheduling.problem`
|
|
40198
|
+
* Ψ-term snapshot stored under the caller's tenant, and return the
|
|
40199
|
+
* snapshot's `problemId`. The endpoint does NOT solve — call
|
|
40200
|
+
* {@link SchedulingClient.solveProblem} afterwards to compute the
|
|
40201
|
+
* optimum, then {@link SchedulingClient.listAssignments} to fetch
|
|
40202
|
+
* the per-cell trichotomy.
|
|
40203
|
+
*
|
|
40204
|
+
* @param request - same inline shape as
|
|
40205
|
+
* {@link SchedulingClient.optimize}.
|
|
40206
|
+
* @returns the snapshot ID, useful for subsequent re-solves and
|
|
40207
|
+
* provenance lookups.
|
|
40208
|
+
* @throws HTTP 400 on malformed input (duplicate agent IDs,
|
|
40209
|
+
* ambiguous pin role, unknown pin or preference agent ID,
|
|
40210
|
+
* role minima exceeding total demand, etc.).
|
|
40211
|
+
*
|
|
40212
|
+
* @remarks
|
|
40213
|
+
* Re-solves read only the snapshot, so the optimum is reproducible
|
|
40214
|
+
* and auditable from the moment the problem is created. The
|
|
40215
|
+
* snapshot persists across solves — pin a problem once, re-solve
|
|
40216
|
+
* many times.
|
|
40217
|
+
*
|
|
40218
|
+
* @example
|
|
40219
|
+
* ```typescript
|
|
40220
|
+
* const { problemId } = await client.scheduling.createProblem({
|
|
40221
|
+
* agents: [{ id: 'alice', roles: ['icu'], maxAssignments: 3 }],
|
|
40222
|
+
* days: 7,
|
|
40223
|
+
* shiftsPerDay: 3,
|
|
40224
|
+
* demands: [{ day: 0, shift: 0, total: 1, roleMinimums: { icu: 1 } }],
|
|
40225
|
+
* preferences: [{ agentId: 'alice', day: 0, shift: 0, score: 5 }],
|
|
40226
|
+
* });
|
|
40227
|
+
* await client.scheduling.solveProblem(problemId);
|
|
40228
|
+
* const { totalScore, assignments } =
|
|
40229
|
+
* await client.scheduling.listAssignments(problemId);
|
|
40230
|
+
* ```
|
|
40231
|
+
*/
|
|
40232
|
+
createProblem(request: CreateSchedulingProblemRequest): Promise<CreateSchedulingProblemResponse>;
|
|
40233
|
+
/**
|
|
40234
|
+
* Re-solve a previously-stored snapshot, lift the per-cell
|
|
40235
|
+
* trichotomy into `scheduling.assignment` Ψ-terms (idempotent —
|
|
40236
|
+
* previously lifted assignments are replaced), and return the
|
|
40237
|
+
* optimum's `totalScore`.
|
|
40238
|
+
*
|
|
40239
|
+
* @param problemId - the ID returned by
|
|
40240
|
+
* {@link SchedulingClient.createProblem}.
|
|
40241
|
+
* @throws HTTP 404 when the problem doesn't exist for the caller's
|
|
40242
|
+
* tenant. HTTP 400 for malformed problem IDs.
|
|
40243
|
+
*
|
|
40244
|
+
* @remarks
|
|
40245
|
+
* Returns only `status` and `totalScore`; fetch the per-cell
|
|
40246
|
+
* trichotomy with {@link SchedulingClient.listAssignments}.
|
|
40247
|
+
* Re-running this method on the same `problemId` is safe — the
|
|
40248
|
+
* lifted assignment terms are replaced atomically.
|
|
40249
|
+
*/
|
|
40250
|
+
solveProblem(problemId: string): Promise<SolveSchedulingProblemResponse>;
|
|
40251
|
+
/**
|
|
40252
|
+
* Retrieve the lifted `scheduling.assignment` Ψ-terms produced by
|
|
40253
|
+
* the most recent solve.
|
|
40254
|
+
*
|
|
40255
|
+
* @param problemId - the ID returned by
|
|
40256
|
+
* {@link SchedulingClient.createProblem}.
|
|
40257
|
+
* @throws HTTP 404 when the problem doesn't exist for the caller's
|
|
40258
|
+
* tenant. HTTP 400 for malformed problem IDs.
|
|
40259
|
+
*
|
|
40260
|
+
* @remarks
|
|
40261
|
+
* Returns one entry per `(agent, day, shift)` cell — including
|
|
40262
|
+
* `free` cells, so consumers can residuate on cells the optimizer
|
|
40263
|
+
* is indifferent about. `assignments` is empty when the problem
|
|
40264
|
+
* exists but hasn't been solved yet.
|
|
40265
|
+
*
|
|
40266
|
+
* `totalScore` mirrors the most recent solve's optimum value, or
|
|
40267
|
+
* `0` when the problem hasn't been solved.
|
|
40268
|
+
*/
|
|
40269
|
+
listAssignments(problemId: string): Promise<SchedulingAssignmentsResponse>;
|
|
40270
|
+
/**
|
|
40271
|
+
* Read the current state of a stored problem — its pins,
|
|
40272
|
+
* preferences, version counter, and latest-solve metadata.
|
|
40273
|
+
*
|
|
40274
|
+
* @remarks
|
|
40275
|
+
* Pin and preference entries carry stable IDs (`pinId`,
|
|
40276
|
+
* `preferenceId`) — pass those to {@link SchedulingClient.removePin}
|
|
40277
|
+
* / {@link SchedulingClient.removePreference} to delete them.
|
|
40278
|
+
*
|
|
40279
|
+
* @throws HTTP 404 when the problem doesn't exist for the
|
|
40280
|
+
* caller's tenant.
|
|
40281
|
+
*/
|
|
40282
|
+
getProblem(problemId: string): Promise<SchedulingProblem>;
|
|
40283
|
+
/**
|
|
40284
|
+
* Append a pin to a stored problem. Returns the pin's stable
|
|
40285
|
+
* ID and the problem's new version. Multiple pins on the same
|
|
40286
|
+
* `(agent, day, shift)` are not deduplicated server-side; if you
|
|
40287
|
+
* want at-most-one-pin-per-cell semantics, enforce it on the
|
|
40288
|
+
* client by checking the pin entries from
|
|
40289
|
+
* {@link SchedulingClient.getProblem} first.
|
|
40290
|
+
*
|
|
40291
|
+
* @throws HTTP 400 when the agent isn't on the problem's roster
|
|
40292
|
+
* or the (day, shift) is outside the grid. HTTP 404 when the
|
|
40293
|
+
* problem doesn't exist for the caller's tenant.
|
|
40294
|
+
*/
|
|
40295
|
+
addPin(problemId: string, request: AddPinRequest): Promise<AddPinResponse>;
|
|
40296
|
+
/**
|
|
40297
|
+
* Remove a pin previously added via
|
|
40298
|
+
* {@link SchedulingClient.addPin}.
|
|
40299
|
+
*
|
|
40300
|
+
* @throws HTTP 404 when the problem doesn't exist for the
|
|
40301
|
+
* tenant or the `pinId` doesn't match any current pin
|
|
40302
|
+
* (already removed, stale ID).
|
|
40303
|
+
*/
|
|
40304
|
+
removePin(problemId: string, pinId: string): Promise<void>;
|
|
40305
|
+
/**
|
|
40306
|
+
* Append a preference to a stored problem. Same return shape as
|
|
40307
|
+
* {@link SchedulingClient.addPin} — `preferenceId` is the stable
|
|
40308
|
+
* handle for removal. Multiple preferences targeting the same
|
|
40309
|
+
* cell sum on the next solve.
|
|
40310
|
+
*/
|
|
40311
|
+
addPreference(problemId: string, request: AddPreferenceRequest): Promise<AddPreferenceResponse>;
|
|
40312
|
+
/**
|
|
40313
|
+
* Remove a preference previously added via
|
|
40314
|
+
* {@link SchedulingClient.addPreference}.
|
|
40315
|
+
*/
|
|
40316
|
+
removePreference(problemId: string, preferenceId: string): Promise<void>;
|
|
39542
40317
|
}
|
|
39543
40318
|
|
|
39544
40319
|
declare class Osfql<SecurityDataType = unknown> {
|