@kortexya/reasoninglayer 0.21.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.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.21.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,17 +11900,34 @@ 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
+ }
11815
11915
  /**
11816
11916
  * A soft preference: bias the optimizer toward (or against) assigning
11817
11917
  * `agent_id` to cell `(day, shift)`.
11818
11918
  *
11819
11919
  * `score` contributes to the objective when the cell is assigned in
11820
11920
  * the chosen schedule. Positive values pull the optimizer toward
11821
- * the cell; negative values push it away. Preferences targeting a
11822
- * pinned cell, an agent with a day-off on `day`, or an agent
11823
- * otherwise blocked from the slot are silently ignored — the
11824
- * corresponding decision edge does not exist in the reduced flow
11825
- * graph.
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.
11826
11931
  */
11827
11932
  interface PreferenceInput {
11828
11933
  agent_id: string;
@@ -13725,6 +13830,22 @@ interface ScenarioSummaryDto$1 {
13725
13830
  */
13726
13831
  sorts_created: number;
13727
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
+ }
13728
13849
  /**
13729
13850
  * A scheduling feasibility request.
13730
13851
  *
@@ -13816,6 +13937,38 @@ interface SchedulingOptimizeResponse$1 {
13816
13937
  */
13817
13938
  total_score: number;
13818
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
+ }
13819
13972
  /** Top-level request status. */
13820
13973
  type SchedulingStatusDto = "feasible" | "infeasible";
13821
13974
  /** Request to search communities */
@@ -14246,6 +14399,26 @@ interface SolveConstraintResponse$1 {
14246
14399
  success: boolean;
14247
14400
  suspended_constraints: string[];
14248
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
+ }
14249
14422
  /** Response with ancestor sorts */
14250
14423
  interface SortAncestorsResponse {
14251
14424
  ancestors: SortInfoDto$1[];
@@ -39369,6 +39542,33 @@ declare class OptimizeClient {
39369
39542
  declare class Scheduling<SecurityDataType = unknown> {
39370
39543
  http: HttpClient<SecurityDataType>;
39371
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>>;
39372
39572
  /**
39373
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.
39374
39574
  *
@@ -39379,7 +39579,25 @@ declare class Scheduling<SecurityDataType = unknown> {
39379
39579
  */
39380
39580
  feasibility: (data: SchedulingFeasibilityRequest$1, params?: RequestParams) => Promise<HttpResponse<SchedulingFeasibilityResponse$1, void>>;
39381
39581
  /**
39382
- * @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 cells that are already pinned, blocked by a day-off, restricted-to-shift, or otherwise structurally fixed are silently ignored — those cells are not the optimizer's choice to make.
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.
39383
39601
  *
39384
39602
  * @tags scheduling
39385
39603
  * @name Optimize
@@ -39387,6 +39605,33 @@ declare class Scheduling<SecurityDataType = unknown> {
39387
39605
  * @request POST:/api/v1/scheduling/optimize
39388
39606
  */
39389
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>>;
39390
39635
  }
39391
39636
 
39392
39637
  /**
@@ -39630,21 +39875,194 @@ interface SchedulingOptimizeResponse {
39630
39875
  */
39631
39876
  assignments: Assignment[];
39632
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
+ }
39633
40040
 
39634
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;
39635
40046
  type scheduling_AgentSpec = AgentSpec;
39636
40047
  type scheduling_Assignment = Assignment;
39637
40048
  type scheduling_AssignmentStatus = AssignmentStatus;
40049
+ type scheduling_CreateSchedulingProblemRequest = CreateSchedulingProblemRequest;
40050
+ type scheduling_CreateSchedulingProblemResponse = CreateSchedulingProblemResponse;
39638
40051
  type scheduling_Pin = Pin;
40052
+ type scheduling_PinEntry = PinEntry;
39639
40053
  type scheduling_Preference = Preference;
40054
+ type scheduling_PreferenceEntry = PreferenceEntry;
40055
+ type scheduling_SchedulingAssignmentsResponse = SchedulingAssignmentsResponse;
39640
40056
  type scheduling_SchedulingFeasibilityRequest = SchedulingFeasibilityRequest;
39641
40057
  type scheduling_SchedulingFeasibilityResponse = SchedulingFeasibilityResponse;
39642
40058
  type scheduling_SchedulingOptimizeRequest = SchedulingOptimizeRequest;
39643
40059
  type scheduling_SchedulingOptimizeResponse = SchedulingOptimizeResponse;
40060
+ type scheduling_SchedulingProblem = SchedulingProblem;
39644
40061
  type scheduling_SchedulingStatus = SchedulingStatus;
39645
40062
  type scheduling_ShiftDemand = ShiftDemand;
40063
+ type scheduling_SolveSchedulingProblemResponse = SolveSchedulingProblemResponse;
39646
40064
  declare namespace scheduling {
39647
- 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_Preference as Preference, type scheduling_SchedulingFeasibilityRequest as SchedulingFeasibilityRequest, type scheduling_SchedulingFeasibilityResponse as SchedulingFeasibilityResponse, type scheduling_SchedulingOptimizeRequest as SchedulingOptimizeRequest, type scheduling_SchedulingOptimizeResponse as SchedulingOptimizeResponse, 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 };
39648
40066
  }
39649
40067
 
39650
40068
  /**
@@ -39775,6 +40193,127 @@ declare class SchedulingClient {
39775
40193
  * ```
39776
40194
  */
39777
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>;
39778
40317
  }
39779
40318
 
39780
40319
  declare class Osfql<SecurityDataType = unknown> {