@hydra-acp/cli 0.1.14 → 0.1.15

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/dist/cli.js +71 -4
  2. package/package.json +3 -1
package/dist/cli.js CHANGED
@@ -6118,9 +6118,9 @@ var init_screen = __esm({
6118
6118
  wrapOne(line, width) {
6119
6119
  const id = this.lineIds.get(line);
6120
6120
  if (id !== void 0) {
6121
- const cached = this.wrapCache.get(id);
6122
- if (cached) {
6123
- return cached;
6121
+ const cached2 = this.wrapCache.get(id);
6122
+ if (cached2) {
6123
+ return cached2;
6124
6124
  }
6125
6125
  }
6126
6126
  const prefix = line.prefix ?? "";
@@ -13714,7 +13714,55 @@ function injectHydraMeta(msg, additions) {
13714
13714
  };
13715
13715
  }
13716
13716
 
13717
+ // src/core/update-check.ts
13718
+ init_hydra_version();
13719
+ var PKG_NAME = "@hydra-acp/cli";
13720
+ var cached;
13721
+ function disabled() {
13722
+ if (process.env.NO_UPDATE_NOTIFIER === "1") {
13723
+ return true;
13724
+ }
13725
+ if (process.argv.includes("--no-update-notifier")) {
13726
+ return true;
13727
+ }
13728
+ return false;
13729
+ }
13730
+ async function getPendingUpdate() {
13731
+ if (cached !== void 0) {
13732
+ return cached;
13733
+ }
13734
+ if (disabled()) {
13735
+ cached = null;
13736
+ return cached;
13737
+ }
13738
+ try {
13739
+ const mod = await import("update-notifier");
13740
+ const updateNotifier = mod.default ?? mod;
13741
+ const notifier = updateNotifier({
13742
+ pkg: { name: PKG_NAME, version: HYDRA_VERSION },
13743
+ updateCheckInterval: 1e3 * 60 * 60 * 24
13744
+ });
13745
+ const u = notifier.update;
13746
+ if (u && typeof u.latest === "string" && typeof u.current === "string" && u.latest !== u.current) {
13747
+ cached = {
13748
+ current: u.current,
13749
+ latest: u.latest,
13750
+ type: typeof u.type === "string" ? u.type : "unknown"
13751
+ };
13752
+ } else {
13753
+ cached = null;
13754
+ }
13755
+ } catch {
13756
+ cached = null;
13757
+ }
13758
+ return cached;
13759
+ }
13760
+ function formatUpdateNoticeLine(info) {
13761
+ return `hydra-acp ${info.latest} available (current ${info.current}) \xB7 run: npm update -g ${PKG_NAME}`;
13762
+ }
13763
+
13717
13764
  // src/cli.ts
13765
+ var suppressUpdateNotice = false;
13718
13766
  async function main() {
13719
13767
  const argv = process.argv.slice(2);
13720
13768
  const launchIdx = argv.indexOf("launch");
@@ -13746,6 +13794,7 @@ async function main() {
13746
13794
  const sessionId2 = typeof flags2.resume === "string" ? flags2.resume : resolveOption(flags2, "session-id");
13747
13795
  const name2 = resolveOption(flags2, "name");
13748
13796
  const model2 = resolveOption(flags2, "model");
13797
+ suppressUpdateNotice = true;
13749
13798
  await runShim({ sessionId: sessionId2, agentId, agentArgs, name: name2, model: model2 });
13750
13799
  return;
13751
13800
  }
@@ -13770,6 +13819,7 @@ async function main() {
13770
13819
  const model = resolveOption(flags, "model");
13771
13820
  if (!subcommand) {
13772
13821
  if (process.stdout.isTTY) {
13822
+ suppressUpdateNotice = true;
13773
13823
  await dispatchTui(flags, {
13774
13824
  sessionId,
13775
13825
  agentId: agentIdFromFlag,
@@ -13778,11 +13828,13 @@ async function main() {
13778
13828
  });
13779
13829
  return;
13780
13830
  }
13831
+ suppressUpdateNotice = true;
13781
13832
  await runShim({ sessionId, name, agentId: agentIdFromFlag, model });
13782
13833
  return;
13783
13834
  }
13784
13835
  switch (subcommand) {
13785
13836
  case "shim":
13837
+ suppressUpdateNotice = true;
13786
13838
  await runShim({ sessionId, name, agentId: agentIdFromFlag, model });
13787
13839
  return;
13788
13840
  case "init":
@@ -13905,6 +13957,7 @@ async function main() {
13905
13957
  return;
13906
13958
  }
13907
13959
  case "tui":
13960
+ suppressUpdateNotice = true;
13908
13961
  await dispatchTui(flags, {
13909
13962
  sessionId,
13910
13963
  agentId: agentIdFromFlag,
@@ -14007,8 +14060,22 @@ function printHelp() {
14007
14060
  ].join("\n")
14008
14061
  );
14009
14062
  }
14010
- main().catch((err) => {
14063
+ async function maybePrintUpdateNotice() {
14064
+ if (suppressUpdateNotice) {
14065
+ return;
14066
+ }
14067
+ try {
14068
+ const info = await getPendingUpdate();
14069
+ if (info) {
14070
+ process.stderr.write(`\u2728 ${formatUpdateNoticeLine(info)}
14071
+ `);
14072
+ }
14073
+ } catch {
14074
+ }
14075
+ }
14076
+ main().then(maybePrintUpdateNotice).catch(async (err) => {
14011
14077
  process.stderr.write(`hydra-acp: ${err.message}
14012
14078
  `);
14079
+ await maybePrintUpdateNotice();
14013
14080
  process.exit(1);
14014
14081
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hydra-acp/cli",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "Multi-client ACP session daemon: spawn agents, attach over WSS, multiplex sessions across editors.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -61,6 +61,7 @@
61
61
  "string-width": "^8.2.1",
62
62
  "strip-ansi": "^7.2.0",
63
63
  "terminal-kit": "^3.1.2",
64
+ "update-notifier": "^7.3.1",
64
65
  "wrap-ansi": "^10.0.0",
65
66
  "ws": "^8.18.0",
66
67
  "zod": "^3.23.0"
@@ -68,6 +69,7 @@
68
69
  "devDependencies": {
69
70
  "@types/node": "^22.0.0",
70
71
  "@types/terminal-kit": "^2.5.7",
72
+ "@types/update-notifier": "^6.0.8",
71
73
  "@types/ws": "^8.5.0",
72
74
  "tsup": "^8.0.0",
73
75
  "tsx": "^4.0.0",