@opengeni/worker-bundle 0.20.1 → 0.22.0-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) 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 +66 -0
  42. package/dist/activities/image-generation-references.d.ts +2 -0
  43. package/dist/activities/incident-telemetry-authority.d.ts +52 -0
  44. package/dist/activities/incident-telemetry-preflight.d.ts +71 -0
  45. package/dist/activities/knowledge-source-sync-driver.d.ts +21 -0
  46. package/dist/activities/knowledge-source-sync.d.ts +33 -1
  47. package/dist/activities/mcp-credentials.d.ts +9 -3
  48. package/dist/activities/open-suffix-resume.d.ts +77 -0
  49. package/dist/activities/packs.d.ts +3 -11
  50. package/dist/activities/parent-wake.d.ts +19 -0
  51. package/dist/activities/retained-screenshot-reaper.d.ts +1 -1
  52. package/dist/activities/retained-screenshots.d.ts +1 -1
  53. package/dist/activities/rig-verification.d.ts +1 -1
  54. package/dist/activities/run-input.d.ts +16 -7
  55. package/dist/activities/sandbox-images.d.ts +1 -14
  56. package/dist/activities/sandbox-lease.d.ts +21 -3
  57. package/dist/activities/scheduled-tasks.d.ts +47 -0
  58. package/dist/activities/types.d.ts +23 -2
  59. package/dist/activities/video-media-validation.d.ts +1 -1
  60. package/dist/activities/video-output-retention.d.ts +1 -2
  61. package/dist/activities/xai-auth.d.ts +3 -0
  62. package/dist/{activities-control-SMKF2OBE.js → activities-control-DKG22ONJ.js} +2946 -549
  63. package/dist/activities-control-DKG22ONJ.js.map +1 -0
  64. package/dist/activities-control.d.ts +6 -2
  65. package/dist/activities-turn-4IMC3MAA.js +21326 -0
  66. package/dist/activities-turn-4IMC3MAA.js.map +1 -0
  67. package/dist/activities.d.ts +7 -3
  68. package/dist/artifact-materializer-entry.js +41 -22
  69. package/dist/artifact-materializer-entry.js.map +1 -1
  70. package/dist/{chunk-N5TJIFCE.js → chunk-CE7TPKBS.js} +468 -1
  71. package/dist/chunk-CE7TPKBS.js.map +1 -0
  72. package/dist/chunk-CNYGVRKF.js +4698 -0
  73. package/dist/chunk-CNYGVRKF.js.map +1 -0
  74. package/dist/connection-provider-use.d.ts +18 -0
  75. package/dist/editable-artifact-materializer.d.ts +4 -3
  76. package/dist/github-rest-mcp.d.ts +26 -0
  77. package/dist/index.d.ts +10 -2
  78. package/dist/index.js +58 -14
  79. package/dist/index.js.map +1 -1
  80. package/dist/knowledge-source-sync-activity-policy.d.ts +2 -0
  81. package/dist/model-context-contributions.d.ts +8 -4
  82. package/dist/observability-metrics.d.ts +63 -4
  83. package/dist/opensandbox-kubernetes-inventory.d.ts +21 -0
  84. package/dist/personal-github-git-credentials.d.ts +9 -0
  85. package/dist/pr-review-credentials.d.ts +6 -0
  86. package/dist/sandbox-archive-storage.d.ts +45 -0
  87. package/dist/sandbox-resume.d.ts +65 -6
  88. package/dist/sandbox-routing.d.ts +38 -2
  89. package/dist/scheduled-alert-occurrence.d.ts +33 -0
  90. package/dist/workflow-bundle.js +87 -28
  91. package/dist/workflows/activities.d.ts +1 -0
  92. package/dist/workflows/automations.d.ts +6 -0
  93. package/dist/workflows/document-index.d.ts +1 -0
  94. package/dist/workflows.d.ts +1 -0
  95. package/package.json +17 -17
  96. package/src/activities/agent-turn/admission.ts +292 -0
  97. package/src/activities/agent-turn/agent-build.ts +802 -0
  98. package/src/activities/agent-turn/claim.ts +590 -0
  99. package/src/activities/agent-turn/codex-capacity.ts +720 -0
  100. package/src/activities/agent-turn/codex.ts +94 -0
  101. package/src/activities/agent-turn/compaction-prep.ts +722 -0
  102. package/src/activities/agent-turn/credential-leases.ts +240 -0
  103. package/src/activities/agent-turn/errors.ts +1068 -0
  104. package/src/activities/agent-turn/failure-settlement.ts +1436 -0
  105. package/src/activities/agent-turn/file-resources.ts +227 -0
  106. package/src/activities/agent-turn/finalization.ts +754 -0
  107. package/src/activities/agent-turn/github-repository-bindings.ts +300 -0
  108. package/src/activities/agent-turn/governance-model.ts +465 -0
  109. package/src/activities/agent-turn/history-sink.ts +139 -0
  110. package/src/activities/agent-turn/history.ts +200 -0
  111. package/src/activities/agent-turn/media-artifacts.ts +359 -0
  112. package/src/activities/agent-turn/model-usage.ts +823 -0
  113. package/src/activities/agent-turn/quiescence.ts +353 -0
  114. package/src/activities/agent-turn/run-credentials.ts +761 -0
  115. package/src/activities/agent-turn/run.ts +1530 -0
  116. package/src/activities/agent-turn/sandbox-establish.ts +1207 -0
  117. package/src/activities/agent-turn/sandbox-provision.ts +569 -0
  118. package/src/activities/agent-turn/sandbox-route.ts +358 -0
  119. package/src/activities/agent-turn/sandbox-runtime.ts +731 -0
  120. package/src/activities/agent-turn/stream-attempt.ts +1670 -0
  121. package/src/activities/agent-turn/tool-environment.ts +729 -0
  122. package/src/activities/agent-turn/tool-policy.ts +216 -0
  123. package/src/activities/agent-turn/tool-result-spill.ts +265 -0
  124. package/src/activities/agent-turn/turn-context.ts +281 -0
  125. package/src/activities/agent-turn/xai-capacity.ts +229 -0
  126. package/src/activities/agent-turn.ts +12 -12575
  127. package/src/activities/api-integrations.ts +3 -0
  128. package/src/activities/automations.ts +214 -0
  129. package/src/activities/codemode-dispatcher.ts +12 -1
  130. package/src/activities/common.ts +1 -5
  131. package/src/activities/connector-attachments.ts +168 -0
  132. package/src/activities/context-compaction.ts +18 -0
  133. package/src/activities/documents.ts +6 -4
  134. package/src/activities/environment.ts +151 -55
  135. package/src/activities/generated-images.ts +26 -11
  136. package/src/activities/git-credential-renewal.ts +13 -3
  137. package/src/activities/goals.ts +85 -19
  138. package/src/activities/google-drive-provider.ts +178 -0
  139. package/src/activities/google-drive-publication.ts +938 -0
  140. package/src/activities/image-generation-references.ts +11 -2
  141. package/src/activities/incident-telemetry-authority.ts +327 -0
  142. package/src/activities/incident-telemetry-preflight.ts +317 -0
  143. package/src/activities/knowledge-source-sync-driver.ts +23 -0
  144. package/src/activities/knowledge-source-sync.ts +556 -40
  145. package/src/activities/mcp-credentials.ts +191 -17
  146. package/src/activities/open-suffix-resume.ts +422 -0
  147. package/src/activities/packs.ts +12 -60
  148. package/src/activities/parent-wake.ts +64 -14
  149. package/src/activities/retained-screenshot-reaper.ts +6 -3
  150. package/src/activities/retained-screenshots.ts +15 -47
  151. package/src/activities/rig-verification.ts +1 -1
  152. package/src/activities/run-input.ts +128 -136
  153. package/src/activities/sandbox-images.ts +7 -166
  154. package/src/activities/sandbox-lease.ts +406 -15
  155. package/src/activities/scheduled-tasks.ts +2103 -411
  156. package/src/activities/session-state.ts +10 -2
  157. package/src/activities/types.ts +32 -2
  158. package/src/activities/video-media-validation.ts +3 -3
  159. package/src/activities/video-output-retention.ts +2 -57
  160. package/src/activities/xai-auth.ts +8 -0
  161. package/src/activities-control.ts +2 -0
  162. package/src/activities.ts +3 -0
  163. package/src/activity-services.ts +13 -4
  164. package/src/connection-provider-use.ts +36 -0
  165. package/src/editable-artifact-materializer-subprocess.ts +25 -14
  166. package/src/editable-artifact-materializer.ts +29 -18
  167. package/src/github-rest-mcp.ts +713 -0
  168. package/src/http.ts +16 -6
  169. package/src/index.ts +40 -5
  170. package/src/knowledge-source-sync-activity-policy.ts +2 -0
  171. package/src/model-context-contributions.ts +33 -10
  172. package/src/observability-metrics.ts +357 -0
  173. package/src/opensandbox-kubernetes-inventory.ts +292 -0
  174. package/src/personal-github-git-credentials.ts +331 -0
  175. package/src/pr-review-credentials.ts +163 -0
  176. package/src/sandbox-archive-storage.ts +159 -0
  177. package/src/sandbox-resume.ts +449 -63
  178. package/src/sandbox-routing.ts +314 -16
  179. package/src/scheduled-alert-occurrence.ts +176 -0
  180. package/src/workflows/activities.ts +18 -2
  181. package/src/workflows/automations.ts +11 -0
  182. package/src/workflows/session.ts +13 -3
  183. package/src/workflows.ts +1 -0
  184. package/dist/activities-control-SMKF2OBE.js.map +0 -1
  185. package/dist/activities-turn-IDS3WEHA.js +0 -16532
  186. package/dist/activities-turn-IDS3WEHA.js.map +0 -1
  187. package/dist/chunk-N5TJIFCE.js.map +0 -1
  188. package/dist/chunk-P6Z2SLAA.js +0 -3092
  189. package/dist/chunk-P6Z2SLAA.js.map +0 -1
@@ -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;
@@ -23,13 +23,18 @@ export type PreparedTurnInput = {
23
23
  };
24
24
  export type TurnInputOptions = {
25
25
  turnId: string;
26
+ /** Frozen initiating-human authority for every model-visible file read. */
27
+ fileAuthority: {
28
+ accountId: string;
29
+ subjectId: string | null;
30
+ };
26
31
  recovering?: boolean;
27
32
  unavailableSandboxFilesNote?: string;
28
33
  runCredentialsNote?: string;
34
+ mcpAvailabilityNote?: string;
29
35
  providerApi: HistoryProviderApi;
30
36
  projectCanonicalHistory?: ModelHistoryAttachmentProjector;
31
37
  materializeModelHistory?: ModelHistoryAttachmentProjector;
32
- materializeSerializedRunState?: (serialized: string) => Promise<string>;
33
38
  projectModelHistory?: ModelHistoryAttachmentProjector;
34
39
  loadActiveHistory?: typeof getActiveSessionHistoryItemsPaged;
35
40
  /** Bounded critical-path timings; telemetry failures never affect preparation. */
@@ -49,19 +54,23 @@ export type ModelAttachmentContent = {
49
54
  contentType: string;
50
55
  dataUrl: string;
51
56
  };
52
- 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
+ };
53
62
  export type ModelAttachmentInputPolicy = {
54
63
  supportsImageInput: boolean;
55
64
  inputFileMediaTypes: readonly string[];
56
65
  };
57
66
  export declare function modelAttachmentContentForFiles(files: FileAsset[], readFileBytes: (file: FileAsset) => Promise<Uint8Array>): Promise<ModelAttachmentContent[]>;
58
67
  /**
59
- * Build one turn-scoped durable-attachment projector. Metadata is batch-loaded
60
- * and file bytes are memoized, so compaction/retry can reuse the same work and
61
- * 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.
62
71
  */
63
- export declare function createModelHistoryAttachmentProjector(db: Database, workspaceId: string, policy: ModelAttachmentInputPolicy, readFileBytes?: (file: FileAsset) => Promise<Uint8Array>): ModelHistoryAttachmentProjector;
72
+ export declare function createModelHistoryAttachmentProjector(policy: ModelAttachmentInputPolicy, readFileBytes?: (file: FileAsset) => Promise<Uint8Array>): ModelHistoryAttachmentProjector;
64
73
  /** Add current trigger refs only when older/local history predates durable stamping. */
65
74
  export declare function withCurrentUserAttachmentRefs(historyItems: Array<Record<string, unknown>>, refs: FileResourceRef[]): Array<Record<string, unknown>>;
66
75
  export declare function turnInput(db: Database, runtime: OpenGeniRuntime, agent: any, trigger: Awaited<ReturnType<typeof getSessionEvent>>, options: TurnInputOptions): Promise<PreparedTurnInput>;
67
- export declare function userMessageTextWithAttachments(db: Database, workspaceId: string, text: string, resources: ResourceRef[]): Promise<string>;
76
+ export declare function userMessageTextWithAttachments(db: Database, accountId: string, workspaceId: string, subjectId: string | null, text: string, resources: ResourceRef[]): Promise<string>;
@@ -1,14 +1 @@
1
- import type { Settings } from "@opengeni/config";
2
- import type { CapabilityPack, RigVersion, SandboxBackend } from "@opengeni/contracts";
3
- import { resolveModalCheckpointProviderBinding } from "@opengeni/runtime/sandbox";
4
- export declare function settingsWithPackSandboxImage(settings: Settings, sandboxImage: string | null, sandboxProviderImages?: CapabilityPack["sandboxProviderImages"] | null): Settings;
5
- export declare function settingsWithRigImage(settings: Settings, rigImage: string | null): Settings;
6
- export declare function rigProviderImageSourceImage(settings: Settings, backend: SandboxBackend): string | null;
7
- export type RigProviderImageSelectionReason = "selected" | "missing" | "provider_unsupported" | "not_ready" | "not_cold_boot_validated" | "content_mismatch" | "provider_binding_unavailable" | "provider_binding_mismatch";
8
- export declare function resolveRigProviderImageSelection(settings: Settings, version: RigVersion | null, backend: SandboxBackend, currentProviderBindingKeyHash: string | null): {
9
- settings: Settings;
10
- reason: RigProviderImageSelectionReason;
11
- contentHash: string | null;
12
- imageId: string | null;
13
- };
14
- export declare function settingsWithRigProviderImage(settings: Settings, version: RigVersion | null, backend: SandboxBackend, resolveBinding?: typeof resolveModalCheckpointProviderBinding): Promise<Settings>;
1
+ export { resolveRigProviderImageSelection, rigProviderImageSourceImage, settingsWithPackSandboxImage, settingsWithRigImage, settingsWithRigProviderImage, type RigProviderImageSelectionReason, } from "@opengeni/core";
@@ -1,7 +1,10 @@
1
+ import { type OpStatus } from "@opengeni/agent-proto";
1
2
  import { listLiveModalSandboxLeaseAttributions, readLease, type ReapDrainable, type RetainedProcessProviderProof, type SandboxRetainedProcess, type LeaseSnapshot } from "@opengeni/db";
2
- import { createSandboxClientForBackend, inspectModalSandboxLifecycle, resolveModalCheckpointProviderBindingForSession, terminateModalSandboxById, type ModalOrphanSweepTermination, type ModalCheckpointProviderBinding, type ProviderWorkspaceCapturePolicy, type WorkspaceArchiveDescriptor } from "@opengeni/runtime/sandbox";
3
+ import { type ConnectedMachineBackgroundCommandClaim, type ConnectedMachineBackgroundCommandProof } from "@opengeni/db/session-background-commands";
4
+ import { createSandboxClientForBackend, inspectModalSandboxLifecycle, resolveModalCheckpointProviderBindingForSession, terminateModalSandboxById, type ModalOrphanSweepTermination, type ModalCheckpointProviderBinding, type ProviderWorkspaceCapturePolicy, type WorkspaceArchiveDescriptor, type ControlRpc } from "@opengeni/runtime/sandbox";
3
5
  import { type SandboxDrainActivityInput, type SandboxLeaseSweepMaintenanceInput } from "../sandbox-reaper-contract.js";
4
6
  import type { ControlActivityServices as ActivityServices } from "./types.js";
7
+ import { type OpenSandboxKubernetesInventory } from "../opensandbox-kubernetes-inventory.js";
5
8
  export { sandboxLeaseTelemetryKey } from "@opengeni/observability";
6
9
  export type ReapSandboxLeasesResult = {
7
10
  /** Stale viewer holders + warming-death rows the sweep touched is folded into
@@ -57,6 +60,9 @@ export type DrainCaptureDisposition = "capture_required" | "archive_published";
57
60
  * provider disappearance before capture. */
58
61
  export type TerminateBoxFn = (settings: ActivityServices["settings"], lease: NonNullable<Awaited<ReturnType<typeof readLease>>>, observability: ActivityServices["observability"], persistArchive: PersistArchiveFn, providerCaptureRequestId?: string, captureDisposition?: DrainCaptureDisposition, capturePolicy?: ProviderWorkspaceCapturePolicy | null) => Promise<boolean | ProviderTerminationOutcome>;
59
62
  export type SweepModalOrphansFn = (settings: ActivityServices["settings"], db: ActivityServices["db"], observability: ActivityServices["observability"]) => Promise<number>;
63
+ export type InspectOpenSandboxKubernetesInventoryFn = (input: {
64
+ namespace: string;
65
+ }) => Promise<OpenSandboxKubernetesInventory>;
60
66
  export type SandboxLeaseActivityOptions = {
61
67
  /** Override the provider terminate (tests spy this; defaults to the real
62
68
  * resume-by-id + provider stop()). */
@@ -64,6 +70,8 @@ export type SandboxLeaseActivityOptions = {
64
70
  /** Override the provider-side Modal orphan sweep (tests spy this; defaults to
65
71
  * Modal list+tag comparison when Modal is configured). */
66
72
  sweepModalOrphans?: SweepModalOrphansFn;
73
+ /** Override the read-only bounded OpenSandbox Kubernetes projection. */
74
+ inspectOpenSandboxKubernetesInventory?: InspectOpenSandboxKubernetesInventoryFn;
67
75
  /** Override only the read-only provider process probe. The canonical DB
68
76
  * settlement remains real in tests and production. */
69
77
  probeRetainedProcess?: RetainedProcessProbeFn;
@@ -85,12 +93,14 @@ export type RetainedProcessProbeResult = {
85
93
  status: "deferred";
86
94
  reason: "identity_mismatch" | "resume_state_missing" | "backend_unsupported" | "provider_running" | "provider_unknown" | "provider_timeout" | "provider_error" | "provider_binding_missing" | "provider_binding_mismatch";
87
95
  };
88
- export type RetainedProcessProbeFn = (settings: ActivityServices["settings"], lease: LeaseSnapshot, process: SandboxRetainedProcess) => Promise<RetainedProcessProbeResult>;
96
+ export type RetainedProcessProbeFn = (settings: ActivityServices["settings"], lease: LeaseSnapshot, process: SandboxRetainedProcess, mode?: "observe" | "cancel") => Promise<RetainedProcessProbeResult>;
89
97
  export type HistoricalModalSandboxLifecycleProbeFn = typeof inspectModalSandboxLifecycle;
90
98
  export type DrainableProviderProbeFn = (settings: ActivityServices["settings"], lease: LeaseSnapshot) => Promise<"ready" | "missing">;
91
99
  export declare const RETAINED_PROCESS_RECONCILIATION_LIMIT = 20;
92
100
  export declare const RETAINED_PROCESS_RECONCILIATION_CLAIM_TTL_MS: number;
93
101
  export declare const RETAINED_PROCESS_PROVIDER_PROBE_TIMEOUT_MS = 5000;
102
+ export declare const CONNECTED_COMMAND_RECONCILIATION_LIMIT = 20;
103
+ export declare const CONNECTED_COMMAND_RECONCILIATION_CLAIM_TTL_MS: number;
94
104
  export declare class SandboxProviderCaptureTimeoutError extends Error {
95
105
  readonly sandboxGroupId: string;
96
106
  readonly backend: string;
@@ -128,11 +138,19 @@ export declare function createSandboxLeaseActivities(services: () => Promise<Act
128
138
  maintainSandboxLeaseSweep: (input: SandboxLeaseSweepMaintenanceInput) => Promise<SandboxLeaseSweepMaintenanceResult>;
129
139
  reapSandboxLeases: () => Promise<ReapSandboxLeasesResult>;
130
140
  };
131
- export declare function probeRetainedProcessAtProvider(settings: ActivityServices["settings"], lease: LeaseSnapshot, process: SandboxRetainedProcess): Promise<RetainedProcessProbeResult>;
141
+ export declare function probeConnectedMachineBackgroundCommand(claim: ConnectedMachineBackgroundCommandClaim, controlRpc: ControlRpc, controlTimeoutMs: number, observedAt?: Date): Promise<ConnectedMachineBackgroundCommandProof | null>;
142
+ export declare function connectedCommandProofFromStatus(status: OpStatus, observedAt: Date): ConnectedMachineBackgroundCommandProof | null;
143
+ export declare function probeRetainedProcessAtProvider(settings: ActivityServices["settings"], lease: LeaseSnapshot, process: SandboxRetainedProcess, mode?: "observe" | "cancel"): Promise<RetainedProcessProbeResult>;
132
144
  /** Classify only exact SDK control banners. Arbitrary output, malformed text,
133
145
  * and a running marker are observations to retry; none is physical exit proof. */
134
146
  export declare function classifyRetainedProcessPollResult(result: unknown, providerSessionId: number): RetainedProcessProbeResult;
135
147
  export declare function modalOrphanTerminationStillEligible(latest: Awaited<ReturnType<typeof listLiveModalSandboxLeaseAttributions>>, candidate: ModalOrphanSweepTermination): boolean;
148
+ export type SandboxDrainReason = "idle" | "provider_deadline" | "operator" | "teardown_claim" | "rotation_requested";
149
+ /** The bounded drain reason carried on `sandbox.box.terminated`: the lease's
150
+ * rotation reason when a rotation was requested, otherwise the ordinary idle
151
+ * drain. A requested rotation without a recorded reason (legacy rows) is
152
+ * reported as `rotation_requested` rather than guessed. */
153
+ export declare function sandboxDrainReason(lease: Pick<LeaseSnapshot, "rotationRequestedAt" | "rotationReason">): SandboxDrainReason;
136
154
  /**
137
155
  * Resume/attach the box by id, PERSIST its /workspace, fold the snapshot onto the
138
156
  * lease under the epoch fence, hand the superseded snapshot to durable GC, THEN
@@ -1,4 +1,51 @@
1
1
  import type { ControlActivityServices, DispatchScheduledTaskRunInput, DispatchScheduledTaskRunResult } from "./types.js";
2
+ type ScheduledTemporalActivityIdentity = {
3
+ namespace: string;
4
+ workflowExecution?: {
5
+ workflowId: string;
6
+ runId: string;
7
+ };
8
+ activityId: string;
9
+ };
10
+ export declare function scheduledTaskRunProducerKey(input: DispatchScheduledTaskRunInput, suppliedActivityIdentity?: ScheduledTemporalActivityIdentity): string;
11
+ /**
12
+ * Display title for a session the scheduler generates for a task.
13
+ *
14
+ * A scheduled session's `initialMessage` is the task prompt, byte-identical for
15
+ * every run, so an untitled scheduled session falls back to that prompt in the
16
+ * rail and reads exactly like every other run of the task. The task name is the
17
+ * short human-chosen label that actually identifies it, so that is the title.
18
+ *
19
+ * The title is the task name and NOTHING else. It deliberately does not name the
20
+ * run's fire instant, for two independent reasons:
21
+ *
22
+ * - No run mode guarantees one run per session. `reusable_session` generates
23
+ * its session on the first fire and then reuses it forever, and even under
24
+ * `new_session_per_run` alert-occurrence redelivery converges several runs
25
+ * onto one canonical responder session. `existing_session` never generates a
26
+ * session at all, so the scheduler never titles one. A run-specific fact
27
+ * frozen into the title is therefore right for the generating run and a lie
28
+ * for every run that lands in the same session afterwards.
29
+ * - A title is one stored string shown to every viewer, while every surface
30
+ * that renders a run's fire instant renders it viewer-local: the rail row
31
+ * prints the title beside `relativeTimeLabel(session.updatedAt)`, and the
32
+ * Schedules run list prints `formatTimestamp(run.firedAt)`, which is
33
+ * `toLocaleString()`. A wall clock stored in the title therefore disagrees
34
+ * with the time printed next to it for every viewer outside whichever zone
35
+ * it was rendered in. The task's own `timeZone` is no escape: it labels the
36
+ * schedule rule ("Mon Wed 09:00 Europe/Oslo"), not the rendering of a run,
37
+ * which stays viewer-local. No stored clock can agree with a viewer-local
38
+ * one, so the title carries none and the instant stays on the surfaces that
39
+ * already render it correctly.
40
+ *
41
+ * Dropping the clock settles the determinism constraint outright rather than
42
+ * working around it: the same run titled by the normal dispatch or by a later
43
+ * recovery in a different worker process derives one string from `task.name`
44
+ * alone, with no Intl call and so no host ICU or tzdata build to make the two
45
+ * texts differ.
46
+ */
47
+ export declare function scheduledTaskSessionTitle(taskName: string): string;
2
48
  export declare function createScheduledTaskActivities(services: () => Promise<ControlActivityServices>): {
3
49
  dispatchScheduledTaskRun: (input: DispatchScheduledTaskRunInput) => Promise<DispatchScheduledTaskRunResult>;
4
50
  };
51
+ export {};
@@ -72,6 +72,8 @@ export type SharedActivityServices = {
72
72
  startVideoGenerationWorkflow?: StartVideoGenerationWorkflow | null;
73
73
  entitlements?: EntitlementsPort | null;
74
74
  connectionCredentials?: ConnectionCredentialsPort | null;
75
+ /** Standalone, default-off personal GitHub smart-HTTP broker consumer. */
76
+ personalGitHubCredentials?: ConnectionCredentialsPort["gitCredentials"] | null;
75
77
  };
76
78
  /** Control workers own short database and maintenance activities. Document
77
79
  * parsing is resolved lazily by the indexing activity itself. */
@@ -225,6 +227,8 @@ export type EscapedMcpTimeoutRecoveryDetail = {
225
227
  turnId: string;
226
228
  triggerEventId: string;
227
229
  executionGeneration: number;
230
+ providerRecoveryCount: number;
231
+ continueDelayMs: number;
228
232
  };
229
233
  export type RecoverEscapedMcpTimeoutInput = EscapedMcpTimeoutRecoveryDetail & {
230
234
  accountId: string;
@@ -268,7 +272,7 @@ export type MaybeContinueGoalInput = {
268
272
  workflowId: string;
269
273
  };
270
274
  export type MaybeContinueGoalResult = {
271
- action: "none" | "queue" | "continue" | "paused";
275
+ action: "none" | "queue" | "continue" | "paused" | "held" | "deferred";
272
276
  };
273
277
  export type DispatchScheduledTaskRunInput = {
274
278
  workspaceId: string;
@@ -289,7 +293,7 @@ export type DispatchScheduledTaskRunResult = {
289
293
  action: "deleted";
290
294
  } | {
291
295
  action: "blocked";
292
- reason: "insufficient_credits" | "monthly_model_cost_limit" | "monthly_agent_run_limit" | "malformed_manual_trigger" | "knowledge_source_paused";
296
+ reason: "insufficient_credits" | "monthly_model_cost_limit" | "monthly_agent_run_limit" | "malformed_manual_trigger" | "scheduled_task_paused" | "scheduled_authority_exhausted" | "scheduled_run_terminal" | "scheduled_execution_unrepresentable" | "knowledge_source_paused" | "incident_preflight_metadata_missing" | "incident_responder_under_capable" | "incident_data_source_unsuitable";
293
297
  } | {
294
298
  action: "start" | "signal";
295
299
  accountId: string;
@@ -315,6 +319,23 @@ export type RunKnowledgeSourceSyncBatchInput = {
315
319
  sourceId: string;
316
320
  overlapPolicy: "skip" | "buffer_one";
317
321
  };
322
+ export type DispatchAutomationRunInput = {
323
+ accountId: string;
324
+ workspaceId: string;
325
+ runId: string;
326
+ };
327
+ export type DispatchAutomationRunResult = {
328
+ action: "started";
329
+ sessionId: string;
330
+ } | {
331
+ action: "already_dispatched";
332
+ sessionId: string;
333
+ } | {
334
+ action: "skipped";
335
+ reason: string;
336
+ } | {
337
+ action: "not_found";
338
+ };
318
339
  export type RunKnowledgeSourceSyncBatchResult = {
319
340
  action: "continue";
320
341
  } | {
@@ -1,5 +1,5 @@
1
1
  import type { GeneratedVideoFacts } from "@opengeni/contracts";
2
- import type { ObjectStorage } from "@opengeni/storage";
2
+ import { type ObjectStorage } from "@opengeni/storage";
3
3
  export type VerifiedTempFile = Readonly<{
4
4
  directory: string;
5
5
  path: string;
@@ -26,8 +26,7 @@ export declare function downloadGeneratedVideoToVerifiedTemp(input: {
26
26
  temp: VerifiedTempFile;
27
27
  facts: GeneratedVideoFacts;
28
28
  }>;
29
- /** Stream verified bytes into an immutable content-addressed object and hash
30
- * the stored generation back through version-fenced Range reads. */
29
+ /** Stream verified bytes into an immutable content-addressed object. */
31
30
  export declare function retainVerifiedGeneratedVideo(input: {
32
31
  storage: ObjectStorage;
33
32
  temp: VerifiedTempFile;
@@ -20,4 +20,7 @@ export declare function buildXaiTurnRequestAuthorization(input: {
20
20
  hostedSearch?: XaiSubscriptionRequestContext["hostedSearch"];
21
21
  onFinalContextUsage?: XaiSubscriptionRequestContext["onFinalContextUsage"];
22
22
  nextRequestId?: XaiSubscriptionRequestContext["nextRequestId"];
23
+ streamIdleTimeoutMs?: XaiSubscriptionRequestContext["streamIdleTimeoutMs"];
24
+ onModelRequestDiagnostic?: XaiSubscriptionRequestContext["onModelRequestDiagnostic"];
25
+ onModelRequestEvent?: XaiSubscriptionRequestContext["onModelRequestEvent"];
23
26
  }): Promise<XaiTurnRequestAuthorization>;