@timefly/opencode-plugin 0.2.8 → 0.2.10
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 +13 -15
- package/dist/cli.js +0 -0
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +5 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -104,26 +104,24 @@ OpenCode plugins run inside the OpenCode process. There is no built-in TimeFly U
|
|
|
104
104
|
|
|
105
105
|
## How sync works
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
The SDK batches OpenCode events before sending them to TimeFly. This keeps VPS load predictable as usage grows.
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
| Setting | Default | Behavior |
|
|
110
|
+
|---------|---------|----------|
|
|
111
|
+
| Debounce | 5s | Flush pending events 5 seconds after the last event in a burst |
|
|
112
|
+
| Max batch | 50 events | Flush immediately when the in-memory buffer is full |
|
|
113
|
+
| Immediate flush | `session_end` | Session totals are sent right away |
|
|
110
114
|
|
|
111
|
-
|
|
112
|
-
|---------|----------------|
|
|
113
|
-
| LLM request (`chat.params`) | Immediate sync attempt |
|
|
114
|
-
| Assistant turn completes | Immediate sync attempt |
|
|
115
|
-
| Tool call / result | Immediate sync attempt |
|
|
116
|
-
| Session start / end | Immediate sync attempt |
|
|
117
|
-
| Next event after failure | Retries queued events first, then sends new ones |
|
|
115
|
+
Typical flow during a coding session:
|
|
118
116
|
|
|
119
|
-
|
|
117
|
+
1. You send a prompt → `llm_request` is queued
|
|
118
|
+
2. Model responds → `turn_complete`, tool events, etc. join the same batch
|
|
119
|
+
3. After ~5s idle (or 50 events), one gzip `POST /ai/sync` sends the batch
|
|
120
|
+
4. `session_end` flushes immediately so session totals are not delayed
|
|
120
121
|
|
|
121
|
-
|
|
122
|
-
2. Model responds → `turn_complete` + `llm_response` sync (~instant when turn finishes)
|
|
123
|
-
3. Agent runs tools → each `tool_call` / `tool_result` syncs
|
|
124
|
-
4. Session goes idle → `session_end` with session totals syncs
|
|
122
|
+
Compared with the old per-event sync model, one active agent turn usually produces **1–2 HTTP requests** instead of **10–15+**.
|
|
125
123
|
|
|
126
|
-
|
|
124
|
+
Unlike the VS Code extension (timer every ~2 minutes), OpenCode still syncs in near real time — just batched within each active burst.
|
|
127
125
|
|
|
128
126
|
### What each sync request does
|
|
129
127
|
|
package/dist/cli.js
CHANGED
|
File without changes
|
package/dist/install.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":";AA6JA,eAAO,MAAM,UAAU,GAAI,eAAe,MAAM,EAAE,KAAG,OAAO,CAAC,IAAI,CAGhE,CAAA"}
|
package/dist/install.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { mkdir, readFile, rm, writeFile } from 'node:fs/promises';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import { resolveDefaultAuthFilePath } from '@timefly/ai-sdk';
|
|
5
|
+
import { resolveDefaultAuthFilePath, parseJsonText } from '@timefly/ai-sdk';
|
|
6
6
|
const PLUGIN_PACKAGE_LATEST = '@timefly/opencode-plugin@latest';
|
|
7
7
|
const TIMEFLY_PLUGIN_PATTERN = /^@timefly\/opencode-plugin(?:@|$)/;
|
|
8
8
|
const PRICING_URL = 'https://timefly.dev/pricing';
|
|
@@ -54,11 +54,14 @@ const clearOpenCodePluginCache = () => {
|
|
|
54
54
|
.catch(() => undefined);
|
|
55
55
|
};
|
|
56
56
|
const readConfigFile = (configPath) => readFile(configPath, 'utf8')
|
|
57
|
-
.then((configContent) =>
|
|
57
|
+
.then((configContent) => parseJsonText(configContent, {}))
|
|
58
58
|
.catch((error) => {
|
|
59
59
|
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
|
|
60
60
|
return {};
|
|
61
61
|
}
|
|
62
|
+
if (error instanceof SyntaxError) {
|
|
63
|
+
throw new Error(`Invalid OpenCode config at ${configPath}. If you edited it with PowerShell, remove the UTF-8 BOM or delete the file and run setup-opencode again.`);
|
|
64
|
+
}
|
|
62
65
|
throw error;
|
|
63
66
|
});
|
|
64
67
|
const resolvePluginEntry = (options) => options.useLocalPath ? localPluginPath.replaceAll('\\', '/') : PLUGIN_PACKAGE_LATEST;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@timefly/opencode-plugin",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.10",
|
|
4
4
|
"description": "TimeFly telemetry plugin for OpenCode — sessions, tokens, models, and tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": "./dist/cli.js",
|
|
@@ -50,14 +50,14 @@
|
|
|
50
50
|
},
|
|
51
51
|
"license": "MIT",
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@timefly/ai-sdk": "^0.2.
|
|
53
|
+
"@timefly/ai-sdk": "^0.2.3"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@opencode-ai/plugin": ">=1.0.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@opencode-ai/plugin": "^1.17.7",
|
|
60
|
-
"@timefly/ai-sdk": "
|
|
60
|
+
"@timefly/ai-sdk": "workspace:*",
|
|
61
61
|
"@types/bun": "^1.3.14",
|
|
62
62
|
"@types/node": "^22.15.21",
|
|
63
63
|
"typescript": "^5.9.3"
|