opencode-sync-plugin 0.3.5 → 0.3.6

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 +1 -1
  2. package/dist/index.js +18 -31
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -4,7 +4,7 @@ Sync your OpenCode sessions to the cloud. Search, share, and access your coding
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/opencode-sync-plugin.svg)](https://www.npmjs.com/package/opencode-sync-plugin)
6
6
 
7
- ## OpenSync Ecosystem link
7
+ ## OpenSync Ecosystem
8
8
 
9
9
  | Package | Description | Links |
10
10
  |---------|-------------|-------|
package/dist/index.js CHANGED
@@ -202,39 +202,26 @@ var OpenCodeSyncPlugin = async ({ client }) => {
202
202
  syncedSessions.add(sessionId);
203
203
  }
204
204
  if (event.type === "session.idle") {
205
- const localData = getLocalSessionData(sessionId);
206
- if (localData) {
207
- doSyncSession({
208
- ...props,
209
- title: localData.title || props?.title,
210
- slug: localData.slug || props?.slug,
211
- modelID: localData.model || props?.modelID,
212
- providerID: localData.provider || props?.providerID,
213
- tokens: {
214
- input: localData.promptTokens || 0,
215
- output: localData.completionTokens || 0
216
- },
217
- cost: localData.cost || 0
218
- });
219
- return;
220
- }
221
- if (client) {
222
- try {
223
- const response = await client.session.get({
224
- path: { id: sessionId }
205
+ setTimeout(() => {
206
+ const localData = getLocalSessionData(sessionId);
207
+ if (localData && (localData.title || localData.slug)) {
208
+ doSyncSession({
209
+ ...props,
210
+ title: localData.title || props?.title,
211
+ slug: localData.slug || props?.slug,
212
+ modelID: localData.model || props?.modelID,
213
+ providerID: localData.provider || props?.providerID,
214
+ tokens: {
215
+ input: localData.promptTokens || 0,
216
+ output: localData.completionTokens || 0
217
+ },
218
+ cost: localData.cost || 0
225
219
  });
226
- const sessionData = response?.data || response;
227
- if (sessionData?.title || sessionData?.slug) {
228
- doSyncSession({
229
- ...props,
230
- title: sessionData.title,
231
- slug: sessionData.slug
232
- });
233
- return;
234
- }
235
- } catch {
220
+ } else {
221
+ doSyncSession(props);
236
222
  }
237
- }
223
+ }, 1e3);
224
+ return;
238
225
  }
239
226
  doSyncSession(props);
240
227
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-sync-plugin",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "Sync your OpenCode sessions to the OpenSync dashboard",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",