deepline 0.3.574 → 0.3.576

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 (162) hide show
  1. package/dist/bundling-sources/sdk/src/release.ts +13 -1
  2. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +0 -18
  3. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +8 -0
  4. package/dist/bundling-sources/shared_libs/play-runtime/builtin-pacing.ts +18 -0
  5. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +149 -1
  6. package/dist/bundling-sources/shared_libs/play-runtime/deployment/commands/roll-receipt-gateway.ts +1 -1
  7. package/dist/bundling-sources/shared_libs/play-runtime/deployment/vercel-fly-rollback-alignment.ts +0 -14
  8. package/dist/bundling-sources/shared_libs/play-runtime/durable-runs-rollout.ts +17 -0
  9. package/dist/bundling-sources/shared_libs/play-runtime/experiment-switches.ts +8 -0
  10. package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +4 -0
  11. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +190 -9
  12. package/dist/bundling-sources/shared_libs/play-runtime/runtime-speed-profile.ts +41 -5
  13. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +6 -66
  14. package/dist/cli/{agents-6WN5LYUP.mjs → agents-BLJR2Y3X.mjs} +213 -19
  15. package/dist/cli/{agents-7ZZSF4FS.js → agents-CJQ7KBFT.js} +235 -41
  16. package/dist/cli/auth-GSDYP4ZN.js +44 -0
  17. package/dist/cli/{auth-I2QVO677.mjs → auth-SLZIRCPE.mjs} +5 -5
  18. package/dist/cli/{billing-YPH4GEWU.mjs → billing-6Q4SK5KF.mjs} +9 -9
  19. package/dist/cli/{billing-44QFBUWA.js → billing-IECMVARO.js} +102 -102
  20. package/dist/cli/{chunk-MGF3MK27.mjs → chunk-2UHEJPSS.mjs} +5 -5
  21. package/dist/cli/{chunk-2QYU57RG.js → chunk-36254433.js} +3 -3
  22. package/dist/cli/{chunk-ECLCRE5P.js → chunk-45POZK3F.js} +3 -3
  23. package/dist/cli/{chunk-5E2PAGF5.js → chunk-4KIIXV5Z.js} +21 -21
  24. package/dist/cli/{chunk-7334X74C.mjs → chunk-5VABOJ4M.mjs} +2 -2
  25. package/dist/cli/{chunk-YR4REP4D.mjs → chunk-66K7F7LR.mjs} +1 -1
  26. package/dist/cli/{chunk-6GZIT3TH.js → chunk-6JQZC6HX.js} +20 -20
  27. package/dist/cli/{chunk-ID3LGPOE.js → chunk-6RY5COUY.js} +23 -23
  28. package/dist/cli/{chunk-VGIDPJXM.mjs → chunk-7DI34I73.mjs} +3 -3
  29. package/dist/cli/{chunk-Z3XFXFRT.js → chunk-ANPHEXTT.js} +9 -9
  30. package/dist/cli/{chunk-NRVEVKXR.mjs → chunk-AUR24RQB.mjs} +2 -2
  31. package/dist/cli/{chunk-JCO226JM.mjs → chunk-AZFSCPYK.mjs} +89 -10
  32. package/dist/cli/{chunk-2RPRSTHD.js → chunk-BRPUB6UA.js} +5 -5
  33. package/dist/cli/{chunk-XVBEEGI4.mjs → chunk-CUIFDMNP.mjs} +11 -1
  34. package/dist/cli/{chunk-OIZUFRTE.mjs → chunk-D5LWYP2H.mjs} +3 -3
  35. package/dist/cli/{chunk-PP5RMEQQ.js → chunk-DGY4EYIX.js} +5 -5
  36. package/dist/cli/{chunk-Q3A53SWK.mjs → chunk-DWUESXDD.mjs} +1 -1
  37. package/dist/cli/{chunk-7UR57HPJ.js → chunk-E4M4QZBP.js} +11 -1
  38. package/dist/cli/{chunk-DOZIWA66.js → chunk-EQO77FQZ.js} +5 -5
  39. package/dist/cli/{chunk-N6I3BB2O.js → chunk-F4H26PP6.js} +274 -274
  40. package/dist/cli/{chunk-L2NXB4WG.mjs → chunk-FYKHAT2F.mjs} +64 -3
  41. package/dist/cli/{chunk-QPSBV4FD.mjs → chunk-GI57Q7JU.mjs} +2 -2
  42. package/dist/cli/{chunk-H7PVSG3L.js → chunk-GZ7KYGYE.js} +15 -15
  43. package/dist/cli/{chunk-PW6NKI2A.mjs → chunk-HE53AI2E.mjs} +3 -3
  44. package/dist/cli/{chunk-LJLM4BUL.js → chunk-HHMO3CON.js} +6 -6
  45. package/dist/cli/{chunk-2TMAKJBT.mjs → chunk-JPFAD6G6.mjs} +2 -2
  46. package/dist/cli/{chunk-VLUBEMWM.js → chunk-JSIOLCTK.js} +20 -20
  47. package/dist/cli/{chunk-B2XLIQPH.mjs → chunk-KQTZO6NT.mjs} +2 -2
  48. package/dist/cli/{chunk-SLXCVPN7.js → chunk-L6H72AIX.js} +2 -2
  49. package/dist/cli/{chunk-X7RKCAMX.mjs → chunk-LKC7PHDX.mjs} +4 -4
  50. package/dist/cli/{chunk-DG56RWI2.js → chunk-M23G33MH.js} +2 -2
  51. package/dist/cli/{chunk-IB225ZK4.js → chunk-MDJ4LPQ5.js} +4 -4
  52. package/dist/cli/{chunk-AFPGYZBH.js → chunk-MXK4M7HP.js} +17 -17
  53. package/dist/cli/{chunk-KSHZY52O.js → chunk-MXPCTF57.js} +89 -10
  54. package/dist/cli/{chunk-6B5EZOI3.js → chunk-NQFZ7FYN.js} +10 -10
  55. package/dist/cli/{chunk-OH6WOID2.mjs → chunk-OMVBBAQP.mjs} +2 -2
  56. package/dist/cli/{chunk-D6ZVRKJ2.js → chunk-OXRG325T.js} +41 -41
  57. package/dist/cli/{chunk-G7OR3GVD.mjs → chunk-PU5VCDCJ.mjs} +5 -5
  58. package/dist/cli/{chunk-VYSUJMB5.js → chunk-PYFMNPTA.js} +8 -8
  59. package/dist/cli/{chunk-LCAXLGAY.mjs → chunk-QCD7BQ5Z.mjs} +2 -2
  60. package/dist/cli/{chunk-4T2U72SP.mjs → chunk-R5NKLZL2.mjs} +1 -1
  61. package/dist/cli/{chunk-ZTCP5BHH.mjs → chunk-RW3URFZK.mjs} +2 -2
  62. package/dist/cli/{chunk-IA2LTIWO.mjs → chunk-S4IW4NAI.mjs} +2 -2
  63. package/dist/cli/{chunk-UXIUAIL2.js → chunk-SBZSJQEI.js} +53 -53
  64. package/dist/cli/{chunk-XMBTAPHR.js → chunk-SKHUWQZE.js} +7 -7
  65. package/dist/cli/{chunk-S22FSNNC.mjs → chunk-SY3OKOI5.mjs} +1 -1
  66. package/dist/cli/{chunk-MAMGREBW.mjs → chunk-TZHS2W5Z.mjs} +1 -1
  67. package/dist/cli/{chunk-BUBOZKH2.js → chunk-UD6M2ZTY.js} +2 -2
  68. package/dist/cli/{chunk-W6UCS3O6.mjs → chunk-UGIH4462.mjs} +5 -5
  69. package/dist/cli/{chunk-7GQU46SZ.js → chunk-V25CXBR2.js} +26 -26
  70. package/dist/cli/{chunk-G2HW2SAP.js → chunk-WDWV77SJ.js} +13 -13
  71. package/dist/cli/{chunk-I62ZBEKH.js → chunk-WPGZ6V36.js} +48 -48
  72. package/dist/cli/{chunk-GMQZFWQU.mjs → chunk-X5V6S5KI.mjs} +7 -7
  73. package/dist/cli/{chunk-ZFXDD7VM.mjs → chunk-XJNJ3BWU.mjs} +1 -1
  74. package/dist/cli/{chunk-NDDGFX4X.js → chunk-Y4A6Y5EY.js} +11 -11
  75. package/dist/cli/{chunk-LLSCFLFU.mjs → chunk-YHM64N5C.mjs} +1 -1
  76. package/dist/cli/{chunk-JY7RKJ65.mjs → chunk-ZIGMC2X4.mjs} +13 -13
  77. package/dist/cli/{chunk-IXYVHTRZ.js → chunk-ZO65VJRJ.js} +70 -9
  78. package/dist/cli/{chunk-SRUNYWQ2.mjs → chunk-ZRC52APB.mjs} +1 -1
  79. package/dist/cli/{chunk-DX646HO7.mjs → chunk-ZYN6S6G2.mjs} +4 -4
  80. package/dist/cli/command-docs.js +2 -2
  81. package/dist/cli/command-docs.mjs +1 -1
  82. package/dist/cli/{concurrent-runs-help-ROQM6UB3.mjs → concurrent-runs-help-H3SA7J6H.mjs} +6 -6
  83. package/dist/cli/concurrent-runs-help-PB7GT6F2.js +22 -0
  84. package/dist/cli/{csv-FWGSY4GE.js → csv-6DEKR3QQ.js} +13 -13
  85. package/dist/cli/{csv-R7GV33BC.mjs → csv-ICXI7JAS.mjs} +4 -4
  86. package/dist/cli/{db-OCH35YJG.js → db-AG7INMLP.js} +27 -27
  87. package/dist/cli/{db-UWXA4RRV.mjs → db-VI7T5E6O.mjs} +6 -6
  88. package/dist/cli/describe-LMHIG3DP.js +50 -0
  89. package/dist/cli/{describe-QI4HMUGE.mjs → describe-S6NFWWGK.mjs} +21 -21
  90. package/dist/cli/describe-core.d.mts +10 -1
  91. package/dist/cli/describe-core.d.ts +10 -1
  92. package/dist/cli/describe-core.js +4 -4
  93. package/dist/cli/describe-core.mjs +3 -3
  94. package/dist/cli/{executions-7CFGC24E.js → executions-M5R5QHIA.js} +8 -8
  95. package/dist/cli/{executions-YF3KMZZN.mjs → executions-MK7H4Q2H.mjs} +6 -6
  96. package/dist/cli/{feedback-YCZHHSBS.js → feedback-L3L4FEQL.js} +14 -14
  97. package/dist/cli/{feedback-DWIWBS7O.mjs → feedback-ZHATL2XF.mjs} +6 -6
  98. package/dist/cli/{git-XCGMQQOD.mjs → git-W5DHNH2Q.mjs} +5 -5
  99. package/dist/cli/git-WYNCLDHD.js +26 -0
  100. package/dist/cli/index.js +148 -148
  101. package/dist/cli/index.mjs +47 -47
  102. package/dist/cli/{integrations-5ABAJBSW.mjs → integrations-73YSN2LI.mjs} +7 -7
  103. package/dist/cli/{integrations-IEZA3TGK.js → integrations-IBWNO3YP.js} +29 -29
  104. package/dist/cli/{legacy-noops-OZMY73Y3.mjs → legacy-noops-4LFZJTDX.mjs} +6 -6
  105. package/dist/cli/{legacy-noops-KNFLJ5P2.js → legacy-noops-AE6DBYJM.js} +9 -9
  106. package/dist/cli/{mcp-NLQAO7KP.js → mcp-BKL6M6OI.js} +24 -24
  107. package/dist/cli/{mcp-WSPFKQPZ.mjs → mcp-E6PTSNDE.mjs} +4 -4
  108. package/dist/cli/{monitors-LPKFFTOX.mjs → monitors-MXJ27KQK.mjs} +7 -7
  109. package/dist/cli/{monitors-BJYOB4S3.js → monitors-SW7ZCPPT.js} +100 -100
  110. package/dist/cli/{org-RYPMUYUW.mjs → org-HYAJ2MIK.mjs} +6 -6
  111. package/dist/cli/{org-WIVHI4WT.js → org-XJ44KZ5I.js} +121 -121
  112. package/dist/cli/{outcomes-QKX7IE3O.js → outcomes-PTXGG4BZ.js} +14 -14
  113. package/dist/cli/{outcomes-FADJYC4I.mjs → outcomes-PUMAXRGD.mjs} +6 -6
  114. package/dist/cli/{play-ID73J3NP.js → play-EPDZ3GDV.js} +349 -349
  115. package/dist/cli/{play-4ZKK5Q7U.mjs → play-QN3X6IAE.mjs} +20 -20
  116. package/dist/cli/{providers-WCCGYGW6.js → providers-GNJFGNDH.js} +9 -9
  117. package/dist/cli/{providers-LURYBSNO.mjs → providers-JIN5UQ7Z.mjs} +6 -6
  118. package/dist/cli/{quickstart-KCCSEE5J.mjs → quickstart-4EBFHGB7.mjs} +4 -4
  119. package/dist/cli/{quickstart-LVPOU25V.js → quickstart-YH6NNC5I.js} +6 -6
  120. package/dist/cli/{run-2QMJRCVA.js → run-4DRF7KQJ.js} +70 -49
  121. package/dist/cli/{run-XXK7DDUF.mjs → run-5467KBCP.mjs} +48 -27
  122. package/dist/cli/search-B2KCWPUV.js +32 -0
  123. package/dist/cli/{search-ZYAWW3CK.mjs → search-ZERTOGH6.mjs} +7 -7
  124. package/dist/cli/{search-output-N45AIOB4.mjs → search-output-OAVJXRFO.mjs} +5 -5
  125. package/dist/cli/{search-output-YNXAZSKT.js → search-output-OMNZN2LP.js} +8 -8
  126. package/dist/cli/{secrets-MHT27L2M.js → secrets-7XK2BGYX.js} +15 -15
  127. package/dist/cli/{secrets-7Q3AOUAS.mjs → secrets-KAVDYB4P.mjs} +6 -6
  128. package/dist/cli/sessions-PUQURPPC.js +23 -0
  129. package/dist/cli/{sessions-6QKOM7M3.mjs → sessions-TNPI6XWB.mjs} +6 -6
  130. package/dist/cli/{settings-NPVIDENI.mjs → settings-KUABXRAJ.mjs} +12 -12
  131. package/dist/cli/{settings-OP7Q6YX6.js → settings-RQ3Z3JCM.js} +85 -85
  132. package/dist/cli/{setup-OOT3EIMF.mjs → setup-6IX6BSS7.mjs} +9 -9
  133. package/dist/cli/{setup-RT6GHL3W.js → setup-TDOWNKYN.js} +49 -49
  134. package/dist/cli/skills-AACRY2TV.js +37 -0
  135. package/dist/cli/{skills-TEXI4CLZ.mjs → skills-Z6NBJ4KP.mjs} +7 -7
  136. package/dist/cli/{tools-G5L36M3X.mjs → tools-LQKFWK7J.mjs} +19 -19
  137. package/dist/cli/tools-OTYA4722.js +57 -0
  138. package/dist/cli/update-JTGMI6OJ.js +37 -0
  139. package/dist/cli/{update-YNKQTE4D.mjs → update-RUB4EIKW.mjs} +9 -9
  140. package/dist/cli/{views-IQFMUMLU.mjs → views-D7WY5QPR.mjs} +6 -6
  141. package/dist/cli/{views-OVQ5AQAU.js → views-FFLXLAGC.js} +21 -21
  142. package/dist/cli/{workflow-Y5IFMI7N.mjs → workflow-BV2OTEQD.mjs} +7 -7
  143. package/dist/cli/{workflow-RCBYXIFZ.js → workflow-QW7QVODA.js} +17 -17
  144. package/dist/index.js +9 -9
  145. package/dist/index.mjs +6 -6
  146. package/dist/install-integrity.json +122 -122
  147. package/dist/release.d.mts +9 -1
  148. package/dist/release.d.ts +9 -1
  149. package/dist/release.js +2 -2
  150. package/dist/release.mjs +1 -1
  151. package/dist/server.js +5 -5
  152. package/dist/server.mjs +3 -3
  153. package/package.json +1 -1
  154. package/dist/cli/auth-UKPV5U2B.js +0 -44
  155. package/dist/cli/concurrent-runs-help-BFVCUJF4.js +0 -22
  156. package/dist/cli/describe-6OI5K2SH.js +0 -50
  157. package/dist/cli/git-TGLNZRS3.js +0 -26
  158. package/dist/cli/search-AQSAXA6D.js +0 -32
  159. package/dist/cli/sessions-RGD7L4LC.js +0 -23
  160. package/dist/cli/skills-ERAA734H.js +0 -37
  161. package/dist/cli/tools-D5SZSIIH.js +0 -57
  162. package/dist/cli/update-WZ6527EF.js +0 -37
@@ -282,13 +282,48 @@ export const RUNTIME_SPEED_PROFILES = {
282
282
  PWV: false,
283
283
  },
284
284
  },
285
+ 'fast_launch@9': {
286
+ summary:
287
+ "fast_launch@8 plus EW: once a launch has won the fence for an adopted EN-narrowed early sandbox, and before any envelope or customer code is delivered, the sandbox's outbound allowlist is widened to exactly the allowlist a fresh create for that launch would get. ctx.fetch then behaves as on a non-early run (no egress broker caps, rate limits or source-IP change); if widening fails the run defers to a fresh attempt. Registered before any grant.",
288
+ switches: {
289
+ B: true,
290
+ H1: true,
291
+ P1: true,
292
+ P2: true,
293
+ V3: true,
294
+ C3: true,
295
+ C4: true,
296
+ C5: true,
297
+ PI: true,
298
+ E2: true,
299
+ PB: true,
300
+ LH: true,
301
+ EN: true,
302
+ CA: true,
303
+ PX: true,
304
+ EW: true,
305
+ A1: false,
306
+ N1: false,
307
+ F3: false,
308
+ S1: false,
309
+ PWM: false,
310
+ PWT: false,
311
+ PWV: false,
312
+ },
313
+ },
285
314
  } as const satisfies Record<string, RuntimeSpeedProfileDefinition>;
286
315
 
287
316
  export type RuntimeSpeedProfileId = keyof typeof RUNTIME_SPEED_PROFILES;
288
317
 
289
- /** The profile the `runtime-fast-launch` rollout grants. */
318
+ /**
319
+ * The profile the `runtime-fast-launch` rollout grants. fast_launch@9 became
320
+ * the default once its registration served everywhere; the rollout percentage
321
+ * still decides which organizations get it (0% plus the internal workspace's
322
+ * override when this shipped). Rollback: this constant back to 'fast_launch@6',
323
+ * or the rollout back to 0%.
324
+ */
290
325
  export const RUNTIME_FAST_LAUNCH_PROFILE: RuntimeSpeedProfileId =
291
- 'fast_launch@6';
326
+ 'fast_launch@9';
292
327
 
293
328
  /**
294
329
  * Per-organization exceptions to `RUNTIME_FAST_LAUNCH_PROFILE`, for
@@ -302,9 +337,10 @@ export const RUNTIME_FAST_LAUNCH_ORGANIZATION_PROFILES: Readonly<
302
337
  Record<string, RuntimeSpeedProfileId>
303
338
  > = {
304
339
  // Internal Deepline workspace: the one org granted early start (EN, then
305
- // PX + CA) for its Production measurement. Rollback is this entry back to
306
- // 'fast_launch@7' (its previous Production pin), or 'fast_launch@4', or removal.
307
- jh772jvn83r6be5kpcjn6rcqj182tgre: 'fast_launch@8',
340
+ // PX + CA, then EW) for its Production measurement. Rollback is this entry
341
+ // back to 'fast_launch@8' (its previous Production pin: broker ctx.fetch),
342
+ // or 'fast_launch@4', or removal.
343
+ jh772jvn83r6be5kpcjn6rcqj182tgre: 'fast_launch@9',
308
344
  };
309
345
 
310
346
  /** The profile the rollout grants to this organization. */
@@ -15363,72 +15363,6 @@ export async function readPostgresSchedulerComputeBillingRecovery(
15363
15363
  : null;
15364
15364
  }
15365
15365
 
15366
- /** A finalized Preview charge can outlive its test workspace and job ACK. */
15367
- export async function acknowledgeFinalizedTrainComputeBillingJob(
15368
- client: PostgresSchedulerQueryClient,
15369
- input: {
15370
- schema: string;
15371
- runId: string;
15372
- orgId: string;
15373
- attemptCount: number;
15374
- resumeEpoch: string | null;
15375
- resourceSnapshot: ReadonlyArray<readonly [number, unknown]>;
15376
- },
15377
- ): Promise<boolean> {
15378
- const { schema, runId, orgId, attemptCount, resumeEpoch, resourceSnapshot } =
15379
- input;
15380
- if (!/^runtime_scheduler_preview_release_train(?:_[b-d])?$/u.test(schema)) {
15381
- throw new Error(
15382
- 'Finalized train billing recovery requires a named Preview lane.',
15383
- );
15384
- }
15385
- const result = await client.query(
15386
- `WITH matching_run AS MATERIALIZED (
15387
- SELECT run.run_id
15388
- FROM ${tableName('runs', { schema })} AS run
15389
- WHERE run.run_id = $1 AND run.org_id = $2
15390
- AND run.status IN ('completed', 'failed', 'cancelled')
15391
- AND run.launch_json->>'schedulerSchema' = $3
15392
- AND (run.launch_json->>'resumeEpoch') IS NOT DISTINCT FROM $4
15393
- AND coalesce(run.admission_json, run.launch_json)->>'schedulerSchema' = $3
15394
- AND (coalesce(run.admission_json, run.launch_json)->>'resumeEpoch')
15395
- IS NOT DISTINCT FROM $4
15396
- FOR UPDATE OF run
15397
- ), matching_attempts AS MATERIALIZED (
15398
- SELECT attempt.attempt, attempt.resource_json
15399
- FROM ${tableName('attempts', { schema })} AS attempt
15400
- JOIN matching_run ON matching_run.run_id = attempt.run_id
15401
- ORDER BY attempt.attempt
15402
- FOR UPDATE OF attempt
15403
- )
15404
- UPDATE ${tableName('compute_billing_jobs_v2', { schema })} AS job
15405
- SET status = 'settled', blocked_at = NULL, block_reason = NULL,
15406
- last_error = NULL, settled_at = now(), updated_at = now()
15407
- FROM matching_run
15408
- WHERE job.run_id = matching_run.run_id
15409
- AND job.status = 'pending' AND job.blocked_at IS NOT NULL
15410
- AND job.lease_owner IS NULL AND job.lease_expires_at IS NULL
15411
- AND job.attempt_count = $5
15412
- AND $6::jsonb = (
15413
- SELECT coalesce(
15414
- jsonb_agg(jsonb_build_array(attempt, resource_json) ORDER BY attempt),
15415
- '[]'::jsonb
15416
- )
15417
- FROM matching_attempts
15418
- )
15419
- RETURNING job.run_id`,
15420
- [
15421
- runId,
15422
- orgId,
15423
- schema,
15424
- resumeEpoch,
15425
- attemptCount,
15426
- JSON.stringify(resourceSnapshot),
15427
- ],
15428
- );
15429
- return result.rows.length === 1;
15430
- }
15431
-
15432
15366
  /**
15433
15367
  * Explicit operator reconciliation takes its own settlement lease atomically.
15434
15368
  * A retained worker must not win a pending-row race and use the old issuer.
@@ -29630,12 +29564,18 @@ async function projectPostgresSchedulerStartEvent(
29630
29564
  // own envelope. Both reuse the immutable launch for omitted start metadata.
29631
29565
  const start = { ...launch, ...(event.payload as Record<string, unknown>) };
29632
29566
  const payload = hydrateRetainedPlayPipelines(start);
29567
+ const startCommittedAtMs = event.createdAt.getTime();
29633
29568
  await startRunViaAppRuntime(runtimeApi, {
29634
29569
  deliveryLeaseOwner: event.leaseOwner ?? undefined,
29635
29570
  idempotencyKey: buildRunLedgerStartIdempotencyKey({
29636
29571
  runId: event.runId,
29637
29572
  deliveryKey: event.deliveryKey,
29638
29573
  }),
29574
+ // The start's own commit time, so the app's run.started is not stamped
29575
+ // with this (possibly late) delivery's arrival time.
29576
+ ...(Number.isFinite(startCommittedAtMs) && startCommittedAtMs > 0
29577
+ ? { startedAt: startCommittedAtMs }
29578
+ : {}),
29639
29579
  playName: stringPayloadField(start, 'playName') ?? event.runId,
29640
29580
  playReference: stringPayloadField(start, 'playReference'),
29641
29581
  definitionScope: launch?.definitionScope ?? undefined,
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  getAuthedHttpClient,
3
3
  printCommandEnvelope
4
- } from "./chunk-2TMAKJBT.mjs";
4
+ } from "./chunk-JPFAD6G6.mjs";
5
5
  import {
6
6
  cliFeatureEnabled
7
- } from "./chunk-SRUNYWQ2.mjs";
8
- import "./chunk-ZFXDD7VM.mjs";
7
+ } from "./chunk-ZRC52APB.mjs";
8
+ import "./chunk-XJNJ3BWU.mjs";
9
9
  import "./chunk-ASB47RXJ.mjs";
10
10
  import "./chunk-DLIRSHV6.mjs";
11
11
  import {
12
12
  DeeplineError
13
13
  } from "./chunk-Z3A2S3QM.mjs";
14
14
  import "./chunk-2MGZAI54.mjs";
15
- import "./chunk-XVBEEGI4.mjs";
15
+ import "./chunk-CUIFDMNP.mjs";
16
16
  import "./chunk-WZYKRD7T.mjs";
17
17
  import "./chunk-KRD6H754.mjs";
18
18
 
@@ -31,6 +31,17 @@ var MODEL_PROVIDER_NAMES = {
31
31
  openai: "OpenAI",
32
32
  anthropic: "Anthropic"
33
33
  };
34
+ var WAKE_STATUS_WORDS = {
35
+ woken: "started a turn",
36
+ nothing_waiting: "found nothing waiting",
37
+ throttled: "was held back: the hourly turn limit was reached",
38
+ not_woken: "started nothing: the agent was not available"
39
+ };
40
+ function describeOwnedOutcome(owned) {
41
+ const watch = owned.watch ? `watch ${owned.watch.key} (ring ${owned.watch.ringState}${owned.watch.lastRingError ? `, last error: ${owned.watch.lastRingError}` : ""})` : `no watch${owned.refusal ? `: ${owned.refusal}` : ""}`;
42
+ const last = owned.lastWake ? `last ring ${new Date(owned.lastWake.at).toISOString()} ${WAKE_STATUS_WORDS[owned.lastWake.status]}${owned.lastWake.what.length > 0 ? ` (${owned.lastWake.what.join(", ")})` : ""}` : "never rung";
43
+ return `${owned.outcome} \u2014 as ${owned.agent}; ${watch}; ${last}; ${owned.turnsInWindow} of ${owned.turnLimit} turns this hour`;
44
+ }
34
45
  var REPLIES_MAX_LIMIT = 100;
35
46
  var REPLIES_INVALID_CURSOR = "DEEPLINE_AGENT_REPLIES_INVALID_CURSOR";
36
47
  var FEEDBACK_MAX_LIMIT = 100;
@@ -69,7 +80,33 @@ function firstLine(text, max = 100) {
69
80
  }
70
81
  function describeConversation(conversation) {
71
82
  const where = conversation.platform === "slack" ? `#${conversation.conversationName}` : `test ${conversation.conversationName}`;
72
- return `${where} (${conversation.conversationId})`;
83
+ const settings = [
84
+ ...conversation.model ? [`model ${conversation.model}`] : [],
85
+ ...conversation.outcome ? [
86
+ `${conversation.outcome.role === "home" ? "home of" : "linked to"} outcome ${conversation.outcome.slug}`
87
+ ] : []
88
+ ];
89
+ return `${where} (${conversation.conversationId}${settings.length ? `; ${settings.join("; ")}` : ""})`;
90
+ }
91
+ function parseModel(value) {
92
+ if (value === void 0) return void 0;
93
+ const model = value.trim();
94
+ return model === "" || model.toLowerCase() === "default" ? null : model;
95
+ }
96
+ function describeOutcomeChange(change) {
97
+ const { conversation } = change;
98
+ const where = `#${conversation.conversationName}`;
99
+ if (!conversation.outcome) {
100
+ return [
101
+ change.changed ? `${change.agentName} no longer works toward an outcome in ${where}.` : `${change.agentName} works toward no outcome in ${where}.`
102
+ ];
103
+ }
104
+ const { slug, role } = conversation.outcome;
105
+ return [
106
+ role === "home" ? `${where} is the home of outcome ${slug}: ${change.agentName} works toward it there.` : `${where} is linked to outcome ${slug}: ${change.agentName} answers there with it in view.`,
107
+ role === "linked" ? "It is woken in the outcome\u2019s home channel, not here." : change.woken ? "It is woken when something on the outcome concerns it: a schedule firing, a task for it, an answered ask." : "It is not woken between mentions here: this deployment\u2019s app cannot be rung.",
108
+ `See the outcome with: deepline outcomes describe ${slug}`
109
+ ];
73
110
  }
74
111
  function describeAgentLine(agent) {
75
112
  const channels = agent.conversations.length ? agent.conversations.map(describeConversation).join(", ") : "no channels";
@@ -82,6 +119,7 @@ function describeAgent(agent) {
82
119
  "Instructions:",
83
120
  ...agent.instructions.split("\n").map((line) => ` ${line}`),
84
121
  `Skills: ${agent.skillNames.length ? agent.skillNames.join(", ") : "none"}`,
122
+ `Model: ${agent.model ?? "the default (see deepline agents models)"}`,
85
123
  agent.conversations.length ? `Channels: ${agent.conversations.map(describeConversation).join(", ")}` : `Channels: none. Bind one with: deepline agents channels add ${agent.name} <channel-id>`
86
124
  ];
87
125
  }
@@ -381,6 +419,50 @@ function registerWorkspaceCommands(agents, readKey) {
381
419
  print(overview, "agents billing", describeOverview(overview), options);
382
420
  }
383
421
  );
422
+ agents.command("models").description(
423
+ "List the models an agent or one of its channels can run on, and which your workspace\u2019s key can run."
424
+ ).option("--json", "Emit JSON output").action(async (options) => {
425
+ const { http } = getAuthedHttpClient();
426
+ const result = await http.get(
427
+ `${AGENT_PATH}/models`
428
+ );
429
+ const keySet = result.models.some((model) => model.available);
430
+ print(
431
+ result,
432
+ "agent models",
433
+ [
434
+ ...keySet ? [] : [
435
+ "No model key is set, so no model can run yet. An admin runs: deepline agents billing set < key.txt"
436
+ ],
437
+ ...result.models.map(
438
+ (model) => `${model.id} \u2014 ${model.label}${model.id === result.default ? " (the default)" : ""}; say: ${model.aliases.join(", ")}; ${model.available ? "ready" : keySet ? `runs on an ${MODEL_PROVIDER_NAMES[model.provider]} key, which is not the key your agents run on` : `runs on an ${MODEL_PROVIDER_NAMES[model.provider]} key`}`
439
+ ),
440
+ "Set an agent\u2019s model with: deepline agents update <agent> --model <model>",
441
+ "Set one channel\u2019s with: deepline agents channels set <channel-id> --model <model>, or ask the agent there to switch."
442
+ ],
443
+ options
444
+ );
445
+ });
446
+ agents.command("outcomes").description(
447
+ "List the outcomes Bot by Deepline owns by default (those with no home channel), with what woke it last on each."
448
+ ).option("--json", "Emit JSON output").action(async (options) => {
449
+ const { http } = getAuthedHttpClient();
450
+ const result = await http.get(
451
+ `${AGENT_PATH}/outcomes`
452
+ );
453
+ print(
454
+ result,
455
+ "outcomes Bot by Deepline owns",
456
+ result.owners.length === 0 ? [
457
+ "None. Bot by Deepline owns every outcome with no home channel while agents are on (deepline agents enable) and this deployment can be rung."
458
+ ] : [
459
+ ...result.owners.map(describeOwnedOutcome),
460
+ ...result.more ? ["More outcomes than are listed here."] : [],
461
+ "The watch and what waits for it: deepline outcomes watches list <outcome>"
462
+ ],
463
+ options
464
+ );
465
+ });
384
466
  }
385
467
  function registerAgentCommands(agents) {
386
468
  agents.command("get").description("Show one agent: its instructions, skills and channels.").argument("<name>", "Agent name").option("--json", "Emit JSON output").action(async (name, options) => {
@@ -392,9 +474,13 @@ function registerAgentCommands(agents) {
392
474
  });
393
475
  agents.command("create").description(
394
476
  "Create an agent you own, with instructions and optional skills from the workspace library."
395
- ).argument("<name>", "Agent name: lower-case letters, digits and dashes").option("--instructions <text>", "What the agent does and never does").option("--instructions-file <path>", "Read the instructions from a file").option("--skills <names>", "Comma-separated library skill names").option("--dry-run", "Print the request without sending it").option("--json", "Emit JSON output").action(
477
+ ).argument("<name>", "Agent name: lower-case letters, digits and dashes").option("--instructions <text>", "What the agent does and never does").option("--instructions-file <path>", "Read the instructions from a file").option("--skills <names>", "Comma-separated library skill names").option(
478
+ "--model <model>",
479
+ "The model it runs on, from deepline agents models (for example sonnet)"
480
+ ).option("--dry-run", "Print the request without sending it").option("--json", "Emit JSON output").action(
396
481
  async (name, options) => {
397
482
  const instructions = readInstructions(options);
483
+ const model = parseModel(options.model);
398
484
  if (instructions === void 0) {
399
485
  throw new AgentUsageError(
400
486
  'Pass --instructions "<what the agent does>" or --instructions-file <path>.'
@@ -403,7 +489,8 @@ function registerAgentCommands(agents) {
403
489
  const body = {
404
490
  name: requireArgument(name, "an agent name"),
405
491
  instructions,
406
- skills: parseSkills(options.skills) ?? []
492
+ skills: parseSkills(options.skills) ?? [],
493
+ ...typeof model === "string" ? { model } : {}
407
494
  };
408
495
  if (options.dryRun) {
409
496
  printDryRun("POST", `${AGENT_PATH}/agents`, body, options);
@@ -426,23 +513,28 @@ function registerAgentCommands(agents) {
426
513
  }
427
514
  );
428
515
  agents.command("update").description(
429
- "Replace an agent\u2019s instructions or skills (its creator or an admin)."
516
+ "Replace an agent\u2019s instructions, skills or model (its creator or an admin)."
430
517
  ).argument("<name>", "Agent name").option("--instructions <text>", "New instructions").option("--instructions-file <path>", "Read new instructions from a file").option(
431
518
  "--skills <names>",
432
519
  'Comma-separated library skill names; replaces the list ("" clears it)'
520
+ ).option(
521
+ "--model <model>",
522
+ 'The model it runs on, from deepline agents models ("default" returns it to the default)'
433
523
  ).option("--dry-run", "Print the request without sending it").option("--json", "Emit JSON output").action(
434
524
  async (name, options) => {
435
525
  const instructions = readInstructions(options);
436
526
  const skills = parseSkills(options.skills);
437
- if (instructions === void 0 && skills === void 0) {
527
+ const model = parseModel(options.model);
528
+ if (instructions === void 0 && skills === void 0 && model === void 0) {
438
529
  throw new AgentUsageError(
439
- "Pass --instructions, --instructions-file or --skills."
530
+ "Pass --instructions, --instructions-file, --skills or --model."
440
531
  );
441
532
  }
442
533
  const path = `${AGENT_PATH}/agents/${encodeURIComponent(requireArgument(name, "an agent name"))}`;
443
534
  const body = {
444
535
  ...instructions !== void 0 ? { instructions } : {},
445
- ...skills !== void 0 ? { skills } : {}
536
+ ...skills !== void 0 ? { skills } : {},
537
+ ...model !== void 0 ? { model } : {}
446
538
  };
447
539
  if (options.dryRun) {
448
540
  printDryRun("PATCH", path, body, options);
@@ -473,40 +565,104 @@ function registerAgentCommands(agents) {
473
565
  }
474
566
  function registerChannelCommands(agents) {
475
567
  const channels = agents.command("channels").description(
476
- "Bind Slack channels to agents. A channel answers @mentions with one agent."
568
+ "Bind Slack channels to agents, and say what an agent runs on and works toward in each. A channel answers @mentions with one agent."
477
569
  );
478
570
  channels.command("add").description(
479
- "Bind a channel the agent\u2019s Slack app was invited to (the agent\u2019s creator or an admin)."
480
- ).argument("<agent>", "Agent name").argument("<channel-id>", "Slack channel id, for example C0123456789").addOption(new Option("--test-channel").hideHelp()).option("--dry-run", "Print the request without sending it").option("--json", "Emit JSON output").action(
571
+ "Bind a channel the agent\u2019s Slack app was invited to (the agent\u2019s creator or an admin). With --outcome the channel is where the agent works toward that outcome."
572
+ ).argument("<agent>", "Agent name").argument("<channel-id>", "Slack channel id, for example C0123456789").option(
573
+ "--outcome <outcome>",
574
+ "The outcome the agent works toward here, as deepline outcomes list names it. The channel becomes the outcome\u2019s home: the agent is woken there."
575
+ ).option(
576
+ "--linked",
577
+ "With --outcome: link the channel instead. The agent answers here with the outcome in view; its home channel is another one."
578
+ ).addOption(new Option("--test-channel").hideHelp()).option("--dry-run", "Print the request without sending it").option("--json", "Emit JSON output").action(
481
579
  async (agentName, channelId, options) => {
580
+ if (options.linked && options.outcome === void 0) {
581
+ throw new AgentUsageError("--linked goes with --outcome <outcome>.");
582
+ }
482
583
  const body = {
483
584
  agent: requireArgument(agentName, "an agent name"),
484
585
  channel_id: requireArgument(
485
586
  channelId,
486
587
  "a channel id such as C0123456789"
487
588
  ),
488
- ...options.testChannel ? { test_channel: true } : {}
589
+ ...options.testChannel ? { test_channel: true } : {},
590
+ ...options.outcome !== void 0 ? {
591
+ outcome: requireArgument(options.outcome, "an outcome name"),
592
+ outcome_role: options.linked ? "linked" : "home"
593
+ } : {}
489
594
  };
490
595
  if (options.dryRun) {
491
596
  printDryRun("POST", `${AGENT_PATH}/channels`, body, options);
492
597
  return;
493
598
  }
494
599
  const { http } = getAuthedHttpClient();
495
- const result = await http.post(
496
- `${AGENT_PATH}/channels`,
497
- body
498
- );
600
+ const result = await http.post(`${AGENT_PATH}/channels`, body);
499
601
  print(
500
602
  result,
501
603
  "agent channel",
502
604
  [
503
605
  result.created ? `Bound ${body.channel_id} to ${result.agent.name}.` : `${body.channel_id} already answers with ${result.agent.name}.`,
606
+ ...result.outcome ? describeOutcomeChange(result.outcome) : [],
504
607
  ...describeAgent(result.agent)
505
608
  ],
506
609
  options
507
610
  );
508
611
  }
509
612
  );
613
+ channels.command("set").description(
614
+ "Change what a bound channel\u2019s agent runs on or works toward there (the agent\u2019s creator or an admin)."
615
+ ).argument("<channel-id>", "A bound channel id").option(
616
+ "--model <model>",
617
+ 'This channel\u2019s own model, over its agent\u2019s, from deepline agents models ("default" follows the agent again)'
618
+ ).option(
619
+ "--outcome <outcome>",
620
+ "The outcome the agent works toward here. The channel becomes the outcome\u2019s home."
621
+ ).option(
622
+ "--linked",
623
+ "With --outcome: link the channel instead of making it the home"
624
+ ).option("--no-outcome", "The agent works toward no outcome here").option(
625
+ "--platform <platform>",
626
+ "slack or test, when the id is bound on both"
627
+ ).option("--dry-run", "Print the request without sending it").option("--json", "Emit JSON output").action(
628
+ async (channelId, options) => {
629
+ const platform = requirePlatform(options.platform);
630
+ const model = parseModel(options.model);
631
+ const outcome = typeof options.outcome === "string" ? requireArgument(options.outcome, "an outcome name") : options.outcome === false ? null : void 0;
632
+ if (model === void 0 && outcome === void 0) {
633
+ throw new AgentUsageError(
634
+ "Pass --model, --outcome <outcome> or --no-outcome."
635
+ );
636
+ }
637
+ if (options.linked && typeof outcome !== "string") {
638
+ throw new AgentUsageError("--linked goes with --outcome <outcome>.");
639
+ }
640
+ const id = requireArgument(channelId, "a channel id");
641
+ const path = `${AGENT_PATH}/channels/${encodeURIComponent(id)}${platform ? `?platform=${platform}` : ""}`;
642
+ const body = {
643
+ ...model !== void 0 ? { model } : {},
644
+ ...outcome !== void 0 ? { outcome } : {},
645
+ ...typeof outcome === "string" ? { outcome_role: options.linked ? "linked" : "home" } : {}
646
+ };
647
+ if (options.dryRun) {
648
+ printDryRun("PATCH", path, body, options);
649
+ return;
650
+ }
651
+ const { http } = getAuthedHttpClient();
652
+ const result = await http.patch(path, body);
653
+ print(
654
+ result,
655
+ "agent channel",
656
+ [
657
+ ...result.model ? [
658
+ result.model.from === "conversation" ? `${id} runs on ${result.model.model.label} (${result.model.model.id}). Its agent\u2019s other channels are unchanged.` : `${id} follows its agent\u2019s model: ${result.model.model.label} (${result.model.model.id}).`
659
+ ] : [],
660
+ ...result.outcome ? describeOutcomeChange(result.outcome) : []
661
+ ],
662
+ options
663
+ );
664
+ }
665
+ );
510
666
  channels.command("remove").description(
511
667
  "Unbind a channel from its agent (the agent\u2019s creator or an admin). Unbound channels are a no-op."
512
668
  ).argument("<channel-id>", "Channel id").option(
@@ -541,6 +697,14 @@ function describeSlackInstallation(installation) {
541
697
  const reason = installation.uninstallReason === "tokens_revoked" ? "its token was revoked" : "removed from Slack";
542
698
  return `${team}: not installed since ${new Date(installation.uninstalledAt ?? installation.updatedAt).toISOString()} (${reason}); install it again to bring its channels back`;
543
699
  }
700
+ function slackLinkCode(value) {
701
+ const text = requireArgument(value, "the code from the link");
702
+ try {
703
+ return new URL(text).searchParams.get("code") ?? text;
704
+ } catch {
705
+ return text;
706
+ }
707
+ }
544
708
  function registerSlackCommands(agents) {
545
709
  const slack = agents.command("slack").description(
546
710
  "Add the agent to Slack workspaces, each with its own bot token, and see where it is installed."
@@ -564,6 +728,36 @@ function registerSlackCommands(agents) {
564
728
  options
565
729
  );
566
730
  });
731
+ slack.command("link").description(
732
+ "Say which Slack user you are, with the code from the link the agent showed you in Slack. Your clicks there (answering an ask, connecting a channel) are then made as you."
733
+ ).argument("<code>", "The code from the link, or the whole link").option("--json", "Emit JSON output").action(async (code, options) => {
734
+ const { http } = getAuthedHttpClient();
735
+ const result = await http.post(`${AGENT_PATH}/slack/link`, { code: slackLinkCode(code) });
736
+ print(
737
+ result,
738
+ "agent slack link",
739
+ [
740
+ `Linked Slack user ${result.slackUserId} in ${result.slackTeamId} to your Deepline account. Click again in Slack.`
741
+ ],
742
+ options
743
+ );
744
+ });
745
+ slack.command("unlink").description(
746
+ "Forget which Slack user you are in this workspace. Your clicks in Slack decide nothing until you link again."
747
+ ).option("--json", "Emit JSON output").action(async (options) => {
748
+ const { http } = getAuthedHttpClient();
749
+ const result = await http.delete(
750
+ `${AGENT_PATH}/slack/link`
751
+ );
752
+ print(
753
+ result,
754
+ "agent slack unlink",
755
+ [
756
+ result.removed ? "Unlinked your Slack user." : "No Slack user was linked to your account."
757
+ ],
758
+ options
759
+ );
760
+ });
567
761
  slack.command("status").description(
568
762
  "List the Slack workspaces this workspace installed the agent in."
569
763
  ).option("--json", "Emit JSON output").action(async (options) => {