@codyswann/lisa 4.106.3 → 4.107.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 (131) hide show
  1. package/cdk/package-lisa/package.lisa.json +2 -2
  2. package/dist/configs/eslint/base.d.ts +2 -0
  3. package/dist/configs/eslint/base.d.ts.map +1 -1
  4. package/dist/configs/eslint/base.js +8 -0
  5. package/dist/configs/eslint/base.js.map +1 -1
  6. package/dist/configs/eslint/expo.d.ts +6 -0
  7. package/dist/configs/eslint/expo.d.ts.map +1 -1
  8. package/dist/configs/eslint/expo.js +23 -0
  9. package/dist/configs/eslint/expo.js.map +1 -1
  10. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  11. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  12. package/dist/core/upstream-evidence-manifest.js +34 -11
  13. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  14. package/expo/package-lisa/package.lisa.json +2 -2
  15. package/harper-fabric/package-lisa/package.lisa.json +2 -2
  16. package/nestjs/package-lisa/package.lisa.json +2 -2
  17. package/package.json +6 -6
  18. package/phaser/package-lisa/package.lisa.json +2 -2
  19. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  20. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  21. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/SKILL.md +21 -12
  22. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-status.mjs +10 -9
  23. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-usage.mjs +21 -10
  24. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cyclers.mjs +127 -0
  25. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/ledger.mjs +5 -0
  26. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/session-manager.mjs +2 -0
  27. package/plugins/lisa/skills/lisa-session-manager/SKILL.md +21 -12
  28. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-status.mjs +10 -9
  29. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-usage.mjs +21 -10
  30. package/plugins/lisa/skills/lisa-session-manager/scripts/cyclers.mjs +127 -0
  31. package/plugins/lisa/skills/lisa-session-manager/scripts/ledger.mjs +5 -0
  32. package/plugins/lisa/skills/lisa-session-manager/scripts/session-manager.mjs +2 -0
  33. package/plugins/lisa-agy/plugin.json +1 -1
  34. package/plugins/lisa-agy/skills/lisa-session-manager/SKILL.md +21 -12
  35. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-status.mjs +10 -9
  36. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-usage.mjs +21 -10
  37. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cyclers.mjs +127 -0
  38. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/ledger.mjs +5 -0
  39. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/session-manager.mjs +2 -0
  40. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  41. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  42. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  43. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  44. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  45. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  46. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  47. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  48. package/plugins/lisa-copilot/skills/lisa-session-manager/SKILL.md +21 -12
  49. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-status.mjs +10 -9
  50. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-usage.mjs +21 -10
  51. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cyclers.mjs +127 -0
  52. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/ledger.mjs +5 -0
  53. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/session-manager.mjs +2 -0
  54. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  55. package/plugins/lisa-cursor/skills/lisa-session-manager/SKILL.md +21 -12
  56. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-status.mjs +10 -9
  57. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-usage.mjs +21 -10
  58. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cyclers.mjs +127 -0
  59. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/ledger.mjs +5 -0
  60. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/session-manager.mjs +2 -0
  61. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  62. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  63. package/plugins/lisa-devin/skills/lisa-session-manager/SKILL.md +21 -12
  64. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-status.mjs +10 -9
  65. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-usage.mjs +21 -10
  66. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cyclers.mjs +127 -0
  67. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/ledger.mjs +5 -0
  68. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/session-manager.mjs +2 -0
  69. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  70. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  71. package/plugins/lisa-expo-agy/plugin.json +1 -1
  72. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  73. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  74. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  75. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  76. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  77. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  78. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  79. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  80. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  81. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  82. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  83. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  84. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  85. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  86. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  87. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  88. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  89. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  90. package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
  91. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  92. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  93. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  94. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  95. package/plugins/lisa-openclaw-devin/.claude-plugin/plugin.json +1 -1
  96. package/plugins/lisa-openclaw-devin/.devin-plugin/plugin.json +1 -1
  97. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  98. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  99. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  100. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  101. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  102. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  103. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  104. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  105. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  106. package/plugins/lisa-rails-agy/plugin.json +1 -1
  107. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  108. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  109. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  110. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  111. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  112. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  113. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  114. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  115. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  116. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  117. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  118. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  119. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  120. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  121. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  122. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  123. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  124. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  125. package/plugins/src/base/skills/lisa-session-manager/SKILL.md +21 -12
  126. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-status.mjs +10 -9
  127. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-usage.mjs +21 -10
  128. package/plugins/src/base/skills/lisa-session-manager/scripts/cyclers.mjs +127 -0
  129. package/plugins/src/base/skills/lisa-session-manager/scripts/ledger.mjs +5 -0
  130. package/plugins/src/base/skills/lisa-session-manager/scripts/session-manager.mjs +2 -0
  131. package/typescript/package-lisa/package.lisa.json +2 -2
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-rails",
3
- "version": "4.106.3",
3
+ "version": "4.107.0",
4
4
  "description": "Ruby on Rails-specific hooks — RuboCop linting/formatting and ast-grep scanning on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-typescript",
3
- "version": "4.106.3",
3
+ "version": "4.107.0",
4
4
  "description": "TypeScript-specific hooks — Prettier formatting, ESLint linting, ast-grep scanning, and error-suppression blocking on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-typescript",
3
- "version": "4.106.3",
3
+ "version": "4.107.0",
4
4
  "description": "TypeScript-specific hooks for formatting, linting, and ast-grep scanning on edit.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-typescript",
3
- "version": "4.106.3",
3
+ "version": "4.107.0",
4
4
  "description": "TypeScript-specific hooks — Prettier formatting, ESLint linting, ast-grep scanning, and error-suppression blocking on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-typescript",
3
- "version": "4.106.3",
3
+ "version": "4.107.0",
4
4
  "description": "TypeScript-specific hooks — Prettier formatting, ESLint linting, ast-grep scanning, and error-suppression blocking on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-typescript",
3
- "version": "4.106.3",
3
+ "version": "4.107.0",
4
4
  "description": "TypeScript-specific hooks — Prettier formatting, ESLint linting, ast-grep scanning, and error-suppression blocking on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-typescript",
3
- "version": "4.106.3",
3
+ "version": "4.107.0",
4
4
  "description": "TypeScript-specific hooks — Prettier formatting, ESLint linting, ast-grep scanning, and error-suppression blocking on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-typescript",
3
- "version": "4.106.3",
3
+ "version": "4.107.0",
4
4
  "description": "TypeScript-specific hooks — Prettier formatting, ESLint linting, ast-grep scanning, and error-suppression blocking on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "4.106.3",
3
+ "version": "4.107.0",
4
4
  "description": "LLM Wiki — a distributable, git-native markdown knowledge base for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "4.106.3",
3
+ "version": "4.107.0",
4
4
  "description": "Distributable LLM Wiki kernel — ingest, query, lint, and maintain a git-native markdown knowledge base across Claude and Codex.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "4.106.3",
3
+ "version": "4.107.0",
4
4
  "description": "LLM Wiki — a distributable, git-native markdown knowledge base for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "4.106.3",
3
+ "version": "4.107.0",
4
4
  "description": "LLM Wiki — a distributable, git-native markdown knowledge base for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "4.106.3",
3
+ "version": "4.107.0",
4
4
  "description": "LLM Wiki — a distributable, git-native markdown knowledge base for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "4.106.3",
3
+ "version": "4.107.0",
4
4
  "description": "LLM Wiki — a distributable, git-native markdown knowledge base for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "4.106.3",
3
+ "version": "4.107.0",
4
4
  "description": "LLM Wiki — a distributable, git-native markdown knowledge base for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -360,18 +360,27 @@ Do these steps in order. Start each cycle by resolving `$SM`, then confirm the s
360
360
  and check again; never run a cycle from a child repo. Handle any messages that arrived since the last
361
361
  cycle first (above).
362
362
 
363
- **Duplicate-manager check.** Decide **who** the manager is only from `status` `manager.self`; check
364
- this session's own loops with `CronList`. When `manager.self` is true, this session **is** the
365
- manager and its own `/loop` is the manager's loop: never report it as a second manager, and never
366
- recommend `CronDelete` or stopping it. When `manager.self` is `null`, recommend stopping nothing;
367
- report that self-identification failed. When `manager.running` is true, `manager.self` is false, and
368
- this session runs its own `/lisa:session-manager cycle` loop, two managers can hand out the same
369
- item: warn the operator and recommend stopping **this** session's loop, never the tmux manager. The
370
- tmux manager cannot see another session's loop, so that warning comes from the other session's own
371
- cycle and the manager must not invent one (detecting it from inside the manager is follow-up work).
372
- `manager.self` means running inside the manager's tmux session, so another Claude started in a
373
- second window of that same tmux session also reads true. Never infer a second manager from the tmux
374
- session existing plus a loop being present.
363
+ **Duplicate-manager check.** First record this cycle:
364
+ `node "$SM/session-manager.mjs" cycle --project-root "$ROOT"` (it records who ran it, as a tmux
365
+ session name or a process id, never a credential; a failure is one transcript line and never stops
366
+ the cycle). Decide **who** the manager is only from `status` `manager.self`; check this
367
+ session's own loops with `CronList`. When `manager.self` is true, this session **is** the manager
368
+ and its own `/loop` is the manager's loop: never report it as a second manager, and never recommend
369
+ `CronDelete` or stopping it. When `manager.self` is true and `status` `manager.otherCyclers` is not
370
+ empty, another session ran a cycle in this project within twice the interval, so two managers can
371
+ hand out the same item: warn the operator (over Telegram too when `notify` is `telegram`), name each
372
+ entry's `by` and `at`, and recommend stopping **that** session's loop, never this one. A `pid:` entry
373
+ names the process that ran that one cycle, so a single other session can leave several `pid:`
374
+ entries; report them as one or more other sessions, never as an exact count. When
375
+ `manager.self` is true and `manager.otherCyclers` is empty, raise no duplicate-manager warning. When
376
+ `manager.self` is `null`, recommend stopping nothing, whatever `manager.otherCyclers` says; report
377
+ that self-identification failed. When `manager.running` is true, `manager.self` is false, and this
378
+ session runs its own `/lisa:session-manager cycle` loop, two managers can hand out the same item:
379
+ warn the operator and recommend stopping **this** session's loop, never the tmux manager. The tmux
380
+ manager cannot see another session's loop, so it learns of one only from `manager.otherCyclers` and
381
+ must not invent one from anything else. `manager.self` means running inside the manager's tmux
382
+ session, so another Claude started in a second window of that same tmux session also reads true.
383
+ Never infer a second manager from the tmux session existing plus a loop being present.
375
384
 
376
385
  ### 1. Reconcile
377
386
 
@@ -10,7 +10,8 @@ import path from "node:path";
10
10
 
11
11
  import { listAgents, requireConfig, run } from "./cli-runtime.mjs";
12
12
  import { notifyProvider } from "./config.mjs";
13
- import { buildCurrentSessionName, buildHasSession } from "./launch.mjs";
13
+ import { callerSessionName, otherCyclers } from "./cyclers.mjs";
14
+ import { buildHasSession } from "./launch.mjs";
14
15
  import { listPendingQuestions } from "./ledger-questions.mjs";
15
16
  import { readLedger } from "./ledger.mjs";
16
17
  import { shellQuote } from "./token.mjs";
@@ -50,13 +51,9 @@ function answerCommandFor(ctx, ref) {
50
51
  * another session or none, null when tmux cannot say which it is
51
52
  */
52
53
  function isManagerSelf(ctx, name) {
53
- if (!ctx.env.TMUX) return false;
54
- const argv = buildCurrentSessionName(ctx.env.TMUX_PANE);
55
- if (argv === null) return null;
56
- const probe = run("tmux", argv, { env: ctx.env });
57
- const current = probe.status === 0 ? probe.stdout.trim() : "";
58
- if (current === "") return null;
59
- return current === name;
54
+ const current = callerSessionName(ctx);
55
+ if (current === undefined) return false;
56
+ return current === null ? null : current === name;
60
57
  }
61
58
 
62
59
  /**
@@ -66,7 +63,10 @@ function isManagerSelf(ctx, name) {
66
63
  * `notify` is the configured notification provider (`telegram` or `none`),
67
64
  * so the manager knows each cycle whether a channel exists. `manager.self`
68
65
  * (`true|false|null`) says whether the caller runs inside that tmux session
69
- * (see {@link isManagerSelf}).
66
+ * (see {@link isManagerSelf}). `manager.otherCyclers` lists every session
67
+ * other than the manager's tmux session that ran `cycle` within twice the
68
+ * interval, newest first, so the manager can warn about a second loop it
69
+ * cannot otherwise see (#4809; see cyclers.mjs).
70
70
  * @returns {Promise<{ json: object }>}
71
71
  * `{manager,notify,control,workers,untracked,pendingQuestions}`
72
72
  */
@@ -85,6 +85,7 @@ export async function status(ctx) {
85
85
  name: config.name,
86
86
  running: tmux.status === 0,
87
87
  self: isManagerSelf(ctx, config.name),
88
+ otherCyclers: otherCyclers(ledger, config, ctx.now()),
88
89
  },
89
90
  notify: notifyProvider(config),
90
91
  control: ledger.control,
@@ -56,17 +56,28 @@ Workers and capacity
56
56
  requestion|setup-gap|working|stalled|dead|exhausted. setup-gap: the
57
57
  worker's first prompt never ran; setupGap is {kind:"unknown-command"|
58
58
  "prompt-blocked",detail}, else null.
59
+ cycle
60
+ Records that this session ran a cycle now: cyclers[<by>] = <at> in
61
+ the ledger, by tmux:<session> when tmux names the caller's session,
62
+ pid:<parent pid> outside tmux, tmux-unknown:pid:<parent pid> when tmux
63
+ cannot name it. Prunes entries older than twice the interval.
64
+ Run at the start of every cycle. stdout {by,at}.
59
65
  status
60
- stdout {manager:{name,running,self},notify,control,workers:[{ref,
61
- worker,sessionId,repo,status,attempts,pendingQuestion,live}],untracked:
62
- [wk-names],pendingQuestions:[{ref,kind,text,askedAt,marked,
63
- answerQueued,answerCommand}]}. manager.self is true when the caller
64
- runs inside the manager's tmux session (any window of it), false
65
- outside tmux or in another session, null when tmux cannot say which
66
- session the caller is in or $TMUX_PANE is not a pane id. notify is
67
- the configured channel: "telegram" or "none". pendingQuestions lists
68
- every item waiting on a human, oldest first; answerCommand is the
69
- answer line to run at this machine.
66
+ stdout {manager:{name,running,self,otherCyclers:[{by,at}]},notify,
67
+ control,workers:[{ref,worker,sessionId,repo,status,attempts,
68
+ pendingQuestion,live}],untracked:[wk-names],pendingQuestions:[{ref,
69
+ kind,text,askedAt,marked,answerQueued,answerCommand}]}. manager.self
70
+ is true when the caller runs inside the manager's tmux session (any
71
+ window of it), false outside tmux or in another session, null when
72
+ tmux cannot say which session the caller is in or $TMUX_PANE is not
73
+ a pane id.
74
+ manager.otherCyclers lists, newest first, every cycle recorded within
75
+ twice the interval by a session other than tmux:<manager name>,
76
+ leaving out tmux-unknown entries; empty when only the manager
77
+ cycles. notify is the configured
78
+ channel: "telegram" or "none". pendingQuestions lists every item
79
+ waiting on a human, oldest first; answerCommand is the answer line to
80
+ run at this machine.
70
81
 
71
82
  Manager
72
83
  start [--settle-ms <n>]
@@ -0,0 +1,127 @@
1
+ /**
2
+ * Who ran a cycle, so the tmux manager can hear about a second session
3
+ * cycling in its project (CodySwannGT/lisa#4809).
4
+ *
5
+ * Only one session-manager loop should hand out work per project. #4496 left
6
+ * the duplicate warning to the second session's own cycle, because the tmux
7
+ * manager cannot see another session's `/loop`. An operator watching only the
8
+ * manager's channel never heard about it. Now every `cycle` records
9
+ * `cyclers[<identity>] = <ISO time>` in the ledger, and `status` reports as
10
+ * `manager.otherCyclers` every recent cycler that is not the manager's own
11
+ * tmux session, so the manager's cycle can warn too.
12
+ *
13
+ * Identity is `tmux:<session name>` when tmux names the caller's session
14
+ * (the same probe `manager.self` uses), `pid:<parent pid>` outside tmux, and
15
+ * `tmux-unknown:pid:<parent pid>` when that probe fails inside tmux. Nothing from
16
+ * the environment and no credential is ever recorded. "Recent" is within
17
+ * twice `sessionManager.interval`; older entries are pruned on every write so
18
+ * the map stays small.
19
+ * @module session-manager/cyclers
20
+ */
21
+ import { requireConfig, run } from "./cli-runtime.mjs";
22
+ import { parseLoopInterval } from "./config.mjs";
23
+ import { buildCurrentSessionName } from "./launch.mjs";
24
+ import { updateLedger } from "./ledger.mjs";
25
+
26
+ /** Fallback when the interval does not parse: the config default, 5m. */
27
+ const DEFAULT_INTERVAL_SECONDS = 300;
28
+
29
+ /**
30
+ * The tmux session the caller runs in, by asking tmux for the caller's own
31
+ * `$TMUX_PANE` (#4496; see `buildCurrentSessionName` for why the pane is
32
+ * always targeted). Nothing here throws.
33
+ * @param {{ env: Record<string, string | undefined> }} ctx - CLI context
34
+ * @returns {string | null | undefined} The session name; undefined outside
35
+ * tmux; null inside tmux when tmux cannot say which session it is
36
+ */
37
+ export function callerSessionName(ctx) {
38
+ if (!ctx.env.TMUX) return undefined;
39
+ const argv = buildCurrentSessionName(ctx.env.TMUX_PANE);
40
+ if (argv === null) return null;
41
+ const probe = run("tmux", argv, { env: ctx.env });
42
+ const current = probe.status === 0 ? probe.stdout.trim() : "";
43
+ return current === "" ? null : current;
44
+ }
45
+
46
+ /** Prefix for an in-tmux cycle whose session tmux could not name. */
47
+ const UNRESOLVED_PREFIX = "tmux-unknown:";
48
+
49
+ /**
50
+ * The identity a cycle records: `tmux:<session>` when tmux names the
51
+ * caller's session, `pid:<parent pid>` outside tmux, and
52
+ * `tmux-unknown:pid:<parent pid>` inside tmux when the probe fails. The last
53
+ * may be the manager itself on a transient probe failure, so `otherCyclers`
54
+ * never counts it as another session.
55
+ * @param {{ env: Record<string, string | undefined> }} ctx - CLI context
56
+ * @returns {string} Identity
57
+ */
58
+ function cyclerIdentity(ctx) {
59
+ const session = callerSessionName(ctx);
60
+ if (typeof session === "string") return `tmux:${session}`;
61
+ const pid = `pid:${process.ppid}`;
62
+ return session === null ? `${UNRESOLVED_PREFIX}${pid}` : pid;
63
+ }
64
+
65
+ /**
66
+ * How far back a cycle still counts as recent: twice the loop interval.
67
+ * @param {{ interval?: string }} config - sessionManager block
68
+ * @returns {number} Window in milliseconds
69
+ */
70
+ function windowMs(config) {
71
+ const seconds =
72
+ parseLoopInterval(config.interval) ?? DEFAULT_INTERVAL_SECONDS;
73
+ return 2 * seconds * 1000;
74
+ }
75
+
76
+ /**
77
+ * The entries of a cyclers map recorded within the window before `now`.
78
+ * An entry whose time does not parse is dropped.
79
+ * @param {Record<string, string> | undefined} cyclers - Identity to ISO time
80
+ * @param {number} nowMs - Now, in epoch milliseconds
81
+ * @param {number} window - Window in milliseconds
82
+ * @returns {[string, string][]} Recent `[identity, at]` pairs
83
+ */
84
+ function recentEntries(cyclers, nowMs, window) {
85
+ return Object.entries(cyclers ?? {}).filter(([, at]) => {
86
+ const atMs = Date.parse(at);
87
+ return Number.isFinite(atMs) && nowMs - atMs <= window;
88
+ });
89
+ }
90
+
91
+ /**
92
+ * Every recent cycler that is not the manager's own tmux session, newest
93
+ * first, for `status` `manager.otherCyclers`. An unresolved in-tmux cycle is
94
+ * left out: it may be the manager's own cycle on a failed probe.
95
+ * @param {{ cyclers?: Record<string, string> }} ledger - Ledger
96
+ * @param {{ name: string, interval?: string }} config - sessionManager block
97
+ * @param {Date} now - Current time
98
+ * @returns {{by: string, at: string}[]} Other recent cyclers
99
+ */
100
+ export function otherCyclers(ledger, config, now) {
101
+ const self = `tmux:${config.name}`;
102
+ return recentEntries(ledger.cyclers, now.getTime(), windowMs(config))
103
+ .filter(([by]) => by !== self && !by.startsWith(UNRESOLVED_PREFIX))
104
+ .map(([by, at]) => ({ by, at }))
105
+ .sort((a, b) => Date.parse(b.at) - Date.parse(a.at));
106
+ }
107
+
108
+ /**
109
+ * `cycle`: record that this session ran a cycle now, pruning entries older
110
+ * than twice the interval. The skill runs it at the start of every cycle.
111
+ * @param {object} ctx - CLI context
112
+ * @returns {Promise<{ json: {by: string, at: string} }>} What was recorded
113
+ */
114
+ export async function cycle(ctx) {
115
+ const config = requireConfig(ctx);
116
+ const by = cyclerIdentity(ctx);
117
+ const json = await updateLedger(ctx.root, { now: ctx.now }, (ledger, at) => {
118
+ const kept = recentEntries(
119
+ ledger.cyclers,
120
+ Date.parse(at),
121
+ windowMs(config)
122
+ );
123
+ const cyclers = { ...Object.fromEntries(kept), [by]: at };
124
+ return { ledger: { ...ledger, cyclers }, result: { by, at } };
125
+ });
126
+ return { json };
127
+ }
@@ -102,6 +102,9 @@ const FINISH_STATUSES = new Set(["DONE", "FAILED"]);
102
102
  * @property {Record<string, ValidationFailure>} validationFailures - Backlog
103
103
  * items that failed validation, keyed by ref, so an unchanged item is not
104
104
  * re-validated every cycle
105
+ * @property {Record<string, string>} cyclers - Who ran a cycle and when
106
+ * (identity to ISO time), pruned to twice the interval (#4809; see
107
+ * cyclers.mjs)
105
108
  */
106
109
 
107
110
  /**
@@ -149,6 +152,7 @@ function emptyLedger() {
149
152
  items: {},
150
153
  control: { paused: false, maxWorkers: null, me: null },
151
154
  validationFailures: {},
155
+ cyclers: {},
152
156
  };
153
157
  }
154
158
 
@@ -190,6 +194,7 @@ export async function readLedger(projectRoot, seams) {
190
194
  items: parsed.items ?? {},
191
195
  control: { ...empty.control, ...parsed.control },
192
196
  validationFailures: parsed.validationFailures ?? {},
197
+ cyclers: parsed.cyclers ?? {},
193
198
  };
194
199
  }
195
200
 
@@ -47,6 +47,7 @@ import {
47
47
  route,
48
48
  } from "./cli-cycle.mjs";
49
49
  import { answer, itemAnswer, markPlan } from "./cli-human.mjs";
50
+ import { cycle } from "./cyclers.mjs";
50
51
  import { overruledPlan } from "./cli-overruled.mjs";
51
52
  import { repoDir, start, status, stop, validate } from "./cli-manager.mjs";
52
53
  import { queue } from "./cli-queue.mjs";
@@ -71,6 +72,7 @@ const COMMANDS = {
71
72
  resume: { run: resume, options: {}, positionals: 1 },
72
73
  classify: { run: classify, options: {}, positionals: 1 },
73
74
  status: { run: status, options: {}, positionals: 0 },
75
+ cycle: { run: cycle, options: {}, positionals: 0 },
74
76
  start: { run: start, options: { "settle-ms": text }, positionals: 0 },
75
77
  stop: { run: stop, options: {}, positionals: 0 },
76
78
  "store-token": {
@@ -32,8 +32,8 @@
32
32
  "security:audit:lisa": "node scripts/lisa-audit.mjs"
33
33
  },
34
34
  "devDependencies": {
35
- "eslint-plugin-oxlint": "1.62.0",
36
- "oxlint": "1.62.0",
35
+ "eslint-plugin-oxlint": ">=1.62.0 <1.86.0",
36
+ "oxlint": ">=1.62.0 <1.86.0",
37
37
  "oxlint-tsgolint": "^0.24.0",
38
38
  "@stryker-mutator/core": "^9.0.0",
39
39
  "@stryker-mutator/vitest-runner": "^9.0.0",