@opengeni/api-router 3.1.3-canary.38890816741001 → 3.3.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.
Files changed (47) hide show
  1. package/dist/app.js +1 -1
  2. package/dist/{chunk-OT56OY4V.js → chunk-6CECHDZP.js} +1569 -399
  3. package/dist/{chunk-OT56OY4V.js.map → chunk-6CECHDZP.js.map} +1 -1
  4. package/dist/index.js +50 -2
  5. package/dist/index.js.map +1 -1
  6. package/dist/integrations/external-vault-providers.d.ts +29 -0
  7. package/dist/interaction-secrets-vault.d.ts +2 -2
  8. package/dist/mcp/action-descriptions.d.ts +1 -1
  9. package/dist/mcp/scheduled-task-view.d.ts +4 -4
  10. package/dist/routes/vault-providers.d.ts +4 -2
  11. package/dist/sandbox/channel-a.d.ts +10 -1
  12. package/dist/shutdown.d.ts +14 -0
  13. package/dist/site-publishing/agent-data-tools.d.ts +5 -5
  14. package/dist/site-publishing/agent-session.d.ts +3 -2
  15. package/dist/site-publishing/runtime.d.ts +7 -6
  16. package/dist/site-publishing/service.d.ts +8 -11
  17. package/dist/site-publishing/session-request-authority.d.ts +3 -0
  18. package/dist/workspace-tool-gateway-secrets.d.ts +1 -1
  19. package/package.json +25 -22
  20. package/src/access-grant-rls.ts +1 -0
  21. package/src/app.ts +14 -2
  22. package/src/http/sse.ts +5 -1
  23. package/src/index.ts +13 -1
  24. package/src/integrations/external-vault-providers.ts +136 -0
  25. package/src/interaction-secrets-vault.ts +6 -2
  26. package/src/mcp/action-catalog.gen.ts +253 -4
  27. package/src/mcp/action-descriptions.ts +32 -2
  28. package/src/mcp/action-schema-imports.gen.ts +3 -1
  29. package/src/routes/browser-sessions.ts +61 -17
  30. package/src/routes/computer-sessions.ts +102 -39
  31. package/src/routes/connections.ts +17 -0
  32. package/src/routes/insights-usage.ts +22 -0
  33. package/src/routes/sessions.ts +22 -4
  34. package/src/routes/site-runtime.ts +62 -20
  35. package/src/routes/vault-providers.ts +788 -29
  36. package/src/routes/vaults.ts +5 -1
  37. package/src/sandbox/channel-a.ts +18 -1
  38. package/src/sandbox/metrics-ingestion.ts +1 -0
  39. package/src/shutdown.ts +54 -0
  40. package/src/site-frame-guard.ts +11 -2
  41. package/src/site-publishing/agent-data-tools.ts +16 -8
  42. package/src/site-publishing/agent-session.ts +24 -6
  43. package/src/site-publishing/runtime.ts +29 -7
  44. package/src/site-publishing/service.ts +65 -77
  45. package/src/site-publishing/session-request-authority.ts +14 -0
  46. package/src/workspace-tool-gateway-secrets.ts +9 -2
  47. package/src/workspace-tool-gateway.ts +6 -2
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ import {
3
3
  SlackBotProviderError,
4
4
  apiRequestBindingsForTransportPeer,
5
5
  cleanupScheduledTaskConnectorAuthorization,
6
+ closeNativeExternalVaultProviders,
6
7
  createAppComposition,
7
8
  createAutomaticAgentUpdater,
8
9
  createLocalBrowserBoundary,
@@ -14,7 +15,7 @@ import {
14
15
  startSlackInteractionPump,
15
16
  startTemporalScheduleCleanupPump,
16
17
  withAccessGrantSessionRlsContext
17
- } from "./chunk-OT56OY4V.js";
18
+ } from "./chunk-6CECHDZP.js";
18
19
  import "./chunk-OGQDXVXY.js";
19
20
 
20
21
  // src/index.ts
@@ -821,6 +822,7 @@ function helloRuntimeCapabilities(hello) {
821
822
  operationCpuQuota: caps.operationCpuQuota === true,
822
823
  transactionalFsWrite: caps.transactionalFsWrite === true,
823
824
  credentialRenew: caps.credentialRenew === true,
825
+ browserControlHttp: caps.browserControlHttp === true,
824
826
  screenControl: caps.consentedScreenControl === true,
825
827
  ...caps.macPermissions ? enrollmentMacPermissionCapabilities(caps.macPermissions) : {}
826
828
  };
@@ -3794,6 +3796,44 @@ function defaultProcessBoundary() {
3794
3796
  };
3795
3797
  }
3796
3798
 
3799
+ // src/shutdown.ts
3800
+ function installApiShutdownHandlers(input) {
3801
+ const runtime = input.process ?? process;
3802
+ let started = false;
3803
+ let finished = false;
3804
+ let deadline;
3805
+ const dispose = () => {
3806
+ runtime.off("SIGINT", shutdown);
3807
+ runtime.off("SIGTERM", shutdown);
3808
+ };
3809
+ const finish = (code) => {
3810
+ if (finished) return;
3811
+ finished = true;
3812
+ clearTimeout(deadline);
3813
+ dispose();
3814
+ if (code !== 0) {
3815
+ try {
3816
+ input.onFailure?.();
3817
+ } catch {
3818
+ }
3819
+ }
3820
+ runtime.exit(code);
3821
+ };
3822
+ function shutdown() {
3823
+ if (started) return;
3824
+ started = true;
3825
+ deadline = setTimeout(() => finish(1), input.timeoutMs ?? 3e4);
3826
+ deadline.unref?.();
3827
+ void Promise.resolve().then(input.close).then(
3828
+ () => finish(0),
3829
+ () => finish(1)
3830
+ );
3831
+ }
3832
+ runtime.on("SIGINT", shutdown);
3833
+ runtime.on("SIGTERM", shutdown);
3834
+ return dispose;
3835
+ }
3836
+
3797
3837
  // src/index.ts
3798
3838
  function isWorkflowAlreadyStarted(error) {
3799
3839
  return error instanceof WorkflowExecutionAlreadyStartedError;
@@ -4239,6 +4279,7 @@ async function startApi(options = {}) {
4239
4279
  server,
4240
4280
  close: async () => {
4241
4281
  server.stop(true);
4282
+ const vaultProvidersClosed = closeNativeExternalVaultProviders().catch(() => void 0);
4242
4283
  metricsServer?.stop(true);
4243
4284
  stopSlackInteractionPump?.();
4244
4285
  await stopMemorySlackPublicationPump();
@@ -4250,6 +4291,7 @@ async function startApi(options = {}) {
4250
4291
  await stopNativePushDispatchPump();
4251
4292
  await routeDeps.userPresence?.close().catch(() => void 0);
4252
4293
  await Promise.allSettled([
4294
+ vaultProvidersClosed,
4253
4295
  Promise.resolve(editableArtifactComposition?.close()),
4254
4296
  authCalloutResponder?.close(),
4255
4297
  bus.close(),
@@ -4265,7 +4307,13 @@ if (import.meta.main) {
4265
4307
  const settings = getSettings();
4266
4308
  const observability = createObservability(settings, { component: "api" });
4267
4309
  fatalBoundary.attachObservability(observability);
4268
- await startApi({ settings, observability });
4310
+ const api = await startApi({ settings, observability });
4311
+ installApiShutdownHandlers({
4312
+ close: api.close,
4313
+ onFailure: () => observability.warn("Opengeni API shutdown did not finish cleanly", {
4314
+ errorCode: "api_shutdown_failed"
4315
+ })
4316
+ });
4269
4317
  fatalBoundary.markRunning();
4270
4318
  } catch (error) {
4271
4319
  await fatalBoundary.reportStartupFailure(error);