@bytespell/amux 0.0.18 → 0.0.20
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/dist/types.d.ts +3 -64
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -23
- package/dist/types.js.map +1 -1
- package/package.json +3 -4
- package/src/types.ts +18 -94
- package/tsconfig.json +6 -16
- package/tsconfig.tsbuildinfo +1 -0
- package/.claude/settings.local.json +0 -17
- package/CLAUDE.md +0 -104
- package/LICENSE +0 -21
- package/README.md +0 -234
- package/dist/cli.d.ts +0 -14
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -118
- package/dist/cli.js.map +0 -1
- package/dist/message-parser.test.d.ts +0 -2
- package/dist/message-parser.test.d.ts.map +0 -1
- package/dist/message-parser.test.js +0 -188
- package/dist/message-parser.test.js.map +0 -1
- package/dist/server.d.ts +0 -24
- package/dist/server.d.ts.map +0 -1
- package/dist/server.js +0 -356
- package/dist/server.js.map +0 -1
- package/dist/session-updates.test.d.ts +0 -2
- package/dist/session-updates.test.d.ts.map +0 -1
- package/dist/session-updates.test.js +0 -223
- package/dist/session-updates.test.js.map +0 -1
package/README.md
DELETED
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
# amux
|
|
2
|
-
|
|
3
|
-
**ACP Multiplexer** - the session layer for ACP agents.
|
|
4
|
-
|
|
5
|
-
The [ACP TypeScript SDK](https://github.com/agentclientprotocol/typescript-sdk) does the hard work of getting the protocol right - json-rpc transport, type definitions, connection lifecycle. But there's a gap between "I can send messages to an agent" and "I can manage agent sessions in my app".
|
|
6
|
-
|
|
7
|
-
amux fills that gap. Think tmux for agents - spawn sessions, detach, reattach later, pick up where you left off.
|
|
8
|
-
|
|
9
|
-
Everything the SDK doesn't do:
|
|
10
|
-
- Spawn and manage agent processes (the SDK gives you a connection, not a process)
|
|
11
|
-
- Persist session state to disk (detach and reattach later)
|
|
12
|
-
- Replay history on reconnect (your UI picks up where it left off)
|
|
13
|
-
- Handle permission requests with pluggable strategies
|
|
14
|
-
- Switch between agents (Claude Code, Codex, Pi) without changing your code
|
|
15
|
-
|
|
16
|
-
Transport-agnostic core with an optional WebSocket adapter.
|
|
17
|
-
|
|
18
|
-
## Installation
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
npm install @bytespell/amux
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
You'll also need at least one ACP agent installed and available on your PATH:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
# Claude Code
|
|
28
|
-
npm install -g @anthropics/claude-code
|
|
29
|
-
|
|
30
|
-
# Codex
|
|
31
|
-
npm install -g @openai/codex
|
|
32
|
-
|
|
33
|
-
# Pi
|
|
34
|
-
npm install -g @mariozechner/pi-coding-agent
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
amux automatically detects which agents are installed by checking your PATH.
|
|
38
|
-
|
|
39
|
-
## Quick Start
|
|
40
|
-
|
|
41
|
-
### With WebSocket Adapter
|
|
42
|
-
|
|
43
|
-
```typescript
|
|
44
|
-
import { AgentSession, createWsAdapter } from '@bytespell/amux';
|
|
45
|
-
import { WebSocketServer } from 'ws';
|
|
46
|
-
import { createServer } from 'http';
|
|
47
|
-
|
|
48
|
-
const server = createServer();
|
|
49
|
-
const wss = new WebSocketServer({ server, path: '/ws' });
|
|
50
|
-
|
|
51
|
-
const session = new AgentSession({
|
|
52
|
-
instanceId: process.env.INSTANCE_ID ?? 'default',
|
|
53
|
-
systemContext: 'You are a helpful assistant...',
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// Wire up WebSocket
|
|
57
|
-
createWsAdapter(session, wss);
|
|
58
|
-
|
|
59
|
-
// Start the agent
|
|
60
|
-
await session.spawnAgent();
|
|
61
|
-
|
|
62
|
-
server.listen(3000);
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### Events Only (Bring Your Own Transport)
|
|
66
|
-
|
|
67
|
-
```typescript
|
|
68
|
-
import { AgentSession } from '@bytespell/amux';
|
|
69
|
-
|
|
70
|
-
const session = new AgentSession({
|
|
71
|
-
instanceId: 'my-instance',
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
// Subscribe to events
|
|
75
|
-
session.on('ready', (data) => {
|
|
76
|
-
console.log('Agent ready:', data.agent.name);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
session.on('update', (update) => {
|
|
80
|
-
// Handle streaming updates
|
|
81
|
-
if (update.sessionUpdate === 'agent_message_chunk') {
|
|
82
|
-
process.stdout.write(update.content.text);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
session.on('permission_request', (data) => {
|
|
87
|
-
// Auto-approve for demo
|
|
88
|
-
session.respondToPermission(data.requestId, data.options[0].optionId);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
session.on('error', (data) => {
|
|
92
|
-
console.error('Error:', data.message);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
// Start and prompt
|
|
96
|
-
await session.spawnAgent();
|
|
97
|
-
await session.prompt('Hello, what can you do?');
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
## API
|
|
101
|
-
|
|
102
|
-
### `AgentSession`
|
|
103
|
-
|
|
104
|
-
Core class for managing an ACP agent session. Extends `EventEmitter`.
|
|
105
|
-
|
|
106
|
-
```typescript
|
|
107
|
-
const session = new AgentSession({
|
|
108
|
-
instanceId: string; // Unique ID for state isolation
|
|
109
|
-
systemContext?: string; // Injected context for the agent
|
|
110
|
-
fixedCwd?: string; // Lock working directory
|
|
111
|
-
agentType?: string; // 'claude-code' | 'codex' | 'pi'
|
|
112
|
-
stateDir?: string; // Custom state directory
|
|
113
|
-
});
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
#### Methods
|
|
117
|
-
|
|
118
|
-
```typescript
|
|
119
|
-
await session.spawnAgent() // Start the agent process
|
|
120
|
-
await session.prompt(message) // Send a prompt
|
|
121
|
-
await session.cancel() // Cancel current operation
|
|
122
|
-
session.respondToPermission(id, optId) // Respond to permission request
|
|
123
|
-
await session.newSession() // Create new session
|
|
124
|
-
await session.changeCwd(path) // Change working directory
|
|
125
|
-
await session.changeAgent(type) // Switch agent type
|
|
126
|
-
session.listSessions() // List available sessions
|
|
127
|
-
session.loadHistory() // Get current session history
|
|
128
|
-
session.getAvailableAgents() // All agents with installed status
|
|
129
|
-
session.getInstalledAgents() // Only agents ready to use
|
|
130
|
-
session.shutdown() // Cleanup and stop
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
#### Agent Discovery
|
|
134
|
-
|
|
135
|
-
amux bundles ACP wrappers for supported agents. Use `getInstalledAgents()` to find which agents are ready to use (base CLI on PATH + ACP wrapper bundled):
|
|
136
|
-
|
|
137
|
-
```typescript
|
|
138
|
-
const agents = session.getInstalledAgents();
|
|
139
|
-
// [{ id: 'claude-code', name: 'Claude Code' }, ...]
|
|
140
|
-
|
|
141
|
-
const allAgents = session.getAvailableAgents();
|
|
142
|
-
// [{ id: 'claude-code', name: 'Claude Code', installed: true }, ...]
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
The `ready` event also includes `availableAgents` (same as `getInstalledAgents()`).
|
|
146
|
-
|
|
147
|
-
#### Events
|
|
148
|
-
|
|
149
|
-
```typescript
|
|
150
|
-
session.on('connecting', () => {})
|
|
151
|
-
session.on('ready', (data) => {}) // Agent initialized
|
|
152
|
-
session.on('update', (update) => {}) // Session update (streaming)
|
|
153
|
-
session.on('turn_start', () => {}) // Prompt started
|
|
154
|
-
session.on('turn_end', () => {}) // Prompt completed
|
|
155
|
-
session.on('permission_request', (data) => {})
|
|
156
|
-
session.on('prompt_complete', (data) => {})
|
|
157
|
-
session.on('session_created', (data) => {})
|
|
158
|
-
session.on('session_switched', (data) => {})
|
|
159
|
-
session.on('history_replay', (data) => {})
|
|
160
|
-
session.on('error', (data) => {})
|
|
161
|
-
session.on('agent_exit', (data) => {})
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
### `createWsAdapter(session, wss, options?)`
|
|
165
|
-
|
|
166
|
-
Wire up a WebSocket server to an AgentSession.
|
|
167
|
-
|
|
168
|
-
```typescript
|
|
169
|
-
import { createWsAdapter } from '@bytespell/amux';
|
|
170
|
-
|
|
171
|
-
const adapter = createWsAdapter(session, wss, {
|
|
172
|
-
sendHistoryOnConnect: true, // Default: true
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
adapter.clientCount() // Get connected clients
|
|
176
|
-
adapter.broadcast(msg) // Send custom message to all
|
|
177
|
-
adapter.close() // Close all connections
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
#### WebSocket Protocol
|
|
181
|
-
|
|
182
|
-
**Client → Server:**
|
|
183
|
-
```typescript
|
|
184
|
-
{ type: 'prompt', message: 'Hello' }
|
|
185
|
-
{ type: 'cancel' }
|
|
186
|
-
{ type: 'permission_response', requestId: '...', optionId: '...' }
|
|
187
|
-
{ type: 'change_cwd', path: '/new/path' }
|
|
188
|
-
{ type: 'new_session' }
|
|
189
|
-
{ type: 'change_agent', agentType: 'codex' }
|
|
190
|
-
{ type: 'list_sessions' }
|
|
191
|
-
{ type: 'switch_session', sessionId: '...' }
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
**Server → Client:**
|
|
195
|
-
```typescript
|
|
196
|
-
{ type: 'ready', cwd: '...', sessionId: '...', ... }
|
|
197
|
-
{ type: 'session_update', update: { sessionUpdate: '...', ... } }
|
|
198
|
-
{ type: 'permission_request', requestId: '...', toolCall: {...}, options: [...] }
|
|
199
|
-
{ type: 'history_replay', events: [...], eventCount: 42 }
|
|
200
|
-
{ type: 'error', message: '...' }
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
## System Context
|
|
204
|
-
|
|
205
|
-
Inject context to customize agent behavior:
|
|
206
|
-
|
|
207
|
-
```typescript
|
|
208
|
-
const session = new AgentSession({
|
|
209
|
-
instanceId: 'docs-helper',
|
|
210
|
-
systemContext: `
|
|
211
|
-
# Documentation Assistant
|
|
212
|
-
|
|
213
|
-
You help users write documentation for this project.
|
|
214
|
-
|
|
215
|
-
Key conventions:
|
|
216
|
-
- Use markdown format
|
|
217
|
-
- Include code examples
|
|
218
|
-
- Keep explanations concise
|
|
219
|
-
`,
|
|
220
|
-
});
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
## State Persistence
|
|
224
|
-
|
|
225
|
-
Sessions are persisted to `~/.local/state/amux/` by default:
|
|
226
|
-
- Instance state (cwd, sessionId, agentType)
|
|
227
|
-
- Session history (for replay on reconnect)
|
|
228
|
-
- Session registry (list all sessions)
|
|
229
|
-
|
|
230
|
-
Override with `stateDir` option.
|
|
231
|
-
|
|
232
|
-
## License
|
|
233
|
-
|
|
234
|
-
MIT
|
package/dist/cli.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* amux CLI
|
|
4
|
-
*
|
|
5
|
-
* Quick way to start an amux server from the command line.
|
|
6
|
-
*
|
|
7
|
-
* Usage:
|
|
8
|
-
* amux # Start with defaults
|
|
9
|
-
* amux --context ./CONTEXT.md # Start with system context from file
|
|
10
|
-
* amux --cwd /path/to/project # Start with fixed working directory
|
|
11
|
-
* amux --port 3000 # Start on specific port
|
|
12
|
-
*/
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=cli.d.ts.map
|
package/dist/cli.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;GAUG"}
|
package/dist/cli.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* amux CLI
|
|
4
|
-
*
|
|
5
|
-
* Quick way to start an amux server from the command line.
|
|
6
|
-
*
|
|
7
|
-
* Usage:
|
|
8
|
-
* amux # Start with defaults
|
|
9
|
-
* amux --context ./CONTEXT.md # Start with system context from file
|
|
10
|
-
* amux --cwd /path/to/project # Start with fixed working directory
|
|
11
|
-
* amux --port 3000 # Start on specific port
|
|
12
|
-
*/
|
|
13
|
-
import fs from 'fs';
|
|
14
|
-
import path from 'path';
|
|
15
|
-
import { createAmuxServer } from './server.js';
|
|
16
|
-
function parseArgs() {
|
|
17
|
-
const args = {};
|
|
18
|
-
const argv = process.argv.slice(2);
|
|
19
|
-
for (let i = 0; i < argv.length; i++) {
|
|
20
|
-
const arg = argv[i];
|
|
21
|
-
if (arg === '--help' || arg === '-h') {
|
|
22
|
-
args.help = true;
|
|
23
|
-
}
|
|
24
|
-
else if (arg === '--port' || arg === '-p') {
|
|
25
|
-
args.port = parseInt(argv[++i] ?? '', 10);
|
|
26
|
-
}
|
|
27
|
-
else if (arg === '--context' || arg === '-c') {
|
|
28
|
-
args.context = argv[++i];
|
|
29
|
-
}
|
|
30
|
-
else if (arg === '--cwd' || arg === '-d') {
|
|
31
|
-
args.cwd = argv[++i];
|
|
32
|
-
}
|
|
33
|
-
else if (arg === '--agent' || arg === '-a') {
|
|
34
|
-
args.agent = argv[++i];
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return args;
|
|
38
|
-
}
|
|
39
|
-
function printHelp() {
|
|
40
|
-
console.log(`
|
|
41
|
-
amux - ACP Multiplexer
|
|
42
|
-
|
|
43
|
-
Start an agent-powered HTTP server with multiplexed sessions.
|
|
44
|
-
|
|
45
|
-
USAGE:
|
|
46
|
-
amux [OPTIONS]
|
|
47
|
-
|
|
48
|
-
OPTIONS:
|
|
49
|
-
-p, --port <port> Port to listen on (default: 3000 or PORT env)
|
|
50
|
-
-c, --context <file> Load system context from a markdown file
|
|
51
|
-
-d, --cwd <path> Fixed working directory for all sessions
|
|
52
|
-
-a, --agent <type> Agent type: claude-code, codex, pi (default: claude-code)
|
|
53
|
-
-h, --help Show this help message
|
|
54
|
-
|
|
55
|
-
EXAMPLES:
|
|
56
|
-
# Start with defaults
|
|
57
|
-
amux
|
|
58
|
-
|
|
59
|
-
# Start with system context
|
|
60
|
-
amux --context ./PLUGIN_GUIDE.md
|
|
61
|
-
|
|
62
|
-
# Start for a specific project
|
|
63
|
-
amux --cwd /path/to/project --context ./CONTEXT.md
|
|
64
|
-
|
|
65
|
-
# Use a different agent
|
|
66
|
-
amux --agent codex
|
|
67
|
-
|
|
68
|
-
ENVIRONMENT:
|
|
69
|
-
PORT Server port (overridden by --port)
|
|
70
|
-
INSTANCE_ID Unique instance identifier for state isolation
|
|
71
|
-
`);
|
|
72
|
-
}
|
|
73
|
-
async function main() {
|
|
74
|
-
const args = parseArgs();
|
|
75
|
-
if (args.help) {
|
|
76
|
-
printHelp();
|
|
77
|
-
process.exit(0);
|
|
78
|
-
}
|
|
79
|
-
// Load system context if specified
|
|
80
|
-
let systemContext;
|
|
81
|
-
if (args.context) {
|
|
82
|
-
const contextPath = path.resolve(args.context);
|
|
83
|
-
if (!fs.existsSync(contextPath)) {
|
|
84
|
-
console.error(`Error: Context file not found: ${contextPath}`);
|
|
85
|
-
process.exit(1);
|
|
86
|
-
}
|
|
87
|
-
systemContext = fs.readFileSync(contextPath, 'utf-8');
|
|
88
|
-
console.log(`[amux] Loaded system context from ${contextPath} (${systemContext.length} bytes)`);
|
|
89
|
-
}
|
|
90
|
-
// Resolve fixed cwd if specified
|
|
91
|
-
let fixedCwd;
|
|
92
|
-
if (args.cwd) {
|
|
93
|
-
fixedCwd = path.resolve(args.cwd);
|
|
94
|
-
if (!fs.existsSync(fixedCwd)) {
|
|
95
|
-
console.error(`Error: Working directory not found: ${fixedCwd}`);
|
|
96
|
-
process.exit(1);
|
|
97
|
-
}
|
|
98
|
-
console.log(`[amux] Using fixed working directory: ${fixedCwd}`);
|
|
99
|
-
}
|
|
100
|
-
const { start, shutdown } = createAmuxServer({
|
|
101
|
-
port: args.port,
|
|
102
|
-
systemContext,
|
|
103
|
-
fixedCwd,
|
|
104
|
-
agentType: args.agent,
|
|
105
|
-
});
|
|
106
|
-
// Handle shutdown gracefully
|
|
107
|
-
process.on('SIGINT', () => {
|
|
108
|
-
console.log('\n[amux] Received SIGINT, shutting down...');
|
|
109
|
-
shutdown();
|
|
110
|
-
process.exit(0);
|
|
111
|
-
});
|
|
112
|
-
await start();
|
|
113
|
-
}
|
|
114
|
-
main().catch((err) => {
|
|
115
|
-
console.error('[amux] Fatal error:', err);
|
|
116
|
-
process.exit(1);
|
|
117
|
-
});
|
|
118
|
-
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAU/C,SAAS,SAAS;IAChB,MAAM,IAAI,GAAY,EAAE,CAAC;IACzB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAEnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAEpB,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YACrC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACnB,CAAC;aAAM,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YAC5C,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QAC5C,CAAC;aAAM,IAAI,GAAG,KAAK,WAAW,IAAI,GAAG,KAAK,IAAI,EA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,CAAC;IAClG,CAAC;IAED,iCAAiC;IACjC,IAAI,QAA4B,CAAC;IACjC,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;QACb,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC7B,OAAO,CAAC,KAAK,CAAC,uCAAuC,QAAQ,EAAE,CAAC,CAAC;YACjE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,yCAAyC,QAAQ,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,gBAAgB,CAAC;QAC3C,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,aAAa;QACb,QAAQ;QACR,SAAS,EAAE,IAAI,CAAC,KAAK;KACtB,CAAC,CAAC;IAEH,6BAA6B;IAC7B,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;QACxB,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;QAC1D,QAAQ,EAAE,CAAC;QACX,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,MAAM,KAAK,EAAE,CAAC;AAChB,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC;IAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"message-parser.test.d.ts","sourceRoot":"","sources":["../src/message-parser.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { parseMessageToContentBlocks } from './message-parser.js';
|
|
3
|
-
describe('parseMessageToContentBlocks', () => {
|
|
4
|
-
const workingDir = '/home/user/project';
|
|
5
|
-
describe('plain text messages', () => {
|
|
6
|
-
it('returns single text block for plain text', () => {
|
|
7
|
-
const result = parseMessageToContentBlocks('hello world', workingDir);
|
|
8
|
-
expect(result).toEqual([{ type: 'text', text: 'hello world' }]);
|
|
9
|
-
});
|
|
10
|
-
it('returns single text block for empty message', () => {
|
|
11
|
-
const result = parseMessageToContentBlocks('', workingDir);
|
|
12
|
-
expect(result).toEqual([{ type: 'text', text: '' }]);
|
|
13
|
-
});
|
|
14
|
-
it('returns single text block for whitespace-only message', () => {
|
|
15
|
-
const result = parseMessageToContentBlocks(' ', workingDir);
|
|
16
|
-
expect(result).toEqual([{ type: 'text', text: ' ' }]);
|
|
17
|
-
});
|
|
18
|
-
it('preserves multi-line text', () => {
|
|
19
|
-
const result = parseMessageToContentBlocks('line one\nline two', workingDir);
|
|
20
|
-
expect(result).toEqual([{ type: 'text', text: 'line one\nline two' }]);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
describe('single @mentions', () => {
|
|
24
|
-
it('parses single @mention as resource_link', () => {
|
|
25
|
-
const result = parseMessageToContentBlocks('@src/foo.ts', workingDir);
|
|
26
|
-
expect(result).toEqual([
|
|
27
|
-
{
|
|
28
|
-
type: 'resource_link',
|
|
29
|
-
uri: 'file:///home/user/project/src/foo.ts',
|
|
30
|
-
name: 'src/foo.ts',
|
|
31
|
-
},
|
|
32
|
-
]);
|
|
33
|
-
});
|
|
34
|
-
it('parses relative path with ./', () => {
|
|
35
|
-
const result = parseMessageToContentBlocks('@./local.ts', workingDir);
|
|
36
|
-
expect(result).toEqual([
|
|
37
|
-
{
|
|
38
|
-
type: 'resource_link',
|
|
39
|
-
uri: 'file:///home/user/project/local.ts',
|
|
40
|
-
name: './local.ts',
|
|
41
|
-
},
|
|
42
|
-
]);
|
|
43
|
-
});
|
|
44
|
-
it('parses relative path with ../', () => {
|
|
45
|
-
const result = parseMessageToContentBlocks('@../parent/file.ts', workingDir);
|
|
46
|
-
expect(result).toEqual([
|
|
47
|
-
{
|
|
48
|
-
type: 'resource_link',
|
|
49
|
-
uri: 'file:///home/user/parent/file.ts',
|
|
50
|
-
name: '../parent/file.ts',
|
|
51
|
-
},
|
|
52
|
-
]);
|
|
53
|
-
});
|
|
54
|
-
it('handles file with dashes in name', () => {
|
|
55
|
-
const result = parseMessageToContentBlocks('@src/my-file.ts', workingDir);
|
|
56
|
-
expect(result).toEqual([
|
|
57
|
-
{
|
|
58
|
-
type: 'resource_link',
|
|
59
|
-
uri: 'file:///home/user/project/src/my-file.ts',
|
|
60
|
-
name: 'src/my-file.ts',
|
|
61
|
-
},
|
|
62
|
-
]);
|
|
63
|
-
});
|
|
64
|
-
it('handles deeply nested paths', () => {
|
|
65
|
-
const result = parseMessageToContentBlocks('@src/a/b/c/d.ts', workingDir);
|
|
66
|
-
expect(result).toEqual([
|
|
67
|
-
{
|
|
68
|
-
type: 'resource_link',
|
|
69
|
-
uri: 'file:///home/user/project/src/a/b/c/d.ts',
|
|
70
|
-
name: 'src/a/b/c/d.ts',
|
|
71
|
-
},
|
|
72
|
-
]);
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
describe('mixed text and @mentions', () => {
|
|
76
|
-
it('parses text before and after mention', () => {
|
|
77
|
-
const result = parseMessageToContentBlocks('check @src/foo.ts for bugs', workingDir);
|
|
78
|
-
expect(result).toEqual([
|
|
79
|
-
{ type: 'text', text: 'check ' },
|
|
80
|
-
{
|
|
81
|
-
type: 'resource_link',
|
|
82
|
-
uri: 'file:///home/user/project/src/foo.ts',
|
|
83
|
-
name: 'src/foo.ts',
|
|
84
|
-
},
|
|
85
|
-
{ type: 'text', text: ' for bugs' },
|
|
86
|
-
]);
|
|
87
|
-
});
|
|
88
|
-
it('parses text only before mention', () => {
|
|
89
|
-
const result = parseMessageToContentBlocks('look at @src/foo.ts', workingDir);
|
|
90
|
-
expect(result).toEqual([
|
|
91
|
-
{ type: 'text', text: 'look at ' },
|
|
92
|
-
{
|
|
93
|
-
type: 'resource_link',
|
|
94
|
-
uri: 'file:///home/user/project/src/foo.ts',
|
|
95
|
-
name: 'src/foo.ts',
|
|
96
|
-
},
|
|
97
|
-
]);
|
|
98
|
-
});
|
|
99
|
-
it('parses text only after mention', () => {
|
|
100
|
-
const result = parseMessageToContentBlocks('@src/foo.ts has a bug', workingDir);
|
|
101
|
-
expect(result).toEqual([
|
|
102
|
-
{
|
|
103
|
-
type: 'resource_link',
|
|
104
|
-
uri: 'file:///home/user/project/src/foo.ts',
|
|
105
|
-
name: 'src/foo.ts',
|
|
106
|
-
},
|
|
107
|
-
{ type: 'text', text: ' has a bug' },
|
|
108
|
-
]);
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
describe('multiple @mentions', () => {
|
|
112
|
-
it('parses multiple mentions with text between', () => {
|
|
113
|
-
const result = parseMessageToContentBlocks('@src/a.ts and @src/b.ts', workingDir);
|
|
114
|
-
expect(result).toEqual([
|
|
115
|
-
{
|
|
116
|
-
type: 'resource_link',
|
|
117
|
-
uri: 'file:///home/user/project/src/a.ts',
|
|
118
|
-
name: 'src/a.ts',
|
|
119
|
-
},
|
|
120
|
-
{ type: 'text', text: ' and ' },
|
|
121
|
-
{
|
|
122
|
-
type: 'resource_link',
|
|
123
|
-
uri: 'file:///home/user/project/src/b.ts',
|
|
124
|
-
name: 'src/b.ts',
|
|
125
|
-
},
|
|
126
|
-
]);
|
|
127
|
-
});
|
|
128
|
-
it('parses consecutive mentions without text between', () => {
|
|
129
|
-
const result = parseMessageToContentBlocks('@a.ts @b.ts', workingDir);
|
|
130
|
-
// The space between becomes whitespace-only and gets skipped
|
|
131
|
-
expect(result).toEqual([
|
|
132
|
-
{
|
|
133
|
-
type: 'resource_link',
|
|
134
|
-
uri: 'file:///home/user/project/a.ts',
|
|
135
|
-
name: 'a.ts',
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
type: 'resource_link',
|
|
139
|
-
uri: 'file:///home/user/project/b.ts',
|
|
140
|
-
name: 'b.ts',
|
|
141
|
-
},
|
|
142
|
-
]);
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
describe('edge cases', () => {
|
|
146
|
-
it('handles email-like patterns (should not match)', () => {
|
|
147
|
-
// Email addresses should be matched by regex, which may not be desired
|
|
148
|
-
// This test documents current behavior
|
|
149
|
-
const result = parseMessageToContentBlocks('email user@example.com', workingDir);
|
|
150
|
-
// The regex matches @example.com as a mention
|
|
151
|
-
expect(result[0]).toEqual({ type: 'text', text: 'email user' });
|
|
152
|
-
expect(result[1]).toHaveProperty('type', 'resource_link');
|
|
153
|
-
});
|
|
154
|
-
it('handles @ at end of string without path', () => {
|
|
155
|
-
const result = parseMessageToContentBlocks('just an @', workingDir);
|
|
156
|
-
expect(result).toEqual([{ type: 'text', text: 'just an @' }]);
|
|
157
|
-
});
|
|
158
|
-
it('handles multiple @ signs', () => {
|
|
159
|
-
const result = parseMessageToContentBlocks('@@foo.ts', workingDir);
|
|
160
|
-
// First @ doesn't match (followed by @), second @ matches
|
|
161
|
-
expect(result).toHaveLength(2);
|
|
162
|
-
expect(result[0]).toEqual({ type: 'text', text: '@' });
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
describe('working directory resolution', () => {
|
|
166
|
-
it('uses provided working directory for absolute path resolution', () => {
|
|
167
|
-
const result = parseMessageToContentBlocks('@file.ts', '/custom/dir');
|
|
168
|
-
expect(result).toEqual([
|
|
169
|
-
{
|
|
170
|
-
type: 'resource_link',
|
|
171
|
-
uri: 'file:///custom/dir/file.ts',
|
|
172
|
-
name: 'file.ts',
|
|
173
|
-
},
|
|
174
|
-
]);
|
|
175
|
-
});
|
|
176
|
-
it('resolves relative paths correctly from working directory', () => {
|
|
177
|
-
const result = parseMessageToContentBlocks('@../sibling/file.ts', '/home/user/project');
|
|
178
|
-
expect(result).toEqual([
|
|
179
|
-
{
|
|
180
|
-
type: 'resource_link',
|
|
181
|
-
uri: 'file:///home/user/sibling/file.ts',
|
|
182
|
-
name: '../sibling/file.ts',
|
|
183
|
-
},
|
|
184
|
-
]);
|
|
185
|
-
});
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
//# sourceMappingURL=message-parser.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"message-parser.test.js","sourceRoot":"","sources":["../src/message-parser.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAElE,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,MAAM,UAAU,GAAG,oBAAoB,CAAC;IAExC,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;QACnC,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;YAClD,MAAM,MAAM,GAAG,2BAA2B,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;YACtE,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;YACrD,MAAM,MAAM,GAAG,2BAA2B,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;YAC3D,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uDAAuD,EAAE,GAAG,EAAE;YAC/D,MAAM,MAAM,GAAG,2BAA2B,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;YA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AAE,UAAU,CAAC,CAAC;YACnE,0DAA0D;YAC1D,MAAM,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YAC/B,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;QAC5C,EAAE,CAAC,8DAA8D,EAAE,GAAG,EAAE;YACtE,MAAM,MAAM,GAAG,2BAA2B,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;YACtE,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;gBACrB;oBACE,IAAI,EAAE,eAAe;oBACrB,GAAG,EAAE,4BAA4B;oBACjC,IAAI,EAAE,SAAS;iBAChB;aACF,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;YAClE,MAAM,MAAM,GAAG,2BAA2B,CAAC,qBAAqB,EAAE,oBAAoB,CAAC,CAAC;YACxF,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;gBACrB;oBACE,IAAI,EAAE,eAAe;oBACrB,GAAG,EAAE,mCAAmC;oBACxC,IAAI,EAAE,oBAAoB;iBAC3B;aACF,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/server.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { type Application } from 'express';
|
|
2
|
-
import { type Server } from 'http';
|
|
3
|
-
import { AgentSession } from './session.js';
|
|
4
|
-
import type { AmuxServerConfig } from './types.js';
|
|
5
|
-
/**
|
|
6
|
-
* Create an amux server with full Express + WebSocket setup.
|
|
7
|
-
* This is the "batteries included" API for building agent-powered plugins.
|
|
8
|
-
*/
|
|
9
|
-
export declare function createAmuxServer(config?: AmuxServerConfig): {
|
|
10
|
-
app: Application;
|
|
11
|
-
server: Server;
|
|
12
|
-
start: () => Promise<void>;
|
|
13
|
-
shutdown: () => void;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Attach amux to an existing Express app and HTTP server.
|
|
17
|
-
* For when you want more control over the server setup.
|
|
18
|
-
*/
|
|
19
|
-
export declare function attachAmux(_app: Application, server: Server, config: Omit<AmuxServerConfig, 'port' | 'dev' | 'staticDir'>): {
|
|
20
|
-
agentSession: AgentSession;
|
|
21
|
-
start: () => Promise<void>;
|
|
22
|
-
shutdown: () => void;
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAkD,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AACpG,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAMjD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAE,gBAAgB,EAA0B,MAAM,YAAY,CAAC;AAY3E;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,GAAE,gBAAqB,GAAG;IAC/D,GAAG,EAAE,WAAW,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,CA0SA;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,KAAK,GAAG,WAAW,CAAC,GAC3D;IACD,YAAY,EAAE,YAAY,CAAC;IAC3B,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,CA2EA"}
|