🐤 Sync 2026-04-19 08:30:38

This commit is contained in:
github-actions[bot] committed 2026-04-19 08:30:38 +08:00
1 parent 746d64b361
commit a9b3f7579c
14 files changed
+327 -42

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
include $(TOPDIR)/rules.mk
PKG_VERSION:=1.0.0-20240101
PKG_RELEASE:=1
LUCI_TITLE:=LuCI support for Hermes
LUCI_PKGARCH:=all
LUCI_DEPENDS:=+docker +dockerd +luci-lib-taskd
define Package/luci-app-hermes/conffiles
/etc/config/hermes
endef
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature
@@ -0,0 +1,6 @@
module("luci.controller.hermes", package.seeall)
function index()
entry({"admin", "services", "hermes"}, alias("admin", "services", "hermes", "config"), _("Hermes"), 30).dependent = true
entry({"admin", "services", "hermes", "config"}, cbi("hermes"))
end
@@ -0,0 +1,45 @@
--[[
LuCI - Lua Configuration Interface
]]--
local taskd = require "luci.model.tasks"
local hermes_model = require "luci.model.hermes"
local m, s, o
m = taskd.docker_map("hermes", "hermes", "/usr/libexec/istorec/hermes.sh",
translate("Hermes"),
translate("The self-improving AI agent that runs on your server. Layered memory that accumulates across sessions, a cron scheduler that fires while you're offline, and a skills system that saves reusable procedures automatically.")
.. translate("Official website:") .. ' <a href=\"https://get-hermes.ai/\" target=\"_blank\">https://get-hermes.ai/</a>')
s = m:section(SimpleSection, translate("Service Status"), translate("Hermes status:"))
s:append(Template("hermes/status"))
s = m:section(TypedSection, "main", translate("Setup"), translate("The following parameters will only take effect during installation or upgrade:"))
s.addremove = false
s.anonymous = true
o = s:option(Value, "port", translate("Port") .. "<b>*</b>")
o.default = "8787"
o.datatype = "port"
local blocks = hermes_model.blocks()
o = s:option(Value, "data_path", translate("Data path") .. "<b>*</b>")
o.rmempty = false
o.datatype = "string"
local data_paths, data_default = hermes_model.find_paths(blocks, "data")
for _, val in pairs(data_paths) do
o:value(val, val)
end
o.default = data_default
o = s:option(Value, "workspace_path", translate("Workspace path") .. "<b>*</b>")
o.rmempty = false
o.datatype = "string"
local ws_paths, ws_default = hermes_model.find_paths(blocks, "workspace")
for _, val in pairs(ws_paths) do
o:value(val, val)
end
o.default = ws_default
return m
+38
View File
@@ -0,0 +1,38 @@
local util = require "luci.util"
local jsonc = require "luci.jsonc"
local hermes = {}
hermes.blocks = function()
local f = io.popen("lsblk -s -f -b -o NAME,FSSIZE,MOUNTPOINT --json", "r")
local vals = {}
if f then
local ret = f:read("*all")
f:close()
local obj = jsonc.parse(ret)
if obj and obj["blockdevices"] then
for _, val in pairs(obj["blockdevices"]) do
local fsize = val["fssize"]
if fsize ~= nil and string.len(fsize) > 10 and val["mountpoint"] then
-- fsize > 1G
vals[#vals+1] = val["mountpoint"]
end
end
end
end
return vals
end
hermes.find_paths = function(blocks, subdir)
local configs = {}
local default_path = ''
for _, mountpoint in pairs(blocks) do
table.insert(configs, mountpoint .. "/hermes/" .. subdir)
end
if #configs > 0 then
default_path = configs[1]
end
return configs, default_path
end
return hermes
@@ -0,0 +1,30 @@
<%
local util = require "luci.util"
local container_status = util.trim(util.exec("/usr/libexec/istorec/hermes.sh status"))
local container_install = (string.len(container_status) > 0)
local container_running = container_status == "running"
-%>
<div class="cbi-value">
<label class="cbi-value-title"><%:Status%></label>
<div class="cbi-value-field">
<% if container_running then %>
<button class="cbi-button cbi-button-success" disabled="true"><%:Hermes is running%></button>
<% else %>
<button class="cbi-button cbi-button-negative" disabled="true"><%:Hermes is not running%></button>
<% end %>
</div>
</div>
<%
if container_running then
local port = util.trim(util.exec("/usr/libexec/istorec/hermes.sh port"))
if port == "" then
port = "8787"
end
-%>
<div class="cbi-value cbi-value-last">
<label class="cbi-value-title">&nbsp;</label>
<div class="cbi-value-field">
<input type="button" class="btn cbi-button cbi-button-apply" name="start" value="<%:Open Hermes%>" onclick="window.open('http://'+location.hostname+':<%=port%>/', '_blank')">
</div>
</div>
<% end %>
+44
View File
@@ -0,0 +1,44 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "Official website:"
msgstr "官方网站:"
msgid "Hermes"
msgstr "Hermes 消息服务"
msgid "The self-improving AI agent that runs on your server. Layered memory that accumulates across sessions, a cron scheduler that fires while you're offline, and a skills system that saves reusable procedures automatically."
msgstr "运行在您的服务器上的自我改进型人工智能代理。它采用跨会话累积的分层内存、在您离线时运行的定时任务调度程序,以及自动保存可重用程序的技能系统。"
msgid "Port"
msgstr "端口"
msgid "Data path"
msgstr "数据路径"
msgid "Workspace path"
msgstr "工作目录路径"
msgid "Service Status"
msgstr "服务状态"
msgid "Hermes status:"
msgstr "Hermes 状态信息如下:"
msgid "Setup"
msgstr "安装配置"
msgid "The following parameters will only take effect during installation or upgrade:"
msgstr "以下参数只在安装或者升级时才会生效:"
msgid "Status"
msgstr "状态"
msgid "Hermes is running"
msgstr "Hermes 运行中"
msgid "Hermes is not running"
msgstr "Hermes 未运行"
msgid "Open Hermes"
msgstr "打开 Hermes"
+1
View File
@@ -0,0 +1 @@
zh-cn
+4
View File
@@ -0,0 +1,4 @@
config main
option 'port' '8787'
option 'data_path' ''
option 'workspace_path' ''
+67
View File
@@ -0,0 +1,67 @@
#!/bin/sh
ACTION=${1}
shift 1
do_install() {
local port=$(uci get hermes.@main[0].port 2>/dev/null | tr -d '\n\r')
local data=$(uci get hermes.@main[0].data_path 2>/dev/null | tr -d '\n\r')
local workspace=$(uci get hermes.@main[0].workspace_path 2>/dev/null | tr -d '\n\r')
local image_name="linkease/hermes:latest"
echo "docker pull ${image_name}"
docker pull ${image_name}
docker rm -f hermes
[ -z "$port" ] && port=8787
local cmd="docker run --restart=unless-stopped -d"
[ -n "$data" ] && cmd="$cmd -v \"$data:/data/.hermes\""
[ -n "$workspace" ] && cmd="$cmd -v \"$workspace:/workspace\""
cmd="$cmd -p $port:8787"
local tz=$(uci get system.@system[0].zonename 2>/dev/null | sed 's/ /_/g')
[ -z "$tz" ] || cmd="$cmd -e TZ=$tz"
cmd="$cmd --name hermes \"$image_name\""
echo "$cmd"
eval "$cmd"
}
usage() {
echo "usage: $0 sub-command"
echo "where sub-command is one of:"
echo " install Install the hermes"
echo " upgrade Upgrade the hermes"
echo " rm/start/stop/restart Remove/Start/Stop/Restart the hermes"
echo " status Hermes status"
echo " port Hermes port"
}
case ${ACTION} in
"install")
do_install
;;
"upgrade")
do_install
;;
"rm")
docker rm -f hermes
;;
"start" | "stop" | "restart")
docker ${ACTION} hermes
;;
"status")
docker ps --all -f 'name=^/hermes$' --format '{{.State}}'
;;
"port")
docker ps --all -f 'name=^/hermes$' --format '{{.Ports}}' | grep -om1 '0.0.0.0:[0-9]*->8787/tcp' | sed 's/0.0.0.0:\([0-9]*\)->.*/\1/'
;;
*)
usage
exit 1
;;
esac
@@ -0,0 +1,11 @@
{
"luci-app-hermes": {
"description": "Grant UCI access for luci-app-hermes",
"read": {
"uci": [ "hermes" ]
},
"write": {
"uci": [ "hermes" ]
}
}
}