deepline 0.3.87 → 0.3.88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +2 -2
  2. package/dist/bundling-sources/sdk/src/monitor-fleet-contract.ts +1 -1
  3. package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +1 -1
  4. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  5. package/dist/bundling-sources/shared_libs/monitors/org-monitor-limits.ts +1 -1
  6. package/dist/bundling-sources/shared_libs/play-runtime/runtime-env.ts +0 -6
  7. package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +1 -1
  8. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +1 -1
  9. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +0 -302
  10. package/dist/bundling-sources/shared_libs/plays/email-status.ts +1 -1
  11. package/dist/bundling-sources/shared_libs/plays/tool-category-descriptions.ts +2 -2
  12. package/dist/bundling-sources/shared_libs/runtime-env.ts +0 -6
  13. package/dist/cli/index.js +4 -6
  14. package/dist/cli/index.mjs +4 -6
  15. package/dist/index.d.mts +1 -1
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.js +3 -3
  18. package/dist/index.mjs +3 -3
  19. package/dist/install-integrity.json +2 -45
  20. package/package.json +1 -3
  21. package/dist/bundling-sources/shared_libs/integration-contracts/AGENTS.md +0 -9
  22. package/dist/bundling-sources/shared_libs/integration-contracts/README.md +0 -3
  23. package/dist/bundling-sources/shared_libs/integration-contracts/index.ts +0 -2
  24. package/dist/bundling-sources/shared_libs/monitors/analytics-install-guides.ts +0 -77
  25. package/dist/bundling-sources/shared_libs/monitors/billing/charges.ts +0 -125
  26. package/dist/bundling-sources/shared_libs/monitors/billing/policy-builders.ts +0 -686
  27. package/dist/bundling-sources/shared_libs/monitors/billing/pricing.ts +0 -54
  28. package/dist/bundling-sources/shared_libs/monitors/billing/public-pricing.ts +0 -72
  29. package/dist/bundling-sources/shared_libs/monitors/billing/session.ts +0 -45
  30. package/dist/bundling-sources/shared_libs/monitors/billing/state.ts +0 -454
  31. package/dist/bundling-sources/shared_libs/monitors/billing/tamradar.ts +0 -260
  32. package/dist/bundling-sources/shared_libs/monitors/billing/types.ts +0 -215
  33. package/dist/bundling-sources/shared_libs/monitors/callback-security.ts +0 -333
  34. package/dist/bundling-sources/shared_libs/monitors/cursor-page.ts +0 -42
  35. package/dist/bundling-sources/shared_libs/monitors/framework-managed-payload-fields.ts +0 -71
  36. package/dist/bundling-sources/shared_libs/monitors/generated/provider-monitor-callback-admission-targets.ts +0 -16
  37. package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +0 -267
  38. package/dist/bundling-sources/shared_libs/monitors/inbound-publish-key.ts +0 -39
  39. package/dist/bundling-sources/shared_libs/monitors/inbound-queue.ts +0 -82
  40. package/dist/bundling-sources/shared_libs/monitors/lifecycle-notifications.ts +0 -473
  41. package/dist/bundling-sources/shared_libs/monitors/package.json +0 -29
  42. package/dist/bundling-sources/shared_libs/monitors/provider-callback-verification.ts +0 -1125
  43. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-capability.ts +0 -964
  44. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-consumer-health.ts +0 -56
  45. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-errors.ts +0 -131
  46. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-identity-claims.ts +0 -527
  47. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-legacy-aliases.ts +0 -16
  48. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-priority-execution.ts +0 -56
  49. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-public-aliases.ts +0 -28
  50. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-runtime-read-eligibility.ts +0 -38
  51. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-status.ts +0 -10
  52. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-upstream-identity.ts +0 -112
  53. package/dist/bundling-sources/shared_libs/monitors/provider-webhook-monitor-runtime.ts +0 -300
  54. package/dist/bundling-sources/shared_libs/monitors/quickstart-prompts.ts +0 -22
  55. package/dist/bundling-sources/shared_libs/monitors/snitcher-install-validation.ts +0 -93
  56. package/dist/bundling-sources/shared_libs/monitors/snitcher-ip2company.ts +0 -332
  57. package/dist/bundling-sources/shared_libs/monitors/snitcher-radar.ts +0 -221
  58. package/dist/bundling-sources/shared_libs/monitors/starter-templates.ts +0 -105
  59. package/dist/bundling-sources/shared_libs/monitors/tracking-provider-guidance.ts +0 -73
  60. package/dist/bundling-sources/shared_libs/monitors/tracking-provider-integrations.ts +0 -81
  61. package/dist/bundling-sources/shared_libs/monitors/tsconfig.json +0 -10
  62. package/dist/bundling-sources/shared_libs/security/header-safe-env.ts +0 -28
  63. package/dist/bundling-sources/shared_libs/security/secret-redaction.ts +0 -267
  64. /package/dist/bundling-sources/shared_libs/{integration-contracts/bettercontact/execution-policy.ts → integrations/bettercontact-execution-policy.ts} +0 -0
  65. /package/dist/bundling-sources/shared_libs/{integration-contracts/theirstack/execution-policy.ts → integrations/theirstack-execution-policy.ts} +0 -0
@@ -1,73 +0,0 @@
1
- import type { ProviderMonitorPostDeployGuidance } from '@deepline/monitors/provider-monitor-capability';
2
-
3
- // Client-safe provider setup metadata. Provider monitor definitions reference
4
- // these exact objects, while the integrations dialog reads them directly.
5
- export const VECTOR_POST_DEPLOY_GUIDANCE = {
6
- title: 'Connect Vector to this monitor',
7
- steps: [
8
- 'In Vector, open the segment named in this monitor setup.',
9
- 'Add a webhook endpoint using {{callback_url}}, then select contact.visited.',
10
- 'Enable the webhook action on the segment and send a Vector test event.',
11
- ],
12
- event_type: 'contact.visited',
13
- documentation: [
14
- {
15
- label: 'Vector SiteID action integration guide',
16
- url: 'https://learn.vector.co/articles/2260541690-building-an-action-integration-for-siteid',
17
- },
18
- ],
19
- payload_example: {
20
- type: 'contact.visited',
21
- externalId: 'contact_123',
22
- companyDomain: 'example.com',
23
- },
24
- } as const satisfies ProviderMonitorPostDeployGuidance;
25
-
26
- export const RB2B_POST_DEPLOY_GUIDANCE = {
27
- title: 'Connect RB2B to this monitor',
28
- steps: [
29
- 'In RB2B, open Integrations and choose Webhook.',
30
- 'Paste {{callback_url}} as the single webhook URL and save.',
31
- "Use RB2B's Send a Test Event action to verify the connection.",
32
- ],
33
- documentation: [
34
- {
35
- label: 'RB2B webhook setup guide',
36
- url: 'https://support.rb2b.com/en/articles/8976614-setup-guide-webhook',
37
- },
38
- ],
39
- payload_example: {
40
- 'LinkedIn URL': 'https://www.linkedin.com/in/example',
41
- Website: 'https://example.com',
42
- },
43
- } as const satisfies ProviderMonitorPostDeployGuidance;
44
-
45
- export const SNITCHER_POST_DEPLOY_GUIDANCE = {
46
- title: 'Install Deepline Analytics',
47
- steps: [
48
- 'Create the tracker code in Deepline, then paste it in your site’s document head.',
49
- 'Confirm cookie consent before persistent tracking when your privacy policy requires it.',
50
- ],
51
- documentation: [
52
- {
53
- label: 'Deepline Analytics setup guide',
54
- url: 'https://docs.snitcher.com/powered-by-snitcher/radar/installation',
55
- },
56
- ],
57
- payload_example: {
58
- session_uuid: '00000000-0000-4000-8000-000000000001',
59
- start_time: '2026-01-01T00:00:00.000Z',
60
- last_activity: '2026-01-01T00:01:00.000Z',
61
- engagement_time: 60,
62
- user_properties: { $uuid: 'deepline-test-visitor' },
63
- events: [
64
- { event_name: '$pageview', created_at: '2026-01-01T00:00:00.000Z' },
65
- ],
66
- },
67
- } as const satisfies ProviderMonitorPostDeployGuidance;
68
-
69
- export const TRACKING_PROVIDER_POST_DEPLOY_GUIDANCE = {
70
- vector: VECTOR_POST_DEPLOY_GUIDANCE,
71
- rb2b: RB2B_POST_DEPLOY_GUIDANCE,
72
- snitcher: SNITCHER_POST_DEPLOY_GUIDANCE,
73
- } as const;
@@ -1,81 +0,0 @@
1
- import { TRACKING_PROVIDER_POST_DEPLOY_GUIDANCE } from '@deepline/monitors/tracking-provider-guidance';
2
- import {
3
- ANALYTICS_INTEGRATION_SLUG,
4
- ANALYTICS_PUBLIC_TOOL,
5
- } from '@/lib/analytics/public';
6
-
7
- export const TRACKING_PROVIDER_INTEGRATIONS = {
8
- vector: {
9
- provider: 'vector',
10
- displayName: 'Vector',
11
- tool: 'vector.visitor_events',
12
- monitorKey: 'vector-high-intent-visitors',
13
- },
14
- rb2b: {
15
- provider: 'rb2b',
16
- displayName: 'RB2B',
17
- tool: 'rb2b.visitor_events',
18
- monitorKey: 'rb2b-website-visitors',
19
- },
20
- [ANALYTICS_INTEGRATION_SLUG]: {
21
- provider: 'snitcher',
22
- displayName: 'Deepline Analytics',
23
- // Used only by the server-side monitor adapter to resolve upstream wiring.
24
- tool: 'snitcher.website_sessions',
25
- publicTool: ANALYTICS_PUBLIC_TOOL,
26
- monitorKey: 'snitcher-website-sessions',
27
- },
28
- } as const;
29
-
30
- export type TrackingProviderIntegration =
31
- (typeof TRACKING_PROVIDER_INTEGRATIONS)[keyof typeof TRACKING_PROVIDER_INTEGRATIONS] & {
32
- docsUrl: string;
33
- docsLabel: string;
34
- };
35
-
36
- export function getTrackingProviderIntegration(
37
- provider: string,
38
- ): TrackingProviderIntegration | null {
39
- const integration =
40
- TRACKING_PROVIDER_INTEGRATIONS[
41
- provider as keyof typeof TRACKING_PROVIDER_INTEGRATIONS
42
- ];
43
- if (!integration) return null;
44
- const docs =
45
- TRACKING_PROVIDER_POST_DEPLOY_GUIDANCE[
46
- integration.provider as keyof typeof TRACKING_PROVIDER_POST_DEPLOY_GUIDANCE
47
- ]?.documentation[0];
48
- if (!docs) return null;
49
- return { ...integration, docsUrl: docs.url, docsLabel: docs.label };
50
- }
51
-
52
- export function trackingProviderWebhookSetup(
53
- provider: string,
54
- webhookEndpoint: string,
55
- ): {
56
- webhook_endpoint: string;
57
- event_type?: 'contact.visited';
58
- instructions: string[];
59
- } | null {
60
- const integration = getTrackingProviderIntegration(
61
- provider === 'snitcher' ? ANALYTICS_INTEGRATION_SLUG : provider,
62
- );
63
- const guidance = integration
64
- ? TRACKING_PROVIDER_POST_DEPLOY_GUIDANCE[
65
- integration.provider as keyof typeof TRACKING_PROVIDER_POST_DEPLOY_GUIDANCE
66
- ]
67
- : null;
68
- if (!guidance) return null;
69
- return {
70
- webhook_endpoint: webhookEndpoint,
71
- ...('event_type' in guidance && guidance.event_type === 'contact.visited'
72
- ? { event_type: guidance.event_type }
73
- : {}),
74
- // The dialog shows the URL in a dedicated copy target, so retain its
75
- // compact `webhook_endpoint` wording while deriving every step from the
76
- // same metadata used by CLI/API guidance.
77
- instructions: guidance.steps.map((step) =>
78
- step.replaceAll('{{callback_url}}', 'webhook_endpoint'),
79
- ),
80
- };
81
- }
@@ -1,10 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "incremental": false,
5
- "noEmit": true,
6
- "types": ["node"]
7
- },
8
- "include": ["./**/*.ts"],
9
- "exclude": ["node_modules"]
10
- }
@@ -1,28 +0,0 @@
1
- /**
2
- * Guards for env-derived secrets that are sent as HTTP header values.
3
- *
4
- * fetch() validates header values and may echo invalid raw values in its
5
- * error. Validate secrets before constructing headers so failures identify
6
- * the environment variable without leaking its contents.
7
- */
8
-
9
- const HEADER_UNSAFE_CHAR_PATTERN = /[^\t\u0020-\u007e\u0080-\u00ff]/;
10
-
11
- export function isHeaderSafeValue(value: string): boolean {
12
- return !HEADER_UNSAFE_CHAR_PATTERN.test(value);
13
- }
14
-
15
- export function assertHeaderSafeEnvValue(input: {
16
- envVar: string;
17
- value: string;
18
- }): string {
19
- if (!isHeaderSafeValue(input.value)) {
20
- throw new Error(
21
- `Environment variable ${input.envVar} contains a character that is invalid in an HTTP header value ` +
22
- `(typically an embedded newline from a multi-line paste). ` +
23
- `Re-set ${input.envVar} as a single-line value. ` +
24
- `The raw value is not echoed to avoid leaking a secret.`,
25
- );
26
- }
27
- return input.value;
28
- }
@@ -1,267 +0,0 @@
1
- const REDACTED_VALUE = '[REDACTED]';
2
-
3
- type SecretRedactionOptions = {
4
- redactHighEntropy?: boolean;
5
- };
6
-
7
- const SENSITIVE_KEY_PATTERNS = [
8
- /^api[-_]?key$/i,
9
- /^x[-_]?api[-_]?key$/i,
10
- /secret/i,
11
- /token/i,
12
- /password/i,
13
- /authorization/i,
14
- /cookie/i,
15
- /credential/i,
16
- /private/i,
17
- ];
18
-
19
- const SAFE_IDENTIFIER_KEYS = new Set([
20
- 'artifactHash',
21
- 'artifactHashes',
22
- 'artifact_hash',
23
- 'artifact_hashes',
24
- 'graphHash',
25
- 'graph_hash',
26
- 'hash',
27
- 'idempotencyKey',
28
- 'idempotency_key',
29
- 'key',
30
- 'session',
31
- 'sessionId',
32
- 'session_id',
33
- 'sessionIds',
34
- 'session_ids',
35
- 'promptId',
36
- 'prompt_id',
37
- 'requestId',
38
- 'request_id',
39
- 'upload_id',
40
- // Durable-call runtime identity fields. These are non-secret
41
- // `ctx:<org>:call:tool:<tool>:<hash>` receipt/idempotency keys (and their
42
- // `:force:<lease>` / `:ordered:<hash>` variants) surfaced on tool-result
43
- // `_metadata.execution` and echoed provider idempotency metadata.
44
- // Explicit-secret patterns below still redact real secrets that ever appear
45
- // under these keys.
46
- 'receiptKey',
47
- 'receipt_key',
48
- 'attachedToReceiptKey',
49
- 'attached_to_receipt_key',
50
- 'durableCallReceiptKey',
51
- 'durable_call_receipt_key',
52
- 'providerIdempotencyKey',
53
- 'provider_idempotency_key',
54
- 'cacheKey',
55
- 'cache_key',
56
- // Non-secret run-output identifiers.
57
- 'targetTable',
58
- 'target_table',
59
- 'tableNamespace',
60
- 'table_namespace',
61
- 'queryId',
62
- 'query_id',
63
- 'queryIds',
64
- 'query_ids',
65
- 'snowflakeQueryId',
66
- 'snowflake_query_id',
67
- 'snowflakeQueryIds',
68
- 'snowflake_query_ids',
69
- ]);
70
-
71
- const EXPLICIT_SECRET_VALUE_PATTERNS = [
72
- /\bnapi_[a-z0-9]{20,}\b/i,
73
- /\bgh[opsu]_[A-Za-z0-9_]{20,}\b/,
74
- /\bwhsec_[a-z0-9]+\b/i,
75
- /\bsk-proj-[A-Za-z0-9_-]{20,}\b/,
76
- /\bxox[baprs]-[A-Za-z0-9-]{20,}\b/i,
77
- /\b(sk|rk)_(live|test)_[a-z0-9]+\b/i,
78
- /\bpostgres(?:ql)?:\/\/[^\s'"]+/i,
79
- /\bhttps?:\/\/[^/\s'"]+:[^@\s'"]+@[^/\s'"]+/i,
80
- ];
81
-
82
- const HIGH_ENTROPY_VALUE_PATTERN = /\b[A-Za-z0-9+/=_-]{32,}\b/g;
83
- // A public hostname can legitimately contain a generated label longer than the
84
- // high-entropy threshold (for example, a per-run probe hostname). Preserve the
85
- // complete hostname after known secret formats have already been checked.
86
- const PUBLIC_DNS_NAME_PATTERN =
87
- /^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}\.?$/i;
88
- const SENSITIVE_URL_PARAM_KEY_PATTERN =
89
- /(?:api[-_]?key|x[-_]?api[-_]?key|token|access[-_]?token|refresh[-_]?token|secret|password|authorization|credential|signature|sig)/i;
90
- const BEARER_SECRET_PATTERN = /\b(Bearer)\s+[A-Za-z0-9._~+/=-]{8,}/gi;
91
- const ASSIGNMENT_SECRET_PATTERN =
92
- /\b(access[-_]?token|refresh[-_]?token|token|x[-_\s]?api[-_\s]?key|api[-_\s]?key|apikey|password|secret|session)\b(\s*[:=]\s*)[^\s'",;)}\]]+/gi;
93
- const AUTH_ASSIGNMENT_SECRET_PATTERN =
94
- /\b(auth(?:orization)?)\b(\s*[:=]\s*)(?!Bearer\b)(?:[A-Za-z]+\s+)?[^\s'",;)}\]]+/gi;
95
- const SENSITIVE_URL_PARAM_VALUE_PATTERN =
96
- /([?&#](?:api[-_]?key|x[-_]?api[-_]?key|token|access[-_]?token|refresh[-_]?token|secret|password|authorization|credential|signature|sig)=)[^&#\s'"]+/gi;
97
-
98
- function inspectStandalonePublicHttpUrl(
99
- value: string,
100
- ): 'safe' | 'sensitive' | null {
101
- const trimmed = value.trim();
102
- if (!trimmed || /\s/.test(trimmed)) {
103
- return null;
104
- }
105
-
106
- let url: URL;
107
- try {
108
- url = new URL(trimmed);
109
- } catch {
110
- return null;
111
- }
112
-
113
- if (url.protocol !== 'http:' && url.protocol !== 'https:') {
114
- return null;
115
- }
116
- if (url.username || url.password) {
117
- return 'sensitive';
118
- }
119
-
120
- for (const key of url.searchParams.keys()) {
121
- if (SENSITIVE_URL_PARAM_KEY_PATTERN.test(key)) {
122
- return 'sensitive';
123
- }
124
- }
125
- if (url.hash && SENSITIVE_URL_PARAM_KEY_PATTERN.test(url.hash)) {
126
- return 'sensitive';
127
- }
128
- return 'safe';
129
- }
130
-
131
- function shouldRedactKey(key: string) {
132
- if (SAFE_IDENTIFIER_KEYS.has(key)) {
133
- return false;
134
- }
135
- return SENSITIVE_KEY_PATTERNS.some((pattern) => pattern.test(key));
136
- }
137
-
138
- function maybeRedactString(value: string, options: SecretRedactionOptions) {
139
- if (EXPLICIT_SECRET_VALUE_PATTERNS.some((pattern) => pattern.test(value))) {
140
- return REDACTED_VALUE;
141
- }
142
- const publicHttpUrl = inspectStandalonePublicHttpUrl(value);
143
- if (publicHttpUrl === 'sensitive') {
144
- return REDACTED_VALUE;
145
- }
146
- if (publicHttpUrl === 'safe') {
147
- return value;
148
- }
149
- if (PUBLIC_DNS_NAME_PATTERN.test(value.trim())) {
150
- return value;
151
- }
152
- const redacted = value
153
- .replace(BEARER_SECRET_PATTERN, `$1 ${REDACTED_VALUE}`)
154
- .replace(AUTH_ASSIGNMENT_SECRET_PATTERN, `$1$2${REDACTED_VALUE}`)
155
- .replace(ASSIGNMENT_SECRET_PATTERN, `$1$2${REDACTED_VALUE}`)
156
- .replace(SENSITIVE_URL_PARAM_VALUE_PATTERN, `$1${REDACTED_VALUE}`);
157
- return options.redactHighEntropy === false
158
- ? redacted
159
- : redacted.replace(HIGH_ENTROPY_VALUE_PATTERN, REDACTED_VALUE);
160
- }
161
-
162
- export function redactSecretsInValue<T>(
163
- value: T,
164
- parentKey?: string,
165
- options: SecretRedactionOptions = {},
166
- ): T {
167
- if (typeof value === 'string') {
168
- if (EXPLICIT_SECRET_VALUE_PATTERNS.some((pattern) => pattern.test(value))) {
169
- return REDACTED_VALUE as T;
170
- }
171
- if (parentKey && SAFE_IDENTIFIER_KEYS.has(parentKey)) {
172
- return value as T;
173
- }
174
- if (parentKey && shouldRedactKey(parentKey)) {
175
- return REDACTED_VALUE as T;
176
- }
177
- return maybeRedactString(value, options) as T;
178
- }
179
-
180
- if (!value || typeof value !== 'object') return value;
181
-
182
- type Container = unknown[] | Record<string, unknown>;
183
- const root: Container = Array.isArray(value) ? [] : {};
184
- const pending: Array<{
185
- source: Container;
186
- target: Container;
187
- parentKey?: string;
188
- }> = [{ source: value as Container, target: root, parentKey }];
189
-
190
- const redactNestedValue = (
191
- item: unknown,
192
- itemParentKey: string | undefined,
193
- ): unknown => {
194
- if (typeof item !== 'string') return item;
195
- if (EXPLICIT_SECRET_VALUE_PATTERNS.some((pattern) => pattern.test(item))) {
196
- return REDACTED_VALUE;
197
- }
198
- if (itemParentKey && SAFE_IDENTIFIER_KEYS.has(itemParentKey)) return item;
199
- if (itemParentKey && shouldRedactKey(itemParentKey)) return REDACTED_VALUE;
200
- return maybeRedactString(item, options);
201
- };
202
-
203
- while (pending.length > 0) {
204
- const current = pending.pop();
205
- if (!current) break;
206
- const sourceIsArray = Array.isArray(current.source);
207
- for (const [key, item] of Object.entries(current.source)) {
208
- const itemParentKey = sourceIsArray ? current.parentKey : key;
209
- if (!sourceIsArray && shouldRedactKey(key)) {
210
- (current.target as Record<string, unknown>)[key] = REDACTED_VALUE;
211
- continue;
212
- }
213
- if (item && typeof item === 'object') {
214
- const nestedTarget: Container = Array.isArray(item) ? [] : {};
215
- (current.target as Record<string, unknown>)[key] = nestedTarget;
216
- pending.push({
217
- source: item as Container,
218
- target: nestedTarget,
219
- parentKey: itemParentKey,
220
- });
221
- continue;
222
- }
223
- (current.target as Record<string, unknown>)[key] = redactNestedValue(
224
- item,
225
- itemParentKey,
226
- );
227
- }
228
- }
229
-
230
- return root as T;
231
- }
232
-
233
- /**
234
- * Redaction for customer-authored inputs and outputs. Preserve arbitrary
235
- * identifiers while still removing explicit credential formats, sensitive
236
- * keys, authorization values, and credential-bearing URLs.
237
- */
238
- export function redactSecretsInCustomerValue<T>(
239
- value: T,
240
- parentKey?: string,
241
- ): T {
242
- return redactSecretsInValue(value, parentKey, { redactHighEntropy: false });
243
- }
244
-
245
- export function redactSecretsInJsonText(
246
- text: string,
247
- options: SecretRedactionOptions = {},
248
- ) {
249
- try {
250
- const parsed = JSON.parse(text) as unknown;
251
- return JSON.stringify(
252
- redactSecretsInValue(parsed, undefined, options),
253
- null,
254
- 2,
255
- );
256
- } catch {
257
- let redacted = text;
258
- for (const pattern of EXPLICIT_SECRET_VALUE_PATTERNS) {
259
- redacted = redacted.replace(pattern, REDACTED_VALUE);
260
- }
261
- return maybeRedactString(redacted, options);
262
- }
263
- }
264
-
265
- export function redactSecretsInCustomerJsonText(text: string) {
266
- return redactSecretsInJsonText(text, { redactHighEntropy: false });
267
- }