agent-relay-channels-host 0.105.2 → 0.106.0
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/package.json +1 -1
- package/src/index.ts +26 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-relay-channels-host",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.106.0",
|
|
4
4
|
"description": "Channels host connector for Agent Relay — bundles N lightweight egress adapters (ntfy, webhook, …) behind one agent-relay.connector.v1 channel connector. Core ships zero per-service transport.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/index.ts
CHANGED
|
@@ -14,7 +14,16 @@ import { RelayClient } from "./relay";
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
const SELF = join(import.meta.dir, "index.ts");
|
|
17
|
-
|
|
17
|
+
// Track the published package version so the connector manifest the relay registers
|
|
18
|
+
// always reports the deployed version (lockstep-bumped in channels-host/package.json),
|
|
19
|
+
// not a constant that silently drifts. Falls back gracefully if the file is unreadable.
|
|
20
|
+
const VERSION: string = ((): string => {
|
|
21
|
+
try {
|
|
22
|
+
return JSON.parse(readFileSync(join(import.meta.dir, "..", "package.json"), "utf8")).version ?? "0.0.0";
|
|
23
|
+
} catch {
|
|
24
|
+
return "0.0.0";
|
|
25
|
+
}
|
|
26
|
+
})();
|
|
18
27
|
|
|
19
28
|
function pidFile(cfg: HostConfig): string {
|
|
20
29
|
return join(cfg.runtimeDir, "channels-host.pid");
|
|
@@ -139,6 +148,18 @@ async function actionDoctor(cfg: HostConfig): Promise<void> {
|
|
|
139
148
|
out({ checks, summary: `relay ${relayUp ? "reachable" : "unreachable"}, ${adapters.length} adapter(s)` });
|
|
140
149
|
}
|
|
141
150
|
|
|
151
|
+
/**
|
|
152
|
+
* Emit the aggregated connector manifest as JSON ({ manifest }) without touching the
|
|
153
|
+
* relay. The server's boot auto-register (src/connectors.ts) spawns this from the
|
|
154
|
+
* DEPLOYED binary, so `binary`/commands resolve to the installed runtime path — never
|
|
155
|
+
* a repo-working-tree path. Keeps manifest authoring as the single source of truth in
|
|
156
|
+
* this package while leaving core free of any per-adapter code.
|
|
157
|
+
*/
|
|
158
|
+
function actionManifest(cfg: HostConfig): void {
|
|
159
|
+
const manifest = buildManifest({ connectorId: cfg.connectorId, binary: SELF, version: VERSION, adapters });
|
|
160
|
+
out({ manifest });
|
|
161
|
+
}
|
|
162
|
+
|
|
142
163
|
async function actionRegister(cfg: HostConfig): Promise<void> {
|
|
143
164
|
const manifest = buildManifest({ connectorId: cfg.connectorId, binary: SELF, version: VERSION, adapters });
|
|
144
165
|
const headers: Record<string, string> = { "content-type": "application/json" };
|
|
@@ -178,8 +199,11 @@ async function main(): Promise<void> {
|
|
|
178
199
|
case "register":
|
|
179
200
|
await actionRegister(cfg);
|
|
180
201
|
return;
|
|
202
|
+
case "manifest":
|
|
203
|
+
actionManifest(cfg);
|
|
204
|
+
return;
|
|
181
205
|
default:
|
|
182
|
-
process.stderr.write("usage: agent-relay-channels-host <start|stop|restart|status|doctor|register|daemon>\n");
|
|
206
|
+
process.stderr.write("usage: agent-relay-channels-host <start|stop|restart|status|doctor|register|manifest|daemon>\n");
|
|
183
207
|
process.exit(2);
|
|
184
208
|
}
|
|
185
209
|
}
|