@opengeni/db 3.7.3-canary.0 → 3.7.4-canary.0

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 (53) hide show
  1. package/dist/automations.d.ts +4 -0
  2. package/dist/canonical-human-identities.js +3 -3
  3. package/dist/{chunk-U4WPPEBH.js → chunk-3ZMN4EXC.js} +2 -2
  4. package/dist/{chunk-4NAR7FBA.js → chunk-6FIVOJ3V.js} +5 -1
  5. package/dist/{chunk-4NAR7FBA.js.map → chunk-6FIVOJ3V.js.map} +1 -1
  6. package/dist/{chunk-O56DM5GZ.js → chunk-DXJ2WY6W.js} +88 -1
  7. package/dist/chunk-DXJ2WY6W.js.map +1 -0
  8. package/dist/{chunk-S3TDDCS2.js → chunk-JP6IYGYI.js} +3 -3
  9. package/dist/{chunk-SZAWDXQC.js → chunk-JS3AWDKZ.js} +3 -3
  10. package/dist/{chunk-DZCYW2WT.js → chunk-LHKB62GC.js} +2 -2
  11. package/dist/{chunk-US4IS6IV.js → chunk-QL4AHBYD.js} +2 -2
  12. package/dist/{chunk-5NNCGFQY.js → chunk-VDXHLVDE.js} +2 -2
  13. package/dist/{chunk-F6PBS6WE.js → chunk-ZTSJPFDH.js} +2 -2
  14. package/dist/editable-artifact-durable-export.js +2 -2
  15. package/dist/editable-artifacts.js +3 -3
  16. package/dist/index.d.ts +105 -2
  17. package/dist/index.js +6241 -5241
  18. package/dist/index.js.map +1 -1
  19. package/dist/managed-auth-session-sets.js +3 -3
  20. package/dist/model-catalog.d.ts +153 -0
  21. package/dist/pr-review.d.ts +9 -0
  22. package/dist/provision-roles.js +1 -1
  23. package/dist/runtime-posture.d.ts +4 -4
  24. package/dist/schema.d.ts +344 -2
  25. package/dist/schema.js +5 -1
  26. package/dist/session-background-commands.js +3 -3
  27. package/dist/session-control.d.ts +35 -0
  28. package/dist/session-queue-commands.d.ts +17 -0
  29. package/dist/session-tenancy.js +3 -3
  30. package/dist/video-generation.js +3 -3
  31. package/dist/xai-subscription.d.ts +8 -0
  32. package/drizzle/0387_bound_host_export_session_payloads.sql +165 -0
  33. package/drizzle/0388_sandbox_provider_deadline_interactions.sql +491 -0
  34. package/drizzle/0389_model_catalog_and_gateway_custom_models.sql +241 -0
  35. package/package.json +6 -6
  36. package/src/automations.ts +9 -1
  37. package/src/index.ts +850 -117
  38. package/src/insights.ts +21 -7
  39. package/src/model-catalog.ts +682 -0
  40. package/src/pr-review.ts +19 -0
  41. package/src/runtime-posture.ts +4 -0
  42. package/src/schema.ts +98 -2
  43. package/src/session-control.ts +170 -0
  44. package/src/session-queue-commands.ts +157 -82
  45. package/src/xai-subscription.ts +66 -14
  46. package/dist/chunk-O56DM5GZ.js.map +0 -1
  47. /package/dist/{chunk-U4WPPEBH.js.map → chunk-3ZMN4EXC.js.map} +0 -0
  48. /package/dist/{chunk-S3TDDCS2.js.map → chunk-JP6IYGYI.js.map} +0 -0
  49. /package/dist/{chunk-SZAWDXQC.js.map → chunk-JS3AWDKZ.js.map} +0 -0
  50. /package/dist/{chunk-DZCYW2WT.js.map → chunk-LHKB62GC.js.map} +0 -0
  51. /package/dist/{chunk-US4IS6IV.js.map → chunk-QL4AHBYD.js.map} +0 -0
  52. /package/dist/{chunk-5NNCGFQY.js.map → chunk-VDXHLVDE.js.map} +0 -0
  53. /package/dist/{chunk-F6PBS6WE.js.map → chunk-ZTSJPFDH.js.map} +0 -0
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  withRlsContext
3
- } from "./chunk-F6PBS6WE.js";
3
+ } from "./chunk-ZTSJPFDH.js";
4
4
  import {
5
5
  sandboxRetainedProcesses,
6
6
  sessionBackgroundCommands,
7
7
  sessions
8
- } from "./chunk-O56DM5GZ.js";
8
+ } from "./chunk-DXJ2WY6W.js";
9
9
 
10
10
  // src/session-background-commands.ts
11
11
  import { and, desc, eq, inArray, sql } from "drizzle-orm";
@@ -513,4 +513,4 @@ export {
513
513
  settleSessionBackgroundCommandForRetainedProcess,
514
514
  settleConnectedMachineSessionBackgroundCommand
515
515
  };
516
- //# sourceMappingURL=chunk-S3TDDCS2.js.map
516
+ //# sourceMappingURL=chunk-JP6IYGYI.js.map
@@ -2,7 +2,7 @@ import {
2
2
  rawRows,
3
3
  withRlsContext,
4
4
  withWorkspaceRls
5
- } from "./chunk-F6PBS6WE.js";
5
+ } from "./chunk-ZTSJPFDH.js";
6
6
  import {
7
7
  connections,
8
8
  creditLedgerEntries,
@@ -14,7 +14,7 @@ import {
14
14
  workspaceVideoGenerationPolicies,
15
15
  workspaceVideoGenerationQuotas,
16
16
  workspaces
17
- } from "./chunk-O56DM5GZ.js";
17
+ } from "./chunk-DXJ2WY6W.js";
18
18
 
19
19
  // src/video-generation.ts
20
20
  import {
@@ -992,4 +992,4 @@ export {
992
992
  mediaGenerationResultForStoredOperation,
993
993
  getVideoGenerationOperationSummary
994
994
  };
995
- //# sourceMappingURL=chunk-SZAWDXQC.js.map
995
+ //# sourceMappingURL=chunk-JS3AWDKZ.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  nestedPostgresSqlState,
3
3
  rawRows
4
- } from "./chunk-F6PBS6WE.js";
4
+ } from "./chunk-ZTSJPFDH.js";
5
5
 
6
6
  // src/managed-auth-session-sets.ts
7
7
  import {
@@ -296,4 +296,4 @@ export {
296
296
  reapManagedAuthIsolatedSessions,
297
297
  reapExpiredManagedAuthSessionSets
298
298
  };
299
- //# sourceMappingURL=chunk-DZCYW2WT.js.map
299
+ //# sourceMappingURL=chunk-LHKB62GC.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  rawRows,
3
3
  withRlsContext
4
- } from "./chunk-F6PBS6WE.js";
4
+ } from "./chunk-ZTSJPFDH.js";
5
5
 
6
6
  // src/editable-artifacts.ts
7
7
  import { createHash } from "crypto";
@@ -3540,4 +3540,4 @@ export {
3540
3540
  PostgresEditableArtifactStore,
3541
3541
  PostgresEditableArtifactLiveReadStore
3542
3542
  };
3543
- //# sourceMappingURL=chunk-US4IS6IV.js.map
3543
+ //# sourceMappingURL=chunk-QL4AHBYD.js.map
@@ -5,7 +5,7 @@ import {
5
5
  withWorkspaceRls,
6
6
  withWorkspaceSubjectRls,
7
7
  withWorkspaceSubjectSessionActivityRls
8
- } from "./chunk-F6PBS6WE.js";
8
+ } from "./chunk-ZTSJPFDH.js";
9
9
 
10
10
  // src/session-tenancy.ts
11
11
  import { createHash } from "crypto";
@@ -481,4 +481,4 @@ export {
481
481
  forkSessionContent,
482
482
  replayAppliedSessionFork
483
483
  };
484
- //# sourceMappingURL=chunk-5NNCGFQY.js.map
484
+ //# sourceMappingURL=chunk-VDXHLVDE.js.map
@@ -4,7 +4,7 @@ import {
4
4
  sessions,
5
5
  workspaceSessionActivityRevisions,
6
6
  workspaces
7
- } from "./chunk-O56DM5GZ.js";
7
+ } from "./chunk-DXJ2WY6W.js";
8
8
 
9
9
  // src/persistence-errors.ts
10
10
  var SQLSTATE_KEYS = ["sqlState", "sqlstate", "code"];
@@ -755,4 +755,4 @@ export {
755
755
  withAccountRls,
756
756
  dbBindingFor
757
757
  };
758
- //# sourceMappingURL=chunk-F6PBS6WE.js.map
758
+ //# sourceMappingURL=chunk-ZTSJPFDH.js.map
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  rawRows,
3
3
  withRlsContext
4
- } from "./chunk-F6PBS6WE.js";
5
- import "./chunk-O56DM5GZ.js";
4
+ } from "./chunk-ZTSJPFDH.js";
5
+ import "./chunk-DXJ2WY6W.js";
6
6
  import "./chunk-PZ5AY32C.js";
7
7
 
8
8
  // src/editable-artifact-durable-export.ts
@@ -8,9 +8,9 @@ import {
8
8
  PostgresEditableArtifactStore,
9
9
  listEditableArtifactIdsForSession,
10
10
  touchEditableArtifactSessionLink
11
- } from "./chunk-US4IS6IV.js";
12
- import "./chunk-F6PBS6WE.js";
13
- import "./chunk-O56DM5GZ.js";
11
+ } from "./chunk-QL4AHBYD.js";
12
+ import "./chunk-ZTSJPFDH.js";
13
+ import "./chunk-DXJ2WY6W.js";
14
14
  import "./chunk-PZ5AY32C.js";
15
15
  export {
16
16
  EDITABLE_ARTIFACT_INTENT_MAX_BYTES,
package/dist/index.d.ts CHANGED
@@ -68,6 +68,7 @@ export { memoryTextForStorage } from "./memory-domain.js";
68
68
  export { migrate, runMigrations } from "./migrate.js";
69
69
  export { provisionRoles, type ProvisionResult, type ProvisionRolesOptions, } from "./provision-roles.js";
70
70
  export * from "./memory-domain.js";
71
+ export * from "./model-catalog.js";
71
72
  import { type Database, type SessionActivityDatabase } from "./database.js";
72
73
  export { createDb, registerDbBinding, retrySessionActivityRls, rlsContextForWorkspace, rlsStrategyFor, setRlsContext, setSubjectRlsContext, withAccountRls, withDatabaseStatementTimeout, withRlsContext, withSessionActivityRlsContext, withSessionActivitySavepoint, withWorkspaceRls, withWorkspaceSessionActivityRls, withWorkspaceSubjectRls, withWorkspaceSubjectSessionActivityRls, withWorkspaceUsageLock, withSandboxProviderReadLock, SandboxProviderReadLockUnavailableError, type CreateDbOptions, type Database, type DbClient, type SessionActivityDatabase, type RlsContext, type SessionRlsActorContext, type RlsStrategy, type SandboxProviderReadLockIdentity, type ManagedUserProfile, type UserLookup, type UserProfileLookup, } from "./database.js";
73
74
  export { withSessionRlsActorContext } from "./database.js";
@@ -849,6 +850,8 @@ export type CreateScheduledTaskInput = {
849
850
  variableSetId?: string | null;
850
851
  rigId?: string | null;
851
852
  metadata: Record<string, unknown>;
853
+ /** Trusted database-only admission seam. Throwing rolls the task creation back. */
854
+ beforeCreateCommit?: (tx: Database) => Promise<void>;
852
855
  };
853
856
  export type UpdateScheduledTaskInput = Partial<{
854
857
  name: string;
@@ -870,6 +873,8 @@ export type UpdateScheduledTaskInput = Partial<{
870
873
  authorityUpdatedBy: TurnInitiator;
871
874
  authorityUpdatedByContext: TurnInitiatorContext;
872
875
  authorityUpdatedByActor: AgentSessionCreationActor | null;
876
+ /** Trusted database-only admission seam. Throwing rolls the task update back. */
877
+ beforeUpdateCommit: (tx: Database) => Promise<void>;
873
878
  }>;
874
879
  export type CreatePackInstallationInput = {
875
880
  accountId: string;
@@ -992,6 +997,43 @@ export type CreateConnectionInput = {
992
997
  createdBySubjectId?: string | null;
993
998
  updatedBySubjectId?: string | null;
994
999
  };
1000
+ type UpsertWorkspaceProviderApiKeyConnectionInput = {
1001
+ accountId: string;
1002
+ workspaceId: string;
1003
+ operationId: string;
1004
+ requestDigest: string;
1005
+ credentialEncrypted: string;
1006
+ grantedScopes?: string[];
1007
+ expiresAt?: Date | null;
1008
+ metadata?: Record<string, unknown>;
1009
+ updatedBySubjectId: string;
1010
+ };
1011
+ type RotateWorkspaceProviderApiKeyConnectionInput = {
1012
+ accountId: string;
1013
+ workspaceId: string;
1014
+ connectionId: string;
1015
+ expectedVersion: number;
1016
+ operationId: string;
1017
+ requestDigest: string;
1018
+ credentialEncrypted: string;
1019
+ grantedScopes?: string[];
1020
+ expiresAt?: Date | null;
1021
+ metadata?: Record<string, unknown>;
1022
+ updatedBySubjectId: string;
1023
+ };
1024
+ type RevokeWorkspaceProviderApiKeyConnectionsInput = {
1025
+ accountId: string;
1026
+ workspaceId: string;
1027
+ connectionId: string;
1028
+ expectedVersion: number;
1029
+ updatedBySubjectId: string;
1030
+ };
1031
+ export type UpsertWorkspaceVercelAiGatewayConnectionInput = UpsertWorkspaceProviderApiKeyConnectionInput;
1032
+ export type RotateWorkspaceVercelAiGatewayConnectionInput = RotateWorkspaceProviderApiKeyConnectionInput;
1033
+ export type RevokeWorkspaceVercelAiGatewayConnectionsInput = RevokeWorkspaceProviderApiKeyConnectionsInput;
1034
+ export type UpsertWorkspaceOpenRouterConnectionInput = UpsertWorkspaceProviderApiKeyConnectionInput;
1035
+ export type RotateWorkspaceOpenRouterConnectionInput = RotateWorkspaceProviderApiKeyConnectionInput;
1036
+ export type RevokeWorkspaceOpenRouterConnectionsInput = RevokeWorkspaceProviderApiKeyConnectionsInput;
995
1037
  export type UpdateConnectionInput = {
996
1038
  workspaceId: string;
997
1039
  connectionId: string;
@@ -1886,6 +1928,15 @@ export declare function decryptedCapabilityHeaders(server: EnabledMcpCapabilityS
1886
1928
  export declare function getStoredCapabilityHeaderCiphertext(db: Database, workspaceId: string, capabilityId: string): Promise<Record<string, string> | null>;
1887
1929
  export declare function mcpServerIdForCapability(capabilityId: string, metadata?: Record<string, unknown>): string;
1888
1930
  export declare function createConnection(db: Database, input: CreateConnectionInput): Promise<ConnectionMetadataWithVerification>;
1931
+ /** Compatibility wrapper for the existing Vercel AI Gateway create/replay contract. */
1932
+ export declare function upsertWorkspaceVercelAiGatewayConnection(db: Database, input: UpsertWorkspaceVercelAiGatewayConnectionInput): Promise<ConnectionMetadataWithVerification | null>;
1933
+ export declare function upsertWorkspaceOpenRouterConnection(db: Database, input: UpsertWorkspaceOpenRouterConnectionInput): Promise<ConnectionMetadataWithVerification | null>;
1934
+ /** Compatibility wrapper for the existing Vercel AI Gateway rotation contract. */
1935
+ export declare function rotateWorkspaceVercelAiGatewayConnection(db: Database, input: RotateWorkspaceVercelAiGatewayConnectionInput): Promise<ConnectionMetadataWithVerification | null>;
1936
+ export declare function rotateWorkspaceOpenRouterConnection(db: Database, input: RotateWorkspaceOpenRouterConnectionInput): Promise<ConnectionMetadataWithVerification | null>;
1937
+ /** Compatibility wrapper for the existing Vercel AI Gateway revoke contract. */
1938
+ export declare function revokeWorkspaceVercelAiGatewayConnections(db: Database, input: RevokeWorkspaceVercelAiGatewayConnectionsInput): Promise<ConnectionMetadataWithVerification | null>;
1939
+ export declare function revokeWorkspaceOpenRouterConnections(db: Database, input: RevokeWorkspaceOpenRouterConnectionsInput): Promise<ConnectionMetadataWithVerification | null>;
1889
1940
  /**
1890
1941
  * Serialize one provider-principal/owner connection generation. Distinct OAuth
1891
1942
  * starts for the same principal converge on one row, while an explicit
@@ -2517,14 +2568,21 @@ export declare function loadConnectionCredentialForBroker(db: Database, settings
2517
2568
  allowSubjectOwned?: boolean;
2518
2569
  expectedAuthorityGeneration?: number;
2519
2570
  }): Promise<ConnectionCredentialForBroker | null>;
2520
- export declare function workspaceVercelAiGatewayConnectionActive(db: Database, workspaceId: string): Promise<boolean>;
2521
2571
  /** Metadata-only capability revision input; never selects/decrypts the API key. */
2522
2572
  export declare function getWorkspaceVercelAiGatewayConnectionMetadata(db: Database, workspaceId: string): Promise<{
2523
2573
  connectionId: string;
2524
2574
  version: number;
2525
2575
  } | null>;
2576
+ export declare function getWorkspaceOpenRouterConnectionMetadata(db: Database, workspaceId: string): Promise<{
2577
+ connectionId: string;
2578
+ version: number;
2579
+ } | null>;
2580
+ export declare function workspaceVercelAiGatewayConnectionActive(db: Database, workspaceId: string): Promise<boolean>;
2581
+ export declare function workspaceOpenRouterConnectionActive(db: Database, workspaceId: string): Promise<boolean>;
2526
2582
  /** Resolve only the reviewed workspace-shared AI Gateway credential shape. */
2527
2583
  export declare function loadWorkspaceVercelAiGatewayApiKey(db: Database, settings: Settings, workspaceId: string): Promise<string | null>;
2584
+ /** Resolve only the reviewed workspace-shared OpenRouter credential shape. */
2585
+ export declare function loadWorkspaceOpenRouterApiKey(db: Database, settings: Settings, workspaceId: string): Promise<string | null>;
2528
2586
  /**
2529
2587
  * Worker-only immutable credential lease for an asynchronous video operation.
2530
2588
  * The operation copies the already-encrypted credential envelope before its
@@ -2753,6 +2811,11 @@ export declare function createScheduledTaskRun(db: Database, input: {
2753
2811
  scheduledAt?: Date | null;
2754
2812
  firedAt?: Date;
2755
2813
  acceptedExecutionSnapshot?: ScheduledTaskRunAcceptedExecutionType | null;
2814
+ /**
2815
+ * Trusted database-only admission seam for a fresh agent occurrence.
2816
+ * Throwing rolls back the run insert; exact producer replay skips it.
2817
+ */
2818
+ beforeFreshAgentRunCommit?: (tx: Database) => Promise<void>;
2756
2819
  }): Promise<ScheduledTaskRun>;
2757
2820
  export declare function getScheduledTaskRunAcceptedExecution(db: Database, input: {
2758
2821
  workspaceId: string;
@@ -4858,7 +4921,9 @@ export type SessionCreateInput = {
4858
4921
  /** Trusted, transaction-local linkage run after the exact session row and
4859
4922
  * MCP metadata exist but before either can commit. It must perform database
4860
4923
  * work only; throwing rolls the complete create/replay transaction back. */
4861
- beforeCreateCommit?: (tx: Database, sessionId: string) => Promise<void>;
4924
+ beforeCreateCommit?: (tx: Database, sessionId: string, context?: {
4925
+ created: boolean;
4926
+ }) => Promise<void>;
4862
4927
  };
4863
4928
  export declare function createSession(db: Database, input: SessionCreateInput): Promise<DbSession>;
4864
4929
  /**
@@ -4883,6 +4948,42 @@ export declare function createSessionWithIdempotencyKey(db: Database, input: Ses
4883
4948
  createIdempotencyKey: string;
4884
4949
  }): Promise<SessionCreateSuccessResult>;
4885
4950
  export declare function getSessionByCreateIdempotencyKey(db: Database, workspaceId: string, createIdempotencyKey: string): Promise<Session | null>;
4951
+ /**
4952
+ * Recover a keyed create before mutable create dependencies (notably the
4953
+ * current model catalog) are consulted. A fully initialized queued turn gets a
4954
+ * fresh durable wake revision from persisted state only; an uninitialized shell
4955
+ * returns its persisted model so the caller can reopen it strictly as retained
4956
+ * while the canonical keyed transaction repairs initialization. The same
4957
+ * request-identity checks as transactional create replay run before any session
4958
+ * or committed denial is returned.
4959
+ */
4960
+ export type InitializedSessionCreateReplay = {
4961
+ outcome: "session";
4962
+ session: Session & {
4963
+ initialTurnId: string | null;
4964
+ };
4965
+ temporalWorkflowId: string;
4966
+ workflowWakeRevision: number | null;
4967
+ changed: boolean;
4968
+ } | {
4969
+ outcome: "pending";
4970
+ session: Session;
4971
+ } | {
4972
+ outcome: "denied";
4973
+ denial: SessionSpawnDenial;
4974
+ };
4975
+ export declare function getInitializedSessionCreateReplay(db: Database, input: {
4976
+ accountId: string;
4977
+ workspaceId: string;
4978
+ subjectId: string;
4979
+ activeManagedHumanSubjectId?: string;
4980
+ createIdempotencyKey: string;
4981
+ requestedSessionId?: string;
4982
+ visibility?: "user_private" | "workspace_shared";
4983
+ variableSetIds: string[];
4984
+ initialPersonalResourceAttachmentIntent?: PersonalResourceAttachmentIntent | null;
4985
+ deferInitialTurn?: boolean;
4986
+ }): Promise<InitializedSessionCreateReplay | null>;
4886
4987
  export declare function getSession(db: Database, workspaceId: string, sessionId: string): Promise<Session | null>;
4887
4988
  export type DeleteSessionTreeIfQuiescentResult = {
4888
4989
  status: "deleted";
@@ -7586,6 +7687,7 @@ export type SandboxRotationBacklog = {
7586
7687
  turnBlocked: number;
7587
7688
  directBlocked: number;
7588
7689
  processBlocked: number;
7690
+ interactionBlocked: number;
7589
7691
  };
7590
7692
  export declare function readSandboxRotationBacklog(db: Database): Promise<SandboxRotationBacklog>;
7591
7693
  export type LegacyModalCheckpointSlot = {
@@ -8944,6 +9046,7 @@ export declare function materializeGoalContinuation(db: Database, input: {
8944
9046
  model: string;
8945
9047
  reasoningEffort: ReasoningEffort;
8946
9048
  latencyMode: LatencyMode;
9049
+ turnExecutionPolicy?: TurnExecutionPolicyV1;
8947
9050
  tools: ToolRef[];
8948
9051
  sandboxBackend: SandboxBackend;
8949
9052
  };