@coderule/mcp 1.4.0 → 1.6.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/dist/cli.cjs +38 -6
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +38 -6
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +33 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +33 -5
- package/dist/index.js.map +1 -1
- package/dist/mcp-cli.cjs +154 -31
- package/dist/mcp-cli.cjs.map +1 -1
- package/dist/mcp-cli.js +154 -31
- package/dist/mcp-cli.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -30,6 +30,8 @@ var DEFAULT_QUEUE_POLL_INTERVAL_MS = 500;
|
|
|
30
30
|
var DEFAULT_HASH_BATCH_SIZE = 32;
|
|
31
31
|
var DEFAULT_MAX_SNAPSHOT_ATTEMPTS = 5;
|
|
32
32
|
var DEFAULT_HTTP_TIMEOUT_MS = 12e4;
|
|
33
|
+
var DEFAULT_UPLOAD_CHUNK_SIZE = 1;
|
|
34
|
+
var DEFAULT_MAX_QUERY_WAIT_MS = 5e4;
|
|
33
35
|
|
|
34
36
|
// src/config/Configurator.ts
|
|
35
37
|
var DEFAULT_RETRIEVAL_FORMATTER = "standard";
|
|
@@ -57,6 +59,14 @@ function parseInteger(value, fallback) {
|
|
|
57
59
|
}
|
|
58
60
|
return parsed;
|
|
59
61
|
}
|
|
62
|
+
function parseSecondsToMs(value, fallbackMs) {
|
|
63
|
+
if (!value) return fallbackMs;
|
|
64
|
+
const seconds = Number.parseInt(value, 10);
|
|
65
|
+
if (Number.isNaN(seconds) || seconds <= 0) {
|
|
66
|
+
throw new Error(`Invalid seconds value: ${value}`);
|
|
67
|
+
}
|
|
68
|
+
return seconds * 1e3;
|
|
69
|
+
}
|
|
60
70
|
function parseFormatter(value) {
|
|
61
71
|
if (!value) return DEFAULT_RETRIEVAL_FORMATTER;
|
|
62
72
|
const normalized = value.toLowerCase();
|
|
@@ -103,7 +113,9 @@ async function resolveConfig({
|
|
|
103
113
|
maxSnapshotAttempts: DEFAULTS.maxSnapshotAttempts,
|
|
104
114
|
retrievalFormatter: parseFormatter(
|
|
105
115
|
process.env.CODERULE_RETRIEVAL_FORMATTER
|
|
106
|
-
)
|
|
116
|
+
),
|
|
117
|
+
uploadChunkSize: DEFAULT_UPLOAD_CHUNK_SIZE,
|
|
118
|
+
maxQueryWaitMs: DEFAULT_MAX_QUERY_WAIT_MS
|
|
107
119
|
};
|
|
108
120
|
if (process.env.CODERULE_SNAPSHOT_DEBOUNCE_MS) {
|
|
109
121
|
baseConfig.snapshotDebounceMs = parseInteger(
|
|
@@ -145,6 +157,16 @@ async function resolveConfig({
|
|
|
145
157
|
process.env.CODERULE_HTTP_TIMEOUT,
|
|
146
158
|
DEFAULT_HTTP_TIMEOUT_MS
|
|
147
159
|
);
|
|
160
|
+
if (process.env.CODERULE_UPLOAD_CHUNK_SIZE) {
|
|
161
|
+
baseConfig.uploadChunkSize = parseInteger(
|
|
162
|
+
process.env.CODERULE_UPLOAD_CHUNK_SIZE,
|
|
163
|
+
baseConfig.uploadChunkSize
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
baseConfig.maxQueryWaitMs = parseSecondsToMs(
|
|
167
|
+
process.env.CODERULE_MAX_WAIT_TIME,
|
|
168
|
+
baseConfig.maxQueryWaitMs
|
|
169
|
+
);
|
|
148
170
|
logger.debug(
|
|
149
171
|
{
|
|
150
172
|
rootPath,
|
|
@@ -1078,7 +1100,7 @@ async function withRetries(op, logger2, context, maxAttempts) {
|
|
|
1078
1100
|
}
|
|
1079
1101
|
}
|
|
1080
1102
|
}
|
|
1081
|
-
async function uploadMissing(rootPath, missing, syncClient, logger2, maxAttempts, chunkSize =
|
|
1103
|
+
async function uploadMissing(rootPath, missing, syncClient, logger2, maxAttempts, chunkSize = 1) {
|
|
1082
1104
|
if (!missing || missing.length === 0) return;
|
|
1083
1105
|
const total = missing.length;
|
|
1084
1106
|
const chunks = [];
|
|
@@ -1120,7 +1142,7 @@ async function uploadMissing(rootPath, missing, syncClient, logger2, maxAttempts
|
|
|
1120
1142
|
async function ensureSnapshotCreated(rootPath, computation, syncClient, logger2, options) {
|
|
1121
1143
|
const { snapshotHash, files } = computation;
|
|
1122
1144
|
const maxAttempts = options?.maxAttempts ?? 5;
|
|
1123
|
-
const uploadChunkSize = options?.uploadChunkSize ??
|
|
1145
|
+
const uploadChunkSize = options?.uploadChunkSize ?? 1;
|
|
1124
1146
|
let status = await withRetries(
|
|
1125
1147
|
() => syncClient.checkSnapshotStatus(snapshotHash),
|
|
1126
1148
|
logger2,
|
|
@@ -1225,7 +1247,10 @@ async function runInitialSyncPipeline(runtime) {
|
|
|
1225
1247
|
runtime.snapshotsRepo,
|
|
1226
1248
|
runtime.clients.sync,
|
|
1227
1249
|
syncLogger,
|
|
1228
|
-
{
|
|
1250
|
+
{
|
|
1251
|
+
maxAttempts: runtime.config.maxSnapshotAttempts,
|
|
1252
|
+
uploadChunkSize: runtime.config.uploadChunkSize
|
|
1253
|
+
}
|
|
1229
1254
|
);
|
|
1230
1255
|
return result;
|
|
1231
1256
|
}
|
|
@@ -1629,7 +1654,10 @@ var ServiceRunner = class {
|
|
|
1629
1654
|
this.runtime.snapshotsRepo,
|
|
1630
1655
|
this.runtime.clients.sync,
|
|
1631
1656
|
log,
|
|
1632
|
-
{
|
|
1657
|
+
{
|
|
1658
|
+
maxAttempts: this.runtime.config.maxSnapshotAttempts,
|
|
1659
|
+
uploadChunkSize: this.runtime.config.uploadChunkSize
|
|
1660
|
+
}
|
|
1633
1661
|
);
|
|
1634
1662
|
this.runtime.outbox.ack(job.id, this.fsControlLeaseOwner);
|
|
1635
1663
|
this.state.updateSnapshotReady(result.createdAt);
|