jiva-core 0.3.3 → 0.3.4-dev.945ddfc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +232 -570
- package/dist/code/agent.d.ts +105 -0
- package/dist/code/agent.d.ts.map +1 -0
- package/dist/code/agent.js +697 -0
- package/dist/code/agent.js.map +1 -0
- package/dist/code/file-lock.d.ts +15 -0
- package/dist/code/file-lock.d.ts.map +1 -0
- package/dist/code/file-lock.js +36 -0
- package/dist/code/file-lock.js.map +1 -0
- package/dist/code/lsp/client.d.ts +30 -0
- package/dist/code/lsp/client.d.ts.map +1 -0
- package/dist/code/lsp/client.js +181 -0
- package/dist/code/lsp/client.js.map +1 -0
- package/dist/code/lsp/language.d.ts +12 -0
- package/dist/code/lsp/language.d.ts.map +1 -0
- package/dist/code/lsp/language.js +145 -0
- package/dist/code/lsp/language.js.map +1 -0
- package/dist/code/lsp/manager.d.ts +39 -0
- package/dist/code/lsp/manager.d.ts.map +1 -0
- package/dist/code/lsp/manager.js +108 -0
- package/dist/code/lsp/manager.js.map +1 -0
- package/dist/code/lsp/server.d.ts +15 -0
- package/dist/code/lsp/server.d.ts.map +1 -0
- package/dist/code/lsp/server.js +78 -0
- package/dist/code/lsp/server.js.map +1 -0
- package/dist/code/tools/bash.d.ts +3 -0
- package/dist/code/tools/bash.d.ts.map +1 -0
- package/dist/code/tools/bash.js +110 -0
- package/dist/code/tools/bash.js.map +1 -0
- package/dist/code/tools/edit.d.ts +11 -0
- package/dist/code/tools/edit.d.ts.map +1 -0
- package/dist/code/tools/edit.js +459 -0
- package/dist/code/tools/edit.js.map +1 -0
- package/dist/code/tools/glob.d.ts +3 -0
- package/dist/code/tools/glob.d.ts.map +1 -0
- package/dist/code/tools/glob.js +62 -0
- package/dist/code/tools/glob.js.map +1 -0
- package/dist/code/tools/grep.d.ts +3 -0
- package/dist/code/tools/grep.d.ts.map +1 -0
- package/dist/code/tools/grep.js +147 -0
- package/dist/code/tools/grep.js.map +1 -0
- package/dist/code/tools/index.d.ts +31 -0
- package/dist/code/tools/index.d.ts.map +1 -0
- package/dist/code/tools/index.js +9 -0
- package/dist/code/tools/index.js.map +1 -0
- package/dist/code/tools/read.d.ts +3 -0
- package/dist/code/tools/read.d.ts.map +1 -0
- package/dist/code/tools/read.js +120 -0
- package/dist/code/tools/read.js.map +1 -0
- package/dist/code/tools/spawn.d.ts +3 -0
- package/dist/code/tools/spawn.d.ts.map +1 -0
- package/dist/code/tools/spawn.js +49 -0
- package/dist/code/tools/spawn.js.map +1 -0
- package/dist/code/tools/write.d.ts +3 -0
- package/dist/code/tools/write.d.ts.map +1 -0
- package/dist/code/tools/write.js +82 -0
- package/dist/code/tools/write.js.map +1 -0
- package/dist/core/agent-interface.d.ts +54 -0
- package/dist/core/agent-interface.d.ts.map +1 -0
- package/dist/core/agent-interface.js +8 -0
- package/dist/core/agent-interface.js.map +1 -0
- package/dist/core/config.d.ts +71 -0
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +16 -0
- package/dist/core/config.js.map +1 -1
- package/dist/core/conversation-manager.d.ts +4 -1
- package/dist/core/conversation-manager.d.ts.map +1 -1
- package/dist/core/conversation-manager.js +47 -17
- package/dist/core/conversation-manager.js.map +1 -1
- package/dist/core/dual-agent.d.ts +3 -10
- package/dist/core/dual-agent.d.ts.map +1 -1
- package/dist/core/dual-agent.js +42 -117
- package/dist/core/dual-agent.js.map +1 -1
- package/dist/core/manager-agent.d.ts +30 -1
- package/dist/core/manager-agent.d.ts.map +1 -1
- package/dist/core/manager-agent.js +109 -17
- package/dist/core/manager-agent.js.map +1 -1
- package/dist/core/worker-agent.d.ts +5 -2
- package/dist/core/worker-agent.d.ts.map +1 -1
- package/dist/core/worker-agent.js +48 -51
- package/dist/core/worker-agent.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces/cli/index.js +88 -25
- package/dist/interfaces/cli/index.js.map +1 -1
- package/dist/interfaces/cli/repl.d.ts +8 -2
- package/dist/interfaces/cli/repl.d.ts.map +1 -1
- package/dist/interfaces/cli/repl.js +39 -3
- package/dist/interfaces/cli/repl.js.map +1 -1
- package/dist/interfaces/http/routes/chat.js +2 -2
- package/dist/interfaces/http/routes/chat.js.map +1 -1
- package/dist/interfaces/http/session-manager.d.ts +7 -4
- package/dist/interfaces/http/session-manager.d.ts.map +1 -1
- package/dist/interfaces/http/session-manager.js +38 -15
- package/dist/interfaces/http/session-manager.js.map +1 -1
- package/dist/models/base.d.ts +8 -0
- package/dist/models/base.d.ts.map +1 -1
- package/dist/models/harmony.d.ts +7 -1
- package/dist/models/harmony.d.ts.map +1 -1
- package/dist/models/harmony.js +21 -3
- package/dist/models/harmony.js.map +1 -1
- package/dist/models/krutrim.d.ts +30 -0
- package/dist/models/krutrim.d.ts.map +1 -1
- package/dist/models/krutrim.js +51 -8
- package/dist/models/krutrim.js.map +1 -1
- package/package.json +8 -6
package/README.md
CHANGED
|
@@ -1,709 +1,381 @@
|
|
|
1
|
-
# Jiva
|
|
1
|
+
# Jiva
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/jiva-core)
|
|
3
|
+
[](https://www.npmjs.com/package/jiva-core)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](https://github.com/KarmaloopAI/Jiva)
|
|
4
6
|
|
|
5
|
-
Jiva is
|
|
6
|
-
|
|
7
|
-
## Quick Links
|
|
8
|
-
|
|
9
|
-
- **[Quick Start Guide](docs/guides/QUICKSTART.md)** - Get up and running in 30 seconds
|
|
10
|
-
- **[Cloud Run Deployment](docs/deployment/CLOUD_RUN_DEPLOYMENT.md)** - Deploy to production
|
|
11
|
-
- **[Configuration Guide](docs/guides/CONFIGURATION.md)** - Detailed configuration and provider setup
|
|
12
|
-
- **[Documentation](docs/README.md)** - Complete documentation index
|
|
13
|
-
- **[Build Instructions](docs/guides/BUILD.md)** - Detailed setup and development workflow
|
|
14
|
-
- **[Troubleshooting](docs/guides/TROUBLESHOOTING.md)** - Common issues and solutions
|
|
7
|
+
Jiva is an autonomous AI agent for the terminal and cloud. It works with any OpenAI-compatible model provider and supports two execution modes — a general-purpose two-agent system (Manager + Worker) for complex tasks, and a code-optimized single-loop engine with LSP integration for software engineering.
|
|
15
8
|
|
|
16
9
|
## Demo
|
|
17
10
|
|
|
18
11
|

|
|
19
12
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
### Core Capabilities
|
|
23
|
-
- **Three-Agent Architecture**: Manager for planning, Worker for execution, Client for quality validation
|
|
24
|
-
- **Adaptive Quality Control**: Client agent uses tiered validation (MINIMAL→STANDARD→THOROUGH) based on task complexity
|
|
25
|
-
- **Unjustified Failure Detection**: LLM-powered analysis catches agents giving up without trying
|
|
26
|
-
- **Cloud-Ready Deployment**: Run on Google Cloud Run with auto-scaling, WebSocket support, and GCS storage
|
|
27
|
-
- **Multi-Tenancy**: Per-tenant isolation with authenticated session management
|
|
28
|
-
- **Provider Agnostic**: Works with Krutrim, Groq, OpenAI, Ollama, and any OpenAI-compatible API
|
|
29
|
-
- **MCP Integration**: Seamless integration with Model Context Protocol servers for extensible tooling
|
|
30
|
-
- **Smart Conversations**: Auto-save, restore, and AI-generated titles for all conversations
|
|
31
|
-
- **Directive-Based**: Orient agent behavior with custom `jiva-directive.md` files
|
|
32
|
-
- **Storage Abstraction**: Local filesystem or cloud storage (GCS, future: S3, Redis)
|
|
33
|
-
|
|
34
|
-
### v0.3.1 Features
|
|
35
|
-
- **Production Deployment**: One-command Cloud Run deployment with GCS persistence
|
|
36
|
-
- **Client Agent**: Intelligent validation that ensures work quality and catches false failures
|
|
37
|
-
- **HTTP/WebSocket API**: RESTful endpoints and real-time bidirectional communication
|
|
38
|
-
- **Authentication**: Firebase Auth, custom JWT, or development mode
|
|
39
|
-
- **Session Management**: Auto-scaling agent instances with idle timeout and cleanup
|
|
40
|
-
- **Container Orchestration**: Multi-stage Docker builds, health probes, graceful shutdown
|
|
41
|
-
- **Personas & Skills**: 100% compatible with Claude's Skills/Plugins system - extend Jiva with domain-specific capabilities
|
|
42
|
-
|
|
43
|
-
### Personas (Skills & Plugins)
|
|
44
|
-
|
|
45
|
-
Jiva supports persona-based skill management, fully compatible with Claude's Skills/Plugins system:
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
# List available personas
|
|
49
|
-
jiva persona list
|
|
50
|
-
|
|
51
|
-
# Activate a persona
|
|
52
|
-
jiva persona activate data-analyst
|
|
53
|
-
|
|
54
|
-
# Create your own skill
|
|
55
|
-
jiva persona create-skill my-skill \
|
|
56
|
-
--description "Custom functionality" \
|
|
57
|
-
--author "Your Name"
|
|
58
|
-
|
|
59
|
-
# Package and distribute
|
|
60
|
-
jiva persona package-skill my-skill
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
**Key Features:**
|
|
64
|
-
- **Progressive Disclosure**: Skills load only what's needed (L1→L2→L3)
|
|
65
|
-
- **Automatic Routing**: Agent selects skills based on user request
|
|
66
|
-
- **Composable**: Bundle skills, commands, agents, and MCP servers
|
|
67
|
-
- **Portable**: Same .skill files work on Claude and Jiva
|
|
68
|
-
|
|
69
|
-
See **[Personas Guide](docs/guides/PERSONAS.md)** for complete documentation.
|
|
70
|
-
|
|
71
|
-
### v0.3.23 Bug Fixes
|
|
72
|
-
- **Linux Path Fix**: Resolved startup errors on Linux where Jiva was reading from the wrong directory — new `platform.ts` utility ensures correct path resolution across all platforms
|
|
73
|
-
- **Punycode Deprecation**: Eliminated `[DEP0040] DeprecationWarning` by lazy-loading `@google-cloud/storage` so the deprecated built-in `punycode` module is never loaded during CLI-only sessions
|
|
74
|
-
- **Type Safety**: Fixed a `mustUseTools` type error in the Client agent
|
|
75
|
-
- **Dev Publishing**: Added CI workflow to auto-publish `dev`-tagged npm releases on every merge to `develop`
|
|
76
|
-
|
|
77
|
-
### v0.3.22 Maintenance
|
|
78
|
-
- **Security Updates**: Upgraded `glob` and `tr46` via npm `overrides` to resolve known vulnerabilities
|
|
79
|
-
- **CI/CD**: Added GitHub Actions workflow to automatically publish releases to npm
|
|
80
|
-
|
|
81
|
-
### v0.3.2 Bug Fixes & Quality Improvements
|
|
82
|
-
**Bug Fixes:**
|
|
83
|
-
- **Persona Isolation**: Sub-agents now use ephemeral personas that don't overwrite parent agent configuration
|
|
84
|
-
- **Context Propagation**: Workspace directory automatically injected into all sub-agent task messages
|
|
85
|
-
- **Enhanced Logging**: Persona context included in all log messages for better multi-agent debugging
|
|
86
|
-
- **Reduced Hallucination**: Temperature lowered from 0.3-0.7 to 0.1-0.2 for more deterministic, fact-based behavior
|
|
87
|
-
|
|
88
|
-
**HTTP/Cloud Compatibility:**
|
|
89
|
-
- **🚨 Per-Tenant Persona Config** (CRITICAL): Fixed cross-tenant persona configuration leakage - each tenant's settings now isolated in GCS
|
|
90
|
-
- **Session-Scoped Logging**: Fixed persona context race conditions in concurrent HTTP sessions
|
|
91
|
-
- **Cloud-Aware Orchestration**: Orchestration logs now persist to cloud storage (GCS/S3) instead of ephemeral filesystem
|
|
92
|
-
|
|
93
|
-
**Quality Improvements:**
|
|
94
|
-
- **LLM-Based Validation**: Client agent uses semantic analysis instead of keyword matching for involvement level detection
|
|
95
|
-
- **Coherence Checking**: Detects when Worker fabricates accomplishments not supported by actual tool usage
|
|
96
|
-
- **Robust Plan Parsing**: Manager agent parsing with JSON format, LLM cleanup fallback, and garbage filtering
|
|
97
|
-
- **Client Logging**: Full orchestration traceability for validation decisions and quality control
|
|
98
|
-
|
|
99
|
-
**⚠️ CRITICAL:** If running in HTTP/Cloud mode (v0.3.1+), **upgrade immediately**:
|
|
100
|
-
- v0.3.1 has cross-tenant configuration leakage (security issue)
|
|
101
|
-
- v0.3.2 fixes multi-tenant isolation with per-tenant storage
|
|
102
|
-
|
|
103
|
-
### v0.2.1 Features
|
|
104
|
-
- **Dual-Agent System**: Separate Manager and Worker agents for better task focus and reliability
|
|
105
|
-
- **Chain-of-Thought Logging**: Transparent reasoning at INFO level with clean ASCII formatting
|
|
106
|
-
- **Robust Error Recovery**: Automatic retry with error feedback for API and tool failures
|
|
107
|
-
- **Workspace-Aware Operations**: Smart path resolution for file operations
|
|
108
|
-
- **Slash Commands**: Use `/help`, `/load`, `/save`, `/list` for easy conversation management
|
|
109
|
-
- **Smart Tool Format Detection**: Auto-detects Harmony vs Standard OpenAI tool calling format
|
|
110
|
-
|
|
111
|
-
See [release notes](docs/release_notes/) for detailed version history.
|
|
13
|
+
---
|
|
112
14
|
|
|
113
15
|
## Installation
|
|
114
16
|
|
|
115
|
-
### Global Install (Recommended)
|
|
116
|
-
|
|
117
17
|
```bash
|
|
118
18
|
npm install -g jiva-core
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
After installation, run the setup wizard:
|
|
122
|
-
|
|
123
|
-
```bash
|
|
124
19
|
jiva setup
|
|
125
20
|
```
|
|
126
21
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
```bash
|
|
130
|
-
git clone https://github.com/KarmaloopAI/Jiva.git
|
|
131
|
-
cd jCLI Mode (Local Development)
|
|
22
|
+
The setup wizard prompts for your API endpoint, key, and model name. Jiva works with Krutrim, Groq, OpenAI, Ollama, and any OpenAI-compatible provider.
|
|
132
23
|
|
|
133
|
-
|
|
24
|
+
### Development install
|
|
134
25
|
|
|
135
26
|
```bash
|
|
136
|
-
|
|
27
|
+
git clone https://github.com/KarmaloopAI/Jiva.git
|
|
28
|
+
cd Jiva
|
|
29
|
+
npm install && npm run build && npm link
|
|
30
|
+
jiva setup
|
|
137
31
|
```
|
|
138
32
|
|
|
139
|
-
|
|
33
|
+
---
|
|
140
34
|
|
|
141
|
-
|
|
35
|
+
## Quick Start
|
|
142
36
|
|
|
143
37
|
```bash
|
|
144
|
-
|
|
145
|
-
|
|
38
|
+
# General-purpose interactive session
|
|
39
|
+
jiva chat
|
|
146
40
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
- API key for gpt-oss-120b ([Get your API key](https://cloud.olakrutrim.com))
|
|
150
|
-
- Optional multimodal model (Llama-4-Maverick-17B)
|
|
151
|
-
- MCP server configuration
|
|
41
|
+
# Code mode — optimized for software engineering tasks
|
|
42
|
+
jiva chat --code
|
|
152
43
|
|
|
153
|
-
|
|
44
|
+
# Code mode with plan-then-approve flow
|
|
45
|
+
jiva chat --code --plan
|
|
154
46
|
|
|
155
|
-
|
|
47
|
+
# Single prompt
|
|
48
|
+
jiva run "What changed in the last 5 commits?"
|
|
156
49
|
|
|
157
|
-
|
|
158
|
-
jiva
|
|
50
|
+
# Single prompt in code mode
|
|
51
|
+
jiva run "Add error handling to the database module" --code
|
|
159
52
|
```
|
|
160
53
|
|
|
161
|
-
|
|
162
|
-
```bash
|
|
163
|
-
You: /help # Show all available commands
|
|
164
|
-
You: /servers # Check MCP server status
|
|
165
|
-
You: /tools # List all available tools
|
|
166
|
-
You: List files in this directory
|
|
167
|
-
You: /save # Save this conversation
|
|
168
|
-
You: /list # View all saved conversations
|
|
169
|
-
```
|
|
54
|
+
### REPL commands
|
|
170
55
|
|
|
171
|
-
|
|
56
|
+
| Command | Description |
|
|
57
|
+
|---------|-------------|
|
|
58
|
+
| `/help` | Show available commands |
|
|
59
|
+
| `/tools` | List active tools |
|
|
60
|
+
| `/servers` | Show MCP server status |
|
|
61
|
+
| `/save` | Save current conversation |
|
|
62
|
+
| `/load` | Resume a saved conversation |
|
|
63
|
+
| `/list` | Browse all saved conversations |
|
|
64
|
+
| `/reset` | Clear conversation history |
|
|
65
|
+
| `/exit` | Exit Jiva |
|
|
172
66
|
|
|
173
|
-
|
|
67
|
+
---
|
|
174
68
|
|
|
175
|
-
|
|
69
|
+
## Execution Modes
|
|
176
70
|
|
|
177
|
-
|
|
178
|
-
- `gcloud` CLI installed and configured
|
|
179
|
-
- Docker installed (for local testing)
|
|
71
|
+
### General mode (default)
|
|
180
72
|
|
|
181
|
-
|
|
73
|
+
A two-agent pipeline designed for complex, multi-step tasks:
|
|
182
74
|
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
75
|
+
```
|
|
76
|
+
User Request
|
|
77
|
+
↓
|
|
78
|
+
Manager Agent — plans, decomposes, and synthesizes
|
|
79
|
+
↓
|
|
80
|
+
Worker Agent — executes subtasks with MCP tools
|
|
81
|
+
↓
|
|
82
|
+
Response
|
|
187
83
|
```
|
|
188
84
|
|
|
189
|
-
The
|
|
190
|
-
- Enables required GCP APIs
|
|
191
|
-
- Creates GCS bucket for state storage
|
|
192
|
-
- Configures service account and IAM roles
|
|
193
|
-
- Builds and deploys container to Cloud Run
|
|
194
|
-
- Outputs service URL
|
|
85
|
+
The Worker has access to any configured MCP server (filesystem, browser automation, shell commands, etc.). The Manager synthesizes results from all subtasks into a final coherent response. Simple conversational messages are answered directly without executing subtasks.
|
|
195
86
|
|
|
196
|
-
|
|
87
|
+
### Code mode (`--code`)
|
|
197
88
|
|
|
198
|
-
|
|
199
|
-
SERVICE_URL=$(gcloud run services describe jiva --region=us-central1 --format='value(status.url)')
|
|
89
|
+
A single streaming loop optimized for coding tasks:
|
|
200
90
|
|
|
201
|
-
# Health check
|
|
202
|
-
curl $SERVICE_URL/health
|
|
203
|
-
|
|
204
|
-
# Chat endpoint (with auth bypass for testing)
|
|
205
|
-
curl -X POST $SERVICE_URL/api/chat \
|
|
206
|
-
-H "Content-Type: application/json" \
|
|
207
|
-
-H "X-Session-Id: test-session" \
|
|
208
|
-
-d '{"message": "Hello, Jiva!"}'
|
|
209
91
|
```
|
|
92
|
+
User Request
|
|
93
|
+
↓
|
|
94
|
+
CodeAgent
|
|
95
|
+
loop until done:
|
|
96
|
+
LLM call with tool definitions
|
|
97
|
+
↓
|
|
98
|
+
Tool execution (in-process, no subprocess)
|
|
99
|
+
↓
|
|
100
|
+
LSP feedback after file edits
|
|
101
|
+
↓
|
|
102
|
+
Response
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Code mode reduces latency by eliminating inter-agent overhead and running all file tools directly in the Node.js process. It includes a multi-strategy edit engine that reliably handles indentation drift and whitespace inconsistencies.
|
|
106
|
+
|
|
107
|
+
**Available tools in code mode:**
|
|
108
|
+
|
|
109
|
+
| Tool | Description |
|
|
110
|
+
|------|-------------|
|
|
111
|
+
| `read_file` | Read files with line numbers, list directories |
|
|
112
|
+
| `edit_file` | Multi-strategy string replacement (9 strategies) |
|
|
113
|
+
| `write_file` | Create or overwrite files |
|
|
114
|
+
| `glob` | Find files by pattern |
|
|
115
|
+
| `grep` | Regex content search |
|
|
116
|
+
| `bash` | Run shell commands |
|
|
117
|
+
| `spawn_code_agent` | Delegate a sub-task to a child agent |
|
|
118
|
+
|
|
119
|
+
**LSP integration:** After each file edit, Jiva notifies the appropriate language server and appends any compiler errors to the tool result. Language servers are auto-detected from your PATH. If none is installed for a given language, the tool continues silently.
|
|
210
120
|
|
|
211
|
-
**Full deployment guide:** [Cloud Run Deployment](docs/deployment/CLOUD_RUN_DEPLOYMENT.md)ry these commands:**
|
|
212
121
|
```bash
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
You: /list # View all saved conversations
|
|
122
|
+
# Install language servers (optional but recommended for code mode)
|
|
123
|
+
npm install -g typescript-language-server typescript # TypeScript / JavaScript
|
|
124
|
+
pip install python-lsp-server # Python
|
|
125
|
+
go install golang.org/x/tools/gopls@latest # Go
|
|
126
|
+
rustup component add rust-analyzer # Rust
|
|
219
127
|
```
|
|
220
128
|
|
|
221
|
-
|
|
129
|
+
For a complete technical reference see [Code Mode Architecture](docs/architecture/CODE_MODE.md).
|
|
222
130
|
|
|
223
|
-
|
|
224
|
-
```bash
|
|
225
|
-
jiva config --show
|
|
226
|
-
```
|
|
131
|
+
---
|
|
227
132
|
|
|
228
|
-
|
|
229
|
-
```bash
|
|
230
|
-
jiva chat --config ./my-project-config.json
|
|
231
|
-
jiva run "analyze code" --config ./team-config.json
|
|
232
|
-
```
|
|
133
|
+
## Configuration
|
|
233
134
|
|
|
234
|
-
**Custom workspace and directive:**
|
|
235
135
|
```bash
|
|
236
|
-
|
|
237
|
-
|
|
136
|
+
# Run setup wizard
|
|
137
|
+
jiva setup
|
|
238
138
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
jiva run "Analyze the code in this directory and suggest improvements"
|
|
242
|
-
```
|
|
139
|
+
# View or update settings interactively
|
|
140
|
+
jiva config
|
|
243
141
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
jiva chat --debug
|
|
142
|
+
# View current configuration and file path
|
|
143
|
+
jiva config --show
|
|
247
144
|
```
|
|
248
145
|
|
|
249
|
-
|
|
146
|
+
Configuration is stored at `~/.config/jiva-nodejs/config.json` (Linux/macOS) or `%APPDATA%\jiva-nodejs\config.json` (Windows).
|
|
250
147
|
|
|
251
|
-
|
|
252
|
-
```bash
|
|
253
|
-
You: Review all TypeScript files and identify potential bugs
|
|
254
|
-
Jiva: *Uses filesystem to read files, analyzes code, provides detailed review*
|
|
255
|
-
```
|
|
148
|
+
### Provider examples
|
|
256
149
|
|
|
257
|
-
**
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
|
|
150
|
+
**Krutrim (gpt-oss-120b)**
|
|
151
|
+
```json
|
|
152
|
+
{
|
|
153
|
+
"models": {
|
|
154
|
+
"reasoning": {
|
|
155
|
+
"endpoint": "https://cloud.olakrutrim.com/v1/chat/completions",
|
|
156
|
+
"apiKey": "kr-...",
|
|
157
|
+
"model": "gpt-oss-120b",
|
|
158
|
+
"type": "reasoning",
|
|
159
|
+
"useHarmonyFormat": true
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
261
163
|
```
|
|
262
164
|
|
|
263
|
-
**
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
|
|
165
|
+
**Groq**
|
|
166
|
+
```json
|
|
167
|
+
{
|
|
168
|
+
"models": {
|
|
169
|
+
"reasoning": {
|
|
170
|
+
"endpoint": "https://api.groq.com/openai/v1/chat/completions",
|
|
171
|
+
"apiKey": "gsk_...",
|
|
172
|
+
"model": "openai/gpt-oss-20b",
|
|
173
|
+
"type": "reasoning"
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
267
177
|
```
|
|
268
178
|
|
|
269
|
-
**
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
179
|
+
**Ollama (local)**
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"models": {
|
|
183
|
+
"reasoning": {
|
|
184
|
+
"endpoint": "http://localhost:11434/v1/chat/completions",
|
|
185
|
+
"apiKey": "not-needed",
|
|
186
|
+
"model": "llama3.1",
|
|
187
|
+
"type": "reasoning"
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
275
191
|
```
|
|
276
192
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
Configuration is stored in your system's config directory (managed by `conf` package).
|
|
280
|
-
|
|
281
|
-
### View Configuration Location
|
|
193
|
+
### Code mode configuration
|
|
282
194
|
|
|
283
|
-
```
|
|
284
|
-
|
|
195
|
+
```json
|
|
196
|
+
{
|
|
197
|
+
"codeMode": {
|
|
198
|
+
"enabled": true,
|
|
199
|
+
"lsp": { "enabled": true },
|
|
200
|
+
"maxIterations": 50
|
|
201
|
+
}
|
|
202
|
+
}
|
|
285
203
|
```
|
|
286
204
|
|
|
287
|
-
|
|
205
|
+
Full configuration reference: [Configuration Guide](docs/guides/CONFIGURATION.md)
|
|
288
206
|
|
|
289
|
-
|
|
290
|
-
- macOS: `~/Library/Preferences/jiva-nodejs/`
|
|
291
|
-
- Linux: `~/.config/jiva-nodejs/`
|
|
292
|
-
- Windows: `%APPDATA%\jiva-nodejs\`
|
|
207
|
+
---
|
|
293
208
|
|
|
294
209
|
## Directive Files
|
|
295
210
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
### Example Directive
|
|
299
|
-
|
|
300
|
-
Create a file called `jiva-directive.md`:
|
|
211
|
+
Create a `jiva-directive.md` in your project root to orient the agent to your codebase:
|
|
301
212
|
|
|
302
213
|
```markdown
|
|
303
214
|
# Purpose
|
|
304
|
-
|
|
305
|
-
You are a code review assistant focused on identifying security vulnerabilities
|
|
306
|
-
and suggesting performance improvements in Python projects.
|
|
215
|
+
Code review assistant for a Django web application.
|
|
307
216
|
|
|
308
217
|
# Tasks
|
|
309
|
-
|
|
310
|
-
- Scan Python files for common security issues (SQL injection, XSS, etc.)
|
|
218
|
+
- Scan for security vulnerabilities (SQLi, XSS, CSRF)
|
|
311
219
|
- Identify performance bottlenecks
|
|
312
220
|
- Suggest modern Python best practices
|
|
313
|
-
- Check for outdated dependencies
|
|
314
221
|
|
|
315
222
|
# Constraints
|
|
316
|
-
|
|
317
|
-
-
|
|
318
|
-
- Do not modify code without explicit approval
|
|
319
|
-
- Prioritize security issues over style improvements
|
|
223
|
+
- Only analyze .py files
|
|
224
|
+
- Do not modify files without explicit approval
|
|
320
225
|
|
|
321
226
|
# Context
|
|
322
|
-
|
|
323
|
-
This project is a Django web application with a PostgreSQL database.
|
|
324
|
-
It handles sensitive user data and must comply with GDPR.
|
|
227
|
+
PostgreSQL backend, GDPR-sensitive user data.
|
|
325
228
|
```
|
|
326
229
|
|
|
327
|
-
Jiva
|
|
328
|
-
1. Path
|
|
329
|
-
2. `jiva-directive.md` in workspace root
|
|
330
|
-
3. `.jiva/directive.md` in workspace root
|
|
331
|
-
|
|
332
|
-
## MCP Servers
|
|
333
|
-
|
|
334
|
-
Jiva leverages the Model Context Protocol (MCP) to provide extensible tooling. It comes pre-configured with the Filesystem server and makes it easy to add more.
|
|
335
|
-
|
|
336
|
-
### Default Server: Filesystem
|
|
230
|
+
Jiva searches for directive files automatically:
|
|
231
|
+
1. Path given via `--directive`
|
|
232
|
+
2. `jiva-directive.md` in the workspace root
|
|
233
|
+
3. `.jiva/directive.md` in the workspace root
|
|
337
234
|
|
|
338
|
-
|
|
235
|
+
---
|
|
339
236
|
|
|
340
|
-
|
|
341
|
-
- **Package:** `@modelcontextprotocol/server-filesystem`
|
|
342
|
-
- **Access:** `/Users` (macOS/Linux) or `C:\Users` (Windows)
|
|
343
|
-
- **Tools:** read_file, write_file, list_directory, create_directory, and more
|
|
344
|
-
- **Details:** See [FILESYSTEM_ACCESS.md](docs/architecture/FILESYSTEM_ACCESS.md)
|
|
237
|
+
## MCP Servers (general mode)
|
|
345
238
|
|
|
346
|
-
|
|
239
|
+
General mode uses MCP servers to extend the agent's capabilities. Jiva ships with the filesystem server enabled; additional servers can be added via `jiva config`.
|
|
347
240
|
|
|
348
|
-
|
|
241
|
+
### Recommended servers
|
|
349
242
|
|
|
350
|
-
|
|
243
|
+
**Playwright** — browser automation, web scraping, screenshot capture
|
|
351
244
|
|
|
352
245
|
```bash
|
|
353
|
-
# Add Playwright MCP server
|
|
354
246
|
jiva config
|
|
355
|
-
#
|
|
356
|
-
# Name: playwright
|
|
357
|
-
# Command: npx
|
|
358
|
-
# Args: @playwright/mcp@latest
|
|
359
|
-
# Enabled: true
|
|
247
|
+
# MCP Servers > Add Server
|
|
248
|
+
# Name: playwright Command: npx Args: @playwright/mcp@latest
|
|
360
249
|
```
|
|
361
250
|
|
|
362
|
-
**
|
|
363
|
-
- 🌐 Navigate to URLs and interact with web pages
|
|
364
|
-
- 📸 Take screenshots and extract page content
|
|
365
|
-
- 🤖 Automate web forms and workflows
|
|
366
|
-
- 🔍 Scrape data from websites
|
|
367
|
-
- 📝 Fill forms and click buttons
|
|
368
|
-
|
|
369
|
-
**Example usage:**
|
|
370
|
-
```
|
|
371
|
-
You: Open LinkedIn and take a screenshot
|
|
372
|
-
Jiva: *Uses playwright to open LinkedIn, waits for load, captures screenshot*
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
#### 2. Desktop Commander - Shell Command Execution
|
|
376
|
-
|
|
377
|
-
Execute shell commands, manage processes, and interact with the terminal.
|
|
251
|
+
**Desktop Commander** — shell command execution, process management
|
|
378
252
|
|
|
379
253
|
```bash
|
|
380
|
-
#
|
|
381
|
-
jiva config
|
|
382
|
-
# Select "MCP Servers" > "Add Server"
|
|
383
|
-
# Name: desktop-commander
|
|
384
|
-
# Command: npx
|
|
385
|
-
# Args: -y desktop-commander
|
|
386
|
-
# Enabled: true
|
|
254
|
+
# Name: desktop-commander Command: npx Args: -y desktop-commander
|
|
387
255
|
```
|
|
388
256
|
|
|
389
|
-
|
|
390
|
-
- 💻 Execute shell commands (ls, grep, git, etc.)
|
|
391
|
-
- 🔄 Start and manage background processes
|
|
392
|
-
- 📊 Read process output with timeout control
|
|
393
|
-
- 🎯 Session management for long-running commands
|
|
257
|
+
Other popular servers: GitHub, Postgres, Slack, Google Maps — see [modelcontextprotocol/servers](https://github.com/modelcontextprotocol/servers).
|
|
394
258
|
|
|
395
|
-
|
|
396
|
-
```
|
|
397
|
-
You: Run npm test and show me the results
|
|
398
|
-
Jiva: *Uses desktop-commander to execute tests and parse output*
|
|
399
|
-
```
|
|
400
|
-
|
|
401
|
-
**⚠️ Security Note:** Desktop Commander can execute any shell command. Only enable if you understand the security implications and trust the agent.
|
|
402
|
-
|
|
403
|
-
### Other Available MCP Servers
|
|
259
|
+
---
|
|
404
260
|
|
|
405
|
-
|
|
261
|
+
## Cloud Deployment
|
|
406
262
|
|
|
407
|
-
|
|
408
|
-
- **Google Maps** (`@modelcontextprotocol/server-google-maps`) - Location data and mapping
|
|
409
|
-
- **Slack** (`@modelcontextprotocol/server-slack`) - Team communication
|
|
410
|
-
- **Postgres** (`@modelcontextprotocol/server-postgres`) - Database operations
|
|
411
|
-
- **Git** (`@modelcontextprotocol/server-git`) - Version control operations
|
|
412
|
-
- And more at [MCP Servers Repository](https://github.com/modelcontextprotocol/servers)
|
|
413
|
-
|
|
414
|
-
### Adding MCP Servers
|
|
415
|
-
|
|
416
|
-
#### Via Interactive Config
|
|
263
|
+
Jiva can be deployed as a stateless, auto-scaling HTTP/WebSocket service on Google Cloud Run with GCS-backed session persistence and multi-tenant isolation.
|
|
417
264
|
|
|
418
265
|
```bash
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
```
|
|
423
|
-
|
|
424
|
-
#### Via Manual Config Edit
|
|
425
|
-
|
|
426
|
-
Edit your config file at `~/.config/jiva-nodejs/config.json` (Linux) or `~/Library/Preferences/jiva-nodejs/config.json` (macOS):
|
|
427
|
-
|
|
428
|
-
```json
|
|
429
|
-
{
|
|
430
|
-
"mcpServers": {
|
|
431
|
-
"playwright": {
|
|
432
|
-
"command": "npx",
|
|
433
|
-
"args": ["@playwright/mcp@latest"],
|
|
434
|
-
"enabled": true
|
|
435
|
-
},
|
|
436
|
-
"desktop-commander": {
|
|
437
|
-
"command": "npx",
|
|
438
|
-
"args": ["-y", "desktop-commander"],
|
|
439
|
-
"enabled": true
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
```
|
|
444
|
-
|
|
445
|
-
#### Programmatically
|
|
446
|
-
|
|
447
|
-
```typescript
|
|
448
|
-
### Three-Agent System (v0.3.1)
|
|
449
|
-
|
|
450
|
-
Jiva uses a three-agent architecture for intelligent task execution:
|
|
451
|
-
|
|
452
|
-
```
|
|
453
|
-
User Request
|
|
454
|
-
↓
|
|
455
|
-
┌────────────────┐
|
|
456
|
-
│ Manager Agent │ Plans subtasks, coordinates workflow
|
|
457
|
-
└────────┬───────┘
|
|
458
|
-
↓
|
|
459
|
-
┌────────────────┐
|
|
460
|
-
│ Worker Agent │ Executes subtasks with MCP tools
|
|
461
|
-
└────────┬───────┘
|
|
462
|
-
↓
|
|
463
|
-
┌────────────────┐
|
|
464
|
-
│ Client Agent │ Validates outputs, ensures quality
|
|
465
|
-
└────────┬───────┘
|
|
466
|
-
↓
|
|
467
|
-
Final Response
|
|
266
|
+
git clone https://github.com/KarmaloopAI/Jiva.git
|
|
267
|
+
cd Jiva
|
|
268
|
+
./deploy.sh YOUR_PROJECT_ID us-central1
|
|
468
269
|
```
|
|
469
270
|
|
|
470
|
-
|
|
471
|
-
**Worker Agent**: Tool execution and information gathering
|
|
472
|
-
**Client Agent**: Adaptive validation and quality control (new in v0.3.1)
|
|
271
|
+
The deployment script enables required GCP APIs, creates the GCS bucket, configures IAM roles, and deploys the container. After deployment:
|
|
473
272
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
- **STANDARD**: Creation tasks → file exists + basic checks
|
|
477
|
-
- **THOROUGH**: Complex tasks or after failures → full E2E validation
|
|
273
|
+
```bash
|
|
274
|
+
SERVICE_URL=$(gcloud run services describe jiva --region=us-central1 --format='value(status.url)')
|
|
478
275
|
|
|
479
|
-
|
|
276
|
+
# Health check
|
|
277
|
+
curl $SERVICE_URL/health
|
|
480
278
|
|
|
279
|
+
# Chat via REST
|
|
280
|
+
curl -X POST $SERVICE_URL/api/chat \
|
|
281
|
+
-H "Content-Type: application/json" \
|
|
282
|
+
-H "X-Session-Id: my-session" \
|
|
283
|
+
-d '{"message": "Hello, Jiva!"}'
|
|
481
284
|
```
|
|
482
|
-
jiva/
|
|
483
|
-
├── src/
|
|
484
|
-
│ ├── core/ # Three-agent system
|
|
485
|
-
│ │ ├── dual-agent.ts # Main orchestrator
|
|
486
|
-
│ │ ├── manager-agent.ts # Planning & coordination
|
|
487
|
-
│ │ ├── worker-agent.ts # Tool execution
|
|
488
|
-
│ │ └── client-agent.ts # Quality validation (v0.3.1)
|
|
489
|
-
│ ├── models/ # Model integrations and Harmony format
|
|
490
|
-
│ ├── mcp/ # MCP client and server management
|
|
491
|
-
│ ├── storage/ # Storage abstraction (v0.3.1)
|
|
492
|
-
│ │ ├── local-provider.ts # Filesystem storage
|
|
493
|
-
│ │ └── gcp-bucket-provider.ts # Cloud storage
|
|
494
|
-
│ ├── interfaces/ # CLI and HTTP interfaces
|
|
495
|
-
│ │ ├── cli/ # CLI interface
|
|
496
|
-
│ │ └── http/ # Cloud Run HTTP/WebSocket (v0.3.1)
|
|
497
|
-
│ └── utils/ # Utilities and helpers
|
|
498
|
-
```
|
|
499
|
-
|
|
500
|
-
### Key Components
|
|
501
|
-
|
|
502
|
-
1. **DualAgent**: Main orchestrator coordinating Manager, Worker, and Client agents
|
|
503
|
-
2. **ManagerAgent**: High-level planning, task breakdown, and result synthesis
|
|
504
|
-
3. **WorkerAgent**: Focused tool execution and information gathering
|
|
505
|
-
4. **ClientAgent**: Adaptive validation with unjustified failure detection
|
|
506
|
-
5. **ModelOrchestrator**: Manages multi-model coordination (reasoning + multimodal)
|
|
507
|
-
6. **MCPServerManager**: Handles MCP server lifecycle and tool discovery
|
|
508
|
-
7. **StorageProvider**: Unified interface for local/cloud persistence
|
|
509
|
-
8. **SessionManager**: Manages DualAgent lifecycle in cloud deployments
|
|
510
|
-
|
|
511
|
-
**Troubleshooting MCP Issues:** See [TROUBLESHOOTING.md](docs/guides/TROUBLESHOOTING.md#mcp-server-issues)
|
|
512
|
-
|
|
513
|
-
### CLI/Library Mode
|
|
514
285
|
|
|
515
|
-
|
|
516
|
-
import {
|
|
517
|
-
DualAgent,
|
|
518
|
-
createKrutrimModel,
|
|
519
|
-
ModelOrchestrator,
|
|
520
|
-
MCPServerManager,
|
|
521
|
-
WorkspaceManager,
|
|
522
|
-
ConversationManager,
|
|
523
|
-
createStorageProvider,
|
|
524
|
-
} from 'jiva-core';
|
|
525
|
-
|
|
526
|
-
// Create storage provider (auto-detects local/cloud)
|
|
527
|
-
const storageProvider = await createStorageProvider();
|
|
528
|
-
|
|
529
|
-
// Create models
|
|
530
|
-
const reasoningModel = createKrutrimModel({
|
|
531
|
-
endpoint: 'https://cloud.olakrutrim.com/v1/chat/completions',
|
|
532
|
-
apiKey: 'your-api-key',
|
|
533
|
-
model: 'gpt-oss-120b',
|
|
534
|
-
type: 'reasoning',
|
|
535
|
-
});
|
|
536
|
-
|
|
537
|
-
// Create orchestrator
|
|
538
|
-
const orchestrator = new ModelOrchestrator({ reasoningModel });
|
|
539
|
-
|
|
540
|
-
// Initialize MCP
|
|
541
|
-
const mcpManager = new MCPServerManager();
|
|
542
|
-
await mcpManager.initialize({
|
|
543
|
-
filesystem: {
|
|
544
|
-
command: 'npx',
|
|
545
|
-
args: ['-y', '@modelcontextprotocol/server-filesystem', process.cwd()],
|
|
546
|
-
enabled: true,
|
|
547
|
-
},
|
|
548
|
-
});
|
|
286
|
+
**Code mode in the cloud:**
|
|
549
287
|
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
// Initialize conversation manager
|
|
555
|
-
const conversationManager = new ConversationManager(storageProvider);
|
|
556
|
-
|
|
557
|
-
// Create three-agent system
|
|
558
|
-
const agent = new DualAgent({
|
|
559
|
-
orchestrator,
|
|
560
|
-
mcpManager,
|
|
561
|
-
workspace,
|
|
562
|
-
conversationManager,
|
|
563
|
-
maxSubtasks: 20, // Manager's subtask limit
|
|
564
|
-
maxIterations: 10, // Worker's iteration limit per subtask
|
|
565
|
-
});
|
|
566
|
-
|
|
567
|
-
// Use agent
|
|
568
|
-
const response = await agent.chat('Hello, Jiva!');
|
|
569
|
-
console.log(response.content);
|
|
570
|
-
console.log(`Plan: ${response.plan?.subtasks.join(', ')}`);
|
|
571
|
-
console.log(`Tools used: ${response.toolsUsed.join(', ')}`);
|
|
572
|
-
|
|
573
|
-
// Cleanup
|
|
574
|
-
await agent.cleanup();
|
|
288
|
+
```bash
|
|
289
|
+
gcloud run services update jiva \
|
|
290
|
+
--set-env-vars JIVA_CODE_MODE=true \
|
|
291
|
+
--region us-central1
|
|
575
292
|
```
|
|
576
293
|
|
|
577
|
-
|
|
294
|
+
Full guide: [Cloud Run Deployment](docs/deployment/CLOUD_RUN_DEPLOYMENT.md)
|
|
578
295
|
|
|
579
|
-
|
|
296
|
+
---
|
|
580
297
|
|
|
581
|
-
|
|
582
|
-
## Development
|
|
298
|
+
## Personas and Skills
|
|
583
299
|
|
|
584
|
-
|
|
300
|
+
Jiva supports persona-based skill management, compatible with Claude's Skills/Plugins format:
|
|
585
301
|
|
|
586
302
|
```bash
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
### Development Mode
|
|
591
|
-
|
|
592
|
-
```bash
|
|
593
|
-
npm run dev
|
|
303
|
+
jiva persona list
|
|
304
|
+
jiva persona activate data-analyst
|
|
305
|
+
jiva persona create-skill my-skill --description "Custom capability" --author "Your Name"
|
|
594
306
|
```
|
|
595
307
|
|
|
596
|
-
|
|
308
|
+
Skills bundle MCP servers, directives, and model behavior overrides into portable `.skill` files. See [Personas Guide](docs/guides/PERSONAS.md).
|
|
597
309
|
|
|
598
|
-
|
|
599
|
-
npm run type-check
|
|
600
|
-
```
|
|
310
|
+
---
|
|
601
311
|
|
|
602
312
|
## Programmatic Usage
|
|
603
313
|
|
|
604
|
-
Jiva can also be used programmatically:
|
|
605
|
-
|
|
606
314
|
```typescript
|
|
607
|
-
import {
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
MCPServerManager,
|
|
612
|
-
WorkspaceManager,
|
|
613
|
-
ConversationManager,
|
|
614
|
-
} from 'jiva';
|
|
615
|
-
|
|
616
|
-
// Create models
|
|
315
|
+
import { DualAgent, CodeAgent, createKrutrimModel, ModelOrchestrator,
|
|
316
|
+
MCPServerManager, WorkspaceManager, ConversationManager,
|
|
317
|
+
createStorageProvider } from 'jiva-core';
|
|
318
|
+
|
|
617
319
|
const reasoningModel = createKrutrimModel({
|
|
618
|
-
endpoint: 'https://
|
|
619
|
-
apiKey:
|
|
620
|
-
model: 'gpt-oss-
|
|
320
|
+
endpoint: 'https://api.groq.com/openai/v1/chat/completions',
|
|
321
|
+
apiKey: process.env.API_KEY!,
|
|
322
|
+
model: 'openai/gpt-oss-20b',
|
|
621
323
|
type: 'reasoning',
|
|
622
324
|
});
|
|
623
|
-
|
|
624
|
-
// Create orchestrator
|
|
625
325
|
const orchestrator = new ModelOrchestrator({ reasoningModel });
|
|
326
|
+
const storageProvider = await createStorageProvider();
|
|
327
|
+
const workspace = new WorkspaceManager(storageProvider);
|
|
328
|
+
await workspace.initialize();
|
|
329
|
+
const conversationManager = new ConversationManager(storageProvider);
|
|
626
330
|
|
|
627
|
-
//
|
|
331
|
+
// General mode
|
|
628
332
|
const mcpManager = new MCPServerManager();
|
|
629
333
|
await mcpManager.initialize({
|
|
630
|
-
filesystem: {
|
|
631
|
-
command: 'npx',
|
|
632
|
-
args: ['-y', '@modelcontextprotocol/server-filesystem', process.cwd()],
|
|
633
|
-
enabled: true,
|
|
634
|
-
},
|
|
635
|
-
});
|
|
636
|
-
|
|
637
|
-
// Initialize workspace
|
|
638
|
-
const workspace = new WorkspaceManager({
|
|
639
|
-
workspaceDir: process.cwd(),
|
|
640
|
-
});
|
|
641
|
-
await workspace.initialize();
|
|
642
|
-
|
|
643
|
-
// Initialize conversation manager (optional)
|
|
644
|
-
const conversationManager = new ConversationManager();
|
|
645
|
-
await conversationManager.initialize();
|
|
646
|
-
|
|
647
|
-
// Create dual-agent
|
|
648
|
-
const agent = new DualAgent({
|
|
649
|
-
orchestrator,
|
|
650
|
-
mcpManager,
|
|
651
|
-
workspace,
|
|
652
|
-
conversationManager,
|
|
653
|
-
maxSubtasks: 10,
|
|
334
|
+
filesystem: { command: 'npx', args: ['-y', '@modelcontextprotocol/server-filesystem', process.cwd()], enabled: true },
|
|
654
335
|
});
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
const response = await agent.chat('Hello, Jiva!');
|
|
336
|
+
const agent = new DualAgent({ orchestrator, mcpManager, workspace, conversationManager });
|
|
337
|
+
const response = await agent.chat('What files are in this directory?');
|
|
658
338
|
console.log(response.content);
|
|
659
|
-
console.log(`Plan: ${response.plan?.subtasks.join(', ')}`);
|
|
660
|
-
console.log(`Tools used: ${response.toolsUsed.join(', ')}`);
|
|
661
|
-
|
|
662
|
-
// Cleanup
|
|
663
339
|
await agent.cleanup();
|
|
664
|
-
```
|
|
665
|
-
|
|
666
|
-
## Troubleshooting
|
|
667
|
-
|
|
668
|
-
### Tool Calls Not Working
|
|
669
340
|
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
4. **Logging**: Enable debug mode to see detailed tool call information
|
|
676
|
-
|
|
677
|
-
```bash
|
|
678
|
-
jiva chat --debug
|
|
341
|
+
// Code mode
|
|
342
|
+
const codeAgent = new CodeAgent({ orchestrator, workspace, conversationManager, maxIterations: 50, lspEnabled: true });
|
|
343
|
+
const codeResponse = await codeAgent.chat('Refactor the auth module to use async/await');
|
|
344
|
+
console.log(codeResponse.content);
|
|
345
|
+
await codeAgent.cleanup();
|
|
679
346
|
```
|
|
680
347
|
|
|
681
|
-
|
|
348
|
+
Both `DualAgent` and `CodeAgent` implement the `IAgent` interface and are interchangeable in application code.
|
|
682
349
|
|
|
683
|
-
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## Development
|
|
684
353
|
|
|
685
354
|
```bash
|
|
686
|
-
|
|
687
|
-
#
|
|
355
|
+
npm run build # compile TypeScript
|
|
356
|
+
npm run dev # watch mode
|
|
357
|
+
npm run type-check # type-check without emit
|
|
688
358
|
```
|
|
689
359
|
|
|
690
|
-
|
|
360
|
+
---
|
|
691
361
|
|
|
692
|
-
|
|
693
|
-
jiva chat --debug
|
|
694
|
-
```
|
|
362
|
+
## Documentation
|
|
695
363
|
|
|
696
|
-
|
|
364
|
+
| Document | Description |
|
|
365
|
+
|----------|-------------|
|
|
366
|
+
| [Quick Start](docs/guides/QUICKSTART.md) | Get running in 30 seconds |
|
|
367
|
+
| [Configuration Guide](docs/guides/CONFIGURATION.md) | All config options and provider examples |
|
|
368
|
+
| [Code Mode Architecture](docs/architecture/CODE_MODE.md) | How code mode works internally |
|
|
369
|
+
| [Cloud Run Deployment](docs/deployment/CLOUD_RUN_DEPLOYMENT.md) | Production deployment guide |
|
|
370
|
+
| [Personas Guide](docs/guides/PERSONAS.md) | Skills and persona system |
|
|
371
|
+
| [Troubleshooting](docs/guides/TROUBLESHOOTING.md) | Common issues and fixes |
|
|
372
|
+
| [Release Notes](docs/release_notes/) | Version history |
|
|
697
373
|
|
|
698
|
-
|
|
374
|
+
---
|
|
699
375
|
|
|
700
376
|
## Contributing
|
|
701
377
|
|
|
702
|
-
Contributions are welcome
|
|
703
|
-
|
|
704
|
-
1. Code follows TypeScript best practices
|
|
705
|
-
2. All new features include proper error handling
|
|
706
|
-
3. Documentation is updated
|
|
378
|
+
Contributions are welcome. Please ensure new features include error handling and that documentation is updated. Open a PR against the `develop` branch.
|
|
707
379
|
|
|
708
380
|
## License
|
|
709
381
|
|
|
@@ -715,13 +387,3 @@ MIT
|
|
|
715
387
|
- [Harmony Response Format](https://github.com/openai/harmony)
|
|
716
388
|
- [Model Context Protocol](https://modelcontextprotocol.io/)
|
|
717
389
|
- [Krutrim Cloud API](https://cloud.olakrutrim.com/)
|
|
718
|
-
|
|
719
|
-
## Sources
|
|
720
|
-
|
|
721
|
-
This implementation is based on research from:
|
|
722
|
-
|
|
723
|
-
- [OpenAI Harmony GitHub Repository](https://github.com/openai/harmony)
|
|
724
|
-
- [MCP with OpenAI gpt-oss](https://github.com/Vaibhavs10/mcp-with-openai-gpt-oss)
|
|
725
|
-
- [OpenAI Cookbook - Harmony Format](https://cookbook.openai.com/articles/openai-harmony)
|
|
726
|
-
- [MCP Best Practices](https://modelcontextprotocol.info/docs/best-practices/)
|
|
727
|
-
- [vLLM GPT-OSS Documentation](https://docs.vllm.ai/projects/recipes/en/latest/OpenAI/GPT-OSS.html)
|