@openmnemo/sync 0.2.2 → 0.3.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/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # @openmnemo/sync
2
+
3
+ Heartbeat daemon, config management, and background sync for OpenMnemo.
4
+
5
+ Runs periodically to discover new AI transcripts, import them into `Memory/`, commit changes to git, and optionally generate HTML reports.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @openmnemo/sync
11
+ ```
12
+
13
+ This package is primarily consumed by `@openmnemo/cli` via the `openmnemo daemon` commands. Direct usage is for programmatic control.
14
+
15
+ ## Config
16
+
17
+ Config is stored in `~/.memorytree/config.toml`.
18
+
19
+ ```typescript
20
+ import { loadConfig, saveConfig, memorytreeRoot } from '@openmnemo/sync'
21
+
22
+ const config = loadConfig()
23
+ // {
24
+ // heartbeat_interval: '5m',
25
+ // auto_push: true,
26
+ // generate_report: false,
27
+ // locale: 'en',
28
+ // ai_summary_model: 'claude-haiku-4-5-20251001',
29
+ // ...
30
+ // }
31
+ ```
32
+
33
+ ### Config fields
34
+
35
+ | Field | Default | Description |
36
+ |-------|---------|-------------|
37
+ | `heartbeat_interval` | `'5m'` | Heartbeat interval (e.g. `'5m'`, `'1h'`) |
38
+ | `auto_push` | `true` | Git push after each import |
39
+ | `generate_report` | `false` | Build HTML report on each heartbeat |
40
+ | `locale` | `'en'` | Report locale (`'en'` or `'zh-CN'`) |
41
+ | `ai_summary_model` | `'claude-haiku-4-5-20251001'` | Model for AI session summaries |
42
+ | `gh_pages_branch` | `''` | Deploy report to this branch (empty = skip) |
43
+ | `cname` | `''` | Custom domain for GitHub Pages |
44
+ | `webhook_url` | `''` | Notify Feishu/Slack/Discord/Telegram on publish |
45
+ | `report_base_url` | `''` | Base URL for report RSS/OG links |
46
+
47
+ ## Programmatic heartbeat
48
+
49
+ ```typescript
50
+ import { runHeartbeat } from '@openmnemo/sync'
51
+
52
+ await runHeartbeat()
53
+ ```
54
+
55
+ ## Lock management
56
+
57
+ ```typescript
58
+ import { acquireLock, releaseLock, readLockPid } from '@openmnemo/sync'
59
+
60
+ const acquired = acquireLock()
61
+ if (acquired) {
62
+ // run heartbeat
63
+ releaseLock()
64
+ }
65
+ ```
66
+
67
+ ## Alerts
68
+
69
+ ```typescript
70
+ import { readAlerts, writeAlert, clearAlerts } from '@openmnemo/sync'
71
+
72
+ const alerts = readAlerts()
73
+ writeAlert({ type: 'sensitive-content', message: 'API key detected', project: 'my-project' })
74
+ clearAlerts()
75
+ ```
76
+
77
+ ## License
78
+
79
+ MIT
package/dist/index.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import { ParsedTranscript } from '@openmnemo/types';
2
-
3
1
  /**
4
2
  * Load, validate, and manage ~/.memorytree/config.toml.
5
3
  * Port of scripts/_config_utils.py
@@ -36,10 +34,6 @@ declare function registerProject(cfg: Config, repoPath: string): Config;
36
34
 
37
35
  declare function main(): Promise<number>;
38
36
  declare function runHeartbeat(config: Config): Promise<number>;
39
- declare function processProject(config: Config, projectPath: string, projectName: string): Promise<void>;
40
- declare function scanSensitive(parsed: ParsedTranscript, projectPath: string): void;
41
- declare function gitCommitAndPush(config: Config, projectPath: string, projectName: string, count: number): void;
42
- declare function tryPush(projectPath: string, projectName: string): boolean;
43
37
 
44
38
  /**
45
39
  * PID-based lock file for heartbeat single-instance enforcement.
@@ -112,4 +106,4 @@ declare function setupLogging(logLevel?: LogLevel): Logger;
112
106
  */
113
107
  declare function getLogger(): Logger;
114
108
 
115
- export { ALERT_TYPES, type Alert, FAILURE_THRESHOLD, type LogLevel, type Logger, MAX_ALERTS, acquireLock, alertsPath, clearAlerts, configPath, formatAlertsForDisplay, getLogger, gitCommitAndPush, main as heartbeatMain, intervalToSeconds, isProcessAlive, loadConfig, lockPath, memorytreeRoot, processProject, readAlerts, readLockPid, registerProject, releaseLock, resetFailureCount, runHeartbeat, saveConfig, scanSensitive, setupLogging, tryPush, writeAlert, writeAlertWithThreshold };
109
+ export { ALERT_TYPES, type Alert, FAILURE_THRESHOLD, type LogLevel, type Logger, MAX_ALERTS, acquireLock, alertsPath, clearAlerts, configPath, formatAlertsForDisplay, getLogger, main as heartbeatMain, intervalToSeconds, isProcessAlive, loadConfig, lockPath, memorytreeRoot, readAlerts, readLockPid, registerProject, releaseLock, resetFailureCount, runHeartbeat, saveConfig, setupLogging, writeAlert, writeAlertWithThreshold };
package/dist/index.js CHANGED
@@ -703,14 +703,12 @@ export {
703
703
  configPath,
704
704
  formatAlertsForDisplay,
705
705
  getLogger,
706
- gitCommitAndPush,
707
706
  main as heartbeatMain,
708
707
  intervalToSeconds,
709
708
  isProcessAlive,
710
709
  loadConfig,
711
710
  lockPath,
712
711
  memorytreeRoot,
713
- processProject,
714
712
  readAlerts,
715
713
  readLockPid,
716
714
  registerProject,
@@ -718,9 +716,7 @@ export {
718
716
  resetFailureCount,
719
717
  runHeartbeat,
720
718
  saveConfig,
721
- scanSensitive,
722
719
  setupLogging,
723
- tryPush,
724
720
  writeAlert,
725
721
  writeAlertWithThreshold
726
722
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmnemo/sync",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "description": "Heartbeat daemon, config management, and background sync for OpenMnemo",
6
6
  "main": "./dist/index.js",
@@ -22,9 +22,9 @@
22
22
  ],
23
23
  "dependencies": {
24
24
  "smol-toml": "^1.3.1",
25
- "@openmnemo/core": "0.2.2",
26
- "@openmnemo/types": "0.2.2",
27
- "@openmnemo/report": "0.2.2"
25
+ "@openmnemo/core": "0.3.0",
26
+ "@openmnemo/types": "0.3.0",
27
+ "@openmnemo/report": "0.3.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "^20.0.0",