Skip to content

Commit c57f88c

Browse files
committed
Merge branch 'main' into dev-20260407-v2.0.13
2 parents 07c6fb6 + 7df9f7d commit c57f88c

File tree

129 files changed

+42438
-1983
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+42438
-1983
lines changed
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Hermes Plugin — Build Prebuilds & Publish
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Version to publish (e.g. 1.0.0 or 1.0.0-beta.1)"
8+
required: true
9+
tag:
10+
description: "npm dist-tag (latest for production, beta/next/alpha for testing)"
11+
required: true
12+
default: "latest"
13+
14+
defaults:
15+
run:
16+
working-directory: apps/memos-local-plugin
17+
18+
permissions:
19+
contents: write
20+
21+
jobs:
22+
build-prebuilds:
23+
strategy:
24+
matrix:
25+
include:
26+
- os: macos-14
27+
platform: darwin-arm64
28+
- os: macos-15
29+
platform: darwin-x64
30+
- os: ubuntu-latest
31+
platform: linux-x64
32+
- os: windows-latest
33+
platform: win32-x64
34+
runs-on: ${{ matrix.os }}
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- uses: actions/setup-node@v4
39+
with:
40+
node-version: 22
41+
42+
- name: Install dependencies
43+
run: npm install
44+
45+
- name: Rebuild for x64 under Rosetta (darwin-x64 only)
46+
if: matrix.platform == 'darwin-x64'
47+
run: |
48+
arch -x86_64 npm rebuild better-sqlite3
49+
50+
- name: Collect prebuild
51+
shell: bash
52+
run: |
53+
mkdir -p prebuilds/${{ matrix.platform }}
54+
cp node_modules/better-sqlite3/build/Release/better_sqlite3.node prebuilds/${{ matrix.platform }}/
55+
56+
- name: Upload prebuild artifact
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: prebuild-hermes-${{ matrix.platform }}
60+
path: apps/memos-local-plugin/prebuilds/${{ matrix.platform }}/better_sqlite3.node
61+
62+
publish:
63+
needs: build-prebuilds
64+
runs-on: ubuntu-latest
65+
steps:
66+
- uses: actions/checkout@v4
67+
68+
- uses: actions/setup-node@v4
69+
with:
70+
node-version: 22
71+
registry-url: https://registry.npmjs.org
72+
73+
- name: Download all prebuilds
74+
uses: actions/download-artifact@v4
75+
with:
76+
path: apps/memos-local-plugin/prebuilds
77+
pattern: prebuild-hermes-*
78+
merge-multiple: false
79+
80+
- name: Organize prebuilds
81+
run: |
82+
cd prebuilds
83+
for dir in prebuild-hermes-*; do
84+
platform="${dir#prebuild-hermes-}"
85+
mkdir -p "$platform"
86+
mv "$dir/better_sqlite3.node" "$platform/"
87+
rmdir "$dir"
88+
done
89+
echo "Prebuilds collected:"
90+
find . -name "*.node" -exec ls -lh {} \;
91+
92+
- name: Install dependencies (skip native build)
93+
run: npm install --ignore-scripts
94+
95+
- name: Bump version
96+
run: npm version ${{ inputs.version }} --no-git-tag-version --allow-same-version
97+
98+
- name: Publish to npm
99+
run: npm publish --access public --tag ${{ inputs.tag }}
100+
env:
101+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
102+
103+
- name: Create git tag and push
104+
working-directory: .
105+
run: |
106+
git config user.name "github-actions[bot]"
107+
git config user.email "github-actions[bot]@users.noreply.github.com"
108+
git add apps/memos-local-plugin/package.json
109+
if ! git diff --staged --quiet; then
110+
git commit -m "release: hermes-plugin v${{ inputs.version }}"
111+
fi
112+
git tag "hermes-plugin-v${{ inputs.version }}"
113+
git push origin HEAD --tags

.github/workflows/openclaw-plugin-publish.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ jobs:
100100
MEMOS_ARMS_ENV: ${{ secrets.MEMOS_ARMS_ENV }}
101101

102102
- name: Bump version
103-
run: npm version ${{ inputs.version }} --no-git-tag-version
103+
# Branch may already have this version in package.json (e.g. after a prior merge); npm errors without this flag.
104+
run: npm version ${{ inputs.version }} --no-git-tag-version --allow-same-version
104105

105106
- name: Publish to npm
106107
run: npm publish --access public --tag ${{ inputs.tag }}
@@ -113,6 +114,8 @@ jobs:
113114
git config user.name "github-actions[bot]"
114115
git config user.email "github-actions[bot]@users.noreply.github.com"
115116
git add apps/memos-local-openclaw/package.json
116-
git commit -m "release: openclaw-plugin v${{ inputs.version }}"
117+
if ! git diff --staged --quiet; then
118+
git commit -m "release: openclaw-plugin v${{ inputs.version }}"
119+
fi
117120
git tag "openclaw-plugin-v${{ inputs.version }}"
118121
git push origin HEAD --tags

apps/MemOS-Cloud-OpenClaw-Plugin/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ node_modules
44
# Environment variables
55
.env
66
.env.*
7+
.memos_arms_uid
78

89
# NPM
910
.npmrc
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: memos-cloud-openclaw-plugin
3+
description: "OpenClaw lifecycle plugin for MemOS Cloud (add + recall memory)"
4+
homepage: https://github.com/MemTensor/MemOS-Cloud-OpenClaw-Plugin
5+
metadata: {
6+
"openclaw": {
7+
"emoji": "🧠",
8+
"events": ["before_agent_start", "agent_end", "command:new"],
9+
"requires": {
10+
"bins": ["node"]
11+
}
12+
}
13+
}
14+
---
15+
16+
# MemOS Cloud OpenClaw Plugin Hooks
17+
18+
This plugin registers the following OpenClaw lifecycle hooks to interact with MemOS Cloud:
19+
20+
- `before_agent_start`: Intercepts the agent startup sequence to recall relevant memories from MemOS Cloud and injects them into the agent's context.
21+
- `agent_end`: Intercepts the agent termination sequence to capture the completed conversation turn and saves it to MemOS Cloud.
22+
- `command:new`: Increments a numeric conversation suffix when the `/new` command is issued to keep MemOS contexts distinct.

apps/MemOS-Cloud-OpenClaw-Plugin/README.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,18 @@ A minimal OpenClaw lifecycle plugin that **recalls** memories from MemOS Cloud b
77
## Features
88
- **Recall**: `before_agent_start``/search/memory`
99
- **Add**: `agent_end``/add/message`
10+
- **Config UI**: starting the gateway also starts a local plugin config page for editing `plugins.entries.memos-cloud-openclaw-plugin.config`
1011
- Uses **Token** auth (`Authorization: Token <MEMOS_API_KEY>`)
1112

13+
## Config UI
14+
- On gateway start, the plugin launches a local config page and prints the URL in the terminal (default: `http://127.0.0.1:38463`).
15+
- The page reads and writes the host config file directly:
16+
- OpenClaw: `~/.openclaw/openclaw.json`
17+
- Moltbot: `~/.moltbot/moltbot.json`
18+
- ClawDBot: `~/.clawdbot/clawdbot.json`
19+
- If the preferred UI port is already in use, the plugin automatically picks the next free port.
20+
- Saving changes writes `plugins.entries.memos-cloud-openclaw-plugin.config`. (Note: you may need to manually restart the gateway after saving for settings to take effect).
21+
1222
## Install
1323

1424
### Option A — NPM (Recommended)
@@ -55,9 +65,8 @@ Make sure it’s enabled in `~/.openclaw/openclaw.json`:
5565
Restart the gateway after config changes.
5666

5767
## Environment Variables
58-
The plugin resolves runtime config in this order: **plugin config → env files → process environment**.
59-
Among env files, it tries them in order (**openclaw → moltbot → clawdbot**). For each key, the first file with a value wins.
60-
If none of these files exist (or the key is missing), it falls back to the process environment.
68+
The plugin resolves runtime config in this order: **plugin config → env files**. Due to strict security sandboxing, it **does not** read credentials from process environment variables.
69+
For env files, it tries them in order (**openclaw → moltbot → clawdbot**). For each key, the first file with a value wins.
6170

6271
**Where to configure**
6372
- Files (priority order):
@@ -66,19 +75,9 @@ If none of these files exist (or the key is missing), it falls back to the proce
6675
- `~/.clawdbot/.env`
6776
- Each line is `KEY=value`
6877

69-
**Quick setup (shell)**
78+
**Quick setup (shell / Windows)**
7079
```bash
71-
echo 'export MEMOS_API_KEY="mpg-..."' >> ~/.zshrc
72-
source ~/.zshrc
73-
# or
74-
75-
echo 'export MEMOS_API_KEY="mpg-..."' >> ~/.bashrc
76-
source ~/.bashrc
77-
```
78-
79-
**Quick setup (Windows PowerShell)**
80-
```powershell
81-
[System.Environment]::SetEnvironmentVariable("MEMOS_API_KEY", "mpg-...", "User")
80+
echo 'MEMOS_API_KEY="mpg-..."' >> ~/.openclaw/.env
8281
```
8382

8483
If `MEMOS_API_KEY` is missing, the plugin will warn with setup instructions and the API key URL.
@@ -306,7 +305,7 @@ MEMOS_AGENT_OVERRIDES='{"research-agent": {"memoryLimitNumber": 12, "relativity"
306305
- **What it does**: when enabled, session keys like `agent:main:<provider>:direct:<peer-id>` reuse `<peer-id>` as MemOS `user_id`.
307306
- **What it does not do**: non-direct session keys such as `agent:main:<provider>:channel:<channel-id>` keep using the configured fallback `userId`.
308307
- **Request paths affected**: the same resolver is used by both `buildSearchPayload()` and `buildAddMessagePayload()`, so recall and add stay consistent.
309-
- **Config precedence**: runtime config still follows the same rule as the rest of the plugin - plugin config first, then `.env` files (`~/.openclaw/.env` -> `~/.moltbot/.env` -> `~/.clawdbot/.env`), then process env.
308+
- **Config precedence**: runtime config still follows the same rule as the rest of the plugin - plugin config first, then `.env` files (`~/.openclaw/.env` -> `~/.moltbot/.env` -> `~/.clawdbot/.env`).
310309

311310

312311
## Notes

apps/MemOS-Cloud-OpenClaw-Plugin/README_ZH.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,18 @@
99
## 功能
1010
- **Recall**`before_agent_start``/search/memory`
1111
- **Add**`agent_end``/add/message`
12+
- **Config UI**:启动 gateway 时同时启动本地插件配置页面,用来编辑 `plugins.entries.memos-cloud-openclaw-plugin.config`
1213
- 使用 **Token** 认证(`Authorization: Token <MEMOS_API_KEY>`
1314

15+
## 配置页面
16+
- Gateway 启动后,插件会同时拉起一个本地配置页面,并在终端输出访问地址(默认:`http://127.0.0.1:38463`)。
17+
- 页面会直接读取并写回当前宿主的配置文件:
18+
- OpenClaw:`~/.openclaw/openclaw.json`
19+
- Moltbot:`~/.moltbot/moltbot.json`
20+
- ClawDBot:`~/.clawdbot/clawdbot.json`
21+
- 如果默认端口被占用,插件会自动顺延到下一个可用端口。
22+
- 页面保存后会写回 `plugins.entries.memos-cloud-openclaw-plugin.config`。(注意:保存后可能需要手动重启 Gateway 以使配置生效)
23+
1424
## 安装
1525

1626
### 方式 A — NPM(推荐)
@@ -57,9 +67,8 @@ openclaw gateway restart
5767
修改配置后需要重启 gateway。
5868

5969
## 环境变量
60-
插件运行时配置的优先级是:**插件 config → env 文件 → 进程环境变量**
70+
插件运行时配置的优先级是:**插件 config → env 文件**。为符合纯粹的安全沙箱规范,插件不再支持回退到进程环境变量去读取敏感凭证
6171
在 env 文件层,按顺序读取(**openclaw → moltbot → clawdbot**),每个键优先使用最先匹配到的值。
62-
若三个文件都不存在(或该键未找到),才会回退到进程环境变量。
6372

6473
**配置位置**
6574
- 文件(优先级顺序):
@@ -68,19 +77,9 @@ openclaw gateway restart
6877
- `~/.clawdbot/.env`
6978
- 每行格式:`KEY=value`
7079

71-
**快速配置(Shell)**
80+
**快速配置(Shell / Windows**
7281
```bash
73-
echo 'export MEMOS_API_KEY="mpg-..."' >> ~/.zshrc
74-
source ~/.zshrc
75-
# 或者
76-
77-
echo 'export MEMOS_API_KEY="mpg-..."' >> ~/.bashrc
78-
source ~/.bashrc
79-
```
80-
81-
**快速配置(Windows PowerShell)**
82-
```powershell
83-
[System.Environment]::SetEnvironmentVariable("MEMOS_API_KEY", "mpg-...", "User")
82+
echo 'MEMOS_API_KEY="mpg-..."' >> ~/.openclaw/.env
8483
```
8584

8685
若未读取到 `MEMOS_API_KEY`,插件会提示配置方式并附 API Key 获取地址。
@@ -311,7 +310,7 @@ MEMOS_AGENT_OVERRIDES='{"research-agent": {"memoryLimitNumber": 12, "relativity"
311310
- **行为说明**:开启后,像 `agent:main:<provider>:direct:<peer-id>` 这样的私聊 sessionKey,会把 `<peer-id>` 当作 MemOS `user_id`
312311
- **不会影响的场景**:像 `agent:main:<provider>:channel:<channel-id>` 这类非私聊 sessionKey,仍继续使用配置好的 fallback `userId`
313312
- **作用范围**:同一套解析逻辑同时作用于 `buildSearchPayload()``buildAddMessagePayload()`,保证 recall 与 add 一致。
314-
- **配置优先级**:仍遵循插件现有规则——插件 config 优先,其次是 `.env` 文件(`~/.openclaw/.env` -> `~/.moltbot/.env` -> `~/.clawdbot/.env`,最后才回退到进程环境变量
313+
- **配置优先级**:仍遵循插件现有规则——插件 config 优先,其次是 `.env` 文件(`~/.openclaw/.env` -> `~/.moltbot/.env` -> `~/.clawdbot/.env`)。
315314

316315

317316
## 说明

0 commit comments

Comments
 (0)