deepline 0.3.543 → 0.3.545

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 (157) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +11 -0
  2. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  3. package/dist/bundling-sources/shared_libs/integration-contracts/monitor-fleet-contract.ts +3 -1
  4. package/dist/bundling-sources/shared_libs/monitors/fleets/errors.ts +5 -0
  5. package/dist/bundling-sources/shared_libs/monitors/fleets/issues.ts +5 -1
  6. package/dist/bundling-sources/shared_libs/monitors/fleets/limits.ts +6 -0
  7. package/dist/bundling-sources/shared_libs/monitors/fleets/plan.ts +142 -3
  8. package/dist/bundling-sources/shared_libs/play-runtime/durable-summary-events.ts +29 -0
  9. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +2 -1
  10. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +3 -0
  11. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +13 -1
  12. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +1 -1
  13. package/dist/cli/auth-455MB4K6.js +43 -0
  14. package/dist/cli/{auth-ITAELTOA.mjs → auth-VZAMAMFW.mjs} +5 -5
  15. package/dist/cli/{billing-33XVFDUJ.js → billing-ASZJDFH2.js} +92 -92
  16. package/dist/cli/{billing-WZ7RVZW4.mjs → billing-DADQUQEZ.mjs} +8 -8
  17. package/dist/cli/{chunk-NR3O56FT.mjs → chunk-2CBX43LP.mjs} +5 -5
  18. package/dist/cli/{chunk-F6VSQ5LN.js → chunk-2FF3O2Y2.js} +12 -12
  19. package/dist/cli/{chunk-52YK3EII.mjs → chunk-2HFSYH7V.mjs} +2 -2
  20. package/dist/cli/{chunk-EHUG6EUT.js → chunk-34UKDHRL.js} +26 -26
  21. package/dist/cli/{chunk-JXG7HWBA.mjs → chunk-3M2QH3KA.mjs} +1 -1
  22. package/dist/cli/{chunk-2NCJQEZH.js → chunk-3NG43NXB.js} +53 -53
  23. package/dist/cli/{chunk-4SKDSSPU.mjs → chunk-3TCHX7YK.mjs} +2 -2
  24. package/dist/cli/{chunk-5VIPTLRX.mjs → chunk-4NZ3OZNO.mjs} +1 -1
  25. package/dist/cli/{chunk-ZRT2PNYY.mjs → chunk-52C6W7FG.mjs} +1 -1
  26. package/dist/cli/{chunk-STXG2LFC.js → chunk-5YYWZ43J.js} +2 -2
  27. package/dist/cli/{chunk-274WKLSY.mjs → chunk-7JZ27AFH.mjs} +2 -2
  28. package/dist/cli/{chunk-R57UCXQG.mjs → chunk-7MFATEUC.mjs} +1 -1
  29. package/dist/cli/{chunk-MCBUWK5K.js → chunk-7MHBJU73.js} +22 -22
  30. package/dist/cli/{chunk-XFPVFWZR.mjs → chunk-7P72EGLK.mjs} +1 -1
  31. package/dist/cli/{chunk-TBCNL2T5.js → chunk-C6XYSTBW.js} +1 -1
  32. package/dist/cli/{chunk-QFRMVI4S.js → chunk-CJ7DBYEQ.js} +3 -3
  33. package/dist/cli/{chunk-YE3T73BV.js → chunk-CXETRZ3G.js} +10 -10
  34. package/dist/cli/{chunk-BGAUADV4.js → chunk-D3SXB2NX.js} +41 -41
  35. package/dist/cli/{chunk-UJ6GOV7K.js → chunk-DGKDCZGC.js} +13 -13
  36. package/dist/cli/{chunk-46BEBZ3M.js → chunk-DZTVDL2X.js} +29 -28
  37. package/dist/cli/{chunk-2KTGZKRE.js → chunk-EK5C2R7S.js} +15 -15
  38. package/dist/cli/{chunk-YJYKZ2U3.js → chunk-ERLW6RPA.js} +2 -2
  39. package/dist/cli/{chunk-VSJEOSYL.mjs → chunk-EWA3M54M.mjs} +1 -1
  40. package/dist/cli/{chunk-2LNTKICO.js → chunk-FB7UPZ6M.js} +3 -3
  41. package/dist/cli/{chunk-PX7XAVUC.js → chunk-G5TV6WLV.js} +19 -19
  42. package/dist/cli/{chunk-NHKP2NSU.js → chunk-GFRJU2KB.js} +2 -2
  43. package/dist/cli/{chunk-D6YAU3CF.mjs → chunk-GWDPNOA7.mjs} +2 -1
  44. package/dist/cli/{chunk-ZSPBJB7I.mjs → chunk-HLUNTJBO.mjs} +4 -4
  45. package/dist/cli/{chunk-OELJKQOL.mjs → chunk-HPX7LLAM.mjs} +2 -2
  46. package/dist/cli/{chunk-DI3GL3T6.js → chunk-HR5BT42R.js} +99 -99
  47. package/dist/cli/{chunk-3JZXU5OB.js → chunk-IYJO3RWR.js} +5 -5
  48. package/dist/cli/{chunk-DH43ECTN.mjs → chunk-JL5JU3LD.mjs} +2 -2
  49. package/dist/cli/{chunk-OAFKUHN5.mjs → chunk-KRW727W6.mjs} +4 -4
  50. package/dist/cli/{chunk-SYOPHFKB.mjs → chunk-KYO2FICL.mjs} +5 -5
  51. package/dist/cli/{chunk-FNW2SGPD.mjs → chunk-LTCEZWPZ.mjs} +2 -2
  52. package/dist/cli/{chunk-XBM3KABD.mjs → chunk-LWPFMYSO.mjs} +2 -2
  53. package/dist/cli/{chunk-NLENABRU.js → chunk-N4LADLCO.js} +6 -6
  54. package/dist/cli/{chunk-XSN6BAZT.mjs → chunk-NAN3A4IF.mjs} +5 -5
  55. package/dist/cli/{chunk-23D224GI.js → chunk-NCX2JH2F.js} +9 -9
  56. package/dist/cli/{chunk-DUGTPVT7.js → chunk-NZDZGK35.js} +7 -7
  57. package/dist/cli/{chunk-C35NLLSA.js → chunk-OGQYAJSO.js} +5 -5
  58. package/dist/cli/{chunk-J2F6F5GL.js → chunk-QI57XUGA.js} +5 -5
  59. package/dist/cli/{chunk-O2KLWUNI.js → chunk-QM7PHHYZ.js} +44 -44
  60. package/dist/cli/{chunk-5MN3BKNB.js → chunk-TQKHXMV3.js} +16 -16
  61. package/dist/cli/{chunk-SU4K4SUU.mjs → chunk-WP36UBRY.mjs} +1 -1
  62. package/dist/cli/{chunk-AACKPOGA.mjs → chunk-XBYQZEUE.mjs} +1 -1
  63. package/dist/cli/{chunk-7AUQTNLB.mjs → chunk-XGEUPU3L.mjs} +2 -2
  64. package/dist/cli/{chunk-HKJ26NRN.mjs → chunk-XMUPZINS.mjs} +5 -5
  65. package/dist/cli/{chunk-GRCFX2EG.js → chunk-YRQKRQDU.js} +4 -4
  66. package/dist/cli/{chunk-6SJZMMD5.mjs → chunk-YWTRCKGD.mjs} +11 -11
  67. package/dist/cli/{chunk-SZNJENGT.mjs → chunk-Z4Y4BLW7.mjs} +3 -3
  68. package/dist/cli/{chunk-W2OPPSAZ.mjs → chunk-Z7QM244Q.mjs} +3 -3
  69. package/dist/cli/concurrent-runs-help-GFWXOKF5.js +21 -0
  70. package/dist/cli/{concurrent-runs-help-Z6ODNL4E.mjs → concurrent-runs-help-YP7ALTDB.mjs} +6 -6
  71. package/dist/cli/{csv-SSOFTXHU.js → csv-67WT5EGR.js} +13 -13
  72. package/dist/cli/{csv-5QW2HPHT.mjs → csv-D5ITFSYI.mjs} +4 -4
  73. package/dist/cli/{db-4LK5AJNO.js → db-GZS76X7R.js} +27 -27
  74. package/dist/cli/{db-K2JMR6EM.mjs → db-SZYBRFYG.mjs} +6 -6
  75. package/dist/cli/{describe-AXHQZHTT.mjs → describe-YJ7ZLLLI.mjs} +18 -18
  76. package/dist/cli/describe-ZRGYAEBT.js +50 -0
  77. package/dist/cli/describe-core.d.mts +2 -2
  78. package/dist/cli/describe-core.d.ts +2 -2
  79. package/dist/cli/{executions-FY2XTX2W.mjs → executions-HMYGR32E.mjs} +6 -6
  80. package/dist/cli/{executions-AATJQQAQ.js → executions-O5USTYGL.js} +8 -8
  81. package/dist/cli/{feedback-QPVJER75.js → feedback-RHLFDCRS.js} +14 -14
  82. package/dist/cli/{feedback-MKBPRGS6.mjs → feedback-Z3NXWYUO.mjs} +6 -6
  83. package/dist/cli/{git-AGRFZR3K.mjs → git-CLFKXELB.mjs} +5 -5
  84. package/dist/cli/git-RC4XDATD.js +25 -0
  85. package/dist/cli/index.js +142 -142
  86. package/dist/cli/index.mjs +44 -44
  87. package/dist/cli/{integrations-OUQ6U33M.mjs → integrations-FOACOBQB.mjs} +7 -7
  88. package/dist/cli/{integrations-R6OUFZXI.js → integrations-TZ4QEQGV.js} +15 -15
  89. package/dist/cli/{legacy-noops-DVL2RRKL.mjs → legacy-noops-6F6Y3BV7.mjs} +6 -6
  90. package/dist/cli/{legacy-noops-H7INM2QN.js → legacy-noops-QRDOS33V.js} +9 -9
  91. package/dist/cli/{mcp-33F7D7WI.js → mcp-ETMMDDGB.js} +24 -24
  92. package/dist/cli/{mcp-2Z2YVOLK.mjs → mcp-UXRCWOZU.mjs} +4 -4
  93. package/dist/cli/{monitors-NZD2WIKK.mjs → monitors-6XEWR46R.mjs} +86 -13
  94. package/dist/cli/{monitors-KDUJHAKJ.js → monitors-DITT7QTV.js} +179 -106
  95. package/dist/cli/{org-4PQGHLEB.js → org-4DE37X3L.js} +88 -88
  96. package/dist/cli/{org-EJW45RUA.mjs → org-CVSSH73G.mjs} +6 -6
  97. package/dist/cli/{play-MLHMQL4G.js → play-RH6P45CI.js} +317 -317
  98. package/dist/cli/{play-3CM5RT5J.mjs → play-Y5NCHOKK.mjs} +17 -17
  99. package/dist/cli/{providers-YBJG7277.js → providers-DU42DLOL.js} +9 -9
  100. package/dist/cli/{providers-BHYBJI4R.mjs → providers-VHUHC4IZ.mjs} +6 -6
  101. package/dist/cli/{quickstart-LL3MR562.mjs → quickstart-HJY5YYE5.mjs} +4 -4
  102. package/dist/cli/{quickstart-O7L2NNGJ.js → quickstart-XJ43JLEC.js} +6 -6
  103. package/dist/cli/{run-OK545H5Q.mjs → run-JAIXHVH7.mjs} +23 -23
  104. package/dist/cli/{run-HJ2AR6CM.js → run-JXUS7QFI.js} +43 -43
  105. package/dist/cli/search-O5VVMXII.js +32 -0
  106. package/dist/cli/{search-Z5ZKMRTX.mjs → search-RDMNM2AX.mjs} +7 -7
  107. package/dist/cli/{search-output-SVW4DETG.js → search-output-RKAM2HBH.js} +6 -6
  108. package/dist/cli/{search-output-Q5VHNUWG.mjs → search-output-ZKTR3WTJ.mjs} +4 -4
  109. package/dist/cli/{secrets-ENQWMCB5.js → secrets-TKFVMAYX.js} +15 -15
  110. package/dist/cli/{secrets-QIKIEFWB.mjs → secrets-WSW3FTF6.mjs} +6 -6
  111. package/dist/cli/sessions-3PWFWCHO.js +22 -0
  112. package/dist/cli/{sessions-AETO22RF.mjs → sessions-724BK6VP.mjs} +6 -6
  113. package/dist/cli/{settings-OFLIFTMZ.js → settings-5LJZDAZU.js} +85 -85
  114. package/dist/cli/{settings-G5RGRPFV.mjs → settings-YRC7J75G.mjs} +12 -12
  115. package/dist/cli/{setup-QW7Y62XD.js → setup-2F3DBSOS.js} +49 -49
  116. package/dist/cli/{setup-G4N3X6KG.mjs → setup-STNPX5MK.mjs} +9 -9
  117. package/dist/cli/{skills-QRFQGHNA.mjs → skills-D5PK56FO.mjs} +7 -7
  118. package/dist/cli/skills-RFOMVXIT.js +36 -0
  119. package/dist/cli/tools-CAO6EVUW.js +57 -0
  120. package/dist/cli/{tools-52BH7UTF.mjs → tools-WOGWMBA3.mjs} +17 -17
  121. package/dist/cli/update-L4DQZY3G.js +34 -0
  122. package/dist/cli/{update-SDGZLAGL.mjs → update-PC6XSWMI.mjs} +9 -9
  123. package/dist/cli/{views-5QKAWYPI.js → views-HLCLAPWN.js} +21 -21
  124. package/dist/cli/{views-3BIJFJMQ.mjs → views-IIHT4RYQ.mjs} +6 -6
  125. package/dist/cli/{workflow-G67RPWVY.js → workflow-CCZ2A7DI.js} +17 -17
  126. package/dist/cli/{workflow-QAK773FR.mjs → workflow-HK4MZ7LK.mjs} +7 -7
  127. package/dist/{client-D1ga52xq.d.ts → client-BQ6yuSjM.d.ts} +1 -1
  128. package/dist/{client-bd4QQIXo.d.mts → client-DfdUc_MY.d.mts} +1 -1
  129. package/dist/{client-core-B6eMVx8h.d.ts → client-core-3GQ8WMuk.d.ts} +14 -0
  130. package/dist/{client-core-CqfWNf2Q.d.mts → client-core-ClsNRytk.d.mts} +14 -0
  131. package/dist/index.d.mts +3 -3
  132. package/dist/index.d.ts +3 -3
  133. package/dist/index.js +9 -9
  134. package/dist/index.mjs +6 -6
  135. package/dist/install-integrity.json +114 -114
  136. package/dist/plays/play-description.d.mts +1 -1
  137. package/dist/plays/play-description.d.ts +1 -1
  138. package/dist/plays/run-request.d.mts +1 -1
  139. package/dist/plays/run-request.d.ts +1 -1
  140. package/dist/release.d.mts +1 -1
  141. package/dist/release.d.ts +1 -1
  142. package/dist/release.js +2 -2
  143. package/dist/release.mjs +1 -1
  144. package/dist/server.d.mts +2 -2
  145. package/dist/server.d.ts +2 -2
  146. package/dist/server.js +5 -5
  147. package/dist/server.mjs +3 -3
  148. package/package.json +1 -1
  149. package/dist/cli/auth-S6B5WUU5.js +0 -43
  150. package/dist/cli/concurrent-runs-help-E4OYD3DS.js +0 -21
  151. package/dist/cli/describe-AC6PLEFP.js +0 -50
  152. package/dist/cli/git-RUYFQEJX.js +0 -25
  153. package/dist/cli/search-UUNS6BCC.js +0 -32
  154. package/dist/cli/sessions-FNSUDERA.js +0 -22
  155. package/dist/cli/skills-3IXIY2IV.js +0 -36
  156. package/dist/cli/tools-MYBUMPKH.js +0 -57
  157. package/dist/cli/update-GT7574UU.js +0 -34
@@ -1613,6 +1613,11 @@ export type MonitorFleetSyncOptions = {
1613
1613
  dryRun?: boolean;
1614
1614
  /** Optimistic concurrency: refuse the write unless the fleet is at this generation. */
1615
1615
  expectedGeneration?: number;
1616
+ /**
1617
+ * Take over live monitors no Fleet owns whose key a source row renders,
1618
+ * keeping their radar (`adopt_existing: true`). Without it they are refused.
1619
+ */
1620
+ adoptExisting?: boolean;
1616
1621
  /** Stable retry key; generated by the caller when omitted. */
1617
1622
  idempotencyKey?: string;
1618
1623
  };
@@ -1923,6 +1928,11 @@ export type MonitorsHealth = {
1923
1928
  next_attempt_at?: number;
1924
1929
  summary?: Record<string, unknown>;
1925
1930
  }>;
1931
+ /**
1932
+ * With a fleet scope: its failed and blocked members, and the command that
1933
+ * lists each with its reason. Older servers omit this additive field.
1934
+ */
1935
+ fleet_members?: { failed: number; blocked: number; next: string | null };
1926
1936
  /** Bounded sample explaining why normal audit did not settle the row. */
1927
1937
  unaudited_monitors: Array<{
1928
1938
  monitor_key: string;
@@ -8360,6 +8370,7 @@ export class DeeplineClient {
8360
8370
  ? {}
8361
8371
  : { definition: definitionOrId }),
8362
8372
  ...(options?.dryRun ? { dry_run: true } : {}),
8373
+ ...(options?.adoptExisting ? { adopt_existing: true } : {}),
8363
8374
  ...(options?.expectedGeneration !== undefined
8364
8375
  ? { expected_generation: options.expectedGeneration }
8365
8376
  : {}),
@@ -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.543',
208
+ version: '0.3.545',
209
209
  updateSummary: {
210
210
  introducedIn: '0.3.90',
211
211
  summary:
@@ -11,7 +11,9 @@ import {
11
11
  // 20,000 is the first step up from 1,000. The whole Fleet lifecycle is proven
12
12
  // on the fake TamRadar at 5,000 and 10,000, and deploy, re-plan, the global
13
13
  // audit and teardown at 100,000 (docs/plans/2026-10-22-monitor-load-testing.md,
14
- // Stage 10); the full 100,000 run gates the next raise.
14
+ // Stage 10). The next raise waits on two readers outside the Fleet: the Monitor
15
+ // Ledger refuses a workspace past 20,000 summaries (#10551), and the billing
16
+ // policy pass stops after 100,000 definitions (#10552); see #10553.
15
17
  export const MONITOR_FLEET_MAX_MEMBERS = 20_000;
16
18
 
17
19
  /**
@@ -26,6 +26,11 @@ export function fleetDriftCommand(fleetId: string): string {
26
26
  return `deepline monitors fleets get ${fleetId} --drift`;
27
27
  }
28
28
 
29
+ /** Problem members by cause, each with its own message, paginated. */
30
+ export function fleetIssuesCommand(fleetId: string): string {
31
+ return `deepline monitors fleets issues ${fleetId}`;
32
+ }
33
+
29
34
  /** There is no `fleets list` verb: `get` with no id is the list. */
30
35
  export function fleetListCommand(): string {
31
36
  return 'deepline monitors fleets get';
@@ -33,6 +33,7 @@ export const FLEET_BLOCKED_CAUSES = [
33
33
  'monitors_per_account_limit',
34
34
  'rollout_access',
35
35
  'identity_occupied',
36
+ 'invalid_payload',
36
37
  'unsupported_tool',
37
38
  'needs_support',
38
39
  'unknown_code',
@@ -86,13 +87,16 @@ export function classifyFleetFailure(error: string | null): FleetFailedCause {
86
87
  for (const [prefix, cause] of FAILED_PREFIXES) {
87
88
  if (message.startsWith(prefix)) return cause;
88
89
  }
89
- return PROVIDER_REJECTION_DETAIL.test(message) ? 'provider_rejected' : 'other';
90
+ return PROVIDER_REJECTION_DETAIL.test(message)
91
+ ? 'provider_rejected'
92
+ : 'other';
90
93
  }
91
94
 
92
95
  const BLOCKED_CAUSES: Readonly<Record<string, FleetBlockedCause>> = {
93
96
  [FLEET_BLOCKED_BY.watchedEntities]: 'watched_accounts_limit',
94
97
  [FLEET_BLOCKED_BY.monitorsPerEntity]: 'monitors_per_account_limit',
95
98
  [FLEET_BLOCKED_BY.rolloutAccess]: 'rollout_access',
99
+ [FLEET_BLOCKED_BY.invalidPayload]: 'invalid_payload',
96
100
  [FLEET_REFUSAL.identityOccupied]: 'identity_occupied',
97
101
  [FLEET_REFUSAL.batchUnsupported]: 'unsupported_tool',
98
102
  [FLEET_REFUSAL.orphanedResource]: 'needs_support',
@@ -5,6 +5,12 @@ export const FLEET_BLOCKED_BY = {
5
5
  watchedEntities: OrgLimit.MonitorWatchedEntities,
6
6
  monitorsPerEntity: OrgLimit.MonitorsPerEntity,
7
7
  rolloutAccess: 'monitor.rollout_access',
8
+ /**
9
+ * The member's rendered payload breaks its monitor tool's payload rules, so
10
+ * the provider would refuse it. Its row carries the field-level reason;
11
+ * fixing the source row or template unblocks it on the next plan.
12
+ */
13
+ invalidPayload: 'monitor.invalid_payload',
8
14
  } as const;
9
15
  /** Refusals a fleet's provider work records on a member it could not create. */
10
16
  export const FLEET_REFUSAL = {
@@ -17,7 +17,19 @@ export { FLEET_BLOCKED_BY } from './limits';
17
17
  // Rollout access is checked by convergence immediately before provider work,
18
18
  // not by this pure planner: an admitted plan can outlive rollout access.
19
19
 
20
- export type FleetMemberAction = 'create' | 'update' | 'remove' | 'blocked';
20
+ /**
21
+ * `adopt` is a takeover: a live monitor a named Batch deployed, which this
22
+ * Fleet now claims. It is a planning action only. The commit receives it as a
23
+ * `create`, and the commit transition, reading the monitor row itself,
24
+ * re-derives it into an update of the radar the provider already holds. It
25
+ * never reaches the provider as a create.
26
+ */
27
+ export type FleetMemberAction =
28
+ | 'create'
29
+ | 'adopt'
30
+ | 'update'
31
+ | 'remove'
32
+ | 'blocked';
21
33
 
22
34
  /** One monitor the fleet wants, fully resolved from its source row. */
23
35
  export type DesiredFleetMember = {
@@ -28,6 +40,12 @@ export type DesiredFleetMember = {
28
40
  /** The rendered monitor definition: `{ key, tool, payload }`. */
29
41
  definition: Record<string, unknown>;
30
42
  desiredHash: string;
43
+ /**
44
+ * Why this member's payload breaks its monitor tool's payload rules, naming
45
+ * the field. Such a member is planned blocked rather than sent, so one bad
46
+ * source row cannot sink a provider bulk (#10560).
47
+ */
48
+ payloadRefusal?: string;
31
49
  };
32
50
 
33
51
  /** A monitor the fleet already owns, as Convex reports it. */
@@ -52,6 +70,20 @@ export type OwnedFleetMonitor = {
52
70
  firstMissingAt: number | null;
53
71
  };
54
72
 
73
+ /**
74
+ * A live monitor no Fleet owns yet that this Fleet may take over: the key was
75
+ * deployed by a named Batch and the provider holds its radar.
76
+ */
77
+ export type FleetTakeover = {
78
+ /** The provider already holds exactly the payload this Fleet renders. */
79
+ payloadMatches: boolean;
80
+ /**
81
+ * No named Batch deployed it: the sync's `adopt_existing` opt-in is what
82
+ * authorizes the takeover, and the commit is told so per member.
83
+ */
84
+ adoptExisting: boolean;
85
+ };
86
+
55
87
  export type PlannedFleetMember = {
56
88
  monitorKey: string;
57
89
  sourceKey: string;
@@ -60,8 +92,12 @@ export type PlannedFleetMember = {
60
92
  desiredHash?: string;
61
93
  desiredDefinition?: Record<string, unknown>;
62
94
  blockedBy?: string;
95
+ /** The member-specific reason behind `blockedBy`, stored as its error. */
96
+ error?: string;
63
97
  /** True when the commit must be given a monitor seed for this key. */
64
98
  needsSeed: boolean;
99
+ /** An `adopt` the sync's opt-in authorizes, not a named Batch. */
100
+ adoptExisting?: true;
65
101
  };
66
102
 
67
103
  export type FleetPlan = {
@@ -80,6 +116,22 @@ export type FleetPlan = {
80
116
  unblocked: number;
81
117
  /** Creates for rows the fleet did not own a monitor for. Included in `creates`. */
82
118
  newRows: number;
119
+ /**
120
+ * Live named-Batch monitors this plan takes over with the payload the
121
+ * provider already holds: no provider call, the radar and its callback
122
+ * binding are kept. Not counted in `creates` or `updates`.
123
+ */
124
+ adopts: number;
125
+ /**
126
+ * Takeovers whose payload differs, so their radar is replaced as any update
127
+ * replaces one. Included in `updates`; never in `creates`.
128
+ */
129
+ adoptsWithUpdate: number;
130
+ /**
131
+ * Of `adopts` and `adoptsWithUpdate`: monitors no named Batch deployed,
132
+ * taken over only because the sync opted in with `adopt_existing`.
133
+ */
134
+ adoptsExisting: number;
83
135
  };
84
136
 
85
137
  export type FleetMembershipMember = {
@@ -147,6 +199,38 @@ export type FleetEntitlements = {
147
199
  monitorsPerEntity: number;
148
200
  };
149
201
 
202
+ /**
203
+ * The accounts `planFleetMembers` reads monitor counts for.
204
+ *
205
+ * Only a member the provider does not hold yet (no applied hash) reaches the
206
+ * per-account admission below; one already applied is counted, and an update
207
+ * never opens an account. Counting every desired member's account read
208
+ * 100,000 accounts on an unchanged 100,000-member re-plan, 23 s of it, to
209
+ * consult none of them. Matching mirrors `planFleetMembers` exactly: by
210
+ * monitor key, else by source key.
211
+ */
212
+ export function entityKeysAdmittedByPlan(input: {
213
+ desired: readonly DesiredFleetMember[];
214
+ owned: readonly OwnedFleetMonitor[];
215
+ }): string[] {
216
+ const ownedByKey = new Map(
217
+ input.owned.map((monitor) => [monitor.monitorKey, monitor]),
218
+ );
219
+ const ownedBySource = new Map<string, OwnedFleetMonitor>();
220
+ for (const monitor of input.owned) {
221
+ if (monitor.sourceKey) ownedBySource.set(monitor.sourceKey, monitor);
222
+ }
223
+ const keys = new Set<string>();
224
+ for (const desired of input.desired) {
225
+ const owned =
226
+ ownedByKey.get(desired.monitorKey) ??
227
+ ownedBySource.get(desired.sourceKey);
228
+ if ((owned?.appliedHash ?? null) !== null) continue;
229
+ keys.add(fleetEntityKeyFor(desired));
230
+ }
231
+ return [...keys];
232
+ }
233
+
150
234
  /**
151
235
  * Turn "what the fleet wants" plus "what it already owns" into commit members.
152
236
  *
@@ -166,6 +250,8 @@ export function planFleetMembers(input: {
166
250
  * is what costs allowance.
167
251
  */
168
252
  entityMonitorCounts: ReadonlyMap<string, number>;
253
+ /** Live monitors this fleet may take over, by monitor key. */
254
+ takeovers?: ReadonlyMap<string, FleetTakeover>;
169
255
  }): FleetPlan {
170
256
  const ownedByKey = new Map(
171
257
  input.owned.map((monitor) => [monitor.monitorKey, monitor]),
@@ -191,10 +277,22 @@ export function planFleetMembers(input: {
191
277
  let retries = 0;
192
278
  let unblocked = 0;
193
279
  let newRows = 0;
280
+ let adopts = 0;
281
+ let adoptsWithUpdate = 0;
282
+ let adoptsExisting = 0;
194
283
 
195
- const refuse = (member: PlannedFleetMember, blockedBy: string) => {
284
+ const refuse = (
285
+ member: PlannedFleetMember,
286
+ blockedBy: string,
287
+ error?: string,
288
+ ) => {
196
289
  blocked[blockedBy] = (blocked[blockedBy] ?? 0) + 1;
197
- members.push({ ...member, action: 'blocked', blockedBy });
290
+ members.push({
291
+ ...member,
292
+ action: 'blocked',
293
+ blockedBy,
294
+ ...(error === undefined ? {} : { error }),
295
+ });
198
296
  };
199
297
 
200
298
  for (const desired of input.desired) {
@@ -221,6 +319,16 @@ export function planFleetMembers(input: {
221
319
  owned?.convergence === 'settled' &&
222
320
  owned.firstMissingAt === null;
223
321
  if (settledOnDesired) continue;
322
+ // The provider keeps running the radar it has; the change that cannot
323
+ // be sent waits, blocked, for a fixed row or template.
324
+ if (desired.payloadRefusal !== undefined) {
325
+ refuse(
326
+ { ...base, needsSeed: false },
327
+ FLEET_BLOCKED_BY.invalidPayload,
328
+ desired.payloadRefusal,
329
+ );
330
+ continue;
331
+ }
224
332
  // A member an older revision marked missing (the removal grace, since
225
333
  // removed) is still re-published, which clears that mark through the
226
334
  // same guarded transition every other change uses.
@@ -231,6 +339,34 @@ export function planFleetMembers(input: {
231
339
  continue;
232
340
  }
233
341
 
342
+ const takeover = owned
343
+ ? undefined
344
+ : input.takeovers?.get(desired.monitorKey);
345
+ if (takeover) {
346
+ // The monitor exists and is already counted against its account, so a
347
+ // takeover admits nothing against a limit and opens no account. The
348
+ // seed is still sent: if the monitor is deleted before the commit, the
349
+ // commit creates it from scratch as it would any new row.
350
+ members.push({
351
+ ...base,
352
+ action: 'adopt',
353
+ ...(takeover.adoptExisting ? { adoptExisting: true as const } : {}),
354
+ });
355
+ if (takeover.adoptExisting) adoptsExisting += 1;
356
+ if (takeover.payloadMatches) {
357
+ adopts += 1;
358
+ } else {
359
+ adoptsWithUpdate += 1;
360
+ updates += 1;
361
+ }
362
+ continue;
363
+ }
364
+ // Before any limit: a member the provider would refuse must not take one
365
+ // of the organization's account slots from a member it would accept.
366
+ if (desired.payloadRefusal !== undefined) {
367
+ refuse(base, FLEET_BLOCKED_BY.invalidPayload, desired.payloadRefusal);
368
+ continue;
369
+ }
234
370
  const onEntity = entityCounts.get(entityKey) ?? 0;
235
371
  if (onEntity >= input.entitlements.monitorsPerEntity) {
236
372
  refuse(base, FLEET_BLOCKED_BY.monitorsPerEntity);
@@ -281,5 +417,8 @@ export function planFleetMembers(input: {
281
417
  retries,
282
418
  unblocked,
283
419
  newRows,
420
+ adopts,
421
+ adoptsWithUpdate,
422
+ adoptsExisting,
284
423
  };
285
424
  }
@@ -2,6 +2,10 @@ import { sha256Hex } from '../plays/row-identity';
2
2
  import { readProvenanceTag } from './log-provenance';
3
3
  import type { PlayRunFailureDetails } from './run-failure';
4
4
  import { emitPlayTelemetry } from './runtime-telemetry';
5
+ import {
6
+ isRuntimeSandboxProviderId,
7
+ type RuntimeSandboxProviderId,
8
+ } from './runtime-sandbox-provider-profile';
5
9
  import {
6
10
  TOOL_CALL_ERROR_ORIGINS,
7
11
  TOOL_CALL_NETWORK_KINDS,
@@ -574,10 +578,31 @@ export function playRunFailureDetailsOf(
574
578
  return typeof code === 'string' ? (first as PlayRunFailureDetails) : null;
575
579
  }
576
580
 
581
+ /**
582
+ * The sandbox provider a runner result proves it ran on (`stats.sandboxProvider`,
583
+ * set by the runner backend that created the sandbox), or null when the
584
+ * result carries none: a failure before any sandbox, or an older runner.
585
+ */
586
+ export function sandboxProviderOfRunnerResult(
587
+ result: unknown,
588
+ ): RuntimeSandboxProviderId | null {
589
+ if (!result || typeof result !== 'object') return null;
590
+ const stats = (result as { stats?: unknown }).stats;
591
+ if (!stats || typeof stats !== 'object') return null;
592
+ const provider = (stats as { sandboxProvider?: unknown }).sandboxProvider;
593
+ return isRuntimeSandboxProviderId(provider) ? provider : null;
594
+ }
595
+
577
596
  /**
578
597
  * One line per run that reached a terminal state: `play.run.finished`.
579
598
  * Emitted by the process that committed the terminal transition, after it
580
599
  * committed, so a run is reported once.
600
+ *
601
+ * `runtimeBackend` is the run's logical lane (its placement policy's
602
+ * compatibility backend), not where it ran: `daytona_modal_canary@1` and
603
+ * `modal_then_daytona@1` are Daytona-lane policies whose runs mostly execute
604
+ * on Modal. `sandboxProvider` is the provider the run's sandbox was actually
605
+ * created on, from the runner's own proof, or null when there is none.
581
606
  */
582
607
  export function emitPlayRunFinished(input: {
583
608
  orgId: string | null;
@@ -587,6 +612,7 @@ export function emitPlayRunFinished(input: {
587
612
  outcome: PlayRunOutcome;
588
613
  failure: PlayRunFailureDetails | null;
589
614
  runtimeBackend: string | null;
615
+ sandboxProvider: RuntimeSandboxProviderId | null;
590
616
  triggerSource: string | null;
591
617
  /** Where the terminal was committed. */
592
618
  committedBy: 'worker' | 'gateway';
@@ -610,6 +636,9 @@ export function emitPlayRunFinished(input: {
610
636
  failureCategory: oneOf(failure?.category, TOOL_CATEGORIES),
611
637
  failureName: token(failure?.name, CLASS_NAME),
612
638
  runtimeBackend: token(input.runtimeBackend, TOKEN),
639
+ sandboxProvider: isRuntimeSandboxProviderId(input.sandboxProvider)
640
+ ? input.sandboxProvider
641
+ : null,
613
642
  triggerSource: token(input.triggerSource, TOKEN),
614
643
  committedBy: input.committedBy,
615
644
  },
@@ -3458,7 +3458,8 @@ async function run(
3458
3458
  settlement.failedRows += failedRows;
3459
3459
  settlement.columns = datasetWrittenColumnOrder({
3460
3460
  contract: sheetContract,
3461
- rows: input.rows,
3461
+ // Completed rows arrive as map outcomes; the row itself is `data`.
3462
+ rows: input.rows.map((row) => row.data),
3462
3463
  outputFields: input.outputFields,
3463
3464
  existing: settlement.columns,
3464
3465
  });
@@ -8383,6 +8383,9 @@ export async function recoverAbsurdRuntimeOverdueDetachedRunnerCeilings(input: {
8383
8383
  outcome: 'failed',
8384
8384
  failure: normalizePlayRunFailure(failedResult.error),
8385
8385
  runtimeBackend: claim.launch.runtimeBackend ?? null,
8386
+ // The detached runner's suspension records where its sandbox was
8387
+ // created; historical records without it are Daytona.
8388
+ sandboxProvider: suspension.sandboxProvider ?? 'daytona',
8386
8389
  triggerSource: claim.launch.triggerSource ?? null,
8387
8390
  committedBy: 'worker',
8388
8391
  });
@@ -311,6 +311,7 @@ import {
311
311
  } from '../runtime-telemetry';
312
312
  import {
313
313
  emitPlayRunFinished,
314
+ sandboxProviderOfRunnerResult,
314
315
  playRunFailureDetailsOf,
315
316
  } from '../durable-summary-events';
316
317
  import { buildAbsurdPlayRunTask } from './absurd-play-run-task';
@@ -1168,8 +1169,17 @@ export function postgresSchedulerNotifyChannel(
1168
1169
  return `${channel.slice(0, 63 - fingerprint.length - 1)}_${fingerprint}`;
1169
1170
  }
1170
1171
  const DEFAULT_POLL_INTERVAL_MS = 1_000;
1172
+ /**
1173
+ * An interactive start stream (`observe({ startupPolling: true })`) reads the
1174
+ * run's terminal state every 250 ms for its first 30 s, then every second.
1175
+ * Most attached runs finish inside that window, so a one-second cadence there
1176
+ * added about 0.5 s on average between the runner's terminal commit and the
1177
+ * stream seeing it. Each read is one primary-key lookup of the run row
1178
+ * (`readPostgresSchedulerResult`), not a claim: at most 90 extra reads per
1179
+ * streamed run (3 a second for 30 s), and none for a run that is not streamed.
1180
+ */
1171
1181
  const STARTUP_TERMINAL_POLL_INTERVAL_MS = 250;
1172
- const STARTUP_TERMINAL_POLL_DURATION_MS = 2_000;
1182
+ const STARTUP_TERMINAL_POLL_DURATION_MS = 30_000;
1173
1183
  const DEFAULT_RESULT_TIMEOUT_MS = 30_000;
1174
1184
 
1175
1185
  const POSTGRES_SCHEDULER_NOT_CONFIGURED_MESSAGE =
@@ -19111,6 +19121,7 @@ export async function executePostgresSchedulerClaim(
19111
19121
  outcome: 'completed',
19112
19122
  failure: null,
19113
19123
  runtimeBackend: claim.launch.runtimeBackend ?? null,
19124
+ sandboxProvider: sandboxProviderOfRunnerResult(output),
19114
19125
  triggerSource: claim.launch.triggerSource ?? null,
19115
19126
  committedBy: 'worker',
19116
19127
  });
@@ -19206,6 +19217,7 @@ export async function executePostgresSchedulerClaim(
19206
19217
  outcome: 'failed',
19207
19218
  failure: playRunFailureDetailsOf(terminalFailureResult),
19208
19219
  runtimeBackend: claim.launch.runtimeBackend ?? null,
19220
+ sandboxProvider: sandboxProviderOfRunnerResult(terminalFailureResult),
19209
19221
  triggerSource: claim.launch.triggerSource ?? null,
19210
19222
  committedBy: 'worker',
19211
19223
  });
@@ -91,7 +91,7 @@ const RUNTIME_EVENT_LOG_POSITION_EXPRESSION = `jsonb_set(
91
91
  // Migration readiness tracks this projection body independently of scheduler
92
92
  // wire and schema versions. Bump when a changed trigger must be reinstalled.
93
93
  export const RUNTIME_EVENT_SEARCH_OUTBOX_PROJECTION_MARKER =
94
- 'runtime-event-search-epoch-resume-lifecycle-reuse';
94
+ 'runtime-event-search-epoch-resume-lifecycle-reuse-dataset-columns';
95
95
  /** Trusted trigger-authored state; absent on already-projected legacy rows. */
96
96
  export const RUNTIME_EVENT_DEFERRED_PROJECTION_FIELD =
97
97
  '_runtimeSearchProjectionPending';
@@ -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 _chunk3NG43NXBjs = require('./chunk-3NG43NXB.js');
18
+ require('./chunk-G5TV6WLV.js');
19
+ require('./chunk-CJ7DBYEQ.js');
20
+ require('./chunk-YRQKRQDU.js');
21
+ require('./chunk-2GJZLIKW.js');
22
+ require('./chunk-XNYIZMNQ.js');
23
+ require('./chunk-BBTKAASQ.js');
24
+ require('./chunk-C6XYSTBW.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 = _chunk3NG43NXBjs.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunk3NG43NXBjs.authStatusLine; exports.clearPendingClaim = _chunk3NG43NXBjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunk3NG43NXBjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunk3NG43NXBjs.handleRegister; exports.handleStatus = _chunk3NG43NXBjs.handleStatus; exports.handleWait = _chunk3NG43NXBjs.handleWait; exports.httpJson = _chunk3NG43NXBjs.httpJson; exports.readPendingAuthClaim = _chunk3NG43NXBjs.readPendingAuthClaim; exports.readStatusBanner = _chunk3NG43NXBjs.readStatusBanner; exports.registerAuthCommands = _chunk3NG43NXBjs.registerAuthCommands; exports.reportApprovalLinkShown = _chunk3NG43NXBjs.reportApprovalLinkShown; exports.reportSetupCompleted = _chunk3NG43NXBjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunk3NG43NXBjs.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunk3NG43NXBjs.statusBannerLine;
@@ -14,14 +14,14 @@ import {
14
14
  reportSetupCompleted,
15
15
  resolvePendingAuthClaimForResume,
16
16
  statusBannerLine
17
- } from "./chunk-W2OPPSAZ.mjs";
18
- import "./chunk-DH43ECTN.mjs";
19
- import "./chunk-R57UCXQG.mjs";
20
- import "./chunk-JXG7HWBA.mjs";
17
+ } from "./chunk-Z7QM244Q.mjs";
18
+ import "./chunk-JL5JU3LD.mjs";
19
+ import "./chunk-7MFATEUC.mjs";
20
+ import "./chunk-3M2QH3KA.mjs";
21
21
  import "./chunk-CQBIO6HW.mjs";
22
22
  import "./chunk-DLIRSHV6.mjs";
23
23
  import "./chunk-JL2OTMSG.mjs";
24
- import "./chunk-ZRT2PNYY.mjs";
24
+ import "./chunk-52C6W7FG.mjs";
25
25
  import "./chunk-WZYKRD7T.mjs";
26
26
  import "./chunk-KRD6H754.mjs";
27
27
  export {