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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.js CHANGED
@@ -3,10 +3,10 @@ import {
3
3
  createGestureRecognizer,
4
4
  isSameDropTarget,
5
5
  magneticDropPoint
6
- } from "./chunk-BVWJS3AB.js";
6
+ } from "./chunk-JWPWE5EI.js";
7
7
  import {
8
8
  inputValueKey
9
- } from "./chunk-CZRPUWCT.js";
9
+ } from "./chunk-7GX27XU6.js";
10
10
 
11
11
  // src/react/create-game-hook.tsx
12
12
  import { createStore as createStore2 } from "@tanstack/store";
package/dist/reducer.d.ts CHANGED
@@ -1,12 +1,12 @@
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';
1
+ import { al as ManifestIdSchema, b6 as SchemaLike, x as CollectorState, Z as InputCollector, aB as PlayerIdOfState, bn as TableQueriesOfState, aZ as ResourceMapDomainDescriptor, t as BoundedNumberDomainDescriptor, u as ChoiceDomainDescriptor, v as ChoiceListDomainDescriptor, by as TopologyDefinitions, z as CollectorValueWitness, y as CollectorValueOf, a2 as InputSelectionDescriptor, aT as ReducerManifestContractLike, b4 as RuntimeTableRecord, b3 as RuntimeRecord, bi as StateDefinition, aj as ManifestContractOf, B as BaseGameStateOfContract, I as ErrorCodeOfContract, bv as TiledBoardIdOfTable, bl as TableOfManifest, bx as TiledVertexIdOfTable, bw as TiledEdgeIdOfTable, j as BoardIdOfTable, bg as SpaceIdOfTable, l as BoardSpaceTarget, av as PerPlayerInstanceId, bK as ZoneIdOfTable, C as CardIdOfManifest, aG as PositionTargetSchema, aF as PositionTarget, bq as TileIdOfTable, ap as OptionsOfContract, aW as ReducerTransaction, bE as ViewData, bF as ViewDefinition, ax as PhaseMapOf, bG as ViewOfContract, aR as ReducerGameDefinitionInput, aQ as ReducerGameDefinition, ai as InteractionSteps, b7 as ScopedPhaseState, ag as InteractionSpec, af as InteractionRule, aw as PhaseDefinition, ae as InteractionMap, aS as ReducerManifestContract, aO as ReducerGameContract, F as CompiledManifestWitness, E as CompiledManifest, bk as SystemActionEvent, s as BotStrategyMetadata, aC as PluginGameplayFrame, bH as ViewOfDefinition, ay as PhaseNamesOfDefinition, ab as InteractionIdOfDefinitionPhase, w as ClientParamsOfInteractionOfDefinition, bY as validatedReducerDefinition, an as ManifestOf, ah as InteractionSpecByNameOfDefinitionPhase, _ as InputCollectorOfDefinition, aP as ReducerGameContractLike, b2 as RuntimeQueryTable, bI as ZoneDefinitions, bm as TableQueries, b5 as SchemaAuthoring, U as GameTopologyManifest$1, K as FieldsInput, e as AuthoredTileDisclosure, a$ as RuntimeIdsFromCount, bt as TileSpaceIds, i as BoardEdgeRef, q as BoardVertexRef, ak as ManifestCountValidation, bz as ValidatedManifest, c as AuthoredManifest, aM as ReadonlyRuntimeData, d as AuthoredOf } from './extract-BF6nUlze.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, ao as ManifestTable, aq as OutcomeResult, ar as OutcomeScoreComponent, as as OutcomeStanding, at as OutcomeTieBreak, au as PerPlayerInstanceFamily, aA as PlayerId, aL as PublicTileAppearance, aX as ReducerTransactionOutcome, aY as ReducerValidationResult, bW as ReducerWire, bV as ReducerWireZod, a_ as RotateZoneArgs, ba as SeatSpaceRef, bb as SeatTileRef, bh as SquareBoardSpec, bo as TileDisclosure, bp as TileFaceAudience, br as TileSeedSpec, bs as TileSpaceId, bu as TileTypeSpec, bA as ValidationIssue, bN as asPlayerId, bO as boardSpaceHostId, bP as isPlayerId, bQ as parseBoardSpaceHostId, bR as parsePerPlayerInstanceId, bS as parseTileSpaceId, bT as perPlayerInstanceId, bU as ref, bX as tileSpaceId } from './extract-BF6nUlze.js';
3
3
  import * as z from 'zod';
4
4
  import { z as z$1 } from 'zod';
5
5
  export { z };
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';
6
+ import { N as InteractionKey } from './model-C7ScBVY5.js';
7
+ import { a as ReducerBundleContract, c as ReducerDiagnosticsSink } from './diagnostics-DNGfYfY8.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-DNGfYfY8.js';
9
+ export { b as boardEdgeId, a as boardVertexId, p as parseBoardElementId } from './board-element-Bdc0Kv6W.js';
10
10
  import '@tanstack/store';
11
11
  import 'honeycomb-grid';
12
12
 
@@ -257,25 +257,32 @@ declare const rngInput: {
257
257
  coin: typeof coin;
258
258
  };
259
259
 
260
- type ManyOptions = {
260
+ type ManyOptions = ({
261
261
  count: number;
262
- distinct?: boolean;
263
262
  } | {
264
263
  min?: number;
265
264
  max?: number;
265
+ }) & {
266
266
  distinct?: boolean;
267
267
  };
268
+ type ManySelection = Extract<InputSelectionDescriptor, {
269
+ mode: "many";
270
+ }>;
271
+ type AuthoredSelection<Options extends ManyOptions> = ManySelection & Pick<Options, Extract<keyof Options, "distinct">> & (Options extends {
272
+ count: infer Count extends number;
273
+ } ? {
274
+ readonly min: Count;
275
+ readonly max: Count;
276
+ } : Pick<Options, Extract<keyof Options, "min" | "max">>);
268
277
  type NonRngCollector = InputCollector<SchemaLike<unknown>, CollectorState> & {
269
278
  readonly kind: Exclude<InputCollector["kind"], "rng">;
270
279
  };
271
280
  /** Lift the value schema while retaining the collector's exact domain and routing. */
272
- type ManyInputCollector<Collector extends NonRngCollector> = Omit<Collector, "schema" | "selection" | "defaultValue" | "resolveDefaultValue" | keyof CollectorValueWitness<unknown>> & CollectorValueWitness<CollectorValueOf<Collector>[]> & {
281
+ type ManyInputCollector<Collector extends NonRngCollector, Options extends ManyOptions = ManyOptions> = Omit<Collector, "schema" | "selection" | "defaultValue" | "resolveDefaultValue" | keyof CollectorValueWitness<unknown>> & CollectorValueWitness<CollectorValueOf<Collector>[]> & {
273
282
  readonly schema: z.ZodArray<Collector["schema"]>;
274
- readonly selection: Extract<InputSelectionDescriptor, {
275
- mode: "many";
276
- }>;
283
+ readonly selection: AuthoredSelection<Options>;
277
284
  };
278
- declare function many<Collector extends NonRngCollector>(collector: Collector, options: ManyOptions): ManyInputCollector<Collector>;
285
+ declare function many<Collector extends NonRngCollector, const Options extends ManyOptions>(collector: Collector, options: Options & Record<Exclude<keyof Options, "min" | "max" | "count" | "distinct">, never>): ManyInputCollector<Collector, Options>;
279
286
 
280
287
  type TileTargetPredicate<State extends CollectorState, Id extends string, Definitions extends TopologyDefinitions = TopologyDefinitions> = TargetPredicate<State, Id, Definitions>;
281
288
 
@@ -381,16 +388,36 @@ type PhaseAuthoring<Contract extends ContractWithPhases, PhaseStateSchema extend
381
388
  }>): Extract<InteractionSpec<Collectors, BoundPhaseState<Contract, PhaseStateSchema>, BoundManifest<Contract>, ContractErrorCode<Contract>>, {
382
389
  steps: unknown;
383
390
  }>;
391
+ interaction<Collectors extends Record<string, InputCollector>, ParamsSchema extends z$1.core.SomeType>(spec: Extract<InteractionSpec<Collectors, BoundPhaseState<Contract, PhaseStateSchema>, BoundManifest<Contract>, ContractErrorCode<Contract>>, {
392
+ inputs: unknown;
393
+ }> & {
394
+ paramsSchema: ParamsSchema;
395
+ }): Extract<InteractionSpec<Collectors, BoundPhaseState<Contract, PhaseStateSchema>, BoundManifest<Contract>, ContractErrorCode<Contract>>, {
396
+ inputs: unknown;
397
+ }> & {
398
+ paramsSchema: ParamsSchema;
399
+ };
384
400
  interaction<Collectors extends Record<string, InputCollector>>(spec: Extract<InteractionSpec<Collectors, BoundPhaseState<Contract, PhaseStateSchema>, BoundManifest<Contract>, ContractErrorCode<Contract>>, {
385
401
  inputs: unknown;
386
402
  }>): Extract<InteractionSpec<Collectors, BoundPhaseState<Contract, PhaseStateSchema>, BoundManifest<Contract>, ContractErrorCode<Contract>>, {
387
403
  inputs: unknown;
388
404
  }>;
389
405
  rule<Collectors extends Record<string, InputCollector> = Record<string, InputCollector>>(rule: InteractionRule<Collectors, BoundPhaseState<Contract, PhaseStateSchema>, BoundManifest<Contract>, ContractErrorCode<Contract>>): InteractionRule<Collectors, BoundPhaseState<Contract, PhaseStateSchema>, BoundManifest<Contract>, ContractErrorCode<Contract>>;
390
- define<SubmitCollectors extends Record<string, InputCollector> = Record<string, InputCollector>, Interactions extends InteractionMap<BoundPhaseState<Contract, PhaseStateSchema>, BoundManifest<Contract>> = Record<string, never>, const Kind extends "player" | "simultaneousPlayer" | "auto" = "player" | "simultaneousPlayer" | "auto">(definition: PhaseDefinitionWithoutState<PhaseDefinition<PhaseStateSchema, BoundState<Contract>, BoundManifest<Contract>, SubmitCollectors, Interactions, OptionsOfContract<Contract>, ContractErrorCode<Contract>>> & {
406
+ /** Preserve the submit collectors when there are no ordinary interactions. */
407
+ define<SubmitCollectors extends Record<string, InputCollector> = Record<string, InputCollector>, SubmitSpec extends object = Record<never, never>>(definition: PhaseDefinitionWithoutState<PhaseDefinition<PhaseStateSchema, BoundState<Contract>, BoundManifest<Contract>, SubmitCollectors, Record<string, never>, OptionsOfContract<Contract>, ContractErrorCode<Contract>>> & {
408
+ kind: "simultaneousPlayer";
409
+ submit?: SubmitSpec;
410
+ interactions?: never;
411
+ }): PhaseDefinition<PhaseStateSchema, BoundState<Contract>, BoundManifest<Contract>, SubmitCollectors, Record<string, never>, OptionsOfContract<Contract>, ContractErrorCode<Contract>> & {
412
+ kind: "simultaneousPlayer";
413
+ submit?: SubmitSpec;
414
+ };
415
+ define<SubmitCollectors extends Record<string, InputCollector> = Record<string, InputCollector>, Interactions extends InteractionMap<BoundPhaseState<Contract, PhaseStateSchema>, BoundManifest<Contract>> = Record<string, never>, const Kind extends "player" | "simultaneousPlayer" | "auto" = "player" | "simultaneousPlayer" | "auto", SubmitSpec extends object = Record<never, never>>(definition: PhaseDefinitionWithoutState<PhaseDefinition<PhaseStateSchema, BoundState<Contract>, BoundManifest<Contract>, SubmitCollectors, Interactions, OptionsOfContract<Contract>, ContractErrorCode<Contract>>> & {
391
416
  kind: Kind;
417
+ submit?: SubmitSpec;
392
418
  }): PhaseDefinition<PhaseStateSchema, BoundState<Contract>, BoundManifest<Contract>, SubmitCollectors, Interactions, OptionsOfContract<Contract>, ContractErrorCode<Contract>> & {
393
419
  kind: Kind;
420
+ submit?: SubmitSpec;
394
421
  };
395
422
  readonly inputs: BoundInputBuilders<Contract>;
396
423
  /** Compile-time only. Reading any member at runtime throws. */
@@ -494,10 +521,97 @@ interface BotStrategy<Game> extends BotStrategyMetadata {
494
521
  decide(frame: BotFrame<Game>): BotDecision<Game>;
495
522
  }
496
523
 
524
+ declare const registeredStrategies: unique symbol;
525
+ /** A strategy collection registered against one assembled game definition. */
526
+ type DefinedBots<Game> = {
527
+ readonly [registeredStrategies]: readonly BotStrategy<Game>[];
528
+ };
529
+ type VisibleCard = {
530
+ readonly id: string;
531
+ };
532
+ type SeatView<Game> = NonNullable<ViewOfDefinition<Game>>;
533
+ type CardResolver<View, Card extends VisibleCard> = (view: View) => readonly Card[];
534
+ type Scorer<Args> = (args: Args) => number;
535
+ type CardInputAlias<Key, Suffix extends "Id" | "Ids"> = Key extends `${infer Name}${Suffix}` ? Name extends "" ? never : Suffix extends "Ids" ? `${Name}s` : Exclude<Name, "view"> : never;
536
+ type SingleKey<Keys, Key = Keys> = Key extends string ? [Keys] extends [Key] ? Key : never : never;
537
+ type CardBinding<Key, Collector> = Collector extends {
538
+ readonly kind: "card";
539
+ } ? CollectorValueOf<Collector> extends readonly unknown[] ? Collector extends {
540
+ readonly selection: {
541
+ readonly mode: "many";
542
+ readonly min: infer Min extends number;
543
+ readonly max: infer Max extends number;
544
+ readonly distinct: true;
545
+ };
546
+ } ? number extends Min ? never : [Min, Max] extends [Max, Min] ? [CardInputAlias<Key, "Ids">] extends [never] ? never : {
547
+ alias: CardInputAlias<Key, "Ids">;
548
+ multiple: true;
549
+ } : never : never : [CardInputAlias<Key, "Id">] extends [never] ? never : {
550
+ alias: CardInputAlias<Key, "Id">;
551
+ multiple: false;
552
+ } : never;
553
+ type Binding<Game, Phase extends PhaseNamesOfDefinition<Game>, Id extends InteractionIdOfDefinitionPhase<Game, Phase>, Keys = keyof ClientParamsOfInteractionOfDefinition<Game, Phase, Id>> = InteractionSpecByNameOfDefinitionPhase<Game, Phase, Id> extends {
554
+ readonly steps: unknown;
555
+ } ? never : [Keys] extends [never] ? null : CardBinding<SingleKey<Keys>, InputCollectorOfDefinition<Game, Phase, Id, SingleKey<Keys>>>;
556
+ type Bindings<Game> = {
557
+ [Key in InteractionKey<Game>]: Key extends `${infer Phase extends PhaseNamesOfDefinition<Game>}.${infer Id}` ? Id extends InteractionIdOfDefinitionPhase<Game, Phase> ? Binding<Game, Phase, Id> : never : never;
558
+ };
559
+ type ResolvedArgs<Binding, Card> = Binding extends {
560
+ alias: infer Alias extends string;
561
+ multiple: infer Multiple;
562
+ } ? Record<Alias, Multiple extends true ? readonly Card[] : Card> : object;
563
+ type CardAlias<Binding> = Binding extends {
564
+ alias: infer Name extends string;
565
+ } ? Name : never;
566
+ type CandidateGenerator<Binding, View, Card> = (context: {
567
+ view: View;
568
+ eligible: Readonly<Record<CardAlias<Binding>, readonly Card[]>>;
569
+ selection: Readonly<Record<CardAlias<Binding>, {
570
+ readonly count: number;
571
+ }>>;
572
+ }) => Iterable<Record<CardAlias<Binding>, readonly Card[]>>;
573
+ type CandidateHandler<Binding, View, Card> = {
574
+ candidates: CandidateGenerator<Binding, View, Card> & (Binding extends {
575
+ multiple: true;
576
+ } ? unknown : never);
577
+ score: Scorer<{
578
+ view: View;
579
+ } & Record<CardAlias<Binding>, readonly Card[]>>;
580
+ };
581
+ type RequiredSkips<Game, HasResolver extends boolean> = {
582
+ [Key in keyof Bindings<Game>]: [Bindings<Game>[Key]] extends [never] ? Key : HasResolver extends true ? never : Bindings<Game>[Key] extends null ? never : Key;
583
+ }[keyof Bindings<Game>];
584
+ type AuthoredStrategy<Game, Card, Keys extends keyof Bindings<Game>, HasResolver extends boolean> = BotStrategyMetadata & {
585
+ score: {
586
+ [Key in Keys]: "skip" | CandidateHandler<Bindings<Game>[Key], SeatView<Game>, Card> | Scorer<{
587
+ view: SeatView<Game>;
588
+ } & ResolvedArgs<Bindings<Game>[Key], Card>>;
589
+ } & Record<keyof Bindings<Game>, unknown> & Record<RequiredSkips<Game, HasResolver>, "skip">;
590
+ };
591
+ type AssembledGame = {
592
+ readonly [validatedReducerDefinition]: true;
593
+ };
594
+ type GameCard<Game> = {
595
+ readonly id: CardIdOfManifest<ManifestOf<Game>>;
596
+ };
597
+ /** Register seat-view resolvers and strategies for every player interaction. */
598
+ declare function defineBots<Game extends AssembledGame, Card extends GameCard<Game>, Keys extends keyof Bindings<Game>>(game: Game, config: {
599
+ resolve: {
600
+ card: CardResolver<SeatView<Game>, Card>;
601
+ };
602
+ strategies: readonly AuthoredStrategy<Game, Card, Keys, true>[];
603
+ }): DefinedBots<Game>;
604
+ declare function defineBots<Game extends AssembledGame, Keys extends keyof Bindings<Game>>(game: Game, config: {
605
+ resolve: {
606
+ card?: never;
607
+ };
608
+ strategies: readonly AuthoredStrategy<Game, never, Keys, false>[];
609
+ }): DefinedBots<Game>;
610
+
497
611
  type InteractionDiagnosticsMode = "verbose" | undefined;
498
612
 
499
613
  type ReducerBundleOptions<Game = unknown> = {
500
- botStrategies?: readonly BotStrategy<Game>[];
614
+ botStrategies?: DefinedBots<Game>;
501
615
  diagnostics?: ReducerDiagnosticsSink | InteractionDiagnosticsMode;
502
616
  descriptorDiagnostics?: InteractionDiagnosticsMode;
503
617
  };
@@ -1092,174 +1206,4 @@ type MaterializeOptions = {
1092
1206
  /** Construct actual session inventory; references use the supplied live roster. */
1093
1207
  declare function materializeManifestTable(options: MaterializeOptions): Record<string, unknown>;
1094
1208
 
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 };
1209
+ 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, defineBots, defineTopologyManifest, fromCoordinates, gameEvent, hexagon, many, materializeManifestTable, memoize, normalizeCommandParams, parseTopologyManifestJson, rectangle, ring, sparseCounts, sparseMap, spiral };
package/dist/reducer.js CHANGED
@@ -12,6 +12,7 @@ import {
12
12
  createReducerBundle,
13
13
  createStateQueries,
14
14
  createTableQueries,
15
+ defineBots,
15
16
  enumerateZoneHosts,
16
17
  getObjectShape,
17
18
  getZodDef,
@@ -27,14 +28,14 @@ import {
27
28
  sparseMap,
28
29
  unwrapWrappers,
29
30
  validatedReducerDefinition
30
- } from "./chunk-KYQQIFXN.js";
31
+ } from "./chunk-UGWQKBR6.js";
31
32
  import {
32
33
  CARD_REFERENCE_PREFIX,
33
34
  boardSpaceHostId,
34
35
  isCardReferenceNamespace,
35
36
  parseBoardSpaceHostId,
36
37
  runtime_schema_exports
37
- } from "./chunk-BSS4ORU3.js";
38
+ } from "./chunk-G4MY5YMA.js";
38
39
  import {
39
40
  AuthoredTileDisclosureSchema,
40
41
  BoardRelationSchema,
@@ -62,7 +63,7 @@ import {
62
63
  sameBoardSpaceTarget,
63
64
  tileSpaceId,
64
65
  zonePositions
65
- } from "./chunk-CZRPUWCT.js";
66
+ } from "./chunk-7GX27XU6.js";
66
67
 
67
68
  // src/reducer/authoring/validation.ts
68
69
  var MANIFEST_SCOPED_ID_NAMES = [
@@ -1047,7 +1048,10 @@ function createPhaseAuthoring(contract, schema) {
1047
1048
  rule: (rule) => defineInteractionRule()(
1048
1049
  rule
1049
1050
  ),
1050
- define: (definition) => ({ ...definition, state: schema }),
1051
+ define: ((definition) => ({
1052
+ ...definition,
1053
+ state: schema
1054
+ })),
1051
1055
  inputs: createBoundInputBuilders(contract),
1052
1056
  types: phantomTypes()
1053
1057
  };
@@ -4897,17 +4901,6 @@ function defineTopologyManifest(manifest) {
4897
4901
 
4898
4902
  // src/reducer.ts
4899
4903
  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
- }
4911
4904
  export {
4912
4905
  FrameworkErrorCodes,
4913
4906
  REDUCER_CONTRACT_VERSION,
@@ -4922,6 +4915,7 @@ export {
4922
4915
  createReducerBundle,
4923
4916
  createStateQueries,
4924
4917
  createTableQueries,
4918
+ defineBots,
4925
4919
  defineTopologyManifest,
4926
4920
  fromCoordinates,
4927
4921
  gameEvent,
@@ -4932,8 +4926,6 @@ export {
4932
4926
  memoize,
4933
4927
  noopDiagnosticsSink,
4934
4928
  normalizeCommandParams,
4935
- offeredInputDomain,
4936
- offeredInteraction,
4937
4929
  parseBoardElementId,
4938
4930
  parseBoardSpaceHostId,
4939
4931
  parsePerPlayerInstanceId,