Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions apps/app/src/app/lib/den.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export type DenOrgLlmProviderModel = {

export type DenOrgLlmProvider = {
id: string;
source: "models_dev" | "custom";
source: "models_dev" | "custom" | "openwork";
providerId: string;
name: string;
providerConfig: Record<string, unknown>;
Expand Down Expand Up @@ -868,7 +868,9 @@ function parseDenOrgLlmProvider(value: unknown): DenOrgLlmProvider | null {
typeof value.id !== "string" ||
typeof value.providerId !== "string" ||
typeof value.name !== "string" ||
(value.source !== "models_dev" && value.source !== "custom")
(value.source !== "models_dev" &&
value.source !== "custom" &&
value.source !== "openwork")
) {
return null;
}
Expand Down
36 changes: 34 additions & 2 deletions apps/desktop/electron/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -726,10 +726,15 @@ function normalizeDesktopBootstrapConfig(input) {
}

async function getDesktopBootstrapConfig() {
const configPath = desktopBootstrapPath();
try {
const raw = await readFile(desktopBootstrapPath(), "utf8");
const raw = await readFile(configPath, "utf8");
return normalizeDesktopBootstrapConfig(JSON.parse(raw));
} catch {
} catch (error) {
console.warn("[desktop-bootstrap] falling back to defaults", {
path: configPath,
error: error instanceof Error ? error.message : String(error),
});
return {
baseUrl: DEFAULT_DEN_BASE_URL,
apiBaseUrl: null,
Expand All @@ -738,6 +743,31 @@ async function getDesktopBootstrapConfig() {
}
}

async function debugDesktopBootstrapConfig() {
const configPath = desktopBootstrapPath();
const result = {
path: configPath,
home: os.homedir(),
envHome: process.env.HOME ?? null,
envOverride: process.env.OPENWORK_DESKTOP_BOOTSTRAP_PATH ?? null,
exists: existsSync(configPath),
raw: null,
parsed: null,
normalized: null,
error: null,
};

try {
result.raw = await readFile(configPath, "utf8");
result.parsed = JSON.parse(result.raw);
result.normalized = normalizeDesktopBootstrapConfig(result.parsed);
} catch (error) {
result.error = error instanceof Error ? error.message : String(error);
}

return result;
}

async function setDesktopBootstrapConfig(config) {
const normalized = normalizeDesktopBootstrapConfig(config);
const outputPath = desktopBootstrapPath();
Expand Down Expand Up @@ -1776,6 +1806,8 @@ async function handleDesktopInvoke(event, command, ...args) {
}
case "getDesktopBootstrapConfig":
return getDesktopBootstrapConfig();
case "debugDesktopBootstrapConfig":
return debugDesktopBootstrapConfig();
case "setDesktopBootstrapConfig":
return setDesktopBootstrapConfig(args[0] ?? {});
case "nukeOpenworkAndOpencodeConfigAndExit": {
Expand Down
4 changes: 4 additions & 0 deletions ee/apps/den-api/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ POLAR_RETURN_URL=
DAYTONA_API_KEY=
DAYTONA_API_URL=https://app.daytona.io/api
OPENWORK_DEV_MODE=1


OPENROUTER_MANAGEMENT_API_KEY=
OPENROUTER_WORKSPACE_ID=
6 changes: 6 additions & 0 deletions ee/apps/den-api/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ const EnvSchema = z.object({
DAYTONA_CREATE_TIMEOUT_SECONDS: z.string().optional(),
DAYTONA_DELETE_TIMEOUT_SECONDS: z.string().optional(),
DAYTONA_HEALTHCHECK_TIMEOUT_MS: z.string().optional(),
INFERENCE_PROXY_BASE_URL: z.string().optional(),
OPENROUTER_MANAGEMENT_API_KEY: z.string().optional(),
OPENROUTER_WORKSPACE_ID: z.string().optional(),
}).superRefine((value, ctx) => {
const inferredMode = value.DB_MODE ?? (value.DATABASE_URL ? "mysql" : "planetscale")

Expand Down Expand Up @@ -212,6 +215,9 @@ export const env = {
workerActivityBaseUrl:
optionalString(parsed.WORKER_ACTIVITY_BASE_URL) ??
parsed.BETTER_AUTH_URL.trim().replace(/\/+$/, ""),
inferenceProxyBaseUrl: optionalString(parsed.INFERENCE_PROXY_BASE_URL) ?? "http://127.0.0.1:8791",
openRouterManagementApiKey: optionalString(parsed.OPENROUTER_MANAGEMENT_API_KEY),
openRouterWorkspaceId: optionalString(parsed.OPENROUTER_WORKSPACE_ID),
render: {
apiBase: parsed.RENDER_API_BASE ?? "https://api.render.com/v1",
apiKey: parsed.RENDER_API_KEY,
Expand Down
2 changes: 1 addition & 1 deletion ee/apps/den-api/src/generated/app-version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const BUILD_LATEST_APP_VERSION = "0.11.212" as const
export const BUILD_LATEST_APP_VERSION = "0.13.7" as const
Loading
Loading