ocpipe 0.6.8 → 0.6.10
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 +17 -3
- package/package.json +12 -12
- package/src/agent.ts +13 -2
- package/src/index.ts +2 -0
- package/src/omp.ts +313 -0
- package/src/pi.ts +383 -0
- package/src/pipeline.ts +2 -0
- package/src/predict.ts +6 -0
- package/src/types.ts +59 -1
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 <a href="https://github.com/sst/opencode">OpenCode</a>, <a href="https://github.com/anthropics/claude-code">Claude Code</a>, and <a href="https://zod.dev">Zod</a>.</p>
|
|
2
|
+
<p align="center">Build LLM pipelines with <a href="https://github.com/sst/opencode">OpenCode</a>, <a href="https://github.com/anthropics/claude-code">Claude Code</a>, Oh My Pi, 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 OpenCode (75+ providers)
|
|
14
|
+
- **Multi-backend** Choose between OpenCode (75+ providers), Claude Code SDK, Codex SDK, Oh My Pi, or Pi
|
|
15
15
|
- **Auto-correction** Fixes schema mismatches automatically
|
|
16
16
|
|
|
17
17
|
### Quick Start
|
|
@@ -49,7 +49,7 @@ type GreetOut = InferOutputs<typeof Greet> // { greeting: string }
|
|
|
49
49
|
|
|
50
50
|
### Backends
|
|
51
51
|
|
|
52
|
-
ocpipe supports
|
|
52
|
+
ocpipe supports five backends for running LLM agents:
|
|
53
53
|
|
|
54
54
|
**OpenCode** (default) - Requires `opencode` CLI in your PATH. Supports 75+ providers.
|
|
55
55
|
|
|
@@ -83,6 +83,20 @@ defaultModel: { backend: 'codex', modelID: 'gpt-5.4' },
|
|
|
83
83
|
codex: { sandbox: 'read-only', reasoningEffort: 'high' },
|
|
84
84
|
```
|
|
85
85
|
|
|
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
|
+
**Pi** - Uses the `pi` coding-agent CLI JSONL RPC mode.
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
defaultModel: { backend: 'pi', modelID: 'gemma' },
|
|
97
|
+
pi: { command: 'pi' },
|
|
98
|
+
```
|
|
99
|
+
|
|
86
100
|
### Requirements
|
|
87
101
|
|
|
88
102
|
**For OpenCode backend:** Currently requires [this OpenCode fork](https://github.com/paralin/opencode). Once the following PRs are merged, the official release will work:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ocpipe",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.10",
|
|
4
4
|
"description": "SDK for LLM pipelines with OpenCode, Codex, and Zod",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"zod": "4.4.3",
|
|
34
|
-
"@anthropic-ai/claude-agent-sdk": "0.
|
|
35
|
-
"@openai/codex-sdk": "0.
|
|
34
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.185",
|
|
35
|
+
"@openai/codex-sdk": "0.141.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependenciesMeta": {
|
|
38
38
|
"@anthropic-ai/claude-agent-sdk": {
|
|
@@ -43,18 +43,18 @@
|
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@anthropic-ai/claude-agent-sdk": "^0.
|
|
46
|
+
"@anthropic-ai/claude-agent-sdk": "^0.3.197",
|
|
47
47
|
"@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.
|
|
48
|
+
"@openai/codex-sdk": "0.142.5",
|
|
49
|
+
"@typescript/native-preview": "^7.0.0-dev.20260630.1",
|
|
50
|
+
"bun-types": "^1.3.14",
|
|
51
|
+
"eslint": "^10.6.0",
|
|
52
|
+
"globals": "^17.7.0",
|
|
53
53
|
"jiti": "^2.7.0",
|
|
54
|
-
"prettier": "^3.
|
|
54
|
+
"prettier": "^3.9.4",
|
|
55
55
|
"typescript": "^6.0.3",
|
|
56
|
-
"typescript-eslint": "^8.
|
|
57
|
-
"vitest": "^4.1.
|
|
56
|
+
"typescript-eslint": "^8.62.1",
|
|
57
|
+
"vitest": "^4.1.9"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"lint": "eslint .",
|
package/src/agent.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ocpipe agent integration.
|
|
3
3
|
*
|
|
4
|
-
* Dispatches to OpenCode CLI, Claude Code SDK,
|
|
4
|
+
* Dispatches to OpenCode CLI, Claude Code SDK, Codex SDK, or Pi based on backend
|
|
5
5
|
* configuration.
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -9,6 +9,8 @@ import { spawn } from 'child_process'
|
|
|
9
9
|
import { mkdir, writeFile, unlink } from 'fs/promises'
|
|
10
10
|
import { join } from 'path'
|
|
11
11
|
import { PROJECT_ROOT, TMP_DIR } from './paths.js'
|
|
12
|
+
import { runOmpAgent } from './omp.js'
|
|
13
|
+
import { runPiAgent } from './pi.js'
|
|
12
14
|
import type { RunAgentOptions, RunAgentResult } from './types.js'
|
|
13
15
|
|
|
14
16
|
/** Get command and args to invoke opencode from PATH */
|
|
@@ -23,16 +25,25 @@ export async function runAgent(
|
|
|
23
25
|
const backend = options.model.backend ?? 'opencode'
|
|
24
26
|
|
|
25
27
|
if (backend === 'claude-code') {
|
|
26
|
-
// Dynamic import
|
|
28
|
+
// Dynamic import is required: @anthropic-ai/claude-agent-sdk is an optional peer absent for other backends.
|
|
27
29
|
const { runClaudeCodeAgent } = await import('./claude-code.js')
|
|
28
30
|
return runClaudeCodeAgent(options)
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
if (backend === 'codex') {
|
|
34
|
+
// Dynamic import is required: @openai/codex-sdk is an optional peer absent for other backends.
|
|
32
35
|
const { runCodexAgent } = await import('./codex.js')
|
|
33
36
|
return runCodexAgent(options)
|
|
34
37
|
}
|
|
35
38
|
|
|
39
|
+
if (backend === 'pi') {
|
|
40
|
+
return runPiAgent(options)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (backend === 'omp') {
|
|
44
|
+
return runOmpAgent(options)
|
|
45
|
+
}
|
|
46
|
+
|
|
36
47
|
return runOpencodeAgent(options)
|
|
37
48
|
}
|
|
38
49
|
|
package/src/index.ts
CHANGED
package/src/omp.ts
ADDED
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ocpipe Oh My Pi integration.
|
|
3
|
+
*
|
|
4
|
+
* Runs Oh My Pi through its headless JSON print mode.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { spawn, type ChildProcess } from 'child_process'
|
|
8
|
+
import { isAbsolute, join } from 'path'
|
|
9
|
+
import { PROJECT_ROOT } from './paths.js'
|
|
10
|
+
import type { OmpOptions, RunAgentOptions, RunAgentResult } from './types.js'
|
|
11
|
+
|
|
12
|
+
interface OmpProcessRequest {
|
|
13
|
+
command: string
|
|
14
|
+
args: string[]
|
|
15
|
+
cwd: string
|
|
16
|
+
env: NodeJS.ProcessEnv
|
|
17
|
+
signal?: AbortSignal
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface OmpProcessResult {
|
|
21
|
+
stdout: string
|
|
22
|
+
stderr: string
|
|
23
|
+
exitCode: number | null
|
|
24
|
+
signal: NodeJS.Signals | null
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface OmpProcess {
|
|
28
|
+
run(req: OmpProcessRequest): Promise<OmpProcessResult>
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface OmpRunSummary {
|
|
32
|
+
sawJsonEvent: boolean
|
|
33
|
+
sessionId: string
|
|
34
|
+
finalMessage: string
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const defaultOmpCommand = 'omp'
|
|
38
|
+
const defaultOmpThinking = 'high'
|
|
39
|
+
const defaultOmpApprovalMode = 'yolo'
|
|
40
|
+
|
|
41
|
+
/** runOmpAgent executes an Oh My Pi coding-agent turn. */
|
|
42
|
+
export async function runOmpAgent(
|
|
43
|
+
options: RunAgentOptions,
|
|
44
|
+
processRunner: OmpProcess = commandOmpProcess,
|
|
45
|
+
): Promise<RunAgentResult> {
|
|
46
|
+
const {
|
|
47
|
+
prompt,
|
|
48
|
+
model,
|
|
49
|
+
sessionId,
|
|
50
|
+
timeoutSec = 3600,
|
|
51
|
+
workdir,
|
|
52
|
+
omp,
|
|
53
|
+
signal,
|
|
54
|
+
} = options
|
|
55
|
+
|
|
56
|
+
if (signal?.aborted) {
|
|
57
|
+
throw new Error('Request aborted')
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const cwd = workdir ?? PROJECT_ROOT
|
|
61
|
+
const sessionInfo = sessionId ? `[session:${sessionId}]` : '[new session]'
|
|
62
|
+
const promptPreview = prompt.slice(0, 50).replace(/\n/g, ' ')
|
|
63
|
+
console.error(
|
|
64
|
+
`\n>>> OMP [${model.modelID}] ${sessionInfo}: ${promptPreview}...`,
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
const abort = new AbortController()
|
|
68
|
+
const abortHandler = () => abort.abort()
|
|
69
|
+
signal?.addEventListener('abort', abortHandler, { once: true })
|
|
70
|
+
let timedOut = false
|
|
71
|
+
const timeout =
|
|
72
|
+
timeoutSec > 0 ?
|
|
73
|
+
setTimeout(() => {
|
|
74
|
+
timedOut = true
|
|
75
|
+
abort.abort()
|
|
76
|
+
}, timeoutSec * 1000)
|
|
77
|
+
: null
|
|
78
|
+
|
|
79
|
+
try {
|
|
80
|
+
const result = await processRunner.run({
|
|
81
|
+
command: omp?.command ?? defaultOmpCommand,
|
|
82
|
+
args: buildOmpArgs(model.modelID, cwd, sessionId, prompt, omp),
|
|
83
|
+
cwd: omp?.processCwd ?? cwd,
|
|
84
|
+
env: buildOmpEnv(omp),
|
|
85
|
+
signal: abort.signal,
|
|
86
|
+
})
|
|
87
|
+
const summary = parseOmpOutput(result.stdout)
|
|
88
|
+
const detail =
|
|
89
|
+
result.signal ? `signal ${result.signal}` : `status ${result.exitCode}`
|
|
90
|
+
if (result.exitCode !== 0 || result.signal) {
|
|
91
|
+
const message = firstNonEmpty(
|
|
92
|
+
summary.finalMessage,
|
|
93
|
+
result.stderr.trim(),
|
|
94
|
+
result.stdout.trim(),
|
|
95
|
+
detail,
|
|
96
|
+
)
|
|
97
|
+
throw new Error(`OMP exited with ${detail}: ${message}`)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const response = firstNonEmpty(
|
|
101
|
+
summary.finalMessage,
|
|
102
|
+
summary.sawJsonEvent ? '' : result.stdout.trim(),
|
|
103
|
+
)
|
|
104
|
+
if (!response) {
|
|
105
|
+
throw new Error('OMP returned an empty final message')
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const nextSessionId = firstNonEmpty(summary.sessionId, sessionId ?? '')
|
|
109
|
+
console.error(
|
|
110
|
+
`<<< OMP done (${response.length} chars)${nextSessionId ? ` [session:${nextSessionId}]` : ''}`,
|
|
111
|
+
)
|
|
112
|
+
return {
|
|
113
|
+
text: response,
|
|
114
|
+
sessionId: nextSessionId,
|
|
115
|
+
}
|
|
116
|
+
} catch (err) {
|
|
117
|
+
if (timedOut) {
|
|
118
|
+
throw new Error(`Timeout after ${timeoutSec}s`, { cause: err })
|
|
119
|
+
}
|
|
120
|
+
if (signal?.aborted) {
|
|
121
|
+
throw new Error('Request aborted', { cause: err })
|
|
122
|
+
}
|
|
123
|
+
throw err
|
|
124
|
+
} finally {
|
|
125
|
+
if (timeout) clearTimeout(timeout)
|
|
126
|
+
signal?.removeEventListener('abort', abortHandler)
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function buildOmpArgs(
|
|
131
|
+
modelID: string,
|
|
132
|
+
cwd: string,
|
|
133
|
+
sessionId: string | undefined,
|
|
134
|
+
prompt: string,
|
|
135
|
+
omp: OmpOptions | undefined,
|
|
136
|
+
): string[] {
|
|
137
|
+
const args = ['--print', '--mode', 'json', '--cwd', cwd]
|
|
138
|
+
if (modelID) {
|
|
139
|
+
args.push('--model', modelID)
|
|
140
|
+
}
|
|
141
|
+
if (hasOwn(omp, 'codexHome')) {
|
|
142
|
+
args.push('--codex-home', omp?.codexHome ?? '')
|
|
143
|
+
}
|
|
144
|
+
if (sessionId) {
|
|
145
|
+
args.push('--resume', sessionId)
|
|
146
|
+
}
|
|
147
|
+
if (omp?.goalMode || firstNonEmpty(omp?.goalObjective ?? '')) {
|
|
148
|
+
const objective = firstNonEmpty(omp?.goalObjective ?? '', prompt)
|
|
149
|
+
if (objective) {
|
|
150
|
+
args.push('--goal', objective)
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (
|
|
154
|
+
typeof omp?.contextStopPercent === 'number' &&
|
|
155
|
+
omp.contextStopPercent > 0
|
|
156
|
+
) {
|
|
157
|
+
args.push('--context-stop-percent', String(omp.contextStopPercent))
|
|
158
|
+
}
|
|
159
|
+
if (typeof omp?.contextStopTokens === 'number' && omp.contextStopTokens > 0) {
|
|
160
|
+
args.push('--context-stop-tokens', String(omp.contextStopTokens))
|
|
161
|
+
}
|
|
162
|
+
if (omp?.scratchHandoffFile) {
|
|
163
|
+
args.push(
|
|
164
|
+
'--scratch-handoff-file',
|
|
165
|
+
resolveOmpPath(cwd, omp.scratchHandoffFile),
|
|
166
|
+
)
|
|
167
|
+
}
|
|
168
|
+
if (omp?.autoApprove ?? true) {
|
|
169
|
+
args.push('--auto-approve')
|
|
170
|
+
}
|
|
171
|
+
const approvalMode = omp?.approvalMode ?? defaultOmpApprovalMode
|
|
172
|
+
if (approvalMode) {
|
|
173
|
+
args.push('--approval-mode', approvalMode)
|
|
174
|
+
}
|
|
175
|
+
const thinking = omp?.thinking ?? defaultOmpThinking
|
|
176
|
+
if (thinking) {
|
|
177
|
+
args.push('--thinking', thinking)
|
|
178
|
+
}
|
|
179
|
+
args.push(...(omp?.extraArgs ?? []))
|
|
180
|
+
if (prompt) {
|
|
181
|
+
args.push('--', prompt)
|
|
182
|
+
}
|
|
183
|
+
return args
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function buildOmpEnv(omp: OmpOptions | undefined): NodeJS.ProcessEnv {
|
|
187
|
+
const env: NodeJS.ProcessEnv = { ...process.env, ...omp?.env }
|
|
188
|
+
if (hasOwn(omp, 'codexHome')) {
|
|
189
|
+
delete env.CODEX_HOME
|
|
190
|
+
}
|
|
191
|
+
if (omp?.home) {
|
|
192
|
+
env.OMP_HOME = omp.home
|
|
193
|
+
}
|
|
194
|
+
return env
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function resolveOmpPath(cwd: string, path: string): string {
|
|
198
|
+
return isAbsolute(path) ? path : join(cwd, path)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function parseOmpOutput(stdout: string): OmpRunSummary {
|
|
202
|
+
const summary: OmpRunSummary = {
|
|
203
|
+
sawJsonEvent: false,
|
|
204
|
+
sessionId: '',
|
|
205
|
+
finalMessage: '',
|
|
206
|
+
}
|
|
207
|
+
for (const rawLine of stdout.split('\n')) {
|
|
208
|
+
const line = rawLine.trim()
|
|
209
|
+
if (!line) continue
|
|
210
|
+
let event: unknown
|
|
211
|
+
try {
|
|
212
|
+
event = JSON.parse(line)
|
|
213
|
+
} catch {
|
|
214
|
+
continue
|
|
215
|
+
}
|
|
216
|
+
if (!isRecord(event)) continue
|
|
217
|
+
summary.sawJsonEvent = true
|
|
218
|
+
const type = ompString(event.type)
|
|
219
|
+
if (type === 'session') {
|
|
220
|
+
summary.sessionId = firstNonEmpty(
|
|
221
|
+
ompString(event.id),
|
|
222
|
+
ompString(event.sessionId),
|
|
223
|
+
ompString(event.session_id),
|
|
224
|
+
summary.sessionId,
|
|
225
|
+
)
|
|
226
|
+
continue
|
|
227
|
+
}
|
|
228
|
+
if (type === 'message_end') {
|
|
229
|
+
const text = ompAssistantText(event.message)
|
|
230
|
+
if (text) {
|
|
231
|
+
summary.finalMessage = text
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
if (!summary.sawJsonEvent) {
|
|
236
|
+
summary.finalMessage = stdout.trim()
|
|
237
|
+
}
|
|
238
|
+
return summary
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function ompAssistantText(raw: unknown): string {
|
|
242
|
+
if (!isRecord(raw) || ompString(raw.role) !== 'assistant') return ''
|
|
243
|
+
if (Array.isArray(raw.content)) {
|
|
244
|
+
const parts: string[] = []
|
|
245
|
+
for (const rawPart of raw.content) {
|
|
246
|
+
if (!isRecord(rawPart) || ompString(rawPart.type) !== 'text') continue
|
|
247
|
+
const text = ompString(rawPart.text).trim()
|
|
248
|
+
if (text) parts.push(text)
|
|
249
|
+
}
|
|
250
|
+
return parts.join('\n\n')
|
|
251
|
+
}
|
|
252
|
+
return ompString(raw.content).trim()
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const commandOmpProcess: OmpProcess = {
|
|
256
|
+
run(req) {
|
|
257
|
+
const { promise, resolve, reject } =
|
|
258
|
+
Promise.withResolvers<OmpProcessResult>()
|
|
259
|
+
let child: ChildProcess
|
|
260
|
+
try {
|
|
261
|
+
child = spawn(req.command, req.args, {
|
|
262
|
+
cwd: req.cwd,
|
|
263
|
+
env: req.env,
|
|
264
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
265
|
+
})
|
|
266
|
+
} catch (err) {
|
|
267
|
+
reject(err)
|
|
268
|
+
return promise
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const stdoutChunks: Buffer[] = []
|
|
272
|
+
const stderrChunks: Buffer[] = []
|
|
273
|
+
const abortHandler = () => child.kill()
|
|
274
|
+
req.signal?.addEventListener('abort', abortHandler, { once: true })
|
|
275
|
+
|
|
276
|
+
child.stdout?.on('data', (chunk: Buffer) => stdoutChunks.push(chunk))
|
|
277
|
+
child.stderr?.on('data', (chunk: Buffer) => stderrChunks.push(chunk))
|
|
278
|
+
child.on('error', reject)
|
|
279
|
+
child.on('close', (exitCode, signal) => {
|
|
280
|
+
req.signal?.removeEventListener('abort', abortHandler)
|
|
281
|
+
resolve({
|
|
282
|
+
stdout: Buffer.concat(stdoutChunks).toString('utf8'),
|
|
283
|
+
stderr: Buffer.concat(stderrChunks).toString('utf8'),
|
|
284
|
+
exitCode,
|
|
285
|
+
signal,
|
|
286
|
+
})
|
|
287
|
+
})
|
|
288
|
+
return promise
|
|
289
|
+
},
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function hasOwn<T extends object, K extends PropertyKey>(
|
|
293
|
+
value: T | undefined,
|
|
294
|
+
key: K,
|
|
295
|
+
): value is T & Record<K, unknown> {
|
|
296
|
+
return !!value && Object.prototype.hasOwnProperty.call(value, key)
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
300
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
function ompString(value: unknown): string {
|
|
304
|
+
return typeof value === 'string' ? value : ''
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
function firstNonEmpty(...values: string[]): string {
|
|
308
|
+
for (const value of values) {
|
|
309
|
+
const trimmed = value.trim()
|
|
310
|
+
if (trimmed) return trimmed
|
|
311
|
+
}
|
|
312
|
+
return ''
|
|
313
|
+
}
|
package/src/pi.ts
ADDED
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ocpipe Pi coding-agent integration.
|
|
3
|
+
*
|
|
4
|
+
* Runs Pi through its JSONL RPC mode.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { spawn, type ChildProcess } from 'child_process'
|
|
8
|
+
import { createInterface } from 'readline'
|
|
9
|
+
import { join } from 'path'
|
|
10
|
+
import { homedir } from 'os'
|
|
11
|
+
import { PROJECT_ROOT } from './paths.js'
|
|
12
|
+
import type { PiOptions, RunAgentOptions, RunAgentResult } from './types.js'
|
|
13
|
+
|
|
14
|
+
interface PiProcessRequest {
|
|
15
|
+
command: string
|
|
16
|
+
args: string[]
|
|
17
|
+
cwd: string
|
|
18
|
+
env: NodeJS.ProcessEnv
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface PiConnection {
|
|
22
|
+
send(line: string): void
|
|
23
|
+
recv(signal?: AbortSignal): Promise<string>
|
|
24
|
+
close(): void
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface PiProcess {
|
|
28
|
+
start(req: PiProcessRequest): PiConnection
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface PiRPCState {
|
|
32
|
+
sessionID: string
|
|
33
|
+
modelSummary: string
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const defaultPiCommand = 'pi'
|
|
37
|
+
|
|
38
|
+
/** runPiAgent executes a Pi coding-agent turn over JSONL RPC. */
|
|
39
|
+
export async function runPiAgent(
|
|
40
|
+
options: RunAgentOptions,
|
|
41
|
+
processRunner: PiProcess = commandPiProcess,
|
|
42
|
+
): Promise<RunAgentResult> {
|
|
43
|
+
const {
|
|
44
|
+
prompt,
|
|
45
|
+
model,
|
|
46
|
+
sessionId,
|
|
47
|
+
timeoutSec = 3600,
|
|
48
|
+
workdir,
|
|
49
|
+
pi,
|
|
50
|
+
signal,
|
|
51
|
+
} = options
|
|
52
|
+
|
|
53
|
+
if (signal?.aborted) {
|
|
54
|
+
throw new Error('Request aborted')
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const cwd = workdir ?? PROJECT_ROOT
|
|
58
|
+
const sessionInfo = sessionId ? `[session:${sessionId}]` : '[new session]'
|
|
59
|
+
const promptPreview = prompt.slice(0, 50).replace(/\n/g, ' ')
|
|
60
|
+
console.error(
|
|
61
|
+
`\n>>> Pi [${model.modelID}] ${sessionInfo}: ${promptPreview}...`,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
const abort = new AbortController()
|
|
65
|
+
const abortHandler = () => abort.abort()
|
|
66
|
+
signal?.addEventListener('abort', abortHandler, { once: true })
|
|
67
|
+
let timedOut = false
|
|
68
|
+
const timeout =
|
|
69
|
+
timeoutSec > 0 ?
|
|
70
|
+
setTimeout(() => {
|
|
71
|
+
timedOut = true
|
|
72
|
+
abort.abort()
|
|
73
|
+
}, timeoutSec * 1000)
|
|
74
|
+
: null
|
|
75
|
+
|
|
76
|
+
const conn = processRunner.start({
|
|
77
|
+
command: pi?.command ?? defaultPiCommand,
|
|
78
|
+
args: buildPiArgs(model.modelID, sessionId, pi),
|
|
79
|
+
cwd,
|
|
80
|
+
env: buildPiEnv(pi),
|
|
81
|
+
})
|
|
82
|
+
const client = new PiRPCClient(conn)
|
|
83
|
+
|
|
84
|
+
try {
|
|
85
|
+
const initial = await client.getState(abort.signal)
|
|
86
|
+
await client.prompt(prompt, abort.signal)
|
|
87
|
+
await client.waitAgentEnd(abort.signal)
|
|
88
|
+
const response = await client.getLastAssistantText(abort.signal)
|
|
89
|
+
const final = await client.getState(abort.signal)
|
|
90
|
+
const nextSessionId = firstNonEmpty(
|
|
91
|
+
final.sessionID,
|
|
92
|
+
initial.sessionID,
|
|
93
|
+
sessionId ?? '',
|
|
94
|
+
)
|
|
95
|
+
if (!nextSessionId) {
|
|
96
|
+
throw new Error('Pi RPC did not emit a provider session ID')
|
|
97
|
+
}
|
|
98
|
+
if (!response) {
|
|
99
|
+
throw new Error('Pi RPC returned an empty final message')
|
|
100
|
+
}
|
|
101
|
+
const modelSummary =
|
|
102
|
+
final.modelSummary ? ` model=${final.modelSummary}` : ''
|
|
103
|
+
console.error(
|
|
104
|
+
`<<< Pi done (${response.length} chars) [session:${nextSessionId}]${modelSummary}`,
|
|
105
|
+
)
|
|
106
|
+
return {
|
|
107
|
+
text: response,
|
|
108
|
+
sessionId: nextSessionId,
|
|
109
|
+
}
|
|
110
|
+
} catch (err) {
|
|
111
|
+
if (timedOut) {
|
|
112
|
+
throw new Error(`Timeout after ${timeoutSec}s`, { cause: err })
|
|
113
|
+
}
|
|
114
|
+
if (signal?.aborted) {
|
|
115
|
+
throw new Error('Request aborted', { cause: err })
|
|
116
|
+
}
|
|
117
|
+
throw err
|
|
118
|
+
} finally {
|
|
119
|
+
if (timeout) clearTimeout(timeout)
|
|
120
|
+
signal?.removeEventListener('abort', abortHandler)
|
|
121
|
+
conn.close()
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function buildPiArgs(
|
|
126
|
+
modelID: string,
|
|
127
|
+
sessionId: string | undefined,
|
|
128
|
+
pi: PiOptions | undefined,
|
|
129
|
+
): string[] {
|
|
130
|
+
const args = ['--mode', 'rpc', '--approve']
|
|
131
|
+
const sessionDir = piSessionDir(pi)
|
|
132
|
+
if (sessionDir) {
|
|
133
|
+
args.push('--session-dir', sessionDir)
|
|
134
|
+
}
|
|
135
|
+
if (sessionId) {
|
|
136
|
+
args.push('--session-id', sessionId)
|
|
137
|
+
}
|
|
138
|
+
if (modelID) {
|
|
139
|
+
args.push('--model', modelID)
|
|
140
|
+
}
|
|
141
|
+
return args
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function buildPiEnv(pi: PiOptions | undefined): NodeJS.ProcessEnv {
|
|
145
|
+
const providerHome = piProviderHome(pi)
|
|
146
|
+
const sessionDir = piSessionDir(pi)
|
|
147
|
+
return {
|
|
148
|
+
...process.env,
|
|
149
|
+
...pi?.env,
|
|
150
|
+
PI_CODING_AGENT_DIR: providerHome,
|
|
151
|
+
PI_CODING_AGENT_SESSION_DIR: sessionDir,
|
|
152
|
+
...(pi?.baseUrl ? { LLAMA_BASE_URL: pi.baseUrl } : {}),
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function piProviderHome(pi: PiOptions | undefined): string {
|
|
157
|
+
return pi?.providerHome ?? join(homedir(), '.pi-coding-agent')
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function piSessionDir(pi: PiOptions | undefined): string {
|
|
161
|
+
return pi?.sessionDir ?? join(piProviderHome(pi), 'sessions')
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
class PiRPCClient {
|
|
165
|
+
private nextID = 0
|
|
166
|
+
|
|
167
|
+
constructor(private readonly conn: PiConnection) {}
|
|
168
|
+
|
|
169
|
+
async prompt(message: string, signal?: AbortSignal): Promise<void> {
|
|
170
|
+
const response = await this.request('prompt', { message }, signal)
|
|
171
|
+
const command = piString(response.command)
|
|
172
|
+
if (command && command !== 'prompt') {
|
|
173
|
+
throw new Error(`Pi RPC command mismatch: expected prompt got ${command}`)
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
async getState(signal?: AbortSignal): Promise<PiRPCState> {
|
|
178
|
+
const response = await this.request('get_state', {}, signal)
|
|
179
|
+
const data = piObject(response.data, 'Pi get_state response missing data')
|
|
180
|
+
return {
|
|
181
|
+
sessionID: piString(data.sessionId),
|
|
182
|
+
modelSummary: piModelSummary(data.model),
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
async getLastAssistantText(signal?: AbortSignal): Promise<string> {
|
|
187
|
+
const response = await this.request('get_last_assistant_text', {}, signal)
|
|
188
|
+
const data = piObject(
|
|
189
|
+
response.data,
|
|
190
|
+
'Pi get_last_assistant_text response missing data',
|
|
191
|
+
)
|
|
192
|
+
return piString(data.text)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
async waitAgentEnd(signal?: AbortSignal): Promise<void> {
|
|
196
|
+
for (;;) {
|
|
197
|
+
const { value } = await this.recv(signal)
|
|
198
|
+
if (piString(value.type) === 'agent_end') {
|
|
199
|
+
return
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
private async request(
|
|
205
|
+
type: string,
|
|
206
|
+
fields: Record<string, string>,
|
|
207
|
+
signal?: AbortSignal,
|
|
208
|
+
): Promise<Record<string, unknown>> {
|
|
209
|
+
this.nextID++
|
|
210
|
+
const id = `ocpipe-pi-${this.nextID}`
|
|
211
|
+
this.conn.send(JSON.stringify({ type, id, ...fields }))
|
|
212
|
+
for (;;) {
|
|
213
|
+
const { value, line } = await this.recv(signal)
|
|
214
|
+
if (piString(value.type) !== 'response' || piString(value.id) !== id) {
|
|
215
|
+
continue
|
|
216
|
+
}
|
|
217
|
+
if (value.success !== true) {
|
|
218
|
+
const errorText = piString(value.error) || line
|
|
219
|
+
throw new Error(`Pi RPC ${type} failed: ${errorText}`)
|
|
220
|
+
}
|
|
221
|
+
return value
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
private async recv(
|
|
226
|
+
signal?: AbortSignal,
|
|
227
|
+
): Promise<{ value: Record<string, unknown>; line: string }> {
|
|
228
|
+
const line = await this.conn.recv(signal)
|
|
229
|
+
let parsed: unknown
|
|
230
|
+
try {
|
|
231
|
+
parsed = JSON.parse(line)
|
|
232
|
+
} catch (err) {
|
|
233
|
+
throw new Error(`Parse Pi RPC JSONL failed: ${line}`, { cause: err })
|
|
234
|
+
}
|
|
235
|
+
return { value: piObject(parsed, 'Pi RPC line must be an object'), line }
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const commandPiProcess: PiProcess = {
|
|
240
|
+
start(req) {
|
|
241
|
+
const child = spawn(req.command, req.args, {
|
|
242
|
+
cwd: req.cwd,
|
|
243
|
+
env: req.env,
|
|
244
|
+
stdio: ['pipe', 'pipe', 'inherit'],
|
|
245
|
+
})
|
|
246
|
+
return new CommandPiConnection(child)
|
|
247
|
+
},
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
class CommandPiConnection implements PiConnection {
|
|
251
|
+
private readonly lines: string[] = []
|
|
252
|
+
private readonly waiters: Array<{
|
|
253
|
+
resolve: (line: string) => void
|
|
254
|
+
reject: (err: Error) => void
|
|
255
|
+
signal?: AbortSignal
|
|
256
|
+
abort?: () => void
|
|
257
|
+
}> = []
|
|
258
|
+
private closedError: Error | null = null
|
|
259
|
+
|
|
260
|
+
constructor(private readonly child: ChildProcess) {
|
|
261
|
+
if (!child.stdout || !child.stdin) {
|
|
262
|
+
throw new Error('Pi RPC process pipes were not opened')
|
|
263
|
+
}
|
|
264
|
+
const rl = createInterface({ input: child.stdout })
|
|
265
|
+
rl.on('line', (line) => this.push(line))
|
|
266
|
+
child.on('error', (err) => this.closeWith(err))
|
|
267
|
+
child.on('close', (code, signal) => {
|
|
268
|
+
if (this.closedError) return
|
|
269
|
+
if (code === 0) {
|
|
270
|
+
this.closeWith(new Error('Pi RPC closed'))
|
|
271
|
+
return
|
|
272
|
+
}
|
|
273
|
+
const detail = signal ? `signal ${signal}` : `status ${code}`
|
|
274
|
+
this.closeWith(new Error(`Pi RPC exited with ${detail}`))
|
|
275
|
+
})
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
send(line: string): void {
|
|
279
|
+
if (!this.child.stdin) {
|
|
280
|
+
throw new Error('Pi RPC stdin is closed')
|
|
281
|
+
}
|
|
282
|
+
this.child.stdin.write(line.trimEnd() + '\n')
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
recv(signal?: AbortSignal): Promise<string> {
|
|
286
|
+
if (this.lines.length > 0) {
|
|
287
|
+
return Promise.resolve(this.lines.shift() ?? '')
|
|
288
|
+
}
|
|
289
|
+
if (this.closedError) {
|
|
290
|
+
return Promise.reject(this.closedError)
|
|
291
|
+
}
|
|
292
|
+
if (signal?.aborted) {
|
|
293
|
+
return Promise.reject(new Error('Request aborted'))
|
|
294
|
+
}
|
|
295
|
+
return new Promise((resolve, reject) => {
|
|
296
|
+
const waiter = {
|
|
297
|
+
resolve,
|
|
298
|
+
reject,
|
|
299
|
+
signal,
|
|
300
|
+
abort: undefined as (() => void) | undefined,
|
|
301
|
+
}
|
|
302
|
+
waiter.abort = () => {
|
|
303
|
+
this.removeWaiter(waiter)
|
|
304
|
+
reject(new Error('Request aborted'))
|
|
305
|
+
}
|
|
306
|
+
signal?.addEventListener('abort', waiter.abort, { once: true })
|
|
307
|
+
this.waiters.push(waiter)
|
|
308
|
+
})
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
close(): void {
|
|
312
|
+
this.child.stdin?.destroy()
|
|
313
|
+
this.child.kill()
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
private push(line: string): void {
|
|
317
|
+
const waiter = this.waiters.shift()
|
|
318
|
+
if (!waiter) {
|
|
319
|
+
this.lines.push(line)
|
|
320
|
+
return
|
|
321
|
+
}
|
|
322
|
+
if (waiter.abort) {
|
|
323
|
+
waiter.signal?.removeEventListener('abort', waiter.abort)
|
|
324
|
+
}
|
|
325
|
+
waiter.resolve(line)
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
private closeWith(err: Error): void {
|
|
329
|
+
this.closedError = err
|
|
330
|
+
for (const waiter of this.waiters.splice(0)) {
|
|
331
|
+
if (waiter.abort) {
|
|
332
|
+
waiter.signal?.removeEventListener('abort', waiter.abort)
|
|
333
|
+
}
|
|
334
|
+
waiter.reject(err)
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
private removeWaiter(waiter: (typeof this.waiters)[number]): void {
|
|
339
|
+
const idx = this.waiters.indexOf(waiter)
|
|
340
|
+
if (idx >= 0) {
|
|
341
|
+
this.waiters.splice(idx, 1)
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
function piObject(value: unknown, message: string): Record<string, unknown> {
|
|
347
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
348
|
+
throw new Error(message)
|
|
349
|
+
}
|
|
350
|
+
return value as Record<string, unknown>
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
function piString(value: unknown): string {
|
|
354
|
+
return typeof value === 'string' ? value.trim() : ''
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function piModelSummary(value: unknown): string {
|
|
358
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
359
|
+
return ''
|
|
360
|
+
}
|
|
361
|
+
const model = value as Record<string, unknown>
|
|
362
|
+
const provider = firstNonEmpty(
|
|
363
|
+
piString(model.provider),
|
|
364
|
+
piString(model.providerId),
|
|
365
|
+
)
|
|
366
|
+
const id = firstNonEmpty(
|
|
367
|
+
piString(model.id),
|
|
368
|
+
piString(model.model),
|
|
369
|
+
piString(model.name),
|
|
370
|
+
)
|
|
371
|
+
if (provider && id) {
|
|
372
|
+
return `${provider}/${id}`
|
|
373
|
+
}
|
|
374
|
+
return firstNonEmpty(id, provider)
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
function firstNonEmpty(...values: string[]): string {
|
|
378
|
+
for (const value of values) {
|
|
379
|
+
const trimmed = value.trim()
|
|
380
|
+
if (trimmed) return trimmed
|
|
381
|
+
}
|
|
382
|
+
return ''
|
|
383
|
+
}
|
package/src/pipeline.ts
CHANGED
package/src/predict.ts
CHANGED
|
@@ -78,6 +78,8 @@ export class Predict<S extends AnySignature> {
|
|
|
78
78
|
workdir: ctx.workdir,
|
|
79
79
|
claudeCode: ctx.claudeCode,
|
|
80
80
|
codex: ctx.codex,
|
|
81
|
+
pi: ctx.pi,
|
|
82
|
+
omp: ctx.omp,
|
|
81
83
|
signal: ctx.signal,
|
|
82
84
|
})
|
|
83
85
|
|
|
@@ -209,6 +211,8 @@ export class Predict<S extends AnySignature> {
|
|
|
209
211
|
workdir: ctx.workdir,
|
|
210
212
|
claudeCode: ctx.claudeCode,
|
|
211
213
|
codex: ctx.codex,
|
|
214
|
+
pi: ctx.pi,
|
|
215
|
+
omp: ctx.omp,
|
|
212
216
|
signal: ctx.signal,
|
|
213
217
|
})
|
|
214
218
|
|
|
@@ -287,6 +291,8 @@ export class Predict<S extends AnySignature> {
|
|
|
287
291
|
workdir: ctx.workdir,
|
|
288
292
|
claudeCode: ctx.claudeCode,
|
|
289
293
|
codex: ctx.codex,
|
|
294
|
+
pi: ctx.pi,
|
|
295
|
+
omp: ctx.omp,
|
|
290
296
|
signal: ctx.signal,
|
|
291
297
|
})
|
|
292
298
|
|
package/src/types.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type { z } from 'zod/v4'
|
|
|
9
9
|
// ============================================================================
|
|
10
10
|
|
|
11
11
|
/** Backend type for running agents. */
|
|
12
|
-
export type BackendType = 'opencode' | 'claude-code' | 'codex'
|
|
12
|
+
export type BackendType = 'opencode' | 'claude-code' | 'codex' | 'pi' | 'omp'
|
|
13
13
|
|
|
14
14
|
/** Reasoning effort for Codex SDK threads. */
|
|
15
15
|
export type CodexReasoningEffort =
|
|
@@ -119,6 +119,52 @@ export interface CodexOptions {
|
|
|
119
119
|
webSearchEnabled?: boolean
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
/** Pi coding agent specific session options. */
|
|
123
|
+
export interface PiOptions {
|
|
124
|
+
/** Path to the Pi executable (default: `pi` from PATH). */
|
|
125
|
+
command?: string
|
|
126
|
+
/** Pi runtime home passed as PI_CODING_AGENT_DIR. */
|
|
127
|
+
providerHome?: string
|
|
128
|
+
/** Pi session directory passed by flag and PI_CODING_AGENT_SESSION_DIR. */
|
|
129
|
+
sessionDir?: string
|
|
130
|
+
/** Base URL passed as LLAMA_BASE_URL. */
|
|
131
|
+
baseUrl?: string
|
|
132
|
+
/** Extra environment variables passed to the Pi subprocess. */
|
|
133
|
+
env?: Record<string, string>
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** Oh My Pi CLI specific session options. */
|
|
137
|
+
export interface OmpOptions {
|
|
138
|
+
/** Path to the Oh My Pi executable (default: `omp` from PATH). */
|
|
139
|
+
command?: string
|
|
140
|
+
/** Process cwd used to launch Oh My Pi; defaults to the target workdir. */
|
|
141
|
+
processCwd?: string
|
|
142
|
+
/** OMP_HOME passed to the Oh My Pi subprocess. */
|
|
143
|
+
home?: string
|
|
144
|
+
/** CODEX_HOME value passed via `--codex-home`; set to empty string to clear it. */
|
|
145
|
+
codexHome?: string
|
|
146
|
+
/** Extra environment variables passed to the Oh My Pi subprocess. */
|
|
147
|
+
env?: Record<string, string>
|
|
148
|
+
/** Add `--auto-approve` (default: true). */
|
|
149
|
+
autoApprove?: boolean
|
|
150
|
+
/** Approval mode passed with `--approval-mode` (default: `yolo`). */
|
|
151
|
+
approvalMode?: string
|
|
152
|
+
/** Thinking effort passed with `--thinking` (default: `high`). */
|
|
153
|
+
thinking?: string
|
|
154
|
+
/** Run Oh My Pi as a continuing headless goal. */
|
|
155
|
+
goalMode?: boolean
|
|
156
|
+
/** Goal objective; setting this also enables goal mode. */
|
|
157
|
+
goalObjective?: string
|
|
158
|
+
/** Stop when context reaches this percent of the model window. */
|
|
159
|
+
contextStopPercent?: number
|
|
160
|
+
/** Stop when context reaches this token count. */
|
|
161
|
+
contextStopTokens?: number
|
|
162
|
+
/** Scratch handoff path passed to Oh My Pi; relative paths resolve against workdir. */
|
|
163
|
+
scratchHandoffFile?: string
|
|
164
|
+
/** Extra raw Oh My Pi arguments appended before the prompt separator. */
|
|
165
|
+
extraArgs?: string[]
|
|
166
|
+
}
|
|
167
|
+
|
|
122
168
|
/** Model configuration for LLM backends. */
|
|
123
169
|
export interface ModelConfig {
|
|
124
170
|
/** Backend to use (default: 'opencode'). */
|
|
@@ -152,6 +198,10 @@ export interface ExecutionContext {
|
|
|
152
198
|
claudeCode?: ClaudeCodeOptions
|
|
153
199
|
/** Codex SDK specific options. */
|
|
154
200
|
codex?: CodexOptions
|
|
201
|
+
/** Pi coding agent specific options. */
|
|
202
|
+
pi?: PiOptions
|
|
203
|
+
/** Oh My Pi specific options. */
|
|
204
|
+
omp?: OmpOptions
|
|
155
205
|
/** AbortSignal for cancelling in-flight backend requests. */
|
|
156
206
|
signal?: AbortSignal
|
|
157
207
|
}
|
|
@@ -372,6 +422,10 @@ export interface PipelineConfig {
|
|
|
372
422
|
claudeCode?: ClaudeCodeOptions
|
|
373
423
|
/** Codex SDK specific options. */
|
|
374
424
|
codex?: CodexOptions
|
|
425
|
+
/** Pi coding agent specific options. */
|
|
426
|
+
pi?: PiOptions
|
|
427
|
+
/** Oh My Pi specific options. */
|
|
428
|
+
omp?: OmpOptions
|
|
375
429
|
}
|
|
376
430
|
|
|
377
431
|
/** Options for running a pipeline step. */
|
|
@@ -408,6 +462,10 @@ export interface RunAgentOptions {
|
|
|
408
462
|
claudeCode?: ClaudeCodeOptions
|
|
409
463
|
/** Codex SDK specific options. */
|
|
410
464
|
codex?: CodexOptions
|
|
465
|
+
/** Pi coding agent specific options. */
|
|
466
|
+
pi?: PiOptions
|
|
467
|
+
/** Oh My Pi specific options. */
|
|
468
|
+
omp?: OmpOptions
|
|
411
469
|
/** AbortSignal for cancelling the request. */
|
|
412
470
|
signal?: AbortSignal
|
|
413
471
|
}
|