agenticros 0.5.1 → 0.5.3

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.
Files changed (34) hide show
  1. package/README.md +2 -0
  2. package/dist/commands/up.d.ts +1 -0
  3. package/dist/commands/up.d.ts.map +1 -1
  4. package/dist/commands/up.js +3 -2
  5. package/dist/commands/up.js.map +1 -1
  6. package/dist/index.js +1 -0
  7. package/dist/index.js.map +1 -1
  8. package/dist/runners/sim.d.ts +2 -0
  9. package/dist/runners/sim.d.ts.map +1 -1
  10. package/dist/runners/sim.js +7 -0
  11. package/dist/runners/sim.js.map +1 -1
  12. package/package.json +2 -2
  13. package/runtime/BUNDLE.json +1 -1
  14. package/runtime/README.md +20 -48
  15. package/runtime/docs/cli.md +4 -2
  16. package/runtime/packages/agenticros-claude-code/README.md +1 -1
  17. package/runtime/packages/core/README.md +4 -2
  18. package/runtime/packages/core/package.json +1 -1
  19. package/runtime/packages/core/src/__tests__/external-capability.test.ts +21 -0
  20. package/runtime/packages/core/src/external-capability.ts +35 -0
  21. package/runtime/pnpm-lock.yaml +5 -5
  22. package/runtime/ros2_ws/src/agenticros_sim/CMakeLists.txt +1 -0
  23. package/runtime/ros2_ws/src/agenticros_sim/README.md +13 -10
  24. package/runtime/ros2_ws/src/agenticros_sim/config/agenticros-sim.config.json +3 -2
  25. package/runtime/ros2_ws/src/agenticros_sim/config/amr_bridge.yaml +6 -4
  26. package/runtime/ros2_ws/src/agenticros_sim/config/nav2_params.yaml +320 -0
  27. package/runtime/ros2_ws/src/agenticros_sim/launch/sim_amr_nav2.launch.py +101 -0
  28. package/runtime/ros2_ws/src/agenticros_sim/maps/agenticros_indoor.pgm +0 -0
  29. package/runtime/ros2_ws/src/agenticros_sim/maps/agenticros_indoor.yaml +7 -0
  30. package/runtime/ros2_ws/src/agenticros_sim/models/agenticros_amr/model.sdf +18 -1
  31. package/runtime/ros2_ws/src/agenticros_sim/package.xml +15 -2
  32. package/runtime/ros2_ws/src/agenticros_sim/urdf/agenticros_amr.urdf.xacro +9 -0
  33. package/runtime/scripts/sim/run_sim.sh +26 -5
  34. package/runtime/scripts/test-navigate-sim.mjs +164 -0
@@ -0,0 +1,164 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Smoke-test Nav2 against sim-amr (--nav2).
4
+ *
5
+ * Prerequisites (already running):
6
+ * agenticros up sim-amr --nav2 --headless
7
+ * npx agenticros skills install @agenticros/navigate-to
8
+ *
9
+ * Sequence:
10
+ * 1. list topics / capabilities (sanity)
11
+ * 2. run_mission navigate_to → {x: 2.0, y: 1.0} (clear of person at 2.5,0)
12
+ * 3. report success / failure
13
+ *
14
+ * Usage (from repo root, after building MCP server):
15
+ * node scripts/test-navigate-sim.mjs
16
+ */
17
+
18
+ import { spawn } from "node:child_process";
19
+ import { fileURLToPath } from "node:url";
20
+ import { dirname, join, resolve } from "node:path";
21
+
22
+ const __dirname = dirname(fileURLToPath(import.meta.url));
23
+ const repoRoot = resolve(__dirname, "..");
24
+ const serverDist = join(repoRoot, "packages/agenticros-claude-code/dist/index.js");
25
+
26
+ const GOAL = { x: 2.0, y: 1.0, yaw: 0.0 };
27
+ const MISSION_TIMEOUT_MS = 120_000;
28
+
29
+ const child = spawn(process.execPath, [serverDist], {
30
+ stdio: ["pipe", "pipe", "pipe"],
31
+ env: {
32
+ ...process.env,
33
+ // Sim publishes at graph root; empty namespace.
34
+ AGENTICROS_ROBOT_NAMESPACE: process.env.AGENTICROS_ROBOT_NAMESPACE ?? "",
35
+ AGENTICROS_USE_SIM_TIME: process.env.AGENTICROS_USE_SIM_TIME ?? "1",
36
+ },
37
+ });
38
+
39
+ child.stderr.on("data", (d) => {
40
+ process.stderr.write(`[mcp-stderr] ${d}`);
41
+ });
42
+
43
+ let nextId = 1;
44
+ const pending = new Map();
45
+ let buf = "";
46
+
47
+ child.stdout.on("data", (chunk) => {
48
+ buf += chunk.toString();
49
+ let nl;
50
+ while ((nl = buf.indexOf("\n")) !== -1) {
51
+ const line = buf.slice(0, nl).trim();
52
+ buf = buf.slice(nl + 1);
53
+ if (!line) continue;
54
+ let msg;
55
+ try {
56
+ msg = JSON.parse(line);
57
+ } catch {
58
+ continue;
59
+ }
60
+ if (msg.id !== undefined && pending.has(msg.id)) {
61
+ const { resolve: res, reject } = pending.get(msg.id);
62
+ pending.delete(msg.id);
63
+ if (msg.error) reject(new Error(msg.error.message));
64
+ else res(msg.result);
65
+ }
66
+ }
67
+ });
68
+
69
+ function rpc(method, params = {}, timeoutMs = 30000) {
70
+ const id = nextId++;
71
+ return new Promise((resolveOuter, reject) => {
72
+ const t = setTimeout(() => {
73
+ pending.delete(id);
74
+ reject(new Error(`Timeout: ${method}`));
75
+ }, timeoutMs);
76
+ pending.set(id, {
77
+ resolve: (v) => {
78
+ clearTimeout(t);
79
+ resolveOuter(v);
80
+ },
81
+ reject: (e) => {
82
+ clearTimeout(t);
83
+ reject(e);
84
+ },
85
+ });
86
+ child.stdin.write(JSON.stringify({ jsonrpc: "2.0", id, method, params }) + "\n");
87
+ });
88
+ }
89
+
90
+ function pickText(result) {
91
+ return result?.content?.map((c) => c.text ?? "").join("\n") ?? "";
92
+ }
93
+
94
+ async function main() {
95
+ console.log("=== navigate_to (sim-amr + Nav2) smoke ===");
96
+ console.log(`Goal: (${GOAL.x}, ${GOAL.y}, yaw=${GOAL.yaw})`);
97
+
98
+ await rpc("initialize", {
99
+ protocolVersion: "2024-11-05",
100
+ capabilities: { tools: {} },
101
+ clientInfo: { name: "nav-e2e", version: "0.0.1" },
102
+ });
103
+ await rpc("notifications/initialized", {}).catch(() => {});
104
+
105
+ console.log("\n-- ros2_list_topics (expect /odom, /scan, /cmd_vel) --");
106
+ const topics = await rpc("tools/call", { name: "ros2_list_topics", arguments: {} });
107
+ const topicText = pickText(topics);
108
+ console.log(topicText.slice(0, 800));
109
+ for (const t of ["/odom", "/scan", "/cmd_vel"]) {
110
+ if (!topicText.includes(t)) {
111
+ console.warn(`WARN: expected topic ${t} not listed — is sim-amr --nav2 running?`);
112
+ }
113
+ }
114
+
115
+ console.log("\n-- ros2_list_capabilities (expect navigate_to) --");
116
+ const caps = await rpc("tools/call", {
117
+ name: "ros2_list_capabilities",
118
+ arguments: {},
119
+ }).catch((e) => ({ content: [{ text: String(e) }] }));
120
+ const capText = pickText(caps);
121
+ console.log(capText.slice(0, 800));
122
+ if (!capText.includes("navigate_to")) {
123
+ console.warn(
124
+ "WARN: navigate_to not in capabilities — install @agenticros/navigate-to and restart MCP.",
125
+ );
126
+ }
127
+
128
+ console.log("\n-- run_mission navigate_to --");
129
+ const mission = await rpc(
130
+ "tools/call",
131
+ {
132
+ name: "run_mission",
133
+ arguments: {
134
+ steps: [
135
+ {
136
+ capability: "navigate_to",
137
+ inputs: GOAL,
138
+ },
139
+ ],
140
+ },
141
+ },
142
+ MISSION_TIMEOUT_MS,
143
+ );
144
+ const missionText = pickText(mission);
145
+ console.log(missionText);
146
+
147
+ const ok =
148
+ /succeed|completed|status["']?\s*[:=]\s*["']?succeeded/i.test(missionText) &&
149
+ !/fail|error|abort/i.test(missionText.split("\n").slice(-5).join("\n"));
150
+
151
+ child.kill("SIGTERM");
152
+ if (ok) {
153
+ console.log("\n=== PASS ===");
154
+ process.exit(0);
155
+ }
156
+ console.error("\n=== FAIL (inspect mission output above) ===");
157
+ process.exit(1);
158
+ }
159
+
160
+ main().catch((e) => {
161
+ console.error("Failed:", e);
162
+ child.kill("SIGKILL");
163
+ process.exit(1);
164
+ });