@crowdedkingdoms/crowdyjs 17.14.0-dev.1 → 18.0.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/MIGRATION.md +92 -1
  2. package/README.md +93 -162
  3. package/dist/crowdy-client.d.ts +12 -31
  4. package/dist/crowdy-client.d.ts.map +1 -1
  5. package/dist/crowdy-client.js +15 -37
  6. package/dist/crowdy-dsh/bridge.d.ts.map +1 -1
  7. package/dist/crowdy-dsh/bridge.js +3 -6
  8. package/dist/crowdy-studio/controller.d.ts +34 -59
  9. package/dist/crowdy-studio/controller.d.ts.map +1 -1
  10. package/dist/crowdy-studio/controller.js +96 -225
  11. package/dist/crowdy-studio/diagnostics.d.ts +3 -12
  12. package/dist/crowdy-studio/diagnostics.d.ts.map +1 -1
  13. package/dist/crowdy-studio/dom-shell.d.ts +2 -4
  14. package/dist/crowdy-studio/dom-shell.d.ts.map +1 -1
  15. package/dist/crowdy-studio/dom-shell.js +16 -49
  16. package/dist/crowdy-studio/embed/hud-layer.d.ts +1 -2
  17. package/dist/crowdy-studio/embed/hud-layer.d.ts.map +1 -1
  18. package/dist/crowdy-studio/embed/panel.d.ts +3 -13
  19. package/dist/crowdy-studio/embed/panel.d.ts.map +1 -1
  20. package/dist/crowdy-studio/embed/panel.js +3 -6
  21. package/dist/crowdy-studio/index.d.ts +1 -3
  22. package/dist/crowdy-studio/index.d.ts.map +1 -1
  23. package/dist/crowdy-studio/index.js +0 -2
  24. package/dist/crowdy-studio/models.d.ts +3 -4
  25. package/dist/crowdy-studio/models.d.ts.map +1 -1
  26. package/dist/crowdy-studio/starter-projects.d.ts +8 -12
  27. package/dist/crowdy-studio/starter-projects.d.ts.map +1 -1
  28. package/dist/crowdy-studio/starter-projects.js +12 -103
  29. package/dist/domains/appAccess.d.ts +14 -1
  30. package/dist/domains/appAccess.d.ts.map +1 -1
  31. package/dist/domains/appAccess.js +37 -1
  32. package/dist/domains/host.d.ts +3 -3
  33. package/dist/domains/host.js +3 -3
  34. package/dist/domains/marketplace.d.ts +9 -70
  35. package/dist/domains/marketplace.d.ts.map +1 -1
  36. package/dist/domains/marketplace.js +9 -120
  37. package/dist/domains/playerWallet.d.ts +6 -12
  38. package/dist/domains/playerWallet.d.ts.map +1 -1
  39. package/dist/domains/playerWallet.js +6 -21
  40. package/dist/errors.d.ts +7 -13
  41. package/dist/errors.d.ts.map +1 -1
  42. package/dist/errors.js +6 -10
  43. package/dist/generated/graphql.d.ts +141 -7083
  44. package/dist/generated/graphql.d.ts.map +1 -1
  45. package/dist/generated/graphql.js +5 -313
  46. package/dist/grid-mods/exec-client-halves.d.ts +19 -3
  47. package/dist/grid-mods/exec-client-halves.d.ts.map +1 -1
  48. package/dist/grid-mods/exec-client-halves.js +17 -2
  49. package/dist/grid-mods/grid-host-calls.d.ts +29 -17
  50. package/dist/grid-mods/grid-host-calls.d.ts.map +1 -1
  51. package/dist/grid-mods/grid-host-calls.js +40 -46
  52. package/dist/grid-mods/mod-runtime.d.ts +18 -11
  53. package/dist/grid-mods/mod-runtime.d.ts.map +1 -1
  54. package/dist/grid-mods/mod-runtime.js +4 -2
  55. package/dist/grid-scope.d.ts +0 -189
  56. package/dist/grid-scope.d.ts.map +1 -1
  57. package/dist/grid-scope.js +0 -70
  58. package/dist/index.d.ts +11 -17
  59. package/dist/index.d.ts.map +1 -1
  60. package/dist/index.js +10 -16
  61. package/dist/kit/actions.d.ts +5 -9
  62. package/dist/kit/actions.d.ts.map +1 -1
  63. package/dist/kit/actions.js +5 -9
  64. package/dist/kit/index.d.ts +2 -33
  65. package/dist/kit/index.d.ts.map +1 -1
  66. package/dist/kit/index.js +1 -32
  67. package/dist/kit/kit.d.ts +8 -208
  68. package/dist/kit/kit.d.ts.map +1 -1
  69. package/dist/kit/kit.js +5 -163
  70. package/dist/kit/social.d.ts +1 -3
  71. package/dist/kit/social.d.ts.map +1 -1
  72. package/dist/kit/social.js +1 -3
  73. package/dist/kit/wire.d.ts +16 -5
  74. package/dist/kit/wire.d.ts.map +1 -1
  75. package/dist/kit/wire.js +19 -5
  76. package/dist/live-coding/assets/browser-authoring-index.json +1 -1
  77. package/dist/live-coding/assets/manifest.json +1 -1
  78. package/dist/live-coding/browser-authoring-index.generated.d.ts.map +1 -1
  79. package/dist/live-coding/browser-authoring-index.generated.js +1496 -4386
  80. package/dist/live-coding/rust-analysis.d.ts.map +1 -1
  81. package/dist/live-coding/rust-analysis.js +30 -34
  82. package/dist/player-runtime/client-host-calls.d.ts +8 -0
  83. package/dist/player-runtime/client-host-calls.d.ts.map +1 -0
  84. package/dist/player-runtime/client-host-calls.js +28 -0
  85. package/dist/player-runtime/glue-runtime.d.ts +24 -20
  86. package/dist/player-runtime/glue-runtime.d.ts.map +1 -1
  87. package/dist/player-runtime/glue-runtime.js +26 -55
  88. package/dist/player-runtime/glue-sab.d.ts +2 -2
  89. package/dist/player-runtime/glue-sab.js +2 -2
  90. package/dist/player-runtime/player-code-broker.d.ts +70 -43
  91. package/dist/player-runtime/player-code-broker.d.ts.map +1 -1
  92. package/dist/player-runtime/player-code-broker.js +159 -64
  93. package/dist/player-runtime/player-glue-worker.d.ts +8 -9
  94. package/dist/player-runtime/player-glue-worker.d.ts.map +1 -1
  95. package/dist/player-runtime/player-glue-worker.js +26 -11
  96. package/dist/stores/inbox.d.ts +1 -1
  97. package/dist/stores/inbox.d.ts.map +1 -1
  98. package/dist/stores/index.d.ts +0 -11
  99. package/dist/stores/index.d.ts.map +1 -1
  100. package/dist/stores/index.js +0 -4
  101. package/dist/stores/session.d.ts +0 -2
  102. package/dist/stores/session.d.ts.map +1 -1
  103. package/package.json +1 -1
  104. package/dist/crowdy-studio/model-lint-log.d.ts +0 -76
  105. package/dist/crowdy-studio/model-lint-log.d.ts.map +0 -1
  106. package/dist/crowdy-studio/model-lint-log.js +0 -93
  107. package/dist/crowdy-studio/model-lint.d.ts +0 -61
  108. package/dist/crowdy-studio/model-lint.d.ts.map +0 -1
  109. package/dist/crowdy-studio/model-lint.js +0 -45
  110. package/dist/domains/compute.d.ts +0 -208
  111. package/dist/domains/compute.d.ts.map +0 -1
  112. package/dist/domains/compute.js +0 -274
  113. package/dist/domains/controlPlane.d.ts +0 -38
  114. package/dist/domains/controlPlane.d.ts.map +0 -1
  115. package/dist/domains/controlPlane.js +0 -43
  116. package/dist/domains/gameModel.d.ts +0 -1174
  117. package/dist/domains/gameModel.d.ts.map +0 -1
  118. package/dist/domains/gameModel.js +0 -1333
  119. package/dist/domains/playerCompute.d.ts +0 -91
  120. package/dist/domains/playerCompute.d.ts.map +0 -1
  121. package/dist/domains/playerCompute.js +0 -136
  122. package/dist/domains/playerModel.d.ts +0 -20
  123. package/dist/domains/playerModel.d.ts.map +0 -1
  124. package/dist/domains/playerModel.js +0 -54
  125. package/dist/kit/abilities.d.ts +0 -66
  126. package/dist/kit/abilities.d.ts.map +0 -1
  127. package/dist/kit/abilities.js +0 -71
  128. package/dist/kit/blueprints/combat.d.ts +0 -81
  129. package/dist/kit/blueprints/combat.d.ts.map +0 -1
  130. package/dist/kit/blueprints/combat.js +0 -357
  131. package/dist/kit/blueprints/core.d.ts +0 -222
  132. package/dist/kit/blueprints/core.d.ts.map +0 -1
  133. package/dist/kit/blueprints/core.js +0 -185
  134. package/dist/kit/blueprints/decks.d.ts +0 -50
  135. package/dist/kit/blueprints/decks.d.ts.map +0 -1
  136. package/dist/kit/blueprints/decks.js +0 -163
  137. package/dist/kit/blueprints/economy.d.ts +0 -88
  138. package/dist/kit/blueprints/economy.d.ts.map +0 -1
  139. package/dist/kit/blueprints/economy.js +0 -533
  140. package/dist/kit/blueprints/guild.d.ts +0 -51
  141. package/dist/kit/blueprints/guild.d.ts.map +0 -1
  142. package/dist/kit/blueprints/guild.js +0 -50
  143. package/dist/kit/blueprints/index.d.ts +0 -23
  144. package/dist/kit/blueprints/index.d.ts.map +0 -1
  145. package/dist/kit/blueprints/index.js +0 -22
  146. package/dist/kit/blueprints/inventory.d.ts +0 -84
  147. package/dist/kit/blueprints/inventory.d.ts.map +0 -1
  148. package/dist/kit/blueprints/inventory.js +0 -257
  149. package/dist/kit/blueprints/leaderboards.d.ts +0 -49
  150. package/dist/kit/blueprints/leaderboards.d.ts.map +0 -1
  151. package/dist/kit/blueprints/leaderboards.js +0 -126
  152. package/dist/kit/blueprints/liveops.d.ts +0 -42
  153. package/dist/kit/blueprints/liveops.d.ts.map +0 -1
  154. package/dist/kit/blueprints/liveops.js +0 -170
  155. package/dist/kit/blueprints/locks.d.ts +0 -82
  156. package/dist/kit/blueprints/locks.d.ts.map +0 -1
  157. package/dist/kit/blueprints/locks.js +0 -155
  158. package/dist/kit/blueprints/loot.d.ts +0 -90
  159. package/dist/kit/blueprints/loot.d.ts.map +0 -1
  160. package/dist/kit/blueprints/loot.js +0 -229
  161. package/dist/kit/blueprints/matches.d.ts +0 -84
  162. package/dist/kit/blueprints/matches.d.ts.map +0 -1
  163. package/dist/kit/blueprints/matches.js +0 -349
  164. package/dist/kit/blueprints/moderation.d.ts +0 -32
  165. package/dist/kit/blueprints/moderation.d.ts.map +0 -1
  166. package/dist/kit/blueprints/moderation.js +0 -140
  167. package/dist/kit/blueprints/npcs.d.ts +0 -78
  168. package/dist/kit/blueprints/npcs.d.ts.map +0 -1
  169. package/dist/kit/blueprints/npcs.js +0 -125
  170. package/dist/kit/blueprints/plots.d.ts +0 -63
  171. package/dist/kit/blueprints/plots.d.ts.map +0 -1
  172. package/dist/kit/blueprints/plots.js +0 -151
  173. package/dist/kit/blueprints/progression.d.ts +0 -68
  174. package/dist/kit/blueprints/progression.d.ts.map +0 -1
  175. package/dist/kit/blueprints/progression.js +0 -324
  176. package/dist/kit/blueprints/quests.d.ts +0 -72
  177. package/dist/kit/blueprints/quests.d.ts.map +0 -1
  178. package/dist/kit/blueprints/quests.js +0 -285
  179. package/dist/kit/blueprints/worldsim.d.ts +0 -91
  180. package/dist/kit/blueprints/worldsim.d.ts.map +0 -1
  181. package/dist/kit/blueprints/worldsim.js +0 -468
  182. package/dist/kit/combat.d.ts +0 -141
  183. package/dist/kit/combat.d.ts.map +0 -1
  184. package/dist/kit/combat.js +0 -196
  185. package/dist/kit/decks.d.ts +0 -157
  186. package/dist/kit/decks.d.ts.map +0 -1
  187. package/dist/kit/decks.js +0 -186
  188. package/dist/kit/director.d.ts +0 -88
  189. package/dist/kit/director.d.ts.map +0 -1
  190. package/dist/kit/director.js +0 -86
  191. package/dist/kit/economy.d.ts +0 -289
  192. package/dist/kit/economy.d.ts.map +0 -1
  193. package/dist/kit/economy.js +0 -427
  194. package/dist/kit/engine.d.ts +0 -48
  195. package/dist/kit/engine.d.ts.map +0 -1
  196. package/dist/kit/engine.js +0 -113
  197. package/dist/kit/features.d.ts +0 -60
  198. package/dist/kit/features.d.ts.map +0 -1
  199. package/dist/kit/features.js +0 -65
  200. package/dist/kit/instances.d.ts +0 -52
  201. package/dist/kit/instances.d.ts.map +0 -1
  202. package/dist/kit/instances.js +0 -60
  203. package/dist/kit/inventory.d.ts +0 -129
  204. package/dist/kit/inventory.d.ts.map +0 -1
  205. package/dist/kit/inventory.js +0 -200
  206. package/dist/kit/leaderboards.d.ts +0 -86
  207. package/dist/kit/leaderboards.d.ts.map +0 -1
  208. package/dist/kit/leaderboards.js +0 -133
  209. package/dist/kit/liveops.d.ts +0 -112
  210. package/dist/kit/liveops.d.ts.map +0 -1
  211. package/dist/kit/liveops.js +0 -183
  212. package/dist/kit/loot.d.ts +0 -128
  213. package/dist/kit/loot.d.ts.map +0 -1
  214. package/dist/kit/loot.js +0 -160
  215. package/dist/kit/matches.d.ts +0 -301
  216. package/dist/kit/matches.d.ts.map +0 -1
  217. package/dist/kit/matches.js +0 -458
  218. package/dist/kit/matchmaking.d.ts +0 -57
  219. package/dist/kit/matchmaking.d.ts.map +0 -1
  220. package/dist/kit/matchmaking.js +0 -59
  221. package/dist/kit/minigames.d.ts +0 -30
  222. package/dist/kit/minigames.d.ts.map +0 -1
  223. package/dist/kit/minigames.js +0 -38
  224. package/dist/kit/mobs.d.ts +0 -90
  225. package/dist/kit/mobs.d.ts.map +0 -1
  226. package/dist/kit/mobs.js +0 -98
  227. package/dist/kit/moderation.d.ts +0 -73
  228. package/dist/kit/moderation.d.ts.map +0 -1
  229. package/dist/kit/moderation.js +0 -103
  230. package/dist/kit/movement.d.ts +0 -78
  231. package/dist/kit/movement.d.ts.map +0 -1
  232. package/dist/kit/movement.js +0 -103
  233. package/dist/kit/notifications.d.ts +0 -45
  234. package/dist/kit/notifications.d.ts.map +0 -1
  235. package/dist/kit/notifications.js +0 -67
  236. package/dist/kit/npcs.d.ts +0 -226
  237. package/dist/kit/npcs.d.ts.map +0 -1
  238. package/dist/kit/npcs.js +0 -141
  239. package/dist/kit/objects.d.ts +0 -116
  240. package/dist/kit/objects.d.ts.map +0 -1
  241. package/dist/kit/objects.js +0 -119
  242. package/dist/kit/pets.d.ts +0 -85
  243. package/dist/kit/pets.d.ts.map +0 -1
  244. package/dist/kit/pets.js +0 -96
  245. package/dist/kit/plots.d.ts +0 -85
  246. package/dist/kit/plots.d.ts.map +0 -1
  247. package/dist/kit/plots.js +0 -113
  248. package/dist/kit/progression.d.ts +0 -181
  249. package/dist/kit/progression.d.ts.map +0 -1
  250. package/dist/kit/progression.js +0 -265
  251. package/dist/kit/quests.d.ts +0 -171
  252. package/dist/kit/quests.d.ts.map +0 -1
  253. package/dist/kit/quests.js +0 -237
  254. package/dist/kit/racing.d.ts +0 -85
  255. package/dist/kit/racing.d.ts.map +0 -1
  256. package/dist/kit/racing.js +0 -99
  257. package/dist/kit/shared.d.ts +0 -73
  258. package/dist/kit/shared.d.ts.map +0 -1
  259. package/dist/kit/shared.js +0 -101
  260. package/dist/kit/telemetry.d.ts +0 -66
  261. package/dist/kit/telemetry.d.ts.map +0 -1
  262. package/dist/kit/telemetry.js +0 -133
  263. package/dist/kit/territory.d.ts +0 -97
  264. package/dist/kit/territory.d.ts.map +0 -1
  265. package/dist/kit/territory.js +0 -114
  266. package/dist/kit/worldsim.d.ts +0 -263
  267. package/dist/kit/worldsim.d.ts.map +0 -1
  268. package/dist/kit/worldsim.js +0 -268
  269. package/dist/stores/model.d.ts +0 -81
  270. package/dist/stores/model.d.ts.map +0 -1
  271. package/dist/stores/model.js +0 -163
@@ -1,1174 +0,0 @@
1
- import type { GraphQLClient } from '../client.js';
2
- import { type GameModelCreateSessionMutation, type GameModelCreateSessionMutationVariables, type GameModelJoinSessionMutation, type GameModelJoinSessionMutationVariables, type GameModelSetSessionTurnMutation, type GameModelSetSessionTurnMutationVariables, type GameModelLeaveSessionMutation, type GameModelLeaveSessionMutationVariables, type GameModelSetSessionAdmissionMutation, type GameModelSetSessionAdmissionMutationVariables, type GameModelTransferSessionHostMutation, type GameModelTransferSessionHostMutationVariables, type GameModelEndSessionMutation, type GameModelEndSessionMutationVariables, type GameModelSessionSnapshotQuery, type GameModelSessionSnapshotQueryVariables, type GameModelSessionEventsQuery, type GameModelSessionEventsQueryVariables, type GameModelSessionInspectQuery, type GameModelSessionInspectQueryVariables, type GameModelSessionChangedSubscription, type GameModelSessionChangedSubscriptionVariables, type GameModelCreateContainerMutation, type GameModelCreateContainerMutationVariables, type GameModelDeleteContainerMutation, type GameModelDeleteContainerMutationVariables, type GameModelSetPropertyMutation, type GameModelSetPropertyMutationVariables, type GameModelAddEdgeMutation, type GameModelAddEdgeMutationVariables, type GameModelDeleteEdgeMutation, type GameModelDeleteEdgeMutationVariables, type GameModelInvokeMutation, type GameModelInvokeMutationVariables, type GameModelContainerQuery, type GameModelContainerQueryVariables, GameModelContainerChangedSubscription, GameModelContainerChangedSubscriptionVariables, type GameModelActivePlayerCountQuery, type GameModelActivePlayerCountQueryVariables, type GameModelActivePlayerCountChangedSubscription, type GameModelActivePlayerCountChangedSubscriptionVariables, type GameModelContainersQuery, type GameModelContainersQueryVariables, type GameModelContainerStateQuery, type GameModelContainerStateQueryVariables, type GameModelContainerStatesQuery, type GameModelContainerStatesQueryVariables, type GameModelTraverseQuery, type GameModelTraverseQueryVariables, type GameModelSessionQuery, type GameModelSessionQueryVariables, type GameModelSessionsQuery, type GameModelSessionsQueryVariables, type GameModelEventsQuery, type GameModelEventsQueryVariables, type GameModelFlowQuery, type GameModelFlowQueryVariables, type GameModelSeedMutation, type GameModelSeedMutationVariables, type GameModelUpsertContainerTypeMutation, type GameModelUpsertContainerTypeMutationVariables, type GameModelUpsertPropertyDefMutation, type GameModelUpsertPropertyDefMutationVariables, type GameModelDeletePropertyDefMutation, type GameModelDeletePropertyDefMutationVariables, type GameModelDeleteContainerTypeMutation, type GameModelDeleteContainerTypeMutationVariables, type GameModelUpsertFunctionMutation, type GameModelUpsertFunctionMutationVariables, type GameModelDeleteFunctionMutation, type GameModelDeleteFunctionMutationVariables, type GameModelDefineFeatureMutation, type GameModelDefineFeatureMutationVariables, type GameModelGrantTierFeatureMutation, type GameModelGrantTierFeatureMutationVariables, type GameModelSetPolicyMutation, type GameModelSetPolicyMutationVariables, type GameModelTypeSchemaQuery, type GameModelTypeSchemaQueryVariables, type GameModelContainerTypesQuery, type GameModelContainerTypesQueryVariables, type GameModelPropertyDefsQuery, type GameModelPropertyDefsQueryVariables, type GameModelFunctionQuery, type GameModelFunctionQueryVariables, type GameModelFunctionsQuery, type GameModelFunctionsQueryVariables, type GameModelFeaturesQuery, type GameModelFeaturesQueryVariables, type GameModelTierFeaturesQuery, type GameModelTierFeaturesQueryVariables, type GameModelPolicyQuery, type GameModelPolicyQueryVariables, type GameModelRevokeTierFeatureMutation, type GameModelRevokeTierFeatureMutationVariables, type GameModelEventsConnectionQuery, type GameModelEventsConnectionQueryVariables, type GameModelUpsertAutomationMutation, type GameModelUpsertAutomationMutationVariables, type GameModelDeleteAutomationMutation, type GameModelDeleteAutomationMutationVariables, type GameModelSetAutomationEnabledMutation, type GameModelSetAutomationEnabledMutationVariables, type GameModelUpsertAutomationTriggerMutation, type GameModelUpsertAutomationTriggerMutationVariables, type GameModelDeleteAutomationTriggerMutation, type GameModelDeleteAutomationTriggerMutationVariables, type GameModelSetAutomationPolicyMutation, type GameModelSetAutomationPolicyMutationVariables, type GameModelRunAutomationMutation, type GameModelRunAutomationMutationVariables, type GameModelAutomationsQuery, type GameModelAutomationsQueryVariables, type GameModelAutomationQuery, type GameModelAutomationQueryVariables, type GameModelAutomationTriggersQuery, type GameModelAutomationTriggersQueryVariables, type GameModelAutomationPolicyQuery, type GameModelAutomationPolicyQueryVariables, type GameModelAutomationRunsQuery, type GameModelAutomationRunsQueryVariables, type GameModelAutomationStatsQuery, type GameModelAutomationStatsQueryVariables, type GameModelAppDiagnosticsQuery, type GameModelAppDiagnosticsQueryVariables, type GameModelScheduleInvokeMutation, type GameModelScheduleInvokeMutationVariables, type GameModelCancelTimerMutation, type GameModelCancelTimerMutationVariables, type GameModelTimersQuery, type GameModelTimersQueryVariables } from '../generated/graphql.js';
3
- /**
4
- * Abstract **game-model** sub-client on the **game-api** — a schema-driven,
5
- * server-authoritative layer for modelling game/world logic on top of the
6
- * spatial voxel world. Studios *author* the model; players *query* state and
7
- * *invoke* functions at runtime. Exposed as `client.gameModel`.
8
- *
9
- * The model is a typed graph of entities:
10
- * - **Container types** are the schemas (like classes) for a kind of entity.
11
- * **Property definitions** are their typed fields, each with a default value,
12
- * a read **visibility** (`public | owner | hidden`) and a **writability**
13
- * (`function | owner | admin`). See {@link upsertContainerType} /
14
- * {@link upsertPropertyDef} / {@link typeSchema}.
15
- * - **Containers** are the runtime instances of a type, optionally scoped to a
16
- * session and carrying property values. See {@link createContainer},
17
- * {@link container}, {@link containers}, {@link containerState}.
18
- * - **Functions** are named, sandboxed behaviours over containers: typed
19
- * parameters, declared property **mutations** (expressions compiled to an AST
20
- * server-side — never `eval`'d), an optional return expression, an
21
- * `invokeScope` (`player | server | internal`), and an **invoke policy** — an
22
- * authority rule tree of `owner_of_self`, `is_host`, `is_current_turn`,
23
- * `is_participant`, `tier_feature`, `group_permission`, `grid_permission`, and
24
- * `condition` rules. {@link invoke} is the primary, *safe* way for players to
25
- * mutate state: the server checks the policy, evaluates the expressions,
26
- * applies the mutations atomically, and logs an **event**.
27
- * - **Sessions** are isolated instance scopes (a match, room, or save) with
28
- * **participants**, a creator, and an optional current-**turn** user for
29
- * turn-based play. See {@link createSession}, {@link joinSession},
30
- * {@link setSessionTurn}, {@link session}, {@link sessions}.
31
- * - **Edges** are directed, typed relationships between containers (the model is
32
- * a graph); {@link traverse} walks them from a root up to a depth. See
33
- * {@link addEdge}.
34
- * - **Events** are an audit log of every function invocation and its outcome.
35
- * See {@link events}.
36
- * - **App features** are keys functions gate on (via `tier_feature` rules) and
37
- * that **access tiers** can be granted ({@link defineFeature},
38
- * {@link grantTierFeature}); **policy** governs who may create sessions and the
39
- * default participant role ({@link setPolicy}).
40
- * - {@link seed} bulk-creates definitions *and* instances in one transaction for
41
- * model init/import.
42
- *
43
- * **Encoding.** `BigInt` ids (`appId`, `tierId`, every `*UserId`) are sent and
44
- * received as decimal **strings**. Container, session, function, edge, and event
45
- * ids are opaque **UUID strings**. All structured values travel as JSON-encoded
46
- * strings in the `*Json` fields (`metadataJson`, `propertiesJson`, `paramsJson`,
47
- * `valueJson`, `returnValueJson`, `invokePolicyJson`, `idMapJson`, …) — callers
48
- * `JSON.parse` / `JSON.stringify` around them. (Unlike actor/state blobs, these
49
- * are JSON text, not base64.)
50
- *
51
- * **Auth.** Every call requires an authenticated session (a Bearer token set via
52
- * `client.auth.login()` or `client.setToken()`) scoped to the target app, or it
53
- * throws {@link CrowdyGraphQLError} (`UNAUTHENTICATED` / `SCOPE_MISSING`). The
54
- * **studio-authoring** methods ({@link seed}, {@link upsertContainerType},
55
- * {@link upsertPropertyDef}, {@link deletePropertyDef}, {@link upsertFunction},
56
- * {@link deleteFunction}, {@link deleteContainerType}, {@link defineFeature},
57
- * {@link grantTierFeature}, {@link setPolicy}) and the
58
- * {@link typeSchema} query additionally require the app-admin **`manage_apps`**
59
- * permission (otherwise `FORBIDDEN`, with `extensions.requiredPermission ===
60
- * 'manage_apps'`); the runtime/player methods need only a valid token plus
61
- * whatever per-operation policy applies (session-creation policy, a type's
62
- * `instantiableBy` rule, a property's `writable` rule, or a function's invoke
63
- * policy).
64
- *
65
- * @example
66
- * ```ts
67
- * // Studio authors a type, then a player creates a session and invokes a function.
68
- * await client.gameModel.upsertContainerType({ appId, typeName: 'Player', displayName: 'Player' });
69
- * const session = await client.gameModel.createSession({ appId, name: 'Match 1' });
70
- * const result = await client.gameModel.invoke({
71
- * appId,
72
- * functionName: 'takeDamage',
73
- * selfContainerId,
74
- * paramsJson: JSON.stringify({ amount: 10 }),
75
- * });
76
- * // Authority and evaluation failures do NOT throw — they come back in band, because
77
- * // the result still carries an event id and any writes that did apply.
78
- * const fault = playerFaultOf(result);
79
- * if (fault) {
80
- * // `fault.blame` is the platform's attribution: AUTHOR (this app's code), PLATFORM
81
- * // (ours) or BUDGET (an allowance). Choose your own wording — the server no longer
82
- * // sends engine text, deliberately.
83
- * if (fault.retryable) scheduleRetry();
84
- * }
85
- * ```
86
- */
87
- /** One container-change push from {@link GameModelAPI.containerChanged}. */
88
- export type GmContainerChangeEvent = GameModelContainerChangedSubscription['gameModelContainerChanged'];
89
- /** One session revision as streamed by {@link GameModelAPI.sessionChanged}. */
90
- export type GmSessionChangeEvent = GameModelSessionChangedSubscription['gameModelSessionChanged'];
91
- /** Handlers for {@link GameModelAPI.sessionChanged}. */
92
- export interface SessionChangedHandlers {
93
- /**
94
- * One revision of the session. `revision` is a decimal string and strictly
95
- * increasing; `kind` is one of `created | participant_joined |
96
- * participant_rejoined | participant_left | participant_expired |
97
- * host_changed | admission_changed | turn_changed | ended`; `payloadJson`
98
- * names the subject (user id, host, admission, ...).
99
- */
100
- next: (event: GmSessionChangeEvent) => void;
101
- /** Transport/GraphQL errors (the subscription retries on socket drops). */
102
- error?: (error: unknown) => void;
103
- /** The server ended the stream. */
104
- complete?: () => void;
105
- /**
106
- * WebSocket constructor for runtimes without a global `WebSocket` (Node
107
- * ≤ 21): pass `(await import('ws')).default`.
108
- */
109
- webSocketImpl?: unknown;
110
- }
111
- /** Handlers for {@link GameModelAPI.containerChanged}. */
112
- export interface ContainerChangedHandlers {
113
- /** A container changed (metadata only — pull state on receipt). */
114
- next: (change: GmContainerChangeEvent) => void;
115
- /** Transport/GraphQL errors (the subscription retries on socket drops). */
116
- error?: (error: unknown) => void;
117
- /** The server ended the stream. */
118
- complete?: () => void;
119
- /**
120
- * WebSocket constructor for runtimes without a global `WebSocket` (Node
121
- * ≤ 21): pass `(await import('ws')).default`.
122
- */
123
- webSocketImpl?: unknown;
124
- }
125
- /** A snapshot returned by {@link GameModelAPI.activePlayerCount}. */
126
- export type GmActivePlayerCountSnapshot = GameModelActivePlayerCountQuery['gameModelActivePlayerCount'];
127
- /** One count transition from {@link GameModelAPI.activePlayerCountChanged}. */
128
- export type GmActivePlayerCountChangeEvent = GameModelActivePlayerCountChangedSubscription['gameModelActivePlayerCountChanged'];
129
- /** Handlers for {@link GameModelAPI.activePlayerCountChanged}. */
130
- export interface ActivePlayerCountChangedHandlers {
131
- /** A complete app-scoped active-session count transition. */
132
- next: (change: GmActivePlayerCountChangeEvent) => void;
133
- /** Transport/GraphQL errors (the subscription retries on socket drops). */
134
- error?: (error: unknown) => void;
135
- /** The server ended the stream. */
136
- complete?: () => void;
137
- /**
138
- * WebSocket constructor for runtimes without a global `WebSocket` (Node
139
- * ≤ 21): pass `(await import('ws')).default`.
140
- */
141
- webSocketImpl?: unknown;
142
- }
143
- export declare class GameModelAPI {
144
- private gql;
145
- private readonly ws?;
146
- constructor(gql: GraphQLClient, ws?: {
147
- wsUrl?: string;
148
- getToken: () => string | null;
149
- } | undefined);
150
- /**
151
- * **Player count** — read the best-known number of active gameplay sessions
152
- * for one app. Requires a bearer token scoped to exactly `appId`.
153
- *
154
- * This is a **session count**, not a distinct-user or actor count: one user
155
- * with multiple active sessions contributes more than once. A session that
156
- * disappears without a clean disconnect can remain counted for approximately
157
- * 120 seconds while its inactivity is recognized.
158
- *
159
- * Treat the result as authoritative only when `status === 'FRESH'`.
160
- * `PARTIAL` is an incomplete best-known count and `UNAVAILABLE` means no fresh
161
- * observation exists; neither status is an authoritative zero. `appId` and
162
- * the monotonic `revision` are generated `BigInt` scalars represented as
163
- * decimal strings.
164
- *
165
- * @param appId - App to count, as a decimal-string `BigInt`; it must match
166
- * the app scope of the bearer token.
167
- * @returns The generated snapshot payload: `appId`, `activePlayerCount`,
168
- * `status`, nullable `observedAt`, and `revision`.
169
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING` when the
170
- * token is missing or is not scoped to `appId`.
171
- */
172
- activePlayerCount(appId: GameModelActivePlayerCountQueryVariables['appId']): Promise<GmActivePlayerCountSnapshot>;
173
- /**
174
- * **Player-count subscription** — stream complete active-session count
175
- * transitions for one app. Requires a bearer token scoped to exactly
176
- * `variables.appId` and a game-api `wsUrl` in the client config.
177
- *
178
- * This stream counts gameplay **sessions**, not distinct users or actors;
179
- * abandoned sessions can remain counted for approximately 120 seconds while
180
- * inactivity is recognized. It emits no initial/bootstrap event, so establish
181
- * the stream and then call {@link activePlayerCount} for the current snapshot.
182
- * `PARTIAL` and `UNAVAILABLE` observations neither emit transitions nor
183
- * represent an authoritative zero.
184
- *
185
- * Delivery is best-effort and may miss or repeat events across reconnects.
186
- * Deduplicate by the decimal-string `revision`. Requery
187
- * {@link activePlayerCount} after every reconnect or whenever revisions have
188
- * a gap; the query is the source of truth.
189
- *
190
- * @param variables - Exact call shape `{ appId }`, where `appId` is the
191
- * decimal-string `BigInt` matching the app-scoped bearer token.
192
- * @param handlers - `next` per transition; optional `error`, `complete`, and
193
- * `webSocketImpl` for runtimes without a global `WebSocket`.
194
- * @returns An unsubscribe function that disposes this subscription and its
195
- * graphql-transport-ws client.
196
- * @throws {Error} Synchronously when the client config has no `wsUrl`.
197
- */
198
- activePlayerCountChanged(variables: GameModelActivePlayerCountChangedSubscriptionVariables, handlers: ActivePlayerCountChangedHandlers): () => void;
199
- /**
200
- * **Subscriptions** — stream container-change notifications for an app
201
- * (`gameModelContainerChanged`): an invoke mutated a container, a direct
202
- * `setProperty` wrote it, or it was created/deleted. Events are
203
- * **metadata only** (containerId, typeName, changedKeys — no property
204
- * values): pull the visibility-filtered state with {@link containerState}
205
- * on receipt. Post-commit and best-effort, exactly like model-driven
206
- * notifications — replaces interval polling with pull-on-push. Requires a
207
- * game-api with the container-change feed (2026-07+) and a `wsUrl` in the
208
- * client config.
209
- *
210
- * @param variables - `{ appId, typeName?, sessionId? }` delivery filters.
211
- * @param handlers - `next` per change; optional `error` / `complete`.
212
- * @returns An unsubscribe function (closes this subscription's socket).
213
- */
214
- containerChanged(variables: GameModelContainerChangedSubscriptionVariables, handlers: ContainerChangedHandlers): () => void;
215
- /**
216
- * **Subscriptions** — stream the revisions of one session as they commit
217
- * (`gameModelSessionChanged`): joins, rejoins, leaves, presence expiries,
218
- * host changes, admission changes, turn changes and the end. There is no
219
- * bootstrap event: pull {@link sessionSnapshot} first, or pass
220
- * `afterRevision` to replay retained events from there. Revisions are
221
- * strictly increasing; on a gap or after a reconnect, pull the snapshot
222
- * again. Cross-replica and best-effort over a bounded buffer; the events
223
- * table ({@link sessionEvents}) is the record. Requires a `wsUrl` in the
224
- * client config.
225
- *
226
- * @param variables - `{ appId, sessionId, afterRevision? }`.
227
- * @param handlers - `next` per revision; optional `error` / `complete` /
228
- * `webSocketImpl`.
229
- * @returns An unsubscribe function (closes this subscription's socket).
230
- * @throws {Error} Synchronously when the client config has no `wsUrl`.
231
- */
232
- sessionChanged(variables: GameModelSessionChangedSubscriptionVariables, handlers: SessionChangedHandlers): () => void;
233
- /**
234
- * **Sessions** — create a runtime session: an isolated instance scope for
235
- * containers (e.g. a match, room, or save). Subject to the app's
236
- * session-creation policy ({@link setPolicy}); the caller becomes the creator
237
- * and a participant.
238
- *
239
- * **Presence mode.** `presence: 'actor'` (the default) expires a joined
240
- * participant with no fresh Buddy actor in the app after the join grace
241
- * window. `presence: 'none'` never expires anybody: use it for turn-based
242
- * play that talks GraphQL and channel pings and never replicates an actor
243
- * (`kit.matches` does), where the roster's only exits are
244
- * {@link leaveSession}, {@link endSession} and the empty timeout once
245
- * everyone has left. The mode is fixed at creation.
246
- *
247
- * @param input - {@link CreateSessionInput}: `appId` (decimal string), an
248
- * optional `name`, optional `metadataJson` (a JSON-object string),
249
- * optional `participantUserIds` (decimal-string ids of initial participants
250
- * besides the creator), optional `maxParticipants`, `admission`,
251
- * `emptyTimeoutSec`, `presence` and `idempotencyKey`.
252
- * Pass `seedFromApp: { typeNames, initialState? }` to stamp the app's keyed
253
- * template rows of those types (the rows a {@link seed} with `bindingKey`
254
- * wrote) into the new session inside the creation transaction: same
255
- * `bindingKey`, `displayName`, `metadataJson` and `ownerUserId` per row, so a
256
- * later `gameModelEnsureContainer` in the session finds every key present.
257
- * `initialState` is `'defaults'` (type defaults) or `'app'` (copy the app
258
- * rows' current properties). At most 2,000 rows per session; above that the
259
- * creation is refused and no session exists. The count is on the create
260
- * response as `seededContainerCount` (null on later reads) and on the
261
- * session's `created` event as `containersSeeded`. A template type must be
262
- * `instantiableBy: 'admin'` or carry a `bindPolicyJson` (a plain member
263
- * type is refused: a player may own one of its app keys); an `'app'`-scoped
264
- * type is refused. The copies are marked, and on a tier whose operator has
265
- * enabled retention (`GM_SESSION_CONTAINER_RETENTION_DAYS`; off by default)
266
- * they -- and only they -- are dropped once the session has been ended that
267
- * long; hand-made rows in the session are never purged.
268
- * @returns The created {@link GmSession} (`sessionId`, `status`, creator,
269
- * host, admission, `presence`, revision, `seededContainerCount`, …).
270
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING` if the token
271
- * is missing or not scoped to the app, `FORBIDDEN` if the session-creation
272
- * policy disallows the caller, or `BAD_USER_INPUT` for malformed input, an
273
- * undefined `seedFromApp` type, or more than 2,000 template rows.
274
- */
275
- createSession(input: GameModelCreateSessionMutationVariables['input']): Promise<GameModelCreateSessionMutation['gameModelCreateSession']>;
276
- /**
277
- * **Sessions** — join a session, or **reconnect** to one you are already in.
278
- * A rejoin returns your row with `incarnation + 1` and supersedes any older
279
- * client of yours; keep the returned `incarnation`, {@link leaveSession}
280
- * needs it. Pass `actorUuid` (your own Buddy actor, 32 hex chars — the uuid
281
- * you replicate with) to bind this participant's presence to that actor;
282
- * without it any fresh actor of yours in the app keeps you present.
283
- * **Presence is your actor** (in a `presence: 'actor'` session, the default):
284
- * a participant with no fresh Buddy actor in the app after the join grace
285
- * window is expired by the server (`participant_expired`); a client that only
286
- * speaks GraphQL must rejoin to come back. In a `presence: 'none'` session
287
- * nobody is expired and `actorUuid` is recorded but not judged.
288
- *
289
- * @param input - {@link JoinSessionInput}: `appId` (decimal string),
290
- * `sessionId`, optional `role`, optional `actorUuid`, optional
291
- * `idempotencyKey` (replaying returns the same incarnation).
292
- * @returns The {@link GmSessionParticipant} row (`state`, `incarnation`,
293
- * `actorUuid`, `joinedAt`, ...).
294
- * @throws {CrowdyGraphQLError} `SESSION_FULL` (every seat taken),
295
- * `SESSION_LOCKED` (admission locked and you never joined),
296
- * `SESSION_CLOSED`, `SESSION_ENDED`, `FORBIDDEN` (the `actorUuid` is not
297
- * yours or is already bound by another participant), `NOT_FOUND`,
298
- * `UNAUTHENTICATED` / `SCOPE_MISSING`.
299
- */
300
- joinSession(input: GameModelJoinSessionMutationVariables['input']): Promise<GameModelJoinSessionMutation['gameModelJoinSession']>;
301
- /**
302
- * **Sessions** — set or clear the session's current-turn user, for turn-based
303
- * play (turn authority is enforced by the service).
304
- *
305
- * @param input - {@link SetSessionTurnInput}: `appId` (decimal string),
306
- * `sessionId`, and `userId` (the decimal-string id of the user whose turn it
307
- * now is) — pass `userId: null` to **clear** the turn.
308
- * @returns The updated {@link GmSession} (with `currentTurnUserId` reflecting
309
- * the change).
310
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`,
311
- * `NOT_FOUND` if the session doesn't exist, or `FORBIDDEN` if the caller may
312
- * not change the turn.
313
- */
314
- setSessionTurn(input: GameModelSetSessionTurnMutationVariables['input']): Promise<GameModelSetSessionTurnMutation['gameModelSetSessionTurn']>;
315
- /**
316
- * **Sessions** — leave a session you are joined to. `incarnation` is
317
- * **required**: it is the value {@link joinSession} returned to *this*
318
- * client (a creator starts at 1), so a superseded client can never remove
319
- * the one that took over. Leaving an already-left row is a no-op. If you
320
- * were host, the longest-joined present participant succeeds you
321
- * (`host_changed`).
322
- *
323
- * @param input - {@link LeaveSessionInput}: `appId`, `sessionId`,
324
- * `incarnation`, optional `idempotencyKey`.
325
- * @returns Your {@link GmSessionParticipant} row, now `state: 'left'` with
326
- * `leftReason: 'left'`.
327
- * @throws {CrowdyGraphQLError} `SESSION_INCARNATION_STALE` (a newer client
328
- * rejoined as you — stop acting from this one, or rejoin),
329
- * `SESSION_NOT_PARTICIPANT`, `NOT_FOUND`.
330
- */
331
- leaveSession(input: GameModelLeaveSessionMutationVariables['input']): Promise<GameModelLeaveSessionMutation['gameModelLeaveSession']>;
332
- /**
333
- * **Sessions** — change who may still join: `'open'` (anyone the app
334
- * admits), `'locked'` (only participants who already joined may reconnect —
335
- * set it when the match starts), `'closed'` (nobody). Session host or app
336
- * admin (`manage_apps`). Emits `admission_changed`.
337
- *
338
- * @param input - {@link SetSessionAdmissionInput}: `appId`, `sessionId`,
339
- * `admission`, optional `expectedHostTerm` (the `hostTerm` you last read:
340
- * refused if the host changed since), optional `idempotencyKey`.
341
- * @returns The updated {@link GmSession}.
342
- * @throws {CrowdyGraphQLError} `FORBIDDEN` (not host / admin),
343
- * `SESSION_HOST_TERM_STALE`, `SESSION_ENDED`, `NOT_FOUND`.
344
- */
345
- setSessionAdmission(input: GameModelSetSessionAdmissionMutationVariables['input']): Promise<GameModelSetSessionAdmissionMutation['gameModelSetSessionAdmission']>;
346
- /**
347
- * **Sessions** — hand the host role to another *joined* participant.
348
- * Session host or app admin. Increments `hostTerm` and emits
349
- * `host_changed` (reason `transferred`).
350
- *
351
- * @param input - {@link TransferSessionHostInput}: `appId`, `sessionId`,
352
- * `toUserId` (decimal string), optional `expectedHostTerm`, optional
353
- * `idempotencyKey`.
354
- * @returns The updated {@link GmSession} (`hostUserId`, `hostTerm`).
355
- * @throws {CrowdyGraphQLError} `FORBIDDEN`, `SESSION_HOST_TERM_STALE`,
356
- * `SESSION_TARGET_NOT_PARTICIPANT` (the user named is not joined; refetch
357
- * the snapshot and pick a participant), `SESSION_ENDED`.
358
- */
359
- transferSessionHost(input: GameModelTransferSessionHostMutationVariables['input']): Promise<GameModelTransferSessionHostMutation['gameModelTransferSessionHost']>;
360
- /**
361
- * **Sessions** — end a session as `'completed'` (default) or `'abandoned'`.
362
- * Every joined participant is marked left (`session_ended`), admission
363
- * becomes `closed`, `endedAt` / `endReason` are set and an `ended` event
364
- * closes the revision log. Session host or app admin. (The server also ends a
365
- * session nobody has been joined to for longer than its `emptyTimeoutSec` as
366
- * `abandoned` / `empty_timeout`.)
367
- *
368
- * @param input - {@link EndSessionInput}: `appId`, `sessionId`, optional
369
- * `reason`, optional `expectedHostTerm`, optional `idempotencyKey`.
370
- * @returns The ended {@link GmSession}.
371
- * @throws {CrowdyGraphQLError} `FORBIDDEN`, `SESSION_HOST_TERM_STALE`,
372
- * `SESSION_ENDED` (already ended), `NOT_FOUND`.
373
- */
374
- endSession(input: GameModelEndSessionMutationVariables['input']): Promise<GameModelEndSessionMutation['gameModelEndSession']>;
375
- /**
376
- * **Containers** — instantiate a container (a runtime entity of a given type),
377
- * optionally within a session, with an owner and initial property values.
378
- * Subject to the type's `instantiableBy` rule (`admin | member | owner`).
379
- *
380
- * @param input - {@link CreateContainerInput}: `appId` (decimal string), an
381
- * optional `sessionId` (omit for an app-global container), the `typeName` to
382
- * instantiate, a `displayName`, optional `description`, optional
383
- * `ownerUserId` (decimal string; defaults to the caller for member/owner
384
- * instantiation), optional `metadataJson` (JSON-object string), and optional
385
- * initial `properties` (each `{ key, valueType, valueJson }` with a
386
- * JSON-encoded value).
387
- * @returns The created {@link GmContainer}.
388
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`,
389
- * `FORBIDDEN` if `instantiableBy` disallows the caller, `NOT_FOUND` for an
390
- * unknown type, or `BAD_USER_INPUT` for malformed properties.
391
- */
392
- createContainer(input: GameModelCreateContainerMutationVariables['input']): Promise<GameModelCreateContainerMutation['gameModelCreateContainer']>;
393
- /**
394
- * **Containers** — delete a container instance. Cascades its instance
395
- * properties and any edges connected to it. Allowed for an app admin or the
396
- * container owner. **Destructive.**
397
- *
398
- * @param variables - `{ appId, containerId }`: `appId` (decimal string) and
399
- * the container UUID to delete.
400
- * @returns `true` if a container was deleted, `false` if none matched.
401
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`, or
402
- * `FORBIDDEN` if the caller is neither an app admin nor the owner.
403
- */
404
- deleteContainer(variables: GameModelDeleteContainerMutationVariables): Promise<GameModelDeleteContainerMutation['gameModelDeleteContainer']>;
405
- /**
406
- * **Containers** — set a single property value on a container directly (outside
407
- * a function). Allowed only when the property's `writable` rule
408
- * (`function | owner | admin`) permits the caller; the value is JSON-encoded
409
- * and coerced to the property's declared value type. For game-logic changes
410
- * prefer {@link invoke}, which enforces an authority policy and logs an event.
411
- *
412
- * @param input - {@link SetContainerPropertyInput}: `appId` (decimal string),
413
- * `containerId`, the property `key`, its `valueType` (must match the property
414
- * definition), and `valueJson` (the JSON-encoded value to write).
415
- * @returns The updated {@link GmContainer}.
416
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`,
417
- * `FORBIDDEN` if the property's `writable` rule forbids a direct write,
418
- * `NOT_FOUND` for an unknown container/property, or `BAD_USER_INPUT` for a
419
- * value-type mismatch.
420
- */
421
- setProperty(input: GameModelSetPropertyMutationVariables['input']): Promise<GameModelSetPropertyMutation['gameModelSetProperty']>;
422
- /**
423
- * **Edges** — create a directed relationship edge between two containers (the
424
- * game model is a graph), with a relationship type and optional weight.
425
- *
426
- * @param input - {@link AddEdgeInput}: `appId` (decimal string),
427
- * `fromContainerId` (source) and `toContainerId` (target), a
428
- * `relationshipType` label, an optional numeric `weight`, and optional
429
- * `metadataJson` (JSON-object string).
430
- * @returns The created {@link GmEdge} (`edgeId`, endpoints, type, weight).
431
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`,
432
- * `NOT_FOUND` if either container is unknown, or `BAD_USER_INPUT`.
433
- */
434
- addEdge(input: GameModelAddEdgeMutationVariables['input']): Promise<GameModelAddEdgeMutation['gameModelAddEdge']>;
435
- /**
436
- * **Edges** — delete a directed relationship edge. Allowed for an app admin or
437
- * the owner of the source (`from`) container. **Destructive.**
438
- *
439
- * @param variables - `{ appId, edgeId }`: `appId` (decimal string) and the
440
- * edge UUID to delete.
441
- * @returns `true` if an edge was deleted, `false` if none matched.
442
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`, or
443
- * `FORBIDDEN` if the caller may not delete the edge.
444
- */
445
- deleteEdge(variables: GameModelDeleteEdgeMutationVariables): Promise<GameModelDeleteEdgeMutation['gameModelDeleteEdge']>;
446
- /**
447
- * **Functions** — invoke a studio-defined function against a `self` container
448
- * with JSON params. This is the primary, *safe* way for players to mutate game
449
- * state: the server enforces the function's invoke policy (the authority rule
450
- * tree — `owner_of_self` / `is_host` / `is_current_turn` / `is_participant` /
451
- * `tier_feature` / `group_permission` / `grid_permission` / `condition`),
452
- * evaluates its expressions, atomically applies its declared property
453
- * mutations, and logs an {@link events | event}. Only `player`-scope functions
454
- * are invocable here.
455
- *
456
- * Note: an authority denial or an expression-evaluation error is **not** a
457
- * thrown exception — it comes back as a resolved result with `success: false`
458
- * and `fault.code` (`NOT_ALLOWED` for a policy refusal). Inspect
459
- * `result.success` rather than relying on `try/catch` for those cases.
460
- *
461
- * **The invoke policy applies to app admins too** (ck-api v1.89.0). Your own
462
- * account, testing your own game, is judged exactly like a player's. Before
463
- * that release a `manage_apps` holder skipped every policy implicitly, which
464
- * made policies look unenforced to the people who wrote them. Administrative
465
- * tooling that needs to run a function regardless of its policy sets
466
- * `bypassPolicy: true`: honoured only with `manage_apps` (a GraphQL
467
- * `NOT_ALLOWED` error otherwise, nothing runs), reported back as
468
- * `policyBypassed: true` on the result, and audit-logged server-side.
469
- *
470
- * @param input - {@link InvokeFunctionInput}: `appId` (decimal string), the
471
- * `functionName`, the `selfContainerId` (the container the function runs
472
- * against, referenced as `self` in expressions), an optional `sessionId`
473
- * context, `paramsJson` (a JSON-object string of params), and the optional
474
- * administrative `bypassPolicy` flag described above.
475
- * @returns A {@link GmInvokeResult}: `success`, the logged `eventId`, the
476
- * JSON-encoded `returnValueJson`, the `mutationsApplied` (each with
477
- * before/after JSON values), `fault` when `success` is `false`, and
478
- * `policyBypassed` when the call skipped the policy on purpose.
479
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`,
480
- * `NOT_FOUND` for an unknown function/container, `FORBIDDEN` if the function
481
- * isn't `player`-scope, `NOT_ALLOWED` for `bypassPolicy` without
482
- * `manage_apps`, or `BAD_USER_INPUT` for malformed params. (Authority and
483
- * evaluation failures surface as `success: false`, see above.)
484
- */
485
- invoke(input: GameModelInvokeMutationVariables['input']): Promise<GameModelInvokeMutation['gameModelInvoke']>;
486
- /**
487
- * **Containers** — fetch one container (instance) by id, with its full record
488
- * (unfiltered metadata). For a player-facing view whose property values are
489
- * filtered to what the caller may see, use {@link containerState} instead.
490
- *
491
- * @param variables - `{ appId, containerId }`: `appId` (decimal string) is the
492
- * owning app and `containerId` is the container UUID to fetch.
493
- * @returns The {@link GmContainer}.
494
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`, or
495
- * `NOT_FOUND` if no such container.
496
- */
497
- container(variables: GameModelContainerQueryVariables): Promise<GameModelContainerQuery['gameModelContainer']>;
498
- /**
499
- * **Containers** — list containers in an app, optionally narrowed by container
500
- * type and/or session, filtered by property predicates, and paged.
501
- *
502
- * @param variables - `{ appId, typeName?, sessionId?, where?, limit?, offset? }`:
503
- * `appId` (decimal string); optional `typeName` (omit for all types);
504
- * optional `sessionId` (omit for all containers, including app-global
505
- * ones); optional `where` (max 8 AND-combined
506
- * `{ key, op, valueJson }` predicates — ops `==`, `!=`, `<`, `>`, `<=`,
507
- * `>=`; requires `typeName`; missing properties fall back to the type
508
- * default — the same predicate shape automation selectors use); optional
509
- * `limit`/`offset` paging applied after filtering over the stable
510
- * created-at ordering. `bindingKey` narrows to the one row ensured (or
511
- * seeded) under that key — with `typeName` and `sessionId` it is the
512
- * get-by-key read. **An omitted `limit` returns 200 rows and the
513
- * maximum is 1,000** (`BAD_REQUEST` above it); without `where` the page is
514
- * read in SQL, with `where` the predicates are evaluated after reading at
515
- * most 10,000 rows of the type and a larger type is refused. Requires
516
- * game-api with container predicates (2026-07 or later); older servers
517
- * reject the new arguments.
518
- * @returns The matching {@link GmContainer}s.
519
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`, or
520
- * `BAD_USER_INPUT` for `where` without `typeName` / unsupported ops.
521
- */
522
- containers(variables: GameModelContainersQueryVariables): Promise<GameModelContainersQuery['gameModelContainers']>;
523
- /**
524
- * **Containers** — fetch a container together with its property values
525
- * filtered to what the **calling** user is allowed to see (`public` always;
526
- * `owner`/`hidden` depend on the caller's relationship to the container). Use
527
- * this for a player-facing view of an entity.
528
- *
529
- * @param variables - `{ appId, containerId }`: `appId` (decimal string) and
530
- * the `containerId` UUID whose visible state to fetch.
531
- * @returns A {@link GmContainerState}; its `propertiesJson` is a JSON-object
532
- * string of the properties visible to the caller (`JSON.parse` it).
533
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`, or
534
- * `NOT_FOUND` if no such container.
535
- */
536
- containerState(variables: GameModelContainerStateQueryVariables): Promise<GameModelContainerStateQuery['gameModelContainerState']>;
537
- /**
538
- * **Containers** — the bulk twin of {@link containerState}: identity plus the
539
- * property state visible to the **calling** user for up to **500** containers
540
- * in one call, with the same per-row visibility rules. Ids the app does not
541
- * hold are omitted rather than errors, duplicates come back once, and the
542
- * order follows the input. After paging {@link containers} (default 200, max
543
- * 1,000 per page), two of these pull a page's state — a level of thousands of
544
- * placed objects loads in a handful of calls instead of one per object.
545
- *
546
- * @param variables - `{ appId, containerIds }`: `appId` (decimal string) and
547
- * up to 500 container UUIDs.
548
- * @returns An array of {@link GmContainerState}; each `propertiesJson` is a
549
- * JSON-object string of the properties visible to the caller.
550
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`, or
551
- * `BAD_REQUEST` for more than 500 ids or a non-UUID id.
552
- */
553
- containerStates(variables: GameModelContainerStatesQueryVariables): Promise<GameModelContainerStatesQuery['gameModelContainerStates']>;
554
- /**
555
- * **Edges** — traverse the container graph from a root container along a
556
- * relationship type up to a given depth, returning the reachable nodes and the
557
- * edges between them.
558
- *
559
- * @param variables - `{ appId, rootId, relationshipType, depth? }`: `appId`
560
- * (decimal string); the `rootId` container UUID to start from; the
561
- * `relationshipType` edge label to follow; and optional `depth`, the number
562
- * of edge hops to follow from the root (defaults to `1`).
563
- * @returns A {@link GmTraverseResult}: the `rootId`, the reachable `nodes`
564
- * ({@link GmContainer}[]), and the traversed `edges` ({@link GmEdge}[]).
565
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`, or
566
- * `NOT_FOUND` if the root container is unknown.
567
- */
568
- traverse(variables: GameModelTraverseQueryVariables): Promise<GameModelTraverseQuery['gameModelTraverse']>;
569
- /**
570
- * **Sessions** — fetch one session by id.
571
- *
572
- * @param variables - `{ appId, sessionId }`: `appId` (decimal string) and the
573
- * `sessionId` to fetch.
574
- * @returns The {@link GmSession}.
575
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`, or
576
- * `NOT_FOUND` if no such session.
577
- */
578
- session(variables: GameModelSessionQueryVariables): Promise<GameModelSessionQuery['gameModelSession']>;
579
- /**
580
- * **Sessions** — list sessions in an app, newest first, optionally filtered
581
- * by `status` (`active | completed | abandoned`), `admission`
582
- * (`open | locked | closed` — `'open'` lists joinable lobbies) and/or
583
- * `hostUserId`.
584
- *
585
- * @param variables - `{ appId, status?, admission?, hostUserId?, limit? }`
586
- * (`limit` defaults to 200, max 1000).
587
- * @returns The matching {@link GmSession}s.
588
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`.
589
- */
590
- sessions(variables: GameModelSessionsQueryVariables): Promise<GameModelSessionsQuery['gameModelSessions']>;
591
- /**
592
- * **Sessions** — the authoritative state of one session at one revision: the
593
- * session row and every *joined* participant. Pull it when you subscribe
594
- * with {@link sessionChanged}, after a reconnect, or when the stream shows a
595
- * revision gap; then apply only events whose `revision` is above
596
- * `snapshot.revision`.
597
- *
598
- * @param variables - `{ appId, sessionId }`.
599
- * @returns `{ revision, session, participants }`.
600
- * @throws {CrowdyGraphQLError} `NOT_FOUND`, `UNAUTHENTICATED` / `SCOPE_MISSING`.
601
- */
602
- sessionSnapshot(variables: GameModelSessionSnapshotQueryVariables): Promise<GameModelSessionSnapshotQuery['gameModelSessionSnapshot']>;
603
- /**
604
- * **Sessions** — the events of a session with a revision strictly greater
605
- * than `afterRevision`, oldest first: the gap-fill read behind
606
- * {@link sessionChanged}. Events of ended sessions are retained for a bounded
607
- * period, then purged.
608
- *
609
- * @param variables - `{ appId, sessionId, afterRevision, limit? }`;
610
- * `afterRevision` is a decimal string (`'0'` for everything retained).
611
- * @returns The matching {@link GmSessionEvent}s.
612
- */
613
- sessionEvents(variables: GameModelSessionEventsQueryVariables): Promise<GameModelSessionEventsQuery['gameModelSessionEvents']>;
614
- /**
615
- * **Sessions (operators)** — the full roster including departed participants
616
- * (with `leftReason` and `incarnation`), each joined participant's live
617
- * presence verdict (`fresh | grace | stale | legacy | left`), and the most
618
- * recent events. Requires app-admin (`manage_apps`).
619
- *
620
- * @param variables - `{ appId, sessionId }`.
621
- * @throws {CrowdyGraphQLError} `FORBIDDEN` without `manage_apps`.
622
- */
623
- sessionInspect(variables: GameModelSessionInspectQueryVariables): Promise<GameModelSessionInspectQuery['gameModelSessionInspect']>;
624
- /**
625
- * **Events** — query the function-invocation event log (audit trail) with
626
- * optional filters and pagination. Useful for debugging functions or showing
627
- * recent activity.
628
- *
629
- * @param variables - `{ appId, sessionId?, selfContainerId?, functionName?,
630
- * success?, limit?, offset? }`: `appId` (decimal string); optional
631
- * `sessionId`; optional `selfContainerId` (the UUID the function ran
632
- * against); optional `functionName`; optional `success` (`true` = succeeded,
633
- * `false` = failed). `limit` (page size) and `offset` (rows to skip) are
634
- * **deprecated** — see below.
635
- * @returns The matching {@link GmEvent}s (each with `paramsJson`,
636
- * `mutationsAppliedJson`, `returnValueJson`, `success`, `errorMessage`, and
637
- * `executedAt`).
638
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`.
639
- * @remarks The `limit`/`offset` fields use deprecated offset pagination. For
640
- * large logs prefer the Relay-style `gameModelEventsConnection(first:, after:)`
641
- * cursor query (available on the schema via `client.graphql`). See
642
- * https://docs.crowdedkingdoms.com/overview/pagination.
643
- */
644
- events(variables: GameModelEventsQueryVariables): Promise<GameModelEventsQuery['gameModelEvents']>;
645
- /**
646
- * **Events** — Relay-style cursor pagination over the function-invocation
647
- * event log; the preferred alternative to {@link events} for large logs. Page
648
- * with `first` plus the previous page's `pageInfo.endCursor` as `after`. See
649
- * https://docs.crowdedkingdoms.com/overview/pagination.
650
- *
651
- * @param variables - `{ appId, first?, after?, sessionId?, selfContainerId?,
652
- * functionName?, success? }`.
653
- * @returns A {@link GameModelEventsConnection} (`edges { cursor node }`,
654
- * `pageInfo`, `totalCount`).
655
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`.
656
- */
657
- eventsConnection(variables: GameModelEventsConnectionQueryVariables): Promise<GameModelEventsConnectionQuery['gameModelEventsConnection']>;
658
- /**
659
- * **Diagnostics** — stitch one flow correlation id into a single
660
- * cross-engine timeline: the model **events** ({@link events} rows), the
661
- * **automationRuns**, and the compute **moduleRuns** that share the
662
- * `flowId` minted at the entry edge (a player {@link invoke}, an automation
663
- * run, or a `computeInvoke`) and propagated across `model_invoke`, the
664
- * event bus, and `emit_compute_event`. Each array is ordered by time
665
- * ascending, so the three together read as one causal trace — "what
666
- * happened to this kill's reward" in one query instead of three
667
- * hand-joined ones. Take the `flowId` from the `flowId` field on any
668
- * {@link GmEvent}, {@link GmAutomationRun}, or {@link WasmModuleRun}
669
- * (selected by the default fragments since SDK 8.13.0).
670
- *
671
- * Requires the app-admin **`manage_apps`** permission (a diagnostics
672
- * surface, like {@link automationRuns}) and a game-api with the
673
- * `gameModelFlow` query (2026-07-19 or later; older servers reject the
674
- * operation with a validation error).
675
- *
676
- * @param variables - `{ appId, flowId }`: `appId` (decimal string) and the
677
- * flow correlation id (a UUID string). An unknown `flowId` returns three
678
- * empty arrays.
679
- * @returns The {@link GmFlowTimeline}: `flowId`, `events`,
680
- * `automationRuns`, and `moduleRuns`, each time-ascending.
681
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`,
682
- * `FORBIDDEN` (`requiredPermission === 'manage_apps'`), or `BAD_REQUEST`
683
- * if `flowId` is not a UUID.
684
- */
685
- flow(variables: GameModelFlowQueryVariables): Promise<GameModelFlowQuery['gameModelFlow']>;
686
- /**
687
- * **Seed** — bulk-create game-model definitions (container types, property
688
- * defs, functions) and optionally instances (containers + edges) in one
689
- * transaction; used to initialize or import a model.
690
- *
691
- * Requires the app-admin **`manage_apps`** permission.
692
- *
693
- * @param input - {@link SeedGameModelInput}: `appId` (decimal string); an
694
- * optional `sessionId` to seed instances into (omit/`null` = app-global);
695
- * and arrays of `containerTypes`, `propertyDefinitions`, `functions`,
696
- * `containers`, and `edges` to create. Seed containers carry a developer
697
- * `tempId`; seed edges reference containers by those temp ids
698
- * (`fromTempId`/`toTempId`). A container may name its own `bindingKey`
699
- * (on a type that is `instantiableBy: 'admin'` or carries a `bindPolicyJson`,
700
- * and not beginning with `seed:`) so a runtime `gameModelEnsureContainer` later
701
- * resolves the same row; otherwise it binds as `seed:` + `tempId`. A
702
- * caller-keyed row that already exists is adopted only if its `ownerUserId`
703
- * matches (a re-seed); a row a player claimed first is refused and nothing
704
- * is written. At most
705
- * **1,000 containers per call**, all-or-nothing; the same key on two types
706
- * is two rows. A container type may declare `scope: 'app'` (one row per key
707
- * for the whole app) or `'session'` (default). Seeded rows fire no
708
- * `container_created` automation triggers or change-feed events.
709
- * @returns A {@link GmSeedResult}: the counts created, non-fatal `warnings`,
710
- * and `idMapJson` — a JSON-object string mapping each seed `tempId` to the
711
- * created container UUID (`JSON.parse` it to wire up follow-up calls).
712
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`,
713
- * `FORBIDDEN` (with `extensions.requiredPermission === 'manage_apps'`) if the
714
- * caller lacks app-admin, or `BAD_USER_INPUT` for malformed definitions.
715
- */
716
- seed(input: GameModelSeedMutationVariables['input']): Promise<GameModelSeedMutation['gameModelSeed']>;
717
- /**
718
- * **Container types** — create or update a container type: the studio-defined
719
- * schema for a kind of runtime entity (like a class). Idempotent on
720
- * `(appId, typeName)`.
721
- *
722
- * Requires the app-admin **`manage_apps`** permission.
723
- *
724
- * @param input - {@link UpsertContainerTypeInput}: `appId` (decimal string);
725
- * the `typeName` (the stable upsert key, unique per app); a `displayName`;
726
- * optional `description`; optional `instantiableBy` (`admin | member |
727
- * owner`); optional `defaultPropertyVisibility` (`public | owner | hidden`);
728
- * optional `bindPolicyJson` (who may claim a `bindingKey` on
729
- * `ensureContainer`; omit to leave the type unbound); optional `scope`
730
- * (`'session'` default — one row per key per session; `'app'` — one row
731
- * per key for the whole app, on which `ensureContainer` /
732
- * `createContainer` with a `sessionId` are refused with
733
- * `CONTAINER_TYPE_APP_SCOPED`; changing to `'app'` is refused while the
734
- * type holds session-scoped rows); and optional `metadataJson`
735
- * (JSON-object string).
736
- * @returns The upserted {@link GmContainerType}.
737
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`,
738
- * `FORBIDDEN` (`requiredPermission === 'manage_apps'`), or `BAD_USER_INPUT`.
739
- */
740
- upsertContainerType(input: GameModelUpsertContainerTypeMutationVariables['input']): Promise<GameModelUpsertContainerTypeMutation['gameModelUpsertContainerType']>;
741
- /**
742
- * **Property definitions** — create or update a typed property on a container
743
- * type (a field with a default value, read visibility, and writability).
744
- * Idempotent on `(appId, containerTypeName, key)`.
745
- *
746
- * Requires the app-admin **`manage_apps`** permission.
747
- *
748
- * @param input - {@link UpsertPropertyDefInput}: `appId` (decimal string); the
749
- * `containerTypeName` to define on; the property `key` (part of the upsert
750
- * key); a `valueType` (`int | float | string | bool | array | object |
751
- * container_ref`); optional `defaultValueJson` (JSON-encoded default);
752
- * optional `visibility` (`public | owner | hidden`); optional `writable`
753
- * (`function | owner | admin`); and optional `description`.
754
- * @returns The upserted {@link GmPropertyDef}.
755
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`,
756
- * `FORBIDDEN` (`requiredPermission === 'manage_apps'`), `NOT_FOUND` for an
757
- * unknown container type, or `BAD_USER_INPUT`.
758
- */
759
- upsertPropertyDef(input: GameModelUpsertPropertyDefMutationVariables['input']): Promise<GameModelUpsertPropertyDefMutation['gameModelUpsertPropertyDef']>;
760
- /**
761
- * **Property definitions** — delete a property definition from a container
762
- * type. Does **not** remove instance property values already stored on
763
- * containers. **Destructive.**
764
- *
765
- * Requires the app-admin **`manage_apps`** permission.
766
- *
767
- * @param variables - `{ appId, containerTypeName, key }`.
768
- * @returns `true` if a definition was deleted, `false` if none matched.
769
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`, or
770
- * `FORBIDDEN` (`requiredPermission === 'manage_apps'`).
771
- */
772
- deletePropertyDef(variables: GameModelDeletePropertyDefMutationVariables): Promise<GameModelDeletePropertyDefMutation['gameModelDeletePropertyDef']>;
773
- /**
774
- * **Container types** — delete a container type and its property definitions.
775
- * Refuses if live containers of that type exist, or if functions are bound to
776
- * it — delete those first. **Destructive.**
777
- *
778
- * Requires the app-admin **`manage_apps`** permission.
779
- *
780
- * @param variables - `{ appId, typeName }`.
781
- * @returns `true` if a type was deleted, `false` if none matched.
782
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`,
783
- * `FORBIDDEN` (`requiredPermission === 'manage_apps'`), or `BAD_USER_INPUT`
784
- * when containers or bound functions still exist.
785
- */
786
- deleteContainerType(variables: GameModelDeleteContainerTypeMutationVariables): Promise<GameModelDeleteContainerTypeMutation['gameModelDeleteContainerType']>;
787
- /**
788
- * **Functions** — create or update a studio-defined function: a named,
789
- * sandboxed behaviour with typed parameters, declared property mutations
790
- * (expressions compiled to an AST server-side — never `eval`'d), an optional
791
- * return expression, an invoke scope, and an invoke policy (authority rule
792
- * tree). Idempotent on `(appId, name)`. Players run these via {@link invoke}.
793
- *
794
- * Requires the app-admin **`manage_apps`** permission.
795
- *
796
- * @param input - {@link UpsertFunctionInput}: `appId` (decimal string); the
797
- * `name` (upsert key, used to invoke it); optional `containerTypeName` to
798
- * bind to (omit for a global function); optional `description`; optional
799
- * `returnType`; `parameters` (typed `{ name, valueType, required?,
800
- * defaultValueJson?, … }`); `mutations` (declared writes `{ target, property,
801
- * expression }`, applied atomically); optional `returnExpression`;
802
- * `invokeScope` (`player | server | internal`); and `invokePolicyJson` (a
803
- * JSON-encoded authority rule tree).
804
- * @returns The upserted {@link GmFunction}, including any non-fatal
805
- * static-analysis `warnings` from this upload.
806
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`,
807
- * `FORBIDDEN` (`requiredPermission === 'manage_apps'`), or `BAD_USER_INPUT`
808
- * for an expression/policy that fails to compile.
809
- */
810
- upsertFunction(input: GameModelUpsertFunctionMutationVariables['input']): Promise<GameModelUpsertFunctionMutation['gameModelUpsertFunction']>;
811
- /**
812
- * **Functions** — delete a studio-defined function by name. **Destructive.**
813
- *
814
- * Requires the app-admin **`manage_apps`** permission.
815
- *
816
- * @param variables - `{ appId, name }`: `appId` (decimal string) and the
817
- * function `name` to delete.
818
- * @returns `true` if a function was deleted, `false` if none matched.
819
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`, or
820
- * `FORBIDDEN` (`requiredPermission === 'manage_apps'`) if the caller lacks
821
- * app-admin.
822
- */
823
- deleteFunction(variables: GameModelDeleteFunctionMutationVariables): Promise<GameModelDeleteFunctionMutation['gameModelDeleteFunction']>;
824
- /**
825
- * **App features** — define an app feature key that functions can gate on (via
826
- * a `tier_feature` authority rule) and that access tiers can be granted.
827
- * Idempotent on `(appId, featureKey)`.
828
- *
829
- * Requires the app-admin **`manage_apps`** permission.
830
- *
831
- * @param input - {@link DefineAppFeatureInput}: `appId` (decimal string); the
832
- * `featureKey` (referenced by `tier_feature` rules); and an optional
833
- * `description`.
834
- * @returns The defined {@link GmAppFeature}.
835
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`,
836
- * `FORBIDDEN` (`requiredPermission === 'manage_apps'`), or `BAD_USER_INPUT`.
837
- */
838
- defineFeature(input: GameModelDefineFeatureMutationVariables['input']): Promise<GameModelDefineFeatureMutation['gameModelDefineFeature']>;
839
- /**
840
- * **App features** — grant a feature key to an access tier, so users on that
841
- * tier satisfy `tier_feature` authority checks for it.
842
- *
843
- * Requires the app-admin **`manage_apps`** permission.
844
- *
845
- * @param input - {@link GrantTierFeatureInput}: `appId` (decimal string); the
846
- * `tierId` (decimal string) of the access tier; and the `featureKey` to
847
- * grant to that tier.
848
- * @returns The {@link GmTierFeature} grant record.
849
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`,
850
- * `FORBIDDEN` (`requiredPermission === 'manage_apps'`), or `NOT_FOUND` for an
851
- * unknown tier/feature.
852
- */
853
- grantTierFeature(input: GameModelGrantTierFeatureMutationVariables['input']): Promise<GameModelGrantTierFeatureMutation['gameModelGrantTierFeature']>;
854
- /**
855
- * **Policy** — set the app's game-model runtime policy: who may create
856
- * sessions and the default role assigned to new session participants.
857
- *
858
- * Requires the app-admin **`manage_apps`** permission.
859
- *
860
- * @param input - {@link SetGameModelPolicyInput}: `appId` (decimal string); an
861
- * optional `sessionCreationPolicy` (`admin | member | anyone`); and an
862
- * optional `defaultParticipantRole`.
863
- * @returns The updated {@link GmAppPolicy}.
864
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`,
865
- * `FORBIDDEN` (`requiredPermission === 'manage_apps'`), or `BAD_USER_INPUT`.
866
- */
867
- setPolicy(input: GameModelSetPolicyMutationVariables['input']): Promise<GameModelSetPolicyMutation['gameModelSetPolicy']>;
868
- /**
869
- * **Container types** — fetch a container type's full schema: its property
870
- * definitions plus the functions available on it. A studio/authoring read.
871
- *
872
- * Requires the app-admin **`manage_apps`** permission.
873
- *
874
- * @param variables - `{ appId, typeName }`: `appId` (decimal string) and the
875
- * `typeName` whose schema to fetch.
876
- * @returns A {@link GmTypeSchema}: the `typeName`, its `propertyDefinitions`
877
- * ({@link GmPropertyDef}[]), and its `functions` ({@link GmFunction}[]).
878
- * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`,
879
- * `FORBIDDEN` (`requiredPermission === 'manage_apps'`), or `NOT_FOUND` for an
880
- * unknown type.
881
- */
882
- typeSchema(variables: GameModelTypeSchemaQueryVariables): Promise<GameModelTypeSchemaQuery['gameModelTypeSchema']>;
883
- /**
884
- * **Container types** — list every container type defined for an app. A
885
- * studio/authoring read. Requires the app-admin **`manage_apps`** permission.
886
- *
887
- * @param variables - `{ appId }`.
888
- * @returns The app's {@link GmContainerType}s.
889
- */
890
- containerTypes(variables: GameModelContainerTypesQueryVariables): Promise<GameModelContainerTypesQuery['gameModelContainerTypes']>;
891
- /**
892
- * **Property definitions** — list the property definitions for one container
893
- * type. A studio/authoring read. Requires the app-admin **`manage_apps`**
894
- * permission.
895
- *
896
- * @param variables - `{ appId, typeName }`.
897
- * @returns The type's {@link GmPropertyDef}s.
898
- */
899
- propertyDefs(variables: GameModelPropertyDefsQueryVariables): Promise<GameModelPropertyDefsQuery['gameModelPropertyDefs']>;
900
- /**
901
- * **Functions** — fetch one studio-defined function by name (including its
902
- * parameters, mutations, and notification effects). Requires the app-admin
903
- * **`manage_apps`** permission.
904
- *
905
- * @param variables - `{ appId, name }`.
906
- * @returns The {@link GmFunction}.
907
- */
908
- getFunction(variables: GameModelFunctionQueryVariables): Promise<GameModelFunctionQuery['gameModelFunction']>;
909
- /**
910
- * **Functions** — list studio-defined functions for an app, optionally
911
- * filtered to those bound to a container type. Requires the app-admin
912
- * **`manage_apps`** permission.
913
- *
914
- * @param variables - `{ appId, containerTypeName? }`.
915
- * @returns The matching {@link GmFunction}s.
916
- */
917
- functions(variables: GameModelFunctionsQueryVariables): Promise<GameModelFunctionsQuery['gameModelFunctions']>;
918
- /**
919
- * **App features** — list the feature keys defined for an app. Requires the
920
- * app-admin **`manage_apps`** permission.
921
- *
922
- * @param variables - `{ appId }`.
923
- * @returns The app's {@link GmAppFeature}s.
924
- */
925
- features(variables: GameModelFeaturesQueryVariables): Promise<GameModelFeaturesQuery['gameModelFeatures']>;
926
- /**
927
- * **App features** — list tier→feature grants for an app, optionally filtered
928
- * to one tier. Requires the app-admin **`manage_apps`** permission.
929
- *
930
- * @param variables - `{ appId, tierId? }`.
931
- * @returns The {@link GmTierFeature} grants.
932
- */
933
- tierFeatures(variables: GameModelTierFeaturesQueryVariables): Promise<GameModelTierFeaturesQuery['gameModelTierFeatures']>;
934
- /**
935
- * **App features** — revoke a feature key from an access tier (the inverse of
936
- * {@link grantTierFeature}). Requires the app-admin **`manage_apps`**
937
- * permission.
938
- *
939
- * @param input - {@link GrantTierFeatureInput} (`appId`, `tierId`, `featureKey`).
940
- * @returns `true` if a grant was removed.
941
- */
942
- revokeTierFeature(input: GameModelRevokeTierFeatureMutationVariables['input']): Promise<GameModelRevokeTierFeatureMutation['gameModelRevokeTierFeature']>;
943
- /**
944
- * **Policy** — read the app's game-model runtime policy (session-creation
945
- * policy + default participant role). Requires the app-admin **`manage_apps`**
946
- * permission.
947
- *
948
- * @param variables - `{ appId }`.
949
- * @returns The {@link GmAppPolicy}.
950
- */
951
- policy(variables: GameModelPolicyQueryVariables): Promise<GameModelPolicyQuery['gameModelPolicy']>;
952
- /**
953
- * **Automations** — create or update an autonomous process ("automation" /
954
- * NPC): a server-driven entry-point function bound to a trigger
955
- * (`schedule | event | manual`), an optional run-as identity, a target/
956
- * candidate selector, and a per-automation safety budget. The entry-point
957
- * function must be marked `autonomousInvocable` (see {@link upsertFunction}).
958
- * Idempotent on `(appId, name)`. The game-api dispatcher runs it headlessly;
959
- * a tick is just "invoke a function on behalf of the server".
960
- *
961
- * **Only while the app has a player in it** (2026-09-01). A scheduled
962
- * automation that comes due while the app is empty is skipped silently and
963
- * rescheduled from the moment a player returns; the missed runs are never made
964
- * up. Write the entry point so it is idempotent in ELAPSED TIME -- advance the
965
- * world by `now - lastRun` rather than by one step per tick -- or it will
966
- * silently fall behind whenever nobody is playing. `event` and `manual`
967
- * triggers are unaffected: something already asked for those.
968
- *
969
- * Requires the app-admin **`manage_apps`** permission.
970
- *
971
- * @param input - {@link UpsertAutomationInput}: `appId`; `name` (upsert key);
972
- * the action — `actionKind: 'model_function'` (default) with
973
- * `functionName`, or `actionKind: 'compute_invoke'` with
974
- * `computeModuleName` + `computeExport` (invokes a compute-module invoke
975
- * export on the trusted server path; `targetMode` forced to `global`,
976
- * selectors don't apply — requires game-api 2026-07+); `targetMode`
977
- * (`container | type | global`) with `selfContainerId` /
978
- * `targetTypeName`; optional `sessionId`, `paramsJson`, `selectorJson`
979
- * (model-data candidate selection), `runAsUserId`; the trigger
980
- * (`triggerType`, `scheduleKind`, `intervalMs` / `cronExpr`); and the safety
981
- * budget (`maxTargets`, `maxFnDepth`, `gasLimit`, `runTimeoutMs`,
982
- * `maxRunsPerMinute`, `failureThreshold`, `cooldownMs`).
983
- * @returns The upserted {@link GmAutomation}, including circuit-breaker state.
984
- */
985
- upsertAutomation(input: GameModelUpsertAutomationMutationVariables['input']): Promise<GameModelUpsertAutomationMutation['gameModelUpsertAutomation']>;
986
- /**
987
- * **Automations** — delete an automation by name (also removes its event
988
- * triggers). **Destructive.** Requires the app-admin **`manage_apps`**
989
- * permission.
990
- *
991
- * @param variables - `{ appId, name }`.
992
- * @returns `true` if one was deleted.
993
- */
994
- deleteAutomation(variables: GameModelDeleteAutomationMutationVariables): Promise<GameModelDeleteAutomationMutation['gameModelDeleteAutomation']>;
995
- /**
996
- * **Automations** — enable or disable an automation. Re-enabling also resets
997
- * its circuit breaker so a tripped automation resumes. Requires the app-admin
998
- * **`manage_apps`** permission.
999
- *
1000
- * @param variables - `{ appId, name, enabled }`.
1001
- * @returns The updated {@link GmAutomation}.
1002
- */
1003
- setAutomationEnabled(variables: GameModelSetAutomationEnabledMutationVariables): Promise<GameModelSetAutomationEnabledMutation['gameModelSetAutomationEnabled']>;
1004
- /**
1005
- * **Automations** — create an event trigger that fires an automation in
1006
- * reaction to model activity (`function_invoked` | `property_changed` |
1007
- * `container_created` | `player_count_changed`), matched in the API server
1008
- * post-commit. Requires the app-admin **`manage_apps`** permission.
1009
- *
1010
- * Each event matches on its own filters, and a filter the event does not
1011
- * match on is rejected rather than silently never firing:
1012
- * `function_invoked` takes `functionName` and `containerTypeName` (the type
1013
- * of the invocation's `self` container); `property_changed` takes
1014
- * `containerTypeName`, `propertyKey`, and `writeSource`;
1015
- * `container_created` takes `containerTypeName`; `player_count_changed`
1016
- * takes none.
1017
- *
1018
- * `writeSource` decides which writes a `property_changed` trigger sees:
1019
- * `direct` (a {@link GameModelAPI.setProperty} call), `function` (a mutation
1020
- * applied inside an invoke, automation run, or timer fire), or `any`
1021
- * (default). Most game logic writes properties from inside functions, so a
1022
- * trigger watching such a property needs `function` or `any`.
1023
- *
1024
- * @param input - {@link UpsertAutomationTriggerInput}: `appId`,
1025
- * `automationName`, `onEvent`, the filters valid for that event, and
1026
- * `debounceMs`.
1027
- * @returns The created {@link GmAutomationTrigger}.
1028
- */
1029
- upsertAutomationTrigger(input: GameModelUpsertAutomationTriggerMutationVariables['input']): Promise<GameModelUpsertAutomationTriggerMutation['gameModelUpsertAutomationTrigger']>;
1030
- /**
1031
- * **Automations** — delete an event trigger by id. Requires the app-admin
1032
- * **`manage_apps`** permission.
1033
- *
1034
- * @param variables - `{ appId, triggerId }`.
1035
- * @returns `true` if one was deleted.
1036
- */
1037
- deleteAutomationTrigger(variables: GameModelDeleteAutomationTriggerMutationVariables): Promise<GameModelDeleteAutomationTriggerMutation['gameModelDeleteAutomationTrigger']>;
1038
- /**
1039
- * **Automations** — set the app's automation policy (platform guardrails: the
1040
- * kill switch, max automations, the minimum schedule interval floor, max
1041
- * fan-out, max event cascade depth, the aggregate per-minute run ceiling, and
1042
- * the timer floor / pending-timer ceiling).
1043
- * Requires the app-admin **`manage_apps`** permission.
1044
- *
1045
- * @param input - {@link SetAutomationPolicyInput}.
1046
- * @returns The updated {@link GmAutomationPolicy}.
1047
- */
1048
- setAutomationPolicy(input: GameModelSetAutomationPolicyMutationVariables['input']): Promise<GameModelSetAutomationPolicyMutation['gameModelSetAutomationPolicy']>;
1049
- /**
1050
- * **Automations** — run an automation once, immediately (manual trigger),
1051
- * regardless of its schedule. Applies the same guard chain and records a run.
1052
- * Useful for testing an NPC. Requires the app-admin **`manage_apps`**
1053
- * permission.
1054
- *
1055
- * @param variables - `{ appId, name }`.
1056
- * @returns The recorded {@link GmAutomationRun}.
1057
- */
1058
- runAutomation(variables: GameModelRunAutomationMutationVariables): Promise<GameModelRunAutomationMutation['gameModelRunAutomation']>;
1059
- /**
1060
- * **Automations** — list the automations defined for an app (with
1061
- * circuit-breaker state). Requires the app-admin **`manage_apps`** permission.
1062
- *
1063
- * @param variables - `{ appId }`.
1064
- * @returns The {@link GmAutomation}s.
1065
- */
1066
- automations(variables: GameModelAutomationsQueryVariables): Promise<GameModelAutomationsQuery['gameModelAutomations']>;
1067
- /**
1068
- * **Automations** — fetch one automation by name. Requires the app-admin
1069
- * **`manage_apps`** permission.
1070
- *
1071
- * @param variables - `{ appId, name }`.
1072
- * @returns The {@link GmAutomation}.
1073
- */
1074
- automation(variables: GameModelAutomationQueryVariables): Promise<GameModelAutomationQuery['gameModelAutomation']>;
1075
- /**
1076
- * **Automations** — list event triggers for an app, optionally filtered to one
1077
- * automation by name. Requires the app-admin **`manage_apps`** permission.
1078
- *
1079
- * Use this to debug a trigger that isn't firing: `warnings` reports filters
1080
- * that can never match, `lastMatchedAt` is null until the trigger has
1081
- * actually dispatched a run, and `matchCount24h` shows recent activity.
1082
- *
1083
- * @param variables - `{ appId, automationName? }`.
1084
- * @returns The {@link GmAutomationTrigger}s.
1085
- */
1086
- automationTriggers(variables: GameModelAutomationTriggersQueryVariables): Promise<GameModelAutomationTriggersQuery['gameModelAutomationTriggers']>;
1087
- /**
1088
- * **Automations** — read the app's automation policy. Requires the app-admin
1089
- * **`manage_apps`** permission.
1090
- *
1091
- * @param variables - `{ appId }`.
1092
- * @returns The {@link GmAutomationPolicy}.
1093
- */
1094
- automationPolicy(variables: GameModelAutomationPolicyQueryVariables): Promise<GameModelAutomationPolicyQuery['gameModelAutomationPolicy']>;
1095
- /**
1096
- * **Automations** — list automation runs (the monitoring/audit trail), newest
1097
- * first, optionally filtered by automation name and/or outcome. Requires the
1098
- * app-admin **`manage_apps`** permission.
1099
- *
1100
- * @param variables - `{ appId, automationName?, success?, limit?, offset? }`.
1101
- * @returns The {@link GmAutomationRun}s.
1102
- */
1103
- automationRuns(variables: GameModelAutomationRunsQueryVariables): Promise<GameModelAutomationRunsQuery['gameModelAutomationRuns']>;
1104
- /**
1105
- * **Automations** — aggregate automation activity over a recent window
1106
- * (throughput, failure rate, compute, per-automation breakdown). The
1107
- * "what are my NPCs doing" view. Requires the app-admin **`manage_apps`**
1108
- * permission.
1109
- *
1110
- * @param variables - `{ appId, windowMinutes? }` (default 60, max 1440).
1111
- * @returns The {@link GmAutomationStats}.
1112
- */
1113
- automationStats(variables: GameModelAutomationStatsQueryVariables): Promise<GameModelAutomationStatsQuery['gameModelAutomationStats']>;
1114
- /**
1115
- * **Diagnostics** — a snapshot of an app's game-model footprint and recent
1116
- * activity (row counts + 24h invocation activity + top functions). Helps
1117
- * developers understand what is in their game and their database. Requires the
1118
- * app-admin **`manage_apps`** permission.
1119
- *
1120
- * @param variables - `{ appId }`.
1121
- * @returns The {@link GmAppDiagnostics}.
1122
- */
1123
- appDiagnostics(variables: GameModelAppDiagnosticsQueryVariables): Promise<GameModelAppDiagnosticsQuery['gameModelAppDiagnostics']>;
1124
- /**
1125
- * **Timers** — arm a one-shot timer: invoke a function once, after a delay.
1126
- * The timer is durable (it survives an API restart) and claimed by exactly one
1127
- * replica, so it fires once. Requires the app-admin **`manage_apps`**
1128
- * permission, because a timer fires headlessly with system authority rather
1129
- * than a player's.
1130
- *
1131
- * A timer whose deadline passes while the app has no players **waits** rather
1132
- * than firing into an empty world: the sweep only claims timers for apps with a
1133
- * player present, so it is still armed and fires when somebody returns. It is
1134
- * therefore late, not lost -- read the current time in the handler rather than
1135
- * assuming the delay you asked for is the delay that elapsed.
1136
- *
1137
- * For player-driven delays, declare a `timers` effect on the function instead
1138
- * (see {@link GameModelAPI.upsertFunction}) so the delay is part of your game
1139
- * logic and is armed atomically with that invocation's mutations.
1140
- *
1141
- * The target function must be `autonomousInvocable`. Pass `dedupeKey` to make
1142
- * re-arming replace the pending timer instead of queueing another fire, which
1143
- * is how you implement "reset the countdown".
1144
- *
1145
- * @param input - {@link ScheduleInvokeInput}: `appId`, `functionName`,
1146
- * `selfContainerId`, `delayMs`, and optional `paramsJson`, `sessionId`, and
1147
- * `dedupeKey`.
1148
- * @returns The armed {@link GmTimer}.
1149
- */
1150
- scheduleInvoke(input: GameModelScheduleInvokeMutationVariables['input']): Promise<GameModelScheduleInvokeMutation['gameModelScheduleInvoke']>;
1151
- /**
1152
- * **Timers** — cancel pending timers by id or by dedupe key. A timer already
1153
- * claimed for execution cannot be cancelled. Requires the app-admin
1154
- * **`manage_apps`** permission.
1155
- *
1156
- * @param variables - `{ appId, timerId?, dedupeKey? }` (supply at least one
1157
- * selector).
1158
- * @returns How many pending timers were removed.
1159
- */
1160
- cancelTimer(variables: GameModelCancelTimerMutationVariables): Promise<GameModelCancelTimerMutation['gameModelCancelTimer']>;
1161
- /**
1162
- * **Timers** — list pending one-shot timers, soonest first. A timer leaves
1163
- * this list the instant it is claimed for execution, so an empty list means
1164
- * nothing is *scheduled* — not that nothing ran. Fires that already happened
1165
- * appear in {@link GameModelAPI.automationRuns} with
1166
- * `triggerSource: 'timer'`. Requires the app-admin **`manage_apps`**
1167
- * permission.
1168
- *
1169
- * @param variables - `{ appId, sessionId?, limit? }` (limit 1-200, default 50).
1170
- * @returns The pending {@link GmTimer}s.
1171
- */
1172
- timers(variables: GameModelTimersQueryVariables): Promise<GameModelTimersQuery['gameModelTimers']>;
1173
- }
1174
- //# sourceMappingURL=gameModel.d.ts.map