@kodelyth/tlon 2026.5.42 → 2026.6.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/klaw.plugin.json +203 -3
  2. package/package.json +17 -4
  3. package/api.ts +0 -16
  4. package/channel-plugin-api.ts +0 -1
  5. package/doctor-contract-api.ts +0 -1
  6. package/index.ts +0 -16
  7. package/runtime-api.ts +0 -17
  8. package/setup-api.ts +0 -2
  9. package/setup-entry.ts +0 -9
  10. package/src/account-fields.ts +0 -31
  11. package/src/channel.message-adapter.test.ts +0 -145
  12. package/src/channel.runtime.ts +0 -259
  13. package/src/channel.ts +0 -192
  14. package/src/config-schema.ts +0 -54
  15. package/src/core.test.ts +0 -298
  16. package/src/doctor-contract.ts +0 -9
  17. package/src/doctor.test.ts +0 -46
  18. package/src/doctor.ts +0 -10
  19. package/src/logger-runtime.ts +0 -1
  20. package/src/monitor/approval-runtime.ts +0 -363
  21. package/src/monitor/approval.test.ts +0 -33
  22. package/src/monitor/approval.ts +0 -283
  23. package/src/monitor/authorization.ts +0 -30
  24. package/src/monitor/cites.ts +0 -54
  25. package/src/monitor/discovery.ts +0 -68
  26. package/src/monitor/history.ts +0 -226
  27. package/src/monitor/index.ts +0 -1523
  28. package/src/monitor/media.test.ts +0 -80
  29. package/src/monitor/media.ts +0 -156
  30. package/src/monitor/processed-messages.test.ts +0 -58
  31. package/src/monitor/processed-messages.ts +0 -89
  32. package/src/monitor/settings-helpers.test.ts +0 -113
  33. package/src/monitor/settings-helpers.ts +0 -158
  34. package/src/monitor/utils.ts +0 -402
  35. package/src/runtime.ts +0 -9
  36. package/src/security.test.ts +0 -658
  37. package/src/session-route.ts +0 -40
  38. package/src/settings.ts +0 -391
  39. package/src/setup-core.ts +0 -231
  40. package/src/setup-surface.ts +0 -99
  41. package/src/targets.ts +0 -102
  42. package/src/tlon-api.test.ts +0 -572
  43. package/src/tlon-api.ts +0 -389
  44. package/src/types.ts +0 -160
  45. package/src/urbit/auth.ssrf.test.ts +0 -45
  46. package/src/urbit/auth.ts +0 -48
  47. package/src/urbit/base-url.test.ts +0 -48
  48. package/src/urbit/base-url.ts +0 -61
  49. package/src/urbit/channel-ops.test.ts +0 -36
  50. package/src/urbit/channel-ops.ts +0 -149
  51. package/src/urbit/context.ts +0 -50
  52. package/src/urbit/errors.ts +0 -51
  53. package/src/urbit/fetch.ts +0 -38
  54. package/src/urbit/foreigns.ts +0 -49
  55. package/src/urbit/send.test.ts +0 -83
  56. package/src/urbit/send.ts +0 -228
  57. package/src/urbit/sse-client.test.ts +0 -234
  58. package/src/urbit/sse-client.ts +0 -492
  59. package/src/urbit/story.ts +0 -332
  60. package/src/urbit/upload.test.ts +0 -155
  61. package/src/urbit/upload.ts +0 -60
  62. package/test-api.ts +0 -1
  63. package/tsconfig.json +0 -16
package/klaw.plugin.json CHANGED
@@ -3,14 +3,214 @@
3
3
  "activation": {
4
4
  "onStartup": false
5
5
  },
6
- "channels": ["tlon"],
6
+ "channels": [
7
+ "tlon"
8
+ ],
7
9
  "contracts": {
8
- "tools": ["tlon"]
10
+ "tools": [
11
+ "tlon"
12
+ ]
9
13
  },
10
- "skills": ["node_modules/@tloncorp/tlon-skill"],
14
+ "skills": [
15
+ "node_modules/@tloncorp/tlon-skill"
16
+ ],
11
17
  "configSchema": {
12
18
  "type": "object",
13
19
  "additionalProperties": false,
14
20
  "properties": {}
21
+ },
22
+ "channelConfigs": {
23
+ "tlon": {
24
+ "schema": {
25
+ "$schema": "http://json-schema.org/draft-07/schema#",
26
+ "type": "object",
27
+ "properties": {
28
+ "name": {
29
+ "type": "string"
30
+ },
31
+ "enabled": {
32
+ "type": "boolean"
33
+ },
34
+ "ship": {
35
+ "type": "string",
36
+ "minLength": 1
37
+ },
38
+ "url": {
39
+ "type": "string"
40
+ },
41
+ "code": {
42
+ "type": "string"
43
+ },
44
+ "network": {
45
+ "type": "object",
46
+ "properties": {
47
+ "dangerouslyAllowPrivateNetwork": {
48
+ "type": "boolean"
49
+ }
50
+ },
51
+ "additionalProperties": false
52
+ },
53
+ "groupChannels": {
54
+ "type": "array",
55
+ "items": {
56
+ "type": "string",
57
+ "minLength": 1
58
+ }
59
+ },
60
+ "dmAllowlist": {
61
+ "type": "array",
62
+ "items": {
63
+ "type": "string",
64
+ "minLength": 1
65
+ }
66
+ },
67
+ "groupInviteAllowlist": {
68
+ "type": "array",
69
+ "items": {
70
+ "type": "string",
71
+ "minLength": 1
72
+ }
73
+ },
74
+ "autoDiscoverChannels": {
75
+ "type": "boolean"
76
+ },
77
+ "showModelSignature": {
78
+ "type": "boolean"
79
+ },
80
+ "responsePrefix": {
81
+ "type": "string"
82
+ },
83
+ "autoAcceptDmInvites": {
84
+ "type": "boolean"
85
+ },
86
+ "autoAcceptGroupInvites": {
87
+ "type": "boolean"
88
+ },
89
+ "ownerShip": {
90
+ "type": "string",
91
+ "minLength": 1
92
+ },
93
+ "authorization": {
94
+ "type": "object",
95
+ "properties": {
96
+ "channelRules": {
97
+ "type": "object",
98
+ "propertyNames": {
99
+ "type": "string"
100
+ },
101
+ "additionalProperties": {
102
+ "type": "object",
103
+ "properties": {
104
+ "mode": {
105
+ "type": "string",
106
+ "enum": [
107
+ "restricted",
108
+ "open"
109
+ ]
110
+ },
111
+ "allowedShips": {
112
+ "type": "array",
113
+ "items": {
114
+ "type": "string",
115
+ "minLength": 1
116
+ }
117
+ }
118
+ },
119
+ "additionalProperties": false
120
+ }
121
+ }
122
+ },
123
+ "additionalProperties": false
124
+ },
125
+ "defaultAuthorizedShips": {
126
+ "type": "array",
127
+ "items": {
128
+ "type": "string",
129
+ "minLength": 1
130
+ }
131
+ },
132
+ "accounts": {
133
+ "type": "object",
134
+ "propertyNames": {
135
+ "type": "string"
136
+ },
137
+ "additionalProperties": {
138
+ "type": "object",
139
+ "properties": {
140
+ "name": {
141
+ "type": "string"
142
+ },
143
+ "enabled": {
144
+ "type": "boolean"
145
+ },
146
+ "ship": {
147
+ "type": "string",
148
+ "minLength": 1
149
+ },
150
+ "url": {
151
+ "type": "string"
152
+ },
153
+ "code": {
154
+ "type": "string"
155
+ },
156
+ "network": {
157
+ "type": "object",
158
+ "properties": {
159
+ "dangerouslyAllowPrivateNetwork": {
160
+ "type": "boolean"
161
+ }
162
+ },
163
+ "additionalProperties": false
164
+ },
165
+ "groupChannels": {
166
+ "type": "array",
167
+ "items": {
168
+ "type": "string",
169
+ "minLength": 1
170
+ }
171
+ },
172
+ "dmAllowlist": {
173
+ "type": "array",
174
+ "items": {
175
+ "type": "string",
176
+ "minLength": 1
177
+ }
178
+ },
179
+ "groupInviteAllowlist": {
180
+ "type": "array",
181
+ "items": {
182
+ "type": "string",
183
+ "minLength": 1
184
+ }
185
+ },
186
+ "autoDiscoverChannels": {
187
+ "type": "boolean"
188
+ },
189
+ "showModelSignature": {
190
+ "type": "boolean"
191
+ },
192
+ "responsePrefix": {
193
+ "type": "string"
194
+ },
195
+ "autoAcceptDmInvites": {
196
+ "type": "boolean"
197
+ },
198
+ "autoAcceptGroupInvites": {
199
+ "type": "boolean"
200
+ },
201
+ "ownerShip": {
202
+ "type": "string",
203
+ "minLength": 1
204
+ }
205
+ },
206
+ "additionalProperties": false
207
+ }
208
+ }
209
+ },
210
+ "additionalProperties": false
211
+ },
212
+ "label": "Tlon",
213
+ "description": "decentralized messaging on Urbit; install the plugin to enable."
214
+ }
15
215
  }
16
216
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kodelyth/tlon",
3
- "version": "2026.5.42",
3
+ "version": "2026.6.1",
4
4
  "description": "Klaw Tlon/Urbit channel plugin",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,11 +19,15 @@
19
19
  "@kodelyth/klaw": "2026.5.42"
20
20
  },
21
21
  "peerDependencies": {
22
- "@kodelyth/klaw": ">=2026.5.19"
22
+ "@kodelyth/klaw": ">=2026.5.19",
23
+ "klaw": ">=2026.5.39"
23
24
  },
24
25
  "peerDependenciesMeta": {
25
26
  "@kodelyth/klaw": {
26
27
  "optional": true
28
+ },
29
+ "klaw": {
30
+ "optional": true
27
31
  }
28
32
  },
29
33
  "klaw": {
@@ -81,6 +85,15 @@
81
85
  "release": {
82
86
  "publishToClawHub": true,
83
87
  "publishToNpm": true
84
- }
85
- }
88
+ },
89
+ "runtimeExtensions": [
90
+ "./dist/index.js"
91
+ ],
92
+ "runtimeSetupEntry": "./dist/setup-entry.js"
93
+ },
94
+ "files": [
95
+ "dist/**",
96
+ "klaw.plugin.json",
97
+ "README.md"
98
+ ]
86
99
  }
package/api.ts DELETED
@@ -1,16 +0,0 @@
1
- export {
2
- createDedupeCache,
3
- createLoggerBackedRuntime,
4
- fetchWithSsrFGuard,
5
- isBlockedHostnameOrIp,
6
- type LookupFn,
7
- type KlawConfig,
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";
@@ -1 +0,0 @@
1
- export { tlonPlugin } from "./src/channel.js";
@@ -1 +0,0 @@
1
- export { normalizeCompatibilityConfig, legacyConfigRules } from "./src/doctor-contract.js";
package/index.ts DELETED
@@ -1,16 +0,0 @@
1
- import { defineBundledChannelEntry } from "klaw/plugin-sdk/channel-entry-contract";
2
-
3
- export default defineBundledChannelEntry({
4
- id: "tlon",
5
- name: "Tlon",
6
- description: "Tlon/Urbit channel plugin",
7
- importMetaUrl: import.meta.url,
8
- plugin: {
9
- specifier: "./channel-plugin-api.js",
10
- exportName: "tlonPlugin",
11
- },
12
- runtime: {
13
- specifier: "./api.js",
14
- exportName: "setTlonRuntime",
15
- },
16
- });
package/runtime-api.ts DELETED
@@ -1,17 +0,0 @@
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 "klaw/plugin-sdk/reply-runtime";
5
- export type { KlawConfig } from "klaw/plugin-sdk/config-contracts";
6
- export type { RuntimeEnv } from "klaw/plugin-sdk/runtime";
7
- export { createDedupeCache } from "klaw/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 "klaw/plugin-sdk/ssrf-runtime";
17
- export { SsrFBlockedError } from "klaw/plugin-sdk/ssrf-runtime";
package/setup-api.ts DELETED
@@ -1,2 +0,0 @@
1
- export { tlonSetupAdapter } from "./src/setup-core.js";
2
- export { tlonSetupWizard } from "./src/setup-surface.js";
package/setup-entry.ts DELETED
@@ -1,9 +0,0 @@
1
- import { defineBundledChannelSetupEntry } from "klaw/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
- });
@@ -1,31 +0,0 @@
1
- export type TlonAccountFieldsInput = {
2
- ship?: string;
3
- url?: string;
4
- code?: string;
5
- dangerouslyAllowPrivateNetwork?: boolean;
6
- groupChannels?: string[];
7
- dmAllowlist?: string[];
8
- autoDiscoverChannels?: boolean;
9
- ownerShip?: string;
10
- };
11
-
12
- export function buildTlonAccountFields(input: TlonAccountFieldsInput) {
13
- return {
14
- ...(input.ship ? { ship: input.ship } : {}),
15
- ...(input.url ? { url: input.url } : {}),
16
- ...(input.code ? { code: input.code } : {}),
17
- ...(typeof input.dangerouslyAllowPrivateNetwork === "boolean"
18
- ? {
19
- network: {
20
- dangerouslyAllowPrivateNetwork: input.dangerouslyAllowPrivateNetwork,
21
- },
22
- }
23
- : {}),
24
- ...(input.groupChannels ? { groupChannels: input.groupChannels } : {}),
25
- ...(input.dmAllowlist ? { dmAllowlist: input.dmAllowlist } : {}),
26
- ...(typeof input.autoDiscoverChannels === "boolean"
27
- ? { autoDiscoverChannels: input.autoDiscoverChannels }
28
- : {}),
29
- ...(input.ownerShip ? { ownerShip: input.ownerShip } : {}),
30
- };
31
- }
@@ -1,145 +0,0 @@
1
- import { verifyChannelMessageAdapterCapabilityProofs } from "klaw/plugin-sdk/channel-message";
2
- import { beforeEach, describe, expect, it, vi } from "vitest";
3
- import type { KlawConfig } from "../runtime-api.js";
4
-
5
- const mocks = vi.hoisted(() => ({
6
- sendText: vi.fn(),
7
- sendMedia: vi.fn(),
8
- }));
9
-
10
- vi.mock("./channel.runtime.js", () => ({
11
- tlonRuntimeOutbound: {
12
- sendText: mocks.sendText,
13
- sendMedia: mocks.sendMedia,
14
- },
15
- }));
16
-
17
- import { tlonPlugin } from "./channel.js";
18
-
19
- const cfg = {
20
- channels: {
21
- tlon: {
22
- ship: "~zod",
23
- url: "https://zod.example",
24
- code: "lidlut-tabwed-pillex-ridrup",
25
- },
26
- },
27
- } as KlawConfig;
28
-
29
- describe("tlon channel message adapter", () => {
30
- beforeEach(() => {
31
- mocks.sendText.mockReset();
32
- mocks.sendMedia.mockReset();
33
- mocks.sendText.mockResolvedValue({
34
- channel: "tlon",
35
- messageId: "~zod/1700000000000",
36
- conversationId: "~nec/general",
37
- });
38
- mocks.sendMedia.mockResolvedValue({
39
- channel: "tlon",
40
- messageId: "~zod/1700000000001",
41
- conversationId: "~nec/general",
42
- });
43
- });
44
-
45
- it("backs declared durable-final capabilities with outbound send proofs", async () => {
46
- const adapter = tlonPlugin.message;
47
- if (!adapter?.send?.text || !adapter.send.media) {
48
- throw new Error("expected tlon channel message adapter with text and media senders");
49
- }
50
- const sendText = adapter.send.text;
51
- const sendMedia = adapter.send.media;
52
-
53
- const proveText = async () => {
54
- mocks.sendText.mockClear();
55
- const result = await sendText({
56
- cfg,
57
- to: "chat/~nec/general",
58
- text: "hello",
59
- accountId: "default",
60
- });
61
- expect(mocks.sendText).toHaveBeenLastCalledWith({
62
- cfg,
63
- to: "chat/~nec/general",
64
- text: "hello",
65
- accountId: "default",
66
- replyToId: undefined,
67
- threadId: undefined,
68
- });
69
- expect(result.receipt.platformMessageIds).toEqual(["~zod/1700000000000"]);
70
- expect(result.receipt.parts[0]?.kind).toBe("text");
71
- };
72
-
73
- const proveMedia = async () => {
74
- mocks.sendMedia.mockClear();
75
- const result = await sendMedia({
76
- cfg,
77
- to: "chat/~nec/general",
78
- text: "image",
79
- mediaUrl: "https://example.com/image.png",
80
- accountId: "default",
81
- });
82
- expect(mocks.sendMedia).toHaveBeenLastCalledWith({
83
- cfg,
84
- to: "chat/~nec/general",
85
- text: "image",
86
- mediaUrl: "https://example.com/image.png",
87
- accountId: "default",
88
- replyToId: undefined,
89
- threadId: undefined,
90
- });
91
- expect(result.receipt.platformMessageIds).toEqual(["~zod/1700000000001"]);
92
- expect(result.receipt.parts[0]?.kind).toBe("media");
93
- };
94
-
95
- const proveReplyThread = async () => {
96
- mocks.sendText.mockClear();
97
- const result = await sendText({
98
- cfg,
99
- to: "chat/~nec/general",
100
- text: "threaded",
101
- accountId: "default",
102
- replyToId: "1700000000000",
103
- threadId: "1700000000000",
104
- });
105
- expect(mocks.sendText).toHaveBeenLastCalledWith({
106
- cfg,
107
- to: "chat/~nec/general",
108
- text: "threaded",
109
- accountId: "default",
110
- replyToId: "1700000000000",
111
- threadId: "1700000000000",
112
- });
113
- expect(result.receipt.replyToId).toBe("1700000000000");
114
- expect(result.receipt.threadId).toBe("1700000000000");
115
- };
116
-
117
- const proofs = await verifyChannelMessageAdapterCapabilityProofs({
118
- adapterName: "tlonMessageAdapter",
119
- adapter,
120
- proofs: {
121
- text: proveText,
122
- media: proveMedia,
123
- replyTo: proveReplyThread,
124
- thread: proveReplyThread,
125
- messageSendingHooks: () => {
126
- expect(sendText).toBeTypeOf("function");
127
- },
128
- },
129
- });
130
- expect(proofs).toStrictEqual([
131
- { capability: "text", status: "verified" },
132
- { capability: "media", status: "verified" },
133
- { capability: "payload", status: "not_declared" },
134
- { capability: "silent", status: "not_declared" },
135
- { capability: "replyTo", status: "verified" },
136
- { capability: "thread", status: "verified" },
137
- { capability: "nativeQuote", status: "not_declared" },
138
- { capability: "messageSendingHooks", status: "verified" },
139
- { capability: "batch", status: "not_declared" },
140
- { capability: "reconcileUnknownSend", status: "not_declared" },
141
- { capability: "afterSendSuccess", status: "not_declared" },
142
- { capability: "afterCommit", status: "not_declared" },
143
- ]);
144
- });
145
- });