ocpipe 0.6.10 → 0.6.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -22
- package/example/correction.ts +1 -2
- package/example/index.ts +6 -7
- package/package.json +4 -3
- package/src/agent.ts +436 -188
- package/src/claude-code.ts +19 -24
- package/src/codex.ts +28 -8
- package/src/errors.ts +19 -0
- package/src/index.ts +3 -3
- package/src/pipeline.ts +7 -7
- package/src/predict.ts +6 -8
- package/src/testing.ts +7 -5
- package/src/types.ts +36 -41
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<p align="center"><strong>ocpipe</strong></p>
|
|
2
|
-
<p align="center">Build LLM pipelines with
|
|
2
|
+
<p align="center">Build LLM pipelines with Oh My Pi, OpenCode, Claude Code, Codex, Pi, and <a href="https://zod.dev">Zod</a>.</p>
|
|
3
3
|
<p align="center">Inspired by <a href="https://github.com/stanfordnlp/dspy">DSPy</a>.</p>
|
|
4
4
|
<p align="center">
|
|
5
5
|
<a href="https://www.npmjs.com/package/ocpipe"><img alt="npm" src="https://img.shields.io/npm/v/ocpipe?style=flat-square" /></a>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
- **Type-safe** Define inputs and outputs with Zod schemas
|
|
12
12
|
- **Modular** Compose modules into complex pipelines
|
|
13
13
|
- **Checkpoints** Resume from any step
|
|
14
|
-
- **Multi-backend** Choose between
|
|
14
|
+
- **Multi-backend** Choose between Oh My Pi, OpenCode, Claude Code SDK, Codex SDK, or Pi
|
|
15
15
|
- **Auto-correction** Fixes schema mismatches automatically
|
|
16
16
|
|
|
17
17
|
### Quick Start
|
|
@@ -32,8 +32,9 @@ const Greet = signature({
|
|
|
32
32
|
const pipeline = new Pipeline(
|
|
33
33
|
{
|
|
34
34
|
name: 'hello-world',
|
|
35
|
-
defaultModel: {
|
|
36
|
-
|
|
35
|
+
defaultModel: { backend: 'omp', modelID: 'gpt-5.5' },
|
|
36
|
+
checkpointDir: './ckpt',
|
|
37
|
+
logDir: './logs',
|
|
37
38
|
},
|
|
38
39
|
createBaseState,
|
|
39
40
|
)
|
|
@@ -49,24 +50,28 @@ type GreetOut = InferOutputs<typeof Greet> // { greeting: string }
|
|
|
49
50
|
|
|
50
51
|
### Backends
|
|
51
52
|
|
|
52
|
-
ocpipe supports five backends for running LLM
|
|
53
|
+
ocpipe supports five backends for running LLM prompts:
|
|
53
54
|
|
|
54
|
-
**
|
|
55
|
+
**Oh My Pi** (default) - Uses the `omp` CLI in headless JSON print mode.
|
|
55
56
|
|
|
56
57
|
```typescript
|
|
57
58
|
const pipeline = new Pipeline(
|
|
58
59
|
{
|
|
59
60
|
name: 'my-pipeline',
|
|
60
|
-
defaultModel: {
|
|
61
|
-
|
|
62
|
-
modelID: 'claude-sonnet-4-20250514',
|
|
63
|
-
},
|
|
64
|
-
defaultAgent: 'default',
|
|
61
|
+
defaultModel: { backend: 'omp', modelID: 'gpt-5.5' },
|
|
62
|
+
omp: { command: 'omp', approvalMode: 'yolo', thinking: 'high' },
|
|
65
63
|
},
|
|
66
64
|
createBaseState,
|
|
67
65
|
)
|
|
68
66
|
```
|
|
69
67
|
|
|
68
|
+
**OpenCode** - Uses the `opencode` CLI. ocpipe passes prompt files directly and does not create or reference `.opencode/agents` definitions.
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
defaultModel: { backend: 'opencode', providerID: 'anthropic', modelID: 'claude-sonnet-4' },
|
|
72
|
+
opencode: { command: 'opencode' },
|
|
73
|
+
```
|
|
74
|
+
|
|
70
75
|
**Claude Code** - Uses `@anthropic-ai/claude-agent-sdk`. Install as a peer dependency.
|
|
71
76
|
|
|
72
77
|
```typescript
|
|
@@ -83,13 +88,6 @@ defaultModel: { backend: 'codex', modelID: 'gpt-5.4' },
|
|
|
83
88
|
codex: { sandbox: 'read-only', reasoningEffort: 'high' },
|
|
84
89
|
```
|
|
85
90
|
|
|
86
|
-
**Oh My Pi** - Uses the `omp` CLI in headless JSON print mode.
|
|
87
|
-
|
|
88
|
-
```typescript
|
|
89
|
-
defaultModel: { backend: 'omp', modelID: 'gpt-5.5' },
|
|
90
|
-
omp: { command: 'omp', approvalMode: 'yolo', thinking: 'high' },
|
|
91
|
-
```
|
|
92
|
-
|
|
93
91
|
**Pi** - Uses the `pi` coding-agent CLI JSONL RPC mode.
|
|
94
92
|
|
|
95
93
|
```typescript
|
|
@@ -99,10 +97,9 @@ pi: { command: 'pi' },
|
|
|
99
97
|
|
|
100
98
|
### Requirements
|
|
101
99
|
|
|
102
|
-
**For
|
|
100
|
+
**For Oh My Pi:** Install the `omp` CLI and authenticate the models it uses.
|
|
103
101
|
|
|
104
|
-
|
|
105
|
-
- [#5339](https://github.com/anomalyco/opencode/pull/5339) - Adds `--tools` flag to limit available tools (optional)
|
|
102
|
+
**For OpenCode backend:** Install the `opencode` CLI and authenticate the providers it uses. ocpipe does not require a `.opencode` directory.
|
|
106
103
|
|
|
107
104
|
**For Claude Code backend:** Install the SDK as a peer dependency:
|
|
108
105
|
|
|
@@ -126,6 +123,6 @@ bun add @openai/codex-sdk
|
|
|
126
123
|
|
|
127
124
|
---
|
|
128
125
|
|
|
129
|
-
[
|
|
126
|
+
[Oh My Pi](https://github.com/aperturerobotics/oh-my-pi) · [OpenCode](https://github.com/sst/opencode)
|
|
130
127
|
|
|
131
128
|
<sub>An [Aperture Robotics](https://github.com/aperturerobotics) project.</sub>
|
package/example/correction.ts
CHANGED
|
@@ -71,8 +71,7 @@ async function main() {
|
|
|
71
71
|
const pipeline = new Pipeline(
|
|
72
72
|
{
|
|
73
73
|
name: 'correction-demo',
|
|
74
|
-
defaultModel: {
|
|
75
|
-
defaultAgent: 'default',
|
|
74
|
+
defaultModel: { backend: 'omp', modelID: 'gpt-5.5' },
|
|
76
75
|
checkpointDir: './ckpt',
|
|
77
76
|
logDir: './logs',
|
|
78
77
|
},
|
package/example/index.ts
CHANGED
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Demonstrates running an ocpipe module in a pipeline.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* npx tsx example/index.ts
|
|
8
|
-
* npx tsx example/index.ts --claude-code # Use claude-code backend
|
|
6
|
+
* npx tsx example/index.ts # Use OMP backend
|
|
7
|
+
* npx tsx example/index.ts --claude-code # Use Claude Code backend
|
|
9
8
|
*/
|
|
10
9
|
|
|
11
10
|
import { Pipeline, createBaseState } from '../src/index.js'
|
|
@@ -18,10 +17,10 @@ async function main() {
|
|
|
18
17
|
const pipeline = new Pipeline(
|
|
19
18
|
{
|
|
20
19
|
name: 'hello-world',
|
|
21
|
-
defaultModel:
|
|
22
|
-
?
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
defaultModel:
|
|
21
|
+
useClaudeCode ?
|
|
22
|
+
{ backend: 'claude-code', modelID: 'sonnet' }
|
|
23
|
+
: { backend: 'omp', modelID: 'gpt-5.5' },
|
|
25
24
|
checkpointDir: './ckpt',
|
|
26
25
|
logDir: './logs',
|
|
27
26
|
},
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ocpipe",
|
|
3
|
-
"version": "0.6.
|
|
4
|
-
"description": "SDK for LLM pipelines with OpenCode, Codex, and Zod",
|
|
3
|
+
"version": "0.6.12",
|
|
4
|
+
"description": "SDK for LLM pipelines with OpenCode, OMP, Codex, Claude Code, Pi, and Zod",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"types": "src/index.ts",
|
|
@@ -17,9 +17,10 @@
|
|
|
17
17
|
"author": "s4wave",
|
|
18
18
|
"keywords": [
|
|
19
19
|
"dspy",
|
|
20
|
-
"
|
|
20
|
+
"omp",
|
|
21
21
|
"opencode",
|
|
22
22
|
"codex",
|
|
23
|
+
"claude-code",
|
|
23
24
|
"typescript",
|
|
24
25
|
"ai",
|
|
25
26
|
"workflow",
|