ocpipe 0.6.9 → 0.6.11
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 -15
- package/example/correction.ts +1 -2
- package/example/index.ts +6 -7
- package/package.json +13 -12
- package/src/agent.ts +184 -209
- package/src/claude-code.ts +19 -24
- package/src/index.ts +3 -3
- package/src/omp.ts +313 -0
- package/src/pipeline.ts +8 -7
- package/src/predict.ts +9 -8
- package/src/testing.ts +7 -5
- package/src/types.ts +75 -42
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
|
|
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
|
|
@@ -92,10 +97,9 @@ pi: { command: 'pi' },
|
|
|
92
97
|
|
|
93
98
|
### Requirements
|
|
94
99
|
|
|
95
|
-
**For
|
|
100
|
+
**For Oh My Pi:** Install the `omp` CLI and authenticate the models it uses.
|
|
96
101
|
|
|
97
|
-
|
|
98
|
-
- [#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.
|
|
99
103
|
|
|
100
104
|
**For Claude Code backend:** Install the SDK as a peer dependency:
|
|
101
105
|
|
|
@@ -119,6 +123,6 @@ bun add @openai/codex-sdk
|
|
|
119
123
|
|
|
120
124
|
---
|
|
121
125
|
|
|
122
|
-
[
|
|
126
|
+
[Oh My Pi](https://github.com/aperturerobotics/oh-my-pi) · [OpenCode](https://github.com/sst/opencode)
|
|
123
127
|
|
|
124
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.11",
|
|
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",
|
|
@@ -43,18 +44,18 @@
|
|
|
43
44
|
}
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
|
-
"@anthropic-ai/claude-agent-sdk": "^0.3.
|
|
47
|
+
"@anthropic-ai/claude-agent-sdk": "^0.3.197",
|
|
47
48
|
"@eslint/js": "^10.0.1",
|
|
48
|
-
"@openai/codex-sdk": "0.
|
|
49
|
-
"@typescript/native-preview": "^7.0.0-dev.
|
|
50
|
-
"bun-types": "^1.3.
|
|
51
|
-
"eslint": "^10.
|
|
52
|
-
"globals": "^17.
|
|
49
|
+
"@openai/codex-sdk": "0.142.5",
|
|
50
|
+
"@typescript/native-preview": "^7.0.0-dev.20260630.1",
|
|
51
|
+
"bun-types": "^1.3.14",
|
|
52
|
+
"eslint": "^10.6.0",
|
|
53
|
+
"globals": "^17.7.0",
|
|
53
54
|
"jiti": "^2.7.0",
|
|
54
|
-
"prettier": "^3.
|
|
55
|
+
"prettier": "^3.9.4",
|
|
55
56
|
"typescript": "^6.0.3",
|
|
56
|
-
"typescript-eslint": "^8.
|
|
57
|
-
"vitest": "^4.1.
|
|
57
|
+
"typescript-eslint": "^8.62.1",
|
|
58
|
+
"vitest": "^4.1.9"
|
|
58
59
|
},
|
|
59
60
|
"scripts": {
|
|
60
61
|
"lint": "eslint .",
|