sil-openclaw 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/LICENSE +201 -0
- package/NOTICE +4 -0
- package/README.md +189 -0
- package/SECURITY.md +27 -0
- package/dist/index.js +43 -0
- package/dist/lib/config.js +88 -0
- package/dist/lib/credentials.js +144 -0
- package/dist/lib/pkce.js +67 -0
- package/dist/lib/poller.js +94 -0
- package/dist/lib/sil-client.js +1033 -0
- package/dist/lib/tool-result.js +16 -0
- package/dist/tools/catalog.js +630 -0
- package/dist/tools/identity.js +291 -0
- package/openclaw.plugin.json +71 -0
- package/package.json +97 -0
- package/skill/SKILL.md +62 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@4gpts/sil` are documented here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project adheres
|
|
5
|
+
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
Keep `## [Unreleased]` current as you work. `pnpm version <bump>` promotes it to a
|
|
8
|
+
dated release section, and `pnpm release` attaches that section to the ClawHub
|
|
9
|
+
release (`clawhub package publish --changelog`). See [README](./README.md#releasing).
|
|
10
|
+
|
|
11
|
+
## [Unreleased]
|
|
12
|
+
|
|
13
|
+
## [0.2.0] - 2026-06-11
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- **Renamed the published package.** npm: `@4gpts/sil` → **`sil-openclaw`** (unscoped —
|
|
18
|
+
npm has no implicit OpenClaw context, so the distribution name carries the suffix and
|
|
19
|
+
matches the repo). ClawHub: `@4gpts/sil` → **`sil`** (the registry is inherently
|
|
20
|
+
OpenClaw, so the `-openclaw` suffix is redundant; published under the `4gpts` org, from
|
|
21
|
+
`openclaw.plugin.json#id`). `release.mjs` now passes `--name` so the two names diverge by
|
|
22
|
+
design. The mistaken `@4gpts/sil` 0.1.0 is retired on both registries.
|
|
23
|
+
- README rewritten in the install-first style of the klodi OpenClaw adapter (Install,
|
|
24
|
+
Host prerequisites, Config keys, Files on disk, Tool surface, Bundled skill, Security).
|
|
25
|
+
|
|
26
|
+
## [0.1.0] - 2026-06-11
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- Identity tools `sil_register` and `sil_whoami`, and catalog tools `sil_search`
|
|
31
|
+
and `sil_product_get`, exposed to an OpenClaw host as the `sil` plugin.
|
|
32
|
+
- npm + ClawHub publishing: the `pnpm version <bump>` cadence (bump → sync manifest
|
|
33
|
+
→ test → commit → tag → push) and `pnpm release` / `release:dry`, which build a
|
|
34
|
+
clean `dist/`, pack one tarball, and publish the identical bytes to npm and
|
|
35
|
+
ClawHub. `package.json#version` is the single source of truth, mirrored into
|
|
36
|
+
`openclaw.plugin.json#version` and guarded by a version-parity test.
|
|
37
|
+
- Release hygiene shipped in the package: `CHANGELOG.md` (these notes, surfaced
|
|
38
|
+
to ClawHub via `clawhub package publish --changelog`) and a `SECURITY.md`
|
|
39
|
+
disclosure.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
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 reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and 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 Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/NOTICE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
```
|
|
2
|
+
███████╗██╗██╗
|
|
3
|
+
██╔════╝██║██║
|
|
4
|
+
███████╗██║██║
|
|
5
|
+
╚════██║██║██║
|
|
6
|
+
███████║██║███████╗
|
|
7
|
+
╚══════╝╚═╝╚══════╝
|
|
8
|
+
|
|
9
|
+
commerce, handled by your agent
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
**The shopping layer your agent runs for you.**
|
|
13
|
+
|
|
14
|
+
*You say what you want. Your agent searches the catalog, compares, and hands you a ready-to-buy link.*
|
|
15
|
+
*No store. No tabs. No forms.*
|
|
16
|
+
|
|
17
|
+
[](./LICENSE)
|
|
18
|
+
[](https://www.npmjs.com/package/sil-openclaw)
|
|
19
|
+
[](https://clawhub.com)
|
|
20
|
+
[](https://github.com/Context4GPTs/sil-openclaw)
|
|
21
|
+
[](https://github.com/Context4GPTs/sil-openclaw/commits)
|
|
22
|
+
|
|
23
|
+
**[Website](https://4gpts.com)** · **[Changelog](./CHANGELOG.md)** · **[Security](./SECURITY.md)** · **[Follow on X](https://x.com/4gpts)**
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
`sil-openclaw` is the [OpenClaw](https://openclaw.ai) plugin for **sil**. One install and your agent can shop the sil catalog on your behalf.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# ClawHub (recommended)
|
|
33
|
+
openclaw plugins install clawhub:sil
|
|
34
|
+
|
|
35
|
+
# npm
|
|
36
|
+
openclaw plugins install sil-openclaw
|
|
37
|
+
|
|
38
|
+
# Local checkout (dev / e2e)
|
|
39
|
+
openclaw plugins install /path/to/sil-openclaw
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### First run
|
|
43
|
+
|
|
44
|
+
Two lines and you're shopping:
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
1. Tell your agent: "register me on sil" (one browser sign-in, done)
|
|
48
|
+
2. Tell your agent: "find me a mechanical keyboard under $100"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The agent loads the bundled skill on first commerce intent and takes it from there — searching, comparing, pulling up product detail, and handing back ready-to-buy links.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## What sil is
|
|
56
|
+
|
|
57
|
+
**A commerce catalog built for agents, not browsers.** That's sil.
|
|
58
|
+
|
|
59
|
+
sil is a [UCP](https://github.com/universal-commerce-protocol/ucp) (Universal Commerce Protocol) commerce service. `sil-openclaw` wires it into your OpenClaw agent so it can hold a sil identity and shop the catalog for you — find products, compare prices and availability, pull up full detail, and surface a checkout link the moment you say *buy*. Powered by [4GPTs](https://4gpts.com).
|
|
60
|
+
|
|
61
|
+
Today it covers **identity and catalog** — registration plus search and product lookup. The rest of the UCP journey (cart, checkout, order, fulfillment) lands as those domains ship, and the same plugin grows with them.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## See it in action
|
|
66
|
+
|
|
67
|
+
**You, shopping through your agent — no store, no tabs:**
|
|
68
|
+
|
|
69
|
+
```text
|
|
70
|
+
you find me a mechanical keyboard under $100, tactile switches
|
|
71
|
+
|
|
72
|
+
agent searched the sil catalog — 3 strong matches:
|
|
73
|
+
|
|
74
|
+
1. Keychron V3 (Brown) $89 in stock
|
|
75
|
+
2. NuPhy Air75 V2 $99 in stock
|
|
76
|
+
3. Akko 3068B $72 low stock
|
|
77
|
+
|
|
78
|
+
want detail on any of these, or a checkout link?
|
|
79
|
+
|
|
80
|
+
you tell me about the keychron
|
|
81
|
+
|
|
82
|
+
agent Keychron V3 — QMK/VIA, hot-swappable, Brown tactile.
|
|
83
|
+
options: ABS / PBT keycaps · US / ISO layout
|
|
84
|
+
featured: PBT keycaps, US layout — $89, ships in 2 days
|
|
85
|
+
→ checkout: sil.4gpts.com/c/kc-v3-pbt-us
|
|
86
|
+
|
|
87
|
+
you perfect, send it
|
|
88
|
+
|
|
89
|
+
agent done — here's your checkout link, ready to pay:
|
|
90
|
+
sil.4gpts.com/c/kc-v3-pbt-us
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
> **You said three things. The agent did the shopping** — searched, compared, fetched the detail, and handed you a ready-to-buy link. No browser, no forms, no fourteen open tabs.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## How it works
|
|
98
|
+
|
|
99
|
+
sil lives at **two origins**, and the plugin talks to each for one job: **sil-web** is the auth authority (registration + token refresh); **sil-api** is the domain service (your identity and the catalog).
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
you your agent (OpenClaw) sil
|
|
103
|
+
───── ───────────────────── ─────
|
|
104
|
+
"register me ──▶ sil_register ──▶ sil-web PKCE sign-in +
|
|
105
|
+
on sil" token refresh
|
|
106
|
+
│ tokens.json (0600, on your disk)
|
|
107
|
+
▼
|
|
108
|
+
"find me a ──▶ sil_search ──▶ sil-api catalog
|
|
109
|
+
keyboard" sil_product_get search + lookup
|
|
110
|
+
│
|
|
111
|
+
◀── ranked products · prices · availability · checkout links ──┘
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Every tool returns the **same JSON envelope** — a `status` (`ok`, `not_registered`, `must_reregister`, `forbidden`, `invalid_request`, `retryable`) plus, on success, its payload — so your agent always knows whether to act, re-register, or retry. An expired access token is refreshed transparently against sil-web (one refresh, one retry); a confirmed-dead session clears your tokens and asks you to register again.
|
|
115
|
+
|
|
116
|
+
And **`register()` opens nothing** — no sockets, no timers, no background service. Every network and disk operation happens inside a tool call, so the plugin adds zero idle footprint to your host.
|
|
117
|
+
|
|
118
|
+
### Tool surface
|
|
119
|
+
|
|
120
|
+
Namespaced `sil_*` so they never collide with other plugins:
|
|
121
|
+
|
|
122
|
+
| Tool | What it does |
|
|
123
|
+
|---|---|
|
|
124
|
+
| `sil_register` | Start browser sign-in; returns an `auth_url`, polls in the background, stores credentials once you're done. |
|
|
125
|
+
| `sil_whoami` | Your identity (name, addresses), refreshing an expired token transparently. |
|
|
126
|
+
| `sil_search` | Ranked purchasable variants for a `query` / `category` / price range — each with `id`, `title`, `price`, `availability`, `checkout_url` — plus a pagination `cursor`. |
|
|
127
|
+
| `sil_product_get` | Resolve `ids: string[]` to full products in UCP shape (description, options, featured variant); misses come back in `not_found`. |
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Configuration
|
|
132
|
+
|
|
133
|
+
Optional, under `plugins.entries.sil.config` in `~/.openclaw/openclaw.json`. Resolution is **override → env → default**.
|
|
134
|
+
|
|
135
|
+
| Key | Env | Default | Origin |
|
|
136
|
+
|---|---|---|---|
|
|
137
|
+
| `sil_web_url` | `SIL_WEB_URL` | `https://sil.4gpts.com` | sil-web — auth (registration, refresh) |
|
|
138
|
+
| `sil_api_url` | `SIL_API_URL` | `https://sil-api.4gpts.com` | sil-api — identity + catalog |
|
|
139
|
+
|
|
140
|
+
If your host runs a restrictive tool profile (`coding`, `messaging`, `minimal`), let sil through and restart the gateway:
|
|
141
|
+
|
|
142
|
+
```json
|
|
143
|
+
{ "tools": { "profile": "coding", "alsoAllow": ["sil"] } }
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Use `alsoAllow`, not `allow` — `allow` runs *after* the profile filter and can't rescue a tool the profile already removed. The default `full` profile needs no patch.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Files on disk
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
$SIL_DATA_DIR/ # default: $XDG_DATA_HOME/sil, else ~/.local/share/sil
|
|
154
|
+
├── tokens.json # access + refresh token (mode 0600)
|
|
155
|
+
└── config.json # the registered user's identity
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
The PKCE verifier never touches disk — it lives only in memory for the length of a sign-in. Uninstalling the plugin never touches this directory; your data stays where you can see and delete it.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Security
|
|
163
|
+
|
|
164
|
+
The plugin holds your tokens and talks to sil on your behalf — you shouldn't have to take that on faith.
|
|
165
|
+
|
|
166
|
+
- **`register()` opens nothing.** No sockets, no timers, no daemon. All I/O is inside a tool call — zero idle footprint.
|
|
167
|
+
- **PKCE, verifier in memory only.** Sign-in uses PKCE; the verifier is never written to disk. Tokens and identity PII are never logged.
|
|
168
|
+
- **Credentials at `$SIL_DATA_DIR`, mode 0600.** The registration poll timer is bounded — it stops on the first terminal outcome or the session deadline.
|
|
169
|
+
- **Two origins, nothing else.** sil-web (auth) and sil-api (identity + catalog). No inbound webhook, no public URL, no third-party beacons.
|
|
170
|
+
- **No `child_process`, no native modules, no install scripts.** A minimal, auditable surface.
|
|
171
|
+
|
|
172
|
+
> **Full policy:** [SECURITY.md](./SECURITY.md) · machine-readable disclosure in [`openclaw.plugin.json#security`](./openclaw.plugin.json). **Found an issue?** DM [@4gpts on X](https://x.com/4gpts).
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Developing
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
pnpm install
|
|
180
|
+
pnpm build # pnpm clean && tsc → dist/
|
|
181
|
+
pnpm test # vitest (unit + integration)
|
|
182
|
+
pnpm typecheck # tsc --noEmit
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Releasing is two steps: `pnpm version <patch|minor|major>` (bump → sync manifest → cut changelog → test → tag → push), then `pnpm release` (build → pack once → npm `sil-openclaw` + ClawHub `sil`, the **same** tarball to both). Full guide in [`CLAUDE.md`](./CLAUDE.md#releasing); release notes in [`CHANGELOG.md`](./CHANGELOG.md). Adding a tool is three steps, enforced by a drift-guard test — see [`CLAUDE.md`](./CLAUDE.md#how-to-add-a-tool).
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
**Built by [4GPTs](https://4gpts.com)** · Apache-2.0 · [@4gpts on X](https://x.com/4gpts)
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Reporting a vulnerability
|
|
4
|
+
|
|
5
|
+
Report suspected vulnerabilities in `sil-openclaw` **privately — do not open a
|
|
6
|
+
public issue**. Contact [@4gpts on X](https://x.com/4gpts) (this mirrors
|
|
7
|
+
`openclaw.plugin.json#security.reportVulnerabilitiesTo`). We aim to acknowledge
|
|
8
|
+
within a few business days and will coordinate a fix and disclosure timeline.
|
|
9
|
+
|
|
10
|
+
## Supported versions
|
|
11
|
+
|
|
12
|
+
Only the latest `sil-openclaw` published to npm / ClawHub is supported. We do not
|
|
13
|
+
backport fixes or maintain old release lines — upgrade to the latest version.
|
|
14
|
+
|
|
15
|
+
## What this plugin touches
|
|
16
|
+
|
|
17
|
+
`register()` opens nothing — all I/O happens inside a tool's `execute()`. The
|
|
18
|
+
plugin talks only to its two configured sil origins (`sil_web_url` for auth /
|
|
19
|
+
token refresh, `sil_api_url` for identity + catalog reads) and stores
|
|
20
|
+
credentials owner-only (`0600`) under the sil data directory. The PKCE verifier
|
|
21
|
+
is held only in memory and never written to disk; tokens and identity PII are
|
|
22
|
+
never logged.
|
|
23
|
+
|
|
24
|
+
The authoritative, machine-readable disclosure ships in the package manifest —
|
|
25
|
+
`openclaw.plugin.json#security` — covering network endpoints, filesystem scope,
|
|
26
|
+
credentials on disk, and the `noNativeModules` / `noChildProcess` /
|
|
27
|
+
`noInstallScripts` guarantees. Review it before installing.
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sil OpenClaw plugin — entry point.
|
|
3
|
+
*
|
|
4
|
+
* A UCP commerce plugin for sil. It registers its real tool groups —
|
|
5
|
+
* identity (`sil_register`, `sil_whoami`) and catalog (`sil_search`,
|
|
6
|
+
* `sil_product_get`) — so they load in an OpenClaw host. There is no
|
|
7
|
+
* transport, no persistent service, and no background work at register
|
|
8
|
+
* time — `register()` is strictly synchronous and opens nothing.
|
|
9
|
+
*
|
|
10
|
+
* `register()` MUST stay synchronous and side-effect-free beyond
|
|
11
|
+
* registering tools and logging. The reference adapter
|
|
12
|
+
* (`klodi-plugin/adapters/openclaw`) carries a smoke gate precisely
|
|
13
|
+
* because an eager connection opened in `register()` once held the host's
|
|
14
|
+
* install subprocess event loop open and blocked gateway startup. Keep it
|
|
15
|
+
* that way: all I/O lives inside a tool's `execute()` — no timers, no
|
|
16
|
+
* sockets, no unawaited promises here.
|
|
17
|
+
*
|
|
18
|
+
* To add a tool, see `src/tools/identity.ts` (the reference group — it
|
|
19
|
+
* sets the `jsonResult` success shape and structured-error envelope every
|
|
20
|
+
* real tool follows).
|
|
21
|
+
*/
|
|
22
|
+
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
23
|
+
import { applyPluginConfigOverrides, getWebUrl, getWebUrlSource, getApiUrl, getApiUrlSource, } from "./lib/config.js";
|
|
24
|
+
import { registerCatalogTools } from "./tools/catalog.js";
|
|
25
|
+
import { registerIdentityTools } from "./tools/identity.js";
|
|
26
|
+
export default definePluginEntry({
|
|
27
|
+
id: "sil",
|
|
28
|
+
name: "sil",
|
|
29
|
+
description: "sil commerce plugin for OpenClaw — register on sil, read your identity,"
|
|
30
|
+
+ " and search and look up products in the sil catalog.",
|
|
31
|
+
register(api) {
|
|
32
|
+
applyPluginConfigOverrides(api.pluginConfig);
|
|
33
|
+
registerIdentityTools(api);
|
|
34
|
+
registerCatalogTools(api);
|
|
35
|
+
api.logger.info("sil_plugin_loaded", {
|
|
36
|
+
message: "sil plugin registered.",
|
|
37
|
+
api_url: getWebUrl(),
|
|
38
|
+
api_url_source: getWebUrlSource(),
|
|
39
|
+
sil_api_url: getApiUrl(),
|
|
40
|
+
sil_api_url_source: getApiUrlSource(),
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin-config resolution and overrides for the sil plugin.
|
|
3
|
+
*
|
|
4
|
+
* The plugin talks to TWO distinct sil services, each with its OWN origin
|
|
5
|
+
* resolved at call time from three sources, in order:
|
|
6
|
+
*
|
|
7
|
+
* sil-WEB (auth authority — claim + token refresh):
|
|
8
|
+
* 1. `api.pluginConfig.sil_web_url` 2. `SIL_WEB_URL` 3. `DEFAULT_WEB_URL`
|
|
9
|
+
* sil-API (commerce/identity reads — `sil_whoami`):
|
|
10
|
+
* 1. `api.pluginConfig.sil_api_url` 2. `SIL_API_URL` 3. `DEFAULT_API_URL`
|
|
11
|
+
*
|
|
12
|
+
* The two-origin reality is load-bearing (see the sil-whoami card): refresh
|
|
13
|
+
* is on sil-web (the only holder of the Auth0 client secret), the identity
|
|
14
|
+
* read is on sil-api (the Fastify domain service). They are different
|
|
15
|
+
* services and likely different origins, so they get DISTINCT keys — never
|
|
16
|
+
* overload `sil_web_url` for the sil-api read. Every future plugin tool that
|
|
17
|
+
* calls a sil-api domain (fulfillment/payments/loyalty) shares `sil_api_url`.
|
|
18
|
+
*
|
|
19
|
+
* This mirrors the reference adapter's `lib/paths.ts` override pattern
|
|
20
|
+
* (`klodi-plugin/adapters/openclaw`): the override and env routes coexist so
|
|
21
|
+
* tests can drive isolation via env (the cheapest knob) while deployments
|
|
22
|
+
* configure via OpenClaw's pluginConfig surface (the discoverable knob). No
|
|
23
|
+
* on-disk state, no filesystem paths.
|
|
24
|
+
*/
|
|
25
|
+
// sil-web origin (auth authority). Used by refreshStoredTokens / claim.
|
|
26
|
+
const DEFAULT_WEB_URL = "https://sil.4gpts.com";
|
|
27
|
+
// sil-api origin (domain reads). Pinned to the deployed sil-api Railway service
|
|
28
|
+
// at `sil-api.4gpts.com`. Deployments may still override via `sil_api_url` /
|
|
29
|
+
// `SIL_API_URL` (or point at the same origin if a single gateway fronts both
|
|
30
|
+
// services); tests + staging set it explicitly through the override chain.
|
|
31
|
+
const DEFAULT_API_URL = "https://sil-api.4gpts.com";
|
|
32
|
+
let _webUrl = null;
|
|
33
|
+
let _apiUrl = null;
|
|
34
|
+
export function setWebUrl(url) {
|
|
35
|
+
_webUrl = url === "" ? null : url;
|
|
36
|
+
}
|
|
37
|
+
export function getWebUrl() {
|
|
38
|
+
return _webUrl ?? process.env["SIL_WEB_URL"] ?? DEFAULT_WEB_URL;
|
|
39
|
+
}
|
|
40
|
+
export function getWebUrlSource() {
|
|
41
|
+
if (_webUrl !== null)
|
|
42
|
+
return "config";
|
|
43
|
+
if (process.env["SIL_WEB_URL"])
|
|
44
|
+
return "env";
|
|
45
|
+
return "default";
|
|
46
|
+
}
|
|
47
|
+
export function setApiUrl(url) {
|
|
48
|
+
_apiUrl = url === "" ? null : url;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Resolve the sil-API origin (the identity/commerce read service), distinct
|
|
52
|
+
* from `getWebUrl()` (sil-web). `sil_whoami` posts its identity read here.
|
|
53
|
+
*/
|
|
54
|
+
export function getApiUrl() {
|
|
55
|
+
return _apiUrl ?? process.env["SIL_API_URL"] ?? DEFAULT_API_URL;
|
|
56
|
+
}
|
|
57
|
+
export function getApiUrlSource() {
|
|
58
|
+
if (_apiUrl !== null)
|
|
59
|
+
return "config";
|
|
60
|
+
if (process.env["SIL_API_URL"])
|
|
61
|
+
return "env";
|
|
62
|
+
return "default";
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Apply plugin-scoped config overrides from `api.pluginConfig`. OpenClaw
|
|
66
|
+
* populates this object from `plugins.sil.config.*` after validation
|
|
67
|
+
* against `openclaw.plugin.json#configSchema`. Reading from `api.config`
|
|
68
|
+
* instead would silently ignore the user's overrides — that tree is the
|
|
69
|
+
* FULL OpenClawConfig, not the plugin's scoped block.
|
|
70
|
+
*
|
|
71
|
+
* Idempotent and empty-string-tolerant: an empty or missing value leaves
|
|
72
|
+
* the prior source in place rather than clobbering it to a blank.
|
|
73
|
+
*/
|
|
74
|
+
export function applyPluginConfigOverrides(pluginConfig) {
|
|
75
|
+
if (!pluginConfig)
|
|
76
|
+
return;
|
|
77
|
+
// Defensive runtime narrowing despite the typed parameter: the SDK's
|
|
78
|
+
// PluginAPI.pluginConfig is `Record<string, unknown>` because the SDK
|
|
79
|
+
// cannot know each plugin's schema, so callers cast to SilPluginConfig
|
|
80
|
+
// at the boundary. The cast trusts a JSON file on disk — keep the guard.
|
|
81
|
+
const { sil_web_url, sil_api_url } = pluginConfig;
|
|
82
|
+
if (typeof sil_web_url === "string" && sil_web_url.length > 0) {
|
|
83
|
+
setWebUrl(sil_web_url);
|
|
84
|
+
}
|
|
85
|
+
if (typeof sil_api_url === "string" && sil_api_url.length > 0) {
|
|
86
|
+
setApiUrl(sil_api_url);
|
|
87
|
+
}
|
|
88
|
+
}
|