midsummer-sol 0.3.1 → 0.3.4
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/package.json +1 -1
- package/sol-mcp.js +3 -44
- package/sol.js +4 -45
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "midsummer-sol",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Sol — agent-native version control (a new git). CLI, MCP server, and no-filesystem SDK.",
|
|
5
5
|
"bin": { "sol": "./sol.js", "sol-mcp": "./sol-mcp.js", "sol-secret-mcp": "./sol-secret-mcp.js" },
|
|
6
6
|
"main": "./index.js",
|
package/sol-mcp.js
CHANGED
|
@@ -4158,9 +4158,7 @@ __export(exports_remote, {
|
|
|
4158
4158
|
writeBundle: () => writeBundle,
|
|
4159
4159
|
saveRemote: () => saveRemote,
|
|
4160
4160
|
remoteRefs: () => remoteRefs,
|
|
4161
|
-
|
|
4162
|
-
remotePushChunked: () => remotePushChunked,
|
|
4163
|
-
remotePushBatch: () => remotePushBatch,
|
|
4161
|
+
remotePushPack: () => remotePushPack,
|
|
4164
4162
|
remotePush: () => remotePush,
|
|
4165
4163
|
remotePromote: () => remotePromote,
|
|
4166
4164
|
remoteHead: () => remoteHead,
|
|
@@ -4199,44 +4197,6 @@ async function call(cfg, token, path, init) {
|
|
|
4199
4197
|
throw new Error(`remote ${path} -> ${res.status}: ${(await res.text().catch(() => "")).slice(0, 200)}`);
|
|
4200
4198
|
return res.json();
|
|
4201
4199
|
}
|
|
4202
|
-
function splitNodes(nodes, batchSizeBytes) {
|
|
4203
|
-
const batches = [];
|
|
4204
|
-
let cur = [];
|
|
4205
|
-
let curBytes = 0;
|
|
4206
|
-
for (const node of nodes) {
|
|
4207
|
-
const nb = sizeOf(node);
|
|
4208
|
-
if (cur.length && curBytes + nb > batchSizeBytes) {
|
|
4209
|
-
batches.push(cur);
|
|
4210
|
-
cur = [];
|
|
4211
|
-
curBytes = 0;
|
|
4212
|
-
}
|
|
4213
|
-
cur.push(node);
|
|
4214
|
-
curBytes += nb;
|
|
4215
|
-
}
|
|
4216
|
-
if (cur.length)
|
|
4217
|
-
batches.push(cur);
|
|
4218
|
-
return batches.length ? batches : [[]];
|
|
4219
|
-
}
|
|
4220
|
-
async function remotePushChunked(cfg, token, body, batchSizeBytes = DEFAULT_BATCH_BYTES) {
|
|
4221
|
-
const totalBytes = sizeOf(body.nodes) + sizeOf(body.ops);
|
|
4222
|
-
if (totalBytes <= batchSizeBytes)
|
|
4223
|
-
return remotePush(cfg, token, body);
|
|
4224
|
-
const stamp = `${body.head ?? "h"}-${Date.now()}`;
|
|
4225
|
-
const nodeBatches = splitNodes(body.nodes, batchSizeBytes);
|
|
4226
|
-
const batchIds = [];
|
|
4227
|
-
try {
|
|
4228
|
-
for (let i = 0;i < nodeBatches.length; i++) {
|
|
4229
|
-
const batchId = `${stamp}-${i}`;
|
|
4230
|
-
batchIds.push(batchId);
|
|
4231
|
-
await remotePushBatch(cfg, token, batchId, nodeBatches[i], i === 0 ? body.ops : [], i);
|
|
4232
|
-
}
|
|
4233
|
-
} catch (e) {
|
|
4234
|
-
if (e instanceof Error && /-> 404/.test(e.message))
|
|
4235
|
-
return remotePush(cfg, token, body);
|
|
4236
|
-
throw e;
|
|
4237
|
-
}
|
|
4238
|
-
return remotePushFinalize(cfg, token, batchIds, body.branch, body.head, body.expectedHead);
|
|
4239
|
-
}
|
|
4240
4200
|
function loadRemote(solDir2) {
|
|
4241
4201
|
const p = join6(solDir2, "remote.json");
|
|
4242
4202
|
return existsSync6(p) ? JSON.parse(readFileSync6(p, "utf8")) : undefined;
|
|
@@ -4257,10 +4217,9 @@ async function writeBundle(solDir2, bundle, from = 0) {
|
|
|
4257
4217
|
writeFileSync6(join6(solDir2, "HEAD"), JSON.stringify({ head: bundle.head, seq: bundle.seq, logTip: bundle.tip }));
|
|
4258
4218
|
return fresh.length;
|
|
4259
4219
|
}
|
|
4260
|
-
var endpoint = (cfg, path) => `${cfg.url.replace(/\/+$/, "")}${path}${path.includes("?") ? "&" : "?"}repo=${encodeURIComponent(cfg.repo)}`, remoteHead = (cfg, token) => call(cfg, token, "/head"), remoteGate = (cfg, token, branch) => call(cfg, token, `/head?gateState=true${branch ? `&branch=${encodeURIComponent(branch)}` : ""}`), remoteExport = (cfg, token) => call(cfg, token, "/export"), remoteRefs = (cfg, token) => call(cfg, token, "/refs"), remotePush = (cfg, token, body) => call(cfg, token, "/push", { method: "POST", body: JSON.stringify(body) }), remotePromote = (cfg, token, branch) => call(cfg, token, "/promote", { method: "POST", body: JSON.stringify({ branch }) }),
|
|
4220
|
+
var endpoint = (cfg, path) => `${cfg.url.replace(/\/+$/, "")}${path}${path.includes("?") ? "&" : "?"}repo=${encodeURIComponent(cfg.repo)}`, remoteHead = (cfg, token) => call(cfg, token, "/head"), remoteGate = (cfg, token, branch) => call(cfg, token, `/head?gateState=true${branch ? `&branch=${encodeURIComponent(branch)}` : ""}`), remoteExport = (cfg, token) => call(cfg, token, "/export"), remoteRefs = (cfg, token) => call(cfg, token, "/refs"), remotePush = (cfg, token, body) => call(cfg, token, "/push", { method: "POST", body: JSON.stringify(body) }), remotePromote = (cfg, token, branch) => call(cfg, token, "/promote", { method: "POST", body: JSON.stringify({ branch }) }), remotePushPack = (cfg, token, body) => call(cfg, token, "/push/pack", { method: "POST", body: gzipSync3(JSON.stringify(body)), headers: { "content-encoding": "gzip" } }), mrOpen = (cfg, token, body) => call(cfg, token, "/mr", { method: "POST", body: JSON.stringify(body) }), mrList = (cfg, token) => call(cfg, token, "/mrs"), mrDiff = (cfg, token, id) => call(cfg, token, `/mr/diff?id=${id}`), mrGet = (cfg, token, id) => call(cfg, token, `/mr?id=${id}`), mrAction = (cfg, token, action, body) => call(cfg, token, `/mr/${action}`, { method: "POST", body: JSON.stringify(body) }), accessGet = (cfg, token) => call(cfg, token, "/access"), ownerSet = (cfg, token, ownerHandle) => call(cfg, token, "/owner", { method: "POST", body: JSON.stringify({ ownerHandle }) }), accessSet = (cfg, token, body) => call(cfg, token, "/access", { method: "POST", body: JSON.stringify(body) }), policyCheck = (cfg, token, paths) => call(cfg, token, "/policy/check", { method: "POST", body: JSON.stringify({ paths }) }), policyGet = (cfg, token) => call(cfg, token, "/policy"), policyUpsert = (cfg, token, rule) => call(cfg, token, "/policy?write=1", { method: "POST", body: JSON.stringify({ op: "upsert", rule }) }), policyRemove = (cfg, token, pattern) => call(cfg, token, "/policy?write=1", { method: "POST", body: JSON.stringify({ op: "remove", pattern }) }), recipientsForPath = (cfg, token, path) => call(cfg, token, `/recipients?path=${encodeURIComponent(path)}`), recipientsForAudience = (cfg, token, audience, recovery) => call(cfg, token, `/recipients?audience=${encodeURIComponent(JSON.stringify(audience))}${recovery?.length ? `&recovery=${encodeURIComponent(recovery.join(","))}` : ""}`), remoteEnvPush = (cfg, token, bundle) => call(cfg, token, "/env/push", { method: "POST", body: JSON.stringify(bundle) }), remoteEnvAnchor = (cfg, token) => call(cfg, token, "/env/anchor"), remoteEnvPull = (cfg, token) => call(cfg, token, "/env/pull"), forkMeta = (cfg, token, parent) => call(cfg, token, "/fork-meta", { method: "POST", body: JSON.stringify({ parent }) }), forksList = (cfg, token) => call(cfg, token, "/forks"), saveRemote = (solDir2, cfg) => writeFileSync6(join6(solDir2, "remote.json"), JSON.stringify(cfg, null, 2));
|
|
4261
4221
|
var init_remote = __esm(() => {
|
|
4262
4222
|
init_file_store2();
|
|
4263
|
-
DEFAULT_BATCH_BYTES = 5 * 1024 * 1024;
|
|
4264
4223
|
});
|
|
4265
4224
|
|
|
4266
4225
|
// src/bin/test-gate.ts
|
|
@@ -12549,7 +12508,7 @@ WARNING: "${path}" was committed as PLAINTEXT before this seal — the pre-seal
|
|
|
12549
12508
|
const forkBase = localRefs?.branches[branch]?.remote;
|
|
12550
12509
|
const baseOp = forkBase ? ops.find((o) => o.rootAfter === forkBase) : undefined;
|
|
12551
12510
|
const fromSeq = baseOp ? baseOp.seq : rh.seq;
|
|
12552
|
-
const res = await
|
|
12511
|
+
const res = await remotePushPack(cfg, token, {
|
|
12553
12512
|
nodes: allLocalNodes(),
|
|
12554
12513
|
ops: ops.filter((o) => o.seq > fromSeq),
|
|
12555
12514
|
branch,
|
package/sol.js
CHANGED
|
@@ -3391,9 +3391,7 @@ __export(exports_remote, {
|
|
|
3391
3391
|
writeBundle: () => writeBundle,
|
|
3392
3392
|
saveRemote: () => saveRemote,
|
|
3393
3393
|
remoteRefs: () => remoteRefs,
|
|
3394
|
-
|
|
3395
|
-
remotePushChunked: () => remotePushChunked,
|
|
3396
|
-
remotePushBatch: () => remotePushBatch,
|
|
3394
|
+
remotePushPack: () => remotePushPack,
|
|
3397
3395
|
remotePush: () => remotePush,
|
|
3398
3396
|
remotePromote: () => remotePromote,
|
|
3399
3397
|
remoteHead: () => remoteHead,
|
|
@@ -3432,44 +3430,6 @@ async function call(cfg, token, path, init) {
|
|
|
3432
3430
|
throw new Error(`remote ${path} -> ${res.status}: ${(await res.text().catch(() => "")).slice(0, 200)}`);
|
|
3433
3431
|
return res.json();
|
|
3434
3432
|
}
|
|
3435
|
-
function splitNodes(nodes, batchSizeBytes) {
|
|
3436
|
-
const batches = [];
|
|
3437
|
-
let cur = [];
|
|
3438
|
-
let curBytes = 0;
|
|
3439
|
-
for (const node of nodes) {
|
|
3440
|
-
const nb = sizeOf(node);
|
|
3441
|
-
if (cur.length && curBytes + nb > batchSizeBytes) {
|
|
3442
|
-
batches.push(cur);
|
|
3443
|
-
cur = [];
|
|
3444
|
-
curBytes = 0;
|
|
3445
|
-
}
|
|
3446
|
-
cur.push(node);
|
|
3447
|
-
curBytes += nb;
|
|
3448
|
-
}
|
|
3449
|
-
if (cur.length)
|
|
3450
|
-
batches.push(cur);
|
|
3451
|
-
return batches.length ? batches : [[]];
|
|
3452
|
-
}
|
|
3453
|
-
async function remotePushChunked(cfg, token, body, batchSizeBytes = DEFAULT_BATCH_BYTES) {
|
|
3454
|
-
const totalBytes = sizeOf(body.nodes) + sizeOf(body.ops);
|
|
3455
|
-
if (totalBytes <= batchSizeBytes)
|
|
3456
|
-
return remotePush(cfg, token, body);
|
|
3457
|
-
const stamp = `${body.head ?? "h"}-${Date.now()}`;
|
|
3458
|
-
const nodeBatches = splitNodes(body.nodes, batchSizeBytes);
|
|
3459
|
-
const batchIds = [];
|
|
3460
|
-
try {
|
|
3461
|
-
for (let i = 0;i < nodeBatches.length; i++) {
|
|
3462
|
-
const batchId = `${stamp}-${i}`;
|
|
3463
|
-
batchIds.push(batchId);
|
|
3464
|
-
await remotePushBatch(cfg, token, batchId, nodeBatches[i], i === 0 ? body.ops : [], i);
|
|
3465
|
-
}
|
|
3466
|
-
} catch (e) {
|
|
3467
|
-
if (e instanceof Error && /-> 404/.test(e.message))
|
|
3468
|
-
return remotePush(cfg, token, body);
|
|
3469
|
-
throw e;
|
|
3470
|
-
}
|
|
3471
|
-
return remotePushFinalize(cfg, token, batchIds, body.branch, body.head, body.expectedHead);
|
|
3472
|
-
}
|
|
3473
3433
|
function loadRemote(solDir2) {
|
|
3474
3434
|
const p = join5(solDir2, "remote.json");
|
|
3475
3435
|
return existsSync5(p) ? JSON.parse(readFileSync5(p, "utf8")) : undefined;
|
|
@@ -3490,10 +3450,9 @@ async function writeBundle(solDir2, bundle, from = 0) {
|
|
|
3490
3450
|
writeFileSync5(join5(solDir2, "HEAD"), JSON.stringify({ head: bundle.head, seq: bundle.seq, logTip: bundle.tip }));
|
|
3491
3451
|
return fresh.length;
|
|
3492
3452
|
}
|
|
3493
|
-
var endpoint = (cfg, path) => `${cfg.url.replace(/\/+$/, "")}${path}${path.includes("?") ? "&" : "?"}repo=${encodeURIComponent(cfg.repo)}`, remoteHead = (cfg, token) => call(cfg, token, "/head"), remoteGate = (cfg, token, branch) => call(cfg, token, `/head?gateState=true${branch ? `&branch=${encodeURIComponent(branch)}` : ""}`), remoteExport = (cfg, token) => call(cfg, token, "/export"), remoteRefs = (cfg, token) => call(cfg, token, "/refs"), remotePush = (cfg, token, body) => call(cfg, token, "/push", { method: "POST", body: JSON.stringify(body) }), remotePromote = (cfg, token, branch) => call(cfg, token, "/promote", { method: "POST", body: JSON.stringify({ branch }) }),
|
|
3453
|
+
var endpoint = (cfg, path) => `${cfg.url.replace(/\/+$/, "")}${path}${path.includes("?") ? "&" : "?"}repo=${encodeURIComponent(cfg.repo)}`, remoteHead = (cfg, token) => call(cfg, token, "/head"), remoteGate = (cfg, token, branch) => call(cfg, token, `/head?gateState=true${branch ? `&branch=${encodeURIComponent(branch)}` : ""}`), remoteExport = (cfg, token) => call(cfg, token, "/export"), remoteRefs = (cfg, token) => call(cfg, token, "/refs"), remotePush = (cfg, token, body) => call(cfg, token, "/push", { method: "POST", body: JSON.stringify(body) }), remotePromote = (cfg, token, branch) => call(cfg, token, "/promote", { method: "POST", body: JSON.stringify({ branch }) }), remotePushPack = (cfg, token, body) => call(cfg, token, "/push/pack", { method: "POST", body: gzipSync2(JSON.stringify(body)), headers: { "content-encoding": "gzip" } }), mrOpen = (cfg, token, body) => call(cfg, token, "/mr", { method: "POST", body: JSON.stringify(body) }), mrList = (cfg, token) => call(cfg, token, "/mrs"), mrDiff = (cfg, token, id) => call(cfg, token, `/mr/diff?id=${id}`), mrGet = (cfg, token, id) => call(cfg, token, `/mr?id=${id}`), mrAction = (cfg, token, action, body) => call(cfg, token, `/mr/${action}`, { method: "POST", body: JSON.stringify(body) }), accessGet = (cfg, token) => call(cfg, token, "/access"), ownerSet = (cfg, token, ownerHandle) => call(cfg, token, "/owner", { method: "POST", body: JSON.stringify({ ownerHandle }) }), accessSet = (cfg, token, body) => call(cfg, token, "/access", { method: "POST", body: JSON.stringify(body) }), policyCheck = (cfg, token, paths) => call(cfg, token, "/policy/check", { method: "POST", body: JSON.stringify({ paths }) }), policyGet = (cfg, token) => call(cfg, token, "/policy"), policyUpsert = (cfg, token, rule) => call(cfg, token, "/policy?write=1", { method: "POST", body: JSON.stringify({ op: "upsert", rule }) }), policyRemove = (cfg, token, pattern) => call(cfg, token, "/policy?write=1", { method: "POST", body: JSON.stringify({ op: "remove", pattern }) }), recipientsForPath = (cfg, token, path) => call(cfg, token, `/recipients?path=${encodeURIComponent(path)}`), recipientsForAudience = (cfg, token, audience, recovery) => call(cfg, token, `/recipients?audience=${encodeURIComponent(JSON.stringify(audience))}${recovery?.length ? `&recovery=${encodeURIComponent(recovery.join(","))}` : ""}`), remoteEnvPush = (cfg, token, bundle) => call(cfg, token, "/env/push", { method: "POST", body: JSON.stringify(bundle) }), remoteEnvAnchor = (cfg, token) => call(cfg, token, "/env/anchor"), remoteEnvPull = (cfg, token) => call(cfg, token, "/env/pull"), forkMeta = (cfg, token, parent) => call(cfg, token, "/fork-meta", { method: "POST", body: JSON.stringify({ parent }) }), forksList = (cfg, token) => call(cfg, token, "/forks"), saveRemote = (solDir2, cfg) => writeFileSync5(join5(solDir2, "remote.json"), JSON.stringify(cfg, null, 2));
|
|
3494
3454
|
var init_remote = __esm(() => {
|
|
3495
3455
|
init_file_store();
|
|
3496
|
-
DEFAULT_BATCH_BYTES = 5 * 1024 * 1024;
|
|
3497
3456
|
});
|
|
3498
3457
|
|
|
3499
3458
|
// src/bin/test-gate.ts
|
|
@@ -12317,7 +12276,7 @@ WARNING: "${path}" was committed as PLAINTEXT before this seal — the pre-seal
|
|
|
12317
12276
|
const forkBase = localRefs?.branches[branch]?.remote;
|
|
12318
12277
|
const baseOp = forkBase ? ops.find((o) => o.rootAfter === forkBase) : undefined;
|
|
12319
12278
|
const fromSeq = baseOp ? baseOp.seq : rh.seq;
|
|
12320
|
-
const res = await
|
|
12279
|
+
const res = await remotePushPack(cfg, token, {
|
|
12321
12280
|
nodes: allLocalNodes(),
|
|
12322
12281
|
ops: ops.filter((o) => o.seq > fromSeq),
|
|
12323
12282
|
branch,
|
|
@@ -16601,7 +16560,7 @@ WARNING: "${path}" was committed as PLAINTEXT before this seal — the pre-seal
|
|
|
16601
16560
|
const forkBase = localRefs?.branches[branch]?.remote;
|
|
16602
16561
|
const baseOp = forkBase ? ops.find((o) => o.rootAfter === forkBase) : undefined;
|
|
16603
16562
|
const fromSeq = baseOp ? baseOp.seq : rh.seq;
|
|
16604
|
-
const res = await
|
|
16563
|
+
const res = await remotePushPack(cfg, token, {
|
|
16605
16564
|
nodes: allLocalNodes(),
|
|
16606
16565
|
ops: ops.filter((o) => o.seq > fromSeq),
|
|
16607
16566
|
branch,
|