opencode-sync-plugin 0.3.2 → 0.3.3

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 (3) hide show
  1. package/README.md +41 -1
  2. package/dist/index.js +21 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -31,6 +31,44 @@ npm install
31
31
  npm run build
32
32
  ```
33
33
 
34
+ ## Upgrading
35
+
36
+ To upgrade to the latest version of the plugin:
37
+
38
+ **Using npm:**
39
+
40
+ ```bash
41
+ npm update -g opencode-sync-plugin
42
+ ```
43
+
44
+ **Or reinstall to get the latest:**
45
+
46
+ ```bash
47
+ npm install -g opencode-sync-plugin@latest
48
+ ```
49
+
50
+ **Clear the OpenCode plugin cache** (required for OpenCode to pick up the new version):
51
+
52
+ ```bash
53
+ rm -rf ~/.cache/opencode/node_modules/opencode-sync-plugin
54
+ ```
55
+
56
+ **Restart OpenCode** to load the updated plugin.
57
+
58
+ **Check your installed version:**
59
+
60
+ ```bash
61
+ opencode-sync version
62
+ ```
63
+
64
+ **Backfill existing sessions with proper titles** (if upgrading from v0.3.2 or earlier):
65
+
66
+ ```bash
67
+ opencode-sync sync --force
68
+ ```
69
+
70
+ This re-syncs all local sessions with accurate titles from OpenCode's local storage.
71
+
34
72
  ## Setup
35
73
 
36
74
  ### 1. Get your credentials
@@ -112,10 +150,12 @@ The plugin hooks into OpenCode events and syncs data automatically:
112
150
  |-------|--------|
113
151
  | `session.created` | Creates session record in cloud |
114
152
  | `session.updated` | Updates session metadata |
115
- | `session.idle` | Final sync with token counts and cost |
153
+ | `session.idle` | Final sync with accurate title, token counts, and cost |
116
154
  | `message.updated` | Syncs user and assistant messages |
117
155
  | `message.part.updated` | Syncs completed message parts |
118
156
 
157
+ On `session.idle`, the plugin queries OpenCode's SDK to get the accurate session title (generated after the first message exchange). This ensures sessions are stored with meaningful titles instead of "Untitled".
158
+
119
159
  Data is stored in your Convex deployment. You can view, search, and share sessions via the web UI.
120
160
 
121
161
  ## CLI Commands
package/dist/index.js CHANGED
@@ -55,7 +55,7 @@ function doSyncSession(session) {
55
55
  },
56
56
  body: JSON.stringify({
57
57
  externalId: session.id,
58
- title: session.title || "Untitled Session",
58
+ title: session.title || session.slug || "Untitled Session",
59
59
  projectPath,
60
60
  projectName: projectPath?.split("/").pop(),
61
61
  model: modelId,
@@ -132,7 +132,7 @@ function scheduleSyncMessage(messageId) {
132
132
  }, DEBOUNCE_MS);
133
133
  syncTimeouts.set(messageId, timeout);
134
134
  }
135
- var OpenCodeSyncPlugin = async () => {
135
+ var OpenCodeSyncPlugin = async ({ client }) => {
136
136
  return {
137
137
  event: async ({ event }) => {
138
138
  try {
@@ -144,6 +144,25 @@ var OpenCodeSyncPlugin = async () => {
144
144
  if (syncedSessions.has(sessionId)) return;
145
145
  syncedSessions.add(sessionId);
146
146
  }
147
+ if (event.type === "session.idle" && client) {
148
+ try {
149
+ const response = await client.session.get({
150
+ path: { id: sessionId }
151
+ });
152
+ const sessionData = response?.data || response;
153
+ const title = sessionData?.title;
154
+ const slug = sessionData?.slug;
155
+ if (title || slug) {
156
+ doSyncSession({
157
+ ...props,
158
+ title,
159
+ slug
160
+ });
161
+ return;
162
+ }
163
+ } catch {
164
+ }
165
+ }
147
166
  doSyncSession(props);
148
167
  }
149
168
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-sync-plugin",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "Sync your OpenCode sessions to the OpenSync dashboard",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",