@inline-chat/hermes-agent-adapter 0.0.12 → 0.0.13

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
@@ -147,7 +147,7 @@ uv run ./hermes plugins list --plain --no-bundled
147
147
  Expected local output includes:
148
148
 
149
149
  ```text
150
- enabled user 0.0.12 inline-platform
150
+ enabled user 0.0.13 inline-platform
151
151
  ```
152
152
 
153
153
  ## Update Or Reinstall
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inline-chat/hermes-agent-adapter",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "Hermes Agent platform adapter for Inline, with a native Python plugin and bundled Inline realtime sidecar.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -7,6 +7,7 @@ the plugin has already been discovered by Hermes.
7
7
  from __future__ import annotations
8
8
 
9
9
  import argparse
10
+ import hashlib
10
11
  import json
11
12
  import os
12
13
  import re
@@ -26,7 +27,7 @@ _CLI_INSTALL_URL = "https://inline.chat/cli/install.sh"
26
27
  _MAX_TOKEN_BYTES = 16 * 1024
27
28
  _MAX_PROBE_RESPONSE_BYTES = 64 * 1024
28
29
  _MACHINE_SETUP_PROTOCOL_VERSION = 1
29
- _PROBE_USER_AGENT = "inline-hermes-agent-adapter/0.0.12"
30
+ _PROBE_USER_AGENT = "inline-hermes-agent-adapter/0.0.13"
30
31
  _ENV_REFERENCE_RE = re.compile(r"^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$")
31
32
 
32
33
 
@@ -463,6 +464,7 @@ def _status(args) -> int:
463
464
  "sidecar": sidecar,
464
465
  "node": node,
465
466
  "probeRequested": probe_requested,
467
+ "gateway": _gateway_status(),
466
468
  **({"probe": probe} if probe is not None else {}),
467
469
  }
468
470
  if getattr(args, "json", False):
@@ -480,6 +482,51 @@ def _status(args) -> int:
480
482
  return 0 if runtime_usable and (not probe_requested or ready) else 1
481
483
 
482
484
 
485
+ def _gateway_status() -> dict:
486
+ """Project local runtime facts without changing the credential-status contract."""
487
+ unavailable = {"supported": False, "ready": False, "reason": "runtime_status_unavailable"}
488
+ try:
489
+ from gateway.status import read_runtime_status, get_runtime_status_running_pid
490
+ from hermes_constants import get_hermes_home
491
+
492
+ runtime = read_runtime_status()
493
+ # Also validate this helper contract for an absent runtime: older hosts
494
+ # lack expected_home and must not claim support until after installation.
495
+ pid = get_runtime_status_running_pid(runtime if isinstance(runtime, dict) else {}, expected_home=get_hermes_home())
496
+ if not isinstance(runtime, dict):
497
+ return {"supported": True, "ready": False, "reason": "missing_status"}
498
+ # Return only an opaque generation, never process IDs or raw state.
499
+ start_time = runtime.get("start_time")
500
+ valid_identity = type(pid) is int and pid > 0 and type(start_time) is int and start_time >= 0
501
+ if pid and not valid_identity:
502
+ return {"supported": False, "ready": False, "reason": "runtime_identity_unavailable"}
503
+ generation = hashlib.sha256(f"inline-gateway:{pid}:{start_time}".encode()).hexdigest() if valid_identity else None
504
+ state = runtime.get("gateway_state")
505
+ platforms = runtime.get("platforms")
506
+ inline = platforms.get("inline") if isinstance(platforms, dict) else None
507
+ platform_state = inline.get("state") if isinstance(inline, dict) else None
508
+ state = state if state in ("starting", "running", "draining", "stopping", "stopped", "startup_failed") else "unknown"
509
+ platform_state = platform_state if platform_state in ("connected", "connecting", "retrying", "fatal", "disconnected") else "unknown"
510
+ if pid and isinstance(inline, dict) and ("writer_pid" not in inline or "writer_start_time" not in inline):
511
+ return {"supported": False, "ready": False, "reason": "runtime_writer_identity_unavailable"}
512
+ # Runtime status can retain platform entries from the prior process.
513
+ # Only the current process's own connected projection is readiness proof.
514
+ writer_matches = isinstance(inline, dict) and inline.get("writer_pid") == pid and inline.get("writer_start_time") == start_time
515
+ ready = generation is not None and writer_matches and state == "running" and platform_state == "connected"
516
+ return {
517
+ "supported": True,
518
+ "ready": ready,
519
+ **({"generation": generation} if generation is not None else {}),
520
+ "gatewayState": state,
521
+ "platformState": platform_state,
522
+ "reason": "ready" if ready else "stale_pid" if not pid else "gateway_not_running" if state != "running" else "platform_status_stale" if not writer_matches else "platform_not_connected",
523
+ }
524
+ except Exception:
525
+ # Older Hermes versions may not expose the helpers. Never return raw
526
+ # runtime files or exceptions: they can contain provider/credential data.
527
+ return unavailable
528
+
529
+
483
530
  def _plugin_version() -> str:
484
531
  """Read the separately installed plugin version without package-manager state."""
485
532
  try:
@@ -1,7 +1,7 @@
1
1
  name: inline-platform
2
2
  label: Inline
3
3
  kind: platform
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  description: >
6
6
  Inline platform adapter for Hermes Agent. The adapter runs as a native
7
7
  Hermes Python platform plugin and supervises a local Node sidecar that uses