deepline 0.3.86 → 0.3.87

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/integration-contracts/AGENTS.md +9 -0
  6. package/dist/bundling-sources/shared_libs/integration-contracts/README.md +3 -0
  7. package/dist/bundling-sources/shared_libs/integration-contracts/index.ts +2 -0
  8. package/dist/bundling-sources/shared_libs/monitors/analytics-install-guides.ts +77 -0
  9. package/dist/bundling-sources/shared_libs/monitors/billing/charges.ts +125 -0
  10. package/dist/bundling-sources/shared_libs/monitors/billing/policy-builders.ts +686 -0
  11. package/dist/bundling-sources/shared_libs/monitors/billing/pricing.ts +54 -0
  12. package/dist/bundling-sources/shared_libs/monitors/billing/public-pricing.ts +72 -0
  13. package/dist/bundling-sources/shared_libs/monitors/billing/session.ts +45 -0
  14. package/dist/bundling-sources/shared_libs/monitors/billing/state.ts +454 -0
  15. package/dist/bundling-sources/shared_libs/monitors/billing/tamradar.ts +260 -0
  16. package/dist/bundling-sources/shared_libs/monitors/billing/types.ts +215 -0
  17. package/dist/bundling-sources/shared_libs/monitors/callback-security.ts +333 -0
  18. package/dist/bundling-sources/shared_libs/monitors/cursor-page.ts +42 -0
  19. package/dist/bundling-sources/shared_libs/monitors/framework-managed-payload-fields.ts +71 -0
  20. package/dist/bundling-sources/shared_libs/monitors/generated/provider-monitor-callback-admission-targets.ts +16 -0
  21. package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +267 -0
  22. package/dist/bundling-sources/shared_libs/monitors/inbound-publish-key.ts +39 -0
  23. package/dist/bundling-sources/shared_libs/monitors/inbound-queue.ts +82 -0
  24. package/dist/bundling-sources/shared_libs/monitors/lifecycle-notifications.ts +473 -0
  25. package/dist/bundling-sources/shared_libs/monitors/org-monitor-limits.ts +1 -1
  26. package/dist/bundling-sources/shared_libs/monitors/package.json +29 -0
  27. package/dist/bundling-sources/shared_libs/monitors/provider-callback-verification.ts +1125 -0
  28. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-capability.ts +964 -0
  29. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-consumer-health.ts +56 -0
  30. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-errors.ts +131 -0
  31. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-identity-claims.ts +527 -0
  32. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-legacy-aliases.ts +16 -0
  33. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-priority-execution.ts +56 -0
  34. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-public-aliases.ts +28 -0
  35. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-runtime-read-eligibility.ts +38 -0
  36. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-status.ts +10 -0
  37. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-upstream-identity.ts +112 -0
  38. package/dist/bundling-sources/shared_libs/monitors/provider-webhook-monitor-runtime.ts +300 -0
  39. package/dist/bundling-sources/shared_libs/monitors/quickstart-prompts.ts +22 -0
  40. package/dist/bundling-sources/shared_libs/monitors/snitcher-install-validation.ts +93 -0
  41. package/dist/bundling-sources/shared_libs/monitors/snitcher-ip2company.ts +332 -0
  42. package/dist/bundling-sources/shared_libs/monitors/snitcher-radar.ts +221 -0
  43. package/dist/bundling-sources/shared_libs/monitors/starter-templates.ts +105 -0
  44. package/dist/bundling-sources/shared_libs/monitors/tracking-provider-guidance.ts +73 -0
  45. package/dist/bundling-sources/shared_libs/monitors/tracking-provider-integrations.ts +81 -0
  46. package/dist/bundling-sources/shared_libs/monitors/tsconfig.json +10 -0
  47. package/dist/bundling-sources/shared_libs/play-runtime/runtime-env.ts +6 -0
  48. package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +1 -1
  49. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +1 -1
  50. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +302 -0
  51. package/dist/bundling-sources/shared_libs/plays/email-status.ts +1 -1
  52. package/dist/bundling-sources/shared_libs/plays/tool-category-descriptions.ts +2 -2
  53. package/dist/bundling-sources/shared_libs/runtime-env.ts +6 -0
  54. package/dist/bundling-sources/shared_libs/security/header-safe-env.ts +28 -0
  55. package/dist/bundling-sources/shared_libs/security/secret-redaction.ts +267 -0
  56. package/dist/cli/index.js +6 -4
  57. package/dist/cli/index.mjs +6 -4
  58. package/dist/index.d.mts +1 -1
  59. package/dist/index.d.ts +1 -1
  60. package/dist/index.js +3 -3
  61. package/dist/index.mjs +3 -3
  62. package/dist/install-integrity.json +45 -2
  63. package/package.json +3 -1
  64. /package/dist/bundling-sources/shared_libs/{integrations/bettercontact-execution-policy.ts → integration-contracts/bettercontact/execution-policy.ts} +0 -0
  65. /package/dist/bundling-sources/shared_libs/{integrations/theirstack-execution-policy.ts → integration-contracts/theirstack/execution-policy.ts} +0 -0
@@ -88,11 +88,11 @@ import type { PlayStagedFileRef } from './plays/local-file-discovery.js';
88
88
  import type { PlayCompilerManifest } from '../../shared_libs/plays/compiler-manifest.js';
89
89
  import type { EnrichCompiledConfig } from './cli/enrich-play-compiler.js';
90
90
  import { RUNTIME_ENVIRONMENT_TOKEN_HEADER } from '../../shared_libs/play-runtime/coordinator-headers.js';
91
- import { resolveTheirstackClientTimeoutMs } from '../../shared_libs/integrations/theirstack-execution-policy.js';
91
+ import { resolveTheirstackClientTimeoutMs } from '../../shared_libs/integration-contracts/theirstack/execution-policy.js';
92
92
  import {
93
93
  BETTERCONTACT_LAUNCHER_CLIENT_TIMEOUT_MS,
94
94
  usesExtendedBetterContactLauncherBudget,
95
- } from '../../shared_libs/integrations/bettercontact-execution-policy.js';
95
+ } from '../../shared_libs/integration-contracts/bettercontact/execution-policy.js';
96
96
  import {
97
97
  normalizePlayRuntimeEnvironment,
98
98
  normalizePlayRuntimeNamespace,
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The fleet member ceiling, mirrored — deliberately a literal.
3
3
  *
4
- * The canonical declaration is shared_libs/monitors/monitor-fleet-limits.ts,
4
+ * The canonical declaration is packages/monitors/monitor-fleet-limits.ts,
5
5
  * which the Convex commit mutation reads to size its transaction. This package
6
6
  * cannot import it: the workspace-architecture ratchet forbids NEW shared_libs
7
7
  * imports from packages absolutely (only relocations of pre-existing edges
@@ -84,7 +84,7 @@ let hasWarnedAboutNonDevelopmentBundling = false;
84
84
  * The SDK's job is to turn a local play file into a portable artifact using
85
85
  * only SDK/runtime sources. It must work for installed packages, source
86
86
  * checkouts, CI smoke jobs, and clean worktrees without app-generated files
87
- * such as `src/lib/generated/tool-typecheck-catalog.jsonl`.
87
+ * such as `packages/integrations/generated/tool-typecheck-catalog.jsonl`.
88
88
  *
89
89
  * Tool-aware validation belongs to the Deepline API after upload:
90
90
  * `compilePlayManifest` / server preflight runs the cloud typechecker inside
@@ -199,7 +199,7 @@ export const SDK_RELEASE = {
199
199
  // available at toolResponse.rawV2 while toolResponse.raw and all declared
200
200
  // getters keep their established compatibility behavior.
201
201
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
202
- version: '0.3.86',
202
+ version: '0.3.87',
203
203
  updateSummary:
204
204
  'Automatic CLI updates are now enabled by default. To opt out, run `deepline settings autoupdate off`; use `deepline settings autoupdate on` to re-enable updates or `deepline settings autoupdate pin <version>` to hold an exact release. This release also adds raw-v2 tool responses at toolResponse.rawV2 while preserving existing toolResponse.raw and declared getters.',
205
205
  packageCapabilities: {
@@ -0,0 +1,9 @@
1
+ # Integration Contracts
2
+
3
+ This package is the only integration-owned boundary shared with public clients.
4
+
5
+ - Put a value here only when both `packages/integrations` and a public client such as `packages/sdk` must interpret it identically.
6
+ - Keep contracts pure and dependency-light. Do not import provider runtimes, generated catalogs, credentials, billing implementations, action schemas, or application code.
7
+ - Provider implementations and server-only policy remain in `packages/integrations`.
8
+ - The public SDK bundles this package; it must not acquire a runtime dependency on a private workspace package.
9
+ - Prefer a server-driven protocol over adding provider-specific client knowledge when compatibility permits it.
@@ -0,0 +1,3 @@
1
+ # `@deepline/integration-contracts`
2
+
3
+ Pure contracts that must be interpreted identically by integration runtimes and public clients. Server-only integration code belongs in `packages/integrations`; SDK-only behavior belongs in `packages/sdk`.
@@ -0,0 +1,2 @@
1
+ export * from './bettercontact/execution-policy';
2
+ export * from './theirstack/execution-policy';
@@ -0,0 +1,77 @@
1
+ export type AnalyticsInstallGuide = {
2
+ id: 'html' | 'wordpress' | 'react' | 'nextjs' | 'gtm' | 'webflow' | 'shopify';
3
+ label: string;
4
+ steps: string[];
5
+ };
6
+
7
+ /** Kept as data so the UI, email preview, and regression test share one guide source. */
8
+ export const ANALYTICS_INSTALL_GUIDES: readonly AnalyticsInstallGuide[] = [
9
+ {
10
+ id: 'html',
11
+ label: 'HTML',
12
+ steps: [
13
+ 'Open the shared layout or template used by every page.',
14
+ 'Paste the loader immediately before the closing </head> tag, publish, then validate below.',
15
+ ],
16
+ },
17
+ {
18
+ id: 'wordpress',
19
+ label: 'WordPress',
20
+ steps: [
21
+ 'Install or open WPCode / Insert Headers and Footers.',
22
+ 'Add the loader to the site-wide Header area, save it, clear any cache, then validate below.',
23
+ ],
24
+ },
25
+ {
26
+ id: 'react',
27
+ label: 'React',
28
+ steps: [
29
+ 'Open the root HTML template (usually public/index.html).',
30
+ 'Paste the loader in <head>, not inside a rendered component, deploy, then validate below.',
31
+ ],
32
+ },
33
+ {
34
+ id: 'nextjs',
35
+ label: 'Next.js',
36
+ steps: [
37
+ 'Open app/layout.tsx (or pages/_document.tsx in the Pages Router).',
38
+ 'Use the Next.js code below once in the document head, deploy, then validate below.',
39
+ ],
40
+ },
41
+ {
42
+ id: 'gtm',
43
+ label: 'Google Tag Manager',
44
+ steps: [
45
+ 'Create a new Custom HTML tag and paste the loader.',
46
+ 'Trigger it on All Pages, publish the container, then validate below.',
47
+ ],
48
+ },
49
+ {
50
+ id: 'webflow',
51
+ label: 'Webflow',
52
+ steps: [
53
+ 'Open Project settings → Custom code.',
54
+ 'Paste the loader in Head code, publish the site, then validate below.',
55
+ ],
56
+ },
57
+ {
58
+ id: 'shopify',
59
+ label: 'Shopify',
60
+ steps: [
61
+ 'Open Online Store → Themes → Edit code → layout/theme.liquid.',
62
+ 'Paste the loader immediately before </head>, save the theme, then validate below.',
63
+ ],
64
+ },
65
+ ];
66
+
67
+ function scriptBody(loader: string) {
68
+ return loader.replace(/^<script>\s*/i, '').replace(/\s*<\/script>$/i, '');
69
+ }
70
+
71
+ export function analyticsGuideCode(
72
+ guide: AnalyticsInstallGuide,
73
+ loader: string,
74
+ ) {
75
+ if (guide.id !== 'nextjs') return loader;
76
+ return `import Script from 'next/script';\n\n<Script\n id="deepline-analytics"\n strategy="afterInteractive"\n dangerouslySetInnerHTML={{ __html: ${JSON.stringify(scriptBody(loader))} }}\n/>`;
77
+ }
@@ -0,0 +1,125 @@
1
+ import type {
2
+ MonitorBillingPhase,
3
+ MonitorBillingPolicy,
4
+ MonitorRetailCharge,
5
+ MonitorRetailChargeComponent,
6
+ } from '@deepline/monitors/billing/types';
7
+
8
+ export type MonitorCustomerChargeQuote = {
9
+ providerCapability: string;
10
+ phase: MonitorBillingPhase;
11
+ providerCostKey?: string;
12
+ knownCredits: number;
13
+ pendingProviderCostKeys: string[];
14
+ components: readonly MonitorRetailChargeComponent[];
15
+ };
16
+
17
+ export type PublicMonitorCustomerChargeSummary = {
18
+ phase: Extract<MonitorBillingPhase, 'create' | 'reactivate'>;
19
+ label: string;
20
+ known_credits: number;
21
+ pending_provider_pricing: boolean;
22
+ display: string;
23
+ variable_by_payload?: boolean;
24
+ };
25
+
26
+ function chargesForPhase(
27
+ policy: MonitorBillingPolicy,
28
+ phase: MonitorBillingPhase,
29
+ ): MonitorRetailCharge[] {
30
+ return [
31
+ policy.customerCreateCharge,
32
+ policy.customerReactivateCharge,
33
+ ...policy.customerUsageCharges,
34
+ ].filter((charge) => charge.phase === phase);
35
+ }
36
+
37
+ export function quoteMonitorCustomerCharge(input: {
38
+ policy: MonitorBillingPolicy;
39
+ phase: MonitorBillingPhase;
40
+ providerCostKey?: string;
41
+ }): MonitorCustomerChargeQuote {
42
+ let knownCredits = 0;
43
+ const pendingProviderCostKeys: string[] = [];
44
+ const components = chargesForPhase(input.policy, input.phase)
45
+ .flatMap((charge) => charge.components)
46
+ .filter(
47
+ (component) =>
48
+ component.kind !== 'upstream_cost_markup' ||
49
+ !input.providerCostKey ||
50
+ component.providerCostKey === input.providerCostKey,
51
+ );
52
+
53
+ for (const component of components) {
54
+ if (component.kind === 'fixed_deepline_credits') {
55
+ knownCredits += component.credits;
56
+ }
57
+ if (component.kind === 'upstream_cost_markup') {
58
+ if (typeof component.retailCredits === 'number') {
59
+ knownCredits += component.retailCredits;
60
+ } else {
61
+ pendingProviderCostKeys.push(component.providerCostKey);
62
+ }
63
+ }
64
+ }
65
+
66
+ return {
67
+ providerCapability: input.policy.providerCapability,
68
+ phase: input.phase,
69
+ ...(input.providerCostKey
70
+ ? { providerCostKey: input.providerCostKey }
71
+ : {}),
72
+ knownCredits,
73
+ pendingProviderCostKeys,
74
+ components,
75
+ };
76
+ }
77
+
78
+ function formatCredits(credits: number) {
79
+ return `${credits.toLocaleString('en')} Deepline ${
80
+ credits === 1 ? 'credit' : 'credits'
81
+ }`;
82
+ }
83
+
84
+ export function publicMonitorCustomerChargeSummary(input: {
85
+ policy: MonitorBillingPolicy;
86
+ phase: Extract<MonitorBillingPhase, 'create' | 'reactivate'>;
87
+ }): PublicMonitorCustomerChargeSummary {
88
+ if (input.policy.payloadPricing) {
89
+ const primaryCharge =
90
+ input.phase === 'create'
91
+ ? input.policy.customerCreateCharge
92
+ : input.policy.customerReactivateCharge;
93
+ return {
94
+ phase: input.phase,
95
+ label: primaryCharge.label,
96
+ known_credits: 0,
97
+ pending_provider_pricing: false,
98
+ variable_by_payload: true,
99
+ display: `Varies by ${input.policy.payloadPricing.discriminator}; see per-type pricing.`,
100
+ };
101
+ }
102
+ const quote = quoteMonitorCustomerCharge(input);
103
+ const primaryCharge =
104
+ input.phase === 'create'
105
+ ? input.policy.customerCreateCharge
106
+ : input.policy.customerReactivateCharge;
107
+ const hasPendingProviderPricing = quote.pendingProviderCostKeys.length > 0;
108
+ const display = hasPendingProviderPricing
109
+ ? quote.knownCredits > 0
110
+ ? `At least ${formatCredits(
111
+ quote.knownCredits,
112
+ )}; provider-specific monitor pricing is still being resolved.`
113
+ : 'Provider-specific monitor pricing is still being resolved.'
114
+ : quote.knownCredits > 0
115
+ ? formatCredits(quote.knownCredits)
116
+ : 'No Deepline credits';
117
+
118
+ return {
119
+ phase: input.phase,
120
+ label: primaryCharge.label,
121
+ known_credits: quote.knownCredits,
122
+ pending_provider_pricing: hasPendingProviderPricing,
123
+ display,
124
+ };
125
+ }