@ubundi/openclaw-cortex 2.2.2 → 2.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.
Files changed (59) hide show
  1. package/README.md +8 -25
  2. package/dist/cortex/client.d.ts +4 -0
  3. package/dist/cortex/client.d.ts.map +1 -1
  4. package/dist/cortex/client.js.map +1 -1
  5. package/dist/features/capture/handler.d.ts.map +1 -1
  6. package/dist/features/capture/handler.js +6 -5
  7. package/dist/features/capture/handler.js.map +1 -1
  8. package/dist/features/index.d.ts +0 -1
  9. package/dist/features/index.d.ts.map +1 -1
  10. package/dist/features/index.js +0 -1
  11. package/dist/features/index.js.map +1 -1
  12. package/dist/features/recall/handler.d.ts +2 -1
  13. package/dist/features/recall/handler.d.ts.map +1 -1
  14. package/dist/features/recall/handler.js +6 -3
  15. package/dist/features/recall/handler.js.map +1 -1
  16. package/dist/index.d.ts +0 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +0 -1
  19. package/dist/index.js.map +1 -1
  20. package/dist/plugin/cli.d.ts.map +1 -1
  21. package/dist/plugin/cli.js +17 -13
  22. package/dist/plugin/cli.js.map +1 -1
  23. package/dist/plugin/config.d.ts +0 -10
  24. package/dist/plugin/config.d.ts.map +1 -1
  25. package/dist/plugin/config.js +0 -2
  26. package/dist/plugin/config.js.map +1 -1
  27. package/dist/plugin/index.d.ts +0 -4
  28. package/dist/plugin/index.d.ts.map +1 -1
  29. package/dist/plugin/index.js +2 -21
  30. package/dist/plugin/index.js.map +1 -1
  31. package/dist/plugin/search-query.d.ts +16 -0
  32. package/dist/plugin/search-query.d.ts.map +1 -0
  33. package/dist/plugin/search-query.js +105 -0
  34. package/dist/plugin/search-query.js.map +1 -0
  35. package/dist/plugin/tools.d.ts.map +1 -1
  36. package/dist/plugin/tools.js +8 -30
  37. package/dist/plugin/tools.js.map +1 -1
  38. package/openclaw.plugin.json +2 -20
  39. package/package.json +2 -2
  40. package/dist/features/sync/daily-logs-sync.d.ts +0 -26
  41. package/dist/features/sync/daily-logs-sync.d.ts.map +0 -1
  42. package/dist/features/sync/daily-logs-sync.js +0 -95
  43. package/dist/features/sync/daily-logs-sync.js.map +0 -1
  44. package/dist/features/sync/index.d.ts +0 -5
  45. package/dist/features/sync/index.d.ts.map +0 -1
  46. package/dist/features/sync/index.js +0 -5
  47. package/dist/features/sync/index.js.map +0 -1
  48. package/dist/features/sync/memory-md-sync.d.ts +0 -30
  49. package/dist/features/sync/memory-md-sync.d.ts.map +0 -1
  50. package/dist/features/sync/memory-md-sync.js +0 -115
  51. package/dist/features/sync/memory-md-sync.js.map +0 -1
  52. package/dist/features/sync/transcripts-sync.d.ts +0 -24
  53. package/dist/features/sync/transcripts-sync.d.ts.map +0 -1
  54. package/dist/features/sync/transcripts-sync.js +0 -93
  55. package/dist/features/sync/transcripts-sync.js.map +0 -1
  56. package/dist/features/sync/watcher.d.ts +0 -34
  57. package/dist/features/sync/watcher.d.ts.map +0 -1
  58. package/dist/features/sync/watcher.js +0 -125
  59. package/dist/features/sync/watcher.js.map +0 -1
@@ -1,26 +0,0 @@
1
- import type { CortexClient } from "../../cortex/client.js";
2
- import type { RetryQueue } from "../../internal/retry-queue.js";
3
- import type { AuditLogger } from "../../internal/audit-logger.js";
4
- type Logger = {
5
- debug?(...args: unknown[]): void;
6
- info(...args: unknown[]): void;
7
- warn(...args: unknown[]): void;
8
- error(...args: unknown[]): void;
9
- };
10
- export declare class DailyLogsSync {
11
- private client;
12
- private sessionPrefix;
13
- private logger;
14
- private retryQueue?;
15
- private allowedRoot?;
16
- private getUserId?;
17
- private auditLogger?;
18
- private captureFilter;
19
- private offsets;
20
- constructor(client: CortexClient, sessionPrefix: string, logger: Logger, retryQueue?: RetryQueue | undefined, allowedRoot?: string | undefined, getUserId?: (() => string | undefined) | undefined, auditLogger?: AuditLogger | undefined, captureFilter?: boolean);
21
- onFileChange(filePath: string, filename: string): Promise<void>;
22
- stop(): void;
23
- }
24
- export declare function extractDateFromFilename(filename: string): string | undefined;
25
- export {};
26
- //# sourceMappingURL=daily-logs-sync.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"daily-logs-sync.d.ts","sourceRoot":"","sources":["../../../src/features/sync/daily-logs-sync.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAIlE,KAAK,MAAM,GAAG;IACZ,KAAK,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACjC,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC/B,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC/B,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;CACjC,CAAC;AAEF,qBAAa,aAAa;IAItB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,UAAU,CAAC;IACnB,OAAO,CAAC,WAAW,CAAC;IACpB,OAAO,CAAC,SAAS,CAAC;IAClB,OAAO,CAAC,WAAW,CAAC;IACpB,OAAO,CAAC,aAAa;IAVvB,OAAO,CAAC,OAAO,CAA6B;gBAGlC,MAAM,EAAE,YAAY,EACpB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,UAAU,YAAA,EACvB,WAAW,CAAC,EAAE,MAAM,YAAA,EACpB,SAAS,CAAC,GAAE,MAAM,MAAM,GAAG,SAAS,aAAA,EACpC,WAAW,CAAC,EAAE,WAAW,YAAA,EACzB,aAAa,UAAO;IAGxB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAyErE,IAAI,IAAI,IAAI;CAGb;AAID,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAG5E"}
@@ -1,95 +0,0 @@
1
- import { readFile } from "node:fs/promises";
2
- import { safePathCheck } from "../../internal/safe-path.js";
3
- import { filterLowSignalLines } from "../capture/filter.js";
4
- export class DailyLogsSync {
5
- client;
6
- sessionPrefix;
7
- logger;
8
- retryQueue;
9
- allowedRoot;
10
- getUserId;
11
- auditLogger;
12
- captureFilter;
13
- offsets = new Map();
14
- constructor(client, sessionPrefix, logger, retryQueue, allowedRoot, getUserId, auditLogger, captureFilter = true) {
15
- this.client = client;
16
- this.sessionPrefix = sessionPrefix;
17
- this.logger = logger;
18
- this.retryQueue = retryQueue;
19
- this.allowedRoot = allowedRoot;
20
- this.getUserId = getUserId;
21
- this.auditLogger = auditLogger;
22
- this.captureFilter = captureFilter;
23
- }
24
- async onFileChange(filePath, filename) {
25
- try {
26
- if (this.allowedRoot) {
27
- const safe = await safePathCheck(filePath, this.allowedRoot);
28
- if (!safe.ok) {
29
- if (safe.reason === "unsafe") {
30
- this.logger.warn(`Daily log sync: rejected unsafe path ${filePath}`);
31
- }
32
- else if (safe.reason === "io_error") {
33
- this.logger.warn(`Daily log sync: path check failed for ${filePath} (${safe.errorCode ?? "unknown"})`);
34
- }
35
- else {
36
- this.logger.debug?.(`Daily log sync: file not found during path check ${filePath}`);
37
- }
38
- return;
39
- }
40
- filePath = safe.path;
41
- }
42
- const content = await readFile(filePath, "utf-8");
43
- const lastOffset = this.offsets.get(filePath) ?? 0;
44
- let newContent = content.slice(lastOffset);
45
- this.offsets.set(filePath, content.length);
46
- if (this.captureFilter) {
47
- newContent = filterLowSignalLines(newContent);
48
- }
49
- if (!newContent.trim())
50
- return;
51
- const sessionId = `${this.sessionPrefix}:daily:${filename}`;
52
- const referenceDate = extractDateFromFilename(filename);
53
- if (this.auditLogger) {
54
- void this.auditLogger.log({
55
- feature: "file-sync-daily-logs",
56
- method: "POST",
57
- endpoint: "/v1/remember",
58
- payload: newContent,
59
- sessionId,
60
- userId: this.getUserId?.(),
61
- });
62
- }
63
- const doRemember = () => {
64
- // Re-evaluate userId at call time so retries use the resolved value
65
- const userId = this.getUserId?.();
66
- if (this.getUserId && !userId) {
67
- this.logger.warn(`Daily log sync: missing user_id for ${filename}, retrying later`);
68
- throw new Error("Cortex ingest requires user_id");
69
- }
70
- return this.client.remember(newContent, sessionId, undefined, referenceDate, userId, "openclaw", "OpenClaw").then(() => {
71
- this.logger.debug?.(`Daily log sync: remember accepted for ${filename}`);
72
- });
73
- };
74
- try {
75
- await doRemember();
76
- }
77
- catch (err) {
78
- this.logger.warn(`Daily log sync failed for ${filename}, queuing for retry: ${String(err)}`);
79
- this.retryQueue?.enqueue(doRemember, `daily-${filename}`);
80
- }
81
- }
82
- catch (err) {
83
- this.logger.warn(`Daily log sync read failed for ${filename}: ${String(err)}`);
84
- }
85
- }
86
- stop() {
87
- this.offsets.clear();
88
- }
89
- }
90
- const DATE_RE = /(\d{4}-\d{2}-\d{2})/;
91
- export function extractDateFromFilename(filename) {
92
- const match = DATE_RE.exec(filename);
93
- return match?.[1];
94
- }
95
- //# sourceMappingURL=daily-logs-sync.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"daily-logs-sync.js","sourceRoot":"","sources":["../../../src/features/sync/daily-logs-sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAI5C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAS5D,MAAM,OAAO,aAAa;IAId;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAVF,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE5C,YACU,MAAoB,EACpB,aAAqB,EACrB,MAAc,EACd,UAAuB,E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V,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,yCAAyC,QAAQ,EAAE,CAAC,CAAC;gBAC3E,CAAC,CAAC,CAAC;YACL,CAAC,CAAC;YAEF,IAAI,CAAC;gBACH,MAAM,UAAU,EAAE,CAAC;YACrB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,6BAA6B,QAAQ,wBAAwB,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAC7F,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,SAAS,QAAQ,EAAE,CAAC,CAAC;YAC5D,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,kCAAkC,QAAQ,KAAK,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACjF,CAAC;IACH,CAAC;IAED,IAAI;QACF,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;CACF;AAED,MAAM,OAAO,GAAG,qBAAqB,CAAC;AAEtC,MAAM,UAAU,uBAAuB,CAAC,QAAgB;IACtD,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrC,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC"}
@@ -1,5 +0,0 @@
1
- export { FileSyncWatcher, type FileSyncOptions } from "./watcher.js";
2
- export { MemoryMdSync, lineDiff } from "./memory-md-sync.js";
3
- export { DailyLogsSync, extractDateFromFilename } from "./daily-logs-sync.js";
4
- export { TranscriptsSync } from "./transcripts-sync.js";
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/sync/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
@@ -1,5 +0,0 @@
1
- export { FileSyncWatcher } from "./watcher.js";
2
- export { MemoryMdSync, lineDiff } from "./memory-md-sync.js";
3
- export { DailyLogsSync, extractDateFromFilename } from "./daily-logs-sync.js";
4
- export { TranscriptsSync } from "./transcripts-sync.js";
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/features/sync/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAwB,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
@@ -1,30 +0,0 @@
1
- import type { CortexClient } from "../../cortex/client.js";
2
- import type { RetryQueue } from "../../internal/retry-queue.js";
3
- import type { AuditLogger } from "../../internal/audit-logger.js";
4
- type Logger = {
5
- debug?(...args: unknown[]): void;
6
- info(...args: unknown[]): void;
7
- warn(...args: unknown[]): void;
8
- error(...args: unknown[]): void;
9
- };
10
- export declare class MemoryMdSync {
11
- private filePath;
12
- private client;
13
- private sessionId;
14
- private logger;
15
- private retryQueue?;
16
- private allowedRoot?;
17
- private getUserId?;
18
- private auditLogger?;
19
- private captureFilter;
20
- private lastContent;
21
- private debounceTimer;
22
- private syncCounter;
23
- constructor(filePath: string, client: CortexClient, sessionId: string, logger: Logger, retryQueue?: RetryQueue | undefined, allowedRoot?: string | undefined, getUserId?: (() => string | undefined) | undefined, auditLogger?: AuditLogger | undefined, captureFilter?: boolean);
24
- onFileChange(): void;
25
- private diffAndIngest;
26
- stop(): void;
27
- }
28
- export declare function lineDiff(previous: string, current: string): string;
29
- export {};
30
- //# sourceMappingURL=memory-md-sync.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"memory-md-sync.d.ts","sourceRoot":"","sources":["../../../src/features/sync/memory-md-sync.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAIlE,KAAK,MAAM,GAAG;IACZ,KAAK,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACjC,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC/B,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC/B,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;CACjC,CAAC;AAIF,qBAAa,YAAY;IAMrB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,UAAU,CAAC;IACnB,OAAO,CAAC,WAAW,CAAC;IACpB,OAAO,CAAC,SAAS,CAAC;IAClB,OAAO,CAAC,WAAW,CAAC;IACpB,OAAO,CAAC,aAAa;IAbvB,OAAO,CAAC,WAAW,CAAM;IACzB,OAAO,CAAC,aAAa,CAA8C;IACnE,OAAO,CAAC,WAAW,CAAK;gBAGd,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,UAAU,YAAA,EACvB,WAAW,CAAC,EAAE,MAAM,YAAA,EACpB,SAAS,CAAC,GAAE,MAAM,MAAM,GAAG,SAAS,aAAA,EACpC,WAAW,CAAC,EAAE,WAAW,YAAA,EACzB,aAAa,UAAO;IAG9B,YAAY,IAAI,IAAI;YAUN,aAAa;IA2E3B,IAAI,IAAI,IAAI;CAMb;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAMlE"}
@@ -1,115 +0,0 @@
1
- import { readFile } from "node:fs/promises";
2
- import { safePathCheck } from "../../internal/safe-path.js";
3
- import { filterLowSignalLines } from "../capture/filter.js";
4
- const DEBOUNCE_MS = 2000;
5
- export class MemoryMdSync {
6
- filePath;
7
- client;
8
- sessionId;
9
- logger;
10
- retryQueue;
11
- allowedRoot;
12
- getUserId;
13
- auditLogger;
14
- captureFilter;
15
- lastContent = "";
16
- debounceTimer = null;
17
- syncCounter = 0;
18
- constructor(filePath, client, sessionId, logger, retryQueue, allowedRoot, getUserId, auditLogger, captureFilter = true) {
19
- this.filePath = filePath;
20
- this.client = client;
21
- this.sessionId = sessionId;
22
- this.logger = logger;
23
- this.retryQueue = retryQueue;
24
- this.allowedRoot = allowedRoot;
25
- this.getUserId = getUserId;
26
- this.auditLogger = auditLogger;
27
- this.captureFilter = captureFilter;
28
- }
29
- onFileChange() {
30
- if (this.debounceTimer)
31
- clearTimeout(this.debounceTimer);
32
- this.debounceTimer = setTimeout(() => {
33
- this.diffAndIngest().catch((err) => {
34
- this.logger.warn(`MEMORY.md sync failed: ${String(err)}`);
35
- });
36
- }, DEBOUNCE_MS);
37
- }
38
- async diffAndIngest() {
39
- let resolvedPath = this.filePath;
40
- if (this.allowedRoot) {
41
- const safe = await safePathCheck(this.filePath, this.allowedRoot);
42
- if (!safe.ok) {
43
- if (safe.reason === "unsafe") {
44
- this.logger.warn(`MEMORY.md sync: rejected unsafe path ${this.filePath}`);
45
- }
46
- else if (safe.reason === "io_error") {
47
- this.logger.warn(`MEMORY.md sync: path check failed for ${this.filePath} (${safe.errorCode ?? "unknown"})`);
48
- }
49
- else {
50
- this.logger.debug?.(`MEMORY.md sync: file not found during path check ${this.filePath}`);
51
- }
52
- return;
53
- }
54
- resolvedPath = safe.path;
55
- }
56
- let current;
57
- try {
58
- current = await readFile(resolvedPath, "utf-8");
59
- }
60
- catch {
61
- return; // File doesn't exist or unreadable
62
- }
63
- if (current === this.lastContent)
64
- return;
65
- let added = lineDiff(this.lastContent, current);
66
- this.lastContent = current;
67
- if (this.captureFilter) {
68
- added = filterLowSignalLines(added);
69
- }
70
- if (!added.trim())
71
- return;
72
- if (this.auditLogger) {
73
- void this.auditLogger.log({
74
- feature: "file-sync-memory-md",
75
- method: "POST",
76
- endpoint: "/v1/remember",
77
- payload: added,
78
- sessionId: this.sessionId,
79
- userId: this.getUserId?.(),
80
- });
81
- }
82
- const doRemember = () => {
83
- // Re-evaluate userId at call time so retries use the resolved value
84
- const userId = this.getUserId?.();
85
- if (this.getUserId && !userId) {
86
- this.logger.warn("MEMORY.md sync: missing user_id, retrying later");
87
- throw new Error("Cortex ingest requires user_id");
88
- }
89
- return this.client.remember(added, this.sessionId, undefined, undefined, userId, "openclaw", "OpenClaw").then(() => {
90
- this.logger.debug?.("MEMORY.md sync: remember accepted");
91
- });
92
- };
93
- try {
94
- await doRemember();
95
- }
96
- catch (err) {
97
- this.logger.warn(`MEMORY.md sync failed, queuing for retry: ${String(err)}`);
98
- this.retryQueue?.enqueue(doRemember, `memory-md-${++this.syncCounter}`);
99
- }
100
- }
101
- stop() {
102
- if (this.debounceTimer) {
103
- clearTimeout(this.debounceTimer);
104
- this.debounceTimer = null;
105
- }
106
- }
107
- }
108
- export function lineDiff(previous, current) {
109
- const prevLines = new Set(previous.split("\n"));
110
- return current
111
- .split("\n")
112
- .filter((line) => !prevLines.has(line))
113
- .join("\n");
114
- }
115
- //# sourceMappingURL=memory-md-sync.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"memory-md-sync.js","sourceRoot":"","sources":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AAC;QAC1E,CAAC;IACH,CAAC;IAED,IAAI;QACF,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YACjC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC5B,CAAC;IACH,CAAC;CACF;AAED,MAAM,UAAU,QAAQ,CAAC,QAAgB,EAAE,OAAe;IACxD,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAChD,OAAO,OAAO;SACX,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SACtC,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
@@ -1,24 +0,0 @@
1
- import type { CortexClient } from "../../cortex/client.js";
2
- import type { RetryQueue } from "../../internal/retry-queue.js";
3
- import type { AuditLogger } from "../../internal/audit-logger.js";
4
- type Logger = {
5
- debug?(...args: unknown[]): void;
6
- info(...args: unknown[]): void;
7
- warn(...args: unknown[]): void;
8
- error(...args: unknown[]): void;
9
- };
10
- export declare class TranscriptsSync {
11
- private client;
12
- private sessionPrefix;
13
- private logger;
14
- private retryQueue?;
15
- private allowedRoot?;
16
- private getUserId?;
17
- private auditLogger?;
18
- private offsets;
19
- constructor(client: CortexClient, sessionPrefix: string, logger: Logger, retryQueue?: RetryQueue | undefined, allowedRoot?: string | undefined, getUserId?: (() => string | undefined) | undefined, auditLogger?: AuditLogger | undefined);
20
- onFileChange(filePath: string, filename: string): Promise<void>;
21
- stop(): void;
22
- }
23
- export {};
24
- //# sourceMappingURL=transcripts-sync.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transcripts-sync.d.ts","sourceRoot":"","sources":["../../../src/features/sync/transcripts-sync.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAIlE,KAAK,MAAM,GAAG;IACZ,KAAK,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACjC,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC/B,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC/B,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;CACjC,CAAC;AAEF,qBAAa,eAAe;IAIxB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,UAAU,CAAC;IACnB,OAAO,CAAC,WAAW,CAAC;IACpB,OAAO,CAAC,SAAS,CAAC;IAClB,OAAO,CAAC,WAAW,CAAC;IATtB,OAAO,CAAC,OAAO,CAA6B;gBAGlC,MAAM,EAAE,YAAY,EACpB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,UAAU,YAAA,EACvB,WAAW,CAAC,EAAE,MAAM,YAAA,EACpB,SAAS,CAAC,GAAE,MAAM,MAAM,GAAG,SAAS,aAAA,EACpC,WAAW,CAAC,EAAE,WAAW,YAAA;IAG7B,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA+ErE,IAAI,IAAI,IAAI;CAGb"}
@@ -1,93 +0,0 @@
1
- import { readFile } from "node:fs/promises";
2
- import { cleanTranscriptChunk } from "../../internal/cleaner.js";
3
- import { safePathCheck } from "../../internal/safe-path.js";
4
- export class TranscriptsSync {
5
- client;
6
- sessionPrefix;
7
- logger;
8
- retryQueue;
9
- allowedRoot;
10
- getUserId;
11
- auditLogger;
12
- offsets = new Map();
13
- constructor(client, sessionPrefix, logger, retryQueue, allowedRoot, getUserId, auditLogger) {
14
- this.client = client;
15
- this.sessionPrefix = sessionPrefix;
16
- this.logger = logger;
17
- this.retryQueue = retryQueue;
18
- this.allowedRoot = allowedRoot;
19
- this.getUserId = getUserId;
20
- this.auditLogger = auditLogger;
21
- }
22
- async onFileChange(filePath, filename) {
23
- try {
24
- if (this.allowedRoot) {
25
- const safe = await safePathCheck(filePath, this.allowedRoot);
26
- if (!safe.ok) {
27
- if (safe.reason === "unsafe") {
28
- this.logger.warn(`Transcript sync: rejected unsafe path ${filePath}`);
29
- }
30
- else if (safe.reason === "io_error") {
31
- this.logger.warn(`Transcript sync: path check failed for ${filePath} (${safe.errorCode ?? "unknown"})`);
32
- }
33
- else {
34
- this.logger.debug?.(`Transcript sync: file not found during path check ${filePath}`);
35
- }
36
- return;
37
- }
38
- filePath = safe.path;
39
- }
40
- const content = await readFile(filePath, "utf-8");
41
- const lastOffset = this.offsets.get(filePath) ?? 0;
42
- const newContent = content.slice(lastOffset);
43
- this.offsets.set(filePath, content.length);
44
- if (!newContent.trim())
45
- return;
46
- const { messages, worthIngesting } = cleanTranscriptChunk(newContent);
47
- if (!worthIngesting || messages.length === 0) {
48
- this.logger.debug?.(`Transcript sync: skipping ${filename} — not enough content`);
49
- return;
50
- }
51
- // Derive session ID from filename (e.g. "abc123.jsonl" → "openclaw:session:abc123")
52
- const sessionName = filename.replace(/\.jsonl$/, "");
53
- const sessionId = `${this.sessionPrefix}:session:${sessionName}`;
54
- const referenceDate = new Date().toISOString().slice(0, 10);
55
- if (this.auditLogger) {
56
- void this.auditLogger.log({
57
- feature: "file-sync-transcripts",
58
- method: "POST",
59
- endpoint: "/v1/remember",
60
- payload: messages.map((m) => `${m.role}: ${m.content}`).join("\n\n"),
61
- sessionId,
62
- userId: this.getUserId?.(),
63
- messageCount: messages.length,
64
- });
65
- }
66
- const doRemember = () => {
67
- // Re-evaluate userId at call time so retries use the resolved value
68
- const userId = this.getUserId?.();
69
- if (this.getUserId && !userId) {
70
- this.logger.warn(`Transcript sync: missing user_id for ${filename}, retrying later`);
71
- throw new Error("Cortex ingest requires user_id");
72
- }
73
- return this.client.rememberConversation(messages, sessionId, undefined, referenceDate, userId, "openclaw", "OpenClaw").then(() => {
74
- this.logger.debug?.(`Transcript sync: remember accepted for ${filename}`);
75
- });
76
- };
77
- try {
78
- await doRemember();
79
- }
80
- catch (err) {
81
- this.logger.warn(`Transcript sync failed for ${filename}, queuing for retry: ${String(err)}`);
82
- this.retryQueue?.enqueue(doRemember, `transcript-${filename}`);
83
- }
84
- }
85
- catch (err) {
86
- this.logger.warn(`Transcript sync read failed for ${filename}: ${String(err)}`);
87
- }
88
- }
89
- stop() {
90
- this.offsets.clear();
91
- }
92
- }
93
- //# sourceMappingURL=transcripts-sync.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transcripts-sync.js","sourceRoot":"","sources":["../../../src/features/sync/transcripts-sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAI5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAS5D,MAAM,OAAO,eAAe;IAIhB;IACA;IACA;IACA;IACA;IACA;IACA;IATF,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE5C,YACU,MAAoB,EACpB,aAAqB,EACrB,MAAc,EACd,UAAuB,EACvB,WAAoB,EACpB,SAAoC,EACpC,WAAyB;QANzB,WAAM,GAAN,MAAM,CAAc;QACpB,kBAAa,GAAb,aAAa,CAAQ;QACrB,WAAM,GAAN,MAAM,CAAQ;QACd,eAAU,GAAV,UAAU,CAAa;QACvB,gBAAW,GAAX,WAAW,CAAS;QACpB,cAAS,GAAT,SAAS,CAA2B;QACpC,gBAAW,GAAX,WAAW,CAAc;IACh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BACpD,CAAC;gBACD,OAAO,IAAI,CAAC,MAAM,CAAC,oBAAoB,CACrC,QAAQ,EACR,SAAS,EACT,SAAS,EACT,aAAa,EACb,MAAM,EACN,UAAU,EACV,UAAU,CACX,CAAC,IAAI,CAAC,GAAG,EAAE;oBACV,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,0CAA0C,QAAQ,EAAE,CAAC,CAAC;gBAC5E,CAAC,CAAC,CAAC;YACL,CAAC,CAAC;YAEF,IAAI,CAAC;gBACH,MAAM,UAAU,EAAE,CAAC;YACrB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,8BAA8B,QAAQ,wBAAwB,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAC9F,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,cAAc,QAAQ,EAAE,CAAC,CAAC;YACjE,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,mCAAmC,QAAQ,KAAK,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAClF,CAAC;IACH,CAAC;IAED,IAAI;QACF,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;CACF"}
@@ -1,34 +0,0 @@
1
- import type { CortexClient } from "../../cortex/client.js";
2
- import type { RetryQueue } from "../../internal/retry-queue.js";
3
- import type { AuditLogger } from "../../internal/audit-logger.js";
4
- type Logger = {
5
- debug?(...args: unknown[]): void;
6
- info(...args: unknown[]): void;
7
- warn(...args: unknown[]): void;
8
- error(...args: unknown[]): void;
9
- };
10
- export interface FileSyncOptions {
11
- transcripts?: boolean;
12
- captureFilter?: boolean;
13
- }
14
- export declare class FileSyncWatcher {
15
- private workspaceDir;
16
- private client;
17
- private sessionPrefix;
18
- private logger;
19
- private retryQueue?;
20
- private options;
21
- private getUserId?;
22
- private auditLogger?;
23
- private watchers;
24
- private memoryMdSync;
25
- private dailyLogsSync;
26
- private transcriptsSync;
27
- private started;
28
- constructor(workspaceDir: string, client: CortexClient, sessionPrefix: string, logger: Logger, retryQueue?: RetryQueue | undefined, options?: FileSyncOptions, getUserId?: (() => string | undefined) | undefined, auditLogger?: AuditLogger | undefined);
29
- start(): void;
30
- stop(): void;
31
- private watchPath;
32
- }
33
- export {};
34
- //# sourceMappingURL=watcher.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"watcher.d.ts","sourceRoot":"","sources":["../../../src/features/sync/watcher.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAKlE,KAAK,MAAM,GAAG;IACZ,KAAK,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACjC,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC/B,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC/B,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;CACjC,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,qBAAa,eAAe;IAQxB,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,UAAU,CAAC;IACnB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,SAAS,CAAC;IAClB,OAAO,CAAC,WAAW,CAAC;IAdtB,OAAO,CAAC,QAAQ,CAAmB;IACnC,OAAO,CAAC,YAAY,CAA6B;IACjD,OAAO,CAAC,aAAa,CAA8B;IACnD,OAAO,CAAC,eAAe,CAAgC;IACvD,OAAO,CAAC,OAAO,CAAS;gBAGd,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,YAAY,EACpB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,UAAU,YAAA,EACvB,OAAO,GAAE,eAAoB,EAC7B,SAAS,CAAC,GAAE,MAAM,MAAM,GAAG,SAAS,aAAA,EACpC,WAAW,CAAC,EAAE,WAAW,YAAA;IAGnC,KAAK,IAAI,IAAI;IA6Hb,IAAI,IAAI,IAAI;IAiBZ,OAAO,CAAC,SAAS;CAiBlB"}
@@ -1,125 +0,0 @@
1
- import { watch } from "node:fs";
2
- import { dirname, join } from "node:path";
3
- import { MemoryMdSync } from "./memory-md-sync.js";
4
- import { DailyLogsSync } from "./daily-logs-sync.js";
5
- import { TranscriptsSync } from "./transcripts-sync.js";
6
- export class FileSyncWatcher {
7
- workspaceDir;
8
- client;
9
- sessionPrefix;
10
- logger;
11
- retryQueue;
12
- options;
13
- getUserId;
14
- auditLogger;
15
- watchers = [];
16
- memoryMdSync = null;
17
- dailyLogsSync = null;
18
- transcriptsSync = null;
19
- started = false;
20
- constructor(workspaceDir, client, sessionPrefix, logger, retryQueue, options = {}, getUserId, auditLogger) {
21
- this.workspaceDir = workspaceDir;
22
- this.client = client;
23
- this.sessionPrefix = sessionPrefix;
24
- this.logger = logger;
25
- this.retryQueue = retryQueue;
26
- this.options = options;
27
- this.getUserId = getUserId;
28
- this.auditLogger = auditLogger;
29
- }
30
- start() {
31
- if (this.started) {
32
- this.logger.debug?.("File sync: start() called while already running, skipping");
33
- return;
34
- }
35
- this.started = true;
36
- this.logger.info(`File sync: workspaceDir=${this.workspaceDir}`);
37
- const memoryMdPath = join(this.workspaceDir, "MEMORY.md");
38
- const memoryDir = join(this.workspaceDir, "memory");
39
- const sessionsDir = join(this.workspaceDir, "sessions");
40
- const fallbackSessionsDir = join(dirname(this.workspaceDir), "agents", "main", "sessions");
41
- this.memoryMdSync = new MemoryMdSync(memoryMdPath, this.client, `${this.sessionPrefix}:memory-md`, this.logger, this.retryQueue, this.workspaceDir, this.getUserId, this.auditLogger, this.options.captureFilter ?? true);
42
- this.dailyLogsSync = new DailyLogsSync(this.client, this.sessionPrefix, this.logger, this.retryQueue, memoryDir, this.getUserId, this.auditLogger, this.options.captureFilter ?? true);
43
- const watched = [];
44
- const failed = [];
45
- if (this.watchPath(memoryMdPath, () => {
46
- this.memoryMdSync?.onFileChange();
47
- }, "File sync: watching MEMORY.md", "File sync: MEMORY.md not found, skipping")) {
48
- watched.push("MEMORY.md");
49
- }
50
- else {
51
- failed.push("MEMORY.md");
52
- }
53
- if (this.watchPath(memoryDir, (_event, filename) => {
54
- if (typeof filename !== "string" || !filename.endsWith(".md"))
55
- return;
56
- const fullPath = join(memoryDir, filename);
57
- this.dailyLogsSync?.onFileChange(fullPath, filename);
58
- }, "File sync: watching memory/*.md", "File sync: memory/ directory not found, skipping", { recursive: true })) {
59
- watched.push("memory/*.md");
60
- }
61
- else {
62
- failed.push("memory/*.md");
63
- }
64
- // Watch sessions/*.jsonl (transcripts)
65
- if (this.options.transcripts !== false) {
66
- const watchTranscriptsAt = (rootDir, watchedLabel, skipMessage) => {
67
- const sync = new TranscriptsSync(this.client, this.sessionPrefix, this.logger, this.retryQueue, rootDir, this.getUserId, this.auditLogger);
68
- const started = this.watchPath(rootDir, (_event, filename) => {
69
- if (typeof filename !== "string" || !filename.endsWith(".jsonl"))
70
- return;
71
- const fullPath = join(rootDir, filename);
72
- sync.onFileChange(fullPath, filename);
73
- }, `File sync: watching ${watchedLabel}`, skipMessage, { recursive: true });
74
- if (started) {
75
- this.transcriptsSync = sync;
76
- watched.push(watchedLabel);
77
- }
78
- return started;
79
- };
80
- if (watchTranscriptsAt(sessionsDir, "sessions/*.jsonl", "File sync: sessions/ directory not found, skipping")) {
81
- // primary path active
82
- }
83
- else if (watchTranscriptsAt(fallbackSessionsDir, "agents/main/sessions/*.jsonl", "File sync: fallback agent sessions directory not found, skipping")) {
84
- this.logger.info(`File sync: transcript fallback active (${fallbackSessionsDir})`);
85
- }
86
- else {
87
- failed.push("sessions/*.jsonl");
88
- }
89
- }
90
- const parts = [`File sync: watching ${watched.length} paths`];
91
- if (watched.length > 0)
92
- parts.push(`(${watched.join(", ")})`);
93
- if (failed.length > 0)
94
- parts.push(`— failed: ${failed.join(", ")}`);
95
- this.logger.info(parts.join(" "));
96
- }
97
- stop() {
98
- if (!this.started) {
99
- this.logger.info("File sync stopped");
100
- return;
101
- }
102
- this.started = false;
103
- for (const w of this.watchers) {
104
- w.close();
105
- }
106
- this.watchers = [];
107
- this.memoryMdSync?.stop();
108
- this.dailyLogsSync?.stop();
109
- this.transcriptsSync?.stop();
110
- this.logger.info("File sync stopped");
111
- }
112
- watchPath(path, handler, successMessage, skipMessage, options) {
113
- try {
114
- const watcher = options ? watch(path, options, handler) : watch(path, handler);
115
- this.watchers.push(watcher);
116
- this.logger.info(successMessage);
117
- return true;
118
- }
119
- catch (err) {
120
- this.logger.warn(`${skipMessage} (${err instanceof Error ? err.message : String(err)})`);
121
- return false;
122
- }
123
- }
124
- }
125
- //# sourceMappingURL=watcher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"watcher.js","sourceRoot":"","sources":["../../../src/features/sync/watcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAkB,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAI1C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAcxD,MAAM,OAAO,eAAe;IAQhB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAdF,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