@claudexor/cli 3.1.1 → 3.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 (261) hide show
  1. package/dist/about-command.d.ts.map +1 -1
  2. package/dist/accounts-projection.d.ts +8 -1
  3. package/dist/accounts-projection.d.ts.map +1 -1
  4. package/dist/accounts-projection.js +33 -20
  5. package/dist/accounts-projection.js.map +1 -1
  6. package/dist/accounts-services.d.ts +206 -0
  7. package/dist/accounts-services.d.ts.map +1 -0
  8. package/dist/accounts-services.js +71 -0
  9. package/dist/accounts-services.js.map +1 -0
  10. package/dist/acp-surface-runner.d.ts +39 -0
  11. package/dist/acp-surface-runner.d.ts.map +1 -1
  12. package/dist/acp-surface-runner.js +104 -30
  13. package/dist/acp-surface-runner.js.map +1 -1
  14. package/dist/attachment-upload.d.ts +5 -0
  15. package/dist/attachment-upload.d.ts.map +1 -0
  16. package/dist/attachment-upload.js +64 -0
  17. package/dist/attachment-upload.js.map +1 -0
  18. package/dist/belt-bridge.d.ts +2 -0
  19. package/dist/belt-bridge.d.ts.map +1 -0
  20. package/dist/belt-bridge.js +31 -0
  21. package/dist/belt-bridge.js.map +1 -0
  22. package/dist/bridge-serve.d.ts +1 -9
  23. package/dist/bridge-serve.d.ts.map +1 -1
  24. package/dist/bridge-serve.js +5 -22
  25. package/dist/bridge-serve.js.map +1 -1
  26. package/dist/capabilities.d.ts.map +1 -1
  27. package/dist/capabilities.js +8 -1
  28. package/dist/capabilities.js.map +1 -1
  29. package/dist/choice-input.d.ts +7 -0
  30. package/dist/choice-input.d.ts.map +1 -0
  31. package/dist/choice-input.js +17 -0
  32. package/dist/choice-input.js.map +1 -0
  33. package/dist/claude-oauth-usage.js.map +1 -1
  34. package/dist/claudexord-entry.d.ts +11 -0
  35. package/dist/claudexord-entry.d.ts.map +1 -0
  36. package/dist/claudexord-entry.js +42 -0
  37. package/dist/claudexord-entry.js.map +1 -0
  38. package/dist/claudexord.d.ts +2 -17
  39. package/dist/claudexord.d.ts.map +1 -1
  40. package/dist/claudexord.js +60 -93
  41. package/dist/claudexord.js.map +1 -1
  42. package/dist/cli-error.d.ts.map +1 -1
  43. package/dist/cli-error.js +21 -11
  44. package/dist/cli-error.js.map +1 -1
  45. package/dist/cli.js +149 -170
  46. package/dist/cli.js.map +1 -1
  47. package/dist/codex-device-login.js.map +1 -1
  48. package/dist/codex-quota-source.js.map +1 -1
  49. package/dist/command-flags.d.ts +16 -1
  50. package/dist/command-flags.d.ts.map +1 -1
  51. package/dist/command-flags.js +41 -19
  52. package/dist/command-flags.js.map +1 -1
  53. package/dist/command-registry.d.ts +21 -8
  54. package/dist/command-registry.d.ts.map +1 -1
  55. package/dist/command-registry.js +59 -116
  56. package/dist/command-registry.js.map +1 -1
  57. package/dist/command-scope.d.ts +13 -0
  58. package/dist/command-scope.d.ts.map +1 -0
  59. package/dist/command-scope.js +61 -0
  60. package/dist/command-scope.js.map +1 -0
  61. package/dist/control-services.d.ts +1622 -982
  62. package/dist/control-services.d.ts.map +1 -1
  63. package/dist/control-services.js +39 -68
  64. package/dist/control-services.js.map +1 -1
  65. package/dist/credential-commands.d.ts.map +1 -1
  66. package/dist/credential-commands.js +13 -3
  67. package/dist/credential-commands.js.map +1 -1
  68. package/dist/daemon-lifecycle.d.ts.map +1 -1
  69. package/dist/daemon-outcome.d.ts +3 -5
  70. package/dist/daemon-outcome.d.ts.map +1 -1
  71. package/dist/daemon-outcome.js +7 -19
  72. package/dist/daemon-outcome.js.map +1 -1
  73. package/dist/daemon-run.d.ts +26 -29
  74. package/dist/daemon-run.d.ts.map +1 -1
  75. package/dist/daemon-run.js +89 -97
  76. package/dist/daemon-run.js.map +1 -1
  77. package/dist/daemon-runtime-shutdown.d.ts +7 -0
  78. package/dist/daemon-runtime-shutdown.d.ts.map +1 -1
  79. package/dist/daemon-runtime-shutdown.js +29 -0
  80. package/dist/daemon-runtime-shutdown.js.map +1 -1
  81. package/dist/delegation-belt-descriptor.d.ts +20 -36
  82. package/dist/delegation-belt-descriptor.d.ts.map +1 -1
  83. package/dist/delegation-belt-descriptor.js +48 -51
  84. package/dist/delegation-belt-descriptor.js.map +1 -1
  85. package/dist/delegation-capability.d.ts +4 -0
  86. package/dist/delegation-capability.d.ts.map +1 -0
  87. package/dist/delegation-capability.js +29 -0
  88. package/dist/delegation-capability.js.map +1 -0
  89. package/dist/delegation-daemon-binding.d.ts +8 -0
  90. package/dist/delegation-daemon-binding.d.ts.map +1 -0
  91. package/dist/delegation-daemon-binding.js +18 -0
  92. package/dist/delegation-daemon-binding.js.map +1 -0
  93. package/dist/delegation-output.d.ts +18 -0
  94. package/dist/delegation-output.d.ts.map +1 -0
  95. package/dist/delegation-output.js +47 -0
  96. package/dist/delegation-output.js.map +1 -0
  97. package/dist/harness-command.d.ts +13 -0
  98. package/dist/harness-command.d.ts.map +1 -0
  99. package/dist/harness-command.js +35 -0
  100. package/dist/harness-command.js.map +1 -0
  101. package/dist/harness-installer.d.ts +79 -0
  102. package/dist/harness-installer.d.ts.map +1 -0
  103. package/dist/harness-installer.js +256 -0
  104. package/dist/harness-installer.js.map +1 -0
  105. package/dist/interaction-prompt.d.ts +19 -0
  106. package/dist/interaction-prompt.d.ts.map +1 -0
  107. package/dist/interaction-prompt.js +114 -0
  108. package/dist/interaction-prompt.js.map +1 -0
  109. package/dist/live.d.ts +2 -6
  110. package/dist/live.d.ts.map +1 -1
  111. package/dist/live.js +92 -75
  112. package/dist/live.js.map +1 -1
  113. package/dist/mcp-daemon-unavailable.d.ts +6 -0
  114. package/dist/mcp-daemon-unavailable.d.ts.map +1 -0
  115. package/dist/mcp-daemon-unavailable.js +16 -0
  116. package/dist/mcp-daemon-unavailable.js.map +1 -0
  117. package/dist/mcp-run-projections.d.ts +42 -0
  118. package/dist/mcp-run-projections.d.ts.map +1 -0
  119. package/dist/mcp-run-projections.js +74 -0
  120. package/dist/mcp-run-projections.js.map +1 -0
  121. package/dist/mcp-runner.d.ts +19 -1
  122. package/dist/mcp-runner.d.ts.map +1 -1
  123. package/dist/mcp-runner.js +121 -115
  124. package/dist/mcp-runner.js.map +1 -1
  125. package/dist/native-login.js.map +1 -1
  126. package/dist/ops-command-specs.d.ts +64 -0
  127. package/dist/ops-command-specs.d.ts.map +1 -0
  128. package/dist/ops-command-specs.js +146 -0
  129. package/dist/ops-command-specs.js.map +1 -0
  130. package/dist/ops-commands.d.ts.map +1 -1
  131. package/dist/ops-commands.js +23 -5
  132. package/dist/ops-commands.js.map +1 -1
  133. package/dist/orphan-reaper.js.map +1 -1
  134. package/dist/output-mode.d.ts +11 -0
  135. package/dist/output-mode.d.ts.map +1 -0
  136. package/dist/output-mode.js +28 -0
  137. package/dist/output-mode.js.map +1 -0
  138. package/dist/plan-question-loop.d.ts.map +1 -1
  139. package/dist/plan-question-loop.js +16 -13
  140. package/dist/plan-question-loop.js.map +1 -1
  141. package/dist/plugins.js +1 -1
  142. package/dist/plugins.js.map +1 -1
  143. package/dist/primary-output.d.ts +9 -4
  144. package/dist/primary-output.d.ts.map +1 -1
  145. package/dist/primary-output.js +50 -2
  146. package/dist/primary-output.js.map +1 -1
  147. package/dist/quota-subject-universe.d.ts +6 -0
  148. package/dist/quota-subject-universe.d.ts.map +1 -0
  149. package/dist/quota-subject-universe.js +31 -0
  150. package/dist/quota-subject-universe.js.map +1 -0
  151. package/dist/registry.js.map +1 -1
  152. package/dist/release-command.d.ts +1 -1
  153. package/dist/release-command.js +2 -2
  154. package/dist/remote-command-specs.d.ts +45 -0
  155. package/dist/remote-command-specs.d.ts.map +1 -0
  156. package/dist/remote-command-specs.js +29 -0
  157. package/dist/remote-command-specs.js.map +1 -0
  158. package/dist/remote-command.d.ts +11 -0
  159. package/dist/remote-command.d.ts.map +1 -0
  160. package/dist/remote-command.js +262 -0
  161. package/dist/remote-command.js.map +1 -0
  162. package/dist/remote-filesystem.d.ts +33 -0
  163. package/dist/remote-filesystem.d.ts.map +1 -0
  164. package/dist/remote-filesystem.js +280 -0
  165. package/dist/remote-filesystem.js.map +1 -0
  166. package/dist/repo-asset-authority.js.map +1 -1
  167. package/dist/request-preflight.d.ts +11 -2
  168. package/dist/request-preflight.d.ts.map +1 -1
  169. package/dist/request-preflight.js +36 -13
  170. package/dist/request-preflight.js.map +1 -1
  171. package/dist/retry-command-specs.d.ts.map +1 -1
  172. package/dist/retry-command-specs.js +2 -0
  173. package/dist/retry-command-specs.js.map +1 -1
  174. package/dist/run-applicability.d.ts +74 -0
  175. package/dist/run-applicability.d.ts.map +1 -0
  176. package/dist/run-applicability.js +72 -0
  177. package/dist/run-applicability.js.map +1 -0
  178. package/dist/run-detail-projections.d.ts +39 -0
  179. package/dist/run-detail-projections.d.ts.map +1 -0
  180. package/dist/run-detail-projections.js +64 -0
  181. package/dist/run-detail-projections.js.map +1 -0
  182. package/dist/run-detail-response.d.ts +7 -0
  183. package/dist/run-detail-response.d.ts.map +1 -0
  184. package/dist/run-detail-response.js +23 -0
  185. package/dist/run-detail-response.js.map +1 -0
  186. package/dist/run-facts-projection.d.ts +22 -0
  187. package/dist/run-facts-projection.d.ts.map +1 -0
  188. package/dist/run-facts-projection.js +86 -0
  189. package/dist/run-facts-projection.js.map +1 -0
  190. package/dist/runtime-replacement-stop.d.ts +25 -0
  191. package/dist/runtime-replacement-stop.d.ts.map +1 -0
  192. package/dist/runtime-replacement-stop.js +145 -0
  193. package/dist/runtime-replacement-stop.js.map +1 -0
  194. package/dist/settings-command.d.ts +1 -0
  195. package/dist/settings-command.d.ts.map +1 -1
  196. package/dist/settings-command.js +27 -21
  197. package/dist/settings-command.js.map +1 -1
  198. package/dist/settings-service.d.ts +7 -7
  199. package/dist/settings-service.d.ts.map +1 -1
  200. package/dist/settings-service.js +3 -3
  201. package/dist/settings-service.js.map +1 -1
  202. package/dist/setup-client-pty.d.ts +14 -0
  203. package/dist/setup-client-pty.d.ts.map +1 -0
  204. package/dist/setup-client-pty.js +61 -0
  205. package/dist/setup-client-pty.js.map +1 -0
  206. package/dist/setup-device-code-disclosure.d.ts +15 -0
  207. package/dist/setup-device-code-disclosure.d.ts.map +1 -0
  208. package/dist/setup-device-code-disclosure.js +52 -0
  209. package/dist/setup-device-code-disclosure.js.map +1 -0
  210. package/dist/setup-job-reducer.d.ts.map +1 -1
  211. package/dist/setup-job-reducer.js +1 -0
  212. package/dist/setup-job-reducer.js.map +1 -1
  213. package/dist/setup-job-store.d.ts +275 -75
  214. package/dist/setup-job-store.d.ts.map +1 -1
  215. package/dist/setup-job-store.js.map +1 -1
  216. package/dist/setup-job-support.js.map +1 -1
  217. package/dist/setup-jobs.d.ts +517 -137
  218. package/dist/setup-jobs.d.ts.map +1 -1
  219. package/dist/setup-jobs.js +68 -118
  220. package/dist/setup-jobs.js.map +1 -1
  221. package/dist/setup-lifecycle-binding.d.ts +7 -0
  222. package/dist/setup-lifecycle-binding.d.ts.map +1 -1
  223. package/dist/setup-lifecycle-binding.js +6 -0
  224. package/dist/setup-lifecycle-binding.js.map +1 -1
  225. package/dist/setup-login-child-lifecycle.d.ts +13 -0
  226. package/dist/setup-login-child-lifecycle.d.ts.map +1 -0
  227. package/dist/setup-login-child-lifecycle.js +45 -0
  228. package/dist/setup-login-child-lifecycle.js.map +1 -0
  229. package/dist/setup-login-inline.d.ts +11 -12
  230. package/dist/setup-login-inline.d.ts.map +1 -1
  231. package/dist/setup-login-inline.js +26 -15
  232. package/dist/setup-login-inline.js.map +1 -1
  233. package/dist/setup-login-permit.d.ts +10 -0
  234. package/dist/setup-login-permit.d.ts.map +1 -0
  235. package/dist/setup-login-permit.js +52 -0
  236. package/dist/setup-login-permit.js.map +1 -0
  237. package/dist/setup-login-protocol.d.ts.map +1 -1
  238. package/dist/setup-login-protocol.js +9 -2
  239. package/dist/setup-login-protocol.js.map +1 -1
  240. package/dist/setup-login-runner.d.ts +1 -0
  241. package/dist/setup-login-runner.d.ts.map +1 -1
  242. package/dist/setup-login-runner.js +20 -31
  243. package/dist/setup-login-runner.js.map +1 -1
  244. package/dist/setup-supervisor.d.ts.map +1 -1
  245. package/dist/setup-supervisor.js.map +1 -1
  246. package/dist/terminal-run-output.d.ts +12 -0
  247. package/dist/terminal-run-output.d.ts.map +1 -0
  248. package/dist/terminal-run-output.js +33 -0
  249. package/dist/terminal-run-output.js.map +1 -0
  250. package/dist/thread-delivery.d.ts.map +1 -1
  251. package/dist/thread-delivery.js +4 -3
  252. package/dist/thread-delivery.js.map +1 -1
  253. package/dist/thread-execution-workspace.d.ts +15 -0
  254. package/dist/thread-execution-workspace.d.ts.map +1 -1
  255. package/dist/thread-execution-workspace.js +39 -5
  256. package/dist/thread-execution-workspace.js.map +1 -1
  257. package/dist/thread-turn-services.d.ts +104 -0
  258. package/dist/thread-turn-services.d.ts.map +1 -0
  259. package/dist/thread-turn-services.js +27 -0
  260. package/dist/thread-turn-services.js.map +1 -0
  261. package/package.json +23 -23
@@ -1 +1 @@
1
- {"version":3,"file":"about-command.d.ts","sourceRoot":"","sources":["../src/about-command.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,qEAAqE;AACrE,eAAO,MAAM,kBAAkB,cAAc,CAAC;AAC9C,eAAO,MAAM,YAAY,qBAAqB,CAAC;AAC/C,eAAO,MAAM,aAAa,QAAQ,CAAC;AACnC,eAAO,MAAM,WAAW;;;;CAId,CAAC;AAEX,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;KAC7B,CAAC;CACH;AAED,qEAAqE;AACrE,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CASpD;AAED,6CAA6C;AAC7C,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAWnD"}
1
+ {"version":3,"file":"about-command.d.ts","sourceRoot":"","sources":["../src/about-command.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,qEAAqE;AACrE,eAAO,MAAM,kBAAkB,cAAc,CAAC;AAC9C,eAAO,MAAM,YAAY,qBAAqB,CAAC;AAC/C,eAAO,MAAM,aAAa,QAAQ,CAAC;AACnC,eAAO,MAAM,WAAW;aACtB,QAAQ,EAAE,yBAAyB;aACnC,CAAC,EAAE,0BAA0B;aAC7B,UAAU,EAAE,sCAAsC;CAC1C,CAAC;AAEX,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;KAC7B,CAAC;CACH;AAED,qEAAqE;AACrE,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CASpD;AAED,6CAA6C;AAC7C,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAWnD"}
@@ -9,6 +9,7 @@
9
9
  * + quota, so it can never disagree with run-time admission.
10
10
  */
11
11
  import type { AccountIdentity, ControlHarnessAccounts, CredentialProfile, CredentialProfileStatus, QuotaSnapshot } from "@claudexor/schema";
12
+ import type { HarnessStatus } from "@claudexor/gateway";
12
13
  /**
13
14
  * Non-secret {email, plan} of a config_dir_login PROFILE, read daemon-side from
14
15
  * the profile's OWN isolation-locator store (INV-067) — never the ordinary
@@ -22,5 +23,11 @@ export declare function profileAccountIdentity(profile: CredentialProfile): Acco
22
23
  * Adapters without profile support report an honest unknown.
23
24
  */
24
25
  export declare function profileDoctorStatus(profile: CredentialProfile): Promise<CredentialProfileStatus>;
25
- export declare function harnessAccountsProjection(repoRoot: string, quotaSnapshots?: readonly QuotaSnapshot[]): Promise<ControlHarnessAccounts[]>;
26
+ export declare function harnessAccountsProjection(repoRoot: string, quotaSnapshots?: readonly QuotaSnapshot[], snapshot?: {
27
+ statuses?: readonly HarnessStatus[];
28
+ profiles?: readonly {
29
+ profile: CredentialProfile;
30
+ status: CredentialProfileStatus;
31
+ }[];
32
+ }): Promise<ControlHarnessAccounts[]>;
26
33
  //# sourceMappingURL=accounts-projection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"accounts-projection.d.ts","sourceRoot":"","sources":["../src/accounts-projection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,uBAAuB,EACvB,aAAa,EACd,MAAM,mBAAmB,CAAC;AAmB3B;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,iBAAiB,GAAG,eAAe,GAAG,IAAI,CAKzF;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,uBAAuB,CAAC,CAYlC;AAED,wBAAsB,yBAAyB,CAC7C,QAAQ,EAAE,MAAM,EAChB,cAAc,GAAE,SAAS,aAAa,EAAO,GAC5C,OAAO,CAAC,sBAAsB,EAAE,CAAC,CA4CnC"}
1
+ {"version":3,"file":"accounts-projection.d.ts","sourceRoot":"","sources":["../src/accounts-projection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,uBAAuB,EACvB,aAAa,EACd,MAAM,mBAAmB,CAAC;AAS3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAiBxD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,iBAAiB,GAAG,eAAe,GAAG,IAAI,CAKzF;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,uBAAuB,CAAC,CAGlC;AAED,wBAAsB,yBAAyB,CAC7C,QAAQ,EAAE,MAAM,EAChB,cAAc,GAAE,SAAS,aAAa,EAAO,EAC7C,QAAQ,CAAC,EAAE;IACT,QAAQ,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;IACpC,QAAQ,CAAC,EAAE,SAAS;QAAE,OAAO,EAAE,iBAAiB,CAAC;QAAC,MAAM,EAAE,uBAAuB,CAAA;KAAE,EAAE,CAAC;CACvF,GACA,OAAO,CAAC,sBAAsB,EAAE,CAAC,CA8DnC"}
@@ -1,5 +1,5 @@
1
1
  import { loadConfig } from "@claudexor/config";
2
- import { nextUpIdentity } from "@claudexor/orchestrator";
2
+ import { defaultCredentialRoute, effectiveAuthPreference, nextUpIdentity, probeCredentialProfileStatus, profileStatusAdmits, } from "@claudexor/orchestrator";
3
3
  import { codexAccountIdentity, defaultNativeCodexHome } from "@claudexor/harness-codex";
4
4
  import { claudeAccountIdentity, defaultNativeClaudeConfigDir } from "@claudexor/harness-claude";
5
5
  import { buildGateway, buildRegistry } from "./registry.js";
@@ -38,34 +38,44 @@ export function profileAccountIdentity(profile) {
38
38
  */
39
39
  export async function profileDoctorStatus(profile) {
40
40
  const adapter = buildRegistry().get(profile.harness_id);
41
- return adapter?.probeCredentialProfile
42
- ? adapter.probeCredentialProfile(profile)
43
- : {
44
- profile_id: profile.profile_id,
45
- harness_id: profile.harness_id,
46
- availability: "unknown",
47
- verification: "not_run",
48
- detail: `harness "${profile.harness_id}" has no profile probe`,
49
- last_verified_at: null,
50
- };
41
+ return probeCredentialProfileStatus(profile, adapter?.probeCredentialProfile?.bind(adapter));
51
42
  }
52
- export async function harnessAccountsProjection(repoRoot, quotaSnapshots = []) {
43
+ export async function harnessAccountsProjection(repoRoot, quotaSnapshots = [], snapshot) {
53
44
  const cfg = loadConfig(repoRoot).global;
54
45
  const harnessIds = [...buildRegistry({ includeFakes: false }).keys()].sort();
55
46
  const nativeDetected = new Map();
56
- try {
57
- const statuses = await buildGateway({ includeFakes: false }).statusAll({ cwd: repoRoot, fresh: false }, harnessIds);
58
- for (const s of statuses) {
59
- nativeDetected.set(s.id, s.authSources.some((src) => src.source === "native_session" && src.availability === "available"));
47
+ let statuses = snapshot?.statuses ?? [];
48
+ if (!snapshot?.statuses) {
49
+ try {
50
+ statuses = await buildGateway({ includeFakes: false }).statusAll({ cwd: repoRoot, fresh: true }, harnessIds);
51
+ }
52
+ catch {
53
+ statuses = [];
60
54
  }
61
55
  }
62
- catch {
63
- // Doctor probe unavailable: every harness reports "native not detected"
64
- // rather than failing the whole accounts listing.
56
+ const defaultRoutes = new Map();
57
+ for (const s of statuses) {
58
+ const native = s.authSources.find((source) => source.source === "native_session");
59
+ const detected = native?.availability === "available";
60
+ nativeDetected.set(s.id, detected);
61
+ const harness = cfg.harnesses[s.id];
62
+ const route = defaultCredentialRoute(s, effectiveAuthPreference(harness?.auth_preference, cfg.routing.auth_preference));
63
+ if (route)
64
+ defaultRoutes.set(s.id, route);
65
+ }
66
+ const readyProfiles = new Map();
67
+ for (const entry of snapshot?.profiles ?? []) {
68
+ if (!entry.profile.enabled || !profileStatusAdmits(entry.profile, entry.status))
69
+ continue;
70
+ const ready = readyProfiles.get(entry.profile.harness_id) ?? new Set();
71
+ ready.add(entry.profile.profile_id);
72
+ readyProfiles.set(entry.profile.harness_id, ready);
65
73
  }
66
74
  return harnessIds.map((harnessId) => {
67
75
  const h = cfg.harnesses[harnessId];
68
76
  const nativeEnabled = h?.native_credentials_enabled ?? true;
77
+ const defaultEnabled = (h?.enabled ?? true) && nativeEnabled;
78
+ const defaultRoute = defaultRoutes.get(harnessId) ?? null;
69
79
  return {
70
80
  harness_id: harnessId,
71
81
  native_credentials_enabled: nativeEnabled,
@@ -82,7 +92,10 @@ export async function harnessAccountsProjection(repoRoot, quotaSnapshots = []) {
82
92
  headroom_threshold: 0.9,
83
93
  },
84
94
  snapshots: quotaSnapshots,
85
- nativeEnabled,
95
+ defaultEnabled,
96
+ defaultReady: defaultRoute !== null,
97
+ defaultRoute,
98
+ readyProfileIds: readyProfiles.get(harnessId) ?? new Set(),
86
99
  }),
87
100
  };
88
101
  });
@@ -1 +1 @@
1
- {"version":3,"file":"accounts-projection.js","sourceRoot":"","sources":["../src/accounts-projection.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAChG,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE5D;;;;;GAKG;AACH,SAAS,qBAAqB,CAAC,SAAiB;IAC9C,IAAI,SAAS,KAAK,OAAO;QAAE,OAAO,oBAAoB,CAAC,sBAAsB,EAAE,CAAC,CAAC;IACjF,IAAI,SAAS,KAAK,QAAQ;QAAE,OAAO,qBAAqB,CAAC,4BAA4B,EAAE,CAAC,CAAC;IACzF,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAA0B;IAC/D,IAAI,CAAC,OAAO,CAAC,iBAAiB;QAAE,OAAO,IAAI,CAAC;IAC5C,IAAI,OAAO,CAAC,UAAU,KAAK,OAAO;QAAE,OAAO,oBAA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,EAAE,cAAc,IAAI;oBAC3B,YAAY,EAAE,MAAM;oBACpB,iBAAiB,EAAE,EAAE;oBACrB,kBAAkB,EAAE,GAAG;iBACxB;gBACD,SAAS,EAAE,cAAc;gBACzB,cAAc;gBACd,YAAY,EAAE,YAAY,KAAK,IAAI;gBACnC,YAAY;gBACZ,eAAe,EAAE,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,IAAI,GAAG,EAAE;aAC3D,CAAC;SACH,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,206 @@
1
+ import type { QuotaRegistry } from "@claudexor/daemon";
2
+ import { type HarnessStatus } from "@claudexor/gateway";
3
+ export type HarnessListInput = {
4
+ fresh?: boolean;
5
+ includeFakes?: boolean;
6
+ harnessIds?: string[];
7
+ };
8
+ export declare function projectHarnessStatuses(statuses: readonly HarnessStatus[]): Promise<{
9
+ id: string;
10
+ available: boolean;
11
+ status: "ok" | "degraded" | "unavailable";
12
+ manifest: import("@claudexor/schema").HarnessManifest | null;
13
+ enabledIntents: import("@claudexor/schema").Intent[];
14
+ routableIntents: import("@claudexor/schema").Intent[];
15
+ disabledIntents: import("@claudexor/schema").Intent[];
16
+ checks: import("@claudexor/schema").ConformanceCheck[];
17
+ reasons: string[];
18
+ authSources: import("@claudexor/schema").AuthSourceReadiness[];
19
+ configuredModel: string | null;
20
+ configuredModelCheck: {
21
+ status: "ok" | "rejected";
22
+ message?: string | null;
23
+ } | null;
24
+ delegation: {
25
+ available: boolean;
26
+ reason: "manifest_unsupported" | "ready" | "runtime_unavailable";
27
+ remediation: string | null;
28
+ requiresFullAccess: boolean;
29
+ };
30
+ readiness: {
31
+ id: string;
32
+ kind: "auth" | "binary" | "model" | "probe" | "smoke";
33
+ title: string;
34
+ status: "fail" | "pass" | "skip";
35
+ detail: string | null;
36
+ }[];
37
+ }[]>;
38
+ /** One server-owned Accounts response builder. The opt-in form refreshes quota
39
+ * first and then derives next_up from that exact returned response; no client
40
+ * can accidentally pair a newer quota card with an older routing identity. */
41
+ export declare function createCredentialProfilesService(quotaRegistry: () => QuotaRegistry): (input?: {
42
+ snapshot?: boolean;
43
+ }) => Promise<{
44
+ profiles: {
45
+ profile: {
46
+ profile_id: string;
47
+ harness_id: string;
48
+ display_name: string;
49
+ credential_kind: "api_key" | "config_dir_login" | "oauth_token";
50
+ isolation_locator: string | null;
51
+ secret_ref: string | null;
52
+ enabled: boolean;
53
+ created_at: string | null;
54
+ };
55
+ status: {
56
+ profile_id: string;
57
+ harness_id: string;
58
+ availability: "available" | "unavailable" | "unknown";
59
+ verification: "failed" | "not_run" | "passed";
60
+ detail?: string | undefined;
61
+ last_verified_at: string | null;
62
+ };
63
+ identity: {
64
+ email?: string | undefined;
65
+ plan?: string | undefined;
66
+ } | null;
67
+ }[];
68
+ harnessAccounts: {
69
+ harness_id: string;
70
+ native_credentials_enabled: boolean;
71
+ native_login_detected: boolean;
72
+ identity: {
73
+ email?: string | undefined;
74
+ plan?: string | undefined;
75
+ } | null;
76
+ next_up: {
77
+ kind: "profile";
78
+ profileId: string;
79
+ } | {
80
+ kind: "native";
81
+ route?: "api_key" | "local_session" | undefined;
82
+ } | {
83
+ kind: "none";
84
+ reason: string;
85
+ };
86
+ }[];
87
+ harnesses: {
88
+ id: string;
89
+ available: boolean;
90
+ status: "ok" | "degraded" | "unavailable";
91
+ manifest: import("@claudexor/schema").HarnessManifest | null;
92
+ enabledIntents: import("@claudexor/schema").Intent[];
93
+ routableIntents: import("@claudexor/schema").Intent[];
94
+ disabledIntents: import("@claudexor/schema").Intent[];
95
+ checks: import("@claudexor/schema").ConformanceCheck[];
96
+ reasons: string[];
97
+ authSources: import("@claudexor/schema").AuthSourceReadiness[];
98
+ configuredModel: string | null;
99
+ configuredModelCheck: {
100
+ status: "ok" | "rejected";
101
+ message?: string | null;
102
+ } | null;
103
+ delegation: {
104
+ available: boolean;
105
+ reason: "manifest_unsupported" | "ready" | "runtime_unavailable";
106
+ remediation: string | null;
107
+ requiresFullAccess: boolean;
108
+ };
109
+ readiness: {
110
+ id: string;
111
+ kind: "auth" | "binary" | "model" | "probe" | "smoke";
112
+ title: string;
113
+ status: "fail" | "pass" | "skip";
114
+ detail: string | null;
115
+ }[];
116
+ }[];
117
+ git: {
118
+ status: "available" | "developer_tools_stub" | "failed" | "missing";
119
+ version: string | null;
120
+ detail: string | null;
121
+ remediation: string | null;
122
+ };
123
+ quota: {
124
+ snapshots: {
125
+ subject: {
126
+ harness: string;
127
+ credential_route: "local" | "managed_api_key" | "vendor_native";
128
+ plan_label: string | null;
129
+ subject_id: string | null;
130
+ };
131
+ constraints: {
132
+ id: string;
133
+ label: string;
134
+ used_ratio: number | null;
135
+ window_seconds: number | null;
136
+ resets_at: string | null;
137
+ cooldown_until: string | null;
138
+ }[];
139
+ source: "claude_api_retry" | "claude_oauth_usage" | "claude_statusline" | "codex_app_server" | "codex_rollout";
140
+ observed_at: string;
141
+ freshness: "fresh" | "stale" | "unknown";
142
+ }[];
143
+ absences: {
144
+ subject: {
145
+ harness: string;
146
+ credential_route: "local" | "managed_api_key" | "vendor_native";
147
+ plan_label: string | null;
148
+ subject_id: string | null;
149
+ };
150
+ reason: "no_source" | "not_logged_in" | "platform_unsupported" | "refresh_failed" | "transport_unavailable";
151
+ detail: string | null;
152
+ observed_at: string;
153
+ }[];
154
+ refreshed_at: string | null;
155
+ };
156
+ quotaEventCursor: string;
157
+ } | {
158
+ harnesses?: undefined;
159
+ git?: undefined;
160
+ quota?: undefined;
161
+ quotaEventCursor?: undefined;
162
+ profiles: {
163
+ profile: {
164
+ profile_id: string;
165
+ harness_id: string;
166
+ display_name: string;
167
+ credential_kind: "api_key" | "config_dir_login" | "oauth_token";
168
+ isolation_locator: string | null;
169
+ secret_ref: string | null;
170
+ enabled: boolean;
171
+ created_at: string | null;
172
+ };
173
+ status: {
174
+ profile_id: string;
175
+ harness_id: string;
176
+ availability: "available" | "unavailable" | "unknown";
177
+ verification: "failed" | "not_run" | "passed";
178
+ detail?: string | undefined;
179
+ last_verified_at: string | null;
180
+ };
181
+ identity: {
182
+ email?: string | undefined;
183
+ plan?: string | undefined;
184
+ } | null;
185
+ }[];
186
+ harnessAccounts: {
187
+ harness_id: string;
188
+ native_credentials_enabled: boolean;
189
+ native_login_detected: boolean;
190
+ identity: {
191
+ email?: string | undefined;
192
+ plan?: string | undefined;
193
+ } | null;
194
+ next_up: {
195
+ kind: "profile";
196
+ profileId: string;
197
+ } | {
198
+ kind: "native";
199
+ route?: "api_key" | "local_session" | undefined;
200
+ } | {
201
+ kind: "none";
202
+ reason: string;
203
+ };
204
+ }[];
205
+ }>;
206
+ //# sourceMappingURL=accounts-services.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts-services.d.ts","sourceRoot":"","sources":["../src/accounts-services.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAc5E,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAEF,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE;;;;;;;;;;;;;gBAKpD,IAAI,GAAG,UAAU;kBAAY,MAAM,GAAG,IAAI;;;;;;;;;;;;;;;KAuBpE;AAED;;8EAE8E;AAC9E,wBAAgB,+BAA+B,CAAC,aAAa,EAAE,MAAM,aAAa,YAC1D;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA7BnB,IAAI,GAAG,UAAU;sBAAY,MAAM,GAAG,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEpE"}
@@ -0,0 +1,71 @@
1
+ import { loadConfig } from "@claudexor/config";
2
+ import { normalizeReadiness } from "@claudexor/gateway";
3
+ import { probeGitCapability } from "@claudexor/workspace";
4
+ import { noProjectRepoRoot } from "@claudexor/util";
5
+ import { validateModel } from "@claudexor/core";
6
+ import { harnessAccountsProjection, profileAccountIdentity, profileDoctorStatus, } from "./accounts-projection.js";
7
+ import { buildGateway, harnessModels } from "./registry.js";
8
+ import { delegationCapabilityFor } from "./delegation-capability.js";
9
+ const NO_PROJECT_ROOT = noProjectRepoRoot();
10
+ export async function projectHarnessStatuses(statuses) {
11
+ const cfg = loadConfig(NO_PROJECT_ROOT);
12
+ return Promise.all(statuses.map(async (status) => {
13
+ const configured = cfg.global.harnesses[status.id]?.default_model ?? null;
14
+ let check = null;
15
+ if (configured) {
16
+ const truth = await harnessModels(status.id, NO_PROJECT_ROOT, true);
17
+ check = validateModel(configured, truth.models.map((model) => model.id), truth.source === "api" ? "api" : "manifest");
18
+ }
19
+ return {
20
+ ...status,
21
+ configuredModel: configured,
22
+ configuredModelCheck: check,
23
+ delegation: delegationCapabilityFor(status.manifest),
24
+ readiness: normalizeReadiness({
25
+ checks: status.checks,
26
+ authSources: status.authSources,
27
+ configuredModel: configured,
28
+ configuredModelCheck: check,
29
+ }),
30
+ };
31
+ }));
32
+ }
33
+ /** One server-owned Accounts response builder. The opt-in form refreshes quota
34
+ * first and then derives next_up from that exact returned response; no client
35
+ * can accidentally pair a newer quota card with an older routing identity. */
36
+ export function createCredentialProfilesService(quotaRegistry) {
37
+ return async (input) => {
38
+ const profiles = loadConfig(NO_PROJECT_ROOT).global.credential_profiles;
39
+ const projectedProfiles = Promise.all(profiles.map(async (profile) => ({
40
+ profile,
41
+ status: await profileDoctorStatus(profile),
42
+ identity: profileAccountIdentity(profile),
43
+ })));
44
+ if (input?.snapshot === true) {
45
+ const [out, statuses, git, fencedQuota] = await Promise.all([
46
+ projectedProfiles,
47
+ buildGateway({ includeFakes: false }).statusAll({ cwd: NO_PROJECT_ROOT, fresh: true }),
48
+ probeGitCapability(),
49
+ quotaRegistry().refreshWithCursor(),
50
+ ]);
51
+ const quota = fencedQuota.response;
52
+ return {
53
+ profiles: out,
54
+ harnessAccounts: await harnessAccountsProjection(NO_PROJECT_ROOT, quota.snapshots, {
55
+ profiles: out,
56
+ statuses,
57
+ }),
58
+ harnesses: await projectHarnessStatuses(statuses),
59
+ git,
60
+ quota,
61
+ quotaEventCursor: fencedQuota.quotaEventCursor,
62
+ };
63
+ }
64
+ const out = await projectedProfiles;
65
+ return {
66
+ profiles: out,
67
+ harnessAccounts: await harnessAccountsProjection(NO_PROJECT_ROOT, quotaRegistry().read().snapshots, { profiles: out }),
68
+ };
69
+ };
70
+ }
71
+ //# sourceMappingURL=accounts-services.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts-services.js","sourceRoot":"","sources":["../src/accounts-services.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAsB,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE,MAAM,eAAe,GAAG,iBAAiB,EAAE,CAAC;AAQ5C,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,QAAkC;IAC7E,MAAM,GAAG,GAAG,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@@
1
+ import { type ControlPrimaryOutput, type ModeKind, type RunFailure, type RunOutcomeFacts } from "@claudexor/schema";
1
2
  import { type ControlApiAddress } from "./live.js";
3
+ import { type RunDetailProblem } from "./run-detail-projections.js";
2
4
  export declare const ACP_MAX_REPLAY_TURNS = 50;
3
5
  /** Bound the load-replay to the most recent ACP_MAX_REPLAY_TURNS turns, and
4
6
  * report how many older turns were omitted (disclosed to the client, never
@@ -7,10 +9,47 @@ export declare function selectReplayTurns<T>(rawTurns: readonly T[]): {
7
9
  replayTurns: T[];
8
10
  omittedTurnCount: number;
9
11
  };
12
+ /** One post-terminal GET /runs/:id for the ACP turn result (INV-120), DEGRADING
13
+ * on failure: a finished turn must never become a JSON-RPC error that loses
14
+ * the runId. Missing/legacy detail projects null fields; a raised typed
15
+ * problem (e.g. 500 run_facts_invalid) rides the result as `detailProblem`
16
+ * so the client still receives the terminal answer plus the typed reason its
17
+ * detail projections are absent. Exported for test. */
18
+ export declare function projectTerminalTurnDetail(addr: ControlApiAddress, runId: string): Promise<{
19
+ applyEligibility: unknown;
20
+ planReadiness: unknown;
21
+ planQuestions: unknown[];
22
+ failure: RunFailure | null;
23
+ primaryOutput: ControlPrimaryOutput | null;
24
+ outcomeFacts: RunOutcomeFacts | null;
25
+ outcomeBanner: string | null;
26
+ detailProblem?: RunDetailProblem;
27
+ }>;
28
+ type AcpTerminalRecord = {
29
+ state: string;
30
+ error?: string;
31
+ params?: unknown;
32
+ };
33
+ /** Effective mode persisted on the daemon job after the thread-turn funnel. */
34
+ export declare function acpTerminalRecordMode(record: Pick<AcpTerminalRecord, "params">): ModeKind | undefined;
35
+ /**
36
+ * ACP terminal text consumes the Control API's canonical bounded/redacted
37
+ * primaryOutput. Local artifact discovery exists only as a degrading fallback
38
+ * when that one detail read failed; its mode comes from the durable daemon job,
39
+ * never from an ACP default or a hard-coded Agent assumption.
40
+ */
41
+ export declare function acpTerminalSummary(input: {
42
+ runId: string;
43
+ runDir: string;
44
+ record: AcpTerminalRecord;
45
+ detail: Awaited<ReturnType<typeof projectTerminalTurnDetail>>;
46
+ }): string;
10
47
  /** A machine-ish reason for a failed per-turn run-detail fetch: prefer the
11
48
  * typed control-API `code` (e.g. run_expired_by_retention), then the HTTP
12
49
  * status, then a generic marker — never the raw English message. */
13
50
  export declare function typedFetchReason(error: unknown): string;
51
+ /** Translate ACP aliases into the strict Control API run-start vocabulary. */
52
+ export declare function projectAcpRunControls(input: Record<string, unknown>): Record<string, unknown>;
14
53
  type Hooks = {
15
54
  onInteraction?: (ctx: any) => Promise<any | null>;
16
55
  signal?: AbortSignal;
@@ -1 +1 @@
1
- {"version":3,"file":"acp-surface-runner.d.ts","sourceRoot":"","sources":["../src/acp-surface-runner.ts"],"names":[],"mappings":"AAUA,OAAO,EAAmB,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAWpE,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC;;mDAEmD;AACnD,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,GAAG;IAC5D,WAAW,EAAE,CAAC,EAAE,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAKA;AAED;;qEAEqE;AACrE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAOvD;AAED,KAAK,KAAK,GAAG;IACX,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;IAClD,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,MAAM,EAAE,CACN,IAAI,EAAE,iBAAiB,EACvB,MAAM,EAAE,WAAW,KAChB,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,YAAY,EAAE,CACZ,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,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