sensorium-mcp 2.17.25 → 2.17.27
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/dist/dashboard/routes/threads.d.ts.map +1 -1
- package/dist/dashboard/routes/threads.js +18 -5
- package/dist/dashboard/routes/threads.js.map +1 -1
- package/dist/data/memory/bootstrap.js +2 -2
- package/dist/data/memory/bootstrap.js.map +1 -1
- package/dist/data/memory/consolidation.d.ts.map +1 -1
- package/dist/data/memory/consolidation.js +75 -4
- package/dist/data/memory/consolidation.js.map +1 -1
- package/dist/data/memory/index.d.ts +1 -0
- package/dist/data/memory/index.d.ts.map +1 -1
- package/dist/data/memory/index.js +1 -0
- package/dist/data/memory/index.js.map +1 -1
- package/dist/data/memory/quality-scoring.d.ts +32 -0
- package/dist/data/memory/quality-scoring.d.ts.map +1 -0
- package/dist/data/memory/quality-scoring.js +182 -0
- package/dist/data/memory/quality-scoring.js.map +1 -0
- package/dist/data/memory/semantic.d.ts +12 -0
- package/dist/data/memory/semantic.d.ts.map +1 -1
- package/dist/data/memory/semantic.js +45 -2
- package/dist/data/memory/semantic.js.map +1 -1
- package/dist/data/memory/thread-registry.d.ts +7 -0
- package/dist/data/memory/thread-registry.d.ts.map +1 -1
- package/dist/data/memory/thread-registry.js +11 -1
- package/dist/data/memory/thread-registry.js.map +1 -1
- package/dist/index.js +17 -5
- package/dist/index.js.map +1 -1
- package/dist/tools/defs/memory-defs.d.ts.map +1 -1
- package/dist/tools/defs/memory-defs.js +19 -0
- package/dist/tools/defs/memory-defs.js.map +1 -1
- package/dist/tools/delegate-tool.d.ts.map +1 -1
- package/dist/tools/delegate-tool.js +6 -3
- package/dist/tools/delegate-tool.js.map +1 -1
- package/dist/tools/memory-tools.d.ts.map +1 -1
- package/dist/tools/memory-tools.js +15 -0
- package/dist/tools/memory-tools.js.map +1 -1
- package/dist/tools/thread-lifecycle.d.ts.map +1 -1
- package/dist/tools/thread-lifecycle.js +52 -32
- package/dist/tools/thread-lifecycle.js.map +1 -1
- package/package.json +10 -2
- package/scripts/install-supervisor.ps1 +67 -0
- package/scripts/install-supervisor.sh +43 -0
- package/scripts/start-supervisor.ps1 +46 -0
- package/scripts/start-supervisor.sh +20 -0
- package/supervisor/config.go +140 -0
- package/supervisor/go.mod +3 -0
- package/supervisor/health.go +390 -0
- package/supervisor/health_test.go +93 -0
- package/supervisor/keeper.go +303 -0
- package/supervisor/keeper_test.go +27 -0
- package/supervisor/lock.go +56 -0
- package/supervisor/lock_test.go +54 -0
- package/supervisor/log.go +114 -0
- package/supervisor/log_test.go +45 -0
- package/supervisor/main.go +325 -0
- package/supervisor/notify.go +53 -0
- package/supervisor/process.go +222 -0
- package/supervisor/process_test.go +94 -0
- package/supervisor/process_unix.go +14 -0
- package/supervisor/process_windows.go +15 -0
- package/supervisor/updater.go +281 -0
- package/templates/coding-task.default.md +12 -0
- package/dist/claude-keeper.d.ts +0 -24
- package/dist/claude-keeper.d.ts.map +0 -1
- package/dist/claude-keeper.js +0 -374
- package/dist/claude-keeper.js.map +0 -1
- package/dist/watcher-service.d.ts +0 -2
- package/dist/watcher-service.d.ts.map +0 -1
- package/dist/watcher-service.js +0 -997
- package/dist/watcher-service.js.map +0 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env pwsh
|
|
2
|
+
<#
|
|
3
|
+
.SYNOPSIS
|
|
4
|
+
Build and install the sensorium-supervisor Go binary.
|
|
5
|
+
.DESCRIPTION
|
|
6
|
+
Compiles the Go supervisor and places it in ~/.remote-copilot-mcp/bin/.
|
|
7
|
+
Requires Go 1.22+ installed and on PATH.
|
|
8
|
+
.PARAMETER Force
|
|
9
|
+
Rebuild even if the binary already exists.
|
|
10
|
+
#>
|
|
11
|
+
param(
|
|
12
|
+
[switch]$Force
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
$ErrorActionPreference = "Stop"
|
|
16
|
+
|
|
17
|
+
$DataDir = Join-Path $env:USERPROFILE ".remote-copilot-mcp"
|
|
18
|
+
$BinDir = Join-Path $DataDir "bin"
|
|
19
|
+
$Binary = Join-Path $BinDir "sensorium-supervisor.exe"
|
|
20
|
+
|
|
21
|
+
# Find the supervisor source directory (relative to this script)
|
|
22
|
+
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
23
|
+
$SupervisorDir = Join-Path (Split-Path -Parent $ScriptDir) "supervisor"
|
|
24
|
+
|
|
25
|
+
if (-not (Test-Path (Join-Path $SupervisorDir "go.mod"))) {
|
|
26
|
+
Write-Error "Cannot find supervisor source at $SupervisorDir"
|
|
27
|
+
exit 1
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
# Check if Go is available
|
|
31
|
+
$goExe = Get-Command go -ErrorAction SilentlyContinue
|
|
32
|
+
if (-not $goExe) {
|
|
33
|
+
Write-Host "Go is not installed. Install from https://go.dev/dl/ (requires Go 1.22+)" -ForegroundColor Red
|
|
34
|
+
exit 1
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
# Check version
|
|
38
|
+
$goVersion = (go version) -replace 'go version go', '' -replace ' .*', ''
|
|
39
|
+
Write-Host "Found Go $goVersion"
|
|
40
|
+
|
|
41
|
+
# Skip build if binary exists and is newer than source (unless -Force)
|
|
42
|
+
if (-not $Force -and (Test-Path $Binary)) {
|
|
43
|
+
$binaryTime = (Get-Item $Binary).LastWriteTime
|
|
44
|
+
$sourceFiles = Get-ChildItem $SupervisorDir -Filter "*.go"
|
|
45
|
+
$newestSource = ($sourceFiles | Sort-Object LastWriteTime -Descending | Select-Object -First 1).LastWriteTime
|
|
46
|
+
if ($binaryTime -gt $newestSource) {
|
|
47
|
+
Write-Host "sensorium-supervisor is up to date ($Binary)"
|
|
48
|
+
exit 0
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
# Ensure bin directory exists
|
|
53
|
+
New-Item -ItemType Directory -Path $BinDir -Force | Out-Null
|
|
54
|
+
|
|
55
|
+
Write-Host "Building sensorium-supervisor..."
|
|
56
|
+
Push-Location $SupervisorDir
|
|
57
|
+
try {
|
|
58
|
+
go build -o $Binary .
|
|
59
|
+
if ($LASTEXITCODE -ne 0) {
|
|
60
|
+
Write-Error "Go build failed"
|
|
61
|
+
exit 1
|
|
62
|
+
}
|
|
63
|
+
} finally {
|
|
64
|
+
Pop-Location
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
Write-Host "Installed: $Binary" -ForegroundColor Green
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Build and install the sensorium-supervisor Go binary.
|
|
3
|
+
# Requires Go 1.22+ installed and on PATH.
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
FORCE="${1:-}"
|
|
7
|
+
DATA_DIR="$HOME/.remote-copilot-mcp"
|
|
8
|
+
BIN_DIR="$DATA_DIR/bin"
|
|
9
|
+
BINARY="$BIN_DIR/sensorium-supervisor"
|
|
10
|
+
|
|
11
|
+
# Find supervisor source relative to this script
|
|
12
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
13
|
+
SUPERVISOR_DIR="$(dirname "$SCRIPT_DIR")/supervisor"
|
|
14
|
+
|
|
15
|
+
if [ ! -f "$SUPERVISOR_DIR/go.mod" ]; then
|
|
16
|
+
echo "ERROR: Cannot find supervisor source at $SUPERVISOR_DIR" >&2
|
|
17
|
+
exit 1
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
# Check Go is available
|
|
21
|
+
if ! command -v go >/dev/null 2>&1; then
|
|
22
|
+
echo "ERROR: Go is not installed. Install from https://go.dev/dl/ (requires Go 1.22+)" >&2
|
|
23
|
+
exit 1
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
echo "Found $(go version)"
|
|
27
|
+
|
|
28
|
+
# Skip if binary is newer than source (unless --force)
|
|
29
|
+
if [ "$FORCE" != "--force" ] && [ -f "$BINARY" ]; then
|
|
30
|
+
NEWEST_SRC=$(find "$SUPERVISOR_DIR" -name '*.go' -newer "$BINARY" 2>/dev/null | head -1)
|
|
31
|
+
if [ -z "$NEWEST_SRC" ]; then
|
|
32
|
+
echo "sensorium-supervisor is up to date ($BINARY)"
|
|
33
|
+
exit 0
|
|
34
|
+
fi
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
mkdir -p "$BIN_DIR"
|
|
38
|
+
|
|
39
|
+
echo "Building sensorium-supervisor..."
|
|
40
|
+
cd "$SUPERVISOR_DIR"
|
|
41
|
+
go build -o "$BINARY" .
|
|
42
|
+
|
|
43
|
+
echo "Installed: $BINARY"
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env pwsh
|
|
2
|
+
<#
|
|
3
|
+
.SYNOPSIS
|
|
4
|
+
Launch sensorium-supervisor. Builds automatically if needed.
|
|
5
|
+
.DESCRIPTION
|
|
6
|
+
Replaces update-watcher.ps1. Builds the Go supervisor if it doesn't exist,
|
|
7
|
+
then runs it. All environment variables (MCP_HTTP_PORT, TELEGRAM_TOKEN, etc.)
|
|
8
|
+
are passed through to the supervisor process.
|
|
9
|
+
.PARAMETER Mode
|
|
10
|
+
Watcher mode: production or development. Maps to WATCHER_MODE env var.
|
|
11
|
+
.PARAMETER Build
|
|
12
|
+
Force rebuild of the supervisor binary before starting.
|
|
13
|
+
#>
|
|
14
|
+
param(
|
|
15
|
+
[ValidateSet("production", "development")]
|
|
16
|
+
[string]$Mode = "production",
|
|
17
|
+
[switch]$Build
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
$ErrorActionPreference = "Stop"
|
|
21
|
+
|
|
22
|
+
$DataDir = Join-Path $env:USERPROFILE ".remote-copilot-mcp"
|
|
23
|
+
$BinDir = Join-Path $DataDir "bin"
|
|
24
|
+
$Binary = Join-Path $BinDir "sensorium-supervisor.exe"
|
|
25
|
+
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
26
|
+
|
|
27
|
+
# Build if missing or requested
|
|
28
|
+
if ($Build -or -not (Test-Path $Binary)) {
|
|
29
|
+
$installScript = Join-Path $ScriptDir "install-supervisor.ps1"
|
|
30
|
+
if ($Build) {
|
|
31
|
+
& $installScript -Force
|
|
32
|
+
} else {
|
|
33
|
+
& $installScript
|
|
34
|
+
}
|
|
35
|
+
if ($LASTEXITCODE -ne 0) { exit 1 }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
# Set WATCHER_MODE if not already set
|
|
39
|
+
if (-not $env:WATCHER_MODE) {
|
|
40
|
+
$env:WATCHER_MODE = $Mode
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
# Launch supervisor
|
|
44
|
+
Write-Host "Starting sensorium-supervisor ($Mode mode)..."
|
|
45
|
+
& $Binary
|
|
46
|
+
exit $LASTEXITCODE
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Launch sensorium-supervisor. Builds automatically if needed.
|
|
3
|
+
# Replaces update-watcher.ps1 on Unix systems.
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
MODE="${1:-production}"
|
|
7
|
+
DATA_DIR="$HOME/.remote-copilot-mcp"
|
|
8
|
+
BIN_DIR="$DATA_DIR/bin"
|
|
9
|
+
BINARY="$BIN_DIR/sensorium-supervisor"
|
|
10
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
11
|
+
|
|
12
|
+
# Build if missing
|
|
13
|
+
if [ ! -f "$BINARY" ]; then
|
|
14
|
+
"$SCRIPT_DIR/install-supervisor.sh"
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
export WATCHER_MODE="${WATCHER_MODE:-$MODE}"
|
|
18
|
+
|
|
19
|
+
echo "Starting sensorium-supervisor ($WATCHER_MODE mode)..."
|
|
20
|
+
exec "$BINARY"
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
package main
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"fmt"
|
|
5
|
+
"os"
|
|
6
|
+
"path/filepath"
|
|
7
|
+
"strconv"
|
|
8
|
+
"time"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
// Config holds all supervisor configuration, sourced from environment variables
|
|
12
|
+
// with sensible defaults matching the TypeScript watcher-service.ts CONFIG object.
|
|
13
|
+
type Config struct {
|
|
14
|
+
// Watcher
|
|
15
|
+
Mode string
|
|
16
|
+
PollAtHour int
|
|
17
|
+
PollInterval time.Duration
|
|
18
|
+
GracePeriod time.Duration
|
|
19
|
+
MinUptime time.Duration
|
|
20
|
+
MCPStartCommand string
|
|
21
|
+
DataDir string
|
|
22
|
+
MCPHttpPort int
|
|
23
|
+
MCPHttpSecret string
|
|
24
|
+
TelegramToken string
|
|
25
|
+
TelegramChatID string
|
|
26
|
+
HealthFailThresh int
|
|
27
|
+
|
|
28
|
+
// Keeper defaults
|
|
29
|
+
KeeperBaseBackoff time.Duration
|
|
30
|
+
KeeperMaxBackoff time.Duration
|
|
31
|
+
KeeperHealthCheckInterval time.Duration
|
|
32
|
+
KeeperMaxRetries int
|
|
33
|
+
KeeperCooldown time.Duration
|
|
34
|
+
KeeperReadyPollInterval time.Duration
|
|
35
|
+
KeeperReadyTimeout time.Duration
|
|
36
|
+
FastExitThreshold time.Duration
|
|
37
|
+
FastExitMaxCount int
|
|
38
|
+
FastExitBaseCooldown time.Duration
|
|
39
|
+
FastExitMaxCooldown time.Duration
|
|
40
|
+
StuckThreshold time.Duration
|
|
41
|
+
|
|
42
|
+
// Derived paths
|
|
43
|
+
Paths Paths
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Paths holds all filesystem paths derived from DataDir.
|
|
47
|
+
type Paths struct {
|
|
48
|
+
MaintenanceFlag string
|
|
49
|
+
VersionFile string
|
|
50
|
+
LastActivity string
|
|
51
|
+
ServerPID string
|
|
52
|
+
WatcherLock string
|
|
53
|
+
WatcherLog string
|
|
54
|
+
PIDsDir string
|
|
55
|
+
HeartbeatsDir string
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
func LoadConfig() Config {
|
|
59
|
+
dataDir := filepath.Join(homeDir(), ".remote-copilot-mcp")
|
|
60
|
+
|
|
61
|
+
mode := envOr("WATCHER_MODE", "development")
|
|
62
|
+
graceDef := "300"
|
|
63
|
+
if mode == "development" {
|
|
64
|
+
graceDef = "10"
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
c := Config{
|
|
68
|
+
Mode: mode,
|
|
69
|
+
PollAtHour: envInt("WATCHER_POLL_HOUR", 4),
|
|
70
|
+
PollInterval: time.Duration(envInt("WATCHER_POLL_INTERVAL", 60)) * time.Second,
|
|
71
|
+
GracePeriod: time.Duration(envInt("WATCHER_GRACE_PERIOD", safeAtoi(graceDef))) * time.Second,
|
|
72
|
+
MinUptime: 600 * time.Second,
|
|
73
|
+
MCPStartCommand: envOr("MCP_START_COMMAND", "npx -y sensorium-mcp@latest"),
|
|
74
|
+
DataDir: dataDir,
|
|
75
|
+
MCPHttpPort: envInt("MCP_HTTP_PORT", 0),
|
|
76
|
+
MCPHttpSecret: os.Getenv("MCP_HTTP_SECRET"),
|
|
77
|
+
TelegramToken: os.Getenv("TELEGRAM_TOKEN"),
|
|
78
|
+
TelegramChatID: os.Getenv("TELEGRAM_CHAT_ID"),
|
|
79
|
+
HealthFailThresh: 3,
|
|
80
|
+
|
|
81
|
+
KeeperBaseBackoff: 5 * time.Second,
|
|
82
|
+
KeeperMaxBackoff: 5 * time.Minute,
|
|
83
|
+
KeeperHealthCheckInterval: 2 * time.Minute,
|
|
84
|
+
KeeperMaxRetries: 5,
|
|
85
|
+
KeeperCooldown: 5 * time.Minute,
|
|
86
|
+
KeeperReadyPollInterval: 3 * time.Second,
|
|
87
|
+
KeeperReadyTimeout: 2 * time.Minute,
|
|
88
|
+
FastExitThreshold: 60 * time.Second,
|
|
89
|
+
FastExitMaxCount: 3,
|
|
90
|
+
FastExitBaseCooldown: 10 * time.Minute,
|
|
91
|
+
FastExitMaxCooldown: 4 * time.Hour,
|
|
92
|
+
StuckThreshold: 10 * time.Minute,
|
|
93
|
+
|
|
94
|
+
Paths: Paths{
|
|
95
|
+
MaintenanceFlag: filepath.Join(dataDir, "maintenance.flag"),
|
|
96
|
+
VersionFile: filepath.Join(dataDir, "current-version.txt"),
|
|
97
|
+
LastActivity: filepath.Join(dataDir, "last-activity.txt"),
|
|
98
|
+
ServerPID: filepath.Join(dataDir, "server.pid"),
|
|
99
|
+
WatcherLock: filepath.Join(dataDir, "watcher.lock"),
|
|
100
|
+
WatcherLog: filepath.Join(dataDir, "watcher.log"),
|
|
101
|
+
PIDsDir: filepath.Join(dataDir, "pids"),
|
|
102
|
+
HeartbeatsDir: filepath.Join(dataDir, "heartbeats"),
|
|
103
|
+
},
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return c
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
func homeDir() string {
|
|
110
|
+
h, err := os.UserHomeDir()
|
|
111
|
+
if err != nil {
|
|
112
|
+
fmt.Fprintf(os.Stderr, "FATAL: cannot determine home directory: %v\n", err)
|
|
113
|
+
os.Exit(1)
|
|
114
|
+
}
|
|
115
|
+
return h
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
func envOr(key, fallback string) string {
|
|
119
|
+
if v := os.Getenv(key); v != "" {
|
|
120
|
+
return v
|
|
121
|
+
}
|
|
122
|
+
return fallback
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
func envInt(key string, fallback int) int {
|
|
126
|
+
s := os.Getenv(key)
|
|
127
|
+
if s == "" {
|
|
128
|
+
return fallback
|
|
129
|
+
}
|
|
130
|
+
v, err := strconv.Atoi(s)
|
|
131
|
+
if err != nil {
|
|
132
|
+
return fallback
|
|
133
|
+
}
|
|
134
|
+
return v
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
func safeAtoi(s string) int {
|
|
138
|
+
v, _ := strconv.Atoi(s)
|
|
139
|
+
return v
|
|
140
|
+
}
|