orquesta-cli 0.2.30 → 0.2.32
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/orquesta/config-sync.js +23 -3
- package/package.json +1 -1
|
@@ -1,17 +1,34 @@
|
|
|
1
1
|
import { configManager } from '../core/config/config-manager.js';
|
|
2
2
|
import { logger } from '../utils/logger.js';
|
|
3
|
+
import { readHookConfig } from './hook-init.js';
|
|
3
4
|
const ORQUESTA_API = process.env['ORQUESTA_API_URL'] || 'https://getorquesta.com';
|
|
4
5
|
export async function fetchOrquestaProjects(token) {
|
|
6
|
+
let response;
|
|
5
7
|
try {
|
|
6
|
-
|
|
8
|
+
response = await fetch(`${ORQUESTA_API}/api/orquesta-cli/projects`, {
|
|
7
9
|
headers: {
|
|
8
10
|
Authorization: `Bearer ${token}`,
|
|
9
11
|
'Content-Type': 'application/json',
|
|
10
12
|
},
|
|
11
13
|
});
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
if (response.status === 401) {
|
|
19
|
+
let detail = 'token has been revoked';
|
|
20
|
+
try {
|
|
21
|
+
const body = (await response.json());
|
|
22
|
+
if (body?.error)
|
|
23
|
+
detail = body.error.toLowerCase();
|
|
14
24
|
}
|
|
25
|
+
catch { }
|
|
26
|
+
throw new Error(`Your Orquesta session has expired (${detail}). Run \`orquesta --login\` (or /login) to sign in again.`);
|
|
27
|
+
}
|
|
28
|
+
if (!response.ok) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
15
32
|
return (await response.json());
|
|
16
33
|
}
|
|
17
34
|
catch {
|
|
@@ -194,6 +211,8 @@ export async function submitPromptToOrquesta(prompt) {
|
|
|
194
211
|
if (!orquestaConfig?.token) {
|
|
195
212
|
return { success: false, error: 'Not connected to Orquesta' };
|
|
196
213
|
}
|
|
214
|
+
const cwd = prompt.context?.['cwd'] || process.cwd();
|
|
215
|
+
const effectiveProjectId = readHookConfig(cwd)?.projectId || orquestaConfig.projectId;
|
|
197
216
|
try {
|
|
198
217
|
const response = await fetch(`${ORQUESTA_API}/api/orquesta-cli/prompts`, {
|
|
199
218
|
method: 'POST',
|
|
@@ -206,6 +225,7 @@ export async function submitPromptToOrquesta(prompt) {
|
|
|
206
225
|
context: prompt.context,
|
|
207
226
|
cliType: 'orquesta-cli',
|
|
208
227
|
llmConfig: prompt.llmConfig,
|
|
228
|
+
projectId: effectiveProjectId,
|
|
209
229
|
}),
|
|
210
230
|
});
|
|
211
231
|
if (!response.ok) {
|