@gameslate/sdk 0.0.0-stage → 0.3.0
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/LICENSE +21 -0
- package/README.md +38 -2
- package/bin/gameslate-plugin.mjs +26 -0
- package/build/build-plugin.mjs +103 -0
- package/lib/assets.d.ts +1788 -0
- package/lib/assets.js +107 -0
- package/lib/bytes.d.ts +33 -0
- package/lib/bytes.js +89 -0
- package/lib/catalogue.d.ts +1228 -0
- package/lib/catalogue.js +305 -0
- package/lib/chips.d.ts +18 -0
- package/lib/chips.js +28 -0
- package/lib/condition.d.ts +58 -0
- package/lib/condition.js +125 -0
- package/lib/index.d.ts +16 -0
- package/lib/index.js +16 -0
- package/lib/logic.d.ts +68 -0
- package/lib/logic.js +194 -0
- package/lib/navigation.d.ts +139 -0
- package/lib/navigation.js +38 -0
- package/lib/pack.d.ts +933 -0
- package/lib/pack.js +29 -0
- package/lib/pins.d.ts +19 -0
- package/lib/pins.js +35 -0
- package/lib/plugin/contract.d.ts +111 -0
- package/lib/plugin/contract.js +1 -0
- package/lib/plugin/index.d.ts +3 -0
- package/lib/plugin/index.js +9 -0
- package/lib/plugin/sandbox-guest.d.ts +12 -0
- package/lib/plugin/sandbox-guest.js +128 -0
- package/lib/plugin/seqlock.d.ts +8 -0
- package/lib/plugin/seqlock.js +19 -0
- package/lib/plugin-manifest.d.ts +131 -0
- package/lib/plugin-manifest.js +54 -0
- package/lib/plugins-api.d.ts +445 -0
- package/lib/plugins-api.js +38 -0
- package/lib/registry.d.ts +2231 -0
- package/lib/registry.js +170 -0
- package/lib/sandbox-protocol.d.ts +1363 -0
- package/lib/sandbox-protocol.js +39 -0
- package/lib/status.d.ts +24 -0
- package/lib/status.js +75 -0
- package/lib/types.d.ts +2684 -0
- package/lib/types.js +282 -0
- package/lib/views.d.ts +204 -0
- package/lib/views.js +35 -0
- package/package.json +53 -3
package/lib/types.js
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PackViewsSchema } from './views.js';
|
|
3
|
+
export const GameCapabilitySchema = z.enum([
|
|
4
|
+
'location',
|
|
5
|
+
'map_2d',
|
|
6
|
+
'objectives',
|
|
7
|
+
'inventory',
|
|
8
|
+
'stats',
|
|
9
|
+
'chat_chips',
|
|
10
|
+
]);
|
|
11
|
+
export const GamePhaseSchema = z.enum([
|
|
12
|
+
'title',
|
|
13
|
+
'menu',
|
|
14
|
+
'loading',
|
|
15
|
+
'cutscene',
|
|
16
|
+
'in_stage',
|
|
17
|
+
'paused',
|
|
18
|
+
]);
|
|
19
|
+
export const ObjectiveStatusSchema = z.enum(['incomplete', 'complete', 'failed']);
|
|
20
|
+
export const ObjectiveProgressSchema = z.object({
|
|
21
|
+
current: z.number().int().nonnegative(),
|
|
22
|
+
target: z.number().int().positive(),
|
|
23
|
+
});
|
|
24
|
+
export const Position3DSchema = z.object({
|
|
25
|
+
x: z.number().finite(),
|
|
26
|
+
y: z.number().finite(),
|
|
27
|
+
z: z.number().finite(),
|
|
28
|
+
headingDeg: z.number().finite(),
|
|
29
|
+
roomId: z.number().int().optional(),
|
|
30
|
+
});
|
|
31
|
+
export const EnemyActorSchema = z.object({
|
|
32
|
+
id: z.string(),
|
|
33
|
+
label: z.string(),
|
|
34
|
+
x: z.number().finite(),
|
|
35
|
+
y: z.number().finite(),
|
|
36
|
+
z: z.number().finite(),
|
|
37
|
+
headingDeg: z.number().finite().optional(),
|
|
38
|
+
roomId: z.number().int().optional(),
|
|
39
|
+
});
|
|
40
|
+
export const NpcActorSchema = EnemyActorSchema;
|
|
41
|
+
export const ProvenanceSchema = z.object({
|
|
42
|
+
source: z.enum(['ram', 'save', 'socket']),
|
|
43
|
+
asOf: z.number(),
|
|
44
|
+
frame: z.number().int().optional(),
|
|
45
|
+
});
|
|
46
|
+
export const GameStateSchema = z.object({
|
|
47
|
+
phase: GamePhaseSchema,
|
|
48
|
+
provenance: ProvenanceSchema,
|
|
49
|
+
locationId: z.string(),
|
|
50
|
+
difficulty: z.string().optional(),
|
|
51
|
+
variant: z.enum(['vanilla', 'master_quest', 'randomizer']).optional(),
|
|
52
|
+
position: Position3DSchema.nullable(),
|
|
53
|
+
enemies: z.array(EnemyActorSchema).optional(),
|
|
54
|
+
npcs: z.array(NpcActorSchema).optional(),
|
|
55
|
+
/** @deprecated v1 bag of numbers; packs emit `counters` + `flagSets`. Kept while old wrappers run. */
|
|
56
|
+
stats: z.record(z.string(), z.number()).optional(),
|
|
57
|
+
/** v2: named numbers (hearts, keys, capacities) read by `{ counter }` conditions. */
|
|
58
|
+
counters: z.record(z.string(), z.number()).optional(),
|
|
59
|
+
/** v2: bitsets as byte arrays (e.g. `gs`, `chest:85`) read by `{ bit }` conditions. */
|
|
60
|
+
flagSets: z.record(z.string(), z.array(z.number().int().min(0).max(255))).optional(),
|
|
61
|
+
inventory: z.array(z.string()),
|
|
62
|
+
equipped: z.string().nullable().optional(),
|
|
63
|
+
objectives: z.record(z.string(), ObjectiveStatusSchema),
|
|
64
|
+
objectiveProgress: z.record(z.string(), ObjectiveProgressSchema).optional(),
|
|
65
|
+
flags: z.record(z.string(), z.boolean()),
|
|
66
|
+
});
|
|
67
|
+
export const SessionEventSchema = z.object({
|
|
68
|
+
id: z.string(),
|
|
69
|
+
timestamp: z.number(),
|
|
70
|
+
gameId: z.string(),
|
|
71
|
+
kind: z.enum([
|
|
72
|
+
'stage_entered',
|
|
73
|
+
'objective_completed',
|
|
74
|
+
'objective_failed',
|
|
75
|
+
'item_gained',
|
|
76
|
+
'flag_triggered',
|
|
77
|
+
]),
|
|
78
|
+
key: z.string(),
|
|
79
|
+
detail: z.string().optional(),
|
|
80
|
+
});
|
|
81
|
+
// --- Sequenced Wire Protocol (H7, C4) ---
|
|
82
|
+
export const SpotlightTargetSchema = z.object({
|
|
83
|
+
objectiveId: z.string().optional(),
|
|
84
|
+
landmarkId: z.string().optional(),
|
|
85
|
+
label: z.string().optional(),
|
|
86
|
+
clear: z.boolean().optional(),
|
|
87
|
+
});
|
|
88
|
+
export const MapTrailWaypointSchema = z.object({
|
|
89
|
+
landmarkId: z.string().optional(),
|
|
90
|
+
world: z.tuple([z.number(), z.number(), z.number()]),
|
|
91
|
+
label: z.string().optional(),
|
|
92
|
+
layerId: z.string().optional(),
|
|
93
|
+
});
|
|
94
|
+
export const MapTrailSchema = z.object({
|
|
95
|
+
label: z.string(),
|
|
96
|
+
objectiveId: z.string().optional(),
|
|
97
|
+
nudgeOnly: z.boolean().optional(),
|
|
98
|
+
waypoints: z.array(MapTrailWaypointSchema),
|
|
99
|
+
});
|
|
100
|
+
export const ServerLlmTelemetrySchema = z.object({
|
|
101
|
+
requests: z.number().int().nonnegative(),
|
|
102
|
+
fastRequests: z.number().int().nonnegative(),
|
|
103
|
+
fallbacks: z.number().int().nonnegative(),
|
|
104
|
+
errors: z.number().int().nonnegative(),
|
|
105
|
+
lastModelUsed: z.string().optional(),
|
|
106
|
+
lastFallbackAt: z.number().optional(),
|
|
107
|
+
});
|
|
108
|
+
export const ServerLlmQuotaSchema = z.object({
|
|
109
|
+
status: z.enum(['unknown', 'allowed', 'warning', 'rate_limited']),
|
|
110
|
+
utilization5h: z.number().nonnegative().optional(),
|
|
111
|
+
reset5hAt: z.number().optional(),
|
|
112
|
+
utilization7d: z.number().nonnegative().optional(),
|
|
113
|
+
reset7dAt: z.number().optional(),
|
|
114
|
+
blockedUntil: z.number().optional(),
|
|
115
|
+
limitingWindow: z.string().optional(),
|
|
116
|
+
checkedAt: z.number().optional(),
|
|
117
|
+
});
|
|
118
|
+
export const ServerLlmStatusSchema = z.object({
|
|
119
|
+
available: z.boolean(),
|
|
120
|
+
provider: z.string().optional(),
|
|
121
|
+
model: z.string().optional(),
|
|
122
|
+
account: z.string().optional(),
|
|
123
|
+
telemetry: ServerLlmTelemetrySchema.optional(),
|
|
124
|
+
quota: ServerLlmQuotaSchema.optional(),
|
|
125
|
+
});
|
|
126
|
+
export const CustomMapPinSchema = z.object({
|
|
127
|
+
id: z.string().min(1).max(80),
|
|
128
|
+
locationId: z.string().min(1).max(80),
|
|
129
|
+
layerId: z.string().min(1).max(80),
|
|
130
|
+
u: z.number().finite(),
|
|
131
|
+
v: z.number().finite(),
|
|
132
|
+
world: z.tuple([z.number().finite(), z.number().finite(), z.number().finite()]),
|
|
133
|
+
label: z.string().min(1).max(120),
|
|
134
|
+
note: z.string().max(400).optional(),
|
|
135
|
+
createdAt: z.number(),
|
|
136
|
+
});
|
|
137
|
+
export const ClientWsMessageSchema = z.discriminatedUnion('type', [
|
|
138
|
+
z.object({
|
|
139
|
+
type: z.literal('auth'),
|
|
140
|
+
token: z.string().optional(),
|
|
141
|
+
lastSessionId: z.string().optional(),
|
|
142
|
+
lastSeq: z.number().int().optional(),
|
|
143
|
+
}),
|
|
144
|
+
z.object({
|
|
145
|
+
type: z.literal('resync'),
|
|
146
|
+
}),
|
|
147
|
+
z.object({
|
|
148
|
+
type: z.literal('spotlight'),
|
|
149
|
+
objectiveId: z.string().optional(),
|
|
150
|
+
landmarkId: z.string().optional(),
|
|
151
|
+
label: z.string().optional(),
|
|
152
|
+
clear: z.boolean().optional(),
|
|
153
|
+
}),
|
|
154
|
+
z.object({
|
|
155
|
+
type: z.literal('trail'),
|
|
156
|
+
trail: MapTrailSchema.nullable(),
|
|
157
|
+
}),
|
|
158
|
+
z.object({
|
|
159
|
+
type: z.literal('pin:done'),
|
|
160
|
+
gameId: z.string(),
|
|
161
|
+
pinKey: z.string(),
|
|
162
|
+
done: z.boolean(),
|
|
163
|
+
}),
|
|
164
|
+
z.object({
|
|
165
|
+
type: z.literal('pin:resetGame'),
|
|
166
|
+
gameId: z.string(),
|
|
167
|
+
}),
|
|
168
|
+
z.object({
|
|
169
|
+
type: z.literal('pin:custom:upsert'),
|
|
170
|
+
gameId: z.string(),
|
|
171
|
+
pin: CustomMapPinSchema,
|
|
172
|
+
}),
|
|
173
|
+
z.object({
|
|
174
|
+
type: z.literal('pin:custom:delete'),
|
|
175
|
+
gameId: z.string(),
|
|
176
|
+
pinId: z.string(),
|
|
177
|
+
}),
|
|
178
|
+
]);
|
|
179
|
+
export const ServerWsMessageSchema = z.discriminatedUnion('type', [
|
|
180
|
+
/** A running game GameSlate can't read (e.g. an unverified build), or null once it's gone. */
|
|
181
|
+
z.object({ type: z.literal('game:unsupported'), detail: z.string().nullable() }),
|
|
182
|
+
z.object({
|
|
183
|
+
type: z.literal('hello'),
|
|
184
|
+
protocolVersion: z.literal(1),
|
|
185
|
+
sessionId: z.string(),
|
|
186
|
+
seq: z.number().int(),
|
|
187
|
+
hostname: z.string(),
|
|
188
|
+
activeGameId: z.string().nullable(),
|
|
189
|
+
stateSchemaVersion: z.number().int().nullable(),
|
|
190
|
+
unsupportedBuild: z.string().nullable().optional(),
|
|
191
|
+
connectedClients: z.number().int().nonnegative().optional(),
|
|
192
|
+
recentEvents: z.array(SessionEventSchema).optional(),
|
|
193
|
+
activeSpotlight: SpotlightTargetSchema.nullable().optional(),
|
|
194
|
+
activeTrail: MapTrailSchema.nullable().optional(),
|
|
195
|
+
completedPins: z.record(z.string(), z.array(z.string())).optional(),
|
|
196
|
+
customPins: z.record(z.string(), z.array(CustomMapPinSchema)).optional(),
|
|
197
|
+
serverLlm: ServerLlmStatusSchema.optional(),
|
|
198
|
+
lastSession: z
|
|
199
|
+
.object({
|
|
200
|
+
gameId: z.string(),
|
|
201
|
+
state: GameStateSchema,
|
|
202
|
+
})
|
|
203
|
+
.nullable()
|
|
204
|
+
.optional(),
|
|
205
|
+
}),
|
|
206
|
+
z.object({
|
|
207
|
+
type: z.literal('state:full'),
|
|
208
|
+
sessionId: z.string(),
|
|
209
|
+
seq: z.number().int(),
|
|
210
|
+
timestamp: z.number(),
|
|
211
|
+
gameId: z.string(),
|
|
212
|
+
stateSchemaVersion: z.number().int(),
|
|
213
|
+
capabilities: z.array(GameCapabilitySchema),
|
|
214
|
+
state: GameStateSchema,
|
|
215
|
+
}),
|
|
216
|
+
/** An extraction job wrote new local assets for this game: reload them. */
|
|
217
|
+
z.object({ type: z.literal('assets:updated'), gameId: z.string() }),
|
|
218
|
+
/** The running (or last) game's computed views, sent whenever they change. */
|
|
219
|
+
z.object({
|
|
220
|
+
type: z.literal('pack:views'),
|
|
221
|
+
gameId: z.string(),
|
|
222
|
+
views: PackViewsSchema,
|
|
223
|
+
}),
|
|
224
|
+
z.object({
|
|
225
|
+
type: z.literal('state:patch'),
|
|
226
|
+
sessionId: z.string(),
|
|
227
|
+
seq: z.number().int(),
|
|
228
|
+
baseSeq: z.number().int(),
|
|
229
|
+
timestamp: z.number(),
|
|
230
|
+
gameId: z.string(),
|
|
231
|
+
patch: GameStateSchema.partial(),
|
|
232
|
+
}),
|
|
233
|
+
z.object({
|
|
234
|
+
type: z.literal('event'),
|
|
235
|
+
sessionId: z.string(),
|
|
236
|
+
seq: z.number().int(),
|
|
237
|
+
event: SessionEventSchema,
|
|
238
|
+
}),
|
|
239
|
+
z.object({
|
|
240
|
+
type: z.literal('ui:spotlight'),
|
|
241
|
+
timestamp: z.number(),
|
|
242
|
+
target: SpotlightTargetSchema.nullable(),
|
|
243
|
+
}),
|
|
244
|
+
z.object({
|
|
245
|
+
type: z.literal('ui:trail'),
|
|
246
|
+
timestamp: z.number(),
|
|
247
|
+
trail: MapTrailSchema.nullable(),
|
|
248
|
+
}),
|
|
249
|
+
z.object({
|
|
250
|
+
type: z.literal('ui:completedPins'),
|
|
251
|
+
timestamp: z.number(),
|
|
252
|
+
completedPins: z.record(z.string(), z.array(z.string())),
|
|
253
|
+
}),
|
|
254
|
+
z.object({
|
|
255
|
+
type: z.literal('ui:customPins'),
|
|
256
|
+
timestamp: z.number(),
|
|
257
|
+
customPins: z.record(z.string(), z.array(CustomMapPinSchema)),
|
|
258
|
+
}),
|
|
259
|
+
z.object({
|
|
260
|
+
type: z.literal('game:stopped'),
|
|
261
|
+
sessionId: z.string(),
|
|
262
|
+
seq: z.number().int(),
|
|
263
|
+
timestamp: z.number(),
|
|
264
|
+
gameId: z.string(),
|
|
265
|
+
}),
|
|
266
|
+
z.object({
|
|
267
|
+
type: z.literal('heartbeat'),
|
|
268
|
+
sessionId: z.string(),
|
|
269
|
+
seq: z.number().int(),
|
|
270
|
+
timestamp: z.number(),
|
|
271
|
+
connectedClients: z.number().int().nonnegative().optional(),
|
|
272
|
+
}),
|
|
273
|
+
z.object({
|
|
274
|
+
type: z.literal('daemon:shutdown'),
|
|
275
|
+
timestamp: z.number(),
|
|
276
|
+
}),
|
|
277
|
+
z.object({
|
|
278
|
+
type: z.literal('error'),
|
|
279
|
+
code: z.enum(['unauthorized', 'bad_request']),
|
|
280
|
+
message: z.string(),
|
|
281
|
+
}),
|
|
282
|
+
]);
|
package/lib/views.d.ts
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const StatusStripViewSchema: z.ZodObject<{
|
|
3
|
+
label: z.ZodString;
|
|
4
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
5
|
+
right: z.ZodOptional<z.ZodString>;
|
|
6
|
+
/** 0..100 */
|
|
7
|
+
progressPct: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
tone: z.ZodOptional<z.ZodEnum<["normal", "warning"]>>;
|
|
9
|
+
icon: z.ZodOptional<z.ZodEnum<["day", "night"]>>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
label: string;
|
|
12
|
+
detail?: string | undefined;
|
|
13
|
+
right?: string | undefined;
|
|
14
|
+
progressPct?: number | undefined;
|
|
15
|
+
tone?: "normal" | "warning" | undefined;
|
|
16
|
+
icon?: "day" | "night" | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
label: string;
|
|
19
|
+
detail?: string | undefined;
|
|
20
|
+
right?: string | undefined;
|
|
21
|
+
progressPct?: number | undefined;
|
|
22
|
+
tone?: "normal" | "warning" | undefined;
|
|
23
|
+
icon?: "day" | "night" | undefined;
|
|
24
|
+
}>;
|
|
25
|
+
export type StatusStripView = z.infer<typeof StatusStripViewSchema>;
|
|
26
|
+
export declare const TimelineViewSchema: z.ZodObject<{
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
title: z.ZodString;
|
|
29
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
30
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
31
|
+
id: z.ZodString;
|
|
32
|
+
title: z.ZodString;
|
|
33
|
+
when: z.ZodString;
|
|
34
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
35
|
+
status: z.ZodEnum<["done", "now", "soon", "later", "missed"]>;
|
|
36
|
+
ask: z.ZodOptional<z.ZodString>;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
status: "done" | "now" | "soon" | "later" | "missed";
|
|
39
|
+
id: string;
|
|
40
|
+
title: string;
|
|
41
|
+
when: string;
|
|
42
|
+
detail?: string | undefined;
|
|
43
|
+
ask?: string | undefined;
|
|
44
|
+
}, {
|
|
45
|
+
status: "done" | "now" | "soon" | "later" | "missed";
|
|
46
|
+
id: string;
|
|
47
|
+
title: string;
|
|
48
|
+
when: string;
|
|
49
|
+
detail?: string | undefined;
|
|
50
|
+
ask?: string | undefined;
|
|
51
|
+
}>, "many">;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
entries: {
|
|
54
|
+
status: "done" | "now" | "soon" | "later" | "missed";
|
|
55
|
+
id: string;
|
|
56
|
+
title: string;
|
|
57
|
+
when: string;
|
|
58
|
+
detail?: string | undefined;
|
|
59
|
+
ask?: string | undefined;
|
|
60
|
+
}[];
|
|
61
|
+
id: string;
|
|
62
|
+
title: string;
|
|
63
|
+
subtitle?: string | undefined;
|
|
64
|
+
}, {
|
|
65
|
+
entries: {
|
|
66
|
+
status: "done" | "now" | "soon" | "later" | "missed";
|
|
67
|
+
id: string;
|
|
68
|
+
title: string;
|
|
69
|
+
when: string;
|
|
70
|
+
detail?: string | undefined;
|
|
71
|
+
ask?: string | undefined;
|
|
72
|
+
}[];
|
|
73
|
+
id: string;
|
|
74
|
+
title: string;
|
|
75
|
+
subtitle?: string | undefined;
|
|
76
|
+
}>;
|
|
77
|
+
export type TimelineView = z.infer<typeof TimelineViewSchema>;
|
|
78
|
+
export declare const PackViewsSchema: z.ZodObject<{
|
|
79
|
+
/** facts about the live state for the AI prompt (plain sentences/phrases) */
|
|
80
|
+
facts: z.ZodArray<z.ZodString, "many">;
|
|
81
|
+
/** a thin status strip under the tab bar (e.g. MM's clock and Moonfall countdown) */
|
|
82
|
+
statusStrip: z.ZodNullable<z.ZodObject<{
|
|
83
|
+
label: z.ZodString;
|
|
84
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
85
|
+
right: z.ZodOptional<z.ZodString>;
|
|
86
|
+
/** 0..100 */
|
|
87
|
+
progressPct: z.ZodOptional<z.ZodNumber>;
|
|
88
|
+
tone: z.ZodOptional<z.ZodEnum<["normal", "warning"]>>;
|
|
89
|
+
icon: z.ZodOptional<z.ZodEnum<["day", "night"]>>;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
label: string;
|
|
92
|
+
detail?: string | undefined;
|
|
93
|
+
right?: string | undefined;
|
|
94
|
+
progressPct?: number | undefined;
|
|
95
|
+
tone?: "normal" | "warning" | undefined;
|
|
96
|
+
icon?: "day" | "night" | undefined;
|
|
97
|
+
}, {
|
|
98
|
+
label: string;
|
|
99
|
+
detail?: string | undefined;
|
|
100
|
+
right?: string | undefined;
|
|
101
|
+
progressPct?: number | undefined;
|
|
102
|
+
tone?: "normal" | "warning" | undefined;
|
|
103
|
+
icon?: "day" | "night" | undefined;
|
|
104
|
+
}>>;
|
|
105
|
+
/** named timelines under Missions → side (e.g. the Bombers' Notebook schedule) */
|
|
106
|
+
timelines: z.ZodArray<z.ZodObject<{
|
|
107
|
+
id: z.ZodString;
|
|
108
|
+
title: z.ZodString;
|
|
109
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
110
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
111
|
+
id: z.ZodString;
|
|
112
|
+
title: z.ZodString;
|
|
113
|
+
when: z.ZodString;
|
|
114
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
115
|
+
status: z.ZodEnum<["done", "now", "soon", "later", "missed"]>;
|
|
116
|
+
ask: z.ZodOptional<z.ZodString>;
|
|
117
|
+
}, "strip", z.ZodTypeAny, {
|
|
118
|
+
status: "done" | "now" | "soon" | "later" | "missed";
|
|
119
|
+
id: string;
|
|
120
|
+
title: string;
|
|
121
|
+
when: string;
|
|
122
|
+
detail?: string | undefined;
|
|
123
|
+
ask?: string | undefined;
|
|
124
|
+
}, {
|
|
125
|
+
status: "done" | "now" | "soon" | "later" | "missed";
|
|
126
|
+
id: string;
|
|
127
|
+
title: string;
|
|
128
|
+
when: string;
|
|
129
|
+
detail?: string | undefined;
|
|
130
|
+
ask?: string | undefined;
|
|
131
|
+
}>, "many">;
|
|
132
|
+
}, "strip", z.ZodTypeAny, {
|
|
133
|
+
entries: {
|
|
134
|
+
status: "done" | "now" | "soon" | "later" | "missed";
|
|
135
|
+
id: string;
|
|
136
|
+
title: string;
|
|
137
|
+
when: string;
|
|
138
|
+
detail?: string | undefined;
|
|
139
|
+
ask?: string | undefined;
|
|
140
|
+
}[];
|
|
141
|
+
id: string;
|
|
142
|
+
title: string;
|
|
143
|
+
subtitle?: string | undefined;
|
|
144
|
+
}, {
|
|
145
|
+
entries: {
|
|
146
|
+
status: "done" | "now" | "soon" | "later" | "missed";
|
|
147
|
+
id: string;
|
|
148
|
+
title: string;
|
|
149
|
+
when: string;
|
|
150
|
+
detail?: string | undefined;
|
|
151
|
+
ask?: string | undefined;
|
|
152
|
+
}[];
|
|
153
|
+
id: string;
|
|
154
|
+
title: string;
|
|
155
|
+
subtitle?: string | undefined;
|
|
156
|
+
}>, "many">;
|
|
157
|
+
}, "strip", z.ZodTypeAny, {
|
|
158
|
+
facts: string[];
|
|
159
|
+
statusStrip: {
|
|
160
|
+
label: string;
|
|
161
|
+
detail?: string | undefined;
|
|
162
|
+
right?: string | undefined;
|
|
163
|
+
progressPct?: number | undefined;
|
|
164
|
+
tone?: "normal" | "warning" | undefined;
|
|
165
|
+
icon?: "day" | "night" | undefined;
|
|
166
|
+
} | null;
|
|
167
|
+
timelines: {
|
|
168
|
+
entries: {
|
|
169
|
+
status: "done" | "now" | "soon" | "later" | "missed";
|
|
170
|
+
id: string;
|
|
171
|
+
title: string;
|
|
172
|
+
when: string;
|
|
173
|
+
detail?: string | undefined;
|
|
174
|
+
ask?: string | undefined;
|
|
175
|
+
}[];
|
|
176
|
+
id: string;
|
|
177
|
+
title: string;
|
|
178
|
+
subtitle?: string | undefined;
|
|
179
|
+
}[];
|
|
180
|
+
}, {
|
|
181
|
+
facts: string[];
|
|
182
|
+
statusStrip: {
|
|
183
|
+
label: string;
|
|
184
|
+
detail?: string | undefined;
|
|
185
|
+
right?: string | undefined;
|
|
186
|
+
progressPct?: number | undefined;
|
|
187
|
+
tone?: "normal" | "warning" | undefined;
|
|
188
|
+
icon?: "day" | "night" | undefined;
|
|
189
|
+
} | null;
|
|
190
|
+
timelines: {
|
|
191
|
+
entries: {
|
|
192
|
+
status: "done" | "now" | "soon" | "later" | "missed";
|
|
193
|
+
id: string;
|
|
194
|
+
title: string;
|
|
195
|
+
when: string;
|
|
196
|
+
detail?: string | undefined;
|
|
197
|
+
ask?: string | undefined;
|
|
198
|
+
}[];
|
|
199
|
+
id: string;
|
|
200
|
+
title: string;
|
|
201
|
+
subtitle?: string | undefined;
|
|
202
|
+
}[];
|
|
203
|
+
}>;
|
|
204
|
+
export type PackViews = z.infer<typeof PackViewsSchema>;
|
package/lib/views.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/*
|
|
3
|
+
* Views a pack computes from the live state. The daemon runs the pack's code and streams the result
|
|
4
|
+
* (`pack:views`), so the web app renders them without running any game code.
|
|
5
|
+
*/
|
|
6
|
+
export const StatusStripViewSchema = z.object({
|
|
7
|
+
label: z.string(),
|
|
8
|
+
detail: z.string().optional(),
|
|
9
|
+
right: z.string().optional(),
|
|
10
|
+
/** 0..100 */
|
|
11
|
+
progressPct: z.number().min(0).max(100).optional(),
|
|
12
|
+
tone: z.enum(['normal', 'warning']).optional(),
|
|
13
|
+
icon: z.enum(['day', 'night']).optional(),
|
|
14
|
+
});
|
|
15
|
+
export const TimelineViewSchema = z.object({
|
|
16
|
+
id: z.string(),
|
|
17
|
+
title: z.string(),
|
|
18
|
+
subtitle: z.string().optional(),
|
|
19
|
+
entries: z.array(z.object({
|
|
20
|
+
id: z.string(),
|
|
21
|
+
title: z.string(),
|
|
22
|
+
when: z.string(),
|
|
23
|
+
detail: z.string().optional(),
|
|
24
|
+
status: z.enum(['done', 'now', 'soon', 'later', 'missed']),
|
|
25
|
+
ask: z.string().optional(),
|
|
26
|
+
})),
|
|
27
|
+
});
|
|
28
|
+
export const PackViewsSchema = z.object({
|
|
29
|
+
/** facts about the live state for the AI prompt (plain sentences/phrases) */
|
|
30
|
+
facts: z.array(z.string()),
|
|
31
|
+
/** a thin status strip under the tab bar (e.g. MM's clock and Moonfall countdown) */
|
|
32
|
+
statusStrip: StatusStripViewSchema.nullable(),
|
|
33
|
+
/** named timelines under Missions → side (e.g. the Bombers' Notebook schedule) */
|
|
34
|
+
timelines: z.array(TimelineViewSchema),
|
|
35
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gameslate/sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.3.0",
|
|
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
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"gameslate",
|
|
9
|
+
"game",
|
|
10
|
+
"companion",
|
|
11
|
+
"plugin",
|
|
12
|
+
"second-screen"
|
|
13
|
+
],
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./lib/index.d.ts",
|
|
17
|
+
"default": "./lib/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./plugin": {
|
|
20
|
+
"types": "./lib/plugin/index.d.ts",
|
|
21
|
+
"default": "./lib/plugin/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./build": "./build/build-plugin.mjs"
|
|
24
|
+
},
|
|
25
|
+
"bin": {
|
|
26
|
+
"gameslate-plugin": "./bin/gameslate-plugin.mjs"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"lib",
|
|
30
|
+
"build",
|
|
31
|
+
"bin",
|
|
32
|
+
"README.md",
|
|
33
|
+
"LICENSE"
|
|
34
|
+
],
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public",
|
|
37
|
+
"exports": {
|
|
38
|
+
".": {
|
|
39
|
+
"types": "./lib/index.d.ts",
|
|
40
|
+
"default": "./lib/index.js"
|
|
41
|
+
},
|
|
42
|
+
"./plugin": {
|
|
43
|
+
"types": "./lib/plugin/index.d.ts",
|
|
44
|
+
"default": "./lib/plugin/index.js"
|
|
45
|
+
},
|
|
46
|
+
"./build": "./build/build-plugin.mjs"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"prepack": "yarn run -T tsc -p tsconfig.publish.json"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"esbuild": "^0.24.0",
|
|
54
|
+
"zod": "^3.24.1"
|
|
55
|
+
}
|
|
6
56
|
}
|