@finalai/final-agent-provider 0.11.0 → 0.13.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 -14
- package/dist/modules/integrations.d.mts +0 -1
- package/dist/modules/integrations.mjs +0 -2
- package/dist/modules/integrations.mjs.map +2 -2
- package/dist/modules/sandboxes/computer.d.mts +2 -4
- package/dist/modules/sandboxes/computer.mjs +110 -480
- package/dist/modules/sandboxes/computer.mjs.map +2 -2
- package/dist/modules/sandboxes/computers-api.d.mts +6 -1
- package/dist/modules/sandboxes/computers-api.mjs.map +2 -2
- package/dist/modules/sandboxes/device-api.d.mts +8 -48
- package/dist/modules/sandboxes/device-api.mjs +2 -92
- package/dist/modules/sandboxes/device-api.mjs.map +2 -2
- package/dist/modules/sandboxes/device.d.mts +1 -1
- package/dist/modules/sandboxes/device.mjs.map +2 -2
- package/dist/modules/sandboxes/environment.d.mts +4 -0
- package/dist/modules/sandboxes/environment.mjs.map +2 -2
- package/dist/modules/sandboxes/local.d.mts +2 -1
- package/dist/modules/sandboxes/local.mjs +64 -8
- package/dist/modules/sandboxes/local.mjs.map +2 -2
- package/dist/modules/sandboxes/session.mjs +0 -1
- package/dist/modules/sandboxes/session.mjs.map +2 -2
- package/package.json +5 -57
- package/WORKSPACE-EGRESS.md +0 -184
- package/dist/modules/authoring-final-channel.d.mts +0 -3
- package/dist/modules/authoring-final-channel.mjs +0 -10
- package/dist/modules/authoring-final-channel.mjs.map +0 -7
- package/dist/modules/channel-factories.d.mts +0 -40
- package/dist/modules/channel-factories.mjs +0 -212
- package/dist/modules/channel-factories.mjs.map +0 -7
- package/dist/modules/channels/content.d.mts +0 -6
- package/dist/modules/channels/content.mjs +0 -31
- package/dist/modules/channels/content.mjs.map +0 -7
- package/dist/modules/channels/delivery.d.mts +0 -54
- package/dist/modules/channels/delivery.mjs +0 -243
- package/dist/modules/channels/delivery.mjs.map +0 -7
- package/dist/modules/channels/direct-messaging.d.mts +0 -5
- package/dist/modules/channels/direct-messaging.mjs +0 -8
- package/dist/modules/channels/direct-messaging.mjs.map +0 -7
- package/dist/modules/channels/fake-platform.d.mts +0 -36
- package/dist/modules/channels/fake-platform.mjs +0 -168
- package/dist/modules/channels/fake-platform.mjs.map +0 -7
- package/dist/modules/channels/group-messaging.d.mts +0 -5
- package/dist/modules/channels/group-messaging.mjs +0 -8
- package/dist/modules/channels/group-messaging.mjs.map +0 -7
- package/dist/modules/channels/inbound.d.mts +0 -52
- package/dist/modules/channels/inbound.mjs +0 -42
- package/dist/modules/channels/inbound.mjs.map +0 -7
- package/dist/modules/channels/index.d.mts +0 -9
- package/dist/modules/channels/index.mjs +0 -10
- package/dist/modules/channels/index.mjs.map +0 -7
- package/dist/modules/channels/messaging-channel.d.mts +0 -7
- package/dist/modules/channels/messaging-channel.mjs +0 -99
- package/dist/modules/channels/messaging-channel.mjs.map +0 -7
- package/dist/modules/channels/projection.d.mts +0 -36
- package/dist/modules/channels/projection.mjs +0 -233
- package/dist/modules/channels/projection.mjs.map +0 -7
- package/dist/modules/channels/prompt.d.mts +0 -72
- package/dist/modules/channels/prompt.mjs +0 -208
- package/dist/modules/channels/prompt.mjs.map +0 -7
- package/dist/modules/channels/routing.d.mts +0 -5
- package/dist/modules/channels/routing.mjs +0 -53
- package/dist/modules/channels/routing.mjs.map +0 -7
- package/dist/modules/sandboxes/access.d.mts +0 -34
- package/dist/modules/sandboxes/access.mjs +0 -15
- package/dist/modules/sandboxes/access.mjs.map +0 -7
- package/dist/modules/sandboxes/egress-bootstrap.d.mts +0 -3
- package/dist/modules/sandboxes/egress-bootstrap.mjs +0 -929
- package/dist/modules/sandboxes/egress-bootstrap.mjs.map +0 -7
- package/dist/modules/sandboxes/egress.d.mts +0 -94
- package/dist/modules/sandboxes/egress.mjs +0 -1561
- package/dist/modules/sandboxes/egress.mjs.map +0 -7
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../src/sandboxes/egress.ts"],
|
|
4
|
-
"sourcesContent": ["import * as z from 'zod';\nimport {\n WorkspaceEgressAction,\n workspaceEgressRequestSchema,\n deviceEgressWorkspaceIdSchema,\n workspaceEgressStatusSchema,\n type WorkspaceEgressRequestIface,\n type WorkspaceEgressStatusIface,\n type DeviceEgressLeaseIface,\n WorkspaceNetworkPolicy,\n workspaceNetworkPolicySchema,\n} from '@finalai/agent-protocol/device-egress';\nimport { Capability, FilesAccess, ShellAccess } from '@finalai/agent-protocol';\nimport type { JsonValue } from '@finalai/agent-provider';\nimport {\n grantAllows,\n SandboxCapability,\n SandboxExecutionOperation,\n withSandboxNetworking,\n withSandboxOverrides,\n type SandboxNetworkingControllerIface,\n type SandboxGrantIface,\n type SandboxNetworkingExtensionIface,\n} from '@finalai/agent-provider/sandbox';\nimport type {\n NetworkSandboxSessionIface,\n SandboxActingUserIface,\n SandboxRunResultIface,\n SandboxProviderHandleIface,\n NetworkPolicyIface,\n} from '@finalai/agent-provider/sandbox';\nimport {\n deviceCredentialsFor,\n type DeviceAccessIface,\n type DeviceApiCredentialsIface,\n} from \"./access.mjs\";\nimport {\n createDeviceApiClient,\n type DeviceApiClientIface,\n type DeviceApiConfigIface,\n deviceApiStatusOf,\n deviceApiCodeOf,\n DeviceApiClientErrorCode,\n} from \"./device-api.mjs\";\nimport {\n workspaceEgressBootstrap,\n cachedWorkspaceEgressBootstrap,\n workspaceEgressLauncher,\n} from \"./egress-bootstrap.mjs\";\nimport { sleep } from \"./bytes.mjs\";\n\nconst localStatusSchema = workspaceEgressStatusSchema.extend({\n architecture: z.string().optional(),\n networkPristine: z.boolean().optional(),\n policyRouting: z.boolean().optional(),\n helperReady: z.boolean().optional(),\n busy: z.boolean().optional(),\n configuring: z.boolean().optional(),\n controllerAlive: z.boolean().optional(),\n restorePending: z.boolean().optional(),\n choicePending: z.boolean().optional(),\n ownerUserId: z.string().nullable().optional(),\n workspaceId: z.string().nullable().optional(),\n});\n\ninterface ConfigurationOutcomeIface {\n result: z.infer<typeof localStatusSchema> | null;\n failures: unknown[];\n}\n\nconst validateApprovedDevices = (lease: DeviceEgressLeaseIface, approved: readonly string[]) => {\n if (\n lease.devices.length !== approved.length ||\n lease.devices.some(\n (device, index) => device.deviceId.toLowerCase() !== approved[index]?.toLowerCase(),\n )\n )\n throw Object.assign(\n new Error('Egress lease Devices do not match the approved ordered Device list'),\n { invalidEgressLease: true, code: 'configuration' },\n );\n};\n\nconst validateActiveLease = (lease: DeviceEgressLeaseIface, at: number) => {\n if (lease.state !== 'active' || !Number.isFinite(lease.expiresAtMs) || lease.expiresAtMs <= at)\n throw Object.assign(new Error('Egress lease is not active or has expired'), {\n invalidEgressLease: true,\n code: 'configuration',\n });\n};\n\nconst isPermanentAuthorizationFailure = (error: Error): boolean => {\n const pending = [error];\n const visited = new Set<Error>();\n while (pending.length > 0 && visited.size < 32) {\n const current = pending.pop();\n if (current == null || visited.has(current)) continue;\n visited.add(current);\n const status = deviceApiStatusOf(current);\n if (status != null && [401, 403, 404, 410].includes(status)) return true;\n if (current.cause instanceof Error) pending.push(current.cause);\n if (current instanceof AggregateError)\n for (const nested of current.errors) if (nested instanceof Error) pending.push(nested);\n }\n return false;\n};\n\nexport interface WorkspaceEgressManagerOptionsIface {\n // Raw, unguarded session; passing withWorkspaceEgress() here recursively deadlocks.\n sandbox: NetworkSandboxSessionIface;\n workspaceId: string;\n organizationId: string;\n // Device API access for this workspace's project.\n credentials?: DeviceApiCredentialsIface;\n actingUser: SandboxActingUserIface;\n api: DeviceApiConfigIface | (() => DeviceApiConfigIface);\n // Must execute in this workspace's isolated network namespace, as root with NET_ADMIN.\n // Run python3 -I -c source source (or a file with __file__); pass JSON on stdin.\n privilegedRun?: (request: { source: string; input: string }) => Promise<SandboxRunResultIface>;\n client?: Pick<DeviceApiClientIface, 'egress'>;\n fetch?: typeof fetch;\n // Restore the provider's outer network policy only after the namespace guard is installed.\n afterGuard?: (policy?: NetworkPolicyIface) => Promise<void>;\n // Optional outer-provider fence after namespace denial; unsupported providers may retain namespace-only denial.\n afterBlock?: () => Promise<void>;\n // Provider-confirmed deletion permits authorization cleanup without entering a missing namespace.\n namespaceExists?: () => Promise<boolean>;\n initialNetworkPolicy?: NetworkPolicyIface;\n onNetworkPolicy?: (policy: NetworkPolicyIface) => Promise<void>;\n allowConfiguration?: boolean;\n allowOwnerChange?: boolean;\n authorizeOwnerChange?: (actingUserId: string | null) => Promise<void>;\n onClose?: () => void;\n now?: () => number;\n onFailure?: (event: {\n operation: string;\n workspaceId: string;\n leaseId: string | null;\n reason: string;\n httpStatus: number | null;\n }) => void;\n}\n\nexport const suspendWorkspaceEgress = async (args: {\n api: DeviceApiConfigIface | (() => DeviceApiConfigIface);\n organizationId: string;\n credentials?: DeviceApiCredentialsIface;\n workspaceId: string;\n actingUser: SandboxActingUserIface;\n}): Promise<void> => {\n await createDeviceApiClient({ api: args.api }).egress.suspend({\n caller: {\n organizationId: args.organizationId,\n credentials: args.credentials,\n actingUser: args.actingUser,\n },\n workspaceId: args.workspaceId,\n });\n};\n\n// Host-owned lease renewal; callers tie close() to their provider handle's lifecycle.\nexport const createWorkspaceEgressManager = (options: WorkspaceEgressManagerOptionsIface) => {\n if (!deviceEgressWorkspaceIdSchema.safeParse(options.workspaceId).success)\n throw new Error(\n 'Device egress requires a stable workspaceId of 1\u2013256 characters without control characters',\n );\n const client = options.client ?? createDeviceApiClient({ api: options.api });\n const revokeLease = async (args: Parameters<typeof client.egress.revoke>[0]) => {\n try {\n await client.egress.revoke(args);\n } catch (cause) {\n const status = cause instanceof Error ? deviceApiStatusOf(cause) : null;\n if (status !== 404 && status !== 410) throw cause;\n }\n };\n const now = options.now ?? Date.now;\n const run =\n options.privilegedRun ??\n ((request) =>\n options.sandbox.run({\n command: 'sudo',\n args: ['-n', 'python3', '-I', '-c', workspaceEgressLauncher],\n stdin: JSON.stringify(request),\n timeoutMs: 35_000,\n }));\n let pending: Promise<unknown> = Promise.resolve();\n let owner: string | null | undefined;\n let current: DeviceEgressLeaseIface | null = null;\n let closed = false;\n let stopped = false;\n let recovered = false;\n let createdLease: { leaseId: string; userId: string } | null = null;\n let directPolicy: NetworkPolicyIface | undefined = options.initialNetworkPolicy;\n let directPolicyKnown = false;\n let requiresChoice = false;\n let timer: ReturnType<typeof setTimeout> | null = null;\n let nextRenewAttempt = 0;\n let nextRecoveryAttempt = 0;\n let nextRecoveryProbeAt = 0;\n let initializing = false;\n let configurationToken: string | null = null;\n let pendingUnlock: string | null = null;\n let repairProviderPolicy = false;\n let configurationFailure: unknown = null;\n let notifiedClosed = false;\n const notifyClosed = () => {\n if (!notifiedClosed) {\n notifiedClosed = true;\n options.onClose?.();\n }\n };\n let cachedStatus: {\n at: number;\n userId: string | null;\n value: z.infer<typeof localStatusSchema>;\n } | null = null;\n const reportFailure = (operation: string, cause: unknown) => {\n const rawCode = z.object({ code: z.string() }).safeParse(cause).data?.code;\n const known = [\n 'credential_missing',\n 'no_acting_user',\n 'unauthorized',\n 'forbidden',\n 'not_found',\n 'unavailable',\n 'invalid',\n 'rate_limited',\n 'prerequisite',\n 'conflict',\n 'configuration',\n 'request_failed',\n 'egress_enrollment_lost',\n ];\n try {\n options.onFailure?.({\n operation,\n workspaceId: options.workspaceId,\n leaseId: current?.leaseId ?? null,\n reason:\n rawCode != null && known.includes(rawCode)\n ? rawCode\n : cause instanceof TypeError\n ? 'transport'\n : 'operation_failed',\n httpStatus: cause instanceof Error ? deviceApiStatusOf(cause) : null,\n });\n } catch {\n // Host telemetry must not interrupt fencing, claim cleanup, or renewal.\n console.warn('Workspace egress failure observer threw');\n }\n };\n const serialized = <T>(work: () => Promise<T>): Promise<T> => {\n const task = pending.then(work, work);\n pending = task.catch(() => undefined);\n return task;\n };\n let sourceDigest: Promise<string> | null = null;\n const execute = async (request: Record<string, JsonValue>) => {\n if (request.action === 'block' && configurationToken == null && pendingUnlock != null) {\n try {\n await execute({\n action: 'claim',\n configurationToken: pendingUnlock,\n refresh: true,\n verifyOnly: true,\n });\n } catch (cause) {\n if (!z.object({ code: z.literal('conflict') }).safeParse(cause).success) throw cause;\n pendingUnlock = null;\n }\n }\n if (\n configurationFailure != null &&\n request.action !== 'status' &&\n request.action !== 'unlock' &&\n request.action !== 'block'\n )\n throw configurationFailure;\n if (request.action !== 'status') cachedStatus = null;\n sourceDigest ??= crypto.subtle\n .digest('SHA-256', new TextEncoder().encode(workspaceEgressBootstrap))\n .then((hash) =>\n [...new Uint8Array(hash)].map((byte) => byte.toString(16).padStart(2, '0')).join(''),\n );\n const input = JSON.stringify({\n ...request,\n configurationToken: request.configurationToken ?? configurationToken ?? pendingUnlock,\n workspaceId: options.workspaceId,\n });\n let result = await run({ source: cachedWorkspaceEgressBootstrap(await sourceDigest), input });\n if (result.exitCode === 0) {\n let response: unknown;\n try {\n response = JSON.parse(result.stdout);\n } catch {\n response = null;\n }\n if (z.object({ needsBootstrap: z.literal(true) }).safeParse(response).success)\n result = await run({ source: workspaceEgressBootstrap, input });\n }\n if (result.exitCode !== 0) {\n let failure: unknown;\n try {\n failure = JSON.parse(result.stdout);\n } catch {\n failure = null;\n }\n const parsed = z.object({ errorCode: z.string() }).safeParse(failure);\n const code =\n parsed.success &&\n [\n 'prerequisite',\n 'conflict',\n 'configuration',\n DeviceApiClientErrorCode.EgressEnrollmentLost,\n ].includes(parsed.data.errorCode)\n ? parsed.data.errorCode\n : 'prerequisite';\n throw Object.assign(\n new Error(\n `Workspace egress ${code} failed${code === 'prerequisite' ? ' (root, TUN, NET_ADMIN and policy routing required)' : ''}. Inspect the root-owned last-error.json for details`,\n ),\n { code },\n );\n }\n let raw: unknown;\n try {\n raw = JSON.parse(result.stdout);\n } catch {\n throw new Error('Invalid workspace egress status');\n }\n const status = localStatusSchema.parse(raw);\n if (request.action === 'block' && configurationToken == null && pendingUnlock != null) {\n try {\n await execute({ action: 'unlock', configurationToken: pendingUnlock });\n pendingUnlock = null;\n } catch (cause) {\n reportFailure('unlock', cause);\n }\n }\n return status;\n };\n const statusForGuard = async (userId: string | null) => {\n if (\n cachedStatus != null &&\n cachedStatus.userId === userId &&\n performance.now() - cachedStatus.at < 100\n )\n return cachedStatus.value;\n const value = await execute({ action: 'status' });\n cachedStatus = { at: performance.now(), userId, value };\n return value;\n };\n const callerFor = (userId: string | null) => ({\n organizationId: options.organizationId,\n credentials: options.credentials,\n actingUser: { current: async () => userId },\n });\n const block = async (userId: string | null, restoreDirect = false) => {\n current = null;\n const local = await execute({ action: 'block', ownerUserId: userId, restoreDirect }).catch(\n async (cause) => {\n if (z.object({ code: z.literal('conflict') }).safeParse(cause).success) throw cause;\n const fences = await Promise.allSettled([\n options.afterBlock?.(),\n options.afterGuard == null\n ? undefined\n : restoreNetwork({ mode: WorkspaceNetworkPolicy.DenyAll }),\n ]);\n const failures = fences.flatMap((result) =>\n result.status === 'rejected' ? [result.reason] : [],\n );\n if (failures.length > 0)\n throw new AggregateError([cause, ...failures], 'Namespace and provider denial failed');\n throw cause;\n },\n );\n await options.afterBlock?.();\n return local;\n };\n const release = async (args: {\n userId: string | null;\n leaseId: string | null;\n nextOwner: string | null;\n suspendWorkspace?: boolean;\n restoreDirect?: boolean;\n }) => {\n const failures: unknown[] = [];\n let denied = false;\n let superseded = false;\n current = null;\n try {\n const local = await execute({\n action: 'block',\n ownerUserId: args.nextOwner,\n expectedLeaseId: args.suspendWorkspace === true ? null : args.leaseId,\n restoreDirect: args.restoreDirect ?? false,\n });\n denied = local.mode === 'blocked';\n superseded = !denied;\n } catch (cause) {\n superseded = z.object({ code: z.literal('conflict') }).safeParse(cause).success;\n failures.push(cause);\n }\n if (!superseded || args.suspendWorkspace === true)\n try {\n const fences = await Promise.allSettled([\n options.afterBlock?.(),\n (!denied || options.afterBlock == null) && options.afterGuard != null\n ? restoreNetwork({ mode: WorkspaceNetworkPolicy.DenyAll, allow: [] })\n : undefined,\n ]);\n const rejected = fences.flatMap((result) =>\n result.status === 'rejected' ? [result.reason] : [],\n );\n if (rejected.length > 0) throw new AggregateError(rejected, 'Provider denial failed');\n repairProviderPolicy = false;\n } catch (cause) {\n failures.push(cause);\n }\n if (args.suspendWorkspace === true) {\n try {\n // Local owner/lease fields constrain the namespace guard, never API identity.\n await client.egress.suspend({\n caller: callerFor(args.userId),\n workspaceId: options.workspaceId,\n });\n createdLease = null;\n } catch (cause) {\n failures.push(cause);\n }\n } else if (args.userId != null && args.leaseId != null) {\n try {\n await revokeLease({\n caller: callerFor(args.userId),\n leaseId: args.leaseId,\n workspaceId: options.workspaceId,\n });\n if (createdLease?.leaseId === args.leaseId) createdLease = null;\n } catch (cause) {\n failures.push(cause);\n }\n }\n if (failures.length > 0)\n throw new AggregateError(failures, 'Workspace network block or egress revocation failed');\n };\n let reportedPolicy: string | null = null;\n const reportLogicalPolicy = async () => {\n const logical =\n directPolicyKnown && directPolicy != null\n ? directPolicy\n : { mode: WorkspaceNetworkPolicy.DenyAll };\n const encoded = JSON.stringify(logical);\n if (encoded !== reportedPolicy) {\n await options.onNetworkPolicy?.(logical);\n reportedPolicy = encoded;\n }\n };\n const restoreNetwork = async (policy: { mode: string; allow?: string[] } | null) => {\n const parsed = workspaceNetworkPolicySchema.safeParse(policy);\n if (policy != null && !parsed.success)\n throw new Error('Saved workspace network policy is unsupported; networking remains blocked');\n const desired = parsed.success ? parsed.data : { mode: WorkspaceNetworkPolicy.DenyAll };\n if (options.afterGuard != null) await options.afterGuard(desired);\n else if (desired.mode !== WorkspaceNetworkPolicy.AllowAll || options.afterBlock != null)\n throw new Error('A provider policy-restoration hook is required; networking remains blocked');\n await reportLogicalPolicy();\n };\n const profileFor = async (userId: string) => {\n const caller = callerFor(userId);\n const profile = await client.egress.workspace({ caller, workspaceId: options.workspaceId });\n if (profile.networkPolicy != null) {\n directPolicy = workspaceNetworkPolicySchema.parse(profile.networkPolicy);\n directPolicyKnown = true;\n }\n if (profile.networkPolicy == null && options.initialNetworkPolicy == null) {\n requiresChoice = true;\n await block(userId);\n throw new Error(\n 'The host must supply the current network policy before opting in a workspace',\n );\n }\n if (profile.networkPolicy == null && options.initialNetworkPolicy != null) {\n const policy = workspaceNetworkPolicySchema.parse(options.initialNetworkPolicy);\n directPolicy = policy;\n await client.egress.setNetworkPolicy({\n caller: callerFor(null),\n workspaceId: options.workspaceId,\n policy,\n initializeIfMissing: true,\n });\n const initialized = await client.egress.workspace({\n caller,\n workspaceId: options.workspaceId,\n });\n if (initialized.networkPolicy != null) {\n directPolicy = workspaceNetworkPolicySchema.parse(initialized.networkPolicy);\n directPolicyKnown = true;\n }\n return initialized;\n }\n return profile;\n };\n const authorizeRouteMutation = async (\n userId: string | null,\n local: z.infer<typeof localStatusSchema>,\n ) => {\n if (\n options.allowOwnerChange === false &&\n local.ownerUserId != null &&\n local.ownerUserId !== userId\n )\n throw new Error('Workspace egress belongs to another actor; this binding requires its owner');\n if (local.ownerUserId != null && local.ownerUserId !== userId)\n await options.authorizeOwnerChange?.(userId);\n // An owned active lease permits local cleanup during an outage; other routes require fresh authority.\n if (\n current != null &&\n owner === userId &&\n local.ownerUserId === userId &&\n local.leaseId === current.leaseId &&\n current.state === 'active' &&\n current.expiresAtMs > now()\n )\n return;\n if (userId == null) {\n await client.egress.networkState({\n organizationId: options.organizationId,\n credentials: options.credentials,\n workspaceId: options.workspaceId,\n });\n return;\n }\n const profile = await client.egress.workspace({\n caller: callerFor(userId),\n workspaceId: options.workspaceId,\n });\n if (options.allowOwnerChange === false && profile.lockedByOtherOwner)\n throw new Error('Workspace egress belongs to another actor; this binding requires its owner');\n };\n const waitReady = async (leaseId: string | null, mode: string) => {\n const deadline = performance.now() + 35_000;\n for (;;) {\n const result = await execute({ action: 'status' });\n if (result.mode === mode && (leaseId == null || result.leaseId === leaseId)) return result;\n if (performance.now() >= deadline)\n throw new Error('Workspace egress did not become ready; networking remains blocked');\n await sleep(200);\n }\n };\n const configureAttempt = async (userId: string, deviceIds: string[], dnsResolvers?: string[]) => {\n recovered = false;\n await authorizeRouteMutation(userId, await execute({ action: 'status' }));\n const local = await block(userId);\n if (local.policyRouting === false)\n throw new Error(\n 'This sandbox kernel does not support the Linux policy routing required for Device egress',\n );\n const caller = callerFor(userId);\n const profile = await profileFor(userId);\n if (\n options.afterGuard == null &&\n (directPolicy?.mode !== WorkspaceNetworkPolicy.AllowAll || options.afterBlock != null)\n )\n throw new Error('A provider policy-restoration hook is required before Device configuration');\n try {\n if (profile.lease != null)\n await revokeLease({\n caller,\n leaseId: profile.lease.leaseId,\n workspaceId: options.workspaceId,\n });\n if (\n profile.onlineDeviceIds != null &&\n deviceIds.every((id) =>\n profile.deviceIds.some((saved) => saved.toLowerCase() === id.toLowerCase()),\n ) &&\n !deviceIds.some((id) =>\n profile.onlineDeviceIds?.some((online) => online.toLowerCase() === id.toLowerCase()),\n )\n )\n throw new Error('No configured egress Device is online; networking remains blocked');\n const architecture = local.architecture ?? 'x86_64';\n const selectArtifact = (artifacts: DeviceEgressLeaseIface['helper']) => {\n const selected = [artifacts, ...(artifacts.alternatives ?? [])].find(\n (item) => (item.architecture ?? 'x86_64') === architecture,\n );\n if (selected == null)\n throw new Error(\n 'No approved networking helper is configured for this workspace architecture',\n );\n return selected;\n };\n const helper = selectArtifact(profile.helper);\n const helperUrl = new URL(helper.url);\n if (helperUrl.protocol !== 'https:') {\n throw new Error('Workspace networking artifacts require HTTPS');\n }\n const cached = await execute({ action: 'artifact', sha256: helper.sha256 });\n let bytes: Uint8Array | null = null;\n if (cached.helperReady !== true) {\n const response = await (options.fetch ?? fetch)(helperUrl, {\n redirect: 'error',\n signal: AbortSignal.timeout(60_000),\n });\n if (!response.ok || response.body == null) {\n await response.body?.cancel();\n throw new Error('Could not download the pinned workspace networking helper');\n }\n const chunks: Uint8Array[] = [];\n let size = 0;\n const reader = response.body.getReader();\n try {\n for (;;) {\n const next = await reader.read();\n if (next.done) break;\n size += next.value.byteLength;\n if (size > 128 * 1024 * 1024)\n throw new Error('Workspace networking helper exceeds its size limit');\n chunks.push(next.value);\n }\n } finally {\n await reader.cancel();\n }\n const downloaded = new Uint8Array(size);\n let offset = 0;\n for (const chunk of chunks) {\n downloaded.set(chunk, offset);\n offset += chunk.byteLength;\n }\n const hash = [...new Uint8Array(await crypto.subtle.digest('SHA-256', downloaded))]\n .map((byte) => byte.toString(16).padStart(2, '0'))\n .join('');\n if (hash !== helper.sha256)\n throw new Error('Workspace networking helper failed integrity verification');\n bytes = downloaded;\n }\n const hash = helper.sha256;\n // Upload APIs can create root-owned files; a sandbox-owned parent allows normal cleanup.\n const stagingDirectory = bytes == null ? null : `/tmp/final-egress-${crypto.randomUUID()}`;\n const helperPath =\n stagingDirectory == null\n ? '/run/final-workspace-egress/helper'\n : `${stagingDirectory}/helper`;\n let leaseId: string | null = null;\n const outcome: ConfigurationOutcomeIface = { result: null, failures: [] };\n try {\n if (bytes != null)\n await options.sandbox.writeBinaryFile({ path: helperPath, content: bytes });\n // Downloads and uploads can outlive the claim; do not enroll after another binding wins.\n const refreshed = await execute({ action: 'claim', configurationToken, refresh: true });\n if (refreshed.busy === true)\n throw new Error('Workspace configuration claim was superseded');\n const lease = await client.egress.create({\n caller,\n workspaceId: options.workspaceId,\n deviceIds,\n dnsResolvers,\n });\n leaseId = lease.leaseId;\n createdLease = { leaseId: lease.leaseId, userId };\n validateApprovedDevices(lease, deviceIds);\n if (lease.workspaceId !== options.workspaceId)\n throw new Error('Egress enrollment belongs to a different workspace');\n if (lease.state !== 'provisioning')\n throw new Error('Egress enrollment must return provisioning state before activation');\n if (selectArtifact(lease.helper).sha256 !== hash)\n throw new Error('Networking artifact changed during enrollment; retry configuration');\n // Allow transport only once local denial, artifact integrity, and lease ownership are established.\n await execute({ action: 'claim', configurationToken, refresh: true });\n repairProviderPolicy = true;\n await restoreNetwork({ mode: WorkspaceNetworkPolicy.AllowAll, allow: [] });\n await execute({ action: 'claim', configurationToken, refresh: true });\n await execute({\n action: 'configure',\n ownerUserId: userId,\n helperPath,\n config: { ...lease, helper, ownerUserId: userId, revision: crypto.randomUUID() },\n });\n await waitReady(lease.leaseId, 'enrolled');\n if (configurationFailure != null) throw configurationFailure;\n // Revalidate the root-owned claim immediately before publishing packet grants.\n const claim = await execute({ action: 'claim', configurationToken, refresh: true });\n if (claim.busy === true) throw new Error('Workspace configuration claim was superseded');\n const active = await client.egress.activate({ caller, leaseId: lease.leaseId });\n validateApprovedDevices(active, deviceIds);\n if (active.leaseId !== lease.leaseId)\n throw new Error('Egress activation returned a different lease');\n if (active.workspaceId !== options.workspaceId)\n throw new Error('Egress activation belongs to a different workspace');\n if (active.state !== 'active')\n throw new Error('Egress activation must return active state');\n validateActiveLease(active, now());\n await execute({ action: 'renew', lease: active });\n const result = await waitReady(lease.leaseId, 'device');\n repairProviderPolicy = false;\n current = active;\n recovered = true;\n nextRenewAttempt = 0;\n nextRecoveryAttempt = 0;\n outcome.result = result;\n } catch (cause) {\n outcome.failures.push(cause);\n try {\n await release({ userId, leaseId, nextOwner: userId });\n } catch (cleanup) {\n outcome.failures.push(cleanup);\n }\n }\n try {\n if (stagingDirectory != null)\n await options.sandbox.removePath({\n path: stagingDirectory,\n recursive: true,\n force: true,\n });\n } catch (cleanup) {\n reportFailure('artifact-cleanup', cleanup);\n outcome.failures.push(cleanup);\n }\n if (outcome.failures.length > 0 && outcome.result != null) {\n try {\n await release({ userId, leaseId, nextOwner: userId });\n } catch (cleanup) {\n outcome.failures.push(cleanup);\n }\n }\n if (outcome.failures.length > 0)\n throw new AggregateError(outcome.failures, 'Egress configuration or cleanup failed');\n if (outcome.result == null) throw new Error('Egress configuration did not return a status');\n return outcome.result;\n } catch (cause) {\n try {\n if (options.afterBlock == null && directPolicy != null) {\n let ownsClaim = false;\n try {\n const claim = await execute({ action: 'claim', configurationToken, refresh: true });\n ownsClaim = claim.busy !== true;\n } catch (claim) {\n reportFailure('outer-policy-claim', claim);\n }\n if (ownsClaim && (await execute({ action: 'status' })).mode === 'blocked')\n await restoreNetwork(directPolicy);\n }\n } catch (cleanup) {\n throw new AggregateError(\n [cause, cleanup],\n 'Egress configuration and outer policy restoration failed',\n );\n }\n throw cause;\n }\n };\n\n const verifyConfigurationClaim = async () => {\n const claim = await execute({\n action: 'claim',\n configurationToken,\n refresh: true,\n verifyOnly: true,\n });\n if (claim.busy === true) throw new Error('Workspace configuration claim was superseded');\n };\n\n const withConfigurationClaim = async <T>(\n work: () => Promise<T>,\n cleanup?: () => Promise<void>,\n waitForClaim = true,\n ): Promise<T> => {\n if (pendingUnlock != null) {\n await execute({ action: 'unlock', configurationToken: pendingUnlock });\n pendingUnlock = null;\n }\n const token = crypto.randomUUID();\n const deadline = performance.now() + 180_000;\n for (;;) {\n let claim: Awaited<ReturnType<typeof execute>>;\n try {\n claim = await execute({ action: 'claim', configurationToken: token });\n } catch (cause) {\n // The guest may have recorded this token before its response was lost.\n pendingUnlock = token;\n recovered = false;\n throw cause;\n }\n if (claim.busy !== true) break;\n if (!waitForClaim)\n throw Object.assign(new Error('Another binding owns workspace configuration'), {\n code: 'conflict',\n });\n if (performance.now() >= deadline)\n throw new Error('Another binding is configuring workspace egress; retry later');\n await sleep(200);\n }\n configurationToken = token;\n let refreshing = true;\n let refreshTimer: ReturnType<typeof setTimeout> | null = null;\n let refresh: Promise<void> = Promise.resolve();\n const scheduleRefresh = () => {\n refreshTimer = setTimeout(() => {\n refresh = execute({ action: 'claim', configurationToken: token, refresh: true })\n .then((claim) => {\n if (claim.busy === true)\n throw new Error('Workspace configuration claim was superseded');\n })\n .catch((cause) => {\n configurationFailure = cause;\n reportFailure('configuration-claim', cause);\n });\n void refresh.then(() => {\n if (refreshing && configurationFailure == null) scheduleRefresh();\n });\n }, 60_000);\n if (typeof refreshTimer === 'object' && 'unref' in refreshTimer) refreshTimer.unref();\n };\n scheduleRefresh();\n let result: { value: T } | null = null;\n const failures: unknown[] = [];\n try {\n result = { value: await work() };\n } catch (cause) {\n failures.push(cause);\n }\n refreshing = false;\n if (refreshTimer != null) clearTimeout(refreshTimer);\n await refresh;\n if (configurationFailure != null && !failures.includes(configurationFailure))\n failures.push(configurationFailure);\n let cleaned = false;\n const clean = async () => {\n if (cleanup == null || cleaned) return;\n cleaned = true;\n try {\n await cleanup();\n } catch (cause) {\n failures.push(cause);\n reportFailure('configuration-cleanup', cause);\n }\n };\n if (failures.length > 0) await clean();\n try {\n await execute({ action: 'unlock', configurationToken: token });\n } catch (cause) {\n pendingUnlock = token;\n recovered = false;\n if (failures.length === 0) failures.push(cause);\n else reportFailure('unlock', cause);\n if (!cleaned && cleanup != null) {\n try {\n const claim = await execute({\n action: 'claim',\n configurationToken: token,\n refresh: true,\n });\n if (claim.busy === true) throw new Error('Workspace configuration claim was superseded');\n await clean();\n } catch (cleanupClaim) {\n failures.push(cleanupClaim);\n reportFailure('configuration-cleanup', cleanupClaim);\n }\n }\n }\n configurationToken = null;\n configurationFailure = null;\n if (repairProviderPolicy) {\n repairProviderPolicy = false;\n try {\n if (options.namespaceExists == null || (await options.namespaceExists()) !== false)\n await withConfigurationClaim(\n async () => {\n const latest = await execute({ action: 'status' });\n if (latest.leaseId != null) return;\n if (latest.choicePending === true || latest.mode !== 'direct') {\n if (options.afterBlock != null) await options.afterBlock();\n else await restoreNetwork({ mode: WorkspaceNetworkPolicy.DenyAll, allow: [] });\n await execute({ action: 'claim', configurationToken, refresh: true });\n return;\n }\n // Repair a late provider write against current state, never the superseded actor's policy.\n await block(latest.ownerUserId ?? null, true);\n const state = await client.egress.networkState({\n organizationId: options.organizationId,\n credentials: options.credentials,\n workspaceId: options.workspaceId,\n });\n if (state.enabled || state.networkPolicy == null)\n throw new Error(\n 'Current direct-access policy is unavailable; networking remains blocked',\n );\n await restoreNetwork(state.networkPolicy);\n await execute({ action: 'claim', configurationToken, refresh: true });\n await execute({ action: 'disable', ownerUserId: null });\n await waitReady(null, 'direct');\n },\n undefined,\n false,\n );\n } catch (cause) {\n if (!z.object({ code: z.literal('conflict') }).safeParse(cause).success)\n failures.push(cause);\n reportFailure('provider-policy-repair', cause);\n }\n }\n if (failures.length > 1)\n throw new AggregateError(\n failures,\n failures\n .map((failure) => (failure instanceof Error ? failure.message : String(failure)))\n .join('; '),\n { cause: failures[0] },\n );\n if (failures.length > 0) throw failures[0];\n if (result == null) throw new Error('Workspace egress configuration returned no result');\n return result.value;\n };\n\n const configure = (userId: string, deviceIds: string[], dnsResolvers?: string[]) =>\n withConfigurationClaim(\n () => configureAttempt(userId, deviceIds, dnsResolvers),\n async () => {\n if (\n current != null &&\n createdLease?.leaseId === current.leaseId &&\n createdLease.userId === userId\n )\n await release({ userId, leaseId: current.leaseId, nextOwner: userId });\n },\n );\n\n const recoverAttempt = async (userId: string | null, background: boolean) => {\n const local = await execute({ action: 'status' });\n if (local.ownerUserId != null && local.ownerUserId !== userId) {\n if (background) {\n requiresChoice = true;\n current = null;\n return;\n }\n await options.authorizeOwnerChange?.(userId);\n }\n if (local.mode === 'error' && local.ownerUserId !== userId) {\n requiresChoice = true;\n if (options.allowOwnerChange !== false) {\n await options.afterBlock?.();\n await restoreNetwork({ mode: WorkspaceNetworkPolicy.DenyAll, allow: [] });\n }\n throw new Error(\n 'Workspace egress enforcement is in error; explicitly configure or disable to repair',\n );\n }\n // Recovery holds the same namespace claim as explicit configuration and disable.\n // An actor change cannot inherit another person's exit, including after host restart.\n if (\n (local.ownerUserId != null && local.ownerUserId !== userId) ||\n (background && local.mode === 'blocked' && local.ownerUserId === null && userId != null)\n ) {\n if (options.allowOwnerChange === false)\n throw new Error(\n 'Workspace egress belongs to another actor; this binding requires its owner',\n );\n if (background) {\n requiresChoice = true;\n current = null;\n return;\n }\n await authorizeRouteMutation(userId, local);\n requiresChoice = true;\n await release({ userId, leaseId: local.leaseId, nextOwner: userId, suspendWorkspace: true });\n throw new Error(\n 'Workspace egress owner changed; explicitly configure or disable egress before running tools',\n );\n }\n const choicePending = local.choicePending ?? local.mode === 'blocked';\n if (userId == null) {\n const state = await client.egress.networkState({\n organizationId: options.organizationId,\n credentials: options.credentials,\n workspaceId: options.workspaceId,\n });\n if (state.enabled) {\n requiresChoice = true;\n await block(null);\n throw new Error(\n 'This workspace has Device egress configured; an acting user must choose its network policy',\n );\n }\n if (choicePending) {\n requiresChoice = true;\n await block(null);\n throw new Error('Workspace networking is blocked; explicitly configure or disable egress');\n }\n let policy = state.networkPolicy;\n if (policy == null) {\n if (options.initialNetworkPolicy == null) {\n requiresChoice = true;\n await block(null);\n throw new Error(\n 'The host must supply the current network policy before opting in a workspace',\n );\n }\n const initial = workspaceNetworkPolicySchema.parse(options.initialNetworkPolicy);\n await client.egress.setNetworkPolicy({\n caller: callerFor(null),\n workspaceId: options.workspaceId,\n policy: initial,\n initializeIfMissing: true,\n });\n policy = (\n await client.egress.networkState({\n organizationId: options.organizationId,\n credentials: options.credentials,\n workspaceId: options.workspaceId,\n })\n ).networkPolicy;\n }\n if (policy != null) {\n directPolicy = workspaceNetworkPolicySchema.parse(policy);\n directPolicyKnown = true;\n }\n await restoreNetwork(policy);\n if (local.mode !== 'direct' || local.restorePending === true) {\n await execute({ action: 'disable', ownerUserId: null });\n await waitReady(null, 'direct');\n }\n requiresChoice = false;\n return;\n }\n const desired = await profileFor(userId);\n if (desired.lockedByOtherOwner) {\n if (options.allowOwnerChange === false)\n throw new Error(\n 'Workspace egress belongs to another actor; this binding requires its owner',\n );\n requiresChoice = true;\n if (background) {\n current = null;\n return;\n }\n await block(userId);\n throw new Error(\n 'Workspace egress belongs to a different actor; configure or explicitly disable it before running tools',\n );\n }\n if (!desired.enabled) {\n if (choicePending) {\n requiresChoice = true;\n await block(userId);\n throw new Error('Workspace networking is blocked; explicitly configure or disable egress');\n }\n await restoreNetwork(desired.networkPolicy);\n if (local.mode !== 'direct' || local.restorePending === true) {\n await execute({ action: 'disable', ownerUserId: userId });\n await waitReady(null, 'direct');\n }\n current = null;\n return;\n }\n if (\n desired.lease != null &&\n (['device', 'reconnecting'].includes(local.mode) ||\n (['blocked', 'configuring'].includes(local.mode) && local.controllerAlive === true)) &&\n local.leaseId === desired.lease.leaseId\n ) {\n try {\n if (desired.lease.workspaceId !== options.workspaceId)\n throw new Error('Egress recovery belongs to a different workspace');\n validateApprovedDevices(desired.lease, desired.deviceIds);\n validateActiveLease(desired.lease, now());\n } catch (cause) {\n requiresChoice = true;\n if (options.allowOwnerChange !== false)\n await release({ userId, leaseId: desired.lease.leaseId, nextOwner: userId });\n throw cause;\n }\n current = desired.lease;\n await restoreNetwork({ mode: WorkspaceNetworkPolicy.AllowAll, allow: [] });\n if (local.mode === 'configuring' || local.expiresAtMs !== desired.lease.expiresAtMs) {\n await execute({ action: 'renew', lease: desired.lease });\n await waitReady(desired.lease.leaseId, 'device');\n }\n return;\n }\n if (options.allowOwnerChange === false)\n throw new Error(\n 'Workspace networking needs recovery by an active workspace binding before external access',\n );\n if (performance.now() < nextRecoveryAttempt)\n throw new Error(\n 'Workspace egress recovery is cooling down; retry later or explicitly configure',\n );\n nextRecoveryAttempt = performance.now() + 60_000;\n await configureAttempt(userId, desired.deviceIds, desired.dnsResolvers);\n nextRecoveryAttempt = 0;\n };\n const recover = async (userId: string | null, background: boolean) => {\n if (performance.now() < nextRecoveryProbeAt)\n throw new Error(\n 'Workspace egress recovery is cooling down; retry shortly or explicitly configure',\n );\n recovered = false;\n try {\n await withConfigurationClaim(\n () => recoverAttempt(userId, background),\n async () => {\n if (\n current != null &&\n createdLease?.leaseId === current.leaseId &&\n createdLease.userId === userId\n )\n await release({ userId, leaseId: current.leaseId, nextOwner: userId });\n },\n );\n recovered = true;\n nextRecoveryProbeAt = 0;\n } catch (cause) {\n if (cause instanceof Error && isPermanentAuthorizationFailure(cause)) {\n requiresChoice = true;\n try {\n if (options.allowOwnerChange !== false) await block(userId);\n } catch (cleanup) {\n throw new AggregateError(\n [cause, cleanup],\n 'Egress recovery rejected and local denial failed',\n );\n }\n }\n if (!initializing && !requiresChoice) nextRecoveryProbeAt = performance.now() + 5_000;\n throw cause;\n }\n };\n const stableStatus = async (userId: string | null) => {\n const deadline = performance.now() + 180_000;\n for (;;) {\n const local = await statusForGuard(userId);\n if (local.configuring !== true) return local;\n if (performance.now() >= deadline)\n throw new Error('Another binding is configuring workspace egress; retry later');\n cachedStatus = null;\n await sleep(200);\n }\n };\n const maintain = async (background = false) => {\n if (closed) throw new Error('Workspace egress manager is closed');\n if (background && (requiresChoice || (recovered && current == null))) return;\n if (requiresChoice) {\n const actor = await options.actingUser.current();\n const local = await execute({ action: 'status' });\n const repaired =\n local.configuring !== true &&\n ((local.mode === 'direct' &&\n local.choicePending === false &&\n local.restorePending !== true &&\n local.ownerUserId == null) ||\n (local.mode === 'device' &&\n local.ownerUserId === actor &&\n local.expiresAtMs != null &&\n local.expiresAtMs > now()));\n if (!repaired)\n throw new Error('Explicitly configure or disable workspace egress before running tools');\n // Another authorized binding repaired the namespace; revalidate its saved route.\n requiresChoice = false;\n current = null;\n owner = undefined;\n recovered = false;\n cachedStatus = null;\n nextRecoveryProbeAt = 0;\n }\n if (background && owner === undefined) return;\n const userId = background ? (owner ?? null) : await options.actingUser.current();\n if (owner !== userId) {\n if (options.allowOwnerChange === false && owner !== undefined && current != null)\n throw new Error(\n 'Workspace egress belongs to another actor; this binding requires its owner',\n );\n if (owner !== undefined && current != null) {\n await authorizeRouteMutation(userId, await execute({ action: 'status' }));\n requiresChoice = true;\n const leaseId = current.leaseId;\n owner = userId;\n await release({ userId, leaseId, nextOwner: userId, suspendWorkspace: true });\n throw new Error(\n 'Workspace egress owner changed; configure or disable egress before running tools',\n );\n }\n // Recovery failures belong to the actor that attempted them.\n nextRecoveryProbeAt = 0;\n nextRecoveryAttempt = 0;\n // Retain the last foreground identity even when recovery fails transiently.\n owner = userId;\n await recover(userId, background);\n }\n if (!recovered) {\n await recover(userId, background);\n }\n if (background && requiresChoice) return;\n if (current != null && current.expiresAtMs <= now()) {\n await recover(userId, background);\n }\n const local = await stableStatus(userId);\n if (local.mode === 'blocked' && local.ownerUserId == null && local.leaseId == null) {\n requiresChoice = true;\n if (background) return;\n throw new Error(\n 'Workspace networking is blocked; explicitly configure or disable egress before running tools',\n );\n }\n if (local.mode === 'error' && local.ownerUserId !== userId) {\n requiresChoice = true;\n if (options.allowOwnerChange !== false) {\n await options.afterBlock?.();\n await restoreNetwork({ mode: WorkspaceNetworkPolicy.DenyAll, allow: [] });\n }\n throw new Error(\n 'Workspace egress enforcement is in error; explicitly configure or disable to repair',\n );\n }\n if (\n (local.ownerUserId != null && local.ownerUserId !== userId) ||\n (background && local.mode === 'blocked' && local.ownerUserId === null && userId != null)\n ) {\n if (options.allowOwnerChange === false)\n throw new Error(\n 'Workspace egress belongs to another actor; this binding requires its owner',\n );\n if (background) {\n requiresChoice = true;\n current = null;\n return;\n }\n await authorizeRouteMutation(userId, local);\n requiresChoice = true;\n await release({ userId, leaseId: local.leaseId, nextOwner: userId, suspendWorkspace: true });\n throw new Error(\n 'Workspace egress owner changed; configure or disable egress before running tools',\n );\n }\n if (\n (current != null && local.leaseId !== current.leaseId) ||\n (current == null && local.leaseId != null)\n ) {\n current = null;\n await recover(userId, background);\n return;\n }\n if (\n (local.mode === 'error' || (local.mode === 'blocked' && local.controllerAlive !== true)) &&\n local.ownerUserId === userId\n ) {\n // A live controller waits through Device outages; a dead controller needs recovery.\n current = null;\n await recover(userId, background);\n return;\n }\n if (\n current != null &&\n userId != null &&\n performance.now() >= nextRenewAttempt &&\n (current.expiresAtMs - now() < 10 * 60_000 ||\n ['blocked', 'reconnecting'].includes(local.mode))\n ) {\n try {\n const lease = await client.egress.renew({\n caller: callerFor(userId),\n leaseId: current.leaseId,\n });\n validateActiveLease(lease, now());\n validateApprovedDevices(\n lease,\n current.devices.map((device) => device.deviceId),\n );\n if (lease.leaseId !== current.leaseId)\n throw Object.assign(new Error('Egress renewal returned a different lease'), {\n invalidEgressLease: true,\n code: 'configuration',\n });\n if (lease.workspaceId !== options.workspaceId)\n throw Object.assign(new Error('Egress renewal belongs to a different workspace'), {\n invalidEgressLease: true,\n code: 'configuration',\n });\n await execute({ action: 'renew', lease });\n current = lease;\n nextRenewAttempt = performance.now() + 30_000;\n } catch (cause) {\n const status = cause instanceof Error ? deviceApiStatusOf(cause) : null;\n reportFailure('renew', cause);\n if (z.object({ invalidEgressLease: z.literal(true) }).safeParse(cause).success) {\n requiresChoice = true;\n const leaseId = current.leaseId;\n try {\n await release({ userId, leaseId, nextOwner: userId });\n } catch (cleanup) {\n throw new AggregateError([cause, cleanup], 'Invalid egress lease and cleanup failed');\n }\n throw cause;\n }\n if (deviceApiCodeOf(cause) === DeviceApiClientErrorCode.EgressEnrollmentLost) {\n const leaseId = current.leaseId;\n recovered = false;\n try {\n await release({ userId, leaseId, nextOwner: userId });\n } catch (cleanup) {\n throw new AggregateError([cause, cleanup], 'Egress renewal and cleanup failed');\n }\n current = null;\n nextRecoveryProbeAt = performance.now() + 5_000;\n throw cause;\n }\n if (status === 401 || status === 403 || status === 404 || status === 410) {\n if (status === 404) {\n const profile = await profileFor(userId).catch((lookup) => {\n nextRenewAttempt = performance.now() + 30_000;\n reportFailure('renew-profile', lookup);\n throw new AggregateError([cause, lookup], 'Egress renewal and profile lookup failed');\n });\n if (\n !profile.lockedByOtherOwner &&\n profile.configured === true &&\n !profile.enabled &&\n profile.networkPolicy != null\n ) {\n const latest = await execute({ action: 'status' });\n if (\n latest.mode === 'direct' &&\n latest.choicePending !== true &&\n latest.ownerUserId === userId\n ) {\n current = null;\n createdLease = null;\n recovered = false;\n requiresChoice = false;\n await recover(userId, background);\n return;\n }\n }\n if (\n !profile.lockedByOtherOwner &&\n profile.enabled &&\n profile.lease != null &&\n profile.lease.leaseId !== current.leaseId\n ) {\n current = null;\n recovered = false;\n await recover(userId, background);\n return;\n }\n }\n requiresChoice = true;\n try {\n await release({ userId, leaseId: current.leaseId, nextOwner: userId });\n } catch (cleanup) {\n throw new AggregateError([cause, cleanup], 'Egress renewal and cleanup failed');\n }\n throw cause;\n }\n nextRenewAttempt = performance.now() + 30_000;\n if (\n current.expiresAtMs > now() &&\n local.leaseId === current.leaseId &&\n (['device', 'reconnecting'].includes(local.mode) || local.controllerAlive === true)\n )\n return;\n throw cause;\n }\n }\n };\n const schedule = () => {\n if (closed) return;\n timer = setTimeout(() => {\n void serialized(() => maintain(true))\n .catch((cause) => reportFailure('maintenance', cause))\n .finally(schedule);\n }, 60_000);\n if (typeof timer === 'object' && 'unref' in timer) timer.unref();\n };\n const close = (stopWorkspace = false, onlyCurrent = false): Promise<void> =>\n serialized(async () => {\n if (stopped || (closed && !stopWorkspace)) return;\n if (onlyCurrent && (current == null || current.leaseId !== createdLease?.leaseId)) {\n closed = true;\n if (timer != null) clearTimeout(timer);\n timer = null;\n const created = createdLease;\n const results = await Promise.allSettled([\n (async () => {\n if (created == null) return;\n await revokeLease({\n caller: callerFor(created.userId),\n leaseId: created.leaseId,\n workspaceId: options.workspaceId,\n });\n createdLease = null;\n })(),\n (async () => {\n if (pendingUnlock == null) return;\n await execute({ action: 'unlock', configurationToken: pendingUnlock });\n pendingUnlock = null;\n })(),\n ]);\n notifyClosed();\n const failures = results.flatMap((result) =>\n result.status === 'rejected' ? [result.reason] : [],\n );\n if (failures.length > 0) throw new AggregateError(failures, 'Owned egress cleanup failed');\n return;\n }\n closed = true;\n if (timer != null) clearTimeout(timer);\n if (!stopWorkspace) {\n try {\n if (pendingUnlock != null) {\n await execute({ action: 'unlock', configurationToken: pendingUnlock });\n pendingUnlock = null;\n }\n } finally {\n notifyClosed();\n }\n return;\n }\n timer = null;\n try {\n const failures: unknown[] = [];\n let userId: string | null = onlyCurrent ? (createdLease?.userId ?? owner ?? null) : null;\n if (!onlyCurrent) {\n try {\n userId = await options.actingUser.current();\n } catch (cause) {\n failures.push(cause);\n }\n }\n let leaseId = current?.leaseId ?? null;\n let needsBlock = current != null || requiresChoice;\n let namespaceExists = true;\n try {\n namespaceExists = (await options.namespaceExists?.()) ?? true;\n } catch (cause) {\n failures.push(cause);\n }\n if (!namespaceExists) {\n try {\n if (!onlyCurrent)\n await client.egress.suspend({\n caller: callerFor(userId),\n workspaceId: options.workspaceId,\n });\n else if (userId != null && leaseId != null)\n await revokeLease({\n caller: callerFor(userId),\n leaseId,\n workspaceId: options.workspaceId,\n });\n } catch (cause) {\n failures.push(cause);\n }\n if (failures.length > 0)\n throw new AggregateError(failures, 'Workspace egress close or revocation failed');\n stopped = true;\n return;\n }\n if (pendingUnlock != null) {\n try {\n await execute({ action: 'unlock', configurationToken: pendingUnlock });\n pendingUnlock = null;\n } catch (cause) {\n failures.push(cause);\n }\n }\n if (!onlyCurrent && leaseId == null && userId != null) {\n try {\n leaseId =\n (\n await client.egress.workspace({\n caller: callerFor(userId),\n workspaceId: options.workspaceId,\n })\n ).lease?.leaseId ?? null;\n } catch (cause) {\n failures.push(cause);\n }\n }\n if (leaseId == null) {\n try {\n needsBlock ||= (await execute({ action: 'status' })).mode !== 'direct';\n } catch (cause) {\n failures.push(cause);\n needsBlock = true;\n }\n }\n if (leaseId != null || needsBlock) {\n try {\n await release({ userId, leaseId, nextOwner: userId, suspendWorkspace: !onlyCurrent });\n } catch (cause) {\n failures.push(cause);\n }\n } else if (!onlyCurrent) {\n try {\n await client.egress.suspend({\n caller: callerFor(userId),\n workspaceId: options.workspaceId,\n });\n } catch (cause) {\n failures.push(cause);\n }\n }\n if (failures.length > 0)\n throw new AggregateError(failures, 'Workspace egress close or revocation failed');\n stopped = true;\n } finally {\n notifyClosed();\n }\n });\n\n return {\n initialize: () =>\n serialized(async () => {\n initializing = true;\n try {\n await maintain();\n } catch (cause) {\n reportFailure('initialize', cause);\n /* Management remains available while execution is blocked. */\n } finally {\n initializing = false;\n }\n if (timer == null) schedule();\n }),\n guard: (args?: { background?: boolean }) =>\n serialized(async () => {\n await maintain(args?.background ?? false);\n if (requiresChoice)\n throw new Error('Explicitly configure or disable workspace egress before running tools');\n }),\n setNetworkPolicy: (\n policy: NetworkPolicyIface,\n apply: (policy: NetworkPolicyIface) => Promise<void>,\n ) =>\n serialized(async () => {\n if (closed) throw new Error('Workspace egress manager is closed');\n nextRecoveryProbeAt = 0;\n const userId = await options.actingUser.current();\n await withConfigurationClaim(async () => {\n const local = await execute({ action: 'status' });\n const deviceChoicePending = local.choicePending ?? local.mode === 'blocked';\n const validated = workspaceNetworkPolicySchema.parse(policy);\n const state = await client.egress.networkState({\n organizationId: options.organizationId,\n credentials: options.credentials,\n workspaceId: options.workspaceId,\n });\n if (current != null || state.enabled || deviceChoicePending)\n throw new Error(\n 'Disable Device egress before changing the saved direct-access network policy',\n );\n if (requiresChoice)\n await execute({ action: 'block', ownerUserId: userId, restoreDirect: true });\n try {\n await client.egress.setNetworkPolicy({\n caller: callerFor(userId),\n workspaceId: options.workspaceId,\n policy: validated,\n });\n directPolicy = validated;\n directPolicyKnown = true;\n await apply(validated);\n await reportLogicalPolicy();\n await execute({ action: 'disable', ownerUserId: userId });\n await waitReady(null, 'direct');\n requiresChoice = false;\n recovered = true;\n owner = userId;\n } catch (cause) {\n requiresChoice = true;\n try {\n await release({ userId, leaseId: null, nextOwner: userId, restoreDirect: true });\n } catch (cleanup) {\n throw new AggregateError(\n [cause, cleanup],\n 'Network policy update and egress cleanup failed',\n );\n }\n throw cause;\n }\n });\n }),\n egress: (request: WorkspaceEgressRequestIface): Promise<WorkspaceEgressStatusIface> =>\n serialized(async () => {\n if (closed) throw new Error('Workspace egress manager is closed');\n const parsed = workspaceEgressRequestSchema.parse(request);\n const userId = await options.actingUser.current();\n if (parsed.action === WorkspaceEgressAction.Status) {\n const local = await execute({ action: 'status' });\n return workspaceEgressStatusSchema.parse(local);\n }\n if (userId == null) throw new Error('Changing Device egress requires an acting user');\n if (parsed.action === WorkspaceEgressAction.Configure) {\n if (options.allowConfiguration === false)\n throw new Error(\n 'New workspace egress configuration is disabled; existing settings can be inspected or disabled',\n );\n if (parsed.deviceIds == null) throw new Error('Configure requires Device IDs');\n await authorizeRouteMutation(userId, await execute({ action: 'status' }));\n owner = userId;\n requiresChoice = false;\n nextRecoveryAttempt = 0;\n nextRecoveryProbeAt = 0;\n try {\n return workspaceEgressStatusSchema.parse(\n await configure(userId, parsed.deviceIds, parsed.dnsResolvers),\n );\n } catch (cause) {\n requiresChoice = true;\n reportFailure('configure', cause);\n throw cause;\n }\n }\n await authorizeRouteMutation(userId, await execute({ action: 'status' }));\n owner = userId;\n requiresChoice = false;\n nextRecoveryAttempt = 0;\n nextRecoveryProbeAt = 0;\n try {\n return await withConfigurationClaim(async () => {\n const local = await execute({ action: 'status' });\n await authorizeRouteMutation(userId, local);\n await verifyConfigurationClaim();\n if (local.mode !== 'direct') {\n try {\n await block(userId);\n } catch (cause) {\n // The controller can confirm emergency denial even when the full guard fails.\n await verifyConfigurationClaim();\n const denied = await execute({ action: 'status' });\n if (\n (denied.mode !== 'blocked' &&\n !(denied.mode === 'error' && denied.networkPristine === true)) ||\n denied.ownerUserId !== userId\n )\n throw cause;\n }\n }\n await verifyConfigurationClaim();\n await client.egress.disable({\n caller: callerFor(userId),\n workspaceId: options.workspaceId,\n });\n createdLease = null;\n const profile = await client.egress.workspace({\n caller: callerFor(userId),\n workspaceId: options.workspaceId,\n });\n await verifyConfigurationClaim();\n repairProviderPolicy = true;\n if (profile.networkPolicy != null) {\n directPolicy = workspaceNetworkPolicySchema.parse(profile.networkPolicy);\n directPolicyKnown = true;\n }\n await restoreNetwork(profile.networkPolicy);\n await verifyConfigurationClaim();\n repairProviderPolicy = false;\n await execute({ action: 'disable', ownerUserId: userId });\n const result = workspaceEgressStatusSchema.parse(await waitReady(null, 'direct'));\n current = null;\n recovered = true;\n return result;\n });\n } catch (cause) {\n requiresChoice = true;\n throw cause;\n }\n }),\n close: (stopWorkspace = false) => close(stopWorkspace),\n closeOnFailure: () => close(true, true),\n };\n};\n\n// Persist the provider's policy before any boot fence, including passive first attachments.\nexport const preserveWorkspaceNetworkPolicy = async (options: {\n api: DeviceApiConfigIface | (() => DeviceApiConfigIface);\n organizationId: string;\n credentials?: DeviceApiCredentialsIface;\n workspaceId: string;\n policy: NetworkPolicyIface;\n client?: Pick<DeviceApiClientIface, 'egress'>;\n}): Promise<void> => {\n deviceEgressWorkspaceIdSchema.parse(options.workspaceId);\n const api = typeof options.api === 'function' ? options.api() : options.api;\n await (options.client ?? createDeviceApiClient({ api })).egress.setNetworkPolicy({\n caller: {\n organizationId: options.organizationId,\n credentials: options.credentials,\n actingUser: { current: async () => null },\n },\n workspaceId: options.workspaceId,\n policy: options.policy,\n initializeIfMissing: true,\n });\n};\n\nexport type WorkspaceEgressManagerIface = ReturnType<typeof createWorkspaceEgressManager>;\n\nconst workspaceEgressController = (\n manager: WorkspaceEgressManagerIface,\n): SandboxNetworkingControllerIface => ({\n initialize: manager.initialize,\n guard: async (context) => {\n // The policy operation authorizes and repairs networking without requiring a usable tunnel.\n if (\n context == null ||\n ![SandboxExecutionOperation.SetNetworkPolicy, SandboxExecutionOperation.Egress].includes(\n context.operation,\n )\n )\n await manager.guard(context);\n },\n close: manager.close,\n closeOnFailure: manager.closeOnFailure,\n extendSandbox: (sandbox) => {\n const overrides: Partial<NetworkSandboxSessionIface> = { egress: manager.egress };\n if (sandbox.screen != null) {\n const screen = sandbox.screen.bind(sandbox);\n overrides.screen = async (args) => {\n if (args?.viewOnly === false)\n throw new Error(\n 'Managed workspace screen grants are view-only; use the guarded computer-use channel for input',\n );\n return screen({ ...args, viewOnly: true });\n };\n }\n if (sandbox.setNetworkPolicy != null) {\n const apply = sandbox.setNetworkPolicy.bind(sandbox);\n overrides.setNetworkPolicy = (policy) => manager.setNetworkPolicy(policy, apply);\n }\n return withSandboxOverrides(sandbox, overrides);\n },\n authorizeExternalAccess: async () => {\n await manager.guard();\n const status = await manager.egress({ action: WorkspaceEgressAction.Status });\n return { expiresAtMs: status.expiresAtMs == null ? null : status.expiresAtMs - 90_000 };\n },\n});\n\nexport interface WorkspaceDeviceNetworkingOptionsIface {\n api: WorkspaceEgressManagerOptionsIface['api'];\n // Device API access, for the sandbox's project.\n access?: DeviceAccessIface;\n mcpFetch?: typeof globalThis.fetch;\n needed: (args: {\n organizationId: string;\n projectId: string;\n workspaceId: string;\n teardown?: boolean;\n }) => Promise<boolean>;\n allowConfiguration?: boolean;\n authorizeOwnerChange?: (args: {\n organizationId: string;\n workspaceId: string;\n actingUserId: string | null;\n }) => Promise<void>;\n}\n\n// Only a grant that runs commands and writes files may reconfigure egress or\n// take the workspace over from another owner.\nconst grantConfigures = (grant: SandboxGrantIface): boolean =>\n grantAllows(grant, Capability.Shell, ShellAccess.Execute) &&\n grantAllows(grant, Capability.Files, FilesAccess.Write);\n\n// Final Device is one opinionated implementation of the public networking extension contract.\nexport const createWorkspaceDeviceNetworking = (\n options: WorkspaceDeviceNetworkingOptionsIface,\n): SandboxNetworkingExtensionIface => {\n const credentialsOf = (ctx: { organizationId: string; projectId: string }) =>\n deviceCredentialsFor(options.access, {\n organizationId: ctx.organizationId,\n projectId: ctx.projectId,\n });\n return {\n capabilities: [SandboxCapability.Egress],\n fetch: options.mcpFetch,\n validateWorkspaceId: (workspaceId) => {\n deviceEgressWorkspaceIdSchema.parse(workspaceId);\n },\n enabled: ({ ctx, workspaceId, teardown }) =>\n options.needed({\n organizationId: ctx.organizationId,\n projectId: ctx.projectId,\n workspaceId,\n teardown,\n }),\n prepare: async ({ ctx, workspaceId, policy }) => {\n const client = createDeviceApiClient({ api: options.api });\n const credentials = credentialsOf(ctx);\n await preserveWorkspaceNetworkPolicy({\n client,\n api: options.api,\n organizationId: ctx.organizationId,\n credentials,\n workspaceId,\n policy,\n });\n try {\n const saved = await client.egress.networkState({\n organizationId: ctx.organizationId,\n credentials,\n workspaceId,\n });\n return workspaceNetworkPolicySchema.parse(saved.networkPolicy);\n } catch {\n // The initialized ledger remains authoritative; admission restores reporting after recovery.\n return { mode: WorkspaceNetworkPolicy.DenyAll, allow: [] };\n }\n },\n suspend: ({ ctx, workspaceId }) =>\n suspendWorkspaceEgress({\n api: options.api,\n organizationId: ctx.organizationId,\n credentials: credentialsOf(ctx),\n workspaceId,\n actingUser: ctx.actingUser,\n }),\n controller: (args) =>\n workspaceEgressController(\n createWorkspaceEgressManager({\n sandbox: args.sandbox,\n workspaceId: args.workspaceId,\n organizationId: args.ctx.organizationId,\n credentials: credentialsOf(args.ctx),\n actingUser: args.ctx.actingUser,\n api: options.api,\n initialNetworkPolicy: args.initialNetworkPolicy,\n onNetworkPolicy: args.ctx.platformNetworkPolicy,\n privilegedRun: args.privilegedRun,\n afterGuard: args.afterGuard,\n afterBlock: args.afterBlock,\n namespaceExists: args.namespaceExists,\n onClose: args.onClose,\n allowConfiguration: grantConfigures(args.grant) && options.allowConfiguration !== false,\n allowOwnerChange: args.allowOwnerChange ?? grantConfigures(args.grant),\n authorizeOwnerChange: (actingUserId) =>\n options.authorizeOwnerChange?.({\n organizationId: args.ctx.organizationId,\n workspaceId: args.workspaceId,\n actingUserId,\n }) ?? Promise.resolve(),\n onFailure: (event) => args.log?.('workspace_egress.control_failure', { ...event }),\n }),\n ),\n };\n};\n\nexport const withWorkspaceEgress = <S extends NetworkSandboxSessionIface>(options: {\n handle: SandboxProviderHandleIface<S>;\n manager: WorkspaceEgressManagerIface;\n grant: SandboxGrantIface;\n beforeUse?: () => Promise<void>;\n initialized?: boolean;\n fetch?: typeof globalThis.fetch;\n}): Promise<SandboxProviderHandleIface<S>> =>\n withSandboxNetworking({\n ...options,\n controller: workspaceEgressController(options.manager),\n });\n\nexport const withWorkspaceAdmission = <S extends NetworkSandboxSessionIface>(options: {\n handle: SandboxProviderHandleIface<S>;\n grant: SandboxGrantIface;\n admission: () => Promise<void>;\n fetch?: typeof globalThis.fetch;\n}): Promise<SandboxProviderHandleIface<S>> => withSandboxNetworking(options);\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,OAAO;AACnB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAIA;AAAA,EACA;AAAA,OACK;AACP,SAAS,YAAY,aAAa,mBAAmB;AAErD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAQP;AAAA,EACE;AAAA,OAGK;AACP;AAAA,EACE;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,E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