@crowdedkingdoms/crowdyjs 17.13.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 (284) hide show
  1. package/MIGRATION.md +163 -1
  2. package/README.md +142 -146
  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 +59 -57
  9. package/dist/crowdy-studio/controller.d.ts.map +1 -1
  10. package/dist/crowdy-studio/controller.js +268 -206
  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 -47
  16. package/dist/crowdy-studio/embed/hud-layer.d.ts +1 -1
  17. package/dist/crowdy-studio/embed/panel.d.ts +3 -12
  18. package/dist/crowdy-studio/embed/panel.d.ts.map +1 -1
  19. package/dist/crowdy-studio/embed/panel.js +3 -6
  20. package/dist/crowdy-studio/index.d.ts +1 -3
  21. package/dist/crowdy-studio/index.d.ts.map +1 -1
  22. package/dist/crowdy-studio/index.js +0 -2
  23. package/dist/crowdy-studio/models.d.ts +3 -4
  24. package/dist/crowdy-studio/models.d.ts.map +1 -1
  25. package/dist/crowdy-studio/starter-projects.d.ts +8 -4
  26. package/dist/crowdy-studio/starter-projects.d.ts.map +1 -1
  27. package/dist/crowdy-studio/starter-projects.js +83 -100
  28. package/dist/domains/appAccess.d.ts +14 -1
  29. package/dist/domains/appAccess.d.ts.map +1 -1
  30. package/dist/domains/appAccess.js +37 -1
  31. package/dist/domains/exec.d.ts +162 -15
  32. package/dist/domains/exec.d.ts.map +1 -1
  33. package/dist/domains/exec.js +180 -18
  34. package/dist/domains/host.d.ts +3 -3
  35. package/dist/domains/host.js +3 -3
  36. package/dist/domains/marketplace.d.ts +9 -58
  37. package/dist/domains/marketplace.d.ts.map +1 -1
  38. package/dist/domains/marketplace.js +9 -106
  39. package/dist/domains/playerWallet.d.ts +6 -12
  40. package/dist/domains/playerWallet.d.ts.map +1 -1
  41. package/dist/domains/playerWallet.js +6 -21
  42. package/dist/errors.d.ts +7 -13
  43. package/dist/errors.d.ts.map +1 -1
  44. package/dist/errors.js +6 -10
  45. package/dist/generated/graphql.d.ts +1384 -7977
  46. package/dist/generated/graphql.d.ts.map +1 -1
  47. package/dist/generated/graphql.js +22 -321
  48. package/dist/grid-mods/exec-client-halves.d.ts +156 -0
  49. package/dist/grid-mods/exec-client-halves.d.ts.map +1 -0
  50. package/dist/grid-mods/exec-client-halves.js +356 -0
  51. package/dist/grid-mods/grid-host-calls.d.ts +29 -15
  52. package/dist/grid-mods/grid-host-calls.d.ts.map +1 -1
  53. package/dist/grid-mods/grid-host-calls.js +40 -44
  54. package/dist/grid-mods/index.d.ts +1 -0
  55. package/dist/grid-mods/index.d.ts.map +1 -1
  56. package/dist/grid-mods/index.js +1 -0
  57. package/dist/grid-mods/mod-runtime.d.ts +21 -6
  58. package/dist/grid-mods/mod-runtime.d.ts.map +1 -1
  59. package/dist/grid-mods/mod-runtime.js +6 -2
  60. package/dist/grid-scope.d.ts +0 -188
  61. package/dist/grid-scope.d.ts.map +1 -1
  62. package/dist/grid-scope.js +0 -69
  63. package/dist/index.d.ts +12 -18
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +11 -16
  66. package/dist/kit/actions.d.ts +5 -9
  67. package/dist/kit/actions.d.ts.map +1 -1
  68. package/dist/kit/actions.js +5 -9
  69. package/dist/kit/index.d.ts +2 -33
  70. package/dist/kit/index.d.ts.map +1 -1
  71. package/dist/kit/index.js +1 -32
  72. package/dist/kit/kit.d.ts +8 -208
  73. package/dist/kit/kit.d.ts.map +1 -1
  74. package/dist/kit/kit.js +5 -163
  75. package/dist/kit/social.d.ts +1 -3
  76. package/dist/kit/social.d.ts.map +1 -1
  77. package/dist/kit/social.js +1 -3
  78. package/dist/kit/wire.d.ts +16 -5
  79. package/dist/kit/wire.d.ts.map +1 -1
  80. package/dist/kit/wire.js +19 -5
  81. package/dist/live-coding/assets/browser-authoring-index.json +1 -1
  82. package/dist/live-coding/assets/manifest.json +1 -1
  83. package/dist/live-coding/browser-authoring-index.generated.d.ts.map +1 -1
  84. package/dist/live-coding/browser-authoring-index.generated.js +1496 -4386
  85. package/dist/live-coding/rust-analysis.d.ts.map +1 -1
  86. package/dist/live-coding/rust-analysis.js +31 -23
  87. package/dist/player-runtime/client-host-calls.d.ts +8 -0
  88. package/dist/player-runtime/client-host-calls.d.ts.map +1 -0
  89. package/dist/player-runtime/client-host-calls.js +28 -0
  90. package/dist/player-runtime/glue-runtime.d.ts +27 -10
  91. package/dist/player-runtime/glue-runtime.d.ts.map +1 -1
  92. package/dist/player-runtime/glue-runtime.js +40 -45
  93. package/dist/player-runtime/glue-sab.d.ts +2 -2
  94. package/dist/player-runtime/glue-sab.js +2 -2
  95. package/dist/player-runtime/player-code-broker.d.ts +80 -24
  96. package/dist/player-runtime/player-code-broker.d.ts.map +1 -1
  97. package/dist/player-runtime/player-code-broker.js +169 -41
  98. package/dist/player-runtime/player-glue-worker.d.ts +8 -8
  99. package/dist/player-runtime/player-glue-worker.d.ts.map +1 -1
  100. package/dist/player-runtime/player-glue-worker.js +26 -9
  101. package/dist/stores/actors.d.ts +12 -2
  102. package/dist/stores/actors.d.ts.map +1 -1
  103. package/dist/stores/actors.js +43 -18
  104. package/dist/stores/chunks.d.ts +12 -0
  105. package/dist/stores/chunks.d.ts.map +1 -1
  106. package/dist/stores/chunks.js +112 -39
  107. package/dist/stores/durable.d.ts.map +1 -1
  108. package/dist/stores/durable.js +2 -1
  109. package/dist/stores/inbox.d.ts +1 -1
  110. package/dist/stores/inbox.d.ts.map +1 -1
  111. package/dist/stores/index.d.ts +0 -11
  112. package/dist/stores/index.d.ts.map +1 -1
  113. package/dist/stores/index.js +0 -4
  114. package/dist/stores/session.d.ts +0 -2
  115. package/dist/stores/session.d.ts.map +1 -1
  116. package/package.json +1 -1
  117. package/dist/crowdy-studio/model-lint-log.d.ts +0 -76
  118. package/dist/crowdy-studio/model-lint-log.d.ts.map +0 -1
  119. package/dist/crowdy-studio/model-lint-log.js +0 -93
  120. package/dist/crowdy-studio/model-lint.d.ts +0 -61
  121. package/dist/crowdy-studio/model-lint.d.ts.map +0 -1
  122. package/dist/crowdy-studio/model-lint.js +0 -45
  123. package/dist/domains/compute.d.ts +0 -208
  124. package/dist/domains/compute.d.ts.map +0 -1
  125. package/dist/domains/compute.js +0 -274
  126. package/dist/domains/controlPlane.d.ts +0 -38
  127. package/dist/domains/controlPlane.d.ts.map +0 -1
  128. package/dist/domains/controlPlane.js +0 -43
  129. package/dist/domains/gameModel.d.ts +0 -1174
  130. package/dist/domains/gameModel.d.ts.map +0 -1
  131. package/dist/domains/gameModel.js +0 -1333
  132. package/dist/domains/playerCompute.d.ts +0 -91
  133. package/dist/domains/playerCompute.d.ts.map +0 -1
  134. package/dist/domains/playerCompute.js +0 -136
  135. package/dist/domains/playerModel.d.ts +0 -20
  136. package/dist/domains/playerModel.d.ts.map +0 -1
  137. package/dist/domains/playerModel.js +0 -54
  138. package/dist/kit/abilities.d.ts +0 -66
  139. package/dist/kit/abilities.d.ts.map +0 -1
  140. package/dist/kit/abilities.js +0 -71
  141. package/dist/kit/blueprints/combat.d.ts +0 -81
  142. package/dist/kit/blueprints/combat.d.ts.map +0 -1
  143. package/dist/kit/blueprints/combat.js +0 -357
  144. package/dist/kit/blueprints/core.d.ts +0 -222
  145. package/dist/kit/blueprints/core.d.ts.map +0 -1
  146. package/dist/kit/blueprints/core.js +0 -185
  147. package/dist/kit/blueprints/decks.d.ts +0 -50
  148. package/dist/kit/blueprints/decks.d.ts.map +0 -1
  149. package/dist/kit/blueprints/decks.js +0 -163
  150. package/dist/kit/blueprints/economy.d.ts +0 -88
  151. package/dist/kit/blueprints/economy.d.ts.map +0 -1
  152. package/dist/kit/blueprints/economy.js +0 -533
  153. package/dist/kit/blueprints/guild.d.ts +0 -51
  154. package/dist/kit/blueprints/guild.d.ts.map +0 -1
  155. package/dist/kit/blueprints/guild.js +0 -50
  156. package/dist/kit/blueprints/index.d.ts +0 -23
  157. package/dist/kit/blueprints/index.d.ts.map +0 -1
  158. package/dist/kit/blueprints/index.js +0 -22
  159. package/dist/kit/blueprints/inventory.d.ts +0 -84
  160. package/dist/kit/blueprints/inventory.d.ts.map +0 -1
  161. package/dist/kit/blueprints/inventory.js +0 -257
  162. package/dist/kit/blueprints/leaderboards.d.ts +0 -49
  163. package/dist/kit/blueprints/leaderboards.d.ts.map +0 -1
  164. package/dist/kit/blueprints/leaderboards.js +0 -126
  165. package/dist/kit/blueprints/liveops.d.ts +0 -42
  166. package/dist/kit/blueprints/liveops.d.ts.map +0 -1
  167. package/dist/kit/blueprints/liveops.js +0 -170
  168. package/dist/kit/blueprints/locks.d.ts +0 -82
  169. package/dist/kit/blueprints/locks.d.ts.map +0 -1
  170. package/dist/kit/blueprints/locks.js +0 -155
  171. package/dist/kit/blueprints/loot.d.ts +0 -90
  172. package/dist/kit/blueprints/loot.d.ts.map +0 -1
  173. package/dist/kit/blueprints/loot.js +0 -229
  174. package/dist/kit/blueprints/matches.d.ts +0 -84
  175. package/dist/kit/blueprints/matches.d.ts.map +0 -1
  176. package/dist/kit/blueprints/matches.js +0 -349
  177. package/dist/kit/blueprints/moderation.d.ts +0 -32
  178. package/dist/kit/blueprints/moderation.d.ts.map +0 -1
  179. package/dist/kit/blueprints/moderation.js +0 -140
  180. package/dist/kit/blueprints/npcs.d.ts +0 -78
  181. package/dist/kit/blueprints/npcs.d.ts.map +0 -1
  182. package/dist/kit/blueprints/npcs.js +0 -125
  183. package/dist/kit/blueprints/plots.d.ts +0 -63
  184. package/dist/kit/blueprints/plots.d.ts.map +0 -1
  185. package/dist/kit/blueprints/plots.js +0 -151
  186. package/dist/kit/blueprints/progression.d.ts +0 -68
  187. package/dist/kit/blueprints/progression.d.ts.map +0 -1
  188. package/dist/kit/blueprints/progression.js +0 -324
  189. package/dist/kit/blueprints/quests.d.ts +0 -72
  190. package/dist/kit/blueprints/quests.d.ts.map +0 -1
  191. package/dist/kit/blueprints/quests.js +0 -285
  192. package/dist/kit/blueprints/worldsim.d.ts +0 -91
  193. package/dist/kit/blueprints/worldsim.d.ts.map +0 -1
  194. package/dist/kit/blueprints/worldsim.js +0 -468
  195. package/dist/kit/combat.d.ts +0 -141
  196. package/dist/kit/combat.d.ts.map +0 -1
  197. package/dist/kit/combat.js +0 -196
  198. package/dist/kit/decks.d.ts +0 -157
  199. package/dist/kit/decks.d.ts.map +0 -1
  200. package/dist/kit/decks.js +0 -186
  201. package/dist/kit/director.d.ts +0 -88
  202. package/dist/kit/director.d.ts.map +0 -1
  203. package/dist/kit/director.js +0 -86
  204. package/dist/kit/economy.d.ts +0 -289
  205. package/dist/kit/economy.d.ts.map +0 -1
  206. package/dist/kit/economy.js +0 -427
  207. package/dist/kit/engine.d.ts +0 -48
  208. package/dist/kit/engine.d.ts.map +0 -1
  209. package/dist/kit/engine.js +0 -113
  210. package/dist/kit/features.d.ts +0 -60
  211. package/dist/kit/features.d.ts.map +0 -1
  212. package/dist/kit/features.js +0 -65
  213. package/dist/kit/instances.d.ts +0 -52
  214. package/dist/kit/instances.d.ts.map +0 -1
  215. package/dist/kit/instances.js +0 -60
  216. package/dist/kit/inventory.d.ts +0 -129
  217. package/dist/kit/inventory.d.ts.map +0 -1
  218. package/dist/kit/inventory.js +0 -200
  219. package/dist/kit/leaderboards.d.ts +0 -86
  220. package/dist/kit/leaderboards.d.ts.map +0 -1
  221. package/dist/kit/leaderboards.js +0 -133
  222. package/dist/kit/liveops.d.ts +0 -112
  223. package/dist/kit/liveops.d.ts.map +0 -1
  224. package/dist/kit/liveops.js +0 -183
  225. package/dist/kit/loot.d.ts +0 -128
  226. package/dist/kit/loot.d.ts.map +0 -1
  227. package/dist/kit/loot.js +0 -160
  228. package/dist/kit/matches.d.ts +0 -301
  229. package/dist/kit/matches.d.ts.map +0 -1
  230. package/dist/kit/matches.js +0 -458
  231. package/dist/kit/matchmaking.d.ts +0 -57
  232. package/dist/kit/matchmaking.d.ts.map +0 -1
  233. package/dist/kit/matchmaking.js +0 -59
  234. package/dist/kit/minigames.d.ts +0 -30
  235. package/dist/kit/minigames.d.ts.map +0 -1
  236. package/dist/kit/minigames.js +0 -38
  237. package/dist/kit/mobs.d.ts +0 -90
  238. package/dist/kit/mobs.d.ts.map +0 -1
  239. package/dist/kit/mobs.js +0 -98
  240. package/dist/kit/moderation.d.ts +0 -73
  241. package/dist/kit/moderation.d.ts.map +0 -1
  242. package/dist/kit/moderation.js +0 -103
  243. package/dist/kit/movement.d.ts +0 -78
  244. package/dist/kit/movement.d.ts.map +0 -1
  245. package/dist/kit/movement.js +0 -103
  246. package/dist/kit/notifications.d.ts +0 -45
  247. package/dist/kit/notifications.d.ts.map +0 -1
  248. package/dist/kit/notifications.js +0 -67
  249. package/dist/kit/npcs.d.ts +0 -226
  250. package/dist/kit/npcs.d.ts.map +0 -1
  251. package/dist/kit/npcs.js +0 -141
  252. package/dist/kit/objects.d.ts +0 -116
  253. package/dist/kit/objects.d.ts.map +0 -1
  254. package/dist/kit/objects.js +0 -119
  255. package/dist/kit/pets.d.ts +0 -85
  256. package/dist/kit/pets.d.ts.map +0 -1
  257. package/dist/kit/pets.js +0 -96
  258. package/dist/kit/plots.d.ts +0 -85
  259. package/dist/kit/plots.d.ts.map +0 -1
  260. package/dist/kit/plots.js +0 -113
  261. package/dist/kit/progression.d.ts +0 -181
  262. package/dist/kit/progression.d.ts.map +0 -1
  263. package/dist/kit/progression.js +0 -265
  264. package/dist/kit/quests.d.ts +0 -171
  265. package/dist/kit/quests.d.ts.map +0 -1
  266. package/dist/kit/quests.js +0 -237
  267. package/dist/kit/racing.d.ts +0 -85
  268. package/dist/kit/racing.d.ts.map +0 -1
  269. package/dist/kit/racing.js +0 -99
  270. package/dist/kit/shared.d.ts +0 -73
  271. package/dist/kit/shared.d.ts.map +0 -1
  272. package/dist/kit/shared.js +0 -101
  273. package/dist/kit/telemetry.d.ts +0 -66
  274. package/dist/kit/telemetry.d.ts.map +0 -1
  275. package/dist/kit/telemetry.js +0 -133
  276. package/dist/kit/territory.d.ts +0 -97
  277. package/dist/kit/territory.d.ts.map +0 -1
  278. package/dist/kit/territory.js +0 -114
  279. package/dist/kit/worldsim.d.ts +0 -263
  280. package/dist/kit/worldsim.d.ts.map +0 -1
  281. package/dist/kit/worldsim.js +0 -268
  282. package/dist/stores/model.d.ts +0 -81
  283. package/dist/stores/model.d.ts.map +0 -1
  284. package/dist/stores/model.js +0 -163
@@ -1,170 +0,0 @@
1
- import { kitPolicyJson, toSnakeCase, trustedAuthorityFields, } from './core.js';
2
- /** Compute the type/function names a liveops blueprint (and its runtime helper) uses. */
3
- export function liveopsNames(typePrefix = '') {
4
- const fnPrefix = typePrefix ? `${toSnakeCase(typePrefix)}_` : '';
5
- return {
6
- windowType: `${typePrefix}EventWindow`,
7
- seasonType: `${typePrefix}SeasonDef`,
8
- openWindowFn: `${fnPrefix}open_window`,
9
- closeWindowFn: `${fnPrefix}close_window`,
10
- activateSeasonFn: `${fnPrefix}activate_season`,
11
- };
12
- }
13
- /**
14
- * Blueprint for **liveops** (matrix P4, P3): event windows, seasons, and
15
- * battle-pass composition — MODEL-FIRST (the coexistence policy):
16
- *
17
- * - `EventWindow` containers carry a `window_id`, an `active` flag, optional
18
- * `opens_at_ms`/`closes_at_ms` timestamps, and an opaque `modifiers` JSON
19
- * blob. Admin (or cron-automation) functions flip `active`; when both
20
- * timestamps are set, the **liveops-scheduler compute engine** flips the
21
- * flag itself and broadcasts the modifiers on the compute bus
22
- * (`liveops_window_opened`/`closed`) for other engines to apply — spawn
23
- * multipliers, weather locks, double gold.
24
- * - `SeasonDef` containers name a season (`season_id`, `active`,
25
- * `starts_at_ms`/`ends_at_ms`) and its battle-pass composition: the
26
- * `pass_track` is a progression-layer track name and `pass_features` a
27
- * JSON array of feature gates unlocked per tier — a battle pass is a
28
- * SEASON + PROGRESSION TRACK + FEATURE GATES, no new machinery.
29
- *
30
- * Runtime counterpart: `client.kit(appId).liveops`.
31
- */
32
- export function liveopsBlueprint(options = {}) {
33
- const { typePrefix = '', adminAuthority = 'server' } = options;
34
- const names = liveopsNames(typePrefix);
35
- const trusted = trustedAuthorityFields(adminAuthority);
36
- const propertyDefinitions = [
37
- {
38
- containerTypeName: names.windowType,
39
- key: 'window_id',
40
- valueType: 'string',
41
- defaultValueJson: '""',
42
- description: 'Stable id other systems reference (unique per app by convention).',
43
- },
44
- {
45
- containerTypeName: names.windowType,
46
- key: 'active',
47
- valueType: 'bool',
48
- defaultValueJson: 'false',
49
- description: 'Live flag. Flipped by the admin functions, cron automations, or the liveops-scheduler engine (timestamp windows).',
50
- },
51
- {
52
- containerTypeName: names.windowType,
53
- key: 'opens_at_ms',
54
- valueType: 'int',
55
- defaultValueJson: '0',
56
- description: 'Optional epoch-ms open time (with closes_at_ms, the scheduler owns the flag).',
57
- },
58
- {
59
- containerTypeName: names.windowType,
60
- key: 'closes_at_ms',
61
- valueType: 'int',
62
- defaultValueJson: '0',
63
- description: 'Optional epoch-ms close time.',
64
- },
65
- {
66
- containerTypeName: names.windowType,
67
- key: 'modifiers',
68
- valueType: 'string',
69
- defaultValueJson: '"{}"',
70
- description: 'Opaque JSON broadcast on the compute bus when the window opens/closes (consumed by engines).',
71
- },
72
- {
73
- containerTypeName: names.seasonType,
74
- key: 'season_id',
75
- valueType: 'string',
76
- defaultValueJson: '""',
77
- description: 'Stable season id (e.g. "s3").',
78
- },
79
- {
80
- containerTypeName: names.seasonType,
81
- key: 'active',
82
- valueType: 'bool',
83
- defaultValueJson: 'false',
84
- description: 'The one live season (activate_season deactivates the rest by convention).',
85
- },
86
- {
87
- containerTypeName: names.seasonType,
88
- key: 'starts_at_ms',
89
- valueType: 'int',
90
- defaultValueJson: '0',
91
- description: 'Season start (epoch ms; informational).',
92
- },
93
- {
94
- containerTypeName: names.seasonType,
95
- key: 'ends_at_ms',
96
- valueType: 'int',
97
- defaultValueJson: '0',
98
- description: 'Season end (epoch ms; informational).',
99
- },
100
- {
101
- containerTypeName: names.seasonType,
102
- key: 'pass_track',
103
- valueType: 'string',
104
- defaultValueJson: '""',
105
- description: "Battle-pass composition: the progression layer's track name whose tiers gate rewards.",
106
- },
107
- {
108
- containerTypeName: names.seasonType,
109
- key: 'pass_features',
110
- valueType: 'string',
111
- defaultValueJson: '"[]"',
112
- description: 'Battle-pass composition: JSON array of feature-gate keys unlocked per pass tier.',
113
- },
114
- ];
115
- const functions = [
116
- {
117
- name: names.openWindowFn,
118
- containerTypeName: names.windowType,
119
- returnType: 'bool',
120
- mutations: [{ target: 'self', property: 'active', expression: 'true' }],
121
- returnExpression: 'self.active',
122
- invokePolicyJson: trusted.invokePolicyJson ?? kitPolicyJson({ type: 'is_automation' }),
123
- ...(trusted.autonomousInvocable !== undefined
124
- ? { autonomousInvocable: trusted.autonomousInvocable }
125
- : {}),
126
- description: 'Open the window (admin/automation). The liveops-scheduler engine broadcasts the modifiers on the next tick.',
127
- },
128
- {
129
- name: names.closeWindowFn,
130
- containerTypeName: names.windowType,
131
- returnType: 'bool',
132
- mutations: [{ target: 'self', property: 'active', expression: 'false' }],
133
- returnExpression: 'self.active',
134
- invokePolicyJson: trusted.invokePolicyJson ?? kitPolicyJson({ type: 'is_automation' }),
135
- ...(trusted.autonomousInvocable !== undefined
136
- ? { autonomousInvocable: trusted.autonomousInvocable }
137
- : {}),
138
- description: 'Close the window (admin/automation).',
139
- },
140
- {
141
- name: names.activateSeasonFn,
142
- containerTypeName: names.seasonType,
143
- returnType: 'bool',
144
- mutations: [{ target: 'self', property: 'active', expression: 'true' }],
145
- returnExpression: 'self.active',
146
- invokePolicyJson: trusted.invokePolicyJson ?? kitPolicyJson({ type: 'is_automation' }),
147
- ...(trusted.autonomousInvocable !== undefined
148
- ? { autonomousInvocable: trusted.autonomousInvocable }
149
- : {}),
150
- description: 'Activate this season (admin/automation). Deactivate the previous season separately (one live season by convention).',
151
- },
152
- ];
153
- return {
154
- name: 'liveops',
155
- containerTypes: [
156
- {
157
- typeName: names.windowType,
158
- displayName: 'Liveops event window',
159
- description: 'A liveops window: active flag + optional timestamps + modifier JSON broadcast by the scheduler engine.',
160
- },
161
- {
162
- typeName: names.seasonType,
163
- displayName: 'Liveops season',
164
- description: 'A season definition; battle passes compose a season with a progression track + feature gates.',
165
- },
166
- ],
167
- propertyDefinitions,
168
- functions,
169
- };
170
- }
@@ -1,82 +0,0 @@
1
- import { type KitBlueprint, type KitInvokePolicy } from './core.js';
2
- /**
3
- * The authority source that may operate a lockable object. Several may be
4
- * combined (any one grants access — they are OR'd):
5
- *
6
- * - `owner` — only the container's owner (`owner_of_self`); "only the owner
7
- * of this chest can open it".
8
- * - `key` — the caller must own a matching key item; "if a player has key 1
9
- * they can open door 1". Adds a required `key_id` (`container_ref`) param.
10
- * - `gridPermission` — the caller must hold a runtime grid permission; ties
11
- * the object to a world region ("movement permission on chunk X opens the
12
- * doors in it").
13
- * - `groupPermission` — the caller must be in a team/group (optionally with a
14
- * specific group permission).
15
- * - `custom` — any hand-written {@link KitInvokePolicy} rule.
16
- */
17
- export type LockAuthority = {
18
- kind: 'owner';
19
- } | {
20
- kind: 'key';
21
- } | {
22
- kind: 'gridPermission';
23
- key: string;
24
- gridId?: string;
25
- } | {
26
- /**
27
- * The caller must hold the runtime permission on the grid covering the
28
- * chunk the OBJECT stands in (`cx`/`cy`/`cz` int properties, seeded via
29
- * `ObjectsKit.create({ chunk })`). No hand-pinned grid id — one function
30
- * serves every such object in the world. `mode` picks the covering grid
31
- * when several overlap: 'first' (enforcement parity, default) |
32
- * 'smallest' (innermost plot) | 'largest'. Requires game-api v0.13.12+.
33
- */
34
- kind: 'chunkPermission';
35
- key: string;
36
- mode?: 'first' | 'smallest' | 'largest';
37
- } | {
38
- kind: 'groupPermission';
39
- groupId: string;
40
- permission?: string;
41
- } | {
42
- kind: 'custom';
43
- rule: KitInvokePolicy;
44
- };
45
- /** Options for {@link lockBlueprint}. */
46
- export interface LockBlueprintOptions {
47
- /**
48
- * Container type name for the lockable object (`Door`, `Chest`, `Gate`, …).
49
- * Also drives the function names (`open_door` / `close_door`). Defaults to
50
- * `'Lockable'`.
51
- */
52
- objectTypeName?: string;
53
- /** Key item type name (only used with a `key` authority). Defaults to `<objectTypeName>Key`. */
54
- keyTypeName?: string;
55
- /** One or more authority sources; any one grants access. */
56
- authority: LockAuthority | LockAuthority[];
57
- /**
58
- * Extra policy rule AND'ed on top of the OR'd authorities — e.g.
59
- * `featureGate('vip')` for members-only doors regardless of keys.
60
- */
61
- policyExtra?: KitInvokePolicy;
62
- }
63
- /** Names derived by {@link lockBlueprint} for a given object type. */
64
- export interface LockNames {
65
- objectType: string;
66
- keyType: string;
67
- openFn: string;
68
- closeFn: string;
69
- }
70
- /** Compute the type/function names a lock blueprint (and its runtime helper) uses. */
71
- export declare function lockNames(objectTypeName?: string, keyTypeName?: string): LockNames;
72
- /**
73
- * Blueprint for a **lockable game object** (door, chest, gate, switch) whose
74
- * `open`/`close` functions are gated by a configurable authority source:
75
- * ownership, a key item the caller must hold, a runtime grid permission, a
76
- * team/group permission, or any custom policy rule. Multiple authorities are
77
- * OR'd, so "the owner, or anyone with the right key" is one blueprint.
78
- *
79
- * Runtime counterpart: `client.kit(appId).objects`.
80
- */
81
- export declare function lockBlueprint(options: LockBlueprintOptions): KitBlueprint;
82
- //# sourceMappingURL=locks.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"locks.d.ts","sourceRoot":"","sources":["../../../src/kit/blueprints/locks.ts"],"names":[],"mappings":"AAMA,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,eAAe,EACrB,MAAM,WAAW,CAAC;AAEnB;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,GACf;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GACxD;IACE;;;;;;;OAOG;IACH,IAAI,EAAE,iBAAiB,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,CAAC;CACzC,GACD;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GACjE;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,eAAe,CAAA;CAAE,CAAC;AAE9C,yCAAyC;AACzC,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gGAAgG;IAChG,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,SAAS,EAAE,aAAa,GAAG,aAAa,EAAE,CAAC;IAC3C;;;OAGG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B;AAED,sEAAsE;AACtE,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,sFAAsF;AACtF,wBAAgB,SAAS,CACvB,cAAc,SAAa,EAC3B,WAAW,CAAC,EAAE,MAAM,GACnB,SAAS,CAQX;AAwCD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,YAAY,CA6GzE"}
@@ -1,155 +0,0 @@
1
- import { andPolicies, kitPolicyJson, toSnakeCase, } from './core.js';
2
- /** Compute the type/function names a lock blueprint (and its runtime helper) uses. */
3
- export function lockNames(objectTypeName = 'Lockable', keyTypeName) {
4
- const snake = toSnakeCase(objectTypeName);
5
- return {
6
- objectType: objectTypeName,
7
- keyType: keyTypeName ?? `${objectTypeName}Key`,
8
- openFn: `open_${snake}`,
9
- closeFn: `close_${snake}`,
10
- };
11
- }
12
- function lockAuthorityRule(authority) {
13
- switch (authority.kind) {
14
- case 'owner':
15
- return { type: 'owner_of_self' };
16
- case 'key':
17
- // Container ownership is not readable from expressions, so the key
18
- // mirrors its owner into an `owner_user_id` property; the condition
19
- // verifies both the match and the ownership server-side.
20
- return {
21
- type: 'condition',
22
- expression: 'ref($key_id).key_id == self.required_key_id && ref($key_id).owner_user_id == $caller_user_id',
23
- };
24
- case 'gridPermission':
25
- return {
26
- type: 'grid_permission',
27
- key: authority.key,
28
- ...(authority.gridId !== undefined ? { gridId: authority.gridId } : {}),
29
- };
30
- case 'chunkPermission':
31
- // Resolved per-invocation against the grid covering the object's chunk.
32
- return {
33
- type: 'condition',
34
- expression: `has_chunk_permission($caller_user_id, "${authority.key}", self.cx, self.cy, self.cz, "${authority.mode ?? 'first'}")`,
35
- };
36
- case 'groupPermission':
37
- return {
38
- type: 'group_permission',
39
- groupId: authority.groupId,
40
- ...(authority.permission !== undefined
41
- ? { permission: authority.permission }
42
- : {}),
43
- };
44
- case 'custom':
45
- return authority.rule;
46
- }
47
- }
48
- /**
49
- * Blueprint for a **lockable game object** (door, chest, gate, switch) whose
50
- * `open`/`close` functions are gated by a configurable authority source:
51
- * ownership, a key item the caller must hold, a runtime grid permission, a
52
- * team/group permission, or any custom policy rule. Multiple authorities are
53
- * OR'd, so "the owner, or anyone with the right key" is one blueprint.
54
- *
55
- * Runtime counterpart: `client.kit(appId).objects`.
56
- */
57
- export function lockBlueprint(options) {
58
- const authorities = Array.isArray(options.authority)
59
- ? options.authority
60
- : [options.authority];
61
- if (authorities.length === 0) {
62
- throw new Error('lockBlueprint requires at least one authority source');
63
- }
64
- const names = lockNames(options.objectTypeName, options.keyTypeName);
65
- const usesKey = authorities.some((a) => a.kind === 'key');
66
- const usesChunk = authorities.some((a) => a.kind === 'chunkPermission');
67
- const rules = authorities.map(lockAuthorityRule);
68
- const policy = rules.length === 1 ? rules[0] : { type: 'or', rules };
69
- const policyJson = kitPolicyJson(andPolicies(policy, options.policyExtra));
70
- const parameters = usesKey
71
- ? [{ name: 'key_id', valueType: 'container_ref', required: true }]
72
- : [];
73
- const containerTypes = [
74
- {
75
- typeName: names.objectType,
76
- displayName: names.objectType,
77
- instantiableBy: 'admin',
78
- description: 'A lockable world object operated through gated functions.',
79
- },
80
- ];
81
- const propertyDefinitions = [
82
- {
83
- containerTypeName: names.objectType,
84
- key: 'is_open',
85
- valueType: 'bool',
86
- defaultValueJson: 'false',
87
- },
88
- ];
89
- if (usesChunk) {
90
- // The chunk the object stands in, read by has_chunk_permission().
91
- for (const axis of ['cx', 'cy', 'cz']) {
92
- propertyDefinitions.push({
93
- containerTypeName: names.objectType,
94
- key: axis,
95
- valueType: 'int',
96
- defaultValueJson: '0',
97
- });
98
- }
99
- }
100
- if (usesKey) {
101
- propertyDefinitions.push({
102
- containerTypeName: names.objectType,
103
- key: 'required_key_id',
104
- valueType: 'string',
105
- });
106
- containerTypes.push({
107
- typeName: names.keyType,
108
- displayName: names.keyType,
109
- instantiableBy: 'admin',
110
- description: 'A key item granting access to matching lockable objects.',
111
- });
112
- propertyDefinitions.push({ containerTypeName: names.keyType, key: 'key_id', valueType: 'string' }, {
113
- containerTypeName: names.keyType,
114
- key: 'owner_user_id',
115
- valueType: 'int',
116
- });
117
- }
118
- const openMutation = {
119
- target: 'self',
120
- property: 'is_open',
121
- expression: 'true',
122
- };
123
- const closeMutation = {
124
- target: 'self',
125
- property: 'is_open',
126
- expression: 'false',
127
- };
128
- return {
129
- name: names.objectType,
130
- containerTypes,
131
- propertyDefinitions,
132
- functions: [
133
- {
134
- name: names.openFn,
135
- containerTypeName: names.objectType,
136
- returnType: 'bool',
137
- parameters,
138
- mutations: [openMutation],
139
- returnExpression: 'self.is_open',
140
- invokePolicyJson: policyJson,
141
- description: `Open a ${names.objectType}; the invoke policy decides who may.`,
142
- },
143
- {
144
- name: names.closeFn,
145
- containerTypeName: names.objectType,
146
- returnType: 'bool',
147
- parameters,
148
- mutations: [closeMutation],
149
- returnExpression: 'self.is_open',
150
- invokePolicyJson: policyJson,
151
- description: `Close a ${names.objectType}; same authority as opening.`,
152
- },
153
- ],
154
- };
155
- }
@@ -1,90 +0,0 @@
1
- import { type KitBlueprint, type KitOwnerIdKind, type KitTrustedAuthority } from './core.js';
2
- /** One weighted entry of a loot table. */
3
- export interface LootEntrySpec {
4
- itemId: string;
5
- /** Relative weight (> 0); probabilities are weights normalized per table. */
6
- weight: number;
7
- /** Minimum quantity granted. Defaults to 1. */
8
- minQty?: number;
9
- /** Maximum quantity granted. Defaults to `minQty`. */
10
- maxQty?: number;
11
- }
12
- /** One loot table, unrolled into a single expression at blueprint-build time. */
13
- export interface LootTableSpec {
14
- /** Stable table identifier; also derives the roll function name. */
15
- tableId: string;
16
- /** 1–16 weighted entries (the expression parser caps chain length). */
17
- entries: LootEntrySpec[];
18
- }
19
- /** An event-triggered drop: rolls a pooled LootRoll when a model event fires. */
20
- export interface LootDropSpec {
21
- /** Automation name (unique per app), e.g. `'goblin-drop'`. */
22
- name: string;
23
- /** The table to roll. */
24
- tableId: string;
25
- /** The model event that triggers the drop (e.g. a `mob_died` function). */
26
- onEvent: 'function_invoked' | 'property_changed' | 'container_created';
27
- functionName?: string;
28
- containerTypeName?: string;
29
- propertyKey?: string;
30
- /**
31
- * `property_changed` only: which writes roll the drop. Properties mutated
32
- * by kit functions (a mob's `hp` reaching 0, say) need `'function'` or
33
- * `'any'`; the default `'direct'` only sees client `setProperty` calls.
34
- */
35
- writeSource?: 'direct' | 'function' | 'any';
36
- debounceMs?: number;
37
- /** Rolls per event. Defaults to 1. */
38
- maxTargets?: number;
39
- }
40
- /** Options for {@link lootBlueprint}. */
41
- export interface LootBlueprintOptions {
42
- /** Prefix for the type/function names. Defaults to none. */
43
- typePrefix?: string;
44
- /** The loot tables; entries are unrolled into expressions at build time. */
45
- tables: LootTableSpec[];
46
- /**
47
- * Who may roll. Defaults to `'server'` (app admins / studio backend);
48
- * automations configured via `drops` may always roll (trusted automations
49
- * bypass invoke policies, and the roll functions are marked
50
- * `autonomousInvocable` when drops reference their table).
51
- */
52
- rollAuthority?: KitTrustedAuthority;
53
- /**
54
- * Event-triggered drops: each rolls an UNROLLED pooled `LootRoll` container
55
- * of its table when the event fires (automations mutate — they cannot
56
- * create containers — so keep a small pool of pre-created rolls per table).
57
- */
58
- drops?: LootDropSpec[];
59
- /** Owner-mirror typing (see the kit convention). Defaults to `'int'`. */
60
- ownerIdKind?: KitOwnerIdKind;
61
- }
62
- /** Names derived by {@link lootBlueprint} for a given prefix. */
63
- export interface LootNames {
64
- rollType: string;
65
- claimFn: string;
66
- /** Snake-cased function-name prefix (empty without a `typePrefix`). */
67
- fnPrefix: string;
68
- }
69
- /** Compute the type/function names a loot blueprint (and its runtime helper) uses. */
70
- export declare function lootNames(typePrefix?: string): LootNames;
71
- /** The roll function name for one table. */
72
- export declare function lootRollFn(tableId: string, typePrefix?: string): string;
73
- /**
74
- * Blueprint for **loot tables & drops**: weighted tables are unrolled into
75
- * pure expressions at blueprint-build time (the expression language is
76
- * loop-free), rolled server-side into durable `LootRoll` containers, and
77
- * claimed atomically into an item stack. Covers chest rolls, mob drops, and
78
- * gacha pulls.
79
- *
80
- * Flow: create a `LootRoll` (member) for a table → `roll_<table>` (trusted:
81
- * server scope by default, or an event automation via `drops`) stores a
82
- * single `rand()` seed and resolves item + quantity from it in one
83
- * transaction → the owner claims with `claim_roll`, which marks the roll
84
- * claimed AND grants the stack in the same invoke (no double-claim, no
85
- * client-chosen rewards).
86
- *
87
- * Runtime counterpart: `client.kit(appId).loot`.
88
- */
89
- export declare function lootBlueprint(options: LootBlueprintOptions): KitBlueprint;
90
- //# sourceMappingURL=loot.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loot.d.ts","sourceRoot":"","sources":["../../../src/kit/blueprints/loot.ts"],"names":[],"mappings":"AAIA,OAAO,EAQL,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACzB,MAAM,WAAW,CAAC;AAEnB,0CAA0C;AAC1C,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,6EAA6E;IAC7E,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,iFAAiF;AACjF,MAAM,WAAW,aAAa;IAC5B,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,OAAO,EAAE,aAAa,EAAE,CAAC;CAC1B;AAED,iFAAiF;AACjF,MAAM,WAAW,YAAY;IAC3B,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,OAAO,EAAE,kBAAkB,GAAG,kBAAkB,GAAG,mBAAmB,CAAC;IACvE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,WAAW,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,KAAK,CAAC;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,yCAAyC;AACzC,MAAM,WAAW,oBAAoB;IACnC,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC;;;;OAIG;IACH,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,yEAAyE;IACzE,WAAW,CAAC,EAAE,cAAc,CAAC;CAC9B;AAED,iEAAiE;AACjE,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,sFAAsF;AACtF,wBAAgB,SAAS,CAAC,UAAU,SAAK,GAAG,SAAS,CAOpD;AAED,4CAA4C;AAC5C,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,SAAK,GAAG,MAAM,CAGnE;AAwCD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,YAAY,CAwLzE"}