sil-openclaw 0.5.1 → 0.6.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 +42 -0
- package/README.md +16 -16
- package/SECURITY.md +3 -4
- package/dist/index.js +1 -1
- package/dist/lib/shopping-call.js +5 -6
- package/dist/lib/sil-client.js +20 -7
- package/dist/tools/catalog.js +78 -64
- package/openclaw.plugin.json +2 -2
- package/package.json +1 -1
- package/schema/PROVENANCE.md +1 -1
- package/schema/shopping-brief-create-request.schema.json +1 -1
- package/schema/shopping-brief-edit-request.schema.json +1 -1
- package/schema/shopping-brief-read-response.schema.json +1 -1
- package/schema/shopping-content-request.schema.json +92 -0
- package/schema/shopping-content-response.schema.json +172 -0
- package/schema/shopping-domain-get-request.schema.json +1 -1
- package/schema/shopping-domain-get-response.schema.json +233 -7
- package/schema/shopping-domain-search-request.schema.json +1 -1
- package/schema/shopping-domain-search-response.schema.json +40 -35
- package/schema/shopping-product-get-response.schema.json +6 -0
- package/schema/shopping-search-request.schema.json +1 -1
- package/schema/shopping-search-response.schema.json +6 -0
- package/sil-shopping/SKILL.md +134 -121
- package/schema/shopping-domain-create-request.schema.json +0 -160
- package/schema/shopping-domain-create-response.schema.json +0 -60
- package/sil-shopping/references/mint.md +0 -190
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,48 @@ release (`clawhub package publish --changelog`). See [README](./README.md#releas
|
|
|
10
10
|
|
|
11
11
|
## [Unreleased]
|
|
12
12
|
|
|
13
|
+
## [0.6.0] - 2026-10-08
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **`shopping_content` greps sil's library about a thing**: sil's own guides and the sources it
|
|
18
|
+
read, quoted verbatim with their author and link. Send a node and the terms: it reads every
|
|
19
|
+
document on the line through that node (the node, every kind it is, what sits beneath it and
|
|
20
|
+
every place above it) and answers whole passages within a token budget, every term first. A
|
|
21
|
+
quoted phrase is one term, `total` says how many passages hold a term, and `document` with
|
|
22
|
+
`from` reads any document on by part. No model in the path. The skill greps a leaf's library
|
|
23
|
+
before the first question to the buyer, and again when the buyer asks how or why; it says so
|
|
24
|
+
plainly when sil holds nothing.
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
|
|
28
|
+
- **Finding the place is three calls.** `shopping_domain_search` takes what the thing is
|
|
29
|
+
called and answers up to three leaves, best first: `path`, `name`, which of sil's words
|
|
30
|
+
`matched`, and `under`, every place above the leaf. `shopping_domain_get` reads that leaf's
|
|
31
|
+
specs and says how its products are bought (`record`: `specs` or `full`).
|
|
32
|
+
`shopping_search` is unchanged.
|
|
33
|
+
- **A place sil does not carry yet answers nothing.** The domain search returns no leaf for it,
|
|
34
|
+
and `shopping_domain_get` and `shopping_search` refuse it as `not carried`, before any spend.
|
|
35
|
+
The skill tells the buyer sil cannot sell it yet, it is in the pipeline, and stops: no
|
|
36
|
+
search, no other place, no web.
|
|
37
|
+
- **English to sil.** Every `q`, value, narrative and quoted reason the agent sends is English;
|
|
38
|
+
the skill translates the buyer's words on the way in and answers in their language.
|
|
39
|
+
- The skill's place-finding section is rewritten around the three calls.
|
|
40
|
+
|
|
41
|
+
### Removed
|
|
42
|
+
|
|
43
|
+
- `tree` and `about` from the search answer, and `guide` from the domain read.
|
|
44
|
+
|
|
45
|
+
## [0.5.2] - 2026-10-06
|
|
46
|
+
|
|
47
|
+
### Added
|
|
48
|
+
|
|
49
|
+
- **Every `shopping_*` call says who is calling**, as sil-api now requires: the
|
|
50
|
+
conversation (`sil-session-id`), the tool call (`sil-tool-call-id`, `sil-attempt` —
|
|
51
|
+
`2` on the one retry after a refreshed sign-in), the model (`sil-model`) and both
|
|
52
|
+
versions (`sil-openclaw-version`, `sil-plugin-version`). The tools are registered as
|
|
53
|
+
per-run factories to read these from the host. Never the chat-handle session key.
|
|
54
|
+
|
|
13
55
|
## [0.5.1] - 2026-09-30
|
|
14
56
|
|
|
15
57
|
### Changed
|
package/README.md
CHANGED
|
@@ -95,19 +95,19 @@ agent done — here's your checkout link, ready to pay:
|
|
|
95
95
|
|
|
96
96
|
## Turn your OpenClaw into your personal shopping expert
|
|
97
97
|
|
|
98
|
-
So far your *general* agent did the shopping. Go one step further, with **nothing to set up**: install the plugin and the agent you already have shops **any** niche like a specialist,
|
|
98
|
+
So far your *general* agent did the shopping. Go one step further, with **nothing to set up**: install the plugin and the agent you already have shops **any** niche like a specialist, getting sharper about *you* every session.
|
|
99
99
|
|
|
100
|
-
**Spec-Driven Shopping (SDS).** There is no setup step and no interview — just say what you want. The
|
|
100
|
+
**Spec-Driven Shopping (SDS).** There is no setup step and no interview — just say what you want. The plugin finds the node in sil's **domain graph** for what you're buying and reads the **specs** it is bought along (fit, gearing, geometry, the trade-offs) — what every request there is decomposed into. It decomposes what you asked, **learns your facts and taste as it goes** (your measurements, your budget, a brand you won't touch) — captured once, never re-asked — and recommends with a "why" that cites *what you asked*, *a fact it remembered*, and *a niche mechanic you'd never have named*.
|
|
101
101
|
|
|
102
|
-
**
|
|
102
|
+
**Every niche reads sil's own node, and keeps *you* across all of them:**
|
|
103
103
|
|
|
104
104
|
```text
|
|
105
105
|
you find me a road bike, ~€1500
|
|
106
106
|
|
|
107
|
-
agent
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
agent [shopping_domain_search "road bike" → shopping_domain_get]
|
|
108
|
+
Road bikes are bought on fit from height AND inseam, endurance
|
|
109
|
+
vs race geometry, and gearing. Two numbers I'll keep so I never
|
|
110
|
+
re-ask: your height and inseam.
|
|
111
111
|
|
|
112
112
|
you 178cm, 81cm inseam. Secondhand is fine
|
|
113
113
|
|
|
@@ -122,14 +122,14 @@ agent searched sil — endurance, 54cm for your fit, ~€1500:
|
|
|
122
122
|
|
|
123
123
|
you later — find me a backpacking tent for two, under €250
|
|
124
124
|
|
|
125
|
-
agent
|
|
126
|
-
|
|
127
|
-
returns rule carries straight over
|
|
125
|
+
agent [shopping_domain_search "backpacking tent" → shopping_domain_get]
|
|
126
|
+
Tents are bought on season rating, packed weight and floor
|
|
127
|
+
area… and your returns rule carries straight over.
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
-
> **You teach it once; it stays sharp.** How a
|
|
130
|
+
> **You teach it once; it stays sharp.** How a thing is bought comes from sil's domain graph, the same for every agent, and your own facts, taste and shopping jobs belong to your sil account rather than to one agent. Nothing to re-answer, and sharper every session.
|
|
131
131
|
|
|
132
|
-
**What it keeps on your machine: nothing of yours.** The plugin stores your sil credentials and its own configuration under `$SIL_DATA_DIR` (owner-only `0600`) and nothing else — no notes about you, no shopping jobs, no measurements. A shopping call reads that credential, rewrites it when sil refreshes it, and deletes it when the session is past refreshing. What your agent learns about you lives in your sil account, is **never pooled across users**, and is never used for training or aggregation.
|
|
132
|
+
**What it keeps on your machine: nothing of yours.** The plugin stores your sil credentials and its own configuration under `$SIL_DATA_DIR` (owner-only `0600`) and nothing else — no notes about you, no shopping jobs, no measurements. A shopping call reads that credential, rewrites it when sil refreshes it, and deletes it when the session is past refreshing. What your agent learns about you lives in your sil account, is **never pooled across users**, and is never used for training or aggregation. If an earlier version left a `shopper/` folder under that directory, nothing reads it any more and you can delete it.
|
|
133
133
|
|
|
134
134
|
---
|
|
135
135
|
|
|
@@ -160,9 +160,9 @@ for you; you just say what you want.
|
|
|
160
160
|
|
|
161
161
|
| Tool | What it does |
|
|
162
162
|
|---|---|
|
|
163
|
-
| `shopping_domain_search` |
|
|
164
|
-
| `
|
|
165
|
-
| `
|
|
163
|
+
| `shopping_domain_search` | Say what the thing is called, in your own words, and get back up to three leaves (buyable kinds of thing), best first: each with its name, which of sil's words matched, and `under` — the places above it. Empty when nothing fits, or when the best fit is an area sil does not carry yet. |
|
|
164
|
+
| `shopping_content` | Grep sil's own documents on the line through a node — the node, its kinds, beneath it and above it — by words, never by meaning. Answers whole passages within a token budget, every-word matches first, each with the words it matched; filled passages carry none. |
|
|
165
|
+
| `shopping_domain_get` | Read a leaf's specs: every key it is bought by with the operators, unit and allowed values each takes, plus its kinds, parts and how its products are bought (`record`). On a kind it also lists its `leaves`. A shelf or domain is refused as `not_a_leaf`; an area sil does not carry yet as `not_carried`. |
|
|
166
166
|
| `shopping_search` | Search one settled category, under the brief this conversation is working from. Send the brief's id, the domain, your own shopping words, how many products you want, the brief's own values for that category as `specs`, and `ship_to` — the label of one of your saved addresses, which localizes the search (your default one when it is left off) and rules no seller out. Products come back best-first with `fit` (what sil verified), their variants, a price range, and `webpage_info` where sil has not read the page yet. |
|
|
167
167
|
| `shopping_product_get` | Open the whole of what sil holds on 1–10 shortlisted variants: the description, the images, every key sil holds, and where each reading came from and when. |
|
|
168
168
|
| `shopping_offers` | Price 1–10 picked variants live, on your own terms: send the brief's id and the variant ids, and sil reads the rest — the brief's `seller` terms and price ceiling, your default address and your currency. It looks on the web for shops it does not hold yet, and each offer comes back with the price exactly as the page prints it, its currency, availability, the listing URL, the moment sil read it, and `seller_fit` — whether that seller ships to your address (`serviceable`, `not_serviceable` or `unknown`) and what it holds for each term on the brief. Shops in your currency and market come first. |
|
|
@@ -179,7 +179,7 @@ is the API's own 200 body handed over untouched.
|
|
|
179
179
|
The plugin ships one bundled skill — **`sil-shopping`** 🛒 — that your agent loads automatically the first time you express a shopping intent. You don't invoke it; it's the playbook that makes the tools work well together:
|
|
180
180
|
|
|
181
181
|
- **Routes intent to the right tool.** *"find me a keyboard"* → `shopping_search`, *"what does it cost?"* → `shopping_offers`, *"will it reach me?"* → `shopping_seller_get`, *"what was I shopping for?"* → `shopping_brief_read`, *"who am I?"* → `sil_whoami`, *"sign me up"* → `sil_register`.
|
|
182
|
-
- **Many niches,
|
|
182
|
+
- **Many niches, with no preparation.** A shopping intent runs the loop on whatever agent holds the plugin: it finds the place sil shelves what you're buying (`shopping_domain_search`), reads the specs it is bought along (`shopping_domain_get`), and decomposes every request along them — learning your facts and taste as it goes.
|
|
183
183
|
- **Recovers the right way.** Every tool reports a status; the skill follows that tool's own recovery hint — re-register, fix the query, or retry — instead of guessing a fix that won't work.
|
|
184
184
|
- **Keeps prices honest.** A price is dated only where sil dated it, so the skill re-reads an item's offers right before you buy and quotes the moment they were read.
|
|
185
185
|
- **Says what sil verified, and says the rest as what it is.** A key sil holds no value for is named as a gap, not passed off as a miss; a page sil has not read yet is quoted as the seller's own words; a seller sil knows nothing about keeps its place.
|
package/SECURITY.md
CHANGED
|
@@ -31,10 +31,9 @@ The plugin talks to these hosts and no others:
|
|
|
31
31
|
the published `@4gpts/sil` version: no token, no PII, bounded timeout, redirects
|
|
32
32
|
refused, silent on any failure.
|
|
33
33
|
|
|
34
|
-
The `shopping_*` tools are read-only, except `
|
|
35
|
-
|
|
36
|
-
`
|
|
37
|
-
account). On a `401`, every sil call refreshes once and retries once. A second
|
|
34
|
+
The `shopping_*` tools are read-only, except `shopping_brief_create` /
|
|
35
|
+
`shopping_brief_edit` / `shopping_profile_edit` (write the buyer's own brief and
|
|
36
|
+
profile under their sil account). On a `401`, every sil call refreshes once and retries once. A second
|
|
38
37
|
`401` or a dead refresh token clears `tokens.json`.
|
|
39
38
|
|
|
40
39
|
### Filesystem and credentials
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* sil OpenClaw plugin — entry point.
|
|
3
3
|
*
|
|
4
4
|
* A UCP commerce plugin for sil. It registers its real tool groups — the account
|
|
5
|
-
* tools (`sil_register`, `sil_whoami`, `sil_doctor`) and the
|
|
5
|
+
* tools (`sil_register`, `sil_whoami`, `sil_doctor`) and the ten `shopping_*`
|
|
6
6
|
* catalog tools — so they load in an OpenClaw host.
|
|
7
7
|
* There is no transport, no persistent service, and no background work at
|
|
8
8
|
* register time — `register()` is strictly synchronous and opens nothing.
|
|
@@ -18,12 +18,12 @@ function refused(status, result) {
|
|
|
18
18
|
* Every non-`ok` outcome comes back as its finished envelope, so no caller re-derives
|
|
19
19
|
* the taxonomy.
|
|
20
20
|
*/
|
|
21
|
-
export async function callRoute(api, call, args) {
|
|
21
|
+
export async function callRoute(api, call, args, caller) {
|
|
22
22
|
const stored = readTokens();
|
|
23
23
|
if (stored === null)
|
|
24
24
|
return refused("not_registered", notRegistered(call.name));
|
|
25
|
-
const first = await callShopping(getApiUrl(), stored.access_token, call, args);
|
|
26
|
-
const recovered = await refreshAndRetryOnce(first, (o) => o.kind === "unauthorized", (accessToken) => callShopping(getApiUrl(), accessToken, call, args));
|
|
25
|
+
const first = await callShopping(getApiUrl(), stored.access_token, call, args, caller, 1);
|
|
26
|
+
const recovered = await refreshAndRetryOnce(first, (o) => o.kind === "unauthorized", (accessToken) => callShopping(getApiUrl(), accessToken, call, args, caller, 2));
|
|
27
27
|
switch (recovered.kind) {
|
|
28
28
|
case "result":
|
|
29
29
|
if (recovered.refreshed)
|
|
@@ -51,9 +51,8 @@ function mapOutcome(api, call, outcome) {
|
|
|
51
51
|
api.logger.info(`${call.name}_invalid_request`, {});
|
|
52
52
|
return refused("invalid_request", refusal("invalid_request", outcome.message));
|
|
53
53
|
case "not_found":
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return refused(outcome.kind, refusal(outcome.kind, outcome.message, call.recovery?.[outcome.kind]));
|
|
54
|
+
api.logger.info(`${call.name}_not_found`, {});
|
|
55
|
+
return refused("not_found", refusal("not_found", outcome.message, call.recovery?.not_found));
|
|
57
56
|
case "forbidden":
|
|
58
57
|
return refused("forbidden", forbiddenResult(api, call.name, outcome.reason));
|
|
59
58
|
case "retryable":
|
package/dist/lib/sil-client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Typed HTTP wrappers for every endpoint the plugin calls — the two sil-web auth
|
|
3
|
-
* endpoints, the sil-api identity read and the
|
|
3
|
+
* endpoints, the sil-api identity read and the ten shopping routes — each returning
|
|
4
4
|
* a DISCRIMINATED UNION over the documented outcomes so the status taxonomy lives in
|
|
5
5
|
* exactly one place and the caller switches on `kind` rather than re-deriving meaning
|
|
6
6
|
* from `res.status` at every site.
|
|
@@ -84,7 +84,7 @@ const SEARCH_TIMEOUT_MS = 130_000;
|
|
|
84
84
|
const SEARCH_PATH = "/catalog/search";
|
|
85
85
|
export const requestTimeoutMs = (route) => route.path === SEARCH_PATH ? SEARCH_TIMEOUT_MS : REQUEST_TIMEOUT_MS;
|
|
86
86
|
/**
|
|
87
|
-
* Classify a shopping response. One classifier for all
|
|
87
|
+
* Classify a shopping response. One classifier for all ten routes — the contract
|
|
88
88
|
* gives them one error vocabulary, so a second one could only drift.
|
|
89
89
|
*
|
|
90
90
|
* The 200 gate is the whole of what the plugin owns: a plain object stating
|
|
@@ -102,8 +102,6 @@ function classifyShoppingResponse(status, body) {
|
|
|
102
102
|
return { kind: "forbidden", reason: extractForbiddenReason(body) };
|
|
103
103
|
if (status === 404)
|
|
104
104
|
return { kind: "not_found", message: extractApiError(body).message };
|
|
105
|
-
if (status === 409)
|
|
106
|
-
return { kind: "already_exists", message: extractApiError(body).message };
|
|
107
105
|
if (status !== 200)
|
|
108
106
|
return retryableFromBody(body);
|
|
109
107
|
const envelope = asRecord(body);
|
|
@@ -274,7 +272,7 @@ export async function fetchIdentity(silApiUrl, token) {
|
|
|
274
272
|
* The Bearer header is built HERE and never logged; the token travels only in the
|
|
275
273
|
* outbound request, never into the returned union.
|
|
276
274
|
*/
|
|
277
|
-
export async function callShopping(silApiUrl, token, route, args) {
|
|
275
|
+
export async function callShopping(silApiUrl, token, route, args, caller, attempt) {
|
|
278
276
|
const path = routePath(route, args);
|
|
279
277
|
if (typeof path !== "string") {
|
|
280
278
|
return {
|
|
@@ -285,19 +283,34 @@ export async function callShopping(silApiUrl, token, route, args) {
|
|
|
285
283
|
};
|
|
286
284
|
}
|
|
287
285
|
const url = `${stripTrailingSlash(silApiUrl)}${path}`;
|
|
286
|
+
const headers = { authorization: `Bearer ${token}`, ...callerHeaders(caller, attempt) };
|
|
288
287
|
let res;
|
|
289
288
|
try {
|
|
290
289
|
const timeoutMs = requestTimeoutMs(route);
|
|
291
290
|
res =
|
|
292
291
|
route.method === "GET"
|
|
293
|
-
? await getJson(url,
|
|
294
|
-
: await postJson(url, args,
|
|
292
|
+
? await getJson(url, headers, timeoutMs)
|
|
293
|
+
: await postJson(url, args, headers, timeoutMs);
|
|
295
294
|
}
|
|
296
295
|
catch {
|
|
297
296
|
return { kind: "retryable" };
|
|
298
297
|
}
|
|
299
298
|
return classifyShoppingResponse(res.status, await readJsonBody(res));
|
|
300
299
|
}
|
|
300
|
+
/** sil-api's rule for every caller header. A value outside it is dropped, not sent: fetch
|
|
301
|
+
* throws on a non-Latin-1 header before sending, and the catch would read that as retryable. */
|
|
302
|
+
const HEADER_VALUE = /^[\x21-\x7E]+$/;
|
|
303
|
+
function callerHeaders(caller, attempt) {
|
|
304
|
+
const headers = [
|
|
305
|
+
["sil-session-id", caller.sessionId],
|
|
306
|
+
["sil-tool-call-id", caller.toolCallId],
|
|
307
|
+
["sil-attempt", String(attempt)],
|
|
308
|
+
["sil-model", caller.model],
|
|
309
|
+
["sil-openclaw-version", caller.openclawVersion],
|
|
310
|
+
["sil-plugin-version", caller.pluginVersion],
|
|
311
|
+
];
|
|
312
|
+
return Object.fromEntries(headers.filter((h) => h[1] !== undefined && HEADER_VALUE.test(h[1])));
|
|
313
|
+
}
|
|
301
314
|
/**
|
|
302
315
|
* The route's path with its `:name` segment filled and its querystring built — or the
|
|
303
316
|
* name of the segment the arguments could not fill.
|
package/dist/tools/catalog.js
CHANGED
|
@@ -8,11 +8,12 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { requestSchema } from "../lib/artifacts.js";
|
|
10
10
|
import { readConfig } from "../lib/credentials.js";
|
|
11
|
-
import { wiringAdvisoryBlocks } from "../lib/host-wiring.js";
|
|
11
|
+
import { readHostVersion, wiringAdvisoryBlocks } from "../lib/host-wiring.js";
|
|
12
12
|
import { logSearchResults } from "../lib/search-results-log.js";
|
|
13
13
|
import { putSearchResult } from "../lib/search-results-store.js";
|
|
14
14
|
import { DOMAIN_GET_ROUTE, callRoute } from "../lib/shopping-call.js";
|
|
15
15
|
import { jsonResult } from "../lib/tool-result.js";
|
|
16
|
+
import { readInstalledVersion } from "../lib/version-advisory.js";
|
|
16
17
|
/** The tool whose page a paired client can pull back by `callId`. */
|
|
17
18
|
const SEARCH_TOOL = "shopping_search";
|
|
18
19
|
export const SHOPPING_TOOLS = [
|
|
@@ -21,65 +22,61 @@ export const SHOPPING_TOOLS = [
|
|
|
21
22
|
method: "GET",
|
|
22
23
|
path: "/catalog/domains",
|
|
23
24
|
query: ["q"],
|
|
24
|
-
label: "
|
|
25
|
-
description: "
|
|
26
|
-
+ "
|
|
27
|
-
+ "
|
|
28
|
-
+ "
|
|
29
|
-
+ "
|
|
30
|
-
+ "
|
|
31
|
-
+ "
|
|
32
|
-
+ "
|
|
33
|
-
+ "
|
|
25
|
+
label: "Find the place for a thing",
|
|
26
|
+
description: "The first call for any buy: send `q`, what the thing is called, in English — "
|
|
27
|
+
+ "translate the buyer first — and get up to three LEAVES — buyable kinds of thing — best first. Each has "
|
|
28
|
+
+ "its `path`, `name`, `matched` (which of sil's words your ask matched) and `under`, "
|
|
29
|
+
+ "the places above it, outermost first down to its parent, each with a `role`: `under`"
|
|
30
|
+
+ " tells same-named leaves apart. Choose from what the ask already says; when the "
|
|
31
|
+
+ "three share one kind, ask the buyer which. Take the path verbatim to "
|
|
32
|
+
+ "shopping_domain_get. An empty answer, or no leaf that fits, means sil does not carry"
|
|
33
|
+
+ " it yet: tell the buyer so — it is in the pipeline — and do not search; never shop "
|
|
34
|
+
+ "around.",
|
|
34
35
|
},
|
|
35
36
|
{
|
|
36
37
|
name: "shopping_domain_get",
|
|
37
38
|
...DOMAIN_GET_ROUTE,
|
|
38
|
-
label: "Read a
|
|
39
|
+
label: "Read a place's specs",
|
|
39
40
|
recovery: { not_found: "shopping_domain_search" },
|
|
40
|
-
description: "
|
|
41
|
-
+ "
|
|
42
|
-
+ "
|
|
43
|
-
+ "
|
|
44
|
-
+ "
|
|
45
|
-
+ "
|
|
46
|
-
+ "
|
|
47
|
-
+ "
|
|
48
|
-
+ "
|
|
49
|
-
+ "
|
|
50
|
-
+ "
|
|
51
|
-
+ "
|
|
52
|
-
+ " `
|
|
53
|
-
+ "
|
|
54
|
-
+ "
|
|
55
|
-
+ "
|
|
56
|
-
+ "
|
|
57
|
-
+ " to read the registry again in their words.",
|
|
41
|
+
description: "A leaf's specs, from a path shopping_domain_search answered. `name` is its one "
|
|
42
|
+
+ "English name and `labels` the market's own words for it — never send them. `specs` "
|
|
43
|
+
+ "are the keys it is bought by and `seller_specs` the seller terms it is bought with. "
|
|
44
|
+
+ "Each key's `description` says how it moves the fit: what it decides, what goes wrong"
|
|
45
|
+
+ " at either end, and how a buyer's fact becomes its value. Each key states its type, "
|
|
46
|
+
+ "operators, unit, any closed set, the `step` a number moves by, and `forms` — printed"
|
|
47
|
+
+ " forms mapped to the value. Send that key and one of those operators, never a "
|
|
48
|
+
+ "synonym you coined: `specs` go on the brief and to shopping_search, `seller_specs` "
|
|
49
|
+
+ "on the brief's `seller` domain, where shopping_offers reads them. variant_spec marks"
|
|
50
|
+
+ " the key an option is picked on (a size, a colour), answered under each product's "
|
|
51
|
+
+ "variants; product_spec tells one product from the next; `several`, a key held many-"
|
|
52
|
+
+ "valued — `eq`/`in` meet any, `neq`/`nin` none. `reach` says where each key comes "
|
|
53
|
+
+ "from, `kinds` every kind it is, `parts` what it has, `made_for` what a part or "
|
|
54
|
+
+ "consumable fits. `record` is how a leaf's products are bought: `specs` — on measures"
|
|
55
|
+
+ " alone; `full` — on measures and their record (purpose, story, pros and cons, for "
|
|
56
|
+
+ "and not for). On a kind, `leaves` lists what to choose from. A shelf or domain is "
|
|
57
|
+
+ "refused `not_a_leaf`, naming leaves; one sil does not carry yet, `not carried`.",
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
|
-
name: "
|
|
60
|
+
name: "shopping_content",
|
|
61
61
|
method: "POST",
|
|
62
|
-
path: "/catalog/
|
|
63
|
-
label: "
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
+ "
|
|
68
|
-
+ "
|
|
69
|
-
+ "
|
|
70
|
-
+ "
|
|
71
|
-
+ "
|
|
72
|
-
+ "
|
|
73
|
-
+ "
|
|
74
|
-
+ "
|
|
75
|
-
+ "
|
|
76
|
-
+ "
|
|
77
|
-
+ "
|
|
78
|
-
+ "
|
|
79
|
-
+ "
|
|
80
|
-
+ " unit, values or mark for your subtree; stating nothing new it answers `inherited:"
|
|
81
|
-
+ " true`, and a key naming a standing one binds and answers `bound_from`. A refusal"
|
|
82
|
-
+ " names the standing thing and the fix.",
|
|
62
|
+
path: "/catalog/content",
|
|
63
|
+
label: "Grep what sil holds about it",
|
|
64
|
+
recovery: { not_found: "shopping_domain_search" },
|
|
65
|
+
description: "Grep sil's library for a thing: its own guides and the sources it read, quoted "
|
|
66
|
+
+ "verbatim — label law, producers' technical sheets, writers on the trade. Send `path` (the "
|
|
67
|
+
+ "leaf you chose, or any place above it) and `q`, the terms: each word matched stemmed, "
|
|
68
|
+
+ "a \"quoted phrase\" as one term, never by meaning. It reads every document on the "
|
|
69
|
+
+ "line through that node, up to the root, and answers whole passages: every term "
|
|
70
|
+
+ "first, then more terms, then the densest. `total` says how many passages hold a "
|
|
71
|
+
+ "term; more than came back means grep narrower, add a phrase, or set `kinds`. Each "
|
|
72
|
+
+ "passage carries `part` and `of`: send `document` (its `id`) with `from` to read that "
|
|
73
|
+
+ "document on. `max_passages` and `max_tokens` bound the answer, the last passage cut "
|
|
74
|
+
+ "and marked `truncated`; an empty `matched` only fills the minimum. Search like an "
|
|
75
|
+
+ "agent: grep, read on, grep again in other words. Once the leaf is chosen, grep it "
|
|
76
|
+
+ "before your first question to the buyer, and again whenever they ask how or why. "
|
|
77
|
+
+ "A passage with `author` is that author's words — quote and name them, with `url`; "
|
|
78
|
+
+ "without it, the words are sil's. Empty `passages`: say sil holds nothing on it, "
|
|
79
|
+
+ "and never fill the gap from the open web.",
|
|
83
80
|
},
|
|
84
81
|
{
|
|
85
82
|
name: "shopping_brief_create",
|
|
@@ -98,8 +95,8 @@ export const SHOPPING_TOOLS = [
|
|
|
98
95
|
+ " optional first `domain` with `specs` writes what they have already said: a"
|
|
99
96
|
+ " domain path carries that domain's product specs, `seller` carries the seller"
|
|
100
97
|
+ " specs, and each spec is a key and an operator shopping_domain_get listed whose"
|
|
101
|
-
+ " `reason` quotes the buyer VERBATIM — their own words, or the measurement the"
|
|
102
|
-
+ "
|
|
98
|
+
+ " `reason` quotes the buyer VERBATIM, in English — their own words, or the measurement the"
|
|
99
|
+
+ " key's `description` converted — never a paraphrase and never a want they did not state. On"
|
|
103
100
|
+ " anything worn, the `gender` sil_whoami holds is a product spec in the registry's"
|
|
104
101
|
+ " own spelling — male → `gender eq mens`, female → `gender eq womens` — asked once"
|
|
105
102
|
+ " where the profile answers none or `other`, and never inferred. Everything after"
|
|
@@ -170,7 +167,7 @@ export const SHOPPING_TOOLS = [
|
|
|
170
167
|
+ " sil converts nothing. sil_whoami reads all of it back, so a fact written here"
|
|
171
168
|
+ " is one you never ask for again. What belongs to THIS job — a budget, a size for"
|
|
172
169
|
+ " these boots — is the brief's, through shopping_brief_edit: a measurement is the"
|
|
173
|
-
+ " buyer's, and the spec the domain's
|
|
170
|
+
+ " buyer's, and the spec the domain's key turns it into carries that"
|
|
174
171
|
+ " measurement as its `reason`.",
|
|
175
172
|
},
|
|
176
173
|
{
|
|
@@ -192,9 +189,9 @@ export const SHOPPING_TOOLS = [
|
|
|
192
189
|
+ " bound, never one it does not hold — money a decimal STRING (`\"300\"`, never 300)."
|
|
193
190
|
+ " The brief's `seller` specs are shopping_offers' to read off the brief, never on"
|
|
194
191
|
+ " the search. Keep the server's order, never re-rank; quote each variant's OWN"
|
|
195
|
-
+ " `price` with its size. `fit` answers the ask key by key: the value sil verified
|
|
196
|
-
+ " or \"unknown\" where it holds none — a gap to dig
|
|
197
|
-
+ " never a failed one."
|
|
192
|
+
+ " `price` with its size. `fit` answers the ask key by key: the value sil verified"
|
|
193
|
+
+ " (a list on a `several` key), or \"unknown\" where it holds none — a gap to dig"
|
|
194
|
+
+ " into with shopping_product_get, never a failed one."
|
|
198
195
|
+ " `host` is the shop; `printed` is that page's own pairs, never verified —"
|
|
199
196
|
+ " say \"the page says\". A `variants` entry with no option"
|
|
200
197
|
+ " values is a listing whose sizes sil has not read: say so — it prices like any"
|
|
@@ -209,7 +206,8 @@ export const SHOPPING_TOOLS = [
|
|
|
209
206
|
description: "The dossier: send 1–10 variant ids from a shopping_search answer and get"
|
|
210
207
|
+ " the whole of what sil holds for each — the title, the maker, the page's own"
|
|
211
208
|
+ " description, the images, every key sil holds for it (not only the ones you"
|
|
212
|
-
+ " asked about), and `sources` naming which site each
|
|
209
|
+
+ " asked about; a `several` key as a list), and `sources` naming which site each"
|
|
210
|
+
+ " reading came from and when."
|
|
213
211
|
+ " This is where a key the search answered \"unknown\" is dug out. A variant with no"
|
|
214
212
|
+ " option values is a listing whose sizes sil has not read, and its id opens here"
|
|
215
213
|
+ " like any other: the answer carries that page whole, so the sizes it prints are"
|
|
@@ -277,19 +275,35 @@ export const SHOPPING_TOOLS = [
|
|
|
277
275
|
* `ensureDataDir`'s `mkdirSync` does. It is deliberately eager — an unreadable artifact
|
|
278
276
|
* is a broken build, and failing loud at load beats a tool whose `parameters` the host
|
|
279
277
|
* has already published by the time anyone finds out.
|
|
278
|
+
*
|
|
279
|
+
* Each tool is a factory because the host hands the conversation and the model only to a
|
|
280
|
+
* factory, once per agent run; every call that run makes says who is calling.
|
|
280
281
|
*/
|
|
281
282
|
export function registerCatalogTools(api) {
|
|
282
|
-
|
|
283
|
-
|
|
283
|
+
const pluginVersion = readInstalledVersion();
|
|
284
|
+
const openclawVersion = readHostVersion(api) ?? undefined;
|
|
285
|
+
for (const tool of SHOPPING_TOOLS) {
|
|
286
|
+
const parameters = requestSchema(tool.name);
|
|
287
|
+
api.registerTool((ctx) => {
|
|
288
|
+
const { provider, modelId } = ctx.activeModel ?? {};
|
|
289
|
+
const run = {
|
|
290
|
+
pluginVersion,
|
|
291
|
+
...(openclawVersion !== undefined ? { openclawVersion } : {}),
|
|
292
|
+
...(ctx.sessionId ? { sessionId: ctx.sessionId } : {}),
|
|
293
|
+
...(provider && modelId ? { model: `${provider}/${modelId}` } : {}),
|
|
294
|
+
};
|
|
295
|
+
return defineTool(api, tool, parameters, run);
|
|
296
|
+
}, { name: tool.name });
|
|
297
|
+
}
|
|
284
298
|
}
|
|
285
|
-
function defineTool(api, tool) {
|
|
299
|
+
function defineTool(api, tool, parameters, run) {
|
|
286
300
|
return {
|
|
287
301
|
name: tool.name,
|
|
288
302
|
label: tool.label,
|
|
289
303
|
description: tool.description,
|
|
290
|
-
parameters
|
|
304
|
+
parameters,
|
|
291
305
|
async execute(callId, params) {
|
|
292
|
-
const called = await callRoute(api, tool, params);
|
|
306
|
+
const called = await callRoute(api, tool, params, { ...run, toolCallId: callId });
|
|
293
307
|
if (called.kind === "refused") {
|
|
294
308
|
if (tool.name === SEARCH_TOOL)
|
|
295
309
|
skipped(api, callId, `refused:${called.status}`);
|
package/openclaw.plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "sil",
|
|
3
3
|
"name": "sil",
|
|
4
4
|
"description": "Turn your OpenClaw into an expert shopping agent.",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.6.0",
|
|
6
6
|
"skills": ["./sil-shopping"],
|
|
7
7
|
"activation": {
|
|
8
8
|
"onCapabilities": ["tool"],
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"shopping_brief_create",
|
|
14
14
|
"shopping_brief_edit",
|
|
15
15
|
"shopping_brief_read",
|
|
16
|
-
"
|
|
16
|
+
"shopping_content",
|
|
17
17
|
"shopping_domain_get",
|
|
18
18
|
"shopping_domain_search",
|
|
19
19
|
"shopping_offers",
|
package/package.json
CHANGED
package/schema/PROVENANCE.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Where these twenty-two files come from
|
|
2
2
|
|
|
3
3
|
Copied verbatim from `sil-services` `packages/schemas/schema/`, commit
|
|
4
|
-
`
|
|
4
|
+
`11ef83e34f413bbd59f277348740c000c19d578a`. One request and one response artifact per
|
|
5
5
|
shopping tool; each is `JSON.stringify` of the TypeBox object the API serialises against.
|
|
6
6
|
|
|
7
7
|
**Re-copy, never hand-edit.** A local edit is drift the moment the sibling moves, and the
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"type": "string",
|
|
86
86
|
"minLength": 1,
|
|
87
87
|
"maxLength": 256,
|
|
88
|
-
"description": "Quotes the buyer's own words behind the spec,
|
|
88
|
+
"description": "Quotes the buyer's own words behind the spec, in English — translated, never a paraphrase, never a sentence they did not say; a spec derived from a measurement quotes the measurement. Reads them back before proposing to relax it."
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
91
|
"additionalProperties": false
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"type": "string",
|
|
91
91
|
"minLength": 1,
|
|
92
92
|
"maxLength": 256,
|
|
93
|
-
"description": "Quotes the buyer's own words behind the spec,
|
|
93
|
+
"description": "Quotes the buyer's own words behind the spec, in English — translated, never a paraphrase, never a sentence they did not say; a spec derived from a measurement quotes the measurement. Reads them back before proposing to relax it."
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
96
|
"additionalProperties": false
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"type": "string",
|
|
120
120
|
"minLength": 1,
|
|
121
121
|
"maxLength": 256,
|
|
122
|
-
"description": "Quotes the buyer's own words behind the spec,
|
|
122
|
+
"description": "Quotes the buyer's own words behind the spec, in English — translated, never a paraphrase, never a sentence they did not say; a spec derived from a measurement quotes the measurement. Reads them back before proposing to relax it."
|
|
123
123
|
}
|
|
124
124
|
},
|
|
125
125
|
"additionalProperties": false
|