@culture.dev/agents 0.16.1 → 0.17.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/README.md +26 -3
- package/dist/contract-schemas/api.json +324 -1
- package/dist/contract-schemas/fleet.json +114 -0
- package/dist/contract-schemas/reachability.json +51 -0
- package/dist/contract-schemas/remote.json +150 -0
- package/dist/contract-schemas/run.json +17 -3
- package/dist/contract-schemas/unreadable.json +45 -0
- package/dist/contract-schemas/version.json +1 -1
- package/dist/src/contract/api.d.ts +10 -0
- package/dist/src/contract/api.js +18 -0
- package/dist/src/contract/api.js.map +1 -1
- package/dist/src/contract/generated/fleet.d.ts +50 -0
- package/dist/src/contract/generated/fleet.js +3 -0
- package/dist/src/contract/generated/fleet.js.map +1 -0
- package/dist/src/contract/generated/index.d.ts +24 -0
- package/dist/src/contract/generated/reachability.d.ts +20 -0
- package/dist/src/contract/generated/reachability.js +3 -0
- package/dist/src/contract/generated/reachability.js.map +1 -0
- package/dist/src/contract/generated/remote.d.ts +64 -0
- package/dist/src/contract/generated/remote.js +3 -0
- package/dist/src/contract/generated/remote.js.map +1 -0
- package/dist/src/contract/generated/run.d.ts +3 -1
- package/dist/src/contract/generated/unreadable.d.ts +15 -0
- package/dist/src/contract/generated/unreadable.js +3 -0
- package/dist/src/contract/generated/unreadable.js.map +1 -0
- package/dist/src/contract/generated/version.d.ts +1 -1
- package/dist/src/contract/index.d.ts +1 -1
- package/dist/src/contract/index.js +1 -1
- package/dist/src/contract/index.js.map +1 -1
- package/dist/src/daemon/daemon.d.ts +6 -0
- package/dist/src/daemon/daemon.js +2 -0
- package/dist/src/daemon/daemon.js.map +1 -1
- package/dist/src/daemon/fleet-routes.d.ts +40 -0
- package/dist/src/daemon/fleet-routes.js +111 -0
- package/dist/src/daemon/fleet-routes.js.map +1 -0
- package/dist/src/daemon/http.d.ts +2 -2
- package/dist/src/daemon/http.js +5 -4
- package/dist/src/daemon/http.js.map +1 -1
- package/dist/src/daemon/main.js +16 -1
- package/dist/src/daemon/main.js.map +1 -1
- package/dist/src/daemon/ports.d.ts +22 -4
- package/dist/src/daemon/routes.d.ts +6 -1
- package/dist/src/daemon/routes.js +34 -0
- package/dist/src/daemon/routes.js.map +1 -1
- package/dist/src/daemon/secrets.js +2 -0
- package/dist/src/daemon/secrets.js.map +1 -1
- package/dist/src/fleet/aliases.d.ts +17 -0
- package/dist/src/fleet/aliases.js +62 -0
- package/dist/src/fleet/aliases.js.map +1 -0
- package/dist/src/fleet/announce.d.ts +53 -0
- package/dist/src/fleet/announce.js +126 -0
- package/dist/src/fleet/announce.js.map +1 -0
- package/dist/src/fleet/bundle.d.ts +21 -0
- package/dist/src/fleet/bundle.js +88 -0
- package/dist/src/fleet/bundle.js.map +1 -0
- package/dist/src/fleet/cert.d.ts +43 -0
- package/dist/src/fleet/cert.js +110 -0
- package/dist/src/fleet/cert.js.map +1 -0
- package/dist/src/fleet/command.d.ts +5 -0
- package/dist/src/fleet/command.js +71 -0
- package/dist/src/fleet/command.js.map +1 -0
- package/dist/src/fleet/config.d.ts +36 -0
- package/dist/src/fleet/config.js +69 -0
- package/dist/src/fleet/config.js.map +1 -0
- package/dist/src/fleet/index.d.ts +69 -0
- package/dist/src/fleet/index.js +120 -0
- package/dist/src/fleet/index.js.map +1 -0
- package/dist/src/fleet/members.d.ts +47 -0
- package/dist/src/fleet/members.js +131 -0
- package/dist/src/fleet/members.js.map +1 -0
- package/dist/src/fleet/peers.d.ts +18 -0
- package/dist/src/fleet/peers.js +76 -0
- package/dist/src/fleet/peers.js.map +1 -0
- package/dist/src/fleet/remote-attach.d.ts +33 -0
- package/dist/src/fleet/remote-attach.js +109 -0
- package/dist/src/fleet/remote-attach.js.map +1 -0
- package/dist/src/fleet/remote.d.ts +85 -0
- package/dist/src/fleet/remote.js +115 -0
- package/dist/src/fleet/remote.js.map +1 -0
- package/dist/src/fleet/serve-runs.d.ts +56 -0
- package/dist/src/fleet/serve-runs.js +176 -0
- package/dist/src/fleet/serve-runs.js.map +1 -0
- package/dist/src/fleet/transport.d.ts +85 -0
- package/dist/src/fleet/transport.js +243 -0
- package/dist/src/fleet/transport.js.map +1 -0
- package/dist/src/fleet/trust.d.ts +35 -0
- package/dist/src/fleet/trust.js +136 -0
- package/dist/src/fleet/trust.js.map +1 -0
- package/dist/src/harness/stub/backend.js +3 -1
- package/dist/src/harness/stub/backend.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/runs/admission.d.ts +15 -0
- package/dist/src/runs/admission.js +24 -1
- package/dist/src/runs/admission.js.map +1 -1
- package/dist/src/runs/gateway.d.ts +1 -0
- package/dist/src/runs/gateway.js +4 -0
- package/dist/src/runs/gateway.js.map +1 -1
- package/dist/src/runs/keys.js +5 -3
- package/dist/src/runs/keys.js.map +1 -1
- package/dist/src/runs/service.d.ts +6 -5
- package/dist/src/runs/service.js +25 -14
- package/dist/src/runs/service.js.map +1 -1
- package/dist/src/runs/unreadable.d.ts +8 -0
- package/dist/src/runs/unreadable.js +64 -0
- package/dist/src/runs/unreadable.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://culture.dev/contract/agents/remote.json",
|
|
4
|
+
"title": "RemoteRun",
|
|
5
|
+
"description": "A run on another fleet member, as a caller sees it (added in 3.2): response of GET /v1/fleet/runs/{run_id}, and the `run` of a remote submit. It is the executing core's run without its repository path, which stays private to the executing host (docs/d2/part-two-design.md, Decision 4). Every timestamp is the executing core's clock; a caller never compares one with its own clock.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["id", "agent_id", "harness", "state", "terminal", "cursor", "submitter", "base_commit", "deadline", "created_at", "updated_at"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"id": { "$ref": "common.json#/$defs/run_id" },
|
|
11
|
+
"agent_id": { "$ref": "common.json#/$defs/mesh_id" },
|
|
12
|
+
"harness": { "$ref": "common.json#/$defs/harness_id" },
|
|
13
|
+
"state": { "$ref": "run.json#/$defs/state" },
|
|
14
|
+
"terminal": { "type": "boolean" },
|
|
15
|
+
"cursor": {
|
|
16
|
+
"description": "Cursor of the newest event in the run's event log on the executing core.",
|
|
17
|
+
"$ref": "common.json#/$defs/cursor"
|
|
18
|
+
},
|
|
19
|
+
"submitter": {
|
|
20
|
+
"description": "Who submitted the run, as the executing core established it. For a run submitted over the fleet transport it is `member` with the node name the executing core's trust list gives the caller's key.",
|
|
21
|
+
"$ref": "run.json#/$defs/submitter"
|
|
22
|
+
},
|
|
23
|
+
"base_commit": {
|
|
24
|
+
"description": "The commit of the aliased checkout the run starts from: the named `base_commit` of the submit, else the executing host's HEAD when it accepted the submit.",
|
|
25
|
+
"$ref": "common.json#/$defs/git_sha"
|
|
26
|
+
},
|
|
27
|
+
"deadline": {
|
|
28
|
+
"description": "When the run must be terminal, on the executing core's clock: its clock at acceptance plus the submit's `deadline_ms`. Null without a deadline.",
|
|
29
|
+
"$ref": "common.json#/$defs/nullable_timestamp"
|
|
30
|
+
},
|
|
31
|
+
"created_at": { "$ref": "common.json#/$defs/timestamp" },
|
|
32
|
+
"updated_at": { "$ref": "common.json#/$defs/timestamp" }
|
|
33
|
+
},
|
|
34
|
+
"$defs": {
|
|
35
|
+
"alias": {
|
|
36
|
+
"description": "A name the operator of a host gives one of its checkouts. The operator asserts that the same alias names the same repository on each host; the core never infers it and checks only a named commit.",
|
|
37
|
+
"type": "string",
|
|
38
|
+
"pattern": "^[a-z0-9][a-z0-9._-]{0,63}$"
|
|
39
|
+
},
|
|
40
|
+
"submit_request": {
|
|
41
|
+
"description": "Body of POST /v1/fleet/runs (added in 3.2), on the control socket and over the fleet transport alike. The node of `agent_id` names the member that executes the run: the caller chooses the host, and nothing schedules. The repository is named by `alias`, as the executing host defines it; no path crosses the network. Optional fields are omitted, never null. No field sets the run's `submitter`.",
|
|
42
|
+
"type": "object",
|
|
43
|
+
"additionalProperties": false,
|
|
44
|
+
"required": ["agent_id", "harness", "alias", "task", "caller"],
|
|
45
|
+
"properties": {
|
|
46
|
+
"agent_id": { "$ref": "common.json#/$defs/mesh_id" },
|
|
47
|
+
"harness": { "$ref": "common.json#/$defs/harness_id" },
|
|
48
|
+
"alias": { "$ref": "#/$defs/alias" },
|
|
49
|
+
"task": { "$ref": "common.json#/$defs/text" },
|
|
50
|
+
"caller": { "$ref": "common.json#/$defs/principal" },
|
|
51
|
+
"idempotency_key": { "$ref": "common.json#/$defs/idempotency_key" },
|
|
52
|
+
"deadline_ms": {
|
|
53
|
+
"description": "How long the run may take, in milliseconds, counted on the executing core's clock from when it accepts the submit. A duration, never an absolute time: no timestamp from the caller's clock is sent (spec c42). At most 30 days.",
|
|
54
|
+
"type": "integer",
|
|
55
|
+
"minimum": 1,
|
|
56
|
+
"maximum": 2592000000
|
|
57
|
+
},
|
|
58
|
+
"base_commit": {
|
|
59
|
+
"description": "The full commit id the run must start from. The executing core refuses the submit with `invalid` when its aliased checkout lacks that commit, and fetches nothing. When omitted, the run starts from the executing host's HEAD at acceptance, which the response returns.",
|
|
60
|
+
"$ref": "common.json#/$defs/git_sha"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"submit_response": {
|
|
65
|
+
"description": "201 response of POST /v1/fleet/runs. For a new run it is in state `queued`. When `replayed` is true the idempotency key matched an earlier submit of the same member: nothing was created and `run` is that first run as it is now.",
|
|
66
|
+
"type": "object",
|
|
67
|
+
"additionalProperties": false,
|
|
68
|
+
"required": ["run"],
|
|
69
|
+
"properties": {
|
|
70
|
+
"run": { "$ref": "#" },
|
|
71
|
+
"replayed": {
|
|
72
|
+
"description": "True when the request repeated an earlier submit with the same idempotency key. Omitted otherwise.",
|
|
73
|
+
"type": "boolean"
|
|
74
|
+
},
|
|
75
|
+
"warnings": {
|
|
76
|
+
"description": "Things the caller should know about a run that was admitted all the same. Omitted when there are none.",
|
|
77
|
+
"type": "array",
|
|
78
|
+
"minItems": 1,
|
|
79
|
+
"items": { "$ref": "control-action.json#/$defs/warning" }
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"if": {
|
|
83
|
+
"required": ["replayed"],
|
|
84
|
+
"properties": { "replayed": { "const": true } }
|
|
85
|
+
},
|
|
86
|
+
"else": {
|
|
87
|
+
"properties": { "run": { "properties": { "state": { "const": "queued" } } } }
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"alias_list": {
|
|
91
|
+
"description": "Response of GET /v1/fleet/aliases (added in 3.2): the aliases a member defines, each with the agent and harness pairs its allow-list permits on the aliased checkout. No path is reported.",
|
|
92
|
+
"type": "object",
|
|
93
|
+
"additionalProperties": false,
|
|
94
|
+
"required": ["node", "aliases"],
|
|
95
|
+
"properties": {
|
|
96
|
+
"node": {
|
|
97
|
+
"description": "The member whose aliases these are.",
|
|
98
|
+
"$ref": "common.json#/$defs/node"
|
|
99
|
+
},
|
|
100
|
+
"aliases": {
|
|
101
|
+
"type": "array",
|
|
102
|
+
"maxItems": 256,
|
|
103
|
+
"items": {
|
|
104
|
+
"type": "object",
|
|
105
|
+
"additionalProperties": false,
|
|
106
|
+
"required": ["alias", "permits"],
|
|
107
|
+
"properties": {
|
|
108
|
+
"alias": { "$ref": "#/$defs/alias" },
|
|
109
|
+
"permits": {
|
|
110
|
+
"type": "array",
|
|
111
|
+
"maxItems": 256,
|
|
112
|
+
"items": {
|
|
113
|
+
"type": "object",
|
|
114
|
+
"additionalProperties": false,
|
|
115
|
+
"required": ["agent_id", "harness"],
|
|
116
|
+
"properties": {
|
|
117
|
+
"agent_id": { "$ref": "common.json#/$defs/mesh_id" },
|
|
118
|
+
"harness": { "$ref": "common.json#/$defs/harness_id" }
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"alias_file": {
|
|
128
|
+
"description": "The core's local alias file, `${XDG_CONFIG_HOME:-$HOME/.config}/culture-agents/fleet/aliases.json` (added in 3.2). Not an API payload: no route reads or writes it, and it is never tracked. Each alias resolves to an absolute path on this host; a submit through it is allowed only when the allow-list permits the agent and harness on that path.",
|
|
129
|
+
"type": "object",
|
|
130
|
+
"additionalProperties": false,
|
|
131
|
+
"required": ["version", "aliases"],
|
|
132
|
+
"properties": {
|
|
133
|
+
"version": { "const": 1 },
|
|
134
|
+
"aliases": {
|
|
135
|
+
"type": "array",
|
|
136
|
+
"maxItems": 256,
|
|
137
|
+
"items": {
|
|
138
|
+
"type": "object",
|
|
139
|
+
"additionalProperties": false,
|
|
140
|
+
"required": ["alias", "repo"],
|
|
141
|
+
"properties": {
|
|
142
|
+
"alias": { "$ref": "#/$defs/alias" },
|
|
143
|
+
"repo": { "$ref": "common.json#/$defs/repo_path" }
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -246,7 +246,7 @@
|
|
|
246
246
|
"description": "A final state. `unanswered`: a question the run asked its operator passed its own time limit. `unknown`: the outcome cannot be established; it is never a success."
|
|
247
247
|
},
|
|
248
248
|
"submitter": {
|
|
249
|
-
"description": "Who submitted a run, as the core established it. `local_user`: the request arrived on the core's own control socket, and `uid` is the operating-system user that owns that socket. `member`: the request arrived from another core, and `node` is the fleet member the connection authenticated as. No request field sets or changes it.",
|
|
249
|
+
"description": "Who submitted a run, as the core established it. `local_user`: the request arrived on the core's own control socket, and `uid` is the operating-system user that owns that socket. `member`: the request arrived from another core, and `node` is the fleet member the connection authenticated as, `key` (3.3) the fingerprint of the key it authenticated with. No request field sets or changes it.",
|
|
250
250
|
"type": "object",
|
|
251
251
|
"additionalProperties": false,
|
|
252
252
|
"required": [
|
|
@@ -273,6 +273,11 @@
|
|
|
273
273
|
"node": {
|
|
274
274
|
"description": "member only: the node name of the authenticated fleet member.",
|
|
275
275
|
"$ref": "common.json#/$defs/node"
|
|
276
|
+
},
|
|
277
|
+
"key": {
|
|
278
|
+
"description": "member only (3.3, optional): the SHA-256 fingerprint, hex, of the public key the member authenticated with at submit. A member acts on a run only with this key (a node name moved to another key does not inherit its runs); a run without it is matched by node.",
|
|
279
|
+
"type": "string",
|
|
280
|
+
"pattern": "^[0-9a-f]{64}$"
|
|
276
281
|
}
|
|
277
282
|
},
|
|
278
283
|
"allOf": [
|
|
@@ -292,8 +297,17 @@
|
|
|
292
297
|
"uid"
|
|
293
298
|
],
|
|
294
299
|
"not": {
|
|
295
|
-
"
|
|
296
|
-
|
|
300
|
+
"anyOf": [
|
|
301
|
+
{
|
|
302
|
+
"required": [
|
|
303
|
+
"node"
|
|
304
|
+
]
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"required": [
|
|
308
|
+
"key"
|
|
309
|
+
]
|
|
310
|
+
}
|
|
297
311
|
]
|
|
298
312
|
}
|
|
299
313
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://culture.dev/contract/agents/unreadable.json",
|
|
4
|
+
"title": "UnreadableRunList",
|
|
5
|
+
"description": "Response of GET /v1/runs/unreadable (added in 3.2): every run directory in this core's store that the core cannot read, with the run id (the directory's name) and the reason. A run listed here is not absent and not failed: its state is unknown to this core. Listing it changes nothing in its directory. `runs.list` skips these runs; this is the one place that names them.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["count", "runs"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"count": {
|
|
11
|
+
"description": "How many run directories cannot be read. Equals the length of `runs`.",
|
|
12
|
+
"type": "integer",
|
|
13
|
+
"minimum": 0,
|
|
14
|
+
"maximum": 10000
|
|
15
|
+
},
|
|
16
|
+
"runs": {
|
|
17
|
+
"type": "array",
|
|
18
|
+
"maxItems": 10000,
|
|
19
|
+
"items": { "$ref": "#/$defs/unreadable_run" }
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"$defs": {
|
|
23
|
+
"unreadable_run": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"additionalProperties": false,
|
|
26
|
+
"required": ["run_id", "reason", "detail"],
|
|
27
|
+
"properties": {
|
|
28
|
+
"run_id": {
|
|
29
|
+
"description": "The run directory's name, which is the run id. A directory whose name is not a run id is not a run directory and is not listed.",
|
|
30
|
+
"$ref": "common.json#/$defs/run_id"
|
|
31
|
+
},
|
|
32
|
+
"reason": {
|
|
33
|
+
"description": "`newer_version`: written by a newer store schema than this core reads (nothing in it is read past the version file, and nothing in it is changed). `corrupt_record`: the run's record file is missing, not JSON or not a run. `unreadable_log`: the event log is corrupt or cannot be read. `other`: any other reason (an unreadable version file, liveness that cannot be read); `detail` says which.",
|
|
34
|
+
"enum": ["newer_version", "corrupt_record", "unreadable_log", "other"]
|
|
35
|
+
},
|
|
36
|
+
"detail": {
|
|
37
|
+
"description": "The core's message about why, at most 500 characters. It is text from a directory the core does not control: show it escaped.",
|
|
38
|
+
"type": "string",
|
|
39
|
+
"minLength": 1,
|
|
40
|
+
"maxLength": 500
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "https://culture.dev/contract/agents/version.json",
|
|
4
4
|
"title": "Version",
|
|
5
|
-
"description": "Response of GET /v1/version, the first call a client makes on connect (README: versioning). A core built from this contract reports `api_version` 3.
|
|
5
|
+
"description": "Response of GET /v1/version, the first call a client makes on connect (README: versioning). A core built from this contract reports `api_version` 3.3.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"additionalProperties": false,
|
|
8
8
|
"required": ["api_version", "core_version", "node"],
|
|
@@ -30,6 +30,16 @@ export declare function parseApiVersion(text: string): ApiVersion | null;
|
|
|
30
30
|
* `C == S` and `y >= x`. An unparseable version is never compatible.
|
|
31
31
|
*/
|
|
32
32
|
export declare function isCompatible(clientVersion: string, serverVersion: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The rule between two cores (contract/README.md, "Calls between cores"): a core calling a fleet
|
|
35
|
+
* member and the member it calls are compatible exactly when their MAJOR numbers are equal,
|
|
36
|
+
* whatever their two MINOR numbers. A member serves the routes its own MINOR has; the caller sends
|
|
37
|
+
* a route only to a member whose announced MINOR has it (`servesSince`). So a fleet upgrades one
|
|
38
|
+
* host at a time. An unparseable version is never compatible.
|
|
39
|
+
*/
|
|
40
|
+
export declare function isPeerCompatible(callerVersion: string, memberVersion: string): boolean;
|
|
41
|
+
/** Whether a member at `memberVersion` serves a route added in `since` (both `MAJOR.MINOR`, same MAJOR). */
|
|
42
|
+
export declare function servesSince(memberVersion: string, since: string): boolean;
|
|
33
43
|
/** HTTP status for an error code (api.json `errors`). */
|
|
34
44
|
export declare function httpStatusFor(code: ErrorCode): number;
|
|
35
45
|
/** CLI exit code for an error code: 1 for a user error, 2 for an environment error. */
|
package/dist/src/contract/api.js
CHANGED
|
@@ -18,6 +18,24 @@ export function isCompatible(clientVersion, serverVersion) {
|
|
|
18
18
|
const s = parseApiVersion(serverVersion);
|
|
19
19
|
return c !== null && s !== null && c.major === s.major && s.minor >= c.minor;
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* The rule between two cores (contract/README.md, "Calls between cores"): a core calling a fleet
|
|
23
|
+
* member and the member it calls are compatible exactly when their MAJOR numbers are equal,
|
|
24
|
+
* whatever their two MINOR numbers. A member serves the routes its own MINOR has; the caller sends
|
|
25
|
+
* a route only to a member whose announced MINOR has it (`servesSince`). So a fleet upgrades one
|
|
26
|
+
* host at a time. An unparseable version is never compatible.
|
|
27
|
+
*/
|
|
28
|
+
export function isPeerCompatible(callerVersion, memberVersion) {
|
|
29
|
+
const c = parseApiVersion(callerVersion);
|
|
30
|
+
const m = parseApiVersion(memberVersion);
|
|
31
|
+
return c !== null && m !== null && c.major === m.major;
|
|
32
|
+
}
|
|
33
|
+
/** Whether a member at `memberVersion` serves a route added in `since` (both `MAJOR.MINOR`, same MAJOR). */
|
|
34
|
+
export function servesSince(memberVersion, since) {
|
|
35
|
+
const m = parseApiVersion(memberVersion);
|
|
36
|
+
const s = parseApiVersion(since);
|
|
37
|
+
return m !== null && s !== null && m.major === s.major && m.minor >= s.minor;
|
|
38
|
+
}
|
|
21
39
|
/** HTTP status for an error code (api.json `errors`). */
|
|
22
40
|
export function httpStatusFor(code) {
|
|
23
41
|
return api.errors[code].http_status;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/contract/api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAcxC,MAAM,CAAC,MAAM,GAAG,GAAG,QAAQ,CAAC,UAAU,CAAa,CAAC;AAEpD,+EAA+E;AAC/E,MAAM,CAAC,MAAM,UAAU,GAAW,GAAG,CAAC,WAAW,CAAC;AAElD,+EAA+E;AAC/E,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAOvD,2DAA2D;AAC3D,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,MAAM,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACjE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,aAAqB,EAAE,aAAqB;IACvE,MAAM,CAAC,GAAG,eAAe,CAAC,aAAa,CAAC,CAAC;IACzC,MAAM,CAAC,GAAG,eAAe,CAAC,aAAa,CAAC,CAAC;IACzC,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC;AAC/E,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,aAAa,CAAC,IAAe;IAC3C,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;AACtC,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,WAAW,CAAC,IAAe;IACzC,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;AACpC,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,YAAY,CAAC,IAAe;IAC1C,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;AACpC,CAAC;AAED,oCAAoC;AACpC,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/contract/api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAcxC,MAAM,CAAC,MAAM,GAAG,GAAG,QAAQ,CAAC,UAAU,CAAa,CAAC;AAEpD,+EAA+E;AAC/E,MAAM,CAAC,MAAM,UAAU,GAAW,GAAG,CAAC,WAAW,CAAC;AAElD,+EAA+E;AAC/E,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAOvD,2DAA2D;AAC3D,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,MAAM,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACjE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,aAAqB,EAAE,aAAqB;IACvE,MAAM,CAAC,GAAG,eAAe,CAAC,aAAa,CAAC,CAAC;IACzC,MAAM,CAAC,GAAG,eAAe,CAAC,aAAa,CAAC,CAAC;IACzC,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC;AAC/E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,aAAqB,EAAE,aAAqB;IAC3E,MAAM,CAAC,GAAG,eAAe,CAAC,aAAa,CAAC,CAAC;IACzC,MAAM,CAAC,GAAG,eAAe,CAAC,aAAa,CAAC,CAAC;IACzC,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,CAAC;AACzD,CAAC;AAED,4GAA4G;AAC5G,MAAM,UAAU,WAAW,CAAC,aAAqB,EAAE,KAAa;IAC9D,MAAM,CAAC,GAAG,eAAe,CAAC,aAAa,CAAC,CAAC;IACzC,MAAM,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IACjC,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC;AAC/E,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,aAAa,CAAC,IAAe;IAC3C,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;AACtC,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,WAAW,CAAC,IAAe;IACzC,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;AACpC,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,YAAY,CAAC,IAAe;IAC1C,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;AACpC,CAAC;AAED,oCAAoC;AACpC,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAgB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ApiVersion, MeshNode } from "./common.js";
|
|
2
|
+
/** 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. */
|
|
3
|
+
export type MemberList = {
|
|
4
|
+
/** This core's own node name. This core is not an entry of `members`. */
|
|
5
|
+
node: MeshNode;
|
|
6
|
+
/** `off` when the fleet transport is not configured: nothing is announced or heard, and both lists are empty. */
|
|
7
|
+
transport: "on" | "off";
|
|
8
|
+
/** How often this core announces itself to the peers in its local address list. */
|
|
9
|
+
announce_interval_ms: number;
|
|
10
|
+
/** How long a member may stay silent before it is dropped. It leaves the list within this time plus one sweep (1 s). */
|
|
11
|
+
silence_ms: number;
|
|
12
|
+
members: Member[];
|
|
13
|
+
refused: Refusal[];
|
|
14
|
+
};
|
|
15
|
+
/** SHA-256 of a member's public key, lowercase hex. Public: it identifies the key, it gives no access. */
|
|
16
|
+
export type Fingerprint = string;
|
|
17
|
+
/** 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. */
|
|
18
|
+
export type Member = {
|
|
19
|
+
node: MeshNode;
|
|
20
|
+
fingerprint: Fingerprint;
|
|
21
|
+
/** The control API version the member announced. */
|
|
22
|
+
api_version: ApiVersion;
|
|
23
|
+
/** The sequence number of the member's last announcement heard. */
|
|
24
|
+
seq: number;
|
|
25
|
+
/** Milliseconds since this core last heard the member, on this core's monotonic clock. */
|
|
26
|
+
heard_ms_ago: number;
|
|
27
|
+
};
|
|
28
|
+
/** 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. */
|
|
29
|
+
export type Refusal = {
|
|
30
|
+
node: MeshNode;
|
|
31
|
+
trusted_as: MeshNode;
|
|
32
|
+
fingerprint: Fingerprint;
|
|
33
|
+
reason: string;
|
|
34
|
+
count: number;
|
|
35
|
+
heard_ms_ago: number;
|
|
36
|
+
};
|
|
37
|
+
/** 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. */
|
|
38
|
+
export type AnnounceRefusal = {
|
|
39
|
+
code: "conflict";
|
|
40
|
+
message: string;
|
|
41
|
+
retryable: boolean;
|
|
42
|
+
};
|
|
43
|
+
/** 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. */
|
|
44
|
+
export type Announcement = {
|
|
45
|
+
node: MeshNode;
|
|
46
|
+
api_version: ApiVersion;
|
|
47
|
+
seq: number;
|
|
48
|
+
/** `up` while the core runs; `leaving` once, on a clean stop, so that its peers drop it at once. */
|
|
49
|
+
state: "up" | "leaving";
|
|
50
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fleet.js","sourceRoot":"","sources":["../../../../src/contract/generated/fleet.ts"],"names":[],"mappings":"AAAA,0FAA0F"}
|
|
@@ -6,8 +6,12 @@ import type { Common, MeshNode, Suffix, MeshId, Ulid, RunId, SessionId, ActionId
|
|
|
6
6
|
import type { ControlAction, ActionKind, ActionRecord, SubmitRequest, SubmitResponse, Warning, SteerRequest, CancelRequest, PauseRequest, ResumeRequest, AnswerRequest, Decision, ChoiceIds, AcceptedResponse } from "./control-action.js";
|
|
7
7
|
import type { ErrorResponse, ErrorCode, ErrorBody, Limit, HeldSignal } from "./error.js";
|
|
8
8
|
import type { RunEvent, EventKind, StateData, OutputData, ControlData, RefusedData, ErrorData, Question, Choice, ChoiceId, QuestionData, AnswerData, EventPage } from "./event.js";
|
|
9
|
+
import type { MemberList, Fingerprint, Member, Refusal, AnnounceRefusal, Announcement } from "./fleet.js";
|
|
10
|
+
import type { RunView, Unreachable } from "./reachability.js";
|
|
11
|
+
import type { RemoteRun, RepoAlias, RemoteSubmitRequest, RemoteSubmitResponse, AliasList, AliasFile } from "./remote.js";
|
|
9
12
|
import type { Run, RunState, ActiveState, TerminalState, Submitter, RunList, RunResult } from "./run.js";
|
|
10
13
|
import type { Session } from "./session.js";
|
|
14
|
+
import type { UnreadableRunList, UnreadableRun } from "./unreadable.js";
|
|
11
15
|
import type { Version } from "./version.js";
|
|
12
16
|
export type { Agent, AgentList } from "./agent.js";
|
|
13
17
|
export type { Allowlist } from "./allowlist.js";
|
|
@@ -17,8 +21,12 @@ export type { Common, MeshNode, Suffix, MeshId, Ulid, RunId, SessionId, ActionId
|
|
|
17
21
|
export type { ControlAction, ActionKind, ActionRecord, SubmitRequest, SubmitResponse, Warning, SteerRequest, CancelRequest, PauseRequest, ResumeRequest, AnswerRequest, Decision, ChoiceIds, AcceptedResponse } from "./control-action.js";
|
|
18
22
|
export type { ErrorResponse, ErrorCode, ErrorBody, Limit, HeldSignal } from "./error.js";
|
|
19
23
|
export type { RunEvent, EventKind, StateData, OutputData, ControlData, RefusedData, ErrorData, Question, Choice, ChoiceId, QuestionData, AnswerData, EventPage } from "./event.js";
|
|
24
|
+
export type { MemberList, Fingerprint, Member, Refusal, AnnounceRefusal, Announcement } from "./fleet.js";
|
|
25
|
+
export type { RunView, Unreachable } from "./reachability.js";
|
|
26
|
+
export type { RemoteRun, RepoAlias, RemoteSubmitRequest, RemoteSubmitResponse, AliasList, AliasFile } from "./remote.js";
|
|
20
27
|
export type { Run, RunState, ActiveState, TerminalState, Submitter, RunList, RunResult } from "./run.js";
|
|
21
28
|
export type { Session } from "./session.js";
|
|
29
|
+
export type { UnreadableRunList, UnreadableRun } from "./unreadable.js";
|
|
22
30
|
export type { Version } from "./version.js";
|
|
23
31
|
/** Schema target (`<file stem>` or `<file stem>#<$defs name>`) to its payload type. */
|
|
24
32
|
export interface SchemaTypes {
|
|
@@ -94,6 +102,20 @@ export interface SchemaTypes {
|
|
|
94
102
|
"event#question_data": QuestionData;
|
|
95
103
|
"event#answer_data": AnswerData;
|
|
96
104
|
"event#event_page": EventPage;
|
|
105
|
+
"fleet": MemberList;
|
|
106
|
+
"fleet#fingerprint": Fingerprint;
|
|
107
|
+
"fleet#member": Member;
|
|
108
|
+
"fleet#refusal": Refusal;
|
|
109
|
+
"fleet#announce_refusal": AnnounceRefusal;
|
|
110
|
+
"fleet#announcement": Announcement;
|
|
111
|
+
"reachability": RunView;
|
|
112
|
+
"reachability#unreachable": Unreachable;
|
|
113
|
+
"remote": RemoteRun;
|
|
114
|
+
"remote#alias": RepoAlias;
|
|
115
|
+
"remote#submit_request": RemoteSubmitRequest;
|
|
116
|
+
"remote#submit_response": RemoteSubmitResponse;
|
|
117
|
+
"remote#alias_list": AliasList;
|
|
118
|
+
"remote#alias_file": AliasFile;
|
|
97
119
|
"run": Run;
|
|
98
120
|
"run#state": RunState;
|
|
99
121
|
"run#active_state": ActiveState;
|
|
@@ -102,5 +124,7 @@ export interface SchemaTypes {
|
|
|
102
124
|
"run#run_list": RunList;
|
|
103
125
|
"run#run_result": RunResult;
|
|
104
126
|
"session": Session;
|
|
127
|
+
"unreadable": UnreadableRunList;
|
|
128
|
+
"unreadable#unreadable_run": UnreadableRun;
|
|
105
129
|
"version": Version;
|
|
106
130
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { MeshNode, RunId } from "./common.js";
|
|
2
|
+
import type { RemoteRun } from "./remote.js";
|
|
3
|
+
/** 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. */
|
|
4
|
+
export type RunView = {
|
|
5
|
+
run_id: RunId;
|
|
6
|
+
/** The member the run id names. */
|
|
7
|
+
node: MeshNode;
|
|
8
|
+
/** `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. */
|
|
9
|
+
view: "reachable" | "unreachable";
|
|
10
|
+
/** Present exactly when `view` is `reachable`: the run as the member answered. */
|
|
11
|
+
run?: RemoteRun;
|
|
12
|
+
/** Present exactly when `view` is `unreachable`. */
|
|
13
|
+
unreachable?: Unreachable;
|
|
14
|
+
};
|
|
15
|
+
export type Unreachable = {
|
|
16
|
+
/** `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). */
|
|
17
|
+
reason: "not_listed" | "no_answer";
|
|
18
|
+
/** This core's message about why, at most 500 characters. */
|
|
19
|
+
detail: string;
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reachability.js","sourceRoot":"","sources":["../../../../src/contract/generated/reachability.ts"],"names":[],"mappings":"AAAA,iGAAiG"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { CallerText, Cursor, GitSha, HarnessId, IdempotencyKey, MeshId, MeshNode, NullableTimestamp, Principal, RepoPath, RunId, Timestamp } from "./common.js";
|
|
2
|
+
import type { Warning } from "./control-action.js";
|
|
3
|
+
import type { RunState, Submitter } from "./run.js";
|
|
4
|
+
/** A run on another fleet member, as a caller sees it (added in 3.2): response of GET /v1/fleet/runs/{run_id}, and the `run` of a remote submit. It is the executing core's run without its repository path, which stays private to the executing host (docs/d2/part-two-design.md, Decision 4). Every timestamp is the executing core's clock; a caller never compares one with its own clock. */
|
|
5
|
+
export type RemoteRun = {
|
|
6
|
+
id: RunId;
|
|
7
|
+
agent_id: MeshId;
|
|
8
|
+
harness: HarnessId;
|
|
9
|
+
state: RunState;
|
|
10
|
+
terminal: boolean;
|
|
11
|
+
/** Cursor of the newest event in the run's event log on the executing core. */
|
|
12
|
+
cursor: Cursor;
|
|
13
|
+
/** Who submitted the run, as the executing core established it. For a run submitted over the fleet transport it is `member` with the node name the executing core's trust list gives the caller's key. */
|
|
14
|
+
submitter: Submitter;
|
|
15
|
+
/** The commit of the aliased checkout the run starts from: the named `base_commit` of the submit, else the executing host's HEAD when it accepted the submit. */
|
|
16
|
+
base_commit: GitSha;
|
|
17
|
+
/** When the run must be terminal, on the executing core's clock: its clock at acceptance plus the submit's `deadline_ms`. Null without a deadline. */
|
|
18
|
+
deadline: NullableTimestamp;
|
|
19
|
+
created_at: Timestamp;
|
|
20
|
+
updated_at: Timestamp;
|
|
21
|
+
};
|
|
22
|
+
/** A name the operator of a host gives one of its checkouts. The operator asserts that the same alias names the same repository on each host; the core never infers it and checks only a named commit. */
|
|
23
|
+
export type RepoAlias = string;
|
|
24
|
+
/** Body of POST /v1/fleet/runs (added in 3.2), on the control socket and over the fleet transport alike. The node of `agent_id` names the member that executes the run: the caller chooses the host, and nothing schedules. The repository is named by `alias`, as the executing host defines it; no path crosses the network. Optional fields are omitted, never null. No field sets the run's `submitter`. */
|
|
25
|
+
export type RemoteSubmitRequest = {
|
|
26
|
+
agent_id: MeshId;
|
|
27
|
+
harness: HarnessId;
|
|
28
|
+
alias: RepoAlias;
|
|
29
|
+
task: CallerText;
|
|
30
|
+
caller: Principal;
|
|
31
|
+
idempotency_key?: IdempotencyKey;
|
|
32
|
+
/** How long the run may take, in milliseconds, counted on the executing core's clock from when it accepts the submit. A duration, never an absolute time: no timestamp from the caller's clock is sent (spec c42). At most 30 days. */
|
|
33
|
+
deadline_ms?: number;
|
|
34
|
+
/** The full commit id the run must start from. The executing core refuses the submit with `invalid` when its aliased checkout lacks that commit, and fetches nothing. When omitted, the run starts from the executing host's HEAD at acceptance, which the response returns. */
|
|
35
|
+
base_commit?: GitSha;
|
|
36
|
+
};
|
|
37
|
+
/** 201 response of POST /v1/fleet/runs. For a new run it is in state `queued`. When `replayed` is true the idempotency key matched an earlier submit of the same member: nothing was created and `run` is that first run as it is now. */
|
|
38
|
+
export type RemoteSubmitResponse = {
|
|
39
|
+
run: RemoteRun;
|
|
40
|
+
/** True when the request repeated an earlier submit with the same idempotency key. Omitted otherwise. */
|
|
41
|
+
replayed?: boolean;
|
|
42
|
+
/** Things the caller should know about a run that was admitted all the same. Omitted when there are none. */
|
|
43
|
+
warnings?: Warning[];
|
|
44
|
+
};
|
|
45
|
+
/** Response of GET /v1/fleet/aliases (added in 3.2): the aliases a member defines, each with the agent and harness pairs its allow-list permits on the aliased checkout. No path is reported. */
|
|
46
|
+
export type AliasList = {
|
|
47
|
+
/** The member whose aliases these are. */
|
|
48
|
+
node: MeshNode;
|
|
49
|
+
aliases: {
|
|
50
|
+
alias: RepoAlias;
|
|
51
|
+
permits: {
|
|
52
|
+
agent_id: MeshId;
|
|
53
|
+
harness: HarnessId;
|
|
54
|
+
}[];
|
|
55
|
+
}[];
|
|
56
|
+
};
|
|
57
|
+
/** The core's local alias file, `${XDG_CONFIG_HOME:-$HOME/.config}/culture-agents/fleet/aliases.json` (added in 3.2). Not an API payload: no route reads or writes it, and it is never tracked. Each alias resolves to an absolute path on this host; a submit through it is allowed only when the allow-list permits the agent and harness on that path. */
|
|
58
|
+
export type AliasFile = {
|
|
59
|
+
version: 1;
|
|
60
|
+
aliases: {
|
|
61
|
+
alias: RepoAlias;
|
|
62
|
+
repo: RepoPath;
|
|
63
|
+
}[];
|
|
64
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote.js","sourceRoot":"","sources":["../../../../src/contract/generated/remote.ts"],"names":[],"mappings":"AAAA,2FAA2F"}
|
|
@@ -43,7 +43,7 @@ export type RunState = "queued" | "running" | "cancelling" | "succeeded" | "fail
|
|
|
43
43
|
export type ActiveState = "queued" | "running" | "cancelling";
|
|
44
44
|
/** A final state. `unanswered`: a question the run asked its operator passed its own time limit. `unknown`: the outcome cannot be established; it is never a success. */
|
|
45
45
|
export type TerminalState = "succeeded" | "failed" | "cancelled" | "timed_out" | "unknown" | "unanswered";
|
|
46
|
-
/** Who submitted a run, as the core established it. `local_user`: the request arrived on the core's own control socket, and `uid` is the operating-system user that owns that socket. `member`: the request arrived from another core, and `node` is the fleet member the connection authenticated as. No request field sets or changes it. */
|
|
46
|
+
/** Who submitted a run, as the core established it. `local_user`: the request arrived on the core's own control socket, and `uid` is the operating-system user that owns that socket. `member`: the request arrived from another core, and `node` is the fleet member the connection authenticated as, `key` (3.3) the fingerprint of the key it authenticated with. No request field sets or changes it. */
|
|
47
47
|
export type Submitter = {
|
|
48
48
|
kind: "local_user" | "member";
|
|
49
49
|
/** local_user only: the numeric id of the user that owns the control socket. */
|
|
@@ -52,6 +52,8 @@ export type Submitter = {
|
|
|
52
52
|
user?: string;
|
|
53
53
|
/** member only: the node name of the authenticated fleet member. */
|
|
54
54
|
node?: MeshNode;
|
|
55
|
+
/** member only (3.3, optional): the SHA-256 fingerprint, hex, of the public key the member authenticated with at submit. A member acts on a run only with this key (a node name moved to another key does not inherit its runs); a run without it is matched by node. */
|
|
56
|
+
key?: string;
|
|
55
57
|
};
|
|
56
58
|
/** Response of GET /v1/runs: newest first by created_at. */
|
|
57
59
|
export type RunList = {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RunId } from "./common.js";
|
|
2
|
+
/** Response of GET /v1/runs/unreadable (added in 3.2): every run directory in this core's store that the core cannot read, with the run id (the directory's name) and the reason. A run listed here is not absent and not failed: its state is unknown to this core. Listing it changes nothing in its directory. `runs.list` skips these runs; this is the one place that names them. */
|
|
3
|
+
export type UnreadableRunList = {
|
|
4
|
+
/** How many run directories cannot be read. Equals the length of `runs`. */
|
|
5
|
+
count: number;
|
|
6
|
+
runs: UnreadableRun[];
|
|
7
|
+
};
|
|
8
|
+
export type UnreadableRun = {
|
|
9
|
+
/** The run directory's name, which is the run id. A directory whose name is not a run id is not a run directory and is not listed. */
|
|
10
|
+
run_id: RunId;
|
|
11
|
+
/** `newer_version`: written by a newer store schema than this core reads (nothing in it is read past the version file, and nothing in it is changed). `corrupt_record`: the run's record file is missing, not JSON or not a run. `unreadable_log`: the event log is corrupt or cannot be read. `other`: any other reason (an unreadable version file, liveness that cannot be read); `detail` says which. */
|
|
12
|
+
reason: "newer_version" | "corrupt_record" | "unreadable_log" | "other";
|
|
13
|
+
/** The core's message about why, at most 500 characters. It is text from a directory the core does not control: show it escaped. */
|
|
14
|
+
detail: string;
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unreadable.js","sourceRoot":"","sources":["../../../../src/contract/generated/unreadable.ts"],"names":[],"mappings":"AAAA,+FAA+F"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ApiVersion, MeshNode } from "./common.js";
|
|
2
|
-
/** Response of GET /v1/version, the first call a client makes on connect (README: versioning). A core built from this contract reports `api_version` 3.
|
|
2
|
+
/** Response of GET /v1/version, the first call a client makes on connect (README: versioning). A core built from this contract reports `api_version` 3.3. */
|
|
3
3
|
export type Version = {
|
|
4
4
|
api_version: ApiVersion;
|
|
5
5
|
/** The core package's own release version (semver); informational, never used for compatibility. */
|
|
@@ -10,7 +10,7 @@ export { ContractValidationError } from "./errors.js";
|
|
|
10
10
|
export type { ValidationIssue } from "./errors.js";
|
|
11
11
|
export { assertValid, schemaNames, validate } from "./validate.js";
|
|
12
12
|
export type { SchemaName, ValidationResult } from "./validate.js";
|
|
13
|
-
export { API_VERSION_HEADER, apiVersion, errorCodes, exitCodeFor, httpStatusFor, isCompatible, parseApiVersion, retryableFor, } from "./api.js";
|
|
13
|
+
export { API_VERSION_HEADER, apiVersion, errorCodes, exitCodeFor, httpStatusFor, isCompatible, isPeerCompatible, servesSince, parseApiVersion, retryableFor, } from "./api.js";
|
|
14
14
|
export type { ApiVersion } from "./api.js";
|
|
15
15
|
export { canTransition, initialState, isActive, isTerminal, nextStates, runStates } from "./run-state.js";
|
|
16
16
|
export { buildActionId, buildMeshId, buildQuestionId, buildRunId, buildSessionId, isActionId, isQuestionId, isRunId, isSessionId, newUlid, parseMeshId, parseScopedId, runBranch, } from "./ids.js";
|
|
@@ -7,7 +7,7 @@ export * from "./generated/index.js";
|
|
|
7
7
|
export { SCHEMA_BASE, loadSchemaFiles, schemaDir } from "./schemas.js";
|
|
8
8
|
export { ContractValidationError } from "./errors.js";
|
|
9
9
|
export { assertValid, schemaNames, validate } from "./validate.js";
|
|
10
|
-
export { API_VERSION_HEADER, apiVersion, errorCodes, exitCodeFor, httpStatusFor, isCompatible, parseApiVersion, retryableFor, } from "./api.js";
|
|
10
|
+
export { API_VERSION_HEADER, apiVersion, errorCodes, exitCodeFor, httpStatusFor, isCompatible, isPeerCompatible, servesSince, parseApiVersion, retryableFor, } from "./api.js";
|
|
11
11
|
export { canTransition, initialState, isActive, isTerminal, nextStates, runStates } from "./run-state.js";
|
|
12
12
|
export { buildActionId, buildMeshId, buildQuestionId, buildRunId, buildSessionId, isActionId, isQuestionId, isRunId, isSessionId, newUlid, parseMeshId, parseScopedId, runBranch, } from "./ids.js";
|
|
13
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/contract/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,EACL,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,WAAW,EACX,aAAa,EACb,YAAY,EACZ,eAAe,EACf,YAAY,GACb,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC1G,OAAO,EACL,aAAa,EACb,WAAW,EACX,eAAe,EACf,UAAU,EACV,cAAc,EACd,UAAU,EACV,YAAY,EACZ,OAAO,EACP,WAAW,EACX,OAAO,EACP,WAAW,EACX,aAAa,EACb,SAAS,GACV,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/contract/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,EACL,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,WAAW,EACX,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,YAAY,GACb,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC1G,OAAO,EACL,aAAa,EACb,WAAW,EACX,eAAe,EACf,UAAU,EACV,cAAc,EACd,UAAU,EACV,YAAY,EACZ,OAAO,EACP,WAAW,EACX,OAAO,EACP,WAAW,EACX,aAAa,EACb,SAAS,GACV,MAAM,UAAU,CAAC"}
|