@sjawhar/pi-envoy 13.10.0 → 13.10.1

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
@@ -210,8 +210,10 @@ tools and `/whoami`, takes no inbound messages, connects to no NATS server, and
210
210
  the claim before any listener call, so a Legion process fails its boot rather than hold a role
211
211
  whose tasks reach nobody. When a
212
212
  section is off for a reason worth saying, the session says so once at its start:
213
- `envoy: no envoy.json at <path>: Dispatch and Envoy are off`, the section's error, what a
214
- checkout's file holds that is not read, or that inbound messages are off and why. Invalid configuration, an
213
+ `envoy: no envoy.json at <path>: Dispatch and Envoy are off`, the lost `DISPATCH_URL` when
214
+ `DISPATCH_TOKEN_FILE` is set and no server is named (`DISPATCH_TOKEN_FILE is set and DISPATCH_URL
215
+ is not, so Dispatch is off: …`, which every `dispatch` command also prints), the section's error,
216
+ what a checkout's file holds that is not read, or that inbound messages are off and why. Invalid configuration, an
215
217
  invalid URL, or an empty token makes every `dispatch` command exit 2 naming the source of the error.
216
218
 
217
219
  `~/.config/opencode/envoy.json` and a checkout's `.opencode/envoy.json` are not read. While the old
package/dist/dispatch.js CHANGED
@@ -21380,6 +21380,17 @@ function writtenToken(config, checkout) {
21380
21380
  checkout: false
21381
21381
  };
21382
21382
  }
21383
+ function lostDispatchUrlNotice(env, config) {
21384
+ if (nonEmpty(env.DISPATCH_TOKEN_FILE) === undefined)
21385
+ return;
21386
+ const link = config.missing?.link ?? null;
21387
+ const old = config.missing?.oldUserFileNotice;
21388
+ return [
21389
+ "DISPATCH_TOKEN_FILE is set and DISPATCH_URL is not, so Dispatch is off: this shell lost the DISPATCH_URL it started with. Export DISPATCH_URL again, set to the Dispatch server that token is for",
21390
+ ...link === null ? [] : [`${config.path} is a link to ${link}, which does not exist`],
21391
+ ...old === undefined ? [] : [old]
21392
+ ].join("; ");
21393
+ }
21383
21394
  function dispatchSettings(env, config, options = {}) {
21384
21395
  const target = dispatchTarget(env, config);
21385
21396
  if (!target.enabled)
@@ -21421,6 +21432,9 @@ function dispatchTarget(env, config) {
21421
21432
  const checkoutServer = checkout?.dispatch.serverUrl;
21422
21433
  const addressed = explicitUrl !== undefined || checkoutServer !== undefined || own.serverUrl !== undefined || own.enabled === true;
21423
21434
  if (!addressed) {
21435
+ const lost = lostDispatchUrlNotice(env, config);
21436
+ if (lost !== undefined)
21437
+ return offWithNotice(lost);
21424
21438
  return offWithNotice(config.missing === null ? `${config.path} names no Dispatch server, and DISPATCH_URL is not set: Dispatch is off` : missingConfigNotice(config.path, config.missing, "Dispatch is off"));
21425
21439
  }
21426
21440
  if (explicitUrl !== undefined && httpUrl2(explicitUrl) === undefined) {
package/dist/envoy.js CHANGED
@@ -33997,6 +33997,17 @@ function writtenToken(config, checkout) {
33997
33997
  checkout: false
33998
33998
  };
33999
33999
  }
34000
+ function lostDispatchUrlNotice(env, config) {
34001
+ if (nonEmpty(env.DISPATCH_TOKEN_FILE) === undefined)
34002
+ return;
34003
+ const link = config.missing?.link ?? null;
34004
+ const old = config.missing?.oldUserFileNotice;
34005
+ return [
34006
+ "DISPATCH_TOKEN_FILE is set and DISPATCH_URL is not, so Dispatch is off: this shell lost the DISPATCH_URL it started with. Export DISPATCH_URL again, set to the Dispatch server that token is for",
34007
+ ...link === null ? [] : [`${config.path} is a link to ${link}, which does not exist`],
34008
+ ...old === undefined ? [] : [old]
34009
+ ].join("; ");
34010
+ }
34000
34011
  function dispatchSettings(env, config, options = {}) {
34001
34012
  const target = dispatchTarget(env, config);
34002
34013
  if (!target.enabled)
@@ -34038,6 +34049,9 @@ function dispatchTarget(env, config) {
34038
34049
  const checkoutServer = checkout?.dispatch.serverUrl;
34039
34050
  const addressed = explicitUrl !== undefined || checkoutServer !== undefined || own.serverUrl !== undefined || own.enabled === true;
34040
34051
  if (!addressed) {
34052
+ const lost = lostDispatchUrlNotice(env, config);
34053
+ if (lost !== undefined)
34054
+ return offWithNotice(lost);
34041
34055
  return offWithNotice(config.missing === null ? `${config.path} names no Dispatch server, and DISPATCH_URL is not set: Dispatch is off` : missingConfigNotice(config.path, config.missing, "Dispatch is off"));
34042
34056
  }
34043
34057
  if (explicitUrl !== undefined && httpUrl2(explicitUrl) === undefined) {
@@ -36466,25 +36480,29 @@ function sessionConfigFile(harness, env) {
36466
36480
  return { path: null, error: messageFor(error) };
36467
36481
  }
36468
36482
  }
36469
- function startNotice(config, dispatch, envoy, nats) {
36483
+ function startNotice(config, dispatch, envoy, nats, lost) {
36470
36484
  if (config.kind === "failed")
36471
36485
  return `${config.error}: Dispatch and Envoy are off`;
36472
36486
  const { missing, checkout } = config;
36487
+ const lostNotice = !dispatch.enabled && dispatch.notice === lost ? lost ?? null : null;
36473
36488
  const dispatchQuiet = !dispatch.enabled && dispatch.error === null;
36474
36489
  const envoyQuiet = !envoy.enabled && envoy.error === null;
36475
36490
  const parts = [];
36476
- if (missing !== null && dispatchQuiet && envoyQuiet) {
36491
+ if (missing !== null && dispatchQuiet && envoyQuiet && lostNotice === null) {
36477
36492
  parts.push(missingConfigNotice(config.path, missing, "Dispatch and Envoy are off"));
36478
36493
  } else {
36479
36494
  if (!dispatch.enabled && dispatch.error !== null)
36480
36495
  parts.push(`Dispatch is off: ${dispatch.error}`);
36496
+ else if (lostNotice !== null)
36497
+ parts.push(lostNotice);
36481
36498
  else if (dispatchQuiet && missing !== null) {
36482
36499
  parts.push(missingConfigNotice(config.path, missing, "Dispatch is off"));
36483
36500
  }
36484
36501
  if (!envoy.enabled && envoy.error !== null)
36485
36502
  parts.push(`Envoy is off: ${envoy.error}`);
36486
36503
  else if (envoyQuiet && missing !== null) {
36487
- parts.push(missingConfigNotice(config.path, missing, "Envoy is off"));
36504
+ const said = lostNotice === null ? missing : { link: null };
36505
+ parts.push(missingConfigNotice(config.path, said, "Envoy is off"));
36488
36506
  }
36489
36507
  }
36490
36508
  if (checkout?.kind === "valid" && checkout.envoyError !== null)
@@ -36515,7 +36533,7 @@ function sessionSettings(file, env, options) {
36515
36533
  return {
36516
36534
  dispatch,
36517
36535
  envoy,
36518
- notice: startNotice(config, dispatch, envoy, options.nats !== false)
36536
+ notice: startNotice(config, dispatch, envoy, options.nats !== false, config.kind === "read" ? lostDispatchUrlNotice(env, config) : undefined)
36519
36537
  };
36520
36538
  }
36521
36539
  function sessionDispatchSettings(file, env, options) {
@@ -37251,7 +37269,7 @@ var import_nats2 = __toESM(require_mod4(), 1);
37251
37269
 
37252
37270
  // package.json
37253
37271
  var name = "@sjawhar/pi-envoy";
37254
- var version2 = "13.10.0";
37272
+ var version2 = "13.10.1";
37255
37273
  var package_default = {
37256
37274
  name,
37257
37275
  version: version2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/pi-envoy",
3
- "version": "13.10.0",
3
+ "version": "13.10.1",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "omp": {