@culture.dev/agents 0.16.2 → 0.17.1

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.
Files changed (107) hide show
  1. package/README.md +26 -3
  2. package/dist/contract-schemas/api.json +324 -1
  3. package/dist/contract-schemas/fleet.json +114 -0
  4. package/dist/contract-schemas/reachability.json +51 -0
  5. package/dist/contract-schemas/remote.json +150 -0
  6. package/dist/contract-schemas/run.json +17 -3
  7. package/dist/contract-schemas/unreadable.json +45 -0
  8. package/dist/contract-schemas/version.json +1 -1
  9. package/dist/src/contract/api.d.ts +10 -0
  10. package/dist/src/contract/api.js +18 -0
  11. package/dist/src/contract/api.js.map +1 -1
  12. package/dist/src/contract/generated/fleet.d.ts +50 -0
  13. package/dist/src/contract/generated/fleet.js +3 -0
  14. package/dist/src/contract/generated/fleet.js.map +1 -0
  15. package/dist/src/contract/generated/index.d.ts +24 -0
  16. package/dist/src/contract/generated/reachability.d.ts +20 -0
  17. package/dist/src/contract/generated/reachability.js +3 -0
  18. package/dist/src/contract/generated/reachability.js.map +1 -0
  19. package/dist/src/contract/generated/remote.d.ts +64 -0
  20. package/dist/src/contract/generated/remote.js +3 -0
  21. package/dist/src/contract/generated/remote.js.map +1 -0
  22. package/dist/src/contract/generated/run.d.ts +3 -1
  23. package/dist/src/contract/generated/unreadable.d.ts +15 -0
  24. package/dist/src/contract/generated/unreadable.js +3 -0
  25. package/dist/src/contract/generated/unreadable.js.map +1 -0
  26. package/dist/src/contract/generated/version.d.ts +1 -1
  27. package/dist/src/contract/index.d.ts +1 -1
  28. package/dist/src/contract/index.js +1 -1
  29. package/dist/src/contract/index.js.map +1 -1
  30. package/dist/src/daemon/daemon.d.ts +6 -0
  31. package/dist/src/daemon/daemon.js +2 -0
  32. package/dist/src/daemon/daemon.js.map +1 -1
  33. package/dist/src/daemon/fleet-routes.d.ts +40 -0
  34. package/dist/src/daemon/fleet-routes.js +111 -0
  35. package/dist/src/daemon/fleet-routes.js.map +1 -0
  36. package/dist/src/daemon/http.d.ts +2 -2
  37. package/dist/src/daemon/http.js +5 -4
  38. package/dist/src/daemon/http.js.map +1 -1
  39. package/dist/src/daemon/main.js +16 -1
  40. package/dist/src/daemon/main.js.map +1 -1
  41. package/dist/src/daemon/ports.d.ts +22 -4
  42. package/dist/src/daemon/routes.d.ts +6 -1
  43. package/dist/src/daemon/routes.js +34 -0
  44. package/dist/src/daemon/routes.js.map +1 -1
  45. package/dist/src/daemon/secrets.js +2 -0
  46. package/dist/src/daemon/secrets.js.map +1 -1
  47. package/dist/src/fleet/aliases.d.ts +17 -0
  48. package/dist/src/fleet/aliases.js +62 -0
  49. package/dist/src/fleet/aliases.js.map +1 -0
  50. package/dist/src/fleet/announce.d.ts +53 -0
  51. package/dist/src/fleet/announce.js +126 -0
  52. package/dist/src/fleet/announce.js.map +1 -0
  53. package/dist/src/fleet/bundle.d.ts +21 -0
  54. package/dist/src/fleet/bundle.js +88 -0
  55. package/dist/src/fleet/bundle.js.map +1 -0
  56. package/dist/src/fleet/cert.d.ts +43 -0
  57. package/dist/src/fleet/cert.js +110 -0
  58. package/dist/src/fleet/cert.js.map +1 -0
  59. package/dist/src/fleet/command.d.ts +5 -0
  60. package/dist/src/fleet/command.js +71 -0
  61. package/dist/src/fleet/command.js.map +1 -0
  62. package/dist/src/fleet/config.d.ts +36 -0
  63. package/dist/src/fleet/config.js +69 -0
  64. package/dist/src/fleet/config.js.map +1 -0
  65. package/dist/src/fleet/index.d.ts +69 -0
  66. package/dist/src/fleet/index.js +120 -0
  67. package/dist/src/fleet/index.js.map +1 -0
  68. package/dist/src/fleet/members.d.ts +47 -0
  69. package/dist/src/fleet/members.js +131 -0
  70. package/dist/src/fleet/members.js.map +1 -0
  71. package/dist/src/fleet/peers.d.ts +18 -0
  72. package/dist/src/fleet/peers.js +76 -0
  73. package/dist/src/fleet/peers.js.map +1 -0
  74. package/dist/src/fleet/remote-attach.d.ts +33 -0
  75. package/dist/src/fleet/remote-attach.js +109 -0
  76. package/dist/src/fleet/remote-attach.js.map +1 -0
  77. package/dist/src/fleet/remote.d.ts +85 -0
  78. package/dist/src/fleet/remote.js +115 -0
  79. package/dist/src/fleet/remote.js.map +1 -0
  80. package/dist/src/fleet/serve-runs.d.ts +56 -0
  81. package/dist/src/fleet/serve-runs.js +176 -0
  82. package/dist/src/fleet/serve-runs.js.map +1 -0
  83. package/dist/src/fleet/transport.d.ts +85 -0
  84. package/dist/src/fleet/transport.js +243 -0
  85. package/dist/src/fleet/transport.js.map +1 -0
  86. package/dist/src/fleet/trust.d.ts +35 -0
  87. package/dist/src/fleet/trust.js +136 -0
  88. package/dist/src/fleet/trust.js.map +1 -0
  89. package/dist/src/harness/stub/backend.js +3 -1
  90. package/dist/src/harness/stub/backend.js.map +1 -1
  91. package/dist/src/index.d.ts +1 -1
  92. package/dist/src/index.js +1 -1
  93. package/dist/src/runs/admission.d.ts +15 -0
  94. package/dist/src/runs/admission.js +24 -1
  95. package/dist/src/runs/admission.js.map +1 -1
  96. package/dist/src/runs/gateway.d.ts +1 -0
  97. package/dist/src/runs/gateway.js +4 -0
  98. package/dist/src/runs/gateway.js.map +1 -1
  99. package/dist/src/runs/keys.js +5 -3
  100. package/dist/src/runs/keys.js.map +1 -1
  101. package/dist/src/runs/service.d.ts +6 -5
  102. package/dist/src/runs/service.js +25 -14
  103. package/dist/src/runs/service.js.map +1 -1
  104. package/dist/src/runs/unreadable.d.ts +8 -0
  105. package/dist/src/runs/unreadable.js +64 -0
  106. package/dist/src/runs/unreadable.js.map +1 -0
  107. package/package.json +3 -2
package/README.md CHANGED
@@ -73,9 +73,32 @@ environment in `/proc/<pid>/environ`, which any process of the same user can rea
73
73
  stay readable there for the life of the core. The way to avoid that is to give the core its secrets
74
74
  by file or descriptor instead of the environment (planned, not built). The list is declared in one place,
75
75
  `INJECTED_SECRETS` in `src/daemon/secrets.ts`: `GH_TOKEN`, `GITHUB_TOKEN`, `SSH_AUTH_SOCK`,
76
- `CLAUDE_CODE_OAUTH_TOKEN`, `ANTHROPIC_API_KEY` and `LOBES_GATEWAY_KEY`. The worker spawner, the host
77
- command runner and the sandbox environment filter also drop these names from any environment they
78
- are given.
76
+ `CLAUDE_CODE_OAUTH_TOKEN`, `ANTHROPIC_API_KEY`, `LOBES_GATEWAY_KEY` and `CULTURE_AGENTS_FLEET_KEY`.
77
+ The worker spawner, the host command runner and the sandbox environment filter also drop these names
78
+ from any environment they are given.
79
+
80
+ ## Fleet transport (off by default)
81
+
82
+ A TLS 1.3 listener for other cores, authenticated in both directions by Ed25519 key against a local
83
+ trust list (`src/fleet/`). It opens only when `CULTURE_AGENTS_FLEET_LISTEN` is set to `<ip>:<port>`.
84
+ The key comes as `CULTURE_AGENTS_FLEET_KEY` (above), so it stays readable in the core's
85
+ `/proc/<pid>/environ` to the same user. `culture-agents-fleet keygen` makes a key, and
86
+ `culture-agents-fleet cert` prints the trust entry other members add. See
87
+ `docs/d2/fleet-transport.md`.
88
+
89
+ With the transport on, the core announces itself every 5 s to the addresses in its local, untracked
90
+ `culture-agents/fleet/peers.json` (IP addresses only), and keeps a member list built from
91
+ announcements only: a member is listed under the name its trust-list entry gives its key, dropped
92
+ after 15 s of silence or at once when it leaves, and an announcement claiming a node name held by
93
+ another key is refused (409) and logged. `GET /v1/fleet/members` on the control socket returns the
94
+ list (API 3.1). See `docs/d2/fleet-members.md`.
95
+
96
+ Remote runs (API 3.2): `POST /v1/fleet/runs` on the control socket sends a submit to the member that
97
+ the node of its `agent_id` names, with the repository named by an alias that member defines in its
98
+ local, untracked `culture-agents/fleet/aliases.json`; `/v1/fleet/runs/{run_id}` (show, attach, steer,
99
+ cancel) reaches the member a run id names. The member records itself as the run's submitter, acts
100
+ only on the runs it submitted, and takes the deadline as a duration on its own clock. Every call has
101
+ a 5 s timeout and a read cap. See `docs/d2/remote-runs.md`.
79
102
 
80
103
  ## License
81
104
 
@@ -1,5 +1,5 @@
1
1
  {
2
- "api_version": "3.0",
2
+ "api_version": "3.3",
3
3
  "schema_base": "https://culture.dev/contract/agents/",
4
4
  "description": "Index of the culture-agents control-plane API. Semantics live in contract/README.md; payload shapes in the schema files named here, resolved against schema_base.",
5
5
  "transport": {
@@ -554,6 +554,329 @@
554
554
  "internal",
555
555
  "denied"
556
556
  ]
557
+ },
558
+ {
559
+ "id": "fleet.members",
560
+ "method": "GET",
561
+ "path": "/v1/fleet/members",
562
+ "summary": "The fleet members this core heard announce themselves, and the announcements it refused (added in 3.1). With the fleet transport off, both lists are empty.",
563
+ "cli": "agents agents list",
564
+ "d1": "supported",
565
+ "request": null,
566
+ "response": "fleet.json",
567
+ "status": 200,
568
+ "stream": false,
569
+ "content_type": "application/json",
570
+ "params": {},
571
+ "query": {},
572
+ "errors": [
573
+ "invalid",
574
+ "incompatible_version",
575
+ "internal"
576
+ ]
577
+ },
578
+ {
579
+ "id": "fleet.runs.submit",
580
+ "method": "POST",
581
+ "path": "/v1/fleet/runs",
582
+ "summary": "Submit a run to the fleet member that the agent_id's node names, over the fleet transport; the repository is an alias that member defines (added in 3.2).",
583
+ "cli": "agents runs submit --alias",
584
+ "d1": "supported",
585
+ "request": "remote.json#/$defs/submit_request",
586
+ "response": "remote.json#/$defs/submit_response",
587
+ "status": 201,
588
+ "stream": false,
589
+ "content_type": "application/json",
590
+ "params": {},
591
+ "query": {},
592
+ "errors": [
593
+ "invalid",
594
+ "incompatible_version",
595
+ "internal",
596
+ "denied",
597
+ "not_found",
598
+ "unsupported",
599
+ "unavailable",
600
+ "conflict",
601
+ "limit_reached",
602
+ "admission_held"
603
+ ]
604
+ },
605
+ {
606
+ "id": "fleet.runs.show",
607
+ "method": "GET",
608
+ "path": "/v1/fleet/runs/{run_id}",
609
+ "summary": "One run on the fleet member that the run id's node names, without its repository path (added in 3.2).",
610
+ "cli": "agents runs attach (remote run)",
611
+ "d1": "supported",
612
+ "request": null,
613
+ "response": "remote.json",
614
+ "status": 200,
615
+ "stream": false,
616
+ "content_type": "application/json",
617
+ "params": {
618
+ "run_id": "common.json#/$defs/run_id"
619
+ },
620
+ "query": {},
621
+ "errors": [
622
+ "invalid",
623
+ "incompatible_version",
624
+ "internal",
625
+ "denied",
626
+ "not_found",
627
+ "unsupported",
628
+ "unavailable"
629
+ ]
630
+ },
631
+ {
632
+ "id": "fleet.runs.view",
633
+ "method": "GET",
634
+ "path": "/v1/fleet/runs/{run_id}/view",
635
+ "summary": "A run on another member as this caller sees it now: the member's answer, or `unreachable` when the member does not answer. A view computed on each read and never stored (added in 3.3).",
636
+ "cli": "agents runs show (remote run)",
637
+ "d1": "supported",
638
+ "request": null,
639
+ "response": "reachability.json",
640
+ "status": 200,
641
+ "stream": false,
642
+ "content_type": "application/json",
643
+ "params": {
644
+ "run_id": "common.json#/$defs/run_id"
645
+ },
646
+ "query": {},
647
+ "errors": [
648
+ "invalid",
649
+ "incompatible_version",
650
+ "internal",
651
+ "denied",
652
+ "not_found",
653
+ "unsupported",
654
+ "unavailable"
655
+ ]
656
+ },
657
+ {
658
+ "id": "fleet.runs.attach",
659
+ "method": "GET",
660
+ "path": "/v1/fleet/runs/{run_id}/attach",
661
+ "summary": "SSE: the events of a run on another member, read from it over the fleet transport, with cursor > after; closes after the terminal run.state event (added in 3.2).",
662
+ "cli": "agents runs attach (remote run)",
663
+ "d1": "supported",
664
+ "request": null,
665
+ "response": "event.json",
666
+ "status": 200,
667
+ "stream": true,
668
+ "content_type": "text/event-stream",
669
+ "params": {
670
+ "run_id": "common.json#/$defs/run_id"
671
+ },
672
+ "query": {
673
+ "after": {
674
+ "type": "integer",
675
+ "minimum": 0,
676
+ "default": 0
677
+ }
678
+ },
679
+ "errors": [
680
+ "invalid",
681
+ "incompatible_version",
682
+ "internal",
683
+ "denied",
684
+ "not_found",
685
+ "unsupported",
686
+ "unavailable"
687
+ ]
688
+ },
689
+ {
690
+ "id": "fleet.runs.steer",
691
+ "method": "POST",
692
+ "path": "/v1/fleet/runs/{run_id}/steer",
693
+ "summary": "Deliver a mid-run instruction to a run on another member, over the fleet transport (added in 3.2).",
694
+ "cli": "agents runs steer (remote run)",
695
+ "d1": "supported",
696
+ "request": "control-action.json#/$defs/steer_request",
697
+ "response": "control-action.json#/$defs/accepted_response",
698
+ "status": 202,
699
+ "stream": false,
700
+ "content_type": "application/json",
701
+ "params": {
702
+ "run_id": "common.json#/$defs/run_id"
703
+ },
704
+ "query": {},
705
+ "errors": [
706
+ "invalid",
707
+ "incompatible_version",
708
+ "internal",
709
+ "denied",
710
+ "not_found",
711
+ "unsupported",
712
+ "unavailable",
713
+ "conflict"
714
+ ]
715
+ },
716
+ {
717
+ "id": "fleet.runs.cancel",
718
+ "method": "POST",
719
+ "path": "/v1/fleet/runs/{run_id}/cancel",
720
+ "summary": "Cancel a run on another member, over the fleet transport (added in 3.2).",
721
+ "cli": "agents runs cancel (remote run)",
722
+ "d1": "supported",
723
+ "request": "control-action.json#/$defs/cancel_request",
724
+ "response": "control-action.json#/$defs/accepted_response",
725
+ "status": 202,
726
+ "stream": false,
727
+ "content_type": "application/json",
728
+ "params": {
729
+ "run_id": "common.json#/$defs/run_id"
730
+ },
731
+ "query": {},
732
+ "errors": [
733
+ "invalid",
734
+ "incompatible_version",
735
+ "internal",
736
+ "denied",
737
+ "not_found",
738
+ "unsupported",
739
+ "unavailable",
740
+ "conflict"
741
+ ]
742
+ },
743
+ {
744
+ "id": "fleet.runs.logs",
745
+ "method": "GET",
746
+ "path": "/v1/fleet/runs/{run_id}/events",
747
+ "summary": "A page of the stored events of a run on another member, read from it over the fleet transport, unredacted; the response carries the Agents-Content-Sensitivity header (added in 3.3).",
748
+ "cli": "agents runs logs (remote run)",
749
+ "d1": "supported",
750
+ "request": null,
751
+ "response": "event.json#/$defs/event_page",
752
+ "status": 200,
753
+ "stream": false,
754
+ "content_type": "application/json",
755
+ "params": {
756
+ "run_id": "common.json#/$defs/run_id"
757
+ },
758
+ "query": {
759
+ "after": {
760
+ "type": "integer",
761
+ "minimum": 0,
762
+ "default": 0
763
+ },
764
+ "limit": {
765
+ "type": "integer",
766
+ "minimum": 1,
767
+ "maximum": 50,
768
+ "default": 50
769
+ }
770
+ },
771
+ "errors": [
772
+ "invalid",
773
+ "incompatible_version",
774
+ "internal",
775
+ "denied",
776
+ "not_found",
777
+ "unsupported",
778
+ "unavailable"
779
+ ]
780
+ },
781
+ {
782
+ "id": "fleet.runs.result",
783
+ "method": "GET",
784
+ "path": "/v1/fleet/runs/{run_id}/result",
785
+ "summary": "Outcome of a terminal run on another member, read from it over the fleet transport; conflict while the run is active (added in 3.3).",
786
+ "cli": "agents runs result (remote run)",
787
+ "d1": "supported",
788
+ "request": null,
789
+ "response": "run.json#/$defs/run_result",
790
+ "status": 200,
791
+ "stream": false,
792
+ "content_type": "application/json",
793
+ "params": {
794
+ "run_id": "common.json#/$defs/run_id"
795
+ },
796
+ "query": {},
797
+ "errors": [
798
+ "invalid",
799
+ "incompatible_version",
800
+ "internal",
801
+ "denied",
802
+ "not_found",
803
+ "unsupported",
804
+ "unavailable",
805
+ "conflict"
806
+ ]
807
+ },
808
+ {
809
+ "id": "fleet.runs.bundle",
810
+ "method": "GET",
811
+ "path": "/v1/fleet/runs/{run_id}/bundle",
812
+ "summary": "A git bundle of a terminal run's branch on another member, read from it over the fleet transport: the one ref refs/heads/runs/<run_id>, with the run's base commit as its only prerequisite. Binary body; refusals are JSON errors; the response carries the Agents-Content-Sensitivity header (added in 3.3).",
813
+ "cli": "agents runs result (remote run)",
814
+ "d1": "supported",
815
+ "request": null,
816
+ "response": null,
817
+ "status": 200,
818
+ "stream": false,
819
+ "content_type": "application/x-git-bundle",
820
+ "params": {
821
+ "run_id": "common.json#/$defs/run_id"
822
+ },
823
+ "query": {},
824
+ "errors": [
825
+ "invalid",
826
+ "incompatible_version",
827
+ "internal",
828
+ "denied",
829
+ "not_found",
830
+ "unsupported",
831
+ "unavailable",
832
+ "conflict"
833
+ ]
834
+ },
835
+ {
836
+ "id": "fleet.aliases",
837
+ "method": "GET",
838
+ "path": "/v1/fleet/aliases",
839
+ "summary": "The aliases a fleet member defines and what its allow-list permits on each, read from it over the fleet transport (added in 3.2).",
840
+ "cli": "agents agents aliases",
841
+ "d1": "supported",
842
+ "request": null,
843
+ "response": "remote.json#/$defs/alias_list",
844
+ "status": 200,
845
+ "stream": false,
846
+ "content_type": "application/json",
847
+ "params": {},
848
+ "query": {
849
+ "member": {
850
+ "$ref": "common.json#/$defs/node"
851
+ }
852
+ },
853
+ "errors": [
854
+ "invalid",
855
+ "incompatible_version",
856
+ "internal",
857
+ "unsupported",
858
+ "unavailable"
859
+ ]
860
+ },
861
+ {
862
+ "id": "runs.unreadable",
863
+ "method": "GET",
864
+ "path": "/v1/runs/unreadable",
865
+ "summary": "Every run directory this core cannot read, with its run id and the reason: a newer store version, a corrupt record or an unreadable log (added in 3.2). Reading changes nothing in those directories.",
866
+ "cli": "agents runs unreadable",
867
+ "d1": "supported",
868
+ "request": null,
869
+ "response": "unreadable.json",
870
+ "status": 200,
871
+ "stream": false,
872
+ "content_type": "application/json",
873
+ "params": {},
874
+ "query": {},
875
+ "errors": [
876
+ "invalid",
877
+ "incompatible_version",
878
+ "internal"
879
+ ]
557
880
  }
558
881
  ]
559
882
  }
@@ -0,0 +1,114 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://culture.dev/contract/agents/fleet.json",
4
+ "title": "MemberList",
5
+ "description": "Response of GET /v1/fleet/members (added in 3.1): the fleet members this core has heard announce themselves, built from announcements only. A member is listed only after an announcement arrives from a key in this core's trust list, and only under the node name the trust list gives that key; it is dropped after `silence_ms` without an announcement, or at once when it announces `leaving`. No address is reported. `heard_ms_ago` is measured on this core's monotonic clock: no timestamp from another host is read or compared. `refused` holds the announcements this core refused recently, the operator's report of a node name claimed by a key that does not hold it.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["node", "transport", "announce_interval_ms", "silence_ms", "members", "refused"],
9
+ "properties": {
10
+ "node": {
11
+ "description": "This core's own node name. This core is not an entry of `members`.",
12
+ "$ref": "common.json#/$defs/node"
13
+ },
14
+ "transport": {
15
+ "description": "`off` when the fleet transport is not configured: nothing is announced or heard, and both lists are empty.",
16
+ "enum": ["on", "off"]
17
+ },
18
+ "announce_interval_ms": {
19
+ "description": "How often this core announces itself to the peers in its local address list.",
20
+ "type": "integer",
21
+ "minimum": 1,
22
+ "maximum": 3600000
23
+ },
24
+ "silence_ms": {
25
+ "description": "How long a member may stay silent before it is dropped. It leaves the list within this time plus one sweep (1 s).",
26
+ "type": "integer",
27
+ "minimum": 1,
28
+ "maximum": 3600000
29
+ },
30
+ "members": {
31
+ "type": "array",
32
+ "maxItems": 1000,
33
+ "items": { "$ref": "#/$defs/member" }
34
+ },
35
+ "refused": {
36
+ "type": "array",
37
+ "maxItems": 32,
38
+ "items": { "$ref": "#/$defs/refusal" }
39
+ }
40
+ },
41
+ "$defs": {
42
+ "fingerprint": {
43
+ "description": "SHA-256 of a member's public key, lowercase hex. Public: it identifies the key, it gives no access.",
44
+ "type": "string",
45
+ "pattern": "^[0-9a-f]{64}$"
46
+ },
47
+ "member": {
48
+ "description": "One member heard from. `node` is the name this core's trust list gives the member's key, never a name taken from the announcement alone.",
49
+ "type": "object",
50
+ "additionalProperties": false,
51
+ "required": ["node", "fingerprint", "api_version", "seq", "heard_ms_ago"],
52
+ "properties": {
53
+ "node": { "$ref": "common.json#/$defs/node" },
54
+ "fingerprint": { "$ref": "#/$defs/fingerprint" },
55
+ "api_version": {
56
+ "description": "The control API version the member announced.",
57
+ "$ref": "common.json#/$defs/api_version"
58
+ },
59
+ "seq": {
60
+ "description": "The sequence number of the member's last announcement heard.",
61
+ "type": "integer",
62
+ "minimum": 0,
63
+ "maximum": 9007199254740991
64
+ },
65
+ "heard_ms_ago": {
66
+ "description": "Milliseconds since this core last heard the member, on this core's monotonic clock.",
67
+ "type": "integer",
68
+ "minimum": 0,
69
+ "maximum": 9007199254740991
70
+ }
71
+ }
72
+ },
73
+ "refusal": {
74
+ "description": "An announcement refused with `conflict`: the key `fingerprint`, which the trust list names `trusted_as`, claimed the node name `node`, which it does not hold or which another key holds. Repeats of the same claim by the same key are counted, not listed again.",
75
+ "type": "object",
76
+ "additionalProperties": false,
77
+ "required": ["node", "trusted_as", "fingerprint", "reason", "count", "heard_ms_ago"],
78
+ "properties": {
79
+ "node": { "$ref": "common.json#/$defs/node" },
80
+ "trusted_as": { "$ref": "common.json#/$defs/node" },
81
+ "fingerprint": { "$ref": "#/$defs/fingerprint" },
82
+ "reason": { "type": "string", "minLength": 1, "maxLength": 1000 },
83
+ "count": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 },
84
+ "heard_ms_ago": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }
85
+ }
86
+ },
87
+ "announce_refusal": {
88
+ "description": "Body of the 409 reply to POST /v1/fleet/announce when the announcement is refused: the node name it claims is not the one the trust list gives the sender's key, is this core's own, or is held by another listed key. `error.json`'s `conflict` names a run, so the fleet transport has this shape of its own. `retryable` is true only when the name frees once its holder leaves or goes silent.",
89
+ "type": "object",
90
+ "additionalProperties": false,
91
+ "required": ["code", "message", "retryable"],
92
+ "properties": {
93
+ "code": { "const": "conflict" },
94
+ "message": { "type": "string", "minLength": 1, "maxLength": 1000 },
95
+ "retryable": { "type": "boolean" }
96
+ }
97
+ },
98
+ "announcement": {
99
+ "description": "Body of POST /v1/fleet/announce, served over the fleet transport only (never on the control socket), and the body of its 200 reply, which is the answering core's own announcement. It carries no key material: who sent it is the key the transport authenticated.",
100
+ "type": "object",
101
+ "additionalProperties": false,
102
+ "required": ["node", "api_version", "seq", "state"],
103
+ "properties": {
104
+ "node": { "$ref": "common.json#/$defs/node" },
105
+ "api_version": { "$ref": "common.json#/$defs/api_version" },
106
+ "seq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
107
+ "state": {
108
+ "description": "`up` while the core runs; `leaving` once, on a clean stop, so that its peers drop it at once.",
109
+ "enum": ["up", "leaving"]
110
+ }
111
+ }
112
+ }
113
+ }
114
+ }
@@ -0,0 +1,51 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://culture.dev/contract/agents/reachability.json",
4
+ "title": "RunView",
5
+ "description": "Response of GET /v1/fleet/runs/{run_id}/view (added in 3.3): a run on another fleet member as this caller sees it now. `reachable` carries the member's own answer, its true state. `unreachable` says the member does not answer this caller; it says nothing about the run, which may be running, finished or gone. `unreachable` is a view computed by the calling core on each read and never stored, there or on the member: no state, event or file is written for it. A run's stored terminal state `unknown` is still written only by the core that owns the run, with evidence that its worker is gone. A run read as unreachable can end in any terminal state, and shows it as soon as its member answers again.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["run_id", "node", "view"],
9
+ "properties": {
10
+ "run_id": { "$ref": "common.json#/$defs/run_id" },
11
+ "node": {
12
+ "description": "The member the run id names.",
13
+ "$ref": "common.json#/$defs/node"
14
+ },
15
+ "view": {
16
+ "description": "`reachable`: `run` is the member's answer just now. `unreachable`: `unreachable` says why. Never `succeeded` or any other run state: a caller that cannot read a run does not know its state.",
17
+ "enum": ["reachable", "unreachable"]
18
+ },
19
+ "run": {
20
+ "description": "Present exactly when `view` is `reachable`: the run as the member answered.",
21
+ "$ref": "remote.json"
22
+ },
23
+ "unreachable": {
24
+ "description": "Present exactly when `view` is `unreachable`.",
25
+ "$ref": "#/$defs/unreachable"
26
+ }
27
+ },
28
+ "allOf": [
29
+ { "if": { "properties": { "view": { "const": "reachable" } } }, "then": { "required": ["run"], "not": { "required": ["unreachable"] } } },
30
+ { "if": { "properties": { "view": { "const": "unreachable" } } }, "then": { "required": ["unreachable"], "not": { "required": ["run"] } } }
31
+ ],
32
+ "$defs": {
33
+ "unreachable": {
34
+ "type": "object",
35
+ "additionalProperties": false,
36
+ "required": ["reason", "detail"],
37
+ "properties": {
38
+ "reason": {
39
+ "description": "`not_listed`: the member is in this core's trust list but is not in its member list: it never announced itself, or has been silent for longer than the silence limit (15 s, so a halted member reads unreachable within 16 s of its last announcement). `no_answer`: the member is listed but the call to it failed or timed out (within 5 s of the call).",
40
+ "enum": ["not_listed", "no_answer"]
41
+ },
42
+ "detail": {
43
+ "description": "This core's message about why, at most 500 characters.",
44
+ "type": "string",
45
+ "minLength": 1,
46
+ "maxLength": 500
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }