Skip to content
Closed

closed #1507

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions bin/lib/onboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -2515,6 +2515,7 @@ async function createSandbox(
preferredInferenceApi = null,
sandboxNameOverride = null,
webSearchConfig = null,
enabledChannels = null,
) {
step(6, 8, "Creating sandbox");

Expand All @@ -2527,6 +2528,15 @@ async function createSandbox(
const getMessagingToken = (envKey) =>
getCredential(envKey) || normalizeCredentialValue(process.env[envKey]) || null;

// When enabledChannels is provided (from the toggle picker), only include
// channels the user selected. When null (backward compat), include all.
const enabledEnvKeys =
enabledChannels != null
? new Set(
MESSAGING_CHANNELS.filter((c) => enabledChannels.includes(c.name)).map((c) => c.envKey),
)
: null;

const messagingTokenDefs = [
{
name: `${sandboxName}-discord-bridge`,
Expand All @@ -2543,7 +2553,7 @@ async function createSandbox(
envKey: "TELEGRAM_BOT_TOKEN",
token: getMessagingToken("TELEGRAM_BOT_TOKEN"),
},
];
].filter(({ envKey }) => !enabledEnvKeys || enabledEnvKeys.has(envKey));
const hasMessagingTokens = messagingTokenDefs.some(({ token }) => !!token);

// Reconcile local registry state with the live OpenShell gateway state.
Expand Down Expand Up @@ -3570,7 +3580,7 @@ async function setupMessagingChannels() {
} else {
note(" [non-interactive] No messaging tokens configured. Skipping.");
}
return;
return found;
}

// Single-keypress toggle selector — pre-select channels that already have tokens.
Expand Down Expand Up @@ -3663,7 +3673,7 @@ async function setupMessagingChannels() {
const selected = Array.from(enabled);
if (selected.length === 0) {
console.log(" Skipping messaging channels.");
return;
return [];
}

// For each selected channel, prompt for token if not already set
Expand Down Expand Up @@ -3706,6 +3716,7 @@ async function setupMessagingChannels() {
}
}
console.log("");
return selected;
}

// ── Step 7: OpenClaw ─────────────────────────────────────────────
Expand Down Expand Up @@ -4448,7 +4459,7 @@ async function onboard(opts = {}) {
}
}
}
await setupMessagingChannels();
const enabledChannels = await setupMessagingChannels();

startRecordedStep("sandbox", { sandboxName, provider, model });
sandboxName = await createSandbox(
Expand All @@ -4458,6 +4469,7 @@ async function onboard(opts = {}) {
preferredInferenceApi,
sandboxName,
webSearchConfig,
enabledChannels,
);
onboardSession.markStepComplete("sandbox", { sandboxName, provider, model, nimContainer });
}
Expand Down
2 changes: 1 addition & 1 deletion test/onboard.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,7 @@ const { setupInference } = require(${onboardPath});

assert.match(
source,
/startRecordedStep\("sandbox", \{ sandboxName, provider, model \}\);\s*sandboxName = await createSandbox\(\s*gpu,\s*model,\s*provider,\s*preferredInferenceApi,\s*sandboxName,\s*webSearchConfig,\s*\);/,
/startRecordedStep\("sandbox", \{ sandboxName, provider, model \}\);\s*sandboxName = await createSandbox\(\s*gpu,\s*model,\s*provider,\s*preferredInferenceApi,\s*sandboxName,\s*webSearchConfig,\s*enabledChannels,\s*\);/,
);
});

Expand Down
Loading