midsummer-sol 0.3.2 → 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.
Files changed (3) hide show
  1. package/package.json +1 -1
  2. package/sol-mcp.js +3 -45
  3. package/sol.js +4 -46
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "midsummer-sol",
3
- "version": "0.3.2",
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
- remotePushFinalize: () => remotePushFinalize,
4162
- remotePushChunked: () => remotePushChunked,
4163
- remotePushBatch: () => remotePushBatch,
4161
+ remotePushPack: () => remotePushPack,
4164
4162
  remotePush: () => remotePush,
4165
4163
  remotePromote: () => remotePromote,
4166
4164
  remoteHead: () => remoteHead,
@@ -4199,45 +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
- const CONC = 12;
4228
- for (let i = 0;i < nodeBatches.length; i++)
4229
- batchIds.push(`${stamp}-${i}`);
4230
- try {
4231
- for (let w = 0;w < nodeBatches.length; w += CONC) {
4232
- await Promise.all(nodeBatches.slice(w, w + CONC).map((nodes, j) => remotePushBatch(cfg, token, batchIds[w + j], nodes, w + j === 0 ? body.ops : [], w + j)));
4233
- }
4234
- } catch (e) {
4235
- if (e instanceof Error && /-> 404/.test(e.message))
4236
- return remotePush(cfg, token, body);
4237
- throw e;
4238
- }
4239
- return remotePushFinalize(cfg, token, batchIds, body.branch, body.head, body.expectedHead);
4240
- }
4241
4200
  function loadRemote(solDir2) {
4242
4201
  const p = join6(solDir2, "remote.json");
4243
4202
  return existsSync6(p) ? JSON.parse(readFileSync6(p, "utf8")) : undefined;
@@ -4258,10 +4217,9 @@ async function writeBundle(solDir2, bundle, from = 0) {
4258
4217
  writeFileSync6(join6(solDir2, "HEAD"), JSON.stringify({ head: bundle.head, seq: bundle.seq, logTip: bundle.tip }));
4259
4218
  return fresh.length;
4260
4219
  }
4261
- 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 }) }), remotePushBatch = (cfg, token, batchId, nodes, ops, seq) => call(cfg, token, "/push/batch", { method: "POST", body: gzipSync3(JSON.stringify({ batchId, nodes, ops, seq })), headers: { "content-encoding": "gzip" } }), remotePushFinalize = (cfg, token, batchIds, branch, head, expectedHead) => call(cfg, token, "/push/finalize", { method: "POST", body: JSON.stringify({ batchIds, branch, head, expectedHead }) }), DEFAULT_BATCH_BYTES, sizeOf = (v) => JSON.stringify(v).length, 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));
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));
4262
4221
  var init_remote = __esm(() => {
4263
4222
  init_file_store2();
4264
- DEFAULT_BATCH_BYTES = 5 * 1024 * 1024;
4265
4223
  });
4266
4224
 
4267
4225
  // src/bin/test-gate.ts
@@ -12550,7 +12508,7 @@ WARNING: "${path}" was committed as PLAINTEXT before this seal — the pre-seal
12550
12508
  const forkBase = localRefs?.branches[branch]?.remote;
12551
12509
  const baseOp = forkBase ? ops.find((o) => o.rootAfter === forkBase) : undefined;
12552
12510
  const fromSeq = baseOp ? baseOp.seq : rh.seq;
12553
- const res = await remotePushChunked(cfg, token, {
12511
+ const res = await remotePushPack(cfg, token, {
12554
12512
  nodes: allLocalNodes(),
12555
12513
  ops: ops.filter((o) => o.seq > fromSeq),
12556
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
- remotePushFinalize: () => remotePushFinalize,
3395
- remotePushChunked: () => remotePushChunked,
3396
- remotePushBatch: () => remotePushBatch,
3394
+ remotePushPack: () => remotePushPack,
3397
3395
  remotePush: () => remotePush,
3398
3396
  remotePromote: () => remotePromote,
3399
3397
  remoteHead: () => remoteHead,
@@ -3432,45 +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
- const CONC = 12;
3461
- for (let i = 0;i < nodeBatches.length; i++)
3462
- batchIds.push(`${stamp}-${i}`);
3463
- try {
3464
- for (let w = 0;w < nodeBatches.length; w += CONC) {
3465
- await Promise.all(nodeBatches.slice(w, w + CONC).map((nodes, j) => remotePushBatch(cfg, token, batchIds[w + j], nodes, w + j === 0 ? body.ops : [], w + j)));
3466
- }
3467
- } catch (e) {
3468
- if (e instanceof Error && /-> 404/.test(e.message))
3469
- return remotePush(cfg, token, body);
3470
- throw e;
3471
- }
3472
- return remotePushFinalize(cfg, token, batchIds, body.branch, body.head, body.expectedHead);
3473
- }
3474
3433
  function loadRemote(solDir2) {
3475
3434
  const p = join5(solDir2, "remote.json");
3476
3435
  return existsSync5(p) ? JSON.parse(readFileSync5(p, "utf8")) : undefined;
@@ -3491,10 +3450,9 @@ async function writeBundle(solDir2, bundle, from = 0) {
3491
3450
  writeFileSync5(join5(solDir2, "HEAD"), JSON.stringify({ head: bundle.head, seq: bundle.seq, logTip: bundle.tip }));
3492
3451
  return fresh.length;
3493
3452
  }
3494
- 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 }) }), remotePushBatch = (cfg, token, batchId, nodes, ops, seq) => call(cfg, token, "/push/batch", { method: "POST", body: gzipSync2(JSON.stringify({ batchId, nodes, ops, seq })), headers: { "content-encoding": "gzip" } }), remotePushFinalize = (cfg, token, batchIds, branch, head, expectedHead) => call(cfg, token, "/push/finalize", { method: "POST", body: JSON.stringify({ batchIds, branch, head, expectedHead }) }), DEFAULT_BATCH_BYTES, sizeOf = (v) => JSON.stringify(v).length, 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));
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));
3495
3454
  var init_remote = __esm(() => {
3496
3455
  init_file_store();
3497
- DEFAULT_BATCH_BYTES = 5 * 1024 * 1024;
3498
3456
  });
3499
3457
 
3500
3458
  // src/bin/test-gate.ts
@@ -12318,7 +12276,7 @@ WARNING: "${path}" was committed as PLAINTEXT before this seal — the pre-seal
12318
12276
  const forkBase = localRefs?.branches[branch]?.remote;
12319
12277
  const baseOp = forkBase ? ops.find((o) => o.rootAfter === forkBase) : undefined;
12320
12278
  const fromSeq = baseOp ? baseOp.seq : rh.seq;
12321
- const res = await remotePushChunked(cfg, token, {
12279
+ const res = await remotePushPack(cfg, token, {
12322
12280
  nodes: allLocalNodes(),
12323
12281
  ops: ops.filter((o) => o.seq > fromSeq),
12324
12282
  branch,
@@ -16602,7 +16560,7 @@ WARNING: "${path}" was committed as PLAINTEXT before this seal — the pre-seal
16602
16560
  const forkBase = localRefs?.branches[branch]?.remote;
16603
16561
  const baseOp = forkBase ? ops.find((o) => o.rootAfter === forkBase) : undefined;
16604
16562
  const fromSeq = baseOp ? baseOp.seq : rh.seq;
16605
- const res = await remotePushChunked(cfg, token, {
16563
+ const res = await remotePushPack(cfg, token, {
16606
16564
  nodes: allLocalNodes(),
16607
16565
  ops: ops.filter((o) => o.seq > fromSeq),
16608
16566
  branch,