@damian87/omp 0.12.0 → 0.14.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/.github/skills/schedule/SKILL.md +27 -2
- package/.github/skills/verify-byok/SKILL.md +50 -0
- package/README.md +88 -4
- package/catalog/capabilities.json +23 -0
- package/catalog/skills-general.json +25 -0
- package/dist/src/cli.js +158 -5
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/comms.d.ts +2 -0
- package/dist/src/commands/comms.js +110 -0
- package/dist/src/commands/comms.js.map +1 -0
- package/dist/src/commands/council.d.ts +2 -0
- package/dist/src/commands/council.js +77 -0
- package/dist/src/commands/council.js.map +1 -0
- package/dist/src/commands/env.d.ts +2 -0
- package/dist/src/commands/env.js +95 -0
- package/dist/src/commands/env.js.map +1 -0
- package/dist/src/commands/gateway.d.ts +3 -0
- package/dist/src/commands/gateway.js +129 -0
- package/dist/src/commands/gateway.js.map +1 -0
- package/dist/src/commands/memory.d.ts +7 -0
- package/dist/src/commands/memory.js +202 -0
- package/dist/src/commands/memory.js.map +1 -0
- package/dist/src/commands/mode.d.ts +4 -0
- package/dist/src/commands/mode.js +119 -0
- package/dist/src/commands/mode.js.map +1 -0
- package/dist/src/commands/schedule.d.ts +2 -0
- package/dist/src/commands/schedule.js +91 -0
- package/dist/src/commands/schedule.js.map +1 -0
- package/dist/src/commands/team.d.ts +2 -0
- package/dist/src/commands/team.js +146 -0
- package/dist/src/commands/team.js.map +1 -0
- package/dist/src/commands/utils.d.ts +13 -0
- package/dist/src/commands/utils.js +68 -0
- package/dist/src/commands/utils.js.map +1 -0
- package/dist/src/gateway/desktop-notify.d.ts +56 -0
- package/dist/src/gateway/desktop-notify.js +183 -0
- package/dist/src/gateway/desktop-notify.js.map +1 -0
- package/dist/src/goal.js +6 -8
- package/dist/src/goal.js.map +1 -1
- package/dist/src/instructions-memory.js +26 -3
- package/dist/src/instructions-memory.js.map +1 -1
- package/dist/src/memory-review/apply.d.ts +7 -0
- package/dist/src/memory-review/apply.js +75 -0
- package/dist/src/memory-review/apply.js.map +1 -0
- package/dist/src/memory-review/config.d.ts +22 -0
- package/dist/src/memory-review/config.js +54 -0
- package/dist/src/memory-review/config.js.map +1 -0
- package/dist/src/memory-review/guard.d.ts +5 -0
- package/dist/src/memory-review/guard.js +37 -0
- package/dist/src/memory-review/guard.js.map +1 -0
- package/dist/src/memory-review/index.d.ts +17 -0
- package/dist/src/memory-review/index.js +87 -0
- package/dist/src/memory-review/index.js.map +1 -0
- package/dist/src/memory-review/prompt.d.ts +18 -0
- package/dist/src/memory-review/prompt.js +89 -0
- package/dist/src/memory-review/prompt.js.map +1 -0
- package/dist/src/memory-review/spawn.d.ts +2 -0
- package/dist/src/memory-review/spawn.js +51 -0
- package/dist/src/memory-review/spawn.js.map +1 -0
- package/dist/src/memory-review/transcript.d.ts +24 -0
- package/dist/src/memory-review/transcript.js +212 -0
- package/dist/src/memory-review/transcript.js.map +1 -0
- package/dist/src/memory-review/trigger.d.ts +21 -0
- package/dist/src/memory-review/trigger.js +27 -0
- package/dist/src/memory-review/trigger.js.map +1 -0
- package/dist/src/project-memory.d.ts +9 -0
- package/dist/src/project-memory.js +72 -1
- package/dist/src/project-memory.js.map +1 -1
- package/dist/src/schedule/commands.d.ts +13 -0
- package/dist/src/schedule/commands.js +24 -1
- package/dist/src/schedule/commands.js.map +1 -1
- package/dist/src/schedule/deep-link.d.ts +18 -0
- package/dist/src/schedule/deep-link.js +41 -0
- package/dist/src/schedule/deep-link.js.map +1 -0
- package/dist/src/schedule/runner.d.ts +10 -0
- package/dist/src/schedule/runner.js +36 -0
- package/dist/src/schedule/runner.js.map +1 -1
- package/dist/src/schedule/types.d.ts +16 -0
- package/dist/src/state.js +25 -37
- package/dist/src/state.js.map +1 -1
- package/dist/src/utils/fs.d.ts +14 -0
- package/dist/src/utils/fs.js +32 -0
- package/dist/src/utils/fs.js.map +1 -0
- package/dist/src/utils/paths.d.ts +14 -0
- package/dist/src/utils/paths.js +21 -0
- package/dist/src/utils/paths.js.map +1 -0
- package/docs/memory-mode.md +94 -0
- package/docs/research/2026-06-22-schedule-desktop-notifications.md +193 -0
- package/package.json +4 -2
- package/plugin.json +1 -1
- package/scripts/lib/memory-review-trigger.mjs +59 -0
- package/scripts/lib/pending-directives.mjs +36 -0
- package/scripts/session-end.mjs +8 -0
- package/scripts/session-start.mjs +4 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { spawn as nodeSpawn } from "node:child_process";
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { ompRoot } from "./omp-root.mjs";
|
|
6
|
+
|
|
7
|
+
// sessionEnd hook → end-of-session memory review. The hook must return fast
|
|
8
|
+
// (5s timeout), so this only DETACHES `omp memory-review` and returns. The
|
|
9
|
+
// downstream claim guard de-dupes against the wrapper fallback. Fail-open:
|
|
10
|
+
// any error means "don't trigger", never throw into the hook.
|
|
11
|
+
|
|
12
|
+
function readMemoryMode(cwd) {
|
|
13
|
+
const env = process.env.OMP_MEMORY_MODE;
|
|
14
|
+
if (env === "on") return "on";
|
|
15
|
+
if (env === "off") return "off";
|
|
16
|
+
try {
|
|
17
|
+
const p = join(ompRoot(cwd), ".omp", "config.json");
|
|
18
|
+
if (!existsSync(p)) return "off";
|
|
19
|
+
const raw = JSON.parse(readFileSync(p, "utf8"));
|
|
20
|
+
return raw && raw.memoryMode === "on" ? "on" : "off";
|
|
21
|
+
} catch {
|
|
22
|
+
return "off";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function defaultDistPath() {
|
|
27
|
+
// scripts/lib/ -> packageRoot/dist/src/cli.js (present in the npm package and
|
|
28
|
+
// dev builds, but NOT in a plugin installed from GitHub — dist is gitignored).
|
|
29
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
30
|
+
return join(here, "..", "..", "dist", "src", "cli.js");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Decide how to invoke the omp CLI. An explicit cliPath (tests/dev) or a
|
|
34
|
+
* bundled dist runs via `node <path>`; otherwise — the normal install, where
|
|
35
|
+
* the plugin (from GitHub) has no dist but `omp` is installed globally via npm —
|
|
36
|
+
* invoke `omp` from PATH. Exported for testing. */
|
|
37
|
+
export function resolveMemoryReviewInvocation({ sessionId, cwd, cliPath, distPath = defaultDistPath(), exists = existsSync } = {}) {
|
|
38
|
+
const args = ["memory-review", "--session", sessionId, "--root", cwd];
|
|
39
|
+
if (cliPath) return { command: process.execPath, args: [cliPath, ...args] };
|
|
40
|
+
if (exists(distPath)) return { command: process.execPath, args: [distPath, ...args] };
|
|
41
|
+
return { command: "omp", args }; // plugin-from-GitHub: rely on the global omp CLI
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function triggerMemoryReview(options = {}) {
|
|
45
|
+
const { cwd, sessionId, spawn = nodeSpawn, cliPath, mode } = options;
|
|
46
|
+
const resolvedMode = mode ?? readMemoryMode(cwd);
|
|
47
|
+
if (resolvedMode !== "on") return { triggered: false, reason: "memory-mode off" };
|
|
48
|
+
if (!sessionId || sessionId === "unknown") return { triggered: false, reason: "no session id" };
|
|
49
|
+
try {
|
|
50
|
+
const { command, args } = resolveMemoryReviewInvocation({ sessionId, cwd, cliPath });
|
|
51
|
+
const child = spawn(command, args, { detached: true, stdio: "ignore" });
|
|
52
|
+
// Handle async spawn errors so they never surface as unhandled (fail-open).
|
|
53
|
+
if (child && typeof child.on === "function") child.on("error", () => {});
|
|
54
|
+
if (child && typeof child.unref === "function") child.unref();
|
|
55
|
+
return { triggered: true };
|
|
56
|
+
} catch (err) {
|
|
57
|
+
return { triggered: false, reason: String(err?.message ?? err) };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { ompRoot } from "./omp-root.mjs";
|
|
4
|
+
|
|
5
|
+
// Memory-review writes proposed directives to a GATED pending queue (never
|
|
6
|
+
// auto-applied). Without a nudge that queue is invisible and rots, so the
|
|
7
|
+
// sessionStart hook surfaces a count + how to promote. Promotion stays manual:
|
|
8
|
+
// `omp project-memory add-directive "<rule>"` then remove the line.
|
|
9
|
+
|
|
10
|
+
function pendingPath(cwd) {
|
|
11
|
+
return join(ompRoot(cwd), ".oh-my-copilot", "memory-review", "pending-directives.md");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Count unchecked ("- [ ]") items in the pending-directives queue. */
|
|
15
|
+
export function countPendingDirectives(cwd) {
|
|
16
|
+
const p = pendingPath(cwd);
|
|
17
|
+
if (!existsSync(p)) return 0;
|
|
18
|
+
try {
|
|
19
|
+
return readFileSync(p, "utf8")
|
|
20
|
+
.split("\n")
|
|
21
|
+
.filter((line) => /^\s*-\s*\[\s*\]\s+\S/.test(line)).length;
|
|
22
|
+
} catch {
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** SessionStart nudge string, or "" when nothing is pending. */
|
|
28
|
+
export function pendingDirectivesNudge(cwd) {
|
|
29
|
+
const n = countPendingDirectives(cwd);
|
|
30
|
+
if (n === 0) return "";
|
|
31
|
+
return (
|
|
32
|
+
`[MEMORY REVIEW] ${n} proposed directive${n === 1 ? "" : "s"} await your review in ` +
|
|
33
|
+
`.oh-my-copilot/memory-review/pending-directives.md — promote the ones you want with ` +
|
|
34
|
+
"`omp project-memory add-directive \"<rule>\"`, then delete the line."
|
|
35
|
+
);
|
|
36
|
+
}
|
package/scripts/session-end.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import { endSession } from "./lib/daily-log.mjs";
|
|
|
6
6
|
import { ompRoot } from "./lib/omp-root.mjs";
|
|
7
7
|
import { failOpen } from "./lib/hook-output.mjs";
|
|
8
8
|
import { parseHookInput } from "./lib/hook-input.mjs";
|
|
9
|
+
import { triggerMemoryReview } from "./lib/memory-review-trigger.mjs";
|
|
9
10
|
|
|
10
11
|
const HOOK_NAME = "SessionEnd";
|
|
11
12
|
|
|
@@ -28,6 +29,13 @@ const HOOK_NAME = "SessionEnd";
|
|
|
28
29
|
// Arm a daily-log nudge for the next session if this one did work but
|
|
29
30
|
// logged nothing. endSession never throws.
|
|
30
31
|
endSession(directory);
|
|
32
|
+
// Memory mode (opt-in): detach the cheap-model end-of-session review.
|
|
33
|
+
// Best-effort and non-blocking — never delays the hook return.
|
|
34
|
+
try {
|
|
35
|
+
triggerMemoryReview({ cwd: directory, sessionId });
|
|
36
|
+
} catch {
|
|
37
|
+
// never block session end on the review trigger
|
|
38
|
+
}
|
|
31
39
|
failOpen();
|
|
32
40
|
} catch (err) {
|
|
33
41
|
console.error(`[hook ${HOOK_NAME}] failed: ${err?.message ?? err}`);
|
|
@@ -7,6 +7,7 @@ import { checkForUpdate, formatUpdateNotice } from "./lib/version-check.mjs";
|
|
|
7
7
|
import { scanScheduleResults } from "./lib/schedule-results.mjs";
|
|
8
8
|
import { readRepoGoal, readTodayGoal, recentEntryStats, startSession } from "./lib/daily-log.mjs";
|
|
9
9
|
import { readDirectives } from "./lib/project-memory.mjs";
|
|
10
|
+
import { pendingDirectivesNudge } from "./lib/pending-directives.mjs";
|
|
10
11
|
import { ompRoot } from "./lib/omp-root.mjs";
|
|
11
12
|
import { parseHookInput } from "./lib/hook-input.mjs";
|
|
12
13
|
|
|
@@ -78,6 +79,9 @@ function buildDailyLogBreadcrumb(directory) {
|
|
|
78
79
|
}
|
|
79
80
|
const repoGoal = readRepoGoal(directory);
|
|
80
81
|
if (repoGoal) parts.push(`[REPO GOAL] ${repoGoal}`);
|
|
82
|
+
// Memory-review's gated directive queue is invisible without a nudge.
|
|
83
|
+
const pendingNudge = pendingDirectivesNudge(directory);
|
|
84
|
+
if (pendingNudge) parts.push(pendingNudge);
|
|
81
85
|
const breadcrumb = buildDailyLogBreadcrumb(directory);
|
|
82
86
|
if (breadcrumb) parts.push(breadcrumb);
|
|
83
87
|
// Resets the per-session baseline and flushes a nudge when the prior session
|