shortcutxl 0.2.9 → 0.2.12
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/custom/constants.js +1 -1
- package/dist/custom/preflight.js +40 -21
- package/dist/main.js +2 -1
- package/package.json +1 -1
package/dist/custom/constants.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Toggle ACTIVE_ENV between 'prod' and 'staging' to switch environments.
|
|
5
5
|
* Every env var can still be overridden via process.env.
|
|
6
6
|
*/
|
|
7
|
-
const ACTIVE_ENV = '
|
|
7
|
+
const ACTIVE_ENV = 'prod';
|
|
8
8
|
const ENV = {
|
|
9
9
|
prod: {
|
|
10
10
|
llmProxyUrl: 'https://agent.shortcut.ai',
|
package/dist/custom/preflight.js
CHANGED
|
@@ -410,31 +410,50 @@ async function verifyXllConfig() {
|
|
|
410
410
|
async function smokeTest() {
|
|
411
411
|
header('Connection Test');
|
|
412
412
|
log('Verifying Excel connection...');
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
413
|
+
// Retry a few times — Excel's COM subsystem (HWND hierarchy + ROT entry)
|
|
414
|
+
// can take a moment to become available after the XLL HTTP server is up.
|
|
415
|
+
const MAX_ATTEMPTS = 3;
|
|
416
|
+
for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
|
|
417
|
+
try {
|
|
418
|
+
const res = await fetch(`${EXCEL_HTTP_URL}/exec`, {
|
|
419
|
+
method: 'POST',
|
|
420
|
+
headers: { 'Content-Type': 'application/json' },
|
|
421
|
+
body: JSON.stringify({
|
|
422
|
+
code: 'from shortcut_xl import xl_app\nprint(f"Excel {xl_app().Version}")'
|
|
423
|
+
}),
|
|
424
|
+
signal: AbortSignal.timeout(10_000)
|
|
425
|
+
});
|
|
426
|
+
if (!res.ok) {
|
|
427
|
+
if (attempt < MAX_ATTEMPTS) {
|
|
428
|
+
await new Promise((r) => setTimeout(r, 2000));
|
|
429
|
+
continue;
|
|
430
|
+
}
|
|
431
|
+
warn(`Connection error (${res.status}).`);
|
|
432
|
+
return false;
|
|
433
|
+
}
|
|
434
|
+
const data = (await res.json());
|
|
435
|
+
if (data.error) {
|
|
436
|
+
if (attempt < MAX_ATTEMPTS) {
|
|
437
|
+
log(`Waiting for Excel COM... (attempt ${attempt}/${MAX_ATTEMPTS})`);
|
|
438
|
+
await new Promise((r) => setTimeout(r, 2000));
|
|
439
|
+
continue;
|
|
440
|
+
}
|
|
441
|
+
warn(`Connection failed: ${data.error}`);
|
|
442
|
+
return false;
|
|
443
|
+
}
|
|
444
|
+
ok(data.output?.trim() ?? 'Connected');
|
|
445
|
+
return true;
|
|
425
446
|
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
447
|
+
catch (e) {
|
|
448
|
+
if (attempt < MAX_ATTEMPTS) {
|
|
449
|
+
await new Promise((r) => setTimeout(r, 2000));
|
|
450
|
+
continue;
|
|
451
|
+
}
|
|
452
|
+
warn(`Connection failed: ${e instanceof Error ? e.message : e}`);
|
|
429
453
|
return false;
|
|
430
454
|
}
|
|
431
|
-
ok(data.output?.trim() ?? 'Connected');
|
|
432
|
-
return true;
|
|
433
|
-
}
|
|
434
|
-
catch (e) {
|
|
435
|
-
warn(`Connection failed: ${e instanceof Error ? e.message : e}`);
|
|
436
|
-
return false;
|
|
437
455
|
}
|
|
456
|
+
return false;
|
|
438
457
|
}
|
|
439
458
|
/**
|
|
440
459
|
* Run deterministic pre-flight checks and auto-install prerequisites.
|
package/dist/main.js
CHANGED