agenticros 0.1.18 → 0.2.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/__tests__/robot-config.test.d.ts +2 -0
- package/dist/__tests__/robot-config.test.d.ts.map +1 -0
- package/dist/__tests__/robot-config.test.js +374 -0
- package/dist/__tests__/robot-config.test.js.map +1 -0
- package/dist/__tests__/transport-shorthand.test.d.ts +2 -0
- package/dist/__tests__/transport-shorthand.test.d.ts.map +1 -0
- package/dist/__tests__/transport-shorthand.test.js +88 -0
- package/dist/__tests__/transport-shorthand.test.js.map +1 -0
- package/dist/commands/robots.d.ts +57 -0
- package/dist/commands/robots.d.ts.map +1 -0
- package/dist/commands/robots.js +678 -0
- package/dist/commands/robots.js.map +1 -0
- package/dist/commands/skills.d.ts.map +1 -1
- package/dist/commands/skills.js +125 -2
- package/dist/commands/skills.js.map +1 -1
- package/dist/index.js +29 -1
- package/dist/index.js.map +1 -1
- package/dist/menu.js +22 -4
- package/dist/menu.js.map +1 -1
- package/dist/util/marketplace.d.ts +57 -0
- package/dist/util/marketplace.d.ts.map +1 -0
- package/dist/util/marketplace.js +144 -0
- package/dist/util/marketplace.js.map +1 -0
- package/dist/util/mcp-discovery.d.ts +57 -0
- package/dist/util/mcp-discovery.d.ts.map +1 -0
- package/dist/util/mcp-discovery.js +153 -0
- package/dist/util/mcp-discovery.js.map +1 -0
- package/dist/util/robot-config.d.ts +167 -0
- package/dist/util/robot-config.d.ts.map +1 -0
- package/dist/util/robot-config.js +375 -0
- package/dist/util/robot-config.js.map +1 -0
- package/dist/util/skills.d.ts +6 -6
- package/dist/util/skills.d.ts.map +1 -1
- package/dist/util/skills.js +14 -9
- package/dist/util/skills.js.map +1 -1
- package/dist/util/transport-shorthand.d.ts +66 -0
- package/dist/util/transport-shorthand.d.ts.map +1 -0
- package/dist/util/transport-shorthand.js +102 -0
- package/dist/util/transport-shorthand.js.map +1 -0
- package/package.json +12 -10
- package/runtime/BUNDLE.json +1 -1
- package/runtime/README.md +62 -1
- package/runtime/package.json +6 -1
- package/runtime/packages/agenticros/openclaw.plugin.json +7 -1
- package/runtime/packages/agenticros/package.json +2 -1
- package/runtime/packages/agenticros/src/__tests__/capabilities-plugin.test.ts +568 -0
- package/runtime/packages/agenticros/src/config-page.ts +1 -1
- package/runtime/packages/agenticros/src/mission-registry.ts +22 -0
- package/runtime/packages/agenticros/src/service.ts +120 -2
- package/runtime/packages/agenticros/src/skill-loader.ts +109 -30
- package/runtime/packages/agenticros/src/tools/_robot-helpers.ts +68 -0
- package/runtime/packages/agenticros/src/tools/index.ts +49 -9
- package/runtime/packages/agenticros/src/tools/mission-cancel.ts +70 -0
- package/runtime/packages/agenticros/src/tools/ros2-action.ts +11 -4
- package/runtime/packages/agenticros/src/tools/ros2-camera.ts +10 -4
- package/runtime/packages/agenticros/src/tools/ros2-capabilities.ts +63 -0
- package/runtime/packages/agenticros/src/tools/ros2-depth-distance.ts +11 -4
- package/runtime/packages/agenticros/src/tools/ros2-discover.ts +65 -0
- package/runtime/packages/agenticros/src/tools/ros2-find-robots-for.ts +128 -0
- package/runtime/packages/agenticros/src/tools/ros2-mission.ts +311 -0
- package/runtime/packages/agenticros/src/tools/ros2-param.ts +20 -7
- package/runtime/packages/agenticros/src/tools/ros2-publish.ts +15 -8
- package/runtime/packages/agenticros/src/tools/ros2-robots.ts +52 -0
- package/runtime/packages/agenticros/src/tools/ros2-service.ts +11 -4
- package/runtime/packages/agenticros/src/tools/ros2-subscribe.ts +11 -4
- package/runtime/packages/agenticros-claude-code/README.md +52 -9
- package/runtime/packages/agenticros-claude-code/dist/__tests__/capabilities-mcp.test.d.ts +2 -0
- package/runtime/packages/agenticros-claude-code/dist/__tests__/capabilities-mcp.test.d.ts.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/__tests__/capabilities-mcp.test.js +773 -0
- package/runtime/packages/agenticros-claude-code/dist/__tests__/capabilities-mcp.test.js.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/__tests__/follow-me-registry.test.d.ts +2 -0
- package/runtime/packages/agenticros-claude-code/dist/__tests__/follow-me-registry.test.d.ts.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/__tests__/follow-me-registry.test.js +97 -0
- package/runtime/packages/agenticros-claude-code/dist/__tests__/follow-me-registry.test.js.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/find-object/find-object.d.ts +2 -2
- package/runtime/packages/agenticros-claude-code/dist/find-object/find-object.d.ts.map +1 -1
- package/runtime/packages/agenticros-claude-code/dist/find-object/find-object.js +5 -5
- package/runtime/packages/agenticros-claude-code/dist/find-object/find-object.js.map +1 -1
- package/runtime/packages/agenticros-claude-code/dist/follow-me/depth-loop.d.ts +109 -0
- package/runtime/packages/agenticros-claude-code/dist/follow-me/depth-loop.d.ts.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/follow-me/depth-loop.js +392 -0
- package/runtime/packages/agenticros-claude-code/dist/follow-me/depth-loop.js.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/follow-me/loop.d.ts +8 -3
- package/runtime/packages/agenticros-claude-code/dist/follow-me/loop.d.ts.map +1 -1
- package/runtime/packages/agenticros-claude-code/dist/follow-me/loop.js +30 -12
- package/runtime/packages/agenticros-claude-code/dist/follow-me/loop.js.map +1 -1
- package/runtime/packages/agenticros-claude-code/dist/index.js +5 -5
- package/runtime/packages/agenticros-claude-code/dist/index.js.map +1 -1
- package/runtime/packages/agenticros-claude-code/dist/mission-registry.d.ts +16 -0
- package/runtime/packages/agenticros-claude-code/dist/mission-registry.d.ts.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/mission-registry.js +19 -0
- package/runtime/packages/agenticros-claude-code/dist/mission-registry.js.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/tools.d.ts +9 -0
- package/runtime/packages/agenticros-claude-code/dist/tools.d.ts.map +1 -1
- package/runtime/packages/agenticros-claude-code/dist/tools.js +700 -54
- package/runtime/packages/agenticros-claude-code/dist/tools.js.map +1 -1
- package/runtime/packages/agenticros-claude-code/dist/transport.d.ts +28 -8
- package/runtime/packages/agenticros-claude-code/dist/transport.d.ts.map +1 -1
- package/runtime/packages/agenticros-claude-code/dist/transport.js +37 -34
- package/runtime/packages/agenticros-claude-code/dist/transport.js.map +1 -1
- package/runtime/packages/agenticros-claude-code/package.json +2 -1
- package/runtime/packages/agenticros-claude-code/src/__tests__/capabilities-mcp.test.ts +965 -0
- package/runtime/packages/agenticros-claude-code/src/__tests__/follow-me-registry.test.ts +119 -0
- package/runtime/packages/agenticros-claude-code/src/find-object/find-object.ts +7 -6
- package/runtime/packages/agenticros-claude-code/src/follow-me/depth-loop.ts +41 -9
- package/runtime/packages/agenticros-claude-code/src/follow-me/loop.ts +40 -11
- package/runtime/packages/agenticros-claude-code/src/index.ts +5 -5
- package/runtime/packages/agenticros-claude-code/src/mission-registry.ts +21 -0
- package/runtime/packages/agenticros-claude-code/src/tools.ts +668 -56
- package/runtime/packages/agenticros-claude-code/src/transport.ts +43 -43
- package/runtime/packages/agenticros-gemini/package.json +1 -0
- package/runtime/packages/agenticros-gemini/src/__tests__/mission-cancel.test.ts +197 -0
- package/runtime/packages/agenticros-gemini/src/__tests__/mission-transcripts.test.ts +178 -0
- package/runtime/packages/agenticros-gemini/src/tools.ts +504 -21
- package/runtime/packages/agenticros-gemini/src/transport.ts +40 -43
- package/runtime/packages/core/LICENSE +192 -0
- package/runtime/packages/core/README.md +88 -0
- package/runtime/packages/core/package.json +36 -3
- package/runtime/packages/core/src/__tests__/capabilities.test.ts +266 -0
- package/runtime/packages/core/src/__tests__/discovery.test.ts +206 -0
- package/runtime/packages/core/src/__tests__/find-robots-for.test.ts +258 -0
- package/runtime/packages/core/src/__tests__/mission-cancel-transcript.test.ts +371 -0
- package/runtime/packages/core/src/__tests__/mission-transcript-sink.test.ts +189 -0
- package/runtime/packages/core/src/__tests__/mission.test.ts +501 -0
- package/runtime/packages/core/src/__tests__/planner.test.ts +279 -0
- package/runtime/packages/core/src/__tests__/robots.test.ts +406 -0
- package/runtime/packages/core/src/__tests__/topic-utils.test.ts +105 -0
- package/runtime/packages/core/src/__tests__/transport-pool.test.ts +295 -0
- package/runtime/packages/core/src/capabilities.ts +314 -0
- package/runtime/packages/core/src/config.ts +221 -39
- package/runtime/packages/core/src/discovery.ts +193 -0
- package/runtime/packages/core/src/find-robots-for.ts +164 -0
- package/runtime/packages/core/src/index.ts +67 -1
- package/runtime/packages/core/src/mission-registry.ts +142 -0
- package/runtime/packages/core/src/mission-transcript-sink.ts +81 -0
- package/runtime/packages/core/src/mission.ts +574 -0
- package/runtime/packages/core/src/planner/index.ts +564 -0
- package/runtime/packages/core/src/robots.ts +282 -0
- package/runtime/packages/core/src/topic-utils.ts +47 -9
- package/runtime/packages/core/src/transport-pool.ts +171 -0
- package/runtime/ros2_ws/src/agenticros_discovery/agenticros_discovery/discovery_node.py +108 -13
- package/runtime/ros2_ws/src/agenticros_msgs/CMakeLists.txt +1 -0
- package/runtime/ros2_ws/src/agenticros_msgs/msg/RobotInfo.msg +44 -0
- package/runtime/scripts/__tests__/refresh-skill-deps.test.mjs +222 -0
- package/runtime/scripts/configure_agenticros.sh +0 -0
- package/runtime/scripts/configure_for_sim.sh +0 -0
- package/runtime/scripts/fix-openclaw-control-ui-path.sh +0 -0
- package/runtime/scripts/install_cli.sh +0 -0
- package/runtime/scripts/install_rosbridge_from_source.sh +0 -0
- package/runtime/scripts/onboard_robot.sh +0 -0
- package/runtime/scripts/pack-runtime.mjs +0 -0
- package/runtime/scripts/refresh-skill-deps.mjs +381 -0
- package/runtime/scripts/run_demo_native.sh +0 -0
- package/runtime/scripts/run_nemoclaw_host_stack.sh +0 -0
- package/runtime/scripts/run_robot_rosbridge.sh +0 -0
- package/runtime/scripts/setup_gateway_plugin.sh +32 -5
- package/runtime/scripts/setup_robot.sh +0 -0
- package/runtime/scripts/setup_workspace.sh +0 -0
- package/runtime/scripts/sim/run_sim.sh +0 -0
- package/runtime/scripts/smoke_test_nemoclaw.sh +0 -0
- package/runtime/scripts/start_demo.sh +0 -0
- package/runtime/scripts/sync-skill-tools.mjs +69 -12
- package/runtime/scripts/use-openclaw-2026.2.26.sh +0 -0
- package/runtime/scripts/use-openclaw-2026.3.11.sh +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marketplace.js","sourceRoot":"","sources":["../../src/util/marketplace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,mCAAmC,CAAC;AAEpE,MAAM,UAAU,OAAO;IACrB,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,gBAAgB,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACrF,CAAC;AA2BD,KAAK,UAAU,OAAO,CAAI,GAAW;IACnC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAC;IAC1E,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,IAAI,IAAI,GAAG,EAAE,CAAC;QACd,IAAI,CAAC;YACH,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QAC1B,CAAC;QAAC,MAAM,CAAC;YACP,YAAY;QACd,CAAC;QACD,MAAM,IAAI,gBAAgB,CACxB,mBAAmB,GAAG,CAAC,MAAM,OAAO,GAAG,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,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M,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;AACtC,CAAC;AAED,KAAK,UAAU,KAAK,CAClB,GAAW,EACX,GAAW,EACX,IAAc,EACd,GAA0B;IAE1B,GAAG,CAAC,KAAK,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC;IAC/C,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE;QAC3B,GAAG;QACH,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,IAAI;KACb,CAAC,CAAC;IACH,MAAM,GAAG,CAAC;AACZ,CAAC;AAED,KAAK,UAAU,MAAM,CAAC,IAAY;IAChC,IAAI,CAAC;QACH,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;QACzE,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,6EAA6E;AAC7E,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridge from the CLI to the AgenticROS MCP server's `ros2_discover_robots` tool.
|
|
3
|
+
*
|
|
4
|
+
* Rather than re-implement live-topic discovery in the CLI (which would
|
|
5
|
+
* force `@agenticros/core` and its transport deps into the published
|
|
6
|
+
* `agenticros` tarball), we spawn the existing MCP server binary
|
|
7
|
+
* (`packages/agenticros-claude-code/dist/index.js`) and JSON-RPC the
|
|
8
|
+
* `ros2_discover_robots` tool — the exact code path Claude Code uses.
|
|
9
|
+
* This keeps the CLI light AND ensures the CLI sees the same robots
|
|
10
|
+
* the agent sees.
|
|
11
|
+
*
|
|
12
|
+
* Resilience: the spawn-and-rpc dance is wrapped in an overall timeout
|
|
13
|
+
* so a hung Zenoh router or a malformed reply can't lock up the CLI.
|
|
14
|
+
* The stderr stream is drained silently — the MCP server emits a
|
|
15
|
+
* connection banner that isn't useful for the CLI consumer.
|
|
16
|
+
*/
|
|
17
|
+
export interface DetectedRobot {
|
|
18
|
+
id: string;
|
|
19
|
+
cmdVelTopic: string;
|
|
20
|
+
topicCount: number;
|
|
21
|
+
configuredRobotId: string | null;
|
|
22
|
+
}
|
|
23
|
+
export interface ConfiguredRobotSummary {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
namespace: string;
|
|
27
|
+
cameraTopic: string;
|
|
28
|
+
source: "config" | "legacy";
|
|
29
|
+
}
|
|
30
|
+
export interface DiscoveryResult {
|
|
31
|
+
total_topics: number;
|
|
32
|
+
detected: DetectedRobot[];
|
|
33
|
+
configured_online: ConfiguredRobotSummary[];
|
|
34
|
+
configured_offline: ConfiguredRobotSummary[];
|
|
35
|
+
unknown_detected: DetectedRobot[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Resolve the path to the AgenticROS MCP server entrypoint, mirroring
|
|
39
|
+
* the same lookup the rest of the CLI uses. Returns undefined when the
|
|
40
|
+
* dist hasn't been built yet (so the caller can surface an actionable
|
|
41
|
+
* error rather than a cryptic spawn failure).
|
|
42
|
+
*/
|
|
43
|
+
export declare function findMcpEntry(): string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Run `ros2_discover_robots` against the MCP server and return the
|
|
46
|
+
* parsed `DiscoveryResult`.
|
|
47
|
+
*
|
|
48
|
+
* Throws with an actionable message when:
|
|
49
|
+
* - the MCP server binary can't be found (suggests `pnpm build`)
|
|
50
|
+
* - the initialize handshake times out (suggests Zenoh / config issues)
|
|
51
|
+
* - the tool reports `isError: true` (surfaces the inner error)
|
|
52
|
+
*
|
|
53
|
+
* Always cleans up the child process — no orphan node processes after
|
|
54
|
+
* a failed call.
|
|
55
|
+
*/
|
|
56
|
+
export declare function discoverViaMcp(): Promise<DiscoveryResult>;
|
|
57
|
+
//# sourceMappingURL=mcp-discovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-discovery.d.ts","sourceRoot":"","sources":["../../src/util/mcp-discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAWH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC7B;AAED,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,iBAAiB,EAAE,sBAAsB,EAAE,CAAC;IAC5C,kBAAkB,EAAE,sBAAsB,EAAE,CAAC;IAC7C,gBAAgB,EAAE,aAAa,EAAE,CAAC;CACnC;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,MAAM,GAAG,SAAS,CAIjD;AAiED;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,eAAe,CAAC,CAwD/D"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridge from the CLI to the AgenticROS MCP server's `ros2_discover_robots` tool.
|
|
3
|
+
*
|
|
4
|
+
* Rather than re-implement live-topic discovery in the CLI (which would
|
|
5
|
+
* force `@agenticros/core` and its transport deps into the published
|
|
6
|
+
* `agenticros` tarball), we spawn the existing MCP server binary
|
|
7
|
+
* (`packages/agenticros-claude-code/dist/index.js`) and JSON-RPC the
|
|
8
|
+
* `ros2_discover_robots` tool — the exact code path Claude Code uses.
|
|
9
|
+
* This keeps the CLI light AND ensures the CLI sees the same robots
|
|
10
|
+
* the agent sees.
|
|
11
|
+
*
|
|
12
|
+
* Resilience: the spawn-and-rpc dance is wrapped in an overall timeout
|
|
13
|
+
* so a hung Zenoh router or a malformed reply can't lock up the CLI.
|
|
14
|
+
* The stderr stream is drained silently — the MCP server emits a
|
|
15
|
+
* connection banner that isn't useful for the CLI consumer.
|
|
16
|
+
*/
|
|
17
|
+
import { spawn } from "node:child_process";
|
|
18
|
+
import { existsSync } from "node:fs";
|
|
19
|
+
import { join } from "node:path";
|
|
20
|
+
import { getCliPaths } from "./paths.js";
|
|
21
|
+
const DISCOVER_TIMEOUT_MS = 15_000;
|
|
22
|
+
const INIT_TIMEOUT_MS = 8_000;
|
|
23
|
+
/**
|
|
24
|
+
* Resolve the path to the AgenticROS MCP server entrypoint, mirroring
|
|
25
|
+
* the same lookup the rest of the CLI uses. Returns undefined when the
|
|
26
|
+
* dist hasn't been built yet (so the caller can surface an actionable
|
|
27
|
+
* error rather than a cryptic spawn failure).
|
|
28
|
+
*/
|
|
29
|
+
export function findMcpEntry() {
|
|
30
|
+
const { mcpDistDir } = getCliPaths();
|
|
31
|
+
const entry = join(mcpDistDir, "index.js");
|
|
32
|
+
return existsSync(entry) ? entry : undefined;
|
|
33
|
+
}
|
|
34
|
+
/** Minimal stdio JSON-RPC client over a child process. */
|
|
35
|
+
class StdioRpc {
|
|
36
|
+
proc;
|
|
37
|
+
buffer = "";
|
|
38
|
+
nextId = 1;
|
|
39
|
+
pending = new Map();
|
|
40
|
+
constructor(proc) {
|
|
41
|
+
this.proc = proc;
|
|
42
|
+
proc.stdout.setEncoding("utf8");
|
|
43
|
+
proc.stdout.on("data", (chunk) => this.onChunk(chunk));
|
|
44
|
+
proc.stderr.setEncoding("utf8");
|
|
45
|
+
proc.stderr.on("data", () => { });
|
|
46
|
+
}
|
|
47
|
+
onChunk(chunk) {
|
|
48
|
+
this.buffer += chunk;
|
|
49
|
+
let idx;
|
|
50
|
+
while ((idx = this.buffer.indexOf("\n")) >= 0) {
|
|
51
|
+
const line = this.buffer.slice(0, idx).trim();
|
|
52
|
+
this.buffer = this.buffer.slice(idx + 1);
|
|
53
|
+
if (!line)
|
|
54
|
+
continue;
|
|
55
|
+
try {
|
|
56
|
+
const msg = JSON.parse(line);
|
|
57
|
+
if (typeof msg.id === "number" && this.pending.has(msg.id)) {
|
|
58
|
+
this.pending.get(msg.id)(msg);
|
|
59
|
+
this.pending.delete(msg.id);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
/* ignore non-JSON noise — MCP server occasionally writes diagnostic banners to stdout */
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
rpc(method, params, timeoutMs) {
|
|
68
|
+
const id = this.nextId++;
|
|
69
|
+
return new Promise((resolve, reject) => {
|
|
70
|
+
const timer = setTimeout(() => {
|
|
71
|
+
this.pending.delete(id);
|
|
72
|
+
reject(new Error(`JSON-RPC '${method}' timed out after ${timeoutMs / 1000}s`));
|
|
73
|
+
}, timeoutMs);
|
|
74
|
+
this.pending.set(id, (msg) => {
|
|
75
|
+
clearTimeout(timer);
|
|
76
|
+
resolve(msg);
|
|
77
|
+
});
|
|
78
|
+
this.proc.stdin.write(`${JSON.stringify({ jsonrpc: "2.0", id, method, params })}\n`);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
notify(method, params = {}) {
|
|
82
|
+
this.proc.stdin.write(`${JSON.stringify({ jsonrpc: "2.0", method, params })}\n`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Run `ros2_discover_robots` against the MCP server and return the
|
|
87
|
+
* parsed `DiscoveryResult`.
|
|
88
|
+
*
|
|
89
|
+
* Throws with an actionable message when:
|
|
90
|
+
* - the MCP server binary can't be found (suggests `pnpm build`)
|
|
91
|
+
* - the initialize handshake times out (suggests Zenoh / config issues)
|
|
92
|
+
* - the tool reports `isError: true` (surfaces the inner error)
|
|
93
|
+
*
|
|
94
|
+
* Always cleans up the child process — no orphan node processes after
|
|
95
|
+
* a failed call.
|
|
96
|
+
*/
|
|
97
|
+
export async function discoverViaMcp() {
|
|
98
|
+
const entry = findMcpEntry();
|
|
99
|
+
if (!entry) {
|
|
100
|
+
throw new Error("AgenticROS MCP server isn't built. Run `pnpm --filter @agenticros/claude-code build` (or `agenticros init`).");
|
|
101
|
+
}
|
|
102
|
+
// Forward AGENTICROS_* env so the MCP server picks up the same robot
|
|
103
|
+
// namespace + config path the CLI sees.
|
|
104
|
+
const proc = spawn("node", [entry], {
|
|
105
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
106
|
+
env: { ...process.env },
|
|
107
|
+
});
|
|
108
|
+
try {
|
|
109
|
+
const client = new StdioRpc(proc);
|
|
110
|
+
await client.rpc("initialize", {
|
|
111
|
+
protocolVersion: "2025-03-26",
|
|
112
|
+
clientInfo: { name: "agenticros-cli", version: "1.0" },
|
|
113
|
+
capabilities: {},
|
|
114
|
+
}, INIT_TIMEOUT_MS);
|
|
115
|
+
client.notify("notifications/initialized");
|
|
116
|
+
const callResp = await client.rpc("tools/call", { name: "ros2_discover_robots", arguments: {} }, DISCOVER_TIMEOUT_MS);
|
|
117
|
+
if (callResp.error) {
|
|
118
|
+
throw new Error(`MCP server returned error: ${callResp.error.message}`);
|
|
119
|
+
}
|
|
120
|
+
const result = callResp.result;
|
|
121
|
+
if (!result) {
|
|
122
|
+
throw new Error("MCP server returned no result for ros2_discover_robots.");
|
|
123
|
+
}
|
|
124
|
+
const text = result.content?.[0]?.text ?? "";
|
|
125
|
+
if (result.isError) {
|
|
126
|
+
throw new Error(`ros2_discover_robots failed: ${text}`);
|
|
127
|
+
}
|
|
128
|
+
const parsed = safeParse(text);
|
|
129
|
+
if (!parsed) {
|
|
130
|
+
throw new Error(`Unable to parse ros2_discover_robots response: ${text.slice(0, 200)}`);
|
|
131
|
+
}
|
|
132
|
+
return parsed;
|
|
133
|
+
}
|
|
134
|
+
finally {
|
|
135
|
+
proc.kill();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function safeParse(text) {
|
|
139
|
+
try {
|
|
140
|
+
const obj = JSON.parse(text);
|
|
141
|
+
return {
|
|
142
|
+
total_topics: Number(obj["total_topics"] ?? 0),
|
|
143
|
+
detected: obj["detected"] ?? [],
|
|
144
|
+
configured_online: obj["configured_online"] ?? [],
|
|
145
|
+
configured_offline: obj["configured_offline"] ?? [],
|
|
146
|
+
unknown_detected: obj["unknown_detected"] ?? [],
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=mcp-discovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-discovery.js","sourceRoot":"","sources":["../../src/util/mcp-discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,KAAK,EAAuC,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,mBAAmB,GAAG,MAAM,CAAC;AACnC,MAAM,eAAe,GAAG,KAAK,CAAC;AAyB9B;;;;;GAKG;AACH,MAAM,UAAU,YAAY;IAC1B,MAAM,EAAE,UAAU,EAAE,GAAG,WAAW,EAAE,CAAC;IACrC,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAC3C,OAAO,UAAU,CAAC,KAAK,CAAC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CLI so the multi-robot persistence path does NOT pull
|
|
5
|
+
* `@agenticros/core` (and its transport deps) into the published
|
|
6
|
+
* `agenticros` tarball. The shape we read/write is intentionally a
|
|
7
|
+
* subset of `@agenticros/core`'s `AgenticROSConfig.robots`:
|
|
8
|
+
*
|
|
9
|
+
* robots: Array<{
|
|
10
|
+
* id: string;
|
|
11
|
+
* name?: string;
|
|
12
|
+
* namespace?: string;
|
|
13
|
+
* cameraTopic?: string;
|
|
14
|
+
* default?: boolean;
|
|
15
|
+
* }>
|
|
16
|
+
*
|
|
17
|
+
* Backwards compat with the legacy single-robot config:
|
|
18
|
+
* - If `config.robots` is absent/empty AND `config.robot` is set, we
|
|
19
|
+
* "promote" `config.robot` into `robots[0]` on the next write. The
|
|
20
|
+
* legacy `config.robot` field is LEFT in place (harmlessly — the
|
|
21
|
+
* core resolver prefers the explicit array when non-empty) so older
|
|
22
|
+
* adapters that only read `config.robot` keep working.
|
|
23
|
+
* - When the file is missing or empty we treat it as `{}`. Writes
|
|
24
|
+
* create both the file and its directory.
|
|
25
|
+
*
|
|
26
|
+
* All paths route through the CLI's own paths helper so workspace /
|
|
27
|
+
* installed / bundle modes pick up the same `~/.agenticros/config.json`.
|
|
28
|
+
*/
|
|
29
|
+
/** Sensor/hardware tags on a robot — mirrors @agenticros/core's RobotSensors. */
|
|
30
|
+
export interface RobotSensors {
|
|
31
|
+
has_realsense?: boolean;
|
|
32
|
+
has_lidar?: boolean;
|
|
33
|
+
has_arm?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/** What the CLI persists per robot. Matches the core config schema. */
|
|
36
|
+
export interface RobotEntry {
|
|
37
|
+
id: string;
|
|
38
|
+
name?: string;
|
|
39
|
+
namespace?: string;
|
|
40
|
+
cameraTopic?: string;
|
|
41
|
+
default?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Phase 1.e robot kind ("amr" | "arm" | "drone" | "rover" | …).
|
|
44
|
+
* Free-form string; core defaults to "amr" when unset.
|
|
45
|
+
*/
|
|
46
|
+
kind?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Phase 1.e sensor/hardware tags. Same all-false default semantics
|
|
49
|
+
* as core — only the keys the user sets are written through.
|
|
50
|
+
*/
|
|
51
|
+
sensors?: RobotSensors;
|
|
52
|
+
/**
|
|
53
|
+
* Phase 1.e optional per-robot capability allowlist. When set, the
|
|
54
|
+
* `ros2_find_robots_for` filter uses this list instead of the
|
|
55
|
+
* gateway's global capability registry. Stored verbatim — the CLI
|
|
56
|
+
* doesn't import the registry to validate against.
|
|
57
|
+
*/
|
|
58
|
+
capabilities?: string[];
|
|
59
|
+
/**
|
|
60
|
+
* Optional per-robot transport override. Opaque JSON — the core's
|
|
61
|
+
* `RobotTransportOverrideSchema` is the schema-of-truth and will Zod-
|
|
62
|
+
* validate this at config-load time. The CLI doesn't import core, so
|
|
63
|
+
* we only carry the field through as a plain object.
|
|
64
|
+
*/
|
|
65
|
+
transport?: Record<string, unknown>;
|
|
66
|
+
}
|
|
67
|
+
export declare function robotConfigPath(): string;
|
|
68
|
+
/** Parse `~/.agenticros/config.json` to a plain object, or `{}` when absent/bad. */
|
|
69
|
+
export declare function readConfigObject(path?: string): Record<string, unknown>;
|
|
70
|
+
/** Write the config object back, creating directories as needed. */
|
|
71
|
+
export declare function writeConfigObject(obj: Record<string, unknown>, path?: string): void;
|
|
72
|
+
/**
|
|
73
|
+
* Return the robots[] view the agent would see (explicit array when
|
|
74
|
+
* non-empty, otherwise a one-entry array synthesised from legacy
|
|
75
|
+
* `config.robot`). Read-only — the CLI uses this to render `robots list`
|
|
76
|
+
* without ever needing to import @agenticros/core.
|
|
77
|
+
*/
|
|
78
|
+
export declare function readRobots(obj?: Record<string, unknown>): {
|
|
79
|
+
robots: RobotEntry[];
|
|
80
|
+
from: "explicit" | "legacy" | "none";
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Compute the active robot id using the same precedence the core
|
|
84
|
+
* resolver does:
|
|
85
|
+
* 1. explicit robots[] entry with `default: true`
|
|
86
|
+
* 2. first entry in robots[] (with legacy fallback)
|
|
87
|
+
* 3. undefined when there are no robots at all
|
|
88
|
+
*/
|
|
89
|
+
export declare function getActiveRobotId(obj?: Record<string, unknown>): string | undefined;
|
|
90
|
+
export interface AddRobotResult {
|
|
91
|
+
/** Whether the entry was actually written (false = a duplicate id was already present). */
|
|
92
|
+
added: boolean;
|
|
93
|
+
/** True when this write promoted the legacy `config.robot` into `robots[]`. */
|
|
94
|
+
promotedLegacy: boolean;
|
|
95
|
+
/** The final robots[] array after the write. */
|
|
96
|
+
robots: RobotEntry[];
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Add a robot to `config.robots[]`.
|
|
100
|
+
*
|
|
101
|
+
* Promotes the legacy single-robot config on first multi-robot write —
|
|
102
|
+
* `config.robot` is copied as the first entry in the array, and any
|
|
103
|
+
* `default: true` flag we'd set on the new entry is held against that
|
|
104
|
+
* promoted incumbent (it stays the default unless the caller explicitly
|
|
105
|
+
* asks otherwise).
|
|
106
|
+
*
|
|
107
|
+
* Idempotent: re-adding an existing id updates name/namespace/cameraTopic
|
|
108
|
+
* in place but returns `added: false` so the CLI can render the right
|
|
109
|
+
* "already present" message.
|
|
110
|
+
*/
|
|
111
|
+
export declare function addRobot(entry: RobotEntry, opts?: {
|
|
112
|
+
setDefault?: boolean;
|
|
113
|
+
obj?: Record<string, unknown>;
|
|
114
|
+
}): AddRobotResult;
|
|
115
|
+
/**
|
|
116
|
+
* Remove a robot from `config.robots[]` by id.
|
|
117
|
+
*
|
|
118
|
+
* Returns `removed: false` when the id isn't present. Removing the last
|
|
119
|
+
* entry leaves `robots: []` (which the core resolver then ignores in
|
|
120
|
+
* favour of the legacy `config.robot` fallback — so the deployment
|
|
121
|
+
* keeps working).
|
|
122
|
+
*
|
|
123
|
+
* Idempotent across re-runs.
|
|
124
|
+
*/
|
|
125
|
+
export declare function removeRobot(id: string, obj?: Record<string, unknown>): {
|
|
126
|
+
removed: boolean;
|
|
127
|
+
robots: RobotEntry[];
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Set `default: true` on exactly one robot in `config.robots[]`.
|
|
131
|
+
*
|
|
132
|
+
* Auto-promotes the legacy single-robot config first if needed (so
|
|
133
|
+
* marking the first new robot as default doesn't lose the previous
|
|
134
|
+
* incumbent). Throws when the id isn't present after promotion.
|
|
135
|
+
*/
|
|
136
|
+
export declare function setDefaultRobot(id: string, obj?: Record<string, unknown>): {
|
|
137
|
+
robots: RobotEntry[];
|
|
138
|
+
promotedLegacy: boolean;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Apply a per-robot transport override to an existing robot.
|
|
142
|
+
*
|
|
143
|
+
* Auto-promotes legacy `config.robot` into `config.robots[]` so the
|
|
144
|
+
* caller can target the historical single-robot config by its derived
|
|
145
|
+
* id. Throws when the id can't be found after promotion — matching the
|
|
146
|
+
* UX of `setDefaultRobot`.
|
|
147
|
+
*
|
|
148
|
+
* The `override` argument is the plain JSON shape the core's
|
|
149
|
+
* `RobotTransportOverrideSchema` will validate at config-load time. The
|
|
150
|
+
* CLI doesn't validate field shapes — that lives in `@agenticros/core`.
|
|
151
|
+
*/
|
|
152
|
+
export declare function setTransportForRobot(id: string, override: Record<string, unknown>, obj?: Record<string, unknown>): {
|
|
153
|
+
robots: RobotEntry[];
|
|
154
|
+
promotedLegacy: boolean;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Remove a per-robot transport override (so the robot inherits the
|
|
158
|
+
* global transport config). Idempotent — returns `cleared: false` when
|
|
159
|
+
* the robot didn't have an override to begin with. Throws on unknown id
|
|
160
|
+
* (we'd rather complain loudly than silently no-op against a typo).
|
|
161
|
+
*/
|
|
162
|
+
export declare function clearTransportForRobot(id: string, obj?: Record<string, unknown>): {
|
|
163
|
+
cleared: boolean;
|
|
164
|
+
robots: RobotEntry[];
|
|
165
|
+
promotedLegacy: boolean;
|
|
166
|
+
};
|
|
167
|
+
//# sourceMappingURL=robot-config.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