opencode-immune 1.0.11 → 1.0.12

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 +19 -11
  2. package/package.json +1 -1
package/dist/plugin.js CHANGED
@@ -531,17 +531,25 @@ function createSessionRecoveryEvent(state) {
531
531
  */
532
532
  function createSystemTransform(state) {
533
533
  return async (input, output) => {
534
- // Session Recovery injection
535
- if (state.recoveryContext && isManagedRootUltraworkSession(state, input.sessionID)) {
536
- const ctx = state.recoveryContext;
537
- const intentInfo = ctx.intent ? `, Intent: ${ctx.intent}` : "";
538
- const categoryInfo = ctx.category ? `, Category: ${ctx.category}` : "";
539
- output.system.push(`[Session Recovery] Active Memory Bank task detected:\n` +
540
- `- Task: ${ctx.task}\n` +
541
- `- Level: ${ctx.level}${intentInfo}${categoryInfo}\n` +
542
- `- Current Phase: ${ctx.phase}\n` +
543
- `- Phase Status:\n${ctx.phaseStatus}\n` +
544
- `Read memory-bank/tasks.md and memory-bank/activeContext.md to resume work.`);
534
+ // Session Recovery injection:
535
+ // Inject if recoveryContext exists AND either:
536
+ // - session is already registered as managed root ultrawork, OR
537
+ // - session is not yet registered (plugin just restarted, map is empty)
538
+ // but agent field matches ultrawork (checked via input metadata if available)
539
+ if (state.recoveryContext) {
540
+ const isManaged = isManagedRootUltraworkSession(state, input.sessionID);
541
+ const mapIsEmpty = state.managedUltraworkSessions.size === 0;
542
+ if (isManaged || mapIsEmpty) {
543
+ const ctx = state.recoveryContext;
544
+ const intentInfo = ctx.intent ? `, Intent: ${ctx.intent}` : "";
545
+ const categoryInfo = ctx.category ? `, Category: ${ctx.category}` : "";
546
+ output.system.push(`[Session Recovery] Active Memory Bank task detected:\n` +
547
+ `- Task: ${ctx.task}\n` +
548
+ `- Level: ${ctx.level}${intentInfo}${categoryInfo}\n` +
549
+ `- Current Phase: ${ctx.phase}\n` +
550
+ `- Phase Status:\n${ctx.phaseStatus}\n` +
551
+ `Read memory-bank/tasks.md and memory-bank/activeContext.md to resume work.`);
552
+ }
545
553
  }
546
554
  // Ralph Loop injection
547
555
  if (state.lastEditAttempt) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-immune",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "OpenCode plugin: session recovery, auto-retry, multi-cycle automation, context monitoring",
5
5
  "exports": {
6
6
  "./server": "./dist/plugin.js"