@wildo-ai/external-connectors-public 1.1.9 → 1.1.11
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/dist/esm/app/engine-frontend-app-provider-registry.d.ts.map +1 -1
- package/dist/esm/app/engine-frontend-app-provider-registry.js +4 -7
- package/dist/esm/app/engine-frontend-app-provider-registry.js.map +1 -1
- package/dist/esm/app/index.d.ts +1 -0
- package/dist/esm/app/index.d.ts.map +1 -1
- package/dist/esm/app/index.js +1 -0
- package/dist/esm/app/index.js.map +1 -1
- package/dist/esm/companion-exports.d.ts +3 -0
- package/dist/esm/companion-exports.d.ts.map +1 -1
- package/dist/esm/companion-exports.js +35 -10
- package/dist/esm/companion-exports.js.map +1 -1
- package/dist/esm/providers/recaptcha/recaptcha.frontend-website.module.d.ts.map +1 -1
- package/dist/esm/providers/recaptcha/recaptcha.frontend-website.module.js +4 -3
- package/dist/esm/providers/recaptcha/recaptcha.frontend-website.module.js.map +1 -1
- package/dist/esm/shared/activate-frontend-provider-sdks.d.ts +21 -3
- package/dist/esm/shared/activate-frontend-provider-sdks.d.ts.map +1 -1
- package/dist/esm/shared/activate-frontend-provider-sdks.js +51 -4
- package/dist/esm/shared/activate-frontend-provider-sdks.js.map +1 -1
- package/dist/esm/shared/frontend-provider-consent.d.ts +27 -0
- package/dist/esm/shared/frontend-provider-consent.d.ts.map +1 -1
- package/dist/esm/shared/frontend-provider-consent.js +6 -0
- package/dist/esm/shared/frontend-provider-consent.js.map +1 -1
- package/dist/esm/shared/frontend-provider-on-demand.d.ts +49 -0
- package/dist/esm/shared/frontend-provider-on-demand.d.ts.map +1 -0
- package/dist/esm/shared/frontend-provider-on-demand.js +80 -0
- package/dist/esm/shared/frontend-provider-on-demand.js.map +1 -0
- package/dist/esm/shared/frontend-provider-surface.types.d.ts +37 -1
- package/dist/esm/shared/frontend-provider-surface.types.d.ts.map +1 -1
- package/dist/esm/shared/frontend-provider-surface.types.js +17 -0
- package/dist/esm/shared/frontend-provider-surface.types.js.map +1 -1
- package/dist/esm/shared/hydrate-frontend-providers.d.ts +18 -1
- package/dist/esm/shared/hydrate-frontend-providers.d.ts.map +1 -1
- package/dist/esm/shared/hydrate-frontend-providers.js +46 -5
- package/dist/esm/shared/hydrate-frontend-providers.js.map +1 -1
- package/dist/esm/shared/load-frontend-provider-scripts.js +1 -1
- package/dist/esm/shared/load-frontend-provider-scripts.js.map +1 -1
- package/dist/esm/shared/provider-component-registry.js +2 -2
- package/dist/esm/website/engine-frontend-website-provider-registry.d.ts.map +1 -1
- package/dist/esm/website/engine-frontend-website-provider-registry.js +0 -8
- package/dist/esm/website/engine-frontend-website-provider-registry.js.map +1 -1
- package/package.json +3 -15
- package/dist/esm/providers/posthog/index.d.ts +0 -2
- package/dist/esm/providers/posthog/index.d.ts.map +0 -1
- package/dist/esm/providers/posthog/index.js +0 -2
- package/dist/esm/providers/posthog/index.js.map +0 -1
- package/dist/esm/providers/posthog/posthog-browser-options.d.ts +0 -34
- package/dist/esm/providers/posthog/posthog-browser-options.d.ts.map +0 -1
- package/dist/esm/providers/posthog/posthog-browser-options.js +0 -34
- package/dist/esm/providers/posthog/posthog-browser-options.js.map +0 -1
- package/dist/esm/providers/posthog/posthog.frontend-app.module.d.ts +0 -38
- package/dist/esm/providers/posthog/posthog.frontend-app.module.d.ts.map +0 -1
- package/dist/esm/providers/posthog/posthog.frontend-app.module.js +0 -111
- package/dist/esm/providers/posthog/posthog.frontend-app.module.js.map +0 -1
- package/dist/esm/providers/posthog/posthog.frontend-website.module.d.ts +0 -22
- package/dist/esm/providers/posthog/posthog.frontend-website.module.d.ts.map +0 -1
- package/dist/esm/providers/posthog/posthog.frontend-website.module.js +0 -95
- package/dist/esm/providers/posthog/posthog.frontend-website.module.js.map +0 -1
- package/dist/esm/providers/sentry/sentry.frontend-app.module.d.ts +0 -57
- package/dist/esm/providers/sentry/sentry.frontend-app.module.d.ts.map +0 -1
- package/dist/esm/providers/sentry/sentry.frontend-app.module.js +0 -146
- package/dist/esm/providers/sentry/sentry.frontend-app.module.js.map +0 -1
- package/dist/esm/providers/sentry/sentry.frontend-website.module.d.ts +0 -30
- package/dist/esm/providers/sentry/sentry.frontend-website.module.d.ts.map +0 -1
- package/dist/esm/providers/sentry/sentry.frontend-website.module.js +0 -95
- package/dist/esm/providers/sentry/sentry.frontend-website.module.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-frontend-app-provider-registry.d.ts","sourceRoot":"","sources":["../../../../src/app/engine-frontend-app-provider-registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"engine-frontend-app-provider-registry.d.ts","sourceRoot":"","sources":["../../../../src/app/engine-frontend-app-provider-registry.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,kCAAkC,CAAC;AA+B5F,eAAO,MAAM,yCAAyC,EAAE,mCAOvD,CAAC;AAEF,eAAO,MAAM,iCAAiC,8EAE7C,CAAC"}
|
|
@@ -3,11 +3,6 @@ import { GoogleDriveFrontendAppProvider } from '../providers/google-drive/index.
|
|
|
3
3
|
// The owning source directly: a new provider directory gets no intermediary barrel.
|
|
4
4
|
import { GooglePlacesFrontendAppProvider } from '../providers/google-places/google-places.frontend-app.module.js';
|
|
5
5
|
import { MicrosoftOneDriveFrontendAppProvider } from '../providers/microsoft-onedrive/index.js';
|
|
6
|
-
// The owning source directly, as for Sentry: the `posthog` barrel exports the WEBSITE module.
|
|
7
|
-
import { PostHogFrontendAppProvider } from '../providers/posthog/posthog.frontend-app.module.js';
|
|
8
|
-
// The owning source directly — see the note in the website registry: a barrel exporting
|
|
9
|
-
// both of Sentry's surface modules would put the website module in this app bundle.
|
|
10
|
-
import { SentryFrontendAppProvider } from '../providers/sentry/sentry.frontend-app.module.js';
|
|
11
6
|
import { composeFrontendAppProviders } from './compose-frontend-app-providers.js';
|
|
12
7
|
/**
|
|
13
8
|
* The engine's application-tier browser modules: only providers that RUN something in the browser.
|
|
@@ -25,14 +20,16 @@ import { composeFrontendAppProviders } from './compose-frontend-app-providers.js
|
|
|
25
20
|
* "identity-only" frontend presence (a declaration whose only content is a name the ref already owns).
|
|
26
21
|
* A vendor whose BROWSER code a surface does run — Google One Tap, Stripe Elements (#1741) — gets a
|
|
27
22
|
* module then, under a capability that says what it runs.
|
|
23
|
+
*
|
|
24
|
+
* None of these modules loads a vendor npm package: a provider whose browser part needs one is a registry module, whose
|
|
25
|
+
* facet package depends on the SDK and pins it (#2786; Sentry left with #2793, PostHog with #2579). No engine browser
|
|
26
|
+
* module carries a vendor SDK, not even as an optional peer (the backend's remainder is #2791).
|
|
28
27
|
*/
|
|
29
28
|
const frontendAppProviders = [
|
|
30
29
|
DropboxFrontendAppProvider,
|
|
31
30
|
GoogleDriveFrontendAppProvider,
|
|
32
31
|
GooglePlacesFrontendAppProvider,
|
|
33
32
|
MicrosoftOneDriveFrontendAppProvider,
|
|
34
|
-
PostHogFrontendAppProvider,
|
|
35
|
-
SentryFrontendAppProvider,
|
|
36
33
|
];
|
|
37
34
|
export const EngineFrontendAppProviderRegistryFragment = {
|
|
38
35
|
modules: new Map(frontendAppProviders.map((provider) => [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-frontend-app-provider-registry.js","sourceRoot":"","sources":["../../../../src/app/engine-frontend-app-provider-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAC3E,oFAAoF;AACpF,OAAO,EAAE,+BAA+B,EAAE,MAAM,8DAA8D,CAAC;AAC/G,OAAO,EAAE,oCAAoC,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"engine-frontend-app-provider-registry.js","sourceRoot":"","sources":["../../../../src/app/engine-frontend-app-provider-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAC3E,oFAAoF;AACpF,OAAO,EAAE,+BAA+B,EAAE,MAAM,8DAA8D,CAAC;AAC/G,OAAO,EAAE,oCAAoC,EAAE,MAAM,iCAAiC,CAAC;AAEvF,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAI/E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,oBAAoB,GAAG;IAC3B,0BAA0B;IAC1B,8BAA8B;IAC9B,+BAA+B;IAC/B,oCAAoC;CAC5B,CAAC;AAEX,MAAM,CAAC,MAAM,yCAAyC,GAAwC;IAC5F,OAAO,EAAE,IAAI,GAAG,CACd,oBAAoB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;QACrC,QAAQ,CAAC,QAAQ,CAAC,GAA6B;QAC/C,QAAQ;KACT,CAAC,CACH;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,iCAAiC,GAAG,2BAA2B,CAC1E,yCAAyC,CAC1C,CAAC","sourcesContent":["import { DropboxFrontendAppProvider } from '../providers/dropbox';\nimport { GoogleDriveFrontendAppProvider } from '../providers/google-drive';\n// The owning source directly: a new provider directory gets no intermediary barrel.\nimport { GooglePlacesFrontendAppProvider } from '../providers/google-places/google-places.frontend-app.module';\nimport { MicrosoftOneDriveFrontendAppProvider } from '../providers/microsoft-onedrive';\n\nimport { composeFrontendAppProviders } from './compose-frontend-app-providers';\nimport type { FrontendAppProviderRegistryFragment } from './compose-frontend-app-providers';\nimport type { FrontendAppProviderRef } from './frontend-app-provider-registry.types';\n\n/**\n * The engine's application-tier browser modules: only providers that RUN something in the browser.\n *\n * The four sign-in vendors (Apple, GitHub, Google, Microsoft) and Stripe used to have modules here that\n * loaded nothing and declared `SSO_OAUTH2` / `BILLING` only so the sign-in buttons, the identity-links\n * page and the billing components could read a provider display name off them (#1701). Since #1895 that\n * name belongs to the provider REF (`providers.<ref>.displayName`, planned and generated for every\n * declared provider), and those surfaces derive it from the ref they already hold — the configured\n * `auth.socialOAuth2Providers` key, the configured `billing.providerRef`. The modules then carried\n * nothing, while still telling the catalogue that the browser covers sign-in and billing, so they were\n * removed. Sign-in is a redirect to the vendor and checkout / the customer portal are hosted redirects:\n * no vendor code runs on the page. Rejected: keeping them and listing the sign-in buttons from the\n * registry (a module that loads nothing would become a precondition for a button), and a new\n * \"identity-only\" frontend presence (a declaration whose only content is a name the ref already owns).\n * A vendor whose BROWSER code a surface does run — Google One Tap, Stripe Elements (#1741) — gets a\n * module then, under a capability that says what it runs.\n *\n * None of these modules loads a vendor npm package: a provider whose browser part needs one is a registry module, whose\n * facet package depends on the SDK and pins it (#2786; Sentry left with #2793, PostHog with #2579). No engine browser\n * module carries a vendor SDK, not even as an optional peer (the backend's remainder is #2791).\n */\nconst frontendAppProviders = [\n DropboxFrontendAppProvider,\n GoogleDriveFrontendAppProvider,\n GooglePlacesFrontendAppProvider,\n MicrosoftOneDriveFrontendAppProvider,\n] as const;\n\nexport const EngineFrontendAppProviderRegistryFragment: FrontendAppProviderRegistryFragment = {\n modules: new Map(\n frontendAppProviders.map((provider) => [\n provider.metadata.ref as FrontendAppProviderRef,\n provider,\n ]),\n ),\n};\n\nexport const EngineFrontendAppProviderRegistry = composeFrontendAppProviders(\n EngineFrontendAppProviderRegistryFragment,\n);\n"]}
|
package/dist/esm/app/index.d.ts
CHANGED
|
@@ -14,5 +14,6 @@ export * from '../shared/activate-frontend-provider-sdks';
|
|
|
14
14
|
export * from '../shared/load-frontend-provider-scripts';
|
|
15
15
|
export * from '../shared/frontend-provider-consent';
|
|
16
16
|
export * from '../shared/provider-component-registry';
|
|
17
|
+
export * from '../shared/frontend-provider-on-demand';
|
|
17
18
|
export * from '../providers/google-places/google-places.frontend-app.module';
|
|
18
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/app/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,sCAAsC,CAAC;AACrD,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,yCAAyC,CAAC;AACxD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,sCAAsC,CAAC;AACrD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AACpD,cAAc,uCAAuC,CAAC;AAItD,cAAc,8DAA8D,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/app/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,sCAAsC,CAAC;AACrD,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,yCAAyC,CAAC;AACxD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,sCAAsC,CAAC;AACrD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AACpD,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC;AAItD,cAAc,8DAA8D,CAAC"}
|
package/dist/esm/app/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export * from '../shared/activate-frontend-provider-sdks.js';
|
|
|
14
14
|
export * from '../shared/load-frontend-provider-scripts.js';
|
|
15
15
|
export * from '../shared/frontend-provider-consent.js';
|
|
16
16
|
export * from '../shared/provider-component-registry.js';
|
|
17
|
+
export * from '../shared/frontend-provider-on-demand.js';
|
|
17
18
|
// Google Places' address-lookup constants (#561): the operation ids and the region-code limit its adapter, in the
|
|
18
19
|
// facet library, and the backend join test both read. The module has no other surface, so exporting it puts no
|
|
19
20
|
// second facet's code in this bundle.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/app/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,sCAAsC,CAAC;AACrD,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,yCAAyC,CAAC;AACxD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,sCAAsC,CAAC;AACrD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AACpD,cAAc,uCAAuC,CAAC;AACtD,kHAAkH;AAClH,+GAA+G;AAC/G,sCAAsC;AACtC,cAAc,8DAA8D,CAAC","sourcesContent":["/**\n * Public surface of `@wildo-ai/external-connectors-public/app`.\n *\n * Browser-bound, no secrets. Phase 1 wires `composeFrontendAppProviders`.\n */\n\nexport * from './frontend-app-provider-module.types';\nexport * from './frontend-app-provider-registry.types';\nexport * from './compose-frontend-app-providers';\nexport * from './engine-frontend-app-provider-registry';\nexport * from './compose-hydrated-frontend-app-providers';\nexport * from '../shared/frontend-provider-surface.types';\nexport * from '../shared/hydrate-frontend-providers';\nexport * from '../shared/activate-frontend-provider-sdks';\nexport * from '../shared/load-frontend-provider-scripts';\nexport * from '../shared/frontend-provider-consent';\nexport * from '../shared/provider-component-registry';\n// Google Places' address-lookup constants (#561): the operation ids and the region-code limit its adapter, in the\n// facet library, and the backend join test both read. The module has no other surface, so exporting it puts no\n// second facet's code in this bundle.\nexport * from '../providers/google-places/google-places.frontend-app.module';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/app/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,sCAAsC,CAAC;AACrD,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,yCAAyC,CAAC;AACxD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,sCAAsC,CAAC;AACrD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AACpD,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC;AACtD,kHAAkH;AAClH,+GAA+G;AAC/G,sCAAsC;AACtC,cAAc,8DAA8D,CAAC","sourcesContent":["/**\n * Public surface of `@wildo-ai/external-connectors-public/app`.\n *\n * Browser-bound, no secrets. Phase 1 wires `composeFrontendAppProviders`.\n */\n\nexport * from './frontend-app-provider-module.types';\nexport * from './frontend-app-provider-registry.types';\nexport * from './compose-frontend-app-providers';\nexport * from './engine-frontend-app-provider-registry';\nexport * from './compose-hydrated-frontend-app-providers';\nexport * from '../shared/frontend-provider-surface.types';\nexport * from '../shared/hydrate-frontend-providers';\nexport * from '../shared/activate-frontend-provider-sdks';\nexport * from '../shared/load-frontend-provider-scripts';\nexport * from '../shared/frontend-provider-consent';\nexport * from '../shared/provider-component-registry';\nexport * from '../shared/frontend-provider-on-demand';\n// Google Places' address-lookup constants (#561): the operation ids and the region-code limit its adapter, in the\n// facet library, and the backend join test both read. The module has no other surface, so exporting it puts no\n// second facet's code in this bundle.\nexport * from '../providers/google-places/google-places.frontend-app.module';\n"]}
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
import { AppFrontendType, type ProviderFrontendCspFootprintDeclaration, type ProviderFrontendScriptDeclaration, type ProviderFrontendComponentDescriptor, type ProviderFrontendSdkDescriptor, type ProviderComplianceProfile, type ProviderMetadata } from '@wildo-ai/saas-models/public-runtime';
|
|
40
40
|
import { EngineCapability, type ProviderCompanionContribution, type RuntimeOwnerCompanionExports } from '@wildo-ai/saas-models';
|
|
41
41
|
import type { FileStorageAccepted } from '@wildo-ai/saas-models/public-runtime';
|
|
42
|
+
import { type ProviderFrontendSdkActivationMode } from './shared/frontend-provider-surface.types';
|
|
42
43
|
/**
|
|
43
44
|
* The engine slots a BROWSER module may fill: the ones whose work happens on the page.
|
|
44
45
|
*
|
|
@@ -75,6 +76,8 @@ interface FrontendProviderModuleShape {
|
|
|
75
76
|
sdk?: {
|
|
76
77
|
readonly descriptor: ProviderFrontendSdkDescriptor;
|
|
77
78
|
readonly stoppable?: true;
|
|
79
|
+
readonly activation?: ProviderFrontendSdkActivationMode;
|
|
80
|
+
readonly servesOnDemandContext?: unknown;
|
|
78
81
|
};
|
|
79
82
|
components?: Readonly<Record<string, ProviderFrontendComponentDescriptor & {
|
|
80
83
|
readonly load?: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"companion-exports.d.ts","sourceRoot":"","sources":["../../../src/companion-exports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EACL,eAAe,EAIf,KAAK,uCAAuC,EAC5C,KAAK,iCAAiC,EACtC,KAAK,mCAAmC,EACxC,KAAK,6BAA6B,
|
|
1
|
+
{"version":3,"file":"companion-exports.d.ts","sourceRoot":"","sources":["../../../src/companion-exports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EACL,eAAe,EAIf,KAAK,uCAAuC,EAC5C,KAAK,iCAAiC,EACtC,KAAK,mCAAmC,EACxC,KAAK,6BAA6B,EAElC,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,gBAAgB,EAEhB,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EAClC,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAuC,KAAK,iCAAiC,EAAE,MAAM,0CAA0C,CAAC;AAWvI;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kCAAkC,EAAE,WAAW,CAAC,gBAAgB,CAG3E,CAAC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uGAAuG;AACvG,eAAO,MAAM,0CAA0C,EAAE,6BAA6B,EAGnF,CAAC;AAEJ,sGAAsG;AACtG,eAAO,MAAM,mCAAmC,EAAE,6BAA6B,EAI9E,CAAC;AAEF;;;;GAIG;AACH,QAAA,MAAM,gBAAgB,EAAE,4BAEvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -36,11 +36,12 @@
|
|
|
36
36
|
* remain the browser-shipped surface; this `./companion` subpath is
|
|
37
37
|
* tooling-only.
|
|
38
38
|
*/
|
|
39
|
-
import { AppFrontendType, normalizeProviderFrontendCspFootprint, } from '@wildo-ai/saas-models/public-runtime';
|
|
39
|
+
import { AppFrontendType, normalizeProviderFrontendCspFootprint, providerFrontendSdkVendorHostedScriptUrl, } from '@wildo-ai/saas-models/public-runtime';
|
|
40
40
|
import { EngineCapability, PROVIDER_CAPABILITY_TO_ENGINE_CAPABILITY, } from '@wildo-ai/saas-models';
|
|
41
|
-
import { admissibleFrontendPublicConfigKeys, normalizeConsentPurposes, readDeclaredPublicConfigKeys } from '@wildo-ai/saas-models/public-runtime';
|
|
41
|
+
import { admissibleFrontendPublicConfigKeys, normalizeConsentPurposes, readDeclaredPublicConfigKeys, readRequiredPublicConfigKeys } from '@wildo-ai/saas-models/public-runtime';
|
|
42
42
|
import { projectFrontendComponentDescriptors } from './shared/frontend-provider-surface.types.js';
|
|
43
43
|
import { consentBasedProviderStopRefusal, unclassifiedFrontendCapabilities, unknownProviderConsentPurposes } from './shared/frontend-provider-consent.js';
|
|
44
|
+
import { onDemandProviderSdkRefusal } from './shared/frontend-provider-on-demand.js';
|
|
44
45
|
import { EngineFrontendAppProviderRegistry } from './app/engine-frontend-app-provider-registry.js';
|
|
45
46
|
import { EngineFrontendTechdocProviderRegistry } from './techdoc/engine-frontend-techdoc-provider-registry.js';
|
|
46
47
|
import { EngineFrontendWebsiteProviderRegistry } from './website/engine-frontend-website-provider-registry.js';
|
|
@@ -73,8 +74,8 @@ export const BROWSER_FILLED_ENGINE_CAPABILITIES = new Set([
|
|
|
73
74
|
* backend discovery export and the runtime registry projection. Among the
|
|
74
75
|
* capabilities a browser may host, only `FRONTEND_ERROR_MONITORING` and
|
|
75
76
|
* `FRONTEND_PRODUCT_ANALYTICS` resolve to a slot; `SSO_OAUTH2`,
|
|
76
|
-
* `FRONTEND_SEARCH`, `FRONTEND_CAPTCHA`, `FRONTEND_FILE_PICKER
|
|
77
|
-
* `FRONTEND_ADDRESS_LOOKUP` are absent from the map, so those providers
|
|
77
|
+
* `FRONTEND_SEARCH`, `FRONTEND_CAPTCHA`, `FRONTEND_FILE_PICKER`,
|
|
78
|
+
* `FRONTEND_ADDRESS_LOOKUP` and `FRONTEND_CHAT_SIGN_IN_COMPLETION` are absent from the map, so those providers
|
|
78
79
|
* contribute no engine slot by construction. A slot outside
|
|
79
80
|
* {@link BROWSER_FILLED_ENGINE_CAPABILITIES} is refused (#1701).
|
|
80
81
|
*/
|
|
@@ -94,7 +95,9 @@ function deriveEngineCapabilities(ref, providerCapabilities) {
|
|
|
94
95
|
}
|
|
95
96
|
/**
|
|
96
97
|
* Refuses a provider whose declared `<script>` origin it did not also grant
|
|
97
|
-
* itself in `csp.scriptOrigins`.
|
|
98
|
+
* itself in `csp.scriptOrigins`. A vendor-hosted SDK loader is a script too,
|
|
99
|
+
* injected by `activate` rather than declared in `scripts`, and is held to the
|
|
100
|
+
* same rule.
|
|
98
101
|
*
|
|
99
102
|
* The three facet module types have carried this rule in prose since the fields
|
|
100
103
|
* landed, and prose is not a check. The failure it prevents is the worst shape
|
|
@@ -119,18 +122,23 @@ function deriveEngineCapabilities(ref, providerCapabilities) {
|
|
|
119
122
|
*/
|
|
120
123
|
function assertDeclaredScriptOriginsAreGranted(module) {
|
|
121
124
|
const declaredScriptOrigins = new Set(module.csp?.scriptOrigins ?? []);
|
|
122
|
-
|
|
125
|
+
const vendorHostedSdkScriptUrl = providerFrontendSdkVendorHostedScriptUrl(module.sdk?.descriptor);
|
|
126
|
+
const scriptSources = [
|
|
127
|
+
...(module.scripts ?? []).map((script) => script.src),
|
|
128
|
+
...(vendorHostedSdkScriptUrl === undefined ? [] : [vendorHostedSdkScriptUrl]),
|
|
129
|
+
];
|
|
130
|
+
for (const src of scriptSources) {
|
|
123
131
|
let origin;
|
|
124
132
|
try {
|
|
125
|
-
origin = new URL(
|
|
133
|
+
origin = new URL(src).origin;
|
|
126
134
|
}
|
|
127
135
|
catch {
|
|
128
136
|
throw new Error(`Frontend provider "${module.metadata.ref}" declares a script whose src is not an absolute URL: `
|
|
129
|
-
+ `"${
|
|
137
|
+
+ `"${src}". A script declaration names a third-party origin, so the framework can neither `
|
|
130
138
|
+ 'resolve it nor grant it in the composed Content-Security-Policy.');
|
|
131
139
|
}
|
|
132
140
|
if (!declaredScriptOrigins.has(origin)) {
|
|
133
|
-
throw new Error(`Frontend provider "${module.metadata.ref}" declares the script "${
|
|
141
|
+
throw new Error(`Frontend provider "${module.metadata.ref}" declares the script "${src}" but does not list `
|
|
134
142
|
+ `"${origin}" in csp.scriptOrigins. The policy this provider contributes to would then block its own `
|
|
135
143
|
+ 'script — and only where CSP enforces, so the failure would first appear in production. Add the '
|
|
136
144
|
+ 'origin to the provider\'s csp.scriptOrigins.');
|
|
@@ -177,11 +185,22 @@ function assertConsentClassificationIsComplete(module) {
|
|
|
177
185
|
* artifact nor a hand-written module list can start one either.
|
|
178
186
|
*/
|
|
179
187
|
function assertConsentBasedProviderIsStoppable(module) {
|
|
180
|
-
// assurance-control: WILDO.PRIVACY.
|
|
188
|
+
// assurance-control: WILDO.PRIVACY.CONSENT_ENFORCEMENT — a consent-based provider must be stoppable when consent is withdrawn
|
|
181
189
|
const refusal = consentBasedProviderStopRefusal(module.metadata.ref, module);
|
|
182
190
|
if (refusal !== undefined)
|
|
183
191
|
throw new Error(refusal);
|
|
184
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* Refuses a frontend provider that breaks the on-demand rule (#2790): an on-demand capability whose SDK the surface
|
|
195
|
+
* would start (so no flow's call reaches it), or an on-demand SDK serving no on-demand capability or with no
|
|
196
|
+
* predicate. Here, in the provider package's own `./companion` barrel, because that is what publish loads: the
|
|
197
|
+
* author meets it before the module ships rather than as a provider that is declared and never called.
|
|
198
|
+
*/
|
|
199
|
+
function assertOnDemandRuleIsKept(module) {
|
|
200
|
+
const refusal = onDemandProviderSdkRefusal(module.metadata.ref, module);
|
|
201
|
+
if (refusal !== undefined)
|
|
202
|
+
throw new Error(refusal);
|
|
203
|
+
}
|
|
185
204
|
/**
|
|
186
205
|
* Refuses a frontend provider that declares no `publicConfigSchema` whose keys can be read
|
|
187
206
|
* without running it (#1705).
|
|
@@ -237,6 +256,7 @@ export function projectFrontendProviderContribution(module, serviceType, runtime
|
|
|
237
256
|
assertConsentClassificationIsComplete(module);
|
|
238
257
|
assertConsentBasedProviderIsStoppable(module);
|
|
239
258
|
assertPublicConfigSchemaIsIntrospectable(module);
|
|
259
|
+
assertOnDemandRuleIsKept(module);
|
|
240
260
|
const frontendEntry = {
|
|
241
261
|
metadata: module.metadata,
|
|
242
262
|
providerCapabilities: [...module.providerCapabilities],
|
|
@@ -275,6 +295,11 @@ export function projectFrontendProviderContribution(module, serviceType, runtime
|
|
|
275
295
|
declaredKeys: readDeclaredPublicConfigKeys(module.publicConfigSchema),
|
|
276
296
|
providerCapabilities: module.providerCapabilities,
|
|
277
297
|
})?.slice(),
|
|
298
|
+
// The keys the module cannot run without, as DATA, so the CLI and the doctor can say a declared
|
|
299
|
+
// provider is not configured before any browser tries to start it. ALWAYS written, empty when the module
|
|
300
|
+
// requires nothing: an entry without the list is then recognisably one written before the check existed,
|
|
301
|
+
// never mistaken for "configured". The backend's fallback projection writes it the same way.
|
|
302
|
+
requiredPublicConfigKeys: [...readRequiredPublicConfigKeys(module.publicConfigSchema)],
|
|
278
303
|
// The z_file storage the picker fronts (#394 P5) — an enum member, so it
|
|
279
304
|
// crosses the wire as-is; the chooser filters on it and the hydration join
|
|
280
305
|
// compares it to the CODE side.
|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AAuG;AACvG,MAAM,CAAC,MAAM,0CAA0C,GACrD,KAAK,CAAC,IAAI,CAAC,qCAAqC,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAChF,mCAAmC,CAAC,MAAM,EAAE,eAAe,CAAC,cAAc,EAAE,2BAA2B,CAAC,CACzG,CAAC;AAEJ,sGAAsG;AACtG,MAAM,CAAC,MAAM,mCAAmC,GAAoC;IAClF,GAAG,sCAAsC;IACzC,GAAG,0CAA0C;IAC7C,GAAG,0CAA0C;CAC9C,CAAC;AAEF;;;;GAIG;AACH,MAAM,gBAAgB,GAAiC;IACrD,qBAAqB,EAAE,mCAAmC;CAC3D,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["/**\n * Companion-discovery export for `@wildo-ai/external-connectors-public`.\n *\n * Surfaces the engine's three browser-safe frontend provider registries\n * (`EngineFrontendAppProviderRegistry`, `EngineFrontendTechdocProviderRegistry`,\n * `EngineFrontendWebsiteProviderRegistry`) as a single derived\n * `ProviderCompanionContribution[]`, one entry per registered module,\n * keyed to a frontend service-type via `serviceType` (closed\n * `AppFrontendType` enum).\n *\n * NOT auto-discovered — and this package is now the EXCEPTION rather than the rule,\n * which is the part to read carefully. `discoverSaasProviderCompanionContributions`\n * (platform-config-lib) walks each runtime owner declared in `wildo.saas.config.ts`\n * AND every provider package it depends on, admitting the scraped catalogue,\n * `@wildo-ai/provider-*` and — since #358 — the engine's BACKEND connector package\n * `@wildo-ai/external-connectors-private` by exact name. It does not admit this one.\n * So these arrays reach a generated `provider-catalog.types.ts` / runtime artifact\n * only when an app's frontend `provider-contributions.ts` re-derives them from the\n * same registries — which is exactly the dogfood pattern: Wonder Todos's `app` /\n * `website` `provider-contributions.ts` map `EngineFrontend*ProviderRegistry.modules`\n * and add app-owned entries (e.g. its file-picker provider).\n *\n * A `frontendService` target additionally requires a `frontendEntry` payload for\n * bootstrap materialization, which the discovery validator refuses without — so the\n * frontend case is not merely un-admitted, it carries a payload the backend case\n * has no equivalent of. Admitting this package would have to answer that first.\n *\n * (This paragraph used to end \"Wiring the discovery walker to load engine connector\n * packages directly is a tracked follow-up, not the current contract.\" Half of that\n * shipped in #358 and the sentence did not distinguish the two packages, so it read\n * as false about the backend and true here.)\n *\n * NOT for browser consumption. This module is loaded only by Node-side\n * tooling (`wildo config sync` and the `discoverSaasProviderCompanionContributions`\n * walker). The package's `./app`, `./techdoc`, `./website` subpaths\n * remain the browser-shipped surface; this `./companion` subpath is\n * tooling-only.\n */\n\nimport {\n AppFrontendType,\n type BuiltinProviderCapability,\n type FrontendProviderEntry,\n normalizeProviderFrontendCspFootprint,\n type ProviderFrontendCspFootprintDeclaration,\n type ProviderFrontendScriptDeclaration,\n type ProviderFrontendComponentDescriptor,\n type ProviderFrontendSdkDescriptor,\n type ProviderComplianceProfile,\n type ProviderMetadata,\n} from '@wildo-ai/saas-models/public-runtime';\nimport {\n EngineCapability,\n PROVIDER_CAPABILITY_TO_ENGINE_CAPABILITY,\n type ProviderCompanionContribution,\n type RuntimeOwnerCompanionExports,\n} from '@wildo-ai/saas-models';\nimport { admissibleFrontendPublicConfigKeys, normalizeConsentPurposes, readDeclaredPublicConfigKeys } from '@wildo-ai/saas-models/public-runtime';\nimport type { FileStorageAccepted } from '@wildo-ai/saas-models/public-runtime';\nimport { projectFrontendComponentDescriptors } from './shared/frontend-provider-surface.types';\nimport { consentBasedProviderStopRefusal, unclassifiedFrontendCapabilities, unknownProviderConsentPurposes } from './shared/frontend-provider-consent';\nimport { EngineFrontendAppProviderRegistry } from './app/engine-frontend-app-provider-registry';\nimport { EngineFrontendTechdocProviderRegistry } from './techdoc/engine-frontend-techdoc-provider-registry';\nimport { EngineFrontendWebsiteProviderRegistry } from './website/engine-frontend-website-provider-registry';\n\nconst APP_RUNTIME_IMPORT_PATH = '@wildo-ai/external-connectors-public/app';\nconst TECHDOC_RUNTIME_IMPORT_PATH = '@wildo-ai/external-connectors-public/techdoc';\nconst WEBSITE_RUNTIME_IMPORT_PATH = '@wildo-ai/external-connectors-public/website';\n\n/**\n * The engine slots a BROWSER module may fill: the ones whose work happens on the page.\n *\n * Every other slot (billing, mail, LLM, audit…) is served by a backend part. A frontend contribution\n * used to derive `BILLING` from the Stripe module, which loaded no Stripe code, so the catalogue read\n * the browser as covering the billing slot the backend `stripe` part fills (#1701). The consent\n * classification now refuses `BILLING` on a frontend module, and this set is the second, independent\n * statement: whatever a browser-hosted capability ever maps to, a contribution PROJECTED by\n * `projectFrontendProviderContribution` carries only these slots, and a mapping to any other one is\n * refused there instead of advertised. Today the consent classification refuses first, so the join\n * between the two tables is pinned by a test over both, not by this throw; the throw is what holds if\n * a browser-hosted capability is ever mapped to a backend slot. A hand-written contribution does not\n * pass through here.\n */\nexport const BROWSER_FILLED_ENGINE_CAPABILITIES: ReadonlySet<EngineCapability> = new Set([\n EngineCapability.FRONTEND_ERROR_MONITORING,\n EngineCapability.FRONTEND_PRODUCT_ANALYTICS,\n]);\n\n/**\n * Projects a frontend provider's declared capabilities onto the engine\n * slots it fills, using the canonical\n * `PROVIDER_CAPABILITY_TO_ENGINE_CAPABILITY` map from\n * `@wildo-ai/saas-models` — the single source of truth shared with the\n * backend discovery export and the runtime registry projection. Among the\n * capabilities a browser may host, only `FRONTEND_ERROR_MONITORING` and\n * `FRONTEND_PRODUCT_ANALYTICS` resolve to a slot; `SSO_OAUTH2`,\n * `FRONTEND_SEARCH`, `FRONTEND_CAPTCHA`, `FRONTEND_FILE_PICKER` and\n * `FRONTEND_ADDRESS_LOOKUP` are absent from the map, so those providers\n * contribute no engine slot by construction. A slot outside\n * {@link BROWSER_FILLED_ENGINE_CAPABILITIES} is refused (#1701).\n */\nfunction deriveEngineCapabilities(\n ref: string,\n providerCapabilities: ReadonlyArray<string>,\n): EngineCapability[] {\n const slots = new Set<EngineCapability>();\n for (const cap of providerCapabilities) {\n const slot = PROVIDER_CAPABILITY_TO_ENGINE_CAPABILITY[cap as BuiltinProviderCapability];\n if (!slot) continue;\n if (!BROWSER_FILLED_ENGINE_CAPABILITIES.has(slot)) {\n throw new Error(\n `Frontend provider \"${ref}\" declares \"${cap}\", which fills the backend engine slot \"${slot}\". A browser module `\n + 'fills only a slot whose work happens on the page; the backend part of the same vendor fills this one.',\n );\n }\n slots.add(slot);\n }\n return Array.from(slots);\n}\n\n/**\n * The facet-agnostic view of a frontend provider module this projection reads.\n *\n * Only the DATA half appears here, and that is the contract rather than an\n * omission: this file is loaded by NODE-side tooling (`wildo config sync` and\n * the discovery walker), which cannot execute a browser-bound module's\n * `sdk.activate` and must never try. What it CAN read is the descriptor beside\n * it — which package the SDK lives in — and that is what the bundle-isolation\n * policy, an application's dependency alignment and a human reading a bundle\n * report need.\n */\ninterface FrontendProviderModuleShape {\n metadata: ProviderMetadata;\n providerCapabilities: ReadonlyArray<string>;\n protocols: ReadonlyArray<string>;\n publicConfig?: Readonly<Record<string, unknown>>;\n csp?: ProviderFrontendCspFootprintDeclaration;\n scripts?: ReadonlyArray<ProviderFrontendScriptDeclaration>;\n sdk?: { readonly descriptor: ProviderFrontendSdkDescriptor; readonly stoppable?: true };\n components?: Readonly<Record<string, ProviderFrontendComponentDescriptor & { readonly load?: unknown }>>;\n fileStorage?: FileStorageAccepted;\n publicConfigSchema?: unknown;\n complianceProfile?: ProviderComplianceProfile;\n consentPurposes?: ReadonlyArray<string>;\n}\n\n/**\n * Refuses a provider whose declared `<script>` origin it did not also grant\n * itself in `csp.scriptOrigins`.\n *\n * The three facet module types have carried this rule in prose since the fields\n * landed, and prose is not a check. The failure it prevents is the worst shape\n * this surface has: the provider ships, the script tag is injected, the composed\n * policy does not admit its origin, and the browser refuses it — in PRODUCTION\n * ONLY, because development is report-only. The provider looks configured, the\n * page looks fine locally, and the capability is simply absent for real users.\n *\n * Absolute rather than conditional on the application's own policy, and that is\n * the point: a provider cannot know whether the application it lands in\n * happens to allow-list its vendor, and relying on that is exactly the\n * hand-editing per app, per service, per environment that declaring a footprint\n * exists to remove. Restating an origin the app would have allowed anyway costs\n * nothing — CSP source lists are a union.\n *\n * Thrown, not reported, and only HERE. This runs where the author is: in the\n * provider package's own `./companion` barrel and in the CLI's discovery walk,\n * so `wildo config sync` fails with the provider, the script and the missing\n * origin named. The backend's fallback projection deliberately does NOT repeat\n * it — refusing there would take an application's boot down for a provider\n * authoring mistake, long after the person who could fix it has gone.\n */\nfunction assertDeclaredScriptOriginsAreGranted(module: FrontendProviderModuleShape): void {\n const declaredScriptOrigins = new Set(module.csp?.scriptOrigins ?? []);\n\n for (const script of module.scripts ?? []) {\n let origin: string;\n try {\n origin = new URL(script.src).origin;\n } catch {\n throw new Error(\n `Frontend provider \"${module.metadata.ref}\" declares a script whose src is not an absolute URL: `\n + `\"${script.src}\". A script declaration names a third-party origin, so the framework can neither `\n + 'resolve it nor grant it in the composed Content-Security-Policy.',\n );\n }\n\n if (!declaredScriptOrigins.has(origin)) {\n throw new Error(\n `Frontend provider \"${module.metadata.ref}\" declares the script \"${script.src}\" but does not list `\n + `\"${origin}\" in csp.scriptOrigins. The policy this provider contributes to would then block its own `\n + 'script — and only where CSP enforces, so the failure would first appear in production. Add the '\n + 'origin to the provider\\'s csp.scriptOrigins.',\n );\n }\n }\n}\n\n/**\n * Refuses a frontend provider whose consent classification is incomplete (#1702).\n *\n * Two shapes, both of which used to start the provider without consent and say nothing:\n *\n * - a capability no browser may host — anything `PROVIDER_CAPABILITY_FRONTEND_CONSENT_CLASSIFICATION`\n * marks `browserHosted: false`, or a string that is no capability at all. The consent table used to be\n * total only over `FRONTEND_*`-named members and treated every other capability as needing no\n * consent, so a vendor declaring, say, `LLM_CHAT` on its frontend module fell through unclassified;\n * - a module-level `consentPurposes` entry that is not a `ConsentPurpose`. Normalization would DROP\n * it, and a dropped purpose on an additive field is a lowered floor.\n *\n * Thrown here, where the author is, for the reason `assertDeclaredScriptOriginsAreGranted` gives. The\n * browser runners do not rely on it: they refuse to start such a provider on their own (fail closed), so\n * an entry that bypassed this projection is withheld rather than started.\n */\nfunction assertConsentClassificationIsComplete(module: FrontendProviderModuleShape): void {\n const unclassified = unclassifiedFrontendCapabilities(module);\n if (unclassified.length > 0) {\n throw new Error(\n `Frontend provider \"${module.metadata.ref}\" declares ${unclassified.map((capability) => `\"${capability}\"`).join(', ')}, `\n + 'which has no browser consent classification — no browser surface may host it. A frontend module may '\n + 'declare only capabilities PROVIDER_CAPABILITY_FRONTEND_CONSENT_CLASSIFICATION marks browserHosted; '\n + 'classify a new one there (deciding which consent purposes it rests on) before a frontend module declares it.',\n );\n }\n const unknownPurposes = unknownProviderConsentPurposes(module);\n if (unknownPurposes.length > 0) {\n throw new Error(\n `Frontend provider \"${module.metadata.ref}\" declares consentPurposes ${unknownPurposes.map((purpose) => `\"${purpose}\"`).join(', ')}, `\n + 'which are not members of ConsentPurpose. They would be dropped on the way to the browser, lowering what '\n + 'the provider was meant to rest on.',\n );\n }\n}\n\n/**\n * Refuses a CONSENT-BASED frontend provider that a withdrawal could not stop (#1704): one that injects\n * `<script>` tags, or whose SDK does not declare `stoppable`. The earliest of five applications of the same\n * predicate (`consentBasedProviderStopRefusal`), in the provider package's own `./companion` barrel where\n * the author is; hydration withholds the provider's code and scripts, the SDK runner refuses to start it,\n * the startup script collector skips it and the component registry does not register it, so neither a stale\n * artifact nor a hand-written module list can start one either.\n */\nfunction assertConsentBasedProviderIsStoppable(module: FrontendProviderModuleShape): void {\n // assurance-control: WILDO.PRIVACY.CONSENT_RECORD — a consent-based provider must be stoppable when consent is withdrawn\n const refusal = consentBasedProviderStopRefusal(module.metadata.ref, module);\n if (refusal !== undefined) throw new Error(refusal);\n}\n\n/**\n * Refuses a frontend provider that declares no `publicConfigSchema` whose keys can be read\n * without running it (#1705).\n *\n * Without that list nothing can hold what the provider is served to a set of keys, and \"admit\n * everything\" was the answer: 8 of the 13 engine modules declared none, including the two that run\n * vendor code (PostHog, Sentry), so any key — a secret under an innocent name included — passed\n * through to every browser. The overlay at `wildo config sync` refuses the same absence on the entry\n * (`SCHEMA_NOT_INTROSPECTABLE`) and hydration refuses it on the code module; this is the earliest of\n * the three, in the provider package's own `./companion` barrel, where the author is.\n *\n * Checked on the module's authored `publicConfig` too: a module whose own defaults carry a key its\n * schema does not declare would fail its own schema at hydration and run none of its code.\n */\nfunction assertPublicConfigSchemaIsIntrospectable(module: FrontendProviderModuleShape): void {\n // assurance-control: WILDO.SECURITY.FAIL_CLOSED — a frontend provider with no readable key list is not projected\n const declared = readDeclaredPublicConfigKeys(module.publicConfigSchema);\n if (declared === undefined) {\n throw new Error(\n `Frontend provider \"${module.metadata.ref}\" declares no publicConfigSchema whose keys can be read without running `\n + 'it. Its publicConfig is served to every browser, and without a declared key list nothing can refuse a key it '\n + 'never reads — a secret under an innocent name included. Declare one with `defineFrontendPublicConfigSchema` '\n + '(or a Zod object) listing every key its publicConfig carries.',\n );\n }\n const admissible = new Set(admissibleFrontendPublicConfigKeys({ declaredKeys: declared, providerCapabilities: module.providerCapabilities }));\n const undeclared = Object.keys(module.publicConfig ?? {}).filter((key) => !admissible.has(key));\n if (undeclared.length > 0) {\n throw new Error(\n `Frontend provider \"${module.metadata.ref}\" authors publicConfig ${undeclared.map((key) => `\"${key}\"`).join(', ')}, `\n + 'which its own publicConfigSchema does not declare. Declare the key, or remove it.',\n );\n }\n}\n\n/**\n * Turns a frontend provider module into the companion contribution tooling\n * reads — the ONE place a facet module becomes a discovery record.\n *\n * Exported because the engine is not the only producer. Every\n * `@wildo-ai/provider-<ref>` package's own `./companion` barrel has to do\n * exactly this for its own facet modules, and a projection each package\n * hand-rolls is a projection that drifts: the DATA half of the frontend\n * surface would end up carried by some packages and dropped by others, and a\n * dropped CSP footprint is invisible until a provider is blocked in production.\n *\n * What crosses and what does not is the whole contract. `csp`, `scripts`, the\n * SDK DESCRIPTOR and the `complianceProfile` cross, because tooling has to read\n * them without executing anything — this runs in Node and a facet module is browser-bound. The\n * executable half — `sdk.activate`, `publicConfigSchema` — does NOT, and cannot:\n * the contribution is serialized to JSON on its way into the generated\n * artifact, so a function would be dropped by `JSON.stringify` with no error\n * anywhere. Code reaches a bundle through the generated\n * `frontend-providers.generated.ts` instead.\n */\nexport function projectFrontendProviderContribution(\n module: FrontendProviderModuleShape,\n serviceType: AppFrontendType,\n runtimeImportPath: string,\n): ProviderCompanionContribution {\n assertDeclaredScriptOriginsAreGranted(module);\n assertConsentClassificationIsComplete(module);\n assertConsentBasedProviderIsStoppable(module);\n assertPublicConfigSchemaIsIntrospectable(module);\n\n const frontendEntry: FrontendProviderEntry = {\n metadata: module.metadata,\n providerCapabilities: [...module.providerCapabilities],\n protocols: [...module.protocols],\n publicConfig: module.publicConfig,\n // The DATA half of the frontend surface (#332). It has to travel with the\n // contribution because the CSP of a service is composed by the CLI, from\n // the materialized artifact, long before any browser loads the module that\n // declares it — and the CLI cannot execute that module to ask.\n // Normalized here, once: a provider AUTHORS the buckets it reaches and the\n // wire carries all of them, so the CSP composer never branches on absence\n // and the hydration join compares two shapes of the same kind.\n csp: module.csp === undefined ? undefined : normalizeProviderFrontendCspFootprint(module.csp),\n scripts: module.scripts === undefined ? undefined : [...module.scripts],\n sdk: module.sdk?.descriptor,\n // The DATA half of each contributed component (#380). `load` is stripped\n // HERE rather than left to `JSON.stringify` to drop it: a function that\n // disappears silently on its way through a serializer is the failure this\n // whole two-channel split exists to remove, and stripping it explicitly is\n // what makes the projection's contract readable at the projection.\n //\n // Rebuilt field by field rather than spread-minus-`load`, so a future field\n // on the declaration is a COMPILE decision about whether it crosses the wire\n // instead of one that crosses by default. `sdk` makes the same choice by\n // naming `descriptor`; this is the same rule where the shape is a map.\n components: projectFrontendComponentDescriptors(module.components),\n // The keys the module's `publicConfigSchema` declares, as DATA (#394 P3).\n // The schema itself is CODE and stays behind; this list is what lets\n // `wildo config sync` refuse an application-supplied key the module never\n // reads, at the moment it is typed rather than when a picker opens.\n // UNION with the keys the module's own CAPABILITIES own (#380). A picker\n // declaring `appId` still reads `maxFileSizeMb`, because the framework reads\n // it on the picker's behalf — so a list built from the provider's schema\n // alone refuses the capability's whole vocabulary at the moment it is typed.\n publicConfigKeys: admissibleFrontendPublicConfigKeys({\n declaredKeys: readDeclaredPublicConfigKeys(module.publicConfigSchema),\n providerCapabilities: module.providerCapabilities,\n })?.slice(),\n // The z_file storage the picker fronts (#394 P5) — an enum member, so it\n // crosses the wire as-is; the chooser filters on it and the hydration join\n // compares it to the CODE side.\n fileStorage: module.fileStorage,\n // WHO runs the vendor, WHERE it processes and WHICH legal entity stands behind it (#1743).\n // Every engine facet module has declared this since #345 and this projection used to leave it\n // behind — so the browser vendors a privacy notice most needs to name (reCAPTCHA,\n // Sentry, the Drive/OneDrive/Dropbox pickers) reached no compliance reader at all. Pure DATA,\n // like `csp`, so it crosses as-is and lands in the per-service `frontendProviderBootstraps` of\n // the generated artifact, which is where `listServedFrontendProviderCompliance` reads it.\n complianceProfile: module.complianceProfile,\n // The vendor's purposes BEYOND its capabilities' floor (#1702). DATA, because the browser decides\n // on the hydrated module, whose consent inputs come from this entry — a purpose left behind here\n // would reach no gate. Normalized once; absent stays absent so \"adds nothing\" keeps one spelling.\n consentPurposes: module.consentPurposes === undefined || module.consentPurposes.length === 0\n ? undefined\n : normalizeConsentPurposes(module.consentPurposes),\n };\n return {\n ref: module.metadata.ref,\n identity: {\n packageName: module.metadata.packageName,\n tier: module.metadata.tier,\n vendor: module.metadata.vendor,\n origin: module.metadata.origin,\n },\n runtimeImportPath,\n runtimeTargets: [{ kind: 'frontendService', serviceType }],\n engineCapabilities: deriveEngineCapabilities(module.metadata.ref, module.providerCapabilities),\n providerCapabilities: [...module.providerCapabilities],\n protocols: [...module.protocols],\n // Browser-safe providers cannot own server secrets. The explicit empty\n // shape is authoritative and distinct from an unknown/missing contract.\n secretsContractShape: [],\n frontendEntry,\n };\n}\n\n/** One contribution per `EngineFrontendAppProviderRegistry` module, targeting `SAAS_APP`. */\nexport const engineFrontendAppProviderContributions: ProviderCompanionContribution[] =\n Array.from(EngineFrontendAppProviderRegistry.modules.values()).map((module) =>\n projectFrontendProviderContribution(module, AppFrontendType.SAAS_APP, APP_RUNTIME_IMPORT_PATH),\n );\n\n/** One contribution per `EngineFrontendTechdocProviderRegistry` module, targeting `TECH_DOC`. */\nexport const engineFrontendTechdocProviderContributions: ProviderCompanionContribution[] =\n Array.from(EngineFrontendTechdocProviderRegistry.modules.values()).map((module) =>\n projectFrontendProviderContribution(module, AppFrontendType.TECH_DOC, TECHDOC_RUNTIME_IMPORT_PATH),\n );\n\n/** One contribution per `EngineFrontendWebsiteProviderRegistry` module, targeting `STATIC_WEBSITE`. */\nexport const engineFrontendWebsiteProviderContributions: ProviderCompanionContribution[] =\n Array.from(EngineFrontendWebsiteProviderRegistry.modules.values()).map((module) =>\n projectFrontendProviderContribution(module, AppFrontendType.STATIC_WEBSITE, WEBSITE_RUNTIME_IMPORT_PATH),\n );\n\n/** Stable union — order: app providers, then techdoc, then website (matches the registry imports). */\nexport const engineFrontendProviderContributions: ProviderCompanionContribution[] = [\n ...engineFrontendAppProviderContributions,\n ...engineFrontendTechdocProviderContributions,\n ...engineFrontendWebsiteProviderContributions,\n];\n\n/**\n * Companion-discovery contract — see `RuntimeOwnerCompanionExports`.\n * The framework loader reads `providerContributions` via the package's\n * `./companion` subpath export.\n */\nconst companionExports: RuntimeOwnerCompanionExports = {\n providerContributions: engineFrontendProviderContributions,\n};\n\nexport default companionExports;\n"]}
|
|
1
|
+
{"version":3,"file":"companion-exports.js","sourceRoot":"","sources":["../../../src/companion-exports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EACL,eAAe,EAGf,qCAAqC,EAKrC,wCAAwC,GAGzC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,gBAAgB,EAChB,wCAAwC,GAGzC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kCAAkC,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,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AAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAC5E,mCAAmC,CAAC,MAAM,EAAE,eAAe,CAAC,QAAQ,EAAE,uBAAuB,CAAC,CAC/F,CAAC;AAEJ,iGAAiG;AACjG,MAAM,CAAC,MAAM,0CAA0C,GACrD,KAAK,CAAC,IAAI,CAAC,qCAAqC,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAChF,mCAAmC,CAAC,MAAM,EAAE,eAAe,CAAC,QAAQ,EAAE,2BAA2B,CAAC,CACnG,CAAC;AAEJ,uGAAuG;AACvG,MAAM,CAAC,MAAM,0CAA0C,GACrD,KAAK,CAAC,IAAI,CAAC,qCAAqC,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAChF,mCAAmC,CAAC,MAAM,EAAE,eAAe,CAAC,cAAc,EAAE,2BAA2B,CAAC,CACzG,CAAC;AAEJ,sGAAsG;AACtG,MAAM,CAAC,MAAM,mCAAmC,GAAoC;IAClF,GAAG,sCAAsC;IACzC,GAAG,0CAA0C;IAC7C,GAAG,0CAA0C;CAC9C,CAAC;AAEF;;;;GAIG;AACH,MAAM,gBAAgB,GAAiC;IACrD,qBAAqB,EAAE,mCAAmC;CAC3D,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["/**\n * Companion-discovery export for `@wildo-ai/external-connectors-public`.\n *\n * Surfaces the engine's three browser-safe frontend provider registries\n * (`EngineFrontendAppProviderRegistry`, `EngineFrontendTechdocProviderRegistry`,\n * `EngineFrontendWebsiteProviderRegistry`) as a single derived\n * `ProviderCompanionContribution[]`, one entry per registered module,\n * keyed to a frontend service-type via `serviceType` (closed\n * `AppFrontendType` enum).\n *\n * NOT auto-discovered — and this package is now the EXCEPTION rather than the rule,\n * which is the part to read carefully. `discoverSaasProviderCompanionContributions`\n * (platform-config-lib) walks each runtime owner declared in `wildo.saas.config.ts`\n * AND every provider package it depends on, admitting the scraped catalogue,\n * `@wildo-ai/provider-*` and — since #358 — the engine's BACKEND connector package\n * `@wildo-ai/external-connectors-private` by exact name. It does not admit this one.\n * So these arrays reach a generated `provider-catalog.types.ts` / runtime artifact\n * only when an app's frontend `provider-contributions.ts` re-derives them from the\n * same registries — which is exactly the dogfood pattern: Wonder Todos's `app` /\n * `website` `provider-contributions.ts` map `EngineFrontend*ProviderRegistry.modules`\n * and add app-owned entries (e.g. its file-picker provider).\n *\n * A `frontendService` target additionally requires a `frontendEntry` payload for\n * bootstrap materialization, which the discovery validator refuses without — so the\n * frontend case is not merely un-admitted, it carries a payload the backend case\n * has no equivalent of. Admitting this package would have to answer that first.\n *\n * (This paragraph used to end \"Wiring the discovery walker to load engine connector\n * packages directly is a tracked follow-up, not the current contract.\" Half of that\n * shipped in #358 and the sentence did not distinguish the two packages, so it read\n * as false about the backend and true here.)\n *\n * NOT for browser consumption. This module is loaded only by Node-side\n * tooling (`wildo config sync` and the `discoverSaasProviderCompanionContributions`\n * walker). The package's `./app`, `./techdoc`, `./website` subpaths\n * remain the browser-shipped surface; this `./companion` subpath is\n * tooling-only.\n */\n\nimport {\n AppFrontendType,\n type BuiltinProviderCapability,\n type FrontendProviderEntry,\n normalizeProviderFrontendCspFootprint,\n type ProviderFrontendCspFootprintDeclaration,\n type ProviderFrontendScriptDeclaration,\n type ProviderFrontendComponentDescriptor,\n type ProviderFrontendSdkDescriptor,\n providerFrontendSdkVendorHostedScriptUrl,\n type ProviderComplianceProfile,\n type ProviderMetadata,\n} from '@wildo-ai/saas-models/public-runtime';\nimport {\n EngineCapability,\n PROVIDER_CAPABILITY_TO_ENGINE_CAPABILITY,\n type ProviderCompanionContribution,\n type RuntimeOwnerCompanionExports,\n} from '@wildo-ai/saas-models';\nimport { admissibleFrontendPublicConfigKeys, normalizeConsentPurposes, readDeclaredPublicConfigKeys, readRequiredPublicConfigKeys } from '@wildo-ai/saas-models/public-runtime';\nimport type { FileStorageAccepted } from '@wildo-ai/saas-models/public-runtime';\nimport { projectFrontendComponentDescriptors, type ProviderFrontendSdkActivationMode } from './shared/frontend-provider-surface.types';\nimport { consentBasedProviderStopRefusal, unclassifiedFrontendCapabilities, unknownProviderConsentPurposes } from './shared/frontend-provider-consent';\nimport { onDemandProviderSdkRefusal } from './shared/frontend-provider-on-demand';\nimport { EngineFrontendAppProviderRegistry } from './app/engine-frontend-app-provider-registry';\nimport { EngineFrontendTechdocProviderRegistry } from './techdoc/engine-frontend-techdoc-provider-registry';\nimport { EngineFrontendWebsiteProviderRegistry } from './website/engine-frontend-website-provider-registry';\n\nconst APP_RUNTIME_IMPORT_PATH = '@wildo-ai/external-connectors-public/app';\nconst TECHDOC_RUNTIME_IMPORT_PATH = '@wildo-ai/external-connectors-public/techdoc';\nconst WEBSITE_RUNTIME_IMPORT_PATH = '@wildo-ai/external-connectors-public/website';\n\n/**\n * The engine slots a BROWSER module may fill: the ones whose work happens on the page.\n *\n * Every other slot (billing, mail, LLM, audit…) is served by a backend part. A frontend contribution\n * used to derive `BILLING` from the Stripe module, which loaded no Stripe code, so the catalogue read\n * the browser as covering the billing slot the backend `stripe` part fills (#1701). The consent\n * classification now refuses `BILLING` on a frontend module, and this set is the second, independent\n * statement: whatever a browser-hosted capability ever maps to, a contribution PROJECTED by\n * `projectFrontendProviderContribution` carries only these slots, and a mapping to any other one is\n * refused there instead of advertised. Today the consent classification refuses first, so the join\n * between the two tables is pinned by a test over both, not by this throw; the throw is what holds if\n * a browser-hosted capability is ever mapped to a backend slot. A hand-written contribution does not\n * pass through here.\n */\nexport const BROWSER_FILLED_ENGINE_CAPABILITIES: ReadonlySet<EngineCapability> = new Set([\n EngineCapability.FRONTEND_ERROR_MONITORING,\n EngineCapability.FRONTEND_PRODUCT_ANALYTICS,\n]);\n\n/**\n * Projects a frontend provider's declared capabilities onto the engine\n * slots it fills, using the canonical\n * `PROVIDER_CAPABILITY_TO_ENGINE_CAPABILITY` map from\n * `@wildo-ai/saas-models` — the single source of truth shared with the\n * backend discovery export and the runtime registry projection. Among the\n * capabilities a browser may host, only `FRONTEND_ERROR_MONITORING` and\n * `FRONTEND_PRODUCT_ANALYTICS` resolve to a slot; `SSO_OAUTH2`,\n * `FRONTEND_SEARCH`, `FRONTEND_CAPTCHA`, `FRONTEND_FILE_PICKER`,\n * `FRONTEND_ADDRESS_LOOKUP` and `FRONTEND_CHAT_SIGN_IN_COMPLETION` are absent from the map, so those providers\n * contribute no engine slot by construction. A slot outside\n * {@link BROWSER_FILLED_ENGINE_CAPABILITIES} is refused (#1701).\n */\nfunction deriveEngineCapabilities(\n ref: string,\n providerCapabilities: ReadonlyArray<string>,\n): EngineCapability[] {\n const slots = new Set<EngineCapability>();\n for (const cap of providerCapabilities) {\n const slot = PROVIDER_CAPABILITY_TO_ENGINE_CAPABILITY[cap as BuiltinProviderCapability];\n if (!slot) continue;\n if (!BROWSER_FILLED_ENGINE_CAPABILITIES.has(slot)) {\n throw new Error(\n `Frontend provider \"${ref}\" declares \"${cap}\", which fills the backend engine slot \"${slot}\". A browser module `\n + 'fills only a slot whose work happens on the page; the backend part of the same vendor fills this one.',\n );\n }\n slots.add(slot);\n }\n return Array.from(slots);\n}\n\n/**\n * The facet-agnostic view of a frontend provider module this projection reads.\n *\n * Only the DATA half appears here, and that is the contract rather than an\n * omission: this file is loaded by NODE-side tooling (`wildo config sync` and\n * the discovery walker), which cannot execute a browser-bound module's\n * `sdk.activate` and must never try. What it CAN read is the descriptor beside\n * it — which package the SDK lives in — and that is what the bundle-isolation\n * policy, an application's dependency alignment and a human reading a bundle\n * report need.\n */\ninterface FrontendProviderModuleShape {\n metadata: ProviderMetadata;\n providerCapabilities: ReadonlyArray<string>;\n protocols: ReadonlyArray<string>;\n publicConfig?: Readonly<Record<string, unknown>>;\n csp?: ProviderFrontendCspFootprintDeclaration;\n scripts?: ReadonlyArray<ProviderFrontendScriptDeclaration>;\n sdk?: {\n readonly descriptor: ProviderFrontendSdkDescriptor;\n readonly stoppable?: true;\n readonly activation?: ProviderFrontendSdkActivationMode;\n readonly servesOnDemandContext?: unknown;\n };\n components?: Readonly<Record<string, ProviderFrontendComponentDescriptor & { readonly load?: unknown }>>;\n fileStorage?: FileStorageAccepted;\n publicConfigSchema?: unknown;\n complianceProfile?: ProviderComplianceProfile;\n consentPurposes?: ReadonlyArray<string>;\n}\n\n/**\n * Refuses a provider whose declared `<script>` origin it did not also grant\n * itself in `csp.scriptOrigins`. A vendor-hosted SDK loader is a script too,\n * injected by `activate` rather than declared in `scripts`, and is held to the\n * same rule.\n *\n * The three facet module types have carried this rule in prose since the fields\n * landed, and prose is not a check. The failure it prevents is the worst shape\n * this surface has: the provider ships, the script tag is injected, the composed\n * policy does not admit its origin, and the browser refuses it — in PRODUCTION\n * ONLY, because development is report-only. The provider looks configured, the\n * page looks fine locally, and the capability is simply absent for real users.\n *\n * Absolute rather than conditional on the application's own policy, and that is\n * the point: a provider cannot know whether the application it lands in\n * happens to allow-list its vendor, and relying on that is exactly the\n * hand-editing per app, per service, per environment that declaring a footprint\n * exists to remove. Restating an origin the app would have allowed anyway costs\n * nothing — CSP source lists are a union.\n *\n * Thrown, not reported, and only HERE. This runs where the author is: in the\n * provider package's own `./companion` barrel and in the CLI's discovery walk,\n * so `wildo config sync` fails with the provider, the script and the missing\n * origin named. The backend's fallback projection deliberately does NOT repeat\n * it — refusing there would take an application's boot down for a provider\n * authoring mistake, long after the person who could fix it has gone.\n */\nfunction assertDeclaredScriptOriginsAreGranted(module: FrontendProviderModuleShape): void {\n const declaredScriptOrigins = new Set(module.csp?.scriptOrigins ?? []);\n const vendorHostedSdkScriptUrl = providerFrontendSdkVendorHostedScriptUrl(module.sdk?.descriptor);\n const scriptSources = [\n ...(module.scripts ?? []).map((script) => script.src),\n ...(vendorHostedSdkScriptUrl === undefined ? [] : [vendorHostedSdkScriptUrl]),\n ];\n\n for (const src of scriptSources) {\n let origin: string;\n try {\n origin = new URL(src).origin;\n } catch {\n throw new Error(\n `Frontend provider \"${module.metadata.ref}\" declares a script whose src is not an absolute URL: `\n + `\"${src}\". A script declaration names a third-party origin, so the framework can neither `\n + 'resolve it nor grant it in the composed Content-Security-Policy.',\n );\n }\n\n if (!declaredScriptOrigins.has(origin)) {\n throw new Error(\n `Frontend provider \"${module.metadata.ref}\" declares the script \"${src}\" but does not list `\n + `\"${origin}\" in csp.scriptOrigins. The policy this provider contributes to would then block its own `\n + 'script — and only where CSP enforces, so the failure would first appear in production. Add the '\n + 'origin to the provider\\'s csp.scriptOrigins.',\n );\n }\n }\n}\n\n/**\n * Refuses a frontend provider whose consent classification is incomplete (#1702).\n *\n * Two shapes, both of which used to start the provider without consent and say nothing:\n *\n * - a capability no browser may host — anything `PROVIDER_CAPABILITY_FRONTEND_CONSENT_CLASSIFICATION`\n * marks `browserHosted: false`, or a string that is no capability at all. The consent table used to be\n * total only over `FRONTEND_*`-named members and treated every other capability as needing no\n * consent, so a vendor declaring, say, `LLM_CHAT` on its frontend module fell through unclassified;\n * - a module-level `consentPurposes` entry that is not a `ConsentPurpose`. Normalization would DROP\n * it, and a dropped purpose on an additive field is a lowered floor.\n *\n * Thrown here, where the author is, for the reason `assertDeclaredScriptOriginsAreGranted` gives. The\n * browser runners do not rely on it: they refuse to start such a provider on their own (fail closed), so\n * an entry that bypassed this projection is withheld rather than started.\n */\nfunction assertConsentClassificationIsComplete(module: FrontendProviderModuleShape): void {\n const unclassified = unclassifiedFrontendCapabilities(module);\n if (unclassified.length > 0) {\n throw new Error(\n `Frontend provider \"${module.metadata.ref}\" declares ${unclassified.map((capability) => `\"${capability}\"`).join(', ')}, `\n + 'which has no browser consent classification — no browser surface may host it. A frontend module may '\n + 'declare only capabilities PROVIDER_CAPABILITY_FRONTEND_CONSENT_CLASSIFICATION marks browserHosted; '\n + 'classify a new one there (deciding which consent purposes it rests on) before a frontend module declares it.',\n );\n }\n const unknownPurposes = unknownProviderConsentPurposes(module);\n if (unknownPurposes.length > 0) {\n throw new Error(\n `Frontend provider \"${module.metadata.ref}\" declares consentPurposes ${unknownPurposes.map((purpose) => `\"${purpose}\"`).join(', ')}, `\n + 'which are not members of ConsentPurpose. They would be dropped on the way to the browser, lowering what '\n + 'the provider was meant to rest on.',\n );\n }\n}\n\n/**\n * Refuses a CONSENT-BASED frontend provider that a withdrawal could not stop (#1704): one that injects\n * `<script>` tags, or whose SDK does not declare `stoppable`. The earliest of five applications of the same\n * predicate (`consentBasedProviderStopRefusal`), in the provider package's own `./companion` barrel where\n * the author is; hydration withholds the provider's code and scripts, the SDK runner refuses to start it,\n * the startup script collector skips it and the component registry does not register it, so neither a stale\n * artifact nor a hand-written module list can start one either.\n */\nfunction assertConsentBasedProviderIsStoppable(module: FrontendProviderModuleShape): void {\n // assurance-control: WILDO.PRIVACY.CONSENT_ENFORCEMENT — a consent-based provider must be stoppable when consent is withdrawn\n const refusal = consentBasedProviderStopRefusal(module.metadata.ref, module);\n if (refusal !== undefined) throw new Error(refusal);\n}\n\n/**\n * Refuses a frontend provider that breaks the on-demand rule (#2790): an on-demand capability whose SDK the surface\n * would start (so no flow's call reaches it), or an on-demand SDK serving no on-demand capability or with no\n * predicate. Here, in the provider package's own `./companion` barrel, because that is what publish loads: the\n * author meets it before the module ships rather than as a provider that is declared and never called.\n */\nfunction assertOnDemandRuleIsKept(module: FrontendProviderModuleShape): void {\n const refusal = onDemandProviderSdkRefusal(module.metadata.ref, module);\n if (refusal !== undefined) throw new Error(refusal);\n}\n\n/**\n * Refuses a frontend provider that declares no `publicConfigSchema` whose keys can be read\n * without running it (#1705).\n *\n * Without that list nothing can hold what the provider is served to a set of keys, and \"admit\n * everything\" was the answer: 8 of the 13 engine modules declared none, including the two that run\n * vendor code (PostHog, Sentry), so any key — a secret under an innocent name included — passed\n * through to every browser. The overlay at `wildo config sync` refuses the same absence on the entry\n * (`SCHEMA_NOT_INTROSPECTABLE`) and hydration refuses it on the code module; this is the earliest of\n * the three, in the provider package's own `./companion` barrel, where the author is.\n *\n * Checked on the module's authored `publicConfig` too: a module whose own defaults carry a key its\n * schema does not declare would fail its own schema at hydration and run none of its code.\n */\nfunction assertPublicConfigSchemaIsIntrospectable(module: FrontendProviderModuleShape): void {\n // assurance-control: WILDO.SECURITY.FAIL_CLOSED — a frontend provider with no readable key list is not projected\n const declared = readDeclaredPublicConfigKeys(module.publicConfigSchema);\n if (declared === undefined) {\n throw new Error(\n `Frontend provider \"${module.metadata.ref}\" declares no publicConfigSchema whose keys can be read without running `\n + 'it. Its publicConfig is served to every browser, and without a declared key list nothing can refuse a key it '\n + 'never reads — a secret under an innocent name included. Declare one with `defineFrontendPublicConfigSchema` '\n + '(or a Zod object) listing every key its publicConfig carries.',\n );\n }\n const admissible = new Set(admissibleFrontendPublicConfigKeys({ declaredKeys: declared, providerCapabilities: module.providerCapabilities }));\n const undeclared = Object.keys(module.publicConfig ?? {}).filter((key) => !admissible.has(key));\n if (undeclared.length > 0) {\n throw new Error(\n `Frontend provider \"${module.metadata.ref}\" authors publicConfig ${undeclared.map((key) => `\"${key}\"`).join(', ')}, `\n + 'which its own publicConfigSchema does not declare. Declare the key, or remove it.',\n );\n }\n}\n\n/**\n * Turns a frontend provider module into the companion contribution tooling\n * reads — the ONE place a facet module becomes a discovery record.\n *\n * Exported because the engine is not the only producer. Every\n * `@wildo-ai/provider-<ref>` package's own `./companion` barrel has to do\n * exactly this for its own facet modules, and a projection each package\n * hand-rolls is a projection that drifts: the DATA half of the frontend\n * surface would end up carried by some packages and dropped by others, and a\n * dropped CSP footprint is invisible until a provider is blocked in production.\n *\n * What crosses and what does not is the whole contract. `csp`, `scripts`, the\n * SDK DESCRIPTOR and the `complianceProfile` cross, because tooling has to read\n * them without executing anything — this runs in Node and a facet module is browser-bound. The\n * executable half — `sdk.activate`, `publicConfigSchema` — does NOT, and cannot:\n * the contribution is serialized to JSON on its way into the generated\n * artifact, so a function would be dropped by `JSON.stringify` with no error\n * anywhere. Code reaches a bundle through the generated\n * `frontend-providers.generated.ts` instead.\n */\nexport function projectFrontendProviderContribution(\n module: FrontendProviderModuleShape,\n serviceType: AppFrontendType,\n runtimeImportPath: string,\n): ProviderCompanionContribution {\n assertDeclaredScriptOriginsAreGranted(module);\n assertConsentClassificationIsComplete(module);\n assertConsentBasedProviderIsStoppable(module);\n assertPublicConfigSchemaIsIntrospectable(module);\n assertOnDemandRuleIsKept(module);\n\n const frontendEntry: FrontendProviderEntry = {\n metadata: module.metadata,\n providerCapabilities: [...module.providerCapabilities],\n protocols: [...module.protocols],\n publicConfig: module.publicConfig,\n // The DATA half of the frontend surface (#332). It has to travel with the\n // contribution because the CSP of a service is composed by the CLI, from\n // the materialized artifact, long before any browser loads the module that\n // declares it — and the CLI cannot execute that module to ask.\n // Normalized here, once: a provider AUTHORS the buckets it reaches and the\n // wire carries all of them, so the CSP composer never branches on absence\n // and the hydration join compares two shapes of the same kind.\n csp: module.csp === undefined ? undefined : normalizeProviderFrontendCspFootprint(module.csp),\n scripts: module.scripts === undefined ? undefined : [...module.scripts],\n sdk: module.sdk?.descriptor,\n // The DATA half of each contributed component (#380). `load` is stripped\n // HERE rather than left to `JSON.stringify` to drop it: a function that\n // disappears silently on its way through a serializer is the failure this\n // whole two-channel split exists to remove, and stripping it explicitly is\n // what makes the projection's contract readable at the projection.\n //\n // Rebuilt field by field rather than spread-minus-`load`, so a future field\n // on the declaration is a COMPILE decision about whether it crosses the wire\n // instead of one that crosses by default. `sdk` makes the same choice by\n // naming `descriptor`; this is the same rule where the shape is a map.\n components: projectFrontendComponentDescriptors(module.components),\n // The keys the module's `publicConfigSchema` declares, as DATA (#394 P3).\n // The schema itself is CODE and stays behind; this list is what lets\n // `wildo config sync` refuse an application-supplied key the module never\n // reads, at the moment it is typed rather than when a picker opens.\n // UNION with the keys the module's own CAPABILITIES own (#380). A picker\n // declaring `appId` still reads `maxFileSizeMb`, because the framework reads\n // it on the picker's behalf — so a list built from the provider's schema\n // alone refuses the capability's whole vocabulary at the moment it is typed.\n publicConfigKeys: admissibleFrontendPublicConfigKeys({\n declaredKeys: readDeclaredPublicConfigKeys(module.publicConfigSchema),\n providerCapabilities: module.providerCapabilities,\n })?.slice(),\n // The keys the module cannot run without, as DATA, so the CLI and the doctor can say a declared\n // provider is not configured before any browser tries to start it. ALWAYS written, empty when the module\n // requires nothing: an entry without the list is then recognisably one written before the check existed,\n // never mistaken for \"configured\". The backend's fallback projection writes it the same way.\n requiredPublicConfigKeys: [...readRequiredPublicConfigKeys(module.publicConfigSchema)],\n // The z_file storage the picker fronts (#394 P5) — an enum member, so it\n // crosses the wire as-is; the chooser filters on it and the hydration join\n // compares it to the CODE side.\n fileStorage: module.fileStorage,\n // WHO runs the vendor, WHERE it processes and WHICH legal entity stands behind it (#1743).\n // Every engine facet module has declared this since #345 and this projection used to leave it\n // behind — so the browser vendors a privacy notice most needs to name (reCAPTCHA,\n // Sentry, the Drive/OneDrive/Dropbox pickers) reached no compliance reader at all. Pure DATA,\n // like `csp`, so it crosses as-is and lands in the per-service `frontendProviderBootstraps` of\n // the generated artifact, which is where `listServedFrontendProviderCompliance` reads it.\n complianceProfile: module.complianceProfile,\n // The vendor's purposes BEYOND its capabilities' floor (#1702). DATA, because the browser decides\n // on the hydrated module, whose consent inputs come from this entry — a purpose left behind here\n // would reach no gate. Normalized once; absent stays absent so \"adds nothing\" keeps one spelling.\n consentPurposes: module.consentPurposes === undefined || module.consentPurposes.length === 0\n ? undefined\n : normalizeConsentPurposes(module.consentPurposes),\n };\n return {\n ref: module.metadata.ref,\n identity: {\n packageName: module.metadata.packageName,\n tier: module.metadata.tier,\n vendor: module.metadata.vendor,\n origin: module.metadata.origin,\n },\n runtimeImportPath,\n runtimeTargets: [{ kind: 'frontendService', serviceType }],\n engineCapabilities: deriveEngineCapabilities(module.metadata.ref, module.providerCapabilities),\n providerCapabilities: [...module.providerCapabilities],\n protocols: [...module.protocols],\n // Browser-safe providers cannot own server secrets. The explicit empty\n // shape is authoritative and distinct from an unknown/missing contract.\n secretsContractShape: [],\n frontendEntry,\n };\n}\n\n/** One contribution per `EngineFrontendAppProviderRegistry` module, targeting `SAAS_APP`. */\nexport const engineFrontendAppProviderContributions: ProviderCompanionContribution[] =\n Array.from(EngineFrontendAppProviderRegistry.modules.values()).map((module) =>\n projectFrontendProviderContribution(module, AppFrontendType.SAAS_APP, APP_RUNTIME_IMPORT_PATH),\n );\n\n/** One contribution per `EngineFrontendTechdocProviderRegistry` module, targeting `TECH_DOC`. */\nexport const engineFrontendTechdocProviderContributions: ProviderCompanionContribution[] =\n Array.from(EngineFrontendTechdocProviderRegistry.modules.values()).map((module) =>\n projectFrontendProviderContribution(module, AppFrontendType.TECH_DOC, TECHDOC_RUNTIME_IMPORT_PATH),\n );\n\n/** One contribution per `EngineFrontendWebsiteProviderRegistry` module, targeting `STATIC_WEBSITE`. */\nexport const engineFrontendWebsiteProviderContributions: ProviderCompanionContribution[] =\n Array.from(EngineFrontendWebsiteProviderRegistry.modules.values()).map((module) =>\n projectFrontendProviderContribution(module, AppFrontendType.STATIC_WEBSITE, WEBSITE_RUNTIME_IMPORT_PATH),\n );\n\n/** Stable union — order: app providers, then techdoc, then website (matches the registry imports). */\nexport const engineFrontendProviderContributions: ProviderCompanionContribution[] = [\n ...engineFrontendAppProviderContributions,\n ...engineFrontendTechdocProviderContributions,\n ...engineFrontendWebsiteProviderContributions,\n];\n\n/**\n * Companion-discovery contract — see `RuntimeOwnerCompanionExports`.\n * The framework loader reads `providerContributions` via the package's\n * `./companion` subpath export.\n */\nconst companionExports: RuntimeOwnerCompanionExports = {\n providerContributions: engineFrontendProviderContributions,\n};\n\nexport default companionExports;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recaptcha.frontend-website.module.d.ts","sourceRoot":"","sources":["../../../../../src/providers/recaptcha/recaptcha.frontend-website.module.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,sDAAsD,CAAC;AAQ1G;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,4CAA4C,CAAC;AAKjF,mGAAmG;AACnG,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAyDlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,gCAAgC,EAAE,
|
|
1
|
+
{"version":3,"file":"recaptcha.frontend-website.module.d.ts","sourceRoot":"","sources":["../../../../../src/providers/recaptcha/recaptcha.frontend-website.module.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,sDAAsD,CAAC;AAQ1G;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,4CAA4C,CAAC;AAKjF,mGAAmG;AACnG,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAyDlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,gCAAgC,EAAE,6BA2D9C,CAAC"}
|
|
@@ -116,7 +116,7 @@ export const RecaptchaFrontendWebsiteProvider = {
|
|
|
116
116
|
publicConfigSchema: defineFrontendPublicConfigSchema({
|
|
117
117
|
integrationKind: { kind: FrontendPublicConfigValueKind.STRING, description: 'Which integration: captcha.' },
|
|
118
118
|
websiteRuntime: { kind: FrontendPublicConfigValueKind.BOOLEAN, description: 'Runs on the website surface.' },
|
|
119
|
-
siteKey: { kind: FrontendPublicConfigValueKind.STRING, description: 'The reCAPTCHA v3 SITE key (public by design). Never the secret key.' },
|
|
119
|
+
siteKey: { kind: FrontendPublicConfigValueKind.STRING, required: true, description: 'The reCAPTCHA v3 SITE key (public by design). Never the secret key.' },
|
|
120
120
|
}),
|
|
121
121
|
csp: {
|
|
122
122
|
scriptOrigins: ['https://www.google.com', 'https://www.gstatic.com'],
|
|
@@ -124,8 +124,9 @@ export const RecaptchaFrontendWebsiteProvider = {
|
|
|
124
124
|
connectOrigins: ['https://www.google.com'],
|
|
125
125
|
},
|
|
126
126
|
sdk: {
|
|
127
|
-
// Not an npm package: Google serves reCAPTCHA only as its hosted loader, which `activate` injects.
|
|
128
|
-
|
|
127
|
+
// Not an npm package: Google serves reCAPTCHA only as its hosted loader, which `activate` injects. Its origin is
|
|
128
|
+
// in `csp.scriptOrigins` above, which the projection checks.
|
|
129
|
+
descriptor: { vendorHostedScriptUrl: RECAPTCHA_V3_LOADER_URL },
|
|
129
130
|
stoppable: true,
|
|
130
131
|
async activate({ providerRef, publicConfig }) {
|
|
131
132
|
const siteKey = publicConfig.siteKey;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recaptcha.frontend-website.module.js","sourceRoot":"","sources":["../../../../../src/providers/recaptcha/recaptcha.frontend-website.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sCAAsC,EAAE,MAAM,yCAAyC,CAAC;AACjG,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,2BAA2B,EAC3B,yBAAyB,EACzB,sBAAsB,EACtB,sBAAsB,EACtB,YAAY,EACZ,gCAAgC,EAChC,6BAA6B,GAE9B,MAAM,sCAAsC,CAAC;AAS9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,yCAAyC,CAAC;AAEjF,wGAAwG;AACxG,MAAM,aAAa,GAAG,6BAA6B,CAAC;AAEpD,mGAAmG;AACnG,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC;AAElD,SAAS,YAAY;IACnB,OAAO,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAe,CAAC;AACrE,CAAC;AAED;;;;GAIG;AACH,SAAS,aAAa,CAAC,OAAe;IACpC,MAAM,GAAG,GAAG,YAAY,EAAE,CAAC;IAC3B,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC,CAAC;IACjG,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,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C;oBACnB,CAAC;gBACH,CAAC;aACF,CAAC;YACF,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC;QACrD,CAAC;KACF;IACD,iBAAiB,EAAE;QACjB,gBAAgB,EAAE,CAAC,uBAAuB,CAAC,aAAa,CAAC;QACzD,iBAAiB,EAAE,CAAC,QAAQ,CAAC;QAC7B,qBAAqB,EAAE,wBAAwB;KAChD;CACF,CAAC","sourcesContent":["import { ENGINE_FRONTEND_PROVIDERS_PACKAGE_NAME } from '../../engine-frontend-providers-package';\nimport {\n ConsentPurpose,\n ProviderDeploymentModel,\n BUILTIN_PROVIDER_CAPABILITY,\n BUILTIN_PROVIDER_PROTOCOL,\n defineProviderMetadata,\n ENGINE_PROVIDER_ORIGIN,\n ProviderTier,\n defineFrontendPublicConfigSchema,\n FrontendPublicConfigValueKind,\n type FrontendCaptchaSink,\n} from '@wildo-ai/saas-models/public-runtime';\nimport type { FrontendWebsiteProviderModule } from '../../website/frontend-website-provider-module.types';\n\n/** The reCAPTCHA v3 client, as far as this module drives it. */\ninterface GrecaptchaClient {\n ready(callback: () => void): void;\n execute(siteKey: string, options: { action: string }): Promise<string>;\n}\n\n/**\n * Google's loader for reCAPTCHA v3, rendered for one site key.\n * spec-cite: https://developers.google.com/recaptcha/docs/v3 — \"Load the JavaScript API with your sitekey\",\n * `https://www.google.com/recaptcha/api.js?render=reCAPTCHA_site_key`. Fetched 2026-09-28.\n */\nexport const RECAPTCHA_V3_LOADER_URL = 'https://www.google.com/recaptcha/api.js';\n\n/** The attribute that marks the loader tag this module injected, so `deactivate` removes exactly it. */\nconst LOADER_MARKER = 'data-wildo-recaptcha-loader';\n\n/** How long the page waits for Google's loader before the form falls back to the proof of work. */\nexport const RECAPTCHA_LOADER_TIMEOUT_MS = 10_000;\n\nfunction globalWindow(): (Window & { grecaptcha?: GrecaptchaClient; ___grecaptcha_cfg?: unknown }) | undefined {\n return typeof window === 'undefined' ? undefined : window as never;\n}\n\n/**\n * Inject Google's loader and resolve once `grecaptcha.ready` fires. Loaded HERE, inside `activate`, and never as a\n * declared `scripts` entry: this provider rests on consent, and only an SDK can be stopped when consent is\n * withdrawn (#1704).\n */\nfunction loadRecaptcha(siteKey: string): Promise<GrecaptchaClient> {\n const win = globalWindow();\n if (win === undefined) return Promise.reject(new Error('reCAPTCHA can only load in a browser.'));\n return new Promise((resolve, reject) => {\n const timer = setTimeout(() => reject(new Error('reCAPTCHA did not load in time.')), RECAPTCHA_LOADER_TIMEOUT_MS);\n const settle = () => {\n const client = win.grecaptcha;\n if (client === undefined) {\n clearTimeout(timer);\n reject(new Error('reCAPTCHA loaded without its client.'));\n return;\n }\n client.ready(() => { clearTimeout(timer); resolve(client); });\n };\n const script = win.document.createElement('script');\n script.src = `${RECAPTCHA_V3_LOADER_URL}?render=${encodeURIComponent(siteKey)}`;\n script.async = true;\n script.setAttribute(LOADER_MARKER, '');\n script.addEventListener('load', settle, { once: true });\n script.addEventListener('error', () => { clearTimeout(timer); reject(new Error('reCAPTCHA failed to load.')); }, { once: true });\n win.document.head.appendChild(script);\n });\n}\n\n/**\n * Stop reCAPTCHA in this page (#1704): remove the loader tag, every script and frame Google added under its\n * `recaptcha` paths, the badge, and the globals it installed, so no code of it keeps running and nothing more\n * reaches Google from this page. What Google already stored in ITS OWN cookies cannot be cleared by the page\n * (they belong to Google's domain); that is why this provider starts only on consent in the first place.\n */\nfunction stopRecaptcha(): void {\n const win = globalWindow();\n if (win === undefined) return;\n const doc = win.document;\n const added = doc.querySelectorAll(\n `script[${LOADER_MARKER}], script[src*=\"/recaptcha/\"], iframe[src*=\"/recaptcha/\"], .grecaptcha-badge`,\n );\n added.forEach((element) => {\n const badgeHost = element.classList.contains('grecaptcha-badge') ? element.parentElement : null;\n element.remove();\n if (badgeHost !== null && badgeHost !== doc.body && badgeHost.childElementCount === 0) badgeHost.remove();\n });\n delete win.grecaptcha;\n delete win.___grecaptcha_cfg;\n}\n\n/**\n * Google reCAPTCHA v3 for the marketing website's public forms (#1735) — the browser half; the backend half\n * (`recaptcha` in `@wildo-ai/external-connectors-private`) verifies the tokens it mints.\n *\n * ## Consent\n *\n * The capability floor for a captcha is \"no consent\" — a pure security measure is exempt — but Google reCAPTCHA is\n * not one: the CNIL held that it \"also serves Google's own analysis\" (Délibération SAN-2023-003), so this module\n * adds `ConsentPurpose.ANALYTICS` to its floor (#1702). It therefore loads only once the visitor grants analytics,\n * and is stopped when they withdraw it. A visitor who declines still submits: the form then answers the engine's\n * own proof of work, which the backend accepts in place of a token.\n * spec-cite: https://www.legifrance.gouv.fr/cnil/id/CNILTEXT000047346903 — summarised from #1735's research, not quoted.\n *\n * ## Entity\n *\n * Deliberately NOT `Google LLC`. Google's role for reCAPTCHA changed from data CONTROLLER to data PROCESSOR on\n * 2 April 2026: the website operator is the controller and `Google Ireland Limited` the processor for the EEA,\n * with processing still reaching US servers under standard contractual clauses. `global` is the honest region:\n * reCAPTCHA offers no data-residency choice.\n *\n * ## CSP\n *\n * Google's own guidance: script-src `www.google.com/recaptcha/` and `www.gstatic.com/recaptcha/`, frame-src\n * `www.google.com/recaptcha/` and `recaptcha.google.com/recaptcha/`, connect-src `www.google.com/recaptcha/`.\n * The footprint names origins, so those paths widen to their origins.\n * spec-cite: https://developers.google.com/recaptcha/docs/faq — \"I'm using Content Security Policy (CSP) on my\n * website. How can I configure it to work with reCAPTCHA?\", fetched 2026-09-28.\n *\n * ## The badge\n *\n * Left visible: Google permits hiding it only when the page shows its reCAPTCHA branding text instead, which would\n * be a second place for the vendor's words to live. The badge is Google's own disclosure.\n */\nexport const RecaptchaFrontendWebsiteProvider: FrontendWebsiteProviderModule = {\n metadata: defineProviderMetadata({\n ref: 'recaptcha',\n packageName: ENGINE_FRONTEND_PROVIDERS_PACKAGE_NAME,\n // MAIN, like its backend half: the engine's own public contact form consumes it.\n tier: ProviderTier.MAIN,\n origin: ENGINE_PROVIDER_ORIGIN,\n }),\n providerCapabilities: [BUILTIN_PROVIDER_CAPABILITY.FRONTEND_CAPTCHA],\n protocols: [BUILTIN_PROVIDER_PROTOCOL.FRONTEND_SDK],\n consentPurposes: [ConsentPurpose.ANALYTICS],\n publicConfig: {\n integrationKind: 'captcha',\n websiteRuntime: true,\n },\n // The public SITE key only. The secret key is the backend half's and never belongs here — a served value equal\n // to any environment secret is refused by `wildo config sync` (#1705).\n publicConfigSchema: defineFrontendPublicConfigSchema({\n integrationKind: { kind: FrontendPublicConfigValueKind.STRING, description: 'Which integration: captcha.' },\n websiteRuntime: { kind: FrontendPublicConfigValueKind.BOOLEAN, description: 'Runs on the website surface.' },\n siteKey: { kind: FrontendPublicConfigValueKind.STRING, description: 'The reCAPTCHA v3 SITE key (public by design). Never the secret key.' },\n }),\n csp: {\n scriptOrigins: ['https://www.google.com', 'https://www.gstatic.com'],\n frameOrigins: ['https://www.google.com', 'https://recaptcha.google.com'],\n connectOrigins: ['https://www.google.com'],\n },\n sdk: {\n // Not an npm package: Google serves reCAPTCHA only as its hosted loader, which `activate` injects.\n descriptor: { packageName: 'recaptcha-v3-hosted-loader' },\n stoppable: true,\n async activate({ providerRef, publicConfig }) {\n const siteKey = publicConfig.siteKey;\n if (typeof siteKey !== 'string' || siteKey.length === 0) {\n throw new Error(\n `Provider \"${providerRef}\" needs its reCAPTCHA v3 site key in publicConfig.siteKey. Supply it under `\n + 'providerConfigurations.recaptcha.frontend_sdk for the website service.',\n );\n }\n const client = await loadRecaptcha(siteKey);\n const sink: FrontendCaptchaSink = {\n async execute(action) {\n try {\n const token = await client.execute(siteKey, { action });\n return token.length > 0 ? token : undefined;\n } catch {\n return undefined;\n }\n },\n };\n return { handle: sink, deactivate: stopRecaptcha };\n },\n },\n complianceProfile: {\n deploymentModels: [ProviderDeploymentModel.VENDOR_HOSTED],\n processingRegions: ['global'],\n vendorLegalEntityName: 'Google Ireland Limited',\n },\n};\n"]}
|
|
1
|
+
{"version":3,"file":"recaptcha.frontend-website.module.js","sourceRoot":"","sources":["../../../../../src/providers/recaptc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INE_FRONTEND_PROVIDERS_PACKAGE_NAME } from '../../engine-frontend-providers-package';\nimport {\n ConsentPurpose,\n ProviderDeploymentModel,\n BUILTIN_PROVIDER_CAPABILITY,\n BUILTIN_PROVIDER_PROTOCOL,\n defineProviderMetadata,\n ENGINE_PROVIDER_ORIGIN,\n ProviderTier,\n defineFrontendPublicConfigSchema,\n FrontendPublicConfigValueKind,\n type FrontendCaptchaSink,\n} from '@wildo-ai/saas-models/public-runtime';\nimport type { FrontendWebsiteProviderModule } from '../../website/frontend-website-provider-module.types';\n\n/** The reCAPTCHA v3 client, as far as this module drives it. */\ninterface GrecaptchaClient {\n ready(callback: () => void): void;\n execute(siteKey: string, options: { action: string }): Promise<string>;\n}\n\n/**\n * Google's loader for reCAPTCHA v3, rendered for one site key.\n * spec-cite: https://developers.google.com/recaptcha/docs/v3 — \"Load the JavaScript API with your sitekey\",\n * `https://www.google.com/recaptcha/api.js?render=reCAPTCHA_site_key`. Fetched 2026-09-28.\n */\nexport const RECAPTCHA_V3_LOADER_URL = 'https://www.google.com/recaptcha/api.js';\n\n/** The attribute that marks the loader tag this module injected, so `deactivate` removes exactly it. */\nconst LOADER_MARKER = 'data-wildo-recaptcha-loader';\n\n/** How long the page waits for Google's loader before the form falls back to the proof of work. */\nexport const RECAPTCHA_LOADER_TIMEOUT_MS = 10_000;\n\nfunction globalWindow(): (Window & { grecaptcha?: GrecaptchaClient; ___grecaptcha_cfg?: unknown }) | undefined {\n return typeof window === 'undefined' ? undefined : window as never;\n}\n\n/**\n * Inject Google's loader and resolve once `grecaptcha.ready` fires. Loaded HERE, inside `activate`, and never as a\n * declared `scripts` entry: this provider rests on consent, and only an SDK can be stopped when consent is\n * withdrawn (#1704).\n */\nfunction loadRecaptcha(siteKey: string): Promise<GrecaptchaClient> {\n const win = globalWindow();\n if (win === undefined) return Promise.reject(new Error('reCAPTCHA can only load in a browser.'));\n return new Promise((resolve, reject) => {\n const timer = setTimeout(() => reject(new Error('reCAPTCHA did not load in time.')), RECAPTCHA_LOADER_TIMEOUT_MS);\n const settle = () => {\n const client = win.grecaptcha;\n if (client === undefined) {\n clearTimeout(timer);\n reject(new Error('reCAPTCHA loaded without its client.'));\n return;\n }\n client.ready(() => { clearTimeout(timer); resolve(client); });\n };\n const script = win.document.createElement('script');\n script.src = `${RECAPTCHA_V3_LOADER_URL}?render=${encodeURIComponent(siteKey)}`;\n script.async = true;\n script.setAttribute(LOADER_MARKER, '');\n script.addEventListener('load', settle, { once: true });\n script.addEventListener('error', () => { clearTimeout(timer); reject(new Error('reCAPTCHA failed to load.')); }, { once: true });\n win.document.head.appendChild(script);\n });\n}\n\n/**\n * Stop reCAPTCHA in this page (#1704): remove the loader tag, every script and frame Google added under its\n * `recaptcha` paths, the badge, and the globals it installed, so no code of it keeps running and nothing more\n * reaches Google from this page. What Google already stored in ITS OWN cookies cannot be cleared by the page\n * (they belong to Google's domain); that is why this provider starts only on consent in the first place.\n */\nfunction stopRecaptcha(): void {\n const win = globalWindow();\n if (win === undefined) return;\n const doc = win.document;\n const added = doc.querySelectorAll(\n `script[${LOADER_MARKER}], script[src*=\"/recaptcha/\"], iframe[src*=\"/recaptcha/\"], .grecaptcha-badge`,\n );\n added.forEach((element) => {\n const badgeHost = element.classList.contains('grecaptcha-badge') ? element.parentElement : null;\n element.remove();\n if (badgeHost !== null && badgeHost !== doc.body && badgeHost.childElementCount === 0) badgeHost.remove();\n });\n delete win.grecaptcha;\n delete win.___grecaptcha_cfg;\n}\n\n/**\n * Google reCAPTCHA v3 for the marketing website's public forms (#1735) — the browser half; the backend half\n * (`recaptcha` in `@wildo-ai/external-connectors-private`) verifies the tokens it mints.\n *\n * ## Consent\n *\n * The capability floor for a captcha is \"no consent\" — a pure security measure is exempt — but Google reCAPTCHA is\n * not one: the CNIL held that it \"also serves Google's own analysis\" (Délibération SAN-2023-003), so this module\n * adds `ConsentPurpose.ANALYTICS` to its floor (#1702). It therefore loads only once the visitor grants analytics,\n * and is stopped when they withdraw it. A visitor who declines still submits: the form then answers the engine's\n * own proof of work, which the backend accepts in place of a token.\n * spec-cite: https://www.legifrance.gouv.fr/cnil/id/CNILTEXT000047346903 — summarised from #1735's research, not quoted.\n *\n * ## Entity\n *\n * Deliberately NOT `Google LLC`. Google's role for reCAPTCHA changed from data CONTROLLER to data PROCESSOR on\n * 2 April 2026: the website operator is the controller and `Google Ireland Limited` the processor for the EEA,\n * with processing still reaching US servers under standard contractual clauses. `global` is the honest region:\n * reCAPTCHA offers no data-residency choice.\n *\n * ## CSP\n *\n * Google's own guidance: script-src `www.google.com/recaptcha/` and `www.gstatic.com/recaptcha/`, frame-src\n * `www.google.com/recaptcha/` and `recaptcha.google.com/recaptcha/`, connect-src `www.google.com/recaptcha/`.\n * The footprint names origins, so those paths widen to their origins.\n * spec-cite: https://developers.google.com/recaptcha/docs/faq — \"I'm using Content Security Policy (CSP) on my\n * website. How can I configure it to work with reCAPTCHA?\", fetched 2026-09-28.\n *\n * ## The badge\n *\n * Left visible: Google permits hiding it only when the page shows its reCAPTCHA branding text instead, which would\n * be a second place for the vendor's words to live. The badge is Google's own disclosure.\n */\nexport const RecaptchaFrontendWebsiteProvider: FrontendWebsiteProviderModule = {\n metadata: defineProviderMetadata({\n ref: 'recaptcha',\n packageName: ENGINE_FRONTEND_PROVIDERS_PACKAGE_NAME,\n // MAIN, like its backend half: the engine's own public contact form consumes it.\n tier: ProviderTier.MAIN,\n origin: ENGINE_PROVIDER_ORIGIN,\n }),\n providerCapabilities: [BUILTIN_PROVIDER_CAPABILITY.FRONTEND_CAPTCHA],\n protocols: [BUILTIN_PROVIDER_PROTOCOL.FRONTEND_SDK],\n consentPurposes: [ConsentPurpose.ANALYTICS],\n publicConfig: {\n integrationKind: 'captcha',\n websiteRuntime: true,\n },\n // The public SITE key only. The secret key is the backend half's and never belongs here — a served value equal\n // to any environment secret is refused by `wildo config sync` (#1705).\n publicConfigSchema: defineFrontendPublicConfigSchema({\n integrationKind: { kind: FrontendPublicConfigValueKind.STRING, description: 'Which integration: captcha.' },\n websiteRuntime: { kind: FrontendPublicConfigValueKind.BOOLEAN, description: 'Runs on the website surface.' },\n siteKey: { kind: FrontendPublicConfigValueKind.STRING, required: true, description: 'The reCAPTCHA v3 SITE key (public by design). Never the secret key.' },\n }),\n csp: {\n scriptOrigins: ['https://www.google.com', 'https://www.gstatic.com'],\n frameOrigins: ['https://www.google.com', 'https://recaptcha.google.com'],\n connectOrigins: ['https://www.google.com'],\n },\n sdk: {\n // Not an npm package: Google serves reCAPTCHA only as its hosted loader, which `activate` injects. Its origin is\n // in `csp.scriptOrigins` above, which the projection checks.\n descriptor: { vendorHostedScriptUrl: RECAPTCHA_V3_LOADER_URL },\n stoppable: true,\n async activate({ providerRef, publicConfig }) {\n const siteKey = publicConfig.siteKey;\n if (typeof siteKey !== 'string' || siteKey.length === 0) {\n throw new Error(\n `Provider \"${providerRef}\" needs its reCAPTCHA v3 site key in publicConfig.siteKey. Supply it under `\n + 'providerConfigurations.recaptcha.frontend_sdk for the website service.',\n );\n }\n const client = await loadRecaptcha(siteKey);\n const sink: FrontendCaptchaSink = {\n async execute(action) {\n try {\n const token = await client.execute(siteKey, { action });\n return token.length > 0 ? token : undefined;\n } catch {\n return undefined;\n }\n },\n };\n return { handle: sink, deactivate: stopRecaptcha };\n },\n },\n complianceProfile: {\n deploymentModels: [ProviderDeploymentModel.VENDOR_HOSTED],\n processingRegions: ['global'],\n vendorLegalEntityName: 'Google Ireland Limited',\n },\n};\n"]}
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
* analytics client inside a build process. The runner refuses off-browser and
|
|
24
24
|
* says so, rather than letting each surface remember to guard.
|
|
25
25
|
*/
|
|
26
|
-
import type
|
|
27
|
-
import type
|
|
26
|
+
import { type AppFrontendType, type ConsentPurpose, type FrontendOnDemandCapabilityContext } from '@wildo-ai/saas-models/public-runtime';
|
|
27
|
+
import { type ProviderFrontendSdk, type ProviderFrontendSdkActivation } from './frontend-provider-surface.types';
|
|
28
28
|
/** Why an SDK activation did not happen, or did not survive. */
|
|
29
29
|
export declare enum FrontendProviderSdkActivationDiagnosticKind {
|
|
30
30
|
/**
|
|
@@ -52,7 +52,14 @@ export declare enum FrontendProviderSdkActivationDiagnosticKind {
|
|
|
52
52
|
* A consent-based provider's SDK declared `stoppable` and its activation returned no `deactivate`. It IS
|
|
53
53
|
* running, and a withdrawal will not stop it; nothing in the page can undo that, so it is reported loudly.
|
|
54
54
|
*/
|
|
55
|
-
STOP_PROMISE_BROKEN = "STOP_PROMISE_BROKEN"
|
|
55
|
+
STOP_PROMISE_BROKEN = "STOP_PROMISE_BROKEN",
|
|
56
|
+
/**
|
|
57
|
+
* An on-demand SDK (#2790) serving the called capability declares no `servesOnDemandContext`, so it can never say
|
|
58
|
+
* it is the provider to call. Not started; the provider author's to fix (its projection refuses the same shape).
|
|
59
|
+
*/
|
|
60
|
+
ON_DEMAND_WITHOUT_PREDICATE = "ON_DEMAND_WITHOUT_PREDICATE",
|
|
61
|
+
/** An on-demand SDK's `servesOnDemandContext` threw. Treated as not serving the context, so nothing was loaded. */
|
|
62
|
+
ON_DEMAND_PREDICATE_FAILED = "ON_DEMAND_PREDICATE_FAILED"
|
|
56
63
|
}
|
|
57
64
|
export interface FrontendProviderSdkActivationDiagnostic {
|
|
58
65
|
readonly kind: FrontendProviderSdkActivationDiagnosticKind;
|
|
@@ -89,6 +96,17 @@ export interface ActivateFrontendProviderSdksInput {
|
|
|
89
96
|
* answer passes it.
|
|
90
97
|
*/
|
|
91
98
|
readonly grantedConsentPurposes?: readonly ConsentPurpose[];
|
|
99
|
+
/**
|
|
100
|
+
* The ON-DEMAND call (#2790): the capability a flow needs now and the context it knows. With it, only the SDKs
|
|
101
|
+
* declared `ON_DEMAND` that serve `onDemand.capability` and whose `servesOnDemandContext` accepts the context are
|
|
102
|
+
* started, the predicate evaluated here, at the call. Without it — every surface start — an `ON_DEMAND` SDK is
|
|
103
|
+
* skipped, silently, because not starting it is the expected outcome on every page.
|
|
104
|
+
*
|
|
105
|
+
* Held here rather than in each caller: the four surface starts (application startup, its consent phase, the
|
|
106
|
+
* website, the documentation) all go through this runner, so none of them can start an on-demand SDK by
|
|
107
|
+
* forgetting a filter.
|
|
108
|
+
*/
|
|
109
|
+
readonly onDemand?: FrontendOnDemandCapabilityContext;
|
|
92
110
|
/**
|
|
93
111
|
* Escape hatch for tests and for a surface that legitimately renders in a
|
|
94
112
|
* non-DOM host. Defaults to a real `window` check; nothing else in this
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activate-frontend-provider-sdks.d.ts","sourceRoot":"","sources":["../../../../src/shared/activate-frontend-provider-sdks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"activate-frontend-provider-sdks.d.ts","sourceRoot":"","sources":["../../../../src/shared/activate-frontend-provider-sdks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,iCAAiC,EACvC,MAAM,sCAAsC,CAAC;AAO9C,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,6BAA6B,EACnC,MAAM,mCAAmC,CAAC;AAS3C,gEAAgE;AAChE,oBAAY,2CAA2C;IACrD;;;;OAIG;IACH,mBAAmB,wBAAwB;IAC3C,6EAA6E;IAC7E,iBAAiB,sBAAsB;IACvC,6EAA6E;IAC7E,mBAAmB,wBAAwB;IAC3C;;;OAGG;IACH,wBAAwB,6BAA6B;IACrD;;;;OAIG;IACH,sBAAsB,2BAA2B;IACjD;;;OAGG;IACH,mBAAmB,wBAAwB;IAC3C;;;OAGG;IACH,2BAA2B,gCAAgC;IAC3D,mHAAmH;IACnH,0BAA0B,+BAA+B;CAC1D;AAED,MAAM,WAAW,uCAAuC;IACtD,QAAQ,CAAC,IAAI,EAAE,2CAA2C,CAAC;IAC3D,QAAQ,CAAC,W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