我打造 ORBIT,因為看 Reddit 像一份工作
I built ORBIT because reading Reddit felt like a job
作者打造 ORBIT,將原本用來搜尋 Reddit 貼文及草擬回覆的工具,發展成 Chrome 側邊欄擴充功能,可閲讀及摘要網頁、操作瀏覽器和執行腳本。ORBIT 使用名為 OBT 的腳本語言,並有聊天和浮動機械人;作者表示,最初的 Reddit 工具每天為他節省一小時。
Okay so Reddit was the problem.
Every time I finished a project, launched a site, shipped something, I'd go to Reddit to see if people were talking about it. Not just reading. Replying. Finding the important posts out of two hundred, opening each one, reading through comments to see if it was worth a response, drafting something that doesn't sound like a bot. Do that for an hour and tell me how you feel.
I'm the kind of engineer who hates repeating the same task twice. So I built a scraper. That's it. That's what ORBIT started as. A Reddit scraper.
Every morning a notification went off. I opened it, hit scan, and it read the posts. It pulled out the ones that were actually worth my time. If I wanted to reply, it drafted something and I tweaked it to sound like a human before posting. If I didn't, I moved on.
It worked. It saved me an hour a day. That was enough at first.
Then Indie Hackers happened. Then dev.to. I read posts there but a lot of times I just wanted a summary. I didn't want to read a 2000 word post to find out it was a listicle. So I added chat. Gave it the ability to read the page and summarize.
Then the thing grew on me. It became personal. It was on my right side, every page, every tab. That's when I realized I wanted it to feel alive. So I built the floating bot. A small orb thing that sits on the screen, blinks, talks back. Not because it's needed. Because when something is always there, you want it to feel like it's there.
Then even that wasn't enough. Chat wasn't the interaction I wanted. I wanted commands. Something I could click and let it go. That's how OBT scripting got started. A tiny language that looks like shell commands but runs the browser. It compiles to an AST and executes through a proper interpreter. I didn't plan for it to become the center of the project but here we are.
The part people ask about
People ask what ORBIT actually does and I usually give a bad answer, because it's not one thing.
It reads pages. It summarizes. It clicks, types, fills forms, runs scripts, talks out loud, remembers what you told it. But the reason it's worth keeping open over just switching to a ChatGPT tab is that it's right there. On the page you're already on. You ask a question and you don't have to leave.
Switch tabs to get an answer once and you'll do it forever. Ask a question where you already are and you get used to it in a week. That "I got you" feeling is the whole product. Everything else is just features that make the feeling stick.
What broke
Now the part everyone skips.
The compiler nearly ended me.
I had Claude in the passenger seat and I still almost choked. String parsers, try blocks, run blocks, and mostly error handling. You'd think error handling is the easy part. It is not. It is the part that makes or breaks the language. Every command can fail in nine different ways and you have to decide which failures the user can catch and which ones they can't. Which ones are bugs and which ones are the user's fault. Which ones should stop the script and which ones should just log and move on.
I rebuilt the error system three times. The current version has typed error codes, run blocks with onThrow and onFinish, a throw statement, a registry that third party code can extend. It's the thing I'm proudest of now. It's also the thing that had me staring at a screen at 2am wondering why a caught timeout wasn't stopping the loop it was supposed to stop.
Then Google happened.
Chrome extensions are a minefield. The mic was in for a while. I had a voice input thing working. It crashed ORBIT every few hours. Not sometimes. Every few hours. I tried passing it from the real page into the extension, tried moving everything into the background worker, tried about four different workarounds. Every fix cost more than it gave. I stripped the mic out. It's gone. I don't miss it but I'd be lying if I said that didn't sting.
JS mode is still a mess. Google strictly blocks raw JS execution from extensions on a lot of pages and I haven't found a clean way around it yet. Some pages work. Some don't. It's the one feature I ship with an asterisk. I'm still working on it. That's the honest version.
The extension sandbox itself is a whole other problem. Anything you want to run needs to either happen in the side panel, in the content script inside the page, or in a background worker, and none of them can talk to each other the way you'd expect. I've written more message passing code than actual features at this point.
What's actually in it
ORBIT is a Chrome extension that lives in your side panel. It can chat, read pages, summarize, automate, run scripts, and there's a small floating bot that talks to you.
Under that there's a scripting language called OBT. It looks like this:
"use obt";
navigate "https://example.com";
wait 2;
click "Sign In";
focus --type selector "input[name='email']";
type "user@example.com";
press Enter;
var title = $run(get --type text --target selector "h1");
say "Page title: {$title}";
You can wrap commands in run blocks with onThrow and onFinish, throw your own typed errors, catch them by number or by name. There's $exec for JS logic in a sandboxed iframe, $run for capturing return values, ask for calling the AI from inside a script, dialog commands for alert, confirm, prompt. It does more than I planned for and it still surprises me when it works.
The whole thing took three months and two weeks.
That's not fast. I know people who would have shipped this in six weeks and shipped it worse. I also know people who would have shipped it in six weeks and shipped it better. I'm not sure which group I'm in. Somewhere in the middle, most days.
Where it's at
Nothing dramatic. I want people to try it and tell me what's broken. I want the JS mode problem solved eventually. I want the Reddit thing to keep working because it's the only reason any of this exists and I still use it every morning before I open my editor.
If you want to look at it: GITHUB ORBIT
I'm pushing a bug fix in the next two or three days and then calling it a stable release. Three months feels like a long time for one person to build a compiler, a browser agent, a scripting engine, a floating bot, and a Chrome extension at the same time. It also feels like I just started yesterday.
Reddit was the cause of ORBIT. Everything else came after.
來源:DEV Community · dev.to


