openclaw-workspace-sync 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ash Brener
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,306 @@
1
+ # OpenClaw Workspace Cloud Sync Plugin
2
+
3
+ Bidirectional workspace sync between your OpenClaw agent and cloud storage via [rclone](https://rclone.org/).
4
+
5
+ Supports **Dropbox, Google Drive, OneDrive, S3/R2/Minio**, and [70+ cloud providers](https://rclone.org/overview/).
6
+
7
+ ## How it works
8
+
9
+ ```
10
+ Local Machine Cloud Provider Remote Gateway
11
+ ~/Dropbox/openclaw/ <-> Dropbox/GDrive/etc <-> <workspace>/shared/
12
+ (native app) (any provider) (rclone bisync)
13
+ ```
14
+
15
+ - **Local**: Native cloud app syncs `~/Dropbox/openclaw/` (or equivalent)
16
+ - **Remote**: rclone bisync keeps `<workspace>/shared/` in sync with the cloud
17
+ - **Result**: Drop a file locally, it appears on the remote Gateway (and vice versa)
18
+
19
+ **Zero LLM cost.** All sync operations are pure rclone file operations — they never wake the bot or trigger LLM calls.
20
+
21
+ ## Install
22
+
23
+ ```bash
24
+ openclaw plugins install @openclaw/workspace-sync
25
+ ```
26
+
27
+ Or clone into your extensions directory:
28
+
29
+ ```bash
30
+ cd ~/.openclaw/extensions
31
+ git clone https://github.com/ashbrener/openclaw-workspace-sync workspace-sync
32
+ cd workspace-sync && npm install --omit=dev
33
+ ```
34
+
35
+ ## Quick start
36
+
37
+ ```bash
38
+ # Interactive setup wizard (recommended)
39
+ openclaw workspace setup
40
+ ```
41
+
42
+ The setup wizard guides you through:
43
+ 1. Checking/installing rclone
44
+ 2. Selecting cloud provider
45
+ 3. Dropbox app folder option (for scoped access)
46
+ 4. Background sync interval
47
+ 5. OAuth authorization
48
+ 6. First sync
49
+
50
+ Or configure manually — see [Configuration](#configuration) below.
51
+
52
+ ## Configuration
53
+
54
+ Add to your `openclaw.json`:
55
+
56
+ ```json
57
+ {
58
+ "plugins": {
59
+ "entries": {
60
+ "workspace-sync": {
61
+ "enabled": true,
62
+ "config": {
63
+ "provider": "dropbox",
64
+ "remotePath": "openclaw-share",
65
+ "localPath": "shared",
66
+ "interval": 300,
67
+ "onSessionStart": true,
68
+ "onSessionEnd": false,
69
+ "conflictResolve": "newer",
70
+ "exclude": [".git/**", "node_modules/**", "*.log"]
71
+ }
72
+ }
73
+ }
74
+ }
75
+ }
76
+ ```
77
+
78
+ ### Config reference
79
+
80
+ | Key | Type | Default | Description |
81
+ |-----|------|---------|-------------|
82
+ | `provider` | string | `"off"` | `dropbox` \| `gdrive` \| `onedrive` \| `s3` \| `custom` \| `off` |
83
+ | `remotePath` | string | `"openclaw-share"` | Folder name in cloud storage |
84
+ | `localPath` | string | `"shared"` | Subfolder within workspace to sync |
85
+ | `interval` | number | `0` | Background sync interval in seconds (0 = manual only, min 60) |
86
+ | `onSessionStart` | boolean | `false` | Sync when an agent session begins |
87
+ | `onSessionEnd` | boolean | `false` | Sync when an agent session ends |
88
+ | `remoteName` | string | `"cloud"` | rclone remote name |
89
+ | `configPath` | string | auto | Path to rclone.conf |
90
+ | `conflictResolve` | string | `"newer"` | `newer` \| `local` \| `remote` |
91
+ | `exclude` | string[] | see below | Glob patterns to exclude |
92
+ | `copySymlinks` | boolean | `false` | Follow symlinks during sync |
93
+
94
+ Default excludes: `.git/**`, `node_modules/**`, `.venv/**`, `__pycache__/**`, `*.log`, `.DS_Store`
95
+
96
+ ### Provider-specific options
97
+
98
+ **Dropbox with app folder (recommended for security):**
99
+
100
+ ```json
101
+ {
102
+ "provider": "dropbox",
103
+ "remotePath": "",
104
+ "dropbox": {
105
+ "appFolder": true,
106
+ "appKey": "your-app-key",
107
+ "appSecret": "your-app-secret",
108
+ "token": "{\"access_token\":\"...\"}"
109
+ }
110
+ }
111
+ ```
112
+
113
+ **S3 / Cloudflare R2 / Minio:**
114
+
115
+ ```json
116
+ {
117
+ "provider": "s3",
118
+ "remotePath": "openclaw-sync",
119
+ "s3": {
120
+ "endpoint": "https://s3.us-east-1.amazonaws.com",
121
+ "bucket": "your-bucket",
122
+ "region": "us-east-1",
123
+ "accessKeyId": "AKID...",
124
+ "secretAccessKey": "SECRET..."
125
+ }
126
+ }
127
+ ```
128
+
129
+ ## CLI commands
130
+
131
+ ```bash
132
+ # Interactive setup wizard
133
+ openclaw workspace setup
134
+
135
+ # Check sync status
136
+ openclaw workspace status
137
+
138
+ # Sync bidirectionally
139
+ openclaw workspace sync
140
+
141
+ # First sync (required once to establish baseline)
142
+ openclaw workspace sync --resync
143
+
144
+ # Preview changes without syncing
145
+ openclaw workspace sync --dry-run
146
+
147
+ # One-way sync
148
+ openclaw workspace sync --direction pull # remote -> local
149
+ openclaw workspace sync --direction push # local -> remote
150
+
151
+ # Authorize with cloud provider
152
+ openclaw workspace authorize
153
+ openclaw workspace authorize --provider gdrive
154
+
155
+ # List remote files
156
+ openclaw workspace list
157
+ ```
158
+
159
+ ## Auto-sync
160
+
161
+ ### Session hooks
162
+
163
+ Sync automatically when sessions start or end. These run during existing agent activity and incur zero LLM cost:
164
+
165
+ ```json
166
+ {
167
+ "onSessionStart": true,
168
+ "onSessionEnd": false
169
+ }
170
+ ```
171
+
172
+ ### Periodic background sync
173
+
174
+ Set `interval` to enable automatic background sync (in seconds):
175
+
176
+ ```json
177
+ {
178
+ "interval": 300
179
+ }
180
+ ```
181
+
182
+ The gateway runs rclone bisync in the background at this interval. Minimum interval is 60 seconds.
183
+
184
+ ### External cron (alternative)
185
+
186
+ ```bash
187
+ # Add to crontab (crontab -e)
188
+ */5 * * * * openclaw workspace sync >> /var/log/openclaw-sync.log 2>&1
189
+ ```
190
+
191
+ ## Supported providers
192
+
193
+ | Provider | Config value | Auth method |
194
+ |----------|-------------|-------------|
195
+ | Dropbox | `dropbox` | OAuth token |
196
+ | Google Drive | `gdrive` | OAuth token |
197
+ | OneDrive | `onedrive` | OAuth token |
198
+ | S3/R2/Minio | `s3` | Access keys |
199
+ | Custom rclone | `custom` | Manual rclone config |
200
+
201
+ For the full list of 70+ providers, see [rclone overview](https://rclone.org/overview/).
202
+
203
+ ## Manual setup (without wizard)
204
+
205
+ ### 1. Install rclone
206
+
207
+ - **macOS**: `brew install rclone`
208
+ - **Linux**: `curl -s https://rclone.org/install.sh | sudo bash`
209
+ - **Docker**: `RUN curl -s https://rclone.org/install.sh | bash`
210
+
211
+ ### 2. Authorize rclone (from your local machine)
212
+
213
+ Run on a machine with a browser:
214
+
215
+ ```bash
216
+ rclone authorize "dropbox" # or: gdrive, onedrive
217
+ ```
218
+
219
+ Copy the JSON token it outputs.
220
+
221
+ ### 3. Configure on the Gateway
222
+
223
+ ```bash
224
+ mkdir -p ~/.openclaw/.config/rclone
225
+
226
+ cat > ~/.openclaw/.config/rclone/rclone.conf << 'EOF'
227
+ [cloud]
228
+ type = dropbox
229
+ token = {"access_token":"YOUR_TOKEN_HERE","token_type":"bearer","expiry":"..."}
230
+ EOF
231
+ ```
232
+
233
+ ### 4. First sync
234
+
235
+ ```bash
236
+ openclaw workspace sync --resync
237
+ ```
238
+
239
+ ## Dropbox app folder access (recommended)
240
+
241
+ For better security, create a scoped Dropbox app that only accesses a single folder:
242
+
243
+ 1. Go to [Dropbox App Console](https://www.dropbox.com/developers/apps)
244
+ 2. Click **Create app** > **Scoped access** > **App folder**
245
+ 3. Name it (e.g., `openclaw-sync`)
246
+ 4. In **Permissions** tab, enable:
247
+ - `files.metadata.read` / `files.metadata.write`
248
+ - `files.content.read` / `files.content.write`
249
+ 5. Copy **App key** and **App secret** from Settings
250
+
251
+ Benefits:
252
+ - Token only accesses one folder, not your entire Dropbox
253
+ - If token is compromised, blast radius is limited
254
+ - Clean separation — sync folder lives under `Apps/`
255
+
256
+ ## Troubleshooting
257
+
258
+ ### Token expired
259
+
260
+ ```bash
261
+ openclaw workspace authorize
262
+ ```
263
+
264
+ ### Conflicts
265
+
266
+ Files modified on both sides get `.conflict` suffix:
267
+
268
+ ```bash
269
+ find <workspace>/shared -name "*.conflict"
270
+ ```
271
+
272
+ ### First sync fails
273
+
274
+ ```bash
275
+ openclaw workspace sync --resync
276
+ ```
277
+
278
+ ### Permission errors
279
+
280
+ ```bash
281
+ chmod -R 755 <workspace>/shared
282
+ ```
283
+
284
+ ## Security notes
285
+
286
+ - **Token storage**: rclone tokens are stored in `rclone.conf` with `0600` permissions
287
+ - **Sensitive files**: Don't sync secrets, API keys, or credentials
288
+ - **Encryption**: Consider [rclone crypt](https://rclone.org/crypt/) for sensitive data
289
+ - **App folder**: Use Dropbox app folder access for minimal permissions
290
+
291
+ ## Development
292
+
293
+ ```bash
294
+ # Install dependencies
295
+ pnpm install
296
+
297
+ # Run tests
298
+ pnpm test
299
+
300
+ # Type check
301
+ pnpm tsgo --noEmit
302
+ ```
303
+
304
+ ## License
305
+
306
+ MIT
@@ -0,0 +1,21 @@
1
+ /**
2
+ * OpenClaw Workspace Sync Plugin
3
+ *
4
+ * Bidirectional workspace cloud sync via rclone.
5
+ * Supports Dropbox, Google Drive, S3, OneDrive, and 70+ providers.
6
+ *
7
+ * Features:
8
+ * - CLI commands: openclaw workspace sync/status/setup/authorize/list
9
+ * - Background periodic sync (pure rclone, zero LLM cost)
10
+ * - Session start/end hooks for automatic sync
11
+ * - Config-driven rclone setup (no manual rclone config needed)
12
+ */
13
+ import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
14
+ declare const workspaceSyncPlugin: {
15
+ id: string;
16
+ name: string;
17
+ description: string;
18
+ register(api: OpenClawPluginApi): void;
19
+ };
20
+ export default workspaceSyncPlugin;
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAyB7D,QAAA,MAAM,mBAAmB;;;;kBAMT,iBAAiB;CAmmBhC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}