@saadnvd1/agent-os 0.3.680 → 0.3.691
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/README.md +2 -2
- package/app/api/dev-servers/detect/route.ts +1 -2
- package/app/api/projects/[id]/dev-servers/[dsId]/route.ts +2 -4
- package/app/page.tsx +1 -2
- package/components/Artifacts/ArtifactsPanel.tsx +1 -1
- package/components/FileExplorer/FileTabs.tsx +1 -1
- package/components/Pane/DesktopTabBar.tsx +2 -2
- package/components/QuickSwitcher.tsx +24 -21
- package/components/SessionList/SessionRowMenu.tsx +0 -1
- package/components/Settings/ExperimentsSection.test.ts +7 -1
- package/components/Settings/NoApprovalsSection.test.ts +7 -1
- package/components/Terminal/TerminalToolbar.tsx +1 -1
- package/components/Terminal/VirtualKeyboard.tsx +1 -1
- package/components/WorkerCard.tsx +1 -7
- package/components/Workspaces/WorkspaceNameDialog.tsx +5 -3
- package/components/a/AButton.tsx +1 -6
- package/components/a/AIconButton.tsx +1 -5
- package/contexts/PaneContext.tsx +1 -6
- package/data/lumifyhub/index.ts +2 -4
- package/hooks/useDirectoryBrowser.ts +5 -4
- package/hooks/useDrawerAnimation.ts +11 -14
- package/hooks/useFileDrop.ts +2 -6
- package/hooks/useKeybarVisibility.ts +10 -29
- package/hooks/useSidebarPinned.ts +7 -23
- package/hooks/useSpeechRecognition.ts +19 -5
- package/hooks/useStoredFlag.ts +47 -0
- package/hooks/useViewport.ts +11 -17
- package/lib/approvals/no-approvals.ts +1 -7
- package/lib/artifacts/store.ts +1 -2
- package/lib/away/report.ts +1 -2
- package/lib/away/run.ts +1 -2
- package/lib/away/state.ts +1 -2
- package/lib/bookmarks/store.ts +1 -2
- package/lib/bus/delivery.ts +1 -2
- package/lib/bus/index.ts +1 -2
- package/lib/chat/compact-context.ts +1 -2
- package/lib/chat/stop.ts +1 -2
- package/lib/chat/worker/host.ts +1 -1
- package/lib/code-health/reports.ts +39 -3
- package/lib/code-health/source.ts +1 -1
- package/lib/db/lumifyhub.ts +2 -4
- package/lib/db/schedules-move.ts +1 -2
- package/lib/db/session-parts/tasks.ts +1 -2
- package/lib/db/stacks.ts +3 -9
- package/lib/db/types.ts +1 -7
- package/lib/dev-instance/spawnServer.ts +10 -6
- package/lib/doctor/checks.ts +8 -10
- package/lib/done/archive.ts +1 -2
- package/lib/env-setup.ts +2 -0
- package/lib/experiments/meter.ts +1 -7
- package/lib/files.ts +1 -0
- package/lib/health/env/classes.ts +0 -2
- package/lib/health/env/recordHit.ts +1 -2
- package/lib/health/spin.ts +1 -4
- package/lib/health/store.ts +1 -2
- package/lib/hosts/index.ts +1 -2
- package/lib/hosts/peer-sync.ts +2 -4
- package/lib/hosts/remote-api.ts +1 -2
- package/lib/lumifyhub/types.ts +2 -8
- package/lib/notify/index.ts +1 -2
- package/lib/notify/push/index.ts +2 -7
- package/lib/orchestrator/brief.ts +1 -1
- package/lib/orchestrator/external-pr.ts +1 -2
- package/lib/orchestrator/gates.ts +1 -6
- package/lib/orchestrator/needs-you-items.ts +16 -20
- package/lib/orchestrator/pr-wake.ts +1 -2
- package/lib/orchestrator/rebase.ts +1 -2
- package/lib/orchestrator/review.ts +1 -2
- package/lib/orchestrator/usage.ts +1 -2
- package/lib/plans/claim.ts +1 -2
- package/lib/plans/features.ts +4 -11
- package/lib/plans/release.ts +2 -4
- package/lib/ports.ts +1 -2
- package/lib/program-status/records.ts +1 -1
- package/lib/project-config/database.ts +1 -2
- package/lib/projects.ts +1 -2
- package/lib/recipes/settle.ts +2 -4
- package/lib/recipes/store.ts +2 -4
- package/lib/schedules/store.ts +2 -4
- package/lib/search/conversations/backfill.ts +2 -4
- package/lib/security/auth.ts +1 -2
- package/lib/security/passkeys.ts +1 -2
- package/lib/security/presence.ts +1 -7
- package/lib/session-artifacts/types.ts +1 -8
- package/lib/session-audit/transcript.ts +1 -3
- package/lib/session-logs/index.ts +1 -2
- package/lib/sessions/launch.ts +1 -2
- package/lib/share/pdf.ts +32 -1
- package/lib/share/snapshot.ts +1 -7
- package/lib/share/store.ts +1 -2
- package/lib/sidebar/orchestrator-row.ts +1 -6
- package/lib/sidebar/row-menu.ts +1 -2
- package/lib/sidebar/shelves.ts +1 -6
- package/lib/simulator/index.ts +1 -2
- package/lib/simulator/lease.ts +1 -5
- package/lib/stacks/index.ts +1 -1
- package/lib/stacks/plan.ts +1 -1
- package/lib/stacks/restack.ts +1 -2
- package/lib/stacks/tick.ts +1 -2
- package/lib/status/socket.ts +1 -2
- package/lib/tasks/contract/authorize.ts +1 -2
- package/lib/tasks/contract/plan.ts +1 -2
- package/lib/tasks/contract/sync.ts +1 -2
- package/lib/tasks/holds.ts +1 -5
- package/lib/tasks/index.ts +1 -2
- package/lib/tasks/loop-types.ts +1 -6
- package/lib/tasks/move-guard.ts +1 -2
- package/lib/tasks/move.ts +1 -2
- package/lib/tasks/moved-away.ts +1 -2
- package/lib/tasks/pause-hold.ts +1 -2
- package/lib/tasks/pause.ts +3 -6
- package/lib/tasks/pr-activity.ts +1 -3
- package/lib/tasks/queue-rows.ts +2 -4
- package/lib/tasks/queue-types.ts +1 -5
- package/lib/tasks/queue.ts +1 -2
- package/lib/tasks/refresh-base.ts +1 -2
- package/lib/tasks/setup.ts +9 -2
- package/lib/tasks/start.ts +2 -4
- package/lib/tasks/starter.ts +1 -2
- package/lib/tasks/state.ts +1 -6
- package/lib/theme-config.ts +1 -8
- package/lib/updates/banner.ts +1 -6
- package/lib/updates/run.ts +1 -2
- package/lib/usage/aggregate.ts +1 -1
- package/lib/usage/nightly.ts +1 -2
- package/lib/usage/rate-limits.ts +1 -2
- package/lib/usage/turns.ts +1 -2
- package/lib/usage/windows.ts +5 -7
- package/lib/workspaces.ts +1 -2
- package/lib/worktree-deps/clone.ts +10 -0
- package/lib/worktree-deps/fastcopy.ts +8 -1
- package/lib/worktree-deps/index.ts +14 -19
- package/lib/worktree-deps/install.ts +17 -24
- package/lib/worktree-sweep/databases.ts +0 -1
- package/package.json +10 -17
- package/scripts/check-native.mjs +86 -0
- package/scripts/code-health/prepass.ts +3 -3
- package/scripts/install-deps +24 -0
- package/scripts/lib/commands.sh +2 -2
- package/scripts/lib/deps-swap.sh +68 -0
- package/scripts/lib/deps-swap.test.ts +115 -0
- package/scripts/lib/pnpm.sh +36 -0
- package/scripts/lib/prerequisites.sh +9 -9
- package/scripts/publish +3 -2
- package/scripts/redeploy +25 -8
- package/scripts/setup.sh +4 -4
- package/tsconfig.json +1 -0
- package/scripts/ensure-native.mjs +0 -23
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Install this checkout's dependencies the one way AgentOS does: pnpm, frozen
|
|
3
|
+
# to pnpm-lock.yaml, only the build scripts pnpm-workspace.yaml allows, then a
|
|
4
|
+
# check that the native modules work and the PDF browser. For first installs
|
|
5
|
+
# (setup, `agent-os install`); a running server's updates go through
|
|
6
|
+
# scripts/redeploy, which installs beside the live tree.
|
|
7
|
+
# scripts/install-deps [--no-browser]
|
|
8
|
+
set -euo pipefail
|
|
9
|
+
cd "$(dirname "$0")/.."
|
|
10
|
+
# shellcheck source=lib/pnpm.sh
|
|
11
|
+
source scripts/lib/pnpm.sh
|
|
12
|
+
|
|
13
|
+
if [ -s "$HOME/.nvm/nvm.sh" ]; then
|
|
14
|
+
# shellcheck disable=SC1091
|
|
15
|
+
source "$HOME/.nvm/nvm.sh" >/dev/null
|
|
16
|
+
nvm use >/dev/null
|
|
17
|
+
fi
|
|
18
|
+
use_pnpm
|
|
19
|
+
|
|
20
|
+
# devDependencies are needed to build, even when the shell has NODE_ENV=production.
|
|
21
|
+
unset NODE_ENV npm_config_production npm_config_omit
|
|
22
|
+
pnpm install --frozen-lockfile
|
|
23
|
+
node scripts/check-native.mjs
|
|
24
|
+
[ "${1:-}" = "--no-browser" ] || install_pdf_browser
|
package/scripts/lib/commands.sh
CHANGED
|
@@ -43,7 +43,7 @@ cmd_install() {
|
|
|
43
43
|
|
|
44
44
|
# Install dependencies
|
|
45
45
|
log_info "Installing dependencies..."
|
|
46
|
-
|
|
46
|
+
scripts/install-deps
|
|
47
47
|
|
|
48
48
|
# Build for production
|
|
49
49
|
log_info "Building for production..."
|
|
@@ -296,7 +296,7 @@ cmd_update() {
|
|
|
296
296
|
git pull --ff-only
|
|
297
297
|
|
|
298
298
|
log_info "Installing dependencies..."
|
|
299
|
-
|
|
299
|
+
scripts/install-deps
|
|
300
300
|
|
|
301
301
|
log_info "Rebuilding..."
|
|
302
302
|
npm run build
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Install dependencies beside the live ones, prove the native modules work in
|
|
3
|
+
# them, and only then swap them in. A deploy that brings a broken install
|
|
4
|
+
# fails here, and the node_modules the running server reads is never touched.
|
|
5
|
+
# The tree being replaced stays in .deps/prev for one rollback.
|
|
6
|
+
# Sourced by scripts/redeploy; run from the repository root, after use_pnpm.
|
|
7
|
+
# Test hooks: AGENTOS_INSTALL_CMD (default `pnpm install --frozen-lockfile`),
|
|
8
|
+
# AGENTOS_NATIVE_CHECK (default `node scripts/check-native.mjs <dir>`).
|
|
9
|
+
|
|
10
|
+
DEPS=.deps
|
|
11
|
+
STAGE=$DEPS/stage
|
|
12
|
+
PREV=$DEPS/prev
|
|
13
|
+
STAMP=.agentos-deps
|
|
14
|
+
|
|
15
|
+
# What an install depends on. A new Node or CPU rebuilds the native modules.
|
|
16
|
+
deps_stamp() {
|
|
17
|
+
{
|
|
18
|
+
cat package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc 2>/dev/null
|
|
19
|
+
node -p 'process.version + process.platform + process.arch'
|
|
20
|
+
} | shasum -a 256 | cut -d' ' -f1
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
# 0 and a staged tree to swap in, or 10 when the live install is already
|
|
24
|
+
# right, or 1 with the live tree untouched.
|
|
25
|
+
install_beside() {
|
|
26
|
+
local stamp
|
|
27
|
+
stamp=$(deps_stamp)
|
|
28
|
+
if [ -d node_modules ] && [ "$(cat "node_modules/$STAMP" 2>/dev/null)" = "$stamp" ]; then
|
|
29
|
+
echo "Dependencies unchanged."
|
|
30
|
+
# The last build ran on these same dependencies, so a rollback has
|
|
31
|
+
# nothing to put back.
|
|
32
|
+
rm -rf "$PREV"
|
|
33
|
+
return 10
|
|
34
|
+
fi
|
|
35
|
+
rm -rf "$STAGE"
|
|
36
|
+
mkdir -p "$STAGE"
|
|
37
|
+
cp package.json pnpm-lock.yaml pnpm-workspace.yaml "$STAGE/"
|
|
38
|
+
[ -f .npmrc ] && cp .npmrc "$STAGE/"
|
|
39
|
+
# HUSKY=0: the staged copy is not a git checkout.
|
|
40
|
+
if ! (cd "$STAGE" && HUSKY=0 bash -c "${AGENTOS_INSTALL_CMD:-pnpm install --frozen-lockfile}"); then
|
|
41
|
+
rm -rf "$STAGE"
|
|
42
|
+
echo "Install failed; the live node_modules is untouched." >&2
|
|
43
|
+
return 1
|
|
44
|
+
fi
|
|
45
|
+
if ! bash -c "${AGENTOS_NATIVE_CHECK:-node scripts/check-native.mjs \"\$1\"}" _ "$STAGE/node_modules"; then
|
|
46
|
+
rm -rf "$STAGE"
|
|
47
|
+
echo "Native modules do not load in the new install; the live node_modules is untouched." >&2
|
|
48
|
+
return 1
|
|
49
|
+
fi
|
|
50
|
+
echo "$stamp" > "$STAGE/node_modules/$STAMP"
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
swap_deps() {
|
|
54
|
+
[ -d "$STAGE/node_modules" ] || { echo "no checked install to swap in" >&2; return 1; }
|
|
55
|
+
rm -rf "$PREV"
|
|
56
|
+
mkdir -p "$DEPS"
|
|
57
|
+
[ -d node_modules ] && mv node_modules "$PREV"
|
|
58
|
+
mv "$STAGE/node_modules" node_modules
|
|
59
|
+
rm -rf "$STAGE"
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
# Put the node_modules from before the last swap back (a failed build, or
|
|
63
|
+
# `redeploy --rollback`); the current one is dropped.
|
|
64
|
+
restore_deps() {
|
|
65
|
+
[ -d "$PREV" ] || return 0
|
|
66
|
+
rm -rf node_modules
|
|
67
|
+
mv "$PREV" node_modules
|
|
68
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import {
|
|
3
|
+
existsSync,
|
|
4
|
+
mkdirSync,
|
|
5
|
+
readFileSync,
|
|
6
|
+
rmSync,
|
|
7
|
+
writeFileSync,
|
|
8
|
+
} from "node:fs";
|
|
9
|
+
import { join } from "node:path";
|
|
10
|
+
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
11
|
+
import { tempDir } from "@/lib/test-temp";
|
|
12
|
+
|
|
13
|
+
const LIB = join(import.meta.dirname, "deps-swap.sh");
|
|
14
|
+
|
|
15
|
+
let dir: string;
|
|
16
|
+
const read = (p: string) => readFileSync(join(dir, p), "utf8");
|
|
17
|
+
|
|
18
|
+
// Runs the library's functions in `dir` with a fake install and native check.
|
|
19
|
+
function run(script: string, env: Record<string, string> = {}) {
|
|
20
|
+
return spawnSync("bash", ["-c", `source "${LIB}"; ${script}`], {
|
|
21
|
+
cwd: dir,
|
|
22
|
+
encoding: "utf8",
|
|
23
|
+
env: { ...process.env, ...env },
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const INSTALL = "mkdir -p node_modules && echo new > node_modules/marker";
|
|
28
|
+
|
|
29
|
+
beforeEach(() => {
|
|
30
|
+
dir = tempDir("deps-swap-");
|
|
31
|
+
for (const f of ["package.json", "pnpm-lock.yaml", "pnpm-workspace.yaml"])
|
|
32
|
+
writeFileSync(join(dir, f), `{}\n`);
|
|
33
|
+
mkdirSync(join(dir, "node_modules"));
|
|
34
|
+
writeFileSync(join(dir, "node_modules/marker"), "old\n");
|
|
35
|
+
});
|
|
36
|
+
afterEach(() => rmSync(dir, { recursive: true, force: true }));
|
|
37
|
+
|
|
38
|
+
describe("install_beside", () => {
|
|
39
|
+
it("installs beside, checks, and swaps in; the old tree is kept for a rollback", () => {
|
|
40
|
+
const r = run("install_beside && swap_deps", {
|
|
41
|
+
AGENTOS_INSTALL_CMD: INSTALL,
|
|
42
|
+
AGENTOS_NATIVE_CHECK: "true",
|
|
43
|
+
});
|
|
44
|
+
expect(r.status).toBe(0);
|
|
45
|
+
expect(read("node_modules/marker")).toBe("new\n");
|
|
46
|
+
expect(read(".deps/prev/marker")).toBe("old\n");
|
|
47
|
+
expect(existsSync(join(dir, ".deps/stage"))).toBe(false);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("leaves the live node_modules alone when the native check fails", () => {
|
|
51
|
+
const r = run("install_beside", {
|
|
52
|
+
AGENTOS_INSTALL_CMD: INSTALL,
|
|
53
|
+
AGENTOS_NATIVE_CHECK: "exit 1",
|
|
54
|
+
});
|
|
55
|
+
expect(r.status).toBe(1);
|
|
56
|
+
expect(r.stderr).toContain("Native modules do not load");
|
|
57
|
+
expect(read("node_modules/marker")).toBe("old\n");
|
|
58
|
+
expect(existsSync(join(dir, ".deps/stage"))).toBe(false);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("leaves the live node_modules alone when the install fails", () => {
|
|
62
|
+
const r = run("install_beside", {
|
|
63
|
+
AGENTOS_INSTALL_CMD: "exit 3",
|
|
64
|
+
AGENTOS_NATIVE_CHECK: "true",
|
|
65
|
+
});
|
|
66
|
+
expect(r.status).toBe(1);
|
|
67
|
+
expect(read("node_modules/marker")).toBe("old\n");
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("skips the install when nothing it depends on changed", () => {
|
|
71
|
+
const first = run("install_beside && swap_deps", {
|
|
72
|
+
AGENTOS_INSTALL_CMD: INSTALL,
|
|
73
|
+
AGENTOS_NATIVE_CHECK: "true",
|
|
74
|
+
});
|
|
75
|
+
expect(first.status).toBe(0);
|
|
76
|
+
const again = run("install_beside", {
|
|
77
|
+
AGENTOS_INSTALL_CMD: "exit 9",
|
|
78
|
+
AGENTOS_NATIVE_CHECK: "exit 9",
|
|
79
|
+
});
|
|
80
|
+
expect(again.status).toBe(10);
|
|
81
|
+
// A rollback has nothing to restore: the last build used these same deps.
|
|
82
|
+
expect(existsSync(join(dir, ".deps/prev"))).toBe(false);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("installs again when the lockfile changes", () => {
|
|
86
|
+
run("install_beside && swap_deps", {
|
|
87
|
+
AGENTOS_INSTALL_CMD: INSTALL,
|
|
88
|
+
AGENTOS_NATIVE_CHECK: "true",
|
|
89
|
+
});
|
|
90
|
+
writeFileSync(join(dir, "pnpm-lock.yaml"), "changed\n");
|
|
91
|
+
const r = run("install_beside", {
|
|
92
|
+
AGENTOS_INSTALL_CMD: INSTALL,
|
|
93
|
+
AGENTOS_NATIVE_CHECK: "true",
|
|
94
|
+
});
|
|
95
|
+
expect(r.status).toBe(0);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
describe("restore_deps", () => {
|
|
100
|
+
it("puts the previous node_modules back after a swap", () => {
|
|
101
|
+
run("install_beside && swap_deps && restore_deps", {
|
|
102
|
+
AGENTOS_INSTALL_CMD: INSTALL,
|
|
103
|
+
AGENTOS_NATIVE_CHECK: "true",
|
|
104
|
+
});
|
|
105
|
+
expect(read("node_modules/marker")).toBe("old\n");
|
|
106
|
+
expect(existsSync(join(dir, ".deps/prev"))).toBe(false);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it("does nothing without a previous tree", () => {
|
|
110
|
+
rmSync(join(dir, ".deps"), { recursive: true, force: true });
|
|
111
|
+
const r = run("restore_deps");
|
|
112
|
+
expect(r.status).toBe(0);
|
|
113
|
+
expect(read("node_modules/marker")).toBe("old\n");
|
|
114
|
+
});
|
|
115
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Make `pnpm` runnable: the pinned version comes from package.json's
|
|
3
|
+
# packageManager field through corepack (bundled with Node 22; Node 25+ needs
|
|
4
|
+
# `npm i -g corepack`). Sourced by scripts/install-deps and scripts/redeploy.
|
|
5
|
+
|
|
6
|
+
use_pnpm() {
|
|
7
|
+
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
|
|
8
|
+
if ! command -v pnpm >/dev/null 2>&1 && command -v corepack >/dev/null 2>&1; then
|
|
9
|
+
corepack enable pnpm >/dev/null 2>&1 || true
|
|
10
|
+
fi
|
|
11
|
+
if ! command -v pnpm >/dev/null 2>&1; then
|
|
12
|
+
echo "pnpm is not available. Use Node 22 (it bundles corepack: corepack enable pnpm) or npm i -g corepack." >&2
|
|
13
|
+
return 1
|
|
14
|
+
fi
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
# Share -> Download -> PDF prints with Playwright's headless shell, at the
|
|
18
|
+
# revision the locked playwright package names. A failed download only warns:
|
|
19
|
+
# a deploy must not hang on a CDN, and the PDF option hides itself without a
|
|
20
|
+
# browser. Run after the install, from the repository root.
|
|
21
|
+
install_pdf_browser() {
|
|
22
|
+
if ! pnpm exec playwright install chromium-headless-shell; then
|
|
23
|
+
echo "Warning: could not download the PDF browser; share PDF is unavailable until 'pnpm exec playwright install chromium-headless-shell' succeeds." >&2
|
|
24
|
+
return 0
|
|
25
|
+
fi
|
|
26
|
+
if [ "$(uname -s)" = Linux ]; then
|
|
27
|
+
local bin missing
|
|
28
|
+
bin=$(node -e 'const p=require("playwright").chromium.executablePath();const fs=require("fs"),path=require("path");const root=path.dirname(path.dirname(path.dirname(p)));const d=fs.readdirSync(root).filter(x=>x.startsWith("chromium_headless_shell-")).sort().pop();if(d){const b=fs.readdirSync(path.join(root,d)).find(x=>x.startsWith("chrome-headless-shell-"));if(b)console.log(path.join(root,d,b,"chrome-headless-shell"))}' 2>/dev/null || true)
|
|
29
|
+
if [ -n "$bin" ] && command -v ldd >/dev/null 2>&1; then
|
|
30
|
+
missing=$(ldd "$bin" 2>/dev/null | grep -c 'not found' || true)
|
|
31
|
+
if [ "${missing:-0}" -gt 0 ]; then
|
|
32
|
+
echo "Warning: the PDF browser is missing $missing system libraries; run: sudo pnpm exec playwright install-deps chromium-headless-shell" >&2
|
|
33
|
+
fi
|
|
34
|
+
fi
|
|
35
|
+
fi
|
|
36
|
+
}
|
|
@@ -47,7 +47,7 @@ check_node() {
|
|
|
47
47
|
if command -v node &> /dev/null; then
|
|
48
48
|
local version
|
|
49
49
|
version=$(node -v | sed 's/v//' | cut -d. -f1)
|
|
50
|
-
if [[ "$version" -ge
|
|
50
|
+
if [[ "$version" -ge 22 ]]; then
|
|
51
51
|
local node_path=$(command -v node)
|
|
52
52
|
log_success "Found Node.js v$(node -v | sed 's/v//') at $node_path"
|
|
53
53
|
return 0
|
|
@@ -60,7 +60,7 @@ check_node() {
|
|
|
60
60
|
if command -v node &> /dev/null; then
|
|
61
61
|
local version
|
|
62
62
|
version=$(node -v | sed 's/v//' | cut -d. -f1)
|
|
63
|
-
if [[ "$version" -ge
|
|
63
|
+
if [[ "$version" -ge 22 ]]; then
|
|
64
64
|
local node_path=$(command -v node)
|
|
65
65
|
local manager=""
|
|
66
66
|
|
|
@@ -202,10 +202,10 @@ install_node() {
|
|
|
202
202
|
if command -v node &> /dev/null; then
|
|
203
203
|
local version
|
|
204
204
|
version=$(node -v | sed 's/v//' | cut -d. -f1)
|
|
205
|
-
if [[ "$version" -ge
|
|
205
|
+
if [[ "$version" -ge 22 ]]; then
|
|
206
206
|
return 0
|
|
207
207
|
fi
|
|
208
|
-
log_warn "Node.js $version found, but
|
|
208
|
+
log_warn "Node.js $version found, but 22+ required"
|
|
209
209
|
fi
|
|
210
210
|
|
|
211
211
|
log_info "Installing Node.js..."
|
|
@@ -224,9 +224,9 @@ install_node() {
|
|
|
224
224
|
export PATH="$HOME/.local/share/fnm:$PATH"
|
|
225
225
|
eval "$(fnm env --use-on-cd)"
|
|
226
226
|
|
|
227
|
-
# Install and use Node.js
|
|
228
|
-
fnm install
|
|
229
|
-
fnm use
|
|
227
|
+
# Install and use Node.js 22
|
|
228
|
+
fnm install 22
|
|
229
|
+
fnm use 22
|
|
230
230
|
|
|
231
231
|
# Add fnm to shell profile
|
|
232
232
|
local shell_profile=""
|
|
@@ -261,7 +261,7 @@ install_node() {
|
|
|
261
261
|
sudo yum install -y nodejs
|
|
262
262
|
;;
|
|
263
263
|
*)
|
|
264
|
-
log_error "Please install Node.js
|
|
264
|
+
log_error "Please install Node.js 22+ manually: https://nodejs.org"
|
|
265
265
|
exit 1
|
|
266
266
|
;;
|
|
267
267
|
esac
|
|
@@ -499,7 +499,7 @@ check_and_install_prerequisites() {
|
|
|
499
499
|
|
|
500
500
|
# What this distro has no installer for here is still missing.
|
|
501
501
|
local still=()
|
|
502
|
-
check_node > /dev/null || still+=("node
|
|
502
|
+
check_node > /dev/null || still+=("node 22+")
|
|
503
503
|
check_git > /dev/null || still+=("git")
|
|
504
504
|
check_tmux > /dev/null || still+=("tmux")
|
|
505
505
|
if [[ ${#still[@]} -gt 0 ]]; then
|
package/scripts/publish
CHANGED
|
@@ -14,10 +14,11 @@ trap 'rm -f "$npmrc"' EXIT
|
|
|
14
14
|
chmod 600 "$npmrc"
|
|
15
15
|
printf '//registry.npmjs.org/:_authToken=%s\n' "$token" > "$npmrc"
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
# npm is pinned (at least a week old), not @latest: this runs with the publish token.
|
|
18
|
+
echo "Publishing $name@$version as $(npx -y npm@11.21.0 whoami --userconfig "$npmrc")"
|
|
18
19
|
# A 409 "previously staged" means npm already took this version (an earlier
|
|
19
20
|
# run gave up waiting): that's not a failure, just keep waiting for it.
|
|
20
|
-
if ! out=$(NODE_ENV=development npx -y npm@
|
|
21
|
+
if ! out=$(NODE_ENV=development npx -y npm@11.21.0 publish --access public \
|
|
21
22
|
--userconfig "$npmrc" --ignore-scripts --loglevel warn 2>&1); then
|
|
22
23
|
echo "$out"
|
|
23
24
|
echo "$out" | grep -qiE "previously staged|cannot publish over" || exit 1
|
package/scripts/redeploy
CHANGED
|
@@ -8,6 +8,10 @@ set -euo pipefail
|
|
|
8
8
|
cd "$(dirname "$0")/.."
|
|
9
9
|
# shellcheck source=lib/build-swap.sh
|
|
10
10
|
source scripts/lib/build-swap.sh
|
|
11
|
+
# shellcheck source=lib/pnpm.sh
|
|
12
|
+
source scripts/lib/pnpm.sh
|
|
13
|
+
# shellcheck source=lib/deps-swap.sh
|
|
14
|
+
source scripts/lib/deps-swap.sh
|
|
11
15
|
|
|
12
16
|
if [ -s "$HOME/.nvm/nvm.sh" ]; then
|
|
13
17
|
# shellcheck disable=SC1091
|
|
@@ -15,23 +19,36 @@ if [ -s "$HOME/.nvm/nvm.sh" ]; then
|
|
|
15
19
|
nvm use >/dev/null
|
|
16
20
|
fi
|
|
17
21
|
|
|
22
|
+
# The pull can replace this script, so what follows runs from a fresh start.
|
|
23
|
+
if [ "${1:-}" != "--rollback" ] && [ "${1:-}" != "--pulled" ]; then
|
|
24
|
+
echo "::phase pulling"
|
|
25
|
+
git pull --ff-only
|
|
26
|
+
exec bash "$0" --pulled
|
|
27
|
+
fi
|
|
28
|
+
|
|
18
29
|
acquire_build_lock
|
|
19
30
|
|
|
20
31
|
if [ "${1:-}" = "--rollback" ]; then
|
|
21
32
|
rollback_build
|
|
33
|
+
# The build and the dependencies it ran on go back together.
|
|
34
|
+
restore_deps
|
|
22
35
|
else
|
|
23
|
-
echo "::phase pulling"
|
|
24
|
-
git pull --ff-only
|
|
25
36
|
echo "::phase installing"
|
|
37
|
+
use_pnpm
|
|
26
38
|
# The build needs dev dependencies even when the shell runs with
|
|
27
39
|
# NODE_ENV=production (as sessions started by AgentOS do).
|
|
28
|
-
|
|
29
|
-
#
|
|
30
|
-
#
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
unset NODE_ENV npm_config_production npm_config_omit
|
|
41
|
+
# Installed beside the live node_modules and checked (SQLite opens, a pty
|
|
42
|
+
# spawns) before they replace it: a broken install fails the deploy here,
|
|
43
|
+
# and the running server keeps the build and dependencies it has.
|
|
44
|
+
swapped=0
|
|
45
|
+
install_beside && rc=0 || rc=$?
|
|
46
|
+
[ "$rc" = 0 ] && { swap_deps; swapped=1; }
|
|
47
|
+
[ "$rc" = 0 ] || [ "$rc" = 10 ] || exit 1
|
|
48
|
+
install_pdf_browser
|
|
33
49
|
echo "::phase building"
|
|
34
|
-
|
|
50
|
+
# A build that fails on the new dependencies puts the old ones back.
|
|
51
|
+
build_beside || { [ "$swapped" = 1 ] && restore_deps; exit 1; }
|
|
35
52
|
swap_build
|
|
36
53
|
fi
|
|
37
54
|
|
package/scripts/setup.sh
CHANGED
|
@@ -8,13 +8,13 @@ echo ""
|
|
|
8
8
|
# Check Node.js
|
|
9
9
|
if ! command -v node &> /dev/null; then
|
|
10
10
|
echo "Error: Node.js is not installed"
|
|
11
|
-
echo "Install Node.js
|
|
11
|
+
echo "Install Node.js 22+ from https://nodejs.org"
|
|
12
12
|
exit 1
|
|
13
13
|
fi
|
|
14
14
|
|
|
15
15
|
NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1)
|
|
16
|
-
if [ "$NODE_VERSION" -lt
|
|
17
|
-
echo "Error: Node.js
|
|
16
|
+
if [ "$NODE_VERSION" -lt 22 ]; then
|
|
17
|
+
echo "Error: Node.js 22+ required (found v$NODE_VERSION)"
|
|
18
18
|
exit 1
|
|
19
19
|
fi
|
|
20
20
|
echo "Node.js: $(node -v)"
|
|
@@ -60,7 +60,7 @@ fi
|
|
|
60
60
|
# Install dependencies
|
|
61
61
|
echo ""
|
|
62
62
|
echo "Installing dependencies..."
|
|
63
|
-
|
|
63
|
+
scripts/install-deps
|
|
64
64
|
|
|
65
65
|
echo ""
|
|
66
66
|
echo "Setup complete!"
|
package/tsconfig.json
CHANGED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// Native modules are compiled for one Node ABI. After a Node upgrade they fail
|
|
2
|
-
// at the first database call, so check before starting and rebuild if needed.
|
|
3
|
-
import { createRequire } from "module";
|
|
4
|
-
import { execSync } from "child_process";
|
|
5
|
-
|
|
6
|
-
const require = createRequire(import.meta.url);
|
|
7
|
-
const modules = ["better-sqlite3", "node-pty"];
|
|
8
|
-
|
|
9
|
-
function loads(name) {
|
|
10
|
-
try {
|
|
11
|
-
if (name === "better-sqlite3") require(name)(":memory:").close();
|
|
12
|
-
else require(name);
|
|
13
|
-
return true;
|
|
14
|
-
} catch (err) {
|
|
15
|
-
return !String(err?.message).includes("NODE_MODULE_VERSION");
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const stale = modules.filter((m) => !loads(m));
|
|
20
|
-
if (stale.length) {
|
|
21
|
-
console.log(`Rebuilding ${stale.join(", ")} for Node ${process.version}...`);
|
|
22
|
-
execSync(`npm rebuild ${stale.join(" ")}`, { stdio: "inherit" });
|
|
23
|
-
}
|