@gameslate/sdk 0.3.17 → 0.3.19
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/README.md +23 -3
- package/bin/gameslate-plugin.mjs +6 -2
- package/build/build-plugin.d.mts +8 -2
- package/build/build-plugin.mjs +40 -36
- package/build/zip.d.mts +6 -0
- package/build/zip.mjs +94 -0
- package/lib/assets.d.ts +41 -1
- package/lib/assets.js +22 -0
- package/lib/host/asset-sandbox.d.ts +2 -1
- package/lib/host/asset-sandbox.js +7 -2
- package/lib/host/inspect.js +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/plugin/contract.d.ts +2 -45
- package/lib/plugin-manifest.d.ts +172 -21
- package/lib/plugin-manifest.js +88 -11
- package/lib/plugin-permissions.d.ts +20 -0
- package/lib/plugin-permissions.js +58 -0
- package/lib/plugins-api.d.ts +470 -0
- package/lib/plugins-api.js +56 -1
- package/package.json +1 -1
- package/template/README.md +8 -0
- package/template/claude/skills/build-gameslate-plugin/SKILL.md +144 -4
- package/template/github/workflows/release.yml +38 -0
- package/template/gitignore +2 -0
- package/template/plugin/tracked-documents.test.ts +68 -0
package/lib/plugins-api.d.ts
CHANGED
|
@@ -1,10 +1,179 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
/** A plugin the player added by URL; a preset (built with the core) has none. */
|
|
3
|
+
export declare const InstalledInfoSchema: z.ZodObject<{
|
|
4
|
+
/** the manifest or zip URL it was added from */
|
|
5
|
+
url: z.ZodString;
|
|
6
|
+
/** false for a plain zip: there is no manifest to check for updates */
|
|
7
|
+
updates: z.ZodBoolean;
|
|
8
|
+
autoUpdate: z.ZodBoolean;
|
|
9
|
+
/** the version kept for a rollback */
|
|
10
|
+
previous: z.ZodNullable<z.ZodString>;
|
|
11
|
+
/** a newer version found at the URL, not installed yet */
|
|
12
|
+
update: z.ZodNullable<z.ZodObject<{
|
|
13
|
+
version: z.ZodString;
|
|
14
|
+
/** its zip's sha256: confirming sends it back, so only this version installs */
|
|
15
|
+
sha256: z.ZodString;
|
|
16
|
+
/** permissions it asks for that this version doesn't have: it waits for consent */
|
|
17
|
+
wants: z.ZodArray<z.ZodObject<{
|
|
18
|
+
key: z.ZodString;
|
|
19
|
+
label: z.ZodString;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
label: string;
|
|
22
|
+
key: string;
|
|
23
|
+
}, {
|
|
24
|
+
label: string;
|
|
25
|
+
key: string;
|
|
26
|
+
}>, "many">;
|
|
27
|
+
/** it installs itself (auto-update on, nothing new asked, not rolled back from, not
|
|
28
|
+
* failed before) */
|
|
29
|
+
automatic: z.ZodBoolean;
|
|
30
|
+
/** it will install itself once no game from this plugin is running */
|
|
31
|
+
waitingForGame: z.ZodBoolean;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
sha256: string;
|
|
34
|
+
version: string;
|
|
35
|
+
wants: {
|
|
36
|
+
label: string;
|
|
37
|
+
key: string;
|
|
38
|
+
}[];
|
|
39
|
+
automatic: boolean;
|
|
40
|
+
waitingForGame: boolean;
|
|
41
|
+
}, {
|
|
42
|
+
sha256: string;
|
|
43
|
+
version: string;
|
|
44
|
+
wants: {
|
|
45
|
+
label: string;
|
|
46
|
+
key: string;
|
|
47
|
+
}[];
|
|
48
|
+
automatic: boolean;
|
|
49
|
+
waitingForGame: boolean;
|
|
50
|
+
}>>;
|
|
51
|
+
/** why the last update check or automatic update failed */
|
|
52
|
+
checkError: z.ZodNullable<z.ZodString>;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
url: string;
|
|
55
|
+
updates: boolean;
|
|
56
|
+
autoUpdate: boolean;
|
|
57
|
+
previous: string | null;
|
|
58
|
+
update: {
|
|
59
|
+
sha256: string;
|
|
60
|
+
version: string;
|
|
61
|
+
wants: {
|
|
62
|
+
label: string;
|
|
63
|
+
key: string;
|
|
64
|
+
}[];
|
|
65
|
+
automatic: boolean;
|
|
66
|
+
waitingForGame: boolean;
|
|
67
|
+
} | null;
|
|
68
|
+
checkError: string | null;
|
|
69
|
+
}, {
|
|
70
|
+
url: string;
|
|
71
|
+
updates: boolean;
|
|
72
|
+
autoUpdate: boolean;
|
|
73
|
+
previous: string | null;
|
|
74
|
+
update: {
|
|
75
|
+
sha256: string;
|
|
76
|
+
version: string;
|
|
77
|
+
wants: {
|
|
78
|
+
label: string;
|
|
79
|
+
key: string;
|
|
80
|
+
}[];
|
|
81
|
+
automatic: boolean;
|
|
82
|
+
waitingForGame: boolean;
|
|
83
|
+
} | null;
|
|
84
|
+
checkError: string | null;
|
|
85
|
+
}>;
|
|
86
|
+
export type InstalledInfo = z.infer<typeof InstalledInfoSchema>;
|
|
2
87
|
export declare const PluginViewSchema: z.ZodObject<{
|
|
3
88
|
id: z.ZodString;
|
|
4
89
|
name: z.ZodString;
|
|
5
90
|
version: z.ZodString;
|
|
6
91
|
/** built and tested with another core version */
|
|
7
92
|
untested: z.ZodBoolean;
|
|
93
|
+
/** null: a preset, which can be hidden but not removed */
|
|
94
|
+
installed: z.ZodNullable<z.ZodObject<{
|
|
95
|
+
/** the manifest or zip URL it was added from */
|
|
96
|
+
url: z.ZodString;
|
|
97
|
+
/** false for a plain zip: there is no manifest to check for updates */
|
|
98
|
+
updates: z.ZodBoolean;
|
|
99
|
+
autoUpdate: z.ZodBoolean;
|
|
100
|
+
/** the version kept for a rollback */
|
|
101
|
+
previous: z.ZodNullable<z.ZodString>;
|
|
102
|
+
/** a newer version found at the URL, not installed yet */
|
|
103
|
+
update: z.ZodNullable<z.ZodObject<{
|
|
104
|
+
version: z.ZodString;
|
|
105
|
+
/** its zip's sha256: confirming sends it back, so only this version installs */
|
|
106
|
+
sha256: z.ZodString;
|
|
107
|
+
/** permissions it asks for that this version doesn't have: it waits for consent */
|
|
108
|
+
wants: z.ZodArray<z.ZodObject<{
|
|
109
|
+
key: z.ZodString;
|
|
110
|
+
label: z.ZodString;
|
|
111
|
+
}, "strip", z.ZodTypeAny, {
|
|
112
|
+
label: string;
|
|
113
|
+
key: string;
|
|
114
|
+
}, {
|
|
115
|
+
label: string;
|
|
116
|
+
key: string;
|
|
117
|
+
}>, "many">;
|
|
118
|
+
/** it installs itself (auto-update on, nothing new asked, not rolled back from, not
|
|
119
|
+
* failed before) */
|
|
120
|
+
automatic: z.ZodBoolean;
|
|
121
|
+
/** it will install itself once no game from this plugin is running */
|
|
122
|
+
waitingForGame: z.ZodBoolean;
|
|
123
|
+
}, "strip", z.ZodTypeAny, {
|
|
124
|
+
sha256: string;
|
|
125
|
+
version: string;
|
|
126
|
+
wants: {
|
|
127
|
+
label: string;
|
|
128
|
+
key: string;
|
|
129
|
+
}[];
|
|
130
|
+
automatic: boolean;
|
|
131
|
+
waitingForGame: boolean;
|
|
132
|
+
}, {
|
|
133
|
+
sha256: string;
|
|
134
|
+
version: string;
|
|
135
|
+
wants: {
|
|
136
|
+
label: string;
|
|
137
|
+
key: string;
|
|
138
|
+
}[];
|
|
139
|
+
automatic: boolean;
|
|
140
|
+
waitingForGame: boolean;
|
|
141
|
+
}>>;
|
|
142
|
+
/** why the last update check or automatic update failed */
|
|
143
|
+
checkError: z.ZodNullable<z.ZodString>;
|
|
144
|
+
}, "strip", z.ZodTypeAny, {
|
|
145
|
+
url: string;
|
|
146
|
+
updates: boolean;
|
|
147
|
+
autoUpdate: boolean;
|
|
148
|
+
previous: string | null;
|
|
149
|
+
update: {
|
|
150
|
+
sha256: string;
|
|
151
|
+
version: string;
|
|
152
|
+
wants: {
|
|
153
|
+
label: string;
|
|
154
|
+
key: string;
|
|
155
|
+
}[];
|
|
156
|
+
automatic: boolean;
|
|
157
|
+
waitingForGame: boolean;
|
|
158
|
+
} | null;
|
|
159
|
+
checkError: string | null;
|
|
160
|
+
}, {
|
|
161
|
+
url: string;
|
|
162
|
+
updates: boolean;
|
|
163
|
+
autoUpdate: boolean;
|
|
164
|
+
previous: string | null;
|
|
165
|
+
update: {
|
|
166
|
+
sha256: string;
|
|
167
|
+
version: string;
|
|
168
|
+
wants: {
|
|
169
|
+
label: string;
|
|
170
|
+
key: string;
|
|
171
|
+
}[];
|
|
172
|
+
automatic: boolean;
|
|
173
|
+
waitingForGame: boolean;
|
|
174
|
+
} | null;
|
|
175
|
+
checkError: string | null;
|
|
176
|
+
}>>;
|
|
8
177
|
features: z.ZodObject<{
|
|
9
178
|
live: z.ZodObject<{
|
|
10
179
|
available: z.ZodBoolean;
|
|
@@ -87,6 +256,23 @@ export declare const PluginViewSchema: z.ZodObject<{
|
|
|
87
256
|
}[];
|
|
88
257
|
}[];
|
|
89
258
|
untested: boolean;
|
|
259
|
+
installed: {
|
|
260
|
+
url: string;
|
|
261
|
+
updates: boolean;
|
|
262
|
+
autoUpdate: boolean;
|
|
263
|
+
previous: string | null;
|
|
264
|
+
update: {
|
|
265
|
+
sha256: string;
|
|
266
|
+
version: string;
|
|
267
|
+
wants: {
|
|
268
|
+
label: string;
|
|
269
|
+
key: string;
|
|
270
|
+
}[];
|
|
271
|
+
automatic: boolean;
|
|
272
|
+
waitingForGame: boolean;
|
|
273
|
+
} | null;
|
|
274
|
+
checkError: string | null;
|
|
275
|
+
} | null;
|
|
90
276
|
features: {
|
|
91
277
|
assets: {
|
|
92
278
|
available: boolean;
|
|
@@ -110,6 +296,23 @@ export declare const PluginViewSchema: z.ZodObject<{
|
|
|
110
296
|
}[];
|
|
111
297
|
}[];
|
|
112
298
|
untested: boolean;
|
|
299
|
+
installed: {
|
|
300
|
+
url: string;
|
|
301
|
+
updates: boolean;
|
|
302
|
+
autoUpdate: boolean;
|
|
303
|
+
previous: string | null;
|
|
304
|
+
update: {
|
|
305
|
+
sha256: string;
|
|
306
|
+
version: string;
|
|
307
|
+
wants: {
|
|
308
|
+
label: string;
|
|
309
|
+
key: string;
|
|
310
|
+
}[];
|
|
311
|
+
automatic: boolean;
|
|
312
|
+
waitingForGame: boolean;
|
|
313
|
+
} | null;
|
|
314
|
+
checkError: string | null;
|
|
315
|
+
} | null;
|
|
113
316
|
features: {
|
|
114
317
|
assets: {
|
|
115
318
|
available: boolean;
|
|
@@ -195,6 +398,90 @@ export declare const PluginsResponseSchema: z.ZodObject<{
|
|
|
195
398
|
version: z.ZodString;
|
|
196
399
|
/** built and tested with another core version */
|
|
197
400
|
untested: z.ZodBoolean;
|
|
401
|
+
/** null: a preset, which can be hidden but not removed */
|
|
402
|
+
installed: z.ZodNullable<z.ZodObject<{
|
|
403
|
+
/** the manifest or zip URL it was added from */
|
|
404
|
+
url: z.ZodString;
|
|
405
|
+
/** false for a plain zip: there is no manifest to check for updates */
|
|
406
|
+
updates: z.ZodBoolean;
|
|
407
|
+
autoUpdate: z.ZodBoolean;
|
|
408
|
+
/** the version kept for a rollback */
|
|
409
|
+
previous: z.ZodNullable<z.ZodString>;
|
|
410
|
+
/** a newer version found at the URL, not installed yet */
|
|
411
|
+
update: z.ZodNullable<z.ZodObject<{
|
|
412
|
+
version: z.ZodString;
|
|
413
|
+
/** its zip's sha256: confirming sends it back, so only this version installs */
|
|
414
|
+
sha256: z.ZodString;
|
|
415
|
+
/** permissions it asks for that this version doesn't have: it waits for consent */
|
|
416
|
+
wants: z.ZodArray<z.ZodObject<{
|
|
417
|
+
key: z.ZodString;
|
|
418
|
+
label: z.ZodString;
|
|
419
|
+
}, "strip", z.ZodTypeAny, {
|
|
420
|
+
label: string;
|
|
421
|
+
key: string;
|
|
422
|
+
}, {
|
|
423
|
+
label: string;
|
|
424
|
+
key: string;
|
|
425
|
+
}>, "many">;
|
|
426
|
+
/** it installs itself (auto-update on, nothing new asked, not rolled back from, not
|
|
427
|
+
* failed before) */
|
|
428
|
+
automatic: z.ZodBoolean;
|
|
429
|
+
/** it will install itself once no game from this plugin is running */
|
|
430
|
+
waitingForGame: z.ZodBoolean;
|
|
431
|
+
}, "strip", z.ZodTypeAny, {
|
|
432
|
+
sha256: string;
|
|
433
|
+
version: string;
|
|
434
|
+
wants: {
|
|
435
|
+
label: string;
|
|
436
|
+
key: string;
|
|
437
|
+
}[];
|
|
438
|
+
automatic: boolean;
|
|
439
|
+
waitingForGame: boolean;
|
|
440
|
+
}, {
|
|
441
|
+
sha256: string;
|
|
442
|
+
version: string;
|
|
443
|
+
wants: {
|
|
444
|
+
label: string;
|
|
445
|
+
key: string;
|
|
446
|
+
}[];
|
|
447
|
+
automatic: boolean;
|
|
448
|
+
waitingForGame: boolean;
|
|
449
|
+
}>>;
|
|
450
|
+
/** why the last update check or automatic update failed */
|
|
451
|
+
checkError: z.ZodNullable<z.ZodString>;
|
|
452
|
+
}, "strip", z.ZodTypeAny, {
|
|
453
|
+
url: string;
|
|
454
|
+
updates: boolean;
|
|
455
|
+
autoUpdate: boolean;
|
|
456
|
+
previous: string | null;
|
|
457
|
+
update: {
|
|
458
|
+
sha256: string;
|
|
459
|
+
version: string;
|
|
460
|
+
wants: {
|
|
461
|
+
label: string;
|
|
462
|
+
key: string;
|
|
463
|
+
}[];
|
|
464
|
+
automatic: boolean;
|
|
465
|
+
waitingForGame: boolean;
|
|
466
|
+
} | null;
|
|
467
|
+
checkError: string | null;
|
|
468
|
+
}, {
|
|
469
|
+
url: string;
|
|
470
|
+
updates: boolean;
|
|
471
|
+
autoUpdate: boolean;
|
|
472
|
+
previous: string | null;
|
|
473
|
+
update: {
|
|
474
|
+
sha256: string;
|
|
475
|
+
version: string;
|
|
476
|
+
wants: {
|
|
477
|
+
label: string;
|
|
478
|
+
key: string;
|
|
479
|
+
}[];
|
|
480
|
+
automatic: boolean;
|
|
481
|
+
waitingForGame: boolean;
|
|
482
|
+
} | null;
|
|
483
|
+
checkError: string | null;
|
|
484
|
+
}>>;
|
|
198
485
|
features: z.ZodObject<{
|
|
199
486
|
live: z.ZodObject<{
|
|
200
487
|
available: z.ZodBoolean;
|
|
@@ -277,6 +564,23 @@ export declare const PluginsResponseSchema: z.ZodObject<{
|
|
|
277
564
|
}[];
|
|
278
565
|
}[];
|
|
279
566
|
untested: boolean;
|
|
567
|
+
installed: {
|
|
568
|
+
url: string;
|
|
569
|
+
updates: boolean;
|
|
570
|
+
autoUpdate: boolean;
|
|
571
|
+
previous: string | null;
|
|
572
|
+
update: {
|
|
573
|
+
sha256: string;
|
|
574
|
+
version: string;
|
|
575
|
+
wants: {
|
|
576
|
+
label: string;
|
|
577
|
+
key: string;
|
|
578
|
+
}[];
|
|
579
|
+
automatic: boolean;
|
|
580
|
+
waitingForGame: boolean;
|
|
581
|
+
} | null;
|
|
582
|
+
checkError: string | null;
|
|
583
|
+
} | null;
|
|
280
584
|
features: {
|
|
281
585
|
assets: {
|
|
282
586
|
available: boolean;
|
|
@@ -300,6 +604,23 @@ export declare const PluginsResponseSchema: z.ZodObject<{
|
|
|
300
604
|
}[];
|
|
301
605
|
}[];
|
|
302
606
|
untested: boolean;
|
|
607
|
+
installed: {
|
|
608
|
+
url: string;
|
|
609
|
+
updates: boolean;
|
|
610
|
+
autoUpdate: boolean;
|
|
611
|
+
previous: string | null;
|
|
612
|
+
update: {
|
|
613
|
+
sha256: string;
|
|
614
|
+
version: string;
|
|
615
|
+
wants: {
|
|
616
|
+
label: string;
|
|
617
|
+
key: string;
|
|
618
|
+
}[];
|
|
619
|
+
automatic: boolean;
|
|
620
|
+
waitingForGame: boolean;
|
|
621
|
+
} | null;
|
|
622
|
+
checkError: string | null;
|
|
623
|
+
} | null;
|
|
303
624
|
features: {
|
|
304
625
|
assets: {
|
|
305
626
|
available: boolean;
|
|
@@ -375,7 +696,29 @@ export declare const PluginsResponseSchema: z.ZodObject<{
|
|
|
375
696
|
error?: string | undefined;
|
|
376
697
|
building?: string[] | undefined;
|
|
377
698
|
}>>;
|
|
699
|
+
/** presets the player hid: not loaded, offered to show again */
|
|
700
|
+
hidden: z.ZodArray<z.ZodObject<{
|
|
701
|
+
id: z.ZodString;
|
|
702
|
+
name: z.ZodString;
|
|
703
|
+
version: z.ZodString;
|
|
704
|
+
}, "strip", z.ZodTypeAny, {
|
|
705
|
+
id: string;
|
|
706
|
+
name: string;
|
|
707
|
+
version: string;
|
|
708
|
+
}, {
|
|
709
|
+
id: string;
|
|
710
|
+
name: string;
|
|
711
|
+
version: string;
|
|
712
|
+
}>, "many">;
|
|
713
|
+
/** why plugins can't be added, updated or removed right now (the daemon's install record is
|
|
714
|
+
* damaged), or null */
|
|
715
|
+
installError: z.ZodNullable<z.ZodString>;
|
|
378
716
|
}, "strip", z.ZodTypeAny, {
|
|
717
|
+
hidden: {
|
|
718
|
+
id: string;
|
|
719
|
+
name: string;
|
|
720
|
+
version: string;
|
|
721
|
+
}[];
|
|
379
722
|
plugins: {
|
|
380
723
|
id: string;
|
|
381
724
|
name: string;
|
|
@@ -389,6 +732,23 @@ export declare const PluginsResponseSchema: z.ZodObject<{
|
|
|
389
732
|
}[];
|
|
390
733
|
}[];
|
|
391
734
|
untested: boolean;
|
|
735
|
+
installed: {
|
|
736
|
+
url: string;
|
|
737
|
+
updates: boolean;
|
|
738
|
+
autoUpdate: boolean;
|
|
739
|
+
previous: string | null;
|
|
740
|
+
update: {
|
|
741
|
+
sha256: string;
|
|
742
|
+
version: string;
|
|
743
|
+
wants: {
|
|
744
|
+
label: string;
|
|
745
|
+
key: string;
|
|
746
|
+
}[];
|
|
747
|
+
automatic: boolean;
|
|
748
|
+
waitingForGame: boolean;
|
|
749
|
+
} | null;
|
|
750
|
+
checkError: string | null;
|
|
751
|
+
} | null;
|
|
392
752
|
features: {
|
|
393
753
|
assets: {
|
|
394
754
|
available: boolean;
|
|
@@ -419,7 +779,13 @@ export declare const PluginsResponseSchema: z.ZodObject<{
|
|
|
419
779
|
error?: string | undefined;
|
|
420
780
|
building?: string[] | undefined;
|
|
421
781
|
} | null;
|
|
782
|
+
installError: string | null;
|
|
422
783
|
}, {
|
|
784
|
+
hidden: {
|
|
785
|
+
id: string;
|
|
786
|
+
name: string;
|
|
787
|
+
version: string;
|
|
788
|
+
}[];
|
|
423
789
|
plugins: {
|
|
424
790
|
id: string;
|
|
425
791
|
name: string;
|
|
@@ -433,6 +799,23 @@ export declare const PluginsResponseSchema: z.ZodObject<{
|
|
|
433
799
|
}[];
|
|
434
800
|
}[];
|
|
435
801
|
untested: boolean;
|
|
802
|
+
installed: {
|
|
803
|
+
url: string;
|
|
804
|
+
updates: boolean;
|
|
805
|
+
autoUpdate: boolean;
|
|
806
|
+
previous: string | null;
|
|
807
|
+
update: {
|
|
808
|
+
sha256: string;
|
|
809
|
+
version: string;
|
|
810
|
+
wants: {
|
|
811
|
+
label: string;
|
|
812
|
+
key: string;
|
|
813
|
+
}[];
|
|
814
|
+
automatic: boolean;
|
|
815
|
+
waitingForGame: boolean;
|
|
816
|
+
} | null;
|
|
817
|
+
checkError: string | null;
|
|
818
|
+
} | null;
|
|
436
819
|
features: {
|
|
437
820
|
assets: {
|
|
438
821
|
available: boolean;
|
|
@@ -463,5 +846,92 @@ export declare const PluginsResponseSchema: z.ZodObject<{
|
|
|
463
846
|
error?: string | undefined;
|
|
464
847
|
building?: string[] | undefined;
|
|
465
848
|
} | null;
|
|
849
|
+
installError: string | null;
|
|
466
850
|
}>;
|
|
467
851
|
export type PluginsResponse = z.infer<typeof PluginsResponseSchema>;
|
|
852
|
+
/** What a URL holds, shown for the player to confirm before anything is installed. */
|
|
853
|
+
export declare const PluginPreviewSchema: z.ZodObject<{
|
|
854
|
+
url: z.ZodString;
|
|
855
|
+
/** a published manifest (updates are checked), or a plain zip (no update checks) */
|
|
856
|
+
kind: z.ZodEnum<["manifest", "zip"]>;
|
|
857
|
+
id: z.ZodString;
|
|
858
|
+
name: z.ZodString;
|
|
859
|
+
version: z.ZodString;
|
|
860
|
+
games: z.ZodArray<z.ZodObject<{
|
|
861
|
+
id: z.ZodString;
|
|
862
|
+
title: z.ZodString;
|
|
863
|
+
}, "strip", z.ZodTypeAny, {
|
|
864
|
+
id: string;
|
|
865
|
+
title: string;
|
|
866
|
+
}, {
|
|
867
|
+
id: string;
|
|
868
|
+
title: string;
|
|
869
|
+
}>, "many">;
|
|
870
|
+
permissions: z.ZodArray<z.ZodObject<{
|
|
871
|
+
key: z.ZodString;
|
|
872
|
+
label: z.ZodString;
|
|
873
|
+
}, "strip", z.ZodTypeAny, {
|
|
874
|
+
label: string;
|
|
875
|
+
key: string;
|
|
876
|
+
}, {
|
|
877
|
+
label: string;
|
|
878
|
+
key: string;
|
|
879
|
+
}>, "many">;
|
|
880
|
+
/** the zip's sha256: the install refuses any other */
|
|
881
|
+
sha256: z.ZodString;
|
|
882
|
+
/** where that hash came from: the manifest, a `.zip.sha256` beside the zip, or only this
|
|
883
|
+
* download */
|
|
884
|
+
checksum: z.ZodEnum<["manifest", "sidecar", "none"]>;
|
|
885
|
+
/** the version of this plugin already here, if any */
|
|
886
|
+
replaces: z.ZodNullable<z.ZodObject<{
|
|
887
|
+
version: z.ZodString;
|
|
888
|
+
preset: z.ZodBoolean;
|
|
889
|
+
}, "strip", z.ZodTypeAny, {
|
|
890
|
+
version: string;
|
|
891
|
+
preset: boolean;
|
|
892
|
+
}, {
|
|
893
|
+
version: string;
|
|
894
|
+
preset: boolean;
|
|
895
|
+
}>>;
|
|
896
|
+
}, "strip", z.ZodTypeAny, {
|
|
897
|
+
id: string;
|
|
898
|
+
kind: "manifest" | "zip";
|
|
899
|
+
name: string;
|
|
900
|
+
url: string;
|
|
901
|
+
sha256: string;
|
|
902
|
+
version: string;
|
|
903
|
+
games: {
|
|
904
|
+
id: string;
|
|
905
|
+
title: string;
|
|
906
|
+
}[];
|
|
907
|
+
permissions: {
|
|
908
|
+
label: string;
|
|
909
|
+
key: string;
|
|
910
|
+
}[];
|
|
911
|
+
checksum: "none" | "manifest" | "sidecar";
|
|
912
|
+
replaces: {
|
|
913
|
+
version: string;
|
|
914
|
+
preset: boolean;
|
|
915
|
+
} | null;
|
|
916
|
+
}, {
|
|
917
|
+
id: string;
|
|
918
|
+
kind: "manifest" | "zip";
|
|
919
|
+
name: string;
|
|
920
|
+
url: string;
|
|
921
|
+
sha256: string;
|
|
922
|
+
version: string;
|
|
923
|
+
games: {
|
|
924
|
+
id: string;
|
|
925
|
+
title: string;
|
|
926
|
+
}[];
|
|
927
|
+
permissions: {
|
|
928
|
+
label: string;
|
|
929
|
+
key: string;
|
|
930
|
+
}[];
|
|
931
|
+
checksum: "none" | "manifest" | "sidecar";
|
|
932
|
+
replaces: {
|
|
933
|
+
version: string;
|
|
934
|
+
preset: boolean;
|
|
935
|
+
} | null;
|
|
936
|
+
}>;
|
|
937
|
+
export type PluginPreview = z.infer<typeof PluginPreviewSchema>;
|
package/lib/plugins-api.js
CHANGED
|
@@ -1,15 +1,47 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { Sha256Schema } from './plugin-manifest.js';
|
|
3
|
+
import { PluginPermissionSchema } from './plugin-permissions.js';
|
|
2
4
|
/*
|
|
3
5
|
* The daemon's plugin API for the cog (GET /api/plugins and the switch and job endpoints): what's
|
|
4
|
-
* installed, each plugin's feature switches, and the extraction job, if any
|
|
6
|
+
* installed, each plugin's feature switches, and the extraction job, if any; and plugins added by
|
|
7
|
+
* URL (preview, install, updates, rollback, remove).
|
|
5
8
|
*/
|
|
6
9
|
const Feature = z.object({ available: z.boolean(), on: z.boolean() });
|
|
10
|
+
/** A plugin the player added by URL; a preset (built with the core) has none. */
|
|
11
|
+
export const InstalledInfoSchema = z.object({
|
|
12
|
+
/** the manifest or zip URL it was added from */
|
|
13
|
+
url: z.string(),
|
|
14
|
+
/** false for a plain zip: there is no manifest to check for updates */
|
|
15
|
+
updates: z.boolean(),
|
|
16
|
+
autoUpdate: z.boolean(),
|
|
17
|
+
/** the version kept for a rollback */
|
|
18
|
+
previous: z.string().nullable(),
|
|
19
|
+
/** a newer version found at the URL, not installed yet */
|
|
20
|
+
update: z
|
|
21
|
+
.object({
|
|
22
|
+
version: z.string(),
|
|
23
|
+
/** its zip's sha256: confirming sends it back, so only this version installs */
|
|
24
|
+
sha256: Sha256Schema,
|
|
25
|
+
/** permissions it asks for that this version doesn't have: it waits for consent */
|
|
26
|
+
wants: z.array(PluginPermissionSchema),
|
|
27
|
+
/** it installs itself (auto-update on, nothing new asked, not rolled back from, not
|
|
28
|
+
* failed before) */
|
|
29
|
+
automatic: z.boolean(),
|
|
30
|
+
/** it will install itself once no game from this plugin is running */
|
|
31
|
+
waitingForGame: z.boolean(),
|
|
32
|
+
})
|
|
33
|
+
.nullable(),
|
|
34
|
+
/** why the last update check or automatic update failed */
|
|
35
|
+
checkError: z.string().nullable(),
|
|
36
|
+
});
|
|
7
37
|
export const PluginViewSchema = z.object({
|
|
8
38
|
id: z.string(),
|
|
9
39
|
name: z.string(),
|
|
10
40
|
version: z.string(),
|
|
11
41
|
/** built and tested with another core version */
|
|
12
42
|
untested: z.boolean(),
|
|
43
|
+
/** null: a preset, which can be hidden but not removed */
|
|
44
|
+
installed: InstalledInfoSchema.nullable(),
|
|
13
45
|
features: z.object({ live: Feature, assets: Feature }),
|
|
14
46
|
games: z.array(z.object({
|
|
15
47
|
id: z.string(),
|
|
@@ -40,4 +72,27 @@ export const JobStatusSchema = z.object({
|
|
|
40
72
|
export const PluginsResponseSchema = z.object({
|
|
41
73
|
plugins: z.array(PluginViewSchema),
|
|
42
74
|
job: JobStatusSchema.nullable(),
|
|
75
|
+
/** presets the player hid: not loaded, offered to show again */
|
|
76
|
+
hidden: z.array(z.object({ id: z.string(), name: z.string(), version: z.string() })),
|
|
77
|
+
/** why plugins can't be added, updated or removed right now (the daemon's install record is
|
|
78
|
+
* damaged), or null */
|
|
79
|
+
installError: z.string().nullable(),
|
|
80
|
+
});
|
|
81
|
+
/** What a URL holds, shown for the player to confirm before anything is installed. */
|
|
82
|
+
export const PluginPreviewSchema = z.object({
|
|
83
|
+
url: z.string(),
|
|
84
|
+
/** a published manifest (updates are checked), or a plain zip (no update checks) */
|
|
85
|
+
kind: z.enum(['manifest', 'zip']),
|
|
86
|
+
id: z.string(),
|
|
87
|
+
name: z.string(),
|
|
88
|
+
version: z.string(),
|
|
89
|
+
games: z.array(z.object({ id: z.string(), title: z.string() })),
|
|
90
|
+
permissions: z.array(PluginPermissionSchema),
|
|
91
|
+
/** the zip's sha256: the install refuses any other */
|
|
92
|
+
sha256: Sha256Schema,
|
|
93
|
+
/** where that hash came from: the manifest, a `.zip.sha256` beside the zip, or only this
|
|
94
|
+
* download */
|
|
95
|
+
checksum: z.enum(['manifest', 'sidecar', 'none']),
|
|
96
|
+
/** the version of this plugin already here, if any */
|
|
97
|
+
replaces: z.object({ version: z.string(), preset: z.boolean() }).nullable(),
|
|
43
98
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gameslate/sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.19",
|
|
4
4
|
"description": "Build plugins for GameSlate, the second-screen companion for PC games: the plugin contract, game-state and catalogue schemas, and the plugin builder.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/template/README.md
CHANGED
|
@@ -9,3 +9,11 @@ yarn check # typecheck, tests (in the core's own sandbox), build, validate
|
|
|
9
9
|
|
|
10
10
|
`plugin/live.ts` is an example: replace its reads with offsets verified against the game (pin each
|
|
11
11
|
build by its build id), and fill the pack's catalogue (items, missions, collectibles, pins).
|
|
12
|
+
|
|
13
|
+
## Release
|
|
14
|
+
|
|
15
|
+
Bump the version in `package.json` and `plugin/manifest.json`, then push a `vX.Y.Z` tag. The release
|
|
16
|
+
workflow uploads `{{id}}-X.Y.Z.zip`, its `.sha256` and `manifest.json`. Players add the plugin in
|
|
17
|
+
GameSlate's settings (the cog, "Add plugin") with
|
|
18
|
+
`https://github.com/<owner>/gameslate-{{id}}/releases/latest/download/manifest.json`, and GameSlate
|
|
19
|
+
checks that URL for updates.
|