@openclaw/tlon 2026.5.2-beta.2 → 2026.5.3-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 (75) hide show
  1. package/dist/api.js +4 -0
  2. package/dist/channel-B4LtNGeZ.js +221 -0
  3. package/dist/channel-plugin-api.js +2 -0
  4. package/dist/channel.runtime-v-_0sHkJ.js +3584 -0
  5. package/dist/doctor-contract-W99wMbar.js +7 -0
  6. package/dist/doctor-contract-api.js +2 -0
  7. package/dist/index.js +18 -0
  8. package/dist/runtime-5FiW9E50.js +8 -0
  9. package/dist/runtime-api-C0hr1Rtn.js +4 -0
  10. package/dist/runtime-api.js +2 -0
  11. package/dist/setup-api.js +3 -0
  12. package/dist/setup-core-BUkZJ-MU.js +386 -0
  13. package/dist/setup-entry.js +11 -0
  14. package/dist/setup-surface-FxNMaluC.js +72 -0
  15. package/dist/test-api.js +2 -0
  16. package/package.json +15 -6
  17. package/api.ts +0 -16
  18. package/channel-plugin-api.ts +0 -1
  19. package/doctor-contract-api.ts +0 -1
  20. package/index.ts +0 -183
  21. package/runtime-api.ts +0 -17
  22. package/setup-api.ts +0 -2
  23. package/setup-entry.ts +0 -9
  24. package/src/account-fields.ts +0 -31
  25. package/src/channel.runtime.ts +0 -248
  26. package/src/channel.ts +0 -173
  27. package/src/config-schema.ts +0 -53
  28. package/src/core.test.ts +0 -278
  29. package/src/doctor-contract.ts +0 -9
  30. package/src/doctor.test.ts +0 -40
  31. package/src/doctor.ts +0 -10
  32. package/src/logger-runtime.ts +0 -1
  33. package/src/monitor/approval-runtime.ts +0 -363
  34. package/src/monitor/approval.test.ts +0 -33
  35. package/src/monitor/approval.ts +0 -286
  36. package/src/monitor/authorization.ts +0 -30
  37. package/src/monitor/cites.ts +0 -54
  38. package/src/monitor/discovery.ts +0 -68
  39. package/src/monitor/history.ts +0 -226
  40. package/src/monitor/index.ts +0 -1524
  41. package/src/monitor/media.test.ts +0 -91
  42. package/src/monitor/media.ts +0 -172
  43. package/src/monitor/processed-messages.test.ts +0 -58
  44. package/src/monitor/processed-messages.ts +0 -89
  45. package/src/monitor/settings-helpers.test.ts +0 -113
  46. package/src/monitor/settings-helpers.ts +0 -158
  47. package/src/monitor/utils.ts +0 -372
  48. package/src/runtime.ts +0 -9
  49. package/src/security.test.ts +0 -622
  50. package/src/session-route.ts +0 -40
  51. package/src/settings.ts +0 -391
  52. package/src/setup-core.ts +0 -228
  53. package/src/setup-surface.ts +0 -103
  54. package/src/targets.ts +0 -102
  55. package/src/tlon-api.test.ts +0 -589
  56. package/src/tlon-api.ts +0 -402
  57. package/src/types.ts +0 -160
  58. package/src/urbit/auth.ssrf.test.ts +0 -45
  59. package/src/urbit/auth.ts +0 -48
  60. package/src/urbit/base-url.test.ts +0 -48
  61. package/src/urbit/base-url.ts +0 -61
  62. package/src/urbit/channel-ops.ts +0 -145
  63. package/src/urbit/context.ts +0 -50
  64. package/src/urbit/errors.ts +0 -51
  65. package/src/urbit/fetch.ts +0 -42
  66. package/src/urbit/foreigns.ts +0 -49
  67. package/src/urbit/send.test.ts +0 -38
  68. package/src/urbit/send.ts +0 -176
  69. package/src/urbit/sse-client.test.ts +0 -203
  70. package/src/urbit/sse-client.ts +0 -484
  71. package/src/urbit/story.ts +0 -332
  72. package/src/urbit/upload.test.ts +0 -154
  73. package/src/urbit/upload.ts +0 -60
  74. package/test-api.ts +0 -1
  75. package/tsconfig.json +0 -16
@@ -1,103 +0,0 @@
1
- import {
2
- applyTlonSetupConfig,
3
- createTlonSetupWizardBase,
4
- resolveTlonSetupConfigured,
5
- resolveTlonSetupStatusLines,
6
- } from "./setup-core.js";
7
- import { normalizeShip } from "./targets.js";
8
- import { resolveTlonAccount, type TlonResolvedAccount } from "./types.js";
9
- import { isBlockedUrbitHostname, validateUrbitBaseUrl } from "./urbit/base-url.js";
10
-
11
- const _channel = "tlon" as const;
12
-
13
- function _isConfigured(account: TlonResolvedAccount): boolean {
14
- return Boolean(account.ship && account.url && account.code);
15
- }
16
-
17
- function parseList(value: string): string[] {
18
- return value
19
- .split(/[\n,;]+/g)
20
- .map((entry) => entry.trim())
21
- .filter(Boolean);
22
- }
23
-
24
- export const tlonSetupWizard = createTlonSetupWizardBase({
25
- resolveConfigured: async ({ cfg, accountId }) => await resolveTlonSetupConfigured(cfg, accountId),
26
- resolveStatusLines: async ({ cfg, accountId }) =>
27
- await resolveTlonSetupStatusLines(cfg, accountId),
28
- finalize: async ({ cfg, accountId, prompter }) => {
29
- let next = cfg;
30
- const resolved = resolveTlonAccount(next, accountId);
31
- const validatedUrl = validateUrbitBaseUrl(resolved.url ?? "");
32
- if (!validatedUrl.ok) {
33
- throw new Error(`Invalid URL: ${validatedUrl.error}`);
34
- }
35
-
36
- let dangerouslyAllowPrivateNetwork = resolved.dangerouslyAllowPrivateNetwork ?? false;
37
- if (isBlockedUrbitHostname(validatedUrl.hostname)) {
38
- dangerouslyAllowPrivateNetwork = await prompter.confirm({
39
- message:
40
- "Ship URL looks like a private/internal host. Allow private network access? (SSRF risk)",
41
- initialValue: dangerouslyAllowPrivateNetwork,
42
- });
43
- if (!dangerouslyAllowPrivateNetwork) {
44
- throw new Error("Refusing private/internal ship URL without explicit network opt-in");
45
- }
46
- }
47
- next = applyTlonSetupConfig({
48
- cfg: next,
49
- accountId,
50
- input: { dangerouslyAllowPrivateNetwork },
51
- });
52
-
53
- const currentGroups = resolved.groupChannels;
54
- const wantsGroupChannels = await prompter.confirm({
55
- message: "Add group channels manually? (optional)",
56
- initialValue: currentGroups.length > 0,
57
- });
58
- if (wantsGroupChannels) {
59
- const entry = await prompter.text({
60
- message: "Group channels (comma-separated)",
61
- placeholder: "chat/~host-ship/general, chat/~host-ship/support",
62
- initialValue: currentGroups.join(", ") || undefined,
63
- });
64
- next = applyTlonSetupConfig({
65
- cfg: next,
66
- accountId,
67
- input: { groupChannels: parseList(entry ?? "") },
68
- });
69
- }
70
-
71
- const currentAllowlist = resolved.dmAllowlist;
72
- const wantsAllowlist = await prompter.confirm({
73
- message: "Restrict DMs with an allowlist?",
74
- initialValue: currentAllowlist.length > 0,
75
- });
76
- if (wantsAllowlist) {
77
- const entry = await prompter.text({
78
- message: "DM allowlist (comma-separated ship names)",
79
- placeholder: "~zod, ~nec",
80
- initialValue: currentAllowlist.join(", ") || undefined,
81
- });
82
- next = applyTlonSetupConfig({
83
- cfg: next,
84
- accountId,
85
- input: {
86
- dmAllowlist: parseList(entry ?? "").map((ship) => normalizeShip(ship)),
87
- },
88
- });
89
- }
90
-
91
- const autoDiscoverChannels = await prompter.confirm({
92
- message: "Enable auto-discovery of group channels?",
93
- initialValue: resolved.autoDiscoverChannels ?? true,
94
- });
95
- next = applyTlonSetupConfig({
96
- cfg: next,
97
- accountId,
98
- input: { autoDiscoverChannels },
99
- });
100
-
101
- return { cfg: next };
102
- },
103
- });
package/src/targets.ts DELETED
@@ -1,102 +0,0 @@
1
- type TlonTarget =
2
- | { kind: "dm"; ship: string }
3
- | { kind: "group"; nest: string; hostShip: string; channelName: string };
4
-
5
- const SHIP_RE = /^~?[a-z-]+$/i;
6
- const NEST_RE = /^chat\/([^/]+)\/([^/]+)$/i;
7
-
8
- export function normalizeShip(raw: string): string {
9
- const trimmed = raw.trim();
10
- if (!trimmed) {
11
- return trimmed;
12
- }
13
- return trimmed.startsWith("~") ? trimmed : `~${trimmed}`;
14
- }
15
-
16
- export function parseChannelNest(raw: string): { hostShip: string; channelName: string } | null {
17
- const match = NEST_RE.exec(raw.trim());
18
- if (!match) {
19
- return null;
20
- }
21
- const hostShip = normalizeShip(match[1]);
22
- const channelName = match[2];
23
- return { hostShip, channelName };
24
- }
25
-
26
- function makeGroupTarget(parsed: { hostShip: string; channelName: string }): TlonTarget {
27
- return {
28
- kind: "group",
29
- nest: `chat/${parsed.hostShip}/${parsed.channelName}`,
30
- hostShip: parsed.hostShip,
31
- channelName: parsed.channelName,
32
- };
33
- }
34
-
35
- export function parseTlonTarget(raw?: string | null): TlonTarget | null {
36
- const trimmed = raw?.trim();
37
- if (!trimmed) {
38
- return null;
39
- }
40
- const withoutPrefix = trimmed.replace(/^tlon:/i, "");
41
-
42
- const dmPrefix = withoutPrefix.match(/^dm[/:](.+)$/i);
43
- if (dmPrefix) {
44
- return { kind: "dm", ship: normalizeShip(dmPrefix[1]) };
45
- }
46
-
47
- const groupPrefix = withoutPrefix.match(/^(group|room)[/:](.+)$/i);
48
- if (groupPrefix) {
49
- const groupTarget = groupPrefix[2].trim();
50
- if (groupTarget.startsWith("chat/")) {
51
- const parsed = parseChannelNest(groupTarget);
52
- if (!parsed) {
53
- return null;
54
- }
55
- return makeGroupTarget(parsed);
56
- }
57
- const parts = groupTarget.split("/");
58
- if (parts.length === 2) {
59
- const hostShip = normalizeShip(parts[0]);
60
- const channelName = parts[1];
61
- return {
62
- kind: "group",
63
- nest: `chat/${hostShip}/${channelName}`,
64
- hostShip,
65
- channelName,
66
- };
67
- }
68
- return null;
69
- }
70
-
71
- if (withoutPrefix.startsWith("chat/")) {
72
- const parsed = parseChannelNest(withoutPrefix);
73
- if (!parsed) {
74
- return null;
75
- }
76
- return makeGroupTarget(parsed);
77
- }
78
-
79
- if (SHIP_RE.test(withoutPrefix)) {
80
- return { kind: "dm", ship: normalizeShip(withoutPrefix) };
81
- }
82
-
83
- return null;
84
- }
85
-
86
- export function resolveTlonOutboundTarget(to?: string | null) {
87
- const parsed = parseTlonTarget(to ?? "");
88
- if (!parsed) {
89
- return {
90
- ok: false as const,
91
- error: new Error(`Invalid Tlon target. Use ${formatTargetHint()}`),
92
- };
93
- }
94
- if (parsed.kind === "dm") {
95
- return { ok: true as const, to: parsed.ship };
96
- }
97
- return { ok: true as const, to: parsed.nest };
98
- }
99
-
100
- export function formatTargetHint(): string {
101
- return "dm/~sampel-palnet | ~sampel-palnet | chat/~host-ship/channel | group:~host-ship/channel";
102
- }