agenticros 0.0.1 → 0.1.1
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/LICENSE +192 -0
- package/README.md +90 -4
- package/dist/commands/config.d.ts +20 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +179 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/doctor.d.ts +33 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +232 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/down.d.ts +15 -0
- package/dist/commands/down.d.ts.map +1 -0
- package/dist/commands/down.js +91 -0
- package/dist/commands/down.js.map +1 -0
- package/dist/commands/init.d.ts +21 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +259 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/logs.d.ts +18 -0
- package/dist/commands/logs.d.ts.map +1 -0
- package/dist/commands/logs.js +67 -0
- package/dist/commands/logs.js.map +1 -0
- package/dist/commands/status.d.ts +12 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +56 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/up.d.ts +20 -0
- package/dist/commands/up.d.ts.map +1 -0
- package/dist/commands/up.js +70 -0
- package/dist/commands/up.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +107 -0
- package/dist/index.js.map +1 -0
- package/dist/menu.d.ts +9 -0
- package/dist/menu.d.ts.map +1 -0
- package/dist/menu.js +96 -0
- package/dist/menu.js.map +1 -0
- package/dist/runners/real-robot.d.ts +15 -0
- package/dist/runners/real-robot.d.ts.map +1 -0
- package/dist/runners/real-robot.js +46 -0
- package/dist/runners/real-robot.js.map +1 -0
- package/dist/runners/sim.d.ts +19 -0
- package/dist/runners/sim.d.ts.map +1 -0
- package/dist/runners/sim.js +53 -0
- package/dist/runners/sim.js.map +1 -0
- package/dist/util/env.d.ts +24 -0
- package/dist/util/env.d.ts.map +1 -0
- package/dist/util/env.js +53 -0
- package/dist/util/env.js.map +1 -0
- package/dist/util/logger.d.ts +24 -0
- package/dist/util/logger.d.ts.map +1 -0
- package/dist/util/logger.js +62 -0
- package/dist/util/logger.js.map +1 -0
- package/dist/util/paths.d.ts +57 -0
- package/dist/util/paths.d.ts.map +1 -0
- package/dist/util/paths.js +132 -0
- package/dist/util/paths.js.map +1 -0
- package/dist/util/pidfile.d.ts +16 -0
- package/dist/util/pidfile.d.ts.map +1 -0
- package/dist/util/pidfile.js +63 -0
- package/dist/util/pidfile.js.map +1 -0
- package/dist/util/state.d.ts +26 -0
- package/dist/util/state.d.ts.map +1 -0
- package/dist/util/state.js +55 -0
- package/dist/util/state.js.map +1 -0
- package/package.json +60 -1
- package/runtime/BUNDLE.json +11 -0
- package/runtime/LICENSE +192 -0
- package/runtime/README.md +273 -0
- package/runtime/docs/architecture.md +366 -0
- package/runtime/docs/cli.md +140 -0
- package/runtime/docs/memory.md +292 -0
- package/runtime/docs/robot-setup.md +347 -0
- package/runtime/package.json +28 -0
- package/runtime/packages/agenticros/agenticros-agenticros-0.0.1.tgz +0 -0
- package/runtime/packages/agenticros/openclaw.plugin.json +451 -0
- package/runtime/packages/agenticros/package.json +41 -0
- package/runtime/packages/agenticros/src/camera-snapshot-cache.ts +59 -0
- package/runtime/packages/agenticros/src/camera-snapshot-routes.ts +44 -0
- package/runtime/packages/agenticros/src/commands/estop.ts +41 -0
- package/runtime/packages/agenticros/src/commands/transport.ts +195 -0
- package/runtime/packages/agenticros/src/config-file.ts +136 -0
- package/runtime/packages/agenticros/src/config-page.ts +498 -0
- package/runtime/packages/agenticros/src/context/robot-context.ts +373 -0
- package/runtime/packages/agenticros/src/depth.ts +313 -0
- package/runtime/packages/agenticros/src/describer.ts +157 -0
- package/runtime/packages/agenticros/src/image-binary-trim.ts +16 -0
- package/runtime/packages/agenticros/src/index.ts +85 -0
- package/runtime/packages/agenticros/src/landing-page.ts +38 -0
- package/runtime/packages/agenticros/src/memory.ts +44 -0
- package/runtime/packages/agenticros/src/plugin-api.ts +173 -0
- package/runtime/packages/agenticros/src/plugin-image-base64.ts +69 -0
- package/runtime/packages/agenticros/src/preflight.ts +110 -0
- package/runtime/packages/agenticros/src/routes.ts +328 -0
- package/runtime/packages/agenticros/src/safety/validator.ts +43 -0
- package/runtime/packages/agenticros/src/service.ts +359 -0
- package/runtime/packages/agenticros/src/skill-api.ts +65 -0
- package/runtime/packages/agenticros/src/skill-loader.ts +146 -0
- package/runtime/packages/agenticros/src/teleop/page.ts +498 -0
- package/runtime/packages/agenticros/src/teleop/routes.ts +650 -0
- package/runtime/packages/agenticros/src/tools/index.ts +26 -0
- package/runtime/packages/agenticros/src/tools/ros2-action.ts +50 -0
- package/runtime/packages/agenticros/src/tools/ros2-camera.ts +221 -0
- package/runtime/packages/agenticros/src/tools/ros2-depth-distance.ts +58 -0
- package/runtime/packages/agenticros/src/tools/ros2-introspect.ts +62 -0
- package/runtime/packages/agenticros/src/tools/ros2-memory.ts +158 -0
- package/runtime/packages/agenticros/src/tools/ros2-param.ts +87 -0
- package/runtime/packages/agenticros/src/tools/ros2-publish.ts +52 -0
- package/runtime/packages/agenticros/src/tools/ros2-service.ts +46 -0
- package/runtime/packages/agenticros/src/tools/ros2-subscribe.ts +71 -0
- package/runtime/packages/agenticros/tsconfig.json +9 -0
- package/runtime/packages/agenticros-claude-code/README.md +260 -0
- package/runtime/packages/agenticros-claude-code/config.example.json +9 -0
- package/runtime/packages/agenticros-claude-code/dist/config.d.ts +8 -0
- package/runtime/packages/agenticros-claude-code/dist/config.d.ts.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/config.js +93 -0
- package/runtime/packages/agenticros-claude-code/dist/config.js.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/depth.d.ts +20 -0
- package/runtime/packages/agenticros-claude-code/dist/depth.d.ts.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/depth.js +126 -0
- package/runtime/packages/agenticros-claude-code/dist/depth.js.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/find-object/coco-classes.d.ts +6 -0
- package/runtime/packages/agenticros-claude-code/dist/find-object/coco-classes.d.ts.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/find-object/coco-classes.js +36 -0
- package/runtime/packages/agenticros-claude-code/dist/find-object/coco-classes.js.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/find-object/find-object.d.ts +33 -0
- package/runtime/packages/agenticros-claude-code/dist/find-object/find-object.d.ts.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/find-object/find-object.js +134 -0
- package/runtime/packages/agenticros-claude-code/dist/find-object/find-object.js.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/follow-me/controller.d.ts +43 -0
- package/runtime/packages/agenticros-claude-code/dist/follow-me/controller.d.ts.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/follow-me/controller.js +73 -0
- package/runtime/packages/agenticros-claude-code/dist/follow-me/controller.js.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/follow-me/detector.d.ts +58 -0
- package/runtime/packages/agenticros-claude-code/dist/follow-me/detector.d.ts.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/follow-me/detector.js +251 -0
- package/runtime/packages/agenticros-claude-code/dist/follow-me/detector.js.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/follow-me/loop.d.ts +61 -0
- package/runtime/packages/agenticros-claude-code/dist/follow-me/loop.d.ts.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/follow-me/loop.js +268 -0
- package/runtime/packages/agenticros-claude-code/dist/follow-me/loop.js.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/index.d.ts +3 -0
- package/runtime/packages/agenticros-claude-code/dist/index.d.ts.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/index.js +111 -0
- package/runtime/packages/agenticros-claude-code/dist/index.js.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/memory.d.ts +17 -0
- package/runtime/packages/agenticros-claude-code/dist/memory.d.ts.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/memory.js +44 -0
- package/runtime/packages/agenticros-claude-code/dist/memory.js.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/safety.d.ts +10 -0
- package/runtime/packages/agenticros-claude-code/dist/safety.d.ts.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/safety.js +34 -0
- package/runtime/packages/agenticros-claude-code/dist/safety.js.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/tools.d.ts +36 -0
- package/runtime/packages/agenticros-claude-code/dist/tools.d.ts.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/tools.js +777 -0
- package/runtime/packages/agenticros-claude-code/dist/tools.js.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/transport.d.ts +17 -0
- package/runtime/packages/agenticros-claude-code/dist/transport.d.ts.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/transport.js +46 -0
- package/runtime/packages/agenticros-claude-code/dist/transport.js.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/zero-shot/detector.d.ts +42 -0
- package/runtime/packages/agenticros-claude-code/dist/zero-shot/detector.d.ts.map +1 -0
- package/runtime/packages/agenticros-claude-code/dist/zero-shot/detector.js +114 -0
- package/runtime/packages/agenticros-claude-code/dist/zero-shot/detector.js.map +1 -0
- package/runtime/packages/agenticros-claude-code/package.json +29 -0
- package/runtime/packages/agenticros-claude-code/src/config.ts +96 -0
- package/runtime/packages/agenticros-claude-code/src/depth.ts +173 -0
- package/runtime/packages/agenticros-claude-code/src/find-object/coco-classes.ts +38 -0
- package/runtime/packages/agenticros-claude-code/src/find-object/find-object.ts +190 -0
- package/runtime/packages/agenticros-claude-code/src/follow-me/controller.ts +109 -0
- package/runtime/packages/agenticros-claude-code/src/follow-me/depth-loop.ts +420 -0
- package/runtime/packages/agenticros-claude-code/src/follow-me/detector.ts +303 -0
- package/runtime/packages/agenticros-claude-code/src/follow-me/loop.ts +330 -0
- package/runtime/packages/agenticros-claude-code/src/index.ts +125 -0
- package/runtime/packages/agenticros-claude-code/src/memory.ts +51 -0
- package/runtime/packages/agenticros-claude-code/src/safety.ts +44 -0
- package/runtime/packages/agenticros-claude-code/src/tools.ts +891 -0
- package/runtime/packages/agenticros-claude-code/src/transport.ts +58 -0
- package/runtime/packages/agenticros-claude-code/src/zero-shot/detector.ts +169 -0
- package/runtime/packages/agenticros-claude-code/tsconfig.json +9 -0
- package/runtime/packages/agenticros-claude-code/yolo-debug.mjs +106 -0
- package/runtime/packages/agenticros-gemini/README.md +139 -0
- package/runtime/packages/agenticros-gemini/package.json +28 -0
- package/runtime/packages/agenticros-gemini/scripts/smoke-api.mjs +42 -0
- package/runtime/packages/agenticros-gemini/src/chat.ts +139 -0
- package/runtime/packages/agenticros-gemini/src/config.ts +92 -0
- package/runtime/packages/agenticros-gemini/src/depth.ts +173 -0
- package/runtime/packages/agenticros-gemini/src/index.ts +58 -0
- package/runtime/packages/agenticros-gemini/src/memory.ts +32 -0
- package/runtime/packages/agenticros-gemini/src/safety.ts +44 -0
- package/runtime/packages/agenticros-gemini/src/tools.ts +516 -0
- package/runtime/packages/agenticros-gemini/src/transport.ts +58 -0
- package/runtime/packages/agenticros-gemini/tsconfig.json +8 -0
- package/runtime/packages/core/package.json +47 -0
- package/runtime/packages/core/src/banner.ts +32 -0
- package/runtime/packages/core/src/cmd-vel-twist.ts +31 -0
- package/runtime/packages/core/src/config.ts +279 -0
- package/runtime/packages/core/src/index.ts +54 -0
- package/runtime/packages/core/src/memory/__tests__/factory.test.ts +70 -0
- package/runtime/packages/core/src/memory/__tests__/local-provider.test.ts +195 -0
- package/runtime/packages/core/src/memory/__tests__/mem0-provider.test.ts +192 -0
- package/runtime/packages/core/src/memory/__tests__/smart-defaults.test.ts +46 -0
- package/runtime/packages/core/src/memory/factory.ts +63 -0
- package/runtime/packages/core/src/memory/index.ts +10 -0
- package/runtime/packages/core/src/memory/local/provider.ts +229 -0
- package/runtime/packages/core/src/memory/mem0/provider.ts +379 -0
- package/runtime/packages/core/src/memory/types.ts +96 -0
- package/runtime/packages/core/src/topic-utils.ts +95 -0
- package/runtime/packages/core/src/transport/factory.ts +47 -0
- package/runtime/packages/core/src/transport/local/conversion.ts +333 -0
- package/runtime/packages/core/src/transport/local/entities.ts +129 -0
- package/runtime/packages/core/src/transport/local/transport.ts +406 -0
- package/runtime/packages/core/src/transport/rosbridge/actions.ts +81 -0
- package/runtime/packages/core/src/transport/rosbridge/adapter.ts +157 -0
- package/runtime/packages/core/src/transport/rosbridge/client.ts +438 -0
- package/runtime/packages/core/src/transport/rosbridge/services.ts +41 -0
- package/runtime/packages/core/src/transport/rosbridge/topics.ts +60 -0
- package/runtime/packages/core/src/transport/rosbridge/types.ts +118 -0
- package/runtime/packages/core/src/transport/transport.ts +77 -0
- package/runtime/packages/core/src/transport/types.ts +137 -0
- package/runtime/packages/core/src/transport/webrtc/signaling-client.ts +196 -0
- package/runtime/packages/core/src/transport/webrtc/signaling-types.ts +130 -0
- package/runtime/packages/core/src/transport/webrtc/transport.ts +516 -0
- package/runtime/packages/core/src/transport/zenoh/adapter.ts +357 -0
- package/runtime/packages/core/src/transport/zenoh/cdr.ts +183 -0
- package/runtime/packages/core/src/transport/zenoh/keys.ts +51 -0
- package/runtime/packages/core/tsconfig.json +9 -0
- package/runtime/packages/ros-camera/package.json +30 -0
- package/runtime/packages/ros-camera/src/index.ts +13 -0
- package/runtime/packages/ros-camera/src/snapshot.ts +372 -0
- package/runtime/packages/ros-camera/tsconfig.json +9 -0
- package/runtime/pnpm-lock.yaml +5260 -0
- package/runtime/pnpm-workspace.yaml +2 -0
- package/runtime/ros2_ws/src/agenticros_agent/agenticros_agent/__init__.py +0 -0
- package/runtime/ros2_ws/src/agenticros_agent/agenticros_agent/agent_node.py +561 -0
- package/runtime/ros2_ws/src/agenticros_agent/package.xml +25 -0
- package/runtime/ros2_ws/src/agenticros_agent/resource/agenticros_agent +0 -0
- package/runtime/ros2_ws/src/agenticros_agent/setup.cfg +4 -0
- package/runtime/ros2_ws/src/agenticros_agent/setup.py +25 -0
- package/runtime/ros2_ws/src/agenticros_bringup/README.md +128 -0
- package/runtime/ros2_ws/src/agenticros_bringup/agenticros_bringup/__init__.py +1 -0
- package/runtime/ros2_ws/src/agenticros_bringup/agenticros_bringup/cmd_vel_relay.py +33 -0
- package/runtime/ros2_ws/src/agenticros_bringup/launch/cmd_vel_bridge.launch.py +58 -0
- package/runtime/ros2_ws/src/agenticros_bringup/launch/gazebo_turtlebot3.launch.py +69 -0
- package/runtime/ros2_ws/src/agenticros_bringup/launch/mode_a_gazebo.launch.py +55 -0
- package/runtime/ros2_ws/src/agenticros_bringup/launch/mode_a_gazebo_rviz.launch.py +48 -0
- package/runtime/ros2_ws/src/agenticros_bringup/launch/realsense_rosbridge.launch.py +154 -0
- package/runtime/ros2_ws/src/agenticros_bringup/launch/rosbridge_gazebo.launch.py +54 -0
- package/runtime/ros2_ws/src/agenticros_bringup/launch/rviz.launch.py +38 -0
- package/runtime/ros2_ws/src/agenticros_bringup/launch/turtlebot3_gazebo_rviz.launch.py +42 -0
- package/runtime/ros2_ws/src/agenticros_bringup/package.xml +24 -0
- package/runtime/ros2_ws/src/agenticros_bringup/resource/agenticros_bringup +0 -0
- package/runtime/ros2_ws/src/agenticros_bringup/rviz/turtlebot3_agenticros.rviz +174 -0
- package/runtime/ros2_ws/src/agenticros_bringup/setup.cfg +4 -0
- package/runtime/ros2_ws/src/agenticros_bringup/setup.py +28 -0
- package/runtime/ros2_ws/src/agenticros_discovery/agenticros_discovery/__init__.py +0 -0
- package/runtime/ros2_ws/src/agenticros_discovery/agenticros_discovery/discovery_node.py +172 -0
- package/runtime/ros2_ws/src/agenticros_discovery/package.xml +22 -0
- package/runtime/ros2_ws/src/agenticros_discovery/resource/agenticros_discovery +0 -0
- package/runtime/ros2_ws/src/agenticros_discovery/setup.cfg +5 -0
- package/runtime/ros2_ws/src/agenticros_discovery/setup.py +25 -0
- package/runtime/ros2_ws/src/agenticros_follow_me/README.md +66 -0
- package/runtime/ros2_ws/src/agenticros_follow_me/agenticros_follow_me/__init__.py +1 -0
- package/runtime/ros2_ws/src/agenticros_follow_me/agenticros_follow_me/__main__.py +5 -0
- package/runtime/ros2_ws/src/agenticros_follow_me/agenticros_follow_me/follow_me_node.py +278 -0
- package/runtime/ros2_ws/src/agenticros_follow_me/agenticros_follow_me/follower_controller.py +631 -0
- package/runtime/ros2_ws/src/agenticros_follow_me/agenticros_follow_me/person_tracker.py +635 -0
- package/runtime/ros2_ws/src/agenticros_follow_me/package.xml +22 -0
- package/runtime/ros2_ws/src/agenticros_follow_me/resource/agenticros_follow_me +0 -0
- package/runtime/ros2_ws/src/agenticros_follow_me/setup.py +25 -0
- package/runtime/ros2_ws/src/agenticros_msgs/CMakeLists.txt +26 -0
- package/runtime/ros2_ws/src/agenticros_msgs/msg/CapabilityManifest.msg +9 -0
- package/runtime/ros2_ws/src/agenticros_msgs/package.xml +22 -0
- package/runtime/ros2_ws/src/agenticros_msgs/srv/FollowMeGetStatus.srv +11 -0
- package/runtime/ros2_ws/src/agenticros_msgs/srv/FollowMeSetDistance.srv +4 -0
- package/runtime/ros2_ws/src/agenticros_msgs/srv/FollowMeSetTarget.srv +6 -0
- package/runtime/ros2_ws/src/agenticros_msgs/srv/FollowMeStart.srv +5 -0
- package/runtime/ros2_ws/src/agenticros_msgs/srv/FollowMeStop.srv +3 -0
- package/runtime/ros2_ws/src/agenticros_msgs/srv/GetCapabilities.srv +5 -0
- package/runtime/ros2_ws/src/agenticros_sim/CMakeLists.txt +24 -0
- package/runtime/ros2_ws/src/agenticros_sim/README.md +120 -0
- package/runtime/ros2_ws/src/agenticros_sim/config/agenticros-sim.config.json +28 -0
- package/runtime/ros2_ws/src/agenticros_sim/config/amr_bridge.yaml +111 -0
- package/runtime/ros2_ws/src/agenticros_sim/config/amr_view.rviz +172 -0
- package/runtime/ros2_ws/src/agenticros_sim/env-hooks/gz_resource_path.dsv.in +3 -0
- package/runtime/ros2_ws/src/agenticros_sim/env-hooks/gz_resource_path.sh.in +7 -0
- package/runtime/ros2_ws/src/agenticros_sim/launch/sim_amr.launch.py +159 -0
- package/runtime/ros2_ws/src/agenticros_sim/models/agenticros_amr/model.config +17 -0
- package/runtime/ros2_ws/src/agenticros_sim/models/agenticros_amr/model.sdf +244 -0
- package/runtime/ros2_ws/src/agenticros_sim/package.xml +27 -0
- package/runtime/ros2_ws/src/agenticros_sim/worlds/agenticros_indoor.sdf +183 -0
- package/runtime/scripts/activate_workspace.sh +285 -0
- package/runtime/scripts/agenticros-describer.policy.yaml +96 -0
- package/runtime/scripts/agenticros-proxy.cjs +99 -0
- package/runtime/scripts/agenticros-rosbridge.policy.yaml +62 -0
- package/runtime/scripts/check-cli-tarball-size.mjs +42 -0
- package/runtime/scripts/configure_agenticros.sh +200 -0
- package/runtime/scripts/configure_for_sim.sh +64 -0
- package/runtime/scripts/fix-openclaw-control-ui-path.sh +20 -0
- package/runtime/scripts/install_cli.sh +94 -0
- package/runtime/scripts/install_rosbridge_from_source.sh +67 -0
- package/runtime/scripts/lib/agenticros-banner.sh +28 -0
- package/runtime/scripts/onboard_robot.sh +75 -0
- package/runtime/scripts/openai.policy.yaml +77 -0
- package/runtime/scripts/openclaw-dashboard-url.cjs +49 -0
- package/runtime/scripts/pack-runtime.mjs +245 -0
- package/runtime/scripts/run_demo_native.sh +43 -0
- package/runtime/scripts/run_nemoclaw_host_stack.sh +91 -0
- package/runtime/scripts/run_robot_rosbridge.sh +36 -0
- package/runtime/scripts/sandbox_rosbridge_relay.py +137 -0
- package/runtime/scripts/setup-openclaw-local.cjs +75 -0
- package/runtime/scripts/setup_gateway_plugin.sh +329 -0
- package/runtime/scripts/setup_robot.sh +113 -0
- package/runtime/scripts/setup_workspace.sh +484 -0
- package/runtime/scripts/sim/run_sim.sh +146 -0
- package/runtime/scripts/smoke_test_nemoclaw.sh +123 -0
- package/runtime/scripts/start_demo.sh +55 -0
- package/runtime/scripts/sync-skill-tools.mjs +335 -0
- package/runtime/scripts/test-follow-me-sim.mjs +135 -0
- package/runtime/scripts/test-mcp-e2e.mjs +184 -0
- package/runtime/scripts/test-rclnodejs.mts +129 -0
- package/runtime/scripts/use-openclaw-2026.2.26.sh +19 -0
- package/runtime/scripts/use-openclaw-2026.3.11.sh +19 -0
- package/runtime/scripts/zenoh-bridge-ros2dds-robot.json5 +30 -0
- package/runtime/scripts/zenohd-agenticros.json5 +11 -0
- package/runtime/scripts/zenohd-rosclaw.json5 +11 -0
- package/runtime/tsconfig.base.json +19 -0
- package/index.js +0 -6
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalizes sensor_msgs/Image and sensor_msgs/CompressedImage plain objects (from any transport)
|
|
3
|
+
* into base64 + MIME-friendly format labels for chat UIs.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { decompress as zstdDecompress } from "fzstd";
|
|
7
|
+
import { PNG } from "pngjs";
|
|
8
|
+
|
|
9
|
+
/** ROS 2 type string for subscribe/publish calls. */
|
|
10
|
+
export const ROS_MSG_IMAGE = "sensor_msgs/msg/Image";
|
|
11
|
+
export const ROS_MSG_COMPRESSED_IMAGE = "sensor_msgs/msg/CompressedImage";
|
|
12
|
+
|
|
13
|
+
const MAX_IMAGE_BYTES_UNWRAP_DEPTH = 3;
|
|
14
|
+
|
|
15
|
+
export interface CameraSnapshotPayload {
|
|
16
|
+
/** Format key for MIME fallback: png, jpeg, webp, … */
|
|
17
|
+
formatLabel: string;
|
|
18
|
+
dataBase64: string;
|
|
19
|
+
width?: number;
|
|
20
|
+
height?: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Width / height / step may be plain numbers or rclnodejs ref-wrapped. */
|
|
24
|
+
export function rosNumericField(v: unknown, label: string): number {
|
|
25
|
+
if (typeof v === "number" && Number.isFinite(v)) return Math.trunc(v);
|
|
26
|
+
if (typeof v === "bigint") return Number(v);
|
|
27
|
+
if (v != null && typeof v === "object" && "data" in v) {
|
|
28
|
+
return rosNumericField((v as { data: unknown }).data, label);
|
|
29
|
+
}
|
|
30
|
+
const n = Number(v);
|
|
31
|
+
if (Number.isFinite(n)) return Math.trunc(n);
|
|
32
|
+
throw new Error(`Invalid ${label} in Image message (cannot coerce to integer)`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** `sensor_msgs/Image.is_bigendian` and similar flags (plain or ref-wrapped). */
|
|
36
|
+
export function rosBoolField(v: unknown): boolean {
|
|
37
|
+
if (v == null) return false;
|
|
38
|
+
if (typeof v === "boolean") return v;
|
|
39
|
+
if (typeof v === "bigint") return v !== 0n;
|
|
40
|
+
if (typeof v === "number" && Number.isFinite(v)) return v !== 0;
|
|
41
|
+
if (typeof v === "object" && v !== null && "data" in v) {
|
|
42
|
+
return rosBoolField((v as { data: unknown }).data);
|
|
43
|
+
}
|
|
44
|
+
const n = Number(v);
|
|
45
|
+
return Number.isFinite(n) && n !== 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** `sensor_msgs/Image.encoding` may be a plain string or ref-wrapped (same pattern as numeric fields). */
|
|
49
|
+
export function rosStringField(v: unknown, fallback: string): string {
|
|
50
|
+
if (v == null || v === "") return fallback;
|
|
51
|
+
if (typeof v === "string") return v;
|
|
52
|
+
if (typeof v === "object" && v !== null && "data" in v) {
|
|
53
|
+
return rosStringField((v as { data: unknown }).data, fallback);
|
|
54
|
+
}
|
|
55
|
+
if (typeof v === "bigint") return String(v);
|
|
56
|
+
if (typeof v === "number" && Number.isFinite(v)) return String(v);
|
|
57
|
+
return String(v);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Normalize depth image encodings for sampling (trim; map mono16 / case variants).
|
|
62
|
+
* `mono16` uses the same uint16 layout as `16UC1` (millimeters on RealSense-class sensors).
|
|
63
|
+
*/
|
|
64
|
+
export function normalizeDepthImageEncoding(encoding: string): string {
|
|
65
|
+
const t = encoding.trim();
|
|
66
|
+
if (t === "") return "16UC1";
|
|
67
|
+
const lower = t.toLowerCase();
|
|
68
|
+
if (lower === "mono16") return "16UC1";
|
|
69
|
+
if (lower === "16uc1") return "16UC1";
|
|
70
|
+
if (lower === "32fc1") return "32FC1";
|
|
71
|
+
return t;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Normalize `sensor_msgs/Image.data` / `CompressedImage.data` from any transport into a Buffer. */
|
|
75
|
+
export function coerceRosImageDataToBuffer(data: unknown, depth = 0): Buffer {
|
|
76
|
+
if (data == null) {
|
|
77
|
+
throw new Error("Image data is null or missing");
|
|
78
|
+
}
|
|
79
|
+
if (typeof data === "string") {
|
|
80
|
+
try {
|
|
81
|
+
const asB64 = Buffer.from(data, "base64");
|
|
82
|
+
if (asB64.length > 0) return asB64;
|
|
83
|
+
} catch {
|
|
84
|
+
/* fall through */
|
|
85
|
+
}
|
|
86
|
+
return Buffer.from(data, "utf8");
|
|
87
|
+
}
|
|
88
|
+
if (depth < MAX_IMAGE_BYTES_UNWRAP_DEPTH && typeof data === "object" && data !== null) {
|
|
89
|
+
const rec = data as Record<string, unknown>;
|
|
90
|
+
if (rec["type"] === "Buffer" && Array.isArray(rec["data"])) {
|
|
91
|
+
return coerceRosImageDataToBuffer(rec["data"], depth + 1);
|
|
92
|
+
}
|
|
93
|
+
if ("data" in rec && rec["data"] !== undefined) {
|
|
94
|
+
return coerceRosImageDataToBuffer(rec["data"], depth + 1);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (typeof ArrayBuffer !== "undefined" && data instanceof ArrayBuffer) {
|
|
98
|
+
return Buffer.from(data);
|
|
99
|
+
}
|
|
100
|
+
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView(data)) {
|
|
101
|
+
const view = data as ArrayBufferView;
|
|
102
|
+
return Buffer.from(view.buffer, view.byteOffset, view.byteLength);
|
|
103
|
+
}
|
|
104
|
+
if (data instanceof Uint8Array) return Buffer.from(data);
|
|
105
|
+
if (Array.isArray(data)) {
|
|
106
|
+
const bytes = new Uint8Array(data.length);
|
|
107
|
+
for (let i = 0; i < data.length; i++) bytes[i] = Number(data[i]) & 0xff;
|
|
108
|
+
return Buffer.from(bytes);
|
|
109
|
+
}
|
|
110
|
+
if (typeof data === "object" && data !== null && Symbol.iterator in data) {
|
|
111
|
+
try {
|
|
112
|
+
const arr = Uint8Array.from(data as Iterable<number>);
|
|
113
|
+
if (arr.length > 0) return Buffer.from(arr);
|
|
114
|
+
} catch {
|
|
115
|
+
/* fall through */
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const arrayLike = tryArrayLikeBytes(data);
|
|
119
|
+
if (arrayLike !== null) return arrayLike;
|
|
120
|
+
const fromNumericRecord = tryDenseNumericRecordToBuffer(data);
|
|
121
|
+
if (fromNumericRecord !== null) return fromNumericRecord;
|
|
122
|
+
|
|
123
|
+
throw new Error(
|
|
124
|
+
"Image data has unsupported shape after ROS decode (expected byte array, Buffer, TypedArray, ArrayBuffer, or {data: …}). " +
|
|
125
|
+
`Got: ${typeof data}${data !== null && typeof data === "object" ? ` (${data.constructor?.name ?? "Object"})` : ""}`,
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function tryArrayLikeBytes(data: unknown): Buffer | null {
|
|
130
|
+
if (data == null || typeof data !== "object") return null;
|
|
131
|
+
const v = data as { length?: unknown };
|
|
132
|
+
const len = v.length;
|
|
133
|
+
if (typeof len !== "number" || !Number.isFinite(len) || len < 0 || len > 200_000_000) {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
try {
|
|
137
|
+
const rec = data as Record<number, unknown>;
|
|
138
|
+
const u8 = new Uint8Array(len);
|
|
139
|
+
for (let i = 0; i < len; i++) {
|
|
140
|
+
const el = rec[i];
|
|
141
|
+
const n =
|
|
142
|
+
typeof el === "number"
|
|
143
|
+
? el
|
|
144
|
+
: typeof el === "bigint"
|
|
145
|
+
? Number(el)
|
|
146
|
+
: typeof el === "string"
|
|
147
|
+
? Number(el)
|
|
148
|
+
: Number(el);
|
|
149
|
+
if (!Number.isFinite(n)) return null;
|
|
150
|
+
u8[i] = n & 0xff;
|
|
151
|
+
}
|
|
152
|
+
return Buffer.from(u8);
|
|
153
|
+
} catch {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function tryDenseNumericRecordToBuffer(data: unknown): Buffer | null {
|
|
159
|
+
if (typeof data !== "object" || data === null) return null;
|
|
160
|
+
const rec = data as Record<string, unknown>;
|
|
161
|
+
const keys = Object.keys(rec);
|
|
162
|
+
if (keys.length === 0) return null;
|
|
163
|
+
if (!keys.every((k) => /^\d+$/.test(k))) return null;
|
|
164
|
+
const indices = keys.map((k) => Number(k)).sort((a, b) => a - b);
|
|
165
|
+
for (let i = 0; i < indices.length; i++) {
|
|
166
|
+
if (indices[i] !== i) return null;
|
|
167
|
+
}
|
|
168
|
+
const len = indices.length;
|
|
169
|
+
const u8 = new Uint8Array(len);
|
|
170
|
+
for (let i = 0; i < len; i++) {
|
|
171
|
+
const v = rec[String(i)];
|
|
172
|
+
const n = typeof v === "number" ? v : typeof v === "boolean" ? Number(v) : typeof v === "string" ? Number(v) : NaN;
|
|
173
|
+
if (!Number.isFinite(n)) return null;
|
|
174
|
+
u8[i] = n & 0xff;
|
|
175
|
+
}
|
|
176
|
+
return Buffer.from(u8);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function bytesPerPixelForEncoding(enc: string): number {
|
|
180
|
+
const e = enc.toLowerCase().trim();
|
|
181
|
+
if (e === "rgb8" || e === "rgb888" || e === "bgr8" || e === "bgr888") return 3;
|
|
182
|
+
if (e === "rgba8" || e === "bgra8") return 4;
|
|
183
|
+
if (e === "mono8" || e === "8uc1") return 1;
|
|
184
|
+
return 0;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function encodeRawRosImageToPng(params: {
|
|
188
|
+
width: number;
|
|
189
|
+
height: number;
|
|
190
|
+
step: number;
|
|
191
|
+
encoding: string;
|
|
192
|
+
data: Buffer;
|
|
193
|
+
}): Buffer {
|
|
194
|
+
const { width, height, step, encoding, data } = params;
|
|
195
|
+
const enc = encoding.toLowerCase().trim();
|
|
196
|
+
const bpp = bytesPerPixelForEncoding(enc);
|
|
197
|
+
if (bpp === 0) {
|
|
198
|
+
throw new Error(
|
|
199
|
+
`Unsupported sensor_msgs/Image encoding for snapshot: "${encoding}" (supported: rgb8, bgr8, rgba8, bgra8, mono8)`,
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
if (step < width * bpp) {
|
|
203
|
+
throw new Error(`Image step ${step} is smaller than width×bpp (${width}×${bpp}) for ${enc}`);
|
|
204
|
+
}
|
|
205
|
+
const minLen = step * (height - 1) + width * bpp;
|
|
206
|
+
if (data.length < minLen) {
|
|
207
|
+
throw new Error(`Image data length ${data.length} < expected minimum ${minLen} for ${width}×${height} ${enc}`);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
const png = new PNG({ width, height });
|
|
211
|
+
const d = png.data;
|
|
212
|
+
|
|
213
|
+
for (let y = 0; y < height; y++) {
|
|
214
|
+
const row = y * step;
|
|
215
|
+
for (let x = 0; x < width; x++) {
|
|
216
|
+
const i = row + x * bpp;
|
|
217
|
+
const o = (y * width + x) << 2;
|
|
218
|
+
if (enc === "rgb8" || enc === "rgb888") {
|
|
219
|
+
d[o] = data[i];
|
|
220
|
+
d[o + 1] = data[i + 1];
|
|
221
|
+
d[o + 2] = data[i + 2];
|
|
222
|
+
d[o + 3] = 255;
|
|
223
|
+
} else if (enc === "bgr8" || enc === "bgr888") {
|
|
224
|
+
d[o] = data[i + 2];
|
|
225
|
+
d[o + 1] = data[i + 1];
|
|
226
|
+
d[o + 2] = data[i];
|
|
227
|
+
d[o + 3] = 255;
|
|
228
|
+
} else if (enc === "rgba8") {
|
|
229
|
+
d[o] = data[i];
|
|
230
|
+
d[o + 1] = data[i + 1];
|
|
231
|
+
d[o + 2] = data[i + 2];
|
|
232
|
+
d[o + 3] = data[i + 3];
|
|
233
|
+
} else if (enc === "bgra8") {
|
|
234
|
+
d[o] = data[i + 2];
|
|
235
|
+
d[o + 1] = data[i + 1];
|
|
236
|
+
d[o + 2] = data[i];
|
|
237
|
+
d[o + 3] = data[i + 3];
|
|
238
|
+
} else if (enc === "mono8" || enc === "8uc1") {
|
|
239
|
+
const v = data[i];
|
|
240
|
+
d[o] = v;
|
|
241
|
+
d[o + 1] = v;
|
|
242
|
+
d[o + 2] = v;
|
|
243
|
+
d[o + 3] = 255;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return PNG.sync.write(png);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function sniffImageMagic(buf: Buffer): { mime: string; label: string } | null {
|
|
252
|
+
if (buf.length >= 3 && buf[0] === 0xff && buf[1] === 0xd8 && buf[2] === 0xff) {
|
|
253
|
+
return { mime: "image/jpeg", label: "jpeg" };
|
|
254
|
+
}
|
|
255
|
+
if (
|
|
256
|
+
buf.length >= 8 &&
|
|
257
|
+
buf[0] === 0x89 &&
|
|
258
|
+
buf[1] === 0x50 &&
|
|
259
|
+
buf[2] === 0x4e &&
|
|
260
|
+
buf[3] === 0x47 &&
|
|
261
|
+
buf[4] === 0x0d &&
|
|
262
|
+
buf[5] === 0x0a &&
|
|
263
|
+
buf[6] === 0x1a &&
|
|
264
|
+
buf[7] === 0x0a
|
|
265
|
+
) {
|
|
266
|
+
return { mime: "image/png", label: "png" };
|
|
267
|
+
}
|
|
268
|
+
if (buf.length >= 12 && buf.subarray(8, 12).toString("ascii") === "WEBP") {
|
|
269
|
+
return { mime: "image/webp", label: "webp" };
|
|
270
|
+
}
|
|
271
|
+
return null;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function mimeFromSnapshotLabel(label: string): string {
|
|
275
|
+
const f = label.toLowerCase();
|
|
276
|
+
if (f === "png") return "image/png";
|
|
277
|
+
if (f === "gif") return "image/gif";
|
|
278
|
+
if (f === "webp") return "image/webp";
|
|
279
|
+
return "image/jpeg";
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function mimeHintFromCompressedRosFormat(rosFormat: string): { mime: string; label: string } | null {
|
|
283
|
+
const f = rosFormat.toLowerCase();
|
|
284
|
+
if (f.includes("png")) return { mime: "image/png", label: "png" };
|
|
285
|
+
if (f.includes("jpeg") || f.includes("jpg")) return { mime: "image/jpeg", label: "jpeg" };
|
|
286
|
+
if (f.includes("webp")) return { mime: "image/webp", label: "webp" };
|
|
287
|
+
return null;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Build base64 snapshot + format metadata from one plain ROS image message (already decoded by transport).
|
|
292
|
+
*/
|
|
293
|
+
export function cameraSnapshotFromPlainMessage(
|
|
294
|
+
messageType: "Image" | "CompressedImage",
|
|
295
|
+
msg: Record<string, unknown>,
|
|
296
|
+
): CameraSnapshotPayload {
|
|
297
|
+
if (messageType === "Image") {
|
|
298
|
+
const rawBuf = coerceRosImageDataToBuffer(msg["data"]);
|
|
299
|
+
const encoding = String((msg["encoding"] as string) ?? "rgb8");
|
|
300
|
+
const w = rosNumericField(msg["width"], "width");
|
|
301
|
+
const h = rosNumericField(msg["height"], "height");
|
|
302
|
+
const bpp = bytesPerPixelForEncoding(encoding);
|
|
303
|
+
const stepDefault = w * (bpp > 0 ? bpp : 3);
|
|
304
|
+
const step =
|
|
305
|
+
msg["step"] !== undefined && msg["step"] !== null
|
|
306
|
+
? rosNumericField(msg["step"], "step")
|
|
307
|
+
: stepDefault;
|
|
308
|
+
const pngBuf = encodeRawRosImageToPng({
|
|
309
|
+
width: w,
|
|
310
|
+
height: h,
|
|
311
|
+
step,
|
|
312
|
+
encoding,
|
|
313
|
+
data: rawBuf,
|
|
314
|
+
});
|
|
315
|
+
return {
|
|
316
|
+
formatLabel: "png",
|
|
317
|
+
dataBase64: pngBuf.toString("base64"),
|
|
318
|
+
width: w,
|
|
319
|
+
height: h,
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
const rosFormat = String((msg["format"] as string) ?? "jpeg");
|
|
324
|
+
let buf = coerceRosImageDataToBuffer(msg["data"]);
|
|
325
|
+
if (rosFormat.toLowerCase().includes("zstd")) {
|
|
326
|
+
try {
|
|
327
|
+
buf = Buffer.from(zstdDecompress(buf));
|
|
328
|
+
} catch (e) {
|
|
329
|
+
throw new Error(
|
|
330
|
+
`CompressedImage zstd decompress failed: ${e instanceof Error ? e.message : String(e)}`,
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
const magic = sniffImageMagic(buf);
|
|
335
|
+
const hinted = mimeHintFromCompressedRosFormat(rosFormat);
|
|
336
|
+
const label = magic?.label ?? hinted?.label ?? "jpeg";
|
|
337
|
+
return {
|
|
338
|
+
formatLabel: label,
|
|
339
|
+
dataBase64: buf.toString("base64"),
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Decode a plain `sensor_msgs/CompressedImage` (e.g. from Zenoh CDR) to raw image bytes + MIME type.
|
|
345
|
+
* Decompresses zstd-wrapped payloads when `format` indicates it. Returns null if data is missing or invalid.
|
|
346
|
+
*/
|
|
347
|
+
export function bufferAndMimeFromCompressedImageMessage(
|
|
348
|
+
msg: Record<string, unknown>,
|
|
349
|
+
): { buf: Buffer; mime: string } | null {
|
|
350
|
+
try {
|
|
351
|
+
if (msg["data"] == null) return null;
|
|
352
|
+
const rosFormat = String((msg["format"] as string) ?? "jpeg");
|
|
353
|
+
let buf = coerceRosImageDataToBuffer(msg["data"]);
|
|
354
|
+
if (!buf || buf.length === 0) return null;
|
|
355
|
+
if (rosFormat.toLowerCase().includes("zstd")) {
|
|
356
|
+
buf = Buffer.from(zstdDecompress(buf));
|
|
357
|
+
}
|
|
358
|
+
if (!buf.length) return null;
|
|
359
|
+
const magic = sniffImageMagic(buf);
|
|
360
|
+
const hinted = mimeHintFromCompressedRosFormat(rosFormat);
|
|
361
|
+
const mime = magic?.mime ?? hinted?.mime ?? "image/jpeg";
|
|
362
|
+
return { buf, mime };
|
|
363
|
+
} catch {
|
|
364
|
+
return null;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/** Prefer magic bytes from decoded payload, then format label (png/jpeg/…). */
|
|
369
|
+
export function mimeTypeForSnapshotBase64(base64: string, formatLabel: string): string {
|
|
370
|
+
const magic = sniffImageMagic(Buffer.from(base64, "base64"));
|
|
371
|
+
return magic?.mime ?? mimeFromSnapshotLabel(formatLabel);
|
|
372
|
+
}
|