buildhive-agent 1.0.0-beta.1 → 1.0.0-beta.10

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 (241) hide show
  1. package/LICENSE +194 -0
  2. package/README.md +167 -3
  3. package/dist/auth/agentEnrollmentKeyringStore.d.ts +78 -0
  4. package/dist/auth/agentEnrollmentKeyringStore.js +149 -0
  5. package/dist/auth/deviceFlow.d.ts +45 -0
  6. package/dist/auth/deviceFlow.js +85 -0
  7. package/dist/auth/deviceFlowClient.d.ts +70 -0
  8. package/dist/auth/deviceFlowClient.js +110 -0
  9. package/dist/auth/joinCommand.d.ts +29 -0
  10. package/dist/auth/joinCommand.js +208 -0
  11. package/dist/auth/keyringStore.d.ts +88 -0
  12. package/dist/auth/keyringStore.js +189 -0
  13. package/dist/auth/loginCommand.d.ts +24 -0
  14. package/dist/auth/loginCommand.js +62 -0
  15. package/dist/auth/logoutCommand.d.ts +16 -0
  16. package/dist/auth/logoutCommand.js +22 -0
  17. package/dist/auth/tokenManager.d.ts +54 -0
  18. package/dist/auth/tokenManager.js +78 -0
  19. package/dist/auth/types.d.ts +98 -0
  20. package/dist/auth/types.js +69 -0
  21. package/dist/auth/whoamiCommand.d.ts +14 -0
  22. package/dist/auth/whoamiCommand.js +28 -0
  23. package/dist/autoUpdater.d.ts +186 -111
  24. package/dist/autoUpdater.js +480 -420
  25. package/dist/cacheManager.d.ts +0 -1
  26. package/dist/cacheManager.js +0 -1
  27. package/dist/cacheServer/denylist.d.ts +24 -0
  28. package/dist/cacheServer/denylist.js +109 -0
  29. package/dist/cacheServer/index.d.ts +75 -0
  30. package/dist/cacheServer/index.js +86 -0
  31. package/dist/cacheServer/protocol.d.ts +91 -0
  32. package/dist/cacheServer/protocol.js +499 -0
  33. package/dist/cli-guard.d.ts +16 -0
  34. package/dist/cli-guard.js +26 -0
  35. package/dist/cli.d.ts +16 -2
  36. package/dist/cli.js +371 -435
  37. package/dist/config/index.d.ts +0 -1
  38. package/dist/config/index.js +0 -1
  39. package/dist/config/loader.d.ts +5 -2
  40. package/dist/config/loader.js +23 -6
  41. package/dist/config/types.d.ts +14 -2
  42. package/dist/config/types.js +17 -9
  43. package/dist/config/validation.d.ts +0 -1
  44. package/dist/config/validation.js +27 -1
  45. package/dist/doctor/cacheCheck.d.ts +47 -0
  46. package/dist/doctor/cacheCheck.js +96 -0
  47. package/dist/doctor/index.d.ts +22 -0
  48. package/dist/doctor/index.js +122 -0
  49. package/dist/doctor/runChecks.d.ts +78 -0
  50. package/dist/doctor/runChecks.js +483 -0
  51. package/dist/index.d.ts +5 -7
  52. package/dist/index.js +11 -7
  53. package/dist/main.d.ts +27 -2
  54. package/dist/main.js +139 -27
  55. package/dist/metrics.d.ts +0 -1
  56. package/dist/metrics.js +0 -1
  57. package/dist/platform/caffeinate.d.ts +79 -0
  58. package/dist/platform/caffeinate.js +122 -0
  59. package/dist/registration/apiClient.d.ts +9 -3
  60. package/dist/registration/apiClient.js +15 -5
  61. package/dist/registration/index.d.ts +7 -1
  62. package/dist/registration/index.js +5 -3
  63. package/dist/registration/machineId.d.ts +0 -1
  64. package/dist/registration/machineId.js +0 -1
  65. package/dist/registration/types.d.ts +13 -2
  66. package/dist/registration/types.js +0 -1
  67. package/dist/resourceGovernor.d.ts +0 -1
  68. package/dist/resourceGovernor.js +0 -1
  69. package/dist/runner/binaryFetcher.d.ts +136 -0
  70. package/dist/runner/binaryFetcher.js +522 -0
  71. package/dist/runner/cacheEnv.d.ts +101 -0
  72. package/dist/runner/cacheEnv.js +124 -0
  73. package/dist/runner/cacheStatsReporter.d.ts +46 -0
  74. package/dist/runner/cacheStatsReporter.js +92 -0
  75. package/dist/runner/deviceInfo.d.ts +28 -0
  76. package/dist/runner/deviceInfo.js +31 -0
  77. package/dist/runner/heartbeat.d.ts +75 -0
  78. package/dist/runner/heartbeat.js +134 -0
  79. package/dist/runner/pool.d.ts +94 -0
  80. package/dist/runner/pool.js +263 -0
  81. package/dist/runner/startCommand.d.ts +70 -0
  82. package/dist/runner/startCommand.js +378 -0
  83. package/dist/runner/supervisor.d.ts +109 -0
  84. package/dist/runner/supervisor.js +281 -0
  85. package/dist/runner/tokenClient.d.ts +38 -0
  86. package/dist/runner/tokenClient.js +95 -0
  87. package/dist/security/keyringSecretStore.d.ts +106 -0
  88. package/dist/security/keyringSecretStore.js +196 -0
  89. package/dist/security/logRedactor.d.ts +72 -0
  90. package/dist/security/logRedactor.js +164 -0
  91. package/dist/security/secretManager.d.ts +86 -7
  92. package/dist/security/secretManager.js +177 -9
  93. package/dist/security/secretStore.d.ts +37 -0
  94. package/dist/security/secretStore.js +22 -0
  95. package/dist/security.d.ts +1 -1
  96. package/dist/security.js +37 -5
  97. package/dist/service/migrator.d.ts +169 -0
  98. package/dist/service/migrator.js +327 -0
  99. package/dist/service/paths.d.ts +129 -0
  100. package/dist/service/paths.js +171 -0
  101. package/dist/service/plistGenerator.d.ts +122 -0
  102. package/dist/service/plistGenerator.js +322 -0
  103. package/dist/service/serviceInstaller.d.ts +99 -0
  104. package/dist/service/serviceInstaller.js +184 -0
  105. package/dist/storage/artifactUploader.d.ts +0 -1
  106. package/dist/storage/artifactUploader.js +0 -1
  107. package/dist/types.d.ts +0 -1
  108. package/dist/types.js +0 -1
  109. package/dist/utils/capabilities.d.ts +0 -1
  110. package/dist/utils/capabilities.js +0 -1
  111. package/dist/utils/logger.d.ts +13 -9
  112. package/dist/utils/logger.js +192 -156
  113. package/dist/utils/sdkScanner.d.ts +0 -1
  114. package/dist/utils/sdkScanner.js +0 -1
  115. package/dist/utils/sentry.d.ts +43 -0
  116. package/dist/utils/sentry.js +133 -0
  117. package/package.json +39 -26
  118. package/dist/__tests__/fakes/FakeDockerManager.d.ts +0 -115
  119. package/dist/__tests__/fakes/FakeDockerManager.d.ts.map +0 -1
  120. package/dist/__tests__/fakes/FakeDockerManager.js +0 -203
  121. package/dist/__tests__/fakes/FakeDockerManager.js.map +0 -1
  122. package/dist/acceptanceChecker.d.ts +0 -26
  123. package/dist/acceptanceChecker.d.ts.map +0 -1
  124. package/dist/acceptanceChecker.js +0 -64
  125. package/dist/acceptanceChecker.js.map +0 -1
  126. package/dist/advancedAgent.d.ts +0 -161
  127. package/dist/advancedAgent.d.ts.map +0 -1
  128. package/dist/advancedAgent.js +0 -604
  129. package/dist/advancedAgent.js.map +0 -1
  130. package/dist/agent.d.ts +0 -101
  131. package/dist/agent.d.ts.map +0 -1
  132. package/dist/agent.js +0 -490
  133. package/dist/agent.js.map +0 -1
  134. package/dist/api/jobStatusApi.d.ts +0 -88
  135. package/dist/api/jobStatusApi.d.ts.map +0 -1
  136. package/dist/api/jobStatusApi.js +0 -240
  137. package/dist/api/jobStatusApi.js.map +0 -1
  138. package/dist/autoUpdater.d.ts.map +0 -1
  139. package/dist/autoUpdater.js.map +0 -1
  140. package/dist/cacheManager.d.ts.map +0 -1
  141. package/dist/cacheManager.js.map +0 -1
  142. package/dist/cli.d.ts.map +0 -1
  143. package/dist/cli.js.map +0 -1
  144. package/dist/config/index.d.ts.map +0 -1
  145. package/dist/config/index.js.map +0 -1
  146. package/dist/config/loader.d.ts.map +0 -1
  147. package/dist/config/loader.js.map +0 -1
  148. package/dist/config/types.d.ts.map +0 -1
  149. package/dist/config/types.js.map +0 -1
  150. package/dist/config/validation.d.ts.map +0 -1
  151. package/dist/config/validation.js.map +0 -1
  152. package/dist/docker.d.ts +0 -96
  153. package/dist/docker.d.ts.map +0 -1
  154. package/dist/docker.js +0 -411
  155. package/dist/docker.js.map +0 -1
  156. package/dist/enhancedJobExecutor.d.ts +0 -81
  157. package/dist/enhancedJobExecutor.d.ts.map +0 -1
  158. package/dist/enhancedJobExecutor.js +0 -223
  159. package/dist/enhancedJobExecutor.js.map +0 -1
  160. package/dist/executors/executorFactory.d.ts +0 -46
  161. package/dist/executors/executorFactory.d.ts.map +0 -1
  162. package/dist/executors/executorFactory.js +0 -80
  163. package/dist/executors/executorFactory.js.map +0 -1
  164. package/dist/executors/index.d.ts +0 -7
  165. package/dist/executors/index.d.ts.map +0 -1
  166. package/dist/executors/index.js +0 -6
  167. package/dist/executors/index.js.map +0 -1
  168. package/dist/executors/nativeExecutor.d.ts +0 -60
  169. package/dist/executors/nativeExecutor.d.ts.map +0 -1
  170. package/dist/executors/nativeExecutor.js +0 -311
  171. package/dist/executors/nativeExecutor.js.map +0 -1
  172. package/dist/executors/types.d.ts +0 -38
  173. package/dist/executors/types.d.ts.map +0 -1
  174. package/dist/executors/types.js +0 -9
  175. package/dist/executors/types.js.map +0 -1
  176. package/dist/healthMonitor.d.ts +0 -213
  177. package/dist/healthMonitor.d.ts.map +0 -1
  178. package/dist/healthMonitor.js +0 -547
  179. package/dist/healthMonitor.js.map +0 -1
  180. package/dist/index.d.ts.map +0 -1
  181. package/dist/index.js.map +0 -1
  182. package/dist/jobExecutor.d.ts +0 -117
  183. package/dist/jobExecutor.d.ts.map +0 -1
  184. package/dist/jobExecutor.js +0 -458
  185. package/dist/jobExecutor.js.map +0 -1
  186. package/dist/lifecycleExecutor.d.ts +0 -54
  187. package/dist/lifecycleExecutor.d.ts.map +0 -1
  188. package/dist/lifecycleExecutor.js +0 -230
  189. package/dist/lifecycleExecutor.js.map +0 -1
  190. package/dist/main.d.ts.map +0 -1
  191. package/dist/main.js.map +0 -1
  192. package/dist/metrics.d.ts.map +0 -1
  193. package/dist/metrics.js.map +0 -1
  194. package/dist/recipes/builtinRecipes.d.ts +0 -11
  195. package/dist/recipes/builtinRecipes.d.ts.map +0 -1
  196. package/dist/recipes/builtinRecipes.js +0 -688
  197. package/dist/recipes/builtinRecipes.js.map +0 -1
  198. package/dist/recipes/index.d.ts +0 -18
  199. package/dist/recipes/index.d.ts.map +0 -1
  200. package/dist/recipes/index.js +0 -17
  201. package/dist/recipes/index.js.map +0 -1
  202. package/dist/recipes/recipeRegistry.d.ts +0 -49
  203. package/dist/recipes/recipeRegistry.d.ts.map +0 -1
  204. package/dist/recipes/recipeRegistry.js +0 -264
  205. package/dist/recipes/recipeRegistry.js.map +0 -1
  206. package/dist/recipes/types.d.ts +0 -116
  207. package/dist/recipes/types.d.ts.map +0 -1
  208. package/dist/recipes/types.js +0 -10
  209. package/dist/recipes/types.js.map +0 -1
  210. package/dist/recovery.d.ts +0 -133
  211. package/dist/recovery.d.ts.map +0 -1
  212. package/dist/recovery.js +0 -299
  213. package/dist/recovery.js.map +0 -1
  214. package/dist/registration/apiClient.d.ts.map +0 -1
  215. package/dist/registration/apiClient.js.map +0 -1
  216. package/dist/registration/index.d.ts.map +0 -1
  217. package/dist/registration/index.js.map +0 -1
  218. package/dist/registration/machineId.d.ts.map +0 -1
  219. package/dist/registration/machineId.js.map +0 -1
  220. package/dist/registration/types.d.ts.map +0 -1
  221. package/dist/registration/types.js.map +0 -1
  222. package/dist/resourceGovernor.d.ts.map +0 -1
  223. package/dist/resourceGovernor.js.map +0 -1
  224. package/dist/security/secretManager.d.ts.map +0 -1
  225. package/dist/security/secretManager.js.map +0 -1
  226. package/dist/security.d.ts.map +0 -1
  227. package/dist/security.js.map +0 -1
  228. package/dist/storage/artifactUploader.d.ts.map +0 -1
  229. package/dist/storage/artifactUploader.js.map +0 -1
  230. package/dist/types.d.ts.map +0 -1
  231. package/dist/types.js.map +0 -1
  232. package/dist/utils/capabilities.d.ts.map +0 -1
  233. package/dist/utils/capabilities.js.map +0 -1
  234. package/dist/utils/logger.d.ts.map +0 -1
  235. package/dist/utils/logger.js.map +0 -1
  236. package/dist/utils/sdkScanner.d.ts.map +0 -1
  237. package/dist/utils/sdkScanner.js.map +0 -1
  238. package/dist/websocketClient.d.ts +0 -154
  239. package/dist/websocketClient.d.ts.map +0 -1
  240. package/dist/websocketClient.js +0 -422
  241. package/dist/websocketClient.js.map +0 -1
package/LICENSE ADDED
@@ -0,0 +1,194 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship made available under
36
+ the License, as indicated by a copyright notice that is included in
37
+ or attached to the work (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other transformations
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
48
+ in the Work by the copyright owner or by an individual or Legal Entity
49
+ authorized to submit on behalf of the copyright owner. For the purposes
50
+ of this definition, "submit" means any form of electronic, verbal, or
51
+ written communication sent to the Licensor or its representatives,
52
+ including but not limited to communication on electronic mailing lists,
53
+ source code control systems, and issue tracking systems that are managed
54
+ by, or on behalf of, the Licensor for the purpose of discussing and
55
+ improving the Work, but excluding communication that is conspicuously
56
+ marked or designated in writing by the copyright owner as "Not a
57
+ Contribution."
58
+
59
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
60
+ whom a Contribution has been received by the Licensor and incorporated
61
+ within the Work.
62
+
63
+ 2. Grant of Copyright License. Subject to the terms and conditions of
64
+ this License, each Contributor hereby grants to You a perpetual,
65
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
66
+ copyright license to reproduce, prepare Derivative Works of,
67
+ publicly display, publicly perform, sublicense, and distribute the
68
+ Work and such Derivative Works in Source or Object form.
69
+
70
+ 3. Grant of Patent License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ (except as stated in this section) patent license to make, have made,
74
+ use, offer to sell, sell, import, and otherwise transfer the Work,
75
+ where such license applies only to those patent claims licensable
76
+ by such Contributor that are necessarily infringed by their
77
+ Contribution(s) alone or by the combination of their Contribution(s)
78
+ with the Work to which such Contribution(s) was submitted. If You
79
+ institute patent litigation against any entity (including a cross-claim
80
+ or counterclaim in a lawsuit) alleging that the Work or any
81
+ Contribution embodied within the Work constitutes direct or contributory
82
+ patent infringement, then any patent licenses granted to You under
83
+ this License for that Work shall terminate as of the date such
84
+ litigation is filed.
85
+
86
+ 4. Redistribution. You may reproduce and distribute copies of the
87
+ Work or Derivative Works thereof in any medium, with or without
88
+ modifications, and in Source or Object form, provided that You
89
+ meet the following conditions:
90
+
91
+ (a) You must give any other recipients of the Work or Derivative
92
+ Works a copy of this License; and
93
+
94
+ (b) You must cause any modified files to carry prominent notices
95
+ stating that You changed the files; and
96
+
97
+ (c) You must retain, in the Source form of any Derivative Works
98
+ that You distribute, all copyright, patent, trademark, and
99
+ attribution notices from the Source form of the Work,
100
+ excluding those notices that do not pertain to any part of
101
+ the Derivative Works; and
102
+
103
+ (d) If the Work includes a "NOTICE" text file as part of its
104
+ distribution, You must include a readable copy of the
105
+ attribution notices contained within such NOTICE file, in
106
+ at least one of the following places: within a NOTICE text
107
+ file distributed as part of the Derivative Works; within
108
+ the Source form or documentation, if provided along with the
109
+ Derivative Works; or, within a display generated by the
110
+ Derivative Works, if and wherever such third-party notices
111
+ normally appear. The contents of the NOTICE file are for
112
+ informational purposes only and do not modify the License.
113
+ You may add Your own attribution notices within Derivative
114
+ Works that You distribute, alongside or as an addendum to
115
+ the NOTICE text from the Work, provided that such additional
116
+ attribution notices cannot be construed as modifying the License.
117
+
118
+ You may add Your own license statement for Your modifications and
119
+ may provide additional grant of rights to use, copy, modify, merge,
120
+ publish, distribute, sublicense, and/or sell copies of the
121
+ Derivative Works, as set forth in this Section, provided, however,
122
+ that such additional terms cannot be construed as a modification
123
+ of this License.
124
+
125
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
126
+ any Contribution intentionally submitted for inclusion in the Work
127
+ by You to the Licensor shall be under the terms and conditions of
128
+ this License, without any additional terms or conditions.
129
+ Notwithstanding the above, nothing herein shall supersede or modify
130
+ the terms of any separate license agreement you may have executed
131
+ with Licensor regarding such Contributions.
132
+
133
+ 6. Trademarks. This License does not grant permission to use the trade
134
+ names, trademarks, service marks, or product names of the Licensor,
135
+ except as required for reasonable and customary use in describing the
136
+ origin of the Work and reproducing the content of the NOTICE file.
137
+
138
+ 7. Disclaimer of Warranty. Unless required by applicable law or
139
+ agreed to in writing, Licensor provides the Work (and each
140
+ Contributor provides its Contributions) on an "AS IS" BASIS,
141
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
142
+ implied, including, without limitation, any warranties or conditions
143
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
144
+ PARTICULAR PURPOSE. You are solely responsible for determining the
145
+ appropriateness of using or redistributing the Work and assume any
146
+ risks associated with Your exercise of permissions under this License.
147
+
148
+ 8. Limitation of Liability. In no event and under no legal theory,
149
+ whether in tort (including negligence), contract, or otherwise,
150
+ unless required by applicable law (such as deliberate and grossly
151
+ negligent acts) or agreed to in writing, shall any Contributor be
152
+ liable to You for damages, including any direct, indirect, special,
153
+ incidental, or exemplary damages of any character arising as a
154
+ result of this License or out of the use or inability to use the
155
+ Work (including but not limited to damages for loss of goodwill,
156
+ work stoppage, computer failure or malfunction, or all other
157
+ commercial damages or losses), even if such Contributor has been
158
+ advised of the possibility of such damages.
159
+
160
+ 9. Accepting Warranty or Additional Liability. While redistributing
161
+ the Work or Derivative Works thereof, You may choose to offer,
162
+ and charge a fee for, acceptance of support, warranty, indemnity,
163
+ or other liability obligations and/or rights consistent with this
164
+ License. However, in accepting such obligations, You may offer
165
+ such conditions only on Your own behalf and on Your sole
166
+ responsibility, not on behalf of any other Contributor, and
167
+ only if You agree to indemnify, defend, and hold each Contributor
168
+ harmless for any liability incurred by, or claims asserted against,
169
+ such Contributor by reason of your accepting any warranty or
170
+ additional liability.
171
+
172
+ END OF TERMS AND CONDITIONS
173
+
174
+ APPENDIX: How to apply the Apache License to your work.
175
+
176
+ To apply the Apache License to your work, attach the following
177
+ boilerplate notice, with the fields enclosed by brackets "[]"
178
+ replaced with your own identifying information. (Don't include
179
+ the brackets!) The text should be enclosed in the appropriate
180
+ comment syntax for the file format in use.
181
+
182
+ Copyright 2026 BuildHive contributors
183
+
184
+ Licensed under the Apache License, Version 2.0 (the "License");
185
+ you may not use this file except in compliance with the License.
186
+ You may obtain a copy of the License at
187
+
188
+ http://www.apache.org/licenses/LICENSE-2.0
189
+
190
+ Unless required by applicable law or agreed to in writing, software
191
+ distributed under the License is distributed on an "AS IS" BASIS,
192
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
193
+ See the License for the specific language governing permissions and
194
+ limitations under the License.
package/README.md CHANGED
@@ -30,7 +30,7 @@ All configuration options can be overridden using environment variables:
30
30
 
31
31
  | Environment Variable | Configuration Field | Type | Example |
32
32
  |---------------------|---------------------|------|---------|
33
- | `BUILDHIVE_PLATFORM_URL` | `platformUrl` | string | `https://api.buildhive.dev` |
33
+ | `BUILDHIVE_PLATFORM_URL` | `platformUrl` | string | `https://api.buildhive.app` |
34
34
  | `BUILDHIVE_API_KEY` | `apiKey` | string | `your-api-key` |
35
35
  | `BUILDHIVE_AGENT_ID` | `agentId` | string | `agent-123` |
36
36
  | `BUILDHIVE_AGENT_NAME` | `name` | string | `My Agent` |
@@ -86,7 +86,7 @@ Note: You cannot specify both `allowedRepositories` and `blockedRepositories`.
86
86
 
87
87
  ```json
88
88
  {
89
- "platformUrl": "https://api.buildhive.dev",
89
+ "platformUrl": "https://api.buildhive.app",
90
90
  "apiKey": "your-api-key-here",
91
91
  "agentId": "agent-unique-id",
92
92
  "name": "My Build Agent",
@@ -122,8 +122,116 @@ Note: You cannot specify both `allowedRepositories` and `blockedRepositories`.
122
122
  }
123
123
  ```
124
124
 
125
+ ## Build cache (opt-in)
126
+
127
+ BuildHive can cache npm/pip/gradle/cargo/etc. dependencies locally on your
128
+ machine to speed up repeat builds. **This is OFF by default.**
129
+
130
+ To enable, pick ONE of:
131
+
132
+ - Environment variable (recommended for trying it out):
133
+ ```bash
134
+ BUILDHIVE_CACHE_ENABLED=1 buildhive-agent start
135
+ ```
136
+
137
+ - Config file (persistent across restarts):
138
+ ```json
139
+ {
140
+ "cacheConfig": {
141
+ "enabled": true,
142
+ "directory": "/tmp/buildhive/cache",
143
+ "maxSizeGB": 20,
144
+ "strategy": "lru"
145
+ }
146
+ }
147
+ ```
148
+
149
+ The cache lives entirely on your local disk under the configured directory.
150
+ Nothing is uploaded anywhere. To wipe it manually:
151
+
152
+ ```bash
153
+ buildhive-agent stop
154
+ rm -rf ~/.buildhive/cache
155
+ ```
156
+
157
+ Verify your cache is on or off with:
158
+
159
+ ```bash
160
+ buildhive-agent doctor
161
+ ```
162
+
163
+ `Cache` row in the output shows the current state (OFF/ON), size, and entry count.
164
+
165
+ ### What is NOT cached
166
+
167
+ For safety, the following path patterns are refused even if a workflow tries
168
+ to cache them (defense-in-depth against accidental credential caching):
169
+
170
+ - `~/.aws/**`
171
+ - `~/.ssh/**`
172
+ - `**/.env*`
173
+ - `**/credentials`
174
+ - `**/.netrc`
175
+ - `**/.npmrc`
176
+ - `**/.docker/config.json`
177
+ - `~/.kube/config`
178
+ - `**/.gnupg/**`
179
+ - `**/*.pem`
180
+ - `**/*.key`
181
+ - `**/*.p12`
182
+ - `**/*.pfx`
183
+ - `**/id_rsa*`
184
+ - `**/id_ed25519*`
185
+ - `**/id_ecdsa*`
186
+
187
+ If a cache request is refused you'll see `denied:<reason>` in the agent logs.
188
+
189
+ ### When to disable cache
190
+
191
+ If a build produces incorrect output and you suspect cache staleness:
192
+
193
+ ```bash
194
+ BUILDHIVE_CACHE_ENABLED=0 buildhive-agent start # one-off override
195
+ ```
196
+
197
+ Or set `cacheConfig.enabled: false` in your config file.
198
+
199
+ Always treat cache as advisory — if a build fails with cache, retry without
200
+ cache before assuming it's a real failure.
201
+
125
202
  ## Installation
126
203
 
204
+ ### End-user install (recommended)
205
+
206
+ ```bash
207
+ # 1. Install the agent globally via npm
208
+ npm install -g buildhive-agent
209
+
210
+ # 2. Initialize config (creates ~/.buildhive/buildhive-agent.json)
211
+ buildhive-agent init
212
+
213
+ # 3. Install as a launchd service
214
+ buildhive-agent service:install # macOS LaunchAgent (default)
215
+ buildhive-agent service:install --system # build-farm LaunchDaemon (opt-in,
216
+ # runs as _buildhive — NEVER root)
217
+
218
+ # 4. Verify
219
+ buildhive-agent service:status
220
+ buildhive-agent doctor
221
+ ```
222
+
223
+ Migrating from a pre-2026-05-10 LaunchDaemon install:
224
+
225
+ ```bash
226
+ buildhive-agent service:migrate --dry-run # detect first
227
+ buildhive-agent service:migrate # cleans legacy + installs LaunchAgent
228
+ ```
229
+
230
+ Distribution + daemon-model constraints are documented in `CLAUDE.md`
231
+ under "Phase 10 binding architectural constraints".
232
+
233
+ ### Development install (from source)
234
+
127
235
  ```bash
128
236
  npm install
129
237
  ```
@@ -163,4 +271,60 @@ const validation = validateConfigFile('./config.json');
163
271
  if (!validation.isValid) {
164
272
  console.error('Configuration errors:', validation.errors);
165
273
  }
166
- ```
274
+ ```
275
+
276
+ ## Licenses & dependency audit
277
+
278
+ ### This package
279
+
280
+ `buildhive-agent` is released under the **Apache License 2.0**.
281
+ See [`LICENSE`](./LICENSE) for the full text.
282
+ Copyright 2026 BuildHive contributors.
283
+
284
+ ### npm audit summary
285
+
286
+ Date audited: 2026-05-11
287
+ Tool: `npm audit` (npm v10, node_modules fully installed)
288
+
289
+ ```
290
+ found 0 vulnerabilities
291
+ ```
292
+
293
+ **Status: CLEAN** — 0 HIGH, 0 CRITICAL.
294
+ Previously flagged `fast-xml-builder <=1.1.6` (GHSA-5wm8-gmm8-39j9,
295
+ GHSA-45c6-75p6-83cc) was resolved by bumping `@aws-sdk/client-s3` (and
296
+ `lib-storage`, `s3-request-presigner`) from `3.1036.0` → `3.1045.0`.
297
+ The transitive chain now resolves `fast-xml-builder@1.2.0` (safe).
298
+ See PR #181.
299
+
300
+ ### Runtime dependency licenses
301
+
302
+ All 15 direct runtime dependencies use OSI-approved open-source licenses
303
+ (MIT or Apache-2.0). No proprietary licenses present.
304
+
305
+ | Package | Version | License |
306
+ |---------|---------|---------|
307
+ | `@aws-sdk/client-s3` | 3.1045.0 | Apache-2.0 |
308
+ | `@aws-sdk/lib-storage` | 3.1045.0 | Apache-2.0 |
309
+ | `@aws-sdk/s3-request-presigner` | 3.1045.0 | Apache-2.0 |
310
+ | `@napi-rs/keyring` | 1.3.0 | MIT |
311
+ | `@sentry/node` | 10.51.0 | MIT |
312
+ | `axios` | 1.15.2 | MIT |
313
+ | `commander` | 11.1.0 | MIT |
314
+ | `dockerode` | 4.0.12 | Apache-2.0 |
315
+ | `inquirer` | 9.3.8 | MIT |
316
+ | `node-machine-id` | 1.1.12 | MIT |
317
+ | `pino` | 9.14.0 | MIT |
318
+ | `pino-pretty` | 11.3.0 | MIT |
319
+ | `pino-roll` | 3.1.0 | MIT |
320
+ | `systeminformation` | 5.31.5 | MIT |
321
+ | `ws` | 8.20.0 | MIT |
322
+
323
+ Verified via `node -e "require('./node_modules/<pkg>/package.json').license"` for each entry.
324
+ No proprietary dependencies detected.
325
+
326
+ ### 2026-05-12 packaging fix
327
+
328
+ - v1.0.0-beta.7 unintentionally shipped a 172 MB nested old tarball + 55 MB of runtime workspace data due to a missing `files` allowlist in `package.json`. **Use v1.0.0-beta.8 or later.** beta.7 is deprecated on npm.
329
+ - v1.0.0-beta.8 adds: explicit `files` allowlist, expanded `.gitignore`, disabled source maps in published `dist/`.
330
+ - Expected published size: ~0.5 MB compressed.
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Agent-enrollment keyring wrapper — stores the 5 agent-enrollment credentials
3
+ * under the `agent-enrollment.*` namespace in the OS keyring (@napi-rs/keyring).
4
+ *
5
+ * Row 17c — zero-GH developer onboarding (Wave A).
6
+ * Design: docs/ops/zero-github-dev-onboarding-design-2026-05-17.md §1.3 step 4 + §3.1
7
+ *
8
+ * 5 stored keys (sibling to DeviceFlowKeyringStore's `device-flow.*` namespace —
9
+ * different prefix guarantees zero collision):
10
+ * agent-enrollment.jwt — signed JWT (~600-800 chars)
11
+ * agent-enrollment.jwt_exp — unix seconds (avoid jwt.decode per call in `start`)
12
+ * agent-enrollment.agent_id — for local whoami without network round-trip
13
+ * agent-enrollment.tenant_id — client-side defensive tenant check
14
+ * agent-enrollment.platform_url — bound at enroll; refuses cross-instance reuse
15
+ */
16
+ import type { SecretStore } from '../security/secretStore.js';
17
+ import { PlatformUrlMismatchError } from './types.js';
18
+ export declare const AGENT_ENROLLMENT_KEY_PREFIX = "agent-enrollment.";
19
+ export declare const KEY_JWT = "agent-enrollment.jwt";
20
+ export declare const KEY_JWT_EXP = "agent-enrollment.jwt_exp";
21
+ export declare const KEY_AGENT_ID = "agent-enrollment.agent_id";
22
+ export declare const KEY_TENANT_ID = "agent-enrollment.tenant_id";
23
+ export declare const KEY_PLATFORM_URL = "agent-enrollment.platform_url";
24
+ export interface AgentEnrollmentCredentials {
25
+ readonly jwt: string;
26
+ readonly jwtExpiresAtUnix: number;
27
+ readonly agentId: string;
28
+ readonly tenantId: string;
29
+ readonly platformUrl: string;
30
+ }
31
+ export interface AgentEnrollmentKeyringStoreOptions {
32
+ /** Override the SecretStore (tests + environments without OS keyring). */
33
+ readonly store?: SecretStore;
34
+ }
35
+ /**
36
+ * Custom error thrown when the stored platform_url doesn't match the current
37
+ * platform URL — prevents cross-instance JWT reuse. Same pattern as
38
+ * DeviceFlowKeyringStore.PlatformUrlMismatchError.
39
+ */
40
+ export declare class AgentPlatformUrlMismatchError extends PlatformUrlMismatchError {
41
+ constructor(stored: string, current: string);
42
+ }
43
+ export declare class AgentEnrollmentKeyringStore {
44
+ private readonly store;
45
+ constructor(opts?: AgentEnrollmentKeyringStoreOptions);
46
+ /** Throws KeyringUnavailableError if the OS keyring is unreachable. */
47
+ static assertAvailable(): Promise<void>;
48
+ /**
49
+ * Persist all 5 enrollment credentials atomically.
50
+ * On any write failure, rolls back by clearing all keys (prevents partial state).
51
+ */
52
+ persist(creds: AgentEnrollmentCredentials): Promise<void>;
53
+ /**
54
+ * Read the stored JWT + its cached exp. Throws NotLoggedInError if absent
55
+ * (guides the user to `buildhive-agent join`).
56
+ */
57
+ readJwt(): Promise<{
58
+ jwt: string;
59
+ expiresAtUnix: number;
60
+ }>;
61
+ /**
62
+ * Read the full stored credentials (for display or row-17b supervisor).
63
+ * Throws NotLoggedInError if any required key is missing.
64
+ */
65
+ readAll(): Promise<AgentEnrollmentCredentials>;
66
+ /**
67
+ * Cross-platform-url check. Refuses to use credentials minted against a
68
+ * different BuildHive instance.
69
+ */
70
+ assertPlatformUrlMatches(currentPlatformUrl: string): Promise<void>;
71
+ /** Returns true if any enrollment key exists in the keyring. */
72
+ hasEnrollment(): Promise<boolean>;
73
+ /**
74
+ * Delete all 5 `agent-enrollment.*` keys. Idempotent.
75
+ * Called by a hypothetical `buildhive-agent leave` command (out of scope for v1).
76
+ */
77
+ clear(): Promise<void>;
78
+ }
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Agent-enrollment keyring wrapper — stores the 5 agent-enrollment credentials
3
+ * under the `agent-enrollment.*` namespace in the OS keyring (@napi-rs/keyring).
4
+ *
5
+ * Row 17c — zero-GH developer onboarding (Wave A).
6
+ * Design: docs/ops/zero-github-dev-onboarding-design-2026-05-17.md §1.3 step 4 + §3.1
7
+ *
8
+ * 5 stored keys (sibling to DeviceFlowKeyringStore's `device-flow.*` namespace —
9
+ * different prefix guarantees zero collision):
10
+ * agent-enrollment.jwt — signed JWT (~600-800 chars)
11
+ * agent-enrollment.jwt_exp — unix seconds (avoid jwt.decode per call in `start`)
12
+ * agent-enrollment.agent_id — for local whoami without network round-trip
13
+ * agent-enrollment.tenant_id — client-side defensive tenant check
14
+ * agent-enrollment.platform_url — bound at enroll; refuses cross-instance reuse
15
+ */
16
+ import { KeyringSecretStore } from '../security/keyringSecretStore.js';
17
+ import { KeyringUnavailableError, NotLoggedInError, PlatformUrlMismatchError, } from './types.js';
18
+ export const AGENT_ENROLLMENT_KEY_PREFIX = 'agent-enrollment.';
19
+ export const KEY_JWT = `${AGENT_ENROLLMENT_KEY_PREFIX}jwt`;
20
+ export const KEY_JWT_EXP = `${AGENT_ENROLLMENT_KEY_PREFIX}jwt_exp`;
21
+ export const KEY_AGENT_ID = `${AGENT_ENROLLMENT_KEY_PREFIX}agent_id`;
22
+ export const KEY_TENANT_ID = `${AGENT_ENROLLMENT_KEY_PREFIX}tenant_id`;
23
+ export const KEY_PLATFORM_URL = `${AGENT_ENROLLMENT_KEY_PREFIX}platform_url`;
24
+ const ALL_KEYS = [
25
+ KEY_JWT,
26
+ KEY_JWT_EXP,
27
+ KEY_AGENT_ID,
28
+ KEY_TENANT_ID,
29
+ KEY_PLATFORM_URL,
30
+ ];
31
+ /**
32
+ * Custom error thrown when the stored platform_url doesn't match the current
33
+ * platform URL — prevents cross-instance JWT reuse. Same pattern as
34
+ * DeviceFlowKeyringStore.PlatformUrlMismatchError.
35
+ */
36
+ export class AgentPlatformUrlMismatchError extends PlatformUrlMismatchError {
37
+ constructor(stored, current) {
38
+ super(stored, current);
39
+ this.name = 'AgentPlatformUrlMismatchError';
40
+ this.message =
41
+ `Stored agent enrollment bound to ${stored}, but current config targets ${current}. ` +
42
+ `Run \`buildhive-agent join <token>\` to re-enroll.`;
43
+ }
44
+ }
45
+ export class AgentEnrollmentKeyringStore {
46
+ store;
47
+ constructor(opts = {}) {
48
+ this.store = opts.store ?? new KeyringSecretStore();
49
+ }
50
+ /** Throws KeyringUnavailableError if the OS keyring is unreachable. */
51
+ static async assertAvailable() {
52
+ const ok = await KeyringSecretStore.isAvailable();
53
+ if (!ok)
54
+ throw new KeyringUnavailableError();
55
+ }
56
+ /**
57
+ * Persist all 5 enrollment credentials atomically.
58
+ * On any write failure, rolls back by clearing all keys (prevents partial state).
59
+ */
60
+ async persist(creds) {
61
+ const writes = [
62
+ [KEY_JWT, creds.jwt],
63
+ [KEY_JWT_EXP, String(creds.jwtExpiresAtUnix)],
64
+ [KEY_AGENT_ID, creds.agentId],
65
+ [KEY_TENANT_ID, creds.tenantId],
66
+ [KEY_PLATFORM_URL, creds.platformUrl],
67
+ ];
68
+ try {
69
+ for (const [k, v] of writes) {
70
+ await this.store.setSecret(k, v);
71
+ }
72
+ }
73
+ catch (err) {
74
+ // Partial-state cleanup: best-effort delete-all on any write failure.
75
+ await this.clear().catch(() => undefined);
76
+ throw err;
77
+ }
78
+ }
79
+ /**
80
+ * Read the stored JWT + its cached exp. Throws NotLoggedInError if absent
81
+ * (guides the user to `buildhive-agent join`).
82
+ */
83
+ async readJwt() {
84
+ const [token, expStr] = await Promise.all([
85
+ this.store.getSecret(KEY_JWT),
86
+ this.store.getSecret(KEY_JWT_EXP),
87
+ ]);
88
+ if (!token || !expStr)
89
+ throw new NotLoggedInError();
90
+ const exp = Number(expStr);
91
+ return {
92
+ jwt: token,
93
+ expiresAtUnix: Number.isFinite(exp) ? exp : 0,
94
+ };
95
+ }
96
+ /**
97
+ * Read the full stored credentials (for display or row-17b supervisor).
98
+ * Throws NotLoggedInError if any required key is missing.
99
+ */
100
+ async readAll() {
101
+ const [jwt, expStr, agentId, tenantId, platformUrl] = await Promise.all([
102
+ this.store.getSecret(KEY_JWT),
103
+ this.store.getSecret(KEY_JWT_EXP),
104
+ this.store.getSecret(KEY_AGENT_ID),
105
+ this.store.getSecret(KEY_TENANT_ID),
106
+ this.store.getSecret(KEY_PLATFORM_URL),
107
+ ]);
108
+ if (!jwt || !expStr || !agentId || !tenantId || !platformUrl) {
109
+ throw new NotLoggedInError();
110
+ }
111
+ const exp = Number(expStr);
112
+ return {
113
+ jwt,
114
+ jwtExpiresAtUnix: Number.isFinite(exp) ? exp : 0,
115
+ agentId,
116
+ tenantId,
117
+ platformUrl,
118
+ };
119
+ }
120
+ /**
121
+ * Cross-platform-url check. Refuses to use credentials minted against a
122
+ * different BuildHive instance.
123
+ */
124
+ async assertPlatformUrlMatches(currentPlatformUrl) {
125
+ const stored = await this.store.getSecret(KEY_PLATFORM_URL);
126
+ if (!stored)
127
+ throw new NotLoggedInError();
128
+ if (normalizeUrl(stored) !== normalizeUrl(currentPlatformUrl)) {
129
+ throw new AgentPlatformUrlMismatchError(stored, currentPlatformUrl);
130
+ }
131
+ }
132
+ /** Returns true if any enrollment key exists in the keyring. */
133
+ async hasEnrollment() {
134
+ const jwt = await this.store.getSecret(KEY_JWT);
135
+ return jwt !== null && jwt.length > 0;
136
+ }
137
+ /**
138
+ * Delete all 5 `agent-enrollment.*` keys. Idempotent.
139
+ * Called by a hypothetical `buildhive-agent leave` command (out of scope for v1).
140
+ */
141
+ async clear() {
142
+ for (const k of ALL_KEYS) {
143
+ await this.store.deleteSecret(k).catch(() => false);
144
+ }
145
+ }
146
+ }
147
+ function normalizeUrl(u) {
148
+ return u.replace(/\/$/, '').toLowerCase();
149
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * deviceFlow orchestrator — initiate + poll-with-backoff + atomic persist.
3
+ *
4
+ * Phase 4 Task 5 commit 4. This is the high-level entry point the
5
+ * `buildhive-agent login` command calls. Pure logic + DI'd dependencies;
6
+ * no commander, no TUI.
7
+ */
8
+ import { DeviceFlowClient } from './deviceFlowClient.js';
9
+ import { DeviceFlowKeyringStore } from './keyringStore.js';
10
+ import { type StoredIdentity, type TokenPair } from './types.js';
11
+ export interface LoginOptions {
12
+ /** Hard ceiling on poll loop wall-time. Defaults to expires_in from /code. */
13
+ readonly maxWaitSeconds?: number;
14
+ /** Override scope (default: AGENT_CLI_DEFAULT_SCOPE). */
15
+ readonly scope?: string;
16
+ /** Hook called after /code with the user-facing prompt data. Synchronous
17
+ * to keep the TUI rendering snappy. Tests use it to capture rendered UX. */
18
+ readonly onPromptUser?: (panel: {
19
+ userCode: string;
20
+ verificationUri: string;
21
+ expiresIn: number;
22
+ }) => void;
23
+ /** Hook called when the server signals slow_down. Tests + TUI use this
24
+ * to update the spinner copy. */
25
+ readonly onSlowDown?: () => void;
26
+ /** Sleep implementation (tests inject a fake clock). */
27
+ readonly sleep?: (ms: number) => Promise<void>;
28
+ }
29
+ export interface LoginResult {
30
+ readonly identity: StoredIdentity;
31
+ readonly tokenPair: TokenPair;
32
+ }
33
+ export interface LoginContext {
34
+ readonly client: DeviceFlowClient;
35
+ readonly store: DeviceFlowKeyringStore;
36
+ readonly platformUrl: string;
37
+ }
38
+ /**
39
+ * Drive the device flow end-to-end:
40
+ * 1. POST /code
41
+ * 2. Surface user_code + verification_uri to the operator via the hook
42
+ * 3. Poll /token at the server-suggested interval (backoff on slow_down)
43
+ * 4. On success: persist token pair + identity atomically
44
+ */
45
+ export declare function loginViaDeviceFlow(ctx: LoginContext, opts?: LoginOptions): Promise<LoginResult>;