@codyswann/lisa 4.106.3 → 4.107.1
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.
- package/cdk/package-lisa/package.lisa.json +2 -2
- package/dist/configs/eslint/base.d.ts +2 -0
- package/dist/configs/eslint/base.d.ts.map +1 -1
- package/dist/configs/eslint/base.js +8 -0
- package/dist/configs/eslint/base.js.map +1 -1
- package/dist/configs/eslint/expo.d.ts +6 -0
- package/dist/configs/eslint/expo.d.ts.map +1 -1
- package/dist/configs/eslint/expo.js +23 -0
- package/dist/configs/eslint/expo.js.map +1 -1
- package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +35 -55
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/expo/package-lisa/package.lisa.json +2 -2
- package/harper-fabric/package-lisa/package.lisa.json +2 -2
- package/nestjs/package-lisa/package.lisa.json +2 -2
- package/package.json +6 -11
- package/phaser/package-lisa/package.lisa.json +2 -2
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/SKILL.md +21 -12
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-status.mjs +10 -9
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-usage.mjs +21 -10
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cyclers.mjs +127 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/ledger.mjs +5 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/session-manager.mjs +2 -0
- package/plugins/lisa/skills/lisa-session-manager/SKILL.md +21 -12
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-status.mjs +10 -9
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-usage.mjs +21 -10
- package/plugins/lisa/skills/lisa-session-manager/scripts/cyclers.mjs +127 -0
- package/plugins/lisa/skills/lisa-session-manager/scripts/ledger.mjs +5 -0
- package/plugins/lisa/skills/lisa-session-manager/scripts/session-manager.mjs +2 -0
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/skills/lisa-session-manager/SKILL.md +21 -12
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-status.mjs +10 -9
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-usage.mjs +21 -10
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cyclers.mjs +127 -0
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/ledger.mjs +5 -0
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/session-manager.mjs +2 -0
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/skills/lisa-session-manager/SKILL.md +21 -12
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-status.mjs +10 -9
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-usage.mjs +21 -10
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cyclers.mjs +127 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/ledger.mjs +5 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/session-manager.mjs +2 -0
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/skills/lisa-session-manager/SKILL.md +21 -12
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-status.mjs +10 -9
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-usage.mjs +21 -10
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cyclers.mjs +127 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/ledger.mjs +5 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/session-manager.mjs +2 -0
- package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/skills/lisa-session-manager/SKILL.md +21 -12
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-status.mjs +10 -9
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-usage.mjs +21 -10
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cyclers.mjs +127 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/ledger.mjs +5 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/session-manager.mjs +2 -0
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-agy/plugin.json +1 -1
- package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/src/base/skills/lisa-session-manager/SKILL.md +21 -12
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-status.mjs +10 -9
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-usage.mjs +21 -10
- package/plugins/src/base/skills/lisa-session-manager/scripts/cyclers.mjs +127 -0
- package/plugins/src/base/skills/lisa-session-manager/scripts/ledger.mjs +5 -0
- package/plugins/src/base/skills/lisa-session-manager/scripts/session-manager.mjs +2 -0
- package/typescript/package-lisa/package.lisa.json +2 -2
- package/ui/README.md +3 -8
- package/scripts/check-ui-demo-data.mjs +0 -102
|
@@ -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.**
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
`
|
|
373
|
-
|
|
374
|
-
|
|
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 {
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
|
61
|
-
worker,sessionId,repo,status,attempts,
|
|
62
|
-
[wk-names],pendingQuestions:[{ref,
|
|
63
|
-
answerQueued,answerCommand}]}. manager.self
|
|
64
|
-
runs inside the manager's tmux session (any
|
|
65
|
-
outside tmux or in another session, null when
|
|
66
|
-
session the caller is in or $TMUX_PANE is not
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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",
|
package/ui/README.md
CHANGED
|
@@ -51,14 +51,9 @@ Every renderer-bearing catalog value must declare exactly one provenance:
|
|
|
51
51
|
- `demoOnly: true` for intentional direct-file sample data; or
|
|
52
52
|
- `staticCopy` with a narrow reason for fixed Lisa documentation or semantics.
|
|
53
53
|
|
|
54
|
-
The
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
inspects nothing. Run it after adding or changing console data:
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
bun run check:ui-demo-data
|
|
61
|
-
```
|
|
54
|
+
The repository guard for this boundary (`check:ui-demo-data`) and its browser
|
|
55
|
+
suite were removed with the console (CodySwannGT/lisa#4804); this page goes with
|
|
56
|
+
the rest of `ui/` in the same change.
|
|
62
57
|
|
|
63
58
|
`acme/acme-app` is not a forbidden string: a live project can legitimately use
|
|
64
59
|
that name. The boundary is provenance, not a sentinel grep.
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Evaluate the Lisa UI catalog in a code-generation-disabled VM and invoke the
|
|
5
|
-
* catalog's own renderer-aware audit. Keeping the audit in `ui/index.html`
|
|
6
|
-
* means the browser and repository guard cannot drift into different ideas of
|
|
7
|
-
* which values are renderable.
|
|
8
|
-
* @module scripts/check-ui-demo-data
|
|
9
|
-
*/
|
|
10
|
-
import { readFileSync } from "node:fs";
|
|
11
|
-
import path from "node:path";
|
|
12
|
-
import vm from "node:vm";
|
|
13
|
-
|
|
14
|
-
import { invokedAsScript } from "./lib/invoked-as-script.mjs";
|
|
15
|
-
|
|
16
|
-
const START_MARKER = "/* LISA_UI_CATALOG_START */";
|
|
17
|
-
const END_MARKER = "/* LISA_UI_CATALOG_END */";
|
|
18
|
-
const DEFAULT_UI_FILE = path.resolve("ui/index.html");
|
|
19
|
-
const VM_TIMEOUT_MS = 2_000;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Extract exactly one bounded catalog program from the HTML document.
|
|
23
|
-
* @param {string} html - Complete UI HTML
|
|
24
|
-
* @returns {string} Catalog JavaScript including the shared audit seam
|
|
25
|
-
*/
|
|
26
|
-
export function extractUiCatalogProgram(html) {
|
|
27
|
-
const start = html.indexOf(START_MARKER);
|
|
28
|
-
const end = html.indexOf(END_MARKER);
|
|
29
|
-
if (start === -1 || end === -1 || end <= start) {
|
|
30
|
-
throw new Error(
|
|
31
|
-
`UI catalog markers are missing or out of order (${START_MARKER}, ${END_MARKER})`
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
if (
|
|
35
|
-
html.indexOf(START_MARKER, start + START_MARKER.length) !== -1 ||
|
|
36
|
-
html.indexOf(END_MARKER, end + END_MARKER.length) !== -1
|
|
37
|
-
) {
|
|
38
|
-
throw new Error("UI catalog markers must each occur exactly once");
|
|
39
|
-
}
|
|
40
|
-
return html.slice(start + START_MARKER.length, end);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Audit an HTML catalog and optionally exercise the live preparation path.
|
|
45
|
-
* @param {string} html - Complete UI HTML
|
|
46
|
-
* @param {{liveConfigPresent?: boolean, liveConfig?: unknown, filename?: string}} [options]
|
|
47
|
-
* @returns {{audit: {inspected: number, sections: number, violations: string[]}, preparation: object|null, catalog: object}}
|
|
48
|
-
*/
|
|
49
|
-
export function inspectUiDemoData(html, options = {}) {
|
|
50
|
-
const context = vm.createContext(
|
|
51
|
-
{
|
|
52
|
-
__liveConfigPresent: options.liveConfigPresent === true,
|
|
53
|
-
__liveConfig: options.liveConfig,
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
codeGeneration: { strings: false, wasm: false },
|
|
57
|
-
name: "lisa-ui-demo-data-audit",
|
|
58
|
-
}
|
|
59
|
-
);
|
|
60
|
-
const program = `${extractUiCatalogProgram(html)}
|
|
61
|
-
const __auditResult = auditUiCatalog(DATA);
|
|
62
|
-
const __preparationResult = globalThis.__liveConfigPresent
|
|
63
|
-
? prepareUiCatalogForLive(DATA, globalThis.__liveConfig)
|
|
64
|
-
: null;
|
|
65
|
-
globalThis.__inspectionResult = {
|
|
66
|
-
audit: __auditResult,
|
|
67
|
-
preparation: __preparationResult,
|
|
68
|
-
catalog: DATA
|
|
69
|
-
};
|
|
70
|
-
`;
|
|
71
|
-
// The bounded catalog source is intentionally executed in a context with
|
|
72
|
-
// string/wasm code generation disabled and a hard timeout. This is the
|
|
73
|
-
// guard's shared-seam contract, not application input.
|
|
74
|
-
// eslint-disable-next-line sonarjs/code-eval -- Evaluate only the extracted catalog inside the locked VM above.
|
|
75
|
-
vm.runInContext(program, context, {
|
|
76
|
-
displayErrors: true,
|
|
77
|
-
filename: options.filename || "ui/index.html#catalog",
|
|
78
|
-
timeout: VM_TIMEOUT_MS,
|
|
79
|
-
});
|
|
80
|
-
return context.__inspectionResult;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/** Run the repository guard against a supplied file or the real UI. */
|
|
84
|
-
function main() {
|
|
85
|
-
const file = path.resolve(process.argv[2] || DEFAULT_UI_FILE);
|
|
86
|
-
try {
|
|
87
|
-
const inspection = inspectUiDemoData(readFileSync(file, "utf8"), {
|
|
88
|
-
filename: file,
|
|
89
|
-
});
|
|
90
|
-
process.stdout.write(
|
|
91
|
-
`[ui-demo-data] PASS: inspected ${inspection.audit.inspected} rendered values across ${inspection.audit.sections} sections\n`
|
|
92
|
-
);
|
|
93
|
-
} catch (error) {
|
|
94
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
95
|
-
process.stderr.write(`[ui-demo-data] FAIL: ${message}\n`);
|
|
96
|
-
process.exitCode = 1;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (invokedAsScript(import.meta.url)) {
|
|
101
|
-
main();
|
|
102
|
-
}
|