sil-openclaw 0.2.2 → 0.2.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 CHANGED
@@ -10,6 +10,72 @@ release (`clawhub package publish --changelog`). See [README](./README.md#releas
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.2.4] - 2026-06-18
14
+
15
+ ### Fixed
16
+
17
+ - **`sil_register` now steers users into their device's default browser before the
18
+ Auth0 leg, so registration completes first-try from in-app/embedded webviews.** An
19
+ auth link opened in an app's built-in webview dead-ends — Auth0 can't set its
20
+ session cookie in a partitioned webview, so login bounces with `?error=`. The
21
+ `awaiting_browser` return now carries an explicit instruction, in both the
22
+ human-facing `message` and the agent-facing `instructions`, to open the link in the
23
+ **default browser (Safari, Chrome, …), not this app's built-in browser** — before
24
+ the link is ever opened, steering a webview user out ahead of the Auth0 leg. The
25
+ `auth_url` value is byte-for-byte unchanged and the link stays atomically
26
+ angle-bracket-wrapped on its own line (the #24 invariants hold); no new tool and no
27
+ webview detection (the host exposes no surface signal, so the steer ships
28
+ unconditionally). (#25)
29
+
30
+ ## [0.2.3] - 2026-06-16
31
+
32
+ ### Added
33
+
34
+ - **`sil_search` and `sil_product_get` now surface evaluate-before-buy detail.**
35
+ Beyond the purchasable variant, results carry — where the source provides them —
36
+ the product/variant `url` (the page to VIEW / learn more, distinct from the
37
+ buy-committing `checkout_url`), a short `description`, `media`, the product
38
+ `options` menu, the `seller` with its policy/info links (shipping & return/refund
39
+ policies, terms), and arbitrary `metadata`. The tool descriptions teach the three
40
+ distinct actions — VIEW (`url`), DIG IN (`seller.links`), BUY (`checkout_url`) — so
41
+ an agent can compare, answer "what's their return policy?", and hand back the right
42
+ link without conflating viewing with buying. (#23)
43
+
44
+ ### Changed
45
+
46
+ - **`sil_search`: replaced the `ships_from` filter with a `local_merchants` boolean
47
+ bias.** It nudges shops based in the shopper's own country up the ranking,
48
+ best-effort — it does NOT restrict results to them (some local shops go
49
+ undetected, some non-local ones still appear). The agent passes no country: sil
50
+ resolves it server-side from the registered address. To actually surface local
51
+ stores, issue the `query` in the shopper's own language (a French query surfaces
52
+ French shops). (#20)
53
+
54
+ ### Fixed
55
+
56
+ - **A catalog `422 source_rejected` is now classified non-retryable
57
+ `invalid_request`, not source-named `retryable`.** A real source *rejection*
58
+ (the source looked at the request and refused it — it can never succeed
59
+ unchanged) was falling through to `retryableFromBody`, and because the 422 body
60
+ carries a `source` it surfaced as the source-named `retryable` (outcome b) — a
61
+ false instruction that told the agent to retry a doomed request while the real
62
+ upstream cause was buried as a transient `detail`. Both catalog classifiers
63
+ (`classifySearchResponse` / `classifyLookupResponse`, backing `sil_search` /
64
+ `sil_product_get`) now special-case `422 → invalid_request` carrying the
65
+ upstream `{ error, message }`, mirroring the existing `400` arm. The narrowing
66
+ is exact: a `5xx`/`429 source_unavailable` stays `retryable`.
67
+
68
+ - **`sil_search` / `sil_product_get` surface `user_not_provisioned` as a distinct
69
+ `forbidden` outcome and clear the structurally-dead token**, so the next
70
+ `sil_register` re-onboards the user instead of short-circuiting to
71
+ `already_registered`. A `principal_mismatch` or unknown 403 reason stays
72
+ recoverable and is NOT cleared. (#21)
73
+
74
+ - **Catalog transient (5xx) failures now name the failed source** when the wire
75
+ carries one — "the catalog source X is temporarily unavailable; sil itself is
76
+ fine" — instead of mis-attributing one degraded source to sil being down, which
77
+ would make the agent abandon a healthy platform. (#19)
78
+
13
79
  ## [0.2.2] - 2026-06-13
14
80
 
15
81
  ### Fixed
package/README.md CHANGED
@@ -14,13 +14,13 @@
14
14
  *You say what you want. Your agent searches the catalog, compares, and hands you a ready-to-buy link.*
15
15
  *No store. No tabs. No forms.*
16
16
 
17
- [![license](https://img.shields.io/badge/license-Apache--2.0-blue)](./LICENSE)
18
- [![npm](https://img.shields.io/badge/npm-sil--openclaw-cb3837?logo=npm&logoColor=white)](https://www.npmjs.com/package/sil-openclaw)
17
+ [![license](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/Context4GPTs/sil-openclaw/blob/main/LICENSE)
18
+ [![npm](https://img.shields.io/npm/v/sil-openclaw?logo=npm&logoColor=white&color=cb3837)](https://www.npmjs.com/package/sil-openclaw)
19
19
  [![ClawHub](https://img.shields.io/badge/ClawHub-sil-6f42c1)](https://clawhub.com)
20
20
  [![stars](https://img.shields.io/github/stars/Context4GPTs/sil-openclaw?color=f5b700)](https://github.com/Context4GPTs/sil-openclaw)
21
- [![last commit](https://img.shields.io/github/last-commit/Context4GPTs/sil-openclaw?color=9333ea)](https://github.com/Context4GPTs/sil-openclaw/commits)
21
+ [![last commit](https://img.shields.io/github/last-commit/Context4GPTs/sil-openclaw?color=9333ea)](https://github.com/Context4GPTs/sil-openclaw/commits/main)
22
22
 
23
- **[Website](https://4gpts.com)** · **[Changelog](./CHANGELOG.md)** · **[Security](./SECURITY.md)** · **[Follow on X](https://x.com/4gpts)**
23
+ **[Website](https://4gpts.com)** · **[Changelog](https://github.com/Context4GPTs/sil-openclaw/blob/main/CHANGELOG.md)** · **[Security](https://github.com/Context4GPTs/sil-openclaw/blob/main/SECURITY.md)** · **[Follow on X](https://x.com/4gpts)**
24
24
 
25
25
  ---
26
26
 
@@ -30,7 +30,7 @@
30
30
 
31
31
  ```bash
32
32
  # ClawHub (recommended)
33
- openclaw plugins install clawhub:sil
33
+ openclaw plugins install clawhub:@4gpts/sil
34
34
 
35
35
  # npm
36
36
  openclaw plugins install sil-openclaw
@@ -117,8 +117,8 @@ Namespaced `sil_*` so they never collide with other plugins. Your agent calls th
117
117
 
118
118
  | Tool | What it does |
119
119
  |---|---|
120
- | `sil_search` | Search for purchasable products. A free-text `query` plus optional filters: `category`, `price_min`/`price_max`, `ship_to` (delivery destination — leave empty to ship to your registered address), `ships_from` (merchant origin country), `condition` (`new` / `secondhand`), and `available`. Returns a ranked list of variants — each with `id`, `title`, `price`, `availability`, `checkout_url`, `source` — and a pagination `cursor`. Location filters take ISO codes (`US`, `CA`), not place names. |
121
- | `sil_product_get` | Resolve `ids` you already hold to full products in UCP shape — description, options, and the featured purchasable variant with fresh `price`, `availability`, and `checkout_url`. Re-fetch right before buying; those values are point-in-time, not guarantees. Ids that no longer resolve come back in `not_found`. |
120
+ | `sil_search` | Search for purchasable products. A free-text `query` plus optional filters: `category`, `price_min`/`price_max`, `ship_to` (delivery destination — leave empty to ship to your registered address), `condition` (`new` / `secondhand`), `available`, and `local_merchants` (best-effort bias toward shops in the user's own country). Results are **localized** to the shopper — issue the `query` in their own language for the best local results (e.g. search in French for French stores). Returns a ranked list of variants — each with `id`, `title`, `price`, `availability`, `checkout_url`, `source`, plus (where the source provides them) evaluate-before-buy detail: a product/variant `url` to view, a `description`, `media`, the product `options`, and the `seller`'s **shipping & return policy links** — and a pagination `cursor`. Location filters take ISO codes (`US`, `CA`), not place names. |
121
+ | `sil_product_get` | Resolve `ids` you already hold to full products in UCP shape — `description`, `options`, `media`, the `seller`'s shipping & return policy links, and the featured purchasable variant with fresh `price`, `availability`, `url` (the page to view), and `checkout_url` (the link that buys). Re-fetch right before buying; those values are point-in-time, not guarantees. Ids that no longer resolve come back in `not_found`. |
122
122
 
123
123
  ---
124
124
 
@@ -149,7 +149,7 @@ pnpm test # vitest (unit + integration)
149
149
  pnpm typecheck # tsc --noEmit
150
150
  ```
151
151
 
152
- Releasing is two steps: `pnpm version <patch|minor|major>` (bump → sync manifest → cut changelog → test → tag → push), then `pnpm release` (build → pack → npm `sil-openclaw` + ClawHub `@4gpts/sil` — the same contents, re-packed under each registry's name). Full guide in [`CLAUDE.md`](./CLAUDE.md#releasing); release notes in [`CHANGELOG.md`](./CHANGELOG.md). Adding a tool is three steps, enforced by a drift-guard test — see [`CLAUDE.md`](./CLAUDE.md#how-to-add-a-tool).
152
+ Releasing is two steps: `pnpm version <patch|minor|major>` (bump → sync manifest → cut changelog → test → tag → push), then `pnpm release` (build → pack → npm `sil-openclaw` + ClawHub `@4gpts/sil` — the same contents, re-packed under each registry's name). Release notes in [`CHANGELOG.md`](https://github.com/Context4GPTs/sil-openclaw/blob/main/CHANGELOG.md). Adding a tool is three steps, enforced by a drift-guard test.
153
153
 
154
154
  ---
155
155
 
@@ -69,9 +69,15 @@ export function startPoll(opts) {
69
69
  result = await opts.poll();
70
70
  }
71
71
  catch {
72
- // A throw from the injected step is treated as non-terminal: the
73
- // sil-client wrapper already maps network errors to a retryable result,
74
- // so this is belt-and-braces; let the next tick (within budget) retry.
72
+ // A throw from the injected step is treated as non-terminal — the next
73
+ // tick (within budget) retries. This is correct ONLY for the claim call:
74
+ // the sil-client wrapper already maps network errors to a `retryable`
75
+ // result, so a genuine throw here is a rare transient. A TERMINAL failure
76
+ // that must NOT be retried (e.g. the token-persist failure) is never a
77
+ // throw that reaches this catch — `claimStep` classifies it and RETURNS a
78
+ // `{ done: true, outcome: "persist_failed", error }` terminal, so the
79
+ // poller stays generic over `done` and the terminal settles like any
80
+ // other. Do not move classification of a throw into this catch.
75
81
  result = { done: false };
76
82
  }
77
83
  finally {
@@ -245,6 +245,12 @@ export function classifyIdentityResponse(status, body) {
245
245
  * retry or re-register)
246
246
  * 401 → unauthorized (the refresh trigger — the caller drives transparent
247
247
  * refresh-and-retry-once via `refreshAndRetryOnce`, not terminal)
248
+ * 403 → forbidden (terminal-but-recoverable; carries the actionable reason
249
+ * `user_not_provisioned`/`principal_mismatch`, defaulting to the generic
250
+ * `"forbidden"` marker on an unexpected body — parity with
251
+ * `classifyIdentityResponse`). A 403 is NOT a 401: it surfaces as the
252
+ * shared forbidden envelope, never the false-transient `retryable`, and a
253
+ * valid-but-unprovisioned token gains nothing from a refresh.
248
254
  * 5xx / other non-200 → retryable
249
255
  * 200 → read `products` off sil-api's FLAT envelope (`{ ucp, products,
250
256
  * pagination? }` — top level, no `result` wrapper), normalize, and require
@@ -258,7 +264,7 @@ export function classifyIdentityResponse(status, body) {
258
264
  *
259
265
  * Pure and exported — unit-tested in isolation like `classifyIdentityResponse`;
260
266
  * conflating the empty-match success with a partial-200 false-green, or with the
261
- * 400/401/5xx error classes, is the highest-risk subtle bug in this flow.
267
+ * 400/401/403/5xx error classes, is the highest-risk subtle bug in this flow.
262
268
  */
263
269
  export function classifySearchResponse(status, body) {
264
270
  if (status === 400) {
@@ -267,8 +273,22 @@ export function classifySearchResponse(status, body) {
267
273
  }
268
274
  if (status === 401)
269
275
  return { kind: "unauthorized" };
276
+ if (status === 403)
277
+ return { kind: "forbidden", reason: extractForbiddenReason(body) };
278
+ // 422 source_rejected: the source LOOKED at this exact request and refused it —
279
+ // it can never succeed unchanged, so it is non-retryable invalid_request carrying
280
+ // the real upstream cause, NOT the source-named `retryable` the fallthrough below
281
+ // would produce (a 422 body names a `source`, so `retryableFromBody` would emit
282
+ // outcome (b) and tell the agent to retry a doomed request). This is the third
283
+ // arm of the 401-vs-403-vs-422 split: 401 refresh-and-retry, 403 forbidden
284
+ // (refresh won't help), 422 invalid_request (fix the request, don't retry).
285
+ // Matches EXACTLY 422 — a 5xx/429 source_unavailable stays `retryable` (outcome b).
286
+ if (status === 422) {
287
+ const { error, message } = extractApiError(body);
288
+ return { kind: "invalid_request", error, message };
289
+ }
270
290
  if (status !== 200)
271
- return { kind: "retryable" };
291
+ return retryableFromBody(body);
272
292
  const result = extractSearchResult(body);
273
293
  if (result === null)
274
294
  return { kind: "retryable" };
@@ -286,6 +306,12 @@ export function classifySearchResponse(status, body) {
286
306
  * which never arises on the lookup route; do not special-case it.)
287
307
  * 401 → unauthorized (the refresh trigger — the caller drives transparent
288
308
  * refresh-and-retry-once via `refreshAndRetryOnce`, parity with search)
309
+ * 403 → forbidden (terminal-but-recoverable; carries the actionable reason
310
+ * `user_not_provisioned`/`principal_mismatch`, defaulting to the generic
311
+ * `"forbidden"` marker on an unexpected body — parity with search and
312
+ * `classifyIdentityResponse`). A 403 surfaces as the shared forbidden
313
+ * envelope, never the false-transient `retryable`; it is NOT a 401, so no
314
+ * refresh is triggered.
289
315
  * 5xx / other non-200 → retryable
290
316
  * 200 → read `products` off sil-api's FLAT envelope (`{ ucp, products,
291
317
  * messages? }` — top level, no `result` wrapper), normalize, and require
@@ -312,8 +338,20 @@ export function classifyLookupResponse(status, body) {
312
338
  }
313
339
  if (status === 401)
314
340
  return { kind: "unauthorized" };
341
+ if (status === 403)
342
+ return { kind: "forbidden", reason: extractForbiddenReason(body) };
343
+ // 422 source_rejected: the twin seam of `classifySearchResponse` — sil-api emits
344
+ // 422 on the SHARED source layer backing both catalog routes, so a source-rejected
345
+ // lookup is the same non-retryable invalid_request, carrying the upstream cause,
346
+ // NOT the source-named `retryable` the fallthrough would produce. Same one error
347
+ // vocabulary across both catalog tools (see this fn's doc-comment). Matches EXACTLY
348
+ // 422 — a 5xx/429 source_unavailable stays `retryable` (outcome b).
349
+ if (status === 422) {
350
+ const { error, message } = extractApiError(body);
351
+ return { kind: "invalid_request", error, message };
352
+ }
315
353
  if (status !== 200)
316
- return { kind: "retryable" };
354
+ return retryableFromBody(body);
317
355
  const result = extractLookupResult(body);
318
356
  if (result === null)
319
357
  return { kind: "retryable" };
@@ -576,8 +614,8 @@ function extractForbiddenReason(body) {
576
614
  * The tool clamps nothing and validates no cursor opacity — sil-api owns those.
577
615
  *
578
616
  * THE load-bearing rename: the agent arg `ship_to` (singular) becomes the wire key
579
- * `filters.ships_to` (plural). `ships_from`/`condition`/`available` keep their name
580
- * under `filters.*`. These four ride sil-api's OPEN `SearchFilters`
617
+ * `filters.ships_to` (plural). `condition`/`available` keep their name under
618
+ * `filters.*`. These three ride sil-api's OPEN `SearchFilters`
581
619
  * (`additionalProperties: true`), which SILENTLY accepts an unknown key — so the
582
620
  * exact emitted key name is the only thing standing between a working serviceability
583
621
  * filter and a no-op (a wrong rename fails GREEN). Each is forwarded ONLY when
@@ -586,13 +624,23 @@ function extractForbiddenReason(body) {
586
624
  * `available: false` is narrowed with `typeof === "boolean"`, never `if (v)`, so the
587
625
  * meaningful `false` (include unavailable items) survives.
588
626
  *
627
+ * `local_merchants` is the ONE field that does NOT ride `filters`. It is a
628
+ * sil-PRIVATE ranking-bias signal, not a UCP/Global-Catalog filter — `filters` is
629
+ * forwarded to the cross-shop Global Catalog, whose OPEN schema would silently
630
+ * accept and ignore an unknown `local_merchants` key (the exact wrong-placement
631
+ * no-op the rename hazard above warns of). So it is emitted at the TOP LEVEL of the
632
+ * body (beside `query`/`filters`/`pagination`), and ONLY when exactly `true`: unlike
633
+ * `available: false` (a meaningful include-unavailable signal that survives), a
634
+ * `false` bias carries NO signal (== the server's unbiased default), so `false` and
635
+ * absent both omit the key (narrow on the VALUE, not just the type — emit iff true).
636
+ *
589
637
  * COUNTRY-CASE NORMALIZATION is the wire layer's job (the read site owns FORMAT
590
- * rejection): `ships_to.country` and `ships_from.country` are emitted UPPERCASE
591
- * (`us` → `US`), the alpha-2 contract `@sil/schemas` `ShipTo`/`ShipFrom` mirrors
592
- * byte-for-byte. A lowercase code on the wire would diverge from the sibling and
593
- * (depending on the server's case-sensitivity) silently mis-filter. `region` and
594
- * `postal_code` are forwarded VERBATIM — they passed their pattern at the read site,
595
- * and the wire normalizes only country case.
638
+ * rejection): `ships_to.country` is emitted UPPERCASE (`us` → `US`), the alpha-2
639
+ * contract `@sil/schemas` `ShipTo` mirrors byte-for-byte. A lowercase code on the
640
+ * wire would diverge from the sibling and (depending on the server's
641
+ * case-sensitivity) silently mis-filter. `region` and `postal_code` are forwarded
642
+ * VERBATIM — they passed their pattern at the read site, and the wire normalizes
643
+ * only country case.
596
644
  */
597
645
  function buildSearchBody(params) {
598
646
  const body = {};
@@ -609,20 +657,25 @@ function buildSearchBody(params) {
609
657
  price["max"] = params.price_max;
610
658
  if (Object.keys(price).length > 0)
611
659
  filters["price"] = price;
612
- // The four serviceability/localization filters — the `ship_to` → `ships_to`
613
- // rename happens here; the other three keep their name. Country is uppercased
614
- // on emit (region/postal forwarded verbatim); the other three pass through as-is.
660
+ // The three serviceability/localization filters — the `ship_to` → `ships_to`
661
+ // rename happens here; the other two keep their name. Country is uppercased on
662
+ // emit (region/postal forwarded verbatim); the other two pass through as-is.
615
663
  if (params.ship_to !== undefined)
616
664
  filters["ships_to"] = withUppercaseCountry(params.ship_to);
617
- if (params.ships_from !== undefined) {
618
- filters["ships_from"] = withUppercaseCountry(params.ships_from);
619
- }
620
665
  if (params.condition !== undefined)
621
666
  filters["condition"] = params.condition;
622
667
  if (typeof params.available === "boolean")
623
668
  filters["available"] = params.available;
624
669
  if (Object.keys(filters).length > 0)
625
670
  body["filters"] = filters;
671
+ // `local_merchants` is a sil-PRIVATE ranking bias — it rides at the TOP LEVEL of
672
+ // the body (a sibling of `query`/`filters`/`pagination`), NEVER under `filters`
673
+ // (those are forwarded to the Global Catalog, which would silently swallow it).
674
+ // Emitted ONLY when exactly `true`: a `false`/absent bias carries no signal (it is
675
+ // the server's unbiased default), so — unlike `available:false` — it is omitted.
676
+ // Narrow on the VALUE, not just the type: `=== true`, never a truthiness coerce.
677
+ if (params.local_merchants === true)
678
+ body["local_merchants"] = true;
626
679
  const pagination = {};
627
680
  if (typeof params.cursor === "string")
628
681
  pagination["cursor"] = params.cursor;
@@ -632,10 +685,10 @@ function buildSearchBody(params) {
632
685
  body["pagination"] = pagination;
633
686
  return body;
634
687
  }
635
- /** Emit a ship-to/ships-from object with its alpha-2 `country` UPPERCASED on the
636
- * wire (`us` → `US`); every other field (`region`/`postal_code` on `ShipTo`) is
637
- * preserved verbatim. The spread-then-overwrite keeps the shape generic over both
638
- * {@link ShipTo} and {@link ShipsFrom} without reshaping or dropping a field. */
688
+ /** Emit a ship-to object with its alpha-2 `country` UPPERCASED on the wire
689
+ * (`us` → `US`); every other field (`region`/`postal_code` on {@link ShipTo}) is
690
+ * preserved verbatim. The spread-then-overwrite keeps the shape generic over any
691
+ * `{ country }`-bearing value without reshaping or dropping a field. */
639
692
  function withUppercaseCountry(value) {
640
693
  return { ...value, country: value.country.toUpperCase() };
641
694
  }
@@ -704,13 +757,20 @@ function projectProduct(raw) {
704
757
  const variant = projectVariant(variants[0]);
705
758
  if (variant === null)
706
759
  return null;
707
- return { id: productId, title: productTitle, source, variant };
760
+ const result = { id: productId, title: productTitle, source, variant };
761
+ attachProductEnrichment(result, product);
762
+ return result;
708
763
  }
709
764
  /**
710
765
  * Project a `SilCatalogVariant` to the agent-facing {@link SearchVariant}, or
711
766
  * null if it is not a usable purchasable variant. Requires `id`, `title`, a price
712
767
  * object, and a non-empty `checkout_url`; `price`/`availability` pass through
713
- * opaque.
768
+ * opaque. The PURCHASABILITY gate is unchanged — the enriched fields are additive
769
+ * context, never a new gate: a variant lacking a non-empty `checkout_url` is still
770
+ * dropped even when it carries `url`/`seller`/`media`.
771
+ *
772
+ * The enriched per-variant surface (`url`/`seller`/`media`/`metadata`) is attached
773
+ * via {@link attachVariantEnrichment}, each ONLY when present.
714
774
  */
715
775
  function projectVariant(raw) {
716
776
  const variant = asRecord(raw);
@@ -728,13 +788,15 @@ function projectVariant(raw) {
728
788
  const price = extractPrice(variant["price"]);
729
789
  if (price === null)
730
790
  return null;
731
- return {
791
+ const result = {
732
792
  id,
733
793
  title,
734
794
  price,
735
795
  availability: extractAvailability(variant["availability"]),
736
796
  checkout_url: checkoutUrl,
737
797
  };
798
+ attachVariantEnrichment(result, variant);
799
+ return result;
738
800
  }
739
801
  /**
740
802
  * Unwrap + narrow a sil-api catalog-LOOKUP response body to a typed
@@ -797,9 +859,6 @@ function projectLookupProduct(raw) {
797
859
  return null;
798
860
  if (typeof source !== "string" || source.length === 0)
799
861
  return null;
800
- const description = asRecord(product["description"]);
801
- if (description === null)
802
- return null;
803
862
  const priceRange = product["price_range"];
804
863
  if (asRecord(priceRange) === null)
805
864
  return null;
@@ -812,7 +871,6 @@ function projectLookupProduct(raw) {
812
871
  const result = {
813
872
  id,
814
873
  title,
815
- description,
816
874
  price_range: priceRange,
817
875
  source,
818
876
  variant,
@@ -823,6 +881,11 @@ function projectLookupProduct(raw) {
823
881
  const handle = product["handle"];
824
882
  if (typeof handle === "string" && handle.length > 0)
825
883
  result.handle = handle;
884
+ // `description` is now the `{ plain }` lift (ONE vocabulary with search), NOT the
885
+ // whole opaque object — omitted entirely when `plain` is absent/empty. Reuses the
886
+ // SAME product-enrichment attach as search so both tools surface the identical
887
+ // enriched shape (`url`/`description`/`media`/`options`/`metadata`).
888
+ attachProductEnrichment(result, product);
826
889
  return result;
827
890
  }
828
891
  /**
@@ -865,6 +928,10 @@ function projectLookupVariant(raw) {
865
928
  const inputs = extractInputs(variant["inputs"]);
866
929
  if (inputs !== null)
867
930
  result.inputs = inputs;
931
+ // The SAME enriched per-variant surface as search (ONE vocabulary):
932
+ // `url`/`seller`/`media`/`metadata`, each only when present. The variant's
933
+ // `options` SELECTIONS above and these enriched fields are distinct, additive.
934
+ attachVariantEnrichment(result, variant);
868
935
  return result;
869
936
  }
870
937
  /** Pass a wire array of objects through OPAQUE — filter to plain objects, preserve
@@ -881,6 +948,80 @@ function passThroughObjects(raw) {
881
948
  const objects = raw.filter((o) => asRecord(o) !== null);
882
949
  return objects.length === 0 ? null : objects;
883
950
  }
951
+ /** Pass a single wire OBJECT through OPAQUE — forward it verbatim when it is a
952
+ * plain object, never reading or remapping individual fields. The single-object
953
+ * counterpart to {@link passThroughObjects}, for `seller` and `metadata`: contextual
954
+ * data the tool SURFACES but does not interpret. This is the load-bearing
955
+ * narrow-vs-pass-through guard ([[sil-shared-catalog-client]]) — a typed
956
+ * `{ name, links }` narrow on `seller` would silently DROP the Shopify extension
957
+ * keys (`seller.url`/`seller.domain`) the source attaches, and pass a naive fixture;
958
+ * opaque pass-through keeps both the base shape and any extension/drift. An ARRAY is
959
+ * NOT a usable object here (a `seller`/`metadata` that arrived as `[]` is garbage),
960
+ * so arrays return null and the caller omits the key. */
961
+ function passThroughObject(raw) {
962
+ return raw !== null && typeof raw === "object" && !Array.isArray(raw)
963
+ ? raw
964
+ : null;
965
+ }
966
+ /** Lift the agent-facing {@link ProductDescription} (`{ plain }`) from a wire
967
+ * `description` object, or null to OMIT. Surfaces ONLY the `plain` UCP format, and
968
+ * ONLY when it is a non-empty string — `html`/`markdown` are never substituted into
969
+ * `plain` (the spec flags `html` as untrusted rich text), and an absent/empty `plain`
970
+ * omits the whole `description` key. This is the one SCALAR read in the enriched
971
+ * surface (a stable, named UCP sub-field), and lifting it identically on both catalog
972
+ * tools is what keeps them on ONE `description` shape. */
973
+ function liftDescriptionPlain(raw) {
974
+ const obj = asRecord(raw);
975
+ if (obj === null)
976
+ return null;
977
+ const plain = obj["plain"];
978
+ return typeof plain === "string" && plain.length > 0 ? { plain } : null;
979
+ }
980
+ /** Attach the enriched PRODUCT surface (`url`/`description`/`media`/`options`/
981
+ * `metadata`) onto a projected product, each ONLY when present on the wire object.
982
+ * Shared verbatim by `projectProduct` (search) and `projectLookupProduct` (lookup)
983
+ * so BOTH tools surface the IDENTICAL enriched shape — the ONE-vocabulary property.
984
+ * Mutates `target` in place (it is a freshly-built projection the caller owns). Every
985
+ * field is OPAQUE pass-through keyed on PRESENCE; the only scalar read is
986
+ * `description.plain`. Omit-when-absent is per-field — an absent / empty-`plain` /
987
+ * no-`metadata` / all-garbage-array field leaves its key off entirely (no null/''/[]). */
988
+ function attachProductEnrichment(target, product) {
989
+ const url = product["url"];
990
+ if (typeof url === "string" && url.length > 0)
991
+ target.url = url;
992
+ const description = liftDescriptionPlain(product["description"]);
993
+ if (description !== null)
994
+ target.description = description;
995
+ const media = passThroughObjects(product["media"]);
996
+ if (media !== null)
997
+ target.media = media;
998
+ const options = passThroughObjects(product["options"]);
999
+ if (options !== null)
1000
+ target.options = options;
1001
+ const metadata = passThroughObject(product["metadata"]);
1002
+ if (metadata !== null)
1003
+ target.metadata = metadata;
1004
+ }
1005
+ /** Attach the enriched per-VARIANT surface (`url`/`seller`/`media`/`metadata`) onto a
1006
+ * projected variant, each ONLY when present. Shared verbatim by `projectVariant`
1007
+ * (search) and `projectLookupVariant` (lookup) — the variant half of the
1008
+ * ONE-vocabulary property. `seller` (incl. `seller.links[]`) and `metadata` are
1009
+ * single-object opaque pass-through; `media` is array pass-through. Same
1010
+ * omit-when-absent, per-field, never-narrow discipline as the product surface. */
1011
+ function attachVariantEnrichment(target, variant) {
1012
+ const url = variant["url"];
1013
+ if (typeof url === "string" && url.length > 0)
1014
+ target.url = url;
1015
+ const seller = passThroughObject(variant["seller"]);
1016
+ if (seller !== null)
1017
+ target.seller = seller;
1018
+ const media = passThroughObjects(variant["media"]);
1019
+ if (media !== null)
1020
+ target.media = media;
1021
+ const metadata = passThroughObject(variant["metadata"]);
1022
+ if (metadata !== null)
1023
+ target.metadata = metadata;
1024
+ }
884
1025
  /** Narrow a wire `inputs` correlation array to {@link LookupInput}[] — each entry
885
1026
  * needs a non-empty `id` (the request id that resolved to this variant); a missing
886
1027
  * or non-string `match` is dropped (not coerced). Returns null when the field is
@@ -968,6 +1109,40 @@ function extractCursor(raw) {
968
1109
  const cursor = obj["cursor"];
969
1110
  return typeof cursor === "string" && cursor.length > 0 ? cursor : null;
970
1111
  }
1112
+ /**
1113
+ * Build the `retryable` outcome for a non-200, non-{400,401} response, attaching
1114
+ * the failed catalog `source` (+ a `detail` carrying the upstream cause) ONLY when
1115
+ * the 5xx body is a real `source_unavailable` SourceError that names a source.
1116
+ *
1117
+ * This is the seam where outcome (a) (sil/network down → bare retryable, generic
1118
+ * copy) and outcome (b) (a named source down → source-named retryable) become
1119
+ * distinguishable — see {@link SearchOutcome}. The gate is the PRESENCE of a real
1120
+ * non-empty-string `source` field on the body, NEVER the `message` prose: a
1121
+ * sil-internal 5xx (no `source`), a bodyless/garbage non-200, or a `source` that is
1122
+ * null/number/empty/object/array all fall back to the bare sourceless retryable.
1123
+ * Attaching a source to a non-source 5xx would re-introduce wrong attribution in
1124
+ * the opposite direction (a sil-down event falsely named as a source outage), so
1125
+ * the populate must never fabricate or coerce.
1126
+ *
1127
+ * `detail` is the upstream cause the consumer can relay — the body's `message`
1128
+ * when present, else its `error` code. It is only set alongside a real `source`
1129
+ * (an outcome-a retryable carries neither field).
1130
+ */
1131
+ function retryableFromBody(body) {
1132
+ const obj = asRecord(body);
1133
+ const source = obj?.["source"];
1134
+ if (typeof source !== "string" || source.length === 0) {
1135
+ return { kind: "retryable" };
1136
+ }
1137
+ const message = obj?.["message"];
1138
+ const error = obj?.["error"];
1139
+ const detail = typeof message === "string" && message.length > 0
1140
+ ? message
1141
+ : typeof error === "string" && error.length > 0
1142
+ ? error
1143
+ : source;
1144
+ return { kind: "retryable", source, detail };
1145
+ }
971
1146
  /** Pull sil-api's structured `{ error, message }` out of a 400 body, defaulting
972
1147
  * each field when the shape is unexpected so the agent always gets an actionable
973
1148
  * (if generic) hint rather than `undefined`. */
@@ -53,16 +53,16 @@ import { clearTokens, readTokens } from "../lib/credentials.js";
53
53
  import { lookupCatalog, refreshAndRetryOnce, searchCatalog, } from "../lib/sil-client.js";
54
54
  import { jsonResult } from "../lib/tool-result.js";
55
55
  /**
56
- * The TIGHTENED ship-to/ships-from format contract (founder re-spec 2026-06-11),
57
- * pinned as a `pattern` BOTH the local schema and sil-api's `@sil/schemas`
58
- * `ShipTo`/`ShipFrom` enforce IDENTICALLY (byte-for-byte) — so the plugin rejects a
59
- * malformed value client-side instead of forwarding free text and eating an opaque,
60
- * fail-late sil-api 400. These same patterns are the schema `pattern` (so the host
61
- * validates) AND the read-site format gate (so a drifted on-disk call is rejected),
62
- * defined once here to keep the two in lockstep. The sil-services sibling
56
+ * The TIGHTENED ship-to format contract (founder re-spec 2026-06-11), pinned as a
57
+ * `pattern` BOTH the local schema and sil-api's `@sil/schemas` `ShipTo` enforce
58
+ * IDENTICALLY (byte-for-byte) — so the plugin rejects a malformed value client-side
59
+ * instead of forwarding free text and eating an opaque, fail-late sil-api 400. These
60
+ * same patterns are the schema `pattern` (so the host validates) AND the read-site
61
+ * format gate (so a drifted on-disk call is rejected), defined once here to keep the
62
+ * two in lockstep. The sil-services sibling
63
63
  * (`attach-buyer-ship-to-context-server-side-in-sil-ap`) MUST mirror these exactly;
64
64
  * the sil-stage eval verifies it end-to-end.
65
- * - country (ships_to + ships_from): ISO 3166-1 alpha-2, a 2-letter code.
65
+ * - country (ships_to): ISO 3166-1 alpha-2, a 2-letter code.
66
66
  * - region: ISO 3166-2 subdivision code (CA/NY/BY/97), bounded — NOT a place name.
67
67
  * - postal_code: a single self-contained pattern (a length-cap lookahead 2–12
68
68
  * chars, separators counted, + a structural body of alnum runs joined by single
@@ -84,7 +84,21 @@ function registerSearch(api) {
84
84
  + " and/or filters (`category`, `price_min`/`price_max` in the currency's"
85
85
  + " minor units, e.g. cents). Returns a ranked list (best match first —"
86
86
  + " present results in order, do not re-rank), each item a purchasable"
87
- + " variant with id, title, price, availability, checkout_url, and source."
87
+ + " variant with id, title, price, availability, checkout_url, and source,"
88
+ + " plus (where the source provides them) the evaluate-before-buy fields:"
89
+ + " product and variant `url`, a short `description`, `media`, the product"
90
+ + " `options` (the menu of choices), the `seller` (with policy/info links),"
91
+ + " and arbitrary `metadata`. THREE DISTINCT ACTIONS the agent must not"
92
+ + " conflate: (1) VIEW — a product's or variant's `url` opens the PAGE to"
93
+ + " view / learn more; hand it to the user to SEE the item, it is NOT a"
94
+ + " purchase. (2) DIG IN — `seller.links` are the seller's policy / info"
95
+ + " links (refund policy, shipping policy, terms); follow one to answer"
96
+ + " \"what's their return policy?\" without a web search. (3) BUY —"
97
+ + " `checkout_url` is the variant permalink that commits the purchase; use it"
98
+ + " ONLY to buy. A variant's `url` and its `checkout_url` are DIFFERENT"
99
+ + " targets: `url` is the page (view / learn more) whereas `checkout_url`"
100
+ + " buys — never hand back `checkout_url` for a \"show me / learn more\""
101
+ + " intent, and never stall on `url` when the user said \"buy\"."
88
102
  + " Use the returned `cursor` to fetch the next page (its absence means no"
89
103
  + " more results — never infer end-of-results from the page size). An empty"
90
104
  + " result list means nothing matched (a normal outcome, not an error)."
@@ -103,12 +117,17 @@ function registerSearch(api) {
103
117
  + " code, NOT a country name); `region` (optional) = the ISO 3166-2 subdivision"
104
118
  + " code (CA, NY, BY — a code, NOT a place name); `postal_code` (optional) ="
105
119
  + " the destination postal/ZIP code. The other optional filters need no prior"
106
- + " tool call: `ships_from` (`{ country }`, the same 2-letter ISO 3166-1"
107
- + " alpha-2 code — US/GB/DE) restricts to a merchant ORIGIN country; `condition`"
108
- + " (array; the values are exactly \"new\" or \"secondhand\", lowercase) filters"
109
- + " by product condition; `available` (boolean) controls availability — the"
110
- + " server returns only sale-ready items by default, so set `available: false`"
111
- + " to INCLUDE out-of-stock/unavailable items. Requires registration (run"
120
+ + " tool call: `condition` (array; the values are exactly \"new\" or"
121
+ + " \"secondhand\", lowercase) filters by product condition; `available`"
122
+ + " (boolean) controls availability — the server returns only sale-ready items"
123
+ + " by default, so set `available: false` to INCLUDE out-of-stock/unavailable"
124
+ + " items. `local_merchants` (boolean) is a BEST-EFFORT BIAS toward shops based"
125
+ + " in the user's OWN country (home-country / domestic / local sellers) — set it"
126
+ + " ONLY when the shopper asks for local/domestic shops; it nudges local shops up"
127
+ + " the ranking but does NOT restrict results to them, so never tell the user the"
128
+ + " results are all local. To actually surface local shops, ALSO issue the"
129
+ + " `query` in the USER'S LANGUAGE (a Greek-language query surfaces Greek shops);"
130
+ + " pass NO country — sil resolves it server-side. Requires registration (run"
112
131
  + " sil_register first).",
113
132
  parameters: Type.Object({
114
133
  query: Type.Optional(Type.String({
@@ -156,15 +175,20 @@ function registerSearch(api) {
156
175
  + " default with a DIFFERENT destination than the registered address."
157
176
  + " Send ISO CODES, never free-text place names.",
158
177
  })),
159
- ships_from: Type.Optional(Type.Object({
160
- country: Type.String({
161
- pattern: COUNTRY_PATTERN,
162
- description: "Merchant origin country as a 2-letter ISO 3166-1 alpha-2 CODE (US,"
163
- + " GB, DE) — a code, NOT a country name.",
164
- }),
165
- }, {
166
- description: "Restrict results to products that ship FROM a given merchant origin"
167
- + " country (alpha-2 ISO code). Omit for no origin constraint.",
178
+ local_merchants: Type.Optional(Type.Boolean({
179
+ description: "Bias results toward shops based in the USER'S OWN country (home-country"
180
+ + " / domestic / local sellers) — set true ONLY when the shopper asks for"
181
+ + " local or domestic shops (e.g. \"buy from a Greek shop\", \"support"
182
+ + " local businesses\"). This is a BEST-EFFORT BIAS, NOT a filter: it"
183
+ + " nudges local shops up the ranking but does NOT restrict results to them"
184
+ + " and does NOT guarantee every result is local — some local shops won't"
185
+ + " be detected and some non-local shops may still appear, so never tell"
186
+ + " the user the results are all local sellers. To actually surface local"
187
+ + " shops, also issue the `query` in the USER'S LANGUAGE (a Greek-language"
188
+ + " query surfaces Greek shops; an English query will not). You pass NO"
189
+ + " country — sil resolves the user's country server-side from their"
190
+ + " registered address, so do NOT call sil_whoami or pass a country. Omit"
191
+ + " (or false) for the normal unbiased ranking.",
168
192
  })),
169
193
  condition: Type.Optional(Type.Array(Type.String(), {
170
194
  description: "Filter by product condition. The values are exactly \"new\" or"
@@ -244,12 +268,30 @@ function mapSearchOutcome(api, outcome) {
244
268
  switch (outcome.kind) {
245
269
  case "ok":
246
270
  return searchResult(outcome);
271
+ case "forbidden":
272
+ // A 403 surfaces the SAME forbidden envelope `sil_whoami` emits — never the
273
+ // false-transient `retryable`. On `user_not_provisioned` (and ONLY that exact
274
+ // reason) the held token maps to no account on this backend and a refresh
275
+ // cannot help — structurally dead, like the invalid_grant/second_unauthorized
276
+ // clears below — so clear it HERE (the tool call site, never the pure
277
+ // classifier) and the next sil_register re-onboards instead of short-circuiting
278
+ // to already_registered. A `principal_mismatch` / unknown reason can be
279
+ // transient and stays recoverable — it MUST NOT clear (the exact-equality gate
280
+ // is the correctness boundary: a startsWith/truthy check would wrongly wipe a
281
+ // good session).
282
+ api.logger.warn("sil_search_forbidden", { reason: outcome.reason });
283
+ if (outcome.reason === "user_not_provisioned")
284
+ clearTokens();
285
+ return forbidden(outcome.reason);
247
286
  case "invalid_request":
248
287
  api.logger.info("sil_search_invalid_request", { error: outcome.error });
249
288
  return invalidRequest(outcome.error, outcome.message);
250
289
  case "retryable":
251
- api.logger.info("sil_search_retryable", {});
252
- return transient("sil_search");
290
+ // A source-attributed 5xx names the failed source (outcome b); a sil/network
291
+ // blip carries no source and stays the generic copy (outcome a). The log marker
292
+ // records the source when present so a flaky source is visible to operators.
293
+ api.logger.info("sil_search_retryable", outcome.source ? { source: outcome.source } : {});
294
+ return transient("sil_search", outcome.source, outcome.detail);
253
295
  case "unauthorized":
254
296
  return mustReregister("sil_search");
255
297
  }
@@ -304,7 +346,17 @@ function registerProductGet(api) {
304
346
  + " Pass `ids` (one or more product/variant ids you already hold, e.g. from"
305
347
  + " a prior sil_search result) and get the matching products back with FRESH"
306
348
  + " detail: each product's description plus its featured purchasable variant"
307
- + " (id, title, price, availability, checkout_url, options). Re-fetch right"
349
+ + " (id, title, price, availability, checkout_url, options), and — where the"
350
+ + " source provides them — the same evaluate-before-buy fields sil_search"
351
+ + " surfaces: product and variant `url`, `media`, the product `options` menu,"
352
+ + " the `seller` (with policy/info links), and `metadata`. The SAME three"
353
+ + " distinct actions apply: (1) VIEW — a product's or variant's `url` opens"
354
+ + " the PAGE to view / learn more (NOT a purchase); (2) DIG IN —"
355
+ + " `seller.links` follow the seller's policy / info links (refund, shipping,"
356
+ + " terms); (3) BUY — `checkout_url` is the variant permalink that commits the"
357
+ + " purchase. A variant's `url` and its `checkout_url` are DIFFERENT targets:"
358
+ + " `url` is the page (view) whereas `checkout_url` buys — do not conflate"
359
+ + " them. Re-fetch right"
308
360
  + " before the user buys — prices, availability, and checkout_url are"
309
361
  + " point-in-time, not guarantees. Each variant carries an `inputs` list"
310
362
  + " correlating it back to the id(s) you asked about (the response is NOT in"
@@ -371,12 +423,24 @@ function mapLookupOutcome(api, outcome) {
371
423
  switch (outcome.kind) {
372
424
  case "ok":
373
425
  return lookupResult(outcome);
426
+ case "forbidden":
427
+ // Symmetric with sil_search (one vocabulary, AC2/AC7/AC10): a 403 is the shared
428
+ // forbidden envelope, and `user_not_provisioned` — and ONLY that exact reason —
429
+ // clears the structurally-dead token at this call site so recovery terminates
430
+ // regardless of which catalog tool revealed the state. `principal_mismatch` /
431
+ // unknown reasons survive (recoverable; the same exact-equality gate).
432
+ api.logger.warn("sil_product_get_forbidden", { reason: outcome.reason });
433
+ if (outcome.reason === "user_not_provisioned")
434
+ clearTokens();
435
+ return forbidden(outcome.reason);
374
436
  case "invalid_request":
375
437
  api.logger.info("sil_product_get_invalid_request", { error: outcome.error });
376
438
  return invalidRequest(outcome.error, outcome.message);
377
439
  case "retryable":
378
- api.logger.info("sil_product_get_retryable", {});
379
- return transient("sil_product_get");
440
+ // Symmetric with sil_search: a source-attributed 5xx names the source (outcome
441
+ // b); a sil/network blip is the generic copy (outcome a). One error vocabulary.
442
+ api.logger.info("sil_product_get_retryable", outcome.source ? { source: outcome.source } : {});
443
+ return transient("sil_product_get", outcome.source, outcome.detail);
380
444
  case "unauthorized":
381
445
  return mustReregister("sil_product_get");
382
446
  }
@@ -417,20 +481,21 @@ function invalidIds() {
417
481
  * a drifted on-disk call must not slip a non-string into the query mapping. No
418
482
  * `any`, no unchecked `as`.
419
483
  *
420
- * The four serviceability/localization filters narrow by their own type: `ship_to`/
421
- * `ships_from` to an object with a string `country` (a primitive/number is
422
- * DROPPED), `condition` to a string[] (a bare string is dropped), `available` to a
423
- * boolean (a string is dropped). The drop is TYPE-driven, never value-driven, so a
424
- * valid `available: false` survives — it is a boolean, the meaningful "include
425
- * unavailable items" signal, not a falsy value to discard.
484
+ * The serviceability/localization filters narrow by their own type: `ship_to` to an
485
+ * object with a string `country` (a primitive/number is DROPPED), `condition` to a
486
+ * string[] (a bare string is dropped), `available` and `local_merchants` to a boolean
487
+ * (a string is dropped). The drop is TYPE-driven, never value-driven, so a valid
488
+ * `available: false` survives — it is a boolean, the meaningful "include unavailable
489
+ * items" signal, not a falsy value to discard.
426
490
  *
427
- * Beyond TYPE narrowing, `ship_to`/`ships_from` also FORMAT-validate every provided
428
- * string field (country alpha-2, region 3166-2, postal bounded) against the shared
429
- * patterns: a present-but-malformed value returns an `invalid` read so the tool
430
- * rejects the request client-side with a clear `invalid_filter` error (better agent
431
- * UX than an opaque, fail-late sil-api 400). `condition` is NOT format-validated —
432
- * its wire stays OPEN (an unrecognized value still forwards; steering to
433
- * new/secondhand lives in the description only). The first bad field wins. */
491
+ * Beyond TYPE narrowing, `ship_to` also FORMAT-validates every provided string field
492
+ * (country alpha-2, region 3166-2, postal bounded) against the shared patterns: a
493
+ * present-but-malformed value returns an `invalid` read so the tool rejects the
494
+ * request client-side with a clear `invalid_filter` error (better agent UX than an
495
+ * opaque, fail-late sil-api 400). `condition` is NOT format-validated — its wire
496
+ * stays OPEN (an unrecognized value still forwards; steering to new/secondhand lives
497
+ * in the description only). `local_merchants` is a plain boolean bias (no format, no
498
+ * country) — its whole steer lives in the description. The first bad field wins. */
434
499
  function readSearchParams(params) {
435
500
  const result = {};
436
501
  const query = params["query"];
@@ -456,17 +521,20 @@ function readSearchParams(params) {
456
521
  return { kind: "invalid", field: shipTo.field };
457
522
  if (shipTo.kind === "ok")
458
523
  result.ship_to = shipTo.value;
459
- const shipsFrom = readShipsFrom(params["ships_from"]);
460
- if (shipsFrom.kind === "invalid")
461
- return { kind: "invalid", field: shipsFrom.field };
462
- if (shipsFrom.kind === "ok")
463
- result.ships_from = shipsFrom.value;
464
524
  const condition = readCondition(params["condition"]);
465
525
  if (condition !== null)
466
526
  result.condition = condition;
467
527
  const available = params["available"];
468
528
  if (typeof available === "boolean")
469
529
  result.available = available;
530
+ // `local_merchants` is a plain boolean bias narrowed exactly like `available`:
531
+ // a wrong type is DROPPED (treated as absent), never coerced. A valid `false`
532
+ // survives the read site (type-driven, not value-driven); the omit-when-falsy
533
+ // discipline for the BIAS itself lives at the wire (`buildSearchBody`), since
534
+ // unlike `available:false`, a false bias carries no ranking signal.
535
+ const localMerchants = params["local_merchants"];
536
+ if (typeof localMerchants === "boolean")
537
+ result.local_merchants = localMerchants;
470
538
  return { kind: "ok", params: result };
471
539
  }
472
540
  /** A non-null plain object, or null for anything else (arrays/primitives). */
@@ -508,22 +576,6 @@ function readShipTo(raw) {
508
576
  }
509
577
  return { kind: "ok", value: result };
510
578
  }
511
- /** Narrow a `ships_from` arg to {@link ShipsFrom}. A non-object/missing-country is
512
- * `absent` (DROPPED, wrong-TYPE discipline); a provided `country` string that fails
513
- * the alpha-2 pattern is `invalid` (REJECT). Country is uppercased on the wire, not
514
- * here. */
515
- function readShipsFrom(raw) {
516
- const obj = asRecord(raw);
517
- if (obj === null)
518
- return { kind: "absent" };
519
- const country = obj["country"];
520
- if (typeof country !== "string" || country.length === 0)
521
- return { kind: "absent" };
522
- if (!matchesPattern(country, COUNTRY_PATTERN)) {
523
- return { kind: "invalid", field: "ships_from.country" };
524
- }
525
- return { kind: "ok", value: { country } };
526
- }
527
579
  /** Test a value against one of the shared schema patterns, anchored exactly as the
528
580
  * schema's `pattern` is (the constants carry their own `^…$`). A fresh `RegExp` per
529
581
  * call keeps the patterns as plain shared strings (the schema needs the string form;
@@ -619,12 +671,59 @@ function mustReregister(tool) {
619
671
  recovery: "sil_register",
620
672
  });
621
673
  }
622
- /** Transient: a network/5xx blip — try again, NOT a re-register (a false terminal
623
- * on a transient would send the agent down a recovery path that can't fix it).
624
- * The `tool` name keeps the retry guidance actionable; the taxonomy is shared. */
625
- function transient(tool) {
674
+ /** Terminal-but-distinct: a 403 — the token is valid but the user isn't provisioned
675
+ * (or a principal mismatch / other reason). Refreshing would not help (a 403 is not
676
+ * a 401). Surfaces the SAME envelope `sil_whoami`'s `forbidden()` (identity.ts) emits
677
+ * — `{ status:"forbidden", reason, message, recovery:"sil_register" }`, byte-identical
678
+ * including the reason-driven message branch — so the three sil-api tools speak ONE
679
+ * error vocabulary (AC5). `user_not_provisioned` reads as an actionable onboarding
680
+ * prompt; any other reason is the generic forbidden copy carrying the reason. The
681
+ * recovery hint is always `sil_register` (the message names it, tool-agnostic — the
682
+ * parity with `sil_whoami`'s envelope is byte-exact, so it carries no per-tool name).
683
+ * The dead-token CLEAR is NOT here — it is the caller's decision (gated on
684
+ * `user_not_provisioned`), so a `principal_mismatch` that still wants the legible
685
+ * envelope does not have its token wiped. */
686
+ function forbidden(reason) {
687
+ const message = reason === "user_not_provisioned"
688
+ ? "Your sil account is not fully set up. Complete onboarding (run"
689
+ + " sil_register) and try again."
690
+ : "sil rejected this request (" + reason + "). Run sil_register to"
691
+ + " re-establish your session, then try again.";
692
+ return jsonResult({ status: "forbidden", reason, message, recovery: "sil_register" });
693
+ }
694
+ /** Transient: a retryable blip — try again, NOT a re-register (a false terminal on
695
+ * a transient would send the agent down a recovery path that can't fix it). The two
696
+ * causally-distinct transient failures share `status: "retryable"` (both succeed on
697
+ * backoff) but split on ATTRIBUTION, which is the whole point of this card:
698
+ *
699
+ * - `source` ABSENT (outcome a) — sil itself / the network / transport is down,
700
+ * OR a refresh-leg blip. The agent retries the same call; the copy stays the
701
+ * GENERIC "sil is temporarily unavailable" and names no source it cannot
702
+ * identify (attribution honesty).
703
+ * - `source` PRESENT (outcome b) — a specific catalog source is down or
704
+ * rate-limited. The copy NAMES that source and must NEVER say "sil is …
705
+ * unavailable" / "sil is down": sil is healthy, one source is degraded, often
706
+ * for seconds, and mis-attributing it to sil makes the agent abandon a working
707
+ * platform. `detail` (the upstream cause) is relayed when present.
708
+ *
709
+ * The source is named ONLY when the wire actually carried it (the classifier gates
710
+ * on a real `source` field — see `retryableFromBody` in sil-client). The named-source
711
+ * copy is SELF-AUTHORED around the source token rather than echoing the raw upstream
712
+ * `detail` prose verbatim — the upstream wording is sil-api's to change and could
713
+ * itself contain "sil is …" phrasing that would muddy the attribution; `detail` is
714
+ * surfaced as a separate, clearly-delimited field instead. The `tool` name keeps the
715
+ * retry guidance actionable; the status taxonomy is shared. */
716
+ function transient(tool, source, detail) {
717
+ if (source === undefined) {
718
+ return jsonResult({
719
+ status: "retryable",
720
+ message: `sil is temporarily unavailable. Please try ${tool} again.`,
721
+ });
722
+ }
626
723
  return jsonResult({
627
724
  status: "retryable",
628
- message: `sil is temporarily unavailable. Please try ${tool} again.`,
725
+ message: `The catalog source "${source}" is temporarily unavailable.`
726
+ + ` sil itself is fine — retry ${tool} shortly.`,
727
+ ...(detail !== undefined ? { detail } : {}),
629
728
  });
630
729
  }
@@ -30,8 +30,8 @@
30
30
  * inside execute(), never at register time.
31
31
  */
32
32
  import { Type } from "typebox";
33
- import { getWebUrl, getApiUrl } from "../lib/config.js";
34
- import { clearTokens, hasTokens, readConfig, readTokens, writeConfig, writeTokens, } from "../lib/credentials.js";
33
+ import { getWebUrl, getWebUrlSource, getApiUrl } from "../lib/config.js";
34
+ import { clearTokens, getTokensPath, hasTokens, readConfig, readTokens, writeConfig, writeTokens, } from "../lib/credentials.js";
35
35
  import { deriveChallenge, newSessionId, newVerifier } from "../lib/pkce.js";
36
36
  import { POLL_DEADLINE_MS, POLL_INTERVAL_MS, startPoll, } from "../lib/poller.js";
37
37
  import { claimSession, fetchIdentity, refreshAndRetryOnce, } from "../lib/sil-client.js";
@@ -59,14 +59,21 @@ function registerRegister(api) {
59
59
  user: config?.user ?? null,
60
60
  });
61
61
  }
62
+ // A fresh registration attempt clears any prior in-process persist-failure
63
+ // marker: this process is starting over, so a stale marker from an earlier
64
+ // failed attempt must not make a later genuine `not_registered` (or this
65
+ // attempt's own outcome) masquerade as `persistence_failed`. (FIX C.)
66
+ clearPersistFailure();
62
67
  // 2 — mint PKCE. The verifier stays in this closure (never on disk).
63
68
  const sessionId = newSessionId();
64
69
  const verifier = newVerifier();
65
70
  const challenge = deriveChallenge(verifier);
66
- const apiUrl = getWebUrl();
71
+ // The sil-WEB origin (auth authority) — this is what the auth URL is built
72
+ // from. The local was historically misnamed `apiUrl`; it is the web origin.
73
+ const webUrl = getWebUrl();
67
74
  // 3 — build the auth URL. Opening it (by the user's browser) is what
68
75
  // creates the pending session server-side; the plugin does not pre-POST.
69
- const authUrl = `${stripTrailingSlash(apiUrl)}/authorize`
76
+ const authUrl = `${stripTrailingSlash(webUrl)}/authorize`
70
77
  + `?session=${sessionId}&code_challenge=${challenge}`;
71
78
  // 4 — fire-and-forget bounded poll. Not awaited: execute() returns now.
72
79
  // The poll step maps each claim outcome to the loop's done/continue
@@ -76,18 +83,35 @@ function registerRegister(api) {
76
83
  startPoll({
77
84
  intervalMs: POLL_INTERVAL_MS,
78
85
  deadlineMs: POLL_DEADLINE_MS,
79
- poll: () => claimStep(apiUrl, sessionId, verifier),
86
+ poll: () => claimStep(webUrl, sessionId, verifier),
80
87
  onDone: (result) => handleDone(api, sessionId, result),
81
88
  });
82
89
  api.logger.info("sil_register_started", { session_id: sessionId });
83
90
  return jsonResult({
84
91
  status: "awaiting_browser",
85
- message: `Open this URL in a browser to register: ${authUrl}`,
92
+ // The steer lead line routes the user into their OWN default browser
93
+ // BEFORE the Auth0 leg (where Auth0's session cookie works on its own
94
+ // domain), instead of an in-app/embedded webview that partitions it and
95
+ // dead-ends the login. It is a SEPARATE line ABOVE the link, so the link
96
+ // line stays exactly `<authUrl>` — ONE atomic, angle-bracket-wrapped
97
+ // target that a greedy chat auto-linker captures WHOLE (`&code_challenge`
98
+ // included) instead of truncating at the `&` and 400-ing
99
+ // `invalid_code_challenge`. `auth_url` below stays the canonical,
100
+ // UNWRAPPED machine field agents parse. (FIX A + system-browser steer.)
101
+ message: BROWSER_STEER_HUMAN
102
+ + "\n"
103
+ + presentAuthLink(authUrl),
86
104
  auth_url: authUrl,
87
105
  session_id: sessionId,
88
- instructions: "Share the auth URL with the user. The plugin is polling in the"
89
- + " background — once the user finishes signing in, call sil_register"
90
- + " again to confirm (it will report already_registered).",
106
+ // The agent-facing steer MUST agree with the human `message` (both built
107
+ // from the shared BROWSER_STEER_NEGATIVE clause) so an agent relaying the
108
+ // instruction can't paraphrase it back to a generic "a browser" and
109
+ // re-open the cookie-blocking-webview gap.
110
+ instructions: "Share the auth URL with the user and tell them to "
111
+ + BROWSER_STEER_AGENT
112
+ + " The plugin is polling in the background — once the user finishes"
113
+ + " signing in, call sil_register again to confirm (it will report"
114
+ + " already_registered).",
91
115
  });
92
116
  },
93
117
  });
@@ -132,11 +156,35 @@ function registerWhoami(api) {
132
156
  + " the recovery action (run sil_register).",
133
157
  parameters: Type.Object({}),
134
158
  async execute() {
135
- // 1 — not registered: terminal, zero network calls.
159
+ // 1 — not registered: terminal, zero network calls. If THIS process saw a
160
+ // token-persist failure (auth succeeded but the write failed), surface the
161
+ // distinct `persistence_failed` state instead — the no-tokens.json state on
162
+ // disk is identical for both, so the in-process marker is the only signal
163
+ // that tells them apart (FIX C; cold-restart correctly degrades to
164
+ // not_registered — see the persistence_failed/notRegistered helpers).
136
165
  const stored = readTokens();
137
166
  if (stored === null) {
138
- return notRegistered();
167
+ const failure = getPersistFailure();
168
+ return failure !== null ? persistenceFailed(failure) : notRegistered();
139
169
  }
170
+ // B (origin visibility): resolve the sil-WEB origin (the origin the
171
+ // registration link is built from) + its source, surface it on the success
172
+ // payload so a wrong/staging origin is diagnosable BEFORE anything 404s,
173
+ // and emit a single warn when the source is non-default. Warn-only — a
174
+ // staging/self-host origin is legitimate, so it is NEVER rejected. Scope is
175
+ // the WEB origin only; the sil-api read origin is out of scope. (FIX B.)
176
+ const webOrigin = getWebUrl();
177
+ const webOriginSource = getWebUrlSource();
178
+ if (webOriginSource !== "default") {
179
+ api.logger.warn("sil_whoami_web_origin_override", {
180
+ web_origin: webOrigin,
181
+ web_origin_source: webOriginSource,
182
+ });
183
+ }
184
+ const originBlock = {
185
+ web_origin: webOrigin,
186
+ web_origin_source: webOriginSource,
187
+ };
140
188
  // 2 — read identity; on a 401 refresh-and-retry ONCE via the shared
141
189
  // choreography (the SAME `refreshAndRetryOnce` path sil_search /
142
190
  // sil_product_get use — 401 recovery is uniform across every
@@ -152,7 +200,7 @@ function registerWhoami(api) {
152
200
  // logs-only, no token material, NOT a payload field (the agent never sees it).
153
201
  if (recovered.refreshed)
154
202
  api.logger.info("sil_whoami_refreshed", {});
155
- return identityOutcomeToResult(api, recovered.outcome);
203
+ return identityOutcomeToResult(api, recovered.outcome, originBlock);
156
204
  case "must_reregister":
157
205
  // The refresh token is dead (invalid_grant) → clear the now-known-dead
158
206
  // pair so the user's sil_register recovery is not blocked by stale
@@ -175,13 +223,26 @@ function registerWhoami(api) {
175
223
  });
176
224
  }
177
225
  /** Map a non-401 identity outcome to the agent-facing result. (401 is handled
178
- * inline by the refresh path; it never reaches here.) */
179
- function identityOutcomeToResult(api, outcome) {
226
+ * inline by the refresh path; it never reaches here.) The origin block rides the
227
+ * SUCCESS payload (the point is pre-failure diagnosis); the terminal/transient
228
+ * envelopes don't carry it. */
229
+ function identityOutcomeToResult(api, outcome, originBlock) {
180
230
  switch (outcome.kind) {
181
231
  case "ok":
182
- return identityResult(outcome.identity);
232
+ return identityResult(outcome.identity, originBlock);
183
233
  case "forbidden":
234
+ // Decision B — the dead-token clear is UNIFORM across all three sil-api tools.
235
+ // `sil_whoami` is the tool that is legible TODAY; an agent that diagnoses the
236
+ // 403 via whoami, follows `recovery:"sil_register"`, and hits
237
+ // `already_registered` is stranded identically to the catalog path. So clear on
238
+ // `user_not_provisioned` HERE too (the held token maps to no account on this
239
+ // backend; a refresh cannot help — structurally dead, like the invalid_grant
240
+ // clear above). Gated on EXACT equality: `principal_mismatch` / unknown reasons
241
+ // can be transient and must stay recoverable, so they keep the legible forbidden
242
+ // envelope WITHOUT a destructive clear (AC9 clears, AC10 does not).
184
243
  api.logger.warn("sil_whoami_forbidden", { reason: outcome.reason });
244
+ if (outcome.reason === "user_not_provisioned")
245
+ clearTokens();
185
246
  return forbidden(outcome.reason);
186
247
  case "retryable":
187
248
  api.logger.info("sil_whoami_retryable", {});
@@ -192,9 +253,11 @@ function identityOutcomeToResult(api, outcome) {
192
253
  return mustReregister();
193
254
  }
194
255
  }
195
- /** Success: the identity payload ONLY — no token, no Bearer header. */
196
- function identityResult(identity) {
197
- return jsonResult({ status: "ok", identity });
256
+ /** Success: the identity payload + the web-origin visibility block (FIX B) —
257
+ * no token, no Bearer header. The origin block (strings only) lets the agent
258
+ * relay the resolved origin + its source so a wrong origin is diagnosable. */
259
+ function identityResult(identity, originBlock) {
260
+ return jsonResult({ status: "ok", identity, ...originBlock });
198
261
  }
199
262
  /** Not registered: a distinct, actionable outcome naming the recovery tool. No
200
263
  * identity fields (name/addresses) so the agent can't mistake it for a read. */
@@ -206,6 +269,25 @@ function notRegistered() {
206
269
  recovery: "sil_register",
207
270
  });
208
271
  }
272
+ /**
273
+ * Registered-but-persistence-failed (FIX C): auth succeeded in THIS process but
274
+ * the token write failed, so nothing reached disk. DISTINCT from `not_registered`
275
+ * because the recovery differs — the user must FIX THE DATA DIR (the path + cause
276
+ * name what to fix), THEN re-register; a bare "run sil_register" would just fail
277
+ * to persist again, looping. `error` carries the "<path>: <cause>" from the
278
+ * in-process marker. No identity fields (the tokens never landed).
279
+ */
280
+ function persistenceFailed(error) {
281
+ return jsonResult({
282
+ status: "persistence_failed",
283
+ message: "Registration authenticated but the credentials could NOT be written to"
284
+ + " disk, so it did not stick. Fix the data directory (it must be writable"
285
+ + " — check permissions / free space / that $SIL_DATA_DIR is a directory),"
286
+ + " then run sil_register again.",
287
+ error,
288
+ recovery: "sil_register",
289
+ });
290
+ }
209
291
  /** Terminal: the session is fully expired (refresh rejected). Re-register. */
210
292
  function mustReregister() {
211
293
  return jsonResult({
@@ -232,6 +314,29 @@ function transient() {
232
314
  message: "sil is temporarily unavailable. Please try sil_whoami again.",
233
315
  });
234
316
  }
317
+ /**
318
+ * In-process persist-failure marker (FIX C). A failed token write leaves NO
319
+ * `tokens.json` on disk — exactly the state a never-registered user has — so the
320
+ * two are indistinguishable from disk alone. This module-level marker is the only
321
+ * signal that tells `sil_whoami` "auth succeeded in THIS process but persistence
322
+ * failed" apart from a bare `not_registered`. It is intentionally in-process only:
323
+ * the failure mode IS an unwritable data dir, so an on-disk sentinel would fail to
324
+ * write for the same reason — and after a cold restart `not_registered` is the
325
+ * TRUE state (no creds exist), with a re-run of `sil_register` re-surfacing the
326
+ * write failure loudly. Set by `claimStep` on the persist_failed terminal; reset
327
+ * on a fresh `sil_register` start so a stale marker can't mislabel a later genuine
328
+ * not_registered (and resettable in tests via that same fresh-start path).
329
+ */
330
+ let _persistFailure = null;
331
+ function setPersistFailure(error) {
332
+ _persistFailure = error;
333
+ }
334
+ function getPersistFailure() {
335
+ return _persistFailure;
336
+ }
337
+ function clearPersistFailure() {
338
+ _persistFailure = null;
339
+ }
235
340
  /**
236
341
  * One poll step: claim, then map the outcome to the loop's done/continue signal.
237
342
  * `pending`/`retryable`/`not_found` keep the loop alive (`done:false`). The 404
@@ -252,11 +357,26 @@ async function claimStep(apiUrl, sessionId, verifier) {
252
357
  case "not_found":
253
358
  return { done: false };
254
359
  case "success":
255
- await writeTokens({
256
- access_token: outcome.access_token,
257
- refresh_token: outcome.refresh_token,
258
- });
259
- await writeConfig({ user: outcome.user });
360
+ // Persist the bearer pair + identity. FIX C: wrap ONLY the persist calls
361
+ // (never the whole step — a too-wide catch could mislabel a genuine claim
362
+ // success). A write failure (unwritable / missing-and-uncreatable / full
363
+ // $SIL_DATA_DIR) is TERMINAL, not transient: re-polling the claim cannot
364
+ // make the data dir writable, and the claim is single-use server-side. So
365
+ // return a descriptive `persist_failed` terminal (path + cause) and set the
366
+ // in-process marker — instead of letting the throw reach the poller's catch,
367
+ // which would swallow it as a retry and end the run as a misleading timeout.
368
+ try {
369
+ await writeTokens({
370
+ access_token: outcome.access_token,
371
+ refresh_token: outcome.refresh_token,
372
+ });
373
+ await writeConfig({ user: outcome.user });
374
+ }
375
+ catch (err) {
376
+ const error = `${getTokensPath()}: ${describeCause(err)}`;
377
+ setPersistFailure(error);
378
+ return { done: true, outcome: "persist_failed", error };
379
+ }
260
380
  return { done: true, outcome: "success", user_id: outcome.user.id };
261
381
  case "expired":
262
382
  case "already_claimed":
@@ -278,6 +398,18 @@ function handleDone(api, sessionId, result) {
278
398
  });
279
399
  return;
280
400
  }
401
+ // FIX C: a token-persist failure is logged LOUDLY at error — the most severe
402
+ // terminal, distinct from the routine info/warn terminals — carrying the path +
403
+ // cause (in `step.error`) so an operator sees persistence failed, NOT that the
404
+ // user abandoned the flow. The tokens never reached disk, so there is no token
405
+ // material to leak; only the session id + the path/cause error are logged.
406
+ if (step.outcome === "persist_failed") {
407
+ api.logger.error("sil_register_persist_failed", {
408
+ session_id: sessionId,
409
+ error: typeof step.error === "string" ? step.error : "",
410
+ });
411
+ return;
412
+ }
281
413
  if ("timedOut" in step && step.timedOut === true) {
282
414
  api.logger.info("sil_register_timeout", { session_id: sessionId });
283
415
  return;
@@ -299,3 +431,60 @@ function handleDone(api, sessionId, result) {
299
431
  function stripTrailingSlash(url) {
300
432
  return url.endsWith("/") ? url.slice(0, -1) : url;
301
433
  }
434
+ /**
435
+ * Render an errno-style cause from a caught (unknown) persist error, for the
436
+ * loud log + whoami `persistence_failed` state (FIX C). A Node fs error carries
437
+ * a `.code` (EACCES/ENOSPC/ENOTDIR/ENOENT…) and a `.message` that already names
438
+ * the code and the human cause ("not a directory") — surface the code first
439
+ * (prominent for an operator) then the full message. Carries NO token material:
440
+ * an fs error names paths/errnos only, and the tokens never reached this point.
441
+ */
442
+ function describeCause(err) {
443
+ if (err instanceof Error) {
444
+ const code = err.code;
445
+ return code ? `${code}: ${err.message}` : err.message;
446
+ }
447
+ return String(err);
448
+ }
449
+ /**
450
+ * Present an auth URL as a single atomic link target for a human-rendered chat
451
+ * surface: angle-bracket wrapped (`<…>`). The angle brackets are the RFC-3986 /
452
+ * Markdown convention that bounds a URL so a greedy auto-linker captures the
453
+ * WHOLE span — including the `&code_challenge=…` query param — instead of
454
+ * terminating the link at the first `&` (the reported production break that
455
+ * dropped `code_challenge` and 400-ed `invalid_code_challenge`). The caller puts
456
+ * the returned token on its OWN line so no surrounding prose can be folded into
457
+ * the link. Pure (no I/O) — the [unit] seam for the atomic-link contract. The
458
+ * structured `auth_url` field is the UNWRAPPED canonical URL; this is the
459
+ * human-presentation form only, and it carries the same params byte-for-byte (it
460
+ * never re-encodes, never adds the verifier).
461
+ */
462
+ function presentAuthLink(authUrl) {
463
+ return `<${authUrl}>`;
464
+ }
465
+ /**
466
+ * System-browser steer copy (the proactive webview → default-browser handoff).
467
+ *
468
+ * Auth0's hosted login sets its session cookie on its OWN domain; an app's
469
+ * embedded/in-app webview routinely partitions or blocks that cookie, so opening
470
+ * the auth URL there dead-ends the login. The plugin CANNOT detect the surface —
471
+ * the host `api` exposes no client/UA/surface signal (see openclaw.d.ts) and a
472
+ * tool's execute receives no request context — so the steer ships UNCONDITIONALLY
473
+ * at presentation time, BEFORE the Auth0 leg (not as a post-failure recovery; that
474
+ * reactive path is sil-services #50). Phrased as a neutral setup step, not a
475
+ * warning — onboarding first-impression is the metric.
476
+ *
477
+ * One shared NEGATIVE clause feeds both the human `message` and the agent
478
+ * `instructions` so the two copies cannot drift — an agent paraphrasing must
479
+ * carry the same "not the in-app browser" half, never collapse it back to a
480
+ * generic "a browser". Plain "default browser (Safari/Chrome)" is used over the
481
+ * term "system browser": it names the concrete action a non-technical user can
482
+ * follow on their own device.
483
+ */
484
+ const BROWSER_STEER_NEGATIVE = "your device's default browser (Safari, Chrome, …), not this app's"
485
+ + " built-in / in-app browser";
486
+ /** Human-facing lead line — the line ABOVE the atomic link in `message`. */
487
+ const BROWSER_STEER_HUMAN = `Open this link in ${BROWSER_STEER_NEGATIVE}:`;
488
+ /** Agent-facing steer — embedded mid-sentence in `instructions` (lower-cased lead
489
+ * so it reads naturally after "tell them to …"). */
490
+ const BROWSER_STEER_AGENT = `open the link in ${BROWSER_STEER_NEGATIVE}.`;
@@ -2,7 +2,7 @@
2
2
  "id": "sil",
3
3
  "name": "sil",
4
4
  "description": "sil commerce plugin for OpenClaw — register on sil, read your identity, and search and look up products in the sil catalog.",
5
- "version": "0.2.2",
5
+ "version": "0.2.4",
6
6
  "skills": ["./skill"],
7
7
  "activation": {
8
8
  "onCapabilities": ["tool"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sil-openclaw",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "OpenClaw plugin for sil — register an identity and search and look up products in the sil commerce catalog from an agent.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {