opencode-immune 1.0.13 → 1.0.14
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 +38 -1
- package/package.json +1 -1
package/dist/plugin.js
CHANGED
|
@@ -998,8 +998,45 @@ async function server(input) {
|
|
|
998
998
|
const recovery = await parseTasksFile(state.input.directory);
|
|
999
999
|
if (recovery && recovery.phase !== "ARCHIVE: DONE") {
|
|
1000
1000
|
state.recoveryContext = recovery;
|
|
1001
|
+
state.autoResumeAttempted = true;
|
|
1001
1002
|
console.log(`[opencode-immune] Plugin init: ultrawork marker active, recovery context loaded: ` +
|
|
1002
|
-
`task="${recovery.task}", level=${recovery.level}, phase=${recovery.phase}`
|
|
1003
|
+
`task="${recovery.task}", level=${recovery.level}, phase=${recovery.phase}. ` +
|
|
1004
|
+
`Will create new session and send AUTO-RESUME.`);
|
|
1005
|
+
// Create a new session and send AUTO-RESUME prompt (same pattern as CYCLE_COMPLETE).
|
|
1006
|
+
// Delay to let opencode fully initialize.
|
|
1007
|
+
setTimeout(async () => {
|
|
1008
|
+
try {
|
|
1009
|
+
const createResult = await state.input.client.session.create({
|
|
1010
|
+
body: {
|
|
1011
|
+
title: `AUTO-RESUME: ${recovery.task}`,
|
|
1012
|
+
},
|
|
1013
|
+
});
|
|
1014
|
+
const newSessionData = createResult?.data;
|
|
1015
|
+
const newSessionID = newSessionData?.id;
|
|
1016
|
+
if (!newSessionID) {
|
|
1017
|
+
console.error("[opencode-immune] Auto-resume: Failed to create session — no session ID returned.");
|
|
1018
|
+
return;
|
|
1019
|
+
}
|
|
1020
|
+
console.log(`[opencode-immune] Auto-resume: New session created: ${newSessionID}`);
|
|
1021
|
+
await addManagedUltraworkSession(state, newSessionID);
|
|
1022
|
+
await state.input.client.session.promptAsync({
|
|
1023
|
+
body: {
|
|
1024
|
+
agent: ULTRAWORK_AGENT,
|
|
1025
|
+
parts: [
|
|
1026
|
+
{
|
|
1027
|
+
type: "text",
|
|
1028
|
+
text: `[AUTO-RESUME] Previous session was interrupted. Read memory-bank/tasks.md, check the Phase Status block, and continue the pipeline. Use ONLY the Phase Status block to determine the next phase. Do NOT analyze or evaluate the content of tasks.md. Call the appropriate router with the exact neutral prompt from your Step 5 table.`,
|
|
1029
|
+
},
|
|
1030
|
+
],
|
|
1031
|
+
},
|
|
1032
|
+
path: { id: newSessionID },
|
|
1033
|
+
});
|
|
1034
|
+
console.log(`[opencode-immune] Auto-resume prompt sent to new session ${newSessionID}`);
|
|
1035
|
+
}
|
|
1036
|
+
catch (err) {
|
|
1037
|
+
console.error("[opencode-immune] Auto-resume: Failed to create session or send prompt:", err);
|
|
1038
|
+
}
|
|
1039
|
+
}, 5_000);
|
|
1003
1040
|
}
|
|
1004
1041
|
}
|
|
1005
1042
|
console.log(`[opencode-immune] Plugin initialized. Directory: ${input.directory}`);
|