@annals/agent-mesh 0.15.0 → 0.16.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/dist/index.js +92 -55
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1007,7 +1007,6 @@ var SENSITIVE_PATHS = [
|
|
|
1007
1007
|
// contains ah_ platform token
|
|
1008
1008
|
"~/.agent-mesh/pids",
|
|
1009
1009
|
"~/.agent-mesh/logs",
|
|
1010
|
-
"~/.codex",
|
|
1011
1010
|
// Package manager tokens
|
|
1012
1011
|
"~/.npmrc",
|
|
1013
1012
|
"~/.yarnrc",
|
|
@@ -1027,16 +1026,6 @@ var SANDBOX_PRESETS = {
|
|
|
1027
1026
|
allowWrite: [".", "/tmp"],
|
|
1028
1027
|
denyWrite: [".env", ".env.*"]
|
|
1029
1028
|
},
|
|
1030
|
-
codex: {
|
|
1031
|
-
denyRead: [...SENSITIVE_PATHS],
|
|
1032
|
-
allowWrite: [".", "/tmp"],
|
|
1033
|
-
denyWrite: [".env", ".env.*"]
|
|
1034
|
-
},
|
|
1035
|
-
gemini: {
|
|
1036
|
-
denyRead: [...SENSITIVE_PATHS],
|
|
1037
|
-
allowWrite: [".", "/tmp"],
|
|
1038
|
-
denyWrite: [".env", ".env.*"]
|
|
1039
|
-
},
|
|
1040
1029
|
openclaw: {
|
|
1041
1030
|
denyRead: [...SENSITIVE_PATHS],
|
|
1042
1031
|
allowWrite: ["/tmp"],
|
|
@@ -1748,34 +1737,6 @@ var ClaudeAdapter = class extends AgentAdapter {
|
|
|
1748
1737
|
}
|
|
1749
1738
|
};
|
|
1750
1739
|
|
|
1751
|
-
// src/adapters/codex.ts
|
|
1752
|
-
var CodexAdapter = class extends AgentAdapter {
|
|
1753
|
-
type = "codex";
|
|
1754
|
-
displayName = "Codex CLI";
|
|
1755
|
-
async isAvailable() {
|
|
1756
|
-
return false;
|
|
1757
|
-
}
|
|
1758
|
-
createSession(_id, _config) {
|
|
1759
|
-
throw new Error("Codex adapter not yet implemented");
|
|
1760
|
-
}
|
|
1761
|
-
destroySession(_id) {
|
|
1762
|
-
}
|
|
1763
|
-
};
|
|
1764
|
-
|
|
1765
|
-
// src/adapters/gemini.ts
|
|
1766
|
-
var GeminiAdapter = class extends AgentAdapter {
|
|
1767
|
-
type = "gemini";
|
|
1768
|
-
displayName = "Gemini CLI";
|
|
1769
|
-
async isAvailable() {
|
|
1770
|
-
return false;
|
|
1771
|
-
}
|
|
1772
|
-
createSession(_id, _config) {
|
|
1773
|
-
throw new Error("Gemini adapter not yet implemented");
|
|
1774
|
-
}
|
|
1775
|
-
destroySession(_id) {
|
|
1776
|
-
}
|
|
1777
|
-
};
|
|
1778
|
-
|
|
1779
1740
|
// src/commands/connect.ts
|
|
1780
1741
|
var DEFAULT_BRIDGE_URL = "wss://bridge.agents.hot/ws";
|
|
1781
1742
|
function logWorkspaceHint(slug, projectPath) {
|
|
@@ -1791,12 +1752,8 @@ function createAdapter(type, config) {
|
|
|
1791
1752
|
return new OpenClawAdapter(config);
|
|
1792
1753
|
case "claude":
|
|
1793
1754
|
return new ClaudeAdapter(config);
|
|
1794
|
-
case "codex":
|
|
1795
|
-
return new CodexAdapter(config);
|
|
1796
|
-
case "gemini":
|
|
1797
|
-
return new GeminiAdapter(config);
|
|
1798
1755
|
default:
|
|
1799
|
-
throw new Error(`Unknown agent type: ${type}. Supported: openclaw, claude
|
|
1756
|
+
throw new Error(`Unknown agent type: ${type}. Supported: openclaw, claude`);
|
|
1800
1757
|
}
|
|
1801
1758
|
}
|
|
1802
1759
|
function registerConnectCommand(program2) {
|
|
@@ -1962,11 +1919,7 @@ function registerConnectCommand(program2) {
|
|
|
1962
1919
|
log.info(`Checking ${adapter.displayName} availability...`);
|
|
1963
1920
|
const available = await adapter.isAvailable();
|
|
1964
1921
|
if (!available) {
|
|
1965
|
-
|
|
1966
|
-
log.error(`${adapter.displayName} adapter is not yet implemented. Supported adapters: openclaw, claude`);
|
|
1967
|
-
} else {
|
|
1968
|
-
log.error(`${adapter.displayName} is not available. Make sure it is installed and running.`);
|
|
1969
|
-
}
|
|
1922
|
+
log.error(`${adapter.displayName} is not available. Make sure it is installed and running.`);
|
|
1970
1923
|
process.exit(1);
|
|
1971
1924
|
}
|
|
1972
1925
|
log.success(`${adapter.displayName} is available`);
|
|
@@ -2208,7 +2161,7 @@ function registerStatusCommand(program2) {
|
|
|
2208
2161
|
}
|
|
2209
2162
|
console.log("\nTo connect an agent, run:");
|
|
2210
2163
|
console.log(" agent-mesh connect <type> --agent-id <id>");
|
|
2211
|
-
console.log("\nSupported types: openclaw, claude
|
|
2164
|
+
console.log("\nSupported types: openclaw, claude");
|
|
2212
2165
|
});
|
|
2213
2166
|
}
|
|
2214
2167
|
|
|
@@ -2966,6 +2919,12 @@ async function asyncChat(opts) {
|
|
|
2966
2919
|
process.stderr.write(` done
|
|
2967
2920
|
`);
|
|
2968
2921
|
process.stdout.write((task.result || "") + "\n");
|
|
2922
|
+
if (task.attachments?.length) {
|
|
2923
|
+
for (const att of task.attachments) {
|
|
2924
|
+
process.stdout.write(`${GRAY}[file: ${att.name} -> ${att.url}]${RESET}
|
|
2925
|
+
`);
|
|
2926
|
+
}
|
|
2927
|
+
}
|
|
2969
2928
|
return;
|
|
2970
2929
|
}
|
|
2971
2930
|
if (task.status === "failed") {
|
|
@@ -3853,6 +3812,25 @@ function registerDiscoverCommand(program2) {
|
|
|
3853
3812
|
// src/commands/call.ts
|
|
3854
3813
|
import { readFileSync, writeFileSync as writeFileSync2 } from "fs";
|
|
3855
3814
|
var DEFAULT_BASE_URL4 = "https://agents.hot";
|
|
3815
|
+
async function submitRating(baseUrl, token, agentId, callId, rating) {
|
|
3816
|
+
const res = await fetch(`${baseUrl}/api/agents/${agentId}/rate`, {
|
|
3817
|
+
method: "POST",
|
|
3818
|
+
headers: {
|
|
3819
|
+
Authorization: `Bearer ${token}`,
|
|
3820
|
+
"Content-Type": "application/json"
|
|
3821
|
+
},
|
|
3822
|
+
body: JSON.stringify({ call_id: callId, rating })
|
|
3823
|
+
});
|
|
3824
|
+
if (!res.ok) {
|
|
3825
|
+
let msg = `HTTP ${res.status}`;
|
|
3826
|
+
try {
|
|
3827
|
+
const body = await res.json();
|
|
3828
|
+
msg = body.message || body.error || msg;
|
|
3829
|
+
} catch {
|
|
3830
|
+
}
|
|
3831
|
+
throw new Error(msg);
|
|
3832
|
+
}
|
|
3833
|
+
}
|
|
3856
3834
|
function sleep5(ms) {
|
|
3857
3835
|
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
3858
3836
|
}
|
|
@@ -3925,15 +3903,30 @@ async function asyncCall(opts) {
|
|
|
3925
3903
|
}
|
|
3926
3904
|
const result = task.result || "";
|
|
3927
3905
|
if (opts.json) {
|
|
3928
|
-
console.log(JSON.stringify({
|
|
3906
|
+
console.log(JSON.stringify({
|
|
3907
|
+
call_id,
|
|
3908
|
+
request_id,
|
|
3909
|
+
status: "completed",
|
|
3910
|
+
result,
|
|
3911
|
+
...task.attachments?.length ? { attachments: task.attachments } : {},
|
|
3912
|
+
rate_hint: `POST /api/agents/${opts.id}/rate body: { call_id: "${call_id}", rating: 1-5 }`
|
|
3913
|
+
}));
|
|
3929
3914
|
} else {
|
|
3930
3915
|
process.stdout.write(result + "\n");
|
|
3916
|
+
if (task.attachments?.length) {
|
|
3917
|
+
for (const att of task.attachments) {
|
|
3918
|
+
log.info(` ${GRAY}File:${RESET} ${att.name} ${GRAY}${att.url}${RESET}`);
|
|
3919
|
+
}
|
|
3920
|
+
}
|
|
3931
3921
|
}
|
|
3932
3922
|
if (opts.outputFile && result) {
|
|
3933
3923
|
writeFileSync2(opts.outputFile, result);
|
|
3934
3924
|
if (!opts.json) log.info(`Saved to ${opts.outputFile}`);
|
|
3935
3925
|
}
|
|
3936
|
-
|
|
3926
|
+
if (!opts.json) {
|
|
3927
|
+
log.info(`${GRAY}Rate this call: agent-mesh rate ${call_id} <1-5> --agent ${opts.id}${RESET}`);
|
|
3928
|
+
}
|
|
3929
|
+
return { callId: call_id };
|
|
3937
3930
|
}
|
|
3938
3931
|
if (task.status === "failed") {
|
|
3939
3932
|
if (!opts.json) {
|
|
@@ -4012,6 +4005,7 @@ async function streamCall(opts) {
|
|
|
4012
4005
|
let buffer = "";
|
|
4013
4006
|
let outputBuffer = "";
|
|
4014
4007
|
let inThinkingBlock = false;
|
|
4008
|
+
let callId = res.headers.get("X-Call-Id") || "";
|
|
4015
4009
|
while (true) {
|
|
4016
4010
|
const { done, value } = await reader.read();
|
|
4017
4011
|
if (done) break;
|
|
@@ -4022,6 +4016,9 @@ async function streamCall(opts) {
|
|
|
4022
4016
|
if (data === "[DONE]") continue;
|
|
4023
4017
|
try {
|
|
4024
4018
|
const event = JSON.parse(data);
|
|
4019
|
+
if (event.type === "start" && event.call_id) {
|
|
4020
|
+
callId = event.call_id;
|
|
4021
|
+
}
|
|
4025
4022
|
if (opts.json) {
|
|
4026
4023
|
console.log(JSON.stringify(event));
|
|
4027
4024
|
} else {
|
|
@@ -4082,10 +4079,14 @@ Error: ${event.message}
|
|
|
4082
4079
|
if (!opts.json) {
|
|
4083
4080
|
console.log("\n");
|
|
4084
4081
|
log.success("Call completed");
|
|
4082
|
+
if (callId) {
|
|
4083
|
+
log.info(`${GRAY}Rate this call: agent-mesh rate ${callId} <1-5> --agent ${opts.id}${RESET}`);
|
|
4084
|
+
}
|
|
4085
4085
|
}
|
|
4086
|
+
return { callId };
|
|
4086
4087
|
}
|
|
4087
4088
|
function registerCallCommand(program2) {
|
|
4088
|
-
program2.command("call <agent>").description("Call an agent on the A2A network (default: async polling)").requiredOption("--task <description>", "Task description").option("--input-file <path>", "Read file and append to task description").option("--output-file <path>", "Save response text to file").option("--stream", "Use SSE streaming instead of async polling").option("--json", "Output JSONL events").option("--timeout <seconds>", "Timeout in seconds", "300").action(async (agentInput, opts) => {
|
|
4089
|
+
program2.command("call <agent>").description("Call an agent on the A2A network (default: async polling)").requiredOption("--task <description>", "Task description").option("--input-file <path>", "Read file and append to task description").option("--output-file <path>", "Save response text to file").option("--stream", "Use SSE streaming instead of async polling").option("--json", "Output JSONL events").option("--timeout <seconds>", "Timeout in seconds", "300").option("--rate <rating>", "Rate the agent after call (1-5)", parseInt).action(async (agentInput, opts) => {
|
|
4089
4090
|
try {
|
|
4090
4091
|
const token = loadToken();
|
|
4091
4092
|
if (!token) {
|
|
@@ -4116,12 +4117,23 @@ ${content}`;
|
|
|
4116
4117
|
outputFile: opts.outputFile,
|
|
4117
4118
|
signal: abortController.signal
|
|
4118
4119
|
};
|
|
4120
|
+
let result;
|
|
4119
4121
|
if (opts.stream) {
|
|
4120
|
-
await streamCall(callOpts);
|
|
4122
|
+
result = await streamCall(callOpts);
|
|
4121
4123
|
} else {
|
|
4122
|
-
await asyncCall(callOpts);
|
|
4124
|
+
result = await asyncCall(callOpts);
|
|
4123
4125
|
}
|
|
4124
4126
|
clearTimeout(timer);
|
|
4127
|
+
if (opts.rate && result.callId) {
|
|
4128
|
+
try {
|
|
4129
|
+
await submitRating(DEFAULT_BASE_URL4, token, id, result.callId, opts.rate);
|
|
4130
|
+
if (!opts.json) {
|
|
4131
|
+
log.success(`Rated ${opts.rate}/5`);
|
|
4132
|
+
}
|
|
4133
|
+
} catch (rateErr) {
|
|
4134
|
+
log.warn(`Rating failed: ${rateErr.message}`);
|
|
4135
|
+
}
|
|
4136
|
+
}
|
|
4125
4137
|
} catch (err) {
|
|
4126
4138
|
if (err.name === "AbortError") {
|
|
4127
4139
|
log.error("Call timed out");
|
|
@@ -4421,6 +4433,30 @@ function registerRegisterCommand(program2) {
|
|
|
4421
4433
|
});
|
|
4422
4434
|
}
|
|
4423
4435
|
|
|
4436
|
+
// src/commands/rate.ts
|
|
4437
|
+
var DEFAULT_BASE_URL6 = "https://agents.hot";
|
|
4438
|
+
function registerRateCommand(program2) {
|
|
4439
|
+
program2.command("rate <call-id> <rating>").description("Rate a completed A2A call (1-5)").requiredOption("--agent <agent-id>", "Agent UUID that was called").action(async (callId, ratingStr, opts) => {
|
|
4440
|
+
const token = loadToken();
|
|
4441
|
+
if (!token) {
|
|
4442
|
+
log.error("Not authenticated. Run `agent-mesh login` first.");
|
|
4443
|
+
process.exit(1);
|
|
4444
|
+
}
|
|
4445
|
+
const rating = parseInt(ratingStr, 10);
|
|
4446
|
+
if (isNaN(rating) || rating < 1 || rating > 5) {
|
|
4447
|
+
log.error("Rating must be an integer between 1 and 5");
|
|
4448
|
+
process.exit(1);
|
|
4449
|
+
}
|
|
4450
|
+
try {
|
|
4451
|
+
await submitRating(DEFAULT_BASE_URL6, token, opts.agent, callId, rating);
|
|
4452
|
+
log.success(`Rated ${rating}/5 for call ${callId.slice(0, 8)}...`);
|
|
4453
|
+
} catch (err) {
|
|
4454
|
+
log.error(err.message);
|
|
4455
|
+
process.exit(1);
|
|
4456
|
+
}
|
|
4457
|
+
});
|
|
4458
|
+
}
|
|
4459
|
+
|
|
4424
4460
|
// src/index.ts
|
|
4425
4461
|
var require2 = createRequire(import.meta.url);
|
|
4426
4462
|
var { version } = require2("../package.json");
|
|
@@ -4449,4 +4485,5 @@ registerConfigCommand(program);
|
|
|
4449
4485
|
registerStatsCommand(program);
|
|
4450
4486
|
registerSubscribeCommand(program);
|
|
4451
4487
|
registerRegisterCommand(program);
|
|
4488
|
+
registerRateCommand(program);
|
|
4452
4489
|
program.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@annals/agent-mesh",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "CLI bridge connecting local AI agents to the Agents.Hot platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"main": "./dist/index.js",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@annals/bridge-protocol": "^0.
|
|
11
|
+
"@annals/bridge-protocol": "^0.2.0",
|
|
12
12
|
"commander": "^13.0.0",
|
|
13
13
|
"ws": "^8.18.0"
|
|
14
14
|
},
|