@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AgentPromptToolAvailability } from "@opengeni/runtime";
|
|
2
|
-
import type { FirstPartyMcpToolName, Permission, ResolvedAgentConfig } from "@opengeni/contracts";
|
|
2
|
+
import type { AgentLearningDefaults, FirstPartyMcpToolName, Permission, ResolvedAgentConfig } from "@opengeni/contracts";
|
|
3
3
|
/**
|
|
4
4
|
* The frozen clause-availability view for one attempt's modular instructions.
|
|
5
5
|
* Derived from the same accepted first-party selection and permission ceiling
|
|
@@ -7,6 +7,12 @@ import type { FirstPartyMcpToolName, Permission, ResolvedAgentConfig } from "@op
|
|
|
7
7
|
* so it can only describe tools the executable catalog already excludes. It is
|
|
8
8
|
* a rendering input, never authority.
|
|
9
9
|
*
|
|
10
|
+
* The turn's frozen learning modes are a rendering input too: with a category
|
|
11
|
+
* Off, its authoring clauses are omitted as if those tools were absent. The
|
|
12
|
+
* tools themselves stay in the catalog and still answer with the refusal, so
|
|
13
|
+
* nothing executable changes. Learning settings change rarely, so the prefix
|
|
14
|
+
* stays stable between turns.
|
|
15
|
+
*
|
|
10
16
|
* Sessions without an agent configuration keep the legacy composition, which
|
|
11
17
|
* does not read availability; they receive undefined so nothing changes.
|
|
12
18
|
*/
|
|
@@ -14,4 +20,9 @@ export declare function promptToolAvailabilityForTurn(input: {
|
|
|
14
20
|
agentConfig: ResolvedAgentConfig | null | undefined;
|
|
15
21
|
selectedFirstPartyMcpTools: readonly FirstPartyMcpToolName[];
|
|
16
22
|
firstPartyPermissions: readonly Permission[] | null | undefined;
|
|
23
|
+
/** Frozen on the session; an exhausted depth hides `session_create`. */
|
|
24
|
+
nestedAgentDepth?: number | undefined;
|
|
25
|
+
effectiveMaxNestedAgentDepth?: number | undefined;
|
|
26
|
+
/** The accepted turn's effective learning modes; omitted keeps every clause. */
|
|
27
|
+
learning?: AgentLearningDefaults | undefined;
|
|
17
28
|
}): AgentPromptToolAvailability | undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { TurnHistorySink } from "./history-sink.js";
|
|
2
2
|
import type { Settings } from "@opengeni/config";
|
|
3
|
+
import type { SandboxRuntimeState } from "./turn-context.js";
|
|
3
4
|
export declare class SandboxCapabilitiesChangedError extends Error {
|
|
4
5
|
readonly code = "native_capabilities_changed_this_attempt";
|
|
5
6
|
constructor();
|
|
@@ -8,6 +9,16 @@ type ActiveRoutePointer = {
|
|
|
8
9
|
activeSandboxId: string | null;
|
|
9
10
|
activeEpoch: number;
|
|
10
11
|
};
|
|
12
|
+
type RouteContinuableSession = {
|
|
13
|
+
assertActiveRouteContinuable?: () => Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The routed session the agent's own tools use, which is the one that can tell
|
|
17
|
+
* whether a moved route is still servable. A home box provisioned on demand
|
|
18
|
+
* fills `resolvedSandbox` with the raw provider box, so reading that would see
|
|
19
|
+
* no route at all and never end the attempt after a move.
|
|
20
|
+
*/
|
|
21
|
+
export declare function activeRouteSessionForBoundary(sandboxState: Pick<SandboxRuntimeState, "resolvedSandbox" | "lazyOwnedSandbox" | "turnSandboxProvisioner">): RouteContinuableSession | undefined;
|
|
11
22
|
/**
|
|
12
23
|
* Ends an attempt between tool batches when its route moved somewhere it can
|
|
13
24
|
* no longer serve. A swap to a machine with another workspace root (or back
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type EstablishedSandboxSession } from "@opengeni/runtime";
|
|
1
|
+
import { type EstablishedSandboxSession, type TurnToolCancellationFence } from "@opengeni/runtime";
|
|
2
2
|
import { type Settings } from "@opengeni/config";
|
|
3
3
|
import { currentActivityContext } from "../streaming.js";
|
|
4
4
|
import type { TurnActivityServices as ActivityServices, RunAgentTurnInput } from "../types.js";
|
|
@@ -18,6 +18,24 @@ export type SandboxTurnRuntimeDeps = {
|
|
|
18
18
|
attempt: AttemptIdentityState;
|
|
19
19
|
};
|
|
20
20
|
export type SandboxTurnRuntime = ReturnType<typeof createSandboxTurnRuntime>;
|
|
21
|
+
export type WorkspaceMutationOptions = {
|
|
22
|
+
/** Every write this mutation makes runs as a command through this fence
|
|
23
|
+
* (platform setup passes it as its command runner). Once the attempt's
|
|
24
|
+
* writer drain has cancelled and quiesced this same fence, the mutation can
|
|
25
|
+
* no longer write, so the proof-bearing release may settle its admission
|
|
26
|
+
* even while the mutation itself has not returned yet. */
|
|
27
|
+
commandFence?: TurnToolCancellationFence;
|
|
28
|
+
};
|
|
29
|
+
type PendingWorkspaceMutation = {
|
|
30
|
+
operation: string;
|
|
31
|
+
/** Set once the provider outcome is unknown; such a mutation stays fenced. */
|
|
32
|
+
cause?: unknown;
|
|
33
|
+
commandFence?: TurnToolCancellationFence;
|
|
34
|
+
};
|
|
35
|
+
/** Whether the attempt's writer drain proves that none of these in-flight
|
|
36
|
+
* mutations can still write: each writes only through the exact fence the
|
|
37
|
+
* drain cancelled and quiesced, and none has an unknown provider outcome. */
|
|
38
|
+
export declare function pendingMutationsCoveredByWriterDrain(pending: Iterable<PendingWorkspaceMutation>, drainedCommandFence: TurnToolCancellationFence | null): boolean;
|
|
21
39
|
/**
|
|
22
40
|
* Provider-deadline rotation is a preemption boundary, not a cooperative
|
|
23
41
|
* snapshot boundary. Snapshotting while this attempt still owns active tools
|
|
@@ -45,7 +63,7 @@ export declare function createSandboxTurnRuntime(deps: SandboxTurnRuntimeDeps):
|
|
|
45
63
|
phase: "admission" | "provider" | "settlement" | "snapshot_wait";
|
|
46
64
|
outcome: "completed" | "failed";
|
|
47
65
|
durationSeconds: number;
|
|
48
|
-
}) => void) => Promise<T>;
|
|
66
|
+
}) => void, options?: WorkspaceMutationOptions) => Promise<T>;
|
|
49
67
|
stopLeaseHeartbeat: () => void;
|
|
50
68
|
flushRuntimeBatcher: () => Promise<void>;
|
|
51
69
|
publishSandboxLifecycleEvents: (sandbox: ResumedTurnSandbox) => Promise<void>;
|
|
@@ -54,3 +72,4 @@ export declare function createSandboxTurnRuntime(deps: SandboxTurnRuntimeDeps):
|
|
|
54
72
|
}) => Promise<void>;
|
|
55
73
|
startLeaseHeartbeat: (sandbox: ResumedTurnSandbox, warmBackend: Settings["sandboxBackend"] | undefined) => void;
|
|
56
74
|
};
|
|
75
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform sandbox setup (credential hooks, client readiness, repository
|
|
3
|
+
* clones, file delivery) failed because the sandbox's machine agent was not
|
|
4
|
+
* answering: offline, reconnecting, draining, timed out or replaced. Setup
|
|
5
|
+
* runs before any model-requested command can reach the box, and every hook
|
|
6
|
+
* it ran is idempotent, so the same turn may run it again after a short delay.
|
|
7
|
+
* Only `withSandboxSetupAgentRecovery` creates it.
|
|
8
|
+
*/
|
|
9
|
+
export declare class SandboxSetupAgentUnavailableError extends Error {
|
|
10
|
+
readonly name = "SandboxSetupAgentUnavailableError";
|
|
11
|
+
constructor(cause: unknown);
|
|
12
|
+
}
|
|
13
|
+
/** Whether a machine-agent liveness failure appears anywhere in the error's
|
|
14
|
+
* cause graph (`cause`, the agents SDK's `.error`, AggregateError members). */
|
|
15
|
+
export declare function isSandboxAgentLivenessFailure(error: unknown): boolean;
|
|
16
|
+
type SharedRigSetupCoordinator = (input: {
|
|
17
|
+
specHash: string;
|
|
18
|
+
timeoutMs: number;
|
|
19
|
+
execute: () => Promise<void>;
|
|
20
|
+
}) => Promise<"executed" | "reused">;
|
|
21
|
+
/**
|
|
22
|
+
* Tracks whether one setup run stayed replay safe. Every setup hook is
|
|
23
|
+
* idempotent except the rig setup script, which runs user-defined commands:
|
|
24
|
+
* once it has started without finishing, a liveness failure leaves the setup
|
|
25
|
+
* failed rather than retrying it.
|
|
26
|
+
*/
|
|
27
|
+
export declare function createSandboxSetupReplayGuard(): {
|
|
28
|
+
/** Wrap the shared rig setup coordinator so the guard sees its script run. */
|
|
29
|
+
trackRigSetup(coordinator: SharedRigSetupCoordinator): SharedRigSetupCoordinator;
|
|
30
|
+
replaySafe(): boolean;
|
|
31
|
+
};
|
|
32
|
+
export type SandboxSetupReplayGuard = ReturnType<typeof createSandboxSetupReplayGuard>;
|
|
33
|
+
/**
|
|
34
|
+
* The error a failed platform setup throws: a machine-agent liveness failure
|
|
35
|
+
* becomes the typed setup failure the turn recovers from. Any other failure,
|
|
36
|
+
* and a liveness failure after a non-idempotent step started, stays unchanged.
|
|
37
|
+
*/
|
|
38
|
+
export declare function sandboxSetupFailure(guard: SandboxSetupReplayGuard, error: unknown): unknown;
|
|
39
|
+
export {};
|
|
@@ -8,6 +8,7 @@ import { currentActivityContext } from "../streaming.js";
|
|
|
8
8
|
import type { TurnActivityServices as ActivityServices, RunAgentTurnInput, RunAgentTurnResult } from "../types.js";
|
|
9
9
|
import { type ResumedTurnSandbox } from "../../sandbox-resume.js";
|
|
10
10
|
import { ToolResultSpill } from "./tool-result-spill.js";
|
|
11
|
+
import type { WorkspaceMutationOptions } from "./sandbox-runtime.js";
|
|
11
12
|
import { createTurnCredentialLeases } from "./credential-leases.js";
|
|
12
13
|
import { createTurnMediaArtifacts } from "./media-artifacts.js";
|
|
13
14
|
import { createTurnHistorySink } from "./history-sink.js";
|
|
@@ -61,7 +62,7 @@ export type TurnStreamAttemptDeps = {
|
|
|
61
62
|
phase: "admission" | "provider" | "settlement" | "snapshot_wait";
|
|
62
63
|
outcome: "completed" | "failed";
|
|
63
64
|
durationSeconds: number;
|
|
64
|
-
}) => void) => Promise<T>;
|
|
65
|
+
}) => void, options?: WorkspaceMutationOptions) => Promise<T>;
|
|
65
66
|
throwIfWorkerShuttingDown: () => void;
|
|
66
67
|
throwIfTurnCancelled: () => void;
|
|
67
68
|
setLastInputTokensFenced: (lastInputTokens: number | null) => Promise<void>;
|
|
@@ -4,7 +4,7 @@ import { withFirstPartyTools } from "../goals.js";
|
|
|
4
4
|
import type { TurnActivityServices as ActivityServices, RunAgentTurnInput } from "../types.js";
|
|
5
5
|
import { ToolResultSpill } from "./tool-result-spill.js";
|
|
6
6
|
import { createTurnMediaArtifacts } from "./media-artifacts.js";
|
|
7
|
-
import { type ResourceRef, type Permission } from "@opengeni/contracts";
|
|
7
|
+
import { type AgentLearningDefaults, type ResourceRef, type Permission } from "@opengeni/contracts";
|
|
8
8
|
import type { ClaimTurnOk } from "./claim.js";
|
|
9
9
|
import type { GovernanceModelOk } from "./governance-model.js";
|
|
10
10
|
import type { SandboxTurnRuntime } from "./sandbox-runtime.js";
|
|
@@ -85,6 +85,8 @@ export type PrepareTurnToolRuntimeDeps = {
|
|
|
85
85
|
/** Present when this turn resolves host-managed run credentials. */
|
|
86
86
|
runCredentialRenewals?: RenewalState | undefined;
|
|
87
87
|
runMcpCredentials?: RunMcpCredentials;
|
|
88
|
+
/** The accepted turn's frozen effective learning modes (instructions rendering only). */
|
|
89
|
+
learningModes?: AgentLearningDefaults | undefined;
|
|
88
90
|
};
|
|
89
91
|
export declare function prepareTurnToolPolicy(deps: PrepareTurnToolPolicyDeps): Promise<{
|
|
90
92
|
turnResources: ({
|
|
@@ -98,6 +98,11 @@ export type BillingState = {
|
|
|
98
98
|
export type SandboxRuntimeState = {
|
|
99
99
|
resolvedSandbox: ResumedTurnSandbox | null;
|
|
100
100
|
attemptWritersDrained: boolean;
|
|
101
|
+
/** The command fence the attempt writer drain cancelled and quiesced. Set
|
|
102
|
+
* together with `attemptWritersDrained`; a cancelled fence also refuses
|
|
103
|
+
* every later command, so a workspace mutation that writes only through it
|
|
104
|
+
* can no longer write once this is set. */
|
|
105
|
+
drainedCommandFence: TurnToolCancellationFence | null;
|
|
101
106
|
lateSandboxesAwaitingWriterDrain: Set<ResumedTurnSandbox>;
|
|
102
107
|
machinePrimarySession: SelfhostedSession | null;
|
|
103
108
|
lazyOwnedSandbox: EstablishedSandboxSession | null;
|
|
@@ -178,6 +183,12 @@ export type EventingState = {
|
|
|
178
183
|
* same.
|
|
179
184
|
*/
|
|
180
185
|
appActionApprovalCards: Map<string, AppActionApprovalCard>;
|
|
186
|
+
/**
|
|
187
|
+
* Finished-command text appended to tool results for the model and not yet
|
|
188
|
+
* matched to its result event; the timeline shows each tool's own output.
|
|
189
|
+
* Absent means nothing was appended.
|
|
190
|
+
*/
|
|
191
|
+
commandCompletionNotices?: Set<string> | undefined;
|
|
181
192
|
};
|
|
182
193
|
/** Rig telemetry: set once the session loads; empty string for a rig-less
|
|
183
194
|
* turn. Read by the activity span's finally block. */
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
withFirstPartyTools,
|
|
21
21
|
workflowIdForSession,
|
|
22
22
|
writeSessionUsageReceipts
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-Q4KXCK36.js";
|
|
24
24
|
import "./chunk-5E7CLEQM.js";
|
|
25
25
|
import {
|
|
26
26
|
createSiteAuthMaintenanceActivities
|
|
@@ -28,13 +28,13 @@ import {
|
|
|
28
28
|
import {
|
|
29
29
|
createBrowserDeadlineCheckpointActivities,
|
|
30
30
|
createSandboxLeaseActivities
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-C5RYXGXF.js";
|
|
32
32
|
import "./chunk-XTG32O4Q.js";
|
|
33
33
|
import "./chunk-BKPKTXFV.js";
|
|
34
34
|
import {
|
|
35
35
|
recordTurnsQueuedGauge,
|
|
36
36
|
recordWorkerDeathRecoveryMetrics
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-W2IHRF7L.js";
|
|
38
38
|
import {
|
|
39
39
|
deliverFailedChildTurnToParent,
|
|
40
40
|
notifyParentOfChildIdle,
|
|
@@ -8961,4 +8961,4 @@ export {
|
|
|
8961
8961
|
createControlActivities,
|
|
8962
8962
|
createControlActivitiesFromServices
|
|
8963
8963
|
};
|
|
8964
|
-
//# sourceMappingURL=activities-control-
|
|
8964
|
+
//# sourceMappingURL=activities-control-LJVIL5FP.js.map
|