sil-openclaw 0.8.2 → 0.8.4
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 +34 -0
- package/README.md +2 -3
- package/dist/lib/poller.js +0 -1
- package/dist/lib/sil-client.js +19 -14
- package/dist/tools/catalog.js +132 -38
- package/dist/tools/identity.js +4 -4
- package/openclaw.plugin.json +1 -1
- package/package.json +4 -8
- package/schema/PROVENANCE.md +3 -3
- package/schema/shopping-content-response.schema.json +5 -1
- package/schema/shopping-offers-response.schema.json +24 -0
- package/schema/shopping-search-request.schema.json +55 -1
- package/schema/shopping-search-response.schema.json +49 -7
- package/schema/shopping-user-forget-request.schema.json +1 -1
- package/schema/shopping-user-forget-response.schema.json +8 -8
- package/schema/shopping-user-read-request.schema.json +27 -29
- package/schema/shopping-user-read-response.schema.json +145 -54
- package/schema/shopping-user-remember-request.schema.json +95 -55
- package/schema/shopping-user-remember-response.schema.json +82 -3
- package/sil-shopping/SKILL.md +120 -147
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,40 @@ release (`clawhub package publish --changelog`). See [README](./README.md#releas
|
|
|
10
10
|
|
|
11
11
|
## [Unreleased]
|
|
12
12
|
|
|
13
|
+
## [0.8.4] - 2026-11-27
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- **What sil keeps about the buyer is four kinds, and a memory's place is its reach.** The persona
|
|
18
|
+
kind is gone: who the buyer is and how they like to be served is a memory placed at `product`,
|
|
19
|
+
read on every ask; a memory placed in a domain is its context there. A purchase is now `owned`:
|
|
20
|
+
had `now` or `before`, linked to sil's product when a search gave its id, started from and never
|
|
21
|
+
offered again unless the buyer is replacing it.
|
|
22
|
+
- **The skill is rebuilt around one order of a turn, by kind of ask.** A quick answer, a browse,
|
|
23
|
+
a decided buy and a considered buy each get their own turn. On a considered buy the agent
|
|
24
|
+
says where it stands before asking, the route and the search before searching, and what came
|
|
25
|
+
back after the products: the guide named, sil's own counts, what sil has not verified, and
|
|
26
|
+
where to buy.
|
|
27
|
+
- **Each tool's description carries the sentence for its own moment.** `shopping_user_remember`
|
|
28
|
+
shows a whole row to keep; `shopping_search` sends only the search the buyer was told;
|
|
29
|
+
`shopping_content` asks for the guide's name; `shopping_offers` for where to buy and why there.
|
|
30
|
+
|
|
31
|
+
## [0.8.3] - 2026-11-11
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
|
|
35
|
+
- **A tool called outside a turn reaches sil.** `tools.invoke` hands a tool no session and no
|
|
36
|
+
model, so sil-api refused every such call and the plugin read the refusal as sil being down.
|
|
37
|
+
An off-turn call now mints a session and names its model `none/sil-openclaw`; the screen
|
|
38
|
+
follows only the host's own conversation.
|
|
39
|
+
- **sil's refusals read as refusals.** Any 4xx but 401, 403 and 404 is `invalid_request`
|
|
40
|
+
carrying sil's message, not a retry; 408 and 429 stay retryable.
|
|
41
|
+
|
|
42
|
+
### Removed
|
|
43
|
+
|
|
44
|
+
- **The plugin's test suite.** Its proofs live in sil-stage; `pnpm version` runs the type
|
|
45
|
+
check alone. The package's contents are unchanged by this.
|
|
46
|
+
|
|
13
47
|
## [0.8.2] - 2026-10-30
|
|
14
48
|
|
|
15
49
|
### Fixed
|
package/README.md
CHANGED
|
@@ -96,7 +96,7 @@ for you; you just say what you want.
|
|
|
96
96
|
|
|
97
97
|
| Tool | What it does |
|
|
98
98
|
|---|---|
|
|
99
|
-
| `shopping_user_read` | Everything sil keeps about you —
|
|
99
|
+
| `shopping_user_read` | Everything sil keeps about you — what you told it, your measurements and preferences, what you own — each with what it gives you back. |
|
|
100
100
|
| `shopping_user_remember` | Keep what lasts, in the turn you say it, with "forget that" as the undo. |
|
|
101
101
|
| `shopping_user_forget` | Erase rows you name, or everything, on your word. |
|
|
102
102
|
| `shopping_brief_write` | Open a brief for a buy with requirements, or update one: a title, what you are after in your own words, specs by domain, decisions and the end of the job. |
|
|
@@ -145,11 +145,10 @@ The plugin holds your sil credentials and transacts on your behalf. The full dis
|
|
|
145
145
|
```bash
|
|
146
146
|
pnpm install
|
|
147
147
|
pnpm build # pnpm clean && tsc → dist/
|
|
148
|
-
pnpm test # vitest (unit + integration)
|
|
149
148
|
pnpm typecheck # tsc --noEmit
|
|
150
149
|
```
|
|
151
150
|
|
|
152
|
-
Releasing is two steps: `pnpm version <patch|minor|major>` (bump → sync manifest → cut changelog →
|
|
151
|
+
Releasing is two steps: `pnpm version <patch|minor|major>` (bump → sync manifest → cut changelog → tag → push), then `pnpm release` (build → pack → **stage** on npm as `sil-openclaw` → a maintainer approves it with 2FA under npmjs.com's Staged Packages → the same contents to ClawHub as `@4gpts/sil`, only once npm serves them byte-identical). Staged publishing needs no 2FA-bypass token, which npm is retiring from publishing. Release notes in [`CHANGELOG.md`](https://github.com/Context4GPTs/sil-openclaw/blob/main/CHANGELOG.md).
|
|
153
152
|
|
|
154
153
|
---
|
|
155
154
|
|
package/dist/lib/poller.js
CHANGED
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* - The interval timer is cleared on EVERY exit path (terminal, deadline,
|
|
15
15
|
* explicit `stop()`). The architect's "poll loop leak" risk: a missed
|
|
16
16
|
* `clearInterval` leaks a timer per `sil_register` call in a reused process.
|
|
17
|
-
* `vi.getTimerCount()` must be 0 after any exit — enforced by poller.test.ts.
|
|
18
17
|
*
|
|
19
18
|
* The loop is deliberately GENERIC over the step result: it knows only `done`.
|
|
20
19
|
* The claim-status → done mapping lives in the caller (the tool), keeping the
|
package/dist/lib/sil-client.js
CHANGED
|
@@ -39,10 +39,12 @@
|
|
|
39
39
|
* 200 { status, name, country?, currency?, gender?, language?, addresses } → ok
|
|
40
40
|
* 401 → unauthorized (→ refresh)
|
|
41
41
|
* 403 { error: user_not_provisioned | principal_mismatch } → forbidden (terminal)
|
|
42
|
-
*
|
|
42
|
+
* 408 / 429 → retryable
|
|
43
|
+
* any other 4xx → invalid_request (sil's message)
|
|
43
44
|
* 5xx / network / abort → retryable
|
|
44
45
|
*
|
|
45
|
-
* Shopping routes:
|
|
46
|
+
* Shopping routes: 404 → not_found; 408/429 → retryable; any other 4xx but 401/403 →
|
|
47
|
+
* invalid_request, carrying sil's message: sil refused THIS request, so it is not retried.
|
|
46
48
|
*
|
|
47
49
|
* THE SHOPPING WIRE IS NOT MIRRORED HERE. Each tool's request shape is the committed
|
|
48
50
|
* artifact under `schema/`, registered as the tool's own `parameters`; each 200 body is
|
|
@@ -88,16 +90,18 @@ const REQUEST_TIMEOUT_MS = 45_000;
|
|
|
88
90
|
* source, and a second opinion here would be the copy that drifts from it.
|
|
89
91
|
*/
|
|
90
92
|
function classifyShoppingResponse(status, body) {
|
|
91
|
-
// 426: sil refuses a plugin older than it accepts; its message says to update.
|
|
92
|
-
if (status === 400 || status === 426) {
|
|
93
|
-
return { kind: "invalid_request", message: extractApiError(body).message };
|
|
94
|
-
}
|
|
95
93
|
if (status === 401)
|
|
96
94
|
return { kind: "unauthorized" };
|
|
97
95
|
if (status === 403)
|
|
98
96
|
return { kind: "forbidden", reason: extractForbiddenReason(body) };
|
|
99
97
|
if (status === 404)
|
|
100
98
|
return { kind: "not_found", message: extractApiError(body).message };
|
|
99
|
+
if (status === 408 || status === 429)
|
|
100
|
+
return retryableFromBody(body);
|
|
101
|
+
// 400, 409 `full`, 410 retired, 426 plugin too old: the same call again cannot pass.
|
|
102
|
+
if (status >= 400 && status < 500) {
|
|
103
|
+
return { kind: "invalid_request", message: extractApiError(body).message };
|
|
104
|
+
}
|
|
101
105
|
if (status !== 200)
|
|
102
106
|
return retryableFromBody(body);
|
|
103
107
|
const envelope = asRecord(body);
|
|
@@ -120,8 +124,7 @@ function classifyShoppingResponse(status, body) {
|
|
|
120
124
|
* non-polling terminal `invalid_request` (fail fast) rather than riding the
|
|
121
125
|
* keep-polling `not_found` path and spinning for the full deadline.
|
|
122
126
|
*
|
|
123
|
-
* Pure and exported — this is the highest-risk subtle branch
|
|
124
|
-
* isolation (sil-client.test.ts).
|
|
127
|
+
* Pure and exported — this is the highest-risk subtle branch.
|
|
125
128
|
*/
|
|
126
129
|
export function classifyClaimResponse(status, body) {
|
|
127
130
|
if (status === 409)
|
|
@@ -180,7 +183,9 @@ export function classifyRefreshResponse(status, body) {
|
|
|
180
183
|
* on STATUS (and, for 200, the body shape) — never on `res.ok`:
|
|
181
184
|
* 401 → unauthorized (the ONLY refresh trigger)
|
|
182
185
|
* 403 → forbidden (terminal; carries user_not_provisioned/principal_mismatch)
|
|
183
|
-
*
|
|
186
|
+
* 408 / 429 → retryable (an edge proxy's "try again")
|
|
187
|
+
* other 4xx → invalid_request (sil's message; a missing identity header is a 400)
|
|
188
|
+
* 5xx / other non-200 → retryable
|
|
184
189
|
* 200 → unwrap the envelope `result` and narrow to {name, …}; a 200
|
|
185
190
|
* that yields no usable identity (no `name`) is `retryable`, NEVER `ok`
|
|
186
191
|
* (the anti-false-green guard — a partial/garbage 200, or the current
|
|
@@ -191,15 +196,15 @@ export function classifyRefreshResponse(status, body) {
|
|
|
191
196
|
* auth-branch bug in this flow.
|
|
192
197
|
*/
|
|
193
198
|
export function classifyIdentityResponse(status, body) {
|
|
194
|
-
// Not `invalid_request`: IdentityOutcome has no such variant; the tool surfaces it as one.
|
|
195
|
-
if (status === 426)
|
|
196
|
-
return { kind: "refused", message: extractApiError(body).message };
|
|
197
199
|
if (status === 401)
|
|
198
200
|
return { kind: "unauthorized" };
|
|
199
201
|
if (status === 403)
|
|
200
202
|
return { kind: "forbidden", reason: extractForbiddenReason(body) };
|
|
201
|
-
if (status
|
|
203
|
+
if (status === 408 || status === 429)
|
|
202
204
|
return { kind: "retryable" };
|
|
205
|
+
if (status >= 400 && status < 500) {
|
|
206
|
+
return { kind: "invalid_request", message: extractApiError(body).message };
|
|
207
|
+
}
|
|
203
208
|
if (status !== 200)
|
|
204
209
|
return { kind: "retryable" };
|
|
205
210
|
const identity = extractIdentity(body);
|
|
@@ -489,7 +494,7 @@ function extractForbiddenReason(body) {
|
|
|
489
494
|
return typeof error === "string" && error.length > 0 ? error : "forbidden";
|
|
490
495
|
}
|
|
491
496
|
/**
|
|
492
|
-
* Build the `retryable` outcome for a non-200, non-
|
|
497
|
+
* Build the `retryable` outcome for a 408/429 or a non-200, non-4xx response, attaching
|
|
493
498
|
* the failed catalog `source` (+ a `detail` carrying the upstream cause) ONLY when
|
|
494
499
|
* the 5xx body is a real `source_unavailable` SourceError that names a source.
|
|
495
500
|
*
|
package/dist/tools/catalog.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* The twelve `shopping_*` tools, 1:1 with the sil-api user, brief and catalog routes.
|
|
3
3
|
* Bodies cross verbatim: sil's answer is the agent's answer, and the screen's.
|
|
4
4
|
*/
|
|
5
|
+
import { randomUUID } from "node:crypto";
|
|
5
6
|
import { keepAnswer } from "../lib/answers.js";
|
|
6
7
|
import { requestSchema } from "../lib/artifacts.js";
|
|
7
8
|
import { readHostVersion, wiringAdvisoryBlocks } from "../lib/host-wiring.js";
|
|
@@ -14,9 +15,19 @@ export const SHOPPING_TOOLS = [
|
|
|
14
15
|
method: "POST",
|
|
15
16
|
path: "/user/read",
|
|
16
17
|
label: "Read what sil keeps about the buyer",
|
|
17
|
-
description: "Know the buyer: everything kept about them is here, never in your own memory files."
|
|
18
|
-
+ "
|
|
19
|
-
+ "
|
|
18
|
+
description: "Know the buyer: everything kept about them is here, never in your own memory files. At"
|
|
19
|
+
+ " the start of a conversation read with no `place`: the rows for everywhere, who they are"
|
|
20
|
+
+ " and how they like to be served. Once the domain read gives the ask's path, read again"
|
|
21
|
+
+ " with it as `place`: the rows for everywhere, then the rows at or under it, elsewhere in"
|
|
22
|
+
+ " its domain and above it, nearest first; `held` counts by domain what the answer left"
|
|
23
|
+
+ " out. `all: true` reads every row, newest first, as far as one answer holds: when they"
|
|
24
|
+
+ " ask what sil keeps, show what it answers and say what `held` counts. What it answers is"
|
|
25
|
+
+ " never asked again; say a row when you use it. A row on how they like to be served"
|
|
26
|
+
+ " overrides the usual flow: ask nothing the pick can be made without; pick, say in a"
|
|
27
|
+
+ " clause the one thing it assumes, give the shop. What they own `now` is where you start"
|
|
28
|
+
+ " (read a linked `product` for its specs) and is never offered unless they are replacing"
|
|
29
|
+
+ " it. A `likes` row is a lean on the search, never a want, and its `from` names what"
|
|
30
|
+
+ " it was read from. A price row is `value` with `unit` its currency; money is in the"
|
|
20
31
|
+ " minor unit: €130 is 13000.",
|
|
21
32
|
},
|
|
22
33
|
{
|
|
@@ -24,20 +35,61 @@ export const SHOPPING_TOOLS = [
|
|
|
24
35
|
method: "POST",
|
|
25
36
|
path: "/user/remember",
|
|
26
37
|
label: "Keep what lasts about the buyer",
|
|
27
|
-
description: "Keep what will matter next time about the buyer
|
|
28
|
-
+ "
|
|
29
|
-
+ "
|
|
30
|
-
+ "
|
|
31
|
-
+ "
|
|
32
|
-
+ "
|
|
33
|
-
+ "
|
|
38
|
+
description: "Keep what will matter next time about the buyer in the turn you learn it, the first"
|
|
39
|
+
+ " included, before any search, even mid-ask and even when the ask's own terms use it"
|
|
40
|
+
+ " too. This is the only place the buyer is kept: \"remember this\" means this call,"
|
|
41
|
+
+ " not a note or memory file. A one-off wish for this buy rides on its calls instead."
|
|
42
|
+
+ " What they tell about themselves is a memory row: as they said it, with what it means"
|
|
43
|
+
+ " for their buys, one to three sentences, never labelled, a health condition too."
|
|
44
|
+
+ " Every row is read alone, weeks later, by a conversation that never saw this one: its"
|
|
45
|
+
+ " words name the products and the thing in full (\"Loves the 1Zpresso K-Ultra and the"
|
|
46
|
+
+ " Timemore C5 ESP Pro hand grinders because both grind consistently.\", at the"
|
|
47
|
+
+ " grinders' own path), never"
|
|
48
|
+
+ " \"both\", \"it\" or \"they\" for something the row does not name. Its"
|
|
49
|
+
+ " place is its reach: what they value, how they spend and how they like to be served"
|
|
50
|
+
+ " hold on every ask, at `product`; their experience or situation in one domain is"
|
|
51
|
+
+ " placed at that domain's path, read first even when nothing is being bought: never"
|
|
52
|
+
+ " `product` for what concerns one domain. Send whole rows: `{ rows: [{ kind:"
|
|
53
|
+
+ " \"memory\", text: \"Would rather spend"
|
|
54
|
+
+ " less than get something fancy, so value comes before features.\", place:"
|
|
55
|
+
+ " \"product\", gives_back: \"the cheaper good pick comes first\", source: \"told\" }]"
|
|
56
|
+
+ " }`. The other kinds, same row: `kind: \"owned\"` for what they have or had, with"
|
|
57
|
+
+ " `name`, `has` (\"now\", or \"before\" once they no longer have it), `since` or"
|
|
58
|
+
+ " `until` when said (a year, month or day), and `product`, sil's id: search it by name"
|
|
59
|
+
+ " first and link the one that is it, else keep it by `name` (the answer's `tips` says"
|
|
60
|
+
+ " how to resend it); `kind: \"preference\"`"
|
|
61
|
+
+ " with `subject`, `op`, `value` and"
|
|
62
|
+
+ " `reason`, a limit a search can hold, on a spec or the price (a price in the minor"
|
|
63
|
+
+ " unit with `unit` its currency: €130 is 13000), or a liking: `op: \"likes\"` only when"
|
|
64
|
+
+ " they say they like it (owning is not liking), its `subject` a spec the domain read"
|
|
65
|
+
+ " listed, by its key, `brand`, `price`, or `product` for the products themselves,"
|
|
66
|
+
+ " `reason`,"
|
|
67
|
+
+ " what made them like it in their words, and `from`, sil's ids of what they own and"
|
|
68
|
+
+ " like. A product they say they love is three rows in one keep, each at the path its"
|
|
69
|
+
+ " search gave: its `owned` row, one liking with `subject: \"product\"`, `value` the"
|
|
70
|
+
+ " products' names and `from` their ids, and a memory of why."
|
|
71
|
+
+ " A keep naming two or more products answers `shared`, what they all hold: only if"
|
|
72
|
+
+ " they like them, keep what explains why as a liking, `from` all, source \"agent\","
|
|
73
|
+
+ " and say it back;"
|
|
74
|
+
+ " a quality no spec holds (consistent, sturdy) is a memory, never a liking: sil refuses"
|
|
75
|
+
+ " a liking on one; `kind: \"measurement\"` with `what`,"
|
|
76
|
+
+ " `value` and `unit`. `place` is the path the domain read gave, a wider node for a wider"
|
|
77
|
+
+ " place, `product` for everywhere; `source` on every row: \"told\", or \"agent\" for"
|
|
78
|
+
+ " what you inferred. A place that is no node is refused with the nearest sil holds and"
|
|
79
|
+
+ " those beneath it: keep at one of them. A `product` sil does not hold is refused: keep"
|
|
80
|
+
+ " the row by its `name` alone. `full` (300 rows) names the oldest to forget first: say"
|
|
81
|
+
+ " so and ask. A refused keep: fix what the refusal names and resend every row of that"
|
|
82
|
+
+ " keep, never a subset. Never \"got it\" before it answers `ok`. Once sil answers `ok`,"
|
|
83
|
+
+ " say in one line what you kept, what it gives them next time (its `gives_back`), and"
|
|
84
|
+
+ " that \"forget that\" undoes it; a keep is never silent.",
|
|
34
85
|
},
|
|
35
86
|
{
|
|
36
87
|
name: "shopping_user_forget",
|
|
37
88
|
method: "POST",
|
|
38
89
|
path: "/user/forget",
|
|
39
90
|
label: "Erase what sil keeps, on the buyer's word",
|
|
40
|
-
description: "Erase what sil keeps, only after saying what goes and the buyer saying yes
|
|
91
|
+
description: "Erase what sil keeps, only after saying what goes and the buyer saying yes: \"forget"
|
|
92
|
+
+ " that\" is its row's `ids`, \"forget everything\" is `all: true`.",
|
|
41
93
|
},
|
|
42
94
|
{
|
|
43
95
|
name: "shopping_brief_write",
|
|
@@ -62,7 +114,9 @@ export const SHOPPING_TOOLS = [
|
|
|
62
114
|
path: "/catalog/domains",
|
|
63
115
|
query: ["query"],
|
|
64
116
|
label: "Place the thing",
|
|
65
|
-
description: "Place the thing the buyer named: the leaves sil holds for it."
|
|
117
|
+
description: "Place the thing the buyer named: the leaves sil holds for it. Send the kind of thing"
|
|
118
|
+
+ " (\"trail shoes\"), never a brand or a model. Search the leaf; while the buyer has not"
|
|
119
|
+
+ " chosen between leaves of one kind, read and search the kind above them.",
|
|
66
120
|
},
|
|
67
121
|
{
|
|
68
122
|
name: "shopping_domain_get",
|
|
@@ -83,10 +137,14 @@ export const SHOPPING_TOOLS = [
|
|
|
83
137
|
path: "/catalog/content",
|
|
84
138
|
label: "Read what sil holds about it",
|
|
85
139
|
recovery: { not_found: "shopping_domain_search" },
|
|
86
|
-
description: "
|
|
87
|
-
+ " buyer's own
|
|
88
|
-
+ "
|
|
89
|
-
+ "
|
|
140
|
+
description: "Read sil's guides before you teach or ask: the passages sil holds on a place that bear"
|
|
141
|
+
+ " on `about`. Send the buyer's own words as `about` (clarity, texture, quiet). Each"
|
|
142
|
+
+ " passage carries its `title`, `author`, `heading`, `publish_date` and `url`: when you"
|
|
143
|
+
+ " teach from one, name it by its `title` or `author`, its `heading` when it has one,"
|
|
144
|
+
+ " never \"the guide\" alone, and its date when it has one. A taste the buyer gives"
|
|
145
|
+
+ " (springy, grippy) goes through here before you search: the passage gives the route;"
|
|
146
|
+
+ " a taste is no spec. A question's why comes from"
|
|
147
|
+
+ " here or from a spec's `why`. Nothing held: say so, never fill it from the web.",
|
|
90
148
|
},
|
|
91
149
|
{
|
|
92
150
|
name: "shopping_search",
|
|
@@ -94,17 +152,38 @@ export const SHOPPING_TOOLS = [
|
|
|
94
152
|
path: "/catalog/search",
|
|
95
153
|
label: "Search sil's products",
|
|
96
154
|
recovery: { not_found: "shopping_brief_read" },
|
|
97
|
-
description: "Search once per settled ask
|
|
98
|
-
+ "
|
|
99
|
-
+ "
|
|
100
|
-
+ "
|
|
101
|
-
+ "
|
|
102
|
-
+ "
|
|
103
|
-
+ "
|
|
104
|
-
+ "
|
|
105
|
-
+ "
|
|
106
|
-
+ "
|
|
107
|
-
+ "
|
|
155
|
+
description: "Search once per settled ask. On a considered buy, first say the route you think best"
|
|
156
|
+
+ " and why, then the search, part by part, each with its why; send exactly what you said."
|
|
157
|
+
+ " `domain` is the leaf, or the kind above while the buyer has not chosen between its"
|
|
158
|
+
+ " leaves: your own route is a lean until they take it, so the search still covers the"
|
|
159
|
+
+ " other kind. `specs` `{ spec, op, value }` from the domain read, each a want the buyer"
|
|
160
|
+
+ " said or sil keeps and none of your own. Filter only on what they measured or named (a"
|
|
161
|
+
+ " size, a width, what it is for, a cap): a quality word (springy, grippy, light) is never"
|
|
162
|
+
+ " a filter, even where a spec exists for it, since every product whose maker says nothing"
|
|
163
|
+
+ " about it would drop off the page. A brand they named is the `brand` spec on"
|
|
164
|
+
+ " every kind, never the `query`; on a kind, `leaf` with `in` or `nin` rules a leaf in or"
|
|
165
|
+
+ " out. `price` is the range `{ min?, max?, currency }`;"
|
|
166
|
+
+ " money is in the minor unit: €130 is 13000; \"around\" a sum is up to a fifth over it,"
|
|
167
|
+
+ " never a floor under it, and you say so; a kept cap is their figure, not the wider one."
|
|
168
|
+
+ " `query` holds only the buyer's own word for what no spec holds, a name, a model or a use:"
|
|
169
|
+
+ " good `query: \"Speedgoat\"` when they named it,"
|
|
170
|
+
+ " bad `query: \"light grippy trail shoe\"`, which is a sentence of yours. `n`: 8 to weigh a"
|
|
171
|
+
+ " kind or show a range, 1 to 3 for a product they named; the product a `query` names"
|
|
172
|
+
+ " comes first. `leans` `{ spec, op, value }` are their kept likings, the row's `subject`"
|
|
173
|
+
+ " as `spec`, `likes` as `eq`, `dislikes` as `neq`: those holding them come first among"
|
|
174
|
+
+ " products that fit alike, others keep a third of the seats, and a liking is never in"
|
|
175
|
+
+ " `specs`; a pick that follows one says so, in their reason. Back come `asked` numbered,"
|
|
176
|
+
+ " `search_stats`, and the closest cards with `holds`, `misses` and `unknown` as ask"
|
|
177
|
+
+ " numbers, `price_range` and `variants`, each with its own `price_range`, one"
|
|
178
|
+
+ " `recommended`. After it, say what came back: how wide you looked, by sil's own counts"
|
|
179
|
+
+ " (`search_stats`: the products and shops sil weighed in this kind; per ask in `asks`,"
|
|
180
|
+
+ " how many held a value for it, passed and failed, so a brand ask's `passed` is how many"
|
|
181
|
+
+ " of that brand sil holds in this kind; `with_all_specs` is testable, not passing; a page"
|
|
182
|
+
+ " of eight is the eight you asked for). A quality word few products hold a value for"
|
|
183
|
+
+ " hides the rest: drop it, say which and why, and search once more. When few fit or many"
|
|
184
|
+
+ " are unknown, say what came back and ask the one question that would change it, or ask"
|
|
185
|
+
+ " before relaxing a want they measured or named, rather than searching again in other"
|
|
186
|
+
+ " words.",
|
|
108
187
|
},
|
|
109
188
|
{
|
|
110
189
|
name: "shopping_product_get",
|
|
@@ -113,7 +192,8 @@ export const SHOPPING_TOOLS = [
|
|
|
113
192
|
label: "Read shortlisted products whole",
|
|
114
193
|
description: "Read the products the buyer leans to whole: values once, reviews, every picture, and"
|
|
115
194
|
+ " each variant with what sets it apart and its `price_range`, cheapest to dearest offer."
|
|
116
|
-
+ " Pick the
|
|
195
|
+
+ " Pick the variant here, then read its offers before you name the pick; money is in the"
|
|
196
|
+
+ " minor unit: €130 is 13000.",
|
|
117
197
|
},
|
|
118
198
|
{
|
|
119
199
|
name: "shopping_offers",
|
|
@@ -125,10 +205,16 @@ export const SHOPPING_TOOLS = [
|
|
|
125
205
|
+ " `ship_to`, one of the buyer's addresses by name (the default when absent). Every"
|
|
126
206
|
+ " offer, shops shipping there first, each with its shop's `name`, whether it `ships`, its"
|
|
127
207
|
+ " `delivery` there, `returns_days` and own `promotions`, then `price`, `was`, `pack` or"
|
|
128
|
-
+ " `plan`,
|
|
129
|
-
+ "
|
|
130
|
-
+ "
|
|
131
|
-
+ "
|
|
208
|
+
+ " `plan`, its stock, its `url` and `read_on`, the day sil read it; nothing marks a best."
|
|
209
|
+
+ " Tell the buyer where to buy and why there, with one link, the offer's `url`; when"
|
|
210
|
+
+ " they choose, hand over in that turn, even if you linked it before. `ships:"
|
|
211
|
+
+ " unknown` is sil not having read that shop's delivery: say so, never \"delivers\";"
|
|
212
|
+
+ " when a date decides, such a shop does not count as reaching them. Never hand over to"
|
|
213
|
+
+ " a shop that does not ship to them. A promotion is its shop's alone:"
|
|
214
|
+
+ " quote it on that shop's offers only. A `was`: say it was higher, judge on the price. A"
|
|
215
|
+
+ " bundle (`pack.with`) is one offer; a `plan` price is the plan's. Money is in the minor"
|
|
216
|
+
+ " unit: €130 is 13000. Send `page` = `next_page` only when a shop the buyer needs may be"
|
|
217
|
+
+ " past it. Warranty, policies, reviews and other terms come from `shopping_seller_get`.",
|
|
132
218
|
},
|
|
133
219
|
{
|
|
134
220
|
name: "shopping_seller_get",
|
|
@@ -156,14 +242,22 @@ export function registerCatalogTools(api) {
|
|
|
156
242
|
api.registerTool((ctx) => defineTool(api, tool, parameters, runOf(ctx, pluginVersion, openclawVersion)), { name: tool.name });
|
|
157
243
|
}
|
|
158
244
|
}
|
|
245
|
+
/** sil's record reads a `none/` model as no agent turn — `tools.invoke` runs a tool outside one,
|
|
246
|
+
* handing over no model and, at most, the host's own session key (`main`), never a turn's. */
|
|
247
|
+
const NO_TURN_MODEL = "none/sil-openclaw";
|
|
159
248
|
/** Who is calling, as the host hands it to a tool factory once per agent run. */
|
|
160
249
|
export function runOf(ctx, pluginVersion, openclawVersion) {
|
|
161
250
|
const { provider, modelId } = ctx.activeModel ?? {};
|
|
251
|
+
const model = provider && modelId ? `${provider}/${modelId}` : undefined;
|
|
252
|
+
const conversation = model !== undefined ? ctx.sessionId || undefined : undefined;
|
|
162
253
|
return {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
254
|
+
caller: {
|
|
255
|
+
pluginVersion,
|
|
256
|
+
...(openclawVersion !== undefined ? { openclawVersion } : {}),
|
|
257
|
+
sessionId: conversation ?? randomUUID(),
|
|
258
|
+
model: model ?? NO_TURN_MODEL,
|
|
259
|
+
},
|
|
260
|
+
conversation,
|
|
167
261
|
};
|
|
168
262
|
}
|
|
169
263
|
function defineTool(api, tool, parameters, run) {
|
|
@@ -173,10 +267,10 @@ function defineTool(api, tool, parameters, run) {
|
|
|
173
267
|
description: tool.description,
|
|
174
268
|
parameters,
|
|
175
269
|
async execute(callId, params) {
|
|
176
|
-
const called = await callRoute(api, tool, params, { ...run, toolCallId: callId });
|
|
270
|
+
const called = await callRoute(api, tool, params, { ...run.caller, toolCallId: callId });
|
|
177
271
|
if (called.kind === "refused")
|
|
178
272
|
return jsonResult(called.body);
|
|
179
|
-
keepAnswer(api, callId, run.
|
|
273
|
+
keepAnswer(api, callId, run.conversation, called.body);
|
|
180
274
|
// The advisory rides its own block: nothing of ours may sit beside the body's keys.
|
|
181
275
|
return jsonResult(called.body, ...wiringAdvisoryBlocks(api));
|
|
182
276
|
},
|
package/dist/tools/identity.js
CHANGED
|
@@ -132,7 +132,7 @@ function registerWhoami(api) {
|
|
|
132
132
|
}
|
|
133
133
|
// 2 — read identity; on a 401 refresh-and-retry ONCE, shared with every
|
|
134
134
|
// `shopping_*` call so the recovery cannot drift between tools.
|
|
135
|
-
const caller = { ...run, toolCallId: callId };
|
|
135
|
+
const caller = { ...run.caller, toolCallId: callId };
|
|
136
136
|
const first = await fetchIdentity(getApiUrl(), stored.access_token, caller, 1);
|
|
137
137
|
const recovered = await refreshAndRetryOnce(first, (o) => o.kind === "unauthorized", (accessToken) => fetchIdentity(getApiUrl(), accessToken, caller, 2));
|
|
138
138
|
switch (recovered.kind) {
|
|
@@ -141,7 +141,7 @@ function registerWhoami(api) {
|
|
|
141
141
|
// 401 recoveries is invisible otherwise.
|
|
142
142
|
if (recovered.refreshed)
|
|
143
143
|
api.logger.info("sil_whoami_refreshed", {});
|
|
144
|
-
return identityOutcomeToResult(api, recovered.outcome, (body) => keepAnswer(api, callId, run.
|
|
144
|
+
return identityOutcomeToResult(api, recovered.outcome, (body) => keepAnswer(api, callId, run.conversation, body));
|
|
145
145
|
case "must_reregister":
|
|
146
146
|
// Clear the known-dead pair so its stale presence cannot block the
|
|
147
147
|
// sil_register recovery; an empty re-read has nothing to clear.
|
|
@@ -171,8 +171,8 @@ function identityOutcomeToResult(api, outcome, keep) {
|
|
|
171
171
|
keep(body);
|
|
172
172
|
return jsonResult(body, ...wiringAdvisoryBlocks(api));
|
|
173
173
|
}
|
|
174
|
-
case "
|
|
175
|
-
api.logger.info("
|
|
174
|
+
case "invalid_request":
|
|
175
|
+
api.logger.info("sil_whoami_invalid_request", {});
|
|
176
176
|
return jsonResult({ status: "invalid_request", message: outcome.message });
|
|
177
177
|
case "forbidden":
|
|
178
178
|
// A token that maps to no account is structurally dead, so clear it or the
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sil-openclaw",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"description": "The Shopping Interface Layer for personal AI agents. Turn your OpenClaw into an expert shopping agent.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -78,15 +78,14 @@
|
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
80
|
"scripts": {
|
|
81
|
+
"prepare": "git rev-parse --git-dir >/dev/null 2>&1 && git config core.hooksPath .githooks || true",
|
|
81
82
|
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
82
83
|
"build": "pnpm clean && tsc -p tsconfig.build.json",
|
|
83
84
|
"typecheck": "tsc --noEmit",
|
|
84
85
|
"dev": "tsc -p tsconfig.build.json --watch",
|
|
85
|
-
"test": "vitest run --passWithNoTests",
|
|
86
|
-
"test:watch": "vitest",
|
|
87
86
|
"sync-version": "node scripts/sync-version.mjs",
|
|
88
87
|
"openclaw:allowlist": "node scripts/allowlist-openclaw.mjs",
|
|
89
|
-
"preversion": "pnpm typecheck
|
|
88
|
+
"preversion": "pnpm typecheck",
|
|
90
89
|
"version": "pnpm sync-version && node scripts/changelog.mjs cut && git add openclaw.plugin.json CHANGELOG.md",
|
|
91
90
|
"postversion": "git push --follow-tags",
|
|
92
91
|
"prepack": "pnpm build",
|
|
@@ -98,9 +97,6 @@
|
|
|
98
97
|
},
|
|
99
98
|
"devDependencies": {
|
|
100
99
|
"@types/node": "22.15.3",
|
|
101
|
-
"
|
|
102
|
-
"ajv-formats": "3.0.1",
|
|
103
|
-
"typescript": "5.8.3",
|
|
104
|
-
"vitest": "4.1.2"
|
|
100
|
+
"typescript": "5.8.3"
|
|
105
101
|
}
|
|
106
102
|
}
|
package/schema/PROVENANCE.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# Where these twenty-six files come from
|
|
2
2
|
|
|
3
3
|
Copied verbatim from `sil-services` `packages/schemas/schema/`, commit
|
|
4
|
-
`fd37ffed3c04ef12c81b3490a91d6dfd290105c3
|
|
4
|
+
`fd37ffed3c04ef12c81b3490a91d6dfd290105c3`; the six `shopping-user-*` files and the two `shopping-search-*`
|
|
5
|
+
files from its branch `iter/sil-leaves-you-smarter/8` at `46028607`. One request and one response artifact per
|
|
5
6
|
`shopping_*` tool, plus `sil-whoami-*`; each is `JSON.stringify` of the TypeBox object the
|
|
6
7
|
API serialises against.
|
|
7
8
|
|
|
@@ -11,8 +12,7 @@ contract the API never agreed to.
|
|
|
11
12
|
|
|
12
13
|
```sh
|
|
13
14
|
S=<sil-services>/packages/schemas/schema; rm schema/*.schema.json \
|
|
14
|
-
&& cp $S/shopping-*.schema.json $S/sil-whoami-*.schema.json schema/
|
|
15
|
-
&& node scripts/contract-examples.mjs $S/agent-contract.md
|
|
15
|
+
&& cp $S/shopping-*.schema.json $S/sil-whoami-*.schema.json schema/
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
Byte-identity against the sibling is graded by sil-stage, not here.
|
|
@@ -68,6 +68,10 @@
|
|
|
68
68
|
"type": "string",
|
|
69
69
|
"description": "Cites who wrote it; absent, sil did."
|
|
70
70
|
},
|
|
71
|
+
"heading": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"description": "Reads the heading it sits under; absent before the document’s first."
|
|
74
|
+
},
|
|
71
75
|
"text": {
|
|
72
76
|
"type": "string",
|
|
73
77
|
"description": "Reads the passage."
|
|
@@ -84,7 +88,7 @@
|
|
|
84
88
|
},
|
|
85
89
|
"additionalProperties": false
|
|
86
90
|
},
|
|
87
|
-
"description": "Reads sil’s passages, best first. Empty: say so, never the open web."
|
|
91
|
+
"description": "Reads sil’s passages, best first, at most two of one document. Empty: say so, never the open web."
|
|
88
92
|
}
|
|
89
93
|
},
|
|
90
94
|
"additionalProperties": false
|
|
@@ -432,6 +432,30 @@
|
|
|
432
432
|
"type": "string",
|
|
433
433
|
"format": "date",
|
|
434
434
|
"description": "Dates the price: the day sil read it."
|
|
435
|
+
},
|
|
436
|
+
"images": {
|
|
437
|
+
"type": "array",
|
|
438
|
+
"items": {
|
|
439
|
+
"type": "object",
|
|
440
|
+
"required": [
|
|
441
|
+
"card",
|
|
442
|
+
"full"
|
|
443
|
+
],
|
|
444
|
+
"properties": {
|
|
445
|
+
"card": {
|
|
446
|
+
"type": "string",
|
|
447
|
+
"description": "Hands the photo at card size, for a thumbnail."
|
|
448
|
+
},
|
|
449
|
+
"full": {
|
|
450
|
+
"type": "string",
|
|
451
|
+
"description": "Hands the photo at full size."
|
|
452
|
+
}
|
|
453
|
+
},
|
|
454
|
+
"additionalProperties": false,
|
|
455
|
+
"description": "One photo of the set, at two sizes."
|
|
456
|
+
},
|
|
457
|
+
"minItems": 1,
|
|
458
|
+
"description": "Shows a set the offer sells together, several products at once: its own photos, never a variant’s."
|
|
435
459
|
}
|
|
436
460
|
},
|
|
437
461
|
"additionalProperties": false,
|