@opengeni/api-router 2.10.0-canary.2 → 2.10.0-canary.4
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 +1 -1
- package/dist/{chunk-BVX5ASFY.js → chunk-NWSVDE7O.js} +70 -21
- package/dist/{chunk-BVX5ASFY.js.map → chunk-NWSVDE7O.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/scheduled-task-view.d.ts +3 -3
- package/package.json +19 -19
- package/src/app.ts +4 -0
- package/src/routes/codex.ts +1 -1
- package/src/routes/video-generation.ts +2 -1
- package/src/routes/workspace-artifacts.ts +17 -3
- package/src/routes/workspace-learning.ts +5 -4
- package/src/routes/workspaces.ts +47 -10
package/dist/app.js
CHANGED
|
@@ -27892,7 +27892,7 @@ function registerCodexRoutes(app, deps) {
|
|
|
27892
27892
|
accountId: grant.accountId,
|
|
27893
27893
|
workspaceId,
|
|
27894
27894
|
subjectId: grant.subjectId,
|
|
27895
|
-
mode:
|
|
27895
|
+
mode: "workspace",
|
|
27896
27896
|
effectiveSourceBeforeMutation: sourceBeforeConnect.effectiveSource
|
|
27897
27897
|
});
|
|
27898
27898
|
const rotation = await getCodexRotationSettings(tx, workspaceId);
|
|
@@ -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,
|
|
@@ -57011,6 +57013,7 @@ import {
|
|
|
57011
57013
|
hasPermission as hasPermission20,
|
|
57012
57014
|
requireAccessContext as requireAccessContext3,
|
|
57013
57015
|
requireAccessGrant as requireAccessGrant32,
|
|
57016
|
+
requireWorkspaceSettingsGrant,
|
|
57014
57017
|
requireFreshAccessGrant as requireFreshAccessGrant3,
|
|
57015
57018
|
resolveWorkspaceCatalogSettings as resolveWorkspaceCatalogSettings7
|
|
57016
57019
|
} from "@opengeni/core";
|
|
@@ -57018,7 +57021,8 @@ import { requireLimit as requireLimit9 } from "@opengeni/core";
|
|
|
57018
57021
|
import {
|
|
57019
57022
|
assertWorkspaceMemberRemovable,
|
|
57020
57023
|
assertWorkspaceMemberUpdateAllowed,
|
|
57021
|
-
controlHumanWorkspace
|
|
57024
|
+
controlHumanWorkspace,
|
|
57025
|
+
controlHumanWorkspaceTimer
|
|
57022
57026
|
} from "@opengeni/core";
|
|
57023
57027
|
|
|
57024
57028
|
// src/workspace-deletion.ts
|
|
@@ -57358,7 +57362,7 @@ function registerWorkspaceRoutes(app, deps) {
|
|
|
57358
57362
|
});
|
|
57359
57363
|
app.patch("/v1/workspaces/:workspaceId/settings", async (c) => {
|
|
57360
57364
|
const workspaceId = c.req.param("workspaceId");
|
|
57361
|
-
await
|
|
57365
|
+
await requireWorkspaceSettingsGrant(c, deps, workspaceId);
|
|
57362
57366
|
const parsed = UpdateWorkspaceSettingsRequest.safeParse(await c.req.json());
|
|
57363
57367
|
if (!parsed.success) {
|
|
57364
57368
|
throw new HTTPException60(400, {
|
|
@@ -57458,7 +57462,7 @@ function registerWorkspaceRoutes(app, deps) {
|
|
|
57458
57462
|
});
|
|
57459
57463
|
app.post("/v1/workspaces/:workspaceId/gateway-custom-models", async (c) => {
|
|
57460
57464
|
const workspaceId = c.req.param("workspaceId");
|
|
57461
|
-
const grant = await
|
|
57465
|
+
const grant = await requireWorkspaceSettingsGrant(c, deps, workspaceId);
|
|
57462
57466
|
const parsed = CreateWorkspaceGatewayCustomModelRequest.safeParse(
|
|
57463
57467
|
await c.req.json().catch(() => null)
|
|
57464
57468
|
);
|
|
@@ -57530,7 +57534,7 @@ function registerWorkspaceRoutes(app, deps) {
|
|
|
57530
57534
|
});
|
|
57531
57535
|
app.delete("/v1/workspaces/:workspaceId/gateway-custom-models/:customModelId", async (c) => {
|
|
57532
57536
|
const workspaceId = c.req.param("workspaceId");
|
|
57533
|
-
const grant = await
|
|
57537
|
+
const grant = await requireWorkspaceSettingsGrant(c, deps, workspaceId);
|
|
57534
57538
|
const customModelId = c.req.param("customModelId");
|
|
57535
57539
|
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu.test(
|
|
57536
57540
|
customModelId
|
|
@@ -57587,7 +57591,7 @@ function registerWorkspaceRoutes(app, deps) {
|
|
|
57587
57591
|
});
|
|
57588
57592
|
app.post("/v1/workspaces/:workspaceId/openrouter-custom-models", async (c) => {
|
|
57589
57593
|
const workspaceId = c.req.param("workspaceId");
|
|
57590
|
-
const grant = await
|
|
57594
|
+
const grant = await requireWorkspaceSettingsGrant(c, deps, workspaceId);
|
|
57591
57595
|
const parsed = CreateWorkspaceOpenRouterCustomModelRequest.safeParse(
|
|
57592
57596
|
await c.req.json().catch(() => null)
|
|
57593
57597
|
);
|
|
@@ -57659,7 +57663,7 @@ function registerWorkspaceRoutes(app, deps) {
|
|
|
57659
57663
|
});
|
|
57660
57664
|
app.delete("/v1/workspaces/:workspaceId/openrouter-custom-models/:customModelId", async (c) => {
|
|
57661
57665
|
const workspaceId = c.req.param("workspaceId");
|
|
57662
|
-
const grant = await
|
|
57666
|
+
const grant = await requireWorkspaceSettingsGrant(c, deps, workspaceId);
|
|
57663
57667
|
const customModelId = c.req.param("customModelId");
|
|
57664
57668
|
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu.test(
|
|
57665
57669
|
customModelId
|
|
@@ -57763,7 +57767,7 @@ function registerWorkspaceRoutes(app, deps) {
|
|
|
57763
57767
|
});
|
|
57764
57768
|
app.put("/v1/workspaces/:workspaceId/model-policy", async (c) => {
|
|
57765
57769
|
const workspaceId = c.req.param("workspaceId");
|
|
57766
|
-
const grant = await
|
|
57770
|
+
const grant = await requireWorkspaceSettingsGrant(c, deps, workspaceId);
|
|
57767
57771
|
const payload = UpdateWorkspaceModelPolicyRequest.parse(await c.req.json());
|
|
57768
57772
|
const catalog = await resolveWorkspaceCatalogSettings7(deps.db, deps.settings, {
|
|
57769
57773
|
accountId: grant.accountId,
|
|
@@ -57777,9 +57781,39 @@ function registerWorkspaceRoutes(app, deps) {
|
|
|
57777
57781
|
});
|
|
57778
57782
|
return c.json(policy);
|
|
57779
57783
|
});
|
|
57784
|
+
app.post("/v1/workspaces/:workspaceId/pause-timer", async (c) => {
|
|
57785
|
+
const workspaceId = c.req.param("workspaceId");
|
|
57786
|
+
const grant = await requireWorkspaceSettingsGrant(c, deps, workspaceId);
|
|
57787
|
+
if (workspaceControlUtf8Bytes2(grant.subjectId) > WORKSPACE_CONTROL_ACTOR_MAX_BYTES2) {
|
|
57788
|
+
throw new HTTPException60(400, { message: "workspace-control actor is too large" });
|
|
57789
|
+
}
|
|
57790
|
+
const parsed = WorkspacePauseTimerRequest.safeParse(await c.req.json().catch(() => null));
|
|
57791
|
+
if (!parsed.success) throw new HTTPException60(400, { message: "Invalid pause timer" });
|
|
57792
|
+
try {
|
|
57793
|
+
await controlHumanWorkspaceTimer(
|
|
57794
|
+
{
|
|
57795
|
+
db: deps.db,
|
|
57796
|
+
bus: deps.bus,
|
|
57797
|
+
workflowClient: deps.workflowClient,
|
|
57798
|
+
...deps.schedulePromptPostCommit ? { schedulePromptPostCommit: deps.schedulePromptPostCommit } : {}
|
|
57799
|
+
},
|
|
57800
|
+
{ accountId: grant.accountId, workspaceId, subjectId: grant.subjectId },
|
|
57801
|
+
parsed.data
|
|
57802
|
+
);
|
|
57803
|
+
} catch (error) {
|
|
57804
|
+
if (error instanceof SessionControlConflictError2)
|
|
57805
|
+
throw new HTTPException60(409, {
|
|
57806
|
+
message: "Workspace changed. Reopen the timer and try again."
|
|
57807
|
+
});
|
|
57808
|
+
if (error instanceof WorkspacePauseTimerInputError)
|
|
57809
|
+
throw new HTTPException60(400, { message: error.message });
|
|
57810
|
+
throw error;
|
|
57811
|
+
}
|
|
57812
|
+
return c.json({ ok: true });
|
|
57813
|
+
});
|
|
57780
57814
|
app.post("/v1/workspaces/:workspaceId/inference-control", async (c) => {
|
|
57781
57815
|
const workspaceId = c.req.param("workspaceId");
|
|
57782
|
-
const grant = await
|
|
57816
|
+
const grant = await requireWorkspaceSettingsGrant(c, deps, workspaceId);
|
|
57783
57817
|
if (workspaceControlUtf8Bytes2(grant.subjectId) > WORKSPACE_CONTROL_ACTOR_MAX_BYTES2) {
|
|
57784
57818
|
throw new HTTPException60(400, {
|
|
57785
57819
|
message: "workspace-control actor is too large"
|
|
@@ -58422,7 +58456,8 @@ import {
|
|
|
58422
58456
|
} from "@opengeni/contracts";
|
|
58423
58457
|
import {
|
|
58424
58458
|
publishGovernedLearningEventToSlack,
|
|
58425
|
-
requireAccessGrant as requireAccessGrant34
|
|
58459
|
+
requireAccessGrant as requireAccessGrant34,
|
|
58460
|
+
requireWorkspaceSettingsGrant as requireWorkspaceSettingsGrant2
|
|
58426
58461
|
} from "@opengeni/core";
|
|
58427
58462
|
import {
|
|
58428
58463
|
activateWorkspaceLearningPolicyRevision,
|
|
@@ -58515,7 +58550,7 @@ function registerWorkspaceLearningRoutes(app, deps) {
|
|
|
58515
58550
|
});
|
|
58516
58551
|
app.post(`${base}/revisions`, async (context) => {
|
|
58517
58552
|
const workspaceId = context.req.param("workspaceId");
|
|
58518
|
-
const grant = await
|
|
58553
|
+
const grant = await requireWorkspaceSettingsGrant2(context, deps, workspaceId);
|
|
58519
58554
|
const request = await parseBody2(context, CreateWorkspaceLearningPolicyRevisionRequest);
|
|
58520
58555
|
try {
|
|
58521
58556
|
return context.json(
|
|
@@ -58541,7 +58576,7 @@ function registerWorkspaceLearningRoutes(app, deps) {
|
|
|
58541
58576
|
const workspaceId = context.req.param("workspaceId");
|
|
58542
58577
|
const revisionId2 = z18.string().uuid().safeParse(context.req.param("revisionId"));
|
|
58543
58578
|
if (!revisionId2.success) throw new HTTPException62(422, { message: "Invalid revision id" });
|
|
58544
|
-
const grant = await
|
|
58579
|
+
const grant = await requireWorkspaceSettingsGrant2(context, deps, workspaceId);
|
|
58545
58580
|
const request = await parseBody2(context, ActivateWorkspaceLearningPolicyRevisionRequest);
|
|
58546
58581
|
try {
|
|
58547
58582
|
return context.json(
|
|
@@ -58565,7 +58600,7 @@ function registerWorkspaceLearningRoutes(app, deps) {
|
|
|
58565
58600
|
});
|
|
58566
58601
|
app.post(`${base}/rollback`, async (context) => {
|
|
58567
58602
|
const workspaceId = context.req.param("workspaceId");
|
|
58568
|
-
const grant = await
|
|
58603
|
+
const grant = await requireWorkspaceSettingsGrant2(context, deps, workspaceId);
|
|
58569
58604
|
const request = await parseBody2(context, RollbackWorkspaceLearningPolicyRevisionRequest);
|
|
58570
58605
|
try {
|
|
58571
58606
|
return context.json(
|
|
@@ -58593,7 +58628,7 @@ function registerWorkspaceLearningRoutes(app, deps) {
|
|
|
58593
58628
|
if (!activationReceiptId.success) {
|
|
58594
58629
|
throw new HTTPException62(422, { message: "Invalid activation receipt id" });
|
|
58595
58630
|
}
|
|
58596
|
-
const grant = await
|
|
58631
|
+
const grant = await requireWorkspaceSettingsGrant2(context, deps, workspaceId);
|
|
58597
58632
|
const request = await parseBody2(context, UndoGovernedLearningActivationHttpRequest);
|
|
58598
58633
|
try {
|
|
58599
58634
|
const undo = await undoGovernedLearningActivation(deps.db, {
|
|
@@ -60188,7 +60223,9 @@ function registerWorkspaceArtifactRoutes(app, deps) {
|
|
|
60188
60223
|
const workspaceId = context.req.param("workspaceId");
|
|
60189
60224
|
await requireAccessGrant39(context, deps, workspaceId, "artifacts:read");
|
|
60190
60225
|
if (!deps.objectStorage)
|
|
60191
|
-
throw new HTTPException67(503, {
|
|
60226
|
+
throw new HTTPException67(503, {
|
|
60227
|
+
message: "Object storage is not configured"
|
|
60228
|
+
});
|
|
60192
60229
|
const ref = await getWorkspaceArtifactContentRef2(
|
|
60193
60230
|
deps.db,
|
|
60194
60231
|
workspaceId,
|
|
@@ -60199,13 +60236,17 @@ function registerWorkspaceArtifactRoutes(app, deps) {
|
|
|
60199
60236
|
});
|
|
60200
60237
|
app.get(base, async (context) => {
|
|
60201
60238
|
const workspaceId = context.req.param("workspaceId");
|
|
60202
|
-
await requireAccessGrant39(context, deps, workspaceId, "artifacts:read");
|
|
60239
|
+
const grant = await requireAccessGrant39(context, deps, workspaceId, "artifacts:read");
|
|
60203
60240
|
const query = WorkspaceArtifactListQuery.safeParse({
|
|
60204
60241
|
limit: context.req.query("limit"),
|
|
60205
60242
|
cursor: context.req.query("cursor"),
|
|
60206
|
-
status: context.req.query("status")
|
|
60243
|
+
status: context.req.query("status"),
|
|
60244
|
+
sourceSessionId: context.req.query("sourceSessionId")
|
|
60207
60245
|
});
|
|
60208
60246
|
if (!query.success) throw new HTTPException67(422, { message: "Invalid artifact list query" });
|
|
60247
|
+
if (query.data.sourceSessionId && !await canReadProvenanceSession(deps, grant, query.data.sourceSessionId)) {
|
|
60248
|
+
throw new HTTPException67(404, { message: "Session not found" });
|
|
60249
|
+
}
|
|
60209
60250
|
try {
|
|
60210
60251
|
return context.json(
|
|
60211
60252
|
WorkspaceArtifactListResponse.parse(
|
|
@@ -60213,7 +60254,8 @@ function registerWorkspaceArtifactRoutes(app, deps) {
|
|
|
60213
60254
|
await listWorkspaceArtifacts2(deps.db, workspaceId, {
|
|
60214
60255
|
limit: query.data.limit,
|
|
60215
60256
|
...query.data.cursor ? { cursor: query.data.cursor } : {},
|
|
60216
|
-
...query.data.status ? { status: query.data.status } : {}
|
|
60257
|
+
...query.data.status ? { status: query.data.status } : {},
|
|
60258
|
+
...query.data.sourceSessionId ? { sourceSessionId: query.data.sourceSessionId } : {}
|
|
60217
60259
|
})
|
|
60218
60260
|
)
|
|
60219
60261
|
)
|
|
@@ -60285,7 +60327,9 @@ function registerWorkspaceArtifactRoutes(app, deps) {
|
|
|
60285
60327
|
const workspaceId = context.req.param("workspaceId");
|
|
60286
60328
|
await requireAccessGrant39(context, deps, workspaceId, "artifacts:read");
|
|
60287
60329
|
if (!deps.objectStorage)
|
|
60288
|
-
throw new HTTPException67(503, {
|
|
60330
|
+
throw new HTTPException67(503, {
|
|
60331
|
+
message: "Object storage is not configured"
|
|
60332
|
+
});
|
|
60289
60333
|
const ref = await getWorkspaceArtifactContentRef2(
|
|
60290
60334
|
deps.db,
|
|
60291
60335
|
workspaceId,
|
|
@@ -61997,6 +62041,7 @@ import {
|
|
|
61997
62041
|
} from "@opengeni/db";
|
|
61998
62042
|
import {
|
|
61999
62043
|
requireAccessGrant as requireAccessGrant44,
|
|
62044
|
+
requireWorkspaceSettingsGrant as requireWorkspaceSettingsGrant3,
|
|
62000
62045
|
VIDEO_GENERATION_MODEL_CATALOG,
|
|
62001
62046
|
videoGenerationModelSupportsFundingSource,
|
|
62002
62047
|
videoGenerationCapabilitiesForPolicy
|
|
@@ -62033,7 +62078,7 @@ function registerVideoGenerationRoutes(app, deps) {
|
|
|
62033
62078
|
});
|
|
62034
62079
|
app.put("/v1/workspaces/:workspaceId/video-generation/policy", async (c) => {
|
|
62035
62080
|
const workspaceId = c.req.param("workspaceId");
|
|
62036
|
-
const grant = await
|
|
62081
|
+
const grant = await requireWorkspaceSettingsGrant3(c, deps, workspaceId);
|
|
62037
62082
|
const payload = UpdateVideoGenerationPolicyRequest.parse(await c.req.json());
|
|
62038
62083
|
const [connection, supergrokConfigured] = await Promise.all([
|
|
62039
62084
|
getWorkspaceVercelAiGatewayConnectionMetadata(deps.db, workspaceId),
|
|
@@ -71253,6 +71298,10 @@ var routeLabelPatterns = [
|
|
|
71253
71298
|
pattern: /^\/v1\/workspaces\/[^/]+\/inference-control$/,
|
|
71254
71299
|
label: "/v1/workspaces/:workspaceId/inference-control"
|
|
71255
71300
|
},
|
|
71301
|
+
{
|
|
71302
|
+
pattern: /^\/v1\/workspaces\/[^/]+\/pause-timer$/,
|
|
71303
|
+
label: "/v1/workspaces/:workspaceId/pause-timer"
|
|
71304
|
+
},
|
|
71256
71305
|
{
|
|
71257
71306
|
pattern: /^\/v1\/workspaces\/[^/]+\/sessions\/[^/]+\/fs\/(list|list-batch|read|write|delete|move|mkdir)$/,
|
|
71258
71307
|
label: "/v1/workspaces/:workspaceId/sessions/:id/fs/:operation"
|
|
@@ -71853,4 +71902,4 @@ export {
|
|
|
71853
71902
|
withDefaultEnabledCapabilityMcpTools,
|
|
71854
71903
|
workflowIdForSession4 as workflowIdForSession
|
|
71855
71904
|
};
|
|
71856
|
-
//# sourceMappingURL=chunk-
|
|
71905
|
+
//# sourceMappingURL=chunk-NWSVDE7O.js.map
|