deepline 0.3.406 → 0.3.407

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 (109) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +54 -57
  2. package/dist/bundling-sources/sdk/src/play.ts +8 -5
  3. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  4. package/dist/bundling-sources/sdk/src/types.ts +4 -3
  5. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/gateway-adapter.ts +4 -0
  6. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +1 -0
  7. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +87 -28
  8. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +6 -1
  9. package/dist/cli/auth-4JTX6AGM.js +40 -0
  10. package/dist/cli/{auth-U7LIMXIS.mjs → auth-WURWNNLE.mjs} +4 -4
  11. package/dist/cli/{billing-5ABVIJFU.js → billing-2QJGXGJX.js} +73 -73
  12. package/dist/cli/{billing-KGGS3444.mjs → billing-BP3E6WIM.mjs} +4 -4
  13. package/dist/cli/{chunk-T7YF4MQH.mjs → chunk-4TV43THC.mjs} +3 -3
  14. package/dist/cli/{chunk-OPHLT4TM.mjs → chunk-6JZZNP5G.mjs} +2 -2
  15. package/dist/cli/{chunk-W3ZNQE5Y.js → chunk-7LKYHZVB.js} +1 -1
  16. package/dist/cli/{chunk-5IGBBYXH.mjs → chunk-BKC6VMYZ.mjs} +1 -1
  17. package/dist/cli/{chunk-NYDRX6JJ.js → chunk-D2ZRMZKF.js} +6 -6
  18. package/dist/cli/{chunk-N43PX2CA.js → chunk-G4LJS2RE.js} +8 -8
  19. package/dist/cli/{chunk-IE6IKRQA.js → chunk-G6U74WNM.js} +15 -15
  20. package/dist/cli/{chunk-W2BAO4OR.js → chunk-H6EWQFPQ.js} +2 -2
  21. package/dist/cli/{chunk-N6DJQQ2S.js → chunk-IY6GKJ4O.js} +50 -50
  22. package/dist/cli/{chunk-7ZMVAV2B.mjs → chunk-J67NU4MQ.mjs} +55 -58
  23. package/dist/cli/{chunk-APLRSERF.js → chunk-KUQAU5MG.js} +60 -63
  24. package/dist/cli/{chunk-RXDJKAM2.mjs → chunk-L25GBGQU.mjs} +5 -5
  25. package/dist/cli/{chunk-YLV6PT6B.mjs → chunk-N6OAMAO5.mjs} +1 -1
  26. package/dist/cli/{chunk-2OFPPAUY.mjs → chunk-P7HOTKOK.mjs} +4 -4
  27. package/dist/cli/{chunk-V3OTRWVK.mjs → chunk-QJAX7QN7.mjs} +2 -2
  28. package/dist/cli/{chunk-4REBZQNK.js → chunk-RMZAOYDN.js} +44 -44
  29. package/dist/cli/{chunk-FQBKK5DG.js → chunk-RZLXVHNO.js} +26 -26
  30. package/dist/cli/{chunk-EKS2FXL5.js → chunk-SOQIPKF2.js} +8 -8
  31. package/dist/cli/{chunk-YSAZVLJD.js → chunk-THHM4DPE.js} +4 -4
  32. package/dist/cli/{chunk-2MLY2ZBT.mjs → chunk-UFFSOV6I.mjs} +2 -2
  33. package/dist/cli/{chunk-42RUJLQI.mjs → chunk-UPEOEYZ3.mjs} +1 -1
  34. package/dist/cli/{chunk-77UGRG6X.mjs → chunk-XT6GG3QO.mjs} +3 -3
  35. package/dist/cli/{chunk-KPU53YBB.js → chunk-Y6CX4QPR.js} +65 -65
  36. package/dist/cli/{chunk-CGX4NSS3.mjs → chunk-ZBCTXQ3P.mjs} +1 -1
  37. package/dist/cli/{csv-U36TIOKU.js → csv-7E5BE23B.js} +12 -12
  38. package/dist/cli/{csv-HXJAAW3H.mjs → csv-N6KYTG7L.mjs} +3 -3
  39. package/dist/cli/{db-T5MLQQWJ.js → db-4VLZP33O.js} +25 -25
  40. package/dist/cli/{db-GRWD3JAC.mjs → db-XMBJNVBD.mjs} +4 -4
  41. package/dist/cli/{describe-NFX6THJE.js → describe-4I6EIVXD.js} +10 -10
  42. package/dist/cli/{describe-HXFEIZFO.mjs → describe-WERH4TD2.mjs} +6 -6
  43. package/dist/cli/describe-core.d.mts +2 -2
  44. package/dist/cli/describe-core.d.ts +2 -2
  45. package/dist/cli/{executions-YGOS5E44.mjs → executions-JWQXE7G6.mjs} +4 -4
  46. package/dist/cli/{executions-KBHTDL3A.js → executions-W7TWJRBK.js} +6 -6
  47. package/dist/cli/{feedback-VP3GWJIH.js → feedback-FMGRC6KO.js} +7 -7
  48. package/dist/cli/{feedback-NEQGCSHB.mjs → feedback-OEJFX4F7.mjs} +3 -3
  49. package/dist/cli/{git-JJ3CHOTL.mjs → git-IVC4KHXX.mjs} +4 -4
  50. package/dist/cli/git-OFXE7G4X.js +24 -0
  51. package/dist/cli/index.js +89 -89
  52. package/dist/cli/index.mjs +32 -32
  53. package/dist/cli/{legacy-noops-A6KGBODU.mjs → legacy-noops-LT36CLWZ.mjs} +4 -4
  54. package/dist/cli/{legacy-noops-ITTD33ZN.js → legacy-noops-X3BQ7MUK.js} +7 -7
  55. package/dist/cli/{monitors-DXVP5YFC.js → monitors-DLIIAVLW.js} +84 -84
  56. package/dist/cli/{monitors-NGEXCUEY.mjs → monitors-MNLCELF7.mjs} +4 -4
  57. package/dist/cli/{org-C4ZTOSQC.js → org-CYHDEW7P.js} +64 -64
  58. package/dist/cli/{org-34DBJSFP.mjs → org-QV5LMUPT.mjs} +4 -4
  59. package/dist/cli/{play-SVLQKZBG.mjs → play-5Z4ROZ3P.mjs} +7 -7
  60. package/dist/cli/{play-5FWTZCHN.js → play-MEFXC2QA.js} +231 -231
  61. package/dist/cli/{providers-QWR2HRNY.js → providers-2MKUNFBQ.js} +7 -7
  62. package/dist/cli/{providers-RQTSGYE4.mjs → providers-FJLYSHB3.mjs} +4 -4
  63. package/dist/cli/{quickstart-W5UHZAEU.mjs → quickstart-PQO3OQRT.mjs} +3 -3
  64. package/dist/cli/{quickstart-DHFNEMGY.js → quickstart-ULWXKAOT.js} +5 -5
  65. package/dist/cli/search-ANKSJ224.js +30 -0
  66. package/dist/cli/{search-U4AJC3FH.mjs → search-KGAAXMDG.mjs} +5 -5
  67. package/dist/cli/{secrets-YSMQ7CVZ.mjs → secrets-PD5I3KAF.mjs} +4 -4
  68. package/dist/cli/{secrets-HH4H7BLE.js → secrets-X2VGG2PO.js} +13 -13
  69. package/dist/cli/{sessions-URONRCTV.mjs → sessions-3WVEU4PE.mjs} +4 -4
  70. package/dist/cli/{sessions-AJZXYUCJ.js → sessions-R3XAKTBQ.js} +5 -5
  71. package/dist/cli/{settings-KGAMW4MN.mjs → settings-645RSFQX.mjs} +7 -7
  72. package/dist/cli/{settings-QAW62BH4.js → settings-ZIDO3IP6.js} +74 -74
  73. package/dist/cli/{setup-KAMFU5VE.js → setup-LH5HOZ3D.js} +41 -41
  74. package/dist/cli/{setup-P54DPBFO.mjs → setup-LISKIJKP.mjs} +6 -6
  75. package/dist/cli/{skills-UMWRJ6TL.mjs → skills-VVQJHLSF.mjs} +4 -4
  76. package/dist/cli/skills-WLHYSVQA.js +29 -0
  77. package/dist/cli/{tools-HX3BHT55.js → tools-FTPJCNAM.js} +7 -7
  78. package/dist/cli/{tools-HN4EFVY7.mjs → tools-Y3LOMXFT.mjs} +6 -6
  79. package/dist/cli/update-A622H2DZ.js +29 -0
  80. package/dist/cli/{update-7AFQCJ75.mjs → update-DOBNQNJI.mjs} +6 -6
  81. package/dist/cli/{workflow-7EHU5ZPX.js → workflow-LGENKZBV.js} +15 -15
  82. package/dist/cli/{workflow-ARDO4VHU.mjs → workflow-ZMAA5VCN.mjs} +5 -5
  83. package/dist/{client-Buv1_ktG.d.mts → client-6rEB46Lv.d.mts} +55 -57
  84. package/dist/{client-Db1jFLpF.d.ts → client-IrPHUE5J.d.ts} +55 -57
  85. package/dist/{compiler-manifest-N77W75Py.d.ts → compiler-manifest-BHnXE43X.d.mts} +6 -1
  86. package/dist/{compiler-manifest-N77W75Py.d.mts → compiler-manifest-BHnXE43X.d.ts} +6 -1
  87. package/dist/{index-3WOfyVhW.d.mts → index-Da_Y8z5e.d.mts} +1 -1
  88. package/dist/{index-CtIJFTCl.d.ts → index-SODb2ROS.d.ts} +1 -1
  89. package/dist/index.d.mts +13 -10
  90. package/dist/index.d.ts +13 -10
  91. package/dist/index.js +8 -8
  92. package/dist/index.mjs +5 -5
  93. package/dist/install-integrity.json +76 -76
  94. package/dist/plays/bundle-play-file.d.mts +3 -3
  95. package/dist/plays/bundle-play-file.d.ts +3 -3
  96. package/dist/plays/play-description.d.mts +2 -2
  97. package/dist/plays/play-description.d.ts +2 -2
  98. package/dist/plays/run-request.d.mts +2 -2
  99. package/dist/plays/run-request.d.ts +2 -2
  100. package/dist/release.d.mts +1 -1
  101. package/dist/release.d.ts +1 -1
  102. package/dist/release.js +2 -2
  103. package/dist/release.mjs +1 -1
  104. package/package.json +1 -1
  105. package/dist/cli/auth-K5QAZH42.js +0 -40
  106. package/dist/cli/git-63RYCZSI.js +0 -24
  107. package/dist/cli/search-YAYYU3WD.js +0 -30
  108. package/dist/cli/skills-M2GGHYJU.js +0 -29
  109. package/dist/cli/update-I23NN5QI.js +0 -29
@@ -3232,8 +3232,8 @@ export class DeeplineClient {
3232
3232
  /**
3233
3233
  * Search available tools using Deepline's ranked backend search.
3234
3234
  *
3235
- * This is the same discovery surface used by the CLI: it ranks across
3236
- * tool metadata, categories, agent guidance, and input schema fields.
3235
+ * The CLI uses the same search.
3236
+ * The search ranks tool metadata, categories, agent guidance, and input schema fields.
3237
3237
  */
3238
3238
  async searchTools(
3239
3239
  options: ToolSearchOptions = {},
@@ -3308,13 +3308,12 @@ export class DeeplineClient {
3308
3308
  /**
3309
3309
  * Describe a Deepline Agent model and its provider-specific option surface.
3310
3310
  *
3311
- * Combines live AI Gateway model metadata with Deepline's generated AI SDK
3312
- * provider option registry so agents can construct `providerOptions`
3313
- * payloads before executing `deeplineagent`.
3311
+ * The method combines live AI Gateway model metadata with Deepline's generated registry of AI SDK provider options.
3312
+ * Agents can use this information to construct `providerOptions` payloads before they execute `deeplineagent`.
3314
3313
  *
3315
- * The returned option schemas describe accepted provider option shapes, not
3316
- * guaranteed support for every model. Runtime AI SDK/Gateway errors remain
3317
- * authoritative for model-gated values.
3314
+ * The returned schemas describe accepted shapes for provider options.
3315
+ * These schemas do not guarantee that every model supports each option.
3316
+ * Runtime AI SDK and Gateway errors determine support for model-specific values.
3318
3317
  *
3319
3318
  * @param model - Exact-case Gateway model id such as `"openai/gpt-5.6-luna"`
3320
3319
  * @returns Model metadata, provider option shapes, and runnable examples
@@ -3331,8 +3330,8 @@ export class DeeplineClient {
3331
3330
  /**
3332
3331
  * Quote dynamic AI inference pricing for a concrete payload.
3333
3332
  *
3334
- * The result separates a planning estimate from a proven authorization
3335
- * maximum and contains Deepline credits only.
3333
+ * The result contains a planning estimate and a separate, proven authorization maximum.
3334
+ * Both values use Deepline credits.
3336
3335
  */
3337
3336
  async quoteInferenceTool(
3338
3337
  toolId: 'ai_evaluate' | 'ai_inference' | 'deeplineagent',
@@ -3437,13 +3436,16 @@ export class DeeplineClient {
3437
3436
  * entrypoints: the CLI, {@link Deepline.connect}, {@link submitPlay},
3438
3437
  * or {@link runPlay}.
3439
3438
  *
3440
- * Supported invocation surfaces intentionally share this same run contract:
3441
- * `deepline plays run`, repo scripts such as `bun run deepline -- plays run`,
3442
- * SDK context calls like `Deepline.connect().play(name).run()`, and direct
3443
- * `POST /api/v2/plays/run` calls all return a workflow/run id. The completed
3444
- * output is always retrievable from `getPlayStatus(runId).result` (or from
3445
- * `PlayJob.get()` for SDK context calls). Execution logs live under
3446
- * `progress.logs`; they are not part of the user output object.
3439
+ * These interfaces share the run contract and return a workflow or run ID:
3440
+ *
3441
+ * - `deepline plays run`.
3442
+ * - Repository scripts such as `bun run deepline -- plays run`.
3443
+ * - SDK context calls such as `Deepline.connect().play(name).run()`.
3444
+ * - Direct `POST /api/v2/plays/run` calls.
3445
+ *
3446
+ * Read completed output from `getPlayStatus(runId).result`.
3447
+ * For SDK context calls, read output from `PlayJob.get()`.
3448
+ * Execution logs appear under `progress.logs`. The user output object does not contain these logs.
3447
3449
  *
3448
3450
  * @param request - Play run configuration (name, code, input, etc.)
3449
3451
  * @returns Run metadata including the public `workflowId`
@@ -3718,9 +3720,8 @@ export class DeeplineClient {
3718
3720
  /**
3719
3721
  * Compile a bundled play artifact into the server-side compiler manifest.
3720
3722
  *
3721
- * The manifest records imports, trigger bindings, static pipeline shape, and
3722
- * runtime metadata needed before a play artifact can be checked, registered,
3723
- * or run.
3723
+ * The manifest records imports, trigger bindings, static pipeline shape, and runtime metadata.
3724
+ * The compiler needs these records before it checks, registers, or runs a Play artifact.
3724
3725
  */
3725
3726
  async compilePlayManifest(input: {
3726
3727
  name: string;
@@ -3802,8 +3803,8 @@ export class DeeplineClient {
3802
3803
  /**
3803
3804
  * Register an already-bundled play artifact and start a run from it.
3804
3805
  *
3805
- * This is the low-level file-backed run path used by SDK/CLI packaging
3806
- * wrappers after local bundling has produced the runtime artifact.
3806
+ * SDK and CLI packaging wrappers use this low-level run method for file-based Plays.
3807
+ * Local bundling must produce the runtime artifact first.
3807
3808
  */
3808
3809
  async startPlayRunFromBundle(input: {
3809
3810
  name: string;
@@ -3859,15 +3860,15 @@ export class DeeplineClient {
3859
3860
  /**
3860
3861
  * Register a bundled play artifact and start a run from the live revision.
3861
3862
  *
3862
- * Convenience wrapper around {@link registerPlayArtifact} plus
3863
- * {@link startPlayRun}. This is the canonical file-backed path used by wrappers.
3864
- * The returned id can be passed to {@link getPlayStatus} to retrieve the same
3865
- * durable `{ result }` object that the CLI prints after `plays run` completes.
3863
+ * This method wraps {@link registerPlayArtifact} and {@link startPlayRun}.
3864
+ * Packaging wrappers use this method for file-based Plays.
3865
+ * Pass the returned ID to {@link getPlayStatus}.
3866
+ * The method returns the same durable `{ result }` object that the CLI prints after `plays run` completes.
3866
3867
  *
3867
- * @param code - Source string fallback; the bundled artifact should be passed in `options.artifact`
3868
- * @param csvPath - Path to input CSV file, or `null`
3869
- * @param name - Play name (extracted from source if omitted)
3870
- * @param options - Additional submission options
3868
+ * @param code - Fallback source string. Pass the bundled artifact in `options.artifact`.
3869
+ * @param csvPath - Path to the input CSV file, or `null`.
3870
+ * @param name - Play name. The SDK derives it from the source when omitted.
3871
+ * @param options - Additional submission options.
3871
3872
  * @returns Workflow metadata with `workflowId`
3872
3873
  *
3873
3874
  * @example
@@ -3998,9 +3999,8 @@ export class DeeplineClient {
3998
3999
  /**
3999
4000
  * Mint short-lived presigned upload targets for staged play files.
4000
4001
  *
4001
- * Internal primitive used by {@link stagePlayFiles}. The server returns an
4002
- * already-staged ref (no upload needed) for content-addressed files it
4003
- * already holds, or a presigned PUT URL the caller uploads the body to.
4002
+ * Internal primitive used by {@link stagePlayFiles}. For a content-addressed file already in storage, the server returns a staged reference. That file needs no upload.
4003
+ * For other files, the server returns a presigned PUT URL. Upload the file body to that URL.
4004
4004
  */
4005
4005
  async mintStagedPlayFileUploads(
4006
4006
  files: Array<{
@@ -4016,8 +4016,7 @@ export class DeeplineClient {
4016
4016
  /**
4017
4017
  * Resolve staged play files by content hash without uploading bytes.
4018
4018
  *
4019
- * Missing files are returned so callers can upload only the files the server
4020
- * does not already have.
4019
+ * The response identifies missing files. Callers need to upload only these files.
4021
4020
  */
4022
4021
  async resolveStagedPlayFiles(
4023
4022
  files: Array<{
@@ -4658,11 +4657,11 @@ export class DeeplineClient {
4658
4657
  /**
4659
4658
  * Start a fresh run from a prior run's retained input and pinned revision.
4660
4659
  *
4661
- * Every invocation sends an `Idempotency-Key`. When the caller does not
4662
- * supply one, a fresh key is generated once per call so the transport's own
4663
- * network retries converge on a single rerun. Pass the same explicit key
4664
- * across separate invocations to repeat an ambiguous result safely; a
4665
- * different key intentionally starts another rerun.
4660
+ * Every invocation sends an `Idempotency-Key`.
4661
+ * When the caller supplies no key, the SDK creates a fresh key once per call.
4662
+ * The transport reuses that key for network retries, so those retries produce one rerun.
4663
+ * Reuse an explicit key across separate invocations when the previous result is uncertain.
4664
+ * A different key starts another rerun.
4666
4665
  */
4667
4666
  async rerun(
4668
4667
  runId: string,
@@ -5113,8 +5112,8 @@ export class DeeplineClient {
5113
5112
  options?: StopAllRunsOptions,
5114
5113
  ): Promise<StopAllPlayRunsResult>;
5115
5114
  /**
5116
- * Stop every active run visible to the current workspace, or with
5117
- * `dryRun: true` enumerate the exact candidates without cancelling anything.
5115
+ * Stop every active run visible to the current workspace.
5116
+ * With `dryRun: true`, list the exact candidates without cancelling any run.
5118
5117
  *
5119
5118
  * This is the SDK equivalent of:
5120
5119
  *
@@ -5123,8 +5122,8 @@ export class DeeplineClient {
5123
5122
  * deepline runs stop-all --reason "stale lock"
5124
5123
  * ```
5125
5124
  *
5126
- * Use this when a failed parent run left child or waiting runs active and you
5127
- * need to clear the workspace run-slot state without knowing each run id.
5125
+ * Use this method when a failed parent leaves active child or waiting runs.
5126
+ * The method clears workspace run-slot state without requiring each run ID.
5128
5127
  */
5129
5128
  async stopAllRuns(
5130
5129
  options?: StopAllRunsOptions,
@@ -5150,8 +5149,8 @@ export class DeeplineClient {
5150
5149
  }
5151
5150
 
5152
5151
  /**
5153
- * List one page of callable plays; grep retains exhaustive matching results.
5154
- * Use listPlaysPage to retain pagination metadata.
5152
+ * List one page of callable Plays. With grep, the method retains all matching results.
5153
+ * Use listPlaysPage for pagination metadata.
5155
5154
  *
5156
5155
  * Pass `origin: "prebuilt"` for Deepline-managed prebuilts or
5157
5156
  * `origin: "owned"` for org-owned plays.
@@ -5736,8 +5735,7 @@ export class DeeplineClient {
5736
5735
  /**
5737
5736
  * Get the full definition and state of a named play.
5738
5737
  *
5739
- * Returns the play's revision state (draft, live), recent runs,
5740
- * sheet processing summary, and database URL.
5738
+ * The response includes revision state (draft or live), recent runs, a summary of sheet processing, and the database URL.
5741
5739
  *
5742
5740
  * @param name - Play name
5743
5741
  * @returns Complete play detail
@@ -5813,10 +5811,10 @@ export class DeeplineClient {
5813
5811
  /**
5814
5812
  * Get a normalized play description suitable for agents and CLIs.
5815
5813
  *
5816
- * The description includes runnable examples, input/output summaries, clone
5817
- * guidance, revision state, and latest run metadata when available. Pass
5818
- * `{ pipeline: true }` to include the compiled pipeline, which can be
5819
- * hundreds of kilobytes and is otherwise left out.
5814
+ * The description includes runnable examples, input and output summaries, clone guidance, and revision state.
5815
+ * It also includes metadata for the latest run when available.
5816
+ * Set `{ pipeline: true }` to include the compiled pipeline.
5817
+ * The pipeline can be hundreds of kilobytes. The response omits it by default.
5820
5818
  */
5821
5819
  async describePlay(
5822
5820
  name: string,
@@ -5884,8 +5882,7 @@ export class DeeplineClient {
5884
5882
  * Make a play revision live.
5885
5883
  *
5886
5884
  * When `revisionId` is omitted, the current working revision becomes live.
5887
- * The live version is what executes when the play is run by name without
5888
- * specifying an explicit revision.
5885
+ * A call by Play name executes the live revision unless the caller specifies another revision.
5889
5886
  *
5890
5887
  * @param name - Play name
5891
5888
  * @param request - Optional explicit revision to make live
@@ -6211,9 +6208,9 @@ export class DeeplineClient {
6211
6208
  }
6212
6209
 
6213
6210
  /**
6214
- * What Deepline has billed each run so far (customer-visible credits, never
6215
- * provider spend) and whether any of its charges is still settling — the
6216
- * same read the dashboard's runs grid shows. `GET /api/v2/runs/billing`.
6211
+ * Read Deepline credits billed to each run and whether charges are still settling.
6212
+ * The response never shows provider spend. The dashboard runs grid uses the same read.
6213
+ * HTTP endpoint: `GET /api/v2/runs/billing`.
6217
6214
  */
6218
6215
  async getRunBilling(runIds: readonly string[]): Promise<RunBillingResult> {
6219
6216
  const params = new URLSearchParams();
@@ -192,8 +192,8 @@ export type PlayFetchResponse = PlayAuthoringFetchResponse;
192
192
  * A play can be triggered three ways, declared as the third argument to
193
193
  * {@link definePlay}:
194
194
  * - `webhook` — an inbound HTTP call (with optional legacy HMAC or Standard
195
- * Webhooks signature verification);
196
- * - `cron` — a schedule; or
195
+ * Webhooks signature verification).
196
+ * - `cron` — a schedule.
197
197
  * - `sqlListeners` — a **monitor**: the play runs whenever a monitor writes a new
198
198
  * row to its output stream. This is how you build a play "on top of" a monitor
199
199
  * (e.g. run enrichment every time a watched company posts a new job). Each
@@ -1232,8 +1232,8 @@ export class DeeplineContext {
1232
1232
  * Run a named or prebuilt play and wait for its output.
1233
1233
  *
1234
1234
  * This is the high-level SDK equivalent of `ctx.play(name).runSync(input)`.
1235
- * Inside a play runtime, prefer the in-play `ctx.runPlay(key, playRef, input,
1236
- * options)` form so the child run is checkpointed under a stable key.
1235
+ * Inside a Play, prefer `ctx.runPlay(key, playRef, input, options)`.
1236
+ * The runtime checkpoints the child run under a stable key.
1237
1237
  *
1238
1238
  * @param playOrRef - Play name or prebuilt/reference object.
1239
1239
  * @param input - JSON input passed to the play.
@@ -1630,7 +1630,10 @@ export function defineInput<TInput>(
1630
1630
  /**
1631
1631
  * Define a play — a composable TypeScript workflow for the Deepline platform.
1632
1632
  *
1633
- * The returned value is both a callable function, invoked by the Deepline runtime with a runtime context, and a named play handle carrying `.run()`, `.versions()`, `.get()` and `.publish()` for remote lifecycle management. Plays are the primary abstraction for repeatable data pipelines and execute durably, with automatic retries and timeouts.
1633
+ * The returned value is both a callable function and a named Play handle.
1634
+ * The Deepline runtime calls the function with a runtime context.
1635
+ * The handle provides `.run()`, `.versions()`, `.get()`, and `.publish()` for remote lifecycle operations.
1636
+ * Plays define repeatable data pipelines. The runtime executes them durably with automatic retries and timeouts.
1634
1637
  *
1635
1638
  * @typeParam TInput - The input type accepted by the play
1636
1639
  * @typeParam TOutput - The return type of the play
@@ -202,7 +202,7 @@ export const SDK_RELEASE = {
202
202
  // getters keep their established compatibility behavior.
203
203
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
204
204
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
205
- version: '0.3.406',
205
+ version: '0.3.407',
206
206
  updateSummary:
207
207
  'Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.',
208
208
  packageCapabilities: {
@@ -1181,9 +1181,10 @@ export interface StopPlayRunResult {
1181
1181
  /** True if HITL state or its same-message Slack card still needs retrying. */
1182
1182
  hitlCancellationPending?: boolean;
1183
1183
  /**
1184
- * True only when the scheduler and the canonical run ledger disagree (for
1185
- * example a terminal scheduler run whose ledger projection is pending), so
1186
- * the stop could not be confirmed. Never set for a queued cancellation.
1184
+ * True only when the scheduler and the canonical run ledger disagree and
1185
+ * the server could not confirm the stop.
1186
+ * For example, the scheduler can report a terminal run while the ledger
1187
+ * projection is pending. This field is never true for a queued cancellation.
1187
1188
  */
1188
1189
  staleSchedulerState?: boolean;
1189
1190
  /** Server-side error detail when the stop failed (`state: 'failed'`). */
@@ -5,6 +5,7 @@ import {
5
5
  dispatchRunLedgerOutboxToLedgerThroughEventWithClientScope,
6
6
  type PostgresSchedulerOptions,
7
7
  type PostgresSchedulerOutboxDrainResult,
8
+ type RunLedgerDispatchLaunch,
8
9
  type RunLedgerOutboxWithClient,
9
10
  } from '../../scheduler-backends/postgres';
10
11
 
@@ -17,6 +18,8 @@ export type GatewayRunLedgerProjectionAdapterInput = {
17
18
  * against the active outbox lease while retaining supported transport hooks.
18
19
  */
19
20
  runtimeApi: WorkerRuntimeApiContext;
21
+ /** Immutable launch already read by the worker that committed the terminal. */
22
+ launch?: RunLedgerDispatchLaunch;
20
23
  withClient: RunLedgerOutboxWithClient;
21
24
  schedulerOptions?: Pick<PostgresSchedulerOptions, 'schema'>;
22
25
  };
@@ -35,6 +38,7 @@ export function createGatewayRunLedgerProjectionAdapter(
35
38
  runId: input.runId,
36
39
  runtimeApi: input.runtimeApi,
37
40
  tokenAuthority: 'gateway' as const,
41
+ ...(input.launch ? { dispatchLaunch: input.launch } : {}),
38
42
  ...(input.runtimeApi.signal ? { signal: input.runtimeApi.signal } : {}),
39
43
  };
40
44
  return {
@@ -872,6 +872,7 @@ function buildDefaultDeps(absurd: Absurd): AbsurdRuntimeWorkerDeps {
872
872
  await createRunLedgerProjectionJob({
873
873
  outbox: createGatewayRunLedgerProjectionAdapter({
874
874
  runId,
875
+ launch,
875
876
  runtimeApi: {
876
877
  ...absurdRuntimeApiFromLaunch(launch),
877
878
  ...(signal ? { signal } : {}),
@@ -19053,6 +19053,8 @@ async function claimRunLedgerOutboxPrefixInBatch(
19053
19053
  expectedHeadEventId?: string;
19054
19054
  lockStrength?: 'no_key_update';
19055
19055
  transportCandidate?: RunLedgerTransportCandidate;
19056
+ /** Discover the zero-effect transport head under this transaction's run lock. */
19057
+ discoverTransportHead?: boolean;
19056
19058
  recoverTransportDelivery?: boolean;
19057
19059
  },
19058
19060
  options?: Pick<PostgresSchedulerOptions, 'schema'>,
@@ -19093,8 +19095,22 @@ async function claimRunLedgerOutboxPrefixInBatch(
19093
19095
  // run/head locks a never-leased, never-frozen carrier may be acknowledged
19094
19096
  // locally before the next READ COMMITTED statement claims its successor.
19095
19097
  // Keep the successor's existing run.events-first receipt shape unchanged.
19098
+ const recoverTransportDelivery = input.recoverTransportDelivery === true;
19099
+ // An ACK and successor claim commit in the same transaction. For a discovered
19100
+ // carrier whose response was lost, xmin plus the still-live successor owner
19101
+ // proves exactly which delivery consumed this drain's allowance.
19102
+ const ownedTransportSql = (alias: string) => `
19103
+ to_jsonb(${alias})->>'delivery_batch_started_at' IS NULL AND EXISTS (
19104
+ SELECT 1 FROM ${tableName('outbox', options)} AS successor
19105
+ WHERE successor.run_id = ${alias}.run_id AND successor.delivered_at IS NULL
19106
+ AND successor.lease_owner = ${escapeLiteral(leaseOwner!)}
19107
+ AND successor.lease_expires_at > clock_timestamp()
19108
+ AND successor.xmin = ${alias}.xmin
19109
+ AND NOT ${searchLaneSql('successor')}
19110
+ )`;
19096
19111
  const transportHeadSql =
19097
- input.transportCandidate !== undefined &&
19112
+ (input.transportCandidate !== undefined ||
19113
+ input.discoverTransportHead === true) &&
19098
19114
  input.allowIngressPrefix === true &&
19099
19115
  !input.searchOnly &&
19100
19116
  !input.extendOwnedHead &&
@@ -19112,8 +19128,12 @@ async function claimRunLedgerOutboxPrefixInBatch(
19112
19128
  ), eligible_transport_head AS MATERIALIZED (
19113
19129
  SELECT head.* FROM transport_head AS head
19114
19130
  WHERE current_setting('deepline.run_ledger_outbox_lock', true) = ${escapeLiteral(input.runId)}
19115
- AND head.event_id = ${escapeLiteral(input.transportCandidate!.eventId)}
19116
- AND head.delivery_key = ${escapeLiteral(input.transportCandidate!.deliveryKey)}
19131
+ ${
19132
+ input.transportCandidate
19133
+ ? `AND head.event_id = ${escapeLiteral(input.transportCandidate.eventId)}
19134
+ AND head.delivery_key = ${escapeLiteral(input.transportCandidate.deliveryKey)}`
19135
+ : ''
19136
+ }
19117
19137
  AND ${runLedgerZeroEffectTransportSql('head')}
19118
19138
  AND ${runLedgerTerminalPendingSql('head', options)}
19119
19139
  AND EXISTS (
@@ -19142,24 +19162,22 @@ async function claimRunLedgerOutboxPrefixInBatch(
19142
19162
  escapeLiteral(input.runId),
19143
19163
  )}
19144
19164
  )${
19145
- input.recoverTransportDelivery === true
19165
+ recoverTransportDelivery
19146
19166
  ? `, prior_transport AS MATERIALIZED (
19147
19167
  SELECT prior.event_id, prior.run_id, prior.event_type, prior.delivery_key,
19148
19168
  (extract(epoch FROM (prior.delivered_at-prior.created_at))*1000)::float8 AS lag_ms,
19149
- to_jsonb(prior)->>'delivery_batch_started_at' IS NULL AND EXISTS (
19150
- SELECT 1 FROM ${tableName('outbox', options)} AS successor
19151
- WHERE successor.run_id = prior.run_id AND successor.delivered_at IS NULL
19152
- AND successor.lease_owner = ${escapeLiteral(leaseOwner!)}
19153
- AND successor.lease_expires_at > clock_timestamp()
19154
- AND successor.xmin = prior.xmin
19155
- AND NOT ${searchLaneSql('successor')}
19156
- ) AS owned
19169
+ ${ownedTransportSql('prior')} AS owned
19157
19170
  FROM ${tableName('outbox', options)} AS prior
19158
19171
  WHERE current_setting('deepline.run_ledger_outbox_lock', true) = ${escapeLiteral(input.runId)}
19159
19172
  AND prior.run_id = ${escapeLiteral(input.runId)}
19160
- AND prior.event_id = ${escapeLiteral(input.transportCandidate!.eventId)}
19161
- AND prior.delivery_key = ${escapeLiteral(input.transportCandidate!.deliveryKey)}
19162
- AND prior.event_type = ${escapeLiteral(input.transportCandidate!.eventType)}
19173
+ ${
19174
+ input.transportCandidate
19175
+ ? `AND prior.event_id = ${escapeLiteral(input.transportCandidate.eventId)}
19176
+ AND prior.delivery_key = ${escapeLiteral(input.transportCandidate.deliveryKey)}
19177
+ AND prior.event_type = ${escapeLiteral(input.transportCandidate.eventType)}`
19178
+ : `AND ${runLedgerZeroEffectTransportSql('prior')}
19179
+ AND ${ownedTransportSql('prior')}`
19180
+ }
19163
19181
  AND prior.delivered_at IS NOT NULL
19164
19182
  AND NOT EXISTS (SELECT 1 FROM delivered)
19165
19183
  )`
@@ -19168,7 +19186,7 @@ async function claimRunLedgerOutboxPrefixInBatch(
19168
19186
  SELECT delivered.event_id, head.run_id, delivered.event_type, head.delivery_key, delivered.lag_ms
19169
19187
  FROM delivered JOIN eligible_transport_head AS head ON head.event_id = delivered.event_id
19170
19188
  ${
19171
- input.recoverTransportDelivery === true
19189
+ recoverTransportDelivery
19172
19190
  ? `UNION ALL
19173
19191
  SELECT event_id,run_id,event_type,delivery_key,lag_ms FROM prior_transport WHERE owned`
19174
19192
  : ''
@@ -19185,13 +19203,28 @@ async function claimRunLedgerOutboxPrefixInBatch(
19185
19203
  json_build_object('eventId', delivered.event_id, 'kind', 'outbox_delivered')::text)::text
19186
19204
  FROM transport_deliveries AS delivered
19187
19205
  ${
19188
- input.recoverTransportDelivery === true
19206
+ recoverTransportDelivery
19189
19207
  ? `UNION ALL
19190
19208
  SELECT 'transport_unconfirmed'::text,event_id,run_id,event_type,NULL::jsonb,NULL::timestamptz,
19191
19209
  NULL::text,delivery_key,lag_ms,false,NULL::float8,NULL::text,NULL::text
19192
19210
  FROM prior_transport WHERE NOT owned`
19193
19211
  : ''
19194
- }`
19212
+ }` +
19213
+ (recoverTransportDelivery && !input.transportCandidate
19214
+ ? `
19215
+ UNION ALL
19216
+ SELECT 'transport_unconfirmed'::text,pending.event_id,pending.run_id,pending.event_type,NULL::jsonb,NULL::timestamptz,
19217
+ NULL::text,pending.delivery_key,0::float8,false,NULL::float8,NULL::text,NULL::text
19218
+ FROM ${tableName('outbox', options)} AS pending
19219
+ WHERE current_setting('deepline.run_ledger_outbox_lock', true) = ${escapeLiteral(input.runId)}
19220
+ AND pending.run_id = ${escapeLiteral(input.runId)} AND pending.delivered_at IS NULL
19221
+ AND pending.lease_owner = ${escapeLiteral(leaseOwner!)}
19222
+ AND NOT ${searchLaneSql('pending')}
19223
+ AND NOT EXISTS (SELECT 1 FROM transport_deliveries)
19224
+ -- A renewal may have replaced the transaction proof. Hand back the
19225
+ -- prefix instead of guessing whether a carrier spent its allowance.
19226
+ `
19227
+ : '')
19195
19228
  : undefined;
19196
19229
  let result: QueryResult<RunLedgerOutboxPrefixClaimRow>;
19197
19230
  try {
@@ -20587,6 +20620,12 @@ export type RunLedgerOutboxDispatchInput = {
20587
20620
  * explicit context as before.
20588
20621
  */
20589
20622
  runtimeApi?: WorkerRuntimeApiContext | null;
20623
+ /**
20624
+ * Immutable launch already held by a terminal producer. Reuse requires the
20625
+ * same run and the existing qualified projection token; claims and receiver
20626
+ * ownership proofs still read durable state. Other dispatches read SQL.
20627
+ */
20628
+ dispatchLaunch?: RunLedgerDispatchLaunch;
20590
20629
  limit?: number;
20591
20630
  runId?: string | null;
20592
20631
  leaseOwner?: string | null;
@@ -21160,19 +21199,38 @@ async function dispatchRunLedgerOutboxBatchWithScope(
21160
21199
  )
21161
21200
  return null;
21162
21201
  const targetRunId = input.runId?.trim() || null;
21202
+ const producerLaunch =
21203
+ terminalRunId === targetRunId &&
21204
+ !input.headEventId &&
21205
+ tokenAuthority === 'gateway' &&
21206
+ input.dispatchLaunch?.runId === targetRunId &&
21207
+ usableRunLedgerExecutorToken(input.dispatchLaunch, reuseMarginMs, options)
21208
+ ?.runLedgerIngressPrefixBatching === true
21209
+ ? input.dispatchLaunch
21210
+ : null;
21163
21211
  const selected =
21164
21212
  selectedFastRun ??
21165
- (input.waitForRunLock && targetRunId
21166
- ? await client.query<{
21167
- run_id: string;
21168
- dispatch_launch_json: unknown;
21169
- transport_head?: RunLedgerTransportCandidate | null;
21170
- }>(
21171
- `SELECT runs.run_id, ${needsLaunch ? runLedgerDispatchLaunchSql('runs') : 'NULL::jsonb'} AS dispatch_launch_json, ${transportHeadSelection} AS transport_head
21213
+ (producerLaunch
21214
+ ? {
21215
+ rows: [
21216
+ {
21217
+ run_id: producerLaunch.runId,
21218
+ dispatch_launch_json: producerLaunch,
21219
+ transport_head: undefined,
21220
+ },
21221
+ ],
21222
+ }
21223
+ : input.waitForRunLock && targetRunId
21224
+ ? await client.query<{
21225
+ run_id: string;
21226
+ dispatch_launch_json: unknown;
21227
+ transport_head?: RunLedgerTransportCandidate | null;
21228
+ }>(
21229
+ `SELECT runs.run_id, ${needsLaunch ? runLedgerDispatchLaunchSql('runs') : 'NULL::jsonb'} AS dispatch_launch_json, ${transportHeadSelection} AS transport_head
21172
21230
  FROM ${tableName('runs', options)} AS runs WHERE runs.run_id = $1`,
21173
- [targetRunId],
21174
- )
21175
- : await selectRunForClaim(client, targetRunId));
21231
+ [targetRunId],
21232
+ )
21233
+ : await selectRunForClaim(client, targetRunId));
21176
21234
  const runId = selected.rows[0]?.run_id;
21177
21235
  if (!runId)
21178
21236
  return {
@@ -21201,6 +21259,7 @@ async function dispatchRunLedgerOutboxBatchWithScope(
21201
21259
  !input.headEventId && ingressPrefixClaimed
21202
21260
  ? (selected.rows[0]?.transport_head ?? undefined)
21203
21261
  : undefined,
21262
+ discoverTransportHead: producerLaunch !== null && ingressPrefixClaimed,
21204
21263
  recoverTransportDelivery: claimInvocations > 1,
21205
21264
  },
21206
21265
  options,
@@ -1403,7 +1403,12 @@ export type PlayAuthoringFetchResponse = {
1403
1403
  /** Full response body as text, with any known secret values redacted. */
1404
1404
  bodyText: string;
1405
1405
  /**
1406
- * The parsed body, eagerly decoded at request time. Read it as a property — `const body = res.json`, never `await res.json()`. Null when the body is empty AND when it is not valid JSON: a malformed payload is reported as null rather than thrown, so check `res.ok` and fall back to `res.bodyText` before treating null as an empty result.
1406
+ * The runtime parses the body at request time.
1407
+ * Read the property with `const body = res.json`. Do not call `await res.json()`.
1408
+ * The value is null when the body is empty or is not valid JSON.
1409
+ * Malformed JSON produces null instead of an error.
1410
+ *
1411
+ * Check `res.ok`. Check `res.bodyText` before you interpret null as an empty response.
1407
1412
  */
1408
1413
  json: unknown | null;
1409
1414
  };
@@ -0,0 +1,40 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+ var _chunkIY6GKJ4Ojs = require('./chunk-IY6GKJ4O.js');
17
+ require('./chunk-D2ZRMZKF.js');
18
+ require('./chunk-THHM4DPE.js');
19
+ require('./chunk-Q2E4E4FJ.js');
20
+ require('./chunk-XNYIZMNQ.js');
21
+ require('./chunk-7P5AA3SN.js');
22
+ require('./chunk-7LKYHZVB.js');
23
+ require('./chunk-OG64RBAC.js');
24
+ require('./chunk-COGTRVWW.js');
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+ exports.EXIT_WORKSPACE_MISMATCH = _chunkIY6GKJ4Ojs.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunkIY6GKJ4Ojs.authStatusLine; exports.clearPendingClaim = _chunkIY6GKJ4Ojs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkIY6GKJ4Ojs.clearSatisfiedPendingClaim; exports.handleRegister = _chunkIY6GKJ4Ojs.handleRegister; exports.handleStatus = _chunkIY6GKJ4Ojs.handleStatus; exports.handleWait = _chunkIY6GKJ4Ojs.handleWait; exports.httpJson = _chunkIY6GKJ4Ojs.httpJson; exports.readPendingAuthClaim = _chunkIY6GKJ4Ojs.readPendingAuthClaim; exports.readStatusBanner = _chunkIY6GKJ4Ojs.readStatusBanner; exports.registerAuthCommands = _chunkIY6GKJ4Ojs.registerAuthCommands; exports.reportSetupCompleted = _chunkIY6GKJ4Ojs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkIY6GKJ4Ojs.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunkIY6GKJ4Ojs.statusBannerLine;
@@ -13,13 +13,13 @@ import {
13
13
  reportSetupCompleted,
14
14
  resolvePendingAuthClaimForResume,
15
15
  statusBannerLine
16
- } from "./chunk-2MLY2ZBT.mjs";
17
- import "./chunk-5IGBBYXH.mjs";
18
- import "./chunk-CGX4NSS3.mjs";
16
+ } from "./chunk-UFFSOV6I.mjs";
17
+ import "./chunk-BKC6VMYZ.mjs";
18
+ import "./chunk-ZBCTXQ3P.mjs";
19
19
  import "./chunk-YHPYUZZX.mjs";
20
20
  import "./chunk-DLIRSHV6.mjs";
21
21
  import "./chunk-NXGCO4JB.mjs";
22
- import "./chunk-42RUJLQI.mjs";
22
+ import "./chunk-UPEOEYZ3.mjs";
23
23
  import "./chunk-WZYKRD7T.mjs";
24
24
  import "./chunk-KRD6H754.mjs";
25
25
  export {