deepline 0.3.492 → 0.3.494

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 (185) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +11 -5
  2. package/dist/bundling-sources/sdk/src/plays/run-request.ts +1 -0
  3. package/dist/bundling-sources/sdk/src/release.ts +2 -2
  4. package/dist/bundling-sources/sdk/src/types.ts +11 -4
  5. package/dist/bundling-sources/shared_libs/monitors/fleets/verdict.ts +25 -9
  6. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +36 -0
  7. package/dist/bundling-sources/shared_libs/observability/scheduled-work-manual.ts +5 -4
  8. package/dist/bundling-sources/shared_libs/play-runtime/crustdata-company-identify-batching.ts +162 -0
  9. package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-reaper.ts +19 -3
  10. package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-batching-registry.ts +2 -0
  11. package/dist/bundling-sources/shared_libs/play-runtime/receipt-sql.ts +17 -23
  12. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-modal-fallback.ts +28 -1
  13. package/dist/bundling-sources/shared_libs/play-runtime/runtime-sandbox-placement-policy.ts +75 -0
  14. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +20 -0
  15. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +412 -59
  16. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +38 -10
  17. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-ledger-reconciliation.ts +19 -11
  18. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-operation.ts +165 -12
  19. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +15 -0
  20. package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-state-machine.ts +358 -0
  21. package/dist/bundling-sources/shared_libs/plays/field-catalog.ts +101 -3
  22. package/dist/cli/{auth-4I6QY5WX.mjs → auth-6X5YXMFN.mjs} +5 -5
  23. package/dist/cli/auth-RWLCLMDY.js +43 -0
  24. package/dist/cli/{billing-2H4GOJZY.js → billing-5F5PZB77.js} +80 -80
  25. package/dist/cli/{billing-4F6L4JSI.mjs → billing-IN74SDSC.mjs} +7 -7
  26. package/dist/cli/{chunk-3RGWTKK3.mjs → chunk-2GEYN3H4.mjs} +89 -3
  27. package/dist/cli/{chunk-JJAHWKJ2.js → chunk-3KVFOKPR.js} +73 -59
  28. package/dist/cli/{chunk-NBL6JMIY.js → chunk-4A5WXQJK.js} +17 -17
  29. package/dist/cli/{chunk-YOCEY4EI.mjs → chunk-4RWH4LRQ.mjs} +5 -5
  30. package/dist/cli/{chunk-OGNIB64W.js → chunk-4ZKZS43N.js} +23 -15
  31. package/dist/cli/{chunk-TKLDKIJU.mjs → chunk-5JPKRDFC.mjs} +7 -5
  32. package/dist/cli/{chunk-3TISK5RQ.js → chunk-5WYH2LAP.js} +6 -6
  33. package/dist/cli/{chunk-MQ2LQOAM.mjs → chunk-65NMOP4T.mjs} +23 -9
  34. package/dist/cli/{chunk-O65HDVA7.mjs → chunk-6DMLWM7L.mjs} +5 -5
  35. package/dist/cli/{chunk-OTUT3XTX.mjs → chunk-6XZR2642.mjs} +8 -7
  36. package/dist/cli/{chunk-Q3CCCTRQ.js → chunk-7B7A36XZ.js} +14 -14
  37. package/dist/cli/{chunk-O3K22ZC7.js → chunk-AARXOBVD.js} +35 -11
  38. package/dist/cli/{chunk-DVGCPOEA.mjs → chunk-BLHQRETG.mjs} +187 -187
  39. package/dist/cli/{chunk-NPZBE64X.js → chunk-BLMB4N63.js} +89 -3
  40. package/dist/cli/{chunk-OTDX4A4W.js → chunk-BNI653WN.js} +21 -21
  41. package/dist/cli/{chunk-E47VAVAR.js → chunk-BU5Y7HOD.js} +5 -5
  42. package/dist/cli/{chunk-CGDUFVNE.mjs → chunk-C5R3UH5V.mjs} +29 -2
  43. package/dist/cli/{chunk-HFEJ7JJT.js → chunk-CAWOSHEC.js} +26 -26
  44. package/dist/cli/{chunk-TVUE4CPW.js → chunk-CK5MA6S6.js} +32 -32
  45. package/dist/cli/{chunk-Y7QCMOGZ.mjs → chunk-DKKAJ3U2.mjs} +6 -6
  46. package/dist/cli/{chunk-ONONSV2Q.mjs → chunk-DVQHG6AM.mjs} +1 -0
  47. package/dist/cli/{chunk-3BRDP4UP.mjs → chunk-EG3OSUBO.mjs} +1 -1
  48. package/dist/cli/{chunk-ZCKUNXXR.mjs → chunk-FAT6CUZK.mjs} +1 -1
  49. package/dist/cli/{chunk-YNWET57Z.js → chunk-GBICEYUA.js} +13 -13
  50. package/dist/cli/{chunk-42Z6VC2Q.js → chunk-GDNQXLBM.js} +2 -2
  51. package/dist/cli/{chunk-SE23YSBK.js → chunk-GLDBMKTV.js} +3 -3
  52. package/dist/cli/{chunk-OKHBAAJG.mjs → chunk-GNSGDIA4.mjs} +2 -2
  53. package/dist/cli/{chunk-W4FEX5ZF.js → chunk-GSCCDGGT.js} +261 -261
  54. package/dist/cli/{chunk-A7ZMG2QZ.mjs → chunk-H46X7YDU.mjs} +35 -11
  55. package/dist/cli/{chunk-3IBKEOL4.js → chunk-HINVMRGQ.js} +4 -4
  56. package/dist/cli/{chunk-HHTVRICE.js → chunk-I42EOZKQ.js} +44 -17
  57. package/dist/cli/{chunk-MPITIXW4.mjs → chunk-IPWYDANJ.mjs} +13 -5
  58. package/dist/cli/{chunk-YVOYZPMY.mjs → chunk-IZJSX3SZ.mjs} +2 -2
  59. package/dist/cli/{chunk-FFOJRD53.mjs → chunk-J2HOVZOE.mjs} +3 -3
  60. package/dist/cli/{chunk-EFFHRXKB.js → chunk-J3UHNUWI.js} +2 -2
  61. package/dist/cli/{chunk-4IP5MLWU.js → chunk-JO5FFSR7.js} +6 -1
  62. package/dist/cli/{chunk-PIC6M4X3.mjs → chunk-KR2XEI5T.mjs} +1 -1
  63. package/dist/cli/{chunk-FTXIJTV2.mjs → chunk-KSHAFYYG.mjs} +2 -2
  64. package/dist/cli/{chunk-6YO4OJPM.mjs → chunk-KVCQL6SP.mjs} +99 -24
  65. package/dist/cli/{chunk-RC366IJS.mjs → chunk-L2P2XRPO.mjs} +38 -6
  66. package/dist/cli/{chunk-R5MP3CIY.mjs → chunk-L4QPBQUX.mjs} +3 -3
  67. package/dist/cli/{chunk-4RB74KJX.js → chunk-L6KA4ENU.js} +47 -15
  68. package/dist/cli/{chunk-MJFVF5AW.mjs → chunk-L6L57RSG.mjs} +2 -2
  69. package/dist/cli/{chunk-F6EQWY4E.mjs → chunk-MWZNMWR2.mjs} +2 -2
  70. package/dist/cli/{chunk-LCCFGSV7.mjs → chunk-ODWTFVE4.mjs} +2 -2
  71. package/dist/cli/{chunk-AUQQVDAB.js → chunk-PKV5CD3W.js} +1 -0
  72. package/dist/cli/{chunk-UUH4GQRL.mjs → chunk-QOEI42IU.mjs} +2 -2
  73. package/dist/cli/{chunk-JHBRJDUC.js → chunk-QSRWBOPV.js} +11 -10
  74. package/dist/cli/{chunk-4OLXMJ2L.js → chunk-RLX5ZFNX.js} +8 -6
  75. package/dist/cli/{chunk-EANFUHRM.mjs → chunk-RPFNIMUO.mjs} +1 -1
  76. package/dist/cli/{chunk-DJOLMS2A.js → chunk-S3XQH7DW.js} +2 -2
  77. package/dist/cli/{chunk-DEJIN4DF.mjs → chunk-SAW3FBCA.mjs} +5 -0
  78. package/dist/cli/{chunk-GDSZWTJK.mjs → chunk-TLQXN4ZZ.mjs} +12 -12
  79. package/dist/cli/{chunk-O2FB42N2.js → chunk-USWLB4KV.js} +234 -234
  80. package/dist/cli/{chunk-BDUFZSUL.js → chunk-VMPM2FKT.js} +8 -8
  81. package/dist/cli/{chunk-4GJIJHRQ.mjs → chunk-WCZBIE5L.mjs} +1 -1
  82. package/dist/cli/{chunk-NF7NUKWF.js → chunk-WP45PUPW.js} +132 -57
  83. package/dist/cli/{chunk-FPLN7PHP.js → chunk-X6HIIHQO.js} +5 -5
  84. package/dist/cli/{chunk-B2JE3HD6.js → chunk-Y4GRL533.js} +3 -3
  85. package/dist/cli/{chunk-ZDTPSVGF.js → chunk-ZZD245Z2.js} +10 -10
  86. package/dist/cli/command-docs.js +2 -2
  87. package/dist/cli/command-docs.mjs +1 -1
  88. package/dist/cli/{csv-JGJNDRSA.js → csv-QD7JJGSP.js} +13 -13
  89. package/dist/cli/{csv-VGXGV7YM.mjs → csv-UBW4ID5D.mjs} +4 -4
  90. package/dist/cli/{db-W52WJ6E5.js → db-AARR3WYD.js} +28 -28
  91. package/dist/cli/{db-OYG27ZBM.mjs → db-QFDXKIVD.mjs} +7 -7
  92. package/dist/cli/describe-OBVIAC2H.mjs +50 -0
  93. package/dist/cli/describe-RYJ6HDYD.js +50 -0
  94. package/dist/cli/describe-core.d.mts +5 -11
  95. package/dist/cli/describe-core.d.ts +5 -11
  96. package/dist/cli/describe-core.js +5 -5
  97. package/dist/cli/describe-core.mjs +4 -4
  98. package/dist/cli/{executions-EVE4KUGL.mjs → executions-IZYUDYTZ.mjs} +7 -7
  99. package/dist/cli/{executions-LAJHZGPY.js → executions-KXY7KMZY.js} +9 -9
  100. package/dist/cli/{feedback-ZABCN7RT.js → feedback-3334HBPD.js} +8 -8
  101. package/dist/cli/{feedback-75QB7KVG.mjs → feedback-IVCVBERN.mjs} +4 -4
  102. package/dist/cli/getting-started.d.mts +12 -10
  103. package/dist/cli/getting-started.d.ts +12 -10
  104. package/dist/cli/getting-started.js +4 -2
  105. package/dist/cli/getting-started.mjs +3 -1
  106. package/dist/cli/git-4VLYFHNU.js +25 -0
  107. package/dist/cli/{git-QIFEYQGY.mjs → git-JHNVET5A.mjs} +5 -5
  108. package/dist/cli/index.js +143 -143
  109. package/dist/cli/index.mjs +43 -43
  110. package/dist/cli/{legacy-noops-2TBIAMCM.js → legacy-noops-DBA32JCV.js} +8 -8
  111. package/dist/cli/{legacy-noops-PNTWBBGY.mjs → legacy-noops-WGVBUOCC.mjs} +5 -5
  112. package/dist/cli/{monitors-UKBOEGBS.js → monitors-GHWZ5AZS.js} +169 -129
  113. package/dist/cli/{monitors-LOHUYJEI.mjs → monitors-ZGANC7JY.mjs} +49 -9
  114. package/dist/cli/{org-JRUKUOUF.mjs → org-CUS42N2T.mjs} +7 -7
  115. package/dist/cli/{org-E7A6QLBW.js → org-S7JWP264.js} +73 -73
  116. package/dist/cli/{pages-K76HA473.mjs → pages-IH56T6L6.mjs} +7 -7
  117. package/dist/cli/{pages-EUDFFLLD.js → pages-QXRZDEJW.js} +18 -18
  118. package/dist/cli/{play-UWHNUJRA.js → play-4C5PYS62.js} +661 -566
  119. package/dist/cli/{play-DG2N66SV.mjs → play-Z65ZFOQH.mjs} +147 -52
  120. package/dist/cli/{providers-RUTTPUZD.mjs → providers-FSZSJX4Z.mjs} +7 -7
  121. package/dist/cli/{providers-DZX6TTC6.js → providers-XYQGYF3O.js} +10 -10
  122. package/dist/cli/{quickstart-RGZZN2YE.mjs → quickstart-DHWVE32I.mjs} +5 -5
  123. package/dist/cli/{quickstart-U4NMD7KX.js → quickstart-ZA25RJT3.js} +13 -13
  124. package/dist/cli/{run-5UNF4FHG.js → run-5MP6LEHM.js} +45 -44
  125. package/dist/cli/{run-MOJWQYFQ.mjs → run-WRPPEPLG.mjs} +30 -29
  126. package/dist/cli/search-4SQFVNTB.js +32 -0
  127. package/dist/cli/{search-5B3ZDU7H.mjs → search-A6NVJPKX.mjs} +8 -8
  128. package/dist/cli/{search-output-QS4IWWHA.mjs → search-output-PAOUMVXY.mjs} +7 -4
  129. package/dist/cli/{search-output-VQWJS3FN.js → search-output-YA6TXWGO.js} +9 -6
  130. package/dist/cli/{secrets-S3PJMEAC.js → secrets-AZYOGH3I.js} +16 -16
  131. package/dist/cli/{secrets-V5XVDBIS.mjs → secrets-ZGF7JOBI.mjs} +7 -7
  132. package/dist/cli/{sessions-Y5QMEZ3D.js → sessions-GCIN5VXT.js} +6 -6
  133. package/dist/cli/{sessions-5V3X24XI.mjs → sessions-RNEAXZPV.mjs} +5 -5
  134. package/dist/cli/{settings-3U6RRO5F.js → settings-LMEZNLBB.js} +80 -80
  135. package/dist/cli/{settings-LHZYY5PT.mjs → settings-NO5KXQJF.mjs} +13 -13
  136. package/dist/cli/{setup-AJLWXYAN.mjs → setup-GCYB4IFS.mjs} +13 -13
  137. package/dist/cli/{setup-MLLIGO2S.js → setup-XKTZPYYH.js} +57 -57
  138. package/dist/cli/{skills-5O2MUWKK.mjs → skills-TY4HHIKH.mjs} +10 -10
  139. package/dist/cli/skills-V4APQA2I.js +36 -0
  140. package/dist/cli/tools-HKQLQ7HT.js +57 -0
  141. package/dist/cli/{tools-PWNMI5CD.mjs → tools-RDTHHYJ3.mjs} +21 -21
  142. package/dist/cli/{update-SXT4QW7S.mjs → update-BRLLTTCS.mjs} +10 -10
  143. package/dist/cli/update-Z4MUAHWM.js +34 -0
  144. package/dist/cli/{workflow-KPRM6ARO.mjs → workflow-F72EVZWM.mjs} +8 -8
  145. package/dist/cli/{workflow-3WTF5IYT.js → workflow-YHA4WE3K.js} +18 -18
  146. package/dist/{client-Cb1ej1Vr.d.ts → client-97yTcdLl.d.ts} +1 -1
  147. package/dist/{client-vWpbLNCB.d.mts → client-CFo9qalW.d.mts} +1 -1
  148. package/dist/{client-core-BmVs6SP0.d.ts → client-core-BRZrY13B.d.ts} +15 -8
  149. package/dist/{client-core-CoBTvsXG.d.mts → client-core-Dl6xgfLq.d.mts} +15 -8
  150. package/dist/{compiler-manifest-BFTwq1HI.d.mts → compiler-manifest-CPEF48NM.d.mts} +91 -0
  151. package/dist/{compiler-manifest-BFTwq1HI.d.ts → compiler-manifest-CPEF48NM.d.ts} +91 -0
  152. package/dist/{errors-c3pMsylw.d.ts → errors-B-PJXveg.d.ts} +1 -1
  153. package/dist/{errors-w31ybrQM.d.mts → errors-BWbPzqwo.d.mts} +1 -1
  154. package/dist/{index-DvNtxucX.d.mts → index-BJ8AA1F9.d.mts} +1 -1
  155. package/dist/{index-CQ-15-QL.d.ts → index-CvVxPpE8.d.ts} +1 -1
  156. package/dist/index.d.mts +7 -7
  157. package/dist/index.d.ts +7 -7
  158. package/dist/index.js +27 -19
  159. package/dist/index.mjs +16 -8
  160. package/dist/install-integrity.json +123 -122
  161. package/dist/plays/bundle-play-file.d.mts +3 -3
  162. package/dist/plays/bundle-play-file.d.ts +3 -3
  163. package/dist/plays/play-description.d.mts +2 -2
  164. package/dist/plays/play-description.d.ts +2 -2
  165. package/dist/plays/run-request.d.mts +2 -2
  166. package/dist/plays/run-request.d.ts +2 -2
  167. package/dist/plays/run-request.js +2 -2
  168. package/dist/plays/run-request.mjs +1 -1
  169. package/dist/release.d.mts +2 -2
  170. package/dist/release.d.ts +2 -2
  171. package/dist/release.js +2 -2
  172. package/dist/release.mjs +1 -1
  173. package/dist/server.d.mts +4 -4
  174. package/dist/server.d.ts +4 -4
  175. package/dist/server.js +6 -6
  176. package/dist/server.mjs +4 -4
  177. package/package.json +1 -1
  178. package/dist/cli/auth-7BCLZU6K.js +0 -43
  179. package/dist/cli/describe-FIXCRO5N.mjs +0 -50
  180. package/dist/cli/describe-G3O6OUBG.js +0 -50
  181. package/dist/cli/git-QBAR46NW.js +0 -25
  182. package/dist/cli/search-3DAEJL6S.js +0 -32
  183. package/dist/cli/skills-BBLIML5M.js +0 -36
  184. package/dist/cli/tools-X5SQXUMM.js +0 -57
  185. package/dist/cli/update-AEJ2ZSZQ.js +0 -34
@@ -6,6 +6,364 @@ export type WorkReceiptStateStatus =
6
6
  | 'failed'
7
7
  | 'skipped';
8
8
 
9
+ /**
10
+ * The receipt status machine, declared once for both receipt stores.
11
+ *
12
+ * Every SQL write of a receipt's status takes its allowed-from set from the
13
+ * tables below (`status = ANY($from)`), so the legal moves live here and not
14
+ * in each statement. `absent` is the source of an INSERT: no row exists yet.
15
+ *
16
+ * The two stores hold different machines and this module keeps both, side by
17
+ * side, so a change to one is a visible decision about the other:
18
+ *
19
+ * - The Postgres scheduler (`runtime_scheduler.receipts.status`, text) keeps
20
+ * `pending` (released, free to claim) apart from `queued` (marked by its
21
+ * live owner).
22
+ * - The customer-database store (`status smallint`) stores both as code 0,
23
+ * named `queued` here.
24
+ *
25
+ * `SCHEDULER_TENANT_WORK_RECEIPT_DIFFERENCES` lists where they disagree.
26
+ */
27
+ export const WORK_RECEIPT_STATUSES = [
28
+ 'queued',
29
+ 'pending',
30
+ 'running',
31
+ 'completed',
32
+ 'failed',
33
+ 'skipped',
34
+ ] as const satisfies readonly WorkReceiptStateStatus[];
35
+
36
+ /** Statuses the customer-database store can hold; `pending` is stored as `queued`. */
37
+ export const TENANT_WORK_RECEIPT_STATUSES = [
38
+ 'queued',
39
+ 'running',
40
+ 'completed',
41
+ 'failed',
42
+ 'skipped',
43
+ ] as const satisfies readonly WorkReceiptStateStatus[];
44
+
45
+ export const WORK_RECEIPT_TERMINAL_STATUSES = [
46
+ 'completed',
47
+ 'failed',
48
+ 'skipped',
49
+ ] as const satisfies readonly WorkReceiptStateStatus[];
50
+
51
+ /** Terminal receipts whose output later runs reuse instead of executing. */
52
+ export const WORK_RECEIPT_REUSABLE_STATUSES = [
53
+ 'completed',
54
+ 'skipped',
55
+ ] as const satisfies readonly WorkReceiptStateStatus[];
56
+
57
+ /** Live receipts: claimed by an owner run that has not finished the work. */
58
+ export const WORK_RECEIPT_LIVE_STATUSES = [
59
+ 'queued',
60
+ 'running',
61
+ ] as const satisfies readonly WorkReceiptStateStatus[];
62
+
63
+ export const WORK_RECEIPT_ABSENT = 'absent';
64
+ export type WorkReceiptTransitionSource =
65
+ | WorkReceiptStateStatus
66
+ | typeof WORK_RECEIPT_ABSENT;
67
+
68
+ export type WorkReceiptTransitionSpec = {
69
+ /** Statuses (or `absent`, for an INSERT) the write may start from. */
70
+ readonly from: readonly WorkReceiptTransitionSource[];
71
+ /** Statuses the write may produce. */
72
+ readonly to: readonly WorkReceiptStateStatus[];
73
+ };
74
+
75
+ /**
76
+ * `runtime_scheduler.receipts.status`. Each entry is one write in
77
+ * `scheduler-backends/postgres.ts`; the row-level fences (owner run, attempt,
78
+ * lease) stay in that SQL and narrow these sets further.
79
+ */
80
+ export const SCHEDULER_WORK_RECEIPT_TRANSITIONS = {
81
+ /** claimPostgresSchedulerReceipt(s). A live owner is taken over only when its run is terminal. */
82
+ claim: {
83
+ from: [WORK_RECEIPT_ABSENT, 'pending', 'failed', 'queued', 'running'],
84
+ to: ['running'],
85
+ },
86
+ /** Claim with `reclaimRunning`: an expired or unleased running receipt may be taken over. */
87
+ claim_reclaim_running: {
88
+ from: [WORK_RECEIPT_ABSENT, 'pending', 'failed', 'running'],
89
+ to: ['running'],
90
+ },
91
+ /** Claim with `forceRefresh`: a different run may replace reusable output. */
92
+ claim_force_refresh: {
93
+ from: [
94
+ WORK_RECEIPT_ABSENT,
95
+ 'pending',
96
+ 'failed',
97
+ 'running',
98
+ 'completed',
99
+ 'skipped',
100
+ ],
101
+ to: ['running'],
102
+ },
103
+ /** Leased completion by the running owner and attempt. */
104
+ complete: { from: ['running'], to: ['completed'] },
105
+ /**
106
+ * Immutable cache publication (`COMPLETED_RECEIPT_CACHE_INSERT_LEASE_ID`).
107
+ * It ignores leases: a publisher never waits on a peer, and a live owner's
108
+ * later leased completion matches no row and reads the published value.
109
+ */
110
+ publish_completed: {
111
+ from: [WORK_RECEIPT_ABSENT, 'queued', 'pending', 'running', 'failed'],
112
+ to: ['completed'],
113
+ },
114
+ fail: { from: ['running'], to: ['failed'] },
115
+ /** Exact release by the owner; `pending` is claimable by the next run. */
116
+ release: { from: ['running'], to: ['pending'] },
117
+ /** Attempt cleanup returns every receipt the attempt still holds. */
118
+ release_attempt: { from: ['queued', 'running'], to: ['pending'] },
119
+ mark_running: { from: ['queued', 'running'], to: ['running'] },
120
+ mark_queued: { from: ['queued', 'running'], to: ['queued'] },
121
+ skip: {
122
+ from: [WORK_RECEIPT_ABSENT, 'pending', 'failed', 'running'],
123
+ to: ['skipped'],
124
+ },
125
+ } as const satisfies Record<string, WorkReceiptTransitionSpec>;
126
+
127
+ export type SchedulerWorkReceiptTransition =
128
+ keyof typeof SCHEDULER_WORK_RECEIPT_TRANSITIONS;
129
+
130
+ /**
131
+ * Customer-database receipts (`apps/deepline-api` store-impl, SQL from
132
+ * `receipt-sql.ts`). A lease-aware claim produces `queued`, an unleased one
133
+ * `running`.
134
+ */
135
+ export const TENANT_WORK_RECEIPT_TRANSITIONS = {
136
+ claim: {
137
+ from: [WORK_RECEIPT_ABSENT, 'queued', 'failed'],
138
+ to: ['queued', 'running'],
139
+ },
140
+ claim_reclaim_running: {
141
+ from: [WORK_RECEIPT_ABSENT, 'queued', 'running', 'failed'],
142
+ to: ['queued', 'running'],
143
+ },
144
+ claim_force_refresh: {
145
+ from: [WORK_RECEIPT_ABSENT, 'queued', 'failed', 'completed', 'skipped'],
146
+ to: ['queued', 'running'],
147
+ },
148
+ claim_force_refresh_reclaim_running: {
149
+ from: [
150
+ WORK_RECEIPT_ABSENT,
151
+ 'queued',
152
+ 'failed',
153
+ 'running',
154
+ 'completed',
155
+ 'skipped',
156
+ ],
157
+ to: ['queued', 'running'],
158
+ },
159
+ complete: { from: ['queued', 'running'], to: ['completed'] },
160
+ publish_completed: {
161
+ from: [WORK_RECEIPT_ABSENT, 'queued', 'running', 'failed'],
162
+ to: ['completed'],
163
+ },
164
+ fail: { from: ['queued', 'running'], to: ['failed'] },
165
+ release: { from: ['queued', 'running'], to: ['queued'] },
166
+ mark_running: { from: ['queued', 'running'], to: ['running'] },
167
+ mark_queued: { from: ['queued', 'running'], to: ['queued'] },
168
+ skip: { from: ['queued', 'running'], to: ['skipped'] },
169
+ } as const satisfies Record<string, WorkReceiptTransitionSpec>;
170
+
171
+ export type TenantWorkReceiptTransition =
172
+ keyof typeof TENANT_WORK_RECEIPT_TRANSITIONS;
173
+
174
+ /**
175
+ * Every move out of a terminal status, by name. A transition table entry that
176
+ * leaves a terminal status without a row here fails the conformance test, so a
177
+ * new exit is always a named, reviewed decision.
178
+ */
179
+ export const WORK_RECEIPT_TERMINAL_EXITS = [
180
+ {
181
+ store: 'scheduler',
182
+ transition: 'claim',
183
+ from: 'failed',
184
+ why: 'Failed work is not reusable: another run, or the same run with forceFailedRefresh, retries it.',
185
+ },
186
+ {
187
+ store: 'scheduler',
188
+ transition: 'claim_reclaim_running',
189
+ from: 'failed',
190
+ why: 'As claim.',
191
+ },
192
+ {
193
+ store: 'scheduler',
194
+ transition: 'claim_force_refresh',
195
+ from: 'failed',
196
+ why: 'As claim.',
197
+ },
198
+ {
199
+ store: 'scheduler',
200
+ transition: 'claim_force_refresh',
201
+ from: 'completed',
202
+ why: 'Force refresh from a different run replaces reusable output (seedForcedRuntimeStepReceipts).',
203
+ },
204
+ {
205
+ store: 'scheduler',
206
+ transition: 'claim_force_refresh',
207
+ from: 'skipped',
208
+ why: 'As completed.',
209
+ },
210
+ {
211
+ store: 'scheduler',
212
+ transition: 'publish_completed',
213
+ from: 'failed',
214
+ why: 'A successful re-execution publishes over a non-reusable failure.',
215
+ },
216
+ {
217
+ store: 'scheduler',
218
+ transition: 'skip',
219
+ from: 'failed',
220
+ why: 'The same run (or an unowned row) records a skip over its own failure.',
221
+ },
222
+ {
223
+ store: 'tenant',
224
+ transition: 'claim',
225
+ from: 'failed',
226
+ why: 'As the scheduler claim.',
227
+ },
228
+ {
229
+ store: 'tenant',
230
+ transition: 'claim_reclaim_running',
231
+ from: 'failed',
232
+ why: 'As claim.',
233
+ },
234
+ {
235
+ store: 'tenant',
236
+ transition: 'claim_force_refresh',
237
+ from: 'failed',
238
+ why: 'As claim.',
239
+ },
240
+ {
241
+ store: 'tenant',
242
+ transition: 'claim_force_refresh',
243
+ from: 'completed',
244
+ why: 'As the scheduler force refresh.',
245
+ },
246
+ {
247
+ store: 'tenant',
248
+ transition: 'claim_force_refresh',
249
+ from: 'skipped',
250
+ why: 'As the scheduler force refresh.',
251
+ },
252
+ {
253
+ store: 'tenant',
254
+ transition: 'claim_force_refresh_reclaim_running',
255
+ from: 'failed',
256
+ why: 'As claim.',
257
+ },
258
+ {
259
+ store: 'tenant',
260
+ transition: 'claim_force_refresh_reclaim_running',
261
+ from: 'completed',
262
+ why: 'As the scheduler force refresh.',
263
+ },
264
+ {
265
+ store: 'tenant',
266
+ transition: 'claim_force_refresh_reclaim_running',
267
+ from: 'skipped',
268
+ why: 'As the scheduler force refresh.',
269
+ },
270
+ {
271
+ store: 'tenant',
272
+ transition: 'publish_completed',
273
+ from: 'failed',
274
+ why: 'As the scheduler publication.',
275
+ },
276
+ ] as const;
277
+
278
+ /**
279
+ * Where the two stores' tables disagree, by transition name, after reading the
280
+ * scheduler's `pending` as the customer store's `queued` (both mean free to
281
+ * claim). These predate the shared table and are kept as they are. The
282
+ * conformance test compares the tables and fails when this list no longer
283
+ * names exactly the transitions that differ.
284
+ */
285
+ export const SCHEDULER_TENANT_WORK_RECEIPT_DIFFERENCES = {
286
+ claim:
287
+ 'The scheduler always claims to running and may take over a live (queued or running) receipt once its owner run is terminal. A lease-aware customer claim produces queued, and the customer store claims running only with reclaimRunning.',
288
+ claim_reclaim_running:
289
+ 'The target differs, as for claim. The scheduler also refuses an owner-marked queued receipt, which the customer store cannot tell apart from a free one.',
290
+ claim_force_refresh:
291
+ 'The scheduler admits running on every force refresh, and refuses owner-marked queued; the customer store admits running only when reclaimRunning is also set (claim_force_refresh_reclaim_running).',
292
+ claim_force_refresh_reclaim_running:
293
+ 'Customer store only: the scheduler ignores reclaimRunning when forceRefresh is set.',
294
+ complete:
295
+ 'The scheduler requires running. The customer store also accepts queued, because its lease-aware claim produces queued.',
296
+ fail: 'As complete.',
297
+ release:
298
+ 'The scheduler releases running only; the customer store releases queued or running.',
299
+ release_attempt:
300
+ 'Scheduler only: attempt cleanup returns every receipt the attempt holds to pending.',
301
+ skip: 'The scheduler upserts a skip over an absent, pending, failed or running row; the customer store updates only a live owned row.',
302
+ } as const;
303
+
304
+ /** The SQL `status = ANY($from)` set for a scheduler transition (no `absent`). */
305
+ export function schedulerWorkReceiptFromStatuses(
306
+ transition: SchedulerWorkReceiptTransition,
307
+ ): WorkReceiptStateStatus[] {
308
+ return existingFromStatuses(SCHEDULER_WORK_RECEIPT_TRANSITIONS[transition]);
309
+ }
310
+
311
+ /** The status the scheduler transition writes. */
312
+ export function schedulerWorkReceiptTargetStatus(
313
+ transition: SchedulerWorkReceiptTransition,
314
+ ): WorkReceiptStateStatus {
315
+ const [to] = SCHEDULER_WORK_RECEIPT_TRANSITIONS[transition].to;
316
+ return to;
317
+ }
318
+
319
+ /** The scheduler claim transition for a claim's flags. */
320
+ export function schedulerWorkReceiptClaimTransition(input: {
321
+ forceRefresh?: boolean;
322
+ reclaimRunning?: boolean;
323
+ }): Extract<
324
+ SchedulerWorkReceiptTransition,
325
+ 'claim' | 'claim_reclaim_running' | 'claim_force_refresh'
326
+ > {
327
+ if (input.forceRefresh === true) return 'claim_force_refresh';
328
+ if (input.reclaimRunning === true) return 'claim_reclaim_running';
329
+ return 'claim';
330
+ }
331
+
332
+ /** The customer-database `status = ANY($from)` set (no `absent`). */
333
+ export function tenantWorkReceiptFromStatuses(
334
+ transition: TenantWorkReceiptTransition,
335
+ ): WorkReceiptStateStatus[] {
336
+ return existingFromStatuses(TENANT_WORK_RECEIPT_TRANSITIONS[transition]);
337
+ }
338
+
339
+ /** The customer-database claim transition for a claim's flags. */
340
+ export function tenantWorkReceiptClaimTransition(input: {
341
+ forceRefresh?: boolean;
342
+ reclaimRunning?: boolean;
343
+ }): Extract<
344
+ TenantWorkReceiptTransition,
345
+ | 'claim'
346
+ | 'claim_reclaim_running'
347
+ | 'claim_force_refresh'
348
+ | 'claim_force_refresh_reclaim_running'
349
+ > {
350
+ if (input.forceRefresh === true) {
351
+ return input.reclaimRunning === true
352
+ ? 'claim_force_refresh_reclaim_running'
353
+ : 'claim_force_refresh';
354
+ }
355
+ return input.reclaimRunning === true ? 'claim_reclaim_running' : 'claim';
356
+ }
357
+
358
+ function existingFromStatuses(
359
+ spec: WorkReceiptTransitionSpec,
360
+ ): WorkReceiptStateStatus[] {
361
+ return spec.from.filter(
362
+ (status): status is WorkReceiptStateStatus =>
363
+ status !== WORK_RECEIPT_ABSENT,
364
+ );
365
+ }
366
+
9
367
  export type WorkReceiptStateInput = {
10
368
  status: WorkReceiptStateStatus;
11
369
  runId?: string | null;
@@ -44,6 +44,23 @@ type Group = {
44
44
  };
45
45
 
46
46
  const value = (description: string): Leaf => ({ type: 'string', description });
47
+ const count = (description: string): Leaf => ({ type: 'number', description });
48
+ const date = (description: string): Leaf => ({
49
+ type: 'string',
50
+ description: `${description} An ISO 8601 date.`,
51
+ });
52
+
53
+ // Where something is. Without a kind, a location in some form.
54
+ const LOCATION: Group = {
55
+ description: 'Where it is. Without a kind, a location in some form.',
56
+ leaves: { value: value('The location.') },
57
+ kinds: {
58
+ country: 'The country.',
59
+ region: 'The state, province or region.',
60
+ city: 'The city.',
61
+ address: 'The full street address.',
62
+ },
63
+ };
47
64
 
48
65
  const SOURCE: Leaf = {
49
66
  type: 'string',
@@ -73,6 +90,11 @@ export const FIELD_CATALOG = {
73
90
  type: 'EmailStatus',
74
91
  description: 'The validation verdict and its signals.',
75
92
  },
93
+ available: {
94
+ type: 'boolean',
95
+ description:
96
+ 'Whether the provider has an address it could reveal, without the address itself.',
97
+ },
76
98
  source: SOURCE,
77
99
  },
78
100
  kinds: {
@@ -92,6 +114,11 @@ export const FIELD_CATALOG = {
92
114
  type: '"valid" | "invalid" | "unknown"',
93
115
  description: 'The validation verdict.',
94
116
  },
117
+ available: {
118
+ type: 'boolean',
119
+ description:
120
+ 'Whether the provider has a number it could reveal, without the number itself.',
121
+ },
95
122
  line_type: value('Mobile, landline, VoIP and so on.'),
96
123
  carrier: value('The carrier serving the number.'),
97
124
  source: SOURCE,
@@ -130,8 +157,16 @@ export const FIELD_CATALOG = {
130
157
  type: 'JobChangeStatus',
131
158
  description: 'The job-change verdict alone.',
132
159
  },
160
+ seniority: value('How senior the role is, such as director or VP.'),
161
+ department: value('The department or function, such as sales.'),
162
+ started_at: date('When they started the role.'),
133
163
  },
134
164
  },
165
+ location: LOCATION,
166
+ skills: {
167
+ description: 'Skills the person lists. Usually several: read `.values`.',
168
+ leaves: { value: value('One skill.') },
169
+ },
135
170
  record: {
136
171
  description: "A provider's own record of the person.",
137
172
  leaves: { id: value("The provider's id for the person.") },
@@ -153,7 +188,10 @@ export const FIELD_CATALOG = {
153
188
  },
154
189
  linkedin: {
155
190
  description: "The company's LinkedIn page.",
156
- leaves: { url: value('The page URL.') },
191
+ leaves: {
192
+ url: value('The page URL.'),
193
+ id: value("LinkedIn's numeric id or public identifier for the page."),
194
+ },
157
195
  },
158
196
  phone: {
159
197
  description: 'A phone number for the company.',
@@ -163,6 +201,42 @@ export const FIELD_CATALOG = {
163
201
  description: 'The industry the company is in.',
164
202
  leaves: { value: value('The industry.') },
165
203
  },
204
+ description: {
205
+ description: "What the company does, in its own or a provider's words.",
206
+ leaves: { value: value('The description.') },
207
+ },
208
+ location: LOCATION,
209
+ headcount: {
210
+ description:
211
+ 'How many people work there. Without a kind, a count in some form.',
212
+ leaves: { value: value('The headcount.') },
213
+ kinds: {
214
+ exact: 'A single number of employees.',
215
+ range: 'A range such as 51-200.',
216
+ },
217
+ },
218
+ funding: {
219
+ description: 'Money the company has raised.',
220
+ groups: {
221
+ total: {
222
+ description: 'Everything raised to date.',
223
+ leaves: { value: count('The total, in US dollars.') },
224
+ },
225
+ last_round: {
226
+ description: 'The most recent funding round.',
227
+ leaves: {
228
+ type: value('The round type, such as Series A.'),
229
+ amount: count('The amount raised, in US dollars.'),
230
+ date: date('When it was announced.'),
231
+ },
232
+ },
233
+ },
234
+ },
235
+ technologies: {
236
+ description:
237
+ 'Technologies the company uses. Usually several: read `.values`.',
238
+ leaves: { value: value('One technology.') },
239
+ },
166
240
  record: {
167
241
  description: "A provider's own record of the company.",
168
242
  leaves: { id: value("The provider's id for the company.") },
@@ -171,11 +245,17 @@ export const FIELD_CATALOG = {
171
245
  job: {
172
246
  posting: {
173
247
  description: 'A job posting.',
248
+ leaves: { url: value("The posting's page.") },
174
249
  groups: {
175
250
  title: {
176
251
  description: "The posting's title. Not a person's job title.",
177
252
  leaves: { value: value('The title.') },
178
253
  },
254
+ location: LOCATION,
255
+ posted_at: {
256
+ description: 'When the posting was published.',
257
+ leaves: { value: date('The date.') },
258
+ },
179
259
  },
180
260
  },
181
261
  },
@@ -190,6 +270,10 @@ export const FIELD_CATALOG = {
190
270
  },
191
271
  },
192
272
  post: {
273
+ url: {
274
+ description: "A social or business post's own page.",
275
+ leaves: { value: value('The URL.') },
276
+ },
193
277
  title: {
194
278
  description: "A social or business post's title.",
195
279
  leaves: { value: value('The title.') },
@@ -209,6 +293,10 @@ export const FIELD_CATALOG = {
209
293
  description: "A web page's title.",
210
294
  leaves: { value: value('The title.') },
211
295
  },
296
+ url: {
297
+ description: "A web page's address, when it is not a known profile.",
298
+ leaves: { value: value('The URL.') },
299
+ },
212
300
  },
213
301
  // Some entity's value, when a tool cannot say whether it is a person's or a
214
302
  // company's. Each field here is answered by the same field of either.
@@ -397,12 +485,20 @@ export function fieldOfName(
397
485
  if (declared === undefined) {
398
486
  return meanings.length === 1 ? meanings[0] : undefined;
399
487
  }
488
+ // The tool's own word for an output says nothing by itself, so it is
489
+ // whatever field it declares.
490
+ if (!isSharedName(name)) return isFieldId(declared) ? declared : undefined;
400
491
  return isOtherThing(declared) ||
401
492
  meanings.some((meaning) => relatedFields(declared, meaning))
402
493
  ? declared
403
494
  : undefined;
404
495
  }
405
496
 
497
+ /** Whether `name` is one of the shared output names with catalog meanings. */
498
+ function isSharedName(name: string): boolean {
499
+ return Object.hasOwn(EXTRACTOR_TARGET_FIELDS, name);
500
+ }
501
+
406
502
  function nameMeanings(name: string): readonly string[] {
407
503
  return EXTRACTOR_TARGET_FIELDS[name as DeeplineExtractorTarget] ?? [];
408
504
  }
@@ -480,9 +576,11 @@ export function resolveFieldName(
480
576
  if (isFieldId(name)) return viaId(name);
481
577
  const own = bindings.find((binding) => binding.name === name);
482
578
  // `company_name` that is declared as a podcast's name is not a company name,
483
- // so it is read by its id, never by a name that says something else.
579
+ // so it is read by its id, never by a name that says something else. The
580
+ // tool's own word (`headcount`) means only what it declares.
484
581
  if (own) {
485
- return nameMeanings(name).some((id) => relatedFields(own.id, id))
582
+ return !isSharedName(name) ||
583
+ nameMeanings(name).some((id) => relatedFields(own.id, id))
486
584
  ? byId.get(own.id)
487
585
  : undefined;
488
586
  }
@@ -14,14 +14,14 @@ import {
14
14
  reportSetupCompleted,
15
15
  resolvePendingAuthClaimForResume,
16
16
  statusBannerLine
17
- } from "./chunk-MQ2LQOAM.mjs";
18
- import "./chunk-O65HDVA7.mjs";
19
- import "./chunk-PIC6M4X3.mjs";
20
- import "./chunk-ZCKUNXXR.mjs";
17
+ } from "./chunk-65NMOP4T.mjs";
18
+ import "./chunk-6DMLWM7L.mjs";
19
+ import "./chunk-KR2XEI5T.mjs";
20
+ import "./chunk-FAT6CUZK.mjs";
21
21
  import "./chunk-4QF2K7TM.mjs";
22
22
  import "./chunk-DLIRSHV6.mjs";
23
23
  import "./chunk-HBL4PM5Q.mjs";
24
- import "./chunk-UUH4GQRL.mjs";
24
+ import "./chunk-QOEI42IU.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 _chunk3KVFOKPRjs = require('./chunk-3KVFOKPR.js');
18
+ require('./chunk-ZZD245Z2.js');
19
+ require('./chunk-Y4GRL533.js');
20
+ require('./chunk-HINVMRGQ.js');
21
+ require('./chunk-ALJJRZNJ.js');
22
+ require('./chunk-XNYIZMNQ.js');
23
+ require('./chunk-DIAWYWT5.js');
24
+ require('./chunk-S3XQH7DW.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 = _chunk3KVFOKPRjs.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunk3KVFOKPRjs.authStatusLine; exports.clearPendingClaim = _chunk3KVFOKPRjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunk3KVFOKPRjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunk3KVFOKPRjs.handleRegister; exports.handleStatus = _chunk3KVFOKPRjs.handleStatus; exports.handleWait = _chunk3KVFOKPRjs.handleWait; exports.httpJson = _chunk3KVFOKPRjs.httpJson; exports.readPendingAuthClaim = _chunk3KVFOKPRjs.readPendingAuthClaim; exports.readStatusBanner = _chunk3KVFOKPRjs.readStatusBanner; exports.registerAuthCommands = _chunk3KVFOKPRjs.registerAuthCommands; exports.reportApprovalLinkShown = _chunk3KVFOKPRjs.reportApprovalLinkShown; exports.reportSetupCompleted = _chunk3KVFOKPRjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunk3KVFOKPRjs.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunk3KVFOKPRjs.statusBannerLine;