midsummer-sol 0.3.7 → 0.3.8
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 +33 -1
- package/sol.js +33 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "midsummer-sol",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8",
|
|
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
|
@@ -4192,6 +4192,7 @@ __export(exports_remote, {
|
|
|
4192
4192
|
loadRemote: () => loadRemote,
|
|
4193
4193
|
forksList: () => forksList,
|
|
4194
4194
|
forkMeta: () => forkMeta,
|
|
4195
|
+
exportStreaming: () => exportStreaming,
|
|
4195
4196
|
classifyNodes: () => classifyNodes,
|
|
4196
4197
|
accessSet: () => accessSet,
|
|
4197
4198
|
accessGet: () => accessGet
|
|
@@ -4258,6 +4259,37 @@ async function exportStreaming(cfg, token) {
|
|
|
4258
4259
|
throw new Error("remote /export returned an empty stream");
|
|
4259
4260
|
return { ...header, nodes };
|
|
4260
4261
|
}
|
|
4262
|
+
async function exportManifest(cfg, token) {
|
|
4263
|
+
const res = await fetch(endpoint(cfg, "/export/manifest"), {
|
|
4264
|
+
headers: { authorization: `Bearer ${token}`, "content-type": "application/json" }
|
|
4265
|
+
});
|
|
4266
|
+
if (res.status === 404)
|
|
4267
|
+
return exportStreaming(cfg, token);
|
|
4268
|
+
if (!res.ok)
|
|
4269
|
+
throw new Error(`remote /export/manifest -> ${res.status}: ${(await res.text().catch(() => "")).slice(0, 200)}`);
|
|
4270
|
+
const m = await res.json();
|
|
4271
|
+
if (!Array.isArray(m.packIds))
|
|
4272
|
+
return exportStreaming(cfg, token);
|
|
4273
|
+
const tasks = [
|
|
4274
|
+
...(m.packIds ?? []).map((packId) => () => fetchPack(cfg, token, packId, false)),
|
|
4275
|
+
...(m.legacyNodes ?? []).map((hash) => () => fetchPack(cfg, token, hash, true))
|
|
4276
|
+
];
|
|
4277
|
+
const packNodes = await pool(tasks, CLONE_PACK_CONCURRENCY);
|
|
4278
|
+
const nodes = [];
|
|
4279
|
+
for (const ns of packNodes)
|
|
4280
|
+
for (const n of ns)
|
|
4281
|
+
nodes.push(n);
|
|
4282
|
+
return { schema: m.schema, head: m.head, seq: m.seq, tip: m.tip, ops: m.ops, nodes, refs: m.refs, checkout: m.checkout };
|
|
4283
|
+
}
|
|
4284
|
+
async function fetchPack(cfg, token, id, legacy) {
|
|
4285
|
+
return retryTransient(async () => {
|
|
4286
|
+
const path = `/pack/${encodeURIComponent(id)}${legacy ? "?legacy=1" : ""}`;
|
|
4287
|
+
const res = await fetch(endpoint(cfg, path), { headers: { authorization: `Bearer ${token}` } });
|
|
4288
|
+
if (!res.ok)
|
|
4289
|
+
throw new Error(`remote /pack -> ${res.status}: ${(await res.text().catch(() => "")).slice(0, 200)}`);
|
|
4290
|
+
return decodePackLine((await res.text()).trim());
|
|
4291
|
+
});
|
|
4292
|
+
}
|
|
4261
4293
|
function classifyNodes(nodes) {
|
|
4262
4294
|
const trees = [];
|
|
4263
4295
|
const leaves = [];
|
|
@@ -4369,7 +4401,7 @@ async function writeBundle(solDir2, bundle, from = 0) {
|
|
|
4369
4401
|
writeFileSync6(join6(solDir2, "HEAD"), JSON.stringify({ head: bundle.head, seq: bundle.seq, logTip: bundle.tip }));
|
|
4370
4402
|
return fresh.length;
|
|
4371
4403
|
}
|
|
4372
|
-
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) =>
|
|
4404
|
+
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)}` : ""}`), CLONE_PACK_CONCURRENCY = 12, remoteExport = (cfg, token) => exportManifest(cfg, token), 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 }) }), SMALL_PUSH_BYTES, BLOB_PACK_BYTES, BLOB_PACK_CONCURRENCY = 6, GIANT_LEAF_BYTES, nodeBytes = (n) => JSON.stringify(n).length, remotePushBlobs = (cfg, token, nodes) => retryTransient(() => call(cfg, token, "/push/blobs", { method: "POST", body: gzipSync3(JSON.stringify({ nodes })), 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));
|
|
4373
4405
|
var init_remote = __esm(() => {
|
|
4374
4406
|
init_file_store2();
|
|
4375
4407
|
init_store();
|
package/sol.js
CHANGED
|
@@ -3425,6 +3425,7 @@ __export(exports_remote, {
|
|
|
3425
3425
|
loadRemote: () => loadRemote,
|
|
3426
3426
|
forksList: () => forksList,
|
|
3427
3427
|
forkMeta: () => forkMeta,
|
|
3428
|
+
exportStreaming: () => exportStreaming,
|
|
3428
3429
|
classifyNodes: () => classifyNodes,
|
|
3429
3430
|
accessSet: () => accessSet,
|
|
3430
3431
|
accessGet: () => accessGet
|
|
@@ -3491,6 +3492,37 @@ async function exportStreaming(cfg, token) {
|
|
|
3491
3492
|
throw new Error("remote /export returned an empty stream");
|
|
3492
3493
|
return { ...header, nodes };
|
|
3493
3494
|
}
|
|
3495
|
+
async function exportManifest(cfg, token) {
|
|
3496
|
+
const res = await fetch(endpoint(cfg, "/export/manifest"), {
|
|
3497
|
+
headers: { authorization: `Bearer ${token}`, "content-type": "application/json" }
|
|
3498
|
+
});
|
|
3499
|
+
if (res.status === 404)
|
|
3500
|
+
return exportStreaming(cfg, token);
|
|
3501
|
+
if (!res.ok)
|
|
3502
|
+
throw new Error(`remote /export/manifest -> ${res.status}: ${(await res.text().catch(() => "")).slice(0, 200)}`);
|
|
3503
|
+
const m = await res.json();
|
|
3504
|
+
if (!Array.isArray(m.packIds))
|
|
3505
|
+
return exportStreaming(cfg, token);
|
|
3506
|
+
const tasks = [
|
|
3507
|
+
...(m.packIds ?? []).map((packId) => () => fetchPack(cfg, token, packId, false)),
|
|
3508
|
+
...(m.legacyNodes ?? []).map((hash) => () => fetchPack(cfg, token, hash, true))
|
|
3509
|
+
];
|
|
3510
|
+
const packNodes = await pool(tasks, CLONE_PACK_CONCURRENCY);
|
|
3511
|
+
const nodes = [];
|
|
3512
|
+
for (const ns of packNodes)
|
|
3513
|
+
for (const n of ns)
|
|
3514
|
+
nodes.push(n);
|
|
3515
|
+
return { schema: m.schema, head: m.head, seq: m.seq, tip: m.tip, ops: m.ops, nodes, refs: m.refs, checkout: m.checkout };
|
|
3516
|
+
}
|
|
3517
|
+
async function fetchPack(cfg, token, id, legacy) {
|
|
3518
|
+
return retryTransient(async () => {
|
|
3519
|
+
const path = `/pack/${encodeURIComponent(id)}${legacy ? "?legacy=1" : ""}`;
|
|
3520
|
+
const res = await fetch(endpoint(cfg, path), { headers: { authorization: `Bearer ${token}` } });
|
|
3521
|
+
if (!res.ok)
|
|
3522
|
+
throw new Error(`remote /pack -> ${res.status}: ${(await res.text().catch(() => "")).slice(0, 200)}`);
|
|
3523
|
+
return decodePackLine((await res.text()).trim());
|
|
3524
|
+
});
|
|
3525
|
+
}
|
|
3494
3526
|
function classifyNodes(nodes) {
|
|
3495
3527
|
const trees = [];
|
|
3496
3528
|
const leaves = [];
|
|
@@ -3602,7 +3634,7 @@ async function writeBundle(solDir2, bundle, from = 0) {
|
|
|
3602
3634
|
writeFileSync5(join5(solDir2, "HEAD"), JSON.stringify({ head: bundle.head, seq: bundle.seq, logTip: bundle.tip }));
|
|
3603
3635
|
return fresh.length;
|
|
3604
3636
|
}
|
|
3605
|
-
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) =>
|
|
3637
|
+
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)}` : ""}`), CLONE_PACK_CONCURRENCY = 12, remoteExport = (cfg, token) => exportManifest(cfg, token), 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 }) }), SMALL_PUSH_BYTES, BLOB_PACK_BYTES, BLOB_PACK_CONCURRENCY = 6, GIANT_LEAF_BYTES, nodeBytes = (n) => JSON.stringify(n).length, remotePushBlobs = (cfg, token, nodes) => retryTransient(() => call(cfg, token, "/push/blobs", { method: "POST", body: gzipSync2(JSON.stringify({ nodes })), 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));
|
|
3606
3638
|
var init_remote = __esm(() => {
|
|
3607
3639
|
init_file_store();
|
|
3608
3640
|
init_store();
|