@opengeni/worker-bundle 0.20.3 → 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.
Files changed (184) hide show
  1. package/dist/activities/agent-turn/admission.d.ts +52 -0
  2. package/dist/activities/agent-turn/agent-build.d.ts +89 -0
  3. package/dist/activities/agent-turn/claim.d.ts +67 -0
  4. package/dist/activities/agent-turn/codex-capacity.d.ts +40 -0
  5. package/dist/activities/agent-turn/codex.d.ts +32 -0
  6. package/dist/activities/agent-turn/compaction-prep.d.ts +88 -0
  7. package/dist/activities/agent-turn/credential-leases.d.ts +56 -0
  8. package/dist/activities/agent-turn/errors.d.ts +253 -0
  9. package/dist/activities/agent-turn/failure-settlement.d.ts +33 -0
  10. package/dist/activities/agent-turn/file-resources.d.ts +37 -0
  11. package/dist/activities/agent-turn/finalization.d.ts +42 -0
  12. package/dist/activities/agent-turn/github-repository-bindings.d.ts +105 -0
  13. package/dist/activities/agent-turn/governance-model.d.ts +66 -0
  14. package/dist/activities/agent-turn/history-sink.d.ts +52 -0
  15. package/dist/activities/agent-turn/history.d.ts +63 -0
  16. package/dist/activities/agent-turn/media-artifacts.d.ts +145 -0
  17. package/dist/activities/agent-turn/model-usage.d.ts +218 -0
  18. package/dist/activities/agent-turn/quiescence.d.ts +135 -0
  19. package/dist/activities/agent-turn/run-credentials.d.ts +84 -0
  20. package/dist/activities/agent-turn/run.d.ts +3 -0
  21. package/dist/activities/agent-turn/sandbox-establish.d.ts +93 -0
  22. package/dist/activities/agent-turn/sandbox-provision.d.ts +89 -0
  23. package/dist/activities/agent-turn/sandbox-route.d.ts +151 -0
  24. package/dist/activities/agent-turn/sandbox-runtime.d.ts +44 -0
  25. package/dist/activities/agent-turn/stream-attempt.d.ts +107 -0
  26. package/dist/activities/agent-turn/tool-environment.d.ts +142 -0
  27. package/dist/activities/agent-turn/tool-policy.d.ts +127 -0
  28. package/dist/activities/agent-turn/tool-result-spill.d.ts +59 -0
  29. package/dist/activities/agent-turn/turn-context.d.ts +144 -0
  30. package/dist/activities/agent-turn/xai-capacity.d.ts +2 -0
  31. package/dist/activities/agent-turn.d.ts +12 -954
  32. package/dist/activities/automations.d.ts +16 -0
  33. package/dist/activities/common.d.ts +1 -1
  34. package/dist/activities/connector-attachments.d.ts +13 -0
  35. package/dist/activities/documents.d.ts +1 -0
  36. package/dist/activities/environment.d.ts +26 -15
  37. package/dist/activities/generated-images.d.ts +1 -1
  38. package/dist/activities/git-credential-renewal.d.ts +3 -1
  39. package/dist/activities/goals.d.ts +4 -1
  40. package/dist/activities/google-drive-provider.d.ts +29 -0
  41. package/dist/activities/google-drive-publication.d.ts +17 -4
  42. package/dist/activities/incident-telemetry-authority.d.ts +52 -0
  43. package/dist/activities/incident-telemetry-preflight.d.ts +71 -0
  44. package/dist/activities/knowledge-source-sync.d.ts +4 -0
  45. package/dist/activities/mcp-credentials.d.ts +9 -3
  46. package/dist/activities/open-suffix-resume.d.ts +77 -0
  47. package/dist/activities/packs.d.ts +3 -11
  48. package/dist/activities/parent-wake.d.ts +19 -0
  49. package/dist/activities/retained-screenshot-reaper.d.ts +1 -1
  50. package/dist/activities/retained-screenshots.d.ts +1 -1
  51. package/dist/activities/rig-verification.d.ts +1 -1
  52. package/dist/activities/run-input.d.ts +9 -10
  53. package/dist/activities/sandbox-images.d.ts +1 -14
  54. package/dist/activities/sandbox-lease.d.ts +21 -3
  55. package/dist/activities/scheduled-tasks.d.ts +47 -0
  56. package/dist/activities/types.d.ts +23 -2
  57. package/dist/activities/video-media-validation.d.ts +1 -1
  58. package/dist/activities/video-output-retention.d.ts +1 -2
  59. package/dist/activities/xai-auth.d.ts +3 -0
  60. package/dist/{activities-control-BJSDRSIP.js → activities-control-DKG22ONJ.js} +2646 -551
  61. package/dist/activities-control-DKG22ONJ.js.map +1 -0
  62. package/dist/activities-control.d.ts +6 -2
  63. package/dist/activities-turn-4IMC3MAA.js +21326 -0
  64. package/dist/activities-turn-4IMC3MAA.js.map +1 -0
  65. package/dist/activities.d.ts +7 -3
  66. package/dist/artifact-materializer-entry.js +41 -22
  67. package/dist/artifact-materializer-entry.js.map +1 -1
  68. package/dist/{chunk-N5TJIFCE.js → chunk-CE7TPKBS.js} +468 -1
  69. package/dist/chunk-CE7TPKBS.js.map +1 -0
  70. package/dist/chunk-CNYGVRKF.js +4698 -0
  71. package/dist/chunk-CNYGVRKF.js.map +1 -0
  72. package/dist/connection-provider-use.d.ts +18 -0
  73. package/dist/editable-artifact-materializer.d.ts +4 -3
  74. package/dist/github-rest-mcp.d.ts +26 -0
  75. package/dist/index.d.ts +10 -2
  76. package/dist/index.js +58 -14
  77. package/dist/index.js.map +1 -1
  78. package/dist/knowledge-source-sync-activity-policy.d.ts +2 -0
  79. package/dist/model-context-contributions.d.ts +8 -4
  80. package/dist/observability-metrics.d.ts +63 -4
  81. package/dist/opensandbox-kubernetes-inventory.d.ts +21 -0
  82. package/dist/personal-github-git-credentials.d.ts +9 -0
  83. package/dist/pr-review-credentials.d.ts +6 -0
  84. package/dist/sandbox-archive-storage.d.ts +45 -0
  85. package/dist/sandbox-resume.d.ts +65 -6
  86. package/dist/sandbox-routing.d.ts +38 -2
  87. package/dist/scheduled-alert-occurrence.d.ts +33 -0
  88. package/dist/workflow-bundle.js +87 -28
  89. package/dist/workflows/activities.d.ts +1 -0
  90. package/dist/workflows/automations.d.ts +6 -0
  91. package/dist/workflows/document-index.d.ts +1 -0
  92. package/dist/workflows.d.ts +1 -0
  93. package/package.json +17 -17
  94. package/src/activities/agent-turn/admission.ts +292 -0
  95. package/src/activities/agent-turn/agent-build.ts +802 -0
  96. package/src/activities/agent-turn/claim.ts +590 -0
  97. package/src/activities/agent-turn/codex-capacity.ts +720 -0
  98. package/src/activities/agent-turn/codex.ts +94 -0
  99. package/src/activities/agent-turn/compaction-prep.ts +722 -0
  100. package/src/activities/agent-turn/credential-leases.ts +240 -0
  101. package/src/activities/agent-turn/errors.ts +1068 -0
  102. package/src/activities/agent-turn/failure-settlement.ts +1436 -0
  103. package/src/activities/agent-turn/file-resources.ts +227 -0
  104. package/src/activities/agent-turn/finalization.ts +754 -0
  105. package/src/activities/agent-turn/github-repository-bindings.ts +300 -0
  106. package/src/activities/agent-turn/governance-model.ts +465 -0
  107. package/src/activities/agent-turn/history-sink.ts +139 -0
  108. package/src/activities/agent-turn/history.ts +200 -0
  109. package/src/activities/agent-turn/media-artifacts.ts +359 -0
  110. package/src/activities/agent-turn/model-usage.ts +823 -0
  111. package/src/activities/agent-turn/quiescence.ts +353 -0
  112. package/src/activities/agent-turn/run-credentials.ts +761 -0
  113. package/src/activities/agent-turn/run.ts +1530 -0
  114. package/src/activities/agent-turn/sandbox-establish.ts +1207 -0
  115. package/src/activities/agent-turn/sandbox-provision.ts +569 -0
  116. package/src/activities/agent-turn/sandbox-route.ts +358 -0
  117. package/src/activities/agent-turn/sandbox-runtime.ts +731 -0
  118. package/src/activities/agent-turn/stream-attempt.ts +1670 -0
  119. package/src/activities/agent-turn/tool-environment.ts +729 -0
  120. package/src/activities/agent-turn/tool-policy.ts +216 -0
  121. package/src/activities/agent-turn/tool-result-spill.ts +265 -0
  122. package/src/activities/agent-turn/turn-context.ts +281 -0
  123. package/src/activities/agent-turn/xai-capacity.ts +229 -0
  124. package/src/activities/agent-turn.ts +12 -12701
  125. package/src/activities/api-integrations.ts +3 -0
  126. package/src/activities/automations.ts +214 -0
  127. package/src/activities/codemode-dispatcher.ts +12 -1
  128. package/src/activities/common.ts +1 -5
  129. package/src/activities/connector-attachments.ts +168 -0
  130. package/src/activities/context-compaction.ts +18 -0
  131. package/src/activities/environment.ts +151 -55
  132. package/src/activities/generated-images.ts +26 -11
  133. package/src/activities/git-credential-renewal.ts +13 -3
  134. package/src/activities/goals.ts +85 -19
  135. package/src/activities/google-drive-provider.ts +178 -0
  136. package/src/activities/google-drive-publication.ts +147 -49
  137. package/src/activities/incident-telemetry-authority.ts +327 -0
  138. package/src/activities/incident-telemetry-preflight.ts +317 -0
  139. package/src/activities/knowledge-source-sync.ts +178 -37
  140. package/src/activities/mcp-credentials.ts +191 -17
  141. package/src/activities/open-suffix-resume.ts +422 -0
  142. package/src/activities/packs.ts +12 -60
  143. package/src/activities/parent-wake.ts +64 -14
  144. package/src/activities/retained-screenshot-reaper.ts +6 -3
  145. package/src/activities/retained-screenshots.ts +15 -47
  146. package/src/activities/rig-verification.ts +1 -1
  147. package/src/activities/run-input.ts +102 -142
  148. package/src/activities/sandbox-images.ts +7 -166
  149. package/src/activities/sandbox-lease.ts +406 -15
  150. package/src/activities/scheduled-tasks.ts +2103 -411
  151. package/src/activities/session-state.ts +10 -2
  152. package/src/activities/types.ts +32 -2
  153. package/src/activities/video-media-validation.ts +3 -3
  154. package/src/activities/video-output-retention.ts +2 -57
  155. package/src/activities/xai-auth.ts +8 -0
  156. package/src/activities-control.ts +2 -0
  157. package/src/activities.ts +3 -0
  158. package/src/activity-services.ts +13 -4
  159. package/src/connection-provider-use.ts +36 -0
  160. package/src/editable-artifact-materializer-subprocess.ts +25 -14
  161. package/src/editable-artifact-materializer.ts +29 -18
  162. package/src/github-rest-mcp.ts +713 -0
  163. package/src/http.ts +16 -6
  164. package/src/index.ts +40 -5
  165. package/src/knowledge-source-sync-activity-policy.ts +2 -0
  166. package/src/model-context-contributions.ts +33 -10
  167. package/src/observability-metrics.ts +357 -0
  168. package/src/opensandbox-kubernetes-inventory.ts +292 -0
  169. package/src/personal-github-git-credentials.ts +331 -0
  170. package/src/pr-review-credentials.ts +163 -0
  171. package/src/sandbox-archive-storage.ts +159 -0
  172. package/src/sandbox-resume.ts +449 -63
  173. package/src/sandbox-routing.ts +314 -16
  174. package/src/scheduled-alert-occurrence.ts +176 -0
  175. package/src/workflows/activities.ts +18 -2
  176. package/src/workflows/automations.ts +11 -0
  177. package/src/workflows/session.ts +13 -3
  178. package/src/workflows.ts +1 -0
  179. package/dist/activities-control-BJSDRSIP.js.map +0 -1
  180. package/dist/activities-turn-J5YO7XXX.js +0 -17243
  181. package/dist/activities-turn-J5YO7XXX.js.map +0 -1
  182. package/dist/chunk-N5TJIFCE.js.map +0 -1
  183. package/dist/chunk-P6Z2SLAA.js +0 -3092
  184. package/dist/chunk-P6Z2SLAA.js.map +0 -1
@@ -0,0 +1,16 @@
1
+ import { assertWorkspaceModelPolicyAllows, createAndStartSessionWithOutcome, recordWorkspaceUsage } from "@opengeni/core";
2
+ import { assertAutomationRunAuthorityInTransaction, claimAutomationRun, settleAutomationRun } from "@opengeni/db";
3
+ import { agentRunAdmissionDenial } from "./agent-run-admission.js";
4
+ import type { ControlActivityServices, DispatchAutomationRunInput, DispatchAutomationRunResult } from "./types.js";
5
+ export type AutomationActivityOptions = {
6
+ claim?: typeof claimAutomationRun;
7
+ settle?: typeof settleAutomationRun;
8
+ assertAuthority?: typeof assertAutomationRunAuthorityInTransaction;
9
+ createSession?: typeof createAndStartSessionWithOutcome;
10
+ admit?: typeof agentRunAdmissionDenial;
11
+ assertModelPolicy?: typeof assertWorkspaceModelPolicyAllows;
12
+ recordUsage?: typeof recordWorkspaceUsage;
13
+ };
14
+ export declare function createAutomationActivities(services: () => Promise<ControlActivityServices>, options?: AutomationActivityOptions): {
15
+ dispatchAutomationRun: (input: DispatchAutomationRunInput) => Promise<DispatchAutomationRunResult>;
16
+ };
@@ -1,5 +1,5 @@
1
1
  import type { ResourceRef, SessionStatus, SessionSystemUpdatePayload, ToolRef } from "@opengeni/contracts";
2
- export { mergeResourceRefs, mergeToolRefs, reasoningEffortForMetadata as reasoningEffortForSession, } from "@opengeni/contracts";
2
+ export { mergeResourceRefs, mergeToolRefs } from "@opengeni/contracts";
3
3
  /**
4
4
  * Refuse to revive a terminal reusable session on a scheduled fire. Mirrors the
5
5
  * API-level guard in apps/api/src/domain/sessions.ts (post a user message ->
@@ -0,0 +1,13 @@
1
+ import { type ConnectorAttachmentReceiptEnvelope as ConnectorAttachmentReceiptEnvelopeValue, type ConnectorAttachmentTransfer } from "@opengeni/contracts";
2
+ import { type ConnectorAttachmentMaterializationRequest } from "@opengeni/runtime";
3
+ import { SandboxChannelAService } from "@opengeni/runtime/sandbox";
4
+ export declare class ConnectorAttachmentMaterializationError extends Error {
5
+ constructor();
6
+ }
7
+ type ConnectorAttachmentChannel = Pick<SandboxChannelAService, "importWorkspaceFiles" | "inspectWorkspaceFiles">;
8
+ type ConnectorAttachmentMaterializationOptions = Readonly<{
9
+ runMutation?: <T>(mutation: () => Promise<T>) => Promise<T>;
10
+ }>;
11
+ export { connectorAttachmentSandboxPath } from "@opengeni/runtime";
12
+ export declare function connectorAttachmentImportOperationId(request: Pick<ConnectorAttachmentMaterializationRequest, "serverId" | "toolName" | "operationId" | "connectionId">, attachment: ConnectorAttachmentTransfer, index: number): string;
13
+ export declare function materializeConnectorAttachmentsInChannel(channel: ConnectorAttachmentChannel, request: ConnectorAttachmentMaterializationRequest, options?: ConnectorAttachmentMaterializationOptions): Promise<ConnectorAttachmentReceiptEnvelopeValue>;
@@ -23,6 +23,7 @@ export declare function createDocumentActivities(services: () => Promise<Control
23
23
  authorityKind: "organization" | "personal" | "workspace";
24
24
  authorityWorkspaceId: string | null;
25
25
  authoritySubjectId: string | null;
26
+ authorityId?: string | null | undefined;
26
27
  visibility: "private" | "workspace";
27
28
  createdBy: string | null;
28
29
  agentAccess: boolean;
@@ -1,11 +1,20 @@
1
1
  import { type Settings } from "@opengeni/config";
2
- import { type ConnectionCredentialsPort, type GitCredentialProvider, type GitCredentialTransport, type ResourceRef, type SessionTurn, type TurnInitiator, type TurnInitiatorContext } from "@opengeni/contracts";
2
+ import { type ConnectionCredentialsPort, type GitCredentialProvider, type GitCredentialRepositoryRef, type GitCredentialTransport, type ResourceRef, type SessionTurn, type TurnInitiator, type TurnInitiatorContext } from "@opengeni/contracts";
3
+ import { type SandboxCodemodeAuthority } from "@opengeni/runtime/sandbox";
3
4
  import { loadVariableSetForRun as loadWorkspaceEnvironmentForRunFromDb, type Database, type VariableSetForRun as WorkspaceEnvironmentForRun } from "@opengeni/db";
4
5
  export { loadWorkspaceEnvironmentForRunFromDb as loadWorkspaceEnvironmentForRun, type WorkspaceEnvironmentForRun, };
5
6
  export type ConnectionScope = {
6
7
  accountId: string;
7
8
  workspaceId: string;
8
9
  };
10
+ export type VariableSetCredentialAuthority = {
11
+ sessionId: string;
12
+ turnId: string;
13
+ attemptId: string;
14
+ executionGeneration: number;
15
+ initiator: TurnInitiator;
16
+ initiatingHumanSubjectId: string | null;
17
+ };
9
18
  export type GitTokenSeeds = Partial<Record<GitCredentialProvider, string>>;
10
19
  export type GitTokenExpiries = Partial<Record<GitCredentialProvider, string>>;
11
20
  export type GitCredentialBindingSeed = {
@@ -21,22 +30,14 @@ export type MintedRunGitCredentials = {
21
30
  gitTokens: GitTokenSeeds;
22
31
  expiresAt: GitTokenExpiries;
23
32
  };
24
- export type GitHubTokenMintAuthorization = (selection: {
33
+ export type GitHubTokenMintSelection = {
34
+ credentialBindingId: string;
25
35
  installationId: number;
26
36
  repositoryIds: number[];
27
- }) => Promise<void>;
28
- export declare const CODEMODE_TOKEN_TTL_SECONDS: number;
29
- export type MintedSandboxCodemodeToken = {
30
- token: string;
31
- expiresAt: Date;
37
+ repositoryRefs: GitCredentialRepositoryRef[];
32
38
  };
33
- export type SandboxCodemodeAuthority = {
34
- sessionId: string;
35
- turnId: string;
36
- attemptId: string;
37
- executionGeneration: number;
38
- };
39
- export declare function mintSandboxCodemodeToken(settings: Settings, scope: ConnectionScope, authority: SandboxCodemodeAuthority, nowMs?: number): Promise<MintedSandboxCodemodeToken | undefined>;
39
+ export type GitHubTokenMintAuthorization = (selection: GitHubTokenMintSelection) => Promise<void>;
40
+ export { CODEMODE_TOKEN_TTL_SECONDS, mintSandboxCodemodeToken, type MintedSandboxCodemodeToken, type SandboxCodemodeAuthority, } from "@opengeni/runtime/sandbox";
40
41
  export type GitCredentialAuthority = {
41
42
  sessionId: string;
42
43
  rootSessionId: string;
@@ -56,9 +57,17 @@ type RunGitCredentialOptions = {
56
57
  scope?: ConnectionScope;
57
58
  authority?: GitCredentialAuthority;
58
59
  gitCredentials?: ConnectionCredentialsPort["gitCredentials"];
60
+ personalGitHubCredentials?: ConnectionCredentialsPort["gitCredentials"];
59
61
  authorizeGitHubTokenMint?: GitHubTokenMintAuthorization;
60
62
  };
61
- export declare function loadWorkspaceEnvironmentForRunWithCredentials(db: Database, settings: Settings, scope: ConnectionScope, environmentId: string | null, sandboxSecrets?: ConnectionCredentialsPort["sandboxSecrets"]): Promise<WorkspaceEnvironmentForRun | null>;
63
+ export declare function loadWorkspaceEnvironmentForRunWithCredentials(db: Database, settings: Settings, scope: ConnectionScope, environmentId: string | null, authority: VariableSetCredentialAuthority, sandboxSecrets?: ConnectionCredentialsPort["sandboxSecrets"], options?: {
64
+ /**
65
+ * Exact accepted scheduled-occurrence generation for this Variable Set,
66
+ * resolved by the caller from the immutable run snapshot; null/omitted for
67
+ * ordinary live turns.
68
+ */
69
+ expectedGeneration?: number | null;
70
+ }): Promise<WorkspaceEnvironmentForRun | null>;
62
71
  export declare function sandboxEnvironmentForRun(settings: Settings, resources: ResourceRef[], workspaceEnvironment?: Record<string, string>, options?: RunGitCredentialOptions & {
63
72
  skipGitHubToken?: boolean;
64
73
  /**
@@ -100,6 +109,8 @@ export declare function gitHubTokenMintSelections(resources: ResourceRef[]): Arr
100
109
  installationId: number;
101
110
  repositoryIds: number[];
102
111
  }>;
112
+ /** Exact binding-aware selections used by authorization immediately before mint. */
113
+ export declare function gitHubTokenAuthorizationSelections(resources: ResourceRef[]): GitHubTokenMintSelection[];
103
114
  /** @deprecated Use gitHubTokenMintSelections for multi-installation sessions. */
104
115
  export declare function gitHubTokenMintSelection(resources: ResourceRef[]): {
105
116
  installationId: number;
@@ -1,6 +1,6 @@
1
1
  import { type GeneratedImageReceipt } from "@opengeni/contracts";
2
2
  import { type Database, type GeneratedImageArtifact, type GeneratedImageSourceStrategy } from "@opengeni/db";
3
- import type { ObjectStorage } from "@opengeni/storage";
3
+ import { type ObjectStorage } from "@opengeni/storage";
4
4
  export type GeneratedImageMediaType = "image/png" | "image/jpeg" | "image/webp";
5
5
  export type ValidatedGeneratedImage = {
6
6
  bytes: Uint8Array;
@@ -21,6 +21,8 @@ export type GitCredentialRenewalController = {
21
21
  export type GitCredentialRenewalOptions = {
22
22
  expectedProviders: readonly GitCredentialProvider[];
23
23
  initialExpiresAt?: GitTokenExpiries;
24
+ /** Override the default five-minute provider-token lead for shorter broker bearers. */
25
+ expiryLeadMs?: number;
24
26
  mint: () => Promise<MintedRunGitCredentials | undefined>;
25
27
  write: (tokens: GitTokenSeeds) => Promise<void>;
26
28
  now?: () => number;
@@ -36,6 +38,6 @@ export type GitCredentialRenewalOptions = {
36
38
  * pulls renewal forward. Invalid metadata is treated as unknown rather than
37
39
  * allowing a token to live indefinitely.
38
40
  */
39
- export declare function nextGitCredentialRenewalDelay(expiresAt: GitTokenExpiries | undefined, providers: readonly GitCredentialProvider[], nowMs?: number): number;
41
+ export declare function nextGitCredentialRenewalDelay(expiresAt: GitTokenExpiries | undefined, providers: readonly GitCredentialProvider[], nowMs?: number, expiryLeadMs?: number): number;
40
42
  export declare function startGitCredentialRenewalLoop(options: GitCredentialRenewalOptions): GitCredentialRenewalController;
41
43
  export {};
@@ -5,7 +5,10 @@ export declare function createGoalActivities(services: () => Promise<ControlActi
5
5
  enqueueGoalRetryWake: (input: MaybeContinueGoalInput) => Promise<void>;
6
6
  maybeContinueGoal: (input: MaybeContinueGoalInput) => Promise<MaybeContinueGoalResult>;
7
7
  };
8
- export declare function goalContinuationPrompt(goal: SessionGoal, autoContinuation: number, cap: number | null): string;
8
+ export declare function goalContinuationPrompt(_goal: SessionGoal, _autoContinuation: number, _cap: number | null, options?: {
9
+ goalWaitAvailable?: boolean;
10
+ humanInputRespondAvailable?: boolean;
11
+ }): string;
9
12
  /**
10
13
  * Ensures a session/turn carries the first-party "opengeni" MCP server, which
11
14
  * hosts set_session_title, the goal tools, and the permission-gated
@@ -0,0 +1,29 @@
1
+ import type { GoogleDriveProviderRetryOptions } from "@opengeni/config";
2
+ import type { FetchLike } from "@opengeni/network";
3
+ import type { Observability } from "@opengeni/observability";
4
+ export type GoogleDriveProviderOperation = "start_page_token" | "list_changes" | "get_file" | "list_children" | "list_permissions" | "download" | "export";
5
+ export type GoogleDriveProviderHeartbeat = (details: {
6
+ operation: GoogleDriveProviderOperation;
7
+ attempt: number;
8
+ phase: "request_start" | "request_end" | "retry_delay_start" | "retry_delay_end";
9
+ }) => void;
10
+ export declare class GoogleDriveProviderTransportError extends Error {
11
+ constructor();
12
+ }
13
+ /**
14
+ * Absorb only short, explicitly retryable Drive failures inside one bounded
15
+ * activity. Provider bodies, URLs, headers, and credentials never enter logs
16
+ * or metric labels. The caller's logical sync-request accounting remains
17
+ * unchanged; this helper exposes physical attempts separately as telemetry.
18
+ */
19
+ export declare function fetchGoogleDriveProvider(input: {
20
+ fetchImpl: FetchLike;
21
+ url: string | URL;
22
+ init: RequestInit;
23
+ operation: GoogleDriveProviderOperation;
24
+ policy: GoogleDriveProviderRetryOptions;
25
+ observability: Observability;
26
+ heartbeat?: GoogleDriveProviderHeartbeat;
27
+ now?: () => number;
28
+ sleep?: (delayMs: number) => Promise<void>;
29
+ }): Promise<Response>;
@@ -1,19 +1,27 @@
1
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 { beginConnectorActionExecution, completeConnectorActionExecution, getConnectionMetadata, getWorkspaceGrant, prepareConnectorActionApproval, requireFile, type ConnectorActionAttemptIdentity, type ConnectorActionInvocation, type Database, type ResolveConnectionCredentialInput, type ResolveConnectionCredentialResult } from "@opengeni/db";
4
+ import { beginConnectorActionExecution, completeConnectorActionExecution, getConnectionMetadata, prepareConnectorActionApproval, 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
- import type { ObjectStorage } from "@opengeni/storage";
7
+ import { type ObjectStorage } from "@opengeni/storage";
8
8
  export type GoogleDrivePublicationTarget = Readonly<{
9
9
  ownerSubjectId: string;
10
10
  connectionId: string;
11
+ originWorkspaceId: string;
11
12
  destination: GoogleDriveOutputDestination;
12
13
  credentialScope: typeof GOOGLE_DRIVE_FILE_SCOPE | typeof GOOGLE_DRIVE_FULL_SCOPE;
13
14
  }>;
14
15
  export type GoogleDrivePublicationPorts = {
15
16
  getConnection: typeof getConnectionMetadata;
16
- getMembership: typeof getWorkspaceGrant;
17
+ /**
18
+ * Live workspace authority for the frozen delegation owner. This must be the
19
+ * canonical resolver, not a bare `workspace_memberships` join: a managed
20
+ * human's personal workspace deliberately has no membership row (migration
21
+ * 0219), so a bare join denies the owner publication inside their own
22
+ * private workspace.
23
+ */
24
+ getMembership: typeof namedSubjectHasLiveWorkspaceAuthority;
17
25
  readMaterialization: typeof readAuthorizedEditableArtifactMaterialization;
18
26
  requireFile: typeof requireFile;
19
27
  prepare: typeof prepareConnectorActionApproval;
@@ -21,7 +29,10 @@ export type GoogleDrivePublicationPorts = {
21
29
  complete: typeof completeConnectorActionExecution;
22
30
  fetch: FetchLike;
23
31
  };
24
- export declare function resolveGoogleDrivePublicationTarget(db: Database, workspaceId: string, delegations: readonly McpPersonalConnectionDelegation[], ports?: Pick<GoogleDrivePublicationPorts, "getConnection" | "getMembership">): Promise<GoogleDrivePublicationTarget | null>;
32
+ export declare function resolveGoogleDrivePublicationTarget(db: Database, workspace: {
33
+ accountId: string;
34
+ workspaceId: string;
35
+ }, delegations: readonly McpPersonalConnectionDelegation[], ports?: Pick<GoogleDrivePublicationPorts, "getConnection" | "getMembership">): Promise<GoogleDrivePublicationTarget | null>;
25
36
  export declare function googleDrivePublicationConnectorCall(target: GoogleDrivePublicationTarget, rawRequest: unknown, approvalId: string): ConnectorActionInvocation;
26
37
  export declare function createGoogleDrivePublicationAttemptTool(input: {
27
38
  db: Database;
@@ -50,4 +61,6 @@ export declare function executeGoogleDrivePublication(input: {
50
61
  request: GoogleDrivePublicationToolInputValue;
51
62
  resolveCredential: (input: ResolveConnectionCredentialInput) => Promise<ResolveConnectionCredentialResult>;
52
63
  signal?: AbortSignal;
64
+ /** Invoked immediately before the first provider request is sent. */
65
+ onProviderRequest?: () => void;
53
66
  }, ports?: Pick<GoogleDrivePublicationPorts, "getConnection" | "readMaterialization" | "requireFile" | "fetch">): Promise<GoogleDrivePublicationReceiptValue>;
@@ -0,0 +1,52 @@
1
+ import { type McpPersonalConnectionDelegation, type ScheduledTask, type ScheduledTaskRunAcceptedExecution, type Session, type SessionSystemUpdate } from "@opengeni/contracts";
2
+ import { type Database } from "@opengeni/db";
3
+ import { type Settings } from "@opengeni/config";
4
+ import { type IncidentTelemetryResponderMetadata } from "./incident-telemetry-preflight.js";
5
+ /** Resolve only exact selected responder metadata; never read/decrypt values or call providers. */
6
+ export declare function resolveIncidentTelemetryResponderMetadata(input: {
7
+ db: Database;
8
+ settings: Settings;
9
+ task: ScheduledTask;
10
+ session: Session | null;
11
+ personalConnectionDelegations: readonly McpPersonalConnectionDelegation[];
12
+ personalResourceAuthoritySubjectId?: string | null;
13
+ executionPolicy?: {
14
+ tools: ScheduledTaskRunAcceptedExecution["resolvedTools"];
15
+ firstPartyMcpTools: ScheduledTaskRunAcceptedExecution["resolvedFirstPartyMcpTools"];
16
+ firstPartyMcpPermissions: ScheduledTaskRunAcceptedExecution["resolvedFirstPartyMcpPermissions"] | null;
17
+ variableSetId: string | null;
18
+ rigId: string | null;
19
+ rigVersionId: string | null;
20
+ toolPolicy: Session["toolPolicy"];
21
+ mcpServerIds: readonly string[];
22
+ toolPolicyVersion: number | null;
23
+ };
24
+ }): Promise<IncidentTelemetryResponderMetadata>;
25
+ /** Resolve the responder's current ID-only MCP policy without materializing runtime secrets. */
26
+ export declare function resolveIncidentTelemetryResponderToolPolicy(input: {
27
+ settingsMcpServerIds: readonly string[];
28
+ capabilityServerIds: readonly string[];
29
+ apiIntegrationServerIds: readonly string[];
30
+ acceptedSessionMcpServerIds?: readonly string[];
31
+ session: {
32
+ mcpServers: readonly {
33
+ id: string;
34
+ }[];
35
+ tools: Session["tools"];
36
+ toolPolicy: Session["toolPolicy"];
37
+ } | null;
38
+ plannedTools: Session["tools"];
39
+ }): import("@opengeni/core").ResolvedSessionToolPolicy;
40
+ /** Revalidate a source-frozen incident responder fence before a turn can claim it. */
41
+ export declare function validateIncidentTelemetrySystemUpdateAuthority(input: {
42
+ db: Database;
43
+ settings: Settings;
44
+ workspaceId: string;
45
+ sessionId: string;
46
+ update: SessionSystemUpdate;
47
+ }): Promise<{
48
+ action: "accept";
49
+ } | {
50
+ action: "reject";
51
+ reason: string;
52
+ }>;
@@ -0,0 +1,71 @@
1
+ import { IncidentTelemetryPreflight, type FirstPartyMcpToolName, type Permission, type ResourceRef, type ScheduledTask, type ScheduledTaskAgentConfig } from "@opengeni/contracts";
2
+ export type IncidentTelemetryPreflightBlockReason = "incident_preflight_metadata_missing" | "incident_responder_under_capable" | "incident_data_source_unsuitable";
3
+ export type IncidentTelemetryPreflightResult = {
4
+ action: "not_required";
5
+ } | {
6
+ action: "ready";
7
+ } | {
8
+ action: "blocked";
9
+ reason: IncidentTelemetryPreflightBlockReason;
10
+ };
11
+ export type IncidentTelemetryRigMetadata = {
12
+ name: string;
13
+ credentialHooks: readonly string[];
14
+ checkHealth: "passing" | "failing" | "unknown";
15
+ };
16
+ export type IncidentTelemetryVariableSetMetadata = {
17
+ name: string;
18
+ variables: readonly {
19
+ name: string;
20
+ }[];
21
+ };
22
+ export type IncidentTelemetryResponderMetadata = {
23
+ /** False when an exact selected attachment could not be projected safely. */
24
+ metadataComplete: boolean;
25
+ resources: readonly ResourceRef[];
26
+ mcpServerIds: readonly string[];
27
+ firstPartyMcpTools: readonly FirstPartyMcpToolName[];
28
+ firstPartyMcpPermissions: readonly Permission[];
29
+ rig: IncidentTelemetryRigMetadata | null;
30
+ variableSets: readonly IncidentTelemetryVariableSetMetadata[];
31
+ /** Exact durable session policy version, or null for a not-yet-created session. */
32
+ toolPolicyVersion: number | null;
33
+ };
34
+ export type IncidentTelemetryPreflightInput = {
35
+ agentConfig: ScheduledTaskAgentConfig;
36
+ /** A valid structured alert occurrence also makes a legacy task incident-triggered. */
37
+ incidentTriggered: boolean;
38
+ /** Exact bounded labels from that validated occurrence; values are never rendered in blockers. */
39
+ alertOccurrenceLabels: Readonly<Record<string, string>> | null;
40
+ responder: IncidentTelemetryResponderMetadata;
41
+ };
42
+ export declare const INCIDENT_TELEMETRY_AUTHORITY_FENCE_LINEAGE_KEY = "incidentTelemetryAuthorityFence";
43
+ export type IncidentTelemetryAuthorityFence = {
44
+ version: 2;
45
+ toolPolicyVersion: number;
46
+ responderDigest: string;
47
+ taskDigest: string;
48
+ alertSelectorDigest: string;
49
+ };
50
+ export type IncidentTelemetryPreflightDeclaration = {
51
+ action: "not_required";
52
+ } | {
53
+ action: "blocked";
54
+ reason: "incident_preflight_metadata_missing" | "incident_data_source_unsuitable";
55
+ } | {
56
+ action: "required";
57
+ preflight: IncidentTelemetryPreflight;
58
+ };
59
+ export declare function incidentTelemetryPreflightDeclaration(agentConfig: ScheduledTaskAgentConfig, incidentTriggered: boolean): IncidentTelemetryPreflightDeclaration;
60
+ /**
61
+ * Pure, metadata-only incident admission. No provider request, public endpoint
62
+ * fetch, secret read/decrypt, session creation, or ambient credential lookup is
63
+ * reachable from this evaluator.
64
+ */
65
+ export declare function evaluateIncidentTelemetryPreflight(input: IncidentTelemetryPreflightInput): IncidentTelemetryPreflightResult;
66
+ export declare function incidentTelemetryAuthorityFence(input: {
67
+ task: ScheduledTask;
68
+ responder: IncidentTelemetryResponderMetadata;
69
+ alertOccurrenceLabels: Readonly<Record<string, string>> | null;
70
+ }): IncidentTelemetryAuthorityFence | null;
71
+ export declare function parseIncidentTelemetryAuthorityFence(lineage: Record<string, unknown>): IncidentTelemetryAuthorityFence | null;
@@ -1,6 +1,8 @@
1
+ import { type GoogleDriveProviderRetryOptions } from "@opengeni/config";
1
2
  import { GoogleDriveConnectionMetadata, type GoogleDriveSelectedSource } from "@opengeni/contracts/google-drive";
2
3
  import { type GoogleDriveInventoryEntry, type GoogleDriveInventoryPage, type GoogleDriveInventoryProviderItem, type GoogleDriveInventoryStopReason } from "@opengeni/documents/google-drive";
3
4
  import { deauthorizeKnowledgeSourceRetrieval, settleKnowledgeSourceSyncLease, type Database, type KnowledgeSourceSyncObjectObservationResult, type KnowledgeSourceSyncObservationFloor } from "@opengeni/db";
5
+ import type { Observability } from "@opengeni/observability";
4
6
  import type { ControlActivityServices, RunKnowledgeSourceSyncBatchInput, RunKnowledgeSourceSyncBatchResult } from "./types.js";
5
7
  import type { KnowledgeSourceSyncAclEvidence, KnowledgeSourceSyncDriver } from "./knowledge-source-sync-driver.js";
6
8
  import { type GoogleDriveChangesPage } from "./google-drive-changes.js";
@@ -66,6 +68,8 @@ export declare function googleDriveSyncDriver(input: {
66
68
  workspaceId: string;
67
69
  initiatingSubjectId: string;
68
70
  authorization: string | undefined;
71
+ retry: GoogleDriveProviderRetryOptions;
72
+ observability: Observability;
69
73
  fullReconciliationIntervalMs: number;
70
74
  observedExternalObjectIds: (ids: string[]) => Promise<Set<string>>;
71
75
  provider?: GoogleDriveSyncProviderPort;
@@ -1,6 +1,7 @@
1
1
  import type { Settings } from "@opengeni/config";
2
- import type { ConnectionCredentialsPort, SessionTurn } from "@opengeni/contracts";
3
- import { type Database, type ResolveConnectionCredentialInput, type ResolveConnectionCredentialResult } from "@opengeni/db";
2
+ import type { ConnectionCredentialsPort } from "@opengeni/contracts";
3
+ import { resolveAcceptedConnectionUse, sessionTenancyProductActivated, type Database, type ResolveConnectionCredentialInput, type ResolveConnectionCredentialResult, type SessionTurnForExecution } from "@opengeni/db";
4
+ import { type Observability } from "@opengeni/observability";
4
5
  export declare function connectionTokenResolverForTurn(input: {
5
6
  db: Database;
6
7
  settings: Settings;
@@ -10,5 +11,10 @@ export declare function connectionTokenResolverForTurn(input: {
10
11
  sessionId: string;
11
12
  rootSessionId: string;
12
13
  attemptId: string;
13
- turn: SessionTurn;
14
+ turn: SessionTurnForExecution;
15
+ authorizeAcceptedUse?: typeof resolveAcceptedConnectionUse;
16
+ /** Test seam for the activation fence on pre-snapshot workspace refs. */
17
+ isSessionTenancyProductActivated?: typeof sessionTenancyProductActivated;
18
+ /** Optional; used only for content-free compatibility-lane counters. */
19
+ observability?: Observability | null | undefined;
14
20
  }): (request: ResolveConnectionCredentialInput) => Promise<ResolveConnectionCredentialResult>;
@@ -0,0 +1,77 @@
1
+ import type { Agent } from "@openai/agents";
2
+ import { type HumanInputResponse, type SessionEvent } from "@opengeni/contracts";
3
+ import { type Database, type OpenSuffixPendingToolCall } from "@opengeni/db";
4
+ export type OpenSuffixResumeOutcome = {
5
+ action: "continue";
6
+ } | {
7
+ action: "requires_action";
8
+ } | {
9
+ action: "cancelled";
10
+ };
11
+ type OpenSuffixSettle = (input: {
12
+ events: Array<{
13
+ type: "session.requiresAction";
14
+ payload: {
15
+ approvals: unknown[];
16
+ };
17
+ } | {
18
+ type: "session.status.changed";
19
+ payload: {
20
+ status: "requires_action";
21
+ };
22
+ }>;
23
+ turnStatus: "requires_action";
24
+ sessionStatus: "requires_action";
25
+ activeTurnId: string;
26
+ runState: {
27
+ serializedRunState: string;
28
+ pendingApprovals: unknown[];
29
+ };
30
+ }) => Promise<boolean>;
31
+ /** Matches the original pause `session.requiresAction` payload: ordinary approvals only. */
32
+ export declare function remainingPendingApprovalsFromSuffix(rows: readonly OpenSuffixPendingToolCall[]): unknown[];
33
+ /** Leftover `pendingApprovals` snapshot includes interaction interventions. */
34
+ export declare function remainingRunStatePendingApprovalsFromSuffix(rows: readonly OpenSuffixPendingToolCall[]): unknown[];
35
+ export declare function openSuffixHistoryItems(row: OpenSuffixPendingToolCall, resultItem: Record<string, unknown>): Record<string, unknown>[];
36
+ export declare function matchingOpenSuffixCallId(input: {
37
+ trigger: Pick<SessionEvent, "type" | "payload">;
38
+ humanInputToolCallId?: string | undefined;
39
+ }): string | null;
40
+ export declare function resolveOpenSuffixResumeTarget(rows: readonly OpenSuffixPendingToolCall[], callId: string | null): OpenSuffixPendingToolCall | null;
41
+ /** True when the paired call and result already exist in durable history. */
42
+ export declare function openSuffixPairPresentInHistory(items: readonly Record<string, unknown>[], callId: string): boolean;
43
+ export declare function settleOpenSuffixResumeIfNeeded(input: {
44
+ db: Database;
45
+ agent: Agent<any, any>;
46
+ accountId: string;
47
+ workspaceId: string;
48
+ sessionId: string;
49
+ turnId: string;
50
+ executionGeneration: number;
51
+ attemptId: string;
52
+ trigger: Pick<SessionEvent, "type" | "payload">;
53
+ humanInputResume: {
54
+ requestId: string;
55
+ toolCallId: string;
56
+ response: HumanInputResponse;
57
+ } | null;
58
+ modelToolOutputTruncationTokens?: number;
59
+ settle: OpenSuffixSettle;
60
+ publish?: (events: Array<{
61
+ type: "agent.toolCall.output";
62
+ payload: {
63
+ id: string;
64
+ output: unknown;
65
+ };
66
+ }>) => Promise<unknown>;
67
+ }): Promise<OpenSuffixResumeOutcome>;
68
+ export declare function interruptionCallIdsFromPause(input: {
69
+ humanInputRequests: Array<{
70
+ toolCallId: string;
71
+ }>;
72
+ interactionInterventionRequests: Array<{
73
+ toolCallId: string;
74
+ }>;
75
+ pendingApprovals: unknown[];
76
+ }): string[];
77
+ export {};
@@ -1,7 +1,9 @@
1
- import { CapabilityPack, type PackInstallation } from "@opengeni/contracts";
1
+ import { CapabilityPack } from "@opengeni/contracts";
2
2
  import { type Database } from "@opengeni/db";
3
+ import { packInstallationUsesLegacyRuntime } from "@opengeni/core";
3
4
  import { type InstalledSkillActivation, type PackSkillActivation } from "@opengeni/runtime";
4
5
  export { resolveRigProviderImageSelection, rigProviderImageSourceImage, settingsWithPackSandboxImage, settingsWithRigImage, settingsWithRigProviderImage, } from "./sandbox-images.js";
6
+ export { packInstallationUsesLegacyRuntime };
5
7
  /**
6
8
  * Legacy pack-scoped runtime compatibility. V2 Pack installations own ordinary
7
9
  * Skill components and select an explicit Rig; they contribute nothing here.
@@ -22,7 +24,6 @@ export type WorkspaceInstalledSkillRuntime = {
22
24
  * override session compute.
23
25
  */
24
26
  export declare function resolveWorkspacePackRuntime(db: Database, workspaceId: string): Promise<WorkspacePackRuntime>;
25
- export declare function packInstallationUsesLegacyRuntime(installation: Pick<PackInstallation, "manifestSnapshot" | "manifestDigest">): boolean;
26
27
  /**
27
28
  * Resolves every active immutable Skill through the normalized Plugin/Skill-
28
29
  * Facet ledger. The data layer has already filtered ineffective owner edges;
@@ -52,12 +53,3 @@ export declare function resolveWorkspaceAgentInstructions(db: Database, workspac
52
53
  * the settings pass through untouched, so deployments without packs keep the
53
54
  * global OPENGENI_DOCKER_IMAGE / OPENGENI_MODAL_IMAGE_REF behavior exactly.
54
55
  */
55
- /**
56
- * Layers the rig version's default variable sets BELOW the session's own set:
57
- * the session's values WIN on any key collision (explicit precedence). Both maps
58
- * are already the decrypted-and-merged values (rig defaults merged in listed
59
- * order upstream). Pure and deterministic — given the same inputs it returns the
60
- * same env, which is what keeps a session's box-manifest env stable across turns
61
- * (the rig version is frozen per session, so its default-set list is fixed).
62
- */
63
- export declare function mergeRigDefaultVariableSetEnvironment(rigDefaultValues: Record<string, string>, sessionValues: Record<string, string>): Record<string, string>;
@@ -22,12 +22,31 @@ export type ReconcileSessionWorkflowWakeOverrides = Partial<{
22
22
  * stable episode identity is the newest non-status event sequence.
23
23
  */
24
24
  export declare function notifyParentOfChildIdle(svc: NotifyServices, workspaceId: string, childSessionId: string, episodeKey: string): Promise<void>;
25
+ /**
26
+ * Deliver one exact child-lifecycle outbox row already committed by the
27
+ * child's own lifecycle transaction (turn failure, requires_action freeze,
28
+ * ...). This layer deliberately cannot create or rewrite the row: the
29
+ * producing transaction is the sole owner of its payload and lineage, and the
30
+ * global reconciler remains the recovery path if immediate delivery fails.
31
+ */
32
+ export declare function deliverChildLifecycleOutboxToParent(svc: NotifyServices, workspaceId: string, childSessionId: string, dedupeKey: string, options?: {
33
+ requireRow?: boolean;
34
+ }): Promise<void>;
25
35
  /**
26
36
  * Deliver the exact failure row already committed by turn settlement. This
27
37
  * layer deliberately cannot create or rewrite the row: the settlement
28
38
  * transaction is the sole owner of the failed turn id, payload, and lineage.
29
39
  */
30
40
  export declare function deliverFailedChildTurnToParent(svc: NotifyServices, workspaceId: string, childSessionId: string, turnId: string): Promise<void>;
41
+ /**
42
+ * Deliver the child_requires_action notice a requires_action settlement
43
+ * committed for this exact (child, turn, generation). When the rollout flag is
44
+ * off no row exists and this is a no-op; the reaper covers crashes after commit.
45
+ */
46
+ export declare function deliverChildRequiresActionToParent(svc: NotifyServices, workspaceId: string, childSessionId: string, input: {
47
+ turnId: string;
48
+ turnGeneration: number;
49
+ }): Promise<void>;
31
50
  export declare function reconcilePendingParentSystemUpdates(svc: NotifyServices, limit?: number, overrides?: ReconcileParentSystemUpdateOverrides): Promise<{
32
51
  claimed: number;
33
52
  delivered: number;
@@ -1,5 +1,5 @@
1
1
  import type { FileAsset } from "@opengeni/contracts";
2
- import type { ObjectHead, ObjectStorage } from "@opengeni/storage";
2
+ import { type ObjectHead, type ObjectStorage } from "@opengeni/storage";
3
3
  import type { ControlActivityServices } from "./types.js";
4
4
  export declare const RETAINED_SCREENSHOT_PENDING_GRACE_MS: number;
5
5
  export declare const RETAINED_SCREENSHOT_CLAIM_TIMEOUT_MS: number;
@@ -1,6 +1,6 @@
1
1
  import { type RetainedArtifactMetadata, type RetainedOutputUnavailableReason } from "@opengeni/contracts";
2
2
  import { type Database } from "@opengeni/db";
3
- import type { ObjectStorage } from "@opengeni/storage";
3
+ import { type ObjectStorage } from "@opengeni/storage";
4
4
  export type TypedScreenshotToolOutput = {
5
5
  callId: string;
6
6
  toolOutputId: string;
@@ -175,7 +175,7 @@ export declare function createRigVerificationActivities(services: () => Promise<
175
175
  command: string;
176
176
  }[];
177
177
  providerImage: {
178
- backend: "blaxel" | "cloudflare" | "daytona" | "docker" | "e2b" | "local" | "modal" | "none" | "runloop" | "selfhosted" | "vercel";
178
+ backend: "blaxel" | "cloudflare" | "daytona" | "docker" | "e2b" | "local" | "modal" | "none" | "opensandbox" | "runloop" | "selfhosted" | "vercel";
179
179
  provider: string;
180
180
  status: "building" | "failed" | "ready" | "unsupported";
181
181
  contentHash: string;
@@ -35,7 +35,6 @@ export type TurnInputOptions = {
35
35
  providerApi: HistoryProviderApi;
36
36
  projectCanonicalHistory?: ModelHistoryAttachmentProjector;
37
37
  materializeModelHistory?: ModelHistoryAttachmentProjector;
38
- materializeSerializedRunState?: (serialized: string) => Promise<string>;
39
38
  projectModelHistory?: ModelHistoryAttachmentProjector;
40
39
  loadActiveHistory?: typeof getActiveSessionHistoryItemsPaged;
41
40
  /** Bounded critical-path timings; telemetry failures never affect preparation. */
@@ -55,22 +54,22 @@ export type ModelAttachmentContent = {
55
54
  contentType: string;
56
55
  dataUrl: string;
57
56
  };
58
- export type ModelHistoryAttachmentProjector = (items: Array<Record<string, unknown>>) => Promise<Array<Record<string, unknown>>>;
57
+ export type ModelHistoryAttachmentProjector = (items: Array<Record<string, unknown>>, options?: ModelHistoryAttachmentProjectionOptions) => Promise<Array<Record<string, unknown>>>;
58
+ export type ModelHistoryAttachmentProjectionOptions = {
59
+ /** Exact, already-authorized files attached to the triggering message. */
60
+ inlineFiles?: readonly FileAsset[];
61
+ };
59
62
  export type ModelAttachmentInputPolicy = {
60
63
  supportsImageInput: boolean;
61
64
  inputFileMediaTypes: readonly string[];
62
65
  };
63
66
  export declare function modelAttachmentContentForFiles(files: FileAsset[], readFileBytes: (file: FileAsset) => Promise<Uint8Array>): Promise<ModelAttachmentContent[]>;
64
67
  /**
65
- * Build one turn-scoped durable-attachment projector. Metadata is batch-loaded
66
- * and file bytes are memoized, so compaction/retry can reuse the same work and
67
- * the SDK's repeated tool loop never touches storage or rescans old history.
68
+ * Build one turn-scoped durable-attachment projector. Current attachment
69
+ * metadata arrives already authorized; bytes are memoized for same-turn retry.
70
+ * Historical projection has no database or object-storage path.
68
71
  */
69
- export declare function createModelHistoryAttachmentProjector(db: Database, authority: {
70
- accountId: string;
71
- workspaceId: string;
72
- subjectId: string | null;
73
- }, policy: ModelAttachmentInputPolicy, readFileBytes?: (file: FileAsset) => Promise<Uint8Array>): ModelHistoryAttachmentProjector;
72
+ export declare function createModelHistoryAttachmentProjector(policy: ModelAttachmentInputPolicy, readFileBytes?: (file: FileAsset) => Promise<Uint8Array>): ModelHistoryAttachmentProjector;
74
73
  /** Add current trigger refs only when older/local history predates durable stamping. */
75
74
  export declare function withCurrentUserAttachmentRefs(historyItems: Array<Record<string, unknown>>, refs: FileResourceRef[]): Array<Record<string, unknown>>;
76
75
  export declare function turnInput(db: Database, runtime: OpenGeniRuntime, agent: any, trigger: Awaited<ReturnType<typeof getSessionEvent>>, options: TurnInputOptions): Promise<PreparedTurnInput>;