@cordfuse/crosstalk 6.0.0-alpha.8 → 6.0.0-alpha.9

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/send.ts +21 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cordfuse/crosstalk",
3
- "version": "6.0.0-alpha.8",
3
+ "version": "6.0.0-alpha.9",
4
4
  "description": "Crosstalk runtime — async messaging between agents over git, across machines.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/send.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  // Operators (no env) always send new tasks.
9
9
 
10
10
  import { resolve, join } from 'path';
11
- import { mkdirSync, writeFileSync } from 'fs';
11
+ import { mkdirSync, writeFileSync, existsSync } from 'fs';
12
12
  import { now, messageFilename } from './filenames.js';
13
13
  import { serializeFrontmatter } from './frontmatter.js';
14
14
  import { gitCommitAndPush, discoverChannels } from './transport.js';
@@ -56,6 +56,26 @@ async function main(): Promise<void> {
56
56
  }
57
57
  }
58
58
 
59
+ // Warn when --to names an actor@host whose host file isn't in the transport
60
+ // yet. The dispatcher's high-water-mark seeds past any commit before the
61
+ // host file landed, so messages to an un-provisioned host are silently
62
+ // skipped on first boot. Surfacing this here turns the silent drop into an
63
+ // operator-visible error before the message is even written.
64
+ const recipients = to.split(',').map((s) => s.trim()).filter(Boolean);
65
+ for (const recipient of recipients) {
66
+ const at = recipient.indexOf('@');
67
+ if (at === -1) continue;
68
+ const host = recipient.slice(at + 1);
69
+ const hostPath = join(transportRoot, 'hosts', `${host}.md`);
70
+ if (!existsSync(hostPath)) {
71
+ console.error(
72
+ `crosstalk send: WARNING — no host file at hosts/${host}.md. ` +
73
+ `Messages addressed to '${recipient}' will be skipped by that host ` +
74
+ `until hosts/${host}.md is committed to the transport.`,
75
+ );
76
+ }
77
+ }
78
+
59
79
  const reTargets = (isNew ? '' : process.env['CROSSTALK_DISPATCH_RE'] ?? '')
60
80
  .split(',')
61
81
  .map((s) => s.trim())