agent-orchestrator-mcp-server 0.1.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/README.md +172 -0
- package/build/index.integration-with-mock.js +36 -0
- package/build/index.js +98 -0
- package/package.json +49 -0
- package/shared/index.d.ts +7 -0
- package/shared/index.js +8 -0
- package/shared/logging.d.ts +20 -0
- package/shared/logging.js +34 -0
- package/shared/orchestrator-client/orchestrator-client.d.ts +109 -0
- package/shared/orchestrator-client/orchestrator-client.integration-mock.d.ts +20 -0
- package/shared/orchestrator-client/orchestrator-client.integration-mock.js +373 -0
- package/shared/orchestrator-client/orchestrator-client.js +166 -0
- package/shared/resources.d.ts +3 -0
- package/shared/resources.js +67 -0
- package/shared/server.d.ts +31 -0
- package/shared/server.js +34 -0
- package/shared/tools/action-session.d.ts +55 -0
- package/shared/tools/action-session.js +182 -0
- package/shared/tools/get-session.d.ts +95 -0
- package/shared/tools/get-session.js +271 -0
- package/shared/tools/search-sessions.d.ts +92 -0
- package/shared/tools/search-sessions.js +201 -0
- package/shared/tools/start-session.d.ts +119 -0
- package/shared/tools/start-session.js +146 -0
- package/shared/tools.d.ts +29 -0
- package/shared/tools.js +88 -0
- package/shared/types.d.ts +155 -0
- package/shared/types.js +4 -0
package/README.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Agent Orchestrator MCP Server
|
|
2
|
+
|
|
3
|
+
> **Note**: This package is part of the [MCP Servers](https://github.com/pulsemcp/mcp-servers) monorepo. For the latest updates and full source code, visit the [Agent Orchestrator MCP Server directory](https://github.com/pulsemcp/mcp-servers/tree/main/experimental/agent-orchestrator).
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
MCP server for PulseMCP's agent-orchestrator: a Claude Code + MCP-powered agent-parallelization system for agentic coding and ops done at PulseMCP.
|
|
7
|
+
|
|
8
|
+
## Highlights
|
|
9
|
+
|
|
10
|
+
- Simplified 4-tool interface for full agent session management
|
|
11
|
+
- Search, filter, and retrieve sessions with optional logs and transcripts
|
|
12
|
+
- Session lifecycle actions (pause, restart, archive, unarchive, follow_up)
|
|
13
|
+
- Tool grouping system for permission-based access control
|
|
14
|
+
- TypeScript with strict type checking
|
|
15
|
+
- Comprehensive testing setup (functional, integration, manual)
|
|
16
|
+
|
|
17
|
+
## Capabilities
|
|
18
|
+
|
|
19
|
+
### Tools
|
|
20
|
+
|
|
21
|
+
| Tool | Group | Description |
|
|
22
|
+
| ----------------- | -------- | ---------------------------------------------------------------------- |
|
|
23
|
+
| `search_sessions` | readonly | Search/list sessions with optional ID lookup, query, and status filter |
|
|
24
|
+
| `get_session` | readonly | Get detailed session info with optional logs and transcripts |
|
|
25
|
+
| `start_session` | write | Create and start a new agent session |
|
|
26
|
+
| `action_session` | write | Perform actions: follow_up, pause, restart, archive, unarchive |
|
|
27
|
+
|
|
28
|
+
### Resources
|
|
29
|
+
|
|
30
|
+
| Resource | Description |
|
|
31
|
+
| ----------------------------- | ----------------------------------------------- |
|
|
32
|
+
| `agent-orchestrator://config` | Server configuration and status (for debugging) |
|
|
33
|
+
|
|
34
|
+
### Tool Groups
|
|
35
|
+
|
|
36
|
+
Control which tools are available via the `ENABLED_TOOLGROUPS` environment variable:
|
|
37
|
+
|
|
38
|
+
| Group | Description |
|
|
39
|
+
| ---------- | --------------------------------------------------------------------------- |
|
|
40
|
+
| `readonly` | Read-only operations (list, get, search) |
|
|
41
|
+
| `write` | Write operations (create, update, follow_up, pause, restart, archive, etc.) |
|
|
42
|
+
| `admin` | Administrative operations (delete) |
|
|
43
|
+
|
|
44
|
+
**Examples:**
|
|
45
|
+
|
|
46
|
+
- `ENABLED_TOOLGROUPS="readonly"` - Only read operations
|
|
47
|
+
- `ENABLED_TOOLGROUPS="readonly,write"` - Read and write, no admin
|
|
48
|
+
- Not set - All tools enabled (default)
|
|
49
|
+
|
|
50
|
+
## Quick Start
|
|
51
|
+
|
|
52
|
+
### Installation
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npm run install-all
|
|
56
|
+
npm run build
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Configuration
|
|
60
|
+
|
|
61
|
+
Set the required environment variables:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
export AGENT_ORCHESTRATOR_BASE_URL="http://localhost:3000"
|
|
65
|
+
export AGENT_ORCHESTRATOR_API_KEY="your_api_key_here"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Running
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm start
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Environment Variables
|
|
75
|
+
|
|
76
|
+
| Variable | Required | Description | Default |
|
|
77
|
+
| ----------------------------- | -------- | --------------------------------- | ----------- |
|
|
78
|
+
| `AGENT_ORCHESTRATOR_BASE_URL` | Yes | Base URL for the orchestrator API | - |
|
|
79
|
+
| `AGENT_ORCHESTRATOR_API_KEY` | Yes | API key for authentication | - |
|
|
80
|
+
| `ENABLED_TOOLGROUPS` | No | Comma-separated tool groups | All enabled |
|
|
81
|
+
| `SKIP_HEALTH_CHECKS` | No | Skip API validation at startup | `false` |
|
|
82
|
+
|
|
83
|
+
### Claude Desktop Configuration
|
|
84
|
+
|
|
85
|
+
#### macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
86
|
+
|
|
87
|
+
#### Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"mcpServers": {
|
|
92
|
+
"agent-orchestrator": {
|
|
93
|
+
"command": "node",
|
|
94
|
+
"args": ["/path/to/agent-orchestrator/local/build/index.js"],
|
|
95
|
+
"env": {
|
|
96
|
+
"AGENT_ORCHESTRATOR_BASE_URL": "http://localhost:3000",
|
|
97
|
+
"AGENT_ORCHESTRATOR_API_KEY": "your-api-key-here",
|
|
98
|
+
"ENABLED_TOOLGROUPS": "readonly,write"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Development
|
|
106
|
+
|
|
107
|
+
### Running in Development Mode
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
npm run dev
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Testing
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Run functional tests in watch mode
|
|
117
|
+
npm test
|
|
118
|
+
|
|
119
|
+
# Run tests once
|
|
120
|
+
npm run test:run
|
|
121
|
+
|
|
122
|
+
# Run integration tests (full MCP protocol)
|
|
123
|
+
npm run test:integration
|
|
124
|
+
|
|
125
|
+
# Run all automated tests
|
|
126
|
+
npm run test:all
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Linting and Formatting
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# Check for linting issues
|
|
133
|
+
npm run lint
|
|
134
|
+
|
|
135
|
+
# Auto-fix linting issues
|
|
136
|
+
npm run lint:fix
|
|
137
|
+
|
|
138
|
+
# Format code
|
|
139
|
+
npm run format
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## API Coverage
|
|
143
|
+
|
|
144
|
+
This MCP server provides tools for the following Agent Orchestrator REST API endpoints:
|
|
145
|
+
|
|
146
|
+
### Sessions
|
|
147
|
+
|
|
148
|
+
- `GET /api/v1/sessions` - List sessions
|
|
149
|
+
- `GET /api/v1/sessions/search` - Search sessions
|
|
150
|
+
- `GET /api/v1/sessions/:id` - Get session
|
|
151
|
+
- `POST /api/v1/sessions` - Create session
|
|
152
|
+
- `PATCH /api/v1/sessions/:id` - Update session
|
|
153
|
+
- `DELETE /api/v1/sessions/:id` - Delete session
|
|
154
|
+
- `POST /api/v1/sessions/:id/archive` - Archive session
|
|
155
|
+
- `POST /api/v1/sessions/:id/unarchive` - Unarchive session
|
|
156
|
+
- `POST /api/v1/sessions/:id/follow_up` - Send follow-up prompt
|
|
157
|
+
- `POST /api/v1/sessions/:id/pause` - Pause session
|
|
158
|
+
- `POST /api/v1/sessions/:id/restart` - Restart session
|
|
159
|
+
|
|
160
|
+
### Logs
|
|
161
|
+
|
|
162
|
+
- `GET /api/v1/sessions/:session_id/logs` - List logs
|
|
163
|
+
- `POST /api/v1/sessions/:session_id/logs` - Create log
|
|
164
|
+
|
|
165
|
+
### Subagent Transcripts
|
|
166
|
+
|
|
167
|
+
- `GET /api/v1/sessions/:session_id/subagent_transcripts` - List transcripts
|
|
168
|
+
- `GET /api/v1/sessions/:session_id/subagent_transcripts/:id` - Get transcript
|
|
169
|
+
|
|
170
|
+
## License
|
|
171
|
+
|
|
172
|
+
MIT
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Integration Test Server Entry Point with Mock Client Factory
|
|
4
|
+
*
|
|
5
|
+
* This file is used for integration testing with a mocked AgentOrchestratorClient.
|
|
6
|
+
* It uses the real MCP server but injects a mock client factory.
|
|
7
|
+
*
|
|
8
|
+
* Mock data is passed via the ORCHESTRATOR_MOCK_DATA environment variable.
|
|
9
|
+
*/
|
|
10
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
11
|
+
// Import from shared module via symlink (created by setup-dev.js)
|
|
12
|
+
import { createMCPServer } from '../shared/index.js';
|
|
13
|
+
// Import the mock client factory from the shared module
|
|
14
|
+
import { createIntegrationMockOrchestratorClient } from '../shared/orchestrator-client/orchestrator-client.integration-mock.js';
|
|
15
|
+
async function main() {
|
|
16
|
+
const transport = new StdioServerTransport();
|
|
17
|
+
// Parse mock data from environment variable
|
|
18
|
+
let mockData = {};
|
|
19
|
+
if (process.env.ORCHESTRATOR_MOCK_DATA) {
|
|
20
|
+
try {
|
|
21
|
+
mockData = JSON.parse(process.env.ORCHESTRATOR_MOCK_DATA);
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
console.error('Failed to parse ORCHESTRATOR_MOCK_DATA:', e);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
// Create client factory that returns our mock
|
|
28
|
+
const clientFactory = () => createIntegrationMockOrchestratorClient(mockData);
|
|
29
|
+
const { server, registerHandlers } = createMCPServer();
|
|
30
|
+
await registerHandlers(server, clientFactory);
|
|
31
|
+
await server.connect(transport);
|
|
32
|
+
}
|
|
33
|
+
main().catch((error) => {
|
|
34
|
+
console.error('Server error:', error);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
});
|
package/build/index.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
3
|
+
import { createMCPServer } from '../shared/index.js';
|
|
4
|
+
import { logServerStart, logError, logWarning } from '../shared/logging.js';
|
|
5
|
+
// =============================================================================
|
|
6
|
+
// ENVIRONMENT VALIDATION
|
|
7
|
+
// =============================================================================
|
|
8
|
+
// Validates required environment variables at startup with helpful error messages.
|
|
9
|
+
// =============================================================================
|
|
10
|
+
function validateEnvironment() {
|
|
11
|
+
const required = [
|
|
12
|
+
{
|
|
13
|
+
name: 'AGENT_ORCHESTRATOR_BASE_URL',
|
|
14
|
+
description: 'Base URL for the Agent Orchestrator API',
|
|
15
|
+
example: 'http://localhost:3000',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: 'AGENT_ORCHESTRATOR_API_KEY',
|
|
19
|
+
description: 'API key for authentication with the Agent Orchestrator',
|
|
20
|
+
example: 'your_api_key_here',
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
const optional = [
|
|
24
|
+
{
|
|
25
|
+
name: 'ENABLED_TOOLGROUPS',
|
|
26
|
+
description: 'Comma-separated list of tool groups to enable (readonly,write,admin)',
|
|
27
|
+
defaultValue: 'all groups enabled',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'SKIP_HEALTH_CHECKS',
|
|
31
|
+
description: 'Skip API validation at startup',
|
|
32
|
+
defaultValue: 'false',
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
const missing = required.filter(({ name }) => !process.env[name]);
|
|
36
|
+
if (missing.length > 0) {
|
|
37
|
+
logError('validateEnvironment', 'Missing required environment variables:');
|
|
38
|
+
missing.forEach(({ name, description, example }) => {
|
|
39
|
+
console.error(` - ${name}: ${description}`);
|
|
40
|
+
console.error(` Example: ${example}`);
|
|
41
|
+
});
|
|
42
|
+
if (optional.length > 0) {
|
|
43
|
+
console.error('\nOptional environment variables:');
|
|
44
|
+
optional.forEach(({ name, description, defaultValue }) => {
|
|
45
|
+
const defaultStr = defaultValue ? ` (default: ${defaultValue})` : '';
|
|
46
|
+
console.error(` - ${name}: ${description}${defaultStr}`);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
console.error('\n----------------------------------------');
|
|
50
|
+
console.error('Please set the required environment variables and try again.');
|
|
51
|
+
console.error('\nExample commands:');
|
|
52
|
+
missing.forEach(({ name, example }) => {
|
|
53
|
+
console.error(` export ${name}="${example}"`);
|
|
54
|
+
});
|
|
55
|
+
console.error('----------------------------------------\n');
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
// Log warnings for common configuration issues
|
|
59
|
+
if (process.env.ENABLED_TOOLGROUPS) {
|
|
60
|
+
logWarning('config', `Tool groups filter active: ${process.env.ENABLED_TOOLGROUPS}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// =============================================================================
|
|
64
|
+
// HEALTH CHECKS
|
|
65
|
+
// =============================================================================
|
|
66
|
+
// Validates API credentials and connectivity before starting the server.
|
|
67
|
+
// Set SKIP_HEALTH_CHECKS=true to disable (useful for testing).
|
|
68
|
+
// =============================================================================
|
|
69
|
+
async function performHealthChecks() {
|
|
70
|
+
if (process.env.SKIP_HEALTH_CHECKS === 'true') {
|
|
71
|
+
logWarning('healthcheck', 'Health checks skipped (SKIP_HEALTH_CHECKS=true)');
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
// For agent-orchestrator, we could add a health check by calling the sessions endpoint
|
|
75
|
+
// For now, we skip complex validation since the API might not always be available
|
|
76
|
+
}
|
|
77
|
+
// =============================================================================
|
|
78
|
+
// MAIN ENTRY POINT
|
|
79
|
+
// =============================================================================
|
|
80
|
+
async function main() {
|
|
81
|
+
// Step 1: Validate environment variables
|
|
82
|
+
validateEnvironment();
|
|
83
|
+
// Step 2: Perform health checks (validates credentials, connectivity)
|
|
84
|
+
await performHealthChecks();
|
|
85
|
+
// Step 3: Create server using factory
|
|
86
|
+
const { server, registerHandlers } = createMCPServer();
|
|
87
|
+
// Step 4: Register all handlers (resources and tools)
|
|
88
|
+
await registerHandlers(server);
|
|
89
|
+
// Step 5: Start server with stdio transport
|
|
90
|
+
const transport = new StdioServerTransport();
|
|
91
|
+
await server.connect(transport);
|
|
92
|
+
logServerStart('agent-orchestrator');
|
|
93
|
+
}
|
|
94
|
+
// Run the server
|
|
95
|
+
main().catch((error) => {
|
|
96
|
+
logError('main', error);
|
|
97
|
+
process.exit(1);
|
|
98
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "agent-orchestrator-mcp-server",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Local implementation of agent-orchestrator MCP server",
|
|
5
|
+
"main": "build/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"agent-orchestrator-mcp-server": "./build/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"build/**/*.js",
|
|
12
|
+
"build/**/*.d.ts",
|
|
13
|
+
"shared/**/*.js",
|
|
14
|
+
"shared/**/*.d.ts",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc && npm run build:integration",
|
|
19
|
+
"build:integration": "tsc -p tsconfig.integration.json",
|
|
20
|
+
"start": "node build/index.js",
|
|
21
|
+
"dev": "tsx src/index.ts",
|
|
22
|
+
"predev": "cd ../shared && npm run build && cd ../local && node setup-dev.js",
|
|
23
|
+
"prebuild": "cd ../shared && npm run build && cd ../local && node setup-dev.js",
|
|
24
|
+
"prepublishOnly": "node prepare-publish.js && node ../scripts/prepare-npm-readme.js",
|
|
25
|
+
"lint": "eslint . --ext .ts,.tsx",
|
|
26
|
+
"lint:fix": "eslint . --ext .ts,.tsx --fix",
|
|
27
|
+
"format": "prettier --write .",
|
|
28
|
+
"format:check": "prettier --check .",
|
|
29
|
+
"stage-publish": "npm version"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@modelcontextprotocol/sdk": "^1.19.1",
|
|
33
|
+
"zod": "^3.24.1"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/node": "^22.10.6",
|
|
37
|
+
"tsx": "^4.19.4",
|
|
38
|
+
"typescript": "^5.7.3"
|
|
39
|
+
},
|
|
40
|
+
"keywords": [
|
|
41
|
+
"mcp",
|
|
42
|
+
"model-context-protocol",
|
|
43
|
+
"claude-code",
|
|
44
|
+
"agent-orchestrator",
|
|
45
|
+
"pulsemcp"
|
|
46
|
+
],
|
|
47
|
+
"author": "PulseMCP",
|
|
48
|
+
"license": "MIT"
|
|
49
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { registerResources } from './resources.js';
|
|
2
|
+
export { registerTools, createRegisterTools, type ToolGroup, parseEnabledToolGroups, } from './tools.js';
|
|
3
|
+
export { createMCPServer, type ClientFactory, type IAgentOrchestratorClient } from './server.js';
|
|
4
|
+
export { AgentOrchestratorClient, type IAgentOrchestratorClient as AgentOrchestratorClientInterface, } from './orchestrator-client/orchestrator-client.js';
|
|
5
|
+
export type { Session, Log, SubagentTranscript, SessionStatus, LogLevel, SubagentStatus, Pagination, SessionsResponse, SearchSessionsResponse, SessionResponse, SessionActionResponse, LogsResponse, LogResponse, SubagentTranscriptsResponse, SubagentTranscriptResponse, CreateSessionRequest, UpdateSessionRequest, CreateLogRequest, UpdateLogRequest, CreateSubagentTranscriptRequest, UpdateSubagentTranscriptRequest, } from './types.js';
|
|
6
|
+
export { logServerStart, logError, logWarning, logDebug } from './logging.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
package/shared/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Core server exports
|
|
2
|
+
export { registerResources } from './resources.js';
|
|
3
|
+
export { registerTools, createRegisterTools, parseEnabledToolGroups, } from './tools.js';
|
|
4
|
+
export { createMCPServer } from './server.js';
|
|
5
|
+
// Client exports
|
|
6
|
+
export { AgentOrchestratorClient, } from './orchestrator-client/orchestrator-client.js';
|
|
7
|
+
// Logging exports (re-exported for convenience)
|
|
8
|
+
export { logServerStart, logError, logWarning, logDebug } from './logging.js';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logging utilities for consistent output across MCP servers
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Log server startup message
|
|
6
|
+
*/
|
|
7
|
+
export declare function logServerStart(serverName: string, transport?: string): void;
|
|
8
|
+
/**
|
|
9
|
+
* Log an error with context
|
|
10
|
+
*/
|
|
11
|
+
export declare function logError(context: string, error: unknown): void;
|
|
12
|
+
/**
|
|
13
|
+
* Log a warning
|
|
14
|
+
*/
|
|
15
|
+
export declare function logWarning(context: string, message: string): void;
|
|
16
|
+
/**
|
|
17
|
+
* Log debug information (only in development)
|
|
18
|
+
*/
|
|
19
|
+
export declare function logDebug(context: string, message: string): void;
|
|
20
|
+
//# sourceMappingURL=logging.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logging utilities for consistent output across MCP servers
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Log server startup message
|
|
6
|
+
*/
|
|
7
|
+
export function logServerStart(serverName, transport = 'stdio') {
|
|
8
|
+
console.error(`MCP server ${serverName} running on ${transport}`);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Log an error with context
|
|
12
|
+
*/
|
|
13
|
+
export function logError(context, error) {
|
|
14
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
15
|
+
const stack = error instanceof Error ? error.stack : undefined;
|
|
16
|
+
console.error(`[ERROR] ${context}: ${message}`);
|
|
17
|
+
if (stack) {
|
|
18
|
+
console.error(stack);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Log a warning
|
|
23
|
+
*/
|
|
24
|
+
export function logWarning(context, message) {
|
|
25
|
+
console.error(`[WARN] ${context}: ${message}`);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Log debug information (only in development)
|
|
29
|
+
*/
|
|
30
|
+
export function logDebug(context, message) {
|
|
31
|
+
if (process.env.NODE_ENV === 'development' || process.env.DEBUG) {
|
|
32
|
+
console.error(`[DEBUG] ${context}: ${message}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Orchestrator API Client
|
|
3
|
+
*
|
|
4
|
+
* A client for interacting with the Agent Orchestrator REST API.
|
|
5
|
+
*/
|
|
6
|
+
import type { Session, Log, SubagentTranscript, SessionsResponse, SearchSessionsResponse, SessionActionResponse, LogsResponse, SubagentTranscriptsResponse, CreateSessionRequest, UpdateSessionRequest, CreateLogRequest, UpdateLogRequest, CreateSubagentTranscriptRequest, UpdateSubagentTranscriptRequest, SessionStatus, LogLevel, SubagentStatus } from '../types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Interface for the Agent Orchestrator API client.
|
|
9
|
+
* Used for dependency injection and testing.
|
|
10
|
+
*/
|
|
11
|
+
export interface IAgentOrchestratorClient {
|
|
12
|
+
listSessions(options?: {
|
|
13
|
+
status?: SessionStatus;
|
|
14
|
+
agent_type?: string;
|
|
15
|
+
show_archived?: boolean;
|
|
16
|
+
page?: number;
|
|
17
|
+
per_page?: number;
|
|
18
|
+
}): Promise<SessionsResponse>;
|
|
19
|
+
searchSessions(query: string, options?: {
|
|
20
|
+
search_contents?: boolean;
|
|
21
|
+
status?: SessionStatus;
|
|
22
|
+
agent_type?: string;
|
|
23
|
+
show_archived?: boolean;
|
|
24
|
+
page?: number;
|
|
25
|
+
per_page?: number;
|
|
26
|
+
}): Promise<SearchSessionsResponse>;
|
|
27
|
+
getSession(id: string | number, includeTranscript?: boolean): Promise<Session>;
|
|
28
|
+
createSession(data: CreateSessionRequest): Promise<Session>;
|
|
29
|
+
updateSession(id: string | number, data: UpdateSessionRequest): Promise<Session>;
|
|
30
|
+
deleteSession(id: string | number): Promise<void>;
|
|
31
|
+
archiveSession(id: string | number): Promise<Session>;
|
|
32
|
+
unarchiveSession(id: string | number): Promise<Session>;
|
|
33
|
+
followUp(id: string | number, prompt: string): Promise<SessionActionResponse>;
|
|
34
|
+
pauseSession(id: string | number): Promise<SessionActionResponse>;
|
|
35
|
+
restartSession(id: string | number): Promise<SessionActionResponse>;
|
|
36
|
+
listLogs(sessionId: string | number, options?: {
|
|
37
|
+
level?: LogLevel;
|
|
38
|
+
page?: number;
|
|
39
|
+
per_page?: number;
|
|
40
|
+
}): Promise<LogsResponse>;
|
|
41
|
+
getLog(sessionId: string | number, logId: number): Promise<Log>;
|
|
42
|
+
createLog(sessionId: string | number, data: CreateLogRequest): Promise<Log>;
|
|
43
|
+
updateLog(sessionId: string | number, logId: number, data: UpdateLogRequest): Promise<Log>;
|
|
44
|
+
deleteLog(sessionId: string | number, logId: number): Promise<void>;
|
|
45
|
+
listSubagentTranscripts(sessionId: string | number, options?: {
|
|
46
|
+
status?: SubagentStatus;
|
|
47
|
+
subagent_type?: string;
|
|
48
|
+
page?: number;
|
|
49
|
+
per_page?: number;
|
|
50
|
+
}): Promise<SubagentTranscriptsResponse>;
|
|
51
|
+
getSubagentTranscript(sessionId: string | number, transcriptId: number, includeTranscript?: boolean): Promise<SubagentTranscript>;
|
|
52
|
+
createSubagentTranscript(sessionId: string | number, data: CreateSubagentTranscriptRequest): Promise<SubagentTranscript>;
|
|
53
|
+
updateSubagentTranscript(sessionId: string | number, transcriptId: number, data: UpdateSubagentTranscriptRequest): Promise<SubagentTranscript>;
|
|
54
|
+
deleteSubagentTranscript(sessionId: string | number, transcriptId: number): Promise<void>;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Implementation of the Agent Orchestrator API client.
|
|
58
|
+
*/
|
|
59
|
+
export declare class AgentOrchestratorClient implements IAgentOrchestratorClient {
|
|
60
|
+
private baseUrl;
|
|
61
|
+
private apiKey;
|
|
62
|
+
private timeoutMs;
|
|
63
|
+
constructor(baseUrl: string, apiKey: string, timeoutMs?: number);
|
|
64
|
+
private request;
|
|
65
|
+
listSessions(options?: {
|
|
66
|
+
status?: SessionStatus;
|
|
67
|
+
agent_type?: string;
|
|
68
|
+
show_archived?: boolean;
|
|
69
|
+
page?: number;
|
|
70
|
+
per_page?: number;
|
|
71
|
+
}): Promise<SessionsResponse>;
|
|
72
|
+
searchSessions(query: string, options?: {
|
|
73
|
+
search_contents?: boolean;
|
|
74
|
+
status?: SessionStatus;
|
|
75
|
+
agent_type?: string;
|
|
76
|
+
show_archived?: boolean;
|
|
77
|
+
page?: number;
|
|
78
|
+
per_page?: number;
|
|
79
|
+
}): Promise<SearchSessionsResponse>;
|
|
80
|
+
getSession(id: string | number, includeTranscript?: boolean): Promise<Session>;
|
|
81
|
+
createSession(data: CreateSessionRequest): Promise<Session>;
|
|
82
|
+
updateSession(id: string | number, data: UpdateSessionRequest): Promise<Session>;
|
|
83
|
+
deleteSession(id: string | number): Promise<void>;
|
|
84
|
+
archiveSession(id: string | number): Promise<Session>;
|
|
85
|
+
unarchiveSession(id: string | number): Promise<Session>;
|
|
86
|
+
followUp(id: string | number, prompt: string): Promise<SessionActionResponse>;
|
|
87
|
+
pauseSession(id: string | number): Promise<SessionActionResponse>;
|
|
88
|
+
restartSession(id: string | number): Promise<SessionActionResponse>;
|
|
89
|
+
listLogs(sessionId: string | number, options?: {
|
|
90
|
+
level?: LogLevel;
|
|
91
|
+
page?: number;
|
|
92
|
+
per_page?: number;
|
|
93
|
+
}): Promise<LogsResponse>;
|
|
94
|
+
getLog(sessionId: string | number, logId: number): Promise<Log>;
|
|
95
|
+
createLog(sessionId: string | number, data: CreateLogRequest): Promise<Log>;
|
|
96
|
+
updateLog(sessionId: string | number, logId: number, data: UpdateLogRequest): Promise<Log>;
|
|
97
|
+
deleteLog(sessionId: string | number, logId: number): Promise<void>;
|
|
98
|
+
listSubagentTranscripts(sessionId: string | number, options?: {
|
|
99
|
+
status?: SubagentStatus;
|
|
100
|
+
subagent_type?: string;
|
|
101
|
+
page?: number;
|
|
102
|
+
per_page?: number;
|
|
103
|
+
}): Promise<SubagentTranscriptsResponse>;
|
|
104
|
+
getSubagentTranscript(sessionId: string | number, transcriptId: number, includeTranscript?: boolean): Promise<SubagentTranscript>;
|
|
105
|
+
createSubagentTranscript(sessionId: string | number, data: CreateSubagentTranscriptRequest): Promise<SubagentTranscript>;
|
|
106
|
+
updateSubagentTranscript(sessionId: string | number, transcriptId: number, data: UpdateSubagentTranscriptRequest): Promise<SubagentTranscript>;
|
|
107
|
+
deleteSubagentTranscript(sessionId: string | number, transcriptId: number): Promise<void>;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=orchestrator-client.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration mock for the Agent Orchestrator API client.
|
|
3
|
+
*
|
|
4
|
+
* Used in integration tests to simulate API responses without hitting real endpoints.
|
|
5
|
+
*/
|
|
6
|
+
import type { IAgentOrchestratorClient } from './orchestrator-client.js';
|
|
7
|
+
import type { Session, Log, SubagentTranscript } from '../types.js';
|
|
8
|
+
interface MockData {
|
|
9
|
+
sessions?: Session[];
|
|
10
|
+
logs?: Log[];
|
|
11
|
+
subagentTranscripts?: SubagentTranscript[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Creates a mock Agent Orchestrator client for integration testing.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createIntegrationMockOrchestratorClient(initialMockData?: MockData): IAgentOrchestratorClient & {
|
|
17
|
+
mockData: MockData;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=orchestrator-client.integration-mock.d.ts.map
|