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

推荐订阅源

Jina AI
Jina AI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
B
Blog
T
The Blog of Author Tim Ferriss
量子位
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - Franky
小众软件
小众软件
Recent Announcements
Recent Announcements
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
I
InfoQ
美团技术团队
G
Google Developers Blog
Engineering at Meta
Engineering at Meta
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
V
Visual Studio Blog
云风的 BLOG
云风的 BLOG
博客园 - 【当耐特】
IT之家
IT之家
Microsoft Security Blog
Microsoft Security Blog
博客园 - 聂微东
Last Week in AI
Last Week in AI
H
Hackread – Cybersecurity News, Data Breaches, AI and More
H
Help Net Security

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
fix(tlon): drop bundled cli tool wrapper · openclaw/openc...
vincentkoc · 2026-05-03 · via Recent Commits to openclaw:main

@@ -1,117 +1,4 @@

1-

import { spawn } from "node:child_process";

2-

import { existsSync } from "node:fs";

3-

import { dirname, join } from "node:path";

4-

import { fileURLToPath } from "node:url";

51

import { defineBundledChannelEntry } from "openclaw/plugin-sdk/channel-entry-contract";

6-

import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";

7-8-

const __dirname = dirname(fileURLToPath(import.meta.url));

9-10-

const ALLOWED_TLON_COMMANDS = new Set([

11-

"activity",

12-

"channels",

13-

"contacts",

14-

"groups",

15-

"messages",

16-

"dms",

17-

"posts",

18-

"notebook",

19-

"settings",

20-

"help",

21-

"version",

22-

]);

23-24-

let cachedTlonBinary: string | undefined;

25-26-

function findTlonBinary(): string {

27-

if (cachedTlonBinary) {

28-

return cachedTlonBinary;

29-

}

30-

const skillBin = join(__dirname, "node_modules", ".bin", "tlon");

31-

if (existsSync(skillBin)) {

32-

cachedTlonBinary = skillBin;

33-

return skillBin;

34-

}

35-36-

const platformPkg = `@tloncorp/tlon-skill-${process.platform}-${process.arch}`;

37-

const platformBin = join(__dirname, "node_modules", platformPkg, "tlon");

38-

if (existsSync(platformBin)) {

39-

cachedTlonBinary = platformBin;

40-

return platformBin;

41-

}

42-43-

cachedTlonBinary = "tlon";

44-

return cachedTlonBinary;

45-

}

46-47-

function shellSplit(str: string): string[] {

48-

const args: string[] = [];

49-

let cur = "";

50-

let inDouble = false;

51-

let inSingle = false;

52-

let escape = false;

53-54-

for (const ch of str) {

55-

if (escape) {

56-

cur += ch;

57-

escape = false;

58-

continue;

59-

}

60-

if (ch === "\\" && !inSingle) {

61-

escape = true;

62-

continue;

63-

}

64-

if (ch === '"' && !inSingle) {

65-

inDouble = !inDouble;

66-

continue;

67-

}

68-

if (ch === "'" && !inDouble) {

69-

inSingle = !inSingle;

70-

continue;

71-

}

72-

if (/\s/.test(ch) && !inDouble && !inSingle) {

73-

if (cur) {

74-

args.push(cur);

75-

cur = "";

76-

}

77-

continue;

78-

}

79-

cur += ch;

80-

}

81-

if (cur) {

82-

args.push(cur);

83-

}

84-

return args;

85-

}

86-87-

function runTlonCommand(binary: string, args: string[]): Promise<string> {

88-

return new Promise((resolve, reject) => {

89-

const child = spawn(binary, args, { env: process.env });

90-91-

let stdout = "";

92-

let stderr = "";

93-94-

child.stdout.on("data", (data) => {

95-

stdout += data.toString();

96-

});

97-98-

child.stderr.on("data", (data) => {

99-

stderr += data.toString();

100-

});

101-102-

child.on("error", (err) => {

103-

reject(new Error(`Failed to run tlon: ${err.message}`));

104-

});

105-106-

child.on("close", (code) => {

107-

if (code !== 0) {

108-

reject(new Error(stderr || `tlon exited with code ${code}`));

109-

return;

110-

}

111-

resolve(stdout);

112-

});

113-

});

114-

}

11521163

export default defineBundledChannelEntry({

1174

id: "tlon",

@@ -126,58 +13,4 @@ export default defineBundledChannelEntry({

12613

specifier: "./api.js",

12714

exportName: "setTlonRuntime",

12815

},

129-

registerFull(api) {

130-

api.registerTool({

131-

name: "tlon",

132-

label: "Tlon CLI",

133-

description:

134-

"Tlon/Urbit API operations: activity, channels, contacts, groups, messages, dms, posts, notebook, settings. " +

135-

"Examples: 'activity mentions --limit 10', 'channels groups', 'contacts self', 'groups list'",

136-

parameters: {

137-

type: "object",

138-

properties: {

139-

command: {

140-

type: "string",

141-

description:

142-

"The tlon command and arguments. " +

143-

"Examples: 'activity mentions --limit 10', 'contacts get ~sampel-palnet', 'groups list'",

144-

},

145-

},

146-

required: ["command"],

147-

},

148-

async execute(_id: string, params: { command: string }) {

149-

try {

150-

const args = shellSplit(params.command);

151-

const subcommand = args[0];

152-

if (!ALLOWED_TLON_COMMANDS.has(subcommand)) {

153-

return {

154-

content: [

155-

{

156-

type: "text" as const,

157-

text: `Error: Unknown tlon subcommand '${subcommand}'. Allowed: ${[...ALLOWED_TLON_COMMANDS].join(", ")}`,

158-

},

159-

],

160-

details: { error: true },

161-

};

162-

}

163-164-

const output = await runTlonCommand(findTlonBinary(), args);

165-

return {

166-

content: [{ type: "text" as const, text: output }],

167-

details: undefined,

168-

};

169-

} catch (error: unknown) {

170-

return {

171-

content: [

172-

{

173-

type: "text" as const,

174-

text: `Error: ${formatErrorMessage(error)}`,

175-

},

176-

],

177-

details: { error: true },

178-

};

179-

}

180-

},

181-

});

182-

},

18316

});