opencode-immune 1.0.64 → 1.0.65
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/plugin/server.js +34 -1
- package/package.json +1 -1
package/dist/plugin/server.js
CHANGED
|
@@ -3777,7 +3777,7 @@ import { fileURLToPath } from "url";
|
|
|
3777
3777
|
import { createHash } from "crypto";
|
|
3778
3778
|
import { tmpdir } from "os";
|
|
3779
3779
|
import { execFile } from "child_process";
|
|
3780
|
-
var PLUGIN_VERSION = "1.0.
|
|
3780
|
+
var PLUGIN_VERSION = "1.0.65";
|
|
3781
3781
|
var PLUGIN_PACKAGE_NAME = "opencode-immune";
|
|
3782
3782
|
var PLUGIN_DIRNAME = dirname(fileURLToPath(import.meta.url));
|
|
3783
3783
|
function getServerAuthHeaders() {
|
|
@@ -4826,6 +4826,24 @@ async function readLocalHarnessVersion(directory) {
|
|
|
4826
4826
|
return null;
|
|
4827
4827
|
}
|
|
4828
4828
|
}
|
|
4829
|
+
function parseHarnessVersion(tag) {
|
|
4830
|
+
const match = tag.match(/^v(\d{4}\.\d{2}\.\d{2})(?:-(.+))?$/);
|
|
4831
|
+
if (!match?.[1]) return null;
|
|
4832
|
+
return {
|
|
4833
|
+
dateKey: match[1],
|
|
4834
|
+
suffix: match[2] ?? ""
|
|
4835
|
+
};
|
|
4836
|
+
}
|
|
4837
|
+
function compareHarnessVersions(localVersion, releaseVersion) {
|
|
4838
|
+
if (localVersion === releaseVersion) return 0;
|
|
4839
|
+
const local = parseHarnessVersion(localVersion);
|
|
4840
|
+
const release = parseHarnessVersion(releaseVersion);
|
|
4841
|
+
if (!local || !release) return null;
|
|
4842
|
+
if (local.dateKey < release.dateKey) return -1;
|
|
4843
|
+
if (local.dateKey > release.dateKey) return 1;
|
|
4844
|
+
if (local.suffix !== release.suffix) return null;
|
|
4845
|
+
return 0;
|
|
4846
|
+
}
|
|
4829
4847
|
async function downloadHarnessAsset(assetUrl, token) {
|
|
4830
4848
|
const resp = await fetch(assetUrl, {
|
|
4831
4849
|
headers: {
|
|
@@ -4894,6 +4912,21 @@ async function syncHarness(state) {
|
|
|
4894
4912
|
);
|
|
4895
4913
|
return;
|
|
4896
4914
|
}
|
|
4915
|
+
if (localVersion) {
|
|
4916
|
+
const versionOrder = compareHarnessVersions(localVersion, release.tagName);
|
|
4917
|
+
if (versionOrder === null) {
|
|
4918
|
+
pluginLog.warn(
|
|
4919
|
+
`[opencode-immune] Harness sync: local ${localVersion} and release ${release.tagName} have ambiguous ordering. Skipping sync to avoid overwriting project harness.`
|
|
4920
|
+
);
|
|
4921
|
+
return;
|
|
4922
|
+
}
|
|
4923
|
+
if (versionOrder > 0) {
|
|
4924
|
+
pluginLog.info(
|
|
4925
|
+
`[opencode-immune] Harness sync: local ${localVersion} is newer than release ${release.tagName}. Skipping sync.`
|
|
4926
|
+
);
|
|
4927
|
+
return;
|
|
4928
|
+
}
|
|
4929
|
+
}
|
|
4897
4930
|
pluginLog.info(
|
|
4898
4931
|
`[opencode-immune] Harness sync: updating ${localVersion ?? "(none)"} \u2192 ${release.tagName}`
|
|
4899
4932
|
);
|