@opengeni/api-router 4.3.3-canary.39780140124001 → 4.4.1
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-S5VJ3GVR.js → chunk-3KRHXJPM.js} +28 -50
- package/dist/{chunk-S5VJ3GVR.js.map → chunk-3KRHXJPM.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/user-setup-card.d.ts +21 -0
- package/package.json +24 -24
- package/src/mcp/server.ts +25 -38
- package/src/mcp/user-setup-card.ts +42 -0
- package/src/sandbox-file-artifacts.ts +3 -1
- package/dist/mcp/machine-permission-card.d.ts +0 -33
- package/src/mcp/machine-permission-card.ts +0 -78
package/dist/app.js
CHANGED
|
@@ -6515,44 +6515,30 @@ function capabilityAccountReadiness(availableRoutes, bindings) {
|
|
|
6515
6515
|
return { available, accepted };
|
|
6516
6516
|
}
|
|
6517
6517
|
|
|
6518
|
-
// src/mcp/
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
}
|
|
6524
|
-
async function
|
|
6525
|
-
|
|
6518
|
+
// src/mcp/user-setup-card.ts
|
|
6519
|
+
import {
|
|
6520
|
+
userSetupBlocker,
|
|
6521
|
+
userSetupCardShownMessage
|
|
6522
|
+
} from "@opengeni/contracts";
|
|
6523
|
+
import { sessionChatUrl } from "@opengeni/contracts";
|
|
6524
|
+
async function withUserSetupCard(result2, post) {
|
|
6525
|
+
const blocker = userSetupBlocker(result2.code);
|
|
6526
|
+
if (!blocker) return result2;
|
|
6526
6527
|
let posted;
|
|
6527
6528
|
try {
|
|
6528
|
-
posted = await post();
|
|
6529
|
+
posted = await post(blocker);
|
|
6529
6530
|
} catch {
|
|
6530
6531
|
return result2;
|
|
6531
6532
|
}
|
|
6532
6533
|
if (!posted) return result2;
|
|
6533
6534
|
return {
|
|
6534
6535
|
...result2,
|
|
6535
|
-
reason:
|
|
6536
|
+
reason: userSetupCardShownMessage(blocker, posted.chatUrl),
|
|
6536
6537
|
card: "shown",
|
|
6537
6538
|
cardEventId: posted.eventId,
|
|
6538
6539
|
...posted.chatUrl ? { chatUrl: posted.chatUrl } : {}
|
|
6539
6540
|
};
|
|
6540
6541
|
}
|
|
6541
|
-
function sessionChatUrl(base, workspaceId, sessionId) {
|
|
6542
|
-
if (!base) return null;
|
|
6543
|
-
try {
|
|
6544
|
-
const url = new URL(
|
|
6545
|
-
`/workspaces/${encodeURIComponent(workspaceId)}/sessions/${encodeURIComponent(sessionId)}`,
|
|
6546
|
-
base
|
|
6547
|
-
);
|
|
6548
|
-
if (url.protocol !== "https:" && url.protocol !== "http:" || url.username || url.password) {
|
|
6549
|
-
return null;
|
|
6550
|
-
}
|
|
6551
|
-
return url.toString();
|
|
6552
|
-
} catch {
|
|
6553
|
-
return null;
|
|
6554
|
-
}
|
|
6555
|
-
}
|
|
6556
6542
|
|
|
6557
6543
|
// src/site-uploads.ts
|
|
6558
6544
|
import { WorkspaceArtifactSourceBundle as WorkspaceArtifactSourceBundle2 } from "@opengeni/contracts";
|
|
@@ -16608,6 +16594,7 @@ import {
|
|
|
16608
16594
|
CONNECTED_MACHINE_CAPABILITY_ID,
|
|
16609
16595
|
EXCEL_ADDIN_CAPABILITY_ID as EXCEL_ADDIN_CAPABILITY_ID2,
|
|
16610
16596
|
nativeConnectionCapabilityRecommendations,
|
|
16597
|
+
userSetupCardPayload,
|
|
16611
16598
|
OPENGENI_BROWSER_EXTENSION_URL,
|
|
16612
16599
|
requireLiveAgentAttemptAuthorization as requireLiveAgentAttemptAuthorization7,
|
|
16613
16600
|
requireSessionAuthorization as requireSessionAuthorization3,
|
|
@@ -19560,7 +19547,9 @@ function sandboxArtifactRelativePath(value, workspaceRoot = "/workspace") {
|
|
|
19560
19547
|
}
|
|
19561
19548
|
if (!relative) {
|
|
19562
19549
|
throw new HTTPException24(400, {
|
|
19563
|
-
|
|
19550
|
+
// Say which root: on a connected machine the file may exist outside it,
|
|
19551
|
+
// and copying it in is the way forward.
|
|
19552
|
+
message: `sandbox artifact path must name a file inside this session's workspace root ${workspaceRoot}; ${path} is outside it, so copy the file into the workspace first and use that path`
|
|
19564
19553
|
});
|
|
19565
19554
|
}
|
|
19566
19555
|
if (absolute.length > SANDBOX_ARTIFACT_ABSOLUTE_PATH_MAX_CHARS) {
|
|
@@ -48581,13 +48570,12 @@ function registerFleetTools(server, deps, grant, sessionId, json2) {
|
|
|
48581
48570
|
...deps.settings.ogtoolPackageSpec ? { OPENGENI_OGTOOL_PACKAGE_SPEC: deps.settings.ogtoolPackageSpec } : {}
|
|
48582
48571
|
};
|
|
48583
48572
|
};
|
|
48584
|
-
const
|
|
48573
|
+
const userSetupCard = (toolName, target) => async (blocker) => {
|
|
48585
48574
|
const requestedSandboxId = UUID_TARGET.test(target) ? target.toLowerCase() : null;
|
|
48586
48575
|
if (!exactAgentAttemptClaims(grant)) return null;
|
|
48587
48576
|
const claims = exactAgentCommandContext(grant, sessionId);
|
|
48588
|
-
const
|
|
48589
|
-
|
|
48590
|
-
);
|
|
48577
|
+
const payload = userSetupCardPayload(blocker, { toolName, requestedSandboxId });
|
|
48578
|
+
if (!payload) return null;
|
|
48591
48579
|
const appended = await appendTurnCapabilityCardOnce(
|
|
48592
48580
|
deps.db,
|
|
48593
48581
|
grant.workspaceId,
|
|
@@ -48595,23 +48583,13 @@ function registerFleetTools(server, deps, grant, sessionId, json2) {
|
|
|
48595
48583
|
claims.callerTurnId,
|
|
48596
48584
|
claims.callerExecutionGeneration,
|
|
48597
48585
|
claims.callerAttemptId,
|
|
48598
|
-
|
|
48599
|
-
{
|
|
48600
|
-
type: "tool.auth_needed",
|
|
48601
|
-
payload: {
|
|
48602
|
-
...capabilityCardPayload(item, {
|
|
48603
|
-
action: "connect",
|
|
48604
|
-
rationale: "Allow this chat to use your computer.",
|
|
48605
|
-
toolName
|
|
48606
|
-
}),
|
|
48607
|
-
...requestedSandboxId ? { requestedSandboxId } : {}
|
|
48608
|
-
}
|
|
48609
|
-
},
|
|
48586
|
+
blocker.capabilityId,
|
|
48587
|
+
{ type: "tool.auth_needed", payload },
|
|
48610
48588
|
requestedSandboxId
|
|
48611
48589
|
);
|
|
48612
48590
|
await publishDurableSessionEvents(deps.bus, grant.workspaceId, sessionId, appended.events);
|
|
48613
48591
|
if (!appended.accepted) {
|
|
48614
|
-
throw new Error("The calling turn was replaced before the
|
|
48592
|
+
throw new Error("The calling turn was replaced before the setup card committed.");
|
|
48615
48593
|
}
|
|
48616
48594
|
return {
|
|
48617
48595
|
eventId: appended.existingEventId ?? appended.events[0]?.id ?? null,
|
|
@@ -48640,9 +48618,9 @@ function registerFleetTools(server, deps, grant, sessionId, json2) {
|
|
|
48640
48618
|
inputSchema: { target: z47.string().min(1) }
|
|
48641
48619
|
},
|
|
48642
48620
|
async ({ target }) => json2(
|
|
48643
|
-
await
|
|
48621
|
+
await withUserSetupCard(
|
|
48644
48622
|
await swapActiveSandbox(services, await fleetContext(), target),
|
|
48645
|
-
|
|
48623
|
+
userSetupCard("sandbox_attach", target)
|
|
48646
48624
|
)
|
|
48647
48625
|
)
|
|
48648
48626
|
);
|
|
@@ -48653,9 +48631,9 @@ function registerFleetTools(server, deps, grant, sessionId, json2) {
|
|
|
48653
48631
|
inputSchema: { target: z47.string().min(1) }
|
|
48654
48632
|
},
|
|
48655
48633
|
async ({ target }) => json2(
|
|
48656
|
-
await
|
|
48634
|
+
await withUserSetupCard(
|
|
48657
48635
|
await swapActiveSandbox(services, await fleetContext(), target),
|
|
48658
|
-
|
|
48636
|
+
userSetupCard("sandbox_swap", target)
|
|
48659
48637
|
)
|
|
48660
48638
|
)
|
|
48661
48639
|
);
|
|
@@ -48690,12 +48668,12 @@ function registerFleetTools(server, deps, grant, sessionId, json2) {
|
|
|
48690
48668
|
(subjectId) => vaultProviderRegistryFor(deps, { workspaceId: grant.workspaceId, subjectId })
|
|
48691
48669
|
) : null;
|
|
48692
48670
|
return json2(
|
|
48693
|
-
await
|
|
48671
|
+
await withUserSetupCard(
|
|
48694
48672
|
await runOnSandbox(services, await fleetContext(), target, typedOp, {
|
|
48695
48673
|
...transientExecEnvironment ? { transientExecEnvironment } : {},
|
|
48696
48674
|
...secretResolver ? { secretResolver } : {}
|
|
48697
48675
|
}),
|
|
48698
|
-
|
|
48676
|
+
userSetupCard("run_on", target)
|
|
48699
48677
|
)
|
|
48700
48678
|
);
|
|
48701
48679
|
}
|
|
@@ -152239,4 +152217,4 @@ export {
|
|
|
152239
152217
|
withDefaultEnabledCapabilityMcpTools,
|
|
152240
152218
|
workflowIdForSession4 as workflowIdForSession
|
|
152241
152219
|
};
|
|
152242
|
-
//# sourceMappingURL=chunk-
|
|
152220
|
+
//# sourceMappingURL=chunk-3KRHXJPM.js.map
|