@opengeni/core 0.4.7 → 0.4.9

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,5 +1,5 @@
1
1
  import { Settings } from '@opengeni/config';
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';
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, SessionControlRequest, SessionControlResponse, WorkspaceInferenceControlRequest, WorkspaceInferenceControlResponse, DeleteSessionQueueItemRequest, SessionQueueMutationResponse, EditSessionQueueItemRequest, ComposerDraft, MoveSessionQueueItemRequest, SaveComposerDraftRequest, SteerSessionQueueItemRequest } from '@opengeni/contracts';
3
3
  export { mergeToolRefs, stableJson } from '@opengeni/contracts';
4
4
  import * as _opengeni_db from '@opengeni/db';
5
5
  import { Database, SandboxRecord, EnabledMcpCapabilityServer, UpdateScheduledTaskInput, CreateSessionMcpServerInput, UpdateSessionMcpServerCredentialsInput } from '@opengeni/db';
@@ -78,8 +78,10 @@ type SessionWorkflowClient = {
78
78
  sessionId: string;
79
79
  workflowId: string;
80
80
  wakeRevision: number;
81
- controlEventId?: string;
81
+ interruptionRequested?: boolean;
82
82
  }) => Promise<void>;
83
+ /** Trigger one bounded drain of already-committed workflow-wake revisions. */
84
+ requestSessionWorkflowWakeDispatch: () => Promise<void>;
83
85
  signalCodexCapacity?: (input: {
84
86
  accountId: string;
85
87
  workspaceId: string;
@@ -96,14 +98,6 @@ type SessionWorkflowClient = {
96
98
  workflowId: string;
97
99
  workflowWakeRevision: number;
98
100
  }) => Promise<void>;
99
- signalSessionControl: (input: {
100
- accountId: string;
101
- workspaceId: string;
102
- sessionId: string;
103
- eventId: string;
104
- workflowId: string;
105
- workflowWakeRevision: number;
106
- }) => Promise<void>;
107
101
  syncScheduledTask: (input: {
108
102
  task: ScheduledTask;
109
103
  }) => Promise<void>;
@@ -169,10 +163,15 @@ type ApiRouteDeps = AppDependencies & {
169
163
  * or sandbox services. The public API still passes its `ApiRouteDeps` superset.
170
164
  */
171
165
  type AcceptSessionUserMessageDependencies = Pick<AppDependencies, "settings" | "db" | "bus"> & {
172
- workflowClient: Pick<SessionWorkflowClient, "wakeSessionWorkflow" | "signalSessionControl">;
166
+ workflowClient: Pick<SessionWorkflowClient, "wakeSessionWorkflow">;
173
167
  objectStorage: ObjectStorageDependency;
174
168
  };
175
169
 
170
+ /** One global Temporal Schedule owns bounded delivery of committed session wakes. */
171
+ declare const SESSION_WORKFLOW_WAKE_DISPATCHER_SCHEDULE_ID = "opengeni-session-workflow-wake-dispatcher";
172
+ declare const SESSION_WORKFLOW_WAKE_DISPATCHER_WORKFLOW_TYPE = "sessionWorkflowWakeDispatcherWorkflow";
173
+ declare const SESSION_WORKFLOW_WAKE_DISPATCHER_PERIOD_MS = 10000;
174
+
176
175
  type FleetServices = {
177
176
  db: Database;
178
177
  settings: Settings;
@@ -672,7 +671,7 @@ declare function createAndStartSession(input: {
672
671
  id: string;
673
672
  workspaceId: string;
674
673
  accountId: string;
675
- status: "queued" | "running" | "idle" | "requires_action" | "recovering" | "waiting_capacity" | "paused" | "failed" | "cancelled";
674
+ status: "queued" | "running" | "idle" | "requires_action" | "recovering" | "waiting_capacity" | "failed" | "cancelled";
676
675
  initialMessage: string;
677
676
  title: string | null;
678
677
  titleSource: "user" | "agent" | null;
@@ -727,12 +726,54 @@ declare function createAndStartSession(input: {
727
726
  queueVersion: number;
728
727
  queueHeadPosition: number;
729
728
  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;
729
+ effectiveControl: {
730
+ state: "active" | "paused";
731
+ controlVersion: number;
732
+ controlEtag: string;
733
+ directState: "active" | "paused";
734
+ primaryBlocker: {
735
+ kind: "workspace" | "session";
736
+ displayName: string;
737
+ actor: string | null;
738
+ reason: string | null;
739
+ changedAt: string | null;
740
+ revision: number;
741
+ sessionId?: string | undefined;
742
+ } | null;
743
+ additionalBlockerCount: number;
744
+ blockers: {
745
+ kind: "workspace" | "session";
746
+ displayName: string;
747
+ actor: string | null;
748
+ reason: string | null;
749
+ changedAt: string | null;
750
+ revision: number;
751
+ sessionId?: string | undefined;
752
+ }[];
753
+ resumeOptions: {
754
+ scope: "workspace" | "session" | "selected";
755
+ selectedStateAfter: "active" | "paused";
756
+ impactCopy: string;
757
+ targetId?: string | undefined;
758
+ remainingPrimaryBlocker?: {
759
+ kind: "workspace" | "session";
760
+ displayName: string;
761
+ actor: string | null;
762
+ reason: string | null;
763
+ changedAt: string | null;
764
+ revision: number;
765
+ sessionId?: string | undefined;
766
+ } | undefined;
767
+ }[];
768
+ override: {
769
+ rootSessionId: string;
770
+ revision: number;
771
+ } | null;
772
+ settlement: {
773
+ state: "stopping";
774
+ attemptCount: number;
775
+ } | null;
776
+ };
736
777
  lastSequence: number;
737
778
  codexPinnedCredentialId: string | null;
738
779
  codexLastCredentialId: string | null;
@@ -793,7 +834,7 @@ declare function reasoningEffortForSession(metadata: Record<string, unknown>, fa
793
834
  declare function postUserMessageTurn(input: {
794
835
  db: Database;
795
836
  bus: EventBus;
796
- workflowClient: Pick<SessionWorkflowClient, "wakeSessionWorkflow" | "signalSessionControl">;
837
+ workflowClient: Pick<SessionWorkflowClient, "wakeSessionWorkflow">;
797
838
  settings: Settings;
798
839
  accountId: string;
799
840
  workspaceId: string;
@@ -805,11 +846,11 @@ declare function postUserMessageTurn(input: {
805
846
  reasoningEffort?: Settings["openaiReasoningEffort"] | null;
806
847
  clientEventId?: string;
807
848
  mcpCredentialUpdates?: UpdateSessionMcpServerCredentialsInput[];
808
- delivery?: "queue" | "steer";
849
+ delivery?: "send" | "steer";
809
850
  origin?: "human" | "operator";
810
851
  actor?: string;
811
- expectedControlGeneration?: number;
812
- expectedWorkspaceInferenceGeneration?: number;
852
+ controlEtag?: string | null;
853
+ expectedDraftRevision?: number | null;
813
854
  }): Promise<{
814
855
  accepted: SessionEvent;
815
856
  turn: SessionTurn;
@@ -838,10 +879,10 @@ declare function acceptSessionUserMessage(deps: AcceptSessionUserMessageDependen
838
879
  reasoningEffort?: ReasoningEffort | null;
839
880
  clientEventId?: string;
840
881
  mcpCredentialUpdates?: SessionMcpCredentialUpdateInput[];
841
- delivery?: "queue" | "steer";
882
+ delivery?: "send" | "steer";
842
883
  origin?: "human" | "operator";
843
- expectedControlGeneration?: number;
844
- expectedWorkspaceInferenceGeneration?: number;
884
+ controlEtag?: string | null;
885
+ expectedDraftRevision?: number | null;
845
886
  }): Promise<{
846
887
  accepted: SessionEvent;
847
888
  turn: SessionTurn;
@@ -898,4 +939,75 @@ declare function assertWorkspaceDeletable(input: {
898
939
  activeSessionCount: number;
899
940
  }): void;
900
941
 
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 };
942
+ type HumanSessionCommandContext = {
943
+ accountId: string;
944
+ workspaceId: string;
945
+ sessionId: string;
946
+ subjectId: string;
947
+ };
948
+ type AgentSessionCommandContext = {
949
+ accountId: string;
950
+ workspaceId: string;
951
+ callerSessionId: string;
952
+ callerTurnId: string;
953
+ callerAttemptId: string;
954
+ callerExecutionGeneration: number;
955
+ };
956
+ declare function sendAgentSessionMessage(deps: {
957
+ db: Database;
958
+ bus: EventBus;
959
+ workflowClient: Pick<SessionWorkflowClient, "wakeSessionWorkflow">;
960
+ }, context: AgentSessionCommandContext, input: {
961
+ targetSessionId: string;
962
+ text: string;
963
+ idempotencyKey: string;
964
+ }): Promise<_opengeni_db.AgentInternalUpdateCommandResult>;
965
+ declare function steerAgentSession(deps: {
966
+ db: Database;
967
+ bus: EventBus;
968
+ workflowClient: Pick<SessionWorkflowClient, "wakeSessionWorkflow">;
969
+ }, context: AgentSessionCommandContext, input: {
970
+ targetSessionId: string;
971
+ instruction: string;
972
+ idempotencyKey: string;
973
+ }): Promise<_opengeni_db.AgentInternalUpdateCommandResult>;
974
+ declare function controlAgentSessionWorkstream(deps: {
975
+ db: Database;
976
+ bus: EventBus;
977
+ workflowClient: Pick<SessionWorkflowClient, "requestSessionWorkflowWakeDispatch">;
978
+ }, context: AgentSessionCommandContext, input: {
979
+ targetSessionId: string;
980
+ action: "pause" | "resume";
981
+ idempotencyKey: string;
982
+ reason?: string | null;
983
+ }): Promise<_opengeni_db.SessionControlMutationResult>;
984
+ declare function moveHumanQueuePrompt(deps: {
985
+ db: Database;
986
+ bus: EventBus;
987
+ }, context: HumanSessionCommandContext, turnId: string, input: MoveSessionQueueItemRequest): Promise<SessionQueueMutationResponse>;
988
+ declare function deleteHumanQueuePrompt(deps: {
989
+ db: Database;
990
+ bus: EventBus;
991
+ }, context: HumanSessionCommandContext, turnId: string, input: DeleteSessionQueueItemRequest): Promise<SessionQueueMutationResponse>;
992
+ declare function editHumanQueuePrompt(deps: {
993
+ db: Database;
994
+ bus: EventBus;
995
+ }, context: HumanSessionCommandContext, turnId: string, input: EditSessionQueueItemRequest): Promise<SessionQueueMutationResponse>;
996
+ declare function steerHumanQueuePrompt(deps: {
997
+ db: Database;
998
+ bus: EventBus;
999
+ }, context: HumanSessionCommandContext, turnId: string, input: SteerSessionQueueItemRequest): Promise<SessionQueueMutationResponse>;
1000
+ declare function controlHumanSessionWorkstream(deps: {
1001
+ db: Database;
1002
+ bus: EventBus;
1003
+ workflowClient: Pick<SessionWorkflowClient, "requestSessionWorkflowWakeDispatch">;
1004
+ }, context: HumanSessionCommandContext, input: SessionControlRequest): Promise<SessionControlResponse>;
1005
+ declare function controlHumanWorkspace(deps: {
1006
+ db: Database;
1007
+ bus: EventBus;
1008
+ workflowClient: Pick<SessionWorkflowClient, "requestSessionWorkflowWakeDispatch">;
1009
+ }, context: Omit<HumanSessionCommandContext, "sessionId">, input: WorkspaceInferenceControlRequest): Promise<WorkspaceInferenceControlResponse>;
1010
+ declare function getHumanComposerDraft(db: Database, context: HumanSessionCommandContext): Promise<ComposerDraft>;
1011
+ declare function saveHumanComposerDraft(db: Database, context: HumanSessionCommandContext, input: SaveComposerDraftRequest): Promise<ComposerDraft>;
1012
+
1013
+ export { type AcceptSessionUserMessageDependencies, type AccessDeps, type AgentSessionCommandContext, 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 HumanSessionCommandContext, 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, SESSION_WORKFLOW_WAKE_DISPATCHER_PERIOD_MS, SESSION_WORKFLOW_WAKE_DISPATCHER_SCHEDULE_ID, SESSION_WORKFLOW_WAKE_DISPATCHER_WORKFLOW_TYPE, type SessionWorkflowClient, acceptSessionUserMessage, activateRigVersionForApi, appendRigSetupCommand, applyCapabilityEnablement, assertAllowedEnvironmentVariableName, assertAllowedVariableSetVariableName, assertConfiguredModel, assertPackSandboxImageCompatible, assertWorkspaceDeletable, assertWorkspaceMemberRemovable, assertWorkspaceModelPolicyAllows, buildCapabilityCatalog, buildFleetContextForSession, buildMarketingDailyAnalysisAgentConfig, checkLimit, classifyRigVerificationOutcome, controlAgentSessionWorkstream, controlHumanSessionWorkstream, controlHumanWorkspace, createAndStartSession, createCatalogItem, createRigForApi, createRigVersionForApi, createSessionForRequest, createValidatedScheduledTask, deleteHumanQueuePrompt, deleteRigForApi, disableCapability, discoverMcpRegistryCapabilities, editHumanQueuePrompt, enableCapability, enabledCapabilityMcpToolRefs, getCapabilityPack, getHumanComposerDraft, hasPermission, isBuiltInCapabilityPack, isUserMember, listCapabilityPacks, listFleet, listRigChangesForApi, listRigVersionsForApi, listWorkspaceCapabilityPacks, manualScheduledTaskTriggerUsageKey, manualScheduledTaskTriggerWorkflowId, memberCanAdminister, mergeResourceRefs, moveHumanQueuePrompt, 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, saveHumanComposerDraft, scheduledTaskTemporalScheduleId, scheduledTaskToolsProvided, scheduledTaskTriggerToken, sendAgentSessionMessage, settingsWithEnabledCapabilityMcpServers, settingsWithMcpCapabilityServers, settingsWithSessionMcpServerMetadata, steerAgentSession, steerHumanQueuePrompt, swapActiveSandbox, syncCreatedScheduledTask, syncUpdatedScheduledTask, updateRigForApi, updateSessionTitle, validateFileResources, validateGitHubRepositorySelection, validateGitHubRepositorySelectionShape, validateMcpCapabilityConnection, validateToolRefs, validateVariableSetAttachment, validatedScheduledTaskUpdate, withDefaultEnabledCapabilityMcpTools, workflowIdForSession, wrapChannelABoxWithRouting };