@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.
- 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 +10 -8
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/package.json +4 -4
- 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-secrets-access/scripts/validate-config.mjs +1 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/SKILL.md +3 -2
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-orphans.mjs +17 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-usage.mjs +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/config.mjs +2 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/orphan-sweep.mjs +9 -2
- package/plugins/lisa/hooks/auto-update.mjs +128 -25
- package/plugins/lisa/rules/reference/config-resolution.md +2 -1
- package/plugins/lisa/skills/lisa-secrets-access/scripts/validate-config.mjs +1 -0
- package/plugins/lisa/skills/lisa-session-manager/SKILL.md +3 -2
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-orphans.mjs +17 -1
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-usage.mjs +1 -1
- package/plugins/lisa/skills/lisa-session-manager/scripts/config.mjs +2 -1
- package/plugins/lisa/skills/lisa-session-manager/scripts/orphan-sweep.mjs +9 -2
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/skills/lisa-secrets-access/scripts/validate-config.mjs +1 -0
- package/plugins/lisa-agy/skills/lisa-session-manager/SKILL.md +3 -2
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-orphans.mjs +17 -1
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-usage.mjs +1 -1
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/config.mjs +2 -1
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/orphan-sweep.mjs +9 -2
- 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/hooks/auto-update.mjs +128 -25
- package/plugins/lisa-copilot/rules/reference/config-resolution.md +2 -1
- package/plugins/lisa-copilot/skills/lisa-secrets-access/scripts/validate-config.mjs +1 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/SKILL.md +3 -2
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-orphans.mjs +17 -1
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-usage.mjs +1 -1
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/config.mjs +2 -1
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/orphan-sweep.mjs +9 -2
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/hooks/auto-update.mjs +128 -25
- package/plugins/lisa-cursor/rules/config-resolution-reference.mdc +2 -1
- package/plugins/lisa-cursor/skills/lisa-secrets-access/scripts/validate-config.mjs +1 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/SKILL.md +3 -2
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-orphans.mjs +17 -1
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-usage.mjs +1 -1
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/config.mjs +2 -1
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/orphan-sweep.mjs +9 -2
- package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/hooks/auto-update.mjs +128 -25
- package/plugins/lisa-devin/rules/reference/config-resolution.md +2 -1
- package/plugins/lisa-devin/skills/lisa-secrets-access/scripts/validate-config.mjs +1 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/SKILL.md +3 -2
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-orphans.mjs +17 -1
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-usage.mjs +1 -1
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/config.mjs +2 -1
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/orphan-sweep.mjs +9 -2
- 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-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/hooks/auto-update.mjs +128 -25
- package/plugins/src/base/rules/reference/config-resolution.md +2 -1
- package/plugins/src/base/skills/lisa-secrets-access/scripts/validate-config.mjs +1 -0
- package/plugins/src/base/skills/lisa-session-manager/SKILL.md +3 -2
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-orphans.mjs +17 -1
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-usage.mjs +1 -1
- package/plugins/src/base/skills/lisa-session-manager/scripts/config.mjs +2 -1
- 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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
730
|
-
|
|
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
|
-
|
|
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)
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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(() => {
|
|
@@ -699,7 +699,7 @@ have a `.lisa.config.json` and their own `.git` (written as `"root": "."`).
|
|
|
699
699
|
}
|
|
700
700
|
},
|
|
701
701
|
"capacity": { "maxWorkers": 6, "gbPerWorker": 3, "reserveGb": 8, "cpuFraction": 0.75, "maxLoadPerCore": 1.5 },
|
|
702
|
-
"stall": { "noOutputMinutes": 60, "maxAttempts": 3, "requestionHours": 4 },
|
|
702
|
+
"stall": { "noOutputMinutes": 60, "maxAttempts": 3, "requestionHours": 4, "orphanHours": 2 },
|
|
703
703
|
"notify": { "provider": "telegram", "stateDir": "~/.claude/channels/telegram-<project>" }
|
|
704
704
|
}
|
|
705
705
|
```
|
|
@@ -724,6 +724,7 @@ operator chooses Telegram (`init-config --notify telegram`).
|
|
|
724
724
|
| `sessionManager.stall.noOutputMinutes` | no | `60` | A live worker with no new output for this long counts as stalled (zero or positive). |
|
|
725
725
|
| `sessionManager.stall.maxAttempts` | no | `3` | Fresh sessions per item before it moves to the configured `blocked` role (a positive integer). |
|
|
726
726
|
| `sessionManager.stall.requestionHours` | no | `4` | How long an unanswered worker question waits before the manager asks again (zero or positive). |
|
|
727
|
+
| `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). |
|
|
727
728
|
| `sessionManager.notify.provider` | no | `none` | `none` (no notification channel) or `telegram`. Absent, like an absent `notify` block, means `none`. Any other value fails validation. |
|
|
728
729
|
| `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>`. |
|
|
729
730
|
| `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
|
|
516
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
/**
|
|
42
|
-
|
|
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"];
|