@gameslate/sdk 0.3.17 → 0.3.20
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.d.ts +3 -0
- package/lib/host/inspect.js +21 -5
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/pack.d.ts +991 -0
- package/lib/pack.js +6 -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 +512 -0
- package/lib/plugins-api.js +66 -1
- package/lib/types.d.ts +4 -3
- package/lib/types.js +2 -1
- package/package.json +1 -1
- package/template/README.md +8 -0
- package/template/claude/skills/build-gameslate-plugin/SKILL.md +149 -6
- 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;
|
|
@@ -188,6 +391,23 @@ export declare const JobStatusSchema: z.ZodObject<{
|
|
|
188
391
|
building?: string[] | undefined;
|
|
189
392
|
}>;
|
|
190
393
|
export type JobStatus = z.infer<typeof JobStatusSchema>;
|
|
394
|
+
/** A plugin the core found but refused to load (bad manifest, failed checks, a game another
|
|
395
|
+
* plugin already provides). */
|
|
396
|
+
export declare const RefusedPluginSchema: z.ZodObject<{
|
|
397
|
+
/** its id, or its folder's name when its manifest can't be read */
|
|
398
|
+
name: z.ZodString;
|
|
399
|
+
version: z.ZodNullable<z.ZodString>;
|
|
400
|
+
reason: z.ZodString;
|
|
401
|
+
}, "strip", z.ZodTypeAny, {
|
|
402
|
+
name: string;
|
|
403
|
+
version: string | null;
|
|
404
|
+
reason: string;
|
|
405
|
+
}, {
|
|
406
|
+
name: string;
|
|
407
|
+
version: string | null;
|
|
408
|
+
reason: string;
|
|
409
|
+
}>;
|
|
410
|
+
export type RefusedPlugin = z.infer<typeof RefusedPluginSchema>;
|
|
191
411
|
export declare const PluginsResponseSchema: z.ZodObject<{
|
|
192
412
|
plugins: z.ZodArray<z.ZodObject<{
|
|
193
413
|
id: z.ZodString;
|
|
@@ -195,6 +415,90 @@ export declare const PluginsResponseSchema: z.ZodObject<{
|
|
|
195
415
|
version: z.ZodString;
|
|
196
416
|
/** built and tested with another core version */
|
|
197
417
|
untested: z.ZodBoolean;
|
|
418
|
+
/** null: a preset, which can be hidden but not removed */
|
|
419
|
+
installed: z.ZodNullable<z.ZodObject<{
|
|
420
|
+
/** the manifest or zip URL it was added from */
|
|
421
|
+
url: z.ZodString;
|
|
422
|
+
/** false for a plain zip: there is no manifest to check for updates */
|
|
423
|
+
updates: z.ZodBoolean;
|
|
424
|
+
autoUpdate: z.ZodBoolean;
|
|
425
|
+
/** the version kept for a rollback */
|
|
426
|
+
previous: z.ZodNullable<z.ZodString>;
|
|
427
|
+
/** a newer version found at the URL, not installed yet */
|
|
428
|
+
update: z.ZodNullable<z.ZodObject<{
|
|
429
|
+
version: z.ZodString;
|
|
430
|
+
/** its zip's sha256: confirming sends it back, so only this version installs */
|
|
431
|
+
sha256: z.ZodString;
|
|
432
|
+
/** permissions it asks for that this version doesn't have: it waits for consent */
|
|
433
|
+
wants: z.ZodArray<z.ZodObject<{
|
|
434
|
+
key: z.ZodString;
|
|
435
|
+
label: z.ZodString;
|
|
436
|
+
}, "strip", z.ZodTypeAny, {
|
|
437
|
+
label: string;
|
|
438
|
+
key: string;
|
|
439
|
+
}, {
|
|
440
|
+
label: string;
|
|
441
|
+
key: string;
|
|
442
|
+
}>, "many">;
|
|
443
|
+
/** it installs itself (auto-update on, nothing new asked, not rolled back from, not
|
|
444
|
+
* failed before) */
|
|
445
|
+
automatic: z.ZodBoolean;
|
|
446
|
+
/** it will install itself once no game from this plugin is running */
|
|
447
|
+
waitingForGame: z.ZodBoolean;
|
|
448
|
+
}, "strip", z.ZodTypeAny, {
|
|
449
|
+
sha256: string;
|
|
450
|
+
version: string;
|
|
451
|
+
wants: {
|
|
452
|
+
label: string;
|
|
453
|
+
key: string;
|
|
454
|
+
}[];
|
|
455
|
+
automatic: boolean;
|
|
456
|
+
waitingForGame: boolean;
|
|
457
|
+
}, {
|
|
458
|
+
sha256: string;
|
|
459
|
+
version: string;
|
|
460
|
+
wants: {
|
|
461
|
+
label: string;
|
|
462
|
+
key: string;
|
|
463
|
+
}[];
|
|
464
|
+
automatic: boolean;
|
|
465
|
+
waitingForGame: boolean;
|
|
466
|
+
}>>;
|
|
467
|
+
/** why the last update check or automatic update failed */
|
|
468
|
+
checkError: z.ZodNullable<z.ZodString>;
|
|
469
|
+
}, "strip", z.ZodTypeAny, {
|
|
470
|
+
url: string;
|
|
471
|
+
updates: boolean;
|
|
472
|
+
autoUpdate: boolean;
|
|
473
|
+
previous: string | null;
|
|
474
|
+
update: {
|
|
475
|
+
sha256: string;
|
|
476
|
+
version: string;
|
|
477
|
+
wants: {
|
|
478
|
+
label: string;
|
|
479
|
+
key: string;
|
|
480
|
+
}[];
|
|
481
|
+
automatic: boolean;
|
|
482
|
+
waitingForGame: boolean;
|
|
483
|
+
} | null;
|
|
484
|
+
checkError: string | null;
|
|
485
|
+
}, {
|
|
486
|
+
url: string;
|
|
487
|
+
updates: boolean;
|
|
488
|
+
autoUpdate: boolean;
|
|
489
|
+
previous: string | null;
|
|
490
|
+
update: {
|
|
491
|
+
sha256: string;
|
|
492
|
+
version: string;
|
|
493
|
+
wants: {
|
|
494
|
+
label: string;
|
|
495
|
+
key: string;
|
|
496
|
+
}[];
|
|
497
|
+
automatic: boolean;
|
|
498
|
+
waitingForGame: boolean;
|
|
499
|
+
} | null;
|
|
500
|
+
checkError: string | null;
|
|
501
|
+
}>>;
|
|
198
502
|
features: z.ZodObject<{
|
|
199
503
|
live: z.ZodObject<{
|
|
200
504
|
available: z.ZodBoolean;
|
|
@@ -277,6 +581,23 @@ export declare const PluginsResponseSchema: z.ZodObject<{
|
|
|
277
581
|
}[];
|
|
278
582
|
}[];
|
|
279
583
|
untested: boolean;
|
|
584
|
+
installed: {
|
|
585
|
+
url: string;
|
|
586
|
+
updates: boolean;
|
|
587
|
+
autoUpdate: boolean;
|
|
588
|
+
previous: string | null;
|
|
589
|
+
update: {
|
|
590
|
+
sha256: string;
|
|
591
|
+
version: string;
|
|
592
|
+
wants: {
|
|
593
|
+
label: string;
|
|
594
|
+
key: string;
|
|
595
|
+
}[];
|
|
596
|
+
automatic: boolean;
|
|
597
|
+
waitingForGame: boolean;
|
|
598
|
+
} | null;
|
|
599
|
+
checkError: string | null;
|
|
600
|
+
} | null;
|
|
280
601
|
features: {
|
|
281
602
|
assets: {
|
|
282
603
|
available: boolean;
|
|
@@ -300,6 +621,23 @@ export declare const PluginsResponseSchema: z.ZodObject<{
|
|
|
300
621
|
}[];
|
|
301
622
|
}[];
|
|
302
623
|
untested: boolean;
|
|
624
|
+
installed: {
|
|
625
|
+
url: string;
|
|
626
|
+
updates: boolean;
|
|
627
|
+
autoUpdate: boolean;
|
|
628
|
+
previous: string | null;
|
|
629
|
+
update: {
|
|
630
|
+
sha256: string;
|
|
631
|
+
version: string;
|
|
632
|
+
wants: {
|
|
633
|
+
label: string;
|
|
634
|
+
key: string;
|
|
635
|
+
}[];
|
|
636
|
+
automatic: boolean;
|
|
637
|
+
waitingForGame: boolean;
|
|
638
|
+
} | null;
|
|
639
|
+
checkError: string | null;
|
|
640
|
+
} | null;
|
|
303
641
|
features: {
|
|
304
642
|
assets: {
|
|
305
643
|
available: boolean;
|
|
@@ -375,7 +713,44 @@ export declare const PluginsResponseSchema: z.ZodObject<{
|
|
|
375
713
|
error?: string | undefined;
|
|
376
714
|
building?: string[] | undefined;
|
|
377
715
|
}>>;
|
|
716
|
+
/** presets the player hid: not loaded, offered to show again */
|
|
717
|
+
hidden: z.ZodArray<z.ZodObject<{
|
|
718
|
+
id: z.ZodString;
|
|
719
|
+
name: z.ZodString;
|
|
720
|
+
version: z.ZodString;
|
|
721
|
+
}, "strip", z.ZodTypeAny, {
|
|
722
|
+
id: string;
|
|
723
|
+
name: string;
|
|
724
|
+
version: string;
|
|
725
|
+
}, {
|
|
726
|
+
id: string;
|
|
727
|
+
name: string;
|
|
728
|
+
version: string;
|
|
729
|
+
}>, "many">;
|
|
730
|
+
/** plugins found but not loaded, with the reason */
|
|
731
|
+
refused: z.ZodArray<z.ZodObject<{
|
|
732
|
+
/** its id, or its folder's name when its manifest can't be read */
|
|
733
|
+
name: z.ZodString;
|
|
734
|
+
version: z.ZodNullable<z.ZodString>;
|
|
735
|
+
reason: z.ZodString;
|
|
736
|
+
}, "strip", z.ZodTypeAny, {
|
|
737
|
+
name: string;
|
|
738
|
+
version: string | null;
|
|
739
|
+
reason: string;
|
|
740
|
+
}, {
|
|
741
|
+
name: string;
|
|
742
|
+
version: string | null;
|
|
743
|
+
reason: string;
|
|
744
|
+
}>, "many">;
|
|
745
|
+
/** why plugins can't be added, updated or removed right now (the daemon's install record is
|
|
746
|
+
* damaged), or null */
|
|
747
|
+
installError: z.ZodNullable<z.ZodString>;
|
|
378
748
|
}, "strip", z.ZodTypeAny, {
|
|
749
|
+
hidden: {
|
|
750
|
+
id: string;
|
|
751
|
+
name: string;
|
|
752
|
+
version: string;
|
|
753
|
+
}[];
|
|
379
754
|
plugins: {
|
|
380
755
|
id: string;
|
|
381
756
|
name: string;
|
|
@@ -389,6 +764,23 @@ export declare const PluginsResponseSchema: z.ZodObject<{
|
|
|
389
764
|
}[];
|
|
390
765
|
}[];
|
|
391
766
|
untested: boolean;
|
|
767
|
+
installed: {
|
|
768
|
+
url: string;
|
|
769
|
+
updates: boolean;
|
|
770
|
+
autoUpdate: boolean;
|
|
771
|
+
previous: string | null;
|
|
772
|
+
update: {
|
|
773
|
+
sha256: string;
|
|
774
|
+
version: string;
|
|
775
|
+
wants: {
|
|
776
|
+
label: string;
|
|
777
|
+
key: string;
|
|
778
|
+
}[];
|
|
779
|
+
automatic: boolean;
|
|
780
|
+
waitingForGame: boolean;
|
|
781
|
+
} | null;
|
|
782
|
+
checkError: string | null;
|
|
783
|
+
} | null;
|
|
392
784
|
features: {
|
|
393
785
|
assets: {
|
|
394
786
|
available: boolean;
|
|
@@ -419,7 +811,18 @@ export declare const PluginsResponseSchema: z.ZodObject<{
|
|
|
419
811
|
error?: string | undefined;
|
|
420
812
|
building?: string[] | undefined;
|
|
421
813
|
} | null;
|
|
814
|
+
refused: {
|
|
815
|
+
name: string;
|
|
816
|
+
version: string | null;
|
|
817
|
+
reason: string;
|
|
818
|
+
}[];
|
|
819
|
+
installError: string | null;
|
|
422
820
|
}, {
|
|
821
|
+
hidden: {
|
|
822
|
+
id: string;
|
|
823
|
+
name: string;
|
|
824
|
+
version: string;
|
|
825
|
+
}[];
|
|
423
826
|
plugins: {
|
|
424
827
|
id: string;
|
|
425
828
|
name: string;
|
|
@@ -433,6 +836,23 @@ export declare const PluginsResponseSchema: z.ZodObject<{
|
|
|
433
836
|
}[];
|
|
434
837
|
}[];
|
|
435
838
|
untested: boolean;
|
|
839
|
+
installed: {
|
|
840
|
+
url: string;
|
|
841
|
+
updates: boolean;
|
|
842
|
+
autoUpdate: boolean;
|
|
843
|
+
previous: string | null;
|
|
844
|
+
update: {
|
|
845
|
+
sha256: string;
|
|
846
|
+
version: string;
|
|
847
|
+
wants: {
|
|
848
|
+
label: string;
|
|
849
|
+
key: string;
|
|
850
|
+
}[];
|
|
851
|
+
automatic: boolean;
|
|
852
|
+
waitingForGame: boolean;
|
|
853
|
+
} | null;
|
|
854
|
+
checkError: string | null;
|
|
855
|
+
} | null;
|
|
436
856
|
features: {
|
|
437
857
|
assets: {
|
|
438
858
|
available: boolean;
|
|
@@ -463,5 +883,97 @@ export declare const PluginsResponseSchema: z.ZodObject<{
|
|
|
463
883
|
error?: string | undefined;
|
|
464
884
|
building?: string[] | undefined;
|
|
465
885
|
} | null;
|
|
886
|
+
refused: {
|
|
887
|
+
name: string;
|
|
888
|
+
version: string | null;
|
|
889
|
+
reason: string;
|
|
890
|
+
}[];
|
|
891
|
+
installError: string | null;
|
|
466
892
|
}>;
|
|
467
893
|
export type PluginsResponse = z.infer<typeof PluginsResponseSchema>;
|
|
894
|
+
/** What a URL holds, shown for the player to confirm before anything is installed. */
|
|
895
|
+
export declare const PluginPreviewSchema: z.ZodObject<{
|
|
896
|
+
url: z.ZodString;
|
|
897
|
+
/** a published manifest (updates are checked), or a plain zip (no update checks) */
|
|
898
|
+
kind: z.ZodEnum<["manifest", "zip"]>;
|
|
899
|
+
id: z.ZodString;
|
|
900
|
+
name: z.ZodString;
|
|
901
|
+
version: z.ZodString;
|
|
902
|
+
games: z.ZodArray<z.ZodObject<{
|
|
903
|
+
id: z.ZodString;
|
|
904
|
+
title: z.ZodString;
|
|
905
|
+
}, "strip", z.ZodTypeAny, {
|
|
906
|
+
id: string;
|
|
907
|
+
title: string;
|
|
908
|
+
}, {
|
|
909
|
+
id: string;
|
|
910
|
+
title: string;
|
|
911
|
+
}>, "many">;
|
|
912
|
+
permissions: z.ZodArray<z.ZodObject<{
|
|
913
|
+
key: z.ZodString;
|
|
914
|
+
label: z.ZodString;
|
|
915
|
+
}, "strip", z.ZodTypeAny, {
|
|
916
|
+
label: string;
|
|
917
|
+
key: string;
|
|
918
|
+
}, {
|
|
919
|
+
label: string;
|
|
920
|
+
key: string;
|
|
921
|
+
}>, "many">;
|
|
922
|
+
/** the zip's sha256: the install refuses any other */
|
|
923
|
+
sha256: z.ZodString;
|
|
924
|
+
/** where that hash came from: the manifest, a `.zip.sha256` beside the zip, or only this
|
|
925
|
+
* download */
|
|
926
|
+
checksum: z.ZodEnum<["manifest", "sidecar", "none"]>;
|
|
927
|
+
/** the version of this plugin already here, if any */
|
|
928
|
+
replaces: z.ZodNullable<z.ZodObject<{
|
|
929
|
+
version: z.ZodString;
|
|
930
|
+
preset: z.ZodBoolean;
|
|
931
|
+
}, "strip", z.ZodTypeAny, {
|
|
932
|
+
version: string;
|
|
933
|
+
preset: boolean;
|
|
934
|
+
}, {
|
|
935
|
+
version: string;
|
|
936
|
+
preset: boolean;
|
|
937
|
+
}>>;
|
|
938
|
+
}, "strip", z.ZodTypeAny, {
|
|
939
|
+
id: string;
|
|
940
|
+
kind: "manifest" | "zip";
|
|
941
|
+
name: string;
|
|
942
|
+
url: string;
|
|
943
|
+
sha256: string;
|
|
944
|
+
version: string;
|
|
945
|
+
games: {
|
|
946
|
+
id: string;
|
|
947
|
+
title: string;
|
|
948
|
+
}[];
|
|
949
|
+
permissions: {
|
|
950
|
+
label: string;
|
|
951
|
+
key: string;
|
|
952
|
+
}[];
|
|
953
|
+
checksum: "none" | "manifest" | "sidecar";
|
|
954
|
+
replaces: {
|
|
955
|
+
version: string;
|
|
956
|
+
preset: boolean;
|
|
957
|
+
} | null;
|
|
958
|
+
}, {
|
|
959
|
+
id: string;
|
|
960
|
+
kind: "manifest" | "zip";
|
|
961
|
+
name: string;
|
|
962
|
+
url: string;
|
|
963
|
+
sha256: string;
|
|
964
|
+
version: string;
|
|
965
|
+
games: {
|
|
966
|
+
id: string;
|
|
967
|
+
title: string;
|
|
968
|
+
}[];
|
|
969
|
+
permissions: {
|
|
970
|
+
label: string;
|
|
971
|
+
key: string;
|
|
972
|
+
}[];
|
|
973
|
+
checksum: "none" | "manifest" | "sidecar";
|
|
974
|
+
replaces: {
|
|
975
|
+
version: string;
|
|
976
|
+
preset: boolean;
|
|
977
|
+
} | null;
|
|
978
|
+
}>;
|
|
979
|
+
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(),
|
|
@@ -37,7 +69,40 @@ export const JobStatusSchema = z.object({
|
|
|
37
69
|
failures: z.array(z.object({ label: z.string(), error: z.string() })),
|
|
38
70
|
error: z.string().optional(),
|
|
39
71
|
});
|
|
72
|
+
/** A plugin the core found but refused to load (bad manifest, failed checks, a game another
|
|
73
|
+
* plugin already provides). */
|
|
74
|
+
export const RefusedPluginSchema = z.object({
|
|
75
|
+
/** its id, or its folder's name when its manifest can't be read */
|
|
76
|
+
name: z.string(),
|
|
77
|
+
version: z.string().nullable(),
|
|
78
|
+
reason: z.string(),
|
|
79
|
+
});
|
|
40
80
|
export const PluginsResponseSchema = z.object({
|
|
41
81
|
plugins: z.array(PluginViewSchema),
|
|
42
82
|
job: JobStatusSchema.nullable(),
|
|
83
|
+
/** presets the player hid: not loaded, offered to show again */
|
|
84
|
+
hidden: z.array(z.object({ id: z.string(), name: z.string(), version: z.string() })),
|
|
85
|
+
/** plugins found but not loaded, with the reason */
|
|
86
|
+
refused: z.array(RefusedPluginSchema),
|
|
87
|
+
/** why plugins can't be added, updated or removed right now (the daemon's install record is
|
|
88
|
+
* damaged), or null */
|
|
89
|
+
installError: z.string().nullable(),
|
|
90
|
+
});
|
|
91
|
+
/** What a URL holds, shown for the player to confirm before anything is installed. */
|
|
92
|
+
export const PluginPreviewSchema = z.object({
|
|
93
|
+
url: z.string(),
|
|
94
|
+
/** a published manifest (updates are checked), or a plain zip (no update checks) */
|
|
95
|
+
kind: z.enum(['manifest', 'zip']),
|
|
96
|
+
id: z.string(),
|
|
97
|
+
name: z.string(),
|
|
98
|
+
version: z.string(),
|
|
99
|
+
games: z.array(z.object({ id: z.string(), title: z.string() })),
|
|
100
|
+
permissions: z.array(PluginPermissionSchema),
|
|
101
|
+
/** the zip's sha256: the install refuses any other */
|
|
102
|
+
sha256: Sha256Schema,
|
|
103
|
+
/** where that hash came from: the manifest, a `.zip.sha256` beside the zip, or only this
|
|
104
|
+
* download */
|
|
105
|
+
checksum: z.enum(['manifest', 'sidecar', 'none']),
|
|
106
|
+
/** the version of this plugin already here, if any */
|
|
107
|
+
replaces: z.object({ version: z.string(), preset: z.boolean() }).nullable(),
|
|
43
108
|
});
|
package/lib/types.d.ts
CHANGED
|
@@ -2673,14 +2673,15 @@ export declare const ServerWsMessageSchema: z.ZodDiscriminatedUnion<"type", [z.Z
|
|
|
2673
2673
|
timestamp: number;
|
|
2674
2674
|
}>, z.ZodObject<{
|
|
2675
2675
|
type: z.ZodLiteral<"error">;
|
|
2676
|
-
|
|
2676
|
+
/** not_paired: a screen that may view, without the pairing token, tried a change */
|
|
2677
|
+
code: z.ZodEnum<["unauthorized", "bad_request", "not_paired"]>;
|
|
2677
2678
|
message: z.ZodString;
|
|
2678
2679
|
}, "strip", z.ZodTypeAny, {
|
|
2679
|
-
code: "unauthorized" | "bad_request";
|
|
2680
|
+
code: "unauthorized" | "bad_request" | "not_paired";
|
|
2680
2681
|
message: string;
|
|
2681
2682
|
type: "error";
|
|
2682
2683
|
}, {
|
|
2683
|
-
code: "unauthorized" | "bad_request";
|
|
2684
|
+
code: "unauthorized" | "bad_request" | "not_paired";
|
|
2684
2685
|
message: string;
|
|
2685
2686
|
type: "error";
|
|
2686
2687
|
}>]>;
|