summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFrank <[email protected]>2026-01-30 12:19:36 -0500
committerGitHub <[email protected]>2026-01-30 12:19:36 -0500
commit7cb84f13d3b73c6bd6e6f7949bb952da1af3f2be (patch)
tree5374a7eb115c43478e925f25d8e64b7d2167787f
parent1aade4b30817b8ecd2edb708737ed554879c2f28 (diff)
downloadopencode-7cb84f13d3b73c6bd6e6f7949bb952da1af3f2be.tar.gz
opencode-7cb84f13d3b73c6bd6e6f7949bb952da1af3f2be.zip
wip: zen (#11343)
-rw-r--r--infra/console.ts2
-rwxr-xr-xpackages/console/core/script/promote-models.ts11
-rwxr-xr-xpackages/console/core/script/pull-models.ts11
-rwxr-xr-xpackages/console/core/script/update-models.ts16
-rw-r--r--packages/console/core/src/model.ts4
-rw-r--r--packages/console/core/sst-env.d.ts8
-rw-r--r--packages/console/function/sst-env.d.ts8
-rw-r--r--packages/console/resource/sst-env.d.ts8
-rw-r--r--packages/enterprise/sst-env.d.ts8
-rw-r--r--packages/function/sst-env.d.ts8
-rw-r--r--sst-env.d.ts8
11 files changed, 74 insertions, 18 deletions
diff --git a/infra/console.ts b/infra/console.ts
index 5b08e9cea..ba1ff15bf 100644
--- a/infra/console.ts
+++ b/infra/console.ts
@@ -133,6 +133,8 @@ const ZEN_MODELS = [
new sst.Secret("ZEN_MODELS6"),
new sst.Secret("ZEN_MODELS7"),
new sst.Secret("ZEN_MODELS8"),
+ new sst.Secret("ZEN_MODELS9"),
+ new sst.Secret("ZEN_MODELS10"),
]
const STRIPE_SECRET_KEY = new sst.Secret("STRIPE_SECRET_KEY")
const STRIPE_PUBLISHABLE_KEY = new sst.Secret("STRIPE_PUBLISHABLE_KEY")
diff --git a/packages/console/core/script/promote-models.ts b/packages/console/core/script/promote-models.ts
index bc57fc5bb..9a9b2dcad 100755
--- a/packages/console/core/script/promote-models.ts
+++ b/packages/console/core/script/promote-models.ts
@@ -2,20 +2,21 @@
import { $ } from "bun"
import path from "path"
+import os from "os"
import { ZenData } from "../src/model"
const stage = process.argv[2]
if (!stage) throw new Error("Stage is required")
const root = path.resolve(process.cwd(), "..", "..", "..")
-const PARTS = 8
+const PARTS = 10
// read the secret
const ret = await $`bun sst secret list`.cwd(root).text()
const lines = ret.split("\n")
const values = Array.from({ length: PARTS }, (_, i) => {
const value = lines
- .find((line) => line.startsWith(`ZEN_MODELS${i + 1}`))
+ .find((line) => line.startsWith(`ZEN_MODELS${i + 1}=`))
?.split("=")
.slice(1)
.join("=")
@@ -27,6 +28,6 @@ const values = Array.from({ length: PARTS }, (_, i) => {
ZenData.validate(JSON.parse(values.join("")))
// update the secret
-for (let i = 0; i < PARTS; i++) {
- await $`bun sst secret set ZEN_MODELS${i + 1} --stage ${stage} -- ${values[i]}`
-}
+const envFile = Bun.file(path.join(os.tmpdir(), `models-${Date.now()}.env`))
+await envFile.write(values.map((v, i) => `ZEN_MODELS${i + 1}=${v}`).join("\n"))
+await $`bun sst secret load ${envFile.name} --stage ${stage}`.cwd(root)
diff --git a/packages/console/core/script/pull-models.ts b/packages/console/core/script/pull-models.ts
index f360b8186..6e89f602b 100755
--- a/packages/console/core/script/pull-models.ts
+++ b/packages/console/core/script/pull-models.ts
@@ -2,20 +2,21 @@
import { $ } from "bun"
import path from "path"
+import os from "os"
import { ZenData } from "../src/model"
const stage = process.argv[2]
if (!stage) throw new Error("Stage is required")
const root = path.resolve(process.cwd(), "..", "..", "..")
-const PARTS = 8
+const PARTS = 10
// read the secret
const ret = await $`bun sst secret list --stage ${stage}`.cwd(root).text()
const lines = ret.split("\n")
const values = Array.from({ length: PARTS }, (_, i) => {
const value = lines
- .find((line) => line.startsWith(`ZEN_MODELS${i + 1}`))
+ .find((line) => line.startsWith(`ZEN_MODELS${i + 1}=`))
?.split("=")
.slice(1)
.join("=")
@@ -27,6 +28,6 @@ const values = Array.from({ length: PARTS }, (_, i) => {
ZenData.validate(JSON.parse(values.join("")))
// update the secret
-for (let i = 0; i < PARTS; i++) {
- await $`bun sst secret set ZEN_MODELS${i + 1} -- ${values[i]}`
-}
+const envFile = Bun.file(path.join(os.tmpdir(), `models-${Date.now()}.env`))
+await envFile.write(values.map((v, i) => `ZEN_MODELS${i + 1}=${v}`).join("\n"))
+await $`bun sst secret load ${envFile.name}`.cwd(root)
diff --git a/packages/console/core/script/update-models.ts b/packages/console/core/script/update-models.ts
index 56940af25..3085353a7 100755
--- a/packages/console/core/script/update-models.ts
+++ b/packages/console/core/script/update-models.ts
@@ -7,18 +7,20 @@ import { ZenData } from "../src/model"
const root = path.resolve(process.cwd(), "..", "..", "..")
const models = await $`bun sst secret list`.cwd(root).text()
-const PARTS = 8
+const PARTS = 10
// read the line starting with "ZEN_MODELS"
const lines = models.split("\n")
const oldValues = Array.from({ length: PARTS }, (_, i) => {
const value = lines
- .find((line) => line.startsWith(`ZEN_MODELS${i + 1}`))
+ .find((line) => line.startsWith(`ZEN_MODELS${i + 1}=`))
?.split("=")
.slice(1)
.join("=")
- if (!value) throw new Error(`ZEN_MODELS${i + 1} not found`)
- return value
+ // TODO
+ //if (!value) throw new Error(`ZEN_MODELS${i + 1} not found`)
+ //return value
+ return value ?? ""
})
// store the prettified json to a temp file
@@ -38,6 +40,6 @@ const newValues = Array.from({ length: PARTS }, (_, i) =>
newValue.slice(chunk * i, i === PARTS - 1 ? undefined : chunk * (i + 1)),
)
-for (let i = 0; i < PARTS; i++) {
- await $`bun sst secret set ZEN_MODELS${i + 1} -- ${newValues[i]}`
-}
+const envFile = Bun.file(path.join(os.tmpdir(), `models-${Date.now()}.env`))
+await envFile.write(newValues.map((v, i) => `ZEN_MODELS${i + 1}=${v}`).join("\n"))
+await $`bun sst secret load ${envFile.name}`.cwd(root)
diff --git a/packages/console/core/src/model.ts b/packages/console/core/src/model.ts
index 0fd8bdecf..880c63a19 100644
--- a/packages/console/core/src/model.ts
+++ b/packages/console/core/src/model.ts
@@ -75,7 +75,9 @@ export namespace ZenData {
Resource.ZEN_MODELS5.value +
Resource.ZEN_MODELS6.value +
Resource.ZEN_MODELS7.value +
- Resource.ZEN_MODELS8.value,
+ Resource.ZEN_MODELS8.value +
+ Resource.ZEN_MODELS9.value +
+ Resource.ZEN_MODELS10.value,
)
return ModelsSchema.parse(json)
})
diff --git a/packages/console/core/sst-env.d.ts b/packages/console/core/sst-env.d.ts
index cb4902813..0769c7633 100644
--- a/packages/console/core/sst-env.d.ts
+++ b/packages/console/core/sst-env.d.ts
@@ -133,6 +133,10 @@ declare module "sst" {
"type": "sst.sst.Secret"
"value": string
}
+ "ZEN_MODELS10": {
+ "type": "sst.sst.Secret"
+ "value": string
+ }
"ZEN_MODELS2": {
"type": "sst.sst.Secret"
"value": string
@@ -161,6 +165,10 @@ declare module "sst" {
"type": "sst.sst.Secret"
"value": string
}
+ "ZEN_MODELS9": {
+ "type": "sst.sst.Secret"
+ "value": string
+ }
"ZEN_SESSION_SECRET": {
"type": "sst.sst.Secret"
"value": string
diff --git a/packages/console/function/sst-env.d.ts b/packages/console/function/sst-env.d.ts
index cb4902813..0769c7633 100644
--- a/packages/console/function/sst-env.d.ts
+++ b/packages/console/function/sst-env.d.ts
@@ -133,6 +133,10 @@ declare module "sst" {
"type": "sst.sst.Secret"
"value": string
}
+ "ZEN_MODELS10": {
+ "type": "sst.sst.Secret"
+ "value": string
+ }
"ZEN_MODELS2": {
"type": "sst.sst.Secret"
"value": string
@@ -161,6 +165,10 @@ declare module "sst" {
"type": "sst.sst.Secret"
"value": string
}
+ "ZEN_MODELS9": {
+ "type": "sst.sst.Secret"
+ "value": string
+ }
"ZEN_SESSION_SECRET": {
"type": "sst.sst.Secret"
"value": string
diff --git a/packages/console/resource/sst-env.d.ts b/packages/console/resource/sst-env.d.ts
index cb4902813..0769c7633 100644
--- a/packages/console/resource/sst-env.d.ts
+++ b/packages/console/resource/sst-env.d.ts
@@ -133,6 +133,10 @@ declare module "sst" {
"type": "sst.sst.Secret"
"value": string
}
+ "ZEN_MODELS10": {
+ "type": "sst.sst.Secret"
+ "value": string
+ }
"ZEN_MODELS2": {
"type": "sst.sst.Secret"
"value": string
@@ -161,6 +165,10 @@ declare module "sst" {
"type": "sst.sst.Secret"
"value": string
}
+ "ZEN_MODELS9": {
+ "type": "sst.sst.Secret"
+ "value": string
+ }
"ZEN_SESSION_SECRET": {
"type": "sst.sst.Secret"
"value": string
diff --git a/packages/enterprise/sst-env.d.ts b/packages/enterprise/sst-env.d.ts
index cb4902813..0769c7633 100644
--- a/packages/enterprise/sst-env.d.ts
+++ b/packages/enterprise/sst-env.d.ts
@@ -133,6 +133,10 @@ declare module "sst" {
"type": "sst.sst.Secret"
"value": string
}
+ "ZEN_MODELS10": {
+ "type": "sst.sst.Secret"
+ "value": string
+ }
"ZEN_MODELS2": {
"type": "sst.sst.Secret"
"value": string
@@ -161,6 +165,10 @@ declare module "sst" {
"type": "sst.sst.Secret"
"value": string
}
+ "ZEN_MODELS9": {
+ "type": "sst.sst.Secret"
+ "value": string
+ }
"ZEN_SESSION_SECRET": {
"type": "sst.sst.Secret"
"value": string
diff --git a/packages/function/sst-env.d.ts b/packages/function/sst-env.d.ts
index cb4902813..0769c7633 100644
--- a/packages/function/sst-env.d.ts
+++ b/packages/function/sst-env.d.ts
@@ -133,6 +133,10 @@ declare module "sst" {
"type": "sst.sst.Secret"
"value": string
}
+ "ZEN_MODELS10": {
+ "type": "sst.sst.Secret"
+ "value": string
+ }
"ZEN_MODELS2": {
"type": "sst.sst.Secret"
"value": string
@@ -161,6 +165,10 @@ declare module "sst" {
"type": "sst.sst.Secret"
"value": string
}
+ "ZEN_MODELS9": {
+ "type": "sst.sst.Secret"
+ "value": string
+ }
"ZEN_SESSION_SECRET": {
"type": "sst.sst.Secret"
"value": string
diff --git a/sst-env.d.ts b/sst-env.d.ts
index 0b4cbffe2..2d60c83ec 100644
--- a/sst-env.d.ts
+++ b/sst-env.d.ts
@@ -159,6 +159,10 @@ declare module "sst" {
"type": "sst.sst.Secret"
"value": string
}
+ "ZEN_MODELS10": {
+ "type": "sst.sst.Secret"
+ "value": string
+ }
"ZEN_MODELS2": {
"type": "sst.sst.Secret"
"value": string
@@ -187,6 +191,10 @@ declare module "sst" {
"type": "sst.sst.Secret"
"value": string
}
+ "ZEN_MODELS9": {
+ "type": "sst.sst.Secret"
+ "value": string
+ }
"ZEN_SESSION_SECRET": {
"type": "sst.sst.Secret"
"value": string