@in-the-loop-labs/pair-review 5.1.1 → 5.2.1
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 +12 -4
- package/package.json +3 -2
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin-code-critic/.claude-plugin/plugin.json +1 -1
- package/plugin-pair-loop/.claude-plugin/plugin.json +1 -1
- package/public/index.html +6 -2
- package/public/js/index.js +251 -73
- package/public/js/repo-links.js +60 -11
- package/src/ai/index.js +1 -0
- package/src/ai/omp/review-config.yml +13 -0
- package/src/ai/omp-provider.js +279 -0
- package/src/ai/pi-format.js +535 -0
- package/src/ai/pi-provider.js +38 -963
- package/src/ai/pi-style-provider.js +526 -0
- package/src/ai/provider.js +2 -0
- package/src/chat/chat-providers.js +34 -11
- package/src/chat/omp-bridge.js +111 -0
- package/src/chat/pi-bridge.js +42 -34
- package/src/chat/session-manager.js +30 -4
- package/src/config.js +32 -3
- package/src/database.js +24 -0
- package/src/external/github-adapter.js +8 -10
- package/src/links/host-names.js +200 -0
- package/src/local-review.js +7 -3
- package/src/main.js +72 -23
- package/src/review-config.js +81 -5
- package/src/routes/config.js +42 -12
- package/src/routes/external-comments.js +18 -6
- package/src/routes/github-collections.js +32 -5
- package/src/routes/local.js +1 -1
- package/src/routes/pr.js +47 -28
- package/src/routes/setup.js +15 -8
- package/src/routes/stack-analysis.js +22 -9
- package/src/routes/worktrees.js +36 -0
- package/src/server.js +8 -3
- package/src/settings/registry.js +1 -1
- package/src/setup/local-setup.js +5 -3
- package/src/setup/pr-setup.js +49 -26
- package/src/single-port.js +7 -7
- package/src/utils/host-resolution.js +177 -27
- package/src/utils/local-path-input.js +64 -8
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Copyright 2026 Tim Perkins (tjwp) | SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
#
|
|
3
|
+
# OMP config overlay loaded via `omp --config` for every pair-review analysis
|
|
4
|
+
# run. Review runs must not depend on the user's global ~/.omp/agent/config.yml
|
|
5
|
+
# for these settings.
|
|
6
|
+
#
|
|
7
|
+
# advisor.enabled: the advisor runtime passively reviews each turn and injects
|
|
8
|
+
# notes into the conversation. That adds cost and nondeterminism to analysis
|
|
9
|
+
# runs, so it is disabled by default. Set `"advisor": true` in
|
|
10
|
+
# config.json providers.omp to opt back in (pair-review then passes --advisor
|
|
11
|
+
# instead of this overlay).
|
|
12
|
+
advisor:
|
|
13
|
+
enabled: false
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
// Copyright 2026 Tim Perkins (tjwp) | SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
/**
|
|
3
|
+
* OMP (Oh My Pi) AI Provider
|
|
4
|
+
*
|
|
5
|
+
* Implements the AI provider interface for the OMP coding agent CLI, a fork
|
|
6
|
+
* of the Pi coding agent. Uses `omp -p --mode json` for non-interactive
|
|
7
|
+
* execution with structured output.
|
|
8
|
+
*
|
|
9
|
+
* OMP emits the same JSONL event stream as Pi (session, turn_start,
|
|
10
|
+
* message_start, message_update, message_end, tool_execution_start/update/end,
|
|
11
|
+
* agent_end, etc.), so parsing is shared with the Pi provider via pi-format.js
|
|
12
|
+
* and the process lifecycle (spawn/parse/abort/timeout) via PiStyleProvider
|
|
13
|
+
* (pi-style-provider.js). This file defines OMP's CLI surface: argv
|
|
14
|
+
* construction, model resolution, and env merging.
|
|
15
|
+
*
|
|
16
|
+
* Differences from the Pi provider:
|
|
17
|
+
* - Model selection: OMP's --model accepts fuzzy matches and full
|
|
18
|
+
* `provider/model` strings directly (--provider is legacy), so cli_model
|
|
19
|
+
* values are passed to --model verbatim instead of being split.
|
|
20
|
+
* - Advisor runtime: OMP can passively review each turn and inject notes
|
|
21
|
+
* (advisor.enabled in ~/.omp/agent/config.yml). Reviews disable it by
|
|
22
|
+
* default via a bundled --config overlay; set `"advisor": true` in
|
|
23
|
+
* config.json providers.omp to opt in (passes --advisor instead).
|
|
24
|
+
* - Tools: OMP's read-only tool set is read,bash,grep,glob (no find/ls).
|
|
25
|
+
* - No bundled task extension or --no-prompt-templates flag (Pi-specific).
|
|
26
|
+
*
|
|
27
|
+
* OMP provides a 'default' analysis mode and supports additional models via
|
|
28
|
+
* config.providers.omp.models in ~/.pair-review/config.json.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
const path = require('path');
|
|
32
|
+
const { registerProvider } = require('./provider');
|
|
33
|
+
const { PiStyleProvider } = require('./pi-style-provider');
|
|
34
|
+
|
|
35
|
+
// Config overlay that disables the advisor runtime for review runs.
|
|
36
|
+
// Loaded with `--config`, which merges on top of ~/.omp/agent/config.yml,
|
|
37
|
+
// so reviews stay deterministic even when the user enables the advisor
|
|
38
|
+
// globally. There is no --no-advisor flag, so the overlay is the only
|
|
39
|
+
// per-run off switch.
|
|
40
|
+
const REVIEW_CONFIG_OVERLAY_PATH = path.join(__dirname, 'omp', 'review-config.yml');
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* OMP model definitions
|
|
44
|
+
*
|
|
45
|
+
* OMP delegates model selection to the user's OMP configuration
|
|
46
|
+
* (~/.omp/agent/config.yml). The built-in 'default' entry uses whatever model
|
|
47
|
+
* the user has configured as their OMP default.
|
|
48
|
+
*
|
|
49
|
+
* Users can add specific models via config.json providers.omp.models.
|
|
50
|
+
* cli_model values are passed verbatim to --model, which fuzzy-matches
|
|
51
|
+
* ("opus", "gpt-5.2") and accepts full `provider/model` strings
|
|
52
|
+
* (e.g., 'anthropic/claude-opus-5'). Run `omp models` to list the catalog.
|
|
53
|
+
*/
|
|
54
|
+
const OMP_MODELS = [
|
|
55
|
+
{
|
|
56
|
+
id: 'default',
|
|
57
|
+
cli_model: null,
|
|
58
|
+
name: 'Default',
|
|
59
|
+
tier: 'balanced',
|
|
60
|
+
tagline: 'Your OMP Default',
|
|
61
|
+
description: 'Uses your configured OMP default model',
|
|
62
|
+
badge: 'Default',
|
|
63
|
+
badgeClass: 'badge-recommended',
|
|
64
|
+
default: true
|
|
65
|
+
}
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
class OmpProvider extends PiStyleProvider {
|
|
69
|
+
/**
|
|
70
|
+
* @param {string|null} [model='default'] - Model identifier or null/undefined for default mode
|
|
71
|
+
* @param {Object} configOverrides - Config overrides from providers config
|
|
72
|
+
* @param {string} configOverrides.command - Custom CLI command
|
|
73
|
+
* @param {string[]} configOverrides.extra_args - Additional CLI arguments
|
|
74
|
+
* @param {Object} configOverrides.env - Additional environment variables
|
|
75
|
+
* @param {Object[]} configOverrides.models - Custom model definitions
|
|
76
|
+
* @param {boolean} [configOverrides.load_skills=true] - When false, adds --no-skills to suppress skill auto-discovery
|
|
77
|
+
* @param {boolean} [configOverrides.advisor=false] - When true, enables OMP's advisor runtime
|
|
78
|
+
* (--advisor) instead of disabling it via the bundled config overlay
|
|
79
|
+
*/
|
|
80
|
+
constructor(model, configOverrides = {}) {
|
|
81
|
+
super(model || 'default');
|
|
82
|
+
|
|
83
|
+
// Store config overrides early so _resolveCliModelArgs can use them
|
|
84
|
+
this.configOverrides = configOverrides;
|
|
85
|
+
|
|
86
|
+
// Resolve model configuration from built-in definitions and config overrides
|
|
87
|
+
const resolvedModel = model || 'default';
|
|
88
|
+
const builtIn = OMP_MODELS.find(m => m.id === resolvedModel);
|
|
89
|
+
const configModel = configOverrides.models?.find(m => m.id === resolvedModel);
|
|
90
|
+
|
|
91
|
+
// Conditionally include --model (null = suppress, let OMP use its default)
|
|
92
|
+
const cliModelArgs = this._resolveCliModelArgs(resolvedModel);
|
|
93
|
+
|
|
94
|
+
// Command precedence: ENV > config > default
|
|
95
|
+
const envCmd = process.env.PAIR_REVIEW_OMP_CMD;
|
|
96
|
+
const configCmd = configOverrides.command;
|
|
97
|
+
const ompCmd = envCmd || configCmd || 'omp';
|
|
98
|
+
|
|
99
|
+
// For multi-word commands, use shell mode
|
|
100
|
+
this.useShell = ompCmd.includes(' ');
|
|
101
|
+
|
|
102
|
+
// ============================================================================
|
|
103
|
+
// SECURITY: OMP CLI tool permissions
|
|
104
|
+
// ============================================================================
|
|
105
|
+
//
|
|
106
|
+
// OMP's --tools flag controls which built-in tools are available to the model.
|
|
107
|
+
// When --tools is specified, ONLY the listed tools are loaded; unlisted tools
|
|
108
|
+
// (edit, write) are not available at all — they cannot be requested or executed.
|
|
109
|
+
// MCP tools configured in the user's OMP setup are likewise excluded because
|
|
110
|
+
// they are not on the allowlist.
|
|
111
|
+
//
|
|
112
|
+
// Enabled tools: read, bash, grep, glob
|
|
113
|
+
// Excluded tools: edit, write (file modification), task, MCP tools
|
|
114
|
+
//
|
|
115
|
+
// LIMITATION: The `bash` tool grants arbitrary shell command execution.
|
|
116
|
+
// Unlike Claude (Bash(git diff*) prefixes) or Copilot (shell(git diff) prefixes),
|
|
117
|
+
// OMP does not support fine-grained bash command restrictions. The model could
|
|
118
|
+
// theoretically execute destructive commands (rm, git push, etc.).
|
|
119
|
+
//
|
|
120
|
+
// MITIGATION STRATEGY:
|
|
121
|
+
// 1. Prompt engineering: Analysis prompts explicitly instruct the AI to only
|
|
122
|
+
// use read-only operations and never modify files
|
|
123
|
+
// 2. Worktree isolation: Analysis runs in a git worktree, limiting blast radius
|
|
124
|
+
// 3. Tool exclusion: edit and write tools are not loaded at all
|
|
125
|
+
//
|
|
126
|
+
// If OMP CLI adds prefix-based bash restrictions in the future, they should
|
|
127
|
+
// be adopted here to match the granularity of other providers.
|
|
128
|
+
// ============================================================================
|
|
129
|
+
|
|
130
|
+
// omp -p --mode json --model <model> --tools read,bash,grep,glob <prompt-via-@file>
|
|
131
|
+
// -p: Non-interactive mode (process prompt and exit)
|
|
132
|
+
// --mode json: Output JSONL events
|
|
133
|
+
// --model: Specify the model (omitted when cli_model is null to use OMP's default)
|
|
134
|
+
// --tools: Enable read-only tools for Level 2/3 analysis (excludes edit,write for safety)
|
|
135
|
+
// --no-session: Each omp invocation is an ephemeral analysis — there's no need to
|
|
136
|
+
// persist session state between runs. Set PAIR_REVIEW_OMP_SESSION=1
|
|
137
|
+
// to enable session saving for debugging (sessions saved under ~/.omp/).
|
|
138
|
+
// Advisor: disabled by default via the bundled --config overlay (see
|
|
139
|
+
// REVIEW_CONFIG_OVERLAY_PATH); configOverrides.advisor === true opts in via --advisor.
|
|
140
|
+
// Build args: base args + built-in extra_args + provider extra_args + model extra_args
|
|
141
|
+
// In yolo mode, omit --tools entirely to allow all tools (including edit, write)
|
|
142
|
+
// load_skills (default true): when false, adds --no-skills to suppress skill
|
|
143
|
+
// auto-discovery.
|
|
144
|
+
const loadSkills = configOverrides.load_skills !== false;
|
|
145
|
+
const sessionArgs = process.env.PAIR_REVIEW_OMP_SESSION ? [] : ['--no-session'];
|
|
146
|
+
const skillArgs = loadSkills ? [] : ['--no-skills'];
|
|
147
|
+
const advisorArgs = configOverrides.advisor === true
|
|
148
|
+
? ['--advisor']
|
|
149
|
+
: ['--config', REVIEW_CONFIG_OVERLAY_PATH];
|
|
150
|
+
let baseArgs;
|
|
151
|
+
if (configOverrides.yolo) {
|
|
152
|
+
baseArgs = ['-p', '--mode', 'json', ...cliModelArgs, ...sessionArgs,
|
|
153
|
+
...advisorArgs, ...skillArgs];
|
|
154
|
+
} else {
|
|
155
|
+
baseArgs = ['-p', '--mode', 'json', ...cliModelArgs, '--tools', 'read,bash,grep,glob',
|
|
156
|
+
...sessionArgs, ...advisorArgs, ...skillArgs];
|
|
157
|
+
}
|
|
158
|
+
const builtInArgs = builtIn?.extra_args || [];
|
|
159
|
+
const providerArgs = configOverrides.extra_args || [];
|
|
160
|
+
const modelArgs = configModel?.extra_args || [];
|
|
161
|
+
|
|
162
|
+
// Store base command (used by the shared execute/extraction/availability
|
|
163
|
+
// paths in PiStyleProvider) and args (prompt added in execute)
|
|
164
|
+
this.cliCmd = ompCmd;
|
|
165
|
+
this.cliName = 'OMP';
|
|
166
|
+
this.extraEnv = this._resolveEnvForModel(resolvedModel);
|
|
167
|
+
this.baseArgs = [...baseArgs, ...builtInArgs, ...providerArgs, ...modelArgs];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Resolve the extra env vars for a given model.
|
|
172
|
+
* Merge order: built-in model → provider config → per-model config.
|
|
173
|
+
* Later entries override earlier ones, so model-specific settings take
|
|
174
|
+
* precedence over provider-level ones. Unlike Pi, no task-extension env
|
|
175
|
+
* vars (PI_CMD, PI_TASK_MAX_DEPTH) are set — OMP has no bundled extension.
|
|
176
|
+
*
|
|
177
|
+
* Used both by the constructor (analysis model) and by the shared
|
|
178
|
+
* getExtractionConfig() (extraction model), so the extraction fallback picks
|
|
179
|
+
* up env configured on its own (possibly fast-tier) model.
|
|
180
|
+
*
|
|
181
|
+
* @param {string} modelId - Model identifier
|
|
182
|
+
* @returns {Object} Env vars to merge into the child environment
|
|
183
|
+
*/
|
|
184
|
+
_resolveEnvForModel(modelId) {
|
|
185
|
+
const builtIn = OMP_MODELS.find(m => m.id === modelId);
|
|
186
|
+
const configModel = this.configOverrides?.models?.find(m => m.id === modelId);
|
|
187
|
+
return {
|
|
188
|
+
...(builtIn?.env || {}),
|
|
189
|
+
...(this.configOverrides?.env || {}),
|
|
190
|
+
...(configModel?.env || {})
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Resolve the --model CLI arguments for a given model ID.
|
|
196
|
+
* Checks config model overrides, then built-in definitions, then falls back
|
|
197
|
+
* to the raw ID. Returns an empty array when cli_model is null (OMP uses its
|
|
198
|
+
* configured default).
|
|
199
|
+
*
|
|
200
|
+
* Unlike Pi, `provider/model` strings are passed to --model verbatim: OMP's
|
|
201
|
+
* --model fuzzy-matches and accepts full provider-qualified names directly
|
|
202
|
+
* (its --provider flag is legacy).
|
|
203
|
+
*
|
|
204
|
+
* @param {string|null} modelId - Model identifier
|
|
205
|
+
* @returns {string[]} CLI arguments (e.g., ['--model', 'x'] or [])
|
|
206
|
+
*/
|
|
207
|
+
_resolveCliModelArgs(modelId) {
|
|
208
|
+
const builtIn = OMP_MODELS.find(m => m.id === modelId);
|
|
209
|
+
const configModel = this.configOverrides?.models?.find(m => m.id === modelId);
|
|
210
|
+
const resolvedCliModel = configModel?.cli_model !== undefined
|
|
211
|
+
? configModel.cli_model
|
|
212
|
+
: (builtIn?.cli_model !== undefined ? builtIn.cli_model : modelId);
|
|
213
|
+
if (resolvedCliModel === null) return [];
|
|
214
|
+
return ['--model', resolvedCliModel];
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Build args for OMP CLI execution, applying provider and model extra_args.
|
|
219
|
+
* This ensures consistent arg construction for both execute() and getExtractionConfig().
|
|
220
|
+
*
|
|
221
|
+
* @param {string} model - The model identifier to use
|
|
222
|
+
* @returns {string[]} Complete args array for the CLI
|
|
223
|
+
*/
|
|
224
|
+
buildArgsForModel(model) {
|
|
225
|
+
const cliModelArgs = this._resolveCliModelArgs(model);
|
|
226
|
+
|
|
227
|
+
// Note: built-in extra_args are intentionally excluded for extraction.
|
|
228
|
+
// Extraction is a simple JSON-parsing task that doesn't need
|
|
229
|
+
// analysis-specific configuration.
|
|
230
|
+
|
|
231
|
+
// Base args for omp non-interactive JSON mode (extraction only — no tools needed).
|
|
232
|
+
// The advisor overlay is always applied here: advisor notes cannot help a
|
|
233
|
+
// JSON-parsing task, they only add cost, so extraction never opts in even
|
|
234
|
+
// when configOverrides.advisor is true.
|
|
235
|
+
// load_skills: mirror the analysis run — when the user disabled skill
|
|
236
|
+
// auto-discovery, the extraction fallback must not re-enable it.
|
|
237
|
+
const sessionArgs = process.env.PAIR_REVIEW_OMP_SESSION ? [] : ['--no-session'];
|
|
238
|
+
const skillArgs = this.configOverrides?.load_skills === false ? ['--no-skills'] : [];
|
|
239
|
+
const baseArgs = ['-p', '--mode', 'json', ...cliModelArgs, '--no-tools', ...sessionArgs,
|
|
240
|
+
'--config', REVIEW_CONFIG_OVERLAY_PATH, ...skillArgs];
|
|
241
|
+
const configModel = this.configOverrides?.models?.find(m => m.id === model);
|
|
242
|
+
const providerArgs = this.configOverrides?.extra_args || [];
|
|
243
|
+
const modelArgs = configModel?.extra_args || [];
|
|
244
|
+
return [...baseArgs, ...providerArgs, ...modelArgs];
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
static getProviderName() {
|
|
248
|
+
return 'OMP';
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
static getProviderId() {
|
|
252
|
+
return 'omp';
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
static getModels() {
|
|
256
|
+
return OMP_MODELS;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
static getDefaultModel() {
|
|
260
|
+
const defaultModel = OMP_MODELS.find(m => m.default);
|
|
261
|
+
return defaultModel ? defaultModel.id : null;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
static getInstallInstructions() {
|
|
265
|
+
return 'Install OMP (Oh My Pi): npm install -g @oh-my-pi/pi-coding-agent\n' +
|
|
266
|
+
'Or visit: https://github.com/can1357/oh-my-pi';
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/** Default timeout in ms (15 minutes) — matches Pi, which OMP is a fork of */
|
|
270
|
+
static defaultTimeout = 900000;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// Register this provider
|
|
274
|
+
registerProvider('omp', OmpProvider);
|
|
275
|
+
|
|
276
|
+
module.exports = OmpProvider;
|
|
277
|
+
// Test-only export. Underscore prefix signals an internal constant that should
|
|
278
|
+
// not be consumed from production code paths.
|
|
279
|
+
module.exports._REVIEW_CONFIG_OVERLAY_PATH = REVIEW_CONFIG_OVERLAY_PATH;
|