@opengeni/db 6.8.0 → 6.9.1-canary.41937124785001
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.
- package/dist/agent-calls.d.ts +1 -1
- package/dist/app-action-targets.js +17 -17
- package/dist/billing-auto-top-up.d.ts +112 -0
- package/dist/billing-customer.d.ts +7 -0
- package/dist/canonical-human-identities.js +3 -3
- package/dist/capability-reconciliation.js +2 -2
- package/dist/{chunk-VDPTVYW7.js → chunk-3DOWOHR6.js} +76 -133
- package/dist/chunk-3DOWOHR6.js.map +1 -0
- package/dist/{chunk-W4SBKWX5.js → chunk-A5ODQDXU.js} +38 -193
- package/dist/chunk-A5ODQDXU.js.map +1 -0
- package/dist/{chunk-4KUHBHVS.js → chunk-BGZQJTP6.js} +2 -2
- package/dist/{chunk-MGSNLGZM.js → chunk-BVC3AHIQ.js} +2 -2
- package/dist/{chunk-HMENEAI2.js → chunk-D4RWSSSD.js} +2 -2
- package/dist/{chunk-VFXJUF6L.js → chunk-DG3ISTDI.js} +2 -2
- package/dist/{chunk-IQUN5I3W.js → chunk-F5VBP3PI.js} +2 -2
- package/dist/{chunk-OZXPB6T7.js → chunk-FFW633OZ.js} +4548 -4138
- package/dist/{chunk-OZXPB6T7.js.map → chunk-FFW633OZ.js.map} +1 -1
- package/dist/{chunk-FXXPR7HE.js → chunk-GU2GL3IK.js} +4 -4
- package/dist/{chunk-XIZ7DXHZ.js → chunk-JLHJOXQE.js} +7 -7
- package/dist/chunk-JLHJOXQE.js.map +1 -0
- package/dist/{chunk-RR7PGHVZ.js → chunk-JWYG2X46.js} +3 -3
- package/dist/{chunk-Z3ELCTBD.js → chunk-K3APTSR3.js} +2 -2
- package/dist/{chunk-G6PRV7EY.js → chunk-KI7SKJBW.js} +45 -8
- package/dist/chunk-KI7SKJBW.js.map +1 -0
- package/dist/{chunk-7ZH7ZX4I.js → chunk-PQM4LNL4.js} +2 -2
- package/dist/{chunk-GRSMAO2J.js → chunk-QO6OI24Z.js} +3 -3
- package/dist/{chunk-3KJG2SRY.js → chunk-VGZBOEO7.js} +7 -27
- package/dist/chunk-VGZBOEO7.js.map +1 -0
- package/dist/{chunk-2A5SA32N.js → chunk-VJ2UDJBX.js} +3 -3
- package/dist/connect-attempts.js +3 -3
- package/dist/credit-ledger.d.ts +25 -0
- package/dist/editable-artifact-durable-export.js +2 -2
- package/dist/editable-artifacts.js +3 -3
- package/dist/index.d.ts +14 -30
- package/dist/index.js +36 -40
- package/dist/lossless-columns.d.ts +0 -110
- package/dist/managed-auth-session-sets.js +3 -3
- package/dist/mcp-operations.js +2 -2
- package/dist/migrate.js +17 -17
- package/dist/native-push.d.ts +1 -10
- package/dist/organization-integration-policy.js +3 -3
- package/dist/provision-roles.js +1 -1
- package/dist/retained-provider-commands.js +6 -6
- package/dist/runtime-posture.d.ts +6 -7
- package/dist/schema.d.ts +679 -4
- package/dist/schema.js +7 -1
- package/dist/session-background-commands.js +5 -5
- package/dist/session-command-output.js +5 -5
- package/dist/session-event-slices.js +3 -3
- package/dist/session-event-write-bounds.d.ts +0 -5
- package/dist/session-mcp-credential-rotation.js +6 -6
- package/dist/session-secret-redaction-text.d.ts +4 -4
- package/dist/session-tenancy.js +6 -6
- package/dist/subscription-core-claude-adapter.d.ts +1 -1
- package/dist/subscription-core-claude-oauth.d.ts +11 -0
- package/dist/subscription-core-claude-usage.d.ts +9 -4
- package/dist/{subscription-core-codex-BWLSJGEU.js → subscription-core-codex-UEOBG5T4.js} +5 -5
- package/dist/video-generation.js +3 -3
- package/dist/workspace-tool-defaults.js +5 -5
- package/drizzle/1239_agent_call_runtime_grants.sql +31 -0
- package/drizzle/1252_insights_hourly_rollups_never_negative.sql +226 -0
- package/drizzle/1257_billing_auto_top_up.sql +137 -0
- package/drizzle/1259_drop_audit_events_secret_used_index.sql +5 -0
- package/package.json +11 -10
- package/src/agent-calls.ts +1 -7
- package/src/billing-auto-top-up.ts +380 -0
- package/src/billing-customer.ts +35 -0
- package/src/credit-ledger.ts +81 -0
- package/src/index.ts +193 -155
- package/src/lossless-columns.ts +0 -73
- package/src/native-push.ts +11 -59
- package/src/runtime-posture.ts +8 -9
- package/src/schema.ts +83 -30
- package/src/session-command-output.ts +5 -31
- package/src/session-event-write-bounds.ts +1 -10
- package/src/session-queue-commands.ts +0 -4
- package/src/session-secret-redaction-text.ts +6 -6
- package/src/subscription-core-claude-adapter.ts +17 -5
- package/src/subscription-core-claude-oauth.ts +38 -0
- package/src/subscription-core-claude-usage.ts +19 -7
- package/src/task-notes.ts +0 -3
- package/dist/chunk-3KJG2SRY.js.map +0 -1
- package/dist/chunk-G6PRV7EY.js.map +0 -1
- package/dist/chunk-VDPTVYW7.js.map +0 -1
- package/dist/chunk-W4SBKWX5.js.map +0 -1
- package/dist/chunk-XIZ7DXHZ.js.map +0 -1
- package/dist/secret-use-history.d.ts +0 -28
- package/dist/secret-value-masking.d.ts +0 -27
- package/src/secret-use-history.ts +0 -108
- package/src/secret-value-masking.ts +0 -113
- /package/dist/{chunk-4KUHBHVS.js.map → chunk-BGZQJTP6.js.map} +0 -0
- /package/dist/{chunk-MGSNLGZM.js.map → chunk-BVC3AHIQ.js.map} +0 -0
- /package/dist/{chunk-HMENEAI2.js.map → chunk-D4RWSSSD.js.map} +0 -0
- /package/dist/{chunk-VFXJUF6L.js.map → chunk-DG3ISTDI.js.map} +0 -0
- /package/dist/{chunk-IQUN5I3W.js.map → chunk-F5VBP3PI.js.map} +0 -0
- /package/dist/{chunk-FXXPR7HE.js.map → chunk-GU2GL3IK.js.map} +0 -0
- /package/dist/{chunk-RR7PGHVZ.js.map → chunk-JWYG2X46.js.map} +0 -0
- /package/dist/{chunk-Z3ELCTBD.js.map → chunk-K3APTSR3.js.map} +0 -0
- /package/dist/{chunk-7ZH7ZX4I.js.map → chunk-PQM4LNL4.js.map} +0 -0
- /package/dist/{chunk-GRSMAO2J.js.map → chunk-QO6OI24Z.js.map} +0 -0
- /package/dist/{chunk-2A5SA32N.js.map → chunk-VJ2UDJBX.js.map} +0 -0
- /package/dist/{subscription-core-codex-BWLSJGEU.js.map → subscription-core-codex-UEOBG5T4.js.map} +0 -0
package/dist/agent-calls.d.ts
CHANGED
|
@@ -79,7 +79,7 @@ export declare function setAgentCallHostPhones(db: Database, input: {
|
|
|
79
79
|
}): Promise<AgentCallHostPhones | null>;
|
|
80
80
|
/**
|
|
81
81
|
* How many of a person's Opengeni app phones an agent may ring (for their
|
|
82
|
-
* own agents, or a teammate's).
|
|
82
|
+
* own agents, or a teammate's).
|
|
83
83
|
*/
|
|
84
84
|
export declare function countAgentCallDevices(db: Database, input: {
|
|
85
85
|
calleeSubjectId: string;
|
|
@@ -7,35 +7,35 @@ import {
|
|
|
7
7
|
getVault,
|
|
8
8
|
getVaultItem,
|
|
9
9
|
listOrganizationMcpConnections
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-FFW633OZ.js";
|
|
11
|
+
import "./chunk-BVC3AHIQ.js";
|
|
12
|
+
import "./chunk-GU2GL3IK.js";
|
|
13
|
+
import "./chunk-QO6OI24Z.js";
|
|
14
14
|
import "./chunk-MORKJ5JN.js";
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-JWYG2X46.js";
|
|
16
|
+
import "./chunk-JLHJOXQE.js";
|
|
17
|
+
import "./chunk-D4RWSSSD.js";
|
|
18
|
+
import "./chunk-DG3ISTDI.js";
|
|
19
|
+
import "./chunk-A5ODQDXU.js";
|
|
20
|
+
import "./chunk-PQM4LNL4.js";
|
|
21
|
+
import "./chunk-BGZQJTP6.js";
|
|
22
22
|
import {
|
|
23
23
|
getOrganizationInvitationForAdministration,
|
|
24
24
|
listOrganizationMembers,
|
|
25
25
|
listSelfOrganizationMemberships,
|
|
26
26
|
membershipOutsidePersonalWorkspace,
|
|
27
27
|
normalizeWorkspaceMembershipPermissions
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
28
|
+
} from "./chunk-VGZBOEO7.js";
|
|
29
|
+
import "./chunk-KI7SKJBW.js";
|
|
30
|
+
import "./chunk-VJ2UDJBX.js";
|
|
31
31
|
import "./chunk-4UJCXBR2.js";
|
|
32
|
-
import "./chunk-
|
|
32
|
+
import "./chunk-F5VBP3PI.js";
|
|
33
33
|
import {
|
|
34
34
|
setSubjectRlsContext,
|
|
35
35
|
withAccountRls,
|
|
36
36
|
withRlsContext,
|
|
37
37
|
withWorkspaceSubjectRls
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-K3APTSR3.js";
|
|
39
39
|
import "./chunk-SMCA7PNJ.js";
|
|
40
40
|
import {
|
|
41
41
|
apiKeys,
|
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
workspaceMemberships,
|
|
65
65
|
workspaceWebhooks,
|
|
66
66
|
workspaces
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-3DOWOHR6.js";
|
|
68
68
|
import "./chunk-PZ5AY32C.js";
|
|
69
69
|
|
|
70
70
|
// src/app-action-targets.ts
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { UpdateBillingAutoTopUpRequest } from "@opengeni/contracts";
|
|
2
|
+
import { type Database } from "./database.js";
|
|
3
|
+
export type AutoTopUpSettingsRow = {
|
|
4
|
+
account_id: string;
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
threshold_micros: number;
|
|
7
|
+
amount_micros: number;
|
|
8
|
+
monthly_cap_micros: number;
|
|
9
|
+
consent_subject: string | null;
|
|
10
|
+
consent_version: string | null;
|
|
11
|
+
consent_at: string | null;
|
|
12
|
+
provider: "stripe:test" | "stripe:live" | null;
|
|
13
|
+
customer_id: string | null;
|
|
14
|
+
payment_method_id: string | null;
|
|
15
|
+
payment_method_brand: string | null;
|
|
16
|
+
payment_method_last4: string | null;
|
|
17
|
+
setup_key: string | null;
|
|
18
|
+
setup_subject: string | null;
|
|
19
|
+
failure_reason: string | null;
|
|
20
|
+
cap_required_micros: number | null;
|
|
21
|
+
revision: string;
|
|
22
|
+
};
|
|
23
|
+
export type AutoTopUpIntent = {
|
|
24
|
+
provider: "stripe:test" | "stripe:live";
|
|
25
|
+
customerId: string;
|
|
26
|
+
paymentMethodId: string;
|
|
27
|
+
consentSubject: string;
|
|
28
|
+
settingsRevision: string;
|
|
29
|
+
taxCalculationId: string;
|
|
30
|
+
taxExpiresAt: number;
|
|
31
|
+
receiptEmail: string | null;
|
|
32
|
+
};
|
|
33
|
+
export type AutoTopUpOperation = {
|
|
34
|
+
account_id: string;
|
|
35
|
+
operation_key: string;
|
|
36
|
+
state: "pending" | "succeeded" | "failed";
|
|
37
|
+
reservation_month: string;
|
|
38
|
+
credit_micros: number;
|
|
39
|
+
charge_micros: number;
|
|
40
|
+
intent: AutoTopUpIntent;
|
|
41
|
+
payment_intent_id: string | null;
|
|
42
|
+
confirmation_started_at: string | null;
|
|
43
|
+
charged_at: string | null;
|
|
44
|
+
failure_reason: string | null;
|
|
45
|
+
notification_delivered_at: string | null;
|
|
46
|
+
created_at: string;
|
|
47
|
+
completed_at: string | null;
|
|
48
|
+
};
|
|
49
|
+
export type AutoTopUpNotification = {
|
|
50
|
+
accountId: string;
|
|
51
|
+
kind: "topup_success" | "topup_failed" | "cap_reached";
|
|
52
|
+
operationKey: string;
|
|
53
|
+
amountMicros: number;
|
|
54
|
+
chargeMicros: number;
|
|
55
|
+
failureReason?: string;
|
|
56
|
+
};
|
|
57
|
+
/** The notification worker owns delivery/outbox. Enqueue with this transaction and
|
|
58
|
+
* stable operationKey; never send network email from this callback. */
|
|
59
|
+
export type AutoTopUpNotificationPort = (tx: Database, event: AutoTopUpNotification) => Promise<void>;
|
|
60
|
+
export declare class AutoTopUpStoreError extends Error {
|
|
61
|
+
readonly status: 403 | 409 | 422;
|
|
62
|
+
constructor(status: 403 | 409 | 422, message: string);
|
|
63
|
+
}
|
|
64
|
+
export declare class AutoTopUpAccountStore {
|
|
65
|
+
readonly tx: Database;
|
|
66
|
+
readonly accountId: string;
|
|
67
|
+
readonly notify?: AutoTopUpNotificationPort | undefined;
|
|
68
|
+
constructor(tx: Database, accountId: string, notify?: AutoTopUpNotificationPort | undefined);
|
|
69
|
+
settings(): Promise<AutoTopUpSettingsRow | null>;
|
|
70
|
+
clock(): Promise<{
|
|
71
|
+
now: string;
|
|
72
|
+
month: string;
|
|
73
|
+
}>;
|
|
74
|
+
spent(): Promise<number>;
|
|
75
|
+
operation(key: string): Promise<AutoTopUpOperation | null>;
|
|
76
|
+
pending(): Promise<AutoTopUpOperation | null>;
|
|
77
|
+
assertOwner(subject: string): Promise<void>;
|
|
78
|
+
update(subject: string, request: UpdateBillingAutoTopUpRequest): Promise<void>;
|
|
79
|
+
startSetup(subject: string, key: string, provider: AutoTopUpIntent["provider"], customerId: string): Promise<void>;
|
|
80
|
+
finishSetup(input: {
|
|
81
|
+
key: string;
|
|
82
|
+
subject: string;
|
|
83
|
+
provider: AutoTopUpIntent["provider"];
|
|
84
|
+
customerId: string;
|
|
85
|
+
methodId: string;
|
|
86
|
+
brand: string;
|
|
87
|
+
last4: string;
|
|
88
|
+
}): Promise<boolean>;
|
|
89
|
+
customer(provider: string): Promise<string | null>;
|
|
90
|
+
balance(): Promise<number>;
|
|
91
|
+
reserve(input: {
|
|
92
|
+
key: string;
|
|
93
|
+
creditMicros: number;
|
|
94
|
+
chargeMicros: number;
|
|
95
|
+
intent: AutoTopUpIntent;
|
|
96
|
+
}): Promise<AutoTopUpOperation>;
|
|
97
|
+
bind(key: string, paymentIntentId: string): Promise<void>;
|
|
98
|
+
markConfirmation(key: string): Promise<void>;
|
|
99
|
+
succeeded(operation: AutoTopUpOperation, chargedAt: string): Promise<void>;
|
|
100
|
+
failed(operation: AutoTopUpOperation, reason: string): Promise<void>;
|
|
101
|
+
disable(reason: string): Promise<void>;
|
|
102
|
+
failBeforePayment(settings: AutoTopUpSettingsRow, reason: string): Promise<void>;
|
|
103
|
+
deliverOutstanding(): Promise<void>;
|
|
104
|
+
capReached(settings: AutoTopUpSettingsRow, requiredMicros?: number): Promise<void>;
|
|
105
|
+
deliver(key: string): Promise<void>;
|
|
106
|
+
}
|
|
107
|
+
export declare function autoTopUpCreditKey(operationKey: string): string;
|
|
108
|
+
export interface AutoTopUpStore {
|
|
109
|
+
locked<T>(accountId: string, run: (account: AutoTopUpAccountStore) => Promise<T>): Promise<T>;
|
|
110
|
+
}
|
|
111
|
+
/** Root handle only: every call is an independent committed recovery checkpoint. */
|
|
112
|
+
export declare function billingAutoTopUpStore(db: Database, notify?: AutoTopUpNotificationPort): AutoTopUpStore;
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
getCanonicalHumanIdentityProjection,
|
|
12
12
|
synchronizeCanonicalHumanLoginBindings,
|
|
13
13
|
validateCanonicalHumanSession
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-D4RWSSSD.js";
|
|
15
|
+
import "./chunk-K3APTSR3.js";
|
|
16
16
|
import "./chunk-SMCA7PNJ.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-3DOWOHR6.js";
|
|
18
18
|
import "./chunk-PZ5AY32C.js";
|
|
19
19
|
export {
|
|
20
20
|
CanonicalHumanIdentityAuthorityError,
|
|
@@ -20,6 +20,9 @@ __export(schema_exports, {
|
|
|
20
20
|
authRuns: () => authRuns,
|
|
21
21
|
automaticSessionTitleFanoutOutboxV1: () => automaticSessionTitleFanoutOutboxV1,
|
|
22
22
|
automationTemplates: () => automationTemplates,
|
|
23
|
+
billingAutoTopUpMutations: () => billingAutoTopUpMutations,
|
|
24
|
+
billingAutoTopUpOperations: () => billingAutoTopUpOperations,
|
|
25
|
+
billingAutoTopUpSettings: () => billingAutoTopUpSettings,
|
|
23
26
|
billingCustomers: () => billingCustomers,
|
|
24
27
|
billingSubscriptionOperations: () => billingSubscriptionOperations,
|
|
25
28
|
botTemplates: () => botTemplates,
|
|
@@ -1342,64 +1345,6 @@ function isPlainObject(value) {
|
|
|
1342
1345
|
return prototype === Object.prototype || prototype === null;
|
|
1343
1346
|
}
|
|
1344
1347
|
|
|
1345
|
-
// src/secret-value-masking.ts
|
|
1346
|
-
import { AsyncLocalStorage } from "async_hooks";
|
|
1347
|
-
import { maskSecretShapes } from "@opengeni/contracts";
|
|
1348
|
-
var maskers = new AsyncLocalStorage();
|
|
1349
|
-
function composed(outer, inner) {
|
|
1350
|
-
return {
|
|
1351
|
-
get size() {
|
|
1352
|
-
return outer.size + inner.size;
|
|
1353
|
-
},
|
|
1354
|
-
mask(value, stage) {
|
|
1355
|
-
return outer.mask(inner.mask(value, stage), stage);
|
|
1356
|
-
},
|
|
1357
|
-
maskToolOutput(value, stage) {
|
|
1358
|
-
const once = inner.maskToolOutput ? inner.maskToolOutput(value, stage) : inner.mask(value, stage);
|
|
1359
|
-
return outer.maskToolOutput ? outer.maskToolOutput(once, stage) : outer.mask(once, stage);
|
|
1360
|
-
},
|
|
1361
|
-
async captureShapes(value, stage) {
|
|
1362
|
-
await inner.captureShapes?.(value, stage);
|
|
1363
|
-
await outer.captureShapes?.(value, stage);
|
|
1364
|
-
}
|
|
1365
|
-
};
|
|
1366
|
-
}
|
|
1367
|
-
function withSecretValueMasking(masker, run) {
|
|
1368
|
-
if (!masker) return run();
|
|
1369
|
-
const outer = maskers.getStore();
|
|
1370
|
-
return maskers.run(outer ? composed(outer, masker) : masker, run);
|
|
1371
|
-
}
|
|
1372
|
-
function activeSecretValueMasker() {
|
|
1373
|
-
return maskers.getStore();
|
|
1374
|
-
}
|
|
1375
|
-
function maskSecretValuesForStorage(value, stage = "storage") {
|
|
1376
|
-
const masker = maskers.getStore();
|
|
1377
|
-
if (!masker || masker.size === 0) return value;
|
|
1378
|
-
try {
|
|
1379
|
-
return masker.mask(value, stage);
|
|
1380
|
-
} catch {
|
|
1381
|
-
return value;
|
|
1382
|
-
}
|
|
1383
|
-
}
|
|
1384
|
-
function maskToolOutputForStorage(value, stage = "tool_output") {
|
|
1385
|
-
const masker = maskers.getStore();
|
|
1386
|
-
try {
|
|
1387
|
-
if (!masker) return maskSecretShapes(value);
|
|
1388
|
-
if (masker.maskToolOutput) return masker.maskToolOutput(value, stage);
|
|
1389
|
-
return masker.size === 0 ? value : masker.mask(value, stage);
|
|
1390
|
-
} catch {
|
|
1391
|
-
return value;
|
|
1392
|
-
}
|
|
1393
|
-
}
|
|
1394
|
-
async function captureToolOutputSecretShapes(value, stage = "tool_output") {
|
|
1395
|
-
const masker = maskers.getStore();
|
|
1396
|
-
if (!masker?.captureShapes) return;
|
|
1397
|
-
try {
|
|
1398
|
-
await masker.captureShapes(value, stage);
|
|
1399
|
-
} catch {
|
|
1400
|
-
}
|
|
1401
|
-
}
|
|
1402
|
-
|
|
1403
1348
|
// src/lossless-columns.ts
|
|
1404
1349
|
function losslessCodecVersion(name) {
|
|
1405
1350
|
return integer2(name);
|
|
@@ -1437,60 +1382,6 @@ var losslessOrderedJson = customType({
|
|
|
1437
1382
|
return typeof value === "string" ? JSON.parse(value) : value;
|
|
1438
1383
|
}
|
|
1439
1384
|
});
|
|
1440
|
-
var conversationLosslessJsonb = customType({
|
|
1441
|
-
dataType() {
|
|
1442
|
-
return "jsonb";
|
|
1443
|
-
},
|
|
1444
|
-
toDriver(value) {
|
|
1445
|
-
return JSON.stringify(toPostgresLosslessJson(maskSecretValuesForStorage(value, "column")));
|
|
1446
|
-
},
|
|
1447
|
-
fromDriver(value) {
|
|
1448
|
-
return typeof value === "string" ? JSON.parse(value) : value;
|
|
1449
|
-
}
|
|
1450
|
-
});
|
|
1451
|
-
var conversationLosslessText = customType({
|
|
1452
|
-
dataType() {
|
|
1453
|
-
return "text";
|
|
1454
|
-
},
|
|
1455
|
-
toDriver(value) {
|
|
1456
|
-
return toPostgresLosslessText(maskSecretValuesForStorage(value, "column"));
|
|
1457
|
-
},
|
|
1458
|
-
fromDriver(value) {
|
|
1459
|
-
return value;
|
|
1460
|
-
}
|
|
1461
|
-
});
|
|
1462
|
-
function maskSerializedRunStateForStorage(value) {
|
|
1463
|
-
let parsed;
|
|
1464
|
-
try {
|
|
1465
|
-
parsed = JSON.parse(value);
|
|
1466
|
-
} catch {
|
|
1467
|
-
return maskSecretValuesForStorage(value, "run_state");
|
|
1468
|
-
}
|
|
1469
|
-
const masked = maskSecretValuesForStorage(parsed, "run_state");
|
|
1470
|
-
return masked === parsed ? value : JSON.stringify(masked);
|
|
1471
|
-
}
|
|
1472
|
-
var conversationRunStateText = customType({
|
|
1473
|
-
dataType() {
|
|
1474
|
-
return "text";
|
|
1475
|
-
},
|
|
1476
|
-
toDriver(value) {
|
|
1477
|
-
return toPostgresLosslessText(maskSerializedRunStateForStorage(value));
|
|
1478
|
-
},
|
|
1479
|
-
fromDriver(value) {
|
|
1480
|
-
return value;
|
|
1481
|
-
}
|
|
1482
|
-
});
|
|
1483
|
-
var conversationLosslessOrderedJson = customType({
|
|
1484
|
-
dataType() {
|
|
1485
|
-
return "json";
|
|
1486
|
-
},
|
|
1487
|
-
toDriver(value) {
|
|
1488
|
-
return JSON.stringify(toPostgresLosslessJson(maskSecretValuesForStorage(value, "column")));
|
|
1489
|
-
},
|
|
1490
|
-
fromDriver(value) {
|
|
1491
|
-
return typeof value === "string" ? JSON.parse(value) : value;
|
|
1492
|
-
}
|
|
1493
|
-
});
|
|
1494
1385
|
|
|
1495
1386
|
// src/knowledge-entries-schema.ts
|
|
1496
1387
|
import { sql as sql3 } from "drizzle-orm";
|
|
@@ -1736,6 +1627,7 @@ import {
|
|
|
1736
1627
|
boolean as boolean17,
|
|
1737
1628
|
check as check12,
|
|
1738
1629
|
customType as customType8,
|
|
1630
|
+
date,
|
|
1739
1631
|
foreignKey,
|
|
1740
1632
|
index as index27,
|
|
1741
1633
|
integer as integer22,
|
|
@@ -12707,7 +12599,7 @@ var sessions = pgTable29(
|
|
|
12707
12599
|
accountId: uuid28("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
|
|
12708
12600
|
workspaceId: uuid28("workspace_id").notNull().references(() => workspaces.id, { onDelete: "cascade" }),
|
|
12709
12601
|
status: text29("status").notNull().default("queued"),
|
|
12710
|
-
initialMessage:
|
|
12602
|
+
initialMessage: losslessText("initial_message").notNull(),
|
|
12711
12603
|
initialMessageCodecVersion: losslessCodecVersion("initial_message_codec_version"),
|
|
12712
12604
|
// Model-visible application context frozen with the winning create. The
|
|
12713
12605
|
// initial turn copies it into the canonical user message so an idempotent
|
|
@@ -13500,9 +13392,9 @@ var sessionRealtimeEntries = pgTable29(
|
|
|
13500
13392
|
// result/error to the same ordinary turn. It never denotes a child/fork
|
|
13501
13393
|
// session.
|
|
13502
13394
|
turnId: uuid28("turn_id"),
|
|
13503
|
-
text:
|
|
13395
|
+
text: losslessText("text"),
|
|
13504
13396
|
textCodecVersion: losslessCodecVersion("text_codec_version"),
|
|
13505
|
-
payload:
|
|
13397
|
+
payload: losslessJsonb("payload").$type().notNull().default({}),
|
|
13506
13398
|
payloadCodecVersion: losslessCodecVersion("payload_codec_version"),
|
|
13507
13399
|
// Application context for an exact provider-in delegation or finalized
|
|
13508
13400
|
// transcript. It is materialized as ordinary user-role message content.
|
|
@@ -14933,7 +14825,7 @@ var sessionTurns = pgTable29(
|
|
|
14933
14825
|
// turns, and is projected conservatively as visible queue work.
|
|
14934
14826
|
promptRouting: text29("prompt_routing"),
|
|
14935
14827
|
position: bigint17("position", { mode: "number" }).notNull(),
|
|
14936
|
-
prompt:
|
|
14828
|
+
prompt: losslessText("prompt").notNull(),
|
|
14937
14829
|
promptCodecVersion: losslessCodecVersion("prompt_codec_version"),
|
|
14938
14830
|
annotations: jsonb24("annotations").$type().notNull().default([]),
|
|
14939
14831
|
// Application context for this exact user message. It is copied into the
|
|
@@ -16410,9 +16302,9 @@ var sessionSystemUpdates = pgTable29(
|
|
|
16410
16302
|
classification: text29("classification").notNull().default("info"),
|
|
16411
16303
|
sourceId: text29("source_id").notNull(),
|
|
16412
16304
|
dedupeKey: text29("dedupe_key").notNull(),
|
|
16413
|
-
summary:
|
|
16305
|
+
summary: losslessText("summary").notNull(),
|
|
16414
16306
|
summaryCodecVersion: losslessCodecVersion("summary_codec_version"),
|
|
16415
|
-
payload:
|
|
16307
|
+
payload: losslessJsonb("payload").$type().notNull().default({}),
|
|
16416
16308
|
payloadCodecVersion: losslessCodecVersion("payload_codec_version"),
|
|
16417
16309
|
lineage: jsonb24("lineage").$type().notNull().default({}),
|
|
16418
16310
|
// Private immutable authority frozen when this machine input is accepted.
|
|
@@ -16500,9 +16392,9 @@ var sessionSystemUpdateOutbox = pgTable29(
|
|
|
16500
16392
|
kind: text29("kind").notNull(),
|
|
16501
16393
|
classification: text29("classification").notNull(),
|
|
16502
16394
|
sourceId: text29("source_id").notNull(),
|
|
16503
|
-
summary:
|
|
16395
|
+
summary: losslessText("summary").notNull(),
|
|
16504
16396
|
summaryCodecVersion: losslessCodecVersion("summary_codec_version"),
|
|
16505
|
-
payload:
|
|
16397
|
+
payload: losslessJsonb("payload").$type().notNull().default({}),
|
|
16506
16398
|
payloadCodecVersion: losslessCodecVersion("payload_codec_version"),
|
|
16507
16399
|
lineage: jsonb24("lineage").$type().notNull().default({}),
|
|
16508
16400
|
// Exact private authority copied from the causal parent turn in the source
|
|
@@ -16841,7 +16733,7 @@ var sessionEvents = pgTable29(
|
|
|
16841
16733
|
duplicateReason: text29("duplicate_reason"),
|
|
16842
16734
|
sequence: integer22("sequence").notNull(),
|
|
16843
16735
|
type: text29("type").notNull(),
|
|
16844
|
-
payload:
|
|
16736
|
+
payload: losslessJsonb("payload").$type().notNull().default({}),
|
|
16845
16737
|
payloadCodecVersion: losslessCodecVersion("payload_codec_version"),
|
|
16846
16738
|
clientEventId: text29("client_event_id"),
|
|
16847
16739
|
producerId: text29("producer_id"),
|
|
@@ -17023,7 +16915,7 @@ var agentRunStates = pgTable29("agent_run_states", {
|
|
|
17023
16915
|
onDelete: "set null"
|
|
17024
16916
|
}),
|
|
17025
16917
|
stateVersion: integer22("state_version").notNull(),
|
|
17026
|
-
serializedRunState:
|
|
16918
|
+
serializedRunState: losslessText("serialized_run_state").notNull(),
|
|
17027
16919
|
serializedRunStateCodecVersion: losslessCodecVersion("serialized_run_state_codec_version"),
|
|
17028
16920
|
pendingApprovals: losslessJsonb("pending_approvals").$type().notNull().default([]),
|
|
17029
16921
|
pendingApprovalsCodecVersion: losslessCodecVersion("pending_approvals_codec_version"),
|
|
@@ -17139,7 +17031,7 @@ var sessionHistoryItems = pgTable29(
|
|
|
17139
17031
|
// positions; only the summary uses the half-step. `mode: "number"` maps the
|
|
17140
17032
|
// postgres.js string back to a JS number so every reader stays numeric.
|
|
17141
17033
|
position: numeric("position", { mode: "number" }).notNull(),
|
|
17142
|
-
item:
|
|
17034
|
+
item: losslessOrderedJson("item_ordered").$type().notNull(),
|
|
17143
17035
|
itemCodecVersion: losslessCodecVersion("item_codec_version"),
|
|
17144
17036
|
// Live-row flag for client-side context compaction. The read path selects
|
|
17145
17037
|
// only active rows; a compaction supersedes the summarized prefix (sets this
|
|
@@ -19992,6 +19884,62 @@ var billingSubscriptionOperations = pgTable29(
|
|
|
19992
19884
|
pending: uniqueIndex25("billing_subscription_operations_pending_idx").on(table.accountId).where(sql24`${table.completedAt} is null`)
|
|
19993
19885
|
})
|
|
19994
19886
|
);
|
|
19887
|
+
var billingAutoTopUpSettings = pgTable29("billing_auto_top_up_settings", {
|
|
19888
|
+
accountId: uuid28("account_id").primaryKey().references(() => managedAccounts.id, { onDelete: "cascade" }),
|
|
19889
|
+
enabled: boolean17("enabled").notNull().default(false),
|
|
19890
|
+
thresholdMicros: bigint17("threshold_micros", { mode: "number" }).notNull().default(1e7),
|
|
19891
|
+
amountMicros: bigint17("amount_micros", { mode: "number" }).notNull().default(25e6),
|
|
19892
|
+
monthlyCapMicros: bigint17("monthly_cap_micros", { mode: "number" }).notNull().default(1e8),
|
|
19893
|
+
consentSubject: text29("consent_subject"),
|
|
19894
|
+
consentVersion: text29("consent_version"),
|
|
19895
|
+
consentAt: timestamp29("consent_at", { withTimezone: true }),
|
|
19896
|
+
provider: text29("provider"),
|
|
19897
|
+
customerId: text29("customer_id"),
|
|
19898
|
+
paymentMethodId: text29("payment_method_id"),
|
|
19899
|
+
paymentMethodBrand: text29("payment_method_brand"),
|
|
19900
|
+
paymentMethodLast4: text29("payment_method_last4"),
|
|
19901
|
+
setupKey: uuid28("setup_key"),
|
|
19902
|
+
setupSubject: text29("setup_subject"),
|
|
19903
|
+
failureReason: text29("failure_reason"),
|
|
19904
|
+
capRequiredMicros: bigint17("cap_required_micros", { mode: "number" }),
|
|
19905
|
+
revision: uuid28("revision").notNull(),
|
|
19906
|
+
updatedAt: timestamp29("updated_at", { withTimezone: true }).notNull().default(sql24`clock_timestamp()`)
|
|
19907
|
+
});
|
|
19908
|
+
var billingAutoTopUpMutations = pgTable29(
|
|
19909
|
+
"billing_auto_top_up_mutations",
|
|
19910
|
+
{
|
|
19911
|
+
accountId: uuid28("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
|
|
19912
|
+
operationKey: uuid28("operation_key").notNull(),
|
|
19913
|
+
actorSubject: text29("actor_subject").notNull(),
|
|
19914
|
+
request: jsonb24("request").$type().notNull(),
|
|
19915
|
+
createdAt: timestamp29("created_at", { withTimezone: true }).notNull().default(sql24`clock_timestamp()`)
|
|
19916
|
+
},
|
|
19917
|
+
(table) => ({ pk: primaryKey13({ columns: [table.accountId, table.operationKey] }) })
|
|
19918
|
+
);
|
|
19919
|
+
var billingAutoTopUpOperations = pgTable29(
|
|
19920
|
+
"billing_auto_top_up_operations",
|
|
19921
|
+
{
|
|
19922
|
+
accountId: uuid28("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
|
|
19923
|
+
operationKey: uuid28("operation_key").notNull(),
|
|
19924
|
+
state: text29("state").notNull().default("pending"),
|
|
19925
|
+
reservationMonth: date("reservation_month").notNull(),
|
|
19926
|
+
creditMicros: bigint17("credit_micros", { mode: "number" }).notNull(),
|
|
19927
|
+
chargeMicros: bigint17("charge_micros", { mode: "number" }).notNull(),
|
|
19928
|
+
intent: jsonb24("intent").$type().notNull(),
|
|
19929
|
+
paymentIntentId: text29("payment_intent_id").unique(),
|
|
19930
|
+
confirmationStartedAt: timestamp29("confirmation_started_at", { withTimezone: true }),
|
|
19931
|
+
chargedAt: timestamp29("charged_at", { withTimezone: true }),
|
|
19932
|
+
failureReason: text29("failure_reason"),
|
|
19933
|
+
notificationDeliveredAt: timestamp29("notification_delivered_at", { withTimezone: true }),
|
|
19934
|
+
createdAt: timestamp29("created_at", { withTimezone: true }).notNull().default(sql24`clock_timestamp()`),
|
|
19935
|
+
completedAt: timestamp29("completed_at", { withTimezone: true })
|
|
19936
|
+
},
|
|
19937
|
+
(table) => ({
|
|
19938
|
+
pk: primaryKey13({ columns: [table.accountId, table.operationKey] }),
|
|
19939
|
+
pending: uniqueIndex25("billing_auto_top_up_one_pending").on(table.accountId).where(sql24`${table.state} = 'pending'`),
|
|
19940
|
+
month: index27("billing_auto_top_up_month").on(table.accountId, table.reservationMonth)
|
|
19941
|
+
})
|
|
19942
|
+
);
|
|
19995
19943
|
var organizationPlans = pgTable29("organization_plans", {
|
|
19996
19944
|
accountId: uuid28("account_id").primaryKey().references(() => managedAccounts.id, { onDelete: "cascade" }),
|
|
19997
19945
|
planKey: text29("plan_key").notNull(),
|
|
@@ -20316,9 +20264,7 @@ var auditEvents = pgTable29(
|
|
|
20316
20264
|
workspaceCreated: index27("audit_events_workspace_created_idx").on(
|
|
20317
20265
|
table.workspaceId,
|
|
20318
20266
|
table.occurredAt
|
|
20319
|
-
)
|
|
20320
|
-
// Earlier secret uses of a session tree, for known-value masking (1023).
|
|
20321
|
-
secretUsed: index27("audit_events_secret_used_idx").on(table.workspaceId, table.occurredAt).where(sql24`${table.action} = 'vault.secret.used'`)
|
|
20267
|
+
)
|
|
20322
20268
|
})
|
|
20323
20269
|
);
|
|
20324
20270
|
var importBatches = pgTable29(
|
|
@@ -21475,12 +21421,6 @@ export {
|
|
|
21475
21421
|
completeMeaningfulSessionEventSql,
|
|
21476
21422
|
childRecentTurnOutcomesSql,
|
|
21477
21423
|
childLifecycleEvidenceCandidatesSql,
|
|
21478
|
-
withSecretValueMasking,
|
|
21479
|
-
activeSecretValueMasker,
|
|
21480
|
-
maskSecretValuesForStorage,
|
|
21481
|
-
maskToolOutputForStorage,
|
|
21482
|
-
captureToolOutputSecretShapes,
|
|
21483
|
-
maskSerializedRunStateForStorage,
|
|
21484
21424
|
agentLearningRevisions,
|
|
21485
21425
|
agentLearningSnapshots,
|
|
21486
21426
|
knowledgeEntries,
|
|
@@ -21893,6 +21833,9 @@ export {
|
|
|
21893
21833
|
creditLedgerEntries,
|
|
21894
21834
|
subscriptionPlanCatalogRevisions,
|
|
21895
21835
|
billingSubscriptionOperations,
|
|
21836
|
+
billingAutoTopUpSettings,
|
|
21837
|
+
billingAutoTopUpMutations,
|
|
21838
|
+
billingAutoTopUpOperations,
|
|
21896
21839
|
organizationPlans,
|
|
21897
21840
|
planCreditPeriods,
|
|
21898
21841
|
creditDebitAllocations,
|
|
@@ -21946,4 +21889,4 @@ export {
|
|
|
21946
21889
|
promotionEnforcement,
|
|
21947
21890
|
schema_exports
|
|
21948
21891
|
};
|
|
21949
|
-
//# sourceMappingURL=chunk-
|
|
21892
|
+
//# sourceMappingURL=chunk-3DOWOHR6.js.map
|