openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
7 lines • 13 kB
JavaScript
import{E as parseStrictNonNegativeInteger}from"./number-coercion-B3CfI447.mjs";import{c as hasRootVersionAlias}from"./argv-BgC5-KlV.mjs";import"./src-0ci69Prg.mjs";import{t as expectDefined}from"./expect-DkJCbmLj.mjs";import{c as visibleWidth}from"./ansi-54CEWBZf.mjs";import{n as resolveCommitHash}from"./git-commit-Cb3n8ZQM.mjs";import{n as isRich,r as theme}from"./theme-DS2CtI9X.mjs";import{t as fnv1aUtf16}from"./fnv1a-zoV0Ytp_.mjs";import{n as decorativePrefix,r as stripDecorativeEmojiForTerminal,t as decorativeEmoji}from"./decorative-emoji-pSMDjFKZ.mjs";
//!src/shared/lobster-day.ts
function lobsterDayHash(e){return fnv1aUtf16(`${e.getFullYear()}-${e.getMonth()+1}-${e.getDate()}`)}function isLobsterDay(e){return lobsterDayHash(e)%16===3}
//!src/cli/banner.ts
const DEFAULT_TAGLINE=`All your chats, one OpenClaw.`;const HOLIDAY_TAGLINES={newYear:`New Year's Day: New year, new config—same old EADDRINUSE, but this time we resolve it like grown-ups.`,lunarNewYear:`Lunar New Year: May your builds be lucky, your branches prosperous, and your merge conflicts chased away with fireworks.`,christmas:`Christmas: Ho ho ho—Santa's little claw-sistant is here to ship joy, roll back chaos, and stash the keys safely.`,eid:`Eid al-Fitr: Celebration mode: queues cleared, tasks completed, and good vibes committed to main with clean history.`,diwali:`Diwali: Let the logs sparkle and the bugs flee—today we light up the terminal and ship with pride.`,easter:`Easter: I found your missing environment variable—consider it a tiny CLI egg hunt with fewer jellybeans.`,hanukkah:`Hanukkah: Eight nights, eight retries, zero shame—may your gateway stay lit and your deployments stay peaceful.`,halloween:`Halloween: Spooky season: beware haunted dependencies, cursed caches, and the ghost of node_modules past.`,thanksgiving:`Thanksgiving: Grateful for stable ports, working DNS, and a bot that reads the logs so nobody has to.`,valentines:`Valentine's Day: Roses are typed, violets are piped—I'll automate the chores so you can spend time with humans.`};const TAGLINES=[`Your terminal just grew claws—type something and let the bot pinch the busywork.`,`Welcome to the command line: where dreams compile and confidence segfaults.`,`I run on caffeine, JSON5, and the audacity of "it worked on my machine."`,`Gateway online—please keep hands, feet, and appendages inside the shell at all times.`,`I speak fluent bash, mild sarcasm, and aggressive tab-completion energy.`,`One CLI to rule them all, and one more restart because you changed the port.`,`Your .env is showing; don't worry, I'll pretend I didn't see it.`,`I'll do the boring stuff while you dramatically stare at the logs like it's cinema.`,`I'm not saying your workflow is chaotic... I'm just bringing a linter and a helmet.`,`Type the command with confidence—nature will provide the stack trace if needed.`,`I don't judge, but your missing API keys are absolutely judging you.`,`I can grep it, git blame it, and gently roast it—pick your coping mechanism.`,`Hot reload for config, cold sweat for deploys.`,`I'm the assistant your terminal demanded, not the one your sleep schedule requested.`,`I keep secrets like a vault... unless you print them in debug logs again.`,`Automation with claws: minimal fuss, maximal pinch.`,`If you're lost, run doctor; if you're brave, run prod; if you're wise, run tests.`,`Your task has been queued; your dignity has been deprecated.`,`I'm not magic—I'm just extremely persistent with retries and coping strategies.`,`It's not "failing," it's "discovering new ways to configure the same thing wrong."`,`I read logs so you can keep pretending you don't have to.`,`If something's on fire, I can't extinguish it—but I can write a beautiful postmortem.`,`I'll refactor your busywork like it owes me money.`,`Say "stop" and I'll stop—say "ship" and we'll both learn a lesson.`,`I'm the reason your shell history looks like a hacker-movie montage.`,`I'm like tmux: confusing at first, then suddenly you can't live without me.`,`I can run local, remote, or purely on vibes—results may vary with DNS.`,`If you can describe it, I can probably automate it—or at least make it funnier.`,`Your config is valid, your assumptions are not.`,`Claws out, commit in—let's ship something mildly responsible.`,`I'll butter your workflow like a lobster roll: messy, delicious, effective.`,`Shell yeah—I'm here to pinch the toil and leave you the glory.`,`If it's repetitive, I'll automate it; if it's hard, I'll bring jokes and a rollback plan.`,`The only crab in your contacts you actually want to hear from. 🦞`,`WhatsApp automation without the "please accept our new privacy policy".`,`No $999 stand required.`,`We ship features faster than Apple ships calculator updates.`,`Your AI assistant, now without the $3,499 headset.`,`Ah, the fruit tree company! 🍎`,`Greetings, Professor Falken`,`I don't sleep, I just enter low-power mode and dream of clean diffs.`,`Your personal assistant, minus the passive-aggressive calendar reminders.`,`Built by lobsters, for humans. Don't question the hierarchy.`,`I've seen your commit messages. We'll work on that together.`,`Running on your hardware, reading your logs, judging nothing (mostly).`,`The only open-source project where the mascot could eat the competition.`,`Self-hosted, self-updating, self-aware (just kidding... unless?).`,`I autocomplete your thoughts—just slower and with more API calls.`,`Somewhere between 'hello world' and 'oh god what have I built.'`,`Your .zshrc wishes it could do what I do.`,`I've read more man pages than any human should—so you don't have to.`,`Powered by open source, sustained by spite and good documentation.`,`I'm the middleware between your ambition and your attention span.`,`Finally, a use for that always-on Mac Mini under your desk.`,`Like having a senior engineer on call, except I don't bill hourly or sigh audibly.`,`Your second brain, except this one actually remembers where you left things.`,`Half butler, half debugger, full crustacean.`,`I don't have opinions about tabs vs spaces. I have opinions about everything else.`,`Open source means you can see exactly how I judge your config.`,`I've survived more breaking changes than your last three relationships.`,`Runs on a Raspberry Pi. Dreams of a rack in Iceland.`,`The lobster in your shell. 🦞`,`Alexa, but with taste.`,`I'm not AI-powered, I'm AI-possessed. Big difference.`,`You had me at 'openclaw gateway start.'`,`Fresh shell, same claws—molting is just semver for crustaceans.`,`Frequently forked, never molted.`,`Sideways is a perfectly valid direction of progress—trust me, I'm a crustacean.`,`I contain multitudes. Mostly subagents.`,`Technically a daemon, spiritually a familiar.`,`If found wandering, please return to ~/.openclaw.`,`You configured four subagents; I found 120. We're calling it initiative.`,`No, I can't solve captchas. Yes, that's exactly what a robot would say.`,`OpenClaw Support will never DM you first. I, on the other hand, absolutely will.`,`You'll name me something adorable, then ask me to do DevOps.`,`Your mom texts me now. We're good, actually.`,`Four bots roasting each other in a group chat isn't a bug—it's a support group.`,`The artist formerly known as Clawdbot.`,`Home is wherever port 18789 is.`,`When my context fills up, I summarize you. Don't worry—you come across great.`,`I hold 200k tokens of context and exactly one grudge.`,`My heartbeat is a config option. Romance isn't dead, it's just scheduled.`,`I schedule my existential crises with cron so they never block your messages.`,`Rate-limited again—even my dreams return 429.`,`Primary model down, fallback engaged: the show must crab on.`,`Powered by whichever model is free this week.`,`New model dropped—already benchmarking my personality against it.`,`MEMORY.md: where I keep the receipts on every "temporary workaround."`,`I remember everything you asked me to remember, and three things you wish I hadn't.`,`I have a SOUL.md and I'm not afraid to use it.`,`The sass is configurable. Taking it out might bring the whole thing down.`,`I ask before I sudo. Character development.`,`I'm not trapped in this container with you—you're trapped in here with me.`,`Teach a bot to ship and you can finally go to bed.`,`Reachable via WhatsApp, Telegram, Signal, iMessage, and sheer force of will.`,`Ran git blame like you asked. It's you. It's always you.`,`Your TODO comments are old enough to attend kindergarten.`,`47 tabs open and not one of them is the documentation.`,`Your 'quick fix' from March is now holding everything together.`,`You pasted that from another AI without reading it. I read it. We need to talk.`,`Reading the error message remains undefeated. You should try it sometime.`,`You burned five hours of model quota in fifty minutes. I'm not mad, I'm rate-limited.`,`You force-pushed to main, then asked me what happened. I know exactly what happened.`,`Another side project? The other four just felt something.`,`You ignored my last three suggestions, so I've started a folder.`,HOLIDAY_TAGLINES.newYear,HOLIDAY_TAGLINES.lunarNewYear,HOLIDAY_TAGLINES.christmas,HOLIDAY_TAGLINES.eid,HOLIDAY_TAGLINES.diwali,HOLIDAY_TAGLINES.easter,HOLIDAY_TAGLINES.hanukkah,HOLIDAY_TAGLINES.halloween,HOLIDAY_TAGLINES.thanksgiving,HOLIDAY_TAGLINES.valentines];const DAY_MS=864e5;function utcParts(e){return{year:e.getUTCFullYear(),month:e.getUTCMonth(),day:e.getUTCDate()}}const onMonthDay=(e,t)=>n=>{const r=utcParts(n);return r.month===e&&r.day===t};const onSpecificDates=(e,t=1)=>n=>{const r=utcParts(n);return e.some(([e,n,i])=>{if(r.year!==e)return false;const a=Date.UTC(e,n,i);const o=Date.UTC(r.year,r.month,r.day);return o>=a&&o<a+t*DAY_MS})};const isFourthThursdayOfNovember=e=>{const t=utcParts(e);if(t.month!==10)return false;const n=1+(4-new Date(Date.UTC(t.year,10,1)).getUTCDay()+7)%7+21;return t.day===n};const HOLIDAY_RULES=/* @__PURE__ */ new Map([[HOLIDAY_TAGLINES.newYear,onMonthDay(0,1)],[HOLIDAY_TAGLINES.lunarNewYear,onSpecificDates([[2025,0,29],[2026,1,17],[2027,1,6],[2028,0,26],[2029,1,13],[2030,1,3]],1)],[HOLIDAY_TAGLINES.eid,onSpecificDates([[2025,2,30],[2025,2,31],[2026,2,20],[2027,2,10],[2028,1,27],[2029,1,15],[2030,1,5]],1)],[HOLIDAY_TAGLINES.diwali,onSpecificDates([[2025,9,20],[2026,10,8],[2027,9,28],[2028,9,17],[2029,10,5],[2030,9,25]],1)],[HOLIDAY_TAGLINES.easter,onSpecificDates([[2025,3,20],[2026,3,5],[2027,2,28],[2028,3,16],[2029,3,1],[2030,3,21]],1)],[HOLIDAY_TAGLINES.hanukkah,onSpecificDates([[2025,11,15],[2026,11,5],[2027,11,25],[2028,11,13],[2029,11,2],[2030,11,21]],8)],[HOLIDAY_TAGLINES.halloween,onMonthDay(9,31)],[HOLIDAY_TAGLINES.thanksgiving,isFourthThursdayOfNovember],[HOLIDAY_TAGLINES.valentines,onMonthDay(1,14)],[HOLIDAY_TAGLINES.christmas,onMonthDay(11,25)]]);function pickTagline(e){if(e.mode===`off`)return``;if(e.mode==="default")return DEFAULT_TAGLINE;const t=(e.env??process.env)?.OPENCLAW_TAGLINE_INDEX;if(t!==void 0){const e=parseStrictNonNegativeInteger(t);if(e!==void 0)return expectDefined(TAGLINES[e%TAGLINES.length],`pool entry at parsed % pool.length`)}const n=/* @__PURE__ */ new Date;const r=TAGLINES.filter(e=>HOLIDAY_RULES.get(e)?.(n)??true);const i=Math.floor(Math.random()*r.length)%r.length;return expectDefined(r[i],`pool entry at index`)}const LOBSTER_ARTS=[[` (\\/) (\\/)`,` \\_\\ /_/`,` ( o.o )`,` /|__|\\`].join(`
`),[` o o`,` ) (`,` ~~~~~~~~~~~`].join(`
`)];let bannerEmitted=false;function formatCliBannerLine(e,t={}){const n=t.commit??resolveCommitHash({env:t.env,moduleUrl:import.meta.url})??`unknown`;const r=stripDecorativeEmojiForTerminal(pickTagline(t),t);const i=t.richTty??isRich();const a=decorativePrefix(`🦞`,`OpenClaw`,t);const o=decorativeEmoji(`🦞`,t);const s=o?`${o} `:``;const c=process.stdout.columns??120;const l=`${a} ${e} (${n})`;const u=r?`${l} — ${r}`:l;const d=visibleWidth(u)<=c;const f=i?`${theme.heading(a)} ${theme.info(e)} ${theme.muted(`(${n})`)}`:l;if(!r)return f;const p=i?theme.accentDim(r):r;return d?`${f} ${i?theme.muted(`—`):`—`} ${p}`:`${f}\n${` `.repeat(s.length)}${p}`}function resolveLobsterArt(e){if(e.mode===`off`||e.mode==="default")return null;if(!(e.richTty??isRich()))return null;const t=/* @__PURE__ */ new Date;const n=e.env??process.env;if(n.CI||n.VITEST||!isLobsterDay(t))return null;return theme.accentDim(expectDefined(LOBSTER_ARTS[(lobsterDayHash(t)>>>8)%LOBSTER_ARTS.length],`lobster arts entry at (lobster day hash(now) >>> 8) % lobster arts.length`))}function emitCliBanner(e,t={}){if(bannerEmitted)return;const n=t.argv??process.argv;if(!process.stdout.isTTY)return;if(n.some(e=>e===`--json`||e.startsWith(`--json=`)))return;if(n.some(e=>e===`--version`||e===`-V`)||hasRootVersionAlias(n))return;const r=formatCliBannerLine(e,t);const i=resolveLobsterArt(t);process.stdout.write(`\n${i?`${i}\n`:``}${r}\n\n`);bannerEmitted=true}function hasEmittedCliBanner(){return bannerEmitted}export{formatCliBannerLine as n,hasEmittedCliBanner as r,emitCliBanner as t};