@opengeni/db 3.7.4 → 4.0.0-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.
- package/dist/automations.d.ts +4 -0
- package/dist/canonical-human-identities.js +3 -3
- package/dist/capability-integrations.d.ts +2 -0
- package/dist/{chunk-6DPJA36C.js → chunk-2XEZK4LF.js} +7 -1
- package/dist/chunk-2XEZK4LF.js.map +1 -0
- package/dist/{chunk-4NAR7FBA.js → chunk-3RI33YQN.js} +67 -1
- package/dist/chunk-3RI33YQN.js.map +1 -0
- package/dist/{chunk-SZAWDXQC.js → chunk-CJROYHSC.js} +3 -3
- package/dist/{chunk-DZCYW2WT.js → chunk-MX6V5F65.js} +2 -2
- package/dist/{chunk-S3TDDCS2.js → chunk-N5VXJ4I2.js} +151 -78
- package/dist/chunk-N5VXJ4I2.js.map +1 -0
- package/dist/{chunk-U4WPPEBH.js → chunk-NLFHMPUB.js} +2 -2
- package/dist/{chunk-5NNCGFQY.js → chunk-P6NSEG2S.js} +2 -2
- package/dist/{chunk-O56DM5GZ.js → chunk-QM6YOWHZ.js} +624 -57
- package/dist/chunk-QM6YOWHZ.js.map +1 -0
- package/dist/{chunk-US4IS6IV.js → chunk-RZNOSEMC.js} +2 -2
- package/dist/{chunk-F6PBS6WE.js → chunk-UFAMOUWL.js} +2 -2
- package/dist/codemode-operations.d.ts +5 -0
- package/dist/codex-token-resolver.d.ts +6 -2
- package/dist/connection-token-resolver.d.ts +8 -0
- package/dist/editable-artifact-durable-export.js +2 -2
- package/dist/editable-artifacts.js +3 -3
- package/dist/generated-images.d.ts +15 -0
- package/dist/index.d.ts +393 -91
- package/dist/index.js +9992 -6069
- package/dist/index.js.map +1 -1
- package/dist/insights.d.ts +9 -0
- package/dist/managed-auth-session-sets.js +3 -3
- package/dist/managed-user-setup.d.ts +3 -0
- package/dist/mcp-oauth.d.ts +80 -0
- package/dist/migrate.d.ts +1 -0
- package/dist/migrate.js +3 -1
- package/dist/model-catalog.d.ts +153 -0
- package/dist/model-context-snapshots.d.ts +20 -0
- package/dist/new-session-drafts.d.ts +12 -0
- package/dist/organization-membership-lifecycle.d.ts +8 -1
- package/dist/organization-model-providers.d.ts +101 -0
- package/dist/pack-components.d.ts +1 -0
- package/dist/pr-review.d.ts +9 -0
- package/dist/provision-roles.js +1 -1
- package/dist/runtime-posture.d.ts +8 -8
- package/dist/schema.d.ts +7708 -5050
- package/dist/schema.js +25 -1
- package/dist/session-background-commands.d.ts +18 -6
- package/dist/session-background-commands.js +15 -9
- package/dist/session-control.d.ts +37 -2
- package/dist/session-goal-pacing.d.ts +3 -6
- package/dist/session-queue-commands.d.ts +17 -0
- package/dist/session-tenancy.js +3 -3
- package/dist/tool-gateway-approvals.d.ts +31 -0
- package/dist/video-generation.js +3 -3
- package/dist/workspace-artifacts.d.ts +17 -3
- package/dist/xai-subscription.d.ts +8 -0
- package/drizzle/0387_bound_host_export_session_payloads.sql +165 -0
- package/drizzle/0388_sandbox_provider_deadline_interactions.sql +491 -0
- package/drizzle/0389_model_catalog_and_gateway_custom_models.sql +241 -0
- package/drizzle/0390_organization_model_provider_connections.sql +197 -0
- package/drizzle/0391_sandbox_provider_deadline_interaction_followup.sql +295 -0
- package/drizzle/0392_context_compaction_pending_observability.sql +198 -0
- package/drizzle/0393_workspace_memory_and_learning_defaults.sql +102 -0
- package/drizzle/0394_session_selected_skill_activation.sql +20 -0
- package/drizzle/0395_scheduled_task_unclaimed_occurrence_invalidation.sql +154 -0
- package/drizzle/0396_model_call_equivalent_credit_cost.sql +28 -0
- package/drizzle/0397_sandbox_deadline_rotation_preemption.sql +113 -0
- package/drizzle/0398_organization_workspace_management_entry.sql +206 -0
- package/drizzle/0399_additional_managed_organization_creation.sql +691 -0
- package/drizzle/0400_session_attempt_model_context_snapshots.sql +65 -0
- package/drizzle/0401_organization_user_setup_token_transport.sql +178 -0
- package/drizzle/0402_session_input_wait_and_background_command_results.sql +1023 -0
- package/drizzle/0403_codex_unconditional_credential_leasing.sql +181 -0
- package/drizzle/0404_mcp_oauth_authorization_server.sql +471 -0
- package/drizzle/0405_tool_gateway_approval_capabilities.sql +184 -0
- package/drizzle/0406_workspace_html_site_sources.sql +71 -0
- package/package.json +6 -6
- package/src/automations.ts +9 -1
- package/src/capability-integrations.ts +8 -0
- package/src/codemode-operations.ts +31 -21
- package/src/codex-token-resolver.ts +16 -6
- package/src/connection-token-resolver.ts +52 -3
- package/src/generated-images.ts +70 -6
- package/src/index.ts +3894 -994
- package/src/insights-model-bundle.ts +54 -5
- package/src/insights.ts +53 -7
- package/src/managed-user-setup.ts +14 -3
- package/src/mcp-oauth.ts +488 -0
- package/src/migrate.ts +9 -1
- package/src/model-catalog.ts +682 -0
- package/src/model-context-snapshots.ts +151 -0
- package/src/new-session-drafts.ts +66 -21
- package/src/organization-membership-lifecycle.ts +47 -5
- package/src/organization-model-providers.ts +614 -0
- package/src/pack-components.ts +15 -2
- package/src/pr-review.ts +19 -0
- package/src/provision-roles.ts +4 -0
- package/src/runtime-posture.ts +64 -0
- package/src/schema.ts +666 -61
- package/src/session-background-commands.ts +180 -78
- package/src/session-control.ts +181 -12
- package/src/session-goal-pacing.ts +4 -8
- package/src/session-queue-commands.ts +157 -82
- package/src/tool-gateway-approvals.ts +168 -0
- package/src/workspace-artifacts.ts +633 -178
- package/src/xai-subscription.ts +66 -14
- package/dist/chunk-4NAR7FBA.js.map +0 -1
- package/dist/chunk-6DPJA36C.js.map +0 -1
- package/dist/chunk-O56DM5GZ.js.map +0 -1
- package/dist/chunk-S3TDDCS2.js.map +0 -1
- /package/dist/{chunk-SZAWDXQC.js.map → chunk-CJROYHSC.js.map} +0 -0
- /package/dist/{chunk-DZCYW2WT.js.map → chunk-MX6V5F65.js.map} +0 -0
- /package/dist/{chunk-U4WPPEBH.js.map → chunk-NLFHMPUB.js.map} +0 -0
- /package/dist/{chunk-5NNCGFQY.js.map → chunk-P6NSEG2S.js.map} +0 -0
- /package/dist/{chunk-US4IS6IV.js.map → chunk-RZNOSEMC.js.map} +0 -0
- /package/dist/{chunk-F6PBS6WE.js.map → chunk-UFAMOUWL.js.map} +0 -0
package/dist/insights.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ export type ModelCallFactAggregateRow = {
|
|
|
21
21
|
pricedCostMicros: number;
|
|
22
22
|
estimatedProviderCostMicros: number;
|
|
23
23
|
estimatedProviderCostKnownCalls: number;
|
|
24
|
+
equivalentCreditCostMicros: number;
|
|
25
|
+
equivalentCreditCostKnownCalls: number;
|
|
24
26
|
};
|
|
25
27
|
export type InsightsDayBucket = {
|
|
26
28
|
day: string;
|
|
@@ -48,6 +50,8 @@ export type RootSessionDriverRow = {
|
|
|
48
50
|
pricedCostMicros: number;
|
|
49
51
|
estimatedProviderCostMicros: number;
|
|
50
52
|
estimatedProviderCostKnownCalls: number;
|
|
53
|
+
equivalentCreditCostMicros: number;
|
|
54
|
+
equivalentCreditCostKnownCalls: number;
|
|
51
55
|
totalTokens: number;
|
|
52
56
|
cachedTokens: number;
|
|
53
57
|
cacheInputTokens: number;
|
|
@@ -57,6 +61,8 @@ export type ScheduleFactAggregate = {
|
|
|
57
61
|
pricedCostMicros: number;
|
|
58
62
|
estimatedProviderCostMicros: number;
|
|
59
63
|
estimatedProviderCostKnownCalls: number;
|
|
64
|
+
equivalentCreditCostMicros: number;
|
|
65
|
+
equivalentCreditCostKnownCalls: number;
|
|
60
66
|
totalTokens: number;
|
|
61
67
|
cachedTokens: number;
|
|
62
68
|
cacheInputTokens: number;
|
|
@@ -116,6 +122,7 @@ export type RecentModelCallRow = {
|
|
|
116
122
|
totalTokens: number | null;
|
|
117
123
|
pricedCostMicros: number;
|
|
118
124
|
estimatedProviderCostMicros: number | null;
|
|
125
|
+
equivalentCreditCostMicros: number | null;
|
|
119
126
|
pricingSource: string | null;
|
|
120
127
|
};
|
|
121
128
|
export declare function sumUsageQuantityInRange(db: Database, input: {
|
|
@@ -153,6 +160,8 @@ export type ModelCallFactSeriesAggregate = {
|
|
|
153
160
|
costMicros: number;
|
|
154
161
|
estimatedProviderCostMicros: number;
|
|
155
162
|
estimatedProviderCostKnownCalls: number;
|
|
163
|
+
equivalentCreditCostMicros: number;
|
|
164
|
+
equivalentCreditCostKnownCalls: number;
|
|
156
165
|
inputTokens: number;
|
|
157
166
|
outputTokens: number;
|
|
158
167
|
cachedTokens: number;
|
|
@@ -20,9 +20,9 @@ import {
|
|
|
20
20
|
reapManagedAuthIsolatedSessions,
|
|
21
21
|
releaseManagedAuthActorMutationLease,
|
|
22
22
|
validateManagedAuthActorMutationLease
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-MX6V5F65.js";
|
|
24
|
+
import "./chunk-UFAMOUWL.js";
|
|
25
|
+
import "./chunk-QM6YOWHZ.js";
|
|
26
26
|
import "./chunk-PZ5AY32C.js";
|
|
27
27
|
export {
|
|
28
28
|
ManagedAuthActorMutationInFlightError,
|
|
@@ -42,6 +42,8 @@ export type OrganizationUserSetupDeliveryClaim = {
|
|
|
42
42
|
role: "viewer" | "member" | "admin";
|
|
43
43
|
}>;
|
|
44
44
|
expiresAt: string;
|
|
45
|
+
setupTokenTransport: "fragment" | "query" | null;
|
|
46
|
+
payloadDigest: string | null;
|
|
45
47
|
};
|
|
46
48
|
export declare function claimOrganizationUserSetupDelivery(db: Database, input: {
|
|
47
49
|
organizationId: string;
|
|
@@ -58,6 +60,7 @@ export declare function prepareOrganizationUserSetupDelivery(db: Database, input
|
|
|
58
60
|
claimHolderId: string;
|
|
59
61
|
tokenDigest: string;
|
|
60
62
|
payloadDigest: string;
|
|
63
|
+
setupTokenTransport: "fragment" | "query";
|
|
61
64
|
providerIdempotencyScope: string;
|
|
62
65
|
providerIdempotencyRetentionSeconds: number;
|
|
63
66
|
}): Promise<void>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { type AccessGrant } from "@opengeni/contracts";
|
|
2
|
+
import { type Database } from "./database.js";
|
|
3
|
+
export declare class McpOAuthClientRegistrationRateLimitError extends Error {
|
|
4
|
+
readonly name = "McpOAuthClientRegistrationRateLimitError";
|
|
5
|
+
readonly code = "mcp_oauth_client_registration_rate_limited";
|
|
6
|
+
}
|
|
7
|
+
export type McpOAuthClient = {
|
|
8
|
+
clientId: string;
|
|
9
|
+
redirectUris: string[];
|
|
10
|
+
clientName: string | null;
|
|
11
|
+
grantTypes: Array<"authorization_code" | "refresh_token">;
|
|
12
|
+
responseTypes: ["code"];
|
|
13
|
+
createdAt: Date;
|
|
14
|
+
};
|
|
15
|
+
export type McpOAuthGrantSnapshot = {
|
|
16
|
+
accountId: string;
|
|
17
|
+
workspaceId: string;
|
|
18
|
+
subjectId: string;
|
|
19
|
+
resource: string;
|
|
20
|
+
permissions: AccessGrant["permissions"];
|
|
21
|
+
toolIdentities: Array<{
|
|
22
|
+
serverId: string;
|
|
23
|
+
toolName: string;
|
|
24
|
+
}>;
|
|
25
|
+
};
|
|
26
|
+
export type McpOAuthAuthorizationRequest = McpOAuthGrantSnapshot & {
|
|
27
|
+
requestHash: string;
|
|
28
|
+
clientId: string;
|
|
29
|
+
redirectUri: string;
|
|
30
|
+
codeChallenge: string;
|
|
31
|
+
state: string | null;
|
|
32
|
+
expiresAt: Date;
|
|
33
|
+
};
|
|
34
|
+
export type McpOAuthAccess = McpOAuthGrantSnapshot & {
|
|
35
|
+
tokenHash: string;
|
|
36
|
+
clientId: string;
|
|
37
|
+
refreshFamilyId: string;
|
|
38
|
+
refreshGeneration: number;
|
|
39
|
+
expiresAt: Date;
|
|
40
|
+
};
|
|
41
|
+
export declare function registerMcpOAuthClient(db: Database, input: {
|
|
42
|
+
clientId: string;
|
|
43
|
+
redirectUris: string[];
|
|
44
|
+
clientName: string | null;
|
|
45
|
+
grantTypes: Array<"authorization_code" | "refresh_token">;
|
|
46
|
+
responseTypes: ["code"];
|
|
47
|
+
registrationScopeHash: string;
|
|
48
|
+
}): Promise<McpOAuthClient>;
|
|
49
|
+
export declare function getMcpOAuthClient(db: Database, clientId: string): Promise<McpOAuthClient | null>;
|
|
50
|
+
export declare function createMcpOAuthAuthorizationRequest(db: Database, input: McpOAuthAuthorizationRequest): Promise<void>;
|
|
51
|
+
export declare function getMcpOAuthAuthorizationRequest(db: Database, requestHash: string): Promise<McpOAuthAuthorizationRequest | null>;
|
|
52
|
+
export declare function deleteMcpOAuthAuthorizationRequest(db: Database, requestHash: string): Promise<void>;
|
|
53
|
+
export declare function consumeMcpOAuthAuthorizationRequest(db: Database, input: {
|
|
54
|
+
requestHash: string;
|
|
55
|
+
subjectId: string;
|
|
56
|
+
codeHash: string;
|
|
57
|
+
codeExpiresAt: Date;
|
|
58
|
+
}): Promise<McpOAuthAuthorizationRequest | null>;
|
|
59
|
+
export declare function exchangeMcpOAuthAuthorizationCode(db: Database, input: {
|
|
60
|
+
codeHash: string;
|
|
61
|
+
clientId: string;
|
|
62
|
+
redirectUri: string;
|
|
63
|
+
resource: string;
|
|
64
|
+
codeChallenge: string;
|
|
65
|
+
accessTokenHash: string;
|
|
66
|
+
refreshTokenHash: string | null;
|
|
67
|
+
accessExpiresAt: Date;
|
|
68
|
+
refreshExpiresAt: Date;
|
|
69
|
+
}): Promise<McpOAuthAccess | null>;
|
|
70
|
+
export declare function rotateMcpOAuthRefreshToken(db: Database, input: {
|
|
71
|
+
refreshTokenHash: string;
|
|
72
|
+
clientId: string;
|
|
73
|
+
resource: string;
|
|
74
|
+
accessTokenHash: string;
|
|
75
|
+
nextRefreshTokenHash: string;
|
|
76
|
+
accessExpiresAt: Date;
|
|
77
|
+
refreshExpiresAt: Date;
|
|
78
|
+
}): Promise<McpOAuthAccess | null>;
|
|
79
|
+
export declare function resolveMcpOAuthAccessToken(db: Database, tokenHash: string): Promise<McpOAuthAccess | null>;
|
|
80
|
+
export declare function resolveLiveMcpOAuthGrant(db: Database, access: McpOAuthAccess): Promise<AccessGrant | null>;
|
package/dist/migrate.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export type MigrationRuntimeOptions = {
|
|
|
34
34
|
* scripts possible.
|
|
35
35
|
*/
|
|
36
36
|
export declare function parseConcurrentIndexMigration(file: string, sqlText: string): ConcurrentIndexMigration | null;
|
|
37
|
+
export declare function migrationApplicationRoles(schema: string | undefined, options: MigrationRuntimeOptions | undefined): string[];
|
|
37
38
|
/**
|
|
38
39
|
* Apply the OpenGeni SQL migration chain.
|
|
39
40
|
*
|
package/dist/migrate.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
migrate,
|
|
3
|
+
migrationApplicationRoles,
|
|
3
4
|
parseConcurrentIndexMigration,
|
|
4
5
|
runMigrations
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-2XEZK4LF.js";
|
|
6
7
|
import "./chunk-PZ5AY32C.js";
|
|
7
8
|
export {
|
|
8
9
|
migrate,
|
|
10
|
+
migrationApplicationRoles,
|
|
9
11
|
parseConcurrentIndexMigration,
|
|
10
12
|
runMigrations
|
|
11
13
|
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { type Database } from "./database.js";
|
|
2
|
+
export type DeploymentModelCatalogRow = {
|
|
3
|
+
document: unknown;
|
|
4
|
+
version: number;
|
|
5
|
+
updatedAt: Date;
|
|
6
|
+
};
|
|
7
|
+
export type WorkspaceCustomModelProviderKind = "vercel_gateway" | "openrouter";
|
|
8
|
+
export type WorkspaceProviderCustomModel = {
|
|
9
|
+
id: string;
|
|
10
|
+
accountId: string;
|
|
11
|
+
workspaceId: string;
|
|
12
|
+
providerKind: WorkspaceCustomModelProviderKind;
|
|
13
|
+
upstreamModelId: string;
|
|
14
|
+
label: string | null;
|
|
15
|
+
version: number;
|
|
16
|
+
createdBySubjectId: string;
|
|
17
|
+
retiredAt?: Date | null;
|
|
18
|
+
createdAt: Date;
|
|
19
|
+
updatedAt: Date;
|
|
20
|
+
};
|
|
21
|
+
export type WorkspaceGatewayCustomModel = WorkspaceProviderCustomModel & {
|
|
22
|
+
providerKind: "vercel_gateway";
|
|
23
|
+
};
|
|
24
|
+
export type WorkspaceOpenRouterCustomModel = WorkspaceProviderCustomModel & {
|
|
25
|
+
providerKind: "openrouter";
|
|
26
|
+
};
|
|
27
|
+
export declare const MAX_WORKSPACE_GATEWAY_CUSTOM_MODELS = 100;
|
|
28
|
+
export declare const MAX_WORKSPACE_GATEWAY_CUSTOM_MODEL_RECORDS = 1000;
|
|
29
|
+
export declare const MAX_WORKSPACE_OPENROUTER_CUSTOM_MODELS = 100;
|
|
30
|
+
export declare const MAX_WORKSPACE_OPENROUTER_CUSTOM_MODEL_RECORDS = 1000;
|
|
31
|
+
export declare class WorkspaceGatewayCustomModelLimitError extends Error {
|
|
32
|
+
constructor();
|
|
33
|
+
}
|
|
34
|
+
export declare class WorkspaceGatewayCustomModelHistoryLimitError extends Error {
|
|
35
|
+
constructor();
|
|
36
|
+
}
|
|
37
|
+
export declare class WorkspaceOpenRouterCustomModelLimitError extends Error {
|
|
38
|
+
constructor();
|
|
39
|
+
}
|
|
40
|
+
export declare class WorkspaceOpenRouterCustomModelHistoryLimitError extends Error {
|
|
41
|
+
constructor();
|
|
42
|
+
}
|
|
43
|
+
/** Serialize one provider's custom-model mutations while allowing concurrent acceptance reads. */
|
|
44
|
+
export declare function withWorkspaceProviderCustomModelReadLock<T>(db: Database, input: {
|
|
45
|
+
accountId: string;
|
|
46
|
+
workspaceId: string;
|
|
47
|
+
providerKind: WorkspaceCustomModelProviderKind;
|
|
48
|
+
}, fn: (db: Database) => Promise<T>): Promise<T>;
|
|
49
|
+
/** Compatibility wrapper for existing Vercel AI Gateway admission callers. */
|
|
50
|
+
export declare function withWorkspaceGatewayCustomModelReadLock<T>(db: Database, input: {
|
|
51
|
+
accountId: string;
|
|
52
|
+
workspaceId: string;
|
|
53
|
+
}, fn: (db: Database) => Promise<T>): Promise<T>;
|
|
54
|
+
export declare function withWorkspaceOpenRouterCustomModelReadLock<T>(db: Database, input: {
|
|
55
|
+
accountId: string;
|
|
56
|
+
workspaceId: string;
|
|
57
|
+
}, fn: (db: Database) => Promise<T>): Promise<T>;
|
|
58
|
+
/** Runtime read of the deployment-global singleton. Returns null when absent. */
|
|
59
|
+
export declare function getDeploymentModelCatalog(db: Database): Promise<DeploymentModelCatalogRow | null>;
|
|
60
|
+
export declare function listWorkspaceGatewayCustomModels(db: Database, input: {
|
|
61
|
+
accountId: string;
|
|
62
|
+
workspaceId: string;
|
|
63
|
+
}): Promise<WorkspaceGatewayCustomModel[]>;
|
|
64
|
+
export declare function listWorkspaceOpenRouterCustomModels(db: Database, input: {
|
|
65
|
+
accountId: string;
|
|
66
|
+
workspaceId: string;
|
|
67
|
+
}): Promise<WorkspaceOpenRouterCustomModel[]>;
|
|
68
|
+
/**
|
|
69
|
+
* Lock and re-read one active Gateway custom model at a fresh-selection commit
|
|
70
|
+
* boundary. The shared lock remains held until an existing outer transaction commits.
|
|
71
|
+
*/
|
|
72
|
+
export declare function lockActiveWorkspaceGatewayCustomModelForAdmission(db: Database, input: {
|
|
73
|
+
accountId: string;
|
|
74
|
+
workspaceId: string;
|
|
75
|
+
upstreamModelId: string;
|
|
76
|
+
}): Promise<WorkspaceGatewayCustomModel | null>;
|
|
77
|
+
export declare function lockActiveWorkspaceOpenRouterCustomModelForAdmission(db: Database, input: {
|
|
78
|
+
accountId: string;
|
|
79
|
+
workspaceId: string;
|
|
80
|
+
upstreamModelId: string;
|
|
81
|
+
}): Promise<WorkspaceOpenRouterCustomModel | null>;
|
|
82
|
+
export declare function replayWorkspaceGatewayCustomModelCreate(db: Database, input: {
|
|
83
|
+
accountId: string;
|
|
84
|
+
workspaceId: string;
|
|
85
|
+
operationId: string;
|
|
86
|
+
requestHash: string;
|
|
87
|
+
}): Promise<{
|
|
88
|
+
outcome: "missing";
|
|
89
|
+
} | {
|
|
90
|
+
outcome: "conflict";
|
|
91
|
+
} | {
|
|
92
|
+
outcome: "success";
|
|
93
|
+
model: WorkspaceGatewayCustomModel;
|
|
94
|
+
}>;
|
|
95
|
+
export declare function replayWorkspaceOpenRouterCustomModelCreate(db: Database, input: {
|
|
96
|
+
accountId: string;
|
|
97
|
+
workspaceId: string;
|
|
98
|
+
operationId: string;
|
|
99
|
+
requestHash: string;
|
|
100
|
+
}): Promise<{
|
|
101
|
+
outcome: "missing";
|
|
102
|
+
} | {
|
|
103
|
+
outcome: "conflict";
|
|
104
|
+
} | {
|
|
105
|
+
outcome: "success";
|
|
106
|
+
model: WorkspaceOpenRouterCustomModel;
|
|
107
|
+
}>;
|
|
108
|
+
type CreateWorkspaceProviderCustomModelInput = {
|
|
109
|
+
accountId: string;
|
|
110
|
+
workspaceId: string;
|
|
111
|
+
upstreamModelId: string;
|
|
112
|
+
label?: string | null;
|
|
113
|
+
operationId: string;
|
|
114
|
+
requestHash: string;
|
|
115
|
+
createdBySubjectId: string;
|
|
116
|
+
};
|
|
117
|
+
export declare function createWorkspaceGatewayCustomModel(db: Database, input: CreateWorkspaceProviderCustomModelInput): Promise<WorkspaceGatewayCustomModel | null>;
|
|
118
|
+
export declare function createWorkspaceOpenRouterCustomModel(db: Database, input: CreateWorkspaceProviderCustomModelInput): Promise<WorkspaceOpenRouterCustomModel | null>;
|
|
119
|
+
type DeleteWorkspaceProviderCustomModelInput = {
|
|
120
|
+
accountId: string;
|
|
121
|
+
workspaceId: string;
|
|
122
|
+
customModelId: string;
|
|
123
|
+
expectedVersion: number;
|
|
124
|
+
operationId: string;
|
|
125
|
+
requestHash: string;
|
|
126
|
+
};
|
|
127
|
+
export declare function deleteWorkspaceGatewayCustomModel(db: Database, input: DeleteWorkspaceProviderCustomModelInput): Promise<{
|
|
128
|
+
outcome: "success";
|
|
129
|
+
model: WorkspaceGatewayCustomModel;
|
|
130
|
+
} | {
|
|
131
|
+
outcome: "conflict";
|
|
132
|
+
} | {
|
|
133
|
+
outcome: "not_found";
|
|
134
|
+
}>;
|
|
135
|
+
export declare function deleteWorkspaceOpenRouterCustomModel(db: Database, input: DeleteWorkspaceProviderCustomModelInput): Promise<{
|
|
136
|
+
outcome: "success";
|
|
137
|
+
model: WorkspaceOpenRouterCustomModel;
|
|
138
|
+
} | {
|
|
139
|
+
outcome: "conflict";
|
|
140
|
+
} | {
|
|
141
|
+
outcome: "not_found";
|
|
142
|
+
}>;
|
|
143
|
+
export declare function getWorkspaceGatewayCustomModelForExecution(db: Database, input: {
|
|
144
|
+
accountId: string;
|
|
145
|
+
workspaceId: string;
|
|
146
|
+
upstreamModelId: string;
|
|
147
|
+
}): Promise<WorkspaceGatewayCustomModel | null>;
|
|
148
|
+
export declare function getWorkspaceOpenRouterCustomModelForExecution(db: Database, input: {
|
|
149
|
+
accountId: string;
|
|
150
|
+
workspaceId: string;
|
|
151
|
+
upstreamModelId: string;
|
|
152
|
+
}): Promise<WorkspaceOpenRouterCustomModel | null>;
|
|
153
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ModelContextSnapshot, SessionModelContextResponse } from "@opengeni/contracts";
|
|
2
|
+
import type { Database } from "./database.js";
|
|
3
|
+
export declare class ModelContextSnapshotAuthorityError extends Error {
|
|
4
|
+
readonly code = "model_context_snapshot_authority_mismatch";
|
|
5
|
+
constructor();
|
|
6
|
+
}
|
|
7
|
+
export declare function persistModelContextSnapshot(db: Database, input: {
|
|
8
|
+
accountId: string;
|
|
9
|
+
workspaceId: string;
|
|
10
|
+
sessionId: string;
|
|
11
|
+
turnId: string;
|
|
12
|
+
attemptId: string;
|
|
13
|
+
executionGeneration: number;
|
|
14
|
+
snapshot: ModelContextSnapshot;
|
|
15
|
+
}): Promise<void>;
|
|
16
|
+
export declare function getLatestSessionModelContext(db: Database, input: {
|
|
17
|
+
accountId: string;
|
|
18
|
+
workspaceId: string;
|
|
19
|
+
sessionId: string;
|
|
20
|
+
}): Promise<SessionModelContextResponse>;
|
|
@@ -69,6 +69,18 @@ export declare function rememberNewSessionSelectionInTransaction(db: Database, i
|
|
|
69
69
|
subjectId: string;
|
|
70
70
|
acceptedSelection: AcceptedNewSessionSelection;
|
|
71
71
|
}): Promise<boolean>;
|
|
72
|
+
/**
|
|
73
|
+
* Fence a fresh session shell on the exact actor-private draft it represents.
|
|
74
|
+
* The caller keeps this row lock through its create transaction, so a draft
|
|
75
|
+
* that was already stale cannot leave a committed, uninitialized session.
|
|
76
|
+
* The later atomic initializer still performs the authoritative consume.
|
|
77
|
+
*/
|
|
78
|
+
export declare function assertExactNewSessionDraftInTransaction(db: Database, input: {
|
|
79
|
+
workspaceId: string;
|
|
80
|
+
subjectId: string;
|
|
81
|
+
expectedRevision: number;
|
|
82
|
+
expectedSnapshot: NewSessionDraftSnapshot;
|
|
83
|
+
}): Promise<void>;
|
|
72
84
|
/**
|
|
73
85
|
* Replace one exact accepted draft with the next-create safe seed. The row is
|
|
74
86
|
* identity-serialized before the revision check so even the absent-row
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CreateOrganizationResponse as CreateOrganizationResponseType, type OrganizationAdministrationMember as OrganizationAdministrationMemberType, type OrganizationAdministrationOverview as OrganizationAdministrationOverviewType, type OrganizationInvitation as OrganizationInvitationType, type OrganizationMember as OrganizationMemberType, type OrganizationPrivateSessionSettings as OrganizationPrivateSessionSettingsType, type OrganizationMembershipRole, type OrganizationRetentionDeletionClaim as OrganizationRetentionDeletionClaimType, type OrganizationRetentionDatabaseFinalization as OrganizationRetentionDatabaseFinalizationType, type OrganizationRetentionDeletionObject as OrganizationRetentionDeletionObjectType, type OrganizationRetentionDeletionPreview as OrganizationRetentionDeletionPreviewType, type OrganizationRetentionDeletionResult as OrganizationRetentionDeletionResultType, type OrganizationRetentionPolicy as OrganizationRetentionPolicyType, type OrganizationSummary as OrganizationSummaryType, type OrganizationWorkspaceAccess as OrganizationWorkspaceAccessType, type PutOrganizationWorkspaceMemberRequest, type RevokeOrganizationWorkspaceMemberResponse as RevokeOrganizationWorkspaceMemberResponseType, type UpdateOrganizationMemberRequest } from "@opengeni/contracts";
|
|
1
|
+
import { type CreateAdditionalOrganizationResponse as CreateAdditionalOrganizationResponseType, type CreateOrganizationResponse as CreateOrganizationResponseType, type OrganizationAdministrationMember as OrganizationAdministrationMemberType, type OrganizationAdministrationOverview as OrganizationAdministrationOverviewType, type OrganizationInvitation as OrganizationInvitationType, type OrganizationMember as OrganizationMemberType, type OrganizationPrivateSessionSettings as OrganizationPrivateSessionSettingsType, type OrganizationMembershipRole, type OrganizationRetentionDeletionClaim as OrganizationRetentionDeletionClaimType, type OrganizationRetentionDatabaseFinalization as OrganizationRetentionDatabaseFinalizationType, type OrganizationRetentionDeletionObject as OrganizationRetentionDeletionObjectType, type OrganizationRetentionDeletionPreview as OrganizationRetentionDeletionPreviewType, type OrganizationRetentionDeletionResult as OrganizationRetentionDeletionResultType, type OrganizationRetentionPolicy as OrganizationRetentionPolicyType, type OrganizationSummary as OrganizationSummaryType, type OrganizationWorkspaceAccess as OrganizationWorkspaceAccessType, type PutOrganizationWorkspaceMemberRequest, type RevokeOrganizationWorkspaceMemberResponse as RevokeOrganizationWorkspaceMemberResponseType, type UpdateOrganizationMemberRequest } from "@opengeni/contracts";
|
|
2
2
|
import type { Database } from "./database.js";
|
|
3
3
|
export declare function createManagedOrganization(db: Database, input: {
|
|
4
4
|
subjectId: string;
|
|
@@ -6,6 +6,13 @@ export declare function createManagedOrganization(db: Database, input: {
|
|
|
6
6
|
name: string;
|
|
7
7
|
operationId: string;
|
|
8
8
|
}): Promise<CreateOrganizationResponseType>;
|
|
9
|
+
export declare function createAdditionalManagedOrganization(db: Database, input: {
|
|
10
|
+
subjectId: string;
|
|
11
|
+
subjectLabel: string;
|
|
12
|
+
name: string;
|
|
13
|
+
workspaceName: string;
|
|
14
|
+
operationId: string;
|
|
15
|
+
}): Promise<CreateAdditionalOrganizationResponseType>;
|
|
9
16
|
type CommandBase = {
|
|
10
17
|
organizationId: string;
|
|
11
18
|
actorSubjectId: string;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { type Settings } from "@opengeni/config";
|
|
2
|
+
import { type Database } from "./database.js";
|
|
3
|
+
export type OrganizationModelProviderKind = "vercel_gateway" | "openrouter";
|
|
4
|
+
export type OrganizationModelProviderConnection = {
|
|
5
|
+
providerKind: OrganizationModelProviderKind;
|
|
6
|
+
status: "active" | "revoked";
|
|
7
|
+
version: number;
|
|
8
|
+
createdAt: Date;
|
|
9
|
+
updatedAt: Date;
|
|
10
|
+
};
|
|
11
|
+
export type OrganizationModelProviderCustomModel = {
|
|
12
|
+
id: string;
|
|
13
|
+
accountId: string;
|
|
14
|
+
providerKind: OrganizationModelProviderKind;
|
|
15
|
+
upstreamModelId: string;
|
|
16
|
+
label: string | null;
|
|
17
|
+
version: number;
|
|
18
|
+
retiredAt: Date | null;
|
|
19
|
+
createdAt: Date;
|
|
20
|
+
updatedAt: Date;
|
|
21
|
+
};
|
|
22
|
+
export declare class OrganizationModelProviderConflictError extends Error {
|
|
23
|
+
}
|
|
24
|
+
export declare class OrganizationModelProviderLimitError extends Error {
|
|
25
|
+
}
|
|
26
|
+
export declare function organizationModelProviderCredentialDigest(credential: string): string;
|
|
27
|
+
export declare function getOrganizationModelProviderConnection(db: Database, input: {
|
|
28
|
+
organizationId: string;
|
|
29
|
+
actorSubjectId: string;
|
|
30
|
+
providerKind: OrganizationModelProviderKind;
|
|
31
|
+
}): Promise<OrganizationModelProviderConnection | null>;
|
|
32
|
+
export declare function upsertOrganizationModelProviderConnection(db: Database, input: {
|
|
33
|
+
organizationId: string;
|
|
34
|
+
actorSubjectId: string;
|
|
35
|
+
providerKind: OrganizationModelProviderKind;
|
|
36
|
+
credentialEncrypted: string;
|
|
37
|
+
credentialDigest: string;
|
|
38
|
+
operationId: string;
|
|
39
|
+
expectedVersion?: number;
|
|
40
|
+
}): Promise<OrganizationModelProviderConnection>;
|
|
41
|
+
export declare function revokeOrganizationModelProviderConnection(db: Database, input: {
|
|
42
|
+
organizationId: string;
|
|
43
|
+
actorSubjectId: string;
|
|
44
|
+
providerKind: OrganizationModelProviderKind;
|
|
45
|
+
operationId: string;
|
|
46
|
+
expectedVersion: number;
|
|
47
|
+
}): Promise<OrganizationModelProviderConnection>;
|
|
48
|
+
export declare function organizationModelProviderConnectionActiveForWorkspace(db: Database, input: {
|
|
49
|
+
accountId: string;
|
|
50
|
+
workspaceId: string;
|
|
51
|
+
providerKind: OrganizationModelProviderKind;
|
|
52
|
+
}): Promise<boolean>;
|
|
53
|
+
export declare function loadOrganizationModelProviderApiKey(db: Database, settings: Settings, input: {
|
|
54
|
+
accountId: string;
|
|
55
|
+
workspaceId: string;
|
|
56
|
+
providerKind: OrganizationModelProviderKind;
|
|
57
|
+
}): Promise<string | null>;
|
|
58
|
+
export declare function listOrganizationModelProviderCustomModelsForWorkspace(db: Database, input: {
|
|
59
|
+
accountId: string;
|
|
60
|
+
workspaceId: string;
|
|
61
|
+
providerKind: OrganizationModelProviderKind;
|
|
62
|
+
includeRetired?: boolean;
|
|
63
|
+
}): Promise<OrganizationModelProviderCustomModel[]>;
|
|
64
|
+
export declare function getOrganizationModelProviderCustomModelForExecution(db: Database, input: {
|
|
65
|
+
accountId: string;
|
|
66
|
+
workspaceId: string;
|
|
67
|
+
providerKind: OrganizationModelProviderKind;
|
|
68
|
+
upstreamModelId: string;
|
|
69
|
+
}): Promise<OrganizationModelProviderCustomModel | null>;
|
|
70
|
+
export declare function withOrganizationModelProviderCustomModelReadLock<T>(db: Database, input: {
|
|
71
|
+
accountId: string;
|
|
72
|
+
workspaceId: string;
|
|
73
|
+
providerKind: OrganizationModelProviderKind;
|
|
74
|
+
}, use: (scopedDb: Database) => Promise<T>): Promise<T>;
|
|
75
|
+
export declare function lockActiveOrganizationModelProviderCustomModelForAdmission(db: Database, input: {
|
|
76
|
+
accountId: string;
|
|
77
|
+
workspaceId: string;
|
|
78
|
+
providerKind: OrganizationModelProviderKind;
|
|
79
|
+
upstreamModelId: string;
|
|
80
|
+
}): Promise<OrganizationModelProviderCustomModel | null>;
|
|
81
|
+
export declare function listOrganizationModelProviderCustomModels(db: Database, input: {
|
|
82
|
+
organizationId: string;
|
|
83
|
+
actorSubjectId: string;
|
|
84
|
+
providerKind: OrganizationModelProviderKind;
|
|
85
|
+
}): Promise<OrganizationModelProviderCustomModel[]>;
|
|
86
|
+
export declare function createOrganizationModelProviderCustomModel(db: Database, input: {
|
|
87
|
+
organizationId: string;
|
|
88
|
+
actorSubjectId: string;
|
|
89
|
+
providerKind: OrganizationModelProviderKind;
|
|
90
|
+
upstreamModelId: string;
|
|
91
|
+
label?: string;
|
|
92
|
+
operationId: string;
|
|
93
|
+
}): Promise<OrganizationModelProviderCustomModel>;
|
|
94
|
+
export declare function retireOrganizationModelProviderCustomModel(db: Database, input: {
|
|
95
|
+
organizationId: string;
|
|
96
|
+
actorSubjectId: string;
|
|
97
|
+
providerKind: OrganizationModelProviderKind;
|
|
98
|
+
customModelId: string;
|
|
99
|
+
expectedVersion: number;
|
|
100
|
+
operationId: string;
|
|
101
|
+
}): Promise<OrganizationModelProviderCustomModel>;
|
package/dist/pr-review.d.ts
CHANGED
|
@@ -68,6 +68,8 @@ export declare function createPrReviewRepositoryBinding(db: Database, input: {
|
|
|
68
68
|
eventTypes: string[];
|
|
69
69
|
configuration: Record<string, unknown>;
|
|
70
70
|
sessionTemplate: AutomationSessionTemplate;
|
|
71
|
+
/** Trusted database-only admission seam. Throwing rolls the binding and trigger back. */
|
|
72
|
+
beforeCreateCommit?: (tx: Database) => Promise<void>;
|
|
71
73
|
}): Promise<PrReviewRepositoryBinding>;
|
|
72
74
|
/** Atomically converge one owner-authorized installation of the deployment
|
|
73
75
|
* review App onto the Pack's ordinary source/trigger/binding model. Re-running
|
|
@@ -116,6 +118,13 @@ export declare function updatePrReviewRepositoryBinding(db: Database, input: {
|
|
|
116
118
|
model?: string | null;
|
|
117
119
|
additionalInstructions?: string | null;
|
|
118
120
|
status?: "active" | "disabled";
|
|
121
|
+
/** Trusted database-only admission seam. Throwing rolls the binding revision back. */
|
|
122
|
+
beforeUpdateCommit?: (tx: Database, context: {
|
|
123
|
+
currentModel: string | null;
|
|
124
|
+
currentStatus: "active" | "disabled";
|
|
125
|
+
nextModel: string | null;
|
|
126
|
+
nextStatus: "active" | "disabled";
|
|
127
|
+
}) => Promise<void>;
|
|
119
128
|
}): Promise<PrReviewRepositoryBinding | null>;
|
|
120
129
|
export declare function deletePrReviewRepositoryBinding(db: Database, input: {
|
|
121
130
|
accountId: string;
|