@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
package/src/domain/skills.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type {
|
|
|
3
3
|
SkillInstallInput,
|
|
4
4
|
SkillRevisionInput,
|
|
5
5
|
SkillSaveInput,
|
|
6
|
+
SkillRemoveInput,
|
|
6
7
|
} from "@opengeni/contracts";
|
|
7
8
|
import { validateSkillTextFiles } from "@opengeni/contracts";
|
|
8
9
|
import { buildPortableSkillArtifact } from "@opengeni/runtime/skill-library";
|
|
@@ -30,6 +31,14 @@ export function skillBundleHash(files: readonly SkillFile[]): string {
|
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
export const listSkills = listSkillRecords;
|
|
34
|
+
export async function removeSkill(db: Database, input: SkillRemoveInput) {
|
|
35
|
+
const { accountId, workspaceId, actor, ...request } = input;
|
|
36
|
+
return applySkillLifecycle(
|
|
37
|
+
db,
|
|
38
|
+
{ accountId, workspaceId, actor },
|
|
39
|
+
{ ...request, operation: "remove" },
|
|
40
|
+
);
|
|
41
|
+
}
|
|
33
42
|
export async function readSkill(
|
|
34
43
|
db: Database,
|
|
35
44
|
context: SkillReadContext,
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
export { readSessionAttachmentFiles } from "./domain/session-file-access";
|
|
1
2
|
export * from "./domain/skills";
|
|
3
|
+
export * from "./domain/mcp-account-bindings";
|
|
4
|
+
export * from "./domain/organization-integration-catalog";
|
|
2
5
|
export * from "./domain/knowledge";
|
|
3
6
|
export * from "./domain/knowledge-search";
|
|
4
7
|
// @opengeni/core — the framework-agnostic OpenGeni core.
|
|
@@ -65,12 +68,10 @@ export * from "./sandbox/runtime-settings";
|
|
|
65
68
|
export * from "./access";
|
|
66
69
|
export * from "./application/external-workspace-members";
|
|
67
70
|
export * from "./application/external-identity-lifecycle";
|
|
68
|
-
export * from "./application/host-mcp-resolvers";
|
|
69
71
|
export * from "./application/external-continuation";
|
|
70
72
|
export * from "./application/session-mcp-credential-rotation";
|
|
71
73
|
export * from "./application/external-link-work-admission";
|
|
72
74
|
export * from "./application/connect-authority";
|
|
73
|
-
export * from "./application/host-mcp-owner";
|
|
74
75
|
export * from "./application/connect-operation";
|
|
75
76
|
export * from "./session-authorization";
|
|
76
77
|
|
|
@@ -78,19 +79,18 @@ export * from "./session-authorization";
|
|
|
78
79
|
export * from "./billing/limits";
|
|
79
80
|
|
|
80
81
|
// Domain layer — the off-HTTP V2 surface (createSessionForRequest,
|
|
81
|
-
|
|
82
|
+
|
|
82
83
|
// scheduled-task/workspace-member logic, …).
|
|
83
84
|
export * from "./domain/capabilities";
|
|
84
|
-
export * from "./domain/
|
|
85
|
+
export * from "./domain/native-mcp-connection-admission";
|
|
85
86
|
export * from "./domain/skill-imports";
|
|
86
87
|
export * from "./domain/skill-search";
|
|
87
88
|
export * from "./domain/github-skill-source";
|
|
88
89
|
export * from "./domain/environments";
|
|
89
90
|
export * from "./rigs";
|
|
90
|
-
export * from "./domain/packs";
|
|
91
91
|
export * from "./domain/automations";
|
|
92
92
|
export * from "./domain/pr-review";
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
export * from "./domain/personal-connection-delegations";
|
|
95
95
|
export * from "./domain/resources";
|
|
96
96
|
export * from "./domain/github-repository-bindings";
|
|
@@ -116,6 +116,7 @@ export * from "./application/new-session-drafts";
|
|
|
116
116
|
export * from "./application/composer-submit";
|
|
117
117
|
export * from "./application/session-commands";
|
|
118
118
|
export * from "./application/session-tenancy";
|
|
119
|
+
export * from "./application/sandbox-recovery";
|
|
119
120
|
export * from "./application/user-resource-grants";
|
|
120
121
|
export * from "./application/api-integration-servers";
|
|
121
122
|
|
|
@@ -129,5 +130,8 @@ export { withSiteSessionOrigin } from "./site-session-origin";
|
|
|
129
130
|
export { fileOwnerContextForAccess, fileOwnerContextForAgent } from "./domain/file-owner";
|
|
130
131
|
|
|
131
132
|
export { prepareKnowledgeFile } from "./domain/knowledge-files";
|
|
133
|
+
export { prepareKnowledgeSave } from "./domain/knowledge-preparation";
|
|
132
134
|
|
|
133
135
|
export { retainKnowledgeMessage } from "./domain/knowledge-messages";
|
|
136
|
+
|
|
137
|
+
export * from "./domain/connector-tool-permissions";
|
package/src/rigs/index.ts
CHANGED
|
@@ -128,7 +128,7 @@ export async function requireRigForApi(
|
|
|
128
128
|
): Promise<Rig> {
|
|
129
129
|
const rig = await getRig(db, grant, rigId);
|
|
130
130
|
if (!rig) {
|
|
131
|
-
throw new HTTPException(404, { message: "
|
|
131
|
+
throw new HTTPException(404, { message: "sandbox environment not found" });
|
|
132
132
|
}
|
|
133
133
|
return rig;
|
|
134
134
|
}
|
|
@@ -143,7 +143,7 @@ export async function requireRigChangeForApi(
|
|
|
143
143
|
// RLS + the workspace clause make a cross-workspace id indistinguishable from
|
|
144
144
|
// missing; the rigId clause keeps the change addressable only under its rig.
|
|
145
145
|
if (!change || change.rigId !== rigId) {
|
|
146
|
-
throw new HTTPException(404, { message: "
|
|
146
|
+
throw new HTTPException(404, { message: "sandbox environment change not found" });
|
|
147
147
|
}
|
|
148
148
|
return change;
|
|
149
149
|
}
|
|
@@ -151,7 +151,7 @@ export async function requireRigChangeForApi(
|
|
|
151
151
|
function trimmedRigName(name: string): string {
|
|
152
152
|
const trimmed = name.trim();
|
|
153
153
|
if (!trimmed) {
|
|
154
|
-
throw new HTTPException(422, { message: "
|
|
154
|
+
throw new HTTPException(422, { message: "sandbox environment name is required" });
|
|
155
155
|
}
|
|
156
156
|
return trimmed;
|
|
157
157
|
}
|
|
@@ -165,7 +165,7 @@ function assertUniqueCheckNames(checks: ReadonlyArray<{ name: string }> | undefi
|
|
|
165
165
|
for (const check of checks) {
|
|
166
166
|
if (seen.has(check.name)) {
|
|
167
167
|
throw new HTTPException(422, {
|
|
168
|
-
message: `duplicate
|
|
168
|
+
message: `duplicate sandbox environment check name: ${check.name}`,
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
seen.add(check.name);
|
|
@@ -198,7 +198,7 @@ async function assertVariableSetsExist(
|
|
|
198
198
|
}
|
|
199
199
|
if (!variableSetScopeAllowedForRig(rigScope, variableSet.scope)) {
|
|
200
200
|
throw new HTTPException(422, {
|
|
201
|
-
message: `${rigScope}-scoped
|
|
201
|
+
message: `${rigScope}-scoped sandbox environments cannot use ${variableSet.scope}-scoped variable sets`,
|
|
202
202
|
});
|
|
203
203
|
}
|
|
204
204
|
}
|
|
@@ -233,12 +233,12 @@ export async function createRigForApi(
|
|
|
233
233
|
);
|
|
234
234
|
if ((await countRigs(deps.db, grant, payload.scope)) >= MAX_RIGS_PER_WORKSPACE) {
|
|
235
235
|
throw new HTTPException(422, {
|
|
236
|
-
message: `a workspace supports at most ${MAX_RIGS_PER_WORKSPACE}
|
|
236
|
+
message: `a workspace supports at most ${MAX_RIGS_PER_WORKSPACE} sandbox environments`,
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
239
|
if (await getRigByName(deps.db, grant, name, payload.scope)) {
|
|
240
240
|
throw new HTTPException(409, {
|
|
241
|
-
message: `
|
|
241
|
+
message: `sandbox environment name is already in use: ${name}`,
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
244
|
const createdBy = rigActorForGrant(grant);
|
|
@@ -281,7 +281,7 @@ export async function updateRigForApi(
|
|
|
281
281
|
const existing = await getRigByName(deps.db, grant, name, rig.scope);
|
|
282
282
|
if (existing && existing.id !== rig.id) {
|
|
283
283
|
throw new HTTPException(409, {
|
|
284
|
-
message: `
|
|
284
|
+
message: `sandbox environment name is already in use: ${name}`,
|
|
285
285
|
});
|
|
286
286
|
}
|
|
287
287
|
}
|
|
@@ -339,7 +339,7 @@ export async function proposeRigChangeForApi(
|
|
|
339
339
|
const workspaceId = rig.workspaceId;
|
|
340
340
|
if (!rig.activeVersion) {
|
|
341
341
|
throw new HTTPException(422, {
|
|
342
|
-
message: "
|
|
342
|
+
message: "sandbox environment has no active version to base a change on",
|
|
343
343
|
});
|
|
344
344
|
}
|
|
345
345
|
if (request.kind === "definition_edit") {
|
|
@@ -412,7 +412,7 @@ async function promoteChangeWithActiveCas(
|
|
|
412
412
|
} catch (error) {
|
|
413
413
|
if (error instanceof RigActiveVersionChangedError) {
|
|
414
414
|
throw new HTTPException(409, {
|
|
415
|
-
message: `
|
|
415
|
+
message: `sandbox environment moved since this change was verified (base ${error.expectedVersionId}, now ${error.actualVersionId ?? "none"}); re-verify before promoting`,
|
|
416
416
|
});
|
|
417
417
|
}
|
|
418
418
|
if (error instanceof RigChangeTransitionError) {
|
|
@@ -435,15 +435,15 @@ export async function promoteSetupAppendChange(
|
|
|
435
435
|
}
|
|
436
436
|
if (change.status !== "proposed" && change.status !== "verifying") {
|
|
437
437
|
throw new HTTPException(409, {
|
|
438
|
-
message: `
|
|
438
|
+
message: `sandbox environment change is ${change.status}; cannot promote`,
|
|
439
439
|
});
|
|
440
440
|
}
|
|
441
441
|
if (!change.baseVersionId) {
|
|
442
|
-
throw new HTTPException(422, { message: "
|
|
442
|
+
throw new HTTPException(422, { message: "sandbox environment change has no base version" });
|
|
443
443
|
}
|
|
444
444
|
const base = await getRigVersion(deps.db, rig.workspaceId, rig.id, change.baseVersionId);
|
|
445
445
|
if (!base) {
|
|
446
|
-
throw new HTTPException(404, { message: "base
|
|
446
|
+
throw new HTTPException(404, { message: "base sandbox environment version not found" });
|
|
447
447
|
}
|
|
448
448
|
const payload = change.payload as { command?: unknown; note?: unknown };
|
|
449
449
|
if (typeof payload.command !== "string" || !payload.command.trim()) {
|
|
@@ -510,7 +510,7 @@ export async function promoteVerifiedDefinitionEditChangeForApi(
|
|
|
510
510
|
}
|
|
511
511
|
if (change.status !== "proposed") {
|
|
512
512
|
throw new HTTPException(409, {
|
|
513
|
-
message: `
|
|
513
|
+
message: `sandbox environment change is ${change.status}; cannot promote`,
|
|
514
514
|
});
|
|
515
515
|
}
|
|
516
516
|
if (change.verification?.passed !== true) {
|
|
@@ -519,11 +519,11 @@ export async function promoteVerifiedDefinitionEditChangeForApi(
|
|
|
519
519
|
});
|
|
520
520
|
}
|
|
521
521
|
if (!change.baseVersionId) {
|
|
522
|
-
throw new HTTPException(422, { message: "
|
|
522
|
+
throw new HTTPException(422, { message: "sandbox environment change has no base version" });
|
|
523
523
|
}
|
|
524
524
|
const base = await getRigVersion(deps.db, rig.workspaceId, rig.id, change.baseVersionId);
|
|
525
525
|
if (!base) {
|
|
526
|
-
throw new HTTPException(404, { message: "base
|
|
526
|
+
throw new HTTPException(404, { message: "base sandbox environment version not found" });
|
|
527
527
|
}
|
|
528
528
|
const payload = change.payload as {
|
|
529
529
|
setupScript?: unknown;
|
|
@@ -590,7 +590,7 @@ export async function createRigVersionForApi(
|
|
|
590
590
|
payload: RigDefinitionEditPayload,
|
|
591
591
|
): Promise<RigVersion> {
|
|
592
592
|
if (!rig.activeVersion) {
|
|
593
|
-
throw new HTTPException(422, { message: "
|
|
593
|
+
throw new HTTPException(422, { message: "sandbox environment has no active version" });
|
|
594
594
|
}
|
|
595
595
|
assertUniqueCheckNames(payload.checks);
|
|
596
596
|
await assertVariableSetsExist(
|
package/src/sandbox/routing.ts
CHANGED
|
@@ -15,10 +15,11 @@ import { sandboxLifecycleTransitionWaitMs, type Settings } from "@opengeni/confi
|
|
|
15
15
|
import { appendSessionCommandOutput } from "@opengeni/db/session-command-output";
|
|
16
16
|
import {
|
|
17
17
|
createProviderCommandRetainer,
|
|
18
|
-
|
|
18
|
+
supervisedCommandProtocolReady,
|
|
19
19
|
} from "@opengeni/db/retained-provider-commands";
|
|
20
20
|
import {
|
|
21
21
|
advanceWorkspaceGenerationForDirectRequest,
|
|
22
|
+
retainedProviderCommandPersistence,
|
|
22
23
|
advanceWorkspaceGenerationForRetainedProcess,
|
|
23
24
|
getLiveEnrollmentConnection,
|
|
24
25
|
getRetainedProcess,
|
|
@@ -52,6 +53,7 @@ import {
|
|
|
52
53
|
type RoutingRetainedProcess,
|
|
53
54
|
type RoutingRetainedProcessTerminalProof,
|
|
54
55
|
type RoutingSandboxOperationObserver,
|
|
56
|
+
type RoutingSandboxCaptureWaitObserver,
|
|
55
57
|
type SelfhostedRelayConfig,
|
|
56
58
|
type SelfhostedConnectionBinding,
|
|
57
59
|
type SelfhostedOpStreamDeps,
|
|
@@ -116,6 +118,7 @@ export type ChannelARoutingServices = {
|
|
|
116
118
|
settings: Settings;
|
|
117
119
|
bus?: EventBus;
|
|
118
120
|
onSandboxOperation?: RoutingSandboxOperationObserver;
|
|
121
|
+
onSandboxCaptureWait?: RoutingSandboxCaptureWaitObserver;
|
|
119
122
|
waitSignal?: AbortSignal;
|
|
120
123
|
};
|
|
121
124
|
|
|
@@ -530,17 +533,23 @@ export function wrapChannelABoxWithRouting(
|
|
|
530
533
|
});
|
|
531
534
|
|
|
532
535
|
const proxy = new RoutingSandboxSession({
|
|
536
|
+
providerSupervisionReady: async () =>
|
|
537
|
+
settings.modalCommandSupervisionEnabled && (await supervisedCommandProtocolReady(db)),
|
|
533
538
|
providerCommandHandle: (value) =>
|
|
534
539
|
value && typeof value === "object"
|
|
535
540
|
? (value as PersistableMutationAdmission).admission?.workspaceGeneration
|
|
536
541
|
: undefined,
|
|
537
542
|
providerCommandPersistence: (process) =>
|
|
538
|
-
retainedProviderCommandPersistence(
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
543
|
+
retainedProviderCommandPersistence(
|
|
544
|
+
db,
|
|
545
|
+
{
|
|
546
|
+
accountId: ids.accountId,
|
|
547
|
+
workspaceId: ids.workspaceId,
|
|
548
|
+
sessionId: ids.sessionId,
|
|
549
|
+
processId: process.id,
|
|
550
|
+
},
|
|
551
|
+
bus ? (events) => bus.publish(ids.workspaceId, ids.sessionId, events) : undefined,
|
|
552
|
+
),
|
|
544
553
|
captureProcessOutput: async ({ process, chunkId, chunk, stream, streamFidelity }) => {
|
|
545
554
|
const events = await appendSessionCommandOutput(db, {
|
|
546
555
|
accountId: ids.accountId,
|
|
@@ -576,6 +585,7 @@ export function wrapChannelABoxWithRouting(
|
|
|
576
585
|
},
|
|
577
586
|
resolveActiveBackend: resolver,
|
|
578
587
|
...(services.onSandboxOperation ? { onOperation: services.onSandboxOperation } : {}),
|
|
588
|
+
...(services.onSandboxCaptureWait ? { onCaptureWait: services.onSandboxCaptureWait } : {}),
|
|
579
589
|
...(beforeMutation ? { beforeMutation } : {}),
|
|
580
590
|
...(afterMutation ? { afterMutation } : {}),
|
|
581
591
|
...(beforeProcessMutation ? { beforeProcessMutation } : {}),
|
|
@@ -591,6 +601,7 @@ export function wrapChannelABoxWithRouting(
|
|
|
591
601
|
sandboxGroupId: homeLease.sandboxGroupId,
|
|
592
602
|
expectedEpoch: homeLease.leaseEpoch,
|
|
593
603
|
expectedInstanceId: homeLease.instanceId,
|
|
604
|
+
expectedBackend: homeLease.backend,
|
|
594
605
|
diagnostic: "provider_not_found_during_routed_operation",
|
|
595
606
|
});
|
|
596
607
|
if (marked.status === "marked" && bus) {
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import type { Settings } from "@opengeni/config";
|
|
2
2
|
import {
|
|
3
|
-
CapabilityPack,
|
|
4
|
-
StoredCapabilityPack,
|
|
5
3
|
type RigVersion,
|
|
6
4
|
type Session,
|
|
7
5
|
type SandboxBackend,
|
|
8
6
|
type SandboxOs,
|
|
9
7
|
} from "@opengeni/contracts";
|
|
10
|
-
import {
|
|
11
|
-
getRigVersion,
|
|
12
|
-
getWorkspacePack,
|
|
13
|
-
listPackInstallations,
|
|
14
|
-
type Database,
|
|
15
|
-
} from "@opengeni/db";
|
|
8
|
+
import { getRigVersion, type Database } from "@opengeni/db";
|
|
16
9
|
import { resolveModalCheckpointProviderBinding } from "@opengeni/runtime/sandbox";
|
|
17
10
|
import {
|
|
18
11
|
rigProviderImageContentHash,
|
|
@@ -51,76 +44,6 @@ export function managedSessionGroupOs(
|
|
|
51
44
|
return sessionBackend === "selfhosted" ? "linux" : sessionOs;
|
|
52
45
|
}
|
|
53
46
|
|
|
54
|
-
/** Pre-V2 Packs are the sole compatibility path where a Pack can still own a
|
|
55
|
-
* sandbox image. V2 installations select a Rig instead. Keep this predicate at
|
|
56
|
-
* the shared runtime boundary so turns, API-direct tools, viewers, Browser and
|
|
57
|
-
* Computer cannot resolve different physical machines for the same session. */
|
|
58
|
-
export function packInstallationUsesLegacyRuntime(input: {
|
|
59
|
-
manifestSnapshot: unknown | null;
|
|
60
|
-
manifestDigest: string | null;
|
|
61
|
-
}): boolean {
|
|
62
|
-
return input.manifestSnapshot === null && input.manifestDigest === null;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export async function resolveWorkspaceLegacyRuntimePacks(
|
|
66
|
-
db: Database,
|
|
67
|
-
workspaceId: string,
|
|
68
|
-
): Promise<CapabilityPack[]> {
|
|
69
|
-
const installations = await listPackInstallations(db, workspaceId);
|
|
70
|
-
const packs: CapabilityPack[] = [];
|
|
71
|
-
for (const installation of installations) {
|
|
72
|
-
if (installation.status !== "active" || !packInstallationUsesLegacyRuntime(installation)) {
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
const registration = await getWorkspacePack(db, workspaceId, installation.packId);
|
|
76
|
-
if (!registration)
|
|
77
|
-
throw new Error(`Enabled Pack ${installation.packId} has no registered manifest`);
|
|
78
|
-
const parsed = StoredCapabilityPack.safeParse(registration.pack);
|
|
79
|
-
if (!parsed.success)
|
|
80
|
-
throw new Error(
|
|
81
|
-
`Enabled Pack ${installation.packId} requires repair: ${parsed.error.message}`,
|
|
82
|
-
);
|
|
83
|
-
packs.push(parsed.data);
|
|
84
|
-
}
|
|
85
|
-
return packs;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export function legacySandboxRuntimeFromPacks(packs: readonly CapabilityPack[]): {
|
|
89
|
-
sandboxImage: string | null;
|
|
90
|
-
sandboxProviderImages: CapabilityPack["sandboxProviderImages"] | null;
|
|
91
|
-
} {
|
|
92
|
-
const imagePacks = packs.filter(
|
|
93
|
-
(pack) => typeof pack.sandboxImage === "string" && pack.sandboxImage.trim().length > 0,
|
|
94
|
-
);
|
|
95
|
-
if (imagePacks.length > 1) {
|
|
96
|
-
const ids = imagePacks
|
|
97
|
-
.map((pack) => pack.id)
|
|
98
|
-
.sort()
|
|
99
|
-
.join(", ");
|
|
100
|
-
throw new Error(
|
|
101
|
-
`Multiple enabled packs declare a sandbox image (${ids}). Only one enabled pack per workspace may declare sandboxImage; disable the others and retry.`,
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
return {
|
|
105
|
-
sandboxImage: imagePacks[0]?.sandboxImage?.trim() ?? null,
|
|
106
|
-
sandboxProviderImages: imagePacks[0]?.sandboxProviderImages ?? null,
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export function settingsWithPackSandboxImage(
|
|
111
|
-
settings: Settings,
|
|
112
|
-
sandboxImage: string | null,
|
|
113
|
-
sandboxProviderImages: CapabilityPack["sandboxProviderImages"] | null = null,
|
|
114
|
-
): Settings {
|
|
115
|
-
if (!sandboxImage) return settings;
|
|
116
|
-
return {
|
|
117
|
-
...settings,
|
|
118
|
-
dockerImage: sandboxImage,
|
|
119
|
-
modalImageRef: sandboxImage,
|
|
120
|
-
modalImageId: sandboxProviderImages?.modal?.imageId,
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
|
|
124
47
|
export function settingsWithRigImage(settings: Settings, rigImage: string | null): Settings {
|
|
125
48
|
// Explicit Rig image overrides are intentionally inert. Preserve this helper
|
|
126
49
|
// as a compatibility seam for callers and historical rows while ensuring the
|
|
@@ -277,22 +200,15 @@ export async function resolveSessionSandboxRuntime(
|
|
|
277
200
|
settings: Settings,
|
|
278
201
|
session: Pick<Session, "workspaceId" | "sandboxBackend" | "rigId" | "rigVersionId">,
|
|
279
202
|
): Promise<SessionSandboxRuntime> {
|
|
280
|
-
const
|
|
281
|
-
resolveWorkspaceLegacyRuntimePacks(db, session.workspaceId),
|
|
203
|
+
const rigVersion =
|
|
282
204
|
session.rigId && session.rigVersionId
|
|
283
|
-
? getRigVersion(db, session.workspaceId, session.rigId, session.rigVersionId)
|
|
284
|
-
:
|
|
285
|
-
]);
|
|
205
|
+
? await getRigVersion(db, session.workspaceId, session.rigId, session.rigVersionId)
|
|
206
|
+
: null;
|
|
286
207
|
if (session.rigVersionId && !rigVersion) {
|
|
287
|
-
throw new Error(`Frozen
|
|
208
|
+
throw new Error(`Frozen sandbox environment version ${session.rigVersionId} is unavailable`);
|
|
288
209
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
// sandbox. Legacy pre-v2 Pack image compatibility remains available only to
|
|
292
|
-
// rig-less sessions; it cannot replace the base beneath a Rig.
|
|
293
|
-
const logicalSettings = rigVersion
|
|
294
|
-
? settings
|
|
295
|
-
: settingsWithPackSandboxImage(settings, legacy.sandboxImage, legacy.sandboxProviderImages);
|
|
210
|
+
// Setup and checks always layer on the deployment-owned sandbox image.
|
|
211
|
+
const logicalSettings = settings;
|
|
296
212
|
return {
|
|
297
213
|
settings: {
|
|
298
214
|
...logicalSettings,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type Database } from "@opengeni/db";
|
|
2
|
-
import { type AccessGrantAuthorization } from "../access/index.js";
|
|
3
|
-
/** Direct user admission only. Agents inherit exact accepted snapshots instead.
|
|
4
|
-
* Native and externally represented users share owner semantics; service keys
|
|
5
|
-
* cannot impersonate a human owner merely by naming a subject. */
|
|
6
|
-
export declare function prepareHostMcpOwnerAuthorization(authorization: AccessGrantAuthorization, workspaceId: string, permission: "connections:read" | "connections:write"): (tx: Database) => Promise<import("@opengeni/db").HostMcpBindingOwner>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Context } from "hono";
|
|
2
|
-
import { type AccessDeps } from "../access/index.js";
|
|
3
|
-
export declare function hostMcpResolverForRequest(context: Context, deps: AccessDeps, organizationId: string, source: string, method: "get" | "put" | "revoke", raw?: unknown): Promise<{
|
|
4
|
-
id: string;
|
|
5
|
-
organizationId: string;
|
|
6
|
-
externalSource: string;
|
|
7
|
-
url: string;
|
|
8
|
-
timeoutMs: number;
|
|
9
|
-
generation: number;
|
|
10
|
-
status: "active" | "revoked";
|
|
11
|
-
createdAt: string;
|
|
12
|
-
updatedAt: string;
|
|
13
|
-
}>;
|