deepline 0.3.503 → 0.3.505

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 (151) hide show
  1. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  2. package/dist/bundling-sources/sdk/src/types.ts +5 -0
  3. package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +35 -0
  4. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +1 -1
  5. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-public-aliases.ts +13 -0
  6. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +1 -1
  7. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +144 -7
  8. package/dist/bundling-sources/shared_libs/play-runtime/transient-service-error.ts +18 -0
  9. package/dist/bundling-sources/shared_libs/product-notifications/onboarding-unsubscribe.ts +23 -0
  10. package/dist/cli/{auth-IC4WLSE3.mjs → auth-AHE2EDQA.mjs} +5 -5
  11. package/dist/cli/auth-SEPKNRHV.js +43 -0
  12. package/dist/cli/{billing-2VOV64SD.mjs → billing-7CPWTGGI.mjs} +19 -12
  13. package/dist/cli/{billing-LWQOII22.js → billing-JOIZPHON.js} +92 -85
  14. package/dist/cli/{chunk-33JUK73X.js → chunk-3YEOOXD4.js} +96 -37
  15. package/dist/cli/{chunk-FVDTERO2.js → chunk-45XYW477.js} +21 -21
  16. package/dist/cli/{chunk-5GI6NKOE.mjs → chunk-4OFSAZN6.mjs} +1 -1
  17. package/dist/cli/{chunk-D27HP3HS.mjs → chunk-52FPW2RD.mjs} +2 -2
  18. package/dist/cli/chunk-5LUF4LAR.mjs +209 -0
  19. package/dist/cli/{chunk-VC5B462T.mjs → chunk-5XT4DZQL.mjs} +2 -2
  20. package/dist/cli/{chunk-26RSSTCF.js → chunk-6FEN6VWZ.js} +26 -26
  21. package/dist/cli/{chunk-7HEDCIR3.mjs → chunk-6U3AGJWI.mjs} +1 -1
  22. package/dist/cli/{chunk-KPBBT6OS.mjs → chunk-7AD565DO.mjs} +1 -1
  23. package/dist/cli/{chunk-FZHOWPSN.js → chunk-7DDACLMX.js} +16 -16
  24. package/dist/cli/{chunk-ZEQPCEV4.mjs → chunk-7DDKLFOY.mjs} +3 -3
  25. package/dist/cli/{chunk-WHP3FJ7T.js → chunk-7QLK2GHL.js} +5 -5
  26. package/dist/cli/{chunk-BI2Q45SY.mjs → chunk-ACI6CUDX.mjs} +11 -401
  27. package/dist/cli/{chunk-C5RQTTLP.js → chunk-BWAYMJ23.js} +7 -7
  28. package/dist/cli/{chunk-YXGPMTAK.js → chunk-CA3SYXCS.js} +2 -2
  29. package/dist/cli/{chunk-J6RBOLK7.mjs → chunk-CSLLQWAB.mjs} +1 -1
  30. package/dist/cli/{chunk-F73PD2XD.js → chunk-EMUFF6EU.js} +7 -7
  31. package/dist/cli/chunk-FIQ5UEIF.mjs +405 -0
  32. package/dist/cli/{chunk-2626LTU3.js → chunk-GAUNJCXQ.js} +96 -96
  33. package/dist/cli/{chunk-A2C6ONWA.js → chunk-GXMNOUHP.js} +6 -6
  34. package/dist/cli/{chunk-MJQOG4TZ.js → chunk-HASFFOSU.js} +16 -16
  35. package/dist/cli/{chunk-TCQYWZFS.js → chunk-IDAE5VDH.js} +5 -5
  36. package/dist/cli/{chunk-JJVN7OIX.mjs → chunk-IZYOYXG7.mjs} +4 -4
  37. package/dist/cli/{chunk-FHJ54BHH.mjs → chunk-JA7YBRP4.mjs} +1 -1
  38. package/dist/cli/{chunk-HRTDCXHI.js → chunk-JSTKLYYD.js} +2 -2
  39. package/dist/cli/{chunk-5M5WSFRZ.mjs → chunk-JVKEZT7L.mjs} +48 -8
  40. package/dist/cli/{chunk-4IIYSBEP.js → chunk-K26YOPDO.js} +50 -10
  41. package/dist/cli/{chunk-2K2QBLYO.js → chunk-LC4FG34E.js} +53 -53
  42. package/dist/cli/{chunk-XYZZZLN6.mjs → chunk-MAFZ64RN.mjs} +2 -2
  43. package/dist/cli/{chunk-B3X4YWQ6.js → chunk-MHZAG2ZQ.js} +80 -470
  44. package/dist/cli/{chunk-DPI5OYVU.mjs → chunk-NARJWXBR.mjs} +2 -2
  45. package/dist/cli/{chunk-GLZBFBJS.mjs → chunk-OA6U5NVB.mjs} +5 -5
  46. package/dist/cli/{chunk-URZNSJE2.mjs → chunk-OMEDQ77C.mjs} +93 -34
  47. package/dist/cli/{chunk-QIEYEY6Z.js → chunk-OORPAQVC.js} +8 -8
  48. package/dist/cli/{chunk-WS274KID.mjs → chunk-PDLOPF5L.mjs} +1 -1
  49. package/dist/cli/{chunk-KGLVATEB.mjs → chunk-PZN24YQQ.mjs} +2 -2
  50. package/dist/cli/{chunk-GIHNEYBG.mjs → chunk-QGNNAZ5M.mjs} +1 -1
  51. package/dist/cli/chunk-QYGYVCRI.js +405 -0
  52. package/dist/cli/chunk-R7J7CJPZ.js +209 -0
  53. package/dist/cli/{chunk-6XTE6C3W.mjs → chunk-RT3HJBIH.mjs} +12 -12
  54. package/dist/cli/{chunk-L3TZV625.mjs → chunk-SHKRL7CW.mjs} +1 -1
  55. package/dist/cli/{chunk-FIUTDSJX.js → chunk-SPN7U3MV.js} +4 -4
  56. package/dist/cli/{chunk-EQ3WMKFY.mjs → chunk-UZ24SF7N.mjs} +5 -5
  57. package/dist/cli/{chunk-AARF4SOW.js → chunk-VXKWF3AD.js} +9 -9
  58. package/dist/cli/{chunk-JPDD4Y53.mjs → chunk-W6I4N4JN.mjs} +6 -6
  59. package/dist/cli/{chunk-PVA3MWCO.js → chunk-WPCF7C6B.js} +3 -3
  60. package/dist/cli/{chunk-3CXHK4TW.js → chunk-WTQLUULB.js} +6 -6
  61. package/dist/cli/{chunk-EDMV4JT5.mjs → chunk-WTUC5VKB.mjs} +2 -2
  62. package/dist/cli/{chunk-IIP46RVC.js → chunk-XHPB6RGY.js} +1 -1
  63. package/dist/cli/{chunk-RVOBFO7C.js → chunk-Y52XY56V.js} +41 -41
  64. package/dist/cli/{chunk-K7NFFQFU.mjs → chunk-YBIVVAL7.mjs} +2 -2
  65. package/dist/cli/{chunk-HS63YBT5.js → chunk-ZLN2B5YA.js} +3 -3
  66. package/dist/cli/command-docs.d.mts +2 -1
  67. package/dist/cli/command-docs.d.ts +2 -1
  68. package/dist/cli/command-docs.js +6 -2
  69. package/dist/cli/command-docs.mjs +5 -1
  70. package/dist/cli/{csv-NEWCNOSZ.js → csv-DZHVIW3G.js} +13 -13
  71. package/dist/cli/{csv-2TXOI3UE.mjs → csv-WTPI6ZON.mjs} +4 -4
  72. package/dist/cli/{db-J3IJS4OG.js → db-D7LPPNCC.js} +27 -27
  73. package/dist/cli/{db-PX7EQEIG.mjs → db-NR4PJ6AF.mjs} +6 -6
  74. package/dist/cli/describe-HVQBTKFM.js +50 -0
  75. package/dist/cli/{describe-GQHGTZSL.mjs → describe-NCKAJPUG.mjs} +18 -17
  76. package/dist/cli/describe-core.d.mts +2 -2
  77. package/dist/cli/describe-core.d.ts +2 -2
  78. package/dist/cli/{executions-FFKK24RY.mjs → executions-RQVJ4LAB.mjs} +6 -6
  79. package/dist/cli/{executions-RO3TJUXL.js → executions-UQG6LWEN.js} +8 -8
  80. package/dist/cli/{feedback-ZTO56SRL.mjs → feedback-RD4Y3YQR.mjs} +4 -4
  81. package/dist/cli/{feedback-XRR4HIS6.js → feedback-TCHA67IA.js} +8 -8
  82. package/dist/cli/git-TUB2ZUEH.js +25 -0
  83. package/dist/cli/{git-FIPBVFYZ.mjs → git-Z7434B7Y.mjs} +5 -5
  84. package/dist/cli/index.js +145 -141
  85. package/dist/cli/index.mjs +51 -47
  86. package/dist/cli/{legacy-noops-MTBBGM27.js → legacy-noops-23WRA7DH.js} +8 -8
  87. package/dist/cli/{legacy-noops-AMD2NWHF.mjs → legacy-noops-LQJU4UIV.mjs} +5 -5
  88. package/dist/cli/{monitors-42PIGLBF.js → monitors-KOWN7M3V.js} +95 -95
  89. package/dist/cli/{monitors-24LDKDJX.mjs → monitors-Z6VYUZ2W.mjs} +7 -7
  90. package/dist/cli/{org-GQMCA3MN.js → org-2T5K2VP5.js} +72 -72
  91. package/dist/cli/{org-4B7SCFRL.mjs → org-UBNRO5XO.mjs} +6 -6
  92. package/dist/cli/{pages-PD5EGL2R.mjs → pages-GHPJBVV3.mjs} +6 -6
  93. package/dist/cli/{pages-RL2M62GJ.js → pages-SRXTU7XO.js} +18 -18
  94. package/dist/cli/{play-FST6ZAHW.js → play-2HMZ57EZ.js} +324 -517
  95. package/dist/cli/{play-5V54VTUR.mjs → play-HRQKGTXA.mjs} +24 -217
  96. package/dist/cli/{providers-N5YVCKPL.mjs → providers-JWJRFRR5.mjs} +6 -6
  97. package/dist/cli/{providers-HBUUPN7J.js → providers-P5O676MZ.js} +9 -9
  98. package/dist/cli/{quickstart-NJDDVTQR.mjs → quickstart-S7NZUQRO.mjs} +4 -4
  99. package/dist/cli/{quickstart-4QIQNSHG.js → quickstart-YCY72TAO.js} +6 -6
  100. package/dist/cli/{run-FGOKCG4J.js → run-MHLLGF4G.js} +41 -40
  101. package/dist/cli/{run-JHI5MTHD.mjs → run-QWMRIUIU.mjs} +23 -22
  102. package/dist/cli/{search-EWIZBIY2.mjs → search-4BFTQUEP.mjs} +8 -7
  103. package/dist/cli/search-QPUHOEIL.js +33 -0
  104. package/dist/cli/{search-output-TMQTRC2W.js → search-output-62LBVZHN.js} +6 -6
  105. package/dist/cli/{search-output-NAK3MWBH.mjs → search-output-LIYHDTBP.mjs} +4 -4
  106. package/dist/cli/{secrets-ONQVW5SR.mjs → secrets-GW27V77E.mjs} +6 -6
  107. package/dist/cli/{secrets-5TSUEOJB.js → secrets-KKKHVSOO.js} +15 -15
  108. package/dist/cli/{sessions-BSGE5EET.js → sessions-R3OEINAR.js} +6 -6
  109. package/dist/cli/{sessions-B7F5O3ZR.mjs → sessions-R75LBGIL.mjs} +5 -5
  110. package/dist/cli/{settings-SGGFQV5R.mjs → settings-I3AQZSYG.mjs} +12 -11
  111. package/dist/cli/{settings-47LARBRU.js → settings-MQIHAEZN.js} +79 -78
  112. package/dist/cli/{setup-ATGNXQUK.mjs → setup-2YA5MYMS.mjs} +10 -9
  113. package/dist/cli/{setup-BNFZFXO6.js → setup-X3QRJERP.js} +50 -49
  114. package/dist/cli/{skills-CIMBRM5R.mjs → skills-7252FOOI.mjs} +8 -7
  115. package/dist/cli/skills-BPZWMZSL.js +37 -0
  116. package/dist/cli/tools-F7RVQ3IK.js +57 -0
  117. package/dist/cli/{tools-DTDXAULX.mjs → tools-SKQTSVGE.mjs} +17 -16
  118. package/dist/cli/{update-EOIJBJCO.mjs → update-GNBBSKTB.mjs} +10 -9
  119. package/dist/cli/update-TLSY6LC2.js +35 -0
  120. package/dist/cli/{workflow-IWXUJPWY.mjs → workflow-OJSAL5FO.mjs} +7 -7
  121. package/dist/cli/{workflow-V5VKPICQ.js → workflow-QB7YYWPP.js} +17 -17
  122. package/dist/{client-CIwenMFS.d.ts → client-B3GSaSFn.d.ts} +1 -1
  123. package/dist/{client-DYAfJpaN.d.mts → client-DEJg0CZn.d.mts} +1 -1
  124. package/dist/{client-core-DlzP8vEs.d.mts → client-core-C404E33V.d.mts} +5 -0
  125. package/dist/{client-core-CRjtyMAI.d.ts → client-core-GQmy3N8y.d.ts} +5 -0
  126. package/dist/index.d.mts +3 -3
  127. package/dist/index.d.ts +3 -3
  128. package/dist/index.js +9 -9
  129. package/dist/index.mjs +6 -6
  130. package/dist/install-integrity.json +109 -104
  131. package/dist/plays/bundle-play-file.mjs +4 -4
  132. package/dist/plays/play-description.d.mts +1 -1
  133. package/dist/plays/play-description.d.ts +1 -1
  134. package/dist/plays/run-request.d.mts +1 -1
  135. package/dist/plays/run-request.d.ts +1 -1
  136. package/dist/release.d.mts +1 -1
  137. package/dist/release.d.ts +1 -1
  138. package/dist/release.js +2 -2
  139. package/dist/release.mjs +1 -1
  140. package/dist/server.d.mts +2 -2
  141. package/dist/server.d.ts +2 -2
  142. package/dist/server.js +5 -5
  143. package/dist/server.mjs +3 -3
  144. package/package.json +1 -1
  145. package/dist/cli/auth-ZCMSXZO4.js +0 -43
  146. package/dist/cli/describe-LE7EZCL4.js +0 -49
  147. package/dist/cli/git-26AH4XIO.js +0 -25
  148. package/dist/cli/search-CTKSEVSO.js +0 -32
  149. package/dist/cli/skills-6RD25MVM.js +0 -36
  150. package/dist/cli/tools-TDZH4XHS.js +0 -56
  151. package/dist/cli/update-Y32VT4VL.js +0 -34
@@ -205,7 +205,7 @@ export const SDK_RELEASE = {
205
205
  // getters keep their established compatibility behavior.
206
206
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
207
207
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
208
- version: '0.3.503',
208
+ version: '0.3.505',
209
209
  updateSummary: {
210
210
  introducedIn: '0.3.90',
211
211
  summary:
@@ -638,6 +638,11 @@ export interface ToolSearchResult {
638
638
  search_mode?: 'v1' | 'v2';
639
639
  /** Whether search fell back to category matching. */
640
640
  search_fallback_to_category?: boolean;
641
+ /** Query-writing advice when phrasing is unclear, matches are weak, or the search is empty. */
642
+ search_guidance?: {
643
+ reason: 'poor_query' | 'low_confidence' | 'no_results';
644
+ message: string;
645
+ };
641
646
  /** Requested categories no tool has, left out of the filter. */
642
647
  unknown_categories?: string[];
643
648
  /** Explanation and next commands when filters/search succeed but match zero tools. */
@@ -1,4 +1,5 @@
1
1
  import { NextResponse } from 'next/server';
2
+ import { isExplicitConvexOCC } from '@deepline/convex-client/occ-retry';
2
3
 
3
4
  export const MONITOR_ERROR_FALLBACK_NEXT_ACTION =
4
5
  "Do not retry blindly. Read the deepline-monitors skill's 'Recover from errors by code' section, inspect the returned message and relevant state, then diagnose this failure.";
@@ -110,6 +111,35 @@ export function monitorUpstreamFailureResponse(
110
111
  return null;
111
112
  }
112
113
 
114
+ /**
115
+ * Convex gave up retrying a write conflict, so the mutation that lost did not
116
+ * commit (a provider call earlier in the same request may have happened, so the
117
+ * customer-facing text promises only that a rerun resumes it). This is the same "try again" answer the backfill-in-progress codes
118
+ * give, and it is a 503, not a 409: the monitors CLI maps 503 to exit 5 ("retry
119
+ * the same command as-is") and 409 to exit 7 ("change the request"), and
120
+ * nothing about the request is wrong. Every other error keeps its mapping.
121
+ */
122
+ export const MONITOR_WRITE_CONFLICT_RETRYABLE_CODE =
123
+ 'monitor_write_conflict_retryable';
124
+
125
+ export function monitorWriteConflictResponse(
126
+ error: unknown,
127
+ ): NextResponse | null {
128
+ if (!isExplicitConvexOCC(error)) return null;
129
+ return monitorErrorResponse(
130
+ {
131
+ error: {
132
+ code: MONITOR_WRITE_CONFLICT_RETRYABLE_CODE,
133
+ message:
134
+ "Another change to this workspace's monitors was committing at the same moment, so Deepline could not finish this request.",
135
+ retryable: true,
136
+ retry_after_seconds: 1,
137
+ },
138
+ },
139
+ { status: 503, headers: { 'retry-after': '1' } },
140
+ );
141
+ }
142
+
113
143
  /**
114
144
  * Server-owned recovery guidance for every agent-facing monitor error.
115
145
  * Known codes get an exact next step. Unknown failures deliberately point at
@@ -141,6 +171,11 @@ export function monitorErrorNextAction(payload: MonitorErrorPayload): string {
141
171
  if (code === 'monitor_control_plane_unavailable') {
142
172
  return 'Wait briefly, then rerun the same monitor read. No monitor state was changed.';
143
173
  }
174
+ if (code === MONITOR_WRITE_CONFLICT_RETRYABLE_CODE) {
175
+ return typeof retryAfterSeconds === 'number'
176
+ ? `Wait ${retryAfterSeconds} second${retryAfterSeconds === 1 ? '' : 's'}, then rerun the same command. An operation already in progress is resumed, not repeated.`
177
+ : 'Wait briefly, then rerun the same command. An operation already in progress is resumed, not repeated.';
178
+ }
144
179
  if (code === 'monitor_job_control_plane_unavailable') {
145
180
  return 'Wait briefly, then retry the same request once, reusing its Idempotency-Key if it sent one. Deepline could not confirm whether it was applied.';
146
181
  }
@@ -139,7 +139,7 @@ export function validateProviderMonitorBatchIdempotencyKey(
139
139
  const idempotencyKey = value.trim();
140
140
  if (!IDEMPOTENCY_KEY.test(idempotencyKey)) {
141
141
  throw new Error(
142
- `idempotencyKey must be 1-${PROVIDER_MONITOR_BATCH_IDEMPOTENCY_KEY_MAX_LENGTH} characters of letters, numbers, dot, underscore, or hyphen.`,
142
+ `idempotencyKey must be 1-${PROVIDER_MONITOR_BATCH_IDEMPOTENCY_KEY_MAX_LENGTH} characters of letters, numbers, dot, underscore, or hyphen (received ${idempotencyKey.length} characters).`,
143
143
  );
144
144
  }
145
145
  return idempotencyKey;
@@ -12,6 +12,19 @@ export function canonicalProviderMonitorKey(key: string) {
12
12
  return key === ANALYTICS_MONITOR_KEY ? ANALYTICS_INTERNAL_MONITOR_KEY : key;
13
13
  }
14
14
 
15
+ /**
16
+ * The key a monitor's stored rows (findings, bindings) carry, given the key
17
+ * and tool it is shown under. Only a Deepline Analytics monitor is aliased.
18
+ */
19
+ export function storedProviderMonitorKey(monitor: {
20
+ key: string;
21
+ tool: string;
22
+ }) {
23
+ return canonicalProviderMonitorTool(monitor.tool) === ANALYTICS_INTERNAL_TOOL
24
+ ? canonicalProviderMonitorKey(monitor.key)
25
+ : monitor.key;
26
+ }
27
+
15
28
  export function publicProviderMonitorKey(key: string) {
16
29
  return key === ANALYTICS_INTERNAL_MONITOR_KEY ? ANALYTICS_MONITOR_KEY : key;
17
30
  }
@@ -103,7 +103,7 @@
103
103
  "successDefinition": "Snapshots are complete, marts validate, and the versioned serving pointer advances atomically.",
104
104
  "failureDefinition": "A snapshot, dbt/mart validation, artifact, or pointer publish fails.",
105
105
  "startGraceMs": 600000,
106
- "runTimeoutMs": 3600000,
106
+ "runTimeoutMs": 10800000,
107
107
  "failureAlert": "github_workflow_run",
108
108
  "domainReportRequired": true
109
109
  },
@@ -65,6 +65,20 @@ const DAYTONA_TIMED_OUT_CREATE_RECONCILE_DELAYS_MS = [
65
65
  // It is not a fence: a stalled owner can outlast it, so name uniqueness and the
66
66
  // attempt fences on abandon and promotion keep custody safe.
67
67
  const DAYTONA_ABSENT_OPERATION_RECREATE_AFTER_MS = 3 * 60_000;
68
+ // A named create still `creating` this long after its operation was reserved
69
+ // is stuck on its runner, not slow. On 2026-11-11 Preview, 1,222 healthy
70
+ // creates returned in p99 3.4 s and at most 16 s, and Daytona's runner fails
71
+ // its own container start after 120 s ("sysbox container start timed out
72
+ // after 120s"). One runner whose VM boot hung instead held every sandbox
73
+ // placed on it in `creating` for 11+ minutes before reporting `error`. Past
74
+ // this age the create's own reconcile ladder, or a resumed recovery, hands
75
+ // that exact sandbox to durable cleanup and reports a provider start timeout
76
+ // before customer code, so the placement policy moves the run to Modal where
77
+ // it allows that transition; otherwise recovery retries on Daytona once the
78
+ // cleanup settles. The sandbox has never started: its operation is still
79
+ // `reserved`, and `deleting` can never be promoted to `live`, so no runner
80
+ // command can reach it afterwards.
81
+ export const DAYTONA_STUCK_CREATING_REPLACE_AFTER_MS = 2 * 60_000;
68
82
  // Explicit runner deadline + scheduler GC own the normal lifecycle. Daytona's
69
83
  // inactivity stop is a wider crash backstop measured from sandbox creation, so
70
84
  // setup time cannot consume the terminal-flush grace.
@@ -720,10 +734,55 @@ type TimedOutDaytonaSandboxReconcileObserved = {
720
734
  type TimedOutDaytonaSandboxReconciliation = (
721
735
  | { kind: 'started'; sandbox: DaytonaSandbox }
722
736
  | { kind: 'deleted' }
737
+ /** Past the replacement age in `creating`; durable cleanup now owns it. */
738
+ | {
739
+ kind: 'stuck_creating';
740
+ sandbox: DaytonaSandbox;
741
+ operationAgeMs: number;
742
+ }
723
743
  | { kind: 'not_found' }
724
744
  | { kind: 'transition_pending' }
725
745
  ) & { observed: TimedOutDaytonaSandboxReconcileObserved };
726
746
 
747
+ /**
748
+ * A create stuck in `creating` past DAYTONA_STUCK_CREATING_REPLACE_AFTER_MS was
749
+ * handed to durable cleanup. Report it as a provider start timeout before
750
+ * customer code, the same failure the placement policy already moves to Modal.
751
+ * The log line feeds the Slack notice naming the runner.
752
+ */
753
+ function daytonaStuckCreatingUnavailable(input: {
754
+ daytona: DaytonaClient;
755
+ context: DaytonaExecutionContext;
756
+ phase: 'create_reconcile' | 'resume';
757
+ providerAttempt: number;
758
+ reconciliation: Extract<
759
+ TimedOutDaytonaSandboxReconciliation,
760
+ { kind: 'stuck_creating' }
761
+ >;
762
+ }): DaytonaSandboxAcquisitionUnavailableError {
763
+ const { sandbox, operationAgeMs } = input.reconciliation;
764
+ const placement = input.daytona.placementForLog?.(sandbox) ?? {};
765
+ console.warn('[play-runner.daytona.stuck_creating]', {
766
+ event: 'play_runner.daytona.stuck_creating',
767
+ runId: input.context.runId ?? null,
768
+ workflowId: input.context.workflowId ?? null,
769
+ phase: input.phase,
770
+ providerAttempt: input.providerAttempt,
771
+ sandboxId: sandbox.id,
772
+ operationAgeMs,
773
+ runnerId: placement.runnerId ?? null,
774
+ target: placement.target ?? null,
775
+ runtimeEnvironment:
776
+ process.env.DEEPLINE_RUNTIME_ENVIRONMENT === 'preview'
777
+ ? 'preview'
778
+ : 'production',
779
+ });
780
+ return new DaytonaSandboxAcquisitionUnavailableError(
781
+ 'daytona_sandbox_start_timeout',
782
+ `Daytona sandbox ${sandbox.id} stayed in creating for ${Math.round(operationAgeMs / 1_000)} s and was handed to cleanup before customer code started.`,
783
+ );
784
+ }
785
+
727
786
  async function reconcileAndDeleteTimedOutDaytonaSandbox(input: {
728
787
  daytona: DaytonaClient;
729
788
  sandboxName: string;
@@ -738,6 +797,13 @@ async function reconcileAndDeleteTimedOutDaytonaSandbox(input: {
738
797
  recordCleanupIntent?: (
739
798
  intent: PlayRunnerDaytonaCleanupIntent,
740
799
  ) => Promise<void>;
800
+ /**
801
+ * Age of the reserved operation when this ladder started: the database
802
+ * clock on resume, or time since the create was sent in the creating
803
+ * process. Absent when it is unknown (a lease that expired), and then a
804
+ * `creating` sandbox is never replaced.
805
+ */
806
+ operationAgeAtStartMs?: number;
741
807
  }): Promise<TimedOutDaytonaSandboxReconciliation> {
742
808
  const reconcileStartedAt = Date.now();
743
809
  let last = NO_DAYTONA_NAMED_SANDBOX_LOOKUP;
@@ -753,6 +819,10 @@ async function reconcileAndDeleteTimedOutDaytonaSandbox(input: {
753
819
  deleteTimeouts,
754
820
  elapsedMs: Date.now() - reconcileStartedAt,
755
821
  });
822
+ const operationAgeMs = (): number | null =>
823
+ input.operationAgeAtStartMs === undefined
824
+ ? null
825
+ : input.operationAgeAtStartMs + (Date.now() - reconcileStartedAt);
756
826
  if (!input.daytona.get) return { kind: 'not_found', observed: observed() };
757
827
  let lastDeleteConflict: unknown = null;
758
828
  let sawDeleteTimeout = false;
@@ -813,14 +883,44 @@ async function reconcileAndDeleteTimedOutDaytonaSandbox(input: {
813
883
  }
814
884
  // Keep an in-progress create under its original reservation. A late start
815
885
  // belongs to the same operation, unless a prior DELETE timed out and made
816
- // that sandbox's future state ambiguous.
817
- if (sandbox.state === 'creating' && !sawDeleteTimeout) continue;
886
+ // that sandbox's future state ambiguous, or the create has outlived any
887
+ // healthy runner (DAYTONA_STUCK_CREATING_REPLACE_AFTER_MS). Only the
888
+ // durable cleanup owner may take a stuck create: deleting a creating
889
+ // sandbox in process turned failed deletes into terminal Play failures
890
+ // (docs/incidents/2026-11-03-daytona-create.md).
891
+ const ageMs = operationAgeMs();
892
+ const stuckCreatingAgeMs =
893
+ sandbox.state === 'creating' &&
894
+ input.recordCleanupIntent !== undefined &&
895
+ Boolean(input.operationIdentity?.runId) &&
896
+ Boolean(sandbox.organizationId?.trim()) &&
897
+ ageMs !== null &&
898
+ ageMs >= DAYTONA_STUCK_CREATING_REPLACE_AFTER_MS
899
+ ? ageMs
900
+ : null;
901
+ const creatingPastReplacementAge = stuckCreatingAgeMs !== null;
902
+ if (
903
+ sandbox.state === 'creating' &&
904
+ !sawDeleteTimeout &&
905
+ !creatingPastReplacementAge
906
+ ) {
907
+ continue;
908
+ }
818
909
  if (sandbox.state === 'started' && !sawDeleteTimeout) {
819
910
  return { kind: 'started', sandbox, observed: observed() };
820
911
  }
821
- // Persist the exact identity before handing stable or ambiguously-deleted
822
- // resources to the cleanup worker. Never turn a still-creating sandbox
823
- // into a delete intent: its create may complete and be safely resumed.
912
+ if (creatingPastReplacementAge) {
913
+ input.emitStage?.('create:stuck_creating_cleanup', {
914
+ sandboxId: sandbox.id,
915
+ operationAgeMs: ageMs,
916
+ });
917
+ }
918
+ // Persist the exact identity before handing stable, stuck-creating, or
919
+ // ambiguously-deleted resources to the cleanup worker. A sandbox that is
920
+ // still creating stays with its create until it is past the replacement
921
+ // age: before then it may complete and be safely resumed. The intent moves
922
+ // the operation from `reserved` to `deleting`, which no writer promotes to
923
+ // `live`, so a late start of this sandbox can never receive a command.
824
924
  if (input.operationIdentity && input.recordCleanupIntent) {
825
925
  if (!input.operationIdentity.runId || !sandbox.organizationId?.trim()) {
826
926
  throw new Error(
@@ -835,6 +935,14 @@ async function reconcileAndDeleteTimedOutDaytonaSandbox(input: {
835
935
  sandboxId: sandbox.id,
836
936
  routingDomain: sandbox.organizationId,
837
937
  });
938
+ if (stuckCreatingAgeMs !== null) {
939
+ return {
940
+ kind: 'stuck_creating',
941
+ sandbox,
942
+ operationAgeMs: stuckCreatingAgeMs,
943
+ observed: observed(),
944
+ };
945
+ }
838
946
  return { kind: 'transition_pending', observed: observed() };
839
947
  }
840
948
  // After a DELETE timed out, never run the sandbox until this same named
@@ -950,9 +1058,15 @@ async function createRetriedOneShotDaytonaSandbox(input: {
950
1058
  if (!reservation.providerOperationToken) {
951
1059
  throw new DaytonaSandboxTransitionPendingError(sandboxName);
952
1060
  }
953
- // Recovery must converge when the timed-out create has stopped or failed,
954
- // using the same provider-confirmed cleanup path as its initial observer.
1061
+ // Recovery must converge when the timed-out create has stopped, failed,
1062
+ // or stayed `creating` past any healthy runner, using the same
1063
+ // provider-confirmed cleanup path as its initial observer.
955
1064
  const reconciliation = await reconcileAndDeleteTimedOutDaytonaSandbox({
1065
+ ...(reservation.existingProviderOperationAgeMs === undefined
1066
+ ? {}
1067
+ : {
1068
+ operationAgeAtStartMs: reservation.existingProviderOperationAgeMs,
1069
+ }),
956
1070
  daytona: input.daytona,
957
1071
  sandboxName,
958
1072
  cancellationSignal: input.cancellationSignal,
@@ -987,6 +1101,17 @@ async function createRetriedOneShotDaytonaSandbox(input: {
987
1101
  'The resumed timed-out Daytona sandbox was reconciled and deleted before fallback.',
988
1102
  );
989
1103
  }
1104
+ // Cleanup owns the stuck sandbox and its capacity lease until Daytona
1105
+ // confirms it gone; the operation is `deleting` and never runs the Play.
1106
+ if (reconciliation.kind === 'stuck_creating') {
1107
+ throw daytonaStuckCreatingUnavailable({
1108
+ daytona: input.daytona,
1109
+ context: input.context,
1110
+ phase: 'resume',
1111
+ providerAttempt: attempt,
1112
+ reconciliation,
1113
+ });
1114
+ }
990
1115
  // Neither absence nor an ongoing transition proves that create cannot
991
1116
  // commit, so inside the create window retain the durable identity and
992
1117
  // its capacity reservation. The detail only records which of the two
@@ -1088,6 +1213,9 @@ async function createRetriedOneShotDaytonaSandbox(input: {
1088
1213
  let reconciliation: TimedOutDaytonaSandboxReconciliation;
1089
1214
  try {
1090
1215
  reconciliation = await reconcileAndDeleteTimedOutDaytonaSandbox({
1216
+ // The create was sent at attemptStartedAt, just after its
1217
+ // reservation committed.
1218
+ operationAgeAtStartMs: Date.now() - attemptStartedAt,
1091
1219
  daytona: input.daytona,
1092
1220
  sandboxName,
1093
1221
  cancellationSignal: input.cancellationSignal,
@@ -1141,6 +1269,15 @@ async function createRetriedOneShotDaytonaSandbox(input: {
1141
1269
  };
1142
1270
  }
1143
1271
  await recordCreateFailure();
1272
+ if (reconciliation.kind === 'stuck_creating') {
1273
+ throw daytonaStuckCreatingUnavailable({
1274
+ daytona: input.daytona,
1275
+ context: input.context,
1276
+ phase: 'create_reconcile',
1277
+ providerAttempt: attempt,
1278
+ reconciliation,
1279
+ });
1280
+ }
1144
1281
  // Same decision as before; the detail records what the ladder saw.
1145
1282
  const reconcileObserved = reconciliation.observed;
1146
1283
  const reconcilePending = (): DaytonaSandboxTransitionPendingError =>
@@ -39,6 +39,24 @@ export class ConvexEdgeUnavailableError extends Error {
39
39
  }
40
40
  }
41
41
 
42
+ /**
43
+ * True only for the branded edge refusal itself, never for message text.
44
+ *
45
+ * `transientServiceUnavailableDetail` also matches Convex's own admission
46
+ * responses by message, so an application exception that happens to say
47
+ * "ServiceUnavailable" would pass it. A caller that uses the answer to keep a
48
+ * failure out of a verdict needs the structured signal alone.
49
+ */
50
+ export function isConvexEdgeUnavailableError(
51
+ error: unknown,
52
+ ): error is ConvexEdgeUnavailableError {
53
+ // The name check covers an error raised by another copy of this module.
54
+ return (
55
+ error instanceof ConvexEdgeUnavailableError ||
56
+ (error instanceof Error && error.name === 'ConvexEdgeUnavailableError')
57
+ );
58
+ }
59
+
42
60
  export function transientServiceUnavailableDetail(
43
61
  error: unknown,
44
62
  ): string | null {
@@ -0,0 +1,23 @@
1
+ import { createHash } from 'node:crypto';
2
+
3
+ // This campaign belongs to Deepline's own workspace, never the requester's.
4
+ export const ONBOARDING_WORKSPACE = 'jh7eep8wqe12fx2e0hd5en44m182v3jg';
5
+
6
+ export function onboardingTokenHash(token: string): string | null {
7
+ if (!/^[a-f0-9]{64}$/.test(token)) return null;
8
+ return createHash('sha256').update(token).digest('hex');
9
+ }
10
+
11
+ export function onboardingOptOutSql(hash: string): string {
12
+ if (!/^[a-f0-9]{64}$/.test(hash)) throw new Error('INVALID_TOKEN_HASH');
13
+ return `WITH recipient AS MATERIALIZED (
14
+ SELECT email FROM storage.signup_nurture_unsubscribe_tokens WHERE token_hash='${hash}'
15
+ ), stopped AS (
16
+ INSERT INTO storage.signup_nurture_optouts(email,source)
17
+ SELECT email,'recipient_link' FROM recipient
18
+ ON CONFLICT(email) DO UPDATE SET source=storage.signup_nurture_optouts.source RETURNING email
19
+ ), sync AS (
20
+ INSERT INTO storage.signup_nurture_preference_outbox(email)
21
+ SELECT email FROM stopped ON CONFLICT(email) DO NOTHING
22
+ ) SELECT count(*)::integer AS matched FROM stopped`;
23
+ }
@@ -14,14 +14,14 @@ import {
14
14
  reportSetupCompleted,
15
15
  resolvePendingAuthClaimForResume,
16
16
  statusBannerLine
17
- } from "./chunk-ZEQPCEV4.mjs";
18
- import "./chunk-KGLVATEB.mjs";
19
- import "./chunk-L3TZV625.mjs";
20
- import "./chunk-KPBBT6OS.mjs";
17
+ } from "./chunk-7DDKLFOY.mjs";
18
+ import "./chunk-PZN24YQQ.mjs";
19
+ import "./chunk-SHKRL7CW.mjs";
20
+ import "./chunk-7AD565DO.mjs";
21
21
  import "./chunk-4QF2K7TM.mjs";
22
22
  import "./chunk-DLIRSHV6.mjs";
23
23
  import "./chunk-HBL4PM5Q.mjs";
24
- import "./chunk-7HEDCIR3.mjs";
24
+ import "./chunk-6U3AGJWI.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 _chunkLC4FG34Ejs = require('./chunk-LC4FG34E.js');
18
+ require('./chunk-EMUFF6EU.js');
19
+ require('./chunk-ZLN2B5YA.js');
20
+ require('./chunk-SPN7U3MV.js');
21
+ require('./chunk-ALJJRZNJ.js');
22
+ require('./chunk-XNYIZMNQ.js');
23
+ require('./chunk-DIAWYWT5.js');
24
+ require('./chunk-XHPB6RGY.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 = _chunkLC4FG34Ejs.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunkLC4FG34Ejs.authStatusLine; exports.clearPendingClaim = _chunkLC4FG34Ejs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkLC4FG34Ejs.clearSatisfiedPendingClaim; exports.handleRegister = _chunkLC4FG34Ejs.handleRegister; exports.handleStatus = _chunkLC4FG34Ejs.handleStatus; exports.handleWait = _chunkLC4FG34Ejs.handleWait; exports.httpJson = _chunkLC4FG34Ejs.httpJson; exports.readPendingAuthClaim = _chunkLC4FG34Ejs.readPendingAuthClaim; exports.readStatusBanner = _chunkLC4FG34Ejs.readStatusBanner; exports.registerAuthCommands = _chunkLC4FG34Ejs.registerAuthCommands; exports.reportApprovalLinkShown = _chunkLC4FG34Ejs.reportApprovalLinkShown; exports.reportSetupCompleted = _chunkLC4FG34Ejs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkLC4FG34Ejs.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunkLC4FG34Ejs.statusBannerLine;
@@ -1,26 +1,30 @@
1
- import {
2
- PLAY_SANDBOX_SIZE_INPUTS
3
- } from "./chunk-7I4B6V2S.mjs";
4
1
  import {
5
2
  DeeplineClient
6
- } from "./chunk-D27HP3HS.mjs";
3
+ } from "./chunk-52FPW2RD.mjs";
7
4
  import {
8
5
  iterateCursorPages,
9
6
  requireBillingIdempotencyKey
10
- } from "./chunk-5GI6NKOE.mjs";
7
+ } from "./chunk-4OFSAZN6.mjs";
11
8
  import "./chunk-L2VKAASU.mjs";
12
9
  import "./chunk-N4TR6QRI.mjs";
13
10
  import "./chunk-S3A4IXBQ.mjs";
14
11
  import "./chunk-BMCRTI6Z.mjs";
12
+ import {
13
+ PLAY_RUNTIME_PRICING_NOTE
14
+ } from "./chunk-JVKEZT7L.mjs";
15
+ import "./chunk-5LUF4LAR.mjs";
16
+ import {
17
+ PLAY_SANDBOX_SIZE_INPUTS
18
+ } from "./chunk-7I4B6V2S.mjs";
15
19
  import {
16
20
  createTimestampedName,
17
21
  getAuthedHttpClient,
18
22
  openInBrowser,
19
23
  printCommandEnvelope,
20
24
  shouldEmitJson
21
- } from "./chunk-KGLVATEB.mjs";
22
- import "./chunk-L3TZV625.mjs";
23
- import "./chunk-KPBBT6OS.mjs";
25
+ } from "./chunk-PZN24YQQ.mjs";
26
+ import "./chunk-SHKRL7CW.mjs";
27
+ import "./chunk-7AD565DO.mjs";
24
28
  import {
25
29
  AuthError,
26
30
  ConfigError
@@ -29,7 +33,7 @@ import "./chunk-DLIRSHV6.mjs";
29
33
  import {
30
34
  DeeplineError
31
35
  } from "./chunk-HBL4PM5Q.mjs";
32
- import "./chunk-7HEDCIR3.mjs";
36
+ import "./chunk-6U3AGJWI.mjs";
33
37
  import "./chunk-WZYKRD7T.mjs";
34
38
  import "./chunk-KRD6H754.mjs";
35
39
 
@@ -1258,11 +1262,13 @@ async function handleIncludedCompute(options) {
1258
1262
  title: "billing compute",
1259
1263
  lines: payload.status === "on" ? [
1260
1264
  `Included compute: on, ${formatComputeMinutes(payload.included_minutes)} standard-equivalent per month, then ${Math.round((payload.credits_per_minute ?? 0) * 60)} credits/standard hour`,
1261
- `Used: ${formatComputeMinutes(payload.included_minutes_used)} standard-equivalent included, ${formatComputeMinutes(payload.minutes_used)} elapsed since ${payload.period_start_at.slice(0, 10)}`
1265
+ `Used: ${formatComputeMinutes(payload.included_minutes_used)} standard-equivalent included, ${formatComputeMinutes(payload.minutes_used)} elapsed since ${payload.period_start_at.slice(0, 10)}`,
1266
+ PLAY_RUNTIME_PRICING_NOTE
1262
1267
  ] : payload.status === "off" ? [
1263
1268
  "Included compute: off; Play compute is billed at provider cost.",
1264
1269
  `Used: ${formatComputeMinutes(payload.minutes_used)} since ${payload.period_start_at.slice(0, 10)}`,
1265
- `Turning it on gives ${plan}. Run deepline billing compute --enable; it cannot be turned off again.`
1270
+ `Turning it on gives ${plan}. Run deepline billing compute --enable; it cannot be turned off again.`,
1271
+ PLAY_RUNTIME_PRICING_NOTE
1266
1272
  ] : [
1267
1273
  "Included compute is not available for this workspace yet."
1268
1274
  ]
@@ -1584,6 +1590,7 @@ Examples:
1584
1590
  deepline billing balance
1585
1591
  deepline billing usage --limit 20
1586
1592
  deepline billing plans
1593
+ deepline billing compute
1587
1594
  deepline billing subscription status
1588
1595
 
1589
1596
  # Price a tool before execution; look up its exact charge afterward
@@ -1833,7 +1840,7 @@ Examples:
1833
1840
  "Show workspace benefits, remaining people search profiles, and effective rate limits."
1834
1841
  ).option("--json", "Emit JSON output").action(handleEntitlements);
1835
1842
  billing.command("compute").description(
1836
- "Show Play compute pricing and minutes used; --enable turns on included compute."
1843
+ "Show Play runtime pricing, included compute, and minutes used."
1837
1844
  ).option(
1838
1845
  "--enable",
1839
1846
  "Turn on included compute for this workspace (cannot be undone)"