Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions OrchestratorIDE.Avalonia/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,11 @@ public MainWindow()
WorkspaceRoot = _session.WorkspaceRoot,
};

_pitPanel = new TrainingPitPanel { WorkspaceRoot = _session.WorkspaceRoot };
_pitPanel = new TrainingPitPanel
{
WorkspaceRoot = _session.WorkspaceRoot,
ModelDepotRoot = _settings.ResolvedModelStoragePath,
};
_pitPanel.StatusChanged += msg => Dispatcher.UIThread.InvokeAsync(() => SetStatus(msg));
_pitPanel.OnActivity += msg => Dispatcher.UIThread.InvokeAsync(() =>
AddActivity(new ActivityEvent(ActivityKind.Info, "Training Pit", msg, DateTime.Now)));
Expand All @@ -291,7 +295,9 @@ public MainWindow()
PitLiveDot.IsVisible = active;
PitQueueBadge.Text = waiting > 0 ? waiting.ToString() : "";
});
_pitPanel.PitBossRequested += () => Dispatcher.UIThread.InvokeAsync(ShowPitBoss);
_pitPanel.PitBossRequested += () => Dispatcher.UIThread.InvokeAsync(ShowPitBoss);
_pitPanel.ActivateAdapterRequested += (baseGguf, loraGguf) =>
Dispatcher.UIThread.InvokeAsync(() => ApplyFoundryAdapter(baseGguf, loraGguf));

// Default layout: explorer in sidebar, agent in main
SidebarContent.Content = _explorerPanel;
Expand Down Expand Up @@ -2053,6 +2059,7 @@ private void OnSettingsSaved(AppSettings newSettings)
GpuLayers = s.LlamaCppGpuLayers,
ContextSize = s.LlamaCppContextSize,
Threads = s.LlamaCppThreads,
LoraPath = s.LlamaCppLoraPath,
};
mgr.OnLog += msg =>
AddActivity(new ActivityEvent(ActivityKind.Info, "llama.cpp", msg, DateTime.Now));
Expand All @@ -2067,6 +2074,29 @@ private IModelRuntime BuildModelRuntime() =>
? new LlamaCppServerRuntime(_llamaServer)
: new OllamaRuntime(_ollama);

/// <summary>
/// Called by the Training Pit "Load adapter into Native Runtime" button.
/// Updates the llama.cpp model + LoRA paths in settings and restarts the server.
/// </summary>
private void ApplyFoundryAdapter(string baseGguf, string loraGguf)
{
_settings.LlamaCppModelPath = baseGguf;
_settings.LlamaCppLoraPath = loraGguf;
_settings.Save();

AddActivity(new ActivityEvent(ActivityKind.Info, "Foundry",
$"Native runtime → {Path.GetFileName(baseGguf)} + {Path.GetFileName(loraGguf)}", DateTime.Now));

// Restart llama.cpp server if it's the active backend and currently running.
if (_settings.Backend == InferenceBackend.LlamaCpp && _llamaServer?.IsRunning == true)
{
_llamaServer.Stop();
_llamaServer = BuildServerManager(_settings);
if (_llamaServer is not null)
_ = _llamaServer.StartAsync();
}
}

private IRoleRuntime? BuildExperimentalNativeHiveWorkerRuntime() =>
BuildExperimentalNativeRoleRuntime("native HIVE worker", _settings.ExperimentalNativeHiveWorkerEnabled);

Expand Down
135 changes: 128 additions & 7 deletions OrchestratorIDE.Avalonia/UI/Panels/TrainingPitPanel.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,58 @@
<TextBlock Text="🧪" FontSize="14" VerticalAlignment="Center"/>
<TextBlock Text="GENERATE DATASET" FontSize="12" FontWeight="Bold"
Foreground="#80C0E0" Margin="8,0,0,0" VerticalAlignment="Center"/>
<Border Background="#0A1A10" BorderBrush="#2A5A38" BorderThickness="1"
CornerRadius="3" Padding="5,1" Margin="8,0,0,0" VerticalAlignment="Center">
<TextBlock Text="→ Stage 2" FontSize="9" Foreground="#60A070"/>
</Border>
Comment on lines +407 to +410

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Static "→ Stage 2" badge doesn't reflect the new target picker.

This badge has no x:Name, so it can never be updated when CbGenTarget_SelectionChanged fires. Once the user selects "Toolcaller Examples → THE FOUNDRY", the output actually feeds Stage 3, but this badge still reads "→ Stage 2" — directly contradicting the PR's own goal of "route labels ... to distinguish the two data paths." The TbGenTargetNote text below is correctly updated, but this badge sits right in the header and will visibly conflict with it.

🏷️ Proposed fix
-                        <Border Background="`#0A1A10`" BorderBrush="`#2A5A38`" BorderThickness="1"
+                        <Border x:Name="GenRouteBadge" Background="`#0A1A10`" BorderBrush="`#2A5A38`" BorderThickness="1"
                                 CornerRadius="3" Padding="5,1" Margin="8,0,0,0" VerticalAlignment="Center">
-                            <TextBlock Text="→ Stage 2" FontSize="9" Foreground="`#60A070`"/>
+                            <TextBlock x:Name="GenRouteBadgeText" Text="→ Stage 2" FontSize="9" Foreground="`#60A070`"/>
                        </Border>

Then update GenRouteBadgeText.Text alongside TbGenTargetNote.Text inside CbGenTarget_SelectionChanged.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Border Background="#0A1A10" BorderBrush="#2A5A38" BorderThickness="1"
CornerRadius="3" Padding="5,1" Margin="8,0,0,0" VerticalAlignment="Center">
<TextBlock Text="→ Stage 2" FontSize="9" Foreground="#60A070"/>
</Border>
<Border x:Name="GenRouteBadge" Background="`#0A1A10`" BorderBrush="`#2A5A38`" BorderThickness="1"
CornerRadius="3" Padding="5,1" Margin="8,0,0,0" VerticalAlignment="Center">
<TextBlock x:Name="GenRouteBadgeText" Text="→ Stage 2" FontSize="9" Foreground="`#60A070`"/>
</Border>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@OrchestratorIDE.Avalonia/UI/Panels/TrainingPitPanel.axaml` around lines 407 -
410, The “→ Stage 2” badge is hardcoded and cannot be updated when the target
selection changes, so it stays inconsistent with the selected route. Add an
x:Name to the TextBlock in TrainingPitPanel.axaml and update its Text in
CbGenTarget_SelectionChanged alongside TbGenTargetNote.Text, using the same
selection logic that distinguishes the Stage 2 vs Stage 3 path.

</DockPanel>
<TextBlock Text="Build synthetic boss plans with a local model"
<TextBlock Text="Build synthetic Warchief boss plans — trains the orchestration adapter in ORC ACADEMY (Stage 2)"
FontSize="11" Foreground="#999999" TextWrapping="Wrap" Margin="0,0,0,4"/>
<TextBlock x:Name="GenBadge" Text="" FontSize="11" FontWeight="SemiBold"
Foreground="#76B900" Margin="0,0,0,10"/>
Foreground="#76B900" Margin="0,0,0,8"/>

<!-- Generation target picker -->
<Border Background="#0C0C0C" BorderBrush="#2A2A2A" BorderThickness="1"
CornerRadius="4" Padding="10,8" Margin="0,0,0,10">
<StackPanel>
<TextBlock Text="GENERATE TARGET" FontSize="9" FontWeight="Bold"
Foreground="#555555" LetterSpacing="0.5" Margin="0,0,0,6"/>
<ComboBox x:Name="CbGenTarget" FontSize="11" HorizontalAlignment="Stretch"
SelectionChanged="CbGenTarget_SelectionChanged">
<ComboBoxItem x:Name="GenTargetBoss"
Content="🏛 Boss Plans → ORC ACADEMY (Stage 2)"
IsSelected="True"/>
<ComboBoxItem x:Name="GenTargetToolcaller"
Content="⚒ Toolcaller Examples → THE FOUNDRY (Stage 3)"/>
</ComboBox>
<TextBlock x:Name="TbGenTargetNote"
Text="Synthetic Warchief boss plans for the orchestration role. Output feeds ORC ACADEMY."
FontSize="10" Foreground="#666666" TextWrapping="Wrap" Margin="0,6,0,0"/>
</StackPanel>
</Border>

<!-- Generation Backend (visible only in toolcaller mode) -->
<Border x:Name="BorderGenBackend" IsVisible="False"
Background="#0A1018" BorderBrush="#1A2A38" BorderThickness="1"
CornerRadius="4" Padding="10,8" Margin="0,0,0,8">
<StackPanel>
<TextBlock Text="GENERATION BACKEND" FontSize="9" FontWeight="Bold"
Foreground="#555555" LetterSpacing="0.5" Margin="0,0,0,6"/>
<ComboBox x:Name="CbGenBackend" FontSize="11" HorizontalAlignment="Stretch"
SelectionChanged="CbGenBackend_SelectionChanged">
<ComboBoxItem x:Name="GenBackendNative"
Content="⚡ Native Runtime (llama.cpp · port 8080)"
IsSelected="True"/>
<ComboBoxItem x:Name="GenBackendClaude"
Content="☁ Claude API (ANTHROPIC_API_KEY)"/>
<ComboBoxItem x:Name="GenBackendOllama"
Content="⚙ Ollama (local)"/>
</ComboBox>
<TextBlock x:Name="TbGenBackendNote"
Text="Fully local — uses whatever model is loaded in the native runtime (port 8080). Requires a ≥3B model."
FontSize="10" Foreground="#666666" TextWrapping="Wrap" Margin="0,6,0,0"/>
</StackPanel>
</Border>

<!-- Model / key / count -->
<TextBlock Text="Model" FontSize="10" Foreground="#999999" Margin="0,0,0,2"
Expand Down Expand Up @@ -443,7 +490,7 @@
</StackPanel>
</Grid>

<TextBlock FontSize="10" Foreground="#666666" FontStyle="Italic"
<TextBlock x:Name="TbGenFieldHint" FontSize="10" Foreground="#666666" FontStyle="Italic"
TextWrapping="Wrap" Margin="0,0,0,8"
Text="Every CODER/UIDEVELOPER task must name its output file(s) in the title — plans that omit filenames are rejected automatically."/>

Expand Down Expand Up @@ -474,6 +521,26 @@
BorderThickness="0" Background="#111111" Foreground="#40A070"
Maximum="100" Value="0"/>

<!-- Post-generation action buttons (shown only after a successful run) -->
<Button x:Name="BtnGenLoadAcademy"
Content="→ Use this dataset in ORC ACADEMY (Stage 2)"
Click="BtnGenLoadAcademy_Click"
IsVisible="False"
Padding="10,4" Margin="0,0,0,4"
Background="#3D2A00" BorderBrush="#E8A030" Foreground="#E8C080"
BorderThickness="1" FontSize="11" HorizontalAlignment="Stretch"
HorizontalContentAlignment="Center"
ToolTip.Tip="Selects this dataset in Stage 2 (ORC ACADEMY) so you can start training immediately"/>
<Button x:Name="BtnGenLoadFoundry"
Content="→ Captures ready — validate in THE FOUNDRY (Stage 3)"
Click="BtnGenLoadFoundry_Click"
IsVisible="False"
Padding="10,4" Margin="0,0,0,8"
Background="#2A1408" BorderBrush="#E06040" Foreground="#E0A080"
BorderThickness="1" FontSize="11" HorizontalAlignment="Stretch"
HorizontalContentAlignment="Center"
ToolTip.Tip="Refreshes THE FOUNDRY gate card — click Validate captures there to proceed"/>

<!-- Notes editor + open shortcuts -->
<TextBox x:Name="TbGenNotes" Margin="0,10,0,8"
PlaceholderText="Dataset description / notes (saved to .meta.json)…"
Expand Down Expand Up @@ -630,8 +697,12 @@
<TextBlock Text="⚒" FontSize="14" VerticalAlignment="Center"/>
<TextBlock Text="THE FOUNDRY" FontSize="12" FontWeight="Bold"
Foreground="#E06040" Margin="8,0,0,0" VerticalAlignment="Center"/>
<Border Background="#1A0A06" BorderBrush="#5A2818" BorderThickness="1"
CornerRadius="3" Padding="5,1" Margin="8,0,0,0" VerticalAlignment="Center">
<TextBlock Text="swarm captures" FontSize="9" Foreground="#C06040"/>
</Border>
</DockPanel>
<TextBlock Text="Train TheOrc's own specialist models — smallest safe model wins"
<TextBlock Text="Train specialist models from organic swarm captures — smallest safe model that passes the gate"
FontSize="11" Foreground="#999999" TextWrapping="Wrap" Margin="0,0,0,4"/>
<TextBlock x:Name="FoundryBadge" Text="" FontSize="11" FontWeight="SemiBold"
Foreground="#76B900" Margin="0,0,0,10"/>
Expand Down Expand Up @@ -666,9 +737,42 @@
</ItemsControl.ItemTemplate>
</ItemsControl>

<!-- Toolcaller pipeline: captures → validate → export → train -->
<TextBlock x:Name="FoundryCounts" Text="toolcaller: counting captures…"
FontSize="11" Foreground="#999999" TextWrapping="Wrap" Margin="0,0,0,6"/>
<!-- Toolcaller pipeline: swarm captures → validate → export → train -->
<Border Background="#0A1018" BorderBrush="#1A2A38" BorderThickness="1"
CornerRadius="4" Padding="10,8" Margin="0,0,0,8">
<StackPanel Spacing="3">
<TextBlock Text="TRAINING GATES" FontSize="9" FontWeight="Bold"
Foreground="#4A6A88" LetterSpacing="0.5" Margin="0,0,0,4"/>
<DockPanel>
<TextBlock x:Name="GateStagedIcon" Text="●" FontSize="10" Width="14"
Foreground="#E06040" VerticalAlignment="Center"/>
<TextBlock x:Name="GateStagedLabel" Text="0 staged captures"
FontSize="11" Foreground="#999999" VerticalAlignment="Center"/>
<TextBlock Text="gate: 150" FontSize="10" Foreground="#555555"
FontFamily="Consolas" HorizontalAlignment="Right"
DockPanel.Dock="Right" VerticalAlignment="Center"/>
</DockPanel>
<ProgressBar x:Name="GateStagedBar" Height="3" Maximum="150" Value="0"
Background="#111111" Foreground="#E06040" Margin="14,0,0,2"/>
<DockPanel>
<TextBlock x:Name="GateAcceptedIcon" Text="●" FontSize="10" Width="14"
Foreground="#E06040" VerticalAlignment="Center"/>
<TextBlock x:Name="GateAcceptedLabel" Text="0 accepted captures"
FontSize="11" Foreground="#999999" VerticalAlignment="Center"/>
<TextBlock Text="gate: 30 eval" FontSize="10" Foreground="#555555"
FontFamily="Consolas" HorizontalAlignment="Right"
DockPanel.Dock="Right" VerticalAlignment="Center"/>
</DockPanel>
<DockPanel Margin="0,2,0,0">
<TextBlock x:Name="GateExportIcon" Text="●" FontSize="10" Width="14"
Foreground="#E06040" VerticalAlignment="Center"/>
<TextBlock x:Name="GateExportLabel" Text="Dataset not exported yet"
FontSize="11" Foreground="#999999" VerticalAlignment="Center"/>
</DockPanel>
<TextBlock x:Name="GateTrainEta" Text="" FontSize="10"
Foreground="#80A0C0" FontFamily="Consolas" Margin="14,4,0,0"/>
</StackPanel>
</Border>
<CheckBox x:Name="ChkFoundryDryRun" Content="Dry run" IsChecked="True" Margin="0,0,0,8"
FontSize="11" Foreground="#999999"
ToolTip.Tip="Validate gates + model/data load without a real training run. A real run is the explicit approval for ONE training experiment."/>
Expand Down Expand Up @@ -717,6 +821,23 @@
<ProgressBar x:Name="FoundryBar" Height="8" Margin="0,6,0,0"
BorderThickness="0" Background="#111111" Foreground="#E06040"
Maximum="100"/>

<!-- Load adapter to native runtime -->
<Border x:Name="BorderFoundryActivate" IsVisible="False"
Background="#0A1A0A" BorderBrush="#3A5A3A" BorderThickness="1"
CornerRadius="4" Padding="10,8" Margin="0,10,0,0">
<StackPanel Spacing="6">
<TextBlock x:Name="TbFoundryActivateInfo" Text=""
FontSize="11" Foreground="#90D090" TextWrapping="Wrap"/>
<Button x:Name="BtnFoundryActivate"
Content="⚡ Load adapter into Native Runtime"
Click="BtnFoundryActivate_Click"
Padding="10,5" HorizontalAlignment="Left"
Background="#1A3A1A" BorderBrush="#4A8A4A" Foreground="#90D090"
BorderThickness="1" FontSize="11"
ToolTip.Tip="Sets the native runtime base model to Qwen2.5-1.5B-Instruct and loads this LoRA adapter. Requires llama.cpp backend."/>
</StackPanel>
</Border>
</StackPanel>
</Border>
</Grid>
Expand Down
Loading
Loading