@agenticros/core 0.5.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/LICENSE +192 -0
- package/README.md +88 -0
- package/dist/banner.d.ts +7 -0
- package/dist/banner.d.ts.map +1 -0
- package/dist/banner.js +25 -0
- package/dist/banner.js.map +1 -0
- package/dist/capabilities.d.ts +101 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +240 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/cmd-vel-twist.d.ts +9 -0
- package/dist/cmd-vel-twist.d.ts.map +1 -0
- package/dist/cmd-vel-twist.js +32 -0
- package/dist/cmd-vel-twist.js.map +1 -0
- package/dist/config.d.ts +1195 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +427 -0
- package/dist/config.js.map +1 -0
- package/dist/discovery.d.ts +113 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +141 -0
- package/dist/discovery.js.map +1 -0
- package/dist/find-robots-for.d.ts +85 -0
- package/dist/find-robots-for.d.ts.map +1 -0
- package/dist/find-robots-for.js +120 -0
- package/dist/find-robots-for.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/memory/factory.d.ts +18 -0
- package/dist/memory/factory.d.ts.map +1 -0
- package/dist/memory/factory.js +51 -0
- package/dist/memory/factory.js.map +1 -0
- package/dist/memory/index.d.ts +3 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +2 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/local/provider.d.ts +29 -0
- package/dist/memory/local/provider.d.ts.map +1 -0
- package/dist/memory/local/provider.js +202 -0
- package/dist/memory/local/provider.js.map +1 -0
- package/dist/memory/mem0/provider.d.ts +66 -0
- package/dist/memory/mem0/provider.d.ts.map +1 -0
- package/dist/memory/mem0/provider.js +310 -0
- package/dist/memory/mem0/provider.js.map +1 -0
- package/dist/memory/types.d.ts +91 -0
- package/dist/memory/types.d.ts.map +1 -0
- package/dist/memory/types.js +10 -0
- package/dist/memory/types.js.map +1 -0
- package/dist/mission-registry.d.ts +94 -0
- package/dist/mission-registry.d.ts.map +1 -0
- package/dist/mission-registry.js +123 -0
- package/dist/mission-registry.js.map +1 -0
- package/dist/mission-transcript-sink.d.ts +33 -0
- package/dist/mission-transcript-sink.d.ts.map +1 -0
- package/dist/mission-transcript-sink.js +76 -0
- package/dist/mission-transcript-sink.js.map +1 -0
- package/dist/mission.d.ts +281 -0
- package/dist/mission.d.ts.map +1 -0
- package/dist/mission.js +331 -0
- package/dist/mission.js.map +1 -0
- package/dist/planner/index.d.ts +84 -0
- package/dist/planner/index.d.ts.map +1 -0
- package/dist/planner/index.js +486 -0
- package/dist/planner/index.js.map +1 -0
- package/dist/robots.d.ts +133 -0
- package/dist/robots.d.ts.map +1 -0
- package/dist/robots.js +220 -0
- package/dist/robots.js.map +1 -0
- package/dist/topic-utils.d.ts +47 -0
- package/dist/topic-utils.d.ts.map +1 -0
- package/dist/topic-utils.js +136 -0
- package/dist/topic-utils.js.map +1 -0
- package/dist/transport/factory.d.ts +10 -0
- package/dist/transport/factory.d.ts.map +1 -0
- package/dist/transport/factory.js +40 -0
- package/dist/transport/factory.js.map +1 -0
- package/dist/transport/local/conversion.d.ts +30 -0
- package/dist/transport/local/conversion.d.ts.map +1 -0
- package/dist/transport/local/conversion.js +340 -0
- package/dist/transport/local/conversion.js.map +1 -0
- package/dist/transport/local/entities.d.ts +34 -0
- package/dist/transport/local/entities.d.ts.map +1 -0
- package/dist/transport/local/entities.js +108 -0
- package/dist/transport/local/entities.js.map +1 -0
- package/dist/transport/local/transport.d.ts +53 -0
- package/dist/transport/local/transport.d.ts.map +1 -0
- package/dist/transport/local/transport.js +344 -0
- package/dist/transport/local/transport.js.map +1 -0
- package/dist/transport/rosbridge/actions.d.ts +30 -0
- package/dist/transport/rosbridge/actions.d.ts.map +1 -0
- package/dist/transport/rosbridge/actions.js +61 -0
- package/dist/transport/rosbridge/actions.js.map +1 -0
- package/dist/transport/rosbridge/adapter.d.ts +29 -0
- package/dist/transport/rosbridge/adapter.d.ts.map +1 -0
- package/dist/transport/rosbridge/adapter.js +108 -0
- package/dist/transport/rosbridge/adapter.js.map +1 -0
- package/dist/transport/rosbridge/client.d.ts +55 -0
- package/dist/transport/rosbridge/client.d.ts.map +1 -0
- package/dist/transport/rosbridge/client.js +375 -0
- package/dist/transport/rosbridge/client.js.map +1 -0
- package/dist/transport/rosbridge/services.d.ts +14 -0
- package/dist/transport/rosbridge/services.d.ts.map +1 -0
- package/dist/transport/rosbridge/services.js +25 -0
- package/dist/transport/rosbridge/services.js.map +1 -0
- package/dist/transport/rosbridge/topics.d.ts +28 -0
- package/dist/transport/rosbridge/topics.d.ts.map +1 -0
- package/dist/transport/rosbridge/topics.js +59 -0
- package/dist/transport/rosbridge/topics.js.map +1 -0
- package/dist/transport/rosbridge/types.d.ts +87 -0
- package/dist/transport/rosbridge/types.d.ts.map +1 -0
- package/dist/transport/rosbridge/types.js +6 -0
- package/dist/transport/rosbridge/types.js.map +1 -0
- package/dist/transport/transport.d.ts +39 -0
- package/dist/transport/transport.d.ts.map +1 -0
- package/dist/transport/transport.js +2 -0
- package/dist/transport/transport.js.map +1 -0
- package/dist/transport/types.d.ts +100 -0
- package/dist/transport/types.d.ts.map +1 -0
- package/dist/transport/types.js +5 -0
- package/dist/transport/types.js.map +1 -0
- package/dist/transport/webrtc/signaling-client.d.ts +38 -0
- package/dist/transport/webrtc/signaling-client.d.ts.map +1 -0
- package/dist/transport/webrtc/signaling-client.js +161 -0
- package/dist/transport/webrtc/signaling-client.js.map +1 -0
- package/dist/transport/webrtc/signaling-types.d.ts +112 -0
- package/dist/transport/webrtc/signaling-types.d.ts.map +1 -0
- package/dist/transport/webrtc/signaling-types.js +8 -0
- package/dist/transport/webrtc/signaling-types.js.map +1 -0
- package/dist/transport/webrtc/transport.d.ts +67 -0
- package/dist/transport/webrtc/transport.d.ts.map +1 -0
- package/dist/transport/webrtc/transport.js +406 -0
- package/dist/transport/webrtc/transport.js.map +1 -0
- package/dist/transport/zenoh/adapter.d.ts +47 -0
- package/dist/transport/zenoh/adapter.d.ts.map +1 -0
- package/dist/transport/zenoh/adapter.js +296 -0
- package/dist/transport/zenoh/adapter.js.map +1 -0
- package/dist/transport/zenoh/cdr.d.ts +17 -0
- package/dist/transport/zenoh/cdr.d.ts.map +1 -0
- package/dist/transport/zenoh/cdr.js +170 -0
- package/dist/transport/zenoh/cdr.js.map +1 -0
- package/dist/transport/zenoh/keys.d.ts +21 -0
- package/dist/transport/zenoh/keys.d.ts.map +1 -0
- package/dist/transport/zenoh/keys.js +44 -0
- package/dist/transport/zenoh/keys.js.map +1 -0
- package/dist/transport-pool.d.ts +74 -0
- package/dist/transport-pool.d.ts.map +1 -0
- package/dist/transport-pool.js +135 -0
- package/dist/transport-pool.js.map +1 -0
- package/package.json +80 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Support. While redistributing the Work or
|
|
166
|
+
Derivative Works thereof, You may choose to offer, and charge a
|
|
167
|
+
fee for, acceptance of support, warranty, indemnity, or other
|
|
168
|
+
liability obligations and/or rights consistent with this License.
|
|
169
|
+
However, in accepting such obligations, You may act only on Your
|
|
170
|
+
own behalf and on Your sole responsibility, not on behalf of any
|
|
171
|
+
other Contributor, and only if You agree to indemnify, defend,
|
|
172
|
+
and hold each Contributor harmless for any liability incurred by,
|
|
173
|
+
or claims asserted against, such Contributor by reason of your
|
|
174
|
+
accepting any such warranty or support.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2025 PlaiPin
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
189
|
+
implied, including, without limitation, any warranties or conditions
|
|
190
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
191
|
+
PARTICULAR PURPOSE. See the License for the specific language governing
|
|
192
|
+
permissions and limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# @agenticros/core
|
|
2
|
+
|
|
3
|
+
Platform-agnostic ROS2 transport, types, and config schema. This package is the **single dependency** every AgenticROS adapter and skill imports.
|
|
4
|
+
|
|
5
|
+
It contains:
|
|
6
|
+
|
|
7
|
+
- The `RosTransport` interface every transport implementation satisfies.
|
|
8
|
+
- Four implementations: **Zenoh** (binary CDR), **Rosbridge** (WebSocket JSON), **WebRTC** (Mode C, cloud/remote), and **Local DDS** via `rclnodejs`.
|
|
9
|
+
- A Zod config schema (`AgenticROSConfig`) shared across all adapters.
|
|
10
|
+
- Topic-namespace utilities, capability registry, and a small long-term memory layer (`mem0` or local file backend).
|
|
11
|
+
|
|
12
|
+
You don't normally use it directly — you use one of the adapters that depends on it:
|
|
13
|
+
|
|
14
|
+
- [`agenticros`](https://github.com/agenticros/agenticros) — OpenClaw plugin
|
|
15
|
+
- [`@agenticros/claude-code`](https://github.com/agenticros/agenticros) — MCP server for Claude Code / Codex CLI / Claude Desktop
|
|
16
|
+
- [`@agenticros/gemini`](https://github.com/agenticros/agenticros) — Gemini CLI adapter
|
|
17
|
+
|
|
18
|
+
…or you build a **skill** for one of them.
|
|
19
|
+
|
|
20
|
+
## Building a skill
|
|
21
|
+
|
|
22
|
+
A skill is an npm package that registers tools the AI agent can call on your robot.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install --save @agenticros/core
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Your `package.json` declares an `agenticros` block:
|
|
29
|
+
|
|
30
|
+
```jsonc
|
|
31
|
+
{
|
|
32
|
+
"name": "agenticros-skill-myskill",
|
|
33
|
+
"main": "dist/index.js",
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "https://github.com/you/agenticros-skill-myskill.git"
|
|
37
|
+
},
|
|
38
|
+
"agenticros": {
|
|
39
|
+
"id": "myskill",
|
|
40
|
+
"displayName": "My Skill",
|
|
41
|
+
"description": "What this skill does in one sentence.",
|
|
42
|
+
"categories": ["navigation"],
|
|
43
|
+
"screenshots": ["docs/screenshot.png"],
|
|
44
|
+
"capabilities": [
|
|
45
|
+
{
|
|
46
|
+
"id": "do_thing",
|
|
47
|
+
"verb": "do",
|
|
48
|
+
"description": "Do the thing.",
|
|
49
|
+
"inputs": { "thing": "string" }
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@agenticros/core": "^0.5.0"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Your entry exports a `registerSkill` function:
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import type { RegisterSkill } from "@agenticros/core";
|
|
63
|
+
|
|
64
|
+
export const registerSkill: RegisterSkill = (api, _config, _context) => {
|
|
65
|
+
api.registerTool({
|
|
66
|
+
name: "do_thing",
|
|
67
|
+
label: "Do thing",
|
|
68
|
+
description: "Do the thing on the robot.",
|
|
69
|
+
parameters: /* @sinclair/typebox schema */,
|
|
70
|
+
async execute(_callId, params) {
|
|
71
|
+
// ...do the thing
|
|
72
|
+
return { ok: true };
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Submit your skill to the marketplace at **[skills.agenticros.com/submit](https://skills.agenticros.com/submit)** — sign in with GitHub, paste your repo URL, and your skill becomes installable with:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
npx agenticros skills install myskill
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
See the [skills contract & guide](https://github.com/agenticros/agenticros/blob/main/docs/skills.md) for the full reference.
|
|
85
|
+
|
|
86
|
+
## License
|
|
87
|
+
|
|
88
|
+
Apache-2.0
|
package/dist/banner.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface AgenticROSBannerOptions {
|
|
2
|
+
color?: boolean;
|
|
3
|
+
tagline?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function renderAgenticROSBanner(options?: AgenticROSBannerOptions): string;
|
|
6
|
+
export declare function agenticROSBannerLines(options?: AgenticROSBannerOptions): string[];
|
|
7
|
+
//# sourceMappingURL=banner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../src/banner.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,uBAAuB;IACtC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAeD,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,uBAA4B,GAAG,MAAM,CASpF;AAED,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,uBAA4B,GAAG,MAAM,EAAE,CAErF"}
|
package/dist/banner.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const ANSI_GREEN = "\x1b[92m";
|
|
2
|
+
const ANSI_YELLOW = "\x1b[93m";
|
|
3
|
+
const ANSI_DIM = "\x1b[2m";
|
|
4
|
+
const ANSI_RESET = "\x1b[0m";
|
|
5
|
+
const LOGO = String.raw `
|
|
6
|
+
_ _ _ ____ ___ ____
|
|
7
|
+
/ \ __ _ ___ _ __ | |_(_) ___ | _ \ / _ \/ ___|
|
|
8
|
+
/ _ \ / _` + "`" + String.raw ` |/ _ \ '_ \| __| |/ __|| |_) | | | \___ \
|
|
9
|
+
/ ___ \ (_| | __/ | | | |_| | (__ | _ <| |_| |___) |
|
|
10
|
+
/_/ \_\__, |\___|_| |_|\__|_|\___||_| \_\___/|____/
|
|
11
|
+
|___/`;
|
|
12
|
+
export function renderAgenticROSBanner(options = {}) {
|
|
13
|
+
const tagline = options.tagline ?? true;
|
|
14
|
+
if (!options.color) {
|
|
15
|
+
return tagline ? `${LOGO}\n AgenticROS - agentic AI for ROS-powered robots` : LOGO;
|
|
16
|
+
}
|
|
17
|
+
const coloredLogo = `${ANSI_GREEN}${LOGO}${ANSI_RESET}`;
|
|
18
|
+
return tagline
|
|
19
|
+
? `${coloredLogo}\n${ANSI_YELLOW} AgenticROS${ANSI_RESET} ${ANSI_DIM}- agentic AI for ROS-powered robots${ANSI_RESET}`
|
|
20
|
+
: coloredLogo;
|
|
21
|
+
}
|
|
22
|
+
export function agenticROSBannerLines(options = {}) {
|
|
23
|
+
return renderAgenticROSBanner(options).split("\n");
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=banner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner.js","sourceRoot":"","sources":["../src/banner.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,GAAG,UAAU,CAAC;AAC9B,MAAM,WAAW,GAAG,UAAU,CAAC;AAC/B,MAAM,QAAQ,GAAG,SAAS,CAAC;AAC3B,MAAM,UAAU,GAAG,SAAS,CAAC;AAE7B,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAA;;;YAGX,GAAG,GAAG,GAAG,MAAM,CAAC,GAAG,CAAA;;;cAGjB,CAAC;AAEf,MAAM,UAAU,sBAAsB,CAAC,UAAmC,EAAE;IAC1E,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC;IACxC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACnB,OAAO,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,oDAAoD,CAAC,CAAC,CAAC,IAAI,CAAC;IACtF,CAAC;IACD,MAAM,WAAW,GAAG,GAAG,UAAU,GAAG,IAAI,GAAG,UAAU,EAAE,CAAC;IACxD,OAAO,OAAO;QACZ,CAAC,CAAC,GAAG,WAAW,KAAK,WAAW,eAAe,UAAU,IAAI,QAAQ,sCAAsC,UAAU,EAAE;QACvH,CAAC,CAAC,WAAW,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,UAAmC,EAAE;IACzE,OAAO,sBAAsB,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capability registry — Phase 1.a/1.b of the AgenticROS strategy.
|
|
3
|
+
*
|
|
4
|
+
* A capability is a named, declarable verb an LLM can plan against
|
|
5
|
+
* (`follow_person`, `find_object`, `take_snapshot`, `drive_base`).
|
|
6
|
+
* It's deliberately shaped to match inter-agent protocol agent cards
|
|
7
|
+
* (ACP / A2A) so a skill's capability today is readable as an agent
|
|
8
|
+
* capability when Phase 4 lands — no rewrite required.
|
|
9
|
+
*
|
|
10
|
+
* Two kinds of capabilities:
|
|
11
|
+
* - **Intrinsic** — built into every AgenticROS deployment (drive_base,
|
|
12
|
+
* take_snapshot, measure_depth, list_topics, publish, subscribe). Lives
|
|
13
|
+
* in this file as `BUILTIN_CAPABILITIES`.
|
|
14
|
+
* - **Skill-declared** — comes from a skill package's `package.json`
|
|
15
|
+
* under `agenticrosSkill.capabilities[]` (or a sibling
|
|
16
|
+
* `capabilities.json`). Read at adapter startup.
|
|
17
|
+
*
|
|
18
|
+
* See: docs/strategy-ai-agents-plus-ros.md §4 (Phase 1).
|
|
19
|
+
*/
|
|
20
|
+
import type { AgenticROSConfig } from "./config.js";
|
|
21
|
+
/** Where a capability came from. */
|
|
22
|
+
export type CapabilitySource = {
|
|
23
|
+
kind: "builtin";
|
|
24
|
+
} | {
|
|
25
|
+
kind: "skill";
|
|
26
|
+
skillId: string;
|
|
27
|
+
package: string;
|
|
28
|
+
path?: string;
|
|
29
|
+
};
|
|
30
|
+
/** Implementation hint — in-process Node.js skill vs external ROS node. */
|
|
31
|
+
export type CapabilityImplementation = {
|
|
32
|
+
kind: "in_process";
|
|
33
|
+
} | {
|
|
34
|
+
kind: "external_ros_node";
|
|
35
|
+
package?: string;
|
|
36
|
+
launch?: string;
|
|
37
|
+
action?: string;
|
|
38
|
+
service?: string;
|
|
39
|
+
topic?: string;
|
|
40
|
+
msg_type?: string;
|
|
41
|
+
};
|
|
42
|
+
/** Typed input/output schema — minimal, JSON-Schema-ish. */
|
|
43
|
+
export interface CapabilityField {
|
|
44
|
+
type: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
optional?: boolean;
|
|
47
|
+
default?: unknown;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* One capability the agent can plan against.
|
|
51
|
+
*
|
|
52
|
+
* Required: `id`, `verb`, `description`.
|
|
53
|
+
* Everything else is optional so a skill can adopt the manifest
|
|
54
|
+
* incrementally.
|
|
55
|
+
*/
|
|
56
|
+
export interface Capability {
|
|
57
|
+
/** Unique identifier within a robot (e.g. `follow_person`, `find_object`). */
|
|
58
|
+
id: string;
|
|
59
|
+
/** High-level verb (`follow`, `find`, `navigate`, `manipulate`, `map`, `detect`). */
|
|
60
|
+
verb: string;
|
|
61
|
+
/** One-line, human-readable description. */
|
|
62
|
+
description: string;
|
|
63
|
+
/** Optional structured inputs the agent can fill. */
|
|
64
|
+
inputs?: Record<string, CapabilityField>;
|
|
65
|
+
/** Optional structured outputs the skill emits. */
|
|
66
|
+
outputs?: Record<string, CapabilityField>;
|
|
67
|
+
/** Free-form preconditions ("depthTopic available", "person detected"). */
|
|
68
|
+
preconditions?: string[];
|
|
69
|
+
/** Can be canceled mid-execution? Default true for intrinsic, varies for skills. */
|
|
70
|
+
interruptible?: boolean;
|
|
71
|
+
/** Owns the robot base (cmd_vel); other base-owning skills should yield. */
|
|
72
|
+
blocks_base?: boolean;
|
|
73
|
+
/** How the capability is implemented. Defaults to `in_process` when unset. */
|
|
74
|
+
implementation?: CapabilityImplementation;
|
|
75
|
+
/** Set by the registry, not the skill author. */
|
|
76
|
+
source?: CapabilitySource;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Built-in robot verbs — wrap the raw MCP tools in agent-meaningful
|
|
80
|
+
* capability names. The intrinsic set is intentionally small and stable
|
|
81
|
+
* so the agent's planning surface stays understandable as skill catalogs
|
|
82
|
+
* grow.
|
|
83
|
+
*/
|
|
84
|
+
export declare const BUILTIN_CAPABILITIES: readonly Capability[];
|
|
85
|
+
/**
|
|
86
|
+
* Read every capability declared by every skill referenced in `config`.
|
|
87
|
+
* Sources both `skillPaths` (directories with a package.json) and
|
|
88
|
+
* `skillPackages` (resolvable npm names).
|
|
89
|
+
*
|
|
90
|
+
* Failures are silent — a missing skill is logged elsewhere by the
|
|
91
|
+
* skill loader; this function focuses on returning the capabilities
|
|
92
|
+
* it can read.
|
|
93
|
+
*/
|
|
94
|
+
export declare function readSkillCapabilities(config: AgenticROSConfig): Capability[];
|
|
95
|
+
/**
|
|
96
|
+
* Return the full capability list: built-in robot verbs first, then
|
|
97
|
+
* skill-declared capabilities. This is the shape returned by
|
|
98
|
+
* `ros2_list_capabilities` across every adapter.
|
|
99
|
+
*/
|
|
100
|
+
export declare function listAllCapabilities(config: AgenticROSConfig): Capability[];
|
|
101
|
+
//# sourceMappingURL=capabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,oCAAoC;AACpC,MAAM,MAAM,gBAAgB,GACxB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvE,2EAA2E;AAC3E,MAAM,MAAM,wBAAwB,GAChC;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GACtB;IACE,IAAI,EAAE,mBAAmB,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEN,4DAA4D;AAC5D,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,8EAA8E;IAC9E,EAAE,EAAE,MAAM,CAAC;IACX,qFAAqF;IACrF,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACzC,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC1C,2EAA2E;IAC3E,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,oFAAoF;IACpF,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,8EAA8E;IAC9E,cAAc,CAAC,EAAE,wBAAwB,CAAC;IAC1C,iDAAiD;IACjD,MAAM,CAAC,EAAE,gBAAgB,CAAC;CAC3B;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,UAAU,EAkFrD,CAAC;AA+EF;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,gBAAgB,GAAG,UAAU,EAAE,CA+C5E;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,GAAG,UAAU,EAAE,CAE1E"}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capability registry — Phase 1.a/1.b of the AgenticROS strategy.
|
|
3
|
+
*
|
|
4
|
+
* A capability is a named, declarable verb an LLM can plan against
|
|
5
|
+
* (`follow_person`, `find_object`, `take_snapshot`, `drive_base`).
|
|
6
|
+
* It's deliberately shaped to match inter-agent protocol agent cards
|
|
7
|
+
* (ACP / A2A) so a skill's capability today is readable as an agent
|
|
8
|
+
* capability when Phase 4 lands — no rewrite required.
|
|
9
|
+
*
|
|
10
|
+
* Two kinds of capabilities:
|
|
11
|
+
* - **Intrinsic** — built into every AgenticROS deployment (drive_base,
|
|
12
|
+
* take_snapshot, measure_depth, list_topics, publish, subscribe). Lives
|
|
13
|
+
* in this file as `BUILTIN_CAPABILITIES`.
|
|
14
|
+
* - **Skill-declared** — comes from a skill package's `package.json`
|
|
15
|
+
* under `agenticrosSkill.capabilities[]` (or a sibling
|
|
16
|
+
* `capabilities.json`). Read at adapter startup.
|
|
17
|
+
*
|
|
18
|
+
* See: docs/strategy-ai-agents-plus-ros.md §4 (Phase 1).
|
|
19
|
+
*/
|
|
20
|
+
import { createRequire } from "node:module";
|
|
21
|
+
import { readFileSync, existsSync } from "node:fs";
|
|
22
|
+
import { join, resolve as resolvePath } from "node:path";
|
|
23
|
+
/**
|
|
24
|
+
* Built-in robot verbs — wrap the raw MCP tools in agent-meaningful
|
|
25
|
+
* capability names. The intrinsic set is intentionally small and stable
|
|
26
|
+
* so the agent's planning surface stays understandable as skill catalogs
|
|
27
|
+
* grow.
|
|
28
|
+
*/
|
|
29
|
+
export const BUILTIN_CAPABILITIES = [
|
|
30
|
+
{
|
|
31
|
+
id: "drive_base",
|
|
32
|
+
verb: "drive",
|
|
33
|
+
description: "Drive the robot base by publishing geometry_msgs/Twist to the configured cmd_vel topic. " +
|
|
34
|
+
"Linear/angular velocities are clamped server-side by safety.maxLinearVelocity / maxAngularVelocity.",
|
|
35
|
+
inputs: {
|
|
36
|
+
linear_x: { type: "number", description: "Forward velocity (m/s).", optional: true },
|
|
37
|
+
angular_z: { type: "number", description: "Yaw velocity (rad/s).", optional: true },
|
|
38
|
+
},
|
|
39
|
+
interruptible: true,
|
|
40
|
+
blocks_base: true,
|
|
41
|
+
source: { kind: "builtin" },
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: "take_snapshot",
|
|
45
|
+
verb: "see",
|
|
46
|
+
description: "Capture one frame from the configured camera topic. Returns base64-encoded JPEG/PNG.",
|
|
47
|
+
inputs: {
|
|
48
|
+
topic: { type: "string", description: "Camera topic (defaults to robot.cameraTopic).", optional: true },
|
|
49
|
+
},
|
|
50
|
+
outputs: {
|
|
51
|
+
format: { type: "string", description: "Image format (jpeg / png)." },
|
|
52
|
+
width: { type: "number", description: "Image width in pixels." },
|
|
53
|
+
height: { type: "number", description: "Image height in pixels." },
|
|
54
|
+
},
|
|
55
|
+
interruptible: true,
|
|
56
|
+
source: { kind: "builtin" },
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: "measure_depth",
|
|
60
|
+
verb: "measure",
|
|
61
|
+
description: "Sample the center of a depth image and return a distance in meters. " +
|
|
62
|
+
"Use to answer 'how far am I from X' style questions.",
|
|
63
|
+
inputs: {
|
|
64
|
+
topic: { type: "string", description: "Depth topic.", optional: true },
|
|
65
|
+
},
|
|
66
|
+
outputs: {
|
|
67
|
+
distance_m: { type: "number", description: "Distance in meters at image center." },
|
|
68
|
+
median_m: { type: "number", description: "Median distance across sampled pixels." },
|
|
69
|
+
},
|
|
70
|
+
interruptible: true,
|
|
71
|
+
source: { kind: "builtin" },
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: "list_topics",
|
|
75
|
+
verb: "introspect",
|
|
76
|
+
description: "List all reachable ROS 2 topics with their message types. Use for discovery when " +
|
|
77
|
+
"no other capability fits or to confirm what the robot currently publishes.",
|
|
78
|
+
interruptible: true,
|
|
79
|
+
source: { kind: "builtin" },
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: "publish_topic",
|
|
83
|
+
verb: "publish",
|
|
84
|
+
description: "Generic ROS 2 publish escape hatch. Prefer a named capability when one exists; " +
|
|
85
|
+
"publishes are safety-checked but otherwise unmediated.",
|
|
86
|
+
inputs: {
|
|
87
|
+
topic: { type: "string", description: "ROS 2 topic name." },
|
|
88
|
+
type: { type: "string", description: "ROS 2 message type (e.g. geometry_msgs/msg/Twist)." },
|
|
89
|
+
message: { type: "object", description: "Message payload matching the type schema." },
|
|
90
|
+
},
|
|
91
|
+
interruptible: true,
|
|
92
|
+
source: { kind: "builtin" },
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: "subscribe_once",
|
|
96
|
+
verb: "read",
|
|
97
|
+
description: "Read one message from a ROS 2 topic. Use for one-shot sensor reads or state checks.",
|
|
98
|
+
inputs: {
|
|
99
|
+
topic: { type: "string", description: "ROS 2 topic name." },
|
|
100
|
+
type: { type: "string", description: "ROS 2 message type (optional, often inferred).", optional: true },
|
|
101
|
+
timeout: { type: "number", description: "Milliseconds to wait (default 5000).", optional: true },
|
|
102
|
+
},
|
|
103
|
+
interruptible: true,
|
|
104
|
+
source: { kind: "builtin" },
|
|
105
|
+
},
|
|
106
|
+
];
|
|
107
|
+
function isCapabilityLike(value) {
|
|
108
|
+
if (!value || typeof value !== "object")
|
|
109
|
+
return false;
|
|
110
|
+
const v = value;
|
|
111
|
+
return typeof v.id === "string" && v.id.length > 0;
|
|
112
|
+
}
|
|
113
|
+
function normalizeCapability(raw, source) {
|
|
114
|
+
return {
|
|
115
|
+
id: raw.id,
|
|
116
|
+
verb: typeof raw.verb === "string" && raw.verb ? raw.verb : raw.id,
|
|
117
|
+
description: typeof raw.description === "string" ? raw.description : "",
|
|
118
|
+
...(raw.inputs ? { inputs: raw.inputs } : {}),
|
|
119
|
+
...(raw.outputs ? { outputs: raw.outputs } : {}),
|
|
120
|
+
...(raw.preconditions ? { preconditions: raw.preconditions } : {}),
|
|
121
|
+
...(typeof raw.interruptible === "boolean" ? { interruptible: raw.interruptible } : {}),
|
|
122
|
+
...(typeof raw.blocks_base === "boolean" ? { blocks_base: raw.blocks_base } : {}),
|
|
123
|
+
...(raw.implementation ? { implementation: raw.implementation } : { implementation: { kind: "in_process" } }),
|
|
124
|
+
source,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Read the `agenticros.capabilities[]` array from a skill's package.json.
|
|
129
|
+
* Returns `null` if the package doesn't declare a valid `agenticros` block.
|
|
130
|
+
*
|
|
131
|
+
* The legacy `agenticrosSkill: true | { capabilities }` form is NOT supported
|
|
132
|
+
* — every skill must use the single `agenticros` block as its source of truth.
|
|
133
|
+
*/
|
|
134
|
+
function readSkillManifestFromDir(packageDir) {
|
|
135
|
+
const pkgJsonPath = join(packageDir, "package.json");
|
|
136
|
+
if (!existsSync(pkgJsonPath))
|
|
137
|
+
return null;
|
|
138
|
+
let pkg;
|
|
139
|
+
try {
|
|
140
|
+
pkg = JSON.parse(readFileSync(pkgJsonPath, "utf-8"));
|
|
141
|
+
}
|
|
142
|
+
catch {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
if (!pkg.agenticros || typeof pkg.agenticros !== "object")
|
|
146
|
+
return null;
|
|
147
|
+
if (typeof pkg.agenticros.id !== "string")
|
|
148
|
+
return null;
|
|
149
|
+
const packageName = pkg.name ?? "unknown";
|
|
150
|
+
const skillId = pkg.agenticros.id;
|
|
151
|
+
const rawCaps = [];
|
|
152
|
+
const caps = pkg.agenticros.capabilities;
|
|
153
|
+
if (Array.isArray(caps)) {
|
|
154
|
+
for (const c of caps)
|
|
155
|
+
if (isCapabilityLike(c))
|
|
156
|
+
rawCaps.push(c);
|
|
157
|
+
}
|
|
158
|
+
return { packageName, skillId, rawCaps };
|
|
159
|
+
}
|
|
160
|
+
function resolvePackageDir(packageName, searchPaths) {
|
|
161
|
+
const req = createRequire(import.meta.url);
|
|
162
|
+
for (const base of [...searchPaths, process.cwd()]) {
|
|
163
|
+
try {
|
|
164
|
+
const entry = req.resolve(`${packageName}/package.json`, { paths: [base] });
|
|
165
|
+
return entry.replace(/\/package\.json$/, "");
|
|
166
|
+
}
|
|
167
|
+
catch {
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
try {
|
|
171
|
+
const entry = req.resolve(`${packageName}/package.json`);
|
|
172
|
+
return entry.replace(/\/package\.json$/, "");
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Read every capability declared by every skill referenced in `config`.
|
|
180
|
+
* Sources both `skillPaths` (directories with a package.json) and
|
|
181
|
+
* `skillPackages` (resolvable npm names).
|
|
182
|
+
*
|
|
183
|
+
* Failures are silent — a missing skill is logged elsewhere by the
|
|
184
|
+
* skill loader; this function focuses on returning the capabilities
|
|
185
|
+
* it can read.
|
|
186
|
+
*/
|
|
187
|
+
export function readSkillCapabilities(config) {
|
|
188
|
+
const out = [];
|
|
189
|
+
const seen = new Set();
|
|
190
|
+
const skillPaths = config.skillPaths ?? [];
|
|
191
|
+
const skillPackages = config.skillPackages ?? [];
|
|
192
|
+
for (const dir of skillPaths) {
|
|
193
|
+
const absDir = resolvePath(dir);
|
|
194
|
+
const manifest = readSkillManifestFromDir(absDir);
|
|
195
|
+
if (!manifest)
|
|
196
|
+
continue;
|
|
197
|
+
for (const raw of manifest.rawCaps) {
|
|
198
|
+
const key = `${manifest.skillId}:${raw.id}`;
|
|
199
|
+
if (seen.has(key))
|
|
200
|
+
continue;
|
|
201
|
+
seen.add(key);
|
|
202
|
+
out.push(normalizeCapability(raw, {
|
|
203
|
+
kind: "skill",
|
|
204
|
+
skillId: manifest.skillId,
|
|
205
|
+
package: manifest.packageName,
|
|
206
|
+
path: absDir,
|
|
207
|
+
}));
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
for (const pkgName of skillPackages) {
|
|
211
|
+
const packageDir = resolvePackageDir(pkgName, skillPaths.map((p) => resolvePath(p)));
|
|
212
|
+
if (!packageDir)
|
|
213
|
+
continue;
|
|
214
|
+
const manifest = readSkillManifestFromDir(packageDir);
|
|
215
|
+
if (!manifest)
|
|
216
|
+
continue;
|
|
217
|
+
for (const raw of manifest.rawCaps) {
|
|
218
|
+
const key = `${manifest.skillId}:${raw.id}`;
|
|
219
|
+
if (seen.has(key))
|
|
220
|
+
continue;
|
|
221
|
+
seen.add(key);
|
|
222
|
+
out.push(normalizeCapability(raw, {
|
|
223
|
+
kind: "skill",
|
|
224
|
+
skillId: manifest.skillId,
|
|
225
|
+
package: manifest.packageName,
|
|
226
|
+
path: packageDir,
|
|
227
|
+
}));
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return out;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Return the full capability list: built-in robot verbs first, then
|
|
234
|
+
* skill-declared capabilities. This is the shape returned by
|
|
235
|
+
* `ros2_list_capabilities` across every adapter.
|
|
236
|
+
*/
|
|
237
|
+
export function listAllCapabilities(config) {
|
|
238
|
+
return [...BUILTIN_CAPABILITIES, ...readSkillCapabilities(config)];
|
|
239
|
+
}
|
|
240
|
+
//# sourceMappingURL=capabilities.js.map
|