@extenshi/mcp 0.7.0 → 0.9.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.
Files changed (69) hide show
  1. package/README.md +9 -4
  2. package/dist/bff.d.ts +17 -0
  3. package/dist/bff.d.ts.map +1 -1
  4. package/dist/bff.js +4 -0
  5. package/dist/bff.js.map +1 -1
  6. package/dist/development-guide.d.ts +109 -79
  7. package/dist/development-guide.d.ts.map +1 -1
  8. package/dist/development-guide.js +133 -45
  9. package/dist/development-guide.js.map +1 -1
  10. package/dist/docs.d.ts +45 -4
  11. package/dist/docs.d.ts.map +1 -1
  12. package/dist/docs.js +162 -17
  13. package/dist/docs.js.map +1 -1
  14. package/dist/icon-workflow.d.ts +5 -4
  15. package/dist/icon-workflow.d.ts.map +1 -1
  16. package/dist/icon-workflow.js +33 -32
  17. package/dist/icon-workflow.js.map +1 -1
  18. package/dist/json-ld.d.ts +89 -0
  19. package/dist/json-ld.d.ts.map +1 -0
  20. package/dist/json-ld.js +118 -0
  21. package/dist/json-ld.js.map +1 -0
  22. package/dist/landing-page.d.ts +123 -0
  23. package/dist/landing-page.d.ts.map +1 -0
  24. package/dist/landing-page.js +405 -0
  25. package/dist/landing-page.js.map +1 -0
  26. package/dist/landing-workflow.d.ts +49 -0
  27. package/dist/landing-workflow.d.ts.map +1 -0
  28. package/dist/landing-workflow.js +80 -0
  29. package/dist/landing-workflow.js.map +1 -0
  30. package/dist/localize-workflow.d.ts +6 -1
  31. package/dist/localize-workflow.d.ts.map +1 -1
  32. package/dist/localize-workflow.js +65 -47
  33. package/dist/localize-workflow.js.map +1 -1
  34. package/dist/pay.d.ts +1 -1
  35. package/dist/pay.d.ts.map +1 -1
  36. package/dist/pay.js +11 -11
  37. package/dist/pay.js.map +1 -1
  38. package/dist/privacy-ai-outcome.d.ts +21 -0
  39. package/dist/privacy-ai-outcome.d.ts.map +1 -0
  40. package/dist/privacy-ai-outcome.js +69 -0
  41. package/dist/privacy-ai-outcome.js.map +1 -0
  42. package/dist/scan.d.ts +7 -0
  43. package/dist/scan.d.ts.map +1 -1
  44. package/dist/scan.js +26 -2
  45. package/dist/scan.js.map +1 -1
  46. package/dist/search-filters.js +1 -1
  47. package/dist/search-filters.js.map +1 -1
  48. package/dist/shape.d.ts +34 -0
  49. package/dist/shape.d.ts.map +1 -1
  50. package/dist/shape.js +150 -3
  51. package/dist/shape.js.map +1 -1
  52. package/dist/telemetry.d.ts.map +1 -1
  53. package/dist/telemetry.js +3 -0
  54. package/dist/telemetry.js.map +1 -1
  55. package/dist/templates.js +5 -5
  56. package/dist/templates.js.map +1 -1
  57. package/dist/tools.d.ts +2 -1
  58. package/dist/tools.d.ts.map +1 -1
  59. package/dist/tools.js +398 -115
  60. package/dist/tools.js.map +1 -1
  61. package/dist/welcome-agent-brief.d.ts +9 -9
  62. package/dist/welcome-agent-brief.d.ts.map +1 -1
  63. package/dist/welcome-agent-brief.js +32 -32
  64. package/dist/welcome-agent-brief.js.map +1 -1
  65. package/dist/welcome-workflow.d.ts +5 -5
  66. package/dist/welcome-workflow.d.ts.map +1 -1
  67. package/dist/welcome-workflow.js +13 -14
  68. package/dist/welcome-workflow.js.map +1 -1
  69. package/package.json +3 -2
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Body of the free `generate_landing_page` MCP tool.
3
+ *
4
+ * Pure function of its arguments — no API key, no network, no credits — so it
5
+ * is registered under the `docs` capability and works on both the local stdio
6
+ * server and the hosted connector. The HTML comes from ./landing-page.ts, a
7
+ * synced copy of shared-types/landing-page.ts: the page an agent generates here
8
+ * is byte-for-byte what the cabinet Page generator downloads for the same form.
9
+ *
10
+ * Extenshi does not host the page. The returned `nextSteps` describe hosting it
11
+ * on any HTTPS origin and registering the URL with `upsert_hosted_page`, which
12
+ * is what feeds HOMEPAGE_URL in the generated integration config.
13
+ */
14
+ import { buildLandingPage, DEFAULT_LANDING_FORM, landingFormToInput, landingPageWarnings, } from './landing-page.js';
15
+ export function landingFormFromArgs(args) {
16
+ const form = {
17
+ ...DEFAULT_LANDING_FORM,
18
+ extensionName: args.extensionName,
19
+ tagline: args.tagline ?? '',
20
+ description: args.description ?? '',
21
+ accentColor: args.accentColor ?? DEFAULT_LANDING_FORM.accentColor,
22
+ theme: args.theme ?? DEFAULT_LANDING_FORM.theme,
23
+ chromeUrl: args.chromeUrl ?? '',
24
+ firefoxUrl: args.firefoxUrl ?? '',
25
+ edgeUrl: args.edgeUrl ?? '',
26
+ privacyPolicyUrl: args.privacyPolicyUrl ?? '',
27
+ supportUrl: args.supportUrl ?? '',
28
+ features: (args.features ?? []).map((f) => ({ title: f.title, description: f.description ?? '' })),
29
+ };
30
+ if (args.homepageUrl)
31
+ form.homepageUrl = args.homepageUrl;
32
+ if (args.logoUrl)
33
+ form.logoUrl = args.logoUrl;
34
+ if (args.logoSvg)
35
+ form.logoSvg = args.logoSvg;
36
+ if (args.screenshots?.length) {
37
+ form.screenshots = args.screenshots.map((s) => ({ url: s.url, alt: s.alt ?? '' }));
38
+ }
39
+ return form;
40
+ }
41
+ export function landingNextSteps(homepageUrl) {
42
+ return [
43
+ 'Save `html` verbatim as index.html. Put any relative screenshot or logo paths next to it at the same relative locations.',
44
+ 'Host the file on a public HTTPS origin — for example GitHub Pages (commit index.html to the repository, then Settings → Pages → deploy from the branch and folder), Cloudflare Pages, Netlify or any static host. The page has no JavaScript, so it needs no build step or CSP changes.',
45
+ homepageUrl
46
+ ? `Confirm the page loads at ${homepageUrl} (the canonical/og:url tags already point there).`
47
+ : 'Once the final URL is known, regenerate with homepageUrl set to it so the canonical, og:url and JSON-LD url tags are filled in, and re-upload.',
48
+ 'Register the URL on the project: upsert_hosted_page {projectId, kind: "homepage", url} (needs identity and hosted.write; the server fetches the public page and hashes it, so it has to be publicly reachable). CLI equivalent: npx @extenshi/cli@latest page register --project <id> --url <https-url>.',
49
+ 'Re-read get_project_state and write integration.file verbatim to integration.path — the regenerated config carries the new HOMEPAGE_URL.',
50
+ 'After later edits to the hosted page, verify_hosted_artifact {projectId, kind: "homepage"} reports whether the live page still matches the registered hash.',
51
+ ];
52
+ }
53
+ export function renderGenerateLandingPage(args) {
54
+ const input = landingFormToInput(landingFormFromArgs(args));
55
+ const html = buildLandingPage(input);
56
+ return {
57
+ html,
58
+ bytes: new TextEncoder().encode(html).length,
59
+ warnings: landingPageWarnings(input),
60
+ nextSteps: landingNextSteps(/^https:\/\/\S+$/i.test(input.homepageUrl ?? '') ? input.homepageUrl : undefined),
61
+ };
62
+ }
63
+ /** Follow-ups after publish_landing_page, from the fields the BFF returned. */
64
+ export function hostedLandingNextSteps(result) {
65
+ const homepage = (result.homepage ?? {});
66
+ const steps = [
67
+ `The page is live at ${String(result.url)}; the same URL keeps serving every later version.`,
68
+ homepage.registered
69
+ ? 'It is now the project homepage. Re-read get_project_state and write integration.file verbatim to integration.path so HOMEPAGE_URL uses it.'
70
+ : 'The homepage registration was left unchanged (registerAsHomepage: false).',
71
+ 'verify_hosted_artifact {projectId, kind: "homepage"} confirms the public URL serves the published bytes (the hash is contentHash).',
72
+ ];
73
+ if (homepage.previousUrl)
74
+ steps.push(`This replaced the previously registered homepage ${homepage.previousUrl}.`);
75
+ const warnings = Array.isArray(result.warnings) ? result.warnings : [];
76
+ if (warnings.length)
77
+ steps.push('Review warnings: those values were clamped or dropped in the rendered page.');
78
+ return steps;
79
+ }
80
+ //# sourceMappingURL=landing-workflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"landing-workflow.js","sourceRoot":"","sources":["../src/landing-workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACN,gBAAgB,EAChB,oBAAoB,EAGpB,kBAAkB,EAClB,mBAAmB,GACnB,MAAM,mBAAmB,CAAA;AA2B1B,MAAM,UAAU,mBAAmB,CAAC,IAAqB;IACxD,MAAM,IAAI,GAAgB;QACzB,GAAG,oBAAoB;QACvB,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,OAAO,EAAE,IAAI,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M,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAA;IACtE,IAAI,QAAQ,CAAC,MAAM;QAClB,KAAK,CAAC,IAAI,CAAC,6EAA6E,CAAC,CAAA;IAC1F,OAAO,KAAK,CAAA;AACb,CAAC"}
@@ -1,3 +1,8 @@
1
- /** Static, keyless guidance; translation and filesystem changes belong to the caller's local agent. */
1
+ /**
2
+ * Static reference for the free `localize_workflow` MCP tool: the local
3
+ * localization process, the translation-bundle file format and the release
4
+ * checks. Written as documentation a developer can read on its own — it
5
+ * describes the process and its constraints, it does not address the reader.
6
+ */
2
7
  export declare function renderLocalizeWorkflow(): string;
3
8
  //# sourceMappingURL=localize-workflow.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"localize-workflow.d.ts","sourceRoot":"","sources":["../src/localize-workflow.ts"],"names":[],"mappings":"AAAA,uGAAuG;AACvG,wBAAgB,sBAAsB,IAAI,MAAM,CAoF/C"}
1
+ {"version":3,"file":"localize-workflow.d.ts","sourceRoot":"","sources":["../src/localize-workflow.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAiG/C"}
@@ -1,35 +1,45 @@
1
- /** Static, keyless guidance; translation and filesystem changes belong to the caller's local agent. */
1
+ /**
2
+ * Static reference for the free `localize_workflow` MCP tool: the local
3
+ * localization process, the translation-bundle file format and the release
4
+ * checks. Written as documentation a developer can read on its own — it
5
+ * describes the process and its constraints, it does not address the reader.
6
+ */
2
7
  export function renderLocalizeWorkflow() {
3
- return `# Local extension localization
8
+ return `# Local extension localization — reference
4
9
 
5
- This workflow is free of Extenshi credits and requires no API key. The MCP tool returns
6
- static instructions. Your coding agent translates using its own provider and tokens;
7
- the CLI prepares and validates local files offline after installation.
10
+ Cost and access: free. No Extenshi credits and no API key. Translation happens with
11
+ whichever translation provider the developer already uses; the Extenshi CLI prepares
12
+ and validates the local files offline.
8
13
 
9
14
  ## Availability
10
15
 
11
- First run \`extenshi localize --help\` with the CLI installed in your environment.
12
- Use a release that includes localize. A merged change is not proof that npm latest
13
- contains it. When working from the Extenshi repository, build the CLI with
14
- \`yarn workspace @extenshi/cli build\` and replace \`extenshi\` below with
15
- \`node tools/extenshi-cli/dist/cli.js\` (from the repository root).
16
+ The \`localize\` command ships in recent \`@extenshi/cli\` releases; \`extenshi localize --help\`
17
+ shows whether the installed version includes it. A merged change is not the same as an
18
+ npm release — the npm \`latest\` tag is the reference for what is installable. Inside the
19
+ Extenshi repository the CLI is built with \`yarn workspace @extenshi/cli build\` and run as
20
+ \`node tools/extenshi-cli/dist/cli.js\` from the repository root in place of \`extenshi\`.
16
21
 
17
- ## Prepare
22
+ ## Scope
18
23
 
19
- Start from manifest.json with default_locale and
20
- _locales/<default_locale>/messages.json. This workflow handles these messages,
21
- including manifest name/description references. Full store descriptions and arbitrary
22
- hardcoded UI strings need their own extraction and review.
24
+ Input: \`manifest.json\` with \`default_locale\`, plus \`_locales/<default_locale>/messages.json\`.
25
+ Covered: those messages, including the manifest name/description references.
26
+ Not covered: full store descriptions and hardcoded UI strings — they need separate
27
+ extraction and review.
28
+
29
+ ## Step 1 — Prepare
23
30
 
24
31
  \`\`\`bash
25
32
  extenshi localize prepare ./extension --lang fr,de,es --output ./localization --protect MyBrand
26
33
  \`\`\`
27
34
 
28
- The output localization-request.json contains missing, stale or untracked messages, grouped by
29
- locale. Use a fresh output directory on each run; prepare refuses to overwrite its request.
30
- When localization.json supplies targetLocales, --lang is optional. Its protectedTerms
31
- are combined with --protect. Keep the version, sourceLocale, locale keys and sourceHashes unchanged. Each
32
- locale has this structure (the hash shown is illustrative; retain the actual prepared hash):
35
+ Output: \`localization-request.json\`, listing missing, stale or untracked messages grouped
36
+ by locale. Each run needs a fresh output directory; prepare does not overwrite an existing
37
+ request. When \`localization.json\` supplies \`targetLocales\`, \`--lang\` is optional, and its
38
+ \`protectedTerms\` are combined with \`--protect\`.
39
+
40
+ The fields \`version\`, \`sourceLocale\`, the locale keys and \`sourceHashes\` are part of the
41
+ contract and stay unchanged. Per-locale structure (the hash is illustrative; the real
42
+ prepared hash is kept):
33
43
 
34
44
  \`\`\`json
35
45
  {
@@ -44,42 +54,50 @@ locale has this structure (the hash shown is illustrative; retain the actual pre
44
54
  }
45
55
  \`\`\`
46
56
 
47
- ## Translate and review
57
+ ## Step 2 — Translate and review
58
+
59
+ Translation rules:
48
60
 
49
- Translate only message text into each target language. Preserve keys, placeholder
50
- names and definitions, positional substitutions, escaped dollar signs and protected
51
- terms exactly. Keep descriptions as translation context. Use the actual product for
52
- context; never invent features, guarantees or marketing claims. Save the edited bundle
53
- as ./localization/translations.json. Preserve any removeKeys array: it lists translations whose source keys were
54
- deleted. Review these removals together with the translated messages. A removal-only
55
- locale has empty messages and sourceHashes objects and still requires reviewed: true.
61
+ - Only message text is translated into each target language.
62
+ - Keys, placeholder names and definitions, positional substitutions, escaped dollar signs
63
+ and protected terms are preserved exactly.
64
+ - Descriptions stay as translator context.
65
+ - Copy reflects the actual product: no new features, guarantees or marketing claims.
56
66
 
57
- Review the translations for meaning, tone, brand spelling and truthful claims before
58
- applying, then add "reviewed": true inside each reviewed locale object alongside
59
- sourceHashes and messages. Apply requires this explicit review marker. Source hashes detect edits to the source while translation was in progress;
60
- if the source changed, prepare a fresh request and translate the changed entries again.
67
+ The edited bundle is saved as \`./localization/translations.json\`. A \`removeKeys\` array, when
68
+ present, lists translations whose source keys were deleted; it is preserved and reviewed
69
+ together with the translated messages. A removal-only locale has empty \`messages\` and
70
+ \`sourceHashes\` objects and still carries the review marker.
61
71
 
62
- ## Apply and validate
72
+ Review covers meaning, tone, brand spelling and truthful claims. Each reviewed locale object
73
+ gets \`"reviewed": true\` next to \`sourceHashes\` and \`messages\`; apply rejects a locale without
74
+ this marker. Source hashes detect source edits made while translation was in progress — when
75
+ the source changed, a fresh prepare and re-translation of the changed entries is required.
76
+
77
+ ## Step 3 — Apply and validate
63
78
 
64
79
  \`\`\`bash
65
80
  extenshi localize apply ./extension --translations ./localization/translations.json --protect MyBrand
66
81
  extenshi localize check ./extension --protect MyBrand
67
82
  \`\`\`
68
83
 
69
- Apply validates the bundle before updating _locales. Keep .extenshi-localization.json
70
- with the project: it records source and reviewed target hashes for incremental updates. Direct target edits require re-review. Re-run
71
- prepare after changing source messages. Review the diff and resolve validation errors;
72
- do not bypass placeholder, protected-term or listing-risk failures to get a green result.
73
-
74
- ## Release review gates
75
-
76
- - Run review-risk for every target locale using the exact command documented by your
77
- installed CLI's help. Resolve listing risks against the real build and retain reports.
78
- - Have a fluent reviewer inspect the copy and any full store descriptions/screenshots.
79
- - Load the packaged extension under each target language. Check popup/options, long
80
- strings, truncation and keyboard accessibility. For Arabic/Hebrew, inspect RTL direction,
81
- layout and mixed text/numbers. A locale file or passing CLI check does not prove RTL UI support.
82
- - Rebuild and check every browser artifact. Publish only within the developer's authorization.
84
+ Apply validates the bundle before it updates \`_locales\`. \`.extenshi-localization.json\` belongs
85
+ in the project: it records source and reviewed target hashes for incremental updates. Direct
86
+ edits to target files require re-review, and changed source messages require a new prepare.
87
+ Validation errors (placeholders, protected terms, listing risks) are resolved in the copy;
88
+ they are not bypassed to reach a passing result.
89
+
90
+ ## Release checks
91
+
92
+ - \`review-risk\` runs for every target locale (exact syntax: the installed CLI's help); listing
93
+ risks are resolved against the real build and the reports are kept.
94
+ - A fluent reviewer inspects the copy, full store descriptions and screenshots.
95
+ - The packaged extension is loaded under each target language: popup/options, long strings,
96
+ truncation and keyboard accessibility. Arabic/Hebrew additionally need RTL direction,
97
+ layout and mixed text/number checks — a locale file or a passing CLI check does not prove
98
+ RTL UI support.
99
+ - Every browser artifact is rebuilt and checked. Publication stays within the developer's
100
+ authorization.
83
101
 
84
102
  Documentation: https://docs.extenshi.io/developers/localization
85
103
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"localize-workflow.js","sourceRoot":"","sources":["../src/localize-workflow.ts"],"names":[],"mappings":"AAAA,uGAAuG;AACvG,MAAM,UAAU,sBAAsB;IACrC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkFP,CAAA;AACD,CAAC"}
1
+ {"version":3,"file":"localize-workflow.js","sourceRoot":"","sources":["../src/localize-workflow.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB;IACrC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+FP,CAAA;AACD,CAAC"}
package/dist/pay.d.ts CHANGED
@@ -208,7 +208,7 @@ export type PayMethod = keyof typeof paySchemas;
208
208
  export type PayBff = {
209
209
  [M in PayMethod]: (input: z.infer<(typeof paySchemas)[M]>) => Promise<unknown>;
210
210
  };
211
- export declare const PAY_OPERATIONS: readonly [readonly ["listPayApps", "list_pay_apps", "list", "payApp.list", false, "List your independent Pay applications. No development project required. Follow nextCursor for more results."], readonly ["createPayApp", "create_pay_app", "create", "payApp.create", true, "Create an independent Pay application; linking a development project is optional. Creates a new application on every call: do not retry blindly after a timeout."], readonly ["getPayApp", "get_pay_app", "get", "payApp.get", false, "Read your Pay application and optional project link."], readonly ["getPayReadiness", "get_pay_readiness", "readiness", "payApp.readiness", false, "Check current checkout and launch prerequisites. A passing checkout check does not prove a live external purchase or SDK publication."], readonly ["linkPayApp", "link_pay_app", "link", "payApp.link", true, "Link your Pay application to your development project. Existing purchases remain attached to the Pay application."], readonly ["unlinkPayApp", "unlink_pay_app", "unlink", "payApp.unlink", true, "Remove the optional development-project link without deleting Pay data."], readonly ["archivePayApp", "archive_pay_app", "archive", "payApp.archive", true, "Archive your application and stop new checkout. Preserve payment records and existing entitlements."], readonly ["exportPayData", "export_pay_data", "export", "payApp.export", false, "Export one page of your application data. Follow nextCursor until null for a complete export. Customer/payment data is sensitive: save only to an author-controlled destination; never paste into public issues."], readonly ["getPaySeller", "get_pay_seller", "seller", "paySeller.get", false, "Read seller connection, public profile, offers and publishable SDK key. Agreement signing and KYC require the author in the browser."], readonly ["connectPaySeller", "connect_pay_seller", "connect", "paySeller.connect", true, "Start Stripe Connect onboarding and return a browser action URL. The author must complete KYC and legal acceptance; never do these on their behalf."], readonly ["refreshPaySeller", "refresh_pay_seller", "refresh", "paySeller.refreshStatus", true, "Refresh current payment-provider onboarding status. This does not complete KYC or accept agreements."], readonly ["setPaySellerProfile", "set_pay_seller_profile", "profile", "paySeller.setPublicProfile", true, "Save author-confirmed public seller identity, support and terms links. Never invent legal identity or terms."], readonly ["upsertPayOffer", "upsert_pay_offer", "offer-upsert", "paySeller.upsertOffer", true, "Create or update an offer by stable SKU. Price is in minor currency units. Use only the author-approved price, billing interval and features."], readonly ["archivePayOffer", "archive_pay_offer", "offer-archive", "paySeller.archiveOffer", true, "Stop offering a SKU for new checkout; preserve historical purchases."], readonly ["setPayEnabled", "set_pay_enabled", "enable", "paySeller.setEnabled", true, "Explicitly enable or disable new payments. Enabling is a live commerce change: only do so with author authorization and after checking readiness. Backend prerequisites remain enforced."], readonly ["rotatePayKey", "rotate_pay_key", "rotate-key", "paySeller.rotatePublishableKey", true, "Generate a new publishable SDK key. Prior keys remain accepted for installed extension builds; this is not secret revocation. Never retry blindly."]];
211
+ export declare const PAY_OPERATIONS: readonly [readonly ["listPayApps", "list_pay_apps", "list", "payApp.list", false, "List your independent Pay applications. No development project required. Paginated: nextCursor is set while more results exist."], readonly ["createPayApp", "create_pay_app", "create", "payApp.create", true, "Create an independent Pay application; linking a development project is optional. Not idempotent: each call creates a new application, including a call repeated after a timeout."], readonly ["getPayApp", "get_pay_app", "get", "payApp.get", false, "Read your Pay application and optional project link."], readonly ["getPayReadiness", "get_pay_readiness", "readiness", "payApp.readiness", false, "Check current checkout and launch prerequisites. A passing checkout check does not prove a live external purchase or SDK publication."], readonly ["linkPayApp", "link_pay_app", "link", "payApp.link", true, "Link your Pay application to your development project. Existing purchases remain attached to the Pay application."], readonly ["unlinkPayApp", "unlink_pay_app", "unlink", "payApp.unlink", true, "Remove the optional development-project link without deleting Pay data."], readonly ["archivePayApp", "archive_pay_app", "archive", "payApp.archive", true, "Archive your application and stop new checkout. Payment records and existing entitlements are preserved."], readonly ["exportPayData", "export_pay_data", "export", "payApp.export", false, "Export one page of one resource (offers, payments, subscriptions, entitlements or customers). nextCursor is null on the last page. The output contains sensitive customer and payment data."], readonly ["getPaySeller", "get_pay_seller", "seller", "paySeller.get", false, "Read seller connection, public profile, offers, the publishable SDK key and the public entitlement verification key. Those two keys are the ones meant to be embedded in extension code; secret keys are not part of the response. Agreement signing and KYC take place in the browser."], readonly ["connectPaySeller", "connect_pay_seller", "connect", "paySeller.connect", true, "Start Stripe Connect onboarding and return a browser action URL. KYC and legal acceptance are completed by the author at that URL; this tool does not perform them."], readonly ["refreshPaySeller", "refresh_pay_seller", "refresh", "paySeller.refreshStatus", true, "Refresh current payment-provider onboarding status. This does not complete KYC or accept agreements."], readonly ["setPaySellerProfile", "set_pay_seller_profile", "profile", "paySeller.setPublicProfile", true, "Save the public seller profile: display name, support URL or email, and terms URL. The values are stored as provided and are publicly visible."], readonly ["upsertPayOffer", "upsert_pay_offer", "offer-upsert", "paySeller.upsertOffer", true, "Create or update an offer keyed by a stable SKU. Price is in minor currency units. Subscriptions keep the given billing interval; one-time and lifetime offers store no interval. Price and features are stored as provided."], readonly ["archivePayOffer", "archive_pay_offer", "offer-archive", "paySeller.archiveOffer", true, "Stop offering a SKU for new checkout; historical purchases are preserved."], readonly ["setPayEnabled", "set_pay_enabled", "enable", "paySeller.setEnabled", true, "Enable or disable new payments for the application; requires a connected payment provider. Enabling re-reads the seller status from the provider (charges and payouts). It does not verify the public profile, agreement or offer sync: buyers can check out only when every readiness check reported by get_pay_readiness passes. Enabling is a live commerce change."], readonly ["rotatePayKey", "rotate_pay_key", "rotate-key", "paySeller.rotatePublishableKey", true, "Generate a new publishable SDK key. Not idempotent: each call issues another key. Prior keys remain accepted for installed extension builds; this does not revoke any secret."]];
212
212
  /** The legacy seller API uses projectId as the payment namespace. Never substitute a linked project ID. */
213
213
  export declare function payWireInput(method: PayMethod, input: Record<string, unknown>): Record<string, unknown>;
214
214
  //# sourceMappingURL=pay.d.ts.map
package/dist/pay.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"pay.d.ts","sourceRoot":"","sources":["../src/pay.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAavB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDb,CAAA;AACV,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,UAAU,CAAA;AAC/C,MAAM,MAAM,MAAM,GAAG;KAAG,CAAC,IAAI,SAAS,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC;CAAE,CAAA;AACvG,eAAO,MAAM,cAAc,61GAiIjB,CAAA;AAEV,2GAA2G;AAC3G,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAIvG"}
1
+ {"version":3,"file":"pay.d.ts","sourceRoot":"","sources":["../src/pay.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAavB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDb,CAAA;AACV,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,UAAU,CAAA;AAC/C,MAAM,MAAM,MAAM,GAAG;KAAG,CAAC,IAAI,SAAS,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC;CAAE,CAAA;AACvG,eAAO,MAAM,cAAc,m1HAiIjB,CAAA;AAEV,2GAA2G;AAC3G,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAIvG"}
package/dist/pay.js CHANGED
@@ -69,7 +69,7 @@ export const PAY_OPERATIONS = [
69
69
  'list',
70
70
  'payApp.list',
71
71
  false,
72
- 'List your independent Pay applications. No development project required. Follow nextCursor for more results.',
72
+ 'List your independent Pay applications. No development project required. Paginated: nextCursor is set while more results exist.',
73
73
  ],
74
74
  [
75
75
  'createPayApp',
@@ -77,7 +77,7 @@ export const PAY_OPERATIONS = [
77
77
  'create',
78
78
  'payApp.create',
79
79
  true,
80
- 'Create an independent Pay application; linking a development project is optional. Creates a new application on every call: do not retry blindly after a timeout.',
80
+ 'Create an independent Pay application; linking a development project is optional. Not idempotent: each call creates a new application, including a call repeated after a timeout.',
81
81
  ],
82
82
  [
83
83
  'getPayApp',
@@ -117,7 +117,7 @@ export const PAY_OPERATIONS = [
117
117
  'archive',
118
118
  'payApp.archive',
119
119
  true,
120
- 'Archive your application and stop new checkout. Preserve payment records and existing entitlements.',
120
+ 'Archive your application and stop new checkout. Payment records and existing entitlements are preserved.',
121
121
  ],
122
122
  [
123
123
  'exportPayData',
@@ -125,7 +125,7 @@ export const PAY_OPERATIONS = [
125
125
  'export',
126
126
  'payApp.export',
127
127
  false,
128
- 'Export one page of your application data. Follow nextCursor until null for a complete export. Customer/payment data is sensitive: save only to an author-controlled destination; never paste into public issues.',
128
+ 'Export one page of one resource (offers, payments, subscriptions, entitlements or customers). nextCursor is null on the last page. The output contains sensitive customer and payment data.',
129
129
  ],
130
130
  [
131
131
  'getPaySeller',
@@ -133,7 +133,7 @@ export const PAY_OPERATIONS = [
133
133
  'seller',
134
134
  'paySeller.get',
135
135
  false,
136
- 'Read seller connection, public profile, offers and publishable SDK key. Agreement signing and KYC require the author in the browser.',
136
+ 'Read seller connection, public profile, offers, the publishable SDK key and the public entitlement verification key. Those two keys are the ones meant to be embedded in extension code; secret keys are not part of the response. Agreement signing and KYC take place in the browser.',
137
137
  ],
138
138
  [
139
139
  'connectPaySeller',
@@ -141,7 +141,7 @@ export const PAY_OPERATIONS = [
141
141
  'connect',
142
142
  'paySeller.connect',
143
143
  true,
144
- 'Start Stripe Connect onboarding and return a browser action URL. The author must complete KYC and legal acceptance; never do these on their behalf.',
144
+ 'Start Stripe Connect onboarding and return a browser action URL. KYC and legal acceptance are completed by the author at that URL; this tool does not perform them.',
145
145
  ],
146
146
  [
147
147
  'refreshPaySeller',
@@ -157,7 +157,7 @@ export const PAY_OPERATIONS = [
157
157
  'profile',
158
158
  'paySeller.setPublicProfile',
159
159
  true,
160
- 'Save author-confirmed public seller identity, support and terms links. Never invent legal identity or terms.',
160
+ 'Save the public seller profile: display name, support URL or email, and terms URL. The values are stored as provided and are publicly visible.',
161
161
  ],
162
162
  [
163
163
  'upsertPayOffer',
@@ -165,7 +165,7 @@ export const PAY_OPERATIONS = [
165
165
  'offer-upsert',
166
166
  'paySeller.upsertOffer',
167
167
  true,
168
- 'Create or update an offer by stable SKU. Price is in minor currency units. Use only the author-approved price, billing interval and features.',
168
+ 'Create or update an offer keyed by a stable SKU. Price is in minor currency units. Subscriptions keep the given billing interval; one-time and lifetime offers store no interval. Price and features are stored as provided.',
169
169
  ],
170
170
  [
171
171
  'archivePayOffer',
@@ -173,7 +173,7 @@ export const PAY_OPERATIONS = [
173
173
  'offer-archive',
174
174
  'paySeller.archiveOffer',
175
175
  true,
176
- 'Stop offering a SKU for new checkout; preserve historical purchases.',
176
+ 'Stop offering a SKU for new checkout; historical purchases are preserved.',
177
177
  ],
178
178
  [
179
179
  'setPayEnabled',
@@ -181,7 +181,7 @@ export const PAY_OPERATIONS = [
181
181
  'enable',
182
182
  'paySeller.setEnabled',
183
183
  true,
184
- 'Explicitly enable or disable new payments. Enabling is a live commerce change: only do so with author authorization and after checking readiness. Backend prerequisites remain enforced.',
184
+ 'Enable or disable new payments for the application; requires a connected payment provider. Enabling re-reads the seller status from the provider (charges and payouts). It does not verify the public profile, agreement or offer sync: buyers can check out only when every readiness check reported by get_pay_readiness passes. Enabling is a live commerce change.',
185
185
  ],
186
186
  [
187
187
  'rotatePayKey',
@@ -189,7 +189,7 @@ export const PAY_OPERATIONS = [
189
189
  'rotate-key',
190
190
  'paySeller.rotatePublishableKey',
191
191
  true,
192
- 'Generate a new publishable SDK key. Prior keys remain accepted for installed extension builds; this is not secret revocation. Never retry blindly.',
192
+ 'Generate a new publishable SDK key. Not idempotent: each call issues another key. Prior keys remain accepted for installed extension builds; this does not revoke any secret.',
193
193
  ],
194
194
  ];
195
195
  /** The legacy seller API uses projectId as the payment namespace. Never substitute a linked project ID. */
package/dist/pay.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"pay.js","sourceRoot":"","sources":["../src/pay.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,GAAG,GAA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R,sBAAsB;QACtB,IAAI;QACJ,wWAAwW;KACxW;IACD;QACC,cAAc;QACd,gBAAgB;QAChB,YAAY;QACZ,gCAAgC;QAChC,IAAI;QACJ,+KAA+K;KAC/K;CACQ,CAAA;AAEV,2GAA2G;AAC3G,MAAM,UAAU,YAAY,CAAC,MAAiB,EAAE,KAA8B;IAC7E,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC;QAAE,OAAO,KAAK,CAAA;IAC/F,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAA;IAChC,OAAO,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAA;AACrC,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Agent-readable outcome for `update_privacy_policy_with_ai`.
3
+ *
4
+ * The backend always returns a proposal: an AI draft when the model ran and
5
+ * its draft passed the category guard, otherwise a deterministic section
6
+ * merge. This puts the difference first in the tool result (`aiStep` +
7
+ * `notice`) so an agent cannot present a merge as an AI draft.
8
+ *
9
+ * Skew-safe in both directions: a backend that returns `ai` (2026-09+) is
10
+ * described from it; an older backend that only returns `usedLlm` /
11
+ * `aiDegraded` / `keptHeadings` is described from those, and its
12
+ * `kind: 'ai_updated'` on a non-AI proposal is corrected to `edited`.
13
+ */
14
+ export type AiStep = 'ran' | 'did_not_run' | 'discarded' | 'not_needed';
15
+ export interface PrivacyAiUpdateView {
16
+ aiStep: AiStep;
17
+ notice: string;
18
+ [key: string]: unknown;
19
+ }
20
+ export declare function describePrivacyAiUpdate(result: unknown): PrivacyAiUpdateView;
21
+ //# sourceMappingURL=privacy-ai-outcome.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"privacy-ai-outcome.d.ts","sourceRoot":"","sources":["../src/privacy-ai-outcome.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,MAAM,GAAG,KAAK,GAAG,aAAa,GAAG,WAAW,GAAG,YAAY,CAAA;AAEvE,MAAM,WAAW,mBAAmB;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACtB;AAaD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,OAAO,GAAG,mBAAmB,CA0C5E"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Agent-readable outcome for `update_privacy_policy_with_ai`.
3
+ *
4
+ * The backend always returns a proposal: an AI draft when the model ran and
5
+ * its draft passed the category guard, otherwise a deterministic section
6
+ * merge. This puts the difference first in the tool result (`aiStep` +
7
+ * `notice`) so an agent cannot present a merge as an AI draft.
8
+ *
9
+ * Skew-safe in both directions: a backend that returns `ai` (2026-09+) is
10
+ * described from it; an older backend that only returns `usedLlm` /
11
+ * `aiDegraded` / `keptHeadings` is described from those, and its
12
+ * `kind: 'ai_updated'` on a non-AI proposal is corrected to `edited`.
13
+ */
14
+ const AI_STATUSES_NOT_RUN = new Set(['not_configured']);
15
+ const AI_STATUSES_DISCARDED = new Set(['request_failed', 'incomplete_reply', 'rejected']);
16
+ function asRecord(value) {
17
+ return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
18
+ }
19
+ function strings(value) {
20
+ return Array.isArray(value) ? value.filter((v) => typeof v === 'string') : [];
21
+ }
22
+ export function describePrivacyAiUpdate(result) {
23
+ const r = asRecord(result);
24
+ const ai = asRecord(r.ai);
25
+ const status = typeof ai.status === 'string' ? ai.status : undefined;
26
+ const usedLlm = ai.applied === true || (status === undefined && r.usedLlm === true);
27
+ const kept = strings(r.keptHeadings);
28
+ const conflicts = strings(r.conflictHeadings);
29
+ const missing = strings(r.missingCategories);
30
+ let aiStep;
31
+ if (usedLlm)
32
+ aiStep = 'ran';
33
+ else if (status === 'not_needed')
34
+ aiStep = 'not_needed';
35
+ else if (status && AI_STATUSES_NOT_RUN.has(status))
36
+ aiStep = 'did_not_run';
37
+ else if (status && AI_STATUSES_DISCARDED.has(status))
38
+ aiStep = 'discarded';
39
+ // Older backend: no `ai` field. It skipped the model silently when no key
40
+ // was configured, so a customized policy without usedLlm did not get an AI pass.
41
+ else if (r.aiDegraded === true || kept.length > 0)
42
+ aiStep = 'did_not_run';
43
+ else
44
+ aiStep = 'not_needed';
45
+ const reason = typeof ai.reason === 'string' && ai.reason ? ai.reason : undefined;
46
+ let reviewLine = '';
47
+ if (conflicts.length)
48
+ reviewLine += ` Sections that need a manual edit: ${conflicts.join(', ')}.`;
49
+ if (missing.length)
50
+ reviewLine += ` Required data categories not mentioned: ${missing.join(', ')}.`;
51
+ let notice;
52
+ switch (aiStep) {
53
+ case 'ran':
54
+ notice = `${reason ?? 'The proposal is an AI draft.'} Nothing is live until it is published.${reviewLine}`;
55
+ break;
56
+ case 'not_needed':
57
+ notice = `${reason ?? 'No AI step was needed; the proposal is the regenerated policy.'}${reviewLine}`;
58
+ break;
59
+ default:
60
+ notice =
61
+ `${reason ?? 'The AI step did not run. The proposal is the deterministic section merge, not an AI draft.'} ` +
62
+ "proposedMarkdown keeps the author's sections and adds only sections new since the last generated " +
63
+ `baseline; it is not AI-written.${reviewLine}`;
64
+ }
65
+ // Never let a non-AI proposal carry the AI version label into publish.
66
+ const kind = !usedLlm && r.kind === 'ai_updated' ? 'edited' : r.kind;
67
+ return { aiStep, notice, ...r, ...(kind === undefined ? {} : { kind }) };
68
+ }
69
+ //# sourceMappingURL=privacy-ai-outcome.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"privacy-ai-outcome.js","sourceRoot":"","sources":["../src/privacy-ai-outcome.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAUH,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAA;AACvD,MAAM,qBAAqB,GA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,KAAK,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IACpE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAA;AACzE,CAAC"}
package/dist/scan.d.ts CHANGED
@@ -41,5 +41,12 @@ export declare class ScanError extends Error {
41
41
  });
42
42
  }
43
43
  export type ScanReport = Record<string, unknown>;
44
+ /**
45
+ * Why a parsed scan response is not a usable report, or null when it is. The
46
+ * backend has already committed the credit by the time a result arrives, so an
47
+ * unusable body must surface as an error naming the job — never as an empty
48
+ * success the caller cannot tell apart from a clean scan.
49
+ */
50
+ export declare function scanReportProblem(report: unknown): string | null;
44
51
  export declare function scanArtifact(opts: ScanArtifactOptions): Promise<ScanReport>;
45
52
  //# sourceMappingURL=scan.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../src/scan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAWH,MAAM,WAAW,YAAY;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,GAAG,CAAC,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,mBAAmB;IACnC,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,gFAAgF;IAChF,OAAO,EAAE,MAAM,CAAA;IACf,uFAAuF;IACvF,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,YAAY,KAAK,IAAI,CAAA;CACtC;A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AAO,EAAE,MAAM,EAAE,IAAI,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAO;CAOvG;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAEhD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAShE;AAaD,wBAAsB,YAAY,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC,CAwDjF"}
package/dist/scan.js CHANGED
@@ -32,6 +32,30 @@ export class ScanError extends Error {
32
32
  this.retryAfterSec = opts.retryAfterSec;
33
33
  }
34
34
  }
35
+ /**
36
+ * Why a parsed scan response is not a usable report, or null when it is. The
37
+ * backend has already committed the credit by the time a result arrives, so an
38
+ * unusable body must surface as an error naming the job — never as an empty
39
+ * success the caller cannot tell apart from a clean scan.
40
+ */
41
+ export function scanReportProblem(report) {
42
+ if (!report || typeof report !== 'object' || Array.isArray(report))
43
+ return 'the scan returned no report object';
44
+ const r = report;
45
+ if (!Array.isArray(r.scanners)) {
46
+ const job = typeof r.jobId === 'string' ? ` (job ${r.jobId})` : '';
47
+ return `the scan result${job} has no scanner results`;
48
+ }
49
+ return null;
50
+ }
51
+ function assertScanReport(report) {
52
+ const problem = scanReportProblem(report);
53
+ if (problem) {
54
+ throw new ScanError(`Scan finished but ${problem}. If a scan credit was charged, keep the job id and re-run with ` +
55
+ '`npx @extenshi/cli@latest scan <artifact> --format json`, which reads the same backend.');
56
+ }
57
+ return report;
58
+ }
35
59
  export async function scanArtifact(opts) {
36
60
  const { artifactPath, apiKey, scanUrl, extensionId, onProgress } = opts;
37
61
  if (!fs.existsSync(artifactPath)) {
@@ -78,10 +102,10 @@ export async function scanArtifact(opts) {
78
102
  }
79
103
  const contentType = response.headers.get('content-type') ?? '';
80
104
  if (contentType.includes('text/event-stream')) {
81
- return await consumeSseStream(response, onProgress);
105
+ return assertScanReport(await consumeSseStream(response, onProgress));
82
106
  }
83
107
  // Legacy single-JSON mode (server ignored the Accept header).
84
- return await parseJsonBody(response);
108
+ return assertScanReport(await parseJsonBody(response));
85
109
  }
86
110
  async function consumeSseStream(response, onProgress) {
87
111
  if (!response.body)