agl 42.1.0 → 42.2.1

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 (138) hide show
  1. package/changelog.md +44 -0
  2. package/dist_serve/bundle.js +797 -785
  3. package/dist_serve/bundle.js.map +2 -2
  4. package/dist_ts/00_commitinfo_data.js +1 -1
  5. package/dist_ts/aglapi/aglapisurface.document.js +124 -10
  6. package/dist_ts/classes.accountsactions.d.ts +3 -1
  7. package/dist_ts/classes.accountsactions.js +16 -1
  8. package/dist_ts/classes.authstore.js +9 -1
  9. package/dist_ts/classes.cli.js +19 -49
  10. package/dist_ts/classes.configurationauthority.js +2 -2
  11. package/dist_ts/classes.controllerservice.d.ts +20 -2
  12. package/dist_ts/classes.controllerservice.js +42 -6
  13. package/dist_ts/classes.flexservice.js +8 -3
  14. package/dist_ts/classes.inferencegateway.d.ts +30 -2
  15. package/dist_ts/classes.inferencegateway.js +115 -20
  16. package/dist_ts/classes.inferencerouter.d.ts +16 -0
  17. package/dist_ts/classes.inferencerouter.js +5 -3
  18. package/dist_ts/classes.inferenceservice.js +7 -3
  19. package/dist_ts/classes.ticketmodels.js +4 -3
  20. package/dist_ts/classes.ticketnotifier.js +9 -2
  21. package/dist_ts/classes.ticketstore.js +9 -5
  22. package/dist_ts/classes.upgradecoordinator.d.ts +6 -1
  23. package/dist_ts/classes.upgradecoordinator.js +9 -2
  24. package/dist_ts/classes.upgradetransaction.d.ts +27 -1
  25. package/dist_ts/classes.upgradetransaction.js +92 -2
  26. package/dist_ts/configuration/functions.master.d.ts +7 -2
  27. package/dist_ts/configuration/functions.master.js +7 -4
  28. package/dist_ts/driver/classes.drivereventrelay.d.ts +1 -1
  29. package/dist_ts/driver/classes.drivereventrelay.js +3 -3
  30. package/dist_ts/fleet/classes.boardpump.d.ts +1 -1
  31. package/dist_ts/fleet/classes.boardpump.js +7 -4
  32. package/dist_ts/fleet/classes.claudeworkers.d.ts +6 -0
  33. package/dist_ts/fleet/classes.claudeworkers.js +17 -7
  34. package/dist_ts/fleet/classes.deploymodels.d.ts +19 -0
  35. package/dist_ts/fleet/classes.deploymodels.js +140 -0
  36. package/dist_ts/fleet/functions.validation.d.ts +8 -1
  37. package/dist_ts/fleet/functions.validation.js +65 -3
  38. package/dist_ts/fleet/interfaces.workers.d.ts +6 -0
  39. package/dist_ts/fleet/interfaces.workers.js +65 -2
  40. package/dist_ts/functions.fleetworkercli.d.ts +16 -3
  41. package/dist_ts/functions.fleetworkercli.js +21 -7
  42. package/dist_ts/functions.inferencecli.js +4 -2
  43. package/dist_ts/functions.mcptickettools.d.ts +1 -0
  44. package/dist_ts/functions.ticketvalidation.d.ts +36 -3
  45. package/dist_ts/functions.ticketvalidation.js +45 -14
  46. package/dist_ts/interfaces.auth.d.ts +1 -1
  47. package/dist_ts/interfaces.auth.js +2 -1
  48. package/dist_ts_authswitch/authority-contract.d.ts +23 -0
  49. package/dist_ts_authswitch/authority-contract.js +1 -1
  50. package/dist_ts_authswitch/classes.authoritybroker.d.ts +12 -0
  51. package/dist_ts_authswitch/classes.authoritybroker.js +72 -22
  52. package/dist_ts_authswitch/classes.authoritycli.d.ts +1 -0
  53. package/dist_ts_authswitch/classes.authoritycli.js +26 -1
  54. package/dist_ts_authswitch/classes.authorityclient.d.ts +3 -1
  55. package/dist_ts_authswitch/classes.authorityclient.js +10 -4
  56. package/dist_ts_authswitch/classes.authoritydaemon.js +7 -1
  57. package/dist_ts_authswitch/classes.authorityimport.js +2 -2
  58. package/dist_ts_authswitch/classes.authoritymodels.d.ts +3 -0
  59. package/dist_ts_authswitch/classes.authoritymodels.js +10 -3
  60. package/dist_ts_authswitch/classes.authorityusage.js +5 -3
  61. package/dist_ts_authswitch/classes.claudeauthority.js +2 -2
  62. package/dist_ts_authswitch/testsupport.js +4 -4
  63. package/dist_ts_authswitch/ts_migration/0012_account_claude_code.d.ts +11 -0
  64. package/dist_ts_authswitch/ts_migration/0012_account_claude_code.js +18 -0
  65. package/dist_ts_authswitch/ts_migration/index.js +3 -1
  66. package/dist_ts_interfaces/deployments.d.ts +104 -0
  67. package/dist_ts_interfaces/deployments.js +8 -0
  68. package/dist_ts_interfaces/fleet.d.ts +2 -0
  69. package/dist_ts_interfaces/index.d.ts +1 -0
  70. package/dist_ts_interfaces/index.js +2 -1
  71. package/dist_ts_interfaces/interfaces.d.ts +1 -1
  72. package/dist_ts_interfaces/interfaces.js +1 -1
  73. package/dist_ts_interfaces/requests.accounts.d.ts +18 -0
  74. package/dist_ts_interfaces/requests.accounts.js +1 -1
  75. package/dist_ts_interfaces/requests.d.ts +2 -2
  76. package/dist_ts_interfaces/requests.js +1 -1
  77. package/dist_ts_interfaces/tickets.d.ts +53 -4
  78. package/dist_ts_interfaces/tickets.js +6 -2
  79. package/dist_ts_migration/index.d.ts +1 -0
  80. package/dist_ts_migration/index.js +2 -1
  81. package/dist_ts_migration/v41_ticketmigrationmarkers.d.ts +19 -0
  82. package/dist_ts_migration/v41_ticketmigrationmarkers.js +85 -0
  83. package/docs/authswitch.md +9 -1
  84. package/package.json +5 -5
  85. package/readme.md +48 -12
  86. package/ts/00_commitinfo_data.ts +1 -1
  87. package/ts/aglapi/aglapisurface.document.ts +123 -9
  88. package/ts/classes.accountsactions.ts +24 -0
  89. package/ts/classes.authstore.ts +8 -0
  90. package/ts/classes.cli.ts +17 -54
  91. package/ts/classes.configurationauthority.ts +1 -1
  92. package/ts/classes.controllerservice.ts +49 -6
  93. package/ts/classes.flexservice.ts +7 -2
  94. package/ts/classes.inferencegateway.ts +133 -19
  95. package/ts/classes.inferencerouter.ts +20 -2
  96. package/ts/classes.inferenceservice.ts +6 -3
  97. package/ts/classes.ticketmodels.ts +3 -2
  98. package/ts/classes.ticketnotifier.ts +8 -1
  99. package/ts/classes.ticketstore.ts +8 -4
  100. package/ts/classes.upgradecoordinator.ts +14 -4
  101. package/ts/classes.upgradetransaction.ts +118 -0
  102. package/ts/configuration/functions.master.ts +6 -3
  103. package/ts/driver/classes.drivereventrelay.ts +2 -2
  104. package/ts/fleet/classes.boardpump.ts +7 -4
  105. package/ts/fleet/classes.claudeworkers.ts +16 -6
  106. package/ts/fleet/classes.deploymodels.ts +44 -0
  107. package/ts/fleet/functions.validation.ts +50 -2
  108. package/ts/fleet/interfaces.workers.ts +56 -1
  109. package/ts/functions.fleetworkercli.ts +26 -8
  110. package/ts/functions.inferencecli.ts +3 -1
  111. package/ts/functions.ticketvalidation.ts +48 -13
  112. package/ts/interfaces.auth.ts +1 -0
  113. package/ts_authswitch/authority-contract.ts +18 -0
  114. package/ts_authswitch/classes.authoritybroker.ts +67 -19
  115. package/ts_authswitch/classes.authoritycli.ts +29 -0
  116. package/ts_authswitch/classes.authorityclient.ts +12 -4
  117. package/ts_authswitch/classes.authoritydaemon.ts +8 -1
  118. package/ts_authswitch/classes.authorityimport.ts +1 -1
  119. package/ts_authswitch/classes.authoritymodels.ts +5 -1
  120. package/ts_authswitch/classes.authorityusage.ts +5 -2
  121. package/ts_authswitch/classes.claudeauthority.ts +1 -1
  122. package/ts_authswitch/native-contracts.md +10 -0
  123. package/ts_authswitch/testsupport.ts +3 -3
  124. package/ts_authswitch/ts_migration/0012_account_claude_code.ts +17 -0
  125. package/ts_authswitch/ts_migration/index.ts +2 -0
  126. package/ts_interfaces/deployments.ts +98 -0
  127. package/ts_interfaces/fleet.ts +2 -0
  128. package/ts_interfaces/index.ts +1 -0
  129. package/ts_interfaces/interfaces.ts +1 -1
  130. package/ts_interfaces/requests.accounts.ts +16 -0
  131. package/ts_interfaces/requests.ts +2 -0
  132. package/ts_interfaces/tickets.ts +34 -4
  133. package/ts_migration/index.ts +1 -0
  134. package/ts_migration/v41_ticketmigrationmarkers.ts +28 -0
  135. package/ts_web/00_commitinfo_data.ts +1 -1
  136. package/ts_web/classes.accountsreadmodel.ts +12 -1
  137. package/ts_web/elements.accounts.ts +44 -0
  138. package/ts_web/elements.ticketboard.ts +15 -4
@@ -3765,7 +3765,7 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
3765
3765
  },
3766
3766
  "protocolVersion": {
3767
3767
  "type": "number",
3768
- "const": 49
3768
+ "const": 50
3769
3769
  },
3770
3770
  "upgradeManagementVersion": {
3771
3771
  "type": "number"
@@ -3891,7 +3891,7 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
3891
3891
  ],
3892
3892
  "additionalProperties": false
3893
3893
  },
3894
- "declaration": "interface IControllerStatus {\n packageName: string;\n packageVersion: string;\n protocolVersion: 49;\n upgradeManagementVersion: number;\n /**\n * The protocol of the controller's loopback management endpoint (`controllerManagementProtocolVersion`); absent\n * from a controller older than the endpoint, which this release refuses to manage.\n */\n managementProtocolVersion?: number;\n controllerPid: number;\n processGroupId: number;\n processFingerprint: string;\n processMode: TControllerProcessMode;\n lifecycleState: TControllerLifecycleState;\n startedAt: number;\n setupRequired: boolean;\n /** Present when the controller runs as the systemd user unit (`agl service install`); absent for a detached or foreground one. */\n serviceUnit?: \"agl-controller.service\";\n /** The TLS mode of the runtime configuration the controller runs with; absent until it is resolved. */\n tlsMode?: TControllerTlsMode;\n upgrade?: IControllerUpgradeStatus;\n /** AGL's inference proxy, by state only; details need a signed-in owner (`controller.proxy.status.get`). */\n proxy?: { state: TControllerProxyState };\n harnesses: Array<{\n harnessId: TControllerSessionHarnessId;\n pid?: number;\n state: TControllerHarnessLifecycleState;\n healthy: boolean;\n version?: string;\n supportsLocalAttachments?: boolean;\n connectionMode?: 'local' | 'shared' | 'remote';\n diagnostic?: IControllerCodexDiagnostic;\n /** Codex only: automatic reconnection of this entry's profile to the local shared app-server. */\n rejoin?: IControllerCodexRejoinStatus;\n /**\n * Codex only, on the controller status: every connected or required profile. The entry's\n * `healthy` is then true only when each of them is, apart from a profile on an account Codex\n * cannot run on now, listed `stopped` with an `account_unavailable` diagnostic that says why;\n * its other members describe the default profile.\n */\n profiles?: IControllerCodexProfileStatus[];\n }>;\n}"
3894
+ "declaration": "interface IControllerStatus {\n packageName: string;\n packageVersion: string;\n protocolVersion: 50;\n upgradeManagementVersion: number;\n /**\n * The protocol of the controller's loopback management endpoint (`controllerManagementProtocolVersion`); absent\n * from a controller older than the endpoint, which this release refuses to manage.\n */\n managementProtocolVersion?: number;\n controllerPid: number;\n processGroupId: number;\n processFingerprint: string;\n processMode: TControllerProcessMode;\n lifecycleState: TControllerLifecycleState;\n startedAt: number;\n setupRequired: boolean;\n /** Present when the controller runs as the systemd user unit (`agl service install`); absent for a detached or foreground one. */\n serviceUnit?: \"agl-controller.service\";\n /** The TLS mode of the runtime configuration the controller runs with; absent until it is resolved. */\n tlsMode?: TControllerTlsMode;\n upgrade?: IControllerUpgradeStatus;\n /** AGL's inference proxy, by state only; details need a signed-in owner (`controller.proxy.status.get`). */\n proxy?: { state: TControllerProxyState };\n harnesses: Array<{\n harnessId: TControllerSessionHarnessId;\n pid?: number;\n state: TControllerHarnessLifecycleState;\n healthy: boolean;\n version?: string;\n supportsLocalAttachments?: boolean;\n connectionMode?: 'local' | 'shared' | 'remote';\n diagnostic?: IControllerCodexDiagnostic;\n /** Codex only: automatic reconnection of this entry's profile to the local shared app-server. */\n rejoin?: IControllerCodexRejoinStatus;\n /**\n * Codex only, on the controller status: every connected or required profile. The entry's\n * `healthy` is then true only when each of them is, apart from a profile on an account Codex\n * cannot run on now, listed `stopped` with an `account_unavailable` diagnostic that says why;\n * its other members describe the default profile.\n */\n profiles?: IControllerCodexProfileStatus[];\n }>;\n}"
3895
3895
  },
3896
3896
  {
3897
3897
  "name": "IControllerTerminalResource",
@@ -4400,6 +4400,15 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
4400
4400
  "$ref": "#/$defs/TTicketLink"
4401
4401
  }
4402
4402
  },
4403
+ "releasePlan": {
4404
+ "$ref": "#/$defs/ITicketReleasePlan"
4405
+ },
4406
+ "maintenanceWindow": {
4407
+ "$ref": "#/$defs/ITicketMaintenanceWindow"
4408
+ },
4409
+ "deployPlan": {
4410
+ "$ref": "#/$defs/ITicketDeployPlan"
4411
+ },
4403
4412
  "source": {
4404
4413
  "$ref": "#/$defs/ITicketSource"
4405
4414
  },
@@ -4476,7 +4485,7 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
4476
4485
  ],
4477
4486
  "additionalProperties": false
4478
4487
  },
4479
- "declaration": "interface ITicket {\n id: string;\n key: string;\n revision: number;\n project: string;\n kind: TTicketKind;\n title: string;\n description: string;\n parentId?: string;\n columnId: TTicketColumn;\n order: number;\n priority: TTicketPriority;\n assignee?: ITicketPerson;\n labels: string[];\n links: TTicketLink[];\n source: ITicketSource;\n createdBy: ITicketActor;\n updatedBy: ITicketActor;\n createdAt: string;\n updatedAt: string;\n permissions?: { edit: boolean; move: boolean; comment: boolean; createChild: boolean; ask: boolean; answer: boolean };\n /** Computed on read by the AutoLabel rules, never persisted and never set by hand. */\n autoLabels?: TTicketAutoLabel[];\n}"
4488
+ "declaration": "interface ITicket {\n id: string;\n key: string;\n revision: number;\n project: string;\n kind: TTicketKind;\n title: string;\n description: string;\n parentId?: string;\n columnId: TTicketColumn;\n order: number;\n priority: TTicketPriority;\n assignee?: ITicketPerson;\n labels: string[];\n links: TTicketLink[];\n releasePlan?: ITicketReleasePlan;\n maintenanceWindow?: ITicketMaintenanceWindow;\n deployPlan?: ITicketDeployPlan;\n source: ITicketSource;\n createdBy: ITicketActor;\n updatedBy: ITicketActor;\n createdAt: string;\n updatedAt: string;\n permissions?: { edit: boolean; move: boolean; comment: boolean; createChild: boolean; ask: boolean; answer: boolean };\n /** Computed on read by the AutoLabel rules, never persisted and never set by hand. */\n autoLabels?: TTicketAutoLabel[];\n}"
4480
4489
  },
4481
4490
  {
4482
4491
  "name": "ITicketActivity",
@@ -4504,6 +4513,7 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
4504
4513
  "reordered",
4505
4514
  "commented",
4506
4515
  "linked",
4516
+ "unlinked",
4507
4517
  "asked",
4508
4518
  "answered"
4509
4519
  ]
@@ -4530,7 +4540,7 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
4530
4540
  ],
4531
4541
  "additionalProperties": false
4532
4542
  },
4533
- "declaration": "interface ITicketActivity {\n id: string;\n ticketId: string;\n actor: ITicketActor;\n createdAt: string;\n action: 'created' | 'updated' | 'moved' | 'reordered' | 'commented' | 'linked' | 'asked' | 'answered';\n changes: Record<string, { before?: unknown; after?: unknown }>;\n}"
4543
+ "declaration": "interface ITicketActivity {\n id: string;\n ticketId: string;\n actor: ITicketActor;\n createdAt: string;\n action: 'created' | 'updated' | 'moved' | 'reordered' | 'commented' | 'linked' | 'unlinked' | 'asked' | 'answered';\n changes: Record<string, { before?: unknown; after?: unknown }>;\n}"
4534
4544
  },
4535
4545
  {
4536
4546
  "name": "ITicketActor",
@@ -4729,6 +4739,31 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
4729
4739
  "name": "ITicketCreate",
4730
4740
  "declaration": "interface ITicketCreate {\n project: string;\n kind?: TTicketKind;\n title: string;\n description?: string;\n columnId?: TTicketColumn;\n parentId?: string;\n priority?: TTicketPriority;\n assignee?: ITicketPerson;\n labels?: string[];\n sourceText?: string;\n attachments?: ITicketAttachment[];\n}"
4731
4741
  },
4742
+ {
4743
+ "name": "ITicketDeployPlan",
4744
+ "schema": {
4745
+ "type": "object",
4746
+ "properties": {
4747
+ "target": {
4748
+ "type": "string"
4749
+ },
4750
+ "version": {
4751
+ "type": "string"
4752
+ },
4753
+ "questionId": {
4754
+ "type": "string"
4755
+ }
4756
+ },
4757
+ "required": [
4758
+ "target",
4759
+ "version",
4760
+ "questionId"
4761
+ ],
4762
+ "additionalProperties": false,
4763
+ "description": "A planned deploy: the deploy target should run `version`, a release of its repository, or a newer one. Setting it asks the owner `questionId` on the ticket; the answer is the owner's go."
4764
+ },
4765
+ "declaration": "/**\n * A planned deploy: the deploy target should run `version`, a release of its repository, or a newer one. Setting it\n * asks the owner `questionId` on the ticket; the answer is the owner's go.\n */\ninterface ITicketDeployPlan { target: string; version: string; questionId: string }"
4766
+ },
4732
4767
  {
4733
4768
  "name": "ITicketDetail",
4734
4769
  "schema": {
@@ -4778,6 +4813,37 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
4778
4813
  "name": "ITicketGet",
4779
4814
  "declaration": "/** A ticket and one page of its history: the newest entries, or those older than the entry `before` names, within `ticketHistoryPage`. */\ninterface ITicketGet {\n ticketId: string;\n /** An activity id, as `historyBefore` returned it: the page holds only older entries. */\n before?: string;\n /** Entries on the page, 1 to 500 (`ticketHistoryPage.maximum`); 50 (`ticketHistoryPage.default`) when absent. */\n limit?: number;\n /**\n * One comment of this ticket, by the id an activity entry or a fleet event names: the response holds the ticket, its\n * questions and that comment alone (`comments: [it]`, `activity: []`, no `historyBefore`). Excludes `before` and `limit`.\n */\n commentId?: string;\n}"
4780
4815
  },
4816
+ {
4817
+ "name": "ITicketMaintenanceWindow",
4818
+ "schema": {
4819
+ "type": "object",
4820
+ "properties": {
4821
+ "from": {
4822
+ "type": "string"
4823
+ },
4824
+ "to": {
4825
+ "type": "string"
4826
+ },
4827
+ "targets": {
4828
+ "type": "array",
4829
+ "items": {
4830
+ "type": "string"
4831
+ }
4832
+ },
4833
+ "questionId": {
4834
+ "type": "string"
4835
+ }
4836
+ },
4837
+ "required": [
4838
+ "from",
4839
+ "to",
4840
+ "targets"
4841
+ ],
4842
+ "additionalProperties": false,
4843
+ "description": "A maintenance window: between `from` and `to` (ISO 8601 instants, `to` after `from`) the deploy targets it lists may be deployed, which a target whose deploys need a window waits for. A window counts while its ticket is not done. `questionId` is the owner's question on the ticket when the driver proposed the window: it counts once the owner approves it there. The owner's own window has none and counts at once."
4844
+ },
4845
+ "declaration": "/**\n * A maintenance window: between `from` and `to` (ISO 8601 instants, `to` after `from`) the deploy targets it lists may\n * be deployed, which a target whose deploys need a window waits for. A window counts while its ticket is not done.\n * `questionId` is the owner's question on the ticket when the driver proposed the window: it counts once the owner\n * approves it there. The owner's own window has none and counts at once.\n */\ninterface ITicketMaintenanceWindow { from: string; to: string; targets: string[]; questionId?: string }"
4846
+ },
4781
4847
  {
4782
4848
  "name": "ITicketMove",
4783
4849
  "declaration": "interface ITicketMove { ticketId: string; columnId: TTicketColumn; beforeTicketId?: string; }"
@@ -4939,6 +5005,26 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
4939
5005
  },
4940
5006
  "declaration": "/**\n * A question in a ticket's discussion. Field names follow dees-catalog's `IHarnessQuestionRequest`\n * (`question`, `options`, `multiSelect`, `allowCustom`) so the board can show the chat's question card.\n */\ninterface ITicketQuestionOption {\n /** Assigned by AGL: '1' to 'n' in option order. */\n id: string;\n label: string;\n description?: string;\n}"
4941
5007
  },
5008
+ {
5009
+ "name": "ITicketReleasePlan",
5010
+ "schema": {
5011
+ "type": "object",
5012
+ "properties": {
5013
+ "repo": {
5014
+ "type": "string"
5015
+ },
5016
+ "version": {
5017
+ "type": "string"
5018
+ }
5019
+ },
5020
+ "required": [
5021
+ "repo"
5022
+ ],
5023
+ "additionalProperties": false,
5024
+ "description": "A planned release: the repository (`org/name`, one fleet discovery knows) and, optionally, the version it should reach; without a version it means the next release. A hotfix is the same plan on an urgent ticket."
5025
+ },
5026
+ "declaration": "/**\n * A planned release: the repository (`org/name`, one fleet discovery knows) and, optionally, the version it should\n * reach; without a version it means the next release. A hotfix is the same plan on an urgent ticket.\n */\ninterface ITicketReleasePlan { repo: string; version?: string }"
5027
+ },
4942
5028
  {
4943
5029
  "name": "ITicketSource",
4944
5030
  "schema": {
@@ -5827,10 +5913,11 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
5827
5913
  "needs_input",
5828
5914
  "review",
5829
5915
  "landed",
5830
- "released"
5916
+ "released",
5917
+ "closed"
5831
5918
  ]
5832
5919
  },
5833
- "declaration": "type TTicketColumn = (readonly [\"backlog\", \"ready\", \"in_progress\", \"needs_input\", \"review\", \"landed\", \"released\"])[number];"
5920
+ "declaration": "type TTicketColumn = (readonly [\"backlog\", \"ready\", \"in_progress\", \"needs_input\", \"review\", \"landed\", \"released\", \"closed\"])[number];"
5834
5921
  },
5835
5922
  {
5836
5923
  "name": "TTicketKind",
@@ -5901,23 +5988,50 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
5901
5988
  "type": "string",
5902
5989
  "const": "release"
5903
5990
  },
5991
+ "version": {
5992
+ "type": "string"
5993
+ },
5904
5994
  "package": {
5905
5995
  "type": "string"
5906
5996
  },
5997
+ "repo": {
5998
+ "type": "string"
5999
+ },
6000
+ "sha": {
6001
+ "type": "string"
6002
+ }
6003
+ },
6004
+ "required": [
6005
+ "kind",
6006
+ "version"
6007
+ ],
6008
+ "additionalProperties": false
6009
+ },
6010
+ {
6011
+ "type": "object",
6012
+ "properties": {
6013
+ "kind": {
6014
+ "type": "string",
6015
+ "const": "affects"
6016
+ },
6017
+ "repo": {
6018
+ "type": "string"
6019
+ },
5907
6020
  "version": {
5908
6021
  "type": "string"
5909
6022
  }
5910
6023
  },
5911
6024
  "required": [
5912
6025
  "kind",
5913
- "package",
6026
+ "repo",
5914
6027
  "version"
5915
6028
  ],
5916
6029
  "additionalProperties": false
5917
6030
  }
5918
- ]
6031
+ ],
6032
+ "description": "Evidence a ticket carries. A release is a repository's tag `v<version>`: its link names the repository (`org/name`) and the commit the tag points at, and the package it published where there is one; a release linked by hand names the package alone. `affects` records the version of a repository a bug was found in."
5919
6033
  },
5920
- "declaration": "type TTicketLink =\n | { kind: 'branch'; repo: string; branch: string; sha: string }\n | { kind: 'commit'; repo: string; sha: string }\n | { kind: 'release'; package: string; version: string };"
6034
+ "declaration": "/**\n * Evidence a ticket carries. A release is a repository's tag `v<version>`: its link names the repository (`org/name`)\n * and the commit the tag points at, and the package it published where there is one; a release linked by hand names\n * the package alone. `affects` records the version of a repository a bug was found in.\n */\ntype TTicketLink =\n | { kind: 'branch'; repo: string; branch: string; sha: string }\n | { kind: 'commit'; repo: string; sha: string }\n | { kind: 'release'; version: string; package?: string; repo?: string; sha?: string }\n | { kind: 'affects'; repo: string; version: string };"
5921
6035
  },
5922
6036
  {
5923
6037
  "name": "TTicketPriority",
@@ -27,6 +27,7 @@ import type {
27
27
  IReq_ControllerAccountsReserveLift,
28
28
  IReq_ControllerAccountsApiKeyAdd,
29
29
  IReq_ControllerAccountsSpendLimit,
30
+ IReq_ControllerAccountsClaudeCode,
30
31
  IReq_ControllerAccountsUsageGet,
31
32
  IReq_ControllerAccountsUsageRecheck,
32
33
  TControllerAccountBinding,
@@ -229,6 +230,17 @@ export class AccountsActions {
229
230
  }));
230
231
  },
231
232
  );
233
+ routerArg.addHandler<IReq_ControllerAccountsClaudeCode>(
234
+ 'controller.accounts.claudecode',
235
+ async (requestArg, toolsArg) => {
236
+ const request = assertRequestShape(requestArg, {
237
+ accountId: 'string', expectedRevision: 'number', claudeCode: 'boolean',
238
+ }) as IReq_ControllerAccountsClaudeCode['request'];
239
+ return hostArg.runAudited(toolsArg?.localData, 'accounts.claudecode', async (signalArg) => ({
240
+ answer: await this.setClaudeCode(request, signalArg),
241
+ }));
242
+ },
243
+ );
232
244
  routerArg.addHandler<IReq_ControllerAccountsRemove>(
233
245
  'controller.accounts.remove',
234
246
  async (requestArg, toolsArg) => {
@@ -508,6 +520,18 @@ export class AccountsActions {
508
520
  return answer;
509
521
  }
510
522
 
523
+ /** Sets whether an API key account may serve Claude Code, and answers once the projection shows it. */
524
+ public async setClaudeCode(
525
+ requestArg: IReq_ControllerAccountsClaudeCode['request'],
526
+ signalArg: AbortSignal,
527
+ ): Promise<TControllerAccountsAnswer<plugins.authswitchAuthority.IAuthSwitchAccount>> {
528
+ const answer = await this.answer((clientArg) => clientArg.setAccountClaudeCode(
529
+ requestArg.accountId, requestArg.expectedRevision, requestArg.claudeCode, signalArg,
530
+ ));
531
+ if (answer.state === 'done') await this.waitForAccountRevision(answer.value, signalArg);
532
+ return answer;
533
+ }
534
+
511
535
  /** Waits until the controller's projection shows the account at `accountArg`'s revision or later. */
512
536
  private async waitForAccountRevision(
513
537
  accountArg: plugins.authswitchAuthority.IAuthSwitchAccount,
@@ -3,6 +3,8 @@ import { DriverModel } from './driver/classes.driverstore.js';
3
3
  import { DirectReportModel } from './driver/classes.directreportstore.js';
4
4
  import { SessionFeedAcknowledgementModel } from './classes.sessionfeedacknowledgements.js';
5
5
  import { HarnessReleaseModel } from './classes.harnessreleases.js';
6
+ import { DeployObservationModel } from './fleet/classes.deploymodels.js';
7
+ import { TicketMigrationMarkerModel } from '../ts_migration/v41_ticketmigrationmarkers.js';
6
8
  import { WorkerCallerBindingModel } from './classes.workercallerbindings.js';
7
9
  import { FleetTicketEffectModel } from './fleet/classes.ticketeffects.js';
8
10
  import { ControllerCodexOriginMigrationModel } from '../ts_migration/v29_codexorigins.js';
@@ -786,6 +788,8 @@ const setAuthStoreModelManager = (
786
788
  plugins.nosqldb.setDefaultManagerForDoc(managerArg, SessionFeedAcknowledgementModel);
787
789
  plugins.nosqldb.setDefaultManagerForDoc(managerArg, FleetTicketEffectModel);
788
790
  plugins.nosqldb.setDefaultManagerForDoc(managerArg, HarnessReleaseModel);
791
+ plugins.nosqldb.setDefaultManagerForDoc(managerArg, DeployObservationModel);
792
+ plugins.nosqldb.setDefaultManagerForDoc(managerArg, TicketMigrationMarkerModel);
789
793
  plugins.nosqldb.setDefaultManagerForDoc(managerArg, WorkerCallerBindingModel);
790
794
  plugins.nosqldb.setDefaultManagerForDoc(managerArg, TicketModel);
791
795
  plugins.nosqldb.setDefaultManagerForDoc(managerArg, TicketBoardModel);
@@ -1062,6 +1066,10 @@ export class SmartDataAuthStore implements IAuthStore, IAuthStoreSessionIdentity
1062
1066
  await FleetTicketEffectModel.exact.prepare();
1063
1067
  await HarnessReleaseModel.init();
1064
1068
  await HarnessReleaseModel.exact.prepare();
1069
+ await DeployObservationModel.init();
1070
+ await DeployObservationModel.exact.prepare();
1071
+ await TicketMigrationMarkerModel.init();
1072
+ await TicketMigrationMarkerModel.exact.prepare();
1065
1073
  await WorkerCallerBindingModel.init();
1066
1074
  await WorkerCallerBindingModel.exact.prepare();
1067
1075
  await TicketModel.init();
package/ts/classes.cli.ts CHANGED
@@ -32,7 +32,6 @@ import {
32
32
  assertControllerStatus,
33
33
  isLoopbackPortListening,
34
34
  queryControllerStatus as queryManagedControllerStatus,
35
- requestControllerUpgradeLaunch,
36
35
  stopRunningController,
37
36
  tryQueryControllerStatus as tryQueryManagedControllerStatus,
38
37
  waitUntilControllerExited,
@@ -68,14 +67,13 @@ import {
68
67
  handoffStalledUpgradeRecoveryUnderLock,
69
68
  type IUpgradeWorkerLaunchCandidate,
70
69
  inspectOrphanedUpgradeForAdoption,
71
- launchDetachedUpgradeWorker,
70
+ launchUpgradeWorkerUnderLock,
72
71
  resolveCurrentCliPath,
73
72
  resolveCurrentPnpmGlobalInstallation,
74
73
  resolveVerifiedPnpmGlobalShim,
75
74
  runUpgradeWorker,
76
75
  terminalizeUpgradeWorkerHandoffFailure,
77
76
  tryResolveCurrentPnpmGlobalInstallation,
78
- UpgradeWorkerCandidateDrainageError,
79
77
  UpgradeWorkerHandoffError,
80
78
  type IPnpmGlobalInstallation,
81
79
  } from './classes.upgradetransaction.js';
@@ -237,7 +235,8 @@ service install writes and enables ${controllerServiceUnitName} for this AGL_HOM
237
235
  --port; it never starts or stops ${currentRuntimeName}. From then on start, stop, restart and
238
236
  upgrade drive that unit, which restarts ${currentRuntimeName} after a failure and starts it at
239
237
  login. Move a running detached controller into it with restart; change its
240
- settings with stop, service install, then start. The unit carries PATH,
238
+ settings with stop, service install, then start. The unit carries PATH
239
+ (this shell's, then the directories the installed unit had that it lacks),
241
240
  AGL_HOME and the database, harness, certificate and proxy variables, never a
242
241
  secret: install refuses while AGL_FORWARD_ENV or a credentialed AGL_MONGO_URL,
243
242
  HTTP_PROXY or HTTPS_PROXY is set. A controller behind a TLS reverse proxy runs
@@ -1518,12 +1517,16 @@ const installControllerService = async (argvArg: TParsedArguments): Promise<void
1518
1517
  executable,
1519
1518
  port,
1520
1519
  logFilePath: service.logFilePath(port),
1520
+ keptPath: installed.keptPath,
1521
1521
  }, null, 2) + '\n');
1522
1522
  return;
1523
1523
  }
1524
1524
  process.stdout.write([
1525
1525
  `${controllerServiceUnitName} ${installed.changed ? 'installed' : 'unchanged'} and enabled: ${installed.record.path}`,
1526
1526
  `Runs: ${executable} __serve --service --port ${port}`,
1527
+ ...(installed.keptPath.length > 0
1528
+ ? [`PATH keeps after this shell's entries what the installed unit had: ${installed.keptPath.join(plugins.path.delimiter)}`]
1529
+ : []),
1527
1530
  `Logs: ${service.logFilePath(port)}`,
1528
1531
  next,
1529
1532
  ].join('\n') + '\n');
@@ -1747,57 +1750,17 @@ const upgradeController = async (argvArg: TParsedArguments): Promise<void> => {
1747
1750
  gracePeriodMs: payload.gracePeriodMs,
1748
1751
  });
1749
1752
  try {
1750
- if (status) {
1751
- await coordinator.createLaunchGrant({
1752
- token: payload.token,
1753
- port,
1754
- packageName: controllerPackageName,
1755
- packageVersion: commitinfo.version,
1756
- cliPath: installation.cliPath,
1757
- controller: payload.expectedController!,
1758
- });
1759
- try {
1760
- const launched = await requestControllerUpgradeLaunch(port, status, payload.token);
1761
- worker = {
1762
- pid: launched.workerPid,
1763
- cliPath: installation.cliPath,
1764
- logFilePath: launched.logFilePath,
1765
- };
1766
- } finally {
1767
- await coordinator.removeLaunchGrant(payload.token);
1768
- }
1769
- } else {
1770
- const launched = await launchDetachedUpgradeWorker({ installation, payload });
1771
- worker = launched;
1772
- }
1753
+ worker = await launchUpgradeWorkerUnderLock({
1754
+ coordinator,
1755
+ installation,
1756
+ lock: invocationLease,
1757
+ payload,
1758
+ ...(status ? { status } : {}),
1759
+ });
1773
1760
  } catch (errorArg) {
1774
- if (errorArg instanceof UpgradeWorkerCandidateDrainageError || status) {
1775
- invocationLeaseHandled = true;
1776
- throw errorArg instanceof UpgradeWorkerCandidateDrainageError
1777
- ? errorArg
1778
- : new UpgradeWorkerCandidateDrainageError(
1779
- 'The controller upgrade launch failed and candidate drainage cannot be proven by the CLI.',
1780
- errorArg,
1781
- );
1782
- }
1783
- const transaction = await coordinator.readTransaction(payload.token);
1784
- if (transaction.worker?.logFilePath) {
1785
- worker = {
1786
- pid: transaction.worker.pid,
1787
- processGroupId: transaction.worker.processGroupId,
1788
- fingerprint: transaction.worker.fingerprint,
1789
- cliPath: transaction.worker.cliPath,
1790
- logFilePath: transaction.worker.logFilePath,
1791
- };
1792
- } else {
1793
- await coordinator.finishTransaction(
1794
- payload.token,
1795
- false,
1796
- 'The upgrade worker could not be launched.',
1797
- errorArg instanceof Error ? errorArg.message : String(errorArg),
1798
- );
1799
- throw errorArg;
1800
- }
1761
+ // A failed launch has released the lock with the failed transaction, or keeps both for a worker that may run.
1762
+ invocationLeaseHandled = true;
1763
+ throw errorArg;
1801
1764
  }
1802
1765
  try {
1803
1766
  try {
@@ -548,7 +548,7 @@ export class ConfigurationAuthority {
548
548
  const head = await this.requireResource(inputArg.resourceId);
549
549
  const expected = inputArg.expectedRevision === null ? '' : assertRevision(inputArg.expectedRevision, 'Expected master revision');
550
550
  if (head.masterRevision !== expected) throw new ConfigurationError('conflict', 'The master changed since this edit started; reload it.');
551
- const serialized = serializeMaster(validateMaster(inputArg.master));
551
+ const serialized = serializeMaster(validateMaster(inputArg.master, { save: true }));
552
552
  const revision = masterRevision(serialized);
553
553
  if (revision === head.masterRevision) return { revision };
554
554
  const { ConfigurationMasterModel: Master, ConfigurationHeadModel: Head } = this.modelSet;
@@ -159,6 +159,29 @@ export const controllerServiceEnvironment = (environmentArg: NodeJS.ProcessEnv):
159
159
  return environment;
160
160
  };
161
161
 
162
+ /**
163
+ * The `PATH` a rewritten unit carries (AGL-1108): the installing shell's `PATH` as it is, then each entry of the
164
+ * installed unit's `PATH` it lacks, in the installed order. The installing shell decides precedence, so a new
165
+ * toolchain it puts first wins; a directory the controller ran with is kept behind it, so a shell without some
166
+ * tool directory never removes it. Only an absolute directory that still exists is kept: an empty or relative entry
167
+ * would resolve against the unit's working directory, and a removed one, such as a deleted Node.js version, would
168
+ * otherwise stay forever. A first install has no installed `PATH` and carries the shell's unchanged.
169
+ */
170
+ export const controllerServicePath = async (
171
+ installerPathArg: string,
172
+ installedPathArg: string | undefined,
173
+ ): Promise<{ path: string; kept: string[] }> => {
174
+ const present = new Set(installerPathArg.split(plugins.path.delimiter));
175
+ const kept: string[] = [];
176
+ for (const entry of installedPathArg?.split(plugins.path.delimiter) ?? []) {
177
+ if (present.has(entry) || !plugins.path.isAbsolute(entry)) continue;
178
+ present.add(entry);
179
+ const stats = await plugins.fs.promises.stat(entry).catch(() => null);
180
+ if (stats?.isDirectory()) kept.push(entry);
181
+ }
182
+ return { path: [installerPathArg, ...kept].join(plugins.path.delimiter), kept };
183
+ };
184
+
162
185
  /** The controller service as `agl service install` left it, read back from the file and the manager. */
163
186
  export interface IInstalledControllerService {
164
187
  record: plugins.smartdaemon.ISystemdUnitFileRecord;
@@ -232,11 +255,15 @@ export class AglControllerService {
232
255
  return resolveControllerLogFilePath(resolveAGLHomePaths({ environment: this.environment }).logs, portArg);
233
256
  }
234
257
 
235
- /** The unit AGL writes for `executableArg` (the verified pnpm-global shim) on `portArg`. */
258
+ /**
259
+ * The unit AGL writes for `executableArg` (the verified pnpm-global shim) on `portArg`, with the installing
260
+ * shell's `PATH` unless `path` (`controllerServicePath`) replaces it.
261
+ */
236
262
  public definition(optionsArg: {
237
263
  executable: string;
238
264
  port: number;
239
265
  overrides: IControllerServiceOverrides;
266
+ path?: string;
240
267
  }): plugins.smartdaemon.SystemdServiceDefinition {
241
268
  if (!Number.isInteger(optionsArg.port) || optionsArg.port < 1 || optionsArg.port > 65_535) {
242
269
  throw new Error('The controller port must be 1 to 65535.');
@@ -263,7 +290,10 @@ export class AglControllerService {
263
290
  conflicts: [],
264
291
  },
265
292
  install: { wantedBy: ['default.target'], requiredBy: [] },
266
- environment: controllerServiceEnvironment(this.environment),
293
+ environment: {
294
+ ...controllerServiceEnvironment(this.environment),
295
+ ...(optionsArg.path === undefined ? {} : { PATH: optionsArg.path }),
296
+ },
267
297
  // Standard output stays discarded, as for a detached controller: the transport logs every connection there.
268
298
  standardOutput: 'null',
269
299
  standardError: { append: this.logFilePath(optionsArg.port) },
@@ -273,17 +303,30 @@ export class AglControllerService {
273
303
  /**
274
304
  * Writes the unit and enables it, so the user manager starts the controller at login or boot. Never starts or
275
305
  * stops it: unchanged bytes are left alone, so this also runs while the unit does, and a changed definition is
276
- * refused while the unit runs (`agl stop` first, then `agl start` once it is written).
306
+ * refused while the unit runs (`agl stop` first, then `agl start` once it is written). A rewrite keeps the
307
+ * installed unit's `PATH` directories the installing shell lacks (`controllerServicePath`), named in `keptPath`.
277
308
  */
278
309
  public async install(optionsArg: {
279
310
  executable: string;
280
311
  port: number;
281
312
  overrides: IControllerServiceOverrides;
282
- }): Promise<{ changed: boolean; record: plugins.smartdaemon.ISystemdUnitFileRecord; state: plugins.smartdaemon.ISystemdUnitState }> {
283
- const definition = this.definition(optionsArg);
313
+ }): Promise<{
314
+ changed: boolean;
315
+ record: plugins.smartdaemon.ISystemdUnitFileRecord;
316
+ state: plugins.smartdaemon.ISystemdUnitState;
317
+ keptPath: string[];
318
+ }> {
319
+ let definition = this.definition(optionsArg);
284
320
  await this.unit.requireManagerVersion(controllerServiceManagerMajor);
285
321
  await prepareControllerLogFile(this.logFilePath(optionsArg.port));
286
322
  const previous = await this.unitFile.inspect();
323
+ let keptPath: string[] = [];
324
+ if (previous) {
325
+ const installedPath = (await this.unit.inspectServiceSettings()).environment.PATH;
326
+ const merged = await controllerServicePath(controllerServiceEnvironment(this.environment).PATH, installedPath);
327
+ keptPath = merged.kept;
328
+ if (keptPath.length > 0) definition = this.definition({ ...optionsArg, path: merged.path });
329
+ }
287
330
  let record = previous;
288
331
  let changed = false;
289
332
  if (previous?.sha256 !== definition.sha256) {
@@ -301,7 +344,7 @@ export class AglControllerService {
301
344
  }
302
345
  let state = await this.unit.inspect();
303
346
  if (state.unitFileState !== 'enabled') state = await this.unit.enable();
304
- return { changed, record: record!, state };
347
+ return { changed, record: record!, state, keptPath };
305
348
  }
306
349
 
307
350
  /** The installed unit, or null when no unit file exists; the manager is contacted only when one does. */
@@ -14,6 +14,7 @@ import {
14
14
  filesystemIdentitiesEqual,
15
15
  } from './functions.canonicaldirectory.js';
16
16
  import { controllerProjectLimit } from './interfaces.projects.js';
17
+ import { controllerMcpMaximumNodeMajorExclusive, controllerMcpMinimumNodeMajor } from './classes.mcpplatform.js';
17
18
  import {
18
19
  FlexHostRequestFailureError,
19
20
  FlexServiceError,
@@ -209,7 +210,6 @@ interface IFlexUploadGrant {
209
210
  runId?: string;
210
211
  }
211
212
 
212
- const supportedNodeMajors = new Set([24, 25]);
213
213
  const toolOutputBytes = 256 * 1024;
214
214
  const providerOperationTimeoutMs = 30_000;
215
215
  const flexModelHintPrefix = 'hcon-flex-choice:';
@@ -532,9 +532,14 @@ export const projectFlexChildError = (
532
532
  publicFlexChildFailure(errorArg) ?? opaqueArg
533
533
  );
534
534
 
535
+ /**
536
+ * Flex runs on the Node.js majors AGL itself runs on (`engines`, the range `agl mcp` checks), on Linux x64 (AGL-1156).
537
+ * It used to stop at 25 while `engines` admitted 26, so a controller on Node.js 26 had no Flex.
538
+ */
535
539
  const runtimeSupported = (): boolean => {
536
540
  const major = Number.parseInt(process.versions.node.split('.')[0] ?? '', 10);
537
- return supportedNodeMajors.has(major) && process.platform === 'linux' && process.arch === 'x64';
541
+ return major >= controllerMcpMinimumNodeMajor && major < controllerMcpMaximumNodeMajorExclusive
542
+ && process.platform === 'linux' && process.arch === 'x64';
538
543
  };
539
544
 
540
545
  const maximumPromptCorrelations = flexIpcMaximumPromptQueueEntries * 2;