File size: 3,293 Bytes
f778c12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Lazy lifecycle runtime export hub used by gateway run-loop restart paths.
// run-loop.ts primes this hub before the HTTP listener binds, so each re-export
// must target the module that defines the symbol rather than a re-export facade;
// a facade also evaluates its siblings and drags their graphs onto cold start.
export { abortEmbeddedAgentRun } from "../../agents/embedded-agent-runner/runs.js";
export { listActiveEmbeddedRunSessionIds } from "../../agents/embedded-agent-runner/active-run-projections.js";
export { getDiagnosticSessionActivitySnapshot } from "../../logging/diagnostic-run-activity.js";
export { LAUNCH_AGENT_EXIT_TIMEOUT_SECONDS } from "../../daemon/launchd-plist.js";
export {
  respawnGatewayProcessForUpdate,
  restartGatewayProcessWithFreshPid,
} from "../../infra/process-respawn.js";
export {
  resolveGatewayRestartDeferralTimeoutMs,
  consumeGatewaySigusr1RestartIntent,
  consumeGatewaySigusr1RestartAuthorization,
  isGatewaySigusr1RestartExternallyAllowed,
  markGatewaySigusr1RestartHandled,
  peekGatewaySigusr1RestartReason,
  resetGatewayRestartStateForInProcessRestart,
  requestGatewayRestartWithSignalAdmission,
  rollbackGatewayRestartSignalAdmission,
  scheduleGatewaySigusr1Restart,
} from "../../infra/restart.js";
export {
  consumeGatewayRestartIntentPayloadSync,
  consumeGatewayRestartIntentSync,
} from "../../infra/restart-intent.js";
export { writeGatewayRestartHandoffSync } from "../../infra/restart-handoff.js";
export {
  cancelManagedServiceUpdateHandoff,
  claimManagedServiceUpdateHandoff,
  commitManagedServiceUpdateHandoff,
  requestManagedServiceUpdateHandoffPark,
} from "../../infra/update-managed-service-handoff.js";
export { resetGatewaySuspendCoordinatorForLifecycleRestart } from "../../infra/gateway-suspend-coordinator.js";
export { rotateAgentEventLifecycleGeneration } from "../../infra/agent-events.js";
export { markUpdateRestartSentinelFailure } from "../../infra/restart-sentinel.js";
export {
  detectGatewayRespawnSupervisor,
  detectGatewayRespawnSupervisorIdentity,
  detectRespawnSupervisor,
} from "../../infra/supervisor-markers.js";
export { writeDiagnosticStabilityBundleForFailureSync } from "../../logging/diagnostic-stability-bundle.js";
export {
  createGatewayActiveWorkSnapshot,
  waitForGatewayActiveWork,
} from "../../infra/gateway-active-work.js";
export {
  advanceCronActiveJobGeneration,
  resetCronActiveJobs,
  waitForActiveCronJobs,
} from "../../cron/active-jobs.js";
export {
  abortActiveCronTaskRuns,
  retireActiveCronTaskRunTracking,
  waitForActiveCronTaskRuns,
} from "../../cron/service/active-run-cancellation.js";
export { markGatewayDraining, resetAllLanes } from "../../process/command-queue.js";
export { reloadTaskRuntimeStateFromStore } from "../../tasks/runtime-internal.js";
export { abortPendingChannelReloads } from "../../gateway/server-reload-generation.js";

export async function stopGatewayManagedProviderLocalServices(): Promise<void> {
  const { hasManagedProviderLocalServices } =
    await import("../../agents/provider-runtime-lifecycle.js");
  if (!hasManagedProviderLocalServices()) {
    return;
  }
  const { stopManagedProviderLocalServices } =
    await import("../../agents/provider-local-service.js");
  await stopManagedProviderLocalServices();
}