greprag 5.76.0 → 5.78.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.
@@ -548,6 +548,8 @@ async function fetchRecapInbox(anchor) {
548
548
  // ============================================================================
549
549
  const relayArmedBySession = new Set();
550
550
  const announcedBySession = new Set();
551
+ const personaAnnounceBySession = new Map();
552
+ const PERSONA_SESSION_CACHE_MAX = 100;
551
553
  const turnCountBySession = new Map();
552
554
  const procedurePromptKeyBySession = new Map();
553
555
  /** Cached recap body per projectId. opencode fires
@@ -596,6 +598,35 @@ async function fetchSkillActivation(apiKey, cwd) {
596
598
  return undefined;
597
599
  }
598
600
  }
601
+ async function fetchPersonaAnnounce(apiKey) {
602
+ try {
603
+ const response = await fetch(`${API_URL}/v1/persona`, {
604
+ headers: { Authorization: `Bearer ${apiKey}` },
605
+ });
606
+ if (!response.ok)
607
+ return null;
608
+ const data = await response.json();
609
+ return typeof data.announce === 'string' && data.announce.length > 0
610
+ ? data.announce
611
+ : null;
612
+ }
613
+ catch {
614
+ return null;
615
+ }
616
+ }
617
+ async function personaAnnounceForSession(sessionId, apiKey) {
618
+ if (personaAnnounceBySession.has(sessionId)) {
619
+ return personaAnnounceBySession.get(sessionId) ?? null;
620
+ }
621
+ const announce = await fetchPersonaAnnounce(apiKey);
622
+ if (personaAnnounceBySession.size >= PERSONA_SESSION_CACHE_MAX) {
623
+ const oldest = personaAnnounceBySession.keys().next().value;
624
+ if (oldest)
625
+ personaAnnounceBySession.delete(oldest);
626
+ }
627
+ personaAnnounceBySession.set(sessionId, announce);
628
+ return announce;
629
+ }
599
630
  // ============================================================================
600
631
  // Per-session relay spawner — "anytime opencode is opened and being used"
601
632
  // ============================================================================
@@ -1002,6 +1033,7 @@ const GrepRAGMemoryPlugin = async (ctx) => {
1002
1033
  if (sid8) {
1003
1034
  const turnCount = (turnCountBySession.get(sid8) ?? 0) + 1;
1004
1035
  turnCountBySession.set(sid8, turnCount);
1036
+ const firstAnnounce = !announcedBySession.has(sid8);
1005
1037
  // Build env — only populate what's available in the opencode context
1006
1038
  const env = (0, opencode_interrupt_1.buildOpenCodeEnv)({
1007
1039
  short: sid8,
@@ -1019,12 +1051,15 @@ const GrepRAGMemoryPlugin = async (ctx) => {
1019
1051
  return [];
1020
1052
  }
1021
1053
  })(),
1022
- mirroredSkills: !announcedBySession.has(sid8)
1054
+ mirroredSkills: firstAnnounce
1023
1055
  ? await fetchSkillActivation(apiKey, workingDir)
1024
1056
  : undefined,
1057
+ // output.system is fresh on EVERY transform call. Resolve Persona
1058
+ // once/session, then replay the cached shared-registry announce.
1059
+ personaAnnounce: await personaAnnounceForSession(sid8, apiKey),
1025
1060
  });
1026
1061
  // Announces: inject on first fire per session (static primers)
1027
- if (!announcedBySession.has(sid8)) {
1062
+ if (firstAnnounce) {
1028
1063
  announcedBySession.add(sid8);
1029
1064
  const announces = (0, opencode_interrupt_1.getOpenCodeAnnounces)(env);
1030
1065
  if (announces.length > 0) {
@@ -1034,6 +1069,14 @@ const GrepRAGMemoryPlugin = async (ctx) => {
1034
1069
  dlog(`interrupt: pushed ${announces.length} announce(s) for sid=${sid8}`);
1035
1070
  }
1036
1071
  }
1072
+ else {
1073
+ const persistent = (0, opencode_interrupt_1.getOpenCodePersistentAnnounces)(env);
1074
+ for (const line of persistent)
1075
+ pushSystemPrompt(output, line);
1076
+ if (persistent.length > 0) {
1077
+ dlog(`interrupt: replayed ${persistent.length} persistent announce(s) for sid=${sid8}`);
1078
+ }
1079
+ }
1037
1080
  // Reminders: inject every turn (dynamic nudges)
1038
1081
  const reminders = (0, opencode_interrupt_1.getOpenCodeReminders)(env);
1039
1082
  if (reminders.length > 0) {
@@ -44,6 +44,7 @@ const session_id_1 = require("./session-id");
44
44
  const reminder_registry_1 = require("./commands/reminder-registry");
45
45
  const friction_reminder_1 = require("./commands/friction-reminder");
46
46
  const equipped_loadouts_cache_1 = require("./equipped-loadouts-cache");
47
+ const app_settings_1 = require("./app-settings");
47
48
  async function fetchSessionUnread(apiUrl, apiKey, short) {
48
49
  try {
49
50
  const res = await fetch(`${apiUrl}/v1/inbox?count_only=1&session_id=${encodeURIComponent(short)}`, {
@@ -193,7 +194,7 @@ async function injectReminders(input, cfg, short, platform = 'claude-code') {
193
194
  promptText,
194
195
  equippedLoadouts,
195
196
  };
196
- const base = (0, reminder_registry_1.promptModules)().filter(m => !codex || m.id !== 'watcher-arm');
197
+ const base = (0, app_settings_1.filterEnabledInterrupts)((0, reminder_registry_1.promptModules)()).filter(m => !codex || m.id !== 'watcher-arm');
197
198
  const reg = mechanicKilled() ? base.filter(m => m.id !== 'mechanic-friction') : base;
198
199
  const fired = (0, reminder_registry_1.collectReminders)(env, reg);
199
200
  if (!fired.length)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "greprag",
3
- "version": "5.76.0",
3
+ "version": "5.78.0",
4
4
  "description": "GrepRAG — agent memory for Claude Code, Codex, OpenCode, and Grok Build.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -16,6 +16,7 @@
16
16
  "files": [
17
17
  "dist/**/*.js",
18
18
  "dist/**/*.json",
19
+ "app",
19
20
  "skill",
20
21
  "scripts"
21
22
  ],
@@ -95,8 +95,9 @@ if (changes.length > 0) {
95
95
  const verb = installed.length > 0 ? 'Synced' : 'Refreshed';
96
96
  console.log('\n greprag installed. ' + verb + ': ' + changes.join(', ') + '\n');
97
97
  } else {
98
- console.log('\n greprag installed. Run `greprag init` to connect Claude Code, Codex, or OpenCode memory.\n');
98
+ console.log('\n greprag installed.\n');
99
99
  }
100
+ console.log(' Run `greprag` to open the local app.\n');
100
101
 
101
102
  if (detected.includes('Codex')) {
102
103
  console.log(' Detected Codex. Next:');