opencode-immune 1.0.83 → 1.0.85
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 +35 -5
- package/package.json +2 -1
package/dist/plugin/server.js
CHANGED
|
@@ -4123,7 +4123,6 @@ import { fileURLToPath } from "url";
|
|
|
4123
4123
|
import { createHash } from "crypto";
|
|
4124
4124
|
import { tmpdir } from "os";
|
|
4125
4125
|
import { execFile } from "child_process";
|
|
4126
|
-
var PLUGIN_VERSION = "1.0.83";
|
|
4127
4126
|
var PLUGIN_PACKAGE_NAME = "opencode-immune";
|
|
4128
4127
|
var PLUGIN_DIRNAME = dirname(fileURLToPath(import.meta.url));
|
|
4129
4128
|
function getServerAuthHeaders() {
|
|
@@ -4150,7 +4149,7 @@ async function getPluginVersion() {
|
|
|
4150
4149
|
}
|
|
4151
4150
|
} catch {
|
|
4152
4151
|
}
|
|
4153
|
-
return
|
|
4152
|
+
return "0.0.0";
|
|
4154
4153
|
}
|
|
4155
4154
|
async function installLatestPluginUpdate(state, currentVersion, latestVersion) {
|
|
4156
4155
|
try {
|
|
@@ -5464,7 +5463,7 @@ function compareHarnessVersions(localVersion, releaseVersion) {
|
|
|
5464
5463
|
if (!local || !release) return null;
|
|
5465
5464
|
if (local.dateKey < release.dateKey) return -1;
|
|
5466
5465
|
if (local.dateKey > release.dateKey) return 1;
|
|
5467
|
-
if (local.suffix !== release.suffix) return
|
|
5466
|
+
if (local.suffix !== release.suffix) return -1;
|
|
5468
5467
|
return 0;
|
|
5469
5468
|
}
|
|
5470
5469
|
async function downloadHarnessAsset(assetUrl, token) {
|
|
@@ -5519,6 +5518,31 @@ async function fileHash(filePath) {
|
|
|
5519
5518
|
return "";
|
|
5520
5519
|
}
|
|
5521
5520
|
}
|
|
5521
|
+
async function fileExists(filePath) {
|
|
5522
|
+
try {
|
|
5523
|
+
await stat(filePath);
|
|
5524
|
+
return true;
|
|
5525
|
+
} catch {
|
|
5526
|
+
return false;
|
|
5527
|
+
}
|
|
5528
|
+
}
|
|
5529
|
+
async function getHarnessIntegrityIssue(directory) {
|
|
5530
|
+
try {
|
|
5531
|
+
const configPath = join(directory, "opencode.json");
|
|
5532
|
+
const raw = await readFile(configPath, "utf-8");
|
|
5533
|
+
const config = JSON.parse(raw);
|
|
5534
|
+
const plugins = Array.isArray(config.plugin) ? config.plugin : [];
|
|
5535
|
+
const usesLoader = plugins.includes(".opencode/plugin-loader.cjs") || plugins.includes(".opencode\\plugin-loader.cjs");
|
|
5536
|
+
if (!usesLoader) return null;
|
|
5537
|
+
const loaderPath = join(directory, ".opencode", "plugin-loader.cjs");
|
|
5538
|
+
if (!await fileExists(loaderPath)) {
|
|
5539
|
+
return "opencode.json references .opencode/plugin-loader.cjs but the file is missing";
|
|
5540
|
+
}
|
|
5541
|
+
} catch {
|
|
5542
|
+
return null;
|
|
5543
|
+
}
|
|
5544
|
+
return null;
|
|
5545
|
+
}
|
|
5522
5546
|
function parseImmunePluginSpec(value) {
|
|
5523
5547
|
const trimmed = value.trim();
|
|
5524
5548
|
const match = trimmed.match(/^opencode-immune(?:@(.+))?$/);
|
|
@@ -5627,13 +5651,19 @@ async function syncHarness(state) {
|
|
|
5627
5651
|
const release = await fetchLatestHarnessRelease(state.input.directory, repo, token);
|
|
5628
5652
|
if (!release) return;
|
|
5629
5653
|
const localVersion = await readLocalHarnessVersion(state.input.directory);
|
|
5630
|
-
|
|
5654
|
+
const integrityIssue = await getHarnessIntegrityIssue(state.input.directory);
|
|
5655
|
+
if (localVersion === release.tagName && !integrityIssue) {
|
|
5631
5656
|
pluginLog.info(
|
|
5632
5657
|
`[opencode-immune] Harness sync: already up to date (${release.tagName})`
|
|
5633
5658
|
);
|
|
5634
5659
|
return;
|
|
5635
5660
|
}
|
|
5636
|
-
if (localVersion) {
|
|
5661
|
+
if (localVersion === release.tagName && integrityIssue) {
|
|
5662
|
+
pluginLog.warn(
|
|
5663
|
+
`[opencode-immune] Harness sync: integrity issue detected for ${release.tagName}: ${integrityIssue}. Reinstalling harness files from release.`
|
|
5664
|
+
);
|
|
5665
|
+
}
|
|
5666
|
+
if (localVersion && localVersion !== release.tagName) {
|
|
5637
5667
|
const versionOrder = compareHarnessVersions(localVersion, release.tagName);
|
|
5638
5668
|
if (versionOrder === null) {
|
|
5639
5669
|
pluginLog.warn(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-immune",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.85",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenCode plugin: session recovery, auto-retry, multi-cycle automation, context monitoring",
|
|
6
6
|
"exports": {
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"scripts": {
|
|
15
15
|
"build": "esbuild plugin.ts --bundle --platform=node --format=esm --target=node22 --outfile=dist/plugin/server.js && esbuild plugin.ts --bundle --platform=node --format=esm --target=node22 --outfile=dist/plugin.js",
|
|
16
16
|
"dev": "node ./node_modules/typescript/bin/tsc --project tsconfig.json --watch",
|
|
17
|
+
"release": "cd .. && bash scripts/release-plugin.sh",
|
|
17
18
|
"prepublishOnly": "npm run build"
|
|
18
19
|
},
|
|
19
20
|
"dependencies": {
|