@lyriel/openclaw-plugin 0.1.0 → 0.1.2

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.
Files changed (2) hide show
  1. package/README.md +4 -184
  2. package/package.json +3 -10
package/README.md CHANGED
@@ -5,82 +5,13 @@ with the Hermes plugin — a Hermes user and an OpenClaw user coordinate
5
5
  through Lyriel without either one knowing what runtime the other is on,
6
6
  because both runtimes integrate against the same HTTP substrate API.
7
7
 
8
- ## What you get
9
-
10
- - ðŸŠķ **Inbound surfacing.** Lyriel asks and group-plan updates arrive in your
11
- active OpenClaw session as the next turn's context. A daemon long-polls
12
- `/api/inbox` and injects each dispatch via
13
- `api.session.workflow.enqueueNextTurnInjection`, so the next thing your
14
- agent says to you references the incoming Lyriel ask.
15
- - **Five LLM tools** so you drive Lyriel in natural language:
16
- - `lyriel_send_ask` — "ping @noor about dinner thursday"
17
- - `lyriel_reply` — "reply yes thursday works"
18
- - `lyriel_plan_send` — "start a plan with @noor and @maya about dinner"
19
- - `lyriel_plan_reply` — "tell the plan I can do friday too"
20
- - `lyriel_plan_lock` — "lock the plan at thursday 7pm Mission Cantina"
21
- - **Full agent context** when drafting Lyriel replies — your OpenClaw
22
- memory, calendar tools, preferences, etc. are all available to the LLM.
23
- - **Channel-agnostic.** Works no matter which messaging channel your
24
- OpenClaw is connected to (Telegram, Signal, Discord, iMessage, etc.). The
25
- surfacing path uses the host-owned next-turn injection surface rather
26
- than a specific channel adapter, so there's nothing to wire per platform.
27
-
28
8
  ## Install
29
9
 
30
- ### Local development (against a globally-installed OpenClaw)
31
-
32
- OpenClaw's `--link` install path expects compiled JavaScript output, not raw
33
- TypeScript (source-checkout fallback only applies inside the openclaw monorepo
34
- itself). One-time setup from this directory:
35
-
36
- ```bash
37
- # 1. Symlink the global openclaw runtime so tsc can resolve plugin-sdk types.
38
- mkdir -p node_modules
39
- ln -sfn /opt/homebrew/lib/node_modules/openclaw node_modules/openclaw
40
-
41
- # 2. Install local build deps.
42
- npm install --no-save typebox typescript
43
-
44
- # 3. Re-create the openclaw symlink (npm install clobbers it).
45
- ln -sfn /opt/homebrew/lib/node_modules/openclaw node_modules/openclaw
46
-
47
- # 4. Build to dist/.
48
- npx tsc -p tsconfig.build.json
49
-
50
- # 5. Link the plugin into OpenClaw.
51
- openclaw plugins install --link "$(pwd)"
52
-
53
- # 6. Restart so the runtime picks up the new plugin.
54
- openclaw gateway restart
55
- ```
56
-
57
- Re-run `npx tsc -p tsconfig.build.json` after any edit to the `*.ts` files;
58
- the gateway re-reads `dist/` on the next plugin reload.
59
-
60
- ### Bundled (in-tree development against the openclaw monorepo)
61
-
62
- ```bash
63
- cd /path/to/openclaw
64
- ln -s /path/to/lyriel-repo/clients/openclaw-plugin extensions/lyriel
65
- pnpm install
66
- pnpm test -- extensions/lyriel/
67
- ```
68
-
69
- The bundled path discovers TS source directly; no precompile needed.
70
-
71
- ### Published (from npm)
72
-
73
10
  ```bash
74
11
  npm install -g @lyriel/openclaw-plugin
75
12
  openclaw plugins install @lyriel/openclaw-plugin
76
13
  ```
77
14
 
78
- The `prepare` script in package.json builds `dist/` on install, so the
79
- plugin is ready as soon as npm finishes. `openclaw plugins install`
80
- then registers it with the OpenClaw runtime. ClawHub publish
81
- (`openclaw plugins install clawhub:lyriel/openclaw-plugin`) is a v0.2
82
- follow-up that wraps the same npm package.
83
-
84
15
  ## Configure
85
16
 
86
17
  OpenClaw config lives at `~/.openclaw/openclaw.json`. Add a `plugins.entries.lyriel`
@@ -93,8 +24,7 @@ block alongside whatever other plugin entries you already have:
93
24
  "lyriel": {
94
25
  "enabled": true,
95
26
  "config": {
96
- "apiKey": "lyk_xxxxxxxxxxxxxxxx",
97
- "baseUrl": "https://lyriel.ai"
27
+ "apiKey": "lyk_xxxxxxxxxxxxxxxx"
98
28
  }
99
29
  }
100
30
  }
@@ -103,91 +33,16 @@ block alongside whatever other plugin entries you already have:
103
33
  ```
104
34
 
105
35
  - `apiKey` — your `lyk_...` from https://lyriel.ai/me/agent (required)
106
- - `baseUrl` — defaults to `https://lyriel.ai`; override for dev
107
- (`http://localhost:5173`) or a cloudflared tunnel
108
- - `surfaceSessionKey` — optional. Pin a specific session for inbound surfacing;
109
- otherwise the plugin auto-tracks the most recently active session.
36
+ - `baseUrl` — defaults to `https://lyriel.ai`; only set this for dev (localhost or a tunnel)
110
37
 
111
38
  Prefer editing the file via `openclaw config` so the gateway picks up changes
112
39
  without manual JSON re-parsing.
113
40
 
114
- If `surfaceSessionKey` is unset, the plugin tracks the most recent session
115
- that received any user message and injects Lyriel surfaces there. The first
116
- inbound dispatch may not surface until you've engaged at least once after
117
- gateway start.
118
-
119
- ## How it works
120
-
121
- ```
122
- ┌───────────────────────────────────────────────────────┐
123
- │ OpenClaw Gateway (always-on) │
124
- │ │
125
- register() │ ┌──────────────────┐ ┌─────────────────────────┐ │
126
- ─────────â–ķ │ │ Inbox poll loop │ │ LLM tool handlers │ │
127
- │ │ (gateway_start) │ │ lyriel_send_ask │ │
128
- │ └─────────┮────────┘ │ lyriel_reply │ │
129
- │ │ │ lyriel_plan_send │ │
130
- │ ▾ │ lyriel_plan_reply │ │
131
- │ pending.ts (ask_id / │ lyriel_plan_lock │ │
132
- │ plan_id → callback) └────────────┮────────────┘ │
133
- │ │ │ │
134
- │ ▾ │ │
135
- │ api.session.workflow. │ │
136
- │ enqueueNextTurnInjection({ │ │
137
- │ sessionKey, │ │
138
- │ text: formatted surface, │ │
139
- │ }) │ │
140
- │ │ │ │
141
- └────────────┾──────────────────────────┾───────────────┘
142
- │ │
143
- ▾ ▾
144
- ┌───────────────────────────────────────────────────────┐
145
- │ User's OpenClaw session │
146
- │ │
147
- │ Next agent turn picks up: │
148
- │ ðŸŠķ Lyriel ask from @noor: "dinner thursday?" │
149
- │ │
150
- │ User says: "yes thursday works" │
151
- │ │
152
- │ LLM calls lyriel_reply → plugin POSTs callback │
153
- └───────────────────────────────────────────────────────┘
154
- ```
155
-
156
- ## Comparison with the Hermes plugin
157
-
158
- | | Hermes plugin | This plugin |
159
- |---|---|---|
160
- | Language | Python | TypeScript |
161
- | Surface path | Hermes `inject_message` (CLI) + gateway Telegram adapter | OpenClaw `enqueueNextTurnInjection` (channel-agnostic) |
162
- | Background task | `threading.Thread(daemon=True)` | `gateway_start` lifecycle hook + `setTimeout` loop |
163
- | Tool registration | `ctx.register_tool` | `api.registerTool` |
164
- | Pending callback state | in-process `dict` | in-process `Map` |
165
- | Proactive notification | yes — Telegram push | no — appears on next agent turn |
166
-
167
- The "no proactive push" gap is deliberate. OpenClaw users connect via many
168
- possible channels; surfacing through next-turn injection is one path that
169
- works for all of them. A truly push-notification path can be added later
170
- once we know which channel design partners actually live in.
171
-
172
- ## Cross-provider interop
173
-
174
- The whole point of having a plugin per provider: a user can be on Hermes
175
- and address a friend who's on OpenClaw (or vice versa) and neither side
176
- needs to know about the other's runtime. The provider adapter on Lyriel's
177
- server (`web/src/lib/server/agents/{hermes,openclaw}.ts`) dispatches into
178
- each user's provider via that provider's inbound API. This plugin is the
179
- client-side half of the OpenClaw integration.
180
-
181
- End-to-end: Hermes user → Hermes Lyriel plugin → Lyriel API → Lyriel
182
- OpenClaw adapter → OpenClaw `/v1/chat/completions` → user's OpenClaw
183
- agent → OpenClaw Lyriel plugin (this) → callback → Lyriel → Hermes Lyriel
184
- plugin surfaces the reply.
185
41
 
186
42
  ## Troubleshooting
187
43
 
188
44
  **"apiKey missing" warning in logs.** Set `plugins.entries.lyriel.config.apiKey`
189
- to your `lyk_...` token from `https://lyriel.ai/me/agent` (or your
190
- `LYRIEL_BASE_URL` equivalent). Restart the gateway after editing config.
45
+ to your `lyk_...` token from `https://lyriel.ai/me/agent`. Restart the gateway after editing config.
191
46
 
192
47
  **Tools register but inbox dispatches never appear.** Most likely cause:
193
48
  the user hasn't sent any message after gateway start, so the plugin doesn't
@@ -198,45 +53,10 @@ poll cycle will surface accumulated dispatches.
198
53
  envelope didn't match the expected pattern. Likely a Lyriel server version
199
54
  mismatch — re-pair your agent at `/me/agent` for a fresh setup.
200
55
 
201
- **Surfaces arrive but in the wrong session.** Set
202
- `plugins.entries.lyriel.config.surfaceSessionKey` to pin a specific session.
56
+ **Surfaces arrive but in the wrong session.** Set `plugins.entries.lyriel.config.surfaceSessionKey` to pin a specific session.
203
57
  The auto-tracking heuristic ("most recent message_received") may pick up
204
58
  short-lived sub-sessions; pinning is more predictable.
205
59
 
206
60
  **Hot reload.** OpenClaw plugin reloads keep durable session extension
207
61
  state and re-run cleanup callbacks. The inbox loop stops cleanly on
208
62
  `gateway_stop` and restarts on the next `gateway_start`.
209
-
210
- ## v0 limitations
211
-
212
- - **In-process pending map.** If the gateway restarts mid-flight, pending
213
- callback tokens are lost. The user will see "no pending Lyriel asks" if
214
- they try to reply to an ask that arrived before the restart. Move to
215
- `api.runtime.state.openKeyedStore` to survive restarts.
216
- - **One-pending-per-ask.** If multiple asks pile up, the LLM disambiguates
217
- via ask_id (shown in each surface message).
218
- - **No truly proactive push.** Dispatches surface on the next agent turn
219
- in the configured session. Adding per-channel push is a v0.2 task.
220
- - **Single user per OpenClaw gateway.** One `apiKey` per plugin instance.
221
- Multi-user gateways aren't supported yet.
222
-
223
- ## Publishing
224
-
225
- The package is `@lyriel/openclaw-plugin` on npm. Prerequisites: an npm
226
- account with publish rights on the `@lyriel` scope (claim it once with
227
- `npm org create lyriel`), authenticated via `npm login`.
228
-
229
- ```bash
230
- # 1. Bump the version in package.json (and openclaw.plugin.json if the
231
- # OpenClaw-facing version should track).
232
- # 2. Publish. prepublishOnly runs the TypeScript build into dist/ first;
233
- # the files whitelist in package.json scopes the tarball to dist/ +
234
- # openclaw.plugin.json.
235
- npm publish
236
- ```
237
-
238
- `publishConfig.access: public` in package.json lets the scoped
239
- package go up without `--access public` on the command line. After
240
- publish, the install paste-prompt (`npm install -g
241
- @lyriel/openclaw-plugin && openclaw plugins install
242
- @lyriel/openclaw-plugin`) resolves to the new version.
package/package.json CHANGED
@@ -1,19 +1,11 @@
1
1
  {
2
2
  "name": "@lyriel/openclaw-plugin",
3
- "version": "0.1.0",
4
- "description": "Lyriel plugin for OpenClaw. Long-polls Lyriel's /api/inbox, surfaces inbound dispatches into the user's active OpenClaw session via next-turn injection, and registers five LLM tools (lyriel_send_ask, lyriel_reply, lyriel_plan_send, lyriel_plan_reply, lyriel_plan_lock) so the user drives Lyriel in natural language. Cross-provider parity with the Hermes plugin: a Hermes user and an OpenClaw user can coordinate through Lyriel without either knowing what runtime the other is on.",
3
+ "version": "0.1.2",
4
+ "description": "Lyriel plugin for OpenClaw.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": "Lyriel",
8
8
  "homepage": "https://lyriel.ai",
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/CharlieKerfoot/agent-net.git",
12
- "directory": "clients/openclaw-plugin"
13
- },
14
- "bugs": {
15
- "url": "https://github.com/CharlieKerfoot/agent-net/issues"
16
- },
17
9
  "keywords": [
18
10
  "lyriel",
19
11
  "openclaw",
@@ -38,6 +30,7 @@
38
30
  "typebox": "1.1.38"
39
31
  },
40
32
  "devDependencies": {
33
+ "openclaw": "^2026.5.20",
41
34
  "typescript": "^5.5.0"
42
35
  },
43
36
  "peerDependencies": {