orynacode-ai 1.16.19 → 1.16.20
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/oryna/agent.ts +12 -2
- package/src/provider/provider.ts +2 -4
package/package.json
CHANGED
package/src/oryna/agent.ts
CHANGED
|
@@ -6,11 +6,22 @@ import path from "path"
|
|
|
6
6
|
export function getOrynaGateId(dir: string): string {
|
|
7
7
|
try {
|
|
8
8
|
const config = JSON.parse(readFileSync(path.join(dir, ".orynagate"), "utf-8"))
|
|
9
|
+
if (config.ticket) return config.ticket
|
|
9
10
|
if (config.id && typeof config.id === "string") return config.id
|
|
10
11
|
} catch {}
|
|
11
12
|
return path.basename(dir)
|
|
12
13
|
}
|
|
13
14
|
|
|
15
|
+
export function getOrynaGateKey(dir: string): string {
|
|
16
|
+
const user = os.userInfo().username || "user"
|
|
17
|
+
try {
|
|
18
|
+
const config = JSON.parse(readFileSync(path.join(dir, ".orynagate"), "utf-8"))
|
|
19
|
+
if (config.ticket) return `sk-ticket-${user}-${config.ticket}`
|
|
20
|
+
if (config.id && typeof config.id === "string") return `sk-local-${user}-${config.id}`
|
|
21
|
+
} catch {}
|
|
22
|
+
return `sk-local-${user}-${path.basename(dir)}`
|
|
23
|
+
}
|
|
24
|
+
|
|
14
25
|
export function setReady(ready: boolean) {
|
|
15
26
|
const s = agentStatus()
|
|
16
27
|
setAgentStatus({ ...s, ready })
|
|
@@ -67,8 +78,7 @@ export function start() {
|
|
|
67
78
|
if (!url) return
|
|
68
79
|
|
|
69
80
|
const host = new URL(url).host
|
|
70
|
-
const
|
|
71
|
-
const token = `sk-local-${user}-${path.basename(process.env.ORYNA_GATE_WORKSPACE || process.cwd())}`
|
|
81
|
+
const token = getOrynaGateKey(process.env.ORYNA_GATE_WORKSPACE || process.cwd())
|
|
72
82
|
const wsUrl = `ws://${host}/ws?token=${token}&name=orynacode`
|
|
73
83
|
|
|
74
84
|
const connect = () => {
|
package/src/provider/provider.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { NoSuchModelError, type Provider as SDK } from "ai"
|
|
|
7
7
|
import { Log } from "@opencode-ai/core/util/log"
|
|
8
8
|
import { Npm } from "@opencode-ai/core/npm"
|
|
9
9
|
import { Hash } from "@opencode-ai/core/util/hash"
|
|
10
|
-
import {
|
|
10
|
+
import { getOrynaGateKey } from "../oryna/agent"
|
|
11
11
|
import { Plugin } from "../plugin"
|
|
12
12
|
import { serviceUse } from "@opencode-ai/core/effect/service-use"
|
|
13
13
|
import { type LanguageModelV3 } from "@ai-sdk/provider"
|
|
@@ -1688,9 +1688,7 @@ export const layer = Layer.effect(
|
|
|
1688
1688
|
if (baseURL !== undefined) options["baseURL"] = baseURL
|
|
1689
1689
|
if (options["apiKey"] === undefined && provider.key) options["apiKey"] = provider.key
|
|
1690
1690
|
if (model.providerID === "orynagate") {
|
|
1691
|
-
|
|
1692
|
-
const user = os.userInfo().username || "user"
|
|
1693
|
-
options["apiKey"] = `sk-local-${user}-${id}`
|
|
1691
|
+
options["apiKey"] = getOrynaGateKey(process.env.ORYNA_GATE_WORKSPACE || process.cwd())
|
|
1694
1692
|
}
|
|
1695
1693
|
if (model.headers)
|
|
1696
1694
|
options["headers"] = {
|