@opengeni/worker-bundle 0.27.0-canary.0 → 0.27.2-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 (60) hide show
  1. package/dist/activities/agent-turn/agent-build.d.ts +3 -4
  2. package/dist/activities/agent-turn/governance-model.d.ts +2 -3
  3. package/dist/activities/agent-turn/skill-checkout.d.ts +21 -0
  4. package/dist/activities/agent-turn/skill-install.d.ts +12 -0
  5. package/dist/activities/agent-turn/skill-read.d.ts +15 -0
  6. package/dist/activities/agent-turn/skill-save.d.ts +26 -0
  7. package/dist/activities/agent-turn/skill-search.d.ts +16 -0
  8. package/dist/activities/agent-turn/skill-selection.d.ts +17 -0
  9. package/dist/activities/agent-turn/skill-tools.d.ts +20 -0
  10. package/dist/activities/agent-turn/skill-transfer.d.ts +26 -0
  11. package/dist/activities/agent-turn/tool-environment.d.ts +7 -0
  12. package/dist/activities/parent-wake.d.ts +12 -2
  13. package/dist/activities/run-input.d.ts +11 -5
  14. package/dist/activities/sandbox-lease.d.ts +5 -4
  15. package/dist/activities/types.d.ts +4 -2
  16. package/dist/activities/workflow-wake.d.ts +2 -4
  17. package/dist/{activities-control-VMA3XMHE.js → activities-control-WZRFEIJH.js} +103 -26
  18. package/dist/activities-control-WZRFEIJH.js.map +1 -0
  19. package/dist/{activities-turn-57AOUNYN.js → activities-turn-V7J34ZOF.js} +945 -532
  20. package/dist/activities-turn-V7J34ZOF.js.map +1 -0
  21. package/dist/{chunk-D4ZEFOYH.js → chunk-BARTLVBK.js} +1 -1
  22. package/dist/chunk-BARTLVBK.js.map +1 -0
  23. package/dist/{chunk-7LS42PHP.js → chunk-C54VDT6I.js} +590 -34
  24. package/dist/chunk-C54VDT6I.js.map +1 -0
  25. package/dist/index.js +6 -4
  26. package/dist/index.js.map +1 -1
  27. package/dist/model-context-contributions.d.ts +2 -0
  28. package/dist/observability-metrics.d.ts +1 -1
  29. package/dist/workflow-bundle.js +1 -1
  30. package/package.json +17 -17
  31. package/src/activities/agent-turn/agent-build.ts +8 -34
  32. package/src/activities/agent-turn/errors.ts +4 -0
  33. package/src/activities/agent-turn/governance-model.ts +15 -19
  34. package/src/activities/agent-turn/run.ts +4 -6
  35. package/src/activities/agent-turn/sandbox-provision.ts +9 -0
  36. package/src/activities/agent-turn/skill-checkout.ts +124 -0
  37. package/src/activities/agent-turn/skill-install.ts +57 -0
  38. package/src/activities/agent-turn/skill-read.ts +117 -0
  39. package/src/activities/agent-turn/skill-save.ts +124 -0
  40. package/src/activities/agent-turn/skill-search.ts +110 -0
  41. package/src/activities/agent-turn/skill-selection.ts +53 -0
  42. package/src/activities/agent-turn/skill-tools.ts +268 -0
  43. package/src/activities/agent-turn/skill-transfer.ts +137 -0
  44. package/src/activities/agent-turn/tool-environment.ts +93 -1
  45. package/src/activities/automations.ts +3 -1
  46. package/src/activities/context-compaction.ts +26 -2
  47. package/src/activities/parent-wake.ts +66 -5
  48. package/src/activities/run-input.ts +88 -12
  49. package/src/activities/sandbox-lease.ts +77 -20
  50. package/src/activities/scheduled-tasks.ts +2 -0
  51. package/src/activities/types.ts +4 -2
  52. package/src/activities/workflow-wake.ts +42 -5
  53. package/src/index.ts +3 -1
  54. package/src/model-context-contributions.ts +18 -2
  55. package/src/observability-metrics.ts +2 -0
  56. package/src/sandbox-routing.ts +42 -1
  57. package/dist/activities-control-VMA3XMHE.js.map +0 -1
  58. package/dist/activities-turn-57AOUNYN.js.map +0 -1
  59. package/dist/chunk-7LS42PHP.js.map +0 -1
  60. package/dist/chunk-D4ZEFOYH.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { type AttemptConnectorActionBinding, type ConnectorActionPolicyHooks, type SandboxFileDownload } from "@opengeni/runtime";
1
+ import { type AttemptConnectorActionBinding, type BuildAgentOptions, 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";
@@ -12,6 +12,7 @@ import type { sandboxArtifactRuntimeAdmission } from "./sandbox-route.js";
12
12
  import type { loadWorkspaceEnvironmentForRunWithCredentials, sandboxEnvironmentForRun } from "../environment.js";
13
13
  import type { AttemptIdentityState, EventingState, ProviderTurnState, SandboxRuntimeState } from "./turn-context.js";
14
14
  export type BuildTurnAgentDeps = {
15
+ skillCatalog: NonNullable<BuildAgentOptions["skillCatalog"]>;
15
16
  input: RunAgentTurnInput;
16
17
  db: ActivityServices["db"];
17
18
  runtime: ActivityServices["runtime"];
@@ -46,8 +47,6 @@ export type BuildTurnAgentDeps = {
46
47
  workspaceMemory: GovernanceModelOk["workspaceMemory"];
47
48
  rigVersion: GovernanceModelOk["rigVersion"];
48
49
  rigName: GovernanceModelOk["rigName"];
49
- packRuntime: GovernanceModelOk["packRuntime"];
50
- installedSkillRuntime: GovernanceModelOk["installedSkillRuntime"];
51
50
  buildCompanyBrainContributionReceiptFor: GovernanceModelOk["buildCompanyBrainContributionReceiptFor"];
52
51
  promptCacheKey: CompactionPrepOk["promptCacheKey"];
53
52
  workspaceVariableSet: Awaited<ReturnType<typeof loadWorkspaceEnvironmentForRunWithCredentials>>;
@@ -74,7 +73,7 @@ export type BuildTurnAgentDeps = {
74
73
  };
75
74
  export declare function buildTurnAgent(deps: BuildTurnAgentDeps): Promise<{
76
75
  agent: import("@openai/agents-core").Agent<any, any>;
77
- modelVisibleRuntimeSkillActivations: readonly import("@opengeni/runtime").RuntimeSkillActivation[];
76
+ modelVisibleSkillCatalogText: string;
78
77
  postAgentPreparationStartedAt: number;
79
78
  }>;
80
79
  export type BuildTurnAgentOk = Awaited<ReturnType<typeof buildTurnAgent>>;
@@ -1,7 +1,7 @@
1
1
  import { materializeRigVersionForAttempt } from "@opengeni/db";
2
2
  import { renderWorkspaceGovernanceContext, type OpenGeniRuntime } from "@opengeni/runtime";
3
3
  import { type Settings } from "@opengeni/config";
4
- import { resolveWorkspacePackRuntime, resolveWorkspaceInstalledSkillRuntime } from "../packs.js";
4
+ import { resolveWorkspacePackRuntime } from "../packs.js";
5
5
  import { createModelHistoryAttachmentProjector } from "../run-input.js";
6
6
  import type { TurnActivityServices as ActivityServices, RunAgentTurnInput, RunAgentTurnResult } from "../types.js";
7
7
  import { buildCompanyBrainContributionReceipt } from "../../model-context-contributions.js";
@@ -36,7 +36,6 @@ export type GovernanceModelDeps = {
36
36
  export type GovernanceModelOk = {
37
37
  runtimePreparationStartedAt: number;
38
38
  packRuntime: Awaited<ReturnType<typeof resolveWorkspacePackRuntime>>;
39
- installedSkillRuntime: Awaited<ReturnType<typeof resolveWorkspaceInstalledSkillRuntime>>;
40
39
  rigVersion: NonNullable<Awaited<ReturnType<typeof materializeRigVersionForAttempt>>>["version"] | null;
41
40
  rigName: string | null;
42
41
  agentHumanInputEnabled: boolean;
@@ -44,7 +43,7 @@ export type GovernanceModelOk = {
44
43
  workspaceGovernance: ReturnType<typeof renderWorkspaceGovernanceContext>;
45
44
  structuredWorkspacePolicyActive: boolean;
46
45
  workspaceMemory: string | null | undefined;
47
- buildCompanyBrainContributionReceiptFor: (skillActivations: Parameters<typeof buildCompanyBrainContributionReceipt>[0]["skillActivations"]) => ReturnType<typeof buildCompanyBrainContributionReceipt>;
46
+ buildCompanyBrainContributionReceiptFor: (skillCatalogText: string) => ReturnType<typeof buildCompanyBrainContributionReceipt>;
48
47
  logicalSandboxSettings: Settings;
49
48
  verifiedRigProviderImageId: string | undefined;
50
49
  runSettings: Settings;
@@ -0,0 +1,21 @@
1
+ import type { AttemptToolDefinition } from "@opengeni/codemode";
2
+ import type { SandboxChannelAService } from "@opengeni/runtime/sandbox";
3
+ import type { SkillTextFile } from "@opengeni/runtime/skill-library";
4
+ import type { SkillSaveReceipt, SkillSaveRequest } from "./skill-save.js";
5
+ type SkillFileSystem = Pick<SandboxChannelAService, "fsList" | "fsRead" | "fsWrite" | "fsMkdir">;
6
+ export declare function createSkillCheckoutAttemptToolDefinition(input: {
7
+ authorize: () => Promise<void>;
8
+ load: (skill: string) => Promise<{
9
+ skillId: string;
10
+ revisionId: string | null;
11
+ scopeVersion: number | null;
12
+ files: readonly SkillTextFile[];
13
+ }>;
14
+ filesystem: () => Promise<SkillFileSystem>;
15
+ }): AttemptToolDefinition;
16
+ export declare function createSkillPublishAttemptToolDefinition(input: {
17
+ authorize: () => Promise<void>;
18
+ filesystem: () => Promise<SkillFileSystem>;
19
+ save: (request: SkillSaveRequest) => Promise<SkillSaveReceipt>;
20
+ }): AttemptToolDefinition;
21
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { AttemptToolDefinition } from "@opengeni/codemode";
2
+ import type { SkillSaveReceipt } from "./skill-save.js";
3
+ /** The installer resolves/pins bytes and persists them through the shared lifecycle. */
4
+ export declare function createSkillInstallAttemptToolDefinition(input: {
5
+ authorize: () => Promise<void>;
6
+ install: (request: {
7
+ operationId: string;
8
+ source: string;
9
+ expectedInstallationVersion?: number;
10
+ reason: string;
11
+ }) => Promise<SkillSaveReceipt>;
12
+ }): AttemptToolDefinition;
@@ -0,0 +1,15 @@
1
+ import type { AttemptToolDefinition } from "@opengeni/codemode";
2
+ import { type SkillTextFile } from "@opengeni/runtime/skill-library";
3
+ export declare const SKILL_READ_TOOL_NAME = "skill_read";
4
+ export type SkillReadContent = Readonly<{
5
+ files: readonly SkillTextFile[];
6
+ skillId: string;
7
+ revisionId: string;
8
+ scopeVersion: number;
9
+ installationVersion?: number;
10
+ }>;
11
+ /** A first-party gateway definition, not a sandbox capability or second backend. */
12
+ export declare function createSkillReadAttemptToolDefinition(input: {
13
+ authorize: () => Promise<void>;
14
+ load: (skill: string) => Promise<readonly SkillTextFile[] | SkillReadContent>;
15
+ }): AttemptToolDefinition;
@@ -0,0 +1,26 @@
1
+ import type { AttemptToolDefinition } from "@opengeni/codemode";
2
+ import { type SkillTextFile } from "@opengeni/runtime/skill-library";
3
+ export type SkillSaveRequest = {
4
+ operationId: string;
5
+ skillId: string;
6
+ expectedRevisionId: string | null;
7
+ expectedScopeVersion: number;
8
+ files: readonly SkillTextFile[];
9
+ reason: string;
10
+ };
11
+ export type SkillSaveReceipt = {
12
+ operationId: string;
13
+ skillId: string;
14
+ revisionId: string;
15
+ outcome: "applied" | "pending" | "preserved";
16
+ replayed: boolean;
17
+ };
18
+ /** Persistence owns mode enforcement, replay, and the final compare-and-swap. */
19
+ export declare function createSkillSaveAttemptToolDefinition(input: {
20
+ authorize: () => Promise<void>;
21
+ load: (skillId: string, revisionId: string) => Promise<{
22
+ revisionId: string;
23
+ files: readonly SkillTextFile[];
24
+ }>;
25
+ save: (request: SkillSaveRequest) => Promise<SkillSaveReceipt>;
26
+ }): AttemptToolDefinition;
@@ -0,0 +1,16 @@
1
+ import type { AttemptToolDefinition } from "@opengeni/codemode";
2
+ import { type PublicSkillSearchClient } from "@opengeni/core";
3
+ export type WorkspaceSkillSearchEntry = Readonly<{
4
+ id: string;
5
+ name: string;
6
+ description: string;
7
+ revisionId?: string;
8
+ scopeVersion?: number;
9
+ installationVersion?: number;
10
+ source?: "workspace" | "builtin" | "session" | "pack";
11
+ }>;
12
+ export declare function createSkillSearchAttemptToolDefinition(input: {
13
+ authorize: () => Promise<void>;
14
+ listWorkspace: () => Promise<readonly WorkspaceSkillSearchEntry[]>;
15
+ publicSearch: PublicSkillSearchClient;
16
+ }): AttemptToolDefinition;
@@ -0,0 +1,17 @@
1
+ import type { BundledSkillId } from "@opengeni/contracts";
2
+ export type BundledSkillConfiguration = {
3
+ /** Already resolved names, not discovered schemas or an attempt catalog. */
4
+ firstPartyTools: readonly string[];
5
+ videoGenerationEnabled: boolean;
6
+ bundledSkillIds?: readonly BundledSkillId[] | undefined;
7
+ };
8
+ /** Individual ordinary-code defaults, evaluated without async tool preparation. */
9
+ export declare function configuredBundledSkillNames(context: BundledSkillConfiguration): string[];
10
+ export declare function loadConfiguredBundledSkills(context: BundledSkillConfiguration): {
11
+ id: string;
12
+ artifact: Readonly<{
13
+ name: string;
14
+ description?: string | null | undefined;
15
+ files: readonly import("@opengeni/runtime").RuntimeSkillArtifactFile[];
16
+ }>;
17
+ }[];
@@ -0,0 +1,20 @@
1
+ import type { Settings } from "@opengeni/config";
2
+ import { type SkillActor } from "@opengeni/contracts";
3
+ import { type Database } from "@opengeni/db";
4
+ import type { RuntimeSkillArtifact } from "@opengeni/runtime";
5
+ import type { SandboxChannelAService } from "@opengeni/runtime/sandbox";
6
+ export declare function createWorkspaceSkillTools(input: {
7
+ db: Database;
8
+ settings: Settings;
9
+ accountId: string;
10
+ workspaceId: string;
11
+ subjectId?: string;
12
+ actor: Extract<SkillActor, {
13
+ kind: "agent";
14
+ }>;
15
+ selected: readonly {
16
+ id: string;
17
+ artifact: RuntimeSkillArtifact;
18
+ }[];
19
+ filesystem: () => Promise<Pick<SandboxChannelAService, "fsList" | "fsRead" | "fsWrite" | "fsMkdir">>;
20
+ }): import("@opengeni/codemode").AttemptToolDefinition[];
@@ -0,0 +1,26 @@
1
+ import type { SandboxChannelAService } from "@opengeni/runtime/sandbox";
2
+ import { type SkillTextFile } from "@opengeni/runtime/skill-library";
3
+ type SkillFileSystem = Pick<SandboxChannelAService, "fsList" | "fsRead" | "fsWrite" | "fsMkdir">;
4
+ /** Reuse the host's cancellation and workspace-mutation authority for each filesystem operation. */
5
+ export declare function guardSkillFilesystem(fs: SkillFileSystem, authority: {
6
+ assertActive: () => void;
7
+ runMutation: <T>(operation: () => Promise<T>) => Promise<T>;
8
+ }): SkillFileSystem;
9
+ /** Caller supplies an authorized live filesystem and a fresh workspace-relative target. */
10
+ export declare function checkoutSkillDirectory(fs: SkillFileSystem, directory: string, files: readonly SkillTextFile[]): Promise<{
11
+ directory: string;
12
+ fileCount: number;
13
+ }>;
14
+ /**
15
+ * Read a folder through existing structured filesystem services, never via model
16
+ * arguments. The caller owns workspace confinement and the final governed save.
17
+ * This operation does not execute scripts or activate the resulting artifact.
18
+ */
19
+ export declare function readSkillDirectory(fs: SkillFileSystem, directory: string): Promise<Readonly<{
20
+ name: string;
21
+ description: string;
22
+ files: readonly import("@opengeni/runtime").SkillLibraryFile[];
23
+ contentSha256: string;
24
+ totalBytes: number;
25
+ }>>;
26
+ export {};
@@ -9,6 +9,7 @@ import type { GovernanceModelOk } from "./governance-model.js";
9
9
  import type { SandboxTurnRuntime } from "./sandbox-runtime.js";
10
10
  import type { sandboxArtifactRuntimeAdmission } from "./sandbox-route.js";
11
11
  import type { AttemptIdentityState, EventingState, SandboxRuntimeState, WorkspaceRefState } from "./turn-context.js";
12
+ import type { RuntimeSkillActivation } from "@opengeni/runtime";
12
13
  export type PrepareTurnToolPolicyDeps = {
13
14
  input: RunAgentTurnInput;
14
15
  db: ActivityServices["db"];
@@ -23,6 +24,7 @@ export type PrepareTurnToolPolicyDeps = {
23
24
  workspaceRefs: WorkspaceRefState;
24
25
  };
25
26
  export type PrepareTurnToolRuntimeDeps = {
27
+ selectedSkillActivations: readonly RuntimeSkillActivation[];
26
28
  input: RunAgentTurnInput;
27
29
  catalogSourceSettings: Settings;
28
30
  db: ActivityServices["db"];
@@ -129,6 +131,11 @@ export declare function prepareTurnToolRuntime(deps: PrepareTurnToolRuntimeDeps)
129
131
  generateSessionTitleInParallel: boolean;
130
132
  postToolPreparationStartedAt: number;
131
133
  preparationIndependentToolNames: string[];
134
+ skillCatalog: {
135
+ id: string;
136
+ name: string;
137
+ description: string;
138
+ }[];
132
139
  }>;
133
140
  export type PrepareTurnToolPolicyOk = Awaited<ReturnType<typeof prepareTurnToolPolicy>>;
134
141
  export type PrepareTurnToolRuntimeOk = Awaited<ReturnType<typeof prepareTurnToolRuntime>>;
@@ -75,11 +75,21 @@ export declare function reconcileAutomaticSessionTitleFanout(svc: NotifyServices
75
75
  delivered: number;
76
76
  failed: number;
77
77
  }>;
78
- export declare function reconcilePendingSessionWorkflowWakes(svc: NotifyServices, limit?: number, overrides?: ReconcileSessionWorkflowWakeOverrides): Promise<{
78
+ export type WorkflowWakeReconciliationResult = {
79
79
  claimed: number;
80
+ /** Transport acceptance is not durable admission. */
81
+ signaled: number;
82
+ /** Revisions acknowledged by the durable admission guard. */
80
83
  delivered: number;
84
+ pendingAdmission: number;
85
+ /** Legacy/embedding signalers may not return an acknowledgment receipt. */
86
+ unconfirmed: number;
81
87
  failed: number;
82
- }>;
88
+ pendingAdmissionBlockers: Partial<Record<Extract<import("@opengeni/db").SessionWorkflowWakeDeliveryResult, {
89
+ action: "pending_admission";
90
+ }>["blocker"], number>>;
91
+ };
92
+ export declare function reconcilePendingSessionWorkflowWakes(svc: NotifyServices, limit?: number, overrides?: ReconcileSessionWorkflowWakeOverrides): Promise<WorkflowWakeReconciliationResult>;
83
93
  /**
84
94
  * The worker-specific lines for one child (what happened + its goal), WITHOUT
85
95
  * the trailing "what to do next" instruction. Kept separate so N child
@@ -47,6 +47,10 @@ export type HistoryPreparationPhaseMeasurement = {
47
47
  durationSeconds: number;
48
48
  };
49
49
  export declare const MAX_INLINE_MODEL_ATTACHMENT_BYTES: number;
50
+ export declare const MAX_RETAINED_MODEL_ATTACHMENT_BYTES: number;
51
+ export declare class RetainedAttachmentTransportLimitError extends Error {
52
+ constructor();
53
+ }
50
54
  export type ModelAttachmentContent = {
51
55
  kind: "image" | "file";
52
56
  fileId: string;
@@ -63,13 +67,15 @@ export type ModelAttachmentInputPolicy = {
63
67
  supportsImageInput: boolean;
64
68
  inputFileMediaTypes: readonly string[];
65
69
  };
66
- export declare function modelAttachmentContentForFiles(files: FileAsset[], readFileBytes: (file: FileAsset) => Promise<Uint8Array>): Promise<ModelAttachmentContent[]>;
70
+ export declare function modelAttachmentContentForFiles(files: FileAsset[], readFileBytes: (file: FileAsset) => Promise<Uint8Array>, options?: {
71
+ retainAll?: boolean;
72
+ }): Promise<ModelAttachmentContent[]>;
67
73
  /**
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.
74
+ * Build one turn-scoped durable-attachment projector. Resolve active refs under
75
+ * current file authority and memoize metadata/bytes for retries and compaction.
76
+ * A turn boundary never changes an authorized attachment's representation.
71
77
  */
72
- export declare function createModelHistoryAttachmentProjector(policy: ModelAttachmentInputPolicy, readFileBytes?: (file: FileAsset) => Promise<Uint8Array>): ModelHistoryAttachmentProjector;
78
+ export declare function createModelHistoryAttachmentProjector(policy: ModelAttachmentInputPolicy, readFileBytes?: (file: FileAsset) => Promise<Uint8Array>, loadAuthorizedFiles?: (fileIds: readonly string[]) => Promise<readonly FileAsset[]>): ModelHistoryAttachmentProjector;
73
79
  /** Add current trigger refs only when older/local history predates durable stamping. */
74
80
  export declare function withCurrentUserAttachmentRefs(historyItems: Array<Record<string, unknown>>, refs: FileResourceRef[]): Array<Record<string, unknown>>;
75
81
  export declare function turnInput(db: Database, runtime: OpenGeniRuntime, agent: any, trigger: Awaited<ReturnType<typeof getSessionEvent>>, options: TurnInputOptions): Promise<PreparedTurnInput>;
@@ -1,3 +1,4 @@
1
+ import type { ProviderCommandPersistence } from "@opengeni/runtime";
1
2
  import { type OpStatus } from "@opengeni/agent-proto";
2
3
  import { listLiveModalSandboxLeaseAttributions, readLease, type ReapDrainable, type RetainedProcessProviderProof, type SandboxRetainedProcess, type LeaseSnapshot } from "@opengeni/db";
3
4
  import { type ConnectedMachineBackgroundCommandClaim, type ConnectedMachineBackgroundCommandProof } from "@opengeni/db/session-background-commands";
@@ -92,9 +93,9 @@ export type RetainedProcessProbeResult = {
92
93
  providerBinding: ModalCheckpointProviderBinding;
93
94
  } | {
94
95
  status: "deferred";
95
- reason: "identity_mismatch" | "resume_state_missing" | "backend_unsupported" | "provider_running" | "provider_unknown" | "provider_timeout" | "provider_error" | "provider_binding_missing" | "provider_binding_mismatch";
96
+ reason: "identity_mismatch" | "resume_state_missing" | "backend_unsupported" | "provider_running" | "provider_unknown" | "provider_timeout" | "provider_error" | "provider_binding_missing" | "provider_binding_mismatch" | "process_observation_unavailable";
96
97
  };
97
- export type RetainedProcessProbeFn = (settings: ActivityServices["settings"], lease: LeaseSnapshot, process: SandboxRetainedProcess, mode?: "observe" | "cancel", captureOutput?: (result: unknown, chunkId: string) => Promise<void>) => Promise<RetainedProcessProbeResult>;
98
+ export type RetainedProcessProbeFn = (settings: ActivityServices["settings"], lease: LeaseSnapshot, process: SandboxRetainedProcess, mode?: "observe" | "cancel", captureOutput?: (result: unknown, chunkId: string, stream?: "stdout" | "stderr", streamFidelity?: "separate" | "merged") => Promise<void>, providerPersistence?: ProviderCommandPersistence) => Promise<RetainedProcessProbeResult>;
98
99
  export type HistoricalModalSandboxLifecycleProbeFn = typeof inspectModalSandboxLifecycle;
99
100
  export type DrainableProviderProbeFn = (settings: ActivityServices["settings"], lease: LeaseSnapshot) => Promise<"ready" | "missing">;
100
101
  export declare const RETAINED_PROCESS_RECONCILIATION_LIMIT = 20;
@@ -157,10 +158,10 @@ export declare function retainedProcessReconciliationDeferral(settings: Pick<Act
157
158
  quarantined: boolean;
158
159
  };
159
160
  export declare function captureRetainedProbeOutput(processId: string, result: unknown, capture: (result: unknown, chunkId: string) => Promise<void>): Promise<void>;
160
- export declare function probeRetainedProcessAtProvider(settings: ActivityServices["settings"], lease: LeaseSnapshot, process: SandboxRetainedProcess, mode?: "observe" | "cancel", captureOutput?: (result: unknown, chunkId: string) => Promise<void>): Promise<RetainedProcessProbeResult>;
161
+ export declare function probeRetainedProcessAtProvider(settings: ActivityServices["settings"], lease: LeaseSnapshot, process: SandboxRetainedProcess, mode?: "observe" | "cancel", captureOutput?: (result: unknown, chunkId: string, stream?: "stdout" | "stderr", streamFidelity?: "separate" | "merged") => Promise<void>, providerPersistence?: ProviderCommandPersistence): Promise<RetainedProcessProbeResult>;
161
162
  /** Classify only exact SDK control banners. Arbitrary output, malformed text,
162
163
  * and a running marker are observations to retry; none is physical exit proof. */
163
- export declare function classifyRetainedProcessPollResult(result: unknown, providerSessionId: number): RetainedProcessProbeResult;
164
+ export declare function classifyRetainedProcessPollResult(result: unknown, providerSessionId: number, source?: object): RetainedProcessProbeResult;
164
165
  export declare function modalOrphanTerminationStillEligible(latest: Awaited<ReturnType<typeof listLiveModalSandboxLeaseAttributions>>, candidate: ModalOrphanSweepTermination): boolean;
165
166
  export type SandboxDrainReason = "idle" | "provider_deadline" | "operator" | "teardown_claim" | "rotation_requested";
166
167
  /** The bounded drain reason carried on `sandbox.box.terminated`: the lease's
@@ -1,6 +1,6 @@
1
1
  import type { Settings } from "@opengeni/config";
2
2
  import type { ConnectionCredentialsPort, DocumentAuthorityKind, EntitlementsPort, ScheduledTaskTriggerType, TurnInitiator } from "@opengeni/contracts";
3
- import type { Database } from "@opengeni/db";
3
+ import type { Database, SessionWorkflowWakeDeliveryResult } from "@opengeni/db";
4
4
  import type { DocumentServices } from "@opengeni/documents";
5
5
  import type { EventBus } from "@opengeni/events";
6
6
  import type { Observability } from "@opengeni/observability";
@@ -13,7 +13,9 @@ export type WakeSessionWorkflowSignal = (input: {
13
13
  workflowId: string;
14
14
  wakeRevision: number;
15
15
  interruptionRequested?: boolean;
16
- }) => Promise<void>;
16
+ /** Called after transport acceptance, before the fallible durable ACK. */
17
+ onSignalAccepted?: () => void;
18
+ }) => Promise<SessionWorkflowWakeDeliveryResult | void>;
17
19
  export type SignalCodexCapacityWorkflow = (input: {
18
20
  accountId: string;
19
21
  workspaceId: string;
@@ -1,8 +1,6 @@
1
1
  import type { ControlActivityServices } from "./types.js";
2
- export type DispatchSessionWorkflowWakesResult = {
3
- claimed: number;
4
- delivered: number;
5
- failed: number;
2
+ import { type WorkflowWakeReconciliationResult } from "./parent-wake.js";
3
+ export type DispatchSessionWorkflowWakesResult = WorkflowWakeReconciliationResult & {
6
4
  exhaustedBatchLimit: boolean;
7
5
  };
8
6
  /**