@dreamboard-games/sdk 0.5.0-alpha.32 → 0.5.0-alpha.34

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.
@@ -1,7 +1,6 @@
1
- import { Store } from '@tanstack/store';
2
- import { j as BoardSpaceTarget, bh as TopologyDefinitions, h as BoardIdOfTable, bb as TileSpaceId, aZ as SeatSpaceRef, b0 as SpaceIdOfTable, be as TiledBoardIdOfTable, bf as TiledEdgeIdOfTable, bg as TiledVertexIdOfTable, k as BoardStateOfTable, at as PositionTarget, a_ as SeatTileRef, aP as RuntimeJson, aX as SeatBoardTopology, a5 as InteractionInputDescriptor, U as InputDomain, aq as PhaseNamesOfDefinition, a4 as InteractionIdOfDefinitionPhase, s as ClientParamsOfInteractionOfDefinition, T as InputCollectorOfDefinition, bq as ViewOfDefinition, ay as ProjectedTile, aA as ReadonlyRuntimeData, l as BoardTopologyOf, P as HiddenCardId, bk as ViewCard, bl as ViewCardOfTable, I as GameEvent } from './extract-Bi6_tzUr.js';
3
- import { g as SourceSnapshot, h as SourceState, i as SubmitResult, G as GameSource, I as InteractionDescriptor } from './types-BlvVQ9WL.js';
1
+ import { l as BoardSpaceTarget, bx as TopologyDefinitions, j as BoardIdOfTable, br as TileSpaceId, b9 as SeatSpaceRef, bf as SpaceIdOfTable, bu as TiledBoardIdOfTable, bv as TiledEdgeIdOfTable, bw as TiledVertexIdOfTable, m as BoardStateOfTable, aE as PositionTarget, ba as SeatTileRef, a$ as RuntimeJson, b7 as SeatBoardTopology, bd as SourceSnapshot, be as SourceState, bi as SubmitResult, ac as InteractionInputDescriptor, $ as InputDomain, S as GameSource, ax as PhaseNamesOfDefinition, ab as InteractionIdOfDefinitionPhase, w as ClientParamsOfInteractionOfDefinition, _ as InputCollectorOfDefinition, bG as ViewOfDefinition, a8 as InteractionDescriptor, aJ as ProjectedTile, aL as ReadonlyRuntimeData, n as BoardTopologyOf, W as HiddenCardId, bA as ViewCard, bB as ViewCardOfTable, N as GameEvent } from './extract-CNUw9Q8C.js';
4
2
  import { z } from 'zod';
3
+ import { Store } from '@tanstack/store';
5
4
 
6
5
  type RuntimeBoardTarget = {
7
6
  readonly valueKind: "board-id";
@@ -703,122 +702,4 @@ type GameInstance<G, F extends Features = Record<never, never>, S extends GameSo
703
702
  explore(...args: A): R;
704
703
  } : Record<never, never>);
705
704
 
706
- /** A zone control carries the actual admitted attachment, including its host. */
707
- type ShortcutZoneTarget<G> = {
708
- [Z in IdOf<G, "zoneId">]: {
709
- readonly kind: "zone";
710
- readonly zoneId: Z;
711
- readonly hostId: ZoneHostId<G, Z>;
712
- };
713
- }[IdOf<G, "zoneId">];
714
- type ShortcutTarget<G> = SelectionTarget<G> | ShortcutZoneTarget<G>;
715
- type TargetKind = SelectionTarget<unknown>["kind"];
716
- type CollectorKind<Kind extends TargetKind> = Kind extends "space" ? "board-space" : Kind extends "edge" ? "board-edge" : Kind extends "vertex" ? "board-vertex" : Kind;
717
- type TargetFor<G, K extends InteractionKey<G>, N extends InputKey<G, K>, Kind extends TargetKind> = Extract<SelectionTarget<G>, {
718
- readonly kind: Kind;
719
- }> & {
720
- readonly value: InputTarget<G, K, N>;
721
- };
722
- type Binding<G, K extends InteractionKey<G>, Target, Filter> = Filter & {
723
- /** Exact browser event.key values; modifiers and held repeats are ignored. */
724
- readonly keys: readonly string[];
725
- readonly label: string;
726
- readonly kind: "interaction";
727
- readonly interaction: K;
728
- readonly inputs: (context: {
729
- readonly key: string;
730
- readonly target: Target;
731
- }) => InteractionParams<G, K>;
732
- };
733
- type SelectionBinding<G, K extends InteractionKey<G>> = {
734
- [N in InputKey<G, K>]: {
735
- [Kind in TargetKind]: [
736
- Extract<InputKind<G, K, N>, CollectorKind<Kind>>
737
- ] extends [never] ? never : Binding<G, K, TargetFor<G, K, N, Kind>, {
738
- readonly target: Kind;
739
- readonly input: N;
740
- }>;
741
- }[TargetKind];
742
- }[InputKey<G, K>];
743
- /** Correlated by interaction, input kind, and the selected target's value. */
744
- type InteractionShortcutBinding<G> = {
745
- [K in InteractionKey<G>]: SelectionBinding<G, K> | {
746
- [Z in IdOf<G, "zoneId">]: Binding<G, K, Extract<ShortcutZoneTarget<G>, {
747
- readonly zoneId: Z;
748
- }>, {
749
- readonly target: "zone";
750
- readonly zoneId: Z;
751
- }>;
752
- }[IdOf<G, "zoneId">];
753
- }[InteractionKey<G>];
754
- /** Local presentation actions run only from control focus, independent of reducer turns. */
755
- type LocalShortcutBinding<G> = {
756
- [Z in IdOf<G, "zoneId">]: {
757
- readonly kind: "local";
758
- readonly keys: readonly string[];
759
- readonly label: string;
760
- readonly target: "zone";
761
- readonly zoneId: Z;
762
- /** Pure applicability predicate, also evaluated for hints. */
763
- readonly getIsAvailable?: (context: {
764
- readonly key: string;
765
- readonly target: Extract<ShortcutZoneTarget<G>, {
766
- readonly zoneId: Z;
767
- }>;
768
- }) => boolean;
769
- readonly run: (context: {
770
- readonly key: string;
771
- readonly target: Extract<ShortcutZoneTarget<G>, {
772
- readonly zoneId: Z;
773
- }>;
774
- }) => void | Promise<void>;
775
- };
776
- }[IdOf<G, "zoneId">];
777
- type ShortcutBinding<G> = InteractionShortcutBinding<G> | LocalShortcutBinding<G>;
778
- interface ShortcutOptions<G> {
779
- readonly bindings: readonly ShortcutBinding<G>[];
780
- }
781
- type ShortcutHint<G = unknown> = {
782
- readonly keys: readonly string[];
783
- readonly label: string;
784
- } & ({
785
- readonly kind: "interaction";
786
- readonly interaction: InteractionKey<G>;
787
- } | {
788
- readonly kind: "local";
789
- });
790
- type ShortcutResult = {
791
- readonly kind: "interaction";
792
- readonly result: SubmitResult;
793
- } | {
794
- readonly kind: "local";
795
- };
796
- /** Mounted control activity; explicit-target interaction menus need no focus. */
797
- interface ShortcutActivity<G> {
798
- readonly focusedTarget: ShortcutTarget<G> | null;
799
- /** Card press, drag, or submitted drag overlay still settling. */
800
- readonly pointerActive: boolean;
801
- /** The latest press was a finger, so there are no keys to show. */
802
- readonly touch: boolean;
803
- }
804
- interface ShortcutsController<G> {
805
- /** UI binding configuration has its own subscription, independent of reducer frames. */
806
- readonly configuration: Pick<Store<ShortcutOptions<G> | null>, "get" | "subscribe">;
807
- /** Registers one mounted adapter. Cleanup removes both behavior and hints. */
808
- register(options: ShortcutOptions<G>): {
809
- update(options: ShortcutOptions<G>): void;
810
- dispose(): void;
811
- };
812
- /** null means unhandled; a handled key runs or submits exactly once. */
813
- handle(key: string, target: ShortcutTarget<G> | null, activity?: ShortcutActivity<G>): Promise<ShortcutResult> | null;
814
- getHints(target: ShortcutTarget<G> | null, activity?: ShortcutActivity<G>): readonly ShortcutHint<G>[];
815
- }
816
- /** Headless and opt-in: no names, bindings or browser listeners are installed by default. */
817
- declare function shortcutsFeature<G>(_game: CoreInstance<G>, context: FeatureContext<G>): {
818
- root: {
819
- shortcuts: ShortcutsController<G>;
820
- };
821
- dispose(): void;
822
- };
823
-
824
- export { type RuntimeBoardDropTarget as $, type ActionProps as A, type Board as B, type Card as C, type Drafts as D, type InputTargetOption as E, type Feature as F, type GameInstance as G, type Hook as H, type IdOf as I, type InstanceOptions as J, type Interaction as K, type InteractionBase as L, type InteractionDropTarget as M, type InteractionKey as N, type InteractionParams as O, type InteractionShortcutBinding as P, type LocalShortcutBinding as Q, type LocalState as R, type NativeEvent as S, type Phase as T, type PhaseName as U, type PlacedTileDataOf as V, type Player as W, type PositionDropTarget as X, type ReadModel as Y, type ReadonlyData as Z, type RuntimeBoard as _, type AnyInput as a, type RuntimeBoardTarget as a0, type RuntimeDropTarget as a1, type RuntimeInteractionDropTarget as a2, type RuntimePositionDropTarget as a3, type RuntimeSelectionTarget as a4, type RuntimeTargetOptions as a5, type SeatCardId as a6, type SelectionTarget as a7, type ShortcutActivity as a8, type ShortcutBinding as a9, type ShortcutHint as aa, type ShortcutOptions as ab, type ShortcutResult as ac, type ShortcutTarget as ad, type ShortcutZoneTarget as ae, type ShortcutsController as af, type TableOfGame as ag, type TargetOptions as ah, type Tile as ai, type TileDataOf as aj, type Turn as ak, type ViewOf as al, type Zone as am, type ZoneBase as an, type ZoneHostId as ao, shortcutsFeature as ap, type AnyInteraction as b, type BoardBase as c, type BoardCollection as d, type BoardDataOf as e, type BoardDropTarget as f, type BoardSpace as g, type BoardSpaceCollection as h, type BoardSpaceData as i, type BoardSpaceId as j, type BoardTarget as k, type CardBase as l, type CardDataOf as m, type CoreInstance as n, type DropAreaBinding as o, type DropTarget as p, type FeatureContext as q, type Features as r, type GameSnapshot as s, type Input as t, type InputBase as u, type InputControl as v, type InputDomainOf as w, type InputKey as x, type InputKind as y, type InputTarget as z };
705
+ export type { RuntimeDropTarget as $, ActionProps as A, Board as B, Card as C, Drafts as D, InputTargetOption as E, Feature as F, GameInstance as G, Hook as H, IdOf as I, InstanceOptions as J, Interaction as K, InteractionBase as L, InteractionDropTarget as M, InteractionKey as N, InteractionParams as O, LocalState as P, NativeEvent as Q, Phase as R, PhaseName as S, PlacedTileDataOf as T, Player as U, PositionDropTarget as V, ReadModel as W, ReadonlyData as X, RuntimeBoard as Y, RuntimeBoardDropTarget as Z, RuntimeBoardTarget as _, AnyInput as a, RuntimeInteractionDropTarget as a0, RuntimePositionDropTarget as a1, RuntimeSelectionTarget as a2, RuntimeTargetOptions as a3, SeatCardId as a4, SelectionTarget as a5, TableOfGame as a6, TargetOptions as a7, Tile as a8, TileDataOf as a9, Turn as aa, ViewOf as ab, Zone as ac, ZoneBase as ad, ZoneHostId as ae, AnyInteraction as b, BoardBase as c, BoardCollection as d, BoardDataOf as e, BoardDropTarget as f, BoardSpace as g, BoardSpaceCollection as h, BoardSpaceData as i, BoardSpaceId as j, BoardTarget as k, CardBase as l, CardDataOf as m, CoreInstance as n, DropAreaBinding as o, DropTarget as p, FeatureContext as q, Features as r, GameSnapshot as s, Input as t, InputBase as u, InputControl as v, InputDomainOf as w, InputKey as x, InputKind as y, InputTarget as z };
package/dist/react.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import * as react from 'react';
2
2
  import { PointerEvent, FocusEvent, MouseEvent, DragEvent, CSSProperties, ReactNode } from 'react';
3
- import { at as PositionTarget, bt as ZoneVisibility } from './extract-Bi6_tzUr.js';
4
- import { ah as TargetOptions, r as Features, C as Card, a6 as SeatCardId, p as DropTarget, I as IdOf, ao as ZoneHostId, ae as ShortcutZoneTarget, J as InstanceOptions, n as CoreInstance, q as FeatureContext, G as GameInstance, s as GameSnapshot, ab as ShortcutOptions, ad as ShortcutTarget, aa as ShortcutHint, o as DropAreaBinding } from './shortcuts-CuQXWAMv.js';
5
- import { G as GameSource } from './types-BlvVQ9WL.js';
3
+ import { aE as PositionTarget, bL as ZoneVisibility, S as GameSource } from './extract-CNUw9Q8C.js';
4
+ import { f as ShortcutZoneTarget, c as ShortcutOptions, e as ShortcutTarget, b as ShortcutHint } from './shortcuts-Br5h9mEV.js';
5
+ import { a7 as TargetOptions, r as Features, C as Card, a4 as SeatCardId, p as DropTarget, I as IdOf, ae as ZoneHostId, J as InstanceOptions, n as CoreInstance, q as FeatureContext, G as GameInstance, s as GameSnapshot, o as DropAreaBinding } from './model-BD0OKVEc.js';
6
+ import '@tanstack/store';
6
7
  import 'zod';
7
8
  import 'honeycomb-grid';
8
- import '@tanstack/store';
9
9
 
10
10
  /** How the dragged card would show where it lands if dropped now. */
11
11
  interface DragFit {
package/dist/reducer.d.ts CHANGED
@@ -1,11 +1,13 @@
1
- import { ae as ManifestIdSchema, aV as SchemaLike, t as CollectorState, S as InputCollector, as as PlayerIdOfState, b6 as TableQueriesOfState, aM as ResourceMapDomainDescriptor, p as BoundedNumberDomainDescriptor, q as ChoiceDomainDescriptor, r as ChoiceListDomainDescriptor, bh as TopologyDefinitions, v as CollectorValueWitness, u as CollectorValueOf, X as InputSelectionDescriptor, aH as ReducerManifestContractLike, aT as RuntimeTableRecord, aS as RuntimeRecord, b2 as StateDefinition, ac as ManifestContractOf, B as BaseGameStateOfContract, E as ErrorCodeOfContract, be as TiledBoardIdOfTable, b4 as TableOfManifest, bg as TiledVertexIdOfTable, bf as TiledEdgeIdOfTable, h as BoardIdOfTable, b0 as SpaceIdOfTable, j as BoardSpaceTarget, an as PerPlayerInstanceId, bs as ZoneIdOfTable, C as CardIdOfManifest, au as PositionTargetSchema, at as PositionTarget, b9 as TileIdOfTable, ah as OptionsOfContract, aJ as ReducerTransaction, bn as ViewData, bo as ViewDefinition, ap as PhaseMapOf, bp as ViewOfContract, aF as ReducerGameDefinitionInput, aE as ReducerGameDefinition, ab as InteractionSteps, aW as ScopedPhaseState, a9 as InteractionSpec, a8 as InteractionRule, a7 as InteractionMap, ao as PhaseDefinition, aG as ReducerManifestContract, aC as ReducerGameContract, x as CompiledManifestWitness, w as CompiledManifest, b3 as SystemActionEvent, aD as ReducerGameContractLike, aR as RuntimeQueryTable, br as ZoneDefinitions, b5 as TableQueries, aU as SchemaAuthoring, O as GameTopologyManifest$1, z as FieldsInput, c as AuthoredTileDisclosure, aO as RuntimeIdsFromCount, bc as TileSpaceIds, g as BoardEdgeRef, o as BoardVertexRef, ad as ManifestCountValidation, bi as ValidatedManifest, a as AuthoredManifest, aA as ReadonlyRuntimeData, b as AuthoredOf } from './extract-Bi6_tzUr.js';
2
- export { d as AuthoredTileFaceAudience, f as BoardEdgeId, i as BoardSpaceHostId, n as BoardVertexId, F as FieldSchema, G as FieldsOutput, H as FrameworkErrorCodes, I as GameEvent, J as GameEventDetail, L as GameOutcome, af as ManifestIdsOf, ag as ManifestTable, ai as OutcomeResult, aj as OutcomeScoreComponent, ak as OutcomeStanding, al as OutcomeTieBreak, am as PerPlayerInstanceFamily, ar as PlayerId, az as PublicTileAppearance, aK as ReducerTransactionOutcome, aL as ReducerValidationResult, bD as ReducerWire, bC as ReducerWireZod, aN as RotateZoneArgs, aZ as SeatSpaceRef, a_ as SeatTileRef, b1 as SquareBoardSpec, b7 as TileDisclosure, b8 as TileFaceAudience, ba as TileSeedSpec, bb as TileSpaceId, bd as TileTypeSpec, bj as ValidationIssue, bu as asPlayerId, bv as boardSpaceHostId, bw as isPlayerId, bx as parseBoardSpaceHostId, by as parsePerPlayerInstanceId, bz as parseTileSpaceId, bA as perPlayerInstanceId, bB as ref, bE as tileSpaceId } from './extract-Bi6_tzUr.js';
1
+ import { al as ManifestIdSchema, b5 as SchemaLike, x as CollectorState, Z as InputCollector, aA as PlayerIdOfState, bm as TableQueriesOfState, aY as ResourceMapDomainDescriptor, t as BoundedNumberDomainDescriptor, u as ChoiceDomainDescriptor, v as ChoiceListDomainDescriptor, bx as TopologyDefinitions, z as CollectorValueWitness, y as CollectorValueOf, a2 as InputSelectionDescriptor, aS as ReducerManifestContractLike, b3 as RuntimeTableRecord, b2 as RuntimeRecord, bh as StateDefinition, aj as ManifestContractOf, B as BaseGameStateOfContract, I as ErrorCodeOfContract, bu as TiledBoardIdOfTable, bk as TableOfManifest, bw as TiledVertexIdOfTable, bv as TiledEdgeIdOfTable, j as BoardIdOfTable, bf as SpaceIdOfTable, l as BoardSpaceTarget, au as PerPlayerInstanceId, bJ as ZoneIdOfTable, C as CardIdOfManifest, aF as PositionTargetSchema, aE as PositionTarget, bp as TileIdOfTable, ao as OptionsOfContract, aV as ReducerTransaction, bD as ViewData, bE as ViewDefinition, aw as PhaseMapOf, bF as ViewOfContract, aQ as ReducerGameDefinitionInput, aP as ReducerGameDefinition, ai as InteractionSteps, b6 as ScopedPhaseState, ag as InteractionSpec, af as InteractionRule, ae as InteractionMap, av as PhaseDefinition, aR as ReducerManifestContract, aN as ReducerGameContract, F as CompiledManifestWitness, E as CompiledManifest, bj as SystemActionEvent, ax as PhaseNamesOfDefinition, ab as InteractionIdOfDefinitionPhase, w as ClientParamsOfInteractionOfDefinition, s as BotStrategyMetadata, aB as PluginGameplayFrame, bG as ViewOfDefinition, aO as ReducerGameContractLike, b1 as RuntimeQueryTable, bH as ZoneDefinitions, bl as TableQueries, b4 as SchemaAuthoring, U as GameTopologyManifest$1, K as FieldsInput, e as AuthoredTileDisclosure, a_ as RuntimeIdsFromCount, bs as TileSpaceIds, i as BoardEdgeRef, q as BoardVertexRef, ak as ManifestCountValidation, by as ValidatedManifest, c as AuthoredManifest, aL as ReadonlyRuntimeData, d as AuthoredOf, $ as InputDomain, a8 as InteractionDescriptor } from './extract-CNUw9Q8C.js';
2
+ export { f as AuthoredTileFaceAudience, h as BoardEdgeId, k as BoardSpaceHostId, p as BoardVertexId, J as FieldSchema, L as FieldsOutput, M as FrameworkErrorCodes, N as GameEvent, O as GameEventDetail, Q as GameOutcome, am as ManifestIdsOf, an as ManifestTable, ap as OutcomeResult, aq as OutcomeScoreComponent, ar as OutcomeStanding, as as OutcomeTieBreak, at as PerPlayerInstanceFamily, az as PlayerId, aK as PublicTileAppearance, aW as ReducerTransactionOutcome, aX as ReducerValidationResult, bV as ReducerWire, bU as ReducerWireZod, aZ as RotateZoneArgs, b9 as SeatSpaceRef, ba as SeatTileRef, bg as SquareBoardSpec, bn as TileDisclosure, bo as TileFaceAudience, bq as TileSeedSpec, br as TileSpaceId, bt as TileTypeSpec, bz as ValidationIssue, bM as asPlayerId, bN as boardSpaceHostId, bO as isPlayerId, bP as parseBoardSpaceHostId, bQ as parsePerPlayerInstanceId, bR as parseTileSpaceId, bS as perPlayerInstanceId, bT as ref, bW as tileSpaceId } from './extract-CNUw9Q8C.js';
3
3
  import * as z from 'zod';
4
4
  import { z as z$1 } from 'zod';
5
5
  export { z };
6
- import { a as ReducerBundleContract, c as ReducerDiagnosticsSink } from './diagnostics-D3mzqjxL.js';
7
- export { D as DispatchTraceSummaryEntry, M as MaybePromise, R as REDUCER_CONTRACT_VERSION, b as ReducerDiagnosticEvent, d as assertReducerBundleContract, n as noopDiagnosticsSink } from './diagnostics-D3mzqjxL.js';
8
- export { b as boardEdgeId, a as boardVertexId, p as parseBoardElementId } from './board-element-DXLPBVk-.js';
6
+ import { N as InteractionKey } from './model-BD0OKVEc.js';
7
+ import { a as ReducerBundleContract, c as ReducerDiagnosticsSink } from './diagnostics-Cl8mSexe.js';
8
+ export { D as DispatchTraceSummaryEntry, M as MaybePromise, R as REDUCER_CONTRACT_VERSION, b as ReducerDiagnosticEvent, d as assertReducerBundleContract, n as noopDiagnosticsSink } from './diagnostics-Cl8mSexe.js';
9
+ export { b as boardEdgeId, a as boardVertexId, p as parseBoardElementId } from './board-element-DCjHsEnF.js';
10
+ import '@tanstack/store';
9
11
  import 'honeycomb-grid';
10
12
 
11
13
  type DomainContext<State extends CollectorState> = {
@@ -478,16 +480,31 @@ declare function sparseMap<KeySchema extends z.ZodType<string>, ValueSchema exte
478
480
  declare function sparseCounts<KeySchema extends z.ZodType<string>>(keySchema: KeySchema): z.ZodType<SparseCounts<z.infer<KeySchema>>>;
479
481
  declare function normalizeCommandParams<Output>(schema: SchemaLike<Output>, input: unknown): Output;
480
482
 
483
+ type BotDecision<Game> = {
484
+ [Phase in PhaseNamesOfDefinition<Game>]: {
485
+ [Id in InteractionIdOfDefinitionPhase<Game, Phase>]: {
486
+ interactionId: Id;
487
+ params: ClientParamsOfInteractionOfDefinition<Game, Phase, Id>;
488
+ };
489
+ }[InteractionIdOfDefinitionPhase<Game, Phase>];
490
+ }[PhaseNamesOfDefinition<Game>] | null;
491
+ type BotFrame<Game> = PluginGameplayFrame<ViewOfDefinition<Game>, PhaseNamesOfDefinition<Game>, InteractionKey<Game>>;
492
+ /** Decide from the same perspective frame delivered to this seat's UI. */
493
+ interface BotStrategy<Game> extends BotStrategyMetadata {
494
+ decide(frame: BotFrame<Game>): BotDecision<Game>;
495
+ }
496
+
481
497
  type InteractionDiagnosticsMode = "verbose" | undefined;
482
498
 
483
- type ReducerBundleOptions = {
499
+ type ReducerBundleOptions<Game = unknown> = {
500
+ botStrategies?: readonly BotStrategy<Game>[];
484
501
  diagnostics?: ReducerDiagnosticsSink | InteractionDiagnosticsMode;
485
502
  descriptorDiagnostics?: InteractionDiagnosticsMode;
486
503
  };
487
504
  type ReducerBundle = ReducerBundleContract;
488
505
 
489
506
  /** The single validated production execution and projection boundary. */
490
- declare function createReducerBundle<Contract extends ReducerGameContractLike, Definitions extends PhaseMapOf<Contract>, View extends ViewOfContract<Contract>>(definition: ReducerGameDefinition<Contract, Definitions, View>, options?: ReducerBundleOptions): ReducerBundle;
507
+ declare function createReducerBundle<Contract extends ReducerGameContractLike, Definitions extends PhaseMapOf<Contract>, View extends ViewOfContract<Contract>>(definition: ReducerGameDefinition<Contract, Definitions, View>, options?: ReducerBundleOptions<typeof definition>): ReducerBundle;
491
508
 
492
509
  /** Cache a pure calculation by immutable object identity. Do not pass a mutable draft. */
493
510
  declare function memoize<A extends object, R>(fn: (a: A) => R): (a: A) => R;
@@ -1075,4 +1092,174 @@ type MaterializeOptions = {
1075
1092
  /** Construct actual session inventory; references use the supplied live roster. */
1076
1093
  declare function materializeManifestTable(options: MaterializeOptions): Record<string, unknown>;
1077
1094
 
1078
- export { AuthoredManifest, AuthoredTileDisclosure, BoardSpaceTarget, type BoardTargetPredicate, type BoundInputBuilders, type BoundTargetPredicate, type CardTargetPredicate, type ChoiceOptionsFactory, type ChoiceTargetOption, type ChoiceTargetPredicate, CompiledManifest, type ContractTypes, FieldsInput, type GameAuthoring, GameTopologyManifest$1 as GameTopologyManifest, InteractionRule, type ManyOptions, PerPlayerInstanceId, type PhaseAuthoring, type PhaseTypes, PositionTarget, type ReducerBundle, ReducerBundleContract, type ReducerBundleOptions, ReducerDiagnosticsSink, ReducerGameDefinition, ReducerGameDefinitionInput, ReducerTransaction, type SparseCounts, type SparseMap, SystemActionEvent, TableQueries, TableQueriesOfState, type TargetContext, type TargetPredicate, type TargetPredicateArgs, type TileTargetPredicate, type TypedTopologyManifest, ValidatedManifest, compileManifest, createGame, createReducerBundle, createStateQueries, createTableQueries, defineTopologyManifest, fromCoordinates, gameEvent, hexagon, many, materializeManifestTable, memoize, normalizeCommandParams, parseTopologyManifestJson, rectangle, ring, sparseCounts, sparseMap, spiral };
1095
+ /** A seat may submit only interactions currently offered as available. */
1096
+ declare function offeredInteraction<Key extends string>(frame: Pick<PluginGameplayFrame<unknown, string, Key>, "availableInteractions">, key: NoInfer<Key>): InteractionDescriptor<Key> | undefined;
1097
+ /** Resolve a named input in the current step and narrow its projected domain. */
1098
+ declare function offeredInputDomain<Type extends InputDomain["type"]>(interaction: InteractionDescriptor | undefined, key: string, type: Type): Extract<{
1099
+ readonly type: "cardTarget";
1100
+ readonly projection: "resolved";
1101
+ readonly targetKind: "card";
1102
+ readonly zoneIds: readonly string[];
1103
+ readonly eligibleTargets: readonly string[];
1104
+ readonly selection?: {
1105
+ readonly mode: "single";
1106
+ } | {
1107
+ readonly mode: "many";
1108
+ readonly min: number;
1109
+ readonly max?: number | undefined;
1110
+ readonly distinct?: boolean | undefined;
1111
+ } | undefined;
1112
+ }, {
1113
+ type: Type;
1114
+ }> | Extract<{
1115
+ readonly type: "tileTarget";
1116
+ readonly projection: "resolved";
1117
+ readonly targetKind: "tile";
1118
+ readonly zoneIds: readonly string[];
1119
+ readonly boardIds: readonly string[];
1120
+ readonly eligibleTargets: readonly (string & z.$brand<"SeatTileRef">)[];
1121
+ readonly selection?: {
1122
+ readonly mode: "single";
1123
+ } | {
1124
+ readonly mode: "many";
1125
+ readonly min: number;
1126
+ readonly max?: number | undefined;
1127
+ readonly distinct?: boolean | undefined;
1128
+ } | undefined;
1129
+ }, {
1130
+ type: Type;
1131
+ }> | Extract<{
1132
+ readonly type: "boardTarget";
1133
+ readonly projection: "resolved";
1134
+ readonly targetKind: "edge" | "vertex" | "space";
1135
+ readonly boardId: string;
1136
+ readonly valueKind: "board-id";
1137
+ readonly eligibleTargets: readonly string[];
1138
+ readonly selection?: {
1139
+ readonly mode: "single";
1140
+ } | {
1141
+ readonly mode: "many";
1142
+ readonly min: number;
1143
+ readonly max?: number | undefined;
1144
+ readonly distinct?: boolean | undefined;
1145
+ } | undefined;
1146
+ }, {
1147
+ type: Type;
1148
+ }> | Extract<{
1149
+ readonly type: "boardTarget";
1150
+ readonly projection: "resolved";
1151
+ readonly targetKind: "space";
1152
+ readonly boardBaseId: string;
1153
+ readonly valueKind: "board-space";
1154
+ readonly eligibleTargets: readonly {
1155
+ readonly boardId: string;
1156
+ readonly spaceId: string;
1157
+ }[];
1158
+ readonly selection?: {
1159
+ readonly mode: "single";
1160
+ } | {
1161
+ readonly mode: "many";
1162
+ readonly min: number;
1163
+ readonly max?: number | undefined;
1164
+ readonly distinct?: boolean | undefined;
1165
+ } | undefined;
1166
+ }, {
1167
+ type: Type;
1168
+ }> | Extract<{
1169
+ readonly type: "zonePosition";
1170
+ readonly zones: readonly {
1171
+ readonly zoneId: string;
1172
+ readonly hostId: string;
1173
+ readonly size: number;
1174
+ }[];
1175
+ readonly selection?: {
1176
+ readonly mode: "single";
1177
+ } | {
1178
+ readonly mode: "many";
1179
+ readonly min: number;
1180
+ readonly max?: number | undefined;
1181
+ readonly distinct?: boolean | undefined;
1182
+ } | undefined;
1183
+ }, {
1184
+ type: Type;
1185
+ }> | Extract<{
1186
+ readonly type: "resourceMap";
1187
+ readonly resources: readonly {
1188
+ readonly resourceId: string;
1189
+ readonly min: number;
1190
+ readonly max: number;
1191
+ readonly label?: string | undefined;
1192
+ readonly icon?: string | undefined;
1193
+ }[];
1194
+ readonly selection?: {
1195
+ readonly mode: "single";
1196
+ } | {
1197
+ readonly mode: "many";
1198
+ readonly min: number;
1199
+ readonly max?: number | undefined;
1200
+ readonly distinct?: boolean | undefined;
1201
+ } | undefined;
1202
+ }, {
1203
+ type: Type;
1204
+ }> | Extract<{
1205
+ readonly type: "boundedNumber";
1206
+ readonly min: number;
1207
+ readonly max: number;
1208
+ readonly selection?: {
1209
+ readonly mode: "single";
1210
+ } | {
1211
+ readonly mode: "many";
1212
+ readonly min: number;
1213
+ readonly max?: number | undefined;
1214
+ readonly distinct?: boolean | undefined;
1215
+ } | undefined;
1216
+ readonly step?: number | undefined;
1217
+ }, {
1218
+ type: Type;
1219
+ }> | Extract<{
1220
+ readonly type: "choice";
1221
+ readonly choices: readonly {
1222
+ readonly value: string | null;
1223
+ readonly label: string;
1224
+ readonly icon?: string | undefined;
1225
+ readonly badge?: string | undefined;
1226
+ readonly description?: string | undefined;
1227
+ readonly disabled?: boolean | undefined;
1228
+ readonly disabledReason?: string | undefined;
1229
+ }[];
1230
+ readonly selection?: {
1231
+ readonly mode: "single";
1232
+ } | {
1233
+ readonly mode: "many";
1234
+ readonly min: number;
1235
+ readonly max?: number | undefined;
1236
+ readonly distinct?: boolean | undefined;
1237
+ } | undefined;
1238
+ }, {
1239
+ type: Type;
1240
+ }> | Extract<{
1241
+ readonly type: "choiceList";
1242
+ readonly choices: readonly {
1243
+ readonly label: string;
1244
+ readonly value: string;
1245
+ readonly icon?: string | undefined;
1246
+ readonly badge?: string | undefined;
1247
+ readonly description?: string | undefined;
1248
+ readonly disabled?: boolean | undefined;
1249
+ readonly disabledReason?: string | undefined;
1250
+ }[];
1251
+ readonly selection?: {
1252
+ readonly mode: "single";
1253
+ } | {
1254
+ readonly mode: "many";
1255
+ readonly min: number;
1256
+ readonly max?: number | undefined;
1257
+ readonly distinct?: boolean | undefined;
1258
+ } | undefined;
1259
+ readonly min?: number | undefined;
1260
+ readonly max?: number | undefined;
1261
+ }, {
1262
+ type: Type;
1263
+ }> | undefined;
1264
+
1265
+ export { AuthoredManifest, AuthoredTileDisclosure, BoardSpaceTarget, type BoardTargetPredicate, type BotDecision, type BotStrategy, type BoundInputBuilders, type BoundTargetPredicate, type CardTargetPredicate, type ChoiceOptionsFactory, type ChoiceTargetOption, type ChoiceTargetPredicate, CompiledManifest, type ContractTypes, FieldsInput, type GameAuthoring, GameTopologyManifest$1 as GameTopologyManifest, InteractionRule, type ManyOptions, PerPlayerInstanceId, type PhaseAuthoring, type PhaseTypes, PositionTarget, type ReducerBundle, ReducerBundleContract, type ReducerBundleOptions, ReducerDiagnosticsSink, ReducerGameDefinition, ReducerGameDefinitionInput, ReducerTransaction, type SparseCounts, type SparseMap, SystemActionEvent, TableQueries, TableQueriesOfState, type TargetContext, type TargetPredicate, type TargetPredicateArgs, type TileTargetPredicate, type TypedTopologyManifest, ValidatedManifest, compileManifest, createGame, createReducerBundle, createStateQueries, createTableQueries, defineTopologyManifest, fromCoordinates, gameEvent, hexagon, many, materializeManifestTable, memoize, normalizeCommandParams, offeredInputDomain, offeredInteraction, parseTopologyManifestJson, rectangle, ring, sparseCounts, sparseMap, spiral };
package/dist/reducer.js CHANGED
@@ -27,14 +27,14 @@ import {
27
27
  sparseMap,
28
28
  unwrapWrappers,
29
29
  validatedReducerDefinition
30
- } from "./chunk-63GWNBZX.js";
30
+ } from "./chunk-KYQQIFXN.js";
31
31
  import {
32
32
  CARD_REFERENCE_PREFIX,
33
33
  boardSpaceHostId,
34
34
  isCardReferenceNamespace,
35
35
  parseBoardSpaceHostId,
36
36
  runtime_schema_exports
37
- } from "./chunk-IEMZ26FI.js";
37
+ } from "./chunk-BSS4ORU3.js";
38
38
  import {
39
39
  AuthoredTileDisclosureSchema,
40
40
  BoardRelationSchema,
@@ -4897,6 +4897,17 @@ function defineTopologyManifest(manifest) {
4897
4897
 
4898
4898
  // src/reducer.ts
4899
4899
  import * as z14 from "zod";
4900
+
4901
+ // src/reducer/bundle/offered-interaction.ts
4902
+ function offeredInteraction(frame, key) {
4903
+ return frame.availableInteractions.find(
4904
+ (descriptor) => descriptor.interactionKey === key && descriptor.availability.status === "available"
4905
+ );
4906
+ }
4907
+ function offeredInputDomain(interaction, key, type) {
4908
+ const domain = interaction?.inputs.find((input) => input.key === key)?.domain;
4909
+ return domain?.type === type ? domain : void 0;
4910
+ }
4900
4911
  export {
4901
4912
  FrameworkErrorCodes,
4902
4913
  REDUCER_CONTRACT_VERSION,
@@ -4921,6 +4932,8 @@ export {
4921
4932
  memoize,
4922
4933
  noopDiagnosticsSink,
4923
4934
  normalizeCommandParams,
4935
+ offeredInputDomain,
4936
+ offeredInteraction,
4924
4937
  parseBoardElementId,
4925
4938
  parseBoardSpaceHostId,
4926
4939
  parsePerPlayerInstanceId,