byollm 0.1.0-alpha.71 → 0.1.0-alpha.72
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/README.md +2 -2
- package/dist/bin.js +1 -1
- package/dist/{chunk-YJ3OSRLT.js → chunk-4T4QT3GX.js} +95 -18
- package/dist/chunk-4T4QT3GX.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-YJ3OSRLT.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
> [!WARNING]
|
|
2
|
-
> **Alpha (`0.1.0-alpha.
|
|
2
|
+
> **Alpha (`0.1.0-alpha.72`) — under active development. Don't use this yet.**
|
|
3
3
|
>
|
|
4
4
|
> Install it deliberately: `npx byollm@alpha`, or `npm install byollm@alpha`.
|
|
5
5
|
>
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
> packages published and `@byollm/server` did not: a Sigstore
|
|
86
86
|
> transparency-log 409 on its provenance attestation. The workflow's
|
|
87
87
|
> "already published" guard correctly refuses to resume a partial publish,
|
|
88
|
-
> so `0.1.0-alpha.
|
|
88
|
+
> so `0.1.0-alpha.72` is that release, whole.
|
|
89
89
|
>
|
|
90
90
|
> If you run the Supabase adapter, `alpha.21` needs
|
|
91
91
|
> `20260819010000_completed_by_lease_id.sql`: alpha.19 shipped §3.6's
|
package/dist/bin.js
CHANGED
|
@@ -2171,6 +2171,22 @@ function describeDrift(ms) {
|
|
|
2171
2171
|
return `${amount} ${ms > 0 ? "ahead of" : "behind"} the server`;
|
|
2172
2172
|
}
|
|
2173
2173
|
|
|
2174
|
+
// src/revoked.ts
|
|
2175
|
+
var REVOKED_SENTENCE = "this device was revoked \u2014 re-pair to return";
|
|
2176
|
+
function revokedRemedy(origin) {
|
|
2177
|
+
return ` re-pair: byollm connect${origin === void 0 ? "" : ` ${origin}`}
|
|
2178
|
+
`;
|
|
2179
|
+
}
|
|
2180
|
+
async function revokedMark(healthPath) {
|
|
2181
|
+
return (await readHealth(healthPath))?.revoked;
|
|
2182
|
+
}
|
|
2183
|
+
async function clearRevokedMark(healthPath) {
|
|
2184
|
+
const health = await readHealth(healthPath);
|
|
2185
|
+
if (health?.revoked === void 0) return;
|
|
2186
|
+
const { revoked: _gone, ...rest } = health;
|
|
2187
|
+
await writeHealth(healthPath, rest);
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2174
2190
|
// src/test-your-device.ts
|
|
2175
2191
|
var TEST_YOUR_DEVICE = "TEST YOUR DEVICE: Visit https://test.byollm.cloud and press the Connect BYOLLM button.";
|
|
2176
2192
|
|
|
@@ -3918,6 +3934,8 @@ var Runner = class {
|
|
|
3918
3934
|
this.#revoked = true;
|
|
3919
3935
|
this.#stopped = true;
|
|
3920
3936
|
this.cancelAll();
|
|
3937
|
+
void this.#recordHealth().catch(() => {
|
|
3938
|
+
});
|
|
3921
3939
|
this.#options.onEvent?.({ type: "revoked" });
|
|
3922
3940
|
return true;
|
|
3923
3941
|
}
|
|
@@ -3944,7 +3962,13 @@ var Runner = class {
|
|
|
3944
3962
|
at: this.#now(),
|
|
3945
3963
|
consecutiveFailures: this.#consecutiveFailures,
|
|
3946
3964
|
...this.#lastUpstreamError === void 0 ? {} : { lastError: this.#lastUpstreamError },
|
|
3947
|
-
origin: this.#options.client.origin
|
|
3965
|
+
origin: this.#options.client.origin,
|
|
3966
|
+
...this.#revoked ? {
|
|
3967
|
+
revoked: {
|
|
3968
|
+
at: this.#now(),
|
|
3969
|
+
origin: this.#options.client.origin
|
|
3970
|
+
}
|
|
3971
|
+
} : {}
|
|
3948
3972
|
});
|
|
3949
3973
|
}
|
|
3950
3974
|
async #tick() {
|
|
@@ -4775,7 +4799,7 @@ function refusalOf(command, result) {
|
|
|
4775
4799
|
const denied = /access is denied|requires elevation|0x80070005/i.test(said);
|
|
4776
4800
|
return denied ? `${command.join(" ")} \u2014 this machine will not let you register a scheduled task (no administrator rights, or IT policy).` : `${command.join(" ")} \u2014 exit ${String(result.code)}` + (said === "" ? "" : `: ${said}`);
|
|
4777
4801
|
}
|
|
4778
|
-
async function installService(target, run2, wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms))) {
|
|
4802
|
+
async function installService(target, run2, wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms)), revoked = false) {
|
|
4779
4803
|
const plan = servicePlan(target);
|
|
4780
4804
|
const refusal = refuseToSupervise(target.scriptPath);
|
|
4781
4805
|
if (refusal !== null) {
|
|
@@ -4840,7 +4864,25 @@ async function installService(target, run2, wait = (ms) => new Promise((resolve)
|
|
|
4840
4864
|
return {
|
|
4841
4865
|
ok: false,
|
|
4842
4866
|
plan,
|
|
4843
|
-
lines: [
|
|
4867
|
+
lines: revoked ? [
|
|
4868
|
+
/**
|
|
4869
|
+
* The cause, not the symptom — ruled 2026-09-03 (2).
|
|
4870
|
+
*
|
|
4871
|
+
* Todd revoked a machine and `install` told him "retry: byollm
|
|
4872
|
+
* install". Honest about the failure and wrong about the fix: the
|
|
4873
|
+
* daemon starts, is refused, and stops, and it will do that every
|
|
4874
|
+
* time. A remedy must match the cause.
|
|
4875
|
+
*/
|
|
4876
|
+
`${plan.supervisor} accepted the service, and the daemon is not running.`,
|
|
4877
|
+
"",
|
|
4878
|
+
` ${REVOKED_SENTENCE}.`,
|
|
4879
|
+
"",
|
|
4880
|
+
` re-pair: byollm connect`,
|
|
4881
|
+
` then: byollm install`,
|
|
4882
|
+
"",
|
|
4883
|
+
`Installing again will not change this \u2014 the refusal is the hub's,`,
|
|
4884
|
+
`and it stands until this device is approved again.`
|
|
4885
|
+
] : [
|
|
4844
4886
|
`${plan.supervisor} accepted the service, and the daemon is not running.`,
|
|
4845
4887
|
"",
|
|
4846
4888
|
` ${started.state === "absent" ? "the supervisor no longer knows it" : started.detail}`,
|
|
@@ -5155,7 +5197,8 @@ async function commandInstall(paths, io, service) {
|
|
|
5155
5197
|
const result = await installService(
|
|
5156
5198
|
serviceTarget(paths, service),
|
|
5157
5199
|
service.run,
|
|
5158
|
-
|
|
5200
|
+
service.wait ?? ((ms) => new Promise((r) => setTimeout(r, ms))),
|
|
5201
|
+
await revokedMark(paths.health) !== void 0
|
|
5159
5202
|
);
|
|
5160
5203
|
for (const line of result.lines) (result.ok ? io.out : io.err)(`${line}
|
|
5161
5204
|
`);
|
|
@@ -5173,14 +5216,16 @@ async function commandUninstall(paths, io, service) {
|
|
|
5173
5216
|
`);
|
|
5174
5217
|
return 0;
|
|
5175
5218
|
}
|
|
5176
|
-
async function supervisionLine(
|
|
5177
|
-
const plan = servicePlan(serviceTarget(paths, service));
|
|
5178
|
-
const state = await serviceState(plan, service.run);
|
|
5219
|
+
async function supervisionLine(plan, state, revoked) {
|
|
5179
5220
|
switch (state.state) {
|
|
5180
5221
|
case "running":
|
|
5181
5222
|
return `service: running under ${plan.supervisor}
|
|
5182
5223
|
`;
|
|
5183
5224
|
case "installed": {
|
|
5225
|
+
if (revoked) {
|
|
5226
|
+
return `service: installed, not serving \u2014 ${REVOKED_SENTENCE}.
|
|
5227
|
+
`;
|
|
5228
|
+
}
|
|
5184
5229
|
const program = await installedProgram(plan);
|
|
5185
5230
|
const gone = program === null || program.exists ? "" : `
|
|
5186
5231
|
the program it runs is missing: ${program.path}
|
|
@@ -5442,6 +5487,7 @@ Connecting to ${origin}
|
|
|
5442
5487
|
await pairings.load();
|
|
5443
5488
|
reportSkipped(pairings, io);
|
|
5444
5489
|
await pairings.put(result.pairing);
|
|
5490
|
+
await clearRevokedMark(paths.health);
|
|
5445
5491
|
io.out(` paired as ${result.pairing.ownerLabel ?? result.pairing.owner}
|
|
5446
5492
|
`);
|
|
5447
5493
|
const pinned = Object.values(result.pairing.sites);
|
|
@@ -5478,8 +5524,7 @@ async function commandRun(paths, args, io, signal) {
|
|
|
5478
5524
|
const target = args[0];
|
|
5479
5525
|
const origins = target === void 0 ? pairings.list().map((pairing) => pairing.origin) : [normalizeOrigin(target)];
|
|
5480
5526
|
if (origins.length === 0) {
|
|
5481
|
-
|
|
5482
|
-
return 2;
|
|
5527
|
+
return nothingToServe(paths, io, signal);
|
|
5483
5528
|
}
|
|
5484
5529
|
return runLoop(paths, origins, io, signal);
|
|
5485
5530
|
}
|
|
@@ -5536,7 +5581,32 @@ ${wrap(
|
|
|
5536
5581
|
);
|
|
5537
5582
|
await rm5(paths.allowlist, { force: true });
|
|
5538
5583
|
}
|
|
5539
|
-
async function
|
|
5584
|
+
async function nothingToServe(paths, io, signal, supervised = !process.stdout.isTTY) {
|
|
5585
|
+
const mark = await revokedMark(paths.health);
|
|
5586
|
+
if (mark === void 0) {
|
|
5587
|
+
io.err(
|
|
5588
|
+
"No app is paired, so there is nothing to serve \u2014 this device will appear on rosters and answer nothing.\n byollm connect <url> pair this device\n byollm status what this device believes right now\n"
|
|
5589
|
+
);
|
|
5590
|
+
return 2;
|
|
5591
|
+
}
|
|
5592
|
+
io.err(
|
|
5593
|
+
`${REVOKED_SENTENCE}.
|
|
5594
|
+
${mark.origin} no longer accepts this device's credential, so there is nothing to serve.
|
|
5595
|
+
` + revokedRemedy(mark.origin)
|
|
5596
|
+
);
|
|
5597
|
+
if (!supervised) return 2;
|
|
5598
|
+
await new Promise((resolve) => {
|
|
5599
|
+
if (signal === void 0 || signal.aborted) {
|
|
5600
|
+
resolve();
|
|
5601
|
+
return;
|
|
5602
|
+
}
|
|
5603
|
+
signal.addEventListener("abort", () => {
|
|
5604
|
+
resolve();
|
|
5605
|
+
});
|
|
5606
|
+
});
|
|
5607
|
+
return 0;
|
|
5608
|
+
}
|
|
5609
|
+
async function runLoop(paths, origins, io, signal, supervised = !process.stdout.isTTY) {
|
|
5540
5610
|
const { loaded, ingress, budgets, spend, spentGrants } = await context(paths);
|
|
5541
5611
|
const identity = new DeviceIdentity(paths.keys);
|
|
5542
5612
|
const pairings = new Pairings(paths.pairings);
|
|
@@ -5624,10 +5694,7 @@ async function runLoop(paths, origins, io, signal) {
|
|
|
5624
5694
|
runners.push(runner);
|
|
5625
5695
|
}
|
|
5626
5696
|
if (runners.length === 0) {
|
|
5627
|
-
io
|
|
5628
|
-
"No app is paired, so there is nothing to serve \u2014 this device will appear on rosters and answer nothing.\n byollm connect <url> pair this device\n byollm status what this device believes right now\n"
|
|
5629
|
-
);
|
|
5630
|
-
return 2;
|
|
5697
|
+
return nothingToServe(paths, io, signal, supervised);
|
|
5631
5698
|
}
|
|
5632
5699
|
if (signal === void 0) {
|
|
5633
5700
|
const stop = () => {
|
|
@@ -5756,10 +5823,20 @@ async function commandStatus(paths, io, service) {
|
|
|
5756
5823
|
);
|
|
5757
5824
|
const health = await readHealth(paths.health);
|
|
5758
5825
|
const failing = health !== void 0 && health.consecutiveFailures >= FAILURES_BEFORE_ALARM;
|
|
5826
|
+
const plan = servicePlan(serviceTarget(paths, service));
|
|
5827
|
+
const supervision = await serviceState(plan, service.run);
|
|
5828
|
+
const revoked = await revokedMark(paths.health);
|
|
5759
5829
|
io.out(
|
|
5760
|
-
`state: ${paused ? "PAUSED" : failing ? "NOT REPORTING" : "running"}
|
|
5830
|
+
`state: ${revoked !== void 0 ? "REVOKED" : paused ? "PAUSED" : supervision.state === "installed" ? "NOT RUNNING" : failing ? "NOT REPORTING" : "running"}
|
|
5761
5831
|
`
|
|
5762
5832
|
);
|
|
5833
|
+
if (revoked !== void 0) {
|
|
5834
|
+
io.out(
|
|
5835
|
+
` ${REVOKED_SENTENCE}.
|
|
5836
|
+
${revoked.origin} no longer accepts this device's credential.
|
|
5837
|
+
` + revokedRemedy(revoked.origin)
|
|
5838
|
+
);
|
|
5839
|
+
}
|
|
5763
5840
|
if (failing) {
|
|
5764
5841
|
io.out(
|
|
5765
5842
|
` the hub has rejected this device's last ${String(health.consecutiveFailures)} messages \u2014 it is running and invisible.
|
|
@@ -5769,7 +5846,7 @@ async function commandStatus(paths, io, service) {
|
|
|
5769
5846
|
`
|
|
5770
5847
|
);
|
|
5771
5848
|
}
|
|
5772
|
-
io.out(await supervisionLine(
|
|
5849
|
+
io.out(await supervisionLine(plan, supervision, revoked !== void 0));
|
|
5773
5850
|
io.out("\n");
|
|
5774
5851
|
io.out("paired apps\n");
|
|
5775
5852
|
const list = pairings.list();
|
|
@@ -6376,7 +6453,7 @@ async function exists(path) {
|
|
|
6376
6453
|
}
|
|
6377
6454
|
|
|
6378
6455
|
// src/index.ts
|
|
6379
|
-
var DAEMON_VERSION = "0.1.0-alpha.
|
|
6456
|
+
var DAEMON_VERSION = "0.1.0-alpha.72";
|
|
6380
6457
|
function daemonVersion() {
|
|
6381
6458
|
return {
|
|
6382
6459
|
daemon: DAEMON_VERSION,
|
|
@@ -6428,4 +6505,4 @@ export {
|
|
|
6428
6505
|
runCli,
|
|
6429
6506
|
main
|
|
6430
6507
|
};
|
|
6431
|
-
//# sourceMappingURL=chunk-
|
|
6508
|
+
//# sourceMappingURL=chunk-4T4QT3GX.js.map
|