@saleso.innovations/bridge 0.1.12 → 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.12
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,6 @@
1
1
  export declare const BRIDGE_PACKAGE = "@saleso.innovations/bridge";
2
+ /** Pin scoped package resolution to the public npm registry in the bridge install dir. */
3
+ export declare function ensureBridgeNpmRegistry(bridgeDir: string): void;
2
4
  export declare function defaultBridgeInstallDir(): string;
3
5
  export declare function bridgeCliPath(bridgeDir: string): string;
4
6
  /** Directory used by `npm install --prefix` (usually ~/.cleos/bridge). */
@@ -1 +1 @@
1
- {"version":3,"file":"bridgePaths.d.ts","sourceRoot":"","sources":["../src/bridgePaths.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,+BAA+B,CAAC;AAE3D,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEvD;AAwBD,0EAA0E;AAC1E,wBAAgB,uBAAuB,IAAI,MAAM,CAMhD;AAED,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ3E"}
1
+ {"version":3,"file":"bridgePaths.d.ts","sourceRoot":"","sources":["../src/bridgePaths.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,cAAc,+BAA+B,CAAC;AAE3D,0FAA0F;AAC1F,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAM/D;AAED,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEvD;AAwBD,0EAA0E;AAC1E,wBAAgB,uBAAuB,IAAI,MAAM,CAMhD;AAED,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ3E"}
@@ -1,9 +1,14 @@
1
1
  import { execFileSync } from "node:child_process";
2
- import { readFileSync } from "node:fs";
2
+ import { readFileSync, writeFileSync } from "node:fs";
3
3
  import { homedir } from "node:os";
4
4
  import { dirname, join, sep } from "node:path";
5
5
  import { fileURLToPath } from "node:url";
6
+ import { NPM_PUBLIC_REGISTRY } from "./constants.js";
6
7
  export const BRIDGE_PACKAGE = "@saleso.innovations/bridge";
8
+ /** Pin scoped package resolution to the public npm registry in the bridge install dir. */
9
+ export function ensureBridgeNpmRegistry(bridgeDir) {
10
+ writeFileSync(join(bridgeDir, ".npmrc"), `@saleso.innovations:registry=${NPM_PUBLIC_REGISTRY}\n`, "utf8");
11
+ }
7
12
  export function defaultBridgeInstallDir() {
8
13
  return join(homedir(), ".cleos", "bridge");
9
14
  }
@@ -9,6 +9,8 @@ export declare const DEFAULT_BRIDGE_CAPABILITIES: string[];
9
9
  export declare const DEFAULT_BRIDGE_INSTALL_URL = "https://amicable-elephant-407.convex.site/install-bridge.sh";
10
10
  /** VPS one-line updater (served from public Convex HTTP). */
11
11
  export declare const DEFAULT_BRIDGE_UPDATE_URL = "https://amicable-elephant-407.convex.site/update-bridge.sh";
12
+ /** Public npm registry — always use this for bridge installs (avoids VPS mirror / scope misconfig). */
13
+ export declare const NPM_PUBLIC_REGISTRY = "https://registry.npmjs.org/";
12
14
  export declare function bridgeInstallCommand(code: string): string;
13
15
  export declare function bridgeUpdateCommand(): string;
14
16
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,eAAO,MAAM,6BAA6B,8CAA8C,CAAC;AAEzF,6FAA6F;AAC7F,eAAO,MAAM,sBAAsB,8CAA8C,CAAC;AAElF,4DAA4D;AAC5D,eAAO,MAAM,0BAA0B,uBAAuB,CAAC;AAE/D,eAAO,MAAM,2BAA2B,UAAuC,CAAC;AAEhF,+DAA+D;AAC/D,eAAO,MAAM,0BAA0B,gEACwB,CAAC;AAEhE,6DAA6D;AAC7D,eAAO,MAAM,yBAAyB,+DACwB,CAAC;AAE/D,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,eAAO,MAAM,6BAA6B,8CAA8C,CAAC;AAEzF,6FAA6F;AAC7F,eAAO,MAAM,sBAAsB,8CAA8C,CAAC;AAElF,4DAA4D;AAC5D,eAAO,MAAM,0BAA0B,uBAAuB,CAAC;AAE/D,eAAO,MAAM,2BAA2B,UAAuC,CAAC;AAEhF,+DAA+D;AAC/D,eAAO,MAAM,0BAA0B,gEACwB,CAAC;AAEhE,6DAA6D;AAC7D,eAAO,MAAM,yBAAyB,+DACwB,CAAC;AAE/D,uGAAuG;AACvG,eAAO,MAAM,mBAAmB,gCAAgC,CAAC;AAEjE,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C"}
package/dist/constants.js CHANGED
@@ -9,6 +9,8 @@ export const DEFAULT_BRIDGE_CAPABILITIES = ["chat", HERMES_COMMANDS_CAPABILITY];
9
9
  export const DEFAULT_BRIDGE_INSTALL_URL = "https://amicable-elephant-407.convex.site/install-bridge.sh";
10
10
  /** VPS one-line updater (served from public Convex HTTP). */
11
11
  export const DEFAULT_BRIDGE_UPDATE_URL = "https://amicable-elephant-407.convex.site/update-bridge.sh";
12
+ /** Public npm registry — always use this for bridge installs (avoids VPS mirror / scope misconfig). */
13
+ export const NPM_PUBLIC_REGISTRY = "https://registry.npmjs.org/";
12
14
  export function bridgeInstallCommand(code) {
13
15
  return `curl -fsSL ${DEFAULT_BRIDGE_INSTALL_URL} | bash -s -- ${code}`;
14
16
  }
@@ -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,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,iBAAiB,CAE7E;AAED,MAAM,MAAM,sBAAsB,GAC9B,qBAAqB,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,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
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../src/update.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,sBAAsB,GAAG;IACnC,gDAAgD;IAChD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,wBAAgB,eAAe,CAAC,OAAO,GAAE,sBAA2B,GAAG,IAAI,CAsC1E"}
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../src/update.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,sBAAsB,GAAG;IACnC,gDAAgD;IAChD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,wBAAgB,eAAe,CAAC,OAAO,GAAE,sBAA2B,GAAG,IAAI,CAyC1E"}
package/dist/update.js CHANGED
@@ -2,18 +2,22 @@ import { execFileSync, spawnSync } from "node:child_process";
2
2
  import { chmodSync, mkdirSync, writeFileSync } from "node:fs";
3
3
  import { homedir } from "node:os";
4
4
  import { join } from "node:path";
5
- import { BRIDGE_PACKAGE, bridgeCliPath, readInstalledBridgeVersion, resolveBridgeInstallDir, } from "./bridgePaths.js";
5
+ import { BRIDGE_PACKAGE, bridgeCliPath, ensureBridgeNpmRegistry, readInstalledBridgeVersion, resolveBridgeInstallDir, } from "./bridgePaths.js";
6
+ import { NPM_PUBLIC_REGISTRY } from "./constants.js";
6
7
  export function runBridgeUpdate(options = {}) {
7
8
  const tag = options.tag ?? "latest";
8
9
  const bridgeDir = resolveBridgeInstallDir();
9
10
  const beforeVersion = readInstalledBridgeVersion(bridgeDir);
10
11
  mkdirSync(bridgeDir, { recursive: true });
11
- console.log(`Updating ${BRIDGE_PACKAGE}@${tag} in ${bridgeDir}...`);
12
+ ensureBridgeNpmRegistry(bridgeDir);
13
+ console.log(`Updating ${BRIDGE_PACKAGE}@${tag} in ${bridgeDir} (registry: ${NPM_PUBLIC_REGISTRY})...`);
12
14
  const npm = spawnSync("npm", [
13
15
  "install",
14
16
  "--prefix",
15
17
  bridgeDir,
16
18
  `${BRIDGE_PACKAGE}@${tag}`,
19
+ "--registry",
20
+ NPM_PUBLIC_REGISTRY,
17
21
  "--no-fund",
18
22
  "--no-audit",
19
23
  "--omit=dev",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saleso.innovations/bridge",
3
- "version": "0.1.12",
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",