@opengeni/core 0.4.5 → 0.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  import { Settings } from '@opengeni/config';
2
- import { ScheduledTask, Document, Permission, AccessContext, AccessGrant, LimitAction, LimitDecision, CapabilityCatalogItem, CapabilityInstallation, CapabilityCatalogResponse, CreateCapabilityCatalogItemRequest, EnableCapabilityRequest, WorkspaceEnvironment, CapabilityPack, SocialConnection, ScheduledTaskAgentConfig, ToolRef, ResourceRef, CreateScheduledTaskRequest, UpdateScheduledTaskRequest, ReasoningEffort, SessionMcpCredentialUpdateInput, SessionEvent, SessionTurn, GoalSpec, SessionMcpServerMetadata, Session, WorkspaceMember } from '@opengeni/contracts';
2
+ import { ScheduledTask, Document, Permission, AccessContext, AccessGrant, LimitAction, LimitDecision, CapabilityCatalogItem, CapabilityInstallation, CapabilityCatalogResponse, CreateCapabilityCatalogItemRequest, EnableCapabilityRequest, VariableSet, Rig, RigVersion, CreateRigRequest, RigDefinitionEditPayload, RigChange, ProposeRigChangeRequest, UpdateRigRequest, CapabilityPack, SocialConnection, ScheduledTaskAgentConfig, ToolRef, ResourceRef, CreateScheduledTaskRequest, UpdateScheduledTaskRequest, ReasoningEffort, SessionMcpCredentialUpdateInput, SessionEvent, SessionTurn, GoalSpec, SessionMcpServerMetadata, Session, WorkspaceMember } from '@opengeni/contracts';
3
3
  export { mergeToolRefs, stableJson } from '@opengeni/contracts';
4
+ import * as _opengeni_db from '@opengeni/db';
4
5
  import { Database, SandboxRecord, EnabledMcpCapabilityServer, UpdateScheduledTaskInput, CreateSessionMcpServerInput, UpdateSessionMcpServerCredentialsInput } from '@opengeni/db';
5
6
  import { DocumentServices } from '@opengeni/documents';
6
7
  import { EventBus } from '@opengeni/events';
7
8
  import { Observability } from '@opengeni/observability';
8
9
  import { createObjectStorage } from '@opengeni/storage';
9
10
  import { Auth } from 'better-auth';
10
- import { SelfhostedRelayConfig, EstablishedSandboxSession } from '@opengeni/runtime/sandbox';
11
+ import { BackendUnresolvableCode, SelfhostedRelayConfig, EstablishedSandboxSession } from '@opengeni/runtime/sandbox';
11
12
  import { Context } from 'hono';
12
13
 
13
14
  type ManagedAuth = Auth<any>;
@@ -37,9 +38,9 @@ type ApiSandboxSession = {
37
38
  };
38
39
  type ApiSandboxClient = {
39
40
  backendId: string;
40
- deserializeSessionState?(state: Record<string, unknown>): Promise<unknown>;
41
- resume?(state: unknown, options?: unknown): Promise<ApiSandboxSession>;
42
- delete?(state: unknown): Promise<void>;
41
+ deserializeSessionState?(state: Record<string, unknown>): Promise<Record<string, unknown>>;
42
+ resume?(state: Record<string, unknown>, options?: unknown): Promise<ApiSandboxSession>;
43
+ delete?(state: Record<string, unknown>): Promise<void>;
43
44
  };
44
45
  type ResumeBoxByIdInput = {
45
46
  /**
@@ -76,18 +77,32 @@ type SessionWorkflowClient = {
76
77
  workspaceId: string;
77
78
  sessionId: string;
78
79
  workflowId: string;
80
+ wakeRevision: number;
81
+ controlEventId?: string;
82
+ }) => Promise<void>;
83
+ signalCodexCapacity?: (input: {
84
+ accountId: string;
85
+ workspaceId: string;
86
+ sessionId: string;
87
+ workflowId: string;
88
+ wakeRevision: number;
89
+ workflowWakeRevision: number;
79
90
  }) => Promise<void>;
80
91
  signalApprovalDecision: (input: {
92
+ accountId: string;
93
+ workspaceId: string;
81
94
  sessionId: string;
82
95
  eventId: string;
83
96
  workflowId: string;
97
+ workflowWakeRevision: number;
84
98
  }) => Promise<void>;
85
- signalInterrupt: (input: {
99
+ signalSessionControl: (input: {
86
100
  accountId: string;
87
101
  workspaceId: string;
88
102
  sessionId: string;
89
103
  eventId: string;
90
104
  workflowId: string;
105
+ workflowWakeRevision: number;
91
106
  }) => Promise<void>;
92
107
  syncScheduledTask: (input: {
93
108
  task: ScheduledTask;
@@ -100,6 +115,12 @@ type SessionWorkflowClient = {
100
115
  agentRunUsageIdempotencyKey?: string;
101
116
  triggerWorkflowId?: string;
102
117
  }) => Promise<void>;
118
+ startRigVerification: (input: {
119
+ workspaceId: string;
120
+ changeId?: string;
121
+ versionId?: string;
122
+ workflowId?: string;
123
+ }) => Promise<void>;
103
124
  check?: () => Promise<void>;
104
125
  };
105
126
  type DocumentIndexClient = {
@@ -114,6 +135,8 @@ type AppDependencies = {
114
135
  db: Database;
115
136
  bus: EventBus;
116
137
  workflowClient: SessionWorkflowClient;
138
+ /** Optional provider override for deterministic API/object-storage tests. */
139
+ objectStorage?: ObjectStorageDependency;
117
140
  documentIndexer?: DocumentIndexClient;
118
141
  documentServices?: DocumentServices;
119
142
  observability?: Observability;
@@ -138,6 +161,17 @@ type ApiRouteDeps = AppDependencies & {
138
161
  getDocumentServices: () => DocumentServices;
139
162
  resumeBoxById: (input: ResumeBoxByIdInput) => Promise<ResumedSandboxSession>;
140
163
  };
164
+ /**
165
+ * The exact dependency slice used by `acceptSessionUserMessage`.
166
+ *
167
+ * Keeping this narrower than `ApiRouteDeps` lets control-plane callers reuse
168
+ * the canonical admission path without constructing unrelated HTTP, document,
169
+ * or sandbox services. The public API still passes its `ApiRouteDeps` superset.
170
+ */
171
+ type AcceptSessionUserMessageDependencies = Pick<AppDependencies, "settings" | "db" | "bus"> & {
172
+ workflowClient: Pick<SessionWorkflowClient, "wakeSessionWorkflow" | "signalSessionControl">;
173
+ objectStorage: ObjectStorageDependency;
174
+ };
141
175
 
142
176
  type FleetServices = {
143
177
  db: Database;
@@ -206,12 +240,14 @@ type FleetListResult = {
206
240
  activeEpoch: number;
207
241
  sandboxes: FleetSandboxEntry[];
208
242
  };
209
- /** A swap/attach outcome the tool returns. */
243
+ /** A swap/attach outcome the tool returns. On a rejection, `code` carries the
244
+ * typed reason (issue #341 typed diagnostics) alongside the human `reason`. */
210
245
  type FleetSwapResult = {
211
246
  swapped: boolean;
212
247
  activeSandboxId: string | null;
213
248
  activeEpoch: number;
214
249
  reason?: string;
250
+ code?: BackendUnresolvableCode | "concurrent_swap";
215
251
  };
216
252
  /**
217
253
  * List the fleet: the session's own Modal group box (a synthetic entry) + the
@@ -332,6 +368,7 @@ declare function requireAccessGrant(c: Context, deps: AccessDeps, workspaceId: s
332
368
  declare function requirePermission(grant: AccessGrant, permission: Permission): void;
333
369
  declare function hasPermission(permissions: Permission[], permission: Permission): boolean;
334
370
 
371
+ type LimitDependencies = Pick<ApiRouteDeps, "db" | "settings">;
335
372
  type LimitCheckInput = {
336
373
  accountId: string;
337
374
  workspaceId?: string;
@@ -339,9 +376,9 @@ type LimitCheckInput = {
339
376
  quantity?: number;
340
377
  model?: string | null;
341
378
  };
342
- declare function requireLimit(deps: ApiRouteDeps, input: LimitCheckInput): Promise<void>;
343
- declare function checkLimit(deps: ApiRouteDeps, input: LimitCheckInput): Promise<LimitDecision>;
344
- declare function recordWorkspaceUsage(deps: ApiRouteDeps, input: {
379
+ declare function requireLimit(deps: LimitDependencies, input: LimitCheckInput): Promise<void>;
380
+ declare function checkLimit(deps: LimitDependencies, input: LimitCheckInput): Promise<LimitDecision>;
381
+ declare function recordWorkspaceUsage(deps: LimitDependencies, input: {
345
382
  accountId: string;
346
383
  workspaceId: string;
347
384
  subjectId?: string | null;
@@ -408,31 +445,90 @@ declare function applyCapabilityEnablement(item: CapabilityCatalogItem, installa
408
445
 
409
446
  declare const MAX_ENVIRONMENTS_PER_WORKSPACE = 25;
410
447
  declare const MAX_VARIABLES_PER_ENVIRONMENT = 100;
411
- declare function assertAllowedEnvironmentVariableName(name: string): void;
412
- declare function requireEnvironmentEncryption(settings: Settings): Uint8Array;
413
- declare function requireEnvironmentForApi(db: Database, workspaceId: string, environmentId: string): Promise<WorkspaceEnvironment>;
448
+ declare function assertAllowedVariableSetVariableName(name: string): void;
449
+ /** @deprecated use assertAllowedVariableSetVariableName */
450
+ declare const assertAllowedEnvironmentVariableName: typeof assertAllowedVariableSetVariableName;
451
+ declare function requireVariableSetEncryption(settings: Settings): Uint8Array;
452
+ /** @deprecated use requireVariableSetEncryption */
453
+ declare const requireEnvironmentEncryption: typeof requireVariableSetEncryption;
454
+ declare function requireVariableSetForApi(db: Database, workspaceId: string, variableSetId: string): Promise<VariableSet>;
414
455
  /**
415
- * Validates an environment attachment supplied in a request payload (session
456
+ * Validates an variableSet attachment supplied in a request payload (session
416
457
  * create, scheduled task create/update, pack enable). Requires the
417
- * `environments:use` permission unless the attachment was already authorized
458
+ * `variable-sets:use` permission unless the attachment was already authorized
418
459
  * (pack-installation-inherited attachments), and maps a missing or
419
- * cross-workspace environment to 422 because the id is payload, not the route
460
+ * cross-variable set to 422 because the id is payload, not the route
420
461
  * target. RLS plus the workspace_id clause make cross-workspace ids
421
462
  * indistinguishable from missing ones.
422
463
  */
423
- declare function validateEnvironmentAttachment(deps: {
464
+ declare function validateVariableSetAttachment(deps: {
424
465
  settings: Settings;
425
466
  db: Database;
426
- }, grant: AccessGrant, workspaceId: string, environmentId: string, options?: {
467
+ }, grant: AccessGrant, workspaceId: string, variableSetId: string, options?: {
427
468
  preauthorized?: boolean;
428
- }): Promise<WorkspaceEnvironment>;
429
- declare function recordEnvironmentAuditEvent(db: Database, input: {
469
+ }): Promise<VariableSet>;
470
+ declare function recordVariableSetAuditEvent(db: Database, input: {
430
471
  grant: AccessGrant;
431
- action: "environment.created" | "environment.updated" | "environment.deleted" | "environment.variable.set" | "environment.variable.deleted";
432
- environmentId: string;
472
+ action: "variable_set.created" | "variable_set.updated" | "variable_set.deleted" | "variable_set.variable.set" | "variable_set.variable.deleted";
473
+ variableSetId: string;
433
474
  variableName?: string;
434
475
  }): Promise<void>;
435
476
 
477
+ declare const MAX_RIGS_PER_WORKSPACE = 50;
478
+ declare const MAX_CHECKS_PER_RIG = 100;
479
+ declare const MAX_CREDENTIAL_HOOKS_PER_RIG = 50;
480
+ declare const MAX_DEFAULT_VARIABLE_SETS_PER_RIG = 25;
481
+ type RigServices = {
482
+ db: Database;
483
+ };
484
+ type RigAuditAction = "rig.created" | "rig.updated" | "rig.deleted" | "rig.change.proposed" | "rig.change.verified" | "rig.change.rejected" | "rig.change.failed" | "rig.change.merged" | "rig.verification.started" | "rig.verification.passed" | "rig.verification.failed" | "rig.version.activated" | "rig.version.promoted";
485
+ declare function recordRigAuditEvent(db: Database, input: {
486
+ grant: AccessGrant;
487
+ action: RigAuditAction;
488
+ rigId: string;
489
+ metadata?: Record<string, unknown>;
490
+ }): Promise<void>;
491
+ declare function rigActorForGrant(grant: AccessGrant): string;
492
+ declare function requireRigForApi(db: Database, workspaceId: string, rigId: string): Promise<Rig>;
493
+ declare function requireRigChangeForApi(db: Database, workspaceId: string, rigId: string, changeId: string): Promise<RigChange>;
494
+ declare function createRigForApi(deps: RigServices, grant: AccessGrant, payload: CreateRigRequest): Promise<Rig>;
495
+ declare function updateRigForApi(deps: RigServices, grant: AccessGrant, rig: Rig, payload: UpdateRigRequest): Promise<Rig>;
496
+ declare function deleteRigForApi(deps: RigServices, grant: AccessGrant, rig: Rig): Promise<void>;
497
+ declare function proposeRigChangeForApi(deps: RigServices, grant: AccessGrant, rig: Rig, request: ProposeRigChangeRequest, options?: {
498
+ proposedBy?: string;
499
+ }): Promise<RigChange>;
500
+ type RigVerificationClassification = {
501
+ status: "merged";
502
+ action: "auto_promote";
503
+ } | {
504
+ status: "proposed";
505
+ action: "await_manage_promote";
506
+ } | {
507
+ status: "rejected";
508
+ action: "reject";
509
+ } | {
510
+ status: "failed";
511
+ action: "retryable_failure";
512
+ };
513
+ declare function classifyRigVerificationOutcome(input: {
514
+ kind: "setup_append" | "definition_edit";
515
+ passed: boolean;
516
+ infraError?: boolean;
517
+ }): RigVerificationClassification;
518
+ declare function appendRigSetupCommand(baseSetupScript: string | null | undefined, command: string): string;
519
+ declare function promoteSetupAppendChange(deps: RigServices, grant: AccessGrant, rig: Rig, change: RigChange): Promise<{
520
+ change: RigChange;
521
+ version: RigVersion;
522
+ }>;
523
+ declare function promoteVerifiedDefinitionEditChangeForApi(deps: RigServices, grant: AccessGrant, rig: Rig, change: RigChange): Promise<{
524
+ change: RigChange;
525
+ version: RigVersion;
526
+ }>;
527
+ declare function createRigVersionForApi(deps: RigServices, grant: AccessGrant, rig: Rig, payload: RigDefinitionEditPayload): Promise<RigVersion>;
528
+ declare function activateRigVersionForApi(deps: RigServices, grant: AccessGrant, rig: Rig, versionId: string): Promise<RigVersion>;
529
+ declare function listRigVersionsForApi(deps: RigServices, workspaceId: string, rigId: string): Promise<RigVersion[]>;
530
+ declare function listRigChangesForApi(deps: RigServices, workspaceId: string, rigId: string, limit?: number): Promise<RigChange[]>;
531
+
436
532
  declare const MARKETING_SOCIAL_PACK_ID = "marketing-social-daily-analysis";
437
533
  declare function listCapabilityPacks(): CapabilityPack[];
438
534
  declare function getCapabilityPack(packId: string): CapabilityPack | null;
@@ -485,7 +581,7 @@ declare function createValidatedScheduledTask(input: {
485
581
  grant: AccessGrant;
486
582
  payload: CreateScheduledTaskRequest;
487
583
  toolsProvided?: boolean;
488
- environmentPreauthorized?: boolean;
584
+ variableSetPreauthorized?: boolean;
489
585
  }): Promise<ScheduledTask>;
490
586
  declare function validatedScheduledTaskUpdate(input: {
491
587
  settings: Settings;
@@ -552,10 +648,12 @@ declare function createAndStartSession(input: {
552
648
  reasoningEffort: Settings["openaiReasoningEffort"];
553
649
  sandboxBackend: Settings["sandboxBackend"];
554
650
  metadata: Record<string, unknown>;
555
- environment?: {
651
+ variableSet?: {
556
652
  id: string;
557
653
  name: string;
558
654
  } | null;
655
+ rigId?: string | null;
656
+ rigVersionId?: string | null;
559
657
  goal?: GoalSpec | null;
560
658
  instructions?: string | null;
561
659
  firstPartyMcpPermissions?: Permission[] | null;
@@ -574,7 +672,7 @@ declare function createAndStartSession(input: {
574
672
  id: string;
575
673
  workspaceId: string;
576
674
  accountId: string;
577
- status: "queued" | "running" | "idle" | "requires_action" | "failed" | "cancelled";
675
+ status: "queued" | "running" | "idle" | "requires_action" | "recovering" | "waiting_capacity" | "paused" | "failed" | "cancelled";
578
676
  initialMessage: string;
579
677
  title: string | null;
580
678
  titleSource: "user" | "agent" | null;
@@ -585,6 +683,11 @@ declare function createAndStartSession(input: {
585
683
  ref: string;
586
684
  mountPath?: string | undefined;
587
685
  subpath?: string | undefined;
686
+ provider?: "github" | "gitlab" | "azure_devops" | undefined;
687
+ repositoryId?: string | number | undefined;
688
+ installationId?: string | number | undefined;
689
+ projectId?: string | number | undefined;
690
+ connectionId?: string | undefined;
588
691
  githubInstallationId?: number | undefined;
589
692
  githubRepositoryId?: number | undefined;
590
693
  } | {
@@ -604,8 +707,11 @@ declare function createAndStartSession(input: {
604
707
  sandboxGroupId: string;
605
708
  activeSandboxId: string | null;
606
709
  activeEpoch: number;
710
+ variableSetId: string | null;
607
711
  environmentId: string | null;
608
- firstPartyMcpPermissions: ("account:read" | "account:admin" | "members:manage" | "workspace:create" | "billing:read" | "billing:manage" | "workspace:read" | "workspace:admin" | "sessions:create" | "sessions:read" | "sessions:control" | "stream:view" | "stream:control" | "stream:acknowledge" | "files:upload" | "files:read" | "files:write" | "terminal:attach" | "documents:manage" | "documents:search" | "scheduled_tasks:manage" | "scheduled_tasks:run" | "github:manage" | "github:use" | "api_keys:manage" | "connections:read" | "connections:write" | "environments:manage" | "environments:use" | "mcp_servers:attach" | "toolspace:call" | "goals:manage" | "enrollments:read" | "enrollments:manage")[] | null;
712
+ rigId: string | null;
713
+ rigVersionId: string | null;
714
+ firstPartyMcpPermissions: ("account:read" | "account:admin" | "members:manage" | "workspace:create" | "billing:read" | "billing:manage" | "workspace:read" | "workspace:admin" | "sessions:create" | "sessions:read" | "sessions:control" | "stream:view" | "stream:control" | "stream:acknowledge" | "files:upload" | "files:read" | "files:write" | "terminal:attach" | "documents:manage" | "documents:search" | "scheduled_tasks:manage" | "scheduled_tasks:run" | "github:manage" | "github:use" | "api_keys:manage" | "connections:read" | "connections:write" | "environments:manage" | "environments:use" | "variable-sets:manage" | "variable-sets:use" | "mcp_servers:attach" | "toolspace:call" | "goals:manage" | "enrollments:read" | "enrollments:manage" | "rigs:use" | "rigs:manage")[] | null;
609
715
  mcpServers: {
610
716
  id: string;
611
717
  name: string | null;
@@ -618,11 +724,32 @@ declare function createAndStartSession(input: {
618
724
  temporalWorkflowId: string | null;
619
725
  activeTurnId: string | null;
620
726
  lastInputTokens: number | null;
727
+ queueVersion: number;
728
+ queueHeadPosition: number;
729
+ queueTailPosition: number;
730
+ controlState: "paused" | "active";
731
+ controlGeneration: number;
732
+ controlReason: string | null;
733
+ controlChangedBy: string | null;
734
+ controlChangedAt: string | null;
735
+ workspaceRunExceptionGeneration: number | null;
621
736
  lastSequence: number;
622
737
  codexPinnedCredentialId: string | null;
623
738
  codexLastCredentialId: string | null;
739
+ pinned: boolean;
740
+ pinnedAt: string | null;
741
+ pinVersion: number;
624
742
  createdAt: string;
625
743
  updatedAt: string;
744
+ treeStats?: {
745
+ directChildren: number;
746
+ totalDescendants: number;
747
+ runningDescendants: number;
748
+ queuedDescendants: number;
749
+ attentionDescendants: number;
750
+ pausedDescendants: number;
751
+ failedDescendants: number;
752
+ } | undefined;
626
753
  }>;
627
754
  declare function workflowIdForSession(sessionId: string): string;
628
755
  /**
@@ -642,6 +769,18 @@ declare function workflowIdForSession(sessionId: string): string;
642
769
  * drift.
643
770
  */
644
771
  declare function assertConfiguredModel(settings: Settings, model: string | null | undefined): void;
772
+ /**
773
+ * Reject a model the WORKSPACE's model policy blocks, at the same choke points
774
+ * as assertConfiguredModel — a 422 at the edge instead of a queued turn the
775
+ * worker's authoritative post-resolution gate would fail. `model` is the
776
+ * EFFECTIVE value the caller is about to persist: pass the explicit value at
777
+ * message/turn-update/scheduled-task edges (omitted inherits an
778
+ * already-validated stored default), but at session CREATION pass
779
+ * `payload.model ?? settings.openaiModel` — an omitted model stamps the
780
+ * deployment default onto the session, and under a restricted policy that
781
+ * default may be exactly the provider the policy exists to block.
782
+ */
783
+ declare function assertWorkspaceModelPolicyAllows(db: Database, settings: Settings, workspaceId: string, model: string | null | undefined): Promise<void>;
645
784
  declare function requireQueuedTurnForApi(db: Database, workspaceId: string, sessionId: string, turnId: string): Promise<SessionTurn>;
646
785
  declare function reasoningEffortForSession(metadata: Record<string, unknown>, fallback: Settings["openaiReasoningEffort"]): Settings["openaiReasoningEffort"];
647
786
  /**
@@ -654,7 +793,7 @@ declare function reasoningEffortForSession(metadata: Record<string, unknown>, fa
654
793
  declare function postUserMessageTurn(input: {
655
794
  db: Database;
656
795
  bus: EventBus;
657
- workflowClient: SessionWorkflowClient;
796
+ workflowClient: Pick<SessionWorkflowClient, "wakeSessionWorkflow" | "signalSessionControl">;
658
797
  settings: Settings;
659
798
  accountId: string;
660
799
  workspaceId: string;
@@ -666,13 +805,18 @@ declare function postUserMessageTurn(input: {
666
805
  reasoningEffort?: Settings["openaiReasoningEffort"] | null;
667
806
  clientEventId?: string;
668
807
  mcpCredentialUpdates?: UpdateSessionMcpServerCredentialsInput[];
808
+ delivery?: "queue" | "steer";
809
+ origin?: "human" | "operator";
810
+ actor?: string;
811
+ expectedControlGeneration?: number;
812
+ expectedWorkspaceInferenceGeneration?: number;
669
813
  }): Promise<{
670
814
  accepted: SessionEvent;
671
815
  turn: SessionTurn;
672
816
  }>;
673
817
  /**
674
818
  * Full create-session flow shared by `POST /sessions` and the first-party MCP
675
- * `session_create` tool: payload validation, resource/tool/environment
819
+ * `session_create` tool: payload validation, resource/tool/variableSet
676
820
  * checks, usage limits, session start, and usage recording. `rawPayload` is
677
821
  * the unparsed request body so absent-vs-empty `tools` keeps its meaning
678
822
  * (absent applies the workspace's default capability MCP tools).
@@ -685,7 +829,7 @@ declare function createSessionForRequest(deps: ApiRouteDeps, grant: AccessGrant,
685
829
  * enqueue, and usage recording. `toolsProvided: false` applies the
686
830
  * workspace's default capability MCP tools, matching an absent `tools` key.
687
831
  */
688
- declare function acceptSessionUserMessage(deps: ApiRouteDeps, grant: AccessGrant, workspaceId: string, sessionId: string, input: {
832
+ declare function acceptSessionUserMessage(deps: AcceptSessionUserMessageDependencies, grant: AccessGrant, workspaceId: string, sessionId: string, input: {
689
833
  text: string;
690
834
  resources?: ResourceRef[];
691
835
  tools?: ToolRef[];
@@ -694,6 +838,10 @@ declare function acceptSessionUserMessage(deps: ApiRouteDeps, grant: AccessGrant
694
838
  reasoningEffort?: ReasoningEffort | null;
695
839
  clientEventId?: string;
696
840
  mcpCredentialUpdates?: SessionMcpCredentialUpdateInput[];
841
+ delivery?: "queue" | "steer";
842
+ origin?: "human" | "operator";
843
+ expectedControlGeneration?: number;
844
+ expectedWorkspaceInferenceGeneration?: number;
697
845
  }): Promise<{
698
846
  accepted: SessionEvent;
699
847
  turn: SessionTurn;
@@ -714,6 +862,7 @@ declare function updateSessionTitle(deps: {
714
862
  updated: boolean;
715
863
  title: string | null;
716
864
  }>;
865
+ declare function readSessionLineage(db: Database, workspaceId: string, sessionId: string): Promise<_opengeni_db.SessionLineage>;
717
866
 
718
867
  /** A member can manage other members (directly or via the admin wildcard). */
719
868
  declare function memberCanAdminister(member: Pick<WorkspaceMember, "permissions">): boolean;
@@ -749,4 +898,4 @@ declare function assertWorkspaceDeletable(input: {
749
898
  activeSessionCount: number;
750
899
  }): void;
751
900
 
752
- export { type AccessDeps, type ApiRouteDeps, type ApiSandboxClient, type ApiSandboxSession, type AppDependencies, type ChannelARoutingServices, type DocumentIndexClient, type FleetContext, type FleetListResult, type FleetLiveness, type FleetSandboxEntry, type FleetServices, type FleetSwapResult, type LimitCheckInput, MARKETING_SOCIAL_PACK_ID, MAX_ENVIRONMENTS_PER_WORKSPACE, MAX_VARIABLES_PER_ENVIRONMENT, type ManagedAuth, type McpCapabilityProbe, type McpCapabilityProbeInput, type McpCapabilityProbeResult, type ObjectStorageDependency, type ProvisionResult, type ResumeBoxByIdInput, type ResumedSandboxSession, type RunOnOp, type RunOnResult, type SessionWorkflowClient, acceptSessionUserMessage, applyCapabilityEnablement, assertAllowedEnvironmentVariableName, assertConfiguredModel, assertPackSandboxImageCompatible, assertWorkspaceDeletable, assertWorkspaceMemberRemovable, buildCapabilityCatalog, buildFleetContextForSession, buildMarketingDailyAnalysisAgentConfig, checkLimit, createAndStartSession, createCatalogItem, createSessionForRequest, createValidatedScheduledTask, disableCapability, discoverMcpRegistryCapabilities, enableCapability, enabledCapabilityMcpToolRefs, getCapabilityPack, hasPermission, isBuiltInCapabilityPack, isUserMember, listCapabilityPacks, listFleet, listWorkspaceCapabilityPacks, manualScheduledTaskTriggerUsageKey, manualScheduledTaskTriggerWorkflowId, memberCanAdminister, mergeResourceRefs, normalizeResources, officialMcpRegistryUrl, postUserMessageTurn, provisionSandbox, reasoningEffortForSession, recordEnvironmentAuditEvent, recordWorkspaceUsage, relayConfigFromSettings, relayDialBaseFromSettings, requireAccessContext, requireAccessGrant, requireEnvironmentEncryption, requireEnvironmentForApi, requireLimit, requirePermission, requireQueuedTurnForApi, requireScheduledTaskForApi, resolveCapabilityPack, resolveMemberSubjectId, restoreScheduledTask, routingEnabled, runOnSandbox, scheduledTaskTemporalScheduleId, scheduledTaskToolsProvided, scheduledTaskTriggerToken, settingsWithEnabledCapabilityMcpServers, settingsWithMcpCapabilityServers, settingsWithSessionMcpServerMetadata, swapActiveSandbox, syncCreatedScheduledTask, syncUpdatedScheduledTask, updateSessionTitle, validateEnvironmentAttachment, validateFileResources, validateGitHubRepositorySelection, validateGitHubRepositorySelectionShape, validateMcpCapabilityConnection, validateToolRefs, validatedScheduledTaskUpdate, withDefaultEnabledCapabilityMcpTools, workflowIdForSession, wrapChannelABoxWithRouting };
901
+ export { type AcceptSessionUserMessageDependencies, type AccessDeps, type ApiRouteDeps, type ApiSandboxClient, type ApiSandboxSession, type AppDependencies, type ChannelARoutingServices, type DocumentIndexClient, type FleetContext, type FleetListResult, type FleetLiveness, type FleetSandboxEntry, type FleetServices, type FleetSwapResult, type LimitCheckInput, type LimitDependencies, MARKETING_SOCIAL_PACK_ID, MAX_CHECKS_PER_RIG, MAX_CREDENTIAL_HOOKS_PER_RIG, MAX_DEFAULT_VARIABLE_SETS_PER_RIG, MAX_ENVIRONMENTS_PER_WORKSPACE, MAX_RIGS_PER_WORKSPACE, MAX_VARIABLES_PER_ENVIRONMENT, type ManagedAuth, type McpCapabilityProbe, type McpCapabilityProbeInput, type McpCapabilityProbeResult, type ObjectStorageDependency, type ProvisionResult, type ResumeBoxByIdInput, type ResumedSandboxSession, type RigServices, type RigVerificationClassification, type RunOnOp, type RunOnResult, type SessionWorkflowClient, acceptSessionUserMessage, activateRigVersionForApi, appendRigSetupCommand, applyCapabilityEnablement, assertAllowedEnvironmentVariableName, assertAllowedVariableSetVariableName, assertConfiguredModel, assertPackSandboxImageCompatible, assertWorkspaceDeletable, assertWorkspaceMemberRemovable, assertWorkspaceModelPolicyAllows, buildCapabilityCatalog, buildFleetContextForSession, buildMarketingDailyAnalysisAgentConfig, checkLimit, classifyRigVerificationOutcome, createAndStartSession, createCatalogItem, createRigForApi, createRigVersionForApi, createSessionForRequest, createValidatedScheduledTask, deleteRigForApi, disableCapability, discoverMcpRegistryCapabilities, enableCapability, enabledCapabilityMcpToolRefs, getCapabilityPack, hasPermission, isBuiltInCapabilityPack, isUserMember, listCapabilityPacks, listFleet, listRigChangesForApi, listRigVersionsForApi, listWorkspaceCapabilityPacks, manualScheduledTaskTriggerUsageKey, manualScheduledTaskTriggerWorkflowId, memberCanAdminister, mergeResourceRefs, normalizeResources, officialMcpRegistryUrl, postUserMessageTurn, promoteSetupAppendChange, promoteVerifiedDefinitionEditChangeForApi, proposeRigChangeForApi, provisionSandbox, readSessionLineage, reasoningEffortForSession, recordRigAuditEvent, recordVariableSetAuditEvent, recordWorkspaceUsage, relayConfigFromSettings, relayDialBaseFromSettings, requireAccessContext, requireAccessGrant, requireEnvironmentEncryption, requireLimit, requirePermission, requireQueuedTurnForApi, requireRigChangeForApi, requireRigForApi, requireScheduledTaskForApi, requireVariableSetEncryption, requireVariableSetForApi, resolveCapabilityPack, resolveMemberSubjectId, restoreScheduledTask, rigActorForGrant, routingEnabled, runOnSandbox, scheduledTaskTemporalScheduleId, scheduledTaskToolsProvided, scheduledTaskTriggerToken, settingsWithEnabledCapabilityMcpServers, settingsWithMcpCapabilityServers, settingsWithSessionMcpServerMetadata, swapActiveSandbox, syncCreatedScheduledTask, syncUpdatedScheduledTask, updateRigForApi, updateSessionTitle, validateFileResources, validateGitHubRepositorySelection, validateGitHubRepositorySelectionShape, validateMcpCapabilityConnection, validateToolRefs, validateVariableSetAttachment, validatedScheduledTaskUpdate, withDefaultEnabledCapabilityMcpTools, workflowIdForSession, wrapChannelABoxWithRouting };