@opengeni/worker-bundle 1.0.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/activities/agent-turn/codex.d.ts +1 -1
- package/dist/activities/agent-turn/compaction-prep.d.ts +1 -5
- package/dist/activities/agent-turn/errors.d.ts +31 -5
- package/dist/activities/agent-turn/finalization-monitor.d.ts +17 -0
- package/dist/activities/agent-turn/finalization.d.ts +1 -1
- package/dist/activities/agent-turn/governance-model.d.ts +0 -2
- package/dist/activities/agent-turn/quiescence.d.ts +1 -0
- package/dist/activities/agent-turn/recovery-warning.d.ts +8 -0
- package/dist/activities/agent-turn/run-credentials.d.ts +0 -1
- package/dist/activities/agent-turn/sandbox-establish.d.ts +1 -1
- package/dist/activities/agent-turn/sandbox-route.d.ts +0 -20
- package/dist/activities/agent-turn/sandbox-runtime.d.ts +1 -1
- package/dist/activities/agent-turn/skill-remove.d.ts +14 -0
- package/dist/activities/agent-turn/skill-search.d.ts +1 -1
- package/dist/activities/agent-turn/stream-attempt.d.ts +1 -0
- package/dist/activities/agent-turn/tool-environment.d.ts +0 -4
- package/dist/activities/agent-turn/turn-context.d.ts +2 -0
- package/dist/activities/agent-turn/turn-sandbox-access.d.ts +3 -0
- package/dist/activities/codex-capacity.d.ts +6 -1
- package/dist/activities/codex-rotation.d.ts +1 -1
- package/dist/activities/context-compaction.d.ts +7 -1
- package/dist/activities/mcp-account-routes.d.ts +22 -0
- package/dist/activities/mcp-credentials.d.ts +12 -13
- package/dist/activities/mcp-operation-authority.d.ts +0 -5
- package/dist/activities/rig-verification.d.ts +2 -3
- package/dist/activities/sandbox-images.d.ts +1 -1
- package/dist/activities/sandbox-lease.d.ts +4 -3
- package/dist/activities/session-state.d.ts +57 -2
- package/dist/activities/types.d.ts +12 -3
- package/dist/{activities-control-HMFGSKC5.js → activities-control-BOLIY3H4.js} +366 -187
- package/dist/activities-control-BOLIY3H4.js.map +1 -0
- package/dist/activities-control.d.ts +110 -2
- package/dist/{activities-turn-AP67JADS.js → activities-turn-2B3WMHBB.js} +767 -471
- package/dist/activities-turn-2B3WMHBB.js.map +1 -0
- package/dist/activities.d.ts +110 -2
- package/dist/artifact-materializer-entry.js +5 -2
- package/dist/artifact-materializer-entry.js.map +1 -1
- package/dist/artifact-outbox-entry.js +2 -2
- package/dist/artifact-outbox-entry.js.map +1 -1
- package/dist/{chunk-A4XQWVZK.js → chunk-I7HKKMUJ.js} +77 -1
- package/dist/chunk-I7HKKMUJ.js.map +1 -0
- package/dist/{chunk-CYITU5UH.js → chunk-TVEE2UUC.js} +275 -146
- package/dist/chunk-TVEE2UUC.js.map +1 -0
- package/dist/editable-artifact-materializer-service.d.ts +2 -2
- package/dist/editable-artifact-outbox-service.d.ts +2 -2
- package/dist/index.d.ts +55 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/observability-metrics.d.ts +11 -3
- package/dist/retained-process-diagnostics.d.ts +4 -0
- package/dist/sandbox-resume.d.ts +2 -12
- package/dist/sandbox-routing.d.ts +5 -3
- package/dist/sandbox-snapshot-diagnostics.d.ts +20 -0
- package/dist/warm-capture-holder.d.ts +3 -0
- package/dist/workflow-bundle.js +51 -11
- package/package.json +15 -15
- package/src/activities/agent-turn/agent-build.ts +42 -5
- package/src/activities/agent-turn/claim.ts +12 -0
- package/src/activities/agent-turn/codex-capacity.ts +26 -4
- package/src/activities/agent-turn/codex.ts +6 -2
- package/src/activities/agent-turn/compaction-prep.ts +53 -72
- package/src/activities/agent-turn/errors.ts +98 -10
- package/src/activities/agent-turn/failure-settlement.ts +49 -28
- package/src/activities/agent-turn/finalization-monitor.ts +121 -0
- package/src/activities/agent-turn/finalization.ts +79 -21
- package/src/activities/agent-turn/governance-model.ts +15 -19
- package/src/activities/agent-turn/history.ts +24 -10
- package/src/activities/agent-turn/quiescence.ts +3 -0
- package/src/activities/agent-turn/recovery-warning.ts +18 -0
- package/src/activities/agent-turn/run-credentials.ts +3 -7
- package/src/activities/agent-turn/run.ts +68 -52
- package/src/activities/agent-turn/sandbox-establish.ts +10 -2
- package/src/activities/agent-turn/sandbox-route.ts +0 -20
- package/src/activities/agent-turn/sandbox-runtime.ts +40 -7
- package/src/activities/agent-turn/skill-remove.ts +46 -0
- package/src/activities/agent-turn/skill-save.ts +1 -1
- package/src/activities/agent-turn/skill-search.ts +1 -1
- package/src/activities/agent-turn/skill-selection.ts +2 -0
- package/src/activities/agent-turn/skill-tools.ts +10 -5
- package/src/activities/agent-turn/stream-attempt.ts +38 -15
- package/src/activities/agent-turn/tool-environment.ts +44 -29
- package/src/activities/agent-turn/turn-context.ts +3 -0
- package/src/activities/agent-turn/turn-sandbox-access.ts +7 -1
- package/src/activities/capabilities.ts +17 -2
- package/src/activities/codex-capacity.ts +38 -9
- package/src/activities/codex-rotation.ts +18 -5
- package/src/activities/context-compaction.ts +26 -4
- package/src/activities/goals.ts +1 -0
- package/src/activities/google-drive-publication.ts +1 -3
- package/src/activities/mcp-account-routes.ts +139 -0
- package/src/activities/mcp-credentials.ts +83 -194
- package/src/activities/mcp-operation-authority.ts +16 -41
- package/src/activities/parent-wake.ts +8 -0
- package/src/activities/rig-verification.ts +38 -37
- package/src/activities/run-input.ts +25 -16
- package/src/activities/sandbox-images.ts +0 -1
- package/src/activities/sandbox-lease.ts +177 -44
- package/src/activities/scheduled-tasks.ts +118 -93
- package/src/activities/session-state.ts +83 -3
- package/src/activities/types.ts +18 -2
- package/src/activities/workflow-wake.ts +2 -17
- package/src/editable-artifact-materializer-service.ts +7 -3
- package/src/editable-artifact-outbox-service.ts +4 -4
- package/src/github-rest-mcp.ts +0 -1
- package/src/index.ts +2 -1
- package/src/observability-metrics.ts +105 -2
- package/src/personal-github-git-credentials.ts +0 -1
- package/src/pr-review-credentials.ts +0 -2
- package/src/retained-process-diagnostics.ts +50 -0
- package/src/sandbox-resume.ts +58 -73
- package/src/sandbox-routing.ts +44 -19
- package/src/sandbox-snapshot-diagnostics.ts +112 -0
- package/src/warm-capture-holder.ts +15 -0
- package/src/workflows/session.ts +64 -2
- package/dist/activities/agent-turn/knowledge-sources.d.ts +0 -20
- package/dist/activities/packs.d.ts +0 -55
- package/dist/activities-control-HMFGSKC5.js.map +0 -1
- package/dist/activities-turn-AP67JADS.js.map +0 -1
- package/dist/chunk-A4XQWVZK.js.map +0 -1
- package/dist/chunk-CYITU5UH.js.map +0 -1
- package/src/activities/agent-turn/knowledge-sources.ts +0 -86
- package/src/activities/packs.ts +0 -166
|
@@ -24,7 +24,7 @@ export declare function acceptsPromptCacheKeyForTurn(resolvedModel: {
|
|
|
24
24
|
export declare function refreshCappedCodexUsageRows(db: ActivityServices["db"], settings: Settings, workspaceId: string, accounts: Array<Pick<CodexAccountStatus, "id" | "status" | "primaryUsedPercent" | "secondaryUsedPercent" | "exhaustedUntil" | "exhaustedKind">>, capacitySignals: {
|
|
25
25
|
signalCodexCapacityWorkflow?: ActivityServices["signalCodexCapacityWorkflow"] | undefined;
|
|
26
26
|
wakeSessionWorkflow: ActivityServices["wakeSessionWorkflow"];
|
|
27
|
-
}): Promise<Array<Pick<CodexAccountStatus, "id" | "status" | "primaryUsedPercent" | "secondaryUsedPercent" | "exhaustedUntil" | "exhaustedKind">>>;
|
|
27
|
+
}, acceptedTurnId?: string): Promise<Array<Pick<CodexAccountStatus, "id" | "status" | "primaryUsedPercent" | "secondaryUsedPercent" | "exhaustedUntil" | "exhaustedKind">>>;
|
|
28
28
|
/**
|
|
29
29
|
* True once the lifetime last confirmed by Postgres is no longer trustworthy.
|
|
30
30
|
* A missing or malformed deadline fails closed for a holder that claims to be
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { serializedToolsForRemoteCompaction } from "@opengeni/runtime";
|
|
2
1
|
import { type Settings } from "@opengeni/config";
|
|
3
2
|
import { maybeCompactContext } from "../context-compaction.js";
|
|
4
3
|
import type { CompactionSummarizer, RemoteCompactionV2Requester } from "../context-compaction.js";
|
|
@@ -10,10 +9,7 @@ import type { ClaimTurnOk } from "./claim.js";
|
|
|
10
9
|
import type { GovernanceModelOk } from "./governance-model.js";
|
|
11
10
|
import type { AttemptIdentityState, BillingState, ClaimedResult, EventingState, ProviderTurnState, TurnControlState } from "./turn-context.js";
|
|
12
11
|
export type RemoteCompactionPrefix = {
|
|
13
|
-
|
|
14
|
-
instructions: string;
|
|
15
|
-
toolsReady: boolean;
|
|
16
|
-
agent: Parameters<typeof serializedToolsForRemoteCompaction>[0] | null;
|
|
12
|
+
agent: ReturnType<ActivityServices["runtime"]["buildAgent"]> | null;
|
|
17
13
|
};
|
|
18
14
|
export type CompactionPrepDeps = {
|
|
19
15
|
input: RunAgentTurnInput;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type CompactionProviderRejection, type MaterializationVerificationDiagnostic } from "@opengeni/runtime";
|
|
1
2
|
import { type McpTransportRequestFailureDiagnostic } from "@opengeni/runtime/mcp-network";
|
|
2
3
|
import { ApplicationFailure } from "@temporalio/activity";
|
|
3
4
|
import type { CodexAccountStatus } from "@opengeni/db";
|
|
@@ -67,11 +68,9 @@ export declare function escapedMcpTimeoutRecoveryFailure(input: {
|
|
|
67
68
|
* Convert the atomic claim transaction's failure into a small, stable
|
|
68
69
|
* Temporal wire contract. The original error remains in activity diagnostics,
|
|
69
70
|
* but SQL text, parameters, and arbitrary invariant messages never enter
|
|
70
|
-
* workflow history.
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* authority refresh, so they must preserve pending work. Only a non-database
|
|
74
|
-
* claim invariant is terminal.
|
|
71
|
+
* workflow history. Operational failures retry; other persistence rejections
|
|
72
|
+
* retain accepted work behind a durable explicit-recheck fence. Repeating the
|
|
73
|
+
* same rejected transaction without changed conditions is not recovery.
|
|
75
74
|
*/
|
|
76
75
|
export declare function preClaimAdmissionFailure(error: unknown): ApplicationFailure;
|
|
77
76
|
/**
|
|
@@ -147,7 +146,29 @@ export type SafeErrorDiagnostic = {
|
|
|
147
146
|
*/
|
|
148
147
|
export declare function safeErrorDiagnostic(error: unknown): SafeErrorDiagnostic;
|
|
149
148
|
export declare function safeErrorForTelemetry(error: unknown): Error;
|
|
149
|
+
/**
|
|
150
|
+
* Guidance appended to a definitive provider rejection. Repeating the exact
|
|
151
|
+
* request cannot succeed, so the generic "send another message to retry"
|
|
152
|
+
* advice is wrong here: a new prompt re-sends the same rejected history.
|
|
153
|
+
*/
|
|
154
|
+
export declare const COMPACTION_PROVIDER_REJECTION_GUIDANCE = "The provider refused this exact request, so repeating it fails the same way until the conversation changes. If a new message fails again, start a new session.";
|
|
150
155
|
export declare function compactionFailureReasonFromError(error: unknown): string;
|
|
156
|
+
/**
|
|
157
|
+
* Exact `turn.failed` payload for a terminal compaction failure. A definitive
|
|
158
|
+
* provider rejection additionally carries its closed identifier record so the
|
|
159
|
+
* timeline, API consumers, and operators can name the rejected field without
|
|
160
|
+
* parsing the message.
|
|
161
|
+
*/
|
|
162
|
+
export declare function compactionFailureTurnEventPayload(error: unknown, overrides?: {
|
|
163
|
+
error?: string;
|
|
164
|
+
}): {
|
|
165
|
+
error: string;
|
|
166
|
+
code: "context_compaction_failed";
|
|
167
|
+
retryable: false;
|
|
168
|
+
recovery: "user_message";
|
|
169
|
+
compacted: false;
|
|
170
|
+
providerRejection?: CompactionProviderRejection;
|
|
171
|
+
};
|
|
151
172
|
export declare function isCompactionSummaryFailure(error: unknown): boolean;
|
|
152
173
|
export declare function shouldRecoverCompactionProviderFailure(error: unknown): boolean;
|
|
153
174
|
export declare function classifyContextWindowOverflowError(error: unknown): {
|
|
@@ -227,6 +248,9 @@ export type XaiCredentialFailure = {
|
|
|
227
248
|
export declare function classifyXaiCredentialFailure(error: unknown): XaiCredentialFailure | null;
|
|
228
249
|
export declare function agentRunFailurePayload(error: unknown, options?: {
|
|
229
250
|
isCodexTurn?: boolean;
|
|
251
|
+
}): ReturnType<typeof baseAgentRunFailurePayload>;
|
|
252
|
+
declare function baseAgentRunFailurePayload(error: unknown, options?: {
|
|
253
|
+
isCodexTurn?: boolean;
|
|
230
254
|
}): {
|
|
231
255
|
error: string;
|
|
232
256
|
code?: string;
|
|
@@ -246,6 +270,7 @@ export declare function agentRunFailurePayload(error: unknown, options?: {
|
|
|
246
270
|
database?: Record<string, string>;
|
|
247
271
|
historyPersistenceStage?: MandatoryHistoryPersistenceStage;
|
|
248
272
|
mcpTransportDiagnostic?: McpTransportRequestFailureDiagnostic;
|
|
273
|
+
materializationDiagnostic?: MaterializationVerificationDiagnostic;
|
|
249
274
|
};
|
|
250
275
|
export type CodexCredentialFailure = {
|
|
251
276
|
kind: "auth" | "forbidden" | "rate_limit" | "quota";
|
|
@@ -285,3 +310,4 @@ export declare function codexUsageLimitFailurePayload(info: {
|
|
|
285
310
|
detail?: string;
|
|
286
311
|
};
|
|
287
312
|
export declare const CODEX_USAGE_LIMIT_MAX_RESUME_MS: number;
|
|
313
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Observability } from "@opengeni/observability";
|
|
2
|
+
import type { TurnHeartbeatDetails } from "../../op-journal.js";
|
|
3
|
+
export declare const TURN_FINALIZATION_STAGES: readonly ["tool_writers", "credential_renewals", "credential_cleanup", "quiescence_receipt", "event_flush", "provider_leases", "workspace_capture", "tool_close", "sandbox_provisioning", "sandbox_rotation", "workspace_snapshot", "sandbox_release"];
|
|
4
|
+
export type TurnFinalizationStage = (typeof TURN_FINALIZATION_STAGES)[number];
|
|
5
|
+
/** Starts only after agent execution ends. A cleanup-stage deadline never caps
|
|
6
|
+
* agent work and never detaches a physical writer to manufacture quiescence. */
|
|
7
|
+
export declare function startTurnFinalizationMonitor(input: {
|
|
8
|
+
observability: Observability;
|
|
9
|
+
details: TurnHeartbeatDetails;
|
|
10
|
+
heartbeat: (details: TurnHeartbeatDetails) => void;
|
|
11
|
+
terminateWorker: () => void;
|
|
12
|
+
timeoutMs?: number;
|
|
13
|
+
slowAfterMs?: number;
|
|
14
|
+
}): {
|
|
15
|
+
enter(next: TurnFinalizationStage): void;
|
|
16
|
+
stop(): void;
|
|
17
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Settings } from "@opengeni/config";
|
|
2
|
-
import type
|
|
2
|
+
import { type currentActivityContext } from "../streaming.js";
|
|
3
3
|
import type { RunAgentTurnInput, TurnActivityServices as ActivityServices } from "../types.js";
|
|
4
4
|
import { createModelCheckpointMemoryCollector } from "../../model-checkpoint-memory-collector.js";
|
|
5
5
|
import { makeMachineOpObserver } from "../../observability-metrics.js";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { materializeRigVersionForAttempt } from "@opengeni/db";
|
|
2
2
|
import { renderWorkspaceGovernanceContext, type OpenGeniRuntime } from "@opengeni/runtime";
|
|
3
3
|
import { type Settings } from "@opengeni/config";
|
|
4
|
-
import { resolveWorkspacePackRuntime } from "../packs.js";
|
|
5
4
|
import { createModelHistoryAttachmentProjector } from "../run-input.js";
|
|
6
5
|
import type { TurnActivityServices as ActivityServices, RunAgentTurnInput, RunAgentTurnResult } from "../types.js";
|
|
7
6
|
import { buildCompanyBrainContributionReceipt } from "../../model-context-contributions.js";
|
|
@@ -35,7 +34,6 @@ export type GovernanceModelDeps = {
|
|
|
35
34
|
};
|
|
36
35
|
export type GovernanceModelOk = {
|
|
37
36
|
runtimePreparationStartedAt: number;
|
|
38
|
-
packRuntime: Awaited<ReturnType<typeof resolveWorkspacePackRuntime>>;
|
|
39
37
|
rigVersion: NonNullable<Awaited<ReturnType<typeof materializeRigVersionForAttempt>>>["version"] | null;
|
|
40
38
|
rigName: string | null;
|
|
41
39
|
agentHumanInputEnabled: boolean;
|
|
@@ -88,6 +88,7 @@ export declare function drainAttemptOwnedSandboxWriters(input: {
|
|
|
88
88
|
gitCredentialRenewals: readonly Pick<GitCredentialRenewalController, "stop">[];
|
|
89
89
|
codemodeTokenRenewal: Pick<CodemodeTokenRenewalController, "stop"> | null;
|
|
90
90
|
runCredentialRenewal: Pick<RunCredentialRenewalController, "stop"> | null;
|
|
91
|
+
onStage?: (stage: "tool_writers" | "credential_renewals") => void;
|
|
91
92
|
}): Promise<void>;
|
|
92
93
|
/** Persist the exact turn's second-stage release only after the caller has
|
|
93
94
|
* crossed the physical writer boundary. This wait is intentionally independent
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Database } from "@opengeni/db";
|
|
2
|
+
/** Opt-in belongs to this warning-aware worker implementation, not the DB
|
|
3
|
+
* client, role defaults or deployment configuration. Claim stamps it locally. */
|
|
4
|
+
export declare const FILESYSTEM_DISCONTINUITY_PROTOCOL: 1;
|
|
5
|
+
export declare function recoveryAwareSessionInstructions(db: Database, workspaceId: string, session: {
|
|
6
|
+
id: string;
|
|
7
|
+
instructions?: string | null;
|
|
8
|
+
}): Promise<string>;
|
|
@@ -54,7 +54,6 @@ export declare function prepareRunCredentials(deps: PrepareRunCredentialsDeps):
|
|
|
54
54
|
initialRunCredentialMaterial: NormalizedRunCredentialMaterial | null;
|
|
55
55
|
runCredentialsNote: string | undefined;
|
|
56
56
|
authorizeGitHubTokenMint: GitHubTokenMintAuthorization;
|
|
57
|
-
hostCredentialRootSessionId: string | null;
|
|
58
57
|
gitCredentialAuthority: import("../environment.js").GitCredentialAuthority | undefined;
|
|
59
58
|
codemodeAuthority: {
|
|
60
59
|
sessionId: string;
|
|
@@ -4,7 +4,7 @@ import { type GitCredentialTokenWriterSession, type NormalizedRunCredentialMater
|
|
|
4
4
|
import { type Settings } from "@opengeni/config";
|
|
5
5
|
import { mergeResourceRefs } from "../common.js";
|
|
6
6
|
import { type MintedRunGitCredentials, type SandboxCodemodeAuthority } from "../environment.js";
|
|
7
|
-
import { rigProviderImageSourceImage } from "../
|
|
7
|
+
import { rigProviderImageSourceImage } from "../sandbox-images.js";
|
|
8
8
|
import type { TurnActivityServices as ActivityServices, RunAgentTurnInput } from "../types.js";
|
|
9
9
|
import type { currentActivityContext } from "../streaming.js";
|
|
10
10
|
import { type ResumedTurnSandbox } from "../../sandbox-resume.js";
|
|
@@ -109,15 +109,6 @@ export declare function reconcileActiveSandboxPointer(db: ActivityServices["db"]
|
|
|
109
109
|
type: SessionEventType;
|
|
110
110
|
payload: unknown;
|
|
111
111
|
}>) => Promise<void> | void): Promise<LoadedActivePointer>;
|
|
112
|
-
/**
|
|
113
|
-
* Warm the Modal private-registry image for the image ref this turn actually
|
|
114
|
-
* resolved, not only the deployment-global OPENGENI_MODAL_IMAGE_REF warmed at
|
|
115
|
-
* worker boot. A provider-native modalImageId bypasses registry import and is
|
|
116
|
-
* resolved by ModalImageSelector.fromId during create. Otherwise packs can
|
|
117
|
-
* override `modalImageRef` per workspace/turn, so a private pack image must be
|
|
118
|
-
* resolved before sandbox creation or Modal falls back to the unauthenticated
|
|
119
|
-
* `fromTag` path.
|
|
120
|
-
*/
|
|
121
112
|
export declare function ensureTurnModalRegistryImage(runSettings: Settings, sandboxCreationBackend: Settings["sandboxBackend"] | undefined, ensureRegistryImage?: (settings: Settings) => Promise<void>): Promise<void>;
|
|
122
113
|
export declare const SANDBOX_ARTIFACT_RUNTIME_MANIFEST = "/opt/opengeni/artifact-runtime/installation.json";
|
|
123
114
|
export declare const SANDBOX_ARTIFACT_TOOL_ENTRY = "/opt/opengeni/artifact-runtime/skill-facade-entry.mjs";
|
|
@@ -125,17 +116,6 @@ export type SandboxArtifactRuntimeAdmission = Readonly<{
|
|
|
125
116
|
available: boolean;
|
|
126
117
|
environment: Readonly<Record<string, string>>;
|
|
127
118
|
}>;
|
|
128
|
-
/**
|
|
129
|
-
* Admit the optional native standalone-file runtime only for the deployment's
|
|
130
|
-
* exact base sandbox image contract. A pack/rig image override is an
|
|
131
|
-
* independent filesystem and therefore fails closed even when the deployment
|
|
132
|
-
* base image is capable. Collaborative artifact skills are admitted separately
|
|
133
|
-
* from the frozen canonical tool catalog.
|
|
134
|
-
*
|
|
135
|
-
* This keeps lazy provisioning intact: CI/release proves the image closure,
|
|
136
|
-
* while a before-agent-start doctor verifies the actual box before any model
|
|
137
|
-
* call. No speculative sandbox is created merely to populate the skill index.
|
|
138
|
-
*/
|
|
139
119
|
export declare function sandboxArtifactRuntimeAdmission(deploymentSettings: Settings, runSettings: Settings, backend: Settings["sandboxBackend"] | undefined, options?: Readonly<{
|
|
140
120
|
production?: boolean;
|
|
141
121
|
}>): SandboxArtifactRuntimeAdmission;
|
|
@@ -40,7 +40,7 @@ export declare function createSandboxTurnRuntime(deps: SandboxTurnRuntimeDeps):
|
|
|
40
40
|
onHomeSandboxRebound: (rebound: {
|
|
41
41
|
established: EstablishedSandboxSession;
|
|
42
42
|
leaseEpoch: number;
|
|
43
|
-
}) => void
|
|
43
|
+
}) => Promise<void>;
|
|
44
44
|
runWorkspaceMutationForSandbox: <T>(sandbox: ResumedTurnSandbox, operation: string, mutation: () => Promise<T>, observePhase?: (measurement: {
|
|
45
45
|
phase: "admission" | "provider" | "settlement" | "snapshot_wait";
|
|
46
46
|
outcome: "completed" | "failed";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AttemptToolDefinition } from "@opengeni/codemode";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import type { SkillWriteReceipt } from "@opengeni/contracts";
|
|
4
|
+
export declare const SkillRemoveRequest: z.ZodObject<{
|
|
5
|
+
operationId: z.ZodUUID;
|
|
6
|
+
skillId: z.ZodUUID;
|
|
7
|
+
expectedRevisionId: z.ZodNullable<z.ZodUUID>;
|
|
8
|
+
expectedScopeVersion: z.ZodNumber;
|
|
9
|
+
reason: z.ZodString;
|
|
10
|
+
}, z.core.$strict>;
|
|
11
|
+
export declare function createSkillRemoveAttemptToolDefinition(input: {
|
|
12
|
+
authorize: () => Promise<void>;
|
|
13
|
+
remove: (request: z.infer<typeof SkillRemoveRequest>) => Promise<SkillWriteReceipt>;
|
|
14
|
+
}): AttemptToolDefinition;
|
|
@@ -7,7 +7,7 @@ export type WorkspaceSkillSearchEntry = Readonly<{
|
|
|
7
7
|
revisionId?: string;
|
|
8
8
|
scopeVersion?: number;
|
|
9
9
|
installationVersion?: number;
|
|
10
|
-
source?: "workspace" | "builtin" | "session"
|
|
10
|
+
source?: "workspace" | "builtin" | "session";
|
|
11
11
|
}>;
|
|
12
12
|
export declare function createSkillSearchAttemptToolDefinition(input: {
|
|
13
13
|
authorize: () => Promise<void>;
|
|
@@ -82,6 +82,7 @@ export type TurnStreamAttemptDeps = {
|
|
|
82
82
|
turn: {
|
|
83
83
|
executionGeneration: number;
|
|
84
84
|
model: string;
|
|
85
|
+
source?: string;
|
|
85
86
|
};
|
|
86
87
|
trigger: NonNullable<Awaited<ReturnType<typeof getSessionEvent>>>;
|
|
87
88
|
humanInputResume: Awaited<ReturnType<typeof getHumanInputResumeForEvent>>;
|
|
@@ -9,7 +9,6 @@ import type { GovernanceModelOk } from "./governance-model.js";
|
|
|
9
9
|
import type { SandboxTurnRuntime } from "./sandbox-runtime.js";
|
|
10
10
|
import type { sandboxArtifactRuntimeAdmission } from "./sandbox-route.js";
|
|
11
11
|
import type { AttemptIdentityState, EventingState, SandboxRuntimeState, WorkspaceRefState } from "./turn-context.js";
|
|
12
|
-
import type { RuntimeSkillActivation } from "@opengeni/runtime";
|
|
13
12
|
export type PrepareTurnToolPolicyDeps = {
|
|
14
13
|
input: RunAgentTurnInput;
|
|
15
14
|
db: ActivityServices["db"];
|
|
@@ -25,7 +24,6 @@ export type PrepareTurnToolPolicyDeps = {
|
|
|
25
24
|
};
|
|
26
25
|
export type PrepareTurnToolRuntimeDeps = {
|
|
27
26
|
fetchKnowledgeSource?: ((input: import("../types.js").RunKnowledgeSourceSyncBatchInput) => Promise<import("../types.js").RunKnowledgeSourceSyncBatchResult>) | undefined;
|
|
28
|
-
selectedSkillActivations: readonly RuntimeSkillActivation[];
|
|
29
27
|
input: RunAgentTurnInput;
|
|
30
28
|
catalogSourceSettings: Settings;
|
|
31
29
|
db: ActivityServices["db"];
|
|
@@ -34,7 +32,6 @@ export type PrepareTurnToolRuntimeDeps = {
|
|
|
34
32
|
objectStorage: ActivityServices["objectStorage"];
|
|
35
33
|
observability: ActivityServices["observability"];
|
|
36
34
|
cancellationSignal: AbortSignal | undefined;
|
|
37
|
-
connectionCredentials: ActivityServices["connectionCredentials"];
|
|
38
35
|
eventing: EventingState;
|
|
39
36
|
attempt: AttemptIdentityState;
|
|
40
37
|
sandboxState: SandboxRuntimeState;
|
|
@@ -55,7 +52,6 @@ export type PrepareTurnToolRuntimeDeps = {
|
|
|
55
52
|
accountId: string;
|
|
56
53
|
workspaceId: string;
|
|
57
54
|
};
|
|
58
|
-
hostCredentialRootSessionId: string | null;
|
|
59
55
|
sandboxArtifactRuntime: ReturnType<typeof sandboxArtifactRuntimeAdmission>;
|
|
60
56
|
activeSandboxBackend: Settings["sandboxBackend"] | undefined;
|
|
61
57
|
groupBoxBackend: Settings["sandboxBackend"];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TurnHeartbeatDetails } from "../../op-journal.js";
|
|
1
2
|
import type { Settings } from "@opengeni/config";
|
|
2
3
|
import type { CodexUsageHeaderSnapshot } from "@opengeni/codex";
|
|
3
4
|
import type { AppendEventInput, ApplySessionTurnSettlementInput } from "@opengeni/db";
|
|
@@ -89,6 +90,7 @@ export type RenewalState = {
|
|
|
89
90
|
publishedRunCredentialNotices: Set<string>;
|
|
90
91
|
};
|
|
91
92
|
export type EventingState = {
|
|
93
|
+
heartbeatDetails: TurnHeartbeatDetails | null;
|
|
92
94
|
heartbeatTimer: ReturnType<typeof startActivityHeartbeat> | undefined;
|
|
93
95
|
batcher: ReturnType<typeof createRuntimeBatcher> | null;
|
|
94
96
|
preparedTools: Awaited<ReturnType<OpenGeniRuntime["prepareTools"]>> | null;
|
|
@@ -7,6 +7,9 @@ export type ResolvedTurnSandboxAccess = Readonly<{
|
|
|
7
7
|
session: ChannelASession;
|
|
8
8
|
leaseEpoch: number;
|
|
9
9
|
}>;
|
|
10
|
+
/** The lazy wrapper remains the agent's owner even after provisioning fills
|
|
11
|
+
* resolvedSandbox with the raw provider handle for capture and release. */
|
|
12
|
+
export declare function ownedTurnSandboxForAgent(sandboxState: TurnSandboxAccessState): import("@opengeni/runtime").EstablishedSandboxSession | undefined;
|
|
10
13
|
/** Join the turn's canonical sandbox boundary and return its active routed session. */
|
|
11
14
|
export declare function resolveTurnSandboxAccess(sandboxState: TurnSandboxAccessState, sdkOwnedSandboxSession: unknown, unavailableMessage: string): Promise<ResolvedTurnSandboxAccess>;
|
|
12
15
|
export {};
|
|
@@ -17,7 +17,7 @@ export declare function signalCodexCapacityWakeTargets(services: CodexCapacitySi
|
|
|
17
17
|
export declare function signalPendingCodexCapacityWakeTargets(services: CodexCapacitySignalServices & {
|
|
18
18
|
db: ControlActivityServices["db"];
|
|
19
19
|
}, workspaceId: string): Promise<void>;
|
|
20
|
-
export declare function codexCapacityDecision<TPolicyScope = never, TUnavailableDiagnostic = never>(context: CodexCapacitySelectionContext<TPolicyScope, TUnavailableDiagnostic
|
|
20
|
+
export declare function codexCapacityDecision<TPolicyScope = never, TUnavailableDiagnostic = never>(context: CodexCapacitySelectionContext<TPolicyScope, TUnavailableDiagnostic>, now?: Date): ReturnType<Parameters<typeof reconcileCodexCapacityWaitDb>[2]>;
|
|
21
21
|
/**
|
|
22
22
|
* Arm a durable Codex waiter and immediately re-evaluate it under the
|
|
23
23
|
* allocator lock. A capacity mutation that commits just before the waiter is
|
|
@@ -28,6 +28,11 @@ export declare function codexCapacityDecision<TPolicyScope = never, TUnavailable
|
|
|
28
28
|
export declare function armAndReconcileCodexCapacityWait(services: Pick<ControlActivityServices, "db" | "bus">, input: Parameters<typeof armCodexCapacityWait>[1], options?: {
|
|
29
29
|
onArmed?: () => void;
|
|
30
30
|
}): Promise<{
|
|
31
|
+
action: "stopped";
|
|
32
|
+
sessionStatus: "failed" | "queued";
|
|
33
|
+
waiter: import("@opengeni/db").CodexCapacityWait;
|
|
34
|
+
events: import("@opengeni/contracts").SessionEvent[];
|
|
35
|
+
} | {
|
|
31
36
|
action: "stale";
|
|
32
37
|
waiter: import("@opengeni/db").CodexCapacityWait | null;
|
|
33
38
|
events: import("@opengeni/contracts").SessionEvent[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CodexAccountStatus, CodexCredentialLeaseSelectionContext, CodexLeaseAccountStatus, CodexPinSource } from "@opengeni/db";
|
|
2
2
|
export type CodexRotationAccount = CodexAccountStatus | CodexLeaseAccountStatus;
|
|
3
3
|
/** Capacity metadata worth an authoritative live read before/all through an idle. */
|
|
4
|
-
export declare function codexAccountNeedsLiveCapacityRefresh(account: Pick<CodexAccountStatus, "primaryUsedPercent" | "secondaryUsedPercent" | "exhaustedUntil" | "exhaustedKind">,
|
|
4
|
+
export declare function codexAccountNeedsLiveCapacityRefresh(account: Pick<CodexAccountStatus, "primaryUsedPercent" | "secondaryUsedPercent" | "exhaustedUntil" | "exhaustedKind">, _now: Date): boolean;
|
|
5
5
|
export type CodexRotationStrategy = "most_remaining" | "round_robin" | "drain_then_next" | "sharded";
|
|
6
6
|
/**
|
|
7
7
|
* The ONE strategy rotation-enabled workspaces run: sticky-sharded. The legacy
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Database } from "@opengeni/db";
|
|
2
|
-
import { type CompactionItem } from "@opengeni/runtime";
|
|
2
|
+
import { type CompactionItem, type CompactionProviderRejection } from "@opengeni/runtime";
|
|
3
3
|
import { type Settings } from "@opengeni/config";
|
|
4
4
|
import type { SessionEvent } from "@opengeni/contracts";
|
|
5
5
|
export type MaybeCompactResult = {
|
|
@@ -77,6 +77,12 @@ export declare function settleFailedContextCompactionLandmark(db: Database, scop
|
|
|
77
77
|
}, options?: {
|
|
78
78
|
clearRequestedCompaction?: boolean;
|
|
79
79
|
publishLiveEvents?: (events: SessionEvent[]) => Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Closed identifier record of a definitive provider rejection. Carried on
|
|
82
|
+
* the visible `compaction.skipped` landmark so the timeline can name the
|
|
83
|
+
* rejected field instead of offering a retry that cannot succeed.
|
|
84
|
+
*/
|
|
85
|
+
providerRejection?: CompactionProviderRejection | null;
|
|
80
86
|
}): Promise<Extract<MaybeCompactResult, {
|
|
81
87
|
compacted: false;
|
|
82
88
|
}>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Settings } from "@opengeni/config";
|
|
2
|
+
import type { McpConnectionAccountBinding, ToolRef, ToolAuthNeededPayload } from "@opengeni/contracts";
|
|
3
|
+
import type { ApiIntegrationRuntime } from "@opengeni/db";
|
|
4
|
+
export declare function accountRouteAuthNeededPayload(payload: ToolAuthNeededPayload, bindings: readonly McpConnectionAccountBinding[] | null | undefined): ToolAuthNeededPayload;
|
|
5
|
+
/** Expand only after canonical tool-policy admission. Aliases are execution
|
|
6
|
+
* identities, never an alternate way to gain admission to a connector. */
|
|
7
|
+
export declare function expandMcpAccountRoutes(input: {
|
|
8
|
+
settings: Settings;
|
|
9
|
+
tools: ToolRef[];
|
|
10
|
+
bindings: readonly McpConnectionAccountBinding[] | null | undefined;
|
|
11
|
+
}): {
|
|
12
|
+
settings: Settings;
|
|
13
|
+
tools: ToolRef[];
|
|
14
|
+
accountLabels: ReadonlyMap<string, string>;
|
|
15
|
+
};
|
|
16
|
+
/** Each adapter closes over its own immutable credential ref and authority
|
|
17
|
+
* generation. Sharing a provider transport never shares a credential resolver. */
|
|
18
|
+
export declare function expandApiIntegrationAccountRoutes(input: {
|
|
19
|
+
integrations: readonly ApiIntegrationRuntime[];
|
|
20
|
+
bindings: readonly McpConnectionAccountBinding[] | null | undefined;
|
|
21
|
+
tools: readonly ToolRef[];
|
|
22
|
+
}): ApiIntegrationRuntime[];
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import type { Settings } from "@opengeni/config";
|
|
2
|
-
import type
|
|
3
|
-
|
|
4
|
-
import { type Observability } from "@opengeni/observability";
|
|
5
|
-
export declare function connectionTokenResolverForTurn(input: {
|
|
2
|
+
import { resolveAcceptedConnectionUse, type Database, type ResolveConnectionCredentialInput, type ResolveConnectionCredentialResult, type SessionTurnForExecution } from "@opengeni/db";
|
|
3
|
+
type TurnConnectionInput = {
|
|
6
4
|
db: Database;
|
|
7
5
|
settings: Settings;
|
|
8
|
-
connectionCredentials?: ConnectionCredentialsPort | null;
|
|
9
6
|
accountId: string;
|
|
10
7
|
workspaceId: string;
|
|
11
8
|
sessionId: string;
|
|
12
|
-
rootSessionId: string;
|
|
13
9
|
attemptId: string;
|
|
14
10
|
turn: SessionTurnForExecution;
|
|
11
|
+
/** Policy identities before account expansion; never used to select credentials. */
|
|
12
|
+
canonicalMcpServerIds?: readonly string[];
|
|
15
13
|
authorizeAcceptedUse?: typeof resolveAcceptedConnectionUse;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
};
|
|
15
|
+
type CredentialResolver = (request: ResolveConnectionCredentialInput) => Promise<ResolveConnectionCredentialResult>;
|
|
16
|
+
export declare function connectionTokenResolverForTurn(input: TurnConnectionInput): CredentialResolver;
|
|
17
|
+
/** Bind the ordinary credential resolver to one immutable accepted turn.
|
|
18
|
+
* Credential acquisition and refresh stay inside the native connection engine;
|
|
19
|
+
* this layer adds the exact execution context and physical-request checks. */
|
|
20
|
+
export declare function bindNativeConnectionCredentialsToTurn(input: TurnConnectionInput, nativeResolver: CredentialResolver): CredentialResolver;
|
|
21
|
+
export {};
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import type { ConnectionUseAttribution } from "@opengeni/contracts/connection-authority";
|
|
2
|
-
import type { HostMcpAcceptedAuthority } from "@opengeni/contracts/host-mcp-bindings";
|
|
3
2
|
import type { ResolveConnectionCredentialInput } from "@opengeni/db";
|
|
4
3
|
/** Metadata only. Callers must obtain authority from a current live fence.
|
|
5
4
|
* This equality key is never authorization and never replaces physical-use checks. */
|
|
6
5
|
export declare function mcpOperationAuthorityDigest(request: ResolveConnectionCredentialInput, authority: {
|
|
7
6
|
native: ConnectionUseAttribution;
|
|
8
|
-
host?: never;
|
|
9
7
|
principal?: {
|
|
10
8
|
kind: string;
|
|
11
9
|
subjectId?: string;
|
|
12
10
|
};
|
|
13
|
-
} | {
|
|
14
|
-
host: HostMcpAcceptedAuthority;
|
|
15
|
-
native?: never;
|
|
16
11
|
}): string;
|
|
@@ -4,7 +4,6 @@ import { acquireLease, commitWarmingToWarm, failWarmingToCold, markWarmLeaseInst
|
|
|
4
4
|
import { createTurnToolCancellationController, establishSandboxSessionFromEnvelope, serializeEstablishedSandboxEnvelope, tagModalSandbox, type EstablishedSandboxSession, type TurnSandboxCommandArgs, type TurnSandboxCommandSession } from "@opengeni/runtime/sandbox";
|
|
5
5
|
import type { Context } from "@temporalio/activity";
|
|
6
6
|
import type { ControlActivityServices } from "./types.js";
|
|
7
|
-
import { type WorkspacePackRuntime } from "./packs.js";
|
|
8
7
|
type SandboxLifecycleCommandRunner = (session: TurnSandboxCommandSession, args: TurnSandboxCommandArgs) => Promise<unknown>;
|
|
9
8
|
export type RigVerificationWorkflowInput = {
|
|
10
9
|
workspaceId: string;
|
|
@@ -29,7 +28,7 @@ export type RigPlatformCheckResult = CommandResult & RigCheck;
|
|
|
29
28
|
*/
|
|
30
29
|
export declare function rigPlatformChecksForSettings(settings: ControlActivityServices["settings"]): RigCheck[];
|
|
31
30
|
export declare const RIG_VERIFICATION_OWNER_TTL_MS: number;
|
|
32
|
-
export declare const RIG_VERIFICATION_OWNERS_DISABLED_MESSAGE = "
|
|
31
|
+
export declare const RIG_VERIFICATION_OWNERS_DISABLED_MESSAGE = "Sandbox Environment verification lease ownership is disabled; refusing to create an unowned verifier sandbox";
|
|
33
32
|
export declare class RigVerificationActivityDeadlineError extends Error {
|
|
34
33
|
readonly startToCloseTimeoutMs: number;
|
|
35
34
|
readonly cleanupReserveMs: number;
|
|
@@ -146,7 +145,7 @@ export declare function buildVerifiedRigProviderImage(input: {
|
|
|
146
145
|
lifecycle: RigVerificationActivityLifecycle;
|
|
147
146
|
signal: AbortSignal;
|
|
148
147
|
}): Promise<RigProviderImage>;
|
|
149
|
-
export declare function settingsForRigVerification(settings: ControlActivityServices["settings"],
|
|
148
|
+
export declare function settingsForRigVerification(settings: ControlActivityServices["settings"], rigImage: string | null): ControlActivityServices["settings"];
|
|
150
149
|
export declare function createRigVerificationActivities(services: () => Promise<ControlActivityServices>): {
|
|
151
150
|
verifyRigChange: (input: {
|
|
152
151
|
workspaceId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { resolveRigProviderImageSelection, rigProviderImageSourceImage,
|
|
1
|
+
export { resolveRigProviderImageSelection, rigProviderImageSourceImage, settingsWithRigImage, settingsWithRigProviderImage, type RigProviderImageSelectionReason, } from "@opengeni/core";
|
|
@@ -2,7 +2,7 @@ import type { ProviderCommandPersistence } from "@opengeni/runtime";
|
|
|
2
2
|
import { type OpStatus } from "@opengeni/agent-proto";
|
|
3
3
|
import { listLiveModalSandboxLeaseAttributions, readLease, type ReapDrainable, type RetainedProcessProviderProof, type SandboxRetainedProcess, type LeaseSnapshot } from "@opengeni/db";
|
|
4
4
|
import { type ConnectedMachineBackgroundCommandClaim, type ConnectedMachineBackgroundCommandProof } from "@opengeni/db/session-background-commands";
|
|
5
|
-
import { type VerifiedHostWorkspaceArchive, createSandboxClientForBackend, inspectModalSandboxLifecycle, resolveModalCheckpointProviderBindingForSession, terminateModalSandboxById, type ModalOrphanSweepTermination, type ModalCheckpointProviderBinding, type ProviderWorkspaceCapturePolicy, type WorkspaceArchiveDescriptor, type ControlRpc } from "@opengeni/runtime/sandbox";
|
|
5
|
+
import { type VerifiedHostWorkspaceArchive, createSandboxClientForBackend, inspectModalSandboxLifecycle, OpStreamExecClient, resolveModalCheckpointProviderBindingForSession, terminateModalSandboxById, type ModalOrphanSweepTermination, type ModalCheckpointProviderBinding, type ProviderWorkspaceCapturePolicy, type WorkspaceArchiveDescriptor, type ControlRpc } from "@opengeni/runtime/sandbox";
|
|
6
6
|
import { type SandboxDrainActivityInput, type SandboxLeaseSweepMaintenanceInput } from "../sandbox-reaper-contract.js";
|
|
7
7
|
import type { ControlActivityServices as ActivityServices } from "./types.js";
|
|
8
8
|
import { type RetainedProcessReconciliationOutcome } from "../observability-metrics.js";
|
|
@@ -60,7 +60,7 @@ export type DrainCaptureDisposition = "capture_required" | "archive_published";
|
|
|
60
60
|
* Test seams may return the legacy boolean shorthand. Production returns the
|
|
61
61
|
* typed outcome so the cold commit can distinguish a clean stop from definitive
|
|
62
62
|
* provider disappearance before capture. */
|
|
63
|
-
export type TerminateBoxFn = (settings: ActivityServices["settings"], lease: NonNullable<Awaited<ReturnType<typeof readLease>>>, observability: ActivityServices["observability"], persistArchive: PersistArchiveFn, providerCaptureRequestId?: string, captureDisposition?: DrainCaptureDisposition, capturePolicy?: ProviderWorkspaceCapturePolicy | null, diskBackedArchives?: boolean, releaseFailedCapture?: () => Promise<void
|
|
63
|
+
export type TerminateBoxFn = (settings: ActivityServices["settings"], lease: NonNullable<Awaited<ReturnType<typeof readLease>>>, observability: ActivityServices["observability"], persistArchive: PersistArchiveFn, providerCaptureRequestId?: string, captureDisposition?: DrainCaptureDisposition, capturePolicy?: ProviderWorkspaceCapturePolicy | null, diskBackedArchives?: boolean, releaseFailedCapture?: () => Promise<void>, workspaceId?: string) => Promise<boolean | ProviderTerminationOutcome>;
|
|
64
64
|
export type SweepModalOrphansFn = (settings: ActivityServices["settings"], db: ActivityServices["db"], observability: ActivityServices["observability"]) => Promise<number>;
|
|
65
65
|
export type InspectOpenSandboxKubernetesInventoryFn = (input: {
|
|
66
66
|
namespace: string;
|
|
@@ -154,6 +154,7 @@ export declare function createSandboxLeaseActivities(services: () => Promise<Act
|
|
|
154
154
|
* adoption. A successor enrollment connection is intentionally irrelevant: no
|
|
155
155
|
* query or cancellation is ever rebound to it. */
|
|
156
156
|
export declare function reconcileConnectedMachineBackgroundCommands(db: ActivityServices["db"], settings: ActivityServices["settings"], observability: ActivityServices["observability"], bus: ActivityServices["bus"], controlRpcOverride?: ControlRpc): Promise<void>;
|
|
157
|
+
export declare function replayConnectedCommandOutput(client: Pick<OpStreamExecClient, "readExisting">, opId: string, terminalKnown: boolean, capture: Parameters<OpStreamExecClient["readExisting"]>[2]): Promise<void>;
|
|
157
158
|
export declare function probeConnectedMachineBackgroundCommand(claim: ConnectedMachineBackgroundCommandClaim, controlRpc: ControlRpc, controlTimeoutMs: number, observedAt?: Date): Promise<ConnectedMachineBackgroundCommandProof | null>;
|
|
158
159
|
export declare function connectedCommandProofFromStatus(status: OpStatus, observedAt: Date): ConnectedMachineBackgroundCommandProof | null;
|
|
159
160
|
type RetainedProcessDeferralOutcome = Extract<RetainedProcessProbeResult, {
|
|
@@ -207,4 +208,4 @@ export declare function sandboxDrainReason(lease: Pick<LeaseSnapshot, "rotationR
|
|
|
207
208
|
* draining until its adapter can prove termination. A truly instance-less or
|
|
208
209
|
* `none`-backed row is a no-op.
|
|
209
210
|
*/
|
|
210
|
-
export declare function terminateProviderBox(settings: ActivityServices["settings"], lease: NonNullable<Awaited<ReturnType<typeof readLease>>>, observability: ActivityServices["observability"], persistArchive: PersistArchiveFn, createClientForBackend?: CreateSandboxClientForBackendFn, terminateModalById?: typeof terminateModalSandboxById, providerCaptureRequestId?: string, captureDisposition?: DrainCaptureDisposition, claimedCapturePolicy?: ProviderWorkspaceCapturePolicy | null, diskBackedArchives?: boolean, releaseFailedCapture?: () => Promise<void
|
|
211
|
+
export declare function terminateProviderBox(settings: ActivityServices["settings"], lease: NonNullable<Awaited<ReturnType<typeof readLease>>>, observability: ActivityServices["observability"], persistArchive: PersistArchiveFn, createClientForBackend?: CreateSandboxClientForBackendFn, terminateModalById?: typeof terminateModalSandboxById, providerCaptureRequestId?: string, captureDisposition?: DrainCaptureDisposition, claimedCapturePolicy?: ProviderWorkspaceCapturePolicy | null, diskBackedArchives?: boolean, releaseFailedCapture?: () => Promise<void>, workspaceId?: string): Promise<ProviderTerminationOutcome>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { settleSessionAttemptInterruptions, applySessionTurnSettlement, enqueueSessionWorkflowWake, failSessionWorkBeforeAttemptClaim, requestSessionTurnRecovery, recoverSessionDispatch, reconcileSessionAttemptQuiescence, peekSessionWork as peekSessionWorkDb, settleSessionInputWait as settleSessionInputWaitDb, countQueuedTurns, getSessionAttemptActivityRef, getSessionEvent, getSessionTurnForAttempt, expireSessionInteractionIntervention as expireSessionInteractionInterventionDb, expireSessionHumanInputRequest, markSessionAttemptQuiesced, requireSession, settleSessionIdleWithParentOutbox } from "@opengeni/db";
|
|
1
|
+
import { settleSessionAttemptInterruptions, applySessionTurnSettlement, enqueueSessionWorkflowWake, failSessionWorkBeforeAttemptClaim, blockSessionWorkBeforeAttemptClaim, requestSessionTurnRecovery, recoverSessionDispatch, reconcileSessionAttemptQuiescence, peekSessionWork as peekSessionWorkDb, settleSessionInputWait as settleSessionInputWaitDb, countQueuedTurns, getSessionAttemptActivityRef, getSessionEvent, getSessionTurnForAttempt, expireSessionInteractionIntervention as expireSessionInteractionInterventionDb, expireSessionHumanInputRequest, markSessionAttemptQuiesced, requireSession, settleSessionIdleWithParentOutbox } from "@opengeni/db";
|
|
2
2
|
import { publishDurableSessionEvents } from "@opengeni/events";
|
|
3
3
|
import { deliverFailedChildTurnToParent, notifyParentOfChildIdle } from "./parent-wake.js";
|
|
4
4
|
import { recordTurnsQueuedGauge, recordWorkerDeathRecoveryMetrics } from "../observability-metrics.js";
|
|
@@ -8,6 +8,7 @@ export type SessionStateActivityOverrides = Partial<{
|
|
|
8
8
|
applySessionTurnSettlement: typeof applySessionTurnSettlement;
|
|
9
9
|
enqueueSessionWorkflowWake: typeof enqueueSessionWorkflowWake;
|
|
10
10
|
failSessionWorkBeforeAttemptClaim: typeof failSessionWorkBeforeAttemptClaim;
|
|
11
|
+
blockSessionWorkBeforeAttemptClaim: typeof blockSessionWorkBeforeAttemptClaim;
|
|
11
12
|
requestSessionTurnRecovery: typeof requestSessionTurnRecovery;
|
|
12
13
|
recoverSessionDispatch: typeof recoverSessionDispatch;
|
|
13
14
|
reconcileSessionAttemptQuiescence: typeof reconcileSessionAttemptQuiescence;
|
|
@@ -38,7 +39,61 @@ export declare function createSessionStateActivities(services: () => Promise<Con
|
|
|
38
39
|
reconcileSessionAttemptQuiescence: (input: ReconcileSessionAttemptQuiescenceInput) => Promise<ReconcileSessionAttemptQuiescenceResult>;
|
|
39
40
|
recoverDispatch: (input: RecoverDispatchInput) => Promise<RecoverDispatchResult>;
|
|
40
41
|
recoverEscapedMcpTimeout: (input: RecoverEscapedMcpTimeoutInput) => Promise<RecoverEscapedMcpTimeoutResult>;
|
|
41
|
-
peekSessionWork: (input: PeekSessionWorkInput) => Promise<
|
|
42
|
+
peekSessionWork: (input: PeekSessionWorkInput) => Promise<{
|
|
43
|
+
kind: "unavailable";
|
|
44
|
+
} | {
|
|
45
|
+
kind: "attempt-owned";
|
|
46
|
+
turnId: string;
|
|
47
|
+
attemptId: string;
|
|
48
|
+
executionGeneration: number;
|
|
49
|
+
activityRef: import("@opengeni/db").SessionAttemptActivityRef;
|
|
50
|
+
} | {
|
|
51
|
+
kind: "runnable";
|
|
52
|
+
admissionFence?: import("@opengeni/db").SessionAdmissionFence;
|
|
53
|
+
} | {
|
|
54
|
+
kind: "admission-blocked";
|
|
55
|
+
} | {
|
|
56
|
+
kind: "sandbox-lifecycle-wait";
|
|
57
|
+
ref: import("@opengeni/db").SandboxLifecycleWait;
|
|
58
|
+
} | {
|
|
59
|
+
kind: "approval-pending";
|
|
60
|
+
triggerEventId: string;
|
|
61
|
+
admissionFence?: import("@opengeni/db").SessionAdmissionFence;
|
|
62
|
+
} | {
|
|
63
|
+
kind: "approval-wait";
|
|
64
|
+
humanInputRequestId?: string;
|
|
65
|
+
interactionInterventionId?: string;
|
|
66
|
+
expiresAt?: string;
|
|
67
|
+
} | {
|
|
68
|
+
kind: "capacity-wait";
|
|
69
|
+
ref: {
|
|
70
|
+
provider?: "codex" | "xai";
|
|
71
|
+
waiterId: string;
|
|
72
|
+
generation: number;
|
|
73
|
+
nextCheckAt: string;
|
|
74
|
+
wakeRevision: number;
|
|
75
|
+
};
|
|
76
|
+
} | {
|
|
77
|
+
kind: "interruption-pending";
|
|
78
|
+
attemptId: string;
|
|
79
|
+
} | {
|
|
80
|
+
kind: "cancellation-wait";
|
|
81
|
+
attemptId: string;
|
|
82
|
+
} | {
|
|
83
|
+
kind: "input-wait";
|
|
84
|
+
disposition: "held" | "timeout" | "superseded";
|
|
85
|
+
waitTurnId: string;
|
|
86
|
+
deadlineAt: string;
|
|
87
|
+
} | {
|
|
88
|
+
kind: "idle";
|
|
89
|
+
} | {
|
|
90
|
+
kind: "attempt-owned";
|
|
91
|
+
turnId: string;
|
|
92
|
+
attemptId: string;
|
|
93
|
+
executionGeneration: number;
|
|
94
|
+
activityRef: import("@opengeni/db").SessionAttemptActivityRef;
|
|
95
|
+
ownerActivityState: "pending" | "settled" | "unknown";
|
|
96
|
+
}>;
|
|
42
97
|
settleSessionInputWait: (input: SettleSessionInputWaitInput) => Promise<SettleSessionInputWaitResult>;
|
|
43
98
|
expireSessionHumanInput: (input: ExpireSessionHumanInputInput) => Promise<ExpireSessionHumanInputResult>;
|
|
44
99
|
expireSessionInteractionIntervention: (input: ExpireSessionInteractionInterventionInput) => Promise<ExpireSessionInteractionInterventionResult>;
|