-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/codra agent native protocol #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
82e01e4
926203c
bfa9308
c7fc0fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| # Codra Agent-Native Protocol Adoption | ||
|
|
||
| How Codra will adopt the Talocode Agent-Native Protocol for safe, audited agent operations. | ||
|
|
||
| ## Current State | ||
|
|
||
| Codra Code is a CLI-based AI coding agent. It currently operates through: | ||
|
|
||
| - Thread-based conversations | ||
| - File read/write operations | ||
| - Terminal command execution | ||
| - Git operations | ||
| - Model relay to external providers | ||
| - Plan-based task execution | ||
|
|
||
| ## Planned Codra Actions | ||
|
|
||
| ### Read-Only Actions (No Approval Required) | ||
|
|
||
| | Action | Risk | Description | | ||
| |--------|------|-------------| | ||
| | `codra.plan.create` | read | Create an execution plan | | ||
| | `codra.thread.resume` | read | Resume a conversation thread | | ||
| | `codra.context.compress` | read | Compress context for token efficiency | | ||
| | `codra.file.read` | read | Read file contents | | ||
| | `codra.git.status` | read | Check git repository status | | ||
| | `codra.git.diff` | read | View file differences | | ||
|
|
||
| ### Write Actions (Approval Required) | ||
|
|
||
| | Action | Risk | Description | | ||
| |--------|------|-------------| | ||
| | `codra.plan.run` | medium | Execute an approved plan | | ||
| | `codra.file.write` | medium | Write or modify file contents | | ||
| | `codra.git.commit` | medium | Create a git commit | | ||
| | `codra.command.run` | high | Execute terminal commands | | ||
|
|
||
| ### Destructive Actions (Unsupported) | ||
|
|
||
| - `codra.git.force_push` — not supported | ||
| - `codra.file.delete` — not supported | ||
| - `codra.database.drop` — not supported | ||
|
|
||
| ## Context Providers | ||
|
|
||
| | Provider | Privacy | Description | | ||
| |----------|---------|-------------| | ||
| | `codra.thread` | workspace | Current conversation thread | | ||
| | `codra.plan` | workspace | Current execution plan | | ||
| | `codra.files` | workspace | File tree and contents | | ||
| | `codra.git` | workspace | Repository state | | ||
| | `codra.model` | private | Model relay configuration | | ||
|
|
||
| ## Permission Gates | ||
|
|
||
| Codra actions declare required permissions: | ||
|
|
||
| - `codra:read` — read files, git status, context | ||
| - `codra:write` — modify files, create commits | ||
| - `codra:execute` — run terminal commands | ||
|
|
||
| Write and execute actions require approval before execution. | ||
|
|
||
| ## Audit Trail | ||
|
|
||
| Every Codra action creates an audit event with: | ||
|
|
||
| - Action type and description | ||
| - Input parameters (sanitized) | ||
| - Execution result | ||
| - Timestamp | ||
| - Actor identifier | ||
|
|
||
| No raw secrets, API keys, or file contents exceeding safe limits are logged. | ||
|
|
||
| ## Adoption Status | ||
|
|
||
| | Component | Status | | ||
| |-----------|--------| | ||
| | Action registry | Planned | | ||
| | Context providers | Planned | | ||
| | Permission gates | Planned | | ||
| | Audit logging | Partial (existing run logging) | | ||
| | Approval workflows | Existing approval system | | ||
| | Protocol endpoint | Not yet implemented | | ||
|
|
||
| ## Migration Plan | ||
|
|
||
| 1. Map existing Codra actions to protocol format | ||
| 2. Add protocol endpoint to Codra API | ||
| 3. Integrate permission gates into file/git operations | ||
| 4. Enhance audit logging with protocol metadata | ||
| 5. Add context providers for thread/plan/file state | ||
|
|
||
| ## Limitations | ||
|
|
||
| - Codra CLI currently operates locally — protocol is for when Codra becomes multi-user | ||
| - File operations are the primary write actions | ||
| - Terminal commands are the highest-risk actions | ||
| - No hosted execution yet |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,11 +2,13 @@ import type { Provider } from './types.js'; | |
| import { MockProvider } from './mock.js'; | ||
| import { OpenAIProvider } from './openai.js'; | ||
| import { OllamaProvider } from './ollama.js'; | ||
| import { TeraProvider } from './tera.js'; | ||
|
|
||
| export type { Provider, Message, ProviderResponse } from './types.js'; | ||
| export { MockProvider } from './mock.js'; | ||
| export { OpenAIProvider } from './openai.js'; | ||
| export { OllamaProvider } from './ollama.js'; | ||
| export { TeraProvider } from './tera.js'; | ||
|
|
||
| export function createProvider(providerName: string, config?: { baseUrl?: string; apiKey?: string }): Provider { | ||
| switch (providerName.toLowerCase()) { | ||
|
|
@@ -16,8 +18,10 @@ export function createProvider(providerName: string, config?: { baseUrl?: string | |
| return new OpenAIProvider(config?.baseUrl, config?.apiKey); | ||
| case 'ollama': | ||
| return new OllamaProvider(config?.baseUrl); | ||
| case 'tera': | ||
| return new TeraProvider(config?.baseUrl); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a user configures Useful? React with 👍 / 👎. |
||
| default: | ||
| throw new Error(`Unknown provider: ${providerName}. Supported: mock, openai, ollama`); | ||
| throw new Error(`Unknown provider: ${providerName}. Supported: mock, openai, ollama, tera`); | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the device start endpoint returns a non-2xx JSON response, such as a 400 or 429 error, this call succeeds and consumes the response body, then execution falls through to parse the same
Responseagain below. That produces a generic body-already-used failure instead of the intended HTTP error, so the non-OK branch should throw after reading the JSON error rather than continuing.Useful? React with 👍 / 👎.