@opengeni/worker-bundle 0.20.1 → 0.22.0-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 +66 -0
- package/dist/activities/image-generation-references.d.ts +2 -0
- 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-driver.d.ts +21 -0
- package/dist/activities/knowledge-source-sync.d.ts +33 -1
- 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 +16 -7
- 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-SMKF2OBE.js → activities-control-DKG22ONJ.js} +2946 -549
- 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 -12575
- 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/documents.ts +6 -4
- 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 +938 -0
- package/src/activities/image-generation-references.ts +11 -2
- package/src/activities/incident-telemetry-authority.ts +327 -0
- package/src/activities/incident-telemetry-preflight.ts +317 -0
- package/src/activities/knowledge-source-sync-driver.ts +23 -0
- package/src/activities/knowledge-source-sync.ts +556 -40
- 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 +128 -136
- 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-SMKF2OBE.js.map +0 -1
- package/dist/activities-turn-IDS3WEHA.js +0 -16532
- package/dist/activities-turn-IDS3WEHA.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,145 @@
|
|
|
1
|
+
import { type CodemodeTokenWriterSession, type RetainableSessionImageOutputHook, type TurnToolCancellationFence } from "@opengeni/runtime";
|
|
2
|
+
import type { Settings } from "@opengeni/config";
|
|
3
|
+
import type { ResumedTurnSandbox } from "../../sandbox-resume.js";
|
|
4
|
+
import type { SharedActivityServices } from "../types.js";
|
|
5
|
+
import { type GeneratedImageOutput, type GeneratedImageReceipt } from "../generated-images.js";
|
|
6
|
+
import type { TurnEventPublisher } from "./model-usage.js";
|
|
7
|
+
export type NativeImageGenerationRetention = {
|
|
8
|
+
providerId: string;
|
|
9
|
+
providerBindingHash: string;
|
|
10
|
+
sessionId: string;
|
|
11
|
+
turnId: string;
|
|
12
|
+
attemptId: string;
|
|
13
|
+
};
|
|
14
|
+
export type TurnMediaArtifactDeps = {
|
|
15
|
+
db: SharedActivityServices["db"];
|
|
16
|
+
objectStorage: SharedActivityServices["objectStorage"];
|
|
17
|
+
observability: SharedActivityServices["observability"];
|
|
18
|
+
accountId: string;
|
|
19
|
+
workspaceId: string;
|
|
20
|
+
sessionId: string;
|
|
21
|
+
attemptId: string;
|
|
22
|
+
getTurnId: () => string | undefined;
|
|
23
|
+
getModelRunSettings: () => Settings;
|
|
24
|
+
getPublish: () => TurnEventPublisher | null;
|
|
25
|
+
toolCancellationFenceRef: {
|
|
26
|
+
current: TurnToolCancellationFence | null;
|
|
27
|
+
};
|
|
28
|
+
getResolvedSandbox: () => ResumedTurnSandbox | null;
|
|
29
|
+
getSetupBoxSession: () => unknown;
|
|
30
|
+
getSandboxGroupId: () => string | null;
|
|
31
|
+
runWorkspaceMutation: <T>(sandbox: ResumedTurnSandbox, operation: string, mutation: () => Promise<T>) => Promise<T>;
|
|
32
|
+
};
|
|
33
|
+
export declare class TurnMediaArtifacts {
|
|
34
|
+
private readonly deps;
|
|
35
|
+
readonly retainedScreenshotReceiptsByCallId: Map<string, {
|
|
36
|
+
available: true;
|
|
37
|
+
artifactId: string;
|
|
38
|
+
kind: "assistant_completion" | "computer_screenshot" | "event_media" | "file" | "generated_image" | "generated_video" | "internal_update" | "tool_result";
|
|
39
|
+
contentType: string;
|
|
40
|
+
originalBytes: number;
|
|
41
|
+
sha256: string;
|
|
42
|
+
retainedAt: string;
|
|
43
|
+
dimensions?: {
|
|
44
|
+
width: number;
|
|
45
|
+
height: number;
|
|
46
|
+
} | undefined;
|
|
47
|
+
retention: {
|
|
48
|
+
policy: "workspace_file";
|
|
49
|
+
expiresAt: null;
|
|
50
|
+
} | {
|
|
51
|
+
policy: "session_screenshot";
|
|
52
|
+
expiresAt: string;
|
|
53
|
+
};
|
|
54
|
+
retrieval: {
|
|
55
|
+
method: "GET";
|
|
56
|
+
path: string;
|
|
57
|
+
acceptRanges: "bytes";
|
|
58
|
+
maxRangeBytes: number;
|
|
59
|
+
};
|
|
60
|
+
} | {
|
|
61
|
+
available: false;
|
|
62
|
+
artifactId: string;
|
|
63
|
+
reason: "deleted" | "expired" | "failed" | "invalid_content" | "missing_storage" | "not_retained" | "oversized" | "pending" | "quota_exceeded" | "storage_write_failed" | "unsupported";
|
|
64
|
+
}>;
|
|
65
|
+
modelCanReceiveRetainedSessionImages: boolean;
|
|
66
|
+
readonly generatedImageReceiptsByProviderItemId: Map<string, {
|
|
67
|
+
type: "generated_image";
|
|
68
|
+
artifact: {
|
|
69
|
+
available: true;
|
|
70
|
+
artifactId: string;
|
|
71
|
+
kind: "assistant_completion" | "computer_screenshot" | "event_media" | "file" | "generated_image" | "generated_video" | "internal_update" | "tool_result";
|
|
72
|
+
contentType: string;
|
|
73
|
+
originalBytes: number;
|
|
74
|
+
sha256: string;
|
|
75
|
+
retainedAt: string;
|
|
76
|
+
dimensions?: {
|
|
77
|
+
width: number;
|
|
78
|
+
height: number;
|
|
79
|
+
} | undefined;
|
|
80
|
+
retention: {
|
|
81
|
+
policy: "workspace_file";
|
|
82
|
+
expiresAt: null;
|
|
83
|
+
} | {
|
|
84
|
+
policy: "session_screenshot";
|
|
85
|
+
expiresAt: string;
|
|
86
|
+
};
|
|
87
|
+
retrieval: {
|
|
88
|
+
method: "GET";
|
|
89
|
+
path: string;
|
|
90
|
+
acceptRanges: "bytes";
|
|
91
|
+
maxRangeBytes: number;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
sandboxPath: string;
|
|
95
|
+
}>;
|
|
96
|
+
readonly generatedImageReceiptsCreatedThisTurn: Map<string, {
|
|
97
|
+
type: "generated_image";
|
|
98
|
+
artifact: {
|
|
99
|
+
available: true;
|
|
100
|
+
artifactId: string;
|
|
101
|
+
kind: "assistant_completion" | "computer_screenshot" | "event_media" | "file" | "generated_image" | "generated_video" | "internal_update" | "tool_result";
|
|
102
|
+
contentType: string;
|
|
103
|
+
originalBytes: number;
|
|
104
|
+
sha256: string;
|
|
105
|
+
retainedAt: string;
|
|
106
|
+
dimensions?: {
|
|
107
|
+
width: number;
|
|
108
|
+
height: number;
|
|
109
|
+
} | undefined;
|
|
110
|
+
retention: {
|
|
111
|
+
policy: "workspace_file";
|
|
112
|
+
expiresAt: null;
|
|
113
|
+
} | {
|
|
114
|
+
policy: "session_screenshot";
|
|
115
|
+
expiresAt: string;
|
|
116
|
+
};
|
|
117
|
+
retrieval: {
|
|
118
|
+
method: "GET";
|
|
119
|
+
path: string;
|
|
120
|
+
acceptRanges: "bytes";
|
|
121
|
+
maxRangeBytes: number;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
sandboxPath: string;
|
|
125
|
+
}>;
|
|
126
|
+
private generatedImageMaterializationCache;
|
|
127
|
+
sdkOwnedSandboxSession: CodemodeTokenWriterSession | null;
|
|
128
|
+
sandboxFileDownloadBackend: Settings["sandboxBackend"];
|
|
129
|
+
nativeImageGenerationRetention: NativeImageGenerationRetention | null;
|
|
130
|
+
readonly retainedSessionImageCallIds: Set<string>;
|
|
131
|
+
constructor(deps: TurnMediaArtifactDeps);
|
|
132
|
+
rememberGeneratedImageCreatedThisTurn: (receipt: GeneratedImageReceipt) => void;
|
|
133
|
+
private prepareGeneratedImageDownload;
|
|
134
|
+
private writeGeneratedImageDownload;
|
|
135
|
+
private warnGeneratedImageMaterializationDeferred;
|
|
136
|
+
materializeGeneratedImageInSandbox: (receipt: GeneratedImageReceipt, sandbox: ResumedTurnSandbox, sessionForDownload: unknown) => Promise<boolean>;
|
|
137
|
+
materializeGeneratedImageInOwnedSdkSession: (receipt: GeneratedImageReceipt, sessionForDownload: unknown) => Promise<boolean>;
|
|
138
|
+
materializeGeneratedImage: (receipt: GeneratedImageReceipt) => Promise<boolean>;
|
|
139
|
+
retainNativeGeneratedImage: (output: GeneratedImageOutput) => Promise<GeneratedImageReceipt>;
|
|
140
|
+
retainNativeGeneratedImagesFromHistory: (history: Array<Record<string, unknown>>) => Promise<void>;
|
|
141
|
+
compactMediaRunState: (serialized: string) => string;
|
|
142
|
+
retainSessionImageAtToolBoundary: RetainableSessionImageOutputHook;
|
|
143
|
+
materializeScreenshotHistory: (history: Array<Record<string, unknown>>) => Promise<Record<string, unknown>[]>;
|
|
144
|
+
}
|
|
145
|
+
export declare function createTurnMediaArtifacts(deps: TurnMediaArtifactDeps): TurnMediaArtifacts;
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { type AppendEventInput, type CanonicalTurnStartupMilestoneReceipt } from "@opengeni/db";
|
|
2
|
+
import { modelResponseServiceTierFromSdkEvent, modelTerminalResponseFromSdkEvent, type ModelResponseUsage, type ModelCallUsageInput, type ModelCallUsageNormalization } from "@opengeni/runtime";
|
|
3
|
+
import { type ModelUsageInput, type ModelProviderApi, type Settings } from "@opengeni/config";
|
|
4
|
+
import type { TurnActivityServices as ActivityServices } from "../types.js";
|
|
5
|
+
import { type LatencyMode, type ModelContextContributionSummary, type SessionEvent } from "@opengeni/contracts";
|
|
6
|
+
export declare function modelUsageSourceKey(input: {
|
|
7
|
+
responseId?: string | null | undefined;
|
|
8
|
+
dispatchId: string | null;
|
|
9
|
+
positionalKey: string;
|
|
10
|
+
}): string;
|
|
11
|
+
export declare function providerContextTokens(usage: {
|
|
12
|
+
inputTokens?: number;
|
|
13
|
+
outputTokens?: number;
|
|
14
|
+
totalTokens?: number;
|
|
15
|
+
} | null | undefined): number | null;
|
|
16
|
+
/**
|
|
17
|
+
* A provider call has already consumed tokens by the time its usage frame is
|
|
18
|
+
* available. Losing the Codex credential lease at the renewal checkpoint must
|
|
19
|
+
* stop the result from becoming authoritative, but it must not erase accounting
|
|
20
|
+
* truth for the call that already happened. Meter first, then surface the lost
|
|
21
|
+
* lease, then write attempt-owned token/context signals. A replaced attempt can
|
|
22
|
+
* reject those signals without erasing the provider usage already incurred.
|
|
23
|
+
*/
|
|
24
|
+
export declare function recordCompletedModelCallBeforeOwnershipFences(input: {
|
|
25
|
+
renewLease: () => Promise<void>;
|
|
26
|
+
recordUsage: () => Promise<void>;
|
|
27
|
+
leaseLost: () => boolean;
|
|
28
|
+
leaseLostMessage: string;
|
|
29
|
+
recordAttemptSignals?: () => Promise<void>;
|
|
30
|
+
}): Promise<void>;
|
|
31
|
+
export type TurnEventPublisher = (events: Array<Omit<AppendEventInput, "producerId" | "producerSeq" | "turnId">>, immediate?: boolean) => Promise<{
|
|
32
|
+
events: SessionEvent[];
|
|
33
|
+
accepted: boolean;
|
|
34
|
+
canonicalStartupMilestones: CanonicalTurnStartupMilestoneReceipt[];
|
|
35
|
+
}>;
|
|
36
|
+
export type ModelResponseEventState = {
|
|
37
|
+
responseCount: number;
|
|
38
|
+
contextSignal: {
|
|
39
|
+
revision: number;
|
|
40
|
+
totalTokens: number;
|
|
41
|
+
} | null;
|
|
42
|
+
claimedSourceKeys: Set<string>;
|
|
43
|
+
};
|
|
44
|
+
export type CompactionModelUsageEventState = {
|
|
45
|
+
usageCount: number;
|
|
46
|
+
claimedSourceKeys: Set<string>;
|
|
47
|
+
};
|
|
48
|
+
export declare function createModelResponseEventState(claimedSourceKeys?: Set<string>): ModelResponseEventState;
|
|
49
|
+
export declare function createCompactionModelUsageEventState(claimedSourceKeys?: Set<string>): CompactionModelUsageEventState;
|
|
50
|
+
export declare function modelResponseContextSignal(state: ModelResponseEventState): {
|
|
51
|
+
revision: number;
|
|
52
|
+
totalTokens: number;
|
|
53
|
+
} | null;
|
|
54
|
+
export declare function assertModelResponseLatencyMode(input: {
|
|
55
|
+
event: Parameters<typeof modelResponseServiceTierFromSdkEvent>[0];
|
|
56
|
+
requested: LatencyMode;
|
|
57
|
+
model: string;
|
|
58
|
+
/** When set to Codex ChatGPT auth, response `service_tier` is not an honor signal. */
|
|
59
|
+
providerId?: string;
|
|
60
|
+
}): void;
|
|
61
|
+
/**
|
|
62
|
+
* Process one SDK terminal-response event through the production authority path.
|
|
63
|
+
*
|
|
64
|
+
* The pinned Responses SDK mirrors one provider terminal response as both a
|
|
65
|
+
* normalized `response_done` and a raw `model/response.completed` event. Claim
|
|
66
|
+
* the stable response/source key before lease renewal or any side effect, and
|
|
67
|
+
* use that one positional ordinal for both response identity and same-run
|
|
68
|
+
* context binding. A response without usage still clears attempt-owned token
|
|
69
|
+
* state. When usage exists, the durable `agent.model.usage` source-key fence
|
|
70
|
+
* remains the cross-restart authority: a replay may retry the idempotent billing
|
|
71
|
+
* write, but it cannot advance metrics, context, or attempt-owned signals.
|
|
72
|
+
*/
|
|
73
|
+
export declare function processModelResponseTerminalEvent(input: {
|
|
74
|
+
event: Parameters<typeof modelTerminalResponseFromSdkEvent>[0];
|
|
75
|
+
state: ModelResponseEventState;
|
|
76
|
+
dispatchId: string | null;
|
|
77
|
+
settings: Settings;
|
|
78
|
+
db: ActivityServices["db"];
|
|
79
|
+
observability: ActivityServices["observability"];
|
|
80
|
+
publish: TurnEventPublisher | null;
|
|
81
|
+
accountId: string;
|
|
82
|
+
workspaceId: string;
|
|
83
|
+
sessionId: string;
|
|
84
|
+
turnId: string;
|
|
85
|
+
turnAttemptId: string;
|
|
86
|
+
provider: string;
|
|
87
|
+
providerApi: ModelProviderApi;
|
|
88
|
+
model: string;
|
|
89
|
+
latencyMode?: LatencyMode;
|
|
90
|
+
metricProvider: string;
|
|
91
|
+
externallyBilled: boolean;
|
|
92
|
+
servingCredentialId: string | null;
|
|
93
|
+
priorSessionCredentialId: string | null;
|
|
94
|
+
emittedSourceKeys: Set<string>;
|
|
95
|
+
renewLease: () => Promise<void>;
|
|
96
|
+
leaseLost: () => boolean;
|
|
97
|
+
leaseLostMessage: string;
|
|
98
|
+
setLastInputTokens: (tokens: number | null) => Promise<void>;
|
|
99
|
+
contextContributions?: readonly ModelContextContributionSummary[] | null;
|
|
100
|
+
}): Promise<{
|
|
101
|
+
status: "not_response";
|
|
102
|
+
} | {
|
|
103
|
+
status: "duplicate";
|
|
104
|
+
sourceKey: string;
|
|
105
|
+
} | {
|
|
106
|
+
status: "processed";
|
|
107
|
+
sourceKey: string;
|
|
108
|
+
authoritative: boolean;
|
|
109
|
+
usageReported: boolean;
|
|
110
|
+
}>;
|
|
111
|
+
/**
|
|
112
|
+
* Apply the same source-key authority ordering to the compaction summarizer's
|
|
113
|
+
* usage callback. The summarizer can retry or mirror a terminal response just
|
|
114
|
+
* like the main stream, so claim before lease renewal, billing, durable usage,
|
|
115
|
+
* logging, or cache metrics. Durable source-key idempotency remains the
|
|
116
|
+
* cross-process authority after a worker restart.
|
|
117
|
+
*/
|
|
118
|
+
export declare function processCompactionModelUsageEvent(input: {
|
|
119
|
+
usage: ModelResponseUsage;
|
|
120
|
+
state: CompactionModelUsageEventState;
|
|
121
|
+
dispatchId: string | null;
|
|
122
|
+
settings: Settings;
|
|
123
|
+
db: ActivityServices["db"];
|
|
124
|
+
observability: ActivityServices["observability"];
|
|
125
|
+
publish: TurnEventPublisher | null;
|
|
126
|
+
accountId: string;
|
|
127
|
+
workspaceId: string;
|
|
128
|
+
sessionId: string;
|
|
129
|
+
turnId: string;
|
|
130
|
+
turnAttemptId: string;
|
|
131
|
+
provider: string;
|
|
132
|
+
providerApi: ModelProviderApi;
|
|
133
|
+
model: string;
|
|
134
|
+
externallyBilled: boolean;
|
|
135
|
+
servingCredentialId: string | null;
|
|
136
|
+
priorSessionCredentialId: string | null;
|
|
137
|
+
emittedSourceKeys: Set<string>;
|
|
138
|
+
renewLease: () => Promise<void>;
|
|
139
|
+
leaseLost: () => boolean;
|
|
140
|
+
leaseLostMessage: string;
|
|
141
|
+
contextContributions?: readonly ModelContextContributionSummary[] | null;
|
|
142
|
+
}): Promise<{
|
|
143
|
+
status: "duplicate";
|
|
144
|
+
sourceKey: string;
|
|
145
|
+
} | {
|
|
146
|
+
status: "processed";
|
|
147
|
+
sourceKey: string;
|
|
148
|
+
authoritative: boolean;
|
|
149
|
+
}>;
|
|
150
|
+
export declare function emitModelCallUsage(input: {
|
|
151
|
+
observability: ActivityServices["observability"];
|
|
152
|
+
publish: TurnEventPublisher | null;
|
|
153
|
+
accountId: string;
|
|
154
|
+
workspaceId: string;
|
|
155
|
+
sessionId: string;
|
|
156
|
+
turnId: string;
|
|
157
|
+
provider: string;
|
|
158
|
+
providerApi: ModelProviderApi;
|
|
159
|
+
model: string;
|
|
160
|
+
sourceKey: string;
|
|
161
|
+
usage: ModelResponseUsage | {
|
|
162
|
+
usage?: unknown | null;
|
|
163
|
+
} | null;
|
|
164
|
+
normalizedUsage?: ModelCallUsageNormalization;
|
|
165
|
+
servingAccountHash?: string;
|
|
166
|
+
accountChangedFromPrevCall?: boolean;
|
|
167
|
+
emittedSourceKeys?: Set<string>;
|
|
168
|
+
}): Promise<boolean>;
|
|
169
|
+
/**
|
|
170
|
+
* Apply one authoritative, normalized model-call usage frame to the shared
|
|
171
|
+
* prompt-cache metrics. The durable source-key fence in `emitModelCallUsage`
|
|
172
|
+
* owns idempotency; this helper must never receive raw provider values.
|
|
173
|
+
*/
|
|
174
|
+
export declare function applyCodexCacheTelemetry(observability: ActivityServices["observability"], provider: string, normalizedUsage: ModelCallUsageNormalization): void;
|
|
175
|
+
export type ModelUsageBillingRecord = {
|
|
176
|
+
billingPath: "opengeni_credits" | "external";
|
|
177
|
+
/** Same quantity written to usage_events.model.cost when present; else 0. */
|
|
178
|
+
pricedCostMicros: number;
|
|
179
|
+
/** Hypothetical provider-rate USD micros; never an OpenGeni charge. */
|
|
180
|
+
estimatedProviderCostMicros: number | null;
|
|
181
|
+
pricingSource: "configured_list_price" | "gateway_reported" | null;
|
|
182
|
+
normalizedUsage: ModelCallUsageNormalization;
|
|
183
|
+
upstreamProvider?: string;
|
|
184
|
+
};
|
|
185
|
+
export declare function recordModelUsageAndDebitCredits(settings: Settings, db: ActivityServices["db"], input: {
|
|
186
|
+
accountId: string;
|
|
187
|
+
workspaceId: string;
|
|
188
|
+
sessionId: string;
|
|
189
|
+
turnId: string;
|
|
190
|
+
turnAttemptId: string;
|
|
191
|
+
model: string;
|
|
192
|
+
externallyBilled: boolean;
|
|
193
|
+
gatewayManaged?: boolean;
|
|
194
|
+
gatewayBilling?: ModelResponseUsage["gatewayBilling"];
|
|
195
|
+
usage?: ModelUsageInput | ModelCallUsageInput | null;
|
|
196
|
+
normalizedUsage?: ModelCallUsageNormalization;
|
|
197
|
+
sourceKey: string;
|
|
198
|
+
latencyMode?: LatencyMode;
|
|
199
|
+
observability?: ActivityServices["observability"];
|
|
200
|
+
}): Promise<ModelUsageBillingRecord | null>;
|
|
201
|
+
/** Soft-fail Insights fact write — never throws into the billing/emit path. */
|
|
202
|
+
export declare function recordAuthoritativeModelCallFact(input: {
|
|
203
|
+
db: ActivityServices["db"];
|
|
204
|
+
observability: ActivityServices["observability"];
|
|
205
|
+
accountId: string;
|
|
206
|
+
workspaceId: string;
|
|
207
|
+
sessionId: string;
|
|
208
|
+
turnId: string;
|
|
209
|
+
turnAttemptId: string;
|
|
210
|
+
sourceKey: string;
|
|
211
|
+
provider: string;
|
|
212
|
+
providerApi: ModelProviderApi;
|
|
213
|
+
model: string;
|
|
214
|
+
billing: ModelUsageBillingRecord;
|
|
215
|
+
contextContributions?: readonly ModelContextContributionSummary[] | null;
|
|
216
|
+
}): Promise<void>;
|
|
217
|
+
export declare function sanitizedModelUsageInput(normalized: ModelCallUsageNormalization): ModelUsageInput;
|
|
218
|
+
export declare function startOfUtcMonth(): Date;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { type SessionAttemptQuiescenceCommit } from "@opengeni/db";
|
|
2
|
+
import { type TurnToolCancellationFence } from "@opengeni/runtime";
|
|
3
|
+
import { type GitCredentialRenewalController } from "../git-credential-renewal.js";
|
|
4
|
+
import { type RunCredentialRenewalController } from "../run-credential-renewal.js";
|
|
5
|
+
import { type CodemodeTokenRenewalController } from "../codemode-token-renewal.js";
|
|
6
|
+
import type { TurnActivityServices as ActivityServices, RunAgentTurnResult, SessionAttemptQuiescenceProof } from "../types.js";
|
|
7
|
+
import { type ResumedTurnSandbox } from "../../sandbox-resume.js";
|
|
8
|
+
import { type SessionEvent } from "@opengeni/contracts";
|
|
9
|
+
export declare function shouldRunTurnEndWorkspacePersistence(input: {
|
|
10
|
+
activityStatus: RunAgentTurnResult["status"] | "unknown";
|
|
11
|
+
cancellationRequested: boolean;
|
|
12
|
+
}): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Periodic workspace snapshots protect work performed during a long-running
|
|
15
|
+
* turn. Before the first provider request reaches the wire there is no
|
|
16
|
+
* mid-turn agent work to protect; snapshotting platform setup at that point can
|
|
17
|
+
* instead make the request wait behind the snapshot's workspace-write fence.
|
|
18
|
+
*/
|
|
19
|
+
export declare function shouldStartPeriodicWorkspaceSnapshot(input: {
|
|
20
|
+
firstProviderRequestStarted: boolean;
|
|
21
|
+
snapshotInFlight: boolean;
|
|
22
|
+
turnEndCaptureInProgress: boolean;
|
|
23
|
+
}): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Temporal cancellation is delivery/transport state, never proof that the
|
|
26
|
+
* dying activity crossed its mandatory sandbox-tool fence. If that fence
|
|
27
|
+
* fails, surface the fence failure instead of retaining a misleading typed
|
|
28
|
+
* cancellation; replacement admission remains closed because no durable
|
|
29
|
+
* quiescence receipt was written.
|
|
30
|
+
*/
|
|
31
|
+
export declare function assertPhysicalToolQuiescenceForCancellation(input: {
|
|
32
|
+
acknowledgeQuiescence: boolean;
|
|
33
|
+
physicalToolQuiescenceConfirmed: boolean;
|
|
34
|
+
failure: unknown;
|
|
35
|
+
}): void;
|
|
36
|
+
/** A physically drained attempt must leave one durable recovery producer. The
|
|
37
|
+
* direct Postgres receipt is preferred; after its bounded retries exhaust, an
|
|
38
|
+
* exact Temporal proof signal is sufficient because the workflow persists it
|
|
39
|
+
* through an independently retrying DB-only control activity. */
|
|
40
|
+
export declare function assertSessionAttemptQuiescenceRecoveryDurable(input: {
|
|
41
|
+
acknowledgeQuiescence: boolean;
|
|
42
|
+
physicalToolQuiescenceConfirmed: boolean;
|
|
43
|
+
receiptOrProofDurable: boolean;
|
|
44
|
+
failure: unknown;
|
|
45
|
+
}): void;
|
|
46
|
+
export declare const QUIESCENCE_PROOF_SIGNAL_INITIAL_RETRY_MS = 250;
|
|
47
|
+
export declare const QUIESCENCE_PROOF_SIGNAL_MAX_RETRY_MS = 5000;
|
|
48
|
+
/** Persist the authoritative receipt or durably hand the exact physical proof
|
|
49
|
+
* to Temporal. This retries signal delivery, not DB eligibility or workflow
|
|
50
|
+
* state. The proof object never changes between attempts. */
|
|
51
|
+
export declare function persistOrSignalSessionAttemptQuiescence(input: {
|
|
52
|
+
proof: SessionAttemptQuiescenceProof;
|
|
53
|
+
persistReceipt: () => Promise<SessionAttemptQuiescenceCommit>;
|
|
54
|
+
deliverWorkflowWake?: (wake: NonNullable<SessionAttemptQuiescenceCommit["workflowWake"]>) => Promise<unknown>;
|
|
55
|
+
publishEvents: (events: SessionEvent[]) => Promise<unknown>;
|
|
56
|
+
signalProof: ActivityServices["signalSessionAttemptQuiesced"];
|
|
57
|
+
sleep?: (ms: number) => Promise<void>;
|
|
58
|
+
heartbeat?: (attempt: number, delayMs: number) => void;
|
|
59
|
+
onReceiptFailure?: (error: unknown) => void;
|
|
60
|
+
onWakeFailure?: (error: unknown) => void;
|
|
61
|
+
onPublishFailure?: (error: unknown) => void;
|
|
62
|
+
onSignalFailure?: (error: unknown, attempt: number, delayMs: number) => void;
|
|
63
|
+
}): Promise<"receipt" | "signal">;
|
|
64
|
+
/**
|
|
65
|
+
* Cross the non-detachable physical boundary for one dying attempt. Temporal's
|
|
66
|
+
* cancellation signal is intentionally absent: cancellation is transport, not
|
|
67
|
+
* proof that sandbox tools and attempt-owned credential writers have drained.
|
|
68
|
+
* A replacement may be admitted only after this function resolves and the
|
|
69
|
+
* caller durably persists or signals the exact quiescence receipt.
|
|
70
|
+
*/
|
|
71
|
+
export declare function drainAttemptOwnedSandboxWriters(input: {
|
|
72
|
+
toolCancellationFence: Pick<TurnToolCancellationFence, "cancel" | "waitForQuiescence"> | null;
|
|
73
|
+
cancellationReason?: unknown;
|
|
74
|
+
gitCredentialRenewals: readonly Pick<GitCredentialRenewalController, "stop">[];
|
|
75
|
+
codemodeTokenRenewal: Pick<CodemodeTokenRenewalController, "stop"> | null;
|
|
76
|
+
runCredentialRenewal: Pick<RunCredentialRenewalController, "stop"> | null;
|
|
77
|
+
}): Promise<void>;
|
|
78
|
+
/** Persist the exact turn's second-stage release only after the caller has
|
|
79
|
+
* crossed the physical writer boundary. This wait is intentionally independent
|
|
80
|
+
* of Temporal cancellation: it is a short idempotent DB transaction that closes
|
|
81
|
+
* the durable archive-capture fence. Bounded retries cover a rollout connection
|
|
82
|
+
* reset without turning ordinary finalizer housekeeping into lifecycle state. */
|
|
83
|
+
export declare function releaseTurnSandboxAfterWriterDrain(sandbox: Pick<ResumedTurnSandbox, "release">, options?: {
|
|
84
|
+
maxAttempts?: number;
|
|
85
|
+
retryDelayMs?: number;
|
|
86
|
+
wait?: (delayMs: number) => Promise<void>;
|
|
87
|
+
}): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Await a finalizer operation only while this Temporal activity still owns its
|
|
90
|
+
* execution window. Once Pause/Steer cancellation arrives, the operation keeps
|
|
91
|
+
* its own rejection handler and may finish its idempotent, attempt-scoped
|
|
92
|
+
* cleanup in the background, but it cannot pin activity terminalization or
|
|
93
|
+
* delay the separately receipt-gated replacement dispatch.
|
|
94
|
+
*/
|
|
95
|
+
export declare function waitForTurnFinalizerStep<T>(operation: Promise<T>, signal: AbortSignal | undefined): Promise<T | undefined>;
|
|
96
|
+
/**
|
|
97
|
+
* Flush provider-facing stream state while the attempt still owns its activity
|
|
98
|
+
* window. On Pause/Steer, both promises are detached with rejection handlers:
|
|
99
|
+
* neither a runtime batcher nor an uncooperative provider completion promise
|
|
100
|
+
* may pin the activity behind cancellation after durable writes are fenced.
|
|
101
|
+
*/
|
|
102
|
+
export declare function waitForTurnStreamCleanup(batcherFlush: Promise<unknown>, providerCompleted: Promise<unknown>, signal: AbortSignal | undefined): Promise<void>;
|
|
103
|
+
/**
|
|
104
|
+
* Terminal settlement closes the active attempt before turn finalization. The
|
|
105
|
+
* ordinary workspace admission therefore correctly returns `attempt_fenced`
|
|
106
|
+
* for the final attempt-qualified credential deletion. Retry only that exact
|
|
107
|
+
* settled-attempt case directly; every other fence/status and the direct
|
|
108
|
+
* deletion itself remain fail-closed.
|
|
109
|
+
*/
|
|
110
|
+
export declare function clearAttemptCredentialsWithSettledFence(input: {
|
|
111
|
+
activityStatus: RunAgentTurnResult["status"] | "unknown";
|
|
112
|
+
runWorkspaceFencedClear: () => Promise<void>;
|
|
113
|
+
clearExactAttempt: () => Promise<void>;
|
|
114
|
+
onSettledAttemptFence: () => void;
|
|
115
|
+
}): Promise<void>;
|
|
116
|
+
export declare function turnFinalizerCancellationSignal(temporalSignal: AbortSignal | undefined, activityStatus: RunAgentTurnResult["status"] | "unknown"): AbortSignal | undefined;
|
|
117
|
+
export type MandatoryHistoryPersistenceStage = "history_append" | "sandbox_envelope";
|
|
118
|
+
/**
|
|
119
|
+
* Preserve the exact storage failure for the permission-controlled turn event
|
|
120
|
+
* while attaching only a stable, non-secret operation token to public worker
|
|
121
|
+
* diagnostics. Mandatory history failures remain terminal and never inherit a
|
|
122
|
+
* provider-retry classification from coincidental source text or status.
|
|
123
|
+
*/
|
|
124
|
+
export declare class MandatoryHistoryPersistenceError extends Error {
|
|
125
|
+
readonly stage: MandatoryHistoryPersistenceStage;
|
|
126
|
+
readonly name = "MandatoryHistoryPersistenceError";
|
|
127
|
+
readonly cause: unknown;
|
|
128
|
+
constructor(stage: MandatoryHistoryPersistenceStage, cause: unknown);
|
|
129
|
+
}
|
|
130
|
+
export declare function runMandatoryHistoryPersistenceStep<T>(stage: MandatoryHistoryPersistenceStage, operation: () => Promise<T>): Promise<T>;
|
|
131
|
+
export type OpStreamFinalizer = {
|
|
132
|
+
finalizeOpStreamOps(): Promise<void>;
|
|
133
|
+
};
|
|
134
|
+
/** Release retained Connected Machine output only after the turn is durable. */
|
|
135
|
+
export declare function finalizeDurableTurnOpStreams(sessions: readonly unknown[], fallback: OpStreamFinalizer | null): Promise<void>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { type GitCredentialTokenWriterSession, type NormalizedRunCredentialMaterial, type RunCredentialCommandSession, type CodemodeTokenWriterSession } from "@opengeni/runtime";
|
|
2
|
+
import { type Settings } from "@opengeni/config";
|
|
3
|
+
import { type GitHubTokenMintAuthorization, type MintedRunGitCredentials, type loadWorkspaceEnvironmentForRunWithCredentials } from "../environment.js";
|
|
4
|
+
import type { mergeResourceRefs } from "../common.js";
|
|
5
|
+
import type { TurnActivityServices as ActivityServices, RunAgentTurnInput } from "../types.js";
|
|
6
|
+
import { type ResumedTurnSandbox } from "../../sandbox-resume.js";
|
|
7
|
+
import type { ClaimTurnOk } from "./claim.js";
|
|
8
|
+
import type { GovernanceModelOk } from "./governance-model.js";
|
|
9
|
+
import type { SandboxTurnRuntime } from "./sandbox-runtime.js";
|
|
10
|
+
import type { AttemptIdentityState, EventingState, RenewalState, SandboxRuntimeState } from "./turn-context.js";
|
|
11
|
+
export type PrepareRunCredentialsDeps = {
|
|
12
|
+
input: RunAgentTurnInput;
|
|
13
|
+
settings: Settings;
|
|
14
|
+
db: ActivityServices["db"];
|
|
15
|
+
observability: ActivityServices["observability"];
|
|
16
|
+
cancellationSignal: AbortSignal | undefined;
|
|
17
|
+
connectionCredentials: ActivityServices["connectionCredentials"];
|
|
18
|
+
personalGitHubCredentials: ActivityServices["personalGitHubCredentials"];
|
|
19
|
+
eventing: EventingState;
|
|
20
|
+
attempt: AttemptIdentityState;
|
|
21
|
+
renewals: RenewalState;
|
|
22
|
+
sandboxState: SandboxRuntimeState;
|
|
23
|
+
sandboxRuntime: SandboxTurnRuntime;
|
|
24
|
+
turn: ClaimTurnOk["turn"];
|
|
25
|
+
session: ClaimTurnOk["session"];
|
|
26
|
+
fileAuthoritySubjectId: ClaimTurnOk["fileAuthoritySubjectId"];
|
|
27
|
+
runSettings: GovernanceModelOk["runSettings"];
|
|
28
|
+
workspaceVariableSet: Awaited<ReturnType<typeof loadWorkspaceEnvironmentForRunWithCredentials>>;
|
|
29
|
+
turnResources: ReturnType<typeof mergeResourceRefs>;
|
|
30
|
+
requiredGeneratedVideoFiles: Array<{
|
|
31
|
+
operationId: string;
|
|
32
|
+
artifactId: string;
|
|
33
|
+
fileId: string;
|
|
34
|
+
objectKey: string;
|
|
35
|
+
sizeBytes: number;
|
|
36
|
+
sha256: string;
|
|
37
|
+
filename: string;
|
|
38
|
+
}>;
|
|
39
|
+
machinePrimary: boolean;
|
|
40
|
+
activeSandboxBackend: Settings["sandboxBackend"] | undefined;
|
|
41
|
+
groupBoxBackend: Settings["sandboxBackend"];
|
|
42
|
+
sandboxCreationBackend: Settings["sandboxBackend"];
|
|
43
|
+
effectiveRunCredentialBackend: Settings["sandboxBackend"];
|
|
44
|
+
sandboxWorkspaceEnvironmentValues: Record<string, string>;
|
|
45
|
+
connectionScope: {
|
|
46
|
+
accountId: string;
|
|
47
|
+
workspaceId: string;
|
|
48
|
+
};
|
|
49
|
+
runWorkspaceMutationForSandbox: SandboxTurnRuntime["runWorkspaceMutationForSandbox"];
|
|
50
|
+
};
|
|
51
|
+
export declare function prepareRunCredentials(deps: PrepareRunCredentialsDeps): Promise<{
|
|
52
|
+
runCredentialResolver: import("../run-credentials.js").BoundRunCredentialResolver | null;
|
|
53
|
+
establishPolicy: "eager" | "on-demand";
|
|
54
|
+
initialRunCredentialMaterial: NormalizedRunCredentialMaterial | null;
|
|
55
|
+
runCredentialsNote: string | undefined;
|
|
56
|
+
authorizeGitHubTokenMint: GitHubTokenMintAuthorization;
|
|
57
|
+
hostCredentialRootSessionId: string | null;
|
|
58
|
+
gitCredentialAuthority: import("../environment.js").GitCredentialAuthority | undefined;
|
|
59
|
+
codemodeAuthority: {
|
|
60
|
+
sessionId: string;
|
|
61
|
+
turnId: string;
|
|
62
|
+
attemptId: string;
|
|
63
|
+
executionGeneration: number;
|
|
64
|
+
};
|
|
65
|
+
sandboxArtifactRuntime: Readonly<{
|
|
66
|
+
available: boolean;
|
|
67
|
+
environment: Readonly<Record<string, string>>;
|
|
68
|
+
}>;
|
|
69
|
+
sandboxEnvironment: Record<string, string>;
|
|
70
|
+
sandboxGitToken: string | undefined;
|
|
71
|
+
sandboxGitTokens: Partial<Record<"azure_devops" | "github" | "gitlab", string>> | undefined;
|
|
72
|
+
sandboxGitTokenExpiresAt: Partial<Record<"azure_devops" | "github" | "gitlab", string>> | undefined;
|
|
73
|
+
sandboxGitCredentialBindings: import("../environment.js").GitCredentialBindingSeed[] | undefined;
|
|
74
|
+
sandboxCodemodeToken: string | undefined;
|
|
75
|
+
sandboxCodemodeTokenExpiresAt: Date | undefined;
|
|
76
|
+
sandboxCodemodeTokenFile: string | undefined;
|
|
77
|
+
transientCodemodeEnvironment: (() => Readonly<Record<string, string>>) | undefined;
|
|
78
|
+
initialGitCredentials: MintedRunGitCredentials | undefined;
|
|
79
|
+
startRunGitCredentialsMint: () => Promise<MintedRunGitCredentials | undefined>;
|
|
80
|
+
attachGitCredentialRenewal: (tokenSession: GitCredentialTokenWriterSession, initial: MintedRunGitCredentials | undefined, initialSandbox?: ResumedTurnSandbox) => Promise<void>;
|
|
81
|
+
attachCodemodeTokenRenewal: (tokenSession?: CodemodeTokenWriterSession, initialExpiresAt?: Date | undefined, initialSandbox?: ResumedTurnSandbox) => Promise<void>;
|
|
82
|
+
attachRunCredentialRenewal: (credentialSession: RunCredentialCommandSession, initialMaterial: NormalizedRunCredentialMaterial | null, initialSandbox?: ResumedTurnSandbox) => Promise<void>;
|
|
83
|
+
}>;
|
|
84
|
+
export type PrepareRunCredentialsOk = Awaited<ReturnType<typeof prepareRunCredentials>>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { TurnActivityServices as ActivityServices, RunAgentTurnInput, RunAgentTurnResult } from "../types.js";
|
|
2
|
+
/** Lifecycle orchestrator: claim → capacity → governance → sandbox → tools → stream. */
|
|
3
|
+
export declare function createRunAgentTurnActivity(services: () => Promise<ActivityServices>): (input: RunAgentTurnInput) => Promise<RunAgentTurnResult>;
|