byollm 0.1.0-alpha.49 → 0.1.0-alpha.50

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  > [!WARNING]
2
- > **Alpha (`0.1.0-alpha.49`) — under active development. Don't use this yet.**
2
+ > **Alpha (`0.1.0-alpha.50`) — 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.49` is that release, whole.
88
+ > so `0.1.0-alpha.50` 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
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  main
4
- } from "./chunk-XIRTWNB2.js";
4
+ } from "./chunk-O3RIF23K.js";
5
5
 
6
6
  // src/bin.ts
7
7
  process.exitCode = await main(process.argv.slice(2));
@@ -96,7 +96,7 @@ function normalizeOrigin(input) {
96
96
  }
97
97
 
98
98
  // src/cli.ts
99
- import { mkdir as mkdir9, readFile as readFile9, rm as rm5, stat as stat2, writeFile as writeFile9 } from "fs/promises";
99
+ import { mkdir as mkdir9, readFile as readFile9, rm as rm5, stat as stat3, writeFile as writeFile9 } from "fs/promises";
100
100
  import { hostname, userInfo } from "os";
101
101
  import { dirname as dirname9 } from "path";
102
102
  import { createInterface as createInterface2 } from "readline/promises";
@@ -3549,9 +3549,22 @@ import { mkdir as mkdir8, rm as rm4, writeFile as writeFile8 } from "fs/promises
3549
3549
  import { dirname as dirname8 } from "path";
3550
3550
 
3551
3551
  // src/service.ts
3552
+ import { stat as stat2 } from "fs/promises";
3552
3553
  import { homedir as homedir2 } from "os";
3553
3554
  import { join as join4 } from "path";
3554
3555
  var SERVICE_LABEL = "cloud.byollm.daemon";
3556
+ function servicePath() {
3557
+ const current = process.env["PATH"] ?? "";
3558
+ const fallback = "/usr/bin:/bin:/usr/sbin:/sbin";
3559
+ const seen = /* @__PURE__ */ new Set();
3560
+ const out = [];
3561
+ for (const dir of [...current.split(":"), ...fallback.split(":")]) {
3562
+ if (dir === "" || seen.has(dir)) continue;
3563
+ seen.add(dir);
3564
+ out.push(dir);
3565
+ }
3566
+ return out.join(":");
3567
+ }
3555
3568
  function xml(value) {
3556
3569
  return value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&apos;");
3557
3570
  }
@@ -3578,6 +3591,10 @@ function servicePlan(target) {
3578
3591
  <string>${xml(scriptPath)}</string>
3579
3592
  <string>run</string>
3580
3593
  </array>
3594
+ <key>EnvironmentVariables</key>
3595
+ <dict>
3596
+ <key>PATH</key><string>${xml(servicePath())}</string>
3597
+ </dict>
3581
3598
  <key>RunAtLoad</key><true/>
3582
3599
  <key>KeepAlive</key><true/>
3583
3600
  <key>ThrottleInterval</key><integer>10</integer>
@@ -3618,6 +3635,10 @@ After=network-online.target
3618
3635
 
3619
3636
  [Service]
3620
3637
  Type=simple
3638
+ # The same gap launchd has, for the same reason: a user unit does not inherit
3639
+ # the login shell's PATH, so a CLI in ~/.local/bin is invisible to the daemon
3640
+ # while being perfectly visible to the person debugging it. See servicePath.
3641
+ Environment=PATH=${servicePath()}
3621
3642
  ExecStart=${execPath} ${scriptPath} run
3622
3643
  Restart=always
3623
3644
  RestartSec=10
@@ -3687,6 +3708,15 @@ WantedBy=default.target
3687
3708
  supervisor: "Task Scheduler"
3688
3709
  };
3689
3710
  }
3711
+ async function serviceIsInstalled(target) {
3712
+ const plan = servicePlan(target);
3713
+ try {
3714
+ await stat2(plan.unitPath);
3715
+ return true;
3716
+ } catch {
3717
+ return false;
3718
+ }
3719
+ }
3690
3720
  function refuseToSupervise(scriptPath) {
3691
3721
  const ephemeral = /[/\\]_npx[/\\]|[/\\]\.npm[/\\]_cacache[/\\]|[/\\]npm-cache[/\\]_npx[/\\]/;
3692
3722
  if (ephemeral.test(scriptPath)) {
@@ -3887,7 +3917,7 @@ async function runCli(argv, options = {}) {
3887
3917
  case "forget":
3888
3918
  return commandForget(paths, rest, io);
3889
3919
  case "services":
3890
- return commandServices(paths, io);
3920
+ return commandServices(paths, io, service);
3891
3921
  case "install":
3892
3922
  return commandInstall(paths, io, service);
3893
3923
  case "uninstall":
@@ -4337,6 +4367,43 @@ async function commandStatus(paths, io, service) {
4337
4367
  `);
4338
4368
  for (const site of Object.values(pairing.sites)) {
4339
4369
  io.out(` pinned: ${fingerprint3(site.identity)}
4370
+ `);
4371
+ }
4372
+ }
4373
+ const serving = /* @__PURE__ */ new Map();
4374
+ for (const route of loaded.routes) {
4375
+ serving.set(route.service, [
4376
+ ...serving.get(route.service) ?? [],
4377
+ route.kind
4378
+ ]);
4379
+ }
4380
+ io.out("\nservices\n");
4381
+ const declared = Object.entries(loaded.config.services);
4382
+ if (declared.length === 0) {
4383
+ io.out(" (none configured)\n");
4384
+ }
4385
+ for (const [name, service2] of declared) {
4386
+ const kinds = serving.get(name) ?? [];
4387
+ const route = loaded.routes.find((r) => r.service === name);
4388
+ const shown = route === void 0 ? service2.model : `${route.backendId}:${route.model}`;
4389
+ io.out(` ${name.padEnd(14)} ${shown}
4390
+ `);
4391
+ io.out(
4392
+ kinds.length === 0 ? (
4393
+ // Declared and serving nothing. Almost always because another
4394
+ // service is the default for its kinds, which is a decision rather
4395
+ // than a fault — so it reads as one.
4396
+ ` serves nothing right now \u2014 another service is the default for ${service2.kinds.join(", ")}
4397
+ `
4398
+ ) : ` ${kinds.join(", ")} \xB7 offered to ${service2.offer}
4399
+ `
4400
+ );
4401
+ }
4402
+ const defaults = Object.entries(loaded.config.defaults);
4403
+ if (defaults.length > 0) {
4404
+ io.out("\ndefaults\n");
4405
+ for (const [kind, name] of defaults) {
4406
+ io.out(` ${kind.padEnd(14)} ${name}
4340
4407
  `);
4341
4408
  }
4342
4409
  }
@@ -4473,7 +4540,7 @@ async function commandPause(paths, pause, io) {
4473
4540
  }
4474
4541
  async function isPaused(paths) {
4475
4542
  try {
4476
- await stat2(paths.pauseFlag);
4543
+ await stat3(paths.pauseFlag);
4477
4544
  return true;
4478
4545
  } catch {
4479
4546
  return false;
@@ -4777,7 +4844,7 @@ async function commandApprove(paths, args, io) {
4777
4844
  );
4778
4845
  return 0;
4779
4846
  }
4780
- async function commandServices(paths, io) {
4847
+ async function commandServices(paths, io, service) {
4781
4848
  const { loaded, ingress, allowlist, budgets, spend } = await context(paths);
4782
4849
  const runner = new Runner({
4783
4850
  client: new ProtocolClient({ origin: "https://unused.invalid" }),
@@ -4822,13 +4889,19 @@ async function commandServices(paths, io) {
4822
4889
  io.out(` i ${notice}
4823
4890
  `);
4824
4891
  }
4892
+ const installed = await serviceIsInstalled(serviceTarget(paths, service));
4825
4893
  io.out(
4826
4894
  `
4827
- ${String(advertised.length)} of ${String(loaded.routes.length)} services are healthy and will be advertised.
4895
+ ${String(advertised.length)} of ${String(loaded.routes.length)} services are healthy from this shell.
4828
4896
  ` + (loaded.withheld.length > 0 ? `${String(loaded.withheld.length)} kind(s) are withheld until you pick a default.
4829
4897
  ` : "") + `A route that is not healthy is never offered to an app \u2014 the daemon does
4830
4898
  not advertise what it cannot actually run.
4831
- `
4899
+ ` + (installed ? `
4900
+ This is your shell's view. The daemon runs under a service manager
4901
+ with its own environment, so what it can reach may differ. Compare
4902
+ with the device's page, and after installing a new CLI run
4903
+ \`byollm uninstall && byollm install\` so the service picks up your PATH.
4904
+ ` : "")
4832
4905
  );
4833
4906
  return advertised.length === 0 ? 1 : 0;
4834
4907
  }
@@ -4884,7 +4957,7 @@ async function main(argv) {
4884
4957
  }
4885
4958
 
4886
4959
  // src/index.ts
4887
- var DAEMON_VERSION = "0.1.0-alpha.49";
4960
+ var DAEMON_VERSION = "0.1.0-alpha.50";
4888
4961
  function daemonVersion() {
4889
4962
  return {
4890
4963
  daemon: DAEMON_VERSION,
@@ -4936,4 +5009,4 @@ export {
4936
5009
  runCli,
4937
5010
  main
4938
5011
  };
4939
- //# sourceMappingURL=chunk-XIRTWNB2.js.map
5012
+ //# sourceMappingURL=chunk-O3RIF23K.js.map