opencode-immune 1.0.12 → 1.0.13

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.
Files changed (2) hide show
  1. package/dist/plugin.js +27 -4
  2. package/package.json +1 -1
package/dist/plugin.js CHANGED
@@ -19,6 +19,7 @@ function createState(input) {
19
19
  todoWriteUsed: false,
20
20
  approximateTokens: 0,
21
21
  sessionActive: false,
22
+ autoResumeAttempted: false,
22
23
  cycleCount: 0,
23
24
  commitPending: false,
24
25
  };
@@ -717,16 +718,38 @@ function createFallbackModels(state) {
717
718
  await addManagedUltraworkSession(state, input.sessionID);
718
719
  await writeUltraworkMarker(state);
719
720
  // First contact with 0-ultrawork after plugin restart:
720
- // if marker is active and tasks.md has incomplete work, populate recoveryContext
721
- // so that system.transform injects recovery info into the conversation.
722
- if (!wasAlreadyManaged && !state.recoveryContext) {
721
+ // if marker is active and tasks.md has incomplete work, send AUTO-RESUME prompt.
722
+ if (!wasAlreadyManaged && !state.autoResumeAttempted) {
723
+ state.autoResumeAttempted = true;
723
724
  const markerActive = await isUltraworkMarkerActive(state);
724
725
  if (markerActive) {
725
726
  const recovery = await parseTasksFile(state.input.directory);
726
727
  if (recovery && recovery.phase !== "ARCHIVE: DONE") {
727
728
  state.recoveryContext = recovery;
728
729
  console.log(`[opencode-immune] Auto-recovery on existing session: ` +
729
- `task="${recovery.task}", level=${recovery.level}, phase=${recovery.phase}`);
730
+ `task="${recovery.task}", level=${recovery.level}, phase=${recovery.phase}. ` +
731
+ `Sending AUTO-RESUME prompt in 3s...`);
732
+ const sid = input.sessionID;
733
+ setTimeout(async () => {
734
+ try {
735
+ await state.input.client.session.promptAsync({
736
+ body: {
737
+ agent: ULTRAWORK_AGENT,
738
+ parts: [
739
+ {
740
+ type: "text",
741
+ 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.`,
742
+ },
743
+ ],
744
+ },
745
+ path: { id: sid },
746
+ });
747
+ console.log(`[opencode-immune] Auto-resume prompt sent to session ${sid}`);
748
+ }
749
+ catch (err) {
750
+ console.log(`[opencode-immune] Auto-resume prompt failed:`, err);
751
+ }
752
+ }, 3_000);
730
753
  }
731
754
  }
732
755
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-immune",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "OpenCode plugin: session recovery, auto-retry, multi-cycle automation, context monitoring",
5
5
  "exports": {
6
6
  "./server": "./dist/plugin.js"