@opengeni/api-router 2.12.1-canary.0 → 2.12.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 +1 -1
- package/dist/{chunk-Y3EPAIEQ.js → chunk-552H26YK.js} +41 -12
- package/dist/chunk-552H26YK.js.map +1 -0
- package/dist/index.js +1 -1
- package/package.json +19 -19
- package/src/mcp/server.ts +60 -13
- package/dist/chunk-Y3EPAIEQ.js.map +0 -1
package/dist/app.js
CHANGED
|
@@ -6041,6 +6041,8 @@ async function workspaceArtifactDownloads(storage, ref, audience) {
|
|
|
6041
6041
|
// src/mcp/server.ts
|
|
6042
6042
|
import {
|
|
6043
6043
|
CreateScheduledTaskRequest,
|
|
6044
|
+
CreateSessionRequest,
|
|
6045
|
+
GoalSpec,
|
|
6044
6046
|
boundSessionMcpText as capSessionDiscoveryText,
|
|
6045
6047
|
compactSessionMcpListRow,
|
|
6046
6048
|
sessionMcpIncludesRelatedWork,
|
|
@@ -24927,6 +24929,30 @@ function orchestrationFailureCode(tool, error) {
|
|
|
24927
24929
|
const suffix = error.status === 401 ? "unauthenticated" : error.status === 403 ? "forbidden" : error.status === 404 ? "not_found" : error.status === 409 ? "conflict" : error.status === 429 ? "limit_exceeded" : error.status >= 500 ? "unavailable" : "rejected";
|
|
24928
24930
|
return `${tool}_${suffix}`.slice(0, ORCHESTRATION_FAILURE_CODE_MAX_LENGTH);
|
|
24929
24931
|
}
|
|
24932
|
+
function sessionCreateValidationFailureResult(error) {
|
|
24933
|
+
const details = error.issues.slice(0, 5).map((issue) => {
|
|
24934
|
+
const [field, goalField] = issue.path;
|
|
24935
|
+
let path = typeof field === "string" && Object.hasOwn(CreateSessionRequest.out.shape, field) ? field : "request";
|
|
24936
|
+
if (field === "goal" && typeof goalField === "string" && Object.hasOwn(GoalSpec.shape, goalField)) {
|
|
24937
|
+
path += `.${goalField}`;
|
|
24938
|
+
}
|
|
24939
|
+
const expected = issue.code === "invalid_type" && ["string", "number", "boolean", "object", "array", "int"].includes(issue.expected) ? `expected ${issue.expected === "int" ? "integer" : issue.expected}` : "failed schema validation";
|
|
24940
|
+
return `${path} ${expected}`;
|
|
24941
|
+
});
|
|
24942
|
+
const envelope = {
|
|
24943
|
+
error: {
|
|
24944
|
+
code: "session_create_invalid_request",
|
|
24945
|
+
message: boundedOrchestrationFailureMessage(
|
|
24946
|
+
`Invalid session create request: ${details.join("; ") || "request failed schema validation"}${error.issues.length > 5 ? "; additional fields failed validation" : ""}.`
|
|
24947
|
+
)
|
|
24948
|
+
}
|
|
24949
|
+
};
|
|
24950
|
+
return {
|
|
24951
|
+
content: [{ type: "text", text: JSON.stringify(envelope, null, 2) }],
|
|
24952
|
+
structuredContent: envelope,
|
|
24953
|
+
isError: true
|
|
24954
|
+
};
|
|
24955
|
+
}
|
|
24930
24956
|
function orchestrationFailureEnvelope(tool, error) {
|
|
24931
24957
|
if (error instanceof SessionSpawnDeniedError) {
|
|
24932
24958
|
const denial = sessionSpawnDenialEnvelope(error);
|
|
@@ -28818,7 +28844,7 @@ function registerWorkspaceOrchestrationTools(server, deps, grant, can, callerSes
|
|
|
28818
28844
|
"Concise semantic title for the child session. Omit only when the delegated goal or initial message already provides a suitable title; OpenGeni derives a sensitive-safe bounded fallback from that text."
|
|
28819
28845
|
),
|
|
28820
28846
|
instructions: z43.string().min(1).max(SESSION_INSTRUCTIONS_MAX_CHARACTERS).optional(),
|
|
28821
|
-
goal:
|
|
28847
|
+
goal: GoalSpec.optional(),
|
|
28822
28848
|
resources: z43.array(z43.unknown()).optional().describe(
|
|
28823
28849
|
"Omit to inherit parent repositories only. Files are never inherited automatically; explicitly include file resources to attach them. An empty array inherits no resources."
|
|
28824
28850
|
),
|
|
@@ -28897,18 +28923,21 @@ function registerWorkspaceOrchestrationTools(server, deps, grant, can, callerSes
|
|
|
28897
28923
|
await authorizeFirstPartySession(deps, grant, callerSessionId, "session.child.create");
|
|
28898
28924
|
}
|
|
28899
28925
|
const { machineTarget, title, projectId, ...request } = args;
|
|
28926
|
+
const rawRequest = {
|
|
28927
|
+
...request,
|
|
28928
|
+
...projectId !== void 0 ? { channelId: projectId } : {},
|
|
28929
|
+
...machineTarget ? {
|
|
28930
|
+
targetSandboxId: machineTarget.targetSandboxId,
|
|
28931
|
+
...machineTarget.workingDir !== void 0 ? { workingDir: machineTarget.workingDir } : {}
|
|
28932
|
+
} : {}
|
|
28933
|
+
};
|
|
28934
|
+
const validation = CreateSessionRequest.safeParse(rawRequest);
|
|
28935
|
+
if (!validation.success) return sessionCreateValidationFailureResult(validation.error);
|
|
28900
28936
|
const result = await createSessionForRequestWithOutcome(
|
|
28901
28937
|
deps,
|
|
28902
28938
|
grant,
|
|
28903
28939
|
grant.workspaceId,
|
|
28904
|
-
|
|
28905
|
-
...request,
|
|
28906
|
-
...projectId !== void 0 ? { channelId: projectId } : {},
|
|
28907
|
-
...machineTarget ? {
|
|
28908
|
-
targetSandboxId: machineTarget.targetSandboxId,
|
|
28909
|
-
...machineTarget.workingDir !== void 0 ? { workingDir: machineTarget.workingDir } : {}
|
|
28910
|
-
} : {}
|
|
28911
|
-
},
|
|
28940
|
+
rawRequest,
|
|
28912
28941
|
void 0,
|
|
28913
28942
|
title === void 0 ? {} : { automaticTitleCandidate: title }
|
|
28914
28943
|
);
|
|
@@ -55805,7 +55834,7 @@ import {
|
|
|
55805
55834
|
GatewayRealtimeConnectRequest,
|
|
55806
55835
|
ClientSessionEvent,
|
|
55807
55836
|
CompactSessionContextRequest,
|
|
55808
|
-
CreateSessionRequest,
|
|
55837
|
+
CreateSessionRequest as CreateSessionRequest2,
|
|
55809
55838
|
DeleteSessionQueueItemRequest,
|
|
55810
55839
|
EditSessionQueueItemRequest,
|
|
55811
55840
|
EndSessionRealtimeRequest,
|
|
@@ -57207,7 +57236,7 @@ function registerSessionRoutes(app, deps) {
|
|
|
57207
57236
|
}
|
|
57208
57237
|
let session;
|
|
57209
57238
|
try {
|
|
57210
|
-
|
|
57239
|
+
CreateSessionRequest2.parse(payload);
|
|
57211
57240
|
const origin = await resolveSiteSessionOrigin(
|
|
57212
57241
|
db,
|
|
57213
57242
|
workspaceId,
|
|
@@ -76525,4 +76554,4 @@ export {
|
|
|
76525
76554
|
withDefaultEnabledCapabilityMcpTools,
|
|
76526
76555
|
workflowIdForSession4 as workflowIdForSession
|
|
76527
76556
|
};
|
|
76528
|
-
//# sourceMappingURL=chunk-
|
|
76557
|
+
//# sourceMappingURL=chunk-552H26YK.js.map
|