agl 42.0.0 → 42.2.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 (168) hide show
  1. package/changelog.md +44 -0
  2. package/dist_serve/bundle.js +2520 -2158
  3. package/dist_serve/bundle.js.map +2 -2
  4. package/dist_ts/00_commitinfo_data.js +1 -1
  5. package/dist_ts/aglapi/aglapisurface.document.js +124 -10
  6. package/dist_ts/classes.accountsactions.d.ts +3 -1
  7. package/dist_ts/classes.accountsactions.js +16 -1
  8. package/dist_ts/classes.authstore.d.ts +2 -0
  9. package/dist_ts/classes.authstore.js +58 -17
  10. package/dist_ts/classes.cli.js +19 -49
  11. package/dist_ts/classes.configurationauthority.js +2 -2
  12. package/dist_ts/classes.controller.d.ts +71 -2
  13. package/dist_ts/classes.controller.js +500 -113
  14. package/dist_ts/classes.controllerdevices.d.ts +128 -0
  15. package/dist_ts/classes.controllerdevices.js +472 -0
  16. package/dist_ts/classes.controllerservice.d.ts +20 -2
  17. package/dist_ts/classes.controllerservice.js +42 -6
  18. package/dist_ts/classes.flexservice.js +8 -3
  19. package/dist_ts/classes.inferencegateway.d.ts +30 -2
  20. package/dist_ts/classes.inferencegateway.js +115 -20
  21. package/dist_ts/classes.inferencerouter.d.ts +16 -0
  22. package/dist_ts/classes.inferencerouter.js +5 -3
  23. package/dist_ts/classes.inferenceservice.js +7 -3
  24. package/dist_ts/classes.sessionfeed.d.ts +10 -1
  25. package/dist_ts/classes.sessionfeed.js +12 -2
  26. package/dist_ts/classes.ticketmodels.js +4 -3
  27. package/dist_ts/classes.ticketnotifier.js +9 -2
  28. package/dist_ts/classes.ticketstore.js +9 -5
  29. package/dist_ts/classes.upgradecoordinator.d.ts +6 -1
  30. package/dist_ts/classes.upgradecoordinator.js +9 -2
  31. package/dist_ts/classes.upgradetransaction.d.ts +27 -1
  32. package/dist_ts/classes.upgradetransaction.js +92 -2
  33. package/dist_ts/classes.validation.d.ts +2 -0
  34. package/dist_ts/classes.validation.js +2 -2
  35. package/dist_ts/configuration/functions.master.d.ts +7 -2
  36. package/dist_ts/configuration/functions.master.js +7 -4
  37. package/dist_ts/driver/classes.drivereventrelay.d.ts +1 -1
  38. package/dist_ts/driver/classes.drivereventrelay.js +3 -3
  39. package/dist_ts/fleet/classes.boardpump.d.ts +1 -1
  40. package/dist_ts/fleet/classes.boardpump.js +7 -4
  41. package/dist_ts/fleet/classes.claudeworkers.d.ts +6 -0
  42. package/dist_ts/fleet/classes.claudeworkers.js +17 -7
  43. package/dist_ts/fleet/classes.deploymodels.d.ts +19 -0
  44. package/dist_ts/fleet/classes.deploymodels.js +140 -0
  45. package/dist_ts/fleet/functions.validation.d.ts +8 -1
  46. package/dist_ts/fleet/functions.validation.js +65 -3
  47. package/dist_ts/fleet/interfaces.workers.d.ts +6 -0
  48. package/dist_ts/fleet/interfaces.workers.js +65 -2
  49. package/dist_ts/functions.deviceapi.d.ts +28 -0
  50. package/dist_ts/functions.deviceapi.js +246 -0
  51. package/dist_ts/functions.deviceproof.d.ts +33 -0
  52. package/dist_ts/functions.deviceproof.js +93 -0
  53. package/dist_ts/functions.fleetworkercli.d.ts +16 -3
  54. package/dist_ts/functions.fleetworkercli.js +21 -7
  55. package/dist_ts/functions.inferencecli.js +4 -2
  56. package/dist_ts/functions.mcptickettools.d.ts +1 -0
  57. package/dist_ts/functions.remotecli.d.ts +1 -1
  58. package/dist_ts/functions.remotecli.js +12 -7
  59. package/dist_ts/functions.ticketvalidation.d.ts +36 -3
  60. package/dist_ts/functions.ticketvalidation.js +45 -14
  61. package/dist_ts/interfaces.auth.d.ts +1 -1
  62. package/dist_ts/interfaces.auth.js +7 -1
  63. package/dist_ts_authswitch/authority-contract.d.ts +23 -0
  64. package/dist_ts_authswitch/authority-contract.js +1 -1
  65. package/dist_ts_authswitch/classes.authoritybroker.d.ts +6 -0
  66. package/dist_ts_authswitch/classes.authoritybroker.js +31 -4
  67. package/dist_ts_authswitch/classes.authoritycli.d.ts +1 -0
  68. package/dist_ts_authswitch/classes.authoritycli.js +26 -1
  69. package/dist_ts_authswitch/classes.authorityclient.d.ts +3 -1
  70. package/dist_ts_authswitch/classes.authorityclient.js +10 -4
  71. package/dist_ts_authswitch/classes.authoritydaemon.js +7 -1
  72. package/dist_ts_authswitch/classes.authorityimport.js +2 -2
  73. package/dist_ts_authswitch/classes.authoritymodels.d.ts +3 -0
  74. package/dist_ts_authswitch/classes.authoritymodels.js +10 -3
  75. package/dist_ts_authswitch/testsupport.js +4 -4
  76. package/dist_ts_authswitch/ts_migration/0012_account_claude_code.d.ts +11 -0
  77. package/dist_ts_authswitch/ts_migration/0012_account_claude_code.js +18 -0
  78. package/dist_ts_authswitch/ts_migration/index.js +3 -1
  79. package/dist_ts_interfaces/deployments.d.ts +104 -0
  80. package/dist_ts_interfaces/deployments.js +8 -0
  81. package/dist_ts_interfaces/devices.d.ts +331 -0
  82. package/dist_ts_interfaces/devices.js +34 -0
  83. package/dist_ts_interfaces/fleet.d.ts +2 -0
  84. package/dist_ts_interfaces/index.d.ts +3 -0
  85. package/dist_ts_interfaces/index.js +4 -1
  86. package/dist_ts_interfaces/interfaces.d.ts +4 -2
  87. package/dist_ts_interfaces/interfaces.js +3 -2
  88. package/dist_ts_interfaces/mcprequests.d.ts +1 -1
  89. package/dist_ts_interfaces/requests.accounts.d.ts +18 -0
  90. package/dist_ts_interfaces/requests.accounts.js +1 -1
  91. package/dist_ts_interfaces/requests.d.ts +3 -2
  92. package/dist_ts_interfaces/requests.devices.d.ts +89 -0
  93. package/dist_ts_interfaces/requests.devices.js +2 -0
  94. package/dist_ts_interfaces/requests.js +1 -1
  95. package/dist_ts_interfaces/tickets.d.ts +53 -4
  96. package/dist_ts_interfaces/tickets.js +6 -2
  97. package/dist_ts_migration/index.d.ts +1 -0
  98. package/dist_ts_migration/index.js +2 -1
  99. package/dist_ts_migration/v41_ticketmigrationmarkers.d.ts +19 -0
  100. package/dist_ts_migration/v41_ticketmigrationmarkers.js +85 -0
  101. package/docs/authswitch.md +6 -0
  102. package/package.json +5 -5
  103. package/readme.md +84 -16
  104. package/ts/00_commitinfo_data.ts +1 -1
  105. package/ts/aglapi/aglapisurface.document.ts +123 -9
  106. package/ts/classes.accountsactions.ts +24 -0
  107. package/ts/classes.authstore.ts +54 -14
  108. package/ts/classes.cli.ts +17 -54
  109. package/ts/classes.configurationauthority.ts +1 -1
  110. package/ts/classes.controller.ts +697 -167
  111. package/ts/classes.controllerdevices.ts +469 -0
  112. package/ts/classes.controllerservice.ts +49 -6
  113. package/ts/classes.flexservice.ts +7 -2
  114. package/ts/classes.inferencegateway.ts +133 -19
  115. package/ts/classes.inferencerouter.ts +20 -2
  116. package/ts/classes.inferenceservice.ts +6 -3
  117. package/ts/classes.sessionfeed.ts +13 -1
  118. package/ts/classes.ticketmodels.ts +3 -2
  119. package/ts/classes.ticketnotifier.ts +8 -1
  120. package/ts/classes.ticketstore.ts +8 -4
  121. package/ts/classes.upgradecoordinator.ts +14 -4
  122. package/ts/classes.upgradetransaction.ts +118 -0
  123. package/ts/classes.validation.ts +1 -1
  124. package/ts/configuration/functions.master.ts +6 -3
  125. package/ts/driver/classes.drivereventrelay.ts +2 -2
  126. package/ts/fleet/classes.boardpump.ts +7 -4
  127. package/ts/fleet/classes.claudeworkers.ts +16 -6
  128. package/ts/fleet/classes.deploymodels.ts +44 -0
  129. package/ts/fleet/functions.validation.ts +50 -2
  130. package/ts/fleet/interfaces.workers.ts +56 -1
  131. package/ts/functions.deviceapi.ts +295 -0
  132. package/ts/functions.deviceproof.ts +118 -0
  133. package/ts/functions.fleetworkercli.ts +26 -8
  134. package/ts/functions.inferencecli.ts +3 -1
  135. package/ts/functions.remotecli.ts +11 -5
  136. package/ts/functions.ticketvalidation.ts +48 -13
  137. package/ts/interfaces.auth.ts +6 -0
  138. package/ts_authswitch/authority-contract.ts +18 -0
  139. package/ts_authswitch/classes.authoritybroker.ts +29 -3
  140. package/ts_authswitch/classes.authoritycli.ts +29 -0
  141. package/ts_authswitch/classes.authorityclient.ts +12 -4
  142. package/ts_authswitch/classes.authoritydaemon.ts +8 -1
  143. package/ts_authswitch/classes.authorityimport.ts +1 -1
  144. package/ts_authswitch/classes.authoritymodels.ts +5 -1
  145. package/ts_authswitch/native-contracts.md +10 -0
  146. package/ts_authswitch/testsupport.ts +3 -3
  147. package/ts_authswitch/ts_migration/0012_account_claude_code.ts +17 -0
  148. package/ts_authswitch/ts_migration/index.ts +2 -0
  149. package/ts_interfaces/deployments.ts +98 -0
  150. package/ts_interfaces/devices.schema.json +890 -0
  151. package/ts_interfaces/devices.ts +392 -0
  152. package/ts_interfaces/fleet.ts +2 -0
  153. package/ts_interfaces/index.ts +3 -0
  154. package/ts_interfaces/interfaces.ts +4 -1
  155. package/ts_interfaces/mcprequests.ts +1 -1
  156. package/ts_interfaces/requests.accounts.ts +16 -0
  157. package/ts_interfaces/requests.devices.ts +95 -0
  158. package/ts_interfaces/requests.ts +12 -0
  159. package/ts_interfaces/tickets.ts +34 -4
  160. package/ts_migration/index.ts +1 -0
  161. package/ts_migration/v41_ticketmigrationmarkers.ts +28 -0
  162. package/ts_web/00_commitinfo_data.ts +1 -1
  163. package/ts_web/classes.accountsreadmodel.ts +12 -1
  164. package/ts_web/classes.controllersocketclient.ts +27 -0
  165. package/ts_web/elements.accounts.ts +44 -0
  166. package/ts_web/elements.devices.ts +752 -0
  167. package/ts_web/elements.harnesscontrollerapp.ts +18 -1
  168. package/ts_web/elements.ticketboard.ts +15 -4
package/readme.md CHANGED
@@ -94,7 +94,7 @@ Each run of a turn's tool calls, with the reasoning between them, folds into one
94
94
  - A prebuilt `node-pty` platform package for Linux, macOS, or Windows on x64 or arm64.
95
95
  - For FlexHarness, a usable local TPM2, access to its resource-manager device (normally through the `tss` group), and `/usr/bin/systemd-creds` with its TPM2 runtime libraries.
96
96
 
97
- FlexHarness currently runs on Linux x64 with Node.js 24 or 25 and fails closed when its TPM requirements are unavailable. Other supported controller platforms still provide OpenCode and terminal functionality.
97
+ FlexHarness currently runs on Linux x64 with Node.js 24, 25 or 26 and fails closed when its TPM requirements are unavailable. Other supported controller platforms still provide OpenCode and terminal functionality.
98
98
 
99
99
  AGL includes an embedded NoSQLDB engine (`@lossless.org/nosqldb`), so a separate database server is optional. It also pins the official OpenCode SDK and platform binary packages to one tested version.
100
100
 
@@ -236,9 +236,19 @@ provider no longer accepts reads **Key rejected** and needs a new key: add one,
236
236
  authswitch account add openai-api-key --label "Codex key" --spend-limit 50 # asks for the key, not echoed
237
237
  authswitch account set <account-id> --spend-limit 80
238
238
  authswitch account set <account-id> --clear-spend-limit
239
+ authswitch account set <account-id> --claude-code off # a key whose credit is not for Claude Code
239
240
  authswitch account recheck <account-id> # lift a key's payment hold
240
241
  ```
241
242
 
243
+ A key serves Claude Code unless you keep it from it. **Keep from Claude Code** under **Clients** on the key's page
244
+ (`authswitch account set <account-id> --claude-code off`) is for a key whose credit its provider grants for API use
245
+ other than Claude Code. AGL's inference proxy then places no Claude Code request on the key: a Claude Code session on
246
+ it moves to another account at its next request, and with every sign-in at its limit Claude Code gets the usual 429
247
+ instead of the key. Every other client (Flex, OpenCode, a client of your own) still uses the key. A request counts as
248
+ Claude Code when it comes through the `claude` or `confined` client, or when its user agent names Claude Code
249
+ (`claude-cli/…`). `agl proxy status` marks such a key **not for Claude Code**, and its **Next new session: Claude** is
250
+ the account Claude Code's next session goes to. **Serve Claude Code** (`--claude-code on`) undoes it.
251
+
242
252
  AGL's inference proxy relays requests on keys when no subscription can take them (see [Claude accounts first, then API
243
253
  keys](#claude-accounts-first-then-api-keys) and [ChatGPT accounts first, then OpenAI API
244
254
  keys](#chatgpt-accounts-first-then-openai-api-keys)), and Flex's Claude models run on the Anthropic keys alone. A key has no
@@ -287,8 +297,10 @@ month's first spend, when the limit changes and when the key reaches or leaves i
287
297
  those the figure, and the 80% tone, are those of the last reading. `authswitch list` shows the same month in dollars.
288
298
 
289
299
  A key its provider refuses for billing or spend is held with a payment problem that says why (see [Payment
290
- problems](#payment-problems)): a billing error, the provider's monthly spend cap (lifted at the start of the next
291
- month), or a used-up credit or spend limit, its row's status **Spend cap reached** for the cap. **Re-check** on its page
300
+ problems](#payment-problems)): a billing error, Anthropic's "credit balance is too low" refusal (HTTP 400) of a key
301
+ whose organization has no credit left, the provider's monthly spend cap (lifted at the start of the next
302
+ month), or a used-up credit or spend limit, its row's status **Spend cap reached** for the cap. After adding credit in
303
+ the Claude Console, re-check the key: AGL cannot see a key's credit balance. **Re-check** on its page
292
304
  (`authswitch account recheck <account-id>`) lifts the hold at once, a spend cap's too, without asking the provider; if
293
305
  the provider still refuses, the next request moves to another account before a byte reaches the client and the hold is
294
306
  set again.
@@ -672,10 +684,17 @@ header receipt to 10 seconds and request receipt to 60 seconds.
672
684
  A successful streaming Responses answer must end with `response.completed`, `response.failed` or
673
685
  `response.incomplete`. An empty upstream HTTP 200 or a provider failure before any response body byte
674
686
  reaches the client becomes a logged JSON HTTP 502, not an empty successful stream. A failure after output
675
- starts is logged and ends with a Codex-readable `response.failed` event, never a fabricated completion or
687
+ starts is logged and ends with a `response.failed` event that Codex and the AI SDK Flex runs on both read,
688
+ numbered after the last event the client received (`sequence_number`), never a fabricated completion or
676
689
  a replay. Provider SSE `error` events are mapped to explicit failures; `context_length_exceeded` before
677
690
  output returns HTTP 400 with that code. Valid provider terminal events and successful output remain unchanged.
678
691
 
692
+ A request the proxy refuses before it knows the client (a missing, unreadable or unknown credential, or a request
693
+ not addressed to the proxy's own host) is logged with the path it asked for, its user agent and, for a 401, what it
694
+ presented as its credential (`missing`, `malformed`, `unknown` or `other_listener`), never the credential itself. The
695
+ same refusal line is written at most once a minute; the next one says how many like it the minute held, so a client
696
+ that retries in a loop can be found without flooding the journal.
697
+
679
698
  `UND_ERR_SOCKET` is not retried by the proxy, even before the first response body byte. Only the existing
680
699
  one-time same-account credential renewal on HTTP 401 and pre-output account hand-over on HTTP 429 replay
681
700
  requests. A client may retry a transient HTTP 502, but must not repeatedly resend an identical oversized
@@ -1207,7 +1226,7 @@ agl fleet worker reconfirm lane --ticket AGL-7 --reason "Revival fence; same ses
1207
1226
  agl fleet worker adopt claude-lane --ticket AGL-7 --profile claude-lane --cwd /srv/repos/example-worktree --native-id SESSION_UUID --relaunch-file /tmp/relaunch.md --json
1208
1227
  agl fleet worker adopt claude-lane --ticket AGL-7 --profile claude-lane --cwd /srv/repos/example-worktree --native-id COPY_UUID --rebind --reason "Lane continued as a copy outside AGL" --json
1209
1228
  agl fleet worker steer lane --ticket AGL-7 --message-file /tmp/message.md --json
1210
- agl fleet worker message 0f3c9a1e --ticket AGL-7 --message-file /tmp/message.md --json
1229
+ agl fleet worker message 0f3c9a1e --message-file /tmp/message.md --json
1211
1230
  agl fleet worker native-message 84965d6b --message-file /tmp/message.md --sender drv-agl --json
1212
1231
  agl fleet worker report lane --ticket AGL-7 --json
1213
1232
  agl fleet worker refresh lane --ticket AGL-7 --next-name lane2 --handoff-file /tmp/handoff.md --json
@@ -1270,7 +1289,9 @@ from the saved record. Codex workers are not re-bound and fail closed.
1270
1289
 
1271
1290
  `message NAME|NATIVE_ID --message-file FILE` steers one worker addressed by its fleet name or by
1272
1291
  the native session id it is bound to, or a unique prefix of that id of at least 8 characters; an
1273
- unbound session must be adopted first.
1292
+ unbound session must be adopted first. It needs no `--ticket`: the worker is steered on its own
1293
+ ticket. A `--ticket` the worker is not on (the ticket the message is about, say) and a worker on
1294
+ no ticket are refused before anything is sent.
1274
1295
 
1275
1296
  `steer --messages-file FILE` accepts a JSON array of `{name,text}` objects for multiple
1276
1297
  recipients. File contents are delivered unchanged. Claude starts with `--bg`, obtains its
@@ -1293,9 +1314,10 @@ prompt, or use a trusted working directory. The preflight never grants trust; Cl
1293
1314
  authoritative for linked-worktree and other trust checks. A start that exits non-zero without a
1294
1315
  `backgrounded` line and whose inventory gained no session of that name and directory was
1295
1316
  refused: the worker is `stopped` without a dispatch fence and can be archived. Any other
1296
- failed start keeps the fence. Relays group recipients by their observed permission mode, close
1297
- stdin and pass one `--allowedTools=SendMessage,Read,ToolSearch` argument. A relay addresses
1298
- each recipient by its session name from `agents --json --all`, which is how SendMessage
1317
+ failed start keeps the fence. Relays group recipients by their observed permission mode (any
1318
+ mode Claude Code records: `acceptEdits`, `auto`, `bypassPermissions`, `default`, `dontAsk`, `plan`
1319
+ or `manual`), close stdin and pass one `--allowedTools=SendMessage,Read,ToolSearch` argument. A
1320
+ relay addresses each recipient by its session name from `agents --json --all`, which is how SendMessage
1299
1321
  resolves a recipient; a name that another live session shares refuses before anything is sent.
1300
1322
  Each exact native tool receipt must prove queued delivery (`success: true` with a `msg_id`);
1301
1323
  held messages, permission changes, missing or unreachable recipients refuse. A send counts as
@@ -1336,7 +1358,8 @@ Claude can reap idle background processes while retaining their jobs and convers
1336
1358
  Fleet uses `agents --json --all`: a live PID/status receives a relay, including when idle;
1337
1359
  a retained `done` or `blocked` job without PID/status is reaped. Steering that worker, or one
1338
1360
  `claude stop` stopped, runs `--bg --resume` with its full UUID and the message, retaining the
1339
- native job's saved options. Fleet confirms the original identity and checks all output for copy
1361
+ native job's saved options. Fleet confirms the original identity, the short id on Claude's
1362
+ `backgrounded · <id>` line (` · <name>` follows only for a named job), and checks all output for copy
1340
1363
  notices. Claude Code 2.1.282 hands a woken job to its process a moment after the command exits:
1341
1364
  its inventory lists the job `working` without a PID, then with a PID before a status. Fleet
1342
1365
  polls it (every 250 ms, up to 30 s) until the same job is live with PID and status, binds its
@@ -1349,6 +1372,11 @@ place) and the command's credential-redacted output. When the original session c
1349
1372
  steer, `reconfirm` clears the fence (see below). Failed, recovering or removed jobs require inspection. Reports preserve the last
1350
1373
  assistant text and expose `reaped`; watch emits `worker.reaped` once per observed dormant
1351
1374
  period, including an initial dormant observation. This reports observed state, not a reap time.
1375
+ A report longer than 32 KiB of UTF-8 keeps its head (where a summary and the first rows stand),
1376
+ its last marker line (its `result:` line, at most 1 KiB) when neither the head nor the end holds
1377
+ it, and its last 4 KiB from a line start. A line `[… N bytes cut; the worker's transcript holds
1378
+ the whole report …]` stands for each part left out, and the report is marked `truncated`; the
1379
+ worker's own transcript keeps the whole message.
1352
1380
 
1353
1381
  Codex attaches the published shared daemon with its existing identity checks. A live turn
1354
1382
  uses its exact `turn/steer` identity. Subscribing to that existing thread preserves its native
@@ -1753,7 +1781,7 @@ question:` and the others the fleet reads as a report), each at most 1 KiB, then
1753
1781
  in order, with `[… N lines …]` where lines were left out. A note then says where the whole text
1754
1782
  is: a ticketed worker's report is the fleet comment of that report id on its ticket, and a
1755
1783
  stalled ticket's notice or another's change is on its ticket, all read with `ticket_get`. A
1756
- report longer than 32 KiB is kept by the fleet from its end only, which the note says. A batch waits 15
1784
+ report longer than 32 KiB is kept by the fleet as its head, its result line and its end, which the note says. A batch waits 15
1757
1785
  seconds for further events and is delivered at most once a minute. It waits while the driver runs a turn, including permission waits, using the current session state.
1758
1786
  If a batch is still queued when further events arrive, they merge into that same message,
1759
1787
  keeping its position and sender. The merged text is stored before the merge is acknowledged,
@@ -2873,7 +2901,7 @@ From then on, `start`, `stop`, `restart` and `upgrade` drive the unit for the AG
2873
2901
 
2874
2902
  `agl status` shows `agl-controller.service` in place of `detached` for a controller the unit runs. `agl service status [--json]` reports the unit's state, its port and AGL home, and its unit and log files. `agl service uninstall` disables the unit, stops the controller it runs, waits for the unit to stop and removes exactly the definition AGL installed; it refuses while processes it started, such as jobs, still run in the unit's control group. Start AGL detached again with `agl start`.
2875
2903
 
2876
- The unit carries `PATH` and `AGL_HOME`, and, when set, `AGL_DB_DIR`, `AGL_MONGO_DB`, `AGL_MONGO_URL`, `AGL_CODEX_EXECUTABLE`, `AGL_CLAUDE_EXECUTABLE`, `CODEX_HOME`, `CLAUDE_CONFIG_DIR`, `XDG_CONFIG_HOME`, `XDG_DATA_HOME`, `XDG_STATE_HOME`, `XDG_CACHE_HOME`, `NODE_EXTRA_CA_CERTS`, `SSL_CERT_FILE`, `SSL_CERT_DIR`, `TZ`, `HTTP_PROXY`, `HTTPS_PROXY` and `NO_PROXY`; nothing else from the installing shell reaches it. The unit file is readable by every local user, so it never holds a secret: `service install` refuses while `AGL_MONGO_URL`, `HTTP_PROXY` or `HTTPS_PROXY` carries credentials, and while `AGL_FORWARD_ENV` names variables the fixed set would drop. Such a controller keeps running detached.
2904
+ The unit carries `PATH` and `AGL_HOME`, and, when set, `AGL_DB_DIR`, `AGL_MONGO_DB`, `AGL_MONGO_URL`, `AGL_CODEX_EXECUTABLE`, `AGL_CLAUDE_EXECUTABLE`, `CODEX_HOME`, `CLAUDE_CONFIG_DIR`, `XDG_CONFIG_HOME`, `XDG_DATA_HOME`, `XDG_STATE_HOME`, `XDG_CACHE_HOME`, `NODE_EXTRA_CA_CERTS`, `SSL_CERT_FILE`, `SSL_CERT_DIR`, `TZ`, `HTTP_PROXY`, `HTTPS_PROXY` and `NO_PROXY`; nothing else from the installing shell reaches it. `PATH` is the installing shell's; when `service install` rewrites an installed unit, the unit's `PATH` keeps, after the shell's entries and in their old order, every directory of the installed unit's `PATH` the shell lacks that still exists, so installing from a shell without, say, `~/.bun/bin` does not take Bun away from the controller (an empty, relative or removed directory is dropped, and the command names the directories it kept). To take a directory out, `agl service uninstall` first. The unit file is readable by every local user, so it never holds a secret: `service install` refuses while `AGL_MONGO_URL`, `HTTP_PROXY` or `HTTPS_PROXY` carries credentials, and while `AGL_FORWARD_ENV` names variables the fixed set would drop. Such a controller keeps running detached.
2877
2905
 
2878
2906
  The unit appends the controller's errors to the same `$AGL_HOME/logs/controller-<port>.log` a detached controller writes; standard output is discarded, as it is for a detached controller.
2879
2907
 
@@ -2937,6 +2965,8 @@ While stopped turns are ending, progress output and the private upgrade log list
2937
2965
 
2938
2966
  An upgrade prepared by AGL 39.5.x or older paused its cohort with a control prompt instead. The release that ends this is installed by such an AGL, which still pauses; install it while the Driver is idle, or stop the controller first (`agl stop`, `agl upgrade`, `agl start`). The new controller reads that older transaction and continues its paused conversations with `--continue-sessions`.
2939
2967
 
2968
+ `agl upgrade` asks a running controller to launch the upgrade worker against a one-time grant. When the controller refuses before it takes the grant, as one still starting right after a restart does, or the request never reaches it, the command fails, the upgrade ends as failed and the next `agl upgrade` can start at once. Only a launch that failed after the controller took the grant keeps the upgrade open, since a worker the command cannot see may run.
2969
+
2940
2970
  If a forward-only upgrade worker is lost after target startup or package commit begins, a later fixed AGL installation can adopt exactly one stalled transaction during an explicit `agl upgrade`. Adoption requires a free port, no live worker, controller, Flex child, temporary-password writer, or token-bound metadata, and a compatible installed version. It preserves the original preparation timeline and stopped cohort. Do not delete upgrade files, copy transactions between roots, downgrade the package, or bypass recovery with `agl start`.
2941
2971
 
2942
2972
  Upgrade coordination lives under `$AGL_HOME/upgrade`. Private logs live under `$AGL_HOME/logs`.
@@ -2947,13 +2977,19 @@ A failure reference from the Errors dialog appears in those logs on the line the
2947
2977
 
2948
2978
  41.1.0 and the later 41.x releases are the ones this release rolls back to. This release keeps a port's trusted-proxy secret sealed in the controller's database and never exports it, and `agl remote set` can store gateway sources, which 41.x cannot enforce. To roll back a port that this release serves behind a TLS reverse proxy:
2949
2979
 
2950
- 1. Stop the controller and run `agl remote unset --port <port>`. It moves the port back to `http://localhost:<port>` and removes its passkey, so the next start prints a setup code. A 41.x controller refuses to start on a configuration with gateway sources, and its refusal names this command.
2980
+ 1. Stop the controller and run `agl remote unset --port <port>`. It moves the port back to `http://localhost:<port>` and removes its passkey and every paired device, so the next start prints a setup code. A 41.x controller refuses to start on a configuration with gateway sources, and its refusal names this command.
2951
2981
  2. Roll back and start the controller. Roll back only while no upgrade is open: 41.x refuses an upgrade transaction this release created.
2952
2982
  3. To serve 41.x behind the proxy again, generate a new secret and set it both on the proxy route (`X-Harness-Controller-Proxy-Secret`) and in `AGL_TRUSTED_PROXY_SECRET`, as 41.x's readme describes. 41.x fixes a port's public origin and TLS mode on its first start, so that is a port that has not been started yet.
2953
2983
 
2954
2984
  A recovery of AGL 42 that would roll a stalled upgrade back to a release older than 42 first checks the port's stored configuration: while it names gateway sources (`agl remote set --gateway-source`), which such a release refuses to start on and has no command to remove, it restores nothing and asks you to run `agl remote unset --port 4097` with 42, still installed, and then `agl upgrade --port 4097` again. Whether the release it would put back supports gateway sources is what that release's package declares (`controllerGatewaySourcesVersion`), as the upgrade recorded it when it started.
2955
2985
 
2956
- The audit events of types 41.x does not know (`remote.*`) stay in the audit log and are pruned with the others.
2986
+ The audit events of types 41.x does not know (`remote.*`, `device.*`) stay in the audit log and are pruned with the others.
2987
+
2988
+ ### Rolling back from a release that plans deploys
2989
+
2990
+ A later release that plans deploys (AGL-909) stores what 42.1.0 cannot read: release plans, maintenance windows and deploy plans on tickets, `affects` links, release links without a package, the Closed column, and the Configuration master's `fleet.deployTargets`. 42.1.0 and earlier refuse a ticket or a master that holds any of them, so roll such a release back to 42.1.1 or a later 42.1.x. 42.1.1 reads all of it and acts on none of it: it probes no deploy target, plans and asks nothing, and moves no ticket to Closed.
2991
+
2992
+ While the master holds `fleet.deployTargets`, 42.1.1 refuses every save of the master, from the CLI or the browser, and the refusal names `fleet.deployTargets`. It reads them, but saving them is left to the release that acts on them. To change the master after the rollback, save it without `fleet.deployTargets`; that removes the targets until you configure them again on the later release. Or remove them on the later release before rolling back.
2957
2993
 
2958
2994
  ### Migrating From `hcon`
2959
2995
 
@@ -3078,7 +3114,8 @@ agl start --port 4097 # prints the setup code for https://agl.example.com
3078
3114
  - The controller keeps its id (`controller:4097`) and all of its data: projects, conversations, tickets, settings and the audit trail. Only the public origin, the WebAuthn RP ID (the origin's hostname when `--rp-id` is omitted; IP addresses and public suffixes are refused) and the gateway sources change.
3079
3115
  - A passkey belongs to its RP ID. When the origin or RP ID changes, the passkey is removed and every temporary password revoked, so nothing that signed in to the old origin signs in to the new one. The next `agl start` prints a fresh setup code to its terminal, never to a log: enroll the passkey at the new origin with it. Running `remote set` again with only other gateway sources keeps the passkey.
3080
3116
  - `--gateway-source` names an address the proxy's connections arrive from (IPv4 or IPv6, repeatable, at most 16). Without one only a reverse proxy on this host reaches the controller.
3081
- - `agl remote unset --port 4097` moves the port back to `http://localhost:4097` (RP ID `localhost`): it removes the passkey, revokes every temporary password and forgets the trusted-proxy secret. The next start prints a setup code.
3117
+ - A paired device signs the public origin (see Paired Devices), so a changed origin removes every paired device as well; `remote set` says how many. Changing only the gateway sources or the RP ID keeps them.
3118
+ - `agl remote unset --port 4097` moves the port back to `http://localhost:4097` (RP ID `localhost`): it removes the passkey and every paired device, revokes every temporary password and forgets the trusted-proxy secret. The next start prints a setup code.
3082
3119
  - Both refuse while anything listens on the port, take start admission (no upgrade runs meanwhile), run as the local OS user (the trust `agl temp-password` has) and are audited as `remote.set` or `remote.unset`, attempted and then succeeded or failed, with the OS user and process and the public origin and RP ID the move goes from and to (never a secret).
3083
3120
  - A start never moves a port: one that asks for another `--public-origin`, `--rp-id` or TLS mode is refused and names `agl remote set`. A new port can still start behind a reverse proxy on this host directly: `agl start --public-origin https://agl.example.com --rp-id agl.example.com --behind-tls-proxy`.
3084
3121
 
@@ -3135,11 +3172,42 @@ sudo ufw status verbose # the allow is listed before the deny, and no broader
3135
3172
 
3136
3173
  The gateway source is the address the proxy's connections arrive from on this host. A router that translates addresses between the proxy and this host puts its own address there, and every host behind it then passes the source check: route without translation, or put the proxy on this host's network.
3137
3174
 
3175
+ ## Paired Devices
3176
+
3177
+ A phone or a desktop app pairs with a controller and then reaches it as a device: it lists the session feed, reads a session's transcript, sends a message to a session and answers its permissions and questions. A device reaches nothing else: no terminals, settings, accounts, tickets, browsers or files. It connects through the controller's public HTTPS origin (Remote Browser Access), so a controller in local mode pairs no device.
3178
+
3179
+ ### Pairing a device
3180
+
3181
+ **Settings → Devices → Pair a device** makes a single-use pairing code and shows it as a QR code, with its expiry:
3182
+
3183
+ - The code is 32 random bytes, valid for five minutes and once; at most four wait at once, and closing the dialog withdraws its code. Codes live only in the controller's memory, so a restart voids them. The QR code carries `agl-pair:?origin=<public origin>&controller=<controller id>&code=<code>`. Anyone who has the code can pair until it expires: show it only to the device you pair.
3184
+ - A device without a camera, such as the Linux desktop app, pairs with the same code as a pairing link: **Copy pairing link** beside the QR code puts exactly the QR code's `agl-pair:` link on the clipboard, and you paste it into the app on that device. Nothing is copied unless you press it, and the button is there only while a code waits and the page may write the clipboard (an HTTPS or localhost page). The link is the same single-use, five-minute code, not a second one, and AGL does not clear the clipboard afterwards: paste it only on the device you pair, and close the dialog to withdraw an unused code.
3185
+ - The app makes its own P-256 key (on an iPhone in the Secure Enclave), signs the code with it and sends its name, model and public key. The controller keeps the public key and nothing secret.
3186
+ - The dialog then shows the device's name and its key fingerprint (SHA-256 of the key, the first 16 bytes as eight groups of four hex digits), which the app shows too. Compare the two, above all after pairing by a copied link; if they differ, **Revoke** in the same dialog removes the device at once.
3187
+ - A controller holds at most 16 devices.
3188
+
3189
+ Each connection of a device authenticates on its own: the controller hands it a nonce, the device signs it with its key, and the connection holds the device's authentication on the server side until it closes. The signed messages bind the controller id, the public origin and the code or nonce, so a signature made for one controller or origin is useless at another.
3190
+
3191
+ ### Managing devices
3192
+
3193
+ Settings → Devices lists every paired device with its model, when it paired, whether it is connected now and when it last connected. A device's page shows its key fingerprint and id. **Revoke** deletes the device and closes every connection of it at once with WebSocket close code 4403; the device must pair again with a new code. Moving the controller to another public origin with `agl remote set` or `agl remote unset` removes every device, since each signed the old origin; the devices go in the same transaction as the move, so a move that fails keeps them. Pairing, authentication and revocation are audited (`device.pairing.begin`, `device.pair`, `device.auth`, `device.revoke`), and every request of a device is audited under `device:<id>`.
3194
+
3195
+ ### The device protocol
3196
+
3197
+ The device API is its own contract, separate from the browser's: `ts_interfaces/devices.ts` in the package, and the same contracts as JSON Schema in `ts_interfaces/devices.schema.json` (each contract's request and response, and every named type they reach). A device asks `device.hello` for the device protocol version (`major` 1, `minor` 0) and speaks one major; within it, changes only add. Apps generate their clients from these files.
3198
+
3199
+ - Before it is authenticated a connection reaches `device.hello`, `device.pair`, `device.auth.challenge` and `device.auth.prove`, under the controller's limits for unauthenticated requests: per connection, and in total together with the browser's sign-in requests. After that it reaches `device.sessions.list`, `device.session.read`, `device.session.send`, `device.permission.reply` and `device.question.reply`, under the limits of the owner's browser. A device never reaches a method of the browser, and the browser never one of a device. A connection is one or the other for its whole life: a connection signed in as the browser cannot authenticate as a device, and one a device authenticated cannot sign in as the browser.
3200
+ - The feed is the sidebar's session feed without terminal rows, host directories or tickets. A transcript page reduces a tool call to its name, title and status; its input and output stay on the controller. `device.session.read` without `before` returns the newest page, sized by the controller whatever `limit` says; with `before` it returns the next older page of `limit` messages (1 to 50, default 20). A device names a session only by the feed's row id, and reaches only what the feed lists.
3201
+ - A message from a device is a direct message (it queues behind a running turn), never the browser's shared draft. A native session AGL does not write to (another process runs it, a fleet worker owns it) refuses it, as it refuses the browser.
3202
+ - The controller pushes a device an allowlist of events in their own shape: feed changes, a session's change, its streaming text (snapshots and exact deltas) and a resynchronization request. Every other event, and every event about a session the feed does not list, stays on the controller. A device that falls behind by 256 events or 4 MiB is resynchronized alone.
3203
+ - Through the gateway, a device's WebSocket upgrade carries the public origin as `Origin`, like a browser's (Admission).
3204
+
3138
3205
  ## Security Boundaries
3139
3206
 
3140
3207
  - Local mode binds the controller to loopback only, and so does TLS-proxy mode without a gateway source. With one, a request from off loopback needs a configured gateway source address and the trusted-proxy secret, and only loopback connects without an `Origin`.
3141
3208
  - The trusted-proxy secret is generated and TPM2-sealed in the controller's database; it is never read from the environment, written to a file or logged.
3142
- - Only `agl remote`, run by the local OS user against a stopped controller, changes a port's public origin, RP ID, TLS mode or gateway sources, and a changed origin or RP ID removes the passkey.
3209
+ - Only `agl remote`, run by the local OS user against a stopped controller, changes a port's public origin, RP ID, TLS mode or gateway sources, and a changed origin or RP ID removes the passkey (a changed origin every paired device too).
3210
+ - A paired device holds its own key; the controller stores only its public key. A device reaches only the device scope (feed, bounded reads, direct sends, permission and question answers), each connection proves the key over a fresh nonce, and revoking a device closes its connections at once. Pairing codes are single-use, live five minutes in memory only, and pairing is refused in local mode.
3143
3211
  - The private OpenCode server always remains on loopback and uses a generated per-process password.
3144
3212
  - Application RPC starts only after the exact TypedSocket package-major handshake.
3145
3213
  - The management endpoint (`/management/typedrequest`, used by the CLI and the upgrade worker) answers only an HTTP `POST` of `application/json` from a loopback peer (`127.0.0.1` or `::1`), addressed to `127.0.0.1:<port>`, with no `Origin` and no forwarding header (`Forwarded`, `X-Forwarded-*`, `X-Real-IP`, `X-Harness-Controller-Proxy-Secret`), so a browser or a request a proxy forwards is refused, also in proxy mode. It serves only the status read and the upgrade methods; each upgrade method authorises itself against the upgrade token and its one-time grant, as it does over the socket, and every upgrade request counts against the controller's global unauthenticated preflight limit.
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: 'agl',
6
- version: '42.0.0',
6
+ version: '42.2.0',
7
7
  description: 'Agent Gateway Layer for OpenCode, FlexHarness, and Codex sessions'
8
8
  }
@@ -3765,7 +3765,7 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
3765
3765
  },
3766
3766
  "protocolVersion": {
3767
3767
  "type": "number",
3768
- "const": 48
3768
+ "const": 50
3769
3769
  },
3770
3770
  "upgradeManagementVersion": {
3771
3771
  "type": "number"
@@ -3891,7 +3891,7 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
3891
3891
  ],
3892
3892
  "additionalProperties": false
3893
3893
  },
3894
- "declaration": "interface IControllerStatus {\n packageName: string;\n packageVersion: string;\n protocolVersion: 48;\n upgradeManagementVersion: number;\n /**\n * The protocol of the controller's loopback management endpoint (`controllerManagementProtocolVersion`); absent\n * from a controller older than the endpoint, which this release refuses to manage.\n */\n managementProtocolVersion?: number;\n controllerPid: number;\n processGroupId: number;\n processFingerprint: string;\n processMode: TControllerProcessMode;\n lifecycleState: TControllerLifecycleState;\n startedAt: number;\n setupRequired: boolean;\n /** Present when the controller runs as the systemd user unit (`agl service install`); absent for a detached or foreground one. */\n serviceUnit?: \"agl-controller.service\";\n /** The TLS mode of the runtime configuration the controller runs with; absent until it is resolved. */\n tlsMode?: TControllerTlsMode;\n upgrade?: IControllerUpgradeStatus;\n /** AGL's inference proxy, by state only; details need a signed-in owner (`controller.proxy.status.get`). */\n proxy?: { state: TControllerProxyState };\n harnesses: Array<{\n harnessId: TControllerSessionHarnessId;\n pid?: number;\n state: TControllerHarnessLifecycleState;\n healthy: boolean;\n version?: string;\n supportsLocalAttachments?: boolean;\n connectionMode?: 'local' | 'shared' | 'remote';\n diagnostic?: IControllerCodexDiagnostic;\n /** Codex only: automatic reconnection of this entry's profile to the local shared app-server. */\n rejoin?: IControllerCodexRejoinStatus;\n /**\n * Codex only, on the controller status: every connected or required profile. The entry's\n * `healthy` is then true only when each of them is, apart from a profile on an account Codex\n * cannot run on now, listed `stopped` with an `account_unavailable` diagnostic that says why;\n * its other members describe the default profile.\n */\n profiles?: IControllerCodexProfileStatus[];\n }>;\n}"
3894
+ "declaration": "interface IControllerStatus {\n packageName: string;\n packageVersion: string;\n protocolVersion: 50;\n upgradeManagementVersion: number;\n /**\n * The protocol of the controller's loopback management endpoint (`controllerManagementProtocolVersion`); absent\n * from a controller older than the endpoint, which this release refuses to manage.\n */\n managementProtocolVersion?: number;\n controllerPid: number;\n processGroupId: number;\n processFingerprint: string;\n processMode: TControllerProcessMode;\n lifecycleState: TControllerLifecycleState;\n startedAt: number;\n setupRequired: boolean;\n /** Present when the controller runs as the systemd user unit (`agl service install`); absent for a detached or foreground one. */\n serviceUnit?: \"agl-controller.service\";\n /** The TLS mode of the runtime configuration the controller runs with; absent until it is resolved. */\n tlsMode?: TControllerTlsMode;\n upgrade?: IControllerUpgradeStatus;\n /** AGL's inference proxy, by state only; details need a signed-in owner (`controller.proxy.status.get`). */\n proxy?: { state: TControllerProxyState };\n harnesses: Array<{\n harnessId: TControllerSessionHarnessId;\n pid?: number;\n state: TControllerHarnessLifecycleState;\n healthy: boolean;\n version?: string;\n supportsLocalAttachments?: boolean;\n connectionMode?: 'local' | 'shared' | 'remote';\n diagnostic?: IControllerCodexDiagnostic;\n /** Codex only: automatic reconnection of this entry's profile to the local shared app-server. */\n rejoin?: IControllerCodexRejoinStatus;\n /**\n * Codex only, on the controller status: every connected or required profile. The entry's\n * `healthy` is then true only when each of them is, apart from a profile on an account Codex\n * cannot run on now, listed `stopped` with an `account_unavailable` diagnostic that says why;\n * its other members describe the default profile.\n */\n profiles?: IControllerCodexProfileStatus[];\n }>;\n}"
3895
3895
  },
3896
3896
  {
3897
3897
  "name": "IControllerTerminalResource",
@@ -4400,6 +4400,15 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
4400
4400
  "$ref": "#/$defs/TTicketLink"
4401
4401
  }
4402
4402
  },
4403
+ "releasePlan": {
4404
+ "$ref": "#/$defs/ITicketReleasePlan"
4405
+ },
4406
+ "maintenanceWindow": {
4407
+ "$ref": "#/$defs/ITicketMaintenanceWindow"
4408
+ },
4409
+ "deployPlan": {
4410
+ "$ref": "#/$defs/ITicketDeployPlan"
4411
+ },
4403
4412
  "source": {
4404
4413
  "$ref": "#/$defs/ITicketSource"
4405
4414
  },
@@ -4476,7 +4485,7 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
4476
4485
  ],
4477
4486
  "additionalProperties": false
4478
4487
  },
4479
- "declaration": "interface ITicket {\n id: string;\n key: string;\n revision: number;\n project: string;\n kind: TTicketKind;\n title: string;\n description: string;\n parentId?: string;\n columnId: TTicketColumn;\n order: number;\n priority: TTicketPriority;\n assignee?: ITicketPerson;\n labels: string[];\n links: TTicketLink[];\n source: ITicketSource;\n createdBy: ITicketActor;\n updatedBy: ITicketActor;\n createdAt: string;\n updatedAt: string;\n permissions?: { edit: boolean; move: boolean; comment: boolean; createChild: boolean; ask: boolean; answer: boolean };\n /** Computed on read by the AutoLabel rules, never persisted and never set by hand. */\n autoLabels?: TTicketAutoLabel[];\n}"
4488
+ "declaration": "interface ITicket {\n id: string;\n key: string;\n revision: number;\n project: string;\n kind: TTicketKind;\n title: string;\n description: string;\n parentId?: string;\n columnId: TTicketColumn;\n order: number;\n priority: TTicketPriority;\n assignee?: ITicketPerson;\n labels: string[];\n links: TTicketLink[];\n releasePlan?: ITicketReleasePlan;\n maintenanceWindow?: ITicketMaintenanceWindow;\n deployPlan?: ITicketDeployPlan;\n source: ITicketSource;\n createdBy: ITicketActor;\n updatedBy: ITicketActor;\n createdAt: string;\n updatedAt: string;\n permissions?: { edit: boolean; move: boolean; comment: boolean; createChild: boolean; ask: boolean; answer: boolean };\n /** Computed on read by the AutoLabel rules, never persisted and never set by hand. */\n autoLabels?: TTicketAutoLabel[];\n}"
4480
4489
  },
4481
4490
  {
4482
4491
  "name": "ITicketActivity",
@@ -4504,6 +4513,7 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
4504
4513
  "reordered",
4505
4514
  "commented",
4506
4515
  "linked",
4516
+ "unlinked",
4507
4517
  "asked",
4508
4518
  "answered"
4509
4519
  ]
@@ -4530,7 +4540,7 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
4530
4540
  ],
4531
4541
  "additionalProperties": false
4532
4542
  },
4533
- "declaration": "interface ITicketActivity {\n id: string;\n ticketId: string;\n actor: ITicketActor;\n createdAt: string;\n action: 'created' | 'updated' | 'moved' | 'reordered' | 'commented' | 'linked' | 'asked' | 'answered';\n changes: Record<string, { before?: unknown; after?: unknown }>;\n}"
4543
+ "declaration": "interface ITicketActivity {\n id: string;\n ticketId: string;\n actor: ITicketActor;\n createdAt: string;\n action: 'created' | 'updated' | 'moved' | 'reordered' | 'commented' | 'linked' | 'unlinked' | 'asked' | 'answered';\n changes: Record<string, { before?: unknown; after?: unknown }>;\n}"
4534
4544
  },
4535
4545
  {
4536
4546
  "name": "ITicketActor",
@@ -4729,6 +4739,31 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
4729
4739
  "name": "ITicketCreate",
4730
4740
  "declaration": "interface ITicketCreate {\n project: string;\n kind?: TTicketKind;\n title: string;\n description?: string;\n columnId?: TTicketColumn;\n parentId?: string;\n priority?: TTicketPriority;\n assignee?: ITicketPerson;\n labels?: string[];\n sourceText?: string;\n attachments?: ITicketAttachment[];\n}"
4731
4741
  },
4742
+ {
4743
+ "name": "ITicketDeployPlan",
4744
+ "schema": {
4745
+ "type": "object",
4746
+ "properties": {
4747
+ "target": {
4748
+ "type": "string"
4749
+ },
4750
+ "version": {
4751
+ "type": "string"
4752
+ },
4753
+ "questionId": {
4754
+ "type": "string"
4755
+ }
4756
+ },
4757
+ "required": [
4758
+ "target",
4759
+ "version",
4760
+ "questionId"
4761
+ ],
4762
+ "additionalProperties": false,
4763
+ "description": "A planned deploy: the deploy target should run `version`, a release of its repository, or a newer one. Setting it asks the owner `questionId` on the ticket; the answer is the owner's go."
4764
+ },
4765
+ "declaration": "/**\n * A planned deploy: the deploy target should run `version`, a release of its repository, or a newer one. Setting it\n * asks the owner `questionId` on the ticket; the answer is the owner's go.\n */\ninterface ITicketDeployPlan { target: string; version: string; questionId: string }"
4766
+ },
4732
4767
  {
4733
4768
  "name": "ITicketDetail",
4734
4769
  "schema": {
@@ -4778,6 +4813,37 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
4778
4813
  "name": "ITicketGet",
4779
4814
  "declaration": "/** A ticket and one page of its history: the newest entries, or those older than the entry `before` names, within `ticketHistoryPage`. */\ninterface ITicketGet {\n ticketId: string;\n /** An activity id, as `historyBefore` returned it: the page holds only older entries. */\n before?: string;\n /** Entries on the page, 1 to 500 (`ticketHistoryPage.maximum`); 50 (`ticketHistoryPage.default`) when absent. */\n limit?: number;\n /**\n * One comment of this ticket, by the id an activity entry or a fleet event names: the response holds the ticket, its\n * questions and that comment alone (`comments: [it]`, `activity: []`, no `historyBefore`). Excludes `before` and `limit`.\n */\n commentId?: string;\n}"
4780
4815
  },
4816
+ {
4817
+ "name": "ITicketMaintenanceWindow",
4818
+ "schema": {
4819
+ "type": "object",
4820
+ "properties": {
4821
+ "from": {
4822
+ "type": "string"
4823
+ },
4824
+ "to": {
4825
+ "type": "string"
4826
+ },
4827
+ "targets": {
4828
+ "type": "array",
4829
+ "items": {
4830
+ "type": "string"
4831
+ }
4832
+ },
4833
+ "questionId": {
4834
+ "type": "string"
4835
+ }
4836
+ },
4837
+ "required": [
4838
+ "from",
4839
+ "to",
4840
+ "targets"
4841
+ ],
4842
+ "additionalProperties": false,
4843
+ "description": "A maintenance window: between `from` and `to` (ISO 8601 instants, `to` after `from`) the deploy targets it lists may be deployed, which a target whose deploys need a window waits for. A window counts while its ticket is not done. `questionId` is the owner's question on the ticket when the driver proposed the window: it counts once the owner approves it there. The owner's own window has none and counts at once."
4844
+ },
4845
+ "declaration": "/**\n * A maintenance window: between `from` and `to` (ISO 8601 instants, `to` after `from`) the deploy targets it lists may\n * be deployed, which a target whose deploys need a window waits for. A window counts while its ticket is not done.\n * `questionId` is the owner's question on the ticket when the driver proposed the window: it counts once the owner\n * approves it there. The owner's own window has none and counts at once.\n */\ninterface ITicketMaintenanceWindow { from: string; to: string; targets: string[]; questionId?: string }"
4846
+ },
4781
4847
  {
4782
4848
  "name": "ITicketMove",
4783
4849
  "declaration": "interface ITicketMove { ticketId: string; columnId: TTicketColumn; beforeTicketId?: string; }"
@@ -4939,6 +5005,26 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
4939
5005
  },
4940
5006
  "declaration": "/**\n * A question in a ticket's discussion. Field names follow dees-catalog's `IHarnessQuestionRequest`\n * (`question`, `options`, `multiSelect`, `allowCustom`) so the board can show the chat's question card.\n */\ninterface ITicketQuestionOption {\n /** Assigned by AGL: '1' to 'n' in option order. */\n id: string;\n label: string;\n description?: string;\n}"
4941
5007
  },
5008
+ {
5009
+ "name": "ITicketReleasePlan",
5010
+ "schema": {
5011
+ "type": "object",
5012
+ "properties": {
5013
+ "repo": {
5014
+ "type": "string"
5015
+ },
5016
+ "version": {
5017
+ "type": "string"
5018
+ }
5019
+ },
5020
+ "required": [
5021
+ "repo"
5022
+ ],
5023
+ "additionalProperties": false,
5024
+ "description": "A planned release: the repository (`org/name`, one fleet discovery knows) and, optionally, the version it should reach; without a version it means the next release. A hotfix is the same plan on an urgent ticket."
5025
+ },
5026
+ "declaration": "/**\n * A planned release: the repository (`org/name`, one fleet discovery knows) and, optionally, the version it should\n * reach; without a version it means the next release. A hotfix is the same plan on an urgent ticket.\n */\ninterface ITicketReleasePlan { repo: string; version?: string }"
5027
+ },
4942
5028
  {
4943
5029
  "name": "ITicketSource",
4944
5030
  "schema": {
@@ -5827,10 +5913,11 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
5827
5913
  "needs_input",
5828
5914
  "review",
5829
5915
  "landed",
5830
- "released"
5916
+ "released",
5917
+ "closed"
5831
5918
  ]
5832
5919
  },
5833
- "declaration": "type TTicketColumn = (readonly [\"backlog\", \"ready\", \"in_progress\", \"needs_input\", \"review\", \"landed\", \"released\"])[number];"
5920
+ "declaration": "type TTicketColumn = (readonly [\"backlog\", \"ready\", \"in_progress\", \"needs_input\", \"review\", \"landed\", \"released\", \"closed\"])[number];"
5834
5921
  },
5835
5922
  {
5836
5923
  "name": "TTicketKind",
@@ -5901,23 +5988,50 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
5901
5988
  "type": "string",
5902
5989
  "const": "release"
5903
5990
  },
5991
+ "version": {
5992
+ "type": "string"
5993
+ },
5904
5994
  "package": {
5905
5995
  "type": "string"
5906
5996
  },
5997
+ "repo": {
5998
+ "type": "string"
5999
+ },
6000
+ "sha": {
6001
+ "type": "string"
6002
+ }
6003
+ },
6004
+ "required": [
6005
+ "kind",
6006
+ "version"
6007
+ ],
6008
+ "additionalProperties": false
6009
+ },
6010
+ {
6011
+ "type": "object",
6012
+ "properties": {
6013
+ "kind": {
6014
+ "type": "string",
6015
+ "const": "affects"
6016
+ },
6017
+ "repo": {
6018
+ "type": "string"
6019
+ },
5907
6020
  "version": {
5908
6021
  "type": "string"
5909
6022
  }
5910
6023
  },
5911
6024
  "required": [
5912
6025
  "kind",
5913
- "package",
6026
+ "repo",
5914
6027
  "version"
5915
6028
  ],
5916
6029
  "additionalProperties": false
5917
6030
  }
5918
- ]
6031
+ ],
6032
+ "description": "Evidence a ticket carries. A release is a repository's tag `v<version>`: its link names the repository (`org/name`) and the commit the tag points at, and the package it published where there is one; a release linked by hand names the package alone. `affects` records the version of a repository a bug was found in."
5919
6033
  },
5920
- "declaration": "type TTicketLink =\n | { kind: 'branch'; repo: string; branch: string; sha: string }\n | { kind: 'commit'; repo: string; sha: string }\n | { kind: 'release'; package: string; version: string };"
6034
+ "declaration": "/**\n * Evidence a ticket carries. A release is a repository's tag `v<version>`: its link names the repository (`org/name`)\n * and the commit the tag points at, and the package it published where there is one; a release linked by hand names\n * the package alone. `affects` records the version of a repository a bug was found in.\n */\ntype TTicketLink =\n | { kind: 'branch'; repo: string; branch: string; sha: string }\n | { kind: 'commit'; repo: string; sha: string }\n | { kind: 'release'; version: string; package?: string; repo?: string; sha?: string }\n | { kind: 'affects'; repo: string; version: string };"
5921
6035
  },
5922
6036
  {
5923
6037
  "name": "TTicketPriority",
@@ -27,6 +27,7 @@ import type {
27
27
  IReq_ControllerAccountsReserveLift,
28
28
  IReq_ControllerAccountsApiKeyAdd,
29
29
  IReq_ControllerAccountsSpendLimit,
30
+ IReq_ControllerAccountsClaudeCode,
30
31
  IReq_ControllerAccountsUsageGet,
31
32
  IReq_ControllerAccountsUsageRecheck,
32
33
  TControllerAccountBinding,
@@ -229,6 +230,17 @@ export class AccountsActions {
229
230
  }));
230
231
  },
231
232
  );
233
+ routerArg.addHandler<IReq_ControllerAccountsClaudeCode>(
234
+ 'controller.accounts.claudecode',
235
+ async (requestArg, toolsArg) => {
236
+ const request = assertRequestShape(requestArg, {
237
+ accountId: 'string', expectedRevision: 'number', claudeCode: 'boolean',
238
+ }) as IReq_ControllerAccountsClaudeCode['request'];
239
+ return hostArg.runAudited(toolsArg?.localData, 'accounts.claudecode', async (signalArg) => ({
240
+ answer: await this.setClaudeCode(request, signalArg),
241
+ }));
242
+ },
243
+ );
232
244
  routerArg.addHandler<IReq_ControllerAccountsRemove>(
233
245
  'controller.accounts.remove',
234
246
  async (requestArg, toolsArg) => {
@@ -508,6 +520,18 @@ export class AccountsActions {
508
520
  return answer;
509
521
  }
510
522
 
523
+ /** Sets whether an API key account may serve Claude Code, and answers once the projection shows it. */
524
+ public async setClaudeCode(
525
+ requestArg: IReq_ControllerAccountsClaudeCode['request'],
526
+ signalArg: AbortSignal,
527
+ ): Promise<TControllerAccountsAnswer<plugins.authswitchAuthority.IAuthSwitchAccount>> {
528
+ const answer = await this.answer((clientArg) => clientArg.setAccountClaudeCode(
529
+ requestArg.accountId, requestArg.expectedRevision, requestArg.claudeCode, signalArg,
530
+ ));
531
+ if (answer.state === 'done') await this.waitForAccountRevision(answer.value, signalArg);
532
+ return answer;
533
+ }
534
+
511
535
  /** Waits until the controller's projection shows the account at `accountArg`'s revision or later. */
512
536
  private async waitForAccountRevision(
513
537
  accountArg: plugins.authswitchAuthority.IAuthSwitchAccount,