@opengeni/worker-bundle 2.2.1 → 2.3.0-canary.36938443461001

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 (37) hide show
  1. package/dist/activities/agent-turn/credential-restriction.d.ts +3 -0
  2. package/dist/activities/agent-turn/run-credentials.d.ts +2 -0
  3. package/dist/activities/scheduled-tasks.d.ts +4 -35
  4. package/dist/activities/types.d.ts +3 -0
  5. package/dist/activities/workspace-capture.d.ts +2 -0
  6. package/dist/{activities-control-55ECL47G.js → activities-control-RDA4E2DM.js} +102 -20
  7. package/dist/activities-control-RDA4E2DM.js.map +1 -0
  8. package/dist/{activities-turn-T7Y3BWYO.js → activities-turn-A7LDKRLD.js} +20 -7
  9. package/dist/activities-turn-A7LDKRLD.js.map +1 -0
  10. package/dist/{chunk-OWNLATJL.js → chunk-HXPW4HPN.js} +60 -24
  11. package/dist/chunk-HXPW4HPN.js.map +1 -0
  12. package/dist/{chunk-IJZU752L.js → chunk-YG27NEMX.js} +34 -1
  13. package/dist/chunk-YG27NEMX.js.map +1 -0
  14. package/dist/index.js +2 -2
  15. package/dist/observability-metrics.d.ts +16 -1
  16. package/dist/workflow-bundle.js +18 -12
  17. package/dist/workflows/scheduled-tasks.d.ts +4 -0
  18. package/package.json +21 -21
  19. package/src/activities/agent-turn/claim.ts +13 -1
  20. package/src/activities/agent-turn/credential-restriction.ts +14 -0
  21. package/src/activities/agent-turn/errors.ts +39 -13
  22. package/src/activities/agent-turn/run-credentials.ts +5 -0
  23. package/src/activities/agent-turn/run.ts +1 -0
  24. package/src/activities/agent-turn/tool-environment.ts +4 -0
  25. package/src/activities/automations.ts +23 -1
  26. package/src/activities/goals.ts +33 -8
  27. package/src/activities/sandbox-lease.ts +22 -0
  28. package/src/activities/scheduled-tasks.ts +89 -25
  29. package/src/activities/site-auth-maintenance.ts +1 -0
  30. package/src/activities/types.ts +3 -0
  31. package/src/activities/workspace-capture.ts +13 -2
  32. package/src/observability-metrics.ts +55 -1
  33. package/src/workflows/scheduled-tasks.ts +26 -13
  34. package/dist/activities-control-55ECL47G.js.map +0 -1
  35. package/dist/activities-turn-T7Y3BWYO.js.map +0 -1
  36. package/dist/chunk-IJZU752L.js.map +0 -1
  37. package/dist/chunk-OWNLATJL.js.map +0 -1
@@ -0,0 +1,3 @@
1
+ import { type TurnExecutionPolicyV1 } from "@opengeni/contracts";
2
+ /** Only accepted policies establish the ceiling; ordinary metadata is not authority. */
3
+ export declare function turnCredentialRestriction(acceptedPolicy: TurnExecutionPolicyV1, initialSessionMetadata: unknown): "developer_setup" | undefined;
@@ -26,6 +26,7 @@ export type PrepareRunCredentialsDeps = {
26
26
  sandboxRuntime: SandboxTurnRuntime;
27
27
  turn: ClaimTurnOk["turn"];
28
28
  session: ClaimTurnOk["session"];
29
+ turnExecutionPolicy: ClaimTurnOk["turnExecutionPolicy"];
29
30
  fileAuthoritySubjectId: ClaimTurnOk["fileAuthoritySubjectId"];
30
31
  runSettings: GovernanceModelOk["runSettings"];
31
32
  workspaceVariableSet: Awaited<ReturnType<typeof loadWorkspaceEnvironmentForRunWithCredentials>>;
@@ -64,6 +65,7 @@ export declare function prepareRunCredentials(deps: PrepareRunCredentialsDeps):
64
65
  turnId: string;
65
66
  attemptId: string;
66
67
  executionGeneration: number;
68
+ credentialRestriction?: "developer_setup";
67
69
  };
68
70
  sandboxArtifactRuntime: Readonly<{
69
71
  available: boolean;
@@ -1,3 +1,4 @@
1
+ import { TurnExecutionPolicyV1 } from "@opengeni/contracts";
1
2
  import { updateSessionTitleWithEvent } from "@opengeni/db";
2
3
  import type { ControlActivityServices, DispatchScheduledTaskRunInput, DispatchScheduledTaskRunResult } from "./types.js";
3
4
  import type { Database } from "@opengeni/db";
@@ -9,43 +10,11 @@ type ScheduledTemporalActivityIdentity = {
9
10
  };
10
11
  activityId: string;
11
12
  };
13
+ export declare function scheduledTaskRunExecutionPolicy(policy: TurnExecutionPolicyV1, input: DispatchScheduledTaskRunInput, creatorRestriction?: "developer_setup"): TurnExecutionPolicyV1;
14
+ /** Only a creator ceiling is standing; a manual caller ceiling is per-run. */
15
+ export declare function scheduledSessionExecutionPolicyMetadata(policy: unknown, creatorRestriction?: "developer_setup"): Record<string, unknown>;
12
16
  export declare function scheduledTaskRunProducerKey(input: DispatchScheduledTaskRunInput, suppliedActivityIdentity?: ScheduledTemporalActivityIdentity): string;
13
17
  export declare function scheduledTaskGeneratedSessionCreateIdempotencyKey(producerKey: string): string;
14
- /**
15
- * Display title for a session the scheduler generates for a task.
16
- *
17
- * A scheduled session's `initialMessage` is the task prompt, byte-identical for
18
- * every run. The task name is the short human-chosen label that actually
19
- * identifies it, so that is the title.
20
- *
21
- * The title is the task name and NOTHING else. It deliberately does not name the
22
- * run's fire instant, for two independent reasons:
23
- *
24
- * - No run mode guarantees one run per session. `reusable_session` generates
25
- * its session on the first fire and then reuses it forever, and even under
26
- * `new_session_per_run` alert-occurrence redelivery converges several runs
27
- * onto one canonical responder session. `existing_session` never generates a
28
- * session at all, so the scheduler never titles one. A run-specific fact
29
- * frozen into the title is therefore right for the generating run and a lie
30
- * for every run that lands in the same session afterwards.
31
- * - A title is one stored string shown to every viewer, while every surface
32
- * that renders a run's fire instant renders it viewer-local: the rail row
33
- * prints the title beside `relativeTimeLabel(session.updatedAt)`, and the
34
- * Schedules run list prints `formatTimestamp(run.firedAt)`, which is
35
- * `toLocaleString()`. A wall clock stored in the title therefore disagrees
36
- * with the time printed next to it for every viewer outside whichever zone
37
- * it was rendered in. The task's own `timeZone` is no escape: it labels the
38
- * schedule rule ("Mon Wed 09:00 Europe/Oslo"), not the rendering of a run,
39
- * which stays viewer-local. No stored clock can agree with a viewer-local
40
- * one, so the title carries none and the instant stays on the surfaces that
41
- * already render it correctly.
42
- *
43
- * Dropping the clock settles the determinism constraint outright rather than
44
- * working around it: the same run titled by the normal dispatch or by a later
45
- * recovery in a different worker process derives one string from `task.name`
46
- * alone, with no Intl call and so no host ICU or tzdata build to make the two
47
- * texts differ.
48
- */
49
18
  export declare function scheduledTaskSessionTitle(taskName: string): string;
50
19
  /**
51
20
  * Title a session the scheduler generated, and emit the same `session.title_set`
@@ -343,11 +343,14 @@ export type DispatchScheduledTaskRunInput = {
343
343
  triggerType: Extract<ScheduledTaskTriggerType, "scheduled">;
344
344
  agentRunUsageIdempotencyKey?: never;
345
345
  initiator?: never;
346
+ credentialRestriction?: never;
346
347
  } | {
347
348
  triggerType: Extract<ScheduledTaskTriggerType, "manual" | "initial" | "provider_event" | "retry" | "repair">;
348
349
  agentRunUsageIdempotencyKey: string;
349
350
  /** Exact identity used by the API-side charge for this same trigger. */
350
351
  initiator: TurnInitiator;
352
+ /** Trusted API-side caller ceiling for this occurrence, not the schedule. */
353
+ credentialRestriction?: "developer_setup";
351
354
  });
352
355
  export type DispatchScheduledTaskRunResult = {
353
356
  action: "deleted";
@@ -108,6 +108,8 @@ export declare function captureWhileIdle(input: {
108
108
  * to release() regardless.
109
109
  */
110
110
  export declare function captureWorkspaceRevision(input: CaptureWorkspaceRevisionInput): Promise<void>;
111
+ /** Count one committed logical capture and observe its end-to-end duration. */
112
+ export declare function recordWorkspaceCaptureCompleted(observability: Pick<Observability, "incrementCounter" | "observeHistogram">, durationMs: number): void;
111
113
  /**
112
114
  * sha256 over the CHANGE SURFACE only — per-file (path, status, hash, deleted,
113
115
  * tooLarge), exact HEAD identity, the working diff summary, and exact committed
@@ -34,10 +34,12 @@ import {
34
34
  warnDrainSnapshotFailure,
35
35
  withFirstPartyTools,
36
36
  workflowIdForSession
37
- } from "./chunk-OWNLATJL.js";
37
+ } from "./chunk-HXPW4HPN.js";
38
38
  import {
39
39
  inspectOpenSandboxKubernetesInventory,
40
+ recordActiveUserGauges,
40
41
  recordCreditBalanceGauges,
42
+ recordCreditGrantGauges,
41
43
  recordCreditMicros,
42
44
  recordExpiredDrainingSandboxLeaseGauges,
43
45
  recordOpenSandboxKubernetesInventoryGauges,
@@ -58,7 +60,7 @@ import {
58
60
  recordVerifiedSignupTrialSwitchGauge,
59
61
  recordWorkerDeathRecoveryMetrics,
60
62
  runtimeMetricsHooksForObservability
61
- } from "./chunk-IJZU752L.js";
63
+ } from "./chunk-YG27NEMX.js";
62
64
  import "./chunk-PZ5AY32C.js";
63
65
 
64
66
  // src/activities/knowledge-indexing.ts
@@ -717,7 +719,8 @@ import {
717
719
  createAndStartSessionWithOutcome,
718
720
  recordWorkspaceUsage,
719
721
  resolveCatalogSettings,
720
- resolveWorkspaceCatalogSettings
722
+ resolveWorkspaceCatalogSettings,
723
+ isDeveloperSetupDelegatedPermissionAllowed
721
724
  } from "@opengeni/core";
722
725
  import {
723
726
  AutomationAuthorityRevokedError,
@@ -777,6 +780,17 @@ function createAutomationActivities(services, options = {}) {
777
780
  return { action: "skipped", reason: "accepted_execution_mismatch" };
778
781
  }
779
782
  const template = accepted.sessionTemplate;
783
+ if (template.credentialRestriction === "developer_setup" && template.firstPartyMcpPermissions.some(
784
+ (permission) => !isDeveloperSetupDelegatedPermissionAllowed(permission)
785
+ )) {
786
+ await settle(service.db, {
787
+ workspaceId: input.workspaceId,
788
+ runId: run.id,
789
+ status: "failed",
790
+ errorCode: "credential_restriction_violation"
791
+ });
792
+ return { action: "failed", reason: "credential_restriction_violation" };
793
+ }
780
794
  const requestedModel = template.model ?? deploymentCatalogSettings.openaiModel;
781
795
  const catalogSettings = requestedModel.startsWith(WORKSPACE_GATEWAY_MODEL_ID_PREFIX) || requestedModel.startsWith(WORKSPACE_OPENROUTER_MODEL_ID_PREFIX) ? (await resolveWorkspaceCatalogSettings(service.db, catalogSourceSettings, {
782
796
  accountId: input.accountId,
@@ -864,7 +878,7 @@ function createAutomationActivities(services, options = {}) {
864
878
  });
865
879
  return { action: "failed", reason: "dispatch_failed" };
866
880
  }
867
- const turnExecutionPolicy = resolveTurnExecutionPolicyV1(catalogSettings, {
881
+ const resolvedTurnExecutionPolicy = resolveTurnExecutionPolicyV1(catalogSettings, {
868
882
  modelId: model,
869
883
  requestedModelId: template.model,
870
884
  modelSource: template.model ? "explicit" : "deployment",
@@ -873,6 +887,10 @@ function createAutomationActivities(services, options = {}) {
873
887
  latencyMode: "standard",
874
888
  latencyModeSource: "deployment"
875
889
  });
890
+ const turnExecutionPolicy = template.credentialRestriction ? {
891
+ ...resolvedTurnExecutionPolicy,
892
+ credentialRestriction: template.credentialRestriction
893
+ } : resolvedTurnExecutionPolicy;
876
894
  const created = await createSession2({
877
895
  db: service.db,
878
896
  bus: service.bus,
@@ -896,6 +914,7 @@ function createAutomationActivities(services, options = {}) {
896
914
  workspaceId: input.workspaceId,
897
915
  initialMessage: accepted.initialMessage,
898
916
  surface: "automation",
917
+ metrics: service.observability,
899
918
  resources: template.resources,
900
919
  skills: SessionSkills.parse(template.skills),
901
920
  bundledSkillIds: template.bundledSkillIds,
@@ -2675,6 +2694,8 @@ import {
2675
2694
  deferRetainedProcessReconciliation,
2676
2695
  forceDrainOverLimitViewerOnlyBoxes,
2677
2696
  listCreditBalancesByAccount,
2697
+ countActiveUsers,
2698
+ readCreditGrantTotals,
2678
2699
  readVerifiedSignupTrialSwitch,
2679
2700
  listLegacyModalCheckpointSlots,
2680
2701
  listLiveModalSandboxLeaseAttributions,
@@ -4369,6 +4390,24 @@ async function refreshQueueLeaseAndCreditGauges(db, settings, observability, ins
4369
4390
  });
4370
4391
  }
4371
4392
  })(),
4393
+ (async () => {
4394
+ try {
4395
+ recordActiveUserGauges(observability, await countActiveUsers(db));
4396
+ } catch (error) {
4397
+ observability.warn("sandbox reaper: active-user gauge refresh failed", {
4398
+ error: error instanceof Error ? error.message : String(error)
4399
+ });
4400
+ }
4401
+ })(),
4402
+ (async () => {
4403
+ try {
4404
+ recordCreditGrantGauges(observability, await readCreditGrantTotals(db));
4405
+ } catch (error) {
4406
+ observability.warn("sandbox reaper: credit-grant gauge refresh failed", {
4407
+ error: error instanceof Error ? error.message : String(error)
4408
+ });
4409
+ }
4410
+ })(),
4372
4411
  (async () => {
4373
4412
  recordVerifiedSignupTrialDeploymentFlagGauge(
4374
4413
  observability,
@@ -5206,6 +5245,7 @@ import {
5206
5245
  SessionAgentAccess,
5207
5246
  SessionMemoryScope,
5208
5247
  normalizeAutomaticSessionTitle,
5248
+ metadataWithTurnExecutionPolicyV1,
5209
5249
  scheduledOccurrencePayloadUtf8Bytes,
5210
5250
  stableJson,
5211
5251
  TurnExecutionPolicyV1,
@@ -5230,7 +5270,9 @@ import {
5230
5270
  swapActiveSandbox,
5231
5271
  agentConfigMayResolve as agentConfigMayResolve2,
5232
5272
  applySessionAgentConfigWriteThrough as applySessionAgentConfigWriteThrough2,
5233
- resolveSessionAgentConfigForCreate as resolveSessionAgentConfigForCreate2
5273
+ resolveSessionAgentConfigForCreate as resolveSessionAgentConfigForCreate2,
5274
+ recordSessionCreated,
5275
+ recordUserMessageAccepted
5234
5276
  } from "@opengeni/core";
5235
5277
  import {
5236
5278
  addSessionSystemUpdateWithSourceMutation,
@@ -5397,6 +5439,14 @@ function canonicalLabels(value) {
5397
5439
  }
5398
5440
 
5399
5441
  // src/activities/scheduled-tasks.ts
5442
+ function scheduledTaskRunExecutionPolicy(policy, input, creatorRestriction) {
5443
+ return creatorRestriction === "developer_setup" || input.triggerType !== "scheduled" && input.credentialRestriction === "developer_setup" ? { ...policy, credentialRestriction: "developer_setup" } : policy;
5444
+ }
5445
+ function scheduledSessionExecutionPolicyMetadata(policy, creatorRestriction) {
5446
+ if (policy === void 0 || policy === null) return {};
5447
+ const acceptedPolicy = TurnExecutionPolicyV1.parse(policy);
5448
+ return creatorRestriction === "developer_setup" && acceptedPolicy.credentialRestriction === "developer_setup" ? metadataWithTurnExecutionPolicyV1({}, acceptedPolicy) : {};
5449
+ }
5400
5450
  function scheduledTaskRunProducerKey(input, suppliedActivityIdentity) {
5401
5451
  if (input.producerKey) return input.producerKey;
5402
5452
  if (input.triggerType !== "scheduled") return input.agentRunUsageIdempotencyKey;
@@ -5422,6 +5472,13 @@ function scheduledTaskGeneratedSessionCreateIdempotencyKey(producerKey) {
5422
5472
  const digest = createHash3("sha256").update("scheduled-task-run\0", "utf8").update(producerKey, "utf8").digest("hex");
5423
5473
  return `scheduled-task-run:${digest}`;
5424
5474
  }
5475
+ function recordScheduledSessionCreated(observability) {
5476
+ recordSessionCreated(observability, {
5477
+ surface: "scheduled",
5478
+ createdByKind: "service",
5479
+ parentSessionId: null
5480
+ });
5481
+ }
5425
5482
  function scheduledTaskSessionTitle(taskName) {
5426
5483
  return normalizeAutomaticSessionTitle(taskName) ?? "Scheduled run";
5427
5484
  }
@@ -5496,6 +5553,7 @@ function createScheduledTaskActivities(services) {
5496
5553
  try {
5497
5554
  return await recoverBoundScheduledTaskDispatch({
5498
5555
  db,
5556
+ observability: baseService.observability,
5499
5557
  bus,
5500
5558
  settings: settings2,
5501
5559
  wakeSessionWorkflow,
@@ -5997,15 +6055,19 @@ function createScheduledTaskActivities(services) {
5997
6055
  );
5998
6056
  }
5999
6057
  } : void 0;
6000
- const turnExecutionPolicy = resolveTurnExecutionPolicyV12(settings, {
6001
- modelId: acceptedModel,
6002
- requestedModelId: generatedTarget && task.agentConfig.model ? task.agentConfig.model : null,
6003
- modelSource: generatedTarget ? task.agentConfig.model ? "explicit" : "deployment" : "session",
6004
- reasoningEffort: acceptedReasoningEffort,
6005
- reasoningSource: generatedTarget ? task.agentConfig.reasoningEffort ? "explicit" : "deployment" : "session",
6006
- latencyMode: acceptedLatencyMode,
6007
- latencyModeSource: generatedTarget ? "deployment" : "session"
6008
- });
6058
+ const turnExecutionPolicy = scheduledTaskRunExecutionPolicy(
6059
+ resolveTurnExecutionPolicyV12(settings, {
6060
+ modelId: acceptedModel,
6061
+ requestedModelId: generatedTarget && task.agentConfig.model ? task.agentConfig.model : null,
6062
+ modelSource: generatedTarget ? task.agentConfig.model ? "explicit" : "deployment" : "session",
6063
+ reasoningEffort: acceptedReasoningEffort,
6064
+ reasoningSource: generatedTarget ? task.agentConfig.reasoningEffort ? "explicit" : "deployment" : "session",
6065
+ latencyMode: acceptedLatencyMode,
6066
+ latencyModeSource: generatedTarget ? "deployment" : "session"
6067
+ }),
6068
+ input,
6069
+ creatorPolicy?.credentialRestriction
6070
+ );
6009
6071
  const deferredEvents = [];
6010
6072
  const executeDispatch = async (dispatchDb, deferPublications) => {
6011
6073
  const admittedRunId = crypto.randomUUID();
@@ -6216,6 +6278,10 @@ function createScheduledTaskActivities(services) {
6216
6278
  } : {},
6217
6279
  metadata: {
6218
6280
  ...taskMetadata,
6281
+ ...scheduledSessionExecutionPolicyMetadata(
6282
+ turnExecutionPolicy,
6283
+ creatorPolicy?.credentialRestriction
6284
+ ),
6219
6285
  model,
6220
6286
  reasoningEffort,
6221
6287
  scheduledTaskId: task.id,
@@ -6305,6 +6371,7 @@ function createScheduledTaskActivities(services) {
6305
6371
  }
6306
6372
  session = created.session;
6307
6373
  sessionCreated = created.created;
6374
+ if (sessionCreated) recordScheduledSessionCreated(baseService.observability);
6308
6375
  if (!sessionCreated) {
6309
6376
  await bindScheduledTaskRunSessionInTransaction(dispatchDb, {
6310
6377
  accountId: task.accountId,
@@ -6540,6 +6607,9 @@ function createScheduledTaskActivities(services) {
6540
6607
  run: { ...run, status: "skipped", error }
6541
6608
  };
6542
6609
  }
6610
+ if (scheduledUpdate.added) {
6611
+ recordUserMessageAccepted(baseService.observability, { surface: "scheduled" });
6612
+ }
6543
6613
  if (scheduledUpdate.added && scheduledUpdate.events.length > 0) {
6544
6614
  if (deferPublications) {
6545
6615
  deferredEvents.push({
@@ -6664,6 +6734,9 @@ function createScheduledTaskActivities(services) {
6664
6734
  run: { ...run, status: "skipped", error }
6665
6735
  };
6666
6736
  }
6737
+ if (bundled.added) {
6738
+ recordUserMessageAccepted(baseService.observability, { surface: "scheduled" });
6739
+ }
6667
6740
  if (bundled.added && bundled.events.length > 0) {
6668
6741
  if (deferPublications) {
6669
6742
  deferredEvents.push({
@@ -7005,6 +7078,7 @@ async function recoverBoundScheduledTaskDispatch(input) {
7005
7078
  throw new Error("scheduled run is not an exact queued recovery");
7006
7079
  }
7007
7080
  const generatedSession = task.runMode === "new_session_per_run" || task.runMode === "reusable_session" && task.reusableSessionId === null;
7081
+ const recoveredCreatorPolicy = generatedSession ? await getScheduledTaskCreatorPolicy(input.db, task.workspaceId, task.id) : null;
7008
7082
  const frozenSlack = input.acceptedExecution.resolvedSlackBotConnection;
7009
7083
  if (frozenSlack) {
7010
7084
  const currentSlack = await requireOpenGeniSlackBotConnection(
@@ -7064,11 +7138,6 @@ async function recoverBoundScheduledTaskDispatch(input) {
7064
7138
  }
7065
7139
  const taskMetadata = { ...task.agentConfig.metadata };
7066
7140
  delete taskMetadata[OPENGENI_SLACK_BOT_SESSION_METADATA_KEY];
7067
- const recoveredCreatorPolicy = await getScheduledTaskCreatorPolicy(
7068
- input.db,
7069
- task.workspaceId,
7070
- task.id
7071
- );
7072
7141
  const created = await createSessionWithIdempotencyKeyResult(input.db, {
7073
7142
  accountId: task.accountId,
7074
7143
  workspaceId: task.workspaceId,
@@ -7087,6 +7156,10 @@ async function recoverBoundScheduledTaskDispatch(input) {
7087
7156
  } : {},
7088
7157
  metadata: {
7089
7158
  ...taskMetadata,
7159
+ ...scheduledSessionExecutionPolicyMetadata(
7160
+ input.acceptedExecution.turnExecutionPolicy,
7161
+ recoveredCreatorPolicy?.credentialRestriction
7162
+ ),
7090
7163
  model: input.acceptedExecution.resolvedModel,
7091
7164
  reasoningEffort: input.acceptedExecution.resolvedReasoningEffort,
7092
7165
  scheduledTaskId: task.id,
@@ -7139,6 +7212,7 @@ async function recoverBoundScheduledTaskDispatch(input) {
7139
7212
  });
7140
7213
  if (created.denied) throw new SessionSpawnDeniedDbError(created.denial);
7141
7214
  session = created.session;
7215
+ if (created.created) recordScheduledSessionCreated(input.observability);
7142
7216
  if (!created.created) {
7143
7217
  await bindScheduledTaskRunSessionInTransaction(input.db, {
7144
7218
  accountId: task.accountId,
@@ -7205,6 +7279,10 @@ async function recoverBoundScheduledTaskDispatch(input) {
7205
7279
  const expectedMetadata = metadataWithAgentConfigCreateIdentity(
7206
7280
  {
7207
7281
  ...expectedTaskMetadata,
7282
+ ...scheduledSessionExecutionPolicyMetadata(
7283
+ input.acceptedExecution.turnExecutionPolicy,
7284
+ recoveredCreatorPolicy?.credentialRestriction
7285
+ ),
7208
7286
  model: input.acceptedExecution.resolvedModel,
7209
7287
  reasoningEffort: input.acceptedExecution.resolvedReasoningEffort,
7210
7288
  scheduledTaskId: task.id,
@@ -7358,6 +7436,9 @@ async function recoverBoundScheduledTaskDispatch(input) {
7358
7436
  if (scheduledUpdate.reason === "session_cancelled" || scheduledUpdate.reason === "session_not_idle") {
7359
7437
  return { action: "blocked", reason: "scheduled_run_terminal" };
7360
7438
  }
7439
+ if (scheduledUpdate.added) {
7440
+ recordUserMessageAccepted(input.observability, { surface: "scheduled" });
7441
+ }
7361
7442
  if (scheduledUpdate.added && scheduledUpdate.events.length > 0) {
7362
7443
  await publishDurableSessionEvents(
7363
7444
  input.bus,
@@ -7613,6 +7694,7 @@ async function dispatchMaintenanceSession(service, maintenance, dependencies) {
7613
7694
  initialMessage: maintenancePrompt(maintenance),
7614
7695
  // OpenGeni's own periodic check: no human or product surface entered it.
7615
7696
  surface: "system",
7697
+ metrics: service.observability,
7616
7698
  resources: [],
7617
7699
  tools: [{ kind: "mcp", id: "opengeni" }],
7618
7700
  toolPolicy: { mode: "explicit", inheritedFromSessionId: null },
@@ -8306,4 +8388,4 @@ export {
8306
8388
  createControlActivities,
8307
8389
  createControlActivitiesFromServices
8308
8390
  };
8309
- //# sourceMappingURL=activities-control-55ECL47G.js.map
8391
+ //# sourceMappingURL=activities-control-RDA4E2DM.js.map