@jiggai/recipes 0.2.13 → 0.2.15
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/index.ts +8 -1
- package/package.json +1 -1
- package/src/toolsInvoke.ts +6 -1
package/index.ts
CHANGED
|
@@ -371,7 +371,14 @@ async function reconcileRecipeCronJobs(opts: {
|
|
|
371
371
|
if (mode === "prompt") {
|
|
372
372
|
const header = `Recipe ${opts.scope.recipeId} defines ${desired.length} cron job(s).\nThese run automatically on a schedule. Install them?`;
|
|
373
373
|
userOptIn = await promptYesNo(header);
|
|
374
|
-
|
|
374
|
+
|
|
375
|
+
// If the user declines, skip all cron reconciliation entirely. This avoids a
|
|
376
|
+
// potentially slow gateway cron.list call and matches user intent.
|
|
377
|
+
if (!userOptIn) {
|
|
378
|
+
return { ok: true, changed: false, note: "cron-installation-declined" as const, desiredCount: desired.length };
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
if (!process.stdin.isTTY) {
|
|
375
382
|
console.error("Non-interactive mode: defaulting cron install to disabled.");
|
|
376
383
|
}
|
|
377
384
|
}
|
package/package.json
CHANGED
package/src/toolsInvoke.ts
CHANGED
|
@@ -31,14 +31,19 @@ export async function toolsInvoke<T = unknown>(api: any, req: ToolsInvokeRequest
|
|
|
31
31
|
let lastErr: unknown = null;
|
|
32
32
|
for (let attempt = 1; attempt <= 3; attempt++) {
|
|
33
33
|
try {
|
|
34
|
+
const ac = new AbortController();
|
|
35
|
+
const timeoutMs = 30_000;
|
|
36
|
+
const t = setTimeout(() => ac.abort(), timeoutMs);
|
|
37
|
+
|
|
34
38
|
const res = await fetch(url, {
|
|
35
39
|
method: "POST",
|
|
40
|
+
signal: ac.signal,
|
|
36
41
|
headers: {
|
|
37
42
|
"content-type": "application/json",
|
|
38
43
|
authorization: `Bearer ${token}`,
|
|
39
44
|
},
|
|
40
45
|
body: JSON.stringify(req),
|
|
41
|
-
});
|
|
46
|
+
}).finally(() => clearTimeout(t));
|
|
42
47
|
|
|
43
48
|
const json = (await res.json()) as ToolsInvokeResponse;
|
|
44
49
|
if (!res.ok || !json.ok) {
|