@enderfga/openclaw-claude-code 2.0.0
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/LICENSE +21 -0
- package/README.md +179 -0
- package/dist/bin/cli.d.ts +10 -0
- package/dist/bin/cli.js +301 -0
- package/dist/bin/cli.js.map +1 -0
- package/dist/src/embedded-server.d.ts +19 -0
- package/dist/src/embedded-server.js +190 -0
- package/dist/src/embedded-server.js.map +1 -0
- package/dist/src/hooks/prompt-bypass.d.ts +20 -0
- package/dist/src/hooks/prompt-bypass.js +37 -0
- package/dist/src/hooks/prompt-bypass.js.map +1 -0
- package/dist/src/index.d.ts +47 -0
- package/dist/src/index.js +230 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/persistent-session.d.ts +100 -0
- package/dist/src/persistent-session.js +563 -0
- package/dist/src/persistent-session.js.map +1 -0
- package/dist/src/proxy/anthropic-adapter.d.ts +136 -0
- package/dist/src/proxy/anthropic-adapter.js +394 -0
- package/dist/src/proxy/anthropic-adapter.js.map +1 -0
- package/dist/src/proxy/handler.d.ts +39 -0
- package/dist/src/proxy/handler.js +261 -0
- package/dist/src/proxy/handler.js.map +1 -0
- package/dist/src/proxy/schema-cleaner.d.ts +11 -0
- package/dist/src/proxy/schema-cleaner.js +34 -0
- package/dist/src/proxy/schema-cleaner.js.map +1 -0
- package/dist/src/proxy/thought-cache.d.ts +19 -0
- package/dist/src/proxy/thought-cache.js +53 -0
- package/dist/src/proxy/thought-cache.js.map +1 -0
- package/dist/src/session-manager.d.ts +79 -0
- package/dist/src/session-manager.js +329 -0
- package/dist/src/session-manager.js.map +1 -0
- package/dist/src/types.d.ts +160 -0
- package/dist/src/types.js +20 -0
- package/dist/src/types.js.map +1 -0
- package/openclaw.plugin.json +76 -0
- package/package.json +46 -0
- package/skills/SKILL.md +594 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 enderfga
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# openclaw-claude-code
|
|
2
|
+
|
|
3
|
+
Full-featured Claude Code integration for OpenClaw — session management, agent teams, multi-model proxy, and plan mode workflows.
|
|
4
|
+
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
## What is this?
|
|
8
|
+
|
|
9
|
+
An OpenClaw native plugin that turns Anthropic's Claude Code CLI into a **programmable, headless coding engine**. Your AI agents get 10 tools to drive Claude Code sessions — start, send messages, manage context, coordinate agent teams, and more.
|
|
10
|
+
|
|
11
|
+
Works as:
|
|
12
|
+
- **OpenClaw Plugin** — install once, agents get `claude_session_*` tools automatically
|
|
13
|
+
- **Standalone CLI** — `claude-code-skill serve` + CLI commands, no OpenClaw needed
|
|
14
|
+
- **TypeScript library** — `import { SessionManager } from '@enderfga/openclaw-claude-code'`
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
### As OpenClaw Plugin
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
openclaw plugins install @enderfga/openclaw-claude-code
|
|
22
|
+
openclaw gateway restart
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
That's it. Your agents can now use `claude_session_start`, `claude_session_send`, etc.
|
|
26
|
+
|
|
27
|
+
### Standalone (no OpenClaw)
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install -g @enderfga/openclaw-claude-code
|
|
31
|
+
|
|
32
|
+
# Start the embedded server
|
|
33
|
+
claude-code-skill serve
|
|
34
|
+
|
|
35
|
+
# Use CLI commands
|
|
36
|
+
claude-code-skill session-start myproject -d ~/project
|
|
37
|
+
claude-code-skill session-send myproject "fix the auth bug"
|
|
38
|
+
claude-code-skill session-stop myproject
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Tools (10)
|
|
42
|
+
|
|
43
|
+
| Tool | Description |
|
|
44
|
+
|------|-------------|
|
|
45
|
+
| `claude_session_start` | Start a session with full CLI flag support (model, effort, worktree, bare, agent teams, etc.) |
|
|
46
|
+
| `claude_session_send` | Send a message and get the response |
|
|
47
|
+
| `claude_session_stop` | Stop a session |
|
|
48
|
+
| `claude_session_list` | List active sessions |
|
|
49
|
+
| `claude_session_status` | Status with context %, tokens, cost, uptime |
|
|
50
|
+
| `claude_session_grep` | Search session history by regex |
|
|
51
|
+
| `claude_session_compact` | Compact session to reclaim context window |
|
|
52
|
+
| `claude_agents_list` | List agent definitions from `.claude/agents/` |
|
|
53
|
+
| `claude_team_list` | List teammates in an agent team session |
|
|
54
|
+
| `claude_team_send` | Send message to a specific teammate |
|
|
55
|
+
|
|
56
|
+
## CLI Commands
|
|
57
|
+
|
|
58
|
+
### Session Management
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
claude-code-skill session-start [name] [options]
|
|
62
|
+
claude-code-skill session-send <name> <message> [--effort high] [--plan]
|
|
63
|
+
claude-code-skill session-stop <name>
|
|
64
|
+
claude-code-skill session-list
|
|
65
|
+
claude-code-skill session-status <name>
|
|
66
|
+
claude-code-skill session-grep <name> <pattern>
|
|
67
|
+
claude-code-skill session-compact <name> [--summary <text>]
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Agent / Skill / Rule Management
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
claude-code-skill agents-list [-d <dir>]
|
|
74
|
+
claude-code-skill agents-create <name> [--description <desc>] [--prompt <prompt>]
|
|
75
|
+
claude-code-skill skills-list [-d <dir>]
|
|
76
|
+
claude-code-skill skills-create <name> [--description <desc>] [--prompt <prompt>]
|
|
77
|
+
claude-code-skill rules-list [-d <dir>]
|
|
78
|
+
claude-code-skill rules-create <name> [--paths "*.py"] [--condition "Bash(git *)"]
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Agent Teams
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
claude-code-skill session-start team -d ~/project --enable-agent-teams
|
|
85
|
+
claude-code-skill session-team-list <name>
|
|
86
|
+
claude-code-skill session-team-send <name> <teammate> <message>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Session Start Flags
|
|
90
|
+
|
|
91
|
+
All Claude Code CLI flags are supported:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
claude-code-skill session-start myproject \
|
|
95
|
+
-d ~/project \
|
|
96
|
+
-m opus \
|
|
97
|
+
--effort high \
|
|
98
|
+
--bare \
|
|
99
|
+
--worktree \
|
|
100
|
+
--fallback-model sonnet \
|
|
101
|
+
--json-schema '{"type":"object","properties":{"name":{"type":"string"}}}' \
|
|
102
|
+
--mcp-config ./mcp.json \
|
|
103
|
+
--settings ./settings.json \
|
|
104
|
+
--skip-persistence \
|
|
105
|
+
--betas "max-tokens-3-5-sonnet-2024-07-15" \
|
|
106
|
+
--enable-agent-teams \
|
|
107
|
+
--allowed-tools Bash,Read,Edit \
|
|
108
|
+
--max-turns 50 \
|
|
109
|
+
--max-budget 5.00
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Multi-Model Proxy
|
|
113
|
+
|
|
114
|
+
Built-in Anthropic-to-OpenAI format translation. Claude Code CLI talks Anthropic format; the proxy converts to/from OpenAI format for Gemini, GPT, and other models.
|
|
115
|
+
|
|
116
|
+
- Pure TypeScript, zero Python dependency
|
|
117
|
+
- Streaming SSE conversion
|
|
118
|
+
- Gemini tool schema cleaning
|
|
119
|
+
- Thought signature caching (Gemini round-trip)
|
|
120
|
+
- Gateway passthrough mode (OpenClaw handles routing)
|
|
121
|
+
|
|
122
|
+
## Architecture
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
openclaw-claude-code/
|
|
126
|
+
├── src/
|
|
127
|
+
│ ├── index.ts # Plugin entry — 10 tools + hooks + proxy route
|
|
128
|
+
│ ├── types.ts # Shared types, model pricing/aliases
|
|
129
|
+
│ ├── persistent-session.ts # Claude CLI subprocess management
|
|
130
|
+
│ ├── session-manager.ts # Pure class, manages multiple sessions
|
|
131
|
+
│ ├── embedded-server.ts # Auto-start HTTP server for CLI
|
|
132
|
+
│ ├── hooks/
|
|
133
|
+
│ │ └── prompt-bypass.ts # Passthrough workspace hook
|
|
134
|
+
│ └── proxy/
|
|
135
|
+
│ ├── handler.ts # HTTP route handler
|
|
136
|
+
│ ├── anthropic-adapter.ts # Anthropic ↔ OpenAI format conversion
|
|
137
|
+
│ ├── schema-cleaner.ts # Gemini schema compatibility
|
|
138
|
+
│ └── thought-cache.ts # Gemini thought signature cache
|
|
139
|
+
├── bin/
|
|
140
|
+
│ └── cli.ts # CLI (HTTP client to embedded server)
|
|
141
|
+
├── skills/
|
|
142
|
+
│ └── SKILL.md # Bundled skill for plan mode workflows
|
|
143
|
+
├── openclaw.plugin.json # Plugin manifest
|
|
144
|
+
└── package.json
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Configuration (OpenClaw)
|
|
148
|
+
|
|
149
|
+
In `~/.openclaw/openclaw.json`:
|
|
150
|
+
|
|
151
|
+
```jsonc
|
|
152
|
+
{
|
|
153
|
+
"plugins": {
|
|
154
|
+
"entries": {
|
|
155
|
+
"openclaw-claude-code": {
|
|
156
|
+
"enabled": true,
|
|
157
|
+
"config": {
|
|
158
|
+
"claudeBin": "claude",
|
|
159
|
+
"defaultModel": "claude-opus-4-6",
|
|
160
|
+
"defaultPermissionMode": "acceptEdits",
|
|
161
|
+
"defaultEffort": "auto",
|
|
162
|
+
"maxConcurrentSessions": 5,
|
|
163
|
+
"sessionTtlMinutes": 120
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Requirements
|
|
172
|
+
|
|
173
|
+
- Node.js >= 22
|
|
174
|
+
- Claude Code CLI installed (`npm install -g @anthropic-ai/claude-code`)
|
|
175
|
+
- OpenClaw >= 2026.3.0 (for plugin mode, optional)
|
|
176
|
+
|
|
177
|
+
## License
|
|
178
|
+
|
|
179
|
+
MIT
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* claude-code-skill CLI — connects to the embedded server (auto-started by plugin)
|
|
4
|
+
*
|
|
5
|
+
* When the plugin is installed, the embedded server starts automatically.
|
|
6
|
+
* This CLI is just an HTTP client — zero configuration needed.
|
|
7
|
+
*
|
|
8
|
+
* For standalone use (no OpenClaw), run: claude-code-skill serve
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
package/dist/bin/cli.js
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* claude-code-skill CLI — connects to the embedded server (auto-started by plugin)
|
|
4
|
+
*
|
|
5
|
+
* When the plugin is installed, the embedded server starts automatically.
|
|
6
|
+
* This CLI is just an HTTP client — zero configuration needed.
|
|
7
|
+
*
|
|
8
|
+
* For standalone use (no OpenClaw), run: claude-code-skill serve
|
|
9
|
+
*/
|
|
10
|
+
import { Command } from 'commander';
|
|
11
|
+
const BASE_URL = process.env.CLAUDE_CODE_API_URL || 'http://127.0.0.1:18796';
|
|
12
|
+
// ─── HTTP Client ─────────────────────────────────────────────────────────────
|
|
13
|
+
async function api(path, method = 'GET', body) {
|
|
14
|
+
const opts = {
|
|
15
|
+
method,
|
|
16
|
+
headers: { 'Content-Type': 'application/json' },
|
|
17
|
+
};
|
|
18
|
+
if (body)
|
|
19
|
+
opts.body = JSON.stringify(body);
|
|
20
|
+
try {
|
|
21
|
+
const resp = await fetch(`${BASE_URL}${path}`, opts);
|
|
22
|
+
return await resp.json();
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return { ok: false, error: `Cannot connect to ${BASE_URL} — is the plugin running?` };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// ─── CLI ─────────────────────────────────────────────────────────────────────
|
|
29
|
+
const program = new Command();
|
|
30
|
+
program.name('claude-code-skill').description('Claude Code SDK CLI').version('2.0.0');
|
|
31
|
+
// Serve (standalone mode — no OpenClaw needed)
|
|
32
|
+
program
|
|
33
|
+
.command('serve')
|
|
34
|
+
.description('Start standalone embedded server (for use without OpenClaw)')
|
|
35
|
+
.option('-p, --port <port>', 'Port', '18796')
|
|
36
|
+
.action(async (opts) => {
|
|
37
|
+
const { SessionManager } = await import('../src/session-manager.js');
|
|
38
|
+
const { EmbeddedServer } = await import('../src/embedded-server.js');
|
|
39
|
+
const manager = new SessionManager();
|
|
40
|
+
const server = new EmbeddedServer(manager, parseInt(opts.port));
|
|
41
|
+
const port = await server.start();
|
|
42
|
+
if (port) {
|
|
43
|
+
console.log(`Standalone server running on http://127.0.0.1:${port}`);
|
|
44
|
+
console.log('Press Ctrl+C to stop');
|
|
45
|
+
process.on('SIGINT', async () => { await server.stop(); await manager.shutdown(); process.exit(0); });
|
|
46
|
+
process.on('SIGTERM', async () => { await server.stop(); await manager.shutdown(); process.exit(0); });
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
// Session commands
|
|
50
|
+
program
|
|
51
|
+
.command('session-start [name]')
|
|
52
|
+
.description('Start a persistent Claude Code session')
|
|
53
|
+
.option('-d, --cwd <dir>', 'Working directory')
|
|
54
|
+
.option('-m, --model <model>', 'Model to use')
|
|
55
|
+
.option('--permission-mode <mode>', 'Permission mode', 'acceptEdits')
|
|
56
|
+
.option('--effort <level>', 'Effort level')
|
|
57
|
+
.option('--allowed-tools <tools>', 'Comma-separated tools to auto-approve')
|
|
58
|
+
.option('--max-turns <n>', 'Max agent loop turns')
|
|
59
|
+
.option('--max-budget <usd>', 'Max API spend')
|
|
60
|
+
.option('--system-prompt <prompt>', 'Replace system prompt')
|
|
61
|
+
.option('--append-system-prompt <prompt>', 'Append to system prompt')
|
|
62
|
+
.option('--agents <json>', 'Custom sub-agents JSON')
|
|
63
|
+
.option('--agent <name>', 'Default agent')
|
|
64
|
+
.option('--bare', 'Minimal mode')
|
|
65
|
+
.option('-w, --worktree [name]', 'Git worktree')
|
|
66
|
+
.option('--fallback-model <model>', 'Fallback model')
|
|
67
|
+
.option('--json-schema <schema>', 'JSON Schema for structured output')
|
|
68
|
+
.option('--mcp-config <paths>', 'MCP config files')
|
|
69
|
+
.option('--settings <pathOrJson>', 'Settings.json')
|
|
70
|
+
.option('--skip-persistence', 'Disable session persistence')
|
|
71
|
+
.option('--betas <headers>', 'Custom beta headers')
|
|
72
|
+
.option('--enable-agent-teams', 'Enable agent teams')
|
|
73
|
+
.action(async (name, opts) => {
|
|
74
|
+
const body = { name: name || `session-${Date.now()}` };
|
|
75
|
+
if (opts.cwd)
|
|
76
|
+
body.cwd = opts.cwd;
|
|
77
|
+
if (opts.model)
|
|
78
|
+
body.model = opts.model;
|
|
79
|
+
if (opts.permissionMode)
|
|
80
|
+
body.permissionMode = opts.permissionMode;
|
|
81
|
+
if (opts.effort)
|
|
82
|
+
body.effort = opts.effort;
|
|
83
|
+
if (opts.allowedTools)
|
|
84
|
+
body.allowedTools = opts.allowedTools.split(',');
|
|
85
|
+
if (opts.maxTurns)
|
|
86
|
+
body.maxTurns = parseInt(opts.maxTurns);
|
|
87
|
+
if (opts.maxBudget)
|
|
88
|
+
body.maxBudgetUsd = parseFloat(opts.maxBudget);
|
|
89
|
+
if (opts.systemPrompt)
|
|
90
|
+
body.systemPrompt = opts.systemPrompt;
|
|
91
|
+
if (opts.appendSystemPrompt)
|
|
92
|
+
body.appendSystemPrompt = opts.appendSystemPrompt;
|
|
93
|
+
if (opts.agents)
|
|
94
|
+
body.agents = JSON.parse(opts.agents);
|
|
95
|
+
if (opts.agent)
|
|
96
|
+
body.agent = opts.agent;
|
|
97
|
+
if (opts.bare)
|
|
98
|
+
body.bare = true;
|
|
99
|
+
if (opts.worktree !== undefined)
|
|
100
|
+
body.worktree = typeof opts.worktree === 'string' ? opts.worktree : true;
|
|
101
|
+
if (opts.fallbackModel)
|
|
102
|
+
body.fallbackModel = opts.fallbackModel;
|
|
103
|
+
if (opts.jsonSchema)
|
|
104
|
+
body.jsonSchema = opts.jsonSchema;
|
|
105
|
+
if (opts.mcpConfig)
|
|
106
|
+
body.mcpConfig = opts.mcpConfig.split(',');
|
|
107
|
+
if (opts.settings)
|
|
108
|
+
body.settings = opts.settings;
|
|
109
|
+
if (opts.skipPersistence)
|
|
110
|
+
body.noSessionPersistence = true;
|
|
111
|
+
if (opts.betas)
|
|
112
|
+
body.betas = opts.betas.split(',');
|
|
113
|
+
if (opts.enableAgentTeams)
|
|
114
|
+
body.enableAgentTeams = true;
|
|
115
|
+
const result = await api('/session/start', 'POST', body);
|
|
116
|
+
if (result.ok) {
|
|
117
|
+
console.log(`Session '${body.name}' started!`);
|
|
118
|
+
if (result.claudeSessionId)
|
|
119
|
+
console.log(`Claude Session ID: ${result.claudeSessionId}`);
|
|
120
|
+
}
|
|
121
|
+
else
|
|
122
|
+
console.error(`Failed: ${result.error}`);
|
|
123
|
+
});
|
|
124
|
+
program
|
|
125
|
+
.command('session-send <name> <message>')
|
|
126
|
+
.description('Send a message to a session')
|
|
127
|
+
.option('--effort <level>', 'Effort level')
|
|
128
|
+
.option('--plan', 'Plan mode')
|
|
129
|
+
.option('-t, --timeout <ms>', 'Timeout', '300000')
|
|
130
|
+
.action(async (name, message, opts) => {
|
|
131
|
+
const result = await api('/session/send', 'POST', {
|
|
132
|
+
name, message, effort: opts.effort, plan: opts.plan, timeout: parseInt(opts.timeout),
|
|
133
|
+
});
|
|
134
|
+
if (result.ok)
|
|
135
|
+
console.log(result.output);
|
|
136
|
+
else
|
|
137
|
+
console.error(`Failed: ${result.error}`);
|
|
138
|
+
});
|
|
139
|
+
program.command('session-stop <name>').description('Stop a session')
|
|
140
|
+
.action(async (name) => {
|
|
141
|
+
const r = await api('/session/stop', 'POST', { name });
|
|
142
|
+
if (r.ok)
|
|
143
|
+
console.log(`Session '${name}' stopped.`);
|
|
144
|
+
else
|
|
145
|
+
console.error(`Failed: ${r.error}`);
|
|
146
|
+
});
|
|
147
|
+
program.command('session-list').description('List sessions')
|
|
148
|
+
.action(async () => {
|
|
149
|
+
const r = await api('/session/list');
|
|
150
|
+
if (!r.ok) {
|
|
151
|
+
console.error(`Failed: ${r.error}`);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const sessions = r.sessions;
|
|
155
|
+
if (!sessions.length) {
|
|
156
|
+
console.log('No active sessions.');
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
for (const s of sessions)
|
|
160
|
+
console.log(` ${s.name} — ${s.model || 'default'} (${s.cwd})`);
|
|
161
|
+
});
|
|
162
|
+
program.command('session-status <name>').description('Get session status')
|
|
163
|
+
.action(async (name) => {
|
|
164
|
+
const r = await api('/session/status', 'POST', { name });
|
|
165
|
+
if (!r.ok) {
|
|
166
|
+
console.error(`Failed: ${r.error}`);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const s = r.stats;
|
|
170
|
+
console.log(`Session: ${name}`);
|
|
171
|
+
console.log(` Turns: ${s.turns}, Tools: ${s.toolCalls}, Cost: $${s.costUsd}`);
|
|
172
|
+
console.log(` Tokens: ${s.tokensIn} in / ${s.tokensOut} out`);
|
|
173
|
+
console.log(` Uptime: ${s.uptime}s`);
|
|
174
|
+
});
|
|
175
|
+
program.command('session-grep <name> <pattern>').description('Search session history')
|
|
176
|
+
.option('-n, --limit <n>', 'Max results', '50')
|
|
177
|
+
.action(async (name, pattern, opts) => {
|
|
178
|
+
const r = await api('/session/grep', 'POST', { name, pattern, limit: parseInt(opts.limit) });
|
|
179
|
+
if (!r.ok) {
|
|
180
|
+
console.error(`Failed: ${r.error}`);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
console.log(`Found ${r.count} match(es)`);
|
|
184
|
+
for (const m of r.matches)
|
|
185
|
+
console.log(` [${m.time}] ${m.type}`);
|
|
186
|
+
});
|
|
187
|
+
program.command('session-compact <name>').description('Compact session')
|
|
188
|
+
.option('--summary <text>', 'Custom summary')
|
|
189
|
+
.action(async (name, opts) => {
|
|
190
|
+
const r = await api('/session/compact', 'POST', { name, summary: opts.summary });
|
|
191
|
+
if (r.ok)
|
|
192
|
+
console.log('Compacted.');
|
|
193
|
+
else
|
|
194
|
+
console.error(`Failed: ${r.error}`);
|
|
195
|
+
});
|
|
196
|
+
// Agent management
|
|
197
|
+
program.command('agents-list').description('List agents').option('-d, --cwd <dir>')
|
|
198
|
+
.action(async (opts) => {
|
|
199
|
+
const q = opts.cwd ? `?cwd=${encodeURIComponent(opts.cwd)}` : '';
|
|
200
|
+
const r = await api(`/agents${q}`);
|
|
201
|
+
if (!r.ok) {
|
|
202
|
+
console.error(`Failed: ${r.error}`);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
const agents = r.agents;
|
|
206
|
+
if (!agents.length) {
|
|
207
|
+
console.log('No agents found.');
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
for (const a of agents)
|
|
211
|
+
console.log(` ${a.name}${a.description ? ` — ${a.description}` : ''}`);
|
|
212
|
+
});
|
|
213
|
+
program.command('agents-create <name>').description('Create agent')
|
|
214
|
+
.option('-d, --cwd <dir>').option('--description <desc>').option('--prompt <prompt>')
|
|
215
|
+
.action(async (name, opts) => {
|
|
216
|
+
const r = await api('/agents/create', 'POST', { name, cwd: opts.cwd, description: opts.description, prompt: opts.prompt });
|
|
217
|
+
if (r.ok)
|
|
218
|
+
console.log(`Agent '${name}' created at: ${r.path}`);
|
|
219
|
+
else
|
|
220
|
+
console.error(`Failed: ${r.error}`);
|
|
221
|
+
});
|
|
222
|
+
// Skills
|
|
223
|
+
program.command('skills-list').description('List skills').option('-d, --cwd <dir>')
|
|
224
|
+
.action(async (opts) => {
|
|
225
|
+
const q = opts.cwd ? `?cwd=${encodeURIComponent(opts.cwd)}` : '';
|
|
226
|
+
const r = await api(`/skills${q}`);
|
|
227
|
+
if (!r.ok) {
|
|
228
|
+
console.error(`Failed: ${r.error}`);
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
const skills = r.skills;
|
|
232
|
+
if (!skills.length) {
|
|
233
|
+
console.log('No skills found.');
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
for (const s of skills)
|
|
237
|
+
console.log(` ${s.name}${s.description ? ` — ${s.description}` : ''}`);
|
|
238
|
+
});
|
|
239
|
+
program.command('skills-create <name>').description('Create skill')
|
|
240
|
+
.option('-d, --cwd <dir>').option('--description <desc>').option('--prompt <prompt>').option('--trigger <t>')
|
|
241
|
+
.action(async (name, opts) => {
|
|
242
|
+
const r = await api('/skills/create', 'POST', { name, cwd: opts.cwd, description: opts.description, prompt: opts.prompt, trigger: opts.trigger });
|
|
243
|
+
if (r.ok)
|
|
244
|
+
console.log(`Skill '${name}' created at: ${r.path}`);
|
|
245
|
+
else
|
|
246
|
+
console.error(`Failed: ${r.error}`);
|
|
247
|
+
});
|
|
248
|
+
// Rules
|
|
249
|
+
program.command('rules-list').description('List rules').option('-d, --cwd <dir>')
|
|
250
|
+
.action(async (opts) => {
|
|
251
|
+
const q = opts.cwd ? `?cwd=${encodeURIComponent(opts.cwd)}` : '';
|
|
252
|
+
const r = await api(`/rules${q}`);
|
|
253
|
+
if (!r.ok) {
|
|
254
|
+
console.error(`Failed: ${r.error}`);
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
const rules = r.rules;
|
|
258
|
+
if (!rules.length) {
|
|
259
|
+
console.log('No rules found.');
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
for (const rule of rules) {
|
|
263
|
+
let info = ` ${rule.name}`;
|
|
264
|
+
if (rule.description)
|
|
265
|
+
info += ` — ${rule.description}`;
|
|
266
|
+
if (rule.paths)
|
|
267
|
+
info += ` [paths: ${rule.paths}]`;
|
|
268
|
+
if (rule.condition)
|
|
269
|
+
info += ` [if: ${rule.condition}]`;
|
|
270
|
+
console.log(info);
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
program.command('rules-create <name>').description('Create rule')
|
|
274
|
+
.option('-d, --cwd <dir>').option('--description <desc>').option('--content <text>')
|
|
275
|
+
.option('--paths <glob>').option('--condition <expr>')
|
|
276
|
+
.action(async (name, opts) => {
|
|
277
|
+
const r = await api('/rules/create', 'POST', { name, cwd: opts.cwd, description: opts.description, content: opts.content, paths: opts.paths, condition: opts.condition });
|
|
278
|
+
if (r.ok)
|
|
279
|
+
console.log(`Rule '${name}' created at: ${r.path}`);
|
|
280
|
+
else
|
|
281
|
+
console.error(`Failed: ${r.error}`);
|
|
282
|
+
});
|
|
283
|
+
// Agent teams
|
|
284
|
+
program.command('session-team-list <name>').description('List teammates')
|
|
285
|
+
.action(async (name) => {
|
|
286
|
+
const r = await api('/session/team-list', 'POST', { name });
|
|
287
|
+
if (r.ok)
|
|
288
|
+
console.log(r.response || 'No team info');
|
|
289
|
+
else
|
|
290
|
+
console.error(`Failed: ${r.error}`);
|
|
291
|
+
});
|
|
292
|
+
program.command('session-team-send <name> <teammate> <message>').description('Message teammate')
|
|
293
|
+
.action(async (name, teammate, message) => {
|
|
294
|
+
const r = await api('/session/team-send', 'POST', { name, teammate, message });
|
|
295
|
+
if (r.ok)
|
|
296
|
+
console.log(r.output || 'Sent');
|
|
297
|
+
else
|
|
298
|
+
console.error(`Failed: ${r.error}`);
|
|
299
|
+
});
|
|
300
|
+
program.parse();
|
|
301
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../bin/cli.ts"],"names":[],"mappings":";AACA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,wBAAwB,CAAC;AAE7E,gFAAgF;AAEhF,KAAK,UAAU,GAAG,CAAC,IAAY,EAAE,MAAM,GAAG,KAAK,EAAE,IAAc;IAC7D,MAAM,IAAI,GAAgB;QACxB,MAAM;QACN,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;KAChD,CAAC;IACF,IAAI,IAAI;QAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,GAAG,QAAQ,GAAG,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC;QACrD,OAAO,MAAM,IAAI,CAAC,IAAI,EAA6B,CAAC;IACtD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,qBAAqB,QAAQ,2BAA2B,EAAE,CAAC;IACxF,CAAC;AACH,CAAC;AAED,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AW,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;AACtF,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Embedded HTTP Server — auto-starts with plugin, serves CLI commands
|
|
3
|
+
*
|
|
4
|
+
* This is NOT a separate process. It runs inside the plugin (or standalone)
|
|
5
|
+
* and provides HTTP endpoints for the CLI to connect to.
|
|
6
|
+
*
|
|
7
|
+
* Users never need to configure or manage this — it just works.
|
|
8
|
+
*/
|
|
9
|
+
import { SessionManager } from './session-manager.js';
|
|
10
|
+
export declare class EmbeddedServer {
|
|
11
|
+
private server;
|
|
12
|
+
private manager;
|
|
13
|
+
private port;
|
|
14
|
+
constructor(manager: SessionManager, port?: number);
|
|
15
|
+
start(): Promise<number>;
|
|
16
|
+
stop(): Promise<void>;
|
|
17
|
+
private handleRequest;
|
|
18
|
+
private route;
|
|
19
|
+
}
|