@codyswann/lisa 5.8.1 → 5.9.0

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 (120) hide show
  1. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  2. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  3. package/dist/core/upstream-evidence-manifest.js +10 -8
  4. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  5. package/package.json +4 -4
  6. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  7. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  8. package/plugins/lisa/.codex-plugin/skills/lisa-secrets-access/scripts/validate-config.mjs +1 -0
  9. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/SKILL.md +3 -2
  10. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-orphans.mjs +17 -1
  11. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-usage.mjs +1 -1
  12. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/config.mjs +2 -1
  13. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/orphan-sweep.mjs +9 -2
  14. package/plugins/lisa/hooks/auto-update.mjs +128 -25
  15. package/plugins/lisa/rules/reference/config-resolution.md +2 -1
  16. package/plugins/lisa/skills/lisa-secrets-access/scripts/validate-config.mjs +1 -0
  17. package/plugins/lisa/skills/lisa-session-manager/SKILL.md +3 -2
  18. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-orphans.mjs +17 -1
  19. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-usage.mjs +1 -1
  20. package/plugins/lisa/skills/lisa-session-manager/scripts/config.mjs +2 -1
  21. package/plugins/lisa/skills/lisa-session-manager/scripts/orphan-sweep.mjs +9 -2
  22. package/plugins/lisa-agy/plugin.json +1 -1
  23. package/plugins/lisa-agy/skills/lisa-secrets-access/scripts/validate-config.mjs +1 -0
  24. package/plugins/lisa-agy/skills/lisa-session-manager/SKILL.md +3 -2
  25. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-orphans.mjs +17 -1
  26. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-usage.mjs +1 -1
  27. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/config.mjs +2 -1
  28. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/orphan-sweep.mjs +9 -2
  29. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  30. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  31. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  32. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  33. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  34. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  35. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  36. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  37. package/plugins/lisa-copilot/hooks/auto-update.mjs +128 -25
  38. package/plugins/lisa-copilot/rules/reference/config-resolution.md +2 -1
  39. package/plugins/lisa-copilot/skills/lisa-secrets-access/scripts/validate-config.mjs +1 -0
  40. package/plugins/lisa-copilot/skills/lisa-session-manager/SKILL.md +3 -2
  41. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-orphans.mjs +17 -1
  42. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-usage.mjs +1 -1
  43. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/config.mjs +2 -1
  44. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/orphan-sweep.mjs +9 -2
  45. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  46. package/plugins/lisa-cursor/hooks/auto-update.mjs +128 -25
  47. package/plugins/lisa-cursor/rules/config-resolution-reference.mdc +2 -1
  48. package/plugins/lisa-cursor/skills/lisa-secrets-access/scripts/validate-config.mjs +1 -0
  49. package/plugins/lisa-cursor/skills/lisa-session-manager/SKILL.md +3 -2
  50. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-orphans.mjs +17 -1
  51. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-usage.mjs +1 -1
  52. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/config.mjs +2 -1
  53. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/orphan-sweep.mjs +9 -2
  54. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  55. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  56. package/plugins/lisa-devin/hooks/auto-update.mjs +128 -25
  57. package/plugins/lisa-devin/rules/reference/config-resolution.md +2 -1
  58. package/plugins/lisa-devin/skills/lisa-secrets-access/scripts/validate-config.mjs +1 -0
  59. package/plugins/lisa-devin/skills/lisa-session-manager/SKILL.md +3 -2
  60. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-orphans.mjs +17 -1
  61. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-usage.mjs +1 -1
  62. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/config.mjs +2 -1
  63. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/orphan-sweep.mjs +9 -2
  64. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  65. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  66. package/plugins/lisa-expo-agy/plugin.json +1 -1
  67. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  68. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  69. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  70. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  71. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  72. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  73. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  74. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  75. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  76. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  77. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  78. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  79. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  80. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  81. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  82. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  83. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  84. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  85. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  86. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  87. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  88. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  89. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  90. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  91. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  92. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  93. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  94. package/plugins/lisa-rails-agy/plugin.json +1 -1
  95. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  96. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  97. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  98. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  99. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  100. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  101. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  102. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  103. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  104. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  105. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  106. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  107. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  108. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  109. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  110. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  111. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  112. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  113. package/plugins/src/base/hooks/auto-update.mjs +128 -25
  114. package/plugins/src/base/rules/reference/config-resolution.md +2 -1
  115. package/plugins/src/base/skills/lisa-secrets-access/scripts/validate-config.mjs +1 -0
  116. package/plugins/src/base/skills/lisa-session-manager/SKILL.md +3 -2
  117. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-orphans.mjs +17 -1
  118. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-usage.mjs +1 -1
  119. package/plugins/src/base/skills/lisa-session-manager/scripts/config.mjs +2 -1
  120. package/plugins/src/base/skills/lisa-session-manager/scripts/orphan-sweep.mjs +9 -2
@@ -36,6 +36,19 @@
36
36
  *
37
37
  * FAIL SOFT, ALWAYS. Any failure is reported in the context and the session
38
38
  * starts; a half-finished update is reported, never hidden.
39
+ *
40
+ * ## The developer is told, not only the agent (CodySwannGT/lisa#4903)
41
+ *
42
+ * Hook context reaches the agent, never the person. So every outcome where a
43
+ * newer Lisa is known and is NOT in place — uncommitted changes, an update an
44
+ * earlier session left uncommitted, an update applied but not committable, a
45
+ * linked `node_modules`, unreadable release tags, a failure — also carries a
46
+ * plain-language notice. The hook emits it as `systemMessage`, which Claude
47
+ * Code, Codex and Devin (Claude-shaped hook output) show to the developer,
48
+ * and the context asks the agent to raise it in its first reply and offer to
49
+ * finish the update, with the command that does. A runtime that does not
50
+ * render `systemMessage` (Cursor) still reaches the developer through that
51
+ * relay. It warns rather than blocks: a session must always start.
39
52
  * @module plugins/src/base/hooks/auto-update
40
53
  */
41
54
  import { execFile } from "child_process";
@@ -461,7 +474,7 @@ async function npmLatest(projectDir, deps) {
461
474
  /**
462
475
  * Everything decided before anything is changed.
463
476
  * @param {object} ctx Context.
464
- * @returns {Promise<{skip: string} | {from: string, to: string, selfMode: boolean, manager: string}>} Plan.
477
+ * @returns {Promise<{skip: string, notice?: string, rerun?: boolean} | {from: string, to: string, selfMode: boolean, manager: string}>} Plan.
465
478
  */
466
479
  async function plan(ctx) {
467
480
  const { projectDir, run } = ctx;
@@ -476,11 +489,6 @@ async function plan(ctx) {
476
489
  if (!declares) return { skip: "" };
477
490
  const modules = path.join(projectDir, "node_modules");
478
491
  if (!existsSync(modules)) return { skip: "" };
479
- if (lstatSync(modules).isSymbolicLink()) {
480
- return {
481
- skip: "node_modules is a link to another checkout's install, so updating here would change that checkout too. Update Lisa from that checkout instead.",
482
- };
483
- }
484
492
  const from = installedVersion(projectDir);
485
493
  const to = await npmLatest(projectDir, ctx);
486
494
  if (!from) return { skip: "" };
@@ -489,12 +497,22 @@ async function plan(ctx) {
489
497
  skip: "npm could not be reached to check for a newer Lisa; nothing was changed.",
490
498
  };
491
499
  if (!precedes(from, to)) return { skip: "" };
500
+ // Checked only once Lisa is known to be behind, so a current project that
501
+ // shares an install is never warned about every session.
502
+ if (lstatSync(modules).isSymbolicLink()) {
503
+ return {
504
+ skip: "node_modules is a link to another checkout's install, so updating here would change that checkout too. Update Lisa from that checkout instead.",
505
+ notice: `Lisa is out of date: this project has ${from} and ${to} is available. This checkout shares its installed packages with another checkout, so it was not updated here. Update Lisa from that other checkout.`,
506
+ };
507
+ }
492
508
  const dirty = await run(["git", "status", "--porcelain"], {
493
509
  cwd: projectDir,
494
510
  });
495
511
  if (dirty) {
496
512
  return {
497
- skip: `Lisa ${to} is available (this project has ${from}), but the working tree has uncommitted changes, so nothing was changed. It updates at the start of a session that begins on a clean tree.`,
513
+ skip: `Lisa ${to} is available (this project has ${from}), but the working tree has uncommitted changes, so nothing was changed.`,
514
+ notice: `Lisa is out of date: this project has ${from} and ${to} is available. It was not updated automatically because there are uncommitted changes. Commit or stash them and start a new session, or ask your agent to update Lisa now.`,
515
+ rerun: true,
498
516
  };
499
517
  }
500
518
  if (selfMode) {
@@ -504,6 +522,7 @@ async function plan(ctx) {
504
522
  if (current === null) {
505
523
  return {
506
524
  skip: `Lisa ${to} is available, but the release tags needed to check it could not be read (offline?), so nothing was changed.`,
525
+ notice: `Lisa ${to} is available (this checkout has ${from}), but its release history could not be read, so it was not updated. Check the network and start a new session.`,
507
526
  };
508
527
  }
509
528
  if (current) return { skip: "" };
@@ -649,7 +668,8 @@ export async function workingTreeDigests(run, cwd, files) {
649
668
  * Commit the update now, or leave it pending for the first work-item binding.
650
669
  * @param {object} ctx Context.
651
670
  * @param {{from: string, to: string}} update The update.
652
- * @returns {Promise<string>} One sentence describing where the update is.
671
+ * @returns {Promise<{where: string, notice: string | null}>} Where the update
672
+ * is, and the developer notice when it is not committed.
653
673
  */
654
674
  async function settle(ctx, update) {
655
675
  const { projectDir, run } = ctx;
@@ -688,7 +708,10 @@ async function settle(ctx, update) {
688
708
  const sha = await run(["git", "rev-parse", "--short", "HEAD"], {
689
709
  cwd: projectDir,
690
710
  });
691
- return `It is committed on ${branch} as its own commit ${sha}, so it ships with this branch's pull request.`;
711
+ return {
712
+ where: `It is committed on ${branch} as its own commit ${sha}, so it ships with this branch's pull request.`,
713
+ notice: null,
714
+ };
692
715
  } catch (error) {
693
716
  await run(["git", "reset", "--quiet"], { cwd: projectDir }).catch(
694
717
  () => ""
@@ -708,13 +731,17 @@ async function settle(ctx, update) {
708
731
  marker,
709
732
  `${JSON.stringify({ from: update.from, to: update.to, files: changed, ...(digests ? { digests } : {}) }, null, 2)}\n`
710
733
  );
711
- return `It is NOT committed yet (${decision.reason}). The ${changed.length} changed file(s) are left in the working tree and recorded as a pending update; binding a work item on a feature branch (\`lisa-work-item.mjs link\` / \`attach-branch\`, which /lisa:track runs) commits them first, as their own commit. Do not fold these files into a feature commit.`;
734
+ return {
735
+ where: `It is NOT committed yet (${decision.reason}). The ${changed.length} changed file(s) are left in the working tree and recorded as a pending update; binding a work item on a feature branch (\`lisa-work-item.mjs link\` / \`attach-branch\`, which /lisa:track runs) commits them first, as their own commit. Do not fold these files into a feature commit.`,
736
+ notice: `Lisa was updated from ${update.from} to ${update.to}, but the change is not committed yet (${decision.reason}). Ask your agent to commit it on its own branch so it is not lost or mixed into other work.`,
737
+ };
712
738
  }
713
739
 
714
740
  /**
715
741
  * Remind about a pending update, or clear a marker whose files were committed.
716
742
  * @param {object} ctx Context.
717
- * @returns {Promise<string | null>} A reminder, or null when nothing is pending.
743
+ * @returns {Promise<{text: string, notice: string} | null>} A reminder, or
744
+ * null when nothing is pending.
718
745
  */
719
746
  async function pendingReminder(ctx) {
720
747
  const markerPath = path.resolve(
@@ -726,22 +753,84 @@ async function pendingReminder(ctx) {
726
753
  );
727
754
  const marker = readJson(markerPath);
728
755
  if (!marker) return null;
729
- const dirty = await ctx.run(["git", "status", "--porcelain"], {
730
- cwd: ctx.projectDir,
731
- });
756
+ // Only the marker's own files decide it: an unrelated edit must not keep a
757
+ // committed update looking pending, and no recorded files means none is.
758
+ const files = marker.files ?? [];
759
+ const dirty = files.length
760
+ ? await ctx.run(["git", "status", "--porcelain", "--", ...files], {
761
+ cwd: ctx.projectDir,
762
+ })
763
+ : "";
732
764
  if (!dirty) {
733
765
  rmSync(markerPath, { force: true });
734
766
  return null;
735
767
  }
736
- return `A Lisa update to ${marker.to} was applied in an earlier session and is still uncommitted (${(marker.files ?? []).length} file(s)). Binding a work item on a feature branch commits it first, as its own commit. Do not fold these files into a feature commit.`;
768
+ // An uncommitted update must not hide a release that came out since, or a
769
+ // project left on main with its bump uncommitted never hears of another.
770
+ // probe-direction: neutral — an unreachable registry only drops the clause.
771
+ const latest = await npmLatest(ctx.projectDir, ctx).catch(() => null);
772
+ const since =
773
+ latest && marker.to && precedes(marker.to, latest)
774
+ ? ` Lisa ${latest} has been released since.`
775
+ : "";
776
+ return {
777
+ text: `A Lisa update to ${marker.to} was applied in an earlier session and is still uncommitted (${files.length} file(s)).${since} Binding a work item on a feature branch commits it first, as its own commit. Do not fold these files into a feature commit.`,
778
+ notice: `A Lisa update to ${marker.to} is sitting in this project but is not committed.${since} Ask your agent to commit it on its own branch so it is not lost or mixed into other work.`,
779
+ };
780
+ }
781
+
782
+ /** This hook's own path, so the agent can rerun it once the tree is clean. */
783
+ const RUNNER_PATH = fileURLToPath(import.meta.url);
784
+
785
+ /**
786
+ * Agent context with the developer notice attached: what to tell them, and
787
+ * how to finish the update when they say yes.
788
+ * @param {string} text Context sentence(s).
789
+ * @param {string} notice What the developer is told.
790
+ * @param {string} projectDir Project root.
791
+ * @param {boolean} rerun Whether rerunning the hook would finish the update.
792
+ * @returns {string} Context for the agent.
793
+ */
794
+ function withNotice(text, notice, projectDir, rerun) {
795
+ const how = rerun
796
+ ? ` If they want it now, help them commit or stash their changes first, then run \`node "${RUNNER_PATH}" --project-dir "${projectDir}"\` and report what it says.`
797
+ : "";
798
+ return `${text}\n\nThe developer may not see hook output. In your first reply, tell them this in plain words and offer to sort it out: "${notice}"${how}`;
737
799
  }
738
800
 
739
801
  /**
740
802
  * Run the whole session-start update.
741
803
  * @param {{projectDir: string, env?: NodeJS.ProcessEnv, nowMs?: number, run?: typeof runCommand, refresh?: typeof refreshNpmLatest}} input Inputs.
804
+ * @returns {Promise<{text: string, notice: string | null}>} The agent context
805
+ * ("" when there is nothing to say) and the developer notice (null when the
806
+ * developer need not be told anything).
807
+ */
808
+ export async function autoUpdateResult(input) {
809
+ const result = await runUpdate(input);
810
+ const notice = result.notice ?? null;
811
+ return {
812
+ text: notice
813
+ ? withNotice(result.text, notice, input.projectDir, Boolean(result.rerun))
814
+ : result.text,
815
+ notice,
816
+ };
817
+ }
818
+
819
+ /**
820
+ * Run the whole session-start update, returning only the agent context.
821
+ * @param {Parameters<typeof autoUpdateResult>[0]} input Inputs.
742
822
  * @returns {Promise<string>} The context sentence(s), or "" when there is nothing to say.
743
823
  */
744
824
  export async function autoUpdate(input) {
825
+ return (await autoUpdateResult(input)).text;
826
+ }
827
+
828
+ /**
829
+ * The update itself.
830
+ * @param {Parameters<typeof autoUpdateResult>[0]} input Inputs.
831
+ * @returns {Promise<{text: string, notice?: string | null, rerun?: boolean}>} Outcome.
832
+ */
833
+ async function runUpdate(input) {
745
834
  const ctx = {
746
835
  env: process.env,
747
836
  nowMs: Date.now(),
@@ -750,11 +839,13 @@ export async function autoUpdate(input) {
750
839
  };
751
840
  ctx.config = readLisaConfig(ctx.projectDir);
752
841
  const setting = autoUpdateSetting(ctx.config, ctx.env);
753
- if (!setting.on) return "";
842
+ if (!setting.on) return { text: "" };
754
843
  const pending = await pendingReminder(ctx);
755
844
  if (pending) return pending;
756
845
  const update = await plan(ctx);
757
- if ("skip" in update) return update.skip;
846
+ if ("skip" in update) {
847
+ return { text: update.skip, notice: update.notice, rerun: update.rerun };
848
+ }
758
849
  const lock = path.resolve(
759
850
  ctx.projectDir,
760
851
  await ctx.run(["git", "rev-parse", "--git-path", "lisa/auto-update.lock"], {
@@ -762,17 +853,26 @@ export async function autoUpdate(input) {
762
853
  })
763
854
  );
764
855
  if (!takeLock(lock, ctx.nowMs)) {
765
- return `Lisa ${update.to} is available; another session is updating this worktree right now.`;
856
+ return {
857
+ text: `Lisa ${update.to} is available; another session is updating this worktree right now.`,
858
+ };
766
859
  }
767
860
  try {
768
861
  await applyUpdate(ctx, update);
769
- const where = await settle(ctx, update);
862
+ const { where, notice } = await settle(ctx, update);
770
863
  const what = update.selfMode
771
864
  ? `Updated Lisa's own self-dependency from ${update.from} to ${update.to}.`
772
865
  : `Updated Lisa from ${update.from} to ${update.to}, including the template changes \`lisa apply\` makes for it.`;
773
- return `${what} ${where} Guard and skill behaviour you observe in THIS session is still the plugin copy it started with.`;
866
+ return {
867
+ text: `${what} ${where} Guard and skill behaviour you observe in THIS session is still the plugin copy it started with.`,
868
+ notice,
869
+ };
774
870
  } catch (error) {
775
- return `Lisa ${update.to} is available but the automatic update failed: ${String(error.message).split("\n")[0]}. The working tree may hold a partial update; review it with \`git status\` before other work, or set "autoUpdate": false to stop these attempts.`;
871
+ const reason = String(error.message).split("\n")[0];
872
+ return {
873
+ text: `Lisa ${update.to} is available but the automatic update failed: ${reason}. The working tree may hold a partial update; review it with \`git status\` before other work, or set "autoUpdate": false to stop these attempts.`,
874
+ notice: `Lisa could not update itself from ${update.from} to ${update.to}, and the project may hold a half-finished update. Ask your agent to check \`git status\` and finish or undo it. The error was: ${reason}`,
875
+ };
776
876
  } finally {
777
877
  releaseLock(lock);
778
878
  }
@@ -782,11 +882,14 @@ export async function autoUpdate(input) {
782
882
  * Wrap the context in the hook envelope.
783
883
  * @param {string} text Context sentence(s).
784
884
  * @param {string} event Hook event name.
885
+ * @param {string | null} [notice] What the developer must see, shown as
886
+ * `systemMessage`; omitted when there is none.
785
887
  * @returns {string} JSON envelope, or "" when there is nothing to say.
786
888
  */
787
- export function envelope(text, event) {
889
+ export function envelope(text, event, notice = null) {
788
890
  if (!text) return "";
789
891
  return JSON.stringify({
892
+ ...(notice ? { systemMessage: `⚠️ ${notice}` } : {}),
790
893
  hookSpecificOutput: {
791
894
  hookEventName: event,
792
895
  additionalContext: `<${BLOCK_TAG}>\n${text}\n</${BLOCK_TAG}>`,
@@ -813,9 +916,9 @@ function invokedDirectly(moduleUrl, argv1 = process.argv[1]) {
813
916
  if (invokedDirectly(import.meta.url)) {
814
917
  const index = process.argv.indexOf("--project-dir");
815
918
  const projectDir = index >= 0 ? process.argv[index + 1] : process.cwd();
816
- autoUpdate({ projectDir })
817
- .then(text => {
818
- const out = envelope(text, "SessionStart");
919
+ autoUpdateResult({ projectDir })
920
+ .then(({ text, notice }) => {
921
+ const out = envelope(text, "SessionStart", notice);
819
922
  if (out) process.stdout.write(`${out}\n`);
820
923
  })
821
924
  .catch(() => {
@@ -694,7 +694,7 @@ have a `.lisa.config.json` and their own `.git` (written as `"root": "."`).
694
694
  }
695
695
  },
696
696
  "capacity": { "maxWorkers": 6, "gbPerWorker": 3, "reserveGb": 8, "cpuFraction": 0.75, "maxLoadPerCore": 1.5 },
697
- "stall": { "noOutputMinutes": 60, "maxAttempts": 3, "requestionHours": 4 },
697
+ "stall": { "noOutputMinutes": 60, "maxAttempts": 3, "requestionHours": 4, "orphanHours": 2 },
698
698
  "notify": { "provider": "telegram", "stateDir": "~/.claude/channels/telegram-<project>" }
699
699
  }
700
700
  ```
@@ -719,6 +719,7 @@ operator chooses Telegram (`init-config --notify telegram`).
719
719
  | `sessionManager.stall.noOutputMinutes` | no | `60` | A live worker with no new output for this long counts as stalled (zero or positive). |
720
720
  | `sessionManager.stall.maxAttempts` | no | `3` | Fresh sessions per item before it moves to the configured `blocked` role (a positive integer). |
721
721
  | `sessionManager.stall.requestionHours` | no | `4` | How long an unanswered worker question waits before the manager asks again (zero or positive). |
722
+ | `sessionManager.stall.orphanHours` | no | `2` | An item in the `claimed` (or `review`) role with no live worker and no tracker update for this long is presumed abandoned, and the orphan sweep finishes, returns or re-dispatches it. Anything updated more recently is left alone, which protects someone running `/lisa:implement` by hand (zero or positive). |
722
723
  | `sessionManager.notify.provider` | no | `none` | `none` (no notification channel) or `telegram`. Absent, like an absent `notify` block, means `none`. Any other value fails validation. |
723
724
  | `sessionManager.notify.stateDir` | **yes** with `telegram`; must be absent otherwise | — | This project's own Telegram state dir. A `stateDir` without the `telegram` provider fails validation, because no bot would use it. Never the shared default `~/.claude/channels/telegram`, because one bot per state dir is how projects stay isolated. Setup writes `~/.claude/channels/telegram-<project>`. |
724
725
  | `sessionManager.trustedAuthorIds` | no | — | Optional list of **stable tracker user ids**, as strings: the GitHub numeric user id (`gh api users/<login> --jq .id`), the Jira `accountId`, or the Linear user id. Not logins or display names: matching compares ids, so a plain login silently matches no one and excludes every item. An entry may name its kind: `id:<v>` is an id, `login:<v>` a GitHub login (matched by the queue and on-item answers; the hold-release check compares ids only and ignores it). A login GitHub frees (after a rename or a deleted account) can be re-registered by someone else, so prefer `id:` for trust. `integration:<service>` trusts items an integration files with no person behind them (Linear's `botActor`, by `subType` such as `sentry`, else its bot `id`, never its self-chosen display name; never an item a person or an outside user filed; it trusts who filed the item, not text an outsider can get into it, such as a quoted error message); GitHub Apps and Jira automation file as an account, so trust them by `id:`. An unknown prefix or an empty value fails validation. When set, the manager takes only items authored by these people or integrations. It is also who may release a human hold, unless `trustedReleaseIds` is set — so removing it removes every hold releaser too. |
@@ -680,6 +680,7 @@ const STALL_RULES = {
680
680
  noOutputMinutes: [n => n >= 0, "zero or a positive number"],
681
681
  maxAttempts: [n => Number.isInteger(n) && n > 0, "a positive integer"],
682
682
  requestionHours: [n => n >= 0, "zero or a positive number"],
683
+ orphanHours: [n => n >= 0, "zero or a positive number"],
683
684
  };
684
685
 
685
686
  /** Notification providers `sessionManager.notify.provider` accepts. */
@@ -512,8 +512,9 @@ just as long. Sweep both every cycle, after `classify` and before Dispatch:
512
512
  operators and the trusted authors come from the ledger and config, never from the input. It
513
513
  skips refs the ledger shows running or asking (their holds too, so an item waiting on a
514
514
  person's answer is never on the operator's list twice), items assigned to anyone but "me" or an
515
- operator, and items updated within `--stale-hours` (default 6) or with no `updatedAt`, which
516
- protects a person running `/lisa:implement` by hand. A live or foreign hold is skipped the
515
+ operator, and items updated within `sessionManager.stall.orphanHours` (default 2;
516
+ `--stale-hours` overrides it) or with no `updatedAt`, which protects a person running
517
+ `/lisa:implement` by hand. A live or foreign hold is skipped the
517
518
  same way; a fresh or undated one is not lifted this cycle, but its human reasons still reach
518
519
  the operator's list, so a new comment never makes the list change.
519
520
  2. **Act** per bucket. **Before every write** in this sweep (a finish, a return, a re-dispatch
@@ -129,6 +129,20 @@ function readEnvelope(ctx) {
129
129
  return { items: envelope.items, holds: envelope.holds };
130
130
  }
131
131
 
132
+ /**
133
+ * The stale threshold for the sweep: the flag, else the config, else the
134
+ * planner's own default.
135
+ * @param {number | undefined} flag - `--stale-hours`
136
+ * @param {{ stall?: { orphanHours?: unknown } } | null | undefined} config -
137
+ * Resolved `sessionManager` block, or absent
138
+ * @returns {{ staleHours?: number }} Spread into the planner options
139
+ */
140
+ function orphanStaleHours(flag, config) {
141
+ if (flag !== undefined) return { staleHours: flag };
142
+ const configured = config?.stall?.orphanHours;
143
+ return typeof configured === "number" ? { staleHours: configured } : {};
144
+ }
145
+
132
146
  /**
133
147
  * `orphan-plan [--input <file>] [--max <n>] [--stale-hours <n>]` (stdin
134
148
  * without --input: `{"complete":true,"items":[...],"holds":[...]}`).
@@ -155,7 +169,9 @@ export async function orphanPlan(ctx) {
155
169
  trustedAuthorIds: trustedReleaseEntries(config),
156
170
  now: new Date(),
157
171
  ...(max === undefined ? {} : { max }),
158
- ...(staleHours === undefined ? {} : { staleHours }),
172
+ // An explicit --stale-hours wins; otherwise the project's
173
+ // `stall.orphanHours` (CodySwannGT/lisa#4901).
174
+ ...orphanStaleHours(staleHours, config),
159
175
  previousDigest: ledger.control.holdDigest ?? null,
160
176
  ...holdPolicy(project),
161
177
  })
@@ -328,7 +328,7 @@ Per cycle
328
328
  trustedAuthorIds and the hold labels come from the ledger and config;
329
329
  the same keys in the input are ignored. Skips live, foreign (assigned
330
330
  to neither me nor an operator), fresh (updated within --stale-hours,
331
- default 6) and undated items. Live and foreign holds are skipped; a
331
+ else sessionManager.stall.orphanHours, default 2) and undated items. Live and foreign holds are skipped; a
332
332
  fresh or undated hold is not lifted (skipped fresh or undated) but its
333
333
  kept reasons still reach holds.keep and the digest. A lift left with
334
334
  nothing to write is skipped as nothing-to-write; decision is null for
@@ -50,6 +50,7 @@ export const SESSION_MANAGER_DEFAULTS = Object.freeze({
50
50
  noOutputMinutes: 60,
51
51
  maxAttempts: 3,
52
52
  requestionHours: 4,
53
+ orphanHours: 2,
53
54
  }),
54
55
  notify: Object.freeze({ provider: "none" }),
55
56
  });
@@ -74,7 +75,7 @@ export function notifyProvider(config) {
74
75
  * @typedef {{ maxWorkers: number, gbPerWorker: number, reserveGb: number,
75
76
  * cpuFraction: number, maxLoadPerCore: number }} CapacityBlock
76
77
  * @typedef {{ noOutputMinutes: number, maxAttempts: number,
77
- * requestionHours: number }} StallBlock
78
+ * requestionHours: number, orphanHours: number }} StallBlock
78
79
  * @typedef {{ provider: string, stateDir?: string }} NotifyBlock
79
80
  * @typedef {{
80
81
  * name: string,
@@ -38,8 +38,15 @@ export {
38
38
  /** At most this many writes per cycle unless the caller says otherwise. */
39
39
  export const DEFAULT_ORPHAN_MAX = 10;
40
40
 
41
- /** An item updated more recently than this many hours is left alone. */
42
- export const DEFAULT_STALE_HOURS = 6;
41
+ /**
42
+ * An item updated more recently than this many hours is left alone.
43
+ *
44
+ * Matches the documented `sessionManager.stall.orphanHours` default, which
45
+ * `orphan-plan` passes in. An in-progress item should never go two hours
46
+ * without a tracker update, so one that has is presumed abandoned
47
+ * (CodySwannGT/lisa#4901).
48
+ */
49
+ export const DEFAULT_STALE_HOURS = 2;
43
50
 
44
51
  /** The order buckets spend the cap in. */
45
52
  const CAPPED_BUCKETS = ["doneReady", "return", "redispatch", "parked"];
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-expo",
3
- "version": "5.8.1",
3
+ "version": "5.9.0",
4
4
  "description": "Expo/React Native-specific skills, agents, rules, and MCP servers",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-expo",
3
- "version": "5.8.1",
3
+ "version": "5.9.0",
4
4
  "description": "Expo and React Native-specific skills, agents, rules, and MCP servers.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-expo",
3
- "version": "5.8.1",
3
+ "version": "5.9.0",
4
4
  "description": "Expo/React Native-specific skills, agents, rules, and MCP servers",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-expo",
3
- "version": "5.8.1",
3
+ "version": "5.9.0",
4
4
  "description": "Expo/React Native-specific skills, agents, rules, and MCP servers",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-expo",
3
- "version": "5.8.1",
3
+ "version": "5.9.0",
4
4
  "description": "Expo/React Native-specific skills, agents, rules, and MCP servers",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-expo",
3
- "version": "5.8.1",
3
+ "version": "5.9.0",
4
4
  "description": "Expo/React Native-specific skills, agents, rules, and MCP servers",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-expo",
3
- "version": "5.8.1",
3
+ "version": "5.9.0",
4
4
  "description": "Expo/React Native-specific skills, agents, rules, and MCP servers",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-harper-fabric",
3
- "version": "5.8.1",
3
+ "version": "5.9.0",
4
4
  "description": "Harper/Fabric-specific rules for TypeScript component apps",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-harper-fabric",
3
- "version": "5.8.1",
3
+ "version": "5.9.0",
4
4
  "description": "Harper/Fabric-specific Lisa rules for TypeScript component apps.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-harper-fabric",
3
- "version": "5.8.1",
3
+ "version": "5.9.0",
4
4
  "description": "Harper/Fabric-specific rules for TypeScript component apps",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-harper-fabric",
3
- "version": "5.8.1",
3
+ "version": "5.9.0",
4
4
  "description": "Harper/Fabric-specific rules for TypeScript component apps",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-harper-fabric",
3
- "version": "5.8.1",
3
+ "version": "5.9.0",
4
4
  "description": "Harper/Fabric-specific rules for TypeScript component apps",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-harper-fabric",
3
- "version": "5.8.1",
3
+ "version": "5.9.0",
4
4
  "description": "Harper/Fabric-specific rules for TypeScript component apps",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-harper-fabric",
3
- "version": "5.8.1",
3
+ "version": "5.9.0",
4
4
  "description": "Harper/Fabric-specific rules for TypeScript component apps",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-nestjs",
3
- "version": "5.8.1",
3
+ "version": "5.9.0",
4
4
  "description": "NestJS-specific skills (GraphQL, TypeORM) and hooks (hand-written migration warning)",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-nestjs",
3
- "version": "5.8.1",
3
+ "version": "5.9.0",
4
4
  "description": "NestJS-specific skills and a hand-written migration warning hook.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-nestjs",
3
- "version": "5.8.1",
3
+ "version": "5.9.0",
4
4
  "description": "NestJS-specific skills (GraphQL, TypeORM) and hooks (hand-written migration warning)",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-nestjs",
3
- "version": "5.8.1",
3
+ "version": "5.9.0",
4
4
  "description": "NestJS-specific skills (GraphQL, TypeORM) and hooks (hand-written migration warning)",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-nestjs",
3
- "version": "5.8.1",
3
+ "version": "5.9.0",
4
4
  "description": "NestJS-specific skills (GraphQL, TypeORM) and hooks (hand-written migration warning)",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-nestjs",
3
- "version": "5.8.1",
3
+ "version": "5.9.0",
4
4
  "description": "NestJS-specific skills (GraphQL, TypeORM) and hooks (hand-written migration warning)",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-nestjs",
3
- "version": "5.8.1",
3
+ "version": "5.9.0",
4
4
  "description": "NestJS-specific skills (GraphQL, TypeORM) and hooks (hand-written migration warning)",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-phaser",
3
- "version": "5.8.1",
3
+ "version": "5.9.0",
4
4
  "description": "Phaser 4 game-development rules for TypeScript projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-phaser",
3
- "version": "5.8.1",
3
+ "version": "5.9.0",
4
4
  "description": "Phaser 4 game-development rules for TypeScript projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-phaser",
3
- "version": "5.8.1",
3
+ "version": "5.9.0",
4
4
  "description": "Phaser 4 game-development rules for TypeScript projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-phaser",
3
- "version": "5.8.1",
3
+ "version": "5.9.0",
4
4
  "description": "Phaser 4 game-development rules for TypeScript projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"