@opengeni/worker-bundle 6.5.2-canary.41607687019001 → 6.7.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/prompt-tool-availability.d.ts +12 -1
- package/dist/activities/agent-turn/provider-dispatch-barrier.d.ts +11 -0
- package/dist/activities/agent-turn/sandbox-runtime.d.ts +21 -2
- package/dist/activities/agent-turn/sandbox-setup-agent-failure.d.ts +39 -0
- package/dist/activities/agent-turn/stream-attempt.d.ts +2 -1
- package/dist/activities/agent-turn/tool-environment.d.ts +3 -1
- package/dist/activities/agent-turn/turn-context.d.ts +11 -0
- package/dist/{activities-control-SZIXMQR2.js → activities-control-LJVIL5FP.js} +4 -4
- package/dist/{activities-turn-KAFMA5CX.js → activities-turn-GTZPMF6T.js} +178 -72
- package/dist/activities-turn-GTZPMF6T.js.map +1 -0
- package/dist/artifact-materializer-entry.js +0 -0
- package/dist/artifact-outbox-entry.js +0 -0
- package/dist/{chunk-6AMYPT2B.js → chunk-C5RYXGXF.js} +2 -2
- package/dist/{chunk-ESC7J52Z.js → chunk-Q4KXCK36.js} +104 -2
- package/dist/chunk-Q4KXCK36.js.map +1 -0
- package/dist/{chunk-LQ352XGC.js → chunk-W2IHRF7L.js} +8 -1
- package/dist/chunk-W2IHRF7L.js.map +1 -0
- package/dist/github-rest-mcp.d.ts +13 -1
- package/dist/index.js +3 -3
- package/dist/{sandbox-lease-GIEUWXRI.js → sandbox-lease-ILEZ6RVI.js} +3 -3
- package/dist/workflow-bundle.js +1 -1
- package/package.json +29 -30
- package/src/activities/agent-turn/agent-build.ts +38 -0
- package/src/activities/agent-turn/errors.ts +28 -0
- package/src/activities/agent-turn/finalization.ts +4 -0
- package/src/activities/agent-turn/owned-sandbox-setup.ts +29 -19
- package/src/activities/agent-turn/prompt-tool-availability.ts +50 -2
- package/src/activities/agent-turn/provider-dispatch-barrier.ts +19 -0
- package/src/activities/agent-turn/run.ts +3 -4
- package/src/activities/agent-turn/sandbox-establish.ts +30 -18
- package/src/activities/agent-turn/sandbox-runtime.ts +51 -4
- package/src/activities/agent-turn/sandbox-setup-agent-failure.ts +110 -0
- package/src/activities/agent-turn/skill-selection.ts +2 -1
- package/src/activities/agent-turn/stream-attempt.ts +15 -1
- package/src/activities/agent-turn/tool-environment.ts +6 -0
- package/src/activities/agent-turn/turn-context.ts +13 -0
- package/src/github-rest-mcp.ts +61 -6
- package/src/observability-metrics.ts +7 -0
- package/dist/activities-turn-KAFMA5CX.js.map +0 -1
- package/dist/chunk-ESC7J52Z.js.map +0 -1
- package/dist/chunk-LQ352XGC.js.map +0 -1
- /package/dist/{activities-control-SZIXMQR2.js.map → activities-control-LJVIL5FP.js.map} +0 -0
- /package/dist/{chunk-6AMYPT2B.js.map → chunk-C5RYXGXF.js.map} +0 -0
- /package/dist/{sandbox-lease-GIEUWXRI.js.map → sandbox-lease-ILEZ6RVI.js.map} +0 -0
|
File without changes
|
|
File without changes
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
recordVerifiedSignupTrialDeploymentFlagGauge,
|
|
48
48
|
recordVerifiedSignupTrialSwitchGauge,
|
|
49
49
|
runtimeMetricsHooksForObservability
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-W2IHRF7L.js";
|
|
51
51
|
import {
|
|
52
52
|
reconcilePendingParentSystemUpdates
|
|
53
53
|
} from "./chunk-C67MOSPJ.js";
|
|
@@ -4165,4 +4165,4 @@ export {
|
|
|
4165
4165
|
sandboxLeaseTelemetryKey2 as sandboxLeaseTelemetryKey,
|
|
4166
4166
|
replayConnectedCommandOutput2 as replayConnectedCommandOutput
|
|
4167
4167
|
};
|
|
4168
|
-
//# sourceMappingURL=chunk-
|
|
4168
|
+
//# sourceMappingURL=chunk-C5RYXGXF.js.map
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "./chunk-XTG32O4Q.js";
|
|
9
9
|
import {
|
|
10
10
|
observabilityEventBusOptions
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-W2IHRF7L.js";
|
|
12
12
|
|
|
13
13
|
// src/activity-services.ts
|
|
14
14
|
import {
|
|
@@ -1984,6 +1984,24 @@ function readProviderRecoveryStartedAt(metadata) {
|
|
|
1984
1984
|
return effectiveProviderRecoveryStartedAt(metadata);
|
|
1985
1985
|
}
|
|
1986
1986
|
|
|
1987
|
+
// src/activities/agent-turn/turn-sandbox-access.ts
|
|
1988
|
+
function ownedTurnSandboxForAgent(sandboxState) {
|
|
1989
|
+
return sandboxState.lazyOwnedSandbox ?? sandboxState.resolvedSandbox?.established;
|
|
1990
|
+
}
|
|
1991
|
+
async function resolveTurnSandboxAccess(sandboxState, sdkOwnedSandboxSession, unavailableMessage) {
|
|
1992
|
+
let sandbox = sandboxState.resolvedSandbox;
|
|
1993
|
+
if (!sandbox && sandboxState.turnSandboxProvisioner) {
|
|
1994
|
+
sandbox = await sandboxState.turnSandboxProvisioner.get();
|
|
1995
|
+
}
|
|
1996
|
+
const session = ownedTurnSandboxForAgent(sandboxState)?.session ?? sandbox?.established.session ?? sdkOwnedSandboxSession;
|
|
1997
|
+
if (!session) throw new Error(unavailableMessage);
|
|
1998
|
+
return {
|
|
1999
|
+
sandbox,
|
|
2000
|
+
session,
|
|
2001
|
+
leaseEpoch: sandbox?.leaseEpoch ?? 0
|
|
2002
|
+
};
|
|
2003
|
+
}
|
|
2004
|
+
|
|
1987
2005
|
// src/activities/agent-turn/provider-dispatch-barrier.ts
|
|
1988
2006
|
var SandboxCapabilitiesChangedError = class extends Error {
|
|
1989
2007
|
code = "native_capabilities_changed_this_attempt";
|
|
@@ -1992,6 +2010,9 @@ var SandboxCapabilitiesChangedError = class extends Error {
|
|
|
1992
2010
|
this.name = "SandboxCapabilitiesChangedError";
|
|
1993
2011
|
}
|
|
1994
2012
|
};
|
|
2013
|
+
function activeRouteSessionForBoundary(sandboxState) {
|
|
2014
|
+
return ownedTurnSandboxForAgent(sandboxState)?.session;
|
|
2015
|
+
}
|
|
1995
2016
|
var ActiveRouteDispatchBoundary = class {
|
|
1996
2017
|
constructor(deps) {
|
|
1997
2018
|
this.deps = deps;
|
|
@@ -2855,6 +2876,66 @@ var TransactionRollbackError = class extends DrizzleError {
|
|
|
2855
2876
|
}
|
|
2856
2877
|
};
|
|
2857
2878
|
|
|
2879
|
+
// src/activities/agent-turn/sandbox-setup-agent-failure.ts
|
|
2880
|
+
import { SelfhostedControlError } from "@opengeni/runtime";
|
|
2881
|
+
var SandboxSetupAgentUnavailableError = class extends Error {
|
|
2882
|
+
name = "SandboxSetupAgentUnavailableError";
|
|
2883
|
+
constructor(cause) {
|
|
2884
|
+
super(
|
|
2885
|
+
`The sandbox's agent did not answer while the sandbox was being set up: ${cause instanceof Error ? cause.message : String(cause)}`,
|
|
2886
|
+
{ cause }
|
|
2887
|
+
);
|
|
2888
|
+
}
|
|
2889
|
+
};
|
|
2890
|
+
function isAgentLivenessControlError(node) {
|
|
2891
|
+
if (!(node instanceof SelfhostedControlError)) return false;
|
|
2892
|
+
if (node.fenced || node.osNotFound || node.payloadTooLarge) return false;
|
|
2893
|
+
if (node.reason === "consent_required") return false;
|
|
2894
|
+
return node.agentOffline || node.connectionReplaced || node.draining || node.reason === "agent_offline" || node.reason === "agent_reconnecting";
|
|
2895
|
+
}
|
|
2896
|
+
function isSandboxAgentLivenessFailure(error) {
|
|
2897
|
+
const queue = [error];
|
|
2898
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2899
|
+
try {
|
|
2900
|
+
for (let index = 0; index < queue.length && seen.size < 64; index += 1) {
|
|
2901
|
+
const node = queue[index];
|
|
2902
|
+
if (!node || typeof node !== "object" || seen.has(node)) continue;
|
|
2903
|
+
seen.add(node);
|
|
2904
|
+
if (isAgentLivenessControlError(node)) return true;
|
|
2905
|
+
const record = node;
|
|
2906
|
+
queue.push(record.cause, record.error);
|
|
2907
|
+
if (Array.isArray(record.errors)) queue.push(...record.errors.slice(0, 16));
|
|
2908
|
+
}
|
|
2909
|
+
} catch {
|
|
2910
|
+
}
|
|
2911
|
+
return false;
|
|
2912
|
+
}
|
|
2913
|
+
function createSandboxSetupReplayGuard() {
|
|
2914
|
+
let rigScriptUnfinished = false;
|
|
2915
|
+
return {
|
|
2916
|
+
/** Wrap the shared rig setup coordinator so the guard sees its script run. */
|
|
2917
|
+
trackRigSetup(coordinator) {
|
|
2918
|
+
return async (input) => await coordinator({
|
|
2919
|
+
...input,
|
|
2920
|
+
execute: async () => {
|
|
2921
|
+
rigScriptUnfinished = true;
|
|
2922
|
+
await input.execute();
|
|
2923
|
+
rigScriptUnfinished = false;
|
|
2924
|
+
}
|
|
2925
|
+
});
|
|
2926
|
+
},
|
|
2927
|
+
replaySafe() {
|
|
2928
|
+
return !rigScriptUnfinished;
|
|
2929
|
+
}
|
|
2930
|
+
};
|
|
2931
|
+
}
|
|
2932
|
+
function sandboxSetupFailure(guard, error) {
|
|
2933
|
+
if (!(error instanceof SandboxSetupAgentUnavailableError) && guard.replaySafe() && isSandboxAgentLivenessFailure(error)) {
|
|
2934
|
+
return new SandboxSetupAgentUnavailableError(error);
|
|
2935
|
+
}
|
|
2936
|
+
return error;
|
|
2937
|
+
}
|
|
2938
|
+
|
|
2858
2939
|
// src/activities/agent-turn/errors.ts
|
|
2859
2940
|
import {
|
|
2860
2941
|
ActiveSessionHistoryLimitExceededError,
|
|
@@ -4771,6 +4852,20 @@ function uncertainMutationOutcome(graph, nodes) {
|
|
|
4771
4852
|
if (node === void 0) return {};
|
|
4772
4853
|
return { uncertain: node instanceof Error ? node.message : String(node) };
|
|
4773
4854
|
}
|
|
4855
|
+
function sandboxSetupAgentUnavailableFailure(error) {
|
|
4856
|
+
const graph = structuredRecoveryCauseGraph(error);
|
|
4857
|
+
const nodes = graph ? [...graph.keys()] : [error];
|
|
4858
|
+
const setup = nodes.find((node) => node instanceof SandboxSetupAgentUnavailableError);
|
|
4859
|
+
if (!setup) return null;
|
|
4860
|
+
const { uncertain } = uncertainMutationOutcome(graph, nodes);
|
|
4861
|
+
if (uncertain !== void 0) return null;
|
|
4862
|
+
return {
|
|
4863
|
+
error: "The sandbox's agent did not answer while the sandbox was being set up, and nothing the model asked for ran. The same turn will retry after a short delay.",
|
|
4864
|
+
code: "sandbox_command_start_unavailable",
|
|
4865
|
+
retryable: true,
|
|
4866
|
+
detail: setup.message
|
|
4867
|
+
};
|
|
4868
|
+
}
|
|
4774
4869
|
var SANDBOX_FAILURE_SUBJECT = {
|
|
4775
4870
|
[SANDBOX_CAPACITY_UNAVAILABLE_CODE]: "No sandbox capacity is available right now",
|
|
4776
4871
|
[SANDBOX_SERVICE_UNAVAILABLE_CODE]: "The sandbox service is temporarily unavailable",
|
|
@@ -5067,6 +5162,8 @@ function baseAgentRunFailurePayload(error, options = {}) {
|
|
|
5067
5162
|
}
|
|
5068
5163
|
const sandboxService = findSandboxServiceFailure(error);
|
|
5069
5164
|
if (sandboxService) return sandboxServiceFailurePayload(sandboxService);
|
|
5165
|
+
const setupAgentUnavailable = sandboxSetupAgentUnavailableFailure(error);
|
|
5166
|
+
if (setupAgentUnavailable) return setupAgentUnavailable;
|
|
5070
5167
|
if (error instanceof AnthropicSizeRecoveryExhaustedError) {
|
|
5071
5168
|
return { error: error.message, code: error.code, retryable: false };
|
|
5072
5169
|
}
|
|
@@ -5512,8 +5609,13 @@ export {
|
|
|
5512
5609
|
validProviderOverloadRecoveryDelay,
|
|
5513
5610
|
readProviderRecoveryStartedAt,
|
|
5514
5611
|
FIRST_PARTY_MCP_SETUP_UNAVAILABLE_CODE2 as FIRST_PARTY_MCP_SETUP_UNAVAILABLE_CODE,
|
|
5612
|
+
ownedTurnSandboxForAgent,
|
|
5613
|
+
resolveTurnSandboxAccess,
|
|
5614
|
+
activeRouteSessionForBoundary,
|
|
5515
5615
|
ActiveRouteDispatchBoundary,
|
|
5516
5616
|
checkpointHistoryBeforeProviderDispatch,
|
|
5617
|
+
createSandboxSetupReplayGuard,
|
|
5618
|
+
sandboxSetupFailure,
|
|
5517
5619
|
SESSION_USAGE_CUSTODY_PENDING,
|
|
5518
5620
|
SESSION_USAGE_CUSTODY_RECHECK_MS,
|
|
5519
5621
|
sessionUsageCustodyPending,
|
|
@@ -5608,4 +5710,4 @@ export {
|
|
|
5608
5710
|
codexUsageLimitFailurePayload,
|
|
5609
5711
|
classifyClaudeProviderError
|
|
5610
5712
|
};
|
|
5611
|
-
//# sourceMappingURL=chunk-
|
|
5713
|
+
//# sourceMappingURL=chunk-Q4KXCK36.js.map
|