akemon 0.1.5 → 0.1.7
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/relay-client.js +24 -0
- package/dist/server.js +2 -1
- package/package.json +1 -1
package/dist/relay-client.js
CHANGED
|
@@ -90,6 +90,9 @@ export function connectRelay(options) {
|
|
|
90
90
|
case "mcp_request":
|
|
91
91
|
handleMCPRequest(ws, msg, options.localPort);
|
|
92
92
|
break;
|
|
93
|
+
case "control":
|
|
94
|
+
handleControl(ws, msg);
|
|
95
|
+
break;
|
|
93
96
|
default:
|
|
94
97
|
console.log(`[relay-ws] Unknown message type: ${msg.type}`);
|
|
95
98
|
}
|
|
@@ -113,6 +116,27 @@ export function connectRelay(options) {
|
|
|
113
116
|
}
|
|
114
117
|
connect();
|
|
115
118
|
}
|
|
119
|
+
function handleControl(ws, msg) {
|
|
120
|
+
const action = msg.action || "";
|
|
121
|
+
console.log(`[control] Received: ${action}`);
|
|
122
|
+
switch (action) {
|
|
123
|
+
case "shutdown":
|
|
124
|
+
console.log("[control] Shutting down by remote command...");
|
|
125
|
+
ws.send(JSON.stringify({ type: "control_ack", action }));
|
|
126
|
+
setTimeout(() => process.exit(0), 500);
|
|
127
|
+
break;
|
|
128
|
+
case "set_public":
|
|
129
|
+
console.log("[control] Agent set to public by remote command");
|
|
130
|
+
ws.send(JSON.stringify({ type: "control_ack", action }));
|
|
131
|
+
break;
|
|
132
|
+
case "set_private":
|
|
133
|
+
console.log("[control] Agent set to private by remote command");
|
|
134
|
+
ws.send(JSON.stringify({ type: "control_ack", action }));
|
|
135
|
+
break;
|
|
136
|
+
default:
|
|
137
|
+
console.log(`[control] Unknown action: ${action}`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
116
140
|
function handleMCPRequest(ws, msg, localPort) {
|
|
117
141
|
const requestId = msg.request_id;
|
|
118
142
|
console.log(`[relay-ws] → mcp_request ${requestId}`);
|
package/dist/server.js
CHANGED
|
@@ -9,6 +9,7 @@ function runCommand(cmd, args, task, cwd, stdinMode = true) {
|
|
|
9
9
|
return new Promise((resolve, reject) => {
|
|
10
10
|
const { CLAUDECODE, ...cleanEnv } = process.env;
|
|
11
11
|
const finalArgs = stdinMode ? args : [...args, task];
|
|
12
|
+
console.log(`[engine] Running: ${cmd} ${finalArgs.join(" ")}`);
|
|
12
13
|
const child = spawn(cmd, finalArgs, {
|
|
13
14
|
cwd,
|
|
14
15
|
env: cleanEnv,
|
|
@@ -143,7 +144,7 @@ function createMcpServer(opts) {
|
|
|
143
144
|
});
|
|
144
145
|
const isHuman = engine === "human";
|
|
145
146
|
const contextEnabled = !!(relayHttp && secretKey);
|
|
146
|
-
server.tool("submit_task", {
|
|
147
|
+
server.tool("submit_task", "Submit a task to this agent. Call ONCE per task — the agent will handle execution end-to-end and return the final result. Do NOT call again to verify or confirm; the response IS the final answer.", {
|
|
147
148
|
task: z.string().describe("The task description for the agent to complete"),
|
|
148
149
|
require_human: z.union([z.boolean(), z.string()]).optional().describe("Request the agent owner to review and respond personally."),
|
|
149
150
|
}, async ({ task, require_human: rawHuman }, extra) => {
|