@opengeni/api-router 2.10.0-canary.2 → 2.10.0-canary.3

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/app.js CHANGED
@@ -24,7 +24,7 @@ import {
24
24
  withDefaultEnabledCapabilityMcpTools,
25
25
  workflowIdForSession,
26
26
  workspaceActorContextExempt
27
- } from "./chunk-BVX5ASFY.js";
27
+ } from "./chunk-CZGPIPDA.js";
28
28
  export {
29
29
  API_MAX_REQUEST_BODY_BYTES,
30
30
  allowedCorsOrigin,
@@ -56928,6 +56928,8 @@ function socialHttpException(error) {
56928
56928
  }
56929
56929
 
56930
56930
  // src/routes/workspaces.ts
56931
+ import { SessionControlConflictError as SessionControlConflictError2, WorkspacePauseTimerInputError } from "@opengeni/db";
56932
+ import { WorkspacePauseTimerRequest } from "@opengeni/contracts";
56931
56933
  import { createHash as createHash18 } from "crypto";
56932
56934
  import {
56933
56935
  AddWorkspaceMemberRequest,
@@ -57018,7 +57020,8 @@ import { requireLimit as requireLimit9 } from "@opengeni/core";
57018
57020
  import {
57019
57021
  assertWorkspaceMemberRemovable,
57020
57022
  assertWorkspaceMemberUpdateAllowed,
57021
- controlHumanWorkspace
57023
+ controlHumanWorkspace,
57024
+ controlHumanWorkspaceTimer
57022
57025
  } from "@opengeni/core";
57023
57026
 
57024
57027
  // src/workspace-deletion.ts
@@ -57777,6 +57780,36 @@ function registerWorkspaceRoutes(app, deps) {
57777
57780
  });
57778
57781
  return c.json(policy);
57779
57782
  });
57783
+ app.post("/v1/workspaces/:workspaceId/pause-timer", async (c) => {
57784
+ const workspaceId = c.req.param("workspaceId");
57785
+ const grant = await requireAccessGrant32(c, deps, workspaceId, "workspace:admin");
57786
+ if (workspaceControlUtf8Bytes2(grant.subjectId) > WORKSPACE_CONTROL_ACTOR_MAX_BYTES2) {
57787
+ throw new HTTPException60(400, { message: "workspace-control actor is too large" });
57788
+ }
57789
+ const parsed = WorkspacePauseTimerRequest.safeParse(await c.req.json().catch(() => null));
57790
+ if (!parsed.success) throw new HTTPException60(400, { message: "Invalid pause timer" });
57791
+ try {
57792
+ await controlHumanWorkspaceTimer(
57793
+ {
57794
+ db: deps.db,
57795
+ bus: deps.bus,
57796
+ workflowClient: deps.workflowClient,
57797
+ ...deps.schedulePromptPostCommit ? { schedulePromptPostCommit: deps.schedulePromptPostCommit } : {}
57798
+ },
57799
+ { accountId: grant.accountId, workspaceId, subjectId: grant.subjectId },
57800
+ parsed.data
57801
+ );
57802
+ } catch (error) {
57803
+ if (error instanceof SessionControlConflictError2)
57804
+ throw new HTTPException60(409, {
57805
+ message: "Workspace changed. Reopen the timer and try again."
57806
+ });
57807
+ if (error instanceof WorkspacePauseTimerInputError)
57808
+ throw new HTTPException60(400, { message: error.message });
57809
+ throw error;
57810
+ }
57811
+ return c.json({ ok: true });
57812
+ });
57780
57813
  app.post("/v1/workspaces/:workspaceId/inference-control", async (c) => {
57781
57814
  const workspaceId = c.req.param("workspaceId");
57782
57815
  const grant = await requireAccessGrant32(c, deps, workspaceId, "workspace:admin");
@@ -71253,6 +71286,10 @@ var routeLabelPatterns = [
71253
71286
  pattern: /^\/v1\/workspaces\/[^/]+\/inference-control$/,
71254
71287
  label: "/v1/workspaces/:workspaceId/inference-control"
71255
71288
  },
71289
+ {
71290
+ pattern: /^\/v1\/workspaces\/[^/]+\/pause-timer$/,
71291
+ label: "/v1/workspaces/:workspaceId/pause-timer"
71292
+ },
71256
71293
  {
71257
71294
  pattern: /^\/v1\/workspaces\/[^/]+\/sessions\/[^/]+\/fs\/(list|list-batch|read|write|delete|move|mkdir)$/,
71258
71295
  label: "/v1/workspaces/:workspaceId/sessions/:id/fs/:operation"
@@ -71853,4 +71890,4 @@ export {
71853
71890
  withDefaultEnabledCapabilityMcpTools,
71854
71891
  workflowIdForSession4 as workflowIdForSession
71855
71892
  };
71856
- //# sourceMappingURL=chunk-BVX5ASFY.js.map
71893
+ //# sourceMappingURL=chunk-CZGPIPDA.js.map