@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
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { resolveTurnExecutionPolicyV1, type Settings } from "@opengeni/config";
|
|
2
2
|
import type { TurnActivityServices as ActivityServices } from "../types.js";
|
|
3
|
-
import { type SessionEvent, type SessionTurn, type ToolAuthNeededPayload, type TurnExecutionPolicyV1 } from "@opengeni/contracts";
|
|
3
|
+
import { type SessionEvent, type SessionTurn, type ToolAuthNeededPayload, type TurnExecutionPolicyV1, type XaiProviderAccountAuthoritySnapshotV1 } from "@opengeni/contracts";
|
|
4
4
|
export declare class WorkspaceHumanInputDisabledError extends Error {
|
|
5
5
|
constructor(kind: "resume" | "interruption");
|
|
6
6
|
}
|
|
7
7
|
export declare function assertWorkspaceHumanInputAllowed(enabled: boolean, kind: "resume" | "interruption", attempted: boolean): void;
|
|
8
8
|
/** Broad personal lookup is allowed only for a direct human/API command. */
|
|
9
9
|
export declare function credentialSubjectIdForTurnInitiator(turn: Pick<SessionTurn, "source" | "initiator" | "initiatorContext">): string | undefined;
|
|
10
|
+
export declare function xaiCatalogReadinessAuthority(turn: {
|
|
11
|
+
initiatingHumanSubjectId: string | null;
|
|
12
|
+
xaiProviderAccountAuthoritySnapshot: XaiProviderAccountAuthoritySnapshotV1;
|
|
13
|
+
}, directCredentialSubjectId: string | undefined): {
|
|
14
|
+
subjectId: string;
|
|
15
|
+
authoritySnapshot: XaiProviderAccountAuthoritySnapshotV1;
|
|
16
|
+
} | null;
|
|
10
17
|
/**
|
|
11
18
|
* Direct authenticated-human work is the persisted human source with subject
|
|
12
19
|
* authority and no inherited agent or legacy provenance. Use this complete
|
|
@@ -22,8 +29,16 @@ export declare function isDirectHumanTurnInitiation(turn: Pick<SessionTurn, "sou
|
|
|
22
29
|
* Slack explicitly. Other providers retain the existing generic behavior.
|
|
23
30
|
*/
|
|
24
31
|
export declare function shouldPublishToolAuthNeededForTurn(payload: Pick<ToolAuthNeededPayload, "providerDomain" | "toolName">, trigger: Pick<SessionEvent, "type" | "payload">, turn: Pick<SessionTurn, "source" | "initiator" | "initiatorContext">): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Keep host-owned auth events inert in browsers from before authoritySource
|
|
34
|
+
* existed. Those bundles treat unsupported_auth as unavailable and therefore
|
|
35
|
+
* do not invoke native OAuth; upgraded clients read hostReason and the
|
|
36
|
+
* host-minted authorizationUrl.
|
|
37
|
+
*/
|
|
38
|
+
export declare function rollingSafeToolAuthNeededPayload(payload: ToolAuthNeededPayload): ToolAuthNeededPayload;
|
|
25
39
|
export declare function turnExecutionPolicyBillingIdentity(policy: TurnExecutionPolicyV1): {
|
|
26
40
|
externallyBilled: boolean;
|
|
41
|
+
countsTowardTokenCap: boolean;
|
|
27
42
|
codexSubscription: boolean;
|
|
28
43
|
xaiSubscription: boolean;
|
|
29
44
|
};
|
|
@@ -49,4 +64,4 @@ export declare class BudgetExhaustedError extends Error {
|
|
|
49
64
|
readonly serializedRunState: string | null;
|
|
50
65
|
constructor(message: string, serializedRunState: string | null);
|
|
51
66
|
}
|
|
52
|
-
export declare function ensureRunAllowed(settings: Settings, db: ActivityServices["db"], accountId: string, workspaceId: string, isExternallyBilledTurn: boolean, entitlements?: ActivityServices["entitlements"]): Promise<void>;
|
|
67
|
+
export declare function ensureRunAllowed(settings: Settings, db: ActivityServices["db"], accountId: string, workspaceId: string, isExternallyBilledTurn: boolean, entitlements?: ActivityServices["entitlements"], chargesOpenGeniCredits?: boolean, countsTowardTokenCap?: boolean): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AttemptConnectorActionBinding, type SandboxFileDownload } from "@opengeni/runtime";
|
|
1
|
+
import { type AttemptConnectorActionBinding, type ConnectorActionPolicyHooks, type SandboxFileDownload } from "@opengeni/runtime";
|
|
2
2
|
import { type Settings } from "@opengeni/config";
|
|
3
3
|
import { type CodexRequestContext } from "@opengeni/codex";
|
|
4
4
|
import type { TurnActivityServices as ActivityServices, RunAgentTurnInput } from "../types.js";
|
|
@@ -60,15 +60,8 @@ export type BuildTurnAgentDeps = {
|
|
|
60
60
|
sandboxCodemodeToken: string | undefined;
|
|
61
61
|
fileResourceDownloads: SandboxFileDownload[];
|
|
62
62
|
attemptConnectorActionBindings: readonly AttemptConnectorActionBinding[];
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
workspaceId: string;
|
|
66
|
-
sessionId: string;
|
|
67
|
-
turnId: string;
|
|
68
|
-
attemptId: string;
|
|
69
|
-
executionGeneration: number;
|
|
70
|
-
initiator: Pick<ClaimTurnOk["turn"]["initiator"], "kind" | "subjectId">;
|
|
71
|
-
};
|
|
63
|
+
connectorActionPolicy: ConnectorActionPolicyHooks;
|
|
64
|
+
trigger: ClaimTurnOk["trigger"];
|
|
72
65
|
preparationIndependentToolNames: readonly string[];
|
|
73
66
|
videoGenerationAcceptancesByCallId: Map<string, {
|
|
74
67
|
operationId: string;
|
|
@@ -10,6 +10,7 @@ import type { AttemptIdentityState, BillingState, ClaimedResult, EventingState,
|
|
|
10
10
|
export type ClaimTurnDeps = {
|
|
11
11
|
input: RunAgentTurnInput;
|
|
12
12
|
settings: Settings;
|
|
13
|
+
catalogSourceSettings: Settings;
|
|
13
14
|
db: ActivityServices["db"];
|
|
14
15
|
bus: ActivityServices["bus"];
|
|
15
16
|
runtime: ActivityServices["runtime"];
|
|
@@ -57,6 +58,13 @@ export type ClaimTurnOk = {
|
|
|
57
58
|
* themselves.
|
|
58
59
|
*/
|
|
59
60
|
export declare function turnAttemptProducerId(input: Pick<RunAgentTurnInput, "workflowId" | "attemptId">, turnId: string): string;
|
|
61
|
+
/**
|
|
62
|
+
* Durable Codex lease holder for one accepted turn attempt. Temporal activity
|
|
63
|
+
* ids may repeat after workflow restart or continue-as-new, so they are not
|
|
64
|
+
* owner identity. The attempt id is generated by the workflow for each
|
|
65
|
+
* redispatch and remains stable when the same activity input is retried.
|
|
66
|
+
*/
|
|
67
|
+
export declare function codexCredentialLeaseHolderId(input: Pick<RunAgentTurnInput, "workflowId" | "attemptId">, turnId: string): string;
|
|
60
68
|
export type ClaimTurnOutcome = {
|
|
61
69
|
exit: RunAgentTurnResult;
|
|
62
70
|
} | {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type CodexAccountStatus } from "@opengeni/db";
|
|
2
|
-
import { type
|
|
2
|
+
import { type ResolvedModelProvider, type Settings } from "@opengeni/config";
|
|
3
3
|
import type { TurnActivityServices as ActivityServices } from "../types.js";
|
|
4
4
|
export declare function codexWorkspaceMetricKey(workspaceId: string): string;
|
|
5
5
|
/** Stable public request identity across partial resumes and activity retries. */
|
|
6
6
|
export declare function acceptsPromptCacheKeyForTurn(resolvedModel: {
|
|
7
7
|
provider: {
|
|
8
|
-
kind:
|
|
8
|
+
kind: ResolvedModelProvider["kind"];
|
|
9
9
|
builtin?: boolean;
|
|
10
10
|
};
|
|
11
11
|
} | null): boolean;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { SharedActivityServices } from "../types.js";
|
|
2
2
|
export type LeaseRenewReason = "timer" | "runtime_event" | "model_usage";
|
|
3
3
|
export type LeaseLossReason = "deadline" | "not_found";
|
|
4
|
+
export declare class CodexCredentialLeaseLostError extends Error {
|
|
5
|
+
readonly reason: LeaseLossReason;
|
|
6
|
+
readonly code = "codex_credential_lease_lost";
|
|
7
|
+
constructor(reason: LeaseLossReason);
|
|
8
|
+
}
|
|
4
9
|
export type TurnCredentialLeaseDeps = {
|
|
5
10
|
db: SharedActivityServices["db"];
|
|
6
11
|
observability: SharedActivityServices["observability"];
|
|
@@ -18,6 +23,7 @@ export declare class CodexTurnLease {
|
|
|
18
23
|
private readonly deps;
|
|
19
24
|
held: boolean;
|
|
20
25
|
lost: boolean;
|
|
26
|
+
lossReason: LeaseLossReason | null;
|
|
21
27
|
holderId: string | null;
|
|
22
28
|
generation: number | null;
|
|
23
29
|
confirmedUntilMs: number | null;
|
|
@@ -25,6 +31,8 @@ export declare class CodexTurnLease {
|
|
|
25
31
|
private heartbeatTimer;
|
|
26
32
|
constructor(deps: TurnCredentialLeaseDeps);
|
|
27
33
|
markLost: (reason: LeaseLossReason) => void;
|
|
34
|
+
/** Fail closed at the last worker-confirmed lease deadline before dispatch. */
|
|
35
|
+
assertUsable: () => void;
|
|
28
36
|
renew: (reason: LeaseRenewReason) => Promise<void>;
|
|
29
37
|
startHeartbeat: () => void;
|
|
30
38
|
stopHeartbeat: () => void;
|
|
@@ -11,7 +11,6 @@ export type TurnFailureDeps = {
|
|
|
11
11
|
bus: ActivityServices["bus"];
|
|
12
12
|
observability: ActivityServices["observability"];
|
|
13
13
|
wakeSessionWorkflow: ActivityServices["wakeSessionWorkflow"];
|
|
14
|
-
signalCodexCapacityWorkflow: ActivityServices["signalCodexCapacityWorkflow"];
|
|
15
14
|
cancellationSignal: AbortSignal | undefined;
|
|
16
15
|
sandboxRotationController: AbortController;
|
|
17
16
|
noteCancellationRequested: () => void;
|
|
@@ -30,4 +29,47 @@ export type TurnFailureDeps = {
|
|
|
30
29
|
acknowledgeLostAttemptOwnership: () => void;
|
|
31
30
|
acknowledgeRecoveryQuiescence: () => void;
|
|
32
31
|
};
|
|
32
|
+
export type CodexDefinitiveFailureDisposition = "failover" | "wait" | "terminal";
|
|
33
|
+
type CodexCapacityWaitFailurePayload = {
|
|
34
|
+
error: string;
|
|
35
|
+
code: string;
|
|
36
|
+
detail?: string;
|
|
37
|
+
retryable: false;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Pure policy for a definitive serving-credential refusal. A policy-constrained
|
|
41
|
+
* account and an all-unavailable pool wait for the same selected capacity to
|
|
42
|
+
* recover; only a truly empty/non-allocatable pool makes an auth/forbidden
|
|
43
|
+
* failure terminal. A different eligible account under rotation-on policy may
|
|
44
|
+
* recover the same durable turn immediately.
|
|
45
|
+
*/
|
|
46
|
+
export declare function codexDefinitiveFailureDisposition(input: {
|
|
47
|
+
failureKind: "auth" | "forbidden" | "rate_limit" | "quota";
|
|
48
|
+
rotationEnabled: boolean;
|
|
49
|
+
pinDisposition: "manual" | "sharded" | "clearStale" | "unpinned";
|
|
50
|
+
decisionKind: "active" | "allCapped" | "none";
|
|
51
|
+
decisionCredentialId: string | null;
|
|
52
|
+
servingCredentialId: string;
|
|
53
|
+
}): CodexDefinitiveFailureDisposition;
|
|
54
|
+
/**
|
|
55
|
+
* Bound one turn to the alternate credentials that policy actually permits.
|
|
56
|
+
* The effective account list is already workspace/organization scoped;
|
|
57
|
+
* allocator-disabled rows must not enlarge the retry budget. The database
|
|
58
|
+
* requires a positive bound even though one-account paths never fail over.
|
|
59
|
+
*/
|
|
60
|
+
export declare function codexCredentialFailoverLimit(accounts: ReadonlyArray<{
|
|
61
|
+
id: string;
|
|
62
|
+
allocatorEnabled: boolean;
|
|
63
|
+
}>, servingCredentialId: string): number;
|
|
64
|
+
/** Build the durable waiter payload without collapsing quota refusals into 403. */
|
|
65
|
+
export declare function codexCapacityWaitFailurePayload(input: {
|
|
66
|
+
failureKind: "auth" | "forbidden" | "rate_limit" | "quota";
|
|
67
|
+
usageLimit: {
|
|
68
|
+
resetsInSeconds: number | null;
|
|
69
|
+
} | null;
|
|
70
|
+
cooldownSeconds: number | null;
|
|
71
|
+
detail: string;
|
|
72
|
+
allAccounts: boolean;
|
|
73
|
+
}): CodexCapacityWaitFailurePayload;
|
|
33
74
|
export declare function settleTurnFailure(deps: TurnFailureDeps): Promise<RunAgentTurnResult>;
|
|
75
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AttemptToolDefinition } from "@opengeni/codemode";
|
|
2
|
+
import type { WorkspaceModelSelection } from "@opengeni/core";
|
|
3
|
+
export declare const LIST_MODELS_TOOL_NAME = "list_models";
|
|
4
|
+
export declare const LIST_MODELS_TOOL_DESCRIPTION = "List the models this workspace can select right now, in picker order, with deployment-defined cost and optional guidance. This does not switch the current session model; use an ID with session_create or the human model picker.";
|
|
5
|
+
export declare function renderListModels(input: {
|
|
6
|
+
currentModelId: string | null;
|
|
7
|
+
selections: readonly WorkspaceModelSelection[];
|
|
8
|
+
modelNotes: Readonly<Record<string, string>>;
|
|
9
|
+
}): string;
|
|
10
|
+
export declare function createListModelsAttemptToolDefinition(input: {
|
|
11
|
+
currentModelId: string | null;
|
|
12
|
+
load: () => Promise<{
|
|
13
|
+
selections: readonly WorkspaceModelSelection[];
|
|
14
|
+
modelNotes: Readonly<Record<string, string>>;
|
|
15
|
+
}>;
|
|
16
|
+
}): AttemptToolDefinition;
|
|
@@ -47,6 +47,7 @@ export type CompactionModelUsageEventState = {
|
|
|
47
47
|
};
|
|
48
48
|
export declare function createModelResponseEventState(claimedSourceKeys?: Set<string>): ModelResponseEventState;
|
|
49
49
|
export declare function createCompactionModelUsageEventState(claimedSourceKeys?: Set<string>): CompactionModelUsageEventState;
|
|
50
|
+
export declare const createSessionTitleModelUsageEventState: typeof createCompactionModelUsageEventState;
|
|
50
51
|
export declare function modelResponseContextSignal(state: ModelResponseEventState): {
|
|
51
52
|
revision: number;
|
|
52
53
|
totalTokens: number;
|
|
@@ -89,6 +90,8 @@ export declare function processModelResponseTerminalEvent(input: {
|
|
|
89
90
|
latencyMode?: LatencyMode;
|
|
90
91
|
metricProvider: string;
|
|
91
92
|
externallyBilled: boolean;
|
|
93
|
+
chargesOpenGeniCredits?: boolean;
|
|
94
|
+
countsTowardTokenCap?: boolean;
|
|
92
95
|
servingCredentialId: string | null;
|
|
93
96
|
priorSessionCredentialId: string | null;
|
|
94
97
|
emittedSourceKeys: Set<string>;
|
|
@@ -118,6 +121,7 @@ export declare function processModelResponseTerminalEvent(input: {
|
|
|
118
121
|
export declare function processCompactionModelUsageEvent(input: {
|
|
119
122
|
usage: ModelResponseUsage;
|
|
120
123
|
state: CompactionModelUsageEventState;
|
|
124
|
+
sourceKind?: "compaction" | "session-title";
|
|
121
125
|
dispatchId: string | null;
|
|
122
126
|
settings: Settings;
|
|
123
127
|
db: ActivityServices["db"];
|
|
@@ -132,6 +136,8 @@ export declare function processCompactionModelUsageEvent(input: {
|
|
|
132
136
|
providerApi: ModelProviderApi;
|
|
133
137
|
model: string;
|
|
134
138
|
externallyBilled: boolean;
|
|
139
|
+
chargesOpenGeniCredits?: boolean;
|
|
140
|
+
countsTowardTokenCap?: boolean;
|
|
135
141
|
servingCredentialId: string | null;
|
|
136
142
|
priorSessionCredentialId: string | null;
|
|
137
143
|
emittedSourceKeys: Set<string>;
|
|
@@ -147,6 +153,7 @@ export declare function processCompactionModelUsageEvent(input: {
|
|
|
147
153
|
sourceKey: string;
|
|
148
154
|
authoritative: boolean;
|
|
149
155
|
}>;
|
|
156
|
+
export declare function processSessionTitleModelUsageEvent(input: Omit<Parameters<typeof processCompactionModelUsageEvent>[0], "sourceKind">): ReturnType<typeof processCompactionModelUsageEvent>;
|
|
150
157
|
export declare function emitModelCallUsage(input: {
|
|
151
158
|
observability: ActivityServices["observability"];
|
|
152
159
|
publish: TurnEventPublisher | null;
|
|
@@ -162,6 +169,10 @@ export declare function emitModelCallUsage(input: {
|
|
|
162
169
|
usage?: unknown | null;
|
|
163
170
|
} | null;
|
|
164
171
|
normalizedUsage?: ModelCallUsageNormalization;
|
|
172
|
+
/** Accepted billing authority persisted for Insights repair after a soft fact-write failure. */
|
|
173
|
+
billingPath?: ModelUsageBillingRecord["billingPath"];
|
|
174
|
+
/** Validated Gateway endpoint provider persisted for exact Insights repair. */
|
|
175
|
+
upstreamProvider?: string;
|
|
165
176
|
servingAccountHash?: string;
|
|
166
177
|
accountChangedFromPrevCall?: boolean;
|
|
167
178
|
emittedSourceKeys?: Set<string>;
|
|
@@ -178,6 +189,8 @@ export type ModelUsageBillingRecord = {
|
|
|
178
189
|
pricedCostMicros: number;
|
|
179
190
|
/** Hypothetical provider-rate USD micros; never an OpenGeni charge. */
|
|
180
191
|
estimatedProviderCostMicros: number | null;
|
|
192
|
+
/** Hypothetical OpenGeni credit price at the captured rate; never a debit. */
|
|
193
|
+
equivalentCreditCostMicros: number | null;
|
|
181
194
|
pricingSource: "configured_list_price" | "gateway_reported" | null;
|
|
182
195
|
normalizedUsage: ModelCallUsageNormalization;
|
|
183
196
|
upstreamProvider?: string;
|
|
@@ -190,7 +203,8 @@ export declare function recordModelUsageAndDebitCredits(settings: Settings, db:
|
|
|
190
203
|
turnAttemptId: string;
|
|
191
204
|
model: string;
|
|
192
205
|
externallyBilled: boolean;
|
|
193
|
-
|
|
206
|
+
chargesOpenGeniCredits?: boolean;
|
|
207
|
+
countsTowardTokenCap?: boolean;
|
|
194
208
|
gatewayBilling?: ModelResponseUsage["gatewayBilling"];
|
|
195
209
|
usage?: ModelUsageInput | ModelCallUsageInput | null;
|
|
196
210
|
normalizedUsage?: ModelCallUsageNormalization;
|
|
@@ -9,6 +9,7 @@ import { type SessionEvent } from "@opengeni/contracts";
|
|
|
9
9
|
export declare function shouldRunTurnEndWorkspacePersistence(input: {
|
|
10
10
|
activityStatus: RunAgentTurnResult["status"] | "unknown";
|
|
11
11
|
cancellationRequested: boolean;
|
|
12
|
+
deadlineRotationRequested?: boolean;
|
|
12
13
|
}): boolean;
|
|
13
14
|
/**
|
|
14
15
|
* Periodic workspace snapshots protect work performed during a long-running
|
|
@@ -20,6 +21,7 @@ export declare function shouldStartPeriodicWorkspaceSnapshot(input: {
|
|
|
20
21
|
firstProviderRequestStarted: boolean;
|
|
21
22
|
snapshotInFlight: boolean;
|
|
22
23
|
turnEndCaptureInProgress: boolean;
|
|
24
|
+
deadlineRotationRequested: boolean;
|
|
23
25
|
}): boolean;
|
|
24
26
|
/**
|
|
25
27
|
* Temporal cancellation is delivery/transport state, never proof that the
|
|
@@ -46,6 +48,7 @@ export declare function assertSessionAttemptQuiescenceRecoveryDurable(input: {
|
|
|
46
48
|
export declare const QUIESCENCE_PROOF_SIGNAL_INITIAL_RETRY_MS = 250;
|
|
47
49
|
export declare const QUIESCENCE_PROOF_SIGNAL_MAX_RETRY_MS = 5000;
|
|
48
50
|
export declare const TURN_QUIESCENCE_WATCHDOG_MS: number;
|
|
51
|
+
export declare const TURN_FINALIZER_STEP_TIMEOUT_MS = 30000;
|
|
49
52
|
/** A fenced activity must never heartbeat forever while its physical writer
|
|
50
53
|
* drain is stuck. The last-resort worker exit stops every in-process writer;
|
|
51
54
|
* Kubernetes replaces the pod and the workflow's heartbeat-lease reconciler
|
|
@@ -97,13 +100,15 @@ export declare function releaseTurnSandboxAfterWriterDrain(sandbox: Pick<Resumed
|
|
|
97
100
|
wait?: (delayMs: number) => Promise<void>;
|
|
98
101
|
}): Promise<void>;
|
|
99
102
|
/**
|
|
100
|
-
* Await
|
|
101
|
-
* execution window.
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
103
|
+
* Await bounded, idempotent finalizer housekeeping only while this Temporal
|
|
104
|
+
* activity still owns its execution window. A completed turn must never keep
|
|
105
|
+
* heartbeating forever because a provider/tool close promise did not settle:
|
|
106
|
+
* that strands every later durable prompt behind an already-terminal attempt.
|
|
107
|
+
* Cancellation or the hard timeout detaches the operation with a rejection
|
|
108
|
+
* handler; the operation may still finish its attempt-scoped cleanup, but it
|
|
109
|
+
* cannot pin activity terminalization.
|
|
105
110
|
*/
|
|
106
|
-
export declare function waitForTurnFinalizerStep<T>(operation: Promise<T>, signal: AbortSignal | undefined): Promise<T | undefined>;
|
|
111
|
+
export declare function waitForTurnFinalizerStep<T>(operation: Promise<T>, signal: AbortSignal | undefined, timeoutMs?: number): Promise<T | undefined>;
|
|
107
112
|
/**
|
|
108
113
|
* Flush provider-facing stream state while the attempt still owns its activity
|
|
109
114
|
* window. On Pause/Steer, both promises are detached with rejection handlers:
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import { type CodexRequestContext } from "@opengeni/codex";
|
|
2
|
+
import { type XaiSubscriptionRequestContext } from "@opengeni/xai-subscription";
|
|
1
3
|
import type { TurnActivityServices as ActivityServices, RunAgentTurnInput, RunAgentTurnResult } from "../types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Retain subscription credential/account authority for the title sidecar
|
|
6
|
+
* without sharing main-stream recovery, startup, audit, or opaque-artifact
|
|
7
|
+
* callbacks. Title usage is returned by the runtime and metered separately.
|
|
8
|
+
*/
|
|
9
|
+
export declare function sessionTitleCodexRequestContext(context: CodexRequestContext, nextRequestId: () => string): CodexRequestContext;
|
|
10
|
+
export declare function sessionTitleXaiRequestContext(context: XaiSubscriptionRequestContext, nextRequestId: () => string): XaiSubscriptionRequestContext;
|
|
2
11
|
/** Lifecycle orchestrator: claim → capacity → governance → sandbox → tools → stream. */
|
|
3
12
|
export declare function createRunAgentTurnActivity(services: () => Promise<ActivityServices>): (input: RunAgentTurnInput) => Promise<RunAgentTurnResult>;
|
|
@@ -18,6 +18,21 @@ export type SandboxTurnRuntimeDeps = {
|
|
|
18
18
|
attempt: AttemptIdentityState;
|
|
19
19
|
};
|
|
20
20
|
export type SandboxTurnRuntime = ReturnType<typeof createSandboxTurnRuntime>;
|
|
21
|
+
/**
|
|
22
|
+
* Provider-deadline rotation is a preemption boundary, not a cooperative
|
|
23
|
+
* snapshot boundary. Snapshotting while this attempt still owns active tools
|
|
24
|
+
* can deadlock on its own unsettled mutation admission or on an earlier native
|
|
25
|
+
* capture. Abort first; the ordinary attempt finalizer then drains every writer
|
|
26
|
+
* and releases the holder, after which the zero-holder reaper owns the exact
|
|
27
|
+
* generation capture and same-request takeover protocol.
|
|
28
|
+
*/
|
|
29
|
+
export declare function preemptSandboxTurnForDeadlineRotation(input: {
|
|
30
|
+
controller: AbortController;
|
|
31
|
+
sandboxState: Pick<SandboxRuntimeState, "deadlineRotationRequested">;
|
|
32
|
+
sandboxGroupId: string;
|
|
33
|
+
leaseEpoch: number;
|
|
34
|
+
cancellationSignal?: AbortSignal;
|
|
35
|
+
}): boolean;
|
|
21
36
|
export declare function createSandboxTurnRuntime(deps: SandboxTurnRuntimeDeps): {
|
|
22
37
|
releaseLateSandbox: (sandbox: ResumedTurnSandbox) => Promise<void>;
|
|
23
38
|
requireResolvedSandboxForMutation: (message: string) => ResumedTurnSandbox;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AttemptToolDefinition } from "@opengeni/codemode";
|
|
2
|
+
import type { GeneratedSessionTitle } from "@opengeni/runtime";
|
|
2
3
|
import { type FirstPartyMcpToolName, type Permission, type ToolRef } from "@opengeni/contracts";
|
|
3
4
|
export declare const SESSION_TITLE_MODEL_TOOL_NAME = "opengeni__set_session_title";
|
|
4
5
|
export declare function shouldRequestMissingSessionTitle(input: {
|
|
@@ -11,11 +12,31 @@ export declare function sessionTitleToolPlan(input: {
|
|
|
11
12
|
tools: readonly ToolRef[];
|
|
12
13
|
selectedFirstPartyMcpTools: readonly FirstPartyMcpToolName[];
|
|
13
14
|
shouldRequestTitle: boolean;
|
|
15
|
+
parallelGenerationAvailable: boolean;
|
|
14
16
|
}): {
|
|
15
17
|
promoteTitleTool: boolean;
|
|
18
|
+
generateTitleInParallel: boolean;
|
|
16
19
|
remoteFirstPartyMcpTools: FirstPartyMcpToolName[];
|
|
17
20
|
preparationIndependentToolNames: string[];
|
|
18
21
|
};
|
|
22
|
+
export declare const PARALLEL_SESSION_TITLE_TIMEOUT_MS = 15000;
|
|
23
|
+
export type ParallelSessionTitleGeneration = {
|
|
24
|
+
finish: () => Promise<GeneratedSessionTitle | null>;
|
|
25
|
+
cancel: () => Promise<void>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Start title inference immediately and keep it independent of the main agent
|
|
29
|
+
* stream. finish() waits for the already-running bounded request, so a quick
|
|
30
|
+
* main response does not discard a valid title merely because it completed
|
|
31
|
+
* first. cancel() aborts and joins exceptional/cancelled exits so no provider
|
|
32
|
+
* work escapes the owning runAgentTurn activity.
|
|
33
|
+
*/
|
|
34
|
+
export declare function startParallelSessionTitleGeneration(input: {
|
|
35
|
+
generate: (signal: AbortSignal) => Promise<GeneratedSessionTitle>;
|
|
36
|
+
signal?: AbortSignal;
|
|
37
|
+
timeoutMs?: number;
|
|
38
|
+
onError?: (error: unknown) => void;
|
|
39
|
+
}): ParallelSessionTitleGeneration;
|
|
19
40
|
export declare function createSessionTitleAttemptToolDefinition(input: {
|
|
20
41
|
updateTitle: (title: string) => Promise<{
|
|
21
42
|
updated: boolean;
|
|
@@ -23,6 +23,7 @@ export type TurnStreamAttemptDeps = {
|
|
|
23
23
|
input: RunAgentTurnInput;
|
|
24
24
|
settings: Settings;
|
|
25
25
|
db: ActivityServices["db"];
|
|
26
|
+
bus: ActivityServices["bus"];
|
|
26
27
|
runtime: ActivityServices["runtime"];
|
|
27
28
|
objectStorage: ActivityServices["objectStorage"];
|
|
28
29
|
observability: ActivityServices["observability"];
|
|
@@ -60,6 +61,7 @@ export type TurnStreamAttemptDeps = {
|
|
|
60
61
|
attachCodemodeTokenRenewal: (tokenSession?: CodemodeTokenWriterSession, initialExpiresAt?: Date, initialSandbox?: ResumedTurnSandbox) => Promise<void>;
|
|
61
62
|
attachRunCredentialRenewal: (credentialSession: RunCredentialCommandSession, initialMaterial: NormalizedRunCredentialMaterial | null, initialSandbox?: ResumedTurnSandbox) => Promise<void>;
|
|
62
63
|
withProviderRequestContext: <T>(fn: () => Promise<T>) => Promise<T>;
|
|
64
|
+
withSessionTitleProviderRequestContext: <T>(fn: () => Promise<T>) => Promise<T>;
|
|
63
65
|
publishCompactionLiveEvents: (events: SessionEvent[]) => Promise<void>;
|
|
64
66
|
publishCompactionOutcomeEvents: (events: SessionEvent[]) => Promise<void>;
|
|
65
67
|
recordCompanyBrainContributionReceiptOnce: () => void;
|
|
@@ -88,6 +90,8 @@ export type TurnStreamAttemptDeps = {
|
|
|
88
90
|
providerApi: HistoryProviderApi;
|
|
89
91
|
runSettings: Settings;
|
|
90
92
|
turnTools: ReturnType<typeof withFirstPartyTools>;
|
|
93
|
+
generateSessionTitleInParallel: boolean;
|
|
94
|
+
sessionTitlePrompt: string;
|
|
91
95
|
compactSummarizer: CompactionSummarizer;
|
|
92
96
|
settleDeferredSteerAfterCompaction: () => Promise<RunAgentTurnResult | null>;
|
|
93
97
|
compactionModelHistoryProjector: (items: Array<Record<string, unknown>>) => Promise<Array<Record<string, unknown>>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AttemptConnectorActionBinding } from "@opengeni/runtime";
|
|
1
|
+
import { type AttemptConnectorActionBinding, type ConnectorActionPolicyHooks } from "@opengeni/runtime";
|
|
2
2
|
import { type Settings } from "@opengeni/config";
|
|
3
3
|
import { withFirstPartyTools } from "../goals.js";
|
|
4
4
|
import type { TurnActivityServices as ActivityServices, RunAgentTurnInput } from "../types.js";
|
|
@@ -24,6 +24,7 @@ export type PrepareTurnToolPolicyDeps = {
|
|
|
24
24
|
};
|
|
25
25
|
export type PrepareTurnToolRuntimeDeps = {
|
|
26
26
|
input: RunAgentTurnInput;
|
|
27
|
+
catalogSourceSettings: Settings;
|
|
27
28
|
db: ActivityServices["db"];
|
|
28
29
|
bus: ActivityServices["bus"];
|
|
29
30
|
runtime: ActivityServices["runtime"];
|
|
@@ -124,18 +125,8 @@ export declare function prepareTurnToolPolicy(deps: PrepareTurnToolPolicyDeps):
|
|
|
124
125
|
}>;
|
|
125
126
|
export declare function prepareTurnToolRuntime(deps: PrepareTurnToolRuntimeDeps): Promise<{
|
|
126
127
|
attemptConnectorActionBindings: AttemptConnectorActionBinding[];
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
readonly workspaceId: string;
|
|
130
|
-
readonly sessionId: string;
|
|
131
|
-
readonly turnId: string;
|
|
132
|
-
readonly attemptId: string;
|
|
133
|
-
readonly executionGeneration: number;
|
|
134
|
-
readonly initiator: {
|
|
135
|
-
readonly kind: "service" | "subject";
|
|
136
|
-
readonly subjectId: string;
|
|
137
|
-
};
|
|
138
|
-
};
|
|
128
|
+
connectorActionPolicy: ConnectorActionPolicyHooks;
|
|
129
|
+
generateSessionTitleInParallel: boolean;
|
|
139
130
|
postToolPreparationStartedAt: number;
|
|
140
131
|
preparationIndependentToolNames: string[];
|
|
141
132
|
}>;
|
|
@@ -1,11 +1,46 @@
|
|
|
1
|
-
import { type LazyToolTransport } from "@opengeni/runtime";
|
|
2
|
-
import { type ModelProviderApi, type
|
|
1
|
+
import { type ComputerToolMode, type LazyToolTransport } from "@opengeni/runtime";
|
|
2
|
+
import { type ModelProviderApi, type ResolvedModelProvider, type Settings } from "@opengeni/config";
|
|
3
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: ResolvedModelProvider["kind"];
|
|
27
|
+
api: ModelProviderApi;
|
|
28
|
+
};
|
|
29
|
+
configured: {
|
|
30
|
+
capabilities: {
|
|
31
|
+
inputModalities: string[];
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
} | null): ComputerToolMode;
|
|
4
35
|
/** Chat wires and Gateway models do not advertise OpenAI's hosted sandbox tool types. */
|
|
5
36
|
export declare function structuredToolTransportForTurn(resolvedModel: {
|
|
6
37
|
provider: {
|
|
7
|
-
|
|
38
|
+
id: string;
|
|
39
|
+
kind: ResolvedModelProvider["kind"];
|
|
8
40
|
api: ModelProviderApi;
|
|
41
|
+
wireProfile: "openai" | "azure-openai";
|
|
42
|
+
builtin: boolean;
|
|
43
|
+
baseUrl?: string | undefined;
|
|
9
44
|
};
|
|
10
45
|
} | null): boolean;
|
|
11
46
|
/**
|
|
@@ -17,7 +52,7 @@ export declare function structuredToolTransportForTurn(resolvedModel: {
|
|
|
17
52
|
export declare function lazyToolTransportForTurn(resolvedModel: {
|
|
18
53
|
provider: {
|
|
19
54
|
id: string;
|
|
20
|
-
kind:
|
|
55
|
+
kind: ResolvedModelProvider["kind"];
|
|
21
56
|
api: ModelProviderApi;
|
|
22
57
|
wireProfile: "openai" | "azure-openai";
|
|
23
58
|
builtin: boolean;
|
|
@@ -60,7 +95,7 @@ export declare function connectedSubscriptionImageGenerationAuthority<T>(credent
|
|
|
60
95
|
export declare function openAiHostedImageProviderBindingForTurn(settings: Pick<Settings, "openaiProvider" | "openaiApiKey" | "openaiBaseUrl">, resolvedModel: {
|
|
61
96
|
provider: {
|
|
62
97
|
id: string;
|
|
63
|
-
kind:
|
|
98
|
+
kind: ResolvedModelProvider["kind"];
|
|
64
99
|
builtin: boolean;
|
|
65
100
|
baseUrl?: string | undefined;
|
|
66
101
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Settings } from "@opengeni/config";
|
|
2
2
|
import type { CodexUsageHeaderSnapshot } from "@opengeni/codex";
|
|
3
3
|
import type { AppendEventInput, ApplySessionTurnSettlementInput } from "@opengeni/db";
|
|
4
|
-
import type { ModelContextContributionSummary, SessionStatus, XaiProviderAccountAuthoritySnapshotV1 } from "@opengeni/contracts";
|
|
4
|
+
import type { CodexCredentialPolicySnapshotV1, ModelContextContributionSummary, SessionStatus, XaiProviderAccountAuthoritySnapshotV1 } from "@opengeni/contracts";
|
|
5
5
|
import type { EstablishedSandboxSession, OpenGeniRuntime, RunCredentialCommandSession, SelfhostedSession, TurnToolCancellationFence } from "@opengeni/runtime";
|
|
6
6
|
import type { XaiSubscriptionRequestContext } from "@opengeni/xai-subscription";
|
|
7
7
|
import type { CodemodeAttemptDispatcher } from "../codemode-dispatcher.js";
|
|
@@ -23,6 +23,7 @@ export type TurnSettleFn = (input: {
|
|
|
23
23
|
turnStatus: "queued" | "running" | "completed" | "failed" | "cancelled" | "superseded" | "requires_action";
|
|
24
24
|
sessionStatus: SessionStatus;
|
|
25
25
|
activeTurnId: string | null;
|
|
26
|
+
suppressGoalContinuation?: boolean;
|
|
26
27
|
consumeRequestedCompactionFailure?: boolean;
|
|
27
28
|
runState?: ApplySessionTurnSettlementInput["runState"];
|
|
28
29
|
}) => Promise<boolean>;
|
|
@@ -35,6 +36,7 @@ export type TurnControlState = {
|
|
|
35
36
|
};
|
|
36
37
|
export type AttemptIdentityState = {
|
|
37
38
|
turnId: string | undefined;
|
|
39
|
+
dispatchId: string;
|
|
38
40
|
triggerEventId: string | undefined;
|
|
39
41
|
executionGeneration: number;
|
|
40
42
|
providerRecoveryCount: number;
|
|
@@ -46,6 +48,8 @@ export type BillingState = {
|
|
|
46
48
|
isCodexTurn: boolean;
|
|
47
49
|
isXaiTurn: boolean;
|
|
48
50
|
isExternallyBilledTurn: boolean;
|
|
51
|
+
chargesOpenGeniCredits: boolean;
|
|
52
|
+
countsTowardTokenCap: boolean;
|
|
49
53
|
};
|
|
50
54
|
export type SandboxRuntimeState = {
|
|
51
55
|
resolvedSandbox: ResumedTurnSandbox | null;
|
|
@@ -67,7 +71,8 @@ export type SandboxRuntimeState = {
|
|
|
67
71
|
sandboxHolderId: TurnSandboxLeaseHolderId | null;
|
|
68
72
|
sandboxGroupId: string | null;
|
|
69
73
|
leaseHeartbeatTimer: ReturnType<typeof setInterval> | undefined;
|
|
70
|
-
|
|
74
|
+
rotationPreemptionInFlight: Promise<void> | null;
|
|
75
|
+
deadlineRotationRequested: boolean;
|
|
71
76
|
snapshotInFlight: Promise<void> | null;
|
|
72
77
|
firstProviderRequestStarted: boolean;
|
|
73
78
|
turnEndCaptureInProgress: boolean;
|
|
@@ -112,6 +117,12 @@ export type WorkspaceRefState = {
|
|
|
112
117
|
};
|
|
113
118
|
export type ProviderTurnState = {
|
|
114
119
|
effectiveCodexCredentialId: string | null;
|
|
120
|
+
/** Exact row version returned by the resolver for the latest provider request. */
|
|
121
|
+
effectiveCodexCredentialVersion: number | null;
|
|
122
|
+
/** Frozen alternate-account ceiling observed by the fenced allocator. */
|
|
123
|
+
codexCredentialFailoverLimit: number;
|
|
124
|
+
/** Accepted Codex allocator policy captured with the first durable lease. */
|
|
125
|
+
codexPolicySnapshot: CodexCredentialPolicySnapshotV1 | null;
|
|
115
126
|
effectiveXaiCredentialId: string | null;
|
|
116
127
|
xaiRotationEnabled: boolean;
|
|
117
128
|
xaiAuthoritySnapshot: XaiProviderAccountAuthoritySnapshotV1 | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Public agent-turn surface. Implementation lives in `./agent-turn/*`. */
|
|
2
|
-
export { createRunAgentTurnActivity } from "./agent-turn/run.js";
|
|
2
|
+
export { createRunAgentTurnActivity, sessionTitleCodexRequestContext, sessionTitleXaiRequestContext, } from "./agent-turn/run.js";
|
|
3
3
|
export * from "./agent-turn/admission.js";
|
|
4
4
|
export * from "./agent-turn/codex.js";
|
|
5
5
|
export * from "./agent-turn/errors.js";
|
|
@@ -12,5 +12,6 @@ export type AutomationActivityOptions = {
|
|
|
12
12
|
recordUsage?: typeof recordWorkspaceUsage;
|
|
13
13
|
};
|
|
14
14
|
export declare function createAutomationActivities(services: () => Promise<ControlActivityServices>, options?: AutomationActivityOptions): {
|
|
15
|
+
settleAutomationRunFailure: (input: DispatchAutomationRunInput) => Promise<void>;
|
|
15
16
|
dispatchAutomationRun: (input: DispatchAutomationRunInput) => Promise<DispatchAutomationRunResult>;
|
|
16
17
|
};
|
|
@@ -22,4 +22,6 @@ export declare function withCodexProvider(settings: Settings): Settings;
|
|
|
22
22
|
* authority snapshot, and bearer remain frozen later at turn admission.
|
|
23
23
|
*/
|
|
24
24
|
export declare function withXaiSubscriptionProvider(settings: Settings): Settings;
|
|
25
|
-
export declare function settingsWithWorkspaceGatewayCredential(db: Database, workspaceId: string, settings: Settings): Promise<Settings>;
|
|
25
|
+
export declare function settingsWithWorkspaceGatewayCredential(db: Database, accountId: string, workspaceId: string, settings: Settings, retainedProductModelId?: string | null): Promise<Settings>;
|
|
26
|
+
export declare function settingsWithWorkspaceOpenRouterCredential(db: Database, accountId: string, workspaceId: string, settings: Settings, retainedProductModelId?: string | null): Promise<Settings>;
|
|
27
|
+
export declare function settingsWithOrganizationProviderCredentials(db: Database, accountId: string, workspaceId: string, settings: Settings, retainedProductModelId?: string | null): Promise<Settings>;
|