snow-flow 10.0.106 → 10.0.108
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/package.json +1 -1
- package/src/installation/index.ts +12 -1
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BusEvent } from "@/bus/bus-event"
|
|
2
2
|
import path from "path"
|
|
3
|
+
import fs from "fs"
|
|
3
4
|
import { $ } from "bun"
|
|
4
5
|
import z from "zod"
|
|
5
6
|
import { NamedError } from "@opencode-ai/util/error"
|
|
@@ -187,7 +188,17 @@ export namespace Installation {
|
|
|
187
188
|
await $`${process.execPath} --version`.nothrow().quiet().text()
|
|
188
189
|
}
|
|
189
190
|
|
|
190
|
-
|
|
191
|
+
function readPackageVersion(): string {
|
|
192
|
+
try {
|
|
193
|
+
const pkgPath = path.resolve(import.meta.dir, "../../package.json")
|
|
194
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"))
|
|
195
|
+
return pkg.version || "local"
|
|
196
|
+
} catch {
|
|
197
|
+
return "local"
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export const VERSION = typeof OPENCODE_VERSION === "string" ? OPENCODE_VERSION : readPackageVersion()
|
|
191
202
|
export const CHANNEL = typeof OPENCODE_CHANNEL === "string" ? OPENCODE_CHANNEL : "local"
|
|
192
203
|
export const USER_AGENT = `snow-code/${CHANNEL}/${VERSION}/${Flag.OPENCODE_CLIENT}`
|
|
193
204
|
|