deepline 0.3.416 → 0.3.418

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 (113) hide show
  1. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  2. package/dist/bundling-sources/sdk/src/types.ts +2 -0
  3. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +18 -0
  4. package/dist/bundling-sources/shared_libs/plays/tool-category-descriptions.ts +9 -0
  5. package/dist/bundling-sources/shared_libs/product-notifications/billing-sales.ts +6 -1
  6. package/dist/bundling-sources/shared_libs/product-notifications/catalog.ts +53 -32
  7. package/dist/bundling-sources/shared_libs/product-notifications/default-policy.ts +1 -1
  8. package/dist/bundling-sources/shared_libs/product-notifications/events.ts +14 -0
  9. package/dist/bundling-sources/shared_libs/security/receipt-admission-token.ts +64 -9
  10. package/dist/cli/auth-3OX637KU.js +40 -0
  11. package/dist/cli/{auth-FLYZAZ7I.mjs → auth-V5ACU3O2.mjs} +4 -4
  12. package/dist/cli/{billing-SVGZSMBY.js → billing-UB4MHOT3.js} +73 -73
  13. package/dist/cli/{billing-XZ62L6ZE.mjs → billing-ZIRQHJFE.mjs} +4 -4
  14. package/dist/cli/{chunk-G3WJWD4R.mjs → chunk-32UTANSY.mjs} +1 -1
  15. package/dist/cli/{chunk-2DRO4YWM.js → chunk-7L622O4Y.js} +2 -2
  16. package/dist/cli/{chunk-UXLXZN2F.js → chunk-AJ3NO7DO.js} +2 -2
  17. package/dist/cli/{chunk-UJTWIOQK.js → chunk-CC2IVEOS.js} +6 -6
  18. package/dist/cli/{chunk-MT7VPFMN.mjs → chunk-IPKEHXR3.mjs} +2 -2
  19. package/dist/cli/{chunk-YCAMTIYM.js → chunk-IQD57S4D.js} +85 -79
  20. package/dist/cli/{chunk-TOIDV6Q4.js → chunk-IRIY5HJ2.js} +50 -50
  21. package/dist/cli/{chunk-LFUGXKJW.js → chunk-K6T5LK2V.js} +20 -20
  22. package/dist/cli/{chunk-ENBTCBGT.mjs → chunk-MBD53IKH.mjs} +3 -3
  23. package/dist/cli/{chunk-NWPC3FUA.js → chunk-MC2WIGSK.js} +8 -8
  24. package/dist/cli/{chunk-DT36JAAX.mjs → chunk-MN6AKSIF.mjs} +2 -2
  25. package/dist/cli/{chunk-ESUBIEVT.js → chunk-OPYLSD2Y.js} +6 -6
  26. package/dist/cli/{chunk-2MQJODFQ.mjs → chunk-OX2RL4U2.mjs} +1 -1
  27. package/dist/cli/{chunk-TXLZ6BJC.js → chunk-QMLU6FR6.js} +26 -26
  28. package/dist/cli/{chunk-6GYQG6V3.mjs → chunk-RTK7HFI2.mjs} +3 -3
  29. package/dist/cli/{chunk-7OLAGY3W.mjs → chunk-SWMW7CGZ.mjs} +4 -4
  30. package/dist/cli/{chunk-ZCO7R65D.js → chunk-TBSHWXLW.js} +52 -52
  31. package/dist/cli/{chunk-ERPU6HBQ.mjs → chunk-TX7M4PHR.mjs} +3 -3
  32. package/dist/cli/{chunk-ZMQTLPLJ.mjs → chunk-U4ZC7W7F.mjs} +1 -1
  33. package/dist/cli/{chunk-F5KJFBDA.js → chunk-UMKUJEPH.js} +1 -1
  34. package/dist/cli/{chunk-Q6MUMX2G.mjs → chunk-VCXODFZY.mjs} +2 -2
  35. package/dist/cli/{chunk-NPFMAFUC.mjs → chunk-W4DLZBGA.mjs} +1 -1
  36. package/dist/cli/{chunk-MRL2OMZY.js → chunk-X4L2TVBM.js} +10 -10
  37. package/dist/cli/{chunk-PH6OXQC7.mjs → chunk-X6TVPUPJ.mjs} +1 -1
  38. package/dist/cli/{chunk-WL3MI252.js → chunk-XMISTHAV.js} +35 -35
  39. package/dist/cli/{chunk-FFEA6KAB.mjs → chunk-XRAEC3CY.mjs} +2 -2
  40. package/dist/cli/{chunk-4R3TJDWD.js → chunk-Y26NGVRJ.js} +8 -8
  41. package/dist/cli/{chunk-XP6LSFCW.mjs → chunk-YKCQ6C72.mjs} +5 -5
  42. package/dist/cli/{chunk-XUMHZPE3.mjs → chunk-YVJ45IPJ.mjs} +1 -1
  43. package/dist/cli/{chunk-E5FNJE3Y.js → chunk-ZLPLABLC.js} +4 -4
  44. package/dist/cli/{chunk-YK3XHX7G.js → chunk-ZTZO2CCM.js} +16 -16
  45. package/dist/cli/{chunk-DBMALDT3.mjs → chunk-ZVIFW7LC.mjs} +14 -8
  46. package/dist/cli/{csv-4TAHSCJO.mjs → csv-NUXKAO75.mjs} +3 -3
  47. package/dist/cli/{csv-X72WTTMT.js → csv-YMB7KQ4Y.js} +12 -12
  48. package/dist/cli/{db-3LIMAM2U.js → db-DZZVILTC.js} +25 -25
  49. package/dist/cli/{db-CK3WE7QC.mjs → db-KZDA6JI2.mjs} +4 -4
  50. package/dist/cli/{describe-H2Z2VKU2.js → describe-AEPMZMC5.js} +16 -16
  51. package/dist/cli/{describe-FW6XZCFK.mjs → describe-F3YVMAIW.mjs} +12 -12
  52. package/dist/cli/describe-core.d.mts +1 -1
  53. package/dist/cli/describe-core.d.ts +1 -1
  54. package/dist/cli/{executions-X7SXKMAI.js → executions-45F3UHOR.js} +6 -6
  55. package/dist/cli/{executions-VXGO3GSE.mjs → executions-FZHTM5M6.mjs} +4 -4
  56. package/dist/cli/{feedback-6I3NFUPV.js → feedback-BB3Z4UEA.js} +7 -7
  57. package/dist/cli/{feedback-KTDQHUNJ.mjs → feedback-Z3DPAIUE.mjs} +3 -3
  58. package/dist/cli/git-MFVTGD4N.js +24 -0
  59. package/dist/cli/{git-ODZASGIK.mjs → git-VB7DKQIF.mjs} +4 -4
  60. package/dist/cli/index.js +131 -131
  61. package/dist/cli/index.mjs +36 -36
  62. package/dist/cli/{legacy-noops-KNGT6U3L.mjs → legacy-noops-FUCTWERE.mjs} +4 -4
  63. package/dist/cli/{legacy-noops-HLVQGZ72.js → legacy-noops-KNXHDWXZ.js} +7 -7
  64. package/dist/cli/{monitors-3F5EZCMB.js → monitors-JAA2QU5X.js} +84 -84
  65. package/dist/cli/{monitors-JLGADUE5.mjs → monitors-QVY6M22O.mjs} +4 -4
  66. package/dist/cli/{org-Z4LPCJII.js → org-6REABQZW.js} +64 -64
  67. package/dist/cli/{org-D7AW6LIR.mjs → org-J4SVIQHM.mjs} +4 -4
  68. package/dist/cli/{play-UBNDV57A.js → play-2PSN3ZIQ.js} +283 -283
  69. package/dist/cli/{play-MO3SAHDS.mjs → play-6JEILD2O.mjs} +10 -10
  70. package/dist/cli/{providers-SL6ZSEDI.js → providers-KC2TT6IK.js} +7 -7
  71. package/dist/cli/{providers-QCBNQY4A.mjs → providers-VWOLONCJ.mjs} +4 -4
  72. package/dist/cli/{quickstart-YGFVF6VL.js → quickstart-CP7L4OHB.js} +5 -5
  73. package/dist/cli/{quickstart-K7J4YOTE.mjs → quickstart-ZAC3IDFO.mjs} +3 -3
  74. package/dist/cli/search-FOUJGAMG.js +30 -0
  75. package/dist/cli/{search-DVE6TKQ3.mjs → search-ZN5ZNNMY.mjs} +5 -5
  76. package/dist/cli/{secrets-JOVBXCUR.mjs → secrets-LNUVVSXM.mjs} +4 -4
  77. package/dist/cli/{secrets-G7ZMCH5J.js → secrets-V6SPFXBE.js} +13 -13
  78. package/dist/cli/{sessions-QQV7FO4Y.js → sessions-5CZX2SXB.js} +5 -5
  79. package/dist/cli/{sessions-NA5POIR5.mjs → sessions-7RW3QBGB.mjs} +4 -4
  80. package/dist/cli/{settings-XGFHXFCJ.js → settings-TSAEGFLE.js} +75 -75
  81. package/dist/cli/{settings-AM44HC2C.mjs → settings-YEM3ZFDW.mjs} +8 -8
  82. package/dist/cli/{setup-DA4TSWCY.js → setup-AAHA5LHX.js} +42 -42
  83. package/dist/cli/{setup-RUBLF452.mjs → setup-JJD4K7W2.mjs} +7 -7
  84. package/dist/cli/{skills-TRG55YOF.mjs → skills-PH7JSP56.mjs} +5 -5
  85. package/dist/cli/skills-RU3O66D5.js +29 -0
  86. package/dist/cli/{tools-CEEA7DU4.mjs → tools-5GBFL3JE.mjs} +12 -12
  87. package/dist/cli/tools-7Q3YFIFR.js +44 -0
  88. package/dist/cli/update-4RBEYEQ5.js +31 -0
  89. package/dist/cli/{update-Y5GSWR67.mjs → update-IKTFZC6V.mjs} +7 -7
  90. package/dist/cli/{workflow-74I6RNJR.mjs → workflow-RNV56CI7.mjs} +5 -5
  91. package/dist/cli/{workflow-D2VHQKJB.js → workflow-ZFIZP6U6.js} +15 -15
  92. package/dist/{client-D2A39edb.d.mts → client-CCWIUnk7.d.mts} +59 -13
  93. package/dist/{client-D6w0_gN1.d.ts → client-vHqBm-OL.d.ts} +59 -13
  94. package/dist/index.d.mts +2 -2
  95. package/dist/index.d.ts +2 -2
  96. package/dist/index.js +6 -6
  97. package/dist/index.mjs +3 -3
  98. package/dist/install-integrity.json +80 -80
  99. package/dist/plays/play-description.d.mts +1 -1
  100. package/dist/plays/play-description.d.ts +1 -1
  101. package/dist/plays/run-request.d.mts +1 -1
  102. package/dist/plays/run-request.d.ts +1 -1
  103. package/dist/release.d.mts +1 -1
  104. package/dist/release.d.ts +1 -1
  105. package/dist/release.js +2 -2
  106. package/dist/release.mjs +1 -1
  107. package/package.json +1 -1
  108. package/dist/cli/auth-BNQP4UYQ.js +0 -40
  109. package/dist/cli/git-LLP4T6XB.js +0 -24
  110. package/dist/cli/search-V4HNFZRE.js +0 -30
  111. package/dist/cli/skills-6AQTCBTF.js +0 -29
  112. package/dist/cli/tools-JLPTH7TF.js +0 -44
  113. package/dist/cli/update-EKEBZDIX.js +0 -31
@@ -205,7 +205,7 @@ export const SDK_RELEASE = {
205
205
  // getters keep their established compatibility behavior.
206
206
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
207
207
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
208
- version: '0.3.416',
208
+ version: '0.3.418',
209
209
  updateSummary: {
210
210
  introducedIn: '0.3.90',
211
211
  summary:
@@ -621,6 +621,8 @@ export interface ToolSearchResult {
621
621
  search_mode?: 'v1' | 'v2';
622
622
  /** Whether search fell back to category matching. */
623
623
  search_fallback_to_category?: boolean;
624
+ /** Requested categories no tool has, left out of the filter. */
625
+ unknown_categories?: string[];
624
626
  /** Explanation and next commands when filters/search succeed but match zero tools. */
625
627
  emptyResult?: {
626
628
  reason: string;
@@ -1447,5 +1447,23 @@
1447
1447
  "runTimeoutMs": 300000,
1448
1448
  "failureAlert": "convex_action_wrapper",
1449
1449
  "domainReportRequired": true
1450
+ },
1451
+ {
1452
+ "id": "convex.billing-credit-delivery-watchdog",
1453
+ "name": "Billing credit delivery watchdog",
1454
+ "scheduler": "convex_scheduled_action",
1455
+ "cadence": "runAfter at 30 and 120 seconds per paid invoice",
1456
+ "timezone": "UTC",
1457
+ "source": "packages/convex/scheduledJobsNode.ts",
1458
+ "locator": "checkBillingInvoiceDelivery",
1459
+ "owner": "billing",
1460
+ "criticality": "critical",
1461
+ "purpose": "Observe paid-invoice credit delivery independently of renewal operations and admit the shared direct Slack alert.",
1462
+ "successDefinition": "The invoice is verified delivered, outside scope, or a missing-credit alert is durably admitted.",
1463
+ "failureDefinition": "Payment or credit evidence cannot be verified, or observation/notification admission fails.",
1464
+ "startGraceMs": 120000,
1465
+ "runTimeoutMs": 60000,
1466
+ "failureAlert": "convex_action_wrapper",
1467
+ "domainReportRequired": true
1450
1468
  }
1451
1469
  ]
@@ -32,6 +32,15 @@ export const TOOL_CATEGORY_DESCRIPTIONS: Readonly<Record<string, string>> = {
32
32
  'Run outbound sequencing, deliverability, and campaign operations.',
33
33
  admin:
34
34
  'Provider-side status, metadata, and account operations behind other tools.',
35
+ crm: 'Read or write CRM records such as contacts, companies, and deals.',
36
+ meeting_intelligence:
37
+ 'Read call and meeting recordings, transcripts, and conversation analytics.',
38
+ messaging: 'Send or read team and customer-support messages.',
39
+ social_media:
40
+ 'Read social posts, comments, reactions, followers, and engagement.',
41
+ ads_audiences:
42
+ 'Research ad libraries or sync custom and matched ad audiences.',
43
+ data_warehouse: 'Query or manage a database or data warehouse.',
35
44
  smb: 'Look up small-business listings, local records, and public filings.',
36
45
  identity_resolution:
37
46
  'Match a partial identity to a single resolved person or company.',
@@ -4,10 +4,15 @@ export const BILLING_SALES_SLACK_CHANNEL_ID = 'C0AGWVD2TNK';
4
4
  export const BILLING_SALES_CONNECTION_ID = 'platform-reporting-bot';
5
5
  export const BILLING_SALES_CREDIT_PURCHASE_MINIMUM_CENTS = 1;
6
6
  export const BILLING_PURCHASE_LATE_RULE_KEY = 'internal.billing.purchase_late';
7
+ export const BILLING_RENEWAL_LATE_RULE_KEY = 'internal.billing.renewal_late';
8
+ export const BILLING_DELIVERY_LATE_RULE_KEYS: readonly string[] = [
9
+ BILLING_PURCHASE_LATE_RULE_KEY,
10
+ BILLING_RENEWAL_LATE_RULE_KEY,
11
+ ];
7
12
  export const BILLING_SALES_RULE_KEYS: readonly string[] = [
8
13
  'internal.billing.credit_purchase',
9
14
  'internal.billing.paid_plan',
10
- BILLING_PURCHASE_LATE_RULE_KEY,
15
+ ...BILLING_DELIVERY_LATE_RULE_KEYS,
11
16
  ];
12
17
 
13
18
  export function isPlatformNotificationGroup(groupKey: string): boolean {
@@ -15,6 +15,7 @@ import { legacySlackNotificationType } from './legacy-slack';
15
15
  import type { NotificationText } from './content';
16
16
  import {
17
17
  BILLING_PURCHASE_LATE_RULE_KEY,
18
+ BILLING_RENEWAL_LATE_RULE_KEY,
18
19
  BILLING_SALES_CREDIT_PURCHASE_MINIMUM_CENTS,
19
20
  BILLING_SALES_GROUP_KEY,
20
21
  } from './billing-sales';
@@ -273,6 +274,46 @@ const GROWTH_LEARN_MORE_DETAILS: NotificationText[] = [
273
274
  ];
274
275
 
275
276
  /** One canonical registry owns every notification type's runtime and UI metadata. */
277
+ function lateCreditDeliveryRegistration<Id extends string>(
278
+ id: Id,
279
+ eventName: ProductNotificationEventName,
280
+ label: 'Purchase' | 'Renewal',
281
+ identityField: 'operationId' | 'stripeInvoiceId',
282
+ ) {
283
+ return {
284
+ id,
285
+ eventName,
286
+ requiredFilter: {},
287
+ allowedTriggers: ['each_match'],
288
+ catalog: undefined,
289
+ shadow: true,
290
+ rule: {
291
+ default: { ruleKey: id, groupKey: BILLING_SALES_GROUP_KEY },
292
+ create: (_input, base) => ({
293
+ ...base,
294
+ repeatMode: 'every_match',
295
+ trigger: { kind: 'each_match' },
296
+ }),
297
+ present: ({ payload }) => ({
298
+ title: `${label} not completed after ${payload.thresholdSeconds} seconds`,
299
+ summary: [
300
+ `<!channel> ${label} fulfillment in `,
301
+ { workspace: true },
302
+ ' needs investigation. Verify payment and fulfillment independently.',
303
+ ],
304
+ details: [
305
+ `${label === 'Purchase' ? 'Operation' : 'Stripe invoice'}: ${payload[identityField]}`,
306
+ ],
307
+ targetUrl: String(payload.targetUrl),
308
+ subjectKind:
309
+ label === 'Purchase' ? 'billing_operation' : 'billing_invoice',
310
+ subjectId: String(payload[identityField]),
311
+ severity: 'error',
312
+ }),
313
+ },
314
+ } satisfies NotificationTypeRegistration;
315
+ }
316
+
276
317
  const PRODUCT_NOTIFICATION_TYPE_REGISTRY = [
277
318
  {
278
319
  id: 'monitor.disabled.insufficient_credits',
@@ -816,38 +857,18 @@ const PRODUCT_NOTIFICATION_TYPE_REGISTRY = [
816
857
  }),
817
858
  },
818
859
  },
819
- {
820
- id: BILLING_PURCHASE_LATE_RULE_KEY,
821
- eventName: ProductNotificationEvent.BillingPurchaseLate,
822
- requiredFilter: {},
823
- allowedTriggers: ['each_match'],
824
- catalog: undefined,
825
- shadow: true,
826
- rule: {
827
- default: {
828
- ruleKey: BILLING_PURCHASE_LATE_RULE_KEY,
829
- groupKey: BILLING_SALES_GROUP_KEY,
830
- },
831
- create: (_input, base) => ({
832
- ...base,
833
- repeatMode: 'every_match',
834
- trigger: { kind: 'each_match' },
835
- }),
836
- present: ({ payload }) => ({
837
- title: `Purchase not completed after ${payload.thresholdSeconds} seconds`,
838
- summary: [
839
- '<!channel> Purchase fulfillment in ',
840
- { workspace: true },
841
- ' needs investigation. Verify payment and fulfillment independently.',
842
- ],
843
- details: [`Operation: ${payload.operationId}`],
844
- targetUrl: String(payload.targetUrl),
845
- subjectKind: 'billing_operation',
846
- subjectId: String(payload.operationId),
847
- severity: 'error',
848
- }),
849
- },
850
- },
860
+ lateCreditDeliveryRegistration(
861
+ BILLING_PURCHASE_LATE_RULE_KEY,
862
+ ProductNotificationEvent.BillingPurchaseLate,
863
+ 'Purchase',
864
+ 'operationId',
865
+ ),
866
+ lateCreditDeliveryRegistration(
867
+ BILLING_RENEWAL_LATE_RULE_KEY,
868
+ ProductNotificationEvent.BillingRenewalLate,
869
+ 'Renewal',
870
+ 'stripeInvoiceId',
871
+ ),
851
872
  {
852
873
  id: 'play.failed',
853
874
  eventName: ProductNotificationEvent.PlayRunCompleted,
@@ -20,7 +20,7 @@ import {
20
20
  * they create sparse copy-on-write overrides.
21
21
  */
22
22
  export const CURRENT_PRODUCT_NOTIFICATION_DEFAULT_POLICY = {
23
- version: 9,
23
+ version: 10,
24
24
  groups: [
25
25
  {
26
26
  groupKey: 'default',
@@ -21,6 +21,7 @@ export const ProductNotificationEvent = {
21
21
  AutoTopupLimitObserved: 'billing.auto_topup.limit_observed',
22
22
  BillingPlanPurchased: 'billing.plan.purchased',
23
23
  BillingPurchaseLate: 'billing.purchase.late',
24
+ BillingRenewalLate: 'billing.renewal.late',
24
25
  MonitorLifecycleChanged: 'monitor.lifecycle.changed',
25
26
  PlayLifecycleChanged: 'play.lifecycle.changed',
26
27
  PlayRunCompleted: 'play.run.completed',
@@ -64,6 +65,7 @@ export const PRODUCT_NOTIFICATION_EVENT_NAMES = [
64
65
  ProductNotificationEvent.CreditsPurchaseCompleted,
65
66
  ProductNotificationEvent.BillingPlanPurchased,
66
67
  ProductNotificationEvent.BillingPurchaseLate,
68
+ ProductNotificationEvent.BillingRenewalLate,
67
69
  ] as const;
68
70
 
69
71
  export const PRODUCT_NOTIFICATION_COMPATIBILITY_EVENT_NAMES = [
@@ -245,6 +247,18 @@ export const PRODUCT_NOTIFICATION_EVENT_DEFINITIONS: readonly ProductNotificatio
245
247
  orderingSubjectFact: 'operationId',
246
248
  allowedTriggers: ['each_match'],
247
249
  },
250
+ {
251
+ eventName: ProductNotificationEvent.BillingRenewalLate,
252
+ producerKey: ProductNotificationProducerKey.BillingPurchases,
253
+ requiredFacts: {
254
+ accountId: 'string',
255
+ stripeInvoiceId: 'string',
256
+ thresholdSeconds: 'number',
257
+ targetUrl: 'string',
258
+ },
259
+ orderingSubjectFact: 'stripeInvoiceId',
260
+ allowedTriggers: ['each_match'],
261
+ },
248
262
  ...PRODUCT_NOTIFICATION_COMPATIBILITY_EVENT_NAMES.map((eventName) => ({
249
263
  eventName,
250
264
  producerKey: ProductNotificationProducerKey.LegacyProductNotifications,
@@ -100,6 +100,26 @@ export async function verifyCreditReadinessToken(
100
100
  scanId: string;
101
101
  cursor: string | null;
102
102
  }> {
103
+ const claims = await verifyObservationToken(
104
+ token,
105
+ 'deepline.credit_readiness',
106
+ nowMs,
107
+ );
108
+ if (
109
+ typeof claims.scanId !== 'string' ||
110
+ !claims.scanId ||
111
+ (claims.cursor !== null &&
112
+ (typeof claims.cursor !== 'string' || !claims.cursor))
113
+ )
114
+ throw new Error('Invalid credit readiness token.');
115
+ return { scanId: claims.scanId, cursor: claims.cursor as string | null };
116
+ }
117
+
118
+ async function verifyObservationToken(
119
+ token: string,
120
+ audience: string,
121
+ nowMs: number,
122
+ ): Promise<Record<string, unknown>> {
103
123
  const parts = token.split('.');
104
124
  if (parts.length !== 3) throw new Error('Invalid credit readiness token.');
105
125
  const decode = (value: string) =>
@@ -126,11 +146,7 @@ export async function verifyCreditReadinessToken(
126
146
  header.typ !== 'JWT' ||
127
147
  claims.v !== TOKEN_VERSION ||
128
148
  claims.iss !== TOKEN_ISSUER ||
129
- claims.aud !== 'deepline.credit_readiness' ||
130
- typeof claims.scanId !== 'string' ||
131
- !claims.scanId ||
132
- (claims.cursor !== null &&
133
- (typeof claims.cursor !== 'string' || !claims.cursor)) ||
149
+ claims.aud !== audience ||
134
150
  !Number.isSafeInteger(claims.iat) ||
135
151
  !Number.isSafeInteger(claims.exp) ||
136
152
  claims.iat > now + 30 ||
@@ -138,10 +154,7 @@ export async function verifyCreditReadinessToken(
138
154
  claims.exp - claims.iat !== TOKEN_TTL_SECONDS
139
155
  )
140
156
  throw new Error('Invalid credit readiness token.');
141
- return {
142
- scanId: claims.scanId,
143
- cursor: claims.cursor,
144
- };
157
+ return claims as Record<string, unknown>;
145
158
  }
146
159
 
147
160
  /**
@@ -323,3 +336,45 @@ export async function mintSqlListenerDispatchRetryToken(input: {
323
336
  exp: issuedAt + TOKEN_TTL_SECONDS,
324
337
  });
325
338
  }
339
+
340
+ /** Authorizes one invoice/threshold observation, never a payment, grant or fleet scan. */
341
+ export async function mintBillingDeliveryToken(input: {
342
+ stripeInvoiceId: string;
343
+ thresholdSeconds: 30 | 120;
344
+ nowMs?: number;
345
+ }): Promise<string> {
346
+ const issuedAt = Math.floor((input.nowMs ?? Date.now()) / 1000);
347
+ return mint({
348
+ v: TOKEN_VERSION,
349
+ iss: TOKEN_ISSUER,
350
+ aud: 'deepline.billing_delivery',
351
+ stripeInvoiceId: input.stripeInvoiceId,
352
+ thresholdSeconds: input.thresholdSeconds,
353
+ iat: issuedAt,
354
+ exp: issuedAt + TOKEN_TTL_SECONDS,
355
+ });
356
+ }
357
+
358
+ export async function verifyBillingDeliveryToken(
359
+ token: string,
360
+ nowMs = Date.now(),
361
+ ): Promise<{
362
+ stripeInvoiceId: string;
363
+ thresholdSeconds: 30 | 120;
364
+ }> {
365
+ const claims = await verifyObservationToken(
366
+ token,
367
+ 'deepline.billing_delivery',
368
+ nowMs,
369
+ );
370
+ if (
371
+ typeof claims.stripeInvoiceId !== 'string' ||
372
+ !claims.stripeInvoiceId ||
373
+ (claims.thresholdSeconds !== 30 && claims.thresholdSeconds !== 120)
374
+ )
375
+ throw new Error('Invalid billing delivery token.');
376
+ return {
377
+ stripeInvoiceId: claims.stripeInvoiceId,
378
+ thresholdSeconds: claims.thresholdSeconds,
379
+ };
380
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+ var _chunkIRIY5HJ2js = require('./chunk-IRIY5HJ2.js');
17
+ require('./chunk-CC2IVEOS.js');
18
+ require('./chunk-ZLPLABLC.js');
19
+ require('./chunk-NPBJI7RE.js');
20
+ require('./chunk-XNYIZMNQ.js');
21
+ require('./chunk-PPDBRJRW.js');
22
+ require('./chunk-UMKUJEPH.js');
23
+ require('./chunk-OG64RBAC.js');
24
+ require('./chunk-COGTRVWW.js');
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+ exports.EXIT_WORKSPACE_MISMATCH = _chunkIRIY5HJ2js.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunkIRIY5HJ2js.authStatusLine; exports.clearPendingClaim = _chunkIRIY5HJ2js.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkIRIY5HJ2js.clearSatisfiedPendingClaim; exports.handleRegister = _chunkIRIY5HJ2js.handleRegister; exports.handleStatus = _chunkIRIY5HJ2js.handleStatus; exports.handleWait = _chunkIRIY5HJ2js.handleWait; exports.httpJson = _chunkIRIY5HJ2js.httpJson; exports.readPendingAuthClaim = _chunkIRIY5HJ2js.readPendingAuthClaim; exports.readStatusBanner = _chunkIRIY5HJ2js.readStatusBanner; exports.registerAuthCommands = _chunkIRIY5HJ2js.registerAuthCommands; exports.reportSetupCompleted = _chunkIRIY5HJ2js.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkIRIY5HJ2js.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunkIRIY5HJ2js.statusBannerLine;
@@ -13,13 +13,13 @@ import {
13
13
  reportSetupCompleted,
14
14
  resolvePendingAuthClaimForResume,
15
15
  statusBannerLine
16
- } from "./chunk-FFEA6KAB.mjs";
17
- import "./chunk-NPFMAFUC.mjs";
18
- import "./chunk-2MQJODFQ.mjs";
16
+ } from "./chunk-XRAEC3CY.mjs";
17
+ import "./chunk-W4DLZBGA.mjs";
18
+ import "./chunk-OX2RL4U2.mjs";
19
19
  import "./chunk-MAMVGOSC.mjs";
20
20
  import "./chunk-DLIRSHV6.mjs";
21
21
  import "./chunk-E4IXDAZI.mjs";
22
- import "./chunk-G3WJWD4R.mjs";
22
+ import "./chunk-32UTANSY.mjs";
23
23
  import "./chunk-WZYKRD7T.mjs";
24
24
  import "./chunk-KRD6H754.mjs";
25
25
  export {