@openclaw/tlon 2026.2.21 → 2026.5.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/api.ts +16 -0
  2. package/channel-plugin-api.ts +1 -0
  3. package/doctor-contract-api.ts +1 -0
  4. package/index.ts +177 -11
  5. package/openclaw.plugin.json +189 -1
  6. package/package.json +57 -4
  7. package/runtime-api.ts +17 -0
  8. package/setup-api.ts +2 -0
  9. package/setup-entry.ts +9 -0
  10. package/src/account-fields.ts +9 -3
  11. package/src/channel.runtime.ts +248 -0
  12. package/src/channel.ts +152 -364
  13. package/src/config-schema.ts +22 -16
  14. package/src/core.test.ts +278 -0
  15. package/src/doctor-contract.ts +9 -0
  16. package/src/doctor.test.ts +40 -0
  17. package/src/doctor.ts +10 -0
  18. package/src/logger-runtime.ts +1 -0
  19. package/src/monitor/approval-runtime.ts +363 -0
  20. package/src/monitor/approval.test.ts +33 -0
  21. package/src/monitor/approval.ts +286 -0
  22. package/src/monitor/authorization.ts +30 -0
  23. package/src/monitor/cites.ts +54 -0
  24. package/src/monitor/discovery.ts +44 -54
  25. package/src/monitor/history.ts +155 -21
  26. package/src/monitor/index.ts +1290 -369
  27. package/src/monitor/media.test.ts +91 -0
  28. package/src/monitor/media.ts +172 -0
  29. package/src/monitor/processed-messages.test.ts +36 -1
  30. package/src/monitor/processed-messages.ts +62 -19
  31. package/src/monitor/settings-helpers.test.ts +113 -0
  32. package/src/monitor/settings-helpers.ts +158 -0
  33. package/src/monitor/utils.ts +311 -45
  34. package/src/runtime.ts +8 -13
  35. package/src/security.test.ts +622 -0
  36. package/src/session-route.ts +40 -0
  37. package/src/settings.ts +391 -0
  38. package/src/setup-core.ts +228 -0
  39. package/src/setup-surface.ts +103 -0
  40. package/src/targets.ts +29 -16
  41. package/src/tlon-api.test.ts +589 -0
  42. package/src/tlon-api.ts +402 -0
  43. package/src/types.ts +106 -45
  44. package/src/urbit/auth.ssrf.test.ts +3 -2
  45. package/src/urbit/auth.ts +2 -2
  46. package/src/urbit/base-url.test.ts +18 -11
  47. package/src/urbit/base-url.ts +9 -5
  48. package/src/urbit/channel-ops.ts +40 -59
  49. package/src/urbit/context.ts +13 -10
  50. package/src/urbit/errors.ts +2 -2
  51. package/src/urbit/fetch.ts +6 -3
  52. package/src/urbit/foreigns.ts +49 -0
  53. package/src/urbit/send.ts +59 -2
  54. package/src/urbit/sse-client.test.ts +184 -25
  55. package/src/urbit/sse-client.ts +123 -69
  56. package/src/urbit/story.ts +332 -0
  57. package/src/urbit/upload.test.ts +154 -0
  58. package/src/urbit/upload.ts +60 -0
  59. package/test-api.ts +1 -0
  60. package/tsconfig.json +16 -0
  61. package/src/config-schema.test.ts +0 -31
  62. package/src/onboarding.ts +0 -229
  63. package/src/urbit/channel-client.ts +0 -157
package/api.ts ADDED
@@ -0,0 +1,16 @@
1
+ export {
2
+ createDedupeCache,
3
+ createLoggerBackedRuntime,
4
+ fetchWithSsrFGuard,
5
+ isBlockedHostnameOrIp,
6
+ type LookupFn,
7
+ type OpenClawConfig,
8
+ type ReplyPayload,
9
+ type RuntimeEnv,
10
+ SsrFBlockedError,
11
+ type SsrFPolicy,
12
+ ssrfPolicyFromAllowPrivateNetwork,
13
+ ssrfPolicyFromDangerouslyAllowPrivateNetwork,
14
+ } from "./runtime-api.js";
15
+ export { tlonPlugin } from "./src/channel.js";
16
+ export { setTlonRuntime } from "./src/runtime.js";
@@ -0,0 +1 @@
1
+ export { tlonPlugin } from "./src/channel.js";
@@ -0,0 +1 @@
1
+ export { normalizeCompatibilityConfig, legacyConfigRules } from "./src/doctor-contract.js";
package/index.ts CHANGED
@@ -1,17 +1,183 @@
1
- import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
2
- import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
3
- import { tlonPlugin } from "./src/channel.js";
4
- import { setTlonRuntime } from "./src/runtime.js";
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";
5
+ import { defineBundledChannelEntry } from "openclaw/plugin-sdk/channel-entry-contract";
6
+ import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
5
7
 
6
- const plugin = {
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
+ }
115
+
116
+ export default defineBundledChannelEntry({
7
117
  id: "tlon",
8
118
  name: "Tlon",
9
119
  description: "Tlon/Urbit channel plugin",
10
- configSchema: emptyPluginConfigSchema(),
11
- register(api: OpenClawPluginApi) {
12
- setTlonRuntime(api.runtime);
13
- api.registerChannel({ plugin: tlonPlugin });
120
+ importMetaUrl: import.meta.url,
121
+ plugin: {
122
+ specifier: "./channel-plugin-api.js",
123
+ exportName: "tlonPlugin",
14
124
  },
15
- };
125
+ runtime: {
126
+ specifier: "./api.js",
127
+ exportName: "setTlonRuntime",
128
+ },
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
+ }
16
163
 
17
- export default plugin;
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
+ },
183
+ });
@@ -1,9 +1,197 @@
1
1
  {
2
2
  "id": "tlon",
3
- "channels": ["tlon"],
3
+ "activation": {
4
+ "onStartup": false
5
+ },
6
+ "channels": [
7
+ "tlon"
8
+ ],
9
+ "skills": [
10
+ "node_modules/@tloncorp/tlon-skill"
11
+ ],
4
12
  "configSchema": {
5
13
  "type": "object",
6
14
  "additionalProperties": false,
7
15
  "properties": {}
16
+ },
17
+ "channelConfigs": {
18
+ "tlon": {
19
+ "schema": {
20
+ "$schema": "http://json-schema.org/draft-07/schema#",
21
+ "type": "object",
22
+ "properties": {
23
+ "name": {
24
+ "type": "string"
25
+ },
26
+ "enabled": {
27
+ "type": "boolean"
28
+ },
29
+ "ship": {
30
+ "type": "string",
31
+ "minLength": 1
32
+ },
33
+ "url": {
34
+ "type": "string"
35
+ },
36
+ "code": {
37
+ "type": "string"
38
+ },
39
+ "network": {
40
+ "type": "object",
41
+ "properties": {
42
+ "dangerouslyAllowPrivateNetwork": {
43
+ "type": "boolean"
44
+ }
45
+ },
46
+ "additionalProperties": false
47
+ },
48
+ "groupChannels": {
49
+ "type": "array",
50
+ "items": {
51
+ "type": "string",
52
+ "minLength": 1
53
+ }
54
+ },
55
+ "dmAllowlist": {
56
+ "type": "array",
57
+ "items": {
58
+ "type": "string",
59
+ "minLength": 1
60
+ }
61
+ },
62
+ "autoDiscoverChannels": {
63
+ "type": "boolean"
64
+ },
65
+ "showModelSignature": {
66
+ "type": "boolean"
67
+ },
68
+ "responsePrefix": {
69
+ "type": "string"
70
+ },
71
+ "autoAcceptDmInvites": {
72
+ "type": "boolean"
73
+ },
74
+ "autoAcceptGroupInvites": {
75
+ "type": "boolean"
76
+ },
77
+ "ownerShip": {
78
+ "type": "string",
79
+ "minLength": 1
80
+ },
81
+ "authorization": {
82
+ "type": "object",
83
+ "properties": {
84
+ "channelRules": {
85
+ "type": "object",
86
+ "propertyNames": {
87
+ "type": "string"
88
+ },
89
+ "additionalProperties": {
90
+ "type": "object",
91
+ "properties": {
92
+ "mode": {
93
+ "type": "string",
94
+ "enum": [
95
+ "restricted",
96
+ "open"
97
+ ]
98
+ },
99
+ "allowedShips": {
100
+ "type": "array",
101
+ "items": {
102
+ "type": "string",
103
+ "minLength": 1
104
+ }
105
+ }
106
+ },
107
+ "additionalProperties": false
108
+ }
109
+ }
110
+ },
111
+ "additionalProperties": false
112
+ },
113
+ "defaultAuthorizedShips": {
114
+ "type": "array",
115
+ "items": {
116
+ "type": "string",
117
+ "minLength": 1
118
+ }
119
+ },
120
+ "accounts": {
121
+ "type": "object",
122
+ "propertyNames": {
123
+ "type": "string"
124
+ },
125
+ "additionalProperties": {
126
+ "type": "object",
127
+ "properties": {
128
+ "name": {
129
+ "type": "string"
130
+ },
131
+ "enabled": {
132
+ "type": "boolean"
133
+ },
134
+ "ship": {
135
+ "type": "string",
136
+ "minLength": 1
137
+ },
138
+ "url": {
139
+ "type": "string"
140
+ },
141
+ "code": {
142
+ "type": "string"
143
+ },
144
+ "network": {
145
+ "type": "object",
146
+ "properties": {
147
+ "dangerouslyAllowPrivateNetwork": {
148
+ "type": "boolean"
149
+ }
150
+ },
151
+ "additionalProperties": false
152
+ },
153
+ "groupChannels": {
154
+ "type": "array",
155
+ "items": {
156
+ "type": "string",
157
+ "minLength": 1
158
+ }
159
+ },
160
+ "dmAllowlist": {
161
+ "type": "array",
162
+ "items": {
163
+ "type": "string",
164
+ "minLength": 1
165
+ }
166
+ },
167
+ "autoDiscoverChannels": {
168
+ "type": "boolean"
169
+ },
170
+ "showModelSignature": {
171
+ "type": "boolean"
172
+ },
173
+ "responsePrefix": {
174
+ "type": "string"
175
+ },
176
+ "autoAcceptDmInvites": {
177
+ "type": "boolean"
178
+ },
179
+ "autoAcceptGroupInvites": {
180
+ "type": "boolean"
181
+ },
182
+ "ownerShip": {
183
+ "type": "string",
184
+ "minLength": 1
185
+ }
186
+ },
187
+ "additionalProperties": false
188
+ }
189
+ }
190
+ },
191
+ "additionalProperties": false
192
+ },
193
+ "label": "Tlon",
194
+ "description": "decentralized messaging on Urbit; install the plugin to enable."
195
+ }
8
196
  }
9
197
  }
package/package.json CHANGED
@@ -1,18 +1,35 @@
1
1
  {
2
2
  "name": "@openclaw/tlon",
3
- "version": "2026.2.21",
3
+ "version": "2026.5.1-beta.1",
4
4
  "description": "OpenClaw Tlon/Urbit channel plugin",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/openclaw/openclaw"
8
+ },
5
9
  "type": "module",
6
10
  "dependencies": {
11
+ "@aws-sdk/client-s3": "3.1041.0",
12
+ "@aws-sdk/s3-request-presigner": "3.1041.0",
13
+ "@tloncorp/tlon-skill": "0.3.5",
7
14
  "@urbit/aura": "^3.0.0"
8
15
  },
9
16
  "devDependencies": {
17
+ "@openclaw/plugin-sdk": "workspace:*",
10
18
  "openclaw": "workspace:*"
11
19
  },
20
+ "peerDependencies": {
21
+ "openclaw": ">=2026.4.25"
22
+ },
23
+ "peerDependenciesMeta": {
24
+ "openclaw": {
25
+ "optional": true
26
+ }
27
+ },
12
28
  "openclaw": {
13
29
  "extensions": [
14
30
  "./index.ts"
15
31
  ],
32
+ "setupEntry": "./setup-entry.ts",
16
33
  "channel": {
17
34
  "id": "tlon",
18
35
  "label": "Tlon",
@@ -21,12 +38,48 @@
21
38
  "docsLabel": "tlon",
22
39
  "blurb": "decentralized messaging on Urbit; install the plugin to enable.",
23
40
  "order": 90,
24
- "quickstartAllowFrom": true
41
+ "quickstartAllowFrom": true,
42
+ "cliAddOptions": [
43
+ {
44
+ "flags": "--ship <ship>",
45
+ "description": "Tlon ship name (~sampel-palnet)"
46
+ },
47
+ {
48
+ "flags": "--code <code>",
49
+ "description": "Tlon login code"
50
+ },
51
+ {
52
+ "flags": "--group-channels <list>",
53
+ "description": "Tlon group channels (comma-separated)"
54
+ },
55
+ {
56
+ "flags": "--dm-allowlist <list>",
57
+ "description": "Tlon DM allowlist (comma-separated ships)"
58
+ },
59
+ {
60
+ "flags": "--auto-discover-channels",
61
+ "description": "Tlon auto-discover group channels"
62
+ },
63
+ {
64
+ "flags": "--no-auto-discover-channels",
65
+ "description": "Disable Tlon auto-discovery"
66
+ }
67
+ ]
25
68
  },
26
69
  "install": {
27
70
  "npmSpec": "@openclaw/tlon",
28
- "localPath": "extensions/tlon",
29
- "defaultChoice": "npm"
71
+ "defaultChoice": "npm",
72
+ "minHostVersion": ">=2026.4.10"
73
+ },
74
+ "compat": {
75
+ "pluginApi": ">=2026.4.10"
76
+ },
77
+ "build": {
78
+ "openclawVersion": "2026.5.1-beta.1"
79
+ },
80
+ "release": {
81
+ "publishToClawHub": true,
82
+ "publishToNpm": true
30
83
  }
31
84
  }
32
85
  }
package/runtime-api.ts ADDED
@@ -0,0 +1,17 @@
1
+ // Private runtime barrel for the bundled Tlon extension.
2
+ // Keep this barrel thin and aligned with the local extension surface.
3
+
4
+ export type { ReplyPayload } from "openclaw/plugin-sdk/reply-runtime";
5
+ export type { OpenClawConfig } from "openclaw/plugin-sdk/config-types";
6
+ export type { RuntimeEnv } from "openclaw/plugin-sdk/runtime";
7
+ export { createDedupeCache } from "openclaw/plugin-sdk/core";
8
+ export { createLoggerBackedRuntime } from "./src/logger-runtime.js";
9
+ export {
10
+ fetchWithSsrFGuard,
11
+ isBlockedHostnameOrIp,
12
+ ssrfPolicyFromAllowPrivateNetwork,
13
+ ssrfPolicyFromDangerouslyAllowPrivateNetwork,
14
+ type LookupFn,
15
+ type SsrFPolicy,
16
+ } from "openclaw/plugin-sdk/ssrf-runtime";
17
+ export { SsrFBlockedError } from "openclaw/plugin-sdk/ssrf-runtime";
package/setup-api.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { tlonSetupAdapter } from "./src/setup-core.js";
2
+ export { tlonSetupWizard } from "./src/setup-surface.js";
package/setup-entry.ts ADDED
@@ -0,0 +1,9 @@
1
+ import { defineBundledChannelSetupEntry } from "openclaw/plugin-sdk/channel-entry-contract";
2
+
3
+ export default defineBundledChannelSetupEntry({
4
+ importMetaUrl: import.meta.url,
5
+ plugin: {
6
+ specifier: "./api.js",
7
+ exportName: "tlonPlugin",
8
+ },
9
+ });
@@ -2,10 +2,11 @@ export type TlonAccountFieldsInput = {
2
2
  ship?: string;
3
3
  url?: string;
4
4
  code?: string;
5
- allowPrivateNetwork?: boolean;
5
+ dangerouslyAllowPrivateNetwork?: boolean;
6
6
  groupChannels?: string[];
7
7
  dmAllowlist?: string[];
8
8
  autoDiscoverChannels?: boolean;
9
+ ownerShip?: string;
9
10
  };
10
11
 
11
12
  export function buildTlonAccountFields(input: TlonAccountFieldsInput) {
@@ -13,13 +14,18 @@ export function buildTlonAccountFields(input: TlonAccountFieldsInput) {
13
14
  ...(input.ship ? { ship: input.ship } : {}),
14
15
  ...(input.url ? { url: input.url } : {}),
15
16
  ...(input.code ? { code: input.code } : {}),
16
- ...(typeof input.allowPrivateNetwork === "boolean"
17
- ? { allowPrivateNetwork: input.allowPrivateNetwork }
17
+ ...(typeof input.dangerouslyAllowPrivateNetwork === "boolean"
18
+ ? {
19
+ network: {
20
+ dangerouslyAllowPrivateNetwork: input.dangerouslyAllowPrivateNetwork,
21
+ },
22
+ }
18
23
  : {}),
19
24
  ...(input.groupChannels ? { groupChannels: input.groupChannels } : {}),
20
25
  ...(input.dmAllowlist ? { dmAllowlist: input.dmAllowlist } : {}),
21
26
  ...(typeof input.autoDiscoverChannels === "boolean"
22
27
  ? { autoDiscoverChannels: input.autoDiscoverChannels }
23
28
  : {}),
29
+ ...(input.ownerShip ? { ownerShip: input.ownerShip } : {}),
24
30
  };
25
31
  }