Skip to content

Commit e9b00a1

Browse files
committed
Preparing V2
1 parent 340aaff commit e9b00a1

File tree

59 files changed

+2678
-756
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2678
-756
lines changed

packages/agent-ctrl/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ $response = AgentCtrl::make($agentType)
8787
| `onText(callable)` | Set text event callback |
8888
| `onToolUse(callable)` | Set tool use callback |
8989
| `onComplete(callable)` | Set completion callback |
90+
| `onError(callable)` | Set streamed error event callback |
91+
92+
Notes:
93+
- Command execution is single-attempt (no automatic retries/backoff).
94+
- `inDirectory(string)` is supported by all three bridges.
9095

9196
### Claude Code Specific
9297

@@ -137,13 +142,30 @@ $response->usage; // TokenUsage (input/output tokens)
137142
$response->cost; // Cost in USD (if available)
138143
$response->toolCalls; // Array of ToolCall objects
139144
$response->rawResponse; // Original bridge response
145+
$response->parseFailures(); // Number of malformed JSON payloads
146+
$response->parseFailureSamples(); // Sample malformed payloads (up to 3)
140147

141148
$response->isSuccess(); // true if exitCode === 0
142149
$response->text(); // Alias for $response->text
143150
$response->usage(); // Alias for $response->usage
144151
$response->cost(); // Alias for $response->cost
145152
```
146153

154+
## JSON Parsing Behavior
155+
156+
- Default behavior is fail-fast: malformed JSON/JSONL raises `Cognesy\Utils\Json\JsonParsingException`.
157+
- For tolerant parsing, instantiate a concrete bridge with `failFast: false` (advanced usage).
158+
- In tolerant mode, malformed payloads are skipped and exposed via `parseFailures()` / `parseFailureSamples()`.
159+
160+
```php
161+
use Cognesy\AgentCtrl\Bridge\OpenCodeBridge;
162+
163+
$bridge = new OpenCodeBridge(failFast: false);
164+
$response = $bridge->execute('Analyze this repository');
165+
166+
echo $response->parseFailures();
167+
```
168+
147169
## Architecture
148170

149171
```

packages/agent-ctrl/src/Bridge/ClaudeCodeBridge.php

Lines changed: 257 additions & 138 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)