cli installation
This commit is contained in:
parent
27d00f3d14
commit
e0cfec1666
15 changed files with 970 additions and 848 deletions
155
docker/README.md
155
docker/README.md
|
|
@ -1,155 +0,0 @@
|
|||
# Hindsight Docker
|
||||
|
||||
Run Hindsight with Docker in standalone or distributed mode.
|
||||
|
||||
## Quick Start (Standalone)
|
||||
|
||||
```bash
|
||||
cd docker
|
||||
./start.sh
|
||||
```
|
||||
|
||||
**Force rebuild after code changes:**
|
||||
```bash
|
||||
./start.sh --build # Quick: rebuild and start
|
||||
# or
|
||||
./rebuild.sh # Complete: rebuild from scratch (no cache)
|
||||
```
|
||||
|
||||
Access:
|
||||
- **Control Plane**: http://localhost:3000
|
||||
- **API**: http://localhost:8888
|
||||
|
||||
Press `Ctrl+C` to stop.
|
||||
|
||||
## What You Get
|
||||
|
||||
**Standalone** (default, simple):
|
||||
- One container with API + Control Plane + embedded database
|
||||
- Perfect for local development and simple deployments
|
||||
|
||||
**Distributed** (advanced):
|
||||
- Separate containers for API and Control Plane
|
||||
- Better for production, scaling, or custom configurations
|
||||
|
||||
## Deployment Modes
|
||||
|
||||
### 1. Standalone (Recommended)
|
||||
|
||||
All-in-one container with embedded pg0 database.
|
||||
|
||||
```bash
|
||||
./start.sh
|
||||
# or
|
||||
cd standalone
|
||||
docker-compose up
|
||||
```
|
||||
|
||||
**Data storage:** `/app/data` volume
|
||||
|
||||
### 2. Distributed (Advanced)
|
||||
|
||||
Separate API and Control Plane containers.
|
||||
|
||||
```bash
|
||||
cd services
|
||||
docker-compose up
|
||||
```
|
||||
|
||||
**Data storage:** `api_data` volume
|
||||
|
||||
See `services/README.md` for details.
|
||||
|
||||
## Data Management
|
||||
|
||||
**Reset data:**
|
||||
```bash
|
||||
# Standalone
|
||||
cd standalone && docker-compose down -v
|
||||
|
||||
# Distributed
|
||||
cd services && docker-compose down -v
|
||||
```
|
||||
|
||||
## Building Images
|
||||
|
||||
```bash
|
||||
# Standalone
|
||||
cd standalone
|
||||
docker build -f Dockerfile -t hindsight:latest ../..
|
||||
|
||||
# Services
|
||||
cd services
|
||||
./build-all.sh
|
||||
```
|
||||
|
||||
## Using External Database
|
||||
|
||||
Both modes use embedded pg0 by default. To use external PostgreSQL:
|
||||
|
||||
```bash
|
||||
export HINDSIGHT_API_DATABASE_URL=postgresql://user:pass@host:5432/db
|
||||
```
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
docker/
|
||||
├── start.sh # Quick start (standalone)
|
||||
├── README.md # This file
|
||||
├── standalone/ # All-in-one deployment
|
||||
│ ├── Dockerfile
|
||||
│ ├── docker-compose.yml
|
||||
│ └── start-all.sh
|
||||
└── services/ # Distributed deployment
|
||||
├── docker-compose.yml
|
||||
├── api.Dockerfile
|
||||
├── control-plane.Dockerfile
|
||||
├── build-all.sh
|
||||
└── README.md
|
||||
```
|
||||
|
||||
## Advanced Usage
|
||||
|
||||
**Background mode:**
|
||||
```bash
|
||||
cd standalone
|
||||
docker-compose up -d
|
||||
docker-compose logs -f
|
||||
docker-compose down
|
||||
```
|
||||
|
||||
**Custom configuration:**
|
||||
Edit `standalone/docker-compose.yml` or `services/docker-compose.yml`
|
||||
|
||||
## Environment Variables
|
||||
|
||||
Hindsight requires configuration through environment variables (all prefixed with `HINDSIGHT_`).
|
||||
|
||||
### Required:
|
||||
- `HINDSIGHT_API_LLM_API_KEY` - Your LLM API key (OpenAI, Anthropic, etc.)
|
||||
|
||||
### Optional:
|
||||
- `HINDSIGHT_API_LLM_MODEL` - Model name (default: gpt-4o-mini)
|
||||
- `HINDSIGHT_API_LLM_BASE_URL` - API base URL (default: https://api.openai.com/v1)
|
||||
- `HINDSIGHT_API_LOG_LEVEL` - Logging level: debug, info, warning, error
|
||||
- `HINDSIGHT_API_DATABASE_URL` - External PostgreSQL connection (uses embedded pg0 by default)
|
||||
|
||||
### Setup Options:
|
||||
|
||||
**Option 1: .env file (recommended)**
|
||||
```bash
|
||||
# Copy example file
|
||||
cp .env.example .env
|
||||
|
||||
# Edit .env and add your API key
|
||||
HINDSIGHT_API_LLM_API_KEY=sk-...
|
||||
```
|
||||
|
||||
**Option 2: Export in shell**
|
||||
```bash
|
||||
export HINDSIGHT_API_LLM_API_KEY=sk-...
|
||||
export HINDSIGHT_API_LLM_MODEL=gpt-4o-mini
|
||||
```
|
||||
|
||||
The `start.sh` script automatically loads `.env` if it exists and validates the API key is set.
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
services:
|
||||
hindsight:
|
||||
image: hindsight
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: docker/standalone/Dockerfile
|
||||
env_file:
|
||||
- ../../.env
|
||||
ports:
|
||||
- "9999:9999"
|
||||
- "8888:8888"
|
||||
environment:
|
||||
# These override env_file values only when set in host shell
|
||||
# Default values are applied only when not set in env_file or host
|
||||
HINDSIGHT_API_HOST: ${HINDSIGHT_API_HOST:-0.0.0.0}
|
||||
HINDSIGHT_API_PORT: ${HINDSIGHT_API_PORT:-8888}
|
||||
HINDSIGHT_API_LOG_LEVEL: ${HINDSIGHT_API_LOG_LEVEL:-info}
|
||||
# HINDSIGHT_API_DATABASE_URL can be set if you want to use an external database
|
||||
# If not set, embedded pg0 will be used automatically
|
||||
volumes:
|
||||
- hindsight_data:/home/hindsight/.pg0
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
hindsight_data:
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Start Hindsight (standalone all-in-one)
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
# Check for --build flag
|
||||
BUILD_FLAG=""
|
||||
if [[ "$1" == "--build" ]] || [[ "$1" == "-b" ]]; then
|
||||
BUILD_FLAG="--build"
|
||||
echo "🔨 Forcing rebuild of images..."
|
||||
echo ""
|
||||
fi
|
||||
|
||||
echo "🚀 Starting Hindsight..."
|
||||
echo ""
|
||||
|
||||
# Load .env file from project root if it exists
|
||||
if [ -f ../.env ]; then
|
||||
echo "📝 Loading environment variables from .env file..."
|
||||
export $(grep -v '^#' ../.env | grep -v '^$' | xargs)
|
||||
fi
|
||||
|
||||
# Check for required HINDSIGHT_API_LLM_API_KEY
|
||||
if [ -z "$HINDSIGHT_API_LLM_API_KEY" ]; then
|
||||
echo "⚠️ Warning: HINDSIGHT_API_LLM_API_KEY is not set"
|
||||
echo ""
|
||||
echo "Set it by either:"
|
||||
echo " 1. Creating a .env file in the project root with: HINDSIGHT_API_LLM_API_KEY=your-key"
|
||||
echo " 2. Exporting: export HINDSIGHT_API_LLM_API_KEY=your-key"
|
||||
echo ""
|
||||
read -p "Continue anyway? (y/N) " -n 1 -r
|
||||
echo
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
cd standalone
|
||||
|
||||
# Run docker-compose with optional --build flag
|
||||
docker-compose up $BUILD_FLAG
|
||||
|
|
@ -67,8 +67,8 @@ def create_app(
|
|||
# Create MCP server with shared memory instance
|
||||
mcp_server = create_mcp_server(memory=memory)
|
||||
|
||||
# Mount at specified path using http_app (modern non-SSE alternative)
|
||||
app.mount(mcp_mount_path, mcp_server.http_app())
|
||||
# Mount at specified path using sse_app for compatibility with mcp-remote
|
||||
app.mount(mcp_mount_path, mcp_server.sse_app())
|
||||
logger.info(f"MCP server enabled at {mcp_mount_path}")
|
||||
except ImportError as e:
|
||||
logger.error(f"MCP server requested but dependencies not available: {e}")
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ set -e
|
|||
# Hindsight CLI installer
|
||||
# Usage: curl -sSf https://your-domain.com/install.sh | sh
|
||||
|
||||
REPO_URL="https://github.com/your-org/hindsight-cli"
|
||||
REPO_URL="https://github.com/vectorize-io/hindsight"
|
||||
INSTALL_DIR="${HINDSIGHT_INSTALL_DIR:-$HOME/.local/bin}"
|
||||
BINARY_NAME="hindsight"
|
||||
|
||||
|
|
@ -47,9 +47,9 @@ detect_platform() {
|
|||
case "$os" in
|
||||
Darwin)
|
||||
if [[ "$arch" == "arm64" ]] || [[ "$arch" == "aarch64" ]]; then
|
||||
echo "macos-arm64"
|
||||
echo "darwin-arm64"
|
||||
elif [[ "$arch" == "x86_64" ]]; then
|
||||
echo "macos-x86_64"
|
||||
echo "darwin-amd64"
|
||||
else
|
||||
print_error "Unsupported macOS architecture: $arch"
|
||||
exit 1
|
||||
|
|
@ -57,7 +57,7 @@ detect_platform() {
|
|||
;;
|
||||
Linux)
|
||||
if [[ "$arch" == "x86_64" ]]; then
|
||||
echo "linux-x86_64"
|
||||
echo "linux-amd64"
|
||||
elif [[ "$arch" == "aarch64" ]] || [[ "$arch" == "arm64" ]]; then
|
||||
echo "linux-arm64"
|
||||
else
|
||||
|
|
@ -78,14 +78,14 @@ download_binary() {
|
|||
local download_url="${REPO_URL}/releases/latest/download/hindsight-${platform}"
|
||||
local tmp_file="/tmp/hindsight-$$"
|
||||
|
||||
print_info "Downloading Hindsight CLI for $platform..."
|
||||
print_info "Downloading Hindsight CLI for $platform..." >&2
|
||||
|
||||
if command -v curl > /dev/null 2>&1; then
|
||||
curl -fsSL "$download_url" -o "$tmp_file"
|
||||
elif command -v wget > /dev/null 2>&1; then
|
||||
wget -q "$download_url" -O "$tmp_file"
|
||||
else
|
||||
print_error "Neither curl nor wget found. Please install one of them."
|
||||
print_error "Neither curl nor wget found. Please install one of them." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
|||
502
hindsight-control-plane/package-lock.json
generated
502
hindsight-control-plane/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "hindsight-control-plane",
|
||||
"version": "0.0.12",
|
||||
"version": "0.0.16",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "hindsight-control-plane",
|
||||
"version": "0.0.12",
|
||||
"version": "0.0.16",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-checkbox": "^1.3.3",
|
||||
|
|
@ -36,6 +36,7 @@
|
|||
"react-cytoscape": "^1.0.6",
|
||||
"react-dom": "^19.2.0",
|
||||
"react18-json-view": "^0.2.9",
|
||||
"recharts": "^3.5.1",
|
||||
"tailwind-merge": "^3.4.0",
|
||||
"tailwindcss": "^4.1.17",
|
||||
"tailwindcss-animate": "^1.0.7",
|
||||
|
|
@ -44,7 +45,7 @@
|
|||
},
|
||||
"../hindsight-clients/typescript": {
|
||||
"name": "@vectorize-io/hindsight-client",
|
||||
"version": "0.0.12",
|
||||
"version": "0.0.16",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@hey-api/openapi-ts": "^0.88.0",
|
||||
|
|
@ -4309,6 +4310,111 @@
|
|||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@next/swc-darwin-x64": {
|
||||
"version": "16.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.0.1.tgz",
|
||||
"integrity": "sha512-kETZBocRux3xITiZtOtVoVvXyQLB7VBxN7L6EPqgI5paZiUlnsgYv4q8diTNYeHmF9EiehydOBo20lTttCbHAg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@next/swc-linux-arm64-gnu": {
|
||||
"version": "16.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.0.1.tgz",
|
||||
"integrity": "sha512-hWg3BtsxQuSKhfe0LunJoqxjO4NEpBmKkE+P2Sroos7yB//OOX3jD5ISP2wv8QdUwtRehMdwYz6VB50mY6hqAg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@next/swc-linux-arm64-musl": {
|
||||
"version": "16.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.0.1.tgz",
|
||||
"integrity": "sha512-UPnOvYg+fjAhP3b1iQStcYPWeBFRLrugEyK/lDKGk7kLNua8t5/DvDbAEFotfV1YfcOY6bru76qN9qnjLoyHCQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@next/swc-linux-x64-gnu": {
|
||||
"version": "16.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.0.1.tgz",
|
||||
"integrity": "sha512-Et81SdWkcRqAJziIgFtsFyJizHoWne4fzJkvjd6V4wEkWTB4MX6J0uByUb0peiJQ4WeAt6GGmMszE5KrXK6WKg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@next/swc-linux-x64-musl": {
|
||||
"version": "16.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.0.1.tgz",
|
||||
"integrity": "sha512-qBbgYEBRrC1egcG03FZaVfVxrJm8wBl7vr8UFKplnxNRprctdP26xEv9nJ07Ggq4y1adwa0nz2mz83CELY7N6Q==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@next/swc-win32-arm64-msvc": {
|
||||
"version": "16.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.0.1.tgz",
|
||||
"integrity": "sha512-cPuBjYP6I699/RdbHJonb3BiRNEDm5CKEBuJ6SD8k3oLam2fDRMKAvmrli4QMDgT2ixyRJ0+DTkiODbIQhRkeQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@next/swc-win32-x64-msvc": {
|
||||
"version": "16.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.0.1.tgz",
|
||||
"integrity": "sha512-XeEUJsE4JYtfrXe/LaJn3z1pD19fK0Q6Er8Qoufi+HqvdO4LEPyCxLUt4rxA+4RfYo6S9gMlmzCMU2F+AatFqQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@nodelib/fs.scandir": {
|
||||
"version": "2.1.5",
|
||||
"license": "MIT",
|
||||
|
|
@ -5089,10 +5195,58 @@
|
|||
"version": "1.1.1",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@reduxjs/toolkit": {
|
||||
"version": "2.11.0",
|
||||
"resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.11.0.tgz",
|
||||
"integrity": "sha512-hBjYg0aaRL1O2Z0IqWhnTLytnjDIxekmRxm1snsHjHaKVmIF1HiImWqsq+PuEbn6zdMlkIj9WofK1vR8jjx+Xw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@standard-schema/spec": "^1.0.0",
|
||||
"@standard-schema/utils": "^0.3.0",
|
||||
"immer": "^11.0.0",
|
||||
"redux": "^5.0.1",
|
||||
"redux-thunk": "^3.1.0",
|
||||
"reselect": "^5.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.9.0 || ^17.0.0 || ^18 || ^19",
|
||||
"react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"react": {
|
||||
"optional": true
|
||||
},
|
||||
"react-redux": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@reduxjs/toolkit/node_modules/immer": {
|
||||
"version": "11.0.1",
|
||||
"resolved": "https://registry.npmjs.org/immer/-/immer-11.0.1.tgz",
|
||||
"integrity": "sha512-naDCyggtcBWANtIrjQEajhhBEuL9b0Zg4zmlWK2CzS6xCWSE39/vvf4LqnMjUAWHBhot4m9MHCM/Z+mfWhUkiA==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/immer"
|
||||
}
|
||||
},
|
||||
"node_modules/@rtsao/scc": {
|
||||
"version": "1.1.0",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@standard-schema/spec": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.0.0.tgz",
|
||||
"integrity": "sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@standard-schema/utils": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@standard-schema/utils/-/utils-0.3.0.tgz",
|
||||
"integrity": "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@swc/helpers": {
|
||||
"version": "0.5.15",
|
||||
"license": "Apache-2.0",
|
||||
|
|
@ -5159,6 +5313,69 @@
|
|||
"tailwindcss": "4.1.17"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/d3-array": {
|
||||
"version": "3.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-3.2.2.tgz",
|
||||
"integrity": "sha512-hOLWVbm7uRza0BYXpIIW5pxfrKe0W+D5lrFiAEYR+pb6w3N2SwSMaJbXdUfSEv+dT4MfHBLtn5js0LAWaO6otw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/d3-color": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.3.tgz",
|
||||
"integrity": "sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/d3-ease": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-3.0.2.tgz",
|
||||
"integrity": "sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/d3-interpolate": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-3.0.4.tgz",
|
||||
"integrity": "sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/d3-color": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/d3-path": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.1.1.tgz",
|
||||
"integrity": "sha512-VMZBYyQvbGmWyWVea0EHs/BwLgxc+MKi1zLDCONksozI4YJMcTt8ZEuIR4Sb1MMTE8MMW49v0IwI5+b7RmfWlg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/d3-scale": {
|
||||
"version": "4.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.9.tgz",
|
||||
"integrity": "sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/d3-time": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/d3-shape": {
|
||||
"version": "3.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.1.7.tgz",
|
||||
"integrity": "sha512-VLvUQ33C+3J+8p+Daf+nYSOsjB4GXp19/S/aGo60m9h1v6XaxjiT82lKVWJCfzhtuZ3yD7i/TPeC/fuKLLOSmg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/d3-path": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/d3-time": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.4.tgz",
|
||||
"integrity": "sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/d3-timer": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-3.0.2.tgz",
|
||||
"integrity": "sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/estree": {
|
||||
"version": "1.0.8",
|
||||
"license": "MIT"
|
||||
|
|
@ -5196,6 +5413,12 @@
|
|||
"version": "4.2.5",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/use-sync-external-store": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.6.tgz",
|
||||
"integrity": "sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||
"version": "8.46.3",
|
||||
"license": "MIT",
|
||||
|
|
@ -6010,6 +6233,27 @@
|
|||
"cytoscape": "^3.2.22"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-array": {
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz",
|
||||
"integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"internmap": "1 - 2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-color": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz",
|
||||
"integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-dispatch": {
|
||||
"version": "1.0.6",
|
||||
"license": "BSD-3-Clause"
|
||||
|
|
@ -6022,10 +6266,56 @@
|
|||
"d3-selection": "1"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-ease": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz",
|
||||
"integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==",
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-format": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.0.tgz",
|
||||
"integrity": "sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-interpolate": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz",
|
||||
"integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-color": "1 - 3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-path": {
|
||||
"version": "1.0.9",
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/d3-scale": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz",
|
||||
"integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-array": "2.10.0 - 3",
|
||||
"d3-format": "1 - 3",
|
||||
"d3-interpolate": "1.2.0 - 3",
|
||||
"d3-time": "2.1.1 - 3",
|
||||
"d3-time-format": "2 - 4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-selection": {
|
||||
"version": "1.4.2",
|
||||
"license": "BSD-3-Clause"
|
||||
|
|
@ -6037,6 +6327,30 @@
|
|||
"d3-path": "1"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-time": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz",
|
||||
"integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-array": "2 - 3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-time-format": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz",
|
||||
"integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-time": "1 - 3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-timer": {
|
||||
"version": "1.0.10",
|
||||
"license": "BSD-3-Clause"
|
||||
|
|
@ -6117,6 +6431,12 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/decimal.js-light": {
|
||||
"version": "2.5.1",
|
||||
"resolved": "https://registry.npmjs.org/decimal.js-light/-/decimal.js-light-2.5.1.tgz",
|
||||
"integrity": "sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/deep-is": {
|
||||
"version": "0.1.4",
|
||||
"license": "MIT"
|
||||
|
|
@ -6356,6 +6676,16 @@
|
|||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/es-toolkit": {
|
||||
"version": "1.42.0",
|
||||
"resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.42.0.tgz",
|
||||
"integrity": "sha512-SLHIyY7VfDJBM8clz4+T2oquwTQxEzu263AyhVK4jREOAwJ+8eebaa4wM3nlvnAqhDrMm2EsA6hWHaQsMPQ1nA==",
|
||||
"license": "MIT",
|
||||
"workspaces": [
|
||||
"docs",
|
||||
"benchmarks"
|
||||
]
|
||||
},
|
||||
"node_modules/escalade": {
|
||||
"version": "3.2.0",
|
||||
"license": "MIT",
|
||||
|
|
@ -6748,6 +7078,12 @@
|
|||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/eventemitter3": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz",
|
||||
"integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"license": "MIT"
|
||||
|
|
@ -7140,6 +7476,16 @@
|
|||
"node": ">= 4"
|
||||
}
|
||||
},
|
||||
"node_modules/immer": {
|
||||
"version": "10.2.0",
|
||||
"resolved": "https://registry.npmjs.org/immer/-/immer-10.2.0.tgz",
|
||||
"integrity": "sha512-d/+XTN3zfODyjr89gM3mPq1WNX2B8pYsu7eORitdwyA2sBubnTl3laYlBk4sXY5FUa5qTZGBDPJICVbvqzjlbw==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/immer"
|
||||
}
|
||||
},
|
||||
"node_modules/import-fresh": {
|
||||
"version": "3.3.1",
|
||||
"license": "MIT",
|
||||
|
|
@ -7173,6 +7519,15 @@
|
|||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/internmap": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz",
|
||||
"integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/is-array-buffer": {
|
||||
"version": "3.0.5",
|
||||
"license": "MIT",
|
||||
|
|
@ -8206,6 +8561,29 @@
|
|||
"version": "16.13.1",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/react-redux": {
|
||||
"version": "9.2.0",
|
||||
"resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.2.0.tgz",
|
||||
"integrity": "sha512-ROY9fvHhwOD9ySfrF0wmvu//bKCQ6AeZZq1nJNtbDC+kk5DuSuNX/n6YWYF/SYy7bSba4D4FSz8DJeKY/S/r+g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/use-sync-external-store": "^0.0.6",
|
||||
"use-sync-external-store": "^1.4.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "^18.2.25 || ^19",
|
||||
"react": "^18.0 || ^19",
|
||||
"redux": "^5.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
},
|
||||
"redux": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/react-remove-scroll": {
|
||||
"version": "2.7.2",
|
||||
"license": "MIT",
|
||||
|
|
@ -8279,6 +8657,51 @@
|
|||
"react": ">=16.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/recharts": {
|
||||
"version": "3.5.1",
|
||||
"resolved": "https://registry.npmjs.org/recharts/-/recharts-3.5.1.tgz",
|
||||
"integrity": "sha512-+v+HJojK7gnEgG6h+b2u7k8HH7FhyFUzAc4+cPrsjL4Otdgqr/ecXzAnHciqlzV1ko064eNcsdzrYOM78kankA==",
|
||||
"license": "MIT",
|
||||
"workspaces": [
|
||||
"www"
|
||||
],
|
||||
"dependencies": {
|
||||
"@reduxjs/toolkit": "1.x.x || 2.x.x",
|
||||
"clsx": "^2.1.1",
|
||||
"decimal.js-light": "^2.5.1",
|
||||
"es-toolkit": "^1.39.3",
|
||||
"eventemitter3": "^5.0.1",
|
||||
"immer": "^10.1.1",
|
||||
"react-redux": "8.x.x || 9.x.x",
|
||||
"reselect": "5.1.1",
|
||||
"tiny-invariant": "^1.3.3",
|
||||
"use-sync-external-store": "^1.2.2",
|
||||
"victory-vendor": "^37.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
||||
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
||||
"react-is": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/redux": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz",
|
||||
"integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/redux-thunk": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz",
|
||||
"integrity": "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"redux": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/reflect.getprototypeof": {
|
||||
"version": "1.0.10",
|
||||
"license": "MIT",
|
||||
|
|
@ -8317,6 +8740,12 @@
|
|||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/reselect": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/reselect/-/reselect-5.1.1.tgz",
|
||||
"integrity": "sha512-K/BG6eIky/SBpzfHZv/dd+9JBFiS4SWV7FIujVyJRux6e45+73RaUHXLmIR1f7WOMaQ0U1km6qwklRQxpJJY0w==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/resolve": {
|
||||
"version": "1.22.11",
|
||||
"license": "MIT",
|
||||
|
|
@ -8871,6 +9300,12 @@
|
|||
"url": "https://opencollective.com/webpack"
|
||||
}
|
||||
},
|
||||
"node_modules/tiny-invariant": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz",
|
||||
"integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/tinyglobby": {
|
||||
"version": "0.2.15",
|
||||
"license": "MIT",
|
||||
|
|
@ -9202,6 +9637,67 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/use-sync-external-store": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.6.0.tgz",
|
||||
"integrity": "sha512-Pp6GSwGP/NrPIrxVFAIkOQeyw8lFenOHijQWkUTrDvrF4ALqylP2C/KCkeS9dpUM3KvYRQhna5vt7IL95+ZQ9w==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/victory-vendor": {
|
||||
"version": "37.3.6",
|
||||
"resolved": "https://registry.npmjs.org/victory-vendor/-/victory-vendor-37.3.6.tgz",
|
||||
"integrity": "sha512-SbPDPdDBYp+5MJHhBCAyI7wKM3d5ivekigc2Dk2s7pgbZ9wIgIBYGVw4zGHBml/qTFbexrofXW6Gu4noGxrOwQ==",
|
||||
"license": "MIT AND ISC",
|
||||
"dependencies": {
|
||||
"@types/d3-array": "^3.0.3",
|
||||
"@types/d3-ease": "^3.0.0",
|
||||
"@types/d3-interpolate": "^3.0.1",
|
||||
"@types/d3-scale": "^4.0.2",
|
||||
"@types/d3-shape": "^3.1.0",
|
||||
"@types/d3-time": "^3.0.0",
|
||||
"@types/d3-timer": "^3.0.0",
|
||||
"d3-array": "^3.1.6",
|
||||
"d3-ease": "^3.0.1",
|
||||
"d3-interpolate": "^3.0.1",
|
||||
"d3-scale": "^4.0.2",
|
||||
"d3-shape": "^3.1.0",
|
||||
"d3-time": "^3.0.0",
|
||||
"d3-timer": "^3.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/victory-vendor/node_modules/d3-path": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz",
|
||||
"integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/victory-vendor/node_modules/d3-shape": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz",
|
||||
"integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-path": "^3.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/victory-vendor/node_modules/d3-timer": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz",
|
||||
"integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/webcola": {
|
||||
"version": "3.4.0",
|
||||
"license": "MIT",
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@
|
|||
"license": "ISC",
|
||||
"description": "Control plane for Hindsight - Semantic memory system",
|
||||
"dependencies": {
|
||||
"@vectorize-io/hindsight-client": "file:../hindsight-clients/typescript",
|
||||
"@radix-ui/react-checkbox": "^1.3.3",
|
||||
"@radix-ui/react-dialog": "^1.1.15",
|
||||
"@radix-ui/react-label": "^2.1.8",
|
||||
|
|
@ -25,6 +24,7 @@
|
|||
"@types/node": "^24.10.0",
|
||||
"@types/react": "^19.2.2",
|
||||
"@types/react-dom": "^19.2.2",
|
||||
"@vectorize-io/hindsight-client": "file:../hindsight-clients/typescript",
|
||||
"autoprefixer": "^10.4.21",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
|
|
@ -40,6 +40,7 @@
|
|||
"react-cytoscape": "^1.0.6",
|
||||
"react-dom": "^19.2.0",
|
||||
"react18-json-view": "^0.2.9",
|
||||
"recharts": "^3.5.1",
|
||||
"tailwind-merge": "^3.4.0",
|
||||
"tailwindcss": "^4.1.17",
|
||||
"tailwindcss-animate": "^1.0.7",
|
||||
|
|
|
|||
|
|
@ -9,11 +9,10 @@ import { DocumentsView } from '@/components/documents-view';
|
|||
import { EntitiesView } from '@/components/entities-view';
|
||||
import { ThinkView } from '@/components/think-view';
|
||||
import { SearchDebugView } from '@/components/search-debug-view';
|
||||
import { StatsView } from '@/components/stats-view';
|
||||
import { BankProfileView } from '@/components/bank-profile-view';
|
||||
import { useBank } from '@/lib/bank-context';
|
||||
|
||||
type NavItem = 'recall' | 'reflect' | 'data' | 'documents' | 'entities' | 'profile' | 'stats';
|
||||
type NavItem = 'recall' | 'reflect' | 'data' | 'documents' | 'entities' | 'profile';
|
||||
type DataSubTab = 'world' | 'bank' | 'opinion';
|
||||
|
||||
export default function BankPage() {
|
||||
|
|
@ -23,7 +22,7 @@ export default function BankPage() {
|
|||
const { currentBank, setCurrentBank } = useBank();
|
||||
|
||||
const bankId = params.bankId as string;
|
||||
const view = (searchParams.get('view') || 'data') as NavItem;
|
||||
const view = (searchParams.get('view') || 'profile') as NavItem;
|
||||
const subTab = (searchParams.get('subTab') || 'world') as DataSubTab;
|
||||
|
||||
// Sync URL bank with context
|
||||
|
|
@ -164,17 +163,6 @@ export default function BankPage() {
|
|||
<EntitiesView />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Stats Tab (Stats & Operations) */}
|
||||
{view === 'stats' && (
|
||||
<div>
|
||||
<h1 className="text-3xl font-bold mb-2 text-foreground">Statistics & Operations</h1>
|
||||
<p className="text-muted-foreground mb-6">
|
||||
View detailed statistics and async operations for this memory bank.
|
||||
</p>
|
||||
<StatsView />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,9 @@ import { Button } from '@/components/ui/button';
|
|||
import { Input } from '@/components/ui/input';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { RefreshCw, Save, User, Brain, FileText, Clock } from 'lucide-react';
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
|
||||
import { RefreshCw, Save, User, Brain, FileText, Clock, AlertCircle, CheckCircle, Database, Link2, FolderOpen, Activity } from 'lucide-react';
|
||||
import { RadarChart, PolarGrid, PolarAngleAxis, PolarRadiusAxis, Radar, ResponsiveContainer, Tooltip } from 'recharts';
|
||||
|
||||
interface PersonalityTraits {
|
||||
openness: number;
|
||||
|
|
@ -44,81 +46,155 @@ interface BankStats {
|
|||
failed_operations: number;
|
||||
}
|
||||
|
||||
const TRAIT_LABELS: Record<keyof PersonalityTraits, { label: string; description: string; lowLabel: string; highLabel: string }> = {
|
||||
interface Operation {
|
||||
id: string;
|
||||
task_type: string;
|
||||
items_count: number;
|
||||
document_id?: string;
|
||||
created_at: string;
|
||||
status: string;
|
||||
error_message?: string;
|
||||
}
|
||||
|
||||
const TRAIT_LABELS: Record<keyof PersonalityTraits, { label: string; shortLabel: string; description: string; lowLabel: string; highLabel: string }> = {
|
||||
openness: {
|
||||
label: 'Openness',
|
||||
shortLabel: 'O',
|
||||
description: 'Openness to experience - curiosity, creativity, and willingness to try new things',
|
||||
lowLabel: 'Practical',
|
||||
highLabel: 'Creative'
|
||||
},
|
||||
conscientiousness: {
|
||||
label: 'Conscientiousness',
|
||||
shortLabel: 'C',
|
||||
description: 'Organization, dependability, and self-discipline',
|
||||
lowLabel: 'Flexible',
|
||||
highLabel: 'Organized'
|
||||
},
|
||||
extraversion: {
|
||||
label: 'Extraversion',
|
||||
shortLabel: 'E',
|
||||
description: 'Sociability, assertiveness, and positive emotions',
|
||||
lowLabel: 'Reserved',
|
||||
highLabel: 'Outgoing'
|
||||
},
|
||||
agreeableness: {
|
||||
label: 'Agreeableness',
|
||||
shortLabel: 'A',
|
||||
description: 'Cooperation, trust, and altruism',
|
||||
lowLabel: 'Skeptical',
|
||||
highLabel: 'Trusting'
|
||||
},
|
||||
neuroticism: {
|
||||
label: 'Neuroticism',
|
||||
shortLabel: 'N',
|
||||
description: 'Emotional instability and tendency toward negative emotions',
|
||||
lowLabel: 'Calm',
|
||||
highLabel: 'Sensitive'
|
||||
},
|
||||
bias_strength: {
|
||||
label: 'Personality Influence',
|
||||
label: 'Influence',
|
||||
shortLabel: 'I',
|
||||
description: 'How strongly personality traits influence opinions and responses',
|
||||
lowLabel: 'Neutral',
|
||||
highLabel: 'Strong'
|
||||
}
|
||||
};
|
||||
|
||||
function PersonalitySlider({
|
||||
trait,
|
||||
value,
|
||||
onChange,
|
||||
disabled
|
||||
}: {
|
||||
trait: keyof PersonalityTraits;
|
||||
value: number;
|
||||
onChange: (value: number) => void;
|
||||
disabled?: boolean;
|
||||
function PersonalityRadarChart({ personality, editMode, editPersonality, onEditChange }: {
|
||||
personality: PersonalityTraits;
|
||||
editMode: boolean;
|
||||
editPersonality: PersonalityTraits;
|
||||
onEditChange: (trait: keyof PersonalityTraits, value: number) => void;
|
||||
}) {
|
||||
const info = TRAIT_LABELS[trait];
|
||||
const percentage = Math.round(value * 100);
|
||||
const data = editMode ? editPersonality : personality;
|
||||
|
||||
const chartData = [
|
||||
{ trait: 'Openness', value: Math.round(data.openness * 100), fullMark: 100 },
|
||||
{ trait: 'Conscientiousness', value: Math.round(data.conscientiousness * 100), fullMark: 100 },
|
||||
{ trait: 'Extraversion', value: Math.round(data.extraversion * 100), fullMark: 100 },
|
||||
{ trait: 'Agreeableness', value: Math.round(data.agreeableness * 100), fullMark: 100 },
|
||||
{ trait: 'Neuroticism', value: Math.round(data.neuroticism * 100), fullMark: 100 },
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<div className="flex justify-between items-center">
|
||||
<label className="text-sm font-medium text-foreground">{info.label}</label>
|
||||
<span className="text-sm text-muted-foreground">{percentage}%</span>
|
||||
<div className="space-y-4">
|
||||
<div className="h-[280px] w-full">
|
||||
<ResponsiveContainer width="100%" height="100%">
|
||||
<RadarChart cx="50%" cy="50%" outerRadius="70%" data={chartData}>
|
||||
<PolarGrid stroke="hsl(var(--border))" />
|
||||
<PolarAngleAxis
|
||||
dataKey="trait"
|
||||
tick={{ fill: 'hsl(var(--muted-foreground))', fontSize: 11 }}
|
||||
/>
|
||||
<PolarRadiusAxis
|
||||
angle={90}
|
||||
domain={[0, 100]}
|
||||
tick={{ fill: 'hsl(var(--muted-foreground))', fontSize: 10 }}
|
||||
tickCount={5}
|
||||
/>
|
||||
<Radar
|
||||
name="Personality"
|
||||
dataKey="value"
|
||||
stroke="hsl(var(--primary))"
|
||||
fill="hsl(var(--primary))"
|
||||
fillOpacity={0.3}
|
||||
strokeWidth={2}
|
||||
/>
|
||||
<Tooltip
|
||||
contentStyle={{
|
||||
backgroundColor: 'hsl(var(--card))',
|
||||
border: '1px solid hsl(var(--border))',
|
||||
borderRadius: '8px',
|
||||
color: 'hsl(var(--foreground))'
|
||||
}}
|
||||
formatter={(value: number) => [`${value}%`, 'Score']}
|
||||
/>
|
||||
</RadarChart>
|
||||
</ResponsiveContainer>
|
||||
</div>
|
||||
<div className="relative">
|
||||
<input
|
||||
type="range"
|
||||
min="0"
|
||||
max="100"
|
||||
value={percentage}
|
||||
onChange={(e) => onChange(parseInt(e.target.value) / 100)}
|
||||
disabled={disabled}
|
||||
className="w-full h-2 bg-muted rounded-lg appearance-none cursor-pointer accent-primary disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
/>
|
||||
<div className="flex justify-between text-xs text-muted-foreground mt-1">
|
||||
<span>{info.lowLabel}</span>
|
||||
<span>{info.highLabel}</span>
|
||||
|
||||
{editMode && (
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
{(Object.keys(TRAIT_LABELS) as Array<keyof PersonalityTraits>).filter(t => t !== 'bias_strength').map((trait) => (
|
||||
<div key={trait} className="space-y-1">
|
||||
<div className="flex justify-between items-center">
|
||||
<label className="text-xs font-medium text-muted-foreground">{TRAIT_LABELS[trait].label}</label>
|
||||
<span className="text-xs text-primary font-semibold">{Math.round(editPersonality[trait] * 100)}%</span>
|
||||
</div>
|
||||
<input
|
||||
type="range"
|
||||
min="0"
|
||||
max="100"
|
||||
value={Math.round(editPersonality[trait] * 100)}
|
||||
onChange={(e) => onEditChange(trait, parseInt(e.target.value) / 100)}
|
||||
className="w-full h-1.5 bg-muted rounded-lg appearance-none cursor-pointer accent-primary"
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Influence Strength - always shown */}
|
||||
<div className="pt-3 border-t border-border">
|
||||
<div className="flex justify-between items-center mb-2">
|
||||
<div>
|
||||
<label className="text-sm font-medium text-foreground">Personality Influence</label>
|
||||
<p className="text-xs text-muted-foreground">How strongly traits affect responses</p>
|
||||
</div>
|
||||
<span className="text-sm font-bold text-primary">{Math.round(data.bias_strength * 100)}%</span>
|
||||
</div>
|
||||
{editMode && (
|
||||
<input
|
||||
type="range"
|
||||
min="0"
|
||||
max="100"
|
||||
value={Math.round(editPersonality.bias_strength * 100)}
|
||||
onChange={(e) => onEditChange('bias_strength', parseInt(e.target.value) / 100)}
|
||||
className="w-full h-2 bg-muted rounded-lg appearance-none cursor-pointer accent-primary"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">{info.description}</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -127,6 +203,7 @@ export function BankProfileView() {
|
|||
const { currentBank } = useBank();
|
||||
const [profile, setProfile] = useState<BankProfile | null>(null);
|
||||
const [stats, setStats] = useState<BankStats | null>(null);
|
||||
const [operations, setOperations] = useState<Operation[]>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [saving, setSaving] = useState(false);
|
||||
const [editMode, setEditMode] = useState(false);
|
||||
|
|
@ -148,12 +225,14 @@ export function BankProfileView() {
|
|||
|
||||
setLoading(true);
|
||||
try {
|
||||
const [profileData, statsData] = await Promise.all([
|
||||
const [profileData, statsData, opsData] = await Promise.all([
|
||||
client.getBankProfile(currentBank),
|
||||
client.getBankStats(currentBank)
|
||||
client.getBankStats(currentBank),
|
||||
client.listOperations(currentBank)
|
||||
]);
|
||||
setProfile(profileData);
|
||||
setStats(statsData as BankStats);
|
||||
setOperations((opsData as any)?.operations || []);
|
||||
|
||||
// Initialize edit state
|
||||
setEditName(profileData.name);
|
||||
|
|
@ -199,6 +278,9 @@ export function BankProfileView() {
|
|||
useEffect(() => {
|
||||
if (currentBank) {
|
||||
loadData();
|
||||
// Refresh operations every 5 seconds
|
||||
const interval = setInterval(loadData, 5000);
|
||||
return () => clearInterval(interval);
|
||||
}
|
||||
}, [currentBank]);
|
||||
|
||||
|
|
@ -230,22 +312,15 @@ export function BankProfileView() {
|
|||
<div className="flex justify-between items-center">
|
||||
<div>
|
||||
<h2 className="text-2xl font-bold text-foreground">{profile?.name || currentBank}</h2>
|
||||
<p className="text-sm text-muted-foreground">Bank ID: {currentBank}</p>
|
||||
<p className="text-sm text-muted-foreground font-mono">{currentBank}</p>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
{editMode ? (
|
||||
<>
|
||||
<Button
|
||||
onClick={handleCancel}
|
||||
variant="outline"
|
||||
disabled={saving}
|
||||
>
|
||||
<Button onClick={handleCancel} variant="outline" disabled={saving}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleSave}
|
||||
disabled={saving}
|
||||
>
|
||||
<Button onClick={handleSave} disabled={saving}>
|
||||
{saving ? (
|
||||
<>
|
||||
<RefreshCw className="w-4 h-4 mr-2 animate-spin" />
|
||||
|
|
@ -261,18 +336,11 @@ export function BankProfileView() {
|
|||
</>
|
||||
) : (
|
||||
<>
|
||||
<Button
|
||||
onClick={loadData}
|
||||
variant="outline"
|
||||
size="sm"
|
||||
>
|
||||
<Button onClick={loadData} variant="outline" size="sm">
|
||||
<RefreshCw className="w-4 h-4 mr-2" />
|
||||
Refresh
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => setEditMode(true)}
|
||||
size="sm"
|
||||
>
|
||||
<Button onClick={() => setEditMode(true)} size="sm">
|
||||
Edit Profile
|
||||
</Button>
|
||||
</>
|
||||
|
|
@ -280,133 +348,245 @@ export function BankProfileView() {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{/* Stats Overview */}
|
||||
{/* Stats Overview - Compact cards */}
|
||||
{stats && (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle className="flex items-center gap-2">
|
||||
<Brain className="w-5 h-5" />
|
||||
Memory Overview
|
||||
</CardTitle>
|
||||
<CardDescription>Summary of stored memories and connections</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="grid grid-cols-2 md:grid-cols-4 gap-4">
|
||||
<div className="bg-muted/50 border border-border rounded-lg p-4 text-center">
|
||||
<div className="text-xs text-muted-foreground font-semibold uppercase tracking-wide mb-1">Total Memories</div>
|
||||
<div className="text-2xl font-bold text-foreground">{stats.total_nodes}</div>
|
||||
<div className="grid grid-cols-2 md:grid-cols-4 gap-4">
|
||||
<Card className="bg-gradient-to-br from-blue-500/10 to-blue-600/5 border-blue-500/20">
|
||||
<CardContent className="p-4">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="p-2 rounded-lg bg-blue-500/20">
|
||||
<Database className="w-5 h-5 text-blue-500" />
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-xs text-muted-foreground font-medium">Memories</p>
|
||||
<p className="text-2xl font-bold text-foreground">{stats.total_nodes}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="bg-muted/50 border border-border rounded-lg p-4 text-center">
|
||||
<div className="text-xs text-muted-foreground font-semibold uppercase tracking-wide mb-1">Total Links</div>
|
||||
<div className="text-2xl font-bold text-foreground">{stats.total_links}</div>
|
||||
</div>
|
||||
<div className="bg-muted/50 border border-border rounded-lg p-4 text-center">
|
||||
<div className="text-xs text-muted-foreground font-semibold uppercase tracking-wide mb-1">Documents</div>
|
||||
<div className="text-2xl font-bold text-foreground">{stats.total_documents}</div>
|
||||
</div>
|
||||
<div className="bg-muted/50 border border-border rounded-lg p-4 text-center">
|
||||
<div className="text-xs text-muted-foreground font-semibold uppercase tracking-wide mb-1">Pending Ops</div>
|
||||
<div className="text-2xl font-bold text-foreground">{stats.pending_operations}</div>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Memory Type Breakdown */}
|
||||
<div className="mt-4 grid grid-cols-3 gap-4">
|
||||
<div className="bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 rounded-lg p-3 text-center">
|
||||
<div className="text-xs text-blue-600 dark:text-blue-400 font-semibold uppercase tracking-wide mb-1">World Facts</div>
|
||||
<div className="text-xl font-bold text-blue-700 dark:text-blue-300">{stats.nodes_by_fact_type?.world || 0}</div>
|
||||
<Card className="bg-gradient-to-br from-purple-500/10 to-purple-600/5 border-purple-500/20">
|
||||
<CardContent className="p-4">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="p-2 rounded-lg bg-purple-500/20">
|
||||
<Link2 className="w-5 h-5 text-purple-500" />
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-xs text-muted-foreground font-medium">Links</p>
|
||||
<p className="text-2xl font-bold text-foreground">{stats.total_links}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="bg-purple-50 dark:bg-purple-950/30 border border-purple-200 dark:border-purple-800 rounded-lg p-3 text-center">
|
||||
<div className="text-xs text-purple-600 dark:text-purple-400 font-semibold uppercase tracking-wide mb-1">Bank Facts</div>
|
||||
<div className="text-xl font-bold text-purple-700 dark:text-purple-300">{stats.nodes_by_fact_type?.bank || 0}</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card className="bg-gradient-to-br from-emerald-500/10 to-emerald-600/5 border-emerald-500/20">
|
||||
<CardContent className="p-4">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="p-2 rounded-lg bg-emerald-500/20">
|
||||
<FolderOpen className="w-5 h-5 text-emerald-500" />
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-xs text-muted-foreground font-medium">Documents</p>
|
||||
<p className="text-2xl font-bold text-foreground">{stats.total_documents}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-lg p-3 text-center">
|
||||
<div className="text-xs text-amber-600 dark:text-amber-400 font-semibold uppercase tracking-wide mb-1">Opinions</div>
|
||||
<div className="text-xl font-bold text-amber-700 dark:text-amber-300">{stats.nodes_by_fact_type?.opinion || 0}</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card className={`bg-gradient-to-br ${stats.pending_operations > 0 ? 'from-amber-500/10 to-amber-600/5 border-amber-500/20' : 'from-slate-500/10 to-slate-600/5 border-slate-500/20'}`}>
|
||||
<CardContent className="p-4">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className={`p-2 rounded-lg ${stats.pending_operations > 0 ? 'bg-amber-500/20' : 'bg-slate-500/20'}`}>
|
||||
<Activity className={`w-5 h-5 ${stats.pending_operations > 0 ? 'text-amber-500 animate-pulse' : 'text-slate-500'}`} />
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-xs text-muted-foreground font-medium">Pending</p>
|
||||
<p className="text-2xl font-bold text-foreground">{stats.pending_operations}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Memory Type Breakdown */}
|
||||
{stats && (
|
||||
<div className="grid grid-cols-3 gap-3">
|
||||
<div className="bg-blue-500/10 border border-blue-500/20 rounded-xl p-4 text-center">
|
||||
<p className="text-xs text-blue-600 dark:text-blue-400 font-semibold uppercase tracking-wide">World Facts</p>
|
||||
<p className="text-2xl font-bold text-blue-600 dark:text-blue-400 mt-1">{stats.nodes_by_fact_type?.world || 0}</p>
|
||||
</div>
|
||||
<div className="bg-purple-500/10 border border-purple-500/20 rounded-xl p-4 text-center">
|
||||
<p className="text-xs text-purple-600 dark:text-purple-400 font-semibold uppercase tracking-wide">Bank Facts</p>
|
||||
<p className="text-2xl font-bold text-purple-600 dark:text-purple-400 mt-1">{stats.nodes_by_fact_type?.bank || 0}</p>
|
||||
</div>
|
||||
<div className="bg-amber-500/10 border border-amber-500/20 rounded-xl p-4 text-center">
|
||||
<p className="text-xs text-amber-600 dark:text-amber-400 font-semibold uppercase tracking-wide">Opinions</p>
|
||||
<p className="text-2xl font-bold text-amber-600 dark:text-amber-400 mt-1">{stats.nodes_by_fact_type?.opinion || 0}</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
|
||||
{/* Basic Info */}
|
||||
{/* Personality Chart */}
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle className="flex items-center gap-2">
|
||||
<User className="w-5 h-5" />
|
||||
Basic Information
|
||||
<CardHeader className="pb-2">
|
||||
<CardTitle className="flex items-center gap-2 text-lg">
|
||||
<Brain className="w-5 h-5 text-primary" />
|
||||
Personality Profile
|
||||
</CardTitle>
|
||||
<CardDescription>Name and identity for this memory bank</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<div>
|
||||
<label className="text-sm font-medium text-foreground">Display Name</label>
|
||||
{editMode ? (
|
||||
<Input
|
||||
value={editName}
|
||||
onChange={(e) => setEditName(e.target.value)}
|
||||
placeholder="Enter a name for this bank"
|
||||
className="mt-1"
|
||||
/>
|
||||
) : (
|
||||
<p className="mt-1 text-foreground">{profile?.name || 'Unnamed'}</p>
|
||||
)}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Background */}
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle className="flex items-center gap-2">
|
||||
<FileText className="w-5 h-5" />
|
||||
Background
|
||||
</CardTitle>
|
||||
<CardDescription>Context and background information for this memory bank</CardDescription>
|
||||
<CardDescription>Big Five personality traits that influence responses</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
{editMode ? (
|
||||
<Textarea
|
||||
value={editBackground}
|
||||
onChange={(e) => setEditBackground(e.target.value)}
|
||||
placeholder="Enter background information..."
|
||||
rows={6}
|
||||
className="resize-none"
|
||||
{profile && (
|
||||
<PersonalityRadarChart
|
||||
personality={profile.personality}
|
||||
editMode={editMode}
|
||||
editPersonality={editPersonality}
|
||||
onEditChange={(trait, value) => setEditPersonality(prev => ({ ...prev, [trait]: value }))}
|
||||
/>
|
||||
) : (
|
||||
<p className="text-foreground whitespace-pre-wrap">
|
||||
{profile?.background || 'No background information provided.'}
|
||||
</p>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Basic Info & Background */}
|
||||
<div className="space-y-6">
|
||||
<Card>
|
||||
<CardHeader className="pb-2">
|
||||
<CardTitle className="flex items-center gap-2 text-lg">
|
||||
<User className="w-5 h-5 text-primary" />
|
||||
Identity
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div>
|
||||
<label className="text-sm font-medium text-muted-foreground">Display Name</label>
|
||||
{editMode ? (
|
||||
<Input
|
||||
value={editName}
|
||||
onChange={(e) => setEditName(e.target.value)}
|
||||
placeholder="Enter a name for this bank"
|
||||
className="mt-1"
|
||||
/>
|
||||
) : (
|
||||
<p className="mt-1 text-lg font-medium text-foreground">{profile?.name || 'Unnamed'}</p>
|
||||
)}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardHeader className="pb-2">
|
||||
<CardTitle className="flex items-center gap-2 text-lg">
|
||||
<FileText className="w-5 h-5 text-primary" />
|
||||
Background
|
||||
</CardTitle>
|
||||
<CardDescription>Context that shapes how memories are interpreted</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
{editMode ? (
|
||||
<Textarea
|
||||
value={editBackground}
|
||||
onChange={(e) => setEditBackground(e.target.value)}
|
||||
placeholder="Enter background information..."
|
||||
rows={5}
|
||||
className="resize-none"
|
||||
/>
|
||||
) : (
|
||||
<p className="text-sm text-foreground whitespace-pre-wrap leading-relaxed">
|
||||
{profile?.background || 'No background information provided.'}
|
||||
</p>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Personality Traits */}
|
||||
{/* Operations Section */}
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle className="flex items-center gap-2">
|
||||
<Brain className="w-5 h-5" />
|
||||
Personality Traits (Big Five)
|
||||
</CardTitle>
|
||||
<CardDescription>
|
||||
These traits influence how the memory bank interprets and responds to information.
|
||||
Based on the Big Five personality model.
|
||||
</CardDescription>
|
||||
<CardHeader className="pb-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<CardTitle className="flex items-center gap-2 text-lg">
|
||||
<Activity className="w-5 h-5 text-primary" />
|
||||
Background Operations
|
||||
</CardTitle>
|
||||
<CardDescription>Async tasks processing memories</CardDescription>
|
||||
</div>
|
||||
{stats && (stats.pending_operations > 0 || stats.failed_operations > 0) && (
|
||||
<div className="flex gap-3">
|
||||
{stats.pending_operations > 0 && (
|
||||
<div className="flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-amber-500/10 border border-amber-500/20">
|
||||
<Clock className="w-3.5 h-3.5 text-amber-500" />
|
||||
<span className="text-xs font-semibold text-amber-600 dark:text-amber-400">{stats.pending_operations} pending</span>
|
||||
</div>
|
||||
)}
|
||||
{stats.failed_operations > 0 && (
|
||||
<div className="flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-red-500/10 border border-red-500/20">
|
||||
<AlertCircle className="w-3.5 h-3.5 text-red-500" />
|
||||
<span className="text-xs font-semibold text-red-600 dark:text-red-400">{stats.failed_operations} failed</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
{(Object.keys(TRAIT_LABELS) as Array<keyof PersonalityTraits>).map((trait) => (
|
||||
<PersonalitySlider
|
||||
key={trait}
|
||||
trait={trait}
|
||||
value={editMode ? editPersonality[trait] : (profile?.personality[trait] || 0.5)}
|
||||
onChange={(value) => setEditPersonality(prev => ({ ...prev, [trait]: value }))}
|
||||
disabled={!editMode}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
{operations.length > 0 ? (
|
||||
<div className="overflow-x-auto">
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="w-[100px]">ID</TableHead>
|
||||
<TableHead>Type</TableHead>
|
||||
<TableHead className="text-center">Items</TableHead>
|
||||
<TableHead>Document</TableHead>
|
||||
<TableHead>Created</TableHead>
|
||||
<TableHead>Status</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{operations.slice(0, 10).map((op) => (
|
||||
<TableRow key={op.id} className={op.status === 'failed' ? 'bg-red-500/5' : ''}>
|
||||
<TableCell className="font-mono text-xs text-muted-foreground">
|
||||
{op.id.substring(0, 8)}
|
||||
</TableCell>
|
||||
<TableCell className="font-medium">{op.task_type}</TableCell>
|
||||
<TableCell className="text-center">{op.items_count}</TableCell>
|
||||
<TableCell className="font-mono text-xs text-muted-foreground">
|
||||
{op.document_id ? op.document_id.substring(0, 12) + '...' : '—'}
|
||||
</TableCell>
|
||||
<TableCell className="text-sm text-muted-foreground">
|
||||
{new Date(op.created_at).toLocaleString()}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
{op.status === 'pending' && (
|
||||
<span className="inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20">
|
||||
<Clock className="w-3 h-3" />
|
||||
pending
|
||||
</span>
|
||||
)}
|
||||
{op.status === 'failed' && (
|
||||
<span className="inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20" title={op.error_message}>
|
||||
<AlertCircle className="w-3 h-3" />
|
||||
failed
|
||||
</span>
|
||||
)}
|
||||
{op.status === 'completed' && (
|
||||
<span className="inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20">
|
||||
<CheckCircle className="w-3 h-3" />
|
||||
done
|
||||
</span>
|
||||
)}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
) : (
|
||||
<p className="text-muted-foreground text-center py-8 text-sm">No background operations</p>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
import { useState } from 'react';
|
||||
import { useBank } from '@/lib/bank-context';
|
||||
import { Search, Sparkles, Database, FileText, Users, ChevronLeft, ChevronRight, UserCircle, BarChart3 } from 'lucide-react';
|
||||
import { Search, Sparkles, Database, FileText, Users, ChevronLeft, ChevronRight, Box } from 'lucide-react';
|
||||
import { cn } from '@/lib/utils';
|
||||
import Link from 'next/link';
|
||||
|
||||
type NavItem = 'recall' | 'reflect' | 'data' | 'documents' | 'entities' | 'profile' | 'stats';
|
||||
type NavItem = 'recall' | 'reflect' | 'data' | 'documents' | 'entities' | 'profile';
|
||||
|
||||
interface SidebarProps {
|
||||
currentTab: NavItem;
|
||||
|
|
@ -22,13 +22,12 @@ export function Sidebar({ currentTab, onTabChange }: SidebarProps) {
|
|||
}
|
||||
|
||||
const navItems = [
|
||||
{ id: 'profile' as NavItem, label: 'Memory Bank', icon: Box },
|
||||
{ id: 'recall' as NavItem, label: 'Recall', icon: Search },
|
||||
{ id: 'reflect' as NavItem, label: 'Reflect', icon: Sparkles },
|
||||
{ id: 'data' as NavItem, label: 'Memories', icon: Database },
|
||||
{ id: 'documents' as NavItem, label: 'Documents', icon: FileText },
|
||||
{ id: 'entities' as NavItem, label: 'Entities', icon: Users },
|
||||
{ id: 'stats' as NavItem, label: 'Stats', icon: BarChart3 },
|
||||
{ id: 'profile' as NavItem, label: 'Profile', icon: UserCircle },
|
||||
];
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -1,234 +0,0 @@
|
|||
'use client';
|
||||
|
||||
import { useState, useEffect } from 'react';
|
||||
import { client } from '@/lib/api';
|
||||
import { useBank } from '@/lib/bank-context';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { RefreshCw, AlertCircle, CheckCircle, Clock } from 'lucide-react';
|
||||
|
||||
export function StatsView() {
|
||||
const { currentBank } = useBank();
|
||||
const [stats, setStats] = useState<any>(null);
|
||||
const [operations, setOperations] = useState<any[]>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const loadStats = async () => {
|
||||
if (!currentBank) return;
|
||||
|
||||
setLoading(true);
|
||||
try {
|
||||
const [stats, ops] = await Promise.all([
|
||||
client.getBankStats(currentBank),
|
||||
client.listOperations(currentBank),
|
||||
]);
|
||||
setStats(stats);
|
||||
setOperations((ops as any)?.operations || []);
|
||||
} catch (error) {
|
||||
console.error('Error loading stats:', error);
|
||||
alert('Error loading stats: ' + (error as Error).message);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (currentBank) {
|
||||
loadStats();
|
||||
// Refresh every 5 seconds
|
||||
const interval = setInterval(loadStats, 5000);
|
||||
return () => clearInterval(interval);
|
||||
}
|
||||
}, [currentBank]);
|
||||
|
||||
if (!currentBank) {
|
||||
return (
|
||||
<Card>
|
||||
<CardContent className="p-10 text-center">
|
||||
<h3 className="text-xl font-semibold mb-2 text-card-foreground">No Bank Selected</h3>
|
||||
<p className="text-muted-foreground">Please select a memory bank from the dropdown above to view statistics.</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
if (loading && !stats) {
|
||||
return (
|
||||
<Card>
|
||||
<CardContent className="text-center py-10">
|
||||
<Clock className="w-12 h-12 mx-auto mb-3 text-muted-foreground animate-pulse" />
|
||||
<div className="text-lg text-muted-foreground">Loading statistics...</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
{/* Stats Section */}
|
||||
{stats && (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<CardTitle>Memory Statistics</CardTitle>
|
||||
<CardDescription>Overview of stored memories and connections</CardDescription>
|
||||
</div>
|
||||
<Button
|
||||
onClick={loadStats}
|
||||
size="sm"
|
||||
variant="outline"
|
||||
>
|
||||
<RefreshCw className="w-4 h-4 mr-2" />
|
||||
Refresh
|
||||
</Button>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="grid grid-cols-3 gap-4">
|
||||
<div className="bg-muted/50 border border-border rounded-lg p-4 text-center transition-all hover:bg-muted">
|
||||
<div className="text-xs text-muted-foreground font-semibold uppercase tracking-wide mb-2">Total Nodes</div>
|
||||
<div className="text-3xl font-bold text-foreground">{stats.total_nodes || 0}</div>
|
||||
</div>
|
||||
<div className="bg-muted/50 border border-border rounded-lg p-4 text-center transition-all hover:bg-muted">
|
||||
<div className="text-xs text-muted-foreground font-semibold uppercase tracking-wide mb-2">World Facts</div>
|
||||
<div className="text-3xl font-bold text-foreground">{stats.nodes_by_fact_type?.world || 0}</div>
|
||||
</div>
|
||||
<div className="bg-muted/50 border border-border rounded-lg p-4 text-center transition-all hover:bg-muted">
|
||||
<div className="text-xs text-muted-foreground font-semibold uppercase tracking-wide mb-2">Bank Facts</div>
|
||||
<div className="text-3xl font-bold text-foreground">{stats.nodes_by_fact_type?.bank || 0}</div>
|
||||
</div>
|
||||
<div className="bg-muted/50 border border-border rounded-lg p-4 text-center transition-all hover:bg-muted">
|
||||
<div className="text-xs text-muted-foreground font-semibold uppercase tracking-wide mb-2">Opinions</div>
|
||||
<div className="text-3xl font-bold text-foreground">{stats.nodes_by_fact_type?.opinion || 0}</div>
|
||||
</div>
|
||||
<div className="bg-muted/50 border border-border rounded-lg p-4 text-center transition-all hover:bg-muted">
|
||||
<div className="text-xs text-muted-foreground font-semibold uppercase tracking-wide mb-2">Total Links</div>
|
||||
<div className="text-3xl font-bold text-foreground">{stats.total_links || 0}</div>
|
||||
</div>
|
||||
<div className="bg-muted/50 border border-border rounded-lg p-4 text-center transition-all hover:bg-muted">
|
||||
<div className="text-xs text-muted-foreground font-semibold uppercase tracking-wide mb-2">Temporal Links</div>
|
||||
<div className="text-3xl font-bold text-foreground">{stats.links_by_link_type?.temporal || 0}</div>
|
||||
</div>
|
||||
<div className="bg-muted/50 border border-border rounded-lg p-4 text-center transition-all hover:bg-muted">
|
||||
<div className="text-xs text-muted-foreground font-semibold uppercase tracking-wide mb-2">Semantic Links</div>
|
||||
<div className="text-3xl font-bold text-foreground">{stats.links_by_link_type?.semantic || 0}</div>
|
||||
</div>
|
||||
<div className="bg-muted/50 border border-border rounded-lg p-4 text-center transition-all hover:bg-muted">
|
||||
<div className="text-xs text-muted-foreground font-semibold uppercase tracking-wide mb-2">Entity Links</div>
|
||||
<div className="text-3xl font-bold text-foreground">{stats.links_by_link_type?.entity || 0}</div>
|
||||
</div>
|
||||
<div className="bg-muted/50 border border-border rounded-lg p-4 text-center transition-all hover:bg-muted">
|
||||
<div className="text-xs text-muted-foreground font-semibold uppercase tracking-wide mb-2">Documents</div>
|
||||
<div className="text-3xl font-bold text-foreground">{stats.total_documents || 0}</div>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{/* Operations Section */}
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Async Operations</CardTitle>
|
||||
<CardDescription>Background tasks and their status</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
{stats && (stats.pending_operations > 0 || stats.failed_operations > 0) && (
|
||||
<div className="mb-4 p-3 bg-amber-50 dark:bg-amber-950 border border-amber-200 dark:border-amber-800 rounded-lg">
|
||||
<div className="flex gap-4">
|
||||
{stats.pending_operations > 0 && (
|
||||
<div className="flex items-center gap-2">
|
||||
<Clock className="w-4 h-4 text-amber-600 dark:text-amber-400" />
|
||||
<span className="text-amber-700 dark:text-amber-300 font-semibold">Pending:</span>
|
||||
<span className="text-amber-900 dark:text-amber-100 font-bold">{stats.pending_operations}</span>
|
||||
</div>
|
||||
)}
|
||||
{stats.failed_operations > 0 && (
|
||||
<div className="flex items-center gap-2">
|
||||
<AlertCircle className="w-4 h-4 text-destructive" />
|
||||
<span className="text-destructive font-semibold">Failed:</span>
|
||||
<span className="text-destructive font-bold">{stats.failed_operations}</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{operations.length > 0 ? (
|
||||
<div className="overflow-x-auto">
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>ID</TableHead>
|
||||
<TableHead>Type</TableHead>
|
||||
<TableHead>Items</TableHead>
|
||||
<TableHead>Document ID</TableHead>
|
||||
<TableHead>Created</TableHead>
|
||||
<TableHead>Status</TableHead>
|
||||
<TableHead>Error</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{operations.map((op) => (
|
||||
<TableRow key={op.id} className={op.status === 'failed' ? 'bg-destructive/5' : ''}>
|
||||
<TableCell title={op.id} className="font-mono text-xs">
|
||||
{op.id.substring(0, 8)}...
|
||||
</TableCell>
|
||||
<TableCell>{op.task_type}</TableCell>
|
||||
<TableCell>{op.items_count}</TableCell>
|
||||
<TableCell className="font-mono text-xs">{op.document_id || 'N/A'}</TableCell>
|
||||
<TableCell className="text-sm">
|
||||
{new Date(op.created_at).toLocaleString()}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<div className="flex items-center gap-2">
|
||||
{op.status === 'pending' && (
|
||||
<>
|
||||
<Clock className="w-3 h-3 text-amber-600" />
|
||||
<span className="px-2 py-1 rounded text-xs font-semibold bg-amber-100 dark:bg-amber-950 text-amber-800 dark:text-amber-200 border border-amber-200 dark:border-amber-800">
|
||||
{op.status}
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
{op.status === 'failed' && (
|
||||
<>
|
||||
<AlertCircle className="w-3 h-3 text-destructive" />
|
||||
<span className="px-2 py-1 rounded text-xs font-semibold bg-destructive/10 text-destructive border border-destructive/20">
|
||||
{op.status}
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
{op.status === 'completed' && (
|
||||
<>
|
||||
<CheckCircle className="w-3 h-3 text-green-600 dark:text-green-400" />
|
||||
<span className="px-2 py-1 rounded text-xs font-semibold bg-green-100 dark:bg-green-950 text-green-800 dark:text-green-200 border border-green-200 dark:border-green-800">
|
||||
{op.status}
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
{op.error_message ? (
|
||||
<span className="text-destructive text-sm" title={op.error_message}>
|
||||
{op.error_message.substring(0, 50)}...
|
||||
</span>
|
||||
) : (
|
||||
<span className="text-muted-foreground">None</span>
|
||||
)}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
) : (
|
||||
<p className="text-muted-foreground text-center py-5">No operations found</p>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -8,17 +8,52 @@ Model Context Protocol (MCP) tools exposed by the Hindsight MCP server.
|
|||
|
||||
## Available Tools
|
||||
|
||||
### hindsight_search
|
||||
### hindsight_put
|
||||
|
||||
Search memories for a memory bank.
|
||||
Store a new memory for a user.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
|-----------|------|----------|-------------|
|
||||
| `query` | string | yes | Search query |
|
||||
| `agent_id` | string | no | bank ID (uses default if not specified) |
|
||||
| `top_k` | integer | no | Number of results (default: 10) |
|
||||
| `bank_id` | string | yes | Unique identifier for the user (e.g., user_id, email) |
|
||||
| `content` | string | yes | Memory content to store |
|
||||
| `context` | string | yes | Category for the memory (e.g., 'personal_preferences', 'work_history') |
|
||||
| `explanation` | string | no | Optional explanation for why this memory is being stored |
|
||||
|
||||
**Example:**
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "hindsight_put",
|
||||
"arguments": {
|
||||
"bank_id": "user_12345",
|
||||
"content": "User prefers Python for data analysis",
|
||||
"context": "programming_preferences"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Response:**
|
||||
|
||||
```
|
||||
Fact stored successfully
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### hindsight_search
|
||||
|
||||
Search memories for a user.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
|-----------|------|----------|-------------|
|
||||
| `bank_id` | string | yes | Unique identifier for the user (e.g., user_id, email) |
|
||||
| `query` | string | yes | Natural language search query |
|
||||
| `max_tokens` | integer | no | Maximum tokens for results (default: 4096) |
|
||||
| `explanation` | string | no | Optional explanation for why this search is being performed |
|
||||
|
||||
**Example:**
|
||||
|
||||
|
|
@ -26,8 +61,8 @@ Search memories for a memory bank.
|
|||
{
|
||||
"name": "hindsight_search",
|
||||
"arguments": {
|
||||
"query": "What does Alice do for work?",
|
||||
"top_k": 5
|
||||
"bank_id": "user_12345",
|
||||
"query": "What does the user do for work?"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
@ -38,9 +73,12 @@ Search memories for a memory bank.
|
|||
{
|
||||
"results": [
|
||||
{
|
||||
"text": "Alice works at Google as a software engineer",
|
||||
"weight": 0.95,
|
||||
"fact_type": "world"
|
||||
"id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"text": "User works at Google as a software engineer",
|
||||
"type": "world",
|
||||
"context": "work_history",
|
||||
"event_date": null,
|
||||
"document_id": null
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -48,129 +86,32 @@ Search memories for a memory bank.
|
|||
|
||||
---
|
||||
|
||||
### hindsight_think
|
||||
## Usage Guidelines
|
||||
|
||||
Generate a personality-aware response using retrieved memories.
|
||||
The MCP tools are designed for **per-user memory**:
|
||||
|
||||
**Parameters:**
|
||||
- Each user MUST have a unique `bank_id` (user ID, email, session ID, etc.)
|
||||
- Memories are isolated by `bank_id` — users cannot access each other's memories
|
||||
- Use consistent `bank_id` values across all interactions with the same user
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
|-----------|------|----------|-------------|
|
||||
| `query` | string | yes | Question or prompt |
|
||||
| `agent_id` | string | no | bank ID (uses default if not specified) |
|
||||
| `budget` | string | no | Budget level: 'low', 'mid', 'high' (default: 'low') |
|
||||
**When to use `hindsight_put`:**
|
||||
- User shares personal facts, preferences, or interests
|
||||
- Important events or milestones are mentioned
|
||||
- Decisions, opinions, or goals are stated
|
||||
- Any information the user would want remembered
|
||||
|
||||
**Example:**
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "hindsight_think",
|
||||
"arguments": {
|
||||
"query": "What should I recommend to Alice?"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
{
|
||||
"text": "Based on Alice's interest in machine learning and her work at Google, I would recommend...",
|
||||
"based_on": [
|
||||
{"text": "Alice works at Google", "weight": 0.95}
|
||||
],
|
||||
"new_opinions": []
|
||||
}
|
||||
```
|
||||
**When to use `hindsight_search`:**
|
||||
- Start of conversation to get user context
|
||||
- Before making recommendations
|
||||
- To provide continuity across conversations
|
||||
- When user asks about something they may have mentioned before
|
||||
|
||||
---
|
||||
|
||||
### hindsight_store
|
||||
|
||||
Store a new memory.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
|-----------|------|----------|-------------|
|
||||
| `content` | string | yes | Memory content to store |
|
||||
| `agent_id` | string | no | bank ID (uses default if not specified) |
|
||||
| `context` | string | no | Context or topic of the memory |
|
||||
|
||||
**Example:**
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "hindsight_store",
|
||||
"arguments": {
|
||||
"content": "User prefers Python for data analysis",
|
||||
"context": "programming discussion"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"message": "Memory stored successfully"
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### hindsight_agents
|
||||
|
||||
List all available memory banks.
|
||||
|
||||
**Parameters:** None
|
||||
|
||||
**Example:**
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "hindsight_agents",
|
||||
"arguments": {}
|
||||
}
|
||||
```
|
||||
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
{
|
||||
"memory banks": [
|
||||
{"agent_id": "default"},
|
||||
{"agent_id": "assistant"},
|
||||
{"agent_id": "researcher"}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable | Description | Default |
|
||||
|----------|-------------|---------|
|
||||
| `HINDSIGHT_API_URL` | Hindsight API URL | `http://localhost:8888` |
|
||||
| `HINDSIGHT_AGENT_ID` | Default bank ID | Required |
|
||||
|
||||
## Error Responses
|
||||
|
||||
MCP tools return errors in the standard MCP error format:
|
||||
MCP tools return errors as strings:
|
||||
|
||||
```json
|
||||
{
|
||||
"error": {
|
||||
"code": "NOT_FOUND",
|
||||
"message": "Memory bank 'unknown-agent' not found"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
| Code | Description |
|
||||
|------|-------------|
|
||||
| `INVALID_PARAMS` | Missing or invalid parameters |
|
||||
| `NOT_FOUND` | Memory bank or resource not found |
|
||||
| `INTERNAL_ERROR` | Server error |
|
||||
Error: Memory bank 'unknown-bank' not found
|
||||
```
|
||||
|
|
|
|||
|
|
@ -6,13 +6,11 @@ sidebar_position: 4
|
|||
|
||||
Model Context Protocol server for AI assistants like Claude Desktop.
|
||||
|
||||
## Installation
|
||||
## Setup
|
||||
|
||||
```bash
|
||||
cd hindsight-cli && cargo build --release
|
||||
```
|
||||
The MCP server is included in the Hindsight API. When running the API with MCP enabled (default), it exposes MCP tools via SSE at `/mcp/sse`.
|
||||
|
||||
## Claude Desktop Setup
|
||||
### Claude Desktop Configuration
|
||||
|
||||
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
||||
|
||||
|
|
@ -20,85 +18,51 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|||
{
|
||||
"mcpServers": {
|
||||
"hindsight": {
|
||||
"command": "/path/to/hindsight",
|
||||
"args": ["mcp-server"],
|
||||
"env": {
|
||||
"HINDSIGHT_API_URL": "http://localhost:8888",
|
||||
"HINDSIGHT_AGENT_ID": "claude-agent"
|
||||
}
|
||||
"command": "npx",
|
||||
"args": ["-y", "mcp-remote", "http://localhost:8888/mcp/sse"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable | Description | Default |
|
||||
|----------|-------------|---------|
|
||||
| `HINDSIGHT_API_URL` | Hindsight API URL | `http://localhost:8888` |
|
||||
| `HINDSIGHT_AGENT_ID` | Default bank ID | Required |
|
||||
|
||||
## Available Tools
|
||||
|
||||
### hindsight_put
|
||||
|
||||
Store a memory for a user:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "hindsight_put",
|
||||
"arguments": {
|
||||
"bank_id": "user_12345",
|
||||
"content": "User prefers Python for data analysis",
|
||||
"context": "programming_preferences"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### hindsight_search
|
||||
|
||||
Search memories:
|
||||
Search memories for a user:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "hindsight_search",
|
||||
"arguments": {
|
||||
"query": "What does Alice do for work?",
|
||||
"top_k": 5
|
||||
"bank_id": "user_12345",
|
||||
"query": "What does the user do for work?"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### hindsight_think
|
||||
|
||||
Generate response using memories:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "hindsight_think",
|
||||
"arguments": {
|
||||
"query": "What should I recommend to Alice?"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### hindsight_store
|
||||
|
||||
Store new memory:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "hindsight_store",
|
||||
"arguments": {
|
||||
"content": "User prefers Python for data analysis",
|
||||
"context": "programming discussion"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### hindsight_agents
|
||||
|
||||
List available memory banks:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "hindsight_agents",
|
||||
"arguments": {}
|
||||
}
|
||||
```
|
||||
|
||||
## Usage Example
|
||||
|
||||
Once configured, Claude can use Hindsight naturally:
|
||||
|
||||
**User**: "Remember that I prefer morning meetings"
|
||||
|
||||
**Claude**: *Uses hindsight_store*
|
||||
**Claude**: *Uses hindsight_put*
|
||||
|
||||
> "I've noted that you prefer morning meetings."
|
||||
|
||||
|
|
@ -110,16 +74,12 @@ Once configured, Claude can use Hindsight naturally:
|
|||
|
||||
> "Based on our conversations, you prefer morning meetings and like Python for data analysis."
|
||||
|
||||
## Testing
|
||||
## Per-User Memory
|
||||
|
||||
Run standalone:
|
||||
The MCP tools require a `bank_id` for each user:
|
||||
|
||||
```bash
|
||||
hindsight mcp-server
|
||||
```
|
||||
- Each user must have a unique `bank_id` (user ID, email, session ID)
|
||||
- Memories are isolated by `bank_id`
|
||||
- Use consistent `bank_id` values across interactions
|
||||
|
||||
Debug mode:
|
||||
|
||||
```bash
|
||||
RUST_LOG=debug hindsight mcp-server
|
||||
```
|
||||
See [MCP API Reference](/api-reference/mcp) for full parameter details.
|
||||
|
|
|
|||
|
|
@ -332,18 +332,30 @@ article li {
|
|||
margin-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
/* API Method badges in sidebar */
|
||||
.api-method::before {
|
||||
display: inline-block;
|
||||
font-size: 0.625rem;
|
||||
/* API Method badges in sidebar - OpenAPI plugin */
|
||||
li.api-method {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
li.api-method > a.menu__link {
|
||||
order: 2;
|
||||
}
|
||||
|
||||
/* Style the badge added by openapi plugin */
|
||||
li.api-method::before {
|
||||
order: 1;
|
||||
flex-shrink: 0;
|
||||
font-size: 0.5625rem;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
padding: 0.125rem 0.375rem;
|
||||
border-radius: 0.25rem;
|
||||
margin-right: 0.5rem;
|
||||
font-family: var(--ifm-font-family-monospace);
|
||||
letter-spacing: 0.025em;
|
||||
vertical-align: middle;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.api-method.get::before {
|
||||
|
|
|
|||
6
uv.lock
6
uv.lock
|
|
@ -1141,7 +1141,7 @@ provides-extras = ["test"]
|
|||
|
||||
[[package]]
|
||||
name = "hindsight-api"
|
||||
version = "0.0.15"
|
||||
version = "0.0.16"
|
||||
source = { editable = "hindsight-api" }
|
||||
dependencies = [
|
||||
{ name = "alembic" },
|
||||
|
|
@ -1243,7 +1243,7 @@ dev = [
|
|||
|
||||
[[package]]
|
||||
name = "hindsight-client"
|
||||
version = "0.0.15"
|
||||
version = "0.0.16"
|
||||
source = { editable = "hindsight-clients/python" }
|
||||
dependencies = [
|
||||
{ name = "aiohttp" },
|
||||
|
|
@ -1275,7 +1275,7 @@ provides-extras = ["test"]
|
|||
|
||||
[[package]]
|
||||
name = "hindsight-dev"
|
||||
version = "0.0.15"
|
||||
version = "0.0.16"
|
||||
source = { editable = "hindsight-dev" }
|
||||
dependencies = [
|
||||
{ name = "hindsight-api" },
|
||||
|
|
|
|||
Loading…
Reference in a new issue