deepline 0.3.501 → 0.3.502

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 (134) hide show
  1. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  2. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +2 -2
  3. package/dist/bundling-sources/shared_libs/play-runtime/deployment/vercel-fly-rollback-alignment.ts +29 -14
  4. package/dist/bundling-sources/shared_libs/play-runtime/prebuilt-result-quality.ts +264 -0
  5. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +5 -0
  6. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +32 -0
  7. package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-oidc.ts +30 -8
  8. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +22 -4
  9. package/dist/bundling-sources/shared_libs/product-notifications/slack-delivery.ts +2 -0
  10. package/dist/cli/{auth-6ECHXOI4.mjs → auth-EFHLOVG4.mjs} +5 -5
  11. package/dist/cli/auth-VM3IKP5F.js +43 -0
  12. package/dist/cli/{billing-75NZYRXA.mjs → billing-Q5XKEYPP.mjs} +6 -6
  13. package/dist/cli/{billing-QRR7O6BD.js → billing-SKT2VE34.js} +79 -79
  14. package/dist/cli/{chunk-RFV7PPLS.mjs → chunk-2JS3H6H6.mjs} +3 -3
  15. package/dist/cli/{chunk-66XDYH5T.mjs → chunk-2MVIS2UI.mjs} +2 -2
  16. package/dist/cli/{chunk-XEBFJ2PH.js → chunk-2S2F6YSI.js} +41 -41
  17. package/dist/cli/{chunk-463ZOO2L.js → chunk-32YQBJON.js} +7 -7
  18. package/dist/cli/{chunk-EOO7OSS4.mjs → chunk-3KEZVGGV.mjs} +4 -4
  19. package/dist/cli/{chunk-EHVFBD36.mjs → chunk-3MJSWVQ2.mjs} +1 -1
  20. package/dist/cli/{chunk-5S7MLAI7.mjs → chunk-4CCMD7QM.mjs} +20 -19
  21. package/dist/cli/{chunk-T7E3XEPG.mjs → chunk-4WTC5SSN.mjs} +7 -7
  22. package/dist/cli/{chunk-NA3J3F2Z.mjs → chunk-54QXWK3C.mjs} +1 -1
  23. package/dist/cli/{chunk-V5NHEYU7.mjs → chunk-7ZYSXSJJ.mjs} +5 -5
  24. package/dist/cli/{chunk-J6SVNKRP.js → chunk-AJL2Q6IQ.js} +2 -2
  25. package/dist/cli/{chunk-QQ3JJYE2.js → chunk-DKAMCJIT.js} +9 -9
  26. package/dist/cli/{chunk-C5R3UH5V.mjs → chunk-DRBD4IYQ.mjs} +1 -1
  27. package/dist/cli/{chunk-VVEMPC2I.js → chunk-DYHTXGLX.js} +2 -2
  28. package/dist/cli/{chunk-SV2TEZ2M.js → chunk-EUWRKWT4.js} +4 -4
  29. package/dist/cli/{chunk-GBICEYUA.js → chunk-FVM4PS5Q.js} +116 -8
  30. package/dist/cli/{chunk-I42EOZKQ.js → chunk-FWDAEWCD.js} +5 -5
  31. package/dist/cli/{chunk-FS7XYDOF.js → chunk-GINKIZ7S.js} +16 -16
  32. package/dist/cli/{chunk-VTDAJZIJ.mjs → chunk-HIVRCTDR.mjs} +1 -1
  33. package/dist/cli/{chunk-OKOXB3LY.mjs → chunk-HMZF2CSP.mjs} +2 -2
  34. package/dist/cli/{chunk-EKF4DKUA.js → chunk-IL666WJE.js} +5 -5
  35. package/dist/cli/{chunk-HDKXSHGA.js → chunk-JFBJLNBI.js} +53 -53
  36. package/dist/cli/{chunk-KSHAFYYG.mjs → chunk-JFUXUSKB.mjs} +112 -4
  37. package/dist/cli/{chunk-TOE7LHEA.js → chunk-JL6H4H3G.js} +6 -6
  38. package/dist/cli/{chunk-BOFCF4L7.js → chunk-JLYDLK6X.js} +3 -3
  39. package/dist/cli/{chunk-O3DDVP7Z.mjs → chunk-L5CTJY74.mjs} +1 -1
  40. package/dist/cli/{chunk-4OXHLTCP.js → chunk-LA3UYRVZ.js} +1 -1
  41. package/dist/cli/{chunk-Z6AUOV7D.mjs → chunk-MP5QY4A2.mjs} +2 -2
  42. package/dist/cli/{chunk-ZUQHQGC5.mjs → chunk-MYUISF3P.mjs} +5 -5
  43. package/dist/cli/{chunk-WJUDAHIQ.mjs → chunk-NKLM4J4X.mjs} +1 -1
  44. package/dist/cli/{chunk-UJRN6YP6.mjs → chunk-NXVYLX3F.mjs} +2 -2
  45. package/dist/cli/{chunk-J74N375S.mjs → chunk-NZXB27TP.mjs} +4 -4
  46. package/dist/cli/{chunk-VL72UKNW.js → chunk-OEUMXKR5.js} +26 -26
  47. package/dist/cli/{chunk-7L6QNHUL.mjs → chunk-OFBLT2LQ.mjs} +1 -1
  48. package/dist/cli/{chunk-PNF2ZU4R.js → chunk-OVZOMSH2.js} +8 -8
  49. package/dist/cli/{chunk-CJJ7JBM2.js → chunk-Q3NM6ZL3.js} +19 -19
  50. package/dist/cli/{chunk-APAHMCGR.js → chunk-QNELA7SX.js} +53 -53
  51. package/dist/cli/{chunk-EKZQ5LQO.js → chunk-QOJBRCAS.js} +3 -3
  52. package/dist/cli/{chunk-MSLXAVVK.mjs → chunk-R5F7JXT4.mjs} +2 -2
  53. package/dist/cli/{chunk-N2TJJNCW.js → chunk-TAK3MVXY.js} +270 -269
  54. package/dist/cli/{chunk-UR7JOSLT.js → chunk-UOANF3DR.js} +7 -7
  55. package/dist/cli/{chunk-MADTHS56.mjs → chunk-W5CHE5Q2.mjs} +1 -1
  56. package/dist/cli/{chunk-W6JTHVPF.js → chunk-WKFAX2K7.js} +21 -21
  57. package/dist/cli/{chunk-KTOAJP4N.js → chunk-X5MGQ7UT.js} +6 -6
  58. package/dist/cli/{chunk-RU5ROUFO.js → chunk-XMKUJ44Z.js} +5 -5
  59. package/dist/cli/{chunk-5X4AUFYW.js → chunk-YDXEXVBV.js} +7 -7
  60. package/dist/cli/{chunk-PXIF74UJ.mjs → chunk-YL2CCF6T.mjs} +4 -4
  61. package/dist/cli/{chunk-ZUOKIBLJ.mjs → chunk-YWOQYYYS.mjs} +2 -2
  62. package/dist/cli/{chunk-T4U245E4.mjs → chunk-Z2H7OQ6E.mjs} +2 -2
  63. package/dist/cli/{chunk-VD2374K7.mjs → chunk-ZNB6GR3P.mjs} +1 -1
  64. package/dist/cli/{csv-RZJ4SOIL.mjs → csv-6AEPKKCO.mjs} +4 -4
  65. package/dist/cli/{csv-JXX2LXK5.js → csv-OXGSCV75.js} +13 -13
  66. package/dist/cli/{db-T2KJNONM.js → db-6NVHDUZY.js} +27 -27
  67. package/dist/cli/{db-MUTT2NWI.mjs → db-K3KRK4CZ.mjs} +6 -6
  68. package/dist/cli/describe-JOUAXXPE.js +49 -0
  69. package/dist/cli/{describe-K3UMAAVO.mjs → describe-P3ZJS7TQ.mjs} +19 -20
  70. package/dist/cli/describe-core.js +3 -4
  71. package/dist/cli/describe-core.mjs +2 -3
  72. package/dist/cli/{executions-7HSLDRHR.js → executions-2C2FFG52.js} +8 -8
  73. package/dist/cli/{executions-PHS4R2OX.mjs → executions-I7XW6WWK.mjs} +6 -6
  74. package/dist/cli/{feedback-BJZRM637.js → feedback-47B57A5Y.js} +8 -8
  75. package/dist/cli/{feedback-RWMDCIDF.mjs → feedback-RSTNBJAI.mjs} +4 -4
  76. package/dist/cli/{git-YW6VHYZG.mjs → git-3G5AFKBT.mjs} +5 -5
  77. package/dist/cli/git-OPKIC6JQ.js +25 -0
  78. package/dist/cli/index.js +137 -137
  79. package/dist/cli/index.mjs +40 -40
  80. package/dist/cli/{legacy-noops-5UBSUPGG.mjs → legacy-noops-NQ262TKL.mjs} +5 -5
  81. package/dist/cli/{legacy-noops-2WUV2XD7.js → legacy-noops-P665PBG4.js} +8 -8
  82. package/dist/cli/{monitors-YZZRKSTG.js → monitors-IPWAD7LS.js} +95 -95
  83. package/dist/cli/{monitors-HWOQO3OK.mjs → monitors-KUPZODZS.mjs} +7 -7
  84. package/dist/cli/{org-JY7HLHBA.js → org-WFC3N672.js} +72 -72
  85. package/dist/cli/{org-NCXT6RB4.mjs → org-ZCQGEM3L.mjs} +6 -6
  86. package/dist/cli/{pages-6ZOHXL6X.js → pages-N5BNC67L.js} +18 -18
  87. package/dist/cli/{pages-QJO53QAT.mjs → pages-VE66IU7B.mjs} +6 -6
  88. package/dist/cli/{play-SQRS7JN3.mjs → play-EIMDIAJB.mjs} +17 -17
  89. package/dist/cli/{play-TAYGSR35.js → play-NKIRJSKX.js} +315 -315
  90. package/dist/cli/{providers-3IR3N5DT.mjs → providers-KDTJ63ED.mjs} +6 -6
  91. package/dist/cli/{providers-4Q5LOIQ5.js → providers-XU3AGY2F.js} +9 -9
  92. package/dist/cli/{quickstart-ITNUZENY.js → quickstart-OSCHOSXU.js} +6 -6
  93. package/dist/cli/{quickstart-KCZCYO6B.mjs → quickstart-TXFXUODF.mjs} +4 -4
  94. package/dist/cli/{run-YQ57LMKN.js → run-ET2KVTPK.js} +43 -44
  95. package/dist/cli/{run-JCWRWDSK.mjs → run-ODGML35U.mjs} +24 -25
  96. package/dist/cli/search-6U54Y3OK.js +32 -0
  97. package/dist/cli/{search-FUM27HQP.mjs → search-DK67K6PR.mjs} +7 -7
  98. package/dist/cli/{search-output-EWEYT34M.mjs → search-output-6SOKQTCW.mjs} +53 -75
  99. package/dist/cli/{search-output-XAMWKRJH.js → search-output-KXP4FA62.js} +58 -80
  100. package/dist/cli/{secrets-YTI4IAKR.mjs → secrets-C6SYTMU7.mjs} +6 -6
  101. package/dist/cli/{secrets-2IRRRZBL.js → secrets-WPS6NMNK.js} +15 -15
  102. package/dist/cli/{sessions-HWTRDXBQ.js → sessions-IP562J5Z.js} +6 -6
  103. package/dist/cli/{sessions-EFS4KUPF.mjs → sessions-PXVOH34X.mjs} +5 -5
  104. package/dist/cli/{settings-NTOO42DY.mjs → settings-FBUQGYVJ.mjs} +11 -11
  105. package/dist/cli/{settings-FRVEIOKR.js → settings-SUDUIVMY.js} +78 -78
  106. package/dist/cli/{setup-6ZIOAE2V.js → setup-I5H6IOEY.js} +49 -49
  107. package/dist/cli/{setup-PAVQPALX.mjs → setup-JSIMTR73.mjs} +9 -9
  108. package/dist/cli/{skills-3O3XTPUM.mjs → skills-FJQ3LX6N.mjs} +7 -7
  109. package/dist/cli/skills-VHININXC.js +36 -0
  110. package/dist/cli/{tools-7QSB65UL.mjs → tools-IGBK4BVE.mjs} +17 -18
  111. package/dist/cli/tools-XMBMHVKF.js +56 -0
  112. package/dist/cli/{update-T6CYS5ZT.mjs → update-7MTT6F5K.mjs} +9 -9
  113. package/dist/cli/update-H7JVW43I.js +34 -0
  114. package/dist/cli/{workflow-OMSXZ73T.mjs → workflow-PM2J2OU3.mjs} +7 -7
  115. package/dist/cli/{workflow-4KMJBMGX.js → workflow-UX3ZX6BQ.js} +17 -17
  116. package/dist/index.js +9 -9
  117. package/dist/index.mjs +6 -6
  118. package/dist/install-integrity.json +103 -104
  119. package/dist/release.d.mts +1 -1
  120. package/dist/release.d.ts +1 -1
  121. package/dist/release.js +2 -2
  122. package/dist/release.mjs +1 -1
  123. package/dist/server.js +5 -5
  124. package/dist/server.mjs +3 -3
  125. package/package.json +1 -1
  126. package/dist/cli/auth-VP7PMXKQ.js +0 -43
  127. package/dist/cli/chunk-XK5DMLZE.js +0 -111
  128. package/dist/cli/chunk-XRDXNAAY.mjs +0 -111
  129. package/dist/cli/describe-SEXUJLE4.js +0 -50
  130. package/dist/cli/git-VNS7UQWN.js +0 -25
  131. package/dist/cli/search-I425FRTK.js +0 -32
  132. package/dist/cli/skills-6ZNMO2PR.js +0 -36
  133. package/dist/cli/tools-DPV2JES6.js +0 -57
  134. package/dist/cli/update-Q5GUDEAW.js +0 -34
@@ -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.501',
208
+ version: '0.3.502',
209
209
  updateSummary: {
210
210
  introducedIn: '0.3.90',
211
211
  summary:
@@ -723,8 +723,8 @@
723
723
  "owner": "product",
724
724
  "criticality": "reporting",
725
725
  "purpose": "Count the previous UTC day's customer prebuilt Play output rows and rows with a result, per Play and workspace, before the cost stats refresh folds them into the hit rate search shows.",
726
- "successDefinition": "Every scored prebuilt's successful customer root runs from that day are counted from their sheets and saved to prebuiltPlayResultDays.",
727
- "failureDefinition": "Run listing, sheet reads or the Convex write fail, leaving the day's counts missing or partial.",
726
+ "successDefinition": "Completion counts from the previous UTC day are saved to prebuiltPlayResultDays. Unmeasured runs are reported as skipped.",
727
+ "failureDefinition": "Run listing or the Convex write fails, leaving the day's counts missing or partial.",
728
728
  "startGraceMs": 300000,
729
729
  "runTimeoutMs": 600000,
730
730
  "failureAlert": "vercel_route_wrapper",
@@ -276,20 +276,26 @@ export function buildVercelDeploymentSlackText(
276
276
  summary: VercelDeploymentEventSummary,
277
277
  promotion?: { promotedAt: number; timing: VercelPromotionTiming },
278
278
  ): string {
279
+ // At most two lines: what shipped, then how long the release took.
280
+ const subject = summary.vercelProject ?? 'Vercel deployment';
279
281
  const title =
280
282
  summary.eventType === 'deployment.succeeded'
281
- ? ':white_check_mark: Vercel deployment succeeded.'
282
- : ':large_green_circle: Vercel deployment promoted.';
283
- const lines = [
283
+ ? `:white_check_mark: ${subject} build succeeded`
284
+ : `:large_green_circle: ${subject} promoted`;
285
+ const deploymentLabel = summary.deploymentId ?? summary.deploymentUrl;
286
+ const deployment =
287
+ deploymentLabel && summary.deploymentUrl
288
+ ? `<${deploymentUrlWithScheme(summary.deploymentUrl)}|${deploymentLabel}>`
289
+ : deploymentLabel;
290
+ const headline = [
284
291
  title,
285
- summary.vercelProject ? `Project: ${summary.vercelProject}` : null,
286
- summary.deploymentId ? `Deployment: ${summary.deploymentId}` : null,
287
- summary.deploymentUrl ? `URL: ${summary.deploymentUrl}` : null,
288
- summary.target ? `Target: ${summary.target}` : null,
289
- summary.workerBuildId
290
- ? `Aligned worker build: ${summary.workerBuildId}`
292
+ summary.target,
293
+ deployment,
294
+ summary.gitSha
295
+ ? `worker <https://github.com/getaero-io/deepline-api/commit/${summary.gitSha}|git-${summary.gitSha.slice(0, 7)}>`
291
296
  : null,
292
297
  ];
298
+ const timingParts: string[] = [];
293
299
  if (summary.eventType === 'deployment.promoted' && promotion) {
294
300
  const { promotedAt, timing } = promotion;
295
301
  const sinceRequest = promotedAt - timing.requestedAt;
@@ -301,8 +307,8 @@ export function buildVercelDeploymentSlackText(
301
307
  ) {
302
308
  const sinceRelease = promotedAt - (timing.previousReleaseAt ?? NaN);
303
309
  if (Number.isFinite(sinceRelease) && sinceRelease >= 0) {
304
- lines.push(
305
- `Since last successful Production release: ${formatDuration(sinceRelease)}`,
310
+ timingParts.push(
311
+ `${formatDuration(sinceRelease)} since last Production release`,
306
312
  );
307
313
  }
308
314
  const train = timing.train;
@@ -314,13 +320,22 @@ export function buildVercelDeploymentSlackText(
314
320
  train.durationMs >= 0
315
321
  ) {
316
322
  const url = `https://github.com/getaero-io/deepline-api/actions/runs/${train.runId}/attempts/${train.attempt}`;
317
- lines.push(
318
- `CI train: ${formatDuration(train.durationMs)} · <${url}|View run>`,
323
+ timingParts.push(
324
+ `CI train <${url}|${formatDuration(train.durationMs)}>`,
319
325
  );
320
326
  }
321
327
  }
322
328
  }
323
- return lines.filter(Boolean).join('\n');
329
+ return [
330
+ headline.filter(Boolean).join(' · '),
331
+ timingParts.length > 0 ? timingParts.join(' · ') : null,
332
+ ]
333
+ .filter(Boolean)
334
+ .join('\n');
335
+ }
336
+
337
+ function deploymentUrlWithScheme(url: string): string {
338
+ return /^https?:\/\//.test(url) ? url : `https://${url}`;
324
339
  }
325
340
 
326
341
  function formatDuration(durationMs: number): string {
@@ -0,0 +1,264 @@
1
+ import {
2
+ isPlayDataset,
3
+ residentPlayDatasetRows,
4
+ } from '../plays/dataset';
5
+
6
+ const RESULT_COLUMNS = {
7
+ 'company-to-contact': 'contacts',
8
+ 'company-to-domain': 'company_domain',
9
+ 'company-to-info': 'company_domain',
10
+ 'company-to-job-postings': 'job_postings',
11
+ 'company-to-news': 'news_events',
12
+ 'company-to-tech-stack': 'technologies',
13
+ 'name-and-domain-to-email-waterfall': 'email',
14
+ 'person-linkedin-to-company': 'company_domain',
15
+ 'person-linkedin-to-email': 'email',
16
+ 'person-to-email': 'email',
17
+ 'person-to-linkedin': 'linkedin_url',
18
+ 'person-to-linkedin-harvestapi': 'linkedin_url',
19
+ 'person-to-phone': 'phone',
20
+ 'personal-email': 'personal_email',
21
+ 'personal-email-to-linkedin': 'linkedin_url',
22
+ 'professional-to-email': 'email',
23
+ 'smb-business-email': 'email',
24
+ } as const;
25
+
26
+ export const PREBUILT_RESULT_QUALITY_COLUMNS: Readonly<Record<string, string>> =
27
+ {
28
+ ...Object.fromEntries(
29
+ Object.entries(RESULT_COLUMNS).flatMap(([name, column]) => [
30
+ [name, column],
31
+ [`${name}-batch`, column],
32
+ ]),
33
+ ),
34
+ 'company-to-employees-batch': 'employees',
35
+ };
36
+
37
+ const LIST_COLUMNS = new Set([
38
+ 'contacts',
39
+ 'employees',
40
+ 'job_postings',
41
+ 'news_events',
42
+ 'technologies',
43
+ ]);
44
+
45
+ const SOURCE_COLUMNS: Readonly<Record<string, string>> = {
46
+ email: 'email_source',
47
+ personal_email: 'email_source',
48
+ phone: 'phone_source',
49
+ linkedin_url: 'linkedin_source',
50
+ };
51
+
52
+ const DOMAIN_SOURCE_PLAYS = new Set([
53
+ 'company-to-domain',
54
+ 'company-to-domain-batch',
55
+ 'person-linkedin-to-company',
56
+ 'person-linkedin-to-company-batch',
57
+ ]);
58
+ const DOMAIN_SOURCES = new Set([
59
+ 'company_identify',
60
+ 'linkedin_company_page',
61
+ 'company_database',
62
+ 'google_maps',
63
+ 'web_search',
64
+ 'linkedin_profile',
65
+ ]);
66
+
67
+ // Stable attribution buckets. Never put an arbitrary output value into the ledger.
68
+ const SOURCES = new Map([
69
+ ...[
70
+ 'aviato',
71
+ 'contactout',
72
+ 'datagma',
73
+ 'exa',
74
+ 'findymail',
75
+ 'forager',
76
+ 'fullenrich',
77
+ 'hunter',
78
+ 'harvestapi',
79
+ 'icypeas',
80
+ 'leadmagic',
81
+ 'limadata',
82
+ 'openmart',
83
+ 'prospeo',
84
+ 'quickenrich',
85
+ 'serper',
86
+ 'upcell',
87
+ 'wiza',
88
+ ].map((provider) => [provider, provider] as const),
89
+ ['ai_ark', 'ai_ark'],
90
+ ['native', 'deepline_native'],
91
+ ['pdl', 'peopledatalabs'],
92
+ ['trykitt', 'kitt'],
93
+ ['pattern', 'email_pattern'],
94
+ ]);
95
+ const SOURCE_BUCKETS = new Set([
96
+ ...SOURCES.values(),
97
+ ...DOMAIN_SOURCES,
98
+ 'unknown',
99
+ ]);
100
+
101
+ export type PrebuiltResultQuality = {
102
+ rows: number;
103
+ hits: number;
104
+ sources: Record<string, number>;
105
+ };
106
+
107
+ function record(value: unknown): Record<string, unknown> | null {
108
+ return value && typeof value === 'object' && !Array.isArray(value)
109
+ ? (value as Record<string, unknown>)
110
+ : null;
111
+ }
112
+
113
+ function resultShape(reference: string | undefined) {
114
+ if (!reference?.startsWith('prebuilt/')) return undefined;
115
+ const name = reference.slice('prebuilt/'.length);
116
+ if (!Object.hasOwn(PREBUILT_RESULT_QUALITY_COLUMNS, name)) return undefined;
117
+ const column = PREBUILT_RESULT_QUALITY_COLUMNS[name];
118
+ return {
119
+ column,
120
+ sourceColumn: DOMAIN_SOURCE_PLAYS.has(name)
121
+ ? 'company_domain_source'
122
+ : SOURCE_COLUMNS[column],
123
+ };
124
+ }
125
+
126
+ function measureRows(
127
+ { column, sourceColumn }: NonNullable<ReturnType<typeof resultShape>>,
128
+ rows: Iterable<unknown>,
129
+ ): PrebuiltResultQuality | null {
130
+ const quality: PrebuiltResultQuality = { rows: 0, hits: 0, sources: {} };
131
+ for (const item of rows) {
132
+ const row = record(item);
133
+ if (!row || !Object.hasOwn(row, column)) return null;
134
+ quality.rows++;
135
+ const value = row[column];
136
+ if (value === null) continue;
137
+ if (LIST_COLUMNS.has(column)) {
138
+ if (!Array.isArray(value)) return null;
139
+ if (!value.length) continue;
140
+ } else {
141
+ if (typeof value !== 'string') return null;
142
+ if (!value.trim()) continue;
143
+ }
144
+ const source = sourceColumn ? row[sourceColumn] : undefined;
145
+ const prefix =
146
+ typeof source === 'string'
147
+ ? /^(ai_ark|[a-z0-9]+)(?:_|$)/.exec(
148
+ source.replace(/^waterfall:/, ''),
149
+ )?.[1]
150
+ : undefined;
151
+ const bucket =
152
+ sourceColumn === 'company_domain_source'
153
+ ? typeof source === 'string' && DOMAIN_SOURCES.has(source)
154
+ ? source
155
+ : 'unknown'
156
+ : (SOURCES.get(prefix ?? '') ?? 'unknown');
157
+ quality.sources[bucket] = (quality.sources[bucket] ?? 0) + 1;
158
+ quality.hits++;
159
+ }
160
+ return quality;
161
+ }
162
+
163
+ /** Tally only first-attempt writes proved committed by the sheet owner. */
164
+ export function createPrebuiltBatchQualityCollector(
165
+ reference: string | undefined,
166
+ ) {
167
+ const shape = reference?.endsWith('-batch') && resultShape(reference);
168
+ if (!shape) return null;
169
+ const datasets = new Map<string, PrebuiltResultQuality | null>();
170
+ return {
171
+ record(input: {
172
+ datasetId: string;
173
+ rows: ReadonlyArray<{ key: string; status?: string; data: unknown }>;
174
+ committedKeys: readonly string[];
175
+ updated: number;
176
+ recoveredStaleKeys: readonly string[];
177
+ }) {
178
+ if (datasets.get(input.datasetId) === null) return;
179
+ // A reconciled stale write proves ownership but may have been written by
180
+ // another invocation. Its candidate values cannot establish attribution.
181
+ if (
182
+ input.updated !== input.committedKeys.length ||
183
+ input.recoveredStaleKeys.length
184
+ ) {
185
+ datasets.set(input.datasetId, null);
186
+ return;
187
+ }
188
+ const committed = new Set(input.committedKeys);
189
+ const accepted = new Map(
190
+ input.rows
191
+ .filter((row) => committed.has(row.key))
192
+ .map((row) => [row.key, row]),
193
+ );
194
+ const batch =
195
+ accepted.size === committed.size
196
+ ? measureRows(
197
+ shape,
198
+ [...accepted.values()]
199
+ .filter((row) => row.status !== 'failed')
200
+ .map((row) => row.data),
201
+ )
202
+ : null;
203
+ const previous = datasets.get(input.datasetId);
204
+ if (batch && previous) {
205
+ batch.rows += previous.rows;
206
+ batch.hits += previous.hits;
207
+ for (const [source, count] of Object.entries(previous.sources)) {
208
+ batch.sources[source] = (batch.sources[source] ?? 0) + count;
209
+ }
210
+ }
211
+ datasets.set(input.datasetId, batch);
212
+ },
213
+ complete(datasetId: string, rows: number): PrebuiltResultQuality | null {
214
+ const quality = datasets.get(datasetId);
215
+ return quality?.rows === rows ? quality : null;
216
+ },
217
+ };
218
+ }
219
+
220
+ export function measurePrebuiltResultQuality(
221
+ reference: string | undefined,
222
+ result: unknown,
223
+ collector?: ReturnType<typeof createPrebuiltBatchQualityCollector>,
224
+ ): PrebuiltResultQuality | null {
225
+ const shape = resultShape(reference);
226
+ const output = record(result);
227
+ if (!shape || !output) return null;
228
+ if (!reference?.endsWith('-batch')) return measureRows(shape, [output]);
229
+ const [dataset, ...others] = Object.values(output).filter(isPlayDataset);
230
+ if (!dataset || others.length) return null;
231
+ const rows = residentPlayDatasetRows(dataset);
232
+ if (rows) return measureRows(shape, rows);
233
+ // The retained preview is incomplete. Only accept counts proved to cover
234
+ // the entire returned handle. This path never reads the sheet again.
235
+ return collector?.complete(dataset.datasetId, dataset.toJSON().count) ?? null;
236
+ }
237
+
238
+ /** Scheduler boundary. Accept only counts and the fixed attribution vocabulary. */
239
+ export function readPrebuiltResultQuality(
240
+ value: unknown,
241
+ ): PrebuiltResultQuality | null {
242
+ const quality = record(value);
243
+ const sources = record(quality?.sources);
244
+ const count = (n: unknown): n is number =>
245
+ typeof n === 'number' && Number.isSafeInteger(n) && n >= 0;
246
+ if (
247
+ !quality ||
248
+ !sources ||
249
+ !count(quality.rows) ||
250
+ !count(quality.hits) ||
251
+ quality.hits > quality.rows
252
+ )
253
+ return null;
254
+ const cleanSources: Record<string, number> = {};
255
+ let hits = 0;
256
+ for (const [source, n] of Object.entries(sources)) {
257
+ if (!SOURCE_BUCKETS.has(source) || !count(n) || n === 0) return null;
258
+ cleanSources[source] = n;
259
+ hits += n;
260
+ }
261
+ return hits === quality.hits
262
+ ? { rows: quality.rows, hits, sources: cleanSources }
263
+ : null;
264
+ }
@@ -26,6 +26,8 @@ import type { ToolResponseContract } from '../plays/tool-response-contract';
26
26
  import type { FixtureBehavior } from './fixture-behavior';
27
27
  import type { CtxFetchHttpFailureDiagnostic } from './log-provenance';
28
28
 
29
+ import type { PrebuiltResultQuality } from './prebuilt-result-quality';
30
+
29
31
  export type PlayRunnerRateStateBackendConfig =
30
32
  | {
31
33
  kind: 'in_memory';
@@ -305,6 +307,8 @@ export interface PlayRunnerContextConfig extends RetainedPipelineCarrier {
305
307
  rootRunId?: string;
306
308
  runAttempt?: number | null;
307
309
  playName?: string;
310
+ /** Canonical system prebuilt reference for internal result coverage. */
311
+ prebuiltQualityReference?: string;
308
312
  userEmail?: string;
309
313
  /** Authenticated account snapshot projected from durable runtime authority. */
310
314
  runActor?:
@@ -486,6 +490,7 @@ export type PlayRunnerResult =
486
490
  /** Customer-safe runtime observations that must survive bounded log tails. */
487
491
  runtimeDiagnostics?: CtxFetchHttpFailureDiagnostic[];
488
492
  outputRowCount?: number;
493
+ prebuiltResultQuality?: PrebuiltResultQuality;
489
494
  rowOutcomes?: PlayRunnerRowOutcomeSummary;
490
495
  logs: string[];
491
496
  logIds?: string[];
@@ -1,4 +1,8 @@
1
1
  import { runtimeToolPath } from '../runtime-api-paths';
2
+ import {
3
+ createPrebuiltBatchQualityCollector,
4
+ measurePrebuiltResultQuality,
5
+ } from '../prebuilt-result-quality';
2
6
  import {
3
7
  emptyRowFailureCounts,
4
8
  readRowFailureCounts,
@@ -2342,6 +2346,15 @@ async function run(
2342
2346
  writeVersion?: number;
2343
2347
  }
2344
2348
  >();
2349
+ // A resumed map can return the rows completed by this invocation alone.
2350
+ const prebuiltQualityReference =
2351
+ config.checkpoint &&
2352
+ config.context.prebuiltQualityReference?.endsWith('-batch')
2353
+ ? undefined
2354
+ : config.context.prebuiltQualityReference;
2355
+ const prebuiltBatchQuality = createPrebuiltBatchQualityCollector(
2356
+ prebuiltQualityReference,
2357
+ );
2345
2358
  const membershipCapturingMaps = new Set<string>();
2346
2359
  const runtimeMapDatasetSettlements = new Map<
2347
2360
  string,
@@ -3258,6 +3271,19 @@ async function run(
3258
3271
  });
3259
3272
  const datasetPath = `datasets.${input.tableNamespace}`;
3260
3273
  const datasetId = createRuntimeDatasetId(playName, input.tableNamespace);
3274
+ if (
3275
+ prebuiltBatchQuality &&
3276
+ canUseRootPreloadedDbSessions &&
3277
+ playName === config.context.playName
3278
+ ) {
3279
+ prebuiltBatchQuality.record({
3280
+ datasetId,
3281
+ rows: input.rows,
3282
+ committedKeys: result.committedKeys,
3283
+ updated: result.updated,
3284
+ recoveredStaleKeys,
3285
+ });
3286
+ }
3261
3287
  const settlement = runtimeMapDatasetSettlements.get(datasetId) ?? {
3262
3288
  datasetId,
3263
3289
  path: datasetPath,
@@ -3713,6 +3739,11 @@ async function run(
3713
3739
  ]),
3714
3740
  ).values(),
3715
3741
  ).slice(0, 16);
3742
+ const prebuiltResultQuality = measurePrebuiltResultQuality(
3743
+ prebuiltQualityReference,
3744
+ result,
3745
+ prebuiltBatchQuality,
3746
+ );
3716
3747
  const checkpoint = ctx.getCheckpoint();
3717
3748
  const rowOutcomes = rowOutcomesFromCheckpoint(checkpoint);
3718
3749
 
@@ -3731,6 +3762,7 @@ async function run(
3731
3762
  logMetadata: terminalLogMetadata(ctx),
3732
3763
  ...(runtimeDiagnostics.length > 0 ? { runtimeDiagnostics } : {}),
3733
3764
  ...(rowOutcomes ? { rowOutcomes } : {}),
3765
+ ...(prebuiltResultQuality ? { prebuiltResultQuality } : {}),
3734
3766
  stats: runtimeStats(),
3735
3767
  steps: ctx.getSteps(),
3736
3768
  checkpoint,
@@ -115,6 +115,30 @@ export function resolveRuntimeGatewayOidcEnvironment(): RuntimeGatewayOidcEnviro
115
115
  return isTestOnlyRuntime() ? 'preview' : 'production';
116
116
  }
117
117
 
118
+ /**
119
+ * The environment a signing key was published for, or null for an unpublished
120
+ * kid. A signer takes its environment from its own key: a Fly worker's
121
+ * `NODE_ENV` is inlined when its bundle is built, so the process test above
122
+ * reads "preview" there even in Production. The verifier is unaffected: a
123
+ * deployment still accepts only its own environment's kids and claim, so a
124
+ * Preview key cannot produce a credential Production accepts.
125
+ */
126
+ export function runtimeGatewayOidcEnvironmentForKid(
127
+ kid: string,
128
+ trust: RuntimeGatewayOidcTrust = RUNTIME_GATEWAY_OIDC_TRUST,
129
+ ): RuntimeGatewayOidcEnvironment | null {
130
+ const environments = (['production', 'preview'] as const).filter(
131
+ (environment) => trust.environmentKids[environment].includes(kid),
132
+ );
133
+ if (environments.length > 1) {
134
+ throw new RuntimeGatewayOidcError(
135
+ 'signing_key_not_published',
136
+ `Runtime gateway OIDC key id "${kid}" is published for both environments; every kid must belong to exactly one.`,
137
+ );
138
+ }
139
+ return environments[0] ?? null;
140
+ }
141
+
118
142
  /** Key material a caller trusts; defaults to the code-owned constants. */
119
143
  export type RuntimeGatewayOidcTrust = Readonly<{
120
144
  jwks: Readonly<{ keys: readonly RuntimeGatewayOidcPublicJwk[] }>;
@@ -266,7 +290,7 @@ export function mintRuntimeGatewayOidcToken(input: {
266
290
  runId: string;
267
291
  attempt: number;
268
292
  nowMs: number;
269
- /** Defaults to this process's environment. */
293
+ /** Defaults to the environment the signing key is published for. */
270
294
  environment?: RuntimeGatewayOidcEnvironment;
271
295
  /** Defaults to the code-owned keys. */
272
296
  trust?: RuntimeGatewayOidcTrust;
@@ -283,15 +307,13 @@ export function mintRuntimeGatewayOidcToken(input: {
283
307
  'Runtime gateway OIDC claims are invalid.',
284
308
  );
285
309
  }
310
+ const trust = input.trust ?? RUNTIME_GATEWAY_OIDC_TRUST;
286
311
  const environment =
287
- input.environment ?? resolveRuntimeGatewayOidcEnvironment();
312
+ input.environment ??
313
+ runtimeGatewayOidcEnvironmentForKid(input.signingKey.kid, trust) ??
314
+ resolveRuntimeGatewayOidcEnvironment();
288
315
  const key = rsaPrivateKey(input.signingKey);
289
- assertSigningKeyPublished(
290
- input.signingKey,
291
- key,
292
- environment,
293
- input.trust ?? RUNTIME_GATEWAY_OIDC_TRUST,
294
- );
316
+ assertSigningKeyPublished(input.signingKey, key, environment, trust);
295
317
  const iat = Math.floor(input.nowMs / 1_000);
296
318
  const claims: RuntimeGatewayOidcClaims = {
297
319
  iss: RUNTIME_GATEWAY_OIDC_ISSUER,
@@ -1,3 +1,4 @@
1
+ import { readPrebuiltResultQuality } from '../prebuilt-result-quality';
1
2
  import { resolveRuntimeAppTransport } from '../runtime-app-transport';
2
3
  import {
3
4
  terminalRuntimePerformanceFromStats,
@@ -11572,9 +11573,7 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
11572
11573
  input.result,
11573
11574
  { logMetadata: input.completionLogMetadata ?? 'attach' },
11574
11575
  );
11575
- const resultSummary = terminalRowOutcomesSummary(
11576
- (input.result as { rowOutcomes?: unknown }).rowOutcomes,
11577
- );
11576
+ const resultSummary = completedResultSummary(input.result);
11578
11577
  const terminalResult = assertTerminalRunResultWithinLimit(terminalOutput);
11579
11578
  const ledgerTerminalResult = terminalRunResultForLedger(terminalResult, {
11580
11579
  content: 'full',
@@ -15142,6 +15141,7 @@ export async function completePostgresSchedulerAttempt(
15142
15141
  leaseToken: string;
15143
15142
  output: unknown;
15144
15143
  rowOutcomes?: unknown;
15144
+ prebuiltResultQuality?: unknown;
15145
15145
  runtimeTiming?: PlayRunnerRuntimeTiming | null;
15146
15146
  terminalLogLines?: readonly string[] | null;
15147
15147
  terminalLogContexts?: readonly (PlayLogContext | null)[] | null;
@@ -15162,7 +15162,7 @@ export async function completePostgresSchedulerAttempt(
15162
15162
  const ledgerTerminalResult = terminalRunResultForLedger(terminalResult, {
15163
15163
  content: 'full',
15164
15164
  });
15165
- const resultSummary = terminalRowOutcomesSummary(input.rowOutcomes);
15165
+ const resultSummary = completedResultSummary(input);
15166
15166
  if (
15167
15167
  input.terminalLogContexts != null &&
15168
15168
  input.terminalLogContexts.length !== (input.terminalLogLines ?? []).length
@@ -16483,6 +16483,16 @@ function finiteRunnerNumber(value: unknown): number | null {
16483
16483
  : null;
16484
16484
  }
16485
16485
 
16486
+ function completedResultSummary(value: unknown) {
16487
+ const result = value as {
16488
+ rowOutcomes?: unknown;
16489
+ prebuiltResultQuality?: unknown;
16490
+ } | null;
16491
+ const outcomes = terminalRowOutcomesSummary(result?.rowOutcomes);
16492
+ const quality = readPrebuiltResultQuality(result?.prebuiltResultQuality);
16493
+ return quality ? { ...outcomes, prebuiltResultQuality: quality } : outcomes;
16494
+ }
16495
+
16486
16496
  function terminalRowOutcomesSummary(value: unknown): {
16487
16497
  rowOutcomes: {
16488
16498
  completedRows?: number;
@@ -17039,6 +17049,9 @@ export async function executePostgresSchedulerClaim(
17039
17049
  output: terminalOutput,
17040
17050
  terminalRuntimeStats: (output as { stats?: unknown } | null)?.stats,
17041
17051
  rowOutcomes: (output as { rowOutcomes?: unknown } | null)?.rowOutcomes,
17052
+ prebuiltResultQuality: (
17053
+ output as { prebuiltResultQuality?: unknown } | null
17054
+ )?.prebuiltResultQuality,
17042
17055
  runtimeTiming: extractRunnerRuntimeTiming(output),
17043
17056
  terminalLogLines: terminalLogProjection.lines,
17044
17057
  terminalLogContexts: terminalLogProjection.lineContexts,
@@ -17336,6 +17349,11 @@ export function buildPostgresSchedulerRunnerContext(
17336
17349
  rootRunId,
17337
17350
  runAttempt,
17338
17351
  playName: launch.playName,
17352
+ ...(launch.definitionScope === 'system' &&
17353
+ launch.playReference?.startsWith('prebuilt/') &&
17354
+ rootRunId === launch.runId
17355
+ ? { prebuiltQualityReference: launch.playReference }
17356
+ : {}),
17339
17357
  userEmail: launch.userEmail,
17340
17358
  runActor: playRunActor(launch.runtimeAuthority),
17341
17359
  force: launch.force === true,
@@ -468,6 +468,8 @@ function attachVercelLogsToPayload(
468
468
  ): SlackPayload {
469
469
  if (
470
470
  channel === 'plain_thread_activity' ||
471
+ // Deploy notices come from the Vercel webhook; its request log is noise.
472
+ channel === 'deploy_events' ||
471
473
  normalizeText(payload.vercelLogsUrl)
472
474
  ) {
473
475
  return payload;
@@ -14,14 +14,14 @@ import {
14
14
  reportSetupCompleted,
15
15
  resolvePendingAuthClaimForResume,
16
16
  statusBannerLine
17
- } from "./chunk-RFV7PPLS.mjs";
18
- import "./chunk-66XDYH5T.mjs";
19
- import "./chunk-MADTHS56.mjs";
20
- import "./chunk-EHVFBD36.mjs";
17
+ } from "./chunk-2JS3H6H6.mjs";
18
+ import "./chunk-2MVIS2UI.mjs";
19
+ import "./chunk-W5CHE5Q2.mjs";
20
+ import "./chunk-3MJSWVQ2.mjs";
21
21
  import "./chunk-4QF2K7TM.mjs";
22
22
  import "./chunk-DLIRSHV6.mjs";
23
23
  import "./chunk-HBL4PM5Q.mjs";
24
- import "./chunk-7L6QNHUL.mjs";
24
+ import "./chunk-OFBLT2LQ.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 _chunkJFBJLNBIjs = require('./chunk-JFBJLNBI.js');
18
+ require('./chunk-YDXEXVBV.js');
19
+ require('./chunk-JLYDLK6X.js');
20
+ require('./chunk-EUWRKWT4.js');
21
+ require('./chunk-ALJJRZNJ.js');
22
+ require('./chunk-XNYIZMNQ.js');
23
+ require('./chunk-DIAWYWT5.js');
24
+ require('./chunk-LA3UYRVZ.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 = _chunkJFBJLNBIjs.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunkJFBJLNBIjs.authStatusLine; exports.clearPendingClaim = _chunkJFBJLNBIjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkJFBJLNBIjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunkJFBJLNBIjs.handleRegister; exports.handleStatus = _chunkJFBJLNBIjs.handleStatus; exports.handleWait = _chunkJFBJLNBIjs.handleWait; exports.httpJson = _chunkJFBJLNBIjs.httpJson; exports.readPendingAuthClaim = _chunkJFBJLNBIjs.readPendingAuthClaim; exports.readStatusBanner = _chunkJFBJLNBIjs.readStatusBanner; exports.registerAuthCommands = _chunkJFBJLNBIjs.registerAuthCommands; exports.reportApprovalLinkShown = _chunkJFBJLNBIjs.reportApprovalLinkShown; exports.reportSetupCompleted = _chunkJFBJLNBIjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkJFBJLNBIjs.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunkJFBJLNBIjs.statusBannerLine;