tnyma-bridge 0.1.0
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 +35 -0
- package/bundle/feishu-bot-creator/README.md +66 -0
- package/bundle/feishu-bot-creator/assets/tnyma-ai-avatar.png +0 -0
- package/bundle/feishu-bot-creator/feishu_bot_creator.py +2063 -0
- package/bundle/index.js +214 -0
- package/bundle/postinstall.js +5 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# tnyma-bridge
|
|
2
|
+
|
|
3
|
+
Tnyma Bridge connects your local OpenClaw app to Tnyma.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i -g tnyma-bridge
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Requires Node.js 20 or newer.
|
|
12
|
+
|
|
13
|
+
## Use
|
|
14
|
+
|
|
15
|
+
The bridge starts automatically after global install.
|
|
16
|
+
|
|
17
|
+
Open the local binding page:
|
|
18
|
+
|
|
19
|
+
```text
|
|
20
|
+
http://127.0.0.1:18788
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The page shows the QR code and pairing code. Scan the QR code or enter the pairing code in Tnyma to bind this computer.
|
|
24
|
+
|
|
25
|
+
Keep the process running while you want this computer connected.
|
|
26
|
+
|
|
27
|
+
## Troubleshooting
|
|
28
|
+
|
|
29
|
+
If OpenClaw is not detected, start OpenClaw first and then restart `tnyma-bridge`.
|
|
30
|
+
|
|
31
|
+
If the bridge is not running, start it manually:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
tnyma-bridge
|
|
35
|
+
```
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# feishu-bot-creator
|
|
2
|
+
|
|
3
|
+
Headless-Playwright script that bridge-node spawns to automate the
|
|
4
|
+
Feishu / Lark open-platform "create custom-built bot" flow.
|
|
5
|
+
|
|
6
|
+
## How it fits
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
[Browser] → /v1/integrations/feishu/bind/stream (SSE)
|
|
10
|
+
│
|
|
11
|
+
▼
|
|
12
|
+
[bridge-node] handlers/integrations-feishu.ts
|
|
13
|
+
│ └── integrations/feishu/bind-session.ts (spawn + line-buffered SSE)
|
|
14
|
+
▼
|
|
15
|
+
[python3 feishu_bot_creator.py create --platform feishu]
|
|
16
|
+
│
|
|
17
|
+
▼
|
|
18
|
+
Feishu open platform (QR scan, internal /developers/v1 APIs)
|
|
19
|
+
│
|
|
20
|
+
▼
|
|
21
|
+
Writes channels.feishu.accounts.<id>.{appId, appSecret, ...}
|
|
22
|
+
into $FEISHU_BOT_OPENCLAW_CONFIG (default /root/.openclaw/openclaw.json)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The script emits one JSON line per event on stdout. bind-session.ts parses
|
|
26
|
+
each line, strips `app_secret` from `finish` events and credential-log
|
|
27
|
+
lines, then re-emits as SSE so neither the browser nor the cloud
|
|
28
|
+
control-plane ever sees the raw secret.
|
|
29
|
+
|
|
30
|
+
## Standalone usage (manual debugging on the VM)
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Install Python deps + Chromium (one-time per VM/image)
|
|
34
|
+
python3 feishu_bot_creator.py init
|
|
35
|
+
|
|
36
|
+
# Run the full flow. Each JSON line is one event.
|
|
37
|
+
python3 feishu_bot_creator.py create --platform feishu
|
|
38
|
+
|
|
39
|
+
# Kill leftover Chromium / clear profile lock files
|
|
40
|
+
python3 feishu_bot_creator.py cleanup
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Environment knobs
|
|
44
|
+
|
|
45
|
+
| Var | Default | Notes |
|
|
46
|
+
|---|---|---|
|
|
47
|
+
| `FEISHU_BOT_CDP_PORT` | `9222` | Chromium remote-debugging port |
|
|
48
|
+
| `FEISHU_BOT_STATE_DIR` | `/tmp` | Profile dir + cached avatar + state file land here |
|
|
49
|
+
| `FEISHU_BOT_OPENCLAW_CONFIG` | `/root/.openclaw/openclaw.json` | Where channels.feishu.* gets written |
|
|
50
|
+
| `FEISHU_BOT_OPENCLAW_ALLOW_FROM` | `/root/.openclaw/credentials/feishu-default-allowFrom.json` | Owner open_id allowlist |
|
|
51
|
+
| `FEISHU_BOT_ACCOUNT_ID` | `default` | `channels.feishu.accounts.<id>` key |
|
|
52
|
+
| `FEISHU_BOT_SCRIPT_PATH` | (resolved relative to bind-session.js) | Override when running from an unusual layout |
|
|
53
|
+
| `FEISHU_BOT_PYTHON_BIN` | `python3` | Path to the Python interpreter |
|
|
54
|
+
|
|
55
|
+
## Concurrency
|
|
56
|
+
|
|
57
|
+
The script hard-codes one CDP port and one profile dir, so only one
|
|
58
|
+
session can run on a bridge at a time. bind-session.ts enforces this with
|
|
59
|
+
a process-level lock; concurrent starts return `409 conflict_session_busy`.
|
|
60
|
+
|
|
61
|
+
## Image dependencies
|
|
62
|
+
|
|
63
|
+
`docker/bridge-node.Dockerfile` installs `python3 + playwright +
|
|
64
|
+
chromium` in the final stage so the script is ready to run on container
|
|
65
|
+
start with no first-request latency. See that file for the full apt /
|
|
66
|
+
pip / playwright install sequence.
|
|
Binary file
|