@opengeni/api-router 2.10.0-canary.3 → 2.10.0-canary.5
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-CZGPIPDA.js → chunk-NWSVDE7O.js} +33 -21
- package/dist/{chunk-CZGPIPDA.js.map → chunk-NWSVDE7O.js.map} +1 -1
- package/dist/index.js +1 -1
- package/package.json +19 -19
- 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 +12 -11
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);
|
|
@@ -57013,6 +57013,7 @@ import {
|
|
|
57013
57013
|
hasPermission as hasPermission20,
|
|
57014
57014
|
requireAccessContext as requireAccessContext3,
|
|
57015
57015
|
requireAccessGrant as requireAccessGrant32,
|
|
57016
|
+
requireWorkspaceSettingsGrant,
|
|
57016
57017
|
requireFreshAccessGrant as requireFreshAccessGrant3,
|
|
57017
57018
|
resolveWorkspaceCatalogSettings as resolveWorkspaceCatalogSettings7
|
|
57018
57019
|
} from "@opengeni/core";
|
|
@@ -57361,7 +57362,7 @@ function registerWorkspaceRoutes(app, deps) {
|
|
|
57361
57362
|
});
|
|
57362
57363
|
app.patch("/v1/workspaces/:workspaceId/settings", async (c) => {
|
|
57363
57364
|
const workspaceId = c.req.param("workspaceId");
|
|
57364
|
-
await
|
|
57365
|
+
await requireWorkspaceSettingsGrant(c, deps, workspaceId);
|
|
57365
57366
|
const parsed = UpdateWorkspaceSettingsRequest.safeParse(await c.req.json());
|
|
57366
57367
|
if (!parsed.success) {
|
|
57367
57368
|
throw new HTTPException60(400, {
|
|
@@ -57461,7 +57462,7 @@ function registerWorkspaceRoutes(app, deps) {
|
|
|
57461
57462
|
});
|
|
57462
57463
|
app.post("/v1/workspaces/:workspaceId/gateway-custom-models", async (c) => {
|
|
57463
57464
|
const workspaceId = c.req.param("workspaceId");
|
|
57464
|
-
const grant = await
|
|
57465
|
+
const grant = await requireWorkspaceSettingsGrant(c, deps, workspaceId);
|
|
57465
57466
|
const parsed = CreateWorkspaceGatewayCustomModelRequest.safeParse(
|
|
57466
57467
|
await c.req.json().catch(() => null)
|
|
57467
57468
|
);
|
|
@@ -57533,7 +57534,7 @@ function registerWorkspaceRoutes(app, deps) {
|
|
|
57533
57534
|
});
|
|
57534
57535
|
app.delete("/v1/workspaces/:workspaceId/gateway-custom-models/:customModelId", async (c) => {
|
|
57535
57536
|
const workspaceId = c.req.param("workspaceId");
|
|
57536
|
-
const grant = await
|
|
57537
|
+
const grant = await requireWorkspaceSettingsGrant(c, deps, workspaceId);
|
|
57537
57538
|
const customModelId = c.req.param("customModelId");
|
|
57538
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(
|
|
57539
57540
|
customModelId
|
|
@@ -57590,7 +57591,7 @@ function registerWorkspaceRoutes(app, deps) {
|
|
|
57590
57591
|
});
|
|
57591
57592
|
app.post("/v1/workspaces/:workspaceId/openrouter-custom-models", async (c) => {
|
|
57592
57593
|
const workspaceId = c.req.param("workspaceId");
|
|
57593
|
-
const grant = await
|
|
57594
|
+
const grant = await requireWorkspaceSettingsGrant(c, deps, workspaceId);
|
|
57594
57595
|
const parsed = CreateWorkspaceOpenRouterCustomModelRequest.safeParse(
|
|
57595
57596
|
await c.req.json().catch(() => null)
|
|
57596
57597
|
);
|
|
@@ -57662,7 +57663,7 @@ function registerWorkspaceRoutes(app, deps) {
|
|
|
57662
57663
|
});
|
|
57663
57664
|
app.delete("/v1/workspaces/:workspaceId/openrouter-custom-models/:customModelId", async (c) => {
|
|
57664
57665
|
const workspaceId = c.req.param("workspaceId");
|
|
57665
|
-
const grant = await
|
|
57666
|
+
const grant = await requireWorkspaceSettingsGrant(c, deps, workspaceId);
|
|
57666
57667
|
const customModelId = c.req.param("customModelId");
|
|
57667
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(
|
|
57668
57669
|
customModelId
|
|
@@ -57766,7 +57767,7 @@ function registerWorkspaceRoutes(app, deps) {
|
|
|
57766
57767
|
});
|
|
57767
57768
|
app.put("/v1/workspaces/:workspaceId/model-policy", async (c) => {
|
|
57768
57769
|
const workspaceId = c.req.param("workspaceId");
|
|
57769
|
-
const grant = await
|
|
57770
|
+
const grant = await requireWorkspaceSettingsGrant(c, deps, workspaceId);
|
|
57770
57771
|
const payload = UpdateWorkspaceModelPolicyRequest.parse(await c.req.json());
|
|
57771
57772
|
const catalog = await resolveWorkspaceCatalogSettings7(deps.db, deps.settings, {
|
|
57772
57773
|
accountId: grant.accountId,
|
|
@@ -57782,7 +57783,7 @@ function registerWorkspaceRoutes(app, deps) {
|
|
|
57782
57783
|
});
|
|
57783
57784
|
app.post("/v1/workspaces/:workspaceId/pause-timer", async (c) => {
|
|
57784
57785
|
const workspaceId = c.req.param("workspaceId");
|
|
57785
|
-
const grant = await
|
|
57786
|
+
const grant = await requireWorkspaceSettingsGrant(c, deps, workspaceId);
|
|
57786
57787
|
if (workspaceControlUtf8Bytes2(grant.subjectId) > WORKSPACE_CONTROL_ACTOR_MAX_BYTES2) {
|
|
57787
57788
|
throw new HTTPException60(400, { message: "workspace-control actor is too large" });
|
|
57788
57789
|
}
|
|
@@ -57812,7 +57813,7 @@ function registerWorkspaceRoutes(app, deps) {
|
|
|
57812
57813
|
});
|
|
57813
57814
|
app.post("/v1/workspaces/:workspaceId/inference-control", async (c) => {
|
|
57814
57815
|
const workspaceId = c.req.param("workspaceId");
|
|
57815
|
-
const grant = await
|
|
57816
|
+
const grant = await requireWorkspaceSettingsGrant(c, deps, workspaceId);
|
|
57816
57817
|
if (workspaceControlUtf8Bytes2(grant.subjectId) > WORKSPACE_CONTROL_ACTOR_MAX_BYTES2) {
|
|
57817
57818
|
throw new HTTPException60(400, {
|
|
57818
57819
|
message: "workspace-control actor is too large"
|
|
@@ -58455,7 +58456,8 @@ import {
|
|
|
58455
58456
|
} from "@opengeni/contracts";
|
|
58456
58457
|
import {
|
|
58457
58458
|
publishGovernedLearningEventToSlack,
|
|
58458
|
-
requireAccessGrant as requireAccessGrant34
|
|
58459
|
+
requireAccessGrant as requireAccessGrant34,
|
|
58460
|
+
requireWorkspaceSettingsGrant as requireWorkspaceSettingsGrant2
|
|
58459
58461
|
} from "@opengeni/core";
|
|
58460
58462
|
import {
|
|
58461
58463
|
activateWorkspaceLearningPolicyRevision,
|
|
@@ -58548,7 +58550,7 @@ function registerWorkspaceLearningRoutes(app, deps) {
|
|
|
58548
58550
|
});
|
|
58549
58551
|
app.post(`${base}/revisions`, async (context) => {
|
|
58550
58552
|
const workspaceId = context.req.param("workspaceId");
|
|
58551
|
-
const grant = await
|
|
58553
|
+
const grant = await requireWorkspaceSettingsGrant2(context, deps, workspaceId);
|
|
58552
58554
|
const request = await parseBody2(context, CreateWorkspaceLearningPolicyRevisionRequest);
|
|
58553
58555
|
try {
|
|
58554
58556
|
return context.json(
|
|
@@ -58574,7 +58576,7 @@ function registerWorkspaceLearningRoutes(app, deps) {
|
|
|
58574
58576
|
const workspaceId = context.req.param("workspaceId");
|
|
58575
58577
|
const revisionId2 = z18.string().uuid().safeParse(context.req.param("revisionId"));
|
|
58576
58578
|
if (!revisionId2.success) throw new HTTPException62(422, { message: "Invalid revision id" });
|
|
58577
|
-
const grant = await
|
|
58579
|
+
const grant = await requireWorkspaceSettingsGrant2(context, deps, workspaceId);
|
|
58578
58580
|
const request = await parseBody2(context, ActivateWorkspaceLearningPolicyRevisionRequest);
|
|
58579
58581
|
try {
|
|
58580
58582
|
return context.json(
|
|
@@ -58598,7 +58600,7 @@ function registerWorkspaceLearningRoutes(app, deps) {
|
|
|
58598
58600
|
});
|
|
58599
58601
|
app.post(`${base}/rollback`, async (context) => {
|
|
58600
58602
|
const workspaceId = context.req.param("workspaceId");
|
|
58601
|
-
const grant = await
|
|
58603
|
+
const grant = await requireWorkspaceSettingsGrant2(context, deps, workspaceId);
|
|
58602
58604
|
const request = await parseBody2(context, RollbackWorkspaceLearningPolicyRevisionRequest);
|
|
58603
58605
|
try {
|
|
58604
58606
|
return context.json(
|
|
@@ -58626,7 +58628,7 @@ function registerWorkspaceLearningRoutes(app, deps) {
|
|
|
58626
58628
|
if (!activationReceiptId.success) {
|
|
58627
58629
|
throw new HTTPException62(422, { message: "Invalid activation receipt id" });
|
|
58628
58630
|
}
|
|
58629
|
-
const grant = await
|
|
58631
|
+
const grant = await requireWorkspaceSettingsGrant2(context, deps, workspaceId);
|
|
58630
58632
|
const request = await parseBody2(context, UndoGovernedLearningActivationHttpRequest);
|
|
58631
58633
|
try {
|
|
58632
58634
|
const undo = await undoGovernedLearningActivation(deps.db, {
|
|
@@ -60221,7 +60223,9 @@ function registerWorkspaceArtifactRoutes(app, deps) {
|
|
|
60221
60223
|
const workspaceId = context.req.param("workspaceId");
|
|
60222
60224
|
await requireAccessGrant39(context, deps, workspaceId, "artifacts:read");
|
|
60223
60225
|
if (!deps.objectStorage)
|
|
60224
|
-
throw new HTTPException67(503, {
|
|
60226
|
+
throw new HTTPException67(503, {
|
|
60227
|
+
message: "Object storage is not configured"
|
|
60228
|
+
});
|
|
60225
60229
|
const ref = await getWorkspaceArtifactContentRef2(
|
|
60226
60230
|
deps.db,
|
|
60227
60231
|
workspaceId,
|
|
@@ -60232,13 +60236,17 @@ function registerWorkspaceArtifactRoutes(app, deps) {
|
|
|
60232
60236
|
});
|
|
60233
60237
|
app.get(base, async (context) => {
|
|
60234
60238
|
const workspaceId = context.req.param("workspaceId");
|
|
60235
|
-
await requireAccessGrant39(context, deps, workspaceId, "artifacts:read");
|
|
60239
|
+
const grant = await requireAccessGrant39(context, deps, workspaceId, "artifacts:read");
|
|
60236
60240
|
const query = WorkspaceArtifactListQuery.safeParse({
|
|
60237
60241
|
limit: context.req.query("limit"),
|
|
60238
60242
|
cursor: context.req.query("cursor"),
|
|
60239
|
-
status: context.req.query("status")
|
|
60243
|
+
status: context.req.query("status"),
|
|
60244
|
+
sourceSessionId: context.req.query("sourceSessionId")
|
|
60240
60245
|
});
|
|
60241
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
|
+
}
|
|
60242
60250
|
try {
|
|
60243
60251
|
return context.json(
|
|
60244
60252
|
WorkspaceArtifactListResponse.parse(
|
|
@@ -60246,7 +60254,8 @@ function registerWorkspaceArtifactRoutes(app, deps) {
|
|
|
60246
60254
|
await listWorkspaceArtifacts2(deps.db, workspaceId, {
|
|
60247
60255
|
limit: query.data.limit,
|
|
60248
60256
|
...query.data.cursor ? { cursor: query.data.cursor } : {},
|
|
60249
|
-
...query.data.status ? { status: query.data.status } : {}
|
|
60257
|
+
...query.data.status ? { status: query.data.status } : {},
|
|
60258
|
+
...query.data.sourceSessionId ? { sourceSessionId: query.data.sourceSessionId } : {}
|
|
60250
60259
|
})
|
|
60251
60260
|
)
|
|
60252
60261
|
)
|
|
@@ -60318,7 +60327,9 @@ function registerWorkspaceArtifactRoutes(app, deps) {
|
|
|
60318
60327
|
const workspaceId = context.req.param("workspaceId");
|
|
60319
60328
|
await requireAccessGrant39(context, deps, workspaceId, "artifacts:read");
|
|
60320
60329
|
if (!deps.objectStorage)
|
|
60321
|
-
throw new HTTPException67(503, {
|
|
60330
|
+
throw new HTTPException67(503, {
|
|
60331
|
+
message: "Object storage is not configured"
|
|
60332
|
+
});
|
|
60322
60333
|
const ref = await getWorkspaceArtifactContentRef2(
|
|
60323
60334
|
deps.db,
|
|
60324
60335
|
workspaceId,
|
|
@@ -62030,6 +62041,7 @@ import {
|
|
|
62030
62041
|
} from "@opengeni/db";
|
|
62031
62042
|
import {
|
|
62032
62043
|
requireAccessGrant as requireAccessGrant44,
|
|
62044
|
+
requireWorkspaceSettingsGrant as requireWorkspaceSettingsGrant3,
|
|
62033
62045
|
VIDEO_GENERATION_MODEL_CATALOG,
|
|
62034
62046
|
videoGenerationModelSupportsFundingSource,
|
|
62035
62047
|
videoGenerationCapabilitiesForPolicy
|
|
@@ -62066,7 +62078,7 @@ function registerVideoGenerationRoutes(app, deps) {
|
|
|
62066
62078
|
});
|
|
62067
62079
|
app.put("/v1/workspaces/:workspaceId/video-generation/policy", async (c) => {
|
|
62068
62080
|
const workspaceId = c.req.param("workspaceId");
|
|
62069
|
-
const grant = await
|
|
62081
|
+
const grant = await requireWorkspaceSettingsGrant3(c, deps, workspaceId);
|
|
62070
62082
|
const payload = UpdateVideoGenerationPolicyRequest.parse(await c.req.json());
|
|
62071
62083
|
const [connection, supergrokConfigured] = await Promise.all([
|
|
62072
62084
|
getWorkspaceVercelAiGatewayConnectionMetadata(deps.db, workspaceId),
|
|
@@ -71890,4 +71902,4 @@ export {
|
|
|
71890
71902
|
withDefaultEnabledCapabilityMcpTools,
|
|
71891
71903
|
workflowIdForSession4 as workflowIdForSession
|
|
71892
71904
|
};
|
|
71893
|
-
//# sourceMappingURL=chunk-
|
|
71905
|
+
//# sourceMappingURL=chunk-NWSVDE7O.js.map
|