@opengeni/db 0.28.9 → 0.36.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/attached-browser-devices.d.ts +42 -0
- package/dist/attempt-tool-catalogs.d.ts +16 -0
- package/dist/browser-auth.d.ts +299 -0
- package/dist/browser-downloads.d.ts +51 -0
- package/dist/browser-identities.d.ts +137 -0
- package/dist/browser-sessions.d.ts +354 -0
- package/dist/browser-state-artifacts.d.ts +91 -0
- package/dist/canonical-human-identities.d.ts +48 -0
- package/dist/canonical-human-identities.js +28 -0
- package/dist/canonical-human-identities.js.map +1 -0
- package/dist/capability-components.d.ts +37 -0
- package/dist/capability-integrations.d.ts +194 -0
- package/dist/chunk-5KTIEDX7.js +13200 -0
- package/dist/chunk-5KTIEDX7.js.map +1 -0
- package/dist/chunk-CQZ4QSP5.js +995 -0
- package/dist/chunk-CQZ4QSP5.js.map +1 -0
- package/dist/chunk-F32YT7MP.js +117 -0
- package/dist/chunk-F32YT7MP.js.map +1 -0
- package/dist/chunk-JC5QPLUM.js +666 -0
- package/dist/chunk-JC5QPLUM.js.map +1 -0
- package/dist/chunk-P3RE4D2B.js +3535 -0
- package/dist/chunk-P3RE4D2B.js.map +1 -0
- package/dist/chunk-TAUTWOS5.js +259 -0
- package/dist/chunk-TAUTWOS5.js.map +1 -0
- package/dist/chunk-VKLB2ZGI.js +2389 -0
- package/dist/chunk-VKLB2ZGI.js.map +1 -0
- package/dist/codemode-operations.d.ts +117 -0
- package/dist/codex-token-resolver.d.ts +2 -2
- package/dist/company-profile-schema.d.ts +798 -0
- package/dist/company-profile.d.ts +268 -0
- package/dist/computer-sessions.d.ts +109 -0
- package/dist/connection-token-resolver.d.ts +9 -4
- package/dist/database.d.ts +57 -3
- package/dist/editable-artifact-durable-export.d.ts +153 -0
- package/dist/editable-artifact-durable-export.js +788 -0
- package/dist/editable-artifact-durable-export.js.map +1 -0
- package/dist/editable-artifact-materialization.d.ts +123 -0
- package/dist/editable-artifacts-schema.d.ts +4152 -0
- package/dist/editable-artifacts.d.ts +610 -0
- package/dist/editable-artifacts.js +26 -0
- package/dist/editable-artifacts.js.map +1 -0
- package/dist/generated-images.d.ts +139 -0
- package/dist/index.d.ts +1122 -126
- package/dist/index.js +42329 -18407
- package/dist/index.js.map +1 -1
- package/dist/insights.d.ts +73 -10
- package/dist/integration-bindings.d.ts +70 -0
- package/dist/integration-facets.d.ts +99 -0
- package/dist/interaction-revisions.d.ts +14 -0
- package/dist/interaction-schema.d.ts +6036 -0
- package/dist/knowledge-source-sync-schema.d.ts +1679 -0
- package/dist/knowledge-source-sync.d.ts +274 -0
- package/dist/memory-governance.d.ts +2 -2
- package/dist/memory-slack-delivery.d.ts +101 -0
- package/dist/new-session-drafts.d.ts +2 -2
- package/dist/pack-components.d.ts +76 -0
- package/dist/pack-installations.d.ts +86 -0
- package/dist/persistence-errors.d.ts +3 -3
- package/dist/plugin-packages.d.ts +126 -0
- package/dist/preference-registry.d.ts +1 -1
- package/dist/provision-roles.d.ts +9 -1
- package/dist/provision-roles.js +1 -1
- package/dist/runtime-posture.d.ts +19 -6
- package/dist/schema.d.ts +22654 -9359
- package/dist/schema.js +209 -3
- package/dist/scoped-knowledge.d.ts +97 -1
- package/dist/session-control.d.ts +33 -7
- package/dist/session-queue-commands.d.ts +19 -11
- package/dist/session-realtime-context.d.ts +2 -2
- package/dist/session-realtime-ledger.d.ts +4 -4
- package/dist/session-realtime-mirror.d.ts +2 -2
- package/dist/session-realtime-state.d.ts +1 -1
- package/dist/session-realtime-terminal.d.ts +1 -1
- package/dist/session-realtime.d.ts +7 -7
- package/dist/session-tenancy.d.ts +44 -0
- package/dist/session-tenancy.js +16 -0
- package/dist/session-tenancy.js.map +1 -0
- package/dist/session-tool-call-settlement.d.ts +1 -1
- package/dist/slack-task-policy-schema.d.ts +847 -0
- package/dist/slack-task-policy.d.ts +65 -0
- package/dist/slack-user-link-access.d.ts +54 -0
- package/dist/task-notes-schema.d.ts +924 -0
- package/dist/task-notes.d.ts +85 -0
- package/dist/transcription-recordings.d.ts +2 -2
- package/dist/turn-initiator.d.ts +2 -2
- package/dist/video-generation.d.ts +225 -0
- package/dist/video-generation.js +68 -0
- package/dist/video-generation.js.map +1 -0
- package/dist/workspace-artifacts.d.ts +1 -1
- package/dist/workspace-instruction-policies.d.ts +1 -1
- package/dist/workspace-learning-policy-schema.d.ts +932 -0
- package/dist/workspace-learning-policy.d.ts +161 -0
- package/dist/xai-subscription.d.ts +326 -0
- package/drizzle/0183_model_call_provider_cost_estimates.sql +39 -0
- package/drizzle/0184_sandbox_drain_teardown_fence.sql +682 -0
- package/drizzle/0185_temporal_schedule_cleanup_outbox.sql +168 -0
- package/drizzle/0186_sandbox_capture_provider_contract.sql +400 -0
- package/drizzle/0187_generated_image_artifacts.sql +173 -0
- package/drizzle/0188_image_generation_retention_failure.sql +25 -0
- package/drizzle/0189_retained_session_image_formats.sql +13 -0
- package/drizzle/0190_timeline_annotations.sql +31 -0
- package/drizzle/0191_editable_artifact_engine.sql +3853 -0
- package/drizzle/0192_editable_artifact_live_tickets.sql +338 -0
- package/drizzle/0193_editable_artifact_authorization.sql +190 -0
- package/drizzle/0194_editable_artifact_durable_exports.sql +160 -0
- package/drizzle/0195_editable_artifact_import_authorization.sql +203 -0
- package/drizzle/0196_rig_provider_images.sql +152 -0
- package/drizzle/0197_knowledge_source_sync_schedules.sql +523 -0
- package/drizzle/0198_memory_slack_publication_delivery.sql +393 -0
- package/drizzle/0199_workspace_learning_policy.sql +980 -0
- package/drizzle/0201_company_profile_authority.sql +849 -0
- package/drizzle/0202_document_index_checkpoints.sql +85 -0
- package/drizzle/0203_durable_video_generation.sql +353 -0
- package/drizzle/0204_video_generation_funding.sql +44 -0
- package/drizzle/0205_attempt_tool_catalogs.sql +230 -0
- package/drizzle/0206_browser_sessions.sql +646 -0
- package/drizzle/0207_browser_identities.sql +379 -0
- package/drizzle/0208_attached_browser_devices.sql +165 -0
- package/drizzle/0209_computer_sessions.sql +575 -0
- package/drizzle/0210_browser_auth_network_interventions.sql +441 -0
- package/drizzle/0211_editable_artifact_session_links.sql +58 -0
- package/drizzle/0212_browser_state_transfer_hardening.sql +560 -0
- package/drizzle/0212_slack_installation_bindings.sql +348 -0
- package/drizzle/0213_browser_interaction_authority.sql +67 -0
- package/drizzle/0213_slack_user_link_access_requests.sql +177 -0
- package/drizzle/0214_browser_download_saves.sql +34 -0
- package/drizzle/0214_session_activity_commit_gate.sql +262 -0
- package/drizzle/0215_browser_controller_host.sql +385 -0
- package/drizzle/0215_capabilities_platform.sql +980 -0
- package/drizzle/0216_browser_auth_health_evidence.sql +137 -0
- package/drizzle/0216_pack_component_ownership.sql +235 -0
- package/drizzle/0217_capability_definition_delete_authority.sql +32 -0
- package/drizzle/0217_external_browser_auth_operations.sql +22 -0
- package/drizzle/0218_organization_tenancy_foundation.sql +299 -0
- package/drizzle/0219_organization_tenancy_managed_human_provisioning.sql +317 -0
- package/drizzle/0219_site_auth_maintenance_sessions.sql +234 -0
- package/drizzle/0220_memory_slack_append_only_cascade.sql +38 -0
- package/drizzle/0220_session_channels.sql +54 -0
- package/drizzle/0221_sessions_channel_index.sql +5 -0
- package/drizzle/0222_session_visibility_authority_epochs.sql +158 -0
- package/drizzle/0222_sessions_channel_fk.sql +89 -0
- package/drizzle/0223_pending_tool_event_output.sql +55 -0
- package/drizzle/0223_sessions_channel_fk_validate.sql +118 -0
- package/drizzle/0224_slack_post_outcome_reconciliation.sql +123 -0
- package/drizzle/0225_session_visibility_fork_activation.sql +1363 -0
- package/drizzle/0226_personal_codex_authority_foundation.sql +365 -0
- package/drizzle/0227_slack_native_actions.sql +145 -0
- package/drizzle/0228_interaction_controller_data_plane.sql +14 -0
- package/drizzle/0228_slack_task_policy.sql +400 -0
- package/drizzle/0229_slack_inbox_file_fact.sql +10 -0
- package/drizzle/0230_user_scoped_variable_sets_rigs.sql +84 -0
- package/drizzle/0231_integration_definition_identity_cutover.sql +271 -0
- package/drizzle/0232_integration_facet_authority_cutover.sql +610 -0
- package/drizzle/0233_skill_and_integration_authority_cutover.sql +1162 -0
- package/drizzle/0234_xai_subscription_authority.sql +1139 -0
- package/drizzle/0235_canonical_human_login_bindings.sql +920 -0
- package/drizzle/0236_browser_identity_lifecycle.sql +39 -0
- package/drizzle/0236_session_visibility_slack_policy.sql +72 -0
- package/drizzle/0237_interaction_transition_reaper.sql +263 -0
- package/drizzle/0238_goal_persistence_policy.sql +471 -0
- package/drizzle/0238_supergrok_realtime_model.sql +29 -0
- package/drizzle/0239_supergrok_video_funding.sql +50 -0
- package/drizzle/0239_task_tree_notes.sql +990 -0
- package/package.json +26 -5
- package/src/attached-browser-devices.ts +371 -0
- package/src/attempt-tool-catalogs.ts +131 -0
- package/src/browser-auth.ts +4373 -0
- package/src/browser-downloads.ts +517 -0
- package/src/browser-identities.ts +1385 -0
- package/src/browser-sessions.ts +2294 -0
- package/src/browser-state-artifacts.ts +449 -0
- package/src/canonical-human-identities.ts +317 -0
- package/src/capability-components.ts +166 -0
- package/src/capability-integrations.ts +1571 -0
- package/src/codemode-operations.ts +674 -0
- package/src/company-profile-schema.ts +143 -0
- package/src/company-profile.ts +968 -0
- package/src/computer-sessions.ts +1130 -0
- package/src/connection-token-resolver.ts +270 -25
- package/src/database.ts +468 -24
- package/src/editable-artifact-durable-export.ts +1201 -0
- package/src/editable-artifact-materialization.ts +893 -0
- package/src/editable-artifacts-schema.ts +879 -0
- package/src/editable-artifacts.ts +5404 -0
- package/src/generated-images.ts +740 -0
- package/src/index.ts +9963 -1465
- package/src/insights.ts +251 -23
- package/src/integration-bindings.ts +455 -0
- package/src/integration-facets.ts +862 -0
- package/src/interaction-revisions.ts +70 -0
- package/src/interaction-schema.ts +1606 -0
- package/src/knowledge-source-sync-schema.ts +192 -0
- package/src/knowledge-source-sync.ts +1922 -0
- package/src/memory-slack-delivery.ts +801 -0
- package/src/pack-components.ts +954 -0
- package/src/pack-installations.ts +886 -0
- package/src/persistence-errors.ts +4 -7
- package/src/plugin-packages.ts +1186 -0
- package/src/provision-roles.ts +534 -1
- package/src/runtime-posture-cli.ts +9 -0
- package/src/runtime-posture.ts +721 -5
- package/src/schema.ts +6270 -3159
- package/src/scoped-knowledge-schema.ts +1 -1
- package/src/scoped-knowledge.ts +655 -3
- package/src/session-control.ts +130 -42
- package/src/session-queue-commands.ts +265 -15
- package/src/session-realtime-context.ts +2 -2
- package/src/session-realtime-ledger.ts +3 -3
- package/src/session-realtime.ts +7 -7
- package/src/session-tenancy.ts +188 -0
- package/src/session-tool-call-settlement.ts +18 -3
- package/src/slack-task-policy-schema.ts +130 -0
- package/src/slack-task-policy.ts +341 -0
- package/src/slack-user-link-access.ts +702 -0
- package/src/task-notes-schema.ts +135 -0
- package/src/task-notes.ts +178 -0
- package/src/video-generation.ts +1530 -0
- package/src/workspace-artifacts.ts +1 -1
- package/src/workspace-learning-policy-schema.ts +139 -0
- package/src/workspace-learning-policy.ts +595 -0
- package/src/xai-subscription.ts +1887 -0
- package/dist/chunk-P6CUHXQZ.js +0 -7248
- package/dist/chunk-P6CUHXQZ.js.map +0 -1
- package/dist/chunk-VHBFHMPC.js +0 -1219
- package/dist/chunk-VHBFHMPC.js.map +0 -1
package/dist/insights.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Database } from "./database";
|
|
1
|
+
import type { Database } from "./database.js";
|
|
2
2
|
export type InsightsTimeWindow = {
|
|
3
3
|
since: Date;
|
|
4
4
|
until: Date;
|
|
@@ -11,10 +11,15 @@ export type ModelCallFactAggregateRow = {
|
|
|
11
11
|
inputTokens: number;
|
|
12
12
|
outputTokens: number;
|
|
13
13
|
cachedTokens: number;
|
|
14
|
+
cacheInputTokens: number;
|
|
14
15
|
cacheWriteTokens: number;
|
|
15
16
|
reasoningTokens: number;
|
|
16
17
|
totalTokens: number;
|
|
18
|
+
tokenKnownCalls: number;
|
|
19
|
+
cacheKnownCalls: number;
|
|
17
20
|
pricedCostMicros: number;
|
|
21
|
+
estimatedProviderCostMicros: number;
|
|
22
|
+
estimatedProviderCostKnownCalls: number;
|
|
18
23
|
};
|
|
19
24
|
export type InsightsDayBucket = {
|
|
20
25
|
day: string;
|
|
@@ -40,14 +45,20 @@ export type RootSessionDriverRow = {
|
|
|
40
45
|
rootSessionId: string;
|
|
41
46
|
title: string | null;
|
|
42
47
|
pricedCostMicros: number;
|
|
43
|
-
|
|
48
|
+
estimatedProviderCostMicros: number;
|
|
49
|
+
estimatedProviderCostKnownCalls: number;
|
|
50
|
+
totalTokens: number;
|
|
44
51
|
cachedTokens: number;
|
|
52
|
+
cacheInputTokens: number;
|
|
45
53
|
};
|
|
46
54
|
export type ScheduleFactAggregate = {
|
|
47
55
|
scheduledTaskId: string;
|
|
48
56
|
pricedCostMicros: number;
|
|
49
|
-
|
|
57
|
+
estimatedProviderCostMicros: number;
|
|
58
|
+
estimatedProviderCostKnownCalls: number;
|
|
59
|
+
totalTokens: number;
|
|
50
60
|
cachedTokens: number;
|
|
61
|
+
cacheInputTokens: number;
|
|
51
62
|
calls: number;
|
|
52
63
|
/** Prefer credits whenever any credits-path call exists in the window. */
|
|
53
64
|
billingPath: string;
|
|
@@ -71,6 +82,27 @@ export type FloorSessionRow = {
|
|
|
71
82
|
updatedAt: Date;
|
|
72
83
|
createdAt: Date;
|
|
73
84
|
};
|
|
85
|
+
export type RecentModelCallRow = {
|
|
86
|
+
id: string;
|
|
87
|
+
occurredAt: Date;
|
|
88
|
+
recordedAt: Date;
|
|
89
|
+
sessionId: string;
|
|
90
|
+
sessionTitle: string | null;
|
|
91
|
+
turnId: string;
|
|
92
|
+
provider: string;
|
|
93
|
+
providerApi: string;
|
|
94
|
+
model: string;
|
|
95
|
+
billingPath: string;
|
|
96
|
+
inputTokens: number | null;
|
|
97
|
+
outputTokens: number | null;
|
|
98
|
+
cachedTokens: number | null;
|
|
99
|
+
cacheWriteTokens: number | null;
|
|
100
|
+
reasoningTokens: number | null;
|
|
101
|
+
totalTokens: number | null;
|
|
102
|
+
pricedCostMicros: number;
|
|
103
|
+
estimatedProviderCostMicros: number | null;
|
|
104
|
+
pricingSource: string | null;
|
|
105
|
+
};
|
|
74
106
|
export declare function sumUsageQuantityInRange(db: Database, input: {
|
|
75
107
|
workspaceId: string;
|
|
76
108
|
eventType: string;
|
|
@@ -83,6 +115,12 @@ export declare function sumUsageQuantityByDay(db: Database, input: {
|
|
|
83
115
|
since: Date;
|
|
84
116
|
until: Date;
|
|
85
117
|
}): Promise<Map<string, number>>;
|
|
118
|
+
export declare function sumUsageQuantityByHour(db: Database, input: {
|
|
119
|
+
workspaceId: string;
|
|
120
|
+
eventType: string;
|
|
121
|
+
since: Date;
|
|
122
|
+
until: Date;
|
|
123
|
+
}): Promise<Map<string, number>>;
|
|
86
124
|
export declare function aggregateModelCallFacts(db: Database, input: {
|
|
87
125
|
workspaceId: string;
|
|
88
126
|
since: Date;
|
|
@@ -90,18 +128,35 @@ export declare function aggregateModelCallFacts(db: Database, input: {
|
|
|
90
128
|
provider?: string | null;
|
|
91
129
|
model?: string | null;
|
|
92
130
|
}): Promise<ModelCallFactAggregateRow[]>;
|
|
131
|
+
type ModelCallFactSeriesAggregate = {
|
|
132
|
+
costMicros: number;
|
|
133
|
+
estimatedProviderCostMicros: number;
|
|
134
|
+
estimatedProviderCostKnownCalls: number;
|
|
135
|
+
inputTokens: number;
|
|
136
|
+
outputTokens: number;
|
|
137
|
+
cachedTokens: number;
|
|
138
|
+
cacheInputTokens: number;
|
|
139
|
+
cacheWriteTokens: number;
|
|
140
|
+
reasoningTokens: number;
|
|
141
|
+
totalTokens: number;
|
|
142
|
+
tokenKnownCalls: number;
|
|
143
|
+
cacheKnownCalls: number;
|
|
144
|
+
calls: number;
|
|
145
|
+
};
|
|
93
146
|
export declare function aggregateModelCallFactsByDay(db: Database, input: {
|
|
94
147
|
workspaceId: string;
|
|
95
148
|
since: Date;
|
|
96
149
|
until: Date;
|
|
97
150
|
provider?: string | null;
|
|
98
151
|
model?: string | null;
|
|
99
|
-
}): Promise<Map<string,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
152
|
+
}): Promise<Map<string, ModelCallFactSeriesAggregate>>;
|
|
153
|
+
export declare function aggregateModelCallFactsByHour(db: Database, input: {
|
|
154
|
+
workspaceId: string;
|
|
155
|
+
since: Date;
|
|
156
|
+
until: Date;
|
|
157
|
+
provider?: string | null;
|
|
158
|
+
model?: string | null;
|
|
159
|
+
}): Promise<Map<string, ModelCallFactSeriesAggregate>>;
|
|
105
160
|
export declare function aggregateWarmSecondsByGroup(db: Database, input: InsightsTimeWindow & {
|
|
106
161
|
workspaceId: string;
|
|
107
162
|
limit?: number;
|
|
@@ -118,6 +173,12 @@ export declare function aggregateRootSessionDrivers(db: Database, input: Insight
|
|
|
118
173
|
export declare function listModelCallFacets(db: Database, input: InsightsTimeWindow & {
|
|
119
174
|
workspaceId: string;
|
|
120
175
|
}): Promise<ModelCallFacetRow[]>;
|
|
176
|
+
export declare function listRecentModelCalls(db: Database, input: InsightsTimeWindow & {
|
|
177
|
+
workspaceId: string;
|
|
178
|
+
provider?: string | null;
|
|
179
|
+
model?: string | null;
|
|
180
|
+
limit?: number;
|
|
181
|
+
}): Promise<RecentModelCallRow[]>;
|
|
121
182
|
export declare function aggregateScheduleFacts(db: Database, input: InsightsTimeWindow & {
|
|
122
183
|
workspaceId: string;
|
|
123
184
|
provider?: string | null;
|
|
@@ -138,8 +199,9 @@ export declare function aggregateSessionDepth(db: Database, workspaceId: string)
|
|
|
138
199
|
goalsCompleted: number;
|
|
139
200
|
}>;
|
|
140
201
|
export declare function listFloorSessions(db: Database, workspaceId: string, limit?: number): Promise<FloorSessionRow[]>;
|
|
141
|
-
export declare function countOnlineMachines(db: Database, workspaceId: string, heartbeatFreshMs: number): Promise<number>;
|
|
202
|
+
export declare function countOnlineMachines(db: Database, workspaceId: string, heartbeatFreshMs: number, now?: Date): Promise<number>;
|
|
142
203
|
export declare function enumerateUtcDays(since: Date, until: Date): string[];
|
|
204
|
+
export declare function enumerateUtcHours(since: Date, until: Date): string[];
|
|
143
205
|
/**
|
|
144
206
|
* Idempotent YTD backfill from authoritative agent.model.usage into model_call_facts.
|
|
145
207
|
* Never rewrites billing rows or existing live facts (onConflictDoNothing).
|
|
@@ -155,3 +217,4 @@ export declare function backfillModelCallFactsFromSessionEvents(db: Database, in
|
|
|
155
217
|
considered: number;
|
|
156
218
|
upserted: number;
|
|
157
219
|
}>;
|
|
220
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { Database } from "./database.js";
|
|
2
|
+
import * as schema from "./schema.js";
|
|
3
|
+
export type IntegrationFacetBindingOwner = {
|
|
4
|
+
kind: "direct" | "plugin" | "pack" | "migration";
|
|
5
|
+
id: string;
|
|
6
|
+
removable: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type UpsertIntegrationFacetBindingInput = {
|
|
9
|
+
accountId: string;
|
|
10
|
+
workspaceId: string;
|
|
11
|
+
integrationFacetInstallationId: string;
|
|
12
|
+
facetDefinitionId: string;
|
|
13
|
+
bindingKey: string;
|
|
14
|
+
displayName: string;
|
|
15
|
+
runtimeKey?: string | null;
|
|
16
|
+
connectionId?: string | null;
|
|
17
|
+
config: Record<string, unknown>;
|
|
18
|
+
createdBySubjectId: string;
|
|
19
|
+
owner: IntegrationFacetBindingOwner;
|
|
20
|
+
expectedVersion?: number;
|
|
21
|
+
};
|
|
22
|
+
export declare class IntegrationFacetBindingVersionConflictError extends Error {
|
|
23
|
+
readonly bindingKey: string;
|
|
24
|
+
readonly expectedVersion: number;
|
|
25
|
+
readonly actualVersion: number;
|
|
26
|
+
readonly name = "IntegrationFacetBindingVersionConflictError";
|
|
27
|
+
constructor(bindingKey: string, expectedVersion: number, actualVersion: number);
|
|
28
|
+
}
|
|
29
|
+
export declare class IntegrationFacetBindingVersionRequiredError extends Error {
|
|
30
|
+
readonly name = "IntegrationFacetBindingVersionRequiredError";
|
|
31
|
+
}
|
|
32
|
+
export declare class IntegrationFacetBindingOwnershipConflictError extends Error {
|
|
33
|
+
readonly name = "IntegrationFacetBindingOwnershipConflictError";
|
|
34
|
+
}
|
|
35
|
+
export declare function integrationBindingKey(connectionId: string | null | undefined, requested?: string | null): string;
|
|
36
|
+
export declare function integrationRuntimeKey(baseServerId: string, bindingKey: string): string;
|
|
37
|
+
export declare function ensureIntegrationFacetDefinition(db: Database, input: {
|
|
38
|
+
integrationFacetId: string;
|
|
39
|
+
facetKey: string;
|
|
40
|
+
kind: "tools" | "knowledge_source" | "inbound_trigger" | "delivery_destination" | "identity_link";
|
|
41
|
+
configSchema?: Record<string, unknown>;
|
|
42
|
+
capabilities?: Record<string, unknown>;
|
|
43
|
+
}): Promise<typeof schema.integrationFacetDefinitions.$inferSelect>;
|
|
44
|
+
export declare function upsertIntegrationFacetBinding(db: Database, input: UpsertIntegrationFacetBindingInput): Promise<{
|
|
45
|
+
row: typeof schema.integrationFacetBindings.$inferSelect;
|
|
46
|
+
changed: boolean;
|
|
47
|
+
}>;
|
|
48
|
+
export declare function listIntegrationFacetBindingOwners(db: Database, bindingId: string): Promise<IntegrationFacetBindingOwner[]>;
|
|
49
|
+
export declare function removeIntegrationFacetBindingOwner(db: Database, input: {
|
|
50
|
+
workspaceId: string;
|
|
51
|
+
bindingId: string;
|
|
52
|
+
owner: Pick<IntegrationFacetBindingOwner, "kind" | "id">;
|
|
53
|
+
expectedVersion?: number;
|
|
54
|
+
}): Promise<{
|
|
55
|
+
binding: typeof schema.integrationFacetBindings.$inferSelect | null;
|
|
56
|
+
remainingOwners: IntegrationFacetBindingOwner[];
|
|
57
|
+
}>;
|
|
58
|
+
export declare function removeIntegrationFacetBindingOwnersForOwner(db: Database, input: {
|
|
59
|
+
workspaceId: string;
|
|
60
|
+
owner: Pick<IntegrationFacetBindingOwner, "kind" | "id">;
|
|
61
|
+
}): Promise<{
|
|
62
|
+
disabledBindingIds: string[];
|
|
63
|
+
retainedBindingIds: string[];
|
|
64
|
+
}>;
|
|
65
|
+
export declare function integrationDefinitionHasBindingOwner(db: Database, input: {
|
|
66
|
+
workspaceId: string;
|
|
67
|
+
pluginInstallationId: string;
|
|
68
|
+
owner: Pick<IntegrationFacetBindingOwner, "kind" | "id">;
|
|
69
|
+
}): Promise<boolean>;
|
|
70
|
+
export declare function addIntegrationFacetBindingOwner(db: Database, bindingId: string, input: Pick<UpsertIntegrationFacetBindingInput, "accountId" | "workspaceId" | "owner">): Promise<void>;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { type Database } from "./database.js";
|
|
2
|
+
export type IntegrationFacetKind = "knowledge_source" | "inbound_trigger" | "delivery_destination" | "identity_link";
|
|
3
|
+
export type IntegrationFacetBindingSummary = {
|
|
4
|
+
id: string;
|
|
5
|
+
facetKey: string;
|
|
6
|
+
kind: IntegrationFacetKind;
|
|
7
|
+
bindingKey: string;
|
|
8
|
+
displayName: string;
|
|
9
|
+
connectionId: string | null;
|
|
10
|
+
status: "active" | "paused" | "needs_attention" | "disabled";
|
|
11
|
+
config: Record<string, unknown>;
|
|
12
|
+
version: number;
|
|
13
|
+
hasCursor: boolean;
|
|
14
|
+
lastSuccessAt: string | null;
|
|
15
|
+
lastErrorCode: string | null;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
};
|
|
19
|
+
export type IntegrationFacetDefinitionSummary = {
|
|
20
|
+
facetKey: string;
|
|
21
|
+
kind: IntegrationFacetKind;
|
|
22
|
+
configSchema: Record<string, unknown>;
|
|
23
|
+
capabilities: Record<string, unknown>;
|
|
24
|
+
};
|
|
25
|
+
export type IntegrationInstanceFacets = {
|
|
26
|
+
capabilityId: string;
|
|
27
|
+
instanceKey: string;
|
|
28
|
+
providerDomain: string;
|
|
29
|
+
connectionId: string | null;
|
|
30
|
+
facets: {
|
|
31
|
+
definition: IntegrationFacetDefinitionSummary;
|
|
32
|
+
binding: IntegrationFacetBindingSummary | null;
|
|
33
|
+
}[];
|
|
34
|
+
};
|
|
35
|
+
export type IntegrationFacetMutationResult = {
|
|
36
|
+
capabilityId: string;
|
|
37
|
+
instanceKey: string;
|
|
38
|
+
facetKey: string;
|
|
39
|
+
status: "configured" | "paused" | "active";
|
|
40
|
+
binding: IntegrationFacetBindingSummary;
|
|
41
|
+
};
|
|
42
|
+
export type IntegrationFacetRemovalResult = {
|
|
43
|
+
capabilityId: string;
|
|
44
|
+
instanceKey: string;
|
|
45
|
+
facetKey: string;
|
|
46
|
+
status: "not_configured" | "removed" | "retained_by_other_owners";
|
|
47
|
+
binding: IntegrationFacetBindingSummary | null;
|
|
48
|
+
remainingOwners: {
|
|
49
|
+
kind: "direct" | "plugin" | "pack" | "migration";
|
|
50
|
+
id: string;
|
|
51
|
+
removable: boolean;
|
|
52
|
+
}[];
|
|
53
|
+
};
|
|
54
|
+
export declare class IntegrationFacetNotFoundError extends Error {
|
|
55
|
+
readonly name = "IntegrationFacetNotFoundError";
|
|
56
|
+
}
|
|
57
|
+
export declare class IntegrationFacetConnectionError extends Error {
|
|
58
|
+
readonly name = "IntegrationFacetConnectionError";
|
|
59
|
+
}
|
|
60
|
+
export declare class IntegrationFacetConfigError extends Error {
|
|
61
|
+
readonly name = "IntegrationFacetConfigError";
|
|
62
|
+
}
|
|
63
|
+
export declare class IntegrationFacetOperationIdempotencyError extends Error {
|
|
64
|
+
readonly name = "IntegrationFacetOperationIdempotencyError";
|
|
65
|
+
}
|
|
66
|
+
export declare function listIntegrationInstanceFacets(db: Database, workspaceId: string, subjectId: string, capabilityId: string, instanceKey: string): Promise<IntegrationInstanceFacets>;
|
|
67
|
+
export declare function configureIntegrationFacet(db: Database, input: {
|
|
68
|
+
accountId: string;
|
|
69
|
+
workspaceId: string;
|
|
70
|
+
subjectId: string;
|
|
71
|
+
capabilityId: string;
|
|
72
|
+
instanceKey: string;
|
|
73
|
+
facetKey: string;
|
|
74
|
+
displayName: string;
|
|
75
|
+
config: Record<string, unknown>;
|
|
76
|
+
expectedVersion?: number;
|
|
77
|
+
idempotencyKey: string;
|
|
78
|
+
}): Promise<IntegrationFacetMutationResult>;
|
|
79
|
+
export declare function setIntegrationFacetLifecycle(db: Database, input: {
|
|
80
|
+
accountId: string;
|
|
81
|
+
workspaceId: string;
|
|
82
|
+
subjectId: string;
|
|
83
|
+
capabilityId: string;
|
|
84
|
+
instanceKey: string;
|
|
85
|
+
facetKey: string;
|
|
86
|
+
action: "pause" | "resume";
|
|
87
|
+
expectedVersion: number;
|
|
88
|
+
idempotencyKey: string;
|
|
89
|
+
}): Promise<IntegrationFacetMutationResult>;
|
|
90
|
+
export declare function removeIntegrationFacet(db: Database, input: {
|
|
91
|
+
accountId: string;
|
|
92
|
+
workspaceId: string;
|
|
93
|
+
subjectId: string;
|
|
94
|
+
capabilityId: string;
|
|
95
|
+
instanceKey: string;
|
|
96
|
+
facetKey: string;
|
|
97
|
+
expectedVersion: number;
|
|
98
|
+
idempotencyKey: string;
|
|
99
|
+
}): Promise<IntegrationFacetRemovalResult>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Database } from "./database.js";
|
|
2
|
+
export declare function advanceWorkspaceInteractionRevision(db: Database, accountId: string, workspaceId: string): Promise<number>;
|
|
3
|
+
export declare function readWorkspaceInteractionRevision(db: Database, workspaceId: string): Promise<number>;
|
|
4
|
+
export type WorkspaceInteractionRevisionState = {
|
|
5
|
+
revision: number;
|
|
6
|
+
updatedAt: Date | null;
|
|
7
|
+
};
|
|
8
|
+
/** Read the latest cursor while already inside the workspace RLS boundary. */
|
|
9
|
+
export declare function readWorkspaceInteractionRevisionState(db: Database, workspaceId: string): Promise<WorkspaceInteractionRevisionState>;
|
|
10
|
+
/** Standalone tenant-scoped cursor read used by the workspace SSE projection. */
|
|
11
|
+
export declare function getWorkspaceInteractionRevisionState(db: Database, input: {
|
|
12
|
+
accountId: string;
|
|
13
|
+
workspaceId: string;
|
|
14
|
+
}): Promise<WorkspaceInteractionRevisionState>;
|