deepline 0.3.579 → 0.3.581
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundling-sources/sdk/src/client-core.ts +13 -2
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/monitors/billing/public-pricing.ts +470 -15
- package/dist/bundling-sources/shared_libs/monitors/billing/tamradar.ts +12 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/types.ts +59 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-capability.ts +5 -3
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +42 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox.ts +49 -11
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-lane.ts +13 -4
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +139 -16
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +39 -2
- package/dist/bundling-sources/shared_libs/play-runtime/transient-service-error.ts +12 -0
- package/dist/bundling-sources/shared_libs/plays/sandbox-runtime-limits.ts +20 -0
- package/dist/cli/{agents-D5RZEVXQ.js → agents-UDTRMWPA.js} +81 -39
- package/dist/cli/{agents-FJTRTYCL.mjs → agents-VDQSVDSM.mjs} +51 -9
- package/dist/cli/{auth-OMYIDVXZ.mjs → auth-SRN5FXUQ.mjs} +5 -5
- package/dist/cli/auth-UYQHRHYR.js +44 -0
- package/dist/cli/{billing-EWFUDLQ7.js → billing-HGHIOFSA.js} +162 -159
- package/dist/cli/{billing-XK3LBNYS.mjs → billing-PR2SIEJM.mjs} +69 -66
- package/dist/cli/{chunk-I2TSRLOI.mjs → chunk-2MIJMDGF.mjs} +1 -1
- package/dist/cli/{chunk-TVAFWAOQ.js → chunk-2RLMHWXW.js} +3 -3
- package/dist/cli/{chunk-OSRATALX.mjs → chunk-3FMGBMT3.mjs} +1 -1
- package/dist/cli/{chunk-KIIOKQFY.mjs → chunk-3I6GA5QW.mjs} +7 -3
- package/dist/cli/{chunk-UYCBG75H.js → chunk-3LP7J63L.js} +5 -5
- package/dist/cli/{chunk-QA55PGJH.js → chunk-3S5KFHQH.js} +7 -7
- package/dist/cli/{chunk-SZIWFQI2.mjs → chunk-46EBSUZF.mjs} +3 -3
- package/dist/cli/{chunk-7HOYKXVY.js → chunk-5XVDZVCR.js} +217 -213
- package/dist/cli/{chunk-PLWZ3NB7.js → chunk-6U3THMRI.js} +5 -5
- package/dist/cli/{chunk-LRZGS6RZ.mjs → chunk-7MMEW2WU.mjs} +1 -1
- package/dist/cli/{chunk-KWQHQG53.js → chunk-7VOSQARZ.js} +6 -6
- package/dist/cli/{chunk-72TWLORR.js → chunk-A4IOPFEJ.js} +3 -3
- package/dist/cli/{chunk-S2OXA7QS.mjs → chunk-ALXIC5U5.mjs} +7 -7
- package/dist/cli/{chunk-6EVVUVU3.mjs → chunk-BDNQDWGI.mjs} +2 -2
- package/dist/cli/{chunk-HEZW2IDK.js → chunk-BQL34VOQ.js} +279 -276
- package/dist/cli/{chunk-FKXSIIR4.js → chunk-BULUFFST.js} +15 -15
- package/dist/cli/{chunk-NONMY5CY.mjs → chunk-CDIMI54H.mjs} +2 -2
- package/dist/cli/{chunk-NWZU6HL4.js → chunk-CN4MXBZ3.js} +13 -13
- package/dist/cli/{chunk-XTM6NOJ6.js → chunk-CNRPE3AE.js} +53 -53
- package/dist/cli/{chunk-LYBZLA6F.mjs → chunk-DZMQV5FL.mjs} +2 -2
- package/dist/cli/{chunk-NKUXW4WB.js → chunk-E2EGQNOS.js} +2 -2
- package/dist/cli/{chunk-BLEYV4BJ.js → chunk-E5ITZIWK.js} +21 -21
- package/dist/cli/{chunk-N6X2UKYQ.mjs → chunk-E5O4CMHZ.mjs} +2 -2
- package/dist/cli/{chunk-X6LPC3SU.mjs → chunk-EHTD65FE.mjs} +1 -1
- package/dist/cli/{chunk-E2G2DNAB.js → chunk-EP3GZAHK.js} +7 -7
- package/dist/cli/{chunk-NOMO5GPI.js → chunk-FXSDDEAR.js} +1 -1
- package/dist/cli/{chunk-AP7PIGL5.js → chunk-INRXX4SX.js} +41 -41
- package/dist/cli/{chunk-XQYBBCFI.mjs → chunk-INXRW5AF.mjs} +2 -2
- package/dist/cli/{chunk-7JMCRYXU.js → chunk-IT3F7P6O.js} +10 -10
- package/dist/cli/{chunk-LYJ2NSHD.js → chunk-J6ITN2X6.js} +13 -13
- package/dist/cli/{chunk-LCPJR3IY.js → chunk-JQK42HZQ.js} +2 -2
- package/dist/cli/{chunk-HGUFTSB5.mjs → chunk-KDITCSPN.mjs} +27 -1
- package/dist/cli/{chunk-VFIIRK7S.mjs → chunk-KLBIHDZB.mjs} +2 -2
- package/dist/cli/{chunk-Y2ND6PPW.js → chunk-KO6OLYSD.js} +48 -48
- package/dist/cli/{chunk-K2BU67UC.js → chunk-LJZESBNY.js} +2 -2
- package/dist/cli/{chunk-PGRRMVQ5.js → chunk-MOZDEYQC.js} +2 -1
- package/dist/cli/{chunk-DH736ASH.js → chunk-MSCYYFLY.js} +20 -20
- package/dist/cli/{chunk-JFS4KHA3.mjs → chunk-N5VJVVVV.mjs} +5 -5
- package/dist/cli/{chunk-G5CZDRY3.js → chunk-O5FIWG2O.js} +26 -26
- package/dist/cli/{chunk-YCWRKSLB.mjs → chunk-OVJWDFIL.mjs} +2 -2
- package/dist/cli/{chunk-WQQQP3FH.mjs → chunk-P5ZZY4RM.mjs} +4 -4
- package/dist/cli/{chunk-WWSGXX6U.js → chunk-PLGJG5FX.js} +5 -5
- package/dist/cli/{chunk-BZ4M7OFO.mjs → chunk-QXQBTTRD.mjs} +1 -1
- package/dist/cli/{chunk-F57NDSKT.mjs → chunk-RA3BWUTD.mjs} +5 -5
- package/dist/cli/{chunk-Q4VKMF3B.js → chunk-S2YKIWCD.js} +17 -17
- package/dist/cli/{chunk-DTQBQSUU.mjs → chunk-SECFDB27.mjs} +1 -0
- package/dist/cli/{chunk-6MIEJJSO.js → chunk-SNYH4QY2.js} +4 -4
- package/dist/cli/{chunk-6GON36H3.mjs → chunk-SZ76UE7C.mjs} +17 -14
- package/dist/cli/{chunk-6DMGKAWO.mjs → chunk-ULU4MEXN.mjs} +2 -2
- package/dist/cli/{chunk-ABH6PUDZ.js → chunk-VJR4CKYJ.js} +23 -23
- package/dist/cli/{chunk-TFNDOH4W.mjs → chunk-VNW454PP.mjs} +1 -1
- package/dist/cli/{chunk-7SZCJC4R.mjs → chunk-VTPMBOHZ.mjs} +2 -2
- package/dist/cli/{chunk-6NYHMXC7.mjs → chunk-VVENTTSA.mjs} +1 -1
- package/dist/cli/{chunk-OOGP737I.js → chunk-VWPM4OIC.js} +20 -20
- package/dist/cli/{chunk-27ZYRIQC.mjs → chunk-WCNJSZHC.mjs} +5 -5
- package/dist/cli/{chunk-KQAEXBVQ.mjs → chunk-WS5ZX4RB.mjs} +3 -3
- package/dist/cli/{chunk-SUHCW7U5.mjs → chunk-WVFDPC4K.mjs} +3 -3
- package/dist/cli/{chunk-44NTNNKC.js → chunk-Y36SQMSN.js} +28 -2
- package/dist/cli/{chunk-LV2LGW2Q.mjs → chunk-YTPXKG4C.mjs} +1 -1
- package/dist/cli/{chunk-3Z4TVZE7.mjs → chunk-Z3MJX3PP.mjs} +1 -1
- package/dist/cli/{chunk-LQ45LCH7.js → chunk-ZAKNDIK7.js} +9 -9
- package/dist/cli/{chunk-M4YWN5BT.mjs → chunk-ZTKLJADJ.mjs} +4 -4
- package/dist/cli/command-docs.js +4 -4
- package/dist/cli/command-docs.mjs +3 -3
- package/dist/cli/concurrent-runs-help-QWDTLZUX.js +22 -0
- package/dist/cli/{concurrent-runs-help-IQBZBTD5.mjs → concurrent-runs-help-Z27MIIH3.mjs} +6 -6
- package/dist/cli/{csv-T7TWLIGD.js → csv-4TP36F5O.js} +13 -13
- package/dist/cli/{csv-6BEOWTGM.mjs → csv-4YFTMVWQ.mjs} +4 -4
- package/dist/cli/{db-MFTUN3DF.js → db-L5EGGO72.js} +27 -27
- package/dist/cli/{db-FA5QGXZ7.mjs → db-U5KR6SYI.mjs} +6 -6
- package/dist/cli/describe-G3SUS76P.js +50 -0
- package/dist/cli/{describe-TITEQNVE.mjs → describe-LZXXSQ26.mjs} +21 -21
- package/dist/cli/describe-core.d.mts +2 -2
- package/dist/cli/describe-core.d.ts +2 -2
- package/dist/cli/describe-core.js +4 -4
- package/dist/cli/describe-core.mjs +3 -3
- package/dist/cli/{executions-QW3L7G7J.js → executions-VZKRFDGM.js} +8 -8
- package/dist/cli/{executions-DMYJJIRB.mjs → executions-ZWEC5DDR.mjs} +6 -6
- package/dist/cli/{feedback-6JZGE7OQ.js → feedback-BTJIJCQF.js} +14 -14
- package/dist/cli/{feedback-WPSNSFRC.mjs → feedback-HXQTHXEZ.mjs} +6 -6
- package/dist/cli/{git-GO65XRM3.mjs → git-P6A45MMT.mjs} +5 -5
- package/dist/cli/git-QU673DBV.js +26 -0
- package/dist/cli/index.js +150 -150
- package/dist/cli/index.mjs +49 -49
- package/dist/cli/{integrations-EEBPETH2.mjs → integrations-4POM2CJ3.mjs} +7 -7
- package/dist/cli/{integrations-T5JPSZXN.js → integrations-VSJQBRFS.js} +29 -29
- package/dist/cli/{legacy-noops-XDNZ46IR.mjs → legacy-noops-I65MIKH2.mjs} +6 -6
- package/dist/cli/{legacy-noops-B55OMNH7.js → legacy-noops-QOJGSGVO.js} +9 -9
- package/dist/cli/{mcp-4QIUAAWS.mjs → mcp-TGY6SRAC.mjs} +4 -4
- package/dist/cli/{mcp-3YA333TQ.js → mcp-WTKBSLSD.js} +24 -24
- package/dist/cli/{monitors-BVUPS4CE.mjs → monitors-E2ENT4RY.mjs} +16 -11
- package/dist/cli/{monitors-FOS7MWZO.js → monitors-TLWVEXW6.js} +109 -104
- package/dist/cli/{org-TCMRRVFC.mjs → org-J2LGW5ZR.mjs} +6 -6
- package/dist/cli/{org-CYM7HFLN.js → org-PZPJJU7K.js} +121 -121
- package/dist/cli/{outcomes-2JSWXWQ3.mjs → outcomes-TMJDASU5.mjs} +6 -6
- package/dist/cli/{outcomes-VDJVP5YC.js → outcomes-Z6ZNBJ3U.js} +14 -14
- package/dist/cli/{play-CPP4EBYF.mjs → play-S3Z24HUS.mjs} +22 -22
- package/dist/cli/{play-U3G73VIR.js → play-ZOOC57X4.js} +355 -355
- package/dist/cli/{providers-RVMIX5ED.mjs → providers-ETD6YLFL.mjs} +6 -6
- package/dist/cli/{providers-2ZB67TK7.js → providers-O4Y2YBS7.js} +9 -9
- package/dist/cli/{quickstart-V3Y7XZ47.js → quickstart-NZALIRBP.js} +6 -6
- package/dist/cli/{quickstart-L3YO3OWZ.mjs → quickstart-QZX32Y5T.mjs} +4 -4
- package/dist/cli/{run-M2CADJ6E.js → run-5UXSWJ7N.js} +48 -48
- package/dist/cli/{run-PQ3Z2GOF.mjs → run-HCVBRE2P.mjs} +26 -26
- package/dist/cli/search-T3SLR55O.js +32 -0
- package/dist/cli/{search-QVLGI7SZ.mjs → search-Z247K76U.mjs} +7 -7
- package/dist/cli/{search-output-PN3V7MSO.mjs → search-output-XCJI3XRA.mjs} +5 -5
- package/dist/cli/{search-output-IUANVHWU.js → search-output-XFKEGUJA.js} +8 -8
- package/dist/cli/{secrets-HK25G4K2.mjs → secrets-7JZXHLRU.mjs} +6 -6
- package/dist/cli/{secrets-AOW6F67J.js → secrets-VUQLTUTM.js} +15 -15
- package/dist/cli/sessions-GHW2H7N2.js +23 -0
- package/dist/cli/{sessions-YN2OIAGR.mjs → sessions-UNGJ342N.mjs} +6 -6
- package/dist/cli/{settings-7UW5TWSM.mjs → settings-67TIT4MZ.mjs} +12 -12
- package/dist/cli/{settings-6EV2FPGF.js → settings-WG5YNHC5.js} +85 -85
- package/dist/cli/{setup-ZQPD2R5K.js → setup-IYUNW5ZP.js} +49 -49
- package/dist/cli/{setup-BG56SHKH.mjs → setup-KMAAJOZM.mjs} +9 -9
- package/dist/cli/skills-JVLCEUBF.js +37 -0
- package/dist/cli/{skills-MQV2TNUZ.mjs → skills-UVS4DODN.mjs} +7 -7
- package/dist/cli/{tools-RGI4OE5T.mjs → tools-B42JY4BX.mjs} +19 -19
- package/dist/cli/tools-ETA3BJNM.js +57 -0
- package/dist/cli/{update-SQKGHQKF.mjs → update-EBYZZ7BW.mjs} +9 -9
- package/dist/cli/update-XZEBQCEY.js +37 -0
- package/dist/cli/{views-BUKVHCRD.js → views-DOUEKLEV.js} +37 -24
- package/dist/cli/{views-734T2CXF.mjs → views-QK3AFD2D.mjs} +21 -8
- package/dist/cli/{workflow-LPJC6RHP.js → workflow-TAKT2T7A.js} +17 -17
- package/dist/cli/{workflow-JNRRBMEK.mjs → workflow-UBJPGRKF.mjs} +7 -7
- package/dist/{client-CNYctEBh.d.mts → client-CmG8MT0x.d.mts} +1 -1
- package/dist/{client-C1AubrWJ.d.ts → client-QznpkWrk.d.ts} +1 -1
- package/dist/{client-core-D6zAE46g.d.ts → client-core-CXDqfeiB.d.ts} +5 -1
- package/dist/{client-core-Bb06TCx5.d.mts → client-core-CY0jNW0e.d.mts} +5 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -9
- package/dist/index.mjs +6 -6
- package/dist/install-integrity.json +130 -130
- package/dist/plays/bundle-play-file.mjs +1 -1
- package/dist/plays/play-description.d.mts +1 -1
- package/dist/plays/play-description.d.ts +1 -1
- package/dist/plays/run-request.d.mts +1 -1
- package/dist/plays/run-request.d.ts +1 -1
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +5 -5
- package/dist/server.mjs +3 -3
- package/package.json +1 -1
- package/dist/cli/auth-Q4O7MJU4.js +0 -44
- package/dist/cli/concurrent-runs-help-D6XH3FY5.js +0 -22
- package/dist/cli/describe-TYZ5YH3V.js +0 -50
- package/dist/cli/git-UGGRLGTQ.js +0 -26
- package/dist/cli/search-RHPPZZFG.js +0 -32
- package/dist/cli/sessions-AEGGTZ3K.js +0 -23
- package/dist/cli/skills-C6ZEZWBE.js +0 -37
- package/dist/cli/tools-PM3MC3RR.js +0 -57
- package/dist/cli/update-ZHUPF2HT.js +0 -37
- /package/dist/cli/{chunk-YGCKMI5P.js → chunk-2M3VVGMZ.js} +0 -0
- /package/dist/cli/{chunk-7I4B6V2S.mjs → chunk-VMGJIFSB.mjs} +0 -0
|
@@ -3245,6 +3245,8 @@ export type View = {
|
|
|
3245
3245
|
play: string;
|
|
3246
3246
|
input: Record<string, unknown>;
|
|
3247
3247
|
access: ViewAccess;
|
|
3248
|
+
embed_origins?: string[];
|
|
3249
|
+
embed_url?: string;
|
|
3248
3250
|
/** The view's workspace; null is the org's default workspace. Absent from older servers. */
|
|
3249
3251
|
team_id?: string | null;
|
|
3250
3252
|
created_at: number;
|
|
@@ -3737,10 +3739,19 @@ export class DeeplineClient {
|
|
|
3737
3739
|
}
|
|
3738
3740
|
|
|
3739
3741
|
/** Who can open a view: its workspace, every org member, or anyone with its URL. */
|
|
3740
|
-
async setViewAccess(
|
|
3742
|
+
async setViewAccess(
|
|
3743
|
+
id: string,
|
|
3744
|
+
access: ViewAccess,
|
|
3745
|
+
options?: { embedOrigins?: string[] },
|
|
3746
|
+
): Promise<View> {
|
|
3741
3747
|
return await this.http.post<View>(
|
|
3742
3748
|
`/api/v2/views/${encodeURIComponent(id)}/access`,
|
|
3743
|
-
{
|
|
3749
|
+
{
|
|
3750
|
+
access,
|
|
3751
|
+
...(options?.embedOrigins !== undefined
|
|
3752
|
+
? { embed_origins: options.embedOrigins }
|
|
3753
|
+
: {}),
|
|
3754
|
+
},
|
|
3744
3755
|
);
|
|
3745
3756
|
}
|
|
3746
3757
|
|
|
@@ -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.
|
|
208
|
+
version: '0.3.581',
|
|
209
209
|
updateSummary: {
|
|
210
210
|
introducedIn: '0.3.90',
|
|
211
211
|
summary:
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
import { quoteMonitorCustomerCharge } from '@deepline/monitors/billing/charges';
|
|
2
|
+
import { monitorUnitCredits } from '@deepline/monitors/billing/pricing';
|
|
1
3
|
import type {
|
|
4
|
+
MonitorBillingPhase,
|
|
5
|
+
MonitorRunMoney,
|
|
6
|
+
MonitorRunPrice,
|
|
7
|
+
MonitorRunPricing,
|
|
2
8
|
MonitorBillingPolicy,
|
|
3
9
|
MonitorPayloadPricingEntry,
|
|
4
10
|
MonitorPayloadPricingMode,
|
|
@@ -6,7 +12,7 @@ import type {
|
|
|
6
12
|
|
|
7
13
|
export type PublicMonitorPricing = {
|
|
8
14
|
mode: MonitorPayloadPricingMode;
|
|
9
|
-
billing_basis: 'per_accepted_event' | 'recurring';
|
|
15
|
+
billing_basis: 'per_accepted_event' | 'per_completed_run' | 'recurring';
|
|
10
16
|
deepline_credits: number;
|
|
11
17
|
unit: string;
|
|
12
18
|
charge_timing: string;
|
|
@@ -14,11 +20,57 @@ export type PublicMonitorPricing = {
|
|
|
14
20
|
display: string;
|
|
15
21
|
};
|
|
16
22
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
/** The account a monitor's provider calls run in (the binding's `credential_lane`). */
|
|
24
|
+
export type MonitorCredentialLane = 'deepline_managed' | 'customer_key';
|
|
25
|
+
|
|
26
|
+
/** One run a pay-per-run monitor's price tables list. */
|
|
27
|
+
export type PublicMonitorRunPrice = {
|
|
28
|
+
label: string;
|
|
29
|
+
deepline_credits: number;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Everything one monitor charges over its life, in Deepline credits (never
|
|
34
|
+
* provider spend), read from its billing policy: per accepted finding, per
|
|
35
|
+
* completed run, once on deploy, and per period while active. One monitor
|
|
36
|
+
* tracks one contact, company, feed or query, so a per-period charge is per
|
|
37
|
+
* tracked entity. A null amount settles from provider usage and is not known
|
|
38
|
+
* in advance.
|
|
39
|
+
*/
|
|
40
|
+
export type PublicMonitorChargeSchedule = {
|
|
41
|
+
/** Per accepted finding (per result). */
|
|
42
|
+
per_result_credits: number | null;
|
|
43
|
+
/**
|
|
44
|
+
* Per completed run, for a monitor billed per run (External Monitors),
|
|
45
|
+
* including runs that find nothing new. Null when the monitor is not billed
|
|
46
|
+
* per run, or when no payload picks the run's size (see `per_run_options`).
|
|
47
|
+
*/
|
|
48
|
+
per_run_credits: number | null;
|
|
49
|
+
/** The runs a pay-per-run monitor's price tables list, when no payload picks one. */
|
|
50
|
+
per_run_options?: PublicMonitorRunPrice[];
|
|
51
|
+
/** Once when the monitor is deployed. */
|
|
52
|
+
on_deploy_credits: number | null;
|
|
53
|
+
/** Once when a suspended monitor is reactivated (quoted on its own phase). */
|
|
54
|
+
on_reactivate_credits: number | null;
|
|
55
|
+
/** Recurring charge per monitor while it is active; null when there is none. */
|
|
56
|
+
per_period: { deepline_credits: number | null; period_days: number } | null;
|
|
57
|
+
/** The charges above in one sentence, for agents (CLI and API). */
|
|
58
|
+
display: string;
|
|
59
|
+
/**
|
|
60
|
+
* The same price in a few words, for people on the website (dashboard and
|
|
61
|
+
* docs): "6.5 credits per finding", "0.34 credits per run (…)", "BYOK",
|
|
62
|
+
* "Compute only".
|
|
63
|
+
*/
|
|
64
|
+
display_short: string;
|
|
20
65
|
};
|
|
21
66
|
|
|
67
|
+
export type PublicResolvedMonitorPricing = PublicMonitorPricing &
|
|
68
|
+
Partial<PublicMonitorChargeSchedule> & {
|
|
69
|
+
/** The payload field and value that picked this price (a radar type). */
|
|
70
|
+
discriminator?: string;
|
|
71
|
+
selection?: string;
|
|
72
|
+
};
|
|
73
|
+
|
|
22
74
|
function formatCredits(credits: number) {
|
|
23
75
|
return `${credits.toLocaleString('en')} Deepline ${
|
|
24
76
|
credits === 1 ? 'credit' : 'credits'
|
|
@@ -52,21 +104,424 @@ export function publicMonitorPricingEntry(
|
|
|
52
104
|
};
|
|
53
105
|
}
|
|
54
106
|
|
|
55
|
-
|
|
107
|
+
function quotedCredits(input: {
|
|
108
|
+
policy: MonitorBillingPolicy;
|
|
109
|
+
phases: readonly MonitorBillingPhase[];
|
|
110
|
+
providerCostKey?: string;
|
|
111
|
+
}): number | null {
|
|
112
|
+
let total = 0;
|
|
113
|
+
for (const phase of input.phases) {
|
|
114
|
+
const quote = quoteMonitorCustomerCharge({
|
|
115
|
+
policy: input.policy,
|
|
116
|
+
phase,
|
|
117
|
+
providerCostKey: input.providerCostKey,
|
|
118
|
+
});
|
|
119
|
+
if (quote.pendingProviderCostKeys.length > 0) return null;
|
|
120
|
+
total += quote.knownCredits;
|
|
121
|
+
}
|
|
122
|
+
return total;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const EVENT_PHASES: readonly MonitorBillingPhase[] = [
|
|
126
|
+
'webhook_event',
|
|
127
|
+
'provider_execution',
|
|
128
|
+
];
|
|
129
|
+
|
|
130
|
+
/** The phase a completed run is charged in, as the live webhook charge quotes it. */
|
|
131
|
+
const RUN_PHASES: readonly MonitorBillingPhase[] = ['webhook_event'];
|
|
132
|
+
|
|
133
|
+
/** The event charges that carry a price, with how many priced components each has. */
|
|
134
|
+
function pricedCharges(input: {
|
|
135
|
+
policy: MonitorBillingPolicy;
|
|
136
|
+
phases: readonly MonitorBillingPhase[];
|
|
137
|
+
providerCostKey?: string;
|
|
138
|
+
}) {
|
|
139
|
+
return input.policy.customerUsageCharges
|
|
140
|
+
.filter((charge) => input.phases.includes(charge.phase))
|
|
141
|
+
.map((charge) => ({
|
|
142
|
+
basis: charge.basis,
|
|
143
|
+
priced: charge.components.filter(
|
|
144
|
+
(component) =>
|
|
145
|
+
component.kind === 'fixed_deepline_credits' ||
|
|
146
|
+
(component.kind === 'upstream_cost_markup' &&
|
|
147
|
+
(!input.providerCostKey ||
|
|
148
|
+
component.providerCostKey === input.providerCostKey)),
|
|
149
|
+
).length,
|
|
150
|
+
}))
|
|
151
|
+
.filter((charge) => charge.priced > 0);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Credits for one completed run of `payload`, exactly as its webhook charge
|
|
156
|
+
* bills it; null when the payload names no priceable run.
|
|
157
|
+
*/
|
|
158
|
+
function runCredits(input: {
|
|
159
|
+
unitCredits: number;
|
|
160
|
+
run: MonitorRunPricing;
|
|
161
|
+
payload: Record<string, unknown>;
|
|
162
|
+
}): number | null {
|
|
163
|
+
const units = input.run.units(input.payload);
|
|
164
|
+
return units === null ? null : monitorUnitCredits(input.unitCredits, units);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* The charge schedule of a monitor, from the same quotes the live charges
|
|
169
|
+
* use. `entry` selects one payload-priced option (a radar type); without it,
|
|
170
|
+
* every charge of the policy counts.
|
|
171
|
+
*
|
|
172
|
+
* A pay-per-run monitor (`run`, from its capability's catalog) is priced per
|
|
173
|
+
* completed run: one usage unit's quote times the units its own counter gives
|
|
174
|
+
* for `payload`, which is the counter its webhook charge calls, so a quote
|
|
175
|
+
* cannot drift from a charge. Without a payload it lists `run.examples`. A
|
|
176
|
+
* `credential: "byok"` payload on a policy whose customer-key lane is free
|
|
177
|
+
* costs nothing.
|
|
178
|
+
*
|
|
179
|
+
* Null when an event has no single price and no run counter: a charge per
|
|
180
|
+
* usage unit (`basis`) or several alternative prices the event type picks
|
|
181
|
+
* between (Findymail, TheirStack). Those keep their own pricing presentation.
|
|
182
|
+
*/
|
|
183
|
+
export function publicMonitorChargeSchedule(input: {
|
|
184
|
+
policy: MonitorBillingPolicy;
|
|
185
|
+
entry?: MonitorPayloadPricingEntry;
|
|
186
|
+
run?: MonitorRunPricing;
|
|
187
|
+
payload?: Record<string, unknown> | null;
|
|
188
|
+
/**
|
|
189
|
+
* The lane the monitor runs (or would run) in, when known: a check resolves
|
|
190
|
+
* it the way deploy does and a deployed monitor pins it on its binding.
|
|
191
|
+
* Without it, only an explicit `credential: "byok"` reads as the customer's
|
|
192
|
+
* key.
|
|
193
|
+
*/
|
|
194
|
+
credentialLane?: MonitorCredentialLane | null;
|
|
195
|
+
}): PublicMonitorChargeSchedule | null {
|
|
196
|
+
const { policy, run, payload } = input;
|
|
197
|
+
const providerCostKey = input.entry?.providerCostKey;
|
|
198
|
+
const onDeploy = quotedCredits({
|
|
199
|
+
policy,
|
|
200
|
+
phases: ['create'],
|
|
201
|
+
providerCostKey,
|
|
202
|
+
});
|
|
203
|
+
const onReactivate = quotedCredits({
|
|
204
|
+
policy,
|
|
205
|
+
phases: ['reactivate'],
|
|
206
|
+
providerCostKey,
|
|
207
|
+
});
|
|
208
|
+
const perPeriodCredits = quotedCredits({
|
|
209
|
+
policy,
|
|
210
|
+
phases: ['subscription_renewal', 'periodic_renewal'],
|
|
211
|
+
providerCostKey,
|
|
212
|
+
});
|
|
213
|
+
const recurring = policy.providerChargeComponents.find(
|
|
214
|
+
(component) => component.kind === 'provider_recurring_period',
|
|
215
|
+
);
|
|
216
|
+
const periodDays =
|
|
217
|
+
input.entry?.periodDays ??
|
|
218
|
+
(recurring?.kind === 'provider_recurring_period'
|
|
219
|
+
? recurring.periodDays
|
|
220
|
+
: 30);
|
|
221
|
+
const perPeriod =
|
|
222
|
+
perPeriodCredits === 0
|
|
223
|
+
? null
|
|
224
|
+
: { deepline_credits: perPeriodCredits, period_days: periodDays };
|
|
225
|
+
const freeOnCustomerKey = policy.customerKeyLaneCharge === 'none';
|
|
226
|
+
// The webhook charge is waived on the binding's customer-key lane, so the
|
|
227
|
+
// quote follows the effective lane, not only what the payload spelled out.
|
|
228
|
+
const onCustomerKey =
|
|
229
|
+
freeOnCustomerKey &&
|
|
230
|
+
(input.credentialLane
|
|
231
|
+
? input.credentialLane === 'customer_key'
|
|
232
|
+
: payload?.credential === 'byok');
|
|
233
|
+
|
|
234
|
+
let perResult: number | null = 0;
|
|
235
|
+
let perRun: number | null = null;
|
|
236
|
+
let runOptions: PublicMonitorRunPrice[] | undefined;
|
|
237
|
+
let runPrice: MonitorRunPrice | undefined;
|
|
238
|
+
if (run) {
|
|
239
|
+
const charges = pricedCharges({ policy, phases: RUN_PHASES });
|
|
240
|
+
if (charges.length !== 1 || charges[0]!.priced !== 1) {
|
|
241
|
+
throw new Error(
|
|
242
|
+
`Pay-per-run monitor ${policy.providerCapability} needs exactly one priced usage unit per run.`,
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
const unitCredits = quotedCredits({ policy, phases: RUN_PHASES });
|
|
246
|
+
if (unitCredits === null) return null;
|
|
247
|
+
runPrice = (examplePayload) => {
|
|
248
|
+
const credits = runCredits({ unitCredits, run, payload: examplePayload });
|
|
249
|
+
if (credits === null) {
|
|
250
|
+
throw new Error(
|
|
251
|
+
`Pay-per-run monitor ${policy.providerCapability} cannot price a run its website wording names.`,
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
return credits;
|
|
255
|
+
};
|
|
256
|
+
if (payload) {
|
|
257
|
+
perRun = onCustomerKey ? 0 : runCredits({ unitCredits, run, payload });
|
|
258
|
+
// No priceable run in this payload: no price, never "free".
|
|
259
|
+
if (perRun === null) return null;
|
|
260
|
+
} else {
|
|
261
|
+
runOptions = run.examples.map((example) => {
|
|
262
|
+
const credits = runCredits({
|
|
263
|
+
unitCredits,
|
|
264
|
+
run,
|
|
265
|
+
payload: example.payload,
|
|
266
|
+
});
|
|
267
|
+
if (credits === null) {
|
|
268
|
+
throw new Error(
|
|
269
|
+
`Pay-per-run monitor ${policy.providerCapability} lists run "${example.label}" that its run counter cannot price.`,
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
return { label: example.label, deepline_credits: credits };
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
} else {
|
|
276
|
+
const charges = pricedCharges({
|
|
277
|
+
policy,
|
|
278
|
+
phases: EVENT_PHASES,
|
|
279
|
+
providerCostKey,
|
|
280
|
+
});
|
|
281
|
+
if (
|
|
282
|
+
charges.some((charge) => charge.basis) ||
|
|
283
|
+
charges.reduce((total, charge) => total + charge.priced, 0) > 1
|
|
284
|
+
) {
|
|
285
|
+
return null;
|
|
286
|
+
}
|
|
287
|
+
perResult = onCustomerKey
|
|
288
|
+
? 0
|
|
289
|
+
: quotedCredits({ policy, phases: EVENT_PHASES, providerCostKey });
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const unitEvent = input.entry ? `${input.entry.unitLabel} event` : 'event';
|
|
293
|
+
const amount = (credits: number | null) =>
|
|
294
|
+
credits === null
|
|
295
|
+
? 'A price set from provider usage'
|
|
296
|
+
: formatCredits(credits);
|
|
297
|
+
// The rates price any configuration; the examples show common ones.
|
|
298
|
+
const runRate =
|
|
299
|
+
run && runPrice
|
|
300
|
+
? run.website.rate(runPrice, {
|
|
301
|
+
amount: (credits) => credits.toLocaleString('en'),
|
|
302
|
+
unit: ' Deepline credits',
|
|
303
|
+
})
|
|
304
|
+
: null;
|
|
305
|
+
const runCharge = runOptions
|
|
306
|
+
? `Per completed run, even one that finds nothing new: ${runRate}. For example: ${runOptions
|
|
307
|
+
.map(
|
|
308
|
+
(option, index) =>
|
|
309
|
+
`${
|
|
310
|
+
index === 0
|
|
311
|
+
? formatCredits(option.deepline_credits)
|
|
312
|
+
: option.deepline_credits.toLocaleString('en')
|
|
313
|
+
} for ${option.label}`,
|
|
314
|
+
)
|
|
315
|
+
.join('; ')}`
|
|
316
|
+
: perRun
|
|
317
|
+
? `${amount(perRun)} per completed run, even one that finds nothing new`
|
|
318
|
+
: null;
|
|
319
|
+
const charges = [
|
|
320
|
+
perResult === 0 ? null : `${amount(perResult)} per accepted ${unitEvent}`,
|
|
321
|
+
runCharge,
|
|
322
|
+
...(onDeploy === onReactivate
|
|
323
|
+
? [
|
|
324
|
+
onDeploy === 0
|
|
325
|
+
? null
|
|
326
|
+
: `${amount(onDeploy)} on deploy or reactivation`,
|
|
327
|
+
]
|
|
328
|
+
: [
|
|
329
|
+
onDeploy === 0 ? null : `${amount(onDeploy)} on deploy`,
|
|
330
|
+
onReactivate === 0 ? null : `${amount(onReactivate)} on reactivation`,
|
|
331
|
+
]),
|
|
332
|
+
perPeriod
|
|
333
|
+
? `${amount(perPeriod.deepline_credits)} per monitor every ${periodDays} days while active`
|
|
334
|
+
: null,
|
|
335
|
+
].filter((charge) => charge !== null);
|
|
336
|
+
const uncharged = [
|
|
337
|
+
onDeploy === 0 && onReactivate === 0 ? 'deploy' : null,
|
|
338
|
+
perPeriod ? null : 'recurring',
|
|
339
|
+
].filter((charge) => charge !== null);
|
|
340
|
+
const customerKeyNote =
|
|
341
|
+
freeOnCustomerKey && !onCustomerKey && charges.length > 0
|
|
342
|
+
? ' No Deepline charge on your own provider key (credential "byok"); the provider bills you.'
|
|
343
|
+
: '';
|
|
344
|
+
const display = onCustomerKey
|
|
345
|
+
? 'No Deepline charge: it runs on your own provider key, and the provider bills you.'
|
|
346
|
+
: charges.length === 0
|
|
347
|
+
? 'No monitor charge: only the compute its events use is billed.'
|
|
348
|
+
: `${charges.join('. ')}.${uncharged.length ? ` No ${uncharged.join(' or ')} charge.` : ''}${customerKeyNote}`;
|
|
349
|
+
return {
|
|
350
|
+
per_result_credits: perResult,
|
|
351
|
+
per_run_credits: perRun,
|
|
352
|
+
...(runOptions ? { per_run_options: runOptions } : {}),
|
|
353
|
+
on_deploy_credits: onDeploy,
|
|
354
|
+
on_reactivate_credits: onReactivate,
|
|
355
|
+
per_period: perPeriod,
|
|
356
|
+
display,
|
|
357
|
+
display_short: shortDisplay({
|
|
358
|
+
onCustomerKey,
|
|
359
|
+
free: charges.length === 0,
|
|
360
|
+
perResult,
|
|
361
|
+
unit: input.entry?.unitLabel ?? 'event',
|
|
362
|
+
run,
|
|
363
|
+
runPrice,
|
|
364
|
+
runOptions,
|
|
365
|
+
perRun,
|
|
366
|
+
payload,
|
|
367
|
+
onDeploy,
|
|
368
|
+
onReactivate,
|
|
369
|
+
perPeriod,
|
|
370
|
+
}),
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* A pay-per-run monitor's run price function on the managed lane: one usage
|
|
376
|
+
* unit's quote times the units its counter gives a payload, the math the
|
|
377
|
+
* webhook charge uses. Null when the policy has no single per-run unit price.
|
|
378
|
+
*/
|
|
379
|
+
export function monitorRunPrice(input: {
|
|
380
|
+
policy: MonitorBillingPolicy;
|
|
381
|
+
run: MonitorRunPricing;
|
|
382
|
+
}): MonitorRunPrice | null {
|
|
383
|
+
const unitCredits = quotedCredits({
|
|
384
|
+
policy: input.policy,
|
|
385
|
+
phases: RUN_PHASES,
|
|
386
|
+
});
|
|
387
|
+
if (unitCredits === null) return null;
|
|
388
|
+
return (payload) => {
|
|
389
|
+
const credits = runCredits({ unitCredits, run: input.run, payload });
|
|
390
|
+
if (credits === null) {
|
|
391
|
+
throw new Error(
|
|
392
|
+
`Pay-per-run monitor ${input.policy.providerCapability} cannot price a run its website wording names.`,
|
|
393
|
+
);
|
|
394
|
+
}
|
|
395
|
+
return credits;
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/** A credit amount as the website writes it: "0.04", "6.5", "1,000". */
|
|
400
|
+
function shortCredits(credits: number): string {
|
|
401
|
+
return Number(credits.toFixed(6)).toLocaleString('en', {
|
|
402
|
+
maximumFractionDigits: 4,
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
const SHORT_CREDITS: MonitorRunMoney = {
|
|
407
|
+
amount: shortCredits,
|
|
408
|
+
unit: ' credits',
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
/** The website's few-word price: the schedule's charges, nothing else. */
|
|
412
|
+
function shortDisplay(input: {
|
|
413
|
+
onCustomerKey: boolean;
|
|
414
|
+
free: boolean;
|
|
415
|
+
perResult: number | null;
|
|
416
|
+
unit: string;
|
|
417
|
+
run?: MonitorRunPricing;
|
|
418
|
+
runPrice?: MonitorRunPrice;
|
|
419
|
+
runOptions?: PublicMonitorRunPrice[];
|
|
420
|
+
perRun: number | null;
|
|
421
|
+
payload?: Record<string, unknown> | null;
|
|
422
|
+
onDeploy: number | null;
|
|
423
|
+
onReactivate: number | null;
|
|
424
|
+
perPeriod: PublicMonitorChargeSchedule['per_period'];
|
|
425
|
+
}): string {
|
|
426
|
+
if (input.onCustomerKey) return 'BYOK';
|
|
427
|
+
if (input.free) return 'Compute only';
|
|
428
|
+
const amount = (credits: number | null) =>
|
|
429
|
+
credits === null ? 'Usage-based' : `${shortCredits(credits)} credits`;
|
|
430
|
+
const parts: string[] = [];
|
|
431
|
+
if (input.perResult)
|
|
432
|
+
parts.push(`${amount(input.perResult)} per ${input.unit}`);
|
|
433
|
+
if (input.run && input.runPrice) {
|
|
434
|
+
if (input.runOptions) {
|
|
435
|
+
parts.push(input.run.website.rate(input.runPrice, SHORT_CREDITS));
|
|
436
|
+
} else if (input.perRun && input.payload) {
|
|
437
|
+
parts.push(
|
|
438
|
+
`${amount(input.perRun)} per run (${input.run.website.run(input.payload, input.runPrice, SHORT_CREDITS)})`,
|
|
439
|
+
);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
if (input.onDeploy === input.onReactivate) {
|
|
443
|
+
if (input.onDeploy)
|
|
444
|
+
parts.push(`${amount(input.onDeploy)} on deploy or reactivation`);
|
|
445
|
+
} else {
|
|
446
|
+
if (input.onDeploy) parts.push(`${amount(input.onDeploy)} on deploy`);
|
|
447
|
+
if (input.onReactivate)
|
|
448
|
+
parts.push(`${amount(input.onReactivate)} on reactivation`);
|
|
449
|
+
}
|
|
450
|
+
if (input.perPeriod) {
|
|
451
|
+
parts.push(
|
|
452
|
+
`${amount(input.perPeriod.deepline_credits)} every ${input.perPeriod.period_days} days`,
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
return parts.join('; ');
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* A monitor's public price for one deploy payload, or for its type when the
|
|
460
|
+
* payload is absent: the selected radar type's price plus the whole charge
|
|
461
|
+
* schedule, a pay-per-run monitor's run price, or the plain schedule. Every
|
|
462
|
+
* surface that shows a monitor's price reads it here, so none can drift from
|
|
463
|
+
* what the monitor charges. Undefined when there is no price to show.
|
|
464
|
+
*/
|
|
56
465
|
export function resolvePublicMonitorPricing(input: {
|
|
57
466
|
policy: MonitorBillingPolicy | null | undefined;
|
|
58
467
|
payload: Record<string, unknown> | null | undefined;
|
|
468
|
+
/** The capability's `catalog.run`, for a monitor billed per completed run. */
|
|
469
|
+
run?: MonitorRunPricing;
|
|
470
|
+
/** The effective credential lane, when known (see `publicMonitorChargeSchedule`). */
|
|
471
|
+
credentialLane?: MonitorCredentialLane | null;
|
|
59
472
|
}): PublicResolvedMonitorPricing | undefined {
|
|
60
|
-
const
|
|
61
|
-
if (!
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
473
|
+
const { policy, payload, run, credentialLane } = input;
|
|
474
|
+
if (!policy) return undefined;
|
|
475
|
+
const pricing = policy.payloadPricing;
|
|
476
|
+
if (pricing) {
|
|
477
|
+
if (!payload) return undefined;
|
|
478
|
+
const rawSelection = payload[pricing.discriminator];
|
|
479
|
+
if (typeof rawSelection !== 'string') return undefined;
|
|
480
|
+
const selection = rawSelection.trim();
|
|
481
|
+
const entry = pricing.entries[selection];
|
|
482
|
+
if (!entry) return undefined;
|
|
483
|
+
return {
|
|
484
|
+
discriminator: pricing.discriminator,
|
|
485
|
+
selection,
|
|
486
|
+
...publicMonitorPricingEntry(entry),
|
|
487
|
+
...publicMonitorChargeSchedule({
|
|
488
|
+
policy,
|
|
489
|
+
entry,
|
|
490
|
+
payload,
|
|
491
|
+
credentialLane,
|
|
492
|
+
}),
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
const schedule = publicMonitorChargeSchedule({
|
|
496
|
+
policy,
|
|
497
|
+
run,
|
|
498
|
+
payload,
|
|
499
|
+
credentialLane,
|
|
500
|
+
});
|
|
501
|
+
if (!schedule) return undefined;
|
|
502
|
+
if (run) {
|
|
503
|
+
// The type's cheapest listed run when no payload picks one.
|
|
504
|
+
const credits =
|
|
505
|
+
schedule.per_run_credits ??
|
|
506
|
+
schedule.per_run_options?.[0]?.deepline_credits ??
|
|
507
|
+
null;
|
|
508
|
+
if (credits === null) return undefined;
|
|
509
|
+
return {
|
|
510
|
+
mode: 'monitor_usage',
|
|
511
|
+
billing_basis: 'per_completed_run',
|
|
512
|
+
deepline_credits: credits,
|
|
513
|
+
unit: 'run',
|
|
514
|
+
charge_timing: 'for each completed run',
|
|
515
|
+
...schedule,
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
if (schedule.per_result_credits === null) return undefined;
|
|
67
519
|
return {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
520
|
+
mode: 'monitor_usage',
|
|
521
|
+
billing_basis: 'per_accepted_event',
|
|
522
|
+
deepline_credits: schedule.per_result_credits,
|
|
523
|
+
unit: 'event',
|
|
524
|
+
charge_timing: 'for each accepted provider event',
|
|
525
|
+
...schedule,
|
|
71
526
|
};
|
|
72
527
|
}
|
|
@@ -47,6 +47,18 @@ export const TAMRADAR_RADAR_TYPE_PRICING = {
|
|
|
47
47
|
providerCostUsd: 0.03,
|
|
48
48
|
unitLabel: 'finding',
|
|
49
49
|
},
|
|
50
|
+
// Source: TAMRadar per-update pricing (confidential/internal), measured on
|
|
51
|
+
// the dev account 2026-11-30 (PR #11756): five company_funding_rounds
|
|
52
|
+
// findings, the only updates in the window, debited $0.50. Launched in beta
|
|
53
|
+
// 2026-11; same content as industry funding rounds.
|
|
54
|
+
// https://docs.tamradar.com/webhooks/company/funding-rounds
|
|
55
|
+
company_funding_rounds: {
|
|
56
|
+
capability: 'company_radar',
|
|
57
|
+
label: 'Company funding rounds',
|
|
58
|
+
mode: 'monitor_usage',
|
|
59
|
+
providerCostUsd: 0.1,
|
|
60
|
+
unitLabel: 'finding',
|
|
61
|
+
},
|
|
50
62
|
// Source: TAMRadar per-update pricing (confidential/internal),
|
|
51
63
|
// https://tamradar.mintlify.app/api-reference/create-company-radar (social_posts).
|
|
52
64
|
company_social_posts: {
|
|
@@ -104,6 +104,65 @@ export type MonitorPayloadPricingMap = {
|
|
|
104
104
|
entries: Record<string, MonitorPayloadPricingEntry>;
|
|
105
105
|
};
|
|
106
106
|
|
|
107
|
+
/**
|
|
108
|
+
* How a pay-per-run monitor (one charge per completed run, sized by its
|
|
109
|
+
* payload) is priced. `units` is the function its webhook charge calls on the
|
|
110
|
+
* stored payload, so a quote and a charge count the same units.
|
|
111
|
+
*/
|
|
112
|
+
export type MonitorRunPricing = {
|
|
113
|
+
/**
|
|
114
|
+
* Usage units one completed run of this deploy payload bills, or null when
|
|
115
|
+
* the payload names no run that can be priced (an invalid definition, which
|
|
116
|
+
* `check` still prices beside its validation errors).
|
|
117
|
+
*/
|
|
118
|
+
units: (payload: Record<string, unknown>) => number | null;
|
|
119
|
+
/** Runs the price tables list, cheapest first, each with a payload that makes it. */
|
|
120
|
+
examples: readonly {
|
|
121
|
+
label: string;
|
|
122
|
+
payload: Record<string, unknown>;
|
|
123
|
+
}[];
|
|
124
|
+
/**
|
|
125
|
+
* Short, human-facing wording for the website (dashboard and docs). The CLI
|
|
126
|
+
* and API keep the full sentence. Every amount comes from `price`, which
|
|
127
|
+
* prices a payload through `units`, so the wording cannot drift from what a
|
|
128
|
+
* run is charged.
|
|
129
|
+
*/
|
|
130
|
+
website: {
|
|
131
|
+
/** The type's rate, e.g. "0.04 credits for 10 results, then 0.02 per additional result". */
|
|
132
|
+
rate: (price: MonitorRunPrice, money: MonitorRunMoney) => string;
|
|
133
|
+
/** The dashboard pricing page's line under the cheapest run's price. */
|
|
134
|
+
catalogNote: (price: MonitorRunPrice, money: MonitorRunMoney) => string;
|
|
135
|
+
/** What one configured run is, shown after its per-run price. */
|
|
136
|
+
run: (
|
|
137
|
+
payload: Record<string, unknown>,
|
|
138
|
+
price: MonitorRunPrice,
|
|
139
|
+
money: MonitorRunMoney,
|
|
140
|
+
) => string;
|
|
141
|
+
/** Rows of the docs and rate-card price tables. */
|
|
142
|
+
table: (price: MonitorRunPrice) => readonly MonitorRunTableRow[];
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
/** Credits for one completed run of a payload, as its webhook charge bills it. */
|
|
147
|
+
export type MonitorRunPrice = (payload: Record<string, unknown>) => number;
|
|
148
|
+
|
|
149
|
+
/** How amounts are written: credits ("0.04", unit " credits") or dollars ("$0.004", unit ""). */
|
|
150
|
+
export type MonitorRunMoney = {
|
|
151
|
+
amount: (credits: number) => string;
|
|
152
|
+
unit: string;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export type MonitorRunTableRow = {
|
|
156
|
+
label: string;
|
|
157
|
+
credits: number;
|
|
158
|
+
/** Added to a run's price rather than a run's whole price. */
|
|
159
|
+
increment?: boolean;
|
|
160
|
+
/** Appended to the amount, e.g. "per result". */
|
|
161
|
+
per?: string;
|
|
162
|
+
/** The rate card's billing basis column. */
|
|
163
|
+
basis: string;
|
|
164
|
+
};
|
|
165
|
+
|
|
107
166
|
export type MonitorProviderTruthSource =
|
|
108
167
|
| 'provider_response'
|
|
109
168
|
| 'provider_webhook'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MONITOR_FLEET_MAX_MEMBERS } from '../integration-contracts/monitor-fleet-contract';
|
|
2
|
+
import type { MonitorRunPricing } from '@deepline/monitors/billing/types';
|
|
2
3
|
import {
|
|
3
4
|
monitorSdkIssue,
|
|
4
5
|
type MonitorSdkValidationIssue,
|
|
@@ -25,10 +26,11 @@ export type ProviderMonitorCatalogListing = {
|
|
|
25
26
|
/** The same per radar type, for a capability whose variants are listed separately. */
|
|
26
27
|
variants?: Readonly<Record<string, { label: string; summary: string }>>;
|
|
27
28
|
/**
|
|
28
|
-
* A pay-per-
|
|
29
|
-
*
|
|
29
|
+
* A pay-per-run monitor's run pricing: the usage units one completed run of
|
|
30
|
+
* a deploy payload bills (the same count its webhook charge uses), and the
|
|
31
|
+
* runs price tables list, cheapest first.
|
|
30
32
|
*/
|
|
31
|
-
run?:
|
|
33
|
+
run?: MonitorRunPricing;
|
|
32
34
|
};
|
|
33
35
|
|
|
34
36
|
export type ProviderMonitorSubjectPathCandidate = {
|