@plasius/player-system-interface 0.1.4 → 0.1.6

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/README.md CHANGED
@@ -25,6 +25,7 @@ npm install @plasius/player-system-interface
25
25
  - focus panes and combat-safe reductions
26
26
  - world-space overlay panel definitions
27
27
  - target popup anchors and alert markers
28
+ - self-state and line-of-sight identity projection overlays
28
29
  - overlay accessibility contracts for keyboard, focus restoration, and announcements
29
30
  - frame-budget assumptions for diegetic panel updates
30
31
  - Party/System composition metadata
@@ -127,6 +128,41 @@ The inherited feature flag for this work is `isekai.player-system.interface.enab
127
128
  - Party and Player System surfaces can coexist in one shell definition
128
129
  - reduced-combat behavior is explicit per surface and bounded by the shell policy
129
130
 
131
+ ## Identity Status Overlays
132
+
133
+ `createIdentityStatusOverlayDefinition()` represents the Identity System's
134
+ self-state and explicit external target projections. The inherited feature
135
+ flag is `isekai.player-system.identity.enabled`.
136
+
137
+ - Self-state overlays use the `self-state` invocation and never require line of
138
+ sight.
139
+ - External overlays require an explicit `identity-sweep` or `spell-targeting`
140
+ invocation and line of sight.
141
+ - `allied`, `neutral`, `unknown`, and `unfriendly` are operational targeting
142
+ categories, not absolute moral truth labels.
143
+ - `readableFacts` must be a subset of `perceivableFacts`; use `partial`,
144
+ `fuzzy`, or `withheld` confidence when identity truth is incomplete.
145
+ - Add identity overlays to a shell with an `identity-overlay` surface and use
146
+ `assessIdentityStatusOverlayDefinition()` / `assessInterfaceShellDefinition()`
147
+ before rendering.
148
+
149
+ ## Shell State, 3D Panes, and Ambient Alerts
150
+
151
+ `createInterfaceShellState()` represents ambient, focused, and combat-safe
152
+ visibility without coupling the package to a renderer. Combat-safe state keeps
153
+ only retained surface kinds and never exposes suspended surfaces. Use
154
+ `applyInterfaceShellFocusShift()` for keyboard, direct-hotkey, restore, or
155
+ system focus changes; shifts to hidden surfaces are rejected.
156
+
157
+ `createThreeDPaneHostDefinition()` associates a pane with a shell surface,
158
+ world anchor, and supported host adapters. It describes the host boundary but
159
+ does not own rendering or scene orchestration.
160
+
161
+ `createLocalizedAmbientAlertDefinition()` stores an allowlisted locale-to-copy
162
+ map with an explicit live-region mode. Resolve the best available copy with
163
+ `resolveLocalizedAmbientAlertMessage()` and validate pane/alert composition with
164
+ `assessInterfaceShellDefinition()`.
165
+
130
166
  ## Governance
131
167
 
132
168
  - ADRs: [docs/adrs](./docs/adrs)
@@ -135,3 +171,4 @@ The inherited feature flag for this work is `isekai.player-system.interface.enab
135
171
  - Parent feature flag: `isekai.player-system.interface.enabled`
136
172
  - Capability: not required for package bootstrap; interface adoption remains feature-flag led
137
173
  - Rollback: disable `isekai.player-system.interface.enabled` to halt package-family adoption without changing package code
174
+ - Identity rollback: disable `isekai.player-system.identity.enabled` to stop identity projection adoption without changing package code
package/dist/index.cjs CHANGED
@@ -20,26 +20,34 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ PLAYER_SYSTEM_IDENTITY_FEATURE_FLAG_ID: () => PLAYER_SYSTEM_IDENTITY_FEATURE_FLAG_ID,
23
24
  PLAYER_SYSTEM_INTERFACE_ENV_PREFIX: () => PLAYER_SYSTEM_INTERFACE_ENV_PREFIX,
24
25
  PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID: () => PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID,
25
26
  PLAYER_SYSTEM_INTERFACE_PACKAGE: () => PLAYER_SYSTEM_INTERFACE_PACKAGE,
26
27
  PLAYER_SYSTEM_PACKAGES_FEATURE_FLAG_ID: () => PLAYER_SYSTEM_PACKAGES_FEATURE_FLAG_ID,
27
28
  PLAYER_SYSTEM_RUNTIME_NFR_FEATURE_FLAG_ID: () => PLAYER_SYSTEM_RUNTIME_NFR_FEATURE_FLAG_ID,
28
29
  PLAYER_SYSTEM_RUNTIME_PORTABILITY_FEATURE_FLAG_ID: () => PLAYER_SYSTEM_RUNTIME_PORTABILITY_FEATURE_FLAG_ID,
30
+ applyInterfaceShellFocusShift: () => applyInterfaceShellFocusShift,
31
+ assessIdentityStatusOverlayDefinition: () => assessIdentityStatusOverlayDefinition,
29
32
  assessInterfaceShellDefinition: () => assessInterfaceShellDefinition,
30
33
  assessPlayerSystemInterfaceComposition: () => assessPlayerSystemInterfaceComposition,
31
34
  createFocusPaneShellDefinition: () => createFocusPaneShellDefinition,
35
+ createIdentityStatusOverlayDefinition: () => createIdentityStatusOverlayDefinition,
32
36
  createInterfaceShellDefinition: () => createInterfaceShellDefinition,
37
+ createInterfaceShellState: () => createInterfaceShellState,
33
38
  createInterfaceShellSurfaceDefinition: () => createInterfaceShellSurfaceDefinition,
34
39
  createLineOfSightTargetPopupDefinition: () => createLineOfSightTargetPopupDefinition,
40
+ createLocalizedAmbientAlertDefinition: () => createLocalizedAmbientAlertDefinition,
35
41
  createPlayerSystemInterfaceContract: () => createPlayerSystemInterfaceContract,
36
42
  createPlayerSystemInterfacePortabilityContract: () => createPlayerSystemInterfacePortabilityContract,
43
+ createThreeDPaneHostDefinition: () => createThreeDPaneHostDefinition,
37
44
  createWorldSpacePanelDefinition: () => createWorldSpacePanelDefinition,
38
45
  defaultPlayerSystemInterfaceContract: () => defaultPlayerSystemInterfaceContract,
39
46
  defaultPlayerSystemInterfacePortabilityContract: () => defaultPlayerSystemInterfacePortabilityContract,
40
47
  defaultReducedCombatOverlayPolicy: () => defaultReducedCombatOverlayPolicy,
41
48
  isPlayerSystemInterfaceMode: () => isPlayerSystemInterfaceMode,
42
- packageDescriptor: () => packageDescriptor
49
+ packageDescriptor: () => packageDescriptor,
50
+ resolveLocalizedAmbientAlertMessage: () => resolveLocalizedAmbientAlertMessage
43
51
  });
44
52
  module.exports = __toCommonJS(index_exports);
45
53
  var PLAYER_SYSTEM_INTERFACE_PACKAGE = "@plasius/player-system-interface";
@@ -48,6 +56,7 @@ var PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID = "isekai.player-system.interface.en
48
56
  var PLAYER_SYSTEM_PACKAGES_FEATURE_FLAG_ID = PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID;
49
57
  var PLAYER_SYSTEM_RUNTIME_NFR_FEATURE_FLAG_ID = PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID;
50
58
  var PLAYER_SYSTEM_RUNTIME_PORTABILITY_FEATURE_FLAG_ID = PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID;
59
+ var PLAYER_SYSTEM_IDENTITY_FEATURE_FLAG_ID = "isekai.player-system.identity.enabled";
51
60
  var packageDescriptor = Object.freeze({
52
61
  packageName: PLAYER_SYSTEM_INTERFACE_PACKAGE,
53
62
  featureFlagId: PLAYER_SYSTEM_PACKAGES_FEATURE_FLAG_ID,
@@ -100,7 +109,8 @@ var defaultReducedCombatOverlayPolicy = Object.freeze({
100
109
  retainedSurfaceKinds: Object.freeze([
101
110
  "alert-marker",
102
111
  "target-popup",
103
- "focus-pane"
112
+ "focus-pane",
113
+ "identity-overlay"
104
114
  ]),
105
115
  maxInteractiveSurfaces: 1
106
116
  });
@@ -154,12 +164,34 @@ function createFocusPaneShellDefinition(input) {
154
164
  function createLineOfSightTargetPopupDefinition(input) {
155
165
  return Object.freeze({ ...input });
156
166
  }
167
+ function createIdentityStatusOverlayDefinition(input) {
168
+ return Object.freeze({
169
+ ...input,
170
+ perceivableFacts: Object.freeze([...input.perceivableFacts]),
171
+ readableFacts: Object.freeze([...input.readableFacts])
172
+ });
173
+ }
174
+ function createThreeDPaneHostDefinition(input) {
175
+ return Object.freeze({
176
+ ...input,
177
+ supportedHosts: Object.freeze([...input.supportedHosts])
178
+ });
179
+ }
180
+ function createLocalizedAmbientAlertDefinition(input) {
181
+ return Object.freeze({
182
+ ...input,
183
+ localizedMessages: Object.freeze({ ...input.localizedMessages })
184
+ });
185
+ }
157
186
  function createInterfaceShellDefinition(input = {}) {
158
187
  return Object.freeze({
159
188
  featureFlagId: input.featureFlagId ?? PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID,
160
189
  surfaces: Object.freeze([...input.surfaces ?? []]),
161
190
  focusPane: input.focusPane ? Object.freeze({ ...input.focusPane }) : void 0,
162
191
  targetPopups: Object.freeze([...input.targetPopups ?? []]),
192
+ identityOverlays: Object.freeze([...input.identityOverlays ?? []]),
193
+ paneHosts: Object.freeze([...input.paneHosts ?? []]),
194
+ ambientAlerts: Object.freeze([...input.ambientAlerts ?? []]),
163
195
  reducedCombat: Object.freeze({
164
196
  ...defaultReducedCombatOverlayPolicy,
165
197
  ...input.reducedCombat,
@@ -169,6 +201,73 @@ function createInterfaceShellDefinition(input = {}) {
169
201
  })
170
202
  });
171
203
  }
204
+ function createInterfaceShellState(shell, input) {
205
+ const retainedSurfaceKinds = new Set(
206
+ shell.reducedCombat.retainedSurfaceKinds
207
+ );
208
+ const visibleSurfaceIds = shell.surfaces.filter(
209
+ (surface) => input.mode !== "combat-safe" || surface.combatBehavior !== "suspend" && retainedSurfaceKinds.has(surface.kind)
210
+ ).map((surface) => surface.surfaceId);
211
+ if (input.focusedSurfaceId && !visibleSurfaceIds.includes(input.focusedSurfaceId)) {
212
+ throw new RangeError(
213
+ `Focused surface '${input.focusedSurfaceId}' is not visible in ${input.mode} mode`
214
+ );
215
+ }
216
+ return Object.freeze({
217
+ featureFlagId: shell.featureFlagId,
218
+ mode: input.mode,
219
+ focusedSurfaceId: input.mode === "focused" ? input.focusedSurfaceId : void 0,
220
+ visibleSurfaceIds: Object.freeze(visibleSurfaceIds)
221
+ });
222
+ }
223
+ function applyInterfaceShellFocusShift(state, focusShift) {
224
+ if (!state.visibleSurfaceIds.includes(focusShift.toSurfaceId)) {
225
+ throw new RangeError(
226
+ `Focused surface '${focusShift.toSurfaceId}' is not visible in ${state.mode} mode`
227
+ );
228
+ }
229
+ return Object.freeze({
230
+ ...state,
231
+ mode: "focused",
232
+ focusedSurfaceId: focusShift.toSurfaceId,
233
+ focusShift: Object.freeze({ ...focusShift })
234
+ });
235
+ }
236
+ function resolveLocalizedAmbientAlertMessage(alert, locale, fallbackLocale = "en-GB") {
237
+ return alert.localizedMessages[locale] ?? alert.localizedMessages[fallbackLocale];
238
+ }
239
+ function assessIdentityStatusOverlayDefinition(overlay) {
240
+ const violations = [];
241
+ const perceivableFacts = new Set(overlay.perceivableFacts);
242
+ if (overlay.readableFacts.some((fact) => !perceivableFacts.has(fact))) {
243
+ violations.push("readableFacts");
244
+ }
245
+ if (overlay.readConfidence === "withheld" && overlay.readableFacts.length > 0) {
246
+ violations.push("withheldRead");
247
+ }
248
+ if (overlay.targetKind === "self") {
249
+ if (overlay.relation !== "self") {
250
+ violations.push("selfRelation");
251
+ }
252
+ if (overlay.invocation !== "self-state") {
253
+ violations.push("selfInvocation");
254
+ }
255
+ if (overlay.requiresLineOfSight) {
256
+ violations.push("selfLineOfSight");
257
+ }
258
+ } else {
259
+ if (overlay.targetId.length === 0) {
260
+ violations.push("targetId");
261
+ }
262
+ if (!overlay.requiresLineOfSight) {
263
+ violations.push("lineOfSight");
264
+ }
265
+ }
266
+ return Object.freeze({
267
+ accepted: violations.length === 0,
268
+ violations: Object.freeze(violations)
269
+ });
270
+ }
172
271
  function assessPlayerSystemInterfaceComposition(sample, contract = defaultPlayerSystemInterfacePortabilityContract) {
173
272
  const violations = [];
174
273
  if (sample.panelCount > contract.compositionScale.maxWorldPanels) {
@@ -218,6 +317,31 @@ function assessInterfaceShellDefinition(shell) {
218
317
  violations.push(`popup:${popup.popupId}`);
219
318
  }
220
319
  }
320
+ for (const overlay of shell.identityOverlays) {
321
+ const identityAssessment = assessIdentityStatusOverlayDefinition(overlay);
322
+ for (const violation of identityAssessment.violations) {
323
+ violations.push(`identityOverlay:${overlay.overlayId}:${violation}`);
324
+ }
325
+ const matchingSurface = shell.surfaces.find(
326
+ (surface) => surface.surfaceId === overlay.surfaceId && surface.kind === "identity-overlay"
327
+ );
328
+ if (!matchingSurface) {
329
+ violations.push(`identityOverlaySurface:${overlay.overlayId}`);
330
+ }
331
+ }
332
+ for (const paneHost of shell.paneHosts) {
333
+ const matchingSurface = shell.surfaces.find(
334
+ (surface) => surface.surfaceId === paneHost.surfaceId && surface.owner === paneHost.owner && surface.anchorId === paneHost.anchorId
335
+ );
336
+ if (!matchingSurface) {
337
+ violations.push(`paneHost:${paneHost.hostId}`);
338
+ }
339
+ }
340
+ for (const alert of shell.ambientAlerts) {
341
+ if (Object.keys(alert.localizedMessages).length === 0) {
342
+ violations.push(`alert:${alert.alertId}`);
343
+ }
344
+ }
221
345
  if (ownerSet.has("player-system") && ownerSet.has("party-system") && shell.reducedCombat.retainedSurfaceKinds.length === 0) {
222
346
  violations.push("reducedCombat");
223
347
  }
@@ -228,25 +352,33 @@ function assessInterfaceShellDefinition(shell) {
228
352
  }
229
353
  // Annotate the CommonJS export names for ESM import in node:
230
354
  0 && (module.exports = {
355
+ PLAYER_SYSTEM_IDENTITY_FEATURE_FLAG_ID,
231
356
  PLAYER_SYSTEM_INTERFACE_ENV_PREFIX,
232
357
  PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID,
233
358
  PLAYER_SYSTEM_INTERFACE_PACKAGE,
234
359
  PLAYER_SYSTEM_PACKAGES_FEATURE_FLAG_ID,
235
360
  PLAYER_SYSTEM_RUNTIME_NFR_FEATURE_FLAG_ID,
236
361
  PLAYER_SYSTEM_RUNTIME_PORTABILITY_FEATURE_FLAG_ID,
362
+ applyInterfaceShellFocusShift,
363
+ assessIdentityStatusOverlayDefinition,
237
364
  assessInterfaceShellDefinition,
238
365
  assessPlayerSystemInterfaceComposition,
239
366
  createFocusPaneShellDefinition,
367
+ createIdentityStatusOverlayDefinition,
240
368
  createInterfaceShellDefinition,
369
+ createInterfaceShellState,
241
370
  createInterfaceShellSurfaceDefinition,
242
371
  createLineOfSightTargetPopupDefinition,
372
+ createLocalizedAmbientAlertDefinition,
243
373
  createPlayerSystemInterfaceContract,
244
374
  createPlayerSystemInterfacePortabilityContract,
375
+ createThreeDPaneHostDefinition,
245
376
  createWorldSpacePanelDefinition,
246
377
  defaultPlayerSystemInterfaceContract,
247
378
  defaultPlayerSystemInterfacePortabilityContract,
248
379
  defaultReducedCombatOverlayPolicy,
249
380
  isPlayerSystemInterfaceMode,
250
- packageDescriptor
381
+ packageDescriptor,
382
+ resolveLocalizedAmbientAlertMessage
251
383
  });
252
384
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export interface PackageDescriptor {\n readonly packageName: string;\n readonly featureFlagId: string;\n readonly envPrefix: string;\n readonly summary: string;\n}\n\nexport type OverlayKeyboardPath = \"sequential\" | \"direct-hotkey\" | \"read-only\";\n\nexport interface OverlayAccessibilityContract {\n readonly keyboardPath: OverlayKeyboardPath;\n readonly focusRestorationTarget: \"trigger\" | \"pane-heading\" | \"nearest-anchor\";\n readonly liveRegionMode: \"polite\" | \"assertive\" | \"off\";\n readonly requiresAccessibleName: boolean;\n}\n\nexport interface InterfaceFrameBudget {\n readonly targetFps: number;\n readonly maxFrameMs: number;\n readonly maxInteractivePanelsPerFrame: number;\n}\n\nexport type OverlayHostKind =\n | \"dom-overlay\"\n | \"native-overlay\"\n | \"headless-snapshot\";\n\nexport type OverlayAdapterCapability =\n | \"focus-restoration\"\n | \"live-region\"\n | \"anchor-registry\";\n\nexport interface OverlayHostAdapterContract {\n readonly supportedHosts: readonly OverlayHostKind[];\n readonly requiredCapabilities: readonly OverlayAdapterCapability[];\n readonly forbiddenAssumptions: readonly string[];\n}\n\nexport interface OverlayCompositionScaleContract {\n readonly maxWorldPanels: number;\n readonly maxFocusPanes: number;\n readonly maxAlertMarkers: number;\n readonly maxInteractivePanelsPerFrame: number;\n}\n\nexport interface PlayerSystemInterfaceContract {\n readonly featureFlagId: string;\n readonly accessibility: OverlayAccessibilityContract;\n readonly frameBudget: InterfaceFrameBudget;\n}\n\nexport interface PlayerSystemInterfacePortabilityContract {\n readonly featureFlagId: string;\n readonly hostAdapters: OverlayHostAdapterContract;\n readonly compositionScale: OverlayCompositionScaleContract;\n}\n\nexport interface PlayerSystemInterfaceContractInput {\n readonly featureFlagId?: string;\n readonly accessibility?: Partial<OverlayAccessibilityContract>;\n readonly frameBudget?: Partial<InterfaceFrameBudget>;\n}\n\nexport interface PlayerSystemInterfacePortabilityContractInput {\n readonly featureFlagId?: string;\n readonly hostAdapters?: Partial<OverlayHostAdapterContract>;\n readonly compositionScale?: Partial<OverlayCompositionScaleContract>;\n}\n\nexport type PlayerSystemInterfaceMode = \"ambient\" | \"focused\" | \"combat-safe\";\n\nexport type PlayerSystemPaneId =\n | \"identity\"\n | \"missions\"\n | \"guild-quests\"\n | \"logs\"\n | \"mcc\"\n | \"tutorial\"\n | \"points-store\";\n\nexport type InterfaceShellOwner = \"player-system\" | \"party-system\";\nexport type InterfaceShellSurfaceKind =\n | \"world-panel\"\n | \"focus-pane\"\n | \"target-popup\"\n | \"alert-marker\";\nexport type InterfaceCombatBehavior = \"persist\" | \"reduce\" | \"suspend\";\n\nexport interface InterfaceShellSurfaceDefinition {\n readonly surfaceId: string;\n readonly owner: InterfaceShellOwner;\n readonly kind: InterfaceShellSurfaceKind;\n readonly anchorId: string;\n readonly interactive: boolean;\n readonly priority: number;\n readonly combatBehavior: InterfaceCombatBehavior;\n}\n\nexport interface FocusPaneShellDefinition {\n readonly panelId: string;\n readonly owner: InterfaceShellOwner;\n readonly pane: PlayerSystemPaneId;\n readonly anchorId: string;\n readonly heading: string;\n readonly interactive: boolean;\n readonly combatBehavior: InterfaceCombatBehavior;\n}\n\nexport interface LineOfSightTargetPopupDefinition {\n readonly popupId: string;\n readonly owner: InterfaceShellOwner;\n readonly anchorId: string;\n readonly targetId: string;\n readonly summary: string;\n readonly requiresLineOfSight: boolean;\n readonly actionLabel?: string;\n}\n\nexport interface ReducedCombatOverlayPolicy {\n readonly featureFlagId: string;\n readonly mode: \"combat-safe\";\n readonly retainedSurfaceKinds: readonly InterfaceShellSurfaceKind[];\n readonly maxInteractiveSurfaces: number;\n}\n\nexport interface InterfaceShellDefinition {\n readonly featureFlagId: string;\n readonly surfaces: readonly InterfaceShellSurfaceDefinition[];\n readonly focusPane?: FocusPaneShellDefinition;\n readonly targetPopups: readonly LineOfSightTargetPopupDefinition[];\n readonly reducedCombat: ReducedCombatOverlayPolicy;\n}\n\nexport interface InterfaceShellDefinitionInput {\n readonly featureFlagId?: string;\n readonly surfaces?: readonly InterfaceShellSurfaceDefinition[];\n readonly focusPane?: FocusPaneShellDefinition;\n readonly targetPopups?: readonly LineOfSightTargetPopupDefinition[];\n readonly reducedCombat?: Partial<ReducedCombatOverlayPolicy>;\n}\n\nexport interface WorldSpacePanelDefinition {\n readonly panelId: string;\n readonly pane: PlayerSystemPaneId;\n readonly anchorId: string;\n readonly interactive: boolean;\n readonly accessibilityLabel?: string;\n readonly focusOrder?: number;\n}\n\nexport interface OverlayAlertMarker {\n readonly markerId: string;\n readonly severity: \"info\" | \"warning\" | \"danger\";\n readonly anchorId: string;\n}\n\nexport interface WorldSpaceCompositionSample {\n readonly panelCount: number;\n readonly focusPaneCount: number;\n readonly alertMarkerCount: number;\n readonly interactivePanelCount: number;\n}\n\nexport interface InterfaceContractAssessment {\n readonly accepted: boolean;\n readonly violations: readonly string[];\n}\n\nexport const PLAYER_SYSTEM_INTERFACE_PACKAGE = \"@plasius/player-system-interface\";\nexport const PLAYER_SYSTEM_INTERFACE_ENV_PREFIX = \"PLAYER_SYSTEM_INTERFACE\";\nexport const PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID =\n \"isekai.player-system.interface.enabled\";\nexport const PLAYER_SYSTEM_PACKAGES_FEATURE_FLAG_ID =\n PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID;\nexport const PLAYER_SYSTEM_RUNTIME_NFR_FEATURE_FLAG_ID =\n PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID;\nexport const PLAYER_SYSTEM_RUNTIME_PORTABILITY_FEATURE_FLAG_ID =\n PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID;\n\nexport const packageDescriptor: PackageDescriptor = Object.freeze({\n packageName: PLAYER_SYSTEM_INTERFACE_PACKAGE,\n featureFlagId: PLAYER_SYSTEM_PACKAGES_FEATURE_FLAG_ID,\n envPrefix: PLAYER_SYSTEM_INTERFACE_ENV_PREFIX,\n summary:\n \"World-space Player System overlays, focus panes, and target-surface contracts for Plasius game experiences.\",\n});\n\nexport const defaultPlayerSystemInterfaceContract: PlayerSystemInterfaceContract =\n Object.freeze({\n featureFlagId: PLAYER_SYSTEM_RUNTIME_NFR_FEATURE_FLAG_ID,\n accessibility: Object.freeze({\n keyboardPath: \"sequential\",\n focusRestorationTarget: \"trigger\",\n liveRegionMode: \"polite\",\n requiresAccessibleName: true,\n }),\n frameBudget: Object.freeze({\n targetFps: 60,\n maxFrameMs: 16,\n maxInteractivePanelsPerFrame: 2,\n }),\n });\n\nexport const defaultPlayerSystemInterfacePortabilityContract: PlayerSystemInterfacePortabilityContract =\n Object.freeze({\n featureFlagId: PLAYER_SYSTEM_RUNTIME_PORTABILITY_FEATURE_FLAG_ID,\n hostAdapters: Object.freeze({\n supportedHosts: Object.freeze([\n \"dom-overlay\",\n \"native-overlay\",\n \"headless-snapshot\",\n ] satisfies OverlayHostKind[]),\n requiredCapabilities: Object.freeze([\n \"focus-restoration\",\n \"live-region\",\n \"anchor-registry\",\n ] satisfies OverlayAdapterCapability[]),\n forbiddenAssumptions: Object.freeze([\n \"window-global\",\n \"single-pane-layout\",\n \"absolute-scene-coordinates\",\n ]),\n }),\n compositionScale: Object.freeze({\n maxWorldPanels: 6,\n maxFocusPanes: 3,\n maxAlertMarkers: 8,\n maxInteractivePanelsPerFrame: 2,\n }),\n });\n\nexport const defaultReducedCombatOverlayPolicy: ReducedCombatOverlayPolicy =\n Object.freeze({\n featureFlagId: PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID,\n mode: \"combat-safe\",\n retainedSurfaceKinds: Object.freeze([\n \"alert-marker\",\n \"target-popup\",\n \"focus-pane\",\n ] satisfies InterfaceShellSurfaceKind[]),\n maxInteractiveSurfaces: 1,\n });\n\nexport function isPlayerSystemInterfaceMode(\n value: string\n): value is PlayerSystemInterfaceMode {\n return value === \"ambient\" || value === \"focused\" || value === \"combat-safe\";\n}\n\nexport function createWorldSpacePanelDefinition(\n input: WorldSpacePanelDefinition\n): WorldSpacePanelDefinition {\n return Object.freeze({ ...input });\n}\n\nexport function createPlayerSystemInterfaceContract(\n input: PlayerSystemInterfaceContractInput = {}\n): PlayerSystemInterfaceContract {\n return Object.freeze({\n featureFlagId:\n input.featureFlagId ?? defaultPlayerSystemInterfaceContract.featureFlagId,\n accessibility: Object.freeze({\n ...defaultPlayerSystemInterfaceContract.accessibility,\n ...input.accessibility,\n }),\n frameBudget: Object.freeze({\n ...defaultPlayerSystemInterfaceContract.frameBudget,\n ...input.frameBudget,\n }),\n });\n}\n\nexport function createPlayerSystemInterfacePortabilityContract(\n input: PlayerSystemInterfacePortabilityContractInput = {}\n): PlayerSystemInterfacePortabilityContract {\n return Object.freeze({\n featureFlagId:\n input.featureFlagId ??\n defaultPlayerSystemInterfacePortabilityContract.featureFlagId,\n hostAdapters: Object.freeze({\n ...defaultPlayerSystemInterfacePortabilityContract.hostAdapters,\n ...input.hostAdapters,\n supportedHosts: Object.freeze([\n ...(input.hostAdapters?.supportedHosts ??\n defaultPlayerSystemInterfacePortabilityContract.hostAdapters\n .supportedHosts),\n ]),\n requiredCapabilities: Object.freeze([\n ...(input.hostAdapters?.requiredCapabilities ??\n defaultPlayerSystemInterfacePortabilityContract.hostAdapters\n .requiredCapabilities),\n ]),\n forbiddenAssumptions: Object.freeze([\n ...(input.hostAdapters?.forbiddenAssumptions ??\n defaultPlayerSystemInterfacePortabilityContract.hostAdapters\n .forbiddenAssumptions),\n ]),\n }),\n compositionScale: Object.freeze({\n ...defaultPlayerSystemInterfacePortabilityContract.compositionScale,\n ...input.compositionScale,\n }),\n });\n}\n\nexport function createInterfaceShellSurfaceDefinition(\n input: InterfaceShellSurfaceDefinition\n): InterfaceShellSurfaceDefinition {\n return Object.freeze({ ...input });\n}\n\nexport function createFocusPaneShellDefinition(\n input: FocusPaneShellDefinition\n): FocusPaneShellDefinition {\n return Object.freeze({ ...input });\n}\n\nexport function createLineOfSightTargetPopupDefinition(\n input: LineOfSightTargetPopupDefinition\n): LineOfSightTargetPopupDefinition {\n return Object.freeze({ ...input });\n}\n\nexport function createInterfaceShellDefinition(\n input: InterfaceShellDefinitionInput = {}\n): InterfaceShellDefinition {\n return Object.freeze({\n featureFlagId: input.featureFlagId ?? PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID,\n surfaces: Object.freeze([...(input.surfaces ?? [])]),\n focusPane: input.focusPane ? Object.freeze({ ...input.focusPane }) : undefined,\n targetPopups: Object.freeze([...(input.targetPopups ?? [])]),\n reducedCombat: Object.freeze({\n ...defaultReducedCombatOverlayPolicy,\n ...input.reducedCombat,\n retainedSurfaceKinds: Object.freeze([\n ...(input.reducedCombat?.retainedSurfaceKinds ??\n defaultReducedCombatOverlayPolicy.retainedSurfaceKinds),\n ]),\n }),\n });\n}\n\nexport function assessPlayerSystemInterfaceComposition(\n sample: WorldSpaceCompositionSample,\n contract: PlayerSystemInterfacePortabilityContract = defaultPlayerSystemInterfacePortabilityContract\n): InterfaceContractAssessment {\n const violations: string[] = [];\n\n if (sample.panelCount > contract.compositionScale.maxWorldPanels) {\n violations.push(\"panelCount\");\n }\n\n if (sample.focusPaneCount > contract.compositionScale.maxFocusPanes) {\n violations.push(\"focusPaneCount\");\n }\n\n if (sample.alertMarkerCount > contract.compositionScale.maxAlertMarkers) {\n violations.push(\"alertMarkerCount\");\n }\n\n if (\n sample.interactivePanelCount >\n contract.compositionScale.maxInteractivePanelsPerFrame\n ) {\n violations.push(\"interactivePanelCount\");\n }\n\n return Object.freeze({\n accepted: violations.length === 0,\n violations: Object.freeze(violations),\n });\n}\n\nexport function assessInterfaceShellDefinition(\n shell: InterfaceShellDefinition\n): InterfaceContractAssessment {\n const violations: string[] = [];\n const ownerSet = new Set(shell.surfaces.map((surface) => surface.owner));\n const retainedSurfaceKinds = new Set(shell.reducedCombat.retainedSurfaceKinds);\n const interactiveSurfaceCount = shell.surfaces.filter(\n (surface) => surface.interactive && retainedSurfaceKinds.has(surface.kind)\n ).length;\n const focusPane = shell.focusPane;\n\n if (shell.surfaces.length === 0) {\n violations.push(\"surfaces\");\n }\n\n if (focusPane && !ownerSet.has(focusPane.owner)) {\n violations.push(\"focusPaneOwner\");\n }\n\n if (focusPane) {\n const matchingSurface = shell.surfaces.find(\n (surface) =>\n surface.kind === \"focus-pane\" &&\n surface.anchorId === focusPane.anchorId &&\n surface.owner === focusPane.owner\n );\n if (!matchingSurface) {\n violations.push(\"focusPaneSurface\");\n }\n }\n\n if (\n interactiveSurfaceCount > shell.reducedCombat.maxInteractiveSurfaces\n ) {\n violations.push(\"interactiveSurfaceCount\");\n }\n\n for (const popup of shell.targetPopups) {\n if (popup.requiresLineOfSight && popup.anchorId.length === 0) {\n violations.push(`popup:${popup.popupId}`);\n }\n }\n\n if (\n ownerSet.has(\"player-system\") &&\n ownerSet.has(\"party-system\") &&\n shell.reducedCombat.retainedSurfaceKinds.length === 0\n ) {\n violations.push(\"reducedCombat\");\n }\n\n return Object.freeze({\n accepted: violations.length === 0,\n violations: Object.freeze(violations),\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwKO,IAAM,kCAAkC;AACxC,IAAM,qCAAqC;AAC3C,IAAM,0CACX;AACK,IAAM,yCACX;AACK,IAAM,4CACX;AACK,IAAM,oDACX;AAEK,IAAM,oBAAuC,OAAO,OAAO;AAAA,EAChE,aAAa;AAAA,EACb,eAAe;AAAA,EACf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;AAExB,MAAI,MAAM,SAAS,WAAW,GAAG;AAC/B,eAAW,KAAK,UAAU;AAAA,EAC5B;AAEA,MAAI,aAAa,CAAC,SAAS,IAAI,UAAU,KAAK,GAAG;AAC/C,eAAW,KAAK,gBAAgB;AAAA,EAClC;AAEA,MAAI,WAAW;AACb,UAAM,kBAAkB,MAAM,SAAS;AAAA,MACrC,CAAC,YACC,QAAQ,SAAS,gBACjB,QAAQ,aAAa,UAAU,YAC/B,QAAQ,UAAU,UAAU;AAAA,IAChC;AACA,QAAI,CAAC,iBAAiB;AACpB,iBAAW,KAAK,kBAAkB;AAAA,IACpC;AAAA,EACF;AAEA,MACE,0BAA0B,MAAM,cAAc,wBAC9C;AACA,eAAW,KAAK,yBAAyB;AAAA,EAC3C;AAEA,aAAW,SAAS,MAAM,cAAc;AACtC,QAAI,MAAM,uBAAuB,MAAM,SAAS,WAAW,GAAG;AAC5D,iBAAW,KAAK,SAAS,MAAM,OAAO,EAAE;AAAA,IAC1C;AAAA,EACF;AAEA,MACE,SAAS,IAAI,eAAe,KAC5B,SAAS,IAAI,cAAc,KAC3B,MAAM,cAAc,qBAAqB,WAAW,GACpD;AACA,eAAW,KAAK,eAAe;AAAA,EACjC;AAEA,SAAO,OAAO,OAAO;AAAA,IACnB,UAAU,WAAW,WAAW;AAAA,IAChC,YAAY,OAAO,OAAO,UAAU;AAAA,EACtC,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export interface PackageDescriptor {\n readonly packageName: string;\n readonly featureFlagId: string;\n readonly envPrefix: string;\n readonly summary: string;\n}\n\nexport type OverlayKeyboardPath = \"sequential\" | \"direct-hotkey\" | \"read-only\";\n\nexport interface OverlayAccessibilityContract {\n readonly keyboardPath: OverlayKeyboardPath;\n readonly focusRestorationTarget: \"trigger\" | \"pane-heading\" | \"nearest-anchor\";\n readonly liveRegionMode: \"polite\" | \"assertive\" | \"off\";\n readonly requiresAccessibleName: boolean;\n}\n\nexport interface InterfaceFrameBudget {\n readonly targetFps: number;\n readonly maxFrameMs: number;\n readonly maxInteractivePanelsPerFrame: number;\n}\n\nexport type OverlayHostKind =\n | \"dom-overlay\"\n | \"native-overlay\"\n | \"headless-snapshot\";\n\nexport type OverlayAdapterCapability =\n | \"focus-restoration\"\n | \"live-region\"\n | \"anchor-registry\";\n\nexport interface OverlayHostAdapterContract {\n readonly supportedHosts: readonly OverlayHostKind[];\n readonly requiredCapabilities: readonly OverlayAdapterCapability[];\n readonly forbiddenAssumptions: readonly string[];\n}\n\nexport interface OverlayCompositionScaleContract {\n readonly maxWorldPanels: number;\n readonly maxFocusPanes: number;\n readonly maxAlertMarkers: number;\n readonly maxInteractivePanelsPerFrame: number;\n}\n\nexport interface PlayerSystemInterfaceContract {\n readonly featureFlagId: string;\n readonly accessibility: OverlayAccessibilityContract;\n readonly frameBudget: InterfaceFrameBudget;\n}\n\nexport interface PlayerSystemInterfacePortabilityContract {\n readonly featureFlagId: string;\n readonly hostAdapters: OverlayHostAdapterContract;\n readonly compositionScale: OverlayCompositionScaleContract;\n}\n\nexport interface PlayerSystemInterfaceContractInput {\n readonly featureFlagId?: string;\n readonly accessibility?: Partial<OverlayAccessibilityContract>;\n readonly frameBudget?: Partial<InterfaceFrameBudget>;\n}\n\nexport interface PlayerSystemInterfacePortabilityContractInput {\n readonly featureFlagId?: string;\n readonly hostAdapters?: Partial<OverlayHostAdapterContract>;\n readonly compositionScale?: Partial<OverlayCompositionScaleContract>;\n}\n\nexport type PlayerSystemInterfaceMode = \"ambient\" | \"focused\" | \"combat-safe\";\n\nexport type PlayerSystemPaneId =\n | \"identity\"\n | \"missions\"\n | \"guild-quests\"\n | \"logs\"\n | \"mcc\"\n | \"tutorial\"\n | \"points-store\";\n\nexport type InterfaceShellOwner = \"player-system\" | \"party-system\";\nexport type InterfaceShellSurfaceKind =\n | \"world-panel\"\n | \"focus-pane\"\n | \"target-popup\"\n | \"alert-marker\"\n | \"identity-overlay\";\nexport type InterfaceCombatBehavior = \"persist\" | \"reduce\" | \"suspend\";\n\nexport type IdentityProjectionRelation =\n | \"self\"\n | \"allied\"\n | \"neutral\"\n | \"unknown\"\n | \"unfriendly\";\nexport type IdentityProjectionInvocation =\n | \"self-state\"\n | \"identity-sweep\"\n | \"spell-targeting\";\nexport type IdentityProjectionReadConfidence =\n | \"complete\"\n | \"partial\"\n | \"fuzzy\"\n | \"withheld\";\nexport type IdentityProjectionPresentation = \"full\" | \"condensed\";\nexport type IdentityProjectionFact =\n | \"display-name\"\n | \"relation\"\n | \"health-band\"\n | \"status-summary\"\n | \"threat-band\"\n | \"targeting-affordance\";\n\nexport interface IdentityStatusOverlayBaseDefinition {\n readonly overlayId: string;\n readonly surfaceId: string;\n readonly readConfidence: IdentityProjectionReadConfidence;\n readonly perceivableFacts: readonly IdentityProjectionFact[];\n readonly readableFacts: readonly IdentityProjectionFact[];\n readonly presentation: IdentityProjectionPresentation;\n}\n\nexport interface IdentitySelfStateOverlayDefinition\n extends IdentityStatusOverlayBaseDefinition {\n readonly targetKind: \"self\";\n readonly relation: \"self\";\n readonly invocation: \"self-state\";\n readonly requiresLineOfSight: false;\n readonly targetId?: never;\n}\n\nexport interface IdentityTargetProjectionOverlayDefinition\n extends IdentityStatusOverlayBaseDefinition {\n readonly targetKind: \"external\";\n readonly targetId: string;\n readonly relation: Exclude<IdentityProjectionRelation, \"self\">;\n readonly invocation: Exclude<IdentityProjectionInvocation, \"self-state\">;\n readonly requiresLineOfSight: true;\n}\n\nexport type IdentityStatusOverlayDefinition =\n | IdentitySelfStateOverlayDefinition\n | IdentityTargetProjectionOverlayDefinition;\n\nexport interface InterfaceShellSurfaceDefinition {\n readonly surfaceId: string;\n readonly owner: InterfaceShellOwner;\n readonly kind: InterfaceShellSurfaceKind;\n readonly anchorId: string;\n readonly interactive: boolean;\n readonly priority: number;\n readonly combatBehavior: InterfaceCombatBehavior;\n}\n\nexport interface FocusPaneShellDefinition {\n readonly panelId: string;\n readonly owner: InterfaceShellOwner;\n readonly pane: PlayerSystemPaneId;\n readonly anchorId: string;\n readonly heading: string;\n readonly interactive: boolean;\n readonly combatBehavior: InterfaceCombatBehavior;\n}\n\nexport interface LineOfSightTargetPopupDefinition {\n readonly popupId: string;\n readonly owner: InterfaceShellOwner;\n readonly anchorId: string;\n readonly targetId: string;\n readonly summary: string;\n readonly requiresLineOfSight: boolean;\n readonly actionLabel?: string;\n}\n\nexport interface ReducedCombatOverlayPolicy {\n readonly featureFlagId: string;\n readonly mode: \"combat-safe\";\n readonly retainedSurfaceKinds: readonly InterfaceShellSurfaceKind[];\n readonly maxInteractiveSurfaces: number;\n}\n\nexport interface InterfaceShellDefinition {\n readonly featureFlagId: string;\n readonly surfaces: readonly InterfaceShellSurfaceDefinition[];\n readonly focusPane?: FocusPaneShellDefinition;\n readonly targetPopups: readonly LineOfSightTargetPopupDefinition[];\n readonly identityOverlays: readonly IdentityStatusOverlayDefinition[];\n readonly paneHosts: readonly ThreeDPaneHostDefinition[];\n readonly ambientAlerts: readonly LocalizedAmbientAlertDefinition[];\n readonly reducedCombat: ReducedCombatOverlayPolicy;\n}\n\nexport interface InterfaceShellDefinitionInput {\n readonly featureFlagId?: string;\n readonly surfaces?: readonly InterfaceShellSurfaceDefinition[];\n readonly focusPane?: FocusPaneShellDefinition;\n readonly targetPopups?: readonly LineOfSightTargetPopupDefinition[];\n readonly identityOverlays?: readonly IdentityStatusOverlayDefinition[];\n readonly paneHosts?: readonly ThreeDPaneHostDefinition[];\n readonly ambientAlerts?: readonly LocalizedAmbientAlertDefinition[];\n readonly reducedCombat?: Partial<ReducedCombatOverlayPolicy>;\n}\n\nexport type InterfaceFocusShiftReason =\n | \"keyboard\"\n | \"direct-hotkey\"\n | \"restore\"\n | \"system\";\n\nexport interface InterfaceFocusShift {\n readonly fromSurfaceId?: string;\n readonly toSurfaceId: string;\n readonly reason: InterfaceFocusShiftReason;\n}\n\nexport interface InterfaceShellStateDefinition {\n readonly featureFlagId: string;\n readonly mode: PlayerSystemInterfaceMode;\n readonly focusedSurfaceId?: string;\n readonly visibleSurfaceIds: readonly string[];\n readonly focusShift?: InterfaceFocusShift;\n}\n\nexport interface InterfaceShellStateInput {\n readonly mode: PlayerSystemInterfaceMode;\n readonly focusedSurfaceId?: string;\n}\n\nexport interface ThreeDPaneHostDefinition {\n readonly hostId: string;\n readonly owner: InterfaceShellOwner;\n readonly pane: PlayerSystemPaneId;\n readonly surfaceId: string;\n readonly anchorId: string;\n readonly supportedHosts: readonly OverlayHostKind[];\n}\n\nexport type AmbientAlertSeverity = \"info\" | \"warning\" | \"danger\";\n\nexport interface LocalizedAmbientAlertDefinition {\n readonly alertId: string;\n readonly owner: InterfaceShellOwner;\n readonly severity: AmbientAlertSeverity;\n readonly anchorId: string;\n readonly messageKey: string;\n readonly localizedMessages: Readonly<Record<string, string>>;\n readonly liveRegionMode: \"polite\" | \"assertive\";\n}\n\nexport interface WorldSpacePanelDefinition {\n readonly panelId: string;\n readonly pane: PlayerSystemPaneId;\n readonly anchorId: string;\n readonly interactive: boolean;\n readonly accessibilityLabel?: string;\n readonly focusOrder?: number;\n}\n\nexport interface OverlayAlertMarker {\n readonly markerId: string;\n readonly severity: AmbientAlertSeverity;\n readonly anchorId: string;\n}\n\nexport interface WorldSpaceCompositionSample {\n readonly panelCount: number;\n readonly focusPaneCount: number;\n readonly alertMarkerCount: number;\n readonly interactivePanelCount: number;\n}\n\nexport interface InterfaceContractAssessment {\n readonly accepted: boolean;\n readonly violations: readonly string[];\n}\n\nexport const PLAYER_SYSTEM_INTERFACE_PACKAGE = \"@plasius/player-system-interface\";\nexport const PLAYER_SYSTEM_INTERFACE_ENV_PREFIX = \"PLAYER_SYSTEM_INTERFACE\";\nexport const PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID =\n \"isekai.player-system.interface.enabled\";\nexport const PLAYER_SYSTEM_PACKAGES_FEATURE_FLAG_ID =\n PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID;\nexport const PLAYER_SYSTEM_RUNTIME_NFR_FEATURE_FLAG_ID =\n PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID;\nexport const PLAYER_SYSTEM_RUNTIME_PORTABILITY_FEATURE_FLAG_ID =\n PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID;\nexport const PLAYER_SYSTEM_IDENTITY_FEATURE_FLAG_ID =\n \"isekai.player-system.identity.enabled\";\n\nexport const packageDescriptor: PackageDescriptor = Object.freeze({\n packageName: PLAYER_SYSTEM_INTERFACE_PACKAGE,\n featureFlagId: PLAYER_SYSTEM_PACKAGES_FEATURE_FLAG_ID,\n envPrefix: PLAYER_SYSTEM_INTERFACE_ENV_PREFIX,\n summary:\n \"World-space Player System overlays, focus panes, and target-surface contracts for Plasius game experiences.\",\n});\n\nexport const defaultPlayerSystemInterfaceContract: PlayerSystemInterfaceContract =\n Object.freeze({\n featureFlagId: PLAYER_SYSTEM_RUNTIME_NFR_FEATURE_FLAG_ID,\n accessibility: Object.freeze({\n keyboardPath: \"sequential\",\n focusRestorationTarget: \"trigger\",\n liveRegionMode: \"polite\",\n requiresAccessibleName: true,\n }),\n frameBudget: Object.freeze({\n targetFps: 60,\n maxFrameMs: 16,\n maxInteractivePanelsPerFrame: 2,\n }),\n });\n\nexport const defaultPlayerSystemInterfacePortabilityContract: PlayerSystemInterfacePortabilityContract =\n Object.freeze({\n featureFlagId: PLAYER_SYSTEM_RUNTIME_PORTABILITY_FEATURE_FLAG_ID,\n hostAdapters: Object.freeze({\n supportedHosts: Object.freeze([\n \"dom-overlay\",\n \"native-overlay\",\n \"headless-snapshot\",\n ] satisfies OverlayHostKind[]),\n requiredCapabilities: Object.freeze([\n \"focus-restoration\",\n \"live-region\",\n \"anchor-registry\",\n ] satisfies OverlayAdapterCapability[]),\n forbiddenAssumptions: Object.freeze([\n \"window-global\",\n \"single-pane-layout\",\n \"absolute-scene-coordinates\",\n ]),\n }),\n compositionScale: Object.freeze({\n maxWorldPanels: 6,\n maxFocusPanes: 3,\n maxAlertMarkers: 8,\n maxInteractivePanelsPerFrame: 2,\n }),\n });\n\nexport const defaultReducedCombatOverlayPolicy: ReducedCombatOverlayPolicy =\n Object.freeze({\n featureFlagId: PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID,\n mode: \"combat-safe\",\n retainedSurfaceKinds: Object.freeze([\n \"alert-marker\",\n \"target-popup\",\n \"focus-pane\",\n \"identity-overlay\",\n ] satisfies InterfaceShellSurfaceKind[]),\n maxInteractiveSurfaces: 1,\n });\n\nexport function isPlayerSystemInterfaceMode(\n value: string\n): value is PlayerSystemInterfaceMode {\n return value === \"ambient\" || value === \"focused\" || value === \"combat-safe\";\n}\n\nexport function createWorldSpacePanelDefinition(\n input: WorldSpacePanelDefinition\n): WorldSpacePanelDefinition {\n return Object.freeze({ ...input });\n}\n\nexport function createPlayerSystemInterfaceContract(\n input: PlayerSystemInterfaceContractInput = {}\n): PlayerSystemInterfaceContract {\n return Object.freeze({\n featureFlagId:\n input.featureFlagId ?? defaultPlayerSystemInterfaceContract.featureFlagId,\n accessibility: Object.freeze({\n ...defaultPlayerSystemInterfaceContract.accessibility,\n ...input.accessibility,\n }),\n frameBudget: Object.freeze({\n ...defaultPlayerSystemInterfaceContract.frameBudget,\n ...input.frameBudget,\n }),\n });\n}\n\nexport function createPlayerSystemInterfacePortabilityContract(\n input: PlayerSystemInterfacePortabilityContractInput = {}\n): PlayerSystemInterfacePortabilityContract {\n return Object.freeze({\n featureFlagId:\n input.featureFlagId ??\n defaultPlayerSystemInterfacePortabilityContract.featureFlagId,\n hostAdapters: Object.freeze({\n ...defaultPlayerSystemInterfacePortabilityContract.hostAdapters,\n ...input.hostAdapters,\n supportedHosts: Object.freeze([\n ...(input.hostAdapters?.supportedHosts ??\n defaultPlayerSystemInterfacePortabilityContract.hostAdapters\n .supportedHosts),\n ]),\n requiredCapabilities: Object.freeze([\n ...(input.hostAdapters?.requiredCapabilities ??\n defaultPlayerSystemInterfacePortabilityContract.hostAdapters\n .requiredCapabilities),\n ]),\n forbiddenAssumptions: Object.freeze([\n ...(input.hostAdapters?.forbiddenAssumptions ??\n defaultPlayerSystemInterfacePortabilityContract.hostAdapters\n .forbiddenAssumptions),\n ]),\n }),\n compositionScale: Object.freeze({\n ...defaultPlayerSystemInterfacePortabilityContract.compositionScale,\n ...input.compositionScale,\n }),\n });\n}\n\nexport function createInterfaceShellSurfaceDefinition(\n input: InterfaceShellSurfaceDefinition\n): InterfaceShellSurfaceDefinition {\n return Object.freeze({ ...input });\n}\n\nexport function createFocusPaneShellDefinition(\n input: FocusPaneShellDefinition\n): FocusPaneShellDefinition {\n return Object.freeze({ ...input });\n}\n\nexport function createLineOfSightTargetPopupDefinition(\n input: LineOfSightTargetPopupDefinition\n): LineOfSightTargetPopupDefinition {\n return Object.freeze({ ...input });\n}\n\nexport function createIdentityStatusOverlayDefinition(\n input: IdentityStatusOverlayDefinition\n): IdentityStatusOverlayDefinition {\n return Object.freeze({\n ...input,\n perceivableFacts: Object.freeze([...input.perceivableFacts]),\n readableFacts: Object.freeze([...input.readableFacts]),\n });\n}\n\nexport function createThreeDPaneHostDefinition(\n input: ThreeDPaneHostDefinition\n): ThreeDPaneHostDefinition {\n return Object.freeze({\n ...input,\n supportedHosts: Object.freeze([...input.supportedHosts]),\n });\n}\n\nexport function createLocalizedAmbientAlertDefinition(\n input: LocalizedAmbientAlertDefinition\n): LocalizedAmbientAlertDefinition {\n return Object.freeze({\n ...input,\n localizedMessages: Object.freeze({ ...input.localizedMessages }),\n });\n}\n\nexport function createInterfaceShellDefinition(\n input: InterfaceShellDefinitionInput = {}\n): InterfaceShellDefinition {\n return Object.freeze({\n featureFlagId: input.featureFlagId ?? PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID,\n surfaces: Object.freeze([...(input.surfaces ?? [])]),\n focusPane: input.focusPane ? Object.freeze({ ...input.focusPane }) : undefined,\n targetPopups: Object.freeze([...(input.targetPopups ?? [])]),\n identityOverlays: Object.freeze([...(input.identityOverlays ?? [])]),\n paneHosts: Object.freeze([...(input.paneHosts ?? [])]),\n ambientAlerts: Object.freeze([...(input.ambientAlerts ?? [])]),\n reducedCombat: Object.freeze({\n ...defaultReducedCombatOverlayPolicy,\n ...input.reducedCombat,\n retainedSurfaceKinds: Object.freeze([\n ...(input.reducedCombat?.retainedSurfaceKinds ??\n defaultReducedCombatOverlayPolicy.retainedSurfaceKinds),\n ]),\n }),\n });\n}\n\nexport function createInterfaceShellState(\n shell: InterfaceShellDefinition,\n input: InterfaceShellStateInput\n): InterfaceShellStateDefinition {\n const retainedSurfaceKinds = new Set(\n shell.reducedCombat.retainedSurfaceKinds\n );\n const visibleSurfaceIds = shell.surfaces\n .filter(\n (surface) =>\n input.mode !== \"combat-safe\" ||\n (surface.combatBehavior !== \"suspend\" &&\n retainedSurfaceKinds.has(surface.kind))\n )\n .map((surface) => surface.surfaceId);\n\n if (\n input.focusedSurfaceId &&\n !visibleSurfaceIds.includes(input.focusedSurfaceId)\n ) {\n throw new RangeError(\n `Focused surface '${input.focusedSurfaceId}' is not visible in ${input.mode} mode`\n );\n }\n\n return Object.freeze({\n featureFlagId: shell.featureFlagId,\n mode: input.mode,\n focusedSurfaceId:\n input.mode === \"focused\" ? input.focusedSurfaceId : undefined,\n visibleSurfaceIds: Object.freeze(visibleSurfaceIds),\n });\n}\n\nexport function applyInterfaceShellFocusShift(\n state: InterfaceShellStateDefinition,\n focusShift: InterfaceFocusShift\n): InterfaceShellStateDefinition {\n if (!state.visibleSurfaceIds.includes(focusShift.toSurfaceId)) {\n throw new RangeError(\n `Focused surface '${focusShift.toSurfaceId}' is not visible in ${state.mode} mode`\n );\n }\n\n return Object.freeze({\n ...state,\n mode: \"focused\",\n focusedSurfaceId: focusShift.toSurfaceId,\n focusShift: Object.freeze({ ...focusShift }),\n });\n}\n\nexport function resolveLocalizedAmbientAlertMessage(\n alert: LocalizedAmbientAlertDefinition,\n locale: string,\n fallbackLocale = \"en-GB\"\n): string | undefined {\n return alert.localizedMessages[locale] ?? alert.localizedMessages[fallbackLocale];\n}\n\nexport function assessIdentityStatusOverlayDefinition(\n overlay: IdentityStatusOverlayDefinition\n): InterfaceContractAssessment {\n const violations: string[] = [];\n const perceivableFacts = new Set(overlay.perceivableFacts);\n\n if (overlay.readableFacts.some((fact) => !perceivableFacts.has(fact))) {\n violations.push(\"readableFacts\");\n }\n\n if (overlay.readConfidence === \"withheld\" && overlay.readableFacts.length > 0) {\n violations.push(\"withheldRead\");\n }\n\n if (overlay.targetKind === \"self\") {\n if (overlay.relation !== \"self\") {\n violations.push(\"selfRelation\");\n }\n if (overlay.invocation !== \"self-state\") {\n violations.push(\"selfInvocation\");\n }\n if (overlay.requiresLineOfSight) {\n violations.push(\"selfLineOfSight\");\n }\n } else {\n if (overlay.targetId.length === 0) {\n violations.push(\"targetId\");\n }\n if (!overlay.requiresLineOfSight) {\n violations.push(\"lineOfSight\");\n }\n }\n\n return Object.freeze({\n accepted: violations.length === 0,\n violations: Object.freeze(violations),\n });\n}\n\nexport function assessPlayerSystemInterfaceComposition(\n sample: WorldSpaceCompositionSample,\n contract: PlayerSystemInterfacePortabilityContract = defaultPlayerSystemInterfacePortabilityContract\n): InterfaceContractAssessment {\n const violations: string[] = [];\n\n if (sample.panelCount > contract.compositionScale.maxWorldPanels) {\n violations.push(\"panelCount\");\n }\n\n if (sample.focusPaneCount > contract.compositionScale.maxFocusPanes) {\n violations.push(\"focusPaneCount\");\n }\n\n if (sample.alertMarkerCount > contract.compositionScale.maxAlertMarkers) {\n violations.push(\"alertMarkerCount\");\n }\n\n if (\n sample.interactivePanelCount >\n contract.compositionScale.maxInteractivePanelsPerFrame\n ) {\n violations.push(\"interactivePanelCount\");\n }\n\n return Object.freeze({\n accepted: violations.length === 0,\n violations: Object.freeze(violations),\n });\n}\n\nexport function assessInterfaceShellDefinition(\n shell: InterfaceShellDefinition\n): InterfaceContractAssessment {\n const violations: string[] = [];\n const ownerSet = new Set(shell.surfaces.map((surface) => surface.owner));\n const retainedSurfaceKinds = new Set(shell.reducedCombat.retainedSurfaceKinds);\n const interactiveSurfaceCount = shell.surfaces.filter(\n (surface) => surface.interactive && retainedSurfaceKinds.has(surface.kind)\n ).length;\n const focusPane = shell.focusPane;\n\n if (shell.surfaces.length === 0) {\n violations.push(\"surfaces\");\n }\n\n if (focusPane && !ownerSet.has(focusPane.owner)) {\n violations.push(\"focusPaneOwner\");\n }\n\n if (focusPane) {\n const matchingSurface = shell.surfaces.find(\n (surface) =>\n surface.kind === \"focus-pane\" &&\n surface.anchorId === focusPane.anchorId &&\n surface.owner === focusPane.owner\n );\n if (!matchingSurface) {\n violations.push(\"focusPaneSurface\");\n }\n }\n\n if (\n interactiveSurfaceCount > shell.reducedCombat.maxInteractiveSurfaces\n ) {\n violations.push(\"interactiveSurfaceCount\");\n }\n\n for (const popup of shell.targetPopups) {\n if (popup.requiresLineOfSight && popup.anchorId.length === 0) {\n violations.push(`popup:${popup.popupId}`);\n }\n }\n\n for (const overlay of shell.identityOverlays) {\n const identityAssessment = assessIdentityStatusOverlayDefinition(overlay);\n for (const violation of identityAssessment.violations) {\n violations.push(`identityOverlay:${overlay.overlayId}:${violation}`);\n }\n\n const matchingSurface = shell.surfaces.find(\n (surface) =>\n surface.surfaceId === overlay.surfaceId &&\n surface.kind === \"identity-overlay\"\n );\n if (!matchingSurface) {\n violations.push(`identityOverlaySurface:${overlay.overlayId}`);\n }\n }\n\n for (const paneHost of shell.paneHosts) {\n const matchingSurface = shell.surfaces.find(\n (surface) =>\n surface.surfaceId === paneHost.surfaceId &&\n surface.owner === paneHost.owner &&\n surface.anchorId === paneHost.anchorId\n );\n if (!matchingSurface) {\n violations.push(`paneHost:${paneHost.hostId}`);\n }\n }\n\n for (const alert of shell.ambientAlerts) {\n if (Object.keys(alert.localizedMessages).length === 0) {\n violations.push(`alert:${alert.alertId}`);\n }\n }\n\n if (\n ownerSet.has(\"player-system\") &&\n ownerSet.has(\"party-system\") &&\n shell.reducedCombat.retainedSurfaceKinds.length === 0\n ) {\n violations.push(\"reducedCombat\");\n }\n\n return Object.freeze({\n accepted: violations.length === 0,\n violations: Object.freeze(violations),\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoRO,IAAM,kCAAkC;AACxC,IAAM,qCAAqC;AAC3C,IAAM,0CACX;AACK,IAAM,yCACX;AACK,IAAM,4CACX;AACK,IAAM,oDACX;AACK,IAAM,yCACX;AAEK,IAAM,oBAAuC,OAAO,OAAO;AAAA,EAChE,aAAa;AAAA,EACb,eAAe;AAAA,EACf,WAAW;AAAA,EACX,SACE;AACJ,CAAC;AAEM,IAAM,uCACX,OAAO,OAAO;AAAA,EACZ,eAAe;AAAA,EACf,eAAe,OAAO,OAAO;AAAA,IAC3B,cAAc;AAAA,IACd,wBAAwB;AAAA,IACxB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B,CAAC;AAAA,EACD,aAAa,OAAO,OAAO;AAAA,IACzB,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,8BAA8B;AAAA,EAChC,CAAC;AACH,CAAC;AAEI,IAAM,kDACX,OAAO,OAAO;AAAA,EACZ,eAAe;AAAA,EACf,cAAc,OAAO,OAAO;AAAA,IAC1B,gBAAgB,OAAO,OAAO;AAAA,MAC5B;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAA6B;AAAA,IAC7B,sBAAsB,OAAO,OAAO;AAAA,MAClC;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAsC;AAAA,IACtC,sBAAsB,OAAO,OAAO;AAAA,MAClC;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AAAA,EACD,kBAAkB,OAAO,OAAO;AAAA,IAC9B,gBAAgB;AAA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ambient" | "focused" | "combat-safe";
53
53
  type PlayerSystemPaneId = "identity" | "missions" | "guild-quests" | "logs" | "mcc" | "tutorial" | "points-store";
54
54
  type InterfaceShellOwner = "player-system" | "party-system";
55
- type InterfaceShellSurfaceKind = "world-panel" | "focus-pane" | "target-popup" | "alert-marker";
55
+ type InterfaceShellSurfaceKind = "world-panel" | "focus-pane" | "target-popup" | "alert-marker" | "identity-overlay";
56
56
  type InterfaceCombatBehavior = "persist" | "reduce" | "suspend";
57
+ type IdentityProjectionRelation = "self" | "allied" | "neutral" | "unknown" | "unfriendly";
58
+ type IdentityProjectionInvocation = "self-state" | "identity-sweep" | "spell-targeting";
59
+ type IdentityProjectionReadConfidence = "complete" | "partial" | "fuzzy" | "withheld";
60
+ type IdentityProjectionPresentation = "full" | "condensed";
61
+ type IdentityProjectionFact = "display-name" | "relation" | "health-band" | "status-summary" | "threat-band" | "targeting-affordance";
62
+ interface IdentityStatusOverlayBaseDefinition {
63
+ readonly overlayId: string;
64
+ readonly surfaceId: string;
65
+ readonly readConfidence: IdentityProjectionReadConfidence;
66
+ readonly perceivableFacts: readonly IdentityProjectionFact[];
67
+ readonly readableFacts: readonly IdentityProjectionFact[];
68
+ readonly presentation: IdentityProjectionPresentation;
69
+ }
70
+ interface IdentitySelfStateOverlayDefinition extends IdentityStatusOverlayBaseDefinition {
71
+ readonly targetKind: "self";
72
+ readonly relation: "self";
73
+ readonly invocation: "self-state";
74
+ readonly requiresLineOfSight: false;
75
+ readonly targetId?: never;
76
+ }
77
+ interface IdentityTargetProjectionOverlayDefinition extends IdentityStatusOverlayBaseDefinition {
78
+ readonly targetKind: "external";
79
+ readonly targetId: string;
80
+ readonly relation: Exclude<IdentityProjectionRelation, "self">;
81
+ readonly invocation: Exclude<IdentityProjectionInvocation, "self-state">;
82
+ readonly requiresLineOfSight: true;
83
+ }
84
+ type IdentityStatusOverlayDefinition = IdentitySelfStateOverlayDefinition | IdentityTargetProjectionOverlayDefinition;
57
85
  interface InterfaceShellSurfaceDefinition {
58
86
  readonly surfaceId: string;
59
87
  readonly owner: InterfaceShellOwner;
@@ -92,6 +120,9 @@ interface InterfaceShellDefinition {
92
120
  readonly surfaces: readonly InterfaceShellSurfaceDefinition[];
93
121
  readonly focusPane?: FocusPaneShellDefinition;
94
122
  readonly targetPopups: readonly LineOfSightTargetPopupDefinition[];
123
+ readonly identityOverlays: readonly IdentityStatusOverlayDefinition[];
124
+ readonly paneHosts: readonly ThreeDPaneHostDefinition[];
125
+ readonly ambientAlerts: readonly LocalizedAmbientAlertDefinition[];
95
126
  readonly reducedCombat: ReducedCombatOverlayPolicy;
96
127
  }
97
128
  interface InterfaceShellDefinitionInput {
@@ -99,8 +130,46 @@ interface InterfaceShellDefinitionInput {
99
130
  readonly surfaces?: readonly InterfaceShellSurfaceDefinition[];
100
131
  readonly focusPane?: FocusPaneShellDefinition;
101
132
  readonly targetPopups?: readonly LineOfSightTargetPopupDefinition[];
133
+ readonly identityOverlays?: readonly IdentityStatusOverlayDefinition[];
134
+ readonly paneHosts?: readonly ThreeDPaneHostDefinition[];
135
+ readonly ambientAlerts?: readonly LocalizedAmbientAlertDefinition[];
102
136
  readonly reducedCombat?: Partial<ReducedCombatOverlayPolicy>;
103
137
  }
138
+ type InterfaceFocusShiftReason = "keyboard" | "direct-hotkey" | "restore" | "system";
139
+ interface InterfaceFocusShift {
140
+ readonly fromSurfaceId?: string;
141
+ readonly toSurfaceId: string;
142
+ readonly reason: InterfaceFocusShiftReason;
143
+ }
144
+ interface InterfaceShellStateDefinition {
145
+ readonly featureFlagId: string;
146
+ readonly mode: PlayerSystemInterfaceMode;
147
+ readonly focusedSurfaceId?: string;
148
+ readonly visibleSurfaceIds: readonly string[];
149
+ readonly focusShift?: InterfaceFocusShift;
150
+ }
151
+ interface InterfaceShellStateInput {
152
+ readonly mode: PlayerSystemInterfaceMode;
153
+ readonly focusedSurfaceId?: string;
154
+ }
155
+ interface ThreeDPaneHostDefinition {
156
+ readonly hostId: string;
157
+ readonly owner: InterfaceShellOwner;
158
+ readonly pane: PlayerSystemPaneId;
159
+ readonly surfaceId: string;
160
+ readonly anchorId: string;
161
+ readonly supportedHosts: readonly OverlayHostKind[];
162
+ }
163
+ type AmbientAlertSeverity = "info" | "warning" | "danger";
164
+ interface LocalizedAmbientAlertDefinition {
165
+ readonly alertId: string;
166
+ readonly owner: InterfaceShellOwner;
167
+ readonly severity: AmbientAlertSeverity;
168
+ readonly anchorId: string;
169
+ readonly messageKey: string;
170
+ readonly localizedMessages: Readonly<Record<string, string>>;
171
+ readonly liveRegionMode: "polite" | "assertive";
172
+ }
104
173
  interface WorldSpacePanelDefinition {
105
174
  readonly panelId: string;
106
175
  readonly pane: PlayerSystemPaneId;
@@ -111,7 +180,7 @@ interface WorldSpacePanelDefinition {
111
180
  }
112
181
  interface OverlayAlertMarker {
113
182
  readonly markerId: string;
114
- readonly severity: "info" | "warning" | "danger";
183
+ readonly severity: AmbientAlertSeverity;
115
184
  readonly anchorId: string;
116
185
  }
117
186
  interface WorldSpaceCompositionSample {
@@ -130,6 +199,7 @@ declare const PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID = "isekai.player-system.in
130
199
  declare const PLAYER_SYSTEM_PACKAGES_FEATURE_FLAG_ID = "isekai.player-system.interface.enabled";
131
200
  declare const PLAYER_SYSTEM_RUNTIME_NFR_FEATURE_FLAG_ID = "isekai.player-system.interface.enabled";
132
201
  declare const PLAYER_SYSTEM_RUNTIME_PORTABILITY_FEATURE_FLAG_ID = "isekai.player-system.interface.enabled";
202
+ declare const PLAYER_SYSTEM_IDENTITY_FEATURE_FLAG_ID = "isekai.player-system.identity.enabled";
133
203
  declare const packageDescriptor: PackageDescriptor;
134
204
  declare const defaultPlayerSystemInterfaceContract: PlayerSystemInterfaceContract;
135
205
  declare const defaultPlayerSystemInterfacePortabilityContract: PlayerSystemInterfacePortabilityContract;
@@ -141,8 +211,15 @@ declare function createPlayerSystemInterfacePortabilityContract(input?: PlayerSy
141
211
  declare function createInterfaceShellSurfaceDefinition(input: InterfaceShellSurfaceDefinition): InterfaceShellSurfaceDefinition;
142
212
  declare function createFocusPaneShellDefinition(input: FocusPaneShellDefinition): FocusPaneShellDefinition;
143
213
  declare function createLineOfSightTargetPopupDefinition(input: LineOfSightTargetPopupDefinition): LineOfSightTargetPopupDefinition;
214
+ declare function createIdentityStatusOverlayDefinition(input: IdentityStatusOverlayDefinition): IdentityStatusOverlayDefinition;
215
+ declare function createThreeDPaneHostDefinition(input: ThreeDPaneHostDefinition): ThreeDPaneHostDefinition;
216
+ declare function createLocalizedAmbientAlertDefinition(input: LocalizedAmbientAlertDefinition): LocalizedAmbientAlertDefinition;
144
217
  declare function createInterfaceShellDefinition(input?: InterfaceShellDefinitionInput): InterfaceShellDefinition;
218
+ declare function createInterfaceShellState(shell: InterfaceShellDefinition, input: InterfaceShellStateInput): InterfaceShellStateDefinition;
219
+ declare function applyInterfaceShellFocusShift(state: InterfaceShellStateDefinition, focusShift: InterfaceFocusShift): InterfaceShellStateDefinition;
220
+ declare function resolveLocalizedAmbientAlertMessage(alert: LocalizedAmbientAlertDefinition, locale: string, fallbackLocale?: string): string | undefined;
221
+ declare function assessIdentityStatusOverlayDefinition(overlay: IdentityStatusOverlayDefinition): InterfaceContractAssessment;
145
222
  declare function assessPlayerSystemInterfaceComposition(sample: WorldSpaceCompositionSample, contract?: PlayerSystemInterfacePortabilityContract): InterfaceContractAssessment;
146
223
  declare function assessInterfaceShellDefinition(shell: InterfaceShellDefinition): InterfaceContractAssessment;
147
224
 
148
- export { type FocusPaneShellDefinition, type InterfaceCombatBehavior, type InterfaceContractAssessment, type InterfaceFrameBudget, type InterfaceShellDefinition, type InterfaceShellDefinitionInput, type InterfaceShellOwner, type InterfaceShellSurfaceDefinition, type InterfaceShellSurfaceKind, type LineOfSightTargetPopupDefinition, type OverlayAccessibilityContract, type OverlayAdapterCapability, type OverlayAlertMarker, type OverlayCompositionScaleContract, type OverlayHostAdapterContract, type OverlayHostKind, type OverlayKeyboardPath, PLAYER_SYSTEM_INTERFACE_ENV_PREFIX, PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID, PLAYER_SYSTEM_INTERFACE_PACKAGE, PLAYER_SYSTEM_PACKAGES_FEATURE_FLAG_ID, PLAYER_SYSTEM_RUNTIME_NFR_FEATURE_FLAG_ID, PLAYER_SYSTEM_RUNTIME_PORTABILITY_FEATURE_FLAG_ID, type PackageDescriptor, type PlayerSystemInterfaceContract, type PlayerSystemInterfaceContractInput, type PlayerSystemInterfaceMode, type PlayerSystemInterfacePortabilityContract, type PlayerSystemInterfacePortabilityContractInput, type PlayerSystemPaneId, type ReducedCombatOverlayPolicy, type WorldSpaceCompositionSample, type WorldSpacePanelDefinition, assessInterfaceShellDefinition, assessPlayerSystemInterfaceComposition, createFocusPaneShellDefinition, createInterfaceShellDefinition, createInterfaceShellSurfaceDefinition, createLineOfSightTargetPopupDefinition, createPlayerSystemInterfaceContract, createPlayerSystemInterfacePortabilityContract, createWorldSpacePanelDefinition, defaultPlayerSystemInterfaceContract, defaultPlayerSystemInterfacePortabilityContract, defaultReducedCombatOverlayPolicy, isPlayerSystemInterfaceMode, packageDescriptor };
225
+ export { type AmbientAlertSeverity, type FocusPaneShellDefinition, type IdentityProjectionFact, type IdentityProjectionInvocation, type IdentityProjectionPresentation, type IdentityProjectionReadConfidence, type IdentityProjectionRelation, type IdentitySelfStateOverlayDefinition, type IdentityStatusOverlayBaseDefinition, type IdentityStatusOverlayDefinition, type IdentityTargetProjectionOverlayDefinition, type InterfaceCombatBehavior, type InterfaceContractAssessment, type InterfaceFocusShift, type InterfaceFocusShiftReason, type InterfaceFrameBudget, type InterfaceShellDefinition, type InterfaceShellDefinitionInput, type InterfaceShellOwner, type InterfaceShellStateDefinition, type InterfaceShellStateInput, type InterfaceShellSurfaceDefinition, type InterfaceShellSurfaceKind, type LineOfSightTargetPopupDefinition, type LocalizedAmbientAlertDefinition, type OverlayAccessibilityContract, type OverlayAdapterCapability, type OverlayAlertMarker, type OverlayCompositionScaleContract, type OverlayHostAdapterContract, type OverlayHostKind, type OverlayKeyboardPath, PLAYER_SYSTEM_IDENTITY_FEATURE_FLAG_ID, PLAYER_SYSTEM_INTERFACE_ENV_PREFIX, PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID, PLAYER_SYSTEM_INTERFACE_PACKAGE, PLAYER_SYSTEM_PACKAGES_FEATURE_FLAG_ID, PLAYER_SYSTEM_RUNTIME_NFR_FEATURE_FLAG_ID, PLAYER_SYSTEM_RUNTIME_PORTABILITY_FEATURE_FLAG_ID, type PackageDescriptor, type PlayerSystemInterfaceContract, type PlayerSystemInterfaceContractInput, type PlayerSystemInterfaceMode, type PlayerSystemInterfacePortabilityContract, type PlayerSystemInterfacePortabilityContractInput, type PlayerSystemPaneId, type ReducedCombatOverlayPolicy, type ThreeDPaneHostDefinition, type WorldSpaceCompositionSample, type WorldSpacePanelDefinition, applyInterfaceShellFocusShift, assessIdentityStatusOverlayDefinition, assessInterfaceShellDefinition, assessPlayerSystemInterfaceComposition, createFocusPaneShellDefinition, createIdentityStatusOverlayDefinition, createInterfaceShellDefinition, createInterfaceShellState, createInterfaceShellSurfaceDefinition, createLineOfSightTargetPopupDefinition, createLocalizedAmbientAlertDefinition, createPlayerSystemInterfaceContract, createPlayerSystemInterfacePortabilityContract, createThreeDPaneHostDefinition, createWorldSpacePanelDefinition, defaultPlayerSystemInterfaceContract, defaultPlayerSystemInterfacePortabilityContract, defaultReducedCombatOverlayPolicy, isPlayerSystemInterfaceMode, packageDescriptor, resolveLocalizedAmbientAlertMessage };
package/dist/index.d.ts CHANGED
@@ -52,8 +52,36 @@ interface PlayerSystemInterfacePortabilityContractInput {
52
52
  type PlayerSystemInterfaceMode = "ambient" | "focused" | "combat-safe";
53
53
  type PlayerSystemPaneId = "identity" | "missions" | "guild-quests" | "logs" | "mcc" | "tutorial" | "points-store";
54
54
  type InterfaceShellOwner = "player-system" | "party-system";
55
- type InterfaceShellSurfaceKind = "world-panel" | "focus-pane" | "target-popup" | "alert-marker";
55
+ type InterfaceShellSurfaceKind = "world-panel" | "focus-pane" | "target-popup" | "alert-marker" | "identity-overlay";
56
56
  type InterfaceCombatBehavior = "persist" | "reduce" | "suspend";
57
+ type IdentityProjectionRelation = "self" | "allied" | "neutral" | "unknown" | "unfriendly";
58
+ type IdentityProjectionInvocation = "self-state" | "identity-sweep" | "spell-targeting";
59
+ type IdentityProjectionReadConfidence = "complete" | "partial" | "fuzzy" | "withheld";
60
+ type IdentityProjectionPresentation = "full" | "condensed";
61
+ type IdentityProjectionFact = "display-name" | "relation" | "health-band" | "status-summary" | "threat-band" | "targeting-affordance";
62
+ interface IdentityStatusOverlayBaseDefinition {
63
+ readonly overlayId: string;
64
+ readonly surfaceId: string;
65
+ readonly readConfidence: IdentityProjectionReadConfidence;
66
+ readonly perceivableFacts: readonly IdentityProjectionFact[];
67
+ readonly readableFacts: readonly IdentityProjectionFact[];
68
+ readonly presentation: IdentityProjectionPresentation;
69
+ }
70
+ interface IdentitySelfStateOverlayDefinition extends IdentityStatusOverlayBaseDefinition {
71
+ readonly targetKind: "self";
72
+ readonly relation: "self";
73
+ readonly invocation: "self-state";
74
+ readonly requiresLineOfSight: false;
75
+ readonly targetId?: never;
76
+ }
77
+ interface IdentityTargetProjectionOverlayDefinition extends IdentityStatusOverlayBaseDefinition {
78
+ readonly targetKind: "external";
79
+ readonly targetId: string;
80
+ readonly relation: Exclude<IdentityProjectionRelation, "self">;
81
+ readonly invocation: Exclude<IdentityProjectionInvocation, "self-state">;
82
+ readonly requiresLineOfSight: true;
83
+ }
84
+ type IdentityStatusOverlayDefinition = IdentitySelfStateOverlayDefinition | IdentityTargetProjectionOverlayDefinition;
57
85
  interface InterfaceShellSurfaceDefinition {
58
86
  readonly surfaceId: string;
59
87
  readonly owner: InterfaceShellOwner;
@@ -92,6 +120,9 @@ interface InterfaceShellDefinition {
92
120
  readonly surfaces: readonly InterfaceShellSurfaceDefinition[];
93
121
  readonly focusPane?: FocusPaneShellDefinition;
94
122
  readonly targetPopups: readonly LineOfSightTargetPopupDefinition[];
123
+ readonly identityOverlays: readonly IdentityStatusOverlayDefinition[];
124
+ readonly paneHosts: readonly ThreeDPaneHostDefinition[];
125
+ readonly ambientAlerts: readonly LocalizedAmbientAlertDefinition[];
95
126
  readonly reducedCombat: ReducedCombatOverlayPolicy;
96
127
  }
97
128
  interface InterfaceShellDefinitionInput {
@@ -99,8 +130,46 @@ interface InterfaceShellDefinitionInput {
99
130
  readonly surfaces?: readonly InterfaceShellSurfaceDefinition[];
100
131
  readonly focusPane?: FocusPaneShellDefinition;
101
132
  readonly targetPopups?: readonly LineOfSightTargetPopupDefinition[];
133
+ readonly identityOverlays?: readonly IdentityStatusOverlayDefinition[];
134
+ readonly paneHosts?: readonly ThreeDPaneHostDefinition[];
135
+ readonly ambientAlerts?: readonly LocalizedAmbientAlertDefinition[];
102
136
  readonly reducedCombat?: Partial<ReducedCombatOverlayPolicy>;
103
137
  }
138
+ type InterfaceFocusShiftReason = "keyboard" | "direct-hotkey" | "restore" | "system";
139
+ interface InterfaceFocusShift {
140
+ readonly fromSurfaceId?: string;
141
+ readonly toSurfaceId: string;
142
+ readonly reason: InterfaceFocusShiftReason;
143
+ }
144
+ interface InterfaceShellStateDefinition {
145
+ readonly featureFlagId: string;
146
+ readonly mode: PlayerSystemInterfaceMode;
147
+ readonly focusedSurfaceId?: string;
148
+ readonly visibleSurfaceIds: readonly string[];
149
+ readonly focusShift?: InterfaceFocusShift;
150
+ }
151
+ interface InterfaceShellStateInput {
152
+ readonly mode: PlayerSystemInterfaceMode;
153
+ readonly focusedSurfaceId?: string;
154
+ }
155
+ interface ThreeDPaneHostDefinition {
156
+ readonly hostId: string;
157
+ readonly owner: InterfaceShellOwner;
158
+ readonly pane: PlayerSystemPaneId;
159
+ readonly surfaceId: string;
160
+ readonly anchorId: string;
161
+ readonly supportedHosts: readonly OverlayHostKind[];
162
+ }
163
+ type AmbientAlertSeverity = "info" | "warning" | "danger";
164
+ interface LocalizedAmbientAlertDefinition {
165
+ readonly alertId: string;
166
+ readonly owner: InterfaceShellOwner;
167
+ readonly severity: AmbientAlertSeverity;
168
+ readonly anchorId: string;
169
+ readonly messageKey: string;
170
+ readonly localizedMessages: Readonly<Record<string, string>>;
171
+ readonly liveRegionMode: "polite" | "assertive";
172
+ }
104
173
  interface WorldSpacePanelDefinition {
105
174
  readonly panelId: string;
106
175
  readonly pane: PlayerSystemPaneId;
@@ -111,7 +180,7 @@ interface WorldSpacePanelDefinition {
111
180
  }
112
181
  interface OverlayAlertMarker {
113
182
  readonly markerId: string;
114
- readonly severity: "info" | "warning" | "danger";
183
+ readonly severity: AmbientAlertSeverity;
115
184
  readonly anchorId: string;
116
185
  }
117
186
  interface WorldSpaceCompositionSample {
@@ -130,6 +199,7 @@ declare const PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID = "isekai.player-system.in
130
199
  declare const PLAYER_SYSTEM_PACKAGES_FEATURE_FLAG_ID = "isekai.player-system.interface.enabled";
131
200
  declare const PLAYER_SYSTEM_RUNTIME_NFR_FEATURE_FLAG_ID = "isekai.player-system.interface.enabled";
132
201
  declare const PLAYER_SYSTEM_RUNTIME_PORTABILITY_FEATURE_FLAG_ID = "isekai.player-system.interface.enabled";
202
+ declare const PLAYER_SYSTEM_IDENTITY_FEATURE_FLAG_ID = "isekai.player-system.identity.enabled";
133
203
  declare const packageDescriptor: PackageDescriptor;
134
204
  declare const defaultPlayerSystemInterfaceContract: PlayerSystemInterfaceContract;
135
205
  declare const defaultPlayerSystemInterfacePortabilityContract: PlayerSystemInterfacePortabilityContract;
@@ -141,8 +211,15 @@ declare function createPlayerSystemInterfacePortabilityContract(input?: PlayerSy
141
211
  declare function createInterfaceShellSurfaceDefinition(input: InterfaceShellSurfaceDefinition): InterfaceShellSurfaceDefinition;
142
212
  declare function createFocusPaneShellDefinition(input: FocusPaneShellDefinition): FocusPaneShellDefinition;
143
213
  declare function createLineOfSightTargetPopupDefinition(input: LineOfSightTargetPopupDefinition): LineOfSightTargetPopupDefinition;
214
+ declare function createIdentityStatusOverlayDefinition(input: IdentityStatusOverlayDefinition): IdentityStatusOverlayDefinition;
215
+ declare function createThreeDPaneHostDefinition(input: ThreeDPaneHostDefinition): ThreeDPaneHostDefinition;
216
+ declare function createLocalizedAmbientAlertDefinition(input: LocalizedAmbientAlertDefinition): LocalizedAmbientAlertDefinition;
144
217
  declare function createInterfaceShellDefinition(input?: InterfaceShellDefinitionInput): InterfaceShellDefinition;
218
+ declare function createInterfaceShellState(shell: InterfaceShellDefinition, input: InterfaceShellStateInput): InterfaceShellStateDefinition;
219
+ declare function applyInterfaceShellFocusShift(state: InterfaceShellStateDefinition, focusShift: InterfaceFocusShift): InterfaceShellStateDefinition;
220
+ declare function resolveLocalizedAmbientAlertMessage(alert: LocalizedAmbientAlertDefinition, locale: string, fallbackLocale?: string): string | undefined;
221
+ declare function assessIdentityStatusOverlayDefinition(overlay: IdentityStatusOverlayDefinition): InterfaceContractAssessment;
145
222
  declare function assessPlayerSystemInterfaceComposition(sample: WorldSpaceCompositionSample, contract?: PlayerSystemInterfacePortabilityContract): InterfaceContractAssessment;
146
223
  declare function assessInterfaceShellDefinition(shell: InterfaceShellDefinition): InterfaceContractAssessment;
147
224
 
148
- export { type FocusPaneShellDefinition, type InterfaceCombatBehavior, type InterfaceContractAssessment, type InterfaceFrameBudget, type InterfaceShellDefinition, type InterfaceShellDefinitionInput, type InterfaceShellOwner, type InterfaceShellSurfaceDefinition, type InterfaceShellSurfaceKind, type LineOfSightTargetPopupDefinition, type OverlayAccessibilityContract, type OverlayAdapterCapability, type OverlayAlertMarker, type OverlayCompositionScaleContract, type OverlayHostAdapterContract, type OverlayHostKind, type OverlayKeyboardPath, PLAYER_SYSTEM_INTERFACE_ENV_PREFIX, PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID, PLAYER_SYSTEM_INTERFACE_PACKAGE, PLAYER_SYSTEM_PACKAGES_FEATURE_FLAG_ID, PLAYER_SYSTEM_RUNTIME_NFR_FEATURE_FLAG_ID, PLAYER_SYSTEM_RUNTIME_PORTABILITY_FEATURE_FLAG_ID, type PackageDescriptor, type PlayerSystemInterfaceContract, type PlayerSystemInterfaceContractInput, type PlayerSystemInterfaceMode, type PlayerSystemInterfacePortabilityContract, type PlayerSystemInterfacePortabilityContractInput, type PlayerSystemPaneId, type ReducedCombatOverlayPolicy, type WorldSpaceCompositionSample, type WorldSpacePanelDefinition, assessInterfaceShellDefinition, assessPlayerSystemInterfaceComposition, createFocusPaneShellDefinition, createInterfaceShellDefinition, createInterfaceShellSurfaceDefinition, createLineOfSightTargetPopupDefinition, createPlayerSystemInterfaceContract, createPlayerSystemInterfacePortabilityContract, createWorldSpacePanelDefinition, defaultPlayerSystemInterfaceContract, defaultPlayerSystemInterfacePortabilityContract, defaultReducedCombatOverlayPolicy, isPlayerSystemInterfaceMode, packageDescriptor };
225
+ export { type AmbientAlertSeverity, type FocusPaneShellDefinition, type IdentityProjectionFact, type IdentityProjectionInvocation, type IdentityProjectionPresentation, type IdentityProjectionReadConfidence, type IdentityProjectionRelation, type IdentitySelfStateOverlayDefinition, type IdentityStatusOverlayBaseDefinition, type IdentityStatusOverlayDefinition, type IdentityTargetProjectionOverlayDefinition, type InterfaceCombatBehavior, type InterfaceContractAssessment, type InterfaceFocusShift, type InterfaceFocusShiftReason, type InterfaceFrameBudget, type InterfaceShellDefinition, type InterfaceShellDefinitionInput, type InterfaceShellOwner, type InterfaceShellStateDefinition, type InterfaceShellStateInput, type InterfaceShellSurfaceDefinition, type InterfaceShellSurfaceKind, type LineOfSightTargetPopupDefinition, type LocalizedAmbientAlertDefinition, type OverlayAccessibilityContract, type OverlayAdapterCapability, type OverlayAlertMarker, type OverlayCompositionScaleContract, type OverlayHostAdapterContract, type OverlayHostKind, type OverlayKeyboardPath, PLAYER_SYSTEM_IDENTITY_FEATURE_FLAG_ID, PLAYER_SYSTEM_INTERFACE_ENV_PREFIX, PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID, PLAYER_SYSTEM_INTERFACE_PACKAGE, PLAYER_SYSTEM_PACKAGES_FEATURE_FLAG_ID, PLAYER_SYSTEM_RUNTIME_NFR_FEATURE_FLAG_ID, PLAYER_SYSTEM_RUNTIME_PORTABILITY_FEATURE_FLAG_ID, type PackageDescriptor, type PlayerSystemInterfaceContract, type PlayerSystemInterfaceContractInput, type PlayerSystemInterfaceMode, type PlayerSystemInterfacePortabilityContract, type PlayerSystemInterfacePortabilityContractInput, type PlayerSystemPaneId, type ReducedCombatOverlayPolicy, type ThreeDPaneHostDefinition, type WorldSpaceCompositionSample, type WorldSpacePanelDefinition, applyInterfaceShellFocusShift, assessIdentityStatusOverlayDefinition, assessInterfaceShellDefinition, assessPlayerSystemInterfaceComposition, createFocusPaneShellDefinition, createIdentityStatusOverlayDefinition, createInterfaceShellDefinition, createInterfaceShellState, createInterfaceShellSurfaceDefinition, createLineOfSightTargetPopupDefinition, createLocalizedAmbientAlertDefinition, createPlayerSystemInterfaceContract, createPlayerSystemInterfacePortabilityContract, createThreeDPaneHostDefinition, createWorldSpacePanelDefinition, defaultPlayerSystemInterfaceContract, defaultPlayerSystemInterfacePortabilityContract, defaultReducedCombatOverlayPolicy, isPlayerSystemInterfaceMode, packageDescriptor, resolveLocalizedAmbientAlertMessage };
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ var PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID = "isekai.player-system.interface.en
5
5
  var PLAYER_SYSTEM_PACKAGES_FEATURE_FLAG_ID = PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID;
6
6
  var PLAYER_SYSTEM_RUNTIME_NFR_FEATURE_FLAG_ID = PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID;
7
7
  var PLAYER_SYSTEM_RUNTIME_PORTABILITY_FEATURE_FLAG_ID = PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID;
8
+ var PLAYER_SYSTEM_IDENTITY_FEATURE_FLAG_ID = "isekai.player-system.identity.enabled";
8
9
  var packageDescriptor = Object.freeze({
9
10
  packageName: PLAYER_SYSTEM_INTERFACE_PACKAGE,
10
11
  featureFlagId: PLAYER_SYSTEM_PACKAGES_FEATURE_FLAG_ID,
@@ -57,7 +58,8 @@ var defaultReducedCombatOverlayPolicy = Object.freeze({
57
58
  retainedSurfaceKinds: Object.freeze([
58
59
  "alert-marker",
59
60
  "target-popup",
60
- "focus-pane"
61
+ "focus-pane",
62
+ "identity-overlay"
61
63
  ]),
62
64
  maxInteractiveSurfaces: 1
63
65
  });
@@ -111,12 +113,34 @@ function createFocusPaneShellDefinition(input) {
111
113
  function createLineOfSightTargetPopupDefinition(input) {
112
114
  return Object.freeze({ ...input });
113
115
  }
116
+ function createIdentityStatusOverlayDefinition(input) {
117
+ return Object.freeze({
118
+ ...input,
119
+ perceivableFacts: Object.freeze([...input.perceivableFacts]),
120
+ readableFacts: Object.freeze([...input.readableFacts])
121
+ });
122
+ }
123
+ function createThreeDPaneHostDefinition(input) {
124
+ return Object.freeze({
125
+ ...input,
126
+ supportedHosts: Object.freeze([...input.supportedHosts])
127
+ });
128
+ }
129
+ function createLocalizedAmbientAlertDefinition(input) {
130
+ return Object.freeze({
131
+ ...input,
132
+ localizedMessages: Object.freeze({ ...input.localizedMessages })
133
+ });
134
+ }
114
135
  function createInterfaceShellDefinition(input = {}) {
115
136
  return Object.freeze({
116
137
  featureFlagId: input.featureFlagId ?? PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID,
117
138
  surfaces: Object.freeze([...input.surfaces ?? []]),
118
139
  focusPane: input.focusPane ? Object.freeze({ ...input.focusPane }) : void 0,
119
140
  targetPopups: Object.freeze([...input.targetPopups ?? []]),
141
+ identityOverlays: Object.freeze([...input.identityOverlays ?? []]),
142
+ paneHosts: Object.freeze([...input.paneHosts ?? []]),
143
+ ambientAlerts: Object.freeze([...input.ambientAlerts ?? []]),
120
144
  reducedCombat: Object.freeze({
121
145
  ...defaultReducedCombatOverlayPolicy,
122
146
  ...input.reducedCombat,
@@ -126,6 +150,73 @@ function createInterfaceShellDefinition(input = {}) {
126
150
  })
127
151
  });
128
152
  }
153
+ function createInterfaceShellState(shell, input) {
154
+ const retainedSurfaceKinds = new Set(
155
+ shell.reducedCombat.retainedSurfaceKinds
156
+ );
157
+ const visibleSurfaceIds = shell.surfaces.filter(
158
+ (surface) => input.mode !== "combat-safe" || surface.combatBehavior !== "suspend" && retainedSurfaceKinds.has(surface.kind)
159
+ ).map((surface) => surface.surfaceId);
160
+ if (input.focusedSurfaceId && !visibleSurfaceIds.includes(input.focusedSurfaceId)) {
161
+ throw new RangeError(
162
+ `Focused surface '${input.focusedSurfaceId}' is not visible in ${input.mode} mode`
163
+ );
164
+ }
165
+ return Object.freeze({
166
+ featureFlagId: shell.featureFlagId,
167
+ mode: input.mode,
168
+ focusedSurfaceId: input.mode === "focused" ? input.focusedSurfaceId : void 0,
169
+ visibleSurfaceIds: Object.freeze(visibleSurfaceIds)
170
+ });
171
+ }
172
+ function applyInterfaceShellFocusShift(state, focusShift) {
173
+ if (!state.visibleSurfaceIds.includes(focusShift.toSurfaceId)) {
174
+ throw new RangeError(
175
+ `Focused surface '${focusShift.toSurfaceId}' is not visible in ${state.mode} mode`
176
+ );
177
+ }
178
+ return Object.freeze({
179
+ ...state,
180
+ mode: "focused",
181
+ focusedSurfaceId: focusShift.toSurfaceId,
182
+ focusShift: Object.freeze({ ...focusShift })
183
+ });
184
+ }
185
+ function resolveLocalizedAmbientAlertMessage(alert, locale, fallbackLocale = "en-GB") {
186
+ return alert.localizedMessages[locale] ?? alert.localizedMessages[fallbackLocale];
187
+ }
188
+ function assessIdentityStatusOverlayDefinition(overlay) {
189
+ const violations = [];
190
+ const perceivableFacts = new Set(overlay.perceivableFacts);
191
+ if (overlay.readableFacts.some((fact) => !perceivableFacts.has(fact))) {
192
+ violations.push("readableFacts");
193
+ }
194
+ if (overlay.readConfidence === "withheld" && overlay.readableFacts.length > 0) {
195
+ violations.push("withheldRead");
196
+ }
197
+ if (overlay.targetKind === "self") {
198
+ if (overlay.relation !== "self") {
199
+ violations.push("selfRelation");
200
+ }
201
+ if (overlay.invocation !== "self-state") {
202
+ violations.push("selfInvocation");
203
+ }
204
+ if (overlay.requiresLineOfSight) {
205
+ violations.push("selfLineOfSight");
206
+ }
207
+ } else {
208
+ if (overlay.targetId.length === 0) {
209
+ violations.push("targetId");
210
+ }
211
+ if (!overlay.requiresLineOfSight) {
212
+ violations.push("lineOfSight");
213
+ }
214
+ }
215
+ return Object.freeze({
216
+ accepted: violations.length === 0,
217
+ violations: Object.freeze(violations)
218
+ });
219
+ }
129
220
  function assessPlayerSystemInterfaceComposition(sample, contract = defaultPlayerSystemInterfacePortabilityContract) {
130
221
  const violations = [];
131
222
  if (sample.panelCount > contract.compositionScale.maxWorldPanels) {
@@ -175,6 +266,31 @@ function assessInterfaceShellDefinition(shell) {
175
266
  violations.push(`popup:${popup.popupId}`);
176
267
  }
177
268
  }
269
+ for (const overlay of shell.identityOverlays) {
270
+ const identityAssessment = assessIdentityStatusOverlayDefinition(overlay);
271
+ for (const violation of identityAssessment.violations) {
272
+ violations.push(`identityOverlay:${overlay.overlayId}:${violation}`);
273
+ }
274
+ const matchingSurface = shell.surfaces.find(
275
+ (surface) => surface.surfaceId === overlay.surfaceId && surface.kind === "identity-overlay"
276
+ );
277
+ if (!matchingSurface) {
278
+ violations.push(`identityOverlaySurface:${overlay.overlayId}`);
279
+ }
280
+ }
281
+ for (const paneHost of shell.paneHosts) {
282
+ const matchingSurface = shell.surfaces.find(
283
+ (surface) => surface.surfaceId === paneHost.surfaceId && surface.owner === paneHost.owner && surface.anchorId === paneHost.anchorId
284
+ );
285
+ if (!matchingSurface) {
286
+ violations.push(`paneHost:${paneHost.hostId}`);
287
+ }
288
+ }
289
+ for (const alert of shell.ambientAlerts) {
290
+ if (Object.keys(alert.localizedMessages).length === 0) {
291
+ violations.push(`alert:${alert.alertId}`);
292
+ }
293
+ }
178
294
  if (ownerSet.has("player-system") && ownerSet.has("party-system") && shell.reducedCombat.retainedSurfaceKinds.length === 0) {
179
295
  violations.push("reducedCombat");
180
296
  }
@@ -184,25 +300,33 @@ function assessInterfaceShellDefinition(shell) {
184
300
  });
185
301
  }
186
302
  export {
303
+ PLAYER_SYSTEM_IDENTITY_FEATURE_FLAG_ID,
187
304
  PLAYER_SYSTEM_INTERFACE_ENV_PREFIX,
188
305
  PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID,
189
306
  PLAYER_SYSTEM_INTERFACE_PACKAGE,
190
307
  PLAYER_SYSTEM_PACKAGES_FEATURE_FLAG_ID,
191
308
  PLAYER_SYSTEM_RUNTIME_NFR_FEATURE_FLAG_ID,
192
309
  PLAYER_SYSTEM_RUNTIME_PORTABILITY_FEATURE_FLAG_ID,
310
+ applyInterfaceShellFocusShift,
311
+ assessIdentityStatusOverlayDefinition,
193
312
  assessInterfaceShellDefinition,
194
313
  assessPlayerSystemInterfaceComposition,
195
314
  createFocusPaneShellDefinition,
315
+ createIdentityStatusOverlayDefinition,
196
316
  createInterfaceShellDefinition,
317
+ createInterfaceShellState,
197
318
  createInterfaceShellSurfaceDefinition,
198
319
  createLineOfSightTargetPopupDefinition,
320
+ createLocalizedAmbientAlertDefinition,
199
321
  createPlayerSystemInterfaceContract,
200
322
  createPlayerSystemInterfacePortabilityContract,
323
+ createThreeDPaneHostDefinition,
201
324
  createWorldSpacePanelDefinition,
202
325
  defaultPlayerSystemInterfaceContract,
203
326
  defaultPlayerSystemInterfacePortabilityContract,
204
327
  defaultReducedCombatOverlayPolicy,
205
328
  isPlayerSystemInterfaceMode,
206
- packageDescriptor
329
+ packageDescriptor,
330
+ resolveLocalizedAmbientAlertMessage
207
331
  };
208
332
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export interface PackageDescriptor {\n readonly packageName: string;\n readonly featureFlagId: string;\n readonly envPrefix: string;\n readonly summary: string;\n}\n\nexport type OverlayKeyboardPath = \"sequential\" | \"direct-hotkey\" | \"read-only\";\n\nexport interface OverlayAccessibilityContract {\n readonly keyboardPath: OverlayKeyboardPath;\n readonly focusRestorationTarget: \"trigger\" | \"pane-heading\" | \"nearest-anchor\";\n readonly liveRegionMode: \"polite\" | \"assertive\" | \"off\";\n readonly requiresAccessibleName: boolean;\n}\n\nexport interface InterfaceFrameBudget {\n readonly targetFps: number;\n readonly maxFrameMs: number;\n readonly maxInteractivePanelsPerFrame: number;\n}\n\nexport type OverlayHostKind =\n | \"dom-overlay\"\n | \"native-overlay\"\n | \"headless-snapshot\";\n\nexport type OverlayAdapterCapability =\n | \"focus-restoration\"\n | \"live-region\"\n | \"anchor-registry\";\n\nexport interface OverlayHostAdapterContract {\n readonly supportedHosts: readonly OverlayHostKind[];\n readonly requiredCapabilities: readonly OverlayAdapterCapability[];\n readonly forbiddenAssumptions: readonly string[];\n}\n\nexport interface OverlayCompositionScaleContract {\n readonly maxWorldPanels: number;\n readonly maxFocusPanes: number;\n readonly maxAlertMarkers: number;\n readonly maxInteractivePanelsPerFrame: number;\n}\n\nexport interface PlayerSystemInterfaceContract {\n readonly featureFlagId: string;\n readonly accessibility: OverlayAccessibilityContract;\n readonly frameBudget: InterfaceFrameBudget;\n}\n\nexport interface PlayerSystemInterfacePortabilityContract {\n readonly featureFlagId: string;\n readonly hostAdapters: OverlayHostAdapterContract;\n readonly compositionScale: OverlayCompositionScaleContract;\n}\n\nexport interface PlayerSystemInterfaceContractInput {\n readonly featureFlagId?: string;\n readonly accessibility?: Partial<OverlayAccessibilityContract>;\n readonly frameBudget?: Partial<InterfaceFrameBudget>;\n}\n\nexport interface PlayerSystemInterfacePortabilityContractInput {\n readonly featureFlagId?: string;\n readonly hostAdapters?: Partial<OverlayHostAdapterContract>;\n readonly compositionScale?: Partial<OverlayCompositionScaleContract>;\n}\n\nexport type PlayerSystemInterfaceMode = \"ambient\" | \"focused\" | \"combat-safe\";\n\nexport type PlayerSystemPaneId =\n | \"identity\"\n | \"missions\"\n | \"guild-quests\"\n | \"logs\"\n | \"mcc\"\n | \"tutorial\"\n | \"points-store\";\n\nexport type InterfaceShellOwner = \"player-system\" | \"party-system\";\nexport type InterfaceShellSurfaceKind =\n | \"world-panel\"\n | \"focus-pane\"\n | \"target-popup\"\n | \"alert-marker\";\nexport type InterfaceCombatBehavior = \"persist\" | \"reduce\" | \"suspend\";\n\nexport interface InterfaceShellSurfaceDefinition {\n readonly surfaceId: string;\n readonly owner: InterfaceShellOwner;\n readonly kind: InterfaceShellSurfaceKind;\n readonly anchorId: string;\n readonly interactive: boolean;\n readonly priority: number;\n readonly combatBehavior: InterfaceCombatBehavior;\n}\n\nexport interface FocusPaneShellDefinition {\n readonly panelId: string;\n readonly owner: InterfaceShellOwner;\n readonly pane: PlayerSystemPaneId;\n readonly anchorId: string;\n readonly heading: string;\n readonly interactive: boolean;\n readonly combatBehavior: InterfaceCombatBehavior;\n}\n\nexport interface LineOfSightTargetPopupDefinition {\n readonly popupId: string;\n readonly owner: InterfaceShellOwner;\n readonly anchorId: string;\n readonly targetId: string;\n readonly summary: string;\n readonly requiresLineOfSight: boolean;\n readonly actionLabel?: string;\n}\n\nexport interface ReducedCombatOverlayPolicy {\n readonly featureFlagId: string;\n readonly mode: \"combat-safe\";\n readonly retainedSurfaceKinds: readonly InterfaceShellSurfaceKind[];\n readonly maxInteractiveSurfaces: number;\n}\n\nexport interface InterfaceShellDefinition {\n readonly featureFlagId: string;\n readonly surfaces: readonly InterfaceShellSurfaceDefinition[];\n readonly focusPane?: FocusPaneShellDefinition;\n readonly targetPopups: readonly LineOfSightTargetPopupDefinition[];\n readonly reducedCombat: ReducedCombatOverlayPolicy;\n}\n\nexport interface InterfaceShellDefinitionInput {\n readonly featureFlagId?: string;\n readonly surfaces?: readonly InterfaceShellSurfaceDefinition[];\n readonly focusPane?: FocusPaneShellDefinition;\n readonly targetPopups?: readonly LineOfSightTargetPopupDefinition[];\n readonly reducedCombat?: Partial<ReducedCombatOverlayPolicy>;\n}\n\nexport interface WorldSpacePanelDefinition {\n readonly panelId: string;\n readonly pane: PlayerSystemPaneId;\n readonly anchorId: string;\n readonly interactive: boolean;\n readonly accessibilityLabel?: string;\n readonly focusOrder?: number;\n}\n\nexport interface OverlayAlertMarker {\n readonly markerId: string;\n readonly severity: \"info\" | \"warning\" | \"danger\";\n readonly anchorId: string;\n}\n\nexport interface WorldSpaceCompositionSample {\n readonly panelCount: number;\n readonly focusPaneCount: number;\n readonly alertMarkerCount: number;\n readonly interactivePanelCount: number;\n}\n\nexport interface InterfaceContractAssessment {\n readonly accepted: boolean;\n readonly violations: readonly string[];\n}\n\nexport const PLAYER_SYSTEM_INTERFACE_PACKAGE = \"@plasius/player-system-interface\";\nexport const PLAYER_SYSTEM_INTERFACE_ENV_PREFIX = \"PLAYER_SYSTEM_INTERFACE\";\nexport const PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID =\n \"isekai.player-system.interface.enabled\";\nexport const PLAYER_SYSTEM_PACKAGES_FEATURE_FLAG_ID =\n PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID;\nexport const PLAYER_SYSTEM_RUNTIME_NFR_FEATURE_FLAG_ID =\n PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID;\nexport const PLAYER_SYSTEM_RUNTIME_PORTABILITY_FEATURE_FLAG_ID =\n PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID;\n\nexport const packageDescriptor: PackageDescriptor = Object.freeze({\n packageName: PLAYER_SYSTEM_INTERFACE_PACKAGE,\n featureFlagId: PLAYER_SYSTEM_PACKAGES_FEATURE_FLAG_ID,\n envPrefix: PLAYER_SYSTEM_INTERFACE_ENV_PREFIX,\n summary:\n \"World-space Player System overlays, focus panes, and target-surface contracts for Plasius game experiences.\",\n});\n\nexport const defaultPlayerSystemInterfaceContract: PlayerSystemInterfaceContract =\n Object.freeze({\n featureFlagId: PLAYER_SYSTEM_RUNTIME_NFR_FEATURE_FLAG_ID,\n accessibility: Object.freeze({\n keyboardPath: \"sequential\",\n focusRestorationTarget: \"trigger\",\n liveRegionMode: \"polite\",\n requiresAccessibleName: true,\n }),\n frameBudget: Object.freeze({\n targetFps: 60,\n maxFrameMs: 16,\n maxInteractivePanelsPerFrame: 2,\n }),\n });\n\nexport const defaultPlayerSystemInterfacePortabilityContract: PlayerSystemInterfacePortabilityContract =\n Object.freeze({\n featureFlagId: PLAYER_SYSTEM_RUNTIME_PORTABILITY_FEATURE_FLAG_ID,\n hostAdapters: Object.freeze({\n supportedHosts: Object.freeze([\n \"dom-overlay\",\n \"native-overlay\",\n \"headless-snapshot\",\n ] satisfies OverlayHostKind[]),\n requiredCapabilities: Object.freeze([\n \"focus-restoration\",\n \"live-region\",\n \"anchor-registry\",\n ] satisfies OverlayAdapterCapability[]),\n forbiddenAssumptions: Object.freeze([\n \"window-global\",\n \"single-pane-layout\",\n \"absolute-scene-coordinates\",\n ]),\n }),\n compositionScale: Object.freeze({\n maxWorldPanels: 6,\n maxFocusPanes: 3,\n maxAlertMarkers: 8,\n maxInteractivePanelsPerFrame: 2,\n }),\n });\n\nexport const defaultReducedCombatOverlayPolicy: ReducedCombatOverlayPolicy =\n Object.freeze({\n featureFlagId: PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID,\n mode: \"combat-safe\",\n retainedSurfaceKinds: Object.freeze([\n \"alert-marker\",\n \"target-popup\",\n \"focus-pane\",\n ] satisfies InterfaceShellSurfaceKind[]),\n maxInteractiveSurfaces: 1,\n });\n\nexport function isPlayerSystemInterfaceMode(\n value: string\n): value is PlayerSystemInterfaceMode {\n return value === \"ambient\" || value === \"focused\" || value === \"combat-safe\";\n}\n\nexport function createWorldSpacePanelDefinition(\n input: WorldSpacePanelDefinition\n): WorldSpacePanelDefinition {\n return Object.freeze({ ...input });\n}\n\nexport function createPlayerSystemInterfaceContract(\n input: PlayerSystemInterfaceContractInput = {}\n): PlayerSystemInterfaceContract {\n return Object.freeze({\n featureFlagId:\n input.featureFlagId ?? defaultPlayerSystemInterfaceContract.featureFlagId,\n accessibility: Object.freeze({\n ...defaultPlayerSystemInterfaceContract.accessibility,\n ...input.accessibility,\n }),\n frameBudget: Object.freeze({\n ...defaultPlayerSystemInterfaceContract.frameBudget,\n ...input.frameBudget,\n }),\n });\n}\n\nexport function createPlayerSystemInterfacePortabilityContract(\n input: PlayerSystemInterfacePortabilityContractInput = {}\n): PlayerSystemInterfacePortabilityContract {\n return Object.freeze({\n featureFlagId:\n input.featureFlagId ??\n defaultPlayerSystemInterfacePortabilityContract.featureFlagId,\n hostAdapters: Object.freeze({\n ...defaultPlayerSystemInterfacePortabilityContract.hostAdapters,\n ...input.hostAdapters,\n supportedHosts: Object.freeze([\n ...(input.hostAdapters?.supportedHosts ??\n defaultPlayerSystemInterfacePortabilityContract.hostAdapters\n .supportedHosts),\n ]),\n requiredCapabilities: Object.freeze([\n ...(input.hostAdapters?.requiredCapabilities ??\n defaultPlayerSystemInterfacePortabilityContract.hostAdapters\n .requiredCapabilities),\n ]),\n forbiddenAssumptions: Object.freeze([\n ...(input.hostAdapters?.forbiddenAssumptions ??\n defaultPlayerSystemInterfacePortabilityContract.hostAdapters\n .forbiddenAssumptions),\n ]),\n }),\n compositionScale: Object.freeze({\n ...defaultPlayerSystemInterfacePortabilityContract.compositionScale,\n ...input.compositionScale,\n }),\n });\n}\n\nexport function createInterfaceShellSurfaceDefinition(\n input: InterfaceShellSurfaceDefinition\n): InterfaceShellSurfaceDefinition {\n return Object.freeze({ ...input });\n}\n\nexport function createFocusPaneShellDefinition(\n input: FocusPaneShellDefinition\n): FocusPaneShellDefinition {\n return Object.freeze({ ...input });\n}\n\nexport function createLineOfSightTargetPopupDefinition(\n input: LineOfSightTargetPopupDefinition\n): LineOfSightTargetPopupDefinition {\n return Object.freeze({ ...input });\n}\n\nexport function createInterfaceShellDefinition(\n input: InterfaceShellDefinitionInput = {}\n): InterfaceShellDefinition {\n return Object.freeze({\n featureFlagId: input.featureFlagId ?? PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID,\n surfaces: Object.freeze([...(input.surfaces ?? [])]),\n focusPane: input.focusPane ? Object.freeze({ ...input.focusPane }) : undefined,\n targetPopups: Object.freeze([...(input.targetPopups ?? [])]),\n reducedCombat: Object.freeze({\n ...defaultReducedCombatOverlayPolicy,\n ...input.reducedCombat,\n retainedSurfaceKinds: Object.freeze([\n ...(input.reducedCombat?.retainedSurfaceKinds ??\n defaultReducedCombatOverlayPolicy.retainedSurfaceKinds),\n ]),\n }),\n });\n}\n\nexport function assessPlayerSystemInterfaceComposition(\n sample: WorldSpaceCompositionSample,\n contract: PlayerSystemInterfacePortabilityContract = defaultPlayerSystemInterfacePortabilityContract\n): InterfaceContractAssessment {\n const violations: string[] = [];\n\n if (sample.panelCount > contract.compositionScale.maxWorldPanels) {\n violations.push(\"panelCount\");\n }\n\n if (sample.focusPaneCount > contract.compositionScale.maxFocusPanes) {\n violations.push(\"focusPaneCount\");\n }\n\n if (sample.alertMarkerCount > contract.compositionScale.maxAlertMarkers) {\n violations.push(\"alertMarkerCount\");\n }\n\n if (\n sample.interactivePanelCount >\n contract.compositionScale.maxInteractivePanelsPerFrame\n ) {\n violations.push(\"interactivePanelCount\");\n }\n\n return Object.freeze({\n accepted: violations.length === 0,\n violations: Object.freeze(violations),\n });\n}\n\nexport function assessInterfaceShellDefinition(\n shell: InterfaceShellDefinition\n): InterfaceContractAssessment {\n const violations: string[] = [];\n const ownerSet = new Set(shell.surfaces.map((surface) => surface.owner));\n const retainedSurfaceKinds = new Set(shell.reducedCombat.retainedSurfaceKinds);\n const interactiveSurfaceCount = shell.surfaces.filter(\n (surface) => surface.interactive && retainedSurfaceKinds.has(surface.kind)\n ).length;\n const focusPane = shell.focusPane;\n\n if (shell.surfaces.length === 0) {\n violations.push(\"surfaces\");\n }\n\n if (focusPane && !ownerSet.has(focusPane.owner)) {\n violations.push(\"focusPaneOwner\");\n }\n\n if (focusPane) {\n const matchingSurface = shell.surfaces.find(\n (surface) =>\n surface.kind === \"focus-pane\" &&\n surface.anchorId === focusPane.anchorId &&\n surface.owner === focusPane.owner\n );\n if (!matchingSurface) {\n violations.push(\"focusPaneSurface\");\n }\n }\n\n if (\n interactiveSurfaceCount > shell.reducedCombat.maxInteractiveSurfaces\n ) {\n violations.push(\"interactiveSurfaceCount\");\n }\n\n for (const popup of shell.targetPopups) {\n if (popup.requiresLineOfSight && popup.anchorId.length === 0) {\n violations.push(`popup:${popup.popupId}`);\n }\n }\n\n if (\n ownerSet.has(\"player-system\") &&\n ownerSet.has(\"party-system\") &&\n shell.reducedCombat.retainedSurfaceKinds.length === 0\n ) {\n violations.push(\"reducedCombat\");\n }\n\n return Object.freeze({\n accepted: violations.length === 0,\n violations: Object.freeze(violations),\n });\n}\n"],"mappings":";AAwKO,IAAM,kCAAkC;AACxC,IAAM,qCAAqC;AAC3C,IAAM,0CACX;AACK,IAAM,yCACX;AACK,IAAM,4CACX;AACK,IAAM,oDACX;AAEK,IAAM,oBAAuC,OAAO,OAAO;AAAA,EAChE,aAAa;AAAA,EACb,eAAe;AAAA,EACf,WAAW;AAAA,EACX,SACE;AACJ,CAAC;AAEM,IAAM,uCACX,OAAO,OAAO;AAAA,EACZ,eAAe;AAAA,EACf,eAAe,OAAO,OAAO;AAAA,IAC3B,cAAc;AAAA,IACd,wBAAwB;AAAA,IACxB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B,CAAC;AAAA,EACD,aAAa,OAAO,OAAO;AAAA,IACzB,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,8BAA8B;AAAA,EAChC,CAAC;AACH,CAAC;AAEI,IAAM,kDACX,OAAO,OAAO;AAAA,EACZ,eAAe;AAAA,EACf,cAAc,OAAO,OAAO;AAAA,IAC1B,gBAAgB,OAAO,OAAO;AAAA,MAC5B;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAA6B;AAAA,IAC7B,sBAAsB,OAAO,OAAO;AAAA,MAClC;AAAA,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AS,WAAW,GAAG;AAC5D,iBAAW,KAAK,SAAS,MAAM,OAAO,EAAE;AAAA,IAC1C;AAAA,EACF;AAEA,MACE,SAAS,IAAI,eAAe,KAC5B,SAAS,IAAI,cAAc,KAC3B,MAAM,cAAc,qBAAqB,WAAW,GACpD;AACA,eAAW,KAAK,eAAe;AAAA,EACjC;AAEA,SAAO,OAAO,OAAO;AAAA,IACnB,UAAU,WAAW,WAAW;AAAA,IAChC,YAAY,OAAO,OAAO,UAAU;AAAA,EACtC,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export interface PackageDescriptor {\n readonly packageName: string;\n readonly featureFlagId: string;\n readonly envPrefix: string;\n readonly summary: string;\n}\n\nexport type OverlayKeyboardPath = \"sequential\" | \"direct-hotkey\" | \"read-only\";\n\nexport interface OverlayAccessibilityContract {\n readonly keyboardPath: OverlayKeyboardPath;\n readonly focusRestorationTarget: \"trigger\" | \"pane-heading\" | \"nearest-anchor\";\n readonly liveRegionMode: \"polite\" | \"assertive\" | \"off\";\n readonly requiresAccessibleName: boolean;\n}\n\nexport interface InterfaceFrameBudget {\n readonly targetFps: number;\n readonly maxFrameMs: number;\n readonly maxInteractivePanelsPerFrame: number;\n}\n\nexport type OverlayHostKind =\n | \"dom-overlay\"\n | \"native-overlay\"\n | \"headless-snapshot\";\n\nexport type OverlayAdapterCapability =\n | \"focus-restoration\"\n | \"live-region\"\n | \"anchor-registry\";\n\nexport interface OverlayHostAdapterContract {\n readonly supportedHosts: readonly OverlayHostKind[];\n readonly requiredCapabilities: readonly OverlayAdapterCapability[];\n readonly forbiddenAssumptions: readonly string[];\n}\n\nexport interface OverlayCompositionScaleContract {\n readonly maxWorldPanels: number;\n readonly maxFocusPanes: number;\n readonly maxAlertMarkers: number;\n readonly maxInteractivePanelsPerFrame: number;\n}\n\nexport interface PlayerSystemInterfaceContract {\n readonly featureFlagId: string;\n readonly accessibility: OverlayAccessibilityContract;\n readonly frameBudget: InterfaceFrameBudget;\n}\n\nexport interface PlayerSystemInterfacePortabilityContract {\n readonly featureFlagId: string;\n readonly hostAdapters: OverlayHostAdapterContract;\n readonly compositionScale: OverlayCompositionScaleContract;\n}\n\nexport interface PlayerSystemInterfaceContractInput {\n readonly featureFlagId?: string;\n readonly accessibility?: Partial<OverlayAccessibilityContract>;\n readonly frameBudget?: Partial<InterfaceFrameBudget>;\n}\n\nexport interface PlayerSystemInterfacePortabilityContractInput {\n readonly featureFlagId?: string;\n readonly hostAdapters?: Partial<OverlayHostAdapterContract>;\n readonly compositionScale?: Partial<OverlayCompositionScaleContract>;\n}\n\nexport type PlayerSystemInterfaceMode = \"ambient\" | \"focused\" | \"combat-safe\";\n\nexport type PlayerSystemPaneId =\n | \"identity\"\n | \"missions\"\n | \"guild-quests\"\n | \"logs\"\n | \"mcc\"\n | \"tutorial\"\n | \"points-store\";\n\nexport type InterfaceShellOwner = \"player-system\" | \"party-system\";\nexport type InterfaceShellSurfaceKind =\n | \"world-panel\"\n | \"focus-pane\"\n | \"target-popup\"\n | \"alert-marker\"\n | \"identity-overlay\";\nexport type InterfaceCombatBehavior = \"persist\" | \"reduce\" | \"suspend\";\n\nexport type IdentityProjectionRelation =\n | \"self\"\n | \"allied\"\n | \"neutral\"\n | \"unknown\"\n | \"unfriendly\";\nexport type IdentityProjectionInvocation =\n | \"self-state\"\n | \"identity-sweep\"\n | \"spell-targeting\";\nexport type IdentityProjectionReadConfidence =\n | \"complete\"\n | \"partial\"\n | \"fuzzy\"\n | \"withheld\";\nexport type IdentityProjectionPresentation = \"full\" | \"condensed\";\nexport type IdentityProjectionFact =\n | \"display-name\"\n | \"relation\"\n | \"health-band\"\n | \"status-summary\"\n | \"threat-band\"\n | \"targeting-affordance\";\n\nexport interface IdentityStatusOverlayBaseDefinition {\n readonly overlayId: string;\n readonly surfaceId: string;\n readonly readConfidence: IdentityProjectionReadConfidence;\n readonly perceivableFacts: readonly IdentityProjectionFact[];\n readonly readableFacts: readonly IdentityProjectionFact[];\n readonly presentation: IdentityProjectionPresentation;\n}\n\nexport interface IdentitySelfStateOverlayDefinition\n extends IdentityStatusOverlayBaseDefinition {\n readonly targetKind: \"self\";\n readonly relation: \"self\";\n readonly invocation: \"self-state\";\n readonly requiresLineOfSight: false;\n readonly targetId?: never;\n}\n\nexport interface IdentityTargetProjectionOverlayDefinition\n extends IdentityStatusOverlayBaseDefinition {\n readonly targetKind: \"external\";\n readonly targetId: string;\n readonly relation: Exclude<IdentityProjectionRelation, \"self\">;\n readonly invocation: Exclude<IdentityProjectionInvocation, \"self-state\">;\n readonly requiresLineOfSight: true;\n}\n\nexport type IdentityStatusOverlayDefinition =\n | IdentitySelfStateOverlayDefinition\n | IdentityTargetProjectionOverlayDefinition;\n\nexport interface InterfaceShellSurfaceDefinition {\n readonly surfaceId: string;\n readonly owner: InterfaceShellOwner;\n readonly kind: InterfaceShellSurfaceKind;\n readonly anchorId: string;\n readonly interactive: boolean;\n readonly priority: number;\n readonly combatBehavior: InterfaceCombatBehavior;\n}\n\nexport interface FocusPaneShellDefinition {\n readonly panelId: string;\n readonly owner: InterfaceShellOwner;\n readonly pane: PlayerSystemPaneId;\n readonly anchorId: string;\n readonly heading: string;\n readonly interactive: boolean;\n readonly combatBehavior: InterfaceCombatBehavior;\n}\n\nexport interface LineOfSightTargetPopupDefinition {\n readonly popupId: string;\n readonly owner: InterfaceShellOwner;\n readonly anchorId: string;\n readonly targetId: string;\n readonly summary: string;\n readonly requiresLineOfSight: boolean;\n readonly actionLabel?: string;\n}\n\nexport interface ReducedCombatOverlayPolicy {\n readonly featureFlagId: string;\n readonly mode: \"combat-safe\";\n readonly retainedSurfaceKinds: readonly InterfaceShellSurfaceKind[];\n readonly maxInteractiveSurfaces: number;\n}\n\nexport interface InterfaceShellDefinition {\n readonly featureFlagId: string;\n readonly surfaces: readonly InterfaceShellSurfaceDefinition[];\n readonly focusPane?: FocusPaneShellDefinition;\n readonly targetPopups: readonly LineOfSightTargetPopupDefinition[];\n readonly identityOverlays: readonly IdentityStatusOverlayDefinition[];\n readonly paneHosts: readonly ThreeDPaneHostDefinition[];\n readonly ambientAlerts: readonly LocalizedAmbientAlertDefinition[];\n readonly reducedCombat: ReducedCombatOverlayPolicy;\n}\n\nexport interface InterfaceShellDefinitionInput {\n readonly featureFlagId?: string;\n readonly surfaces?: readonly InterfaceShellSurfaceDefinition[];\n readonly focusPane?: FocusPaneShellDefinition;\n readonly targetPopups?: readonly LineOfSightTargetPopupDefinition[];\n readonly identityOverlays?: readonly IdentityStatusOverlayDefinition[];\n readonly paneHosts?: readonly ThreeDPaneHostDefinition[];\n readonly ambientAlerts?: readonly LocalizedAmbientAlertDefinition[];\n readonly reducedCombat?: Partial<ReducedCombatOverlayPolicy>;\n}\n\nexport type InterfaceFocusShiftReason =\n | \"keyboard\"\n | \"direct-hotkey\"\n | \"restore\"\n | \"system\";\n\nexport interface InterfaceFocusShift {\n readonly fromSurfaceId?: string;\n readonly toSurfaceId: string;\n readonly reason: InterfaceFocusShiftReason;\n}\n\nexport interface InterfaceShellStateDefinition {\n readonly featureFlagId: string;\n readonly mode: PlayerSystemInterfaceMode;\n readonly focusedSurfaceId?: string;\n readonly visibleSurfaceIds: readonly string[];\n readonly focusShift?: InterfaceFocusShift;\n}\n\nexport interface InterfaceShellStateInput {\n readonly mode: PlayerSystemInterfaceMode;\n readonly focusedSurfaceId?: string;\n}\n\nexport interface ThreeDPaneHostDefinition {\n readonly hostId: string;\n readonly owner: InterfaceShellOwner;\n readonly pane: PlayerSystemPaneId;\n readonly surfaceId: string;\n readonly anchorId: string;\n readonly supportedHosts: readonly OverlayHostKind[];\n}\n\nexport type AmbientAlertSeverity = \"info\" | \"warning\" | \"danger\";\n\nexport interface LocalizedAmbientAlertDefinition {\n readonly alertId: string;\n readonly owner: InterfaceShellOwner;\n readonly severity: AmbientAlertSeverity;\n readonly anchorId: string;\n readonly messageKey: string;\n readonly localizedMessages: Readonly<Record<string, string>>;\n readonly liveRegionMode: \"polite\" | \"assertive\";\n}\n\nexport interface WorldSpacePanelDefinition {\n readonly panelId: string;\n readonly pane: PlayerSystemPaneId;\n readonly anchorId: string;\n readonly interactive: boolean;\n readonly accessibilityLabel?: string;\n readonly focusOrder?: number;\n}\n\nexport interface OverlayAlertMarker {\n readonly markerId: string;\n readonly severity: AmbientAlertSeverity;\n readonly anchorId: string;\n}\n\nexport interface WorldSpaceCompositionSample {\n readonly panelCount: number;\n readonly focusPaneCount: number;\n readonly alertMarkerCount: number;\n readonly interactivePanelCount: number;\n}\n\nexport interface InterfaceContractAssessment {\n readonly accepted: boolean;\n readonly violations: readonly string[];\n}\n\nexport const PLAYER_SYSTEM_INTERFACE_PACKAGE = \"@plasius/player-system-interface\";\nexport const PLAYER_SYSTEM_INTERFACE_ENV_PREFIX = \"PLAYER_SYSTEM_INTERFACE\";\nexport const PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID =\n \"isekai.player-system.interface.enabled\";\nexport const PLAYER_SYSTEM_PACKAGES_FEATURE_FLAG_ID =\n PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID;\nexport const PLAYER_SYSTEM_RUNTIME_NFR_FEATURE_FLAG_ID =\n PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID;\nexport const PLAYER_SYSTEM_RUNTIME_PORTABILITY_FEATURE_FLAG_ID =\n PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID;\nexport const PLAYER_SYSTEM_IDENTITY_FEATURE_FLAG_ID =\n \"isekai.player-system.identity.enabled\";\n\nexport const packageDescriptor: PackageDescriptor = Object.freeze({\n packageName: PLAYER_SYSTEM_INTERFACE_PACKAGE,\n featureFlagId: PLAYER_SYSTEM_PACKAGES_FEATURE_FLAG_ID,\n envPrefix: PLAYER_SYSTEM_INTERFACE_ENV_PREFIX,\n summary:\n \"World-space Player System overlays, focus panes, and target-surface contracts for Plasius game experiences.\",\n});\n\nexport const defaultPlayerSystemInterfaceContract: PlayerSystemInterfaceContract =\n Object.freeze({\n featureFlagId: PLAYER_SYSTEM_RUNTIME_NFR_FEATURE_FLAG_ID,\n accessibility: Object.freeze({\n keyboardPath: \"sequential\",\n focusRestorationTarget: \"trigger\",\n liveRegionMode: \"polite\",\n requiresAccessibleName: true,\n }),\n frameBudget: Object.freeze({\n targetFps: 60,\n maxFrameMs: 16,\n maxInteractivePanelsPerFrame: 2,\n }),\n });\n\nexport const defaultPlayerSystemInterfacePortabilityContract: PlayerSystemInterfacePortabilityContract =\n Object.freeze({\n featureFlagId: PLAYER_SYSTEM_RUNTIME_PORTABILITY_FEATURE_FLAG_ID,\n hostAdapters: Object.freeze({\n supportedHosts: Object.freeze([\n \"dom-overlay\",\n \"native-overlay\",\n \"headless-snapshot\",\n ] satisfies OverlayHostKind[]),\n requiredCapabilities: Object.freeze([\n \"focus-restoration\",\n \"live-region\",\n \"anchor-registry\",\n ] satisfies OverlayAdapterCapability[]),\n forbiddenAssumptions: Object.freeze([\n \"window-global\",\n \"single-pane-layout\",\n \"absolute-scene-coordinates\",\n ]),\n }),\n compositionScale: Object.freeze({\n maxWorldPanels: 6,\n maxFocusPanes: 3,\n maxAlertMarkers: 8,\n maxInteractivePanelsPerFrame: 2,\n }),\n });\n\nexport const defaultReducedCombatOverlayPolicy: ReducedCombatOverlayPolicy =\n Object.freeze({\n featureFlagId: PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID,\n mode: \"combat-safe\",\n retainedSurfaceKinds: Object.freeze([\n \"alert-marker\",\n \"target-popup\",\n \"focus-pane\",\n \"identity-overlay\",\n ] satisfies InterfaceShellSurfaceKind[]),\n maxInteractiveSurfaces: 1,\n });\n\nexport function isPlayerSystemInterfaceMode(\n value: string\n): value is PlayerSystemInterfaceMode {\n return value === \"ambient\" || value === \"focused\" || value === \"combat-safe\";\n}\n\nexport function createWorldSpacePanelDefinition(\n input: WorldSpacePanelDefinition\n): WorldSpacePanelDefinition {\n return Object.freeze({ ...input });\n}\n\nexport function createPlayerSystemInterfaceContract(\n input: PlayerSystemInterfaceContractInput = {}\n): PlayerSystemInterfaceContract {\n return Object.freeze({\n featureFlagId:\n input.featureFlagId ?? defaultPlayerSystemInterfaceContract.featureFlagId,\n accessibility: Object.freeze({\n ...defaultPlayerSystemInterfaceContract.accessibility,\n ...input.accessibility,\n }),\n frameBudget: Object.freeze({\n ...defaultPlayerSystemInterfaceContract.frameBudget,\n ...input.frameBudget,\n }),\n });\n}\n\nexport function createPlayerSystemInterfacePortabilityContract(\n input: PlayerSystemInterfacePortabilityContractInput = {}\n): PlayerSystemInterfacePortabilityContract {\n return Object.freeze({\n featureFlagId:\n input.featureFlagId ??\n defaultPlayerSystemInterfacePortabilityContract.featureFlagId,\n hostAdapters: Object.freeze({\n ...defaultPlayerSystemInterfacePortabilityContract.hostAdapters,\n ...input.hostAdapters,\n supportedHosts: Object.freeze([\n ...(input.hostAdapters?.supportedHosts ??\n defaultPlayerSystemInterfacePortabilityContract.hostAdapters\n .supportedHosts),\n ]),\n requiredCapabilities: Object.freeze([\n ...(input.hostAdapters?.requiredCapabilities ??\n defaultPlayerSystemInterfacePortabilityContract.hostAdapters\n .requiredCapabilities),\n ]),\n forbiddenAssumptions: Object.freeze([\n ...(input.hostAdapters?.forbiddenAssumptions ??\n defaultPlayerSystemInterfacePortabilityContract.hostAdapters\n .forbiddenAssumptions),\n ]),\n }),\n compositionScale: Object.freeze({\n ...defaultPlayerSystemInterfacePortabilityContract.compositionScale,\n ...input.compositionScale,\n }),\n });\n}\n\nexport function createInterfaceShellSurfaceDefinition(\n input: InterfaceShellSurfaceDefinition\n): InterfaceShellSurfaceDefinition {\n return Object.freeze({ ...input });\n}\n\nexport function createFocusPaneShellDefinition(\n input: FocusPaneShellDefinition\n): FocusPaneShellDefinition {\n return Object.freeze({ ...input });\n}\n\nexport function createLineOfSightTargetPopupDefinition(\n input: LineOfSightTargetPopupDefinition\n): LineOfSightTargetPopupDefinition {\n return Object.freeze({ ...input });\n}\n\nexport function createIdentityStatusOverlayDefinition(\n input: IdentityStatusOverlayDefinition\n): IdentityStatusOverlayDefinition {\n return Object.freeze({\n ...input,\n perceivableFacts: Object.freeze([...input.perceivableFacts]),\n readableFacts: Object.freeze([...input.readableFacts]),\n });\n}\n\nexport function createThreeDPaneHostDefinition(\n input: ThreeDPaneHostDefinition\n): ThreeDPaneHostDefinition {\n return Object.freeze({\n ...input,\n supportedHosts: Object.freeze([...input.supportedHosts]),\n });\n}\n\nexport function createLocalizedAmbientAlertDefinition(\n input: LocalizedAmbientAlertDefinition\n): LocalizedAmbientAlertDefinition {\n return Object.freeze({\n ...input,\n localizedMessages: Object.freeze({ ...input.localizedMessages }),\n });\n}\n\nexport function createInterfaceShellDefinition(\n input: InterfaceShellDefinitionInput = {}\n): InterfaceShellDefinition {\n return Object.freeze({\n featureFlagId: input.featureFlagId ?? PLAYER_SYSTEM_INTERFACE_FEATURE_FLAG_ID,\n surfaces: Object.freeze([...(input.surfaces ?? [])]),\n focusPane: input.focusPane ? Object.freeze({ ...input.focusPane }) : undefined,\n targetPopups: Object.freeze([...(input.targetPopups ?? [])]),\n identityOverlays: Object.freeze([...(input.identityOverlays ?? [])]),\n paneHosts: Object.freeze([...(input.paneHosts ?? [])]),\n ambientAlerts: Object.freeze([...(input.ambientAlerts ?? [])]),\n reducedCombat: Object.freeze({\n ...defaultReducedCombatOverlayPolicy,\n ...input.reducedCombat,\n retainedSurfaceKinds: Object.freeze([\n ...(input.reducedCombat?.retainedSurfaceKinds ??\n defaultReducedCombatOverlayPolicy.retainedSurfaceKinds),\n ]),\n }),\n });\n}\n\nexport function createInterfaceShellState(\n shell: InterfaceShellDefinition,\n input: InterfaceShellStateInput\n): InterfaceShellStateDefinition {\n const retainedSurfaceKinds = new Set(\n shell.reducedCombat.retainedSurfaceKinds\n );\n const visibleSurfaceIds = shell.surfaces\n .filter(\n (surface) =>\n input.mode !== \"combat-safe\" ||\n (surface.combatBehavior !== \"suspend\" &&\n retainedSurfaceKinds.has(surface.kind))\n )\n .map((surface) => surface.surfaceId);\n\n if (\n input.focusedSurfaceId &&\n !visibleSurfaceIds.includes(input.focusedSurfaceId)\n ) {\n throw new RangeError(\n `Focused surface '${input.focusedSurfaceId}' is not visible in ${input.mode} mode`\n );\n }\n\n return Object.freeze({\n featureFlagId: shell.featureFlagId,\n mode: input.mode,\n focusedSurfaceId:\n input.mode === \"focused\" ? input.focusedSurfaceId : undefined,\n visibleSurfaceIds: Object.freeze(visibleSurfaceIds),\n });\n}\n\nexport function applyInterfaceShellFocusShift(\n state: InterfaceShellStateDefinition,\n focusShift: InterfaceFocusShift\n): InterfaceShellStateDefinition {\n if (!state.visibleSurfaceIds.includes(focusShift.toSurfaceId)) {\n throw new RangeError(\n `Focused surface '${focusShift.toSurfaceId}' is not visible in ${state.mode} mode`\n );\n }\n\n return Object.freeze({\n ...state,\n mode: \"focused\",\n focusedSurfaceId: focusShift.toSurfaceId,\n focusShift: Object.freeze({ ...focusShift }),\n });\n}\n\nexport function resolveLocalizedAmbientAlertMessage(\n alert: LocalizedAmbientAlertDefinition,\n locale: string,\n fallbackLocale = \"en-GB\"\n): string | undefined {\n return alert.localizedMessages[locale] ?? alert.localizedMessages[fallbackLocale];\n}\n\nexport function assessIdentityStatusOverlayDefinition(\n overlay: IdentityStatusOverlayDefinition\n): InterfaceContractAssessment {\n const violations: string[] = [];\n const perceivableFacts = new Set(overlay.perceivableFacts);\n\n if (overlay.readableFacts.some((fact) => !perceivableFacts.has(fact))) {\n violations.push(\"readableFacts\");\n }\n\n if (overlay.readConfidence === \"withheld\" && overlay.readableFacts.length > 0) {\n violations.push(\"withheldRead\");\n }\n\n if (overlay.targetKind === \"self\") {\n if (overlay.relation !== \"self\") {\n violations.push(\"selfRelation\");\n }\n if (overlay.invocation !== \"self-state\") {\n violations.push(\"selfInvocation\");\n }\n if (overlay.requiresLineOfSight) {\n violations.push(\"selfLineOfSight\");\n }\n } else {\n if (overlay.targetId.length === 0) {\n violations.push(\"targetId\");\n }\n if (!overlay.requiresLineOfSight) {\n violations.push(\"lineOfSight\");\n }\n }\n\n return Object.freeze({\n accepted: violations.length === 0,\n violations: Object.freeze(violations),\n });\n}\n\nexport function assessPlayerSystemInterfaceComposition(\n sample: WorldSpaceCompositionSample,\n contract: PlayerSystemInterfacePortabilityContract = defaultPlayerSystemInterfacePortabilityContract\n): InterfaceContractAssessment {\n const violations: string[] = [];\n\n if (sample.panelCount > contract.compositionScale.maxWorldPanels) {\n violations.push(\"panelCount\");\n }\n\n if (sample.focusPaneCount > contract.compositionScale.maxFocusPanes) {\n violations.push(\"focusPaneCount\");\n }\n\n if (sample.alertMarkerCount > contract.compositionScale.maxAlertMarkers) {\n violations.push(\"alertMarkerCount\");\n }\n\n if (\n sample.interactivePanelCount >\n contract.compositionScale.maxInteractivePanelsPerFrame\n ) {\n violations.push(\"interactivePanelCount\");\n }\n\n return Object.freeze({\n accepted: violations.length === 0,\n violations: Object.freeze(violations),\n });\n}\n\nexport function assessInterfaceShellDefinition(\n shell: InterfaceShellDefinition\n): InterfaceContractAssessment {\n const violations: string[] = [];\n const ownerSet = new Set(shell.surfaces.map((surface) => surface.owner));\n const retainedSurfaceKinds = new Set(shell.reducedCombat.retainedSurfaceKinds);\n const interactiveSurfaceCount = shell.surfaces.filter(\n (surface) => surface.interactive && retainedSurfaceKinds.has(surface.kind)\n ).length;\n const focusPane = shell.focusPane;\n\n if (shell.surfaces.length === 0) {\n violations.push(\"surfaces\");\n }\n\n if (focusPane && !ownerSet.has(focusPane.owner)) {\n violations.push(\"focusPaneOwner\");\n }\n\n if (focusPane) {\n const matchingSurface = shell.surfaces.find(\n (surface) =>\n surface.kind === \"focus-pane\" &&\n surface.anchorId === focusPane.anchorId &&\n surface.owner === focusPane.owner\n );\n if (!matchingSurface) {\n violations.push(\"focusPaneSurface\");\n }\n }\n\n if (\n interactiveSurfaceCount > shell.reducedCombat.maxInteractiveSurfaces\n ) {\n violations.push(\"interactiveSurfaceCount\");\n }\n\n for (const popup of shell.targetPopups) {\n if (popup.requiresLineOfSight && popup.anchorId.length === 0) {\n violations.push(`popup:${popup.popupId}`);\n }\n }\n\n for (const overlay of shell.identityOverlays) {\n const identityAssessment = assessIdentityStatusOverlayDefinition(overlay);\n for (const violation of identityAssessment.violations) {\n violations.push(`identityOverlay:${overlay.overlayId}:${violation}`);\n }\n\n const matchingSurface = shell.surfaces.find(\n (surface) =>\n surface.surfaceId === overlay.surfaceId &&\n surface.kind === \"identity-overlay\"\n );\n if (!matchingSurface) {\n violations.push(`identityOverlaySurface:${overlay.overlayId}`);\n }\n }\n\n for (const paneHost of shell.paneHosts) {\n const matchingSurface = shell.surfaces.find(\n (surface) =>\n surface.surfaceId === paneHost.surfaceId &&\n surface.owner === paneHost.owner &&\n surface.anchorId === paneHost.anchorId\n );\n if (!matchingSurface) {\n violations.push(`paneHost:${paneHost.hostId}`);\n }\n }\n\n for (const alert of shell.ambientAlerts) {\n if (Object.keys(alert.localizedMessages).length === 0) {\n violations.push(`alert:${alert.alertId}`);\n }\n }\n\n if (\n ownerSet.has(\"player-system\") &&\n ownerSet.has(\"party-system\") &&\n shell.reducedCombat.retainedSurfaceKinds.length === 0\n ) {\n violations.push(\"reducedCombat\");\n }\n\n return Object.freeze({\n accepted: violations.length === 0,\n violations: Object.freeze(violations),\n });\n}\n"],"mappings":";AAoRO,IAAM,kCAAkC;AACxC,IAAM,qCAAqC;AAC3C,IAAM,0CACX;AACK,IAAM,yCACX;AACK,IAAM,4CACX;AACK,IAAM,oDACX;AACK,IAAM,yCACX;AAEK,IAAM,oBAAuC,OAAO,OAAO;AAAA,EAChE,aAAa;AAAA,EACb,eAAe;AAAA,EACf,WAAW;AAAA,EACX,SACE;AACJ,CAAC;AAEM,IAAM,uCACX,OAAO,OAAO;AAAA,EACZ,eAAe;AAAA,EACf,eAAe,OAAO,OAAO;AAAA,IAC3B,cAAc;AAAA,IACd,wBAAwB;AAAA,IACxB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B,CAAC;AAAA,EACD,aAAa,OAAO,OAAO;AAAA,IACzB,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M,eAAe;AACvC,QAAI,OAAO,KAAK,MAAM,iBAAiB,EAAE,WAAW,GAAG;AACrD,iBAAW,KAAK,SAAS,MAAM,OAAO,EAAE;AAAA,IAC1C;AAAA,EACF;AAEA,MACE,SAAS,IAAI,eAAe,KAC5B,SAAS,IAAI,cAAc,KAC3B,MAAM,cAAc,qBAAqB,WAAW,GACpD;AACA,eAAW,KAAK,eAAe;AAAA,EACjC;AAEA,SAAO,OAAO,OAAO;AAAA,IACnB,UAAU,WAAW,WAAW;AAAA,IAChC,YAAY,OAAO,OAAO,UAAU;AAAA,EACtC,CAAC;AACH;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasius/player-system-interface",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "World-space Player System overlays, focus panes, and target-surface contracts for Plasius game experiences",
5
5
  "type": "module",
6
6
  "sideEffects": false,