@love-moon/conductor-sdk 0.2.4 → 0.2.5
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/backend/client.d.ts +1 -0
- package/dist/bin/mcp-server.js +26 -1
- package/dist/mcp/server.d.ts +2 -0
- package/dist/mcp/server.js +26 -0
- package/package.json +1 -1
package/dist/backend/client.d.ts
CHANGED
package/dist/bin/mcp-server.js
CHANGED
|
@@ -9,7 +9,12 @@ async function main() {
|
|
|
9
9
|
const notifier = new MCPNotifier();
|
|
10
10
|
const router = new MessageRouter(sessions, notifier);
|
|
11
11
|
const backendApi = new BackendApiClient(config);
|
|
12
|
-
const
|
|
12
|
+
const configuredAgentHost = typeof process.env.CONDUCTOR_AGENT_NAME === 'string' && process.env.CONDUCTOR_AGENT_NAME.trim()
|
|
13
|
+
? process.env.CONDUCTOR_AGENT_NAME.trim()
|
|
14
|
+
: typeof process.env.CONDUCTOR_DAEMON_NAME === 'string' && process.env.CONDUCTOR_DAEMON_NAME.trim()
|
|
15
|
+
? process.env.CONDUCTOR_DAEMON_NAME.trim()
|
|
16
|
+
: defaultConductorFireHostName();
|
|
17
|
+
const wsClient = new ConductorWebSocketClient(config, { hostName: configuredAgentHost });
|
|
13
18
|
const backendSender = async (envelope) => {
|
|
14
19
|
await wsClient.sendJson(envelope);
|
|
15
20
|
};
|
|
@@ -19,6 +24,7 @@ async function main() {
|
|
|
19
24
|
messageRouter: router,
|
|
20
25
|
backendSender,
|
|
21
26
|
backendApi,
|
|
27
|
+
agentHost: configuredAgentHost,
|
|
22
28
|
});
|
|
23
29
|
const orchestrator = new SDKOrchestrator({
|
|
24
30
|
wsClient,
|
|
@@ -46,6 +52,7 @@ async function main() {
|
|
|
46
52
|
properties: {
|
|
47
53
|
project_id: { type: 'string' },
|
|
48
54
|
task_title: { type: 'string' },
|
|
55
|
+
agent_host: { type: 'string' },
|
|
49
56
|
prefill: { type: 'string' },
|
|
50
57
|
project_path: { type: 'string' },
|
|
51
58
|
},
|
|
@@ -97,6 +104,19 @@ async function main() {
|
|
|
97
104
|
required: ['task_id', 'content'],
|
|
98
105
|
},
|
|
99
106
|
},
|
|
107
|
+
{
|
|
108
|
+
name: 'send_task_status',
|
|
109
|
+
description: 'Send a terminal or lifecycle task status update',
|
|
110
|
+
inputSchema: {
|
|
111
|
+
type: 'object',
|
|
112
|
+
properties: {
|
|
113
|
+
task_id: { type: 'string' },
|
|
114
|
+
status: { type: 'string' },
|
|
115
|
+
summary: { type: 'string' },
|
|
116
|
+
},
|
|
117
|
+
required: ['task_id', 'status'],
|
|
118
|
+
},
|
|
119
|
+
},
|
|
100
120
|
{
|
|
101
121
|
name: 'send_runtime_status',
|
|
102
122
|
description: 'Send a runtime status update to a task',
|
|
@@ -191,6 +211,11 @@ async function main() {
|
|
|
191
211
|
process.exit(0);
|
|
192
212
|
});
|
|
193
213
|
}
|
|
214
|
+
function defaultConductorFireHostName() {
|
|
215
|
+
const pid = process.pid;
|
|
216
|
+
const host = process.env.HOSTNAME || process.env.COMPUTERNAME || 'unknown-host';
|
|
217
|
+
return `conductor-fire-${host}-${pid}`;
|
|
218
|
+
}
|
|
194
219
|
main().catch((err) => {
|
|
195
220
|
console.error(err);
|
|
196
221
|
process.exit(1);
|
package/dist/mcp/server.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export interface MCPServerOptions {
|
|
|
11
11
|
backendApi: Pick<BackendApiClient, 'listProjects' | 'listTasks' | 'createProject' | 'createTask' | 'matchProjectByPath' | 'getProject' | 'updateProject'>;
|
|
12
12
|
sessionStore?: SessionDiskStore;
|
|
13
13
|
env?: Record<string, string | undefined>;
|
|
14
|
+
agentHost?: string;
|
|
14
15
|
}
|
|
15
16
|
type ToolRequest = Record<string, any>;
|
|
16
17
|
type ToolResponse = Record<string, any>;
|
|
@@ -24,6 +25,7 @@ export declare class MCPServer {
|
|
|
24
25
|
handleRequest(toolName: string, payload: ToolRequest): Promise<ToolResponse>;
|
|
25
26
|
private toolCreateTaskSession;
|
|
26
27
|
private toolSendMessage;
|
|
28
|
+
private toolSendTaskStatus;
|
|
27
29
|
private toolSendRuntimeStatus;
|
|
28
30
|
private toolReceiveMessages;
|
|
29
31
|
private toolAckMessages;
|
package/dist/mcp/server.js
CHANGED
|
@@ -16,6 +16,7 @@ export class MCPServer {
|
|
|
16
16
|
this.tools = {
|
|
17
17
|
create_task_session: this.toolCreateTaskSession,
|
|
18
18
|
send_message: this.toolSendMessage,
|
|
19
|
+
send_task_status: this.toolSendTaskStatus,
|
|
19
20
|
send_runtime_status: this.toolSendRuntimeStatus,
|
|
20
21
|
receive_messages: this.toolReceiveMessages,
|
|
21
22
|
ack_messages: this.toolAckMessages,
|
|
@@ -49,7 +50,17 @@ export class MCPServer {
|
|
|
49
50
|
id: taskId,
|
|
50
51
|
projectId,
|
|
51
52
|
title,
|
|
53
|
+
backendType: typeof payload.backend_type === 'string'
|
|
54
|
+
? payload.backend_type
|
|
55
|
+
: typeof payload.backendType === 'string'
|
|
56
|
+
? payload.backendType
|
|
57
|
+
: undefined,
|
|
52
58
|
initialContent: payload.prefill,
|
|
59
|
+
agentHost: typeof payload.agent_host === 'string'
|
|
60
|
+
? payload.agent_host
|
|
61
|
+
: typeof payload.agentHost === 'string'
|
|
62
|
+
? payload.agentHost
|
|
63
|
+
: this.options.agentHost,
|
|
53
64
|
});
|
|
54
65
|
await this.waitForTaskCreation(projectId, taskId);
|
|
55
66
|
const projectPath = typeof payload.project_path === 'string' && payload.project_path
|
|
@@ -83,6 +94,21 @@ export class MCPServer {
|
|
|
83
94
|
});
|
|
84
95
|
return { delivered: true };
|
|
85
96
|
}
|
|
97
|
+
async toolSendTaskStatus(payload) {
|
|
98
|
+
const taskId = String(payload.task_id || '');
|
|
99
|
+
if (!taskId) {
|
|
100
|
+
throw new Error('task_id required');
|
|
101
|
+
}
|
|
102
|
+
await this.options.backendSender({
|
|
103
|
+
type: 'task_status_update',
|
|
104
|
+
payload: {
|
|
105
|
+
task_id: taskId,
|
|
106
|
+
status: payload.status,
|
|
107
|
+
summary: payload.summary,
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
return { delivered: true };
|
|
111
|
+
}
|
|
86
112
|
async toolSendRuntimeStatus(payload) {
|
|
87
113
|
const taskId = String(payload.task_id || '');
|
|
88
114
|
if (!taskId) {
|