@kodelyth/tlon 2026.5.39 → 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.
- package/README.md +5 -0
- package/dist/api.js +4 -0
- package/dist/channel-Bvzym9ez.js +236 -0
- package/dist/channel-plugin-api.js +2 -0
- package/dist/channel.runtime-CDY2BdfM.js +3626 -0
- package/dist/doctor-contract-Ip6FcHDH.js +7 -0
- package/dist/doctor-contract-api.js +2 -0
- package/dist/index.js +18 -0
- package/dist/runtime-BmSb9A-q.js +8 -0
- package/dist/runtime-api-Dq8wkBC_.js +4 -0
- package/dist/runtime-api.js +2 -0
- package/dist/setup-api.js +3 -0
- package/dist/setup-core-CF3ryHqs.js +387 -0
- package/dist/setup-entry.js +11 -0
- package/dist/setup-surface-BM5_V_XL.js +74 -0
- package/dist/test-api.js +2 -0
- package/klaw.plugin.json +1 -1
- package/package.json +20 -7
- package/api.js +0 -7
- package/bundled-skills/@tloncorp/tlon-skill/SKILL.md +0 -501
- package/bundled-skills/@tloncorp/tlon-skill/bin/tlon.js +0 -7
- package/bundled-skills/@tloncorp/tlon-skill/package.json +0 -40
- package/bundled-skills/@tloncorp/tlon-skill/scripts/postinstall.js +0 -7
- package/channel-plugin-api.js +0 -7
- package/doctor-contract-api.js +0 -7
- package/index.js +0 -7
- package/runtime-api.js +0 -7
- package/setup-api.js +0 -7
- package/setup-entry.js +0 -7
- package/test-api.js +0 -7
package/README.md
ADDED
package/dist/api.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { a as ssrfPolicyFromAllowPrivateNetwork, i as isBlockedHostnameOrIp, n as createDedupeCache, o as ssrfPolicyFromDangerouslyAllowPrivateNetwork, r as fetchWithSsrFGuard, s as createLoggerBackedRuntime, t as SsrFBlockedError } from "./runtime-api-Dq8wkBC_.js";
|
|
2
|
+
import { t as tlonPlugin } from "./channel-Bvzym9ez.js";
|
|
3
|
+
import { n as setTlonRuntime } from "./runtime-BmSb9A-q.js";
|
|
4
|
+
export { SsrFBlockedError, createDedupeCache, createLoggerBackedRuntime, fetchWithSsrFGuard, isBlockedHostnameOrIp, setTlonRuntime, ssrfPolicyFromAllowPrivateNetwork, ssrfPolicyFromDangerouslyAllowPrivateNetwork, tlonPlugin };
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-Ip6FcHDH.js";
|
|
2
|
+
import { a as tlonSetupAdapter, d as formatTargetHint, f as normalizeShip, h as resolveTlonOutboundTarget, l as listTlonAccountIds, m as parseTlonTarget, n as createTlonSetupWizardBase, u as resolveTlonAccount } from "./setup-core-CF3ryHqs.js";
|
|
3
|
+
import { buildChannelOutboundSessionRoute } from "klaw/plugin-sdk/core";
|
|
4
|
+
import { describeAccountSnapshot } from "klaw/plugin-sdk/account-helpers";
|
|
5
|
+
import { DEFAULT_ACCOUNT_ID } from "klaw/plugin-sdk/account-id";
|
|
6
|
+
import { createHybridChannelConfigAdapter } from "klaw/plugin-sdk/channel-config-helpers";
|
|
7
|
+
import { createChatChannelPlugin } from "klaw/plugin-sdk/channel-core";
|
|
8
|
+
import { createChannelMessageAdapterFromOutbound } from "klaw/plugin-sdk/channel-message";
|
|
9
|
+
import { createLazyRuntimeModule } from "klaw/plugin-sdk/lazy-runtime";
|
|
10
|
+
import { createRuntimeOutboundDelegates } from "klaw/plugin-sdk/outbound-runtime";
|
|
11
|
+
import { createComputedAccountStatusAdapter, createDefaultChannelRuntimeState } from "klaw/plugin-sdk/status-helpers";
|
|
12
|
+
import { buildChannelConfigSchema } from "klaw/plugin-sdk/channel-config-schema";
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
//#region extensions/tlon/src/config-schema.ts
|
|
15
|
+
const ShipSchema = z.string().min(1);
|
|
16
|
+
const ChannelNestSchema = z.string().min(1);
|
|
17
|
+
const TlonChannelRuleSchema = z.object({
|
|
18
|
+
mode: z.enum(["restricted", "open"]).optional(),
|
|
19
|
+
allowedShips: z.array(ShipSchema).optional()
|
|
20
|
+
});
|
|
21
|
+
const TlonAuthorizationSchema = z.object({ channelRules: z.record(z.string(), TlonChannelRuleSchema).optional() });
|
|
22
|
+
const TlonNetworkSchema = z.object({ dangerouslyAllowPrivateNetwork: z.boolean().optional() }).strict().optional();
|
|
23
|
+
const tlonCommonConfigFields = {
|
|
24
|
+
name: z.string().optional(),
|
|
25
|
+
enabled: z.boolean().optional(),
|
|
26
|
+
ship: ShipSchema.optional(),
|
|
27
|
+
url: z.string().optional(),
|
|
28
|
+
code: z.string().optional(),
|
|
29
|
+
network: TlonNetworkSchema,
|
|
30
|
+
groupChannels: z.array(ChannelNestSchema).optional(),
|
|
31
|
+
dmAllowlist: z.array(ShipSchema).optional(),
|
|
32
|
+
groupInviteAllowlist: z.array(ShipSchema).optional(),
|
|
33
|
+
autoDiscoverChannels: z.boolean().optional(),
|
|
34
|
+
showModelSignature: z.boolean().optional(),
|
|
35
|
+
responsePrefix: z.string().optional(),
|
|
36
|
+
autoAcceptDmInvites: z.boolean().optional(),
|
|
37
|
+
autoAcceptGroupInvites: z.boolean().optional(),
|
|
38
|
+
ownerShip: ShipSchema.optional()
|
|
39
|
+
};
|
|
40
|
+
const TlonAccountSchema = z.object({ ...tlonCommonConfigFields });
|
|
41
|
+
const tlonChannelConfigSchema = buildChannelConfigSchema(z.object({
|
|
42
|
+
...tlonCommonConfigFields,
|
|
43
|
+
authorization: TlonAuthorizationSchema.optional(),
|
|
44
|
+
defaultAuthorizedShips: z.array(ShipSchema).optional(),
|
|
45
|
+
accounts: z.record(z.string(), TlonAccountSchema).optional()
|
|
46
|
+
}));
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region extensions/tlon/src/doctor.ts
|
|
49
|
+
const tlonDoctor = {
|
|
50
|
+
legacyConfigRules,
|
|
51
|
+
normalizeCompatibilityConfig
|
|
52
|
+
};
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region extensions/tlon/src/session-route.ts
|
|
55
|
+
function resolveTlonOutboundSessionRoute(params) {
|
|
56
|
+
const parsed = parseTlonTarget(params.target);
|
|
57
|
+
if (!parsed) return null;
|
|
58
|
+
if (parsed.kind === "group") return buildChannelOutboundSessionRoute({
|
|
59
|
+
cfg: params.cfg,
|
|
60
|
+
agentId: params.agentId,
|
|
61
|
+
channel: "tlon",
|
|
62
|
+
accountId: params.accountId,
|
|
63
|
+
peer: {
|
|
64
|
+
kind: "group",
|
|
65
|
+
id: parsed.nest
|
|
66
|
+
},
|
|
67
|
+
chatType: "group",
|
|
68
|
+
from: `tlon:group:${parsed.nest}`,
|
|
69
|
+
to: `tlon:${parsed.nest}`
|
|
70
|
+
});
|
|
71
|
+
return buildChannelOutboundSessionRoute({
|
|
72
|
+
cfg: params.cfg,
|
|
73
|
+
agentId: params.agentId,
|
|
74
|
+
channel: "tlon",
|
|
75
|
+
accountId: params.accountId,
|
|
76
|
+
peer: {
|
|
77
|
+
kind: "direct",
|
|
78
|
+
id: parsed.ship
|
|
79
|
+
},
|
|
80
|
+
chatType: "direct",
|
|
81
|
+
from: `tlon:${parsed.ship}`,
|
|
82
|
+
to: `tlon:${parsed.ship}`
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region extensions/tlon/src/channel.ts
|
|
87
|
+
const TLON_CHANNEL_ID = "tlon";
|
|
88
|
+
const loadTlonChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-CDY2BdfM.js"));
|
|
89
|
+
const tlonSetupWizardProxy = createTlonSetupWizardBase({
|
|
90
|
+
resolveConfigured: async ({ cfg, accountId }) => await (await loadTlonChannelRuntime()).tlonSetupWizard.status.resolveConfigured({
|
|
91
|
+
cfg,
|
|
92
|
+
accountId
|
|
93
|
+
}),
|
|
94
|
+
resolveStatusLines: async ({ cfg, accountId, configured }) => await (await loadTlonChannelRuntime()).tlonSetupWizard.status.resolveStatusLines?.({
|
|
95
|
+
cfg,
|
|
96
|
+
accountId,
|
|
97
|
+
configured
|
|
98
|
+
}) ?? [],
|
|
99
|
+
finalize: async (params) => await (await loadTlonChannelRuntime()).tlonSetupWizard.finalize(params)
|
|
100
|
+
});
|
|
101
|
+
const tlonConfigAdapter = createHybridChannelConfigAdapter({
|
|
102
|
+
sectionKey: TLON_CHANNEL_ID,
|
|
103
|
+
listAccountIds: listTlonAccountIds,
|
|
104
|
+
resolveAccount: resolveTlonAccount,
|
|
105
|
+
defaultAccountId: () => DEFAULT_ACCOUNT_ID,
|
|
106
|
+
clearBaseFields: [
|
|
107
|
+
"ship",
|
|
108
|
+
"code",
|
|
109
|
+
"url",
|
|
110
|
+
"name"
|
|
111
|
+
],
|
|
112
|
+
preserveSectionOnDefaultDelete: true,
|
|
113
|
+
resolveAllowFrom: (account) => account.dmAllowlist,
|
|
114
|
+
formatAllowFrom: (allowFrom) => allowFrom.map((entry) => normalizeShip(String(entry))).filter(Boolean)
|
|
115
|
+
});
|
|
116
|
+
const tlonChannelOutbound = {
|
|
117
|
+
deliveryMode: "direct",
|
|
118
|
+
textChunkLimit: 1e4,
|
|
119
|
+
resolveTarget: ({ to }) => resolveTlonOutboundTarget(to),
|
|
120
|
+
deliveryCapabilities: { durableFinal: {
|
|
121
|
+
text: true,
|
|
122
|
+
media: true,
|
|
123
|
+
replyTo: true,
|
|
124
|
+
thread: true,
|
|
125
|
+
messageSendingHooks: true
|
|
126
|
+
} },
|
|
127
|
+
...createRuntimeOutboundDelegates({
|
|
128
|
+
getRuntime: loadTlonChannelRuntime,
|
|
129
|
+
sendText: { resolve: (runtime) => runtime.tlonRuntimeOutbound.sendText },
|
|
130
|
+
sendMedia: { resolve: (runtime) => runtime.tlonRuntimeOutbound.sendMedia }
|
|
131
|
+
})
|
|
132
|
+
};
|
|
133
|
+
const tlonMessageAdapter = createChannelMessageAdapterFromOutbound({
|
|
134
|
+
id: TLON_CHANNEL_ID,
|
|
135
|
+
outbound: tlonChannelOutbound
|
|
136
|
+
});
|
|
137
|
+
const tlonPlugin = createChatChannelPlugin({
|
|
138
|
+
base: {
|
|
139
|
+
id: TLON_CHANNEL_ID,
|
|
140
|
+
meta: {
|
|
141
|
+
id: TLON_CHANNEL_ID,
|
|
142
|
+
label: "Tlon",
|
|
143
|
+
selectionLabel: "Tlon (Urbit)",
|
|
144
|
+
docsPath: "/channels/tlon",
|
|
145
|
+
docsLabel: "tlon",
|
|
146
|
+
blurb: "Decentralized messaging on Urbit",
|
|
147
|
+
aliases: ["urbit"],
|
|
148
|
+
order: 90
|
|
149
|
+
},
|
|
150
|
+
capabilities: {
|
|
151
|
+
chatTypes: [
|
|
152
|
+
"direct",
|
|
153
|
+
"group",
|
|
154
|
+
"thread"
|
|
155
|
+
],
|
|
156
|
+
media: true,
|
|
157
|
+
reply: true,
|
|
158
|
+
threads: true
|
|
159
|
+
},
|
|
160
|
+
setup: tlonSetupAdapter,
|
|
161
|
+
setupWizard: tlonSetupWizardProxy,
|
|
162
|
+
reload: { configPrefixes: ["channels.tlon"] },
|
|
163
|
+
configSchema: tlonChannelConfigSchema,
|
|
164
|
+
config: {
|
|
165
|
+
...tlonConfigAdapter,
|
|
166
|
+
isConfigured: (account) => account.configured,
|
|
167
|
+
describeAccount: (account) => describeAccountSnapshot({
|
|
168
|
+
account,
|
|
169
|
+
configured: account.configured,
|
|
170
|
+
extra: {
|
|
171
|
+
ship: account.ship,
|
|
172
|
+
url: account.url
|
|
173
|
+
}
|
|
174
|
+
})
|
|
175
|
+
},
|
|
176
|
+
doctor: tlonDoctor,
|
|
177
|
+
messaging: {
|
|
178
|
+
targetPrefixes: ["tlon"],
|
|
179
|
+
normalizeTarget: (target) => {
|
|
180
|
+
const parsed = parseTlonTarget(target);
|
|
181
|
+
if (!parsed) return target.trim();
|
|
182
|
+
if (parsed.kind === "dm") return parsed.ship;
|
|
183
|
+
return parsed.nest;
|
|
184
|
+
},
|
|
185
|
+
targetResolver: {
|
|
186
|
+
looksLikeId: (target) => Boolean(parseTlonTarget(target)),
|
|
187
|
+
hint: formatTargetHint()
|
|
188
|
+
},
|
|
189
|
+
resolveOutboundSessionRoute: (params) => resolveTlonOutboundSessionRoute(params)
|
|
190
|
+
},
|
|
191
|
+
message: tlonMessageAdapter,
|
|
192
|
+
status: createComputedAccountStatusAdapter({
|
|
193
|
+
defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID),
|
|
194
|
+
collectStatusIssues: (accounts) => {
|
|
195
|
+
return accounts.flatMap((account) => {
|
|
196
|
+
if (!account.configured) return [{
|
|
197
|
+
channel: TLON_CHANNEL_ID,
|
|
198
|
+
accountId: account.accountId,
|
|
199
|
+
kind: "config",
|
|
200
|
+
message: "Account not configured (missing ship, code, or url)"
|
|
201
|
+
}];
|
|
202
|
+
return [];
|
|
203
|
+
});
|
|
204
|
+
},
|
|
205
|
+
buildChannelSummary: ({ snapshot }) => {
|
|
206
|
+
const s = snapshot;
|
|
207
|
+
return {
|
|
208
|
+
configured: s.configured ?? false,
|
|
209
|
+
ship: s.ship ?? null,
|
|
210
|
+
url: s.url ?? null
|
|
211
|
+
};
|
|
212
|
+
},
|
|
213
|
+
probeAccount: async ({ account }) => {
|
|
214
|
+
if (!account.configured || !account.ship || !account.url || !account.code) return {
|
|
215
|
+
ok: false,
|
|
216
|
+
error: "Not configured"
|
|
217
|
+
};
|
|
218
|
+
return await (await loadTlonChannelRuntime()).probeTlonAccount(account);
|
|
219
|
+
},
|
|
220
|
+
resolveAccountSnapshot: ({ account }) => ({
|
|
221
|
+
accountId: account.accountId,
|
|
222
|
+
name: account.name ?? void 0,
|
|
223
|
+
enabled: account.enabled,
|
|
224
|
+
configured: account.configured,
|
|
225
|
+
extra: {
|
|
226
|
+
ship: account.ship,
|
|
227
|
+
url: account.url
|
|
228
|
+
}
|
|
229
|
+
})
|
|
230
|
+
}),
|
|
231
|
+
gateway: { startAccount: async (ctx) => await (await loadTlonChannelRuntime()).startTlonGatewayAccount(ctx) }
|
|
232
|
+
},
|
|
233
|
+
outbound: tlonChannelOutbound
|
|
234
|
+
});
|
|
235
|
+
//#endregion
|
|
236
|
+
export { tlonPlugin as t };
|