@culture.dev/agents 0.15.2 → 0.16.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 +22 -0
- package/dist/contract-schemas/api.json +73 -15
- package/dist/contract-schemas/branches.json +163 -0
- package/dist/contract-schemas/capabilities.json +133 -6
- package/dist/contract-schemas/common.json +9 -3
- package/dist/contract-schemas/control-action.json +91 -14
- package/dist/contract-schemas/error.json +189 -48
- package/dist/contract-schemas/event.json +185 -2
- package/dist/contract-schemas/run.json +111 -4
- package/dist/contract-schemas/version.json +2 -2
- package/dist/src/contract/generated/branches.d.ts +34 -0
- package/dist/src/contract/generated/branches.js +3 -0
- package/dist/src/contract/generated/branches.js.map +1 -0
- package/dist/src/contract/generated/capabilities.d.ts +39 -7
- package/dist/src/contract/generated/common.d.ts +5 -3
- package/dist/src/contract/generated/control-action.d.ts +30 -11
- package/dist/src/contract/generated/error.d.ts +31 -7
- package/dist/src/contract/generated/event.d.ts +57 -8
- package/dist/src/contract/generated/index.d.ts +37 -12
- package/dist/src/contract/generated/run.d.ts +23 -5
- package/dist/src/contract/generated/version.d.ts +2 -2
- package/dist/src/contract/ids.d.ts +6 -3
- package/dist/src/contract/ids.js +5 -2
- package/dist/src/contract/ids.js.map +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/branch-routes.d.ts +13 -0
- package/dist/src/daemon/branch-routes.js +41 -0
- package/dist/src/daemon/branch-routes.js.map +1 -0
- package/dist/src/daemon/daemon.js +10 -2
- package/dist/src/daemon/daemon.js.map +1 -1
- package/dist/src/daemon/harness-catalog.d.ts +6 -0
- package/dist/src/daemon/harness-catalog.js +20 -0
- package/dist/src/daemon/harness-catalog.js.map +1 -1
- package/dist/src/daemon/limits.d.ts +31 -0
- package/dist/src/daemon/limits.js +61 -0
- package/dist/src/daemon/limits.js.map +1 -0
- package/dist/src/daemon/main.d.ts +10 -0
- package/dist/src/daemon/main.js +161 -41
- package/dist/src/daemon/main.js.map +1 -1
- package/dist/src/daemon/ports.d.ts +21 -11
- package/dist/src/daemon/routes.d.ts +3 -0
- package/dist/src/daemon/routes.js +26 -5
- package/dist/src/daemon/routes.js.map +1 -1
- package/dist/src/daemon/secrets.d.ts +24 -0
- package/dist/src/daemon/secrets.js +52 -0
- package/dist/src/daemon/secrets.js.map +1 -0
- package/dist/src/daemon/submitter.d.ts +9 -0
- package/dist/src/daemon/submitter.js +23 -0
- package/dist/src/daemon/submitter.js.map +1 -0
- package/dist/src/harness/claude-code/index.js +1 -1
- package/dist/src/harness/claude-code/index.js.map +1 -1
- package/dist/src/harness/common/capabilities.d.ts +26 -2
- package/dist/src/harness/common/capabilities.js +31 -6
- package/dist/src/harness/common/capabilities.js.map +1 -1
- package/dist/src/harness/common/guard.d.ts +2 -1
- package/dist/src/harness/common/guard.js +6 -0
- package/dist/src/harness/common/guard.js.map +1 -1
- package/dist/src/harness/common/run-driver.d.ts +6 -1
- package/dist/src/harness/common/run-driver.js +20 -3
- package/dist/src/harness/common/run-driver.js.map +1 -1
- package/dist/src/harness/common/sandbox-workspace.d.ts +5 -1
- package/dist/src/harness/common/sandbox-workspace.js +12 -3
- package/dist/src/harness/common/sandbox-workspace.js.map +1 -1
- package/dist/src/harness/common/types.d.ts +8 -0
- package/dist/src/harness/config.d.ts +5 -0
- package/dist/src/harness/config.js +7 -3
- package/dist/src/harness/config.js.map +1 -1
- package/dist/src/harness/index.js +2 -2
- package/dist/src/harness/index.js.map +1 -1
- package/dist/src/harness/opencode/index.js +1 -1
- package/dist/src/harness/opencode/index.js.map +1 -1
- package/dist/src/harness/stub/backend.d.ts +3 -0
- package/dist/src/harness/stub/backend.js +50 -1
- package/dist/src/harness/stub/backend.js.map +1 -1
- package/dist/src/harness/stub/index.d.ts +7 -1
- package/dist/src/harness/stub/index.js +10 -2
- package/dist/src/harness/stub/index.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/publish/config.d.ts +25 -0
- package/dist/src/publish/config.js +47 -0
- package/dist/src/publish/config.js.map +1 -0
- package/dist/src/publish/envelope.d.ts +61 -0
- package/dist/src/publish/envelope.js +109 -0
- package/dist/src/publish/envelope.js.map +1 -0
- package/dist/src/publish/index.d.ts +22 -0
- package/dist/src/publish/index.js +35 -0
- package/dist/src/publish/index.js.map +1 -0
- package/dist/src/publish/log-tail.d.ts +31 -0
- package/dist/src/publish/log-tail.js +172 -0
- package/dist/src/publish/log-tail.js.map +1 -0
- package/dist/src/publish/publisher.d.ts +34 -0
- package/dist/src/publish/publisher.js +207 -0
- package/dist/src/publish/publisher.js.map +1 -0
- package/dist/src/publish/transport.d.ts +14 -0
- package/dist/src/publish/transport.js +69 -0
- package/dist/src/publish/transport.js.map +1 -0
- package/dist/src/runs/admission.d.ts +27 -0
- package/dist/src/runs/admission.js +97 -0
- package/dist/src/runs/admission.js.map +1 -0
- package/dist/src/runs/answer.d.ts +24 -0
- package/dist/src/runs/answer.js +99 -0
- package/dist/src/runs/answer.js.map +1 -0
- package/dist/src/runs/base-commit.d.ts +6 -0
- package/dist/src/runs/base-commit.js +23 -0
- package/dist/src/runs/base-commit.js.map +1 -0
- package/dist/src/runs/branches.d.ts +23 -0
- package/dist/src/runs/branches.js +115 -0
- package/dist/src/runs/branches.js.map +1 -0
- package/dist/src/runs/control.d.ts +12 -4
- package/dist/src/runs/control.js +14 -6
- package/dist/src/runs/control.js.map +1 -1
- package/dist/src/runs/gateway.d.ts +25 -0
- package/dist/src/runs/gateway.js +122 -0
- package/dist/src/runs/gateway.js.map +1 -0
- package/dist/src/runs/keys.d.ts +21 -0
- package/dist/src/runs/keys.js +50 -0
- package/dist/src/runs/keys.js.map +1 -0
- package/dist/src/runs/limits.d.ts +15 -0
- package/dist/src/runs/limits.js +37 -0
- package/dist/src/runs/limits.js.map +1 -0
- package/dist/src/runs/ports.d.ts +3 -0
- package/dist/src/runs/ports.js.map +1 -1
- package/dist/src/runs/reattach.d.ts +37 -0
- package/dist/src/runs/reattach.js +70 -0
- package/dist/src/runs/reattach.js.map +1 -0
- package/dist/src/runs/scan.d.ts +11 -6
- package/dist/src/runs/scan.js +12 -15
- package/dist/src/runs/scan.js.map +1 -1
- package/dist/src/runs/service.d.ts +57 -7
- package/dist/src/runs/service.js +160 -95
- package/dist/src/runs/service.js.map +1 -1
- package/dist/src/runs/submit.d.ts +34 -0
- package/dist/src/runs/submit.js +92 -0
- package/dist/src/runs/submit.js.map +1 -0
- package/dist/src/sandbox/host-command.js +5 -1
- package/dist/src/sandbox/host-command.js.map +1 -1
- package/dist/src/sandbox/run-sandbox.d.ts +8 -2
- package/dist/src/sandbox/run-sandbox.js +10 -3
- package/dist/src/sandbox/run-sandbox.js.map +1 -1
- package/dist/src/store/derive.js +3 -0
- package/dist/src/store/derive.js.map +1 -1
- package/dist/src/store/entries.d.ts +29 -0
- package/dist/src/store/entries.js +41 -0
- package/dist/src/store/entries.js.map +1 -0
- package/dist/src/store/event-log.d.ts +3 -3
- package/dist/src/store/event-log.js +2 -2
- package/dist/src/store/event-log.js.map +1 -1
- package/dist/src/store/files.d.ts +4 -0
- package/dist/src/store/files.js +4 -0
- package/dist/src/store/files.js.map +1 -1
- package/dist/src/store/idempotency.d.ts +79 -0
- package/dist/src/store/idempotency.js +281 -0
- package/dist/src/store/idempotency.js.map +1 -0
- package/dist/src/store/index.d.ts +8 -0
- package/dist/src/store/index.js +5 -0
- package/dist/src/store/index.js.map +1 -1
- package/dist/src/store/questions.d.ts +40 -0
- package/dist/src/store/questions.js +90 -0
- package/dist/src/store/questions.js.map +1 -0
- package/dist/src/store/retention.d.ts +13 -0
- package/dist/src/store/retention.js +74 -0
- package/dist/src/store/retention.js.map +1 -0
- package/dist/src/store/run-store.d.ts +4 -0
- package/dist/src/store/run-store.js +20 -4
- package/dist/src/store/run-store.js.map +1 -1
- package/dist/src/store/startup.d.ts +9 -0
- package/dist/src/store/startup.js +92 -0
- package/dist/src/store/startup.js.map +1 -0
- package/dist/src/store/summary.d.ts +7 -0
- package/dist/src/store/summary.js +126 -0
- package/dist/src/store/summary.js.map +1 -0
- package/dist/src/store/version.d.ts +10 -0
- package/dist/src/store/version.js +46 -0
- package/dist/src/store/version.js.map +1 -0
- package/dist/src/trace/config.d.ts +31 -0
- package/dist/src/trace/config.js +69 -0
- package/dist/src/trace/config.js.map +1 -0
- package/dist/src/trace/follower.d.ts +20 -0
- package/dist/src/trace/follower.js +196 -0
- package/dist/src/trace/follower.js.map +1 -0
- package/dist/src/trace/index.d.ts +21 -0
- package/dist/src/trace/index.js +42 -0
- package/dist/src/trace/index.js.map +1 -0
- package/dist/src/trace/otlp.d.ts +11 -0
- package/dist/src/trace/otlp.js +52 -0
- package/dist/src/trace/otlp.js.map +1 -0
- package/dist/src/trace/spans.d.ts +28 -0
- package/dist/src/trace/spans.js +120 -0
- package/dist/src/trace/spans.js.map +1 -0
- package/dist/src/worker/answer.d.ts +29 -0
- package/dist/src/worker/answer.js +53 -0
- package/dist/src/worker/answer.js.map +1 -0
- package/dist/src/worker/asking.d.ts +22 -0
- package/dist/src/worker/asking.js +21 -0
- package/dist/src/worker/asking.js.map +1 -0
- package/dist/src/worker/control.d.ts +7 -1
- package/dist/src/worker/control.js +22 -10
- package/dist/src/worker/control.js.map +1 -1
- package/dist/src/worker/delivery.d.ts +2 -2
- package/dist/src/worker/delivery.js +1 -1
- package/dist/src/worker/delivery.js.map +1 -1
- package/dist/src/worker/driver.d.ts +46 -1
- package/dist/src/worker/fake-driver.d.ts +35 -1
- package/dist/src/worker/fake-driver.js +45 -0
- package/dist/src/worker/fake-driver.js.map +1 -1
- package/dist/src/worker/main.js +4 -1
- package/dist/src/worker/main.js.map +1 -1
- package/dist/src/worker/questions.d.ts +67 -0
- package/dist/src/worker/questions.js +152 -0
- package/dist/src/worker/questions.js.map +1 -0
- package/dist/src/worker/run-loop.d.ts +19 -1
- package/dist/src/worker/run-loop.js +91 -25
- package/dist/src/worker/run-loop.js.map +1 -1
- package/dist/src/worker/spawn.d.ts +9 -1
- package/dist/src/worker/spawn.js +12 -3
- package/dist/src/worker/spawn.js.map +1 -1
- package/package.json +3 -2
- package/policy/profiles/culture-agents-claude-subscription.yaml +1 -1
- package/policy/profiles/culture-agents-local-gateway.yaml +1 -1
|
@@ -46,10 +46,18 @@
|
|
|
46
46
|
"task": {
|
|
47
47
|
"$ref": "common.json#/$defs/text"
|
|
48
48
|
},
|
|
49
|
+
"base_commit": {
|
|
50
|
+
"description": "The commit of `repo` the run starts from, resolved by the core when the submit was accepted. Absent only on a run recorded before the core set it (README: authorization).",
|
|
51
|
+
"$ref": "common.json#/$defs/git_sha"
|
|
52
|
+
},
|
|
49
53
|
"owner": {
|
|
50
|
-
"description": "The principal
|
|
54
|
+
"description": "The principal named by the submit request's `caller`, recorded as supplied and not authenticated. See `submitter` for what the core established.",
|
|
51
55
|
"$ref": "common.json#/$defs/principal"
|
|
52
56
|
},
|
|
57
|
+
"submitter": {
|
|
58
|
+
"description": "Who submitted the run, as the core established it and never from a request field. Absent only on a run recorded before the core set it (README: authorization).",
|
|
59
|
+
"$ref": "#/$defs/submitter"
|
|
60
|
+
},
|
|
53
61
|
"idempotency_key": {
|
|
54
62
|
"oneOf": [
|
|
55
63
|
{
|
|
@@ -94,8 +102,15 @@
|
|
|
94
102
|
"description": "Cursor of the newest event in the run's event log.",
|
|
95
103
|
"$ref": "common.json#/$defs/cursor"
|
|
96
104
|
},
|
|
105
|
+
"pending_questions": {
|
|
106
|
+
"description": "Questions the run has asked its operator that have no answer yet, oldest first, read from the run's event log. Empty when it is waiting for nothing. Absent when the core does not report questions.",
|
|
107
|
+
"type": "array",
|
|
108
|
+
"items": {
|
|
109
|
+
"$ref": "event.json#/$defs/question"
|
|
110
|
+
}
|
|
111
|
+
},
|
|
97
112
|
"live_control": {
|
|
98
|
-
"description": "True when this core can deliver steer and
|
|
113
|
+
"description": "True when this core can deliver steer, cancel and answer to the run's worker. False for every terminal run, and for a run whose worker this core has not reattached to.",
|
|
99
114
|
"type": "boolean"
|
|
100
115
|
},
|
|
101
116
|
"worker_pid": {
|
|
@@ -141,6 +156,9 @@
|
|
|
141
156
|
},
|
|
142
157
|
"ended_at": {
|
|
143
158
|
"$ref": "common.json#/$defs/timestamp"
|
|
159
|
+
},
|
|
160
|
+
"pending_questions": {
|
|
161
|
+
"maxItems": 0
|
|
144
162
|
}
|
|
145
163
|
}
|
|
146
164
|
},
|
|
@@ -205,7 +223,8 @@
|
|
|
205
223
|
"failed",
|
|
206
224
|
"cancelled",
|
|
207
225
|
"timed_out",
|
|
208
|
-
"unknown"
|
|
226
|
+
"unknown",
|
|
227
|
+
"unanswered"
|
|
209
228
|
]
|
|
210
229
|
},
|
|
211
230
|
"active_state": {
|
|
@@ -221,7 +240,95 @@
|
|
|
221
240
|
"failed",
|
|
222
241
|
"cancelled",
|
|
223
242
|
"timed_out",
|
|
224
|
-
"unknown"
|
|
243
|
+
"unknown",
|
|
244
|
+
"unanswered"
|
|
245
|
+
],
|
|
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
|
+
},
|
|
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.",
|
|
250
|
+
"type": "object",
|
|
251
|
+
"additionalProperties": false,
|
|
252
|
+
"required": [
|
|
253
|
+
"kind"
|
|
254
|
+
],
|
|
255
|
+
"properties": {
|
|
256
|
+
"kind": {
|
|
257
|
+
"enum": [
|
|
258
|
+
"local_user",
|
|
259
|
+
"member"
|
|
260
|
+
]
|
|
261
|
+
},
|
|
262
|
+
"uid": {
|
|
263
|
+
"description": "local_user only: the numeric id of the user that owns the control socket.",
|
|
264
|
+
"type": "integer",
|
|
265
|
+
"minimum": 0
|
|
266
|
+
},
|
|
267
|
+
"user": {
|
|
268
|
+
"description": "local_user only (optional): that user's account name, when the core could resolve it.",
|
|
269
|
+
"type": "string",
|
|
270
|
+
"minLength": 1,
|
|
271
|
+
"maxLength": 64
|
|
272
|
+
},
|
|
273
|
+
"node": {
|
|
274
|
+
"description": "member only: the node name of the authenticated fleet member.",
|
|
275
|
+
"$ref": "common.json#/$defs/node"
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
"allOf": [
|
|
279
|
+
{
|
|
280
|
+
"if": {
|
|
281
|
+
"required": [
|
|
282
|
+
"kind"
|
|
283
|
+
],
|
|
284
|
+
"properties": {
|
|
285
|
+
"kind": {
|
|
286
|
+
"const": "local_user"
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
"then": {
|
|
291
|
+
"required": [
|
|
292
|
+
"uid"
|
|
293
|
+
],
|
|
294
|
+
"not": {
|
|
295
|
+
"required": [
|
|
296
|
+
"node"
|
|
297
|
+
]
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"if": {
|
|
303
|
+
"required": [
|
|
304
|
+
"kind"
|
|
305
|
+
],
|
|
306
|
+
"properties": {
|
|
307
|
+
"kind": {
|
|
308
|
+
"const": "member"
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
"then": {
|
|
313
|
+
"required": [
|
|
314
|
+
"node"
|
|
315
|
+
],
|
|
316
|
+
"not": {
|
|
317
|
+
"anyOf": [
|
|
318
|
+
{
|
|
319
|
+
"required": [
|
|
320
|
+
"uid"
|
|
321
|
+
]
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"required": [
|
|
325
|
+
"user"
|
|
326
|
+
]
|
|
327
|
+
}
|
|
328
|
+
]
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
225
332
|
]
|
|
226
333
|
},
|
|
227
334
|
"run_list": {
|
|
@@ -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).",
|
|
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.0.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"additionalProperties": false,
|
|
8
8
|
"required": ["api_version", "core_version", "node"],
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"maxLength": 64
|
|
16
16
|
},
|
|
17
17
|
"node": {
|
|
18
|
-
"description": "The node this core runs on; the `<node>` of every agent it can execute
|
|
18
|
+
"description": "The node this core runs on; the `<node>` of every agent it can execute.",
|
|
19
19
|
"$ref": "common.json#/$defs/node"
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { GitSha, RepoPath, RunId } from "./common.js";
|
|
2
|
+
import type { RunState } from "./run.js";
|
|
3
|
+
/** Response of GET /v1/branches: every `runs/<run_id>` branch of one repository, with the state of its run and the git evidence about whether its commits are reachable from another ref (a local branch other than a runs branch, or a remote-tracking branch). */
|
|
4
|
+
export type Branches = {
|
|
5
|
+
repo: RepoPath;
|
|
6
|
+
branches: Branch[];
|
|
7
|
+
};
|
|
8
|
+
/** One runs branch. `state` is the run's state as the core reads it now, or null when no run can be read for the branch; `state_note` then says why (no such run, or the run cannot be read). `merged_into` names the first other ref git shows to contain the branch tip (`git merge-base --is-ancestor`), or is null. */
|
|
9
|
+
export type Branch = {
|
|
10
|
+
branch: string;
|
|
11
|
+
run_id: RunId;
|
|
12
|
+
state: RunState | null;
|
|
13
|
+
state_note: string | null;
|
|
14
|
+
tip: GitSha;
|
|
15
|
+
merged_into: string | null;
|
|
16
|
+
};
|
|
17
|
+
/** Body of POST /v1/branches/remove. The repository must be one the allow-list names. With `dry_run` true nothing is deleted and `removed` lists what would be. */
|
|
18
|
+
export type RemoveRequest = {
|
|
19
|
+
repo: RepoPath;
|
|
20
|
+
dry_run?: boolean;
|
|
21
|
+
};
|
|
22
|
+
/** Outcome of a removal: the branches deleted with `git branch -d` (never `-D`), and the branches skipped with the reason for each. A branch is skipped when its run is active, unknown or unreadable, when git shows no other ref containing it, or when git itself refuses the delete. */
|
|
23
|
+
export type RemoveResponse = {
|
|
24
|
+
repo: RepoPath;
|
|
25
|
+
dry_run: boolean;
|
|
26
|
+
removed: Branch[];
|
|
27
|
+
skipped: Skipped[];
|
|
28
|
+
};
|
|
29
|
+
export type Skipped = {
|
|
30
|
+
branch: string;
|
|
31
|
+
run_id: RunId;
|
|
32
|
+
state: RunState | null;
|
|
33
|
+
reason: string;
|
|
34
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branches.js","sourceRoot":"","sources":["../../../../src/contract/generated/branches.ts"],"names":[],"mappings":"AAAA,6FAA6F"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Extension, HarnessId } from "./common.js";
|
|
2
|
-
/** What one harness can do through this core, stated honestly. Every capability name is always present. A control action whose capability is not supported is refused with an `unsupported` error naming it, never dropped or simulated. */
|
|
1
|
+
import type { Extension, HarnessId, NullableTimestamp } from "./common.js";
|
|
2
|
+
/** What one harness can do through this core, stated honestly, and what this core's host can take right now. Every capability name is always present. A control action whose capability is not supported is refused with an `unsupported` error naming it, never dropped or simulated. `limits`, `active_runs` and `admission` describe this core's own host and never another one. */
|
|
3
3
|
export type Capabilities = {
|
|
4
4
|
harness: HarnessId;
|
|
5
5
|
/** Whether the core can start this harness right now (binary, credentials and sandbox present). */
|
|
@@ -9,6 +9,12 @@ export type Capabilities = {
|
|
|
9
9
|
/** Neutral one-line description of how the core drives the harness (for example `interactive session over a local bridge`). Informational only. */
|
|
10
10
|
transport: string;
|
|
11
11
|
capabilities: CapabilitySet;
|
|
12
|
+
/** The limits the operator configured on this core. Absent when the core does not report them. */
|
|
13
|
+
limits?: Limits;
|
|
14
|
+
/** How many runs are active on this core's host right now, across every harness and repository. Absent when the core does not report it. */
|
|
15
|
+
active_runs?: number;
|
|
16
|
+
/** What each admission signal says for this harness on this host right now. Absent when the core does not report it. */
|
|
17
|
+
admission?: Admission;
|
|
12
18
|
extension?: Extension;
|
|
13
19
|
};
|
|
14
20
|
/** Every capability the contract can name in a capability document or an `unsupported` error. */
|
|
@@ -20,7 +26,7 @@ export type Capability = {
|
|
|
20
26
|
/** Known limits of a supported capability, for example that cancel can leave a harness child process running until the sandbox is deleted. */
|
|
21
27
|
caveats: string[];
|
|
22
28
|
};
|
|
23
|
-
/** A capability no harness supports in this API version. Changing
|
|
29
|
+
/** A capability no harness supports in this API version: pause, resume, continue_session and delegate. Changing one to supportable is a schema change (README: versioning). */
|
|
24
30
|
export type Deferred = {
|
|
25
31
|
supported: false;
|
|
26
32
|
reason: string;
|
|
@@ -33,12 +39,38 @@ export type CapabilitySet = {
|
|
|
33
39
|
cancel: Capability;
|
|
34
40
|
pause: Deferred;
|
|
35
41
|
resume: Deferred;
|
|
36
|
-
answer:
|
|
42
|
+
answer: Capability;
|
|
37
43
|
continue_session: Deferred;
|
|
38
44
|
delegate: Deferred;
|
|
39
|
-
placement:
|
|
40
|
-
reconnect:
|
|
41
|
-
worktree_isolation:
|
|
45
|
+
placement: Capability;
|
|
46
|
+
reconnect: Capability;
|
|
47
|
+
worktree_isolation: Capability;
|
|
48
|
+
};
|
|
49
|
+
/** A limit an operator can configure. runs_per_repository: active runs in one repository. runs_per_host: active runs on the core's host. */
|
|
50
|
+
export type LimitName = "runs_per_repository" | "runs_per_host";
|
|
51
|
+
/** Every limit by name. null means the operator configured none, and then no submit is refused for it. No limit applies unless one is configured. */
|
|
52
|
+
export type Limits = {
|
|
53
|
+
runs_per_repository: number | null;
|
|
54
|
+
runs_per_host: number | null;
|
|
55
|
+
};
|
|
56
|
+
/** An admission signal. heat: the host's heat state. gateway: the model gateway's admit state, for harnesses that use the gateway. */
|
|
57
|
+
export type SignalName = "heat" | "gateway";
|
|
58
|
+
/** admit: the signal allows new work. hold: it says not to start new work. unknown: it is missing or stale; it is never read as admit or as a failure of the control plane. */
|
|
59
|
+
export type SignalState = "admit" | "hold" | "unknown";
|
|
60
|
+
/** One admission signal as this core read it. */
|
|
61
|
+
export type Signal = {
|
|
62
|
+
state: SignalState;
|
|
63
|
+
/** Whether admission reads this signal for this harness. When false the state does not affect admission and `reason` says why it is not read. */
|
|
64
|
+
consulted: boolean;
|
|
65
|
+
/** Why the state is hold or unknown, or why the signal is not consulted. null only for a plain admit. */
|
|
66
|
+
reason: string | null;
|
|
67
|
+
/** The time the signal's publisher stamped on the reading, or null when there is no reading. */
|
|
68
|
+
observed_at: NullableTimestamp;
|
|
69
|
+
};
|
|
70
|
+
/** Every admission signal by name. */
|
|
71
|
+
export type Admission = {
|
|
72
|
+
heat: Signal;
|
|
73
|
+
gateway: Signal;
|
|
42
74
|
};
|
|
43
75
|
/** Response of GET /v1/harnesses. */
|
|
44
76
|
export type CapabilitiesList = {
|
|
@@ -14,6 +14,8 @@ export type RunId = string;
|
|
|
14
14
|
export type SessionId = string;
|
|
15
15
|
/** Stable control-action id: `<node>-<agent>.act.<ULID>`, using the target run's agent. At most 127 characters: a mesh id of at most 96, then the 31 of `.act.<ULID>`. */
|
|
16
16
|
export type ActionId = string;
|
|
17
|
+
/** Stable id of a question a run asks its operator: `<node>-<agent>.qst.<ULID>`, using the run's agent. Assigned by the run's worker when it records the question, never by a harness or a client. At most 127 characters: a mesh id of at most 96, then the 31 of `.qst.<ULID>`. */
|
|
18
|
+
export type QuestionId = string;
|
|
17
19
|
/** Harness identifier, a free lowercase string (for example `claude-code`, `opencode`). Deliberately not an enum. */
|
|
18
20
|
export type HarnessId = string;
|
|
19
21
|
/** RFC 3339 timestamp in UTC with a `Z` suffix and optional fractional seconds. */
|
|
@@ -22,16 +24,16 @@ export type Timestamp = string;
|
|
|
22
24
|
export type NullableTimestamp = string | null;
|
|
23
25
|
/** Absolute POSIX path of a repository on the core's host, with no `.` or `..` segments, no trailing slash and no control characters (a newline would hide a `..` segment from the pattern). */
|
|
24
26
|
export type RepoPath = string;
|
|
25
|
-
/** Caller-chosen key, recorded and returned.
|
|
27
|
+
/** Caller-chosen key, recorded and returned. A repeat of the same key with the same request takes effect once, and the same key with a different request is a `conflict` (see README: idempotency keys). */
|
|
26
28
|
export type IdempotencyKey = string;
|
|
27
29
|
/** Per-run event cursor: the first event is 1 and each next event is exactly 1 higher. */
|
|
28
30
|
export type Cursor = number;
|
|
29
31
|
/** API version `MAJOR.MINOR`. */
|
|
30
32
|
export type ApiVersion = string;
|
|
31
|
-
/** Free text from a caller (task, steer message). Untrusted data, never a control command. */
|
|
33
|
+
/** Free text from a caller or a harness (task, steer message, question, answer). Untrusted data, never a control command. */
|
|
32
34
|
export type CallerText = string;
|
|
33
35
|
export type GitSha = string;
|
|
34
|
-
/** Who asked: an operator or an agent, by mesh id.
|
|
36
|
+
/** Who asked, as the request says: an operator or an agent, by mesh id. The core records it as supplied and does not authenticate it; authority comes from the owner-only socket and the allow-list, not from this field. What the core itself established about the caller is the run's `submitter`. */
|
|
35
37
|
export type Principal = {
|
|
36
38
|
kind: "operator" | "agent";
|
|
37
39
|
id: MeshId;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SignalName } from "./capabilities.js";
|
|
2
|
+
import type { ActionId, CallerText, HarnessId, IdempotencyKey, MeshId, Principal, QuestionId, RepoPath, RunId, SessionId, Timestamp } from "./common.js";
|
|
2
3
|
import type { ErrorBody } from "./error.js";
|
|
4
|
+
import type { ChoiceId } from "./event.js";
|
|
3
5
|
import type { Run } from "./run.js";
|
|
4
6
|
/** Requests that create or control a run, their responses, and the record of a control action against an existing run. The root schema is that record. */
|
|
5
7
|
export type ControlAction = ActionRecord;
|
|
6
|
-
/** Control actions against an existing run. pause
|
|
8
|
+
/** Control actions against an existing run. pause and resume are deferred: always refused with `unsupported` in this API version. */
|
|
7
9
|
export type ActionKind = "steer" | "cancel" | "pause" | "resume" | "answer";
|
|
8
10
|
/** One control action against a run, as recorded in the run's event log and returned by an accepting route. */
|
|
9
11
|
export type ActionRecord = {
|
|
@@ -17,7 +19,7 @@ export type ActionRecord = {
|
|
|
17
19
|
outcome: "accepted" | "refused";
|
|
18
20
|
error: ErrorBody | null;
|
|
19
21
|
};
|
|
20
|
-
/** Body of POST /v1/runs. Optional fields are omitted, never null. Setting `session_id` asks for `continue_session` and setting `parent_run_id` asks for `delegate`; both are refused with `unsupported` in this API version
|
|
22
|
+
/** Body of POST /v1/runs. Optional fields are omitted, never null. Setting `session_id` asks for `continue_session` and setting `parent_run_id` asks for `delegate`; both are refused with `unsupported` in this API version. An `agent_id` whose node is not the core's node asks for `placement`, which is refused with `unsupported` until part two builds it (planned). No field of this request sets the run's `submitter` or `base_commit`. */
|
|
21
23
|
export type SubmitRequest = {
|
|
22
24
|
agent_id: MeshId;
|
|
23
25
|
harness: HarnessId;
|
|
@@ -30,11 +32,20 @@ export type SubmitRequest = {
|
|
|
30
32
|
session_id?: SessionId;
|
|
31
33
|
parent_run_id?: RunId;
|
|
32
34
|
};
|
|
33
|
-
/**
|
|
35
|
+
/** Response of POST /v1/runs. For a new run it is in state `queued` and its worker's PID, event log and cursor are on disk. When `replayed` is true the idempotency key matched an earlier submit: nothing was created and `run` is that first run as it is now. */
|
|
34
36
|
export type SubmitResponse = {
|
|
35
|
-
run: Run
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
run: Run;
|
|
38
|
+
/** True when the request repeated an earlier submit with the same idempotency key. Omitted otherwise. */
|
|
39
|
+
replayed?: boolean;
|
|
40
|
+
/** Things the caller should know about a run that was admitted all the same. Omitted when there are none. */
|
|
41
|
+
warnings?: Warning[];
|
|
42
|
+
};
|
|
43
|
+
/** One warning on an admitted submit. */
|
|
44
|
+
export type Warning = {
|
|
45
|
+
/** signal_unknown: an admission signal could not be read or was stale, and a local submit was admitted without it. */
|
|
46
|
+
code: "signal_unknown";
|
|
47
|
+
signal: SignalName;
|
|
48
|
+
message: string;
|
|
38
49
|
};
|
|
39
50
|
/** Body of POST /v1/runs/{run_id}/steer: a mid-run instruction delivered to the harness as user input. */
|
|
40
51
|
export type SteerRequest = {
|
|
@@ -58,16 +69,24 @@ export type ResumeRequest = {
|
|
|
58
69
|
caller: Principal;
|
|
59
70
|
idempotency_key?: IdempotencyKey;
|
|
60
71
|
};
|
|
61
|
-
/** Body of POST /v1/runs/{run_id}/answer
|
|
72
|
+
/** Body of POST /v1/runs/{run_id}/answer: the answer to one pending question of the run. For a `question`, give `answer`, `choice_ids` or both. For an `approval`, give `decision`; `answer` is then an optional reason the harness shows the model. The core checks the answer against the question (README: operator questions). */
|
|
62
73
|
export type AnswerRequest = {
|
|
63
74
|
caller: Principal;
|
|
64
|
-
question_id:
|
|
65
|
-
answer
|
|
75
|
+
question_id: QuestionId;
|
|
76
|
+
answer?: CallerText;
|
|
77
|
+
choice_ids?: ChoiceIds;
|
|
78
|
+
decision?: Decision;
|
|
66
79
|
idempotency_key?: IdempotencyKey;
|
|
67
80
|
};
|
|
68
|
-
/**
|
|
81
|
+
/** The answer to an approval: whether the waiting action may run. */
|
|
82
|
+
export type Decision = "approve" | "deny";
|
|
83
|
+
/** Choices picked from the question's `choices`, by id. */
|
|
84
|
+
export type ChoiceIds = ChoiceId[];
|
|
85
|
+
/** 202 response of steer, cancel and answer: the recorded, accepted action. When `replayed` is true the idempotency key matched an earlier request against this run: nothing was delivered again and `action` is the first one. */
|
|
69
86
|
export type AcceptedResponse = {
|
|
70
87
|
action: ActionRecord & {
|
|
71
88
|
outcome?: "accepted";
|
|
72
89
|
};
|
|
90
|
+
/** True when the request repeated an earlier one with the same idempotency key. Omitted otherwise. */
|
|
91
|
+
replayed?: boolean;
|
|
73
92
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { CapabilityName } from "./capabilities.js";
|
|
2
|
-
import type { ApiVersion, RepoPath, RunId } from "./common.js";
|
|
1
|
+
import type { CapabilityName, LimitName, SignalName } from "./capabilities.js";
|
|
2
|
+
import type { ApiVersion, IdempotencyKey, NullableTimestamp, QuestionId, RepoPath, RunId } from "./common.js";
|
|
3
3
|
/** Body of every non-2xx response. HTTP status, CLI exit code and retryability per code are fixed in api.json `errors` and README. */
|
|
4
4
|
export type ErrorResponse = {
|
|
5
5
|
error: ErrorBody;
|
|
6
6
|
};
|
|
7
|
-
export type ErrorCode = "invalid" | "denied" | "not_found" | "
|
|
7
|
+
export type ErrorCode = "invalid" | "denied" | "not_found" | "conflict" | "limit_reached" | "admission_held" | "unsupported" | "incompatible_version" | "unavailable" | "internal";
|
|
8
8
|
export type ErrorBody = {
|
|
9
9
|
code: ErrorCode;
|
|
10
10
|
/** One human-readable sentence; for environment errors it includes a remediation hint. */
|
|
@@ -16,10 +16,34 @@ export type ErrorBody = {
|
|
|
16
16
|
field?: string;
|
|
17
17
|
/** The run the error concerns, when there is one. Required for conflict. */
|
|
18
18
|
run_id?: RunId;
|
|
19
|
-
/** busy only: the active run holding the repository. */
|
|
20
|
-
active_run_id?: RunId;
|
|
21
|
-
/** busy only: the canonical repository path that is busy. */
|
|
22
|
-
repo?: RepoPath;
|
|
23
19
|
client_api_version?: ApiVersion;
|
|
24
20
|
server_api_version?: ApiVersion;
|
|
21
|
+
/** conflict only: present when the conflict is an idempotency key that was already used with a different request. `run_id` is then the run the key belongs to. */
|
|
22
|
+
idempotency_key?: IdempotencyKey;
|
|
23
|
+
/** The question the error concerns, when there is one (for example a second answer to one question). */
|
|
24
|
+
question_id?: QuestionId;
|
|
25
|
+
/** limit_reached only: the configured limit that refused the submit. */
|
|
26
|
+
limit?: Limit;
|
|
27
|
+
/** admission_held only: the admission signal that held the submit, as the core read it. */
|
|
28
|
+
signal?: HeldSignal;
|
|
29
|
+
/** unavailable only (optional): the core expects the same request to work after about this many milliseconds, for example while it reattaches to the run's worker after a restart. */
|
|
30
|
+
retry_after_ms?: number;
|
|
31
|
+
};
|
|
32
|
+
/** A limit the operator configured on this core, as it stood when it refused a submit. Nothing is queued: the caller retries later or submits elsewhere. */
|
|
33
|
+
export type Limit = {
|
|
34
|
+
name: LimitName;
|
|
35
|
+
/** The configured maximum number of active runs. */
|
|
36
|
+
value: number;
|
|
37
|
+
/** How many runs counted against the limit when the submit was refused. */
|
|
38
|
+
active: number;
|
|
39
|
+
/** runs_per_repository only: the canonical repository path the limit was reached for. */
|
|
40
|
+
repo?: RepoPath;
|
|
41
|
+
};
|
|
42
|
+
/** An admission signal that held a submit on this core's host, as it stood when the core refused it (planned, part two). Nothing is queued: the caller retries later or submits to another host. */
|
|
43
|
+
export type HeldSignal = {
|
|
44
|
+
name: SignalName;
|
|
45
|
+
/** hold: the signal says not to start new work. unknown: the signal is missing or stale, which refuses a submit from another host (a local submit is admitted with a warning instead). */
|
|
46
|
+
state: "hold" | "unknown";
|
|
47
|
+
/** The time the signal's publisher stamped on the reading, or null when there is no reading. */
|
|
48
|
+
observed_at: NullableTimestamp;
|
|
25
49
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Cursor, Extension, RunId, Timestamp } from "./common.js";
|
|
2
|
-
import type { ActionRecord } from "./control-action.js";
|
|
1
|
+
import type { CallerText, Cursor, Extension, QuestionId, RunId, Timestamp } from "./common.js";
|
|
2
|
+
import type { ActionRecord, ChoiceIds, Decision } from "./control-action.js";
|
|
3
3
|
import type { ErrorBody } from "./error.js";
|
|
4
4
|
import type { RunState } from "./run.js";
|
|
5
5
|
/** One entry of a run's event log, identical whether read from disk, replayed by attach, or streamed live. The cursor is the transport-independent position (README: cursor and replay). */
|
|
@@ -9,7 +9,7 @@ export type RunEvent = {
|
|
|
9
9
|
time: Timestamp;
|
|
10
10
|
kind: EventKind;
|
|
11
11
|
/** Kind-specific payload; the allOf below pins which one each kind carries. */
|
|
12
|
-
data: StateData | OutputData | ControlData | RefusedData | ErrorData;
|
|
12
|
+
data: StateData | OutputData | ControlData | RefusedData | ErrorData | QuestionData | AnswerData;
|
|
13
13
|
} & (({
|
|
14
14
|
kind: "run.state";
|
|
15
15
|
} & {
|
|
@@ -31,9 +31,17 @@ export type RunEvent = {
|
|
|
31
31
|
} & {
|
|
32
32
|
data: ErrorData;
|
|
33
33
|
}) | ({
|
|
34
|
-
kind:
|
|
34
|
+
kind: "run.question";
|
|
35
|
+
} & {
|
|
36
|
+
data: QuestionData;
|
|
37
|
+
}) | ({
|
|
38
|
+
kind: "run.answer";
|
|
39
|
+
} & {
|
|
40
|
+
data: AnswerData;
|
|
41
|
+
}) | ({
|
|
42
|
+
kind: Exclude<EventKind, "run.state" | "run.output" | "run.control" | "run.refused" | "run.error" | "run.question" | "run.answer">;
|
|
35
43
|
}));
|
|
36
|
-
export type EventKind = "run.state" | "run.output" | "run.control" | "run.refused" | "run.error";
|
|
44
|
+
export type EventKind = "run.state" | "run.output" | "run.control" | "run.refused" | "run.error" | "run.question" | "run.answer";
|
|
37
45
|
/** A state transition. The first event of every run is `from: null, to: queued`. */
|
|
38
46
|
export type StateData = {
|
|
39
47
|
from: RunState | null;
|
|
@@ -49,11 +57,12 @@ export type OutputData = {
|
|
|
49
57
|
tool?: string;
|
|
50
58
|
extension?: Extension;
|
|
51
59
|
};
|
|
52
|
-
/** A
|
|
60
|
+
/** A steer or cancel that was accepted and delivered to the worker. An accepted answer is a `run.answer` event instead. */
|
|
53
61
|
export type ControlData = {
|
|
54
|
-
action: ActionRecord & {
|
|
62
|
+
action: ActionRecord & ({
|
|
55
63
|
outcome?: "accepted";
|
|
56
|
-
|
|
64
|
+
kind?: "steer" | "cancel";
|
|
65
|
+
});
|
|
57
66
|
};
|
|
58
67
|
/** A control action refused against this (non-terminal) run, recorded when the core controls the run's worker: a capability refusal (`unsupported`) or a state conflict. */
|
|
59
68
|
export type RefusedData = {
|
|
@@ -69,6 +78,46 @@ export type ErrorData = {
|
|
|
69
78
|
error: ErrorBody;
|
|
70
79
|
fatal: boolean;
|
|
71
80
|
};
|
|
81
|
+
/** A question a run asks its operator, normalized from what the harness raised. `text`, `choices` and `tool` come from the harness and are untrusted data. The run waits for the answer; nothing else is held for it. */
|
|
82
|
+
export type Question = {
|
|
83
|
+
id: QuestionId;
|
|
84
|
+
/** question: the harness asks for information, answered with choices or free text. approval: the harness asks whether it may take one action, answered with a decision. */
|
|
85
|
+
kind: "question" | "approval";
|
|
86
|
+
/** What is asked. For an approval, a description of the action that waits. */
|
|
87
|
+
text: CallerText;
|
|
88
|
+
/** The answers the harness offers, in its order. Empty when it offers none. */
|
|
89
|
+
choices: Choice[];
|
|
90
|
+
/** Whether an answer in the caller's own words is accepted. */
|
|
91
|
+
free_text: boolean;
|
|
92
|
+
/** Whether more than one choice may be given. */
|
|
93
|
+
multiple: boolean;
|
|
94
|
+
/** approval only (optional): the name of the tool that waits for the decision. */
|
|
95
|
+
tool?: string;
|
|
96
|
+
/** When this question's own time limit passes, on the executing core's clock. After it the run ends `unanswered`. */
|
|
97
|
+
answer_by: Timestamp;
|
|
98
|
+
};
|
|
99
|
+
export type Choice = {
|
|
100
|
+
id: ChoiceId;
|
|
101
|
+
label: string;
|
|
102
|
+
description?: string;
|
|
103
|
+
};
|
|
104
|
+
/** Identifies one choice within its question. */
|
|
105
|
+
export type ChoiceId = string;
|
|
106
|
+
/** A question was asked and the run now waits for its answer. It is written to the log before the run starts waiting. */
|
|
107
|
+
export type QuestionData = {
|
|
108
|
+
question: Question;
|
|
109
|
+
};
|
|
110
|
+
/** An answer was accepted and delivered into the run. At most one per question. `answer` is the caller's own words and is untrusted data. */
|
|
111
|
+
export type AnswerData = {
|
|
112
|
+
question_id: QuestionId;
|
|
113
|
+
action: ActionRecord & {
|
|
114
|
+
kind?: "answer";
|
|
115
|
+
outcome?: "accepted";
|
|
116
|
+
};
|
|
117
|
+
decision?: Decision;
|
|
118
|
+
choice_ids?: ChoiceIds;
|
|
119
|
+
answer?: CallerText;
|
|
120
|
+
};
|
|
72
121
|
/** Response of GET /v1/runs/{run_id}/events (non-streaming logs). */
|
|
73
122
|
export type EventPage = {
|
|
74
123
|
run_id: RunId;
|