@opengeni/db 0.16.2 → 0.18.1
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/{chunk-4RUK5CON.js → chunk-T6RSJT6C.js} +20 -2
- package/dist/chunk-T6RSJT6C.js.map +1 -0
- package/dist/{chunk-HZD7KVAR.js → chunk-YKWJ7QJ2.js} +369 -17
- package/dist/chunk-YKWJ7QJ2.js.map +1 -0
- package/dist/index.d.ts +225 -0
- package/dist/index.js +3735 -2488
- package/dist/index.js.map +1 -1
- package/dist/provision-roles.js +1 -1
- package/dist/runtime-posture.d.ts +3 -3
- package/dist/schema.d.ts +2631 -749
- package/dist/schema.js +15 -1
- package/dist/workspace-artifacts.d.ts +62 -0
- package/drizzle/0141_social_connection_credentials.sql +8 -0
- package/drizzle/0149_workspace_artifacts.sql +348 -0
- package/drizzle/0150_slack_task_interactions.sql +344 -0
- package/drizzle/0151_slack_delivery_backoff.sql +134 -0
- package/package.json +3 -3
- package/src/index.ts +1217 -12
- package/src/runtime-posture.ts +19 -1
- package/src/schema.ts +409 -16
- package/src/workspace-artifacts.ts +751 -0
- package/dist/chunk-4RUK5CON.js.map +0 -1
- package/dist/chunk-HZD7KVAR.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -680,9 +680,28 @@ export type CreateSocialConnectionInput = {
|
|
|
680
680
|
status: SocialConnectionStatus;
|
|
681
681
|
scopes?: string[];
|
|
682
682
|
credentialRef?: string | null;
|
|
683
|
+
credentialEncrypted?: string | null;
|
|
683
684
|
tokenMetadata?: Record<string, unknown>;
|
|
684
685
|
metadata?: Record<string, unknown>;
|
|
685
686
|
};
|
|
687
|
+
export type UpsertSocialOAuthConnectionInput = {
|
|
688
|
+
accountId: string;
|
|
689
|
+
workspaceId: string;
|
|
690
|
+
provider: SocialProvider;
|
|
691
|
+
accountHandle: string;
|
|
692
|
+
accountName?: string | null;
|
|
693
|
+
externalAccountId?: string | null;
|
|
694
|
+
scopes: string[];
|
|
695
|
+
credentialEncrypted: string;
|
|
696
|
+
tokenMetadata?: Record<string, unknown>;
|
|
697
|
+
};
|
|
698
|
+
export type UpdateSocialConnectionCredentialInput = {
|
|
699
|
+
workspaceId: string;
|
|
700
|
+
connectionId: string;
|
|
701
|
+
credentialEncrypted?: string | null;
|
|
702
|
+
status?: SocialConnectionStatus;
|
|
703
|
+
tokenMetadata?: Record<string, unknown>;
|
|
704
|
+
};
|
|
686
705
|
export type CreateSocialPostInput = {
|
|
687
706
|
accountId: string;
|
|
688
707
|
workspaceId: string;
|
|
@@ -1135,6 +1154,173 @@ export declare function listConnectionsMetadata(db: Database, workspaceId: strin
|
|
|
1135
1154
|
export declare function getConnectionMetadata(db: Database, workspaceId: string, connectionId: string, subjectId?: string | null): Promise<ConnectionMetadataWithVerification | null>;
|
|
1136
1155
|
export declare function updateConnection(db: Database, input: UpdateConnectionInput): Promise<ConnectionMetadataWithVerification | null>;
|
|
1137
1156
|
export declare function revokeConnection(db: Database, workspaceId: string, connectionId: string, updatedBySubjectId?: string | null): Promise<ConnectionMetadataWithVerification | null>;
|
|
1157
|
+
export type SlackInstallationRoute = {
|
|
1158
|
+
accountId: string;
|
|
1159
|
+
workspaceId: string;
|
|
1160
|
+
connectionId: string;
|
|
1161
|
+
botId: string;
|
|
1162
|
+
botUserId: string;
|
|
1163
|
+
};
|
|
1164
|
+
export type SlackBotUserLink = {
|
|
1165
|
+
id: string;
|
|
1166
|
+
accountId: string;
|
|
1167
|
+
workspaceId: string;
|
|
1168
|
+
connectionId: string;
|
|
1169
|
+
slackTeamId: string;
|
|
1170
|
+
slackUserId: string;
|
|
1171
|
+
subjectId: string;
|
|
1172
|
+
linkedBySubjectId: string;
|
|
1173
|
+
createdAt: Date;
|
|
1174
|
+
updatedAt: Date;
|
|
1175
|
+
};
|
|
1176
|
+
export type SlackInteractionTriggerKind = "app_mention" | "dm" | "slash_command" | "message_shortcut" | "thread_reply";
|
|
1177
|
+
export type SlackInteractionInboxEntry = {
|
|
1178
|
+
id: string;
|
|
1179
|
+
accountId: string;
|
|
1180
|
+
workspaceId: string;
|
|
1181
|
+
connectionId: string;
|
|
1182
|
+
providerEventId: string;
|
|
1183
|
+
providerMessageId: string;
|
|
1184
|
+
slackTeamId: string;
|
|
1185
|
+
slackUserId: string;
|
|
1186
|
+
slackChannelId: string;
|
|
1187
|
+
slackMessageTs: string;
|
|
1188
|
+
slackThreadTs: string | null;
|
|
1189
|
+
triggerKind: SlackInteractionTriggerKind;
|
|
1190
|
+
text: string;
|
|
1191
|
+
status: "pending" | "processing" | "processed" | "failed";
|
|
1192
|
+
claimHolderId: string | null;
|
|
1193
|
+
claimExpiresAt: Date | null;
|
|
1194
|
+
attemptCount: number;
|
|
1195
|
+
retryAt: Date | null;
|
|
1196
|
+
lastErrorCode: string | null;
|
|
1197
|
+
processedAt: Date | null;
|
|
1198
|
+
createdAt: Date;
|
|
1199
|
+
updatedAt: Date;
|
|
1200
|
+
};
|
|
1201
|
+
export type SlackInteraction = {
|
|
1202
|
+
id: string;
|
|
1203
|
+
accountId: string;
|
|
1204
|
+
workspaceId: string;
|
|
1205
|
+
connectionId: string;
|
|
1206
|
+
slackTeamId: string;
|
|
1207
|
+
slackChannelId: string;
|
|
1208
|
+
slackThreadTs: string;
|
|
1209
|
+
routeKey: string;
|
|
1210
|
+
triggeringProviderEventId: string;
|
|
1211
|
+
owningSubjectId: string;
|
|
1212
|
+
visibility: "private" | "workspace";
|
|
1213
|
+
sessionReservationId: string;
|
|
1214
|
+
sessionId: string | null;
|
|
1215
|
+
lastDeliveredSessionEventSequence: number;
|
|
1216
|
+
deliveryClaimHolderId: string | null;
|
|
1217
|
+
deliveryClaimExpiresAt: Date | null;
|
|
1218
|
+
deliveryAttemptCount: number;
|
|
1219
|
+
deliveryRetryAt: Date | null;
|
|
1220
|
+
deliveryLastErrorCode: string | null;
|
|
1221
|
+
ackSlackMessageTs: string | null;
|
|
1222
|
+
progressCount: number;
|
|
1223
|
+
terminalDeliveryState: "open" | "completed" | "failed" | "cancelled" | "blocked";
|
|
1224
|
+
createdAt: Date;
|
|
1225
|
+
updatedAt: Date;
|
|
1226
|
+
};
|
|
1227
|
+
export type SlackInteractionProgressDelivery = {
|
|
1228
|
+
id: string;
|
|
1229
|
+
accountId: string;
|
|
1230
|
+
workspaceId: string;
|
|
1231
|
+
interactionId: string;
|
|
1232
|
+
sessionEventSequence: number;
|
|
1233
|
+
slot: number;
|
|
1234
|
+
operationId: string;
|
|
1235
|
+
createdAt: Date;
|
|
1236
|
+
};
|
|
1237
|
+
export declare function resolveSlackInstallationRoute(db: Database, slackTeamId: string): Promise<SlackInstallationRoute | null>;
|
|
1238
|
+
export declare function saveSlackBotUserLink(db: Database, input: Omit<SlackBotUserLink, "id" | "createdAt" | "updatedAt">): Promise<SlackBotUserLink>;
|
|
1239
|
+
export declare function getSlackBotUserLink(db: Database, workspaceId: string, connectionId: string, slackUserId: string): Promise<SlackBotUserLink | null>;
|
|
1240
|
+
export declare function deleteSlackBotUserLink(db: Database, workspaceId: string, connectionId: string, slackUserId: string): Promise<boolean>;
|
|
1241
|
+
export declare function enqueueSlackInteractionInbox(db: Database, input: Omit<SlackInteractionInboxEntry, "id" | "status" | "claimHolderId" | "claimExpiresAt" | "attemptCount" | "retryAt" | "lastErrorCode" | "processedAt" | "createdAt" | "updatedAt">): Promise<{
|
|
1242
|
+
inserted: boolean;
|
|
1243
|
+
entry: SlackInteractionInboxEntry;
|
|
1244
|
+
}>;
|
|
1245
|
+
export declare function claimSlackInteractionInbox(db: Database, claimHolderId: string, claimLeaseMs: number): Promise<SlackInteractionInboxEntry | null>;
|
|
1246
|
+
export declare function settleSlackInteractionInbox(db: Database, input: {
|
|
1247
|
+
entry: Pick<SlackInteractionInboxEntry, "id" | "accountId" | "workspaceId">;
|
|
1248
|
+
claimHolderId: string;
|
|
1249
|
+
outcome: "processed" | "failed";
|
|
1250
|
+
errorCode?: string | null;
|
|
1251
|
+
}): Promise<boolean>;
|
|
1252
|
+
export declare function releaseSlackInteractionInbox(db: Database, input: {
|
|
1253
|
+
entry: Pick<SlackInteractionInboxEntry, "id" | "accountId" | "workspaceId">;
|
|
1254
|
+
claimHolderId: string;
|
|
1255
|
+
errorCode: string;
|
|
1256
|
+
retryAt: Date;
|
|
1257
|
+
}): Promise<boolean>;
|
|
1258
|
+
export declare function getOrCreateSlackInteraction(db: Database, input: Omit<SlackInteraction, "id" | "sessionReservationId" | "sessionId" | "lastDeliveredSessionEventSequence" | "deliveryClaimHolderId" | "deliveryClaimExpiresAt" | "deliveryAttemptCount" | "deliveryRetryAt" | "deliveryLastErrorCode" | "ackSlackMessageTs" | "progressCount" | "terminalDeliveryState" | "createdAt" | "updatedAt">): Promise<{
|
|
1259
|
+
created: boolean;
|
|
1260
|
+
interaction: SlackInteraction;
|
|
1261
|
+
}>;
|
|
1262
|
+
export declare function getSlackInteractionByRoute(db: Database, workspaceId: string, connectionId: string, routeKey: string): Promise<SlackInteraction | null>;
|
|
1263
|
+
export declare function getSlackInteractionSessionAccess(db: Database, workspaceId: string, rootSessionId: string): Promise<Pick<SlackInteraction, "owningSubjectId" | "visibility"> | null>;
|
|
1264
|
+
export declare function getSlackInteractionSessionAccessForSession(db: Database, input: {
|
|
1265
|
+
accountId: string;
|
|
1266
|
+
workspaceId: string;
|
|
1267
|
+
sessionId: string;
|
|
1268
|
+
}): Promise<(Pick<SlackInteraction, "owningSubjectId" | "visibility"> & {
|
|
1269
|
+
rootSessionId: string;
|
|
1270
|
+
}) | null>;
|
|
1271
|
+
export declare function bindSlackInteractionSession(db: Database, input: Pick<SlackInteraction, "id" | "accountId" | "workspaceId" | "owningSubjectId"> & {
|
|
1272
|
+
sessionId: string;
|
|
1273
|
+
}): Promise<SlackInteraction | null>;
|
|
1274
|
+
export type SlackInteractionProgressClaim = {
|
|
1275
|
+
kind: "claimed";
|
|
1276
|
+
created: boolean;
|
|
1277
|
+
progressCount: number;
|
|
1278
|
+
delivery: SlackInteractionProgressDelivery;
|
|
1279
|
+
} | {
|
|
1280
|
+
kind: "limit_reached";
|
|
1281
|
+
progressCount: number;
|
|
1282
|
+
} | {
|
|
1283
|
+
kind: "not_owned";
|
|
1284
|
+
};
|
|
1285
|
+
/**
|
|
1286
|
+
* Reserve one globally bounded progress slot before any Slack provider call.
|
|
1287
|
+
* The interaction row lock serializes replicas and expired delivery claim
|
|
1288
|
+
* successors; the event row preserves one operation UUID across every retry.
|
|
1289
|
+
*/
|
|
1290
|
+
export declare function claimSlackInteractionProgressDelivery(db: Database, input: {
|
|
1291
|
+
accountId: string;
|
|
1292
|
+
workspaceId: string;
|
|
1293
|
+
interactionId: string;
|
|
1294
|
+
claimHolderId: string;
|
|
1295
|
+
sessionEventSequence: number;
|
|
1296
|
+
maxProgress: number;
|
|
1297
|
+
}): Promise<SlackInteractionProgressClaim>;
|
|
1298
|
+
export declare function rekeySlackInteractionRoute(db: Database, input: Pick<SlackInteraction, "id" | "accountId" | "workspaceId"> & {
|
|
1299
|
+
routeKey: string;
|
|
1300
|
+
slackThreadTs: string;
|
|
1301
|
+
ackSlackMessageTs: string;
|
|
1302
|
+
}): Promise<SlackInteraction | null>;
|
|
1303
|
+
export declare function claimSlackInteractionDelivery(db: Database, claimHolderId: string, claimLeaseMs: number): Promise<SlackInteraction | null>;
|
|
1304
|
+
export declare function reopenSlackInteractionDelivery(db: Database, input: Pick<SlackInteraction, "id" | "accountId" | "workspaceId">): Promise<boolean>;
|
|
1305
|
+
export declare function advanceSlackInteractionDelivery(db: Database, input: Pick<SlackInteraction, "id" | "accountId" | "workspaceId"> & {
|
|
1306
|
+
claimHolderId: string;
|
|
1307
|
+
sequence: number;
|
|
1308
|
+
ackSlackMessageTs?: string | null;
|
|
1309
|
+
}): Promise<boolean>;
|
|
1310
|
+
export declare function releaseSlackInteractionDelivery(db: Database, input: Pick<SlackInteraction, "id" | "accountId" | "workspaceId"> & {
|
|
1311
|
+
claimHolderId: string;
|
|
1312
|
+
}): Promise<boolean>;
|
|
1313
|
+
export declare function deferSlackInteractionDelivery(db: Database, input: Pick<SlackInteraction, "id" | "accountId" | "workspaceId"> & {
|
|
1314
|
+
claimHolderId: string;
|
|
1315
|
+
retryAt: Date;
|
|
1316
|
+
errorCode: string;
|
|
1317
|
+
}): Promise<boolean>;
|
|
1318
|
+
export declare function closeSlackInteractionDelivery(db: Database, input: Pick<SlackInteraction, "id" | "accountId" | "workspaceId"> & {
|
|
1319
|
+
claimHolderId: string;
|
|
1320
|
+
sequence: number;
|
|
1321
|
+
state: Exclude<SlackInteraction["terminalDeliveryState"], "open">;
|
|
1322
|
+
errorCode?: string | null;
|
|
1323
|
+
}): Promise<boolean>;
|
|
1138
1324
|
export declare class SlackBotLifecycleSuccessAuditError extends Error {
|
|
1139
1325
|
constructor();
|
|
1140
1326
|
}
|
|
@@ -1370,10 +1556,48 @@ export declare function correctWorkspaceMemory(db: Database, input: CorrectWorks
|
|
|
1370
1556
|
export declare function searchWorkspaceMemories(db: Database, workspaceId: string, input: WorkspaceMemorySearchInput, embedder?: MemoryEmbedder): Promise<WorkspaceMemorySearchResult[]>;
|
|
1371
1557
|
export declare function resolveWorkspaceMemoryBlock(db: Database, workspaceId: string): Promise<string | null>;
|
|
1372
1558
|
export declare function createSocialConnection(db: Database, input: CreateSocialConnectionInput): Promise<SocialConnection>;
|
|
1559
|
+
/**
|
|
1560
|
+
* OAuth-callback persistence: reconnecting the same provider account replaces
|
|
1561
|
+
* the stored credential and revives the connection instead of failing on the
|
|
1562
|
+
* (workspace, provider, handle) unique index.
|
|
1563
|
+
*/
|
|
1564
|
+
export declare function upsertSocialOAuthConnection(db: Database, input: UpsertSocialOAuthConnectionInput): Promise<SocialConnection>;
|
|
1565
|
+
/**
|
|
1566
|
+
* Host-side credential read for the social API client. Deliberately not part
|
|
1567
|
+
* of mapSocialConnection so the encrypted bundle never rides along on list or
|
|
1568
|
+
* MCP responses.
|
|
1569
|
+
*/
|
|
1570
|
+
export declare function loadSocialConnectionCredential(db: Database, workspaceId: string, connectionId: string): Promise<{
|
|
1571
|
+
connection: SocialConnection;
|
|
1572
|
+
credentialEncrypted: string | null;
|
|
1573
|
+
} | null>;
|
|
1574
|
+
export declare function updateSocialConnectionCredential(db: Database, input: UpdateSocialConnectionCredentialInput): Promise<SocialConnection | null>;
|
|
1373
1575
|
export declare function listSocialConnections(db: Database, workspaceId: string, limit?: number): Promise<SocialConnection[]>;
|
|
1374
1576
|
export declare function getSocialConnection(db: Database, workspaceId: string, connectionId: string): Promise<SocialConnection | null>;
|
|
1375
1577
|
export declare function requireSocialConnection(db: Database, workspaceId: string, connectionId: string): Promise<SocialConnection>;
|
|
1376
1578
|
export declare function createSocialPost(db: Database, input: CreateSocialPostInput): Promise<SocialPost>;
|
|
1579
|
+
/**
|
|
1580
|
+
* Idempotent bulk ingest for provider sync: rows already present under the
|
|
1581
|
+
* (workspace, connection, external post id) unique index are skipped, so a
|
|
1582
|
+
* scheduled re-sync never duplicates or fails.
|
|
1583
|
+
*/
|
|
1584
|
+
export declare function recordSyncedSocialPosts(db: Database, input: {
|
|
1585
|
+
accountId: string;
|
|
1586
|
+
workspaceId: string;
|
|
1587
|
+
connectionId: string;
|
|
1588
|
+
posts: Array<{
|
|
1589
|
+
externalPostId: string;
|
|
1590
|
+
url?: string | null;
|
|
1591
|
+
authorHandle?: string | null;
|
|
1592
|
+
text: string;
|
|
1593
|
+
publishedAt: Date;
|
|
1594
|
+
metrics?: Record<string, number>;
|
|
1595
|
+
raw?: Record<string, unknown>;
|
|
1596
|
+
}>;
|
|
1597
|
+
}): Promise<{
|
|
1598
|
+
inserted: number;
|
|
1599
|
+
skipped: number;
|
|
1600
|
+
}>;
|
|
1377
1601
|
export declare function listSocialPosts(db: Database, options: {
|
|
1378
1602
|
workspaceId: string;
|
|
1379
1603
|
connectionIds?: string[];
|
|
@@ -6215,3 +6439,4 @@ export declare function appendSessionEventsWithLockedSessionUpdate(db: Database,
|
|
|
6215
6439
|
export declare function sessionSubject(workspaceId: string, sessionId: string): string;
|
|
6216
6440
|
export * from "./codex-token-resolver";
|
|
6217
6441
|
export * from "./connection-token-resolver";
|
|
6442
|
+
export * from "./workspace-artifacts";
|