@sapienx/agentos 0.5.7 → 0.5.8

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 (223) hide show
  1. package/bin/agentos.js +113 -2
  2. package/bin/terminal-boot.js +380 -76
  3. package/bundle/.next/BUILD_ID +1 -1
  4. package/bundle/.next/app-path-routes-manifest.json +8 -7
  5. package/bundle/.next/build-manifest.json +2 -2
  6. package/bundle/.next/prerender-manifest.json +3 -3
  7. package/bundle/.next/required-server-files.json +1 -1
  8. package/bundle/.next/routes-manifest.json +6 -0
  9. package/bundle/.next/server/app/_global-error/page.js +2 -2
  10. package/bundle/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  11. package/bundle/.next/server/app/_global-error.html +1 -1
  12. package/bundle/.next/server/app/_global-error.rsc +1 -1
  13. package/bundle/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  14. package/bundle/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  15. package/bundle/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  16. package/bundle/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  17. package/bundle/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  18. package/bundle/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  19. package/bundle/.next/server/app/_not-found/page.js +2 -2
  20. package/bundle/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  21. package/bundle/.next/server/app/_not-found.html +1 -1
  22. package/bundle/.next/server/app/_not-found.rsc +2 -2
  23. package/bundle/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  24. package/bundle/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  25. package/bundle/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  26. package/bundle/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  27. package/bundle/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  28. package/bundle/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  29. package/bundle/.next/server/app/agents/page.js +2 -2
  30. package/bundle/.next/server/app/agents/page.js.nft.json +1 -1
  31. package/bundle/.next/server/app/agents/page_client-reference-manifest.js +1 -1
  32. package/bundle/.next/server/app/api/agents/[agentId]/chat/route.js +4 -4
  33. package/bundle/.next/server/app/api/agents/[agentId]/chat/route.js.nft.json +1 -1
  34. package/bundle/.next/server/app/api/agents/route.js +1 -1
  35. package/bundle/.next/server/app/api/agents/route.js.nft.json +1 -1
  36. package/bundle/.next/server/app/api/diagnostics/route.js +1 -1
  37. package/bundle/.next/server/app/api/diagnostics/route.js.nft.json +1 -1
  38. package/bundle/.next/server/app/api/files/reveal/route.js +1 -1
  39. package/bundle/.next/server/app/api/gateway/control/route.js +1 -1
  40. package/bundle/.next/server/app/api/gateway/control/route.js.nft.json +1 -1
  41. package/bundle/.next/server/app/api/integrations/[integrationId]/status/route.js +1 -1
  42. package/bundle/.next/server/app/api/mission/route.js +1 -1
  43. package/bundle/.next/server/app/api/mission/route.js.nft.json +1 -1
  44. package/bundle/.next/server/app/api/models/catalog/route.js +2 -2
  45. package/bundle/.next/server/app/api/models/catalog/route.js.nft.json +1 -1
  46. package/bundle/.next/server/app/api/models/providers/route.js +2 -2
  47. package/bundle/.next/server/app/api/models/providers/route.js.nft.json +1 -1
  48. package/bundle/.next/server/app/api/onboarding/models/route.js +3 -3
  49. package/bundle/.next/server/app/api/onboarding/models/route.js.nft.json +1 -1
  50. package/bundle/.next/server/app/api/onboarding/route.js +2 -2
  51. package/bundle/.next/server/app/api/onboarding/route.js.nft.json +1 -1
  52. package/bundle/.next/server/app/api/openclaw/capabilities/route.js +1 -1
  53. package/bundle/.next/server/app/api/openclaw/compatibility-smoke/route.js +1 -0
  54. package/bundle/.next/server/app/api/openclaw/compatibility-smoke/route.js.nft.json +1 -0
  55. package/bundle/.next/server/app/api/openclaw/compatibility-smoke/route_client-reference-manifest.js +1 -0
  56. package/bundle/.next/server/app/api/planner/[planId]/deploy/route.js +2 -2
  57. package/bundle/.next/server/app/api/planner/[planId]/deploy/route.js.nft.json +1 -1
  58. package/bundle/.next/server/app/api/planner/[planId]/document-rewrite/route.js +1 -1
  59. package/bundle/.next/server/app/api/planner/[planId]/document-rewrite/route.js.nft.json +1 -1
  60. package/bundle/.next/server/app/api/planner/[planId]/route.js +1 -1
  61. package/bundle/.next/server/app/api/planner/[planId]/route.js.nft.json +1 -1
  62. package/bundle/.next/server/app/api/planner/[planId]/simulate/route.js +1 -1
  63. package/bundle/.next/server/app/api/planner/[planId]/simulate/route.js.nft.json +1 -1
  64. package/bundle/.next/server/app/api/planner/[planId]/turn/route.js +1 -1
  65. package/bundle/.next/server/app/api/planner/[planId]/turn/route.js.nft.json +1 -1
  66. package/bundle/.next/server/app/api/planner/route.js +1 -1
  67. package/bundle/.next/server/app/api/planner/route.js.nft.json +1 -1
  68. package/bundle/.next/server/app/api/reset/route.js +2 -2
  69. package/bundle/.next/server/app/api/reset/route.js.nft.json +1 -1
  70. package/bundle/.next/server/app/api/runtimes/[runtimeId]/route.js +1 -1
  71. package/bundle/.next/server/app/api/runtimes/[runtimeId]/route.js.nft.json +1 -1
  72. package/bundle/.next/server/app/api/settings/gateway/route.js +1 -1
  73. package/bundle/.next/server/app/api/settings/gateway/route.js.nft.json +1 -1
  74. package/bundle/.next/server/app/api/settings/openclaw-binary/route.js +1 -1
  75. package/bundle/.next/server/app/api/settings/openclaw-binary/route.js.nft.json +1 -1
  76. package/bundle/.next/server/app/api/settings/workspace-root/route.js +1 -1
  77. package/bundle/.next/server/app/api/settings/workspace-root/route.js.nft.json +1 -1
  78. package/bundle/.next/server/app/api/snapshot/route.js +1 -1
  79. package/bundle/.next/server/app/api/snapshot/route.js.nft.json +1 -1
  80. package/bundle/.next/server/app/api/stream/route.js +2 -2
  81. package/bundle/.next/server/app/api/stream/route.js.nft.json +1 -1
  82. package/bundle/.next/server/app/api/system/open-terminal/route.js +1 -1
  83. package/bundle/.next/server/app/api/tasks/[taskId]/abort/route.js +1 -1
  84. package/bundle/.next/server/app/api/tasks/[taskId]/abort/route.js.nft.json +1 -1
  85. package/bundle/.next/server/app/api/tasks/[taskId]/control/route.js +1 -1
  86. package/bundle/.next/server/app/api/tasks/[taskId]/control/route.js.nft.json +1 -1
  87. package/bundle/.next/server/app/api/tasks/[taskId]/stream/route.js +2 -2
  88. package/bundle/.next/server/app/api/tasks/[taskId]/stream/route.js.nft.json +1 -1
  89. package/bundle/.next/server/app/api/update/route.js +2 -2
  90. package/bundle/.next/server/app/api/update/route.js.nft.json +1 -1
  91. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/discovered-groups/route.js +1 -1
  92. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/discovered-groups/route.js.nft.json +1 -1
  93. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/route.js +1 -1
  94. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/route.js.nft.json +1 -1
  95. package/bundle/.next/server/app/api/workspaces/[workspaceId]/edit-draft/route.js +1 -1
  96. package/bundle/.next/server/app/api/workspaces/[workspaceId]/edit-draft/route.js.nft.json +1 -1
  97. package/bundle/.next/server/app/api/workspaces/[workspaceId]/files/route.js +1 -1
  98. package/bundle/.next/server/app/api/workspaces/[workspaceId]/files/route.js.nft.json +1 -1
  99. package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/discovery/route.js +1 -1
  100. package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/discovery/route.js.nft.json +1 -1
  101. package/bundle/.next/server/app/api/workspaces/route.js +2 -2
  102. package/bundle/.next/server/app/api/workspaces/route.js.nft.json +1 -1
  103. package/bundle/.next/server/app/files/page.js +2 -2
  104. package/bundle/.next/server/app/files/page.js.nft.json +1 -1
  105. package/bundle/.next/server/app/files/page_client-reference-manifest.js +1 -1
  106. package/bundle/.next/server/app/integrations/page.js +2 -2
  107. package/bundle/.next/server/app/integrations/page.js.nft.json +1 -1
  108. package/bundle/.next/server/app/integrations/page_client-reference-manifest.js +1 -1
  109. package/bundle/.next/server/app/models/page.js +2 -2
  110. package/bundle/.next/server/app/models/page.js.nft.json +1 -1
  111. package/bundle/.next/server/app/models/page_client-reference-manifest.js +1 -1
  112. package/bundle/.next/server/app/page.js +2 -2
  113. package/bundle/.next/server/app/page.js.nft.json +1 -1
  114. package/bundle/.next/server/app/page_client-reference-manifest.js +1 -1
  115. package/bundle/.next/server/app/settings/page.js +2 -2
  116. package/bundle/.next/server/app/settings/page.js.nft.json +1 -1
  117. package/bundle/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  118. package/bundle/.next/server/app/tasks/page.js +2 -2
  119. package/bundle/.next/server/app/tasks/page.js.nft.json +1 -1
  120. package/bundle/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
  121. package/bundle/.next/server/app-paths-manifest.json +8 -7
  122. package/bundle/.next/server/chunks/1718.js +4 -0
  123. package/bundle/.next/server/chunks/4391.js +44 -34
  124. package/bundle/.next/server/chunks/4767.js +1 -4
  125. package/bundle/.next/server/chunks/5151.js +14 -4
  126. package/bundle/.next/server/chunks/6476.js +2 -2
  127. package/bundle/.next/server/chunks/8849.js +1 -1
  128. package/bundle/.next/server/functions-config-manifest.json +1 -0
  129. package/bundle/.next/server/middleware-build-manifest.js +1 -1
  130. package/bundle/.next/server/pages/404.html +1 -1
  131. package/bundle/.next/server/pages/500.html +1 -1
  132. package/bundle/.next/server/server-reference-manifest.json +1 -1
  133. package/bundle/.next/static/JwIu-FqrfB4Nerk5vBqR2/_buildManifest.js +1 -0
  134. package/bundle/.next/static/chunks/2396-395f5ed99e66819d.js +1 -0
  135. package/bundle/.next/static/chunks/{7442-0da619eb6902ba5b.js → 7442-5ed5b8f501838da4.js} +45 -35
  136. package/bundle/.next/static/chunks/app/_global-error/{page-73422dc4075cbfe0.js → page-8443c62570b9a078.js} +1 -1
  137. package/bundle/.next/static/chunks/app/_not-found/{page-73422dc4075cbfe0.js → page-8443c62570b9a078.js} +1 -1
  138. package/bundle/.next/static/chunks/app/api/agents/[agentId]/chat/{route-73422dc4075cbfe0.js → route-8443c62570b9a078.js} +1 -1
  139. package/bundle/.next/static/chunks/app/api/agents/{route-73422dc4075cbfe0.js → route-8443c62570b9a078.js} +1 -1
  140. package/bundle/.next/static/chunks/app/api/diagnostics/route-8443c62570b9a078.js +1 -0
  141. package/bundle/.next/static/chunks/app/api/files/reveal/route-8443c62570b9a078.js +1 -0
  142. package/bundle/.next/static/chunks/app/api/gateway/control/route-8443c62570b9a078.js +1 -0
  143. package/bundle/.next/static/chunks/app/api/integrations/[integrationId]/status/route-8443c62570b9a078.js +1 -0
  144. package/bundle/.next/static/chunks/app/api/mission/route-8443c62570b9a078.js +1 -0
  145. package/bundle/.next/static/chunks/app/api/models/catalog/route-8443c62570b9a078.js +1 -0
  146. package/bundle/.next/static/chunks/app/api/models/providers/route-8443c62570b9a078.js +1 -0
  147. package/bundle/.next/static/chunks/app/api/onboarding/models/route-8443c62570b9a078.js +1 -0
  148. package/bundle/.next/static/chunks/app/api/onboarding/route-8443c62570b9a078.js +1 -0
  149. package/bundle/.next/static/chunks/app/api/openclaw/capabilities/route-8443c62570b9a078.js +1 -0
  150. package/bundle/.next/static/chunks/app/api/openclaw/compatibility-smoke/route-8443c62570b9a078.js +1 -0
  151. package/bundle/.next/static/chunks/app/api/planner/[planId]/deploy/route-8443c62570b9a078.js +1 -0
  152. package/bundle/.next/static/chunks/app/api/planner/[planId]/document-rewrite/route-8443c62570b9a078.js +1 -0
  153. package/bundle/.next/static/chunks/app/api/planner/[planId]/route-8443c62570b9a078.js +1 -0
  154. package/bundle/.next/static/chunks/app/api/planner/[planId]/simulate/route-8443c62570b9a078.js +1 -0
  155. package/bundle/.next/static/chunks/app/api/planner/[planId]/turn/route-8443c62570b9a078.js +1 -0
  156. package/bundle/.next/static/chunks/app/api/planner/route-8443c62570b9a078.js +1 -0
  157. package/bundle/.next/static/chunks/app/api/reset/route-8443c62570b9a078.js +1 -0
  158. package/bundle/.next/static/chunks/app/api/runtimes/[runtimeId]/route-8443c62570b9a078.js +1 -0
  159. package/bundle/.next/static/chunks/app/api/settings/gateway/route-8443c62570b9a078.js +1 -0
  160. package/bundle/.next/static/chunks/app/api/settings/openclaw-binary/route-8443c62570b9a078.js +1 -0
  161. package/bundle/.next/static/chunks/app/api/settings/workspace-root/route-8443c62570b9a078.js +1 -0
  162. package/bundle/.next/static/chunks/app/api/snapshot/route-8443c62570b9a078.js +1 -0
  163. package/bundle/.next/static/chunks/app/api/stream/route-8443c62570b9a078.js +1 -0
  164. package/bundle/.next/static/chunks/app/api/system/open-terminal/route-8443c62570b9a078.js +1 -0
  165. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/abort/route-8443c62570b9a078.js +1 -0
  166. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/control/route-8443c62570b9a078.js +1 -0
  167. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/stream/route-8443c62570b9a078.js +1 -0
  168. package/bundle/.next/static/chunks/app/api/update/route-8443c62570b9a078.js +1 -0
  169. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/discovered-groups/route-8443c62570b9a078.js +1 -0
  170. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/route-8443c62570b9a078.js +1 -0
  171. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/edit-draft/route-8443c62570b9a078.js +1 -0
  172. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/files/route-8443c62570b9a078.js +1 -0
  173. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/surfaces/discovery/route-8443c62570b9a078.js +1 -0
  174. package/bundle/.next/static/chunks/app/api/workspaces/route-8443c62570b9a078.js +1 -0
  175. package/bundle/.next/static/chunks/app/not-found-8443c62570b9a078.js +1 -0
  176. package/bundle/.next/static/chunks/next/dist/client/components/builtin/app-error-8443c62570b9a078.js +1 -0
  177. package/bundle/.next/static/chunks/next/dist/client/components/builtin/forbidden-8443c62570b9a078.js +1 -0
  178. package/bundle/.next/static/chunks/next/dist/client/components/builtin/unauthorized-8443c62570b9a078.js +1 -0
  179. package/bundle/.next/static/css/288b13e5308447b9.css +3 -0
  180. package/bundle/server.js +1 -1
  181. package/package.json +1 -1
  182. package/bundle/.next/static/JJw_UWORQdbCo0tnqFq68/_buildManifest.js +0 -1
  183. package/bundle/.next/static/chunks/2396-3a9544c281c618dd.js +0 -1
  184. package/bundle/.next/static/chunks/app/api/diagnostics/route-73422dc4075cbfe0.js +0 -1
  185. package/bundle/.next/static/chunks/app/api/files/reveal/route-73422dc4075cbfe0.js +0 -1
  186. package/bundle/.next/static/chunks/app/api/gateway/control/route-73422dc4075cbfe0.js +0 -1
  187. package/bundle/.next/static/chunks/app/api/integrations/[integrationId]/status/route-73422dc4075cbfe0.js +0 -1
  188. package/bundle/.next/static/chunks/app/api/mission/route-73422dc4075cbfe0.js +0 -1
  189. package/bundle/.next/static/chunks/app/api/models/catalog/route-73422dc4075cbfe0.js +0 -1
  190. package/bundle/.next/static/chunks/app/api/models/providers/route-73422dc4075cbfe0.js +0 -1
  191. package/bundle/.next/static/chunks/app/api/onboarding/models/route-73422dc4075cbfe0.js +0 -1
  192. package/bundle/.next/static/chunks/app/api/onboarding/route-73422dc4075cbfe0.js +0 -1
  193. package/bundle/.next/static/chunks/app/api/openclaw/capabilities/route-73422dc4075cbfe0.js +0 -1
  194. package/bundle/.next/static/chunks/app/api/planner/[planId]/deploy/route-73422dc4075cbfe0.js +0 -1
  195. package/bundle/.next/static/chunks/app/api/planner/[planId]/document-rewrite/route-73422dc4075cbfe0.js +0 -1
  196. package/bundle/.next/static/chunks/app/api/planner/[planId]/route-73422dc4075cbfe0.js +0 -1
  197. package/bundle/.next/static/chunks/app/api/planner/[planId]/simulate/route-73422dc4075cbfe0.js +0 -1
  198. package/bundle/.next/static/chunks/app/api/planner/[planId]/turn/route-73422dc4075cbfe0.js +0 -1
  199. package/bundle/.next/static/chunks/app/api/planner/route-73422dc4075cbfe0.js +0 -1
  200. package/bundle/.next/static/chunks/app/api/reset/route-73422dc4075cbfe0.js +0 -1
  201. package/bundle/.next/static/chunks/app/api/runtimes/[runtimeId]/route-73422dc4075cbfe0.js +0 -1
  202. package/bundle/.next/static/chunks/app/api/settings/gateway/route-73422dc4075cbfe0.js +0 -1
  203. package/bundle/.next/static/chunks/app/api/settings/openclaw-binary/route-73422dc4075cbfe0.js +0 -1
  204. package/bundle/.next/static/chunks/app/api/settings/workspace-root/route-73422dc4075cbfe0.js +0 -1
  205. package/bundle/.next/static/chunks/app/api/snapshot/route-73422dc4075cbfe0.js +0 -1
  206. package/bundle/.next/static/chunks/app/api/stream/route-73422dc4075cbfe0.js +0 -1
  207. package/bundle/.next/static/chunks/app/api/system/open-terminal/route-73422dc4075cbfe0.js +0 -1
  208. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/abort/route-73422dc4075cbfe0.js +0 -1
  209. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/control/route-73422dc4075cbfe0.js +0 -1
  210. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/stream/route-73422dc4075cbfe0.js +0 -1
  211. package/bundle/.next/static/chunks/app/api/update/route-73422dc4075cbfe0.js +0 -1
  212. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/discovered-groups/route-73422dc4075cbfe0.js +0 -1
  213. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/route-73422dc4075cbfe0.js +0 -1
  214. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/edit-draft/route-73422dc4075cbfe0.js +0 -1
  215. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/files/route-73422dc4075cbfe0.js +0 -1
  216. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/surfaces/discovery/route-73422dc4075cbfe0.js +0 -1
  217. package/bundle/.next/static/chunks/app/api/workspaces/route-73422dc4075cbfe0.js +0 -1
  218. package/bundle/.next/static/chunks/app/not-found-73422dc4075cbfe0.js +0 -1
  219. package/bundle/.next/static/chunks/next/dist/client/components/builtin/app-error-73422dc4075cbfe0.js +0 -1
  220. package/bundle/.next/static/chunks/next/dist/client/components/builtin/forbidden-73422dc4075cbfe0.js +0 -1
  221. package/bundle/.next/static/chunks/next/dist/client/components/builtin/unauthorized-73422dc4075cbfe0.js +0 -1
  222. package/bundle/.next/static/css/6de56db1be7d3d06.css +0 -3
  223. /package/bundle/.next/static/{JJw_UWORQdbCo0tnqFq68 → JwIu-FqrfB4Nerk5vBqR2}/_ssgManifest.js +0 -0
package/bin/agentos.js CHANGED
@@ -1496,7 +1496,7 @@ function isUpdateCacheFresh(status) {
1496
1496
  }
1497
1497
 
1498
1498
  function markUpdateNotified(status) {
1499
- writeUpdateCache({
1499
+ writeUpdateCacheBestEffort({
1500
1500
  ...status,
1501
1501
  cachedNotifiedVersion: status.latestVersion,
1502
1502
  cachedNotifiedAt: new Date().toISOString()
@@ -1543,6 +1543,14 @@ function writeUpdateCache(payload) {
1543
1543
  writeFileSync(updateCachePath, `${JSON.stringify(payload, null, 2)}\n`, "utf8");
1544
1544
  }
1545
1545
 
1546
+ function writeUpdateCacheBestEffort(payload) {
1547
+ try {
1548
+ writeUpdateCache(payload);
1549
+ } catch {
1550
+ // Update availability should not disappear just because the cache is unavailable.
1551
+ }
1552
+ }
1553
+
1546
1554
  async function getUpdateStatus({ install, forceRefresh, timeoutMs, fallbackToCache }) {
1547
1555
  try {
1548
1556
  const cache = readCachedUpdateStatus(install);
@@ -1567,7 +1575,7 @@ async function getUpdateStatus({ install, forceRefresh, timeoutMs, fallbackToCac
1567
1575
  cachedNotifiedAt: cache?.cachedNotifiedAt || null
1568
1576
  };
1569
1577
 
1570
- writeUpdateCache(status);
1578
+ writeUpdateCacheBestEffort(status);
1571
1579
  return status;
1572
1580
  } catch (error) {
1573
1581
  const message = error instanceof Error ? error.message : String(error);
@@ -1678,6 +1686,29 @@ async function fetchGitHubLatestVersion(timeoutMs) {
1678
1686
  }
1679
1687
 
1680
1688
  async function fetchNpmLatestVersion(timeoutMs) {
1689
+ try {
1690
+ return await fetchNpmLatestVersionFromRegistry(timeoutMs);
1691
+ } catch (error) {
1692
+ const fallback = fetchNpmLatestVersionWithPackageManager(timeoutMs);
1693
+
1694
+ if (fallback.ok) {
1695
+ return {
1696
+ latestVersion: fallback.latestVersion,
1697
+ downloadBaseUrl: null
1698
+ };
1699
+ }
1700
+
1701
+ throw new Error(
1702
+ `npm registry fetch failed (${formatErrorMessage(error)}); package manager fallback failed (${fallback.errorMessage})`
1703
+ );
1704
+ }
1705
+ }
1706
+
1707
+ async function fetchNpmLatestVersionFromRegistry(timeoutMs) {
1708
+ if (cliSmokeTestMode && parseBooleanEnv(process.env.AGENTOS_TEST_FORCE_NPM_FETCH_FAILURE)) {
1709
+ throw new Error("forced npm registry fetch failure");
1710
+ }
1711
+
1681
1712
  const response = await fetchJsonWithTimeout(`https://registry.npmjs.org/${encodeURIComponent(packageJson.name)}/latest`, timeoutMs, {
1682
1713
  headers: {
1683
1714
  Accept: "application/json",
@@ -1697,6 +1728,86 @@ async function fetchNpmLatestVersion(timeoutMs) {
1697
1728
  };
1698
1729
  }
1699
1730
 
1731
+ function fetchNpmLatestVersionWithPackageManager(timeoutMs) {
1732
+ const command = resolvePackageManagerViewCommand();
1733
+
1734
+ if (!command) {
1735
+ return {
1736
+ ok: false,
1737
+ errorMessage: "npm or pnpm was not found on PATH"
1738
+ };
1739
+ }
1740
+
1741
+ const result = spawnSync(command, ["view", packageJson.name, "version", "--json"], {
1742
+ encoding: "utf8",
1743
+ timeout: timeoutMs,
1744
+ env: {
1745
+ ...process.env,
1746
+ NO_UPDATE_NOTIFIER: "1",
1747
+ npm_config_audit: "false",
1748
+ npm_config_fund: "false",
1749
+ npm_config_loglevel: "silent",
1750
+ npm_config_progress: "false"
1751
+ }
1752
+ });
1753
+
1754
+ if (result.error) {
1755
+ return {
1756
+ ok: false,
1757
+ errorMessage: result.error.message
1758
+ };
1759
+ }
1760
+
1761
+ if (result.status !== 0) {
1762
+ return {
1763
+ ok: false,
1764
+ errorMessage: (result.stderr || result.stdout || `${path.basename(command)} exited with ${result.status}`).trim()
1765
+ };
1766
+ }
1767
+
1768
+ const latestVersion = parsePackageManagerViewVersion(result.stdout);
1769
+
1770
+ if (!latestVersion) {
1771
+ return {
1772
+ ok: false,
1773
+ errorMessage: "package manager metadata did not include a valid version"
1774
+ };
1775
+ }
1776
+
1777
+ return {
1778
+ ok: true,
1779
+ latestVersion
1780
+ };
1781
+ }
1782
+
1783
+ function resolvePackageManagerViewCommand() {
1784
+ return resolveCommandPath("npm") || resolveCommandPath("pnpm");
1785
+ }
1786
+
1787
+ function parsePackageManagerViewVersion(output) {
1788
+ const trimmed = output.trim();
1789
+
1790
+ if (!trimmed) {
1791
+ return null;
1792
+ }
1793
+
1794
+ try {
1795
+ const parsed = JSON.parse(trimmed);
1796
+
1797
+ if (typeof parsed === "string") {
1798
+ return normalizeVersion(parsed);
1799
+ }
1800
+ } catch {
1801
+ // Some package managers may ignore --json for simple scalar output.
1802
+ }
1803
+
1804
+ return normalizeVersion(trimmed.split(/\r?\n/).find(Boolean) || "");
1805
+ }
1806
+
1807
+ function formatErrorMessage(error) {
1808
+ return error instanceof Error ? error.message : String(error);
1809
+ }
1810
+
1700
1811
  async function fetchJsonWithTimeout(url, timeoutMs, options = {}) {
1701
1812
  const controller = new AbortController();
1702
1813
  const timeout = setTimeout(() => {