agl 43.6.0 → 43.7.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 (67) hide show
  1. package/changelog.md +10 -0
  2. package/dist_serve/bundle.js +1801 -1783
  3. package/dist_serve/bundle.js.map +2 -2
  4. package/dist_ts/00_commitinfo_data.js +1 -1
  5. package/dist_ts/classes.accountsactions.d.ts +3 -1
  6. package/dist_ts/classes.accountsactions.js +17 -1
  7. package/dist_ts/classes.controller.d.ts +3 -3
  8. package/dist_ts/classes.controller.js +5 -4
  9. package/dist_ts/classes.inferencerouter.d.ts +21 -3
  10. package/dist_ts/classes.inferencerouter.js +40 -17
  11. package/dist_ts/classes.inferenceservice.js +2 -2
  12. package/dist_ts/functions.inferencecli.js +2 -1
  13. package/dist_ts/interfaces.auth.d.ts +1 -1
  14. package/dist_ts/interfaces.auth.js +2 -1
  15. package/dist_ts/plugins.d.ts +2 -1
  16. package/dist_ts/plugins.js +4 -2
  17. package/dist_ts_authswitch/authority-contract.d.ts +26 -0
  18. package/dist_ts_authswitch/authority-contract.js +1 -1
  19. package/dist_ts_authswitch/authority-overview.d.ts +8 -0
  20. package/dist_ts_authswitch/authority-overview.js +10 -4
  21. package/dist_ts_authswitch/authority-placement.d.ts +16 -9
  22. package/dist_ts_authswitch/authority-placement.js +10 -7
  23. package/dist_ts_authswitch/authority-priority.d.ts +20 -0
  24. package/dist_ts_authswitch/authority-priority.js +21 -0
  25. package/dist_ts_authswitch/classes.authoritybroker.d.ts +7 -0
  26. package/dist_ts_authswitch/classes.authoritybroker.js +26 -2
  27. package/dist_ts_authswitch/classes.authoritycli.d.ts +1 -0
  28. package/dist_ts_authswitch/classes.authoritycli.js +43 -3
  29. package/dist_ts_authswitch/classes.authorityclient.d.ts +6 -1
  30. package/dist_ts_authswitch/classes.authorityclient.js +12 -4
  31. package/dist_ts_authswitch/classes.authoritydaemon.js +7 -1
  32. package/dist_ts_authswitch/classes.authoritydatabase.d.ts +6 -0
  33. package/dist_ts_authswitch/classes.authoritydatabase.js +13 -2
  34. package/dist_ts_authswitch/classes.authoritymodels.d.ts +7 -0
  35. package/dist_ts_authswitch/classes.authoritymodels.js +17 -8
  36. package/dist_ts_interfaces/requests.accounts.d.ts +19 -0
  37. package/dist_ts_interfaces/requests.accounts.js +1 -1
  38. package/dist_ts_interfaces/requests.d.ts +2 -2
  39. package/dist_ts_interfaces/requests.js +1 -1
  40. package/docs/authswitch.md +25 -0
  41. package/package.json +1 -1
  42. package/readme.md +29 -5
  43. package/ts/00_commitinfo_data.ts +1 -1
  44. package/ts/classes.accountsactions.ts +25 -0
  45. package/ts/classes.controller.ts +4 -3
  46. package/ts/classes.inferencerouter.ts +61 -16
  47. package/ts/classes.inferenceservice.ts +1 -1
  48. package/ts/functions.inferencecli.ts +1 -0
  49. package/ts/interfaces.auth.ts +1 -0
  50. package/ts/plugins.ts +3 -0
  51. package/ts_authswitch/authority-contract.ts +21 -0
  52. package/ts_authswitch/authority-overview.ts +19 -5
  53. package/ts_authswitch/authority-placement.ts +18 -10
  54. package/ts_authswitch/authority-priority.ts +25 -0
  55. package/ts_authswitch/classes.authoritybroker.ts +26 -1
  56. package/ts_authswitch/classes.authoritycli.ts +48 -2
  57. package/ts_authswitch/classes.authorityclient.ts +14 -4
  58. package/ts_authswitch/classes.authoritydaemon.ts +8 -1
  59. package/ts_authswitch/classes.authoritydatabase.ts +11 -1
  60. package/ts_authswitch/classes.authoritymodels.ts +17 -6
  61. package/ts_authswitch/readme.md +1 -1
  62. package/ts_interfaces/requests.accounts.ts +17 -0
  63. package/ts_interfaces/requests.ts +2 -0
  64. package/ts_web/00_commitinfo_data.ts +1 -1
  65. package/ts_web/accounts.plugins.ts +4 -2
  66. package/ts_web/classes.accountsreadmodel.ts +36 -2
  67. package/ts_web/elements.accounts.ts +48 -0
@@ -285,6 +285,25 @@ export interface IReq_ControllerAccountsRenewal extends plugins.typedrequestInte
285
285
  answer: TControllerAccountsAnswer<TControllerAccount>;
286
286
  };
287
287
  }
288
+ /**
289
+ * Gives an account the owner's priority (AGL-1809) for 24 hours from now, by the accounts service's clock, or ends it
290
+ * with `priority: false`; giving it to an account that holds it starts the 24 hours again. Until it ends, AGL's inference
291
+ * proxy places a new session on the account before any account of its pool without one, as long as it takes the
292
+ * request; several accounts can hold it. Any account can have one. `expectedRevision` is the revision the view showed,
293
+ * so a change of an account that changed meanwhile is refused as `account_changed` by the service. The answer arrives
294
+ * only once the projection shows the result.
295
+ */
296
+ export interface IReq_ControllerAccountsPriority extends plugins.typedrequestInterfaces.implementsTR<plugins.typedrequestInterfaces.ITypedRequest, IReq_ControllerAccountsPriority> {
297
+ method: 'controller.accounts.priority';
298
+ request: {
299
+ accountId: string;
300
+ expectedRevision: number;
301
+ priority: boolean;
302
+ };
303
+ response: {
304
+ answer: TControllerAccountsAnswer<TControllerAccount>;
305
+ };
306
+ }
288
307
  /** Duration validation shared with the authority; no implicit duration is supplied. */
289
308
  export declare const isControllerReserveLiftHours: typeof plugins.authswitchAuthority.isAuthSwitchReserveLiftHours;
290
309
  /** Lift only the saved reserve. The authority sets the expiry; the projection must show the change before answering. */
@@ -32,4 +32,4 @@ export const controllerRenewsAtRange = plugins.authswitchRenewal.authSwitchRenew
32
32
  export const controllerApiKeyMaxLength = 512;
33
33
  /** Duration validation shared with the authority; no implicit duration is supplied. */
34
34
  export const isControllerReserveLiftHours = plugins.authswitchAuthority.isAuthSwitchReserveLiftHours;
35
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVxdWVzdHMuYWNjb3VudHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90c19pbnRlcmZhY2VzL3JlcXVlc3RzLmFjY291bnRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxPQUFPLE1BQU0sY0FBYyxDQUFDO0FBOEd4QyxvR0FBb0c7QUFDcEcsTUFBTSxDQUFDLE1BQU0sZ0NBQWdDLEdBQUcsQ0FBQyxTQUFrQyxFQUFXLEVBQUUsQ0FBQyxDQUMvRixTQUFTLENBQUMsS0FBSyxLQUFLLFNBQVMsSUFBSSxTQUFTLENBQUMsS0FBSyxLQUFLLFlBQVksQ0FDbEUsQ0FBQztBQThCRjs7O0dBR0c7QUFDSCxNQUFNLENBQUMsTUFBTSx3QkFBd0IsR0FBRyxPQUFPLENBQUMsbUJBQW1CLENBQUMsd0JBQXdCLENBQUM7QUFDN0YsdUVBQXVFO0FBQ3ZFLE1BQU0sQ0FBQyxNQUFNLCtCQUErQixHQUFHLE9BQU8sQ0FBQyxtQkFBbUIsQ0FBQywrQkFBK0IsQ0FBQztBQWlCM0c7Ozs7R0FJRztBQUNILE1BQU0sQ0FBQyxNQUFNLGtDQUFrQyxHQUFHLE9BQU8sQ0FBQyxtQkFBbUIsQ0FBQywyQkFBMkIsQ0FBQztBQUMxRyxtRUFBbUU7QUFDbkUsTUFBTSxDQUFDLE1BQU0sOEJBQThCLEdBQUcsT0FBTyxDQUFDLG1CQUFtQixDQUFDLHVCQUF1QixDQUFDO0FBcUJsRzs7OztHQUlHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sOEJBQThCLEdBQUcsT0FBTyxDQUFDLGVBQWUsQ0FBQyw4QkFBOEIsQ0FBQztBQUNyRyxvREFBb0Q7QUFDcEQsTUFBTSxDQUFDLE1BQU0seUJBQXlCLEdBQUcsT0FBTyxDQUFDLGVBQWUsQ0FBQyx5QkFBeUIsQ0FBQztBQUUzRix5SEFBeUg7QUFDekgsTUFBTSxDQUFDLE1BQU0sb0JBQW9CLEdBQUcsT0FBTyxDQUFDLGlCQUFpQixDQUFDLG9CQUFvQixDQUFDO0FBQ25GLDBHQUEwRztBQUMxRyxNQUFNLENBQUMsTUFBTSx1QkFBdUIsR0FBRyxPQUFPLENBQUMsaUJBQWlCLENBQUMsdUJBQXVCLENBQUM7QUFFekYsa0hBQWtIO0FBQ2xILE1BQU0sQ0FBQyxNQUFNLHlCQUF5QixHQUFHLEdBQUcsQ0FBQztBQWtFN0MsdUZBQXVGO0FBQ3ZGLE1BQU0sQ0FBQyxNQUFNLDRCQUE0QixHQUFHLE9BQU8sQ0FBQyxtQkFBbUIsQ0FBQyw0QkFBNEIsQ0FBQyJ9
35
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVxdWVzdHMuYWNjb3VudHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90c19pbnRlcmZhY2VzL3JlcXVlc3RzLmFjY291bnRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxPQUFPLE1BQU0sY0FBYyxDQUFDO0FBOEd4QyxvR0FBb0c7QUFDcEcsTUFBTSxDQUFDLE1BQU0sZ0NBQWdDLEdBQUcsQ0FBQyxTQUFrQyxFQUFXLEVBQUUsQ0FBQyxDQUMvRixTQUFTLENBQUMsS0FBSyxLQUFLLFNBQVMsSUFBSSxTQUFTLENBQUMsS0FBSyxLQUFLLFlBQVksQ0FDbEUsQ0FBQztBQThCRjs7O0dBR0c7QUFDSCxNQUFNLENBQUMsTUFBTSx3QkFBd0IsR0FBRyxPQUFPLENBQUMsbUJBQW1CLENBQUMsd0JBQXdCLENBQUM7QUFDN0YsdUVBQXVFO0FBQ3ZFLE1BQU0sQ0FBQyxNQUFNLCtCQUErQixHQUFHLE9BQU8sQ0FBQyxtQkFBbUIsQ0FBQywrQkFBK0IsQ0FBQztBQWlCM0c7Ozs7R0FJRztBQUNILE1BQU0sQ0FBQyxNQUFNLGtDQUFrQyxHQUFHLE9BQU8sQ0FBQyxtQkFBbUIsQ0FBQywyQkFBMkIsQ0FBQztBQUMxRyxtRUFBbUU7QUFDbkUsTUFBTSxDQUFDLE1BQU0sOEJBQThCLEdBQUcsT0FBTyxDQUFDLG1CQUFtQixDQUFDLHVCQUF1QixDQUFDO0FBcUJsRzs7OztHQUlHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sOEJBQThCLEdBQUcsT0FBTyxDQUFDLGVBQWUsQ0FBQyw4QkFBOEIsQ0FBQztBQUNyRyxvREFBb0Q7QUFDcEQsTUFBTSxDQUFDLE1BQU0seUJBQXlCLEdBQUcsT0FBTyxDQUFDLGVBQWUsQ0FBQyx5QkFBeUIsQ0FBQztBQUUzRix5SEFBeUg7QUFDekgsTUFBTSxDQUFDLE1BQU0sb0JBQW9CLEdBQUcsT0FBTyxDQUFDLGlCQUFpQixDQUFDLG9CQUFvQixDQUFDO0FBQ25GLDBHQUEwRztBQUMxRyxNQUFNLENBQUMsTUFBTSx1QkFBdUIsR0FBRyxPQUFPLENBQUMsaUJBQWlCLENBQUMsdUJBQXVCLENBQUM7QUFFekYsa0hBQWtIO0FBQ2xILE1BQU0sQ0FBQyxNQUFNLHlCQUF5QixHQUFHLEdBQUcsQ0FBQztBQW1GN0MsdUZBQXVGO0FBQ3ZGLE1BQU0sQ0FBQyxNQUFNLDRCQUE0QixHQUFHLE9BQU8sQ0FBQyxtQkFBbUIsQ0FBQyw0QkFBNEIsQ0FBQyJ9
@@ -1,5 +1,5 @@
1
1
  import type { IReq_ControllerConfigurationResourceGet, IReq_ControllerConfigurationStateGet, IReq_ControllerConfigurationSummaryGet, IReq_ControllerConfigurationMasterGet, IReq_ControllerConfigurationMasterSave, IReq_ControllerConfigurationProject, IReq_ControllerConfigurationReview, IReq_ControllerConfigurationApply, IReq_ControllerConfigurationRestoreReview, IReq_ControllerConfigurationRestore, IReq_ControllerConfigurationTargetBind, IReq_ControllerConfigurationOperationRetry, IReq_ControllerConfigurationOperationRecover, IReq_ControllerConfigurationOperationAbandon, IReq_ControllerConfigurationOwnerIssue, IReq_ControllerConfigurationOwnerRevoke } from './requests.configuration.js';
2
- import type { IReq_ControllerAccountsAdd, IReq_ControllerAccountsDoctorGet, IReq_ControllerAccountsOperationCancel, IReq_ControllerAccountsOperationGet, IReq_ControllerAccountsPreuseCancel, IReq_ControllerAccountsPreuseGet, IReq_ControllerAccountsPreuseStart, IReq_ControllerAccountsReauth, IReq_ControllerAccountsRemove, IReq_ControllerAccountsRename, IReq_ControllerAccountsMaxUsage, IReq_ControllerAccountsReserveLift, IReq_ControllerAccountsApiKeyAdd, IReq_ControllerAccountsSpendLimit, IReq_ControllerAccountsClaudeCode, IReq_ControllerAccountsRenewal, IReq_ControllerAccountsSnapshot, IReq_ControllerAccountsUsageGet, IReq_ControllerAccountsUsageRecheck, IReq_ControllerAccountsClaudeHostGet, IReq_ControllerAccountsClaudeRelease, IReq_ControllerAccountsClaudeReleaseGet, IReq_ControllerAccountsClaudeRepair, IReq_ControllerAccountsClaudeSignInCancel, IReq_ControllerAccountsClaudeSignInGet, IReq_ControllerAccountsClaudeSignInStart, IReq_ControllerAccountsCodexAdopt, IReq_ControllerCodexAccountUse, IReq_ControllerAccountsCodexRelease } from './requests.accounts.js';
2
+ import type { IReq_ControllerAccountsAdd, IReq_ControllerAccountsDoctorGet, IReq_ControllerAccountsOperationCancel, IReq_ControllerAccountsOperationGet, IReq_ControllerAccountsPreuseCancel, IReq_ControllerAccountsPreuseGet, IReq_ControllerAccountsPreuseStart, IReq_ControllerAccountsReauth, IReq_ControllerAccountsRemove, IReq_ControllerAccountsRename, IReq_ControllerAccountsMaxUsage, IReq_ControllerAccountsReserveLift, IReq_ControllerAccountsApiKeyAdd, IReq_ControllerAccountsSpendLimit, IReq_ControllerAccountsClaudeCode, IReq_ControllerAccountsRenewal, IReq_ControllerAccountsPriority, IReq_ControllerAccountsSnapshot, IReq_ControllerAccountsUsageGet, IReq_ControllerAccountsUsageRecheck, IReq_ControllerAccountsClaudeHostGet, IReq_ControllerAccountsClaudeRelease, IReq_ControllerAccountsClaudeReleaseGet, IReq_ControllerAccountsClaudeRepair, IReq_ControllerAccountsClaudeSignInCancel, IReq_ControllerAccountsClaudeSignInGet, IReq_ControllerAccountsClaudeSignInStart, IReq_ControllerAccountsCodexAdopt, IReq_ControllerCodexAccountUse, IReq_ControllerAccountsCodexRelease } from './requests.accounts.js';
3
3
  import type { IReq_ControllerOpenCodeRestart, IReq_ControllerProxyStatusGet, IReq_ControllerRestart, IReq_ControllerStatus } from './requests.status.js';
4
4
  import type { IReq_ControllerDriverGet, IReq_ControllerDriverEnsure, IReq_ControllerDriverSeen } from './requests.driver.js';
5
5
  import type { IReq_ControllerFleetWorkerList, IReq_ControllerFleetWorkerRead, IReq_ControllerFleetWorkerSteer } from './requests.fleetworkers.js';
@@ -43,4 +43,4 @@ export * from './requests.browser.js';
43
43
  export * from './requests.terminal.js';
44
44
  export * from './requests.workspace.js';
45
45
  export * from './requests.events.js';
46
- export type TControllerRequest = IReq_ControllerConfigurationResourceGet | IReq_ControllerConfigurationStateGet | IReq_ControllerConfigurationSummaryGet | IReq_ControllerConfigurationMasterGet | IReq_ControllerConfigurationMasterSave | IReq_ControllerConfigurationProject | IReq_ControllerConfigurationReview | IReq_ControllerConfigurationApply | IReq_ControllerConfigurationRestoreReview | IReq_ControllerConfigurationRestore | IReq_ControllerConfigurationTargetBind | IReq_ControllerConfigurationOperationRetry | IReq_ControllerConfigurationOperationRecover | IReq_ControllerConfigurationOperationAbandon | IReq_ControllerConfigurationOwnerIssue | IReq_ControllerConfigurationOwnerRevoke | IReq_ControllerStatus | IReq_ControllerProxyStatusGet | IReq_ControllerOpenCodeRestart | IReq_ControllerRestart | IReq_ControllerDriverGet | IReq_ControllerDriverEnsure | IReq_ControllerDriverSeen | IReq_ControllerFleetWorkerList | IReq_ControllerFleetWorkerRead | IReq_ControllerFleetWorkerSteer | IReq_ControllerDirectReportList | IReq_ControllerDirectReportMessage | IReq_ControllerDirectReportRead | IReq_ControllerDirectReportPreflight | IReq_ControllerDirectReportAppoint | IReq_ControllerDirectReportAdopt | IReq_ControllerSessionFeedList | IReq_ControllerSessionFeedAcknowledge | TControllerDeployTypedRequest | IReq_ControllerNativeSessionRead | IReq_ControllerNativeSessionAuxiliaryGet | IReq_ControllerNativeSessionSend | IReq_ControllerNativeSessionScratchpadSave | IReq_ControllerNativeSessionIntelligenceAsk | IReq_ControllerNativeSessionPermissionReply | IReq_ControllerNativeSessionQuestionReply | IReq_ControllerNativeSessionElicitationReply | IReq_ControllerUsageWatch | IReq_ControllerUsageUnwatch | IReq_ControllerSystemMetrics | IReq_ControllerSystemMetricsHistory | IReq_ControllerFailureDetailGet | IReq_ControllerAuthState | IReq_ControllerSetupBegin | IReq_ControllerSetupFinish | IReq_ControllerAuthenticationBegin | IReq_ControllerAuthenticationFinish | IReq_ControllerTempPasswordLogin | IReq_ControllerAuthResume | IReq_ControllerAuthHandoff | IReq_ControllerAuthSignout | IReq_ControllerProjectList | IReq_ControllerProjectCreate | IReq_ControllerProjectRemove | IReq_ControllerProjectRemovalRetry | IReq_ControllerProjectAgentMessagesUpdate | IReq_ControllerProjectSuggest | IReq_ControllerProviderConnectionList | IReq_ControllerProviderModelRefreshBegin | IReq_ControllerProviderModelRefreshGet | IReq_ControllerSlashList | IReq_ControllerSlashExecute | IReq_ControllerModelList | IReq_ControllerSettingsGet | IReq_ControllerSettingsUpdate | IReq_ControllerConversationList | IReq_ControllerConversationSearch | IReq_ControllerConversationOpen | IReq_ControllerConversationArchive | IReq_ControllerConversationReopen | IReq_ControllerSessionGet | IReq_ControllerSessionChildGet | IReq_ControllerSessionChildStatusGet | IReq_ControllerFlexChildGet | IReq_ControllerCodexChildGet | IReq_ControllerSessionChildMessagesPage | IReq_ControllerSessionChildMessageGet | IReq_ControllerSessionChildPermissionReply | IReq_ControllerSessionChildQuestionReply | IReq_ControllerSessionAuxiliaryGet | IReq_ControllerSessionModelUpdate | IReq_ControllerSessionScratchpadSave | IReq_ControllerSessionIntelligenceAsk | IReq_ControllerSessionMessagesPage | IReq_ControllerSessionMessageGet | IReq_ControllerSessionCreate | IReq_ControllerSessionDelete | IReq_ControllerSessionDiscardEmpty | IReq_ControllerSessionDraftGet | IReq_ControllerSessionDraftUpdate | IReq_ControllerSessionSend | import('./codex.js').IReq_ControllerCodexRestart | import('./codex.js').IReq_ControllerCodexWriterUpdate | import('./codex.js').IReq_ControllerCodexModeUpdate | import('./codex.js').IReq_ControllerCodexProfilesList | import('./codex.js').IReq_ControllerCodexAccountProfile | import('./codex.js').IReq_ControllerCodexProfileCreate | import('./codex.js').IReq_ControllerCodexProfileUpdate | import('./codex.js').IReq_ControllerCodexProfileTest | import('./codex.js').IReq_ControllerCodexMappingUpdate | import('./codex.js').IReq_ControllerCodexThreadsList | import('./codex.js').IReq_ControllerCodexThreadEnroll | IReq_ControllerSessionAbort | IReq_ControllerSessionHarnessRestart | IReq_ControllerSessionCompactionUpdate | IReq_ControllerSessionLimitResumeUpdate | IReq_ControllerSessionPromptQueueRelease | IReq_ControllerSessionHeldPromptRelease | IReq_ControllerSessionPendingPromptAction | IReq_ControllerPermissionReply | IReq_ControllerQuestionReply | IReq_ControllerElicitationReply | IReq_ControllerSessionRename | IReq_ControllerSessionArchive | IReq_ControllerSessionGroupsGet | IReq_ControllerSessionGroupsUpdate | IReq_ControllerSessionYolo | IReq_ControllerResourceList | IReq_ControllerResourceCreate | IReq_ControllerResourceRename | IReq_ControllerResourceAttach | IReq_ControllerResourceDetach | IReq_ControllerResourceRetire | IReq_ControllerResourceStart | IReq_ControllerResourceStop | IReq_ControllerBrowserViewOpen | IReq_ControllerBrowserViewActivate | IReq_ControllerBrowserViewRecover | IReq_ControllerBrowserViewClose | IReq_ControllerBrowserDevToolsOpen | IReq_ControllerBrowserDevToolsClose | IReq_ControllerBrowserPaintOpen | IReq_ControllerBrowserPaintClose | IReq_ControllerBrowserAudioOpen | IReq_ControllerBrowserAudioClose | IReq_ControllerBrowserPaintRearm | IReq_ControllerBrowserAssetsGet | IReq_ControllerBrowserPaintVideoRouteOpen | IReq_ControllerTerminalList | IReq_ControllerTerminalCreate | IReq_ControllerTerminalRename | IReq_ControllerTerminalRemove | IReq_ControllerTerminalAttach | IReq_ControllerTerminalDetach | IReq_ControllerTerminalInput | IReq_ControllerTerminalResize | IReq_ControllerWorkspaceList | IReq_ControllerWorkspaceStat | IReq_ControllerWorkspaceRead | IReq_ControllerWorkspaceWrite | IReq_ControllerWorkspaceMkdir | IReq_ControllerWorkspaceRemove | IReq_ControllerWorkspaceRename | IReq_ControllerWorkspaceCopy | IReq_ControllerWorkspaceWatch | IReq_ControllerWorkspaceUnwatch | IReq_ControllerWorkspaceBaseSet | IReq_ControllerTerminalOutput | IReq_ControllerTerminalDetached | IReq_ControllerWorkspaceChanged | IReq_ControllerAccountsSnapshot | IReq_ControllerAccountsRename | IReq_ControllerAccountsMaxUsage | IReq_ControllerAccountsReserveLift | IReq_ControllerAccountsApiKeyAdd | IReq_ControllerAccountsSpendLimit | IReq_ControllerAccountsClaudeCode | IReq_ControllerAccountsRenewal | IReq_ControllerAccountsRemove | IReq_ControllerAccountsAdd | IReq_ControllerAccountsReauth | IReq_ControllerAccountsOperationGet | IReq_ControllerAccountsOperationCancel | IReq_ControllerAccountsUsageGet | IReq_ControllerAccountsUsageRecheck | IReq_ControllerAccountsPreuseStart | IReq_ControllerAccountsPreuseGet | IReq_ControllerAccountsPreuseCancel | IReq_ControllerAccountsDoctorGet | IReq_ControllerAccountsClaudeSignInStart | IReq_ControllerAccountsClaudeSignInGet | IReq_ControllerAccountsClaudeSignInCancel | IReq_ControllerAccountsClaudeHostGet | IReq_ControllerAccountsClaudeRelease | IReq_ControllerAccountsClaudeReleaseGet | IReq_ControllerAccountsClaudeRepair | IReq_ControllerCodexAccountUse | IReq_ControllerAccountsCodexRelease | IReq_ControllerAccountsCodexAdopt | IReq_ControllerDevicesList | IReq_ControllerDevicesPairingBegin | IReq_ControllerDevicesPairingCancel | IReq_ControllerDevicesRevoke | IReq_ControllerInboxList | import('./requests.tickets.js').TControllerTicketTypedRequest | IReq_ControllerEvent | IReq_ControllerSessionChildEvent;
46
+ export type TControllerRequest = IReq_ControllerConfigurationResourceGet | IReq_ControllerConfigurationStateGet | IReq_ControllerConfigurationSummaryGet | IReq_ControllerConfigurationMasterGet | IReq_ControllerConfigurationMasterSave | IReq_ControllerConfigurationProject | IReq_ControllerConfigurationReview | IReq_ControllerConfigurationApply | IReq_ControllerConfigurationRestoreReview | IReq_ControllerConfigurationRestore | IReq_ControllerConfigurationTargetBind | IReq_ControllerConfigurationOperationRetry | IReq_ControllerConfigurationOperationRecover | IReq_ControllerConfigurationOperationAbandon | IReq_ControllerConfigurationOwnerIssue | IReq_ControllerConfigurationOwnerRevoke | IReq_ControllerStatus | IReq_ControllerProxyStatusGet | IReq_ControllerOpenCodeRestart | IReq_ControllerRestart | IReq_ControllerDriverGet | IReq_ControllerDriverEnsure | IReq_ControllerDriverSeen | IReq_ControllerFleetWorkerList | IReq_ControllerFleetWorkerRead | IReq_ControllerFleetWorkerSteer | IReq_ControllerDirectReportList | IReq_ControllerDirectReportMessage | IReq_ControllerDirectReportRead | IReq_ControllerDirectReportPreflight | IReq_ControllerDirectReportAppoint | IReq_ControllerDirectReportAdopt | IReq_ControllerSessionFeedList | IReq_ControllerSessionFeedAcknowledge | TControllerDeployTypedRequest | IReq_ControllerNativeSessionRead | IReq_ControllerNativeSessionAuxiliaryGet | IReq_ControllerNativeSessionSend | IReq_ControllerNativeSessionScratchpadSave | IReq_ControllerNativeSessionIntelligenceAsk | IReq_ControllerNativeSessionPermissionReply | IReq_ControllerNativeSessionQuestionReply | IReq_ControllerNativeSessionElicitationReply | IReq_ControllerUsageWatch | IReq_ControllerUsageUnwatch | IReq_ControllerSystemMetrics | IReq_ControllerSystemMetricsHistory | IReq_ControllerFailureDetailGet | IReq_ControllerAuthState | IReq_ControllerSetupBegin | IReq_ControllerSetupFinish | IReq_ControllerAuthenticationBegin | IReq_ControllerAuthenticationFinish | IReq_ControllerTempPasswordLogin | IReq_ControllerAuthResume | IReq_ControllerAuthHandoff | IReq_ControllerAuthSignout | IReq_ControllerProjectList | IReq_ControllerProjectCreate | IReq_ControllerProjectRemove | IReq_ControllerProjectRemovalRetry | IReq_ControllerProjectAgentMessagesUpdate | IReq_ControllerProjectSuggest | IReq_ControllerProviderConnectionList | IReq_ControllerProviderModelRefreshBegin | IReq_ControllerProviderModelRefreshGet | IReq_ControllerSlashList | IReq_ControllerSlashExecute | IReq_ControllerModelList | IReq_ControllerSettingsGet | IReq_ControllerSettingsUpdate | IReq_ControllerConversationList | IReq_ControllerConversationSearch | IReq_ControllerConversationOpen | IReq_ControllerConversationArchive | IReq_ControllerConversationReopen | IReq_ControllerSessionGet | IReq_ControllerSessionChildGet | IReq_ControllerSessionChildStatusGet | IReq_ControllerFlexChildGet | IReq_ControllerCodexChildGet | IReq_ControllerSessionChildMessagesPage | IReq_ControllerSessionChildMessageGet | IReq_ControllerSessionChildPermissionReply | IReq_ControllerSessionChildQuestionReply | IReq_ControllerSessionAuxiliaryGet | IReq_ControllerSessionModelUpdate | IReq_ControllerSessionScratchpadSave | IReq_ControllerSessionIntelligenceAsk | IReq_ControllerSessionMessagesPage | IReq_ControllerSessionMessageGet | IReq_ControllerSessionCreate | IReq_ControllerSessionDelete | IReq_ControllerSessionDiscardEmpty | IReq_ControllerSessionDraftGet | IReq_ControllerSessionDraftUpdate | IReq_ControllerSessionSend | import('./codex.js').IReq_ControllerCodexRestart | import('./codex.js').IReq_ControllerCodexWriterUpdate | import('./codex.js').IReq_ControllerCodexModeUpdate | import('./codex.js').IReq_ControllerCodexProfilesList | import('./codex.js').IReq_ControllerCodexAccountProfile | import('./codex.js').IReq_ControllerCodexProfileCreate | import('./codex.js').IReq_ControllerCodexProfileUpdate | import('./codex.js').IReq_ControllerCodexProfileTest | import('./codex.js').IReq_ControllerCodexMappingUpdate | import('./codex.js').IReq_ControllerCodexThreadsList | import('./codex.js').IReq_ControllerCodexThreadEnroll | IReq_ControllerSessionAbort | IReq_ControllerSessionHarnessRestart | IReq_ControllerSessionCompactionUpdate | IReq_ControllerSessionLimitResumeUpdate | IReq_ControllerSessionPromptQueueRelease | IReq_ControllerSessionHeldPromptRelease | IReq_ControllerSessionPendingPromptAction | IReq_ControllerPermissionReply | IReq_ControllerQuestionReply | IReq_ControllerElicitationReply | IReq_ControllerSessionRename | IReq_ControllerSessionArchive | IReq_ControllerSessionGroupsGet | IReq_ControllerSessionGroupsUpdate | IReq_ControllerSessionYolo | IReq_ControllerResourceList | IReq_ControllerResourceCreate | IReq_ControllerResourceRename | IReq_ControllerResourceAttach | IReq_ControllerResourceDetach | IReq_ControllerResourceRetire | IReq_ControllerResourceStart | IReq_ControllerResourceStop | IReq_ControllerBrowserViewOpen | IReq_ControllerBrowserViewActivate | IReq_ControllerBrowserViewRecover | IReq_ControllerBrowserViewClose | IReq_ControllerBrowserDevToolsOpen | IReq_ControllerBrowserDevToolsClose | IReq_ControllerBrowserPaintOpen | IReq_ControllerBrowserPaintClose | IReq_ControllerBrowserAudioOpen | IReq_ControllerBrowserAudioClose | IReq_ControllerBrowserPaintRearm | IReq_ControllerBrowserAssetsGet | IReq_ControllerBrowserPaintVideoRouteOpen | IReq_ControllerTerminalList | IReq_ControllerTerminalCreate | IReq_ControllerTerminalRename | IReq_ControllerTerminalRemove | IReq_ControllerTerminalAttach | IReq_ControllerTerminalDetach | IReq_ControllerTerminalInput | IReq_ControllerTerminalResize | IReq_ControllerWorkspaceList | IReq_ControllerWorkspaceStat | IReq_ControllerWorkspaceRead | IReq_ControllerWorkspaceWrite | IReq_ControllerWorkspaceMkdir | IReq_ControllerWorkspaceRemove | IReq_ControllerWorkspaceRename | IReq_ControllerWorkspaceCopy | IReq_ControllerWorkspaceWatch | IReq_ControllerWorkspaceUnwatch | IReq_ControllerWorkspaceBaseSet | IReq_ControllerTerminalOutput | IReq_ControllerTerminalDetached | IReq_ControllerWorkspaceChanged | IReq_ControllerAccountsSnapshot | IReq_ControllerAccountsRename | IReq_ControllerAccountsMaxUsage | IReq_ControllerAccountsReserveLift | IReq_ControllerAccountsApiKeyAdd | IReq_ControllerAccountsSpendLimit | IReq_ControllerAccountsClaudeCode | IReq_ControllerAccountsRenewal | IReq_ControllerAccountsPriority | IReq_ControllerAccountsRemove | IReq_ControllerAccountsAdd | IReq_ControllerAccountsReauth | IReq_ControllerAccountsOperationGet | IReq_ControllerAccountsOperationCancel | IReq_ControllerAccountsUsageGet | IReq_ControllerAccountsUsageRecheck | IReq_ControllerAccountsPreuseStart | IReq_ControllerAccountsPreuseGet | IReq_ControllerAccountsPreuseCancel | IReq_ControllerAccountsDoctorGet | IReq_ControllerAccountsClaudeSignInStart | IReq_ControllerAccountsClaudeSignInGet | IReq_ControllerAccountsClaudeSignInCancel | IReq_ControllerAccountsClaudeHostGet | IReq_ControllerAccountsClaudeRelease | IReq_ControllerAccountsClaudeReleaseGet | IReq_ControllerAccountsClaudeRepair | IReq_ControllerCodexAccountUse | IReq_ControllerAccountsCodexRelease | IReq_ControllerAccountsCodexAdopt | IReq_ControllerDevicesList | IReq_ControllerDevicesPairingBegin | IReq_ControllerDevicesPairingCancel | IReq_ControllerDevicesRevoke | IReq_ControllerInboxList | import('./requests.tickets.js').TControllerTicketTypedRequest | IReq_ControllerEvent | IReq_ControllerSessionChildEvent;
@@ -18,4 +18,4 @@ export * from './requests.browser.js';
18
18
  export * from './requests.terminal.js';
19
19
  export * from './requests.workspace.js';
20
20
  export * from './requests.events.js';
21
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVxdWVzdHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90c19pbnRlcmZhY2VzL3JlcXVlc3RzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQTJOQSxvRkFBb0Y7QUFDcEYsbUVBQW1FO0FBQ25FLGNBQWMsc0JBQXNCLENBQUM7QUFDckMsY0FBYyx1QkFBdUIsQ0FBQztBQUN0QyxjQUFjLG9CQUFvQixDQUFDO0FBQ25DLGNBQWMsMkJBQTJCLENBQUM7QUFDMUMsY0FBYyx1QkFBdUIsQ0FBQztBQUN0QyxjQUFjLHFCQUFxQixDQUFDO0FBQ3BDLGNBQWMsd0JBQXdCLENBQUM7QUFDdkMsY0FBYyxxQkFBcUIsQ0FBQztBQUNwQyxjQUFjLHdCQUF3QixDQUFDO0FBQ3ZDLGNBQWMsNkJBQTZCLENBQUM7QUFDNUMsY0FBYyw0QkFBNEIsQ0FBQztBQUMzQyxjQUFjLHVCQUF1QixDQUFDO0FBQ3RDLGNBQWMsMkJBQTJCLENBQUM7QUFDMUMsY0FBYyx3QkFBd0IsQ0FBQztBQUN2QyxjQUFjLHVCQUF1QixDQUFDO0FBQ3RDLGNBQWMsd0JBQXdCLENBQUM7QUFDdkMsY0FBYyx5QkFBeUIsQ0FBQztBQUN4QyxjQUFjLHNCQUFzQixDQUFDIn0=
21
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVxdWVzdHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90c19pbnRlcmZhY2VzL3JlcXVlc3RzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQTROQSxvRkFBb0Y7QUFDcEYsbUVBQW1FO0FBQ25FLGNBQWMsc0JBQXNCLENBQUM7QUFDckMsY0FBYyx1QkFBdUIsQ0FBQztBQUN0QyxjQUFjLG9CQUFvQixDQUFDO0FBQ25DLGNBQWMsMkJBQTJCLENBQUM7QUFDMUMsY0FBYyx1QkFBdUIsQ0FBQztBQUN0QyxjQUFjLHFCQUFxQixDQUFDO0FBQ3BDLGNBQWMsd0JBQXdCLENBQUM7QUFDdkMsY0FBYyxxQkFBcUIsQ0FBQztBQUNwQyxjQUFjLHdCQUF3QixDQUFDO0FBQ3ZDLGNBQWMsNkJBQTZCLENBQUM7QUFDNUMsY0FBYyw0QkFBNEIsQ0FBQztBQUMzQyxjQUFjLHVCQUF1QixDQUFDO0FBQ3RDLGNBQWMsMkJBQTJCLENBQUM7QUFDMUMsY0FBYyx3QkFBd0IsQ0FBQztBQUN2QyxjQUFjLHVCQUF1QixDQUFDO0FBQ3RDLGNBQWMsd0JBQXdCLENBQUM7QUFDdkMsY0FBYyx5QkFBeUIsQ0FBQztBQUN4QyxjQUFjLHNCQUFzQixDQUFDIn0=
@@ -326,6 +326,8 @@ authswitch account set <account-id> --max-usage <percent> [--json]
326
326
  authswitch account set <account-id> --clear [--json]
327
327
  authswitch account set <account-id> --lapses-at <date-time> [--json]
328
328
  authswitch account set <account-id> --clear-lapse [--json]
329
+ authswitch account set <account-id> --priority [--json]
330
+ authswitch account set <account-id> --clear-priority [--json]
329
331
  authswitch account set <account-id> --spend-limit <dollars> [--json]
330
332
  authswitch account set <account-id> --clear-spend-limit [--json]
331
333
  authswitch account set <account-id> --claude-code on|off [--json]
@@ -465,6 +467,29 @@ limit row). The account record holds `renewsAt` only while it is set; clearing i
465
467
  never had one is the record an earlier service reads. An earlier service refuses the store while any account holds a
466
468
  renewal: clear every renewal (`authswitch account set <id> --clear-renewal`) before downgrading.
467
469
 
470
+ `account set --priority` gives an account the owner's priority (AGL-1809) for 24 hours, at the revision `account list`
471
+ reads just before (`authswitch.authority.priority { accountId, expectedRevision, priority }`,
472
+ `AuthSwitchClient.setAccountPriority`); `--clear-priority` ends it. The service sets its end, its own clock plus
473
+ `authSwitchPriorityMs` (`ts_authswitch/authority-priority.ts`), and stores it as `priorityUntil` in UTC; giving it to an
474
+ account that holds it starts the 24 hours again. Any account can hold one -- a ChatGPT or Claude sign-in, an OpenAI or
475
+ Anthropic API key -- and several at once; a stale revision is refused as `account_changed`. It ends by itself: a reader
476
+ judges it against its own clock (`authSwitchPriorityActive`, strictly before the end), so one whose end passed reads as
477
+ none everywhere, with nothing run at that moment. While it holds, the AGL proxy places a new session on the account
478
+ before any account of its pool without one, as long as the account takes the request (`authSwitchPlacementOrder`, and
479
+ across credential tiers the proxy's own order): one at its limit or reserve -- a priority lifts no `maxUsagePercent`
480
+ --, resting after a 429, lapsed or without the model is passed over, and among several priority accounts the usual
481
+ order decides. A session already running stays on its account, except that a session on an API key returns to a sign-in
482
+ of the better tier as on any key: while the key holds priority only to a sign-in that has priority too, and at its
483
+ first request once the key's priority ended to any that takes the request. `account set` and `account list` print it while it holds
484
+ (`priority until <ISO> (set by the owner)`); `list` and `limits` show `priority until 14:05 (set by the owner)` in local
485
+ time, with the date on another day (`--json`: `priorityUntil`, the end while it holds or null, on the overview and each
486
+ limit row; `account list --json` carries the stored end as `priorityUntil`). The account record holds `priorityUntil`
487
+ only while it is set: ending it removes the member, and so does the account's first write after its end passed or its
488
+ removal (`AuthSwitchAuthorityDatabase.persistAccount`, judged at the write's `statusObservedAt`). An earlier service
489
+ refuses the store while any account record holds one: run `authswitch account set <id> --clear-priority` on every
490
+ account before downgrading, since a priority that ended is listed nowhere, yet its record keeps it until the account's
491
+ next change.
492
+
468
493
  A Claude account's reading states what its profile says of the subscription as facts (`summaryKey: 'subscription'`):
469
494
  `Subscription status` -- `organization.subscription_status` as received, then what it means from the one shared map
470
495
  (`authority-subscription.ts`, empty: no value is described yet, so each shows `(not described yet)`) -- and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agl",
3
- "version": "43.6.0",
3
+ "version": "43.7.0",
4
4
  "controllerUpgradeManagementVersion": 2,
5
5
  "controllerManagementProtocolVersion": 1,
6
6
  "controllerGatewaySourcesVersion": 1,
package/readme.md CHANGED
@@ -129,6 +129,7 @@ authswitch account list # the stored records, with the ids the account comman
129
129
  authswitch account set <account-id> --max-usage 80 # keep 20% of each usage window for use outside AGL
130
130
  authswitch account set <account-id> --lapses-at 2026-11-01T00:00:00Z # a canceled subscription ends then
131
131
  authswitch account set <account-id> --renews-at 2026-10-20T09:00:00Z # a Claude subscription renews monthly from then
132
+ authswitch account set <account-id> --priority # use this account before any other for 24 hours (--clear-priority ends it)
132
133
  authswitch account recheck <account-id> # read a Claude account now; a healthy read clears its payment problem
133
134
  authswitch --help
134
135
  ```
@@ -196,6 +197,25 @@ usage windows at a renewal is not known. `authswitch list`, `limits` and `accoun
196
197
  (`renews in 9d 4h (set by the owner)`; `--json`: `renewal { at, source: 'manual' }`), and `agl proxy status` too.
197
198
  Any other account is refused one.
198
199
 
200
+ Any account can be given **priority**, to be used up before anything else: for 24 hours from when it was given, or
201
+ until the owner turns it off, the proxy places a new session on it before any account of its pool without priority, as
202
+ long as it takes the request -- one at its limit, at its reserve (a priority lifts no maximum usage), resting after a
203
+ provider 429, lapsed or without the model is passed over, and the other accounts take the session then. Several accounts
204
+ can have it at once; among them placement decides as it always does (below). A session already running stays where it
205
+ is: giving an account priority moves nothing to it, and its end moves no session between accounts, except that a
206
+ session on an API key returns to a sign-in of the better tier that can take its request, as a session on any key does,
207
+ at its first request once the key's priority ended; while the key holds priority, it returns only to a sign-in that has
208
+ priority too. `authswitch account set <account-id> --priority` gives it, again restarts the 24 hours, and `--clear-priority` ends it
209
+ (`authswitch.authority.priority`); the account's page in Settings → Accounts has **Give priority**, then **Restart 24
210
+ hours** and **Turn off** (`controller.accounts.priority`, audited `accounts.priority`). The accounts service sets the
211
+ end by its own clock and keeps it on the account (`priorityUntil`), and every reader judges it against its own clock,
212
+ so it ends by itself with nothing run at its end. The account's row says `priority until 14:05` in the browser's time
213
+ (`tomorrow 14:05` on the next day), as does its page beside its actions; `authswitch list`, `limits` and `account list`
214
+ and `agl proxy status` show it too (`--json`: `priorityUntil`, null without one or once it ended). The account record
215
+ holds it only while it is set; an earlier accounts service refuses the store while any account record holds one, so run
216
+ `authswitch account set <id> --clear-priority` on every account before downgrading: a priority that ran out is listed
217
+ nowhere, yet its record keeps it until the account's next change.
218
+
199
219
  Flex uses every OpenAI account the service holds with a login of its own: each is the Flex connection `flex:authority:<accountId>`, listed wherever Flex accounts are chosen. Flex keeps no login of its own.
200
220
 
201
221
  A Flex session on a ChatGPT account runs through AGL's inference proxy, on the controller's lease of that one account's pool (proxy client `flex`, policy `accountIds: [<accountId>]`): the account the session chose serves it, and the proxy authenticates as the account, applies its maximum usage and limits, and counts every answer's tokens in the [token usage](#token-usage) under the client `flex`. At the account's limit the run reports the limit and its reset; it never moves to another account. The account's model catalog is read by the proxy on that account too. The Flex child is given only the proxy's address and the lease credential, never an account token. When the proxy is not running, a Flex request on a ChatGPT account fails with `INFERENCE_PROXY_UNAVAILABLE`; there is no direct route to ChatGPT. An account whose access ChatGPT keeps rejecting, or the accounts service cannot renew, fails with `PROVIDER_REAUTH_REQUIRED`, repaired by signing it in again in **Settings → Accounts**. Removing an account ends the controller's lease of it at once.
@@ -401,8 +421,9 @@ none shows as unavailable), so a pool no request used since the proxy started is
401
421
  find it -- naming as of when, whether its
402
422
  newest values came from provider answers or the account service's own read, whether a window is estimated since, and
403
423
  whether the service's last read was rate-limited -- with its lifecycle (canceled with its lapse date, or lapsed), its
404
- placement score and its rank for the next new session, and the next renewal its owner set (`--json`: `lifecycle`,
405
- `lapsesAt`, `renewal { at, source: 'manual' }` or null, `placementScore`, `placementRank`, `lastResort`; an OpenAI or Anthropic API key shows its month in place of a maximum usage, as of when
424
+ placement score and its rank for the next new session, and the priority and next renewal its owner set (`--json`:
425
+ `lifecycle`, `lapsesAt`, `priorityUntil` (the end of the account's priority while it holds) or null, `renewal { at,
426
+ source: 'manual' }` or null, `placementScore`, `placementRank`, `lastResort`; an OpenAI or Anthropic API key shows its month in place of a maximum usage, as of when
406
427
  the account service read its spend: `available ($12.40 of $50.00 this month)` with what is left of its limit as its
407
428
  headroom and placement score, `available ($3.20 this month, no spend limit)` with neither, `at its spend limit` (or
408
429
  `held until its month ends`, for an answer that could not be priced) with the month's end -- the month counts the
@@ -552,7 +573,8 @@ counts only on an account without a lapse date) -- and at least one hour; a wind
552
573
  serves now (`score / (1 + in flight)`), so new sessions spread over the accounts in proportion to what each can spend:
553
574
  quota that resets soon, or is lost when the account lapses, is used first -- as is quota an account would still hold at
554
575
  its renewal, when its window resets after it -- and an account that resets in days is spared. An account that lapses within a day comes after every other, and an account without a counted window after
555
- every scored one. Within the client's pool, only current quota exhaustion, a definite provider HTTP 429 before
576
+ every scored one. Before all of this, an account the owner gave priority (above) comes before every account without one,
577
+ of any credential tier, as long as it takes the request; among several priority accounts this order decides. Within the client's pool, only current quota exhaustion, a definite provider HTTP 429 before
556
578
  forwarding output, the account lapsing or leaving the pool, or a Claude account taking no request for a reason of its
557
579
  own (below) permits moving the session to another eligible account.
558
580
  The proxy records every session it places and every move, with why (`new`, `exhausted`, `reserved`, `cooling`,
@@ -597,10 +619,12 @@ allowed in its pool.
597
619
  A Claude pool whose client names no credential -- Claude Code's own lease, `agl proxy run claude` and the `claude`
598
620
  client -- is served by its Claude accounts first and by the Anthropic API keys only when no Claude account can take a
599
621
  request, for whatever reason: every one at its limit or reserve, cooling down, without a usage reading, model list or
600
- access, or with a payment problem. A new session then goes to the key with the most of its monthly spend limit left
622
+ access, or with a payment problem -- unless a key has the owner's priority, which puts it before every Claude account
623
+ without one. A new session then goes to the key with the most of its monthly spend limit left
601
624
  for the requests in flight on it, the keys without a limit after those with one and the least busy of them first, and
602
625
  a session on a Claude account moves to one at its next request. A session on a key returns to a Claude account at the
603
- next request one can take (`returned` in the placement journal), with no waiting period; Claude Code's request reaches
626
+ next request one can take (`returned` in the placement journal), with no waiting period -- a session on a key with
627
+ priority only to a Claude account with priority, since a new session would go to the key first; Claude Code's request reaches
604
628
  the key unchanged, as it reaches an account (thinking signatures carry; the prompt cache starts cold). `count_tokens` never moves a session. A key at its
605
629
  monthly spend limit takes nothing until the month ends, and a key with a limit whose spend could not be read takes
606
630
  nothing until it can (see [API keys and their spend limit](#api-keys-and-their-spend-limit)). When every Claude account
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: 'agl',
6
- version: '43.6.0',
6
+ version: '43.7.0',
7
7
  description: 'Agent Gateway Layer for OpenCode, FlexHarness, and Codex sessions'
8
8
  }
@@ -29,6 +29,7 @@ import type {
29
29
  IReq_ControllerAccountsSpendLimit,
30
30
  IReq_ControllerAccountsClaudeCode,
31
31
  IReq_ControllerAccountsRenewal,
32
+ IReq_ControllerAccountsPriority,
32
33
  IReq_ControllerAccountsUsageGet,
33
34
  IReq_ControllerAccountsUsageRecheck,
34
35
  TControllerAccountBinding,
@@ -256,6 +257,18 @@ export class AccountsActions {
256
257
  }));
257
258
  },
258
259
  );
260
+ routerArg.addHandler<IReq_ControllerAccountsPriority>(
261
+ 'controller.accounts.priority',
262
+ async (requestArg, toolsArg) => {
263
+ const request = assertRequestShape(requestArg, {
264
+ accountId: 'string', expectedRevision: 'number', priority: 'boolean',
265
+ }) as IReq_ControllerAccountsPriority['request'];
266
+ // The audit names the action and the peer; the end is the account's, which the accounts service journals.
267
+ return hostArg.runAudited(toolsArg?.localData, 'accounts.priority', async (signalArg) => ({
268
+ answer: await this.setPriority(request, signalArg),
269
+ }));
270
+ },
271
+ );
259
272
  routerArg.addHandler<IReq_ControllerAccountsRemove>(
260
273
  'controller.accounts.remove',
261
274
  async (requestArg, toolsArg) => {
@@ -559,6 +572,18 @@ export class AccountsActions {
559
572
  return answer;
560
573
  }
561
574
 
575
+ /** Gives an account the owner's priority for 24 hours, or ends it, and answers once the projection shows it. */
576
+ public async setPriority(
577
+ requestArg: IReq_ControllerAccountsPriority['request'],
578
+ signalArg: AbortSignal,
579
+ ): Promise<TControllerAccountsAnswer<plugins.authswitchAuthority.IAuthSwitchAccount>> {
580
+ const answer = await this.answer((clientArg) => clientArg.setAccountPriority(
581
+ requestArg.accountId, requestArg.expectedRevision, requestArg.priority, signalArg,
582
+ ));
583
+ if (answer.state === 'done') await this.waitForAccountRevision(answer.value, signalArg);
584
+ return answer;
585
+ }
586
+
562
587
  /** Waits until the controller's projection shows the account at `accountArg`'s revision or later. */
563
588
  private async waitForAccountRevision(
564
589
  accountArg: plugins.authswitchAuthority.IAuthSwitchAccount,
@@ -21429,9 +21429,9 @@ export class OpenCodeController {
21429
21429
 
21430
21430
  /**
21431
21431
  * The usable Flex accounts in the order AGL's account placement takes a new conversation now
21432
- * (`authSwitchPlacementOrder`), judged on each account's usage reading as the inference proxy
21433
- * judges it: an account at its limit or reserve, lapsed, or without a reading it can be judged on
21434
- * takes none. A conversation keeps its account for its life, so accounts rank by their score and
21432
+ * (`authSwitchPlacementOrder`, a priority account first), judged on each account's usage reading as
21433
+ * the inference proxy judges it: an account at its limit or reserve, lapsed, or without a reading it
21434
+ * can be judged on takes none. A conversation keeps its account for its life, so accounts rank by their score and
21435
21435
  * headroom alone, with none counted as in flight. The Claude pool, which the proxy places inside,
21436
21436
  * comes last.
21437
21437
  */
@@ -21476,6 +21476,7 @@ export class OpenCodeController {
21476
21476
  if (placement.eligibility === 'never') return undefined;
21477
21477
  return {
21478
21478
  id: providerConnectionId,
21479
+ priority: plugins.authswitchPriority.authSwitchPriorityActive(account.priorityUntil, now),
21479
21480
  score: placement.score,
21480
21481
  lastResort: placement.eligibility === 'last_resort',
21481
21482
  headroom: limit.headroom ?? 0,
@@ -83,6 +83,12 @@ export interface IInferenceAccount {
83
83
  * without one. Placement only: a window's usage counts as spent by the next renewal (`authSwitchPlacement`).
84
84
  */
85
85
  renewsAt: string | null;
86
+ /**
87
+ * When the owner's priority on the account ends (`IAuthSwitchAccount.priorityUntil`, AGL-1809); `null` without one.
88
+ * While it holds at the moment of placing (`authSwitchPriorityActive`), a new session goes to the account before any
89
+ * account of the pool without one, as long as it takes the request (`inferencePlacementOrder`).
90
+ */
91
+ priorityUntil: string | null;
86
92
  /**
87
93
  * An API key's monthly spend limit in micro-dollars (`IAuthSwitchAccount.spendLimitMicroUsd`); `null` without one,
88
94
  * and for a sign-in. It decides only whether a key whose spend the proxy holds no reading of may take work: one with
@@ -745,6 +751,11 @@ export interface IInferenceAccountStatus {
745
751
  * without one. Placement ignores it while the account has a lapse date. A proxy of an earlier AGL reports none.
746
752
  */
747
753
  renewal?: plugins.authswitchRenewal.IAuthSwitchRenewal | null;
754
+ /**
755
+ * When the owner's priority on the account ends, while it holds now (`IInferenceAccount.priorityUntil`), or `null`: the
756
+ * account ranks before every account without one. A proxy of an earlier AGL reports none.
757
+ */
758
+ priorityUntil?: string | null;
748
759
  /** The account's placement score in percent per hour (`IAuthSwitchPlacement.score`); `null` without a counted window. */
749
760
  placementScore: number | null;
750
761
  /**
@@ -979,6 +990,23 @@ const accountPlacement = (readingArg: plugins.authswitchAuthority.IAuthSwitchUsa
979
990
  plugins.authswitchPlacement.authSwitchPlacement(readingArg, accountArg.maxUsagePercent, accountArg.lapsesAt,
980
991
  accountArg.renewsAt, nowArg, accountArg.reserveLiftUntil);
981
992
 
993
+ /** An account of a pool as a new session is placed on it: its credential tier and its rank (`IAuthSwitchPlacementRank`). */
994
+ interface IInferencePlacementEntry {
995
+ tier: number;
996
+ rank: plugins.authswitchPlacement.IAuthSwitchPlacementRank;
997
+ }
998
+
999
+ /**
1000
+ * The order a new session is placed in across a pool's credential tiers (`inferenceCredentialTiers`): an account with its
1001
+ * owner's priority (AGL-1809) before any without one, whatever its tier -- the owner chose it to be used first -- then the
1002
+ * better tier, then the placement order (`authSwitchPlacementOrder`), which decides among several priority accounts too.
1003
+ */
1004
+ const inferencePlacementOrder = (inFlightArg: (accountIdArg: string) => number) => {
1005
+ const order = plugins.authswitchPlacement.authSwitchPlacementOrder(inFlightArg);
1006
+ return (left: IInferencePlacementEntry, right: IInferencePlacementEntry): number =>
1007
+ Number(right.rank.priority) - Number(left.rank.priority) || left.tier - right.tier || order(left.rank, right.rank);
1008
+ };
1009
+
982
1010
  /** Model-preserving account selection. Refresh grants and native sign-ins remain the authority's. */
983
1011
  export class InferenceRouter {
984
1012
  /** ChatGPT catalogs by account and the Codex release they were read as. */
@@ -1472,7 +1500,7 @@ export class InferenceRouter {
1472
1500
  if (pinned && optionsArg.returnToBetterTier) {
1473
1501
  // The session's account is of a later tier: an account of a better one that can take the request takes it, as a
1474
1502
  // new session would be placed. When none can, the session stays where it is, judged as before.
1475
- const better = accounts.filter((account) => tiers.indexOf(account.credential) < tiers.indexOf(pinned.credential));
1503
+ const better = this.betterTier(accounts, tiers, pinned);
1476
1504
  if (better.length) {
1477
1505
  try {
1478
1506
  const { accountId: _pinned, ...unpinned } = optionsArg;
@@ -1486,6 +1514,21 @@ export class InferenceRouter {
1486
1514
  return this.routeOpenAi(modelIdArg, policyArg, accounts, tiers, signalArg, optionsArg);
1487
1515
  }
1488
1516
 
1517
+ /**
1518
+ * The accounts of the pool a session on `pinnedArg`, of a later credential tier, returns to (`returnToBetterTier`): those
1519
+ * of a better tier, as a new session would be placed. A session on a priority account (AGL-1809) returns only to a
1520
+ * priority account of a better tier, since a new session would go to its own account before any account without one;
1521
+ * a priority is judged now.
1522
+ */
1523
+ private betterTier(accountsArg: readonly IInferenceAccount[], tiersArg: readonly TInferenceCredential[],
1524
+ pinnedArg: IInferenceAccount): IInferenceAccount[] {
1525
+ const now = this.now();
1526
+ const priority = (accountArg: IInferenceAccount) => plugins.authswitchPriority.authSwitchPriorityActive(
1527
+ accountArg.priorityUntil, now);
1528
+ return accountsArg.filter((account) => tiersArg.indexOf(account.credential) < tiersArg.indexOf(pinnedArg.credential)
1529
+ && (!priority(pinnedArg) || priority(account)));
1530
+ }
1531
+
1489
1532
  /** `acquire` among `accountsArg`, the pool's accounts or those of its better tiers. */
1490
1533
  private async routeOpenAi(modelIdArg: string, policyArg: IInferenceRoutingPolicy, accountsArg: readonly IInferenceAccount[],
1491
1534
  tiersArg: readonly TInferenceCredential[], signalArg: AbortSignal, optionsArg: IInferenceAcquireOptions): Promise<IInferenceRoute> {
@@ -1779,7 +1822,7 @@ export class InferenceRouter {
1779
1822
  if (pinned && optionsArg.returnToBetterTier && !optionsArg.ignoreLimits) {
1780
1823
  // The session's account is of a later tier: an account of a better one that can take the request takes it, as a
1781
1824
  // new session would be placed. When none can, the session stays where it is, judged as before.
1782
- const better = accounts.filter((account) => tiers.indexOf(account.credential) < tiers.indexOf(pinned.credential));
1825
+ const better = this.betterTier(accounts, tiers, pinned);
1783
1826
  if (better.length) {
1784
1827
  try {
1785
1828
  const route = await this.routeClaude(modelIdArg, policyArg, better, tiers, signalArg, {
@@ -1911,9 +1954,9 @@ export class InferenceRouter {
1911
1954
  }
1912
1955
 
1913
1956
  /**
1914
- * The candidate a request goes to -- of the best credential tier, then by the placement order
1915
- * (`authSwitchPlacementOrder`) -- or the refusal that says why there is none. A pinned request has its session's
1916
- * account as its one candidate, so the order only ever places new sessions. An account at its reserve is refused like one at its limit, and the refusal names the reserve. A pinned account
1957
+ * The candidate a request goes to -- a priority account before any other, then of the best credential tier, then by
1958
+ * the placement order (`inferencePlacementOrder`) -- or the refusal that says why there is none. A pinned request has
1959
+ * its session's account as its one candidate, so the order only ever places new sessions. An account at its reserve is refused like one at its limit, and the refusal names the reserve. A pinned account
1917
1960
  * that takes no request for a reason of its own (`refusal`) is refused with that account and reason.
1918
1961
  */
1919
1962
  private select<TModel>(candidatesArg: ICandidate<TModel>[], stateArg: ISelectionState): ICandidate<TModel> {
@@ -1935,12 +1978,12 @@ export class InferenceRouter {
1935
1978
  candidate.score = placement.score;
1936
1979
  return true;
1937
1980
  });
1938
- // The best credential tier first, then the placement order within it.
1939
- const order = plugins.authswitchPlacement.authSwitchPlacementOrder((accountIdArg) => this.active.get(accountIdArg) ?? 0);
1940
- candidatesArg.sort((left, right) => left.tier - right.tier || order({ id: left.account.id, score: left.score,
1941
- lastResort: left.lastResort, headroom: left.headroom }, { id: right.account.id, score: right.score,
1942
- lastResort: right.lastResort, headroom: right.headroom }));
1943
- const selected = candidatesArg[0];
1981
+ // A priority account first, then the best credential tier, then the placement order within it. A priority is judged
1982
+ // now, as a lift is: one that ended while the pool was read is none.
1983
+ const selected = candidatesArg.map((candidate) => ({ candidate, tier: candidate.tier, rank: { id: candidate.account.id,
1984
+ priority: plugins.authswitchPriority.authSwitchPriorityActive(candidate.account.priorityUntil, now),
1985
+ score: candidate.score, lastResort: candidate.lastResort, headroom: candidate.headroom } }))
1986
+ .sort(inferencePlacementOrder((accountIdArg) => this.active.get(accountIdArg) ?? 0))[0]?.candidate;
1944
1987
  if (selected) return selected;
1945
1988
  // A refusal names the API keys held by their spend limit, and those with a limit whose spend could not be read.
1946
1989
  const named = (messageArg: string, sentenceArg: string) => sentenceArg ? `${messageArg} ${sentenceArg}` : messageArg;
@@ -2004,6 +2047,7 @@ export class InferenceRouter {
2004
2047
  maxUsagePercent: account.maxUsagePercent, reserveLiftUntil: account.reserveLiftUntil, inFlight: this.active.get(account.id) ?? 0,
2005
2048
  lifecycle: placement.lifecycle, lapsesAt: account.lapsesAt,
2006
2049
  renewal: plugins.authswitchRenewal.authSwitchRenewal(account.renewsAt, now),
2050
+ priorityUntil: plugins.authswitchPriority.authSwitchPriorityUntil(account.priorityUntil, now),
2007
2051
  placementScore: placement.score, placementRank: null,
2008
2052
  lastResort: placement.eligibility === 'last_resort', claudeCode: account.claudeCode,
2009
2053
  readingSource: held?.observation ? 'headers' as const : held?.reading ? 'poll' as const : null,
@@ -2040,16 +2084,17 @@ export class InferenceRouter {
2040
2084
  plan: limits.plan || null, headroom: limits.limit?.headroom ?? null, crossing: limits.limit?.crossing ?? [],
2041
2085
  resetAt: state === 'cooling' ? new Date(cooldown).toISOString() : limits.limit?.resetAt ?? null };
2042
2086
  });
2043
- // Each provider's accounts that take a new session now, in the order placement takes them: the best credential tier
2044
- // first.
2045
- const order = plugins.authswitchPlacement.authSwitchPlacementOrder((accountIdArg) => this.active.get(accountIdArg) ?? 0);
2087
+ // Each provider's accounts that take a new session now, in the order placement takes them: a priority account first,
2088
+ // then the best credential tier.
2089
+ const order = inferencePlacementOrder((accountIdArg) => this.active.get(accountIdArg) ?? 0);
2046
2090
  const tiers = inferenceCredentialTiers(undefined);
2047
2091
  for (const provider of new Set(statuses.map((statusArg) => statusArg.provider))) {
2048
2092
  statuses.filter((statusArg) => statusArg.provider === provider && statusArg.state === 'available'
2049
2093
  && statusArg.lifecycle !== 'lapsed')
2050
2094
  .map((statusArg) => ({ status: statusArg, tier: tiers.indexOf(statusArg.credential), rank: { id: statusArg.id,
2051
- score: statusArg.placementScore, lastResort: statusArg.lastResort, headroom: statusArg.headroom ?? unknownHeadroom } }))
2052
- .sort((left, right) => left.tier - right.tier || order(left.rank, right.rank))
2095
+ priority: Boolean(statusArg.priorityUntil), score: statusArg.placementScore, lastResort: statusArg.lastResort,
2096
+ headroom: statusArg.headroom ?? unknownHeadroom } }))
2097
+ .sort(order)
2053
2098
  .forEach((entryArg, indexArg) => { entryArg.status.placementRank = indexArg + 1; });
2054
2099
  }
2055
2100
  return statuses;
@@ -159,7 +159,7 @@ export class InferenceService {
159
159
  const login = findAuthorityGatewayLogin(projection, account.id);
160
160
  return pool ? [{ id: account.id, label: account.label, revision: String(account.revision), providerId: pool.provider,
161
161
  credential: pool.credential, maxUsagePercent: account.maxUsagePercent, reserveLiftUntil: account.reserveLiftUntil, lapsesAt: account.lapsesAt,
162
- renewsAt: account.renewsAt, spendLimitMicroUsd: account.spendLimitMicroUsd, claudeCode: account.claudeCode, loginId: typeof login === 'string' ? null : login.id }] : [];
162
+ renewsAt: account.renewsAt, priorityUntil: account.priorityUntil, spendLimitMicroUsd: account.spendLimitMicroUsd, claudeCode: account.claudeCode, loginId: typeof login === 'string' ? null : login.id }] : [];
163
163
  });
164
164
  }
165
165
 
@@ -45,6 +45,7 @@ const placementText = (accountArg: NonNullable<TReportedProxyStatus['accounts']>
45
45
  if (accountArg.lifecycle === undefined) return '';
46
46
  if (accountArg.lifecycle === 'lapsed') return `; lapsed ${accountArg.lapsesAt}, never routed to again`;
47
47
  return `${accountArg.lifecycle === 'canceled' ? `; canceled, lapses ${accountArg.lapsesAt}` : ''}`
48
+ + `${accountArg.priorityUntil ? `; priority until ${accountArg.priorityUntil} (set by the owner)` : ''}`
48
49
  + `${accountArg.renewal ? `; renews ${accountArg.renewal.at} (set by the owner`
49
50
  + `${accountArg.lifecycle === 'canceled' ? ', ignored while it lapses' : ''})` : ''}`
50
51
  + `; placement ${scoreText(accountArg.placementScore ?? null)}`
@@ -85,6 +85,7 @@ export const controllerAuditEventTypes = [
85
85
  'accounts.spendlimit',
86
86
  'accounts.claudecode',
87
87
  'accounts.renewal',
88
+ 'accounts.priority',
88
89
  'accounts.remove',
89
90
  'accounts.add',
90
91
  'accounts.reauth',
package/ts/plugins.ts CHANGED
@@ -68,6 +68,8 @@ import * as authswitchSpend from '../ts_authswitch/authority-spend.js';
68
68
  import * as authswitchSubscription from '../ts_authswitch/authority-subscription.js';
69
69
  // A Claude sign-in's monthly renewal as its owner set it: the rule, the next renewal, which placement and the status share.
70
70
  import * as authswitchRenewal from '../ts_authswitch/authority-renewal.js';
71
+ // An account's priority as its owner set it: whether it holds now, the one rule placement and every view judge it by.
72
+ import * as authswitchPriority from '../ts_authswitch/authority-priority.js';
71
73
  // The login an account's usage is read with (`authSwitchUsageLogin`), the rule `authswitch list` and a device's API key
72
74
  // counts share. The package root already loads this module through its CLI, so the value import adds none.
73
75
  import * as authswitchOverview from '../ts_authswitch/authority-overview.js';
@@ -93,6 +95,7 @@ export {
93
95
  authswitchSpend,
94
96
  authswitchSubscription,
95
97
  authswitchRenewal,
98
+ authswitchPriority,
96
99
  authswitchOverview,
97
100
  flexharness,
98
101
  browserRuntime,
@@ -279,6 +279,15 @@ export interface IAuthSwitchAccount {
279
279
  * lapse date ignores it. Whether the windows reset at a renewal is not known. See `authority-placement.ts`.
280
280
  */
281
281
  renewsAt: string | null;
282
+ /**
283
+ * When the owner's priority on the account ends (AGL-1809), ISO 8601 UTC, 24 hours after it was set
284
+ * (`authSwitchPriorityMs` of `authority-priority.ts`); `null` when the owner set none or turned it off. Until then, AGL's
285
+ * inference proxy places a new session on the account before any account of its pool without one, as long as it takes
286
+ * the request; several accounts can hold it at once. It ends by itself: one whose moment passed is none, so a reader
287
+ * judges it against its own clock (`authSwitchPriorityActive`) rather than by whether it is set. Any account can hold
288
+ * one.
289
+ */
290
+ priorityUntil: string | null;
282
291
  /**
283
292
  * An API key account's spend limit per calendar month in UTC, in micro-dollars (`isAuthSwitchSpendLimitMicroUsd`);
284
293
  * `null` for none, and always for an account on a sign-in. The limit counts what AGL's inference proxy relayed on the
@@ -1544,6 +1553,18 @@ export interface IReq_AuthSwitchSetAccountRenewal extends ITypedRequest {
1544
1553
  response: { account: IAuthSwitchAccount };
1545
1554
  }
1546
1555
 
1556
+ /**
1557
+ * Gives an account the owner's priority for 24 hours from now (`priority: true`; again on an account that holds it starts
1558
+ * the 24 hours again), or ends it (`false`): see `IAuthSwitchAccount.priorityUntil`. The end is the authority's clock
1559
+ * plus `authSwitchPriorityMs`, never the caller's. `expectedRevision` is the revision the caller read, so a change of an
1560
+ * account that changed meanwhile is refused as `account_changed`.
1561
+ */
1562
+ export interface IReq_AuthSwitchSetAccountPriority extends ITypedRequest {
1563
+ method: 'authswitch.authority.priority';
1564
+ request: { accountId: string; expectedRevision: number; priority: boolean };
1565
+ response: { account: IAuthSwitchAccount };
1566
+ }
1567
+
1547
1568
  /**
1548
1569
  * One binding by the id `bind` returned, credential-free, or `null` when this authority holds no binding by
1549
1570
  * that id. A backend checks that its binding still stands without reading the whole snapshot.
@@ -12,6 +12,7 @@ import { authSwitchUsageLimit, authSwitchUsageLimitText, type IAuthSwitchUsageLi
12
12
  type TAuthSwitchLimitState } from './authority-usagelimit.js';
13
13
  import { authSwitchPlacement, type IAuthSwitchPlacement, type TAuthSwitchAccountLifecycle } from './authority-placement.js';
14
14
  import { authSwitchRenewal, type IAuthSwitchRenewal } from './authority-renewal.js';
15
+ import { authSwitchPriorityUntil } from './authority-priority.js';
15
16
  import { authSwitchSubscriptionFacts, type IAuthSwitchSubscriptionFact } from './authority-subscription.js';
16
17
  import type { IAuthSwitchPaymentProblem } from './classes.authorityusage.js';
17
18
  import { plainText } from './formatting.js';
@@ -60,6 +61,12 @@ export interface IAuthSwitchAccountOverview {
60
61
  * without one. Placement ignores it while the account has a lapse date.
61
62
  */
62
63
  renewal: IAuthSwitchRenewal | null;
64
+ /**
65
+ * When the owner's priority on the account ends, while it holds at the list's time (`IAuthSwitchAccount.priorityUntil`,
66
+ * AGL-1809); null without one or once it ended. Until then the AGL proxy places new sessions on it before any account of
67
+ * its pool without one, as long as it takes them.
68
+ */
69
+ priorityUntil: string | null;
63
70
  /**
64
71
  * How the AGL proxy treats the account for a new session, by the rule of `authority-placement.ts`: its score in
65
72
  * percent per hour (null without a counted window) and whether it is a last resort or never placed on.
@@ -102,6 +109,8 @@ export interface IAuthSwitchLimitRow {
102
109
  lifecycle: TAuthSwitchAccountLifecycle;
103
110
  /** The account's next monthly renewal as its owner set it, or null without one (`IAuthSwitchAccountOverview.renewal`). */
104
111
  renewal: IAuthSwitchRenewal | null;
112
+ /** When the owner's priority on the account ends while it holds, or null (`IAuthSwitchAccountOverview.priorityUntil`). */
113
+ priorityUntil: string | null;
105
114
  /** The account's placement score in percent per hour (`IAuthSwitchPlacement.score`), on each of its rows. */
106
115
  placementScore: number | null;
107
116
  placementEligibility: IAuthSwitchPlacement['eligibility'];
@@ -177,6 +186,7 @@ export const readAuthSwitchAccountOverview = async (snapshotArg: IAuthSwitchSnap
177
186
  lifecycle: authSwitchPlacement(null, accountArg.maxUsagePercent, accountArg.lapsesAt, accountArg.renewsAt, nowArg,
178
187
  accountArg.reserveLiftUntil).lifecycle,
179
188
  renewal: authSwitchRenewal(accountArg.renewsAt, nowArg),
189
+ priorityUntil: authSwitchPriorityUntil(accountArg.priorityUntil, nowArg),
180
190
  };
181
191
  const placement = (readingArg: IAuthSwitchUsageSnapshot['reading']): IAuthSwitchPlacement =>
182
192
  authSwitchPlacement(readingArg, accountArg.maxUsagePercent, accountArg.lapsesAt, accountArg.renewsAt, nowArg,
@@ -232,7 +242,7 @@ export const authSwitchLimitList = (overviewArg: IAuthSwitchAccountOverviewList)
232
242
  plan: accountArg.plan, usageState: accountArg.usage?.state ?? null, problem: accountArg.problem,
233
243
  maxUsagePercent: accountArg.maxUsagePercent, accountState: accountArg.limit?.state ?? null,
234
244
  lapsesAt: accountArg.lapsesAt, lifecycle: accountArg.lifecycle, renewal: accountArg.renewal,
235
- placementScore: accountArg.placement.score,
245
+ priorityUntil: accountArg.priorityUntil, placementScore: accountArg.placement.score,
236
246
  placementEligibility: accountArg.placement.eligibility };
237
247
  if (accountArg.windows.length === 0) {
238
248
  return [{ ...base, limit: null, windowSeconds: null, usedPercent: null, estimatedUsedPercent: null, resetAt: null,
@@ -308,13 +318,16 @@ const limitLines = (maxUsagePercentArg: number | null, limitArg: IAuthSwitchUsag
308
318
 
309
319
  /**
310
320
  * The lifecycle and placement of an account as lines of its cell: nothing for an active account with its score, a
311
- * canceled one with its lapse, a lapsed one as never placed on; and the renewal its owner set, unless it lapsed.
321
+ * canceled one with its lapse, a lapsed one as never placed on; and the priority and renewal its owner set, unless it
322
+ * lapsed. The priority's end is in local time: `priority until 14:05 (set by the owner)`, with its date on another day.
312
323
  */
313
- const placementLines = (accountArg: Pick<IAuthSwitchLimitRow, 'lifecycle' | 'lapsesAt' | 'renewal' | 'placementScore'
314
- | 'placementEligibility'>, nowArg: number): string[] => [
324
+ const placementLines = (accountArg: Pick<IAuthSwitchLimitRow, 'lifecycle' | 'lapsesAt' | 'renewal' | 'priorityUntil'
325
+ | 'placementScore' | 'placementEligibility'>, nowArg: number): string[] => [
315
326
  ...accountArg.lifecycle === 'lapsed' ? ['lapsed · never placed on']
316
327
  : accountArg.lifecycle === 'canceled' && accountArg.lapsesAt !== null
317
328
  ? [`canceled · lapses in ${compactUntil(accountArg.lapsesAt, nowArg)}`] : [],
329
+ ...accountArg.lifecycle === 'lapsed' || accountArg.priorityUntil === null ? []
330
+ : [`priority until ${asOfTime(accountArg.priorityUntil, nowArg)} (set by the owner)`],
318
331
  ...accountArg.lifecycle === 'lapsed' || accountArg.renewal === null ? []
319
332
  : [renewalLine(accountArg.renewal, accountArg.lifecycle, nowArg)],
320
333
  ...accountArg.lifecycle === 'lapsed' ? []
@@ -344,7 +357,8 @@ const accountCell = (accountArg: IAuthSwitchAccountOverview, nowArg: number): st
344
357
  ...accountArg.paymentProblem === null ? [] : [`payment problem since ${asOfTime(accountArg.paymentProblem.at, nowArg)}`],
345
358
  ...limitLines(accountArg.maxUsagePercent, accountArg.limit, nowArg),
346
359
  ...placementLines({ lifecycle: accountArg.lifecycle, lapsesAt: accountArg.lapsesAt, renewal: accountArg.renewal,
347
- placementScore: accountArg.placement.score, placementEligibility: accountArg.placement.eligibility }, nowArg),
360
+ priorityUntil: accountArg.priorityUntil, placementScore: accountArg.placement.score,
361
+ placementEligibility: accountArg.placement.eligibility }, nowArg),
348
362
  ...accountArg.loginHealth === null ? ['no login']
349
363
  : accountArg.loginHealth === 'ready' ? []
350
364
  : [`login ${accountArg.loginHealth}`,