@agentproto/corpus-cli 0.11.4 → 0.11.6

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.
@@ -85,13 +85,14 @@
85
85
  "description": "Optional home workspace id (AIP-34). When set, a sibling WORKSPACE.md exists at the app dir root."
86
86
  },
87
87
  "requires": {
88
- "description": "What the app needs from its host. Either a flat array of APP ids this app depends on (legacy form), or an object { browser?, fs?, gpu?, secrets?, apps? }. Each `apps` entry is a bare id (dependency only) or an object { id, version?, workflows? }: `version` is a semver range (exact \"1.2.3\", caret \"^1\"/\"^1.2\"/\"^1.2.3\", or tilde \"~1\"/\"~1.2\"/\"~1.2.3\") the provider's installed version must satisfy; `workflows` lists which of the provider's `exposes.workflows` this consumer may call via the app_call tool — omitted/empty means the dependency carries no call permission.",
89
- "anyOf": [
88
+ "description": "What the app needs (see the AIP-53 section `Requirements`). Either a list of app ids (each a dependency only: no version range, no workflow, nothing granted), or an object naming host capabilities and, under `apps`, the apps it depends on with what it uses from each.",
89
+ "oneOf": [
90
90
  {
91
91
  "type": "array",
92
92
  "items": {
93
93
  "type": "string",
94
- "minLength": 1
94
+ "minLength": 1,
95
+ "pattern": "\\S"
95
96
  },
96
97
  "uniqueItems": true
97
98
  },
@@ -101,62 +102,34 @@
101
102
  "properties": {
102
103
  "browser": {
103
104
  "type": "boolean",
105
+ "default": false,
104
106
  "description": "Needs the user's real browser."
105
107
  },
106
108
  "fs": {
107
109
  "type": "boolean",
108
- "description": "Needs the user's local filesystem beyond app data."
110
+ "default": false,
111
+ "description": "Needs the user's local filesystem beyond the app data dir."
109
112
  },
110
113
  "gpu": {
111
114
  "type": "boolean",
115
+ "default": false,
112
116
  "description": "Needs a GPU."
113
117
  },
114
118
  "secrets": {
115
119
  "type": "array",
116
120
  "items": {
117
121
  "type": "string",
118
- "minLength": 1
122
+ "minLength": 1,
123
+ "pattern": "\\S"
119
124
  },
120
- "description": "Env/secret names the app needs."
125
+ "description": "Env or secret names the app needs."
121
126
  },
122
127
  "apps": {
123
128
  "type": "array",
124
- "description": "Other app ids this app depends on — bare ids or { id, version?, workflows? } objects.",
125
129
  "items": {
126
- "anyOf": [
127
- {
128
- "type": "string",
129
- "minLength": 1
130
- },
131
- {
132
- "type": "object",
133
- "required": [
134
- "id"
135
- ],
136
- "additionalProperties": false,
137
- "properties": {
138
- "id": {
139
- "type": "string",
140
- "minLength": 1,
141
- "description": "The depended-on app id."
142
- },
143
- "version": {
144
- "type": "string",
145
- "minLength": 1,
146
- "description": "Optional semver range the provider's installed version must satisfy: exact (\"1.2.3\"), caret (\"^1\", \"^1.2\", \"^1.2.3\"), or tilde (\"~1\", \"~1.2\", \"~1.2.3\")."
147
- },
148
- "workflows": {
149
- "type": "array",
150
- "items": {
151
- "type": "string",
152
- "minLength": 1
153
- },
154
- "description": "Provider workflows (ids from its exposes.workflows) this consumer may call via app_call. Omitted/empty = dependency only, no call permission."
155
- }
156
- }
157
- }
158
- ]
159
- }
130
+ "$ref": "#/$defs/appRequirement"
131
+ },
132
+ "description": "Apps this app depends on. Two entries naming the same `id` are refused (loader rule)."
160
133
  }
161
134
  }
162
135
  }
@@ -376,9 +349,104 @@
376
349
  "type": "integer",
377
350
  "minimum": 1,
378
351
  "maximum": 65535,
379
- "description": "Optional TCP port the service listens on. Omitted = a service that does not listen. Bookkeeping only: the host records it and does not inject it into the service's environment."
352
+ "description": "Optional TCP port the service listens on. Omitted = a service that does not listen. For a keep-alive service this is bookkeeping only: the host records it and does not inject it into the service's environment. With `activation.mode: on-demand` the host listens on this port itself and gives the process another one in `PORT`. An `expose`d service's tunnel targets it."
353
+ },
354
+ "expose": {
355
+ "type": "object",
356
+ "additionalProperties": false,
357
+ "properties": {
358
+ "auth": {
359
+ "enum": [
360
+ "guard",
361
+ "service"
362
+ ],
363
+ "default": "guard",
364
+ "description": "Who authenticates a request that reaches the public URL. `guard`: the host's access guard sits in front of the tunnel. `service`: no guard, the URL is public and the service authenticates every request itself (for example a Telegram Mini App validating `initData`)."
365
+ },
366
+ "hostname": {
367
+ "type": "string",
368
+ "pattern": "^(?=.{1,253}$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$",
369
+ "description": "Hostname request: a DNS label or a full name, lowercase. Passed as the primary AIP-73 `hostnames` entry; the provider may assign another name."
370
+ }
371
+ },
372
+ "description": "Ask the host for a public URL that reaches `port`, through one AIP-73 tunnel per service, keyed `app.<app>.<service>.<hash>` (AIP-53 § Tunnel key). The host picks the provider and passes the public origin to the process as `AGENTPROTO_PUBLIC_URL`. Requires `port`. See AIP-53 § Exposure."
373
+ },
374
+ "activation": {
375
+ "type": "object",
376
+ "required": [
377
+ "mode"
378
+ ],
379
+ "additionalProperties": false,
380
+ "properties": {
381
+ "mode": {
382
+ "enum": [
383
+ "always",
384
+ "on-demand"
385
+ ],
386
+ "description": "`always`: the host starts the process at install and boot and keeps it running. `on-demand`: the host owns `port` (and the `expose` tunnel's target), starts the process on the first inbound connection, proxies HTTP and WebSocket traffic to it and stops it after `idleStopMs` without traffic. `on-demand` requires `port`, and the process MUST bind the port the host passes in `PORT`."
387
+ },
388
+ "idleStopMs": {
389
+ "type": "integer",
390
+ "minimum": 1000,
391
+ "maximum": 86400000,
392
+ "default": 300000,
393
+ "description": "`on-demand` only. Milliseconds without an open request or connection before the host stops the process. Default 300000."
394
+ },
395
+ "startTimeoutMs": {
396
+ "type": "integer",
397
+ "minimum": 1000,
398
+ "maximum": 300000,
399
+ "default": 30000,
400
+ "description": "`on-demand` only. Milliseconds a request waits for the process to start listening before the host answers 503. Default 30000."
401
+ }
402
+ },
403
+ "if": {
404
+ "properties": {
405
+ "mode": {
406
+ "const": "always"
407
+ }
408
+ }
409
+ },
410
+ "then": {
411
+ "properties": {
412
+ "idleStopMs": false,
413
+ "startTimeoutMs": false
414
+ }
415
+ },
416
+ "description": "When the host runs the process. Omitted means `{ mode: always }`: kept running from install and boot, restarted on an unexpected exit. Only a service whose work is driven entirely by inbound requests may be `on-demand`; one that polls or schedules on its own would be stopped while idle. See AIP-53 § Activation."
380
417
  }
381
418
  },
419
+ "dependentRequired": {
420
+ "expose": [
421
+ "port"
422
+ ]
423
+ },
424
+ "allOf": [
425
+ {
426
+ "if": {
427
+ "required": [
428
+ "activation"
429
+ ],
430
+ "properties": {
431
+ "activation": {
432
+ "required": [
433
+ "mode"
434
+ ],
435
+ "properties": {
436
+ "mode": {
437
+ "const": "on-demand"
438
+ }
439
+ }
440
+ }
441
+ }
442
+ },
443
+ "then": {
444
+ "required": [
445
+ "port"
446
+ ]
447
+ }
448
+ }
449
+ ],
382
450
  "oneOf": [
383
451
  {
384
452
  "required": [
@@ -399,7 +467,7 @@
399
467
  }
400
468
  ]
401
469
  },
402
- "description": "Production hosting surface: long-running processes the host starts with the app, one process per entry. No dependency graph, no scaling, no scheduler. Not `dev.launch`, which stays dev-only and is never executed. See AIP-53 § Services."
470
+ "description": "Production hosting surface: long-running processes the host starts with the app, one process per entry. No dependency graph, no replicas, no scheduler; `activation` only chooses between keeping the process running and starting it on demand. Not `dev.launch`, which stays dev-only and is never executed. See AIP-53 § Services."
403
471
  },
404
472
  "setup": {
405
473
  "type": "array",
@@ -438,12 +506,14 @@
438
506
  "exposes": {
439
507
  "type": "object",
440
508
  "additionalProperties": false,
509
+ "description": "What the app offers to callers outside it: A2A-visible agents and workflows, and the tools and `ui://` views it publishes to MCP clients (see the AIP-53 section `Exposed tools and resources`). Closed object. Rules JSON Schema cannot express (ids naming the app's own agents/workflows, a TOOL.md behind every non-imported tool id, no two entries computing the same MCP name, a computed name of at most 64 characters) are enforced by the loader.",
441
510
  "properties": {
442
511
  "agents": {
443
512
  "type": "array",
444
513
  "items": {
445
514
  "type": "string",
446
- "minLength": 1
515
+ "minLength": 1,
516
+ "pattern": "\\S"
447
517
  },
448
518
  "description": "Agent ids this app exposes. Every id must name one of the app's own agents."
449
519
  },
@@ -451,15 +521,224 @@
451
521
  "type": "array",
452
522
  "items": {
453
523
  "type": "string",
454
- "minLength": 1
524
+ "minLength": 1,
525
+ "pattern": "\\S"
526
+ },
527
+ "description": "Workflow ids this app exposes: the callable surface other apps' `requires.apps[].workflows` entries may name (consumed via `app_call`). Every id must name one of the app's own workflows."
528
+ },
529
+ "prefix": {
530
+ "type": "string",
531
+ "pattern": "^[a-z][a-z0-9]{1,15}$",
532
+ "description": "MCP name prefix of every exposed tool: the computed name is `<prefix>_<name>`. Lowercase letters and digits only, no `_`, 2 to 16 characters. Required when `tools` is non-empty. A host additionally refuses a prefix that is the first `_` segment of one of its own tool names."
533
+ },
534
+ "tools": {
535
+ "type": "array",
536
+ "items": {
537
+ "$ref": "#/$defs/exposedTool"
538
+ },
539
+ "description": "Tools offered to MCP clients, each with an explicit access class. `id` values are unique within the array (loader rule)."
540
+ },
541
+ "resources": {
542
+ "type": "array",
543
+ "items": {
544
+ "type": "string",
545
+ "pattern": "^ui://[^\\s]+$"
455
546
  },
456
- "description": "Workflow ids this app exposes — the callable surface other apps' requires.apps[].workflows entries may name (consumed via the app_call tool). Every id must name one of the app's own workflows."
547
+ "uniqueItems": true,
548
+ "description": "Per-app allowlist of `ui://` view URIs a host may relay to the app's imported MCP servers on `resources/read`. Needs at least one `imported:` entry in `tools` to relay from. An empty array is accepted and means no allowlist."
457
549
  }
458
550
  },
459
- "description": "A2A-visible agents/workflows. Ids must exist in the app's agents / workflows."
551
+ "allOf": [
552
+ {
553
+ "if": {
554
+ "required": [
555
+ "tools"
556
+ ],
557
+ "properties": {
558
+ "tools": {
559
+ "minItems": 1
560
+ }
561
+ }
562
+ },
563
+ "then": {
564
+ "required": [
565
+ "prefix"
566
+ ]
567
+ }
568
+ },
569
+ {
570
+ "if": {
571
+ "required": [
572
+ "resources"
573
+ ],
574
+ "properties": {
575
+ "resources": {
576
+ "minItems": 1
577
+ }
578
+ }
579
+ },
580
+ "then": {
581
+ "required": [
582
+ "tools"
583
+ ],
584
+ "properties": {
585
+ "tools": {
586
+ "contains": {
587
+ "type": "object",
588
+ "required": [
589
+ "id"
590
+ ],
591
+ "properties": {
592
+ "id": {
593
+ "type": "string",
594
+ "pattern": "^imported:"
595
+ }
596
+ }
597
+ }
598
+ }
599
+ }
600
+ }
601
+ }
602
+ ]
460
603
  }
461
604
  },
462
605
  "$defs": {
606
+ "appRequirement": {
607
+ "description": "One `requires.apps` entry: a bare provider app id (a dependency only) or an object. Rules JSON Schema cannot express (every `workflows` id in the provider's `exposes.workflows` when called, every `tools` name computed by one of the provider's `exposes.tools` entries) are enforced by the host against the installed provider.",
608
+ "oneOf": [
609
+ {
610
+ "type": "string",
611
+ "minLength": 1,
612
+ "pattern": "\\S"
613
+ },
614
+ {
615
+ "type": "object",
616
+ "required": [
617
+ "id"
618
+ ],
619
+ "additionalProperties": false,
620
+ "properties": {
621
+ "id": {
622
+ "type": "string",
623
+ "minLength": 1,
624
+ "pattern": "\\S",
625
+ "description": "The provider app id, as it appears in the provider's APP.md `id`."
626
+ },
627
+ "version": {
628
+ "type": "string",
629
+ "pattern": "^(?:[\\^~]\\d+(?:\\.\\d+(?:\\.\\d+)?)?|\\d+\\.\\d+\\.\\d+(?:[-+][\\w.\\-]+)?)$",
630
+ "description": "Range the provider's installed version must satisfy: an exact version (`1.2.3`), a caret (`^1`, `^1.2`, `^1.2.3`) or a tilde (`~1`, `~1.2`, `~1.2.3`). Omitted means any version."
631
+ },
632
+ "workflows": {
633
+ "type": "array",
634
+ "items": {
635
+ "type": "string",
636
+ "minLength": 1,
637
+ "pattern": "\\S"
638
+ },
639
+ "uniqueItems": true,
640
+ "description": "Provider workflows this app may call with `app_call`: ids from the provider's `exposes.workflows`. Omitted or empty means no call is allowed."
641
+ },
642
+ "tools": {
643
+ "type": "array",
644
+ "items": {
645
+ "type": "string",
646
+ "maxLength": 64,
647
+ "pattern": "^[a-z][a-z0-9]{1,15}_[a-zA-Z0-9-](?:[a-zA-Z0-9_-]*[a-zA-Z0-9-])?$"
648
+ },
649
+ "uniqueItems": true,
650
+ "description": "Provider tools granted to this app's own agents: the MCP names the provider's `exposes.tools` entries compute (`<prefix>_<name>`, for example `bureau_navigate`). Each is granted at the access class the provider declares, as if every AGENT.md of this app had opted in to it by name. Omitted or empty means nothing is granted."
651
+ }
652
+ }
653
+ }
654
+ ]
655
+ },
656
+ "exposedTool": {
657
+ "type": "object",
658
+ "required": [
659
+ "id",
660
+ "access",
661
+ "description"
662
+ ],
663
+ "additionalProperties": false,
664
+ "description": "One entry of `exposes.tools`. The MCP name is computed from `exposes.prefix` and `mcpName` (else `id`); see the AIP-53 section `Exposed tools and resources`.",
665
+ "properties": {
666
+ "id": {
667
+ "type": "string",
668
+ "minLength": 1,
669
+ "not": {
670
+ "pattern": "^approval"
671
+ },
672
+ "description": "A TOOL.md id the app bundles, or `imported:<alias>/<tool>` for a tool of one of the app's imported MCP servers. An id starting with `approval` is refused: deciding an approval never goes through this registry. A host's own tool names are refused too (loader rule)."
673
+ },
674
+ "access": {
675
+ "enum": [
676
+ "read",
677
+ "write",
678
+ "approve"
679
+ ],
680
+ "description": "Access class. `read` is visible to every caller by default; `write` and `approve` are visible only to a caller that opted in by exact MCP name."
681
+ },
682
+ "description": {
683
+ "type": "string",
684
+ "pattern": "\\S",
685
+ "maxLength": 300,
686
+ "description": "Written for a model; non-blank, at most 300 characters."
687
+ },
688
+ "inputSchema": {
689
+ "type": "object",
690
+ "description": "JSON Schema object for the tool's input. Defaults to the bundled TOOL.md `inputs`. On an `imported:` entry whose schema declares `properties`, a host drops every undeclared input key before the call, unless `additionalProperties` is `true`."
691
+ },
692
+ "mcpName": {
693
+ "type": "string",
694
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]*$",
695
+ "not": {
696
+ "pattern": "^approval"
697
+ },
698
+ "description": "Replaces the id as the source of the MCP name (no `:`, `/` or `.`). Required for an `imported:` id. A name starting with `approval` is refused."
699
+ },
700
+ "approvalArg": {
701
+ "type": "string",
702
+ "minLength": 1,
703
+ "description": "Name of the input argument that carries an approval reference. Only for `access: approve`; a shape hint, not a guarantee."
704
+ }
705
+ },
706
+ "allOf": [
707
+ {
708
+ "if": {
709
+ "required": [
710
+ "approvalArg"
711
+ ]
712
+ },
713
+ "then": {
714
+ "properties": {
715
+ "access": {
716
+ "const": "approve"
717
+ }
718
+ }
719
+ }
720
+ },
721
+ {
722
+ "if": {
723
+ "properties": {
724
+ "id": {
725
+ "pattern": "^imported:"
726
+ }
727
+ }
728
+ },
729
+ "then": {
730
+ "required": [
731
+ "mcpName"
732
+ ],
733
+ "properties": {
734
+ "access": {
735
+ "const": "read"
736
+ }
737
+ }
738
+ }
739
+ }
740
+ ]
741
+ },
463
742
  "stepId": {
464
743
  "type": "string",
465
744
  "pattern": "^[a-z][a-z0-9-]*$",
@@ -8,7 +8,7 @@
8
8
  "examples": [
9
9
  "ws://operators/atlas",
10
10
  "ws://wikis/platform/http-server",
11
- "ws://workspaces/@acme/agentik-studio",
11
+ "ws://workspaces/@acme/demo-app",
12
12
  "ws://roles/seo-specialist",
13
13
  "ws://companies/acme-co/teams/growth",
14
14
  "ws://tools/agentproto/session_list"
@@ -73,7 +73,7 @@
73
73
  "additionalProperties": false,
74
74
  "properties": {
75
75
  "kind": { "type": "string", "minLength": 1 },
76
- "adapter": { "type": "string" },
76
+ "harness": { "type": "string" },
77
77
  "model": { "type": "string" },
78
78
  "sessionId": {
79
79
  "description": "The AIP-46 session id, when this step is agent-backed.",
@@ -86,7 +86,7 @@
86
86
  },
87
87
  "conformanceLevel": {
88
88
  "type": "string",
89
- "enum": ["core", "interaction", "network", "download", "profile", "recording"]
89
+ "enum": ["core", "interaction", "network", "download", "profile", "recording", "recipes"]
90
90
  },
91
91
  "capabilities": {
92
92
  "type": "object",
@@ -208,7 +208,7 @@
208
208
  "type": "array",
209
209
  "minItems": 1,
210
210
  "uniqueItems": true,
211
- "items": { "type": "string", "enum": ["ephemeral", "persistent", "import", "native-login", "clone"] }
211
+ "items": { "type": "string", "enum": ["ephemeral", "persistent", "import", "native-login", "clone", "attach"] }
212
212
  },
213
213
  "storedBy": { "type": "string", "enum": ["host", "provider"], "description": "Who persists session material between instance runs. provider means the provider keeps its own jar, outside the host store and outside the host's at-rest protections." }
214
214
  }
@@ -315,11 +315,12 @@
315
315
  "grant": {
316
316
  "type": "object",
317
317
  "additionalProperties": false,
318
- "description": "A consent grant. The only way session material enters a store or a remote instance (C1). The scope is EITHER an explicit domain list OR fullProfile true: a wildcard is not a value of domains.",
319
- "required": ["id", "sessionId", "source", "sinks", "grantedAt", "grantedVia", "cookieCount"],
318
+ "description": "A consent grant. The only way session material enters a store or a remote instance (C1), and the authority to attach to a browser the user already runs (attach true, C14). The scope is EITHER an explicit domain list, OR fullProfile true, OR attach true with a profileRef: a wildcard is not a value of domains.",
319
+ "required": ["id", "sessionId", "sinks", "grantedAt", "grantedVia"],
320
320
  "properties": {
321
321
  "id": { "type": "string", "minLength": 1 },
322
322
  "sessionId": { "type": "string", "minLength": 1 },
323
+ "profileRef": { "type": "string", "minLength": 1, "description": "Profile the grant applies to, as <instance>/<profile> (for example chrome-user/perso). Optional next to sessionId, which keeps its meaning (C17); required with attach." },
323
324
  "deviceId": { "type": "string", "minLength": 1, "description": "Paired device (AIP-59) this grant is scoped to. Absent = usable by any device the host serves (C12)." },
324
325
  "source": {
325
326
  "type": "object",
@@ -332,6 +333,7 @@
332
333
  },
333
334
  "domains": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "$ref": "#/$defs/domain" } },
334
335
  "fullProfile": { "const": true, "description": "The recorded full-profile grant (C3). Not a wildcard domain." },
336
+ "attach": { "const": true, "description": "An attach grant (C14): the host may attach to the browser instance and profile named by profileRef. Copies nothing; local sinks only (C16)." },
335
337
  "sinks": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/grantSink" } },
336
338
  "grantedAt": { "type": "string", "format": "date-time" },
337
339
  "grantedVia": { "type": "string", "enum": ["interactive", "flag"] },
@@ -340,11 +342,41 @@
340
342
  "revokedAt": { "type": "string", "format": "date-time" }
341
343
  },
342
344
  "oneOf": [
343
- { "required": ["domains"], "not": { "required": ["fullProfile"] } },
344
- { "required": ["fullProfile"], "not": { "required": ["domains"] } }
345
+ { "required": ["domains", "source", "cookieCount"], "not": { "anyOf": [{ "required": ["fullProfile"] }, { "required": ["attach"] }] } },
346
+ { "required": ["fullProfile", "source", "cookieCount"], "not": { "anyOf": [{ "required": ["domains"] }, { "required": ["attach"] }] } },
347
+ { "required": ["attach", "profileRef"], "not": { "anyOf": [{ "required": ["domains"] }, { "required": ["fullProfile"] }] } }
345
348
  ],
346
- "if": { "required": ["fullProfile"] },
347
- "then": { "properties": { "sinks": { "items": { "properties": { "kind": { "const": "local" } } } } } }
349
+ "allOf": [
350
+ {
351
+ "if": { "required": ["fullProfile"] },
352
+ "then": { "properties": { "sinks": { "items": { "properties": { "kind": { "const": "local" } } } } } }
353
+ },
354
+ {
355
+ "description": "C16: an attached profile never goes to a remote sink.",
356
+ "if": { "required": ["attach"] },
357
+ "then": { "properties": { "sinks": { "items": { "properties": { "kind": { "const": "local" } } } } } }
358
+ }
359
+ ]
360
+ },
361
+ "account": {
362
+ "type": "object",
363
+ "additionalProperties": false,
364
+ "description": "A host record of one account on one site in one profile (C17). It authorizes nothing: only grants do. It never holds a cookie, token or storage value (C9).",
365
+ "required": ["id", "site", "profileRef", "session", "source", "grantIds"],
366
+ "properties": {
367
+ "id": { "type": "string", "minLength": 1, "description": "Stable name, for example linkedin-jeremy." },
368
+ "site": { "$ref": "#/$defs/domain" },
369
+ "account": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Display name or address on the site. Personal data, not a secret." },
370
+ "profileRef": { "type": "string", "minLength": 1, "description": "<instance>/<profile> the account lives in." },
371
+ "session": { "type": "string", "enum": ["valid", "expired", "unknown"], "description": "Observed login state. Indicative; this AIP does not require a probe." },
372
+ "verifiedAt": { "type": "string", "format": "date-time" },
373
+ "source": { "type": "string", "enum": ["native", "synced"], "description": "native: the user logged in in this profile. synced: material copied in under a grant." },
374
+ "syncedFrom": { "type": "string", "minLength": 1, "description": "profileRef the material came from (source synced)." },
375
+ "syncedAt": { "type": "string", "format": "date-time" },
376
+ "grantIds": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } }
377
+ },
378
+ "if": { "properties": { "source": { "const": "synced" } }, "required": ["source"] },
379
+ "then": { "required": ["syncedFrom"] }
348
380
  },
349
381
  "ledgerRecord": {
350
382
  "type": "object",
@@ -354,7 +386,7 @@
354
386
  "properties": {
355
387
  "seq": { "type": "integer", "minimum": 0 },
356
388
  "at": { "type": "string", "format": "date-time" },
357
- "event": { "type": "string", "enum": ["grant", "refresh", "revoke", "sink-ack", "deny"] },
389
+ "event": { "type": "string", "enum": ["grant", "refresh", "revoke", "sink-ack", "deny", "attach-ack"] },
358
390
  "actor": {
359
391
  "type": "object",
360
392
  "additionalProperties": false,
@@ -367,8 +399,12 @@
367
399
  },
368
400
  "grantId": { "type": "string", "minLength": 1 },
369
401
  "sessionId": { "type": "string", "minLength": 1 },
402
+ "profileRef": { "type": "string", "minLength": 1, "description": "Profile an attach grant or attach-ack applies to (C14)." },
403
+ "instance": { "type": "string", "minLength": 1, "description": "Browser instance an attach-ack applies to (C14)." },
404
+ "purpose": { "type": "string", "maxLength": 500, "description": "What the human attached the browser for (C14)." },
370
405
  "domains": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/domain" } },
371
406
  "fullProfile": { "const": true },
407
+ "attach": { "const": true },
372
408
  "cookieCount": { "type": "integer", "minimum": 0 },
373
409
  "nameHashes": {
374
410
  "type": "array",
@@ -397,10 +433,11 @@
397
433
  {
398
434
  "if": { "properties": { "event": { "const": "grant" } } },
399
435
  "then": {
400
- "required": ["grantId", "sessionId", "cookieCount"],
436
+ "required": ["grantId", "sessionId"],
401
437
  "oneOf": [
402
- { "required": ["domains"], "not": { "required": ["fullProfile"] } },
403
- { "required": ["fullProfile"], "not": { "required": ["domains"] } }
438
+ { "required": ["domains", "cookieCount"], "not": { "anyOf": [{ "required": ["fullProfile"] }, { "required": ["attach"] }] } },
439
+ { "required": ["fullProfile", "cookieCount"], "not": { "anyOf": [{ "required": ["domains"] }, { "required": ["attach"] }] } },
440
+ { "required": ["attach", "profileRef"], "not": { "anyOf": [{ "required": ["domains"] }, { "required": ["fullProfile"] }] } }
404
441
  ],
405
442
  "properties": { "domains": { "minItems": 1 } }
406
443
  }
@@ -417,6 +454,11 @@
417
454
  "if": { "properties": { "event": { "const": "sink-ack" } } },
418
455
  "then": { "required": ["grantId", "sinkId"], "properties": { "actor": { "properties": { "kind": { "const": "human" } } } } }
419
456
  },
457
+ {
458
+ "description": "C14: an attach-ack is a human record naming the grant, the instance, the profile and the purpose.",
459
+ "if": { "properties": { "event": { "const": "attach-ack" } } },
460
+ "then": { "required": ["grantId", "instance", "profileRef", "purpose"], "properties": { "actor": { "properties": { "kind": { "const": "human" } } } } }
461
+ },
420
462
  {
421
463
  "if": { "properties": { "event": { "const": "deny" } } },
422
464
  "then": { "required": ["reason"] }