### Install and Start JARVIS Daemon Source: https://github.com/vierisid/jarvis/blob/main/README.md Install the JARVIS daemon globally using Bun and start it as a background daemon. Access the dashboard at http://localhost:3142 for initial setup. ```bash bun install -g @usejarvis/brain # Install the daemon jarvis start -d # Start as background daemon ``` -------------------------------- ### Configure LLM Providers Source: https://github.com/vierisid/jarvis/blob/main/docs/LLM_PROVIDERS.md Run the setup script to initialize the configuration directory, copy example configurations, and test provider connections. ```bash bun run setup ``` -------------------------------- ### Install JARVIS Daemon with Bun Source: https://github.com/vierisid/jarvis/blob/main/README.md Installs the JARVIS daemon globally using Bun. After installation, start the daemon and complete the setup through the web dashboard. ```bash bun install -g @usejarvis/brain jarvis start ``` -------------------------------- ### Install and Run Ollama Source: https://github.com/vierisid/jarvis/blob/main/docs/LLM_PROVIDERS.md Commands to install Ollama on your system, pull a specific model, and start the Ollama server. ```bash # Install Ollama curl -fsSL https://ollama.ai/install.sh | sh # Pull a model ollama pull llama3 # Start server ollama serve ``` -------------------------------- ### Manual Installation of JARVIS Daemon Source: https://github.com/vierisid/jarvis/blob/main/README.md Manually installs the JARVIS daemon by cloning the repository, installing dependencies with Bun, building the UI, and starting the daemon. ```bash git clone https://github.com/vierisid/jarvis.git ~/.jarvis/daemon cd ~/.jarvis/daemon bun install bun run build:ui jarvis start ``` -------------------------------- ### Copy Example Configuration File Source: https://github.com/vierisid/jarvis/blob/main/src/config/README.md Copies the example configuration file to the user's home directory. This is the first step in setting up the application. ```bash mkdir -p ~/.jarvis cp config.example.yaml ~/.jarvis/config.yaml ``` -------------------------------- ### Running a Complete Observer Example Source: https://github.com/vierisid/jarvis/blob/main/src/observers/README.md Command to execute a full working example of the observer layer, which runs all observers for a set duration and logs events. ```bash bun run src/observers/example.ts ``` -------------------------------- ### Error Handling Example: Missing Dependencies Source: https://github.com/vierisid/jarvis/blob/main/src/actions/README.md Illustrates how errors are thrown when dependencies are missing, including installation instructions within the error message. ```typescript try { await controller.captureScreen(); } catch (error) { // Error includes installation instructions: // "No screenshot tool found. Please install one: // ImageMagick: sudo apt install imagemagick // Scrot: sudo apt install scrot" } ``` -------------------------------- ### Install J.A.R.V.I.S. Dependencies Source: https://github.com/vierisid/jarvis/blob/main/QUICKSTART.md Navigate to the J.A.R.V.I.S. project directory and install its dependencies using Bun. ```bash cd ~/jarvis bun install ``` -------------------------------- ### Install JARVIS with One-liner Script Source: https://github.com/vierisid/jarvis/blob/main/README.md Installs JARVIS by downloading and executing a script. This method sets up Bun, clones the repository, and links the CLI. It is suitable for macOS, Linux, and WSL. ```bash curl -fsSL https://raw.githubusercontent.com/vierisid/jarvis/main/install.sh | bash jarvis start ``` -------------------------------- ### Run J.A.R.V.I.S. LLM Integration Example Source: https://github.com/vierisid/jarvis/blob/main/QUICKSTART.md Execute the example script to demonstrate various LLM functionalities including chat, streaming, function calling, and provider fallback. ```bash bun run examples/llm-integration.ts ``` -------------------------------- ### Initialize and Use Personality Engine Source: https://github.com/vierisid/jarvis/blob/main/src/personality/README.md Quick start example demonstrating initialization, interaction processing, and prompt generation using the Personality Engine's public API. ```typescript import { initDatabase } from '@/vault/schema'; import { getPersonality, savePersonality, extractSignals, applySignals, recordInteraction, personalityToPrompt, } from '@/personality'; // Initialize database initDatabase('./data/jarvis.db'); // Process a user interaction let personality = getPersonality(); const signals = extractSignals("Keep it brief", "Sure!"); personality = applySignals(personality, signals); personality = recordInteraction(personality); savePersonality(personality); // Generate LLM prompt const prompt = personalityToPrompt(personality); ``` -------------------------------- ### Start WebSocket Server Only (Bash) Source: https://github.com/vierisid/jarvis/blob/main/src/comms/README.md Command to run the WebSocket server independently for testing or basic real-time communication setup. ```bash bun run src/comms/example.ts ``` -------------------------------- ### Start Ollama Daemon Source: https://github.com/vierisid/jarvis/blob/main/QUICKSTART.md If Ollama is not available, start its daemon process using the `ollama serve` command. ```bash ollama serve ``` -------------------------------- ### Install and Initialize Security Test Site Source: https://github.com/vierisid/jarvis/blob/main/src/sites/fixtures/security-test-site/README.md Steps to copy, install, and initialize the security test site within the Jarvis projects directory. Ensure you are in the project's root directory before running these commands. ```shell cp -r src/sites/fixtures/security-test-site ~/.jarvis/projects/security-test cd ~/.jarvis/projects/security-test bun install git init && git add -A && git commit -m "init" ``` -------------------------------- ### Screenshot Active Window Example Source: https://github.com/vierisid/jarvis/blob/main/src/actions/README.md Captures the active window using the App Controller and saves it as 'screenshot.png'. Requires appropriate screenshot tools to be installed. ```typescript import { getAppController } from '@/actions'; async function screenshotActiveWindow() { const controller = getAppController(); const activeWindow = await controller.getActiveWindow(); console.log(`Capturing: ${activeWindow.title}`); const screenshot = await controller.captureWindow(activeWindow.pid); await Bun.write('screenshot.png', screenshot); console.log('Saved screenshot.png'); } screenshotActiveWindow(); ``` -------------------------------- ### Start WebSocket Server Source: https://github.com/vierisid/jarvis/blob/main/src/comms/README.md Initializes and starts a local WebSocket server for real-time bidirectional communication with web clients. Handles incoming messages and client connections/disconnections. ```typescript import { WebSocketServer } from './comms'; const wsServer = new WebSocketServer(3142); wsServer.setHandler({ async onMessage(msg) { console.log('Received:', msg.type, msg.payload); return { type: 'status', payload: 'Acknowledged', timestamp: Date.now() }; }, onConnect() { console.log('Client connected'); }, onDisconnect() { console.log('Client disconnected'); }, }); wsServer.start(); ``` -------------------------------- ### J.A.R.V.I.S. Daemon Integration Example Source: https://github.com/vierisid/jarvis/blob/main/src/comms/README.md Demonstrates how to integrate various communication channels with the J.A.R.V.I.S. Daemon. This example sets up a WebSocket server, a channel manager, and an LLM router to handle incoming messages, process them, and relay responses. ```typescript // In daemon/index.ts import { WebSocketServer, ChannelManager, TelegramAdapter, StreamRelay } from './comms'; import { LLMRouter } from './llm'; const wsServer = new WebSocketServer(); const channels = new ChannelManager(); const streamRelay = new StreamRelay(wsServer); const llmRouter = new LLMRouter(); // Unified message handler channels.setHandler(async (message) => { // Route to appropriate LLM provider const stream = await llmRouter.route(message.text, { stream: true }); // Relay stream to WebSocket clients const response = await streamRelay.relayStream(stream, message.id); // Return response to original channel return response; }); // Start everything wsServer.start(); if (process.env.TELEGRAM_BOT_TOKEN) { channels.register(new TelegramAdapter(process.env.TELEGRAM_BOT_TOKEN)); } await channels.connectAll(); ``` -------------------------------- ### Run Gated Install Integration Test Source: https://github.com/vierisid/jarvis/blob/main/src/workflows/pieces-library/README.md Executes an integration test that simulates a real 'bun install' of a catalog entry and verifies the published bundle can be required and has the expected piece object shape. ```sh JARVIS_TEST_PIECES_LIBRARY=1 bun test src/workflows/pieces-library/integration.test.ts ``` -------------------------------- ### Install JARVIS Sidecar via Bun Source: https://github.com/vierisid/jarvis/blob/main/README.md Installs the JARVIS sidecar agent globally using the Bun package manager. ```bash bun install -g @usejarvis/sidecar ``` -------------------------------- ### Tool Registry Example Source: https://github.com/vierisid/jarvis/blob/main/src/actions/README.md Demonstrates how to define, register, and execute tools using the ToolRegistry. Includes parameter validation and querying the registry. ```typescript import { ToolRegistry, type ToolDefinition } from '@/actions'; const registry = new ToolRegistry(); // Define a tool const searchTool: ToolDefinition = { name: 'search_files', description: 'Search for files by pattern', category: 'filesystem', parameters: { pattern: { type: 'string', description: 'Search pattern (glob)', required: true, }, directory: { type: 'string', description: 'Directory to search', required: false, }, }, execute: async (params) => { const pattern = params.pattern as string; const dir = (params.directory as string) || '.'; // Implementation here return { found: [] }; }, }; // Register tool registry.register(searchTool); // Execute tool const result = await registry.execute('search_files', { pattern: '*.ts', directory: '/src', }); // Query registry console.log(registry.list('filesystem')); console.log(registry.getCategories()); console.log(registry.count()); ``` -------------------------------- ### Recreate J.A.R.V.I.S. Configuration File Source: https://github.com/vierisid/jarvis/blob/main/QUICKSTART.md If the configuration file is missing, recreate it by copying the example configuration file to the default location. ```bash cp config.example.yaml ~/.jarvis/config.yaml ``` -------------------------------- ### Create and Edit J.A.R.V.I.S. Configuration Source: https://github.com/vierisid/jarvis/blob/main/QUICKSTART.md Create the configuration directory and copy the example configuration file. Then, edit the file to add your LLM provider API keys. ```bash # Create config directory mkdir -p ~/.jarvis # Copy example config cp config.example.yaml ~/.jarvis/config.yaml # Edit config with your API keys nano ~/.jarvis/config.yaml ``` -------------------------------- ### Manual Testing Commands Source: https://github.com/vierisid/jarvis/blob/main/docs/LLM_PROVIDERS.md Commands for manual testing and running LLM-related functionalities and examples. ```bash # Setup config and test providers bun run setup # Test LLM functionality bun run test:llm # Run integration examples bun run examples ``` -------------------------------- ### Implement a New Service for J.A.R.V.I.S. Daemon Source: https://github.com/vierisid/jarvis/blob/main/src/daemon/README.md Example of creating a new service by implementing the Service interface and registering it with the daemon. ```typescript // src/observers/file-observer.ts import type { Service, ServiceStatus } from '../daemon/services.ts'; export class FileObserver implements Service { name = 'file-observer'; private watcher: FSWatcher | null = null; private _status: ServiceStatus = 'stopped'; async start(): Promise { this._status = 'starting'; // Set up file watching this._status = 'running'; } async stop(): Promise { this._status = 'stopping'; this.watcher?.close(); this._status = 'stopped'; } status(): ServiceStatus { return this._status; } } // Register in src/daemon/index.ts import { FileObserver } from '../observers/file-observer.ts'; registry.register(new FileObserver()); ``` -------------------------------- ### Run J.A.R.V.I.S. Daemon with Custom Configuration Source: https://github.com/vierisid/jarvis/blob/main/src/daemon/README.md Start the daemon with specified port and data directory. ```bash bun run src/daemon/index.ts --port 3142 --data-dir ~/my-jarvis-data ``` -------------------------------- ### Start with Telegram Integration (Bash) Source: https://github.com/vierisid/jarvis/blob/main/src/comms/README.md Command to run the communication layer with Telegram integration enabled. Requires setting the TELEGRAM_BOT_TOKEN environment variable. ```bash export TELEGRAM_BOT_TOKEN="your_bot_token" bun run src/comms/example.ts ``` -------------------------------- ### Pieces Library Directory Structure Source: https://github.com/vierisid/jarvis/blob/main/src/workflows/pieces-library/README.md Illustrates the file system layout within the ~/.jarvis/pieces directory after installing a few pieces. This includes the source of truth for installed pieces, synthesized package.json, bun lock file, and the node_modules directory containing the installed pieces and their dependencies. ```bash ~/.jarvis/pieces/ installed.json # source of truth: {id, npmPackage, versionRange, resolvedVersion, installedAt} package.json # synthesized from installed.json on each install/uninstall bun.lock # bun's resolution lock node_modules/ @activepieces/piece-gmail/ # the piece itself; main: ./src/index.js package.json src/index.js # pre-built JS shipped by npm publish @activepieces/piece-slack/ googleapis/ # transitive deps deduped here @slack/web-api/ ... ``` -------------------------------- ### Start J.A.R.V.I.S. Daemon Programmatically Source: https://github.com/vierisid/jarvis/blob/main/src/daemon/README.md Initiate the daemon's operation with custom configuration parameters. ```typescript import { startDaemon } from './src/daemon/index.ts'; await startDaemon({ port: 3142, dataDir: '/path/to/data', dbPath: '/path/to/jarvis.db', healthCheckInterval: 30000, // 30 seconds }); ``` -------------------------------- ### Initialize and Start J.A.R.V.I.S. Health Monitor Source: https://github.com/vierisid/jarvis/blob/main/src/daemon/README.md Instantiate the HealthMonitor and begin periodic health checks. ```typescript import { HealthMonitor } from './src/daemon/health.ts'; const monitor = new HealthMonitor(registry, dbPath); monitor.start(30000); // Check every 30 seconds ``` -------------------------------- ### Run JARVIS Sidecar (Subsequent) Source: https://github.com/vierisid/jarvis/blob/main/README.md Starts the JARVIS sidecar agent after it has been previously enrolled and saved its token locally. ```bash jarvis-sidecar ``` -------------------------------- ### Custom Provider Implementation Example Source: https://github.com/vierisid/jarvis/blob/main/docs/LLM_PROVIDERS.md Provides a template for creating a custom LLM provider by extending the base interface. ```typescript import type { LLMProvider, LLMMessage, LLMResponse } from './provider.ts'; export class CustomProvider implements LLMProvider { name = 'custom'; async chat(messages: LLMMessage[]): Promise { // Your implementation } async *stream(messages: LLMMessage[]) { // Your streaming implementation } async listModels(): Promise { return ['model1', 'model2']; } } ``` -------------------------------- ### Jarvis Configuration File Source: https://github.com/vierisid/jarvis/blob/main/docs/LLM_PROVIDERS.md Example structure of the Jarvis configuration file, detailing settings for daemon, LLM providers, personality, and authority. ```yaml daemon: port: 7777 data_dir: "~/.jarvis" db_path: "~/.jarvis/jarvis.db" llm: primary: "anthropic" fallback: ["openai", "ollama"] anthropic: api_key: "sk-ant-..." model: "claude-sonnet-4-5-20250929" openai: api_key: "sk-..." model: "gpt-4o" ollama: base_url: "http://localhost:11434" model: "llama3" personality: core_traits: - "loyal" - "efficient" - "proactive" - "respectful" - "adaptive" authority: default_level: 3 active_role: "default" ``` -------------------------------- ### Test J.A.R.V.I.S. LLM Setup Source: https://github.com/vierisid/jarvis/blob/main/QUICKSTART.md Run the test script to verify that the LLM configuration is loaded correctly, providers are registered, and a test chat response can be generated. ```bash bun run src/llm/test.ts ``` -------------------------------- ### Initialize Voice I/O Providers Source: https://github.com/vierisid/jarvis/blob/main/src/comms/README.md Sets up Speech-to-Text (STT) using Whisper.cpp and Text-to-Speech (TTS) with ElevenLabs. Requires specific local setups or API keys. ```typescript import { WhisperSTT, LocalTTS } from './comms'; // STT - requires whisper.cpp setup const stt = new WhisperSTT('http://localhost:8080'); // const text = await stt.transcribe(audioBuffer); // TTS - requires ElevenLabs API or local TTS const tts = new LocalTTS({ provider: 'elevenlabs', apiKey: '...' }); // const audio = await tts.synthesize('Hello world'); ``` -------------------------------- ### Update JARVIS via install.sh Source: https://github.com/vierisid/jarvis/blob/main/README.md Manual update steps for JARVIS installed via the install.sh script. ```bash git pull --ff-only bun install ``` -------------------------------- ### Run JARVIS Sidecar with Token Source: https://github.com/vierisid/jarvis/blob/main/README.md Starts the JARVIS sidecar agent using an enrollment token. The token is saved locally for subsequent runs. ```bash jarvis-sidecar --token ``` -------------------------------- ### Automate Browser Example Source: https://github.com/vierisid/jarvis/blob/main/src/actions/README.md Demonstrates automating browser actions like navigating to a URL and retrieving the page title using BrowserSession. Ensures connection and disconnects afterwards. ```typescript import { BrowserSession } from '@/actions'; async function automateSearch() { const session = new BrowserSession(); await session.ensureConnected(); const browser = session.getBrowser(); const tabs = await browser.listTabs(); const tabId = tabs[0]?.id; if (!tabId) { throw new Error('No tabs found'); } await browser.navigate(tabId, 'https://google.com'); const title = await browser.evaluate(tabId, 'document.title'); console.log('Page title:', title); await session.disconnect(); } automateSearch(); ``` -------------------------------- ### Context Graph Entity Linking Example Source: https://github.com/vierisid/jarvis/blob/main/VISION.md Illustrates how activity nodes are linked to entities within the vault, showing relationships like application, file, action, and related concepts. ```text Activity ──references──► Entity(jarvis) │ │ ├─ app: VS Code ├─ type: project ├─ file: orchestrator.ts ├─ related: TypeScript └─ action: editing └─ owner: user ``` -------------------------------- ### Manual LLM Prompt and Parsing Source: https://github.com/vierisid/jarvis/blob/main/docs/VAULT_EXTRACTOR.md Advanced usage example for manually building a prompt, sending it to a custom LLM, and then parsing the response. Useful for fine-grained control over the extraction process. ```typescript import { buildExtractionPrompt } from '@/vault'; // Build custom prompt const prompt = buildExtractionPrompt(userMsg, assistantMsg); // Call your LLM const response = await myLLM.chat([{ role: 'user', content: prompt }]); // Parse response const result = parseExtractionResponse(response.content); ``` -------------------------------- ### Basic JARVIS Daemon Commands Source: https://github.com/vierisid/jarvis/blob/main/README.md Provides essential commands for managing the JARVIS daemon, including starting, stopping, checking status, and viewing logs. ```bash jarvis start # Start in foreground jarvis start -d # Start as background daemon jarvis start --port 3142 # Start on a specific port jarvis stop # Stop the daemon jarvis status # Check if running jarvis doctor # Verify environment & connectivity jarvis logs -f # Follow live logs ``` -------------------------------- ### Multi-Provider LLM Setup with Fallback Source: https://github.com/vierisid/jarvis/blob/main/docs/LLM_PROVIDERS.md Registers multiple LLM providers (Anthropic, OpenAI, Ollama) and configures a primary provider with a fallback chain for resilience. ```typescript const manager = new LLMManager(); // Register multiple providers manager.registerProvider(new AnthropicProvider('sk-ant-...')); manager.registerProvider(new OpenAIProvider('sk-...')); manager.registerProvider(new OllamaProvider()); // Configure fallback chain manager.setPrimary('anthropic'); manager.setFallbackChain(['openai', 'ollama']); // Will automatically try fallbacks if primary fails const response = await manager.chat(messages); ``` -------------------------------- ### WSL File Transfer Example Source: https://github.com/vierisid/jarvis/blob/main/src/actions/README.md Copies a file from the WSL environment to the Windows file system using WSLBridge. Includes a check to ensure the script is running within WSL. ```typescript import { WSLBridge, TerminalExecutor } from '@/actions'; async function copyToWindows() { if (!WSLBridge.isWSL()) { throw new Error('Not running in WSL'); } const bridge = new WSLBridge(); const executor = new TerminalExecutor(); // Copy file from WSL to Windows const wslFile = '/home/user/data.json'; const winPath = await bridge.convertToWindowsPath(wslFile); await bridge.runPowerShell( `Copy-Item "${winPath}" "C:\\Users\\Public\\data.json" ` ); console.log('File copied to Windows'); } copyToWindows(); ``` -------------------------------- ### Basic Setup and Provider Registration Source: https://github.com/vierisid/jarvis/blob/main/src/llm/README.md Initialize the LLMManager and register different LLM providers (Anthropic, OpenAI, Ollama) with their API keys and default models. Set the primary provider and a chain of fallback providers. ```typescript import { LLMManager, AnthropicProvider, OpenAIProvider, OllamaProvider } from './llm/index.ts'; const manager = new LLMManager(); // Register providers const anthropic = new AnthropicProvider('sk-ant-...', 'claude-sonnet-4-5-20250929'); manager.registerProvider(anthropic); const openai = new OpenAIProvider('sk-...', 'gpt-4o'); manager.registerProvider(openai); const ollama = new OllamaProvider('http://localhost:11434', 'llama3'); manager.registerProvider(ollama); // Set primary and fallbacks manager.setPrimary('anthropic'); manager.setFallbackChain(['openai', 'ollama']); ``` -------------------------------- ### Example Extracted Knowledge JSON Source: https://github.com/vierisid/jarvis/blob/main/docs/VAULT_EXTRACTOR.md An example of the structured knowledge extracted from a conversation, including entities, facts, relationships, and commitments. ```json { "entities": [ { "name": "Anna", "type": "person" }, { "name": "Google", "type": "tool" } ], "facts": [ { "subject": "Anna", "predicate": "birthday_is", "object": "March 15", "confidence": 1.0 }, { "subject": "Anna", "predicate": "works_at", "object": "Google", "confidence": 1.0 } ], "relationships": [ { "from": "User", "to": "Anna", "type": "sister_of" }, { "from": "Anna", "to": "Google", "type": "works_at" } ], "commitments": [ { "what": "Remind about Anna's birthday", "when_due": "2026-03-14T09:00:00Z" } ] } ``` -------------------------------- ### Run Development Commands with Bun Source: https://github.com/vierisid/jarvis/blob/main/README.md Execute tests, hot-reload the daemon, rebuild the UI, or initialize the database using Bun commands. ```bash bun test # Run all tests (379 tests across 22 files) bun run dev # Hot-reload daemon bun run build:ui # Rebuild dashboard bun run db:init # Initialize or reset the database ``` -------------------------------- ### Set Up Data Directory Source: https://github.com/vierisid/jarvis/blob/main/src/config/README.md Ensures the application's data directory exists, creating it if necessary. Logs the data directory and database path. ```typescript import { mkdir } from 'node:fs/promises'; import { loadConfig } from './config/index.ts'; const config = await loadConfig(); // Ensure data directory exists await mkdir(config.daemon.data_dir, { recursive: true }); console.log(`Data directory: ${config.daemon.data_dir}`); console.log(`Database path: ${config.daemon.db_path}`); ``` -------------------------------- ### Bun Smoke Test for Piece Installation Source: https://github.com/vierisid/jarvis/blob/main/src/workflows/pieces-library/README.md Verifies that a piece can be installed using Bun and that its core functions are accessible. This is a crucial step in the verification process. ```sh mkdir /tmp/piece-spike && cd /tmp/piece-spike echo '{"name":"spike","private":true}' > package.json bun add @activepieces/piece-@^ bun -e 'const p = require("@activepieces/piece-"); console.log(Object.keys(p));' ``` -------------------------------- ### Community Pieces Source: https://github.com/vierisid/jarvis/blob/main/docs/WORKFLOW_AUTOMATION.md Endpoints for managing community-contributed pieces, including catalog browsing, installation, and uninstallation. ```APIDOC ## GET /api/workflows/pieces ### Description Retrieves an engine-extracted catalog of available pieces. ### Method GET ### Endpoint /api/workflows/pieces ### Response #### Success Response (200) - **pieces** (array) - A list of available piece objects. ### Response Example { "pieces": [ { "id": "gmail", "name": "Gmail" } ] } ``` ```APIDOC ## GET /api/workflows/pieces/library ### Description Retrieves a catalog of installable community pieces. ### Method GET ### Endpoint /api/workflows/pieces/library ### Response #### Success Response (200) - **communityPieces** (array) - A list of installable community piece objects. ### Response Example { "communityPieces": [ { "id": "slack", "name": "Slack" } ] } ``` ```APIDOC ## POST /api/workflows/pieces/library/:id/install ### Description Installs or updates a community piece. ### Method POST ### Endpoint /api/workflows/pieces/library/:id/install ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the community piece to install or update. ### Response #### Success Response (200) Indicates successful installation or update. ``` ```APIDOC ## DELETE /api/workflows/pieces/library/:id ### Description Uninstalls a community piece. ### Method DELETE ### Endpoint /api/workflows/pieces/library/:id ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the community piece to uninstall. ### Response #### Success Response (200) Indicates successful uninstallation. ``` -------------------------------- ### Uninstall JARVIS via Bun Source: https://github.com/vierisid/jarvis/blob/main/README.md Use this command to uninstall JARVIS when installed globally with Bun. ```bash bun uninstall -g @usejarvis/brain ``` -------------------------------- ### Display J.A.R.V.I.S. Daemon Help Options Source: https://github.com/vierisid/jarvis/blob/main/src/daemon/README.md View all available command-line options for the daemon. ```bash bun run src/daemon/index.ts --help ``` -------------------------------- ### Basic LLMManager Usage in TypeScript Source: https://github.com/vierisid/jarvis/blob/main/QUICKSTART.md Demonstrates how to load configuration, register LLM providers (Anthropic, OpenAI, Ollama), set primary and fallback providers, and make a chat request. ```typescript import { loadConfig, } from './src/config/index.ts'; import { LLMManager, AnthropicProvider, OpenAIProvider, OllamaProvider, } from './src/llm/index.ts'; // Load config and initialize const config = await loadConfig(); const manager = new LLMManager(); // Register providers if (config.llm.anthropic?.api_key) { manager.registerProvider( new AnthropicProvider( config.llm.anthropic.api_key, config.llm.anthropic.model ) ); } manager.setPrimary(config.llm.primary); manager.setFallbackChain(config.llm.fallback); // Use it const response = await manager.chat([ { role: 'user', content: 'Hello!' } ]); console.log(response.content); ``` -------------------------------- ### Update JARVIS via Bun Source: https://github.com/vierisid/jarvis/blob/main/README.md Use this command to update JARVIS when installed globally with Bun. ```bash bun update -g @usejarvis/brain ``` -------------------------------- ### Initialize and Use LLMManager Source: https://github.com/vierisid/jarvis/blob/main/docs/LLM_PROVIDERS.md Load configuration, instantiate the LLMManager, register an AnthropicProvider, and send a chat message. ```typescript import { loadConfig } from './src/config/index.ts'; import { LLMManager, AnthropicProvider } from './src/llm/index.ts'; const config = await loadConfig(); const manager = new LLMManager(); manager.registerProvider( new AnthropicProvider(config.llm.anthropic.api_key) ); const response = await manager.chat([ { role: 'user', content: 'Hello!' } ]); console.log(response.content); ``` -------------------------------- ### Personality Configuration Schema Source: https://github.com/vierisid/jarvis/blob/main/src/config/README.md Defines the schema for core personality traits that guide J.A.R.V.I.S. behavior. ```typescript personality: { core_traits: string[]; // Array of personality traits } ``` -------------------------------- ### Use Default Configuration Source: https://github.com/vierisid/jarvis/blob/main/src/config/README.md Obtains a fresh copy of the default configuration settings. ```typescript import { DEFAULT_CONFIG } from './config/index.ts'; // Get a fresh copy of defaults const config = { ...DEFAULT_CONFIG }; ``` -------------------------------- ### Get Formatted J.A.R.V.I.S. Health Report Source: https://github.com/vierisid/jarvis/blob/main/src/daemon/README.md Obtain a human-readable formatted report of the daemon's health status. ```typescript console.log(monitor.formatHealth()); ``` -------------------------------- ### Build Workflows Command Source: https://github.com/vierisid/jarvis/blob/main/docs/PIECE_VERIFICATION.md Demonstrates the command to build all Jarvis pieces and its expected output, including caching information. ```bash bun run build:workflows # expected output: # built @jarvispieces/piece-jarvis-@0.0.1 # bundle: /home//.jarvis/cache/pieces///dist/src/index.js ``` -------------------------------- ### Telegram Bot Token Environment Variable Source: https://github.com/vierisid/jarvis/blob/main/src/comms/README.md Example format for the required TELEGRAM_BOT_TOKEN environment variable used for Telegram integration. ```env TELEGRAM_BOT_TOKEN=1234567890:ABCdefGHIjklMNOpqrsTUVwxyz ``` -------------------------------- ### Handle general suggestion interaction Source: https://github.com/vierisid/jarvis/blob/main/ui/overlay.html Provides general options for interacting with a suggestion, allowing the user to get more information or dismiss it. ```javascript // General / break / cloud insight return [ { label: 'Tell me more', style: 'primary', handler: (t, btn) => { sendChat(`Tell me more about: ${t.title}. ${t.body.slice(0, 100)}`); actOnSuggestion(t.id); btn.textContent = 'Sent!'; btn.className = 'tip-btn sent'; } }, { label: 'Got it', style: 'secondary', handler: (t, btn) => { dismissSuggestion(t.id); removeTip(btn.closest('.tip')); } }, ]; ``` -------------------------------- ### Define Service Interface for J.A.R.V.I.S. Daemon Source: https://github.com/vierisid/jarvis/blob/main/src/daemon/README.md Defines the contract for services managed by the daemon, including start, stop, and status methods. ```typescript export interface Service { name: string; start(): Promise; stop(): Promise; status(): ServiceStatus; } ``` -------------------------------- ### Rate Limiting Implementation Source: https://github.com/vierisid/jarvis/blob/main/docs/LLM_PROVIDERS.md Example of implementing rate limiting to control the frequency of API requests, ensuring adherence to service limits. ```typescript class RateLimitedManager extends LLMManager { private lastRequest = 0; private minInterval = 1000; // 1 second async chat(messages, options?) { const now = Date.now(); const wait = this.minInterval - (now - this.lastRequest); if (wait > 0) await new Promise(r => setTimeout(r, wait)); this.lastRequest = Date.now(); return super.chat(messages, options); } } ``` -------------------------------- ### Test J.A.R.V.I.S. Daemon Startup and Shutdown Source: https://github.com/vierisid/jarvis/blob/main/src/daemon/README.md Run the daemon for a limited time to verify its startup sequence and graceful shutdown. ```bash # Start daemon and let it run for 3 seconds timeout 3 bun run src/daemon/index.ts --data-dir /tmp/test-jarvis ``` -------------------------------- ### Handle 'stuck' suggestion interaction Source: https://github.com/vierisid/jarvis/blob/main/ui/overlay.html Provides options for a user who is 'stuck' in an application. Includes actions to get help or dismiss the suggestion. ```javascript if (type === 'stuck') { return [ { label: 'Help me', style: 'primary', handler: (t, btn) => { const appName = t.context?.appName || ''; const windowTitle = t.context?.windowTitle || ''; sendChat(`I'm stuck in ${appName} (${windowTitle}). Can you help me figure out what to do next?`); actOnSuggestion(t.id); btn.textContent = 'On it!'; btn.className = 'tip-btn sent'; } }, { label: "I'm fine", style: 'secondary', handler: (t, btn) => { dismissSuggestion(t.id); removeTip(btn.closest('.tip')); } }, ]; } ``` -------------------------------- ### Run Channel Integration Tests (Bash) Source: https://github.com/vierisid/jarvis/blob/main/src/comms/README.md Command to execute the unit tests for the various messaging channel adapters. ```bash bun test src/comms/channels.test.ts ``` -------------------------------- ### Get J.A.R.V.I.S. Health Status Source: https://github.com/vierisid/jarvis/blob/main/src/daemon/README.md Retrieve the current health status of the daemon, including uptime, services, memory, and database connection. ```typescript const health = monitor.getHealth(); console.log(health); // { // uptime: 120, // services: { core: 'running', observers: 'running' }, // memory: { heapUsed: 1048576, heapTotal: 2097152, rss: 45678912 }, // database: { connected: true, size: 4096 }, // startedAt: 1708644000000 // } ``` -------------------------------- ### Initialize WebSocket Connection and Handlers Source: https://github.com/vierisid/jarvis/blob/main/ui/overlay.html Establishes a WebSocket connection and defines handlers for open, close, error, and message events. Includes logic for reconnecting on close and parsing incoming messages for proactive chat and awareness suggestions. ```javascript const WS_RECONNECT_MS = 3000; const CONTEXT_POLL_MS = 5000; const TIP_DISPLAY_MS = 60000; let ws = null; let contextTimer = null; let tipDismissTimer = null; let lastTipContext = null; function connectWS() { const protocol = location.protocol === 'https:' ? 'wss:' : 'ws:'; ws = new WebSocket(`${protocol}//${location.host}/ws`); ws.onopen = () => { setStatus(true); pollContext(); }; ws.onclose = () => { setStatus(false); setTimeout(connectWS, WS_RECONNECT_MS); }; ws.onerror = () => setStatus(false); ws.onmessage = (event) => { if (event.data instanceof ArrayBuffer) return; try { const msg = JSON.parse(event.data); // Proactive chat messages (suggestions + error solutions) if (msg.type === 'chat' && msg.payload?.source === 'proactive') { const title = extractTitle(msg.payload.text); const body = extractBody(msg.payload.text); const isError = msg.priority === 'urgent' || title.toLowerCase().includes('error') || title.toLowerCase().includes('fix'); showTip({ id: msg.id, title, body, type: isError ? 'error' : 'general', context: msg.payload, }); } // Awareness suggestion events (more structured) if (msg.type === 'notification' && msg.payload?.source === 'awareness_event') { const ev = msg.payload.event; if (ev?.type === 'suggestion_ready') { showTip({ id: ev.data.id, title: ev.data.title, body: ev.data.body, type: ev.data.type || 'general', context: ev.data, }); } } } catch { /* ignore */ } }; } ``` -------------------------------- ### Configure Ollama Local Provider Source: https://github.com/vierisid/jarvis/blob/main/QUICKSTART.md Set up J.A.R.V.I.S. to use Ollama for local LLM inference. This requires installing Ollama and pulling a model. ```yaml llm: primary: "ollama" fallback: [] ollama: base_url: "http://localhost:11434" model: "llama3" ``` -------------------------------- ### Poll User Context Source: https://github.com/vierisid/jarvis/blob/main/ui/overlay.html Initiates and manages periodic fetching of user context data. Clears any existing timer before starting a new one. ```javascript function pollContext() { clearInterval(contextTimer); fetchContext(); contextTimer = setInterval(fetchContext, CONTEXT_POLL_MS); } ``` -------------------------------- ### Use New Configuration Section in Code Source: https://github.com/vierisid/jarvis/blob/main/src/config/README.md Demonstrates how to access and utilize newly added configuration settings within the application code after updating the types and defaults. ```typescript const config = await loadConfig(); console.log(config.new_section.setting1); ``` -------------------------------- ### Build System Prompt Source: https://github.com/vierisid/jarvis/blob/main/src/roles/README.md Imports the `buildSystemPrompt` function to generate a detailed system prompt for an AI agent. It takes the role definition and contextual information such as user name, time, commitments, observations, and agent hierarchy as input. ```typescript import { buildSystemPrompt } from './roles/index.ts'; const prompt = buildSystemPrompt(role, { userName: 'John Doe', currentTime: new Date().toLocaleString(), activeCommitments: ['Finish report by Friday'], recentObservations: ['User prefers morning meetings'], agentHierarchy: 'Manager > Assistant (you) > Specialist', }); ``` -------------------------------- ### Test FileWatcher Observer Source: https://github.com/vierisid/jarvis/blob/main/src/observers/README.md Unit test for the FileWatcher observer, verifying its start and stop functionality. Asserts the running state before and after start/stop operations. ```typescript import { test, expect } from 'bun:test'; import { FileWatcher } from './file-watcher'; test('FileWatcher starts and stops', async () => { const watcher = new FileWatcher(['/tmp']); expect(watcher.isRunning()).toBe(false); await watcher.start(); expect(watcher.isRunning()).toBe(true); await watcher.stop(); expect(watcher.isRunning()).toBe(false); }); ``` -------------------------------- ### Streaming LLM Responses Source: https://github.com/vierisid/jarvis/blob/main/src/llm/README.md Process streaming responses from the LLMManager. This example iterates over events, handling text chunks, completion signals, and errors. ```typescript for await (const event of manager.stream(messages)) { if (event.type === 'text') { process.stdout.write(event.text); } else if (event.type === 'done') { console.log(' Completed!'); console.log('Total tokens:', event.response.usage); } else if (event.type === 'error') { console.error('Error:', event.error); } } ``` -------------------------------- ### Run Extractor Demo Source: https://github.com/vierisid/jarvis/blob/main/src/vault/README.md Executes the extractor demo script using bun. This is useful for demonstrating the functionality of the extractor. ```bash bun run examples/extractor-demo.ts ``` -------------------------------- ### Manual Personality Update Example Source: https://github.com/vierisid/jarvis/blob/main/docs/PERSONALITY_ENGINE.md Demonstrates how to manually update the personality state, specifically modifying core traits and relationship shared references. ```typescript // 2. Manual personality updates const updated = updatePersonality({ core_traits: ['direct', 'strategic', 'resourceful', 'proactive'], relationship: { shared_references: ['Project X', 'User preferences'], }, }); ```