agenticros 0.1.12 → 0.1.13

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.
@@ -0,0 +1,361 @@
1
+ /**
2
+ * Skill discovery, validation, and config-file mutation primitives.
3
+ *
4
+ * An AgenticROS skill is a Node package whose `package.json` carries
5
+ * `"agenticrosSkill": true` and exports a `registerSkill(api, config, context)`
6
+ * function from its `main` entry. The OpenClaw AgenticROS plugin loads them
7
+ * at gateway start by walking two arrays in its config:
8
+ *
9
+ * - `skillPaths[]` — absolute directories to scan (validate `package.json`)
10
+ * - `skillPackages[]` — npm-resolvable names (e.g. `agenticros-skill-find`)
11
+ *
12
+ * This module is the single place the CLI talks to those arrays. It also
13
+ * encapsulates discovery (where on disk users typically clone skill repos)
14
+ * and the `deriveSkillId` convention shared with `@agenticros/agenticros`'s
15
+ * skill-loader so menu / list output uses the same short ids the plugin
16
+ * surfaces (e.g. `followme`, `find`).
17
+ */
18
+ import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
19
+ import { homedir } from "node:os";
20
+ import { dirname, isAbsolute, join, resolve } from "node:path";
21
+ import { getCliPaths } from "./paths.js";
22
+ import { ensureStringArray, getAgenticrosPluginConfig, openclawConfigExists, openclawConfigPath, readOpenclawConfig, writeOpenclawConfig, } from "./openclaw-config.js";
23
+ /**
24
+ * Apply the same short-id transform the OpenClaw plugin's skill-loader uses,
25
+ * so menu output and the plugin's `config.skills.<id>` keys line up exactly.
26
+ * `agenticros-skill-followme` → `followme`; scoped packages drop the scope.
27
+ */
28
+ export function deriveSkillId(packageName) {
29
+ const lower = packageName.toLowerCase();
30
+ if (lower.startsWith("agenticros-skill-")) {
31
+ return lower.slice("agenticros-skill-".length);
32
+ }
33
+ return lower.replace(/^@[^/]+\//, "").replace(/[^a-z0-9]/g, "");
34
+ }
35
+ /**
36
+ * Inspect a directory and decide whether it's a valid AgenticROS skill clone.
37
+ * Returns a partial `SkillRef` (no `registeredAs`) or `undefined` when the
38
+ * directory is missing, lacks `package.json`, or doesn't opt in via the
39
+ * `agenticrosSkill: true` flag.
40
+ */
41
+ export function inspectSkillDir(dir) {
42
+ const absDir = isAbsolute(dir) ? dir : resolve(dir);
43
+ if (!existsSync(absDir))
44
+ return undefined;
45
+ let stat;
46
+ try {
47
+ stat = statSync(absDir);
48
+ }
49
+ catch {
50
+ return undefined;
51
+ }
52
+ if (!stat.isDirectory())
53
+ return undefined;
54
+ const pkgPath = join(absDir, "package.json");
55
+ if (!existsSync(pkgPath))
56
+ return undefined;
57
+ let pkg;
58
+ try {
59
+ pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
60
+ }
61
+ catch {
62
+ return undefined;
63
+ }
64
+ if (pkg.agenticrosSkill !== true)
65
+ return undefined;
66
+ const packageName = (pkg.name ?? "unknown").toString();
67
+ const mainRel = pkg.main ?? "index.js";
68
+ const entry = join(absDir, mainRel);
69
+ return {
70
+ id: deriveSkillId(packageName),
71
+ packageName,
72
+ dir: absDir,
73
+ entry,
74
+ built: existsSync(entry),
75
+ };
76
+ }
77
+ /**
78
+ * Return a deduped list of "places we should look for skill clones" — the
79
+ * directories whose children the CLI scans on `agenticros skills discover`.
80
+ *
81
+ * We include both the parent of the active repo / install dir (so siblings
82
+ * of `agenticros/` work, e.g. `../agenticros-skill-find`) and `$HOME` /
83
+ * `$HOME/Projects/` / `$HOME/Code/` so a vanilla clone-into-Projects flow
84
+ * is found without configuration.
85
+ */
86
+ export function discoveryRoots(extra = []) {
87
+ const paths = getCliPaths();
88
+ const home = homedir();
89
+ const roots = [];
90
+ const push = (p) => {
91
+ if (!p)
92
+ return;
93
+ const abs = resolve(p);
94
+ if (!roots.includes(abs))
95
+ roots.push(abs);
96
+ };
97
+ if (paths.repoRoot)
98
+ push(dirname(paths.repoRoot));
99
+ push(dirname(paths.installDir));
100
+ push(home);
101
+ push(join(home, "Projects"));
102
+ push(join(home, "Code"));
103
+ push(join(home, "agenticros-skills"));
104
+ for (const e of extra)
105
+ push(e);
106
+ return roots.filter((r) => {
107
+ try {
108
+ return statSync(r).isDirectory();
109
+ }
110
+ catch {
111
+ return false;
112
+ }
113
+ });
114
+ }
115
+ /**
116
+ * Walk every directory in `roots`, returning a `SkillRef` for each child
117
+ * directory that passes `inspectSkillDir`. Used by both `discover` and
118
+ * `list` (which uses it to render orphaned-but-cloned skills).
119
+ */
120
+ export function scanForSkills(extra = []) {
121
+ const out = [];
122
+ const seenDirs = new Set();
123
+ for (const root of discoveryRoots(extra)) {
124
+ let entries;
125
+ try {
126
+ entries = readdirSync(root);
127
+ }
128
+ catch {
129
+ continue;
130
+ }
131
+ for (const name of entries) {
132
+ const child = join(root, name);
133
+ if (seenDirs.has(child))
134
+ continue;
135
+ seenDirs.add(child);
136
+ const info = inspectSkillDir(child);
137
+ if (info) {
138
+ out.push({ ...info, registeredAs: [] });
139
+ }
140
+ }
141
+ }
142
+ return out;
143
+ }
144
+ /**
145
+ * Pull skill arrays out of the OpenClaw config in a shape that's easy to
146
+ * mutate. The returned `paths` / `packages` arrays are filtered to strings
147
+ * (non-string elements are silently skipped in the view but preserved in
148
+ * the underlying arrays on disk).
149
+ */
150
+ function loadOpenclawSkillsView() {
151
+ const cfg = readOpenclawConfig();
152
+ if (!cfg)
153
+ return undefined;
154
+ const pluginCfg = getAgenticrosPluginConfig(cfg);
155
+ const rawPaths = ensureStringArray(pluginCfg, "skillPaths");
156
+ const rawPkgs = ensureStringArray(pluginCfg, "skillPackages");
157
+ const paths = rawPaths.filter((x) => typeof x === "string");
158
+ const packages = rawPkgs.filter((x) => typeof x === "string");
159
+ return { cfg, pluginCfg, paths, packages };
160
+ }
161
+ /**
162
+ * Build a snapshot of the user's current skill state: what's registered,
163
+ * what's available-but-not-registered, and what registrations are broken.
164
+ * The single source of truth for the `agenticros skills` (list) view.
165
+ */
166
+ export function listSkills() {
167
+ const view = loadOpenclawSkillsView();
168
+ const registered = [];
169
+ const brokenPaths = [];
170
+ const byId = new Map();
171
+ if (view) {
172
+ for (const p of view.paths) {
173
+ const info = inspectSkillDir(p);
174
+ if (info) {
175
+ const existing = byId.get(info.id);
176
+ if (existing) {
177
+ if (!existing.registeredAs.includes("path"))
178
+ existing.registeredAs.push("path");
179
+ if (existing.entry === undefined) {
180
+ existing.entry = info.entry;
181
+ existing.built = info.built;
182
+ }
183
+ }
184
+ else {
185
+ const ref = { ...info, registeredAs: ["path"] };
186
+ byId.set(info.id, ref);
187
+ registered.push(ref);
188
+ }
189
+ }
190
+ else {
191
+ brokenPaths.push(p);
192
+ }
193
+ }
194
+ for (const name of view.packages) {
195
+ const id = deriveSkillId(name);
196
+ const existing = byId.get(id);
197
+ if (existing) {
198
+ if (!existing.registeredAs.includes("package"))
199
+ existing.registeredAs.push("package");
200
+ }
201
+ else {
202
+ const ref = { id, packageName: name, registeredAs: ["package"] };
203
+ byId.set(id, ref);
204
+ registered.push(ref);
205
+ }
206
+ }
207
+ }
208
+ const available = scanForSkills().filter((s) => !byId.has(s.id));
209
+ return { registered, available, brokenPaths };
210
+ }
211
+ /**
212
+ * Add a skill to the OpenClaw plugin config by absolute directory path.
213
+ * Idempotent: re-adding an existing entry is a no-op and returns `ok: true`
214
+ * with an explanatory message. The directory must contain a valid
215
+ * `package.json` with `agenticrosSkill: true`.
216
+ */
217
+ export function addSkillByPath(dir) {
218
+ const info = inspectSkillDir(dir);
219
+ if (!info) {
220
+ return {
221
+ ok: false,
222
+ message: `Not an AgenticROS skill directory: ${dir} (need package.json with "agenticrosSkill": true)`,
223
+ };
224
+ }
225
+ if (!openclawConfigExists()) {
226
+ return {
227
+ ok: false,
228
+ message: `OpenClaw config not found at ${openclawConfigPath()}. ` +
229
+ "Run `agenticros init` first to install the OpenClaw plugin.",
230
+ };
231
+ }
232
+ const cfg = readOpenclawConfig();
233
+ if (!cfg) {
234
+ return {
235
+ ok: false,
236
+ message: `Cannot parse OpenClaw config at ${openclawConfigPath()}.`,
237
+ };
238
+ }
239
+ const pluginCfg = getAgenticrosPluginConfig(cfg);
240
+ const paths = ensureStringArray(pluginCfg, "skillPaths");
241
+ if (paths.includes(info.dir)) {
242
+ return {
243
+ ok: true,
244
+ message: `Skill '${info.id}' already registered at ${info.dir}.`,
245
+ skill: { ...info, registeredAs: ["path"] },
246
+ };
247
+ }
248
+ paths.push(info.dir);
249
+ writeOpenclawConfig(cfg);
250
+ return {
251
+ ok: true,
252
+ message: `Registered skill '${info.id}' at ${info.dir} (${openclawConfigPath()} → skillPaths).`,
253
+ skill: { ...info, registeredAs: ["path"] },
254
+ };
255
+ }
256
+ /**
257
+ * Add a skill by npm package name (must be resolvable on the gateway's
258
+ * Node search path). Mainly intended for skills published to a registry —
259
+ * for local clones, prefer `addSkillByPath` so the absolute directory is
260
+ * recorded.
261
+ */
262
+ export function addSkillByPackage(name) {
263
+ if (!openclawConfigExists()) {
264
+ return {
265
+ ok: false,
266
+ message: `OpenClaw config not found at ${openclawConfigPath()}. ` +
267
+ "Run `agenticros init` first to install the OpenClaw plugin.",
268
+ };
269
+ }
270
+ const cfg = readOpenclawConfig();
271
+ if (!cfg) {
272
+ return { ok: false, message: `Cannot parse OpenClaw config at ${openclawConfigPath()}.` };
273
+ }
274
+ const pluginCfg = getAgenticrosPluginConfig(cfg);
275
+ const packages = ensureStringArray(pluginCfg, "skillPackages");
276
+ if (packages.includes(name)) {
277
+ return {
278
+ ok: true,
279
+ message: `Skill package '${name}' already registered.`,
280
+ skill: { id: deriveSkillId(name), packageName: name, registeredAs: ["package"] },
281
+ };
282
+ }
283
+ packages.push(name);
284
+ writeOpenclawConfig(cfg);
285
+ return {
286
+ ok: true,
287
+ message: `Registered skill package '${name}' (${openclawConfigPath()} → skillPackages).`,
288
+ skill: { id: deriveSkillId(name), packageName: name, registeredAs: ["package"] },
289
+ };
290
+ }
291
+ /**
292
+ * Remove every registration that matches `idOrName` — either a derived skill
293
+ * id (e.g. `find`), a full package name (e.g. `agenticros-skill-find`), or an
294
+ * absolute path that appears in `skillPaths`. Both `skillPaths` (matched by
295
+ * resolving each path back through `inspectSkillDir`) and `skillPackages`
296
+ * are cleaned in a single pass.
297
+ */
298
+ export function removeSkill(idOrName) {
299
+ const cfg = readOpenclawConfig();
300
+ if (!cfg) {
301
+ return {
302
+ ok: false,
303
+ message: `OpenClaw config not found or unparseable at ${openclawConfigPath()}.`,
304
+ removedPaths: [],
305
+ removedPackages: [],
306
+ };
307
+ }
308
+ const pluginCfg = getAgenticrosPluginConfig(cfg);
309
+ const rawPaths = ensureStringArray(pluginCfg, "skillPaths");
310
+ const rawPkgs = ensureStringArray(pluginCfg, "skillPackages");
311
+ const wanted = idOrName.trim();
312
+ const wantedAbs = isAbsolute(wanted) ? resolve(wanted) : undefined;
313
+ const removedPaths = [];
314
+ const keptPaths = rawPaths.filter((entry) => {
315
+ if (typeof entry !== "string")
316
+ return true;
317
+ if (wantedAbs && resolve(entry) === wantedAbs) {
318
+ removedPaths.push(entry);
319
+ return false;
320
+ }
321
+ const info = inspectSkillDir(entry);
322
+ if (info && (info.id === wanted || info.packageName === wanted)) {
323
+ removedPaths.push(entry);
324
+ return false;
325
+ }
326
+ return true;
327
+ });
328
+ const removedPackages = [];
329
+ const keptPkgs = rawPkgs.filter((entry) => {
330
+ if (typeof entry !== "string")
331
+ return true;
332
+ if (entry === wanted || deriveSkillId(entry) === wanted) {
333
+ removedPackages.push(entry);
334
+ return false;
335
+ }
336
+ return true;
337
+ });
338
+ if (removedPaths.length === 0 && removedPackages.length === 0) {
339
+ return {
340
+ ok: false,
341
+ message: `No registered skill matches '${idOrName}'.`,
342
+ removedPaths: [],
343
+ removedPackages: [],
344
+ };
345
+ }
346
+ pluginCfg["skillPaths"] = keptPaths;
347
+ pluginCfg["skillPackages"] = keptPkgs;
348
+ writeOpenclawConfig(cfg);
349
+ const parts = [];
350
+ if (removedPaths.length > 0)
351
+ parts.push(`${removedPaths.length} path(s)`);
352
+ if (removedPackages.length > 0)
353
+ parts.push(`${removedPackages.length} package(s)`);
354
+ return {
355
+ ok: true,
356
+ message: `Removed ${parts.join(" + ")} matching '${idOrName}' from ${openclawConfigPath()}.`,
357
+ removedPaths,
358
+ removedPackages,
359
+ };
360
+ }
361
+ //# sourceMappingURL=skills.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills.js","sourceRoot":"","sources":["../../src/util/skills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAoB9B;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,WAAmB;IAC/C,MAAM,KAAK,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC;IACxC,IAAI,KAAK,CAAC,UAAU,CAAC,mBAAmB,CAAC,EAAE,CAAC;QAC1C,OAAO,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAClE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACpD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,SAAS,CAAC;IAC1C,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K,CAAC,EAAE,CAAC;QAC9D,OAAO;YACL,EAAE,EAAE,KAAK;YACT,OAAO,EAAE,gCAAgC,QAAQ,IAAI;YACrD,YAAY,EAAE,EAAE;YAChB,eAAe,EAAE,EAAE;SACpB,CAAC;IACJ,CAAC;IAED,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC;IACpC,SAAS,CAAC,eAAe,CAAC,GAAG,QAAQ,CAAC;IACtC,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACzB,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,MAAM,UAAU,CAAC,CAAC;IAC1E,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,MAAM,aAAa,CAAC,CAAC;IACnF,OAAO;QACL,EAAE,EAAE,IAAI;QACR,OAAO,EAAE,WAAW,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,QAAQ,UAAU,kBAAkB,EAAE,GAAG;QAC5F,YAAY;QACZ,eAAe;KAChB,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agenticros",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "type": "module",
5
5
  "description": "AgenticROS - agentic AI for ROS-powered robots. Single CLI to launch real-robot or simulated demos, manage configuration, and inspect status.",
6
6
  "keywords": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "packedAt": "2026-06-06T14:30:19.631Z",
2
+ "packedAt": "2026-06-06T22:08:53.765Z",
3
3
  "repo": "https://github.com/PlaiPin/agenticros",
4
4
  "note": "This directory is a snapshot of the agenticros monorepo source. `agenticros init` will copy it to ~/agenticros and run pnpm install + colcon build there.",
5
5
  "layout": {
package/runtime/README.md CHANGED
@@ -56,34 +56,95 @@ Gemini CLI → @agenticros/gemini (function calling) → Core → ROS2 robots
56
56
  - `**docker/**` — Docker Compose and Dockerfiles for ROS2 + plugin images.
57
57
  - `**examples/**` — Example projects.
58
58
 
59
- ## Requirements
59
+ ## Install
60
60
 
61
- - Node.js >= 20, pnpm >= 9
62
- - ROS2 (Jazzy or compatible) for building and running the ROS2 packages
63
- - OpenClaw gateway for the OpenClaw plugin
61
+ You only need one command. The `agenticros` CLI handles everything else —
62
+ installing the ROS 2 workspace, building the MCP server, registering the
63
+ OpenClaw plugin, and wiring up your robot config.
64
64
 
65
- ## Quick start
65
+ ```bash
66
+ npx agenticros
67
+ ```
66
68
 
67
- 1. **Install dependencies**
68
- ```bash
69
- pnpm install
70
- ```
71
- 2. **Build ROS2 workspace** (optional, if you need discovery/agent/follow_me nodes)
72
- ```bash
73
- cd ros2_ws
74
- colcon build --packages-select agenticros_msgs agenticros_bringup agenticros_discovery agenticros_agent agenticros_follow_me
75
- source install/setup.bash
76
- ```
77
- 3. **Type-check packages**
78
- ```bash
79
- pnpm typecheck
80
- ```
81
- 4. **Install and test the OpenClaw plugin**
82
- Point the OpenClaw gateway at this repo’s `packages/agenticros` (or at a built package). Configure the plugin under `plugins.entries.agenticros.config` in your OpenClaw config file. Run `./scripts/setup_gateway_plugin.sh` from the repo root to register the plugin and print next steps. **Recommended:** OpenClaw **2026.3.11** or later — plugin routes work at [http://127.0.0.1:18789/plugins/agenticros/](http://127.0.0.1:18789/plugins/agenticros/) (config, teleop). For local dev without token auth, run `**node scripts/setup-openclaw-local.cjs`** then restart the gateway. **If URLs don't load** (e.g. gateway logs "missing or invalid auth" on older versions): run `**./scripts/use-openclaw-2026.2.26.sh`** as fallback. See **docs/openclaw-releases-and-plugin-routes.md**.
69
+ That's it. Run it on any machine with **Node ≥ 20**, no `git clone` required.
70
+ The first run launches the interactive menu:
71
+
72
+ ```text
73
+ ╔──────────────────────────────────────────────────╗
74
+ AgenticROS - agentic AI for ROS-powered robots ║
75
+ ╚──────────────────────────────────────────────────╝
76
+
77
+ ? What would you like to do?
78
+ Launch with real robot
79
+ Launch with simulation
80
+ First-time setup (workspace + OpenClaw plugin + API key)
81
+ Stop everything
82
+ Doctor (health check)
83
+ Configure (API keys, namespace, transport)
84
+ Tail logs
85
+ ```
86
+
87
+ Pick **First-time setup** once (workspace + OpenClaw plugin + API key, all
88
+ idempotent), then choose how you want to run:
89
+
90
+ | You want to … | Pick |
91
+ |---|---|
92
+ | Drive your **real robot** (RealSense + motors + MCP) | **Launch with real robot** |
93
+ | Demo a **simulated 2-wheel AMR** in Gazebo + RViz | **Launch with simulation → AMR** |
94
+ | Demo a **simulated 6-DOF arm** (UR5e-shaped, per-joint position control) | **Launch with simulation → 6-DOF arm** |
83
95
 
84
- **With token auth:** Run `node scripts/agenticros-proxy.cjs 18790` and open [http://127.0.0.1:18790/plugins/agenticros/](http://127.0.0.1:18790/plugins/agenticros/). See **docs/teleop.md**.
96
+ Once a stack is up, point any of the supported agents — OpenClaw, Claude Code,
97
+ Claude Desktop / Dispatch, or Gemini CLI — at the same robot and start talking
98
+ to it. The CLI tracks what it spawned (pidfiles + logs under `/tmp/agenticros-*`),
99
+ so **Stop everything** cleanly tears the demo down.
100
+
101
+ Prefer scripted invocations? Every menu item maps to a direct command:
102
+
103
+ ```bash
104
+ npx agenticros init # one-time workspace + plugin + API key
105
+ agenticros up real # real robot stack
106
+ agenticros up sim-amr # simulated AMR (Gazebo + RViz, headless on Jetson)
107
+ agenticros up sim-arm # simulated 6-DOF arm
108
+ agenticros mode <real|sim> # swap the active config profile (namespace, transport)
109
+ agenticros doctor # coloured health check
110
+ agenticros down # stop everything we started
111
+ ```
112
+
113
+ Full CLI reference: **[packages/agenticros-cli/README.md](packages/agenticros-cli/README.md)**.
114
+
115
+ ### Requirements
116
+
117
+ - **Node.js ≥ 20** (the only hard requirement — `npx agenticros` installs pnpm
118
+ itself if missing)
119
+ - **ROS 2 Humble or Jazzy** if you plan to use the real-robot stack or any
120
+ simulation (the CLI sources `/opt/ros/<distro>/setup.bash` and runs
121
+ `colcon build` for you)
122
+ - **OpenClaw gateway** only if you also want the OpenClaw web UI / chat /
123
+ teleop adapter
124
+
125
+ ### Contributing / building from source
126
+
127
+ Hacking on the packages themselves? Clone and use the local checkout — the CLI
128
+ auto-detects the workspace and uses live sources instead of the bundled snapshot:
129
+
130
+ ```bash
131
+ git clone https://github.com/PlaiPin/agenticros && cd agenticros
132
+ pnpm install && pnpm build
133
+ ./agenticros # repo-local CLI shim, same menu as `npx agenticros`
134
+ ```
85
135
 
86
- See `**docs/`** for robot setup, skills, teleop, and Docker.
136
+ For the OpenClaw plugin specifically, point the gateway at this repo's
137
+ `packages/agenticros` and configure under `plugins.entries.agenticros.config`.
138
+ **Recommended:** OpenClaw **2026.3.11+** — routes work at
139
+ [http://127.0.0.1:18789/plugins/agenticros/](http://127.0.0.1:18789/plugins/agenticros/)
140
+ (config, teleop). For local dev without token auth:
141
+ `node scripts/setup-openclaw-local.cjs` then restart the gateway. Older gateways
142
+ needing token auth: run `node scripts/agenticros-proxy.cjs 18790` and open
143
+ [http://127.0.0.1:18790/plugins/agenticros/](http://127.0.0.1:18790/plugins/agenticros/).
144
+ See **[docs/openclaw-releases-and-plugin-routes.md](docs/openclaw-releases-and-plugin-routes.md)**
145
+ and **[docs/teleop.md](docs/teleop.md)**.
146
+
147
+ See **`docs/`** for robot setup, skills, teleop, simulation internals, and Docker.
87
148
 
88
149
  ## RViz2 and Gazebo (TurtleBot3 + rosbridge)
89
150
 
@@ -23,7 +23,8 @@
23
23
  "memory_status",
24
24
  "follow_robot",
25
25
  "follow_me_see",
26
- "ollama_status"
26
+ "ollama_status",
27
+ "find_object"
27
28
  ]
28
29
  },
29
30
  "configSchema": {
@@ -311,7 +312,10 @@
311
312
  },
312
313
  "backend": {
313
314
  "type": "string",
314
- "enum": ["local", "mem0"],
315
+ "enum": [
316
+ "local",
317
+ "mem0"
318
+ ],
315
319
  "default": "local",
316
320
  "description": "local = JSON-on-disk, no deps; mem0 = semantic search via mem0ai (requires `pnpm add mem0ai`)."
317
321
  },