@theaiplatform/miniapp-sdk 0.3.2 → 0.4.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.
@@ -0,0 +1,361 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://the-ai-platform.dev/schemas/tap.test.schema.json",
4
+ "title": "The AI Platform miniapp test descriptor",
5
+ "description": "Strict schema-v2 descriptor for deterministic miniapp test profiles and matrix entries. Required origins, effects, credentials, and capabilities are preflight requirements only and never grant host authority.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "schemaVersion",
10
+ "packageId",
11
+ "configPath",
12
+ "profiles",
13
+ "matrix"
14
+ ],
15
+ "properties": {
16
+ "$schema": {
17
+ "type": "string",
18
+ "const": "https://the-ai-platform.dev/schemas/tap.test.schema.json"
19
+ },
20
+ "schemaVersion": {
21
+ "type": "integer",
22
+ "const": 2
23
+ },
24
+ "packageId": {
25
+ "$ref": "#/$defs/packageId"
26
+ },
27
+ "configPath": {
28
+ "$ref": "#/$defs/confinedPath"
29
+ },
30
+ "testMatch": {
31
+ "$ref": "#/$defs/testMatch"
32
+ },
33
+ "profiles": {
34
+ "type": "object",
35
+ "minProperties": 1,
36
+ "maxProperties": 64,
37
+ "propertyNames": {
38
+ "$ref": "#/$defs/id"
39
+ },
40
+ "additionalProperties": {
41
+ "$ref": "#/$defs/profile"
42
+ }
43
+ },
44
+ "matrix": {
45
+ "type": "array",
46
+ "minItems": 1,
47
+ "maxItems": 256,
48
+ "items": {
49
+ "$ref": "#/$defs/matrixEntry"
50
+ }
51
+ },
52
+ "waivers": {
53
+ "type": "array",
54
+ "maxItems": 128,
55
+ "items": {
56
+ "$ref": "#/$defs/waiver"
57
+ }
58
+ }
59
+ },
60
+ "$defs": {
61
+ "trimmed": {
62
+ "type": "string",
63
+ "minLength": 1,
64
+ "maxLength": 256,
65
+ "pattern": "^\\S(?:.*\\S)?$"
66
+ },
67
+ "id": {
68
+ "type": "string",
69
+ "minLength": 1,
70
+ "maxLength": 128,
71
+ "pattern": "^[a-z0-9][a-z0-9._:-]*$"
72
+ },
73
+ "actionId": {
74
+ "type": "string",
75
+ "minLength": 1,
76
+ "maxLength": 128,
77
+ "pattern": "^(?:\\*|do:\\*|[a-z0-9][a-z0-9._:-]*)$"
78
+ },
79
+ "capabilityId": {
80
+ "type": "string",
81
+ "minLength": 8,
82
+ "maxLength": 2048,
83
+ "pattern": "^(?:action:[a-z0-9][a-z0-9._:-]*|effect:[a-z0-9][a-z0-9._-]*:\\S+)$"
84
+ },
85
+ "effectToken": {
86
+ "type": "string",
87
+ "minLength": 10,
88
+ "maxLength": 2048,
89
+ "pattern": "^effect:[a-z0-9][a-z0-9._-]*:\\S+$"
90
+ },
91
+ "packageId": {
92
+ "type": "string",
93
+ "minLength": 1,
94
+ "maxLength": 256,
95
+ "pattern": "^[A-Za-z0-9@][A-Za-z0-9@/._:-]*$"
96
+ },
97
+ "confinedPath": {
98
+ "type": "string",
99
+ "minLength": 1,
100
+ "maxLength": 1024,
101
+ "pattern": "^(?!/)(?![A-Za-z]:)(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.(?:/|$)).+$"
102
+ },
103
+ "confinedGlob": {
104
+ "type": "string",
105
+ "minLength": 1,
106
+ "maxLength": 1024,
107
+ "pattern": "^(?!/)(?![A-Za-z]:)(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.(?:/|$)).+$"
108
+ },
109
+ "testMatch": {
110
+ "type": "array",
111
+ "minItems": 1,
112
+ "maxItems": 128,
113
+ "uniqueItems": true,
114
+ "items": {
115
+ "$ref": "#/$defs/confinedGlob"
116
+ }
117
+ },
118
+ "stringIdSet": {
119
+ "type": "array",
120
+ "maxItems": 128,
121
+ "uniqueItems": true,
122
+ "items": {
123
+ "$ref": "#/$defs/id"
124
+ }
125
+ },
126
+ "fileSet": {
127
+ "type": "array",
128
+ "maxItems": 64,
129
+ "uniqueItems": true,
130
+ "items": {
131
+ "allOf": [
132
+ {
133
+ "$ref": "#/$defs/confinedPath"
134
+ },
135
+ {
136
+ "type": "string",
137
+ "pattern": "\\.json$"
138
+ }
139
+ ]
140
+ }
141
+ },
142
+ "originSet": {
143
+ "type": "array",
144
+ "maxItems": 128,
145
+ "uniqueItems": true,
146
+ "items": {
147
+ "type": "string",
148
+ "minLength": 8,
149
+ "maxLength": 2048,
150
+ "pattern": "^https?://[^/?#]+$"
151
+ }
152
+ },
153
+ "viewport": {
154
+ "type": "object",
155
+ "additionalProperties": false,
156
+ "required": ["width", "height"],
157
+ "properties": {
158
+ "width": {
159
+ "type": "integer",
160
+ "minimum": 320,
161
+ "maximum": 8192
162
+ },
163
+ "height": {
164
+ "type": "integer",
165
+ "minimum": 200,
166
+ "maximum": 8192
167
+ }
168
+ }
169
+ },
170
+ "environment": {
171
+ "type": "object",
172
+ "additionalProperties": false,
173
+ "required": [
174
+ "viewport",
175
+ "locale",
176
+ "timezone",
177
+ "theme",
178
+ "reducedMotion",
179
+ "seed"
180
+ ],
181
+ "properties": {
182
+ "viewport": {
183
+ "$ref": "#/$defs/viewport"
184
+ },
185
+ "locale": {
186
+ "type": "string",
187
+ "minLength": 2,
188
+ "maxLength": 64,
189
+ "pattern": "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$"
190
+ },
191
+ "timezone": {
192
+ "type": "string",
193
+ "minLength": 1,
194
+ "maxLength": 128
195
+ },
196
+ "theme": {
197
+ "enum": ["light", "dark"]
198
+ },
199
+ "reducedMotion": {
200
+ "type": "boolean"
201
+ },
202
+ "seed": {
203
+ "type": "integer",
204
+ "minimum": 0,
205
+ "maximum": 4294967295
206
+ },
207
+ "fixedNow": {
208
+ "type": "string",
209
+ "minLength": 20,
210
+ "maxLength": 64,
211
+ "format": "date-time",
212
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?Z$"
213
+ }
214
+ }
215
+ },
216
+ "capturePolicy": {
217
+ "enum": ["off", "failure-only", "always"]
218
+ },
219
+ "artifacts": {
220
+ "type": "object",
221
+ "additionalProperties": false,
222
+ "required": ["trace", "screenshots"],
223
+ "properties": {
224
+ "trace": {
225
+ "$ref": "#/$defs/capturePolicy"
226
+ },
227
+ "screenshots": {
228
+ "$ref": "#/$defs/capturePolicy"
229
+ },
230
+ "maxBytes": {
231
+ "type": "integer",
232
+ "minimum": 1024,
233
+ "maximum": 67108864
234
+ }
235
+ }
236
+ },
237
+ "profile": {
238
+ "type": "object",
239
+ "additionalProperties": false,
240
+ "required": [
241
+ "surface",
242
+ "target",
243
+ "mode",
244
+ "permissionScenario",
245
+ "environment",
246
+ "artifacts"
247
+ ],
248
+ "properties": {
249
+ "surface": {
250
+ "$ref": "#/$defs/id"
251
+ },
252
+ "target": {
253
+ "enum": [
254
+ "desktop",
255
+ "mobile",
256
+ "quickjs",
257
+ "worker",
258
+ "node",
259
+ "workflow-host"
260
+ ]
261
+ },
262
+ "mode": {
263
+ "enum": ["surface", "live"]
264
+ },
265
+ "permissionScenario": {
266
+ "$ref": "#/$defs/id"
267
+ },
268
+ "deniedActions": {
269
+ "type": "array",
270
+ "maxItems": 128,
271
+ "uniqueItems": true,
272
+ "items": {
273
+ "$ref": "#/$defs/actionId"
274
+ }
275
+ },
276
+ "fixtureFiles": {
277
+ "$ref": "#/$defs/fileSet"
278
+ },
279
+ "httpRouteFiles": {
280
+ "$ref": "#/$defs/fileSet"
281
+ },
282
+ "requiredOrigins": {
283
+ "$ref": "#/$defs/originSet"
284
+ },
285
+ "requiredEffects": {
286
+ "type": "array",
287
+ "maxItems": 128,
288
+ "uniqueItems": true,
289
+ "items": {
290
+ "$ref": "#/$defs/effectToken"
291
+ }
292
+ },
293
+ "credentialSlots": {
294
+ "type": "array",
295
+ "maxItems": 64,
296
+ "uniqueItems": true,
297
+ "items": {
298
+ "$ref": "#/$defs/id"
299
+ }
300
+ },
301
+ "environment": {
302
+ "$ref": "#/$defs/environment"
303
+ },
304
+ "artifacts": {
305
+ "$ref": "#/$defs/artifacts"
306
+ }
307
+ }
308
+ },
309
+ "matrixEntry": {
310
+ "type": "object",
311
+ "additionalProperties": false,
312
+ "required": ["id", "profile"],
313
+ "properties": {
314
+ "id": {
315
+ "$ref": "#/$defs/id"
316
+ },
317
+ "profile": {
318
+ "$ref": "#/$defs/id"
319
+ },
320
+ "testMatch": {
321
+ "$ref": "#/$defs/testMatch"
322
+ },
323
+ "capabilities": {
324
+ "type": "array",
325
+ "maxItems": 128,
326
+ "uniqueItems": true,
327
+ "items": {
328
+ "$ref": "#/$defs/capabilityId"
329
+ }
330
+ }
331
+ }
332
+ },
333
+ "waiver": {
334
+ "type": "object",
335
+ "additionalProperties": false,
336
+ "required": ["capability", "reason"],
337
+ "properties": {
338
+ "capability": {
339
+ "$ref": "#/$defs/capabilityId"
340
+ },
341
+ "reason": {
342
+ "type": "string",
343
+ "minLength": 1,
344
+ "maxLength": 2048,
345
+ "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
346
+ },
347
+ "issue": {
348
+ "type": "string",
349
+ "minLength": 8,
350
+ "maxLength": 2048,
351
+ "format": "uri"
352
+ },
353
+ "expiresAt": {
354
+ "type": "string",
355
+ "maxLength": 64,
356
+ "format": "date-time"
357
+ }
358
+ }
359
+ }
360
+ }
361
+ }