惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Vercel News
Vercel News
F
Fortinet All Blogs
月光博客
月光博客
G
Google Developers Blog
博客园 - Franky
GbyAI
GbyAI
The Cloudflare Blog
I
InfoQ
雷峰网
雷峰网
WordPress大学
WordPress大学
罗磊的独立博客
大猫的无限游戏
大猫的无限游戏
T
The Blog of Author Tim Ferriss
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 聂微东
小众软件
小众软件
腾讯CDC
B
Blog
量子位
V
V2EX
S
SegmentFault 最新的问题
Google DeepMind News
Google DeepMind News

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
refactor: simplify e2e fixture helpers · openclaw/opencla...
steipete · 2026-04-29 · via Recent Commits to openclaw:main

@@ -0,0 +1,122 @@

1+

import fs from "node:fs";

2+

import path from "node:path";

3+4+

const command = process.argv[2];

5+

const readJson = (file) => JSON.parse(fs.readFileSync(file, "utf8"));

6+7+

function assertOnboardState() {

8+

const home = process.argv[3];

9+

const stateDir = path.join(home, ".openclaw");

10+

const configPath = path.join(stateDir, "openclaw.json");

11+

const agentDir = path.join(stateDir, "agents", "main", "agent");

12+

const authPath = path.join(agentDir, "auth-profiles.json");

13+14+

if (!fs.existsSync(configPath)) {

15+

throw new Error("onboard did not write openclaw.json");

16+

}

17+

if (!fs.existsSync(agentDir)) {

18+

throw new Error("onboard did not create main agent dir");

19+

}

20+

if (!fs.existsSync(authPath)) {

21+

throw new Error("onboard did not create auth-profiles.json");

22+

}

23+

const authRaw = fs.readFileSync(authPath, "utf8");

24+

if (!authRaw.includes("OPENAI_API_KEY")) {

25+

throw new Error("auth profile did not persist OPENAI_API_KEY env ref");

26+

}

27+

if (authRaw.includes("sk-openclaw-npm-onboard-e2e")) {

28+

throw new Error("auth profile persisted the raw OpenAI test key");

29+

}

30+

}

31+32+

function configureMockModel() {

33+

const mockPort = Number(process.argv[3]);

34+

const configPath = path.join(process.env.HOME, ".openclaw", "openclaw.json");

35+

const cfg = readJson(configPath);

36+

const modelRef = "openai/gpt-5.5";

37+

const cost = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };

38+39+

cfg.models = {

40+

...cfg.models,

41+

mode: "merge",

42+

providers: {

43+

...cfg.models?.providers,

44+

openai: {

45+

...cfg.models?.providers?.openai,

46+

baseUrl: `http://127.0.0.1:${mockPort}/v1`,

47+

apiKey: { source: "env", provider: "default", id: "OPENAI_API_KEY" },

48+

api: "openai-responses",

49+

request: { ...cfg.models?.providers?.openai?.request, allowPrivateNetwork: true },

50+

models: [

51+

{

52+

id: "gpt-5.5",

53+

name: "gpt-5.5",

54+

api: "openai-responses",

55+

reasoning: false,

56+

input: ["text", "image"],

57+

cost,

58+

contextWindow: 128000,

59+

contextTokens: 96000,

60+

maxTokens: 4096,

61+

},

62+

],

63+

},

64+

},

65+

};

66+

cfg.agents = {

67+

...cfg.agents,

68+

defaults: {

69+

...cfg.agents?.defaults,

70+

model: { primary: modelRef },

71+

models: {

72+

...cfg.agents?.defaults?.models,

73+

[modelRef]: { params: { transport: "sse", openaiWsWarmup: false } },

74+

},

75+

},

76+

};

77+

cfg.plugins = {

78+

...cfg.plugins,

79+

enabled: true,

80+

};

81+

fs.writeFileSync(configPath, `${JSON.stringify(cfg, null, 2)}\n`);

82+

}

83+84+

function assertChannelConfig() {

85+

const channel = process.argv[3];

86+

const token = process.argv[4];

87+

const configPath = path.join(process.env.HOME, ".openclaw", "openclaw.json");

88+

const cfg = readJson(configPath);

89+

const entry = cfg.channels?.[channel];

90+

if (!entry || entry.enabled === false) {

91+

throw new Error(`${channel} was not enabled`);

92+

}

93+

if (!JSON.stringify(entry).includes(token)) {

94+

throw new Error(`${channel} token was not persisted`);

95+

}

96+

}

97+98+

function assertAgentTurn() {

99+

const marker = process.argv[3];

100+

const logPath = process.argv[4];

101+

const output = fs.readFileSync("/tmp/openclaw-agent.combined", "utf8");

102+

if (!output.includes(marker)) {

103+

throw new Error(`agent JSON did not contain success marker. Output: ${output}`);

104+

}

105+

const requestLog = fs.existsSync(logPath) ? fs.readFileSync(logPath, "utf8") : "";

106+

if (!/\/v1\/(responses|chat\/completions)/u.test(requestLog)) {

107+

throw new Error(`mock OpenAI server was not used. Requests: ${requestLog}`);

108+

}

109+

}

110+111+

const commands = {

112+

"assert-onboard-state": assertOnboardState,

113+

"configure-mock-model": configureMockModel,

114+

"assert-channel-config": assertChannelConfig,

115+

"assert-agent-turn": assertAgentTurn,

116+

};

117+118+

const fn = commands[command];

119+

if (!fn) {

120+

throw new Error(`unknown npm onboard/channel/agent assertion command: ${command}`);

121+

}

122+

fn();