mirror of
https://github.com/nightly-labs/openbot.git
synced 2026-11-23 02:01:26 +08:00
main
33
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
03c2ff34c2 |
Remove code comments and add the no-comments rule (#12604)
* Remove code comments and add the no-comments rule Remove the comments from first-party code and configuration files: TS/JS, JSX, CSS, SQL migrations, Swift, Kotlin, Gradle, shell, Docker, systemd, Nix, YAML, TOML, JSONC and GritQL. Keep only what a tool reads: license headers, shebangs, compiler and lint directives, JSDoc types in plain .js files, generated file headers, GritQL scope lines, the install-server.sh help text and the openbot-boat-pre-stop marker. Vendored code, fixtures and released schemas keep their comments. Add the rule to AGENTS.md, and change the docs that asked for comments. Add two i18n keys that only comments named to RELEASED_SOURCE_KEYS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep comments that are data in strings The benchmark task files in opencode-free-models-bench.ts tell the model what each function must do. The sample file and HTML page in the two stories are display content. Put their comments back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep released migrations and mobile native inputs unchanged check:migrations compares each released migration with v0.73.0 byte for byte, so restore src/backend/migrations. A change to a native build input of apps/mobile makes a new runtime version, so restore those files and the extra fingerprint sources. List these files and the comment markers that a tool reads in AGENTS.md. Remove the last requests for comments in src/renderer/AGENTS.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
f6c76703bf |
Stop the whole Windows process tree of a dev service (#9692)
On Windows, the dev runner and `dev:stop` stopped a service with `process.kill(pid)`. That stops only the launcher (`bun run ...`), so Vite, workerd and Electron continued to run and kept the dev ports. - `signalOwnedProcess` with `scope: "group"` now runs `taskkill /pid <pid> /T /F` on Windows while the launcher still holds the tree, and once more when the first run fails part-way, as `src/backend/windows-process-tree.ts` does. - A pid's liveness on Windows uses signal 0. Before, a recorded pid was always "running" until the time limit. - On Windows, `dev:stop` stops the service trees before the supervisor. A signal ends the supervisor without its cleanup, and its launchers could then leave their trees with no parent. macOS and Linux keep the old order. Fixes #9421 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
b18b1471b3 |
Show a voice conversation as a pill at the top of the chat (#9580)
* Show a voice conversation as a pill at the top of the chat A voice conversation no longer opens a pane in the side panel. The voice button in the message box starts it, and a pill flows out of the top edge of the chat as liquid, as the agent dock flows out of the side. The pill shows the phase and has the mute, interrupt, speed and end buttons. The messages under it blur and fade, and the blur moves with the pill. The liquid shapes and springs of the agent dock move to `@openbot/ui/liquid`, and the morph of the Library pill to `@openbot/ui/morph-pill`, so the dock, the voice pill and the Library pill use one implementation. The first `bun run dev` of a worktree now prepares the local voice runtime. Refs #8434 * Stop the voice conversation when it is turned off, and keep End in view - A conversation that opens after End, or that is turned off in another way, now stops and releases the microphone. - End before the conversation opens now turns it off. - The pill stays while the conversation is on, also when its access ends. - The pill moves to the new centre when the chat width changes. - Screen readers announce a change of the phase. - LIQUID_PAD is in liquid.tsx. MorphPill has no unused edge or onClosed. - The dev start stops the voice runtime download after 5 minutes. * Keep a voice conversation on when its chat closes, and keep the dock profile local - When the chat view closes, a transcribed conversation stops, but it stays on. It starts again when the chat opens again, as before. - The dev start always runs the voice runtime script. The script repairs a partial or old runtime. - The dock profile is again in agent-dock-motion.ts. liquid.tsx keeps only the parts that the dock and the voice pill share. * Remove the voice caption state that nothing reads The voice pane showed what the user said and what the agent said. The pill does not, so the heard and said accessors and the Codex live caption fields are removed. |
||
|
|
d3e7651b4a |
Tell the user to install OpenBot again when a program file is damaged (#7831)
* Tell the user to install OpenBot again when a program file is damaged The main process imports its packages statically. When a file of the installation was damaged, for example an empty package.json of Effect in app.asar.unpacked, the load stopped before any OpenBot code ran. The user saw only "A JavaScript error occurred in the main process". A new entry, src/main/start.ts, loads index.ts. When the load fails because a package manifest is not JSON, a module is missing, or a module is not JavaScript, a packaged app shows a dialog that says to install OpenBot again, with a button for the download page, and exits with code 1. A server writes the reason and exits. All other failures keep Electron's own report. Electron sends `ready` only after the entry has loaded, so the start order does not change. Fixes #7783 * Start the dev app through the same entry as the release The dev stack started Electron with out-dev-app/main/index.js, so a break in src/main/start.ts did not show in development. * Name the release note after the branch * Report a missing file of a CommonJS package as a damaged installation |
||
|
|
09d51d40ca |
Wait for a file import only in the chat that gets the file (#4440)
* Wait for a file import only in the chat that gets the file The composer kept one busy flag per server. A slow import, such as a large upload to a remote server, disabled Send in the chats of all agents on that server. The flag is now the set of chats that wait for an import, and each composer reads only its own chat. Fixes #4409 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Rename the release notes for the branch name Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Refuse a second web import, and check the edited chat for an import The web client ran imports one at a time. A second import waited and took the chat that was open when it started, and its stop button ended the first import. Now a second import fails with the message that desktop gives for a second upload. A queued message edit now checks the chat that it edits for an import, not the chat on screen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep a local dev host on the local Signal The top-level vars in apps/auth-api/wrangler.jsonc name the production Signal machines, and local `vite dev` reads them. Since #4309, the local API gave each dev host a production Signal home, which rejects a local ticket, so a dev host never connected over WebRTC. The local API also sent its auth events to the production Signal machines. dev-services now blanks REMOTE_SIGNAL_HOMES and REMOTE_AUTH_WEBHOOK_URLS when it starts the local Signal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Add the web app import change to the release notes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Remove the web import queue that the busy check made unused Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
c3c9c6f5cd |
Connect to a remote server faster and sync the rest later (#4360)
* Connect to a remote server faster and sync the rest later Measure the remote connect and sync with `bun run perf:remote`, then remove the serial waits that it found: - Desktop reads the host compatibility once after a WebRTC connect. - The first workspace reads go beside the compatibility read when the host protocol of the last visit is known. - Desktop and web show a saved workspace view (agents, models, sidebar layout and channel names, no message text) while the host connects. - Queue reads and panels load after the workspace is ready. - The agent list waits only until the host loads its agents. - Web: a server switch uses the online status connection of the target server, and the old session ends in the background. - Fewer effects run again while a workspace loads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Do not export the web connect types that no other file uses knip reported WebHostHandover, WebEarlyReads and WebConnectOptions as unused exports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep only the latest remote sync mark of each name The browser keeps User Timing marks until code clears them. A web tab that reconnects its status connections for days added more marks on each connect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
0086fc4eff |
Separate encrypted development settings from local defaults (#1580)
* Add shared development secrets with persistent local defaults * Replace the shared Stripe development key * Use encrypted development env and remove legacy state import * Document the two account environment files * Clarify shell overrides and production worktree setup |
||
|
|
c9d57e3f75 |
Keep dev registries out of TMPDIR and open a worktree profile by default (#1441)
* Make dev scripts reject unknown options Add one strict parser (`node:util` `parseArgs`, `strict: true`) in `scripts/script-arguments.ts`. `dev:seed`, `dev:reset`, `dev:verify`, `dev:bench`, and `dev:automation` use it. `--help` prints the usage and exits 0 before any side effect. An unknown option prints the usage and exits 2. Before this change, `dev:reset --help` deleted the dev profiles. `dev:reset` now refuses while a profile has a live `SingletonLock`. It checks all profiles before it deletes one, and prints each target before it deletes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep dev registries out of TMPDIR and open a worktree profile by default The instance and stack registries, the port lock and the remote handoff file now live in devRuntimeDirectory(): OPENBOT_DEV_REGISTRY_DIR, else ~/Library/Caches/OpenBot/dev on macOS, $XDG_RUNTIME_DIR/openbot-dev or ~/.cache/openbot/dev on Linux, and the same %LOCALAPPDATA% path as before on Windows. dev:status prints the directory it read. The handoff file is named after the stack supervisor pid, and the stack deletes it when it stops. bun run dev now opens the worktree profile. --shared opens the shared OpenBot Dev profile; --isolated is accepted and does nothing. No existing profile is deleted or changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep the port profile when --force starts beside this worktree's stack The running stack holds the worktree profile. A second Electron with the same profile fails requestSingleInstanceLock and quits. Choose the instance id after the conflict check: beside a stack of this worktree, set no worktree id, so the port allocation names a profile after the renderer port, as before. Move the choice into developmentInstanceIdForStart and test it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
f5c74c5c47 |
Close dev Slack tunnels when seeding fails (#1330)
The seed ran before the try that owns closeSlackTunnels. A seed that exits non-zero therefore threw out of main, and the cleanup never ran. The tunnels stayed open, and this process stayed alive because the tunnels are children with piped stdio. The supervisor pid in the dev stack record stayed live too, so the next start refused with "This worktree already runs a dev stack". The seed now runs inside that try. A failed seed closes the tunnels, so this process exits. The record holds no child pids on this path, so it is then a dead record and every read filters it out. The order of the side effects does not change. The seed still runs after the ports are published and after the tunnels, and still before any service starts. Co-authored-by: Aniruddha Adak <aniruddhaadak80@users.noreply.github.com> |
||
|
|
4bd31ab663 |
fix(scripts): support Windows binaries and directory modes in dev runner (#1215)
* fix(scripts): support Windows binaries and directory modes in dev runner * fix(scripts): resolve effective owner without getuid on win32 * fix(scripts): address review feedback on Windows dev runner * Make the Windows dev registry checks fail closed - Stop when the registry owner cannot be read. Compare SIDs in one PowerShell call, so localized account names do not cause a refusal. - Ignore children of a process that reused a dead leader pid. - Show netstat on Windows in place of lsof. - Import cliSpawnTarget directly and remove the dead APPDATA copy. - Restore the comments that the earlier change cut or moved. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Check write access on Windows and quote batch arguments - Reject a Windows registry directory that grants write rights to an account other than this user, Administrators or SYSTEM, as the POSIX mode check does. Read the owner and the ACL in one PowerShell call. - Quote each argument that cliSpawnTarget passes through cmd.exe to a .cmd or .bat wrapper, so a space, a quote, & or % stays in its argument. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Count inherit-only write entries in the Windows registry check A registry record gets its permissions from the inherit-only entries of its directory, so an account with write access to new files only could still replace a record. Count these entries too. Trust CREATOR OWNER, because this user creates every record. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Sniezka1927 <dygons14@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
e9c0480677 |
Answer in Slack through the OpenBot app and a Slack Orchestrator agent (#1152)
* Let agents answer in Slack An agent connects to a Slack app that the user creates from a manifest. The host opens a Socket Mode connection, so it needs no public address and no cloud relay. Each Slack thread or direct message runs in its own execution thread of the agent. The agent answers in the thread, reads and sends files, and asks the requester for approvals with buttons. A reply of "stop" stops the request. - Add migration 24: projection_messaging_connections and projection_messaging_threads. - Keep the tokens encrypted with safeStorage in the main process. Only their state crosses IPC. - Add the messaging IPC group and the optional messaging-v1 Team API capability for admins. - Keep the platform-agnostic core apart from the Slack driver, so Discord and Telegram can follow. - Keep a hosted server awake while a Slack connection is live. Refs #1141 * Let OpenBot create each agent's own Slack app An OpenBot manager app creates one Slack app for each agent in a connected workspace. Slack sends the app's events to Signal, and Signal passes each request to the host's new ingress socket. The host checks Slack's signature with the app's signing secret, which stays on the host. - Signal: POST /v1/slack/events/:route, the ingress peer, and the slack-delivery frames. - auth-api: Slack route tokens, the manager OAuth, and /slack/connect. - Host: SlackIngress, the Events API transport, SlackManagedApps, and the slack-install and slack-workspace deep links. - UI: Add to Slack, Install in Slack, and the new connection states. - Docs: messaging, privacy, architecture, and the manager app requirements. The manual Socket Mode path stays. * Make OpenBot-created Slack apps the only Slack path Remove the manual Slack app path: the token form, the manifest buttons, Socket Mode, the connectSlack and slack setup endpoints and routes, the managed flag, and the tokens_mismatch and socket_mode_off states. Every Slack connection is now an app that OpenBot creates, with events through Signal. The messaging E2E test now sends signed Events API requests. - UI: step 1 connects one Slack workspace, step 2 is Add to Slack. Every agent goes to the connected workspace. - At start, and before Install in Slack, each app moves to the host's current request URL and install address. - Disconnect workspace does not revoke a development token. - bun run dev:slack: the dev stack with cloudflared tunnels to Signal and to a dev-only sign-in listener, so an install returns to the dev app and not to an installed OpenBot. A configuration token in the ignored .env.slack-dev stands in for the manager token until Slack enrolls the manager app. The local Worker now reads the SLACK_* keys. * Let each agent's Slack app join public channels and use the agent's avatar - The app joins every public channel when its connection starts, and each public channel when it is created (channels:join scope, channel_created event). A private channel still needs /invite. - The settings view draws the agent's avatar as a 512 px PNG, and main sets it as the app icon with apps.icon.set. An icon that did not change is not sent again. The canvas image helpers move to avatar-canvas.ts for the share card and the icon. - Save the approval button tokens before the post: a button press can arrive before Slack answers the post. - Docs and privacy: every message of the joined channels passes through Signal; the host keeps only the ones that address the agent. * Bring a teammate's answer to a Slack request back to the Slack thread A request an agent sends from a Slack turn now carries the Slack origin (messagingReturn). The teammate's answer to it takes that origin, so it runs in the same Slack execution thread and the agent posts its answer there, instead of the answer landing in the agent's own chat. - MailboxStore.enqueue gives an answer the request's origin only when it goes to the requester alone. The field stays in the mailbox. - The follow-up turn keeps the original message's reactions, takes the other answers to the same request, and does not count against the Slack flood limits. The agent's main chat hides the request. - The Slack prompt tells the agent to end its turn after asking a teammate. Docs updated; new E2E case in messaging-service.test.ts. - Add docs/slack-in-production.md: how Slack agents look in production. * Delete an agent's Slack app reliably, and send its icon once - Disconnect still ends the connection when Slack refuses to delete the app, and now tells the person to delete it at api.slack.com/apps. The log names Slack's error code. - The app id is saved with the app's credentials, and deleting an agent deletes the apps of all its connections, installed or not. - The settings view draws and sends the app icon once per open, not on every status poll. * Open an agent's Slack install in the workspace that owns the app The agent's app exists only in the workspace that created it. The install URL now names that workspace (team), so Slack opens the install there and asks the person to sign in to it, instead of refusing it with invalid_team_for_non_distributed_app in another workspace. * Add the Slack manager app projects and the launch steps Slack CLI projects for the production and development manager apps in the openbotdev workspace, with the target manifests and the steps to launch agents in Slack. * Move Slack to Server settings > Connectors Remove the Slack page from the agent's right panel. Server settings > Connectors is now a list of GitHub and Slack. The Slack page shows the workspace and every agent with its Slack app, and adds an agent in four steps: agent, preview, create app, install. Add messaging.getSlackOverview, which lists the Slack connection of each agent on this computer. The workspace connect no longer takes an agent. * Answer in Slack through one OpenBot app, and let a router agent pick the agent Slack gives manager-app scopes only to its partners, so OpenBot cannot create an app for each agent. Now every workspace installs the one OpenBot app: - The Worker exchanges the install, links the workspace to the host that asked, and seals the bot token to that host. It keeps no token. - Signal checks Slack's signature with the app's signing secret, reads only the workspace ID, and passes the request to the ingress socket of the host that has a route ticket for that workspace. - On the host, a router agent picks the agent that answers each new conversation. The thread keeps that agent. Replies come from OpenBot. - Server settings > Connectors > Slack shows the workspace, the router agent and the agents that can answer. The manager-app code, the per-agent apps, messaging-v1 and the thread IPC are removed. None of them was released. Database migration 25 changes in place: it was not released either. * Describe Slack as one OpenBot app with a router agent Rewrite the messaging guide, the architecture notes, the privacy section, the glossary entry, the changelog and the launch steps for the one OpenBot Slack app. Remove the manager-app requirements and the old production page. * Record that the OpenBot Slack apps have the new manifest and icons * Let Signal accept both Slack apps, and upload the Slack secrets on deploy The test Worker uses the production Signal, so Signal checks a request against each signing secret in SLACK_SIGNING_SECRET. The deploy script uploads the Slack secrets when they are set. * Add the encrypted Slack app secrets for the Worker and Signal Production gets the OpenBot app's client and the new route key, whose public key joins REMOTE_TICKET_PUBLIC_JWKS. The test Worker gets the development app's client from .env.shared. Signal gets both apps' signing secrets. * Let a local install with the development Slack app return to the dev app bun run dev:slack also tunnels the local account API, which builds Slack's redirect URL from that tunnel origin (SLACK_DEV_PUBLIC_ORIGIN). The dev app names a loopback listener as the return address, so the grant reaches it and not an installed OpenBot. Only a development API takes a return address, and only one on 127.0.0.1. * Answer Slack through a Slack Orchestrator agent The Connect Slack dialog now has two steps: connect the workspace, then add the Slack Orchestrator on the model the user picks. The orchestrator is a normal agent with a standing remit and five starting memories. It receives every new Slack conversation, answers short requests, and gives other work to one teammate with send_message; the teammate's answer comes back to the Slack thread. A turn that only asked a teammate posts "A teammate is working on it". The one-shot model router and the "agents that can answer" list are gone. Without an orchestrator, Slack gets "No agent can answer here yet". Migration 25 is not released, so its columns change in place. * Let the OpenBot Slack app join every public channel by itself When a workspace connects, OpenBot joins every public channel it is not in, and each new public channel when Slack reports channel_created. The app asks for channels:join and the channel_created event again. A private channel still needs /invite. * Hide the Slack workspace section until a workspace is connected Not set up, the header's Connect Slack is the only step, so the empty workspace row repeated it. * Stop posting the host question notice in Slack threads A question the agent asks is still answered on the host; the Slack thread no longer gets "OpenBot asked a question. Answer it on the OpenBot host." * Bring the dev app to the front after a local Slack install A packaged build comes to the front through openbot://. The dev loopback listener now does the same. * Remove the Slack message preview from the connect dialog's last step * Put the Slack Orchestrator in a collapsed Integrations sidebar section Adding the orchestrator creates the sidebar section Integrations the first time, or reuses it, and assigns the agent to it. The renderer then collapses that section, so the orchestrator stays out of the user's own agents. * Fix knip and the preload type predicate check Remove exports that only their own module uses, list cloudflared as a host binary, and move the orchestrator reply predicate to contracts. * Fix review findings and the optional property ratchet Redact answers before Slack, keep a mention in an unlinked thread when the plain message arrives first, admit Slack requests one at a time for each agent, retry Slack after a failed start, and keep a route ticket for 5 minutes. * Keep a Slack workspace with its newest route ticket Signal remembers the issue time of the newest route ticket for each workspace and refuses an older one, so a host that lost a workspace cannot take its events back with a ticket that has not expired. * Revoke a Slack route when its workspace is unlinked or moved Each workspace in a route ticket carries the time D1 linked it. Unlink and link queue slack-route-revoked in the signed auth-event outbox, and Signal drops the route and refuses tickets with that link or an older one. * Confirm Slack links with the Worker after Signal starts Signal keeps route revocations in memory. For one route ticket lifetime after it starts, it asks /v2/remote/slack-route/validate which links of a ticket D1 still has, so a host that lost a workspace cannot take it back after a restart. * Simplify the Slack workspace row and update the launch steps Remove the access warning, the state pill and Pause from the Slack panel. The workspace row keeps Disconnect, and Reconnect or Resume when they apply. LAUNCH.md now lists the rollout order and what the deploy workflows do and do not upload. * Route Slack requests by app and workspace Each SLACK_SIGNING_SECRET entry names its app, and a request must name the app whose secret signed it. Route tickets, revocations and link checks carry the app ID, so the production and development apps can share a workspace. A malformed secret turns off only the Slack route. * Keep the Slack signing secret type inside the Signal config |
||
|
|
93905173c1 |
Support remote desktop on a Linux x64 host and on hosted servers (#1177)
* Support remote desktop on a Linux x64 host in an X11 session Build Sunshine and Moonlight Web for linux-x64 (recipe 14): X11 capture, software encoding, no tray. The Sunshine patch adds an XTest input backend (Xvfb reads no uinput device), links libcap when DRM is off, and adds a vaMapBuffer2 shim for libva 2.20 on Ubuntu 24.04. The gateway accepts a Linux host only in an X11 session. CI builds, publishes and verifies the linux-x64 artifact. The x64 AppImage bundles the runtime, and the hosted server template installs its system libraries. * Pin the recipe 14 remote desktop runtime with the Linux x64 artifact * Keep the hosting developer key on authorized account requests An object spread of a `Headers` object drops its entries, so the key from `withHostingDeveloperKey` did not reach the test Worker, and hosting showed as unavailable in `dev --hosting-test`. Packaged builds send no key. The hosting test stack also sets the dev remote role to "none": a dev role signs in with a code that only the local Worker returns. * Show only connected displays in a remote desktop session Sunshine also lists outputs that have no monitor. On an X server with a dummy driver it lists 16, and 15 got a width of 0, so the Team API refused the session response and remote control did not open. * Run a hosted server's OpenBot on the boat desktop OpenBot now starts on the lightdm session on :0, with openbox, so OpenBot remote desktop and the boat desktop viewer show the same screen. The start waits up to 2 minutes for :0 and then uses Xvfb. * Give the runtime smoke check a local display The runtime now shows only the Sunshine displays that match a local display. The smoke check gave no local display, so it found no display and failed. |
||
|
|
e4c676e4ce |
Pay with Stripe to create hosted OpenBot servers, and manage per-server billing (#1093)
* Add per-server billing management with the Stripe Customer Portal Desktop Settings has a Billing tab, and the web client has a Billing dialog in the account menu. The page shows one row for each server that the account pays for: the plan, the storage, the price and the renewal date. Each row has a menu to change, cancel or renew the plan. These actions open the Stripe Customer Portal. The page does not start a plan. The account server reads each subscription from Stripe when a signed webhook arrives, and links it to the account and server from the subscription metadata. It never moves a known Stripe customer to another account. Migration 0022 adds new tables only. Plan limits read getServerEntitlement only. * Add hosted OpenBot servers on boat An account can create an OpenBot server that runs in a boat sandbox. The server runs all the time, also when the user's computer is off. Only allowed accounts on the test Worker can use it. - Account Worker: create, start and delete sandboxes, boat webhooks, a cron that starts a stopped server again, and a single-use claim for the first sign-in (migration 0022). - Server: the first start redeems the claim, signs in and publishes the host. It publishes the host again after a failed start. - Desktop and web: a Hosted servers settings tab, and a start request when a connection to a stopped hosted server fails. - Shared UI: AddServerDialog with plans, currency, yearly billing and the setup progress (Storybook only for now). * Share encrypted Stripe sandbox keys for local development apps/auth-api/.env.shared holds the Stripe sandbox keys, encrypted with dotenvx. bun run dev:api decrypts them when DOTENV_PRIVATE_KEY_SHARED is available. Without the key, the Worker gets no Stripe value, not the ciphertext. * Pay with Stripe Checkout to create a hosted server The rail plus button opens the add server dialog when the account can create hosted servers. A plan opens Stripe Checkout. The Worker creates the boat sandbox only after the Stripe webhook confirms the plan. - Worker: create stores an awaiting_payment row and returns a Checkout URL; the subscription hook provisions, stops (plan ended, data kept) and resumes servers; delete cancels the plan now; the cron provisions a paid row after a missed hook and removes unpaid rows after 24 hours. - Renew: the checkout route makes a new plan for a server whose plan ended, and answers 409 while an unpaid plan is still open. - Desktop main opens only checkout.stripe.com URLs. The web client goes to Checkout in the same tab and reopens the dialog on return. - Settings: the create form is replaced by "Add server"; rows show the plan, "Waiting for payment" and "Plan ended" with Renew. - Stripe bootstrap: prices match the UI, --webhook-url, and deploy:test reads the sandbox keys first. * Open the add server dialog again after a web Stripe Checkout The Checkout return used ?server=<id>. The invitation link reader also reads 'server' and removes it first, so the web app lost the server and did not open the dialog. The return now uses ?hosted_server=<id>. * Follow Stripe plan changes and check every plan flow end to end - A Customer Portal plan change sets the plan, interval and currency of the server, and its size while it has no sandbox. - A renewed plan sets up again a server that has no sandbox. - A customer deleted in Stripe gets a new customer at the next Checkout. - A cancel with `cancel_at` shows as a cancel at the period end. - A stored subscription keeps its account; pending update events sync the plan. - The bootstrap makes the default Portal configuration: upgrades are invoiced at once, downgrades and shorter intervals start at the period end, and the quantity is fixed. - scripts/stripe-flows-e2e.ts checks renewal, failed renewal, cancel, plan change, renew, delete, another account's server and a deleted customer with test clocks. * Share the encrypted development boat API key The key creates real VMs, so the Stripe flow check now tells you to start the Worker with a fake boat key. * Run a paid hosted server on boat end to end - provision.sh: give the service user read and run access to the unpacked app. Under sudo the extract was mode 700, so OpenBot could not start. - openbot-hosted-server: keep the keyring in the state folder. A boat snapshot restore resets ~/.local/share/keyrings after the service starts, so the session was not stored. - OpenBot redeems the claim only when safeStorage works. The claim works one time, so a session that is only in memory left the server signed out after a restart. - Map the boat trial error trial_auto_stop_required to provider_billing. - stripe-flows-e2e: opt-in `boat` scenario. It pays, waits for sign-in and host publish, restarts the service to check the stored session, and deletes the server. * Keep the hosted server keyring in /srv to make resume fast After a resume, boat serves /home from a FUSE mount until the disk is restored. On that mount, gnome-keyring does not see the new link count after its backup link. Each keyring write then added 16,000 to 31,000 login.keyring.temp-* hard links. The next resume read that folder through the slow mount, and the keyring start took 25 s. The keyring is now in /srv/openbot-hosted. boat keeps changes in /srv and restores them before the service starts. A cleanup job removes leftover links if boat ever serves /srv from the mount too. Tested on one boat sandbox: 2 resumes on other machines, a stored secret stays, no temp links, 16-17 s from resume to the OpenBot start. * Fix the knip and release notes checks decodeBillingState is used only in billing-service.ts, so it is not exported. The release notes check used grep -q after another grep. grep -q stops at the first match, so with a long file list the first grep failed with a broken pipe, and pipefail reported that the PR has no notes. * Sort the icon exports Biome requires the exports in order. The knip failure hid this error in CI. * Fix exactOptionalPropertyTypes errors in the hosted server files The type ratchet allows no errors for this option in these files. A request leaves out body when it has none, the dialog controls send false in place of undefined, and two options accept undefined. * Connect the add server dialog to the contact address and the join dialog The dialog has a join link that opens the join dialog, and the contact button opens mailto:hello@openbot.run through a fixed openExternal destination. The rail plus button reads "Add a server" when the account can create hosted servers. * Retry a failed hosted server setup and resize a server after a plan change A paid server whose setup failed is set up again by a wake at once, and by the cron 10 minutes after each failure. A plan change keeps the new machine in pending_size. The Worker stops a running server and resumes it with the new boat type. A refused downgrade (type_too_small) keeps the old machine until the next plan change. * Record the boat resize test in the hosted server docs * Set the member limit of a server from its plan The Worker checks the limit of the host's plan when a user accepts an invite or a member is reactivated: Starter 3, Standard 10, Pro 25, and 3 with no plan. A downgrade removes no one. The host list gives memberLimit, and a plan change tells each active member to read the list again. Desktop, web and mobile show the limit. * Stop a hosted server after 15 minutes with no use The host reports use each minute while a client is connected or work runs. The cron stops a server with no use for 15 minutes and keeps its data. A wake resumes it with a 2 hour boat lease, and use extends the lease. * Refuse a secret that dotenvx did not decrypt in the Worker deploy Wrangler is at the repository root, and a missing private key left ciphertext in the environment, which the deploy uploaded as a secret. Add the encrypted test Worker webhook and site report secrets. * Run the boat e2e on the test Worker with a real Checkout The boat scenario pays on the Stripe Checkout page, connects the web client over Signal after setup, wake, resize and renew, and checks the idle stop. * Fix hosted server races, name boat sandboxes, and send account events - Keep plan_ended on a stopped server, so the owner can renew it. - Recover a create that stopped before boat answered, and delete a sandbox that no row owns. - Keep a sandbox ID that a create returns during a delete. - Read the sandbox state before a wake, so a missed webhook does not block it. - Close the Checkout before the cron removes an unpaid server; keep it if paid. - Cancel a plan again after the delete, for a payment that came during it. - Ignore a Stripe sync that is older than the stored state. - Name each boat sandbox openbot-<plan>-<email>-<server ID start>. - Send billing and hosted server events to OpenPanel from the Worker, with allowlisted values only. * Make hosted servers ready for the production Worker - Send the Stripe, boat and OpenPanel secrets from the production deploy job and from api:deploy. Refuse a pair with one value, and a Stripe key of the wrong mode. - Turn on the hosting switch in production. Nothing starts until the secrets are set. '*' in the allow list allows each account. - Take the OpenPanel server client ID as a secret, like the backfill. Account events use generation 8. - Count only the unpaid servers that the cron removes. - Document the production steps, the Stripe failed-payment setting, the sandbox names and the account events. * Fix hosted server UI races after payment and wake - The add server dialog reads the rail again while the new server connects on web. - The web wake stops after 60 transition replies, then waits 10 minutes per host. - The Settings list reads again when the window gets focus after the payment page. - The plus button uses the last availability, so a click does not wait for the network. - The yearly discount text comes from the catalog prices. * Fix hosted server start without the account server, member limits and wake - A hosted server that cannot reach the account server at start signs in again on the start retry. It does not spend its claim while the account server does not answer. - The preload keeps memberLimit, so a paid server shows its plan limit on desktop. - A wake with no session rejects and does not throw into the transport error listener. * Let a hosted server redeem its claim again after a lost response For 10 minutes after the first redeem, the same claim gives a new session and revokes the one before. A new setup of the server clears the redeem time, so its new claim works. * Reconnect the web client while a woken hosted server starts OpenBot A wake reply of running with an offline host means that OpenBot in the VM is not connected yet. The web client now reconnects for it too, with the same attempt limit, and a new outage counts from zero. * Send Signal clients to the host socket that said hello last A hosted server that its provider stops, for example for a resize, keeps its old Signal socket until the idle timeout. The resumed host says hello on a new socket, but Signal sent new clients to the old one for up to four minutes. The e2e harness now saves a screenshot when no peer connects. * Add the Signal reconnect fix to the release notes * Keep the account analytics action lists inside their module * Leave out unknown plan fields in the plan ended event * Fix the issues that the full code review found - Billing: a Stripe customer that the key does not know is treated as gone, so the account can check out again. A paid Checkout page stores its plan when the Worker closes it, so a server is set up also when each webhook delivery failed. - Hosting: a delete keeps a server whose Checkout was paid just now (409 hosted_server_paid). A failed resume gives the server summary to the client, not a 500. - Contracts: a hosted server name must be one that the team store accepts (6-32 characters and a valid host name). An unknown state or error from a newer Worker shows as an error, and the list still loads. - Desktop: a failed session write after the claim redeem fails the redeem, so the start retry redeems the claim again. - Renderer: the Hosted servers tab shows while the account has servers. The add server dialog keeps the request key of an unpaid server between openings, and keeps a failed payment return for the next opening. The web wake keeps its 10-minute pause only for 404 and 402. - Hosted VM: the OpenBot unit restarts also after a clean exit. - Docs: the test Worker secrets that api:deploy:test sets, the bootstrap key source, the allow list in the release notes, and the known limits of the claim and of a missing sandbox. * Keep the sandbox of a lost create and let a late VM sign in The claim is now an HMAC of the host ID with BOAT_WEBHOOK_SECRET, so a create retry sends the same body and boat returns the sandbox it made. The row stores a sandbox whose create the cron gave up on. A start of a VM that never signed in makes its claim work again for one hour. * Record the boat create replay probe * Fix the issues that the third code review found - Read the plan from the Price metadata when the lookup key moved, and read again the open plans whose period ended. - Use a new Worker-only HOSTED_CLAIM_SECRET for the claim. - Arm the claim again only while the VM has no live session, also after a revoke. Keep the template of the first create for each retry. - Find the sandbox of a lost create before a delete. - Keep the old session when the redeemed session cannot be saved. - Skip unreadable plans, servers and member limits, not the whole list. - Refresh the joined servers when a new server runs, and show the setup again when the dialog opens after the payment. - Read hosting access again when the account changes. - Stop the server start when the keyring does not unlock. - Keep the allow list a secret in CI, and correct the docs. * Document that an open app keeps a hosted server on * Delete the servers of each Stripe e2e scenario when it ends On the test Worker a paid server is a real boat VM. The scenarios kept their VMs, and setUp removed the old rows first, so a new run left VMs with no row. Now each scenario deletes its servers through the Worker, and setUp deletes an old VM before its row. The renew scenario used a name shorter than the 6-character limit. * Derive the claim key and add one setup command for hosting secrets - The Worker derives the claim key from REMOTE_TICKET_PRIVATE_JWK with HKDF. HOSTED_CLAIM_SECRET is removed. - `bun run hosting:setup --target=production|test` sets up the Stripe catalog, the Customer Portal, and the Stripe and boat webhooks. It stores the webhook signing secrets: production in the cloudflare-production GitHub Environment, test in apps/auth-api/.env.shared. - The Stripe bootstrap makes the new endpoint before it deletes the old one when it replaces it. - The test webhooks have new signing secrets, and the test boat webhook gets sandbox.hydrated. * Let each account buy a hosted server in production - The production vars in wrangler.jsonc set HOSTED_SERVERS_ALLOWED_USER_IDS to `*`. - The CI deploy, the deploy script and `hosting:setup` no longer send an allow list secret. - With no value, no account can create a server, so the test Worker keeps its list. * Show that a hosted server is a Linux machine Each plan card now starts with the fact "Linux machine", so a user knows that agents run Linux commands and apps there, not macOS or Windows ones. * Update the hosted server release note for open sign-up and Linux * Start hosted servers for routines and stop open idle apps from keeping them on - The server reports {inUse, nextRunAt}: at once when use starts, then at most each 5 minutes, and when the next routine run changes. This makes fewer D1 writes. - A connected client counts as use only for 1 hour after its last request or typing event. - The cron starts an idle server less than 10 minutes before its next routine run, once for each reported run, with the wake reason "schedule". It does not stop a server whose next run is that close. * Let developers create real hosted servers from a dev build - `bun run dev --hosting=test` signs the app in to the test account Worker, on one profile that all worktrees share. The test Worker makes a real boat VM that can reach its Worker and Signal. - The allow list takes account IDs or emails. - The test allow list is HOSTED_SERVERS_TEST_ALLOW_LIST in the encrypted .env.shared. `api:deploy:test` sets it and refuses `*`, so only the developers with the shared key can add an account. * Let each developer with the shared key create hosted servers from a dev build bun run dev --hosting=test decrypts HOSTED_SERVERS_DEVELOPER_KEY from the encrypted .env.shared. Main sends it with each hosted server request, and the test Worker lets the account create servers. No developer email list is necessary. Main removes the key from its environment at the start, so agents do not get it, and a packaged build never sends it. * Use the new boat API key for the test Worker and development * Use the one-year boat API key for the test Worker and development * Describe the shared paid boat account of the test and production Workers * Note boat auto-pay and machine prices for production hosting * Keep idle hosted servers stopped and deletions pending on boat failures - A failed lookup of a lost sandbox keeps the deletion pending. Only a request that boat refuses (400, 404, 422) ends it with no sandbox. - A background reconnect no longer starts a server that stopped for no use. Only the selected server with the app in focus starts, and a selected offline server starts at once. - The Stripe e2e setup stops when boat does not delete a VM that a run left. - The plan text no longer promises a server that runs all the time. * Offer renewal for a hosted server whose plan ended after a failed setup A server whose setup failed has no sandbox to stop, so it stays in error with plan_ended. Settings now shows Renew for it, not Start. * Keep a hosted server deletion pending on each failed sandbox lookup A refused create retry does not prove that the earlier create made no sandbox, because the template can be gone since. The cron asks again. * Keep the live Stripe keys encrypted in the production env file The GitHub Environment cloudflare-production stays the source for the CI deploy. This is the encrypted copy for a deploy from a computer with the production key. * Pass null for a missing developer key to the hosted server service The exactOptionalPropertyTypes ratchet allows no undefined for this option. * Start an idle hosted server from mobile, and renew or delete hosted servers on the web The web and mobile clients share the wake logic in @openbot/team-client/hosted-server-wake. The web Billing dialog lists the hosted servers, so a user can renew or delete a retained one. * Stop exporting AddServerCalls, which only AddServerOverlay uses |
||
|
|
c421343060 |
Seed a new dev profile, and give each OpenCode model its own efforts (#537)
* Seed the dev profile a start creates, on one development model A dev profile that no start has created opened the app on first-run setup with no agents and no chats: `bun run dev:prepare` seeded the worktree profile, but a setup that only ran `bun install` never reached it, and the shared `OpenBot Dev` profile was seeded by neither. `bun run dev` now seeds the profile the app child is about to open, and only when it does not exist yet. The profile comes from the app spec rather than the shared environment. A start whose default renderer port is busy takes the port as its instance id, so a decision made before port allocation seeds `OpenBot Dev` while the app opens `OpenBot Dev <port>`. The seeded agents and an agent created by hand now agree on one model. A dev build starts both on `opencode-go/muse-spark-1.3-contributor` at medium effort while the CLI lists it, and on the built-in `gpt-5.6-luna` otherwise; a packaged build is unchanged. It stands in for the built-in default only, so a preferred provider or a model the developer recorded still wins. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * Give each OpenCode model its own reasoning efforts The Effort menu offered `Medium` alone for every OpenCode model, including the ones that reason from `minimal` to `xhigh`. OpenCode publishes `thought_level` for the model its session is on, and model discovery opened one session and set no model, so the whole catalog carried that one answer. Discovery now selects each model on the same probe session and reads the efforts the agent publishes for it. A failed probe keeps the efforts the model had before, a time budget stops a slow agent from turning discovery into a timeout, and the session goes back to the model it opened on, so an agent that remembers a last used model is not moved by the sweep. A catalog that already describes each model's efforts in `session/new` is not asked again. An exact effort name now also wins over an alias. OpenCode lists `["minimal", "low", ...]`, where `minimal` reads as low effort as well, so a first-match map sent `minimal` whenever the user asked for low. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * Keep the reasoning probes inside the caller's model/list deadline The sweep started its own five second budget after `session/new`, and each selection was unbounded. An agent that answered slowly could reach the caller's timeout, which fails `model/list` and leaves the runtime on its previous catalog: empty on the first discovery, so the user got no models rather than imprecise efforts. Discovery now reads one deadline before the session opens and passes it to the sweep. The sweep ends at its budget or at the point that still holds the cleanup, each probe gives up after a second, and the restore of the session's own model is bounded as well. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * Bound the discovery cleanup, and keep the seed CLI from updating itself Model discovery still awaited an unbounded `session/close`. A sweep that ended near the caller's timeout could therefore lose a catalog it had already read. Discovery now works to a deadline set short of that timeout, and every request it makes -- probe, restore and close -- ends by it. The seed asks the OpenCode CLI for its catalog with the CLI's own `models` command. A managed binary inherited no `OPENCODE_DISABLE_AUTOUPDATE`, so seeding a profile could update the shared runtime out of the exact version the app verifies, and the app would download it again. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * Send a discovery request only while there is time to read it `#requestBefore` took a promise, so the caller started every request even when the deadline had passed. The request still reached the agent and still changed the session the sweep was about to give back, and a rejection after the deadline had no handler left to read it. It now takes the call itself and makes it only while time remains. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * Seed from the OpenCode the app itself would start The seed asked `resolveOpencodeCli` with no managed path, so it searched the repository's `build/` tree and the user's own installs. A computer whose only OpenCode came from OpenBot has neither, and the seed put four agents on Codex while the app started a new agent on the development model. It now reads the shared runtime store the app reads, so the seeded agents and an agent created by hand agree. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * Keep the seed tests away from the developer's own OpenCode Every seed call but one left the model to the resolver, which reads the real runtime store and PATH and then runs `opencode models`: the temporary home directory isolates the profile, not the CLI. The file took 12.8 seconds and answered differently on a computer with no OpenCode. Each call now names the fallback model, and the file takes 0.6 seconds. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
943060937a |
feat(opencode): Go key support, key dialog refresh, row badge (#523)
* fix(dev): strip Electron runtime flags from spawned children * feat(opencode): support Go subscription key instead of Zen * refactor(settings): minimalist OpenCode Go key dialog * feat(settings): key tier badge and Reconnect opens key dialog * feat(dev): exact role matching in dev-automation * refactor(contracts): free-tier ids as explicit product rule * fix(settings): keep keyless Connect/Restart, reconnect from key dialog * fix(settings): keep Sign in beside Connect/Restart on OpenCode row |
||
|
|
a5579047f8 |
feat(dev): make worktree dev stacks and ports conflict-free (#297)
* feat(dev): make worktree dev stacks and ports conflict-free Several worktrees run dev on this machine at once. Port selection was a probe followed by a bind seconds later, and nothing was written down in between, so two `bun run dev` calls started together both won 5173 and the unsuffixed `OpenBot Dev` profile with it - two Electron clients writing one SQLite file. - `scripts/dev-automation/port-allocation.ts` puts read, choose and publish behind one machine-wide lock (`wx` create, stale break, holder-matched release). - `scripts/dev-automation/stack-registry.ts` records every port and pid a stack holds. `findAvailablePort` skips a published port without probing it, because a stack that won a port has not bound it yet. - `scripts/dev-stack.ts` adds `dev:status` and `dev:stop`, which read pids from the registry instead of matching a process name. This worktree is the default scope; `--pid=` and `--all` are explicit. - `scripts/dev-storybook.ts` allocates Storybook through the same registry with `--exact-port`, so the announced port is the real one. - A second stack in one worktree is refused unless `--force`, and `--isolated` keys the profile to the worktree path. - `registry-files.ts` holds the owner-only directory checks, the atomic write and the recycled-pid liveness both registries need. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(dev): prove a pid is ours before the stop command signals it Four review findings on the worktree dev-stack work, and what each cost. The port allocation lock created the file and then wrote it, so a waiter could read it in the moment it held nothing, take it for abandoned and break it - two allocators in the critical section, which is the collision the lock exists to stop. The holder now goes into a staging file that is published with `link`, atomic and EEXIST when taken. An unreadable lock is no longer breakable on sight either: it must also have sat there past the stale window. And a waiter that runs out its wait beside a live holder now fails with that holder's pid instead of helping itself. `dev:stop` signalled anything `kill(pid, 0)` said was taken. Pids get recycled, so that is how a stop command sends SIGTERM to a stranger's program. `verifyRecordedProcess` answers live, gone or unverified - and unverified, a pid this machine cannot date, is not permission to signal. What it refuses to touch it reports, leaves running, keeps in the registry and exits non-zero for; `bun run dev:forget` drops such a record once the developer has dealt with the process. Same reasoning one level down: a process group that outlived its recorded leader is named in the report rather than signalled, because the pgid belongs to nobody now. A record was pruned as soon as its recorded pids were gone, which freed a port that a surviving group still held - electron-vite exits and the Electron it started keeps the renderer port. Liveness now includes the group. `dev:status` reports every stack, since the one holding the port this worktree wanted is a sibling's. `stop` and `forget` stay on this worktree. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(dev): serialize recovery of a stale port allocation lock Breaking a lock is an unlink, and unlink cannot be made conditional on what the path holds. Two waiters that read one dead holder both deleted: the first published a lock of its own and started allocating, and the second deleted that replacement and started beside it - the same two allocators on one set of ports that the lock exists to prevent. Recovery now happens behind a second file. Whoever takes it reads the lock again before deleting anything, so a waiter that arrives late finds the replacement instead of the dead holder it saw a moment ago. Nothing ever breaks that second file: it is held across a few syscalls with no await between them, and a leak costs recovery rather than correctness - allocators wait, then fail with a message naming the file. Age no longer breaks a live holder's lock either. An allocation is milliseconds of work, so a lock held for a minute means something is wrong, but wrong is not finished: the holder may be stopped in a debugger and about to step into the critical section. The developer gets an error naming the pid instead. What replaces the age arm is evidence rather than patience - `verifyRecordedProcess` dates the holder, so a pid recycled since the lock was taken reads as gone and one recycled pid can no longer wedge every dev start on this machine. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(dev): make port lock ownership a generation, not a path Recovering a lock whose holder had died still had to delete the path, and `unlink` cannot be made conditional on what the path holds. A recoverer that read a missing or dead lock could therefore remove a lock another allocator had published in the meantime, and both would allocate ports at once - the collision the lock exists to stop. Taking the lock now means creating the next numbered lock file with an exclusive create, so ownership is only ever decided by a step the kernel makes atomic. A dead holder's lock is superseded rather than removed, and the judgement about it decides when to move on, never who won. The break lock this replaces is gone. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(dev): never remove a port lock another allocator may still take The generation an allocator asks for is the highest lock file it saw plus one, and the scan and the exclusive create are separate steps. Sweeping the superseded lock files away therefore let the numbering run backwards over a plan already made against them: recover the lock a dead holder left at 1, take 2, release 2, and an allocator arriving now finds an empty directory and takes 1, while one that read the directory earlier still holds a plan for 2 and no longer collides with anybody. Both then allocate ports. A lock file is now removed by nothing but its own live holder, releasing it. An allocator that read our lock as the highest generation read it as live, so it waited instead of planning a generation above it - nothing holds a plan our removal could let back down. The lock a crashed holder left behind stays where it is; nothing reads it, and it is what keeps the numbering from coming back down to it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(dev): release a port lock by renaming it, never by deleting it Deleting our own lock on release still let a generation be handed out twice. The file need not be gone when another allocator *lists* it, only when it reads its contents: an allocator that listed our live lock and then found nothing there reads a null holder and a null age, judges it abandoned, and plans the generation above it - while the number it left behind goes to the next arrival, which no longer collides with that plan. Both then allocate. So no lock file is ever deleted now. Releasing renames it to `.released`, which gives up the claim in one step while the generation stays spoken for, and both suffixes count towards the numbering. A lock a crashed holder left behind is superseded where it lies. The files are tens of bytes in the per-user temporary directory, and the two registry readers beside them filter `.json`, so nothing else sees them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(dev): mark a released port lock in place, keeping its path occupied Renaming the lock aside kept its generation spoken for but freed the path, and the path is what `link` arbitrates over. An allocator that planned a generation and was descheduled before creating it could therefore create it after its previous holder had released, and enter beside whoever had since taken the generation above. The rule is now that once a lock path exists it stays, and nothing ever frees it. A lock's state lives in its contents: releasing writes a released marker to a staging file and renames that onto our own lock path, which replaces the contents in one step and leaves the path occupied on both sides of it. Reading a lock is a tri-state - claimed by a holder, released, or unreadable - and an unreadable one is left alone for the stale window to recover, because that path has to stay occupied too. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(dev): never delete a stack record from the read that judged it `readDevStackRecords` and `readDevInstanceRecords` read a record, decided it was dead, and then removed its path. The file can change in between: a supervisor publishes a detached child and is killed a moment later, and a reader holding the older view deletes the version *with* the child. The child keeps the ports and nothing records them, which is the collision the port lock exists to stop. A record this checkout cannot parse is the same hazard without a race - a sibling worktree on a newer branch writes a schema this one has not learned yet, and its stack is live. So reading only filters. A dead record's ports are free from the first read that finds it dead, and `bun run dev:forget` is what removes the file, reading past the liveness filter to reach records no other command reports. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(dev): date an instance record before dev:forget deletes it `forgetDevStack` matched instance records by pid alone. That was survivable while a dead stack record was pruned by the next read; now the record waits on disk for `bun run dev:forget`, the pids it names have had every chance to be recycled, and an instance record lives at `<service>-<pid>.json`, so the app that takes a pid writes over the record of the app that had it. `dev:forget` on the old stack deleted a running app's record, and it left `dev:automation instances` until its next start. `claimOnDevInstance` answers whose the record is. Each instance record dates itself - its `startedAt` is when that instance published - so `verifyRecordedProcess` holds it against the start time the kernel reports and a live instance is never a dead stack's, whatever pid it holds. The worktree is checked too: it is the cheaper half of the same question and it still answers where a pid cannot be dated. A record of this worktree that cannot be dated is kept and reported rather than guessed at. No timestamp is carried from the supervisor through electron-vite into the Electron main process to do this: the spawn and the publish are two events and would date differently. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(dev): prevent isolated worktree profile collisions Use prefixed full SHA-256 identifiers while preserving numeric profile ids. Cover the reproduced five-digit collision and remove repeated lock and cleanup commentary. Validation: regression test failed before the fix; 31 focused tests pass. Lint passes with eight existing mobile warnings; typecheck and isolated runner dry-run pass. --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
5359ed2642 |
Generate the development env file per checkout (#282)
* Generate the development env file per checkout `apps/auth-api/.env.dev` was committed encrypted, so running the app needed the maintainer's `DOTENV_PRIVATE_KEY_DEV` and a fork could not run `bun run dev` at all. Every value in it is derivable on the machine that runs it, so `scripts/development-secrets.ts` now writes one on first run: a fresh ES256 ticket key pair claiming the `openbot-remote-1` key ID that `wrangler.jsonc` pins, three 32-byte secrets, the development sign-in flag, and the blank SMTP set. The file is untracked and never overwritten, so an existing one keeps its secrets, and a maintainer's encrypted copy still works unchanged. `prepare-dev-environment.ts` generates before `bun install`, because the script needs node builtins only and both dev services load the file. Its `.env.keys` assertion is gone: only `.env.production` is still encrypted, and nothing in local development reads it. `dotenvx run` accepts a plaintext `-f` file with a missing `-fk` path, verified under `--redact --strict` too, so the launch commands need no change. `env:encrypt:dev` and `env:validate:dev` are removed — both operated on a file that is now plaintext and untracked. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * Say when the development env file was generated `prepareDevelopmentEnvironment` created the file silently, so a first `bun run dev` gave no sign that secrets had been written or where they live. It now returns the outcome and both entry points report a fresh file: `dev-services.ts` through its logger, the standalone script through stdout, since that one runs before `bun install` on a clean clone. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
799de8791a |
feat(dev): AI automation bridge over CDP plus ts-log logging package (#220)
* feat(dev): AI automation bridge over CDP plus ts-log logging package
- packages/logging: ts-log Logger with secret redaction, covered by tests
- scripts/dev-automation: snapshot/screenshot/click/type against the running dev app
- migrate console.* in main/backend/scripts to the redacting logger
* fix(dev-automation): drive the main window, not helper popups
CDP lists Dynamic Island surfaces in arbitrary order; prefer the bare
app URL so snapshot/screenshot/act always target the main window.
* docs(agents): point e2e smoke checks at dev:automation
* fix(review): bundle logging, stderr JSON, UA guard, cycle-safe logs, injectable test loggers
- main build bundles @openbot/logging like contracts (packaged startup)
- dev-automation CLI logs to stderr, stdout keeps pure JSON
- CDP refuses non-OpenBot targets; main-window pick covered by tests
- logging handles bigint/circular values without throwing
- team-api-server and dynamic-island accept an optional logger;
console spies replaced with injected or observed loggers
* fix(review): recipe bump, catalog literals, explicit port for mutations
- bump remoteDesktop.recipeVersion for the touched runtime scripts
- ts-log/playwright-core as literals: single-workspace deps per catalog rule
- click/type refuse a defaulted port; name the instance with --port=
* fix(review): redact serialized payloads, gate log levels, enforce noConsole
- redaction covers a payload that arrives as one string: quoted values are
consumed whole, `{"apiKey":"…"}` and `set-cookie:` shapes match, and a
scheme-prefixed `Authorization: Basic …` no longer leaks its base64
- redaction is idempotent, so a value passed through `toLogValue` and then
formatted no longer grows a stray `]`
- error message and stack are redacted at conversion, not only at format time
- logger honours a level threshold (`info` by default, `OPENBOT_LOG_LEVEL`
lowers it); dev-automation asks for `debug` to keep renderer console output
- Biome `noConsole` enabled for src, scripts and packages so the migration
cannot regress
- dev-automation: mutation gate extracted and tested, `ForeignBrowserError`
sentinel instead of message matching, one role list with the type derived
from Playwright, unused `waitForRole` dropped, `--text=` can clear a field
- remote-debugging port validated through `readDevelopmentRemoteDebuggingPort`
so main and automation agree on the range
- docs: restore rule 7 indentation, document the level and the lint rule
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(dev): tighten automation target selection and screenshot paths
Addresses the review findings on the CDP bridge and unbreaks CI.
- Diagnostics no longer print page titles or full URLs. `describeTarget`
reduces a target to origin + path for loopback pages and to
`scheme//host (external)` for anything else, so a visited page's query
string never reaches the log.
- `pickMainPage` could latch onto an embedded browser page. `isMainAppUrl`
now requires a loopback http(s) origin, no `surface` query and the bare
app route, and `findMainPages` refuses to guess when two candidates
match.
- `screenshot --out` accepted any path with no mutation flag.
`resolveScreenshotPath` keeps the destination inside the build directory
and requires a `.png` name.
- Revert the cosmetic logging edits to the three recipe-guarded runtime
scripts and `recipeVersion` back to 8: the bump guard fired on them,
and a bumped recipe with a stale `artifactRelease.inputDigest` fails
`parseNativeRuntimeLock` and 10 tests. Those files are exempted from
`noConsole` via an enabling override instead.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* feat(dev): make automation pick the right dev instance per worktree
Several worktrees run `bun run dev` on one machine, and only the first
gets 9333: `dev-services` walks the port upwards, so the second instance
answered on a port nobody wrote down and `dev:automation` drove the
wrong app.
- Each dev app and test client now publishes its worktree, profile,
renderer port, debugging port and pid to a registry in the per-user
temporary directory, and removes the record on shutdown. Reading prunes
records whose process is gone, so a killed instance never keeps
offering a port another one has taken.
- `dev:automation instances` lists what is live. Resolution prefers the
record of the worktree the command runs in, refuses to guess between
two, and accepts `--instance=<id>`, `--port=` or `--service=`.
- The mutation gate now asks whether the instance was *named* rather than
whether a port was typed. Another worktree's app stays readable and
is never clickable.
- Two review findings on target selection: the snapshot document carried
a raw `page.url()`, which on the app route can hold an OAuth code, so
it goes through the extracted `describeTarget`; and a visited local
site in an embedded browser view wore the same loopback origin and
bare path as the app, so a page is only driven when it carries the
`window.openbot` preload bridge and, when the registry named one, the
expected renderer port.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* feat(dev): let automation drive any dev window on purpose
The main-window restriction was a safe default that had turned into a
limit. Dev is where every flow has to be testable, embedded browser
views and Dynamic Island surfaces included.
- `dev:automation pages` lists every CDP target with an index and a
sanitized description.
- `--page=<index|url-substring>` drives any of them, overriding both the
bare-route filter and the preload-bridge probe. An empty selector is
refused rather than matching everything.
- Aiming at nothing still resolves the app window, and an ambiguous
selector prints the target list instead of guessing.
The guards that stay are the ones about hitting the wrong process, not
the wrong page: `--allow-mutations` and an instance that was named
rather than inferred.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(logging): bound the redaction patterns and redact snapshot text
Four review findings, and one the third one uncovered.
- `sk-` and friends matched inside ordinary words, so `risk-register`
logged as `ri[redacted]` and erased the part naming what failed. The
provider prefixes now need a token boundary.
- A quoted JSON `"key"` is redacted in the text fallback too, for a
payload too malformed to reparse structurally.
- The 100 KB reparse cap is gone: a long body is exactly where a secret
hides, and truncation keeps the first characters, which were the
unredacted ones.
- Removing that cap surfaced why it was there. `SECRET_LABEL` and `EMAIL`
both had unbounded affix runs, so every position in a long payload
consumed the rest of it and backtracked: 200 KB took 9.6s. Bounded, the
same payload takes 150ms and 2 MB takes 1.4s.
- The snapshot document carried the page title and the accessibility tree
verbatim, so a screen showing an API token exported it on stdout. Both
go through `redactText` before truncation, so a secret cannot survive
in the part that is kept.
- The registry record is written to a sibling and renamed into place. A
plain write truncates first, and a reader hitting that window deleted
the file as corrupt, leaving a freshly started instance undiscoverable.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(logging): stop treating prose as a credential assignment and bound conversion depth
- CREDENTIAL_ASSIGNMENT required an explicit = or : separator; bare whitespace
turned `SKILLS_ADMIN_TOKEN is missing` into `SKILLS_ADMIN_TOKEN [redacted] missing`.
- convertValue now stops at depth 32, so a deeply nested external payload cannot
overflow the stack and replace the failure the caller was reporting.
- dev:automation instances redacts profile and projectRoot on its stdout JSON,
the one registry field that did not pass through the logger.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* feat(dev-automation): add --wait-for, warn on cross-worktree ports, tighten redaction
- --wait-for=<role>,<name> settles on an accessible target before a capture and
after a click or a keystroke, so a flow no longer needs a snapshot loop.
- An explicit --port= stays authoritative, but says whose worktree it resolved
to when that is not this one; a mistyped digit was silent before.
- Registry directory 0700 and records 0600, created exclusively so a planted
staging path cannot redirect the write.
- Basic/Digest/Token only redact inside an Authorization context, so
'Token validation failed' survives; Bearer still matches anywhere.
- Error names, object keys and the String() fallback pass through redactText;
conversion is exception-safe and emits [unserializable] instead of throwing
from inside the logger.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(dev-automation): contain screenshots against symlinks and fail closed on an unsafe registry
- resolveScreenshotPath refuses a symlink anywhere between the build root and
the destination; the containment check was lexical and page.screenshot
follows links, so a read-only command could write outside the directory.
- The screenshot response reports a workspace-relative path, dropping the home
directory prefix, and refuses a name whose redacted form differs rather than
returning one the caller cannot reopen.
- Publishing a dev instance verifies the registry directory is owned by this
user and unreachable by other accounts, instead of swallowing a failed chmod.
A registry someone else can write lets them choose which CDP port a mutation
command trusts.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(dev-automation): validate the registry directory on read as well as on write
Only the writer failed closed on a directory other accounts can reach, so a
reader that never publishes trusted whatever it found there. A planted record
naming this worktree, a live pid and an attacker's CDP endpoint would have been
classified as the local instance a mutation may drive.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(dev-automation): hide non-app loopback paths and aim by CDP target id
A loopback origin does not make a page the app: an embedded view can serve a
callback on 127.0.0.1 whose path carries the code as a plain segment, which no
redaction rule recognizes. `describeTarget` now prints a path only for the
app's own routes and collapses anything else to its origin.
Aiming moves from an array index to CDP's target id. Each command opens its own
connection, so a window closing in between shifted every later position and
`--page=1` could drive a target nobody printed. Verified against a live dev
instance: a stale id now refuses instead of drifting to another window.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(dev-automation): redact renderer console before truncating, and verify instance process identity
Two review findings on the dev automation layer.
The renderer console handler sliced the message to 500 characters before
handing it to the logger, which redacts and only then truncates at 2000. A
cut could hand the log a prefix of a token short enough that no redaction
rule recognizes its shape - so the full text now goes to the logger.
`process.kill(pid, 0)` proves only that something holds that pid. A dev
instance killed with SIGKILL leaves its record behind, and a recycled pid
made that record - with its debugging port - look like this worktree's live
app, which is the one match `click` and `type` accept. Liveness now also
compares the process start time from `ps -o lstart=` against the record's
`startedAt`, and two live records claiming one debugging port keep only the
newest, which is what still fails closed where `ps` is unavailable.
Watched both new guards fail: removing the start-time comparison reds
"rejects a pid that was recycled after the record was published", and
returning the records unfiltered reds the port-collision test.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(dev-automation): keep a one-time code out of the snapshot document
`ariaSnapshot` prints what a control holds, and `redactText` cannot recognize
a login code: it is a handful of characters with no label and no secret shape.
The snapshot goes to stdout and lands in an agent transcript, so a code typed
by `type` without `--submit` left the machine.
`redactSensitiveSnapshotValues` now blanks what was entered into any node
whose accessible name reads as a one-time code, password, token or
credential - the inline value, and the unnamed text anywhere in its subtree.
Named nodes inside that subtree survive, because a developer still has to see
the control to aim `type` at it.
The subtree half is the part that matters for `OtpInput`: it clears the native
input on every keystroke and rebuilds the code as visible characters, so the
code never is the textbox value - it is loose text under the fieldset. That
fieldset was unnamed, leaving nothing for either consumer to recognize, so it
now carries `aria-label="One-time code entry"`: assistive tech announces the
context those characters belong to, and the redactor knows the subtree.
Watched all three guards fail: neutering the sensitive-name pattern reds both
snapshot tests, dropping the subtree rule reds the loose-character one, and
removing the fieldset name reds the OtpInput contract. Verified against the
live dev app that an ordinary textbox value still prints.
Surfaces touched: desktop renderer (OtpInput), dev automation scripts.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
|
||
|
|
9f46f81039 |
Enable mobile connections to OpenBot (#212)
* Add mobile connection support * Simplify application architecture and remove obsolete code * Improve application workflows and user interface behavior * Refine application workflows and user interface * Preserve mobile credentials until sign-out is confirmed * Harden mobile session cleanup and desktop binding validation |
||
|
|
be961969d7 |
Persist and restore the main app window position (#153)
* Persist main window position across launches * Preserve window bounds and refine process group shutdown handling * Use Electron-selected display when creating the window |
||
|
|
35925c2a7e |
Enable hosted sites in local development (#146)
* Enable hosted sites in local development * Preserve local site URLs in conversation markers |
||
|
|
b8bff15ed5 |
Add Expo mobile app and QR sign-in flow (#109)
* feat(mobile): set up Expo app and EAS * fix(mobile): hoist workspace dependencies * Remove hoisted Bun linker configuration * Remove mobile web platform support * Migrate mobile tooling from ESLint to Biome and TypeScript 7 * Set up mobile app foundation and native capabilities * Add OpenBot mobile sign-in and QR scanner * feat: add mobile connect sign-in * Fix mobile camera permissions and logo focus behavior * Serialize mobile session updates and throttle activity tracking * Confirm mobile connections with success feedback * Refresh mobile devices adaptively and clarify disconnect behavior * Prevent reuse of outstanding mobile auth tickets * Route mobile logout through dedicated session endpoint * Harden mobile authentication and session activity handling * Delete doubled license and increase qr pooling |
||
|
|
dd64382259 |
Fix dev Electron EIO dialogs during reload and shutdown (#123)
* Fix dev Electron shutdown errors * Keep Dynamic Island actions retryable during reload |
||
|
|
11ba3fc3e5 | Hide People communication by default (#69) | ||
|
|
2e0ca2561c |
Bundle provider CLIs and harden onboarding (#35)
* feat: bundle agent providers and improve onboarding * fix: isolate agent runtime lock validation * chore: restart CI * chore: retrigger CI |
||
|
|
597f45ac01 |
Connect agents marketplace (#32)
* Connect agents marketplace * Enhance installation flow * prod skills catalog * metadata * b |
||
|
|
5a26f77aa5 |
feat: add production Create Bot flow (#23)
Replace the old picker and chat onboarding with the complete FirstBotSetup flow, atomic Bot creation, rollback support, and updated Storybook coverage. |
||
|
|
62b666b887 | release: prepare v0.1.15 | ||
|
|
63b55606cf | feat: add Sunshine remote control and runtime delivery | ||
|
|
804af672d4 | Fix Biome anti-slop findings | ||
|
|
93646b714b | Publish the local OpenBot instance | ||
|
|
9815947a87 | feat: secure email team onboarding | ||
|
|
77eb17db3e | feat: add remote teams and encrypted auth environments |