@buildbase/sdk 0.0.50 → 0.0.53

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 (52) hide show
  1. package/AGENTS.md +41 -13
  2. package/CHANGELOG.md +109 -0
  3. package/README.md +343 -44
  4. package/dist/css/styles.css +1 -1
  5. package/dist/index.cjs +1 -1
  6. package/dist/index.d.ts +874 -53
  7. package/dist/index.mjs +1 -1
  8. package/dist/mcp/index.cjs +1 -0
  9. package/dist/mcp/index.d.ts +1402 -0
  10. package/dist/mcp/index.mjs +1 -0
  11. package/dist/react/chunks/SettingsDialog-BxDYsie6.mjs +2 -0
  12. package/dist/react/chunks/SettingsDialog-Dy8W3NA6.cjs +2 -0
  13. package/dist/react/chunks/SubscriptionDialog-6c5dHoQd.mjs +2 -0
  14. package/dist/react/chunks/SubscriptionDialog-CpVnnXJg.cjs +2 -0
  15. package/dist/react/chunks/ar-1Z1MOGAP.mjs +2 -0
  16. package/dist/react/chunks/ar-VGzBv3AZ.cjs +2 -0
  17. package/dist/react/chunks/de-BjdDg60Y.cjs +2 -0
  18. package/dist/react/chunks/de-CXUItplO.mjs +2 -0
  19. package/dist/react/chunks/es-BBPsSZUp.cjs +2 -0
  20. package/dist/react/chunks/es-BTbzVutz.mjs +2 -0
  21. package/dist/react/chunks/fr-Cax48X_S.cjs +2 -0
  22. package/dist/react/chunks/fr-DPMeOQu3.mjs +2 -0
  23. package/dist/react/chunks/hi-BJqvpG6d.cjs +2 -0
  24. package/dist/react/chunks/hi-JfJx-LV7.mjs +2 -0
  25. package/dist/react/chunks/ja-CDGtLzTk.mjs +2 -0
  26. package/dist/react/chunks/ja-DvVyj5xX.cjs +2 -0
  27. package/dist/react/chunks/react-4SlWxHdh.cjs +2 -0
  28. package/dist/react/chunks/react-OL1uSkpr.mjs +2 -0
  29. package/dist/react/chunks/zh-BAcqxkxk.cjs +2 -0
  30. package/dist/react/chunks/zh-BNZ2Ooe8.mjs +2 -0
  31. package/dist/react/index.cjs +1 -1
  32. package/dist/react/index.d.ts +484 -93
  33. package/dist/react/index.mjs +1 -1
  34. package/package.json +22 -5
  35. package/dist/react/chunks/SubscriptionDialog-A6oETKbb.cjs +0 -2
  36. package/dist/react/chunks/SubscriptionDialog-nuMunBn4.mjs +0 -2
  37. package/dist/react/chunks/ar-BRvKHRYS.cjs +0 -2
  38. package/dist/react/chunks/ar-IhPhJAZA.mjs +0 -2
  39. package/dist/react/chunks/de-D3q0vQBG.cjs +0 -2
  40. package/dist/react/chunks/de-bvh5IFSx.mjs +0 -2
  41. package/dist/react/chunks/es-B9kiwJmF.cjs +0 -2
  42. package/dist/react/chunks/es-TyUz4_E1.mjs +0 -2
  43. package/dist/react/chunks/fr-C500Ytao.cjs +0 -2
  44. package/dist/react/chunks/fr-CKm-bSvG.mjs +0 -2
  45. package/dist/react/chunks/hi-CfFhH2uQ.cjs +0 -2
  46. package/dist/react/chunks/hi-Ck9cPpd-.mjs +0 -2
  47. package/dist/react/chunks/ja-AM4H1tXw.mjs +0 -2
  48. package/dist/react/chunks/ja-DfROrx_j.cjs +0 -2
  49. package/dist/react/chunks/react-CTX0_nOV.cjs +0 -2
  50. package/dist/react/chunks/react-DzQupoqH.mjs +0 -2
  51. package/dist/react/chunks/zh-CLmBh-it.cjs +0 -2
  52. package/dist/react/chunks/zh-DCVPxie-.mjs +0 -2
package/dist/index.d.ts CHANGED
@@ -1139,6 +1139,15 @@ declare abstract class BaseApi {
1139
1139
  * Tries to parse JSON error body; falls back to status-based message.
1140
1140
  */
1141
1141
  protected throwResponseError(response: Response, defaultMsg: string): Promise<never>;
1142
+ /**
1143
+ * Tagged template that URI-encodes interpolated path segments, so IDs
1144
+ * containing `/ ? # ..` can't retarget the request path.
1145
+ * Use for PATH segments only — never for pre-built query strings.
1146
+ *
1147
+ * @example
1148
+ * this.apiPath`workspaces/${workspaceId}/users/${userId}`
1149
+ */
1150
+ protected apiPath(strings: TemplateStringsArray, ...values: Array<string | number>): string;
1142
1151
  /**
1143
1152
  * Parse JSON and unwrap `{ success, data }` envelope if present.
1144
1153
  * Throws if `success` is explicitly `false`.
@@ -2177,8 +2186,9 @@ interface PermissionContext {
2177
2186
  * 3. settings.workspace.permissions[role] (org-level template)
2178
2187
  * 4. DEFAULT_ROLE_PERMISSIONS[role] (SDK built-in defaults)
2179
2188
  * 5. Merge in appPermissions (developer-defined) for the role
2180
- * 6. If role not found → use defaultRole from settings, then 'member'
2181
- * 7. Apply setting restrictions (canInviteMembers, canCreateWorkspace)
2189
+ * 6. If role not found → use an explicitly-configured, known `defaultRole`;
2190
+ * otherwise deny (no silent 'member' fallback for unknown roles)
2191
+ * 7. Apply setting restrictions (canInviteMembers)
2182
2192
  */
2183
2193
  declare function resolvePermissions(ctx: PermissionContext): Set<string>;
2184
2194
  /**
@@ -2213,6 +2223,652 @@ interface BetaFormResponse {
2213
2223
  message: string;
2214
2224
  }
2215
2225
 
2226
+ /**
2227
+ * Type-safe translation keys for the BuildBase SDK.
2228
+ * All user-facing strings are defined here.
2229
+ */
2230
+ interface SDKMessages {
2231
+ security: {
2232
+ connectedAgentsTitle: string;
2233
+ connectedAgentsDescription: string;
2234
+ connectedAgentsDisconnect: string;
2235
+ connectedAgentsEmpty: string;
2236
+ connectedAgentsAccess: string;
2237
+ connectedAgentsGranted: string;
2238
+ inactive: string;
2239
+ inactiveHint: string;
2240
+ passkeysTitle: string;
2241
+ passkeysDescription: string;
2242
+ noPasskeys: string;
2243
+ addHint: string;
2244
+ rename: string;
2245
+ remove: string;
2246
+ removeTitle: string;
2247
+ removeDescription: string;
2248
+ renamePlaceholder: string;
2249
+ lastUsed: string;
2250
+ added: string;
2251
+ };
2252
+ settings: {
2253
+ titles: {
2254
+ profile: string;
2255
+ security: string;
2256
+ general: string;
2257
+ users: string;
2258
+ subscription: string;
2259
+ usage: string;
2260
+ credits: string;
2261
+ features: string;
2262
+ notifications: string;
2263
+ permissions: string;
2264
+ danger: string;
2265
+ };
2266
+ sidebar: {
2267
+ account: string;
2268
+ workspace: string;
2269
+ profile: string;
2270
+ security: string;
2271
+ general: string;
2272
+ users: string;
2273
+ subscription: string;
2274
+ usage: string;
2275
+ credits: string;
2276
+ features: string;
2277
+ notifications: string;
2278
+ permissions: string;
2279
+ danger: string;
2280
+ };
2281
+ common: {
2282
+ refresh: string;
2283
+ refreshing: string;
2284
+ retry: string;
2285
+ retrying: string;
2286
+ save: string;
2287
+ saving: string;
2288
+ cancel: string;
2289
+ delete: string;
2290
+ dismiss: string;
2291
+ loading: string;
2292
+ success: string;
2293
+ error: string;
2294
+ refreshAction: string;
2295
+ retryAction: string;
2296
+ noPermissionTitle: string;
2297
+ noPermissionDescription: string;
2298
+ billingManageOnly: string;
2299
+ openSettings: string;
2300
+ back: string;
2301
+ };
2302
+ };
2303
+ subscription: {
2304
+ managePlan: string;
2305
+ changePlan: string;
2306
+ viewPricingPlans: string;
2307
+ viewPlans: string;
2308
+ upgradePlan: string;
2309
+ subscribe: string;
2310
+ currentPlan: string;
2311
+ noSubscription: string;
2312
+ choosePlan: string;
2313
+ choosePlanDescription: string;
2314
+ forWorkspace: string;
2315
+ planUpdateAvailable: string;
2316
+ updateSuccess: string;
2317
+ updateFailed: string;
2318
+ cancelTitle: string;
2319
+ cancelConfirm: string;
2320
+ cancelKeep: string;
2321
+ cancelButton: string;
2322
+ canceling: string;
2323
+ cancelSuccess: string;
2324
+ cancelNotCharged: string;
2325
+ cancelResumeAnytime: string;
2326
+ cancelTrialTitle: string;
2327
+ cancelTrialConfirm: string;
2328
+ cancelTrialAccess: string;
2329
+ cancelTrialNoCharge: string;
2330
+ cancelTrialResume: string;
2331
+ cancelTrialKeep: string;
2332
+ cancelTrialButton: string;
2333
+ resumeTitle: string;
2334
+ resumeTrial: string;
2335
+ resumeConfirm: string;
2336
+ resumeKeep: string;
2337
+ resumeButton: string;
2338
+ resuming: string;
2339
+ resumeSuccess: string;
2340
+ managePayment: string;
2341
+ openingPortal: string;
2342
+ viewAllPlans: string;
2343
+ scheduledCancellation: string;
2344
+ scheduledTrialCancellation: string;
2345
+ paymentPastDue: string;
2346
+ paymentPastDueDescription: string;
2347
+ subscriptionPaused: string;
2348
+ subscriptionPausedDescription: string;
2349
+ errorLoading: string;
2350
+ errorLoadingDescription: string;
2351
+ errorProcessing: string;
2352
+ errorCanceling: string;
2353
+ errorResuming: string;
2354
+ invalidWorkspace: string;
2355
+ billingInterval: {
2356
+ monthly: string;
2357
+ quarterly: string;
2358
+ yearly: string;
2359
+ perMonth: string;
2360
+ perQuarter: string;
2361
+ perYear: string;
2362
+ };
2363
+ seats: {
2364
+ title: string;
2365
+ members: string;
2366
+ included: string;
2367
+ billable: string;
2368
+ perExtraSeat: string;
2369
+ limit: string;
2370
+ includedSeats: string;
2371
+ maxSeats: string;
2372
+ freeWithBase: string;
2373
+ allIncluded: string;
2374
+ extra: string;
2375
+ unlimited: string;
2376
+ };
2377
+ items: {
2378
+ features: string;
2379
+ limits: string;
2380
+ quotas: string;
2381
+ credits: string;
2382
+ creditsPerMonth: string;
2383
+ creditsOneTime: string;
2384
+ creditRenewal: string;
2385
+ creditModeReset: string;
2386
+ creditModeTopup: string;
2387
+ creditModeLifetime: string;
2388
+ /** @deprecated */
2389
+ creditsPerPeriod: string;
2390
+ /** @deprecated */
2391
+ creditRollover: string;
2392
+ };
2393
+ checkout: {
2394
+ upgrade: string;
2395
+ downgrade: string;
2396
+ switchTo: string;
2397
+ select: string;
2398
+ };
2399
+ status: {
2400
+ active: string;
2401
+ canceling: string;
2402
+ trial: string;
2403
+ canceled: string;
2404
+ pastDue: string;
2405
+ paused: string;
2406
+ deprecated: string;
2407
+ unknown: string;
2408
+ };
2409
+ plan: string;
2410
+ invoicesTab: string;
2411
+ tabsLabel: string;
2412
+ endsOn: string;
2413
+ versionLabel: string;
2414
+ changePlanButton: string;
2415
+ noPlanAssigned: string;
2416
+ free: string;
2417
+ perSeatDisplay: string;
2418
+ estTotalDisplay: string;
2419
+ nextBillingDisplay: string;
2420
+ membersInWorkspace: string;
2421
+ billingInCurrency: string;
2422
+ savingsPercent: string;
2423
+ switchToInterval: string;
2424
+ seatPriceDisplay: string;
2425
+ trialEnded: string;
2426
+ trialEndsIn: string;
2427
+ onTrial: string;
2428
+ upgradeToKeepAccess: string;
2429
+ viewInvoices: string;
2430
+ cancelTrial: string;
2431
+ dunningFinal: string;
2432
+ dunningSuspended: string;
2433
+ dunningRecovery: string;
2434
+ dunningSuspendedDescription: string;
2435
+ dunningRecoveryDescription: string;
2436
+ cancelEndDescription: string;
2437
+ trialEndDescription: string;
2438
+ cancelEndFallback: string;
2439
+ resumeChargeDate: string;
2440
+ resumeChargeFallback: string;
2441
+ resumeContinue: string;
2442
+ resumeCancelAnytime: string;
2443
+ retainAccess: string;
2444
+ retainAccessFallback: string;
2445
+ noPlansAvailable: string;
2446
+ noPlansAvailableHint: string;
2447
+ startTrialDescription: string;
2448
+ noSubscriptionDescription: string;
2449
+ startFreeTrial: string;
2450
+ startTrialDays: string;
2451
+ trialBadge: string;
2452
+ };
2453
+ users: {
2454
+ emailPlaceholder: string;
2455
+ title: string;
2456
+ adminOnly: string;
2457
+ inviteByEmail: string;
2458
+ inviteButton: string;
2459
+ inviting: string;
2460
+ inviteSuccess: string;
2461
+ emailRequired: string;
2462
+ invalidEmail: string;
2463
+ inviteFailed: string;
2464
+ seatLimitReached: string;
2465
+ memberLimitReached: string;
2466
+ role: string;
2467
+ you: string;
2468
+ owner: string;
2469
+ noMembers: string;
2470
+ extraSeatCost: string;
2471
+ unknownUser: string;
2472
+ seats: string;
2473
+ members: string;
2474
+ included: string;
2475
+ perExtraSeat: string;
2476
+ maxMembers: string;
2477
+ available: string;
2478
+ noMemberLimit: string;
2479
+ seatHeading: string;
2480
+ limitReached: string;
2481
+ memberCount: string;
2482
+ subscriptionRequired: string;
2483
+ seatLimitMessage: string;
2484
+ settingsLimitMessage: string;
2485
+ memberLimitMessage: string;
2486
+ selectRole: string;
2487
+ inviteAs: string;
2488
+ };
2489
+ invoices: {
2490
+ title: string;
2491
+ description: string;
2492
+ pay: string;
2493
+ view: string;
2494
+ viewDetails: string;
2495
+ download: string;
2496
+ errorLoading: string;
2497
+ noInvoices: string;
2498
+ noInvoicesWithSub: string;
2499
+ paidAmount: string;
2500
+ na: string;
2501
+ status: {
2502
+ draft: string;
2503
+ open: string;
2504
+ paid: string;
2505
+ uncollectible: string;
2506
+ void: string;
2507
+ };
2508
+ };
2509
+ usage: {
2510
+ title: string;
2511
+ description: string;
2512
+ totalResources: string;
2513
+ overallUsage: string;
2514
+ inOverage: string;
2515
+ estOverageCost: string;
2516
+ overageDetected: string;
2517
+ overageDescription: string;
2518
+ overageUnits: string;
2519
+ rate: string;
2520
+ billableBlocks: string;
2521
+ estimatedCharge: string;
2522
+ noData: string;
2523
+ noDataHint: string;
2524
+ used: string;
2525
+ remaining: string;
2526
+ overLimit: string;
2527
+ percentUsed: string;
2528
+ availableRemaining: string;
2529
+ overLimitCount: string;
2530
+ overageWarning: string;
2531
+ fullyUsed: string;
2532
+ renewingSoon: string;
2533
+ almostFull: string;
2534
+ overage: string;
2535
+ errorLoading: string;
2536
+ perUnit: string;
2537
+ perUnits: string;
2538
+ rateDisplay: string;
2539
+ resourcesExceeded: string;
2540
+ estOverageCharges: string;
2541
+ overageRateDisplay: string;
2542
+ resetDateDisplay: string;
2543
+ daysRemainingDisplay: string;
2544
+ };
2545
+ profile: {
2546
+ email: string;
2547
+ name: string;
2548
+ language: string;
2549
+ country: string;
2550
+ currency: string;
2551
+ timezone: string;
2552
+ profileImage: string;
2553
+ success: string;
2554
+ nameMinLength: string;
2555
+ save: string;
2556
+ reset: string;
2557
+ };
2558
+ general: {
2559
+ ownerOnly: string;
2560
+ name: string;
2561
+ namePlaceholder: string;
2562
+ nameMinLength: string;
2563
+ billingCurrency: string;
2564
+ icon: string;
2565
+ iconDescription: string;
2566
+ imageUrl: string;
2567
+ imageUrlPlaceholder: string;
2568
+ imageUrlDescription: string;
2569
+ previewLabel: string;
2570
+ previewImageAlt: string;
2571
+ success: string;
2572
+ chooseEmoji: string;
2573
+ customImageUrl: string;
2574
+ updateWorkspace: string;
2575
+ };
2576
+ features: {
2577
+ title: string;
2578
+ ownerOnly: string;
2579
+ noFeatures: string;
2580
+ enabled: string;
2581
+ disabled: string;
2582
+ enabling: string;
2583
+ disabling: string;
2584
+ featureSuccess: string;
2585
+ updateSuccess: string;
2586
+ actionStatus: string;
2587
+ };
2588
+ danger: {
2589
+ title: string;
2590
+ adminOnly: string;
2591
+ deleteWorkspace: string;
2592
+ deleteConfirm: string;
2593
+ deleteWarning: string;
2594
+ deleting: string;
2595
+ deleteDescription: string;
2596
+ deleteConfirmDescription: string;
2597
+ failedToDelete: string;
2598
+ };
2599
+ notifications: {
2600
+ title: string;
2601
+ permissionDenied: string;
2602
+ notSupported: string;
2603
+ manageDescription: string;
2604
+ blocked: string;
2605
+ blockedDescription: string;
2606
+ pushTitle: string;
2607
+ pushEnabledDescription: string;
2608
+ pushDisabledDescription: string;
2609
+ enabling: string;
2610
+ disabling: string;
2611
+ enable: string;
2612
+ disable: string;
2613
+ toggleAction: string;
2614
+ pushDescription: string;
2615
+ deviceNote: string;
2616
+ prefsSaved: string;
2617
+ loadingPrefs: string;
2618
+ categories: {
2619
+ workspace: string;
2620
+ billing: string;
2621
+ };
2622
+ events: {
2623
+ workspace_invite: string;
2624
+ workspace_invite_desc: string;
2625
+ workspace_removed: string;
2626
+ workspace_removed_desc: string;
2627
+ workspace_role_changed: string;
2628
+ workspace_role_changed_desc: string;
2629
+ subscription_created: string;
2630
+ subscription_created_desc: string;
2631
+ subscription_upgraded: string;
2632
+ subscription_upgraded_desc: string;
2633
+ subscription_canceled: string;
2634
+ subscription_canceled_desc: string;
2635
+ subscription_suspended: string;
2636
+ subscription_suspended_desc: string;
2637
+ trial_ending: string;
2638
+ trial_ending_desc: string;
2639
+ trial_expired: string;
2640
+ trial_expired_desc: string;
2641
+ payment_failed: string;
2642
+ payment_failed_desc: string;
2643
+ payment_action_required: string;
2644
+ payment_action_required_desc: string;
2645
+ payment_succeeded: string;
2646
+ payment_succeeded_desc: string;
2647
+ };
2648
+ unblock: {
2649
+ firefox: {
2650
+ step1: string;
2651
+ step2: string;
2652
+ step3: string;
2653
+ step4: string;
2654
+ };
2655
+ safari: {
2656
+ step1: string;
2657
+ step2: string;
2658
+ step3: string;
2659
+ step4: string;
2660
+ };
2661
+ edge: {
2662
+ step1: string;
2663
+ step2: string;
2664
+ step3: string;
2665
+ step4: string;
2666
+ };
2667
+ chrome: {
2668
+ step1: string;
2669
+ step2: string;
2670
+ step3: string;
2671
+ step4: string;
2672
+ };
2673
+ };
2674
+ };
2675
+ quota: {
2676
+ includedOnly: string;
2677
+ includedWithOverage: string;
2678
+ includedHardLimit: string;
2679
+ unitFallback: string;
2680
+ };
2681
+ pricing: {
2682
+ title: string;
2683
+ description: string;
2684
+ currency: string;
2685
+ billingIn: string;
2686
+ noPlansCurrency: string;
2687
+ noPlansCurrencyHint: string;
2688
+ noPlans: string;
2689
+ free: string;
2690
+ included: string;
2691
+ save: string;
2692
+ current: string;
2693
+ processing: string;
2694
+ unavailable: string;
2695
+ selectCurrency: string;
2696
+ billingInterval: string;
2697
+ };
2698
+ beta: {
2699
+ logoAlt: string;
2700
+ nameLabel: string;
2701
+ emailLabel: string;
2702
+ submitText: string;
2703
+ submittingText: string;
2704
+ errorMessage: string;
2705
+ tryAgain: string;
2706
+ privacyConsent: string;
2707
+ privacyPolicy: string;
2708
+ and: string;
2709
+ termsOfService: string;
2710
+ };
2711
+ workspace: {
2712
+ switchTitle: string;
2713
+ switchDescription: string;
2714
+ notLoggedIn: string;
2715
+ availableWorkspaces: string;
2716
+ loadingWorkspaces: string;
2717
+ searchPlaceholder: string;
2718
+ noWorkspacesFound: string;
2719
+ noWorkspacesAvailable: string;
2720
+ switchTo: string;
2721
+ membersCount: string;
2722
+ createNew: string;
2723
+ createTitle: string;
2724
+ createDescription: string;
2725
+ workspaceName: string;
2726
+ workspaceNamePlaceholder: string;
2727
+ workspaceNameMinLength: string;
2728
+ workspaceIcon: string;
2729
+ iconDescription: string;
2730
+ chooseEmoji: string;
2731
+ customImageUrl: string;
2732
+ imageUrl: string;
2733
+ imageUrlPlaceholder: string;
2734
+ imageUrlDescription: string;
2735
+ invalidUrl: string;
2736
+ creating: string;
2737
+ createWorkspace: string;
2738
+ };
2739
+ dropdowns: {
2740
+ search: string;
2741
+ chooseOption: string;
2742
+ chooseCountry: string;
2743
+ searchCountry: string;
2744
+ chooseLanguage: string;
2745
+ searchLanguage: string;
2746
+ chooseCurrency: string;
2747
+ searchCurrency: string;
2748
+ chooseTimezone: string;
2749
+ searchTimezone: string;
2750
+ noResults: string;
2751
+ };
2752
+ push: {
2753
+ failedToSubscribe: string;
2754
+ failedToUnsubscribe: string;
2755
+ };
2756
+ permissions: {
2757
+ title: string;
2758
+ description: string;
2759
+ ownerOnly: string;
2760
+ save: string;
2761
+ saving: string;
2762
+ saveSuccess: string;
2763
+ };
2764
+ credits: {
2765
+ title: string;
2766
+ description: string;
2767
+ balance: string;
2768
+ available: string;
2769
+ totalGranted: string;
2770
+ totalConsumed: string;
2771
+ totalExpired: string;
2772
+ noCredits: string;
2773
+ noCreditsHint: string;
2774
+ buyCredits: string;
2775
+ buyAmount: string;
2776
+ purchasing: string;
2777
+ packages: string;
2778
+ noPackages: string;
2779
+ creditsAmount: string;
2780
+ validityDays: string;
2781
+ validityUnlimited: string;
2782
+ transactions: string;
2783
+ noTransactions: string;
2784
+ loadMore: string;
2785
+ viewAll: string;
2786
+ expiringSoon: string;
2787
+ expiringInDays: string;
2788
+ noExpiring: string;
2789
+ type: {
2790
+ plan_grant: string;
2791
+ pack_purchased: string;
2792
+ consumed: string;
2793
+ expired: string;
2794
+ admin_grant: string;
2795
+ admin_revoke: string;
2796
+ refund: string;
2797
+ };
2798
+ dialogTitle: string;
2799
+ dialogDescription: string;
2800
+ dialogDescriptionWorkspace: string;
2801
+ perCredit: string;
2802
+ purchaseSuccess: string;
2803
+ purchaseCanceled: string;
2804
+ purchaseFailed: string;
2805
+ errorLoading: string;
2806
+ insufficientCredits: string;
2807
+ };
2808
+ loading: {
2809
+ restoringSession: string;
2810
+ redirecting: string;
2811
+ signingIn: string;
2812
+ verifyingAccount: string;
2813
+ almostThere: string;
2814
+ };
2815
+ errors: {
2816
+ networkError: string;
2817
+ unauthorized: string;
2818
+ notFound: string;
2819
+ generic: string;
2820
+ fetchPlans: string;
2821
+ fetchPlanGroup: string;
2822
+ fetchPlanGroupVersion: string;
2823
+ fetchPlanGroupVersions: string;
2824
+ fetchSubscription: string;
2825
+ createCheckout: string;
2826
+ updateSubscription: string;
2827
+ fetchInvoices: string;
2828
+ fetchInvoice: string;
2829
+ openBillingPortal: string;
2830
+ cancelSubscription: string;
2831
+ resumeSubscription: string;
2832
+ recordUsage: string;
2833
+ fetchQuotaUsage: string;
2834
+ fetchAllQuotaUsage: string;
2835
+ fetchUsageLogs: string;
2836
+ fetchCreditBalance: string;
2837
+ consumeCredits: string;
2838
+ purchaseCredits: string;
2839
+ fetchCreditPackages: string;
2840
+ fetchCreditTransactions: string;
2841
+ fetchExpiringCredits: string;
2842
+ };
2843
+ }
2844
+ /**
2845
+ * Generates a union of all valid dot-separated key paths from SDKMessages.
2846
+ * Supports up to 4 levels of nesting (covers all current keys, e.g.
2847
+ * "notifications.unblock.firefox.step1").
2848
+ * Used to make `t()` calls compile-time safe with autocomplete.
2849
+ *
2850
+ * @example
2851
+ * TranslationKey → "settings.titles.profile" | "settings.common.refresh" | ...
2852
+ */
2853
+ type Level1 = keyof SDKMessages & string;
2854
+ type Level2 = {
2855
+ [K1 in Level1]: SDKMessages[K1] extends Record<string, unknown> ? `${K1}.${keyof SDKMessages[K1] & string}` : never;
2856
+ }[Level1];
2857
+ type Level3 = {
2858
+ [K1 in Level1]: SDKMessages[K1] extends Record<string, unknown> ? {
2859
+ [K2 in keyof SDKMessages[K1] & string]: SDKMessages[K1][K2] extends Record<string, unknown> ? `${K1}.${K2}.${keyof SDKMessages[K1][K2] & string}` : never;
2860
+ }[keyof SDKMessages[K1] & string] : never;
2861
+ }[Level1];
2862
+ type Level4 = {
2863
+ [K1 in Level1]: SDKMessages[K1] extends Record<string, unknown> ? {
2864
+ [K2 in keyof SDKMessages[K1] & string]: SDKMessages[K1][K2] extends Record<string, unknown> ? {
2865
+ [K3 in keyof SDKMessages[K1][K2] & string]: SDKMessages[K1][K2][K3] extends Record<string, unknown> ? `${K1}.${K2}.${K3}.${keyof SDKMessages[K1][K2][K3] & string}` : never;
2866
+ }[keyof SDKMessages[K1][K2] & string] : never;
2867
+ }[keyof SDKMessages[K1] & string] : never;
2868
+ }[Level1];
2869
+ /** Union of all valid translation key paths (e.g. "settings.titles.profile") */
2870
+ type TranslationKey = Level2 | Level3 | Level4;
2871
+
2216
2872
  /**
2217
2873
  * Verify that a webhook request came from BuildBase.
2218
2874
  *
@@ -2323,34 +2979,31 @@ declare function parseWebhookEvent(options: {
2323
2979
  * @example Next.js App Router — the entire integration:
2324
2980
  * ```ts
2325
2981
  * // lib/agent-ready.ts
2326
- * import type { AgentReadyConfig } from "@buildbase/sdk";
2982
+ * import { resolveAgentPath, type AgentReadyConfig } from "@buildbase/sdk";
2327
2983
  * export const agentConfig: AgentReadyConfig = {
2328
2984
  * serverUrl: process.env.BUILDBASE_URL!,
2329
2985
  * orgId: process.env.BUILDBASE_ORG_ID!,
2330
2986
  * siteUrl: "https://imejis.io",
2331
2987
  * site: { name: "Imejis", description: "Generate images from templates via API." },
2988
+ * robots: { contentSignals: { search: true, aiInput: true, aiTrain: false } },
2332
2989
  * };
2333
- *
2334
- * // app/.well-known/[...path]/route.ts
2335
- * import { resolveWellKnown } from "@buildbase/sdk";
2336
- * import { agentConfig } from "@/lib/agent-ready";
2337
- * export async function GET(req: Request) {
2338
- * const doc = await resolveWellKnown(new URL(req.url).pathname, agentConfig);
2990
+ * export async function serveAgentPath(req: Request): Promise<Response> {
2991
+ * const doc = await resolveAgentPath(new URL(req.url).pathname, agentConfig);
2339
2992
  * if (!doc) return new Response('{"error":"not_found"}', { status: 404 });
2340
2993
  * return new Response(doc.body, {
2341
2994
  * status: doc.status,
2342
- * headers: { "Content-Type": doc.contentType, "Cache-Control": doc.cacheControl },
2995
+ * headers: {
2996
+ * "Content-Type": doc.contentType,
2997
+ * "Cache-Control": doc.cacheControl,
2998
+ * ...(doc.vary ? { Vary: doc.vary } : {}),
2999
+ * },
2343
3000
  * });
2344
3001
  * }
2345
3002
  *
2346
- * // app/llms.txt/route.ts
2347
- * import { buildLlmsTxt, fetchAgentReadiness } from "@buildbase/sdk";
2348
- * import { agentConfig } from "@/lib/agent-ready";
2349
- * export async function GET() {
2350
- * const doc = buildLlmsTxt(agentConfig, await fetchAgentReadiness(agentConfig));
2351
- * if (!doc) return new Response("Not found", { status: 404 });
2352
- * return new Response(doc.body, { headers: { "Content-Type": doc.contentType } });
2353
- * }
3003
+ * // app/.well-known/[...path]/route.ts — plus identical two-liners at
3004
+ * // app/robots.txt/route.ts, app/llms.txt/route.ts, app/auth.md/route.ts, …
3005
+ * import { serveAgentPath } from "@/lib/agent-ready";
3006
+ * export const GET = serveAgentPath;
2354
3007
  * ```
2355
3008
  */
2356
3009
  /**
@@ -2361,21 +3014,16 @@ declare function parseWebhookEvent(options: {
2361
3014
  interface AgentReadinessBundle {
2362
3015
  /** False when the org has not enabled agent readiness — everything else absent. */
2363
3016
  enabled: boolean;
2364
- /** Pointer to the org's RFC 8414 authorization-server metadata. */
3017
+ /**
3018
+ * Pointer to the org's RFC 8414 authorization-server metadata. This is the
3019
+ * ONLY thing the platform owns and serves — discovery content (protected
3020
+ * resources, llms.txt, sitemap, API catalog, skills) is app-owned and
3021
+ * defined locally in {@link AgentReadyConfig}.
3022
+ */
2365
3023
  authorizationServer?: {
2366
3024
  issuer: string;
2367
3025
  metadataUrl: string;
2368
3026
  };
2369
- /**
2370
- * RFC 9728 protected-resource metadata objects, ready to serve. Each `metadata`
2371
- * is a complete document; `resource` is the canonical resource URI it describes.
2372
- */
2373
- protectedResources?: Array<{
2374
- resource: string;
2375
- metadata: Record<string, unknown>;
2376
- }>;
2377
- /** Org-authored llms.txt content, or null when unset. */
2378
- llmsTxt?: string | null;
2379
3027
  }
2380
3028
  /** An Agent Skill (Agent Skills Discovery RFC v0.2.0) published by this app. */
2381
3029
  interface AgentSkill {
@@ -2423,6 +3071,59 @@ interface McpServerCard {
2423
3071
  /** Documentation URL. */
2424
3072
  documentationUrl?: string;
2425
3073
  }
3074
+ /** One robots.txt policy group (a `User-agent:` block). */
3075
+ interface RobotsPolicy {
3076
+ /** User-agent(s) this group applies to, e.g. `'*'` or `'GPTBot'`. */
3077
+ userAgent: string | string[];
3078
+ /** Paths to allow, e.g. `['/']`. */
3079
+ allow?: string[];
3080
+ /** Paths to disallow, e.g. `['/api/']`. */
3081
+ disallow?: string[];
3082
+ /** Optional `Crawl-delay` (non-standard but widely honored). */
3083
+ crawlDelay?: number;
3084
+ }
3085
+ /**
3086
+ * Content Signals (https://contentsignals.org) — declares how crawlers may use
3087
+ * this site's content. Each flag renders as `<signal>=yes|no`; omitted flags
3088
+ * are not emitted (unset = no preference expressed).
3089
+ */
3090
+ interface ContentSignals {
3091
+ /** May content be indexed for search? → `search=yes|no`. */
3092
+ search?: boolean;
3093
+ /** May content be used as AI input (RAG, grounding)? → `ai-input=yes|no`. */
3094
+ aiInput?: boolean;
3095
+ /** May content be used for AI training? → `ai-train=yes|no`. */
3096
+ aiTrain?: boolean;
3097
+ }
3098
+ /** Configuration for `buildRobotsTxt`. Every field is optional. */
3099
+ interface RobotsConfig {
3100
+ /** Policy groups. Defaults to `[{ userAgent: '*', allow: ['/'] }]`. */
3101
+ policies?: RobotsPolicy[];
3102
+ /**
3103
+ * Stance toward known AI crawlers ({@link AI_BOT_USER_AGENTS}): `'allow'`
3104
+ * (default — an explicit `Allow: /` group per bot, so readiness checkers see
3105
+ * AI bots addressed), `'deny'` (a `Disallow: /` group per bot), or explicit
3106
+ * per-bot policies for finer control.
3107
+ */
3108
+ aiBots?: 'allow' | 'deny' | RobotsPolicy[];
3109
+ /** Content-Signal directive attached to the `User-agent: *` group. */
3110
+ contentSignals?: ContentSignals;
3111
+ /**
3112
+ * Sitemap URLs. Defaults to `${siteUrl}/sitemap.xml` when `config.sitemap`
3113
+ * is set; pass `[]` to emit no `Sitemap:` line.
3114
+ */
3115
+ sitemaps?: string[];
3116
+ }
3117
+ /** One URL entry for the generated sitemap.xml. */
3118
+ interface SitemapUrl {
3119
+ /** Absolute URL, or a path resolved against `siteUrl`. */
3120
+ loc: string;
3121
+ /** ISO-8601 last-modified date. */
3122
+ lastmod?: string;
3123
+ changefreq?: 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never';
3124
+ /** 0.0–1.0. */
3125
+ priority?: number;
3126
+ }
2426
3127
  /** Configuration for the agent-readiness discovery layer. */
2427
3128
  interface AgentReadyConfig {
2428
3129
  /** BuildBase server base URL, e.g. `https://api.buildbase.app` (no trailing slash needed). */
@@ -2475,8 +3176,46 @@ interface AgentReadyConfig {
2475
3176
  * `buildAuthMd` generates one from the OAuth metadata + site config.
2476
3177
  */
2477
3178
  authMd?: string;
3179
+ /**
3180
+ * Local `/llms.txt` content. Takes precedence over the org-authored llms.txt
3181
+ * from the platform bundle — use when the app owns richer llms.txt content.
3182
+ */
3183
+ llmsTxt?: string;
3184
+ /** robots.txt generation (`buildRobotsTxt`). Omitted = sane defaults. */
3185
+ robots?: RobotsConfig;
3186
+ /**
3187
+ * URLs for a minimal generated sitemap.xml (`buildSitemap`). Omit when the
3188
+ * app already generates sitemaps (e.g. next-sitemap) — the builder then
3189
+ * returns null and your own files win.
3190
+ */
3191
+ sitemap?: {
3192
+ urls: Array<string | SitemapUrl>;
3193
+ };
3194
+ /**
3195
+ * RFC 9728 protected resources this app serves, defined locally (app-owned).
3196
+ * When set, the SDK builds the `/.well-known/oauth-protected-resource`
3197
+ * document from this config — `authorization_servers` is derived from
3198
+ * `serverUrl`/`orgId` (the BuildBase issuer). Takes precedence over the
3199
+ * platform bundle. Omit to fall back to the org-configured bundle.
3200
+ */
3201
+ protectedResources?: Array<{
3202
+ /** The protected API's resource URI. Defaults to `siteUrl`. */
3203
+ resource?: string;
3204
+ /** Scopes this resource accepts (`scopes_supported`). */
3205
+ scopes?: string[];
3206
+ /** Human documentation URL (`resource_documentation`). */
3207
+ documentationUrl?: string;
3208
+ /** Bearer methods (`bearer_methods_supported`). Defaults to `['header']`. */
3209
+ bearerMethods?: string[];
3210
+ }>;
2478
3211
  /** TTL (seconds) for cached platform fetches. Default 300 (5 min). */
2479
3212
  cacheTtlSeconds?: number;
3213
+ /**
3214
+ * Timeout (ms) for platform fetches. Fail-soft on timeout, so a hung or slow
3215
+ * BuildBase server can't hang discovery routes forever. Default 5000; set `0`
3216
+ * to disable.
3217
+ */
3218
+ fetchTimeoutMs?: number;
2480
3219
  /** Injectable fetch, mainly for testing. Defaults to the global `fetch`. */
2481
3220
  fetch?: typeof fetch;
2482
3221
  }
@@ -2486,7 +3225,15 @@ interface DiscoveryDocument {
2486
3225
  contentType: string;
2487
3226
  body: string;
2488
3227
  cacheControl: string;
3228
+ /** Value for a `Vary` response header, when the body is negotiated. */
3229
+ vary?: string;
2489
3230
  }
3231
+ /**
3232
+ * User-agent strings of the known AI crawlers/agents that agent-readiness
3233
+ * checkers look for in robots.txt (`buildRobotsTxt` emits a policy group per
3234
+ * entry when `robots.aiBots` is `'allow'`/`'deny'`).
3235
+ */
3236
+ declare const AI_BOT_USER_AGENTS: readonly string[];
2490
3237
  /**
2491
3238
  * SHA-256 of `content` as `sha256:<hex>`, via the shared pure-JS hash (no Web
2492
3239
  * Crypto / Node `crypto`), so output is identical on every runtime.
@@ -2500,7 +3247,7 @@ declare function sha256Digest(content: string): string;
2500
3247
  * simply see the app as not (yet) agent-ready.
2501
3248
  */
2502
3249
  declare function fetchAgentReadiness(config: AgentReadyConfig): Promise<AgentReadinessBundle>;
2503
- /** Clear the in-memory agent-readiness cache (mainly for tests). */
3250
+ /** Clear the in-memory agent-readiness caches (mainly for tests). */
2504
3251
  declare function clearAgentReadinessCache(): void;
2505
3252
  /**
2506
3253
  * The Agent Card served at `/.well-known/agent.json`. A stable, machine-readable
@@ -2510,16 +3257,24 @@ declare function buildAgentCard(config: AgentReadyConfig, bundle: AgentReadiness
2510
3257
  /**
2511
3258
  * Resolve the RFC 9728 protected-resource metadata for a request path, or null
2512
3259
  * if no configured resource maps to it.
3260
+ *
3261
+ * App-owned and local: built entirely from `config.protectedResources`, with
3262
+ * `authorization_servers` derived from `serverUrl`/`orgId` (the BuildBase
3263
+ * issuer). No platform round-trip.
2513
3264
  */
2514
- declare function buildProtectedResourceMetadata(requestPath: string, config: AgentReadyConfig, bundle: AgentReadinessBundle): DiscoveryDocument | null;
3265
+ declare function buildProtectedResourceMetadata(requestPath: string, config: AgentReadyConfig): DiscoveryDocument | null;
2515
3266
  /** Agent Skills discovery index (Agent Skills Discovery RFC v0.2.0). */
2516
3267
  declare function buildAgentSkillsIndex(config: AgentReadyConfig): DiscoveryDocument | null;
2517
3268
  /** Serve a single skill's SKILL.md by request path, or null if none matches. */
2518
3269
  declare function buildSkillMd(requestPath: string, config: AgentReadyConfig): DiscoveryDocument | null;
2519
3270
  /** security.txt (RFC 9116), or null when not configured. */
2520
3271
  declare function buildSecurityTxt(config: AgentReadyConfig): DiscoveryDocument | null;
2521
- /** The org-authored llms.txt, or null when the org hasn't set one. */
2522
- declare function buildLlmsTxt(config: AgentReadyConfig, bundle: AgentReadinessBundle): DiscoveryDocument | null;
3272
+ /**
3273
+ * The `/llms.txt` document from `config.llmsTxt` (app-authored). Returns null
3274
+ * when not set — serve your own static file instead. llms.txt is app content,
3275
+ * not platform-managed.
3276
+ */
3277
+ declare function buildLlmsTxt(config: AgentReadyConfig): DiscoveryDocument | null;
2523
3278
  /**
2524
3279
  * API Catalog (RFC 9727) as a `linkset+json` document for
2525
3280
  * `/.well-known/api-catalog`. Returns null when no APIs are configured.
@@ -2537,6 +3292,42 @@ declare function buildMcpServerCard(config: AgentReadyConfig): DiscoveryDocument
2537
3292
  * there is nothing to describe (no authorizationServer and no override).
2538
3293
  */
2539
3294
  declare function buildAuthMd(config: AgentReadyConfig, bundle: AgentReadinessBundle): DiscoveryDocument | null;
3295
+ /**
3296
+ * robots.txt with AI-bot policy groups, Content Signals, and sitemap
3297
+ * references. Always returns a document — with no `config.robots` it emits an
3298
+ * allow-all default policy plus an explicit `Allow: /` group per known AI bot.
3299
+ */
3300
+ declare function buildRobotsTxt(config: AgentReadyConfig): DiscoveryDocument;
3301
+ /**
3302
+ * A minimal sitemap.xml from `config.sitemap.urls`, or null when not
3303
+ * configured. Meant for API-first apps that would otherwise have no sitemap —
3304
+ * apps with real content pipelines (e.g. next-sitemap) should keep those and
3305
+ * omit `config.sitemap`.
3306
+ */
3307
+ declare function buildSitemap(config: AgentReadyConfig): DiscoveryDocument | null;
3308
+ /**
3309
+ * True when an `Accept` header prefers markdown (`text/markdown` /
3310
+ * `text/x-markdown`) over `text/html` — q-value aware, so
3311
+ * `text/html;q=0.5, text/markdown` is markdown but `text/markdown;q=0.1,
3312
+ * text/html` is not. A bare wildcard does not count as a markdown preference.
3313
+ */
3314
+ declare function wantsMarkdown(acceptHeader: string | null | undefined): boolean;
3315
+ /**
3316
+ * Markdown content negotiation: pick the markdown or HTML variant of a page
3317
+ * per the `Accept` header. The returned document carries `vary: 'Accept'` —
3318
+ * forward it so caches key on the header.
3319
+ */
3320
+ declare function negotiateMarkdown(acceptHeader: string | null | undefined, variants: {
3321
+ html: string;
3322
+ markdown: string;
3323
+ }, config?: Pick<AgentReadyConfig, 'cacheTtlSeconds'>): DiscoveryDocument;
3324
+ /**
3325
+ * Value for a `Link` response header advertising this app's discovery
3326
+ * documents (llms.txt, Agent Card, and — when configured — sitemap, API
3327
+ * catalog, MCP server card). Sync and pure (no platform fetch), so it's safe
3328
+ * in edge middleware.
3329
+ */
3330
+ declare function buildDiscoveryLinkHeader(config: AgentReadyConfig): string;
2540
3331
  /**
2541
3332
  * Resolve any `.well-known` request path to its discovery document, or null if
2542
3333
  * this app serves nothing there (caller should 404).
@@ -2545,10 +3336,18 @@ declare function buildAuthMd(config: AgentReadyConfig, bundle: AgentReadinessBun
2545
3336
  * oauth-authorization-server (pointer), agent-skills index + SKILL.md,
2546
3337
  * security.txt, api-catalog (RFC 9727), and the MCP server card.
2547
3338
  *
2548
- * Root-level docs are served via their own builders (they aren't under
2549
- * `.well-known`): `buildLlmsTxt` for `/llms.txt` and `buildAuthMd` for `/auth.md`.
3339
+ * Root-level docs (`/robots.txt`, `/llms.txt`, `/auth.md`, …) are not handled
3340
+ * here — use {@link resolveAgentPath}, which covers both, for new wiring.
2550
3341
  */
2551
3342
  declare function resolveWellKnown(requestPath: string, config: AgentReadyConfig): Promise<DiscoveryDocument | null>;
3343
+ /**
3344
+ * Superset of {@link resolveWellKnown}: resolves ANY agent-facing path — the
3345
+ * root-level documents (`/robots.txt`, `/sitemap.xml`, `/llms.txt`,
3346
+ * `/auth.md`, `/security.txt`) plus everything under `/.well-known/*`. One
3347
+ * catch-all (or middleware) wired to this function covers the app's entire
3348
+ * agent-readiness surface. Returns null for paths this app doesn't serve.
3349
+ */
3350
+ declare function resolveAgentPath(requestPath: string, config: AgentReadyConfig): Promise<DiscoveryDocument | null>;
2552
3351
  /** A WebMCP tool definition exposed to in-page agents via `navigator.modelContext`. */
2553
3352
  interface WebMcpTool {
2554
3353
  name: string;
@@ -2635,6 +3434,13 @@ interface AppTokenRequestClaims {
2635
3434
  resource?: string[];
2636
3435
  /** The OAuth2 client's display title. */
2637
3436
  clientTitle?: string;
3437
+ /**
3438
+ * Per-user BuildBase session bound to this grant. Embed it ENCRYPTED in the
3439
+ * token you mint (JWTs are signed, not encrypted) and never store it — your
3440
+ * MCP/agent endpoints decrypt it per request to call BuildBase as this user
3441
+ * (`buildbase.withSession(...)`). Fresh on every grant, including refresh.
3442
+ */
3443
+ sessionId?: string;
2638
3444
  [claim: string]: unknown;
2639
3445
  }
2640
3446
  /** The payload BuildBase sends to `applicationRevokeUrl`. */
@@ -2644,14 +3450,43 @@ interface AppRevokeRequestClaims {
2644
3450
  reason: string;
2645
3451
  [claim: string]: unknown;
2646
3452
  }
3453
+ /** Options for {@link verifyClientJwt} (all optional; secure defaults). */
3454
+ interface VerifyClientJwtOptions {
3455
+ /** Allowed clock skew in seconds for `exp`/`nbf`. Default 60. */
3456
+ clockToleranceSec?: number;
3457
+ /**
3458
+ * Require a numeric `exp` claim. Default **true** — a JWT with no expiry
3459
+ * would never expire, so a leaked token stays valid forever. Set `false`
3460
+ * only for a token type you know is intentionally non-expiring.
3461
+ */
3462
+ requireExp?: boolean;
3463
+ /** If set, `iss` must equal this value (RFC 7519 issuer check). */
3464
+ issuer?: string;
3465
+ /** If set, `aud` must equal (or, for an array `aud`, include) this value. */
3466
+ audience?: string;
3467
+ }
2647
3468
  /**
2648
3469
  * Verify a BuildBase-issued HS256 JWT (signed with the client secret) and return
2649
- * its payload. Checks the signature (timing-safe), the algorithm, and `exp`/`nbf`.
3470
+ * its payload. Checks the signature (timing-safe), the algorithm, `exp`/`nbf`,
3471
+ * and — by default — that an `exp` is present at all. Optionally pins `iss`/`aud`.
2650
3472
  * Throws {@link AppBridgeError} on any failure.
3473
+ *
3474
+ * The third argument accepts either the legacy `clockToleranceSec` number or a
3475
+ * {@link VerifyClientJwtOptions} object.
2651
3476
  */
2652
- declare function verifyClientJwt(token: string, clientSecret: string, clockToleranceSec?: number): Record<string, any>;
3477
+ declare function verifyClientJwt(token: string, clientSecret: string, optionsOrTolerance?: number | VerifyClientJwtOptions): Record<string, any>;
2653
3478
  /** Extract the token from an `Authorization: Bearer <token>` header. */
2654
3479
  declare function extractBearerToken(authorization: string | null | undefined): string | null;
3480
+ /**
3481
+ * Sign an HS256 JWT — the symmetric counterpart of {@link verifyClientJwt}.
3482
+ * Sets `iat` and `exp` (from `expiresInSec`, default 3600) unless the payload
3483
+ * already carries them. The intended use is minting the app's own agent access
3484
+ * tokens in an `applicationTokenUrl` handler, embedding whatever claims the
3485
+ * MCP/API layer needs to verify later (e.g. `sub`, `scope`, a session id).
3486
+ */
3487
+ declare function signClientJwt(payload: Record<string, unknown>, secret: string, options?: {
3488
+ expiresInSec?: number;
3489
+ }): string;
2655
3490
  interface VerifyOptions {
2656
3491
  /** The `Authorization` header value from the incoming request. */
2657
3492
  authorization: string | null | undefined;
@@ -2726,20 +3561,6 @@ declare function handleAppRevokeRequest(options: {
2726
3561
  success: boolean;
2727
3562
  message?: string;
2728
3563
  }>>;
2729
- /**
2730
- * Build the 401 an agent should receive when it calls your protected API without
2731
- * a valid token. The `WWW-Authenticate: Bearer resource_metadata=...` header
2732
- * points the agent at your `/.well-known/oauth-protected-resource` document,
2733
- * bootstrapping the OAuth discovery flow (RFC 9728 §5.1, RFC 6750 §3).
2734
- *
2735
- * @example
2736
- * ```ts
2737
- * if (!isValid(token)) {
2738
- * const c = bearerChallenge({ resourceMetadataUrl: "https://imejis.io/.well-known/oauth-protected-resource" });
2739
- * res.writeHead(c.status, c.headers).end(c.body);
2740
- * }
2741
- * ```
2742
- */
2743
3564
  declare function bearerChallenge(options: {
2744
3565
  resourceMetadataUrl: string;
2745
3566
  error?: 'invalid_token' | 'insufficient_scope' | string;
@@ -3034,5 +3855,5 @@ interface BuildBaseResult extends ScopedActions {
3034
3855
  }
3035
3856
  declare function BuildBase(config: BuildBaseConfig): BuildBaseResult;
3036
3857
 
3037
- export { ApiVersion, AppBridgeError, AuthApi, AuthStatus, BBAction, BBScreen, BBStatus, BB_PARAM, BaseApi, BetaForm, BillingIntervals, BuildBase, CURRENCY_DISPLAY, CURRENCY_FLAG, CreditBucketSource, CreditBucketStatus, CreditTransactionType, DEFAULT_ROLE_PERMISSIONS, DunningState, EventEmitter, InvoiceStatuses, PLAN_CURRENCY_CODES, PLAN_CURRENCY_OPTIONS, PUSH_SERVICE_WORKER_SCRIPT, Permission, PushApi, SDKEvent, SettingsApi, SubscriptionItemType, SubscriptionStatus, UserApi, WorkspaceApi, appTokenFailure, appTokenSuccess, bearerChallenge, buildAgentCard, buildAgentSkillsIndex, buildApiCatalog, buildAuthMd, buildLlmsTxt, buildMcpServerCard, buildProtectedResourceMetadata, buildSecurityTxt, buildSkillMd, calculateBillableSeats, calculateSeatOverageCents, calculateTotalSubscriptionCents, cleanBBParams, clearAgentReadinessCache, clearAuthIntent, consumeAuthIntent, createBBUrl, createCheckoutRedirectUrls, createCreditPurchaseRedirectUrls, BuildBase as default, eventEmitter, extractBearerToken, fetchAgentReadiness, formatCents, formatOverageRate, formatOverageRateWithLabel, formatQuotaIncludedOverage, formatQuotaWithPrice, getAvailableCurrenciesFromPlans, getBasePriceCents, getBillingIntervalAndCurrencyFromPriceId, getCurrencyFlag, getCurrencySymbol, getDisplayCurrency, getPerSeatPriceCents, getPricingVariant, getQuotaDisplayValue, getQuotaDisplayWithVariant, getQuotaOverageCents, getQuotaUnitLabelFromName, getSeatPricing, getStripePriceIdForInterval, handleAppRevokeRequest, handleAppTokenRequest, hasPermission, invalidateCreditBalance, invalidateQuotaUsage, invalidateSubscription, parseWebhookEvent, provideWebMcpTools, readBBParams, resolveMaxUsers, resolvePermissions, resolveWellKnown, safeRedirect, saveAuthIntent, sha256Digest, validateInvite, validateRedirectUrl, verifyAppRevokeRequest, verifyAppTokenRequest, verifyClientJwt, verifyWebhookSignature };
3038
- export type { AgentReadinessBundle, AgentReadyConfig, AgentSkill, ApiCatalogApi, AppRevokeRequestClaims, AppTokenRequestClaims, AppTokenResponseBody, AppTokenResult, BBActionType, BBScreenType, BBStatusType, BetaFormData, BetaFormResponse, BillingInterval, BuildBaseConfig, BuildBaseResult, BuildBaseSession, CheckoutResult, CreditActions, CreditBucketSourceType, CreditBucketStatusType, CreditTransactionTypeValue, DiscoveryDocument, DunningStateType, EventData, EventType, FeatureActions, FormatQuotaWithPriceOptions, GetCheckoutStripeParams, HandlerResult, IAllQuotaUsageResponse, IBaseApiConfig, IBasePricing, IBetaConfig, ICheckoutSessionRequest, ICheckoutSessionResponse, ICheckoutStripeOptions, IConsumeCreditsRequest, IConsumeCreditsResponse, ICreditBalance, ICreditBucket, ICreditBucketsQuery, ICreditBucketsResponse, ICreditPackage, ICreditPackagePricingVariant, ICreditPurchaseRequest, ICreditPurchaseResponse, ICreditTransaction, ICreditTransactionsQuery, ICreditTransactionsResponse, IEventCallbacks, IExpiringCreditsResponse, IInvoice, IInvoiceListResponse, IInvoiceResponse, IOsConfig, IOsState, IPlan, IPlanGroup, IPlanGroupInfo, IPlanGroupLatestVersion, IPlanGroupResponse, IPlanGroupVersion, IPlanGroupVersionWithPlans, IPlanGroupVersionsResponse, IPlanVersion, IPlanVersionSummary, IPlanVersionWithPlan, IPricingVariant, IPublicCreditPackage, IPublicCreditPackagesResponse, IPublicPlanItem, IPublicPlanItemCategory, IPublicPlanVersion, IPublicPlansResponse, IQuotaByInterval, IQuotaIntervalValue, IQuotaOveragePriceIdsByInterval, IQuotaOveragesByInterval, IQuotaUsageStatus, IQuotaUsageStatusResponse, IRecordUsageRequest, IRecordUsageResponse, IStripePricesByInterval, ISubscription, ISubscriptionItem, ISubscriptionResponse, ISubscriptionUpdateRequest, ISubscriptionUpdateResponse, IUsageLogEntry, IUsageLogsQuery, IUsageLogsResponse, InviteBlockReason, InviteValidation, InvoiceActions, InvoiceStatus, InvoiceStatusType, MaxUsersConfig, McpServerCard, NotificationData, NotificationEvent, NotificationResult, OnWorkspaceChangeParams, PermissionActions, PermissionContext, PermissionKey, PlanActions, PlanVersionWithPricingVariants, QuotaDisplayValue, QuotaDisplayWithOverage, RolePermissionMap, ScopedActions, SettingsActions, SubscriptionActions, SubscriptionItemTypeValue, SubscriptionStatusType, UsageActions, UserActions, UserCreatedEventData, UserUpdatedEventData, WebMcpTool, WorkspaceActions, WorkspaceChangedEventData, WorkspaceCreatedEventData, WorkspaceDeletedEventData, WorkspaceUpdatedEventData, WorkspaceUserAddedEventData, WorkspaceUserRemovedEventData, WorkspaceUserRoleChangedEventData };
3858
+ export { AI_BOT_USER_AGENTS, ApiVersion, AppBridgeError, AuthApi, AuthStatus, BBAction, BBScreen, BBStatus, BB_PARAM, BaseApi, BetaForm, BillingIntervals, BuildBase, CURRENCY_DISPLAY, CURRENCY_FLAG, CreditBucketSource, CreditBucketStatus, CreditTransactionType, DEFAULT_ROLE_PERMISSIONS, DunningState, EventEmitter, InvoiceStatuses, PLAN_CURRENCY_CODES, PLAN_CURRENCY_OPTIONS, PUSH_SERVICE_WORKER_SCRIPT, Permission, PushApi, SDKEvent, SettingsApi, SubscriptionItemType, SubscriptionStatus, UserApi, WorkspaceApi, appTokenFailure, appTokenSuccess, bearerChallenge, buildAgentCard, buildAgentSkillsIndex, buildApiCatalog, buildAuthMd, buildDiscoveryLinkHeader, buildLlmsTxt, buildMcpServerCard, buildProtectedResourceMetadata, buildRobotsTxt, buildSecurityTxt, buildSitemap, buildSkillMd, calculateBillableSeats, calculateSeatOverageCents, calculateTotalSubscriptionCents, cleanBBParams, clearAgentReadinessCache, clearAuthIntent, consumeAuthIntent, createBBUrl, createCheckoutRedirectUrls, createCreditPurchaseRedirectUrls, BuildBase as default, eventEmitter, extractBearerToken, fetchAgentReadiness, formatCents, formatOverageRate, formatOverageRateWithLabel, formatQuotaIncludedOverage, formatQuotaWithPrice, getAvailableCurrenciesFromPlans, getBasePriceCents, getBillingIntervalAndCurrencyFromPriceId, getCurrencyFlag, getCurrencySymbol, getDisplayCurrency, getPerSeatPriceCents, getPricingVariant, getQuotaDisplayValue, getQuotaDisplayWithVariant, getQuotaOverageCents, getQuotaUnitLabelFromName, getSeatPricing, getStripePriceIdForInterval, handleAppRevokeRequest, handleAppTokenRequest, hasPermission, invalidateCreditBalance, invalidateQuotaUsage, invalidateSubscription, negotiateMarkdown, parseWebhookEvent, provideWebMcpTools, readBBParams, resolveAgentPath, resolveMaxUsers, resolvePermissions, resolveWellKnown, safeRedirect, saveAuthIntent, sha256Digest, signClientJwt, validateInvite, validateRedirectUrl, verifyAppRevokeRequest, verifyAppTokenRequest, verifyClientJwt, verifyWebhookSignature, wantsMarkdown };
3859
+ export type { AgentReadinessBundle, AgentReadyConfig, AgentSkill, ApiCatalogApi, AppRevokeRequestClaims, AppTokenRequestClaims, AppTokenResponseBody, AppTokenResult, BBActionType, BBScreenType, BBStatusType, BetaFormData, BetaFormResponse, BillingInterval, BuildBaseConfig, BuildBaseResult, BuildBaseSession, CheckoutResult, ContentSignals, CreditActions, CreditBucketSourceType, CreditBucketStatusType, CreditTransactionTypeValue, DiscoveryDocument, DunningStateType, EventData, EventType, FeatureActions, FormatQuotaWithPriceOptions, GetCheckoutStripeParams, HandlerResult, IAllQuotaUsageResponse, IBaseApiConfig, IBasePricing, IBetaConfig, ICheckoutSessionRequest, ICheckoutSessionResponse, ICheckoutStripeOptions, IConsumeCreditsRequest, IConsumeCreditsResponse, ICreditBalance, ICreditBucket, ICreditBucketsQuery, ICreditBucketsResponse, ICreditPackage, ICreditPackagePricingVariant, ICreditPurchaseRequest, ICreditPurchaseResponse, ICreditTransaction, ICreditTransactionsQuery, ICreditTransactionsResponse, IEventCallbacks, IExpiringCreditsResponse, IInvoice, IInvoiceListResponse, IInvoiceResponse, IOsConfig, IOsState, IPlan, IPlanGroup, IPlanGroupInfo, IPlanGroupLatestVersion, IPlanGroupResponse, IPlanGroupVersion, IPlanGroupVersionWithPlans, IPlanGroupVersionsResponse, IPlanVersion, IPlanVersionSummary, IPlanVersionWithPlan, IPricingVariant, IPublicCreditPackage, IPublicCreditPackagesResponse, IPublicPlanItem, IPublicPlanItemCategory, IPublicPlanVersion, IPublicPlansResponse, IQuotaByInterval, IQuotaIntervalValue, IQuotaOveragePriceIdsByInterval, IQuotaOveragesByInterval, IQuotaUsageStatus, IQuotaUsageStatusResponse, IRecordUsageRequest, IRecordUsageResponse, ISettings, IStripePricesByInterval, ISubscription, ISubscriptionItem, ISubscriptionResponse, ISubscriptionUpdateRequest, ISubscriptionUpdateResponse, IUsageLogEntry, IUsageLogsQuery, IUsageLogsResponse, IUser, IWorkspace, InviteBlockReason, InviteValidation, InvoiceActions, InvoiceStatus, InvoiceStatusType, MaxUsersConfig, McpServerCard, NotificationData, NotificationEvent, NotificationResult, OnWorkspaceChangeParams, PermissionActions, PermissionContext, PermissionKey, PlanActions, PlanVersionWithPricingVariants, QuotaDisplayValue, QuotaDisplayWithOverage, RobotsConfig, RobotsPolicy, RolePermissionMap, ScopedActions, SettingsActions, SitemapUrl, SubscriptionActions, SubscriptionItemTypeValue, SubscriptionStatusType, TranslationKey, UsageActions, UserActions, UserCreatedEventData, UserUpdatedEventData, WebMcpTool, WorkspaceActions, WorkspaceChangedEventData, WorkspaceCreatedEventData, WorkspaceDeletedEventData, WorkspaceUpdatedEventData, WorkspaceUserAddedEventData, WorkspaceUserRemovedEventData, WorkspaceUserRoleChangedEventData };