@saleso.innovations/bridge 0.1.13 → 0.1.14

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
@@ -34,7 +34,7 @@ This installs the latest package, refreshes the CLI symlink, and restarts `cleos
34
34
  To pin a specific release (e.g. after a Cleos update):
35
35
 
36
36
  ```bash
37
- curl -fsSL https://amicable-elephant-407.convex.site/update-bridge.sh | bash -s -- 0.1.13
37
+ curl -fsSL https://amicable-elephant-407.convex.site/update-bridge.sh | bash -s -- 0.1.14
38
38
  ```
39
39
 
40
40
  ## Manual usage
@@ -1,4 +1,4 @@
1
- export declare const HERMES_COMMAND_NAMES: readonly ["runtime.health", "runtime.detailedHealth", "runtime.capabilities", "models.list", "model.set", "responses.create", "runs.create", "runs.status", "runs.stop", "jobs.list", "jobs.get", "jobs.create", "jobs.update", "jobs.pause", "jobs.resume", "jobs.runNow", "jobs.delete", "profiles.list", "profiles.create", "gateway.start", "gateway.stop", "gateway.restart"];
1
+ export declare const HERMES_COMMAND_NAMES: readonly ["runtime.health", "runtime.detailedHealth", "runtime.capabilities", "models.list", "model.set", "responses.create", "runs.create", "runs.status", "runs.stop", "jobs.list", "jobs.get", "jobs.create", "jobs.update", "jobs.pause", "jobs.resume", "jobs.runNow", "jobs.delete", "profiles.list", "profiles.create", "gateway.start", "gateway.stop", "gateway.restart", "hermes.update"];
2
2
  export type HermesCommandName = (typeof HERMES_COMMAND_NAMES)[number];
3
3
  export declare function isHermesCommandName(value: string): value is HermesCommandName;
4
4
  export type HermesCommandErrorCode = "command_unsupported" | "hermes_unreachable" | "hermes_request_failed" | "invalid_command_args" | "unsupported_by_http";
@@ -1 +1 @@
1
- {"version":3,"file":"hermesCommands.d.ts","sourceRoot":"","sources":["../src/hermesCommands.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB,oXAuBvB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,C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AAC;gBAE1B,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,MAAM;CAI1D;AAuFD,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,iBAAiB,EAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GACjE,OAAO,CAAC,OAAO,CAAC,CA6JlB;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG;IAAE,IAAI,EAAE,sBAAsB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAetG"}
@@ -1,5 +1,6 @@
1
1
  import { resolveHermesApiConfig } from "./hermesForwarder.js";
2
2
  import { restartHermesGateway, startHermesGateway, stopHermesGateway } from "./gatewayControl.js";
3
+ import { runHermesUpdate } from "./hermesUpdate.js";
3
4
  export const HERMES_COMMAND_NAMES = [
4
5
  "runtime.health",
5
6
  "runtime.detailedHealth",
@@ -23,6 +24,7 @@ export const HERMES_COMMAND_NAMES = [
23
24
  "gateway.start",
24
25
  "gateway.stop",
25
26
  "gateway.restart",
27
+ "hermes.update",
26
28
  ];
27
29
  export function isHermesCommandName(value) {
28
30
  return HERMES_COMMAND_NAMES.includes(value);
@@ -244,6 +246,10 @@ export async function executeHermesCommand(command, args, options = {}) {
244
246
  return await stopHermesGateway();
245
247
  case "gateway.restart":
246
248
  return await restartHermesGateway();
249
+ case "hermes.update": {
250
+ const restartGateway = args.restartGateway === true || args.restart_gateway === true;
251
+ return await runHermesUpdate({ restartGateway });
252
+ }
247
253
  default: {
248
254
  const _exhaustive = command;
249
255
  throw new HermesCommandError("command_unsupported", `Unsupported command: ${String(_exhaustive)}`);
@@ -0,0 +1,8 @@
1
+ export type RunHermesUpdateOptions = {
2
+ restartGateway?: boolean;
3
+ };
4
+ export declare function runHermesUpdate(options?: RunHermesUpdateOptions): Promise<{
5
+ ok: true;
6
+ output: string;
7
+ }>;
8
+ //# sourceMappingURL=hermesUpdate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hermesUpdate.d.ts","sourceRoot":"","sources":["../src/hermesUpdate.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,sBAAsB,GAAG;IACnC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,wBAAsB,eAAe,CACnC,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAqBvC"}
@@ -0,0 +1,26 @@
1
+ import { execFile } from "node:child_process";
2
+ import { promisify } from "node:util";
3
+ const execFileAsync = promisify(execFile);
4
+ const UPDATE_TIMEOUT_MS = 600_000;
5
+ const MAX_OUTPUT_BYTES = 10 * 1024 * 1024;
6
+ export async function runHermesUpdate(options = {}) {
7
+ const args = ["update"];
8
+ if (options.restartGateway) {
9
+ args.push("--restart-gateway");
10
+ }
11
+ try {
12
+ const { stdout, stderr } = await execFileAsync("hermes", args, {
13
+ timeout: UPDATE_TIMEOUT_MS,
14
+ maxBuffer: MAX_OUTPUT_BYTES,
15
+ env: process.env,
16
+ });
17
+ const output = [stdout, stderr].filter((chunk) => chunk.trim().length > 0).join("\n").trim();
18
+ return { ok: true, output: output || "Hermes updated successfully." };
19
+ }
20
+ catch (error) {
21
+ const message = error instanceof Error && error.message.trim().length > 0
22
+ ? error.message
23
+ : "Hermes update failed.";
24
+ throw new Error(message);
25
+ }
26
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saleso.innovations/bridge",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Connect your Hermes agent to the Cleos iOS app via pairing code.",
5
5
  "type": "module",
6
6
  "license": "MIT",