pisha-server 0.0.0-stage → 0.0.11

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 (125) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +40 -2
  3. package/accounts/accounts.js +754 -0
  4. package/accounts/index.js +1 -0
  5. package/accounts/passwords.js +41 -0
  6. package/accounts/totp.js +54 -0
  7. package/boards/boards.js +1079 -0
  8. package/boards/github.js +212 -0
  9. package/boards/index.js +1 -0
  10. package/boards/sync.js +980 -0
  11. package/companies.js +294 -0
  12. package/company-export.js +101 -0
  13. package/company.js +79 -0
  14. package/dashboard/dashboard.js +407 -0
  15. package/dashboard/index.js +1 -0
  16. package/data-upgrade.js +69 -0
  17. package/install/linux.sh +181 -0
  18. package/install/macos.sh +121 -0
  19. package/install/windows.bat +54 -0
  20. package/machines/index.js +3 -0
  21. package/machines/machines.js +910 -0
  22. package/messaging/inbox.js +252 -0
  23. package/messaging/index.js +3 -0
  24. package/messaging/messaging.js +551 -0
  25. package/messaging/plans.js +67 -0
  26. package/observation/index.js +1 -0
  27. package/observation/observation.js +224 -0
  28. package/organization/index.js +1 -0
  29. package/organization/organization.js +218 -0
  30. package/package.json +54 -4
  31. package/permissions/index.js +1 -0
  32. package/permissions/permissions.js +211 -0
  33. package/pisha-host.mjs +3297 -0
  34. package/pisha-host.mjs.sig +1 -0
  35. package/platform/acme.js +207 -0
  36. package/platform/basics.js +14 -0
  37. package/platform/config.js +154 -0
  38. package/platform/control.js +93 -0
  39. package/platform/credentials.js +151 -0
  40. package/platform/database.js +251 -0
  41. package/platform/errors.js +13 -0
  42. package/platform/files.js +50 -0
  43. package/platform/http.js +207 -0
  44. package/platform/index.js +58 -0
  45. package/platform/limits.js +122 -0
  46. package/platform/listen.js +183 -0
  47. package/platform/roles.js +6 -0
  48. package/platform/stream.js +19 -0
  49. package/platform/text.js +83 -0
  50. package/platform/ws.js +186 -0
  51. package/routes.js +405 -0
  52. package/server.js +65 -0
  53. package/sessions/index.js +1 -0
  54. package/sessions/sessions.js +533 -0
  55. package/ui/LICENSE-affectui.txt +26 -0
  56. package/ui/addmachine.js +151 -0
  57. package/ui/api.js +20 -0
  58. package/ui/app.js +143 -0
  59. package/ui/attention.js +78 -0
  60. package/ui/back.js +166 -0
  61. package/ui/boards.js +958 -0
  62. package/ui/chat.js +388 -0
  63. package/ui/content.js +157 -0
  64. package/ui/dialogs.js +135 -0
  65. package/ui/doing.js +112 -0
  66. package/ui/dom.js +6 -0
  67. package/ui/ds-base.css +146 -0
  68. package/ui/ds-components.css +229 -0
  69. package/ui/fonts/LICENSE-space-grotesk.txt +93 -0
  70. package/ui/fonts/space-grotesk-latin-700-normal.woff2 +0 -0
  71. package/ui/fonts/space-grotesk-latin-ext-700-normal.woff2 +0 -0
  72. package/ui/format.js +25 -0
  73. package/ui/i18n.js +2093 -0
  74. package/ui/icons/apple-touch-icon.png +0 -0
  75. package/ui/icons/icon-192.png +0 -0
  76. package/ui/icons/icon-512.png +0 -0
  77. package/ui/icons/maskable-512.png +0 -0
  78. package/ui/icons.js +40 -0
  79. package/ui/inbox.js +535 -0
  80. package/ui/index.html +103 -0
  81. package/ui/machines.js +261 -0
  82. package/ui/manifest.webmanifest +16 -0
  83. package/ui/mosaic.js +189 -0
  84. package/ui/nav.js +141 -0
  85. package/ui/newteam.js +223 -0
  86. package/ui/org.js +653 -0
  87. package/ui/overlays.css +126 -0
  88. package/ui/palette.js +179 -0
  89. package/ui/people.js +370 -0
  90. package/ui/permissions.js +202 -0
  91. package/ui/qr.js +158 -0
  92. package/ui/router.js +171 -0
  93. package/ui/routes.js +46 -0
  94. package/ui/screen-boards.css +241 -0
  95. package/ui/screen-inbox.css +201 -0
  96. package/ui/screen-machines.css +76 -0
  97. package/ui/screen-mosaic.css +26 -0
  98. package/ui/screen-newteam.css +90 -0
  99. package/ui/screen-org.css +113 -0
  100. package/ui/screen-session.css +99 -0
  101. package/ui/screen-signin.css +28 -0
  102. package/ui/screen-team.css +80 -0
  103. package/ui/screen-teams.css +41 -0
  104. package/ui/session.js +42 -0
  105. package/ui/shell.css +122 -0
  106. package/ui/signin.js +120 -0
  107. package/ui/squads.js +370 -0
  108. package/ui/state.js +59 -0
  109. package/ui/stream.js +268 -0
  110. package/ui/styles.css +343 -0
  111. package/ui/team.js +115 -0
  112. package/ui/teams.js +58 -0
  113. package/ui/terminal.js +261 -0
  114. package/ui/theme.js +32 -0
  115. package/ui/timeline.js +163 -0
  116. package/ui/topbar.js +205 -0
  117. package/ui/voice-parse.js +98 -0
  118. package/ui/voice.js +320 -0
  119. package/vendor/InterVariable.woff2 +0 -0
  120. package/vendor/LICENSE-inter +92 -0
  121. package/vendor/LICENSE-xterm +21 -0
  122. package/vendor/README.md +8 -0
  123. package/vendor/addon-fit.js +2 -0
  124. package/vendor/xterm.css +218 -0
  125. package/vendor/xterm.js +2 -0
@@ -0,0 +1,121 @@
1
+ #!/usr/bin/env bash
2
+ # Pisha: prepare this Mac and join it to a Pisha server. The dashboard
3
+ # gives you the exact command, with your code. It downloads this script, checks
4
+ # it, and leaves the code in a file for it:
5
+ #
6
+ # bash install.sh https://your-server --code-file code [options]
7
+ #
8
+ # It installs what is missing (tmux with Homebrew, Node.js 22, and the agents
9
+ # chosen: Claude Code unless --no-claude, Codex CLI with --codex, Grok CLI with --grok),
10
+ # then pisha-host, which joins the machine, installs the Pisha plugin, the
11
+ # "pisha-host" command and a service that keeps it running.
12
+ # Options are passed to pisha-host: --allow-home, --insecure, --no-service.
13
+ set -eu
14
+
15
+ # (All in a function: piped into bash, the whole script is read before anything runs.)
16
+ main() {
17
+ SERVER="${1:-}"; [ $# -gt 0 ] && shift
18
+ # The code comes in a file, so it is in no program's arguments, which anyone
19
+ # on this machine can read (or after the URL, as older commands gave it).
20
+ CODE=""; CODE_FILE=""
21
+ case "${1:-}" in ""|-*) ;; *) CODE="$1"; shift ;; esac
22
+ SHA=""
23
+ WANT_CLAUDE=1; WANT_CODEX=""; WANT_GROK=""
24
+ ARGS=()
25
+ while [ $# -gt 0 ]; do
26
+ case "$1" in
27
+ --sha256) [ $# -ge 2 ] || { echo "--sha256 needs a value" >&2; exit 2; }; SHA="$2"; shift 2 ;;
28
+ --code-file) [ $# -ge 2 ] || { echo "--code-file needs a path" >&2; exit 2; }; CODE_FILE="$2"; shift 2 ;;
29
+ --os-user*) echo "--os-user is for Linux. On macOS: create the user, log in as it, and run this command there." >&2; exit 2 ;;
30
+ # The agents to install.
31
+ --no-claude) WANT_CLAUDE=""; shift ;;
32
+ --codex) WANT_CODEX=1; shift ;;
33
+ --grok) WANT_GROK=1; shift ;;
34
+ *) ARGS+=("$1"); shift ;;
35
+ esac
36
+ done
37
+ if [ -n "$CODE_FILE" ]; then
38
+ [ -f "$CODE_FILE" ] || { echo "--code-file: $CODE_FILE is not there" >&2; exit 2; }
39
+ CODE="$(cat "$CODE_FILE")"
40
+ rm -f "$CODE_FILE"
41
+ fi
42
+ if [ -z "$SERVER" ] || [ -z "$CODE" ]; then
43
+ echo "usage: macos.sh <server-url> --code-file <file> [--allow-home] [--insecure] [--no-service]" >&2
44
+ exit 2
45
+ fi
46
+
47
+ say() { printf '\n\033[1m==> %s\033[0m\n' "$*"; }
48
+
49
+ if [ "$(id -u)" -eq 0 ]; then
50
+ echo "Run this as your own user, not as root." >&2
51
+ exit 1
52
+ fi
53
+
54
+ # 1. tmux, with Homebrew
55
+ for b in /opt/homebrew/bin/brew /usr/local/bin/brew; do
56
+ [ -x "$b" ] && eval "$("$b" shellenv)" && break
57
+ done
58
+ if ! command -v tmux >/dev/null 2>&1; then
59
+ if ! command -v brew >/dev/null 2>&1; then
60
+ echo "tmux is needed, and it is installed with Homebrew. Install Homebrew first (https://brew.sh):" >&2
61
+ echo ' /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"' >&2
62
+ echo "then run this command again." >&2
63
+ exit 1
64
+ fi
65
+ say "Installing tmux"
66
+ brew install tmux
67
+ fi
68
+
69
+ # 2. Node.js 22.13 or later (with nvm, in your home, if missing or older)
70
+ node_ok() { command -v node >/dev/null 2>&1 && node -e 'const [a,b]=process.versions.node.split(".").map(Number);process.exit(a>22||(a===22&&b>=13)?0:1)'; }
71
+ if ! node_ok; then
72
+ say "Installing Node.js 22 (with nvm, in your home folder)"
73
+ export NVM_DIR="$HOME/.nvm"
74
+ [ -s "$NVM_DIR/nvm.sh" ] || curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
75
+ set +eu; . "$NVM_DIR/nvm.sh"; nvm install 22 && nvm alias default 22; set -eu
76
+ node_ok || { echo "Node.js 22 could not be installed: install Node.js 22.13 or later, then run this command again." >&2; exit 1; }
77
+ fi
78
+
79
+ # 3. The agents chosen, each in this user's home, each from its maker:
80
+ # Claude Code and Grok CLI with their own installers, Codex CLI from npm.
81
+ export PATH="$HOME/.local/bin:$PATH"
82
+ if [ -n "$WANT_CLAUDE" ] && ! command -v claude >/dev/null 2>&1; then
83
+ say "Installing Claude Code"
84
+ curl -fsSL https://claude.ai/install.sh | bash
85
+ fi
86
+ if [ -n "$WANT_CODEX" ] && ! command -v codex >/dev/null 2>&1; then
87
+ say "Installing Codex CLI"
88
+ npm install -g --prefix "$HOME/.local" @openai/codex
89
+ fi
90
+ if [ -n "$WANT_GROK" ] && ! command -v grok >/dev/null 2>&1; then
91
+ say "Installing Grok CLI"
92
+ curl -fsSL https://x.ai/cli/install.sh | bash
93
+ fi
94
+
95
+ # New terminals find the agents and "pisha-host" in ~/.local/bin.
96
+ for rc in "$HOME/.zshrc" "$HOME/.bash_profile"; do
97
+ if [ "$rc" = "$HOME/.zshrc" ] || [ -f "$rc" ]; then
98
+ # (Managed elsewhere and read-only, as with home-manager: not worth stopping for.)
99
+ { touch "$rc" && { grep -q '\.local/bin' "$rc" || printf '\n# Added by the Pisha installer\nexport PATH="$HOME/.local/bin:$PATH"\n' >> "$rc"; }; } 2>/dev/null || echo "Could not add ~/.local/bin to $rc: add it to your PATH yourself." >&2
100
+ fi
101
+ done
102
+
103
+ # 4. pisha-host: downloaded into a new private folder, checked, and run.
104
+ say "Joining this Mac to $SERVER"
105
+ DIR="$(mktemp -d)"
106
+ cd "$DIR"
107
+ curl -fsSLo pisha-host.mjs "${SERVER%/}/host/pisha-host.mjs"
108
+ if [ -n "$SHA" ]; then
109
+ echo "$SHA pisha-host.mjs" | shasum -a 256 -c - >/dev/null || { echo "pisha-host.mjs does not match the dashboard's checksum: stopped." >&2; exit 1; }
110
+ fi
111
+ printf %s "$CODE" > code
112
+ node pisha-host.mjs enroll "$SERVER" --code-file=code ${ARGS[@]+"${ARGS[@]}"}
113
+
114
+ say "Done"
115
+ echo "If you haven't yet, sign in to each agent once in a terminal, so its sessions can start:"
116
+ [ -z "$WANT_CLAUDE" ] || echo " claude (then /login if it asks)"
117
+ [ -z "$WANT_CODEX" ] || echo " codex login"
118
+ [ -z "$WANT_GROK" ] || echo " grok login"
119
+ }
120
+
121
+ main "$@"
@@ -0,0 +1,54 @@
1
+ @echo off
2
+ rem Pisha: prepare this Windows machine and join it to a Pisha server.
3
+ rem Pisha runs inside WSL (Ubuntu), together with Claude Code: this checks
4
+ rem that WSL is there and runs the Linux installer inside it.
5
+ rem The dashboard gives you the exact command, with your code:
6
+ rem
7
+ rem windows.bat https://your-server --linux-sha256 X [--sha256 X] [--server-key X] [--company X] [--allow-home] [--insecure]
8
+ rem
9
+ rem The code comes in PISHA_ENROLL_CODE, so it is in no program's arguments.
10
+ setlocal
11
+
12
+ if "%~1"=="" goto usage
13
+ if not defined PISHA_ENROLL_CODE goto usage
14
+
15
+ where wsl >nul 2>nul
16
+ if errorlevel 1 goto nowsl
17
+ wsl -e true >nul 2>nul
18
+ if errorlevel 1 goto nowsl
19
+
20
+ echo.
21
+ echo ==^> Setting up Pisha inside WSL (it may ask for your Ubuntu password)
22
+ set "URL=%~1"
23
+ set "LINUX_SHA="
24
+ set "REST="
25
+ shift
26
+ :more
27
+ if "%~1"=="" goto go
28
+ if "%~1"=="--linux-sha256" (
29
+ set "LINUX_SHA=%~2"
30
+ shift
31
+ shift
32
+ goto more
33
+ )
34
+ set "REST=%REST% %1"
35
+ shift
36
+ goto more
37
+ :go
38
+ if not defined LINUX_SHA goto usage
39
+ set "WSLENV=PISHA_ENROLL_CODE:%WSLENV%"
40
+ rem Downloaded and checked inside WSL, as the Linux command does.
41
+ wsl -e bash -c "d=$(mktemp -d) && cd $d && curl -fsSLo install.sh '%URL%/install/linux.sh' && echo '%LINUX_SHA% install.sh' | sha256sum -c - >/dev/null && printf %%s $PISHA_ENROLL_CODE > code && bash install.sh '%URL%' --code-file code%REST%"
42
+ exit /b %errorlevel%
43
+
44
+ :usage
45
+ echo usage: set PISHA_ENROLL_CODE=^<code^> and run: windows.bat ^<server-url^> --linux-sha256 X [--sha256 X] [--server-key X] [--allow-home] [--insecure]
46
+ exit /b 2
47
+
48
+ :nowsl
49
+ echo.
50
+ echo Pisha runs on Windows inside WSL (Ubuntu), and WSL is not installed yet.
51
+ echo 1. Open PowerShell as administrator and run: wsl --install -d Ubuntu
52
+ echo 2. Restart Windows, open "Ubuntu" from the Start menu once and create your user.
53
+ echo 3. Run this command again.
54
+ exit /b 1
@@ -0,0 +1,3 @@
1
+ export {
2
+ createMachines, INSTALLERS, installer, hostScript, hostSignature, checkEnrollRate, enrollmentKey, offeredCredential,
3
+ } from './machines.js'