@opengeni/core 3.0.1 → 4.0.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/README.md +1 -1
- package/dist/application/connect-operation.d.ts +3 -0
- package/dist/application/sandbox-recovery.d.ts +49 -0
- package/dist/{chunk-H7X52RI2.js → chunk-TFHSE7XR.js} +13 -2
- package/dist/chunk-TFHSE7XR.js.map +1 -0
- package/dist/dependencies.d.ts +1 -1
- package/dist/domain/capabilities.d.ts +2 -2
- package/dist/domain/connection-account-selection-error.d.ts +6 -0
- package/dist/domain/connector-tool-permissions.d.ts +27 -0
- package/dist/domain/editable-artifacts/agent-application.d.ts +8 -0
- package/dist/domain/environments.d.ts +3 -7
- package/dist/domain/insights-timing.d.ts +16 -0
- package/dist/domain/insights.d.ts +4 -1
- package/dist/domain/knowledge-files.d.ts +1 -1
- package/dist/domain/knowledge-preparation.d.ts +9 -0
- package/dist/domain/knowledge-preparation.test.d.ts +1 -0
- package/dist/domain/mcp-account-bindings.d.ts +19 -0
- package/dist/domain/native-mcp-connection-admission.d.ts +3 -0
- package/dist/domain/organization-integration-catalog.d.ts +15 -0
- package/dist/domain/personal-connection-delegations.d.ts +19 -10
- package/dist/domain/pr-review.d.ts +56 -4
- package/dist/domain/scheduled-tasks.d.ts +8 -5
- package/dist/domain/session-file-access.d.ts +4 -0
- package/dist/domain/sessions.d.ts +8 -6
- package/dist/domain/skills.d.ts +29 -1
- package/dist/editable-artifacts.js +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.js +4868 -4803
- package/dist/index.js.map +1 -1
- package/dist/sandbox/routing.d.ts +2 -1
- package/dist/sandbox/runtime-settings.d.ts +1 -15
- package/package.json +11 -19
- package/src/application/composer-submit.ts +2 -1
- package/src/application/connect-operation.ts +32 -3
- package/src/application/sandbox-recovery.ts +55 -0
- package/src/application/user-resource-grants.ts +1 -16
- package/src/dependencies.ts +5 -1
- package/src/domain/capabilities.ts +169 -122
- package/src/domain/connection-account-selection-error.ts +9 -0
- package/src/domain/connector-tool-permissions.ts +305 -0
- package/src/domain/editable-artifacts/agent-application.ts +31 -2
- package/src/domain/environments.ts +4 -9
- package/src/domain/file-owner.ts +16 -1
- package/src/domain/insights-timing.ts +95 -0
- package/src/domain/insights.ts +59 -35
- package/src/domain/knowledge-files.ts +10 -3
- package/src/domain/knowledge-messages.ts +1 -0
- package/src/domain/knowledge-preparation.test.ts +251 -0
- package/src/domain/knowledge-preparation.ts +126 -0
- package/src/domain/mcp-account-bindings.ts +152 -0
- package/src/domain/native-mcp-connection-admission.ts +14 -0
- package/src/domain/organization-integration-catalog.ts +83 -0
- package/src/domain/personal-connection-delegations.ts +226 -177
- package/src/domain/pr-review.ts +22 -6
- package/src/domain/resources.ts +9 -2
- package/src/domain/scheduled-tasks.ts +200 -155
- package/src/domain/session-file-access.ts +47 -0
- package/src/domain/session-tool-policy.ts +12 -4
- package/src/domain/sessions.ts +390 -261
- package/src/domain/skills.ts +9 -0
- package/src/index.ts +10 -6
- package/src/rigs/index.ts +17 -17
- package/src/sandbox/routing.ts +18 -7
- package/src/sandbox/runtime-settings.ts +7 -91
- package/dist/application/host-mcp-owner.d.ts +0 -6
- package/dist/application/host-mcp-resolvers.d.ts +0 -13
- package/dist/chunk-5WZYFL45.js +0 -266
- package/dist/chunk-5WZYFL45.js.map +0 -1
- package/dist/chunk-H7X52RI2.js.map +0 -1
- package/dist/domain/connection-authority.d.ts +0 -97
- package/dist/domain/connection-authority.js +0 -169
- package/dist/domain/connection-authority.js.map +0 -1
- package/dist/domain/host-mcp-authority-source-admission.d.ts +0 -10
- package/dist/domain/host-mcp-task-admission.d.ts +0 -18
- package/dist/domain/packs.d.ts +0 -59
- package/dist/domain/product-integration-pack.d.ts +0 -44
- package/dist/domain/product-integration-skill.gen.d.ts +0 -5
- package/dist/remote-mcp-credentials.d.ts +0 -23
- package/dist/remote-mcp-credentials.js +0 -11
- package/dist/remote-mcp-credentials.js.map +0 -1
- package/src/application/host-mcp-owner.ts +0 -41
- package/src/application/host-mcp-resolvers.ts +0 -84
- package/src/domain/connection-authority.ts +0 -329
- package/src/domain/host-mcp-authority-source-admission.ts +0 -25
- package/src/domain/host-mcp-task-admission.ts +0 -121
- package/src/domain/packs.ts +0 -699
- package/src/domain/product-integration-pack.ts +0 -42
- package/src/domain/product-integration-skill.gen.ts +0 -52
- package/src/remote-mcp-credentials.ts +0 -361
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Settings } from "@opengeni/config";
|
|
2
2
|
import { type Database, type SandboxRetainedProcess } from "@opengeni/db";
|
|
3
3
|
import { type EventBus } from "@opengeni/events";
|
|
4
|
-
import { type EstablishedSandboxSession, type ResolvedActiveBackend, type RoutingRetainedProcess, type RoutingRetainedProcessTerminalProof, type RoutingSandboxOperationObserver, type SelfhostedRelayConfig } from "@opengeni/runtime/sandbox";
|
|
4
|
+
import { type EstablishedSandboxSession, type ResolvedActiveBackend, type RoutingRetainedProcess, type RoutingRetainedProcessTerminalProof, type RoutingSandboxOperationObserver, type RoutingSandboxCaptureWaitObserver, type SelfhostedRelayConfig } from "@opengeni/runtime/sandbox";
|
|
5
5
|
type DirectRetainedProcessRoute = {
|
|
6
6
|
providerSessionId: number;
|
|
7
7
|
providerBackend: string;
|
|
@@ -24,6 +24,7 @@ export type ChannelARoutingServices = {
|
|
|
24
24
|
settings: Settings;
|
|
25
25
|
bus?: EventBus;
|
|
26
26
|
onSandboxOperation?: RoutingSandboxOperationObserver;
|
|
27
|
+
onSandboxCaptureWait?: RoutingSandboxCaptureWaitObserver;
|
|
27
28
|
waitSignal?: AbortSignal;
|
|
28
29
|
};
|
|
29
30
|
/** Map the deployment relay URL to the leaf's `SelfhostedRelayConfig` shape. The
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Settings } from "@opengeni/config";
|
|
2
|
-
import {
|
|
2
|
+
import { type RigVersion, type Session, type SandboxBackend, type SandboxOs } from "@opengeni/contracts";
|
|
3
3
|
import { type Database } from "@opengeni/db";
|
|
4
4
|
import { resolveModalCheckpointProviderBinding } from "@opengeni/runtime/sandbox";
|
|
5
5
|
export type ManagedSessionGroupBackend = Exclude<SandboxBackend, "none" | "selfhosted">;
|
|
@@ -18,20 +18,6 @@ export declare function managedSessionGroupBackend(deploymentBackend: SandboxBac
|
|
|
18
18
|
* platform's canonical managed-sandbox OS instead. Ordinary sessions preserve
|
|
19
19
|
* their explicitly selected OS. */
|
|
20
20
|
export declare function managedSessionGroupOs(sessionBackend: SandboxBackend, sessionOs: SandboxOs): SandboxOs;
|
|
21
|
-
/** Pre-V2 Packs are the sole compatibility path where a Pack can still own a
|
|
22
|
-
* sandbox image. V2 installations select a Rig instead. Keep this predicate at
|
|
23
|
-
* the shared runtime boundary so turns, API-direct tools, viewers, Browser and
|
|
24
|
-
* Computer cannot resolve different physical machines for the same session. */
|
|
25
|
-
export declare function packInstallationUsesLegacyRuntime(input: {
|
|
26
|
-
manifestSnapshot: unknown | null;
|
|
27
|
-
manifestDigest: string | null;
|
|
28
|
-
}): boolean;
|
|
29
|
-
export declare function resolveWorkspaceLegacyRuntimePacks(db: Database, workspaceId: string): Promise<CapabilityPack[]>;
|
|
30
|
-
export declare function legacySandboxRuntimeFromPacks(packs: readonly CapabilityPack[]): {
|
|
31
|
-
sandboxImage: string | null;
|
|
32
|
-
sandboxProviderImages: CapabilityPack["sandboxProviderImages"] | null;
|
|
33
|
-
};
|
|
34
|
-
export declare function settingsWithPackSandboxImage(settings: Settings, sandboxImage: string | null, sandboxProviderImages?: CapabilityPack["sandboxProviderImages"] | null): Settings;
|
|
35
21
|
export declare function settingsWithRigImage(settings: Settings, rigImage: string | null): Settings;
|
|
36
22
|
export declare function rigProviderImageSourceImage(settings: Settings, backend: SandboxBackend): string | null;
|
|
37
23
|
export type RigProviderImageSelectionReason = "selected" | "missing" | "provider_unsupported" | "not_ready" | "not_cold_boot_validated" | "content_mismatch" | "provider_binding_unavailable" | "provider_binding_mismatch";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "OpenGeni framework-agnostic core: the domain, access, and billing layers (neutral access, off-HTTP V2 surface). Behavior-preserving extraction from apps/api — keeps Hono's HTTPException for error throwing (typed-errors cleanup deferred).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -18,10 +18,6 @@
|
|
|
18
18
|
"module": "./dist/index.js",
|
|
19
19
|
"types": "./dist/index.d.ts",
|
|
20
20
|
"exports": {
|
|
21
|
-
"./remote-mcp-credentials": {
|
|
22
|
-
"types": "./dist/remote-mcp-credentials.d.ts",
|
|
23
|
-
"import": "./dist/remote-mcp-credentials.js"
|
|
24
|
-
},
|
|
25
21
|
".": {
|
|
26
22
|
"types": "./dist/index.d.ts",
|
|
27
23
|
"import": "./dist/index.js"
|
|
@@ -41,10 +37,6 @@
|
|
|
41
37
|
"./managed-auth-session-sets": {
|
|
42
38
|
"types": "./dist/managed-auth-session-sets.d.ts",
|
|
43
39
|
"import": "./dist/managed-auth-session-sets.js"
|
|
44
|
-
},
|
|
45
|
-
"./connection-authority": {
|
|
46
|
-
"types": "./dist/domain/connection-authority.d.ts",
|
|
47
|
-
"import": "./dist/domain/connection-authority.js"
|
|
48
40
|
}
|
|
49
41
|
},
|
|
50
42
|
"publishConfig": {
|
|
@@ -53,22 +45,22 @@
|
|
|
53
45
|
},
|
|
54
46
|
"scripts": {
|
|
55
47
|
"typecheck": "tsc --noEmit",
|
|
56
|
-
"build": "bun ../../scripts/
|
|
48
|
+
"build": "bun ../../scripts/build-typescript-package.ts",
|
|
57
49
|
"prepublishOnly": "bash ../../scripts/prepublish-guard"
|
|
58
50
|
},
|
|
59
51
|
"dependencies": {
|
|
60
52
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
61
53
|
"@opengeni/capabilities": "^0.3.4",
|
|
62
|
-
"@opengeni/codex": "^0.2.
|
|
63
|
-
"@opengeni/config": "^
|
|
64
|
-
"@opengeni/contracts": "^
|
|
65
|
-
"@opengeni/db": "^
|
|
66
|
-
"@opengeni/documents": "^0.8.
|
|
67
|
-
"@opengeni/events": "^0.4.
|
|
54
|
+
"@opengeni/codex": "^0.2.24",
|
|
55
|
+
"@opengeni/config": "^2.0.0",
|
|
56
|
+
"@opengeni/contracts": "^5.0.0",
|
|
57
|
+
"@opengeni/db": "^6.0.0",
|
|
58
|
+
"@opengeni/documents": "^0.8.31",
|
|
59
|
+
"@opengeni/events": "^0.4.29",
|
|
68
60
|
"@opengeni/network": "^0.3.1",
|
|
69
|
-
"@opengeni/observability": "^0.8.
|
|
70
|
-
"@opengeni/runtime": "^
|
|
71
|
-
"@opengeni/storage": "^0.2.
|
|
61
|
+
"@opengeni/observability": "^0.8.30",
|
|
62
|
+
"@opengeni/runtime": "^4.0.0",
|
|
63
|
+
"@opengeni/storage": "^0.2.131",
|
|
72
64
|
"hono": "^4.12.18",
|
|
73
65
|
"zod": "^4.2.1"
|
|
74
66
|
},
|
|
@@ -48,7 +48,8 @@ export async function submitComposerDraftForRequest(
|
|
|
48
48
|
reasoningEffort: input.reasoningEffort,
|
|
49
49
|
latencyMode: input.latencyMode,
|
|
50
50
|
mcpCredentialUpdates: input.mcpCredentialUpdates ?? [],
|
|
51
|
-
|
|
51
|
+
connectionAccounts: input.connectionAccounts,
|
|
52
|
+
|
|
52
53
|
...(input.personalResourceAttachment
|
|
53
54
|
? { personalResourceAttachment: input.personalResourceAttachment }
|
|
54
55
|
: {}),
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { ConnectAttempt } from "@opengeni/contracts/connect";
|
|
2
|
+
import { assertOrganizationIntegrationAllowed } from "@opengeni/contracts";
|
|
3
|
+
import { withOrganizationIntegrationPolicyFence } from "@opengeni/db/organization-integration-policy";
|
|
4
|
+
import { integrationKeyForConnectProvider } from "../domain/organization-integration-catalog";
|
|
2
5
|
import {
|
|
3
6
|
claimConnectOperation,
|
|
4
7
|
finishConnectOperation,
|
|
@@ -31,11 +34,14 @@ export async function executeConnectOperation(input: {
|
|
|
31
34
|
operationId: string;
|
|
32
35
|
/** Caller computes a stable keyed digest if input contains low-entropy secrets. */
|
|
33
36
|
inputDigest: string;
|
|
37
|
+
/** Trusted server adapter classification, never derived from request data.
|
|
38
|
+
* Cancellation releases pending setup; it acquires no integration authority. */
|
|
39
|
+
purpose?: "acquisition" | "cancellation";
|
|
34
40
|
authorize: ConnectOperationAuthorization;
|
|
35
41
|
execute: (attempt: ConnectAttempt) => Promise<PreparedConnectOperation>;
|
|
36
42
|
}): Promise<ConnectAttempt> {
|
|
37
43
|
// Snapshot caller-controlled identity before the first asynchronous boundary.
|
|
38
|
-
const { db, authorize, execute } = input;
|
|
44
|
+
const { db, authorize, execute, purpose = "acquisition" } = input;
|
|
39
45
|
const scope = { ...input.scope };
|
|
40
46
|
const operation = {
|
|
41
47
|
attemptId: input.attemptId,
|
|
@@ -44,8 +50,31 @@ export async function executeConnectOperation(input: {
|
|
|
44
50
|
inputDigest: input.inputDigest,
|
|
45
51
|
authorize,
|
|
46
52
|
};
|
|
47
|
-
const claim = await
|
|
53
|
+
const claim = await withOrganizationIntegrationPolicyFence(db, scope, async (tx, policy) =>
|
|
54
|
+
claimConnectOperation(tx, scope, {
|
|
55
|
+
...operation,
|
|
56
|
+
authorizeAcquisition: async (_tx, attempt) => {
|
|
57
|
+
if (purpose === "cancellation") return;
|
|
58
|
+
assertOrganizationIntegrationAllowed(
|
|
59
|
+
policy,
|
|
60
|
+
integrationKeyForConnectProvider(attempt.providerId),
|
|
61
|
+
);
|
|
62
|
+
},
|
|
63
|
+
}),
|
|
64
|
+
);
|
|
48
65
|
if (claim.status === "replayed") return claim.attempt;
|
|
49
66
|
const prepared = await execute(structuredClone(claim.attempt));
|
|
50
|
-
return
|
|
67
|
+
return withOrganizationIntegrationPolicyFence(db, scope, async (tx, policy) =>
|
|
68
|
+
finishConnectOperation(tx, scope, {
|
|
69
|
+
...operation,
|
|
70
|
+
commit: prepared.commit,
|
|
71
|
+
authorizeAcquisition: async (_tx, attempt) => {
|
|
72
|
+
if (purpose === "cancellation") return;
|
|
73
|
+
assertOrganizationIntegrationAllowed(
|
|
74
|
+
policy,
|
|
75
|
+
integrationKeyForConnectProvider(attempt.providerId),
|
|
76
|
+
);
|
|
77
|
+
},
|
|
78
|
+
}),
|
|
79
|
+
);
|
|
51
80
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { SandboxRecoveryRequest } from "@opengeni/contracts";
|
|
2
|
+
import { consentPublicSandboxRecovery, readPublicSandboxRecovery } from "@opengeni/db";
|
|
3
|
+
import { requirePermission, type AccessGrantAuthorization } from "../access";
|
|
4
|
+
import type { AppDependencies } from "../dependencies";
|
|
5
|
+
import { requireSessionAuthorization } from "../session-authorization";
|
|
6
|
+
import { requireCanonicalManagedHuman } from "./session-tenancy";
|
|
7
|
+
|
|
8
|
+
type Dependencies = Pick<AppDependencies, "db" | "sessionAuthorization">;
|
|
9
|
+
|
|
10
|
+
async function authorize(
|
|
11
|
+
deps: Dependencies,
|
|
12
|
+
authorization: AccessGrantAuthorization,
|
|
13
|
+
workspaceId: string,
|
|
14
|
+
sessionId: string,
|
|
15
|
+
) {
|
|
16
|
+
// Cookie-verification stamp, never principal-shape inference or an actor from
|
|
17
|
+
// the body. Agents, API keys and delegated humans cannot accept data loss.
|
|
18
|
+
requireCanonicalManagedHuman(authorization, workspaceId);
|
|
19
|
+
requirePermission(authorization.grant, "sessions:read");
|
|
20
|
+
requirePermission(authorization.grant, "sessions:control");
|
|
21
|
+
await requireSessionAuthorization(deps, authorization.grant, {
|
|
22
|
+
sessionId,
|
|
23
|
+
operation: "session.control",
|
|
24
|
+
surface: "core",
|
|
25
|
+
});
|
|
26
|
+
return {
|
|
27
|
+
accountId: authorization.grant.accountId,
|
|
28
|
+
workspaceId,
|
|
29
|
+
sessionId,
|
|
30
|
+
subjectId: authorization.grant.subjectId,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export async function getManagedHumanSandboxRecovery(
|
|
35
|
+
deps: Dependencies,
|
|
36
|
+
authorization: AccessGrantAuthorization,
|
|
37
|
+
workspaceId: string,
|
|
38
|
+
sessionId: string,
|
|
39
|
+
) {
|
|
40
|
+
return readPublicSandboxRecovery(
|
|
41
|
+
deps.db,
|
|
42
|
+
await authorize(deps, authorization, workspaceId, sessionId),
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export async function consentManagedHumanSandboxRecovery(
|
|
47
|
+
deps: Dependencies,
|
|
48
|
+
authorization: AccessGrantAuthorization,
|
|
49
|
+
workspaceId: string,
|
|
50
|
+
sessionId: string,
|
|
51
|
+
request: SandboxRecoveryRequest,
|
|
52
|
+
) {
|
|
53
|
+
const scope = await authorize(deps, authorization, workspaceId, sessionId);
|
|
54
|
+
return consentPublicSandboxRecovery(deps.db, { ...scope, request });
|
|
55
|
+
}
|
|
@@ -6,7 +6,6 @@ import type {
|
|
|
6
6
|
} from "@opengeni/contracts";
|
|
7
7
|
import {
|
|
8
8
|
issueSelfUserResourceGrant,
|
|
9
|
-
issueSelfLocalConnectionUseGrant,
|
|
10
9
|
listSelfUserResourceAuthorities,
|
|
11
10
|
revokeSelfUserResourceGrant,
|
|
12
11
|
sessionTenancyProductActivated,
|
|
@@ -103,21 +102,7 @@ export async function issueManagedHumanUserResourceGrant(
|
|
|
103
102
|
const modePermissions: Permission[] =
|
|
104
103
|
request.mode === "session" ? ["sessions:control"] : ["sessions:create"];
|
|
105
104
|
if (authorization.canonicalLocalHumanSession) {
|
|
106
|
-
|
|
107
|
-
...ISSUE_PERMISSIONS[request.resourceKind],
|
|
108
|
-
"sessions:create",
|
|
109
|
-
]);
|
|
110
|
-
if (request.resourceKind !== "connection" || request.mode !== "always") {
|
|
111
|
-
throw new SessionTenancyManagedHumanRequiredError();
|
|
112
|
-
}
|
|
113
|
-
return await issueSelfLocalConnectionUseGrant(deps.db, {
|
|
114
|
-
accountId: authorization.grant.accountId,
|
|
115
|
-
workspaceId,
|
|
116
|
-
subjectId: authorization.grant.subjectId,
|
|
117
|
-
authorityId,
|
|
118
|
-
context: request.context,
|
|
119
|
-
workspaceSharedAcknowledged: request.workspaceSharedAcknowledged,
|
|
120
|
-
});
|
|
105
|
+
throw new SessionTenancyManagedHumanRequiredError();
|
|
121
106
|
}
|
|
122
107
|
await requireOwnerProductGate(deps, authorization, workspaceId, [
|
|
123
108
|
...ISSUE_PERMISSIONS[request.resourceKind],
|
package/src/dependencies.ts
CHANGED
|
@@ -101,7 +101,11 @@ export type DocumentIndexClient = {
|
|
|
101
101
|
};
|
|
102
102
|
|
|
103
103
|
export type ManagedEmailMessage = {
|
|
104
|
-
kind:
|
|
104
|
+
kind:
|
|
105
|
+
| "email_verification"
|
|
106
|
+
| "password_reset"
|
|
107
|
+
| "organization_user_setup"
|
|
108
|
+
| "sign_in_method_changed";
|
|
105
109
|
from: string;
|
|
106
110
|
to: string;
|
|
107
111
|
subject: string;
|