agl 43.2.0 → 43.3.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 (184) hide show
  1. package/changelog.md +20 -0
  2. package/dist_serve/bundle.js +2845 -2638
  3. package/dist_serve/bundle.js.map +2 -2
  4. package/dist_serve/bundle.js.third-party-notices.json +1 -1
  5. package/dist_serve/bundle.js.third-party-notices.txt +1 -1
  6. package/dist_ts/00_commitinfo_data.js +1 -1
  7. package/dist_ts/aglapi/aglapisurface.document.js +197 -17
  8. package/dist_ts/classes.accountsactions.d.ts +3 -1
  9. package/dist_ts/classes.accountsactions.js +21 -3
  10. package/dist_ts/classes.claudeharness.d.ts +16 -0
  11. package/dist_ts/classes.claudeharness.js +24 -2
  12. package/dist_ts/classes.codexclientadapter.d.ts +11 -0
  13. package/dist_ts/classes.codexclientadapter.js +14 -2
  14. package/dist_ts/classes.controller.d.ts +165 -11
  15. package/dist_ts/classes.controller.js +1095 -170
  16. package/dist_ts/classes.controllerdevices.d.ts +2 -0
  17. package/dist_ts/classes.controllerdevices.js +6 -1
  18. package/dist_ts/classes.inbox.d.ts +72 -0
  19. package/dist_ts/classes.inbox.js +231 -0
  20. package/dist_ts/classes.inferencerouter.d.ts +10 -0
  21. package/dist_ts/classes.inferencerouter.js +5 -3
  22. package/dist_ts/classes.inferenceservice.js +2 -2
  23. package/dist_ts/classes.mcpclient.d.ts +1 -1
  24. package/dist_ts/classes.mcpclient.js +24 -6
  25. package/dist_ts/classes.mcpcontrollerhost.js +3 -1
  26. package/dist_ts/classes.mcptools.js +13 -8
  27. package/dist_ts/classes.mcpvalidation.d.ts +5 -0
  28. package/dist_ts/classes.mcpvalidation.js +32 -2
  29. package/dist_ts/classes.nativesessions.d.ts +17 -4
  30. package/dist_ts/classes.nativesessions.js +41 -9
  31. package/dist_ts/classes.opencodeclient.d.ts +23 -2
  32. package/dist_ts/classes.opencodeclient.js +47 -3
  33. package/dist_ts/classes.publishedset.d.ts +38 -0
  34. package/dist_ts/classes.publishedset.js +50 -0
  35. package/dist_ts/classes.sessionfeed.d.ts +3 -3
  36. package/dist_ts/classes.sessionfeed.js +18 -26
  37. package/dist_ts/classes.systemmetricssampler.d.ts +6 -0
  38. package/dist_ts/classes.systemmetricssampler.js +15 -3
  39. package/dist_ts/classes.ticketstore.d.ts +50 -3
  40. package/dist_ts/classes.ticketstore.js +45 -8
  41. package/dist_ts/driver/classes.directreports.d.ts +14 -4
  42. package/dist_ts/driver/classes.directreports.js +25 -6
  43. package/dist_ts/driver/classes.driverservice.d.ts +44 -3
  44. package/dist_ts/driver/classes.driverservice.js +50 -16
  45. package/dist_ts/fleet/classes.claudeworkers.d.ts +21 -5
  46. package/dist_ts/fleet/classes.claudeworkers.js +142 -46
  47. package/dist_ts/fleet/classes.codexworkers.d.ts +16 -4
  48. package/dist_ts/fleet/classes.codexworkers.js +22 -5
  49. package/dist_ts/fleet/classes.workercommand.d.ts +6 -1
  50. package/dist_ts/fleet/classes.workercommand.js +15 -4
  51. package/dist_ts/fleet/classes.workers.d.ts +5 -1
  52. package/dist_ts/fleet/classes.workers.js +8 -2
  53. package/dist_ts/fleet/functions.unbounddrivers.js +2 -2
  54. package/dist_ts/fleet/functions.workervalidation.js +2 -2
  55. package/dist_ts/fleet/interfaces.workers.d.ts +21 -3
  56. package/dist_ts/fleet/interfaces.workers.js +1 -1
  57. package/dist_ts/functions.agentmessage.d.ts +3 -0
  58. package/dist_ts/functions.agentmessage.js +4 -1
  59. package/dist_ts/functions.deviceapi.d.ts +151 -4
  60. package/dist_ts/functions.deviceapi.js +893 -38
  61. package/dist_ts/functions.fleetworkercli.d.ts +1 -1
  62. package/dist_ts/functions.fleetworkercli.js +11 -8
  63. package/dist_ts/functions.inferencecli.js +3 -1
  64. package/dist_ts/functions.mcpfleetworkertools.js +2 -2
  65. package/dist_ts/functions.ticketvalidation.js +11 -2
  66. package/dist_ts/interfaces.auth.d.ts +1 -1
  67. package/dist_ts/interfaces.auth.js +9 -1
  68. package/dist_ts/plugins.d.ts +3 -1
  69. package/dist_ts/plugins.js +7 -2
  70. package/dist_ts_authswitch/authority-contract.d.ts +25 -0
  71. package/dist_ts_authswitch/authority-contract.js +1 -1
  72. package/dist_ts_authswitch/authority-overview.d.ts +8 -0
  73. package/dist_ts_authswitch/authority-overview.js +17 -6
  74. package/dist_ts_authswitch/authority-placement.d.ts +20 -16
  75. package/dist_ts_authswitch/authority-placement.js +17 -10
  76. package/dist_ts_authswitch/authority-renewal.d.ts +34 -0
  77. package/dist_ts_authswitch/authority-renewal.js +56 -0
  78. package/dist_ts_authswitch/classes.authoritybroker.d.ts +8 -0
  79. package/dist_ts_authswitch/classes.authoritybroker.js +35 -2
  80. package/dist_ts_authswitch/classes.authoritycli.d.ts +1 -0
  81. package/dist_ts_authswitch/classes.authoritycli.js +44 -3
  82. package/dist_ts_authswitch/classes.authorityclient.d.ts +6 -1
  83. package/dist_ts_authswitch/classes.authorityclient.js +12 -4
  84. package/dist_ts_authswitch/classes.authoritydaemon.js +8 -1
  85. package/dist_ts_authswitch/classes.authoritydatabase.js +6 -2
  86. package/dist_ts_authswitch/classes.authoritymodels.d.ts +7 -0
  87. package/dist_ts_authswitch/classes.authoritymodels.js +21 -5
  88. package/dist_ts_interfaces/devices.d.ts +1012 -5
  89. package/dist_ts_interfaces/devices.js +68 -2
  90. package/dist_ts_interfaces/fleetworkers.d.ts +5 -3
  91. package/dist_ts_interfaces/inbox.d.ts +234 -0
  92. package/dist_ts_interfaces/inbox.js +101 -0
  93. package/dist_ts_interfaces/index.d.ts +1 -0
  94. package/dist_ts_interfaces/index.js +2 -1
  95. package/dist_ts_interfaces/interfaces.d.ts +10 -3
  96. package/dist_ts_interfaces/interfaces.js +4 -2
  97. package/dist_ts_interfaces/mcprequests.d.ts +34 -4
  98. package/dist_ts_interfaces/mcprequests.js +11 -1
  99. package/dist_ts_interfaces/mcpworkspacerequests.d.ts +4 -1
  100. package/dist_ts_interfaces/mcpworkspacerequests.js +1 -1
  101. package/dist_ts_interfaces/nativesessions.d.ts +16 -3
  102. package/dist_ts_interfaces/plugins.d.ts +2 -1
  103. package/dist_ts_interfaces/plugins.js +4 -2
  104. package/dist_ts_interfaces/requests.accounts.d.ts +21 -0
  105. package/dist_ts_interfaces/requests.accounts.js +3 -1
  106. package/dist_ts_interfaces/requests.d.ts +3 -2
  107. package/dist_ts_interfaces/requests.js +1 -1
  108. package/docs/authswitch.md +20 -1
  109. package/package.json +3 -3
  110. package/readme.md +112 -26
  111. package/ts/00_commitinfo_data.ts +1 -1
  112. package/ts/aglapi/aglapisurface.document.ts +196 -16
  113. package/ts/classes.accountsactions.ts +30 -3
  114. package/ts/classes.claudeharness.ts +27 -1
  115. package/ts/classes.codexclientadapter.ts +14 -1
  116. package/ts/classes.controller.ts +1294 -246
  117. package/ts/classes.controllerdevices.ts +6 -0
  118. package/ts/classes.inbox.ts +239 -0
  119. package/ts/classes.inferencerouter.ts +15 -2
  120. package/ts/classes.inferenceservice.ts +1 -1
  121. package/ts/classes.mcpclient.ts +24 -3
  122. package/ts/classes.mcpcontrollerhost.ts +2 -0
  123. package/ts/classes.mcptools.ts +12 -7
  124. package/ts/classes.mcpvalidation.ts +27 -1
  125. package/ts/classes.nativesessions.ts +50 -12
  126. package/ts/classes.opencodeclient.ts +55 -4
  127. package/ts/classes.publishedset.ts +56 -0
  128. package/ts/classes.sessionfeed.ts +17 -20
  129. package/ts/classes.systemmetricssampler.ts +13 -2
  130. package/ts/classes.ticketstore.ts +73 -12
  131. package/ts/driver/classes.directreports.ts +25 -6
  132. package/ts/driver/classes.driverservice.ts +75 -14
  133. package/ts/fleet/classes.claudeworkers.ts +112 -39
  134. package/ts/fleet/classes.codexworkers.ts +21 -6
  135. package/ts/fleet/classes.workercommand.ts +14 -4
  136. package/ts/fleet/classes.workers.ts +9 -2
  137. package/ts/fleet/functions.unbounddrivers.ts +1 -1
  138. package/ts/fleet/functions.workervalidation.ts +1 -1
  139. package/ts/fleet/interfaces.workers.ts +20 -5
  140. package/ts/functions.agentmessage.ts +3 -0
  141. package/ts/functions.deviceapi.ts +1071 -34
  142. package/ts/functions.fleetworkercli.ts +10 -7
  143. package/ts/functions.inferencecli.ts +2 -0
  144. package/ts/functions.mcpfleetworkertools.ts +1 -1
  145. package/ts/functions.ticketvalidation.ts +11 -1
  146. package/ts/interfaces.auth.ts +8 -0
  147. package/ts/plugins.ts +7 -0
  148. package/ts_authswitch/authority-contract.ts +20 -0
  149. package/ts_authswitch/authority-overview.ts +28 -6
  150. package/ts_authswitch/authority-placement.ts +25 -17
  151. package/ts_authswitch/authority-renewal.ts +64 -0
  152. package/ts_authswitch/classes.authoritybroker.ts +34 -1
  153. package/ts_authswitch/classes.authoritycli.ts +49 -2
  154. package/ts_authswitch/classes.authorityclient.ts +14 -4
  155. package/ts_authswitch/classes.authoritydaemon.ts +9 -1
  156. package/ts_authswitch/classes.authoritydatabase.ts +5 -1
  157. package/ts_authswitch/classes.authoritymodels.ts +23 -3
  158. package/ts_authswitch/native-contracts.md +21 -0
  159. package/ts_authswitch/readme.md +1 -1
  160. package/ts_interfaces/devices.schema.json +3573 -603
  161. package/ts_interfaces/devices.ts +1093 -4
  162. package/ts_interfaces/fleetworkers.ts +5 -3
  163. package/ts_interfaces/inbox.ts +287 -0
  164. package/ts_interfaces/index.ts +1 -0
  165. package/ts_interfaces/interfaces.ts +9 -2
  166. package/ts_interfaces/mcprequests.ts +43 -4
  167. package/ts_interfaces/mcpworkspacerequests.ts +4 -2
  168. package/ts_interfaces/nativesessions.ts +17 -3
  169. package/ts_interfaces/plugins.ts +3 -1
  170. package/ts_interfaces/requests.accounts.ts +20 -0
  171. package/ts_interfaces/requests.ts +4 -0
  172. package/ts_web/00_commitinfo_data.ts +1 -1
  173. package/ts_web/accounts.plugins.ts +4 -2
  174. package/ts_web/classes.accountsreadmodel.ts +33 -0
  175. package/ts_web/classes.browserpresentation.ts +10 -5
  176. package/ts_web/classes.inboxfeed.ts +329 -0
  177. package/ts_web/classes.nativesessionstate.ts +9 -23
  178. package/ts_web/elements.accounts.ts +81 -0
  179. package/ts_web/elements.deployments.ts +66 -2
  180. package/ts_web/elements.harnesscontrollerapp.ts +107 -37
  181. package/ts_web/elements.inbox.ts +808 -0
  182. package/ts_web/functions.inbox.ts +95 -0
  183. package/ts_web/functions.sessioncards.ts +40 -0
  184. package/ts_web/plugins.ts +2 -0
@@ -7,7 +7,7 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
7
7
  "method": "agl.mcp.context.resolve",
8
8
  "path": "agl.agl_mcp_context_resolve",
9
9
  "summary": "Resolves an absolute project directory and, optionally, one of its existing native tasks to AGL's project and qualified…",
10
- "description": "Resolves an absolute project directory and, optionally, one of its existing native tasks to AGL's\nproject and qualified session. It does not take over a running task.",
10
+ "description": "Resolves an absolute project directory and, optionally, one of its existing native tasks to AGL's\nproject and qualified session. It does not take over a running task. A Claude Code session outside\nAGL (`sessions_list`'s `nativeSessions`) answers as `nativeSession` and is recorded nowhere.",
11
11
  "omitted": [],
12
12
  "inputSchema": {
13
13
  "type": "object",
@@ -32,6 +32,9 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
32
32
  },
33
33
  "session": {
34
34
  "$ref": "#/$defs/IControllerSession"
35
+ },
36
+ "nativeSession": {
37
+ "$ref": "#/$defs/IControllerNativeSession"
35
38
  }
36
39
  },
37
40
  "required": [
@@ -39,7 +42,7 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
39
42
  ],
40
43
  "additionalProperties": false
41
44
  },
42
- "declaration": "/**\n * Resolves an absolute project directory and, optionally, one of its existing native tasks to AGL's\n * project and qualified session. It does not take over a running task.\n */\nfunction agl_mcp_context_resolve(params: { directory: string; sessionId?: TControllerSessionId }): Promise<{ project: IControllerProject; session?: IControllerSession }>;"
45
+ "declaration": "/**\n * Resolves an absolute project directory and, optionally, one of its existing native tasks to AGL's\n * project and qualified session. It does not take over a running task. A Claude Code session outside\n * AGL (`sessions_list`'s `nativeSessions`) answers as `nativeSession` and is recorded nowhere.\n */\nfunction agl_mcp_context_resolve(params: { directory: string; sessionId?: TControllerSessionId }): Promise<{ project: IControllerProject; session?: IControllerSession; nativeSession?: IControllerNativeSession }>;"
43
46
  },
44
47
  {
45
48
  "method": "agl.mcp.controller.settings.get",
@@ -924,6 +927,10 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
924
927
  "turnId": {
925
928
  "type": "string",
926
929
  "description": "The Codex or Claude Code turn a steer went into."
930
+ },
931
+ "native": {
932
+ "$ref": "#/$defs/TControllerNativeJobDelivery",
933
+ "description": "For a Claude Code background job outside AGL: how it took the message; `delivery` is then `controllerMcpNativeDeliveries[native]`."
927
934
  }
928
935
  },
929
936
  "required": [
@@ -932,7 +939,7 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
932
939
  ],
933
940
  "additionalProperties": false
934
941
  },
935
- "declaration": "/**\n * Delivers an attributed message from one agent to another task of the same project. Any caller\n * holding the descriptor token may send one, identified or not; the controller prefixes the text\n * with a header naming the declared sender and the caller it proved, so the task knows it is not\n * from its user, and the project's owner can refuse agent messages altogether. `steer` puts it into\n * the running turn, `next-turn` makes it the next turn's input and `queue` runs it after every\n * earlier message; each starts a turn when nothing runs. OpenCode cannot be steered.\n */\nfunction agl_mcp_session_message(params: {\n projectId: string;\n sessionId: IControllerRuntimeId;\n /** At most `controllerAgentMessageMaxTextBytes` of UTF-8. */\n text: string;\n /** Self-declared, see `isControllerAgentMessageSender`. */\n sender: string;\n delivery: TControllerPromptDelivery;\n /**\n * The turn a steer is for: a Codex turn as `session_read` reports it in\n * `codexActivity.turnId`, or a Claude Code turn an earlier steer's `turnId` named. A message\n * for another turn, or for one that no longer runs, is refused before dispatch. Required to\n * steer a turn another Codex client runs.\n */\n expectedTurnId?: string;\n}): Promise<{\n accepted: true;\n /**\n * How the message was delivered: `steer` only when a running turn took it, `next-turn` for a\n * steer no turn could take any more, otherwise the requested delivery.\n */\n delivery: TControllerPromptDelivery;\n /** The Codex or Claude Code turn a steer went into. */\n turnId?: string;\n}>;"
942
+ "declaration": "/**\n * Delivers an attributed message from one agent to another task of the same project. Any caller\n * holding the descriptor token may send one, identified or not; the controller prefixes the text\n * with a header naming the declared sender and the caller it proved, so the task knows it is not\n * from its user, and the project's owner can refuse agent messages altogether. `steer` puts it into\n * the running turn, `next-turn` makes it the next turn's input and `queue` runs it after every\n * earlier message; each starts a turn when nothing runs. OpenCode cannot be steered.\n */\nfunction agl_mcp_session_message(params: {\n projectId: string;\n sessionId: IControllerRuntimeId;\n /** At most `controllerAgentMessageMaxTextBytes` of UTF-8. */\n text: string;\n /** Self-declared, see `isControllerAgentMessageSender`. */\n sender: string;\n delivery: TControllerPromptDelivery;\n /**\n * The turn a steer is for: a Codex turn as `session_read` reports it in\n * `codexActivity.turnId`, or a Claude Code turn an earlier steer's `turnId` named. A message\n * for another turn, or for one that no longer runs, is refused before dispatch. Required to\n * steer a turn another Codex client runs.\n */\n expectedTurnId?: string;\n}): Promise<{\n accepted: true;\n /**\n * How the message was delivered: `steer` only when a running turn took it, `next-turn` for a\n * steer no turn could take any more, otherwise the requested delivery.\n */\n delivery: TControllerPromptDelivery;\n /** The Codex or Claude Code turn a steer went into. */\n turnId?: string;\n /**\n * For a Claude Code background job outside AGL: how it took the message; `delivery` is then\n * `controllerMcpNativeDeliveries[native]`.\n */\n native?: TControllerNativeJobDelivery;\n}>;"
936
943
  },
937
944
  {
938
945
  "method": "agl.mcp.session.model.update",
@@ -1005,9 +1012,16 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
1005
1012
  "additionalProperties": false
1006
1013
  },
1007
1014
  "outputSchema": {
1008
- "$ref": "#/$defs/TControllerMcpSessionDetail"
1015
+ "anyOf": [
1016
+ {
1017
+ "$ref": "#/$defs/TControllerMcpSessionDetail"
1018
+ },
1019
+ {
1020
+ "$ref": "#/$defs/IControllerMcpNativeSessionDetail"
1021
+ }
1022
+ ]
1009
1023
  },
1010
- "declaration": "/**\n * Reads the bounded current detail of one task: its newest messages, pending prompts, permissions,\n * questions, todos, scratchpad, model and, for Codex, the running turn. Read it again to follow the\n * task; each read answers its state at that moment.\n */\nfunction agl_mcp_session_read(params: {\n projectId: string;\n sessionId: IControllerRuntimeId;\n}): Promise<TControllerMcpSessionDetail>;"
1024
+ "declaration": "/**\n * Reads the bounded current detail of one task: its newest messages, pending prompts, permissions,\n * questions, todos, scratchpad, model and, for Codex, the running turn. Read it again to follow the\n * task; each read answers its state at that moment.\n */\nfunction agl_mcp_session_read(params: {\n projectId: string;\n sessionId: IControllerRuntimeId;\n}): Promise<TControllerMcpSessionDetail | IControllerMcpNativeSessionDetail>;"
1011
1025
  },
1012
1026
  {
1013
1027
  "method": "agl.mcp.session.rename",
@@ -1132,8 +1146,8 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
1132
1146
  {
1133
1147
  "method": "agl.mcp.sessions.list",
1134
1148
  "path": "agl.agl_mcp_sessions_list",
1135
- "summary": "Discovers a project's OpenCode, Flex and Codex tasks from its folder and configured connections, tasks created outside …",
1136
- "description": "Discovers a project's OpenCode, Flex and Codex tasks from its folder and configured connections,\ntasks created outside AGL included.",
1149
+ "summary": "Discovers a project's OpenCode, Flex and Codex tasks and AGL's own Claude Code conversations from its folder and config…",
1150
+ "description": "Discovers a project's OpenCode, Flex and Codex tasks and AGL's own Claude Code conversations from its folder and\nconfigured connections, tasks created outside AGL included (`sessions`), and, apart from them, the Claude Code\nsessions of the host's own Claude Code home whose directory is the project folder itself (`nativeSessions`): running\nones first, all of them, then at most `controllerMcpNativeSessionSettledLimit` settled ones, newest first\n(`nativeSessionsTruncated` when more may exist). `nativeSessionsError` names why the Claude Code inventory could not\nbe read; `nativeSessions` is then empty.",
1137
1151
  "omitted": [],
1138
1152
  "inputSchema": {
1139
1153
  "type": "object",
@@ -1155,14 +1169,28 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
1155
1169
  "items": {
1156
1170
  "$ref": "#/$defs/IControllerSession"
1157
1171
  }
1172
+ },
1173
+ "nativeSessions": {
1174
+ "type": "array",
1175
+ "items": {
1176
+ "$ref": "#/$defs/IControllerNativeSession"
1177
+ }
1178
+ },
1179
+ "nativeSessionsTruncated": {
1180
+ "type": "boolean",
1181
+ "const": true
1182
+ },
1183
+ "nativeSessionsError": {
1184
+ "type": "string"
1158
1185
  }
1159
1186
  },
1160
1187
  "required": [
1161
- "sessions"
1188
+ "sessions",
1189
+ "nativeSessions"
1162
1190
  ],
1163
1191
  "additionalProperties": false
1164
1192
  },
1165
- "declaration": "/**\n * Discovers a project's OpenCode, Flex and Codex tasks from its folder and configured connections,\n * tasks created outside AGL included.\n */\nfunction agl_mcp_sessions_list(params: { projectId: string }): Promise<{ sessions: IControllerSession[] }>;"
1193
+ "declaration": "/**\n * Discovers a project's OpenCode, Flex and Codex tasks and AGL's own Claude Code conversations from its folder and\n * configured connections, tasks created outside AGL included (`sessions`), and, apart from them, the Claude Code\n * sessions of the host's own Claude Code home whose directory is the project folder itself (`nativeSessions`): running\n * ones first, all of them, then at most `controllerMcpNativeSessionSettledLimit` settled ones, newest first\n * (`nativeSessionsTruncated` when more may exist). `nativeSessionsError` names why the Claude Code inventory could not\n * be read; `nativeSessions` is then empty.\n */\nfunction agl_mcp_sessions_list(params: { projectId: string }): Promise<{\n sessions: IControllerSession[];\n nativeSessions: IControllerNativeSession[];\n nativeSessionsTruncated?: true;\n nativeSessionsError?: string;\n}>;"
1166
1194
  },
1167
1195
  {
1168
1196
  "method": "agl.mcp.ticket.ask",
@@ -3129,6 +3157,36 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
3129
3157
  },
3130
3158
  "declaration": "/** What a conversation does once the limit that holds its prompts resets. Both default to off. */\ninterface IControllerLimitResumeOptions {\n /** Start the held prompts on their own once the limit has reset. */\n startAtReset: boolean;\n /** Compact the conversation before the held prompts start; applies with `startAtReset` only. */\n compactFirst: boolean;\n}"
3131
3159
  },
3160
+ {
3161
+ "name": "IControllerMcpNativeSessionDetail",
3162
+ "schema": {
3163
+ "type": "object",
3164
+ "properties": {
3165
+ "kind": {
3166
+ "type": "string",
3167
+ "const": "native"
3168
+ },
3169
+ "session": {
3170
+ "$ref": "#/$defs/IControllerNativeSession"
3171
+ },
3172
+ "messagePage": {
3173
+ "$ref": "#/$defs/IControllerMessagePage"
3174
+ },
3175
+ "scratchpad": {
3176
+ "$ref": "#/$defs/IControllerSessionScratchpad"
3177
+ }
3178
+ },
3179
+ "required": [
3180
+ "kind",
3181
+ "session",
3182
+ "messagePage",
3183
+ "scratchpad"
3184
+ ],
3185
+ "additionalProperties": false,
3186
+ "description": "A Claude Code session outside AGL as `agl.mcp.session.read` answers it: the session with why it takes no message (`readOnly`) or how it takes one (`jobDelivery`), its newest transcript page and its scratchpad."
3187
+ },
3188
+ "declaration": "/**\n * A Claude Code session outside AGL as `agl.mcp.session.read` answers it: the session with why it takes no message\n * (`readOnly`) or how it takes one (`jobDelivery`), its newest transcript page and its scratchpad.\n */\ninterface IControllerMcpNativeSessionDetail {\n kind: 'native';\n session: IControllerNativeSession;\n messagePage: IControllerMessagePage;\n scratchpad: IControllerSessionScratchpad;\n}"
3189
+ },
3132
3190
  {
3133
3191
  "name": "IControllerMcpStatusResponse",
3134
3192
  "schema": {
@@ -3337,6 +3395,90 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
3337
3395
  },
3338
3396
  "declaration": "/**\n * A usage or rate limit a model provider reported. `usage_limit` means the account's quota is\n * spent until it resets; `rate_limit` is a throttle. `usage_reserve` is AGL's own: the account\n * reached its usage threshold (`maxUsagePercent`), so the rest of its quota is kept for use\n * outside AGL until the window resets. Times are Unix milliseconds.\n */\ninterface IControllerModelLimit {\n kind: TControllerModelLimitKind;\n /** The provider that reported the limit, for example `openai`. */\n provider: string;\n resetsAt?: number;\n /** The delay the provider asked for before the next request, in milliseconds. */\n retryAfterMs?: number;\n planType?: string;\n /** The exhausted limit window, for example `5h` or `7d`. */\n window?: string;\n}"
3339
3397
  },
3398
+ {
3399
+ "name": "IControllerNativeSession",
3400
+ "schema": {
3401
+ "type": "object",
3402
+ "properties": {
3403
+ "harness": {
3404
+ "type": "string",
3405
+ "enum": [
3406
+ "claude",
3407
+ "codex"
3408
+ ]
3409
+ },
3410
+ "nativeId": {
3411
+ "type": "string"
3412
+ },
3413
+ "profileId": {
3414
+ "type": "string",
3415
+ "description": "The fleet worker profile whose Claude Code home holds the session; absent for the host's own home and for Codex."
3416
+ },
3417
+ "cwd": {
3418
+ "type": "string"
3419
+ },
3420
+ "title": {
3421
+ "type": "string"
3422
+ },
3423
+ "status": {
3424
+ "type": "string",
3425
+ "enum": [
3426
+ "busy",
3427
+ "idle",
3428
+ "error"
3429
+ ]
3430
+ },
3431
+ "updatedAt": {
3432
+ "type": "number",
3433
+ "description": "Unix milliseconds of the session's last activity, when its source reports it."
3434
+ },
3435
+ "workerName": {
3436
+ "type": "string",
3437
+ "description": "The fleet worker bound to the session."
3438
+ },
3439
+ "model": {
3440
+ "type": "string"
3441
+ },
3442
+ "effort": {
3443
+ "type": "string"
3444
+ },
3445
+ "readOnly": {
3446
+ "type": "object",
3447
+ "properties": {
3448
+ "reason": {
3449
+ "$ref": "#/$defs/TControllerNativeSessionReadOnlyReason"
3450
+ },
3451
+ "message": {
3452
+ "type": "string"
3453
+ }
3454
+ },
3455
+ "required": [
3456
+ "reason",
3457
+ "message"
3458
+ ],
3459
+ "additionalProperties": false,
3460
+ "description": "Present while AGL does not write to the session; `message` is the reason the owner sees."
3461
+ },
3462
+ "jobDelivery": {
3463
+ "$ref": "#/$defs/TControllerNativeJobDelivery",
3464
+ "description": "How a message reaches the session, present exactly while it is a Claude Code background job that takes one."
3465
+ }
3466
+ },
3467
+ "required": [
3468
+ "cwd",
3469
+ "harness",
3470
+ "nativeId",
3471
+ "status",
3472
+ "title"
3473
+ ],
3474
+ "additionalProperties": false
3475
+ },
3476
+ "declaration": "interface IControllerNativeSession extends IControllerNativeSessionRef {\n cwd: string;\n title: string;\n status: 'busy' | 'idle' | 'error';\n /** Unix milliseconds of the session's last activity, when its source reports it. */\n updatedAt?: number;\n /** The fleet worker bound to the session. */\n workerName?: string;\n model?: string;\n effort?: string;\n /** Present while AGL does not write to the session; `message` is the reason the owner sees. */\n readOnly?: { reason: TControllerNativeSessionReadOnlyReason; message: string };\n /** How a message reaches the session, present exactly while it is a Claude Code background job that takes one. */\n jobDelivery?: TControllerNativeJobDelivery;\n}"
3477
+ },
3478
+ {
3479
+ "name": "IControllerNativeSessionRef",
3480
+ "declaration": "/**\n * A session AGL lists but does not host: a Claude Code session of the host's own or a fleet profile's home, or a\n * thread on the host's shared Codex app-server. The project matters only for new sessions: such a session opens\n * wherever it runs. The controller resolves a reference only through the sources the session feed lists, so it never\n * reads a session by an arbitrary path.\n */\ninterface IControllerNativeSessionRef {\n harness: 'claude' | 'codex';\n nativeId: string;\n /** The fleet worker profile whose Claude Code home holds the session; absent for the host's own home and for Codex. */\n profileId?: string;\n}"
3481
+ },
3340
3482
  {
3341
3483
  "name": "IControllerNativeWait",
3342
3484
  "schema": {
@@ -3538,7 +3680,8 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
3538
3680
  "additionalProperties": {}
3539
3681
  },
3540
3682
  "createdAt": {
3541
- "type": "number"
3683
+ "type": "number",
3684
+ "description": "Unix milliseconds when the request entered its harness's pending requests: the harness's own time where it has one."
3542
3685
  }
3543
3686
  },
3544
3687
  "required": [
@@ -3547,11 +3690,12 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
3547
3690
  "title",
3548
3691
  "type",
3549
3692
  "patterns",
3550
- "metadata"
3693
+ "metadata",
3694
+ "createdAt"
3551
3695
  ],
3552
3696
  "additionalProperties": false
3553
3697
  },
3554
- "declaration": "interface IControllerPermission {\n id: IControllerRuntimeId;\n sessionId: IControllerRuntimeId;\n title: string;\n type: string;\n patterns: string[];\n metadata: Record<string, unknown>;\n createdAt?: number;\n}"
3698
+ "declaration": "interface IControllerPermission {\n id: IControllerRuntimeId;\n sessionId: IControllerRuntimeId;\n title: string;\n type: string;\n patterns: string[];\n metadata: Record<string, unknown>;\n /** Unix milliseconds when the request entered its harness's pending requests: the harness's own time where it has one. */\n createdAt: number;\n}"
3555
3699
  },
3556
3700
  {
3557
3701
  "name": "IControllerProject",
@@ -3792,16 +3936,21 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
3792
3936
  "toolCallId": {
3793
3937
  "$ref": "#/$defs/IControllerRuntimeId",
3794
3938
  "description": "Tool call that raised the ask; links the request to its transcript entry."
3939
+ },
3940
+ "createdAt": {
3941
+ "type": "number",
3942
+ "description": "Unix milliseconds when the question entered its harness's pending requests."
3795
3943
  }
3796
3944
  },
3797
3945
  "required": [
3798
3946
  "id",
3799
3947
  "sessionId",
3800
- "questions"
3948
+ "questions",
3949
+ "createdAt"
3801
3950
  ],
3802
3951
  "additionalProperties": false
3803
3952
  },
3804
- "declaration": "interface IControllerQuestion {\n id: IControllerRuntimeId;\n sessionId: IControllerRuntimeId;\n questions: IControllerQuestionItem[];\n /** Tool call that raised the ask; links the request to its transcript entry. */\n toolCallId?: IControllerRuntimeId;\n}"
3953
+ "declaration": "interface IControllerQuestion {\n id: IControllerRuntimeId;\n sessionId: IControllerRuntimeId;\n questions: IControllerQuestionItem[];\n /** Tool call that raised the ask; links the request to its transcript entry. */\n toolCallId?: IControllerRuntimeId;\n /** Unix milliseconds when the question entered its harness's pending requests. */\n createdAt: number;\n}"
3805
3954
  },
3806
3955
  {
3807
3956
  "name": "IControllerQuestionItem",
@@ -4255,7 +4404,7 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
4255
4404
  },
4256
4405
  "protocolVersion": {
4257
4406
  "type": "number",
4258
- "const": 52
4407
+ "const": 53
4259
4408
  },
4260
4409
  "upgradeManagementVersion": {
4261
4410
  "type": "number"
@@ -4381,7 +4530,7 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
4381
4530
  ],
4382
4531
  "additionalProperties": false
4383
4532
  },
4384
- "declaration": "interface IControllerStatus {\n packageName: string;\n packageVersion: string;\n protocolVersion: 52;\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}"
4533
+ "declaration": "interface IControllerStatus {\n packageName: string;\n packageVersion: string;\n protocolVersion: 53;\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}"
4385
4534
  },
4386
4535
  {
4387
4536
  "name": "IControllerTerminalResource",
@@ -6384,6 +6533,37 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
6384
6533
  },
6385
6534
  "declaration": "type TControllerModelRetryReason = 'rate_limit' | 'overloaded' | 'unavailable';"
6386
6535
  },
6536
+ {
6537
+ "name": "TControllerNativeJobDelivery",
6538
+ "schema": {
6539
+ "type": "string",
6540
+ "enum": [
6541
+ "wake",
6542
+ "inbox"
6543
+ ],
6544
+ "description": "How a message reaches a Claude Code background job (`claude --bg`) that AGL does not run: `wake` continues a settled (done, blocked or stopped) job through Claude Code's own `claude --bg --resume`, `inbox` puts it into a running job's inbox through Claude Code's own SendMessage, accepted and queued there, not yet read."
6545
+ },
6546
+ "declaration": "/**\n * How a message reaches a Claude Code background job (`claude --bg`) that AGL does not run: `wake` continues a settled\n * (done, blocked or stopped) job through Claude Code's own `claude --bg --resume`, `inbox` puts it into a running job's\n * inbox through Claude Code's own SendMessage, accepted and queued there, not yet read.\n */\ntype TControllerNativeJobDelivery = 'wake' | 'inbox';"
6547
+ },
6548
+ {
6549
+ "name": "TControllerNativeSessionReadOnlyReason",
6550
+ "schema": {
6551
+ "type": "string",
6552
+ "enum": [
6553
+ "running",
6554
+ "unaddressable",
6555
+ "notBackgroundJob",
6556
+ "profileHome",
6557
+ "directoryMissing",
6558
+ "projectConversation",
6559
+ "fleetWorker",
6560
+ "jobFailed",
6561
+ "jobHeld"
6562
+ ],
6563
+ "description": "Why AGL does not write to a native session: `running`: another process runs it, and AGL never becomes its second writer; `unaddressable`: a running background job takes a message only by a session name no other running session shares, and it has none or shares it; `notBackgroundJob`: an agent reaches only a background job (MCP `session_message`); the owner's own native session view resumes another settled session; `profileHome`: it lives in a fleet profile's Claude Code home, which AGL's own Claude Code does not resume; `directoryMissing`: its directory is gone, so nothing resumes it; `projectConversation`: an AGL project conversation records it, and that project sends to it; `fleetWorker`: a fleet worker owns it, and the worker's view steers it; `jobFailed`: a Claude Code background job holds it and failed, and AGL wakes only a settled job; `jobHeld`: AGL's own Claude Code still holds a background job's conversation, so Claude Code would wake a copy."
6564
+ },
6565
+ "declaration": "/**\n * Why AGL does not write to a native session:\n * `running`: another process runs it, and AGL never becomes its second writer;\n * `unaddressable`: a running background job takes a message only by a session name no other running session shares, and\n * it has none or shares it;\n * `notBackgroundJob`: an agent reaches only a background job (MCP `session_message`); the owner's own native session view\n * resumes another settled session;\n * `profileHome`: it lives in a fleet profile's Claude Code home, which AGL's own Claude Code does not resume;\n * `directoryMissing`: its directory is gone, so nothing resumes it;\n * `projectConversation`: an AGL project conversation records it, and that project sends to it;\n * `fleetWorker`: a fleet worker owns it, and the worker's view steers it;\n * `jobFailed`: a Claude Code background job holds it and failed, and AGL wakes only a settled job;\n * `jobHeld`: AGL's own Claude Code still holds a background job's conversation, so Claude Code would wake a copy.\n */\ntype TControllerNativeSessionReadOnlyReason =\n 'running' | 'unaddressable' | 'notBackgroundJob' | 'profileHome' | 'directoryMissing' | 'projectConversation' | 'fleetWorker' | 'jobFailed' | 'jobHeld';"
6566
+ },
6387
6567
  {
6388
6568
  "name": "TControllerNativeWaitReason",
6389
6569
  "schema": {
@@ -28,6 +28,7 @@ import type {
28
28
  IReq_ControllerAccountsApiKeyAdd,
29
29
  IReq_ControllerAccountsSpendLimit,
30
30
  IReq_ControllerAccountsClaudeCode,
31
+ IReq_ControllerAccountsRenewal,
31
32
  IReq_ControllerAccountsUsageGet,
32
33
  IReq_ControllerAccountsUsageRecheck,
33
34
  TControllerAccountBinding,
@@ -100,11 +101,11 @@ const invalidRequest = (messageArg: string): plugins.typedrequest.TypedResponseE
100
101
 
101
102
  /**
102
103
  * Accepts exactly the named members, each of its declared type, and nothing else. `number | null` is a
103
- * number or an explicit `null`.
104
+ * number or an explicit `null`, `string | null` a string or an explicit `null`.
104
105
  */
105
106
  const assertRequestShape = (
106
107
  requestArg: unknown,
107
- membersArg: Readonly<Record<string, 'string' | 'number' | 'boolean' | 'number | null'>>,
108
+ membersArg: Readonly<Record<string, 'string' | 'number' | 'boolean' | 'number | null' | 'string | null'>>,
108
109
  ): Record<string, unknown> => {
109
110
  if (typeof requestArg !== 'object' || requestArg === null || Array.isArray(requestArg)) {
110
111
  throw invalidRequest('The account request is invalid.');
@@ -115,7 +116,9 @@ const assertRequestShape = (
115
116
  Object.keys(request).length !== names.length
116
117
  || names.some((nameArg) => (membersArg[nameArg] === 'number | null'
117
118
  ? request[nameArg] !== null && typeof request[nameArg] !== 'number'
118
- : typeof request[nameArg] !== membersArg[nameArg]))
119
+ : membersArg[nameArg] === 'string | null'
120
+ ? request[nameArg] !== null && typeof request[nameArg] !== 'string'
121
+ : typeof request[nameArg] !== membersArg[nameArg]))
119
122
  ) throw invalidRequest('The account request is invalid.');
120
123
  for (const name of names) {
121
124
  const value = request[name];
@@ -241,6 +244,18 @@ export class AccountsActions {
241
244
  }));
242
245
  },
243
246
  );
247
+ routerArg.addHandler<IReq_ControllerAccountsRenewal>(
248
+ 'controller.accounts.renewal',
249
+ async (requestArg, toolsArg) => {
250
+ const request = assertRequestShape(requestArg, {
251
+ accountId: 'string', expectedRevision: 'number', renewsAt: 'string | null',
252
+ }) as IReq_ControllerAccountsRenewal['request'];
253
+ // The audit names the action and the peer; the date is the account's, which the accounts service journals.
254
+ return hostArg.runAudited(toolsArg?.localData, 'accounts.renewal', async (signalArg) => ({
255
+ answer: await this.setRenewal(request, signalArg),
256
+ }));
257
+ },
258
+ );
244
259
  routerArg.addHandler<IReq_ControllerAccountsRemove>(
245
260
  'controller.accounts.remove',
246
261
  async (requestArg, toolsArg) => {
@@ -532,6 +547,18 @@ export class AccountsActions {
532
547
  return answer;
533
548
  }
534
549
 
550
+ /** Sets or clears a Claude sign-in's renewal anchor, and answers once the projection shows it. */
551
+ public async setRenewal(
552
+ requestArg: IReq_ControllerAccountsRenewal['request'],
553
+ signalArg: AbortSignal,
554
+ ): Promise<TControllerAccountsAnswer<plugins.authswitchAuthority.IAuthSwitchAccount>> {
555
+ const answer = await this.answer((clientArg) => clientArg.setAccountRenewal(
556
+ requestArg.accountId, requestArg.expectedRevision, requestArg.renewsAt, signalArg,
557
+ ));
558
+ if (answer.state === 'done') await this.waitForAccountRevision(answer.value, signalArg);
559
+ return answer;
560
+ }
561
+
535
562
  /** Waits until the controller's projection shows the account at `accountArg`'s revision or later. */
536
563
  private async waitForAccountRevision(
537
564
  accountArg: plugins.authswitchAuthority.IAuthSwitchAccount,
@@ -60,6 +60,11 @@ export interface IClaudeHarnessOptions {
60
60
  emit: (eventArg: IControllerEvent) => void;
61
61
  /** A conversation went idle: every message it was given ended and Claude Code runs nothing more. */
62
62
  onSessionIdle?: (projectIdArg: string, nativeIdArg: string) => void;
63
+ /**
64
+ * The requests AGL holds for a native session (one outside every project, which `emit` never names) came or went: a
65
+ * permission, a question or an MCP form of a turn AGL runs there.
66
+ */
67
+ onNativeAttention?: (nativeIdArg: string) => void;
63
68
  sdk?: TClaudeSdk;
64
69
  pathToClaudeCodeExecutable?: string;
65
70
  clock?: IClaudeEventClock;
@@ -504,6 +509,22 @@ export class ClaudeHarness {
504
509
  };
505
510
  }
506
511
 
512
+ /**
513
+ * Every session with requests that wait for an answer, from the pending requests alone: its project (none for a
514
+ * native session), directory, title and requests.
515
+ */
516
+ public pendingAttention(): Array<{ nativeId: string; projectId?: string; directory: string; title: string; attention: IControllerAttention }> {
517
+ const nativeIds = new Set([...this.pending.values()].map((requestArg) => requestArg.nativeId));
518
+ return [...nativeIds].flatMap((nativeId) => {
519
+ const state = this.states.get(nativeId);
520
+ if (!state) return [];
521
+ return [{
522
+ nativeId, ...(state.projectId === undefined ? {} : { projectId: state.projectId }),
523
+ directory: state.document.directory, title: state.document.title, attention: this.attention(nativeId),
524
+ }];
525
+ });
526
+ }
527
+
507
528
  public replyPermission(nativeIdArg: string, idArg: string, replyArg: 'once' | 'reject'): void {
508
529
  const request = this.pending.get(idArg);
509
530
  if (!request?.permission || request.nativeId !== nativeIdArg) throw new Error('Claude Code approval is no longer pending in this conversation.');
@@ -1105,6 +1126,7 @@ export class ClaudeHarness {
1105
1126
  // Claude Code always offers a written answer besides the options.
1106
1127
  custom: true,
1107
1128
  })),
1129
+ createdAt: Date.now(),
1108
1130
  };
1109
1131
  } else {
1110
1132
  const title = contextArg.title ?? contextArg.displayName ?? claudeToolTitle(toolNameArg, inputArg) ?? toolNameArg;
@@ -1339,7 +1361,11 @@ export class ClaudeHarness {
1339
1361
  }
1340
1362
 
1341
1363
  private changed(stateArg: IClaudeSessionState, typeArg: IControllerEvent['type']): void {
1342
- if (this.closed || this.states.get(stateArg.document.nativeId) !== stateArg || stateArg.projectId === undefined) return;
1364
+ if (this.closed || this.states.get(stateArg.document.nativeId) !== stateArg) return;
1365
+ if (stateArg.projectId === undefined) {
1366
+ if (typeArg === 'permissions.changed') this.options.onNativeAttention?.(stateArg.document.nativeId);
1367
+ return;
1368
+ }
1343
1369
  this.options.emit({
1344
1370
  type: typeArg, harnessId: 'claude', projectId: stateArg.projectId, sessionId: claudeRuntimeId(stateArg.document.nativeId),
1345
1371
  ...(typeArg === 'session.changed' ? { sessionStatus: this.session(stateArg.document.nativeId).status } : {}),
@@ -1103,6 +1103,18 @@ export class CodexClientAdapter {
1103
1103
  return [...result.values()];
1104
1104
  }
1105
1105
 
1106
+ /**
1107
+ * Every thread with requests that wait for an answer, from the pending requests alone, with the scope it was
1108
+ * registered in: its project (`fleet` for a fleet connection's native thread), directory and session.
1109
+ */
1110
+ public pendingAttention(): Array<{ threadId: string; projectId: string; directory: string; session: IControllerSession; attention: IControllerAttention }> {
1111
+ const threadIds = new Set([...this.pending.values()].map((entryArg) => entryArg.request.params.threadId as string));
1112
+ return [...threadIds].flatMap((threadId) => {
1113
+ const scope = this.scopes.get(threadId);
1114
+ return scope ? [{ threadId, projectId: scope.projectId, directory: scope.directory, session: scope.session, attention: this.attention(threadId) }] : [];
1115
+ });
1116
+ }
1117
+
1106
1118
  public attention(threadIdArg: string): IControllerAttention {
1107
1119
  this.scope(threadIdArg);
1108
1120
  const requests = [...this.pending.values()].filter((entry) => entry.request.params.threadId === threadIdArg);
@@ -1891,7 +1903,8 @@ export class CodexClientAdapter {
1891
1903
  pending.question = { id: codexRuntimeId(id), sessionId: codexRuntimeId(threadId), toolCallId: codexRuntimeId(codexString(params.itemId, 512)),
1892
1904
  questions: questions.map((question) => ({ question: codexString(question.question, 16 * 1024), header: codexString(question.header, 512),
1893
1905
  custom: question.isOther === true || question.options === null,
1894
- options: question.options === null ? [] : codexArray(question.options, 64).map((option) => ({ label: codexString(codexRecord(option).label, 1024), description: codexString(codexRecord(option).description, 4096) })) })) };
1906
+ options: question.options === null ? [] : codexArray(question.options, 64).map((option) => ({ label: codexString(codexRecord(option).label, 1024), description: codexString(codexRecord(option).description, 4096) })) })),
1907
+ createdAt: Date.now() };
1895
1908
  } else if (requestArg.method === 'mcpServer/elicitation/request') {
1896
1909
  pending.elicitation = codexElicitation(id, threadId, params);
1897
1910
  } else { client.rejectRequest(requestArg.id, -32601, 'This Codex host request is not supported by AGL.'); return; }