🤖 Open-source, local-first alternative to Grok Bot, OpenAI dots and Claude Duet. Your own AI bots on any model: GPT, Claude, Gemini, Grok, DeepSeek, Kimi, GLM and 70+ more through one Modelflare key. Reach them in the app, WeChat or Feishu; they remember you, work in the background, run commands and use your computer. Pay per use.
Python ai-agentai-assistantchatbotclaudecomputer-usedeepseekdesktop-appdshelectronfeishugeminigptgrokllmlocal-firstmodelflaremulti-modelopenai-compatiblepersonal-ai-agentwechat
fix(agent): the agent process keeps the system time zone
Marla66634469fc0c
diff --git a/src/agent/host.ts b/src/agent/host.tsindex 3d944d6..aa6f03a 100644--- a/src/agent/host.ts+++ b/src/agent/host.ts@@ -554,7 +554,6 @@ exec "$REAL" "$@"AMB_ALLOW_READ: JSON.stringify([path.resolve(this.workspace), path.resolve(this.home)]),HOME: this.home,LANG: "C.UTF-8",- TZ: process.env.TZ || "Asia/Shanghai",DSH_PERMISSION_MODE: permissionMode(this.settings().permission),AMB_MEMORY: this.settings().memory.enabled ? "1" : "0",AMB_CU_APPROVAL: this.settings().computerUse.approval,@@ -564,14 +563,15 @@ exec "$REAL" "$@"AMB_BRIDGE_TOKEN: this.o.bridge.token,AMB_BOT_ID: this.o.botId,};+ // 时区:本进程设了 TZ 才传下去;没设就不设,子进程用系统时区(各平台都是,Windows 上 TZ 也只认 POSIX 写法)+ if (process.env.TZ) env.TZ = process.env.TZ;if (process.platform === "win32") {// Windows:系统目录类变量不是密钥,但工具进程离不开(npm/pip 找 APPDATA,脚本找 ProgramFiles、ComSpec…)。- // libuv 只自动补 SystemRoot/TEMP/USERPROFILE 等少数几个。TZ 只认 POSIX 写法,不设,用系统时区。+ // libuv 只自动补 SystemRoot/TEMP/USERPROFILE 等少数几个。for (const k of WIN_SYSTEM_ENV) {const v = process.env[k];if (v) env[k] = v;}- if (!process.env.TZ) delete env.TZ;}if (process.versions.electron) env.ELECTRON_RUN_AS_NODE = "1";if (process.env.AMB_DSH_LOG_LEVEL) env.DSH_LOG_LEVEL = process.env.AMB_DSH_LOG_LEVEL;diff --git a/test/agent.unit.test.ts b/test/agent.unit.test.tsindex 04a0cd7..cb9b370 100644--- a/test/agent.unit.test.ts+++ b/test/agent.unit.test.ts@@ -215,6 +215,23 @@ describe("context window written for DSH", () => {expect(modelLimits("claude-mini", 32_000)).toEqual({ window: 32_000, maxTokens: 8_000 });});+ it("the agent process keeps the system time zone unless TZ is set", () => {+ const dataDir = fs.mkdtempSync(path.join(os.tmpdir(), "amb-tz-"));+ const host = new AgentHost({ botId: "b", dataDir, runtimeDir: "/rt", bridge: { url: "http://127.0.0.1:1", token: "t" } as any, store: new Store(":memory:") });+ fs.mkdirSync(host.home, { recursive: true });+ const prev = process.env.TZ;+ try {+ delete process.env.TZ;+ expect((host as any).env()).not.toHaveProperty("TZ");+ process.env.TZ = "Europe/Berlin";+ expect((host as any).env().TZ).toBe("Europe/Berlin");+ } finally {+ if (prev === undefined) delete process.env.TZ;+ else process.env.TZ = prev;+ fs.rmSync(dataDir, { recursive: true, force: true });+ }+ });+it("the patch carries those numbers", () => {const dataDir = fs.mkdtempSync(path.join(os.tmpdir(), "amb-patch-"));const host = new AgentHost({ botId: "b", dataDir, runtimeDir: "/rt", bridge: { url: "http://127.0.0.1:1" } as any, store: new Store(":memory:") });