openclaw/src/globals.ts
kumarabhirup 52707f471d
refactor!: IronClaw v2.0 - external OpenClaw runtime
BREAKING CHANGE: Convert repository to IronClaw-only package with strict
external dependency on globally installed `openclaw` runtime.

### Changes

- Remove entire OpenClaw core source from repository (src/agents/*, src/acp/*,
  src/commands/*, and related modules)
- Implement CLI delegation: non-bootstrap commands now delegate to global
  `openclaw` binary via external contract
- Remove local OpenClaw path resolution from web app; always spawn global
  `openclaw` binary instead of local scripts
- Rename package.json scripts: `pnpm openclaw` → `pnpm ironclaw`,
  `openclaw:rpc` → `ironclaw:rpc`
- Update bootstrap flow to verify and install global OpenClaw when missing
- Migrate web workspace/profile logic to align with OpenClaw state paths
- Add migration contract tests for stream-json, session subscribe, and profile
  resolution behaviors
- Update build/release pipeline for IronClaw-only artifacts
- Update documentation for new peer + global installation model

### Architecture

IronClaw is now strictly a frontend/UI/bootstrap layer:
- `npx ironclaw` bootstraps OpenClaw (if missing), runs guided onboarding
- IronClaw UI serves on localhost:3100
- OpenClaw Gateway runs on standard port 18789
- Communication via stable CLI contracts and Gateway WebSocket protocol only

### Migration

Users must have `openclaw` installed globally:
  npm install -g openclaw

Existing IronClaw profiles and sessions remain compatible through gateway
protocol stability.

Refs: bootstrap_dev_testing, ironclaw_frontend_split, strict-external-openclaw
2026-03-01 16:11:40 -08:00

57 lines
1.2 KiB
TypeScript

let verboseEnabled = false;
let yesEnabled = false;
function isTruthyEnvValue(value: string | undefined): boolean {
if (!value) {
return false;
}
const normalized = value.trim().toLowerCase();
return normalized === "1" || normalized === "true" || normalized === "yes" || normalized === "on";
}
export function setVerbose(enabled: boolean): void {
verboseEnabled = Boolean(enabled);
}
export function isVerbose(): boolean {
return (
verboseEnabled ||
isTruthyEnvValue(process.env.OPENCLAW_VERBOSE) ||
isTruthyEnvValue(process.env.CLAWDBOT_VERBOSE)
);
}
export function shouldLogVerbose(): boolean {
return isVerbose();
}
export function setYes(enabled: boolean): void {
yesEnabled = Boolean(enabled);
}
export function isYes(): boolean {
return (
yesEnabled ||
isTruthyEnvValue(process.env.OPENCLAW_YES) ||
isTruthyEnvValue(process.env.CLAWDBOT_YES)
);
}
export function logVerbose(...args: unknown[]): void {
if (shouldLogVerbose()) {
console.error(...args);
}
}
export function info(...args: unknown[]): void {
console.log(...args);
}
export function warn(...args: unknown[]): void {
console.warn(...args);
}
export function danger(...args: unknown[]): void {
console.error(...args);
}