orynacode-ai 1.16.11 → 1.16.13
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 +8 -0
- package/src/provider/provider.ts +4 -3
package/package.json
CHANGED
package/src/oryna/agent.ts
CHANGED
|
@@ -3,6 +3,14 @@ import { setAgentStatus, agentStatus } from "./agent-signal"
|
|
|
3
3
|
import os from "os"
|
|
4
4
|
import path from "path"
|
|
5
5
|
|
|
6
|
+
export function getOrynaGateId(dir: string): string {
|
|
7
|
+
try {
|
|
8
|
+
const config = JSON.parse(readFileSync(path.join(dir, ".orynagate"), "utf-8"))
|
|
9
|
+
if (config.id && typeof config.id === "string") return config.id
|
|
10
|
+
} catch {}
|
|
11
|
+
return path.basename(dir)
|
|
12
|
+
}
|
|
13
|
+
|
|
6
14
|
export function setReady(ready: boolean) {
|
|
7
15
|
const s = agentStatus()
|
|
8
16
|
setAgentStatus({ ...s, ready })
|
package/src/provider/provider.ts
CHANGED
|
@@ -7,6 +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 { getOrynaGateId } from "../oryna/agent"
|
|
10
11
|
import { Plugin } from "../plugin"
|
|
11
12
|
import { serviceUse } from "@opencode-ai/core/effect/service-use"
|
|
12
13
|
import { type LanguageModelV3 } from "@ai-sdk/provider"
|
|
@@ -1687,9 +1688,9 @@ export const layer = Layer.effect(
|
|
|
1687
1688
|
if (baseURL !== undefined) options["baseURL"] = baseURL
|
|
1688
1689
|
if (options["apiKey"] === undefined && provider.key) options["apiKey"] = provider.key
|
|
1689
1690
|
if (model.providerID === "orynagate") {
|
|
1690
|
-
const
|
|
1691
|
+
const id = getOrynaGateId(process.cwd())
|
|
1691
1692
|
const user = os.userInfo().username || "user"
|
|
1692
|
-
options["apiKey"] = `sk-local-${user}-${
|
|
1693
|
+
options["apiKey"] = `sk-local-${user}-${id}`
|
|
1693
1694
|
}
|
|
1694
1695
|
if (model.headers)
|
|
1695
1696
|
options["headers"] = {
|
|
@@ -1834,7 +1835,7 @@ export const layer = Layer.effect(
|
|
|
1834
1835
|
const s = yield* InstanceState.get(state)
|
|
1835
1836
|
const envs = yield* env.all()
|
|
1836
1837
|
const key = `${model.providerID}/${model.id}`
|
|
1837
|
-
if (s.models.has(key)) return s.models.get(key)!
|
|
1838
|
+
if (s.models.has(key) && model.providerID !== "orynagate") return s.models.get(key)!
|
|
1838
1839
|
|
|
1839
1840
|
const provider = s.providers[model.providerID]
|
|
1840
1841
|
return yield* EffectPromise.refineRejection(
|