@cortexkit/opencode-magic-context 0.7.0 → 0.7.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/scheduler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAK3C,MAAM,WAAW,mBAAmB;IAChC,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,iEAAiE;AACjE,wBAAgB,mBAAmB,CAC/B,QAAQ,EAAE,MAAM,GACjB;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAkBrD;AAED,6GAA6G;AAC7G,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,GAAE,IAAiB,GAAG,OAAO,CAYpF;AAED,6GAA6G;AAC7G,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,EAAE,CA0C/D;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAwB9E"}
1
+ {"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/scheduler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAK3C,MAAM,WAAW,mBAAmB;IAChC,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,iEAAiE;AACjE,wBAAgB,mBAAmB,CAC/B,QAAQ,EAAE,MAAM,GACjB;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAkBrD;AAaD,6GAA6G;AAC7G,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,GAAE,IAAiB,GAAG,OAAO,CAYpF;AAED,6GAA6G;AAC7G,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,EAAE,CAkD/D;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAwB9E"}
package/dist/index.js CHANGED
@@ -25220,6 +25220,10 @@ function parseScheduleWindow(schedule) {
25220
25220
  const endMinutes = endHour * 60 + endMin;
25221
25221
  return { startMinutes, endMinutes };
25222
25222
  }
25223
+ function isDreamFromCurrentWindow(lastDreamAtMs, now) {
25224
+ const twelveHoursMs = 12 * 60 * 60 * 1000;
25225
+ return now.getTime() - lastDreamAtMs < twelveHoursMs;
25226
+ }
25223
25227
  function isInScheduleWindow(schedule, now = new Date) {
25224
25228
  const window = parseScheduleWindow(schedule);
25225
25229
  if (!window)
@@ -25237,10 +25241,14 @@ function findProjectsNeedingDream(db) {
25237
25241
  WHERE type = 'smart' AND status = 'pending' AND project_path IS NOT NULL
25238
25242
  ORDER BY project_path`).all();
25239
25243
  const projects = [];
25244
+ const now = new Date;
25240
25245
  for (const row of projectRows) {
25241
25246
  const lastDreamAtStr = getDreamState(db, `last_dream_at:${row.project_path}`);
25242
25247
  const fallbackStr = !lastDreamAtStr ? getDreamState(db, "last_dream_at") : null;
25243
25248
  const lastDreamAt = Number(lastDreamAtStr ?? fallbackStr ?? "0") || 0;
25249
+ if (lastDreamAt > 0 && isDreamFromCurrentWindow(lastDreamAt, now)) {
25250
+ continue;
25251
+ }
25244
25252
  const updatedMemories = db.query(`SELECT COUNT(*) as cnt FROM memories
25245
25253
  WHERE project_path = ? AND status = 'active' AND updated_at > ?`).get(row.project_path, lastDreamAt);
25246
25254
  const pendingSmartNotes = db.query(`SELECT COUNT(*) as cnt FROM notes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/opencode-magic-context",
3
- "version": "0.7.0",
3
+ "version": "0.7.3",
4
4
  "type": "module",
5
5
  "description": "OpenCode plugin for Magic Context — cross-session memory and context management",
6
6
  "main": "dist/index.js",
package/src/tui/index.tsx CHANGED
@@ -277,10 +277,9 @@ const StatusDialog = (props: { api: TuiPluginApi; s: StatusDetail }) => {
277
277
  return (
278
278
  <box flexDirection="column" width="100%" paddingLeft={2} paddingRight={2} paddingTop={1} paddingBottom={1}>
279
279
  {/* Title */}
280
- <box justifyContent="center" width="100%" marginBottom={1}>
281
- <text fg={t().accent}>
282
- <b>⚡ Magic Context Status</b> <text fg={t().textMuted}>v{packageJson.version}</text>
283
- </text>
280
+ <box justifyContent="center" width="100%" marginBottom={1} flexDirection="row" gap={2}>
281
+ <text fg={t().accent}><b>⚡ Magic Context Status</b></text>
282
+ <text fg={t().textMuted}>v{packageJson.version}</text>
284
283
  </box>
285
284
 
286
285
  {/* Context summary line */}
@@ -319,12 +318,10 @@ const StatusDialog = (props: { api: TuiPluginApi; s: StatusDetail }) => {
319
318
  <R t={t()} l="Active" v={`${s().activeTags} (~${fmtBytes(s().activeBytes)})`} />
320
319
  <R t={t()} l="Dropped" v={String(s().droppedTags)} />
321
320
  <R t={t()} l="Total" v={String(s().totalTags)} fg={t().textMuted} />
322
-
323
321
  <box marginTop={1}>
324
322
  <text fg={t().text}><b>Pending Queue</b></text>
325
323
  </box>
326
324
  <R t={t()} l="Drops" v={String(s().pendingOpsCount)} fg={s().pendingOpsCount > 0 ? t().warning : t().textMuted} />
327
-
328
325
  <box marginTop={1}>
329
326
  <text fg={t().text}><b>Cache TTL</b></text>
330
327
  </box>
@@ -332,14 +329,12 @@ const StatusDialog = (props: { api: TuiPluginApi; s: StatusDetail }) => {
332
329
  <R t={t()} l="Last response" v={s().lastResponseTime > 0 ? `${Math.round(elapsed() / 1000)}s ago` : "never"} />
333
330
  <R t={t()} l="Remaining" v={s().cacheExpired ? "expired" : `${Math.round(s().cacheRemainingMs / 1000)}s`} fg={s().cacheExpired ? t().warning : t().textMuted} />
334
331
  <R t={t()} l="Auto-execute" v={s().cacheExpired ? "yes (expired)" : `at TTL or ≥${s().executeThreshold}%`} fg={t().textMuted} />
335
-
336
332
  <box marginTop={1}>
337
333
  <text fg={t().text}><b>Memory</b></text>
338
334
  </box>
339
335
  <R t={t()} l="Active" v={String(s().memoryCount)} fg={t().accent} />
340
336
  <R t={t()} l="Injected" v={String(s().memoryBlockCount)} fg={t().textMuted} />
341
337
  </box>
342
-
343
338
  {/* Right column */}
344
339
  <box flexDirection="column" flexGrow={1} flexBasis={0}>
345
340
  <text fg={t().text}><b>Rolling Nudges</b></text>
@@ -348,13 +343,11 @@ const StatusDialog = (props: { api: TuiPluginApi; s: StatusDetail }) => {
348
343
  <R t={t()} l="Interval" v={`${fmt(s().nudgeInterval)} tok`} fg={t().textMuted} />
349
344
  <R t={t()} l="Next nudge after" v={`${fmt(s().nextNudgeAfter)} tok`} />
350
345
  {s().lastNudgeBand ? <R t={t()} l="Current band" v={s().lastNudgeBand} /> : null}
351
-
352
346
  <box marginTop={1}>
353
347
  <text fg={t().text}><b>Context Details</b></text>
354
348
  </box>
355
349
  <R t={t()} l="Protected tags" v={String(s().protectedTagCount)} fg={t().textMuted} />
356
350
  <R t={t()} l="Subagent" v={s().isSubagent ? "yes" : "no"} fg={t().textMuted} />
357
-
358
351
  <box marginTop={1}>
359
352
  <text fg={t().text}><b>History Compression</b></text>
360
353
  </box>