@opengeni/worker-bundle 6.7.0 → 6.8.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/dist/activities/agent-turn/secret-values.d.ts +15 -0
- package/dist/{activities-control-LJVIL5FP.js → activities-control-6HEEWPLL.js} +5 -5
- package/dist/{activities-turn-GTZPMF6T.js → activities-turn-E6VP3XVJ.js} +34 -19
- package/dist/activities-turn-E6VP3XVJ.js.map +1 -0
- package/dist/{chunk-W2IHRF7L.js → chunk-UQAMEFZB.js} +15 -1
- package/dist/chunk-UQAMEFZB.js.map +1 -0
- package/dist/{chunk-C5RYXGXF.js → chunk-WLNVZWDL.js} +3 -3
- package/dist/{chunk-XTG32O4Q.js → chunk-YJDTWP6V.js} +41 -11
- package/dist/chunk-YJDTWP6V.js.map +1 -0
- package/dist/{chunk-Q4KXCK36.js → chunk-ZEGN4DC4.js} +3 -3
- package/dist/index.js +3 -3
- package/dist/{sandbox-lease-ILEZ6RVI.js → sandbox-lease-SWS4WQWO.js} +4 -4
- package/dist/sandbox-routing.d.ts +8 -10
- package/package.json +28 -28
- package/src/activities/agent-turn/sandbox-establish.ts +4 -10
- package/src/activities/agent-turn/secret-values.ts +40 -7
- package/src/observability-metrics.ts +14 -0
- package/src/sandbox-routing.ts +61 -20
- package/dist/activities-turn-GTZPMF6T.js.map +0 -1
- package/dist/chunk-W2IHRF7L.js.map +0 -1
- package/dist/chunk-XTG32O4Q.js.map +0 -1
- /package/dist/{activities-control-LJVIL5FP.js.map → activities-control-6HEEWPLL.js.map} +0 -0
- /package/dist/{chunk-C5RYXGXF.js.map → chunk-WLNVZWDL.js.map} +0 -0
- /package/dist/{chunk-Q4KXCK36.js.map → chunk-ZEGN4DC4.js.map} +0 -0
- /package/dist/{sandbox-lease-ILEZ6RVI.js.map → sandbox-lease-SWS4WQWO.js.map} +0 -0
|
@@ -1731,7 +1731,10 @@ import {
|
|
|
1731
1731
|
markWarmLeaseInstanceLost as markWarmLeaseInstanceLost2,
|
|
1732
1732
|
readLease as readLease2,
|
|
1733
1733
|
readActiveSandbox,
|
|
1734
|
+
nestedPostgresMessage,
|
|
1735
|
+
nestedPostgresSqlState,
|
|
1734
1736
|
resolvePersonalMachineConnectionForAttempt,
|
|
1737
|
+
safeDatabaseErrorFacts,
|
|
1735
1738
|
SandboxRetainedProcessPromotionFencedError,
|
|
1736
1739
|
SandboxRetainedProcessTerminalError,
|
|
1737
1740
|
SandboxWorkspaceMutationOutputRejectedError
|
|
@@ -2292,7 +2295,7 @@ function wrapTurnBoxWithRouting(services, ids, established) {
|
|
|
2292
2295
|
controlRpcFactory: controlRpcFactory(bus),
|
|
2293
2296
|
resolveSelfhostedConnection: async (sandbox) => {
|
|
2294
2297
|
if (!sandbox.enrollmentId) return null;
|
|
2295
|
-
const enrollment = await resolveRoutedMachineConnection(
|
|
2298
|
+
const enrollment = await resolveRoutedMachineConnection(services, ids, sandbox);
|
|
2296
2299
|
return connectionBindingFor(services, enrollment);
|
|
2297
2300
|
},
|
|
2298
2301
|
relay: relayConfigFromSettings(settings),
|
|
@@ -2378,11 +2381,14 @@ function wrapTurnBoxWithRouting(services, ids, established) {
|
|
|
2378
2381
|
// session points at a sibling modal box the turn cannot resume here) and the
|
|
2379
2382
|
// op surfaces unresolvable — never a silent wrong-box landing.
|
|
2380
2383
|
//
|
|
2381
|
-
//
|
|
2382
|
-
//
|
|
2383
|
-
//
|
|
2384
|
-
//
|
|
2385
|
-
|
|
2384
|
+
// A pinned machine is never this turn's home. A null pointer means the chat's
|
|
2385
|
+
// own managed box, for machine-home chats too: turn start never resolves null to
|
|
2386
|
+
// a machine. So a mid-turn move home must not keep dispatching to the pinned
|
|
2387
|
+
// machine (whose per-operation authority now refuses it, because the machine is
|
|
2388
|
+
// no longer the active sandbox). The null branch throws the typed
|
|
2389
|
+
// `home_unavailable_this_turn` transition, and failure settlement continues the
|
|
2390
|
+
// same logical turn on the home box in a fresh attempt.
|
|
2391
|
+
...ids.pinnedSelfhosted ? { defaultIsHome: false } : {},
|
|
2386
2392
|
...ids.homeLease ? {
|
|
2387
2393
|
resolveDefaultBackend: () => resolveCurrentHomeBackend(
|
|
2388
2394
|
services,
|
|
@@ -2558,7 +2564,7 @@ function wrapLazyTurnBoxWithRouting(services, ids, args) {
|
|
|
2558
2564
|
controlRpcFactory: controlRpcFactory(bus),
|
|
2559
2565
|
resolveSelfhostedConnection: async (sandbox) => {
|
|
2560
2566
|
if (!sandbox.enrollmentId) return null;
|
|
2561
|
-
const enrollment = await resolveRoutedMachineConnection(
|
|
2567
|
+
const enrollment = await resolveRoutedMachineConnection(services, ids, sandbox);
|
|
2562
2568
|
return connectionBindingFor(services, enrollment);
|
|
2563
2569
|
},
|
|
2564
2570
|
relay: relayConfigFromSettings(settings),
|
|
@@ -2777,14 +2783,38 @@ function connectionBindingFor(services, enrollment) {
|
|
|
2777
2783
|
runAsSupported: enrollment.agentCapabilities.runAs === true
|
|
2778
2784
|
};
|
|
2779
2785
|
}
|
|
2780
|
-
|
|
2786
|
+
function machineAuthorityFailureLog(error) {
|
|
2787
|
+
const sqlState = nestedPostgresSqlState(error);
|
|
2788
|
+
const reason = nestedPostgresMessage(error);
|
|
2789
|
+
const functions = safeDatabaseErrorFacts(error).plpgsql?.join(",");
|
|
2790
|
+
return `Connected Machine authority check failed: sqlState=${sqlState ?? "none"}` + (reason ? ` reason=${reason}` : "") + (functions ? ` functions=${functions}` : "") + (sqlState ? "" : ` error=${error instanceof Error ? error.name : typeof error}`);
|
|
2791
|
+
}
|
|
2792
|
+
async function resolvePersonalMachineConnectionWithDiagnostics(services, input) {
|
|
2793
|
+
try {
|
|
2794
|
+
return await resolvePersonalMachineConnectionForAttempt(services.db, input);
|
|
2795
|
+
} catch (error) {
|
|
2796
|
+
try {
|
|
2797
|
+
services.observability?.warn(machineAuthorityFailureLog(error), {
|
|
2798
|
+
workspaceId: input.workspaceId,
|
|
2799
|
+
sessionId: input.sessionId,
|
|
2800
|
+
turnId: input.turnId,
|
|
2801
|
+
attemptId: input.attemptId,
|
|
2802
|
+
enrollmentId: input.enrollmentId
|
|
2803
|
+
});
|
|
2804
|
+
} catch {
|
|
2805
|
+
}
|
|
2806
|
+
throw error;
|
|
2807
|
+
}
|
|
2808
|
+
}
|
|
2809
|
+
async function resolveRoutedMachineConnection(services, ids, sandbox) {
|
|
2810
|
+
const { db } = services;
|
|
2781
2811
|
if (!sandbox.enrollmentId) return null;
|
|
2782
2812
|
const current = await getLiveEnrollmentConnection(db, sandbox.workspaceId, sandbox.enrollmentId);
|
|
2783
2813
|
if (!current) return null;
|
|
2784
2814
|
if (current.scope === "user") {
|
|
2785
2815
|
const authority = ids.personalMachineAttempt;
|
|
2786
2816
|
if (!authority) return null;
|
|
2787
|
-
return await
|
|
2817
|
+
return await resolvePersonalMachineConnectionWithDiagnostics(services, {
|
|
2788
2818
|
accountId: authority.accountId,
|
|
2789
2819
|
workspaceId: ids.workspaceId,
|
|
2790
2820
|
subjectId: authority.subjectId,
|
|
@@ -2839,7 +2869,7 @@ async function establishSelfhostedTurnSession(services, args) {
|
|
|
2839
2869
|
args.controlWorkspaceId ?? args.workspaceId,
|
|
2840
2870
|
args.agentId
|
|
2841
2871
|
);
|
|
2842
|
-
const enrollment = current?.scope !== "user" ? current : args.personalMachineAttempt ? await
|
|
2872
|
+
const enrollment = current?.scope !== "user" ? current : args.personalMachineAttempt ? await resolvePersonalMachineConnectionWithDiagnostics(services, {
|
|
2843
2873
|
accountId: args.personalMachineAttempt.accountId,
|
|
2844
2874
|
workspaceId: args.workspaceId,
|
|
2845
2875
|
subjectId: args.personalMachineAttempt.subjectId,
|
|
@@ -2913,4 +2943,4 @@ export {
|
|
|
2913
2943
|
agentBackgroundCommandDeps2 as agentBackgroundCommandDeps,
|
|
2914
2944
|
captureConnectedCommandOutput2 as captureConnectedCommandOutput
|
|
2915
2945
|
};
|
|
2916
|
-
//# sourceMappingURL=chunk-
|
|
2946
|
+
//# sourceMappingURL=chunk-YJDTWP6V.js.map
|