@culture.dev/agents 0.0.0-stage → 0.15.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.
Files changed (290) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +59 -2
  3. package/dist/contract-schemas/agent.json +128 -0
  4. package/dist/contract-schemas/allowlist.json +25 -0
  5. package/dist/contract-schemas/api.json +501 -0
  6. package/dist/contract-schemas/capabilities.json +208 -0
  7. package/dist/contract-schemas/common.json +123 -0
  8. package/dist/contract-schemas/control-action.json +279 -0
  9. package/dist/contract-schemas/error.json +269 -0
  10. package/dist/contract-schemas/event.json +316 -0
  11. package/dist/contract-schemas/run.json +336 -0
  12. package/dist/contract-schemas/session.json +77 -0
  13. package/dist/contract-schemas/version.json +22 -0
  14. package/dist/src/contract/api.d.ts +41 -0
  15. package/dist/src/contract/api.js +35 -0
  16. package/dist/src/contract/api.js.map +1 -0
  17. package/dist/src/contract/errors.d.ts +21 -0
  18. package/dist/src/contract/errors.js +25 -0
  19. package/dist/src/contract/errors.js.map +1 -0
  20. package/dist/src/contract/generated/agent.d.ts +31 -0
  21. package/dist/src/contract/generated/agent.js +3 -0
  22. package/dist/src/contract/generated/agent.js.map +1 -0
  23. package/dist/src/contract/generated/allowlist.d.ts +10 -0
  24. package/dist/src/contract/generated/allowlist.js +3 -0
  25. package/dist/src/contract/generated/allowlist.js.map +1 -0
  26. package/dist/src/contract/generated/capabilities.d.ts +46 -0
  27. package/dist/src/contract/generated/capabilities.js +3 -0
  28. package/dist/src/contract/generated/capabilities.js.map +1 -0
  29. package/dist/src/contract/generated/common.d.ts +40 -0
  30. package/dist/src/contract/generated/common.js +3 -0
  31. package/dist/src/contract/generated/common.js.map +1 -0
  32. package/dist/src/contract/generated/control-action.d.ts +73 -0
  33. package/dist/src/contract/generated/control-action.js +3 -0
  34. package/dist/src/contract/generated/control-action.js.map +1 -0
  35. package/dist/src/contract/generated/error.d.ts +25 -0
  36. package/dist/src/contract/generated/error.js +3 -0
  37. package/dist/src/contract/generated/error.js.map +1 -0
  38. package/dist/src/contract/generated/event.d.ts +80 -0
  39. package/dist/src/contract/generated/event.js +3 -0
  40. package/dist/src/contract/generated/event.js.map +1 -0
  41. package/dist/src/contract/generated/index.d.ts +81 -0
  42. package/dist/src/contract/generated/index.js +3 -0
  43. package/dist/src/contract/generated/index.js.map +1 -0
  44. package/dist/src/contract/generated/run.d.ts +63 -0
  45. package/dist/src/contract/generated/run.js +3 -0
  46. package/dist/src/contract/generated/run.js.map +1 -0
  47. package/dist/src/contract/generated/session.d.ts +12 -0
  48. package/dist/src/contract/generated/session.js +3 -0
  49. package/dist/src/contract/generated/session.js.map +1 -0
  50. package/dist/src/contract/generated/version.d.ts +9 -0
  51. package/dist/src/contract/generated/version.js +3 -0
  52. package/dist/src/contract/generated/version.js.map +1 -0
  53. package/dist/src/contract/ids.d.ts +36 -0
  54. package/dist/src/contract/ids.js +85 -0
  55. package/dist/src/contract/ids.js.map +1 -0
  56. package/dist/src/contract/index.d.ts +17 -0
  57. package/dist/src/contract/index.js +13 -0
  58. package/dist/src/contract/index.js.map +1 -0
  59. package/dist/src/contract/run-state.d.ts +13 -0
  60. package/dist/src/contract/run-state.js +24 -0
  61. package/dist/src/contract/run-state.js.map +1 -0
  62. package/dist/src/contract/schemas.d.ts +18 -0
  63. package/dist/src/contract/schemas.js +37 -0
  64. package/dist/src/contract/schemas.js.map +1 -0
  65. package/dist/src/contract/validate.d.ts +17 -0
  66. package/dist/src/contract/validate.js +68 -0
  67. package/dist/src/contract/validate.js.map +1 -0
  68. package/dist/src/daemon/allowlist.d.ts +23 -0
  69. package/dist/src/daemon/allowlist.js +57 -0
  70. package/dist/src/daemon/allowlist.js.map +1 -0
  71. package/dist/src/daemon/daemon.d.ts +31 -0
  72. package/dist/src/daemon/daemon.js +141 -0
  73. package/dist/src/daemon/daemon.js.map +1 -0
  74. package/dist/src/daemon/errors.d.ts +14 -0
  75. package/dist/src/daemon/errors.js +26 -0
  76. package/dist/src/daemon/errors.js.map +1 -0
  77. package/dist/src/daemon/harness-catalog.d.ts +11 -0
  78. package/dist/src/daemon/harness-catalog.js +21 -0
  79. package/dist/src/daemon/harness-catalog.js.map +1 -0
  80. package/dist/src/daemon/http.d.ts +15 -0
  81. package/dist/src/daemon/http.js +76 -0
  82. package/dist/src/daemon/http.js.map +1 -0
  83. package/dist/src/daemon/lock.d.ts +47 -0
  84. package/dist/src/daemon/lock.js +167 -0
  85. package/dist/src/daemon/lock.js.map +1 -0
  86. package/dist/src/daemon/main.d.ts +32 -0
  87. package/dist/src/daemon/main.js +204 -0
  88. package/dist/src/daemon/main.js.map +1 -0
  89. package/dist/src/daemon/paths.d.ts +29 -0
  90. package/dist/src/daemon/paths.js +26 -0
  91. package/dist/src/daemon/paths.js.map +1 -0
  92. package/dist/src/daemon/ports.d.ts +58 -0
  93. package/dist/src/daemon/ports.js +2 -0
  94. package/dist/src/daemon/ports.js.map +1 -0
  95. package/dist/src/daemon/routes.d.ts +15 -0
  96. package/dist/src/daemon/routes.js +259 -0
  97. package/dist/src/daemon/routes.js.map +1 -0
  98. package/dist/src/daemon/sse.d.ts +8 -0
  99. package/dist/src/daemon/sse.js +56 -0
  100. package/dist/src/daemon/sse.js.map +1 -0
  101. package/dist/src/harness/availability.d.ts +9 -0
  102. package/dist/src/harness/availability.js +52 -0
  103. package/dist/src/harness/availability.js.map +1 -0
  104. package/dist/src/harness/claude-code/agent.d.ts +4 -0
  105. package/dist/src/harness/claude-code/agent.js +33 -0
  106. package/dist/src/harness/claude-code/agent.js.map +1 -0
  107. package/dist/src/harness/claude-code/backend.d.ts +48 -0
  108. package/dist/src/harness/claude-code/backend.js +83 -0
  109. package/dist/src/harness/claude-code/backend.js.map +1 -0
  110. package/dist/src/harness/claude-code/capabilities.d.ts +7 -0
  111. package/dist/src/harness/claude-code/capabilities.js +11 -0
  112. package/dist/src/harness/claude-code/capabilities.js.map +1 -0
  113. package/dist/src/harness/claude-code/index.d.ts +15 -0
  114. package/dist/src/harness/claude-code/index.js +20 -0
  115. package/dist/src/harness/claude-code/index.js.map +1 -0
  116. package/dist/src/harness/claude-code/map.d.ts +30 -0
  117. package/dist/src/harness/claude-code/map.js +108 -0
  118. package/dist/src/harness/claude-code/map.js.map +1 -0
  119. package/dist/src/harness/common/capabilities.d.ts +34 -0
  120. package/dist/src/harness/common/capabilities.js +60 -0
  121. package/dist/src/harness/common/capabilities.js.map +1 -0
  122. package/dist/src/harness/common/guard.d.ts +18 -0
  123. package/dist/src/harness/common/guard.js +31 -0
  124. package/dist/src/harness/common/guard.js.map +1 -0
  125. package/dist/src/harness/common/processes.d.ts +21 -0
  126. package/dist/src/harness/common/processes.js +46 -0
  127. package/dist/src/harness/common/processes.js.map +1 -0
  128. package/dist/src/harness/common/queue.d.ts +20 -0
  129. package/dist/src/harness/common/queue.js +76 -0
  130. package/dist/src/harness/common/queue.js.map +1 -0
  131. package/dist/src/harness/common/run-driver.d.ts +88 -0
  132. package/dist/src/harness/common/run-driver.js +317 -0
  133. package/dist/src/harness/common/run-driver.js.map +1 -0
  134. package/dist/src/harness/common/sandbox-workspace.d.ts +72 -0
  135. package/dist/src/harness/common/sandbox-workspace.js +155 -0
  136. package/dist/src/harness/common/sandbox-workspace.js.map +1 -0
  137. package/dist/src/harness/common/text.d.ts +9 -0
  138. package/dist/src/harness/common/text.js +49 -0
  139. package/dist/src/harness/common/text.js.map +1 -0
  140. package/dist/src/harness/common/types.d.ts +111 -0
  141. package/dist/src/harness/common/types.js +2 -0
  142. package/dist/src/harness/common/types.js.map +1 -0
  143. package/dist/src/harness/config.d.ts +43 -0
  144. package/dist/src/harness/config.js +200 -0
  145. package/dist/src/harness/config.js.map +1 -0
  146. package/dist/src/harness/index.d.ts +21 -0
  147. package/dist/src/harness/index.js +89 -0
  148. package/dist/src/harness/index.js.map +1 -0
  149. package/dist/src/harness/opencode/backend.d.ts +37 -0
  150. package/dist/src/harness/opencode/backend.js +114 -0
  151. package/dist/src/harness/opencode/backend.js.map +1 -0
  152. package/dist/src/harness/opencode/capabilities.d.ts +8 -0
  153. package/dist/src/harness/opencode/capabilities.js +11 -0
  154. package/dist/src/harness/opencode/capabilities.js.map +1 -0
  155. package/dist/src/harness/opencode/client.d.ts +70 -0
  156. package/dist/src/harness/opencode/client.js +189 -0
  157. package/dist/src/harness/opencode/client.js.map +1 -0
  158. package/dist/src/harness/opencode/index.d.ts +13 -0
  159. package/dist/src/harness/opencode/index.js +19 -0
  160. package/dist/src/harness/opencode/index.js.map +1 -0
  161. package/dist/src/harness/opencode/lines.d.ts +14 -0
  162. package/dist/src/harness/opencode/lines.js +99 -0
  163. package/dist/src/harness/opencode/lines.js.map +1 -0
  164. package/dist/src/harness/opencode/map.d.ts +13 -0
  165. package/dist/src/harness/opencode/map.js +84 -0
  166. package/dist/src/harness/opencode/map.js.map +1 -0
  167. package/dist/src/harness/opencode/turn.d.ts +23 -0
  168. package/dist/src/harness/opencode/turn.js +143 -0
  169. package/dist/src/harness/opencode/turn.js.map +1 -0
  170. package/dist/src/harness/reclaim.d.ts +13 -0
  171. package/dist/src/harness/reclaim.js +18 -0
  172. package/dist/src/harness/reclaim.js.map +1 -0
  173. package/dist/src/harness/stub/backend.d.ts +11 -0
  174. package/dist/src/harness/stub/backend.js +125 -0
  175. package/dist/src/harness/stub/backend.js.map +1 -0
  176. package/dist/src/harness/stub/index.d.ts +18 -0
  177. package/dist/src/harness/stub/index.js +21 -0
  178. package/dist/src/harness/stub/index.js.map +1 -0
  179. package/dist/src/harness/stub/workspace.d.ts +29 -0
  180. package/dist/src/harness/stub/workspace.js +92 -0
  181. package/dist/src/harness/stub/workspace.js.map +1 -0
  182. package/dist/src/index.d.ts +2 -0
  183. package/dist/src/index.js +3 -0
  184. package/dist/src/index.js.map +1 -0
  185. package/dist/src/runs/agents.d.ts +10 -0
  186. package/dist/src/runs/agents.js +49 -0
  187. package/dist/src/runs/agents.js.map +1 -0
  188. package/dist/src/runs/control.d.ts +31 -0
  189. package/dist/src/runs/control.js +105 -0
  190. package/dist/src/runs/control.js.map +1 -0
  191. package/dist/src/runs/index.d.ts +8 -0
  192. package/dist/src/runs/index.js +7 -0
  193. package/dist/src/runs/index.js.map +1 -0
  194. package/dist/src/runs/ports.d.ts +31 -0
  195. package/dist/src/runs/ports.js +5 -0
  196. package/dist/src/runs/ports.js.map +1 -0
  197. package/dist/src/runs/scan.d.ts +38 -0
  198. package/dist/src/runs/scan.js +149 -0
  199. package/dist/src/runs/scan.js.map +1 -0
  200. package/dist/src/runs/service.d.ts +70 -0
  201. package/dist/src/runs/service.js +239 -0
  202. package/dist/src/runs/service.js.map +1 -0
  203. package/dist/src/sandbox/harness-session.d.ts +11 -0
  204. package/dist/src/sandbox/harness-session.js +170 -0
  205. package/dist/src/sandbox/harness-session.js.map +1 -0
  206. package/dist/src/sandbox/host-command.d.ts +19 -0
  207. package/dist/src/sandbox/host-command.js +41 -0
  208. package/dist/src/sandbox/host-command.js.map +1 -0
  209. package/dist/src/sandbox/index.d.ts +11 -0
  210. package/dist/src/sandbox/index.js +15 -0
  211. package/dist/src/sandbox/index.js.map +1 -0
  212. package/dist/src/sandbox/naming.d.ts +49 -0
  213. package/dist/src/sandbox/naming.js +106 -0
  214. package/dist/src/sandbox/naming.js.map +1 -0
  215. package/dist/src/sandbox/openshell-client.d.ts +81 -0
  216. package/dist/src/sandbox/openshell-client.js +49 -0
  217. package/dist/src/sandbox/openshell-client.js.map +1 -0
  218. package/dist/src/sandbox/policy.d.ts +26 -0
  219. package/dist/src/sandbox/policy.js +100 -0
  220. package/dist/src/sandbox/policy.js.map +1 -0
  221. package/dist/src/sandbox/run-sandbox.d.ts +38 -0
  222. package/dist/src/sandbox/run-sandbox.js +247 -0
  223. package/dist/src/sandbox/run-sandbox.js.map +1 -0
  224. package/dist/src/sandbox/run-sandboxes.d.ts +18 -0
  225. package/dist/src/sandbox/run-sandboxes.js +225 -0
  226. package/dist/src/sandbox/run-sandboxes.js.map +1 -0
  227. package/dist/src/sandbox/timeout.d.ts +12 -0
  228. package/dist/src/sandbox/timeout.js +39 -0
  229. package/dist/src/sandbox/timeout.js.map +1 -0
  230. package/dist/src/sandbox/types.d.ts +125 -0
  231. package/dist/src/sandbox/types.js +15 -0
  232. package/dist/src/sandbox/types.js.map +1 -0
  233. package/dist/src/sandbox/worktree.d.ts +72 -0
  234. package/dist/src/sandbox/worktree.js +157 -0
  235. package/dist/src/sandbox/worktree.js.map +1 -0
  236. package/dist/src/store/derive.d.ts +39 -0
  237. package/dist/src/store/derive.js +68 -0
  238. package/dist/src/store/derive.js.map +1 -0
  239. package/dist/src/store/event-log.d.ts +79 -0
  240. package/dist/src/store/event-log.js +202 -0
  241. package/dist/src/store/event-log.js.map +1 -0
  242. package/dist/src/store/files.d.ts +51 -0
  243. package/dist/src/store/files.js +103 -0
  244. package/dist/src/store/files.js.map +1 -0
  245. package/dist/src/store/index.d.ts +15 -0
  246. package/dist/src/store/index.js +11 -0
  247. package/dist/src/store/index.js.map +1 -0
  248. package/dist/src/store/liveness.d.ts +61 -0
  249. package/dist/src/store/liveness.js +150 -0
  250. package/dist/src/store/liveness.js.map +1 -0
  251. package/dist/src/store/run-store.d.ts +67 -0
  252. package/dist/src/store/run-store.js +211 -0
  253. package/dist/src/store/run-store.js.map +1 -0
  254. package/dist/src/util/sequence.d.ts +58 -0
  255. package/dist/src/util/sequence.js +119 -0
  256. package/dist/src/util/sequence.js.map +1 -0
  257. package/dist/src/worker/control.d.ts +60 -0
  258. package/dist/src/worker/control.js +205 -0
  259. package/dist/src/worker/control.js.map +1 -0
  260. package/dist/src/worker/delivery.d.ts +17 -0
  261. package/dist/src/worker/delivery.js +43 -0
  262. package/dist/src/worker/delivery.js.map +1 -0
  263. package/dist/src/worker/driver.d.ts +88 -0
  264. package/dist/src/worker/driver.js +6 -0
  265. package/dist/src/worker/driver.js.map +1 -0
  266. package/dist/src/worker/fake-driver.d.ts +65 -0
  267. package/dist/src/worker/fake-driver.js +123 -0
  268. package/dist/src/worker/fake-driver.js.map +1 -0
  269. package/dist/src/worker/index.d.ts +15 -0
  270. package/dist/src/worker/index.js +11 -0
  271. package/dist/src/worker/index.js.map +1 -0
  272. package/dist/src/worker/main.d.ts +1 -0
  273. package/dist/src/worker/main.js +57 -0
  274. package/dist/src/worker/main.js.map +1 -0
  275. package/dist/src/worker/retained.d.ts +13 -0
  276. package/dist/src/worker/retained.js +40 -0
  277. package/dist/src/worker/retained.js.map +1 -0
  278. package/dist/src/worker/run-loop.d.ts +63 -0
  279. package/dist/src/worker/run-loop.js +325 -0
  280. package/dist/src/worker/run-loop.js.map +1 -0
  281. package/dist/src/worker/spawn.d.ts +68 -0
  282. package/dist/src/worker/spawn.js +201 -0
  283. package/dist/src/worker/spawn.js.map +1 -0
  284. package/image/Dockerfile +81 -0
  285. package/image/build.sh +62 -0
  286. package/image/pnpm-shim.sh +25 -0
  287. package/package.json +54 -4
  288. package/policy/profiles/culture-agents-claude-subscription.yaml +59 -0
  289. package/policy/profiles/culture-agents-local-gateway.yaml +49 -0
  290. package/policy/run-sandbox.policy.json +10 -0
@@ -0,0 +1,123 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://culture.dev/contract/agents/common.json",
4
+ "title": "Shared definitions",
5
+ "description": "Identifiers, timestamps and small value types shared by every contract schema. See contract/README.md for semantics.",
6
+ "$defs": {
7
+ "node": {
8
+ "description": "Mesh node name, the `<node>` part of a `<node>-<agent>` identity. No hyphen, so the first hyphen of a mesh id always ends the node.",
9
+ "type": "string",
10
+ "pattern": "^[a-z0-9]{1,32}$"
11
+ },
12
+ "suffix": {
13
+ "description": "Agent suffix, the `<agent>` part of a `<node>-<agent>` identity (culture.yaml `suffix`).",
14
+ "type": "string",
15
+ "minLength": 1,
16
+ "maxLength": 63,
17
+ "pattern": "^[a-z0-9_]+(-[a-z0-9_]+)*$"
18
+ },
19
+ "mesh_id": {
20
+ "description": "A mesh identity in `<node>-<agent>` form, used for agents and for principals (operators and agents). The node is 1 to 32 characters and the whole id at most 96.",
21
+ "type": "string",
22
+ "maxLength": 96,
23
+ "pattern": "^[a-z0-9]{1,32}-[a-z0-9_]+(-[a-z0-9_]+)*$"
24
+ },
25
+ "ulid": {
26
+ "description": "A ULID: 26 Crockford base32 characters, uppercase.",
27
+ "type": "string",
28
+ "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
29
+ },
30
+ "run_id": {
31
+ "description": "Stable run id: `<node>-<agent>.run.<ULID>`, where `<node>-<agent>` is the executing agent's mesh id. At most 127 characters: a mesh id of at most 96, then the 31 of `.run.<ULID>`.",
32
+ "type": "string",
33
+ "maxLength": 127,
34
+ "pattern": "^[a-z0-9]{1,32}-[a-z0-9_]+(-[a-z0-9_]+)*\\.run\\.[0-9A-HJKMNP-TV-Z]{26}$"
35
+ },
36
+ "session_id": {
37
+ "description": "Stable session id: `<node>-<agent>.ses.<ULID>`. At most 127 characters: a mesh id of at most 96, then the 31 of `.ses.<ULID>`.",
38
+ "type": "string",
39
+ "maxLength": 127,
40
+ "pattern": "^[a-z0-9]{1,32}-[a-z0-9_]+(-[a-z0-9_]+)*\\.ses\\.[0-9A-HJKMNP-TV-Z]{26}$"
41
+ },
42
+ "action_id": {
43
+ "description": "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>`.",
44
+ "type": "string",
45
+ "maxLength": 127,
46
+ "pattern": "^[a-z0-9]{1,32}-[a-z0-9_]+(-[a-z0-9_]+)*\\.act\\.[0-9A-HJKMNP-TV-Z]{26}$"
47
+ },
48
+ "harness_id": {
49
+ "description": "Harness identifier, a free lowercase string (for example `claude-code`, `opencode`). Deliberately not an enum.",
50
+ "type": "string",
51
+ "maxLength": 64,
52
+ "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
53
+ },
54
+ "timestamp": {
55
+ "description": "RFC 3339 timestamp in UTC with a `Z` suffix and optional fractional seconds.",
56
+ "type": "string",
57
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,9})?Z$"
58
+ },
59
+ "nullable_timestamp": {
60
+ "description": "A timestamp (same pattern as `timestamp`) or null.",
61
+ "type": [
62
+ "string",
63
+ "null"
64
+ ],
65
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,9})?Z$"
66
+ },
67
+ "repo_path": {
68
+ "description": "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).",
69
+ "type": "string",
70
+ "maxLength": 4096,
71
+ "pattern": "^(?![\\s\\S]*[\\u0000-\\u001f])(?!.*/\\.\\.?(/|$))(/[^/]+)+$"
72
+ },
73
+ "idempotency_key": {
74
+ "description": "Caller-chosen key, recorded and returned. D1 does not deduplicate on it (see README).",
75
+ "type": "string",
76
+ "pattern": "^[A-Za-z0-9._:-]{1,128}$"
77
+ },
78
+ "cursor": {
79
+ "description": "Per-run event cursor: the first event is 1 and each next event is exactly 1 higher.",
80
+ "type": "integer",
81
+ "minimum": 1
82
+ },
83
+ "api_version": {
84
+ "description": "API version `MAJOR.MINOR`.",
85
+ "type": "string",
86
+ "pattern": "^[0-9]+\\.[0-9]+$"
87
+ },
88
+ "text": {
89
+ "description": "Free text from a caller (task, steer message). Untrusted data, never a control command.",
90
+ "type": "string",
91
+ "minLength": 1,
92
+ "maxLength": 100000
93
+ },
94
+ "git_sha": {
95
+ "type": "string",
96
+ "pattern": "^[0-9a-f]{40}$"
97
+ },
98
+ "principal": {
99
+ "description": "Who asked: an operator or an agent, by mesh id. In D1 the core records it as supplied; authority comes from the owner-only socket and the allow-list, not from this field.",
100
+ "type": "object",
101
+ "additionalProperties": false,
102
+ "required": [
103
+ "kind",
104
+ "id"
105
+ ],
106
+ "properties": {
107
+ "kind": {
108
+ "enum": [
109
+ "operator",
110
+ "agent"
111
+ ]
112
+ },
113
+ "id": {
114
+ "$ref": "#/$defs/mesh_id"
115
+ }
116
+ }
117
+ },
118
+ "extension": {
119
+ "description": "The single opaque field for harness-specific data. Consumers must not depend on its contents, must not branch control flow on it, and must treat it as untrusted. Its shape is outside the contract and is not versioned.",
120
+ "type": "object"
121
+ }
122
+ }
123
+ }
@@ -0,0 +1,279 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://culture.dev/contract/agents/control-action.json",
4
+ "title": "Control action",
5
+ "description": "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.",
6
+ "$ref": "#/$defs/action_record",
7
+ "$defs": {
8
+ "action_kind": {
9
+ "description": "Control actions against an existing run. pause, resume and answer are deferred: always refused with `unsupported` in this API version.",
10
+ "enum": [
11
+ "steer",
12
+ "cancel",
13
+ "pause",
14
+ "resume",
15
+ "answer"
16
+ ]
17
+ },
18
+ "action_record": {
19
+ "description": "One control action against a run, as recorded in the run's event log and returned by an accepting route.",
20
+ "type": "object",
21
+ "additionalProperties": false,
22
+ "required": [
23
+ "id",
24
+ "run_id",
25
+ "kind",
26
+ "caller",
27
+ "requested_at",
28
+ "idempotency_key",
29
+ "outcome",
30
+ "error"
31
+ ],
32
+ "properties": {
33
+ "id": {
34
+ "$ref": "common.json#/$defs/action_id"
35
+ },
36
+ "run_id": {
37
+ "$ref": "common.json#/$defs/run_id"
38
+ },
39
+ "kind": {
40
+ "$ref": "#/$defs/action_kind"
41
+ },
42
+ "caller": {
43
+ "$ref": "common.json#/$defs/principal"
44
+ },
45
+ "requested_at": {
46
+ "$ref": "common.json#/$defs/timestamp"
47
+ },
48
+ "idempotency_key": {
49
+ "oneOf": [
50
+ {
51
+ "$ref": "common.json#/$defs/idempotency_key"
52
+ },
53
+ {
54
+ "type": "null"
55
+ }
56
+ ]
57
+ },
58
+ "outcome": {
59
+ "description": "accepted: delivered to the run's worker. It does not promise any effect on the harness's behaviour. refused: not delivered; `error` says why.",
60
+ "enum": [
61
+ "accepted",
62
+ "refused"
63
+ ]
64
+ },
65
+ "error": {
66
+ "oneOf": [
67
+ {
68
+ "$ref": "error.json#/$defs/error"
69
+ },
70
+ {
71
+ "type": "null"
72
+ }
73
+ ]
74
+ }
75
+ },
76
+ "if": {
77
+ "required": [
78
+ "outcome"
79
+ ],
80
+ "properties": {
81
+ "outcome": {
82
+ "const": "refused"
83
+ }
84
+ }
85
+ },
86
+ "then": {
87
+ "properties": {
88
+ "error": {
89
+ "$ref": "error.json#/$defs/error"
90
+ }
91
+ }
92
+ },
93
+ "else": {
94
+ "properties": {
95
+ "error": {
96
+ "type": "null"
97
+ }
98
+ }
99
+ }
100
+ },
101
+ "submit_request": {
102
+ "description": "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, as is an `agent_id` whose node is not the core's node (`placement`).",
103
+ "type": "object",
104
+ "additionalProperties": false,
105
+ "required": [
106
+ "agent_id",
107
+ "harness",
108
+ "repo",
109
+ "task",
110
+ "caller"
111
+ ],
112
+ "properties": {
113
+ "agent_id": {
114
+ "$ref": "common.json#/$defs/mesh_id"
115
+ },
116
+ "harness": {
117
+ "$ref": "common.json#/$defs/harness_id"
118
+ },
119
+ "repo": {
120
+ "$ref": "common.json#/$defs/repo_path"
121
+ },
122
+ "task": {
123
+ "$ref": "common.json#/$defs/text"
124
+ },
125
+ "caller": {
126
+ "$ref": "common.json#/$defs/principal"
127
+ },
128
+ "idempotency_key": {
129
+ "$ref": "common.json#/$defs/idempotency_key"
130
+ },
131
+ "deadline": {
132
+ "description": "Absolute UTC time by which the run must be terminal; must be later than the core's clock at submit.",
133
+ "$ref": "common.json#/$defs/timestamp"
134
+ },
135
+ "session_id": {
136
+ "$ref": "common.json#/$defs/session_id"
137
+ },
138
+ "parent_run_id": {
139
+ "$ref": "common.json#/$defs/run_id"
140
+ }
141
+ }
142
+ },
143
+ "submit_response": {
144
+ "description": "201 response of POST /v1/runs. The run is in state `queued` and its worker's PID, event log and cursor are on disk.",
145
+ "type": "object",
146
+ "additionalProperties": false,
147
+ "required": [
148
+ "run"
149
+ ],
150
+ "properties": {
151
+ "run": {
152
+ "$ref": "run.json",
153
+ "properties": {
154
+ "state": {
155
+ "const": "queued"
156
+ }
157
+ }
158
+ }
159
+ }
160
+ },
161
+ "steer_request": {
162
+ "description": "Body of POST /v1/runs/{run_id}/steer: a mid-run instruction delivered to the harness as user input.",
163
+ "type": "object",
164
+ "additionalProperties": false,
165
+ "required": [
166
+ "caller",
167
+ "message"
168
+ ],
169
+ "properties": {
170
+ "caller": {
171
+ "$ref": "common.json#/$defs/principal"
172
+ },
173
+ "message": {
174
+ "$ref": "common.json#/$defs/text"
175
+ },
176
+ "idempotency_key": {
177
+ "$ref": "common.json#/$defs/idempotency_key"
178
+ }
179
+ }
180
+ },
181
+ "cancel_request": {
182
+ "description": "Body of POST /v1/runs/{run_id}/cancel.",
183
+ "type": "object",
184
+ "additionalProperties": false,
185
+ "required": [
186
+ "caller"
187
+ ],
188
+ "properties": {
189
+ "caller": {
190
+ "$ref": "common.json#/$defs/principal"
191
+ },
192
+ "reason": {
193
+ "type": "string",
194
+ "minLength": 1,
195
+ "maxLength": 2000
196
+ },
197
+ "idempotency_key": {
198
+ "$ref": "common.json#/$defs/idempotency_key"
199
+ }
200
+ }
201
+ },
202
+ "pause_request": {
203
+ "description": "Body of POST /v1/runs/{run_id}/pause (deferred; always refused with `unsupported`, capability `pause`).",
204
+ "type": "object",
205
+ "additionalProperties": false,
206
+ "required": [
207
+ "caller"
208
+ ],
209
+ "properties": {
210
+ "caller": {
211
+ "$ref": "common.json#/$defs/principal"
212
+ },
213
+ "idempotency_key": {
214
+ "$ref": "common.json#/$defs/idempotency_key"
215
+ }
216
+ }
217
+ },
218
+ "resume_request": {
219
+ "description": "Body of POST /v1/runs/{run_id}/resume (deferred; always refused with `unsupported`, capability `resume`).",
220
+ "type": "object",
221
+ "additionalProperties": false,
222
+ "required": [
223
+ "caller"
224
+ ],
225
+ "properties": {
226
+ "caller": {
227
+ "$ref": "common.json#/$defs/principal"
228
+ },
229
+ "idempotency_key": {
230
+ "$ref": "common.json#/$defs/idempotency_key"
231
+ }
232
+ }
233
+ },
234
+ "answer_request": {
235
+ "description": "Body of POST /v1/runs/{run_id}/answer (deferred; always refused with `unsupported`, capability `answer`).",
236
+ "type": "object",
237
+ "additionalProperties": false,
238
+ "required": [
239
+ "caller",
240
+ "question_id",
241
+ "answer"
242
+ ],
243
+ "properties": {
244
+ "caller": {
245
+ "$ref": "common.json#/$defs/principal"
246
+ },
247
+ "question_id": {
248
+ "type": "string",
249
+ "minLength": 1,
250
+ "maxLength": 128
251
+ },
252
+ "answer": {
253
+ "$ref": "common.json#/$defs/text"
254
+ },
255
+ "idempotency_key": {
256
+ "$ref": "common.json#/$defs/idempotency_key"
257
+ }
258
+ }
259
+ },
260
+ "accepted_response": {
261
+ "description": "202 response of steer and cancel: the recorded, accepted action.",
262
+ "type": "object",
263
+ "additionalProperties": false,
264
+ "required": [
265
+ "action"
266
+ ],
267
+ "properties": {
268
+ "action": {
269
+ "$ref": "#/$defs/action_record",
270
+ "properties": {
271
+ "outcome": {
272
+ "const": "accepted"
273
+ }
274
+ }
275
+ }
276
+ }
277
+ }
278
+ }
279
+ }
@@ -0,0 +1,269 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://culture.dev/contract/agents/error.json",
4
+ "title": "Error response",
5
+ "description": "Body of every non-2xx response. HTTP status, CLI exit code and retryability per code are fixed in api.json `errors` and README.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "error"
10
+ ],
11
+ "properties": {
12
+ "error": {
13
+ "$ref": "#/$defs/error"
14
+ }
15
+ },
16
+ "$defs": {
17
+ "code": {
18
+ "enum": [
19
+ "invalid",
20
+ "denied",
21
+ "not_found",
22
+ "busy",
23
+ "conflict",
24
+ "unsupported",
25
+ "incompatible_version",
26
+ "unavailable",
27
+ "internal"
28
+ ]
29
+ },
30
+ "error": {
31
+ "type": "object",
32
+ "additionalProperties": false,
33
+ "required": [
34
+ "code",
35
+ "message",
36
+ "retryable"
37
+ ],
38
+ "properties": {
39
+ "code": {
40
+ "$ref": "#/$defs/code"
41
+ },
42
+ "message": {
43
+ "description": "One human-readable sentence; for environment errors it includes a remediation hint.",
44
+ "type": "string",
45
+ "minLength": 1,
46
+ "maxLength": 2000
47
+ },
48
+ "retryable": {
49
+ "type": "boolean"
50
+ },
51
+ "capability": {
52
+ "description": "unsupported only: the capability that was refused.",
53
+ "$ref": "capabilities.json#/$defs/capability_name"
54
+ },
55
+ "field": {
56
+ "description": "invalid only (optional): JSON Pointer to the offending request field, or a query/path parameter name.",
57
+ "type": "string",
58
+ "maxLength": 200
59
+ },
60
+ "run_id": {
61
+ "description": "The run the error concerns, when there is one. Required for conflict.",
62
+ "$ref": "common.json#/$defs/run_id"
63
+ },
64
+ "active_run_id": {
65
+ "description": "busy only: the active run holding the repository.",
66
+ "$ref": "common.json#/$defs/run_id"
67
+ },
68
+ "repo": {
69
+ "description": "busy only: the canonical repository path that is busy.",
70
+ "$ref": "common.json#/$defs/repo_path"
71
+ },
72
+ "client_api_version": {
73
+ "$ref": "common.json#/$defs/api_version"
74
+ },
75
+ "server_api_version": {
76
+ "$ref": "common.json#/$defs/api_version"
77
+ }
78
+ },
79
+ "allOf": [
80
+ {
81
+ "if": {
82
+ "required": [
83
+ "code"
84
+ ],
85
+ "properties": {
86
+ "code": {
87
+ "const": "unsupported"
88
+ }
89
+ }
90
+ },
91
+ "then": {
92
+ "required": [
93
+ "capability"
94
+ ],
95
+ "properties": {
96
+ "retryable": {
97
+ "const": false
98
+ }
99
+ }
100
+ },
101
+ "else": {
102
+ "not": {
103
+ "required": [
104
+ "capability"
105
+ ]
106
+ }
107
+ }
108
+ },
109
+ {
110
+ "if": {
111
+ "required": [
112
+ "code"
113
+ ],
114
+ "properties": {
115
+ "code": {
116
+ "const": "busy"
117
+ }
118
+ }
119
+ },
120
+ "then": {
121
+ "required": [
122
+ "active_run_id",
123
+ "repo"
124
+ ],
125
+ "properties": {
126
+ "retryable": {
127
+ "const": true
128
+ }
129
+ }
130
+ },
131
+ "else": {
132
+ "not": {
133
+ "anyOf": [
134
+ {
135
+ "required": [
136
+ "active_run_id"
137
+ ]
138
+ },
139
+ {
140
+ "required": [
141
+ "repo"
142
+ ]
143
+ }
144
+ ]
145
+ }
146
+ }
147
+ },
148
+ {
149
+ "if": {
150
+ "required": [
151
+ "code"
152
+ ],
153
+ "properties": {
154
+ "code": {
155
+ "const": "incompatible_version"
156
+ }
157
+ }
158
+ },
159
+ "then": {
160
+ "required": [
161
+ "client_api_version",
162
+ "server_api_version"
163
+ ],
164
+ "properties": {
165
+ "retryable": {
166
+ "const": false
167
+ }
168
+ }
169
+ },
170
+ "else": {
171
+ "not": {
172
+ "anyOf": [
173
+ {
174
+ "required": [
175
+ "client_api_version"
176
+ ]
177
+ },
178
+ {
179
+ "required": [
180
+ "server_api_version"
181
+ ]
182
+ }
183
+ ]
184
+ }
185
+ }
186
+ },
187
+ {
188
+ "if": {
189
+ "required": [
190
+ "code"
191
+ ],
192
+ "properties": {
193
+ "code": {
194
+ "const": "invalid"
195
+ }
196
+ }
197
+ },
198
+ "else": {
199
+ "not": {
200
+ "required": [
201
+ "field"
202
+ ]
203
+ }
204
+ }
205
+ },
206
+ {
207
+ "if": {
208
+ "required": [
209
+ "code"
210
+ ],
211
+ "properties": {
212
+ "code": {
213
+ "const": "conflict"
214
+ }
215
+ }
216
+ },
217
+ "then": {
218
+ "required": [
219
+ "run_id"
220
+ ]
221
+ }
222
+ },
223
+ {
224
+ "if": {
225
+ "required": [
226
+ "code"
227
+ ],
228
+ "properties": {
229
+ "code": {
230
+ "const": "unavailable"
231
+ }
232
+ }
233
+ },
234
+ "then": {
235
+ "properties": {
236
+ "retryable": {
237
+ "const": true
238
+ }
239
+ }
240
+ }
241
+ },
242
+ {
243
+ "if": {
244
+ "required": [
245
+ "code"
246
+ ],
247
+ "properties": {
248
+ "code": {
249
+ "enum": [
250
+ "invalid",
251
+ "denied",
252
+ "not_found",
253
+ "internal"
254
+ ]
255
+ }
256
+ }
257
+ },
258
+ "then": {
259
+ "properties": {
260
+ "retryable": {
261
+ "const": false
262
+ }
263
+ }
264
+ }
265
+ }
266
+ ]
267
+ }
268
+ }
269
+ }