opencode-immune 1.0.27 → 1.0.28
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.js +13 -4
- package/package.json +1 -1
package/dist/plugin.js
CHANGED
|
@@ -41,9 +41,10 @@ async function getPluginVersion() {
|
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* Check npm registry for latest version. Warn if current is outdated.
|
|
44
|
+
* Stores update message in state for injection into system prompt.
|
|
44
45
|
* Non-blocking, fire-and-forget — never delays plugin startup.
|
|
45
46
|
*/
|
|
46
|
-
async function checkPluginUpdate() {
|
|
47
|
+
async function checkPluginUpdate(state) {
|
|
47
48
|
try {
|
|
48
49
|
const currentVersion = await getPluginVersion();
|
|
49
50
|
const controller = new AbortController();
|
|
@@ -55,8 +56,10 @@ async function checkPluginUpdate() {
|
|
|
55
56
|
const data = (await res.json());
|
|
56
57
|
const latest = data.version;
|
|
57
58
|
if (latest && latest !== currentVersion) {
|
|
58
|
-
|
|
59
|
-
`
|
|
59
|
+
state.pluginUpdateMessage =
|
|
60
|
+
`[PLUGIN UPDATE] opencode-immune ${currentVersion} → ${latest} is available. ` +
|
|
61
|
+
`Please inform the user: a plugin update is available. They should restart opencode to get the latest version.`;
|
|
62
|
+
console.warn(`[opencode-immune] Plugin update available: ${currentVersion} → ${latest}.`);
|
|
60
63
|
}
|
|
61
64
|
else if (latest) {
|
|
62
65
|
console.log(`[opencode-immune] Plugin version ${currentVersion} is up to date.`);
|
|
@@ -83,6 +86,7 @@ function createState(input) {
|
|
|
83
86
|
autoResumeAttempted: false,
|
|
84
87
|
cycleCount: 0,
|
|
85
88
|
commitPending: false,
|
|
89
|
+
pluginUpdateMessage: null,
|
|
86
90
|
};
|
|
87
91
|
}
|
|
88
92
|
const ULTRAWORK_AGENT = "0-ultrawork";
|
|
@@ -955,6 +959,11 @@ function createSystemTransform(state) {
|
|
|
955
959
|
// Clear after injection to avoid repeated hints
|
|
956
960
|
state.lastEditAttempt = null;
|
|
957
961
|
}
|
|
962
|
+
// Plugin update notification — inject once into first system prompt
|
|
963
|
+
if (state.pluginUpdateMessage) {
|
|
964
|
+
output.system.push(state.pluginUpdateMessage);
|
|
965
|
+
// Keep showing until opencode restarts (don't clear)
|
|
966
|
+
}
|
|
958
967
|
};
|
|
959
968
|
}
|
|
960
969
|
// ═══════════════════════════════════════════════════════════════════════════════
|
|
@@ -1449,7 +1458,7 @@ function createMultiCycleHandler(state) {
|
|
|
1449
1458
|
async function server(input) {
|
|
1450
1459
|
const state = createState(input);
|
|
1451
1460
|
// ── Plugin version check (non-blocking, fire-and-forget) ──
|
|
1452
|
-
checkPluginUpdate().catch(() => { });
|
|
1461
|
+
checkPluginUpdate(state).catch(() => { });
|
|
1453
1462
|
// ── Harness auto-sync (non-blocking, fire-and-forget) ──
|
|
1454
1463
|
// Runs in background so it doesn't delay plugin initialization.
|
|
1455
1464
|
// If sync fails, plugin continues normally with existing config.
|