@opengeni/db 1.0.1 → 3.1.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/attached-browser-devices.d.ts +7 -0
- package/dist/automations.d.ts +154 -0
- package/dist/canonical-human-identities.js +3 -3
- package/dist/capability-integrations.d.ts +13 -0
- package/dist/child-lifecycle-notices.d.ts +68 -0
- package/dist/{chunk-LTG3S6ZY.js → chunk-EULAN2NP.js} +2 -2
- package/dist/{chunk-CUPM3FGB.js → chunk-NJVZPWXY.js} +3 -3
- package/dist/{chunk-4SR4HKKA.js → chunk-NMUBV7Z5.js} +19 -11
- package/dist/chunk-NMUBV7Z5.js.map +1 -0
- package/dist/chunk-OF5OBB76.js +4457 -0
- package/dist/chunk-OF5OBB76.js.map +1 -0
- package/dist/{chunk-6ZYKCRFO.js → chunk-PR2WMLOQ.js} +7580 -4417
- package/dist/chunk-PR2WMLOQ.js.map +1 -0
- package/dist/{chunk-ZWREYEWA.js → chunk-SCPUJS53.js} +41 -4
- package/dist/chunk-SCPUJS53.js.map +1 -0
- package/dist/{chunk-SK7YYHBI.js → chunk-SIBYBA2D.js} +46 -1
- package/dist/chunk-SIBYBA2D.js.map +1 -0
- package/dist/chunk-TIKF3KTI.js +383 -0
- package/dist/chunk-TIKF3KTI.js.map +1 -0
- package/dist/chunk-ZZ5LJEFX.js +516 -0
- package/dist/chunk-ZZ5LJEFX.js.map +1 -0
- package/dist/codemode-operations.d.ts +1 -6
- package/dist/company-brain-context-selection-schema.d.ts +705 -0
- package/dist/company-brain-context-selection.d.ts +94 -0
- package/dist/company-brain-governed-writes.d.ts +24 -0
- package/dist/company-brain.d.ts +55 -0
- package/dist/company-profile-agent-admin.d.ts +15 -0
- package/dist/company-profile-schema.d.ts +619 -2
- package/dist/company-profile.d.ts +9 -4
- package/dist/connection-authority.d.ts +95 -0
- package/dist/connection-scopes.d.ts +8 -0
- package/dist/connection-tenancy-backfill.d.ts +41 -0
- package/dist/connection-token-resolver.d.ts +30 -1
- package/dist/database.d.ts +19 -0
- package/dist/editable-artifact-durable-export.js +2 -2
- package/dist/editable-artifacts.d.ts +2 -2
- package/dist/editable-artifacts.js +3 -3
- package/dist/governed-learning-activation-schema.d.ts +984 -0
- package/dist/governed-learning-activation.d.ts +98 -0
- package/dist/governed-learning-evaluator-schema.d.ts +633 -0
- package/dist/governed-learning-evaluator.d.ts +28 -0
- package/dist/index.d.ts +1595 -81
- package/dist/index.js +21571 -8126
- package/dist/index.js.map +1 -1
- package/dist/insights.d.ts +18 -0
- package/dist/integration-bindings.d.ts +1 -0
- package/dist/integration-facets.d.ts +30 -0
- package/dist/interaction-placement-loss.d.ts +22 -0
- package/dist/managed-human-provisioning.d.ts +25 -0
- package/dist/memory-domain.d.ts +3 -3
- package/dist/migrate.d.ts +11 -1
- package/dist/migrate.js +1 -1
- package/dist/new-session-drafts.d.ts +43 -5
- package/dist/organization-membership-backfill.d.ts +174 -0
- package/dist/organization-membership-lifecycle.d.ts +162 -0
- package/dist/pr-review.d.ts +107 -0
- package/dist/preference-registry-schema.d.ts +2 -0
- package/dist/preference-registry.d.ts +2 -0
- package/dist/provision-roles.js +1 -1
- package/dist/runtime-posture.d.ts +22 -8
- package/dist/schema.d.ts +24914 -13703
- package/dist/schema.js +99 -1
- package/dist/scoped-knowledge-schema.d.ts +52 -1
- package/dist/session-background-commands.d.ts +125 -0
- package/dist/session-background-commands.js +34 -0
- package/dist/session-background-commands.js.map +1 -0
- package/dist/session-control.d.ts +156 -3
- package/dist/session-goal-pacing.d.ts +68 -0
- package/dist/session-queue-commands.d.ts +41 -4
- package/dist/session-realtime-ledger.d.ts +2 -0
- package/dist/session-tenancy.d.ts +71 -1
- package/dist/session-tenancy.js +25 -3
- package/dist/session-tool-call-settlement.d.ts +9 -4
- package/dist/slack-routing-personal-workspace.d.ts +23 -0
- package/dist/slack-routing.d.ts +153 -0
- package/dist/slack-task-policy-schema.d.ts +34 -0
- package/dist/slack-task-policy.d.ts +8 -0
- package/dist/slack-user-link-access.d.ts +1 -0
- package/dist/task-notes-schema.d.ts +594 -0
- package/dist/task-notes.d.ts +39 -0
- package/dist/turn-initiator.d.ts +2 -0
- package/dist/user-resource-authority.d.ts +109 -0
- package/dist/video-generation.js +3 -3
- package/dist/workspace-authority.d.ts +81 -0
- package/dist/workspace-instruction-policies-schema.d.ts +279 -0
- package/dist/workspace-instruction-policies.d.ts +62 -0
- package/dist/workspace-learning-policy.d.ts +1 -0
- package/dist/workspace-membership-permissions.d.ts +2 -0
- package/drizzle/0240_enrollment_connection_authority.sql +39 -0
- package/drizzle/0241_atomic_personal_resource_delegation.sql +1000 -0
- package/drizzle/0241_enrollment_agent_runtime.sql +70 -0
- package/drizzle/0244_slack_app_home_refresh_queue.sql +120 -0
- package/drizzle/0245_model_context_contribution_facts.sql +88 -0
- package/drizzle/0246_integration_personal_instance_authority.sql +70 -0
- package/drizzle/0247_terraform_stacks_provenance_repair.sql +428 -0
- package/drizzle/0248_terraform_stacks_component_resolution_fence.sql +83 -0
- package/drizzle/0249_personal_resource_delegation_authority_correction.sql +662 -0
- package/drizzle/0250_direct_retained_process_owner_liveness.sql +199 -0
- package/drizzle/0251_connected_machine_operation_policy.sql +45 -0
- package/drizzle/0252_scheduled_personal_resource_delegation.sql +1867 -0
- package/drizzle/0253_common_user_resource_authority_lifecycle.sql +1555 -0
- package/drizzle/0254_scoped_variable_set_authority.sql +1255 -0
- package/drizzle/0255_company_brain_governed_write_proposals.sql +524 -0
- package/drizzle/0256_connection_authority_delegation.sql +703 -0
- package/drizzle/0257_goal_revision_decisions_and_root_constraints.sql +436 -0
- package/drizzle/0258_three_scope_document_knowledge_authority.sql +1273 -0
- package/drizzle/0259_company_brain_context_selection_receipts.sql +869 -0
- package/drizzle/0260_task_note_knowledge_promotion.sql +820 -0
- package/drizzle/0261_preference_knowledge_proposal_actor_binding.sql +471 -0
- package/drizzle/0262_scoped_connected_machines_and_rigs.sql +1700 -0
- package/drizzle/0263_organization_membership_lifecycle.sql +3284 -0
- package/drizzle/0264_connection_authority_runtime_activation.sql +1084 -0
- package/drizzle/0266_company_brain_context_receipt_inspection.sql +156 -0
- package/drizzle/0268_governed_learning_decision_receipts.sql +825 -0
- package/drizzle/0269_governed_learning_activation_controller.sql +1874 -0
- package/drizzle/0270_governed_learning_history_inspection.sql +170 -0
- package/drizzle/0271_company_brain_retrieval_only_default.sql +524 -0
- package/drizzle/0272_human_confirmed_learning_activation.sql +591 -0
- package/drizzle/0273_scheduled_variable_set_materialization.sql +268 -0
- package/drizzle/0274_human_confirmed_knowledge_review.sql +310 -0
- package/drizzle/0275_scheduled_connection_authority.sql +5527 -0
- package/drizzle/0276_onboarding_proposal_initiating_human_guc.sql +198 -0
- package/drizzle/0277_workspace_writer_authority_attribution.sql +393 -0
- package/drizzle/0278_workspace_membership_removal_fencing.sql +1174 -0
- package/drizzle/0279_workspace_connection_use_lane.sql +343 -0
- package/drizzle/0280_connection_and_variable_set_audit_attribution.sql +773 -0
- package/drizzle/0281_viewer_holder_authority_claims.sql +52 -0
- package/drizzle/0282_variable_set_session_attach_attribution.sql +178 -0
- package/drizzle/0283_editable_spreadsheet_authored_state.sql +82 -0
- package/drizzle/0284_truthful_human_confirmed_review_reason.sql +930 -0
- package/drizzle/0285_organization_tenancy_inventory.sql +329 -0
- package/drizzle/0286_widen_task_note_expiry_ceiling.sql +391 -0
- package/drizzle/0287_open_suffix_pending_tool_calls.sql +18 -0
- package/drizzle/0288_attached_browser_reenrollment.sql +64 -0
- package/drizzle/0289_session_composer_policy_authority.sql +597 -0
- package/drizzle/0290_organization_membership_backfill.sql +268 -0
- package/drizzle/0291_resource_authority_classification_assertion.sql +371 -0
- package/drizzle/0292_truthful_tenancy_inventory_counters.sql +291 -0
- package/drizzle/0293_confirm_time_rule_rebaseline.sql +615 -0
- package/drizzle/0294_preference_activation_authority.sql +237 -0
- package/drizzle/0295_retire_legacy_standing_memory_mode.sql +476 -0
- package/drizzle/0296_force_rls_backfill_noop_repair.sql +215 -0
- package/drizzle/0297_session_ownership_classification_and_backfill.sql +752 -0
- package/drizzle/0298_organization_tenancy_parity.sql +609 -0
- package/drizzle/0299_organization_membership_lock_order.sql +291 -0
- package/drizzle/0300_tenancy_backfill_ledger.sql +459 -0
- package/drizzle/0301_session_snapshot_and_pin_visibility.sql +181 -0
- package/drizzle/0302_personal_workspace_session_ownership.sql +303 -0
- package/drizzle/0303_session_tenancy_product_activation.sql +919 -0
- package/drizzle/0304_personal_workspace_private_session_reads.sql +97 -0
- package/drizzle/0305_personal_resource_grant_management.sql +584 -0
- package/drizzle/0306_atomic_personal_resource_attachments.sql +1374 -0
- package/drizzle/0307_session_attention_state.sql +51 -0
- package/drizzle/0308_session_archives.sql +35 -0
- package/drizzle/0309_channel_project_pins.sql +6 -0
- package/drizzle/0310_channel_project_order.sql +27 -0
- package/drizzle/0311_company_scope_and_private_session_create.sql +656 -0
- package/drizzle/0312_quiescent_session_tree_deletion.sql +39 -0
- package/drizzle/0313_private_child_session_authority.sql +365 -0
- package/drizzle/0314_unregistered_organization_invitations.sql +606 -0
- package/drizzle/0315_personal_github_repository_selection.sql +624 -0
- package/drizzle/0316_human_confirmed_activation_resumed_generation.sql +869 -0
- package/drizzle/0317_session_goal_continuation_hold.sql +64 -0
- package/drizzle/0318_session_turn_startup_milestones.sql +115 -0
- package/drizzle/0319_event_triggered_automations.sql +254 -0
- package/drizzle/0320_pr_review_pack.sql +113 -0
- package/drizzle/0321_slack_bot_environment_display_name.sql +15 -0
- package/drizzle/0322_session_turns_unclaimed_prompt_trigger_index.sql +5 -0
- package/drizzle/0323_organization_private_session_enablement.sql +489 -0
- package/drizzle/0324_human_confirmed_company_profile_agent_admin.sql +856 -0
- package/drizzle/0325_child_lifecycle_notices.sql +44 -0
- package/drizzle/0326_interaction_operation_error_codes.sql +62 -0
- package/drizzle/0327_slack_first_task_hint.sql +29 -0
- package/drizzle/0328_session_background_commands.sql +590 -0
- package/drizzle/0329_slack_orchestration_delivery_events.sql +91 -0
- package/drizzle/0330_api_key_descriptions.sql +20 -0
- package/drizzle/0331_managed_organization_creation.sql +163 -0
- package/drizzle/0332_organization_shared_workspace_control_plane.sql +539 -0
- package/drizzle/0333_session_turn_prompt_routing.sql +45 -0
- package/drizzle/0334_connected_machine_workspace_root.sql +99 -0
- package/drizzle/0335_slack_workspace_routing.sql +460 -0
- package/drizzle/0336_atomic_session_fork_visibility.sql +667 -0
- package/drizzle/0337_slack_routed_action_handles.sql +189 -0
- package/drizzle/0338_atomic_connected_machine_attachments.sql +410 -0
- package/drizzle/0339_document_authority_reclassification.sql +1153 -0
- package/drizzle/0340_tenancy_backfill_activation_evidence.sql +1347 -0
- package/drizzle/0341_slack_routing_probe_organization_fence.sql +109 -0
- package/package.json +10 -6
- package/src/attached-browser-devices.ts +233 -5
- package/src/automations.ts +911 -0
- package/src/browser-sessions.ts +10 -0
- package/src/capability-integrations.ts +175 -1
- package/src/child-lifecycle-notices.ts +241 -0
- package/src/codemode-operations.ts +1 -35
- package/src/company-brain-context-selection-schema.ts +100 -0
- package/src/company-brain-context-selection.ts +359 -0
- package/src/company-brain-governed-writes.ts +1170 -0
- package/src/company-brain.ts +309 -0
- package/src/company-profile-agent-admin.ts +225 -0
- package/src/company-profile-schema.ts +121 -1
- package/src/company-profile.ts +21 -0
- package/src/computer-sessions.ts +10 -1
- package/src/connection-authority.ts +290 -0
- package/src/connection-scopes.ts +20 -0
- package/src/connection-tenancy-backfill.ts +81 -0
- package/src/connection-token-resolver.ts +263 -31
- package/src/database.ts +75 -2
- package/src/editable-artifacts-schema.ts +10 -5
- package/src/editable-artifacts.ts +21 -11
- package/src/governed-learning-activation-schema.ts +121 -0
- package/src/governed-learning-activation.ts +588 -0
- package/src/governed-learning-evaluator-schema.ts +72 -0
- package/src/governed-learning-evaluator.ts +217 -0
- package/src/index.ts +11651 -1548
- package/src/insights.ts +107 -0
- package/src/integration-bindings.ts +88 -6
- package/src/integration-facets.ts +287 -84
- package/src/interaction-placement-loss.ts +234 -0
- package/src/managed-human-provisioning.ts +116 -0
- package/src/memory-domain.ts +27 -32
- package/src/migrate.ts +77 -1
- package/src/new-session-drafts.ts +229 -35
- package/src/organization-membership-backfill.ts +735 -0
- package/src/organization-membership-lifecycle.ts +985 -0
- package/src/pr-review.ts +890 -0
- package/src/preference-registry.ts +31 -1
- package/src/provision-roles.ts +877 -6
- package/src/runtime-posture-cli.ts +2 -0
- package/src/runtime-posture.ts +1291 -76
- package/src/schema.ts +3303 -428
- package/src/scoped-knowledge-schema.ts +16 -8
- package/src/scoped-knowledge.ts +1 -1
- package/src/session-background-commands.ts +759 -0
- package/src/session-control.ts +640 -74
- package/src/session-goal-pacing.ts +126 -0
- package/src/session-queue-commands.ts +437 -84
- package/src/session-realtime-context.ts +3 -3
- package/src/session-realtime-ledger.ts +22 -11
- package/src/session-realtime-mirror.ts +1 -1
- package/src/session-tenancy.ts +403 -49
- package/src/session-tool-call-settlement.ts +38 -29
- package/src/slack-routing-personal-workspace.ts +67 -0
- package/src/slack-routing.ts +469 -0
- package/src/slack-task-policy-schema.ts +5 -0
- package/src/slack-task-policy.ts +18 -0
- package/src/slack-user-link-access.ts +17 -1
- package/src/task-notes-schema.ts +74 -0
- package/src/task-notes.ts +124 -2
- package/src/turn-initiator.ts +8 -0
- package/src/user-resource-authority.ts +377 -0
- package/src/workspace-authority.ts +160 -0
- package/src/workspace-instruction-policies-schema.ts +53 -1
- package/src/workspace-instruction-policies.ts +528 -77
- package/src/workspace-learning-policy.ts +21 -5
- package/src/workspace-membership-permissions.ts +9 -0
- package/dist/chunk-4SR4HKKA.js.map +0 -1
- package/dist/chunk-6ZYKCRFO.js.map +0 -1
- package/dist/chunk-NXAFLCQX.js +0 -2468
- package/dist/chunk-NXAFLCQX.js.map +0 -1
- package/dist/chunk-SK7YYHBI.js.map +0 -1
- package/dist/chunk-WD5ROSLL.js +0 -117
- package/dist/chunk-WD5ROSLL.js.map +0 -1
- package/dist/chunk-ZWREYEWA.js.map +0 -1
- /package/dist/{chunk-LTG3S6ZY.js.map → chunk-EULAN2NP.js.map} +0 -0
- /package/dist/{chunk-CUPM3FGB.js.map → chunk-NJVZPWXY.js.map} +0 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { ConnectionAuthoritySummary, ConnectionUseAttribution, ConnectionUseAuthorizationResult, type IssueConnectionUseGrantRequest, type ConnectionUseDenialReason as ConnectionUseDenialReasonValue } from "@opengeni/contracts/connection-authority";
|
|
2
|
+
import { type ConnectionKind as ConnectionKindValue, type UserResourceDelegation } from "@opengeni/contracts";
|
|
3
|
+
import { type Database } from "./database.js";
|
|
4
|
+
export declare function listSelfConnectionAuthorities(db: Database, input: {
|
|
5
|
+
accountId: string;
|
|
6
|
+
workspaceId: string;
|
|
7
|
+
subjectId: string;
|
|
8
|
+
}): Promise<ConnectionAuthoritySummary[]>;
|
|
9
|
+
export declare function issueSelfConnectionUseGrant(db: Database, input: {
|
|
10
|
+
accountId: string;
|
|
11
|
+
workspaceId: string;
|
|
12
|
+
subjectId: string;
|
|
13
|
+
authorityId: string;
|
|
14
|
+
request: IssueConnectionUseGrantRequest;
|
|
15
|
+
}): Promise<{
|
|
16
|
+
grantId: string;
|
|
17
|
+
targetWorkspaceId: string;
|
|
18
|
+
targetSessionId: string | null;
|
|
19
|
+
mode: "always" | "once" | "session";
|
|
20
|
+
context: "user_private" | "workspace_shared";
|
|
21
|
+
authorityEpoch: number | null;
|
|
22
|
+
generation: number;
|
|
23
|
+
status: "active" | "consumed" | "expired" | "revoked";
|
|
24
|
+
expiresAt: string | null;
|
|
25
|
+
delegation: {
|
|
26
|
+
authorityId: string;
|
|
27
|
+
grantId: string;
|
|
28
|
+
organizationId: string;
|
|
29
|
+
workspaceId: string;
|
|
30
|
+
sessionId: string | null;
|
|
31
|
+
action: string;
|
|
32
|
+
mode: "always" | "once" | "session";
|
|
33
|
+
context: "user_private" | "workspace_shared";
|
|
34
|
+
authorityEpoch: number | null;
|
|
35
|
+
authorityGeneration: number;
|
|
36
|
+
grantGeneration: number;
|
|
37
|
+
resourceVersionId?: string | null | undefined;
|
|
38
|
+
};
|
|
39
|
+
action: "connection.use";
|
|
40
|
+
}>;
|
|
41
|
+
export declare function revokeSelfConnectionUseGrant(db: Database, input: {
|
|
42
|
+
accountId: string;
|
|
43
|
+
workspaceId: string;
|
|
44
|
+
subjectId: string;
|
|
45
|
+
grantId: string;
|
|
46
|
+
}): Promise<{
|
|
47
|
+
grantId: string;
|
|
48
|
+
generation: number;
|
|
49
|
+
status: "revoked";
|
|
50
|
+
revokedAt: string;
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* Resolves the immutable physical origin for one explicit common-user
|
|
54
|
+
* connection selection. The SECURITY DEFINER database boundary proves the
|
|
55
|
+
* owning human, active organization membership, target-workspace access, and
|
|
56
|
+
* exact authority/grant generations without exposing credentials or allowing
|
|
57
|
+
* an ambient cross-workspace inventory.
|
|
58
|
+
*/
|
|
59
|
+
export declare function resolvePersonalConnectionAuthoritySelectionOrigin(db: Database, input: {
|
|
60
|
+
accountId: string;
|
|
61
|
+
targetWorkspaceId: string;
|
|
62
|
+
subjectId: string;
|
|
63
|
+
connectionId: string;
|
|
64
|
+
delegation: UserResourceDelegation;
|
|
65
|
+
}): Promise<string | null>;
|
|
66
|
+
export declare function resolveConnectionUseAuthority(db: Database, input: {
|
|
67
|
+
snapshot: unknown;
|
|
68
|
+
}): Promise<ConnectionUseAuthorizationResult>;
|
|
69
|
+
export type AcceptedConnectionUseContext = {
|
|
70
|
+
accountId: string;
|
|
71
|
+
workspaceId: string;
|
|
72
|
+
sessionId: string;
|
|
73
|
+
turnId: string;
|
|
74
|
+
attemptId: string;
|
|
75
|
+
executionGeneration: number;
|
|
76
|
+
physicalRequestId: string;
|
|
77
|
+
usePhase: "credential_resolution" | "provider_request";
|
|
78
|
+
};
|
|
79
|
+
export type AcceptedConnectionUseResolution = {
|
|
80
|
+
status: "denied";
|
|
81
|
+
reason: ConnectionUseDenialReasonValue;
|
|
82
|
+
} | {
|
|
83
|
+
status: "authorized";
|
|
84
|
+
originWorkspaceId: string;
|
|
85
|
+
connectionKind: ConnectionKindValue;
|
|
86
|
+
attribution: ConnectionUseAttribution;
|
|
87
|
+
};
|
|
88
|
+
export declare function resolveAcceptedConnectionUse(db: Database, input: AcceptedConnectionUseContext & {
|
|
89
|
+
serverId: string;
|
|
90
|
+
connectionId?: string;
|
|
91
|
+
providerDomain: string;
|
|
92
|
+
connectionKind?: ConnectionKindValue;
|
|
93
|
+
subjectScope?: "workspace" | "subject";
|
|
94
|
+
ownerSubjectId?: string;
|
|
95
|
+
}): Promise<AcceptedConnectionUseResolution>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical comparison key for provider-reported OAuth scopes.
|
|
3
|
+
*
|
|
4
|
+
* Google may return the canonical userinfo scope URLs after the application
|
|
5
|
+
* requested the standard `email` / `profile` aliases. Microsoft scope names
|
|
6
|
+
* are case-insensitive. All other providers retain exact comparison.
|
|
7
|
+
*/
|
|
8
|
+
export declare function connectionScopeKey(providerDomain: string, value: string): string;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type Database } from "./database.js";
|
|
2
|
+
export type ConnectionAuthorityClassificationReport = {
|
|
3
|
+
schemaVersion: 1;
|
|
4
|
+
organizationId: string;
|
|
5
|
+
runKey: string | null;
|
|
6
|
+
rewroteConnectionRows: false;
|
|
7
|
+
receiptId?: string;
|
|
8
|
+
connections: {
|
|
9
|
+
total: number;
|
|
10
|
+
workspaceOwned: number;
|
|
11
|
+
userOwned: number;
|
|
12
|
+
deterministicRepairPending: number;
|
|
13
|
+
unresolved: number;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export type ConnectionAuthorityBackfillReport = {
|
|
17
|
+
schemaVersion: 1;
|
|
18
|
+
organizationId: string;
|
|
19
|
+
dryRun: boolean;
|
|
20
|
+
limit: number;
|
|
21
|
+
candidates: number;
|
|
22
|
+
upgraded: number;
|
|
23
|
+
moreLikely: boolean;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Full-population connection authority classification. Supplying a fresh run
|
|
27
|
+
* key writes one immutable migration-0300 receipt and exact unresolved rows.
|
|
28
|
+
*/
|
|
29
|
+
export declare function classifyOrganizationConnectionAuthority(db: Database, input: {
|
|
30
|
+
organizationId: string;
|
|
31
|
+
runKey?: string | null;
|
|
32
|
+
}): Promise<ConnectionAuthorityClassificationReport>;
|
|
33
|
+
/**
|
|
34
|
+
* One bounded, resumable legacy_user -> user upgrade batch. Dry-run is the
|
|
35
|
+
* default; candidates are claimed with SKIP LOCKED when applying.
|
|
36
|
+
*/
|
|
37
|
+
export declare function backfillOrganizationConnectionAuthority(db: Database, input: {
|
|
38
|
+
organizationId: string;
|
|
39
|
+
limit?: number;
|
|
40
|
+
dryRun?: boolean;
|
|
41
|
+
}): Promise<ConnectionAuthorityBackfillReport>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { environmentsEncryptionKeyBytes, type McpServerConnectionRef, type Settings } from "@opengeni/config";
|
|
2
2
|
import type { ConnectionCredentialPlacement, ConnectionKind, ConnectionCredentialsPort, ConnectionStatus, McpConnectionResourceScope, McpCredentialAuthNeededReason, McpCredentialsRequest, TurnInitiator, TurnInitiatorContext } from "@opengeni/contracts";
|
|
3
|
+
import { type ConnectionUseAttribution, type ConnectionUseAuthorizationResult } from "@opengeni/contracts/connection-authority";
|
|
3
4
|
import { type DnsLookup, type FetchLike } from "@opengeni/network";
|
|
4
5
|
export { isPrivateAddress } from "@opengeni/network";
|
|
5
6
|
import { encryptEnvironmentValue } from "./environment-crypto.js";
|
|
6
7
|
import type { Database } from "./database.js";
|
|
8
|
+
import type { AcceptedConnectionUseContext, AcceptedConnectionUseResolution } from "./connection-authority.js";
|
|
7
9
|
export type ConnectionCredentialForBroker = {
|
|
8
10
|
id: string;
|
|
9
11
|
accountId: string;
|
|
@@ -17,6 +19,8 @@ export type ConnectionCredentialForBroker = {
|
|
|
17
19
|
expiresAt: Date | null;
|
|
18
20
|
lastRefreshAt: Date | null;
|
|
19
21
|
version: number;
|
|
22
|
+
/** Immutable execution authority generation; distinct from token refresh version. */
|
|
23
|
+
authorityGeneration?: number;
|
|
20
24
|
metadata: Record<string, unknown>;
|
|
21
25
|
};
|
|
22
26
|
export type ConnectionCredentialLookupInput = {
|
|
@@ -26,6 +30,7 @@ export type ConnectionCredentialLookupInput = {
|
|
|
26
30
|
kind?: ConnectionKind;
|
|
27
31
|
subjectId?: string | null;
|
|
28
32
|
allowSubjectOwned?: boolean;
|
|
33
|
+
expectedAuthorityGeneration?: number;
|
|
29
34
|
};
|
|
30
35
|
export type ConnectionTokenRefreshInput = {
|
|
31
36
|
id: string;
|
|
@@ -34,6 +39,7 @@ export type ConnectionTokenRefreshInput = {
|
|
|
34
39
|
credentialEncrypted: string;
|
|
35
40
|
expiresAt: Date | null;
|
|
36
41
|
grantedScopes?: string[];
|
|
42
|
+
metadata?: Record<string, unknown>;
|
|
37
43
|
lastRefreshAt: Date;
|
|
38
44
|
subjectId?: string | null;
|
|
39
45
|
};
|
|
@@ -50,6 +56,14 @@ export type ResolveConnectionCredentialResult = {
|
|
|
50
56
|
connectionId: string;
|
|
51
57
|
/** Exact durable version when the credential came from the local connection store. */
|
|
52
58
|
connectionVersion?: number;
|
|
59
|
+
/** Metadata-only owner attribution from the immediate pre-use fence. */
|
|
60
|
+
connectionUseAttribution?: ConnectionUseAttribution;
|
|
61
|
+
/**
|
|
62
|
+
* Revalidate the exact accepted attempt immediately before one target
|
|
63
|
+
* provider request. Credential lookup/refresh is a separate audited
|
|
64
|
+
* boundary and must not manufacture a provider-request fact by itself.
|
|
65
|
+
*/
|
|
66
|
+
authorizeProviderRequest?: () => Promise<boolean>;
|
|
53
67
|
expiresAt?: Date | null;
|
|
54
68
|
} | {
|
|
55
69
|
status: "auth_needed";
|
|
@@ -75,6 +89,10 @@ export type ResolveConnectionCredentialInput = {
|
|
|
75
89
|
/** Defaults to header-only MCP transport. */
|
|
76
90
|
credentialTarget?: "mcp" | "http_api";
|
|
77
91
|
forceRefresh?: boolean;
|
|
92
|
+
/** Exact immutable accepted-work authority; never credential-bearing. */
|
|
93
|
+
connectionUseAuthority?: unknown;
|
|
94
|
+
/** Exact accepted attempt plus one stable physical-provider request id. */
|
|
95
|
+
connectionUseContext?: AcceptedConnectionUseContext;
|
|
78
96
|
};
|
|
79
97
|
export type HostMcpCredentialResolverContext = {
|
|
80
98
|
accountId: string;
|
|
@@ -87,7 +105,6 @@ export type HostMcpCredentialResolverContext = {
|
|
|
87
105
|
initiator: TurnInitiator;
|
|
88
106
|
initiatorContext: TurnInitiatorContext;
|
|
89
107
|
surface: McpCredentialsRequest["surface"];
|
|
90
|
-
allowOfficialGmailRestDestination?: boolean;
|
|
91
108
|
};
|
|
92
109
|
export declare class HostMcpCredentialScopeError extends Error {
|
|
93
110
|
constructor(field: "accountId" | "workspaceId" | "sessionId");
|
|
@@ -111,6 +128,17 @@ export type ConnectionBrokerDeps = {
|
|
|
111
128
|
encrypt: typeof encryptEnvironmentValue;
|
|
112
129
|
keyBytes: typeof environmentsEncryptionKeyBytes;
|
|
113
130
|
now: () => Date;
|
|
131
|
+
authorizeUse?: (db: Database, input: {
|
|
132
|
+
snapshot: unknown;
|
|
133
|
+
}) => Promise<ConnectionUseAuthorizationResult>;
|
|
134
|
+
authorizeAcceptedUse?: (db: Database, input: AcceptedConnectionUseContext & {
|
|
135
|
+
serverId: string;
|
|
136
|
+
connectionId?: string;
|
|
137
|
+
providerDomain: string;
|
|
138
|
+
connectionKind?: ConnectionKind;
|
|
139
|
+
subjectScope?: "workspace" | "subject";
|
|
140
|
+
ownerSubjectId?: string;
|
|
141
|
+
}) => Promise<AcceptedConnectionUseResolution>;
|
|
114
142
|
};
|
|
115
143
|
export type PermanentConnectionRefreshFailure = {
|
|
116
144
|
workspaceId: string;
|
|
@@ -152,4 +180,5 @@ export declare function refreshOAuthConnectionCredential(cred: ConnectionCredent
|
|
|
152
180
|
credential: Record<string, unknown>;
|
|
153
181
|
expiresAt: Date | null;
|
|
154
182
|
grantedScopes?: string[];
|
|
183
|
+
metadata?: Record<string, unknown>;
|
|
155
184
|
}>;
|
package/dist/database.d.ts
CHANGED
|
@@ -57,6 +57,13 @@ export type RlsStrategy = "force" | "scoped";
|
|
|
57
57
|
* `auth_users` directly. Returns the user id, or null when no such user exists.
|
|
58
58
|
*/
|
|
59
59
|
export type UserLookup = (db: Database, email: string) => Promise<string | null>;
|
|
60
|
+
export type ManagedUserProfile = {
|
|
61
|
+
id: string;
|
|
62
|
+
name: string | null;
|
|
63
|
+
email: string;
|
|
64
|
+
};
|
|
65
|
+
/** Host identity projection used by organization administration rosters. */
|
|
66
|
+
export type UserProfileLookup = (db: Database, userIds: readonly string[]) => Promise<ManagedUserProfile[]>;
|
|
60
67
|
export type CreateDbOptions = {
|
|
61
68
|
/**
|
|
62
69
|
* The Postgres `search_path` for this connection (Step I, §7.8 runtime half).
|
|
@@ -74,6 +81,8 @@ export type CreateDbOptions = {
|
|
|
74
81
|
rlsStrategy?: RlsStrategy;
|
|
75
82
|
/** Host-provided user-by-email resolver; unset → today's raw `auth_users` query. */
|
|
76
83
|
userLookup?: UserLookup;
|
|
84
|
+
/** Host-provided user profile projection; unset → standalone `auth_users`. */
|
|
85
|
+
userProfileLookup?: UserProfileLookup;
|
|
77
86
|
/** postgres-js pool size; defaults to today's `10`. */
|
|
78
87
|
max?: number;
|
|
79
88
|
/**
|
|
@@ -94,6 +103,7 @@ export type CreateDbOptions = {
|
|
|
94
103
|
type DbBinding = {
|
|
95
104
|
rlsStrategy: RlsStrategy;
|
|
96
105
|
userLookup?: UserLookup;
|
|
106
|
+
userProfileLookup?: UserProfileLookup;
|
|
97
107
|
};
|
|
98
108
|
/** The strategy bound to a handle (or the `"force"` default). */
|
|
99
109
|
export declare function rlsStrategyFor(db: Database): RlsStrategy;
|
|
@@ -144,6 +154,7 @@ export declare function createDb(databaseUrl: string, options?: CreateDbOptions)
|
|
|
144
154
|
export declare function registerDbBinding(db: Database, binding: {
|
|
145
155
|
rlsStrategy?: RlsStrategy;
|
|
146
156
|
userLookup?: UserLookup;
|
|
157
|
+
userProfileLookup?: UserProfileLookup;
|
|
147
158
|
}): void;
|
|
148
159
|
export declare function setRlsContext(db: Database, context: RlsContext): Promise<void>;
|
|
149
160
|
export declare function withRlsContext<T>(db: Database, context: RlsContext, fn: (db: Database) => Promise<T>, transactionConfig?: PgTransactionConfig): Promise<T>;
|
|
@@ -166,6 +177,14 @@ export declare function withSessionActivityRlsContext<T>(db: Database, context:
|
|
|
166
177
|
workspaceId: string;
|
|
167
178
|
}, fn: (db: SessionActivityDatabase) => Promise<T>, transactionConfig?: PgTransactionConfig): Promise<T>;
|
|
168
179
|
export declare function withWorkspaceSessionActivityRls<T>(db: Database, workspaceId: string, fn: (db: SessionActivityDatabase) => Promise<T>, transactionConfig?: PgTransactionConfig): Promise<T>;
|
|
180
|
+
/**
|
|
181
|
+
* Run one of several ordered workspace activity scopes inside a caller-owned
|
|
182
|
+
* transaction. Each scope is fully finalized before restoring the caller's
|
|
183
|
+
* gate GUCs, so the next workspace can reuse the same outer transaction.
|
|
184
|
+
*/
|
|
185
|
+
export declare function withRestoredSessionActivityRlsContext<T>(db: Database, context: RlsContext & {
|
|
186
|
+
workspaceId: string;
|
|
187
|
+
}, fn: (db: SessionActivityDatabase) => Promise<T>): Promise<T>;
|
|
169
188
|
/**
|
|
170
189
|
* Open one nested savepoint without losing the gate brand. Drizzle correctly
|
|
171
190
|
* preserves the backend-local gate GUCs, but its structural transaction type
|
|
@@ -266,7 +266,7 @@ export type PersistedEditableArtifactLiveHead = (PersistedEditableArtifactLiveBo
|
|
|
266
266
|
nativeRevision: number;
|
|
267
267
|
}>);
|
|
268
268
|
export type PersistedEditableArtifactLiveResume = Readonly<{
|
|
269
|
-
modality
|
|
269
|
+
modality: "spreadsheet";
|
|
270
270
|
localCursor: number | null;
|
|
271
271
|
localStateHash: string | null;
|
|
272
272
|
localCausalFrontier: PersistedEditableArtifactCausalFrontier;
|
|
@@ -286,6 +286,7 @@ export type PersistedEditableArtifactLiveSnapshot = Readonly<{
|
|
|
286
286
|
causalFrontier: PersistedEditableArtifactCausalFrontier;
|
|
287
287
|
digest: string;
|
|
288
288
|
operationProtocolVersion: number;
|
|
289
|
+
snapshotVersion: number;
|
|
289
290
|
kernelVersion: string;
|
|
290
291
|
modelSchemaVersion: number;
|
|
291
292
|
bytes: Uint8Array;
|
|
@@ -576,7 +577,6 @@ export declare class PostgresEditableArtifactLiveReadStore {
|
|
|
576
577
|
scope: PersistedEditableArtifactScope;
|
|
577
578
|
artifactId: string;
|
|
578
579
|
resume: PersistedEditableArtifactLiveResume;
|
|
579
|
-
protocolVersion: number;
|
|
580
580
|
}): Promise<PersistedEditableArtifactLiveBootstrap>;
|
|
581
581
|
readHead(scopeInput: PersistedEditableArtifactScope, artifactIdInput: string): Promise<PersistedEditableArtifactLiveHead>;
|
|
582
582
|
readTransactions(input: {
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
PostgresEditableArtifactStore,
|
|
9
9
|
listEditableArtifactIdsForSession,
|
|
10
10
|
touchEditableArtifactSessionLink
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-NMUBV7Z5.js";
|
|
12
|
+
import "./chunk-SCPUJS53.js";
|
|
13
|
+
import "./chunk-PR2WMLOQ.js";
|
|
14
14
|
import "./chunk-PZ5AY32C.js";
|
|
15
15
|
export {
|
|
16
16
|
EDITABLE_ARTIFACT_INTENT_MAX_BYTES,
|