@superblocksteam/gateway 2.0.178-next.2 → 2.0.179-next.0
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/README.md +4 -1
- package/dist/auth/cli-session.d.ts +24 -0
- package/dist/auth/cli-session.d.ts.map +1 -0
- package/dist/auth/cli-session.js +46 -0
- package/dist/auth/cli-session.js.map +1 -0
- package/dist/auth/index.d.ts +4 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +4 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/login.d.ts +18 -0
- package/dist/auth/login.d.ts.map +1 -0
- package/dist/auth/login.js +124 -0
- package/dist/auth/login.js.map +1 -0
- package/dist/auth/mcp-oauth-session.d.ts +46 -0
- package/dist/auth/mcp-oauth-session.d.ts.map +1 -0
- package/dist/auth/mcp-oauth-session.js +247 -0
- package/dist/auth/mcp-oauth-session.js.map +1 -0
- package/dist/auth/mcp-server-selection.d.ts +42 -0
- package/dist/auth/mcp-server-selection.d.ts.map +1 -0
- package/dist/auth/mcp-server-selection.js +179 -0
- package/dist/auth/mcp-server-selection.js.map +1 -0
- package/dist/auth/native-oauth.d.ts +33 -0
- package/dist/auth/native-oauth.d.ts.map +1 -0
- package/dist/auth/native-oauth.js +181 -0
- package/dist/auth/native-oauth.js.map +1 -0
- package/dist/capabilities/branching.d.ts +139 -0
- package/dist/capabilities/branching.d.ts.map +1 -0
- package/dist/capabilities/branching.js +540 -0
- package/dist/capabilities/branching.js.map +1 -0
- package/dist/capabilities/lifecycle.d.ts +19 -0
- package/dist/capabilities/lifecycle.d.ts.map +1 -1
- package/dist/capabilities/lifecycle.js +60 -2
- package/dist/capabilities/lifecycle.js.map +1 -1
- package/dist/capabilities/types.d.ts +2 -0
- package/dist/capabilities/types.d.ts.map +1 -1
- package/dist/capabilities/types.js.map +1 -1
- package/dist/main.js +21 -3
- package/dist/main.js.map +1 -1
- package/dist/sabs/editor-client-methods.d.ts.map +1 -1
- package/dist/sabs/editor-client-methods.js +11 -1
- package/dist/sabs/editor-client-methods.js.map +1 -1
- package/dist/server/client.d.ts +125 -4
- package/dist/server/client.d.ts.map +1 -1
- package/dist/server/client.js +55 -4
- package/dist/server/client.js.map +1 -1
- package/dist/stdio/index.d.ts +2 -0
- package/dist/stdio/index.d.ts.map +1 -0
- package/dist/stdio/index.js +2 -0
- package/dist/stdio/index.js.map +1 -0
- package/dist/stdio/serve.d.ts +56 -0
- package/dist/stdio/serve.d.ts.map +1 -0
- package/dist/stdio/serve.js +208 -0
- package/dist/stdio/serve.js.map +1 -0
- package/dist/transports/mcp/mount.d.ts.map +1 -1
- package/dist/transports/mcp/mount.js +204 -2
- package/dist/transports/mcp/mount.js.map +1 -1
- package/dist/transports/mcp/tool-names.d.ts +1 -1
- package/dist/transports/mcp/tool-names.d.ts.map +1 -1
- package/dist/transports/mcp/tool-permissions.d.ts +13 -0
- package/dist/transports/mcp/tool-permissions.d.ts.map +1 -1
- package/dist/transports/mcp/tool-permissions.js +14 -0
- package/dist/transports/mcp/tool-permissions.js.map +1 -1
- package/package.json +24 -7
|
@@ -121,6 +121,10 @@ function heldSocketFor(ctx, applicationId, branch) {
|
|
|
121
121
|
}
|
|
122
122
|
return held.branch === branch ? "this_branch" : "other_branch";
|
|
123
123
|
}
|
|
124
|
+
/** Holds a live edit on `branch`, which makes it the caller's current branch on the server. */
|
|
125
|
+
export function attachToBranch({ ctx, principal, applicationId, branch, }) {
|
|
126
|
+
return ensureLiveState(ctx, principal, applicationId, branch, hostCallDeadlineAtMs(ctx));
|
|
127
|
+
}
|
|
124
128
|
/**
|
|
125
129
|
* `branch` is the branch the read resolved to, undefined for the default
|
|
126
130
|
* branch: a socket held for any other branch cannot answer for this read.
|
|
@@ -1023,7 +1027,7 @@ async function createApplicationForPrompt(ctx, args) {
|
|
|
1023
1027
|
* rather than from its arguments, so the failure is the one place a caller can
|
|
1024
1028
|
* learn which app it actually drove.
|
|
1025
1029
|
*/
|
|
1026
|
-
function namingApplication(applicationId, result) {
|
|
1030
|
+
export function namingApplication(applicationId, result) {
|
|
1027
1031
|
return result.kind === "error" ? { ...result, applicationId } : result;
|
|
1028
1032
|
}
|
|
1029
1033
|
/**
|
|
@@ -3717,8 +3721,41 @@ function notShared(applicationId, commitId) {
|
|
|
3717
3721
|
pendingAction: "open_editor",
|
|
3718
3722
|
};
|
|
3719
3723
|
}
|
|
3724
|
+
/**
|
|
3725
|
+
* A rollback publishes only a version that was live before and whose stored
|
|
3726
|
+
* policy checks passed, the versions the editor offers to publish again.
|
|
3727
|
+
*/
|
|
3728
|
+
async function refuseNeverLive(ctx, input) {
|
|
3729
|
+
let deployments;
|
|
3730
|
+
try {
|
|
3731
|
+
deployments = await ctx.server.listDeployments({
|
|
3732
|
+
apiKey: input.apiKey,
|
|
3733
|
+
applicationId: input.applicationId,
|
|
3734
|
+
...(ctx.signal ? { signal: ctx.signal } : {}),
|
|
3735
|
+
});
|
|
3736
|
+
}
|
|
3737
|
+
catch (error) {
|
|
3738
|
+
return {
|
|
3739
|
+
kind: "error",
|
|
3740
|
+
applicationId: input.applicationId,
|
|
3741
|
+
code: "publish_failed",
|
|
3742
|
+
message: error instanceof Error ? error.message : String(error),
|
|
3743
|
+
};
|
|
3744
|
+
}
|
|
3745
|
+
if (deployments.some(({ commitId, policyChecksPassed }) => commitId === input.commitId && policyChecksPassed === true)) {
|
|
3746
|
+
return undefined;
|
|
3747
|
+
}
|
|
3748
|
+
return {
|
|
3749
|
+
kind: "error",
|
|
3750
|
+
applicationId: input.applicationId,
|
|
3751
|
+
code: "rollback_not_live_before",
|
|
3752
|
+
message: `Commit ${input.commitId} was never live, or its policy checks did not pass, so it cannot go live again directly. Call restore_version with this commitId to restore it on the user's branch, then call publish_app with commitMessage.`,
|
|
3753
|
+
};
|
|
3754
|
+
}
|
|
3720
3755
|
/** The server's refusal to land a branch whose merge from main is not resolved yet. */
|
|
3721
3756
|
const MERGE_IN_PROGRESS_REFUSAL = "has a merge in progress";
|
|
3757
|
+
/** The server's refusal to publish a branch that lacks main's latest changes. */
|
|
3758
|
+
const BEHIND_MAIN_REFUSAL = "Pull the latest changes from main before you publish";
|
|
3722
3759
|
function landConflict(applicationId) {
|
|
3723
3760
|
return {
|
|
3724
3761
|
kind: "error",
|
|
@@ -3749,6 +3786,7 @@ async function landForPublish(ctx, input) {
|
|
|
3749
3786
|
const land = (retryFailedMigrations) => ctx.server.landBranch({
|
|
3750
3787
|
apiKey,
|
|
3751
3788
|
applicationId,
|
|
3789
|
+
publish: true,
|
|
3752
3790
|
retryFailedMigrations,
|
|
3753
3791
|
...(ctx.signal ? { signal: ctx.signal } : {}),
|
|
3754
3792
|
timeoutMs: Math.max(1, deadlineAtMs - nowMs(ctx)),
|
|
@@ -3783,6 +3821,14 @@ async function landForPublish(ctx, input) {
|
|
|
3783
3821
|
if (message.includes(MERGE_IN_PROGRESS_REFUSAL)) {
|
|
3784
3822
|
return landConflict(applicationId);
|
|
3785
3823
|
}
|
|
3824
|
+
if (message.includes(BEHIND_MAIN_REFUSAL)) {
|
|
3825
|
+
return {
|
|
3826
|
+
kind: "error",
|
|
3827
|
+
applicationId,
|
|
3828
|
+
code: "publish_behind_main",
|
|
3829
|
+
message: 'This branch does not have the latest changes from main yet. Call pull_branch with target "main", then call publish_app again.',
|
|
3830
|
+
};
|
|
3831
|
+
}
|
|
3786
3832
|
// Only the user can agree to delete data, and only the editor shows what
|
|
3787
3833
|
// would go, so this publish never sends that agreement itself.
|
|
3788
3834
|
if (message.includes(DESTRUCTIVE_MIGRATION_ACK_REQUIRED_MESSAGE)) {
|
|
@@ -3874,9 +3920,20 @@ async function publishResolvedApp(ctx, args) {
|
|
|
3874
3920
|
message: error instanceof Error ? error.message : String(error),
|
|
3875
3921
|
};
|
|
3876
3922
|
}
|
|
3923
|
+
if (input.publishIntent === "rollback" && requestedCommitId) {
|
|
3924
|
+
const refused = await refuseNeverLive(ctx, {
|
|
3925
|
+
apiKey: principal.apiKey,
|
|
3926
|
+
applicationId,
|
|
3927
|
+
commitId: requestedCommitId,
|
|
3928
|
+
});
|
|
3929
|
+
if (refused) {
|
|
3930
|
+
return refused;
|
|
3931
|
+
}
|
|
3932
|
+
}
|
|
3933
|
+
else if (
|
|
3877
3934
|
// The server only deploys main's head, so a commit still on the user's own
|
|
3878
3935
|
// branch has to be shared first.
|
|
3879
|
-
|
|
3936
|
+
userBranch &&
|
|
3880
3937
|
requestedCommitId &&
|
|
3881
3938
|
userBranch.mainHead !== null &&
|
|
3882
3939
|
requestedCommitId !== userBranch.mainHead) {
|
|
@@ -3958,6 +4015,7 @@ async function publishResolvedApp(ctx, args) {
|
|
|
3958
4015
|
apiKey: principal.apiKey,
|
|
3959
4016
|
applicationId,
|
|
3960
4017
|
commitId,
|
|
4018
|
+
...(input.publishIntent ? { publishIntent: input.publishIntent } : {}),
|
|
3961
4019
|
...(ctx.signal ? { signal: ctx.signal } : {}),
|
|
3962
4020
|
timeoutMs: Math.max(1, deadlineAtMs - nowMs(ctx)),
|
|
3963
4021
|
});
|