wogiflow 1.0.32 → 1.0.33
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.
|
@@ -34,20 +34,31 @@ For hybrid-specific configuration only:
|
|
|
34
34
|
node scripts/flow-hybrid-interactive.js
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
### Model Selection
|
|
37
|
+
### Model Selection (Session Persistent)
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
The executor model is selected once per session and remembered for subsequent runs.
|
|
40
40
|
|
|
41
41
|
```javascript
|
|
42
42
|
const modelConfig = require('./scripts/flow-model-config');
|
|
43
|
-
const models = modelConfig.getEnabledModels();
|
|
44
43
|
|
|
45
|
-
//
|
|
46
|
-
|
|
44
|
+
// Check if model already selected this session
|
|
45
|
+
const sessionModel = modelConfig.getSessionModels('hybrid');
|
|
46
|
+
|
|
47
|
+
if (sessionModel && !args.includes('--select-model')) {
|
|
48
|
+
// Use session model - show brief note
|
|
49
|
+
console.log(`Using executor: ${sessionModel}`);
|
|
50
|
+
console.log(`(Run with --select-model to change)`);
|
|
51
|
+
// Proceed with hybrid mode using sessionModel
|
|
52
|
+
} else {
|
|
53
|
+
// Show selection if multiple models available
|
|
54
|
+
const models = modelConfig.getEnabledModels();
|
|
47
55
|
// Use AskUserQuestion to let user select
|
|
56
|
+
// Then save: modelConfig.setSessionModels('hybrid', selectedModel);
|
|
48
57
|
}
|
|
49
58
|
```
|
|
50
59
|
|
|
60
|
+
Selection persists until `/wogi-session-end` is called.
|
|
61
|
+
|
|
51
62
|
## How Hybrid Mode Works
|
|
52
63
|
|
|
53
64
|
1. **You give me a task** - "Add user authentication"
|
|
@@ -69,6 +80,7 @@ Typical savings: **20-60%** (depending on task complexity)
|
|
|
69
80
|
- `/wogi-hybrid-off` - Disable hybrid mode
|
|
70
81
|
- `/wogi-hybrid-status` - Check current configuration
|
|
71
82
|
- `/wogi-hybrid-edit` - Modify plan before execution
|
|
83
|
+
- `/wogi-hybrid --select-model` - Change executor model for this session
|
|
72
84
|
|
|
73
85
|
## Supported Models
|
|
74
86
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Run a multi-model peer review where different AI models review the same code.
|
|
2
2
|
|
|
3
|
-
## Step 0: Model Selection (
|
|
3
|
+
## Step 0: Model Selection (Session Persistent)
|
|
4
4
|
|
|
5
|
-
**
|
|
5
|
+
**Models are selected once per session and remembered for subsequent runs.**
|
|
6
6
|
|
|
7
|
-
### Check
|
|
7
|
+
### Check Session State First
|
|
8
8
|
|
|
9
9
|
```javascript
|
|
10
10
|
const modelConfig = require('./scripts/flow-model-config');
|
|
@@ -12,13 +12,22 @@ const modelConfig = require('./scripts/flow-model-config');
|
|
|
12
12
|
// Run migration if needed (handles old config formats)
|
|
13
13
|
modelConfig.migrateOldConfig();
|
|
14
14
|
|
|
15
|
-
//
|
|
16
|
-
const
|
|
15
|
+
// Check if models already selected this session
|
|
16
|
+
const sessionModels = modelConfig.getSessionModels('peerReview');
|
|
17
|
+
|
|
18
|
+
if (sessionModels && sessionModels.length > 0 && !args.includes('--select-models')) {
|
|
19
|
+
// Use session models - show brief note
|
|
20
|
+
console.log(`Using models: ${sessionModels.join(', ')}`);
|
|
21
|
+
console.log(`(Run with --select-models to change)`);
|
|
22
|
+
// Proceed with review using sessionModels
|
|
23
|
+
} else {
|
|
24
|
+
// Need to select models - continue to selection flow
|
|
25
|
+
}
|
|
17
26
|
```
|
|
18
27
|
|
|
19
28
|
### If No Models Configured
|
|
20
29
|
|
|
21
|
-
If `
|
|
30
|
+
If `modelConfig.getEnabledModels().length === 0`:
|
|
22
31
|
|
|
23
32
|
```
|
|
24
33
|
No external models configured for peer review.
|
|
@@ -37,7 +46,9 @@ Then either:
|
|
|
37
46
|
|
|
38
47
|
### Model Selection Dialog
|
|
39
48
|
|
|
40
|
-
|
|
49
|
+
Show selection dialog when:
|
|
50
|
+
- First run of session (no session models set)
|
|
51
|
+
- User passes `--select-models` flag
|
|
41
52
|
|
|
42
53
|
```javascript
|
|
43
54
|
{
|
|
@@ -62,11 +73,13 @@ If models are configured, show selection dialog using AskUserQuestion:
|
|
|
62
73
|
|
|
63
74
|
### After Selection
|
|
64
75
|
|
|
65
|
-
Save the selection
|
|
76
|
+
Save the selection to session state:
|
|
66
77
|
```javascript
|
|
67
|
-
modelConfig.
|
|
78
|
+
modelConfig.setSessionModels('peerReview', selectedModels);
|
|
68
79
|
```
|
|
69
80
|
|
|
81
|
+
This persists until `/wogi-session-end` is called, which clears the selection.
|
|
82
|
+
|
|
70
83
|
Then proceed with the review using selected models.
|
|
71
84
|
|
|
72
85
|
## How It Works
|
|
@@ -99,9 +112,11 @@ Then proceed with the review using selected models.
|
|
|
99
112
|
## Usage
|
|
100
113
|
|
|
101
114
|
```bash
|
|
102
|
-
/wogi-peer-review # Review staged changes
|
|
115
|
+
/wogi-peer-review # Review staged changes (uses session models)
|
|
103
116
|
/wogi-peer-review --files src/*.ts # Review specific files
|
|
104
117
|
/wogi-peer-review --task wf-abc123 # Review task changes
|
|
118
|
+
/wogi-peer-review --select-models # Force model re-selection
|
|
119
|
+
/wogi-peer-review --manual # Manual mode (no API keys needed)
|
|
105
120
|
```
|
|
106
121
|
|
|
107
122
|
## Provider Configuration
|
|
@@ -299,6 +314,8 @@ Add to coding standards? [Y/n]
|
|
|
299
314
|
|
|
300
315
|
## Options
|
|
301
316
|
|
|
317
|
+
- `--select-models` - Force model re-selection (overrides session selection)
|
|
318
|
+
- `--manual` - Manual mode (copy prompt to another AI, paste response back)
|
|
302
319
|
- `--provider <name>` - Override configured provider
|
|
303
320
|
- `--model <name>` - Specify secondary model
|
|
304
321
|
- `--files <glob>` - Review specific files
|
package/package.json
CHANGED
|
@@ -37,6 +37,7 @@ const PROJECT_ROOT = getProjectRoot();
|
|
|
37
37
|
const WORKFLOW_DIR = path.join(PROJECT_ROOT, '.workflow');
|
|
38
38
|
const CONFIG_PATH = path.join(WORKFLOW_DIR, 'config.json');
|
|
39
39
|
const ENV_PATH = path.join(PROJECT_ROOT, '.env');
|
|
40
|
+
const SESSION_STATE_PATH = path.join(WORKFLOW_DIR, 'state', 'session-state.json');
|
|
40
41
|
|
|
41
42
|
/**
|
|
42
43
|
* Known provider configurations
|
|
@@ -562,6 +563,77 @@ function hasConfiguredModels() {
|
|
|
562
563
|
return providers.some(p => p.enabled && p.apiKeySet && p.models.length > 0);
|
|
563
564
|
}
|
|
564
565
|
|
|
566
|
+
// ============================================================
|
|
567
|
+
// Session State (for model selection persistence within session)
|
|
568
|
+
// ============================================================
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Read session state file
|
|
572
|
+
* @returns {Object} Session state object
|
|
573
|
+
*/
|
|
574
|
+
function readSessionState() {
|
|
575
|
+
return safeJsonParse(SESSION_STATE_PATH, {});
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* Write session state file
|
|
580
|
+
* @param {Object} state - State to write
|
|
581
|
+
*/
|
|
582
|
+
function writeSessionState(state) {
|
|
583
|
+
const stateDir = path.dirname(SESSION_STATE_PATH);
|
|
584
|
+
fs.mkdirSync(stateDir, { recursive: true });
|
|
585
|
+
fs.writeFileSync(SESSION_STATE_PATH, JSON.stringify(state, null, 2));
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* Get models selected for current session
|
|
590
|
+
* @param {string} feature - 'peerReview' or 'hybrid'
|
|
591
|
+
* @returns {string|string[]|null} Selected models or null if not set
|
|
592
|
+
*/
|
|
593
|
+
function getSessionModels(feature) {
|
|
594
|
+
const state = readSessionState();
|
|
595
|
+
return state.selectedModels?.[feature] || null;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* Set models for current session
|
|
600
|
+
* @param {string} feature - 'peerReview' or 'hybrid'
|
|
601
|
+
* @param {string|string[]} models - Model(s) to set
|
|
602
|
+
*/
|
|
603
|
+
function setSessionModels(feature, models) {
|
|
604
|
+
const state = readSessionState();
|
|
605
|
+
if (!state.selectedModels) {
|
|
606
|
+
state.selectedModels = {};
|
|
607
|
+
}
|
|
608
|
+
state.selectedModels[feature] = models;
|
|
609
|
+
writeSessionState(state);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* Clear all session model selections
|
|
614
|
+
* Called by /wogi-session-end
|
|
615
|
+
*/
|
|
616
|
+
function clearSessionModels() {
|
|
617
|
+
const state = readSessionState();
|
|
618
|
+
if (state.selectedModels) {
|
|
619
|
+
delete state.selectedModels;
|
|
620
|
+
writeSessionState(state);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Check if models are selected for a feature in current session
|
|
626
|
+
* @param {string} feature - 'peerReview' or 'hybrid'
|
|
627
|
+
* @returns {boolean}
|
|
628
|
+
*/
|
|
629
|
+
function hasSessionModels(feature) {
|
|
630
|
+
const models = getSessionModels(feature);
|
|
631
|
+
if (Array.isArray(models)) {
|
|
632
|
+
return models.length > 0;
|
|
633
|
+
}
|
|
634
|
+
return !!models;
|
|
635
|
+
}
|
|
636
|
+
|
|
565
637
|
// CLI interface
|
|
566
638
|
if (require.main === module) {
|
|
567
639
|
const args = process.argv.slice(2);
|
|
@@ -638,6 +710,12 @@ module.exports = {
|
|
|
638
710
|
getDefaultModels,
|
|
639
711
|
setDefaultModels,
|
|
640
712
|
|
|
713
|
+
// Session state (model selection persistence)
|
|
714
|
+
getSessionModels,
|
|
715
|
+
setSessionModels,
|
|
716
|
+
clearSessionModels,
|
|
717
|
+
hasSessionModels,
|
|
718
|
+
|
|
641
719
|
// Migration
|
|
642
720
|
migrateOldConfig,
|
|
643
721
|
|
|
@@ -50,6 +50,14 @@ try {
|
|
|
50
50
|
// Session learning module not available
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
// v2.6.0 model selection persistence
|
|
54
|
+
let modelConfig = null;
|
|
55
|
+
try {
|
|
56
|
+
modelConfig = require('./flow-model-config');
|
|
57
|
+
} catch (err) {
|
|
58
|
+
// Model config module not available
|
|
59
|
+
}
|
|
60
|
+
|
|
53
61
|
/**
|
|
54
62
|
* Prompt user for input
|
|
55
63
|
*/
|
|
@@ -262,6 +270,25 @@ function saveSessionSummaryToState() {
|
|
|
262
270
|
}
|
|
263
271
|
}
|
|
264
272
|
|
|
273
|
+
/**
|
|
274
|
+
* v2.6.0: Clear session model selections
|
|
275
|
+
* Resets peer review and hybrid model choices for next session
|
|
276
|
+
*/
|
|
277
|
+
function clearSessionModelSelections() {
|
|
278
|
+
if (!modelConfig) return;
|
|
279
|
+
|
|
280
|
+
try {
|
|
281
|
+
if (modelConfig.hasSessionModels('peerReview') || modelConfig.hasSessionModels('hybrid')) {
|
|
282
|
+
modelConfig.clearSessionModels();
|
|
283
|
+
if (process.env.DEBUG) {
|
|
284
|
+
console.log(color('dim', ' Cleared session model selections'));
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
} catch (err) {
|
|
288
|
+
if (process.env.DEBUG) console.error(`[DEBUG] Clear models: ${err.message}`);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
265
292
|
/**
|
|
266
293
|
* v1.7.0: Archive request log if threshold exceeded
|
|
267
294
|
*/
|
|
@@ -750,6 +777,9 @@ async function main() {
|
|
|
750
777
|
// v1.7.0: Save session summary
|
|
751
778
|
saveSessionSummaryToState();
|
|
752
779
|
|
|
780
|
+
// v2.6.0: Clear session model selections
|
|
781
|
+
clearSessionModelSelections();
|
|
782
|
+
|
|
753
783
|
// v1.7.0: Auto-archive request log
|
|
754
784
|
archiveRequestLogIfNeeded();
|
|
755
785
|
|