swarmlancer-cli 0.7.0 → 0.7.2
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/dist/app.js +11 -18
- package/dist/config.js +2 -0
- package/package.json +1 -1
package/dist/app.js
CHANGED
|
@@ -2,8 +2,8 @@ import { ProcessTerminal, TUI } from "@mariozechner/pi-tui";
|
|
|
2
2
|
import { getConfig, getAgents, getAgent, saveAgent, deleteAgent, createAgent, migrateLegacyAgent, } from "./config.js";
|
|
3
3
|
import { login } from "./login.js";
|
|
4
4
|
import { setActiveModel, setAgentInstructions } from "./inference.js";
|
|
5
|
-
import { resolveModel, getAvailableModels,
|
|
6
|
-
import { LoginDialogComponent } from "@mariozechner/pi-coding-agent";
|
|
5
|
+
import { resolveModel, getAvailableModels, getAuthStorage, } from "./providers.js";
|
|
6
|
+
import { LoginDialogComponent, OAuthSelectorComponent, initTheme } from "@mariozechner/pi-coding-agent";
|
|
7
7
|
import { startAgent, stopAgent, sendToServer } from "./agent.js";
|
|
8
8
|
import { colors } from "./theme.js";
|
|
9
9
|
import { DashboardScreen } from "./screens/dashboard.js";
|
|
@@ -49,6 +49,8 @@ function confirm(question) {
|
|
|
49
49
|
// ── Silent setup ──────────────────────────────────────────
|
|
50
50
|
async function silentSetup() {
|
|
51
51
|
migrateLegacyAgent();
|
|
52
|
+
// Initialize pi's theme system (required by OAuthSelectorComponent / LoginDialogComponent)
|
|
53
|
+
initTheme();
|
|
52
54
|
const config = getConfig();
|
|
53
55
|
if (!config.token) {
|
|
54
56
|
try {
|
|
@@ -207,26 +209,17 @@ async function runSwarm() {
|
|
|
207
209
|
}
|
|
208
210
|
// ── Manage → Providers ────────────────────────────────────
|
|
209
211
|
async function runProviders() {
|
|
210
|
-
let idx = 0;
|
|
211
212
|
while (true) {
|
|
212
|
-
|
|
213
|
-
const
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
return { value: p.id, label: `${prefix}${p.label}${suffix}`, description: "" };
|
|
217
|
-
});
|
|
218
|
-
const result = await new Promise((resolve) => {
|
|
219
|
-
const screen = new MenuScreen(tui, "Providers", items, idx);
|
|
220
|
-
screen.onSelect = (v, i) => resolve({ value: v, index: i });
|
|
221
|
-
screen.onBack = () => resolve({ value: null, index: idx });
|
|
222
|
-
setScreen(screen);
|
|
213
|
+
// Use pi's OAuthSelectorComponent — exact same UI as pi's /login
|
|
214
|
+
const selectedProvider = await new Promise((resolve) => {
|
|
215
|
+
const selector = new OAuthSelectorComponent("login", getAuthStorage(), (providerId) => resolve(providerId), () => resolve(null));
|
|
216
|
+
setScreen(selector);
|
|
223
217
|
});
|
|
224
|
-
if (!
|
|
218
|
+
if (!selectedProvider)
|
|
225
219
|
return;
|
|
226
|
-
|
|
227
|
-
// Use pi's LoginDialogComponent for the OAuth/login flow
|
|
220
|
+
// Use pi's LoginDialogComponent for the actual login flow
|
|
228
221
|
await new Promise((resolve) => {
|
|
229
|
-
const dialog = new LoginDialogComponent(tui,
|
|
222
|
+
const dialog = new LoginDialogComponent(tui, selectedProvider, (_success, _message) => {
|
|
230
223
|
resolve();
|
|
231
224
|
});
|
|
232
225
|
setScreen(dialog);
|
package/dist/config.js
CHANGED
|
@@ -110,6 +110,7 @@ export function getAgents() {
|
|
|
110
110
|
discovery: { ...DEFAULT_DISCOVERY, ...raw.discovery },
|
|
111
111
|
limits: { ...DEFAULT_LIMITS, ...raw.limits },
|
|
112
112
|
modelPattern: raw.modelPattern,
|
|
113
|
+
active: raw.active ?? false,
|
|
113
114
|
});
|
|
114
115
|
}
|
|
115
116
|
catch { }
|
|
@@ -131,6 +132,7 @@ export function getAgent(id) {
|
|
|
131
132
|
discovery: { ...DEFAULT_DISCOVERY, ...raw.discovery },
|
|
132
133
|
limits: { ...DEFAULT_LIMITS, ...raw.limits },
|
|
133
134
|
modelPattern: raw.modelPattern,
|
|
135
|
+
active: raw.active ?? false,
|
|
134
136
|
};
|
|
135
137
|
}
|
|
136
138
|
catch {
|