@kortexya/reasoninglayer 0.19.0 → 0.21.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.ts 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.19.0";
112
+ declare const SDK_VERSION = "0.21.0";
113
113
  /**
114
114
  * Configuration for the Reasoning Layer client.
115
115
  *
@@ -1043,6 +1043,20 @@ interface AssignmentDto {
1043
1043
  agent_id: string;
1044
1044
  /** @min 0 */
1045
1045
  day: number;
1046
+ /**
1047
+ * Roles the agent can or must fill at this cell.
1048
+ *
1049
+ * - When `status = confirmed_true`: the role(s) the agent
1050
+ * must fill at this cell. Usually a single entry.
1051
+ * - When `status = free`: the set of roles the agent could
1052
+ * fill across valid schedules that place them here.
1053
+ * - When `status = confirmed_false`: always empty.
1054
+ *
1055
+ * The reserved string `"any"` denotes routing through the
1056
+ * unroled sub-slot pool (i.e. the agent is "just there",
1057
+ * not counting toward any role minimum at this slot).
1058
+ */
1059
+ roles: string[];
1046
1060
  /** @min 0 */
1047
1061
  shift: number;
1048
1062
  /**
@@ -11473,11 +11487,30 @@ interface PendingReviewEntityDto {
11473
11487
  /** Original text span that was extracted */
11474
11488
  source_text?: string | null;
11475
11489
  }
11476
- /** A pre-assigned `(agent, day, shift)` triple. */
11490
+ /**
11491
+ * A pre-assigned `(agent, day, shift)` triple, optionally naming
11492
+ * which role the pin covers.
11493
+ *
11494
+ * When the agent has **multiple roles that each match a role
11495
+ * minimum** at the target slot, the caller MUST set [`PinInput::role`]
11496
+ * to disambiguate. Otherwise the engine returns HTTP 400 — the
11497
+ * silent greedy-match that used to happen here could pick the
11498
+ * "wrong" role and produce spurious infeasibility.
11499
+ *
11500
+ * Role semantics:
11501
+ * * `None` — caller hasn't chosen. Valid only if the agent has at
11502
+ * most one role matching this slot's role_mins.
11503
+ * * `Some("any")` — explicit request to route through the
11504
+ * unroled pool; no role minimum is decremented.
11505
+ * * `Some(role)` — force the pin to cover this role. Must be a
11506
+ * role the agent possesses (HTTP 400 otherwise).
11507
+ */
11477
11508
  interface PinInput {
11478
11509
  agent_id: string;
11479
11510
  /** @min 0 */
11480
11511
  day: number;
11512
+ /** Role the pin covers. See struct-level docs for the cases. */
11513
+ role?: string | null;
11481
11514
  /** @min 0 */
11482
11515
  shift: number;
11483
11516
  }
@@ -11779,6 +11812,31 @@ interface PreferenceDto$1 {
11779
11812
  /** Preference value. */
11780
11813
  value: string;
11781
11814
  }
11815
+ /**
11816
+ * A soft preference: bias the optimizer toward (or against) assigning
11817
+ * `agent_id` to cell `(day, shift)`.
11818
+ *
11819
+ * `score` contributes to the objective when the cell is assigned in
11820
+ * 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.
11826
+ */
11827
+ interface PreferenceInput {
11828
+ agent_id: string;
11829
+ /** @min 0 */
11830
+ day: number;
11831
+ /**
11832
+ * Score contributed by this assignment to the optimizer's
11833
+ * objective. Positive = preferred, negative = avoided.
11834
+ * @format int64
11835
+ */
11836
+ score: number;
11837
+ /** @min 0 */
11838
+ shift: number;
11839
+ }
11782
11840
  /** Prediction result for a single term */
11783
11841
  interface PreferencePrediction$1 {
11784
11842
  /** @format double */
@@ -13708,6 +13766,56 @@ interface SchedulingFeasibilityResponse$1 {
13708
13766
  /** Top-level request status. */
13709
13767
  status: SchedulingStatusDto;
13710
13768
  }
13769
+ /**
13770
+ * Request body for `POST /api/v1/scheduling/optimize`.
13771
+ *
13772
+ * Same hard-constraint shape as
13773
+ * [`SchedulingFeasibilityRequest`], plus a list of soft
13774
+ * `preferences`. The engine returns the per-cell envelope across
13775
+ * the space of **optimal** schedules under the supplied
13776
+ * preferences.
13777
+ */
13778
+ interface SchedulingOptimizeRequest$1 {
13779
+ agents: AgentInput[];
13780
+ /** @min 0 */
13781
+ days: number;
13782
+ demands: ShiftDemandInput[];
13783
+ pins?: PinInput[];
13784
+ /**
13785
+ * Soft preferences applied to the objective. Empty = unweighted
13786
+ * (every feasible schedule is "optimal").
13787
+ */
13788
+ preferences?: PreferenceInput[];
13789
+ /** @min 0 */
13790
+ shifts_per_day: number;
13791
+ }
13792
+ /**
13793
+ * Response to [`SchedulingOptimizeRequest`].
13794
+ *
13795
+ * The per-cell `assignments` trichotomy classifies each cell over
13796
+ * the space of **optimal** schedules — strictly stronger than the
13797
+ * feasibility-only trichotomy returned by
13798
+ * `/api/v1/scheduling/feasibility`. When the un-pinned reduced
13799
+ * problem is infeasible, `status = "infeasible"`, `assignments` is
13800
+ * empty, and `total_score` is `0`.
13801
+ */
13802
+ interface SchedulingOptimizeResponse$1 {
13803
+ /**
13804
+ * Empty when `status` is `infeasible`; otherwise one entry per
13805
+ * `(agent, day, shift)` triple in the input grid, with
13806
+ * trichotomy taken across the space of optimal schedules.
13807
+ */
13808
+ assignments: AssignmentDto[];
13809
+ /** Top-level request status. */
13810
+ status: SchedulingStatusDto;
13811
+ /**
13812
+ * Sum of [`PreferenceInput::score`] over assigned cells in the
13813
+ * optimum. `0` when no preferences were supplied or the
13814
+ * problem is infeasible.
13815
+ * @format int64
13816
+ */
13817
+ total_score: number;
13818
+ }
13711
13819
  /** Top-level request status. */
13712
13820
  type SchedulingStatusDto = "feasible" | "infeasible";
13713
13821
  /** Request to search communities */
@@ -16894,11 +17002,10 @@ declare class Sorts<SecurityDataType = unknown> {
16894
17002
  */
16895
17003
  getSortSimilarity: (data: GetSortSimilarityRequest$1, params?: RequestParams) => Promise<HttpResponse<GetSortSimilarityResponse$1, any>>;
16896
17004
  /**
16897
- * @description This enables semantic search over sort names for NER label pre-filtering. Must be called after bulk sort creation (e.g., after ontology hydration) to make sorts searchable via embedding similarity. Returns the number of sorts indexed.
17005
+ * No description
16898
17006
  *
16899
17007
  * @tags sorts
16900
17008
  * @name IndexSorts
16901
- * @summary Index all sorts for a tenant into the vector store (Qdrant).
16902
17009
  * @request POST:/api/v1/sorts/index
16903
17010
  * @secure
16904
17011
  */
@@ -16955,6 +17062,12 @@ declare class Sorts<SecurityDataType = unknown> {
16955
17062
  limit?: number | null;
16956
17063
  /** Filter to only show LLM-extracted sorts */
16957
17064
  llm_extracted?: boolean | null;
17065
+ /**
17066
+ * Filter to sorts whose name starts with this prefix.
17067
+ * Supports comma-separated multiple prefixes (e.g. "drug_,target_,pathway_,disease_").
17068
+ * Server-side filtering avoids transferring millions of irrelevant sorts.
17069
+ */
17070
+ name_prefix?: string | null;
16958
17071
  /** Filter to only show sorts needing review */
16959
17072
  needs_review?: boolean | null;
16960
17073
  /**
@@ -39257,7 +39370,7 @@ declare class Scheduling<SecurityDataType = unknown> {
39257
39370
  http: HttpClient<SecurityDataType>;
39258
39371
  constructor(http: HttpClient<SecurityDataType>);
39259
39372
  /**
39260
- * @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.
39373
+ * @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.
39261
39374
  *
39262
39375
  * @tags scheduling
39263
39376
  * @name Feasibility
@@ -39265,6 +39378,15 @@ declare class Scheduling<SecurityDataType = unknown> {
39265
39378
  * @request POST:/api/v1/scheduling/feasibility
39266
39379
  */
39267
39380
  feasibility: (data: SchedulingFeasibilityRequest$1, params?: RequestParams) => Promise<HttpResponse<SchedulingFeasibilityResponse$1, void>>;
39381
+ /**
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.
39383
+ *
39384
+ * @tags scheduling
39385
+ * @name Optimize
39386
+ * @summary `POST /api/v1/scheduling/optimize`
39387
+ * @request POST:/api/v1/scheduling/optimize
39388
+ */
39389
+ optimize: (data: SchedulingOptimizeRequest$1, params?: RequestParams) => Promise<HttpResponse<SchedulingOptimizeResponse$1, void>>;
39268
39390
  }
39269
39391
 
39270
39392
  /**
@@ -39334,14 +39456,38 @@ interface ShiftDemand {
39334
39456
  */
39335
39457
  roleMinimums?: Record<string, number>;
39336
39458
  }
39459
+ /**
39460
+ * Reserved role-name for the unroled ("any") sub-slot pool.
39461
+ *
39462
+ * Use this value for {@link Pin.role} when you want the pin to NOT
39463
+ * decrement any role minimum (agent fills the "any" slack). Also
39464
+ * appears in {@link Assignment.roles} when the agent routes through
39465
+ * that pool.
39466
+ */
39467
+ declare const ANY_ROLE = "any";
39337
39468
  /**
39338
39469
  * A pre-assigned `(agent, day, shift)` triple. The engine treats the
39339
39470
  * pin as confirmed-true and reduces the slot's remaining demand.
39471
+ *
39472
+ * When the agent has **multiple roles that each match a role
39473
+ * minimum** at the target slot, the caller MUST set {@link Pin.role}
39474
+ * to disambiguate. Otherwise the backend returns HTTP 400 with an
39475
+ * "ambiguous pin role" error listing the candidate roles.
39476
+ *
39477
+ * Role semantics:
39478
+ * - `undefined` — no role specified. Valid only when the agent has
39479
+ * at most one role matching this slot's role minimums.
39480
+ * - `"any"` (see {@link ANY_ROLE}) — route through the unroled pool;
39481
+ * no role minimum is decremented.
39482
+ * - `"<role>"` — force the pin to cover this role. Must be a role
39483
+ * the agent possesses (HTTP 400 otherwise).
39340
39484
  */
39341
39485
  interface Pin {
39342
39486
  agentId: string;
39343
39487
  day: number;
39344
39488
  shift: number;
39489
+ /** Role the pin covers. See docs above for the cases. */
39490
+ role?: string;
39345
39491
  }
39346
39492
  /**
39347
39493
  * Input to {@link SchedulingClient.feasibility}.
@@ -39372,6 +39518,19 @@ interface Assignment {
39372
39518
  day: number;
39373
39519
  shift: number;
39374
39520
  status: AssignmentStatus;
39521
+ /**
39522
+ * Roles the agent can or must fill at this cell.
39523
+ *
39524
+ * - When `status === 'confirmed_true'`: the role(s) the agent must
39525
+ * fill at this cell. Usually a single entry.
39526
+ * - When `status === 'free'`: the set of roles the agent could fill
39527
+ * across valid schedules that place them here.
39528
+ * - When `status === 'confirmed_false'`: always empty.
39529
+ *
39530
+ * The reserved string {@link ANY_ROLE} (`"any"`) denotes routing
39531
+ * through the unroled sub-slot pool.
39532
+ */
39533
+ roles: string[];
39375
39534
  }
39376
39535
  /**
39377
39536
  * Response from {@link SchedulingClient.feasibility}.
@@ -39386,17 +39545,106 @@ interface SchedulingFeasibilityResponse {
39386
39545
  status: SchedulingStatus;
39387
39546
  assignments: Assignment[];
39388
39547
  }
39548
+ /**
39549
+ * A soft preference: bias the optimizer toward (or against) assigning
39550
+ * `agentId` to cell `(day, shift)`.
39551
+ *
39552
+ * @remarks
39553
+ * `score` contributes to the optimizer's objective when the cell is
39554
+ * assigned in the chosen schedule. Positive values pull the optimizer
39555
+ * toward the cell; negative values push it away.
39556
+ *
39557
+ * Preferences targeting a cell that is already pinned, blocked by a
39558
+ * day-off, restricted-to-shift, or otherwise structurally fixed are
39559
+ * silently ignored — those cells are not the optimizer's choice to
39560
+ * make.
39561
+ *
39562
+ * Common encodings:
39563
+ * - "Aisha prefers morning shifts" → `score = +5` on every
39564
+ * `(aisha, day, morning)` pair
39565
+ * - "Avoid weekend assignments" → `score = -3` on every
39566
+ * `(*, sat|sun, *)` pair
39567
+ * - "Honor day-off requests" → `score = -100` on
39568
+ * `(agent, requested_off_day, *)` (large negative penalty —
39569
+ * respects the request when feasible, lets the engine decide
39570
+ * when not)
39571
+ */
39572
+ interface Preference {
39573
+ agentId: string;
39574
+ day: number;
39575
+ shift: number;
39576
+ /**
39577
+ * Score added to the objective when this cell is assigned in the
39578
+ * chosen schedule. Positive = preferred, negative = avoided.
39579
+ */
39580
+ score: number;
39581
+ }
39582
+ /**
39583
+ * Input to {@link SchedulingClient.optimize}.
39584
+ *
39585
+ * @remarks
39586
+ * Same hard-constraint shape as {@link SchedulingFeasibilityRequest}
39587
+ * plus a list of soft `preferences`. The engine returns the per-cell
39588
+ * envelope across the space of **optimal** schedules under the
39589
+ * supplied preferences.
39590
+ */
39591
+ interface SchedulingOptimizeRequest {
39592
+ agents: AgentSpec[];
39593
+ days: number;
39594
+ shiftsPerDay: number;
39595
+ demands: ShiftDemand[];
39596
+ /** Pre-assigned `(agent, day, shift)` triples. Defaults to empty. */
39597
+ pins?: Pin[];
39598
+ /**
39599
+ * Soft preferences applied to the objective. Empty (or omitted) =
39600
+ * unweighted: every feasible schedule is "optimal" and the result
39601
+ * coincides with {@link SchedulingClient.feasibility}.
39602
+ */
39603
+ preferences?: Preference[];
39604
+ }
39605
+ /**
39606
+ * Response from {@link SchedulingClient.optimize}.
39607
+ *
39608
+ * @remarks
39609
+ * The per-cell `assignments` trichotomy classifies each cell over the
39610
+ * space of **optimal** schedules — strictly stronger than the
39611
+ * feasibility-only trichotomy from
39612
+ * {@link SchedulingClient.feasibility}:
39613
+ *
39614
+ * - `"confirmed_true"` — assigned in *every* optimal schedule.
39615
+ * - `"confirmed_false"` — assigned in *no* optimal schedule.
39616
+ * - `"free"` — varies across the (possibly multiple) optimal
39617
+ * schedules; the optimizer is indifferent.
39618
+ *
39619
+ * `totalScore` is the sum of {@link Preference.score} over assigned
39620
+ * cells in the optimum. It is `0` when no preferences were supplied
39621
+ * or the problem is infeasible.
39622
+ */
39623
+ interface SchedulingOptimizeResponse {
39624
+ status: SchedulingStatus;
39625
+ /** Sum of preference scores at chosen cells in the optimum. */
39626
+ totalScore: number;
39627
+ /**
39628
+ * Empty when `status === "infeasible"`; otherwise one entry per
39629
+ * `(agent, day, shift)` triple in the input grid.
39630
+ */
39631
+ assignments: Assignment[];
39632
+ }
39389
39633
 
39634
+ declare const scheduling_ANY_ROLE: typeof ANY_ROLE;
39390
39635
  type scheduling_AgentSpec = AgentSpec;
39391
39636
  type scheduling_Assignment = Assignment;
39392
39637
  type scheduling_AssignmentStatus = AssignmentStatus;
39393
39638
  type scheduling_Pin = Pin;
39639
+ type scheduling_Preference = Preference;
39394
39640
  type scheduling_SchedulingFeasibilityRequest = SchedulingFeasibilityRequest;
39395
39641
  type scheduling_SchedulingFeasibilityResponse = SchedulingFeasibilityResponse;
39642
+ type scheduling_SchedulingOptimizeRequest = SchedulingOptimizeRequest;
39643
+ type scheduling_SchedulingOptimizeResponse = SchedulingOptimizeResponse;
39396
39644
  type scheduling_SchedulingStatus = SchedulingStatus;
39397
39645
  type scheduling_ShiftDemand = ShiftDemand;
39398
39646
  declare namespace scheduling {
39399
- export type { scheduling_AgentSpec as AgentSpec, scheduling_Assignment as Assignment, scheduling_AssignmentStatus as AssignmentStatus, scheduling_Pin as Pin, scheduling_SchedulingFeasibilityRequest as SchedulingFeasibilityRequest, scheduling_SchedulingFeasibilityResponse as SchedulingFeasibilityResponse, scheduling_SchedulingStatus as SchedulingStatus, scheduling_ShiftDemand as ShiftDemand };
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 };
39400
39648
  }
39401
39649
 
39402
39650
  /**
@@ -39468,6 +39716,65 @@ declare class SchedulingClient {
39468
39716
  * raises.
39469
39717
  */
39470
39718
  feasibility(request: SchedulingFeasibilityRequest): Promise<SchedulingFeasibilityResponse>;
39719
+ /**
39720
+ * Solve the scheduling problem with **soft preferences** and
39721
+ * return the per-cell envelope across the space of *optimal*
39722
+ * schedules.
39723
+ *
39724
+ * @param request - the scheduling problem plus optional
39725
+ * `preferences` (per-cell scores added to the optimizer's
39726
+ * objective). Same hard-constraint shape as
39727
+ * {@link SchedulingClient.feasibility}.
39728
+ * @returns a {@link SchedulingOptimizeResponse} with `totalScore`
39729
+ * and per-cell trichotomy across optimal schedules.
39730
+ *
39731
+ * @throws HTTP 400 errors are surfaced when the input is malformed
39732
+ * (duplicate agent IDs, pins or preferences referencing unknown
39733
+ * agents, ambiguous pin role on multi-role agents, role minima
39734
+ * exceeding total demand, etc.).
39735
+ *
39736
+ * @remarks
39737
+ * The trichotomy returned here is **strictly stronger** than the
39738
+ * one from {@link SchedulingClient.feasibility}:
39739
+ *
39740
+ * - `"confirmed_true"` — assigned in *every* optimum.
39741
+ * - `"confirmed_false"` — assigned in *no* optimum.
39742
+ * - `"free"` — varies across the optima; the optimizer is indifferent
39743
+ * between equally-good choices.
39744
+ *
39745
+ * `totalScore` is the sum of {@link Preference.score} over assigned
39746
+ * cells in the optimum (`0` when no preferences are supplied or
39747
+ * the problem is infeasible).
39748
+ *
39749
+ * Preferences targeting structurally-fixed cells (pinned cells,
39750
+ * day-off / shift-only restricted cells, agents not in the grid)
39751
+ * are silently ignored — the optimizer has no choice to make there.
39752
+ *
39753
+ * Empty `preferences` is equivalent to calling
39754
+ * {@link SchedulingClient.feasibility} (every feasible schedule
39755
+ * is optimal under a zero objective), but slower; prefer
39756
+ * `feasibility()` when you only need the feasibility envelope.
39757
+ *
39758
+ * @example Score Aisha as a strong preference for emergency cover
39759
+ * ```typescript
39760
+ * const report = await client.scheduling.optimize({
39761
+ * agents: [
39762
+ * { id: 'aisha', roles: ['icu', 'emergency'], maxAssignments: 5 },
39763
+ * { id: 'bob', roles: ['general'], maxAssignments: 5 },
39764
+ * ],
39765
+ * days: 7,
39766
+ * shiftsPerDay: 3,
39767
+ * demands: [{ day: 0, shift: 0, total: 2, roleMinimums: { icu: 1 } }],
39768
+ * preferences: [
39769
+ * { agentId: 'aisha', day: 0, shift: 0, score: 10 },
39770
+ * ],
39771
+ * });
39772
+ *
39773
+ * console.log(report.totalScore); // 10 if Aisha is in the optimum
39774
+ * console.log(report.status); // 'feasible' | 'infeasible'
39775
+ * ```
39776
+ */
39777
+ optimize(request: SchedulingOptimizeRequest): Promise<SchedulingOptimizeResponse>;
39471
39778
  }
39472
39779
 
39473
39780
  declare class Osfql<SecurityDataType = unknown> {
@@ -42334,4 +42641,4 @@ declare function toUntaggedFeatures(features: PlainFeatureMap): Record<string, F
42334
42641
  */
42335
42642
  declare function toTermInputDto(input: PsiTermInput | TermInputDto): TermInputDto;
42336
42643
 
42337
- export { actionReviews as ActionReviews, type AddFactRequest, type AddFactResponse, type AddRuleRequest, type AddRuleResponse, admin as Admin, type AiGroup, analysis as Analysis, type AnalysisGroup, ApiError, type ApiResponse, AuthenticationError, type BackwardChainRequest, type BackwardChainResponse, BadRequestError, type BulkAddTermsRequest, type BulkAddTermsResponse, type BulkCreateSortsRequest, type BulkCreateSortsResponse, cdl as CDL, causal as Causal, type ClearTermsResponse, type ClientConfig, cognitive as Cognitive, collections as Collections, communities as Communities, type ConstrainedPlainVar, ConstraintViolationError, constraints as Constraints, control as Control, conversation as Conversation, type ConversationMessageRequest, type ConversationMessageResponse, type ConversationSummaryDto, type ConversationTurnsResponse, type CoreGroup, type CreateResearchSessionRequest, type CreateResearchSessionResponse, type CreateSortRequest, type CreateTermRequest, type DataGroup, discovery as Discovery, type ErrorResponse$1 as ErrorResponse, execution as Execution, extract as Extract, type FeatureInputValueDto, type FeatureValueDto, ForbiddenError, type ForwardChainRequest, type ForwardChainResponse, functions as Functions, fuzzy as Fuzzy, FuzzyShape, type FuzzyShapeDto, generation as Generation, type GlbRequest, type GlbResponse, health as Health, homoiconic as Homoiconic, ilp as ILP, imageExtraction as ImageExtraction, inference as Inference, type IngestPaperRequest, type IngestPaperResponse, ingestion as Ingestion, IngestionFailedError, IngestionSession, type IngestionSyncOptions, type Interceptor, InternalServerError, type JsonValue$1 as JsonValue, LP, type ListConversationsResponse, type LubRequest, type LubResponse, namespaces as Namespaces, NetworkError, neuroSymbolic as NeuroSymbolic, NotFoundError, ontology as Ontology, optimize as Optimize, type OsfSearchRequest, type OsfSearchResponse, osfql as Osfql, type OsfqlRequest, type OsfqlResponse, type OsfqlValue, oversight as Oversight, type PaginationParams, type PaperMetadataDto, type PaperSource, type PlainFeatureMap, type PlainFeatureValue, plainValues as PlainValues, preferences as Preferences, proofEngine as ProofEngine, type PsiTermDto, type PsiTermInput, query as Query, rag as RAG, RateLimitError, type RateLimitInfo, reasoning as Reasoning, type ReasoningGroup, ReasoningLayerClient, ReasoningLayerError, type RequestOptions, research as Research, type ResearchContradictionsResponse, type ResearchCycleResponse, type ResearchFindingsResponse, type ResearchGapsResponse, type ResearchReportResponse, type ResearchSessionResponse, reviews as Reviews, row as Row, SDK_VERSION, scenarios as Scenarios, scheduling as Scheduling, type SearchPapersRequest, type SearchPapersResponse, SortBuilder, type SortDto, type SortInfoDto, sorts as Sorts, sources as Sources, spaces as Spaces, statistical as Statistical, synthetic as Synthetic, type SystemGroup, type TermDto, type TermInputArg, type TermInputDto, type TermListResponse, type TermPatternDto, type TermResponse, terms as Terms, TimeoutError, type TurnDto, type UpdateTermRequest, utilities as Utilities, ValidationError, Value, type ValueDto, values as Values, type VerifyClaimRequest, type VerifyClaimResponse, visualization as Visualization, WebSocketClient, WebSocketConnection, webhookActions as WebhookActions, type WorkflowGroup, allen, constrained, discriminateFeatureValue, guard, isConstrainedPlainVar, isPsiTermInput, isTaggedValueDto, isUuid, psi, toTaggedFeatures, toTaggedValue, toTermInputDto, toUntaggedFeatures, toUntaggedValue };
42644
+ export { ANY_ROLE, actionReviews as ActionReviews, type AddFactRequest, type AddFactResponse, type AddRuleRequest, type AddRuleResponse, admin as Admin, type AiGroup, analysis as Analysis, type AnalysisGroup, ApiError, type ApiResponse, AuthenticationError, type BackwardChainRequest, type BackwardChainResponse, BadRequestError, type BulkAddTermsRequest, type BulkAddTermsResponse, type BulkCreateSortsRequest, type BulkCreateSortsResponse, cdl as CDL, causal as Causal, type ClearTermsResponse, type ClientConfig, cognitive as Cognitive, collections as Collections, communities as Communities, type ConstrainedPlainVar, ConstraintViolationError, constraints as Constraints, control as Control, conversation as Conversation, type ConversationMessageRequest, type ConversationMessageResponse, type ConversationSummaryDto, type ConversationTurnsResponse, type CoreGroup, type CreateResearchSessionRequest, type CreateResearchSessionResponse, type CreateSortRequest, type CreateTermRequest, type DataGroup, discovery as Discovery, type ErrorResponse$1 as ErrorResponse, execution as Execution, extract as Extract, type FeatureInputValueDto, type FeatureValueDto, ForbiddenError, type ForwardChainRequest, type ForwardChainResponse, functions as Functions, fuzzy as Fuzzy, FuzzyShape, type FuzzyShapeDto, generation as Generation, type GlbRequest, type GlbResponse, health as Health, homoiconic as Homoiconic, ilp as ILP, imageExtraction as ImageExtraction, inference as Inference, type IngestPaperRequest, type IngestPaperResponse, ingestion as Ingestion, IngestionFailedError, IngestionSession, type IngestionSyncOptions, type Interceptor, InternalServerError, type JsonValue$1 as JsonValue, LP, type ListConversationsResponse, type LubRequest, type LubResponse, namespaces as Namespaces, NetworkError, neuroSymbolic as NeuroSymbolic, NotFoundError, ontology as Ontology, optimize as Optimize, type OsfSearchRequest, type OsfSearchResponse, osfql as Osfql, type OsfqlRequest, type OsfqlResponse, type OsfqlValue, oversight as Oversight, type PaginationParams, type PaperMetadataDto, type PaperSource, type PlainFeatureMap, type PlainFeatureValue, plainValues as PlainValues, preferences as Preferences, proofEngine as ProofEngine, type PsiTermDto, type PsiTermInput, query as Query, rag as RAG, RateLimitError, type RateLimitInfo, reasoning as Reasoning, type ReasoningGroup, ReasoningLayerClient, ReasoningLayerError, type RequestOptions, research as Research, type ResearchContradictionsResponse, type ResearchCycleResponse, type ResearchFindingsResponse, type ResearchGapsResponse, type ResearchReportResponse, type ResearchSessionResponse, reviews as Reviews, row as Row, SDK_VERSION, scenarios as Scenarios, scheduling as Scheduling, type SearchPapersRequest, type SearchPapersResponse, SortBuilder, type SortDto, type SortInfoDto, sorts as Sorts, sources as Sources, spaces as Spaces, statistical as Statistical, synthetic as Synthetic, type SystemGroup, type TermDto, type TermInputArg, type TermInputDto, type TermListResponse, type TermPatternDto, type TermResponse, terms as Terms, TimeoutError, type TurnDto, type UpdateTermRequest, utilities as Utilities, ValidationError, Value, type ValueDto, values as Values, type VerifyClaimRequest, type VerifyClaimResponse, visualization as Visualization, WebSocketClient, WebSocketConnection, webhookActions as WebhookActions, type WorkflowGroup, allen, constrained, discriminateFeatureValue, guard, isConstrainedPlainVar, isPsiTermInput, isTaggedValueDto, isUuid, psi, toTaggedFeatures, toTaggedValue, toTermInputDto, toUntaggedFeatures, toUntaggedValue };
package/dist/index.js CHANGED
@@ -1,5 +1,11 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
1
7
  // src/config.ts
2
- var SDK_VERSION = "0.19.0";
8
+ var SDK_VERSION = "0.21.0";
3
9
  function resolveConfig(config) {
4
10
  if (!config.baseUrl) {
5
11
  throw new Error("ClientConfig.baseUrl is required");
@@ -949,11 +955,10 @@ var Sorts = class {
949
955
  ...params
950
956
  });
951
957
  /**
952
- * @description This enables semantic search over sort names for NER label pre-filtering. Must be called after bulk sort creation (e.g., after ontology hydration) to make sorts searchable via embedding similarity. Returns the number of sorts indexed.
958
+ * No description
953
959
  *
954
960
  * @tags sorts
955
961
  * @name IndexSorts
956
- * @summary Index all sorts for a tenant into the vector store (Qdrant).
957
962
  * @request POST:/api/v1/sorts/index
958
963
  * @secure
959
964
  */
@@ -7384,7 +7389,7 @@ var Scheduling = class {
7384
7389
  this.http = http;
7385
7390
  }
7386
7391
  /**
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.
7392
+ * @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.
7388
7393
  *
7389
7394
  * @tags scheduling
7390
7395
  * @name Feasibility
@@ -7399,6 +7404,22 @@ var Scheduling = class {
7399
7404
  format: "json",
7400
7405
  ...params
7401
7406
  });
7407
+ /**
7408
+ * @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.
7409
+ *
7410
+ * @tags scheduling
7411
+ * @name Optimize
7412
+ * @summary `POST /api/v1/scheduling/optimize`
7413
+ * @request POST:/api/v1/scheduling/optimize
7414
+ */
7415
+ optimize = (data, params = {}) => this.http.request({
7416
+ path: `/api/v1/scheduling/optimize`,
7417
+ method: "POST",
7418
+ body: data,
7419
+ type: "application/json" /* Json */,
7420
+ format: "json",
7421
+ ...params
7422
+ });
7402
7423
  };
7403
7424
 
7404
7425
  // src/api-spec/generated/Admin.ts
@@ -20491,11 +20512,15 @@ function ShiftDemandFromFrontToApi(demand) {
20491
20512
  return dto;
20492
20513
  }
20493
20514
  function PinFromFrontToApi(pin) {
20494
- return {
20515
+ const dto = {
20495
20516
  agent_id: pin.agentId,
20496
20517
  day: pin.day,
20497
20518
  shift: pin.shift
20498
20519
  };
20520
+ if (pin.role !== void 0) {
20521
+ dto.role = pin.role;
20522
+ }
20523
+ return dto;
20499
20524
  }
20500
20525
  function SchedulingFeasibilityRequestFromFrontToApi(request) {
20501
20526
  const dto = {
@@ -20514,7 +20539,8 @@ function AssignmentFromApiToFront(dto) {
20514
20539
  agentId: dto.agent_id,
20515
20540
  day: dto.day,
20516
20541
  shift: dto.shift,
20517
- status: dto.status
20542
+ status: dto.status,
20543
+ roles: dto.roles ?? []
20518
20544
  };
20519
20545
  }
20520
20546
  function SchedulingFeasibilityResponseFromApiToFront(dto) {
@@ -20523,6 +20549,36 @@ function SchedulingFeasibilityResponseFromApiToFront(dto) {
20523
20549
  assignments: dto.assignments.map(AssignmentFromApiToFront)
20524
20550
  };
20525
20551
  }
20552
+ function PreferenceFromFrontToApi(pref) {
20553
+ return {
20554
+ agent_id: pref.agentId,
20555
+ day: pref.day,
20556
+ shift: pref.shift,
20557
+ score: pref.score
20558
+ };
20559
+ }
20560
+ function SchedulingOptimizeRequestFromFrontToApi(request) {
20561
+ const dto = {
20562
+ agents: request.agents.map(AgentSpecFromFrontToApi),
20563
+ days: request.days,
20564
+ shifts_per_day: request.shiftsPerDay,
20565
+ demands: request.demands.map(ShiftDemandFromFrontToApi)
20566
+ };
20567
+ if (request.pins !== void 0) {
20568
+ dto.pins = request.pins.map(PinFromFrontToApi);
20569
+ }
20570
+ if (request.preferences !== void 0) {
20571
+ dto.preferences = request.preferences.map(PreferenceFromFrontToApi);
20572
+ }
20573
+ return dto;
20574
+ }
20575
+ function SchedulingOptimizeResponseFromApiToFront(dto) {
20576
+ return {
20577
+ status: dto.status,
20578
+ totalScore: dto.total_score,
20579
+ assignments: dto.assignments.map(AssignmentFromApiToFront)
20580
+ };
20581
+ }
20526
20582
 
20527
20583
  // src/resources/scheduling.ts
20528
20584
  var SchedulingClient = class {
@@ -20553,6 +20609,70 @@ var SchedulingClient = class {
20553
20609
  );
20554
20610
  return SchedulingFeasibilityResponseFromApiToFront(response.data);
20555
20611
  }
20612
+ /**
20613
+ * Solve the scheduling problem with **soft preferences** and
20614
+ * return the per-cell envelope across the space of *optimal*
20615
+ * schedules.
20616
+ *
20617
+ * @param request - the scheduling problem plus optional
20618
+ * `preferences` (per-cell scores added to the optimizer's
20619
+ * objective). Same hard-constraint shape as
20620
+ * {@link SchedulingClient.feasibility}.
20621
+ * @returns a {@link SchedulingOptimizeResponse} with `totalScore`
20622
+ * and per-cell trichotomy across optimal schedules.
20623
+ *
20624
+ * @throws HTTP 400 errors are surfaced when the input is malformed
20625
+ * (duplicate agent IDs, pins or preferences referencing unknown
20626
+ * agents, ambiguous pin role on multi-role agents, role minima
20627
+ * exceeding total demand, etc.).
20628
+ *
20629
+ * @remarks
20630
+ * The trichotomy returned here is **strictly stronger** than the
20631
+ * one from {@link SchedulingClient.feasibility}:
20632
+ *
20633
+ * - `"confirmed_true"` — assigned in *every* optimum.
20634
+ * - `"confirmed_false"` — assigned in *no* optimum.
20635
+ * - `"free"` — varies across the optima; the optimizer is indifferent
20636
+ * between equally-good choices.
20637
+ *
20638
+ * `totalScore` is the sum of {@link Preference.score} over assigned
20639
+ * cells in the optimum (`0` when no preferences are supplied or
20640
+ * the problem is infeasible).
20641
+ *
20642
+ * Preferences targeting structurally-fixed cells (pinned cells,
20643
+ * day-off / shift-only restricted cells, agents not in the grid)
20644
+ * are silently ignored — the optimizer has no choice to make there.
20645
+ *
20646
+ * Empty `preferences` is equivalent to calling
20647
+ * {@link SchedulingClient.feasibility} (every feasible schedule
20648
+ * is optimal under a zero objective), but slower; prefer
20649
+ * `feasibility()` when you only need the feasibility envelope.
20650
+ *
20651
+ * @example Score Aisha as a strong preference for emergency cover
20652
+ * ```typescript
20653
+ * const report = await client.scheduling.optimize({
20654
+ * agents: [
20655
+ * { id: 'aisha', roles: ['icu', 'emergency'], maxAssignments: 5 },
20656
+ * { id: 'bob', roles: ['general'], maxAssignments: 5 },
20657
+ * ],
20658
+ * days: 7,
20659
+ * shiftsPerDay: 3,
20660
+ * demands: [{ day: 0, shift: 0, total: 2, roleMinimums: { icu: 1 } }],
20661
+ * preferences: [
20662
+ * { agentId: 'aisha', day: 0, shift: 0, score: 10 },
20663
+ * ],
20664
+ * });
20665
+ *
20666
+ * console.log(report.totalScore); // 10 if Aisha is in the optimum
20667
+ * console.log(report.status); // 'feasible' | 'infeasible'
20668
+ * ```
20669
+ */
20670
+ async optimize(request) {
20671
+ const response = await this.api.optimize(
20672
+ SchedulingOptimizeRequestFromFrontToApi(request)
20673
+ );
20674
+ return SchedulingOptimizeResponseFromApiToFront(response.data);
20675
+ }
20556
20676
  };
20557
20677
 
20558
20678
  // src/normalizers/osfql.ts
@@ -22088,6 +22208,10 @@ var optimize_exports = {};
22088
22208
 
22089
22209
  // src/types/scheduling.ts
22090
22210
  var scheduling_exports = {};
22211
+ __export(scheduling_exports, {
22212
+ ANY_ROLE: () => ANY_ROLE
22213
+ });
22214
+ var ANY_ROLE = "any";
22091
22215
 
22092
22216
  // src/types/ilp.ts
22093
22217
  var ilp_exports = {};
@@ -22778,6 +22902,6 @@ function discriminateFeatureValue(value) {
22778
22902
  );
22779
22903
  }
22780
22904
 
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 };
22905
+ export { ANY_ROLE, 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 };
22782
22906
  //# sourceMappingURL=index.js.map
22783
22907
  //# sourceMappingURL=index.js.map