@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.
- package/MIGRATION.md +92 -1
- package/README.md +93 -162
- package/dist/crowdy-client.d.ts +12 -31
- package/dist/crowdy-client.d.ts.map +1 -1
- package/dist/crowdy-client.js +15 -37
- package/dist/crowdy-dsh/bridge.d.ts.map +1 -1
- package/dist/crowdy-dsh/bridge.js +3 -6
- package/dist/crowdy-studio/controller.d.ts +34 -59
- package/dist/crowdy-studio/controller.d.ts.map +1 -1
- package/dist/crowdy-studio/controller.js +96 -225
- package/dist/crowdy-studio/diagnostics.d.ts +3 -12
- package/dist/crowdy-studio/diagnostics.d.ts.map +1 -1
- package/dist/crowdy-studio/dom-shell.d.ts +2 -4
- package/dist/crowdy-studio/dom-shell.d.ts.map +1 -1
- package/dist/crowdy-studio/dom-shell.js +16 -49
- package/dist/crowdy-studio/embed/hud-layer.d.ts +1 -2
- package/dist/crowdy-studio/embed/hud-layer.d.ts.map +1 -1
- package/dist/crowdy-studio/embed/panel.d.ts +3 -13
- package/dist/crowdy-studio/embed/panel.d.ts.map +1 -1
- package/dist/crowdy-studio/embed/panel.js +3 -6
- package/dist/crowdy-studio/index.d.ts +1 -3
- package/dist/crowdy-studio/index.d.ts.map +1 -1
- package/dist/crowdy-studio/index.js +0 -2
- package/dist/crowdy-studio/models.d.ts +3 -4
- package/dist/crowdy-studio/models.d.ts.map +1 -1
- package/dist/crowdy-studio/starter-projects.d.ts +8 -12
- package/dist/crowdy-studio/starter-projects.d.ts.map +1 -1
- package/dist/crowdy-studio/starter-projects.js +12 -103
- package/dist/domains/appAccess.d.ts +14 -1
- package/dist/domains/appAccess.d.ts.map +1 -1
- package/dist/domains/appAccess.js +37 -1
- package/dist/domains/host.d.ts +3 -3
- package/dist/domains/host.js +3 -3
- package/dist/domains/marketplace.d.ts +9 -70
- package/dist/domains/marketplace.d.ts.map +1 -1
- package/dist/domains/marketplace.js +9 -120
- package/dist/domains/playerWallet.d.ts +6 -12
- package/dist/domains/playerWallet.d.ts.map +1 -1
- package/dist/domains/playerWallet.js +6 -21
- package/dist/errors.d.ts +7 -13
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +6 -10
- package/dist/generated/graphql.d.ts +141 -7083
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +5 -313
- package/dist/grid-mods/exec-client-halves.d.ts +19 -3
- package/dist/grid-mods/exec-client-halves.d.ts.map +1 -1
- package/dist/grid-mods/exec-client-halves.js +17 -2
- package/dist/grid-mods/grid-host-calls.d.ts +29 -17
- package/dist/grid-mods/grid-host-calls.d.ts.map +1 -1
- package/dist/grid-mods/grid-host-calls.js +40 -46
- package/dist/grid-mods/mod-runtime.d.ts +18 -11
- package/dist/grid-mods/mod-runtime.d.ts.map +1 -1
- package/dist/grid-mods/mod-runtime.js +4 -2
- package/dist/grid-scope.d.ts +0 -189
- package/dist/grid-scope.d.ts.map +1 -1
- package/dist/grid-scope.js +0 -70
- package/dist/index.d.ts +11 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -16
- package/dist/kit/actions.d.ts +5 -9
- package/dist/kit/actions.d.ts.map +1 -1
- package/dist/kit/actions.js +5 -9
- package/dist/kit/index.d.ts +2 -33
- package/dist/kit/index.d.ts.map +1 -1
- package/dist/kit/index.js +1 -32
- package/dist/kit/kit.d.ts +8 -208
- package/dist/kit/kit.d.ts.map +1 -1
- package/dist/kit/kit.js +5 -163
- package/dist/kit/social.d.ts +1 -3
- package/dist/kit/social.d.ts.map +1 -1
- package/dist/kit/social.js +1 -3
- package/dist/kit/wire.d.ts +16 -5
- package/dist/kit/wire.d.ts.map +1 -1
- package/dist/kit/wire.js +19 -5
- package/dist/live-coding/assets/browser-authoring-index.json +1 -1
- package/dist/live-coding/assets/manifest.json +1 -1
- package/dist/live-coding/browser-authoring-index.generated.d.ts.map +1 -1
- package/dist/live-coding/browser-authoring-index.generated.js +1496 -4386
- package/dist/live-coding/rust-analysis.d.ts.map +1 -1
- package/dist/live-coding/rust-analysis.js +30 -34
- package/dist/player-runtime/client-host-calls.d.ts +8 -0
- package/dist/player-runtime/client-host-calls.d.ts.map +1 -0
- package/dist/player-runtime/client-host-calls.js +28 -0
- package/dist/player-runtime/glue-runtime.d.ts +24 -20
- package/dist/player-runtime/glue-runtime.d.ts.map +1 -1
- package/dist/player-runtime/glue-runtime.js +26 -55
- package/dist/player-runtime/glue-sab.d.ts +2 -2
- package/dist/player-runtime/glue-sab.js +2 -2
- package/dist/player-runtime/player-code-broker.d.ts +70 -43
- package/dist/player-runtime/player-code-broker.d.ts.map +1 -1
- package/dist/player-runtime/player-code-broker.js +159 -64
- package/dist/player-runtime/player-glue-worker.d.ts +8 -9
- package/dist/player-runtime/player-glue-worker.d.ts.map +1 -1
- package/dist/player-runtime/player-glue-worker.js +26 -11
- package/dist/stores/inbox.d.ts +1 -1
- package/dist/stores/inbox.d.ts.map +1 -1
- package/dist/stores/index.d.ts +0 -11
- package/dist/stores/index.d.ts.map +1 -1
- package/dist/stores/index.js +0 -4
- package/dist/stores/session.d.ts +0 -2
- package/dist/stores/session.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/crowdy-studio/model-lint-log.d.ts +0 -76
- package/dist/crowdy-studio/model-lint-log.d.ts.map +0 -1
- package/dist/crowdy-studio/model-lint-log.js +0 -93
- package/dist/crowdy-studio/model-lint.d.ts +0 -61
- package/dist/crowdy-studio/model-lint.d.ts.map +0 -1
- package/dist/crowdy-studio/model-lint.js +0 -45
- package/dist/domains/compute.d.ts +0 -208
- package/dist/domains/compute.d.ts.map +0 -1
- package/dist/domains/compute.js +0 -274
- package/dist/domains/controlPlane.d.ts +0 -38
- package/dist/domains/controlPlane.d.ts.map +0 -1
- package/dist/domains/controlPlane.js +0 -43
- package/dist/domains/gameModel.d.ts +0 -1174
- package/dist/domains/gameModel.d.ts.map +0 -1
- package/dist/domains/gameModel.js +0 -1333
- package/dist/domains/playerCompute.d.ts +0 -91
- package/dist/domains/playerCompute.d.ts.map +0 -1
- package/dist/domains/playerCompute.js +0 -136
- package/dist/domains/playerModel.d.ts +0 -20
- package/dist/domains/playerModel.d.ts.map +0 -1
- package/dist/domains/playerModel.js +0 -54
- package/dist/kit/abilities.d.ts +0 -66
- package/dist/kit/abilities.d.ts.map +0 -1
- package/dist/kit/abilities.js +0 -71
- package/dist/kit/blueprints/combat.d.ts +0 -81
- package/dist/kit/blueprints/combat.d.ts.map +0 -1
- package/dist/kit/blueprints/combat.js +0 -357
- package/dist/kit/blueprints/core.d.ts +0 -222
- package/dist/kit/blueprints/core.d.ts.map +0 -1
- package/dist/kit/blueprints/core.js +0 -185
- package/dist/kit/blueprints/decks.d.ts +0 -50
- package/dist/kit/blueprints/decks.d.ts.map +0 -1
- package/dist/kit/blueprints/decks.js +0 -163
- package/dist/kit/blueprints/economy.d.ts +0 -88
- package/dist/kit/blueprints/economy.d.ts.map +0 -1
- package/dist/kit/blueprints/economy.js +0 -533
- package/dist/kit/blueprints/guild.d.ts +0 -51
- package/dist/kit/blueprints/guild.d.ts.map +0 -1
- package/dist/kit/blueprints/guild.js +0 -50
- package/dist/kit/blueprints/index.d.ts +0 -23
- package/dist/kit/blueprints/index.d.ts.map +0 -1
- package/dist/kit/blueprints/index.js +0 -22
- package/dist/kit/blueprints/inventory.d.ts +0 -84
- package/dist/kit/blueprints/inventory.d.ts.map +0 -1
- package/dist/kit/blueprints/inventory.js +0 -257
- package/dist/kit/blueprints/leaderboards.d.ts +0 -49
- package/dist/kit/blueprints/leaderboards.d.ts.map +0 -1
- package/dist/kit/blueprints/leaderboards.js +0 -126
- package/dist/kit/blueprints/liveops.d.ts +0 -42
- package/dist/kit/blueprints/liveops.d.ts.map +0 -1
- package/dist/kit/blueprints/liveops.js +0 -170
- package/dist/kit/blueprints/locks.d.ts +0 -82
- package/dist/kit/blueprints/locks.d.ts.map +0 -1
- package/dist/kit/blueprints/locks.js +0 -155
- package/dist/kit/blueprints/loot.d.ts +0 -90
- package/dist/kit/blueprints/loot.d.ts.map +0 -1
- package/dist/kit/blueprints/loot.js +0 -229
- package/dist/kit/blueprints/matches.d.ts +0 -84
- package/dist/kit/blueprints/matches.d.ts.map +0 -1
- package/dist/kit/blueprints/matches.js +0 -349
- package/dist/kit/blueprints/moderation.d.ts +0 -32
- package/dist/kit/blueprints/moderation.d.ts.map +0 -1
- package/dist/kit/blueprints/moderation.js +0 -140
- package/dist/kit/blueprints/npcs.d.ts +0 -78
- package/dist/kit/blueprints/npcs.d.ts.map +0 -1
- package/dist/kit/blueprints/npcs.js +0 -125
- package/dist/kit/blueprints/plots.d.ts +0 -63
- package/dist/kit/blueprints/plots.d.ts.map +0 -1
- package/dist/kit/blueprints/plots.js +0 -151
- package/dist/kit/blueprints/progression.d.ts +0 -68
- package/dist/kit/blueprints/progression.d.ts.map +0 -1
- package/dist/kit/blueprints/progression.js +0 -324
- package/dist/kit/blueprints/quests.d.ts +0 -72
- package/dist/kit/blueprints/quests.d.ts.map +0 -1
- package/dist/kit/blueprints/quests.js +0 -285
- package/dist/kit/blueprints/worldsim.d.ts +0 -91
- package/dist/kit/blueprints/worldsim.d.ts.map +0 -1
- package/dist/kit/blueprints/worldsim.js +0 -468
- package/dist/kit/combat.d.ts +0 -141
- package/dist/kit/combat.d.ts.map +0 -1
- package/dist/kit/combat.js +0 -196
- package/dist/kit/decks.d.ts +0 -157
- package/dist/kit/decks.d.ts.map +0 -1
- package/dist/kit/decks.js +0 -186
- package/dist/kit/director.d.ts +0 -88
- package/dist/kit/director.d.ts.map +0 -1
- package/dist/kit/director.js +0 -86
- package/dist/kit/economy.d.ts +0 -289
- package/dist/kit/economy.d.ts.map +0 -1
- package/dist/kit/economy.js +0 -427
- package/dist/kit/engine.d.ts +0 -48
- package/dist/kit/engine.d.ts.map +0 -1
- package/dist/kit/engine.js +0 -113
- package/dist/kit/features.d.ts +0 -60
- package/dist/kit/features.d.ts.map +0 -1
- package/dist/kit/features.js +0 -65
- package/dist/kit/instances.d.ts +0 -52
- package/dist/kit/instances.d.ts.map +0 -1
- package/dist/kit/instances.js +0 -60
- package/dist/kit/inventory.d.ts +0 -129
- package/dist/kit/inventory.d.ts.map +0 -1
- package/dist/kit/inventory.js +0 -200
- package/dist/kit/leaderboards.d.ts +0 -86
- package/dist/kit/leaderboards.d.ts.map +0 -1
- package/dist/kit/leaderboards.js +0 -133
- package/dist/kit/liveops.d.ts +0 -112
- package/dist/kit/liveops.d.ts.map +0 -1
- package/dist/kit/liveops.js +0 -183
- package/dist/kit/loot.d.ts +0 -128
- package/dist/kit/loot.d.ts.map +0 -1
- package/dist/kit/loot.js +0 -160
- package/dist/kit/matches.d.ts +0 -301
- package/dist/kit/matches.d.ts.map +0 -1
- package/dist/kit/matches.js +0 -458
- package/dist/kit/matchmaking.d.ts +0 -57
- package/dist/kit/matchmaking.d.ts.map +0 -1
- package/dist/kit/matchmaking.js +0 -59
- package/dist/kit/minigames.d.ts +0 -30
- package/dist/kit/minigames.d.ts.map +0 -1
- package/dist/kit/minigames.js +0 -38
- package/dist/kit/mobs.d.ts +0 -90
- package/dist/kit/mobs.d.ts.map +0 -1
- package/dist/kit/mobs.js +0 -98
- package/dist/kit/moderation.d.ts +0 -73
- package/dist/kit/moderation.d.ts.map +0 -1
- package/dist/kit/moderation.js +0 -103
- package/dist/kit/movement.d.ts +0 -78
- package/dist/kit/movement.d.ts.map +0 -1
- package/dist/kit/movement.js +0 -103
- package/dist/kit/notifications.d.ts +0 -45
- package/dist/kit/notifications.d.ts.map +0 -1
- package/dist/kit/notifications.js +0 -67
- package/dist/kit/npcs.d.ts +0 -226
- package/dist/kit/npcs.d.ts.map +0 -1
- package/dist/kit/npcs.js +0 -141
- package/dist/kit/objects.d.ts +0 -116
- package/dist/kit/objects.d.ts.map +0 -1
- package/dist/kit/objects.js +0 -119
- package/dist/kit/pets.d.ts +0 -85
- package/dist/kit/pets.d.ts.map +0 -1
- package/dist/kit/pets.js +0 -96
- package/dist/kit/plots.d.ts +0 -85
- package/dist/kit/plots.d.ts.map +0 -1
- package/dist/kit/plots.js +0 -113
- package/dist/kit/progression.d.ts +0 -181
- package/dist/kit/progression.d.ts.map +0 -1
- package/dist/kit/progression.js +0 -265
- package/dist/kit/quests.d.ts +0 -171
- package/dist/kit/quests.d.ts.map +0 -1
- package/dist/kit/quests.js +0 -237
- package/dist/kit/racing.d.ts +0 -85
- package/dist/kit/racing.d.ts.map +0 -1
- package/dist/kit/racing.js +0 -99
- package/dist/kit/shared.d.ts +0 -73
- package/dist/kit/shared.d.ts.map +0 -1
- package/dist/kit/shared.js +0 -101
- package/dist/kit/telemetry.d.ts +0 -66
- package/dist/kit/telemetry.d.ts.map +0 -1
- package/dist/kit/telemetry.js +0 -133
- package/dist/kit/territory.d.ts +0 -97
- package/dist/kit/territory.d.ts.map +0 -1
- package/dist/kit/territory.js +0 -114
- package/dist/kit/worldsim.d.ts +0 -263
- package/dist/kit/worldsim.d.ts.map +0 -1
- package/dist/kit/worldsim.js +0 -268
- package/dist/stores/model.d.ts +0 -81
- package/dist/stores/model.d.ts.map +0 -1
- package/dist/stores/model.js +0 -163
package/dist/domains/compute.js
DELETED
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import { ComputeUpsertModuleDocument, ComputeDeployVersionDocument, ComputeSetModuleEnabledDocument, ComputeResetBreakerDocument, ComputeDeleteModuleDocument, ComputeUpsertTriggerDocument, ComputeDeleteTriggerDocument, ComputeSetPolicyDocument, ComputeInvokeDocument, ComputeModulesDocument, ComputeModuleDocument, ComputeModuleVersionsDocument, ComputeModuleTriggersDocument, ComputeModulePolicyDocument, ComputeModuleRunsDocument, ComputeModuleStatsDocument, ComputeModuleLogsDocument, ComputeAppDiagnosticsDocument, ComputeDeployTemplateDocument, ComputeTemplatesDocument, } from '../generated/graphql.js';
|
|
2
|
-
/** The crowdy-compute-sdk version the platform toolchain currently pins. */
|
|
3
|
-
export const COMPUTE_SDK_VERSION = '0.1.3';
|
|
4
|
-
/** The guest ABI version the platform currently supports. */
|
|
5
|
-
export const COMPUTE_ABI_VERSION = 0;
|
|
6
|
-
/**
|
|
7
|
-
* Typed client for **Compute Modules** — server-side Rust/WebAssembly logic
|
|
8
|
-
* on the Game API (`client.compute`). Studios upload Rust source; the
|
|
9
|
-
* platform compiles it to WASM and runs it sandboxed on the game servers with
|
|
10
|
-
* fuel metering, triggers (tick / event / invoke), an app-scoped host data
|
|
11
|
-
* API, and replication egress. Modules are **server-only**: this client
|
|
12
|
-
* manages, invokes, and observes them — nothing executes client-side.
|
|
13
|
-
*
|
|
14
|
-
* Authoring mutations require the org **`manage_compute`** permission;
|
|
15
|
-
* monitoring queries require **`view_compute_diagnostics`**. `invoke` is
|
|
16
|
-
* gated per-export by the invoke trigger's policy.
|
|
17
|
-
*
|
|
18
|
-
* Docs: https://docs.crowdedkingdoms.com/game-api/compute-modules
|
|
19
|
-
*/
|
|
20
|
-
export class ComputeAPI {
|
|
21
|
-
constructor(gql) {
|
|
22
|
-
this.gql = gql;
|
|
23
|
-
}
|
|
24
|
-
// -- Authoring (manage_compute) ---------------------------------------------
|
|
25
|
-
/**
|
|
26
|
-
* Create or update a module's metadata (upsert key `(appId, name)`). New
|
|
27
|
-
* modules start disabled; enable after a successful compile.
|
|
28
|
-
*
|
|
29
|
-
* **Nothing runs for an app with no player in it.** A module ticks only while
|
|
30
|
-
* its app has at least one player connected, anywhere in the fleet, and stops
|
|
31
|
-
* when the last one leaves. `alwaysOn` is retired (2026-09-01) and passing
|
|
32
|
-
* `true` is refused — a world that must advance while empty should compute the
|
|
33
|
-
* elapsed time on its first tick after a player returns, which is cheaper than
|
|
34
|
-
* ticking an empty world and gives the same result.
|
|
35
|
-
*
|
|
36
|
-
* Requires the org **`manage_compute`** permission.
|
|
37
|
-
*
|
|
38
|
-
* @throws {CrowdyGraphQLError} `FORBIDDEN` without the permission.
|
|
39
|
-
* @throws {CrowdyGraphQLError} `BAD_REQUEST` if `alwaysOn: true` is passed.
|
|
40
|
-
*/
|
|
41
|
-
async upsertModule(input) {
|
|
42
|
-
const data = await this.gql.request(ComputeUpsertModuleDocument, { input });
|
|
43
|
-
return data.computeUpsertModule;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Upload an immutable source version and make it the deployed version. The
|
|
47
|
-
* source is validated server-side (Cargo.toml + `src/*.rs` only, dependency
|
|
48
|
-
* allowlist, size caps, no build-time code) and parked as
|
|
49
|
-
* `compileStatus: "pending"` until a game server compiles it — poll with
|
|
50
|
-
* {@link moduleVersions} or {@link waitForCompile}.
|
|
51
|
-
*
|
|
52
|
-
* Requires the org **`manage_compute`** permission.
|
|
53
|
-
*
|
|
54
|
-
* @param opts - App, module, `sourceFiles` map (stringified for you), and
|
|
55
|
-
* optional SDK/ABI pins (defaulted to the current platform pins).
|
|
56
|
-
*/
|
|
57
|
-
async deployVersion(opts) {
|
|
58
|
-
const data = await this.gql.request(ComputeDeployVersionDocument, {
|
|
59
|
-
input: {
|
|
60
|
-
appId: opts.appId,
|
|
61
|
-
moduleName: opts.moduleName,
|
|
62
|
-
sourceFilesJson: JSON.stringify(opts.sourceFiles),
|
|
63
|
-
sdkVersion: opts.sdkVersion ?? COMPUTE_SDK_VERSION,
|
|
64
|
-
abiVersion: opts.abiVersion ?? COMPUTE_ABI_VERSION,
|
|
65
|
-
},
|
|
66
|
-
});
|
|
67
|
-
return data.computeDeployVersion;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Enable or disable a module. Enabling requires a successfully compiled
|
|
71
|
-
* deployed version and resets the failure circuit; disabling stops all
|
|
72
|
-
* scheduling. Requires the org **`manage_compute`** permission.
|
|
73
|
-
*
|
|
74
|
-
* This does **not** restart a module that was stopped for exceeding a
|
|
75
|
-
* resource limit (`breakerLatchedAt`). Deploy a fixed version, or call
|
|
76
|
-
* {@link resetBreaker}.
|
|
77
|
-
*/
|
|
78
|
-
async setModuleEnabled(variables) {
|
|
79
|
-
const data = await this.gql.request(ComputeSetModuleEnabledDocument, variables);
|
|
80
|
-
return data.computeSetModuleEnabled;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Restart a module that was stopped for exceeding a resource limit, without
|
|
84
|
-
* deploying a new version.
|
|
85
|
-
*
|
|
86
|
-
* A module stopped this way reports `breakerLatchedAt` and a
|
|
87
|
-
* `breakerReason` saying what it exceeded. Deploying a fix clears it
|
|
88
|
-
* automatically and is the normal path; use this when the limit itself was
|
|
89
|
-
* wrong, or the load is being accepted deliberately. The reason is recorded
|
|
90
|
-
* with the module's history. Requires the org **`manage_compute`**
|
|
91
|
-
* permission.
|
|
92
|
-
*/
|
|
93
|
-
async resetBreaker(variables) {
|
|
94
|
-
const data = await this.gql.request(ComputeResetBreakerDocument, variables);
|
|
95
|
-
return data.computeResetBreaker;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Delete a module and (via cascade) its versions, triggers, and lease. Run
|
|
99
|
-
* history is retained for auditing. **Destructive.** Requires the org
|
|
100
|
-
* **`manage_compute`** permission.
|
|
101
|
-
*
|
|
102
|
-
* @returns `true` if a module was deleted.
|
|
103
|
-
*/
|
|
104
|
-
async deleteModule(variables) {
|
|
105
|
-
const data = await this.gql.request(ComputeDeleteModuleDocument, variables);
|
|
106
|
-
return data.computeDeleteModule;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Bind a trigger to a module: a tick loop (`triggerType: "tick"` +
|
|
110
|
-
* `tickHz`, clamped by the app policy), an event subscription
|
|
111
|
-
* (`triggerType: "event"` + `onEvent`: `function_invoked` |
|
|
112
|
-
* `property_changed` | `container_created` | `compute_event`), or a
|
|
113
|
-
* client-callable export (`triggerType: "invoke"` + `exportName` +
|
|
114
|
-
* optional `invokePolicyJson` authority tree; null policy = compute admins
|
|
115
|
-
* only). Requires the org **`manage_compute`** permission.
|
|
116
|
-
*/
|
|
117
|
-
async upsertTrigger(input) {
|
|
118
|
-
const data = await this.gql.request(ComputeUpsertTriggerDocument, { input });
|
|
119
|
-
return data.computeUpsertTrigger;
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Delete a trigger by id. Requires the org **`manage_compute`** permission.
|
|
123
|
-
*
|
|
124
|
-
* @returns `true` if a trigger was deleted.
|
|
125
|
-
*/
|
|
126
|
-
async deleteTrigger(variables) {
|
|
127
|
-
const data = await this.gql.request(ComputeDeleteTriggerDocument, variables);
|
|
128
|
-
return data.computeDeleteTrigger;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Set the app's compute policy (guardrails: kill switch, module count,
|
|
132
|
-
* tick-rate / fuel / memory / runtime / host-op / egress ceilings, circuit
|
|
133
|
-
* tuning). Omitted fields keep their current values; values above the
|
|
134
|
-
* platform ceilings are rejected. Requires the org **`manage_compute`**
|
|
135
|
-
* permission.
|
|
136
|
-
*/
|
|
137
|
-
async setPolicy(input) {
|
|
138
|
-
const data = await this.gql.request(ComputeSetPolicyDocument, { input });
|
|
139
|
-
return data.computeSetPolicy;
|
|
140
|
-
}
|
|
141
|
-
// -- Invoke ------------------------------------------------------------------
|
|
142
|
-
/**
|
|
143
|
-
* Invoke a module's client-callable export (an `invoke` trigger) as a
|
|
144
|
-
* **synchronous RPC**: the module runs server-side and its result comes
|
|
145
|
-
* back directly — unlike the spatial send surface, a failure (policy
|
|
146
|
-
* denial, fuel exhaustion, trap) is a thrown error, not a silent drop.
|
|
147
|
-
*
|
|
148
|
-
* Authorization: the export's invoke policy, or `manage_compute` holders
|
|
149
|
-
* only when no policy is set.
|
|
150
|
-
*
|
|
151
|
-
* @returns The invoke result; `resultJson` is set when the module's bytes
|
|
152
|
-
* parse as JSON (`resultBase64` always carries the raw bytes).
|
|
153
|
-
* @throws {CrowdyGraphQLError} `FORBIDDEN` on policy denial; `BAD_REQUEST`
|
|
154
|
-
* when the module is disabled or the call fails inside the sandbox.
|
|
155
|
-
*/
|
|
156
|
-
async invoke(variables) {
|
|
157
|
-
const data = await this.gql.request(ComputeInvokeDocument, variables);
|
|
158
|
-
return data.computeInvoke;
|
|
159
|
-
}
|
|
160
|
-
// -- Monitoring (view_compute_diagnostics) ------------------------------------
|
|
161
|
-
/** List the app's modules. Requires **`view_compute_diagnostics`**. */
|
|
162
|
-
async modules(variables) {
|
|
163
|
-
const data = await this.gql.request(ComputeModulesDocument, variables);
|
|
164
|
-
return data.computeModules;
|
|
165
|
-
}
|
|
166
|
-
/** Read one module by name. Requires **`view_compute_diagnostics`**. */
|
|
167
|
-
async module(variables) {
|
|
168
|
-
const data = await this.gql.request(ComputeModuleDocument, variables);
|
|
169
|
-
return data.computeModule;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* List a module's source versions, newest first, including compile
|
|
173
|
-
* status/log. Requires **`view_compute_diagnostics`**.
|
|
174
|
-
*/
|
|
175
|
-
async moduleVersions(variables) {
|
|
176
|
-
const data = await this.gql.request(ComputeModuleVersionsDocument, variables);
|
|
177
|
-
return data.computeModuleVersions;
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* The platform's engine-template registry: ready-made engines deployable
|
|
181
|
-
* by name with {@link deployTemplate}.
|
|
182
|
-
*/
|
|
183
|
-
async templates(variables) {
|
|
184
|
-
const data = await this.gql.request(ComputeTemplatesDocument, variables);
|
|
185
|
-
return data.computeTemplates;
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Deploy a named engine template from the platform registry — one call
|
|
189
|
-
* instead of the upsert/deploy/trigger/enable sequence. Compilation runs
|
|
190
|
-
* asynchronously; follow with {@link waitForCompile}.
|
|
191
|
-
*/
|
|
192
|
-
async deployTemplate(variables) {
|
|
193
|
-
const data = await this.gql.request(ComputeDeployTemplateDocument, variables);
|
|
194
|
-
return data.computeDeployTemplate;
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Poll {@link moduleVersions} until the newest version's compile settles
|
|
198
|
-
* (`succeeded` or `failed`). Resolves with the settled version; **rejects**
|
|
199
|
-
* on compile failure (message includes the compile log) or timeout.
|
|
200
|
-
*
|
|
201
|
-
* Requires **`view_compute_diagnostics`**.
|
|
202
|
-
*/
|
|
203
|
-
async waitForCompile(appId, moduleName, opts = {}) {
|
|
204
|
-
const timeoutMs = opts.timeoutMs ?? 120000;
|
|
205
|
-
const intervalMs = opts.intervalMs ?? 2000;
|
|
206
|
-
const deadline = Date.now() + timeoutMs;
|
|
207
|
-
for (;;) {
|
|
208
|
-
const versions = await this.moduleVersions({ appId, moduleName, limit: 1 });
|
|
209
|
-
const latest = versions[0];
|
|
210
|
-
if (latest?.compileStatus === 'succeeded')
|
|
211
|
-
return latest;
|
|
212
|
-
if (latest?.compileStatus === 'failed') {
|
|
213
|
-
throw new Error(`compute module '${moduleName}' compile failed:\n${latest.compileLog ?? '(no log)'}`);
|
|
214
|
-
}
|
|
215
|
-
if (Date.now() + intervalMs > deadline) {
|
|
216
|
-
throw new Error(`compute module '${moduleName}' compile did not settle within ${timeoutMs}ms` +
|
|
217
|
-
` (status: ${latest?.compileStatus ?? 'no version found'})`);
|
|
218
|
-
}
|
|
219
|
-
await new Promise((r) => setTimeout(r, intervalMs));
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* List trigger bindings, optionally filtered to one module. Requires
|
|
224
|
-
* **`view_compute_diagnostics`**.
|
|
225
|
-
*/
|
|
226
|
-
async moduleTriggers(variables) {
|
|
227
|
-
const data = await this.gql.request(ComputeModuleTriggersDocument, variables);
|
|
228
|
-
return data.computeModuleTriggers;
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Read the app's compute policy (platform defaults when unset). Requires
|
|
232
|
-
* **`view_compute_diagnostics`**.
|
|
233
|
-
*/
|
|
234
|
-
async modulePolicy(variables) {
|
|
235
|
-
const data = await this.gql.request(ComputeModulePolicyDocument, variables);
|
|
236
|
-
return data.computeModulePolicy;
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* List runs, newest first (module loads/`init`, every failure, and circuit
|
|
240
|
-
* probes; healthy high-frequency ticks are aggregated into per-minute
|
|
241
|
-
* usage instead of one row per tick). Requires
|
|
242
|
-
* **`view_compute_diagnostics`**.
|
|
243
|
-
*/
|
|
244
|
-
async moduleRuns(variables) {
|
|
245
|
-
const data = await this.gql.request(ComputeModuleRunsDocument, variables);
|
|
246
|
-
return data.computeModuleRuns;
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* Aggregate activity over a recent window (default 60 minutes): run and
|
|
250
|
-
* failure counts, fuel, egress, per-module breakdown. Requires
|
|
251
|
-
* **`view_compute_diagnostics`**.
|
|
252
|
-
*/
|
|
253
|
-
async moduleStats(variables) {
|
|
254
|
-
const data = await this.gql.request(ComputeModuleStatsDocument, variables);
|
|
255
|
-
return data.computeModuleStats;
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Diagnostic log lines (guest `log()` output + failure lines), newest
|
|
259
|
-
* first. Requires **`view_compute_diagnostics`**.
|
|
260
|
-
*/
|
|
261
|
-
async moduleLogs(variables) {
|
|
262
|
-
const data = await this.gql.request(ComputeModuleLogsDocument, variables);
|
|
263
|
-
return data.computeModuleLogs;
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* Snapshot of the app's compute footprint: module/version/trigger counts,
|
|
267
|
-
* 24h run activity, most-active modules. Requires
|
|
268
|
-
* **`view_compute_diagnostics`**.
|
|
269
|
-
*/
|
|
270
|
-
async appDiagnostics(variables) {
|
|
271
|
-
const data = await this.gql.request(ComputeAppDiagnosticsDocument, variables);
|
|
272
|
-
return data.computeAppDiagnostics;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { GraphQLClient } from '../client.js';
|
|
2
|
-
import { type CpComputePlatformCeilingsQuery, type CpSetComputePlatformCeilingsMutation, type CpSetComputePlatformCeilingsInput } from '../generated/graphql.js';
|
|
3
|
-
/**
|
|
4
|
-
* Operator (platform-policy) surface — exposed as `client.operator`.
|
|
5
|
-
*
|
|
6
|
-
* As of the v13 unified API this surface is reduced to the platform-wide
|
|
7
|
-
* compute ceilings: dedicated customer environments were retired, and the
|
|
8
|
-
* infrastructure control plane (environments, change orders, secrets, release
|
|
9
|
-
* management, audit) moved to the separate infra-control-plane service with
|
|
10
|
-
* its own auth and operator console. EVERY operation here still requires
|
|
11
|
-
* `users.is_operator` (super-admins implicitly have it).
|
|
12
|
-
*
|
|
13
|
-
* @throws {CrowdyGraphQLError} `UNAUTHENTICATED` without a session, `FORBIDDEN`
|
|
14
|
-
* when the caller is not an operator.
|
|
15
|
-
*/
|
|
16
|
-
export declare class ControlPlaneAPI {
|
|
17
|
-
private readonly api;
|
|
18
|
-
constructor(api: GraphQLClient);
|
|
19
|
-
/**
|
|
20
|
-
* The platform-wide compute ceilings (max modules, tick rates, fuel,
|
|
21
|
-
* memory, run time, db-op and egress budgets).
|
|
22
|
-
*
|
|
23
|
-
* @returns The stored ceilings row.
|
|
24
|
-
*/
|
|
25
|
-
computePlatformCeilings(): Promise<CpComputePlatformCeilingsQuery['cpComputePlatformCeilings']>;
|
|
26
|
-
/**
|
|
27
|
-
* Patch the platform compute ceilings. Patch semantics per knob: omit =
|
|
28
|
-
* unchanged, explicit `null` = clear the override (fall back to the
|
|
29
|
-
* game-api bootstrap default), positive value = set. Takes effect on the
|
|
30
|
-
* next `computeSetPolicy` call (no restart), within a 30s cache bound.
|
|
31
|
-
* Writes a `compute.platform_ceilings_set` audit entry.
|
|
32
|
-
*
|
|
33
|
-
* @param input - The per-knob patch.
|
|
34
|
-
* @returns The stored ceilings after the patch.
|
|
35
|
-
*/
|
|
36
|
-
setComputePlatformCeilings(input: CpSetComputePlatformCeilingsInput): Promise<CpSetComputePlatformCeilingsMutation['cpSetComputePlatformCeilings']>;
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=controlPlane.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"controlPlane.d.ts","sourceRoot":"","sources":["../../src/domains/controlPlane.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAGL,KAAK,8BAA8B,EACnC,KAAK,oCAAoC,EACzC,KAAK,iCAAiC,EACvC,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;GAYG;AACH,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,aAAa;IAE/C;;;;;OAKG;IACG,uBAAuB,IAAI,OAAO,CACtC,8BAA8B,CAAC,2BAA2B,CAAC,CAC5D;IAOD;;;;;;;;;OASG;IACG,0BAA0B,CAC9B,KAAK,EAAE,iCAAiC,GACvC,OAAO,CACR,oCAAoC,CAAC,8BAA8B,CAAC,CACrE;CAOF"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { CpComputePlatformCeilingsDocument, CpSetComputePlatformCeilingsDocument, } from '../generated/graphql.js';
|
|
2
|
-
/**
|
|
3
|
-
* Operator (platform-policy) surface — exposed as `client.operator`.
|
|
4
|
-
*
|
|
5
|
-
* As of the v13 unified API this surface is reduced to the platform-wide
|
|
6
|
-
* compute ceilings: dedicated customer environments were retired, and the
|
|
7
|
-
* infrastructure control plane (environments, change orders, secrets, release
|
|
8
|
-
* management, audit) moved to the separate infra-control-plane service with
|
|
9
|
-
* its own auth and operator console. EVERY operation here still requires
|
|
10
|
-
* `users.is_operator` (super-admins implicitly have it).
|
|
11
|
-
*
|
|
12
|
-
* @throws {CrowdyGraphQLError} `UNAUTHENTICATED` without a session, `FORBIDDEN`
|
|
13
|
-
* when the caller is not an operator.
|
|
14
|
-
*/
|
|
15
|
-
export class ControlPlaneAPI {
|
|
16
|
-
constructor(api) {
|
|
17
|
-
this.api = api;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* The platform-wide compute ceilings (max modules, tick rates, fuel,
|
|
21
|
-
* memory, run time, db-op and egress budgets).
|
|
22
|
-
*
|
|
23
|
-
* @returns The stored ceilings row.
|
|
24
|
-
*/
|
|
25
|
-
async computePlatformCeilings() {
|
|
26
|
-
const data = await this.api.request(CpComputePlatformCeilingsDocument);
|
|
27
|
-
return data.cpComputePlatformCeilings;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Patch the platform compute ceilings. Patch semantics per knob: omit =
|
|
31
|
-
* unchanged, explicit `null` = clear the override (fall back to the
|
|
32
|
-
* game-api bootstrap default), positive value = set. Takes effect on the
|
|
33
|
-
* next `computeSetPolicy` call (no restart), within a 30s cache bound.
|
|
34
|
-
* Writes a `compute.platform_ceilings_set` audit entry.
|
|
35
|
-
*
|
|
36
|
-
* @param input - The per-knob patch.
|
|
37
|
-
* @returns The stored ceilings after the patch.
|
|
38
|
-
*/
|
|
39
|
-
async setComputePlatformCeilings(input) {
|
|
40
|
-
const data = await this.api.request(CpSetComputePlatformCeilingsDocument, { input });
|
|
41
|
-
return data.cpSetComputePlatformCeilings;
|
|
42
|
-
}
|
|
43
|
-
}
|