Skip to content

Slice 9: compile with any OpenAI-compatible model - #13

Open
rvegajr wants to merge 1 commit into
slice-8/installfrom
slice-9/openai-compiler
Open

rvegajr wants to merge 1 commit into
slice-8/installfrom
slice-9/openai-compiler

Conversation

@rvegajr

@rvegajr rvegajr commented Sep 30, 2026

Copy link
Copy Markdown
Member

Stacked on #12. Spec sentences are in docs/IMPLEMENTATION.md §4 Slice 9. This is the last slice of the rebuild plan.

What

  • @tyto/llm
    • chatWithTools: OpenAI-compatible chat with tool calls, no vendor SDK.
    • Configurable request timeout.
    • TypeScript parameter properties replaced with fields. Node's strip-only mode rejects them, so this lets the CLI run the sources directly; erasableSyntaxOnly is now enforced for llm too.
  • @tyto/compiler: OpenAiCompatCompiler, a tool loop whose only tool runs tyto compile-tool:
    • with an argv array, never a shell (tested with d1; touch … and $(id) passed literally);
    • with stdin for drafts;
    • using the same private work folder as the Claude compiler;
    • with a turn limit.
  • CLI: TYTO_COMPILER=claude (default) or openai, with TYTO_BASE_URL, TYTO_MODEL and optional TYTO_API_KEY. Resolved lazily, so a bad setting only affects compile and repair.

Verified live with a local model (Qwen3-coder 30B via Ollama, $0)

  • Loopback compile test: passes in 42 s (Claude took 84 s on the same test).
  • Real Wikipedia task: compiled in 194 s, then 6/6 species correct with no model (0.38–0.71 s each).

Tests

  • npm run check: 23 files, 175 tests, typecheck clean, gitleaks clean.

🤖 Generated with Claude Code

- @tyto/llm: chatWithTools (OpenAI-compatible chat with tool calls, no
  vendor SDK) and a configurable request timeout; parameter properties
  replaced with fields so the CLI can run the sources directly
  (erasableSyntaxOnly now enforced for llm too).
- @tyto/compiler: OpenAiCompatCompiler — a tool loop whose only tool
  runs `tyto compile-tool` with an argv array (never a shell) and stdin
  for drafts; shares the private work folder with the Claude compiler.
- cli: TYTO_COMPILER=claude (default) | openai with TYTO_BASE_URL,
  TYTO_MODEL, optional TYTO_API_KEY; resolved lazily so a bad setting
  only affects compile and repair.

Verified live with a local model (Qwen3-coder 30B via Ollama, $0): the
loopback compile test passes in 42 s, and the real Wikipedia task
compiled in 194 s then answered 6/6 species correctly with no model.

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