refactor: launch external tools without Room credentials or hook settings
A Launcher launch still opens the tool in the active workspace's folder, tracks its process, streams observed output and stops it. What it no longer does: - set WAGGLE_SIGNAL_EMIT, WAGGLE_SIDECAR_URL, HIVE_MIND_DATA_DIR or the Room identity variables (WAGGLE_RUN_ID, WAGGLE_ROOM_ID, WAGGLE_DANCE_TEAM_ID, WAGGLE_SENDER_ID, WAGGLE_RUN_TOKEN). Only the removed coding-agent hooks and the WaggleDance CLI read them. The external-process allowlist now admits WAGGLE_WORKSPACE_ID alone; - issue a run credential. Run tokens existed for Room workers (the dance CLI and OpenClaw's model calls), so the registry's credential store, the middleware's run-token bearer on /v1/chat/completions and the proxy's per-run model scope go. While an agent run with a model is active, the proxy still serves only the session bearer. The run record that a launch creates in the agent-run registry stays: it backs cancel from the Room canvas, which this change does not remove.
This commit is contained in:
@@ -27,12 +27,7 @@ const BASE_ENV_ALLOWLIST = new Set([
|
||||
|
||||
/** Explicit Waggle runtime metadata constructed by trusted launch code. */
|
||||
const WAGGLE_ENV_ALLOWLIST = new Set([
|
||||
'WAGGLE_WORKSPACE_ID', 'WAGGLE_WORKSPACE_PATH',
|
||||
'WAGGLE_RUN_ID', 'WAGGLE_ROOM_ID', 'WAGGLE_SENDER_ID',
|
||||
'WAGGLE_DANCE_TEAM_ID', 'WAGGLE_DANCE_URL', 'WAGGLE_RUN_TOKEN',
|
||||
'WAGGLE_CLI_NODE_PATH', 'WAGGLE_CLI_ENTRY',
|
||||
'WAGGLE_SIGNAL_EMIT', 'WAGGLE_SIDECAR_URL',
|
||||
'HIVE_MIND_DATA_DIR', 'NO_COLOR',
|
||||
'WAGGLE_WORKSPACE_ID',
|
||||
]);
|
||||
|
||||
/**
|
||||
|
||||
@@ -195,11 +195,7 @@ export interface LaunchOptions {
|
||||
* detection is the source of truth for where the tool lives.
|
||||
*/
|
||||
installedPath: string;
|
||||
/**
|
||||
* Workspace id to inject as `WAGGLE_WORKSPACE_ID` in the spawned
|
||||
* tool's environment. Hooks pick this up via workspace-resolver
|
||||
* for context-aware capture.
|
||||
*/
|
||||
/** Workspace id to inject as `WAGGLE_WORKSPACE_ID` in the spawned tool's environment. */
|
||||
workspaceId?: string;
|
||||
/**
|
||||
* Working directory for the spawned process. Defaults to the
|
||||
@@ -208,29 +204,6 @@ export interface LaunchOptions {
|
||||
cwd?: string;
|
||||
/** Extra arguments to pass to the binary. */
|
||||
args?: string[];
|
||||
/**
|
||||
* When true (default), inject `WAGGLE_SIGNAL_EMIT='1'` so the launched
|
||||
* tool's hive-mind hook emits discovery signals back to the sidecar
|
||||
* bus. This is what turns the detect→launch→hook→bus→UI pipeline on:
|
||||
* without it a dock-launched tool saves memory but stays silent on the
|
||||
* bus it was built to feed. Set `false` for a silent launch.
|
||||
*/
|
||||
signalEmit?: boolean;
|
||||
/**
|
||||
* Sidecar base URL injected as `WAGGLE_SIDECAR_URL` so the launched
|
||||
* tool's hook posts signals to the right loopback port (the emitter's
|
||||
* fallback is `http://127.0.0.1:3333`). Omit to let the hook use that
|
||||
* default. Callers (the /launch route) derive this from the loopback
|
||||
* address the UI itself reached.
|
||||
*/
|
||||
sidecarUrl?: string;
|
||||
/** Canonical Waggle/Hive Mind data root for launched hook processes. */
|
||||
dataDir?: string;
|
||||
/** Canonical collaboration identity for authenticated hook signals. */
|
||||
runId?: string;
|
||||
roomId?: string;
|
||||
/** Ephemeral credential accepted only by WaggleDance transport routes. */
|
||||
runToken?: string;
|
||||
/**
|
||||
* When true, launch in OBSERVED mode (piped stdio) so stdout/stderr can be
|
||||
* streamed to the dock. The process is tethered to the sidecar (dies on
|
||||
@@ -300,24 +273,6 @@ export function launchTool(opts: LaunchOptions): LaunchResult {
|
||||
if (opts.workspaceId) {
|
||||
waggleEnv.WAGGLE_WORKSPACE_ID = opts.workspaceId;
|
||||
}
|
||||
// Self-enabling: light the SignalBus this pipeline was built to feed.
|
||||
// Opt out with signalEmit:false for a silent launch.
|
||||
if (opts.signalEmit !== false) {
|
||||
waggleEnv.WAGGLE_SIGNAL_EMIT = '1';
|
||||
}
|
||||
if (opts.sidecarUrl) {
|
||||
waggleEnv.WAGGLE_SIDECAR_URL = opts.sidecarUrl;
|
||||
}
|
||||
if (opts.dataDir) {
|
||||
waggleEnv.HIVE_MIND_DATA_DIR = opts.dataDir;
|
||||
}
|
||||
if (opts.runId && opts.roomId && opts.runToken) {
|
||||
waggleEnv.WAGGLE_RUN_ID = opts.runId;
|
||||
waggleEnv.WAGGLE_ROOM_ID = opts.roomId;
|
||||
waggleEnv.WAGGLE_DANCE_TEAM_ID = `room::${opts.roomId}`;
|
||||
waggleEnv.WAGGLE_SENDER_ID = `run::${opts.runId}`;
|
||||
waggleEnv.WAGGLE_RUN_TOKEN = opts.runToken;
|
||||
}
|
||||
const env = buildExternalProcessEnv(deps.baseEnv, waggleEnv, deps.platform);
|
||||
// Observed mode: piped-stdio spawn that surfaces a live output handle.
|
||||
// Tethered to the sidecar (not unref'd) and tracked in-memory only.
|
||||
|
||||
Reference in New Issue
Block a user