@opengeni/worker-bundle 0.16.21 → 0.17.2
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.d.ts +145 -32
- package/dist/activities/api-integrations.d.ts +21 -0
- package/dist/activities/codemode-dispatcher.d.ts +35 -0
- package/dist/activities/codemode-token-renewal.d.ts +23 -0
- package/dist/activities/codex-capacity.d.ts +5 -5
- package/dist/activities/codex-image-generation.d.ts +21 -0
- package/dist/activities/context-compaction.d.ts +3 -0
- package/dist/activities/documents.d.ts +3 -2
- package/dist/activities/environment.d.ts +11 -7
- package/dist/activities/expiring-material-renewal.d.ts +5 -3
- package/dist/activities/file-upload-reaper.d.ts +7 -2
- package/dist/activities/gateway-image-generation.d.ts +39 -0
- package/dist/activities/gateway-video-generation.d.ts +53 -0
- package/dist/activities/generated-images.d.ts +112 -0
- package/dist/activities/git-credential-renewal.d.ts +2 -2
- package/dist/activities/goals.d.ts +2 -2
- package/dist/activities/google-drive-changes.d.ts +99 -0
- package/dist/activities/image-generation-operation.d.ts +74 -0
- package/dist/activities/image-generation-references.d.ts +25 -0
- package/dist/activities/knowledge-source-sync-driver.d.ts +23 -0
- package/dist/activities/knowledge-source-sync.d.ts +75 -0
- package/dist/activities/packs.d.ts +13 -26
- package/dist/activities/parent-wake.d.ts +1 -1
- package/dist/activities/retained-screenshot-reaper.d.ts +32 -0
- package/dist/activities/retained-screenshots.d.ts +129 -0
- package/dist/activities/rig-verification.d.ts +82 -5
- package/dist/activities/run-credential-renewal.d.ts +2 -2
- package/dist/activities/run-input.d.ts +5 -1
- package/dist/activities/sandbox-images.d.ts +14 -0
- package/dist/activities/sandbox-lease.d.ts +47 -9
- package/dist/activities/scheduled-tasks.d.ts +2 -2
- package/dist/activities/session-state.d.ts +4 -4
- package/dist/activities/streaming.d.ts +1 -1
- package/dist/activities/types.d.ts +71 -5
- package/dist/activities/video-generation-admission.d.ts +38 -0
- package/dist/activities/video-generation-credential.d.ts +7 -0
- package/dist/activities/video-generation-reconciliation.d.ts +13 -0
- package/dist/activities/video-media-validation.d.ts +34 -0
- package/dist/activities/video-output-retention.d.ts +36 -0
- package/dist/activities/video-reference-staging.d.ts +49 -0
- package/dist/activities/workflow-wake.d.ts +2 -2
- package/dist/activities/workspace-capture.d.ts +11 -1
- package/dist/activities-control-44KBWLSM.js +6885 -0
- package/dist/activities-control-44KBWLSM.js.map +1 -0
- package/dist/activities-control.d.ts +289 -0
- package/dist/activities-turn-K4CEDEGJ.js +14675 -0
- package/dist/activities-turn-K4CEDEGJ.js.map +1 -0
- package/dist/activities-turn.d.ts +17 -0
- package/dist/activities.d.ts +130 -147
- package/dist/activity-services.d.ts +10 -0
- package/dist/artifact-materializer-entry.d.ts +6 -0
- package/dist/artifact-materializer-entry.js +2662 -0
- package/dist/artifact-materializer-entry.js.map +1 -0
- package/dist/artifact-outbox-entry.d.ts +2 -0
- package/dist/artifact-outbox-entry.js +681 -0
- package/dist/artifact-outbox-entry.js.map +1 -0
- package/dist/chunk-E3RI3I33.js +828 -0
- package/dist/chunk-E3RI3I33.js.map +1 -0
- package/dist/chunk-GRFQTTSQ.js +448 -0
- package/dist/chunk-GRFQTTSQ.js.map +1 -0
- package/dist/chunk-KKCRGAGZ.js +3091 -0
- package/dist/chunk-KKCRGAGZ.js.map +1 -0
- package/dist/{chunk-BJUW5LCM.js → chunk-RAMNYSAW.js} +15 -12
- package/dist/chunk-RAMNYSAW.js.map +1 -0
- package/dist/concurrency.d.ts +108 -5
- package/dist/editable-artifact-hint-broker.d.ts +49 -0
- package/dist/editable-artifact-materializer-launcher.d.ts +49 -0
- package/dist/editable-artifact-materializer-service.d.ts +108 -0
- package/dist/editable-artifact-materializer-storage.d.ts +12 -0
- package/dist/editable-artifact-materializer-subprocess.d.ts +50 -0
- package/dist/editable-artifact-materializer.d.ts +262 -0
- package/dist/editable-artifact-outbox-dispatcher.d.ts +44 -0
- package/dist/editable-artifact-outbox-service.d.ts +70 -0
- package/dist/host-export.d.ts +1 -1
- package/dist/host-export.js +1 -1
- package/dist/index.d.ts +176 -10
- package/dist/index.js +675 -16460
- package/dist/index.js.map +1 -1
- package/dist/memory-pressure-guard.d.ts +57 -0
- package/dist/model-checkpoint-memory-collector.d.ts +22 -0
- package/dist/observability-metrics.d.ts +33 -0
- package/dist/sandbox-reaper-contract.d.ts +40 -0
- package/dist/sandbox-reaper-timeout.d.ts +14 -0
- package/dist/sandbox-resume.d.ts +40 -7
- package/dist/sandbox-routing.d.ts +13 -6
- package/dist/worker-service-lifecycle.d.ts +6 -2
- package/dist/workflow-bundle.js +1044 -363
- package/dist/workflows/activities.d.ts +7 -1
- package/dist/workflows/document-index.d.ts +1 -1
- package/dist/workflows/knowledge-source-sync.d.ts +13 -0
- package/dist/workflows/rig-verification.d.ts +1 -1
- package/dist/workflows/sandbox-reaper.d.ts +8 -0
- package/dist/workflows/scheduled-tasks.d.ts +1 -1
- package/dist/workflows/session.d.ts +2 -2
- package/dist/workflows/video-generation.d.ts +10 -0
- package/dist/workflows/workflow-wake.d.ts +1 -1
- package/dist/workflows.d.ts +9 -7
- package/package.json +34 -15
- package/src/activities/agent-turn.ts +1905 -559
- package/src/activities/api-integrations.ts +138 -0
- package/src/activities/codemode-dispatcher.ts +335 -0
- package/src/activities/codemode-token-renewal.ts +64 -0
- package/src/activities/codex-capacity.ts +16 -7
- package/src/activities/codex-image-generation.ts +56 -0
- package/src/activities/codex-rotation.ts +19 -5
- package/src/activities/context-compaction.ts +47 -6
- package/src/activities/documents.ts +14 -4
- package/src/activities/environment.ts +52 -60
- package/src/activities/expiring-material-renewal.ts +16 -7
- package/src/activities/file-upload-reaper.ts +34 -3
- package/src/activities/gateway-image-generation.ts +146 -0
- package/src/activities/gateway-video-generation.ts +298 -0
- package/src/activities/generated-images.ts +860 -0
- package/src/activities/git-credential-renewal.ts +3 -3
- package/src/activities/goals.ts +6 -2
- package/src/activities/google-drive-changes.ts +454 -0
- package/src/activities/image-generation-operation.ts +333 -0
- package/src/activities/image-generation-references.ts +118 -0
- package/src/activities/knowledge-source-sync-driver.ts +27 -0
- package/src/activities/knowledge-source-sync.ts +2840 -0
- package/src/activities/mcp-credentials.ts +1 -0
- package/src/activities/packs.ts +55 -55
- package/src/activities/recording.ts +4 -5
- package/src/activities/retained-screenshot-reaper.ts +202 -0
- package/src/activities/retained-screenshots.ts +1317 -0
- package/src/activities/rig-verification.ts +567 -77
- package/src/activities/run-credential-renewal.ts +9 -2
- package/src/activities/run-input.ts +40 -10
- package/src/activities/sandbox-images.ts +167 -0
- package/src/activities/sandbox-lease.ts +1065 -483
- package/src/activities/scheduled-tasks.ts +96 -7
- package/src/activities/session-state.ts +4 -4
- package/src/activities/streaming.ts +42 -3
- package/src/activities/types.ts +87 -5
- package/src/activities/video-generation-admission.ts +270 -0
- package/src/activities/video-generation-credential.ts +34 -0
- package/src/activities/video-generation-reconciliation.ts +578 -0
- package/src/activities/video-media-validation.ts +326 -0
- package/src/activities/video-output-retention.ts +314 -0
- package/src/activities/video-reference-staging.ts +263 -0
- package/src/activities/workflow-wake.ts +2 -2
- package/src/activities/workspace-capture.ts +77 -13
- package/src/activities-control.ts +54 -0
- package/src/activities-turn.ts +40 -0
- package/src/activities.ts +50 -118
- package/src/activity-services.ts +62 -0
- package/src/artifact-materializer-entry.ts +35 -0
- package/src/artifact-outbox-entry.ts +29 -0
- package/src/concurrency.ts +484 -6
- package/src/editable-artifact-hint-broker.ts +235 -0
- package/src/editable-artifact-materializer-launcher.ts +515 -0
- package/src/editable-artifact-materializer-service.ts +787 -0
- package/src/editable-artifact-materializer-storage.ts +413 -0
- package/src/editable-artifact-materializer-subprocess.ts +956 -0
- package/src/editable-artifact-materializer.ts +1289 -0
- package/src/editable-artifact-outbox-dispatcher.ts +244 -0
- package/src/editable-artifact-outbox-service.ts +438 -0
- package/src/host-export-pump.ts +28 -11
- package/src/http.ts +3 -6
- package/src/index.ts +277 -72
- package/src/memory-pressure-guard.ts +489 -0
- package/src/model-checkpoint-memory-collector.ts +116 -0
- package/src/observability-metrics.ts +202 -7
- package/src/sandbox-reaper-contract.ts +73 -0
- package/src/sandbox-reaper-timeout.ts +79 -0
- package/src/sandbox-resume.ts +331 -157
- package/src/sandbox-routing.ts +49 -39
- package/src/worker-service-lifecycle.ts +82 -12
- package/src/workflows/activities.ts +30 -0
- package/src/workflows/file-upload-reaper.ts +6 -1
- package/src/workflows/knowledge-source-sync.ts +83 -0
- package/src/workflows/sandbox-reaper.ts +183 -21
- package/src/workflows/scheduled-tasks.ts +42 -6
- package/src/workflows/video-generation.ts +36 -0
- package/src/workflows.ts +17 -1
- package/dist/activities/redaction.d.ts +0 -1
- package/dist/activities/toolspace-token-renewal.d.ts +0 -23
- package/dist/chunk-BJUW5LCM.js.map +0 -1
- package/src/activities/redaction.ts +0 -9
- package/src/activities/toolspace-token-renewal.ts +0 -57
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Settings } from "@opengeni/config";
|
|
2
|
+
import type { Observability } from "@opengeni/observability";
|
|
3
|
+
export type TurnWorkerMemoryScope = "host" | "cgroup";
|
|
4
|
+
export type TurnWorkerMemoryScopeSnapshot = {
|
|
5
|
+
scope: TurnWorkerMemoryScope;
|
|
6
|
+
usedBytes: number;
|
|
7
|
+
limitBytes: number;
|
|
8
|
+
};
|
|
9
|
+
export type TurnWorkerMemoryPressureSnapshot = {
|
|
10
|
+
processRssBytes: number;
|
|
11
|
+
processHeapUsedBytes: number;
|
|
12
|
+
processExternalBytes: number;
|
|
13
|
+
processArrayBuffersBytes: number;
|
|
14
|
+
scopes: TurnWorkerMemoryScopeSnapshot[];
|
|
15
|
+
};
|
|
16
|
+
export type TurnWorkerMemoryPressureGuard = {
|
|
17
|
+
sampleNow(): void;
|
|
18
|
+
close(): void;
|
|
19
|
+
};
|
|
20
|
+
type GuardSettings = Pick<Settings, "turnWorkerConcurrencyMode" | "turnWorkerTargetMemoryUsage" | "turnWorkerEmergencyMemoryUsage" | "turnWorkerMemoryGuardIntervalMs" | "turnWorkerMemoryGuardSustainMs">;
|
|
21
|
+
type GuardDependencies = {
|
|
22
|
+
now?: () => number;
|
|
23
|
+
sample?: () => TurnWorkerMemoryPressureSnapshot;
|
|
24
|
+
setInterval?: typeof setInterval;
|
|
25
|
+
clearInterval?: typeof clearInterval;
|
|
26
|
+
gc?: () => void;
|
|
27
|
+
};
|
|
28
|
+
type SnapshotDependencies = {
|
|
29
|
+
readText?: (path: string) => string | null;
|
|
30
|
+
hostTotalBytes?: () => number;
|
|
31
|
+
hostAvailableBytes?: () => number;
|
|
32
|
+
processMemoryUsage?: () => Pick<NodeJS.MemoryUsage, "rss" | "heapUsed" | "external" | "arrayBuffers">;
|
|
33
|
+
};
|
|
34
|
+
export type ProcessCgroupMembership = {
|
|
35
|
+
v2Path: string | null;
|
|
36
|
+
v1MemoryPath: string | null;
|
|
37
|
+
};
|
|
38
|
+
export type CgroupMemoryFilePair = {
|
|
39
|
+
currentPath: string;
|
|
40
|
+
maxPath: string;
|
|
41
|
+
};
|
|
42
|
+
export declare function parseLinuxMeminfo(value: string): {
|
|
43
|
+
totalBytes: number;
|
|
44
|
+
availableBytes: number;
|
|
45
|
+
} | null;
|
|
46
|
+
export declare function parseFiniteCgroupMemoryLimit(value: string): number | null;
|
|
47
|
+
export declare function parseProcessCgroupMembership(value: string): ProcessCgroupMembership;
|
|
48
|
+
export declare function cgroupMemoryFilePairs(membership: ProcessCgroupMembership): CgroupMemoryFilePair[];
|
|
49
|
+
export declare function readTurnWorkerMemoryPressureSnapshot(dependencies?: SnapshotDependencies): TurnWorkerMemoryPressureSnapshot;
|
|
50
|
+
export declare function turnWorkerMemoryPressureGuardEnabled(role: "control" | "turn", settings: Pick<Settings, "turnWorkerConcurrencyMode">): boolean;
|
|
51
|
+
export declare function createTurnWorkerMemoryPressureGuard(input: {
|
|
52
|
+
settings: GuardSettings;
|
|
53
|
+
observability: Observability;
|
|
54
|
+
drain: () => void;
|
|
55
|
+
dependencies?: GuardDependencies;
|
|
56
|
+
}): TurnWorkerMemoryPressureGuard;
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Observability } from "@opengeni/observability";
|
|
2
|
+
export declare const MODEL_CHECKPOINT_GC_PRESSURE_BYTES: number;
|
|
3
|
+
export declare const MODEL_CHECKPOINT_GC_COOLDOWN_MS = 30000;
|
|
4
|
+
type ProcessMemory = Pick<NodeJS.MemoryUsage, "heapUsed" | "external">;
|
|
5
|
+
type ModelCheckpointMemoryCollectorDependencies = {
|
|
6
|
+
now?: () => number;
|
|
7
|
+
memoryUsage?: () => ProcessMemory;
|
|
8
|
+
gc?: () => void;
|
|
9
|
+
setTimeout?: typeof setTimeout;
|
|
10
|
+
};
|
|
11
|
+
export type ModelCheckpointMemoryCollector = {
|
|
12
|
+
schedule(observability: Observability): void;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Reclaim request serialization and stream buffers only after one model
|
|
16
|
+
* response has crossed the durable conversation checkpoint. The callback runs
|
|
17
|
+
* on a later task so the completed response's stack can unwind first. Active
|
|
18
|
+
* turns and their exact model context remain strongly reachable and are never
|
|
19
|
+
* shortened, restarted, or rewritten by this process-local collection.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createModelCheckpointMemoryCollector(dependencies?: ModelCheckpointMemoryCollectorDependencies): ModelCheckpointMemoryCollector;
|
|
22
|
+
export {};
|
|
@@ -9,6 +9,22 @@ export type CreditBalanceGauge = {
|
|
|
9
9
|
accountId: string;
|
|
10
10
|
balanceMicros: number;
|
|
11
11
|
};
|
|
12
|
+
export type TurnTaskQueueStats = {
|
|
13
|
+
/** Temporal activity tasks ready for a turn worker to accept. */
|
|
14
|
+
eligibleBacklog: number;
|
|
15
|
+
oldestBacklogAgeSeconds: number;
|
|
16
|
+
tasksAddRate: number;
|
|
17
|
+
tasksDispatchRate: number;
|
|
18
|
+
};
|
|
19
|
+
export type TemporalTurnTaskQueueStats = {
|
|
20
|
+
approximateBacklogCount?: unknown;
|
|
21
|
+
approximateBacklogAge?: {
|
|
22
|
+
seconds?: unknown;
|
|
23
|
+
nanos?: unknown;
|
|
24
|
+
} | null;
|
|
25
|
+
tasksAddRate?: unknown;
|
|
26
|
+
tasksDispatchRate?: unknown;
|
|
27
|
+
} | null;
|
|
12
28
|
export declare function observabilityEventLogger(observability: Observability): EventLogger;
|
|
13
29
|
export declare function runtimeMetricsHooksForObservability(observability: Observability): RuntimeMetricsHooks;
|
|
14
30
|
/**
|
|
@@ -65,6 +81,23 @@ export declare class TurnLifecycleMetrics {
|
|
|
65
81
|
private now;
|
|
66
82
|
}
|
|
67
83
|
export declare function recordTurnsQueuedGauge(observability: Observability, value: number): void;
|
|
84
|
+
/**
|
|
85
|
+
* Record the authoritative turn activity queue rather than aggregate Postgres
|
|
86
|
+
* prompts. A paused human prompt is durable queue truth but is not runnable and
|
|
87
|
+
* never reaches this Temporal task queue. DescribeTaskQueue's approximate
|
|
88
|
+
* backlog count and age are explicitly documented by Temporal as autoscaling
|
|
89
|
+
* signals.
|
|
90
|
+
*/
|
|
91
|
+
export declare function recordTurnTaskQueueStats(observability: Observability, stats: TurnTaskQueueStats): void;
|
|
92
|
+
export declare function normalizeTurnTaskQueueStats(stats: TemporalTurnTaskQueueStats | undefined): TurnTaskQueueStats;
|
|
93
|
+
export declare function startTurnCapacityMonitor(input: {
|
|
94
|
+
observability: Observability;
|
|
95
|
+
read: () => Promise<TurnTaskQueueStats>;
|
|
96
|
+
intervalMs?: number;
|
|
97
|
+
now?: () => number;
|
|
98
|
+
}): {
|
|
99
|
+
close: () => Promise<void>;
|
|
100
|
+
};
|
|
68
101
|
export declare function recordSandboxLeaseGauges(observability: Observability, counts: Partial<Record<SandboxLeaseLiveness, number>>): void;
|
|
69
102
|
export declare const SANDBOX_INVENTORY_PROJECTION_DOMAINS: readonly ["leases", "checkpoint_artifacts", "rotation_backlog", "retained_processes", "expired_drains"];
|
|
70
103
|
export type SandboxInventoryProjectionDomain = (typeof SANDBOX_INVENTORY_PROJECTION_DOMAINS)[number];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const SANDBOX_REAPER_SCAN_ACTIVITY_TIMEOUT_MS: number;
|
|
2
|
+
export declare const SANDBOX_DRAIN_FAST_ACTIVITY_TIMEOUT_MS: number;
|
|
3
|
+
export declare const SANDBOX_DRAIN_EXTENDED_ACTIVITY_TIMEOUT_MS: number;
|
|
4
|
+
export declare const SANDBOX_DRAIN_SETTLEMENT_MARGIN_MS = 60000;
|
|
5
|
+
export declare const SANDBOX_REAPER_ACTIVITY_HEARTBEAT_TIMEOUT_MS = 20000;
|
|
6
|
+
export declare const SANDBOX_REAPER_ACTIVITY_HEARTBEAT_INTERVAL_MS = 5000;
|
|
7
|
+
export declare const SANDBOX_REAPER_CHILD_DISPATCH_LIMIT = 500;
|
|
8
|
+
export declare const SANDBOX_REAPER_V2_WORKFLOW_ID = "opengeni-sandbox-lease-reaper-v2";
|
|
9
|
+
export declare const SANDBOX_REAPER_MAINTENANCE_WORKFLOW_ID = "opengeni-sandbox-lease-maintenance-v1";
|
|
10
|
+
export declare const SANDBOX_LIFECYCLE_TASK_QUEUE_SUFFIX = "-sandbox-lifecycle-v1";
|
|
11
|
+
export declare function sandboxLifecycleTaskQueue(baseTaskQueue: string): string;
|
|
12
|
+
export type SandboxDrainTimeoutClass = "fast" | "extended";
|
|
13
|
+
export type SandboxDrainTarget = {
|
|
14
|
+
workspaceId: string;
|
|
15
|
+
sandboxGroupId: string;
|
|
16
|
+
instanceId: string | null;
|
|
17
|
+
leaseEpoch: number;
|
|
18
|
+
};
|
|
19
|
+
export type SandboxDrainActivityInput = {
|
|
20
|
+
target: SandboxDrainTarget;
|
|
21
|
+
timeoutClass: SandboxDrainTimeoutClass;
|
|
22
|
+
/** Provider operation budget frozen when the durable child is created. A
|
|
23
|
+
* rolling config change cannot make an existing fast child retry forever. */
|
|
24
|
+
snapshotTimeoutMs: number;
|
|
25
|
+
captureTimeoutMs: number;
|
|
26
|
+
/** Stable logical teardown operation; every Temporal activity retry keeps it
|
|
27
|
+
* while receiving a distinct exact capture-attempt id. */
|
|
28
|
+
operationId: string;
|
|
29
|
+
};
|
|
30
|
+
export type SandboxDrainWorkflowInput = Omit<SandboxDrainActivityInput, "operationId">;
|
|
31
|
+
export type SandboxLeaseSweepMaintenanceInput = {
|
|
32
|
+
examined: number;
|
|
33
|
+
started: number;
|
|
34
|
+
alreadyRunning: number;
|
|
35
|
+
startFailed: number;
|
|
36
|
+
rotationsRequested: number;
|
|
37
|
+
};
|
|
38
|
+
export declare function sandboxDrainTimeoutClass(captureTimeoutMs: number): SandboxDrainTimeoutClass;
|
|
39
|
+
export declare function sandboxDrainActivityTimeoutMs(timeoutClass: SandboxDrainTimeoutClass): number;
|
|
40
|
+
export declare function sandboxDrainWorkflowId(target: SandboxDrainTarget): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Settings } from "@opengeni/config";
|
|
2
|
+
import { type SandboxDrainTimeoutClass } from "./sandbox-reaper-contract.js";
|
|
3
|
+
export declare function sandboxDrainTiming(settings: Pick<Settings, "sandboxSnapshotTimeoutMs">): {
|
|
4
|
+
snapshotTimeoutMs: number;
|
|
5
|
+
captureTimeoutMs: number;
|
|
6
|
+
timeoutClass: SandboxDrainTimeoutClass;
|
|
7
|
+
activityTimeoutMs: number;
|
|
8
|
+
};
|
|
9
|
+
export declare function assertSandboxReaperActivityTimeout(settings: Pick<Settings, "sandboxSnapshotTimeoutMs">): void;
|
|
10
|
+
export declare function assertSandboxDrainInputTiming(input: {
|
|
11
|
+
timeoutClass: SandboxDrainTimeoutClass;
|
|
12
|
+
snapshotTimeoutMs: number;
|
|
13
|
+
captureTimeoutMs: number;
|
|
14
|
+
}): void;
|
package/dist/sandbox-resume.d.ts
CHANGED
|
@@ -19,6 +19,10 @@ export declare function isRetryableDegradedRestore(restore: {
|
|
|
19
19
|
export type SandboxResumeServices = {
|
|
20
20
|
db: Database;
|
|
21
21
|
settings: Settings;
|
|
22
|
+
/** Exact settings before a verified rig provider image overlaid the logical
|
|
23
|
+
* pack/deployment image. Fresh-create NotFound fallback must preserve an
|
|
24
|
+
* ID-only logical base instead of selecting the provider default. */
|
|
25
|
+
logicalFallbackSettings?: Settings;
|
|
22
26
|
sandboxMetrics?: RuntimeMetricsHooks;
|
|
23
27
|
/**
|
|
24
28
|
* The logical turn-attempt lifetime, not merely the provider request lifetime.
|
|
@@ -88,15 +92,36 @@ export type ResumedTurnSandbox = {
|
|
|
88
92
|
established: EstablishedSandboxSession;
|
|
89
93
|
/** The lease_epoch this turn holds; the heartbeat/fence token. */
|
|
90
94
|
leaseEpoch: number;
|
|
91
|
-
/**
|
|
92
|
-
*
|
|
93
|
-
|
|
95
|
+
/** Staged idempotent release. The ordinary form immediately prevents a
|
|
96
|
+
* holder/timer leak. The quiesced form may be called later—even after the
|
|
97
|
+
* ordinary form—to repair null-outcome admissions only after every exact
|
|
98
|
+
* attempt-owned workspace writer has physically drained. NEVER stops the box. */
|
|
99
|
+
release: (options?: {
|
|
100
|
+
workspaceWritersQuiesced?: boolean;
|
|
101
|
+
}) => Promise<void>;
|
|
94
102
|
};
|
|
95
|
-
export declare class SandboxWarmingTimeoutError extends Error {
|
|
103
|
+
export declare abstract class SandboxWarmingTimeoutError extends Error {
|
|
96
104
|
readonly backend: string;
|
|
97
105
|
readonly timeoutMs: number;
|
|
98
|
-
readonly
|
|
99
|
-
|
|
106
|
+
readonly stage: "exec_readiness" | "sibling_warming";
|
|
107
|
+
readonly sandboxGroupId: string | null;
|
|
108
|
+
readonly instanceId: string | null;
|
|
109
|
+
abstract readonly code: "sandbox_exec_readiness_timeout" | "sandbox_sibling_warming_timeout";
|
|
110
|
+
protected constructor(backend: string, timeoutMs: number, stage: "exec_readiness" | "sibling_warming", sandboxGroupId: string | null, instanceId: string | null);
|
|
111
|
+
}
|
|
112
|
+
export declare class SandboxExecReadinessTimeoutError extends SandboxWarmingTimeoutError {
|
|
113
|
+
readonly code: "sandbox_exec_readiness_timeout";
|
|
114
|
+
constructor(backend: string, timeoutMs: number, identity?: {
|
|
115
|
+
sandboxGroupId?: string | null;
|
|
116
|
+
instanceId?: string | null;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
export declare class SandboxSiblingWarmingTimeoutError extends SandboxWarmingTimeoutError {
|
|
120
|
+
readonly code: "sandbox_sibling_warming_timeout";
|
|
121
|
+
constructor(backend: string, timeoutMs: number, identity: {
|
|
122
|
+
sandboxGroupId: string;
|
|
123
|
+
instanceId?: string | null;
|
|
124
|
+
});
|
|
100
125
|
}
|
|
101
126
|
/** The exact attached caller that won warm->cold after proving the provider
|
|
102
127
|
* instance gone. It is a lease supersession (the same logical turn recovers),
|
|
@@ -111,7 +136,15 @@ export declare class SandboxLeaseInstanceLostError extends SandboxLeaseSupersede
|
|
|
111
136
|
* returns, so it cannot bound that initial RPC. Probe it before publishing the
|
|
112
137
|
* lease as warm and enforce our own wall-clock deadline.
|
|
113
138
|
*/
|
|
114
|
-
export declare function waitForSandboxExecReadiness(established: EstablishedSandboxSession, timeoutMs?: number
|
|
139
|
+
export declare function waitForSandboxExecReadiness(established: EstablishedSandboxSession, timeoutMs?: number, identity?: {
|
|
140
|
+
sandboxGroupId?: string | null;
|
|
141
|
+
}): Promise<void>;
|
|
142
|
+
export declare function safeSnapshotError(error: unknown): {
|
|
143
|
+
errorClass: "SnapshotOperationError";
|
|
144
|
+
errorCode: "snapshot_operation_failed";
|
|
145
|
+
status?: number;
|
|
146
|
+
origin: "sandbox-resume";
|
|
147
|
+
};
|
|
115
148
|
export declare function waitForWarmSnapshot(snapshot: Promise<unknown>, timeoutMs: number, signal?: AbortSignal): Promise<boolean>;
|
|
116
149
|
/**
|
|
117
150
|
* MID-SESSION /workspace snapshot (sandbox-file-persistence). The reaper's
|
|
@@ -31,6 +31,14 @@ export type RoutingWiringServices = {
|
|
|
31
31
|
established: EstablishedSandboxSession;
|
|
32
32
|
leaseEpoch: number;
|
|
33
33
|
}) => void;
|
|
34
|
+
/** Cancel bounded capture waits with the owning turn activity. */
|
|
35
|
+
waitSignal?: AbortSignal;
|
|
36
|
+
};
|
|
37
|
+
/** Worker-turn routing may final-ack streamed command output, so it must always
|
|
38
|
+
* carry the turn's durable frontier journal. Non-turn helpers may still omit it
|
|
39
|
+
* through the broader service shape above. */
|
|
40
|
+
type TurnRoutingWiringServices = RoutingWiringServices & {
|
|
41
|
+
opJournal: OpStreamJournal;
|
|
34
42
|
};
|
|
35
43
|
export type RoutingWiringIds = {
|
|
36
44
|
workspaceId: string;
|
|
@@ -91,8 +99,8 @@ export type RoutingWiringIds = {
|
|
|
91
99
|
export declare function relayConfigFromSettings(settings: Settings): SelfhostedRelayConfig;
|
|
92
100
|
/** The selfhosted CONTROL vs EXEC op deadlines for a turn, from settings. Control
|
|
93
101
|
* ops (ping/fs/desktop/pty) stay on the short timeout so machine liveness is never
|
|
94
|
-
* masked by a slow op; exec
|
|
95
|
-
*
|
|
102
|
+
* masked by a slow op; exec has its own setting and defaults to no duration wall.
|
|
103
|
+
* Threaded into every turn-path session build + resolver. */
|
|
96
104
|
export declare function selfhostedTimeoutsFromSettings(settings: Settings): {
|
|
97
105
|
timeoutMs: number;
|
|
98
106
|
execTimeoutMs: number;
|
|
@@ -110,8 +118,8 @@ export declare function providerIdentityFromResumeState(resumeState: Record<stri
|
|
|
110
118
|
* SelfhostedSession bound to the target's enrollment agentId, fenced under the
|
|
111
119
|
* swap's active_epoch.
|
|
112
120
|
*/
|
|
113
|
-
export declare function wrapTurnBoxWithRouting(services:
|
|
114
|
-
export declare function wrapLazyTurnBoxWithRouting(services:
|
|
121
|
+
export declare function wrapTurnBoxWithRouting(services: TurnRoutingWiringServices, ids: RoutingWiringIds, established: EstablishedSandboxSession): EstablishedSandboxSession;
|
|
122
|
+
export declare function wrapLazyTurnBoxWithRouting(services: TurnRoutingWiringServices, ids: RoutingWiringIds, args: {
|
|
115
123
|
client: EstablishedSandboxSession["client"];
|
|
116
124
|
backendId: string;
|
|
117
125
|
agentDefaultManifest: unknown;
|
|
@@ -143,8 +151,7 @@ export type SelfhostedTurnSessionArgs = {
|
|
|
143
151
|
/** The session working directory (per-session pointer). Null ⇒ workspace_root. */
|
|
144
152
|
workingDir: string | null;
|
|
145
153
|
};
|
|
146
|
-
|
|
147
|
-
export declare function establishSelfhostedTurnSession(services: RoutingWiringServices, args: SelfhostedTurnSessionArgs | LegacySelfhostedTurnSessionArgs): Promise<EstablishedSandboxSession>;
|
|
154
|
+
export declare function establishSelfhostedTurnSession(services: RoutingWiringServices, args: SelfhostedTurnSessionArgs): Promise<EstablishedSandboxSession>;
|
|
148
155
|
/** Whether the routing proxy should wrap the turn box: the hot-swap feature is
|
|
149
156
|
* gated by the selfhosted flag (the active pointer + swap tools are only
|
|
150
157
|
* meaningful when selfhosted is enabled). With the flag off the established
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import type { Observability } from "@opengeni/observability";
|
|
2
|
-
import type { WorkerLifecycleState } from "./http";
|
|
2
|
+
import type { WorkerLifecycleState } from "./http.js";
|
|
3
3
|
export declare function constructWithOwnedConnection<Connection, Result>(connect: () => Promise<Connection>, construct: (connection: Connection) => Promise<Result>, close: (connection: Connection) => Promise<void>): Promise<Result>;
|
|
4
4
|
export type WorkerRunTarget = {
|
|
5
5
|
run(): Promise<void>;
|
|
6
6
|
shutdown(): void;
|
|
7
7
|
};
|
|
8
|
+
/** One process may poll several disjoint Temporal queues, but it still has one
|
|
9
|
+
* host lifecycle. Start and stop every poller as a unit; a failed poller drains
|
|
10
|
+
* its siblings and preserves the original failure. */
|
|
11
|
+
export declare function combineWorkerRunTargets(targets: readonly WorkerRunTarget[]): WorkerRunTarget;
|
|
8
12
|
export type WorkerServiceLifecycle = {
|
|
9
13
|
state(): WorkerLifecycleState;
|
|
10
14
|
run(): Promise<void>;
|
|
11
|
-
drain(reason?: string):
|
|
15
|
+
drain(reason?: string): boolean;
|
|
12
16
|
close(): Promise<void>;
|
|
13
17
|
};
|
|
14
18
|
export declare function createWorkerServiceLifecycle(input: {
|