@remixhq/mcp 0.1.14 → 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 +2 -2
package/dist/cli.js
CHANGED
|
@@ -499,14 +499,6 @@ var recordTurnInputSchema = {
|
|
|
499
499
|
allowBranchMismatch: z2.boolean().optional(),
|
|
500
500
|
idempotencyKey: z2.string().trim().min(1).optional()
|
|
501
501
|
};
|
|
502
|
-
var finalizeTurnInputSchema = {
|
|
503
|
-
...commonRequestFieldsSchema,
|
|
504
|
-
prompt: z2.string().trim().min(1),
|
|
505
|
-
assistantResponse: z2.string().trim().min(1),
|
|
506
|
-
sync: z2.boolean().optional(),
|
|
507
|
-
allowBranchMismatch: z2.boolean().optional(),
|
|
508
|
-
idempotencyKey: z2.string().trim().min(1).optional()
|
|
509
|
-
};
|
|
510
502
|
var previewInputSchema = {
|
|
511
503
|
...commonRequestFieldsSchema
|
|
512
504
|
};
|
|
@@ -676,17 +668,6 @@ var addDataSchema = z2.object({
|
|
|
676
668
|
changeStep: genericRecordSchema
|
|
677
669
|
});
|
|
678
670
|
var recordTurnDataSchema = genericRecordSchema;
|
|
679
|
-
var finalizeTurnDataSchema = z2.object({
|
|
680
|
-
mode: z2.enum(["changed_turn", "no_diff_turn"]),
|
|
681
|
-
idempotencyKey: z2.string().min(1),
|
|
682
|
-
queued: z2.boolean(),
|
|
683
|
-
jobId: z2.string().nullable(),
|
|
684
|
-
repoState: z2.string().nullable(),
|
|
685
|
-
changeStep: genericRecordSchema.nullable(),
|
|
686
|
-
collabTurn: genericRecordSchema.nullable(),
|
|
687
|
-
autoSync: genericRecordSchema.nullable(),
|
|
688
|
-
warnings: z2.array(z2.string())
|
|
689
|
-
});
|
|
690
671
|
var drainFinalizeQueueDataSchema = z2.object({
|
|
691
672
|
processed: z2.number().int().nonnegative(),
|
|
692
673
|
results: z2.array(genericRecordSchema)
|
|
@@ -766,7 +747,6 @@ var remixSuccessSchema = makeSuccessSchema(remixDataSchema);
|
|
|
766
747
|
var checkoutSuccessSchema = makeSuccessSchema(checkoutDataSchema);
|
|
767
748
|
var addSuccessSchema = makeSuccessSchema(addDataSchema);
|
|
768
749
|
var recordTurnSuccessSchema = makeSuccessSchema(recordTurnDataSchema);
|
|
769
|
-
var finalizeTurnSuccessSchema = makeSuccessSchema(finalizeTurnDataSchema);
|
|
770
750
|
var drainFinalizeQueueSuccessSchema = makeSuccessSchema(drainFinalizeQueueDataSchema);
|
|
771
751
|
var syncSuccessSchema = makeSuccessSchema(syncDataSchema);
|
|
772
752
|
var reAnchorSuccessSchema = makeSuccessSchema(reAnchorDataSchema);
|
|
@@ -787,13 +767,11 @@ var accessDebugSuccessSchema = makeSuccessSchema(accessDebugDataSchema);
|
|
|
787
767
|
var updateMemberRoleSuccessSchema = makeSuccessSchema(updateMemberRoleDataSchema);
|
|
788
768
|
|
|
789
769
|
// src/domain/coreAdapter.ts
|
|
790
|
-
import { spawn } from "child_process";
|
|
791
770
|
import {
|
|
792
771
|
collabList as coreCollabList,
|
|
793
772
|
collabListMembers as coreCollabListMembers,
|
|
794
773
|
collabUpdateMemberRole as coreCollabUpdateMemberRole,
|
|
795
774
|
drainPendingFinalizeQueue as coreDrainPendingFinalizeQueue,
|
|
796
|
-
collabFinalizeTurn as coreCollabFinalizeTurn,
|
|
797
775
|
collabApprove as coreCollabApprove,
|
|
798
776
|
collabCheckout as coreCollabCheckout,
|
|
799
777
|
collabListMergeRequests as coreCollabListMergeRequests,
|
|
@@ -832,17 +810,17 @@ function getRecommendedNextActions(status) {
|
|
|
832
810
|
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."];
|
|
833
811
|
case "re_anchor":
|
|
834
812
|
return [
|
|
835
|
-
"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,
|
|
813
|
+
"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."
|
|
836
814
|
];
|
|
837
815
|
case "record":
|
|
838
816
|
return [
|
|
839
|
-
"
|
|
817
|
+
"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."
|
|
840
818
|
];
|
|
841
819
|
case "reconcile":
|
|
842
820
|
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."];
|
|
843
821
|
case "await_finalize":
|
|
844
822
|
return [
|
|
845
|
-
"Run remix_collab_drain_finalize_queue before merge-related or recovery flows.
|
|
823
|
+
"Run remix_collab_drain_finalize_queue before merge-related or recovery flows. Hook recording is queued until the local finalize queue is drained."
|
|
846
824
|
];
|
|
847
825
|
case "review_queue":
|
|
848
826
|
return ["Run remix_collab_review_queue to inspect reviewable merge requests instead of using local git merge flows."];
|
|
@@ -877,17 +855,6 @@ function truncateText(value, maxChars) {
|
|
|
877
855
|
originalChars: value.length
|
|
878
856
|
};
|
|
879
857
|
}
|
|
880
|
-
function spawnFinalizeQueueDrainer() {
|
|
881
|
-
const entrypoint = process.argv[1];
|
|
882
|
-
if (!entrypoint) return false;
|
|
883
|
-
const child = spawn(process.execPath, [...process.execArgv, entrypoint, "--drain-finalize-queue"], {
|
|
884
|
-
detached: true,
|
|
885
|
-
stdio: "ignore",
|
|
886
|
-
env: process.env
|
|
887
|
-
});
|
|
888
|
-
child.unref();
|
|
889
|
-
return true;
|
|
890
|
-
}
|
|
891
858
|
async function drainBeforeMutation(api) {
|
|
892
859
|
const results = await coreDrainPendingFinalizeQueue({ api });
|
|
893
860
|
return results.flatMap((result) => collectResultWarnings(result));
|
|
@@ -930,7 +897,7 @@ async function initCollab(params) {
|
|
|
930
897
|
data: syncResult,
|
|
931
898
|
warnings: collectResultWarnings(result),
|
|
932
899
|
recommendedNextActions: syncResult.baselineStatus === "requires_re_anchor" ? [
|
|
933
|
-
"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,
|
|
900
|
+
"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."
|
|
934
901
|
] : syncResult.baselineStatus === "requires_sync" ? [
|
|
935
902
|
"Run remix_collab_sync_preview, then remix_collab_sync_apply to pull the server delta and create the first local baseline for this checkout."
|
|
936
903
|
] : ["Run remix_collab_status to inspect sync, reconcile, and merge-request readiness before mutating bound-repo state."],
|
|
@@ -995,36 +962,6 @@ async function checkoutCollab(params) {
|
|
|
995
962
|
}
|
|
996
963
|
};
|
|
997
964
|
}
|
|
998
|
-
async function finalizeCollabTurn(params) {
|
|
999
|
-
const api = await createCollabApiClient();
|
|
1000
|
-
const repoRoot = await findGitRoot(params.cwd);
|
|
1001
|
-
const result = await coreCollabFinalizeTurn({
|
|
1002
|
-
api,
|
|
1003
|
-
cwd: params.cwd,
|
|
1004
|
-
prompt: params.prompt,
|
|
1005
|
-
assistantResponse: params.assistantResponse,
|
|
1006
|
-
sync: params.sync,
|
|
1007
|
-
allowBranchMismatch: params.allowBranchMismatch ?? false,
|
|
1008
|
-
idempotencyKey: params.idempotencyKey ?? null,
|
|
1009
|
-
actor: params.agent,
|
|
1010
|
-
awaitingUsageDeadlineMs: params.awaitingUsageDeadlineMs ?? null
|
|
1011
|
-
});
|
|
1012
|
-
const hasAwaitingDeadline = typeof params.awaitingUsageDeadlineMs === "number" && params.awaitingUsageDeadlineMs > 0;
|
|
1013
|
-
if (result.queued && !hasAwaitingDeadline) {
|
|
1014
|
-
if (!spawnFinalizeQueueDrainer()) {
|
|
1015
|
-
await coreDrainPendingFinalizeQueue({ api });
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
return {
|
|
1019
|
-
data: result,
|
|
1020
|
-
warnings: result.warnings,
|
|
1021
|
-
recommendedNextActions: result.queued ? ["Run remix_collab_drain_finalize_queue before merge-related flows if you need this queued turn recorded immediately."] : [],
|
|
1022
|
-
logContext: {
|
|
1023
|
-
repoRoot,
|
|
1024
|
-
appId: result.changeStep?.appId ?? result.collabTurn?.appId ?? null
|
|
1025
|
-
}
|
|
1026
|
-
};
|
|
1027
|
-
}
|
|
1028
965
|
async function drainFinalizeQueue(params) {
|
|
1029
966
|
const api = await createCollabApiClient();
|
|
1030
967
|
const repoRoot = await findGitRoot(params.cwd);
|
|
@@ -1075,7 +1012,7 @@ async function reAnchor(params) {
|
|
|
1075
1012
|
data: result,
|
|
1076
1013
|
warnings: collectWarnings(result.warnings),
|
|
1077
1014
|
recommendedNextActions: params.dryRun ? [
|
|
1078
|
-
"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
|
|
1015
|
+
"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."
|
|
1079
1016
|
] : [],
|
|
1080
1017
|
logContext: {
|
|
1081
1018
|
repoRoot: result.repoRoot,
|
|
@@ -1807,7 +1744,7 @@ async function accessDebug(params) {
|
|
|
1807
1744
|
}
|
|
1808
1745
|
|
|
1809
1746
|
// src/tools/collab/autoSpawnHistoryImport.ts
|
|
1810
|
-
import { spawn
|
|
1747
|
+
import { spawn } from "child_process";
|
|
1811
1748
|
import { existsSync, mkdirSync, openSync } from "fs";
|
|
1812
1749
|
import path2 from "path";
|
|
1813
1750
|
var MARKER_REL_PATH = path2.join(".remix", ".history-imported");
|
|
@@ -1828,7 +1765,7 @@ function spawnHistoryImportDetached(repoRoot) {
|
|
|
1828
1765
|
const logPath = path2.join(repoRoot, LOG_REL_PATH);
|
|
1829
1766
|
const out = openSync(logPath, "a");
|
|
1830
1767
|
const err = openSync(logPath, "a");
|
|
1831
|
-
const child =
|
|
1768
|
+
const child = spawn(
|
|
1832
1769
|
"remix",
|
|
1833
1770
|
[
|
|
1834
1771
|
"history",
|
|
@@ -1971,7 +1908,7 @@ function registerCollabTools(server, context) {
|
|
|
1971
1908
|
});
|
|
1972
1909
|
registerTool(server, context, {
|
|
1973
1910
|
name: "remix_collab_init",
|
|
1974
|
-
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
|
|
1911
|
+
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.",
|
|
1975
1912
|
access: "remote_write",
|
|
1976
1913
|
inputSchema: initInputSchema,
|
|
1977
1914
|
outputSchema: initSuccessSchema,
|
|
@@ -2055,31 +1992,9 @@ function registerCollabTools(server, context) {
|
|
|
2055
1992
|
});
|
|
2056
1993
|
}
|
|
2057
1994
|
});
|
|
2058
|
-
registerTool(server, context, {
|
|
2059
|
-
name: "remix_collab_finalize_turn",
|
|
2060
|
-
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.",
|
|
2061
|
-
access: "local_write",
|
|
2062
|
-
inputSchema: finalizeTurnInputSchema,
|
|
2063
|
-
outputSchema: finalizeTurnSuccessSchema,
|
|
2064
|
-
annotations: getAnnotations("local_write", { idempotent: true }),
|
|
2065
|
-
run: async (args) => {
|
|
2066
|
-
const input = z3.object(finalizeTurnInputSchema).parse(args);
|
|
2067
|
-
const cwd = resolvePolicyCwd(context.policy, input.cwd);
|
|
2068
|
-
return finalizeCollabTurn({
|
|
2069
|
-
cwd,
|
|
2070
|
-
prompt: input.prompt,
|
|
2071
|
-
assistantResponse: input.assistantResponse,
|
|
2072
|
-
sync: input.sync,
|
|
2073
|
-
allowBranchMismatch: input.allowBranchMismatch ?? false,
|
|
2074
|
-
idempotencyKey: input.idempotencyKey,
|
|
2075
|
-
agent: context.agentMetadata,
|
|
2076
|
-
awaitingUsageDeadlineMs: 3e4
|
|
2077
|
-
});
|
|
2078
|
-
}
|
|
2079
|
-
});
|
|
2080
1995
|
registerTool(server, context, {
|
|
2081
1996
|
name: "remix_collab_drain_finalize_queue",
|
|
2082
|
-
description: "Drain the local finalize queue and record queued
|
|
1997
|
+
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.",
|
|
2083
1998
|
access: "local_write",
|
|
2084
1999
|
inputSchema: drainFinalizeQueueInputSchema,
|
|
2085
2000
|
outputSchema: drainFinalizeQueueSuccessSchema,
|
|
@@ -2117,7 +2032,7 @@ function registerCollabTools(server, context) {
|
|
|
2117
2032
|
});
|
|
2118
2033
|
registerTool(server, context, {
|
|
2119
2034
|
name: "remix_collab_re_anchor_preview",
|
|
2120
|
-
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
|
|
2035
|
+
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.",
|
|
2121
2036
|
access: "read",
|
|
2122
2037
|
inputSchema: previewInputSchema,
|
|
2123
2038
|
outputSchema: reAnchorSuccessSchema,
|
|
@@ -2129,7 +2044,7 @@ function registerCollabTools(server, context) {
|
|
|
2129
2044
|
});
|
|
2130
2045
|
registerTool(server, context, {
|
|
2131
2046
|
name: "remix_collab_re_anchor_apply",
|
|
2132
|
-
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
|
|
2047
|
+
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.",
|
|
2133
2048
|
access: "local_write",
|
|
2134
2049
|
inputSchema: reAnchorInputSchema,
|
|
2135
2050
|
outputSchema: reAnchorSuccessSchema,
|