instar 1.3.108 → 1.3.110

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 (46) hide show
  1. package/dist/commands/init.js +48 -0
  2. package/dist/commands/init.js.map +1 -1
  3. package/dist/config/ConfigDefaults.d.ts.map +1 -1
  4. package/dist/config/ConfigDefaults.js +10 -0
  5. package/dist/config/ConfigDefaults.js.map +1 -1
  6. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  7. package/dist/core/PostUpdateMigrator.js +67 -0
  8. package/dist/core/PostUpdateMigrator.js.map +1 -1
  9. package/dist/core/SessionManager.d.ts +11 -0
  10. package/dist/core/SessionManager.d.ts.map +1 -1
  11. package/dist/core/SessionManager.js +18 -15
  12. package/dist/core/SessionManager.js.map +1 -1
  13. package/dist/core/frameworkSessionLaunch.d.ts +20 -0
  14. package/dist/core/frameworkSessionLaunch.d.ts.map +1 -1
  15. package/dist/core/frameworkSessionLaunch.js +27 -0
  16. package/dist/core/frameworkSessionLaunch.js.map +1 -1
  17. package/dist/monitoring/RevertDetector.d.ts.map +1 -1
  18. package/dist/monitoring/RevertDetector.js +12 -1
  19. package/dist/monitoring/RevertDetector.js.map +1 -1
  20. package/dist/paste/PasteManager.d.ts.map +1 -1
  21. package/dist/paste/PasteManager.js +13 -6
  22. package/dist/paste/PasteManager.js.map +1 -1
  23. package/dist/scheduler/MentorAutonomousGuardian.d.ts +91 -0
  24. package/dist/scheduler/MentorAutonomousGuardian.d.ts.map +1 -0
  25. package/dist/scheduler/MentorAutonomousGuardian.js +88 -0
  26. package/dist/scheduler/MentorAutonomousGuardian.js.map +1 -0
  27. package/dist/scheduler/MentorOnboardingRunner.d.ts +61 -2
  28. package/dist/scheduler/MentorOnboardingRunner.d.ts.map +1 -1
  29. package/dist/scheduler/MentorOnboardingRunner.js +48 -3
  30. package/dist/scheduler/MentorOnboardingRunner.js.map +1 -1
  31. package/dist/server/AgentServer.d.ts.map +1 -1
  32. package/dist/server/AgentServer.js +63 -2
  33. package/dist/server/AgentServer.js.map +1 -1
  34. package/dist/server/routes.d.ts.map +1 -1
  35. package/dist/server/routes.js +2 -1
  36. package/dist/server/routes.js.map +1 -1
  37. package/package.json +1 -1
  38. package/src/data/builtin-manifest.json +64 -64
  39. package/upgrades/1.3.109.md +80 -0
  40. package/upgrades/1.3.110.md +55 -0
  41. package/upgrades/NEXT.eli16.md +60 -63
  42. package/upgrades/side-effects/dangerous-command-guard-gh-pr-merge-gate.md +102 -0
  43. package/upgrades/side-effects/failure-learning-source-tree-readok.md +113 -0
  44. package/upgrades/side-effects/loop-session-no-mcp.md +65 -0
  45. package/upgrades/side-effects/mentor-autonomous-fix-loop.md +79 -0
  46. package/upgrades/side-effects/no-empty-catch-blocks-lint.md +101 -0
@@ -2552,11 +2552,23 @@ A durable, bucket-tagged record of behavioral issues observed while onboarding a
2552
2552
  - Issues logged for a framework: \`curl -H "Authorization: Bearer $AUTH" http://localhost:${port}/framework-issues\` (optional \`?framework=X&bucket=...&status=...&limit=N\`)
2553
2553
  - The onboarding playbook (generalizable lessons from PRIOR frameworks, impact-ranked): \`curl -H "Authorization: Bearer $AUTH" "http://localhost:${port}/framework-issues/playbook?targetFramework=X"\`
2554
2554
  - Both routes are read-only and return references, not log contents.
2555
+
2556
+ **Autonomous-fix loop ("just be Echo")** — when \`mentor.autonomousFix.enabled\` is true, the mentor heartbeat stops running the observe-and-log pipeline and instead keeps ONE full-tool **Opus** session alive on the manual dogfooding loop: assign the mentee a real task over Telegram, observe the UX + the mentee's internals, FIX whatever is broken as a proper fleet PR (full ship gate), and report. Ships **dark** (off by default). The expensive Opus session only spawns when no loop session is already running (single-instance), budget is OK, and the min-interval has elapsed — so it never idle-burns or spawn-storms. Enable per agent in \`.instar/config.json\` → \`mentor.autonomousFix\`. Status lands in \`GET /mentor/status .lastResult\` (\`reason: 'spawned' | 'loop-active' | 'budget' | …\`).
2555
2557
  `;
2556
2558
  content += '\n' + fwLedgerSection;
2557
2559
  patched = true;
2558
2560
  result.upgraded.push('CLAUDE.md: added Framework-Onboarding Mentor System issue-ledger awareness section');
2559
2561
  }
2562
+ else if (!content.includes('Autonomous-fix loop ("just be Echo")')) {
2563
+ // Migration parity: agents that already have the mentor section (shipped
2564
+ // before the autonomous-fix loop) must still learn about the new dark
2565
+ // capability. Append just the autonomousFix paragraph, content-sniffed so
2566
+ // it is idempotent.
2567
+ content +=
2568
+ '\n**Autonomous-fix loop ("just be Echo")** — when `mentor.autonomousFix.enabled` is true, the mentor heartbeat keeps ONE full-tool **Opus** session alive on the manual dogfooding loop (assign the mentee a real task → observe the UX + internals → FIX as a proper fleet PR → report) instead of the observe-and-log pipeline. Ships **dark** (off by default); single-instance + budget + min-interval gated so it never idle-burns. Enable in `.instar/config.json` → `mentor.autonomousFix`; status in `GET /mentor/status .lastResult`.\n';
2569
+ patched = true;
2570
+ result.upgraded.push('CLAUDE.md: added autonomous-fix loop ("just be Echo") awareness paragraph');
2571
+ }
2560
2572
  // Version-Skew Self-Recovery section
2561
2573
  // Tells the agent what's happening when the lifeline+server temporarily
2562
2574
  // mismatch versions during an auto-update. Without this, agents diagnose
@@ -5263,6 +5275,61 @@ for pattern in "rm -rf \\." "git push --force" "git push -f" "git reset --hard"
5263
5275
  fi
5264
5276
  fi
5265
5277
  done
5278
+
5279
+ # 'gh pr merge' watch-exit-merge gate — closes the PR #539 class.
5280
+ # Justin merged #539 on 'gh run watch' exit code (= success), but 'watch'
5281
+ # returns 0 on workflow COMPLETION regardless of conclusion; meanwhile the
5282
+ # PR's branch-protection checks were RED. Cost a fix-forward (#540) + a
5283
+ # fleet outage. The rule: 'gh pr merge' must NEVER fire if any PR-event
5284
+ # check is non-pass. This guard runs 'gh pr checks <num>' and refuses on
5285
+ # any failure / pending / queued check.
5286
+ #
5287
+ # 'gh pr merge --auto' is the documented safe path (only fires when
5288
+ # checks pass) — let it through. Other flags (--admin, no flag) get
5289
+ # verified against the live check state.
5290
+ if echo "$INPUT" | grep -qiE '(^|[;&|(\\s])gh +pr +merge( |\$|--)'; then
5291
+ if echo "$INPUT" | grep -qE '(^| )--auto( |$)'; then
5292
+ : # --auto is the safe async gate; allow.
5293
+ else
5294
+ PR_NUM=$(echo "$INPUT" | grep -oE 'gh +pr +merge[ +-]+[0-9]+' | grep -oE '[0-9]+' | head -1)
5295
+ if [ -z "$PR_NUM" ]; then
5296
+ PR_NUM=$(gh pr view --json number -q .number 2>/dev/null)
5297
+ fi
5298
+ if [ -n "$PR_NUM" ]; then
5299
+ CHECKS_JSON=$(gh pr checks "$PR_NUM" --json name,state 2>/dev/null)
5300
+ if [ -n "$CHECKS_JSON" ]; then
5301
+ NON_OK=$(echo "$CHECKS_JSON" | python3 -c "
5302
+ import sys, json
5303
+ try:
5304
+ rows = json.loads(sys.stdin.read())
5305
+ if isinstance(rows, list):
5306
+ bad = [r.get('name','?') + '=' + str(r.get('state','?')) for r in rows
5307
+ if str(r.get('state','')).upper() not in ('SUCCESS','SKIPPED','SKIPPING','NEUTRAL','')]
5308
+ print(','.join(bad))
5309
+ except Exception:
5310
+ pass
5311
+ " 2>/dev/null)
5312
+ if [ -n "$NON_OK" ]; then
5313
+ echo "BLOCKED: PR #$PR_NUM has non-passing checks: $NON_OK" >&2
5314
+ echo "" >&2
5315
+ echo "'gh pr merge' must not run while any check is failing, pending, or queued." >&2
5316
+ echo "Closes the 2026-05-27 #539 watch-exit-merge class — 'gh run watch' returns 0" >&2
5317
+ echo "on workflow completion regardless of conclusion, which caused a fix-forward" >&2
5318
+ echo "(#540) + a fleet outage when #539 was merged on a red unit-test shard." >&2
5319
+ echo "" >&2
5320
+ echo "Options:" >&2
5321
+ echo " 1) Wait. Re-check with: gh pr checks $PR_NUM" >&2
5322
+ echo " 2) Use 'gh pr merge --auto' — async gate that ONLY fires when all" >&2
5323
+ echo " checks pass. Documented safe path." >&2
5324
+ echo " 3) If a non-passing check is an intentional skip (e.g. Contract Tests" >&2
5325
+ echo " on non-tagged PRs), it appears as SKIPPED / SKIPPING in" >&2
5326
+ echo " 'gh pr checks --json state' output and the gate already allows it." >&2
5327
+ exit 2
5328
+ fi
5329
+ fi
5330
+ fi
5331
+ fi
5332
+ fi
5266
5333
  `;
5267
5334
  }
5268
5335
  getGroundingBeforeMessaging() {