@proagentstore/cli 0.4.107 → 0.4.108
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/index.js +12 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1725,6 +1725,13 @@ function policyScheduleAction(previous, next, wasAuthoritative) {
|
|
|
1725
1725
|
if (!wasAuthoritative || !previous.autoUpdate) return "start";
|
|
1726
1726
|
return "keep";
|
|
1727
1727
|
}
|
|
1728
|
+
function acceptPolicyResponse(local, wasAuthoritative, response) {
|
|
1729
|
+
const remote = policyFromResponse(response);
|
|
1730
|
+
if (!remote) return null;
|
|
1731
|
+
const action = policyScheduleAction(local, remote, wasAuthoritative);
|
|
1732
|
+
const ownerTransition = action === "cancel" || !local.autoUpdate;
|
|
1733
|
+
return { policy: ownerTransition ? { ...local, ...remote } : { ...local, autoUpdate: remote.autoUpdate }, action };
|
|
1734
|
+
}
|
|
1728
1735
|
function mayAutomaticallyRestart(input) {
|
|
1729
1736
|
return input.authoritative && input.enabled && input.workObserved && input.busy.length === 0;
|
|
1730
1737
|
}
|
|
@@ -1980,18 +1987,17 @@ async function connectViaRelay(instanceIds, localUrl, runnerToken, opts, force =
|
|
|
1980
1987
|
};
|
|
1981
1988
|
const acceptAutoUpdatePolicy = (response) => {
|
|
1982
1989
|
if (!autoUpdateKey) return;
|
|
1983
|
-
const
|
|
1984
|
-
if (!
|
|
1985
|
-
|
|
1986
|
-
autoUpdatePolicy = { ...autoUpdatePolicy, ...policy };
|
|
1990
|
+
const accepted = acceptPolicyResponse(autoUpdatePolicy, autoUpdatePolicyAuthoritative, response);
|
|
1991
|
+
if (!accepted) return;
|
|
1992
|
+
autoUpdatePolicy = accepted.policy;
|
|
1987
1993
|
autoUpdatePolicyAuthoritative = true;
|
|
1988
1994
|
if (autoUpdateKey) saveAutoUpdatePolicy(autoUpdateKey, autoUpdatePolicy);
|
|
1989
|
-
if (action === "cancel") {
|
|
1995
|
+
if (accepted.action === "cancel") {
|
|
1990
1996
|
scheduleAutomaticUpdate(false, true);
|
|
1991
1997
|
return;
|
|
1992
1998
|
}
|
|
1993
1999
|
if (refreshingAutomaticPolicy) return;
|
|
1994
|
-
if (action === "start") {
|
|
2000
|
+
if (accepted.action === "start") {
|
|
1995
2001
|
scheduleAutomaticUpdate(true);
|
|
1996
2002
|
}
|
|
1997
2003
|
};
|