clawrelay 0.3.0 → 0.3.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/package.json +1 -1
- package/src/onboarding.ts +5 -56
package/package.json
CHANGED
package/src/onboarding.ts
CHANGED
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
promptAccountId,
|
|
10
10
|
} from "openclaw/plugin-sdk";
|
|
11
11
|
import crypto from "node:crypto";
|
|
12
|
-
import { execSync } from "node:child_process";
|
|
13
12
|
|
|
14
13
|
const channel = "relay" as const;
|
|
15
14
|
|
|
@@ -75,56 +74,6 @@ function getExistingToken(cfg: OpenClawConfig, accountId: string): string | unde
|
|
|
75
74
|
return relay?.accounts?.[accountId]?.authToken;
|
|
76
75
|
}
|
|
77
76
|
|
|
78
|
-
function isSpriteEnv(): boolean {
|
|
79
|
-
try {
|
|
80
|
-
execSync('which sprite-env', { stdio: 'ignore' });
|
|
81
|
-
return true;
|
|
82
|
-
} catch {
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
async function setupSpriteService(prompter: WizardPrompter): Promise<void> {
|
|
88
|
-
if (!isSpriteEnv()) return;
|
|
89
|
-
|
|
90
|
-
const setup = await prompter.confirm({
|
|
91
|
-
message: 'Sprite environment detected. Set up service to expose the gateway?',
|
|
92
|
-
initialValue: true,
|
|
93
|
-
});
|
|
94
|
-
if (!setup) return;
|
|
95
|
-
|
|
96
|
-
try {
|
|
97
|
-
// Check if a service already exists
|
|
98
|
-
const existing = execSync('sprite-env services list', { encoding: 'utf-8' });
|
|
99
|
-
if (existing.includes('openclaw')) {
|
|
100
|
-
await prompter.note(
|
|
101
|
-
'An openclaw service already exists on this sprite.',
|
|
102
|
-
'Sprite Service',
|
|
103
|
-
);
|
|
104
|
-
} else {
|
|
105
|
-
execSync('sprite-env services create openclaw-gateway --cmd openclaw --args start --http-port 18789');
|
|
106
|
-
await prompter.note(
|
|
107
|
-
'Created sprite service: openclaw-gateway (port 18789)',
|
|
108
|
-
'Sprite Service',
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Check URL auth
|
|
113
|
-
const setPublic = await prompter.confirm({
|
|
114
|
-
message: 'Set sprite URL auth to public? (required for relay to connect without org token)',
|
|
115
|
-
initialValue: true,
|
|
116
|
-
});
|
|
117
|
-
if (setPublic) {
|
|
118
|
-
execSync('sprite url update --auth public');
|
|
119
|
-
}
|
|
120
|
-
} catch (err) {
|
|
121
|
-
await prompter.note(
|
|
122
|
-
`Failed to configure sprite service: ${err}\nYou can set it up manually later.`,
|
|
123
|
-
'Sprite Service',
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
77
|
export const relayOnboardingAdapter: ChannelOnboardingAdapter = {
|
|
129
78
|
channel,
|
|
130
79
|
|
|
@@ -219,9 +168,6 @@ export const relayOnboardingAdapter: ChannelOnboardingAdapter = {
|
|
|
219
168
|
authToken,
|
|
220
169
|
});
|
|
221
170
|
|
|
222
|
-
// --- Sprite service setup ---
|
|
223
|
-
await setupSpriteService(prompter);
|
|
224
|
-
|
|
225
171
|
// --- Next steps ---
|
|
226
172
|
await prompter.note(
|
|
227
173
|
[
|
|
@@ -237,8 +183,11 @@ export const relayOnboardingAdapter: ChannelOnboardingAdapter = {
|
|
|
237
183
|
"The gateway auth token is in your OpenClaw config under",
|
|
238
184
|
"gateway.auth.token (not the relay auth token above).",
|
|
239
185
|
"",
|
|
240
|
-
"
|
|
241
|
-
|
|
186
|
+
"On a sprite, expose the gateway with:",
|
|
187
|
+
" sprite-env services create openclaw-gateway \\",
|
|
188
|
+
" --cmd openclaw --args 'gateway --allow-unconfigured' \\",
|
|
189
|
+
" --http-port 18789",
|
|
190
|
+
" sprite url update --auth public",
|
|
242
191
|
"",
|
|
243
192
|
"Docs: https://github.com/kylemclaren/clawrelay",
|
|
244
193
|
].join("\n"),
|