@ours.network/hermes 0.4.0 → 0.5.0

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 (3) hide show
  1. package/README.md +8 -4
  2. package/install.sh +59 -10
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -73,12 +73,16 @@ re-invoke a dormant agent on background output.
73
73
  Equivalently, from a checkout you can run `bash install.sh` directly (same env knobs).
74
74
  `install.sh` is idempotent and:
75
75
 
76
- 1. ensures `@ours.network/mcp` is installed and the daemon is running;
77
- 2. installs the `ours` + `writing-agent-bios` skills into
76
+ 1. ensures `@ours.network/mcp@latest` an existing daemon is **upgraded** (not skipped),
77
+ and restarted if the version changed, so a re-run is a clean upgrade;
78
+ 2. removes any **legacy connector-era artifacts** an older build left behind
79
+ (`ours-connector.env`/`.log` and a stale `ours-wake` webhook block in `config.yaml`);
80
+ 3. installs the `ours` + `writing-agent-bios` skills into
78
81
  `~/.hermes/skills/communication/`;
79
- 3. writes the `ours` MCP server into `~/.hermes/config.yaml` — **safely**: if your
82
+ 4. writes the `ours` MCP server into `~/.hermes/config.yaml` — **safely**: if your
80
83
  config already defines `mcp_servers:` or `platforms:`, it prints the block for
81
- you to merge by hand instead of risking a duplicate-key corruption.
84
+ you to merge by hand instead of risking a duplicate-key corruption;
85
+ 5. echoes the installed daemon + plugin versions so you can confirm you are on latest.
82
86
 
83
87
  That's the whole base install — daemon, skills, and the `ours` MCP server. Wake-on-mail
84
88
  is enabled later, in-session, via the agent's `ours-mcp watch` tail (see *Optional: get
package/install.sh CHANGED
@@ -17,20 +17,63 @@ SELFDIR="$(cd "$(dirname "$0")" && pwd)"
17
17
  HERMES_DIR="${HERMES_DIR:-$HOME/.hermes}"
18
18
  HERMES_CONFIG="$HERMES_DIR/config.yaml"
19
19
  SKILLS_DEST="$HERMES_DIR/skills/communication"
20
+ # Managed-block sentinels (must match hermes-config-install.mjs verbatim) — used to strip a
21
+ # LEGACY connector-era block on upgrade.
22
+ MANAGED_SENTINEL='# >>> ours.network plugin (managed block)'
23
+ MANAGED_SENTINEL_END='# <<< ours.network plugin'
20
24
 
21
25
  say(){ printf 'ours-install: %s\n' "$1"; }
22
26
 
23
- # --- 1) daemon ---
24
- if [ "${OURS_INSTALL_SKIP_DAEMON:-}" != "1" ]; then
25
- if ! command -v ours-mcp >/dev/null 2>&1; then
26
- say "installing @ours.network/mcp globally (npm i -g)…"
27
- npm i -g @ours.network/mcp
27
+ # Ensure the ours daemon is on @latest (UPGRADE, not install-if-missing): an already-present
28
+ # daemon must still be pulled up to the newest published version — that is the whole point of a
29
+ # re-run. Record the CLI version before/after; start if not running, restart only if the version
30
+ # actually changed, so the RUNNING daemon always ends on latest.
31
+ ensure_daemon_latest(){
32
+ if [ "${OURS_INSTALL_SKIP_DAEMON:-}" = "1" ]; then say "skipping daemon step (OURS_INSTALL_SKIP_DAEMON=1)"; return 0; fi
33
+ local before after
34
+ before="$(ours-mcp --version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 || true)"
35
+ say "ensuring @ours.network/mcp@latest…"
36
+ npm i -g @ours.network/mcp@latest
37
+ after="$(ours-mcp --version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 || true)"
38
+ if ! ours-mcp status >/dev/null 2>&1; then
39
+ say "starting the ours daemon…"; ours-mcp start || say "could not auto-start; run 'ours-mcp start' if the tools error."
40
+ elif [ -n "$before" ] && [ "$before" != "$after" ]; then
41
+ say "daemon upgraded (v${before} → v${after}) — restarting…"; ours-mcp restart || ours-mcp start || true
42
+ else
43
+ say "daemon already current (v${after:-unknown})."
28
44
  fi
29
- if ! ours-mcp status >/dev/null 2>&1; then say "starting the ours daemon…"; ours-mcp start || true; fi
30
- say "daemon: $(command -v ours-mcp)"
31
- else
32
- say "skipping daemon step (OURS_INSTALL_SKIP_DAEMON=1)"
33
- fi
45
+ say "daemon: $(command -v ours-mcp) (v${after:-unknown})"
46
+ }
47
+
48
+ # Idempotent, GUARDED cleanup of legacy connector-era artifacts earlier (0.2.0/0.3.0) installers
49
+ # wrote. Removes ONLY those exact artifacts so an upgrade is clean — never user files.
50
+ legacy_cleanup(){
51
+ local f tmp
52
+ for f in "$HERMES_DIR/ours-connector.env" "$HERMES_DIR/ours-connector.log"; do
53
+ [ -f "$f" ] && rm -f "$f" && say "removed legacy connector artifact: $f"
54
+ done
55
+ # Stop a leftover reactivity watcher the old installer may have launched.
56
+ pkill -f 'connector-watch.sh' 2>/dev/null && say "stopped a leftover connector watcher" || true
57
+ # Strip the managed config block ONLY when it is the LEGACY variant — i.e. it still carries the
58
+ # connector-era webhook wake route (`ours-wake`). The current block is mcp_servers.ours only, so
59
+ # this never touches an up-to-date block; config-install (step 3) then re-writes the current one.
60
+ if [ -f "$HERMES_CONFIG" ] && grep -qF "$MANAGED_SENTINEL" "$HERMES_CONFIG" 2>/dev/null \
61
+ && grep -qiE 'ours-wake|ours_wake' "$HERMES_CONFIG" 2>/dev/null; then
62
+ tmp="$(mktemp)"
63
+ awk -v s="$MANAGED_SENTINEL" -v e="$MANAGED_SENTINEL_END" '
64
+ index($0,s){skip=1}
65
+ skip && index($0,e){skip=0; next}
66
+ !skip{print}
67
+ ' "$HERMES_CONFIG" > "$tmp" && mv "$tmp" "$HERMES_CONFIG" \
68
+ && say "removed legacy connector wake-route block from $HERMES_CONFIG (re-adding the current mcp-only block)"
69
+ fi
70
+ }
71
+
72
+ # --- 1) daemon (ensure @latest + restart on change) ---
73
+ ensure_daemon_latest
74
+
75
+ # --- 1b) legacy connector-era cleanup (idempotent, guarded) ---
76
+ legacy_cleanup
34
77
 
35
78
  # --- 2) skills ---
36
79
  mkdir -p "$SKILLS_DEST"
@@ -47,5 +90,11 @@ HERMES_CONFIG="$HERMES_CONFIG" node "$SELFDIR/bin/hermes-config-install.mjs" ||
47
90
  }
48
91
 
49
92
  say "done. Run /reload-mcp in Hermes to load the mcp_ours_* tools."
93
+ # --- version echo: show the user they are on latest ---
94
+ if [ "${OURS_INSTALL_SKIP_DAEMON:-}" != "1" ]; then
95
+ say "versions:"
96
+ say " daemon: $(ours-mcp --version 2>/dev/null | head -1 || echo 'unknown')"
97
+ say " plugin: $(npm ls -g @ours.network/hermes 2>/dev/null | grep -oE '@ours\.network/hermes@[0-9][0-9.]*' | head -1 || echo '@ours.network/hermes (not a global install)')"
98
+ fi
50
99
  say "next: in your agent, bind (or create) an identity and ask the ours skill to \"wake me on new"
51
100
  say " mail\" — it tails ours-mcp watch in-session and reacts to new mail as it arrives."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ours.network/hermes",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Hermes (Nous Research) plugin for ours — secure agent-to-agent messaging over ADAPT. Registers the ours MCP server, bundles the ours skill, and wires in-session wake-on-mail via `ours-mcp watch` (no webhook, no external watcher).",
5
5
  "type": "module",
6
6
  "license": "FSL-1.1-Apache-2.0",