@codyswann/lisa 3.30.0 → 3.31.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 (78) hide show
  1. package/all/copy-overwrite/scripts/lisa-hooks/block-direct-issue-create.sh +66 -5
  2. package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
  3. package/dist/core/lisa-owned-hash-ledger.js +2 -0
  4. package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
  5. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  6. package/dist/core/upstream-evidence-manifest.js +11 -4
  7. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  8. package/package.json +1 -1
  9. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  10. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  11. package/plugins/lisa/hooks/block-direct-issue-create.sh +66 -5
  12. package/plugins/lisa/scripts/automation-status-claude-adapter.mjs +56 -6
  13. package/plugins/lisa/scripts/automation-status-codex-adapter.mjs +54 -4
  14. package/plugins/lisa/scripts/automation-status-unrecorded-runs.mjs +127 -0
  15. package/plugins/lisa-agy/hooks/block-direct-issue-create.sh +66 -5
  16. package/plugins/lisa-agy/plugin.json +1 -1
  17. package/plugins/lisa-agy/scripts/automation-status-claude-adapter.mjs +56 -6
  18. package/plugins/lisa-agy/scripts/automation-status-codex-adapter.mjs +54 -4
  19. package/plugins/lisa-agy/scripts/automation-status-unrecorded-runs.mjs +127 -0
  20. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  21. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  22. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  23. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  24. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  25. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  26. package/plugins/lisa-copilot/hooks/block-direct-issue-create.sh +66 -5
  27. package/plugins/lisa-copilot/scripts/automation-status-claude-adapter.mjs +56 -6
  28. package/plugins/lisa-copilot/scripts/automation-status-codex-adapter.mjs +54 -4
  29. package/plugins/lisa-copilot/scripts/automation-status-unrecorded-runs.mjs +127 -0
  30. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  31. package/plugins/lisa-cursor/hooks/block-direct-issue-create.sh +66 -5
  32. package/plugins/lisa-cursor/scripts/automation-status-claude-adapter.mjs +56 -6
  33. package/plugins/lisa-cursor/scripts/automation-status-codex-adapter.mjs +54 -4
  34. package/plugins/lisa-cursor/scripts/automation-status-unrecorded-runs.mjs +127 -0
  35. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  36. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  37. package/plugins/lisa-expo-agy/plugin.json +1 -1
  38. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  39. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  40. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  41. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  42. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  43. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  44. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  45. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  46. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  47. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  48. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  49. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  50. package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
  51. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  52. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  53. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  54. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  55. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  56. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  57. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  58. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  59. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  60. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  61. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  62. package/plugins/lisa-rails-agy/plugin.json +1 -1
  63. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  64. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  65. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  66. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  67. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  68. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  69. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  70. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  71. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  72. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  73. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  74. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  75. package/plugins/src/base/hooks/block-direct-issue-create.sh +66 -5
  76. package/plugins/src/base/scripts/automation-status-claude-adapter.mjs +56 -6
  77. package/plugins/src/base/scripts/automation-status-codex-adapter.mjs +54 -4
  78. package/plugins/src/base/scripts/automation-status-unrecorded-runs.mjs +127 -0
@@ -0,0 +1,127 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Detect registered-loop cycles that ran and recorded nothing.
4
+ *
5
+ * The Automation Runbook Contract requires every run of a registered loop to
6
+ * end in exactly one of six recorded outcomes, but the recorder is invoked only
7
+ * by prose instruction inside each loop's `SKILL.md`. A cycle that finishes
8
+ * without running it appends no row, and an absent row is ambiguous in the one
9
+ * way that matters: it looks identical to a cycle that never ran.
10
+ *
11
+ * That ambiguity is not merely an audit gap. Cycles read the ledger tail to
12
+ * decide whether the lane was already worked, so a missing row feeds back into
13
+ * selection — the next cycle sees stale activity, concludes the lane is
14
+ * unworked, and re-picks the rung a peer is already holding.
15
+ *
16
+ * This module resolves the ambiguity with a signal the loop does not control:
17
+ * the scheduler's own last-run time. A row written by a cycle necessarily
18
+ * postdates that cycle's start, so a newest row older than the last scheduler
19
+ * run means the run in between recorded nothing. Neither side can fake it —
20
+ * the scheduler timestamp is written by the runtime, and the ledger timestamp
21
+ * by the recorder.
22
+ *
23
+ * Reporting only, never blocking, per the contract's own escape: "If recording
24
+ * still fails, degrade, never abort." Every unreadable input degrades to `null`
25
+ * rather than to a finding, because a detector that guesses would poison the
26
+ * same selection loop it exists to protect.
27
+ */
28
+
29
+ /**
30
+ * @typedef {{
31
+ * readonly missedCycles: number
32
+ * readonly schedulerLastRunAt: string
33
+ * readonly ledgerLastRecordAt: string | null
34
+ * readonly summary: string
35
+ * readonly remediation: string
36
+ * }} UnrecordedRunFinding
37
+ */
38
+
39
+ /**
40
+ * Remediation text shared by both finding shapes.
41
+ *
42
+ * It names the contract rather than the script because the omission is a
43
+ * skipped step in the loop, not a broken recorder — a broken recorder reports
44
+ * itself through the degradation path this module deliberately leaves alone.
45
+ */
46
+ const UNRECORDED_RUN_REMEDIATION =
47
+ "The loop ran without recording an outcome. Confirm the loop's SKILL.md " +
48
+ "still ends every path by invoking `automation-run-record.mjs`, including " +
49
+ "the paths that find no work, per the automation-runbook-contract rule.";
50
+
51
+ /**
52
+ * Whether a scheduled run finished without appending a run record.
53
+ *
54
+ * Tolerance is one full cadence, not a fixed grace period. The scheduler's
55
+ * `lastRunAt` may be stamped at either end of a cycle depending on runtime, and
56
+ * a cycle can legitimately run for many minutes, so anything tighter would
57
+ * report a slow-but-honest loop as a silent one. A full cadence cannot be
58
+ * crossed by a single well-behaved run: it means an entire scheduled cycle came
59
+ * and went between the newest row and the newest run.
60
+ *
61
+ * @param {{
62
+ * readonly schedulerLastRunAt?: string | null
63
+ * readonly ledgerLastRecordAt?: string | null
64
+ * readonly hasRunbook?: boolean
65
+ * readonly cadenceMs?: number | null
66
+ * }} input - Scheduler-side run time, ledger-side newest record, and cadence.
67
+ * @returns {UnrecordedRunFinding | null} The finding, or `null` when the
68
+ * comparison cannot be made from trustworthy inputs.
69
+ */
70
+ export function resolveUnrecordedRunFinding(input) {
71
+ const cadenceMs = input.cadenceMs;
72
+ if (!cadenceMs || !Number.isFinite(cadenceMs) || cadenceMs <= 0) {
73
+ return null;
74
+ }
75
+
76
+ // No scheduler timestamp means the runtime never reported a run, which is
77
+ // indistinguishable from a loop registered moments ago. Silence here is the
78
+ // honest answer, and `classifyAutomationRunSignal` already reports the
79
+ // missing metadata separately.
80
+ if (!input.schedulerLastRunAt) {
81
+ return null;
82
+ }
83
+ const schedulerLastRun = Date.parse(input.schedulerLastRunAt);
84
+ if (Number.isNaN(schedulerLastRun)) {
85
+ return null;
86
+ }
87
+
88
+ // A loop with no runbook is not yet under the contract; `automation-status`
89
+ // reports the un-scaffolded runbook itself, and stacking a second finding on
90
+ // it would blame the loop for a setup step it never took.
91
+ if (input.hasRunbook === false) {
92
+ return null;
93
+ }
94
+
95
+ if (!input.ledgerLastRecordAt) {
96
+ return {
97
+ missedCycles: 1,
98
+ schedulerLastRunAt: input.schedulerLastRunAt,
99
+ ledgerLastRecordAt: null,
100
+ summary: `scheduler reports a run at ${input.schedulerLastRunAt} but the ledger holds no record at all`,
101
+ remediation: UNRECORDED_RUN_REMEDIATION,
102
+ };
103
+ }
104
+
105
+ const ledgerLastRecord = Date.parse(input.ledgerLastRecordAt);
106
+ if (Number.isNaN(ledgerLastRecord)) {
107
+ return null;
108
+ }
109
+
110
+ const gapMs = schedulerLastRun - ledgerLastRecord;
111
+ if (gapMs <= cadenceMs) {
112
+ return null;
113
+ }
114
+
115
+ const missedCycles = Math.floor(gapMs / cadenceMs);
116
+ return {
117
+ missedCycles,
118
+ schedulerLastRunAt: input.schedulerLastRunAt,
119
+ ledgerLastRecordAt: input.ledgerLastRecordAt,
120
+ summary: `${missedCycles} scheduled ${
121
+ missedCycles === 1 ? "run" : "runs"
122
+ } recorded no outcome (newest record ${input.ledgerLastRecordAt}, last run ${input.schedulerLastRunAt})`,
123
+ remediation: UNRECORDED_RUN_REMEDIATION,
124
+ };
125
+ }
126
+
127
+ export { UNRECORDED_RUN_REMEDIATION };