@opengeni/db 3.4.0-canary.2 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/canonical-human-identities.d.ts +20 -0
  2. package/dist/canonical-human-identities.js +7 -3
  3. package/dist/{chunk-ZWRIPCTR.js → chunk-2NT476HD.js} +2 -2
  4. package/dist/{chunk-PYMY3AJW.js → chunk-744DFC65.js} +202 -7
  5. package/dist/chunk-744DFC65.js.map +1 -0
  6. package/dist/{chunk-O6FTELKH.js → chunk-CDMMSUWJ.js} +3 -3
  7. package/dist/chunk-G3732M3T.js +299 -0
  8. package/dist/chunk-G3732M3T.js.map +1 -0
  9. package/dist/{chunk-TRBOWUG3.js → chunk-IW6O6G7R.js} +2 -2
  10. package/dist/{chunk-HY3F5Q4E.js → chunk-Q5YUGQVK.js} +3 -3
  11. package/dist/{chunk-V3TRUXFJ.js → chunk-UGDVSQ6U.js} +72 -19
  12. package/dist/chunk-UGDVSQ6U.js.map +1 -0
  13. package/dist/{chunk-C2AFP7SB.js → chunk-UJ2EW3QI.js} +6664 -6051
  14. package/dist/chunk-UJ2EW3QI.js.map +1 -0
  15. package/dist/{chunk-H7MXYG7R.js → chunk-WW7AJ5IC.js} +2 -2
  16. package/dist/editable-artifact-durable-export.js +2 -2
  17. package/dist/editable-artifacts.js +3 -3
  18. package/dist/index.d.ts +44 -6
  19. package/dist/index.js +2914 -1535
  20. package/dist/index.js.map +1 -1
  21. package/dist/managed-auth-session-set-schema.d.ts +1399 -0
  22. package/dist/managed-auth-session-sets.d.ts +145 -0
  23. package/dist/managed-auth-session-sets.js +50 -0
  24. package/dist/managed-auth-session-sets.js.map +1 -0
  25. package/dist/organization-recovery-schema.d.ts +2144 -0
  26. package/dist/organization-recovery.d.ts +186 -0
  27. package/dist/provision-roles.js +1 -1
  28. package/dist/runtime-posture.d.ts +7 -4
  29. package/dist/schema.d.ts +9 -6
  30. package/dist/schema.js +43 -1
  31. package/dist/session-background-commands.js +3 -3
  32. package/dist/session-control.d.ts +5 -3
  33. package/dist/session-queue-commands.d.ts +2 -0
  34. package/dist/session-tenancy.js +3 -3
  35. package/dist/video-generation.js +3 -3
  36. package/dist/work-claims-schema.d.ts +975 -0
  37. package/dist/work-claims.d.ts +83 -0
  38. package/drizzle/0362_managed_auth_session_sets.sql +2347 -0
  39. package/drizzle/0363_organization_recovery_custody.sql +2418 -0
  40. package/drizzle/0364_workspace_learning_policy_snapshot_lock_order.sql +221 -0
  41. package/drizzle/0365_permission_scoped_work_claims.sql +1306 -0
  42. package/drizzle/0366_session_discovery_title_search_index.sql +5 -0
  43. package/drizzle/0367_session_discovery_goal_search_index.sql +5 -0
  44. package/drizzle/0368_session_discovery_claim_search_index.sql +6 -0
  45. package/package.json +10 -6
  46. package/src/canonical-human-identities.ts +105 -27
  47. package/src/index.ts +1471 -433
  48. package/src/managed-auth-session-set-schema.ts +176 -0
  49. package/src/managed-auth-session-sets.ts +430 -0
  50. package/src/organization-recovery-schema.ts +277 -0
  51. package/src/organization-recovery.ts +424 -0
  52. package/src/provision-roles.ts +67 -0
  53. package/src/runtime-posture.ts +144 -6
  54. package/src/schema.ts +3 -0
  55. package/src/session-control.ts +255 -16
  56. package/src/session-queue-commands.ts +10 -1
  57. package/src/session-tool-call-settlement.ts +6 -1
  58. package/src/work-claims-schema.ts +148 -0
  59. package/src/work-claims.ts +200 -0
  60. package/dist/chunk-C2AFP7SB.js.map +0 -1
  61. package/dist/chunk-PYMY3AJW.js.map +0 -1
  62. package/dist/chunk-V3TRUXFJ.js.map +0 -1
  63. /package/dist/{chunk-ZWRIPCTR.js.map → chunk-2NT476HD.js.map} +0 -0
  64. /package/dist/{chunk-O6FTELKH.js.map → chunk-CDMMSUWJ.js.map} +0 -0
  65. /package/dist/{chunk-TRBOWUG3.js.map → chunk-IW6O6G7R.js.map} +0 -0
  66. /package/dist/{chunk-HY3F5Q4E.js.map → chunk-Q5YUGQVK.js.map} +0 -0
  67. /package/dist/{chunk-H7MXYG7R.js.map → chunk-WW7AJ5IC.js.map} +0 -0
@@ -4,7 +4,7 @@ import {
4
4
  sessions,
5
5
  workspaceSessionActivityRevisions,
6
6
  workspaces
7
- } from "./chunk-C2AFP7SB.js";
7
+ } from "./chunk-UJ2EW3QI.js";
8
8
 
9
9
  // src/persistence-errors.ts
10
10
  var SQLSTATE_KEYS = ["sqlState", "sqlstate", "code"];
@@ -757,4 +757,4 @@ export {
757
757
  withAccountRls,
758
758
  dbBindingFor
759
759
  };
760
- //# sourceMappingURL=chunk-H7MXYG7R.js.map
760
+ //# sourceMappingURL=chunk-WW7AJ5IC.js.map
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  rawRows,
3
3
  withRlsContext
4
- } from "./chunk-H7MXYG7R.js";
5
- import "./chunk-C2AFP7SB.js";
4
+ } from "./chunk-WW7AJ5IC.js";
5
+ import "./chunk-UJ2EW3QI.js";
6
6
  import "./chunk-PZ5AY32C.js";
7
7
 
8
8
  // src/editable-artifact-durable-export.ts
@@ -8,9 +8,9 @@ import {
8
8
  PostgresEditableArtifactStore,
9
9
  listEditableArtifactIdsForSession,
10
10
  touchEditableArtifactSessionLink
11
- } from "./chunk-ZWRIPCTR.js";
12
- import "./chunk-H7MXYG7R.js";
13
- import "./chunk-C2AFP7SB.js";
11
+ } from "./chunk-2NT476HD.js";
12
+ import "./chunk-WW7AJ5IC.js";
13
+ import "./chunk-UJ2EW3QI.js";
14
14
  import "./chunk-PZ5AY32C.js";
15
15
  export {
16
16
  EDITABLE_ARTIFACT_INTENT_MAX_BYTES,
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type ChildLifecycleSystemUpdateKind, type ChildRequiresActionRespondedByKind, SessionGoalSnapshot } from "@opengeni/contracts";
2
- import type { AccessContext, AccessGrant, AccessPrincipalKind, ApiKey, AttemptToolResult, BillingBalance, CapabilityCatalogItem, CapabilityInstallation, CapabilityPack, CapabilitySource, ConnectionKind, ConnectionMetadata, ConnectionStatus, DocumentAuthorityKind, McpServerConnectionRef, FileAsset, FileUploadStatus, FirstPartyMcpToolName, HumanInputQuestion, HumanInputResponse, KnowledgeMemory, KnowledgeMemoryKind, KnowledgeMemoryStatus, KnowledgeSourceRef, GitHubInstallationAuthorityKind, GitHubRepositoryScope, HostEventExportBatch, HostUsageExportBatch, ManagedAccount, ManagedOrganizationMembershipProjection, McpPersonalConnectionDelegation, ModelContextContributionSummary, Permission, PersonalResourceAttachmentIntent, PackInstallation, PackInstallationStatus, ResourceRef, SandboxBackend, SandboxOs, ScheduledTask, ScheduledTaskAction, ScheduledTaskActionKind, KnowledgeSourceSyncAction, ScheduledTaskAgentConfig, ScheduledTaskOverlapPolicy, ScheduledTaskRun, ScheduledTaskRunAcceptedExecution as ScheduledTaskRunAcceptedExecutionType, ScheduledTaskRunMode, ScheduledTaskRunStatus, ScheduledTaskScheduleSpec, ScheduledTaskStatus, ScheduledTaskTriggerType, SlackInstallationBinding, Session, SessionAuthorizationListScope, SessionListResponse, SessionEvent, SessionEventPayloadMode, SessionEventReadDirection, SessionEventSemanticClass, SessionEventType, SessionGoal, SessionGoalChangeKind, SessionGoalCreatedBy, SessionGoalMutationPolicy, SessionGoalRevision, SessionGoalStatus, SessionHumanInputRequest, LineageNode, SessionMcpApprovalPolicy, SessionSkill, SessionMcpServerMetadata, SessionStatus, SessionToolPolicy, SessionTurn, SessionQueueSnapshot, SessionSystemUpdate, SessionSystemUpdateKind, SystemUpdateClassification, SessionTurnSource, SessionTurnStatus, TurnInitiator, TurnInitiatorContext, SocialConnection, SocialConnectionStatus, SocialPost, SocialProvider, ToolRef, ReasoningEffort, UsageEvent, Workspace, WorkspaceControlEvent, VariableSet, VariableSetSecret, VariableSetVariableMetadata, WorkspaceMember, WorkspaceMemoryPromptMode, WorkspaceRegisteredPack, Channel, Rig, RigProviderImage, RigProviderImages, RigVersion, RigVerificationHealth, RigChange, RigChangeKind, RigChangeStatus, RigCheck, NativeSnapshotDescriptor, TarWorkspaceArchiveDescriptor, WorkspaceArchiveDescriptor, ModalCheckpointProviderBinding, SandboxProviderContinuityRecovery } from "@opengeni/contracts";
2
+ import type { AccessContext, AccessGrant, AccessPrincipalKind, ApiKey, AttemptToolResult, BillingBalance, CapabilityCatalogItem, CapabilityInstallation, CapabilityPack, CapabilitySource, ConnectionKind, ConnectionMetadata, ConnectionStatus, DocumentAuthorityKind, McpServerConnectionRef, FileAsset, FileUploadStatus, FirstPartyMcpToolName, HumanInputQuestion, HumanInputResponse, KnowledgeMemory, KnowledgeMemoryKind, KnowledgeMemoryStatus, KnowledgeSourceRef, GitHubInstallationAuthorityKind, GitHubRepositoryScope, HostEventExportBatch, HostUsageExportBatch, ManagedAccount, ManagedOrganizationMembershipProjection, McpPersonalConnectionDelegation, ModelContextContributionSummary, Permission, PersonalResourceAttachmentIntent, PackInstallation, PackInstallationStatus, ResourceRef, SandboxBackend, SandboxOs, ScheduledTask, ScheduledTaskAction, ScheduledTaskActionKind, KnowledgeSourceSyncAction, ScheduledTaskAgentConfig, ScheduledTaskOverlapPolicy, ScheduledTaskRun, ScheduledTaskRunAcceptedExecution as ScheduledTaskRunAcceptedExecutionType, ScheduledTaskRunMode, ScheduledTaskRunStatus, ScheduledTaskScheduleSpec, ScheduledTaskStatus, ScheduledTaskTriggerType, SlackInstallationBinding, Session, SessionAuthorizationListScope, SessionListResponse, SessionEvent, SessionEventPayloadMode, SessionEventReadDirection, SessionEventSemanticClass, SessionEventType, SessionGoal, SessionGoalChangeKind, SessionGoalCreatedBy, SessionGoalMutationPolicy, SessionGoalRevision, SessionGoalStatus, SessionHumanInputRequest, LineageNode, SessionMcpApprovalPolicy, SessionSkill, SessionMcpServerMetadata, SessionStatus, SessionToolPolicy, SessionTurn, SessionQueueSnapshot, SessionSystemUpdate, SessionSystemUpdateKind, SystemUpdateClassification, SessionTurnSource, SessionTurnStatus, TurnInitiator, TurnInitiatorContext, SocialConnection, SocialConnectionStatus, SocialPost, SocialProvider, ToolRef, ReasoningEffort, UsageEvent, Workspace, WorkspaceControlEvent, VariableSet, VariableSetSecret, VariableSetVariableMetadata, WorkspaceMember, WorkspaceMemoryPromptMode, WorkspaceRegisteredPack, Channel, Rig, RigProviderImage, RigProviderImages, RigVersion, RigVerificationHealth, RigChange, RigChangeKind, RigChangeStatus, RigCheck, NativeSnapshotDescriptor, TarWorkspaceArchiveDescriptor, WorkspaceArchiveDescriptor, ModalCheckpointProviderBinding, SandboxProviderContinuityRecovery, WorkClaimSubjectFilter, WorkDiscoveryProjection } from "@opengeni/contracts";
3
3
  import { type WorkspaceArchiveObjectRef, RequestHumanInteractionToolInput, XaiProviderAccountAuthoritySnapshotV1, type TimelineAnnotation } from "@opengeni/contracts";
4
4
  import { type LatencyMode, SessionSystemUpdatePayload, TurnExecutionPolicyV1 } from "@opengeni/contracts";
5
5
  import { type Settings } from "@opengeni/config";
@@ -36,6 +36,7 @@ export * from "./company-brain-governed-writes.js";
36
36
  export * from "./company-brain-context-selection.js";
37
37
  export * from "./knowledge-source-sync.js";
38
38
  export * from "./task-notes.js";
39
+ export * from "./work-claims.js";
39
40
  export * from "./managed-human-provisioning.js";
40
41
  export * from "./managed-user-setup.js";
41
42
  export * from "./organization-membership-backfill.js";
@@ -281,6 +282,7 @@ export declare function ensureManagedAccessForUser(db: Database, input: {
281
282
  name: string;
282
283
  emailVerified?: boolean;
283
284
  provisionFallbackOrganization?: boolean;
285
+ bindPendingInvitations?: boolean;
284
286
  }): Promise<AccessContext>;
285
287
  export type ManagedAccessProvisioningResult = {
286
288
  accessContext: AccessContext;
@@ -292,6 +294,7 @@ export declare function ensureManagedAccessForUserWithOrganizationMemberships(db
292
294
  name: string;
293
295
  emailVerified?: boolean;
294
296
  provisionFallbackOrganization?: boolean;
297
+ bindPendingInvitations?: boolean;
295
298
  }): Promise<ManagedAccessProvisioningResult>;
296
299
  export declare function getWorkspace(db: Database, workspaceId: string): Promise<Workspace | null>;
297
300
  export declare function getManagedAccount(db: Database, accountId: string): Promise<ManagedAccount | null>;
@@ -2750,6 +2753,7 @@ export type VariableSetAccessContext = {
2750
2753
  subjectId: string;
2751
2754
  };
2752
2755
  export declare function listVariableSets(db: Database, context: VariableSetAccessContext): Promise<VariableSet[]>;
2756
+ export declare function resolveVariableSetAttachments(db: Database, context: VariableSetAccessContext, variableSetIds: readonly string[]): Promise<Array<Pick<VariableSet, "id" | "scope">>>;
2753
2757
  export declare function getVariableSet(db: Database, context: VariableSetAccessContext, variableSetId: string): Promise<VariableSet | null>;
2754
2758
  export declare function getVariableSetByName(db: Database, context: VariableSetAccessContext, name: string, scope?: VariableSet["scope"]): Promise<VariableSet | null>;
2755
2759
  export type VariableSetSecretAuditActor = {
@@ -4875,6 +4879,8 @@ export declare function setSessionAttention(db: Database, input: {
4875
4879
  acknowledgedThroughSequence?: number | undefined;
4876
4880
  activelyWorking?: boolean | undefined;
4877
4881
  expectedVersion?: number | undefined;
4882
+ /** See {@link PersonalWorkspaceOwnerException}. Absent means "no exception". */
4883
+ personalWorkspaceOwnerException?: PersonalWorkspaceOwnerException | undefined;
4878
4884
  }): Promise<Session | null>;
4879
4885
  /**
4880
4886
  * Archive or restore one root chat for a single member. Archiving also removes
@@ -4887,6 +4893,8 @@ export declare function setSessionArchive(db: Database, input: {
4887
4893
  sessionId: string;
4888
4894
  archived: boolean;
4889
4895
  expectedVersion?: number | undefined;
4896
+ /** See {@link PersonalWorkspaceOwnerException}. Absent means "no exception". */
4897
+ personalWorkspaceOwnerException?: PersonalWorkspaceOwnerException | undefined;
4890
4898
  }): Promise<Session | null>;
4891
4899
  export declare function listSessions(db: Database, workspaceId: string, limit?: number): Promise<Session[]>;
4892
4900
  export declare function listSessions(db: Database, workspaceId: string, options?: ListSessionsOptions): Promise<Session[]>;
@@ -4899,9 +4907,11 @@ export declare function listSessions(db: Database, workspaceId: string, options?
4899
4907
  * result. The workspace filter remains authoritative under FORCE RLS.
4900
4908
  */
4901
4909
  export declare function getLatestSessionModelForSubject(db: Database, workspaceId: string, subjectId: string): Promise<string | null>;
4902
- export type SessionDiscoveryOrderBy = "createdAt" | "updatedAt";
4910
+ export type SessionDiscoveryOrderBy = "createdAt" | "updatedAt" | "relevance";
4903
4911
  export type SessionDiscoveryCursor = {
4904
4912
  orderBy: SessionDiscoveryOrderBy;
4913
+ /** Stable rank class for relevance order; null for chronological order. */
4914
+ sortRank: number | null;
4905
4915
  /** Decimal database activity revision; zero is the legacy/created-order bucket. */
4906
4916
  sortRevision: string;
4907
4917
  /** Exact PostgreSQL timestamp text (including microseconds), not a JS Date. */
@@ -4913,6 +4923,8 @@ export type SessionDiscoveryCursor = {
4913
4923
  snapshotRevision: string;
4914
4924
  /** Incremental revision scope is cursor-bound and cannot change on continuation. */
4915
4925
  updatedAfter: string | null;
4926
+ /** SHA-256 of normalized relevance filters; null for chronological order. */
4927
+ filterHash: string | null;
4916
4928
  };
4917
4929
  export declare const SESSION_DISCOVERY_GOAL_MAX_CHARS = 600;
4918
4930
  export declare const SESSION_DISCOVERY_MESSAGE_MAX_CHARS = 600;
@@ -4937,12 +4949,15 @@ export type SessionDiscoverySummary = {
4937
4949
  preview: string | null;
4938
4950
  previewOriginalChars: number | null;
4939
4951
  } | null;
4952
+ workDiscovery: WorkDiscoveryProjection;
4940
4953
  createdAt: string;
4941
4954
  updatedAt: string;
4942
4955
  /** Internal exact revision key; omitted from the MCP row projection. */
4943
4956
  sortRevision: string;
4944
4957
  /** Internal exact keyset timestamp; omitted from the MCP row projection. */
4945
4958
  sortAt: string;
4959
+ /** Internal stable relevance class; omitted from public row projections. */
4960
+ sortRank: number | null;
4946
4961
  };
4947
4962
  /**
4948
4963
  * Compact-by-construction discovery projection for the first-party
@@ -4956,7 +4971,17 @@ export declare function listSessionDiscoverySummaries(db: Database, workspaceId:
4956
4971
  orderBy?: SessionDiscoveryOrderBy;
4957
4972
  updatedAfter?: string;
4958
4973
  parentSessionId?: string | null;
4974
+ rootSessionId?: string;
4975
+ query?: string;
4976
+ /** @deprecated use query; retained for the existing topology route. */
4959
4977
  search?: string;
4978
+ statuses?: SessionStatus[];
4979
+ activeOnly?: boolean;
4980
+ recentHours?: number;
4981
+ subject?: WorkClaimSubjectFilter;
4982
+ claimLimit?: number;
4983
+ /** Skip advisory claim reads for an operator-disabled discovery rollout. */
4984
+ includeWorkDiscovery?: boolean;
4960
4985
  subjectId?: string;
4961
4986
  authorizationScope?: SessionAuthorizationListScope;
4962
4987
  }): Promise<{
@@ -4969,6 +4994,8 @@ export declare function listSessionDiscoverySummaries(db: Database, workspaceId:
4969
4994
  snapshotRevision: string;
4970
4995
  updatedThrough: string | null;
4971
4996
  updatedAfter: string | null;
4997
+ /** Internal relevance cursor binding; omitted from row projections. */
4998
+ filterHash: string | null;
4972
4999
  }>;
4973
5000
  export type SessionDiscoveryAncestor = {
4974
5001
  id: string;
@@ -4980,7 +5007,7 @@ export type SessionDiscoveryAncestor = {
4980
5007
  * Authorization is re-applied to every ancestor so exact-session grants never
4981
5008
  * acquire parent metadata merely by searching for their target.
4982
5009
  */
4983
- export declare function listSessionDiscoveryAncestorPaths(db: Database, workspaceId: string, sessionIds: string[], authorizationScope?: SessionAuthorizationListScope): Promise<Map<string, SessionDiscoveryAncestor[]>>;
5010
+ export declare function listSessionDiscoveryAncestorPaths(db: Database, workspaceId: string, sessionIds: string[], authorizationScope?: SessionAuthorizationListScope, subjectId?: string): Promise<Map<string, SessionDiscoveryAncestor[]>>;
4984
5011
  export type SessionLineage = {
4985
5012
  ancestors: Session[];
4986
5013
  children: LineageNode[];
@@ -5129,6 +5156,12 @@ export type AcceptSessionHumanInputResponseResult = {
5129
5156
  event: SessionEvent;
5130
5157
  events: SessionEvent[];
5131
5158
  workflowWakeRevision: number;
5159
+ } | {
5160
+ action: "completed";
5161
+ request: SessionHumanInputRequest;
5162
+ event: SessionEvent;
5163
+ events: SessionEvent[];
5164
+ workflowWakeRevision: number | null;
5132
5165
  } | {
5133
5166
  action: "conflict";
5134
5167
  request: SessionHumanInputRequest;
@@ -5138,9 +5171,12 @@ export type AcceptSessionHumanInputResponseResult = {
5138
5171
  action: "not_found";
5139
5172
  };
5140
5173
  /**
5141
- * First-writer-wins settlement for one pending structured input boundary.
5142
- * Session + logical turn + current freeze generation are locked with the row;
5143
- * the creation attempt is provenance and is intentionally not the resume owner.
5174
+ * First-writer-wins settlement for one structured input boundary. Session +
5175
+ * logical turn + current freeze generation are locked with the row; the
5176
+ * creation attempt is provenance and is intentionally not the resume owner.
5177
+ * A committed response replays its original event without another event or
5178
+ * workflow wake. Historical cancelled rows missing that canonical event are
5179
+ * repaired exactly once under the same locks, but never wake terminal work.
5144
5180
  */
5145
5181
  export declare function acceptSessionHumanInputResponse(db: Database, input: {
5146
5182
  accountId: string;
@@ -9494,6 +9530,8 @@ export * from "./attached-browser-devices.js";
9494
9530
  export * from "./interaction-revisions.js";
9495
9531
  export * from "./interaction-placement-loss.js";
9496
9532
  export * from "./canonical-human-identities.js";
9533
+ export * from "./managed-auth-session-sets.js";
9534
+ export * from "./organization-recovery.js";
9497
9535
  export * from "./session-tenancy.js";
9498
9536
  export * from "./governed-learning-activation.js";
9499
9537
  export * from "./automations.js";