sil-openclaw 0.3.8 → 0.3.9
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 +56 -0
- package/dist/lib/bind-channel.js +10 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/scripts/create-shopper.mjs +176 -14
- package/sil-shopping/SKILL.md +97 -54
- package/sil-shopping/examples/multi_domain_shopper_walkthrough.md +64 -136
- package/sil-shopping/references/agent_creation_engine.md +112 -63
- package/sil-shopping/references/brainstorm_interview.md +95 -69
- package/sil-shopping/references/catalog_tools_reference.md +27 -29
- package/sil-shopping/references/manage_domains.md +60 -39
- package/sil-shopping/references/refine_shopper.md +92 -43
- package/sil-shopping/references/search_param_mapping.md +71 -47
- package/sil-shopping/references/setup_onboarding.md +68 -0
- package/sil-shopping/references/shop_loop.md +154 -124
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,62 @@ release (`clawhub package publish --changelog`). See [README](./README.md#releas
|
|
|
10
10
|
|
|
11
11
|
## [Unreleased]
|
|
12
12
|
|
|
13
|
+
## [0.3.9] - 2026-07-10
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **A new shopper is auto-bound to the current channel — fail-open, verified.**
|
|
18
|
+
Creation grew a final bind beat: `resolveBindChannel` picks the channel
|
|
19
|
+
(`spec.channel` > `OPENCLAW_MCP_MESSAGE_CHANNEL` > none), and
|
|
20
|
+
`create-shopper.mjs` binds the freshly-minted shopper to it and **verifies the
|
|
21
|
+
bind from the host's own JSON** before declaring success (the `created` outcome
|
|
22
|
+
now carries `boundChannel`). The bind is **fail-open**: a bind or verify
|
|
23
|
+
failure never fails the create and never leaves a half-bound agent — it
|
|
24
|
+
self-reverts and returns a manual-bind hint naming the shopper and the exact
|
|
25
|
+
step to run. No channel resolvable is a clean no-op, not an error. (#48)
|
|
26
|
+
- **`SKILL.md` is now stage-aware and gates the shopper's search on a learned
|
|
27
|
+
domain.** The always-loaded router reads two live signals — registration
|
|
28
|
+
(`sil_whoami`) and shopper state (the no-arg `sil_profile_get` overview) — and
|
|
29
|
+
presents a **five-stage onboarding progression** while setup is incomplete,
|
|
30
|
+
then **sheds to usage-only** once complete, so a steady-state session isn't
|
|
31
|
+
taxed with setup prose. When acting *as the shopper*, search is gated behind a
|
|
32
|
+
learned domain (classify → learn-on-miss before any `sil_search`); the
|
|
33
|
+
profile-less **Lane 1 bare search stays untouched**. Prose-only — no tool
|
|
34
|
+
change, `contracts.tools` byte-unchanged. (#49)
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
|
|
38
|
+
- **The `sil-shopping` skill bundle was refactored to progressive disclosure and
|
|
39
|
+
de-rigidified** — same SDS state machine and file-creation flow, leaner and
|
|
40
|
+
more legible. The one-time onboarding script was **evicted from the
|
|
41
|
+
always-loaded `SKILL.md`** into `references/setup_onboarding.md` (loads on
|
|
42
|
+
demand, shed once setup completes); the router collapses to a **pure state
|
|
43
|
+
branch** (no identity / no shopper / shopper) — body **2394 → 1042 words
|
|
44
|
+
(−56%)**, description **917 → 622 chars**. Language firmness was then matched to
|
|
45
|
+
the task: firm only at the genuine cliffs (endorsement gate, singleton refusal,
|
|
46
|
+
confirm-before-remove/persist, hard-constraint reject-at-pick,
|
|
47
|
+
re-fetch-before-buy, follow-the-tool's-recovery), plain heuristics everywhere
|
|
48
|
+
else. The **whole 10-file bundle** was rewritten leaner (**15,644 → 9,101
|
|
49
|
+
words, −41%**; `shop_loop` −56%): killed tool↔skill and cross-file duplication
|
|
50
|
+
and dropped the `sil_search` param-catalog table (the tool description owns it —
|
|
51
|
+
the mapping now points there). Skill prose + tests only; the 8-tool floor and
|
|
52
|
+
`contracts.tools` are unchanged. (#50, #51)
|
|
53
|
+
|
|
54
|
+
### Fixed
|
|
55
|
+
|
|
56
|
+
- **The `sil-shopping` skill now actually loads into the created shopper agent.**
|
|
57
|
+
`create-shopper.mjs` attached the **plugin id** (`["sil"]`) at
|
|
58
|
+
`agents.list[i].skills`, but a skill attaches by its **published name** — the
|
|
59
|
+
skill-dir basename `sil-shopping` (`basename(openclaw.plugin.json#skills[0])`,
|
|
60
|
+
== the `SKILL.md` frontmatter `name`) — so the host looked up a skill named
|
|
61
|
+
`sil`, found none, and the shopper ran with **no skill driving its `sil_*`
|
|
62
|
+
tools**. The `["sil"]` literal is deleted; the attach value is now
|
|
63
|
+
**single-sourced from the shipped manifest** and resolved as a fail-closed
|
|
64
|
+
precondition (a blank/absent `skills[0]` attaches nothing, never `[""]`). A
|
|
65
|
+
static name-agreement drift guard (`basename(skills[0]) == SKILL.md name !=
|
|
66
|
+
plugin id`) keeps the plugin-id/skill-name conflation from silently returning.
|
|
67
|
+
(#47)
|
|
68
|
+
|
|
13
69
|
## [0.3.8] - 2026-07-06
|
|
14
70
|
|
|
15
71
|
### Added
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function resolveBindChannel(sources) {
|
|
2
|
+
return normalizeChannel(sources.specChannel) ?? normalizeChannel(sources.envChannel);
|
|
3
|
+
}
|
|
4
|
+
/** A present, non-blank string trimmed of surrounding whitespace, else `null`. */
|
|
5
|
+
function normalizeChannel(value) {
|
|
6
|
+
if (typeof value !== "string")
|
|
7
|
+
return null;
|
|
8
|
+
const trimmed = value.trim();
|
|
9
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
10
|
+
}
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -13,10 +13,11 @@
|
|
|
13
13
|
* consent gate; this bin executes an already-assembled, already-endorsed spec
|
|
14
14
|
* non-interactively. It never prompts, never re-runs the interview.
|
|
15
15
|
*
|
|
16
|
-
* Input — ONE JSON object `{ agentId, name, workspace, persona, userSpec }`,
|
|
17
|
-
* from stdin (primary) or `--spec <path>` (fallback). Passing multiline
|
|
16
|
+
* Input — ONE JSON object `{ agentId, name, workspace, persona, userSpec, channel? }`,
|
|
17
|
+
* read from stdin (primary) or `--spec <path>` (fallback). Passing multiline
|
|
18
18
|
* persona/userSpec as JSON dodges shell-arg escaping. Unparseable/blank input →
|
|
19
|
-
* `invalid_request`, nothing attempted.
|
|
19
|
+
* `invalid_request`, nothing attempted. `channel` is OPTIONAL — the current-channel
|
|
20
|
+
* override for the step-10 bind; absent/blank is fail-open, never invalid_request.
|
|
20
21
|
*
|
|
21
22
|
* Choreography (validate-first, then atomic, fail-closed):
|
|
22
23
|
* 1. validate the spec — bad/blank field ⇒ invalid_request, nothing attempted
|
|
@@ -32,8 +33,13 @@
|
|
|
32
33
|
* 8. attach the sil skill + enable the sil plugin (openclaw config set --strict-json)
|
|
33
34
|
* 9. sil-openclaw-allowlist — REUSED whole; additive/idempotent/atomic three-surface
|
|
34
35
|
* trust merge (plugins.allow + tools.alsoAllow + plugins.entries.sil)
|
|
35
|
-
* 10.
|
|
36
|
-
*
|
|
36
|
+
* 10. bind the current channel — FAIL-OPEN convenience, NOT fail-closed: resolve the channel
|
|
37
|
+
* (spec.channel > OPENCLAW_MCP_MESSAGE_CHANNEL), bind + VERIFY
|
|
38
|
+
* from the JSON verdict (never the exit code), keep a verified
|
|
39
|
+
* route, revert an unverifiable one; an undetermined/unverifiable
|
|
40
|
+
* channel degrades to a manual-bind hint — it NEVER fails creation
|
|
41
|
+
* 11. openclaw config validate — success keys off `.valid`, never an `ok` field
|
|
42
|
+
* 12. one { status, … } JSON result; exit 0 ONLY on `created`.
|
|
37
43
|
*
|
|
38
44
|
* Teardown on ANY failure after step 5 = whole-file snapshot-restore of
|
|
39
45
|
* openclaw.json (reverses the agents.list entry + skill + plugin + trust in ONE
|
|
@@ -45,6 +51,12 @@
|
|
|
45
51
|
* LOUDER outcome (`teardown_failed`) that names the residue — never a green-washed
|
|
46
52
|
* `persistence_failed`.
|
|
47
53
|
*
|
|
54
|
+
* The step-10 channel bind is the ONE step that never routes into teardown: it is
|
|
55
|
+
* fail-open by design (a convenience, not a precondition), so it self-reverts a bad
|
|
56
|
+
* bind in place and continues. Because a VERIFIED route lives in openclaw.json, the
|
|
57
|
+
* step-4 snapshot restore reverses it FOR FREE if any earlier-or-later step then
|
|
58
|
+
* fails — no `agents unbind`, no bind-specific teardown code.
|
|
59
|
+
*
|
|
48
60
|
* Outcome taxonomy (four terminal, + the louder teardown_failed), in sil's
|
|
49
61
|
* `snake_case_marker` NDJSON style (no api.logger outside the gateway). No PII, no
|
|
50
62
|
* secrets — the persona/userSpec text is NEVER logged:
|
|
@@ -63,7 +75,7 @@
|
|
|
63
75
|
import { execFileSync } from "node:child_process";
|
|
64
76
|
import { existsSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
65
77
|
import { homedir } from "node:os";
|
|
66
|
-
import { dirname, join, resolve } from "node:path";
|
|
78
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
67
79
|
import { randomBytes } from "node:crypto";
|
|
68
80
|
import { fileURLToPath } from "node:url";
|
|
69
81
|
|
|
@@ -72,10 +84,14 @@ import {
|
|
|
72
84
|
readAgentProfile,
|
|
73
85
|
getShopperArtefactDir,
|
|
74
86
|
} from "../dist/lib/profile-store.js";
|
|
87
|
+
import { resolveBindChannel } from "../dist/lib/bind-channel.js";
|
|
75
88
|
|
|
76
89
|
const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
77
90
|
/** The sibling operator bin that performs the additive, self-validating trust merge. */
|
|
78
91
|
const ALLOWLIST_BIN = resolve(ROOT, "scripts", "allowlist-openclaw.mjs");
|
|
92
|
+
/** The shipped plugin manifest — the single source of truth for sil's facts (id,
|
|
93
|
+
* skill name), read the same way `scripts/allowlist-openclaw.mjs` reads it. */
|
|
94
|
+
const MANIFEST_PATH = resolve(ROOT, "openclaw.plugin.json");
|
|
79
95
|
|
|
80
96
|
/** A shopper id path-segment shape — lower-kebab, never `main` (host-reserved). */
|
|
81
97
|
const AGENT_ID_RE = /^[a-z0-9][a-z0-9-]*$/;
|
|
@@ -161,12 +177,15 @@ function readSpecRaw() {
|
|
|
161
177
|
|
|
162
178
|
/** Validate the endorsed spec — deterministic field order (agentId → name →
|
|
163
179
|
* workspace → persona → userSpec). Returns `{ field, message }` on the FIRST bad
|
|
164
|
-
* field, or null when the whole spec is good. Writes/attempts nothing.
|
|
180
|
+
* field, or null when the whole spec is good. Writes/attempts nothing. `channel`
|
|
181
|
+
* is deliberately NOT validated: it is an optional fail-open convenience, so an
|
|
182
|
+
* absent/blank/malformed channel is never invalid_request — it folds to `null` in
|
|
183
|
+
* `resolveBindChannel` and degrades to a manual-bind hint at step 10. */
|
|
165
184
|
function validateSpec(spec) {
|
|
166
185
|
if (typeof spec !== "object" || spec === null || Array.isArray(spec)) {
|
|
167
186
|
return {
|
|
168
187
|
field: "spec",
|
|
169
|
-
message: "spec must be a JSON object with { agentId, name, workspace, persona, userSpec }.",
|
|
188
|
+
message: "spec must be a JSON object with { agentId, name, workspace, persona, userSpec, channel? }.",
|
|
170
189
|
};
|
|
171
190
|
}
|
|
172
191
|
if (!nonBlank(spec.agentId)) {
|
|
@@ -225,6 +244,32 @@ function readConfig(configPath) {
|
|
|
225
244
|
}
|
|
226
245
|
}
|
|
227
246
|
|
|
247
|
+
/** Resolve the sil SKILL's published name to attach at `agents.list[i].skills`,
|
|
248
|
+
* single-sourced from the shipped manifest (mirrors `allowlist-openclaw.mjs`'s
|
|
249
|
+
* `readSilFacts`). A skill attaches by its PUBLISHED name = the skill-dir basename
|
|
250
|
+
* = `basename(openclaw.plugin.json#skills[0])` (`sil-shopping`) — NOT the plugin id
|
|
251
|
+
* (`sil`), which is the tools/trust key. The per-agent attach is the ONLY skill
|
|
252
|
+
* surface (no global skill allow-list), so the plugin id here loads no skill at
|
|
253
|
+
* all. Fail-closed: an unreadable manifest or a blank/absent `skills[0]` returns
|
|
254
|
+
* `{ error }` so the create errors rather than attaching `[""]`. */
|
|
255
|
+
function readSkillAttachName() {
|
|
256
|
+
let manifest;
|
|
257
|
+
try {
|
|
258
|
+
manifest = JSON.parse(readFileSync(MANIFEST_PATH, "utf8"));
|
|
259
|
+
} catch (err) {
|
|
260
|
+
return { error: "the shipped manifest " + MANIFEST_PATH + " is not readable/parseable JSON: " + errCause(err) };
|
|
261
|
+
}
|
|
262
|
+
const ref = Array.isArray(manifest.skills) ? manifest.skills[0] : undefined;
|
|
263
|
+
if (!nonBlank(ref)) {
|
|
264
|
+
return { error: "the shipped manifest " + MANIFEST_PATH + " declares no skills[0] — cannot resolve the sil skill name to attach" };
|
|
265
|
+
}
|
|
266
|
+
const name = basename(ref);
|
|
267
|
+
if (!nonBlank(name)) {
|
|
268
|
+
return { error: "the shipped manifest skills[0] " + JSON.stringify(ref) + " has no usable basename" };
|
|
269
|
+
}
|
|
270
|
+
return { name };
|
|
271
|
+
}
|
|
272
|
+
|
|
228
273
|
/** The agentId path-segment ids already registered in the host config's
|
|
229
274
|
* `agents.list` — the authoritative, shim-independent clash source. */
|
|
230
275
|
function existingAgentIds(config) {
|
|
@@ -256,6 +301,64 @@ function webCapabilityWarnings(config) {
|
|
|
256
301
|
];
|
|
257
302
|
}
|
|
258
303
|
|
|
304
|
+
/** True iff `openclaw config validate --json` reported `{valid:true}`. The host
|
|
305
|
+
* writes its verdict to stdout even on a non-zero exit, so read stdout, never the
|
|
306
|
+
* exit code (fail closed if it is not JSON). */
|
|
307
|
+
function configValidates(stdout) {
|
|
308
|
+
try {
|
|
309
|
+
const verdict = JSON.parse(stdout);
|
|
310
|
+
return verdict !== null && verdict.valid === true;
|
|
311
|
+
} catch {
|
|
312
|
+
return false;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/** True iff `openclaw agents bind --json` reported the channel APPLIED — landed in
|
|
317
|
+
* `added` or `updated`, with an EMPTY `conflicts`. `agents bind` exits 0 even on a
|
|
318
|
+
* conflict or an empty `--bind`, so the JSON verdict — never the exit code — is the
|
|
319
|
+
* source of truth (the same discipline the bin applies to `config validate.valid`). */
|
|
320
|
+
function bindApplied(stdout) {
|
|
321
|
+
let v;
|
|
322
|
+
try {
|
|
323
|
+
v = JSON.parse(stdout);
|
|
324
|
+
} catch {
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
327
|
+
if (v === null || typeof v !== "object") return false;
|
|
328
|
+
const added = Array.isArray(v.added) ? v.added : [];
|
|
329
|
+
const updated = Array.isArray(v.updated) ? v.updated : [];
|
|
330
|
+
const conflicts = Array.isArray(v.conflicts) ? v.conflicts : [];
|
|
331
|
+
return (added.length > 0 || updated.length > 0) && conflicts.length === 0;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/** True iff the `openclaw agents bindings --json` read-back (an ARRAY of
|
|
335
|
+
* `{agentId, match:{channel}}`) actually shows the route `<channel> → <agentId>`.
|
|
336
|
+
* This is the honesty rail: a bind is only "verified" once the read-back proves the
|
|
337
|
+
* write stuck — issuing the write is not the same as the next message reaching it. */
|
|
338
|
+
function bindingPresent(stdout, agentId, channel) {
|
|
339
|
+
let v;
|
|
340
|
+
try {
|
|
341
|
+
v = JSON.parse(stdout);
|
|
342
|
+
} catch {
|
|
343
|
+
return false;
|
|
344
|
+
}
|
|
345
|
+
if (!Array.isArray(v)) return false;
|
|
346
|
+
return v.some((b) => b?.agentId === agentId && b?.match?.channel === channel);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/** The fail-open manual-bind hint appended to `created` warnings when the channel
|
|
350
|
+
* could not be auto-routed (undetermined) or the bind could not be verified. It
|
|
351
|
+
* states the shopper WAS created, names the one-command manual bind, and never
|
|
352
|
+
* implies a broken create — a convenience that didn't fire, not an error. */
|
|
353
|
+
function manualBindHint(agentId, channel) {
|
|
354
|
+
const target = channel ? `the "${channel}" channel` : "the current channel";
|
|
355
|
+
return (
|
|
356
|
+
`the shopper "${agentId}" was created but ${target} was not auto-routed to it. `
|
|
357
|
+
+ `To route it manually, run: openclaw agents bind --agent ${agentId} --bind <channel> `
|
|
358
|
+
+ `(or switch in-chat with /agent ${agentId}). The shopper is fully created and ready.`
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
|
|
259
362
|
/**
|
|
260
363
|
* Whole-file snapshot-restore teardown. Reverses everything this run created and
|
|
261
364
|
* returns the residue it could NOT revert (empty ⇒ clean, host at exact pre-run
|
|
@@ -334,7 +437,7 @@ function main() {
|
|
|
334
437
|
if (bad) {
|
|
335
438
|
emitFailure("invalid_request", { field: bad.field, cause: bad.message });
|
|
336
439
|
}
|
|
337
|
-
const { agentId, name, workspace, persona, userSpec } = spec;
|
|
440
|
+
const { agentId, name, workspace, persona, userSpec, channel } = spec;
|
|
338
441
|
|
|
339
442
|
// --- 2. Resolve the host config (precondition — nothing written yet) ---
|
|
340
443
|
const configPath = resolveConfigPath();
|
|
@@ -354,6 +457,15 @@ function main() {
|
|
|
354
457
|
});
|
|
355
458
|
}
|
|
356
459
|
|
|
460
|
+
// --- 2b. Resolve the sil skill's published name to attach (shipped manifest is the
|
|
461
|
+
// single source of truth) — a packaging defect fails closed BEFORE any host
|
|
462
|
+
// write, so nothing is attempted. Reused at step 8. ---
|
|
463
|
+
const skill = readSkillAttachName();
|
|
464
|
+
if (skill.error) {
|
|
465
|
+
emitFailure("persistence_failed", { path: MANIFEST_PATH, cause: skill.error });
|
|
466
|
+
}
|
|
467
|
+
const skillAttachName = skill.name;
|
|
468
|
+
|
|
357
469
|
// --- 3. Singleton + agentId pre-flight (nothing written; inconclusive → fail closed) ---
|
|
358
470
|
// The sil artefact store is the source of truth for "a shopper exists".
|
|
359
471
|
const overview = readAgentProfile();
|
|
@@ -455,8 +567,11 @@ function main() {
|
|
|
455
567
|
if (idx < 0) {
|
|
456
568
|
failAndTeardown(configPath, "the created agent " + JSON.stringify(agentId) + " is not in agents.list after `openclaw agents add`");
|
|
457
569
|
}
|
|
570
|
+
// Attach the skill by its PUBLISHED name (`sil-shopping`), NOT the plugin id
|
|
571
|
+
// (`sil`) — a skill and the plugin are two distinct host keys, and the per-agent
|
|
572
|
+
// attach is the only skill surface, so the plugin id here would load no skill.
|
|
458
573
|
const skillRes = runOpenclaw(
|
|
459
|
-
["config", "set", `agents.list[${idx}].skills`,
|
|
574
|
+
["config", "set", `agents.list[${idx}].skills`, JSON.stringify([skillAttachName]), "--strict-json"],
|
|
460
575
|
configPath,
|
|
461
576
|
);
|
|
462
577
|
if (!skillRes.ok) {
|
|
@@ -490,7 +605,54 @@ function main() {
|
|
|
490
605
|
failAndTeardown(configPath, "the sil-openclaw-allowlist admission helper failed: " + allowlistCause);
|
|
491
606
|
}
|
|
492
607
|
|
|
493
|
-
// --- 10.
|
|
608
|
+
// --- 10. Bind the current channel to the new shopper (FAIL-OPEN convenience) ---
|
|
609
|
+
// Route the channel the user is talking on to the new shopper by default, so their
|
|
610
|
+
// next message reaches it with no manual bind. This step NEVER fails creation: an
|
|
611
|
+
// undetermined channel, a conflict (already owned by another agent — no auto-steal),
|
|
612
|
+
// or an unverifiable bind all degrade to a manual-bind hint. The bind lands in
|
|
613
|
+
// openclaw.json `bindings[]`, so a VERIFIED route is reversed for free by the
|
|
614
|
+
// step-4 snapshot if a later step tears the whole create down.
|
|
615
|
+
const bindWarnings = [];
|
|
616
|
+
// The channel the route was VERIFIED-bound to (null ⇒ nothing bound). It rides in
|
|
617
|
+
// `created` as the honesty rail: a bound channel is named ONLY when the read-back +
|
|
618
|
+
// config validate confirm it — issuing the write is never enough.
|
|
619
|
+
let boundChannel = null;
|
|
620
|
+
const channelToBind = resolveBindChannel({
|
|
621
|
+
specChannel: channel,
|
|
622
|
+
envChannel: process.env["OPENCLAW_MCP_MESSAGE_CHANNEL"],
|
|
623
|
+
});
|
|
624
|
+
if (channelToBind === null) {
|
|
625
|
+
bindWarnings.push(manualBindHint(agentId, null));
|
|
626
|
+
} else {
|
|
627
|
+
// Snapshot BEFORE the bind so an unverifiable write reverts to a valid config —
|
|
628
|
+
// never falling through to the fail-closed step-11 validate (which would tear
|
|
629
|
+
// down a fully-created shopper over a convenience shortfall).
|
|
630
|
+
const bindSnapshot = readFileSync(configPath, "utf8");
|
|
631
|
+
const bindRes = runOpenclaw(["agents", "bind", "--agent", agentId, "--bind", channelToBind, "--json"], configPath);
|
|
632
|
+
const readBack = runOpenclaw(["agents", "bindings", "--agent", agentId, "--json"], configPath);
|
|
633
|
+
const bindValidateRes = runOpenclaw(["config", "validate", "--json"], configPath);
|
|
634
|
+
const verified =
|
|
635
|
+
bindRes.ok
|
|
636
|
+
&& bindApplied(bindRes.stdout)
|
|
637
|
+
&& readBack.ok
|
|
638
|
+
&& bindingPresent(readBack.stdout, agentId, channelToBind)
|
|
639
|
+
&& configValidates(bindValidateRes.stdout);
|
|
640
|
+
if (verified) {
|
|
641
|
+
boundChannel = channelToBind;
|
|
642
|
+
} else {
|
|
643
|
+
// Revert JUST the route (config back to its pre-bind valid state) and degrade
|
|
644
|
+
// to the manual-bind hint. A failed revert is still fail-open: a well-formed
|
|
645
|
+
// bind is validation-safe, so step 11 certifies the config either way.
|
|
646
|
+
try {
|
|
647
|
+
atomicWrite(configPath, bindSnapshot, mode);
|
|
648
|
+
} catch {
|
|
649
|
+
// best-effort — never escalate a convenience revert into a torn-down create
|
|
650
|
+
}
|
|
651
|
+
bindWarnings.push(manualBindHint(agentId, channelToBind));
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
// --- 11. Validate with the host's OWN check — success keys off `.valid` ---
|
|
494
656
|
// The shim/host writes its structured verdict to stdout even on a non-zero exit,
|
|
495
657
|
// so read stdout regardless of the exit code (fail closed if it is not JSON).
|
|
496
658
|
const validateRes = runOpenclaw(["config", "validate", "--json"], configPath);
|
|
@@ -508,9 +670,9 @@ function main() {
|
|
|
508
670
|
failAndTeardown(configPath, issues ? cause + " — issues: " + issues : cause);
|
|
509
671
|
}
|
|
510
672
|
|
|
511
|
-
// ---
|
|
512
|
-
const warnings = webCapabilityWarnings(readConfig(configPath) ?? postAddConfig);
|
|
513
|
-
emitCreated({ name, agentId, workspace, warnings });
|
|
673
|
+
// --- 12. Declare created — carry the identity + the bound channel (honesty rail) ---
|
|
674
|
+
const warnings = [...webCapabilityWarnings(readConfig(configPath) ?? postAddConfig), ...bindWarnings];
|
|
675
|
+
emitCreated({ name, agentId, workspace, boundChannel, warnings });
|
|
514
676
|
}
|
|
515
677
|
|
|
516
678
|
main();
|
package/sil-shopping/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sil-shopping
|
|
3
|
-
description:
|
|
3
|
+
description: 'Use for any sil shopping, identity, or shopper-setup intent: register or sign in, check the account, search the sil catalog for purchasable products, or look up products by id — plus the single-shopper lifecycle: create the shopper (a short two-touchpoint onboarding), see what it knows or which domains (niches) it has learned, view or forget a domain, refine it — or, as the shopper, run a Spec-Driven Shopping query on any niche and remember a fact or buying taste it surfaces. Drives sil_register, sil_whoami, sil_search, sil_product_get, sil_profile_materialize, sil_profile_get, sil_profile_remove, and sil_remember.'
|
|
4
4
|
metadata:
|
|
5
5
|
openclaw:
|
|
6
6
|
emoji: "\U0001F6D2"
|
|
@@ -8,68 +8,111 @@ metadata:
|
|
|
8
8
|
|
|
9
9
|
# sil-shopping
|
|
10
10
|
|
|
11
|
-
Drive the sil plugin's tools on the user's behalf: register them
|
|
11
|
+
Drive the sil plugin's tools on the user's behalf: register them, read their
|
|
12
|
+
identity, help them find purchasable products — and, when asked, set up their
|
|
13
|
+
**shopper** (one sil-wired agent that shops every niche), then see what it knows,
|
|
14
|
+
view or forget a domain, or refine it. Read intent, route to the matching tool
|
|
15
|
+
(loading its reference on demand), call it, and report what came back.
|
|
12
16
|
|
|
13
|
-
## Always-on
|
|
17
|
+
## Always-on contract
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- **
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
- **Act, don't narrate.** When intent maps to a tool, call it — don't re-confirm
|
|
20
|
+
what was already stated.
|
|
21
|
+
- **Follow the tool's own `recovery`.** Every tool returns a `status`; on a
|
|
22
|
+
non-`ok` one, say what happened and follow that tool's `recovery` hint, never
|
|
23
|
+
improvise another. The taxonomy lives in
|
|
24
|
+
[`references/catalog_tools_reference.md`](references/catalog_tools_reference.md).
|
|
25
|
+
- **Prices are point-in-time.** Before the user buys, re-fetch the item with
|
|
26
|
+
`sil_product_get` rather than trusting an earlier `sil_search` snapshot.
|
|
20
27
|
|
|
21
28
|
## Session start
|
|
22
29
|
|
|
23
|
-
Confirm the `sil_*` tools are exposed. If they are missing
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- **Empty store (no shopper yet):** introduce the shopper in one short beat and offer to set it up. Name the value in its own terms — it shops each niche in depth, reuses the sizes and hard limits it already knows so nothing is re-asked, and explains why each pick fits — a standing buyer's advisor, not a one-off search. Only on a yes, load [`references/brainstorm_interview.md`](references/brainstorm_interview.md) (a two-touchpoint onboarding, never a form). Take no for an answer: bare `sil_search` stays a first-class path, so don't re-offer in the same turn.
|
|
30
|
-
- **A shopper already exists:** skip this beat entirely. The shopper is a singleton — never offer a second one.
|
|
30
|
+
Confirm the `sil_*` tools are exposed. If they are missing, the host is filtering
|
|
31
|
+
them — run the shipped admission helper `sil-openclaw-allowlist` (it additively
|
|
32
|
+
admits sil at `plugins.allow` + `tools.alsoAllow`), then reopen the session. Most
|
|
33
|
+
flows need an identity: calling a catalog tool first lets an unregistered outcome
|
|
34
|
+
route to `sil_register`, or run `sil_register` up front when intent requires it.
|
|
31
35
|
|
|
32
|
-
##
|
|
36
|
+
## Routing — read the stage, then match intent to a tool
|
|
33
37
|
|
|
34
|
-
|
|
38
|
+
**Read the stage from state — never guess it.** Two cheap reads settle it:
|
|
39
|
+
`sil_whoami` (is a sil identity **registered** yet?) and the no-arg
|
|
40
|
+
`sil_profile_get` overview (its **`name` field** is the whole discriminator —
|
|
41
|
+
present only once a shopper exists).
|
|
35
42
|
|
|
36
|
-
|
|
43
|
+
- **No identity** ⇒ guide the user to register.
|
|
44
|
+
- **`name` absent ⇒ profile-less stage** — bare shopping is a first-class quick
|
|
45
|
+
lookup; the setup path is offered alongside it.
|
|
46
|
+
- **`name` present ⇒ shopper stage** — shop through what you know about the person.
|
|
37
47
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
48
|
+
[`references/setup_onboarding.md`](references/setup_onboarding.md) owns the setup
|
|
49
|
+
script — the staged ladder, the after-register offer, the per-search pitch. Load
|
|
50
|
+
it while setup is incomplete; it sheds once a shopper exists.
|
|
41
51
|
|
|
42
|
-
|
|
52
|
+
### Intent → tool (load the reference on demand)
|
|
43
53
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
| Intent | Tool | Reference to load |
|
|
54
|
+
| Intent | Tool | Reference |
|
|
47
55
|
|---|---|---|
|
|
48
|
-
| "sign me up" / "log me in
|
|
49
|
-
| "who am I?" /
|
|
50
|
-
| "find X" / "search for X" / browse a category or price range | `sil_search` | [`
|
|
51
|
-
| "look up these items" / re-check ids from a prior result
|
|
52
|
-
| "set up an agent that shops for me" / "create my shopper" | (onboarding, then the engine) |
|
|
53
|
-
| "what does my shopper know?" / "which domains has it learned?" | `sil_profile_get` (no `domainSlug`
|
|
54
|
-
| "show me the
|
|
55
|
-
| "forget
|
|
56
|
-
| (as the shopper) a shopping intent
|
|
57
|
-
| "remember this" — a fact or
|
|
58
|
-
| "refine / sharpen my shopper" /
|
|
59
|
-
|
|
60
|
-
[`references/catalog_tools_reference.md`](references/catalog_tools_reference.md)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
56
|
+
| "sign me up" / "log me in" / "register" | `sil_register` | [`catalog_tools_reference.md`](references/catalog_tools_reference.md) |
|
|
57
|
+
| "who am I?" / show my saved name + addresses | `sil_whoami` | [`catalog_tools_reference.md`](references/catalog_tools_reference.md) |
|
|
58
|
+
| "find X" / "search for X" / browse a category or price range | `sil_search` | [`catalog_tools_reference.md`](references/catalog_tools_reference.md) |
|
|
59
|
+
| "look up these items" / re-check ids from a prior result | `sil_product_get` | [`catalog_tools_reference.md`](references/catalog_tools_reference.md) |
|
|
60
|
+
| "set up an agent that shops for me" / "create my shopper" | (onboarding, then the engine) | the two-step below |
|
|
61
|
+
| "what does my shopper know?" / "which domains has it learned?" | `sil_profile_get` (no `domainSlug`) | [`manage_domains.md`](references/manage_domains.md) |
|
|
62
|
+
| "show me the <niche> domain" | `sil_profile_get` (`domainSlug`) | [`manage_domains.md`](references/manage_domains.md) |
|
|
63
|
+
| "forget the <niche> domain" | `sil_profile_remove` | [`manage_domains.md`](references/manage_domains.md) |
|
|
64
|
+
| (as the shopper) a shopping intent on any niche | `sil_search` → `sil_product_get` | [`shop_loop.md`](references/shop_loop.md) |
|
|
65
|
+
| "remember this" — a fact or taste the shopper surfaced | `sil_remember` | [`shop_loop.md`](references/shop_loop.md) |
|
|
66
|
+
| "refine / sharpen my shopper" / fix a niche | (load → propose → confirm → persist) | [`refine_shopper.md`](references/refine_shopper.md) |
|
|
67
|
+
|
|
68
|
+
[`references/catalog_tools_reference.md`](references/catalog_tools_reference.md)
|
|
69
|
+
holds the per-tool behaviour + status taxonomy — basic shopping needs only that.
|
|
70
|
+
The answer→`sil_search`-param mapping is
|
|
71
|
+
[`references/search_param_mapping.md`](references/search_param_mapping.md); a full
|
|
72
|
+
run is
|
|
73
|
+
[`examples/multi_domain_shopper_walkthrough.md`](examples/multi_domain_shopper_walkthrough.md).
|
|
74
|
+
|
|
75
|
+
**Setting up the shopper — the endorsement-gated two-step.** The shopper is a
|
|
76
|
+
singleton (refused once one exists). (1) **Onboard first:** run
|
|
77
|
+
[`references/brainstorm_interview.md`](references/brainstorm_interview.md), the
|
|
78
|
+
two-touchpoint onboarding. (2) **Only after** the user explicitly **endorses** the
|
|
79
|
+
assembled draft, run
|
|
80
|
+
[`references/agent_creation_engine.md`](references/agent_creation_engine.md), the
|
|
81
|
+
engine that persists the one sil-wired shopper. No engine step runs before that
|
|
82
|
+
endorsement.
|
|
83
|
+
|
|
84
|
+
### Profile-less stage — the bare lane stays bare
|
|
85
|
+
|
|
86
|
+
**`name` absent.** A shopping intent takes the "find X" → `sil_search` row above
|
|
87
|
+
**unchanged** — no domain check, no mint, no pre-search question. Bare search is a
|
|
88
|
+
legitimate quick lookup; the only nudge is the profile-less per-search pitch
|
|
89
|
+
([`references/setup_onboarding.md`](references/setup_onboarding.md)).
|
|
90
|
+
|
|
91
|
+
### Shopper stage — shop through what you know
|
|
92
|
+
|
|
93
|
+
**`name` present.** As the shopper, shop through what you know about the person:
|
|
94
|
+
classify the query's niche and **reuse a learned domain or mint one before
|
|
95
|
+
searching** — the shop loop's first beat — then follow
|
|
96
|
+
[`references/shop_loop.md`](references/shop_loop.md), the profile-driven
|
|
97
|
+
**Spec-Driven Shopping** loop that web-refreshes the domain, decomposes the
|
|
98
|
+
request, and persists each surfaced fact or taste with a single `sil_remember`.
|
|
99
|
+
|
|
100
|
+
- **An empty `domains` map means no niche yet:** the first shopping intent **mints
|
|
101
|
+
the domain before searching**, **announced** with the inferred niche stated so
|
|
102
|
+
the user can correct it — never a silent mint.
|
|
103
|
+
|
|
104
|
+
This shapes the shopper's **reasoning, not the user's inbox**: a reused domain plus
|
|
105
|
+
a fully-resolved query **passes straight through, asking nothing**. It scopes to
|
|
106
|
+
`sil_search`-driven product discovery only — identity (`sil_register` /
|
|
107
|
+
`sil_whoami`), a direct `sil_product_get` id re-check, and shopper-management
|
|
108
|
+
intents (view / forget a domain) route normally, **ungated**.
|
|
109
|
+
|
|
110
|
+
**Per-query self-check (prose, not a tool).** As you shop, keep track of which
|
|
111
|
+
beat you're on and that you resolved the domain before searching — an in-context
|
|
112
|
+
guardrail, not a new tool, table, or telemetry surface.
|
|
113
|
+
|
|
114
|
+
Management + refinement load on demand:
|
|
115
|
+
[`references/manage_domains.md`](references/manage_domains.md) (view/forget,
|
|
116
|
+
confirm-before-remove) and
|
|
117
|
+
[`references/refine_shopper.md`](references/refine_shopper.md) (sharpen from observed
|
|
118
|
+
sessions, confirm-before-persist).
|