Skip to content

Slice 3: executor, agent-browser adapter, store, and tyto run - #7

Open
rvegajr wants to merge 1 commit into
slice-2/recipe-corefrom
slice-3/executor
Open

rvegajr wants to merge 1 commit into
slice-2/recipe-corefrom
slice-3/executor

Conversation

@rvegajr

@rvegajr rvegajr commented Sep 30, 2026

Copy link
Copy Markdown
Member

Stacked on #6. Spec sentences are in docs/IMPLEMENTATION.md §4 Slice 3, updated in this PR to match what was built. Hand-written recipes now replay with no model.

What

Core

  • executeRecipe: lint → render → one agent-browser batch → verify.
  • Exit codes: 0 hit, 3 miss, 64 bad params, 65 invalid recipe, 69 agent-browser missing, 70 internal, 75 session busy, 77 not approved.
  • Replay-session policy:
    • tyto-rx runs with Tyto's own agent-browser config via AGENT_BROWSER_CONFIG. agent-browser's source (flags.rs load_config) confirms that config replaces the user's entirely, so saved logins never load. It also runs with --allowed-domains.
    • tyto-rx-auth uses --restore main and runs only approved auth recipes.
  • Retry once, only on browser launch errors. 15 s overall deadline. 6 s action timeout.
  • New ports: BrowserRunner, RecipeStore, SessionLock, with fakes.
  • Recipes gain domains: CDN hosts the page may load from, added to the allowlist.

@tyto/agent-browser

  • Spawns the CLI with an argv array, never a shell string.
  • Sends batch steps as JSON on stdin and strips lifecycle noise.
  • Reports step failures without throwing; kills the child on abort.
  • Typed errors when the binary is missing or the output is unreadable.

@tyto/store

  • Recipe files are validated on save and load, written 0600 and atomically, and only kebab-case names are accepted.
  • O_EXCL session lock that reclaims locks whose holder process has died.
  • ensureReplayFiles writes the replay config (only executablePath copied from your config) and the policy {default: allow, deny: [download, upload]}.

@tyto/cli

  • tyto run, tyto test (regression cases), tyto recipes [--json | show | rm].
  • bin/tyto.mjs runs the TypeScript sources directly. New packages use erasableSyntaxOnly so that stays possible.

Tests

  • npm run check: 8 files, 73 tests, typecheck clean, gitleaks clean.

  • The adapter tests use a stand-in executable, so there's no browser or network.

  • npm run test:live (opt-in, real agent-browser, loopback page): 2 passed. A recipe hits, then misses after the page changes; a missing element fails in under 7 s.

  • Manual end to end, with a hand-written GitHub recipe, through the user's Edge:

    Case Result
    vercel-labs/agent-browser v0.38.1 ✅
    nodejs/node v26.10.0 ✅ (an older LTS release is listed first; the recipe follows the Latest badge)
    denoland/deno v2.9.7 ✅
    Missing repo Safe miss, exit 3
    --n two Exit 64
    tyto test 1/1 passed

    Runs took 1.4–2.1 s each, including a live GitHub page load.

🤖 Generated with Claude Code

Hand-written recipes now run with no model:

- core: executeRecipe (lint → render → one batch → verify), exit codes,
  the replay-session policy (tyto-rx with Tyto's own agent-browser config
  and a domain allowlist; tyto-rx-auth with saved logins only for
  approved auth recipes), launch-error retry, 15 s deadline, 6 s action
  timeout. New ports: BrowserRunner, RecipeStore, SessionLock, with fakes.
  Recipes gain `domains` for CDN hosts the page loads from.
- @tyto/agent-browser: spawns the CLI with an argv array, sends batch
  steps as JSON on stdin, strips lifecycle noise, kills on abort.
- @tyto/store: recipe files (validated on save and load, 0600, atomic),
  an O_EXCL session lock that reclaims dead holders, and the replay
  config/policy files.
- @tyto/cli: `tyto run`, `tyto test`, `tyto recipes [show|rm]`; bin runs
  the TypeScript sources directly.

Verified live with a hand-written GitHub recipe through the user's Edge:
correct Latest tags for three repos (including Node, where an older LTS
release is listed first), a safe miss for a missing repo, and exit 64 for
a bad param. Opt-in live tests cover hit-then-miss and a fast failure on
a missing element.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant