feat(scaffold): Tier 1 Items 1-3#1
Conversation
…, core interfaces Implements WSJF items 1-3 from the implementation plan: - Project scaffolding: package.json, tsconfig.json (strict), vitest, directory structure matching spec §4.3 - Config system: TOML parser (smol-toml), deep-merge defaults, validation with error aggregation - Core TypeScript interfaces: LLMProvider, AuthStatus, QuotaStatus, AgentEvent, ProviderCapability, CostTier, TaskContext, HandoffBundle, AuditEvent, ZoraConfig, ZoraPolicy, WorkerCapabilityToken Also includes: - MockProvider test fixture with configurable auth/quota/failure behavior - Sample config.toml and policy.toml test fixtures - 62 passing tests across 3 test suites (defaults, loader, mock-provider) TDD: tests written first, all green before commit. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…onboarding docs - Add .gitkeep to all empty src/ and tests/ subdirectories so directory structure is tracked in git per spec §4.3 - Add HANDOFF.md with build status, relay notes for next agent - Add policy presets doc (Safe/Balanced/Power) and web onboarding wizard spec - Update ONBOARDING_INSTALL.md with preset selection, scope, dry-run sections - Update README.md with links to new docs Tests: 62 passing | TypeScript: clean compile Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
CodeAnt AI is reviewing your PR. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing touches🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @ryaker, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request lays the essential groundwork for the Zora autonomous AI agent by establishing its core architectural components. It introduces a robust TypeScript type system for defining shared interfaces, a flexible TOML-based configuration engine for managing agent settings, and a comprehensive test infrastructure to ensure reliability. These changes provide the fundamental skeleton and nervous system upon which all future agent functionalities, such as LLM providers and execution loops, will be built. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
CodeAnt AI finished reviewing your PR. |
There was a problem hiding this comment.
Code Review
This pull request establishes a comprehensive foundation for the Zora project, including the project scaffolding, a robust TOML-based configuration system with validation, a detailed TypeScript type system, and a thorough test infrastructure with a well-designed mock provider. The code quality is excellent, with clear structure, modern TypeScript practices, and extensive test coverage. My review found only one minor issue related to a type definition not fully aligning with the documentation, which is a testament to the high quality of this foundational work.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Foundation scaffold: type system, config engine, and test infrastructure
Context
Zora is a long-running autonomous AI agent for macOS — multi-provider, capability-routed, memory-enriched. The v0.5 spec defines an N-provider architecture where users stack-rank LLM providers (Claude, Gemini, OpenAI, local models) and the router matches tasks to the best available provider based on capabilities and cost tiers, with automatic failover down the ranked list.
This PR establishes the foundation that everything else builds on: the TypeScript type system, the TOML-based config engine, and the test infrastructure. Nothing in this PR runs an LLM or executes tasks — it's the skeleton and nervous system that Items 4–11 will wire up.
What's in this PR
1. Project scaffolding
Toolchain: Node 20+, ESM (
"type": "module"), TypeScript 5.7 in strict mode withnoUncheckedIndexedAccessandnoUnusedLocals/noUnusedParameters, bundler module resolution, vitest for testing, tsx for dev execution.Directory structure matches spec §4.3 — every module has its home:
Empty directories tracked with
.gitkeepfiles so the full structure is visible to anyone cloning the repo.Single runtime dependency:
smol-tomlfor TOML parsing (zero transitive deps, 15KB). DevDeps aretypescript,vitest,tsx, and@types/node— nothing else.2. Core type system (
src/types.ts— 319 lines)Every interface, type alias, and enum that the codebase shares lives in one file. This is the contract that providers, the router, the orchestrator, the policy engine, and the CLI all agree on.
Key types and the spec sections they implement:
LLMProviderexecute()returnsAsyncGenerator<AgentEvent>for streamingAuthStatus/QuotaStatusAgentEventthinking,tool_call,tool_result,text,error,done)TaskContextHandoffBundleZoraConfigconfig.toml— agent, providers[], routing, failover, memory, security, steering, notificationsZoraPolicyWorkerCapabilityTokenProviderCapabilityreasoning,coding,creative,search, etc.) + custom stringsCostTier/RoutingMode/TaskComplexityDesign choices:
ProviderCapabilityis a union with(string & {})— you get autocomplete for the built-in tags but users can add arbitrary capability strings for custom providers without touching the type definition.LLMProvider.execute()returnsAsyncGenerator<AgentEvent>rather than a callback or observable — this gives the orchestrator naturalfor await...ofconsumption with backpressure, and makes testing trivial (justyieldevents in sequence).AgentConfig,RoutingConfig,FailoverConfig, etc.) — this keeps validation functions focused and lets future code import just the slice it needs.3. Config engine (
src/config/)Three files, clear responsibilities:
defaults.ts— Every default value from spec §7, exported as typed constants (DEFAULT_AGENT,DEFAULT_ROUTING,DEFAULT_FAILOVER, etc.) plusDEFAULT_CONFIGas the assembled whole. Also exports two validation functions:validateProviderConfig(p, index)— checks required fields (name, type, rank ≥ 1, non-empty capabilities, valid cost tier) with indexed error messagesvalidateConfig(config)— validates agent settings (parallel jobs, CPU/memory limits), routing mode enum + provider_only constraint, provider name/rank uniqueness among enabled providers, failover bounds, steering port rangeBoth return
string[]of error messages — empty array means valid. Errors are descriptive and reference the config path (e.g.,"providers[2].rank is required and must be a positive integer").loader.ts— TOML parsing and merge logic:deepMerge(target, source)— recursive object merge where arrays are replaced (not concatenated) and source wins on conflictsparseConfig(raw)— merges parsed TOML with defaults, handles TOML's[[providers]]array-of-tables syntax with per-provider defaultsloadConfig(path)— async file read → parse → validate → return or throwloadConfigFromString(toml)— same pipeline but from a string (used in tests)ConfigError— error class with.errors: string[]for aggregated validation failuresindex.ts— barrel re-exports.4. Test infrastructure
Mock provider (
tests/fixtures/mock-provider.ts) — A fullLLMProviderimplementation with:.executeCalls,.abortCalls,.authCheckCount,.quotaCheckCount)failAfterEventsoption for testing mid-execution failuresreset()to clear state between testsThis mock will be reused by every test that touches the router, orchestrator, failover controller, or execution loop. It's designed so tests never need to spawn real subprocesses.
Test config fixtures —
sample-config.toml(2-provider setup with Claude rank 1 + Gemini rank 2) andsample-policy.toml(filesystem + shell + actions + network rules).62 tests across 3 suites:
defaults.test.tsvalidateProviderConfigfor all required fields and edge cases,validateConfigfor routing modes, duplicate names/ranks, resource limits, failover boundsloader.test.tsmock-provider.test.ts5. Documentation (from GPT 5.2 session)
specs/v5/docs/POLICY_PRESETS.md— Safe/Balanced/Power preset definitions for onboardingspecs/v5/docs/WEB_ONBOARDING_SPEC.md— Local web wizard spec (localhost config UI)specs/v5/docs/ONBOARDING_INSTALL.md— Presets, scope, dry-run sectionsWhat's explicitly NOT in this PR
This is a foundation PR. These are all in scope for subsequent branches:
ClaudeProvider,GeminiProvidercome infeature/t1-claude-provider(Item 4)read_file,shell_exec, etc. come infeature/t1-core-tools(Items 5–6)feature/t1-execution-loop(Items 7–8)zora start,zora ask, etc. come infeature/t1-cli(Item 9)feature/t1-protections(Items 10–11)Design decisions worth noting
Single
types.tsfile — Not split per module. At 319 lines it's manageable, and having one import path (../types.js) prevents circular dependency headaches as the codebase grows. Can be split later if it exceeds ~500 lines.smol-tomlover@iarna/toml— Zero dependencies, smaller bundle, actively maintained, full TOML 1.0 spec compliance. The config file is the only user-facing file format in the system so the parser choice matters.Validation returns error arrays, not throws —
validateConfig()andvalidateProviderConfig()collect all errors in a single pass.ConfigErrorwraps them with a human-readable count message. This means users see all their config problems at once instead of fixing one, re-running, hitting the next one.Deep merge replaces arrays — When your TOML overrides
capabilities = ["coding"], you get exactly["coding"], not["reasoning", "coding", "creative", "coding"]. Array merge semantics cause subtle bugs in config systems.Provider defaults applied per-provider — Each
[[providers]]entry getsenabled: true,cost_tier: "metered",rank: 0as defaults before user values are applied. This means a minimal provider block only needsname,type,rank, andcapabilities.AsyncGenerator for execution — The
LLMProvider.execute()signature usesAsyncGenerator<AgentEvent>rather than callbacks or event emitters. This makes the orchestrator loop a simplefor await (const event of provider.execute(task))and testing is justyieldstatements in the mock.How to verify
What's next
Item 4: Claude Provider (
feature/t1-claude-provider) — ImplementClaudeProvideragainst theLLMProviderinterface using the@anthropic-ai/claude-agent-sdk. Mac session token auth,execute()as AsyncGenerator, dependency-injectedqueryFnfor testability.Full remaining Tier 1 roadmap: Items 4–11, estimated ~12 hours to a working single-provider agent that can
zora ask "write me a blog post"and produce output.