@sapienx/agentos 0.5.7 → 0.5.9
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.
- package/bin/agentos.js +113 -2
- package/bin/terminal-boot.js +383 -76
- package/bundle/.next/BUILD_ID +1 -1
- package/bundle/.next/app-path-routes-manifest.json +9 -8
- package/bundle/.next/build-manifest.json +3 -3
- package/bundle/.next/prerender-manifest.json +3 -3
- package/bundle/.next/react-loadable-manifest.json +2 -2
- package/bundle/.next/required-server-files.json +1 -1
- package/bundle/.next/routes-manifest.json +6 -0
- package/bundle/.next/server/app/_global-error/page.js +2 -2
- package/bundle/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/bundle/.next/server/app/_global-error.html +1 -1
- package/bundle/.next/server/app/_global-error.rsc +1 -1
- package/bundle/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/bundle/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/bundle/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/bundle/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/bundle/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/bundle/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/bundle/.next/server/app/_not-found/page.js +2 -2
- package/bundle/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/bundle/.next/server/app/_not-found.html +1 -1
- package/bundle/.next/server/app/_not-found.rsc +2 -2
- package/bundle/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/bundle/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/bundle/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/bundle/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/bundle/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/bundle/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/bundle/.next/server/app/agents/page.js +2 -2
- package/bundle/.next/server/app/agents/page.js.nft.json +1 -1
- package/bundle/.next/server/app/agents/page_client-reference-manifest.js +1 -1
- package/bundle/.next/server/app/api/agents/[agentId]/chat/route.js +4 -4
- package/bundle/.next/server/app/api/agents/[agentId]/chat/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/agents/route.js +1 -1
- package/bundle/.next/server/app/api/agents/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/diagnostics/route.js +1 -1
- package/bundle/.next/server/app/api/diagnostics/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/files/reveal/route.js +1 -1
- package/bundle/.next/server/app/api/gateway/control/route.js +1 -1
- package/bundle/.next/server/app/api/gateway/control/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/integrations/[integrationId]/status/route.js +1 -1
- package/bundle/.next/server/app/api/mission/route.js +1 -1
- package/bundle/.next/server/app/api/mission/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/models/catalog/route.js +2 -2
- package/bundle/.next/server/app/api/models/catalog/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/models/providers/route.js +2 -2
- package/bundle/.next/server/app/api/models/providers/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/onboarding/models/route.js +3 -3
- package/bundle/.next/server/app/api/onboarding/models/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/onboarding/route.js +2 -2
- package/bundle/.next/server/app/api/onboarding/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/openclaw/capabilities/route.js +1 -1
- package/bundle/.next/server/app/api/openclaw/compatibility-smoke/route.js +1 -0
- package/bundle/.next/server/app/api/openclaw/compatibility-smoke/route.js.nft.json +1 -0
- package/bundle/.next/server/app/api/openclaw/compatibility-smoke/route_client-reference-manifest.js +1 -0
- package/bundle/.next/server/app/api/planner/[planId]/deploy/route.js +2 -2
- package/bundle/.next/server/app/api/planner/[planId]/deploy/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/document-rewrite/route.js +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/document-rewrite/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/route.js +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/simulate/route.js +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/simulate/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/turn/route.js +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/turn/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/planner/route.js +1 -1
- package/bundle/.next/server/app/api/planner/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/reset/route.js +2 -2
- package/bundle/.next/server/app/api/reset/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/runtimes/[runtimeId]/route.js +1 -1
- package/bundle/.next/server/app/api/runtimes/[runtimeId]/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/settings/gateway/route.js +1 -1
- package/bundle/.next/server/app/api/settings/gateway/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/settings/openclaw-binary/route.js +1 -1
- package/bundle/.next/server/app/api/settings/openclaw-binary/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/settings/workspace-root/route.js +1 -1
- package/bundle/.next/server/app/api/settings/workspace-root/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/snapshot/route.js +1 -1
- package/bundle/.next/server/app/api/snapshot/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/stream/route.js +2 -2
- package/bundle/.next/server/app/api/stream/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/system/open-terminal/route.js +1 -1
- package/bundle/.next/server/app/api/tasks/[taskId]/abort/route.js +1 -1
- package/bundle/.next/server/app/api/tasks/[taskId]/abort/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/tasks/[taskId]/control/route.js +1 -1
- package/bundle/.next/server/app/api/tasks/[taskId]/control/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/tasks/[taskId]/stream/route.js +2 -2
- package/bundle/.next/server/app/api/tasks/[taskId]/stream/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/update/route.js +2 -2
- package/bundle/.next/server/app/api/update/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/discovered-groups/route.js +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/discovered-groups/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/route.js +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/edit-draft/route.js +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/edit-draft/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/files/route.js +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/files/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/discovery/route.js +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/discovery/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/workspaces/route.js +2 -2
- package/bundle/.next/server/app/api/workspaces/route.js.nft.json +1 -1
- package/bundle/.next/server/app/files/page.js +2 -2
- package/bundle/.next/server/app/files/page.js.nft.json +1 -1
- package/bundle/.next/server/app/files/page_client-reference-manifest.js +1 -1
- package/bundle/.next/server/app/integrations/page.js +2 -2
- package/bundle/.next/server/app/integrations/page.js.nft.json +1 -1
- package/bundle/.next/server/app/integrations/page_client-reference-manifest.js +1 -1
- package/bundle/.next/server/app/models/page.js +2 -2
- package/bundle/.next/server/app/models/page.js.nft.json +1 -1
- package/bundle/.next/server/app/models/page_client-reference-manifest.js +1 -1
- package/bundle/.next/server/app/page.js +2 -2
- package/bundle/.next/server/app/page.js.nft.json +1 -1
- package/bundle/.next/server/app/page_client-reference-manifest.js +1 -1
- package/bundle/.next/server/app/settings/page.js +2 -2
- package/bundle/.next/server/app/settings/page.js.nft.json +1 -1
- package/bundle/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/bundle/.next/server/app/tasks/page.js +2 -2
- package/bundle/.next/server/app/tasks/page.js.nft.json +1 -1
- package/bundle/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
- package/bundle/.next/server/app-paths-manifest.json +9 -8
- package/bundle/.next/server/chunks/1718.js +4 -0
- package/bundle/.next/server/chunks/4391.js +45 -35
- package/bundle/.next/server/chunks/4767.js +1 -4
- package/bundle/.next/server/chunks/5151.js +14 -4
- package/bundle/.next/server/chunks/6476.js +2 -2
- package/bundle/.next/server/chunks/8849.js +1 -1
- package/bundle/.next/server/functions-config-manifest.json +1 -0
- package/bundle/.next/server/middleware-build-manifest.js +1 -1
- package/bundle/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/bundle/.next/server/pages/404.html +1 -1
- package/bundle/.next/server/pages/500.html +1 -1
- package/bundle/.next/server/server-reference-manifest.json +1 -1
- package/bundle/.next/static/C5KQaZvAavAtZzYvH3CPw/_buildManifest.js +1 -0
- package/bundle/.next/static/chunks/2396-395f5ed99e66819d.js +1 -0
- package/bundle/.next/static/chunks/7197.2385ee563e32813a.js +1 -0
- package/bundle/.next/static/chunks/7442-b2286cbca8c413fd.js +198 -0
- package/bundle/.next/static/chunks/app/_global-error/{page-73422dc4075cbfe0.js → page-8443c62570b9a078.js} +1 -1
- package/bundle/.next/static/chunks/app/_not-found/{page-73422dc4075cbfe0.js → page-8443c62570b9a078.js} +1 -1
- package/bundle/.next/static/chunks/app/api/agents/[agentId]/chat/{route-73422dc4075cbfe0.js → route-8443c62570b9a078.js} +1 -1
- package/bundle/.next/static/chunks/app/api/agents/{route-73422dc4075cbfe0.js → route-8443c62570b9a078.js} +1 -1
- package/bundle/.next/static/chunks/app/api/diagnostics/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/files/reveal/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/gateway/control/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/integrations/[integrationId]/status/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/mission/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/models/catalog/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/models/providers/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/onboarding/models/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/onboarding/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/openclaw/capabilities/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/openclaw/compatibility-smoke/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/planner/[planId]/deploy/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/planner/[planId]/document-rewrite/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/planner/[planId]/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/planner/[planId]/simulate/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/planner/[planId]/turn/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/planner/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/reset/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/runtimes/[runtimeId]/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/settings/gateway/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/settings/openclaw-binary/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/settings/workspace-root/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/snapshot/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/stream/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/system/open-terminal/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/tasks/[taskId]/abort/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/tasks/[taskId]/control/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/tasks/[taskId]/stream/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/update/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/discovered-groups/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/edit-draft/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/files/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/surfaces/discovery/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/api/workspaces/route-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/app/not-found-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/app-error-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/forbidden-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/unauthorized-8443c62570b9a078.js +1 -0
- package/bundle/.next/static/chunks/{webpack-1e021d6850c9ac01.js → webpack-13c3a46c1cdfa6e4.js} +1 -1
- package/bundle/.next/static/css/288b13e5308447b9.css +3 -0
- package/bundle/server.js +1 -1
- package/package.json +1 -1
- package/bundle/.next/static/JJw_UWORQdbCo0tnqFq68/_buildManifest.js +0 -1
- package/bundle/.next/static/chunks/1994.2c1ce6369c0b31aa.js +0 -1
- package/bundle/.next/static/chunks/2396-3a9544c281c618dd.js +0 -1
- package/bundle/.next/static/chunks/7442-0da619eb6902ba5b.js +0 -188
- package/bundle/.next/static/chunks/app/api/diagnostics/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/files/reveal/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/gateway/control/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/integrations/[integrationId]/status/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/mission/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/models/catalog/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/models/providers/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/onboarding/models/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/onboarding/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/openclaw/capabilities/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/planner/[planId]/deploy/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/planner/[planId]/document-rewrite/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/planner/[planId]/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/planner/[planId]/simulate/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/planner/[planId]/turn/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/planner/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/reset/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/runtimes/[runtimeId]/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/settings/gateway/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/settings/openclaw-binary/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/settings/workspace-root/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/snapshot/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/stream/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/system/open-terminal/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/tasks/[taskId]/abort/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/tasks/[taskId]/control/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/tasks/[taskId]/stream/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/update/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/discovered-groups/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/edit-draft/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/files/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/surfaces/discovery/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/api/workspaces/route-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/app/not-found-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/app-error-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/forbidden-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/unauthorized-73422dc4075cbfe0.js +0 -1
- package/bundle/.next/static/css/6de56db1be7d3d06.css +0 -3
- /package/bundle/.next/static/{JJw_UWORQdbCo0tnqFq68 → C5KQaZvAavAtZzYvH3CPw}/_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
|
-
|
|
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
|
-
|
|
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(() => {
|