@opengeni/worker-bundle 0.20.3 → 0.22.1-canary.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/admission.d.ts +52 -0
- package/dist/activities/agent-turn/agent-build.d.ts +89 -0
- package/dist/activities/agent-turn/claim.d.ts +67 -0
- package/dist/activities/agent-turn/codex-capacity.d.ts +40 -0
- package/dist/activities/agent-turn/codex.d.ts +32 -0
- package/dist/activities/agent-turn/compaction-prep.d.ts +88 -0
- package/dist/activities/agent-turn/credential-leases.d.ts +56 -0
- package/dist/activities/agent-turn/errors.d.ts +253 -0
- package/dist/activities/agent-turn/failure-settlement.d.ts +33 -0
- package/dist/activities/agent-turn/file-resources.d.ts +37 -0
- package/dist/activities/agent-turn/finalization.d.ts +42 -0
- package/dist/activities/agent-turn/github-repository-bindings.d.ts +105 -0
- package/dist/activities/agent-turn/governance-model.d.ts +66 -0
- package/dist/activities/agent-turn/history-sink.d.ts +52 -0
- package/dist/activities/agent-turn/history.d.ts +63 -0
- package/dist/activities/agent-turn/media-artifacts.d.ts +145 -0
- package/dist/activities/agent-turn/model-usage.d.ts +218 -0
- package/dist/activities/agent-turn/quiescence.d.ts +135 -0
- package/dist/activities/agent-turn/run-credentials.d.ts +84 -0
- package/dist/activities/agent-turn/run.d.ts +3 -0
- package/dist/activities/agent-turn/sandbox-establish.d.ts +93 -0
- package/dist/activities/agent-turn/sandbox-provision.d.ts +89 -0
- package/dist/activities/agent-turn/sandbox-route.d.ts +151 -0
- package/dist/activities/agent-turn/sandbox-runtime.d.ts +44 -0
- package/dist/activities/agent-turn/stream-attempt.d.ts +107 -0
- package/dist/activities/agent-turn/tool-environment.d.ts +142 -0
- package/dist/activities/agent-turn/tool-policy.d.ts +127 -0
- package/dist/activities/agent-turn/tool-result-spill.d.ts +59 -0
- package/dist/activities/agent-turn/turn-context.d.ts +144 -0
- package/dist/activities/agent-turn/xai-capacity.d.ts +2 -0
- package/dist/activities/agent-turn.d.ts +12 -954
- package/dist/activities/automations.d.ts +16 -0
- package/dist/activities/common.d.ts +1 -1
- package/dist/activities/connector-attachments.d.ts +13 -0
- package/dist/activities/documents.d.ts +1 -0
- package/dist/activities/environment.d.ts +26 -15
- package/dist/activities/generated-images.d.ts +1 -1
- package/dist/activities/git-credential-renewal.d.ts +3 -1
- package/dist/activities/goals.d.ts +4 -1
- package/dist/activities/google-drive-provider.d.ts +29 -0
- package/dist/activities/google-drive-publication.d.ts +17 -4
- package/dist/activities/incident-telemetry-authority.d.ts +52 -0
- package/dist/activities/incident-telemetry-preflight.d.ts +71 -0
- package/dist/activities/knowledge-source-sync.d.ts +4 -0
- package/dist/activities/mcp-credentials.d.ts +9 -3
- package/dist/activities/open-suffix-resume.d.ts +77 -0
- package/dist/activities/packs.d.ts +3 -11
- package/dist/activities/parent-wake.d.ts +19 -0
- package/dist/activities/retained-screenshot-reaper.d.ts +1 -1
- package/dist/activities/retained-screenshots.d.ts +1 -1
- package/dist/activities/rig-verification.d.ts +1 -1
- package/dist/activities/run-input.d.ts +9 -10
- package/dist/activities/sandbox-images.d.ts +1 -14
- package/dist/activities/sandbox-lease.d.ts +21 -3
- package/dist/activities/scheduled-tasks.d.ts +47 -0
- package/dist/activities/types.d.ts +23 -2
- package/dist/activities/video-media-validation.d.ts +1 -1
- package/dist/activities/video-output-retention.d.ts +1 -2
- package/dist/activities/xai-auth.d.ts +3 -0
- package/dist/{activities-control-BJSDRSIP.js → activities-control-DKG22ONJ.js} +2646 -551
- package/dist/activities-control-DKG22ONJ.js.map +1 -0
- package/dist/activities-control.d.ts +6 -2
- package/dist/activities-turn-4IMC3MAA.js +21326 -0
- package/dist/activities-turn-4IMC3MAA.js.map +1 -0
- package/dist/activities.d.ts +7 -3
- package/dist/artifact-materializer-entry.js +41 -22
- package/dist/artifact-materializer-entry.js.map +1 -1
- package/dist/{chunk-N5TJIFCE.js → chunk-CE7TPKBS.js} +468 -1
- package/dist/chunk-CE7TPKBS.js.map +1 -0
- package/dist/chunk-CNYGVRKF.js +4698 -0
- package/dist/chunk-CNYGVRKF.js.map +1 -0
- package/dist/connection-provider-use.d.ts +18 -0
- package/dist/editable-artifact-materializer.d.ts +4 -3
- package/dist/github-rest-mcp.d.ts +26 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.js +58 -14
- package/dist/index.js.map +1 -1
- package/dist/knowledge-source-sync-activity-policy.d.ts +2 -0
- package/dist/model-context-contributions.d.ts +8 -4
- package/dist/observability-metrics.d.ts +63 -4
- package/dist/opensandbox-kubernetes-inventory.d.ts +21 -0
- package/dist/personal-github-git-credentials.d.ts +9 -0
- package/dist/pr-review-credentials.d.ts +6 -0
- package/dist/sandbox-archive-storage.d.ts +45 -0
- package/dist/sandbox-resume.d.ts +65 -6
- package/dist/sandbox-routing.d.ts +38 -2
- package/dist/scheduled-alert-occurrence.d.ts +33 -0
- package/dist/workflow-bundle.js +87 -28
- package/dist/workflows/activities.d.ts +1 -0
- package/dist/workflows/automations.d.ts +6 -0
- package/dist/workflows/document-index.d.ts +1 -0
- package/dist/workflows.d.ts +1 -0
- package/package.json +17 -17
- package/src/activities/agent-turn/admission.ts +292 -0
- package/src/activities/agent-turn/agent-build.ts +802 -0
- package/src/activities/agent-turn/claim.ts +590 -0
- package/src/activities/agent-turn/codex-capacity.ts +720 -0
- package/src/activities/agent-turn/codex.ts +94 -0
- package/src/activities/agent-turn/compaction-prep.ts +722 -0
- package/src/activities/agent-turn/credential-leases.ts +240 -0
- package/src/activities/agent-turn/errors.ts +1068 -0
- package/src/activities/agent-turn/failure-settlement.ts +1436 -0
- package/src/activities/agent-turn/file-resources.ts +227 -0
- package/src/activities/agent-turn/finalization.ts +754 -0
- package/src/activities/agent-turn/github-repository-bindings.ts +300 -0
- package/src/activities/agent-turn/governance-model.ts +465 -0
- package/src/activities/agent-turn/history-sink.ts +139 -0
- package/src/activities/agent-turn/history.ts +200 -0
- package/src/activities/agent-turn/media-artifacts.ts +359 -0
- package/src/activities/agent-turn/model-usage.ts +823 -0
- package/src/activities/agent-turn/quiescence.ts +353 -0
- package/src/activities/agent-turn/run-credentials.ts +761 -0
- package/src/activities/agent-turn/run.ts +1530 -0
- package/src/activities/agent-turn/sandbox-establish.ts +1207 -0
- package/src/activities/agent-turn/sandbox-provision.ts +569 -0
- package/src/activities/agent-turn/sandbox-route.ts +358 -0
- package/src/activities/agent-turn/sandbox-runtime.ts +731 -0
- package/src/activities/agent-turn/stream-attempt.ts +1670 -0
- package/src/activities/agent-turn/tool-environment.ts +729 -0
- package/src/activities/agent-turn/tool-policy.ts +216 -0
- package/src/activities/agent-turn/tool-result-spill.ts +265 -0
- package/src/activities/agent-turn/turn-context.ts +281 -0
- package/src/activities/agent-turn/xai-capacity.ts +229 -0
- package/src/activities/agent-turn.ts +12 -12701
- package/src/activities/api-integrations.ts +3 -0
- package/src/activities/automations.ts +214 -0
- package/src/activities/codemode-dispatcher.ts +12 -1
- package/src/activities/common.ts +1 -5
- package/src/activities/connector-attachments.ts +168 -0
- package/src/activities/context-compaction.ts +18 -0
- package/src/activities/environment.ts +151 -55
- package/src/activities/generated-images.ts +26 -11
- package/src/activities/git-credential-renewal.ts +13 -3
- package/src/activities/goals.ts +85 -19
- package/src/activities/google-drive-provider.ts +178 -0
- package/src/activities/google-drive-publication.ts +147 -49
- package/src/activities/incident-telemetry-authority.ts +327 -0
- package/src/activities/incident-telemetry-preflight.ts +317 -0
- package/src/activities/knowledge-source-sync.ts +178 -37
- package/src/activities/mcp-credentials.ts +191 -17
- package/src/activities/open-suffix-resume.ts +422 -0
- package/src/activities/packs.ts +12 -60
- package/src/activities/parent-wake.ts +64 -14
- package/src/activities/retained-screenshot-reaper.ts +6 -3
- package/src/activities/retained-screenshots.ts +15 -47
- package/src/activities/rig-verification.ts +1 -1
- package/src/activities/run-input.ts +102 -142
- package/src/activities/sandbox-images.ts +7 -166
- package/src/activities/sandbox-lease.ts +406 -15
- package/src/activities/scheduled-tasks.ts +2103 -411
- package/src/activities/session-state.ts +10 -2
- package/src/activities/types.ts +32 -2
- package/src/activities/video-media-validation.ts +3 -3
- package/src/activities/video-output-retention.ts +2 -57
- package/src/activities/xai-auth.ts +8 -0
- package/src/activities-control.ts +2 -0
- package/src/activities.ts +3 -0
- package/src/activity-services.ts +13 -4
- package/src/connection-provider-use.ts +36 -0
- package/src/editable-artifact-materializer-subprocess.ts +25 -14
- package/src/editable-artifact-materializer.ts +29 -18
- package/src/github-rest-mcp.ts +713 -0
- package/src/http.ts +16 -6
- package/src/index.ts +40 -5
- package/src/knowledge-source-sync-activity-policy.ts +2 -0
- package/src/model-context-contributions.ts +33 -10
- package/src/observability-metrics.ts +357 -0
- package/src/opensandbox-kubernetes-inventory.ts +292 -0
- package/src/personal-github-git-credentials.ts +331 -0
- package/src/pr-review-credentials.ts +163 -0
- package/src/sandbox-archive-storage.ts +159 -0
- package/src/sandbox-resume.ts +449 -63
- package/src/sandbox-routing.ts +314 -16
- package/src/scheduled-alert-occurrence.ts +176 -0
- package/src/workflows/activities.ts +18 -2
- package/src/workflows/automations.ts +11 -0
- package/src/workflows/session.ts +13 -3
- package/src/workflows.ts +1 -0
- package/dist/activities-control-BJSDRSIP.js.map +0 -1
- package/dist/activities-turn-J5YO7XXX.js +0 -17243
- package/dist/activities-turn-J5YO7XXX.js.map +0 -1
- package/dist/chunk-N5TJIFCE.js.map +0 -1
- package/dist/chunk-P6Z2SLAA.js +0 -3092
- package/dist/chunk-P6Z2SLAA.js.map +0 -1
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { type ComputerToolMode, type LazyToolTransport } from "@opengeni/runtime";
|
|
2
|
+
import { type ModelProviderApi, type RegistryProviderKind, type Settings } from "@opengeni/config";
|
|
3
|
+
import { type ModelAttachmentInputPolicy } from "../run-input.js";
|
|
4
|
+
export declare function shouldStartOnTurnRecording(params: {
|
|
5
|
+
recordingEnabled: boolean;
|
|
6
|
+
desktopEnabled: boolean;
|
|
7
|
+
establishedBackendId: string;
|
|
8
|
+
effectiveBackend: Settings["sandboxBackend"] | undefined;
|
|
9
|
+
}): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Decide the EXPLICIT computer-use tool transport for THIS turn.
|
|
12
|
+
*
|
|
13
|
+
* Computer-use is ordinary `computer_*` function tools bound to the live
|
|
14
|
+
* desktop. The worker picks the mode from the resolved provider so the runtime
|
|
15
|
+
* never string-sniffs the model instance:
|
|
16
|
+
* • catalogue `inputModalities` must include `image`, or computer-use is off
|
|
17
|
+
* • Responses wires (Azure/OpenAI, Gateway, Codex, legacy client) →
|
|
18
|
+
* "function-image": screenshot results are structured `{type:'image'}`
|
|
19
|
+
* • Chat Completions → "disabled": tool results on that wire are text, so a
|
|
20
|
+
* screenshot would become a base64 string rather than an image the model sees
|
|
21
|
+
*
|
|
22
|
+
* Pure + exported so the mapping is unit-testable without a live turn.
|
|
23
|
+
*/
|
|
24
|
+
export declare function computerToolModeForTurn(resolvedModel: {
|
|
25
|
+
provider: {
|
|
26
|
+
kind: RegistryProviderKind;
|
|
27
|
+
api: ModelProviderApi;
|
|
28
|
+
};
|
|
29
|
+
configured: {
|
|
30
|
+
capabilities: {
|
|
31
|
+
inputModalities: string[];
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
} | null): ComputerToolMode;
|
|
35
|
+
/** Gateway models do not advertise OpenAI's hosted apply_patch/view_image tool types. */
|
|
36
|
+
export declare function structuredToolTransportForTurn(resolvedModel: {
|
|
37
|
+
provider: {
|
|
38
|
+
kind: RegistryProviderKind;
|
|
39
|
+
};
|
|
40
|
+
} | null): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Progressive tool disclosure is universal for supported OpenGeni turns; only
|
|
43
|
+
* its contained transport differs. Codex keeps its native path, built-in direct
|
|
44
|
+
* OpenAI/Azure Responses use native client tool search, and every other ordinary
|
|
45
|
+
* function-calling provider uses OpenGeni's stable search/invoke dispatcher.
|
|
46
|
+
*/
|
|
47
|
+
export declare function lazyToolTransportForTurn(resolvedModel: {
|
|
48
|
+
provider: {
|
|
49
|
+
id: string;
|
|
50
|
+
kind: RegistryProviderKind;
|
|
51
|
+
api: ModelProviderApi;
|
|
52
|
+
wireProfile: "openai" | "azure-openai";
|
|
53
|
+
builtin: boolean;
|
|
54
|
+
baseUrl?: string | undefined;
|
|
55
|
+
};
|
|
56
|
+
} | null): LazyToolTransport;
|
|
57
|
+
/** Only brand-new lazy-capable turns may overlap non-eager tool preparation. */
|
|
58
|
+
export declare function shouldDeferNonEagerToolPreparation(args: {
|
|
59
|
+
lazyToolTransport: LazyToolTransport | null;
|
|
60
|
+
progressiveDisclosureEnabled: boolean;
|
|
61
|
+
artifactRuntimeAvailable: boolean;
|
|
62
|
+
triggerKind: "next" | "approval";
|
|
63
|
+
triggerType: string;
|
|
64
|
+
}): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Native web search is a runtime capability, not part of the session's MCP
|
|
67
|
+
* allow-list. Attach it whenever the resolved provider advertises runnable
|
|
68
|
+
* support. The null model is the legacy built-in Responses path, whose
|
|
69
|
+
* deployment flag is its provider capability gate. There is deliberately no
|
|
70
|
+
* cross-provider or sandbox/curl fallback.
|
|
71
|
+
*/
|
|
72
|
+
export declare function hostedWebSearchForTurn(resolvedModel: {
|
|
73
|
+
configured: {
|
|
74
|
+
hostedWebSearch: boolean;
|
|
75
|
+
};
|
|
76
|
+
} | null, deploymentWebSearchEnabled: boolean): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Image generation is an optional connected-account capability. A delegated
|
|
79
|
+
* subscription may still authorize the text model without carrying the local
|
|
80
|
+
* credential identity required for paid image operations; that must narrow the
|
|
81
|
+
* tool catalog, not reject an otherwise valid turn.
|
|
82
|
+
*/
|
|
83
|
+
export declare function connectedSubscriptionImageGenerationAuthority<T>(credentialContext: T | null | undefined, credentialId: string | null | undefined): {
|
|
84
|
+
credentialContext: T;
|
|
85
|
+
credentialId: string;
|
|
86
|
+
} | null;
|
|
87
|
+
/** Direct OpenAI hosted image IDs are reusable only by the exact API credential. */
|
|
88
|
+
export declare function openAiHostedImageProviderBindingForTurn(settings: Pick<Settings, "openaiProvider" | "openaiApiKey" | "openaiBaseUrl">, resolvedModel: {
|
|
89
|
+
provider: {
|
|
90
|
+
id: string;
|
|
91
|
+
kind: RegistryProviderKind;
|
|
92
|
+
builtin: boolean;
|
|
93
|
+
baseUrl?: string | undefined;
|
|
94
|
+
};
|
|
95
|
+
configured: {
|
|
96
|
+
capabilities: {
|
|
97
|
+
hostedTools: {
|
|
98
|
+
imageGeneration: {
|
|
99
|
+
runnable: boolean;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
} | null): {
|
|
105
|
+
providerId: string;
|
|
106
|
+
providerBindingHash: string;
|
|
107
|
+
} | null;
|
|
108
|
+
/** Exact model-catalog modality gate; null preserves the legacy built-in path. */
|
|
109
|
+
export declare function modelSupportsImageInputForTurn(resolvedModel: {
|
|
110
|
+
configured: {
|
|
111
|
+
capabilities?: {
|
|
112
|
+
inputModalities: string[];
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
} | null): boolean;
|
|
116
|
+
/** Image support is catalogue-driven; document bytes are never `input_file`. */
|
|
117
|
+
export declare function modelAttachmentInputPolicyForTurn(resolvedModel: {
|
|
118
|
+
provider: {
|
|
119
|
+
api: ModelProviderApi;
|
|
120
|
+
};
|
|
121
|
+
configured: {
|
|
122
|
+
capabilities?: {
|
|
123
|
+
inputModalities: string[];
|
|
124
|
+
inputFileMediaTypes?: string[];
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
} | null): ModelAttachmentInputPolicy;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type AttemptToolResult as AttemptToolResultValue, type ToolResultSpilledReceipt } from "@opengeni/contracts";
|
|
2
|
+
import { type Database } from "@opengeni/db";
|
|
3
|
+
import type { Observability } from "@opengeni/observability";
|
|
4
|
+
import { type TurnToolCancellationFence } from "@opengeni/runtime";
|
|
5
|
+
import type { Settings } from "@opengeni/config";
|
|
6
|
+
import { type ObjectStorage } from "@opengeni/storage";
|
|
7
|
+
import type { ResumedTurnSandbox } from "../../sandbox-resume.js";
|
|
8
|
+
export type ToolResultSpillReceipt = ToolResultSpilledReceipt;
|
|
9
|
+
export type ToolResultSpillDeps = {
|
|
10
|
+
db: Database;
|
|
11
|
+
objectStorage: ObjectStorage | null;
|
|
12
|
+
observability: Observability;
|
|
13
|
+
accountId: string;
|
|
14
|
+
workspaceId: string;
|
|
15
|
+
attemptId: string;
|
|
16
|
+
getModelRunSettings: () => Settings;
|
|
17
|
+
getSandboxFileDownloadBackend: () => Settings["sandboxBackend"];
|
|
18
|
+
getPublish: () => ((events: Array<{
|
|
19
|
+
type: string;
|
|
20
|
+
payload: unknown;
|
|
21
|
+
}>, immediate?: boolean) => Promise<unknown>) | null;
|
|
22
|
+
toolCancellationFenceRef: {
|
|
23
|
+
current: TurnToolCancellationFence | null;
|
|
24
|
+
};
|
|
25
|
+
getResolvedSandbox: () => ResumedTurnSandbox | null;
|
|
26
|
+
getSetupBoxSession: () => unknown;
|
|
27
|
+
getSdkOwnedSandboxSession: () => unknown;
|
|
28
|
+
getSandboxGroupId: () => string | null;
|
|
29
|
+
runWorkspaceMutation: <T>(sandbox: ResumedTurnSandbox, operation: string, mutation: () => Promise<T>) => Promise<T>;
|
|
30
|
+
};
|
|
31
|
+
export declare class ToolResultSpill {
|
|
32
|
+
private readonly deps;
|
|
33
|
+
readonly receiptsCreatedThisTurn: Map<string, {
|
|
34
|
+
type: "tool_result_spilled";
|
|
35
|
+
sandboxPath: string | null;
|
|
36
|
+
fileId: string;
|
|
37
|
+
byteSize: number;
|
|
38
|
+
mediaType: "application/json";
|
|
39
|
+
}>;
|
|
40
|
+
private materializationCache;
|
|
41
|
+
constructor(deps: ToolResultSpillDeps);
|
|
42
|
+
spill: (input: {
|
|
43
|
+
operationId: string;
|
|
44
|
+
result: AttemptToolResultValue;
|
|
45
|
+
}) => Promise<AttemptToolResultValue>;
|
|
46
|
+
materializeDeferred: () => Promise<void>;
|
|
47
|
+
private materializeFile;
|
|
48
|
+
private materializeInSandbox;
|
|
49
|
+
private prepareDownload;
|
|
50
|
+
private writeDownload;
|
|
51
|
+
}
|
|
52
|
+
export declare function toolResultSpillIdentity(input: {
|
|
53
|
+
workspaceId: string;
|
|
54
|
+
attemptId: string;
|
|
55
|
+
operationId: string;
|
|
56
|
+
}): {
|
|
57
|
+
fileId: string;
|
|
58
|
+
uploadId: string;
|
|
59
|
+
};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { Settings } from "@opengeni/config";
|
|
2
|
+
import type { CodexUsageHeaderSnapshot } from "@opengeni/codex";
|
|
3
|
+
import type { AppendEventInput, ApplySessionTurnSettlementInput } from "@opengeni/db";
|
|
4
|
+
import type { ModelContextContributionSummary, SessionStatus, XaiProviderAccountAuthoritySnapshotV1 } from "@opengeni/contracts";
|
|
5
|
+
import type { EstablishedSandboxSession, OpenGeniRuntime, RunCredentialCommandSession, SelfhostedSession, TurnToolCancellationFence } from "@opengeni/runtime";
|
|
6
|
+
import type { XaiSubscriptionRequestContext } from "@opengeni/xai-subscription";
|
|
7
|
+
import type { CodemodeAttemptDispatcher } from "../codemode-dispatcher.js";
|
|
8
|
+
import type { CodemodeTokenRenewalController } from "../codemode-token-renewal.js";
|
|
9
|
+
import type { GitCredentialRenewalController } from "../git-credential-renewal.js";
|
|
10
|
+
import type { RunCredentialRenewalController } from "../run-credential-renewal.js";
|
|
11
|
+
import type { ActiveRecording } from "../recording.js";
|
|
12
|
+
import type { createRuntimeBatcher, startActivityHeartbeat } from "../streaming.js";
|
|
13
|
+
import type { RunAgentTurnResult } from "../types.js";
|
|
14
|
+
import type { TurnOutcome } from "../../observability-metrics.js";
|
|
15
|
+
import type { ResumedTurnSandbox, TurnSandboxLeaseHolderId } from "../../sandbox-resume.js";
|
|
16
|
+
import type { TurnEventPublisher } from "./model-usage.js";
|
|
17
|
+
import type { TurnSandboxProvisioner } from "./sandbox-provision.js";
|
|
18
|
+
/** Stamps the claimed turn/attempt ids onto a phase's own outcome. */
|
|
19
|
+
export type ClaimedResult = (result: Omit<Extract<RunAgentTurnResult, {
|
|
20
|
+
status: Exclude<RunAgentTurnResult["status"], "unclaimed">;
|
|
21
|
+
}>, "turnId" | "attemptId">) => RunAgentTurnResult;
|
|
22
|
+
export type TurnSettleFn = (input: {
|
|
23
|
+
events: Array<Omit<AppendEventInput, "producerId" | "producerSeq" | "turnId">>;
|
|
24
|
+
turnStatus: "queued" | "running" | "completed" | "failed" | "cancelled" | "requires_action";
|
|
25
|
+
sessionStatus: SessionStatus;
|
|
26
|
+
activeTurnId: string | null;
|
|
27
|
+
consumeRequestedCompactionFailure?: boolean;
|
|
28
|
+
runState?: ApplySessionTurnSettlementInput["runState"];
|
|
29
|
+
}) => Promise<boolean>;
|
|
30
|
+
export type TurnControlState = {
|
|
31
|
+
cancellationRequestedAt: number | null;
|
|
32
|
+
activityStatus: RunAgentTurnResult["status"] | "unknown";
|
|
33
|
+
turnMetricOutcome: TurnOutcome | null;
|
|
34
|
+
activityError: unknown;
|
|
35
|
+
acknowledgeQuiescence: boolean;
|
|
36
|
+
};
|
|
37
|
+
export type AttemptIdentityState = {
|
|
38
|
+
turnId: string | undefined;
|
|
39
|
+
triggerEventId: string | undefined;
|
|
40
|
+
executionGeneration: number;
|
|
41
|
+
providerRecoveryCount: number;
|
|
42
|
+
modelRequestStarted: boolean;
|
|
43
|
+
redispatchesAtDispatch: number;
|
|
44
|
+
triggerType: string | null;
|
|
45
|
+
};
|
|
46
|
+
export type BillingState = {
|
|
47
|
+
isCodexTurn: boolean;
|
|
48
|
+
isXaiTurn: boolean;
|
|
49
|
+
isExternallyBilledTurn: boolean;
|
|
50
|
+
};
|
|
51
|
+
export type SandboxRuntimeState = {
|
|
52
|
+
resolvedSandbox: ResumedTurnSandbox | null;
|
|
53
|
+
attemptWritersDrained: boolean;
|
|
54
|
+
lateSandboxesAwaitingWriterDrain: Set<ResumedTurnSandbox>;
|
|
55
|
+
machinePrimarySession: SelfhostedSession | null;
|
|
56
|
+
lazyOwnedSandbox: EstablishedSandboxSession | null;
|
|
57
|
+
firstModelPreparationNestedSandboxMs: number;
|
|
58
|
+
firstModelPreparationNestedSandboxPhases: Array<{
|
|
59
|
+
phase: "admission" | "provider" | "settlement" | "snapshot_wait";
|
|
60
|
+
outcome: "completed" | "failed";
|
|
61
|
+
durationSeconds: number;
|
|
62
|
+
}>;
|
|
63
|
+
turnSandboxProvisioner: TurnSandboxProvisioner<ResumedTurnSandbox> | null;
|
|
64
|
+
resumeManagedGroupBox: (() => Promise<ResumedTurnSandbox>) | null;
|
|
65
|
+
prefetchedManagedBox: Promise<ResumedTurnSandbox> | null;
|
|
66
|
+
prefetchedManagedBoxResult: ResumedTurnSandbox | null;
|
|
67
|
+
setupBoxSession: unknown;
|
|
68
|
+
sandboxHolderId: TurnSandboxLeaseHolderId | null;
|
|
69
|
+
sandboxGroupId: string | null;
|
|
70
|
+
leaseHeartbeatTimer: ReturnType<typeof setInterval> | undefined;
|
|
71
|
+
rotationInFlight: Promise<void> | null;
|
|
72
|
+
snapshotInFlight: Promise<void> | null;
|
|
73
|
+
firstProviderRequestStarted: boolean;
|
|
74
|
+
turnEndCaptureInProgress: boolean;
|
|
75
|
+
startupMilestoneBackend: Settings["sandboxBackend"] | null;
|
|
76
|
+
};
|
|
77
|
+
export type RenewalState = {
|
|
78
|
+
gitCredentialRenewals: GitCredentialRenewalController[];
|
|
79
|
+
gitCredentialRenewalClosed: boolean;
|
|
80
|
+
runCredentialRenewal: RunCredentialRenewalController | null;
|
|
81
|
+
runCredentialRenewalClosed: boolean;
|
|
82
|
+
runCredentialSession: RunCredentialCommandSession | null;
|
|
83
|
+
codemodeTokenRenewal: CodemodeTokenRenewalController | null;
|
|
84
|
+
codemodeTokenRenewalClosed: boolean;
|
|
85
|
+
publishedRunCredentialNotices: Set<string>;
|
|
86
|
+
};
|
|
87
|
+
export type RecordingState = {
|
|
88
|
+
activeRecording: ActiveRecording | null;
|
|
89
|
+
computerUseRecordingStart: Promise<void> | null;
|
|
90
|
+
didComputerUse: boolean;
|
|
91
|
+
};
|
|
92
|
+
export type EventingState = {
|
|
93
|
+
heartbeatTimer: ReturnType<typeof startActivityHeartbeat> | undefined;
|
|
94
|
+
batcher: ReturnType<typeof createRuntimeBatcher> | null;
|
|
95
|
+
preparedTools: Awaited<ReturnType<OpenGeniRuntime["prepareTools"]>> | null;
|
|
96
|
+
toolPreparationReady: Promise<void> | null;
|
|
97
|
+
toolPreparationClosing: boolean;
|
|
98
|
+
codemodeDispatcher: CodemodeAttemptDispatcher | null;
|
|
99
|
+
toolCancellationFenceRef: {
|
|
100
|
+
current: TurnToolCancellationFence | null;
|
|
101
|
+
};
|
|
102
|
+
publish: TurnEventPublisher | null;
|
|
103
|
+
settle: TurnSettleFn | null;
|
|
104
|
+
turnStartedPublished: boolean;
|
|
105
|
+
stream: Awaited<ReturnType<OpenGeniRuntime["runStream"]>> | undefined;
|
|
106
|
+
modelRunSettings: Settings;
|
|
107
|
+
firstModelRequestPreparationStartedAt: number | null;
|
|
108
|
+
firstModelRequestPreparationRecorded: boolean;
|
|
109
|
+
firstModelRequestCheckpointAt: number | null;
|
|
110
|
+
companyBrainContextContributions: readonly ModelContextContributionSummary[] | null;
|
|
111
|
+
};
|
|
112
|
+
/** Rig telemetry (M3): set once the session loads; empty string for a rig-less
|
|
113
|
+
* turn (mirrors variableSetId). Read by the activity span's finally block. */
|
|
114
|
+
export type WorkspaceRefState = {
|
|
115
|
+
variableSetId: string;
|
|
116
|
+
rigId: string;
|
|
117
|
+
rigVersionId: string;
|
|
118
|
+
};
|
|
119
|
+
export type ProviderTurnState = {
|
|
120
|
+
effectiveCodexCredentialId: string | null;
|
|
121
|
+
effectiveXaiCredentialId: string | null;
|
|
122
|
+
xaiRotationEnabled: boolean;
|
|
123
|
+
xaiAuthoritySnapshot: XaiProviderAccountAuthoritySnapshotV1 | null;
|
|
124
|
+
xaiRequestContext: XaiSubscriptionRequestContext | null;
|
|
125
|
+
xaiCredentialQuarantined: boolean;
|
|
126
|
+
priorSessionCodexCredentialId: string | null;
|
|
127
|
+
latestCodexUsage: CodexUsageHeaderSnapshot | null;
|
|
128
|
+
lastCodexRequestOpaqueArtifacts: readonly string[];
|
|
129
|
+
};
|
|
130
|
+
export type TurnContext = {
|
|
131
|
+
control: TurnControlState;
|
|
132
|
+
attempt: AttemptIdentityState;
|
|
133
|
+
billingState: BillingState;
|
|
134
|
+
sandboxState: SandboxRuntimeState;
|
|
135
|
+
renewals: RenewalState;
|
|
136
|
+
recordingState: RecordingState;
|
|
137
|
+
eventing: EventingState;
|
|
138
|
+
workspaceRefs: WorkspaceRefState;
|
|
139
|
+
providerTurn: ProviderTurnState;
|
|
140
|
+
};
|
|
141
|
+
export declare function createTurnContext(input: {
|
|
142
|
+
settings: Settings;
|
|
143
|
+
cancellationRequestedAt: number | null;
|
|
144
|
+
}): TurnContext;
|