@ai-ecoverse/slicc-browsers 1.4.0 → 1.6.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.
@@ -150,6 +150,7 @@
150
150
  "originScheme": { "const": "https" },
151
151
  "originHostPattern": { "type": "string", "format": "regex" },
152
152
  "excludedLabels": { "$ref": "#/$defs/names" },
153
+ "excludedLabelPrefixes": { "$ref": "#/$defs/names", "default": [] },
153
154
  "sitePattern": { "$ref": "#/$defs/name" },
154
155
  "switches": { "type": "array", "items": { "type": "string", "pattern": "^--" } },
155
156
  "disabledFeatures": { "$ref": "#/$defs/names" },
@@ -0,0 +1,581 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/ai-ecoverse/slicc-browsers/schema/guard-vectors.schema.json",
4
+ "title": "slicc-browsers guard vectors, schema 1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schemaVersion",
9
+ "setVersion",
10
+ "sources",
11
+ "targets",
12
+ "variants",
13
+ "capabilities",
14
+ "placeholders",
15
+ "vectors"
16
+ ],
17
+ "properties": {
18
+ "schemaVersion": {
19
+ "const": 1
20
+ },
21
+ "setVersion": {
22
+ "type": "string",
23
+ "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$"
24
+ },
25
+ "sources": {
26
+ "type": "array",
27
+ "items": {
28
+ "type": "object",
29
+ "additionalProperties": false,
30
+ "required": ["repo", "ref", "path"],
31
+ "properties": {
32
+ "repo": {
33
+ "type": "string",
34
+ "minLength": 1
35
+ },
36
+ "ref": {
37
+ "type": "string",
38
+ "minLength": 1
39
+ },
40
+ "path": {
41
+ "type": "string",
42
+ "minLength": 1
43
+ }
44
+ }
45
+ }
46
+ },
47
+ "targets": {
48
+ "type": "object",
49
+ "required": ["seven", "vault", "vault-x", "apex", "own", "ordinary", "ordinary-same-site"],
50
+ "additionalProperties": {
51
+ "type": "object",
52
+ "additionalProperties": false,
53
+ "required": ["description"],
54
+ "properties": {
55
+ "host": {
56
+ "type": "string",
57
+ "pattern": "^[a-z0-9.-]+$"
58
+ },
59
+ "description": {
60
+ "type": "string",
61
+ "minLength": 1
62
+ }
63
+ }
64
+ }
65
+ },
66
+ "variants": {
67
+ "type": "object",
68
+ "required": ["prompt", "lagging"],
69
+ "propertyNames": {
70
+ "pattern": "^[a-z0-9-]+$"
71
+ },
72
+ "additionalProperties": {
73
+ "type": "integer",
74
+ "minimum": 0
75
+ }
76
+ },
77
+ "capabilities": {
78
+ "type": "object",
79
+ "additionalProperties": false,
80
+ "required": ["autoAttach", "browserSession", "browserContexts"],
81
+ "properties": {
82
+ "autoAttach": {
83
+ "type": "string",
84
+ "minLength": 1
85
+ },
86
+ "browserSession": {
87
+ "type": "string",
88
+ "minLength": 1
89
+ },
90
+ "browserContexts": {
91
+ "type": "string",
92
+ "minLength": 1
93
+ }
94
+ }
95
+ },
96
+ "placeholders": {
97
+ "type": "object",
98
+ "propertyNames": {
99
+ "pattern": "^[A-Za-z][A-Za-z-]*$"
100
+ },
101
+ "additionalProperties": {
102
+ "type": "string",
103
+ "minLength": 1
104
+ }
105
+ },
106
+ "vectors": {
107
+ "type": "array",
108
+ "minItems": 1,
109
+ "items": {
110
+ "$ref": "#/$defs/vector"
111
+ }
112
+ }
113
+ },
114
+ "$defs": {
115
+ "capability": {
116
+ "enum": ["autoAttach", "browserSession", "browserContexts"]
117
+ },
118
+ "requires": {
119
+ "type": "array",
120
+ "minItems": 1,
121
+ "uniqueItems": true,
122
+ "items": {
123
+ "$ref": "#/$defs/capability"
124
+ }
125
+ },
126
+ "observation": {
127
+ "type": "object",
128
+ "additionalProperties": false,
129
+ "required": ["means"],
130
+ "properties": {
131
+ "means": {
132
+ "type": "string",
133
+ "minLength": 1
134
+ },
135
+ "dependsOn": {
136
+ "type": "array",
137
+ "uniqueItems": true,
138
+ "items": {
139
+ "type": "string",
140
+ "pattern": "^(refused\\.[0-9]+|[A-Za-z][A-Za-z0-9]*)$"
141
+ }
142
+ },
143
+ "requires": {
144
+ "$ref": "#/$defs/requires"
145
+ }
146
+ }
147
+ },
148
+ "target": {
149
+ "enum": ["seven", "vault", "vault-x", "apex", "own"]
150
+ },
151
+ "expected": {
152
+ "oneOf": [
153
+ {
154
+ "type": "object",
155
+ "minProperties": 1,
156
+ "additionalProperties": {
157
+ "oneOf": [
158
+ {
159
+ "type": "boolean"
160
+ },
161
+ {
162
+ "const": "either"
163
+ }
164
+ ]
165
+ }
166
+ },
167
+ {
168
+ "type": "string",
169
+ "minLength": 1
170
+ }
171
+ ]
172
+ },
173
+ "vector": {
174
+ "type": "object",
175
+ "additionalProperties": false,
176
+ "required": [
177
+ "id",
178
+ "family",
179
+ "kind",
180
+ "scope",
181
+ "setup",
182
+ "trigger",
183
+ "targets",
184
+ "live",
185
+ "control",
186
+ "expected"
187
+ ],
188
+ "properties": {
189
+ "id": {
190
+ "type": "string",
191
+ "pattern": "^[CEB][1-9](\\.[A-Za-z0-9-]+)*$"
192
+ },
193
+ "family": {
194
+ "enum": ["C", "E", "B"]
195
+ },
196
+ "kind": {
197
+ "enum": ["cdp", "text"]
198
+ },
199
+ "scope": {
200
+ "type": "string",
201
+ "pattern": "^(any|[a-z][a-z0-9-]*)$"
202
+ },
203
+ "setup": {
204
+ "$ref": "#/$defs/steps"
205
+ },
206
+ "trigger": {
207
+ "$ref": "#/$defs/steps"
208
+ },
209
+ "targets": {
210
+ "type": "array",
211
+ "minItems": 1,
212
+ "uniqueItems": true,
213
+ "items": {
214
+ "$ref": "#/$defs/target"
215
+ }
216
+ },
217
+ "requires": {
218
+ "$ref": "#/$defs/requires"
219
+ },
220
+ "observe": {
221
+ "type": "object",
222
+ "additionalProperties": {
223
+ "$ref": "#/$defs/observation"
224
+ }
225
+ },
226
+ "live": {
227
+ "type": "string",
228
+ "minLength": 1
229
+ },
230
+ "control": {
231
+ "type": "object",
232
+ "additionalProperties": false,
233
+ "required": ["origin", "via", "expected"],
234
+ "properties": {
235
+ "origin": {
236
+ "const": "ordinary"
237
+ },
238
+ "via": {
239
+ "enum": ["guard", "unguarded"]
240
+ },
241
+ "expected": {
242
+ "$ref": "#/$defs/expected"
243
+ }
244
+ }
245
+ },
246
+ "expected": {
247
+ "$ref": "#/$defs/expected"
248
+ },
249
+ "skip": {
250
+ "type": "object",
251
+ "additionalProperties": false,
252
+ "required": ["target", "reason"],
253
+ "properties": {
254
+ "target": {
255
+ "$ref": "#/$defs/target"
256
+ },
257
+ "reason": {
258
+ "type": "string",
259
+ "pattern": "^[a-z][a-z-]*: .+"
260
+ }
261
+ }
262
+ },
263
+ "designDependent": {
264
+ "type": "array",
265
+ "uniqueItems": true,
266
+ "items": {
267
+ "type": "string",
268
+ "minLength": 1
269
+ }
270
+ },
271
+ "observable": {
272
+ "type": "object",
273
+ "additionalProperties": false,
274
+ "properties": {
275
+ "own": {
276
+ "type": "boolean"
277
+ }
278
+ }
279
+ },
280
+ "appliesTo": {
281
+ "type": "array",
282
+ "uniqueItems": true,
283
+ "minItems": 1,
284
+ "items": {
285
+ "enum": ["href", "iframe", "popup", "redirect"]
286
+ }
287
+ }
288
+ }
289
+ },
290
+ "steps": {
291
+ "type": "array",
292
+ "minItems": 1,
293
+ "items": {
294
+ "$ref": "#/$defs/step"
295
+ }
296
+ },
297
+ "on": {
298
+ "enum": ["control", "guarded"]
299
+ },
300
+ "session": {
301
+ "enum": ["page", "browser", "page-or-browser", "child"]
302
+ },
303
+ "name": {
304
+ "type": "string",
305
+ "pattern": "^[A-Za-z][A-Za-z0-9]*$"
306
+ },
307
+ "method": {
308
+ "type": "string",
309
+ "pattern": "^[A-Z][A-Za-z]*\\.[a-z][A-Za-z]*$"
310
+ },
311
+ "hops": {
312
+ "type": "array",
313
+ "minItems": 1,
314
+ "items": {
315
+ "type": "object",
316
+ "additionalProperties": false,
317
+ "required": ["origin", "code"],
318
+ "properties": {
319
+ "origin": {
320
+ "type": "string"
321
+ },
322
+ "code": {
323
+ "type": "integer",
324
+ "minimum": 300,
325
+ "maximum": 399
326
+ }
327
+ }
328
+ }
329
+ },
330
+ "step": {
331
+ "oneOf": [
332
+ {
333
+ "type": "object",
334
+ "additionalProperties": false,
335
+ "required": ["text"],
336
+ "properties": {
337
+ "text": {
338
+ "type": "string",
339
+ "minLength": 1
340
+ },
341
+ "on": {
342
+ "$ref": "#/$defs/on"
343
+ }
344
+ }
345
+ },
346
+ {
347
+ "type": "object",
348
+ "additionalProperties": false,
349
+ "required": ["cdp"],
350
+ "properties": {
351
+ "cdp": {
352
+ "$ref": "#/$defs/method"
353
+ },
354
+ "params": {
355
+ "type": "object"
356
+ },
357
+ "session": {
358
+ "$ref": "#/$defs/session"
359
+ },
360
+ "as": {
361
+ "$ref": "#/$defs/name"
362
+ },
363
+ "on": {
364
+ "$ref": "#/$defs/on"
365
+ },
366
+ "requires": {
367
+ "$ref": "#/$defs/requires"
368
+ },
369
+ "refusable": {
370
+ "const": true
371
+ },
372
+ "refusal": {
373
+ "type": "object",
374
+ "additionalProperties": false,
375
+ "required": ["match"],
376
+ "properties": {
377
+ "match": {
378
+ "type": "string",
379
+ "minLength": 1
380
+ }
381
+ }
382
+ }
383
+ },
384
+ "dependentRequired": {
385
+ "refusable": ["refusal"],
386
+ "refusal": ["refusable"]
387
+ }
388
+ },
389
+ {
390
+ "type": "object",
391
+ "additionalProperties": false,
392
+ "required": ["page"],
393
+ "properties": {
394
+ "page": {
395
+ "enum": [
396
+ "tab",
397
+ "navigate",
398
+ "href",
399
+ "replace",
400
+ "form",
401
+ "post",
402
+ "open",
403
+ "iframe",
404
+ "framed",
405
+ "fetch",
406
+ "xhr",
407
+ "image",
408
+ "eval"
409
+ ]
410
+ },
411
+ "url": {
412
+ "type": "string"
413
+ },
414
+ "hops": {
415
+ "$ref": "#/$defs/hops"
416
+ },
417
+ "from": {
418
+ "type": "string"
419
+ },
420
+ "context": {
421
+ "type": "string"
422
+ },
423
+ "expression": {
424
+ "type": "string"
425
+ },
426
+ "credentials": {
427
+ "const": "include"
428
+ },
429
+ "status": {
430
+ "type": "boolean"
431
+ },
432
+ "background": {
433
+ "type": "boolean"
434
+ },
435
+ "session": {
436
+ "$ref": "#/$defs/session"
437
+ },
438
+ "as": {
439
+ "$ref": "#/$defs/name"
440
+ },
441
+ "on": {
442
+ "$ref": "#/$defs/on"
443
+ },
444
+ "requires": {
445
+ "$ref": "#/$defs/requires"
446
+ }
447
+ }
448
+ },
449
+ {
450
+ "type": "object",
451
+ "additionalProperties": false,
452
+ "required": ["answer"],
453
+ "properties": {
454
+ "answer": {
455
+ "type": "object",
456
+ "additionalProperties": false,
457
+ "required": ["url"],
458
+ "properties": {
459
+ "url": {
460
+ "type": "string"
461
+ },
462
+ "stage": {
463
+ "enum": ["Request", "Response"]
464
+ },
465
+ "cdp": {
466
+ "$ref": "#/$defs/method"
467
+ },
468
+ "params": {
469
+ "type": "object"
470
+ },
471
+ "hold": {
472
+ "const": true
473
+ }
474
+ }
475
+ },
476
+ "on": {
477
+ "$ref": "#/$defs/on"
478
+ }
479
+ }
480
+ },
481
+ {
482
+ "type": "object",
483
+ "additionalProperties": false,
484
+ "required": ["children"],
485
+ "properties": {
486
+ "children": {
487
+ "$ref": "#/$defs/steps"
488
+ },
489
+ "on": {
490
+ "$ref": "#/$defs/on"
491
+ },
492
+ "requires": {
493
+ "$ref": "#/$defs/requires"
494
+ }
495
+ }
496
+ },
497
+ {
498
+ "type": "object",
499
+ "additionalProperties": false,
500
+ "required": ["settle"],
501
+ "properties": {
502
+ "settle": {
503
+ "type": "object",
504
+ "additionalProperties": false,
505
+ "minProperties": 1,
506
+ "properties": {
507
+ "beacon": {
508
+ "type": "string"
509
+ },
510
+ "title": {
511
+ "type": "string"
512
+ },
513
+ "ms": {
514
+ "type": "integer",
515
+ "minimum": 0
516
+ },
517
+ "variant": {
518
+ "const": true
519
+ },
520
+ "session": {
521
+ "$ref": "#/$defs/session"
522
+ }
523
+ }
524
+ },
525
+ "on": {
526
+ "$ref": "#/$defs/on"
527
+ }
528
+ }
529
+ },
530
+ {
531
+ "type": "object",
532
+ "additionalProperties": false,
533
+ "required": ["wait"],
534
+ "properties": {
535
+ "wait": {
536
+ "type": "integer",
537
+ "minimum": 0
538
+ },
539
+ "on": {
540
+ "$ref": "#/$defs/on"
541
+ }
542
+ }
543
+ },
544
+ {
545
+ "type": "object",
546
+ "additionalProperties": false,
547
+ "required": ["guess", "as"],
548
+ "properties": {
549
+ "guess": {
550
+ "type": "object",
551
+ "additionalProperties": false,
552
+ "required": ["between", "cdp", "params"],
553
+ "properties": {
554
+ "between": {
555
+ "type": "array",
556
+ "items": {
557
+ "type": "string"
558
+ },
559
+ "minItems": 2,
560
+ "maxItems": 2
561
+ },
562
+ "cdp": {
563
+ "$ref": "#/$defs/method"
564
+ },
565
+ "params": {
566
+ "type": "object"
567
+ }
568
+ }
569
+ },
570
+ "as": {
571
+ "$ref": "#/$defs/name"
572
+ },
573
+ "on": {
574
+ "$ref": "#/$defs/on"
575
+ }
576
+ }
577
+ }
578
+ ]
579
+ }
580
+ }
581
+ }
package/seven.mjs ADDED
@@ -0,0 +1,6 @@
1
+ export function isSevenLabel(seven, label) {
2
+ if (!label) return false;
3
+ if (seven.excludedLabels?.includes(label)) return false;
4
+ if (seven.excludedLabelPrefixes?.some((p) => label.startsWith(p))) return false;
5
+ return true;
6
+ }