@opengeni/db 1.3.0 → 1.4.2

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 (91) hide show
  1. package/dist/canonical-human-identities.js +3 -3
  2. package/dist/capability-reconciliation.js +2 -2
  3. package/dist/{chunk-7QWWTVYH.js → chunk-5ROHLEN6.js} +29 -4
  4. package/dist/chunk-5ROHLEN6.js.map +1 -0
  5. package/dist/{chunk-AQMH2ZEH.js → chunk-A4J7EECR.js} +2 -2
  6. package/dist/{chunk-VQX54TK3.js → chunk-B5C5SBSI.js} +3 -3
  7. package/dist/{chunk-OI6YZXTU.js → chunk-DKFEUGM4.js} +2 -2
  8. package/dist/{chunk-HYBQABBJ.js → chunk-HUKBIZGH.js} +2 -2
  9. package/dist/{chunk-LRSIODCQ.js → chunk-IT3EYY2C.js} +6 -4
  10. package/dist/{chunk-LRSIODCQ.js.map → chunk-IT3EYY2C.js.map} +1 -1
  11. package/dist/{chunk-DSNEIW5E.js → chunk-JL6TBB76.js} +2 -1
  12. package/dist/chunk-JL6TBB76.js.map +1 -0
  13. package/dist/{chunk-OEFNTGR3.js → chunk-JWBEE4CL.js} +4 -4
  14. package/dist/{chunk-BRVBLQAL.js → chunk-K5MTNKJU.js} +4 -4
  15. package/dist/{chunk-6UKNJ43T.js → chunk-NZ2SP55O.js} +2 -2
  16. package/dist/{chunk-3XHC5KC5.js → chunk-OKCBARX6.js} +2 -2
  17. package/dist/{chunk-PNWWNEDM.js → chunk-OV5AUIBA.js} +2 -2
  18. package/dist/{chunk-BID3CNN3.js → chunk-TODVDGMO.js} +36 -18
  19. package/dist/{chunk-BID3CNN3.js.map → chunk-TODVDGMO.js.map} +1 -1
  20. package/dist/{chunk-6S5T6FSP.js → chunk-W75DRYG3.js} +5 -5
  21. package/dist/{chunk-7S3O33NM.js → chunk-Y72DP3JF.js} +2 -2
  22. package/dist/codemode-approvals.d.ts +7 -1
  23. package/dist/connect-attempts.js +3 -3
  24. package/dist/connection-metadata.d.ts +416 -0
  25. package/dist/credit-balances.d.ts +25 -4
  26. package/dist/database.d.ts +7 -1
  27. package/dist/editable-artifact-durable-export.js +2 -2
  28. package/dist/editable-artifacts.js +3 -3
  29. package/dist/index.d.ts +51 -8
  30. package/dist/index.js +10826 -10129
  31. package/dist/index.js.map +1 -1
  32. package/dist/legacy-tool-action-reviews.d.ts +75 -0
  33. package/dist/managed-auth-session-sets.js +3 -3
  34. package/dist/mcp-operations.js +2 -2
  35. package/dist/modal-native-live-origin.d.ts +75 -0
  36. package/dist/organization-integration-policy.js +3 -3
  37. package/dist/organization-slack-bots.d.ts +1 -1
  38. package/dist/provision-roles.js +1 -1
  39. package/dist/retained-provider-commands.d.ts +21 -21
  40. package/dist/retained-provider-commands.js +6 -6
  41. package/dist/runtime-posture.d.ts +1 -1
  42. package/dist/sandbox-interaction-idle.d.ts +22 -0
  43. package/dist/schema.js +1 -1
  44. package/dist/session-background-commands.js +4 -4
  45. package/dist/session-command-output.js +5 -5
  46. package/dist/session-event-slices.js +3 -3
  47. package/dist/session-mcp-credential-rotation.js +5 -5
  48. package/dist/session-realtime-billing.d.ts +48 -0
  49. package/dist/session-realtime.d.ts +8 -2
  50. package/dist/session-tenancy.js +3 -3
  51. package/dist/video-generation.js +3 -3
  52. package/dist/voice-transcription-settlement.d.ts +36 -0
  53. package/dist/workspace-tool-defaults.js +4 -4
  54. package/drizzle/0623_voice_transcription_attribution.sql +128 -0
  55. package/drizzle/0624_azure_live_realtime_model.sql +30 -0
  56. package/drizzle/0625_transcription_billing_refusal_codes.sql +29 -0
  57. package/drizzle/0632_modal_native_live_origin.sql +239 -0
  58. package/package.json +7 -7
  59. package/src/codemode-approvals.ts +52 -22
  60. package/src/codemode-operations.ts +198 -181
  61. package/src/connection-metadata.ts +166 -0
  62. package/src/credit-balances.ts +58 -17
  63. package/src/database.ts +9 -0
  64. package/src/index.ts +540 -412
  65. package/src/insights-unified.ts +2 -1
  66. package/src/legacy-tool-action-reviews.ts +242 -0
  67. package/src/modal-native-live-origin.ts +148 -0
  68. package/src/organization-slack-bots.ts +1 -1
  69. package/src/provision-roles.ts +12 -0
  70. package/src/runtime-posture.ts +32 -3
  71. package/src/sandbox-interaction-idle.ts +91 -0
  72. package/src/schema.ts +1 -0
  73. package/src/session-realtime-billing.ts +135 -0
  74. package/src/session-realtime-ledger.ts +9 -4
  75. package/src/session-realtime.ts +20 -2
  76. package/src/tool-action-reviews.ts +129 -18
  77. package/src/transcription-recordings.ts +3 -1
  78. package/src/voice-transcription-settlement.ts +94 -0
  79. package/dist/chunk-7QWWTVYH.js.map +0 -1
  80. package/dist/chunk-DSNEIW5E.js.map +0 -1
  81. /package/dist/{chunk-AQMH2ZEH.js.map → chunk-A4J7EECR.js.map} +0 -0
  82. /package/dist/{chunk-VQX54TK3.js.map → chunk-B5C5SBSI.js.map} +0 -0
  83. /package/dist/{chunk-OI6YZXTU.js.map → chunk-DKFEUGM4.js.map} +0 -0
  84. /package/dist/{chunk-HYBQABBJ.js.map → chunk-HUKBIZGH.js.map} +0 -0
  85. /package/dist/{chunk-OEFNTGR3.js.map → chunk-JWBEE4CL.js.map} +0 -0
  86. /package/dist/{chunk-BRVBLQAL.js.map → chunk-K5MTNKJU.js.map} +0 -0
  87. /package/dist/{chunk-6UKNJ43T.js.map → chunk-NZ2SP55O.js.map} +0 -0
  88. /package/dist/{chunk-3XHC5KC5.js.map → chunk-OKCBARX6.js.map} +0 -0
  89. /package/dist/{chunk-PNWWNEDM.js.map → chunk-OV5AUIBA.js.map} +0 -0
  90. /package/dist/{chunk-6S5T6FSP.js.map → chunk-W75DRYG3.js.map} +0 -0
  91. /package/dist/{chunk-7S3O33NM.js.map → chunk-Y72DP3JF.js.map} +0 -0
@@ -33,7 +33,13 @@ export declare function adoptCodemodeApproval(db: Database, input: CodemodeConti
33
33
  catalogDigest: string;
34
34
  effectDigest: string | null;
35
35
  }, onTerminal?: (tx: Database, operation: CodemodeOperation) => Promise<void>): Promise<CodemodeOperation | null>;
36
- /** Read a handle with the current exact attempt and same original caller; old bearer authority is insufficient. */
36
+ /**
37
+ * Read a handle with the current exact attempt and same original caller; old
38
+ * bearer authority is insufficient. This is a status read polled while a
39
+ * caller waits, so it is one plain snapshot select: it proves the exact live
40
+ * attempt in the same statement but takes no session/turn/attempt row locks
41
+ * and is not refused by a pending Pause/Steer, which owns the write fence only.
42
+ */
37
43
  export declare function readTurnCodemodeOperation(db: Database, input: CodemodeContinuationScope & {
38
44
  operationId: string;
39
45
  callerSubjectId: string;
@@ -7,9 +7,9 @@ import {
7
7
  getConnectAttempt,
8
8
  getConnectBeginReplay,
9
9
  listPendingConnectAttempts
10
- } from "./chunk-HYBQABBJ.js";
11
- import "./chunk-LRSIODCQ.js";
12
- import "./chunk-DSNEIW5E.js";
10
+ } from "./chunk-HUKBIZGH.js";
11
+ import "./chunk-IT3EYY2C.js";
12
+ import "./chunk-JL6TBB76.js";
13
13
  import "./chunk-P7YDM2RI.js";
14
14
  import "./chunk-PZ5AY32C.js";
15
15
  export {
@@ -0,0 +1,416 @@
1
+ import { type ConnectionMetadata } from "@opengeni/contracts";
2
+ import { type SQL } from "drizzle-orm";
3
+ import { type Database } from "./database.js";
4
+ /** Server-owned verification facts; public schemas expose them read-only and nullable. */
5
+ export type ConnectionMetadataWithVerification = ConnectionMetadata & {
6
+ verifiedInstallAt: string | null;
7
+ verifiedInstallVersion: number | null;
8
+ };
9
+ export declare const connectionMetadataColumns: {
10
+ id: import("drizzle-orm/pg-core").PgColumn<{
11
+ name: "id";
12
+ tableName: "connections";
13
+ dataType: "string";
14
+ columnType: "PgUUID";
15
+ data: string;
16
+ driverParam: string;
17
+ notNull: true;
18
+ hasDefault: true;
19
+ isPrimaryKey: true;
20
+ isAutoincrement: false;
21
+ hasRuntimeDefault: false;
22
+ enumValues: undefined;
23
+ baseColumn: never;
24
+ identity: undefined;
25
+ generated: undefined;
26
+ }, {}, {}>;
27
+ authorityId: import("drizzle-orm/pg-core").PgColumn<{
28
+ name: "authority_id";
29
+ tableName: "connections";
30
+ dataType: "string";
31
+ columnType: "PgUUID";
32
+ data: string;
33
+ driverParam: string;
34
+ notNull: false;
35
+ hasDefault: false;
36
+ isPrimaryKey: false;
37
+ isAutoincrement: false;
38
+ hasRuntimeDefault: false;
39
+ enumValues: undefined;
40
+ baseColumn: never;
41
+ identity: undefined;
42
+ generated: undefined;
43
+ }, {}, {}>;
44
+ authorityGeneration: import("drizzle-orm/pg-core").PgColumn<{
45
+ name: "authority_generation";
46
+ tableName: "connections";
47
+ dataType: "number";
48
+ columnType: "PgBigInt53";
49
+ data: number;
50
+ driverParam: string | number;
51
+ notNull: true;
52
+ hasDefault: true;
53
+ isPrimaryKey: false;
54
+ isAutoincrement: false;
55
+ hasRuntimeDefault: false;
56
+ enumValues: undefined;
57
+ baseColumn: never;
58
+ identity: undefined;
59
+ generated: undefined;
60
+ }, {}, {}>;
61
+ accountId: import("drizzle-orm/pg-core").PgColumn<{
62
+ name: "account_id";
63
+ tableName: "connections";
64
+ dataType: "string";
65
+ columnType: "PgUUID";
66
+ data: string;
67
+ driverParam: string;
68
+ notNull: true;
69
+ hasDefault: false;
70
+ isPrimaryKey: false;
71
+ isAutoincrement: false;
72
+ hasRuntimeDefault: false;
73
+ enumValues: undefined;
74
+ baseColumn: never;
75
+ identity: undefined;
76
+ generated: undefined;
77
+ }, {}, {}>;
78
+ workspaceId: import("drizzle-orm/pg-core").PgColumn<{
79
+ name: "workspace_id";
80
+ tableName: "connections";
81
+ dataType: "string";
82
+ columnType: "PgUUID";
83
+ data: string;
84
+ driverParam: string;
85
+ notNull: true;
86
+ hasDefault: false;
87
+ isPrimaryKey: false;
88
+ isAutoincrement: false;
89
+ hasRuntimeDefault: false;
90
+ enumValues: undefined;
91
+ baseColumn: never;
92
+ identity: undefined;
93
+ generated: undefined;
94
+ }, {}, {}>;
95
+ subjectId: import("drizzle-orm/pg-core").PgColumn<{
96
+ name: "subject_id";
97
+ tableName: "connections";
98
+ dataType: "string";
99
+ columnType: "PgText";
100
+ data: string;
101
+ driverParam: string;
102
+ notNull: false;
103
+ hasDefault: false;
104
+ isPrimaryKey: false;
105
+ isAutoincrement: false;
106
+ hasRuntimeDefault: false;
107
+ enumValues: [string, ...string[]];
108
+ baseColumn: never;
109
+ identity: undefined;
110
+ generated: undefined;
111
+ }, {}, {}>;
112
+ providerDomain: import("drizzle-orm/pg-core").PgColumn<{
113
+ name: "provider_domain";
114
+ tableName: "connections";
115
+ dataType: "string";
116
+ columnType: "PgText";
117
+ data: string;
118
+ driverParam: string;
119
+ notNull: true;
120
+ hasDefault: false;
121
+ isPrimaryKey: false;
122
+ isAutoincrement: false;
123
+ hasRuntimeDefault: false;
124
+ enumValues: [string, ...string[]];
125
+ baseColumn: never;
126
+ identity: undefined;
127
+ generated: undefined;
128
+ }, {}, {}>;
129
+ kind: import("drizzle-orm/pg-core").PgColumn<{
130
+ name: "kind";
131
+ tableName: "connections";
132
+ dataType: "string";
133
+ columnType: "PgText";
134
+ data: string;
135
+ driverParam: string;
136
+ notNull: true;
137
+ hasDefault: false;
138
+ isPrimaryKey: false;
139
+ isAutoincrement: false;
140
+ hasRuntimeDefault: false;
141
+ enumValues: [string, ...string[]];
142
+ baseColumn: never;
143
+ identity: undefined;
144
+ generated: undefined;
145
+ }, {}, {}>;
146
+ status: import("drizzle-orm/pg-core").PgColumn<{
147
+ name: "status";
148
+ tableName: "connections";
149
+ dataType: "string";
150
+ columnType: "PgText";
151
+ data: string;
152
+ driverParam: string;
153
+ notNull: true;
154
+ hasDefault: true;
155
+ isPrimaryKey: false;
156
+ isAutoincrement: false;
157
+ hasRuntimeDefault: false;
158
+ enumValues: [string, ...string[]];
159
+ baseColumn: never;
160
+ identity: undefined;
161
+ generated: undefined;
162
+ }, {}, {}>;
163
+ grantedScopes: import("drizzle-orm/pg-core").PgColumn<{
164
+ name: "granted_scopes";
165
+ tableName: "connections";
166
+ dataType: "json";
167
+ columnType: "PgJsonb";
168
+ data: string[];
169
+ driverParam: unknown;
170
+ notNull: true;
171
+ hasDefault: true;
172
+ isPrimaryKey: false;
173
+ isAutoincrement: false;
174
+ hasRuntimeDefault: false;
175
+ enumValues: undefined;
176
+ baseColumn: never;
177
+ identity: undefined;
178
+ generated: undefined;
179
+ }, {}, {
180
+ $type: string[];
181
+ }>;
182
+ expiresAt: import("drizzle-orm/pg-core").PgColumn<{
183
+ name: "expires_at";
184
+ tableName: "connections";
185
+ dataType: "date";
186
+ columnType: "PgTimestamp";
187
+ data: Date;
188
+ driverParam: string;
189
+ notNull: false;
190
+ hasDefault: false;
191
+ isPrimaryKey: false;
192
+ isAutoincrement: false;
193
+ hasRuntimeDefault: false;
194
+ enumValues: undefined;
195
+ baseColumn: never;
196
+ identity: undefined;
197
+ generated: undefined;
198
+ }, {}, {}>;
199
+ lastRefreshAt: import("drizzle-orm/pg-core").PgColumn<{
200
+ name: "last_refresh_at";
201
+ tableName: "connections";
202
+ dataType: "date";
203
+ columnType: "PgTimestamp";
204
+ data: Date;
205
+ driverParam: string;
206
+ notNull: false;
207
+ hasDefault: false;
208
+ isPrimaryKey: false;
209
+ isAutoincrement: false;
210
+ hasRuntimeDefault: false;
211
+ enumValues: undefined;
212
+ baseColumn: never;
213
+ identity: undefined;
214
+ generated: undefined;
215
+ }, {}, {}>;
216
+ lastUsedAt: import("drizzle-orm/pg-core").PgColumn<{
217
+ name: "last_used_at";
218
+ tableName: "connections";
219
+ dataType: "date";
220
+ columnType: "PgTimestamp";
221
+ data: Date;
222
+ driverParam: string;
223
+ notNull: false;
224
+ hasDefault: false;
225
+ isPrimaryKey: false;
226
+ isAutoincrement: false;
227
+ hasRuntimeDefault: false;
228
+ enumValues: undefined;
229
+ baseColumn: never;
230
+ identity: undefined;
231
+ generated: undefined;
232
+ }, {}, {}>;
233
+ lastError: import("drizzle-orm/pg-core").PgColumn<{
234
+ name: "last_error";
235
+ tableName: "connections";
236
+ dataType: "string";
237
+ columnType: "PgText";
238
+ data: string;
239
+ driverParam: string;
240
+ notNull: false;
241
+ hasDefault: false;
242
+ isPrimaryKey: false;
243
+ isAutoincrement: false;
244
+ hasRuntimeDefault: false;
245
+ enumValues: [string, ...string[]];
246
+ baseColumn: never;
247
+ identity: undefined;
248
+ generated: undefined;
249
+ }, {}, {}>;
250
+ version: import("drizzle-orm/pg-core").PgColumn<{
251
+ name: "version";
252
+ tableName: "connections";
253
+ dataType: "number";
254
+ columnType: "PgInteger";
255
+ data: number;
256
+ driverParam: string | number;
257
+ notNull: true;
258
+ hasDefault: true;
259
+ isPrimaryKey: false;
260
+ isAutoincrement: false;
261
+ hasRuntimeDefault: false;
262
+ enumValues: undefined;
263
+ baseColumn: never;
264
+ identity: undefined;
265
+ generated: undefined;
266
+ }, {}, {}>;
267
+ verifiedInstallAt: import("drizzle-orm/pg-core").PgColumn<{
268
+ name: "verified_install_at";
269
+ tableName: "connections";
270
+ dataType: "date";
271
+ columnType: "PgTimestamp";
272
+ data: Date;
273
+ driverParam: string;
274
+ notNull: false;
275
+ hasDefault: false;
276
+ isPrimaryKey: false;
277
+ isAutoincrement: false;
278
+ hasRuntimeDefault: false;
279
+ enumValues: undefined;
280
+ baseColumn: never;
281
+ identity: undefined;
282
+ generated: undefined;
283
+ }, {}, {}>;
284
+ verifiedInstallVersion: import("drizzle-orm/pg-core").PgColumn<{
285
+ name: "verified_install_version";
286
+ tableName: "connections";
287
+ dataType: "number";
288
+ columnType: "PgInteger";
289
+ data: number;
290
+ driverParam: string | number;
291
+ notNull: false;
292
+ hasDefault: false;
293
+ isPrimaryKey: false;
294
+ isAutoincrement: false;
295
+ hasRuntimeDefault: false;
296
+ enumValues: undefined;
297
+ baseColumn: never;
298
+ identity: undefined;
299
+ generated: undefined;
300
+ }, {}, {}>;
301
+ metadata: import("drizzle-orm/pg-core").PgColumn<{
302
+ name: "metadata";
303
+ tableName: "connections";
304
+ dataType: "json";
305
+ columnType: "PgJsonb";
306
+ data: Record<string, unknown>;
307
+ driverParam: unknown;
308
+ notNull: true;
309
+ hasDefault: true;
310
+ isPrimaryKey: false;
311
+ isAutoincrement: false;
312
+ hasRuntimeDefault: false;
313
+ enumValues: undefined;
314
+ baseColumn: never;
315
+ identity: undefined;
316
+ generated: undefined;
317
+ }, {}, {
318
+ $type: Record<string, unknown>;
319
+ }>;
320
+ createdBySubjectId: import("drizzle-orm/pg-core").PgColumn<{
321
+ name: "created_by_subject_id";
322
+ tableName: "connections";
323
+ dataType: "string";
324
+ columnType: "PgText";
325
+ data: string;
326
+ driverParam: string;
327
+ notNull: false;
328
+ hasDefault: false;
329
+ isPrimaryKey: false;
330
+ isAutoincrement: false;
331
+ hasRuntimeDefault: false;
332
+ enumValues: [string, ...string[]];
333
+ baseColumn: never;
334
+ identity: undefined;
335
+ generated: undefined;
336
+ }, {}, {}>;
337
+ updatedBySubjectId: import("drizzle-orm/pg-core").PgColumn<{
338
+ name: "updated_by_subject_id";
339
+ tableName: "connections";
340
+ dataType: "string";
341
+ columnType: "PgText";
342
+ data: string;
343
+ driverParam: string;
344
+ notNull: false;
345
+ hasDefault: false;
346
+ isPrimaryKey: false;
347
+ isAutoincrement: false;
348
+ hasRuntimeDefault: false;
349
+ enumValues: [string, ...string[]];
350
+ baseColumn: never;
351
+ identity: undefined;
352
+ generated: undefined;
353
+ }, {}, {}>;
354
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
355
+ name: "created_at";
356
+ tableName: "connections";
357
+ dataType: "date";
358
+ columnType: "PgTimestamp";
359
+ data: Date;
360
+ driverParam: string;
361
+ notNull: true;
362
+ hasDefault: true;
363
+ isPrimaryKey: false;
364
+ isAutoincrement: false;
365
+ hasRuntimeDefault: false;
366
+ enumValues: undefined;
367
+ baseColumn: never;
368
+ identity: undefined;
369
+ generated: undefined;
370
+ }, {}, {}>;
371
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
372
+ name: "updated_at";
373
+ tableName: "connections";
374
+ dataType: "date";
375
+ columnType: "PgTimestamp";
376
+ data: Date;
377
+ driverParam: string;
378
+ notNull: true;
379
+ hasDefault: true;
380
+ isPrimaryKey: false;
381
+ isAutoincrement: false;
382
+ hasRuntimeDefault: false;
383
+ enumValues: undefined;
384
+ baseColumn: never;
385
+ identity: undefined;
386
+ generated: undefined;
387
+ }, {}, {}>;
388
+ };
389
+ export declare function connectionSubjectVisibility(subjectId?: string | null): SQL;
390
+ export declare function withConnectionSubjectRls<T>(db: Database, workspaceId: string, subjectId: string | null | undefined, fn: (db: Database) => Promise<T>): Promise<T>;
391
+ export declare function listConnectionsMetadata(db: Database, workspaceId: string, subjectId?: string | null): Promise<ConnectionMetadataWithVerification[]>;
392
+ export declare function getConnectionMetadata(db: Database, workspaceId: string, connectionId: string, subjectId?: string | null): Promise<ConnectionMetadataWithVerification | null>;
393
+ export declare function mapConnectionMetadata(row: {
394
+ id: string;
395
+ authorityId?: string | null;
396
+ authorityGeneration: number;
397
+ accountId: string;
398
+ workspaceId: string;
399
+ subjectId: string | null;
400
+ providerDomain: string;
401
+ kind: string;
402
+ status: string;
403
+ grantedScopes: string[];
404
+ expiresAt: Date | null;
405
+ lastRefreshAt: Date | null;
406
+ lastUsedAt: Date | null;
407
+ lastError: string | null;
408
+ version: number;
409
+ verifiedInstallAt: Date | null;
410
+ verifiedInstallVersion: number | null;
411
+ metadata: Record<string, unknown>;
412
+ createdBySubjectId: string | null;
413
+ updatedBySubjectId: string | null;
414
+ createdAt: Date;
415
+ updatedAt: Date;
416
+ }): ConnectionMetadataWithVerification;
@@ -5,14 +5,35 @@ type CreditBalanceSnapshot = BillingBalance & {
5
5
  creditPolicyRevision?: number;
6
6
  };
7
7
  export declare function getBillingBalance(db: Database, accountId: string, policyRevision?: number): Promise<CreditBalanceSnapshot>;
8
- /** Missing model means a non-model resource, which can only use general credits. */
9
- export declare function spendableCreditMicros(balance: BillingBalance, modelId?: string): number;
10
- export declare function getSpendableCreditBalance(db: Database, accountId: string, modelId?: string, policyRevision?: number): Promise<CreditBalanceSnapshot>;
11
- export declare function planCreditDebit(balance: BillingBalance, requestedMicros: number, modelId?: string): {
8
+ /**
9
+ * What a charge pays for. A canonical model ID uses grants scoped to that
10
+ * model; {@link VOICE_CREDIT_USAGE} (dictation and live voice) uses grants
11
+ * that cover voice, which are the verified-signup trial credits. Omitted means
12
+ * a non-model resource, which can only use general credits.
13
+ */
14
+ export type CreditUsage = string | {
15
+ readonly kind: "voice";
16
+ } | undefined;
17
+ /** Deployment-funded dictation and live voice. */
18
+ export declare const VOICE_CREDIT_USAGE: {
19
+ readonly kind: "voice";
20
+ };
21
+ export declare function spendableCreditMicros(balance: BillingBalance, usage?: CreditUsage): number;
22
+ export declare function getSpendableCreditBalance(db: Database, accountId: string, usage?: CreditUsage, policyRevision?: number): Promise<CreditBalanceSnapshot>;
23
+ export declare function planCreditDebit(balance: BillingBalance, requestedMicros: number, usage?: CreditUsage): {
12
24
  debitedMicros: number;
13
25
  allocations: {
14
26
  grantEntryId: string;
15
27
  amountMicros: number;
16
28
  }[];
17
29
  };
30
+ /**
31
+ * Allocations for an already-consumed charge of the full amount: covering
32
+ * grants pay what they can and general credit takes the rest, possibly going
33
+ * negative.
34
+ */
35
+ export declare function planPostUseCreditAllocations(balance: BillingBalance, amountMicros: number, usage: CreditUsage): {
36
+ grantEntryId: string;
37
+ amountMicros: number;
38
+ }[];
18
39
  export {};
@@ -192,7 +192,13 @@ export declare function withWorkspaceRls<T>(db: Database, workspaceId: string, f
192
192
  export declare function withSessionActivityRlsContext<T>(db: Database, context: RlsContext & {
193
193
  workspaceId: string;
194
194
  }, fn: (db: SessionActivityDatabase) => Promise<T>, transactionConfig?: PgTransactionConfig, fenceMode?: "shared" | "none", organizationMembershipFence?: boolean): Promise<T>;
195
- export declare function withWorkspaceSessionActivityRls<T>(db: Database, workspaceId: string, fn: (db: SessionActivityDatabase) => Promise<T>, transactionConfig?: PgTransactionConfig): Promise<T>;
195
+ /**
196
+ * `organizationMembershipFence` is required when the callback takes the
197
+ * organization-membership lifecycle lock (for example external-actor
198
+ * reauthorization): that lock precedes the session-tenancy fence and the
199
+ * canonical control/workspace/session prefix, never follows it.
200
+ */
201
+ export declare function withWorkspaceSessionActivityRls<T>(db: Database, workspaceId: string, fn: (db: SessionActivityDatabase) => Promise<T>, transactionConfig?: PgTransactionConfig, organizationMembershipFence?: boolean): Promise<T>;
196
202
  /**
197
203
  * Run one of several ordered workspace activity scopes inside a caller-owned
198
204
  * transaction. Each scope is fully finalized before restoring the caller's
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  rawRows,
3
3
  withRlsContext
4
- } from "./chunk-LRSIODCQ.js";
5
- import "./chunk-DSNEIW5E.js";
4
+ } from "./chunk-IT3EYY2C.js";
5
+ import "./chunk-JL6TBB76.js";
6
6
  import "./chunk-P7YDM2RI.js";
7
7
  import "./chunk-PZ5AY32C.js";
8
8
 
@@ -10,9 +10,9 @@ import {
10
10
  listEditableArtifactIdsForSession,
11
11
  touchEditableArtifactSessionLink,
12
12
  transactionallyAuthorizeEditableArtifactActor
13
- } from "./chunk-3XHC5KC5.js";
14
- import "./chunk-LRSIODCQ.js";
15
- import "./chunk-DSNEIW5E.js";
13
+ } from "./chunk-OKCBARX6.js";
14
+ import "./chunk-IT3EYY2C.js";
15
+ import "./chunk-JL6TBB76.js";
16
16
  import "./chunk-P7YDM2RI.js";
17
17
  import "./chunk-PZ5AY32C.js";
18
18
  export {
package/dist/index.d.ts CHANGED
@@ -1,9 +1,14 @@
1
1
  export * from "./organization-slack-bots.js";
2
+ export * from "./voice-transcription-settlement.js";
3
+ import { type ConnectionMetadataWithVerification } from "./connection-metadata.js";
4
+ export { getConnectionMetadata, listConnectionsMetadata, type ConnectionMetadataWithVerification, } from "./connection-metadata.js";
2
5
  export { readCreditPromotionPolicy } from "./credit-promotion-policy.js";
3
- export { getBillingBalance, getSpendableCreditBalance, spendableCreditMicros, } from "./credit-balances.js";
6
+ import { type CreditUsage } from "./credit-balances.js";
7
+ export { getBillingBalance, getSpendableCreditBalance, spendableCreditMicros, VOICE_CREDIT_USAGE, type CreditUsage, } from "./credit-balances.js";
4
8
  import { type TurnAttemptFenceRejectReason } from "./session-attempt-fence.js";
5
9
  export type { TurnAttemptFenceRejectReason } from "./session-attempt-fence.js";
6
10
  export { resolveConnectorActionPolicy, connectorActionPolicyDecision, projectConnectorToolPermission, connectorActionPoliciesForAccountRoutes, connectorToolPolicyRevision, ConnectorToolPermissionConflictError, } from "./connector-action-policy.js";
11
+ export { lockLiveNativeOriginalOriginTx, type ModalNativeLiveOriginScope, type ModalNativeLiveOriginProjection, type ModalNativeLiveOriginResult, } from "./modal-native-live-origin.js";
7
12
  export { SubscriptionAccountChangedError } from "./subscription-account-conflict.js";
8
13
  import type { GoalAdmissionPausedReason } from "@opengeni/contracts";
9
14
  export declare const getScheduledTaskClaudeProviderAccountAuthoritySnapshot: (db: Database, workspaceId: string, taskId: string) => Promise<{
@@ -260,6 +265,7 @@ export * from "./session-queue-commands.js";
260
265
  export * from "./session-realtime.js";
261
266
  export * from "./session-realtime-context.js";
262
267
  export * from "./session-realtime-ledger.js";
268
+ export * from "./session-realtime-billing.js";
263
269
  export * from "./new-session-drafts.js";
264
270
  export * from "./workspace-instruction-policies.js";
265
271
  export * from "./company-profile.js";
@@ -1095,6 +1101,11 @@ export declare function applyCreditDebitAfterUse(db: Database, input: {
1095
1101
  idempotencyKey: string;
1096
1102
  metadata?: Record<string, unknown>;
1097
1103
  occurredAt?: Date;
1104
+ /**
1105
+ * What the charge paid for. When set, grants covering it pay first (oldest
1106
+ * first) and general credit takes the rest. Omitted: general credit only.
1107
+ */
1108
+ usage?: CreditUsage;
1098
1109
  }): Promise<{
1099
1110
  balance: BillingBalance;
1100
1111
  debitedMicros: number;
@@ -1518,11 +1529,6 @@ export declare class PersonalGitHubRepositorySelectionUnavailableError extends E
1518
1529
  readonly code = "PERSONAL_GITHUB_REPOSITORY_SELECTION_UNAVAILABLE";
1519
1530
  constructor();
1520
1531
  }
1521
- /** Server-owned verification facts; public schemas expose them read-only and nullable. */
1522
- export type ConnectionMetadataWithVerification = ConnectionMetadata & {
1523
- verifiedInstallAt: string | null;
1524
- verifiedInstallVersion: number | null;
1525
- };
1526
1532
  export type SlackBotPostOperation = {
1527
1533
  id: string;
1528
1534
  accountId: string;
@@ -2363,8 +2369,6 @@ export declare function revokeWorkspaceOpenRouterConnections(db: Database, input
2363
2369
  * reconnect remains fenced to the exact Connection version captured in state.
2364
2370
  */
2365
2371
  export declare function persistProviderOAuthConnection(db: Database, input: PersistProviderOAuthConnectionInput): Promise<ConnectionMetadataWithVerification | null>;
2366
- export declare function listConnectionsMetadata(db: Database, workspaceId: string, subjectId?: string | null): Promise<ConnectionMetadataWithVerification[]>;
2367
- export declare function getConnectionMetadata(db: Database, workspaceId: string, connectionId: string, subjectId?: string | null): Promise<ConnectionMetadataWithVerification | null>;
2368
2372
  export declare function getPersonalGitHubRepositorySelectionState(db: Database, input: {
2369
2373
  accountId: string;
2370
2374
  originWorkspaceId: string;
@@ -8409,6 +8413,9 @@ export declare function confirmDrainCold(db: Database, input: {
8409
8413
  idleCommandContainmentMs?: number | undefined;
8410
8414
  }): Promise<{
8411
8415
  wentCold: boolean;
8416
+ /** The missing provider was an unpublished warming replacement: its loss
8417
+ * recorded no lost workspace (see `unpublishedWarmingLoss`). */
8418
+ unpublishedProviderLost?: boolean;
8412
8419
  backgroundCommandEvents?: SessionEvent[];
8413
8420
  }>;
8414
8421
  export declare class SandboxWorkspaceMutationFencedError extends Error {
@@ -8452,6 +8459,41 @@ export type SandboxWorkspaceMutationAdmission = {
8452
8459
  workspaceGeneration: number;
8453
8460
  };
8454
8461
  export type SandboxWorkspaceMutationProviderOutcome = "resolved" | "rejected";
8462
+ /** Evidence from a committed exact admission settlement. It establishes the
8463
+ * physical provider outcome only; mutable output authority remains rejected. */
8464
+ export type SandboxWorkspaceMutationPhysicalSettlement = Readonly<{
8465
+ accountId: string;
8466
+ workspaceId: string;
8467
+ admission: Readonly<SandboxWorkspaceMutationAdmission>;
8468
+ operation: string;
8469
+ outcome: "resolved";
8470
+ }>;
8471
+ /** Durable terminal truth of the retained process whose concurrent settlement
8472
+ * fenced a physically settled mutation's output. */
8473
+ export type SandboxRetainedProcessTerminalState = Readonly<{
8474
+ state: "exited" | "lost";
8475
+ exitCode: number | null;
8476
+ }>;
8477
+ /** The exact provider outcome committed before its output failed an acceptance
8478
+ * fence. A generic admission fence or failed transaction carries no receipt.
8479
+ * This error never authorizes accepting output or replaying provider work. */
8480
+ export declare class SandboxWorkspaceMutationOutputRejectedError extends SandboxWorkspaceMutationFencedError {
8481
+ readonly name = "SandboxWorkspaceMutationOutputRejectedError";
8482
+ readonly physicalSettlement: SandboxWorkspaceMutationPhysicalSettlement;
8483
+ /** Non-null only when the fence was the retained process itself having
8484
+ * already reached a durable terminal state (for example the reaper settled
8485
+ * the exit between admission and settlement). The output stays rejected;
8486
+ * callers may report this stored terminal truth instead of failing. */
8487
+ readonly retainedProcessTerminal: SandboxRetainedProcessTerminalState | null;
8488
+ constructor(code: SandboxWorkspaceMutationFencedError["code"], message: string, physicalSettlement: SandboxWorkspaceMutationPhysicalSettlement, retainedProcessTerminal?: SandboxRetainedProcessTerminalState | null);
8489
+ matchesPhysicalSettlement(input: {
8490
+ accountId: string;
8491
+ workspaceId: string;
8492
+ admission: SandboxWorkspaceMutationAdmission;
8493
+ operation: string;
8494
+ outcome: SandboxWorkspaceMutationProviderOutcome;
8495
+ }): boolean;
8496
+ }
8455
8497
  export type SandboxRetainedProcessState = "active" | "exited" | "lost";
8456
8498
  export type SandboxRetainedProcess = {
8457
8499
  id: string;
@@ -11963,6 +12005,7 @@ export * from "./codemode-approvals.js";
11963
12005
  export * from "./tool-action-reviews.js";
11964
12006
  export * from "./browser-sessions.js";
11965
12007
  export * from "./browser-deadline-checkpoints.js";
12008
+ export * from "./sandbox-interaction-idle.js";
11966
12009
  export * from "./computer-sessions.js";
11967
12010
  export * from "./browser-identities.js";
11968
12011
  export * from "./browser-state-artifacts.js";