@opengeni/react 0.23.0 → 0.25.5

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.
Files changed (62) hide show
  1. package/dist/{chunk-UQS7OQDE.js → chunk-F4CFWKVI.js} +334 -64
  2. package/dist/chunk-F4CFWKVI.js.map +1 -0
  3. package/dist/chunk-GQN2QIR2.js +3767 -0
  4. package/dist/chunk-GQN2QIR2.js.map +1 -0
  5. package/dist/{chunk-I3BJZIG5.js → chunk-HIWPQYWI.js} +2 -120
  6. package/dist/chunk-HIWPQYWI.js.map +1 -0
  7. package/dist/chunk-M7X4JZOD.js +121 -0
  8. package/dist/chunk-M7X4JZOD.js.map +1 -0
  9. package/dist/{chunk-UAHPKLB6.js → chunk-MP6237JB.js} +571 -975
  10. package/dist/chunk-MP6237JB.js.map +1 -0
  11. package/dist/chunk-OZDLELJQ.js +937 -0
  12. package/dist/chunk-OZDLELJQ.js.map +1 -0
  13. package/dist/{chunk-CATATY77.js → chunk-TMH6HZWF.js} +8 -7
  14. package/dist/chunk-TMH6HZWF.js.map +1 -0
  15. package/dist/{chunk-6XUS5VFM.js → chunk-YU5PGUK7.js} +6 -4
  16. package/dist/{chunk-6XUS5VFM.js.map → chunk-YU5PGUK7.js.map} +1 -1
  17. package/dist/{composer-CVm5uoUI.d.ts → composer-DoC4veX1.d.ts} +6 -63
  18. package/dist/composer.d.ts +3 -2
  19. package/dist/composer.js +4 -3
  20. package/dist/fleet-decision-projection-SLNZMS42.js +241 -0
  21. package/dist/fleet-decision-projection-SLNZMS42.js.map +1 -0
  22. package/dist/fleet-decision-row-GGCAT4E4.js +351 -0
  23. package/dist/fleet-decision-row-GGCAT4E4.js.map +1 -0
  24. package/dist/index.d.ts +17 -259
  25. package/dist/index.js +1042 -5058
  26. package/dist/index.js.map +1 -1
  27. package/dist/machines.js +3 -2
  28. package/dist/session-Du_FsrZ1.d.ts +264 -0
  29. package/dist/session-ui-BqQDH7YV.d.ts +183 -0
  30. package/dist/session-ui.d.ts +7 -0
  31. package/dist/session-ui.js +17 -0
  32. package/dist/session-ui.js.map +1 -0
  33. package/dist/session.d.ts +4 -2
  34. package/dist/session.js +26 -9
  35. package/dist/{use-composer-By1wn3MM.d.ts → use-composer-BnEzheSk.d.ts} +8 -2
  36. package/dist/use-file-attachments-C0kpHrs9.d.ts +76 -0
  37. package/dist/use-turn-queue-3rkJwjFv.d.ts +290 -0
  38. package/package.json +6 -2
  39. package/src/components/composer.tsx +7 -6
  40. package/src/components/message-timeline.tsx +94 -54
  41. package/src/hooks/use-composer.ts +470 -73
  42. package/src/hooks/use-file-attachments.ts +96 -3
  43. package/src/hooks/use-goal.ts +23 -5
  44. package/src/hooks/use-session-events.ts +5 -0
  45. package/src/hooks/use-session-lineage.ts +1 -1
  46. package/src/hooks/use-session.ts +9 -6
  47. package/src/hooks/use-workspace-sessions.ts +30 -5
  48. package/src/session-ui.ts +13 -0
  49. package/src/session.ts +15 -0
  50. package/src/timeline/activity-rail.tsx +18 -2
  51. package/src/timeline/fleet-decision-projection.ts +366 -0
  52. package/src/timeline/fleet-decision-row.tsx +412 -0
  53. package/src/timeline/index.ts +2 -0
  54. package/src/timeline/projection.ts +19 -8
  55. package/src/timeline/tool-display-name.ts +16 -0
  56. package/src/timeline/tool-renderers.tsx +1 -1
  57. package/src/timeline/types.ts +68 -1
  58. package/dist/chunk-CATATY77.js.map +0 -1
  59. package/dist/chunk-I3BJZIG5.js.map +0 -1
  60. package/dist/chunk-UAHPKLB6.js.map +0 -1
  61. package/dist/chunk-UQS7OQDE.js.map +0 -1
  62. package/dist/session-Db00TRwl.d.ts +0 -446
@@ -2,9 +2,10 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
3
  import { KeyboardEvent, ButtonHTMLAttributes, ClipboardEvent, RefObject, DragEvent, ChangeEvent, ComponentPropsWithoutRef, ReactNode } from 'react';
4
4
  import * as _opengeni_sdk from '@opengeni/sdk';
5
- import { Permission, SessionStatus, FileAsset, FileResourceRef, EffectiveSessionControl, ClientModel, TranscriptionLifecycleStatus, TranscriptionErrorCode, TranscriptionEvent, TranscriptionAdapter, WorkspaceTranscriptionPolicy, TranscriptionTargetSelection, TranscriptionDiagnostic, TranscriptionPolicyBlockReason } from '@opengeni/sdk';
6
- import { S as SessionClientLike, C as ClientOverride } from './session-context-rgrfElMl.js';
7
- import { C as ComposerState } from './use-composer-By1wn3MM.js';
5
+ import { Permission, SessionStatus, EffectiveSessionControl, ClientModel, TranscriptionLifecycleStatus, TranscriptionErrorCode, TranscriptionEvent, TranscriptionAdapter, WorkspaceTranscriptionPolicy, TranscriptionTargetSelection, TranscriptionDiagnostic, TranscriptionPolicyBlockReason } from '@opengeni/sdk';
6
+ import { S as SessionClientLike } from './session-context-rgrfElMl.js';
7
+ import { C as ComposerState } from './use-composer-BnEzheSk.js';
8
+ import { U as UseFileAttachmentsResult } from './use-file-attachments-C0kpHrs9.js';
8
9
 
9
10
  /**
10
11
  * The slash-command registry. A command is a SESSION / OPERATOR control — an
@@ -155,64 +156,6 @@ type UseSlashCommandsResult = {
155
156
  };
156
157
  declare function useSlashCommands(options: UseSlashCommandsOptions): UseSlashCommandsResult;
157
158
 
158
- type UseFileAttachmentsOptions = ClientOverride & {
159
- /**
160
- * Only files matching this predicate are accepted by {@link
161
- * UseFileAttachmentsResult.addFromPaste} (the clipboard path). Defaults to
162
- * `image/*` — the console's historical paste filter. {@link
163
- * UseFileAttachmentsResult.addFiles} (the explicit picker / drop path)
164
- * bypasses it.
165
- */
166
- pasteFilter?: ((file: File) => boolean) | undefined;
167
- };
168
- type FileAttachment = {
169
- id: string;
170
- name: string;
171
- contentType: string;
172
- sizeBytes: number;
173
- status: "uploading" | "ready" | "failed";
174
- /** The SDK `FileAsset` once the upload finishes. */
175
- file?: FileAsset | undefined;
176
- /** Object-URL for an inline preview; minted for `image/*` files only. */
177
- previewUrl?: string | undefined;
178
- error?: string | undefined;
179
- };
180
- type UseFileAttachmentsResult = {
181
- attachments: FileAttachment[];
182
- /**
183
- * `FileResourceRef[]` for every attachment that finished uploading — feed
184
- * straight into `useComposer`'s `sendExtras.resources`.
185
- */
186
- readyResources: FileResourceRef[];
187
- /** True while any attachment is still uploading (drives the send-gate). */
188
- uploading: boolean;
189
- /** Explicit picker / drop path — uploads every file, no filter. */
190
- addFiles: (files: Iterable<File>) => void;
191
- /** Clipboard path — applies `pasteFilter` (default `image/*`) then uploads. */
192
- addFromPaste: (event: {
193
- clipboardData: DataTransfer | null;
194
- }) => void;
195
- /**
196
- * Re-run the upload for a `failed` attachment, in place (same id, same
197
- * source file). No-op for an id that isn't a known failed upload.
198
- */
199
- retry: (id: string) => void;
200
- /** Remove one attachment; revokes its object-URL. */
201
- remove: (id: string) => void;
202
- /** Remove all; revokes every object-URL. Call from `useComposer`'s `onSent`. */
203
- clear: () => void;
204
- };
205
- /**
206
- * Upload-and-track state for files attached to the next message. Owns the
207
- * full client-side upload layer: a per-file `uploading | ready | failed`
208
- * status machine driven by the SDK's `client.uploadFile`, object-URL image
209
- * previews with create/revoke lifecycle, the `image/*` clipboard paste filter,
210
- * and a `FileResourceRef[]` projection that drops straight into a message's
211
- * `resources`. Workspace-scoped, so it resolves both client and workspace from
212
- * the {@link OpenGeniProvider} (or a per-call `{ client, workspaceId }`).
213
- */
214
- declare function useFileAttachments(options?: UseFileAttachmentsOptions): UseFileAttachmentsResult;
215
-
216
159
  declare const OPEN_WORKSTREAM_CONTROL_EVENT = "opengeni:open-workstream-control";
217
160
  type ComposerDelivery = Pick<ComposerState, "value" | "setValue" | "send" | "steer" | "sending" | "canSend" | "error" | "clearError">;
218
161
  type ComposerDraftState = Pick<ComposerState, "draftConflict" | "draftSaving" | "resolveDraftConflict" | "restoredResources" | "removeRestoredResource">;
@@ -282,7 +225,7 @@ type ChatComposerMessages = {
282
225
  };
283
226
  declare const defaultChatComposerMessages: ChatComposerMessages;
284
227
  type ComposerSubmitMode = "queue" | "steer";
285
- type ComposerSubmitBlocker = "disabled" | "uploading" | "sending" | "command" | "empty" | null;
228
+ type ComposerSubmitBlocker = "disabled" | "attachment" | "sending" | "command" | "empty" | null;
286
229
  type UseChatComposerControllerOptions = {
287
230
  delivery: ComposerDelivery;
288
231
  draft?: ComposerDraftState | undefined;
@@ -582,4 +525,4 @@ type ComposerTranscriptionControlProps = {
582
525
  /** One provider-neutral microphone control for the nearest editable composer. */
583
526
  declare function ComposerTranscriptionControl({ adapter, policy, selection, messages: overrides, className, lifecycleTimeouts, onDiagnostic, }: ComposerTranscriptionControlProps): react_jsx_runtime.JSX.Element;
584
527
 
585
- export { type ComposerSubmitMode as $, Actions as A, type ChatComposerController as B, type ComposerControlLinks as C, CommandPalette as D, type ComposerActionsProps as E, type FileAttachment as F, type ComposerAttachButtonProps as G, type ComposerCommandPaletteProps as H, INITIAL_TRANSCRIPTION_CONTROL_STATE as I, type ComposerControlState as J, type ComposerControlsProps as K, type ComposerDelivery as L, type ComposerDraftState as M, type Notice as N, OPEN_WORKSTREAM_CONTROL_EVENT as O, type ComposerFooterProps as P, type ComposerFrameProps as Q, type ComposerHintProps as R, type SlashCommand as S, type TranscriptionControlAction as T, type UseFileAttachmentsResult as U, type ComposerInputProps as V, type ComposerModelPickerProps as W, type ComposerPauseButtonProps as X, type ComposerRootProps as Y, type ComposerSendButtonProps as Z, type ComposerSubmitBlocker as _, type ComposerTranscriptionControlProps as a, type ComposerSurfaceProps as a0, Confirmation as a1, Controls as a2, Footer as a3, Frame as a4, Help as a5, Hint as a6, Input as a7, ModelPicker as a8, PauseButton as a9, PausedState as aa, RestoredResources as ab, Root as ac, SendButton as ad, Status as ae, Surface as af, type UseChatComposerControllerOptions as ag, useChatComposer as ah, useChatComposerController as ai, type SlashCommandContext as b, type ChatComposerMessages as c, type SlashArg as d, type CommandContext as e, type CommandResult as f, ComposerTranscriptionControl as g, type ComposerTranscriptionMessages as h, type ConfirmState as i, type SlashCommandHandlers as j, type TranscriptionControlState as k, type TranscriptionControlTransition as l, type UseFileAttachmentsOptions as m, type UseSlashCommandsOptions as n, type UseSlashCommandsResult as o, type UseTranscriptionOptions as p, type UseTranscriptionResult as q, appendFinalTranscript as r, defaultChatComposerMessages as s, transitionTranscriptionControl as t, useFileAttachments as u, useSlashCommands as v, useTranscription as w, AttachButton as x, Attachments as y, type ChatComposerContextValue as z };
528
+ export { Footer as $, Actions as A, type ComposerAttachButtonProps as B, type ComposerControlLinks as C, type ComposerCommandPaletteProps as D, type ComposerControlState as E, type ComposerControlsProps as F, type ComposerDelivery as G, type ComposerDraftState as H, INITIAL_TRANSCRIPTION_CONTROL_STATE as I, type ComposerFooterProps as J, type ComposerFrameProps as K, type ComposerHintProps as L, type ComposerInputProps as M, type Notice as N, OPEN_WORKSTREAM_CONTROL_EVENT as O, type ComposerModelPickerProps as P, type ComposerPauseButtonProps as Q, type ComposerRootProps as R, type SlashCommand as S, type TranscriptionControlAction as T, type UseSlashCommandsOptions as U, type ComposerSendButtonProps as V, type ComposerSubmitBlocker as W, type ComposerSubmitMode as X, type ComposerSurfaceProps as Y, Confirmation as Z, Controls as _, type ComposerTranscriptionControlProps as a, Frame as a0, Help as a1, Hint as a2, Input as a3, ModelPicker as a4, PauseButton as a5, PausedState as a6, RestoredResources as a7, Root as a8, SendButton as a9, Status as aa, Surface as ab, type UseChatComposerControllerOptions as ac, useChatComposer as ad, useChatComposerController as ae, type SlashCommandContext as b, type ChatComposerMessages as c, type SlashArg as d, type CommandContext as e, type CommandResult as f, ComposerTranscriptionControl as g, type ComposerTranscriptionMessages as h, type ConfirmState as i, type SlashCommandHandlers as j, type TranscriptionControlState as k, type TranscriptionControlTransition as l, type UseSlashCommandsResult as m, type UseTranscriptionOptions as n, type UseTranscriptionResult as o, appendFinalTranscript as p, defaultChatComposerMessages as q, useTranscription as r, AttachButton as s, transitionTranscriptionControl as t, useSlashCommands as u, Attachments as v, type ChatComposerContextValue as w, type ChatComposerController as x, CommandPalette as y, type ComposerActionsProps as z };
@@ -1,6 +1,7 @@
1
- export { A as Actions, x as AttachButton, y as Attachments, z as ChatComposerContextValue, B as ChatComposerController, c as ChatComposerMessages, D as CommandPalette, E as ComposerActionsProps, G as ComposerAttachButtonProps, H as ComposerCommandPaletteProps, C as ComposerControlLinks, J as ComposerControlState, K as ComposerControlsProps, L as ComposerDelivery, M as ComposerDraftState, P as ComposerFooterProps, Q as ComposerFrameProps, R as ComposerHintProps, V as ComposerInputProps, W as ComposerModelPickerProps, X as ComposerPauseButtonProps, Y as ComposerRootProps, Z as ComposerSendButtonProps, _ as ComposerSubmitBlocker, $ as ComposerSubmitMode, a0 as ComposerSurfaceProps, g as ComposerTranscriptionControl, a as ComposerTranscriptionControlProps, h as ComposerTranscriptionMessages, a1 as Confirmation, a2 as Controls, a3 as Footer, a4 as Frame, a5 as Help, a6 as Hint, a7 as Input, a8 as ModelPicker, O as OPEN_WORKSTREAM_CONTROL_EVENT, a9 as PauseButton, aa as PausedState, ab as RestoredResources, ac as Root, ad as SendButton, ae as Status, af as Surface, ag as UseChatComposerControllerOptions, s as defaultChatComposerMessages, ah as useChatComposer, ai as useChatComposerController } from './composer-CVm5uoUI.js';
1
+ export { A as Actions, s as AttachButton, v as Attachments, w as ChatComposerContextValue, x as ChatComposerController, c as ChatComposerMessages, y as CommandPalette, z as ComposerActionsProps, B as ComposerAttachButtonProps, D as ComposerCommandPaletteProps, C as ComposerControlLinks, E as ComposerControlState, F as ComposerControlsProps, G as ComposerDelivery, H as ComposerDraftState, J as ComposerFooterProps, K as ComposerFrameProps, L as ComposerHintProps, M as ComposerInputProps, P as ComposerModelPickerProps, Q as ComposerPauseButtonProps, R as ComposerRootProps, V as ComposerSendButtonProps, W as ComposerSubmitBlocker, X as ComposerSubmitMode, Y as ComposerSurfaceProps, g as ComposerTranscriptionControl, a as ComposerTranscriptionControlProps, h as ComposerTranscriptionMessages, Z as Confirmation, _ as Controls, $ as Footer, a0 as Frame, a1 as Help, a2 as Hint, a3 as Input, a4 as ModelPicker, O as OPEN_WORKSTREAM_CONTROL_EVENT, a5 as PauseButton, a6 as PausedState, a7 as RestoredResources, a8 as Root, a9 as SendButton, aa as Status, ab as Surface, ac as UseChatComposerControllerOptions, q as defaultChatComposerMessages, ad as useChatComposer, ae as useChatComposerController } from './composer-DoC4veX1.js';
2
2
  import 'react/jsx-runtime';
3
3
  import 'react';
4
4
  import '@opengeni/sdk';
5
5
  import './session-context-rgrfElMl.js';
6
- import './use-composer-By1wn3MM.js';
6
+ import './use-composer-BnEzheSk.js';
7
+ import './use-file-attachments-C0kpHrs9.js';
package/dist/composer.js CHANGED
@@ -23,10 +23,11 @@ import {
23
23
  defaultChatComposerMessages,
24
24
  useChatComposer,
25
25
  useChatComposerController
26
- } from "./chunk-CATATY77.js";
26
+ } from "./chunk-TMH6HZWF.js";
27
27
  import "./chunk-TK7G6XLT.js";
28
- import "./chunk-UQS7OQDE.js";
29
- import "./chunk-I3BJZIG5.js";
28
+ import "./chunk-F4CFWKVI.js";
29
+ import "./chunk-HIWPQYWI.js";
30
+ import "./chunk-M7X4JZOD.js";
30
31
  export {
31
32
  Actions,
32
33
  AttachButton,
@@ -0,0 +1,241 @@
1
+ // src/timeline/fleet-decision-projection.ts
2
+ var FLEET_ACTUAL_OUTCOMES = ["selected", "waiting", "none"];
3
+ var FLEET_ACTUAL_REASONS = [
4
+ "lease_reused",
5
+ "pin",
6
+ "rotation",
7
+ "active",
8
+ "all_capped",
9
+ "none"
10
+ ];
11
+ var FLEET_SHADOW_OUTCOMES = ["selected", "paced", "none"];
12
+ var FLEET_SHADOW_REASONS = [
13
+ "fenced_in_flight",
14
+ "fenced_candidate_missing",
15
+ "admission_paced",
16
+ "no_eligible_candidate",
17
+ "overlay_isolated_empty",
18
+ "best_score",
19
+ "affinity_best",
20
+ "hysteresis_hold"
21
+ ];
22
+ var FLEET_COMPARISONS = [
23
+ "match",
24
+ "different_candidate",
25
+ "different_outcome",
26
+ "not_comparable_truncated"
27
+ ];
28
+ var FLEET_CONFIDENCES = ["unknown", "low", "medium", "high"];
29
+ var FLEET_ADMISSION_OUTCOMES = ["admit", "pace"];
30
+ var FLEET_ADMISSION_REASONS = [
31
+ "fenced_in_flight",
32
+ "pacing_disabled",
33
+ "capacity_unknown",
34
+ "capacity_available",
35
+ "work_conserving_borrow",
36
+ "manager_priority",
37
+ "standard_starvation_bound",
38
+ "capacity_saturated",
39
+ "emergency_fuse"
40
+ ];
41
+ var FLEET_ADMISSION_REASON_CLASSIFICATION = {
42
+ fenced_in_flight: "admit",
43
+ pacing_disabled: "admit",
44
+ capacity_unknown: "admit",
45
+ capacity_available: "admit",
46
+ work_conserving_borrow: "admit",
47
+ manager_priority: "pace",
48
+ standard_starvation_bound: "admit",
49
+ capacity_saturated: "pace",
50
+ emergency_fuse: "pace"
51
+ };
52
+ var FLEET_REJECTION_REASONS = [
53
+ "allocator_disabled",
54
+ "unavailable",
55
+ "cooling",
56
+ "quota_ceiling",
57
+ "overlay_isolation"
58
+ ];
59
+ var FLEET_MAX_CANDIDATES = 32;
60
+ var FLEET_MAX_COUNT = 1e6;
61
+ function fleetDecisionItem(event, payload) {
62
+ const actual = asRecord(payload.actual);
63
+ const replay = asRecord(payload.replay);
64
+ const input = asRecord(replay.input);
65
+ const decision = asRecord(replay.decision);
66
+ const admission = asRecord(decision.admission);
67
+ if (payload.schemaVersion !== 1 || payload.mode !== "shadow" || replay.schemaVersion !== 1 || replay.mode !== "shadow" || replay.policyVersion !== "adaptive-shadow-v1") {
68
+ return null;
69
+ }
70
+ const actualOutcome = fleetEnum(actual.outcome, FLEET_ACTUAL_OUTCOMES);
71
+ const actualReason = fleetEnum(actual.reason, FLEET_ACTUAL_REASONS);
72
+ const shadowOutcome = fleetEnum(decision.outcome, FLEET_SHADOW_OUTCOMES);
73
+ const shadowReason = fleetEnum(decision.reason, FLEET_SHADOW_REASONS);
74
+ const comparison = fleetEnum(payload.comparison, FLEET_COMPARISONS);
75
+ const confidence = fleetEnum(decision.confidence, FLEET_CONFIDENCES);
76
+ const admissionOutcome = fleetEnum(admission.outcome, FLEET_ADMISSION_OUTCOMES);
77
+ const admissionReason = fleetEnum(admission.reason, FLEET_ADMISSION_REASONS);
78
+ if (!actualOutcome || !actualReason || !shadowOutcome || !shadowReason || !comparison || !confidence || !admissionOutcome || !admissionReason) {
79
+ return null;
80
+ }
81
+ if (typeof admission.borrowedIdleCapacity !== "boolean" || typeof decision.borrowedOverlayCapacity !== "boolean") {
82
+ return null;
83
+ }
84
+ const actualCandidateKey = fleetCandidateKey(actual.candidateKey);
85
+ const shadowCandidateKey = fleetCandidateKey(decision.selectedCandidateKey);
86
+ if (actualCandidateKey === void 0 || shadowCandidateKey === void 0) {
87
+ return null;
88
+ }
89
+ if (actualOutcome === "selected" !== (actualCandidateKey !== null) || shadowOutcome === "selected" !== (shadowCandidateKey !== null)) {
90
+ return null;
91
+ }
92
+ const candidates = input.candidates;
93
+ if (!Array.isArray(candidates) || candidates.length > FLEET_MAX_CANDIDATES) {
94
+ return null;
95
+ }
96
+ const candidateKeys = /* @__PURE__ */ new Set();
97
+ for (const candidate of candidates) {
98
+ const key = asRecord(candidate).key;
99
+ if (!isFleetCandidateAlias(key) || candidateKeys.has(key)) {
100
+ return null;
101
+ }
102
+ candidateKeys.add(key);
103
+ }
104
+ const truncatedCandidateCount = fleetCount(replay.truncatedCandidateCount);
105
+ const strandedEligibleCount = fleetCount(decision.strandedEligibleCount);
106
+ if (truncatedCandidateCount === null || strandedEligibleCount === null || strandedEligibleCount > candidates.length || !fleetDecisionSemanticsAreConsistent({
107
+ actualOutcome,
108
+ actualReason,
109
+ shadowOutcome,
110
+ shadowReason,
111
+ admissionOutcome,
112
+ admissionReason,
113
+ borrowedIdleCapacity: admission.borrowedIdleCapacity,
114
+ borrowedOverlayCapacity: decision.borrowedOverlayCapacity,
115
+ strandedEligibleCount
116
+ })) {
117
+ return null;
118
+ }
119
+ if (shadowCandidateKey !== null && !candidateKeys.has(shadowCandidateKey)) {
120
+ return null;
121
+ }
122
+ if (actualCandidateKey !== null && !candidateKeys.has(actualCandidateKey) && !(comparison === "not_comparable_truncated" && truncatedCandidateCount > 0)) {
123
+ return null;
124
+ }
125
+ if (comparison === "not_comparable_truncated" && (truncatedCandidateCount === 0 || actualCandidateKey === null || candidateKeys.has(actualCandidateKey))) {
126
+ return null;
127
+ }
128
+ if (!fleetComparisonIsConsistent(
129
+ comparison,
130
+ actualOutcome,
131
+ actualCandidateKey,
132
+ shadowOutcome,
133
+ shadowCandidateKey
134
+ )) {
135
+ return null;
136
+ }
137
+ const rawScores = decision.scores;
138
+ if (!Array.isArray(rawScores)) {
139
+ return null;
140
+ }
141
+ const scores = [];
142
+ const scoreKeys = /* @__PURE__ */ new Set();
143
+ for (const value of rawScores.slice(0, FLEET_MAX_CANDIDATES)) {
144
+ const score = asRecord(value);
145
+ const candidateKey = score.candidateKey;
146
+ const parsedRejectionReason = score.rejectionReason === null ? null : fleetEnum(score.rejectionReason, FLEET_REJECTION_REASONS);
147
+ if (score.rejectionReason !== null && parsedRejectionReason === null) {
148
+ return null;
149
+ }
150
+ const rejectionReason = parsedRejectionReason;
151
+ const total = fleetFiniteNumber(score.total);
152
+ const scoreConfidence = fleetEnum(score.confidence, FLEET_CONFIDENCES);
153
+ if (!isFleetCandidateAlias(candidateKey) || !candidateKeys.has(candidateKey) || scoreKeys.has(candidateKey) || typeof score.eligible !== "boolean" || total === null || !scoreConfidence || (score.eligible ? rejectionReason !== null : rejectionReason === null)) {
154
+ return null;
155
+ }
156
+ scoreKeys.add(candidateKey);
157
+ scores.push({
158
+ candidateKey,
159
+ eligible: score.eligible,
160
+ rejectionReason,
161
+ total,
162
+ confidence: scoreConfidence
163
+ });
164
+ }
165
+ if (shadowCandidateKey !== null && !scoreKeys.has(shadowCandidateKey)) {
166
+ return null;
167
+ }
168
+ return {
169
+ kind: "fleet-decision",
170
+ id: event.id,
171
+ turnId: event.turnId ?? null,
172
+ policyVersion: "adaptive-shadow-v1",
173
+ actualOutcome,
174
+ actualCandidateKey,
175
+ actualReason,
176
+ shadowOutcome,
177
+ shadowCandidateKey,
178
+ shadowReason,
179
+ comparison,
180
+ confidence,
181
+ admissionOutcome,
182
+ admissionReason,
183
+ borrowedIdleCapacity: admission.borrowedIdleCapacity,
184
+ borrowedOverlayCapacity: decision.borrowedOverlayCapacity,
185
+ strandedEligibleCount,
186
+ candidateCount: candidates.length,
187
+ truncatedCandidateCount,
188
+ scoreRowsTruncatedCount: Math.max(0, rawScores.length - FLEET_MAX_CANDIDATES),
189
+ scores,
190
+ occurredAt: event.occurredAt
191
+ };
192
+ }
193
+ function fleetEnum(value, values) {
194
+ return typeof value === "string" && values.includes(value) ? value : null;
195
+ }
196
+ function isFleetCandidateAlias(value) {
197
+ return typeof value === "string" && /^c[0-9a-z]{2}$/.test(value);
198
+ }
199
+ function fleetCandidateKey(value) {
200
+ return value === null ? null : isFleetCandidateAlias(value) ? value : void 0;
201
+ }
202
+ function fleetCount(value) {
203
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 && value <= FLEET_MAX_COUNT ? value : null;
204
+ }
205
+ function fleetFiniteNumber(value) {
206
+ return typeof value === "number" && Number.isFinite(value) && Math.abs(value) <= Number.MAX_SAFE_INTEGER ? value : null;
207
+ }
208
+ function fleetComparisonIsConsistent(comparison, actualOutcome, actualCandidateKey, shadowOutcome, shadowCandidateKey) {
209
+ if (comparison === "not_comparable_truncated") {
210
+ return actualOutcome === "selected" && actualCandidateKey !== null;
211
+ }
212
+ const comparableActualOutcome = actualOutcome === "selected" ? "selected" : "none";
213
+ const comparableShadowOutcome = shadowOutcome === "selected" ? "selected" : "none";
214
+ if (comparison === "different_outcome") {
215
+ return comparableActualOutcome !== comparableShadowOutcome;
216
+ }
217
+ if (comparableActualOutcome !== comparableShadowOutcome) {
218
+ return false;
219
+ }
220
+ if (comparison === "different_candidate") {
221
+ return comparableActualOutcome === "selected" && actualCandidateKey !== shadowCandidateKey;
222
+ }
223
+ return comparableActualOutcome !== "selected" || actualCandidateKey === shadowCandidateKey;
224
+ }
225
+ function fleetDecisionSemanticsAreConsistent(input) {
226
+ const actualConsistent = input.actualOutcome === "selected" ? ["lease_reused", "pin", "rotation", "active"].includes(input.actualReason) : input.actualOutcome === "waiting" ? input.actualReason === "all_capped" : input.actualReason === "none";
227
+ const shadowConsistent = input.shadowOutcome === "selected" ? ["fenced_in_flight", "best_score", "affinity_best", "hysteresis_hold"].includes(
228
+ input.shadowReason
229
+ ) : input.shadowOutcome === "paced" ? input.shadowReason === "admission_paced" : ["fenced_candidate_missing", "no_eligible_candidate", "overlay_isolated_empty"].includes(
230
+ input.shadowReason
231
+ );
232
+ const pacedAdmissionReason = FLEET_ADMISSION_REASON_CLASSIFICATION[input.admissionReason] === "pace";
233
+ return actualConsistent && shadowConsistent && input.admissionOutcome === "pace" === pacedAdmissionReason && input.shadowOutcome === "paced" === (input.admissionOutcome === "pace") && input.borrowedIdleCapacity === (input.admissionReason === "work_conserving_borrow") && (!input.borrowedOverlayCapacity || input.shadowOutcome === "selected" && input.strandedEligibleCount === 0);
234
+ }
235
+ function asRecord(value) {
236
+ return value !== null && typeof value === "object" ? value : {};
237
+ }
238
+ export {
239
+ fleetDecisionItem as default
240
+ };
241
+ //# sourceMappingURL=fleet-decision-projection-SLNZMS42.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/timeline/fleet-decision-projection.ts"],"sourcesContent":["import type { SessionEvent } from \"@opengeni/sdk\";\nimport type { FleetDecisionItem, FleetDecisionScoreItem } from \"./types\";\n\nconst FLEET_ACTUAL_OUTCOMES = [\"selected\", \"waiting\", \"none\"] as const;\nconst FLEET_ACTUAL_REASONS = [\n \"lease_reused\",\n \"pin\",\n \"rotation\",\n \"active\",\n \"all_capped\",\n \"none\",\n] as const;\nconst FLEET_SHADOW_OUTCOMES = [\"selected\", \"paced\", \"none\"] as const;\nconst FLEET_SHADOW_REASONS = [\n \"fenced_in_flight\",\n \"fenced_candidate_missing\",\n \"admission_paced\",\n \"no_eligible_candidate\",\n \"overlay_isolated_empty\",\n \"best_score\",\n \"affinity_best\",\n \"hysteresis_hold\",\n] as const;\nconst FLEET_COMPARISONS = [\n \"match\",\n \"different_candidate\",\n \"different_outcome\",\n \"not_comparable_truncated\",\n] as const;\nconst FLEET_CONFIDENCES = [\"unknown\", \"low\", \"medium\", \"high\"] as const;\nconst FLEET_ADMISSION_OUTCOMES = [\"admit\", \"pace\"] as const;\nconst FLEET_ADMISSION_REASONS = [\n \"fenced_in_flight\",\n \"pacing_disabled\",\n \"capacity_unknown\",\n \"capacity_available\",\n \"work_conserving_borrow\",\n \"manager_priority\",\n \"standard_starvation_bound\",\n \"capacity_saturated\",\n \"emergency_fuse\",\n] as const;\ntype FleetAdmissionReason = (typeof FLEET_ADMISSION_REASONS)[number];\nconst FLEET_ADMISSION_REASON_CLASSIFICATION = {\n fenced_in_flight: \"admit\",\n pacing_disabled: \"admit\",\n capacity_unknown: \"admit\",\n capacity_available: \"admit\",\n work_conserving_borrow: \"admit\",\n manager_priority: \"pace\",\n standard_starvation_bound: \"admit\",\n capacity_saturated: \"pace\",\n emergency_fuse: \"pace\",\n} as const satisfies Record<FleetAdmissionReason, \"admit\" | \"pace\">;\nconst FLEET_REJECTION_REASONS = [\n \"allocator_disabled\",\n \"unavailable\",\n \"cooling\",\n \"quota_ceiling\",\n \"overlay_isolation\",\n] as const;\nconst FLEET_MAX_CANDIDATES = 32;\nconst FLEET_MAX_COUNT = 1_000_000;\n\n/**\n * Project the identity-free fleet event into the deliberately smaller UI\n * contract. This is a trust boundary: session event payloads are untyped, so\n * arbitrary strings (fingerprints, provider errors, future metadata) must never\n * become renderable copy. Only fixed enums and event-local aliases cross it.\n */\nexport default function fleetDecisionItem(\n event: SessionEvent,\n payload: Record<string, unknown>,\n): FleetDecisionItem | null {\n const actual = asRecord(payload.actual);\n const replay = asRecord(payload.replay);\n const input = asRecord(replay.input);\n const decision = asRecord(replay.decision);\n const admission = asRecord(decision.admission);\n if (\n payload.schemaVersion !== 1 ||\n payload.mode !== \"shadow\" ||\n replay.schemaVersion !== 1 ||\n replay.mode !== \"shadow\" ||\n replay.policyVersion !== \"adaptive-shadow-v1\"\n ) {\n return null;\n }\n\n const actualOutcome = fleetEnum(actual.outcome, FLEET_ACTUAL_OUTCOMES);\n const actualReason = fleetEnum(actual.reason, FLEET_ACTUAL_REASONS);\n const shadowOutcome = fleetEnum(decision.outcome, FLEET_SHADOW_OUTCOMES);\n const shadowReason = fleetEnum(decision.reason, FLEET_SHADOW_REASONS);\n const comparison = fleetEnum(payload.comparison, FLEET_COMPARISONS);\n const confidence = fleetEnum(decision.confidence, FLEET_CONFIDENCES);\n const admissionOutcome = fleetEnum(admission.outcome, FLEET_ADMISSION_OUTCOMES);\n const admissionReason = fleetEnum(admission.reason, FLEET_ADMISSION_REASONS);\n if (\n !actualOutcome ||\n !actualReason ||\n !shadowOutcome ||\n !shadowReason ||\n !comparison ||\n !confidence ||\n !admissionOutcome ||\n !admissionReason\n ) {\n return null;\n }\n if (\n typeof admission.borrowedIdleCapacity !== \"boolean\" ||\n typeof decision.borrowedOverlayCapacity !== \"boolean\"\n ) {\n return null;\n }\n\n const actualCandidateKey = fleetCandidateKey(actual.candidateKey);\n const shadowCandidateKey = fleetCandidateKey(decision.selectedCandidateKey);\n if (actualCandidateKey === undefined || shadowCandidateKey === undefined) {\n return null;\n }\n if (\n (actualOutcome === \"selected\") !== (actualCandidateKey !== null) ||\n (shadowOutcome === \"selected\") !== (shadowCandidateKey !== null)\n ) {\n return null;\n }\n\n const candidates = input.candidates;\n if (!Array.isArray(candidates) || candidates.length > FLEET_MAX_CANDIDATES) {\n return null;\n }\n const candidateKeys = new Set<string>();\n for (const candidate of candidates) {\n const key = asRecord(candidate).key;\n if (!isFleetCandidateAlias(key) || candidateKeys.has(key)) {\n return null;\n }\n candidateKeys.add(key);\n }\n\n const truncatedCandidateCount = fleetCount(replay.truncatedCandidateCount);\n const strandedEligibleCount = fleetCount(decision.strandedEligibleCount);\n if (\n truncatedCandidateCount === null ||\n strandedEligibleCount === null ||\n strandedEligibleCount > candidates.length ||\n !fleetDecisionSemanticsAreConsistent({\n actualOutcome,\n actualReason,\n shadowOutcome,\n shadowReason,\n admissionOutcome,\n admissionReason,\n borrowedIdleCapacity: admission.borrowedIdleCapacity,\n borrowedOverlayCapacity: decision.borrowedOverlayCapacity,\n strandedEligibleCount,\n })\n ) {\n return null;\n }\n if (shadowCandidateKey !== null && !candidateKeys.has(shadowCandidateKey)) {\n return null;\n }\n if (\n actualCandidateKey !== null &&\n !candidateKeys.has(actualCandidateKey) &&\n !(comparison === \"not_comparable_truncated\" && truncatedCandidateCount > 0)\n ) {\n return null;\n }\n if (\n comparison === \"not_comparable_truncated\" &&\n (truncatedCandidateCount === 0 ||\n actualCandidateKey === null ||\n candidateKeys.has(actualCandidateKey))\n ) {\n return null;\n }\n\n if (\n !fleetComparisonIsConsistent(\n comparison,\n actualOutcome,\n actualCandidateKey,\n shadowOutcome,\n shadowCandidateKey,\n )\n ) {\n return null;\n }\n\n const rawScores = decision.scores;\n if (!Array.isArray(rawScores)) {\n return null;\n }\n const scores: FleetDecisionScoreItem[] = [];\n const scoreKeys = new Set<string>();\n for (const value of rawScores.slice(0, FLEET_MAX_CANDIDATES)) {\n const score = asRecord(value);\n const candidateKey = score.candidateKey;\n const parsedRejectionReason =\n score.rejectionReason === null\n ? null\n : fleetEnum(score.rejectionReason, FLEET_REJECTION_REASONS);\n if (score.rejectionReason !== null && parsedRejectionReason === null) {\n return null;\n }\n const rejectionReason = parsedRejectionReason;\n const total = fleetFiniteNumber(score.total);\n const scoreConfidence = fleetEnum(score.confidence, FLEET_CONFIDENCES);\n if (\n !isFleetCandidateAlias(candidateKey) ||\n !candidateKeys.has(candidateKey) ||\n scoreKeys.has(candidateKey) ||\n typeof score.eligible !== \"boolean\" ||\n total === null ||\n !scoreConfidence ||\n (score.eligible ? rejectionReason !== null : rejectionReason === null)\n ) {\n return null;\n }\n scoreKeys.add(candidateKey);\n scores.push({\n candidateKey,\n eligible: score.eligible,\n rejectionReason,\n total,\n confidence: scoreConfidence,\n });\n }\n if (shadowCandidateKey !== null && !scoreKeys.has(shadowCandidateKey)) {\n return null;\n }\n\n return {\n kind: \"fleet-decision\",\n id: event.id,\n turnId: event.turnId ?? null,\n policyVersion: \"adaptive-shadow-v1\",\n actualOutcome,\n actualCandidateKey,\n actualReason,\n shadowOutcome,\n shadowCandidateKey,\n shadowReason,\n comparison,\n confidence,\n admissionOutcome,\n admissionReason,\n borrowedIdleCapacity: admission.borrowedIdleCapacity,\n borrowedOverlayCapacity: decision.borrowedOverlayCapacity,\n strandedEligibleCount,\n candidateCount: candidates.length,\n truncatedCandidateCount,\n scoreRowsTruncatedCount: Math.max(0, rawScores.length - FLEET_MAX_CANDIDATES),\n scores,\n occurredAt: event.occurredAt,\n };\n}\n\nfunction fleetEnum<const Values extends readonly string[]>(\n value: unknown,\n values: Values,\n): Values[number] | null {\n return typeof value === \"string\" && (values as readonly string[]).includes(value)\n ? (value as Values[number])\n : null;\n}\n\n/** c00..czz: ordinal aliases scoped to one event, never stable account ids. */\nfunction isFleetCandidateAlias(value: unknown): value is string {\n return typeof value === \"string\" && /^c[0-9a-z]{2}$/.test(value);\n}\n\n/** `undefined` denotes malformed; `null` is a valid no-selection value. */\nfunction fleetCandidateKey(value: unknown): string | null | undefined {\n return value === null ? null : isFleetCandidateAlias(value) ? value : undefined;\n}\n\nfunction fleetCount(value: unknown): number | null {\n return typeof value === \"number\" &&\n Number.isSafeInteger(value) &&\n value >= 0 &&\n value <= FLEET_MAX_COUNT\n ? value\n : null;\n}\n\nfunction fleetFiniteNumber(value: unknown): number | null {\n return typeof value === \"number\" &&\n Number.isFinite(value) &&\n Math.abs(value) <= Number.MAX_SAFE_INTEGER\n ? value\n : null;\n}\n\nfunction fleetComparisonIsConsistent(\n comparison: FleetDecisionItem[\"comparison\"],\n actualOutcome: FleetDecisionItem[\"actualOutcome\"],\n actualCandidateKey: string | null,\n shadowOutcome: FleetDecisionItem[\"shadowOutcome\"],\n shadowCandidateKey: string | null,\n): boolean {\n if (comparison === \"not_comparable_truncated\") {\n return actualOutcome === \"selected\" && actualCandidateKey !== null;\n }\n const comparableActualOutcome = actualOutcome === \"selected\" ? \"selected\" : \"none\";\n const comparableShadowOutcome = shadowOutcome === \"selected\" ? \"selected\" : \"none\";\n if (comparison === \"different_outcome\") {\n return comparableActualOutcome !== comparableShadowOutcome;\n }\n if (comparableActualOutcome !== comparableShadowOutcome) {\n return false;\n }\n if (comparison === \"different_candidate\") {\n return comparableActualOutcome === \"selected\" && actualCandidateKey !== shadowCandidateKey;\n }\n return comparableActualOutcome !== \"selected\" || actualCandidateKey === shadowCandidateKey;\n}\n\nfunction fleetDecisionSemanticsAreConsistent(input: {\n actualOutcome: FleetDecisionItem[\"actualOutcome\"];\n actualReason: FleetDecisionItem[\"actualReason\"];\n shadowOutcome: FleetDecisionItem[\"shadowOutcome\"];\n shadowReason: FleetDecisionItem[\"shadowReason\"];\n admissionOutcome: FleetDecisionItem[\"admissionOutcome\"];\n admissionReason: FleetDecisionItem[\"admissionReason\"];\n borrowedIdleCapacity: boolean;\n borrowedOverlayCapacity: boolean;\n strandedEligibleCount: number;\n}): boolean {\n const actualConsistent =\n input.actualOutcome === \"selected\"\n ? [\"lease_reused\", \"pin\", \"rotation\", \"active\"].includes(input.actualReason)\n : input.actualOutcome === \"waiting\"\n ? input.actualReason === \"all_capped\"\n : input.actualReason === \"none\";\n const shadowConsistent =\n input.shadowOutcome === \"selected\"\n ? [\"fenced_in_flight\", \"best_score\", \"affinity_best\", \"hysteresis_hold\"].includes(\n input.shadowReason,\n )\n : input.shadowOutcome === \"paced\"\n ? input.shadowReason === \"admission_paced\"\n : [\"fenced_candidate_missing\", \"no_eligible_candidate\", \"overlay_isolated_empty\"].includes(\n input.shadowReason,\n );\n // Keep this mapping exhaustive so a newly accepted admission reason cannot\n // silently be dropped from the paced/admitted event consistency check.\n const pacedAdmissionReason =\n FLEET_ADMISSION_REASON_CLASSIFICATION[input.admissionReason] === \"pace\";\n return (\n actualConsistent &&\n shadowConsistent &&\n (input.admissionOutcome === \"pace\") === pacedAdmissionReason &&\n (input.shadowOutcome === \"paced\") === (input.admissionOutcome === \"pace\") &&\n input.borrowedIdleCapacity === (input.admissionReason === \"work_conserving_borrow\") &&\n (!input.borrowedOverlayCapacity ||\n (input.shadowOutcome === \"selected\" && input.strandedEligibleCount === 0))\n );\n}\n\nfunction asRecord(value: unknown): Record<string, unknown> {\n return value !== null && typeof value === \"object\" ? (value as Record<string, unknown>) : {};\n}\n"],"mappings":";AAGA,IAAM,wBAAwB,CAAC,YAAY,WAAW,MAAM;AAC5D,IAAM,uBAAuB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,IAAM,wBAAwB,CAAC,YAAY,SAAS,MAAM;AAC1D,IAAM,uBAAuB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,IAAM,oBAAoB;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,IAAM,oBAAoB,CAAC,WAAW,OAAO,UAAU,MAAM;AAC7D,IAAM,2BAA2B,CAAC,SAAS,MAAM;AACjD,IAAM,0BAA0B;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAM,wCAAwC;AAAA,EAC5C,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,wBAAwB;AAAA,EACxB,kBAAkB;AAAA,EAClB,2BAA2B;AAAA,EAC3B,oBAAoB;AAAA,EACpB,gBAAgB;AAClB;AACA,IAAM,0BAA0B;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,IAAM,uBAAuB;AAC7B,IA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