deepline 0.3.510 → 0.3.511

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 (146) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +159 -0
  2. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  3. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +3 -3
  4. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +218 -33
  5. package/dist/cli/artifacts-G6JHRHY5.mjs +268 -0
  6. package/dist/cli/artifacts-PLF5ZUS7.js +268 -0
  7. package/dist/cli/{auth-USS2W3UV.mjs → auth-2XMJMDWG.mjs} +5 -5
  8. package/dist/cli/auth-PI2KS2CD.js +43 -0
  9. package/dist/cli/{billing-JCUWM5XB.mjs → billing-6C5AI42X.mjs} +7 -7
  10. package/dist/cli/{billing-LQQHU443.js → billing-Z3XFXP3H.js} +82 -82
  11. package/dist/cli/{chunk-XRLE2FPE.js → chunk-2Q4H2Y6N.js} +6 -6
  12. package/dist/cli/{chunk-4ZIIS6KG.js → chunk-2YVRIXVR.js} +9 -9
  13. package/dist/cli/{chunk-V6DLYRSO.mjs → chunk-5WTLXL6O.mjs} +1 -1
  14. package/dist/cli/{chunk-ZRACZKEE.mjs → chunk-77DPQI6W.mjs} +62 -0
  15. package/dist/cli/{chunk-CLV4T5FN.mjs → chunk-ASXOFBF7.mjs} +2 -2
  16. package/dist/cli/{chunk-LF3FF2B2.js → chunk-BHV7JKXQ.js} +1 -1
  17. package/dist/cli/{chunk-ZCYV6MZH.js → chunk-D5VWSR4D.js} +5 -5
  18. package/dist/cli/{chunk-F6IXWFPF.js → chunk-FAGSSIOY.js} +6 -6
  19. package/dist/cli/{chunk-XK3AJFYQ.js → chunk-FF25PDQ2.js} +62 -0
  20. package/dist/cli/{chunk-YYUVOUEH.mjs → chunk-FTT2SBBH.mjs} +5 -5
  21. package/dist/cli/{chunk-5N2HFB3G.js → chunk-FV4PASXH.js} +16 -16
  22. package/dist/cli/{chunk-6AL2VF3E.js → chunk-GD3ES3JU.js} +14 -14
  23. package/dist/cli/{chunk-VPJSQMWQ.js → chunk-GGQHOLH6.js} +3 -3
  24. package/dist/cli/{chunk-5DU7RXDW.mjs → chunk-GJWL4KTY.mjs} +4 -4
  25. package/dist/cli/{chunk-DMF56C6D.mjs → chunk-HLEZQDEZ.mjs} +2 -2
  26. package/dist/cli/{chunk-FND6GZZ4.mjs → chunk-ISY7PBIK.mjs} +5 -5
  27. package/dist/cli/{chunk-XJZU7KO4.js → chunk-IYWN7M4I.js} +5 -5
  28. package/dist/cli/{chunk-PQ56GE55.mjs → chunk-JDDKJIZU.mjs} +1 -1
  29. package/dist/cli/{chunk-UV524JZ5.mjs → chunk-JHBZBCU4.mjs} +1 -1
  30. package/dist/cli/{chunk-4NJK6P5T.js → chunk-JIY25SUX.js} +4 -4
  31. package/dist/cli/{chunk-XL4FFVWL.js → chunk-JYFLIQPE.js} +7 -7
  32. package/dist/cli/{chunk-N7FV7OM3.js → chunk-K4JB2BZP.js} +96 -96
  33. package/dist/cli/{chunk-EJ57CA2L.mjs → chunk-KK6NZHAJ.mjs} +1 -1
  34. package/dist/cli/{chunk-3LXU22UZ.js → chunk-KUDNPJ43.js} +2 -2
  35. package/dist/cli/{chunk-KXSOZYCS.mjs → chunk-KXGH4YUQ.mjs} +1 -1
  36. package/dist/cli/{chunk-HC27PYJM.js → chunk-KZBKQPSA.js} +2 -2
  37. package/dist/cli/{chunk-B2T7PBS6.js → chunk-LDZYGM7W.js} +41 -41
  38. package/dist/cli/{chunk-YDALHHUC.js → chunk-LKSJXTRP.js} +53 -53
  39. package/dist/cli/{chunk-QRQBKLOM.js → chunk-NVMNMKZW.js} +3 -3
  40. package/dist/cli/{chunk-EEQ2QQOH.js → chunk-O37BQ2CG.js} +10 -10
  41. package/dist/cli/{chunk-7BF4R26M.mjs → chunk-OQ4YBPOQ.mjs} +3 -3
  42. package/dist/cli/{chunk-B2U3LVSO.mjs → chunk-PCI4MMH7.mjs} +1 -1
  43. package/dist/cli/{chunk-JNECQ5QF.js → chunk-PI45LZ5B.js} +11 -11
  44. package/dist/cli/{chunk-ASBWPRBN.js → chunk-PUFEARWT.js} +16 -16
  45. package/dist/cli/{chunk-WAOLTP6R.mjs → chunk-QDWNVTTO.mjs} +2 -2
  46. package/dist/cli/{chunk-RHKFNEV2.mjs → chunk-RPPU3XB3.mjs} +2 -2
  47. package/dist/cli/{chunk-Q5EJO4TE.mjs → chunk-S5C4CWSS.mjs} +5 -5
  48. package/dist/cli/{chunk-563HM4D2.mjs → chunk-S6KEACD3.mjs} +6 -6
  49. package/dist/cli/{chunk-WC5754QJ.mjs → chunk-SI4QXATV.mjs} +5 -5
  50. package/dist/cli/{chunk-HOKOJGQW.mjs → chunk-VEOFISLZ.mjs} +1 -1
  51. package/dist/cli/{chunk-BPGFNVH2.js → chunk-VHFTN6VY.js} +44 -44
  52. package/dist/cli/{chunk-DEPBCRKG.mjs → chunk-VQ74WMKG.mjs} +3 -3
  53. package/dist/cli/{chunk-JY73USD7.js → chunk-WDBEWOU6.js} +2 -2
  54. package/dist/cli/{chunk-7VQKU6MS.js → chunk-XGXXNT4O.js} +270 -199
  55. package/dist/cli/{chunk-JVEU6MXD.mjs → chunk-XREZY4FA.mjs} +1 -1
  56. package/dist/cli/{chunk-OEG6VCK4.mjs → chunk-XSBGWMI6.mjs} +72 -1
  57. package/dist/cli/{chunk-B6Q6BHSY.mjs → chunk-XXQZYLLL.mjs} +2 -2
  58. package/dist/cli/{chunk-7VT7RMZ2.mjs → chunk-XZ6IZIQJ.mjs} +2 -2
  59. package/dist/cli/{chunk-63DHG7BM.js → chunk-YX7E2VQM.js} +26 -26
  60. package/dist/cli/{chunk-5MYXW6M6.mjs → chunk-ZFJ2U76O.mjs} +2 -2
  61. package/dist/cli/{chunk-2JXEZAJF.js → chunk-ZWGBQKW7.js} +21 -21
  62. package/dist/cli/{chunk-FFPLCSTZ.mjs → chunk-ZYVR4A4P.mjs} +10 -10
  63. package/dist/cli/command-docs.js +2 -2
  64. package/dist/cli/command-docs.mjs +1 -1
  65. package/dist/cli/{csv-MTFVEDPU.mjs → csv-CNK6ZF3T.mjs} +4 -4
  66. package/dist/cli/{csv-UXFQZLZM.js → csv-S44OGG2O.js} +13 -13
  67. package/dist/cli/{db-3WPUYCCI.mjs → db-AVO6QJU6.mjs} +6 -6
  68. package/dist/cli/{db-RGWT6B7K.js → db-WKZ6EXNG.js} +27 -27
  69. package/dist/cli/{describe-XJY5654F.mjs → describe-2HQRT5MI.mjs} +18 -18
  70. package/dist/cli/describe-CCK77NER.js +50 -0
  71. package/dist/cli/describe-core.d.mts +2 -2
  72. package/dist/cli/describe-core.d.ts +2 -2
  73. package/dist/cli/{executions-PDE4V5YH.mjs → executions-DKHOR7HD.mjs} +6 -6
  74. package/dist/cli/{executions-IWTALFNB.js → executions-MTAHNARA.js} +8 -8
  75. package/dist/cli/{feedback-BMOVTPC4.mjs → feedback-K6SJS4LG.mjs} +5 -5
  76. package/dist/cli/{feedback-I72P4XZS.js → feedback-R2UABU3E.js} +10 -10
  77. package/dist/cli/{git-QJG3EF4P.mjs → git-3EPA7433.mjs} +5 -5
  78. package/dist/cli/git-7L3PY2A4.js +25 -0
  79. package/dist/cli/index.js +148 -144
  80. package/dist/cli/index.mjs +47 -43
  81. package/dist/cli/{legacy-noops-5P75CQC7.js → legacy-noops-3Q2D2F24.js} +9 -9
  82. package/dist/cli/{legacy-noops-MZ45GDMK.mjs → legacy-noops-66OPCJJD.mjs} +6 -6
  83. package/dist/cli/{monitors-VIOBUG2X.mjs → monitors-2PYPRWT4.mjs} +7 -7
  84. package/dist/cli/{monitors-5PHQZDZM.js → monitors-KHH4MZDF.js} +100 -100
  85. package/dist/cli/{org-D5RTFJNY.mjs → org-WAW3OL7B.mjs} +6 -6
  86. package/dist/cli/{org-B5LDVP2P.js → org-X5G36B2Q.js} +72 -72
  87. package/dist/cli/{pages-XWZL3YV2.mjs → pages-KABWXDGW.mjs} +6 -6
  88. package/dist/cli/{pages-BUJYG3JL.js → pages-XDPHCHHU.js} +18 -18
  89. package/dist/cli/{play-OSXLGCLZ.mjs → play-654B2HQU.mjs} +18 -18
  90. package/dist/cli/{play-SEC3EE7H.js → play-UE5FKQCO.js} +317 -317
  91. package/dist/cli/{providers-RQPUASLI.js → providers-QT2BZMJ7.js} +9 -9
  92. package/dist/cli/{providers-ENSURIW6.mjs → providers-SKNGX6IT.mjs} +6 -6
  93. package/dist/cli/{quickstart-HJTK6XWI.mjs → quickstart-BX7XMJIQ.mjs} +4 -4
  94. package/dist/cli/{quickstart-XDTU4MAT.js → quickstart-XWDVAQTT.js} +6 -6
  95. package/dist/cli/{run-GX2SU5AT.js → run-C6YYD4AK.js} +41 -41
  96. package/dist/cli/{run-ZMWSQAR2.mjs → run-JTU4K4MY.mjs} +23 -23
  97. package/dist/cli/{search-DZHZBHWT.mjs → search-NHV4Y4SX.mjs} +8 -8
  98. package/dist/cli/search-RIFW5JCK.js +33 -0
  99. package/dist/cli/{search-output-MNHAR754.mjs → search-output-AAOMFK7K.mjs} +4 -4
  100. package/dist/cli/{search-output-3JVZERNV.js → search-output-WLFFEGCY.js} +6 -6
  101. package/dist/cli/{secrets-WO2LMDQ2.js → secrets-H4WTLQJJ.js} +15 -15
  102. package/dist/cli/{secrets-VALVNVXB.mjs → secrets-S66PZSRO.mjs} +6 -6
  103. package/dist/cli/sessions-EFWO62XJ.js +18 -0
  104. package/dist/cli/{sessions-EPYCH3AY.mjs → sessions-PY6FJX3O.mjs} +6 -6
  105. package/dist/cli/{settings-W2ABZUD4.mjs → settings-V7BM42KQ.mjs} +13 -13
  106. package/dist/cli/{settings-OSF4O5HM.js → settings-YO4FFPN6.js} +86 -86
  107. package/dist/cli/{setup-DCXNQG6R.js → setup-IFZYYQ2W.js} +50 -50
  108. package/dist/cli/{setup-XI2ERSMQ.mjs → setup-VUBM2HMH.mjs} +10 -10
  109. package/dist/cli/{skills-ZO4AH2YR.mjs → skills-EYWRSQQJ.mjs} +8 -8
  110. package/dist/cli/skills-LFP53SWQ.js +37 -0
  111. package/dist/cli/tools-SR2Q7KC5.js +57 -0
  112. package/dist/cli/{tools-FTECXZYA.mjs → tools-VZOW4MUD.mjs} +17 -17
  113. package/dist/cli/update-ADZBZZZS.js +35 -0
  114. package/dist/cli/{update-WPFZO2JE.mjs → update-CQDJJYU2.mjs} +10 -10
  115. package/dist/cli/{workflow-7X75IP3D.mjs → workflow-2VRDIPF3.mjs} +7 -7
  116. package/dist/cli/{workflow-PKMU33LV.js → workflow-XS3JEU6X.js} +17 -17
  117. package/dist/{client-DMpsMNH9.d.mts → client-By7bUS8h.d.mts} +1 -1
  118. package/dist/{client-BlwD-G4v.d.ts → client-CmlKSBXd.d.ts} +1 -1
  119. package/dist/{client-core-DwBLuEkm.d.ts → client-core-BM0mKhgp.d.ts} +93 -1
  120. package/dist/{client-core-CITtRTbB.d.mts → client-core-BZ3tpY_J.d.mts} +93 -1
  121. package/dist/index.d.mts +3 -3
  122. package/dist/index.d.ts +3 -3
  123. package/dist/index.js +9 -9
  124. package/dist/index.mjs +6 -6
  125. package/dist/install-integrity.json +110 -108
  126. package/dist/plays/play-description.d.mts +1 -1
  127. package/dist/plays/play-description.d.ts +1 -1
  128. package/dist/plays/run-request.d.mts +1 -1
  129. package/dist/plays/run-request.d.ts +1 -1
  130. package/dist/release.d.mts +1 -1
  131. package/dist/release.d.ts +1 -1
  132. package/dist/release.js +2 -2
  133. package/dist/release.mjs +1 -1
  134. package/dist/server.d.mts +2 -2
  135. package/dist/server.d.ts +2 -2
  136. package/dist/server.js +5 -5
  137. package/dist/server.mjs +3 -3
  138. package/package.json +1 -1
  139. package/dist/cli/auth-S2Z5YMU3.js +0 -43
  140. package/dist/cli/describe-LNCLA2LA.js +0 -50
  141. package/dist/cli/git-QWH7SPGF.js +0 -25
  142. package/dist/cli/search-7WPABWYO.js +0 -33
  143. package/dist/cli/sessions-2IA2DGWO.js +0 -18
  144. package/dist/cli/skills-QMD2WARJ.js +0 -37
  145. package/dist/cli/tools-53E6GBQU.js +0 -57
  146. package/dist/cli/update-PPPNR6J5.js +0 -35
@@ -2956,6 +2956,49 @@ export type HostedPageLink = {
2956
2956
  created_at: number;
2957
2957
  };
2958
2958
 
2959
+ export type ArtifactAccess = 'workspace' | 'public';
2960
+
2961
+ export type Artifact = {
2962
+ id: string;
2963
+ name: string;
2964
+ description: string | null;
2965
+ url: string;
2966
+ play: string;
2967
+ input: Record<string, unknown>;
2968
+ access: ArtifactAccess;
2969
+ created_at: number;
2970
+ updated_at: number;
2971
+ };
2972
+
2973
+ export type ArtifactAbilities = {
2974
+ create: boolean;
2975
+ edit: boolean;
2976
+ delete: boolean;
2977
+ setAccess: boolean;
2978
+ refresh: boolean;
2979
+ admin: boolean;
2980
+ };
2981
+
2982
+ export type ArtifactDetail = Artifact & {
2983
+ can: ArtifactAbilities | null;
2984
+ };
2985
+
2986
+ export type ArtifactRunSummary = {
2987
+ run_id: string;
2988
+ status: string;
2989
+ created_at: number;
2990
+ finished_at: number | null;
2991
+ };
2992
+
2993
+ export type ArtifactPermissionLevel = 'members' | 'admins';
2994
+ export type ArtifactPermissionRules = {
2995
+ create: ArtifactPermissionLevel;
2996
+ edit: ArtifactPermissionLevel;
2997
+ delete: ArtifactPermissionLevel;
2998
+ setAccess: ArtifactPermissionLevel;
2999
+ refresh: ArtifactPermissionLevel;
3000
+ };
3001
+
2959
3002
  /**
2960
3003
  * Low-level typed REST client with authentication, retries, and localhost failover.
2961
3004
  *
@@ -3340,6 +3383,122 @@ export class DeeplineClient {
3340
3383
  );
3341
3384
  }
3342
3385
 
3386
+ // ——————————————————————————————————————————————————————————
3387
+ // Artifacts
3388
+ // ——————————————————————————————————————————————————————————
3389
+
3390
+ /** List this workspace's artifacts, most recently changed first. */
3391
+ async listArtifacts(input?: {
3392
+ cursor?: string;
3393
+ limit?: number;
3394
+ }): Promise<{ artifacts: Artifact[]; next_cursor: string | null }> {
3395
+ const params = new URLSearchParams();
3396
+ if (input?.cursor) params.set('cursor', input.cursor);
3397
+ if (input?.limit) params.set('limit', String(input.limit));
3398
+ const query = params.size > 0 ? `?${params}` : '';
3399
+ return await this.http.get(`/api/v2/artifacts${query}`);
3400
+ }
3401
+
3402
+ /** One artifact and what the caller may do with it. */
3403
+ async getArtifact(id: string): Promise<ArtifactDetail> {
3404
+ return await this.http.get<ArtifactDetail>(
3405
+ `/api/v2/artifacts/${encodeURIComponent(id)}`,
3406
+ );
3407
+ }
3408
+
3409
+ /** Create an artifact that shows a Play's runs at a fixed URL. */
3410
+ async createArtifact(input: {
3411
+ name: string;
3412
+ play: string;
3413
+ input?: Record<string, unknown>;
3414
+ description?: string;
3415
+ }): Promise<Artifact> {
3416
+ return await this.http.post<Artifact>('/api/v2/artifacts', input);
3417
+ }
3418
+
3419
+ /** Change the name, description, Play, or saved input. */
3420
+ async updateArtifact(
3421
+ id: string,
3422
+ input: {
3423
+ name?: string;
3424
+ description?: string | null;
3425
+ play?: string;
3426
+ input?: Record<string, unknown>;
3427
+ },
3428
+ ): Promise<Artifact> {
3429
+ return await this.http.patch<Artifact>(
3430
+ `/api/v2/artifacts/${encodeURIComponent(id)}`,
3431
+ input,
3432
+ );
3433
+ }
3434
+
3435
+ /** Who can open an artifact: workspace members, or anyone with its URL. */
3436
+ async setArtifactAccess(
3437
+ id: string,
3438
+ access: ArtifactAccess,
3439
+ ): Promise<Artifact> {
3440
+ return await this.http.post<Artifact>(
3441
+ `/api/v2/artifacts/${encodeURIComponent(id)}/access`,
3442
+ { access },
3443
+ );
3444
+ }
3445
+
3446
+ /** Every run of the artifact's Play, newest first. */
3447
+ async listArtifactRuns(
3448
+ id: string,
3449
+ input?: { limit?: number; offset?: number },
3450
+ ): Promise<{ runs: ArtifactRunSummary[]; total: number }> {
3451
+ const params = new URLSearchParams();
3452
+ if (input?.limit) params.set('limit', String(input.limit));
3453
+ if (input?.offset) params.set('offset', String(input.offset));
3454
+ const query = params.size > 0 ? `?${params}` : '';
3455
+ return await this.http.get(
3456
+ `/api/v2/artifacts/${encodeURIComponent(id)}/runs${query}`,
3457
+ );
3458
+ }
3459
+
3460
+ /**
3461
+ * Refresh an artifact: run its Play with its saved input (or `input`). The run
3462
+ * goes through the normal run API; the artifact shows it when it finishes.
3463
+ */
3464
+ async refreshArtifact(
3465
+ id: string,
3466
+ input?: Record<string, unknown>,
3467
+ ): Promise<PlayRunStart & { artifact: string }> {
3468
+ const intent = await this.http.post<{
3469
+ id: string;
3470
+ play: string;
3471
+ input: Record<string, unknown>;
3472
+ }>(`/api/v2/artifacts/${encodeURIComponent(id)}/refresh`, {});
3473
+ const started = await this.startPlayRun({
3474
+ name: intent.play,
3475
+ input: input ?? intent.input,
3476
+ });
3477
+ return { ...started, artifact: intent.id };
3478
+ }
3479
+
3480
+ /** Delete an artifact. Its Play and runs are not touched. */
3481
+ async deleteArtifact(id: string): Promise<{ id: string; deleted: boolean }> {
3482
+ return await this.http.delete(
3483
+ `/api/v2/artifacts/${encodeURIComponent(id)}`,
3484
+ );
3485
+ }
3486
+
3487
+ /** The workspace artifact rules and what the caller may do. */
3488
+ async getArtifactPermissions(): Promise<{
3489
+ rules: ArtifactPermissionRules;
3490
+ can: ArtifactAbilities | null;
3491
+ }> {
3492
+ return await this.http.get('/api/v2/artifacts/permissions');
3493
+ }
3494
+
3495
+ /** Change artifact rules. Admins only; omitted verbs keep their rule. */
3496
+ async setArtifactPermissions(
3497
+ rules: Partial<ArtifactPermissionRules>,
3498
+ ): Promise<{ rules: ArtifactPermissionRules }> {
3499
+ return await this.http.put('/api/v2/artifacts/permissions', { rules });
3500
+ }
3501
+
3343
3502
  /** List secret metadata visible to the current workspace. */
3344
3503
  async listSecrets(): Promise<PlaySecretMetadata[]> {
3345
3504
  const response = await this.http.get<{ secrets?: PlaySecretMetadata[] }>(
@@ -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.510',
208
+ version: '0.3.511',
209
209
  updateSummary: {
210
210
  introducedIn: '0.3.90',
211
211
  summary:
@@ -1400,15 +1400,15 @@
1400
1400
  "id": "convex.refresh-tool-usage-popularity",
1401
1401
  "name": "Refresh tool usage popularity",
1402
1402
  "scheduler": "convex_cron",
1403
- "cadence": "37 0 * * *",
1403
+ "cadence": "37 * * * *",
1404
1404
  "timezone": "UTC",
1405
1405
  "source": "packages/convex/crons.ts",
1406
1406
  "locator": "refresh tool usage popularity snapshot",
1407
1407
  "owner": "integrations",
1408
1408
  "criticality": "operational",
1409
1409
  "purpose": "Sum distinct user-days per tool over the last 28 complete UTC days into the snapshot tools search uses as a ranking prior, then delete user-day rows past retention.",
1410
- "successDefinition": "A new snapshot row is written and expired user-day rows are drained; an empty snapshot is valid before any usage is folded.",
1411
- "failureDefinition": "Reading daily counts, writing the snapshot, or draining expired rows fails, leaving search on the previous snapshot.",
1410
+ "successDefinition": "A complete snapshot is published and up to 2,000 expired user-day records are removed; an empty snapshot is valid before usage is folded.",
1411
+ "failureDefinition": "If a scan exceeds its input budget or any required read or write fails, Search keeps serving the previous snapshot.",
1412
1412
  "startGraceMs": 120000,
1413
1413
  "runTimeoutMs": 1800000,
1414
1414
  "failureAlert": "convex_action_wrapper",
@@ -482,12 +482,27 @@ const HEARTBEAT_CLAIM_TIMEOUT_SECONDS = RUNTIME_CLAIM_LEASE_SECONDS;
482
482
  export const ABSURD_IDLE_POLL_INTERVAL_SECONDS = 30;
483
483
  /**
484
484
  * Worker modes that intentionally have no wake hook keep a fast durable poll.
485
- * Active lanes with an election hook use the slower standby cadence below
486
- * when they are not the elected listener.
485
+ * Active lanes with an election hook use the standby cadence below when they
486
+ * are not the elected listener.
487
487
  */
488
488
  export const ABSURD_WAKE_UNAVAILABLE_POLL_INTERVAL_MS = 1_000;
489
- /** A standby lane still discovers new work durably if its elected listener is unavailable. */
490
- export const ABSURD_ACTIVE_STANDBY_POLL_INTERVAL_MS =
489
+ /**
490
+ * How often an active-lane worker that is not the elected listener looks for
491
+ * new work. Only one worker per queue holds the LISTEN session, so at a
492
+ * burst's onset every other idle worker learns of the backlog from this poll.
493
+ * Each poll is `hasAbsurdQueueDueWork`, a few index seeks, and the claim runs
494
+ * only when it finds due work (`runAbsurdStandbyDueWorkProbe`), as
495
+ * `docs/runtime-postgres-idle-polling.md` requires of an idle claim poller.
496
+ * At 30 s, Production bursts on 2026-11-11 left a live second Machine idle
497
+ * for 25-33 s while runs queued.
498
+ */
499
+ export const ABSURD_ACTIVE_STANDBY_POLL_INTERVAL_MS = 1_000;
500
+ /**
501
+ * A standby's unprobed claim, which also projects manual cancellations
502
+ * (`afterClaim`), keeps its 30-second durable bound. It covers a probe that
503
+ * keeps failing; the probe above carries the normal discovery latency.
504
+ */
505
+ export const ABSURD_ACTIVE_STANDBY_CLAIM_FALLBACK_MS =
491
506
  ABSURD_IDLE_POLL_INTERVAL_SECONDS * 1000;
492
507
  /**
493
508
  * An adopted (retired) lane is served by durable polling only. Its parked
@@ -1852,19 +1867,16 @@ export async function parkAndResolveSuspension(input: {
1852
1867
  ceilingDeadlineMs,
1853
1868
  inspectDetachedRunner: input.inspectDetachedRunner,
1854
1869
  suspension,
1855
- probeControlPlaneOutage:
1856
- input.observeControlPlaneOutage
1857
- ? async (probeStepName) => {
1858
- const observedAtMs = await ctx.step(
1859
- `${suspension.boundaryId}:liveness-confirm-heartbeat:${renewed?.heartbeatIdentity ?? renewed?.heartbeatAt ?? 'none'}:${probeStepName}`,
1860
- async () =>
1861
- (await input.observeControlPlaneOutage?.())
1862
- ? Date.now()
1863
- : 0,
1864
- );
1865
- if (observedAtMs > 0) outageObservedAtMs = observedAtMs;
1866
- }
1867
- : undefined,
1870
+ probeControlPlaneOutage: input.observeControlPlaneOutage
1871
+ ? async (probeStepName) => {
1872
+ const observedAtMs = await ctx.step(
1873
+ `${suspension.boundaryId}:liveness-confirm-heartbeat:${renewed?.heartbeatIdentity ?? renewed?.heartbeatAt ?? 'none'}:${probeStepName}`,
1874
+ async () =>
1875
+ (await input.observeControlPlaneOutage?.()) ? Date.now() : 0,
1876
+ );
1877
+ if (observedAtMs > 0) outageObservedAtMs = observedAtMs;
1878
+ }
1879
+ : undefined,
1868
1880
  runnerResponded: async () => {
1869
1881
  // A wake replays every finished slice. One read per replay is enough.
1870
1882
  if (Date.now() < quietUntilMs) return false;
@@ -8903,8 +8915,10 @@ export function selectAbsurdAdoptionQueues(input: {
8903
8915
  *
8904
8916
  * - No `onWake`: an adopted queue never opens a direct LISTEN session (see
8905
8917
  * `ABSURD_ADOPTED_LANE_POLL_INTERVAL_MS`).
8906
- * - `idlePollFallbackMs` is the same 30-second durable bound used by active
8907
- * lanes waiting for their elected listener.
8918
+ * - `idlePollFallbackMs` is the same 30-second durable bound as an active
8919
+ * lane's unprobed standby claim (`ABSURD_ACTIVE_STANDBY_CLAIM_FALLBACK_MS`).
8920
+ * Adopted lanes run no 1-second standby probe: their parked waits tolerate
8921
+ * the adoption rotation already.
8908
8922
  * - `nextPollDelayMs` still shortens the wait to the lane's next indexed due
8909
8923
  * transition, so an already-due parked wake is claimed on the next pass.
8910
8924
  */
@@ -10616,10 +10630,133 @@ export async function readAbsurdQueueNextDueAt(
10616
10630
  return (await readAbsurdQueueNextDue(client, queue)).dueAt;
10617
10631
  }
10618
10632
 
10633
+ /**
10634
+ * Whether `absurd.claim_task` on this queue would do anything now: claim a
10635
+ * runnable run, fail an expired claim lease, or cancel a task past its
10636
+ * deadline. Each branch is a superset of the matching `claim_task` predicate
10637
+ * (the claim also checks its task row), so `false` proves the claim would
10638
+ * select nothing. Each branch is an ordered seek on the index `claim_task`
10639
+ * itself uses (`r_<queue>_sai`, `r_<queue>_cei`, `t_<queue>_cai`), bounded by
10640
+ * now. `readAbsurdQueueNextDue` cannot stand in for it: its
10641
+ * `min(available_at)` over two states aggregates every parked run.
10642
+ */
10643
+ export async function hasAbsurdQueueDueWork(
10644
+ client: RuntimeSchedulerQueryClient,
10645
+ queue: string,
10646
+ ): Promise<boolean> {
10647
+ const runTable = quotePostgresIdentifier(`r_${queue}`);
10648
+ const taskTable = quotePostgresIdentifier(`t_${queue}`);
10649
+ // `absurd.current_time()` is volatile, so it cannot bound an index scan
10650
+ // directly. Read it once (honouring `absurd.fake_now`, like claim_task) and
10651
+ // compare against the materialized value.
10652
+ const result = await client.query<{ due: boolean }>(
10653
+ `WITH clock AS MATERIALIZED (SELECT absurd.current_time() AS now)
10654
+ SELECT (
10655
+ (SELECT run_id FROM absurd.${runTable}
10656
+ WHERE state = 'pending'
10657
+ AND available_at <= (SELECT now FROM clock)
10658
+ ORDER BY available_at LIMIT 1) IS NOT NULL
10659
+ OR (SELECT run_id FROM absurd.${runTable}
10660
+ WHERE state = 'sleeping'
10661
+ AND available_at <= (SELECT now FROM clock)
10662
+ ORDER BY available_at LIMIT 1) IS NOT NULL
10663
+ OR (SELECT run_id FROM absurd.${runTable}
10664
+ WHERE state = 'running'
10665
+ AND claim_expires_at IS NOT NULL
10666
+ AND claim_expires_at <= (SELECT now FROM clock)
10667
+ ORDER BY claim_expires_at LIMIT 1) IS NOT NULL
10668
+ OR (SELECT task_id FROM absurd.${taskTable}
10669
+ WHERE state IN ('pending', 'sleeping', 'running')
10670
+ AND cancel_at IS NOT NULL
10671
+ AND cancel_at <= (SELECT now FROM clock)
10672
+ ORDER BY cancel_at LIMIT 1) IS NOT NULL
10673
+ ) AS due`,
10674
+ );
10675
+ return result.rows[0]?.due === true;
10676
+ }
10677
+
10678
+ /**
10679
+ * Wraps the engine's two maintenance hooks to tell whether its claim loop can
10680
+ * take work. The engine calls `saturatedMaintenance` only while every slot is
10681
+ * busy, and `afterClaim` only after a claim, which it attempts only with a free
10682
+ * slot; the later of the two is the loop's current state. When a slot frees,
10683
+ * the engine claims by itself, so a stale saturated reading lasts only until
10684
+ * that claim.
10685
+ */
10686
+ export function trackAbsurdClaimLoopCapacity(hooks: {
10687
+ afterClaim: () => Promise<void>;
10688
+ saturatedMaintenance: () => Promise<void>;
10689
+ }): {
10690
+ afterClaim: () => Promise<void>;
10691
+ saturatedMaintenance: () => Promise<void>;
10692
+ hasIdleSlot: () => boolean;
10693
+ } {
10694
+ let saturated = false;
10695
+ return {
10696
+ afterClaim: () => {
10697
+ saturated = false;
10698
+ return hooks.afterClaim();
10699
+ },
10700
+ saturatedMaintenance: () => {
10701
+ saturated = true;
10702
+ return hooks.saturatedMaintenance();
10703
+ },
10704
+ hasIdleSlot: () => !saturated,
10705
+ };
10706
+ }
10707
+
10708
+ /**
10709
+ * The standby half of the active lane's wake path. The elected listener is
10710
+ * woken by NOTIFY; every other worker on the queue runs this loop. Each tick
10711
+ * runs `probe` (`hasAbsurdQueueDueWork`) and, when it finds due work, wakes the
10712
+ * engine's claim loop, which claims at once. An empty tick costs only the
10713
+ * probe, so polling every second never plans the multi-kilobyte claim on an
10714
+ * idle queue.
10715
+ *
10716
+ * Skipped while this worker is the listener (NOTIFY already wakes it) and while
10717
+ * every slot is busy: a woken saturated loop only repeats its maintenance, and
10718
+ * the engine claims by itself as soon as a slot frees.
10719
+ */
10720
+ export async function runAbsurdStandbyDueWorkProbe(input: {
10721
+ isListening: () => boolean;
10722
+ /** False while the claim loop last stopped because every slot was busy. */
10723
+ hasIdleSlot: () => boolean;
10724
+ probe: () => Promise<boolean>;
10725
+ /** The engine's "poll now" trigger; a lossy hint like any other wake. */
10726
+ wake: () => boolean;
10727
+ shouldStop: () => boolean;
10728
+ intervalMs?: number;
10729
+ sleep?: (ms: number) => Promise<void>;
10730
+ onWake?: () => void;
10731
+ onError: (error: unknown) => void;
10732
+ }): Promise<void> {
10733
+ const intervalMs = Math.max(
10734
+ 1,
10735
+ Math.floor(input.intervalMs ?? ABSURD_ACTIVE_STANDBY_POLL_INTERVAL_MS),
10736
+ );
10737
+ const wait = input.sleep ?? ((ms: number) => sleep(ms));
10738
+ while (!input.shouldStop()) {
10739
+ await wait(intervalMs);
10740
+ if (input.shouldStop()) return;
10741
+ // A failed tick is reported and retried next interval; the loop never
10742
+ // exits early, or the standby would silently fall back to its 30 s claim.
10743
+ try {
10744
+ if (input.isListening() || !input.hasIdleSlot()) continue;
10745
+ if ((await input.probe()) && !input.shouldStop() && input.wake()) {
10746
+ input.onWake?.();
10747
+ }
10748
+ } catch (error) {
10749
+ input.onError(error);
10750
+ }
10751
+ }
10752
+ }
10753
+
10619
10754
  /**
10620
10755
  * Only an active lane participates in the wake election. The winner owns one
10621
- * direct LISTEN session; each loser immediately closes its session and uses
10622
- * the bounded durable polling fallback until it can win a later election.
10756
+ * direct LISTEN session; each loser immediately closes its session and finds
10757
+ * work through the 1-second standby probe (`runAbsurdStandbyDueWorkProbe`),
10758
+ * with the bounded durable claim fallback beneath it, until it can win a later
10759
+ * election.
10623
10760
  */
10624
10761
  export type AbsurdWorkerWakeHook = ((
10625
10762
  wake: () => void,
@@ -10718,10 +10855,12 @@ export function createAbsurdWorkerWakeHook(input: {
10718
10855
  };
10719
10856
  // A local hint does not establish LISTEN health. Preserve the fast durable
10720
10857
  // fallback on isolated workers, including when a hint is lost or unavailable.
10858
+ // A direct-notify standby discovers work through its 1-second probe
10859
+ // (`runAbsurdStandbyDueWorkProbe`); its unprobed claim keeps the 30 s bound.
10721
10860
  hook.idlePollFallbackMs =
10722
10861
  input.useDirectNotify === false
10723
10862
  ? ABSURD_WAKE_UNAVAILABLE_POLL_INTERVAL_MS
10724
- : ABSURD_ACTIVE_STANDBY_POLL_INTERVAL_MS;
10863
+ : ABSURD_ACTIVE_STANDBY_CLAIM_FALLBACK_MS;
10725
10864
  hook.close = () => {
10726
10865
  closed = true;
10727
10866
  listening = false;
@@ -10903,15 +11042,16 @@ export async function startRuntimeWorkerHost(
10903
11042
  ...recovered,
10904
11043
  });
10905
11044
  }
11045
+ const useDirectNotify = shouldUseRuntimeSchedulerDirectNotify(
11046
+ schedulerOptions.schema,
11047
+ );
10906
11048
  const onWake = createAbsurdWorkerWakeHook({
10907
11049
  poolOptions,
10908
11050
  queue,
10909
11051
  // A draining lane is deliberately cold except while it has runnable work.
10910
11052
  // It must not compete with the active lane for the one direct LISTEN slot.
10911
11053
  draining: drainExit,
10912
- useDirectNotify: shouldUseRuntimeSchedulerDirectNotify(
10913
- schedulerOptions.schema,
10914
- ),
11054
+ useDirectNotify,
10915
11055
  enableWakeHints: true,
10916
11056
  });
10917
11057
  const reportCancellationProgress = createRateLimitedRuntimeLogger({
@@ -10946,11 +11086,7 @@ export async function startRuntimeWorkerHost(
10946
11086
  const reportQueueError = createRateLimitedRuntimeLogger({
10947
11087
  log: (...args) => console.error(...args),
10948
11088
  });
10949
- const worker = await absurdClient.startWorker({
10950
- workerId: `${workerBase}:${queue}`,
10951
- concurrency: slots,
10952
- claimTimeout: HEARTBEAT_CLAIM_TIMEOUT_SECONDS,
10953
- pollInterval: ABSURD_IDLE_POLL_INTERVAL_SECONDS,
11089
+ const claimLoop = trackAbsurdClaimLoopCapacity({
10954
11090
  // `claim_task` performs the indexed max_delay sweep. Reconcile after every
10955
11091
  // sweep, including claims that return backlog work, so a saturated queue
10956
11092
  // cannot postpone a cancellation's scheduler/outbox terminal indefinitely.
@@ -10960,6 +11096,14 @@ export async function startRuntimeWorkerHost(
10960
11096
  // by sweeping without claiming, then project cancellation into the
10961
11097
  // scheduler/outbox.
10962
11098
  saturatedMaintenance: sweepAndReconcileCancellations,
11099
+ });
11100
+ const worker = await absurdClient.startWorker({
11101
+ workerId: `${workerBase}:${queue}`,
11102
+ concurrency: slots,
11103
+ claimTimeout: HEARTBEAT_CLAIM_TIMEOUT_SECONDS,
11104
+ pollInterval: ABSURD_IDLE_POLL_INTERVAL_SECONDS,
11105
+ afterClaim: claimLoop.afterClaim,
11106
+ saturatedMaintenance: claimLoop.saturatedMaintenance,
10963
11107
  nextPollDelayMs: () =>
10964
11108
  withRuntimeSchedulerClient(poolOptions, async (client) => {
10965
11109
  const nextDue = await readAbsurdQueueNextDue(client, queue);
@@ -10967,15 +11111,51 @@ export async function startRuntimeWorkerHost(
10967
11111
  return nextDue.dueAt.getTime() - Date.now();
10968
11112
  }),
10969
11113
  // Once this lane is the elected healthy listener, a transactional NOTIFY
10970
- // wakes it. Standby/down lanes use a 30-second safety poll to avoid
10971
- // repeating empty claims on every worker; the indexed next-due read still
10972
- // shortens the wait for known deadlines.
11114
+ // wakes it. Standby/down lanes find new work through the 1-second probe
11115
+ // below and keep a 30-second unprobed claim, so idle workers never repeat
11116
+ // empty claims; the indexed next-due read still shortens the wait for
11117
+ // known deadlines.
10973
11118
  idlePollFallbackMs: () => resolveAbsurdIdlePollFallbackMs(onWake),
10974
11119
  onWake,
10975
11120
  fatalOnLeaseTimeout: false,
10976
11121
  onError: (error) =>
10977
11122
  reportQueueError('[absurd-runtime.worker] queue_error', { queue, error }),
10978
11123
  });
11124
+ // Isolated (Preview) workers already claim every second, and a draining lane
11125
+ // has no wake hook, so only a direct-notify active lane runs the probe.
11126
+ let standbyProbeStopped = false;
11127
+ const reportStandbyProbeWake = createRateLimitedRuntimeLogger({
11128
+ log: (...args) => console.info(...args),
11129
+ });
11130
+ const reportStandbyProbeError = createRateLimitedRuntimeLogger({
11131
+ log: (...args) => console.error(...args),
11132
+ });
11133
+ const standbyProbe =
11134
+ onWake && useDirectNotify
11135
+ ? runAbsurdStandbyDueWorkProbe({
11136
+ isListening: () => onWake.isListening(),
11137
+ hasIdleSlot: claimLoop.hasIdleSlot,
11138
+ probe: () =>
11139
+ withRuntimeSchedulerClient(poolOptions, (client) =>
11140
+ hasAbsurdQueueDueWork(client, queue),
11141
+ ),
11142
+ wake: () => onWake.wake(),
11143
+ shouldStop: () => standbyProbeStopped,
11144
+ onWake: () =>
11145
+ reportStandbyProbeWake(
11146
+ '[absurd-runtime.worker] standby_probe_wake',
11147
+ { queue, releaseId },
11148
+ ),
11149
+ onError: (error) =>
11150
+ reportStandbyProbeError(
11151
+ '[absurd-runtime.worker] standby_probe_failed',
11152
+ {
11153
+ queue,
11154
+ error: error instanceof Error ? error.message : String(error),
11155
+ },
11156
+ ),
11157
+ })
11158
+ : null;
10979
11159
  // Compute settlement and cleanup each have their own controller and
10980
11160
  // database lease. Neither consumes an ordinary play slot or competes with
10981
11161
  // new starts under org concurrency.
@@ -11167,6 +11347,9 @@ export async function startRuntimeWorkerHost(
11167
11347
  schema: schedulerOptions.schema ?? null,
11168
11348
  slots,
11169
11349
  idlePollIntervalSeconds: ABSURD_IDLE_POLL_INTERVAL_SECONDS,
11350
+ standbyProbeIntervalMs: standbyProbe
11351
+ ? ABSURD_ACTIVE_STANDBY_POLL_INTERVAL_MS
11352
+ : null,
11170
11353
  queue,
11171
11354
  releaseId,
11172
11355
  drainExit,
@@ -11183,6 +11366,7 @@ export async function startRuntimeWorkerHost(
11183
11366
  // its listener without exhausting primary scheduler sessions.
11184
11367
  closeWake: () => onWake?.close(),
11185
11368
  stopControllers: () => {
11369
+ standbyProbeStopped = true;
11186
11370
  drainStopped = true;
11187
11371
  billingStopped = true;
11188
11372
  cleanupStopped = true;
@@ -11190,6 +11374,7 @@ export async function startRuntimeWorkerHost(
11190
11374
  overdueCeilingStopped = true;
11191
11375
  },
11192
11376
  controllers: [
11377
+ standbyProbe,
11193
11378
  overdueCeilingController,
11194
11379
  drainWatch,
11195
11380
  adoptionSupervisor,