sil-openclaw 0.4.5 → 0.5.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 +186 -0
- package/README.md +33 -45
- package/dist/gateway/search-results.js +11 -7
- package/dist/index.js +24 -24
- package/dist/lib/allowlist-script.js +13 -0
- package/dist/lib/artifacts.js +30 -0
- package/dist/lib/credentials.js +2 -3
- package/dist/lib/host-wiring.js +44 -15
- package/dist/lib/pkce.js +3 -3
- package/dist/lib/search-results-log.js +23 -0
- package/dist/lib/search-results-store.js +13 -10
- package/dist/lib/shopping-call.js +143 -0
- package/dist/lib/sil-client.js +185 -1046
- package/dist/lib/tool-result.js +10 -3
- package/dist/tools/catalog.js +311 -1197
- package/dist/tools/doctor.js +25 -63
- package/dist/tools/identity.js +110 -245
- package/openclaw.plugin.json +16 -12
- package/package.json +7 -6
- package/schema/PROVENANCE.md +15 -0
- package/schema/shopping-brief-create-request.schema.json +98 -0
- package/schema/shopping-brief-create-response.schema.json +24 -0
- package/schema/shopping-brief-edit-request.schema.json +125 -0
- package/schema/shopping-brief-edit-response.schema.json +24 -0
- package/schema/shopping-brief-read-request.schema.json +15 -0
- package/schema/shopping-brief-read-response.schema.json +235 -0
- package/schema/shopping-domain-create-request.schema.json +160 -0
- package/schema/shopping-domain-create-response.schema.json +60 -0
- package/schema/shopping-domain-get-request.schema.json +18 -0
- package/schema/shopping-domain-get-response.schema.json +307 -0
- package/schema/shopping-domain-search-request.schema.json +18 -0
- package/schema/shopping-domain-search-response.schema.json +92 -0
- package/schema/shopping-offers-request.schema.json +31 -0
- package/schema/shopping-offers-response.schema.json +172 -0
- package/schema/shopping-product-get-request.schema.json +24 -0
- package/schema/shopping-product-get-response.schema.json +121 -0
- package/schema/shopping-profile-edit-request.schema.json +97 -0
- package/schema/shopping-profile-edit-response.schema.json +17 -0
- package/schema/shopping-search-request.schema.json +106 -0
- package/schema/shopping-search-response.schema.json +182 -0
- package/schema/shopping-seller-get-request.schema.json +24 -0
- package/schema/shopping-seller-get-response.schema.json +342 -0
- package/scripts/allowlist-openclaw.mjs +4 -5
- package/sil-shopping/SKILL.md +196 -97
- package/sil-shopping/references/mint.md +190 -0
- package/dist/lib/bind-channel.js +0 -10
- package/dist/lib/creation-entrypoint.js +0 -111
- package/dist/lib/derive-agent-id.js +0 -36
- package/dist/lib/profile-store.js +0 -568
- package/dist/tools/profile.js +0 -300
- package/scripts/create-shopper.mjs +0 -677
- package/sil-shopping/examples/multi_domain_shopper_walkthrough.md +0 -65
- package/sil-shopping/references/agent_creation_engine.md +0 -223
- package/sil-shopping/references/fill_and_feedback.md +0 -102
- package/sil-shopping/references/method_and_prds.md +0 -143
- package/sil-shopping/references/setup_onboarding.md +0 -64
- package/sil-shopping/references/shop_loop.md +0 -118
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The runnable paths of the plugin's shipped operator scripts — resolved from
|
|
3
|
-
* this module's own location, because the agent cannot derive them.
|
|
4
|
-
*
|
|
5
|
-
* WHY THIS EXISTS: a bare bin name (`sil-openclaw-create-shopper`) is on PATH
|
|
6
|
-
* only when a global npm-style install links it. `openclaw plugins install` just
|
|
7
|
-
* extracts the tarball and links nothing, so on that channel the documented
|
|
8
|
-
* creation command did not exist and the flow died at its last step.
|
|
9
|
-
*
|
|
10
|
-
* WHY NOT "resolve it from the skill file's location": the host publishes plugin
|
|
11
|
-
* skills as SYMLINKS into its config tree and hands the agent the symlink path
|
|
12
|
-
* deliberately. Node's `path.resolve()` normalizes `..` LEXICALLY, before
|
|
13
|
-
* touching the filesystem, so a `<skilldir>/../scripts/x` hop is erased and the
|
|
14
|
-
* loader looks beside the symlink, not beside the real file. `cat` and `ls`
|
|
15
|
-
* succeed on the exact string `node` rejects with MODULE_NOT_FOUND — a trap that
|
|
16
|
-
* hand-testing certifies as working. The plugin process's own `import.meta.url`
|
|
17
|
-
* is the ONLY sound root, so the plugin reports the path and the agent runs it.
|
|
18
|
-
*
|
|
19
|
-
* The root derivation mirrors `version-advisory.ts` — two levels up reaches the
|
|
20
|
-
* plugin root from both `src/lib/` and `dist/lib/`. Never cwd (production cwd is
|
|
21
|
-
* the agent's workspace, and cwd passes every test run from the repo root), never
|
|
22
|
-
* PATH, never the user's home, never a hardcoded install path.
|
|
23
|
-
*
|
|
24
|
-
* This module spawns nothing: reachability is a filesystem read. Naming a path is
|
|
25
|
-
* not running it, which is what keeps `security.noChildProcess` true.
|
|
26
|
-
*/
|
|
27
|
-
import { statSync } from "node:fs";
|
|
28
|
-
import { dirname, join } from "node:path";
|
|
29
|
-
import { fileURLToPath } from "node:url";
|
|
30
|
-
/**
|
|
31
|
-
* THE literal. `sil_doctor` reports this path and probes this path, the skill
|
|
32
|
-
* prose documents it, and `package.json#bin` maps it — one constant, so the
|
|
33
|
-
* reported path and the probed path cannot drift. A doctor that certifies a path
|
|
34
|
-
* it never probed is the same class of lie this module exists to kill.
|
|
35
|
-
*/
|
|
36
|
-
export const CREATION_ENTRYPOINT_RELATIVE = "scripts/create-shopper.mjs";
|
|
37
|
-
/** The creation entrypoint's sibling. It lives here for the same reason and by
|
|
38
|
-
* the same root: `wiring.tools_not_admitted` used to hand ClawHub operators a
|
|
39
|
-
* bare bin name too — doctor's own advice, unrunnable on the channel it
|
|
40
|
-
* diagnoses. One root derivation, one place. */
|
|
41
|
-
export const ALLOWLIST_SCRIPT_RELATIVE = "scripts/allowlist-openclaw.mjs";
|
|
42
|
-
const PLUGIN_ROOT = join(dirname(fileURLToPath(import.meta.url)), "..", "..");
|
|
43
|
-
export function resolveCreationEntrypoint() {
|
|
44
|
-
return join(PLUGIN_ROOT, CREATION_ENTRYPOINT_RELATIVE);
|
|
45
|
-
}
|
|
46
|
-
export function resolveAllowlistScript() {
|
|
47
|
-
return join(PLUGIN_ROOT, ALLOWLIST_SCRIPT_RELATIVE);
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Probe the entrypoint — a local `stat`, so it stays determinate with the
|
|
51
|
-
* network down.
|
|
52
|
-
*
|
|
53
|
-
* `unresolvable` is not padding: ENOENT means the tarball shipped incomplete,
|
|
54
|
-
* while an unreadable parent or a non-file at the path means something else is
|
|
55
|
-
* wrong with the tree. They are the same severity but not the same sentence, and
|
|
56
|
-
* the operator's next move depends on which one it is.
|
|
57
|
-
*/
|
|
58
|
-
export function probeCreationEntrypoint(entrypoint = resolveCreationEntrypoint()) {
|
|
59
|
-
try {
|
|
60
|
-
return statSync(entrypoint).isFile() ? "present" : "unresolvable";
|
|
61
|
-
}
|
|
62
|
-
catch (err) {
|
|
63
|
-
return err.code === "ENOENT"
|
|
64
|
-
? "missing"
|
|
65
|
-
: "unresolvable";
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* A singleton subsystem check, so it reports EVERY run and says `ok` when
|
|
70
|
-
* healthy — `fixed → re-run → ok` needs the id to still be there after the fix.
|
|
71
|
-
* Hence a `Finding`, never `Finding | null`: an advisory-only builder could not
|
|
72
|
-
* tell "reachable" from "never checked".
|
|
73
|
-
*
|
|
74
|
-
* Pure — the caller does the I/O and hands in the verdict. That is what makes the
|
|
75
|
-
* no-bare-bin guarantee cheap to assert totally, over every verdict.
|
|
76
|
-
*
|
|
77
|
-
* `warn`, not `critical`: by the doctor's ladder critical means the core path is
|
|
78
|
-
* broken, and a plugin that broken could not run a tool to say so. The plugin
|
|
79
|
-
* runs fine here — one flow cannot. `warn` is also the load-bearing half: it is
|
|
80
|
-
* what makes `healthy` false.
|
|
81
|
-
*/
|
|
82
|
-
export function buildCreationEntrypointFinding(entrypoint, verdict) {
|
|
83
|
-
const id = "creation.entrypoint_present";
|
|
84
|
-
if (verdict === "present") {
|
|
85
|
-
return {
|
|
86
|
-
id,
|
|
87
|
-
severity: "info",
|
|
88
|
-
status: "ok",
|
|
89
|
-
detected: `The shopper-creation entrypoint ${entrypoint} is present and runnable.`,
|
|
90
|
-
suggestedAction: null,
|
|
91
|
-
appliedAction: null,
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
return {
|
|
95
|
-
id,
|
|
96
|
-
severity: "warn",
|
|
97
|
-
status: "advisory",
|
|
98
|
-
detected: verdict === "missing"
|
|
99
|
-
? `The shopper-creation entrypoint ${entrypoint} is missing, so creating`
|
|
100
|
-
+ " a shopper would fail at its last step."
|
|
101
|
-
: `The shopper-creation entrypoint ${entrypoint} could not be read as a`
|
|
102
|
-
+ " file, so creating a shopper would fail at its last step.",
|
|
103
|
-
// Never a bare bin name and never a PATH edit: this diagnoses an incomplete
|
|
104
|
-
// plugin tree, and the recovery must be runnable on the channel it is being
|
|
105
|
-
// read on. `openclaw` itself is always on PATH — that is the whole premise.
|
|
106
|
-
suggestedAction: "Reinstall the sil plugin through OpenClaw's own plugin install path (for"
|
|
107
|
-
+ " example `openclaw plugins install @4gpts/sil`), then reload — the"
|
|
108
|
-
+ " plugin tree is incomplete. sil never reinstalls itself.",
|
|
109
|
-
appliedAction: null,
|
|
110
|
-
};
|
|
111
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Derive a shopper's host `agentId` from its ONE friendly display `name`.
|
|
3
|
-
*
|
|
4
|
-
* Onboarding used to make the user invent TWO names for one shopper — a lower-kebab
|
|
5
|
-
* `agentId` AND a friendly display `name`. The id is pure host plumbing (a workspace
|
|
6
|
-
* path segment, the `/agent <id>` switch handle, the channel-bind target) the user
|
|
7
|
-
* should never author. `create-shopper` now takes only the `name`; the bin derives the
|
|
8
|
-
* id here, so the id never surfaces as a second thing the user has to get right.
|
|
9
|
-
*
|
|
10
|
-
* The slug: NFKD-normalize + strip combining marks (so `Café`/`Málaga` keep their base
|
|
11
|
-
* letters — `cafe`, `malaga` — instead of splitting mid-word on the accent) → lowercase
|
|
12
|
-
* → collapse each run of non-`[a-z0-9]` to a single hyphen → trim edge hyphens. An empty
|
|
13
|
-
* slug (emoji-only / punctuation-only name) OR the host-reserved `main` both fold to the
|
|
14
|
-
* `sil-shopper` fallback — the display `name` the user chose stays intact; only the
|
|
15
|
-
* plumbing id falls back, silently.
|
|
16
|
-
*
|
|
17
|
-
* Pure and total: no I/O, no host, no throw. For ANY string the result satisfies the
|
|
18
|
-
* postcondition `AGENT_ID_RE` (`^[a-z0-9][a-z0-9-]*$`) and is never `main` — so the bin
|
|
19
|
-
* needs no runtime re-validation of the derived id.
|
|
20
|
-
*/
|
|
21
|
-
/** The lower-kebab shopper-id shape — never `main` (host-reserved). The postcondition
|
|
22
|
-
* every `deriveAgentId` result satisfies; also the bin's documented DERIVED shape. */
|
|
23
|
-
export const AGENT_ID_RE = /^[a-z0-9][a-z0-9-]*$/;
|
|
24
|
-
/** Fallback id when the slug is empty or lands on the host-reserved `main`. */
|
|
25
|
-
const FALLBACK_AGENT_ID = "sil-shopper";
|
|
26
|
-
/** The one host-reserved id a derived slug must never become. */
|
|
27
|
-
const RESERVED_AGENT_ID = "main";
|
|
28
|
-
export function deriveAgentId(name) {
|
|
29
|
-
const slug = name
|
|
30
|
-
.normalize("NFKD")
|
|
31
|
-
.replace(/\p{M}/gu, "")
|
|
32
|
-
.toLowerCase()
|
|
33
|
-
.replace(/[^a-z0-9]+/g, "-")
|
|
34
|
-
.replace(/^-+|-+$/g, "");
|
|
35
|
-
return slug === "" || slug === RESERVED_AGENT_ID ? FALLBACK_AGENT_ID : slug;
|
|
36
|
-
}
|