youmd 0.8.29 → 0.9.1

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 (57) hide show
  1. package/dist/commands/orchestrate.d.ts +12 -0
  2. package/dist/commands/orchestrate.d.ts.map +1 -0
  3. package/dist/commands/orchestrate.js +273 -0
  4. package/dist/commands/orchestrate.js.map +1 -0
  5. package/dist/commands/remote.d.ts +8 -0
  6. package/dist/commands/remote.d.ts.map +1 -1
  7. package/dist/commands/remote.js +8 -0
  8. package/dist/commands/remote.js.map +1 -1
  9. package/dist/commands/stack.d.ts.map +1 -1
  10. package/dist/commands/stack.js +37 -3
  11. package/dist/commands/stack.js.map +1 -1
  12. package/dist/commands/status.js +1 -1
  13. package/dist/commands/status.js.map +1 -1
  14. package/dist/commands/storage.d.ts +7 -0
  15. package/dist/commands/storage.d.ts.map +1 -0
  16. package/dist/commands/storage.js +220 -0
  17. package/dist/commands/storage.js.map +1 -0
  18. package/dist/index.js +53 -0
  19. package/dist/index.js.map +1 -1
  20. package/dist/lib/api.d.ts +32 -0
  21. package/dist/lib/api.d.ts.map +1 -1
  22. package/dist/lib/api.js +21 -0
  23. package/dist/lib/api.js.map +1 -1
  24. package/dist/lib/config.d.ts +15 -0
  25. package/dist/lib/config.d.ts.map +1 -1
  26. package/dist/lib/config.js.map +1 -1
  27. package/dist/lib/daemon.d.ts +19 -0
  28. package/dist/lib/daemon.d.ts.map +1 -1
  29. package/dist/lib/daemon.js +72 -1
  30. package/dist/lib/daemon.js.map +1 -1
  31. package/dist/lib/foldermd.d.ts +71 -0
  32. package/dist/lib/foldermd.d.ts.map +1 -0
  33. package/dist/lib/foldermd.js +244 -0
  34. package/dist/lib/foldermd.js.map +1 -0
  35. package/dist/lib/orchestrator/loop.d.ts +55 -0
  36. package/dist/lib/orchestrator/loop.d.ts.map +1 -0
  37. package/dist/lib/orchestrator/loop.js +248 -0
  38. package/dist/lib/orchestrator/loop.js.map +1 -0
  39. package/dist/lib/orchestrator/supervisor.d.ts +80 -0
  40. package/dist/lib/orchestrator/supervisor.d.ts.map +1 -0
  41. package/dist/lib/orchestrator/supervisor.js +315 -0
  42. package/dist/lib/orchestrator/supervisor.js.map +1 -0
  43. package/dist/lib/orchestrator/tools.d.ts +16 -0
  44. package/dist/lib/orchestrator/tools.d.ts.map +1 -0
  45. package/dist/lib/orchestrator/tools.js +258 -0
  46. package/dist/lib/orchestrator/tools.js.map +1 -0
  47. package/dist/lib/remote-executor.d.ts +15 -1
  48. package/dist/lib/remote-executor.d.ts.map +1 -1
  49. package/dist/lib/remote-executor.js +195 -0
  50. package/dist/lib/remote-executor.js.map +1 -1
  51. package/dist/mcp/registry.d.ts.map +1 -1
  52. package/dist/mcp/registry.js +89 -0
  53. package/dist/mcp/registry.js.map +1 -1
  54. package/package.json +1 -1
  55. package/scripts/skillstack-sync/com.you.orchestrator-watch.plist +38 -0
  56. package/scripts/skillstack-sync/install-daemons-linux.sh +168 -0
  57. package/scripts/skillstack-sync/install-daemons.sh +1 -1
@@ -0,0 +1,168 @@
1
+ #!/usr/bin/env bash
2
+ # install-daemons-linux.sh — install resident You.md sync daemons as systemd --user units
3
+ #
4
+ # The Linux counterpart to install-daemons.sh (which is macOS/launchd-only). Lets You.md
5
+ # run always-on on a headless Linux VPS (Hostinger, etc.) so the box stays subscribed to the
6
+ # Convex websocket, picks up cross-machine agent-bus commands, and keeps skills/stacks/context
7
+ # in sync with your Macs — exactly like a Mac mini does via launchd.
8
+ #
9
+ # Design:
10
+ # - you-realtime-sync.service → long-running `youmd sync --live --daemon` (Restart=always)
11
+ # - you-{skillstack,identity,context}-sync.service+.timer → interval oneshots
12
+ # - loginctl enable-linger so the units run without an active login session (critical on a VPS)
13
+ #
14
+ # Idempotent: safe to re-run. Does NOT need sudo — runs as the current user via `systemctl --user`.
15
+ #
16
+ # Usage: ./install-daemons-linux.sh
17
+
18
+ set -euo pipefail
19
+
20
+ YOU_HOME="${YOU_HOME:-${YOUMD_HOME:-${HOME}/.you}}"
21
+ LOG_DIR="${YOU_HOME}/logs"
22
+ UNIT_DIR="${XDG_CONFIG_HOME:-${HOME}/.config}/systemd/user"
23
+
24
+ # Resolve an absolute path to the You.md binary — systemd --user units do NOT source the
25
+ # login profile, so we cannot rely on PATH picking up the npm global bin at runtime.
26
+ YOU_BIN="$(command -v youmd || command -v you || true)"
27
+ if [ -z "${YOU_BIN}" ]; then
28
+ echo "ERROR: could not find the 'youmd' (or 'you') binary on PATH." >&2
29
+ echo " Install the runtime first: curl -fsSL https://you.md/install.sh | bash" >&2
30
+ exit 1
31
+ fi
32
+
33
+ if ! systemctl --user --version >/dev/null 2>&1; then
34
+ echo "ERROR: 'systemctl --user' is unavailable on this host." >&2
35
+ echo " This box has no systemd user instance; cannot install resident daemons here." >&2
36
+ echo " Fallback: run 'youmd sync --live' under nohup/pm2/tmux, or a cron for interval sync." >&2
37
+ exit 1
38
+ fi
39
+
40
+ # systemd >= 240 is required for StandardOutput=append: (so the health check can read log files).
41
+ SYSTEMD_VER="$(systemctl --version 2>/dev/null | head -n1 | awk '{print $2}' | tr -d -c '0-9')"
42
+ USE_APPEND=1
43
+ if [ -n "${SYSTEMD_VER}" ] && [ "${SYSTEMD_VER}" -lt 240 ] 2>/dev/null; then
44
+ USE_APPEND=0
45
+ echo "WARN: systemd ${SYSTEMD_VER} < 240; logging to the journal only (file-based health may be blank)."
46
+ fi
47
+
48
+ echo "==> You.md binary: ${YOU_BIN}"
49
+ echo "==> Log directory: ${LOG_DIR}"
50
+ echo "==> Unit directory: ${UNIT_DIR}"
51
+ mkdir -p "${LOG_DIR}" "${UNIT_DIR}"
52
+
53
+ # A sane PATH for the units (npm global locations + system bins); HOME is inherited by --user.
54
+ UNIT_PATH="${HOME}/.you/bin:${HOME}/.youmd/npm-global/bin:${HOME}/.npm-global/bin:/usr/local/bin:/usr/bin:/bin"
55
+
56
+ # Emit StandardOutput/StandardError lines for a unit given a log basename.
57
+ log_lines() {
58
+ local base="$1"
59
+ if [ "${USE_APPEND}" = "1" ]; then
60
+ printf 'StandardOutput=append:%s/%s.out.log\nStandardError=append:%s/%s.err.log\n' \
61
+ "${LOG_DIR}" "${base}" "${LOG_DIR}" "${base}"
62
+ else
63
+ printf 'StandardOutput=journal\nStandardError=journal\n'
64
+ fi
65
+ }
66
+
67
+ # write_service <unit-name> <description> <youmd-args> <log-base> <restart?>
68
+ write_service() {
69
+ local unit="$1" desc="$2" cmd_args="$3" base="$4" restart="$5"
70
+ local dst="${UNIT_DIR}/${unit}"
71
+ echo " - writing ${unit}"
72
+ {
73
+ printf '[Unit]\nDescription=%s\nStartLimitIntervalSec=0\n\n[Service]\n' "${desc}"
74
+ if [ "${restart}" = "always" ]; then
75
+ printf 'Type=simple\nRestart=always\nRestartSec=10\n'
76
+ else
77
+ printf 'Type=oneshot\n'
78
+ fi
79
+ printf 'Environment=HOME=%s\n' "${HOME}"
80
+ printf 'Environment=YOU_HOME=%s\n' "${YOU_HOME}"
81
+ printf 'Environment=PATH=%s\n' "${UNIT_PATH}"
82
+ # Run via a login shell so PATH is sourced from the user's profile — the CLI shells out to
83
+ # node/git and the claude/codex/cursor harnesses by name, and those may live under nvm/fnm
84
+ # prefixes not in the static Environment=PATH above (mirrors the macOS `/bin/zsh -lc` plists).
85
+ printf "ExecStart=/bin/bash -lc 'exec \"%s\" %s'\n" "${YOU_BIN}" "${cmd_args}"
86
+ log_lines "${base}"
87
+ if [ "${restart}" = "always" ]; then
88
+ printf '\n[Install]\nWantedBy=default.target\n'
89
+ fi
90
+ } > "${dst}"
91
+ }
92
+
93
+ # write_timer <unit-name> <description> <interval-seconds> <service-unit>
94
+ write_timer() {
95
+ local unit="$1" desc="$2" interval="$3" service="$4"
96
+ local dst="${UNIT_DIR}/${unit}"
97
+ echo " - writing ${unit}"
98
+ cat > "${dst}" <<EOF
99
+ [Unit]
100
+ Description=${desc}
101
+
102
+ [Timer]
103
+ OnBootSec=30
104
+ OnUnitActiveSec=${interval}
105
+ Unit=${service}
106
+ AccuracySec=15
107
+
108
+ [Install]
109
+ WantedBy=timers.target
110
+ EOF
111
+ }
112
+
113
+ echo ""
114
+ echo "==> Generating systemd --user units"
115
+
116
+ # Live realtime brain — long-running websocket sync, restart on crash.
117
+ write_service "you-realtime-sync.service" "You.md realtime brain (live websocket sync)" \
118
+ "sync --live --daemon" "realtime-sync" "always"
119
+
120
+ # Interval daemons (oneshot service + timer).
121
+ write_service "you-skillstack-sync.service" "You.md skills/stacks sync" "stack sync" "skillstack-sync" "oneshot"
122
+ write_timer "you-skillstack-sync.timer" "You.md skills/stacks sync (every 5m)" 300 "you-skillstack-sync.service"
123
+
124
+ write_service "you-identity-sync.service" "You.md identity/API sync" "sync --daemon" "identity-sync" "oneshot"
125
+ write_timer "you-identity-sync.timer" "You.md identity/API sync (every 5m)" 300 "you-identity-sync.service"
126
+
127
+ write_service "you-context-sync.service" "You.md project-context sync" "stack context-sync" "context-sync" "oneshot"
128
+ write_timer "you-context-sync.timer" "You.md project-context sync (every 15m)" 900 "you-context-sync.service"
129
+
130
+ write_service "you-orchestrator-watch.service" "You.md orchestrator report-back" "orchestrate watch --once" "orchestrator-watch" "oneshot"
131
+ write_timer "you-orchestrator-watch.timer" "You.md orchestrator report-back (every 60s)" 60 "you-orchestrator-watch.service"
132
+
133
+ echo ""
134
+ echo "==> Enabling linger so daemons run without an active login session"
135
+ # Linger is what keeps the units alive AFTER you log out — without it the user manager is torn
136
+ # down at logout and every "resident" daemon stops, defeating the headless-VPS goal. So if we
137
+ # cannot enable it, warn loudly (not a silent advisory) with the exact fix.
138
+ if loginctl enable-linger "$(id -un)" 2>/dev/null; then
139
+ echo " linger enabled for $(id -un)"
140
+ else
141
+ echo " !! WARNING: could not enable linger. Daemons will STOP when you log out." >&2
142
+ echo " !! Fix (one time): sudo loginctl enable-linger $(id -un)" >&2
143
+ fi
144
+
145
+ echo ""
146
+ echo "==> Reloading + starting units"
147
+ systemctl --user daemon-reload
148
+ systemctl --user enable --now you-realtime-sync.service
149
+ systemctl --user enable --now you-skillstack-sync.timer
150
+ systemctl --user enable --now you-identity-sync.timer
151
+ systemctl --user enable --now you-context-sync.timer
152
+ systemctl --user enable --now you-orchestrator-watch.timer
153
+
154
+ echo ""
155
+ echo "================================================================"
156
+ echo "Resident You.md daemons installed and running (systemd --user)."
157
+ echo ""
158
+ echo "Status:"
159
+ echo " systemctl --user status you-realtime-sync.service"
160
+ echo " systemctl --user list-timers 'you-*'"
161
+ echo ""
162
+ echo "Logs:"
163
+ echo " journalctl --user -u you-realtime-sync.service -f"
164
+ echo " ${LOG_DIR}/realtime-sync.out.log"
165
+ echo ""
166
+ echo "Uninstall:"
167
+ echo " youmd stack daemon uninstall"
168
+ echo "================================================================"
@@ -12,7 +12,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
12
12
  LAUNCH_AGENTS_DIR="${HOME}/Library/LaunchAgents"
13
13
  LOG_DIR="${YOU_HOME:-${YOUMD_HOME:-${HOME}/.you}}/logs"
14
14
 
15
- PLISTS="com.you.realtime-sync com.you.skillstack-sync com.you.identity-sync com.you.context-sync"
15
+ PLISTS="com.you.realtime-sync com.you.skillstack-sync com.you.identity-sync com.you.context-sync com.you.orchestrator-watch"
16
16
  LEGACY_PLISTS="com.youmd.realtime-sync com.youmd.skillstack-sync com.youmd.identity-sync com.youmd.context-sync"
17
17
 
18
18
  echo "==> Creating log directory: ${LOG_DIR}"