rivetkit 0.0.0-sqlite-uds.37f9e48 → 0.0.0-sqlite-profiling-compat.4a9a623

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/browser/client.d.ts +28 -23
  2. package/dist/browser/client.js +6 -9
  3. package/dist/browser/client.js.map +1 -1
  4. package/dist/browser/inspector/client.d.ts +2 -22
  5. package/dist/browser/inspector/client.js +222 -996
  6. package/dist/browser/inspector/client.js.map +1 -1
  7. package/dist/tsup/actor/errors.cjs.map +1 -1
  8. package/dist/tsup/agent-os/index.cjs +34 -104
  9. package/dist/tsup/agent-os/index.cjs.map +1 -1
  10. package/dist/tsup/agent-os/index.d.cts +28 -23
  11. package/dist/tsup/agent-os/index.d.ts +28 -23
  12. package/dist/tsup/agent-os/index.js +36 -106
  13. package/dist/tsup/agent-os/index.js.map +1 -1
  14. package/dist/tsup/{chunk-UEDIZR2M.cjs → chunk-2CICCOBL.cjs} +4 -24
  15. package/dist/tsup/chunk-2CICCOBL.cjs.map +1 -0
  16. package/dist/tsup/{chunk-PVR4LVX2.cjs → chunk-2WMYYG4R.cjs} +10 -18
  17. package/dist/tsup/chunk-2WMYYG4R.cjs.map +1 -0
  18. package/dist/tsup/{chunk-HTREBONF.cjs → chunk-3MHDOUD7.cjs} +1 -6
  19. package/dist/tsup/chunk-3MHDOUD7.cjs.map +1 -0
  20. package/dist/tsup/chunk-4FC7TVS6.cjs.map +1 -1
  21. package/dist/tsup/{chunk-DB45WHMU.js → chunk-4PX3ZKJR.js} +3 -3
  22. package/dist/tsup/{chunk-FFJXFXEW.js → chunk-75UE45DE.js} +7 -11
  23. package/dist/tsup/chunk-75UE45DE.js.map +1 -0
  24. package/dist/tsup/{chunk-MFLAOS2S.cjs → chunk-7QKCGUTJ.cjs} +8 -12
  25. package/dist/tsup/chunk-7QKCGUTJ.cjs.map +1 -0
  26. package/dist/tsup/{chunk-2EYF7KY7.js → chunk-AGDY6TKH.js} +7 -7
  27. package/dist/tsup/{chunk-UEYBIN52.js → chunk-IICIOTML.js} +2 -2
  28. package/dist/tsup/{chunk-AGWIB6VG.cjs → chunk-ND567FR5.cjs} +3 -3
  29. package/dist/tsup/chunk-ND567FR5.cjs.map +1 -0
  30. package/dist/tsup/{chunk-OSQX3QN2.cjs → chunk-NHUTYWKU.cjs} +141 -141
  31. package/dist/tsup/chunk-NHUTYWKU.cjs.map +1 -0
  32. package/dist/tsup/{chunk-42H5OK5Z.cjs → chunk-QAVN4QNO.cjs} +7 -7
  33. package/dist/tsup/chunk-QAVN4QNO.cjs.map +1 -0
  34. package/dist/tsup/{chunk-Q3ODMSBE.js → chunk-RIT7N3TX.js} +2 -22
  35. package/dist/tsup/chunk-RIT7N3TX.js.map +1 -0
  36. package/dist/tsup/{chunk-LIEQDMZ6.cjs → chunk-RV5MAFDT.cjs} +5 -5
  37. package/dist/tsup/chunk-RV5MAFDT.cjs.map +1 -0
  38. package/dist/tsup/chunk-VE2X4KMG.cjs.map +1 -1
  39. package/dist/tsup/{chunk-E4X3JSN7.js → chunk-XFYEVYHG.js} +4 -12
  40. package/dist/tsup/chunk-XFYEVYHG.js.map +1 -0
  41. package/dist/tsup/{chunk-D2JJWLWM.js → chunk-XHGDS3DZ.js} +2 -2
  42. package/dist/tsup/{chunk-ARD7UMSN.js → chunk-XIX5DOZN.js} +1 -6
  43. package/dist/tsup/chunk-XIX5DOZN.js.map +1 -0
  44. package/dist/tsup/chunk-ZA7FLHKH.cjs.map +1 -1
  45. package/dist/tsup/client/mod.cjs +7 -7
  46. package/dist/tsup/client/mod.cjs.map +1 -1
  47. package/dist/tsup/client/mod.d.cts +3 -3
  48. package/dist/tsup/client/mod.d.ts +3 -3
  49. package/dist/tsup/client/mod.js +6 -6
  50. package/dist/tsup/common/log.cjs +2 -4
  51. package/dist/tsup/common/log.cjs.map +1 -1
  52. package/dist/tsup/common/log.d.cts +1 -5
  53. package/dist/tsup/common/log.d.ts +1 -5
  54. package/dist/tsup/common/log.js +3 -5
  55. package/dist/tsup/common/websocket.cjs +3 -3
  56. package/dist/tsup/common/websocket.cjs.map +1 -1
  57. package/dist/tsup/common/websocket.js +2 -2
  58. package/dist/tsup/{config-DLOxy81E.d.cts → config-B0LNDrLY.d.cts} +25 -5
  59. package/dist/tsup/{config-DLOxy81E.d.ts → config-B0LNDrLY.d.ts} +25 -5
  60. package/dist/tsup/{config-BkLXikR2.d.ts → config-BR1Nn0QQ.d.ts} +5 -24
  61. package/dist/tsup/{config-BARPNFvr.d.cts → config-tCvkwzyN.d.cts} +5 -24
  62. package/dist/tsup/{context-DntnH005.d.ts → context-D4WDwf9m.d.cts} +2 -3
  63. package/dist/tsup/{context-A16ymKhK.d.cts → context-oc9zhA3x.d.ts} +2 -3
  64. package/dist/tsup/db/drizzle.cjs +72 -144
  65. package/dist/tsup/db/drizzle.cjs.map +1 -1
  66. package/dist/tsup/db/drizzle.d.cts +2 -4
  67. package/dist/tsup/db/drizzle.d.ts +2 -4
  68. package/dist/tsup/db/drizzle.js +72 -144
  69. package/dist/tsup/db/drizzle.js.map +1 -1
  70. package/dist/tsup/db/mod.cjs +28 -90
  71. package/dist/tsup/db/mod.cjs.map +1 -1
  72. package/dist/tsup/db/mod.d.cts +8 -4
  73. package/dist/tsup/db/mod.d.ts +8 -4
  74. package/dist/tsup/db/mod.js +28 -90
  75. package/dist/tsup/db/mod.js.map +1 -1
  76. package/dist/tsup/dynamic/mod.cjs +2 -2
  77. package/dist/tsup/dynamic/mod.cjs.map +1 -1
  78. package/dist/tsup/dynamic/mod.d.cts +2 -2
  79. package/dist/tsup/dynamic/mod.d.ts +2 -2
  80. package/dist/tsup/dynamic/mod.js +1 -1
  81. package/dist/tsup/inspector/mod.cjs +11 -46
  82. package/dist/tsup/inspector/mod.cjs.map +1 -1
  83. package/dist/tsup/inspector/mod.d.cts +15 -37
  84. package/dist/tsup/inspector/mod.d.ts +15 -37
  85. package/dist/tsup/inspector/mod.js +10 -45
  86. package/dist/tsup/inspector/mod.js.map +1 -1
  87. package/dist/tsup/inspector-tab/mod.cjs +13 -2
  88. package/dist/tsup/inspector-tab/mod.cjs.map +1 -1
  89. package/dist/tsup/inspector-tab/mod.d.cts +14 -4
  90. package/dist/tsup/inspector-tab/mod.d.ts +14 -4
  91. package/dist/tsup/inspector-tab/mod.js +12 -1
  92. package/dist/tsup/inspector-tab/mod.js.map +1 -1
  93. package/dist/tsup/mod.cjs +91 -189
  94. package/dist/tsup/mod.cjs.map +1 -1
  95. package/dist/tsup/mod.d.cts +4 -4
  96. package/dist/tsup/mod.d.ts +4 -4
  97. package/dist/tsup/mod.js +25 -123
  98. package/dist/tsup/mod.js.map +1 -1
  99. package/dist/tsup/test/mod.cjs +10 -10
  100. package/dist/tsup/test/mod.cjs.map +1 -1
  101. package/dist/tsup/test/mod.d.cts +2 -2
  102. package/dist/tsup/test/mod.d.ts +2 -2
  103. package/dist/tsup/test/mod.js +6 -6
  104. package/dist/tsup/utils.cjs +2 -2
  105. package/dist/tsup/utils.cjs.map +1 -1
  106. package/dist/tsup/utils.js +1 -1
  107. package/dist/tsup/workflow/mod.cjs +11 -14
  108. package/dist/tsup/workflow/mod.cjs.map +1 -1
  109. package/dist/tsup/workflow/mod.d.cts +4 -4
  110. package/dist/tsup/workflow/mod.d.ts +4 -4
  111. package/dist/tsup/workflow/mod.js +5 -8
  112. package/dist/tsup/workflow/mod.js.map +1 -1
  113. package/package.json +14 -9
  114. package/src/actor/config.ts +0 -10
  115. package/src/common/bare/transport/v1.ts +0 -36
  116. package/src/common/database/config.ts +24 -19
  117. package/src/common/database/mod.test.ts +2 -96
  118. package/src/common/database/mod.ts +38 -102
  119. package/src/common/database/native-database.ts +4 -19
  120. package/src/common/log.ts +8 -14
  121. package/src/db/drizzle.ts +86 -187
  122. package/src/db/mod.ts +1 -0
  123. package/src/inspector/client.browser.ts +16 -73
  124. package/src/inspector/mod.ts +1 -1
  125. package/src/inspector-tab/mod.ts +15 -0
  126. package/src/registry/index.ts +0 -4
  127. package/src/registry/napi-runtime.ts +1 -25
  128. package/src/registry/native.ts +13 -95
  129. package/src/registry/runtime.ts +6 -18
  130. package/src/registry/wasm-runtime.ts +0 -22
  131. package/src/workflow/context.ts +0 -4
  132. package/src/workflow/inspector.ts +0 -8
  133. package/dist/tsup/chunk-42H5OK5Z.cjs.map +0 -1
  134. package/dist/tsup/chunk-AGWIB6VG.cjs.map +0 -1
  135. package/dist/tsup/chunk-ARD7UMSN.js.map +0 -1
  136. package/dist/tsup/chunk-E4X3JSN7.js.map +0 -1
  137. package/dist/tsup/chunk-FFJXFXEW.js.map +0 -1
  138. package/dist/tsup/chunk-HTREBONF.cjs.map +0 -1
  139. package/dist/tsup/chunk-LIEQDMZ6.cjs.map +0 -1
  140. package/dist/tsup/chunk-MFLAOS2S.cjs.map +0 -1
  141. package/dist/tsup/chunk-OSQX3QN2.cjs.map +0 -1
  142. package/dist/tsup/chunk-PVR4LVX2.cjs.map +0 -1
  143. package/dist/tsup/chunk-Q3ODMSBE.js.map +0 -1
  144. package/dist/tsup/chunk-UEDIZR2M.cjs.map +0 -1
  145. package/src/actor/config.test.ts +0 -11
  146. package/src/common/bare/generated/actor-uds-protocol/v1.ts +0 -802
  147. package/src/common/bare/generated/inspector/v5.ts +0 -1016
  148. /package/dist/tsup/{chunk-DB45WHMU.js.map → chunk-4PX3ZKJR.js.map} +0 -0
  149. /package/dist/tsup/{chunk-2EYF7KY7.js.map → chunk-AGDY6TKH.js.map} +0 -0
  150. /package/dist/tsup/{chunk-UEYBIN52.js.map → chunk-IICIOTML.js.map} +0 -0
  151. /package/dist/tsup/{chunk-D2JJWLWM.js.map → chunk-XHGDS3DZ.js.map} +0 -0
package/src/db/drizzle.ts CHANGED
@@ -28,17 +28,8 @@ export {
28
28
  } from "drizzle-orm/sqlite-core";
29
29
 
30
30
  type DrizzleSchema = Record<string, unknown>;
31
- type DrizzleDatabase<TSchema extends DrizzleSchema> = Omit<
32
- SqliteRemoteDatabase<TSchema>,
33
- "transaction"
34
- > &
35
- Omit<RawAccess, "transaction"> & {
36
- transaction: <T>(
37
- callback: (tx: DrizzleDatabase<TSchema>) => Promise<T> | T,
38
- ) => Promise<T>;
39
- };
40
-
41
- const MIGRATION_LEASE_TIMEOUT_MS = 60_000;
31
+ type DrizzleDatabase<TSchema extends DrizzleSchema> =
32
+ SqliteRemoteDatabase<TSchema> & RawAccess;
42
33
 
43
34
  interface DrizzleMigrationJournalEntry {
44
35
  idx: number;
@@ -99,7 +90,6 @@ export function db<TSchema extends DrizzleSchema = Record<string, never>>({
99
90
 
100
91
  const nativeDb = await nativeDatabaseProvider.open(ctx.actorId);
101
92
  let closed = false;
102
- let transactionActive = false;
103
93
  const ensureOpen = () => {
104
94
  if (closed) {
105
95
  throw new Error(
@@ -108,192 +98,107 @@ export function db<TSchema extends DrizzleSchema = Record<string, never>>({
108
98
  }
109
99
  };
110
100
 
111
- const createDrizzleClient = (lease?: {
112
- key: string;
113
- timeoutMs?: number;
114
- }): DrizzleDatabase<TSchema> => {
115
- const runSql = async (
116
- query: string,
117
- params: unknown[],
118
- method: "run" | "all" | "values" | "get",
119
- ) => {
120
- ensureOpen();
121
- if (!lease && transactionActive) {
122
- throw new Error(
123
- "Use the tx argument inside db.transaction(); the outer database client cannot run work from the transaction callback.",
124
- );
125
- }
126
-
127
- const start = performance.now();
128
- const kvReadsBefore = ctx.metrics?.totalKvReads ?? 0;
129
- const kvWritesBefore = ctx.metrics?.totalKvWrites ?? 0;
130
- try {
131
- const { rows } = await nativeDb.execute(
132
- query,
133
- toSqliteBindings(params),
134
- lease,
135
- );
136
- if (method === "run") {
137
- return { rows: [] };
138
- }
139
- if (method === "get") {
140
- return { rows: rows[0] };
141
- }
142
- return { rows };
143
- } finally {
144
- const durationMs = performance.now() - start;
145
- ctx.metrics?.trackSql(query, durationMs);
146
- if (ctx.metrics) {
147
- ctx.log?.debug({
148
- msg: "sql query",
149
- query: query.slice(0, 120),
150
- durationMs,
151
- kvReads:
152
- ctx.metrics.totalKvReads - kvReadsBefore,
153
- kvWrites:
154
- ctx.metrics.totalKvWrites - kvWritesBefore,
155
- });
156
- }
157
- }
158
- };
101
+ const runSql = async (
102
+ query: string,
103
+ params: unknown[],
104
+ method: "run" | "all" | "values" | "get",
105
+ ) => {
106
+ ensureOpen();
159
107
 
160
- const callback: RemoteCallback = async (
161
- query,
162
- params,
163
- method,
164
- ) => {
165
- return await runSql(query, params, method);
166
- };
167
-
168
- const drizzleDb = drizzle(callback, {
169
- schema,
170
- }) as unknown as DrizzleDatabase<TSchema>;
171
- drizzleDb.execute = async <
172
- TRow extends Record<string, unknown> = Record<
173
- string,
174
- unknown
175
- >,
176
- >(
177
- query: string,
178
- ...args: unknown[]
179
- ): Promise<TRow[]> => {
180
- return await executeRaw<TRow>(
181
- nativeDb,
182
- ctx,
183
- ensureOpen,
108
+ const start = performance.now();
109
+ const kvReadsBefore = ctx.metrics?.totalKvReads ?? 0;
110
+ const kvWritesBefore = ctx.metrics?.totalKvWrites ?? 0;
111
+ try {
112
+ const { rows } = await nativeDb.execute(
184
113
  query,
185
- args,
186
- lease,
114
+ toSqliteBindings(params),
187
115
  );
188
- };
189
- drizzleDb.transaction = async <T>(
190
- transactionCallback: (
191
- tx: DrizzleDatabase<TSchema>,
192
- ) => Promise<T> | T,
193
- ): Promise<T> => {
194
- if (lease || transactionActive) {
195
- throw new Error(
196
- "Nested or concurrent db.transaction() calls are not supported.",
197
- );
116
+ if (method === "run") {
117
+ return { rows: [] };
198
118
  }
199
- const transactionLease = { key: crypto.randomUUID() };
200
- const tx = createDrizzleClient(transactionLease);
201
- await nativeDb.execute(
202
- "BEGIN",
203
- undefined,
204
- transactionLease,
205
- );
206
- transactionActive = true;
207
- try {
208
- const result = await transactionCallback(tx);
209
- await nativeDb.execute(
210
- "COMMIT",
211
- undefined,
212
- transactionLease,
213
- );
214
- return result;
215
- } catch (error) {
216
- try {
217
- await nativeDb.execute(
218
- "ROLLBACK",
219
- undefined,
220
- transactionLease,
221
- );
222
- } catch {
223
- // Preserve the callback or commit error after lease poisoning.
224
- }
225
- throw error;
226
- } finally {
227
- transactionActive = false;
119
+ if (method === "get") {
120
+ return { rows: rows[0] };
228
121
  }
229
- };
230
- drizzleDb.__withSqliteLease = async <T>(
231
- timeoutMs: number,
232
- leaseCallback: (leased: RawAccess) => Promise<T> | T,
233
- ): Promise<T> => {
234
- const internalLease = {
235
- key: crypto.randomUUID(),
236
- timeoutMs,
237
- };
238
- return await leaseCallback(
239
- createDrizzleClient(internalLease),
240
- );
241
- };
242
- drizzleDb.close = async () => {
243
- if (!closed) {
244
- closed = true;
245
- await nativeDb.close();
122
+ return { rows };
123
+ } finally {
124
+ const durationMs = performance.now() - start;
125
+ ctx.metrics?.trackSql(query, durationMs);
126
+ if (ctx.metrics) {
127
+ ctx.log?.debug({
128
+ msg: "sql query",
129
+ query: query.slice(0, 120),
130
+ durationMs,
131
+ kvReads: ctx.metrics.totalKvReads - kvReadsBefore,
132
+ kvWrites:
133
+ ctx.metrics.totalKvWrites - kvWritesBefore,
134
+ });
246
135
  }
247
- };
136
+ }
137
+ };
248
138
 
249
- return drizzleDb;
139
+ const callback: RemoteCallback = async (query, params, method) => {
140
+ return await runSql(query, params, method);
250
141
  };
251
142
 
252
- return createDrizzleClient();
143
+ const drizzleDb = drizzle(callback, {
144
+ schema,
145
+ }) as DrizzleDatabase<TSchema>;
146
+ drizzleDb.execute = async <
147
+ TRow extends Record<string, unknown> = Record<string, unknown>,
148
+ >(
149
+ query: string,
150
+ ...args: unknown[]
151
+ ): Promise<TRow[]> => {
152
+ return await executeRaw<TRow>(
153
+ nativeDb,
154
+ ctx,
155
+ ensureOpen,
156
+ query,
157
+ args,
158
+ );
159
+ };
160
+ drizzleDb.close = async () => {
161
+ if (!closed) {
162
+ closed = true;
163
+ await nativeDb.close();
164
+ }
165
+ };
166
+
167
+ return drizzleDb;
253
168
  },
254
169
  onMigrate: async (client) => {
255
170
  if (!migrations && !onMigrate) {
256
171
  return;
257
172
  }
258
- await withMigrationSavepoint(client, async (leased) => {
173
+ await withMigrationSavepoint(client, async () => {
259
174
  if (migrations) {
260
- await runMigrations(leased, migrations);
175
+ await runMigrations(client, migrations);
261
176
  }
262
177
  if (onMigrate) {
263
- await onMigrate(leased);
178
+ await onMigrate(client);
264
179
  }
265
180
  });
266
181
  },
267
182
  };
268
183
  }
269
184
 
270
- async function withMigrationSavepoint<TSchema extends DrizzleSchema, T>(
271
- client: DrizzleDatabase<TSchema>,
272
- callback: (leased: DrizzleDatabase<TSchema>) => Promise<T> | T,
185
+ async function withMigrationSavepoint<T>(
186
+ client: RawAccess,
187
+ callback: () => Promise<T> | T,
273
188
  ): Promise<T> {
274
- return await client.__withSqliteLease(
275
- MIGRATION_LEASE_TIMEOUT_MS,
276
- async (leasedAccess) => {
277
- const leased = leasedAccess as DrizzleDatabase<TSchema>;
278
- await leased.execute("SAVEPOINT __rivet_on_migrate");
279
- try {
280
- const result = await callback(leased);
281
- await leased.execute("RELEASE SAVEPOINT __rivet_on_migrate");
282
- return result;
283
- } catch (error) {
284
- try {
285
- await leased.execute(
286
- "ROLLBACK TO SAVEPOINT __rivet_on_migrate",
287
- );
288
- } finally {
289
- await leased.execute(
290
- "RELEASE SAVEPOINT __rivet_on_migrate",
291
- );
292
- }
293
- throw error;
294
- }
295
- },
296
- );
189
+ await client.execute("SAVEPOINT __rivet_on_migrate");
190
+ try {
191
+ const result = await callback();
192
+ await client.execute("RELEASE SAVEPOINT __rivet_on_migrate");
193
+ return result;
194
+ } catch (error) {
195
+ try {
196
+ await client.execute("ROLLBACK TO SAVEPOINT __rivet_on_migrate");
197
+ } finally {
198
+ await client.execute("RELEASE SAVEPOINT __rivet_on_migrate");
199
+ }
200
+ throw error;
201
+ }
297
202
  }
298
203
 
299
204
  async function runMigrations<TSchema extends DrizzleSchema>(
@@ -381,7 +286,6 @@ async function executeRaw<TRow extends Record<string, unknown>>(
381
286
  ensureOpen: () => void,
382
287
  query: string,
383
288
  args: unknown[],
384
- lease?: { key: string; timeoutMs?: number },
385
289
  ): Promise<TRow[]> {
386
290
  ensureOpen();
387
291
 
@@ -393,28 +297,23 @@ async function executeRaw<TRow extends Record<string, unknown>>(
393
297
  const { rows, columns } = await db.execute(
394
298
  query,
395
299
  toSqliteBindings(args),
396
- lease,
397
300
  );
398
301
  return rows.map((row) => rowToObject<TRow>(row, columns));
399
302
  }
400
303
 
401
304
  if (!hasMultipleStatements(query)) {
402
- const { rows, columns } = await db.execute(query, undefined, lease);
305
+ const { rows, columns } = await db.execute(query);
403
306
  return rows.map((row) => rowToObject<TRow>(row, columns));
404
307
  }
405
308
 
406
309
  const results: Record<string, unknown>[] = [];
407
310
  let columnNames: string[] | null = null;
408
- await db.exec(
409
- query,
410
- (row, columns) => {
411
- if (!columnNames) {
412
- columnNames = columns;
413
- }
414
- results.push(rowToObject(row, columnNames));
415
- },
416
- lease,
417
- );
311
+ await db.exec(query, (row, columns) => {
312
+ if (!columnNames) {
313
+ columnNames = columns;
314
+ }
315
+ results.push(rowToObject(row, columnNames));
316
+ });
418
317
  return results as TRow[];
419
318
  } finally {
420
319
  const durationMs = performance.now() - start;
package/src/db/mod.ts CHANGED
@@ -8,6 +8,7 @@ export type {
8
8
  SqliteBindings,
9
9
  SqliteDatabase,
10
10
  SqliteNativeMetrics,
11
+ SqliteProfilingOptions,
11
12
  SqliteQueryResult,
12
13
  } from "@/common/database/config";
13
14
  export { db } from "@/common/database/mod";
@@ -3,17 +3,16 @@ import * as v1 from "@/common/bare/generated/inspector/v1";
3
3
  import * as v2 from "@/common/bare/generated/inspector/v2";
4
4
  import * as v3 from "@/common/bare/generated/inspector/v3";
5
5
  import * as v4 from "@/common/bare/generated/inspector/v4";
6
- import * as v5 from "@/common/bare/generated/inspector/v5";
7
6
  import {
8
7
  decodeWorkflowHistoryTransport,
9
8
  encodeWorkflowHistoryTransport,
10
9
  } from "@/common/inspector-transport";
11
10
 
12
- export * from "@/common/bare/generated/inspector/v5";
11
+ export * from "@/common/bare/generated/inspector/v4";
13
12
  export { decodeWorkflowHistoryTransport, encodeWorkflowHistoryTransport };
14
13
  export type { WorkflowHistory as TransportWorkflowHistory } from "@/common/bare/transport/v1";
15
14
 
16
- export const CURRENT_VERSION = 5;
15
+ export const CURRENT_VERSION = 4;
17
16
 
18
17
  const EVENTS_DROPPED_ERROR = "inspector.events_dropped";
19
18
  const WORKFLOW_HISTORY_DROPPED_ERROR = "inspector.workflow_history_dropped";
@@ -157,42 +156,6 @@ const v4ToClientToV3 = (v4Data: v4.ToClient): v3.ToClient => {
157
156
  return v4Data as unknown as v3.ToClient;
158
157
  };
159
158
 
160
- const v4ToClientToV5 = (v4Data: v4.ToClient): v5.ToClient => {
161
- if (v4Data.body.tag === "Init") {
162
- // A v4 runtime predates tab config in Init; default to an empty list.
163
- // The client reads that as "no custom tabs" (built-in tabs only).
164
- const init = v4Data.body.val;
165
- return {
166
- body: {
167
- tag: "Init",
168
- val: { ...init, tabConfig: [] },
169
- },
170
- };
171
- }
172
-
173
- return v4Data as unknown as v5.ToClient;
174
- };
175
-
176
- const v5ToClientToV4 = (v5Data: v5.ToClient): v4.ToClient => {
177
- if (v5Data.body.tag === "Init") {
178
- const { tabConfig: _tabConfig, ...rest } = v5Data.body.val;
179
- return {
180
- body: {
181
- tag: "Init",
182
- val: rest,
183
- },
184
- };
185
- }
186
-
187
- return v5Data as unknown as v4.ToClient;
188
- };
189
-
190
- const v4ToServerToV5 = (v4Data: v4.ToServer): v5.ToServer =>
191
- v4Data as unknown as v5.ToServer;
192
-
193
- const v5ToServerToV4 = (v5Data: v5.ToServer): v4.ToServer =>
194
- v5Data as unknown as v4.ToServer;
195
-
196
159
  const v1ToServerToV2 = (v1Data: v1.ToServer): v2.ToServer => {
197
160
  if (
198
161
  v1Data.body.tag === "EventsRequest" ||
@@ -243,7 +206,7 @@ const v4ToServerToV3 = (v4Data: v4.ToServer): v3.ToServer => {
243
206
  return v4Data as unknown as v3.ToServer;
244
207
  };
245
208
 
246
- export const TO_SERVER_VERSIONED = createVersionedDataHandler<v5.ToServer>({
209
+ export const TO_SERVER_VERSIONED = createVersionedDataHandler<v4.ToServer>({
247
210
  serializeVersion: (data, version) => {
248
211
  switch (version) {
249
212
  case 1:
@@ -253,9 +216,7 @@ export const TO_SERVER_VERSIONED = createVersionedDataHandler<v5.ToServer>({
253
216
  case 3:
254
217
  return v3.encodeToServer(data as unknown as v3.ToServer);
255
218
  case 4:
256
- return v4.encodeToServer(data as unknown as v4.ToServer);
257
- case 5:
258
- return v5.encodeToServer(data);
219
+ return v4.encodeToServer(data);
259
220
  default:
260
221
  throw new Error(`Unknown version ${version}`);
261
222
  }
@@ -263,15 +224,13 @@ export const TO_SERVER_VERSIONED = createVersionedDataHandler<v5.ToServer>({
263
224
  deserializeVersion: (bytes, version) => {
264
225
  switch (version) {
265
226
  case 1:
266
- return v1.decodeToServer(bytes) as unknown as v5.ToServer;
227
+ return v1.decodeToServer(bytes) as unknown as v4.ToServer;
267
228
  case 2:
268
- return v2.decodeToServer(bytes) as unknown as v5.ToServer;
229
+ return v2.decodeToServer(bytes) as unknown as v4.ToServer;
269
230
  case 3:
270
- return v3.decodeToServer(bytes) as unknown as v5.ToServer;
231
+ return v3.decodeToServer(bytes) as unknown as v4.ToServer;
271
232
  case 4:
272
- return v4.decodeToServer(bytes) as unknown as v5.ToServer;
273
- case 5:
274
- return v5.decodeToServer(bytes);
233
+ return v4.decodeToServer(bytes);
275
234
  default:
276
235
  throw new Error(`Unknown version ${version}`);
277
236
  }
@@ -280,17 +239,11 @@ export const TO_SERVER_VERSIONED = createVersionedDataHandler<v5.ToServer>({
280
239
  v1ToServerToV2,
281
240
  v2ToServerToV3,
282
241
  v3ToServerToV4,
283
- v4ToServerToV5,
284
- ],
285
- serializeConverters: () => [
286
- v5ToServerToV4,
287
- v4ToServerToV3,
288
- v3ToServerToV2,
289
- v2ToServerToV1,
290
242
  ],
243
+ serializeConverters: () => [v4ToServerToV3, v3ToServerToV2, v2ToServerToV1],
291
244
  });
292
245
 
293
- export const TO_CLIENT_VERSIONED = createVersionedDataHandler<v5.ToClient>({
246
+ export const TO_CLIENT_VERSIONED = createVersionedDataHandler<v4.ToClient>({
294
247
  serializeVersion: (data, version) => {
295
248
  switch (version) {
296
249
  case 1:
@@ -300,9 +253,7 @@ export const TO_CLIENT_VERSIONED = createVersionedDataHandler<v5.ToClient>({
300
253
  case 3:
301
254
  return v3.encodeToClient(data as unknown as v3.ToClient);
302
255
  case 4:
303
- return v4.encodeToClient(data as unknown as v4.ToClient);
304
- case 5:
305
- return v5.encodeToClient(data);
256
+ return v4.encodeToClient(data);
306
257
  default:
307
258
  throw new Error(`Unknown version ${version}`);
308
259
  }
@@ -310,15 +261,13 @@ export const TO_CLIENT_VERSIONED = createVersionedDataHandler<v5.ToClient>({
310
261
  deserializeVersion: (bytes, version) => {
311
262
  switch (version) {
312
263
  case 1:
313
- return v1.decodeToClient(bytes) as unknown as v5.ToClient;
264
+ return v1.decodeToClient(bytes) as unknown as v4.ToClient;
314
265
  case 2:
315
- return v2.decodeToClient(bytes) as unknown as v5.ToClient;
266
+ return v2.decodeToClient(bytes) as unknown as v4.ToClient;
316
267
  case 3:
317
- return v3.decodeToClient(bytes) as unknown as v5.ToClient;
268
+ return v3.decodeToClient(bytes) as unknown as v4.ToClient;
318
269
  case 4:
319
- return v4.decodeToClient(bytes) as unknown as v5.ToClient;
320
- case 5:
321
- return v5.decodeToClient(bytes);
270
+ return v4.decodeToClient(bytes);
322
271
  default:
323
272
  throw new Error(`Unknown version ${version}`);
324
273
  }
@@ -327,12 +276,6 @@ export const TO_CLIENT_VERSIONED = createVersionedDataHandler<v5.ToClient>({
327
276
  v1ToClientToV2,
328
277
  v2ToClientToV3,
329
278
  v3ToClientToV4,
330
- v4ToClientToV5,
331
- ],
332
- serializeConverters: () => [
333
- v5ToClientToV4,
334
- v4ToClientToV3,
335
- v3ToClientToV2,
336
- v2ToClientToV1,
337
279
  ],
280
+ serializeConverters: () => [v4ToClientToV3, v3ToClientToV2, v2ToClientToV1],
338
281
  });
@@ -1,4 +1,4 @@
1
- export * from "@/common/bare/generated/inspector/v5";
1
+ export * from "@/common/bare/generated/inspector/v4";
2
2
  export type { WorkflowHistory as TransportWorkflowHistory } from "@/common/bare/transport/v1";
3
3
  export {
4
4
  decodeWorkflowHistoryTransport,
@@ -280,6 +280,18 @@ export const InspectorQueueResponseSchema = z.object({
280
280
  messages: z.array(InspectorQueueMessageSchema),
281
281
  });
282
282
 
283
+ /** `GET /inspector/tab-config` response shape. */
284
+ export const InspectorTabConfigResponseSchema = z.object({
285
+ tabs: z.array(
286
+ z.object({
287
+ id: z.string(),
288
+ label: z.string().optional(),
289
+ icon: z.string().nullable().optional(),
290
+ hidden: z.boolean().optional(),
291
+ }),
292
+ ),
293
+ });
294
+
283
295
  export type InspectorStateResponse = z.infer<
284
296
  typeof InspectorStateResponseSchema
285
297
  >;
@@ -298,3 +310,6 @@ export type InspectorQueueMessage = z.infer<typeof InspectorQueueMessageSchema>;
298
310
  export type InspectorQueueResponse = z.infer<
299
311
  typeof InspectorQueueResponseSchema
300
312
  >;
313
+ export type InspectorTabConfigResponse = z.infer<
314
+ typeof InspectorTabConfigResponseSchema
315
+ >;
@@ -1,5 +1,4 @@
1
1
  import { isLocalEngineEndpoint } from "@/common/engine";
2
- import { configureBaseLogger } from "@/common/log";
3
2
  import { configureServerlessPool } from "@/serverless/configure";
4
3
  import { VERSION } from "@/utils";
5
4
  import {
@@ -83,9 +82,6 @@ export class Registry<A extends RegistryActors> {
83
82
 
84
83
  constructor(config: RegistryConfigInput<A>, deps?: Partial<RegistryDeps>) {
85
84
  this.#config = config;
86
- if (config.logging?.baseLogger) {
87
- configureBaseLogger(config.logging.baseLogger);
88
- }
89
85
  this.#buildConfiguredRegistry =
90
86
  deps?.buildConfiguredRegistry ?? buildConfiguredRegistry;
91
87
  this.routes = {
@@ -34,7 +34,6 @@ import type {
34
34
  RuntimeSqlBindParams,
35
35
  RuntimeSqlExecResult,
36
36
  RuntimeSqlExecuteResult,
37
- RuntimeSqlLeaseOptions,
38
37
  RuntimeSqlQueryResult,
39
38
  RuntimeSqlRunResult,
40
39
  RuntimeStateDeltaPayload,
@@ -599,26 +598,18 @@ export class NapiCoreRuntime implements CoreRuntime {
599
598
  async actorSqlExec(
600
599
  ctx: ActorContextHandle,
601
600
  sql: string,
602
- lease?: RuntimeSqlLeaseOptions,
603
601
  ): Promise<RuntimeSqlExecResult> {
604
- return await this.#actorSql(ctx).exec(
605
- sql,
606
- lease?.key,
607
- lease?.timeoutMs,
608
- );
602
+ return await this.#actorSql(ctx).exec(sql);
609
603
  }
610
604
 
611
605
  async actorSqlExecute(
612
606
  ctx: ActorContextHandle,
613
607
  sql: string,
614
608
  params?: RuntimeSqlBindParams,
615
- lease?: RuntimeSqlLeaseOptions,
616
609
  ): Promise<RuntimeSqlExecuteResult> {
617
610
  const result = await this.#actorSql(ctx).execute(
618
611
  sql,
619
612
  toNapiSqlBindParams(params),
620
- lease?.key,
621
- lease?.timeoutMs,
622
613
  );
623
614
  return normalizeRuntimeSqlExecuteResult(result);
624
615
  }
@@ -661,10 +652,6 @@ export class NapiCoreRuntime implements CoreRuntime {
661
652
  await database.close();
662
653
  }
663
654
 
664
- async actorUdsProvision(ctx: ActorContextHandle) {
665
- return await asNativeActorContext(ctx).provisionActorUds();
666
- }
667
-
668
655
  async actorQueueSend(
669
656
  ctx: ActorContextHandle,
670
657
  name: string,
@@ -758,10 +745,6 @@ export class NapiCoreRuntime implements CoreRuntime {
758
745
  return await asNativeActorContext(ctx).queue().inspectMessages();
759
746
  }
760
747
 
761
- async actorQueueReset(ctx: ActorContextHandle): Promise<void> {
762
- await asNativeActorContext(ctx).queue().reset();
763
- }
764
-
765
748
  actorScheduleAfter(
766
749
  ctx: ActorContextHandle,
767
750
  durationMs: number,
@@ -845,13 +828,6 @@ export async function loadNapiRuntime(): Promise<{
845
828
  bindings: NapiBindings;
846
829
  runtime: NapiCoreRuntime;
847
830
  }> {
848
- // LOAD-BEARING: the specifier is computed (`.join("/")`) on purpose. Do NOT
849
- // "simplify" it to a literal `import("@rivetkit/rivetkit-napi")`. Edge
850
- // adapters (e.g. @rivetkit/supabase) pre-bundle this module for Deno; a
851
- // literal dynamic import is statically resolvable, so Deno's eszip bundler
852
- // would snapshot the native `.node` addon into the deploy and 413. The
853
- // computed specifier keeps it opaque to static analysis so it is never
854
- // bundled. Enforced by scripts/ci/check-edge-native-closure.mjs.
855
831
  const bindings = await import(["@rivetkit", "rivetkit-napi"].join("/"));
856
832
  return {
857
833
  bindings,