@handsforbots/consent 0.0.0-stage → 2.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md ADDED
@@ -0,0 +1,9 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright © 2024 Alex Lana and Hands for Bots contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,21 @@
1
- # Temporary Holding Version
1
+ # @handsforbots/consent
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Consent rule sets (LGPD, GDPR, CCPA starting points), loaders for JSON/YAML rules, region helpers and anonymization for Hands for Bots.
4
+
5
+ Part of [Hands for Bots](https://github.com/handsforbots/handsforbots), a headless multimodal and action layer between users, GUIs and agents.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @handsforbots/consent@alpha @handsforbots/core@alpha
11
+ ```
12
+
13
+ ## Documentation
14
+
15
+ - [This package](https://github.com/handsforbots/handsforbots/blob/main/docs/en-us/plugins.md#consent)
16
+ - [Getting started](https://github.com/handsforbots/handsforbots/blob/main/docs/en-us/getting-started.md)
17
+ - [Documentação em português](https://github.com/handsforbots/handsforbots/blob/main/docs/pt-br/README.md)
18
+
19
+ ## License
20
+
21
+ MIT
@@ -0,0 +1,31 @@
1
+ import { type ConsentRules } from '@handsforbots/core';
2
+ export { ccpa, gdpr, lgpd, optIn, presets } from './presets.js';
3
+ export { PATTERNS, redact, redactMessages, redactor, redactText, type PatternName, type RedactOptions, type RedactPluginOptions, } from './redact.js';
4
+ export { parseConsentRules, selectConsentRules, type ConsentRules } from '@handsforbots/core';
5
+ export type LoadRulesOptions = {
6
+ /** Turns the file's text into data. Default `JSON.parse`; pass e.g. `YAML.parse` (from the `yaml` package) for `.yml` files. */
7
+ parse?: (text: string) => unknown;
8
+ fetch?: typeof fetch;
9
+ };
10
+ /**
11
+ * Fetches rule sets from a file you host (one set or a list), validates them
12
+ * and returns a list for `createH4B({ consent: { rules } })`.
13
+ *
14
+ * rules: await loadConsentRules('/consent/rules.yml', { parse: YAML.parse })
15
+ */
16
+ export declare function loadConsentRules(url: string, options?: LoadRulesOptions): Promise<ConsentRules[]>;
17
+ /**
18
+ * The region your server wrote into the page, e.g.
19
+ * `<meta name="h4b-region" content="BR">` from a CDN geo header
20
+ * (`CF-IPCountry`, `CloudFront-Viewer-Country`, `X-Vercel-IP-Country`…).
21
+ */
22
+ export declare function regionFromMeta(name?: string): string | undefined;
23
+ /**
24
+ * Asks your server for the region: the endpoint answers with the code as text
25
+ * (`BR`, `US-CA`) or as JSON `{ "region": "BR" }`. Failures resolve to
26
+ * undefined, so only rule sets for `*` apply.
27
+ */
28
+ export declare function regionFromUrl(url: string, options?: {
29
+ fetch?: typeof fetch;
30
+ }): () => Promise<string | undefined>;
31
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEzE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EACL,QAAQ,EACR,MAAM,EACN,cAAc,EACd,QAAQ,EACR,UAAU,EACV,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,mBAAmB,GACzB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAE7F,MAAM,MAAM,gBAAgB,GAAG;IAC7B,gIAAgI;IAChI,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAA;IACjC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;CACrB,CAAA;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAK3G;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,SAAe,GAAG,MAAM,GAAG,SAAS,CAItE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;CAAO,GAAG,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAYpH"}
package/dist/index.js ADDED
@@ -0,0 +1,50 @@
1
+ import { parseConsentRules } from '@handsforbots/core';
2
+ export { ccpa, gdpr, lgpd, optIn, presets } from './presets.js';
3
+ export { PATTERNS, redact, redactMessages, redactor, redactText, } from './redact.js';
4
+ export { parseConsentRules, selectConsentRules } from '@handsforbots/core';
5
+ /**
6
+ * Fetches rule sets from a file you host (one set or a list), validates them
7
+ * and returns a list for `createH4B({ consent: { rules } })`.
8
+ *
9
+ * rules: await loadConsentRules('/consent/rules.yml', { parse: YAML.parse })
10
+ */
11
+ export async function loadConsentRules(url, options = {}) {
12
+ const response = await (options.fetch ?? globalThis.fetch)(url, { headers: { accept: 'application/json, application/yaml, text/plain' } });
13
+ if (!response.ok)
14
+ throw new Error(`[h4b] consent: ${response.status} loading rules from ${url}`);
15
+ const data = (options.parse ?? JSON.parse)(await response.text());
16
+ return (Array.isArray(data) ? data : [data]).map(parseConsentRules);
17
+ }
18
+ /**
19
+ * The region your server wrote into the page, e.g.
20
+ * `<meta name="h4b-region" content="BR">` from a CDN geo header
21
+ * (`CF-IPCountry`, `CloudFront-Viewer-Country`, `X-Vercel-IP-Country`…).
22
+ */
23
+ export function regionFromMeta(name = 'h4b-region') {
24
+ if (typeof document === 'undefined')
25
+ return undefined;
26
+ const content = document.querySelector(`meta[name="${name.replace(/["\\]/g, '\\$&')}"]`)?.getAttribute('content')?.trim();
27
+ return content || undefined;
28
+ }
29
+ /**
30
+ * Asks your server for the region: the endpoint answers with the code as text
31
+ * (`BR`, `US-CA`) or as JSON `{ "region": "BR" }`. Failures resolve to
32
+ * undefined, so only rule sets for `*` apply.
33
+ */
34
+ export function regionFromUrl(url, options = {}) {
35
+ return async () => {
36
+ try {
37
+ const response = await (options.fetch ?? globalThis.fetch)(url, { credentials: 'same-origin' });
38
+ if (!response.ok)
39
+ return undefined;
40
+ const text = (await response.text()).trim();
41
+ if (text.startsWith('{'))
42
+ return JSON.parse(text).region?.trim() || undefined;
43
+ return text || undefined;
44
+ }
45
+ catch {
46
+ return undefined;
47
+ }
48
+ };
49
+ }
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAqB,MAAM,oBAAoB,CAAA;AAEzE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,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AU,aAAa,CAAC,GAAW,EAAE,OAAO,GAA6B,EAAE;IAC/E,OAAO,KAAK,IAAI,EAAE;QAChB,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,CAAA;YAC/F,IAAI,CAAC,QAAQ,CAAC,EAAE;gBAAE,OAAO,SAAS,CAAA;YAClC,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAA;YAC3C,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;gBAAE,OAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,CAAyB,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,SAAS,CAAA;YACtG,OAAO,IAAI,IAAI,SAAS,CAAA;QAC1B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,SAAS,CAAA;QAClB,CAAC;IACH,CAAC,CAAA;AACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { ConsentRules } from '@handsforbots/core';
2
+ /** Brazil (LGPD): opt-in for every purpose. */
3
+ export declare const lgpd: ConsentRules;
4
+ /** European Economic Area, Switzerland and the United Kingdom (GDPR / ePrivacy): opt-in for every purpose. */
5
+ export declare const gdpr: ConsentRules;
6
+ /** California (CCPA/CPRA): allowed until the person opts out. */
7
+ export declare const ccpa: ConsentRules;
8
+ /** Anywhere else: opt-in for every purpose. Put it last as the fallback. */
9
+ export declare const optIn: ConsentRules;
10
+ /** LGPD, GDPR, CCPA and the opt-in fallback, in the order `selectConsentRules` expects. */
11
+ export declare const presets: ConsentRules[];
12
+ //# sourceMappingURL=presets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../src/presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAsB,YAAY,EAAgB,MAAM,oBAAoB,CAAA;AAgCxF,+CAA+C;AAC/C,eAAO,MAAM,IAAI,EAAE,YAKlB,CAAA;AAED,8GAA8G;AAC9G,eAAO,MAAM,IAAI,EAAE,YASlB,CAAA;AAED,iEAAiE;AACjE,eAAO,MAAM,IAAI,EAAE,YAKlB,CAAA;AAED,4EAA4E;AAC5E,eAAO,MAAM,KAAK,EAAE,YAKnB,CAAA;AAED,2FAA2F;AAC3F,eAAO,MAAM,OAAO,EAAE,YAAY,EAA8B,CAAA"}
@@ -0,0 +1,63 @@
1
+ /*
2
+ * Starting points, not legal advice: review them with whoever answers for
3
+ * privacy where you operate. The same rule sets are in `rules/*.json`, to copy
4
+ * and edit (as JSON or YAML) and load with `loadConsentRules`.
5
+ */
6
+ const purposes = (state) => ({
7
+ persistence: {
8
+ default: state,
9
+ label: { en: 'Keep this conversation', 'pt-BR': 'Guardar esta conversa' },
10
+ description: {
11
+ en: 'Keep the conversation so it survives reloads and later visits.',
12
+ 'pt-BR': 'Guardar a conversa para que ela continue depois de recarregar a página ou voltar ao site.',
13
+ },
14
+ },
15
+ review: {
16
+ default: state,
17
+ label: { en: 'Human review', 'pt-BR': 'Revisão por pessoas' },
18
+ description: {
19
+ en: 'Keep the conversation, with contacts and documents anonymized, so our team can review it to improve the service.',
20
+ 'pt-BR': 'Guardar a conversa, com contatos e documentos anonimizados, para que a nossa equipe a revise e melhore o atendimento.',
21
+ },
22
+ },
23
+ analytics: {
24
+ default: state,
25
+ label: { en: 'Usage metrics', 'pt-BR': 'Métricas de uso' },
26
+ description: { en: 'Measure how the assistant is used.', 'pt-BR': 'Medir como o assistente é usado.' },
27
+ },
28
+ });
29
+ /** Brazil (LGPD): opt-in for every purpose. */
30
+ export const lgpd = {
31
+ id: 'lgpd',
32
+ label: { en: 'LGPD (Brazil)', 'pt-BR': 'LGPD (Brasil)' },
33
+ regions: ['BR'],
34
+ purposes: purposes('pending'),
35
+ };
36
+ /** European Economic Area, Switzerland and the United Kingdom (GDPR / ePrivacy): opt-in for every purpose. */
37
+ export const gdpr = {
38
+ id: 'gdpr',
39
+ label: 'GDPR',
40
+ // EU 27 + Iceland, Liechtenstein, Norway + Switzerland and the UK.
41
+ regions: [
42
+ 'AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU',
43
+ 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'IS', 'LI', 'NO', 'CH', 'GB',
44
+ ],
45
+ purposes: purposes('pending'),
46
+ };
47
+ /** California (CCPA/CPRA): allowed until the person opts out. */
48
+ export const ccpa = {
49
+ id: 'ccpa',
50
+ label: 'CCPA (California)',
51
+ regions: ['US-CA'],
52
+ purposes: purposes('granted'),
53
+ };
54
+ /** Anywhere else: opt-in for every purpose. Put it last as the fallback. */
55
+ export const optIn = {
56
+ id: 'opt-in',
57
+ label: { en: 'Ask first', 'pt-BR': 'Perguntar antes' },
58
+ regions: ['*'],
59
+ purposes: purposes('pending'),
60
+ };
61
+ /** LGPD, GDPR, CCPA and the opt-in fallback, in the order `selectConsentRules` expects. */
62
+ export const presets = [lgpd, gdpr, ccpa, optIn];
63
+ //# sourceMappingURL=presets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presets.js","sourceRoot":"","sources":["../src/presets.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,MAAM,QAAQ,GAAG,CAAC,KAAmB,EAAsC,EAAE,CAAC,CAAC;IAC7E,WAAW,EAAE;QACX,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,EAAE,EAAE,EAAE,wBAAwB,EAAE,OAAO,EAAE,uBAAuB,EAAE;QACzE,WAAW,EAAE;YACX,EAAE,EAAE,gEAAgE;YACpE,OAAO,EAAE,2FAA2F;SACrG;KACF;IACD,MAAM,EAAE;QACN,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,EAAE,EAAE,EAAE,cAAc,EAAE,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mBAAmB;IAC1B,OAAO,EAAE,CAAC,OAAO,CAAC;IAClB,QAAQ,EAAE,QAAQ,CAAC,SAAS,CAAC;CAC9B,CAAA;AAED,4EAA4E;AAC5E,MAAM,CAAC,MAAM,KAAK,GAAiB;IACjC,EAAE,EAAE,QAAQ;IACZ,KAAK,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,iBAAiB,EAAE;IACtD,OAAO,EAAE,CAAC,GAAG,CAAC;IACd,QAAQ,EAAE,QAAQ,CAAC,SAAS,CAAC;CAC9B,CAAA;AAED,2FAA2F;AAC3F,MAAM,CAAC,MAAM,OAAO,GAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAA"}
@@ -0,0 +1,57 @@
1
+ import { type Message, type Signal } from '@handsforbots/core';
2
+ /** Built-in detectors. Best effort: anonymize again on your server before people read the conversation. */
3
+ export declare const PATTERNS: {
4
+ email: RegExp;
5
+ /** Brazilian company id (CNPJ), with or without punctuation. */
6
+ cnpj: RegExp;
7
+ /** Brazilian personal id (CPF), with or without punctuation. */
8
+ cpf: RegExp;
9
+ /** Payment card numbers: 13 to 19 digits, optionally grouped. */
10
+ card: RegExp;
11
+ /** Phone numbers with 8+ digits, optional country and area codes. */
12
+ phone: RegExp;
13
+ };
14
+ export type PatternName = keyof typeof PATTERNS;
15
+ export type RedactOptions = {
16
+ /** Built-in detectors to use. Default: all (`email`, `cnpj`, `cpf`, `card`, `phone`). */
17
+ patterns?: PatternName[];
18
+ /** Your own detectors (e.g. an id format), applied after the built-in ones. Use the `g` flag. */
19
+ custom?: Record<string, RegExp>;
20
+ /** Replacement text. Default `[kind]`, e.g. `[email]`. */
21
+ replace?: (kind: string, match: string) => string;
22
+ /**
23
+ * What to do with media parts (photos, documents sent as files). `omit`
24
+ * (default) keeps only the type and name, as a `redacted_media` data part;
25
+ * `keep` leaves them untouched.
26
+ */
27
+ media?: 'omit' | 'keep';
28
+ };
29
+ /** Replaces contacts and documents found in `text`. */
30
+ export declare function redactText(text: string, options?: RedactOptions): string;
31
+ /** Anonymized copies of `messages`; the originals are not touched. */
32
+ export declare function redactMessages(messages: Message[], options?: RedactOptions): Message[];
33
+ /**
34
+ * An interceptor for `storage.before` (what is saved) or `request.before`
35
+ * (what goes to the assistant) that anonymizes messages and context signals.
36
+ */
37
+ export declare function redactor<T extends {
38
+ messages: Message[];
39
+ context?: Signal[];
40
+ }>(options?: RedactOptions): (value: T) => T;
41
+ export type RedactPluginOptions = RedactOptions & {
42
+ /**
43
+ * Where to anonymize. Default `['storage.before']`: what is stored (and,
44
+ * with `storage-backend`, what your reviewers read), never what is on screen.
45
+ * Add `request.before` to also hide it from the assistant.
46
+ */
47
+ hooks?: ('storage.before' | 'request.before')[];
48
+ /** Only while this consent purpose is granted (e.g. `review`). Default: always. */
49
+ when?: string;
50
+ };
51
+ /**
52
+ * Anonymizes contacts and documents before the conversation is stored:
53
+ *
54
+ * createH4B({ plugins: [storageBackend({ url }), redact({ when: 'review' })] })
55
+ */
56
+ export declare const redact: (config?: RedactPluginOptions | undefined) => import("@handsforbots/core").Plugin<RedactPluginOptions | undefined>;
57
+ //# sourceMappingURL=redact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redact.d.ts","sourceRoot":"","sources":["../src/redact.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,OAAO,EAAa,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAEnG,2GAA2G;AAC3G,eAAO,MAAM,QAAQ;;IAEnB,gEAAgE;;IAEhE,gEAAgE;;IAEhE,iEAAiE;;IAEjE,qEAAqE;;CAErC,CAAA;AAElC,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,QAAQ,CAAA;AAE/C,MAAM,MAAM,aAAa,GAAG;IAC1B,yFAAyF;IACzF,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAA;IACxB,iGAAiG;IACjG,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,0DAA0D;IAC1D,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IACjD;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACxB,CAAA;AAED,uDAAuD;AACvD,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,MAAM,CAS5E;AAoCD,sEAAsE;AACtE,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,GAAE,aAAkB,GAAG,OAAO,EAAE,CAoB1F;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS;IAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,EAAE,OAAO,GAAE,aAAkB,WAC1F,CAAC,KAAG,CAAC,CAKrB;AAED,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG;IAChD;;;;OAIG;IACH,KAAK,CAAC,EAAE,CAAC,gBAAgB,GAAG,gBAAgB,CAAC,EAAE,CAAA;IAC/C,mFAAmF;IACnF,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,MAAM,oHAajB,CAAA"}
package/dist/redact.js ADDED
@@ -0,0 +1,112 @@
1
+ import { definePlugin } from '@handsforbots/core';
2
+ /** Built-in detectors. Best effort: anonymize again on your server before people read the conversation. */
3
+ export const PATTERNS = {
4
+ email: /[\p{L}\p{N}._%+-]+@[\p{L}\p{N}.-]+\.[\p{L}]{2,}/gu,
5
+ /** Brazilian company id (CNPJ), with or without punctuation. */
6
+ cnpj: /(?<![\d.])\d{2}\.?\d{3}\.?\d{3}\/?\d{4}-?\d{2}(?![\d])/g,
7
+ /** Brazilian personal id (CPF), with or without punctuation. */
8
+ cpf: /(?<![\d.])\d{3}\.?\d{3}\.?\d{3}-?\d{2}(?![\d])/g,
9
+ /** Payment card numbers: 13 to 19 digits, optionally grouped. */
10
+ card: /(?<!\d)(?:\d[ -]?){12,18}\d(?!\d)/g,
11
+ /** Phone numbers with 8+ digits, optional country and area codes. */
12
+ phone: /(?<![\w@])(?:\+\d{1,3}[\s.-]?)?(?:\(\d{1,4}\)[\s.-]?|\d{2,4}[\s.-])?\d{4,5}[\s.-]?\d{4}(?!\w)/g,
13
+ };
14
+ /** Replaces contacts and documents found in `text`. */
15
+ export function redactText(text, options = {}) {
16
+ const replace = options.replace ?? ((kind) => `[${kind}]`);
17
+ const detectors = [
18
+ ...(options.patterns ?? Object.keys(PATTERNS)).map((name) => [name, PATTERNS[name]]),
19
+ ...Object.entries(options.custom ?? {}),
20
+ ];
21
+ let out = text;
22
+ for (const [kind, pattern] of detectors)
23
+ out = out.replace(pattern, (match) => replace(kind, match));
24
+ return out;
25
+ }
26
+ /** Deep copy of `value` with every string redacted. */
27
+ function redactValue(value, options) {
28
+ if (typeof value === 'string')
29
+ return redactText(value, options);
30
+ if (Array.isArray(value))
31
+ return value.map((v) => redactValue(v, options));
32
+ if (value && typeof value === 'object' && Object.getPrototypeOf(value) === Object.prototype) {
33
+ return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, redactValue(v, options)]));
34
+ }
35
+ return value;
36
+ }
37
+ function redactParts(parts, options) {
38
+ return parts.map((part) => {
39
+ // Citations are dropped: their positions do not fit the redacted text.
40
+ if (part.type === 'text')
41
+ return { type: 'text', text: redactText(part.text, options) };
42
+ if (part.type === 'data')
43
+ return { ...part, value: redactValue(part.value, options) };
44
+ if (part.type === 'source') {
45
+ return {
46
+ type: 'source',
47
+ id: part.id,
48
+ title: redactText(part.title, options),
49
+ ...(part.trail ? { trail: part.trail.map((t) => redactText(t, options)) } : {}),
50
+ ...(part.url === undefined ? {} : { url: redactText(part.url, options) }),
51
+ ...(part.excerpt === undefined ? {} : { excerpt: redactText(part.excerpt, options) }),
52
+ };
53
+ }
54
+ if (options.media === 'keep')
55
+ return part;
56
+ return {
57
+ type: 'data',
58
+ name: 'redacted_media',
59
+ value: { type: part.type, mimeType: part.mimeType, name: part.name === undefined ? undefined : redactText(part.name, options) },
60
+ };
61
+ });
62
+ }
63
+ /** Anonymized copies of `messages`; the originals are not touched. */
64
+ export function redactMessages(messages, options = {}) {
65
+ return messages.map((message) => {
66
+ if (message.role === 'tool') {
67
+ return {
68
+ ...message,
69
+ ...(message.result === undefined ? {} : { result: redactValue(message.result, options) }),
70
+ ...(message.error === undefined ? {} : { error: redactText(message.error, options) }),
71
+ };
72
+ }
73
+ if (message.role === 'assistant') {
74
+ return {
75
+ ...message,
76
+ parts: redactParts(message.parts, options),
77
+ ...(message.toolCalls
78
+ ? { toolCalls: message.toolCalls.map((call) => ({ ...call, args: redactValue(call.args, options) })) }
79
+ : {}),
80
+ };
81
+ }
82
+ return { ...message, parts: redactParts(message.parts, options) };
83
+ });
84
+ }
85
+ /**
86
+ * An interceptor for `storage.before` (what is saved) or `request.before`
87
+ * (what goes to the assistant) that anonymizes messages and context signals.
88
+ */
89
+ export function redactor(options = {}) {
90
+ return (value) => ({
91
+ ...value,
92
+ messages: redactMessages(value.messages, options),
93
+ ...(value.context ? { context: value.context.map((s) => ({ ...s, parts: redactParts(s.parts, options) })) } : {}),
94
+ });
95
+ }
96
+ /**
97
+ * Anonymizes contacts and documents before the conversation is stored:
98
+ *
99
+ * createH4B({ plugins: [storageBackend({ url }), redact({ when: 'review' })] })
100
+ */
101
+ export const redact = definePlugin({
102
+ name: 'redact',
103
+ apply(ctx, options = {}) {
104
+ const run = redactor(options);
105
+ for (const hook of options.hooks ?? ['storage.before']) {
106
+ ctx.intercept(hook, (value) => (options.when && !ctx.app.consent.granted(options.when) ? value : run(value)),
107
+ // Late, after other interceptors had their say.
108
+ 100);
109
+ }
110
+ },
111
+ });
112
+ //# sourceMappingURL=redact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redact.js","source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,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAClH,CAAC,CAAA;AACJ,CAAC;AAaD;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAkC;IAClE,IAAI,EAAE,QAAQ;IACd,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,EAAE;QACrB,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAA;QAC7B,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;YACvD,GAAG,CAAC,SAAS,CACX,IAAI,EACJ,CAAC,KAAyB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAU;YACrH,gDAAgD;YAChD,GAAG,CACJ,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,44 @@
1
1
  {
2
2
  "name": "@handsforbots/consent",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "2.0.0-alpha.0",
4
+ "description": "Consent rule sets (LGPD, GDPR, CCPA starting points), loaders for JSON/YAML rules, region helpers and anonymization for Hands for Bots.",
5
+ "license": "MIT",
6
+ "homepage": "https://github.com/handsforbots/handsforbots/blob/main/docs/en-us/plugins.md#consent",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/handsforbots/handsforbots.git",
10
+ "directory": "packages/consent"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/handsforbots/handsforbots/issues"
14
+ },
15
+ "type": "module",
16
+ "sideEffects": false,
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "import": "./dist/index.js"
21
+ },
22
+ "./rules/*": "./rules/*"
23
+ },
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "files": [
28
+ "dist",
29
+ "rules"
30
+ ],
31
+ "peerDependencies": {
32
+ "@handsforbots/core": "^2.0.0-alpha.0"
33
+ },
34
+ "devDependencies": {
35
+ "jsdom": "^27.0.0",
36
+ "@handsforbots/testkit": "^2.0.0-alpha.0",
37
+ "@handsforbots/core": "^2.0.0-alpha.0",
38
+ "@handsforbots/storage-local": "^2.0.0-alpha.0"
39
+ },
40
+ "scripts": {
41
+ "build": "tsc -p tsconfig.build.json",
42
+ "typecheck": "tsc -p tsconfig.json --noEmit"
43
+ }
6
44
  }
@@ -0,0 +1,42 @@
1
+ {
2
+ "id": "ccpa",
3
+ "label": "CCPA (California)",
4
+ "regions": [
5
+ "US-CA"
6
+ ],
7
+ "purposes": {
8
+ "persistence": {
9
+ "default": "granted",
10
+ "label": {
11
+ "en": "Keep this conversation",
12
+ "pt-BR": "Guardar esta conversa"
13
+ },
14
+ "description": {
15
+ "en": "Keep the conversation so it survives reloads and later visits.",
16
+ "pt-BR": "Guardar a conversa para que ela continue depois de recarregar a página ou voltar ao site."
17
+ }
18
+ },
19
+ "review": {
20
+ "default": "granted",
21
+ "label": {
22
+ "en": "Human review",
23
+ "pt-BR": "Revisão por pessoas"
24
+ },
25
+ "description": {
26
+ "en": "Keep the conversation, with contacts and documents anonymized, so our team can review it to improve the service.",
27
+ "pt-BR": "Guardar a conversa, com contatos e documentos anonimizados, para que a nossa equipe a revise e melhore o atendimento."
28
+ }
29
+ },
30
+ "analytics": {
31
+ "default": "granted",
32
+ "label": {
33
+ "en": "Usage metrics",
34
+ "pt-BR": "Métricas de uso"
35
+ },
36
+ "description": {
37
+ "en": "Measure how the assistant is used.",
38
+ "pt-BR": "Medir como o assistente é usado."
39
+ }
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,73 @@
1
+ {
2
+ "id": "gdpr",
3
+ "label": "GDPR",
4
+ "regions": [
5
+ "AT",
6
+ "BE",
7
+ "BG",
8
+ "HR",
9
+ "CY",
10
+ "CZ",
11
+ "DK",
12
+ "EE",
13
+ "FI",
14
+ "FR",
15
+ "DE",
16
+ "GR",
17
+ "HU",
18
+ "IE",
19
+ "IT",
20
+ "LV",
21
+ "LT",
22
+ "LU",
23
+ "MT",
24
+ "NL",
25
+ "PL",
26
+ "PT",
27
+ "RO",
28
+ "SK",
29
+ "SI",
30
+ "ES",
31
+ "SE",
32
+ "IS",
33
+ "LI",
34
+ "NO",
35
+ "CH",
36
+ "GB"
37
+ ],
38
+ "purposes": {
39
+ "persistence": {
40
+ "default": "pending",
41
+ "label": {
42
+ "en": "Keep this conversation",
43
+ "pt-BR": "Guardar esta conversa"
44
+ },
45
+ "description": {
46
+ "en": "Keep the conversation so it survives reloads and later visits.",
47
+ "pt-BR": "Guardar a conversa para que ela continue depois de recarregar a página ou voltar ao site."
48
+ }
49
+ },
50
+ "review": {
51
+ "default": "pending",
52
+ "label": {
53
+ "en": "Human review",
54
+ "pt-BR": "Revisão por pessoas"
55
+ },
56
+ "description": {
57
+ "en": "Keep the conversation, with contacts and documents anonymized, so our team can review it to improve the service.",
58
+ "pt-BR": "Guardar a conversa, com contatos e documentos anonimizados, para que a nossa equipe a revise e melhore o atendimento."
59
+ }
60
+ },
61
+ "analytics": {
62
+ "default": "pending",
63
+ "label": {
64
+ "en": "Usage metrics",
65
+ "pt-BR": "Métricas de uso"
66
+ },
67
+ "description": {
68
+ "en": "Measure how the assistant is used.",
69
+ "pt-BR": "Medir como o assistente é usado."
70
+ }
71
+ }
72
+ }
73
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "id": "lgpd",
3
+ "label": {
4
+ "en": "LGPD (Brazil)",
5
+ "pt-BR": "LGPD (Brasil)"
6
+ },
7
+ "regions": [
8
+ "BR"
9
+ ],
10
+ "purposes": {
11
+ "persistence": {
12
+ "default": "pending",
13
+ "label": {
14
+ "en": "Keep this conversation",
15
+ "pt-BR": "Guardar esta conversa"
16
+ },
17
+ "description": {
18
+ "en": "Keep the conversation so it survives reloads and later visits.",
19
+ "pt-BR": "Guardar a conversa para que ela continue depois de recarregar a página ou voltar ao site."
20
+ }
21
+ },
22
+ "review": {
23
+ "default": "pending",
24
+ "label": {
25
+ "en": "Human review",
26
+ "pt-BR": "Revisão por pessoas"
27
+ },
28
+ "description": {
29
+ "en": "Keep the conversation, with contacts and documents anonymized, so our team can review it to improve the service.",
30
+ "pt-BR": "Guardar a conversa, com contatos e documentos anonimizados, para que a nossa equipe a revise e melhore o atendimento."
31
+ }
32
+ },
33
+ "analytics": {
34
+ "default": "pending",
35
+ "label": {
36
+ "en": "Usage metrics",
37
+ "pt-BR": "Métricas de uso"
38
+ },
39
+ "description": {
40
+ "en": "Measure how the assistant is used.",
41
+ "pt-BR": "Medir como o assistente é usado."
42
+ }
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "id": "opt-in",
3
+ "label": {
4
+ "en": "Ask first",
5
+ "pt-BR": "Perguntar antes"
6
+ },
7
+ "regions": [
8
+ "*"
9
+ ],
10
+ "purposes": {
11
+ "persistence": {
12
+ "default": "pending",
13
+ "label": {
14
+ "en": "Keep this conversation",
15
+ "pt-BR": "Guardar esta conversa"
16
+ },
17
+ "description": {
18
+ "en": "Keep the conversation so it survives reloads and later visits.",
19
+ "pt-BR": "Guardar a conversa para que ela continue depois de recarregar a página ou voltar ao site."
20
+ }
21
+ },
22
+ "review": {
23
+ "default": "pending",
24
+ "label": {
25
+ "en": "Human review",
26
+ "pt-BR": "Revisão por pessoas"
27
+ },
28
+ "description": {
29
+ "en": "Keep the conversation, with contacts and documents anonymized, so our team can review it to improve the service.",
30
+ "pt-BR": "Guardar a conversa, com contatos e documentos anonimizados, para que a nossa equipe a revise e melhore o atendimento."
31
+ }
32
+ },
33
+ "analytics": {
34
+ "default": "pending",
35
+ "label": {
36
+ "en": "Usage metrics",
37
+ "pt-BR": "Métricas de uso"
38
+ },
39
+ "description": {
40
+ "en": "Measure how the assistant is used.",
41
+ "pt-BR": "Medir como o assistente é usado."
42
+ }
43
+ }
44
+ }
45
+ }