Skip to content

Commit 1506d9f

Browse files
wheattoast11claude
andauthored
Release/v2.0.0 (#14)
* fix: Lazy initialization for graph/session modules and DDL execution - Add ensureIntegrations() calls to all graph and session legacy tool implementations to prevent null reference errors - Add executeDDL() function in dbClient for CREATE/INSERT/UPDATE/DELETE operations (schema management not exposed to user queries) - Update knowledgeGraph.js to use executeDDL for table creation - Update sessionStore.js to use executeDDL for schema and DML operations - Fix setup-claude-code.js: init() -> initDB() Resolves "Cannot read properties of null" errors when calling graph_* or session_* tools before module initialization. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(cli): Zero CLI with verification layer and micro-libraries Implements the Zero CLI - a bleeding-edge agentic intelligence system with: Core Features: - bin/zero executable with 9 commands (research, search, graph, session, verify, config, status, help, version) - Zero external dependencies for core CLI using custom micro-libraries - Timeout-protected initialization with graceful fallbacks Micro-Libraries (src/cli/lib/): - micro-args.js: Zero-dependency argument parser with aliases, booleans, camelCase - micro-term.js: ANSI terminal control, colors, cursor management - micro-progress.js: Animated spinner and progress bar - micro-prompt.js: Interactive input, password masking, selection - micro-crypt.js: AES-256-GCM encryption, scrypt key derivation, hash chains Verification Layer (src/cli/verification/): - consensusGate.js: Multi-model agreement checking to prevent hallucinations - Extracts factual claims (existence, capability, temporal, negation) - Calculates agreement ratios across model responses - Flags high-severity disputed claims (like "X doesn't exist") - sourceVerifier.js: Citation/URL validation with reliability tracking - Verifies source accessibility - Tracks domain trust scores - Cross-references against knowledge graph - factTracker.js: Accuracy metrics and feedback integration - Persists verification results to database - Tracks model accuracy over time - Supports user corrections - index.js: VerificationPipeline unifying all components This addresses the critical Qwen3-Omni research failure by implementing multi-stage verification to catch factually incorrect claims before output. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: Align database schema - rename reports to research_reports Root cause: The table was created as `reports` in dbClient.js but handlers referenced `research_reports`. This mismatch caused SQL queries to fail with "relation does not exist" errors. Changes: - dbClient.js: Renamed all `reports` table references to `research_reports` - kb.js: Fixed getReport to use getReportById, updated column names (query → original_query), extract params from JSONB - graph.js: Updated all SQL to use original_query column The handlers were also referencing non-existent columns (query, rating, cost_preference as direct columns). Fixed to use actual schema: - original_query instead of query - parameters JSONB for costPreference/audienceLevel 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs(v1.9.0): Documentation overhaul, CI/CD automation, MCP compliance Documentation: - README restructured: concise, scannable format with collapsible sections - Fixed all outdated GitHub URLs (wheattoast11 → terminals-tech) - Updated MCP spec URL from 2025-03-26 to 2025-06-18 stable spec - Documented SEP-990 (Enterprise Auth) and SEP-991 (Client Metadata) - Added ENV-REFERENCE.md with complete environment variable reference CI/CD: - Added npm test script (53 unit tests for core/shared/config) - Added prepublishOnly hook for validation before publish - Created .release-please.json for semantic versioning automation - Expanded files array to include README.md, LICENSE, CHANGELOG.md Infrastructure (from previous commits): - Core abstractions: Signal protocol, parameter normalization, schema registry - Handler utilities: context validation, capability detection, legacy wrappers - Config system: Zod validation, constants, env coercion 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(transport): STDIO default, EADDRINUSE handling, XDG paths BREAKING CHANGE: STDIO is now the default transport per MCP spec. Use --http flag explicitly for HTTP mode. Changes: - Transport: STDIO default, --http flag for HTTP mode - Port conflicts: Clean EADDRINUSE error with actionable suggestions - Data paths: XDG_DATA_HOME > TMPDIR (AppImage) > ~/.local/share - Filesystem: Proactive read-only detection for sandboxed envs - README: Multi-client setup guide (Jan AI, Claude Desktop, etc.) Fixes Jan AI initialization errors in AppImage environments. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(mcp): MCP 2025-11-25 draft spec compliance verification - Verified all 8 SEPs with line-by-line code exploration - Added SEP verification table to MCP-COMPLIANCE-REPORT.md - Added MCP 2025-11-25 Draft compliance badge to README - Updated mcpSpec.features in config.js with all 7 SEPs Phase 0 Compliance Fixes: - taskAdapter.js: notifications/progress format, result structure - sampling.js: content array type, JSON.parse error handling - elicitation.js: cleanup race condition fix - clientMetadata.js: HTTPS enforcement in production - enterpriseAuth.js: RFC 7662 introspection credentials - config.js: Signal, RoleShift, Core handlers enabled by default - tools.js: consolidated normalization via core/normalize.js SEPs Verified: - SEP-1686 (Task Protocol) - SEP-1577 (Sampling with Tools) - SEP-1036 (URL Mode Elicitation) - SEP-1865 (MCP Apps) - SEP-990 (Enterprise Auth) - SEP-991 (Client Metadata) - SEP-1649 (Server Discovery) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * test(integration): Add "Mic Drop" orchestration integration test Comprehensive integration test demonstrating Agent Zero's full parallel research orchestration capabilities through microplastics-cancer investigation. Test phases: - Phase A: Parallel batch_research dispatch (sync/async modes) - Phase B: Signal Protocol consensus calculation - Phase C: Knowledge synthesis with cross-query correlation - Phase D: Session time-travel with checkpoints and forking - Phase E: Knowledge graph integration (PageRank, traversal) Test modes: - DRY_RUN=true: Structural validation without API calls - Live: Full orchestration with real research queries Files: - tests/integration/orchestration/mic-drop.test.js: Main test suite - tests/integration/orchestration/fixtures/microplastics-queries.json: 10 parallel queries - tests/integration/orchestration/helpers/timer.js: Performance instrumentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: Resolve dbClient.query and React dependency errors - Export `query` as alias for `executeQuery` in dbClient for handler compatibility - Import EventStore directly from core module to avoid React adapter dependency - Add fallback to main module import if direct path fails Fixes handler errors calling dbClient.query() which didn't exist. Prevents 'Cannot find module react' error in @terminals-tech/core. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(ux): Parameter normalization, semantic errors, and progress notifications This release adds three major UX improvements: 1. Parameter Normalization (Phase 1) - Unified alias system: taskId → job_id, q → query, etc. - MCP Task Protocol backward compatibility - Single normalize() function replaces 10+ scattered normalizers 2. Semantic Borrow Checker (Phase 2) - Rust-style error diagnostics with actionable suggestions - Detects ID type confusion (job_id vs reportId) - Tree-formatted error messages with hints and fixes 3. Server→Client Push Notifications (Phase 3) - ProgressNotifier for real-time job updates - Phase tracking: planning → researching → synthesizing → complete - MCP 2025-11-25 notifications/progress compliance 4. Token-Efficient Slash Commands (Phase 4) - Streamlined .claude/commands/*.md - New /mcp-job-to-report workflow command Bug Fixes: - task_result now correctly returns results for 'succeeded' jobs - Terminal state detection: succeeded, failed, canceled, complete 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore(release): Bump version to 1.9.1 - package.json: 1.9.0 → 1.9.1 - README.md: Updated What's New section for v1.9.1 - CLAUDE.md: Updated Server Version reference - docs/CHANGELOG.md: Added v1.9.1 release notes - docs/TESTING-GUIDE.md: Updated all version references 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(signal-protocol): wire ensemble signals into research flow - Add Signal creation in ResearchAgent with confidence scoring - Collect signals in conductResearch, persist to DB - Fix aggregatedResults bug in factCheck call - CLI retrieves stored signals for verification - Add health warning debounce in job worker - Update CHANGELOG.md and CLAUDE.md documentation Fixes: undefined aggregatedResults, CLI report ID extraction 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(job-handler): use correct dbClient.cancelJob function Changed updateJobStatus (non-existent) to cancelJob in cancel handler. Fixes job cancellation failing with 'dbClient.updateJobStatus is not a function'. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat: Agent Zero + Security Hardening + CLI Auth ## Agent Zero - Add emergent persona research orchestrator (zeroAgent.js) - Implement lambda calculus combinators in Signal protocol - Add semantic router for query classification - Create Zero endpoint handlers ## Security Fixes (6 vulnerabilities) - Fix command injection in session.js/pane.js (HIGH) - Fix code injection in calc tool (MEDIUM) - Fix timing attack in API key comparison (MEDIUM) - Fix OAuth state bypass for Supabase (MEDIUM) - Fix JWT header parsing (LOW) ## CLI Authentication - Add OAuth PKCE flow for terminals.tech - Add device code flow for headless environments 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(secret-sauce): Add Supabase OAuth and consilience enhancement plan Secret Sauce Branch Additions: - Add Supabase OAuth integration (Google/GitHub via terminals.tech) - Add comprehensive enhancement plan (PLAN.md) with 7 enhancement vectors - Update research outputs from recent batch research sessions - Exclude cloudflared binary (use package manager instead) Enhancement Plan Highlights: - PGlite extensions: pg_trgm, fuzzystrmatch, unaccent for better search - HTTP proxy support for web research (bypass 403/IP restrictions) - BrowserResearchAgent for JavaScript-heavy sites - WebSocket transport (SEP-1288 forward compatibility) - Live queries for reactive knowledge base subscriptions - New ui://browser/research MCP App resource All enhancements designed with ZERO REGRESSION principle. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(ux): Stage 3 - Noob-friendly user journeys User Journey Improvements: - CLI wizard with step-by-step setup (src/cli/wizard/) - Post-wizard success message shows research command templates - CLI research output shows next steps (show, verify, search) - Extension onboarding flow on first install - Plain English extension buttons (Test Connection, Show Interface, etc.) - Fixed extension status indicator bug Documentation: - docs/GETTING-STARTED.md - First 5 minutes guide - docs/CONCEPTS.md - Plain English terminology - docs/ARCHITECTURE.md - Codebase structure with STABLE/BETA/VISION markers - docs/COMMAND-COOKBOOK.md - "I want to..." quick reference - docs/TROUBLESHOOTING.md - Common errors with fixes - src/core/README.md - Module status and integration roadmap - README.md - Documentation links table The fixed point of documentation: docs describe what users observe. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(zero): Zero Protocol v1.10.0 - Self-referential MCP architecture The fixed point of client-server duality: f(x) = x → Zero - Interaction Combinators (γ/δ/ε) based on Lafont nets - DualRoleNode: Client + Server in one entity - Protocol Adapter: Unified MCP/ACP/LSP/A2A/ANP abstraction - zero:// URI scheme for self-referential addressing - SelfConnection handler for zero://self fixed point - Zero node initialization with automatic self-connection - New tools: zero_status, zero_connect, zero_handshake - PGlite extensions: pg_trgm, fuzzystrmatch, unaccent - Removed legacy shared handlers (consolidated) - Chrome MV3 extension scaffold - window.Zero API via postMessage bridge - Page context extraction and overlay UI - RFP Workflow using interaction combinators - Thermodynamic router for attractor-based routing - .mcp.minimal.json / .mcp.optimized.json profiles - MCP configuration guide and comparison docs - ZERO.md specification + ZERO.json schema Breaking: Removed src/server/handlers/shared/* (1,453 LOC) Version: 1.9.1 → 1.10.0 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat: Resonant Knowledge Mesh Integration - Refactored robustWebScraper.js into Signal-native UnifiedSearchMesh (1P first) - Evolved xmlParser.js into SignalParser for protocol alignment - Implemented KnowledgePipeline in core/rail/knowledge.js - Unified auth architecture with Supabase OAuth 2.1 PKCE - Fixed searchWeb and fetchUrl errors across tools and agents - Updated unit tests to match new dynamic provider configuration * feat: PGlite 0.3.14 upgrade with 16 extensions + payload optimization + model updates - Upgraded @electric-sql/pglite to 0.3.14 with full extension support - Enabled 16 extensions: vector, pgtap, pg_uuidv7, pg_ivm, bloom, cube, seg, tcn, tsm_system_time, ltree, lo, tablefunc, uuid_ossp, fuzzystrmatch, citext, hstore - Fixed TCN trigger setup (split multi-command prepared statements) - Added graceful database shutdown to prevent mutex lock errors - Implemented synthesis payload truncation to prevent 413 errors - Updated model IDs to latest: gpt-5-nano, gemini-3-flash-preview, claude-haiku-4.5 - Added ZeroReplay temporal analysis, StickyCluster agent grouping - Added MultimodalStorage for binary data, HierarchicalRoute for ltree routing - Added comprehensive extension tests and EXTENSIONS.md documentation * chore(release): bump version to 1.11.0 with updated README and CHANGELOG * fix: robust XML parsing with fallback and improved graceful shutdown - Add fallback extraction in xmlParser.js for non-XML LLM responses (handles numbered lists, bullet points, and question patterns) - Improve graceful shutdown in bin/zero with: - Shutdown state flag to prevent multiple attempts - Timeout race for stuck WASM instances - SIGINT/SIGTERM handlers - Post-close delay for WASM cleanup * v1.11.1: finalize mesh integration and core agentic logic * fix: remove .env.zero from repo and update .gitignore * feat: v1.12.0 - Graceful Degradation & Provider Telemetry - Implements multi-key rotation and cooldowns for OpenRouter - Adds streaming synthesis fallback for resilience - Introduces ProviderManager abstraction for future SDK alignment - Adds 'get_provider_health' tool and CLI status integration - Adds Operator's Handbook (UAT Guide) * feat(core): Isomorphic SDK Alignment - Code Review Fixes High Priority (H1-H3): - H1: SDK-compatible ok/err/isOk/isErr Result types in rail.js - H2: Layer addressing (L3:{type}:{id}) on Signal, Token, Rail - H3: Signal → AgentSignal rename with backward-compat alias Medium Priority (M2-M5): - M2: explain() introspection methods on core primitives - M3: Logger integration in skillLoader.js (replaces console.warn) - M4: toSDKMessage() adapter on AgentSignal - M5: Provider detection consolidated to ProviderRegistry Nitpick (N1-N5): - N1: ShapeHash already correct (deterministicStringify handles it) - N2: Model names from config.models.highCost/lowCost - N3: Critical degradation fallback implemented - N4: JSDoc with examples on coerceTypes - N5: getCognitiveRouter() factory with _resetInstance() All 47 tests passing. M1 (file naming) deferred as breaking change. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * security: Critical fixes for XSS, code injection, and timing attacks CRITICAL: - Fix DOM XSS via innerHTML - replaced with textContent/createElement - Add escapeHtml helper to mcpBridge for client-side escaping - Escape OAuth callback URL parameters (error, accessToken) HIGH: - Replace unsafe Function() constructor with safe recursive descent parser - Safe math evaluator: +, -, *, /, %, ^/**, parentheses, unary operators - Fix Signal.fromJSON to use AgentSignal class (not deprecated alias) MEDIUM: - Add timing-safe API key comparison using crypto.timingSafeEqual - Prevents timing attacks on authentication All 47 tests passing. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(core): Resurrect dbClient with unified L1-L5 architecture ## Summary - Rebuilt src/utils/dbClient.js from corrupted state - Unified PGLite infrastructure + Jobs API + HVM Signal (computeShapeHash) - Fixed duplicate batchResearchSchema/batchResearchTool in tools.js - Added null-safety for convergence.errorBreakdown ## Changes - dbClient.js: Complete rewrite with clean exports, proper async handling - tools.js: Removed duplicate definitions, fixed undefined slice error - db-jobs.test.js: Unit tests for Jobs API contract ## Verified - All 47 unit tests pass (core: 23, config: 14, auth: 10) - CLI loads and runs (help, status commands work) - Server components initialize correctly - Jobs API: createJob, appendJobEvent, getJobStatus all functional Part of Project Lazarus - L5 Protocol Bridge restoration * chore: remove CLI and private experiments for public release * chore: release v1.15.0 * feat(routing): Add embedding-based model routing with @terminals-tech packages Replace LLM-based query classification with local embedding similarity: - Add EmbeddingRouter for domain/complexity classification using seed phrase centroids - Wire SignalRouter into handlers for intent classification (chat/research/action) - ResearchAgent uses embedding-first with LLM fallback when confidence < 0.6 - Add ROUTING config section with embedding routing flags - Fix NaN validation in dbClient to prevent PGLite vector errors - Use @terminals-tech/embeddings for real transformer embeddings - Use @terminals-tech/graph for knowledge graph operations - Fix tokenizer dead code where ** was unreachable after * match Perf: Local embeddings avoid LLM round-trips for query classification Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: resolve db schema, api types, and security config * chore: release v1.16.0 — SDK upgrade, model roster, duplicate purge - Upgrade @modelcontextprotocol/sdk from ^1.21.1 to ^1.26.0 (ReDoS fix, shared transport security) - Update MCP_SPEC.STABLE to 2025-11-25 (AAIF governance), add SEP-990/SEP-991 - Add anthropic/claude-opus-4.6, openai/gpt-5.3-codex, deepseek/deepseek-v3.2 to model roster - Remove 80+ macOS Finder duplicate artifacts (git clean) - Remove dead thermodynamicRouter.ts (canonical JS at src/routing/index.js) - Add .gitignore patterns to prevent future duplicate artifacts - Simplify package.json files array to use docs/ directory glob - Add CHANGELOG entries for v1.13.0–v1.16.0 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: v2.0.0 — MCP SDK upgrade, Zod 4, Express 5, circuit breakers BREAKING CHANGES (internal): - MCP SDK 1.26.0 → 1.27.1 with registerTool/registerPrompt/registerResource APIs - Zod 3.22.4 → 4.3.6 (z.record() syntax, config schema pipe pattern) - Express 4.18.2 → 5.2.1 (async error handling, deprecated method removal) - SSE transport deprecated → Streamable HTTP is primary NEW: - Circuit breaker state machine (CLOSED/OPEN/HALF_OPEN) on API/DB/embedder - Exponential backoff with jitter via withRetry() - Model tier fallback on circuit trip - Prompts migrated to server.registerPrompt() (3 prompts) - Resources migrated to server.registerResource() (9 resources) - z.object() auto-wrapping in tool registration FIXED: - PGlite multi-statement SQL in DB fallback path (job_events, tool_observations, graph_nodes, graph_edges) - Corrupted ~/.zero/db recovery - npm audit critical/high vulnerabilities (fast-xml-parser, axios, tar) - Zod 4 z.record() single-arg breaking change - Zod 4 .default({}) nested schema resolution via pipe pattern Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: replace npm ci with npm install in workflows and include latest updates --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Claude <wheattoast11@users.noreply.github.com>
1 parent e8e6660 commit 1506d9f

229 files changed

Lines changed: 52544 additions & 4659 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/SESSION-CONTEXT.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Session Context - CLI Auth & Orchestrator Fixes
2+
3+
**Last Updated:** 2025-12-19T17:43:00Z
4+
**Session ID:** efce0d10-5bb1-474e-a57f-8593daf07f56
5+
6+
## Current State: WAITING FOR DEPLOYMENT
7+
8+
### Blocking Issue
9+
The terminals.tech Vercel deployment needs to complete with Attack Challenge Mode disabled.
10+
The CLI auth flow is hitting Vercel's Security Checkpoint (bot protection).
11+
12+
### Test Command (run after deployment)
13+
```bash
14+
zero login
15+
```
16+
17+
If still blocked, verify:
18+
1. Attack Challenge Mode is **Disabled** in Vercel Dashboard → Settings → Security
19+
2. Deployment completed: `vercel ls --prod` in terminals-landing-new
20+
3. Test endpoint directly:
21+
```bash
22+
curl -X POST https://terminals.tech/api/auth/cli/init \
23+
-H "Content-Type: application/json" \
24+
-d '{"session_id":"test123","public_key":"test"}' \
25+
-w "\n%{http_code}\n"
26+
```
27+
28+
---
29+
30+
## Completed Work
31+
32+
### 1. CLI Auth Module (ECDH Flow) - DONE
33+
Files created/modified:
34+
- `src/cli/auth/cliAuth.js` - **NEW** - Complete ECDH key exchange implementation
35+
- `src/cli/auth/providers.js` - Updated terminals provider to type: 'cli-auth'
36+
- `src/cli/auth/index.js` - Routes to cliAuth when provider type is 'cli-auth'
37+
- `src/cli/auth/tokenStore.js` - Saves credentials to `~/.zero/oauth_creds.json`
38+
39+
**Auth Flow:**
40+
```
41+
zero login
42+
→ auth.login({provider: 'terminals'})
43+
→ loginWithOAuth() detects type: 'cli-auth'
44+
→ startCliAuth() executes ECDH flow:
45+
1. Generate ECDH keypair + UUID session
46+
2. POST /api/auth/cli/init
47+
3. Open browser to /auth/cli?session=<uuid>
48+
4. Poll /api/auth/cli/status/<session_id>
49+
5. Decrypt token with ECDH shared secret
50+
6. Save credentials
51+
```
52+
53+
### 2. tmux Orchestrator Fixes - DONE
54+
Files modified:
55+
- `src/cli/orchestrator/core/pane.js` - `ensureTmuxServer()` creates socket directory
56+
- `src/cli/orchestrator/core/session.js` - Pre-flight checks before session creation
57+
58+
**Fix:** Socket directory `/tmp/tmux-<uid>` is now created with proper permissions (0o700)
59+
60+
---
61+
62+
## terminals.tech CLI Auth Endpoints
63+
64+
| Endpoint | Method | Purpose |
65+
|----------|--------|---------|
66+
| `/api/auth/cli/init` | POST | Initialize CLI auth session |
67+
| `/api/auth/cli/status/<session_id>` | GET | Poll for completion |
68+
| `/api/auth/cli/complete` | POST | Browser calls to complete auth |
69+
| `/auth/cli` | Page | Browser auth page |
70+
71+
Located in: `~/Documents/terminals-tech-landing/terminals-landing-new/`
72+
73+
---
74+
75+
## Next Steps After Deployment Works
76+
77+
1. **Test `zero login`** - Should open browser and complete ECDH auth
78+
2. **Verify token storage** - Check `~/.zero/oauth_creds.json`
79+
3. **Test authenticated commands** - `zero research "test query"`
80+
4. **Test `zero claude`** - tmux orchestrator should work now
81+
82+
---
83+
84+
## Key Files Reference
85+
86+
### CLI Auth
87+
```
88+
src/cli/auth/
89+
├── cliAuth.js # ECDH auth flow (NEW)
90+
├── index.js # Main auth module
91+
├── providers.js # Provider configs
92+
├── tokenStore.js # Credential storage
93+
├── oauth.js # OAuth PKCE flow
94+
└── deviceFlow.js # Device auth flow
95+
```
96+
97+
### Orchestrator
98+
```
99+
src/cli/orchestrator/
100+
├── index.js # Main orchestrator
101+
└── core/
102+
├── pane.js # tmux pane management
103+
└── session.js # Session lifecycle
104+
```
105+
106+
---
107+
108+
## Vercel Configuration Applied
109+
110+
1. **Attack Challenge Mode:** Should be set to **Disabled** (or "Suspicious only")
111+
2. **WAF Rules:** May have path-based bypass for `/api/auth/cli/*`
112+
3. **vercel.json:** May have headers for security bypass
113+
114+
The WAF rules alone don't bypass "system mitigations" - Attack Challenge Mode must be disabled project-wide.
Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
# MCP Async Research Workflow
1+
# MCP Async Research
22

3-
Submit a research query asynchronously and monitor progress.
3+
Submit research asynchronously. Returns job_id for tracking.
44

5-
## Instructions
5+
## Steps
66

7-
1. Submit the research using `mcp__openrouter-agents__research` with:
8-
- `query`: The user's research topic
9-
- `async`: true (will return a job_id)
10-
2. Note the job_id from the response
11-
3. Poll `mcp__openrouter-agents__job_status` with the job_id every few seconds
12-
4. When status shows "completed", extract the report ID from the result
13-
5. Retrieve the full report using `mcp__openrouter-agents__get_report`
14-
6. Present the findings with citations
7+
1. `research({ query: "$ARGUMENTS", async: true })` -> note `job_id`
8+
2. `job_status({ job_id: "<id>" })` -> check status
9+
3. When status="succeeded", extract `reportId` from response
10+
4. `get_report({ reportId: "<id>" })` -> full report
1511

16-
## Research Query
12+
## Key Points
13+
14+
- job_id format: `job_<timestamp>_<random>` (e.g., job_1234567890_abc123)
15+
- reportId format: numeric (e.g., "5", "42")
16+
- Do NOT pass job_id to get_report - extract reportId first
17+
- Real-time progress via SSE: `sse_url` in initial response
18+
19+
## Query
1720
$ARGUMENTS
Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
# MCP Batch Research
22

3-
Run multiple research queries in parallel using the OpenRouter Agents MCP server.
3+
Run multiple queries in parallel. Max 10.
44

5-
## Instructions
5+
## Steps
66

7-
1. Parse the user's input for multiple research topics (comma-separated or numbered list)
8-
2. Run batch research using `mcp__openrouter-agents__batch_research` with:
9-
- `queries`: Array of research queries
10-
- `waitForCompletion`: true (to get results immediately)
11-
- `costPreference`: "low" (default) or "high" for premium models
12-
3. Extract the report IDs from the result
13-
4. For each completed report, retrieve using `mcp__openrouter-agents__get_report`
14-
5. Present a consolidated summary comparing findings across all topics
7+
1. Parse topics (comma/newline separated)
8+
2. `batch_research({ queries: [...], waitForCompletion: true })`
9+
3. Extract `reportIds` from result
10+
4. `get_report({ reportId })` for each
11+
5. Compare findings
1512

16-
## Example Usage
13+
## Options
1714

18-
/mcp-batch-research "AI safety, quantum computing, climate tech"
19-
/mcp-batch-research topic1, topic2, topic3
15+
| Param | Default | Description |
16+
|-------|---------|-------------|
17+
| waitForCompletion | true | Block until all complete |
18+
| costPreference | "low" | "low" or "high" |
19+
| timeoutMs | 300000 | 5 min max wait |
2020

21-
## User's Research Topics
21+
## Example
22+
23+
Input: "AI safety, quantum computing, climate tech"
24+
-> queries: ["AI safety", "quantum computing", "climate tech"]
25+
26+
## Topics
2227
$ARGUMENTS
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Get Report from Job ID
2+
3+
Convert job_id to report. Single-command bridge.
4+
5+
## Steps
6+
7+
1. `job_status({ job_id: "$ARGUMENTS" })`
8+
2. If status="succeeded": extract `reportId` field
9+
3. `get_report({ reportId: "<extracted_id>" })`
10+
4. Present report
11+
12+
## ID Types
13+
14+
| Type | Format | Example |
15+
|------|--------|---------|
16+
| job_id | `job_<ts>_<rand>` | job_1234567890_abc123 |
17+
| reportId | numeric | 5, 42 |
18+
19+
## Common Errors
20+
21+
- "Invalid report ID format" -> You passed job_id instead of reportId
22+
- "Job not found" -> Job expired (1hr TTL) or invalid ID
23+
24+
## Job ID
25+
$ARGUMENTS

.claude/commands/mcp-query.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
# MCP SQL Query
22

3-
Execute a read-only SQL query against the MCP server database.
3+
Execute read-only SELECT queries.
44

5-
## Instructions
5+
## Steps
66

7-
1. Parse the user's intent and construct a safe SELECT query
8-
2. Execute using `mcp__openrouter-agents__query` with:
9-
- `sql`: The SELECT statement
10-
- `params`: Array of parameters for placeholders ($1, $2, etc.)
11-
- `explain`: true (to get natural language explanation)
12-
3. Present the results in a readable format
7+
1. `query({ sql: "<SELECT...>", params: [], explain: true })`
8+
2. Present results in table format
139

14-
## Common Tables
15-
- `research_reports`: id, query, final_report, rating, created_at
16-
- `jobs`: id, type, status, result, created_at
17-
- `doc_index`: id, source_type, title, content
10+
## Tables
1811

19-
## Query Request
12+
| Table | Key Columns |
13+
|-------|-------------|
14+
| research_reports | id, original_query, final_report, rating, created_at |
15+
| jobs | id, type, status, result, progress, created_at |
16+
| doc_index | source_type, source_id, title, content |
17+
18+
## Safety
19+
20+
- SELECT only (no INSERT/UPDATE/DELETE)
21+
- Use $1, $2 placeholders for params
22+
23+
## Query
2024
$ARGUMENTS

.claude/commands/mcp-research.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
1-
# MCP Research Workflow
1+
# MCP Research (Sync)
22

3-
Execute a research query using the OpenRouter Agents MCP server.
3+
Execute research synchronously. Streams results, returns reportId.
44

5-
## Instructions
5+
## Steps
66

7-
1. First check server health: `mcp__openrouter-agents__get_server_status`
8-
2. Run the research query provided by the user using `mcp__openrouter-agents__conduct_research` with:
9-
- `query`: The user's research topic
10-
- `costPreference`: "low" (default) or "high" for premium models
11-
- `outputFormat`: "report" (default), "briefing", or "bullet_points"
12-
3. Extract the report ID from the result
13-
4. Retrieve the full report using `mcp__openrouter-agents__get_report` with the reportId
14-
5. Present a summary of the findings to the user with key citations
7+
1. `get_server_status()` -> verify db/embedder ready
8+
2. `conduct_research({ query: "$ARGUMENTS", costPreference: "low" })`
9+
3. Note `reportId` from completion message
10+
4. `get_report({ reportId: "<id>" })` -> full content
1511

16-
## User's Research Query
12+
## Options
13+
14+
| Param | Values | Default |
15+
|-------|--------|---------|
16+
| costPreference | "low", "high" | low |
17+
| outputFormat | "report", "briefing", "bullet_points" | report |
18+
| audienceLevel | "beginner", "intermediate", "expert" | intermediate |
19+
20+
## Query
1721
$ARGUMENTS

.claude/commands/mcp-search.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1-
# MCP Knowledge Base Search
1+
# MCP Search
22

3-
Search the existing knowledge base for relevant information.
3+
Search existing knowledge base (reports + docs).
44

5-
## Instructions
5+
## Steps
66

7-
1. Use `mcp__openrouter-agents__search` with:
8-
- `q`: The user's search query
9-
- `k`: 10 (number of results)
10-
- `scope`: "both" (search reports and documents)
11-
2. Review the results and summarize relevant findings
12-
3. If the user wants more detail on a specific report, use `mcp__openrouter-agents__get_report` with the reportId
7+
1. `search({ q: "$ARGUMENTS", k: 10, scope: "both" })`
8+
2. Summarize matches with relevance scores
9+
3. For details: `get_report({ reportId: "<id>" })`
1310

14-
## Search Query
11+
## Options
12+
13+
| Param | Values | Default |
14+
|-------|--------|---------|
15+
| k | 1-100 | 10 |
16+
| scope | "both", "reports", "docs" | both |
17+
| rerank | true/false | false |
18+
19+
## Query
1520
$ARGUMENTS

.claude/commands/mcp-status.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
# MCP Server Status Check
1+
# MCP Status
22

3-
Perform a comprehensive health check of the OpenRouter Agents MCP server.
3+
Comprehensive server health check.
44

5-
## Instructions
5+
## Steps
66

7-
1. Run `mcp__openrouter-agents__ping` to verify basic connectivity
8-
2. Run `mcp__openrouter-agents__get_server_status` for full status
9-
3. Run `mcp__openrouter-agents__history` to see recent research reports
10-
4. Run `mcp__openrouter-agents__task_list` to see any active or recent tasks
11-
5. Present a summary including:
12-
- Server version and health
13-
- Database and embedder status
14-
- Job queue status (queued, running, succeeded, failed)
15-
- Recent research reports (last 5)
16-
- Any active tasks
7+
1. `ping()` -> basic connectivity
8+
2. `get_server_status()` -> db, embedder, jobs
9+
3. `history({ limit: 5 })` -> recent reports
10+
4. `task_list({ limit: 5 })` -> active jobs
11+
12+
## Key Indicators
13+
14+
| Component | Healthy State |
15+
|-----------|---------------|
16+
| database.initialized | true |
17+
| embedder.ready | true |
18+
| jobs.running | 0-5 normal |
19+
| jobs.failed | 0 ideal |

.claude/settings.json

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,6 @@
11
{
22
"permissions": {
3-
"allow": [
4-
"mcp__openrouter-agents__ping",
5-
"mcp__openrouter-agents__get_server_status",
6-
"mcp__openrouter-agents__list_tools",
7-
"mcp__openrouter-agents__date_time",
8-
"mcp__openrouter-agents__calc",
9-
"mcp__openrouter-agents__history",
10-
"mcp__openrouter-agents__sample_message",
11-
"mcp__openrouter-agents__research",
12-
"mcp__openrouter-agents__job_status",
13-
"mcp__openrouter-agents__conduct_research",
14-
"mcp__openrouter-agents__get_report",
15-
"mcp__openrouter-agents__task_list",
16-
"mcp__openrouter-agents__task_result",
17-
"mcp__openrouter-agents__search",
18-
"mcp__openrouter-agents__agent",
19-
"mcp__openrouter-agents__task_get"
20-
],
3+
"allow": [],
214
"deny": []
225
}
236
}

0 commit comments

Comments
 (0)