docs: Add repository README, license, and visual assets

This commit is contained in:
Dhaval Gujar 2026-04-13 16:21:02 +05:30
parent 0071c142e1
commit c51dd1aeff
8 changed files with 293 additions and 49 deletions

202
LICENSE Normal file
View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright Espressif Systems
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1,26 @@
![esp-openclaw-node banner](docs/assets/esp-openclaw-node-banner.png)
# esp-openclaw-node
This repository contains the `esp-openclaw-node` ESP-IDF component, example applications, and documentation for running ESP32 boards as [OpenClaw Nodes](https://docs.openclaw.ai/nodes).
<a href="docs/assets/openclaw-gateway-esp-box-3-message-flow.png">
<img src="docs/assets/openclaw-gateway-esp-box-3-message-flow.png" alt="OpenClaw Gateway to ESP-BOX-3 message flow" width="900">
</a>
## Repository Layout
- `components/esp-openclaw-node/` The `esp-openclaw-node` ESP-IDF component that handles OpenClaw transport, pairing, reconnect, and command dispatch.
See the [Component README](./components/esp-openclaw-node/README.md) for more details on component internals.
- `examples/` Example applications for supported boards.
- `docs/` Getting-started and troubleshooting guides.
## Start Here
<a href="https://espressif.github.io/esp-launchpad/?flashConfigURL=https://espressif.github.io/esp-openclaw-node/launchpad.toml">
<img alt="Try it with ESP Launchpad" src="https://espressif.github.io/esp-launchpad/assets/try_with_launchpad.png" width="220" height="62">
</a>
1. Read [Getting Started](./docs/getting-started.md).
2. Choose an example from [Examples](./examples/README.md).
3. Use [Troubleshooting](./docs/troubleshooting.md) if the node pairs, connects, or advertises commands differently than expected.

View File

@ -514,7 +514,7 @@ Example `connect` from the node:
For explicit no-auth, the component omits the `auth` object entirely.
Successful response:
Successful `hello-ok` response:
```json
{
@ -523,13 +523,38 @@ Successful response:
"ok": true,
"payload": {
"type": "hello-ok",
"protocol": 3,
"server": {
"version": "2026.4.9",
"connId": "<gateway-connection-id>"
},
"auth": {
"deviceToken": "<gateway-issued-device-token>"
"deviceToken": "<node-device-token>",
"role": "node",
"scopes": [],
"deviceTokens": [
{
"deviceToken": "<bounded-operator-token>",
"role": "operator",
"scopes": [
"operator.approvals",
"operator.read",
"operator.talk.secrets",
"operator.write"
]
}
]
}
}
}
```
The gateway may return the primary node reconnect token in
`payload.auth.deviceToken` plus additional tokens in
`payload.auth.deviceTokens`.
This component persists and reuses only
`payload.auth.deviceToken`; it ignores any extra `payload.auth.deviceTokens` entries.
Example `node.invoke.request` from the gateway:
```json

View File

@ -32,16 +32,16 @@ typedef struct esp_openclaw_node *esp_openclaw_node_handle_t;
/** @brief Terminal and maintenance events emitted by the component. */
typedef enum {
ESP_OPENCLAW_NODE_EVENT_CONNECTED = 0, /**< Handshake completed and the session is ready. */
ESP_OPENCLAW_NODE_EVENT_CONNECTED = 0, /**< Handshake completed and the session is ready. */
ESP_OPENCLAW_NODE_EVENT_CONNECT_FAILED, /**< A connect attempt ended without reaching ready state. */
ESP_OPENCLAW_NODE_EVENT_DISCONNECTED, /**< An established session disconnected or was closed locally. */
ESP_OPENCLAW_NODE_EVENT_DISCONNECTED, /**< An established session disconnected or was closed locally. */
} esp_openclaw_node_event_t;
/** @brief Failure reasons surfaced on @ref ESP_OPENCLAW_NODE_EVENT_CONNECT_FAILED. */
typedef enum {
ESP_OPENCLAW_NODE_CONNECT_FAILURE_TRANSPORT_START_FAILED = 0, /**< Transport startup or local connect setup failed. */
ESP_OPENCLAW_NODE_CONNECT_FAILURE_CONNECTION_LOST, /**< The transport dropped before connect completed. */
ESP_OPENCLAW_NODE_CONNECT_FAILURE_AUTH_REJECTED, /**< The gateway rejected the auth material or signature. */
ESP_OPENCLAW_NODE_CONNECT_FAILURE_TRANSPORT_START_FAILED = 0, /**< Transport startup or local connect setup failed. */
ESP_OPENCLAW_NODE_CONNECT_FAILURE_CONNECTION_LOST, /**< The transport dropped before connect completed. */
ESP_OPENCLAW_NODE_CONNECT_FAILURE_AUTH_REJECTED, /**< The gateway rejected the auth material or signature. */
ESP_OPENCLAW_NODE_CONNECT_FAILURE_SESSION_FINALIZATION_FAILED, /**< `hello-ok` handling failed after initial auth acceptance. */
} esp_openclaw_node_connect_failure_reason_t;
@ -54,7 +54,7 @@ typedef struct {
/** @brief Disconnect reasons surfaced on @ref ESP_OPENCLAW_NODE_EVENT_DISCONNECTED. */
typedef enum {
ESP_OPENCLAW_NODE_DISCONNECTED_REASON_REQUESTED = 0, /**< Disconnect was requested locally. */
ESP_OPENCLAW_NODE_DISCONNECTED_REASON_REQUESTED = 0, /**< Disconnect was requested locally. */
ESP_OPENCLAW_NODE_DISCONNECTED_REASON_CONNECTION_LOST, /**< Disconnect followed a transport loss or remote close. */
} esp_openclaw_node_disconnected_reason_t;
@ -108,28 +108,28 @@ typedef void (*esp_openclaw_node_event_cb_t)(
* session once a route to the configured gateway exists.
*/
typedef struct {
const char *display_name; /**< Human-readable name advertised to the gateway. */
const char *platform; /**< Lower-level platform string included in auth and identity metadata. */
const char *device_family; /**< Higher-level device family string included in auth metadata. */
const char *client_id; /**< Protocol client identifier sent during connect. */
const char *client_mode; /**< Protocol client mode, typically `node` for these examples. */
const char *role; /**< Protocol role string expected by the gateway for this client. */
const char *model_identifier; /**< Optional model string such as `esp32c6` or `esp32s3`. */
const char *locale; /**< Optional locale metadata advertised to the gateway. */
const char *tls_common_name; /**< Optional TLS common-name override for certificate checks. */
const char *tls_cert_pem; /**< Optional PEM trust anchor for `wss://` connections. */
size_t tls_cert_len; /**< Length of @p tls_cert_pem in bytes, or `0` for NUL-terminated PEM. */
bool use_cert_bundle; /**< Use the ESP-IDF certificate bundle for server validation. */
bool skip_cert_common_name_check; /**< Skip common-name validation for TLS server certificates. */
esp_openclaw_node_event_cb_t event_cb; /**< Optional event callback invoked on the component task. */
void *event_user_ctx; /**< Opaque caller context passed back to @p event_cb. */
const char *display_name; /**< Human-readable name advertised to the gateway. */
const char *platform; /**< Lower-level platform string included in auth and identity metadata. */
const char *device_family; /**< Higher-level device family string included in auth metadata. */
const char *client_id; /**< Protocol client identifier sent during connect. */
const char *client_mode; /**< Protocol client mode, typically `node` for these examples. */
const char *role; /**< Protocol role string expected by the gateway for this client. */
const char *model_identifier; /**< Optional model string such as `esp32c6` or `esp32s3`. */
const char *locale; /**< Optional locale metadata advertised to the gateway. */
const char *tls_common_name; /**< Optional TLS common-name override for certificate checks. */
const char *tls_cert_pem; /**< Optional PEM trust anchor for `wss://` connections. */
size_t tls_cert_len; /**< Length of @p tls_cert_pem in bytes, or `0` for NUL-terminated PEM. */
bool use_cert_bundle; /**< Use the ESP-IDF certificate bundle for server validation. */
bool skip_cert_common_name_check; /**< Skip common-name validation for TLS server certificates. */
esp_openclaw_node_event_cb_t event_cb; /**< Optional event callback invoked on the component task. */
void *event_user_ctx; /**< Opaque caller context passed back to @p event_cb. */
} esp_openclaw_node_config_t;
/* Command Types */
/** @brief Structured command error returned to the gateway. */
typedef struct {
const char *code; /**< Stable machine-readable error code returned to the gateway. */
const char *code; /**< Stable machine-readable error code returned to the gateway. */
const char *message; /**< Human-readable error message returned to the gateway. */
} esp_openclaw_node_error_t;
@ -161,9 +161,9 @@ typedef esp_err_t (*esp_openclaw_node_command_handler_t)(
/** @brief Command registration entry passed to esp_openclaw_node_register_command(). */
typedef struct {
const char *name; /**< Command name advertised to the gateway, for example `wifi.status`. */
const char *name; /**< Command name advertised to the gateway, for example `wifi.status`. */
esp_openclaw_node_command_handler_t handler; /**< Command callback invoked for matching requests. */
void *context; /**< Opaque caller context passed to @p handler. */
void *context; /**< Opaque caller context passed to @p handler. */
} esp_openclaw_node_command_t;
/* Connect Input Types */
@ -171,26 +171,26 @@ typedef struct {
/** @brief Caller-chosen source for one connect attempt. */
typedef enum {
ESP_OPENCLAW_NODE_CONNECT_SOURCE_SAVED_SESSION = 0, /**< Reconnect with the persisted `{ gateway_uri, device_token }` session. */
ESP_OPENCLAW_NODE_CONNECT_SOURCE_SETUP_CODE, /**< Decode and use a setup code that contains the gateway URI and exactly one auth secret. */
ESP_OPENCLAW_NODE_CONNECT_SOURCE_GATEWAY_TOKEN, /**< Connect with an explicit shared gateway token. */
ESP_OPENCLAW_NODE_CONNECT_SOURCE_GATEWAY_PASSWORD, /**< Connect with an explicit shared gateway password. */
ESP_OPENCLAW_NODE_CONNECT_SOURCE_NO_AUTH, /**< Connect to a gateway that intentionally allows unauthenticated node access. */
ESP_OPENCLAW_NODE_CONNECT_SOURCE_SETUP_CODE, /**< Decode and use a setup code that contains the gateway URI and exactly one auth secret. */
ESP_OPENCLAW_NODE_CONNECT_SOURCE_GATEWAY_TOKEN, /**< Connect with an explicit shared gateway token. */
ESP_OPENCLAW_NODE_CONNECT_SOURCE_GATEWAY_PASSWORD, /**< Connect with an explicit shared gateway password. */
ESP_OPENCLAW_NODE_CONNECT_SOURCE_NO_AUTH, /**< Connect to a gateway that intentionally allows unauthenticated node access. */
} esp_openclaw_node_connect_source_t;
/**
* @brief Connect request submitted to @ref esp_openclaw_node_request_connect().
*
* Field requirements by source:
* - `SAVED_SESSION`: `gateway_uri = NULL`, `value = NULL`
* - `SETUP_CODE`: `gateway_uri = NULL`, `value = <setup code>`
* - `GATEWAY_TOKEN`: `gateway_uri = <ws://...|wss://...>`, `value = <token>`
* - `SAVED_SESSION`: `gateway_uri = NULL`, `value = NULL`
* - `SETUP_CODE`: `gateway_uri = NULL`, `value = <setup code>`
* - `GATEWAY_TOKEN`: `gateway_uri = <ws://...|wss://...>`, `value = <token>`
* - `GATEWAY_PASSWORD`: `gateway_uri = <ws://...|wss://...>`, `value = <password>`
* - `NO_AUTH`: `gateway_uri = <ws://...|wss://...>`, `value = NULL`
* - `NO_AUTH`: `gateway_uri = <ws://...|wss://...>`, `value = NULL`
*/
typedef struct {
esp_openclaw_node_connect_source_t source; /**< Caller-chosen source for this one connect attempt. */
const char *gateway_uri; /**< Explicit `ws://` or `wss://` URI when required by @p source. */
const char *value; /**< Setup code, token, or password when required by @p source. */
const char *gateway_uri; /**< Explicit `ws://` or `wss://` URI when required by @p source. */
const char *value; /**< Setup code, token, or password when required by @p source. */
} esp_openclaw_node_connect_request_t;
/* Lifecycle APIs */

View File

@ -23,21 +23,12 @@ not require a live OpenClaw gateway.
- setup-code validation for malformed or ambiguous payloads
- explicit connect-request argument validation for saved-session, token,
password, and no-auth sources
- auth-material selection, including the password-signature exclusion rule
- auth-material selection, including the rule that password auth is not included
in the device-signature payload
- destroy-path notification safety
- transport-state edge cases around challenge ping, clean close, and disconnect
rejection while still connecting
## Not covered here
The following still need integration or end-to-end tests:
- WebSocket handshake behavior against a live gateway
- end-to-end event delivery for `CONNECTED`, `CONNECT_FAILED`, and
`DISCONNECTED`
- persistence of `{ gateway_uri, device_token }` after a real `hello-ok`
- example-application REPL flows and Wi-Fi recovery behavior
## Build and run
Example for `esp32s3`:

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 854 KiB

View File

@ -13,12 +13,12 @@
* @brief Register the GPIO commands used by the generic ESP32 example.
*
* The helper adds the `gpio.mode`, `gpio.read`, and `gpio.write` commands.
* The documented v1 path is:
* The documented path is:
* - `gpio.mode` with `"input"`, `"output"`, or `"input_output"`
* - `gpio.read`
* - `gpio.write` after `"output"` or `"input_output"`
*
* Open-drain drive modes are intentionally not exposed in this v1 helper.
* Open-drain drive modes are intentionally not exposed in this helper.
*
* @param[in] node OpenClaw Node instance to extend.
*