@opengeni/core 2.6.3-canary.0 → 2.6.4-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.
@@ -1,3 +1,4 @@
1
+ import { type Settings } from "@opengeni/config";
1
2
  import type { LimitAction, LimitDecision, SessionTurnSource, TurnInitiator, TurnInitiatorContext } from "@opengeni/contracts";
2
3
  import type { ApiRouteDeps } from "../dependencies.js";
3
4
  export type LimitDependencies = Pick<ApiRouteDeps, "db" | "settings">;
@@ -8,6 +9,10 @@ export type LimitCheckInput = {
8
9
  quantity?: number;
9
10
  model?: string | null;
10
11
  };
12
+ export declare function modelFundingForAdmission(settings: Settings, model: string | null | undefined, codexBilled: boolean): {
13
+ fundedWithoutCredits: boolean;
14
+ countsTowardTokenCap: boolean;
15
+ };
11
16
  export declare function requireLimit(deps: LimitDependencies, input: LimitCheckInput): Promise<void>;
12
17
  export declare function checkLimit(deps: LimitDependencies, input: LimitCheckInput): Promise<LimitDecision>;
13
18
  export declare function recordWorkspaceUsage(deps: LimitDependencies, input: {
@@ -10,6 +10,7 @@ import type { ManagedAuthSessionAdapter } from "./managed-auth-session-sets.js";
10
10
  import type { ApiSandboxClient, ResumeBoxByIdInput, ResumedSandboxSession } from "./sandbox-types.js";
11
11
  import type { TranscriptionSegmenter, TranscriptionService } from "./transcription.js";
12
12
  import type { EditableArtifactApplicationPort } from "./editable-artifact-live.js";
13
+ import type { ResolvedCatalogSettings } from "./model-catalog.js";
13
14
  import type { EditableArtifactAgentApplication, EditableArtifactDurableExportService, EditableArtifactOfficeImportPort } from "./editable-artifacts.js";
14
15
  export type SessionWorkflowClient = {
15
16
  triggerAutomationRun?: (input: {
@@ -114,6 +115,13 @@ export type ManagedEmailTransport = {
114
115
  };
115
116
  export type AppDependencies = {
116
117
  settings: Settings;
118
+ /**
119
+ * Original deployment settings when `settings` is already overlaid with a
120
+ * deployment/workspace catalog snapshot. Model-bearing request adapters set
121
+ * this marker so core admission never feeds a synthetic reviewed provider
122
+ * back through deployment validation.
123
+ */
124
+ catalogSourceSettings?: Settings;
117
125
  db: Database;
118
126
  /**
119
127
  * Host-composed editable artifact engine. Standalone startup binds the same
@@ -202,6 +210,7 @@ export type AppDependencies = {
202
210
  };
203
211
  export type ObjectStorageDependency = ReturnType<typeof createObjectStorage>;
204
212
  export type ApiRouteDeps = AppDependencies & {
213
+ resolveCatalogSettings: () => Promise<ResolvedCatalogSettings>;
205
214
  managedEmailTransport: ManagedEmailTransport;
206
215
  objectStorage: ObjectStorageDependency;
207
216
  githubStateSecret: string;
@@ -216,7 +225,7 @@ export type ApiRouteDeps = AppDependencies & {
216
225
  * the canonical admission path without constructing unrelated HTTP, document,
217
226
  * or sandbox services. The public API still passes its `ApiRouteDeps` superset.
218
227
  */
219
- export type AcceptSessionUserMessageDependencies = Pick<AppDependencies, "settings" | "db" | "bus" | "sessionAuthorization" | "schedulePromptPostCommit"> & {
228
+ export type AcceptSessionUserMessageDependencies = Pick<AppDependencies, "settings" | "catalogSourceSettings" | "db" | "bus" | "sessionAuthorization" | "schedulePromptPostCommit"> & {
220
229
  workflowClient: Pick<SessionWorkflowClient, "wakeSessionWorkflow">;
221
230
  objectStorage: ObjectStorageDependency;
222
231
  };
@@ -83,6 +83,16 @@ export declare function createAndStartSessionWithOutcome(input: {
83
83
  /** Internal database-only composition seam. The exact session shell and this
84
84
  * linkage commit together before its first event/turn can be initialized. */
85
85
  beforeCreateCommit?: (tx: Database, sessionId: string) => Promise<void>;
86
+ /** The custom workspace model was frozen by an earlier accepted boundary or
87
+ * inherited from an existing session, so retirement must not invalidate it. */
88
+ retainWorkspaceGatewayModel?: boolean;
89
+ /** Provider-neutral successor to retainWorkspaceGatewayModel. */
90
+ retainWorkspaceCustomModel?: boolean;
91
+ /** The selected workspace Gateway product is backed by a mutable custom row,
92
+ * rather than deployment-curated Gateway membership. */
93
+ workspaceGatewayCustomModel?: boolean;
94
+ /** Provider-neutral successor to workspaceGatewayCustomModel. */
95
+ workspaceCustomModel?: boolean;
86
96
  accountId: string;
87
97
  workspaceId: string;
88
98
  visibility?: "user_private" | "workspace_shared";
@@ -213,7 +223,16 @@ export declare function requireQueuedTurnForApi(db: Database, workspaceId: strin
213
223
  * `session_send_message` tool so the two surfaces cannot drift. Callers own
214
224
  * resource/tool validation and the per-message usage limit before calling.
215
225
  */
216
- export declare function postUserMessageTurn(input: {
226
+ type PostUserMessageTurnResult = {
227
+ accepted: SessionEvent;
228
+ turn: SessionTurn;
229
+ draft: ComposerDraft | null;
230
+ receipt: SessionCommandReceipt;
231
+ routing: SessionPromptRouting;
232
+ interruptionCount: number;
233
+ replay: boolean;
234
+ };
235
+ type PostUserMessageTurnInput = {
217
236
  db: Database;
218
237
  bus: EventBus;
219
238
  workflowClient: Pick<SessionWorkflowClient, "wakeSessionWorkflow">;
@@ -241,19 +260,13 @@ export declare function postUserMessageTurn(input: {
241
260
  commandActor?: SessionCommandActor;
242
261
  controlEtag?: string | null;
243
262
  expectedDraftRevision?: number | null;
263
+ boundaryRequestHash?: string;
244
264
  reasoningEffortFallback?: Settings["openaiReasoningEffort"];
245
265
  turnExecutionPolicy: TurnExecutionPolicyV1;
246
266
  recordAgentRunUsage?: boolean;
247
267
  schedulePostCommit?: (task: () => Promise<void>) => void;
248
- }): Promise<{
249
- accepted: SessionEvent;
250
- turn: SessionTurn;
251
- draft: ComposerDraft | null;
252
- receipt: SessionCommandReceipt;
253
- routing: SessionPromptRouting;
254
- interruptionCount: number;
255
- replay: boolean;
256
- }>;
268
+ };
269
+ export declare function postUserMessageTurn(input: PostUserMessageTurnInput): Promise<PostUserMessageTurnResult>;
257
270
  /**
258
271
  * Full create-session flow shared by `POST /sessions` and the first-party MCP
259
272
  * `session_create` tool: payload validation, resource/tool/variableSet
@@ -269,7 +282,7 @@ export declare function resolveSessionCreateVisibility(input: {
269
282
  visibilityProvided: boolean;
270
283
  parentVisibility: "user_private" | "workspace_shared" | null;
271
284
  }): "user_private" | "workspace_shared";
272
- export declare function createSessionForRequestWithOutcome(deps: ApiRouteDeps, grant: AccessGrant, workspaceId: string, rawPayload: unknown, authorization?: AccessGrantAuthorization, agentChildPresentation?: AgentChildSessionCreatePresentation): Promise<CreateSessionRequestOutcome>;
285
+ export declare function createSessionForRequestWithOutcome(unresolvedDeps: ApiRouteDeps, grant: AccessGrant, workspaceId: string, rawPayload: unknown, authorization?: AccessGrantAuthorization, agentChildPresentation?: AgentChildSessionCreatePresentation): Promise<CreateSessionRequestOutcome>;
273
286
  /** @internal Fixed public projection; the committed session outcome remains authoritative. */
274
287
  export declare function reportSessionUsageRecordingFailure(_error: unknown): void;
275
288
  /** Backward-compatible entity-returning request path for REST and core callers. */
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export * from "./sandbox-types.js";
4
4
  export * from "./managed-auth-type.js";
5
5
  export { getManagedAuthRequestActorAbortSignal, getManagedAuthRequestActorAdmissionStamp, getManagedAuthRequestActorEpoch, getManagedAuthRequestActorLeaseStamp, getManagedSession, ManagedAuthActorLeaseOutcomeUnknownError, markManagedAuthRequestActorTransitionApplied, releaseManagedAuthRequestActorLease, validateManagedAuthRequestActorLease, type ManagedAuthActorAdmissionStamp, type ManagedAuthActorMutationLeaseStamp, } from "./managed-session.js";
6
6
  export * from "./transcription.js";
7
+ export * from "./model-catalog.js";
7
8
  export * from "./sandbox/fleet.js";
8
9
  export * from "./sandbox/routing.js";
9
10
  export * from "./sandbox/runtime-settings.js";