@remixhq/mcp 0.1.15 → 0.1.16
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/cli.js +11 -96
- package/dist/cli.js.map +1 -1
- package/dist/index.js +11 -96
- package/dist/index.js.map +1 -1
- package/dist/server.js +11 -96
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -495,14 +495,6 @@ var recordTurnInputSchema = {
|
|
|
495
495
|
allowBranchMismatch: z2.boolean().optional(),
|
|
496
496
|
idempotencyKey: z2.string().trim().min(1).optional()
|
|
497
497
|
};
|
|
498
|
-
var finalizeTurnInputSchema = {
|
|
499
|
-
...commonRequestFieldsSchema,
|
|
500
|
-
prompt: z2.string().trim().min(1),
|
|
501
|
-
assistantResponse: z2.string().trim().min(1),
|
|
502
|
-
sync: z2.boolean().optional(),
|
|
503
|
-
allowBranchMismatch: z2.boolean().optional(),
|
|
504
|
-
idempotencyKey: z2.string().trim().min(1).optional()
|
|
505
|
-
};
|
|
506
498
|
var previewInputSchema = {
|
|
507
499
|
...commonRequestFieldsSchema
|
|
508
500
|
};
|
|
@@ -672,17 +664,6 @@ var addDataSchema = z2.object({
|
|
|
672
664
|
changeStep: genericRecordSchema
|
|
673
665
|
});
|
|
674
666
|
var recordTurnDataSchema = genericRecordSchema;
|
|
675
|
-
var finalizeTurnDataSchema = z2.object({
|
|
676
|
-
mode: z2.enum(["changed_turn", "no_diff_turn"]),
|
|
677
|
-
idempotencyKey: z2.string().min(1),
|
|
678
|
-
queued: z2.boolean(),
|
|
679
|
-
jobId: z2.string().nullable(),
|
|
680
|
-
repoState: z2.string().nullable(),
|
|
681
|
-
changeStep: genericRecordSchema.nullable(),
|
|
682
|
-
collabTurn: genericRecordSchema.nullable(),
|
|
683
|
-
autoSync: genericRecordSchema.nullable(),
|
|
684
|
-
warnings: z2.array(z2.string())
|
|
685
|
-
});
|
|
686
667
|
var drainFinalizeQueueDataSchema = z2.object({
|
|
687
668
|
processed: z2.number().int().nonnegative(),
|
|
688
669
|
results: z2.array(genericRecordSchema)
|
|
@@ -762,7 +743,6 @@ var remixSuccessSchema = makeSuccessSchema(remixDataSchema);
|
|
|
762
743
|
var checkoutSuccessSchema = makeSuccessSchema(checkoutDataSchema);
|
|
763
744
|
var addSuccessSchema = makeSuccessSchema(addDataSchema);
|
|
764
745
|
var recordTurnSuccessSchema = makeSuccessSchema(recordTurnDataSchema);
|
|
765
|
-
var finalizeTurnSuccessSchema = makeSuccessSchema(finalizeTurnDataSchema);
|
|
766
746
|
var drainFinalizeQueueSuccessSchema = makeSuccessSchema(drainFinalizeQueueDataSchema);
|
|
767
747
|
var syncSuccessSchema = makeSuccessSchema(syncDataSchema);
|
|
768
748
|
var reAnchorSuccessSchema = makeSuccessSchema(reAnchorDataSchema);
|
|
@@ -783,13 +763,11 @@ var accessDebugSuccessSchema = makeSuccessSchema(accessDebugDataSchema);
|
|
|
783
763
|
var updateMemberRoleSuccessSchema = makeSuccessSchema(updateMemberRoleDataSchema);
|
|
784
764
|
|
|
785
765
|
// src/domain/coreAdapter.ts
|
|
786
|
-
import { spawn } from "child_process";
|
|
787
766
|
import {
|
|
788
767
|
collabList as coreCollabList,
|
|
789
768
|
collabListMembers as coreCollabListMembers,
|
|
790
769
|
collabUpdateMemberRole as coreCollabUpdateMemberRole,
|
|
791
770
|
drainPendingFinalizeQueue as coreDrainPendingFinalizeQueue,
|
|
792
|
-
collabFinalizeTurn as coreCollabFinalizeTurn,
|
|
793
771
|
collabApprove as coreCollabApprove,
|
|
794
772
|
collabCheckout as coreCollabCheckout,
|
|
795
773
|
collabListMergeRequests as coreCollabListMergeRequests,
|
|
@@ -828,17 +806,17 @@ function getRecommendedNextActions(status) {
|
|
|
828
806
|
return ["Run remix_collab_sync_preview, then remix_collab_sync_apply if the preview is acceptable. This pulls the server delta into the local working tree without rewriting local git history."];
|
|
829
807
|
case "re_anchor":
|
|
830
808
|
return [
|
|
831
|
-
"Run remix_collab_re_anchor_preview, then remix_collab_re_anchor_apply. This seeds a local Remix baseline. It is required because no local baseline exists for this lane yet (fresh clone, deleted .remix/ state, or first init didn't seed) \u2014 not because of any specific git operation. After it succeeds,
|
|
809
|
+
"Run remix_collab_re_anchor_preview, then remix_collab_re_anchor_apply. This seeds a local Remix baseline. It is required because no local baseline exists for this lane yet (fresh clone, deleted .remix/ state, or first init didn't seed) \u2014 not because of any specific git operation. After it succeeds, automatic hook recording can capture completed turns."
|
|
832
810
|
];
|
|
833
811
|
case "record":
|
|
834
812
|
return [
|
|
835
|
-
"
|
|
813
|
+
"No MCP recording tool is required. Automatic hook finalization will capture the local boundary at the end of the completed turn; this covers agent edits, manual user edits, git commit, git pull, git merge, git rebase, and git reset."
|
|
836
814
|
];
|
|
837
815
|
case "reconcile":
|
|
838
816
|
return ["Run remix_collab_reconcile_preview before attempting remix_collab_reconcile_apply. Reconcile applies only when both the local workspace and the server lane changed since the last agreed baseline."];
|
|
839
817
|
case "await_finalize":
|
|
840
818
|
return [
|
|
841
|
-
"Run remix_collab_drain_finalize_queue before merge-related or recovery flows.
|
|
819
|
+
"Run remix_collab_drain_finalize_queue before merge-related or recovery flows. Hook recording is queued until the local finalize queue is drained."
|
|
842
820
|
];
|
|
843
821
|
case "review_queue":
|
|
844
822
|
return ["Run remix_collab_review_queue to inspect reviewable merge requests instead of using local git merge flows."];
|
|
@@ -873,17 +851,6 @@ function truncateText(value, maxChars) {
|
|
|
873
851
|
originalChars: value.length
|
|
874
852
|
};
|
|
875
853
|
}
|
|
876
|
-
function spawnFinalizeQueueDrainer() {
|
|
877
|
-
const entrypoint = process.argv[1];
|
|
878
|
-
if (!entrypoint) return false;
|
|
879
|
-
const child = spawn(process.execPath, [...process.execArgv, entrypoint, "--drain-finalize-queue"], {
|
|
880
|
-
detached: true,
|
|
881
|
-
stdio: "ignore",
|
|
882
|
-
env: process.env
|
|
883
|
-
});
|
|
884
|
-
child.unref();
|
|
885
|
-
return true;
|
|
886
|
-
}
|
|
887
854
|
async function drainBeforeMutation(api) {
|
|
888
855
|
const results = await coreDrainPendingFinalizeQueue({ api });
|
|
889
856
|
return results.flatMap((result) => collectResultWarnings(result));
|
|
@@ -926,7 +893,7 @@ async function initCollab(params) {
|
|
|
926
893
|
data: syncResult,
|
|
927
894
|
warnings: collectResultWarnings(result),
|
|
928
895
|
recommendedNextActions: syncResult.baselineStatus === "requires_re_anchor" ? [
|
|
929
|
-
"This checkout has no local Remix baseline yet. Run remix_collab_re_anchor_preview, then remix_collab_re_anchor_apply to seed one. After it succeeds,
|
|
896
|
+
"This checkout has no local Remix baseline yet. Run remix_collab_re_anchor_preview, then remix_collab_re_anchor_apply to seed one. After it succeeds, automatic hook recording can capture completed turns."
|
|
930
897
|
] : syncResult.baselineStatus === "requires_sync" ? [
|
|
931
898
|
"Run remix_collab_sync_preview, then remix_collab_sync_apply to pull the server delta and create the first local baseline for this checkout."
|
|
932
899
|
] : ["Run remix_collab_status to inspect sync, reconcile, and merge-request readiness before mutating bound-repo state."],
|
|
@@ -991,36 +958,6 @@ async function checkoutCollab(params) {
|
|
|
991
958
|
}
|
|
992
959
|
};
|
|
993
960
|
}
|
|
994
|
-
async function finalizeCollabTurn(params) {
|
|
995
|
-
const api = await createCollabApiClient();
|
|
996
|
-
const repoRoot = await findGitRoot(params.cwd);
|
|
997
|
-
const result = await coreCollabFinalizeTurn({
|
|
998
|
-
api,
|
|
999
|
-
cwd: params.cwd,
|
|
1000
|
-
prompt: params.prompt,
|
|
1001
|
-
assistantResponse: params.assistantResponse,
|
|
1002
|
-
sync: params.sync,
|
|
1003
|
-
allowBranchMismatch: params.allowBranchMismatch ?? false,
|
|
1004
|
-
idempotencyKey: params.idempotencyKey ?? null,
|
|
1005
|
-
actor: params.agent,
|
|
1006
|
-
awaitingUsageDeadlineMs: params.awaitingUsageDeadlineMs ?? null
|
|
1007
|
-
});
|
|
1008
|
-
const hasAwaitingDeadline = typeof params.awaitingUsageDeadlineMs === "number" && params.awaitingUsageDeadlineMs > 0;
|
|
1009
|
-
if (result.queued && !hasAwaitingDeadline) {
|
|
1010
|
-
if (!spawnFinalizeQueueDrainer()) {
|
|
1011
|
-
await coreDrainPendingFinalizeQueue({ api });
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
return {
|
|
1015
|
-
data: result,
|
|
1016
|
-
warnings: result.warnings,
|
|
1017
|
-
recommendedNextActions: result.queued ? ["Run remix_collab_drain_finalize_queue before merge-related flows if you need this queued turn recorded immediately."] : [],
|
|
1018
|
-
logContext: {
|
|
1019
|
-
repoRoot,
|
|
1020
|
-
appId: result.changeStep?.appId ?? result.collabTurn?.appId ?? null
|
|
1021
|
-
}
|
|
1022
|
-
};
|
|
1023
|
-
}
|
|
1024
961
|
async function drainFinalizeQueue(params) {
|
|
1025
962
|
const api = await createCollabApiClient();
|
|
1026
963
|
const repoRoot = await findGitRoot(params.cwd);
|
|
@@ -1071,7 +1008,7 @@ async function reAnchor(params) {
|
|
|
1071
1008
|
data: result,
|
|
1072
1009
|
warnings: collectWarnings(result.warnings),
|
|
1073
1010
|
recommendedNextActions: params.dryRun ? [
|
|
1074
|
-
"Run remix_collab_re_anchor_apply with confirm=true to seed a local Remix baseline for this checkout. Re-anchor is for missing-baseline cases only and does not replace
|
|
1011
|
+
"Run remix_collab_re_anchor_apply with confirm=true to seed a local Remix baseline for this checkout. Re-anchor is for missing-baseline cases only and does not replace automatic hook recording for ordinary local content changes."
|
|
1075
1012
|
] : [],
|
|
1076
1013
|
logContext: {
|
|
1077
1014
|
repoRoot: result.repoRoot,
|
|
@@ -1803,7 +1740,7 @@ async function accessDebug(params) {
|
|
|
1803
1740
|
}
|
|
1804
1741
|
|
|
1805
1742
|
// src/tools/collab/autoSpawnHistoryImport.ts
|
|
1806
|
-
import { spawn
|
|
1743
|
+
import { spawn } from "child_process";
|
|
1807
1744
|
import { existsSync, mkdirSync, openSync } from "fs";
|
|
1808
1745
|
import path2 from "path";
|
|
1809
1746
|
var MARKER_REL_PATH = path2.join(".remix", ".history-imported");
|
|
@@ -1824,7 +1761,7 @@ function spawnHistoryImportDetached(repoRoot) {
|
|
|
1824
1761
|
const logPath = path2.join(repoRoot, LOG_REL_PATH);
|
|
1825
1762
|
const out = openSync(logPath, "a");
|
|
1826
1763
|
const err = openSync(logPath, "a");
|
|
1827
|
-
const child =
|
|
1764
|
+
const child = spawn(
|
|
1828
1765
|
"remix",
|
|
1829
1766
|
[
|
|
1830
1767
|
"history",
|
|
@@ -1967,7 +1904,7 @@ function registerCollabTools(server, context) {
|
|
|
1967
1904
|
});
|
|
1968
1905
|
registerTool(server, context, {
|
|
1969
1906
|
name: "remix_collab_init",
|
|
1970
|
-
description: "Import the current repository into Remix and write the local binding file. Synchronous: by the time this tool resolves, the local binding file AND the local Remix baseline are both on disk, so
|
|
1907
|
+
description: "Import the current repository into Remix and write the local binding file. Synchronous: by the time this tool resolves, the local binding file AND the local Remix baseline are both on disk, so automatic hook recording can capture subsequent completed turns. Brand-new init on the default branch typically takes ~10s; non-default-branch init can take 30-90s while the server provisions a feature lane. The result includes `reused: boolean` (false for a brand-new app, true if a binding already existed) plus the canonical app/project identifiers and the dashboard URL. Use forceNew=true only when intentionally creating a new canonical family from scratch in a previously-bound repo; do NOT use forceNew as a retry mechanism for a failed init \u2014 it creates orphan backend apps and triggers canonical-family ambiguity errors on subsequent inits in this directory.",
|
|
1971
1908
|
access: "remote_write",
|
|
1972
1909
|
inputSchema: initInputSchema,
|
|
1973
1910
|
outputSchema: initSuccessSchema,
|
|
@@ -2051,31 +1988,9 @@ function registerCollabTools(server, context) {
|
|
|
2051
1988
|
});
|
|
2052
1989
|
}
|
|
2053
1990
|
});
|
|
2054
|
-
registerTool(server, context, {
|
|
2055
|
-
name: "remix_collab_finalize_turn",
|
|
2056
|
-
description: "Primary turn recorder for the current bound repository. Required: call this exactly once before the final response on every turn that touched a Remix-bound repo. Captures the current boundary locally and queues remote processing. Queued only: no remote change step exists yet until the finalize queue drains. Runtime exception: if this turn's context contains a [Remix runtime status] system note from the Remix UserPromptSubmit hook stating that the Stop hook will record this turn automatically, do NOT call this tool \u2014 the runtime is recording it on your behalf and a manual call would create a duplicate record. The runtime note is the only sanctioned override; trivial prompts, error states, and ambiguity all still require this call.",
|
|
2057
|
-
access: "local_write",
|
|
2058
|
-
inputSchema: finalizeTurnInputSchema,
|
|
2059
|
-
outputSchema: finalizeTurnSuccessSchema,
|
|
2060
|
-
annotations: getAnnotations("local_write", { idempotent: true }),
|
|
2061
|
-
run: async (args) => {
|
|
2062
|
-
const input = z3.object(finalizeTurnInputSchema).parse(args);
|
|
2063
|
-
const cwd = resolvePolicyCwd(context.policy, input.cwd);
|
|
2064
|
-
return finalizeCollabTurn({
|
|
2065
|
-
cwd,
|
|
2066
|
-
prompt: input.prompt,
|
|
2067
|
-
assistantResponse: input.assistantResponse,
|
|
2068
|
-
sync: input.sync,
|
|
2069
|
-
allowBranchMismatch: input.allowBranchMismatch ?? false,
|
|
2070
|
-
idempotencyKey: input.idempotencyKey,
|
|
2071
|
-
agent: context.agentMetadata,
|
|
2072
|
-
awaitingUsageDeadlineMs: 3e4
|
|
2073
|
-
});
|
|
2074
|
-
}
|
|
2075
|
-
});
|
|
2076
1991
|
registerTool(server, context, {
|
|
2077
1992
|
name: "remix_collab_drain_finalize_queue",
|
|
2078
|
-
description: "Drain the local finalize queue and record queued
|
|
1993
|
+
description: "Drain the local finalize queue and record queued hook-finalize jobs immediately. NOT required as a precondition for `remix_collab_request_merge` or `remix_collab_reconcile_apply` \u2014 those tools drain the queue internally before they run. Useful only for explicit recovery flows (e.g. status reports `await_finalize` and you want to flush before re-checking). Runtime exception: if this turn's context contains a [Remix runtime status] system note from the Remix UserPromptSubmit hook, the runtime drains the queue automatically in the background; do NOT call this tool unless an explicit recovery flow requires it.",
|
|
2079
1994
|
access: "local_write",
|
|
2080
1995
|
inputSchema: drainFinalizeQueueInputSchema,
|
|
2081
1996
|
outputSchema: drainFinalizeQueueSuccessSchema,
|
|
@@ -2113,7 +2028,7 @@ function registerCollabTools(server, context) {
|
|
|
2113
2028
|
});
|
|
2114
2029
|
registerTool(server, context, {
|
|
2115
2030
|
name: "remix_collab_re_anchor_preview",
|
|
2116
|
-
description: "Preview whether this checkout needs a fresh local Remix baseline. Use only when status reports `re_anchor` (no local baseline exists for this lane yet \u2014 fresh clone, deleted `.remix/` state, or first init didn't seed). Re-anchor does not replace
|
|
2031
|
+
description: "Preview whether this checkout needs a fresh local Remix baseline. Use only when status reports `re_anchor` (no local baseline exists for this lane yet \u2014 fresh clone, deleted `.remix/` state, or first init didn't seed). Re-anchor does not replace automatic hook recording; ordinary local content changes (including merges, pulls, and rebases) are captured at the completed-turn boundary, not by re-anchor.",
|
|
2117
2032
|
access: "read",
|
|
2118
2033
|
inputSchema: previewInputSchema,
|
|
2119
2034
|
outputSchema: reAnchorSuccessSchema,
|
|
@@ -2125,7 +2040,7 @@ function registerCollabTools(server, context) {
|
|
|
2125
2040
|
});
|
|
2126
2041
|
registerTool(server, context, {
|
|
2127
2042
|
name: "remix_collab_re_anchor_apply",
|
|
2128
|
-
description: "Establish a local Remix baseline for the current checkout against the existing app head, without rewriting the local checkout afterward. Required only when status reports `re_anchor` (missing local baseline). It does not replace
|
|
2043
|
+
description: "Establish a local Remix baseline for the current checkout against the existing app head, without rewriting the local checkout afterward. Required only when status reports `re_anchor` (missing local baseline). It does not replace automatic hook recording \u2014 local commits, pulls, merges, and rebases are still captured at the completed-turn boundary.",
|
|
2129
2044
|
access: "local_write",
|
|
2130
2045
|
inputSchema: reAnchorInputSchema,
|
|
2131
2046
|
outputSchema: reAnchorSuccessSchema,
|