chore: fix md lint
Some checks failed
CI / Lint (bash) (push) Has been cancelled
CI / Lint (markdown) (push) Has been cancelled
CI / Lint (nickel) (push) Has been cancelled
CI / Lint (nushell) (push) Has been cancelled
CI / Lint (rust) (push) Has been cancelled
CI / Code Coverage (push) Has been cancelled
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Build (macos-latest) (push) Has been cancelled
CI / Build (ubuntu-latest) (push) Has been cancelled
CI / Build (windows-latest) (push) Has been cancelled
CI / Benchmark (push) Has been cancelled
CI / Security Audit (push) Has been cancelled
CI / License Compliance (push) Has been cancelled
Some checks failed
CI / Lint (bash) (push) Has been cancelled
CI / Lint (markdown) (push) Has been cancelled
CI / Lint (nickel) (push) Has been cancelled
CI / Lint (nushell) (push) Has been cancelled
CI / Lint (rust) (push) Has been cancelled
CI / Code Coverage (push) Has been cancelled
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Build (macos-latest) (push) Has been cancelled
CI / Build (ubuntu-latest) (push) Has been cancelled
CI / Build (windows-latest) (push) Has been cancelled
CI / Benchmark (push) Has been cancelled
CI / Security Audit (push) Has been cancelled
CI / License Compliance (push) Has been cancelled
This commit is contained in:
parent
a8617c98e1
commit
ab6c097819
@ -2,7 +2,7 @@ Based on [write-good](https://github.com/btford/write-good).
|
||||
|
||||
> Naive linter for English prose for developers who can't write good and wanna learn to do other stuff good too.
|
||||
|
||||
```
|
||||
```text
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Brian Ford
|
||||
@ -24,4 +24,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
```
|
||||
```text
|
||||
|
||||
@ -62,10 +62,10 @@ docker push your-registry/typedialog-ci:latest
|
||||
# Update .woodpecker/ci.yml and ci-advanced.yml
|
||||
# Change: image: rust:latest
|
||||
# To: image: your-registry/typedialog-ci:latest
|
||||
```
|
||||
```text
|
||||
|
||||
**Size comparison breakdown**:
|
||||
```
|
||||
```text
|
||||
Original (Dockerfile):
|
||||
Base Debian + buildtools: 1.6GB
|
||||
Rust toolchain: 538MB
|
||||
@ -79,7 +79,7 @@ Optimized (Dockerfile.prebuilt):
|
||||
Binaries only: 140MB (no cargo cache)
|
||||
--------------------------------
|
||||
TOTAL: ~600MB
|
||||
```
|
||||
```text
|
||||
|
||||
### 3. Secrets Configuration
|
||||
|
||||
@ -102,14 +102,14 @@ The `release-docker.yml` pipeline requires access to Docker socket. Configure in
|
||||
```yaml
|
||||
# In Woodpecker server config
|
||||
WOODPECKER_BACKEND_DOCKER_ENABLE_PRIVILEGED: true
|
||||
```
|
||||
```text
|
||||
|
||||
**Option B: Volume mount** (recommended):
|
||||
Already configured in pipeline via:
|
||||
```yaml
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
```
|
||||
```text
|
||||
|
||||
Ensure Woodpecker agent has permission to access Docker socket.
|
||||
|
||||
@ -200,8 +200,8 @@ All release pipelines trigger on Git tags `v*` (e.g., `v0.1.0`).
|
||||
| Caching | ✅ Built-in | ⚠️ Server-side** |
|
||||
| SBOM | ✅ Auto-upload | ⚠️ Manual*** |
|
||||
|
||||
\* Multi-OS builds require multiple Woodpecker agents
|
||||
\*\* Configure in Woodpecker server settings
|
||||
\* Multi-OS builds require multiple Woodpecker agents
|
||||
\*\* Configure in Woodpecker server settings
|
||||
\*\*\* Manual upload to Gitea/Forgejo releases
|
||||
|
||||
## Triggering Pipelines
|
||||
@ -213,7 +213,7 @@ git push origin main
|
||||
# Release pipeline (manual tag)
|
||||
git tag v0.1.0
|
||||
git push origin v0.1.0
|
||||
```
|
||||
```text
|
||||
|
||||
**Selecting Release Pipeline**:
|
||||
|
||||
@ -228,7 +228,7 @@ Example:
|
||||
mv .woodpecker/release.yml .woodpecker/.release-basic.yml.disabled
|
||||
mv .woodpecker/release-advanced.yml .woodpecker/.release-advanced.yml.disabled
|
||||
mv .woodpecker/release-docker.yml .woodpecker/release.yml
|
||||
```
|
||||
```text
|
||||
|
||||
Or configure in Woodpecker UI to enable/disable specific pipelines.
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ cd typedialog
|
||||
|
||||
# Run full validation
|
||||
just check-all
|
||||
```
|
||||
```text
|
||||
|
||||
## Making Changes
|
||||
|
||||
@ -103,7 +103,7 @@ Open a GitHub Discussion first for:
|
||||
|
||||
See [SECURITY.md](SECURITY.md) for reporting process.
|
||||
|
||||
## Questions?
|
||||
## Questions
|
||||
|
||||
- Discussions: GitHub Discussions
|
||||
- Chat: (if applicable)
|
||||
|
||||
36
README.md
36
README.md
@ -3,7 +3,7 @@
|
||||
</div>
|
||||
|
||||

|
||||
|
||||
|
||||
# TypeDialog
|
||||
|
||||
> ▲ Create Type-Safe Interactive Dialogs.
|
||||
@ -69,7 +69,7 @@ cargo run --example form
|
||||
|
||||
# Run with defaults pre-loaded
|
||||
typedialog form config.toml --defaults defaults.json
|
||||
```
|
||||
```text
|
||||
|
||||
## Backends at a Glance
|
||||
|
||||
@ -89,7 +89,7 @@ typedialog text "Email" --format json
|
||||
|
||||
# Pre-populate form with defaults
|
||||
typedialog form schema.toml --defaults config.json --format json
|
||||
```
|
||||
```text
|
||||
|
||||
**Use for:** Scripts, CI/CD pipelines, server tools, piping between tools
|
||||
**See:** [`examples/04-backends/cli/`](examples/04-backends/cli/)
|
||||
@ -100,7 +100,7 @@ Full terminal UI with keyboard navigation and mouse support.
|
||||
|
||||
```bash
|
||||
cargo run -p typedialog-tui --example form_with_autocompletion
|
||||
```
|
||||
```text
|
||||
|
||||
**Use for:** Interactive dashboards, system administration tools, complex forms
|
||||
**See:** [`examples/04-backends/tui/`](examples/04-backends/tui/)
|
||||
@ -112,7 +112,7 @@ HTTP server with browser-based forms.
|
||||
```bash
|
||||
cargo run -p typedialog-web -- --config config/web/dev.toml
|
||||
# Open http://localhost:3000
|
||||
```
|
||||
```text
|
||||
|
||||
**Use for:** SaaS platforms, public forms, mobile-friendly interfaces
|
||||
**See:** [`examples/04-backends/web/`](examples/04-backends/web/)
|
||||
@ -127,7 +127,7 @@ typedialog-ai --config config/ai/dev.toml --query "How do I configure encryption
|
||||
|
||||
# Build knowledge graph
|
||||
typedialog-ai --config config/ai/production.toml --build-graph ./docs
|
||||
```
|
||||
```text
|
||||
|
||||
**Use for:** Documentation search, context-aware assistance, knowledge retrieval, semantic search
|
||||
**Features:**
|
||||
@ -162,7 +162,7 @@ Create `hello.agent.mdx`:
|
||||
---
|
||||
|
||||
Say hello to {{name}} in a warm and friendly way!
|
||||
```
|
||||
```text
|
||||
|
||||
Run it:
|
||||
|
||||
@ -170,7 +170,7 @@ Run it:
|
||||
typedialog-ag hello.agent.mdx
|
||||
# Prompts: name (String): Alice
|
||||
# Output: Hello Alice! It's wonderful to meet you! ...
|
||||
```
|
||||
```text
|
||||
|
||||
### Supported LLM Providers
|
||||
|
||||
@ -200,7 +200,7 @@ typedialog-ag examples/12-agent-execution/creative-writer.agent.mdx
|
||||
|
||||
# Privacy-first analysis with Ollama (local)
|
||||
typedialog-ag examples/12-agent-execution/local-privacy.agent.mdx
|
||||
```
|
||||
```text
|
||||
|
||||
**Learn more:**
|
||||
|
||||
@ -226,7 +226,7 @@ typedialog-prov-gen --name myproject --providers aws,hetzner --ai-assist
|
||||
|
||||
# Dry run (preview without generating)
|
||||
typedialog-prov-gen --name myproject --dry-run
|
||||
```
|
||||
```text
|
||||
|
||||
### Provisioning Features
|
||||
|
||||
@ -269,7 +269,7 @@ typedialog form schema.toml --backend tui
|
||||
|
||||
# 3. Get validated output in any format
|
||||
# JSON, YAML, TOML, or back to Nickel with type preservation
|
||||
```
|
||||
```text
|
||||
|
||||
**Benefits:**
|
||||
|
||||
@ -331,7 +331,7 @@ just distro::create-package
|
||||
|
||||
# Full CI/CD
|
||||
just ci::full
|
||||
```
|
||||
```text
|
||||
|
||||
See [docs/development.md](docs/development.md) for details.
|
||||
|
||||
@ -341,7 +341,7 @@ See [docs/development.md](docs/development.md) for details.
|
||||
|
||||
```bash
|
||||
just build::release
|
||||
```
|
||||
```text
|
||||
|
||||
Binaries in `target/release/`
|
||||
|
||||
@ -351,7 +351,7 @@ Binaries in `target/release/`
|
||||
just distro::build-release
|
||||
just distro::create-package
|
||||
just distro::create-checksums
|
||||
```
|
||||
```text
|
||||
|
||||
Package includes binaries, configs, and installers.
|
||||
|
||||
@ -365,7 +365,7 @@ curl -fsSL https://github.com/anthropics/typedialog/releases/download/latest/ins
|
||||
|
||||
# Windows PowerShell
|
||||
irm https://github.com/anthropics/typedialog/releases/download/latest/install.ps1 | iex
|
||||
```
|
||||
```text
|
||||
|
||||
See [docs/release.md](docs/release.md) for release workflow.
|
||||
|
||||
@ -381,7 +381,7 @@ config/
|
||||
├── ai/ # default, dev, production (RAG/embeddings)
|
||||
├── ag/ # default, dev, production (Agent/LLM)
|
||||
└── prov-gen/ # default, dev, production (IaC generation)
|
||||
```
|
||||
```text
|
||||
|
||||
See [docs/configuration.md](docs/configuration.md) and [config/README.md](config/README.md) for all options.
|
||||
|
||||
@ -406,7 +406,7 @@ typedialog/
|
||||
├── docs/ # Documentation
|
||||
├── justfile # Command orchestration
|
||||
└── Cargo.toml # Workspace manifest
|
||||
```
|
||||
```text
|
||||
|
||||
## Key Technologies
|
||||
|
||||
@ -461,7 +461,7 @@ just distro::build-release # Release build
|
||||
just distro::create-package # Package
|
||||
just distro::create-checksums # Checksums
|
||||
just distro::package-release # Prepare release
|
||||
```
|
||||
```text
|
||||
|
||||
## System Requirements
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
### Private Reporting
|
||||
|
||||
Send vulnerability reports to: **jpl@jesusperez.com**
|
||||
Send vulnerability reports to: **<jpl@jesusperez.com>**
|
||||
|
||||
Include in your report:
|
||||
- Description of the vulnerability
|
||||
|
||||
@ -18,7 +18,7 @@ typedialog-ag agents/greeting.agent.mdx
|
||||
curl -X POST http://localhost:8765/agents/greeting/execute \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"name":"Alice"}'
|
||||
```
|
||||
```text
|
||||
|
||||
### 2. code-reviewer.agent.mdx
|
||||
**Purpose**: Comprehensive code review
|
||||
@ -34,7 +34,7 @@ curl -X POST http://localhost:8765/agents/code-reviewer/execute \
|
||||
"language": "rust",
|
||||
"code": "fn add(a: i32, b: i32) -> i32 { a + b }"
|
||||
}'
|
||||
```
|
||||
```text
|
||||
|
||||
### 3. architect.agent.mdx
|
||||
**Purpose**: Software architecture design
|
||||
@ -50,7 +50,7 @@ curl -X POST http://localhost:8765/agents/architect/execute \
|
||||
"feature": "Real-time chat system",
|
||||
"tech_stack": "Rust, WebSockets, PostgreSQL"
|
||||
}'
|
||||
```
|
||||
```text
|
||||
|
||||
### 4. summarizer.agent.mdx
|
||||
**Purpose**: Text summarization
|
||||
@ -65,7 +65,7 @@ curl -X POST http://localhost:8765/agents/summarizer/execute \
|
||||
"text": "Long article text here...",
|
||||
"style": "technical"
|
||||
}'
|
||||
```
|
||||
```text
|
||||
|
||||
### 5. test-generator.agent.mdx
|
||||
**Purpose**: Generate unit tests
|
||||
@ -81,7 +81,7 @@ curl -X POST http://localhost:8765/agents/test-generator/execute \
|
||||
"language": "python",
|
||||
"function_code": "def factorial(n):\\n return 1 if n == 0 else n * factorial(n-1)"
|
||||
}'
|
||||
```
|
||||
```text
|
||||
|
||||
### 6. doc-generator.agent.mdx
|
||||
**Purpose**: Generate technical documentation
|
||||
@ -96,7 +96,7 @@ curl -X POST http://localhost:8765/agents/doc-generator/execute \
|
||||
"language": "javascript",
|
||||
"code": "function debounce(fn, delay) { ... }"
|
||||
}'
|
||||
```
|
||||
```text
|
||||
|
||||
### 7. translator.agent.mdx
|
||||
**Purpose**: Language translation
|
||||
@ -112,7 +112,7 @@ curl -X POST http://localhost:8765/agents/translator/execute \
|
||||
"source_lang": "English",
|
||||
"target_lang": "Spanish"
|
||||
}'
|
||||
```
|
||||
```text
|
||||
|
||||
### 8. debugger.agent.mdx
|
||||
**Purpose**: Debug code issues
|
||||
@ -129,7 +129,7 @@ curl -X POST http://localhost:8765/agents/debugger/execute \
|
||||
"code": "let x = vec![1,2,3]; println!(\"{}\", x[5]);",
|
||||
"error": "index out of bounds: the len is 3 but the index is 5"
|
||||
}'
|
||||
```
|
||||
```text
|
||||
|
||||
### 9. refactor.agent.mdx
|
||||
**Purpose**: Code refactoring
|
||||
@ -146,7 +146,7 @@ curl -X POST http://localhost:8765/agents/refactor/execute \
|
||||
"code": "function calc(a,b,op){if(op==='+')return a+b;if(op==='-')return a-b;}",
|
||||
"goal": "Improve readability and type safety"
|
||||
}'
|
||||
```
|
||||
```text
|
||||
|
||||
## Features Demonstrated
|
||||
|
||||
@ -187,7 +187,7 @@ typedialog-ag transpile agents/greeting.agent.mdx
|
||||
|
||||
# Execute (interactive)
|
||||
typedialog-ag agents/greeting.agent.mdx
|
||||
```
|
||||
```text
|
||||
|
||||
### HTTP Server Testing
|
||||
```bash
|
||||
@ -206,7 +206,7 @@ curl -X POST http://localhost:8765/validate \
|
||||
curl -X POST http://localhost:8765/agents/greeting/execute \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"name":"World"}'
|
||||
```
|
||||
```text
|
||||
|
||||
## Best Practices
|
||||
|
||||
@ -225,7 +225,7 @@ Ensure you have API keys configured:
|
||||
```bash
|
||||
export ANTHROPIC_API_KEY=sk-ant-...
|
||||
export OPENAI_API_KEY=sk-... # If using OpenAI models
|
||||
```
|
||||
```text
|
||||
|
||||
## Cache
|
||||
|
||||
@ -236,6 +236,6 @@ typedialog-ag cache stats
|
||||
|
||||
# Clear cache
|
||||
typedialog-ag cache clear
|
||||
```
|
||||
```text
|
||||
|
||||
Cache location: `~/.typeagent/cache/`
|
||||
|
||||
@ -72,7 +72,7 @@ The TypeDialog logo is composed of three essential elements that work together t
|
||||
|
||||
/* CSS usage */
|
||||
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
||||
```
|
||||
```text
|
||||
|
||||
### Sizing
|
||||
|
||||
@ -165,7 +165,7 @@ font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
||||
.cursor {
|
||||
animation: blink 1s ease-in-out infinite;
|
||||
}
|
||||
```
|
||||
```text
|
||||
|
||||
- **Duration**: 1 second
|
||||
- **Function**: ease-in-out (smooth acceleration/deceleration)
|
||||
@ -183,7 +183,7 @@ font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
||||
.text-pulse {
|
||||
animation: text-pulse 3s ease-in-out infinite;
|
||||
}
|
||||
```
|
||||
```text
|
||||
|
||||
- **Duration**: 3 seconds
|
||||
- **Function**: ease-in-out
|
||||
@ -248,25 +248,25 @@ Format: `typedialog_[component]_[variant].svg`
|
||||
### Web - Header Logo
|
||||
```html
|
||||
<img src="/assets/typedialog_logo_h.svg" alt="TypeDialog" width="240" height="64">
|
||||
```
|
||||
```text
|
||||
|
||||
### App - Favicon
|
||||
```html
|
||||
<link rel="icon" href="/assets/favicon.svg" type="image/svg+xml">
|
||||
<link rel="icon" href="/assets/favicon-32.png" type="image/png" sizes="32x32">
|
||||
```
|
||||
```text
|
||||
|
||||
### Email - Static Logo
|
||||
```html
|
||||
<!-- Export typedialog_logo_h_s.svg as PNG, then embed -->
|
||||
<img src="typedialog-logo.png" alt="TypeDialog" width="240" height="64">
|
||||
```
|
||||
```text
|
||||
|
||||
### Print - Monochrome Logo
|
||||
```html
|
||||
<!-- Use typedialog_logo_bn.svg -->
|
||||
<img src="typedialog_logo_bn.svg" alt="TypeDialog" width="100%">
|
||||
```
|
||||
```text
|
||||
|
||||
---
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ Official logo assets for **TypeDialog** — typed dialogs for inputs, forms and
|
||||
|
||||
<!-- Logo in header -->
|
||||
<img src="/assets/typedialog_logo_h.svg" alt="TypeDialog" width="240">
|
||||
```
|
||||
```text
|
||||
|
||||
### For React/Vue
|
||||
|
||||
@ -23,13 +23,13 @@ import logo from '/assets/typedialog_logo_h.svg';
|
||||
export default function Header() {
|
||||
return <img src={logo} alt="TypeDialog" width={240} />;
|
||||
}
|
||||
```
|
||||
```text
|
||||
|
||||
### For Markdown/Docs
|
||||
|
||||
```markdown
|
||||

|
||||
```
|
||||
```text
|
||||
|
||||
---
|
||||
|
||||
@ -110,7 +110,7 @@ export default function Header() {
|
||||
--td-primary: #3a3a50; /* Primary gray */
|
||||
--td-accent: #4f46e5; /* Accent indigo */
|
||||
--td-white: #ffffff; /* Contrast */
|
||||
```
|
||||
```text
|
||||
|
||||
---
|
||||
|
||||
@ -198,7 +198,7 @@ All TypeDialog branding uses **Inter** font (Google Fonts).
|
||||
```css
|
||||
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@500&display=swap');
|
||||
font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
```
|
||||
```text
|
||||
|
||||
- **Weights**: 400 (regular), 500 (medium), 600 (semibold)
|
||||
- **Sizes**: 14-24px (responsive)
|
||||
@ -221,7 +221,7 @@ font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
height: auto;
|
||||
}
|
||||
</style>
|
||||
```
|
||||
```text
|
||||
|
||||
### Markdown
|
||||
|
||||
@ -229,13 +229,13 @@ font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
#  Welcome
|
||||
|
||||
[Link text](/)
|
||||
```
|
||||
```text
|
||||
|
||||
### Rust / Markdown Docs
|
||||
|
||||
```markdown
|
||||

|
||||
```
|
||||
```text
|
||||
|
||||
---
|
||||
|
||||
@ -253,7 +253,7 @@ font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
<!-- Path elements for bubble, brackets, cursor -->
|
||||
<!-- Text element for wordmark -->
|
||||
</svg>
|
||||
```
|
||||
```text
|
||||
|
||||
### Scalability
|
||||
|
||||
@ -298,7 +298,7 @@ TypeDialog logo is part of the TypeDialog project. Use according to project lice
|
||||
|
||||
---
|
||||
|
||||
## Questions?
|
||||
## Questions
|
||||
|
||||
Refer to the comprehensive documentation:
|
||||
1. `index.html` for visual reference
|
||||
|
||||
@ -65,7 +65,7 @@ Quick integration guide with code examples for different frameworks and contexts
|
||||
</style>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
```text
|
||||
|
||||
### React
|
||||
|
||||
@ -84,7 +84,7 @@ export default function Header() {
|
||||
</header>
|
||||
);
|
||||
}
|
||||
```
|
||||
```text
|
||||
|
||||
### Vue
|
||||
|
||||
@ -111,7 +111,7 @@ import TypeDialogLogo from '@/assets/assets/typedialog_logo_h.svg';
|
||||
height: auto;
|
||||
}
|
||||
</style>
|
||||
```
|
||||
```text
|
||||
|
||||
### Svelte
|
||||
|
||||
@ -130,7 +130,7 @@ import TypeDialogLogo from '@/assets/assets/typedialog_logo_h.svg';
|
||||
height: auto;
|
||||
}
|
||||
</style>
|
||||
```
|
||||
```text
|
||||
|
||||
### Angular
|
||||
|
||||
@ -148,7 +148,7 @@ import TypeDialogLogo from '@/assets/assets/typedialog_logo_h.svg';
|
||||
max-width: 240px;
|
||||
height: auto;
|
||||
}
|
||||
```
|
||||
```text
|
||||
|
||||
---
|
||||
|
||||
@ -158,13 +158,13 @@ import TypeDialogLogo from '@/assets/assets/typedialog_logo_h.svg';
|
||||
|
||||
```markdown
|
||||

|
||||
```
|
||||
```text
|
||||
|
||||
### With Link
|
||||
|
||||
```markdown
|
||||
[](https://yoursite.com)
|
||||
```
|
||||
```text
|
||||
|
||||
### mdBook / GitHub Docs
|
||||
|
||||
@ -172,7 +172,7 @@ import TypeDialogLogo from '@/assets/assets/typedialog_logo_h.svg';
|
||||
#  Welcome to TypeDialog
|
||||
|
||||
Content here...
|
||||
```
|
||||
```text
|
||||
|
||||
### Rust Project README
|
||||
|
||||
@ -182,7 +182,7 @@ Content here...
|
||||

|
||||
|
||||
Typed dialogs for inputs, forms and schemas you can trust.
|
||||
```
|
||||
```text
|
||||
|
||||
---
|
||||
|
||||
@ -196,7 +196,7 @@ Typed dialogs for inputs, forms and schemas you can trust.
|
||||
<link rel="icon" href="/assets/favicon-16.png" type="image/png" sizes="16x16">
|
||||
<link rel="apple-touch-icon" href="/assets/favicon-64.png">
|
||||
<link rel="icon" href="/assets/favicon.ico" sizes="16x16 32x32 64x64">
|
||||
```
|
||||
```text
|
||||
|
||||
### Hero Section
|
||||
|
||||
@ -221,7 +221,7 @@ Typed dialogs for inputs, forms and schemas you can trust.
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
</style>
|
||||
```
|
||||
```text
|
||||
|
||||
### Navigation Bar
|
||||
|
||||
@ -247,7 +247,7 @@ Typed dialogs for inputs, forms and schemas you can trust.
|
||||
height: auto;
|
||||
}
|
||||
</style>
|
||||
```
|
||||
```text
|
||||
|
||||
---
|
||||
|
||||
@ -270,7 +270,7 @@ Typed dialogs for inputs, forms and schemas you can trust.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
```
|
||||
```text
|
||||
|
||||
### Social Media
|
||||
|
||||
@ -281,7 +281,7 @@ Typed dialogs for inputs, forms and schemas you can trust.
|
||||
<meta property="og:image:alt" content="TypeDialog Logo">
|
||||
<meta property="og:image:width" content="1200">
|
||||
<meta property="og:image:height" content="630">
|
||||
```
|
||||
```text
|
||||
|
||||
---
|
||||
|
||||
@ -334,7 +334,7 @@ body.dark-mode {
|
||||
width: 240px;
|
||||
height: 64px;
|
||||
}
|
||||
```
|
||||
```text
|
||||
|
||||
### SVG Direct Approach
|
||||
|
||||
@ -362,7 +362,7 @@ body.dark-mode {
|
||||
.logo-dark { display: block; }
|
||||
}
|
||||
</style>
|
||||
```
|
||||
```text
|
||||
|
||||
---
|
||||
|
||||
@ -376,7 +376,7 @@ body.dark-mode {
|
||||
|
||||
<!-- Avoid huge SVGs if PNG export available -->
|
||||
<img src="assets/typedialog_logo_h.png" alt="TypeDialog" width="240">
|
||||
```
|
||||
```text
|
||||
|
||||
### CSS Loading
|
||||
|
||||
@ -387,7 +387,7 @@ body.dark-mode {
|
||||
|
||||
/* Use data URIs for very small files */
|
||||
.logo { background-image: url('data:image/svg+xml;...'); }
|
||||
```
|
||||
```text
|
||||
|
||||
### Caching
|
||||
|
||||
@ -399,7 +399,7 @@ body.dark-mode {
|
||||
/>
|
||||
|
||||
<!-- Or use service workers for offline support -->
|
||||
```
|
||||
```text
|
||||
|
||||
---
|
||||
|
||||
@ -415,7 +415,7 @@ body.dark-mode {
|
||||
<a href="/">
|
||||
<img src="assets/typedialog_icon.svg" alt="Home">
|
||||
</a>
|
||||
```
|
||||
```text
|
||||
|
||||
### ARIA Labels
|
||||
|
||||
@ -426,7 +426,7 @@ body.dark-mode {
|
||||
alt="TypeDialog"
|
||||
aria-label="TypeDialog - Typed dialogs for inputs, forms and schemas you can trust"
|
||||
/>
|
||||
```
|
||||
```text
|
||||
|
||||
### Animation Preferences
|
||||
|
||||
@ -439,7 +439,7 @@ body.dark-mode {
|
||||
/* Option 2: Disable animations */
|
||||
.logo * { animation: none !important; }
|
||||
}
|
||||
```
|
||||
```text
|
||||
|
||||
---
|
||||
|
||||
@ -498,14 +498,14 @@ convert typedialog_logo_h.svg typedialog_logo_h.png
|
||||
|
||||
# Using online tool
|
||||
# https://convertio.co/svg-png/
|
||||
```
|
||||
```text
|
||||
|
||||
### PDF Export
|
||||
|
||||
```bash
|
||||
# Using Inkscape
|
||||
inkscape typedialog_logo_h.svg --export-filename=typedialog_logo_h.pdf
|
||||
```
|
||||
```text
|
||||
|
||||
---
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ Pre-configured settings for each typedialog backend and environment.
|
||||
|
||||
Configuration files are organized by **backend** (CLI, TUI, Web, AI, Agent, Prov-gen) and **environment** (default, dev, production).
|
||||
|
||||
```
|
||||
```text
|
||||
config/
|
||||
├── cli/
|
||||
│ ├── default.toml # Standard CLI settings
|
||||
@ -32,7 +32,7 @@ config/
|
||||
├── default.toml # Standard provisioning settings
|
||||
├── dev.toml # Development (Hetzner/LXD)
|
||||
└── production.toml # Production (AWS/GCP)
|
||||
```
|
||||
```text
|
||||
|
||||
## Backend Configurations
|
||||
|
||||
@ -49,7 +49,7 @@ config/
|
||||
**Usage:**
|
||||
```bash
|
||||
typedialog --config config/cli/production.toml form.toml
|
||||
```
|
||||
```text
|
||||
|
||||
**Features:**
|
||||
- Inline validation
|
||||
@ -70,7 +70,7 @@ typedialog --config config/cli/production.toml form.toml
|
||||
**Usage:**
|
||||
```bash
|
||||
typedialog-tui --config config/tui/production.toml form.toml
|
||||
```
|
||||
```text
|
||||
|
||||
**Features:**
|
||||
- 3-panel layout (fields, input, buttons)
|
||||
@ -92,7 +92,7 @@ typedialog-tui --config config/tui/production.toml form.toml
|
||||
```bash
|
||||
typedialog-web --config config/web/production.toml
|
||||
# Server starts on http://localhost:8080
|
||||
```
|
||||
```text
|
||||
|
||||
**Features:**
|
||||
- HTML/CSS rendering
|
||||
@ -113,7 +113,7 @@ typedialog-web --config config/web/production.toml
|
||||
**Usage:**
|
||||
```bash
|
||||
typedialog-ai --config config/ai/production.toml --query "user question"
|
||||
```
|
||||
```text
|
||||
|
||||
**Features:**
|
||||
- RAG pipeline for context retrieval
|
||||
@ -134,7 +134,7 @@ typedialog-ai --config config/ai/production.toml --query "user question"
|
||||
**Usage:**
|
||||
```bash
|
||||
typedialog-ag --config config/ag/production.toml task.agent.mdx
|
||||
```
|
||||
```text
|
||||
|
||||
**Features:**
|
||||
- Multi-provider (Claude, OpenAI, Gemini, Ollama)
|
||||
@ -155,7 +155,7 @@ typedialog-ag --config config/ag/production.toml task.agent.mdx
|
||||
**Usage:**
|
||||
```bash
|
||||
typedialog-prov-gen --config config/prov-gen/production.toml --name myproject
|
||||
```
|
||||
```text
|
||||
|
||||
**Features:**
|
||||
- Multi-cloud support (AWS, GCP, Hetzner, UpCloud, LXD)
|
||||
@ -198,7 +198,7 @@ temperature = 0.7
|
||||
default_providers = ["hetzner", "lxd"]
|
||||
verbose = true
|
||||
log_level = "debug"
|
||||
```
|
||||
```text
|
||||
|
||||
**Usage:**
|
||||
```bash
|
||||
@ -208,7 +208,7 @@ typedialog-web --config config/web/dev.toml
|
||||
typedialog-ai --config config/ai/dev.toml --query "question"
|
||||
typedialog-ag --config config/ag/dev.toml task.agent.mdx
|
||||
typedialog-prov-gen --config config/prov-gen/dev.toml --name project
|
||||
```
|
||||
```text
|
||||
|
||||
### Production Configuration
|
||||
|
||||
@ -249,7 +249,7 @@ default_providers = ["aws", "gcp"]
|
||||
strict_validation = true
|
||||
require_encryption = true
|
||||
require_tests = true
|
||||
```
|
||||
```text
|
||||
|
||||
**Usage:**
|
||||
```bash
|
||||
@ -259,7 +259,7 @@ typedialog-web --config config/web/production.toml
|
||||
typedialog-ai --config config/ai/production.toml --query "question"
|
||||
typedialog-ag --config config/ag/production.toml task.agent.mdx
|
||||
typedialog-prov-gen --config config/prov-gen/production.toml --name project
|
||||
```
|
||||
```text
|
||||
|
||||
## Common Settings
|
||||
|
||||
@ -274,7 +274,7 @@ description = "Optional description"
|
||||
validate_on_change = true
|
||||
show_errors_inline = true
|
||||
strict_validation = true
|
||||
```
|
||||
```text
|
||||
|
||||
### Output Configuration
|
||||
|
||||
@ -283,7 +283,7 @@ strict_validation = true
|
||||
format = "json" # json, yaml, toml, text
|
||||
pretty_print = true
|
||||
debug_output = false
|
||||
```
|
||||
```text
|
||||
|
||||
### Logging
|
||||
|
||||
@ -291,7 +291,7 @@ debug_output = false
|
||||
[logging]
|
||||
level = "info" # debug, info, warn, error
|
||||
file = "/var/log/typedialog/app.log"
|
||||
```
|
||||
```text
|
||||
|
||||
## Custom Configuration
|
||||
|
||||
@ -308,7 +308,7 @@ nano config/cli/custom.toml
|
||||
|
||||
# Use it
|
||||
typedialog --config config/cli/custom.toml form.toml
|
||||
```
|
||||
```text
|
||||
|
||||
### Override Specific Settings
|
||||
|
||||
@ -328,7 +328,7 @@ typedialog-tui --config config/tui/default.toml form.toml
|
||||
export TYPEDIALOG_WEB_PORT=3000
|
||||
export TYPEDIALOG_WEB_CORS_ORIGINS="localhost,example.com"
|
||||
typedialog-web --config config/web/default.toml
|
||||
```
|
||||
```text
|
||||
|
||||
## CLI Backend Configuration Details
|
||||
|
||||
@ -350,7 +350,7 @@ show_errors_inline = true # Inline error messages
|
||||
[timeout]
|
||||
max_duration = 3600 # Max form time (seconds)
|
||||
input_timeout = 300 # Field input timeout
|
||||
```
|
||||
```text
|
||||
|
||||
## TUI Backend Configuration Details
|
||||
|
||||
@ -380,7 +380,7 @@ emacs_mode = false
|
||||
[performance]
|
||||
render_throttle = 16 # milliseconds
|
||||
max_fps = 60 # frames per second
|
||||
```
|
||||
```text
|
||||
|
||||
## Web Backend Configuration Details
|
||||
|
||||
@ -413,7 +413,7 @@ cache_static = true
|
||||
cache_ttl = 3600
|
||||
enable_compression = true
|
||||
compression_threshold = 1024
|
||||
```
|
||||
```text
|
||||
|
||||
## AI Backend Configuration Details
|
||||
|
||||
@ -439,7 +439,7 @@ ttl = 3600 # seconds
|
||||
[ai.knowledge_graph]
|
||||
enabled = false
|
||||
max_depth = 3
|
||||
```
|
||||
```text
|
||||
|
||||
## Agent Backend Configuration Details
|
||||
|
||||
@ -474,7 +474,7 @@ timestamp = true
|
||||
[agent.logging]
|
||||
level = "info" # debug, info, warn, error
|
||||
file = true
|
||||
```
|
||||
```text
|
||||
|
||||
## Provisioning Generator Configuration Details
|
||||
|
||||
@ -517,7 +517,7 @@ require_tests = false
|
||||
[provisioning.security]
|
||||
require_encryption = false
|
||||
scan_templates = false
|
||||
```
|
||||
```text
|
||||
|
||||
## Distribution Configurations
|
||||
|
||||
@ -538,7 +538,7 @@ distribution/typedialog-0.1.0/
|
||||
│ ├── ag/
|
||||
│ └── prov-gen/
|
||||
└── ...
|
||||
```
|
||||
```text
|
||||
|
||||
Users can then choose configs during installation:
|
||||
|
||||
@ -552,7 +552,7 @@ bash installers/install.sh
|
||||
|
||||
# Use specific config
|
||||
typedialog --config ~/.config/typedialog/cli/production.toml form.toml
|
||||
```
|
||||
```text
|
||||
|
||||
## Best Practices
|
||||
|
||||
|
||||
@ -24,13 +24,13 @@ typedialog-ag run agent.mdx # Explicit run command
|
||||
typedialog-ag transpile agent.mdx -o out.ncl # Transpile to Nickel
|
||||
typedialog-ag validate agent.mdx # Validate without executing
|
||||
typedialog-ag cache clear|stats # Manage cache
|
||||
```
|
||||
```text
|
||||
|
||||
With custom configuration:
|
||||
```bash
|
||||
typedialog-ag -c ~/.config/typedialog/ag/config.toml run agent.mdx
|
||||
TYPEDIALOG_ENV=dev typedialog-ag run agent.mdx
|
||||
```
|
||||
```text
|
||||
|
||||
### Agent HTTP Server Mode
|
||||
Start HTTP API server for remote agent execution:
|
||||
@ -39,7 +39,7 @@ typedialog-ag serve # Start server (127.0.0.1:8765)
|
||||
typedialog-ag serve --port 9000 # Custom port
|
||||
typedialog-ag serve --host 0.0.0.0 # Public interface
|
||||
typedialog-ag -c ~/.config/typedialog/ag/server-default.toml serve
|
||||
```
|
||||
```text
|
||||
|
||||
Server endpoints:
|
||||
- `GET /health` - Health check
|
||||
|
||||
@ -15,7 +15,7 @@ Part of the [TypeDialog](https://github.com/yourusername/typedialog) ecosystem.
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
```text
|
||||
Layer 1: Markup Parser
|
||||
.agent.mdx → AST
|
||||
Parse @directives, {{variables}}, markdown
|
||||
@ -25,7 +25,7 @@ Layer 2: Nickel Transpiler + Evaluator
|
||||
|
||||
Layer 3: Executor
|
||||
AgentDefinition + Inputs → LLM → Validated Output
|
||||
```
|
||||
```text
|
||||
|
||||
## Quick Start
|
||||
|
||||
@ -43,7 +43,7 @@ typeagent validate architect.agent.mdx
|
||||
|
||||
# Start HTTP server
|
||||
typeagent serve --port 8765
|
||||
```
|
||||
```text
|
||||
|
||||
### Programmatic Usage
|
||||
|
||||
@ -67,7 +67,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
println!("{}", result.output);
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
```text
|
||||
|
||||
## Integration with TypeDialog Ecosystem
|
||||
|
||||
@ -80,7 +80,7 @@ typedialog form agent-builder.toml --backend ai
|
||||
|
||||
# 2. Execute with typeagent
|
||||
typeagent architect.agent.mdx
|
||||
```
|
||||
```text
|
||||
|
||||
### With Vapora (MCP Plugin)
|
||||
|
||||
@ -91,16 +91,16 @@ use typedialog_ag_core::AgentLoader;
|
||||
let loader = AgentLoader::new();
|
||||
let agent = loader.load(Path::new("agents/architect.agent.mdx")).await?;
|
||||
// Execute via Vapora orchestration
|
||||
```
|
||||
```text
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
```text
|
||||
typedialog-agent/
|
||||
├── typedialog-ag-core/ # Core library (reusable)
|
||||
├── typedialog-ag/ # CLI binary
|
||||
└── typedialog-ag-server/ # HTTP server
|
||||
```
|
||||
```text
|
||||
|
||||
## Documentation
|
||||
|
||||
|
||||
@ -1,245 +0,0 @@
|
||||
# TypeAgent Quick Start
|
||||
|
||||
Get started with TypeAgent in 5 minutes.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Rust toolchain (1.75+)
|
||||
- Anthropic API key
|
||||
|
||||
## Setup
|
||||
|
||||
### 1. Set API Key
|
||||
|
||||
```bash
|
||||
export ANTHROPIC_API_KEY=your-api-key-here
|
||||
```
|
||||
|
||||
### 2. Build TypeAgent
|
||||
|
||||
```bash
|
||||
cd crates/typedialog-agent/typedialog-ag
|
||||
cargo build --release
|
||||
```
|
||||
|
||||
### 3. Add to PATH (optional)
|
||||
|
||||
```bash
|
||||
export PATH="$PWD/target/release:$PATH"
|
||||
```
|
||||
|
||||
## Your First Agent
|
||||
|
||||
### Create an Agent File
|
||||
|
||||
Create `hello.agent.mdx`:
|
||||
|
||||
```markdown
|
||||
---
|
||||
@agent {
|
||||
role: friendly assistant,
|
||||
llm: claude-3-5-haiku-20241022
|
||||
}
|
||||
|
||||
@input name: String
|
||||
---
|
||||
|
||||
Say hello to {{ name }} in a creative and friendly way!
|
||||
```
|
||||
|
||||
### Run It
|
||||
|
||||
```bash
|
||||
typeagent hello.agent.mdx
|
||||
```
|
||||
|
||||
You'll see:
|
||||
|
||||
```
|
||||
🤖 TypeAgent Executor
|
||||
|
||||
✓ Parsed agent definition
|
||||
✓ Transpiled to Nickel
|
||||
✓ Evaluated agent definition
|
||||
|
||||
Agent Configuration:
|
||||
Role: friendly assistant
|
||||
Model: claude-3-5-haiku-20241022
|
||||
Max tokens: 4096
|
||||
Temperature: 0.7
|
||||
|
||||
name (String): Alice█
|
||||
```
|
||||
|
||||
Type a name and press Enter. The agent will execute and show the response!
|
||||
|
||||
## Next Steps
|
||||
|
||||
### Try the Examples
|
||||
|
||||
```bash
|
||||
# Simple greeting
|
||||
typeagent tests/fixtures/simple.agent.mdx --yes
|
||||
|
||||
# Creative haiku
|
||||
typeagent tests/fixtures/haiku.agent.mdx
|
||||
```
|
||||
|
||||
### Validate Before Running
|
||||
|
||||
```bash
|
||||
typeagent validate hello.agent.mdx
|
||||
```
|
||||
|
||||
### See the Nickel Code
|
||||
|
||||
```bash
|
||||
typeagent transpile hello.agent.mdx
|
||||
```
|
||||
|
||||
## Common Workflows
|
||||
|
||||
### Development Workflow
|
||||
|
||||
```bash
|
||||
# 1. Write your agent
|
||||
vim agent.mdx
|
||||
|
||||
# 2. Validate it
|
||||
typeagent validate agent.mdx
|
||||
|
||||
# 3. Test with verbose output
|
||||
typeagent agent.mdx --verbose
|
||||
|
||||
# 4. Run in production
|
||||
typeagent agent.mdx
|
||||
```
|
||||
|
||||
### Quick Iteration
|
||||
|
||||
Use `--yes` to skip prompts during development:
|
||||
|
||||
```bash
|
||||
# Edit agent.mdx
|
||||
# Run without prompts
|
||||
typeagent agent.mdx --yes
|
||||
```
|
||||
|
||||
## Advanced Features
|
||||
|
||||
### Context Injection
|
||||
|
||||
Import files into your agent:
|
||||
|
||||
```markdown
|
||||
@import "./docs/**/*.md" as documentation
|
||||
@shell "git log --oneline -5" as recent_commits
|
||||
```
|
||||
|
||||
### Output Validation
|
||||
|
||||
Ensure output meets requirements:
|
||||
|
||||
```markdown
|
||||
@validate output {
|
||||
must_contain: ["Security", "Performance"],
|
||||
format: markdown,
|
||||
min_length: 100
|
||||
}
|
||||
```
|
||||
|
||||
### Conditional Logic
|
||||
|
||||
Use Tera template syntax:
|
||||
|
||||
```markdown
|
||||
{% if has_description %}
|
||||
Description: {{ description }}
|
||||
{% endif %}
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### "ANTHROPIC_API_KEY not set"
|
||||
|
||||
```bash
|
||||
export ANTHROPIC_API_KEY=sk-ant-...
|
||||
```
|
||||
|
||||
### "Failed to parse agent MDX"
|
||||
|
||||
Check your frontmatter syntax:
|
||||
|
||||
```markdown
|
||||
---
|
||||
@agent {
|
||||
role: assistant, # <- comma required
|
||||
llm: claude-3-5-haiku-20241022
|
||||
}
|
||||
---
|
||||
```
|
||||
|
||||
### "Permission denied"
|
||||
|
||||
```bash
|
||||
chmod +x ./target/release/typeagent
|
||||
```
|
||||
|
||||
## Learn More
|
||||
|
||||
- [CLI Documentation](typedialog-ag/README.md)
|
||||
- [LLM Integration Guide](typedialog-ag-core/LLM_INTEGRATION.md)
|
||||
- [Example Agents](typedialog-ag-core/tests/fixtures/)
|
||||
|
||||
## Support
|
||||
|
||||
- GitHub Issues: https://github.com/jesusperezlorenzo/typedialog/issues
|
||||
- API Docs: `cargo doc --open --package typedialog-ag-core`
|
||||
|
||||
## Next Example: Architecture Agent
|
||||
|
||||
Create `architect.agent.mdx`:
|
||||
|
||||
```markdown
|
||||
---
|
||||
@agent {
|
||||
role: software architect,
|
||||
llm: claude-3-5-sonnet-20241022
|
||||
}
|
||||
|
||||
@input feature_name: String
|
||||
@input requirements?: String
|
||||
|
||||
@validate output {
|
||||
must_contain: ["## Architecture", "## Components"],
|
||||
format: markdown,
|
||||
min_length: 200
|
||||
}
|
||||
---
|
||||
|
||||
# Architecture Design: {{ feature_name }}
|
||||
|
||||
You are an experienced software architect. Design a comprehensive architecture for:
|
||||
|
||||
**Feature**: {{ feature_name }}
|
||||
|
||||
{% if requirements %}
|
||||
**Requirements**: {{ requirements }}
|
||||
{% endif %}
|
||||
|
||||
Provide:
|
||||
1. High-level architecture overview
|
||||
2. Component breakdown
|
||||
3. Data flow
|
||||
4. Technology recommendations
|
||||
|
||||
Use clear markdown formatting with sections.
|
||||
```
|
||||
|
||||
Run it:
|
||||
|
||||
```bash
|
||||
typeagent architect.agent.mdx
|
||||
```
|
||||
|
||||
The agent will prompt for inputs and generate a complete architecture design!
|
||||
@ -1,357 +0,0 @@
|
||||
# LLM Integration
|
||||
|
||||
TypeAgent Core now includes full LLM execution capabilities, allowing agents to call real language models.
|
||||
|
||||
## Supported Providers
|
||||
|
||||
### Claude (Anthropic)
|
||||
- ✅ Fully supported with streaming
|
||||
- Models: `claude-3-5-haiku-20241022`, `claude-3-5-sonnet-20241022`, `claude-opus-4`, etc.
|
||||
- Requires: `ANTHROPIC_API_KEY` environment variable
|
||||
- Features: Full SSE streaming, token usage tracking
|
||||
|
||||
### OpenAI
|
||||
- ✅ Fully supported with streaming
|
||||
- Models: `gpt-4o`, `gpt-4o-mini`, `gpt-4-turbo`, `o1`, `o3`, `o4-mini`, etc.
|
||||
- Requires: `OPENAI_API_KEY` environment variable
|
||||
- Features: Full SSE streaming, token usage tracking
|
||||
|
||||
### Google Gemini
|
||||
- ✅ Fully supported with streaming
|
||||
- Models: `gemini-2.0-flash-exp`, `gemini-1.5-pro`, `gemini-1.5-flash`, etc.
|
||||
- Requires: `GEMINI_API_KEY` or `GOOGLE_API_KEY` environment variable
|
||||
- Features: Full JSON streaming, token usage tracking
|
||||
- Note: Assistant role is mapped to "model" in Gemini API
|
||||
|
||||
### Ollama (Local Models)
|
||||
- ✅ Fully supported with streaming
|
||||
- Models: `llama2`, `mistral`, `phi`, `codellama`, `mixtral`, `qwen`, etc.
|
||||
- Requires: Ollama running locally (default: http://localhost:11434)
|
||||
- Optional: `OLLAMA_BASE_URL` to override endpoint
|
||||
- Features: Full JSON streaming, token usage tracking, privacy (local execution)
|
||||
- Note: No API key required - runs entirely on your machine
|
||||
|
||||
## Setup
|
||||
|
||||
### 1. Set API Key
|
||||
|
||||
**For Claude:**
|
||||
```bash
|
||||
export ANTHROPIC_API_KEY=your-api-key-here
|
||||
```
|
||||
|
||||
**For OpenAI:**
|
||||
```bash
|
||||
export OPENAI_API_KEY=your-api-key-here
|
||||
```
|
||||
|
||||
**For Gemini:**
|
||||
```bash
|
||||
export GEMINI_API_KEY=your-api-key-here
|
||||
# Or use GOOGLE_API_KEY
|
||||
export GOOGLE_API_KEY=your-api-key-here
|
||||
```
|
||||
|
||||
**For Ollama (local models):**
|
||||
```bash
|
||||
# Install and start Ollama first
|
||||
# Download from: https://ollama.ai
|
||||
ollama serve # Start the Ollama server
|
||||
|
||||
# Pull a model (in another terminal)
|
||||
ollama pull llama2
|
||||
|
||||
# Optional: Override default URL
|
||||
export OLLAMA_BASE_URL=http://localhost:11434
|
||||
```
|
||||
|
||||
### 2. Create Agent MDX File
|
||||
|
||||
```markdown
|
||||
---
|
||||
@agent {
|
||||
role: assistant,
|
||||
llm: claude-3-5-haiku-20241022
|
||||
}
|
||||
---
|
||||
|
||||
Hello {{ name }}! How can I help you today?
|
||||
```
|
||||
|
||||
### 3. Execute Agent
|
||||
|
||||
```rust
|
||||
use typedialog_ag_core::{MarkupParser, NickelTranspiler, NickelEvaluator, AgentExecutor};
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Parse MDX
|
||||
let parser = MarkupParser::new();
|
||||
let ast = parser.parse(mdx_content)?;
|
||||
|
||||
// Transpile to Nickel
|
||||
let transpiler = NickelTranspiler::new();
|
||||
let nickel_code = transpiler.transpile(&ast)?;
|
||||
|
||||
// Evaluate to AgentDefinition
|
||||
let evaluator = NickelEvaluator::new();
|
||||
let agent_def = evaluator.evaluate(&nickel_code)?;
|
||||
|
||||
// Execute with LLM
|
||||
let executor = AgentExecutor::new();
|
||||
let mut inputs = HashMap::new();
|
||||
inputs.insert("name".to_string(), serde_json::json!("Alice"));
|
||||
|
||||
let result = executor.execute(&agent_def, inputs).await?;
|
||||
println!("Response: {}", result.output);
|
||||
println!("Tokens: {}", result.metadata.tokens.unwrap_or(0));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Agent configuration is specified in the MDX frontmatter:
|
||||
|
||||
```yaml
|
||||
@agent {
|
||||
role: creative writer, # System prompt role
|
||||
llm: claude-3-5-haiku-20241022, # Model name
|
||||
tools: [], # Tool calling (future)
|
||||
max_tokens: 4096, # Optional (default: 4096)
|
||||
temperature: 0.7 # Optional (default: 0.7)
|
||||
}
|
||||
```
|
||||
|
||||
## LLM Provider Architecture
|
||||
|
||||
### Provider Trait
|
||||
|
||||
```rust
|
||||
#[async_trait]
|
||||
pub trait LlmProvider: Send + Sync {
|
||||
async fn complete(&self, request: LlmRequest) -> Result<LlmResponse>;
|
||||
fn name(&self) -> &str;
|
||||
}
|
||||
```
|
||||
|
||||
### Request/Response
|
||||
|
||||
```rust
|
||||
pub struct LlmRequest {
|
||||
pub model: String,
|
||||
pub messages: Vec<LlmMessage>,
|
||||
pub max_tokens: Option<usize>,
|
||||
pub temperature: Option<f64>,
|
||||
pub system: Option<String>,
|
||||
}
|
||||
|
||||
pub struct LlmResponse {
|
||||
pub content: String,
|
||||
pub model: String,
|
||||
pub usage: Option<TokenUsage>,
|
||||
}
|
||||
```
|
||||
|
||||
### Automatic Provider Selection
|
||||
|
||||
The executor automatically selects the correct provider based on model name:
|
||||
|
||||
- `claude-*`, `anthropic-*` → ClaudeProvider
|
||||
- `gpt-*`, `o1-*`, `o3-*`, `o4-*` → OpenAIProvider
|
||||
- `gemini-*` → GeminiProvider
|
||||
- `llama*`, `mistral*`, `phi*`, `codellama*`, `mixtral*`, `qwen*`, etc. → OllamaProvider
|
||||
|
||||
## Examples
|
||||
|
||||
### Run Complete Pipeline
|
||||
|
||||
```bash
|
||||
cargo run --example llm_execution
|
||||
```
|
||||
|
||||
### Compare All Providers
|
||||
|
||||
```bash
|
||||
# Run all four providers with the same prompt
|
||||
cargo run --example provider_comparison
|
||||
|
||||
# Run specific provider only
|
||||
cargo run --example provider_comparison claude
|
||||
cargo run --example provider_comparison openai
|
||||
cargo run --example provider_comparison gemini
|
||||
cargo run --example provider_comparison ollama
|
||||
```
|
||||
|
||||
### Run with Test (requires API key)
|
||||
|
||||
```bash
|
||||
cargo test --package typedialog-ag-core -- test_execute_with_real_llm --exact --ignored --nocapture
|
||||
```
|
||||
|
||||
### Integration Test
|
||||
|
||||
```bash
|
||||
cargo test --package typedialog-ag-core --test simple_integration_test -- test_complete_pipeline_with_llm --exact --ignored --nocapture
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
|
||||
```rust
|
||||
match executor.execute(&agent_def, inputs).await {
|
||||
Ok(result) => {
|
||||
if !result.validation_passed {
|
||||
eprintln!("Validation errors: {:?}", result.validation_errors);
|
||||
}
|
||||
println!("Output: {}", result.output);
|
||||
}
|
||||
Err(e) => {
|
||||
if e.to_string().contains("ANTHROPIC_API_KEY") {
|
||||
eprintln!("Error: API key not set");
|
||||
} else {
|
||||
eprintln!("Execution failed: {}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Token Usage Tracking
|
||||
|
||||
All LLM responses include token usage information:
|
||||
|
||||
```rust
|
||||
let result = executor.execute(&agent_def, inputs).await?;
|
||||
|
||||
if let Some(tokens) = result.metadata.tokens {
|
||||
println!("Tokens used: {}", tokens);
|
||||
}
|
||||
|
||||
if let Some(usage) = response.usage {
|
||||
println!("Input tokens: {}", usage.input_tokens);
|
||||
println!("Output tokens: {}", usage.output_tokens);
|
||||
println!("Total tokens: {}", usage.total_tokens);
|
||||
}
|
||||
```
|
||||
|
||||
## Context Injection
|
||||
|
||||
Agents can load context from files, URLs, and shell commands before LLM execution:
|
||||
|
||||
```markdown
|
||||
---
|
||||
@agent {
|
||||
role: code reviewer,
|
||||
llm: claude-3-5-sonnet-20241022
|
||||
}
|
||||
|
||||
@import "./src/**/*.rs" as source_code
|
||||
@shell "git diff HEAD~1" as recent_changes
|
||||
|
||||
---
|
||||
|
||||
Review the following code:
|
||||
|
||||
**Source Code:**
|
||||
{{ source_code }}
|
||||
|
||||
**Recent Changes:**
|
||||
{{ recent_changes }}
|
||||
|
||||
Provide security and performance analysis.
|
||||
```
|
||||
|
||||
The executor loads all context before calling the LLM, so the model receives the fully rendered prompt with all imported content.
|
||||
|
||||
## Validation
|
||||
|
||||
Output validation runs automatically after LLM execution:
|
||||
|
||||
```markdown
|
||||
---
|
||||
@validate output {
|
||||
must_contain: ["Security", "Performance"],
|
||||
format: markdown,
|
||||
min_length: 100
|
||||
}
|
||||
---
|
||||
```
|
||||
|
||||
Validation results are included in `ExecutionResult`:
|
||||
|
||||
```rust
|
||||
if !result.validation_passed {
|
||||
for error in result.validation_errors {
|
||||
eprintln!("Validation error: {}", error);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Cost Optimization
|
||||
|
||||
### Use Appropriate Models
|
||||
|
||||
- `claude-3-5-haiku-20241022`: Fast, cheap, good for simple tasks
|
||||
- `claude-3-5-sonnet-20241022`: Balanced performance and cost
|
||||
- `claude-opus-4`: Most capable, highest cost
|
||||
|
||||
### Limit Token Usage
|
||||
|
||||
```rust
|
||||
agent_def.config.max_tokens = 500; // Limit response length
|
||||
```
|
||||
|
||||
### Cache Context
|
||||
|
||||
The executor supports context caching to avoid re-loading files on each execution (implementation varies by provider).
|
||||
|
||||
## Testing Without API Key
|
||||
|
||||
Tests that require real LLM execution are marked with `#[ignore]`:
|
||||
|
||||
```bash
|
||||
# Run only non-LLM tests
|
||||
cargo test --package typedialog-ag-core
|
||||
|
||||
# Run LLM tests (requires ANTHROPIC_API_KEY)
|
||||
cargo test --package typedialog-ag-core -- --ignored
|
||||
```
|
||||
|
||||
## Implementation Files
|
||||
|
||||
- **Provider Trait**: `src/llm/provider.rs`
|
||||
- **Claude Client**: `src/llm/claude.rs`
|
||||
- **OpenAI Client**: `src/llm/openai.rs`
|
||||
- **Gemini Client**: `src/llm/gemini.rs`
|
||||
- **Ollama Client**: `src/llm/ollama.rs`
|
||||
- **Executor Integration**: `src/executor/mod.rs`
|
||||
- **Example**: `examples/llm_execution.rs`
|
||||
- **Multi-Provider Demo**: `examples/provider_comparison.rs`
|
||||
- **Tests**: `tests/simple_integration_test.rs`
|
||||
|
||||
## Streaming Support
|
||||
|
||||
All four providers (Claude, OpenAI, Gemini, Ollama) support real-time streaming:
|
||||
|
||||
```rust
|
||||
use typedialog_ag_core::AgentExecutor;
|
||||
|
||||
let executor = AgentExecutor::new();
|
||||
let result = executor.execute_streaming(&agent_def, inputs, |chunk| {
|
||||
print!("{}", chunk);
|
||||
std::io::stdout().flush().unwrap();
|
||||
}).await?;
|
||||
|
||||
println!("\n\nFinal output: {}", result.output);
|
||||
println!("Tokens: {:?}", result.metadata.tokens);
|
||||
```
|
||||
|
||||
The CLI automatically uses streaming for real-time token display.
|
||||
|
||||
### Token Usage in Streaming
|
||||
|
||||
- **Claude**: ✅ Provides token usage in stream (via `message_delta` event)
|
||||
- **OpenAI**: ❌ No token usage in stream (API limitation - only in non-streaming mode)
|
||||
- **Gemini**: ✅ Provides token usage in stream (via `usageMetadata` in final chunk)
|
||||
- **Ollama**: ✅ Provides token usage in stream (via `prompt_eval_count`/`eval_count` in done event)
|
||||
@ -6,13 +6,13 @@ Command-line interface for executing type-safe AI agents defined in MDX format.
|
||||
|
||||
```bash
|
||||
cargo install --path crates/typedialog-agent/typedialog-ag
|
||||
```
|
||||
```text
|
||||
|
||||
Or build from source:
|
||||
|
||||
```bash
|
||||
cargo build --release --package typedialog-ag
|
||||
```
|
||||
```text
|
||||
|
||||
## Setup
|
||||
|
||||
@ -20,7 +20,7 @@ Set your API key:
|
||||
|
||||
```bash
|
||||
export ANTHROPIC_API_KEY=your-api-key-here
|
||||
```
|
||||
```text
|
||||
|
||||
## Usage
|
||||
|
||||
@ -30,25 +30,25 @@ Run an agent with interactive prompts for inputs:
|
||||
|
||||
```bash
|
||||
typeagent agent.mdx
|
||||
```
|
||||
```text
|
||||
|
||||
Or use the explicit `run` command:
|
||||
|
||||
```bash
|
||||
typeagent run agent.mdx
|
||||
```
|
||||
```text
|
||||
|
||||
Skip input prompts (use defaults):
|
||||
|
||||
```bash
|
||||
typeagent agent.mdx --yes
|
||||
```
|
||||
```text
|
||||
|
||||
Verbose output (show Nickel code):
|
||||
|
||||
```bash
|
||||
typeagent agent.mdx --verbose
|
||||
```
|
||||
```text
|
||||
|
||||
### Validate an Agent
|
||||
|
||||
@ -56,10 +56,10 @@ Check syntax, transpilation, and type checking without executing:
|
||||
|
||||
```bash
|
||||
typeagent validate agent.mdx
|
||||
```
|
||||
```text
|
||||
|
||||
Output:
|
||||
```
|
||||
```text
|
||||
✓ Validating agent
|
||||
|
||||
✓ MDX syntax valid
|
||||
@ -74,7 +74,7 @@ Agent Summary:
|
||||
Temperature: 0.7
|
||||
|
||||
✓ Agent is valid and ready to execute
|
||||
```
|
||||
```text
|
||||
|
||||
### Transpile to Nickel
|
||||
|
||||
@ -86,7 +86,7 @@ typeagent transpile agent.mdx
|
||||
|
||||
# Save to file
|
||||
typeagent transpile agent.mdx -o agent.ncl
|
||||
```
|
||||
```text
|
||||
|
||||
Output:
|
||||
```nickel
|
||||
@ -98,7 +98,7 @@ Output:
|
||||
inputs = {},
|
||||
template = "Write a haiku about {{ topic }}.",
|
||||
}
|
||||
```
|
||||
```text
|
||||
|
||||
## Example Session
|
||||
|
||||
@ -117,7 +117,7 @@ Create `haiku.agent.mdx`:
|
||||
---
|
||||
|
||||
Write a haiku about {{ topic }}. Return only the haiku, nothing else.
|
||||
```
|
||||
```text
|
||||
|
||||
### 2. Validate the Agent
|
||||
|
||||
@ -138,7 +138,7 @@ Agent Summary:
|
||||
Temperature: 0.7
|
||||
|
||||
✓ Agent is valid and ready to execute
|
||||
```
|
||||
```text
|
||||
|
||||
### 3. Execute the Agent
|
||||
|
||||
@ -177,7 +177,7 @@ Metadata:
|
||||
Duration: 1234ms
|
||||
Tokens: 87
|
||||
Validation: ✓ PASSED
|
||||
```
|
||||
```text
|
||||
|
||||
## Agent File Format
|
||||
|
||||
@ -200,7 +200,7 @@ Metadata:
|
||||
---
|
||||
|
||||
Your template content with {{ variables }}.
|
||||
```
|
||||
```text
|
||||
|
||||
### Directives
|
||||
|
||||
@ -214,7 +214,7 @@ Defines the agent configuration.
|
||||
llm: claude-3-5-haiku-20241022,
|
||||
tools: [] # Optional
|
||||
}
|
||||
```
|
||||
```text
|
||||
|
||||
**Supported models:**
|
||||
- `claude-3-5-haiku-20241022` - Fast, cheap
|
||||
@ -228,7 +228,7 @@ Declares inputs that will be prompted to the user.
|
||||
```markdown
|
||||
@input name: String # Required input
|
||||
@input description?: String # Optional input
|
||||
```
|
||||
```text
|
||||
|
||||
#### `@validate` (Optional)
|
||||
|
||||
@ -242,7 +242,7 @@ Defines output validation rules.
|
||||
min_length: 100,
|
||||
max_length: 5000
|
||||
}
|
||||
```
|
||||
```text
|
||||
|
||||
**Supported formats:**
|
||||
- `markdown` (default)
|
||||
@ -257,7 +257,7 @@ Import file content into template variables.
|
||||
```markdown
|
||||
@import "./docs/**/*.md" as documentation
|
||||
@import "https://example.com/schema.json" as schema
|
||||
```
|
||||
```text
|
||||
|
||||
#### `@shell` (Optional)
|
||||
|
||||
@ -266,7 +266,7 @@ Execute shell commands and inject output.
|
||||
```markdown
|
||||
@shell "git diff HEAD~1" as recent_changes
|
||||
@shell "cargo tree" as dependencies
|
||||
```
|
||||
```text
|
||||
|
||||
### Template Syntax
|
||||
|
||||
@ -284,7 +284,7 @@ Uses [Tera template engine](https://tera.netlify.app/):
|
||||
# Filters
|
||||
{{ name | upper }}
|
||||
{{ value | default(value="fallback") }}
|
||||
```
|
||||
```text
|
||||
|
||||
## Commands
|
||||
|
||||
@ -300,7 +300,7 @@ Execute an agent (default command).
|
||||
**Example:**
|
||||
```bash
|
||||
typeagent agent.mdx --yes --verbose
|
||||
```
|
||||
```text
|
||||
|
||||
### `typeagent run <FILE>`
|
||||
|
||||
@ -312,7 +312,7 @@ Explicit execute command (same as default).
|
||||
**Example:**
|
||||
```bash
|
||||
typeagent run agent.mdx
|
||||
```
|
||||
```text
|
||||
|
||||
### `typeagent validate <FILE>`
|
||||
|
||||
@ -321,7 +321,7 @@ Validate agent without execution.
|
||||
**Example:**
|
||||
```bash
|
||||
typeagent validate agent.mdx
|
||||
```
|
||||
```text
|
||||
|
||||
### `typeagent transpile <FILE>`
|
||||
|
||||
@ -333,7 +333,7 @@ Transpile MDX to Nickel.
|
||||
**Example:**
|
||||
```bash
|
||||
typeagent transpile agent.mdx -o agent.ncl
|
||||
```
|
||||
```text
|
||||
|
||||
### `typeagent cache`
|
||||
|
||||
@ -354,34 +354,34 @@ Cache management (not yet implemented).
|
||||
|
||||
### Missing API Key
|
||||
|
||||
```
|
||||
```text
|
||||
Error: ANTHROPIC_API_KEY environment variable not set
|
||||
Set ANTHROPIC_API_KEY to use Claude models
|
||||
```
|
||||
```text
|
||||
|
||||
**Solution:** Export your API key:
|
||||
```bash
|
||||
export ANTHROPIC_API_KEY=sk-ant-...
|
||||
```
|
||||
```text
|
||||
|
||||
### Invalid Agent File
|
||||
|
||||
```
|
||||
```text
|
||||
Error: Failed to parse agent MDX
|
||||
```
|
||||
```text
|
||||
|
||||
**Solution:** Validate your agent file:
|
||||
```bash
|
||||
typeagent validate agent.mdx
|
||||
```
|
||||
```text
|
||||
|
||||
### Validation Failures
|
||||
|
||||
```
|
||||
```text
|
||||
Validation: ✗ FAILED
|
||||
- Output must contain: Security
|
||||
- Output too short: 45 chars (minimum: 100)
|
||||
```
|
||||
```text
|
||||
|
||||
The agent executed successfully but output validation failed. Adjust your `@validate` rules or improve your prompt.
|
||||
|
||||
@ -401,13 +401,13 @@ Make sure the binary is in your PATH:
|
||||
|
||||
```bash
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
||||
```
|
||||
```text
|
||||
|
||||
Or use the full path:
|
||||
|
||||
```bash
|
||||
./target/release/typeagent
|
||||
```
|
||||
```text
|
||||
|
||||
### Permission denied
|
||||
|
||||
@ -415,7 +415,7 @@ Make the binary executable:
|
||||
|
||||
```bash
|
||||
chmod +x ./target/release/typeagent
|
||||
```
|
||||
```text
|
||||
|
||||
### Slow compilation
|
||||
|
||||
@ -424,7 +424,7 @@ Use release mode for better performance:
|
||||
```bash
|
||||
cargo build --release --package typedialog-ag
|
||||
./target/release/typeagent agent.mdx
|
||||
```
|
||||
```text
|
||||
|
||||
## Development
|
||||
|
||||
@ -432,13 +432,13 @@ Run from source:
|
||||
|
||||
```bash
|
||||
cargo run --package typedialog-ag -- agent.mdx
|
||||
```
|
||||
```text
|
||||
|
||||
Run with logging:
|
||||
|
||||
```bash
|
||||
RUST_LOG=debug cargo run --package typedialog-ag -- agent.mdx
|
||||
```
|
||||
```text
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@ -7,19 +7,19 @@ Quick installation scripts for all platforms.
|
||||
Install with `curl`:
|
||||
```bash
|
||||
curl -fsSL https://github.com/anthropics/typedialog/releases/download/latest/install.sh | bash
|
||||
```
|
||||
```text
|
||||
|
||||
Or with `wget`:
|
||||
```bash
|
||||
wget -qO - https://github.com/anthropics/typedialog/releases/download/latest/install.sh | bash
|
||||
```
|
||||
```text
|
||||
|
||||
## Windows
|
||||
|
||||
Open PowerShell and run:
|
||||
```powershell
|
||||
irm https://github.com/anthropics/typedialog/releases/download/latest/install.ps1 | iex
|
||||
```
|
||||
```text
|
||||
|
||||
## Manual Installation
|
||||
|
||||
@ -34,7 +34,7 @@ bash install.sh
|
||||
|
||||
# Or with environment variables
|
||||
INSTALL_DIR="$HOME/bin" CONFIG_DIR="$HOME/.typedialog" bash install.sh
|
||||
```
|
||||
```text
|
||||
|
||||
### Windows
|
||||
|
||||
@ -47,7 +47,7 @@ Invoke-WebRequest -Uri "https://github.com/anthropics/typedialog/releases/downlo
|
||||
|
||||
# Or with parameters
|
||||
.\install.ps1 -InstallDir "C:\Program Files\typedialog" -ConfigDir "C:\Users\$env:USERNAME\AppData\Local\typedialog"
|
||||
```
|
||||
```text
|
||||
|
||||
## Configuration
|
||||
|
||||
@ -91,7 +91,7 @@ typedialog-web --version
|
||||
|
||||
# List available configurations
|
||||
ls ~/.config/typedialog/
|
||||
```
|
||||
```text
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
@ -103,27 +103,27 @@ Update your PATH:
|
||||
```bash
|
||||
echo 'export PATH="$PATH:$HOME/.local/bin"' >> ~/.bashrc
|
||||
source ~/.bashrc
|
||||
```
|
||||
```text
|
||||
|
||||
**zsh:**
|
||||
```bash
|
||||
echo 'export PATH="$PATH:$HOME/.local/bin"' >> ~/.zshrc
|
||||
source ~/.zshrc
|
||||
```
|
||||
```text
|
||||
|
||||
### Permission denied
|
||||
|
||||
Make binaries executable:
|
||||
```bash
|
||||
chmod +x ~/.local/bin/typedialog*
|
||||
```
|
||||
```text
|
||||
|
||||
### Configuration issues
|
||||
|
||||
Check configuration directory:
|
||||
```bash
|
||||
cat ~/.config/typedialog/cli/default.toml
|
||||
```
|
||||
```text
|
||||
|
||||
## Uninstallation
|
||||
|
||||
@ -135,7 +135,7 @@ rm ~/.local/bin/typedialog*
|
||||
|
||||
# Remove configurations (optional)
|
||||
rm -rf ~/.config/typedialog/
|
||||
```
|
||||
```text
|
||||
|
||||
## Platform Support
|
||||
|
||||
@ -175,7 +175,7 @@ cd typedialog
|
||||
tar -xzf distribution/typedialog-0.1.0.tar.gz
|
||||
cp typedialog-0.1.0/bin/* ~/.local/bin/
|
||||
cp -r typedialog-0.1.0/config/* ~/.config/typedialog/
|
||||
```
|
||||
```text
|
||||
|
||||
## Support
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ Use in form templates with Tera include syntax:
|
||||
contract: "std.string.NonEmpty",
|
||||
default: "myapp"
|
||||
} %}
|
||||
```
|
||||
```text
|
||||
|
||||
### Form Templates
|
||||
|
||||
@ -51,7 +51,7 @@ Render a complete schema:
|
||||
|
||||
```bash
|
||||
typedialog nickel-template forms/config_schema.ncl.j2 form_results.json -o config.ncl
|
||||
```
|
||||
```text
|
||||
|
||||
### Macro Templates
|
||||
|
||||
@ -60,14 +60,14 @@ Include macros in custom templates:
|
||||
```jinja2
|
||||
{% include "macros/contracts.ncl.j2" %}
|
||||
{% include "macros/validation.ncl.j2" %}
|
||||
```
|
||||
```text
|
||||
|
||||
Then use the defined macros:
|
||||
|
||||
```jinja2
|
||||
{{ non_empty_string("username", "User login name") }}
|
||||
{{ port_number("server_port", "HTTP port") }}
|
||||
```
|
||||
```text
|
||||
|
||||
## Template Context Variables
|
||||
|
||||
@ -83,7 +83,7 @@ Templates expect the following context from form results:
|
||||
"options": ["option1", "option2"],
|
||||
"groups_by_section": { "section_name": [...fields...] }
|
||||
}
|
||||
```
|
||||
```text
|
||||
|
||||
## Examples
|
||||
|
||||
@ -108,13 +108,13 @@ default = "1.0.0"
|
||||
name = "debug_mode"
|
||||
type = "confirm"
|
||||
prompt = "Enable debug mode"
|
||||
```
|
||||
```text
|
||||
|
||||
Render with template:
|
||||
|
||||
```bash
|
||||
typedialog nickel-template forms/config_schema.ncl.j2 results.json -o config.ncl
|
||||
```
|
||||
```text
|
||||
|
||||
Output:
|
||||
|
||||
@ -126,7 +126,7 @@ Output:
|
||||
debug_mode | doc "Enable debug mode" : Bool = true,
|
||||
},
|
||||
}
|
||||
```
|
||||
```text
|
||||
|
||||
### Service Specification
|
||||
|
||||
@ -140,7 +140,7 @@ typedialog nickel-template forms/service_spec.ncl.j2 \
|
||||
service_results.json -o service.ncl
|
||||
|
||||
nickel export service.ncl
|
||||
```
|
||||
```text
|
||||
|
||||
## Extending
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ cargo run --package typedialog-ag -- tests/agent/test-openai.agent.mdx
|
||||
|
||||
# Test Gemini provider
|
||||
cargo run --package typedialog-ag -- tests/agent/test-gemini.agent.mdx
|
||||
```
|
||||
```text
|
||||
|
||||
### Requirements
|
||||
|
||||
@ -38,7 +38,7 @@ export OPENAI_API_KEY=sk-...
|
||||
|
||||
# For Gemini test
|
||||
export GEMINI_API_KEY=...
|
||||
```
|
||||
```text
|
||||
|
||||
## Unit Tests
|
||||
|
||||
@ -53,7 +53,7 @@ cargo test --package typedialog-ag-core llm::
|
||||
|
||||
# Run with ignored tests (requires API keys)
|
||||
cargo test --package typedialog-ag-core -- --ignored
|
||||
```
|
||||
```text
|
||||
|
||||
## Integration Tests
|
||||
|
||||
@ -65,7 +65,7 @@ cargo test --package typedialog-ag-core --test integration_test
|
||||
|
||||
# Run simple integration test
|
||||
cargo test --package typedialog-ag-core --test simple_integration_test
|
||||
```
|
||||
```text
|
||||
|
||||
## Test Coverage
|
||||
|
||||
@ -127,21 +127,21 @@ To add a new test agent:
|
||||
## Troubleshooting
|
||||
|
||||
### API Key Not Set
|
||||
```
|
||||
```text
|
||||
Error: ANTHROPIC_API_KEY environment variable not set
|
||||
```
|
||||
```text
|
||||
**Solution**: Set the appropriate environment variable
|
||||
|
||||
### Quota Exceeded
|
||||
```
|
||||
```text
|
||||
Error: 429 Too Many Requests
|
||||
```
|
||||
```text
|
||||
**Solution**: Wait for quota reset or upgrade API plan
|
||||
|
||||
### Ollama Not Running
|
||||
```
|
||||
```text
|
||||
Error: Failed to call Ollama API - is Ollama running?
|
||||
```
|
||||
```text
|
||||
**Solution**: Start Ollama server with `ollama serve`
|
||||
|
||||
## See Also
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user