@crowdedkingdoms/crowdyjs 17.12.0-dev.1 → 17.14.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 +127 -0
- package/README.md +99 -4
- package/dist/crowdy-dsh/bridge.d.ts.map +1 -1
- package/dist/crowdy-dsh/bridge.js +2 -0
- package/dist/crowdy-studio/controller.d.ts +64 -8
- package/dist/crowdy-studio/controller.d.ts.map +1 -1
- package/dist/crowdy-studio/controller.js +345 -46
- package/dist/crowdy-studio/dom-shell.d.ts.map +1 -1
- package/dist/crowdy-studio/dom-shell.js +16 -9
- package/dist/crowdy-studio/embed/hud-layer.d.ts +2 -1
- package/dist/crowdy-studio/embed/hud-layer.d.ts.map +1 -1
- package/dist/crowdy-studio/embed/panel.d.ts +9 -6
- package/dist/crowdy-studio/embed/panel.d.ts.map +1 -1
- package/dist/crowdy-studio/embed/panel.js +4 -2
- package/dist/crowdy-studio/index.d.ts +2 -2
- package/dist/crowdy-studio/index.d.ts.map +1 -1
- package/dist/crowdy-studio/models.d.ts +1 -1
- package/dist/crowdy-studio/starter-projects.d.ts +22 -0
- package/dist/crowdy-studio/starter-projects.d.ts.map +1 -1
- package/dist/crowdy-studio/starter-projects.js +129 -5
- package/dist/domains/exec.d.ts +222 -20
- package/dist/domains/exec.d.ts.map +1 -1
- package/dist/domains/exec.js +215 -21
- package/dist/domains/marketplace.d.ts +15 -3
- package/dist/domains/marketplace.d.ts.map +1 -1
- package/dist/domains/marketplace.js +17 -3
- package/dist/errors.d.ts +3 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/generated/graphql.d.ts +422 -0
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +23 -11
- package/dist/grid-mods/exec-client-halves.d.ts +140 -0
- package/dist/grid-mods/exec-client-halves.d.ts.map +1 -0
- package/dist/grid-mods/exec-client-halves.js +341 -0
- package/dist/grid-mods/grid-host-calls.d.ts +3 -1
- package/dist/grid-mods/grid-host-calls.d.ts.map +1 -1
- package/dist/grid-mods/grid-host-calls.js +3 -1
- package/dist/grid-mods/index.d.ts +1 -0
- package/dist/grid-mods/index.d.ts.map +1 -1
- package/dist/grid-mods/index.js +1 -0
- package/dist/grid-mods/mod-runtime.d.ts +10 -2
- package/dist/grid-mods/mod-runtime.d.ts.map +1 -1
- package/dist/grid-mods/mod-runtime.js +2 -0
- package/dist/grid-scope.d.ts +1 -0
- package/dist/grid-scope.d.ts.map +1 -1
- package/dist/grid-scope.js +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/kit/npcs.d.ts.map +1 -1
- package/dist/kit/social.d.ts.map +1 -1
- package/dist/live-coding/rust-analysis.js +13 -1
- package/dist/player-runtime/glue-runtime.d.ts +19 -6
- package/dist/player-runtime/glue-runtime.d.ts.map +1 -1
- package/dist/player-runtime/glue-runtime.js +40 -16
- package/dist/player-runtime/player-code-broker.d.ts +29 -0
- package/dist/player-runtime/player-code-broker.d.ts.map +1 -1
- package/dist/player-runtime/player-code-broker.js +41 -8
- package/dist/player-runtime/player-glue-worker.d.ts +2 -1
- package/dist/player-runtime/player-glue-worker.d.ts.map +1 -1
- package/dist/player-runtime/player-glue-worker.js +3 -1
- package/dist/stores/actors.d.ts +12 -2
- package/dist/stores/actors.d.ts.map +1 -1
- package/dist/stores/actors.js +43 -18
- package/dist/stores/chunks.d.ts +12 -0
- package/dist/stores/chunks.d.ts.map +1 -1
- package/dist/stores/chunks.js +112 -39
- package/dist/stores/durable.d.ts.map +1 -1
- package/dist/stores/durable.js +2 -1
- package/package.json +1 -1
package/dist/domains/exec.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { decode, encode } from '@msgpack/msgpack';
|
|
2
|
-
import { CrowdyError } from '../errors.js';
|
|
3
|
-
import { ExecActivateVersionDocument, ExecAppStatusDocument, ExecBuildDocument, ExecBuildStatusDocument, ExecConnectAsDeveloperDocument, ExecConnectDocument, ExecDeployDocument, ExecInstancesDocument, ExecLogsDocument, ExecAppModsDocument, ExecModBuildDocument, ExecModBuildStatusDocument, ExecModDeleteDocument, ExecModDeployDocument, ExecModInstallDocument, ExecModListingsDocument, ExecModLogsDocument, ExecModPublishDocument, ExecModScope, ExecModSetEnabledDocument, ExecModSetSwitchDocument, ExecModStarterDocument, ExecModSwitchesDocument, ExecModUnpublishDocument, ExecModsDocument, ExecMyModsDocument, ExecSetEnabledDocument, ExecStartersDocument, ExecVersionsDocument, } from '../generated/graphql.js';
|
|
2
|
+
import { CrowdyError, CrowdyProtocolError } from '../errors.js';
|
|
3
|
+
import { ExecActivateVersionDocument, ExecAppStatusDocument, ExecBuildDocument, ExecBuildStatusDocument, ExecConnectAsDeveloperDocument, ExecConnectDocument, ExecConsentClientModDocument, ExecDeployDocument, ExecEndpointStatsDocument, ExecGridClientModsDocument, ExecInstancesDocument, ExecLogsDocument, ExecAppModsDocument, ExecModBuildDocument, ExecModBuildStatusDocument, ExecModClientArtifactDocument, ExecModClientBuildDocument, ExecModClientDeleteDocument, ExecModClientDeployDocument, ExecModDeleteDocument, ExecModDeployDocument, ExecModInstallDocument, ExecModListingsDocument, ExecModLogsDocument, ExecModPublishDocument, ExecModScope, ExecModSetEnabledDocument, ExecModSetSwitchDocument, ExecModStarterDocument, ExecModSwitchesDocument, ExecModUnpublishDocument, ExecModsDocument, ExecMyModsDocument, ExecSetEnabledDocument, ExecStartersDocument, ExecTrustAuthorDocument, ExecVersionsDocument, } from '../generated/graphql.js';
|
|
4
4
|
export { ExecModScope };
|
|
5
5
|
/**
|
|
6
6
|
* ck-exec, the hub-and-spoke execution service (dev-tier preview).
|
|
@@ -46,16 +46,26 @@ const RETRYABLE = new Set([
|
|
|
46
46
|
'Unavailable',
|
|
47
47
|
'RateLimited',
|
|
48
48
|
]);
|
|
49
|
+
const RETRY_IN = /retry in (\d+) ms/;
|
|
49
50
|
/**
|
|
50
51
|
* A call, subscription or connection that ck-exec refused or could not complete.
|
|
51
52
|
* `status` is the platform's (`AppError` carries the handler's own message);
|
|
52
53
|
* `retryable` says whether trying again later can succeed.
|
|
54
|
+
*
|
|
55
|
+
* The SDK never retries a `Busy` reply. A gateway refuses a player's call over its
|
|
56
|
+
* limit (120 calls per 10 s per player and app on a host) as `Busy` with a message
|
|
57
|
+
* starting `rate limited`: `rateLimited` is then true and `retryAfterMs` says how long
|
|
58
|
+
* to wait. Calling again sooner is refused again and does not shorten the wait.
|
|
53
59
|
*/
|
|
54
60
|
export class CrowdyExecError extends CrowdyError {
|
|
55
61
|
constructor(status, message, cause) {
|
|
56
62
|
super({ message: `${status}: ${message}`, cause });
|
|
57
63
|
this.status = status;
|
|
58
64
|
this.retryable = RETRYABLE.has(status);
|
|
65
|
+
this.rateLimited =
|
|
66
|
+
status === 'RateLimited' || (status === 'Busy' && message.startsWith('rate limited'));
|
|
67
|
+
const retryIn = this.rateLimited ? RETRY_IN.exec(message) : null;
|
|
68
|
+
this.retryAfterMs = retryIn ? Number(retryIn[1]) : undefined;
|
|
59
69
|
}
|
|
60
70
|
}
|
|
61
71
|
const utf8 = new TextEncoder();
|
|
@@ -414,7 +424,7 @@ export class ExecConnection {
|
|
|
414
424
|
/**
|
|
415
425
|
* Calls a node's endpoint with raw bytes and returns the reply's bytes. A call
|
|
416
426
|
* whose connection closes, or that is answered `Moved`, is tried once more on a
|
|
417
|
-
* fresh connection.
|
|
427
|
+
* fresh connection. A `Busy` reply is not retried: see {@link CrowdyExecError.retryAfterMs}.
|
|
418
428
|
* @throws {CrowdyExecError} for any status but `Ok`.
|
|
419
429
|
*/
|
|
420
430
|
async callRaw(nodeType, key, method, payload = new Uint8Array(), options = {}) {
|
|
@@ -509,26 +519,73 @@ function base64(bytes) {
|
|
|
509
519
|
}
|
|
510
520
|
return btoa(s);
|
|
511
521
|
}
|
|
522
|
+
function fromBase64(b64) {
|
|
523
|
+
const binary = atob(b64);
|
|
524
|
+
const out = new Uint8Array(binary.length);
|
|
525
|
+
for (let i = 0; i < binary.length; i++)
|
|
526
|
+
out[i] = binary.charCodeAt(i);
|
|
527
|
+
return out;
|
|
528
|
+
}
|
|
512
529
|
async function sha256Hex(bytes) {
|
|
513
530
|
const d = new Uint8Array(await crypto.subtle.digest('SHA-256', bytes));
|
|
514
531
|
return Array.from(d, (x) => x.toString(16).padStart(2, '0')).join('');
|
|
515
532
|
}
|
|
533
|
+
/** The CLIENT ABI version the player runtime's glue implements (crowdy-client-sdk `ABI_VERSION`). */
|
|
534
|
+
export const EXEC_CLIENT_ABI_VERSION = 0;
|
|
516
535
|
/** The node type players call a mod by: `mod:<name>`, keyed by its grid id. */
|
|
517
536
|
export function execModType(name) {
|
|
518
537
|
return `mod:${name}`;
|
|
519
538
|
}
|
|
539
|
+
function parseManifest(json) {
|
|
540
|
+
if (!json)
|
|
541
|
+
return null;
|
|
542
|
+
try {
|
|
543
|
+
return JSON.parse(json);
|
|
544
|
+
}
|
|
545
|
+
catch {
|
|
546
|
+
return null;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
function parseCapabilities(json) {
|
|
550
|
+
if (!json)
|
|
551
|
+
return null;
|
|
552
|
+
try {
|
|
553
|
+
const parsed = JSON.parse(json);
|
|
554
|
+
return parsed && typeof parsed === 'object' && !Array.isArray(parsed)
|
|
555
|
+
? parsed
|
|
556
|
+
: null;
|
|
557
|
+
}
|
|
558
|
+
catch {
|
|
559
|
+
return null;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
520
562
|
function strip(v) {
|
|
521
563
|
const { __typename: _, ...rest } = v;
|
|
522
564
|
return rest;
|
|
523
565
|
}
|
|
524
566
|
function build(b) {
|
|
525
567
|
const { __typename: _, artifacts, ...rest } = b;
|
|
526
|
-
return {
|
|
568
|
+
return {
|
|
569
|
+
...rest,
|
|
570
|
+
artifacts: artifacts.map((a) => ({
|
|
571
|
+
...strip(a),
|
|
572
|
+
capabilitySummary: parseCapabilities(a.capabilitySummaryJson),
|
|
573
|
+
})),
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
function listing(l) {
|
|
577
|
+
return { ...strip(l), clientCapabilitySummary: parseCapabilities(l.clientCapabilitySummaryJson) };
|
|
578
|
+
}
|
|
579
|
+
function crateInput(crate) {
|
|
580
|
+
const files = Array.isArray(crate.files)
|
|
581
|
+
? crate.files
|
|
582
|
+
: Object.entries(crate.files).map(([path, content]) => ({ path, content }));
|
|
583
|
+
return { name: crate.name, files };
|
|
527
584
|
}
|
|
528
585
|
/**
|
|
529
586
|
* `client.exec`: connecting players to ck-exec, building and deploying an app's nodes (and
|
|
530
|
-
* the starter packs),
|
|
531
|
-
*
|
|
587
|
+
* the starter packs), operating them (logs, instances, versions, rollback, the kill switch,
|
|
588
|
+
* developer connections), and players' mods with their CLIENT halves.
|
|
532
589
|
*/
|
|
533
590
|
export class ExecAPI {
|
|
534
591
|
constructor(graphql) {
|
|
@@ -568,10 +625,22 @@ export class ExecAPI {
|
|
|
568
625
|
const data = await this.graphql.request(ExecInstancesDocument, { appId });
|
|
569
626
|
return data.execInstances.map(strip);
|
|
570
627
|
}
|
|
571
|
-
/** The app's versions, newest first. Requires `view_compute_diagnostics`. */
|
|
628
|
+
/** The app's versions, newest first, with their manifests. Requires `view_compute_diagnostics`. */
|
|
572
629
|
async versions(appId) {
|
|
573
630
|
const data = await this.graphql.request(ExecVersionsDocument, { appId });
|
|
574
|
-
return data.execVersions.map(
|
|
631
|
+
return data.execVersions.map((v) => {
|
|
632
|
+
const version = strip(v);
|
|
633
|
+
return { ...version, manifest: parseManifest(version.manifestJson) };
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* Calls to each endpoint of the app's code over the last `sinceMinutes` (default 60), by
|
|
638
|
+
* outcome and with their latency, most called first. Each host reports a minute once it
|
|
639
|
+
* ends. Requires `view_compute_diagnostics`.
|
|
640
|
+
*/
|
|
641
|
+
async endpointStats(appId, options = {}) {
|
|
642
|
+
const data = await this.graphql.request(ExecEndpointStatsDocument, { appId, ...options });
|
|
643
|
+
return data.execEndpointStats.map(strip);
|
|
575
644
|
}
|
|
576
645
|
/** The active version and the switches. Requires `view_compute_diagnostics`. */
|
|
577
646
|
async status(appId) {
|
|
@@ -666,21 +735,15 @@ export class ExecAPI {
|
|
|
666
735
|
* player. Requires `write_server_code` in the app.
|
|
667
736
|
*/
|
|
668
737
|
async modBuild(appId, crate) {
|
|
669
|
-
const
|
|
670
|
-
? crate.files
|
|
671
|
-
: Object.entries(crate.files).map(([path, content]) => ({ path, content }));
|
|
672
|
-
const data = await this.graphql.request(ExecModBuildDocument, {
|
|
673
|
-
appId,
|
|
674
|
-
crate: { name: crate.name, files },
|
|
675
|
-
});
|
|
738
|
+
const data = await this.graphql.request(ExecModBuildDocument, { appId, crate: crateInput(crate) });
|
|
676
739
|
return build(data.execModBuild);
|
|
677
740
|
}
|
|
678
|
-
/** A mod build of yours. */
|
|
741
|
+
/** A mod build of yours: a mod's (`kind` `exec`) or a CLIENT half's (`kind` `client`). */
|
|
679
742
|
async modBuildStatus(appId, buildId) {
|
|
680
743
|
const data = await this.graphql.request(ExecModBuildStatusDocument, { appId, buildId });
|
|
681
744
|
return build(data.execModBuildStatus);
|
|
682
745
|
}
|
|
683
|
-
/** Polls a mod build until it succeeds or fails, like {@link waitForBuild}. */
|
|
746
|
+
/** Polls a mod build, server or CLIENT, until it succeeds or fails, like {@link waitForBuild}. */
|
|
684
747
|
async waitForModBuild(appId, buildId, options = {}) {
|
|
685
748
|
const until = Date.now() + (options.timeoutMs ?? 600000);
|
|
686
749
|
for (;;) {
|
|
@@ -732,19 +795,22 @@ export class ExecAPI {
|
|
|
732
795
|
/** Publishes a mod of yours, at its current version, for other grid owners to install. */
|
|
733
796
|
async modPublish(appId, gridId, name, title, description) {
|
|
734
797
|
const data = await this.graphql.request(ExecModPublishDocument, { appId, gridId, name, title, description });
|
|
735
|
-
return
|
|
798
|
+
return listing(data.execModPublish);
|
|
736
799
|
}
|
|
737
|
-
/** The app's listed mods, most installed first. */
|
|
800
|
+
/** The app's listed mods, most installed first, each with the CLIENT half it carries, if any. */
|
|
738
801
|
async modListings(appId) {
|
|
739
802
|
const data = await this.graphql.request(ExecModListingsDocument, { appId });
|
|
740
|
-
return data.execModListings.map(
|
|
803
|
+
return data.execModListings.map(listing);
|
|
741
804
|
}
|
|
742
805
|
/** Delists a listing you published; installed copies keep running. */
|
|
743
806
|
async modUnpublish(appId, listingId) {
|
|
744
807
|
const data = await this.graphql.request(ExecModUnpublishDocument, { appId, listingId });
|
|
745
808
|
return data.execModUnpublish;
|
|
746
809
|
}
|
|
747
|
-
/**
|
|
810
|
+
/**
|
|
811
|
+
* Installs a listing onto a grid you own as your own mod, switched off, with the listing's
|
|
812
|
+
* CLIENT half if it has one; visitors, you too, consent to that CLIENT half afresh.
|
|
813
|
+
*/
|
|
748
814
|
async modInstall(appId, gridId, name, listingId) {
|
|
749
815
|
const data = await this.graphql.request(ExecModInstallDocument, { appId, gridId, name, listingId });
|
|
750
816
|
return strip(data.execModInstall);
|
|
@@ -768,6 +834,134 @@ export class ExecAPI {
|
|
|
768
834
|
const data = await this.graphql.request(ExecModSetSwitchDocument, { appId, scope, off, ...options });
|
|
769
835
|
return data.execModSetSwitch.map(strip);
|
|
770
836
|
}
|
|
837
|
+
// ---- CLIENT halves: a mod's browser half ----
|
|
838
|
+
/**
|
|
839
|
+
* Builds the CLIENT half of a mod from one `crowdy-client-sdk` crate: compiled for
|
|
840
|
+
* `wasm32-unknown-unknown` in the build sandbox, fuel-metered and optimized there, checked
|
|
841
|
+
* against the CLIENT ABI and at most 512 KiB, with its capability summary derived from the
|
|
842
|
+
* module. Its `Cargo.toml` may have only `[package]`, `[lib]` as a cdylib, `[dependencies]` on
|
|
843
|
+
* `crowdy-client-sdk`, `serde` and `serde_json`, and `[package.metadata.crowdy]
|
|
844
|
+
* tick_interval_ms`. Returns at once with the build queued (`kind` `client`); wait with
|
|
845
|
+
* {@link waitForModBuild}, then attach it with {@link modClientDeploy}. One build, server or
|
|
846
|
+
* CLIENT, at a time per player. Requires `write_client_code` in the app.
|
|
847
|
+
*/
|
|
848
|
+
async modClientBuild(appId, crate) {
|
|
849
|
+
const data = await this.graphql.request(ExecModClientBuildDocument, { appId, crate: crateInput(crate) });
|
|
850
|
+
return build(data.execModClientBuild);
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Attaches a succeeded CLIENT build of yours to your mod `name` on a grid you own, replacing
|
|
854
|
+
* the CLIENT half it had; its `clientVersion` rises by one. The mod must exist and run as
|
|
855
|
+
* you. A visitor's consent carries over only while the capability hash is unchanged.
|
|
856
|
+
* Requires being the grid's owner, `write_client_code` on the app tier and the grid, and the
|
|
857
|
+
* app's code admission admitting the new CLIENT version.
|
|
858
|
+
*/
|
|
859
|
+
async modClientDeploy(appId, gridId, name, buildId) {
|
|
860
|
+
const data = await this.graphql.request(ExecModClientDeployDocument, { appId, gridId, name, buildId });
|
|
861
|
+
const c = strip(data.execModClientDeploy);
|
|
862
|
+
return { ...c, capabilitySummary: parseCapabilities(c.capabilitySummaryJson) };
|
|
863
|
+
}
|
|
864
|
+
/** Detaches the CLIENT half of a mod on your grid, with every visitor's consent to it; the mod keeps running. */
|
|
865
|
+
async modClientDelete(appId, gridId, name) {
|
|
866
|
+
const data = await this.graphql.request(ExecModClientDeleteDocument, { appId, gridId, name });
|
|
867
|
+
return data.execModClientDelete;
|
|
868
|
+
}
|
|
869
|
+
/**
|
|
870
|
+
* The CLIENT halves a grid serves: those of its mods that are switched on, not stopped by the
|
|
871
|
+
* kill ladder, running as the grid's owner and admitted. Each has its capability summary and
|
|
872
|
+
* hash and whether you consented to it, and its author's union summary and hash and whether
|
|
873
|
+
* you trust them. Prompt once per author ({@link trustAuthor}) or per CLIENT half
|
|
874
|
+
* ({@link consentClientMod}), fetch with {@link modClientArtifactBytes}, cache by `digest`, and
|
|
875
|
+
* poll this to stop the CLIENT halves that are no longer listed or whose digest changed:
|
|
876
|
+
* `ExecClientHalves` does all of that for a game. Requires access to the app.
|
|
877
|
+
*/
|
|
878
|
+
async gridClientMods(appId, gridId) {
|
|
879
|
+
const data = await this.graphql.request(ExecGridClientModsDocument, { appId, gridId });
|
|
880
|
+
return data.execGridClientMods.map((m) => ({
|
|
881
|
+
...strip(m),
|
|
882
|
+
capabilitySummary: parseCapabilities(m.capabilitySummaryJson),
|
|
883
|
+
authorCapabilitySummary: parseCapabilities(m.authorCapabilitySummaryJson),
|
|
884
|
+
}));
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* Consents to run one mod's CLIENT half in your browser at `capabilityHash`, the one
|
|
888
|
+
* {@link gridClientMods} showed you. A CLIENT half whose capabilities change carries a new hash,
|
|
889
|
+
* and the consent stops holding until you consent again; a hash that is not the current one
|
|
890
|
+
* is refused as `CONFLICT` (`CrowdyGraphQLError.code`). Requires access to the app.
|
|
891
|
+
*/
|
|
892
|
+
async consentClientMod(appId, modId, capabilityHash) {
|
|
893
|
+
const data = await this.graphql.request(ExecConsentClientModDocument, { appId, modId, capabilityHash });
|
|
894
|
+
return data.execConsentClientMod;
|
|
895
|
+
}
|
|
896
|
+
/**
|
|
897
|
+
* Trusts one author's CLIENT halves on a grid you stand in, at the hash of their union
|
|
898
|
+
* (`authorCapabilityHash`): the trust covers their CLIENT halves there while the union is no
|
|
899
|
+
* wider, and consents to each current one at its own hash. A hash that is not the current one
|
|
900
|
+
* is `CONFLICT`; not standing in the grid, or an author with nothing served there, is
|
|
901
|
+
* `NOT_FOUND`. Requires access to the app.
|
|
902
|
+
*/
|
|
903
|
+
async trustAuthor(appId, gridId, authorId, capabilityHash) {
|
|
904
|
+
const data = await this.graphql.request(ExecTrustAuthorDocument, { appId, gridId, authorId, capabilityHash });
|
|
905
|
+
return data.execTrustAuthor;
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* A served CLIENT half's module, base64, with what the broker needs to run it. Served only to a
|
|
909
|
+
* player holding `run_client_code` in the app, standing in the mod's grid now, who consented
|
|
910
|
+
* to it at its current hash or trusts its author at a union no wider; every refusal is
|
|
911
|
+
* `NOT_FOUND`. At most 12 fetches a minute per player and mod on each API instance
|
|
912
|
+
* (`RATE_LIMITED`): the module never changes for its digest, so cache it by `digest`.
|
|
913
|
+
*/
|
|
914
|
+
async modClientArtifact(appId, modId) {
|
|
915
|
+
const data = await this.graphql.request(ExecModClientArtifactDocument, { appId, modId });
|
|
916
|
+
const a = strip(data.execModClientArtifact);
|
|
917
|
+
return { ...a, capabilitySummary: parseCapabilities(a.capabilitySummaryJson) };
|
|
918
|
+
}
|
|
919
|
+
/**
|
|
920
|
+
* {@link modClientArtifact} decoded for `PlayerCodeBroker`: the module's bytes, their SHA-256
|
|
921
|
+
* recomputed with WebCrypto, and the fuel budget as a bigint; the exec twin of
|
|
922
|
+
* `marketplace.clientArtifactBytes`. Bytes that differ from `digest`, a module built for a
|
|
923
|
+
* CLIENT ABI other than {@link EXEC_CLIENT_ABI_VERSION}, or a capability summary that does not
|
|
924
|
+
* parse are refused with a {@link CrowdyProtocolError} and never returned. Start the broker
|
|
925
|
+
* with `engine: 'ck-exec'`, `artifactHash: digest`, `fuelPerDispatch`, `tickIntervalMs` and
|
|
926
|
+
* `consentedHostCalls: capabilitySummary.hostFunctions`.
|
|
927
|
+
*/
|
|
928
|
+
async modClientArtifactBytes(appId, modId) {
|
|
929
|
+
const a = await this.modClientArtifact(appId, modId);
|
|
930
|
+
if (a.abiVersion !== EXEC_CLIENT_ABI_VERSION) {
|
|
931
|
+
throw new CrowdyProtocolError({
|
|
932
|
+
message: `CLIENT half of mod ${a.modId} is built for CLIENT ABI ${a.abiVersion}; this SDK runs ABI ${EXEC_CLIENT_ABI_VERSION}`,
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
const capabilitySummary = a.capabilitySummary;
|
|
936
|
+
if (!capabilitySummary || !Array.isArray(capabilitySummary.hostFunctions)) {
|
|
937
|
+
throw new CrowdyProtocolError({
|
|
938
|
+
message: `CLIENT half of mod ${a.modId}: its capability summary does not parse, so nothing bounds its host calls`,
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
const bytes = fromBase64(a.wasmBase64);
|
|
942
|
+
const digest = a.digest.toLowerCase();
|
|
943
|
+
const actual = await sha256Hex(bytes);
|
|
944
|
+
if (actual !== digest) {
|
|
945
|
+
throw new CrowdyProtocolError({
|
|
946
|
+
message: `CLIENT half of mod ${a.modId}: the module's SHA-256 is ${actual}, not the digest ${digest} it was served with`,
|
|
947
|
+
});
|
|
948
|
+
}
|
|
949
|
+
return {
|
|
950
|
+
modId: a.modId,
|
|
951
|
+
name: a.name,
|
|
952
|
+
gridId: a.gridId,
|
|
953
|
+
clientVersion: a.clientVersion,
|
|
954
|
+
bytes: bytes.buffer,
|
|
955
|
+
digest,
|
|
956
|
+
sizeBytes: a.sizeBytes,
|
|
957
|
+
fuelPerDispatch: BigInt(a.fuelPerDispatch),
|
|
958
|
+
tickIntervalMs: a.tickIntervalMs,
|
|
959
|
+
capabilitySummaryJson: a.capabilitySummaryJson,
|
|
960
|
+
capabilitySummary,
|
|
961
|
+
capabilityHash: a.capabilityHash,
|
|
962
|
+
abiVersion: a.abiVersion,
|
|
963
|
+
};
|
|
964
|
+
}
|
|
771
965
|
/** A host for this player and its connect token (valid for about a minute). */
|
|
772
966
|
async endpoint(appId, options = {}) {
|
|
773
967
|
const data = await this.graphql.request(ExecConnectDocument, {
|
|
@@ -36,22 +36,34 @@ export declare class MarketplaceAPI {
|
|
|
36
36
|
install(variables: MarketplaceInstallMutationVariables): Promise<MarketplaceInstallMutation['installPlayerCode']>;
|
|
37
37
|
/** Remove instances/attachments/fetch rights; the acquisition is retained. */
|
|
38
38
|
uninstall(variables: MarketplaceUninstallMutationVariables): Promise<boolean>;
|
|
39
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Client mods attached to a grid, with the caller's consent state.
|
|
41
|
+
* @deprecated Superseded by `client.exec.gridClientMods` (a ck-exec mod's CLIENT half); removed in 18.0.
|
|
42
|
+
*/
|
|
40
43
|
gridClientMods(variables: MarketplaceGridClientModsQueryVariables): Promise<MarketplaceGridClientModsQuery['gridClientMods']>;
|
|
41
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Consent to one attachment's exact capability hash (per player).
|
|
46
|
+
* @deprecated Superseded by `client.exec.consentClientMod`; removed in 18.0.
|
|
47
|
+
*/
|
|
42
48
|
consentGridClientMod(variables: MarketplaceConsentGridClientModMutationVariables): Promise<boolean>;
|
|
43
49
|
/**
|
|
44
50
|
* Trust one author's active attachments in a grid at the exact aggregate
|
|
45
51
|
* capability hash returned by `gridClientMods`. Capability widening changes
|
|
46
52
|
* the hash and requires another explicit call.
|
|
53
|
+
* @deprecated Superseded by `client.exec.trustAuthor`; removed in 18.0.
|
|
47
54
|
*/
|
|
48
55
|
trustGridAuthor(variables: MarketplaceTrustGridAuthorMutationVariables): Promise<MarketplaceTrustGridAuthorMutation['trustGridAuthor']>;
|
|
49
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Fetch an acquired/attached listing's client artifact (base64 + metadata).
|
|
58
|
+
* @deprecated Superseded by `client.exec.modClientArtifact`; removed in 18.0.
|
|
59
|
+
*/
|
|
50
60
|
clientArtifact(variables: MarketplaceClientArtifactQueryVariables): Promise<MarketplaceClientArtifactQuery['playerCodeClientArtifact']>;
|
|
51
61
|
/**
|
|
52
62
|
* Fetch and decode a client artifact into broker inputs (bytes, content
|
|
53
63
|
* hash, per-dispatch fuel budget) — the marketplace twin of
|
|
54
64
|
* `playerCompute.artifactBytes` for acquired and grid-attached mods.
|
|
65
|
+
* @deprecated Superseded by `client.exec.modClientArtifactBytes`, which also checks the
|
|
66
|
+
* bytes against their digest; `ExecClientHalves` runs a grid's CLIENT halves. Removed in 18.0.
|
|
55
67
|
*/
|
|
56
68
|
clientArtifactBytes(variables: MarketplaceClientArtifactQueryVariables): Promise<{
|
|
57
69
|
bytes: ArrayBuffer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version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AS,EAAE,wCAAwC,GAClD,OAAO,CAAC,+BAA+B,CAAC,2BAA2B,CAAC,CAAC;IASxE,sDAAsD;IAChD,eAAe,CACnB,SAAS,EAAE,2CAA2C,GACrD,OAAO,CAAC,kCAAkC,CAAC,2BAA2B,CAAC,CAAC;IAS3E;;;;OAIG;IACG,gBAAgB,CACpB,SAAS,EAAE,4CAA4C,GACtD,OAAO,CAAC,mCAAmC,CAAC,4BAA4B,CAAC,CAAC;IAS7E,8DAA8D;IACxD,kBAAkB,CACtB,SAAS,EAAE,8CAA8C,GACxD,OAAO,CAAC,qCAAqC,CAAC,uBAAuB,CAAC,CAAC;CAQ3E"}
|
|
@@ -65,12 +65,20 @@ export class MarketplaceAPI {
|
|
|
65
65
|
return data.uninstallPlayerCode;
|
|
66
66
|
}
|
|
67
67
|
// -- Grid-attached client mods (D2) --------------------------------------------
|
|
68
|
-
|
|
68
|
+
// Superseded by ck-exec mods' CLIENT halves (`client.exec`, 17.14.0) and removed with the
|
|
69
|
+
// legacy engines in 18.0.
|
|
70
|
+
/**
|
|
71
|
+
* Client mods attached to a grid, with the caller's consent state.
|
|
72
|
+
* @deprecated Superseded by `client.exec.gridClientMods` (a ck-exec mod's CLIENT half); removed in 18.0.
|
|
73
|
+
*/
|
|
69
74
|
async gridClientMods(variables) {
|
|
70
75
|
const data = await this.game.request(MarketplaceGridClientModsDocument, variables);
|
|
71
76
|
return data.gridClientMods;
|
|
72
77
|
}
|
|
73
|
-
/**
|
|
78
|
+
/**
|
|
79
|
+
* Consent to one attachment's exact capability hash (per player).
|
|
80
|
+
* @deprecated Superseded by `client.exec.consentClientMod`; removed in 18.0.
|
|
81
|
+
*/
|
|
74
82
|
async consentGridClientMod(variables) {
|
|
75
83
|
const data = await this.game.request(MarketplaceConsentGridClientModDocument, variables);
|
|
76
84
|
return data.consentGridClientMod;
|
|
@@ -79,12 +87,16 @@ export class MarketplaceAPI {
|
|
|
79
87
|
* Trust one author's active attachments in a grid at the exact aggregate
|
|
80
88
|
* capability hash returned by `gridClientMods`. Capability widening changes
|
|
81
89
|
* the hash and requires another explicit call.
|
|
90
|
+
* @deprecated Superseded by `client.exec.trustAuthor`; removed in 18.0.
|
|
82
91
|
*/
|
|
83
92
|
async trustGridAuthor(variables) {
|
|
84
93
|
const data = await this.game.request(MarketplaceTrustGridAuthorDocument, variables);
|
|
85
94
|
return data.trustGridAuthor;
|
|
86
95
|
}
|
|
87
|
-
/**
|
|
96
|
+
/**
|
|
97
|
+
* Fetch an acquired/attached listing's client artifact (base64 + metadata).
|
|
98
|
+
* @deprecated Superseded by `client.exec.modClientArtifact`; removed in 18.0.
|
|
99
|
+
*/
|
|
88
100
|
async clientArtifact(variables) {
|
|
89
101
|
const data = await this.game.request(MarketplaceClientArtifactDocument, variables);
|
|
90
102
|
return data.playerCodeClientArtifact;
|
|
@@ -93,6 +105,8 @@ export class MarketplaceAPI {
|
|
|
93
105
|
* Fetch and decode a client artifact into broker inputs (bytes, content
|
|
94
106
|
* hash, per-dispatch fuel budget) — the marketplace twin of
|
|
95
107
|
* `playerCompute.artifactBytes` for acquired and grid-attached mods.
|
|
108
|
+
* @deprecated Superseded by `client.exec.modClientArtifactBytes`, which also checks the
|
|
109
|
+
* bytes against their digest; `ExecClientHalves` runs a grid's CLIENT halves. Removed in 18.0.
|
|
96
110
|
*/
|
|
97
111
|
async clientArtifactBytes(variables) {
|
|
98
112
|
const a = await this.clientArtifact(variables);
|
package/dist/errors.d.ts
CHANGED
|
@@ -175,7 +175,9 @@ export type CrowdyFaultBlame = 'PLATFORM' | 'AUTHOR' | 'BUDGET';
|
|
|
175
175
|
* reads the full detail in the Crowdy console. Treat it as an open union: the server may
|
|
176
176
|
* add a code, and a client that switches on it should have a default branch.
|
|
177
177
|
*/
|
|
178
|
-
export type CrowdyFaultCode = 'USER_CODE_ERROR' | 'USER_CODE_TOO_SLOW' | 'USER_CODE_LIMIT_EXCEEDED' | 'PLATFORM_BUSY' | 'PLATFORM_ERROR' | 'BUDGET_EXCEEDED' | 'RATE_LIMITED' | 'QUOTA_EXHAUSTED' | 'CIRCUIT_OPEN' | 'TEMPORARILY_DISABLED' | 'INVALID_REQUEST' | 'NOT_ALLOWED' | 'NOT_FOUND' | 'UNAUTHENTICATED' | 'WRONG_DATACENTER' | 'APP_UNAVAILABLE'
|
|
178
|
+
export type CrowdyFaultCode = 'USER_CODE_ERROR' | 'USER_CODE_TOO_SLOW' | 'USER_CODE_LIMIT_EXCEEDED' | 'PLATFORM_BUSY' | 'PLATFORM_ERROR' | 'BUDGET_EXCEEDED' | 'RATE_LIMITED' | 'QUOTA_EXHAUSTED' | 'CIRCUIT_OPEN' | 'TEMPORARILY_DISABLED' | 'INVALID_REQUEST' | 'NOT_ALLOWED' | 'NOT_FOUND' | 'UNAUTHENTICATED' | 'WRONG_DATACENTER' | 'APP_UNAVAILABLE'
|
|
179
|
+
/** The tier switched the legacy engine off (compute, player compute, game model); never retryable. */
|
|
180
|
+
| 'ENGINE_SWITCHED_OFF' | (string & {});
|
|
179
181
|
/** What the platform says about a failure, in the only vocabulary a player is shown. */
|
|
180
182
|
export interface CrowdyPlayerFault {
|
|
181
183
|
/** A stable, enumerated reason. Branch on this, never on a message. */
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,iFAAiF;AACjF,MAAM,WAAW,yBAAyB;IACxC,mFAAmF;IACnF,OAAO,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,SAAS,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAC/B,2EAA2E;IAC3E,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IACpC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AA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