@inline-chat/hermes-agent-adapter 0.0.10 → 0.0.11
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 +1 -1
- package/package.json +1 -1
- package/plugin/inline/adapter.py +14 -15
- package/plugin/inline/cli.py +1 -1
- package/plugin/inline/plugin.yaml +1 -1
- package/plugin/inline/sidecar/index.mjs +24 -1
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inline-chat/hermes-agent-adapter",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
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/adapter.py
CHANGED
|
@@ -67,7 +67,10 @@ _DEDUP_WINDOW_SECONDS = 48 * 3600
|
|
|
67
67
|
_CHAT_INFO_CACHE_SECONDS = 10 * 60
|
|
68
68
|
_CHAT_INFO_CACHE_MAX_SIZE = 512
|
|
69
69
|
_BOT_SETTINGS_CHAT_INFO_TIMEOUT_SECONDS = 2.0
|
|
70
|
-
|
|
70
|
+
# Provider discovery may invoke host CLIs. Keep repeated panel opens and
|
|
71
|
+
# unrelated mutations off that slow path while always injecting the live
|
|
72
|
+
# current/default model into the document below.
|
|
73
|
+
_BOT_SETTINGS_MODEL_CATALOG_CACHE_SECONDS = 5 * 60
|
|
71
74
|
_DEFAULT_CONTEXT_BACKFILL = "selective"
|
|
72
75
|
_CONTEXT_BACKFILL_MODES = {"off", "selective", "always"}
|
|
73
76
|
_DEFAULT_THREAD_CONTEXT_LIMIT = 30
|
|
@@ -1058,7 +1061,7 @@ class InlineAdapter(BasePlatformAdapter):
|
|
|
1058
1061
|
"actor_id": actor_id,
|
|
1059
1062
|
"chat_type": chat_type,
|
|
1060
1063
|
"is_reply_thread": is_reply_thread,
|
|
1061
|
-
"following": self._chat_follow_mode_following(info),
|
|
1064
|
+
"following": None if chat_type == "dm" else self._chat_follow_mode_following(info),
|
|
1062
1065
|
"reply_threads": self._reply_thread_mode_for_chat(scope_chat_id),
|
|
1063
1066
|
"can_set_default_model": can_modify,
|
|
1064
1067
|
"source": source,
|
|
@@ -1250,13 +1253,13 @@ class InlineAdapter(BasePlatformAdapter):
|
|
|
1250
1253
|
}},
|
|
1251
1254
|
})
|
|
1252
1255
|
|
|
1253
|
-
sections: List[Dict[str, Any]] = [
|
|
1254
|
-
|
|
1255
|
-
{"id": "attention", "items": [{
|
|
1256
|
+
sections: List[Dict[str, Any]] = [{"id": "runtime", "items": runtime_items}]
|
|
1257
|
+
if context.get("following") is not None:
|
|
1258
|
+
sections.append({"id": "attention", "items": [{
|
|
1256
1259
|
"id": "following", "label": "Following", "description": "Wake on eligible activity.", **common,
|
|
1257
1260
|
"control": {"oneofKind": "toggle", "toggle": {"value": bool(context.get("following"))}},
|
|
1258
|
-
}]}
|
|
1259
|
-
|
|
1261
|
+
}]})
|
|
1262
|
+
sections.append({"id": "replies", "items": [{
|
|
1260
1263
|
"id": "reply-threads", "label": "Reply in threads", **common,
|
|
1261
1264
|
"control": {"oneofKind": "select", "select": {
|
|
1262
1265
|
"value": context.get("reply_threads") or "auto",
|
|
@@ -1266,8 +1269,7 @@ class InlineAdapter(BasePlatformAdapter):
|
|
|
1266
1269
|
{"value": "off", "label": "Off", "description": "Stay in chat.", "disabled": False},
|
|
1267
1270
|
],
|
|
1268
1271
|
}},
|
|
1269
|
-
}]}
|
|
1270
|
-
]
|
|
1272
|
+
}]})
|
|
1271
1273
|
if disabled:
|
|
1272
1274
|
sections.append({"id": "access", "items": [{
|
|
1273
1275
|
"id": "read-only", "label": "Read-only", "disabled": False,
|
|
@@ -1351,14 +1353,11 @@ class InlineAdapter(BasePlatformAdapter):
|
|
|
1351
1353
|
runner = context.get("runner")
|
|
1352
1354
|
source = context.get("source")
|
|
1353
1355
|
if item_id == "following" and value_body.get("oneofKind") == "boolValue":
|
|
1356
|
+
if context.get("following") is None:
|
|
1357
|
+
raise ValueError("following unavailable")
|
|
1354
1358
|
enabled = bool(value_body.get("boolValue"))
|
|
1355
|
-
target = (
|
|
1356
|
-
{"userId": context["actor_id"]}
|
|
1357
|
-
if context.get("chat_type") == "dm"
|
|
1358
|
-
else {"chatId": context["chat_id"]}
|
|
1359
|
-
)
|
|
1360
1359
|
await self._sidecar_call("/follow-mode", {
|
|
1361
|
-
"target":
|
|
1360
|
+
"target": {"chatId": context["chat_id"]},
|
|
1362
1361
|
"mode": "following" if enabled else "unfollowed",
|
|
1363
1362
|
})
|
|
1364
1363
|
self._invalidate_chat_info(context["chat_id"])
|
package/plugin/inline/cli.py
CHANGED
|
@@ -26,7 +26,7 @@ _CLI_INSTALL_URL = "https://inline.chat/cli/install.sh"
|
|
|
26
26
|
_MAX_TOKEN_BYTES = 16 * 1024
|
|
27
27
|
_MAX_PROBE_RESPONSE_BYTES = 64 * 1024
|
|
28
28
|
_MACHINE_SETUP_PROTOCOL_VERSION = 1
|
|
29
|
-
_PROBE_USER_AGENT = "inline-hermes-agent-adapter/0.0.
|
|
29
|
+
_PROBE_USER_AGENT = "inline-hermes-agent-adapter/0.0.11"
|
|
30
30
|
_ENV_REFERENCE_RE = re.compile(r"^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$")
|
|
31
31
|
|
|
32
32
|
|
|
@@ -45251,6 +45251,7 @@ var portableCoreV1Vector = {
|
|
|
45251
45251
|
};
|
|
45252
45252
|
// src/sidecar/contract.ts
|
|
45253
45253
|
var MAX_INLINE_ID = 9223372036854775807n;
|
|
45254
|
+
var MAX_UINT64 = 18446744073709551615n;
|
|
45254
45255
|
var sensitiveUrlParams = new Set([
|
|
45255
45256
|
"access_token",
|
|
45256
45257
|
"auth",
|
|
@@ -45553,6 +45554,25 @@ function parseInlineId(value, field) {
|
|
|
45553
45554
|
throw new SidecarError(`${field} must be a positive signed 64-bit integer`, "bad_format");
|
|
45554
45555
|
}
|
|
45555
45556
|
}
|
|
45557
|
+
function parseUnsigned64Id(value, field) {
|
|
45558
|
+
try {
|
|
45559
|
+
if (typeof value === "number" && (!Number.isSafeInteger(value) || value <= 0)) {
|
|
45560
|
+
throw new Error("unsafe number");
|
|
45561
|
+
}
|
|
45562
|
+
const raw = typeof value === "string" ? value.trim() : value;
|
|
45563
|
+
if (typeof raw === "string" && !/^[1-9][0-9]*$/.test(raw))
|
|
45564
|
+
throw new Error("invalid digits");
|
|
45565
|
+
if (typeof raw !== "string" && typeof raw !== "bigint" && typeof raw !== "number") {
|
|
45566
|
+
throw new Error("invalid type");
|
|
45567
|
+
}
|
|
45568
|
+
const parsed = BigInt(raw);
|
|
45569
|
+
if (parsed <= 0n || parsed > MAX_UINT64)
|
|
45570
|
+
throw new Error("out of range");
|
|
45571
|
+
return parsed;
|
|
45572
|
+
} catch {
|
|
45573
|
+
throw new SidecarError(`${field} must be a positive unsigned 64-bit integer`, "bad_format");
|
|
45574
|
+
}
|
|
45575
|
+
}
|
|
45556
45576
|
function defaultErrorText(error) {
|
|
45557
45577
|
return error instanceof Error ? error.message : String(error);
|
|
45558
45578
|
}
|
|
@@ -46579,7 +46599,10 @@ async function endpointAnswerAction(res, body) {
|
|
|
46579
46599
|
}
|
|
46580
46600
|
async function endpointAnswerBotSettings(res, body) {
|
|
46581
46601
|
const record2 = asRecord(body);
|
|
46582
|
-
|
|
46602
|
+
if (record2.requestId == null || record2.requestId === "") {
|
|
46603
|
+
throw new SidecarError("missing requestId", "bad_format");
|
|
46604
|
+
}
|
|
46605
|
+
const requestId = parseUnsigned64Id(record2.requestId, "requestId");
|
|
46583
46606
|
const response = asRecord(record2.response);
|
|
46584
46607
|
await client.answerBotChatSettings({ requestId, response });
|
|
46585
46608
|
writeJson(res, 200, { ok: true, result: {} });
|