sil-openclaw 0.8.2 → 0.8.3
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 +16 -0
- package/README.md +1 -2
- package/dist/lib/poller.js +0 -1
- package/dist/lib/sil-client.js +19 -14
- package/dist/tools/catalog.js +15 -6
- package/dist/tools/identity.js +4 -4
- package/openclaw.plugin.json +1 -1
- package/package.json +4 -8
- package/schema/PROVENANCE.md +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,22 @@ release (`clawhub package publish --changelog`). See [README](./README.md#releas
|
|
|
10
10
|
|
|
11
11
|
## [Unreleased]
|
|
12
12
|
|
|
13
|
+
## [0.8.3] - 2026-11-11
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- **A tool called outside a turn reaches sil.** `tools.invoke` hands a tool no session and no
|
|
18
|
+
model, so sil-api refused every such call and the plugin read the refusal as sil being down.
|
|
19
|
+
An off-turn call now mints a session and names its model `none/sil-openclaw`; the screen
|
|
20
|
+
follows only the host's own conversation.
|
|
21
|
+
- **sil's refusals read as refusals.** Any 4xx but 401, 403 and 404 is `invalid_request`
|
|
22
|
+
carrying sil's message, not a retry; 408 and 429 stay retryable.
|
|
23
|
+
|
|
24
|
+
### Removed
|
|
25
|
+
|
|
26
|
+
- **The plugin's test suite.** Its proofs live in sil-stage; `pnpm version` runs the type
|
|
27
|
+
check alone. The package's contents are unchanged by this.
|
|
28
|
+
|
|
13
29
|
## [0.8.2] - 2026-10-30
|
|
14
30
|
|
|
15
31
|
### Fixed
|
package/README.md
CHANGED
|
@@ -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";
|
|
@@ -156,14 +157,22 @@ export function registerCatalogTools(api) {
|
|
|
156
157
|
api.registerTool((ctx) => defineTool(api, tool, parameters, runOf(ctx, pluginVersion, openclawVersion)), { name: tool.name });
|
|
157
158
|
}
|
|
158
159
|
}
|
|
160
|
+
/** sil's record reads a `none/` model as no agent turn — `tools.invoke` runs a tool outside one,
|
|
161
|
+
* handing over no model and, at most, the host's own session key (`main`), never a turn's. */
|
|
162
|
+
const NO_TURN_MODEL = "none/sil-openclaw";
|
|
159
163
|
/** Who is calling, as the host hands it to a tool factory once per agent run. */
|
|
160
164
|
export function runOf(ctx, pluginVersion, openclawVersion) {
|
|
161
165
|
const { provider, modelId } = ctx.activeModel ?? {};
|
|
166
|
+
const model = provider && modelId ? `${provider}/${modelId}` : undefined;
|
|
167
|
+
const conversation = model !== undefined ? ctx.sessionId || undefined : undefined;
|
|
162
168
|
return {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
169
|
+
caller: {
|
|
170
|
+
pluginVersion,
|
|
171
|
+
...(openclawVersion !== undefined ? { openclawVersion } : {}),
|
|
172
|
+
sessionId: conversation ?? randomUUID(),
|
|
173
|
+
model: model ?? NO_TURN_MODEL,
|
|
174
|
+
},
|
|
175
|
+
conversation,
|
|
167
176
|
};
|
|
168
177
|
}
|
|
169
178
|
function defineTool(api, tool, parameters, run) {
|
|
@@ -173,10 +182,10 @@ function defineTool(api, tool, parameters, run) {
|
|
|
173
182
|
description: tool.description,
|
|
174
183
|
parameters,
|
|
175
184
|
async execute(callId, params) {
|
|
176
|
-
const called = await callRoute(api, tool, params, { ...run, toolCallId: callId });
|
|
185
|
+
const called = await callRoute(api, tool, params, { ...run.caller, toolCallId: callId });
|
|
177
186
|
if (called.kind === "refused")
|
|
178
187
|
return jsonResult(called.body);
|
|
179
|
-
keepAnswer(api, callId, run.
|
|
188
|
+
keepAnswer(api, callId, run.conversation, called.body);
|
|
180
189
|
// The advisory rides its own block: nothing of ours may sit beside the body's keys.
|
|
181
190
|
return jsonResult(called.body, ...wiringAdvisoryBlocks(api));
|
|
182
191
|
},
|
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.3",
|
|
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
|
@@ -11,8 +11,7 @@ contract the API never agreed to.
|
|
|
11
11
|
|
|
12
12
|
```sh
|
|
13
13
|
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
|
|
14
|
+
&& cp $S/shopping-*.schema.json $S/sil-whoami-*.schema.json schema/
|
|
16
15
|
```
|
|
17
16
|
|
|
18
17
|
Byte-identity against the sibling is graded by sil-stage, not here.
|