@inline-chat/hermes-agent-adapter 0.0.5-alpha.0 → 0.0.5-alpha.1
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 +5 -5
- package/package.json +1 -1
- package/plugin/inline/cli.py +102 -10
- package/plugin/inline/plugin.yaml +1 -1
package/README.md
CHANGED
|
@@ -58,11 +58,11 @@ hermes plugins enable inline-platform
|
|
|
58
58
|
hermes gateway setup
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
Select Inline in the messaging-platform picker. The
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
Select Inline in the messaging-platform picker. The default path is: go to
|
|
62
|
+
**Inline → Settings → Bots → Create a new bot**, then paste its token. See the
|
|
63
|
+
[Inline bot creation guide](https://inline.chat/docs/creating-a-bot). The
|
|
64
|
+
optional CLI path can install/sign in to the Inline CLI and create the bot from
|
|
65
|
+
the terminal. Both paths securely save the token and configure access.
|
|
66
66
|
|
|
67
67
|
## Coding Agent Setup Prompt
|
|
68
68
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inline-chat/hermes-agent-adapter",
|
|
3
|
-
"version": "0.0.5-alpha.
|
|
3
|
+
"version": "0.0.5-alpha.1",
|
|
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",
|
package/plugin/inline/cli.py
CHANGED
|
@@ -12,12 +12,14 @@ import os
|
|
|
12
12
|
import re
|
|
13
13
|
import shutil
|
|
14
14
|
import subprocess
|
|
15
|
+
import sys
|
|
15
16
|
|
|
16
17
|
from pathlib import Path
|
|
17
18
|
|
|
18
19
|
_SIDECAR_ENTRY = Path(__file__).parent / "sidecar" / "index.mjs"
|
|
19
20
|
_MIN_NODE_MAJOR = 20
|
|
20
21
|
_BOT_USERNAME_RE = re.compile(r"^[A-Za-z0-9_]+bot$", re.IGNORECASE)
|
|
22
|
+
_CLI_INSTALL_URL = "https://inline.chat/cli/install.sh"
|
|
21
23
|
|
|
22
24
|
|
|
23
25
|
def gateway_setup() -> None:
|
|
@@ -42,17 +44,18 @@ def gateway_setup() -> None:
|
|
|
42
44
|
|
|
43
45
|
hermes_setup.print_info("How would you like to connect Hermes to Inline?")
|
|
44
46
|
print()
|
|
45
|
-
hermes_setup.print_info(" [1] Create a
|
|
46
|
-
hermes_setup.print_info("
|
|
47
|
+
hermes_setup.print_info(" [1] Create a bot in Inline and paste its token")
|
|
48
|
+
hermes_setup.print_info(" Go to Settings → Bots → Create a new bot.")
|
|
49
|
+
hermes_setup.print_info(" https://inline.chat/docs/creating-a-bot")
|
|
47
50
|
print()
|
|
48
|
-
hermes_setup.print_info(" [2]
|
|
49
|
-
hermes_setup.print_info("
|
|
51
|
+
hermes_setup.print_info(" [2] Create a bot with the Inline CLI")
|
|
52
|
+
hermes_setup.print_info(" Install or sign in to the CLI, then create the bot here.")
|
|
50
53
|
print()
|
|
51
54
|
|
|
52
55
|
choice = hermes_setup.prompt("Choice [1/2]", default="1").strip()
|
|
53
56
|
owner_user_id: str | None = None
|
|
54
57
|
token: str | None = None
|
|
55
|
-
if choice == "
|
|
58
|
+
if choice == "2":
|
|
56
59
|
token, owner_user_id = _create_bot_with_inline_cli(hermes_setup)
|
|
57
60
|
if not token:
|
|
58
61
|
print()
|
|
@@ -78,11 +81,13 @@ def gateway_setup() -> None:
|
|
|
78
81
|
|
|
79
82
|
|
|
80
83
|
def _create_bot_with_inline_cli(hermes_setup) -> tuple[str | None, str | None]:
|
|
81
|
-
inline_bin =
|
|
84
|
+
inline_bin = _find_inline_cli()
|
|
82
85
|
if not inline_bin:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
+
inline_bin = _install_inline_cli(hermes_setup)
|
|
87
|
+
if not inline_bin:
|
|
88
|
+
hermes_setup.print_warning("Automatic bot creation is unavailable because the Inline CLI could not be installed.")
|
|
89
|
+
hermes_setup.print_info("Install it from https://inline.chat/docs/cli, or use an existing bot token.")
|
|
90
|
+
return None, None
|
|
86
91
|
|
|
87
92
|
owner_user_id = _inline_cli_user_id(inline_bin)
|
|
88
93
|
if not owner_user_id:
|
|
@@ -126,9 +131,96 @@ def _create_bot_with_inline_cli(hermes_setup) -> tuple[str | None, str | None]:
|
|
|
126
131
|
return None, owner_user_id
|
|
127
132
|
|
|
128
133
|
|
|
134
|
+
def _install_inline_cli(hermes_setup) -> str | None:
|
|
135
|
+
print()
|
|
136
|
+
hermes_setup.print_info("The Inline CLI is needed to create your bot automatically.")
|
|
137
|
+
if not hermes_setup.prompt_yes_no("Install the Inline CLI now?", True):
|
|
138
|
+
hermes_setup.print_info("Inline CLI installation skipped.")
|
|
139
|
+
return None
|
|
140
|
+
|
|
141
|
+
brew_bin = shutil.which("brew") if sys.platform == "darwin" else None
|
|
142
|
+
if brew_bin:
|
|
143
|
+
hermes_setup.print_info("Installing the Inline CLI with Homebrew...")
|
|
144
|
+
result = subprocess.run(
|
|
145
|
+
[brew_bin, "install", "--cask", "inline"],
|
|
146
|
+
check=False,
|
|
147
|
+
)
|
|
148
|
+
else:
|
|
149
|
+
curl_bin = shutil.which("curl")
|
|
150
|
+
shell_bin = shutil.which("sh") or "/bin/sh"
|
|
151
|
+
if not curl_bin:
|
|
152
|
+
hermes_setup.print_warning("Automatic installation requires curl.")
|
|
153
|
+
return None
|
|
154
|
+
hermes_setup.print_info("Downloading the official Inline CLI installer...")
|
|
155
|
+
try:
|
|
156
|
+
download = subprocess.run(
|
|
157
|
+
[curl_bin, "-fsSL", _CLI_INSTALL_URL],
|
|
158
|
+
stdout=subprocess.PIPE,
|
|
159
|
+
stderr=subprocess.PIPE,
|
|
160
|
+
timeout=60,
|
|
161
|
+
check=False,
|
|
162
|
+
)
|
|
163
|
+
except (OSError, subprocess.TimeoutExpired) as exc:
|
|
164
|
+
hermes_setup.print_warning(f"Could not download the Inline CLI installer: {exc}")
|
|
165
|
+
return None
|
|
166
|
+
if download.returncode != 0 or not download.stdout:
|
|
167
|
+
hermes_setup.print_warning("Could not download the Inline CLI installer.")
|
|
168
|
+
return None
|
|
169
|
+
try:
|
|
170
|
+
result = subprocess.run(
|
|
171
|
+
[shell_bin, "-s"],
|
|
172
|
+
input=download.stdout,
|
|
173
|
+
timeout=180,
|
|
174
|
+
check=False,
|
|
175
|
+
)
|
|
176
|
+
except (OSError, subprocess.TimeoutExpired) as exc:
|
|
177
|
+
hermes_setup.print_warning(f"Inline CLI installation failed: {exc}")
|
|
178
|
+
return None
|
|
179
|
+
|
|
180
|
+
if result.returncode != 0:
|
|
181
|
+
hermes_setup.print_warning("The Inline CLI installer exited unsuccessfully.")
|
|
182
|
+
return None
|
|
183
|
+
|
|
184
|
+
inline_bin = _find_inline_cli()
|
|
185
|
+
if not inline_bin:
|
|
186
|
+
hermes_setup.print_warning("The Inline CLI was installed but could not be found on PATH.")
|
|
187
|
+
return None
|
|
188
|
+
try:
|
|
189
|
+
verified = subprocess.run(
|
|
190
|
+
[inline_bin, "--version"],
|
|
191
|
+
stdout=subprocess.PIPE,
|
|
192
|
+
stderr=subprocess.PIPE,
|
|
193
|
+
timeout=10,
|
|
194
|
+
check=False,
|
|
195
|
+
)
|
|
196
|
+
except (OSError, subprocess.TimeoutExpired):
|
|
197
|
+
verified = None
|
|
198
|
+
if verified is None or verified.returncode != 0:
|
|
199
|
+
hermes_setup.print_warning("The installed Inline CLI could not be verified.")
|
|
200
|
+
return None
|
|
201
|
+
|
|
202
|
+
hermes_setup.print_success("Inline CLI installed successfully.")
|
|
203
|
+
return inline_bin
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def _find_inline_cli() -> str | None:
|
|
207
|
+
discovered = shutil.which("inline")
|
|
208
|
+
if discovered:
|
|
209
|
+
return discovered
|
|
210
|
+
candidates = [
|
|
211
|
+
Path("/opt/homebrew/bin/inline"),
|
|
212
|
+
Path("/usr/local/bin/inline"),
|
|
213
|
+
Path.home() / ".local" / "bin" / "inline",
|
|
214
|
+
]
|
|
215
|
+
for candidate in candidates:
|
|
216
|
+
if candidate.is_file() and os.access(candidate, os.X_OK):
|
|
217
|
+
return str(candidate)
|
|
218
|
+
return None
|
|
219
|
+
|
|
220
|
+
|
|
129
221
|
def _prompt_existing_token(hermes_setup) -> str | None:
|
|
130
222
|
print()
|
|
131
|
-
hermes_setup.print_info("
|
|
223
|
+
hermes_setup.print_info("Go to Inline → Settings → Bots → Create a new bot, then copy its token.")
|
|
132
224
|
hermes_setup.print_info("Guide: https://inline.chat/docs/creating-a-bot")
|
|
133
225
|
token = hermes_setup.prompt("Inline bot token", password=True).strip()
|
|
134
226
|
return token or None
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
name: inline-platform
|
|
2
2
|
label: Inline
|
|
3
3
|
kind: platform
|
|
4
|
-
version: 0.0.5-alpha.
|
|
4
|
+
version: 0.0.5-alpha.1
|
|
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
|