@opengeni/core 2.4.0-canary.2 → 2.5.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.
package/dist/index.js CHANGED
@@ -116,8 +116,17 @@ import {
116
116
  validateEditableArtifactActor
117
117
  } from "./chunk-VCZFFEPB.js";
118
118
  import {
119
- getManagedSession
120
- } from "./chunk-IBOEYG6N.js";
119
+ ManagedAuthActorLeaseOutcomeUnknownError,
120
+ getManagedAuthRequestActorAbortSignal,
121
+ getManagedAuthRequestActorAdmissionStamp,
122
+ getManagedAuthRequestActorEpoch,
123
+ getManagedAuthRequestActorLeaseStamp,
124
+ getManagedSession,
125
+ markManagedAuthRequestActorTransitionApplied,
126
+ releaseManagedAuthRequestActorLease,
127
+ validateManagedAuthRequestActorLease
128
+ } from "./chunk-ZVZJTMSV.js";
129
+ import "./chunk-YGOMUGYS.js";
121
130
 
122
131
  // src/workflow-wake-contract.ts
123
132
  var SESSION_WORKFLOW_WAKE_DISPATCHER_SCHEDULE_ID = "opengeni-session-workflow-wake-dispatcher";
@@ -1635,14 +1644,19 @@ async function resolveAccessContext(c, deps) {
1635
1644
  }
1636
1645
  }
1637
1646
  if (deps.managedAuth) {
1638
- const session = await getManagedSession(c, deps.managedAuth, { db: deps.db });
1647
+ const session = await getManagedSession(c, deps.managedAuth, {
1648
+ db: deps.db,
1649
+ sessionSetMode: deps.settings.managedAuthSessionSetMode,
1650
+ sessionAdapter: deps.managedAuthSessionAdapter
1651
+ });
1639
1652
  if (session?.user) {
1640
1653
  const context = await ensureManagedAccessForUser(deps.db, {
1641
1654
  userId: session.user.id,
1642
1655
  email: session.user.email,
1643
1656
  name: session.user.name,
1644
1657
  emailVerified: session.user.emailVerified,
1645
- provisionFallbackOrganization: false
1658
+ provisionFallbackOrganization: false,
1659
+ bindPendingInvitations: false
1646
1660
  });
1647
1661
  canonicalManagedCookieContexts.add(context);
1648
1662
  return context;
@@ -8202,6 +8216,7 @@ async function postUserMessageTurn(input) {
8202
8216
  annotations: input.annotations ?? [],
8203
8217
  modelContext: input.modelContext ?? null,
8204
8218
  resources: input.resources,
8219
+ ...input.composerDraftResources ? { composerDraftResources: input.composerDraftResources } : {},
8205
8220
  model: requestedModel,
8206
8221
  reasoningEffort: requestedReasoningEffort,
8207
8222
  latencyMode: input.latencyMode ?? null,
@@ -9025,6 +9040,18 @@ async function acceptSessionUserMessageWithOutcome(deps, grant, workspaceId, ses
9025
9040
  latencyModeSource: input.latencyMode == null ? "session" : "explicit"
9026
9041
  });
9027
9042
  const requestedResources = normalizeResources(input.resources ?? []);
9043
+ const composerDraftResources = input.composerDraftResources ? normalizeResources(input.composerDraftResources) : void 0;
9044
+ if (composerDraftResources) {
9045
+ const acceptedResources = new Set(requestedResources.map((resource) => stableJson4(resource)));
9046
+ const unacceptedDraftResource = composerDraftResources.find(
9047
+ (resource) => !acceptedResources.has(stableJson4(resource))
9048
+ );
9049
+ if (unacceptedDraftResource) {
9050
+ throw new HTTPException11(422, {
9051
+ message: "composer draft resources must be included in the accepted resource set"
9052
+ });
9053
+ }
9054
+ }
9028
9055
  const annotations = await validateSubmittedTimelineAnnotations(
9029
9056
  db,
9030
9057
  workspaceId,
@@ -9099,6 +9126,7 @@ async function acceptSessionUserMessageWithOutcome(deps, grant, workspaceId, ses
9099
9126
  annotations,
9100
9127
  modelContext: input.modelContext ?? null,
9101
9128
  resources: requestedResources,
9129
+ ...composerDraftResources ? { composerDraftResources } : {},
9102
9130
  model: input.model ?? null,
9103
9131
  reasoningEffort: input.reasoningEffort ?? null,
9104
9132
  latencyMode: input.latencyMode ?? null,
@@ -13307,6 +13335,42 @@ async function saveActorNewSessionDraft(deps, grant, workspaceId, rawInput, cano
13307
13335
  }
13308
13336
  }
13309
13337
 
13338
+ // src/application/composer-submit.ts
13339
+ async function submitComposerDraftForRequest(deps, grant, workspaceId, sessionId, input, options = {}) {
13340
+ const additionalResources = options.additionalResources ?? [];
13341
+ const result = await acceptSessionUserMessageWithOutcome(deps, grant, workspaceId, sessionId, {
13342
+ text: input.text,
13343
+ annotations: input.annotations,
13344
+ modelContext: input.modelContext ?? null,
13345
+ resources: [...input.resources, ...additionalResources],
13346
+ ...additionalResources.length > 0 ? { composerDraftResources: input.resources } : {},
13347
+ model: input.model,
13348
+ reasoningEffort: input.reasoningEffort,
13349
+ latencyMode: input.latencyMode,
13350
+ mcpCredentialUpdates: input.mcpCredentialUpdates ?? [],
13351
+ connectionAuthorities: input.connectionAuthorities,
13352
+ ...input.personalResourceAttachment ? { personalResourceAttachment: input.personalResourceAttachment } : {},
13353
+ ...options.authorization ? { authorization: options.authorization } : {},
13354
+ delivery: input.delivery,
13355
+ origin: "human",
13356
+ expectedDraftRevision: input.expectedDraftRevision,
13357
+ clientEventId: input.clientEventId,
13358
+ ...input.controlEtag ? { controlEtag: input.controlEtag } : {}
13359
+ });
13360
+ if (!result.draft) {
13361
+ throw new Error("Accepted composer draft submission did not return its next draft");
13362
+ }
13363
+ return {
13364
+ accepted: result.accepted,
13365
+ turn: result.turn,
13366
+ draft: result.draft,
13367
+ receipt: result.receipt,
13368
+ routing: result.routing,
13369
+ interruptionCount: result.interruptionCount,
13370
+ replay: result.replay
13371
+ };
13372
+ }
13373
+
13310
13374
  // src/application/session-commands.ts
13311
13375
  import { DraftTimelineAnnotations as DraftTimelineAnnotations3 } from "@opengeni/contracts";
13312
13376
  import {
@@ -13618,24 +13682,30 @@ async function controlAgentSessionWorkstream(deps, context, input) {
13618
13682
  }
13619
13683
  );
13620
13684
  scheduleSessionCommandPostCommit(deps, "agent_control", [
13621
- {
13622
- kind: "session_event_fanout",
13623
- run: async () => await publishSessionEventIds(deps, context.workspaceId, input.targetSessionId, [
13624
- result.sessionControlEventId
13625
- ])
13626
- },
13627
- {
13628
- kind: "workspace_control_fanout",
13629
- run: async () => await publishWorkspaceControlEvent(
13630
- deps,
13631
- context.workspaceId,
13632
- result.workspaceControlEventId
13633
- )
13634
- },
13635
- {
13636
- kind: "workflow_wake",
13637
- run: async () => await requestControlWakeDispatch(deps, result.wakeCount)
13638
- },
13685
+ ...result.sessionControlEventId ? [
13686
+ {
13687
+ kind: "session_event_fanout",
13688
+ run: async () => await publishSessionEventIds(deps, context.workspaceId, input.targetSessionId, [
13689
+ result.sessionControlEventId
13690
+ ])
13691
+ }
13692
+ ] : [],
13693
+ ...result.workspaceControlEventId ? [
13694
+ {
13695
+ kind: "workspace_control_fanout",
13696
+ run: async () => await publishWorkspaceControlEvent(
13697
+ deps,
13698
+ context.workspaceId,
13699
+ result.workspaceControlEventId
13700
+ )
13701
+ }
13702
+ ] : [],
13703
+ ...result.wakeCount > 0 ? [
13704
+ {
13705
+ kind: "workflow_wake",
13706
+ run: async () => await requestControlWakeDispatch(deps, result.wakeCount)
13707
+ }
13708
+ ] : [],
13639
13709
  {
13640
13710
  kind: "workflow_wake",
13641
13711
  run: async () => {
@@ -13908,18 +13978,22 @@ async function controlHumanSessionWorkstreamWithOutcome(deps, context, input) {
13908
13978
  affected.eventIds
13909
13979
  )
13910
13980
  })),
13911
- {
13912
- kind: "workspace_control_fanout",
13913
- run: async () => await publishWorkspaceControlEvent(
13914
- deps,
13915
- context.workspaceId,
13916
- result.workspaceControlEventId
13917
- )
13918
- },
13919
- {
13920
- kind: "workflow_wake",
13921
- run: async () => await requestControlWakeDispatch(deps, result.wakeCount)
13922
- },
13981
+ ...result.workspaceControlEventId ? [
13982
+ {
13983
+ kind: "workspace_control_fanout",
13984
+ run: async () => await publishWorkspaceControlEvent(
13985
+ deps,
13986
+ context.workspaceId,
13987
+ result.workspaceControlEventId
13988
+ )
13989
+ }
13990
+ ] : [],
13991
+ ...result.wakeCount > 0 ? [
13992
+ {
13993
+ kind: "workflow_wake",
13994
+ run: async () => await requestControlWakeDispatch(deps, result.wakeCount)
13995
+ }
13996
+ ] : [],
13923
13997
  {
13924
13998
  kind: "workflow_wake",
13925
13999
  run: async () => {
@@ -13937,7 +14011,7 @@ async function controlHumanSessionWorkstreamWithOutcome(deps, context, input) {
13937
14011
  }
13938
14012
  }
13939
14013
  ]);
13940
- return { response, replay: result.replay };
14014
+ return { response, outcome: result.outcome, replay: result.replay };
13941
14015
  }
13942
14016
  async function controlHumanSessionWorkstream(deps, context, input) {
13943
14017
  return (await controlHumanSessionWorkstreamWithOutcome(deps, context, input)).response;
@@ -13967,18 +14041,22 @@ async function controlHumanWorkspace(deps, context, input) {
13967
14041
  wakeCount: result.wakeCount
13968
14042
  };
13969
14043
  scheduleSessionCommandPostCommit(deps, "human_workspace_control", [
13970
- {
13971
- kind: "workspace_control_fanout",
13972
- run: async () => await publishWorkspaceControlEvent(
13973
- deps,
13974
- context.workspaceId,
13975
- result.workspaceControlEventId
13976
- )
13977
- },
13978
- {
13979
- kind: "workflow_wake",
13980
- run: async () => await requestControlWakeDispatch(deps, result.wakeCount)
13981
- }
14044
+ ...result.workspaceControlEventId ? [
14045
+ {
14046
+ kind: "workspace_control_fanout",
14047
+ run: async () => await publishWorkspaceControlEvent(
14048
+ deps,
14049
+ context.workspaceId,
14050
+ result.workspaceControlEventId
14051
+ )
14052
+ }
14053
+ ] : [],
14054
+ ...result.wakeCount > 0 ? [
14055
+ {
14056
+ kind: "workflow_wake",
14057
+ run: async () => await requestControlWakeDispatch(deps, result.wakeCount)
14058
+ }
14059
+ ] : []
13982
14060
  ]);
13983
14061
  return response;
13984
14062
  }
@@ -14202,6 +14280,7 @@ export {
14202
14280
  MEMORY_SLACK_PROJECTION_MAX_UTF8_BYTES,
14203
14281
  MEMORY_SLACK_PROJECTION_VERSION,
14204
14282
  MEMORY_SLACK_SUMMARY_MAX_UTF8_BYTES,
14283
+ ManagedAuthActorLeaseOutcomeUnknownError,
14205
14284
  MathEditableArtifactOutboxRandom,
14206
14285
  OPENGENI_PR_REVIEW_AGENT_INSTRUCTIONS,
14207
14286
  OPENGENI_PR_REVIEW_SKILL,
@@ -14368,6 +14447,10 @@ export {
14368
14447
  getAutomationAdapter,
14369
14448
  getCapabilityPack,
14370
14449
  getHumanComposerDraft,
14450
+ getManagedAuthRequestActorAbortSignal,
14451
+ getManagedAuthRequestActorAdmissionStamp,
14452
+ getManagedAuthRequestActorEpoch,
14453
+ getManagedAuthRequestActorLeaseStamp,
14371
14454
  getManagedHumanSessionCreateCapabilities,
14372
14455
  getManagedSession,
14373
14456
  getWorkspaceInsights,
@@ -14405,6 +14488,7 @@ export {
14405
14488
  loadRigDefaultVariableSetEnvironment,
14406
14489
  manualScheduledTaskTriggerUsageKey,
14407
14490
  manualScheduledTaskTriggerWorkflowId,
14491
+ markManagedAuthRequestActorTransitionApplied,
14408
14492
  memberCanAdminister,
14409
14493
  mergeCausalFrontiers,
14410
14494
  mergeResourceRefs,
@@ -14465,6 +14549,7 @@ export {
14465
14549
  registerAutomationAdapter,
14466
14550
  relayConfigFromSettings,
14467
14551
  relayDialBaseFromSettings,
14552
+ releaseManagedAuthRequestActorLease,
14468
14553
  rememberConfirmationLabel,
14469
14554
  reportSessionUsageRecordingFailure,
14470
14555
  requireAccessContext,
@@ -14546,6 +14631,7 @@ export {
14546
14631
  statusForVoiceInputError,
14547
14632
  steerAgentSession,
14548
14633
  steerHumanQueuePrompt,
14634
+ submitComposerDraftForRequest,
14549
14635
  swapActiveSandbox,
14550
14636
  syncCreatedScheduledTask,
14551
14637
  syncUpdatedScheduledTask,
@@ -14564,6 +14650,7 @@ export {
14564
14650
  validateGitHubRepositorySelectionShape,
14565
14651
  validateGitHubRepositorySelectionShapes,
14566
14652
  validateIncidentTelemetryPreflightSelection,
14653
+ validateManagedAuthRequestActorLease,
14567
14654
  validateMcpCapabilityConnection,
14568
14655
  validateOpenGeniSlackBotConnectionSelection,
14569
14656
  validateScheduledTaskTarget,