@opengeni/core 3.0.1-canary.3 → 3.0.1-canary.35131097657002

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 (38) hide show
  1. package/dist/dependencies.d.ts +1 -1
  2. package/dist/domain/native-mcp-connection-admission.d.ts +3 -0
  3. package/dist/domain/personal-connection-delegations.d.ts +12 -9
  4. package/dist/domain/scheduled-tasks.d.ts +8 -4
  5. package/dist/domain/sessions.d.ts +2 -6
  6. package/dist/index.d.ts +1 -3
  7. package/dist/index.js +727 -1081
  8. package/dist/index.js.map +1 -1
  9. package/package.json +12 -20
  10. package/src/application/composer-submit.ts +2 -1
  11. package/src/application/user-resource-grants.ts +1 -16
  12. package/src/dependencies.ts +5 -1
  13. package/src/domain/capabilities.ts +35 -21
  14. package/src/domain/connector-tool-permissions.ts +8 -0
  15. package/src/domain/native-mcp-connection-admission.ts +14 -0
  16. package/src/domain/personal-connection-delegations.ts +90 -175
  17. package/src/domain/product-integration-skill.gen.ts +1 -1
  18. package/src/domain/scheduled-tasks.ts +149 -144
  19. package/src/domain/sessions.ts +38 -200
  20. package/src/index.ts +1 -3
  21. package/dist/application/host-mcp-owner.d.ts +0 -6
  22. package/dist/application/host-mcp-resolvers.d.ts +0 -13
  23. package/dist/chunk-5WZYFL45.js +0 -266
  24. package/dist/chunk-5WZYFL45.js.map +0 -1
  25. package/dist/domain/connection-authority.d.ts +0 -97
  26. package/dist/domain/connection-authority.js +0 -169
  27. package/dist/domain/connection-authority.js.map +0 -1
  28. package/dist/domain/host-mcp-authority-source-admission.d.ts +0 -10
  29. package/dist/domain/host-mcp-task-admission.d.ts +0 -18
  30. package/dist/remote-mcp-credentials.d.ts +0 -23
  31. package/dist/remote-mcp-credentials.js +0 -11
  32. package/dist/remote-mcp-credentials.js.map +0 -1
  33. package/src/application/host-mcp-owner.ts +0 -41
  34. package/src/application/host-mcp-resolvers.ts +0 -84
  35. package/src/domain/connection-authority.ts +0 -329
  36. package/src/domain/host-mcp-authority-source-admission.ts +0 -25
  37. package/src/domain/host-mcp-task-admission.ts +0 -121
  38. package/src/remote-mcp-credentials.ts +0 -361
@@ -83,7 +83,7 @@ export type DocumentIndexClient = {
83
83
  }) => Promise<Document | void>;
84
84
  };
85
85
  export type ManagedEmailMessage = {
86
- kind: "email_verification" | "password_reset" | "organization_user_setup";
86
+ kind: "email_verification" | "password_reset" | "organization_user_setup" | "sign_in_method_changed";
87
87
  from: string;
88
88
  to: string;
89
89
  subject: string;
@@ -0,0 +1,3 @@
1
+ import type { McpServerConnectionRef } from "@opengeni/contracts";
2
+ /** Reject retired authority sources instead of aliasing them to native IDs. */
3
+ export declare function assertNativeMcpConnectionRef(connectionRef: McpServerConnectionRef | null | undefined): void;
@@ -1,5 +1,6 @@
1
1
  import type { McpServerConfig, Settings } from "@opengeni/config";
2
- import type { AccessGrant, ConnectionMetadata, McpConnectionAuthoritySelection, McpPersonalConnectionDelegation, ResourceRef, SessionTurn, SocialConnection, ToolRef } from "@opengeni/contracts";
2
+ import { HTTPException } from "hono/http-exception";
3
+ import type { AccessGrant, ConnectionMetadata, McpConnectionAccountSelection, McpPersonalConnectionDelegation, ResourceRef, SessionTurn, SocialConnection, ToolRef } from "@opengeni/contracts";
3
4
  import { type Database, type ResolveConnectionCredentialInput, type ResolveConnectionCredentialResult } from "@opengeni/db";
4
5
  export type PersonalConnectionDelegationSource = {
5
6
  kind: "subject";
@@ -27,6 +28,8 @@ export type AuthorizedAtlassianConnection = {
27
28
  };
28
29
  export declare function directPersonalConnectionSubjectId(turn: Pick<SessionTurn, "source" | "initiator" | "initiatorContext">): string | undefined;
29
30
  export declare function personalConnectionDelegationSourceForGrant(grant: AccessGrant): PersonalConnectionDelegationSource;
31
+ /** Account-picker inventory, never an execution grant or credential response. */
32
+ export declare function listOwnConnectionAccountsForGrant(db: Database, grant: AccessGrant): Promise<ConnectionMetadata[]>;
30
33
  export declare function authorizedSocialConnectionsForGrant(input: {
31
34
  db: Database;
32
35
  grant: AccessGrant;
@@ -37,19 +40,22 @@ export declare function authorizedAtlassianConnectionsForGrant(input: {
37
40
  grant: AccessGrant;
38
41
  }): Promise<AuthorizedAtlassianConnection[]>;
39
42
  export declare function selectedPersonalConnectionServers(settings: Pick<Settings, "mcpServers">, tools: ToolRef[]): McpServerConfig[];
43
+ /** An account choice needs user attention; retrying the same work cannot fix it. */
44
+ export declare class ConnectionAccountSelectionError extends HTTPException {
45
+ name: string;
46
+ constructor(message: string);
47
+ }
40
48
  export declare function personalConnectionDelegationsFromVisibleConnections(input: {
41
49
  servers: McpServerConfig[];
42
50
  subjectId: string;
43
51
  connections: ConnectionMetadata[];
44
- authoritySelections?: McpConnectionAuthoritySelection[];
45
- rejectUnselectedActivatedConnections?: boolean;
52
+ authoritySelections?: McpConnectionAccountSelection[];
46
53
  }): McpPersonalConnectionDelegation[];
47
54
  export declare function personalConnectionDelegationsFromParent(input: {
48
55
  servers: McpServerConfig[];
49
56
  parentDelegations: McpPersonalConnectionDelegation[];
50
57
  personalGitHubResources?: ResourceRef[];
51
58
  targetSessionId?: string;
52
- rejectActivatedConnections?: boolean;
53
59
  }): McpPersonalConnectionDelegation[];
54
60
  /**
55
61
  * Freezes Google Drive publishing only when one exact subject-owned connection
@@ -60,13 +66,11 @@ export declare function personalConnectionDelegationsFromParent(input: {
60
66
  export declare function googleDrivePublicationDelegationFromVisibleConnections(input: {
61
67
  subjectId: string;
62
68
  connections: ConnectionMetadata[];
63
- authoritySelection?: McpConnectionAuthoritySelection;
64
- rejectUnselectedActivatedConnection?: boolean;
69
+ authoritySelection?: McpConnectionAccountSelection;
65
70
  }): McpPersonalConnectionDelegation | null;
66
71
  export declare function personalAtlassianDelegationsFromVisibleConnections(input: {
67
72
  subjectId: string;
68
73
  connections: ConnectionMetadata[];
69
- rejectActivatedConnections?: boolean;
70
74
  }): McpPersonalConnectionDelegation[];
71
75
  export declare function personalConnectionDelegationsEqual(left: McpPersonalConnectionDelegation[], right: McpPersonalConnectionDelegation[]): boolean;
72
76
  export declare function personalConnectionDelegationForServer(delegations: McpPersonalConnectionDelegation[], server: Pick<McpServerConfig, "id" | "connectionRef">): McpPersonalConnectionDelegation | null;
@@ -96,8 +100,7 @@ export declare function freezePersonalConnectionDelegations(input: {
96
100
  tools: ToolRef[];
97
101
  resources?: ResourceRef[];
98
102
  source: PersonalConnectionDelegationSource;
99
- authoritySelections?: McpConnectionAuthoritySelection[];
100
- rejectUnselectedActivatedConnections?: boolean;
103
+ authoritySelections?: McpConnectionAccountSelection[];
101
104
  /** Exact first-party export tool + permission gate, not broad opengeni attachment. */
102
105
  googleDrivePublicationEnabled?: boolean;
103
106
  /** Exact first-party Atlassian tool + permission gate. */
@@ -1,5 +1,5 @@
1
1
  import { type Settings } from "@opengeni/config";
2
- import type { AccessGrant, McpPersonalConnectionDelegation, ScheduledTask, ScheduledTaskAgentConfig, Session, SessionAuthorizationPort, SessionAuthorizationSurface, CreateScheduledTaskRequest as CreateScheduledTaskPayload, UpdateScheduledTaskRequest as UpdateScheduledTaskPayload } from "@opengeni/contracts";
2
+ import type { AccessGrant, ScheduledTask, ScheduledTaskAgentConfig, Session, ToolRef, SessionAuthorizationPort, SessionAuthorizationSurface, CreateScheduledTaskRequest as CreateScheduledTaskPayload, UpdateScheduledTaskRequest as UpdateScheduledTaskPayload } from "@opengeni/contracts";
3
3
  import { type KnowledgeContext, type Database, type TemporalScheduleCleanupClaim, type UpdateScheduledTaskInput } from "@opengeni/db";
4
4
  import { type AccessGrantAuthorization } from "../access/index.js";
5
5
  import type { SessionWorkflowClient } from "../dependencies.js";
@@ -13,6 +13,8 @@ import type { ObjectStorageDependency } from "../dependencies.js";
13
13
  * verbatim.
14
14
  */
15
15
  export declare function scheduledTaskToolsProvided(rawPayload: unknown): boolean;
16
+ /** Resolve the target's current tool policy before choosing its owner's accounts. */
17
+ export declare function scheduledConnectionTools(db: Database, workspaceId: string, settings: Settings, target: Session | null, taskTools: ToolRef[], subjectId?: string): Promise<ToolRef[]>;
16
18
  export declare function scheduledConnectionSurfaceEligibility(settings: Settings, target: Pick<Session, "firstPartyMcpTools" | "firstPartyMcpPermissions"> | null): {
17
19
  googleDrivePublicationEnabled: boolean;
18
20
  atlassianEnabled: boolean;
@@ -37,11 +39,13 @@ export declare function createValidatedScheduledTask(input: {
37
39
  */
38
40
  export declare function withScheduledTaskAuthorityWriteErrors<T>(run: () => Promise<T>): Promise<T>;
39
41
  /** API/MCP-facing update that maps authority-write denials to 409. */
40
- export declare function updateScheduledTaskForApi(db: Database, workspaceId: string, taskId: string, update: UpdateScheduledTaskInput, learning?: {
42
+ export declare function updateScheduledTaskForApi(db: Database, grant: AccessGrant, taskId: string, update: UpdateScheduledTaskInput, learning?: {
41
43
  authorization: AccessGrantAuthorization;
42
44
  request: NonNullable<UpdateScheduledTaskPayload["agentLearning"]>;
43
45
  restoreState: ScheduledTaskRestoreState;
44
46
  }): Promise<ScheduledTask>;
47
+ export declare function assertScheduledTaskMutationOwner(db: Database, grant: AccessGrant, taskId: string): Promise<void>;
48
+ export declare function triggerScheduledTaskForGrant(db: Database, grant: AccessGrant, workflowClient: SessionWorkflowClient, input: Parameters<SessionWorkflowClient["triggerScheduledTask"]>[0]): Promise<void>;
45
49
  export declare function validateScheduledTaskTarget(input: {
46
50
  db: Database;
47
51
  sessionAuthorization?: SessionAuthorizationPort | null | undefined;
@@ -87,7 +91,6 @@ export declare function validatedScheduledTaskUpdate(input: {
87
91
  export declare function requireScheduledTaskForApi(db: Database, workspaceId: string, taskId: string): Promise<ScheduledTask>;
88
92
  export type ScheduledTaskRestoreState = {
89
93
  task: ScheduledTask;
90
- personalConnectionDelegations: McpPersonalConnectionDelegation[];
91
94
  learning?: {
92
95
  context: KnowledgeContext;
93
96
  scope: "workspace" | "personal";
@@ -95,7 +98,7 @@ export type ScheduledTaskRestoreState = {
95
98
  expectedVersion: number;
96
99
  };
97
100
  };
98
- export declare function captureScheduledTaskRestoreState(db: Database, task: ScheduledTask): Promise<ScheduledTaskRestoreState>;
101
+ export declare function captureScheduledTaskRestoreState(_db: Database, task: ScheduledTask): Promise<ScheduledTaskRestoreState>;
99
102
  export declare function restoreScheduledTask(db: Database, previous: ScheduledTaskRestoreState): Promise<ScheduledTask>;
100
103
  export declare class ScheduledTaskSyncError extends Error {
101
104
  readonly persistenceRestored: boolean;
@@ -113,6 +116,7 @@ export declare function deleteScheduledTaskLifecycle(input: {
113
116
  workspaceId: string;
114
117
  taskId: string;
115
118
  subjectId: string;
119
+ beforeDeleteCommit?: (tx: Database) => Promise<void>;
116
120
  preflightConnectorAuthorization: (task: ScheduledTask) => Promise<void>;
117
121
  cleanupConnectorAuthorization: (db: Database, task: ScheduledTask) => Promise<void>;
118
122
  processCleanupClaims?: (claims: readonly TemporalScheduleCleanupClaim[]) => Promise<void>;
@@ -1,6 +1,5 @@
1
- import { type HostMcpCreateSelection } from "@opengeni/contracts/host-mcp-bindings";
2
1
  import { type Settings } from "@opengeni/config";
3
- import { SessionSpawnDenial, type AccessGrant, type ComposerDraft, type CreateSessionResponse, type GoalSpec, type FirstPartyMcpToolName, type McpPersonalConnectionDelegation, type McpConnectionAuthoritySelection, type Permission, type PersonalResourceAttachmentIntent, type ReasoningEffort, type ResourceRef, type Session, type SessionAgentAccess, type SessionCommandReceipt, type SessionScopeSubjectId, type SessionMemoryScope, type SessionSkill, type SessionEvent, SessionMcpApprovalPolicy, type SessionMcpCredentialUpdateInput, type SessionMcpServerMetadata, type SubmittedTimelineAnnotation, type TimelineAnnotation, type UpdateSessionMcpApprovalPolicyResponse, type UpdateSessionToolPolicyRequest, type SessionAuthorizationPort, type SessionToolPolicy, type SessionTurn, type SessionPromptRouting, type SessionGoalSnapshot, type ToolRef, type TurnInitiator, type TurnInitiatorContext, type TurnExecutionPolicyV1, type VariableSet, type XaiProviderAccountAuthoritySnapshotV1 } from "@opengeni/contracts";
2
+ import { SessionSpawnDenial, type AccessGrant, type ComposerDraft, type CreateSessionResponse, type GoalSpec, type FirstPartyMcpToolName, type McpPersonalConnectionDelegation, type McpConnectionAccountSelection, type Permission, type PersonalResourceAttachmentIntent, type ReasoningEffort, type ResourceRef, type Session, type SessionAgentAccess, type SessionCommandReceipt, type SessionScopeSubjectId, type SessionMemoryScope, type SessionSkill, type SessionEvent, SessionMcpApprovalPolicy, type SessionMcpCredentialUpdateInput, type SessionMcpServerMetadata, type SubmittedTimelineAnnotation, type TimelineAnnotation, type UpdateSessionMcpApprovalPolicyResponse, type UpdateSessionToolPolicyRequest, type SessionAuthorizationPort, type SessionToolPolicy, type SessionTurn, type SessionPromptRouting, type SessionGoalSnapshot, type ToolRef, type TurnInitiator, type TurnInitiatorContext, type TurnExecutionPolicyV1, type VariableSet, type XaiProviderAccountAuthoritySnapshotV1 } from "@opengeni/contracts";
4
3
  import { type CreateSessionMcpServerInput, type Database, type UpdateSessionMcpServerCredentialsInput, type SessionCommandActor, type NewSessionDraftSnapshot } from "@opengeni/db";
5
4
  import { type EventBus } from "@opengeni/events";
6
5
  import { type AccessGrantAuthorization } from "../access/index.js";
@@ -106,7 +105,6 @@ export declare function createAndStartSessionWithOutcome(input: {
106
105
  captureInitialTurnAuthority?: (tx: Database, sessionId: string, turnId: string) => Promise<void>;
107
106
  /** Internal replay identity; the verified caller must also capture authority.
108
107
  * Supplying selection metadata alone never grants runtime use. */
109
- selectedHostMcpDelegations?: HostMcpCreateSelection[];
110
108
  /** The custom workspace model was frozen by an earlier accepted boundary or
111
109
  * inherited from an existing session, so retirement must not invalidate it. */
112
110
  retainWorkspaceGatewayModel?: boolean;
@@ -281,7 +279,6 @@ type PostUserMessageTurnInput = {
281
279
  clientEventId?: string;
282
280
  mcpCredentialUpdates?: UpdateSessionMcpServerCredentialsInput[];
283
281
  personalConnectionDelegations?: McpPersonalConnectionDelegation[];
284
- selectedHostMcpDelegations?: HostMcpCreateSelection[];
285
282
  captureTurnAuthority?: (tx: Database, turnId: string) => Promise<void>;
286
283
  personalResourceAttachment?: PersonalResourceAttachmentIntent;
287
284
  delivery?: "send" | "steer";
@@ -364,8 +361,7 @@ declare function acceptSessionUserMessageInFileScope(deps: AcceptSessionUserMess
364
361
  latencyMode?: "standard" | "priority" | "fast" | null;
365
362
  clientEventId?: string;
366
363
  mcpCredentialUpdates?: SessionMcpCredentialUpdateInput[];
367
- connectionAuthorities?: McpConnectionAuthoritySelection[];
368
- selectedHostMcpDelegations?: HostMcpCreateSelection[];
364
+ connectionAccounts?: McpConnectionAccountSelection[];
369
365
  delivery?: "send" | "steer";
370
366
  origin?: "human" | "operator";
371
367
  controlEtag?: string | null;
package/dist/index.d.ts CHANGED
@@ -15,17 +15,15 @@ export * from "./sandbox/runtime-settings.js";
15
15
  export * from "./access/index.js";
16
16
  export * from "./application/external-workspace-members.js";
17
17
  export * from "./application/external-identity-lifecycle.js";
18
- export * from "./application/host-mcp-resolvers.js";
19
18
  export * from "./application/external-continuation.js";
20
19
  export * from "./application/session-mcp-credential-rotation.js";
21
20
  export * from "./application/external-link-work-admission.js";
22
21
  export * from "./application/connect-authority.js";
23
- export * from "./application/host-mcp-owner.js";
24
22
  export * from "./application/connect-operation.js";
25
23
  export * from "./session-authorization.js";
26
24
  export * from "./billing/limits.js";
27
25
  export * from "./domain/capabilities.js";
28
- export * from "./domain/host-mcp-authority-source-admission.js";
26
+ export * from "./domain/native-mcp-connection-admission.js";
29
27
  export * from "./domain/skill-imports.js";
30
28
  export * from "./domain/skill-search.js";
31
29
  export * from "./domain/github-skill-source.js";