deepline 0.3.506 → 0.3.508
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 +27 -6
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/monitors/deactivation-reasons.ts +38 -1
- package/dist/bundling-sources/shared_libs/monitors/fleets/verdict.ts +4 -2
- package/dist/bundling-sources/shared_libs/monitors/package.json +4 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-admission-codes.ts +11 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +2 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-errors.ts +15 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-state.ts +24 -4
- package/dist/bundling-sources/shared_libs/monitors/provider-resource-failure.ts +405 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +18 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-work-manual.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/durable-runs-rollout.ts +6 -1
- package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +3 -1
- package/dist/cli/{auth-ZHFONT2D.mjs → auth-2URIN52G.mjs} +5 -5
- package/dist/cli/auth-LFU77QDI.js +43 -0
- package/dist/cli/{billing-B2YEMNHE.mjs → billing-IW23GSR5.mjs} +6 -6
- package/dist/cli/{billing-3Z7N4WTL.js → billing-R2HY2ZVJ.js} +79 -79
- package/dist/cli/{chunk-TS4KFQKS.mjs → chunk-2LY42EZJ.mjs} +1 -1
- package/dist/cli/{chunk-ND4WPLTE.mjs → chunk-2PYFXXYA.mjs} +2 -2
- package/dist/cli/{chunk-N7G36GXB.js → chunk-2YOM5J3G.js} +26 -26
- package/dist/cli/{chunk-SUJIVF6L.js → chunk-3BZ74K27.js} +16 -16
- package/dist/cli/{chunk-Z7EHY2MF.mjs → chunk-3C6VBHNW.mjs} +2 -2
- package/dist/cli/{chunk-FFGQR5J3.mjs → chunk-3XBI4KZM.mjs} +2 -2
- package/dist/cli/{chunk-OHNMJ5XQ.js → chunk-3ZNPIJX6.js} +41 -41
- package/dist/cli/{chunk-6RYVIZRP.mjs → chunk-4DAR2GYV.mjs} +2 -2
- package/dist/cli/{chunk-E554XCJI.js → chunk-63BGKU3A.js} +96 -96
- package/dist/cli/{chunk-OUGJUM5X.mjs → chunk-63MCLOR2.mjs} +6 -6
- package/dist/cli/{chunk-FWSEGIT6.js → chunk-74UO7THC.js} +4 -4
- package/dist/cli/{chunk-ZZDTWVCQ.js → chunk-7PELFO3C.js} +21 -21
- package/dist/cli/{chunk-3F676QXJ.js → chunk-AYNO4VFW.js} +11 -11
- package/dist/cli/{chunk-D7OCORZ7.mjs → chunk-C6TP4DR3.mjs} +1 -1
- package/dist/cli/{chunk-F7IQQYKV.js → chunk-D73YB5NQ.js} +2 -2
- package/dist/cli/{chunk-QAY5AS2H.mjs → chunk-DWV7KM6H.mjs} +10 -10
- package/dist/cli/{chunk-2CFTDVEP.mjs → chunk-DZ7JCRAL.mjs} +2 -2
- package/dist/cli/{chunk-2OY5DXTC.js → chunk-ESVK4Z7S.js} +1 -1
- package/dist/cli/{chunk-YVOS5KSG.mjs → chunk-FRT5MFLF.mjs} +1 -1
- package/dist/cli/{chunk-PRIHD5XS.js → chunk-FXKKFM7J.js} +9 -9
- package/dist/cli/{chunk-GJNIC2CO.mjs → chunk-GRGZKXLL.mjs} +5 -5
- package/dist/cli/{chunk-CHGRURBN.mjs → chunk-IF242BIJ.mjs} +5 -5
- package/dist/cli/{chunk-HINTYT5H.js → chunk-IZZ7FFWP.js} +44 -44
- package/dist/cli/{chunk-MHRR47VQ.js → chunk-J3LJ37WD.js} +3 -3
- package/dist/cli/{chunk-O4DZG4VA.mjs → chunk-JEB6BNIU.mjs} +2 -2
- package/dist/cli/{chunk-AD2WJUZA.js → chunk-JRHMPZJX.js} +7 -7
- package/dist/cli/{chunk-75NAFY36.js → chunk-JUYW6TSU.js} +7 -7
- package/dist/cli/{chunk-2IXXB7OA.mjs → chunk-JXYVBF5L.mjs} +5 -5
- package/dist/cli/{chunk-QP333GFE.js → chunk-JYNHHO3J.js} +6 -6
- package/dist/cli/{chunk-3BFZEHBH.mjs → chunk-K4RME7AV.mjs} +1 -1
- package/dist/cli/{chunk-OPBXKB57.mjs → chunk-KSQO32L5.mjs} +1 -1
- package/dist/cli/{chunk-LRSRJJPD.js → chunk-M37I4A2Z.js} +16 -16
- package/dist/cli/{chunk-YJKKOSXS.js → chunk-N5HRBS4K.js} +3 -3
- package/dist/cli/{chunk-TEMORCEE.mjs → chunk-NC2FIUPX.mjs} +1 -1
- package/dist/cli/{chunk-YWZEBPXK.mjs → chunk-OWH7SSBO.mjs} +2 -2
- package/dist/cli/{chunk-GRESJ3H3.js → chunk-P7GOQTUN.js} +14 -14
- package/dist/cli/{chunk-ONBXTEFQ.mjs → chunk-Q4I5YKN4.mjs} +1 -1
- package/dist/cli/{chunk-BQBPVUFJ.mjs → chunk-QBZECLNG.mjs} +3 -3
- package/dist/cli/{chunk-ZM5BJ5MP.js → chunk-R4S2AK3Q.js} +53 -53
- package/dist/cli/{chunk-XUY7WQ2R.mjs → chunk-RNZQ7RDW.mjs} +2 -2
- package/dist/cli/{chunk-F53SGS3C.js → chunk-RUD77W2Y.js} +5 -5
- package/dist/cli/{chunk-OD6TASBP.js → chunk-RWXHMG6F.js} +8 -8
- package/dist/cli/{chunk-DB54ROPH.js → chunk-TVADI7K5.js} +5 -5
- package/dist/cli/{chunk-YEX6RPUO.mjs → chunk-UDH3YMBI.mjs} +1 -1
- package/dist/cli/{chunk-BJ5OX62J.mjs → chunk-VXNL4HLE.mjs} +5 -5
- package/dist/cli/{chunk-EN7GXLFX.mjs → chunk-XSOLA2ED.mjs} +4 -4
- package/dist/cli/{chunk-5ARG7J7A.js → chunk-ZL2ME3UT.js} +6 -6
- package/dist/cli/{chunk-26DJ4BDY.js → chunk-ZLIAUR2E.js} +2 -2
- package/dist/cli/{csv-ARHQ54HA.mjs → csv-CMJSMC2I.mjs} +4 -4
- package/dist/cli/{csv-7K7LK63Y.js → csv-DPDO6BU6.js} +13 -13
- package/dist/cli/{db-V4Z2I6DY.js → db-PPPKNTT5.js} +27 -27
- package/dist/cli/{db-JBX24NJY.mjs → db-SL3EFN6V.mjs} +6 -6
- package/dist/cli/describe-JKZ67X3E.js +50 -0
- package/dist/cli/{describe-RBDSGSZ7.mjs → describe-XLN33FJX.mjs} +18 -18
- package/dist/cli/describe-core.d.mts +2 -2
- package/dist/cli/describe-core.d.ts +2 -2
- package/dist/cli/{executions-XEZKV5QU.js → executions-6YDTV2J6.js} +8 -8
- package/dist/cli/{executions-BAZEU63W.mjs → executions-O6Z5B5NY.mjs} +6 -6
- package/dist/cli/{feedback-LOERESRU.js → feedback-BZ434BN4.js} +8 -8
- package/dist/cli/{feedback-YDSWBHCO.mjs → feedback-DP7LPWAD.mjs} +4 -4
- package/dist/cli/{git-4Z3W2CQU.mjs → git-MI7E5WGL.mjs} +5 -5
- package/dist/cli/git-U5N6CTML.js +25 -0
- package/dist/cli/index.js +138 -138
- package/dist/cli/index.mjs +41 -41
- package/dist/cli/{legacy-noops-4QIQPVE5.js → legacy-noops-65WNPQVZ.js} +8 -8
- package/dist/cli/{legacy-noops-E4HH7S5O.mjs → legacy-noops-6VYXF2MG.mjs} +5 -5
- package/dist/cli/{monitors-QBHDSDA7.js → monitors-BYUCTVSC.js} +127 -112
- package/dist/cli/{monitors-FPDW5DDM.mjs → monitors-Y7I5ZVCN.mjs} +34 -19
- package/dist/cli/{org-JO4GGSAH.js → org-F2ASWTFY.js} +72 -72
- package/dist/cli/{org-UCDHIHAD.mjs → org-IW3YD6JZ.mjs} +6 -6
- package/dist/cli/{pages-6V52IZXY.mjs → pages-H2CXNIDB.mjs} +6 -6
- package/dist/cli/{pages-FJAAXAWO.js → pages-X6HLRQNV.js} +18 -18
- package/dist/cli/{play-F3AENS6W.js → play-H2EM7DTI.js} +317 -317
- package/dist/cli/{play-MF4DWROJ.mjs → play-LLEEDXRX.mjs} +18 -18
- package/dist/cli/{providers-XXOQLPX7.js → providers-6R2SPOEV.js} +9 -9
- package/dist/cli/{providers-NJJLTECA.mjs → providers-BZR5JONN.mjs} +6 -6
- package/dist/cli/{quickstart-Z5MSMI7S.mjs → quickstart-KVES7R6D.mjs} +4 -4
- package/dist/cli/{quickstart-JCE3XGQG.js → quickstart-PW7ONQUH.js} +6 -6
- package/dist/cli/{run-X2DNIW3F.js → run-HVUQROBE.js} +41 -41
- package/dist/cli/{run-56UGPIRL.mjs → run-RDI3Q6GO.mjs} +23 -23
- package/dist/cli/{search-SZYI4NBB.mjs → search-3TJ24CUF.mjs} +8 -8
- package/dist/cli/search-NKEEGLY6.js +33 -0
- package/dist/cli/{search-output-7UNT6EMP.js → search-output-JHT553SL.js} +6 -6
- package/dist/cli/{search-output-T35QNZUF.mjs → search-output-Y57OBQXX.mjs} +4 -4
- package/dist/cli/{secrets-Q36VC35L.mjs → secrets-OZK7GRD5.mjs} +6 -6
- package/dist/cli/{secrets-JMUAVIVC.js → secrets-U5JHWAXU.js} +15 -15
- package/dist/cli/{sessions-HG6I3HMY.mjs → sessions-D6DSEQ2T.mjs} +5 -5
- package/dist/cli/{sessions-SUXU7OM7.js → sessions-PNMYAJNB.js} +6 -6
- package/dist/cli/{settings-UIELQ5CV.js → settings-DLPEHYGS.js} +82 -82
- package/dist/cli/{settings-Z76XW4KF.mjs → settings-ITLSLT2R.mjs} +12 -12
- package/dist/cli/{setup-OXNYAOQ4.mjs → setup-XTYLF2CF.mjs} +10 -10
- package/dist/cli/{setup-2L7H5P2O.js → setup-Y5ZYEC6U.js} +50 -50
- package/dist/cli/{skills-XSNLXJGI.mjs → skills-C4WCAVII.mjs} +8 -8
- package/dist/cli/skills-K6FVG3BX.js +37 -0
- package/dist/cli/tools-LSALTN7I.js +57 -0
- package/dist/cli/{tools-SUSFAYFH.mjs → tools-ZESAPVOW.mjs} +17 -17
- package/dist/cli/{update-ENSTG3QO.mjs → update-4PCKVDCS.mjs} +10 -10
- package/dist/cli/update-P5KGNFNL.js +35 -0
- package/dist/cli/{workflow-Z33QE6VT.mjs → workflow-42CL4TVR.mjs} +7 -7
- package/dist/cli/{workflow-FMBZNY4F.js → workflow-XXKXMPTI.js} +17 -17
- package/dist/{client-Cx0420fs.d.ts → client-BlwD-G4v.d.ts} +1 -1
- package/dist/{client-BDbouy3Y.d.mts → client-DMpsMNH9.d.mts} +1 -1
- package/dist/{client-core-CwiVaMZ5.d.mts → client-core-CITtRTbB.d.mts} +27 -8
- package/dist/{client-core-B4hq0-m2.d.ts → client-core-DwBLuEkm.d.ts} +27 -8
- 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 +106 -104
- 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-MMHG2OFE.js +0 -43
- package/dist/cli/describe-AYXVS6DZ.js +0 -50
- package/dist/cli/git-T6WKO7EA.js +0 -25
- package/dist/cli/search-B753RTKC.js +0 -33
- package/dist/cli/skills-DEVXYGYH.js +0 -37
- package/dist/cli/tools-SCGHABDL.js +0 -57
- package/dist/cli/update-BSIILGO3.js +0 -35
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider resource failures: the `errored` monitor state (KAR-193).
|
|
3
|
+
*
|
|
4
|
+
* TamRadar can fail a radar hours or days after its create returned success,
|
|
5
|
+
* with a `radar_failure` webhook naming the radar and a reason. Before this
|
|
6
|
+
* module Deepline only refunded the create: the monitor stayed desired-active,
|
|
7
|
+
* the daily global audit saw "active vs inactive" and recreated the radar,
|
|
8
|
+
* TamRadar failed it again, and the loop repeated every day.
|
|
9
|
+
*
|
|
10
|
+
* The rule, decided by Karl on 2026-11-11:
|
|
11
|
+
*
|
|
12
|
+
* - `source_inaccessible` (the profile URL is dead or renamed) errors the
|
|
13
|
+
* monitor at once. Recreating the same URL cannot succeed.
|
|
14
|
+
* - Any other reason gets one automatic recreate. A second failure on the same
|
|
15
|
+
* payload errors the monitor.
|
|
16
|
+
* - An errored monitor stays errored until its payload changes. Changing the
|
|
17
|
+
* payload creates a fresh resource and clears it; resubmitting the same
|
|
18
|
+
* payload does not. Delete removes it. Nothing automatic revives it.
|
|
19
|
+
*
|
|
20
|
+
* The decision is pure so every direction can be driven without Convex. The
|
|
21
|
+
* Convex owner (`providerMonitorRegistry.recordProviderResourceFailure`)
|
|
22
|
+
* applies it, and the inbound processor raises the alerts.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
export const TAMRADAR_SOURCE_INACCESSIBLE_REASON = 'source_inaccessible';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Stored when a failure webhook names no reason. Never a known reason, so it
|
|
29
|
+
* always raises the unknown-reason alert.
|
|
30
|
+
*/
|
|
31
|
+
export const UNSPECIFIED_PROVIDER_FAILURE_REASON = 'unspecified';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Every `radar_failure` reason Deepline has seen in Production.
|
|
35
|
+
*
|
|
36
|
+
* A reason outside this set raises a Slack alert each time it arrives, so a
|
|
37
|
+
* new provider failure mode cannot slip through as one more refund. When the
|
|
38
|
+
* alert fires, decide how the reason should be treated and add it here.
|
|
39
|
+
*
|
|
40
|
+
* Evidence (KAR-193 fleet-wide journal scan, 2026-11-11): Prove's 72
|
|
41
|
+
* `contact_social_posts` failures and three August company radars were
|
|
42
|
+
* `source_inaccessible`; one September `company_new_hires` failure was
|
|
43
|
+
* `missing_prerequisites`.
|
|
44
|
+
*/
|
|
45
|
+
export const KNOWN_TAMRADAR_RADAR_FAILURE_REASONS: ReadonlySet<string> =
|
|
46
|
+
new Set([TAMRADAR_SOURCE_INACCESSIBLE_REASON, 'missing_prerequisites']);
|
|
47
|
+
|
|
48
|
+
export function isKnownTamradarRadarFailureReason(reason: string): boolean {
|
|
49
|
+
return KNOWN_TAMRADAR_RADAR_FAILURE_REASONS.has(reason);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The `provider`-owned deactivation reasons that mean `errored`. Declared in
|
|
54
|
+
* `deactivation-reasons.ts`; repeated here, import-free, so the customer state
|
|
55
|
+
* projection can read them without a module cycle. A unit test keeps the two
|
|
56
|
+
* in step.
|
|
57
|
+
*/
|
|
58
|
+
export const PROVIDER_ERRORED_DEACTIVATION_REASON_IDS: ReadonlySet<string> =
|
|
59
|
+
new Set(['provider_source_inaccessible', 'provider_resource_failed']);
|
|
60
|
+
|
|
61
|
+
export function isProviderErroredDeactivationReason(
|
|
62
|
+
id: string | null | undefined,
|
|
63
|
+
): boolean {
|
|
64
|
+
return (
|
|
65
|
+
typeof id === 'string' && PROVIDER_ERRORED_DEACTIVATION_REASON_IDS.has(id)
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Failures on one payload before a non-`source_inaccessible` reason errors. */
|
|
70
|
+
export const PROVIDER_RESOURCE_FAILURES_BEFORE_ERRORED = 2;
|
|
71
|
+
|
|
72
|
+
/** The stored failure record on a monitor definition. */
|
|
73
|
+
export type ProviderResourceFailureRecord = {
|
|
74
|
+
/** The provider's reason code, e.g. `source_inaccessible`. */
|
|
75
|
+
reason: string;
|
|
76
|
+
/** The resource the provider failed. */
|
|
77
|
+
providerResourceId: string;
|
|
78
|
+
/** The provider's id for this failure event (TamRadar `update_id`). */
|
|
79
|
+
providerEventId: string;
|
|
80
|
+
/** The provider's error id, kept for support conversations. */
|
|
81
|
+
errorId?: string;
|
|
82
|
+
failedAt: number;
|
|
83
|
+
/**
|
|
84
|
+
* Failures of resources created from the same payload. A changed payload
|
|
85
|
+
* starts again at 1.
|
|
86
|
+
*/
|
|
87
|
+
failureCount: number;
|
|
88
|
+
/** Fingerprint of the payload the failed resource was created from. */
|
|
89
|
+
payloadFingerprint: string;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export type ProviderResourceFailureEvent = {
|
|
93
|
+
reason: string;
|
|
94
|
+
providerResourceId: string;
|
|
95
|
+
providerEventId: string;
|
|
96
|
+
errorId?: string;
|
|
97
|
+
failedAt: number;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export type ProviderResourceFailureDecision =
|
|
101
|
+
/** This exact failure event was already recorded. */
|
|
102
|
+
| { kind: 'duplicate' }
|
|
103
|
+
/** Record the failure and let one automatic recreate run. */
|
|
104
|
+
| { kind: 'retry'; failure: ProviderResourceFailureRecord }
|
|
105
|
+
/** Record the failure and move the monitor to `errored`. */
|
|
106
|
+
| {
|
|
107
|
+
kind: 'errored';
|
|
108
|
+
failure: ProviderResourceFailureRecord;
|
|
109
|
+
deactivationReason:
|
|
110
|
+
| 'provider_source_inaccessible'
|
|
111
|
+
| 'provider_resource_failed';
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export function decideProviderResourceFailure(input: {
|
|
115
|
+
previous: ProviderResourceFailureRecord | undefined | null;
|
|
116
|
+
event: ProviderResourceFailureEvent;
|
|
117
|
+
payloadFingerprint: string;
|
|
118
|
+
}): ProviderResourceFailureDecision {
|
|
119
|
+
const { previous, event } = input;
|
|
120
|
+
if (previous && previous.providerEventId === event.providerEventId) {
|
|
121
|
+
return { kind: 'duplicate' };
|
|
122
|
+
}
|
|
123
|
+
const samePayload =
|
|
124
|
+
previous !== null &&
|
|
125
|
+
previous !== undefined &&
|
|
126
|
+
previous.payloadFingerprint === input.payloadFingerprint;
|
|
127
|
+
// A second webhook about a resource already counted is the same failure,
|
|
128
|
+
// not a new one: only a recreate earns another count.
|
|
129
|
+
const failureCount = !samePayload
|
|
130
|
+
? 1
|
|
131
|
+
: previous.providerResourceId === event.providerResourceId
|
|
132
|
+
? previous.failureCount
|
|
133
|
+
: previous.failureCount + 1;
|
|
134
|
+
const failure: ProviderResourceFailureRecord = {
|
|
135
|
+
reason: event.reason,
|
|
136
|
+
providerResourceId: event.providerResourceId,
|
|
137
|
+
providerEventId: event.providerEventId,
|
|
138
|
+
...(event.errorId ? { errorId: event.errorId } : {}),
|
|
139
|
+
failedAt: event.failedAt,
|
|
140
|
+
failureCount,
|
|
141
|
+
payloadFingerprint: input.payloadFingerprint,
|
|
142
|
+
};
|
|
143
|
+
if (event.reason === TAMRADAR_SOURCE_INACCESSIBLE_REASON) {
|
|
144
|
+
return {
|
|
145
|
+
kind: 'errored',
|
|
146
|
+
failure,
|
|
147
|
+
deactivationReason: 'provider_source_inaccessible',
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
if (failureCount >= PROVIDER_RESOURCE_FAILURES_BEFORE_ERRORED) {
|
|
151
|
+
return {
|
|
152
|
+
kind: 'errored',
|
|
153
|
+
failure,
|
|
154
|
+
deactivationReason: 'provider_resource_failed',
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
return { kind: 'retry', failure };
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* True when a payload being committed with a fresh resource differs from the
|
|
162
|
+
* one the recorded failure was created from. That is the customer's fix: it
|
|
163
|
+
* clears `errored` and the failure count.
|
|
164
|
+
*/
|
|
165
|
+
export function providerResourceFailureClearedByPayload(input: {
|
|
166
|
+
failure: Pick<ProviderResourceFailureRecord, 'payloadFingerprint'>;
|
|
167
|
+
payloadFingerprint: string;
|
|
168
|
+
}): boolean {
|
|
169
|
+
return input.failure.payloadFingerprint !== input.payloadFingerprint;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function stableJson(value: unknown): string {
|
|
173
|
+
if (value === null || typeof value !== 'object') {
|
|
174
|
+
return JSON.stringify(value ?? null);
|
|
175
|
+
}
|
|
176
|
+
if (Array.isArray(value)) {
|
|
177
|
+
return `[${value.map((entry) => stableJson(entry)).join(',')}]`;
|
|
178
|
+
}
|
|
179
|
+
return `{${Object.keys(value as Record<string, unknown>)
|
|
180
|
+
.filter((key) => (value as Record<string, unknown>)[key] !== undefined)
|
|
181
|
+
.sort()
|
|
182
|
+
.map(
|
|
183
|
+
(key) =>
|
|
184
|
+
`${JSON.stringify(key)}:${stableJson((value as Record<string, unknown>)[key])}`,
|
|
185
|
+
)
|
|
186
|
+
.join(',')}}`;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* SHA-256 of the payload's stable JSON. Runs in Convex and in Node, both of
|
|
191
|
+
* which provide Web Crypto.
|
|
192
|
+
*/
|
|
193
|
+
export async function providerMonitorPayloadFingerprint(
|
|
194
|
+
payload: unknown,
|
|
195
|
+
): Promise<string> {
|
|
196
|
+
const digest = await crypto.subtle.digest(
|
|
197
|
+
'SHA-256',
|
|
198
|
+
new TextEncoder().encode(stableJson(payload ?? {})),
|
|
199
|
+
);
|
|
200
|
+
return Array.from(new Uint8Array(digest), (byte) =>
|
|
201
|
+
byte.toString(16).padStart(2, '0'),
|
|
202
|
+
).join('');
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* The customer-facing fix prompt for an errored monitor. The wording is
|
|
207
|
+
* Karl's (KAR-193), with "the provider" where he wrote the upstream's name:
|
|
208
|
+
* customers and agents only ever see `deepline_native`
|
|
209
|
+
* (`scripts/check-deepline-native-no-tamradar-leak.ts` scans these strings).
|
|
210
|
+
* A contact radar watches a LinkedIn profile URL, which is what
|
|
211
|
+
* `source_inaccessible` means for it; a company radar's source is not a
|
|
212
|
+
* LinkedIn URL, so it gets the same instruction without that claim.
|
|
213
|
+
*/
|
|
214
|
+
export function providerResourceFailureMessage(input: {
|
|
215
|
+
reason: string;
|
|
216
|
+
sourceCapability?: string | null;
|
|
217
|
+
}): string {
|
|
218
|
+
if (input.reason === TAMRADAR_SOURCE_INACCESSIBLE_REASON) {
|
|
219
|
+
return input.sourceCapability?.startsWith('contact_')
|
|
220
|
+
? "This LinkedIn URL no longer resolves (the provider could not reach it). Update the monitor with the person's current URL, or remove it."
|
|
221
|
+
: 'The provider could not reach the source this monitor watches (reason: source_inaccessible). Update the monitor with a source that resolves, or remove it.';
|
|
222
|
+
}
|
|
223
|
+
return `The provider could not run this monitor (reason: ${input.reason}). Update or remove the monitor.`;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* The public shape of a failure on `monitors list/get` (snake_case API). It
|
|
228
|
+
* never names the provider resource id: the customer API exposes Deepline's
|
|
229
|
+
* own identities, not upstream ones.
|
|
230
|
+
*/
|
|
231
|
+
export type ProviderMonitorFailureSummary = {
|
|
232
|
+
reason: string;
|
|
233
|
+
message: string;
|
|
234
|
+
failed_at: string;
|
|
235
|
+
failure_count: number;
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
export function providerMonitorFailureSummary(input: {
|
|
239
|
+
failure: ProviderResourceFailureRecord;
|
|
240
|
+
sourceCapability?: string | null;
|
|
241
|
+
}): ProviderMonitorFailureSummary {
|
|
242
|
+
return {
|
|
243
|
+
reason: input.failure.reason,
|
|
244
|
+
message: providerResourceFailureMessage({
|
|
245
|
+
reason: input.failure.reason,
|
|
246
|
+
sourceCapability: input.sourceCapability,
|
|
247
|
+
}),
|
|
248
|
+
failed_at: new Date(input.failure.failedAt).toISOString(),
|
|
249
|
+
failure_count: input.failure.failureCount,
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/** Read a stored record defensively; null when absent or malformed. */
|
|
254
|
+
export function parseProviderResourceFailureRecord(
|
|
255
|
+
value: unknown,
|
|
256
|
+
): ProviderResourceFailureRecord | null {
|
|
257
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) return null;
|
|
258
|
+
const row = value as Record<string, unknown>;
|
|
259
|
+
const text = (key: string) =>
|
|
260
|
+
typeof row[key] === 'string' && (row[key] as string).trim()
|
|
261
|
+
? (row[key] as string)
|
|
262
|
+
: null;
|
|
263
|
+
const reason = text('reason');
|
|
264
|
+
const providerResourceId = text('providerResourceId');
|
|
265
|
+
const providerEventId = text('providerEventId');
|
|
266
|
+
const payloadFingerprint = text('payloadFingerprint');
|
|
267
|
+
const failedAt = row.failedAt;
|
|
268
|
+
const failureCount = row.failureCount;
|
|
269
|
+
if (
|
|
270
|
+
!reason ||
|
|
271
|
+
!providerResourceId ||
|
|
272
|
+
!providerEventId ||
|
|
273
|
+
!payloadFingerprint ||
|
|
274
|
+
typeof failedAt !== 'number' ||
|
|
275
|
+
!Number.isFinite(failedAt) ||
|
|
276
|
+
typeof failureCount !== 'number' ||
|
|
277
|
+
!Number.isInteger(failureCount) ||
|
|
278
|
+
failureCount < 1
|
|
279
|
+
) {
|
|
280
|
+
return null;
|
|
281
|
+
}
|
|
282
|
+
const errorId = text('errorId');
|
|
283
|
+
return {
|
|
284
|
+
reason,
|
|
285
|
+
providerResourceId,
|
|
286
|
+
providerEventId,
|
|
287
|
+
...(errorId ? { errorId } : {}),
|
|
288
|
+
failedAt,
|
|
289
|
+
failureCount,
|
|
290
|
+
payloadFingerprint,
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* The Slack alert a recorded failure raises, or null for none.
|
|
296
|
+
*
|
|
297
|
+
* Two things must never pass silently (KAR-193): a monitor going `errored`,
|
|
298
|
+
* and a failure reason Deepline has not classified. A first failure with a
|
|
299
|
+
* known, retryable reason is the automatic recreate working as designed and
|
|
300
|
+
* raises nothing; its second failure errors the monitor and alerts then.
|
|
301
|
+
* A redelivered event alerts nothing the first delivery did not.
|
|
302
|
+
*/
|
|
303
|
+
export function providerResourceFailureAlert(input: {
|
|
304
|
+
outcome: string;
|
|
305
|
+
reason: string;
|
|
306
|
+
providerResourceId: string;
|
|
307
|
+
failureCount?: number | null;
|
|
308
|
+
errorId?: string | null;
|
|
309
|
+
sourceCapability?: string | null;
|
|
310
|
+
}): { reason: string; detail: string } | null {
|
|
311
|
+
if (input.outcome === 'duplicate') return null;
|
|
312
|
+
const unknownReason = !isKnownTamradarRadarFailureReason(input.reason);
|
|
313
|
+
const errored = input.outcome === 'errored';
|
|
314
|
+
if (!errored && !unknownReason) return null;
|
|
315
|
+
const parts = [
|
|
316
|
+
`radar_failure reason=${input.reason} on radar ${input.providerResourceId}`,
|
|
317
|
+
`outcome=${input.outcome}`,
|
|
318
|
+
...(input.failureCount ? [`failure ${input.failureCount}`] : []),
|
|
319
|
+
...(input.errorId ? [`error_id=${input.errorId}`] : []),
|
|
320
|
+
];
|
|
321
|
+
if (unknownReason) {
|
|
322
|
+
parts.push(
|
|
323
|
+
`Deepline has never classified reason '${input.reason}': decide how it should be treated and add it to the known radar failure reasons in packages/monitors/provider-resource-failure.ts`,
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
if (errored) {
|
|
327
|
+
parts.push(
|
|
328
|
+
`Customer sees: ${providerResourceFailureMessage({
|
|
329
|
+
reason: input.reason,
|
|
330
|
+
sourceCapability: input.sourceCapability,
|
|
331
|
+
})}`,
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
return {
|
|
335
|
+
reason: errored
|
|
336
|
+
? unknownReason
|
|
337
|
+
? 'monitor_errored_unknown_provider_failure_reason'
|
|
338
|
+
: 'monitor_errored'
|
|
339
|
+
: 'unknown_provider_failure_reason',
|
|
340
|
+
detail: parts.join(' | '),
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Read the failure facts from an unwrapped TamRadar `radar_failure` payload.
|
|
346
|
+
*
|
|
347
|
+
* Real shape (Prove, 2026-11-11): `{code: 400, status: 'error', message,
|
|
348
|
+
* errors: [{field: 'radar', reason: 'source_inaccessible'}], error_id,
|
|
349
|
+
* update_id, update_type: 'radar_failure', refund_amount_usd,
|
|
350
|
+
* data: {radar_id, radar_type, ...}}`. A payload without `errors[].reason`
|
|
351
|
+
* reads as `unspecified`, which is never a known reason and so alerts.
|
|
352
|
+
*/
|
|
353
|
+
export function readTamradarRadarFailure(payload: Record<string, unknown>): {
|
|
354
|
+
reason: string;
|
|
355
|
+
providerEventId: string | null;
|
|
356
|
+
errorId: string | null;
|
|
357
|
+
radarId: string | null;
|
|
358
|
+
} | null {
|
|
359
|
+
if (payload.update_type !== 'radar_failure') return null;
|
|
360
|
+
const text = (value: unknown) =>
|
|
361
|
+
typeof value === 'string' && value.trim() ? value.trim() : null;
|
|
362
|
+
const errors = Array.isArray(payload.errors) ? payload.errors : [];
|
|
363
|
+
const firstReason = errors
|
|
364
|
+
.map((entry) =>
|
|
365
|
+
entry && typeof entry === 'object'
|
|
366
|
+
? text((entry as Record<string, unknown>).reason)
|
|
367
|
+
: null,
|
|
368
|
+
)
|
|
369
|
+
.find((reason): reason is string => reason !== null);
|
|
370
|
+
const data =
|
|
371
|
+
payload.data && typeof payload.data === 'object'
|
|
372
|
+
? (payload.data as Record<string, unknown>)
|
|
373
|
+
: {};
|
|
374
|
+
return {
|
|
375
|
+
reason: firstReason ?? UNSPECIFIED_PROVIDER_FAILURE_REASON,
|
|
376
|
+
providerEventId: text(payload.update_id) ?? text(payload.event_id),
|
|
377
|
+
errorId: text(payload.error_id),
|
|
378
|
+
radarId: text(data.radar_id),
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* True when Deepline wants a monitor running, the provider holds its resource
|
|
384
|
+
* inactive or missing, and no recorded failure of THAT resource explains it.
|
|
385
|
+
*
|
|
386
|
+
* Repair recreates such a monitor. Before KAR-193 that happened silently;
|
|
387
|
+
* this drift has no webhook behind it, so its cause is unknown and a person
|
|
388
|
+
* should hear about it. A recorded failure of the current resource is the
|
|
389
|
+
* one automatic retry working as designed and is not reported again.
|
|
390
|
+
*/
|
|
391
|
+
export function isUnexplainedProviderDrift(row: {
|
|
392
|
+
desired: 'active' | 'inactive';
|
|
393
|
+
observed?: 'active' | 'inactive' | 'missing' | 'unknown' | null;
|
|
394
|
+
providerResourceId?: string | null;
|
|
395
|
+
providerFailure?: unknown;
|
|
396
|
+
}): boolean {
|
|
397
|
+
if (row.desired !== 'active') return false;
|
|
398
|
+
if (row.observed !== 'inactive' && row.observed !== 'missing') return false;
|
|
399
|
+
const failure = parseProviderResourceFailureRecord(row.providerFailure);
|
|
400
|
+
return (
|
|
401
|
+
failure === null ||
|
|
402
|
+
!row.providerResourceId ||
|
|
403
|
+
failure.providerResourceId !== row.providerResourceId
|
|
404
|
+
);
|
|
405
|
+
}
|
|
@@ -1630,6 +1630,24 @@
|
|
|
1630
1630
|
"failureAlert": "convex_action_wrapper",
|
|
1631
1631
|
"domainReportRequired": true
|
|
1632
1632
|
},
|
|
1633
|
+
{
|
|
1634
|
+
"id": "convex.advance-charge-reservation-admin-projection-floors",
|
|
1635
|
+
"name": "Advance charge-admin projection floors",
|
|
1636
|
+
"scheduler": "convex_cron",
|
|
1637
|
+
"cadence": "every 5 minutes",
|
|
1638
|
+
"timezone": "UTC",
|
|
1639
|
+
"source": "packages/convex/crons.ts",
|
|
1640
|
+
"locator": "advance charge-admin projection floors",
|
|
1641
|
+
"owner": "billing",
|
|
1642
|
+
"criticality": "maintenance",
|
|
1643
|
+
"purpose": "Move each charge-admin projection shard's receipt floor up past deleted receipts so ready-receipt reads stay bounded.",
|
|
1644
|
+
"successDefinition": "Every shard's floor reaches its oldest receipt or now minus the skew allowance, or the remainder is left for the next pass; an unchanged floor is a valid no-op.",
|
|
1645
|
+
"failureDefinition": "A shard's probe fails at the minimum span, so its ready reads keep crossing deleted receipts.",
|
|
1646
|
+
"startGraceMs": 600000,
|
|
1647
|
+
"runTimeoutMs": 1800000,
|
|
1648
|
+
"failureAlert": "convex_action_wrapper",
|
|
1649
|
+
"domainReportRequired": true
|
|
1650
|
+
},
|
|
1633
1651
|
{
|
|
1634
1652
|
"id": "convex.cleanup-expired-notification-audit-records",
|
|
1635
1653
|
"name": "Cleanup expired notification audit records",
|
|
@@ -34,6 +34,7 @@ export const MANUALLY_RUNNABLE_CONVEX_CRON_JOB_IDS = [
|
|
|
34
34
|
'convex.cleanup-expired-notification-audit-records',
|
|
35
35
|
'convex.fail-stale-play-deployments',
|
|
36
36
|
'convex.monitor-findings-roll',
|
|
37
|
+
'convex.advance-charge-reservation-admin-projection-floors',
|
|
37
38
|
] as const;
|
|
38
39
|
|
|
39
40
|
export type ManuallyRunnableConvexCronJobId =
|
|
@@ -27,8 +27,13 @@ export const DURABLE_RUNS_ROLLOUT = {
|
|
|
27
27
|
* stamped by the database clock. Readers of
|
|
28
28
|
* that key already ship; a gateway without `publish_latest_cache_result`
|
|
29
29
|
* turns the write into a no-op.
|
|
30
|
+
*
|
|
31
|
+
* On since rollout switch 1. A hit on the shared result stays unbilled,
|
|
32
|
+
* exactly as every cache hit was before (founder decision, 2026-11-11).
|
|
33
|
+
* Off again stops new writes; entries age out by each caller's own
|
|
34
|
+
* `staleAfterSeconds`.
|
|
30
35
|
*/
|
|
31
|
-
sharedReadCacheWrites:
|
|
36
|
+
sharedReadCacheWrites: true,
|
|
32
37
|
/**
|
|
33
38
|
* A provider's 5xx is retried inside the attempt with exponential backoff
|
|
34
39
|
* and jitter, sending the same provider idempotency key, even for an
|
|
@@ -428,6 +428,9 @@ function formatPublicToolErrorPayload(input: {
|
|
|
428
428
|
'error',
|
|
429
429
|
'message',
|
|
430
430
|
'code',
|
|
431
|
+
// Before the long fields, so the 1,500-character cut below keeps whose
|
|
432
|
+
// key ran out of provider credits.
|
|
433
|
+
'credential_owner',
|
|
431
434
|
'failure_origin',
|
|
432
435
|
'error_category',
|
|
433
436
|
'failure_description',
|
|
@@ -439,7 +442,6 @@ function formatPublicToolErrorPayload(input: {
|
|
|
439
442
|
'request_id',
|
|
440
443
|
'requestId',
|
|
441
444
|
'credential_source',
|
|
442
|
-
'credential_owner',
|
|
443
445
|
]) {
|
|
444
446
|
const value = input.parsed[key];
|
|
445
447
|
if (typeof value === 'string' && value.trim()) {
|
|
@@ -14,14 +14,14 @@ import {
|
|
|
14
14
|
reportSetupCompleted,
|
|
15
15
|
resolvePendingAuthClaimForResume,
|
|
16
16
|
statusBannerLine
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-QBZECLNG.mjs";
|
|
18
|
+
import "./chunk-DZ7JCRAL.mjs";
|
|
19
|
+
import "./chunk-FRT5MFLF.mjs";
|
|
20
|
+
import "./chunk-2LY42EZJ.mjs";
|
|
21
21
|
import "./chunk-4QF2K7TM.mjs";
|
|
22
22
|
import "./chunk-DLIRSHV6.mjs";
|
|
23
23
|
import "./chunk-HBL4PM5Q.mjs";
|
|
24
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-KSQO32L5.mjs";
|
|
25
25
|
import "./chunk-WZYKRD7T.mjs";
|
|
26
26
|
import "./chunk-KRD6H754.mjs";
|
|
27
27
|
export {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var _chunkR4S2AK3Qjs = require('./chunk-R4S2AK3Q.js');
|
|
18
|
+
require('./chunk-JUYW6TSU.js');
|
|
19
|
+
require('./chunk-J3LJ37WD.js');
|
|
20
|
+
require('./chunk-74UO7THC.js');
|
|
21
|
+
require('./chunk-ALJJRZNJ.js');
|
|
22
|
+
require('./chunk-XNYIZMNQ.js');
|
|
23
|
+
require('./chunk-DIAWYWT5.js');
|
|
24
|
+
require('./chunk-ESVK4Z7S.js');
|
|
25
|
+
require('./chunk-OG64RBAC.js');
|
|
26
|
+
require('./chunk-COGTRVWW.js');
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
exports.EXIT_WORKSPACE_MISMATCH = _chunkR4S2AK3Qjs.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunkR4S2AK3Qjs.authStatusLine; exports.clearPendingClaim = _chunkR4S2AK3Qjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkR4S2AK3Qjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunkR4S2AK3Qjs.handleRegister; exports.handleStatus = _chunkR4S2AK3Qjs.handleStatus; exports.handleWait = _chunkR4S2AK3Qjs.handleWait; exports.httpJson = _chunkR4S2AK3Qjs.httpJson; exports.readPendingAuthClaim = _chunkR4S2AK3Qjs.readPendingAuthClaim; exports.readStatusBanner = _chunkR4S2AK3Qjs.readStatusBanner; exports.registerAuthCommands = _chunkR4S2AK3Qjs.registerAuthCommands; exports.reportApprovalLinkShown = _chunkR4S2AK3Qjs.reportApprovalLinkShown; exports.reportSetupCompleted = _chunkR4S2AK3Qjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkR4S2AK3Qjs.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunkR4S2AK3Qjs.statusBannerLine;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DeeplineClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OWH7SSBO.mjs";
|
|
4
4
|
import {
|
|
5
5
|
iterateCursorPages,
|
|
6
6
|
requireBillingIdempotencyKey
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-Q4I5YKN4.mjs";
|
|
8
8
|
import "./chunk-L2VKAASU.mjs";
|
|
9
9
|
import "./chunk-N4TR6QRI.mjs";
|
|
10
10
|
import "./chunk-S3A4IXBQ.mjs";
|
|
@@ -22,9 +22,9 @@ import {
|
|
|
22
22
|
openInBrowser,
|
|
23
23
|
printCommandEnvelope,
|
|
24
24
|
shouldEmitJson
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-DZ7JCRAL.mjs";
|
|
26
|
+
import "./chunk-FRT5MFLF.mjs";
|
|
27
|
+
import "./chunk-2LY42EZJ.mjs";
|
|
28
28
|
import {
|
|
29
29
|
AuthError,
|
|
30
30
|
ConfigError
|
|
@@ -33,7 +33,7 @@ import "./chunk-DLIRSHV6.mjs";
|
|
|
33
33
|
import {
|
|
34
34
|
DeeplineError
|
|
35
35
|
} from "./chunk-HBL4PM5Q.mjs";
|
|
36
|
-
import "./chunk-
|
|
36
|
+
import "./chunk-KSQO32L5.mjs";
|
|
37
37
|
import "./chunk-WZYKRD7T.mjs";
|
|
38
38
|
import "./chunk-KRD6H754.mjs";
|
|
39
39
|
|