@opengeni/worker-bundle 0.23.4 → 0.26.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 +17 -2
- package/dist/activities/agent-turn/agent-build.d.ts +3 -10
- package/dist/activities/agent-turn/claim.d.ts +8 -0
- package/dist/activities/agent-turn/codex.d.ts +2 -2
- package/dist/activities/agent-turn/credential-leases.d.ts +8 -0
- package/dist/activities/agent-turn/errors.d.ts +1 -1
- package/dist/activities/agent-turn/failure-settlement.d.ts +43 -1
- package/dist/activities/agent-turn/list-models.d.ts +16 -0
- package/dist/activities/agent-turn/model-usage.d.ts +15 -1
- package/dist/activities/agent-turn/quiescence.d.ts +11 -6
- package/dist/activities/agent-turn/run.d.ts +9 -0
- package/dist/activities/agent-turn/sandbox-runtime.d.ts +15 -0
- package/dist/activities/agent-turn/session-title.d.ts +21 -0
- package/dist/activities/agent-turn/stream-attempt.d.ts +4 -0
- package/dist/activities/agent-turn/tool-environment.d.ts +4 -13
- package/dist/activities/agent-turn/tool-policy.d.ts +40 -5
- package/dist/activities/agent-turn/turn-context.d.ts +13 -2
- package/dist/activities/agent-turn.d.ts +1 -1
- package/dist/activities/automations.d.ts +1 -0
- package/dist/activities/capabilities.d.ts +3 -1
- package/dist/activities/codemode-dispatcher.d.ts +10 -1
- package/dist/activities/codex-capacity.d.ts +32 -3
- package/dist/activities/codex-fleet-shadow.d.ts +1 -1
- package/dist/activities/codex-image-generation.d.ts +1 -1
- package/dist/activities/codex-rotation.d.ts +8 -67
- package/dist/activities/context-compaction.d.ts +2 -0
- package/dist/activities/goals.d.ts +12 -1
- package/dist/activities/google-drive-publication.d.ts +2 -13
- package/dist/activities/image-generation-operation.d.ts +13 -4
- package/dist/activities/image-generation-references.d.ts +2 -1
- package/dist/activities/scheduled-tasks.d.ts +1 -0
- package/dist/activities/session-state.d.ts +4 -2
- package/dist/activities/types.d.ts +19 -1
- package/dist/{activities-control-52W5IDWM.js → activities-control-CTEMLTHG.js} +339 -195
- package/dist/activities-control-CTEMLTHG.js.map +1 -0
- package/dist/activities-control.d.ts +4 -0
- package/dist/{activities-turn-A2G2KLSY.js → activities-turn-S5IU347A.js} +1846 -1136
- package/dist/activities-turn-S5IU347A.js.map +1 -0
- package/dist/activities.d.ts +4 -0
- package/dist/{chunk-GFNXVZVQ.js → chunk-D4ZEFOYH.js} +107 -7
- package/dist/chunk-D4ZEFOYH.js.map +1 -0
- package/dist/{chunk-GRFQTTSQ.js → chunk-GDCLDKSH.js} +7 -3
- package/dist/{chunk-GRFQTTSQ.js.map → chunk-GDCLDKSH.js.map} +1 -1
- package/dist/{chunk-IPVMCAW5.js → chunk-TAUE3GYT.js} +225 -154
- package/dist/chunk-TAUE3GYT.js.map +1 -0
- package/dist/github-rest-mcp.d.ts +0 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +43 -7
- package/dist/index.js.map +1 -1
- package/dist/observability-metrics.d.ts +35 -8
- package/dist/sandbox-reaper-timeout.d.ts +2 -2
- package/dist/sandbox-resume.d.ts +6 -1
- package/dist/workflow-bundle.js +96 -10
- package/dist/workflows/activities.d.ts +6 -1
- package/dist/workflows/automations.d.ts +5 -0
- package/dist/workflows/session.d.ts +3 -0
- package/package.json +17 -17
- package/src/activities/agent-run-admission.ts +7 -1
- package/src/activities/agent-turn/admission.ts +47 -6
- package/src/activities/agent-turn/agent-build.ts +20 -26
- package/src/activities/agent-turn/claim.ts +59 -6
- package/src/activities/agent-turn/codex-capacity.ts +311 -234
- package/src/activities/agent-turn/codex.ts +2 -2
- package/src/activities/agent-turn/compaction-prep.ts +8 -1
- package/src/activities/agent-turn/credential-leases.ts +36 -0
- package/src/activities/agent-turn/errors.ts +29 -1
- package/src/activities/agent-turn/failure-settlement.ts +451 -323
- package/src/activities/agent-turn/finalization.ts +31 -17
- package/src/activities/agent-turn/list-models.ts +101 -0
- package/src/activities/agent-turn/model-usage.ts +120 -45
- package/src/activities/agent-turn/quiescence.ts +32 -17
- package/src/activities/agent-turn/run.ts +98 -9
- package/src/activities/agent-turn/sandbox-runtime.ts +78 -81
- package/src/activities/agent-turn/session-title.ts +55 -2
- package/src/activities/agent-turn/stream-attempt.ts +281 -136
- package/src/activities/agent-turn/tool-environment.ts +132 -39
- package/src/activities/agent-turn/tool-policy.ts +71 -12
- package/src/activities/agent-turn/turn-context.ts +21 -2
- package/src/activities/agent-turn.ts +5 -1
- package/src/activities/automations.ts +122 -67
- package/src/activities/capabilities.ts +129 -2
- package/src/activities/codemode-dispatcher.ts +235 -59
- package/src/activities/codex-capacity.ts +89 -10
- package/src/activities/codex-fleet-shadow.ts +8 -1
- package/src/activities/codex-image-generation.ts +19 -2
- package/src/activities/codex-rotation.ts +45 -142
- package/src/activities/context-compaction.ts +3 -0
- package/src/activities/goals.ts +116 -39
- package/src/activities/google-drive-publication.ts +4 -81
- package/src/activities/image-generation-operation.ts +28 -3
- package/src/activities/image-generation-references.ts +9 -9
- package/src/activities/mcp-credentials.ts +53 -0
- package/src/activities/rig-verification.ts +5 -3
- package/src/activities/sandbox-lease.ts +29 -12
- package/src/activities/scheduled-tasks.ts +217 -110
- package/src/activities/session-state.ts +17 -0
- package/src/activities/site-auth-maintenance.ts +12 -12
- package/src/activities/types.ts +22 -8
- package/src/activities.ts +2 -0
- package/src/activity-services.ts +4 -1
- package/src/github-rest-mcp.ts +2 -83
- package/src/index.ts +34 -4
- package/src/observability-metrics.ts +158 -14
- package/src/sandbox-reaper-timeout.ts +10 -4
- package/src/sandbox-resume.ts +58 -8
- package/src/sandbox-routing.ts +71 -16
- package/src/workflows/activities.ts +16 -0
- package/src/workflows/automations.ts +21 -2
- package/src/workflows/session.ts +85 -7
- package/dist/activities/api-integrations.d.ts +0 -21
- package/dist/activities-control-52W5IDWM.js.map +0 -1
- package/dist/activities-turn-A2G2KLSY.js.map +0 -1
- package/dist/chunk-GFNXVZVQ.js.map +0 -1
- package/dist/chunk-IPVMCAW5.js.map +0 -1
- package/src/activities/api-integrations.ts +0 -141
|
@@ -9,6 +9,10 @@ export type CodemodeDispatcherScope = {
|
|
|
9
9
|
attemptId: string;
|
|
10
10
|
executionGeneration: number;
|
|
11
11
|
};
|
|
12
|
+
export type CodemodeDispatcherTimings = {
|
|
13
|
+
claimLeaseMs?: number;
|
|
14
|
+
claimHeartbeatMs?: number;
|
|
15
|
+
};
|
|
12
16
|
/**
|
|
13
17
|
* Owns the only Codemode execution edge for one exact attempt. NATS carries a
|
|
14
18
|
* wake-up only; the durable row is claimed before any side effect and the call
|
|
@@ -26,10 +30,15 @@ export declare class CodemodeAttemptDispatcher {
|
|
|
26
30
|
private pendingClaims;
|
|
27
31
|
private unsubscribe;
|
|
28
32
|
private closing;
|
|
29
|
-
|
|
33
|
+
private readonly claimLeaseMs;
|
|
34
|
+
private readonly claimHeartbeatMs;
|
|
35
|
+
constructor(db: Database, bus: EventBus, environment: AttemptToolEnvironment, scope: CodemodeDispatcherScope, turnSignal?: AbortSignal | undefined, maxConcurrentCalls?: number, timings?: CodemodeDispatcherTimings);
|
|
30
36
|
start(): void;
|
|
31
37
|
close(reason?: string): Promise<void>;
|
|
32
38
|
private execute;
|
|
39
|
+
private executeClaimed;
|
|
40
|
+
private ensureToolCallCreated;
|
|
33
41
|
private settleWithOutput;
|
|
34
42
|
private failBeforeExecution;
|
|
35
43
|
}
|
|
44
|
+
export declare function codemodeToolCallCreatedClientEventId(operationId: string): string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { reconcileCodexCapacityWait as reconcileCodexCapacityWaitDb, type CodexCapacityWakeTarget, type CodexCapacitySelectionContext } from "@opengeni/db";
|
|
2
|
-
import type { Settings } from "@opengeni/config";
|
|
1
|
+
import { armCodexCapacityWait, reconcileCodexCapacityWait as reconcileCodexCapacityWaitDb, type CodexCapacityWakeTarget, type CodexCapacitySelectionContext } from "@opengeni/db";
|
|
3
2
|
import type { ControlActivityServices, GetCodexCapacityWaitInput, ReconcileCodexCapacityWaitInput, ReconcileCodexCapacityWaitResult } from "./types.js";
|
|
4
3
|
type CodexCapacitySignalServices = {
|
|
5
4
|
signalCodexCapacityWorkflow?: NonNullable<ControlActivityServices["signalCodexCapacityWorkflow"]> | null | undefined;
|
|
@@ -18,7 +17,37 @@ export declare function signalCodexCapacityWakeTargets(services: CodexCapacitySi
|
|
|
18
17
|
export declare function signalPendingCodexCapacityWakeTargets(services: CodexCapacitySignalServices & {
|
|
19
18
|
db: ControlActivityServices["db"];
|
|
20
19
|
}, workspaceId: string): Promise<void>;
|
|
21
|
-
export declare function codexCapacityDecision(context: CodexCapacitySelectionContext,
|
|
20
|
+
export declare function codexCapacityDecision<TPolicyScope = never, TUnavailableDiagnostic = never>(context: CodexCapacitySelectionContext<TPolicyScope, TUnavailableDiagnostic>): ReturnType<Parameters<typeof reconcileCodexCapacityWaitDb>[2]>;
|
|
21
|
+
/**
|
|
22
|
+
* Arm a durable Codex waiter and immediately re-evaluate it under the
|
|
23
|
+
* allocator lock. A capacity mutation that commits just before the waiter is
|
|
24
|
+
* inserted cannot signal a row that does not exist yet, so every arm site must
|
|
25
|
+
* close that edge before returning an hours-away reset timer to the workflow.
|
|
26
|
+
* Mutations after the arm commit still advance the waiter's wake revision.
|
|
27
|
+
*/
|
|
28
|
+
export declare function armAndReconcileCodexCapacityWait(services: Pick<ControlActivityServices, "db" | "bus">, input: Parameters<typeof armCodexCapacityWait>[1], options?: {
|
|
29
|
+
onArmed?: () => void;
|
|
30
|
+
}): Promise<{
|
|
31
|
+
action: "stale";
|
|
32
|
+
waiter: import("@opengeni/db").CodexCapacityWait | null;
|
|
33
|
+
events: import("@opengeni/contracts").SessionEvent[];
|
|
34
|
+
} | {
|
|
35
|
+
action: "waiting";
|
|
36
|
+
waiter: import("@opengeni/db").CodexCapacityWait;
|
|
37
|
+
events: import("@opengeni/contracts").SessionEvent[];
|
|
38
|
+
} | {
|
|
39
|
+
action: "resumed";
|
|
40
|
+
waiter: import("@opengeni/db").CodexCapacityWait;
|
|
41
|
+
events: import("@opengeni/contracts").SessionEvent[];
|
|
42
|
+
} | {
|
|
43
|
+
action: "paused";
|
|
44
|
+
waiter: import("@opengeni/db").CodexCapacityWait;
|
|
45
|
+
events: import("@opengeni/contracts").SessionEvent[];
|
|
46
|
+
} | {
|
|
47
|
+
action: "superseded";
|
|
48
|
+
waiter: import("@opengeni/db").CodexCapacityWait;
|
|
49
|
+
events: import("@opengeni/contracts").SessionEvent[];
|
|
50
|
+
}>;
|
|
22
51
|
export declare function createCodexCapacityActivities(services: () => Promise<ControlActivityServices>): {
|
|
23
52
|
getCodexCapacityWait: (input: GetCodexCapacityWaitInput) => Promise<{
|
|
24
53
|
provider?: "xai";
|
|
@@ -4,7 +4,7 @@ export declare const CODEX_FLEET_SHADOW_MAX_PAYLOAD_BYTES: number;
|
|
|
4
4
|
export type CodexFleetActualDecisionV1 = {
|
|
5
5
|
outcome: "selected" | "waiting" | "none";
|
|
6
6
|
candidateKey: string | null;
|
|
7
|
-
reason: "lease_reused" | "pin" | "rotation" | "active" | "all_capped" | "none";
|
|
7
|
+
reason: "lease_reused" | "pin" | "rotation" | "active" | "all_capped" | "allocator_disabled" | "none";
|
|
8
8
|
};
|
|
9
9
|
export type CodexFleetShadowComparisonV1 = "match" | "different_candidate" | "different_outcome" | "not_comparable_truncated";
|
|
10
10
|
export type CodexFleetShadowPayloadV1 = {
|
|
@@ -16,6 +16,6 @@ export declare function executeCodexImageGeneration(input: {
|
|
|
16
16
|
prompt: string;
|
|
17
17
|
references?: readonly ResolvedImageGenerationReference[];
|
|
18
18
|
credentialId: string;
|
|
19
|
-
codexContext: Pick<CodexRequestContext, "clientVersion" | "getToken" | "refresh">;
|
|
19
|
+
codexContext: Pick<CodexRequestContext, "clientVersion" | "getToken" | "refresh" | "beforeProviderDispatch">;
|
|
20
20
|
abortSignal?: AbortSignal;
|
|
21
21
|
}): Promise<GeneratedImageReceipt>;
|
|
@@ -51,9 +51,13 @@ export type RotationDecision = {
|
|
|
51
51
|
} | {
|
|
52
52
|
kind: "none";
|
|
53
53
|
};
|
|
54
|
+
export type CodexTurnLeaseDecision = RotationDecision | {
|
|
55
|
+
kind: "allocatorDisabled";
|
|
56
|
+
credentialId: string;
|
|
57
|
+
};
|
|
54
58
|
export type CodexTurnLeaseSelection = {
|
|
55
59
|
credentialId: string | null;
|
|
56
|
-
decision:
|
|
60
|
+
decision: CodexTurnLeaseDecision;
|
|
57
61
|
/** Policy/manual homes never move the workspace-global legacy pointer. */
|
|
58
62
|
advanceActivePointer?: boolean;
|
|
59
63
|
};
|
|
@@ -169,57 +173,6 @@ export declare function authoritativeCodexCapacityResetAt(accounts: CodexRotatio
|
|
|
169
173
|
* earliestResetAt through this before returning continueDelayMs.
|
|
170
174
|
*/
|
|
171
175
|
export declare function computeIdleDelayMs(earliestResetAt: Date, now: Date, maxMs: number): number;
|
|
172
|
-
/**
|
|
173
|
-
* Slow-retry floor (Finding 1a) for the double-fault where the just-served
|
|
174
|
-
* account's cooldown write could NOT be confirmed persisted: the next proactive
|
|
175
|
-
* rank might re-select the same capped account (stale-low cached usedPercent, not
|
|
176
|
-
* cooling). A positive floor degrades that to a SLOW retry instead of a
|
|
177
|
-
* model-paced hot loop. A few seconds — long enough to break the loop, short
|
|
178
|
-
* enough to stay responsive once the transient write fault clears.
|
|
179
|
-
*/
|
|
180
|
-
export declare const REACTIVE_PERSISTENCE_FAULT_FLOOR_MS = 5000;
|
|
181
|
-
/**
|
|
182
|
-
* Circuit-breaker slack (Finding 1b) added to the connected-account count to bound
|
|
183
|
-
* consecutive reactive failovers. Each legitimate failover cools one account, so
|
|
184
|
-
* after at most N failovers every account is capped and the reactive path takes the
|
|
185
|
-
* all-capped idle instead; the +margin absorbs benign capacity re-ranks without
|
|
186
|
-
* tripping the breaker in normal use.
|
|
187
|
-
*/
|
|
188
|
-
export declare const REACTIVE_ROTATION_MARGIN = 2;
|
|
189
|
-
/**
|
|
190
|
-
* The FIXED positive idle the reactive path falls to once consecutive reactive
|
|
191
|
-
* failovers exceed the bound (a double-fault where cooldown writes are not sticking
|
|
192
|
-
* AND the 429s carry no usage headers, so the same account keeps getting re-picked).
|
|
193
|
-
* Mirrors the all-capped floor — a mandatory, bounded hold, never another 0-delay
|
|
194
|
-
* re-dispatch — so the loop can never hammer the capped backend + DB (invariant 4).
|
|
195
|
-
*/
|
|
196
|
-
export declare const REACTIVE_CIRCUIT_BREAKER_IDLE_MS = 60000;
|
|
197
|
-
/** The reactive-resume shape returned to the goal-continuation caller. */
|
|
198
|
-
export type ReactiveRotationResume = {
|
|
199
|
-
continueDelayMs: number;
|
|
200
|
-
idleUntilReset: boolean;
|
|
201
|
-
};
|
|
202
|
-
/**
|
|
203
|
-
* Decide the continueDelayMs for a reactive 429 failover onto a LIVE candidate,
|
|
204
|
-
* bounding the (otherwise 0-delay) re-dispatch against two second-order faults:
|
|
205
|
-
*
|
|
206
|
-
* 1. Circuit breaker (1b): if the consecutive reactive-failover streak (prior
|
|
207
|
-
* rotated 429 failovers since the last successful turn, PLUS this one) exceeds
|
|
208
|
-
* `connectedAccountCount + REACTIVE_ROTATION_MARGIN`, fall to a FIXED positive,
|
|
209
|
-
* MANDATORY idle. Covers the double-fault (cooldown write not persisted + a
|
|
210
|
-
* header-less cap 429) where the same capped account is re-picked every turn.
|
|
211
|
-
* 2. Persistence-fault floor (1a): if the just-served account's cooldown could NOT
|
|
212
|
-
* be confirmed persisted, use a positive floor (slow retry) instead of 0.
|
|
213
|
-
*
|
|
214
|
-
* Otherwise (a confirmed cooldown + an in-bounds streak) returns the unchanged
|
|
215
|
-
* 0-delay fast re-dispatch — the happy single-rotation path is byte-identical.
|
|
216
|
-
* Pure so the boundedness contract is unit-testable without a worker/db env.
|
|
217
|
-
*/
|
|
218
|
-
export declare function computeReactiveRotationResume(args: {
|
|
219
|
-
cooldownPersisted: boolean;
|
|
220
|
-
priorConsecutiveRotations: number;
|
|
221
|
-
connectedAccountCount: number;
|
|
222
|
-
}): ReactiveRotationResume;
|
|
223
176
|
/**
|
|
224
177
|
* THE pure rotation ranker. `accounts` arrives in stable created_at order
|
|
225
178
|
* (listCodexAccountStatuses), which deterministically breaks ranking ties.
|
|
@@ -231,26 +184,14 @@ export declare function chooseRotationActive(args: {
|
|
|
231
184
|
accounts: CodexRotationAccount[];
|
|
232
185
|
now: Date;
|
|
233
186
|
}): RotationDecision;
|
|
234
|
-
/**
|
|
235
|
-
* Exact pre-0053 selector used while the lease cutover is off.
|
|
236
|
-
*
|
|
237
|
-
* Old workers keep a healthy `most_remaining` active pointer sticky and know
|
|
238
|
-
* nothing about lease counts or fairness cursors. A compatible worker must do
|
|
239
|
-
* the same until BOTH the deployment flag and workspace cutover are enabled;
|
|
240
|
-
* otherwise a rolling fleet would run two allocators at once. When the active
|
|
241
|
-
* pointer is no longer eligible, zeroing the additive metadata delegates to the
|
|
242
|
-
* same capacity ranking that the old selector used.
|
|
243
|
-
*/
|
|
244
|
-
export declare function chooseLegacyRotationActive(args: Parameters<typeof chooseRotationActive>[0]): RotationDecision;
|
|
245
187
|
/**
|
|
246
188
|
* Full pure policy at the transaction boundary. A live same-turn lease is
|
|
247
|
-
* idempotent;
|
|
189
|
+
* idempotent; manual and rotation-off policy preserve pin>pointer behavior; a
|
|
248
190
|
* healthy pin wins only while eligible, so quota/auth quarantine cannot trap a
|
|
249
191
|
* session on one subscription.
|
|
250
192
|
*/
|
|
251
|
-
export declare function selectCodexCredentialLeaseForTurn(args: {
|
|
252
|
-
context: CodexCredentialLeaseSelectionContext
|
|
253
|
-
leasingEnabled: boolean;
|
|
193
|
+
export declare function selectCodexCredentialLeaseForTurn<TPolicyScope = never, TUnavailableDiagnostic = never>(args: {
|
|
194
|
+
context: CodexCredentialLeaseSelectionContext<TPolicyScope, TUnavailableDiagnostic>;
|
|
254
195
|
sessionId: string;
|
|
255
196
|
sessionPinnedCredentialId: string | null;
|
|
256
197
|
sessionPinSource: CodexPinSource | null;
|
|
@@ -54,6 +54,8 @@ export declare function maybeCompactContext(db: Database, settings: Settings, sc
|
|
|
54
54
|
* append again — the event is already durable.
|
|
55
55
|
*/
|
|
56
56
|
publishLiveEvents?: (events: SessionEvent[]) => Promise<void>;
|
|
57
|
+
/** Observe the durable start immediately after its attempt-fenced commit. */
|
|
58
|
+
onCompactionStarted?: (trigger: "auto" | "operator" | "proactive" | "overflow") => void;
|
|
57
59
|
/** Materialize retained screenshot receipts only in the attempt-local model view. */
|
|
58
60
|
materializeHistory?: (items: CompactionItem[]) => Promise<CompactionItem[]>;
|
|
59
61
|
/** Turn-scoped attachment/modality view; canonical persisted rows stay untouched. */
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import { type Settings } from "@opengeni/config";
|
|
2
2
|
import { type SessionGoal, type ToolRef } from "@opengeni/contracts";
|
|
3
|
+
import { getWorkspaceModelPolicy } from "@opengeni/db";
|
|
3
4
|
import type { ControlActivityServices, MaybeContinueGoalInput, MaybeContinueGoalResult } from "./types.js";
|
|
4
5
|
export declare function createGoalActivities(services: () => Promise<ControlActivityServices>): {
|
|
5
6
|
enqueueGoalRetryWake: (input: MaybeContinueGoalInput) => Promise<void>;
|
|
6
7
|
maybeContinueGoal: (input: MaybeContinueGoalInput) => Promise<MaybeContinueGoalResult>;
|
|
7
8
|
};
|
|
9
|
+
export declare function goalContinuationModelDecision(input: {
|
|
10
|
+
settings: Settings;
|
|
11
|
+
workspaceModelPolicy: Awaited<ReturnType<typeof getWorkspaceModelPolicy>>;
|
|
12
|
+
inheritedModel: string;
|
|
13
|
+
sessionModel: string;
|
|
14
|
+
}): {
|
|
15
|
+
model: string;
|
|
16
|
+
blocked: string | null;
|
|
17
|
+
};
|
|
18
|
+
export declare function goalContinuationFundedWithoutCredits(settings: Settings, model: string, codexBilled: boolean): boolean;
|
|
8
19
|
export declare function goalContinuationPrompt(_goal: SessionGoal, _autoContinuation: number, _cap: number | null, options?: {
|
|
9
|
-
|
|
20
|
+
inputWaitAvailable?: boolean;
|
|
10
21
|
humanInputRespondAvailable?: boolean;
|
|
11
22
|
}): string;
|
|
12
23
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AttemptToolDefinition } from "@opengeni/codemode";
|
|
2
2
|
import type { McpPersonalConnectionDelegation } from "@opengeni/contracts";
|
|
3
3
|
import { GOOGLE_DRIVE_FILE_SCOPE, GOOGLE_DRIVE_FULL_SCOPE, type GoogleDriveOutputDestination, type GoogleDrivePublicationReceipt as GoogleDrivePublicationReceiptValue, type GoogleDrivePublicationToolInput as GoogleDrivePublicationToolInputValue } from "@opengeni/contracts/google-drive";
|
|
4
|
-
import {
|
|
4
|
+
import { getConnectionMetadata, requireFile, namedSubjectHasLiveWorkspaceAuthority, type ConnectorActionAttemptIdentity, type ConnectorActionInvocation, type Database, type ResolveConnectionCredentialInput, type ResolveConnectionCredentialResult } from "@opengeni/db";
|
|
5
5
|
import { readAuthorizedEditableArtifactMaterialization } from "@opengeni/db/editable-artifact-durable-export";
|
|
6
6
|
import { type FetchLike } from "@opengeni/network";
|
|
7
7
|
import { type ObjectStorage } from "@opengeni/storage";
|
|
@@ -24,9 +24,6 @@ export type GoogleDrivePublicationPorts = {
|
|
|
24
24
|
getMembership: typeof namedSubjectHasLiveWorkspaceAuthority;
|
|
25
25
|
readMaterialization: typeof readAuthorizedEditableArtifactMaterialization;
|
|
26
26
|
requireFile: typeof requireFile;
|
|
27
|
-
prepare: typeof prepareConnectorActionApproval;
|
|
28
|
-
begin: typeof beginConnectorActionExecution;
|
|
29
|
-
complete: typeof completeConnectorActionExecution;
|
|
30
27
|
fetch: FetchLike;
|
|
31
28
|
};
|
|
32
29
|
export declare function resolveGoogleDrivePublicationTarget(db: Database, workspace: {
|
|
@@ -44,14 +41,6 @@ export declare function createGoogleDrivePublicationAttemptTool(input: {
|
|
|
44
41
|
signal?: AbortSignal;
|
|
45
42
|
ports?: GoogleDrivePublicationPorts;
|
|
46
43
|
}): AttemptToolDefinition;
|
|
47
|
-
export declare function authorizeGoogleDrivePublicationAttempt(input: {
|
|
48
|
-
db: Database;
|
|
49
|
-
identity: ConnectorActionAttemptIdentity;
|
|
50
|
-
target: GoogleDrivePublicationTarget;
|
|
51
|
-
approvalId: string;
|
|
52
|
-
arguments: unknown;
|
|
53
|
-
ports?: Pick<GoogleDrivePublicationPorts, "prepare">;
|
|
54
|
-
}): Promise<void>;
|
|
55
44
|
export declare function executeGoogleDrivePublication(input: {
|
|
56
45
|
db: Database;
|
|
57
46
|
objectStorage: ObjectStorage;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { beginImageGenerationOperation, completeImageGenerationOperation, markImageGenerationOperationOutcomeUnknown, markImageGenerationOperationRetentionFailed, prepareImageGenerationOperation, type Database } from "@opengeni/db";
|
|
1
|
+
import { beginImageGenerationOperation, completeImageGenerationOperation, markImageGenerationOperationOutcomeUnknown, markImageGenerationOperationRetentionFailed, prepareImageGenerationOperation, resetImageGenerationOperationBeforeProviderDispatch, type Database } from "@opengeni/db";
|
|
2
2
|
import type { ObjectStorage } from "@opengeni/storage";
|
|
3
3
|
import { retainGeneratedImage, type GeneratedImageOutput, type GeneratedImageReceipt } from "./generated-images.js";
|
|
4
4
|
export declare class ImageGenerationOutcomeUnknownError extends Error {
|
|
@@ -12,6 +12,7 @@ export declare class ImageGenerationRetentionFailedError extends Error {
|
|
|
12
12
|
export type ImageGenerationOperationPorts = {
|
|
13
13
|
prepare: typeof prepareImageGenerationOperation;
|
|
14
14
|
begin: typeof beginImageGenerationOperation;
|
|
15
|
+
resetBeforeProviderDispatch: typeof resetImageGenerationOperationBeforeProviderDispatch;
|
|
15
16
|
retain: typeof retainGeneratedImage;
|
|
16
17
|
complete: typeof completeImageGenerationOperation;
|
|
17
18
|
markOutcomeUnknown: typeof markImageGenerationOperationOutcomeUnknown;
|
|
@@ -21,9 +22,10 @@ export type ImageGenerationOperationPorts = {
|
|
|
21
22
|
/**
|
|
22
23
|
* Durable admission fence shared by every client-executed image provider.
|
|
23
24
|
* Provider execution is permitted at most once after the prepared ->
|
|
24
|
-
* provider_started transition. A
|
|
25
|
-
*
|
|
26
|
-
*
|
|
25
|
+
* provider_started transition. A verified pre-dispatch fence rejection returns
|
|
26
|
+
* the row to `prepared`; a crash or any error after dispatch admission may
|
|
27
|
+
* conservatively leave the outcome unknown. A retry may recover a ready
|
|
28
|
+
* artifact, but never blindly replays an admitted paid operation.
|
|
27
29
|
*/
|
|
28
30
|
export type ExecuteImageGenerationOperationInput = {
|
|
29
31
|
db: Database;
|
|
@@ -42,6 +44,13 @@ export type ExecuteImageGenerationOperationInput = {
|
|
|
42
44
|
mediaType: string;
|
|
43
45
|
sha256: string;
|
|
44
46
|
}>[];
|
|
47
|
+
/**
|
|
48
|
+
* Provider-specific proof that a thrown error occurred before the paid
|
|
49
|
+
* provider boundary was crossed. Such a failure may return the operation to
|
|
50
|
+
* `prepared`; every other generation error remains outcome-ambiguous after
|
|
51
|
+
* `provider_started` and is never blindly replayed.
|
|
52
|
+
*/
|
|
53
|
+
isProviderDispatchRejected?: (error: unknown) => boolean;
|
|
45
54
|
generate: () => Promise<GeneratedImageOutput>;
|
|
46
55
|
};
|
|
47
56
|
export declare function executeImageGenerationOperation(input: ExecuteImageGenerationOperationInput, ports?: ImageGenerationOperationPorts): Promise<GeneratedImageReceipt>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ImageGenerationReference } from "@opengeni/contracts";
|
|
1
|
+
import { type ImageGenerationReference, type FileAsset } from "@opengeni/contracts";
|
|
2
2
|
import { type Database } from "@opengeni/db";
|
|
3
3
|
import type { ObjectStorage } from "@opengeni/storage";
|
|
4
4
|
import { type GeneratedImageMediaType } from "./generated-images.js";
|
|
@@ -57,3 +57,4 @@ export declare function resolveImageGenerationReferencesForTool(input: ResolveIm
|
|
|
57
57
|
* /workspace. Provider adapters receive only validated immutable bytes.
|
|
58
58
|
*/
|
|
59
59
|
export declare function resolveImageGenerationReferences(input: ResolveImageGenerationReferencesInput): Promise<ResolvedImageGenerationReference[]>;
|
|
60
|
+
export declare function readStoredImageReferenceFile(objectStorage: Pick<ObjectStorage, "getFileBytes">, file: FileAsset): Promise<Uint8Array>;
|
|
@@ -10,6 +10,7 @@ type ScheduledTemporalActivityIdentity = {
|
|
|
10
10
|
activityId: string;
|
|
11
11
|
};
|
|
12
12
|
export declare function scheduledTaskRunProducerKey(input: DispatchScheduledTaskRunInput, suppliedActivityIdentity?: ScheduledTemporalActivityIdentity): string;
|
|
13
|
+
export declare function scheduledTaskGeneratedSessionCreateIdempotencyKey(producerKey: string): string;
|
|
13
14
|
/**
|
|
14
15
|
* Display title for a session the scheduler generates for a task.
|
|
15
16
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { settleSessionAttemptInterruptions, applySessionTurnSettlement, enqueueSessionWorkflowWake, failSessionWorkBeforeAttemptClaim, requestSessionTurnRecovery, recoverSessionDispatch, reconcileSessionAttemptQuiescence, peekSessionWork as peekSessionWorkDb, countQueuedTurns, getSessionAttemptActivityRef, getSessionEvent, getSessionTurnForAttempt, expireSessionInteractionIntervention as expireSessionInteractionInterventionDb, expireSessionHumanInputRequest, markSessionAttemptQuiesced, requireSession, settleSessionIdleWithParentOutbox } from "@opengeni/db";
|
|
1
|
+
import { settleSessionAttemptInterruptions, applySessionTurnSettlement, enqueueSessionWorkflowWake, failSessionWorkBeforeAttemptClaim, requestSessionTurnRecovery, recoverSessionDispatch, reconcileSessionAttemptQuiescence, peekSessionWork as peekSessionWorkDb, settleSessionInputWait as settleSessionInputWaitDb, countQueuedTurns, getSessionAttemptActivityRef, getSessionEvent, getSessionTurnForAttempt, expireSessionInteractionIntervention as expireSessionInteractionInterventionDb, expireSessionHumanInputRequest, markSessionAttemptQuiesced, requireSession, settleSessionIdleWithParentOutbox } from "@opengeni/db";
|
|
2
2
|
import { publishDurableSessionEvents } from "@opengeni/events";
|
|
3
3
|
import { deliverFailedChildTurnToParent, notifyParentOfChildIdle } from "./parent-wake.js";
|
|
4
4
|
import { recordTurnsQueuedGauge, recordWorkerDeathRecoveryMetrics } from "../observability-metrics.js";
|
|
5
|
-
import type { ControlActivityServices, ExpireSessionHumanInputInput, ExpireSessionHumanInputResult, ExpireSessionInteractionInterventionInput, ExpireSessionInteractionInterventionResult, PeekSessionWorkInput, FailSessionAttemptInput, FailSessionAttemptResult, SettleSessionInterruptionsInput, MarkSessionIdleInput, PersistSessionAttemptQuiescenceInput, ReconcileSessionAttemptQuiescenceInput, ReconcileSessionAttemptQuiescenceResult, RecoverDispatchInput, RecoverDispatchResult, RecoverEscapedMcpTimeoutInput, RecoverEscapedMcpTimeoutResult } from "./types.js";
|
|
5
|
+
import type { ControlActivityServices, ExpireSessionHumanInputInput, ExpireSessionHumanInputResult, ExpireSessionInteractionInterventionInput, ExpireSessionInteractionInterventionResult, PeekSessionWorkInput, FailSessionAttemptInput, FailSessionAttemptResult, SettleSessionInterruptionsInput, MarkSessionIdleInput, PersistSessionAttemptQuiescenceInput, ReconcileSessionAttemptQuiescenceInput, ReconcileSessionAttemptQuiescenceResult, RecoverDispatchInput, RecoverDispatchResult, RecoverEscapedMcpTimeoutInput, RecoverEscapedMcpTimeoutResult, SettleSessionInputWaitInput, SettleSessionInputWaitResult } from "./types.js";
|
|
6
6
|
export type SessionStateActivityOverrides = Partial<{
|
|
7
7
|
settleSessionAttemptInterruptions: typeof settleSessionAttemptInterruptions;
|
|
8
8
|
applySessionTurnSettlement: typeof applySessionTurnSettlement;
|
|
@@ -12,6 +12,7 @@ export type SessionStateActivityOverrides = Partial<{
|
|
|
12
12
|
recoverSessionDispatch: typeof recoverSessionDispatch;
|
|
13
13
|
reconcileSessionAttemptQuiescence: typeof reconcileSessionAttemptQuiescence;
|
|
14
14
|
peekSessionWork: typeof peekSessionWorkDb;
|
|
15
|
+
settleSessionInputWait: typeof settleSessionInputWaitDb;
|
|
15
16
|
countQueuedTurns: typeof countQueuedTurns;
|
|
16
17
|
getSessionAttemptActivityRef: typeof getSessionAttemptActivityRef;
|
|
17
18
|
getSessionEvent: typeof getSessionEvent;
|
|
@@ -38,6 +39,7 @@ export declare function createSessionStateActivities(services: () => Promise<Con
|
|
|
38
39
|
recoverDispatch: (input: RecoverDispatchInput) => Promise<RecoverDispatchResult>;
|
|
39
40
|
recoverEscapedMcpTimeout: (input: RecoverEscapedMcpTimeoutInput) => Promise<RecoverEscapedMcpTimeoutResult>;
|
|
40
41
|
peekSessionWork: (input: PeekSessionWorkInput) => Promise<import("@opengeni/db").SessionWorkPeek>;
|
|
42
|
+
settleSessionInputWait: (input: SettleSessionInputWaitInput) => Promise<SettleSessionInputWaitResult>;
|
|
41
43
|
expireSessionHumanInput: (input: ExpireSessionHumanInputInput) => Promise<ExpireSessionHumanInputResult>;
|
|
42
44
|
expireSessionInteractionIntervention: (input: ExpireSessionInteractionInterventionInput) => Promise<ExpireSessionInteractionInterventionResult>;
|
|
43
45
|
markSessionIdle: (input: MarkSessionIdleInput) => Promise<void>;
|
|
@@ -53,6 +53,11 @@ export type InspectSessionAttemptActivity = (input: {
|
|
|
53
53
|
* agent runtime and document parser so each process can load only its role. */
|
|
54
54
|
export type SharedActivityServices = {
|
|
55
55
|
settings: Settings;
|
|
56
|
+
/**
|
|
57
|
+
* Original environment/host settings retained across live database-catalog
|
|
58
|
+
* refreshes. Older embedded test hosts may omit it and fall back to settings.
|
|
59
|
+
*/
|
|
60
|
+
catalogSourceSettings?: Settings;
|
|
56
61
|
db: Database;
|
|
57
62
|
bus: EventBus;
|
|
58
63
|
objectStorage: ObjectStorage | null;
|
|
@@ -267,6 +272,16 @@ export type PeekSessionWorkInput = {
|
|
|
267
272
|
workspaceId: string;
|
|
268
273
|
sessionId: string;
|
|
269
274
|
};
|
|
275
|
+
export type SettleSessionInputWaitInput = {
|
|
276
|
+
accountId: string;
|
|
277
|
+
workspaceId: string;
|
|
278
|
+
sessionId: string;
|
|
279
|
+
waitTurnId: string;
|
|
280
|
+
disposition: "held" | "timeout" | "superseded";
|
|
281
|
+
};
|
|
282
|
+
export type SettleSessionInputWaitResult = {
|
|
283
|
+
action: "held" | "timeout" | "superseded" | "stale";
|
|
284
|
+
};
|
|
270
285
|
export type ExpireSessionHumanInputInput = {
|
|
271
286
|
accountId: string;
|
|
272
287
|
workspaceId: string;
|
|
@@ -296,7 +311,7 @@ export type MaybeContinueGoalInput = {
|
|
|
296
311
|
workflowId: string;
|
|
297
312
|
};
|
|
298
313
|
export type MaybeContinueGoalResult = {
|
|
299
|
-
action: "none" | "queue" | "continue" | "paused" | "
|
|
314
|
+
action: "none" | "queue" | "continue" | "paused" | "deferred";
|
|
300
315
|
};
|
|
301
316
|
export type DispatchScheduledTaskRunInput = {
|
|
302
317
|
workspaceId: string;
|
|
@@ -357,6 +372,9 @@ export type DispatchAutomationRunResult = {
|
|
|
357
372
|
} | {
|
|
358
373
|
action: "skipped";
|
|
359
374
|
reason: string;
|
|
375
|
+
} | {
|
|
376
|
+
action: "failed";
|
|
377
|
+
reason: string;
|
|
360
378
|
} | {
|
|
361
379
|
action: "not_found";
|
|
362
380
|
};
|