githolon 0.100.1 → 0.100.2
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.mjs +30 -0
- package/package.json +3 -3
package/dist/cli.mjs
CHANGED
|
@@ -5166,6 +5166,7 @@ var init_lifecycle = __esm({
|
|
|
5166
5166
|
var cloud_exports = {};
|
|
5167
5167
|
__export(cloud_exports, {
|
|
5168
5168
|
activePrincipal: () => activePrincipal,
|
|
5169
|
+
advertisedMainHead: () => advertisedMainHead,
|
|
5169
5170
|
authUse: () => authUse,
|
|
5170
5171
|
clearActAs: () => clearActAs,
|
|
5171
5172
|
cloudBase: () => cloudBase,
|
|
@@ -5187,6 +5188,7 @@ __export(cloud_exports, {
|
|
|
5187
5188
|
setDeviceKey: () => setDeviceKey,
|
|
5188
5189
|
setPrincipal: () => setPrincipal,
|
|
5189
5190
|
setSecret: () => setSecret,
|
|
5191
|
+
waitForDurableMainAdvance: () => waitForDurableMainAdvance,
|
|
5190
5192
|
whoami: () => whoami,
|
|
5191
5193
|
wsCreate: () => wsCreate,
|
|
5192
5194
|
wsReclaim: () => wsReclaim,
|
|
@@ -5540,6 +5542,24 @@ async function wsReclaim(ws, opts) {
|
|
|
5540
5542
|
out4(" the custodian drops the ledger bytes on seeing this fact folded; the reclaimed FACT is append-only");
|
|
5541
5543
|
return 0;
|
|
5542
5544
|
}
|
|
5545
|
+
function advertisedMainHead(text) {
|
|
5546
|
+
return /([0-9a-f]{40}) refs\/heads\/main\b/.exec(text)?.[1];
|
|
5547
|
+
}
|
|
5548
|
+
async function durableMainHead(cloud, ws, fetchImpl = fetch) {
|
|
5549
|
+
return fetchImpl(`${cloud}/v2/workspaces/${encodeURIComponent(ws)}/git/info/refs?service=git-upload-pack`).then(async (r) => r.ok ? advertisedMainHead(await r.text()) : void 0).catch(() => void 0);
|
|
5550
|
+
}
|
|
5551
|
+
async function waitForDurableMainAdvance(cloud, ws, previousHead, opts = {}) {
|
|
5552
|
+
const timeoutMs = Math.max(100, Number(opts.timeoutMs) || 3e4);
|
|
5553
|
+
const pollMs = Math.max(1, Number(opts.pollMs) || 250);
|
|
5554
|
+
const fetchImpl = opts.fetchImpl ?? fetch;
|
|
5555
|
+
const deadline = Date.now() + timeoutMs;
|
|
5556
|
+
while (Date.now() < deadline) {
|
|
5557
|
+
const head = await durableMainHead(cloud, ws, fetchImpl);
|
|
5558
|
+
if (head !== void 0 && head !== previousHead) return head;
|
|
5559
|
+
await new Promise((resolve6) => setTimeout(resolve6, pollMs));
|
|
5560
|
+
}
|
|
5561
|
+
return void 0;
|
|
5562
|
+
}
|
|
5543
5563
|
async function deploy2(ws, opts) {
|
|
5544
5564
|
const cloud = cloudBase(opts.cloud);
|
|
5545
5565
|
let file;
|
|
@@ -5553,6 +5573,7 @@ async function deploy2(ws, opts) {
|
|
|
5553
5573
|
const beforeLaw = await fetch(`${cloud}/v2/workspaces/${ws}/domains`).then((br) => br.json()).then((bd) => bd.ok === true ? bd : {}).catch(() => ({}));
|
|
5554
5574
|
const before = beforeLaw.domains ?? [];
|
|
5555
5575
|
const currentLaw2 = beforeLaw.currentLaw ?? {};
|
|
5576
|
+
const beforeDurableHead = await durableMainHead(cloud, ws);
|
|
5556
5577
|
try {
|
|
5557
5578
|
const compat = JSON.parse(readFileSync5(file, "utf8")).nomosCompat;
|
|
5558
5579
|
const requires = compat?.requiresKernel ?? [];
|
|
@@ -5677,6 +5698,15 @@ async function deploy2(ws, opts) {
|
|
|
5677
5698
|
}
|
|
5678
5699
|
};
|
|
5679
5700
|
if (deployedHash !== void 0 && isCurrent) {
|
|
5701
|
+
const wasCurrentBefore = Object.values(currentLaw2).includes(deployedHash);
|
|
5702
|
+
if (!wasCurrentBefore && beforeDurableHead !== void 0) {
|
|
5703
|
+
const durableHead = await waitForDurableMainAdvance(cloud, ws, beforeDurableHead);
|
|
5704
|
+
if (durableHead === void 0) {
|
|
5705
|
+
err4(`deploy '${ws}' was admitted, but canonical Git main did not advance within 30000ms`);
|
|
5706
|
+
err4(` Nomos will not start application code against a law that fresh peers cannot clone yet; retry the deploy.`);
|
|
5707
|
+
return 2;
|
|
5708
|
+
}
|
|
5709
|
+
}
|
|
5680
5710
|
out4(`\u2713 deployed ${fileName} \u2192 ${ws}${phaseSuffix}`);
|
|
5681
5711
|
out4(` law ${describeLawMove(before, deployedHash)}`);
|
|
5682
5712
|
emitPlan();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "githolon",
|
|
3
|
-
"version": "0.100.
|
|
3
|
+
"version": "0.100.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "githolon — the Nomos developer CLI: Rails-style generators for @githolon/dsl domains + the package compiler. Kernel-independent.",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@bjorn3/browser_wasi_shim": "0.4.2",
|
|
32
|
-
"@githolon/client": "^0.100.
|
|
33
|
-
"@githolon/dsl": "^0.100.
|
|
32
|
+
"@githolon/client": "^0.100.2",
|
|
33
|
+
"@githolon/dsl": "^0.100.2",
|
|
34
34
|
"isomorphic-git": "^1.38.4"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|