@stackmemoryai/stackmemory 1.12.0 → 1.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/LICENSE +131 -64
- package/README.md +3 -1
- package/bin/claude-sm +16 -1
- package/bin/claude-smd +16 -1
- package/bin/codex-smd +16 -1
- package/bin/gemini-sm +16 -1
- package/bin/hermes-sm +21 -0
- package/bin/hermes-smd +21 -0
- package/bin/opencode-sm +16 -1
- package/dist/src/cli/codex-sm.js +51 -11
- package/dist/src/cli/commands/brain.js +206 -0
- package/dist/src/cli/commands/company-os.js +184 -0
- package/dist/src/cli/commands/context.js +5 -0
- package/dist/src/cli/commands/operator.js +127 -0
- package/dist/src/cli/commands/orchestrate.js +2 -0
- package/dist/src/cli/commands/orchestrator.js +3 -2
- package/dist/src/cli/commands/patterns.js +254 -0
- package/dist/src/cli/commands/portal.js +161 -0
- package/dist/src/cli/commands/scaffold.js +92 -0
- package/dist/src/cli/commands/setup.js +1 -4
- package/dist/src/cli/commands/sync.js +253 -0
- package/dist/src/cli/commands/tasks.js +130 -1
- package/dist/src/cli/commands/vision.js +221 -0
- package/dist/src/cli/hermes-sm.js +224 -0
- package/dist/src/cli/index.js +15 -10
- package/dist/src/cli/utils/real-cli-bin.js +72 -0
- package/dist/src/core/brain/brain-store.js +187 -0
- package/dist/src/core/brain/brain-sync.js +193 -0
- package/dist/src/core/brain/index.js +78 -0
- package/dist/src/core/brain/types.js +10 -0
- package/dist/src/core/cache/token-estimator.js +24 -1
- package/dist/src/core/config/feature-flags.js +2 -6
- package/dist/src/core/context/frame-database.js +44 -0
- package/dist/src/core/context/recursive-context-manager.js +1 -1
- package/dist/src/core/context/rehydration.js +2 -1
- package/dist/src/core/database/sqlite-adapter.js +14 -1
- package/dist/src/core/models/model-router.js +33 -1
- package/dist/src/core/models/provider-pricing.js +58 -4
- package/dist/src/core/patterns/index.js +22 -0
- package/dist/src/core/patterns/pattern-applier.js +39 -0
- package/dist/src/core/patterns/pattern-observer.js +157 -0
- package/dist/src/core/patterns/pattern-store.js +259 -0
- package/dist/src/core/patterns/types.js +19 -0
- package/dist/src/core/retrieval/llm-context-retrieval.js +5 -4
- package/dist/src/core/retrieval/unified-context-assembler.js +11 -66
- package/dist/src/core/skill-packs/types.js +14 -1
- package/dist/src/core/storage/cloud-sync-manager.js +116 -0
- package/dist/src/core/storage/cloud-sync.js +574 -0
- package/dist/src/core/storage/two-tier-storage.js +5 -1
- package/dist/src/core/tasks/master-tasks-template.js +43 -0
- package/dist/src/core/tasks/md-task-parser.js +138 -0
- package/dist/src/core/vision/index.js +27 -0
- package/dist/src/core/vision/signals.js +79 -0
- package/dist/src/core/vision/types.js +22 -0
- package/dist/src/core/vision/vision-file.js +146 -0
- package/dist/src/core/vision/vision-loop.js +220 -0
- package/dist/src/core/wiki/wiki-compiler.js +103 -1
- package/dist/src/daemon/daemon-config.js +45 -0
- package/dist/src/daemon/services/desire-path-service.js +566 -0
- package/dist/src/daemon/services/research-stream-service.js +320 -0
- package/dist/src/daemon/services/telemetry-service.js +192 -0
- package/dist/src/daemon/unified-daemon.js +28 -1
- package/dist/src/features/browser/cli-browser-agent.js +417 -0
- package/dist/src/features/browser/stagehand-workflows.js +578 -0
- package/dist/src/features/operator/adapter-factory.js +62 -0
- package/dist/src/features/operator/browser-adapter.js +109 -0
- package/dist/src/features/operator/desktop-adapter.js +125 -0
- package/dist/src/features/operator/index.js +39 -0
- package/dist/src/features/operator/llm-decision.js +137 -0
- package/dist/src/features/operator/operator-logger.js +92 -0
- package/dist/src/features/operator/overnight-runner.js +327 -0
- package/dist/src/features/operator/screen-adapter.js +91 -0
- package/dist/src/features/operator/session-manager.js +127 -0
- package/dist/src/features/operator/state-machine.js +227 -0
- package/dist/src/features/operator/task-queue.js +81 -0
- package/dist/src/features/portal/index.js +26 -0
- package/dist/src/features/portal/server.js +240 -0
- package/dist/src/features/portal/types.js +14 -0
- package/dist/src/features/portal/ui.js +195 -0
- package/dist/src/features/tasks/task-aware-context.js +2 -1
- package/dist/src/features/tui/simple-monitor.js +0 -23
- package/dist/src/features/tui/swarm-monitor.js +8 -66
- package/dist/src/{integrations/diffmem/index.js → features/web/client/hooks/use-socket.js} +6 -5
- package/dist/src/features/web/client/lib/utils.js +12 -0
- package/dist/src/features/web/client/stores/session-store.js +12 -0
- package/dist/src/features/web/server/gcp-billing.js +76 -0
- package/dist/src/features/web/server/index.js +10 -0
- package/dist/src/features/web/server/spend-calculator.js +228 -0
- package/dist/src/hooks/schemas.js +4 -1
- package/dist/src/integrations/anthropic/client.js +3 -2
- package/dist/src/integrations/claude-code/agent-bridge.js +0 -3
- package/dist/src/integrations/claude-code/subagent-client.js +218 -11
- package/dist/src/integrations/claude-code/task-coordinator.js +2 -1
- package/dist/src/integrations/linear/webhook-retry.js +196 -0
- package/dist/src/integrations/linear/webhook-server.js +18 -22
- package/dist/src/integrations/mcp/handlers/cloud-sync-handlers.js +101 -0
- package/dist/src/integrations/mcp/handlers/index.js +27 -52
- package/dist/src/integrations/mcp/server.js +122 -335
- package/dist/src/integrations/mcp/tool-alias-registry.js +0 -73
- package/dist/src/integrations/mcp/tool-definitions.js +111 -510
- package/dist/src/mcp/stackmemory-mcp-server.js +404 -379
- package/dist/src/orchestrators/multimodal/determinism.js +2 -1
- package/dist/src/orchestrators/multimodal/harness.js +2 -1
- package/dist/src/skills/recursive-agent-orchestrator.js +2 -4
- package/dist/src/utils/process-cleanup.js +1 -7
- package/docs/README.md +42 -0
- package/docs/guides/README_INSTALL.md +208 -0
- package/package.json +18 -9
- package/scripts/claude-code-wrapper.sh +11 -0
- package/scripts/claude-sm-setup.sh +12 -1
- package/scripts/codex-wrapper.sh +11 -0
- package/scripts/git-hooks/branch-context-manager.sh +11 -0
- package/scripts/git-hooks/post-checkout-stackmemory.sh +11 -0
- package/scripts/git-hooks/post-commit-stackmemory.sh +11 -0
- package/scripts/git-hooks/pre-commit-stackmemory.sh +11 -0
- package/scripts/hooks/cleanup-shell.sh +12 -1
- package/scripts/hooks/task-complete.sh +12 -1
- package/scripts/install-code-execution-hooks.sh +12 -1
- package/scripts/install-sweep-hook.sh +12 -0
- package/scripts/install.sh +11 -0
- package/scripts/opencode-wrapper.sh +11 -0
- package/scripts/portal/cloud-init.yaml +69 -0
- package/scripts/portal/setup.sh +69 -0
- package/scripts/portal/stackmemory-portal.service +34 -0
- package/scripts/setup-claude-integration.sh +12 -1
- package/scripts/smoke-init-db.sh +23 -0
- package/scripts/stackmemory-daemon.sh +11 -0
- package/scripts/verify-dist.cjs +11 -4
- package/dist/src/cli/commands/ralph.js +0 -1053
- package/dist/src/hooks/diffmem-hooks.js +0 -376
- package/dist/src/integrations/diffmem/client.js +0 -208
- package/dist/src/integrations/diffmem/config.js +0 -14
- package/dist/src/integrations/greptile/client.js +0 -101
- package/dist/src/integrations/greptile/config.js +0 -14
- package/dist/src/integrations/greptile/index.js +0 -11
- package/dist/src/integrations/mcp/handlers/cross-search-handlers.js +0 -188
- package/dist/src/integrations/mcp/handlers/diffmem-handlers.js +0 -455
- package/dist/src/integrations/mcp/handlers/greptile-handlers.js +0 -456
- package/dist/src/integrations/mcp/handlers/provider-handlers.js +0 -227
- package/dist/src/integrations/ralph/bridge/ralph-stackmemory-bridge.js +0 -863
- package/dist/src/integrations/ralph/context/context-budget-manager.js +0 -308
- package/dist/src/integrations/ralph/context/stackmemory-context-loader.js +0 -354
- package/dist/src/integrations/ralph/index.js +0 -17
- package/dist/src/integrations/ralph/learning/pattern-learner.js +0 -416
- package/dist/src/integrations/ralph/lifecycle/iteration-lifecycle.js +0 -448
- package/dist/src/integrations/ralph/loopmax.js +0 -488
- package/dist/src/integrations/ralph/monitoring/swarm-dashboard.js +0 -293
- package/dist/src/integrations/ralph/monitoring/swarm-registry.js +0 -107
- package/dist/src/integrations/ralph/orchestration/multi-loop-orchestrator.js +0 -508
- package/dist/src/integrations/ralph/patterns/compounding-engineering-pattern.js +0 -407
- package/dist/src/integrations/ralph/patterns/extended-coherence-sessions.js +0 -495
- package/dist/src/integrations/ralph/patterns/oracle-worker-pattern.js +0 -387
- package/dist/src/integrations/ralph/performance/performance-optimizer.js +0 -357
- package/dist/src/integrations/ralph/recovery/crash-recovery.js +0 -461
- package/dist/src/integrations/ralph/state/state-reconciler.js +0 -420
- package/dist/src/integrations/ralph/swarm/git-workflow-manager.js +0 -444
- package/dist/src/integrations/ralph/swarm/swarm-coordinator.js +0 -1005
- package/dist/src/integrations/ralph/visualization/ralph-debugger.js +0 -635
- package/scripts/ralph-loop-implementation.js +0 -404
- /package/dist/src/{integrations/diffmem/types.js → core/storage/cloud-sync-types.js} +0 -0
- /package/dist/src/{integrations/greptile → features/operator}/types.js +0 -0
- /package/dist/src/{integrations/ralph/types.js → features/web/client/next-env.d.js} +0 -0
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
createPrivacyFilter
|
|
7
7
|
} from "./privacy-filter.js";
|
|
8
8
|
import { logger } from "../monitoring/logger.js";
|
|
9
|
+
import { estimateTokens } from "../cache/token-estimator.js";
|
|
9
10
|
const DEFAULT_UNIFIED_CONTEXT_CONFIG = {
|
|
10
11
|
totalTokenBudget: 8e3,
|
|
11
12
|
userKnowledgeBudget: 0.2,
|
|
@@ -16,10 +17,6 @@ const DEFAULT_UNIFIED_CONTEXT_CONFIG = {
|
|
|
16
17
|
// 10%
|
|
17
18
|
privacyMode: "standard"
|
|
18
19
|
};
|
|
19
|
-
function estimateTokens(content) {
|
|
20
|
-
if (!content) return 0;
|
|
21
|
-
return Math.ceil(content.length / 4);
|
|
22
|
-
}
|
|
23
20
|
function truncateToTokenBudget(content, tokenBudget) {
|
|
24
21
|
if (!content) return "";
|
|
25
22
|
const estimatedTokens = estimateTokens(content);
|
|
@@ -36,12 +33,10 @@ function truncateToTokenBudget(content, tokenBudget) {
|
|
|
36
33
|
}
|
|
37
34
|
class UnifiedContextAssembler {
|
|
38
35
|
stackMemoryRetrieval;
|
|
39
|
-
diffMemHooks;
|
|
40
36
|
config;
|
|
41
37
|
privacyFilter;
|
|
42
|
-
constructor(stackMemoryRetrieval,
|
|
38
|
+
constructor(stackMemoryRetrieval, config = {}) {
|
|
43
39
|
this.stackMemoryRetrieval = stackMemoryRetrieval;
|
|
44
|
-
this.diffMemHooks = diffMemHooks;
|
|
45
40
|
this.config = { ...DEFAULT_UNIFIED_CONTEXT_CONFIG, ...config };
|
|
46
41
|
this.privacyFilter = createPrivacyFilter(this.config.privacyMode);
|
|
47
42
|
const totalAllocation = this.config.userKnowledgeBudget + this.config.taskContextBudget + this.config.systemContextBudget;
|
|
@@ -69,11 +64,10 @@ class UnifiedContextAssembler {
|
|
|
69
64
|
const systemContextBudget = Math.floor(
|
|
70
65
|
this.config.totalTokenBudget * this.config.systemContextBudget
|
|
71
66
|
);
|
|
72
|
-
const {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
} = await this.gatherUserKnowledge(query, userKnowledgeBudget);
|
|
67
|
+
const { content: userKnowledge } = await this.gatherUserKnowledge(
|
|
68
|
+
query,
|
|
69
|
+
userKnowledgeBudget
|
|
70
|
+
);
|
|
77
71
|
const userKnowledgeFiltered = this.privacyFilter.filter(userKnowledge);
|
|
78
72
|
totalPrivacyFiltered += userKnowledgeFiltered.redactedCount;
|
|
79
73
|
const filteredUserKnowledge = truncateToTokenBudget(
|
|
@@ -110,8 +104,6 @@ class UnifiedContextAssembler {
|
|
|
110
104
|
budget: this.config.totalTokenBudget
|
|
111
105
|
};
|
|
112
106
|
const metadata = {
|
|
113
|
-
diffMemAvailable,
|
|
114
|
-
diffMemMemories,
|
|
115
107
|
stackMemoryFrames: frameCount,
|
|
116
108
|
privacyFiltered: totalPrivacyFiltered
|
|
117
109
|
};
|
|
@@ -131,53 +123,10 @@ class UnifiedContextAssembler {
|
|
|
131
123
|
};
|
|
132
124
|
}
|
|
133
125
|
/**
|
|
134
|
-
* Gather user knowledge
|
|
135
|
-
*/
|
|
136
|
-
async gatherUserKnowledge(query, tokenBudget) {
|
|
137
|
-
if (!this.diffMemHooks) {
|
|
138
|
-
return { content: "", memories: 0, available: false };
|
|
139
|
-
}
|
|
140
|
-
try {
|
|
141
|
-
const status = await this.diffMemHooks.getStatus();
|
|
142
|
-
if (!status.connected) {
|
|
143
|
-
logger.debug("DiffMem not connected");
|
|
144
|
-
return { content: "", memories: 0, available: false };
|
|
145
|
-
}
|
|
146
|
-
const memories = await this.diffMemHooks.getRelevantMemories(query, 10);
|
|
147
|
-
if (memories.length === 0) {
|
|
148
|
-
return { content: "", memories: 0, available: true };
|
|
149
|
-
}
|
|
150
|
-
const sections = ["## User Knowledge"];
|
|
151
|
-
const byCategory = /* @__PURE__ */ new Map();
|
|
152
|
-
for (const memory of memories) {
|
|
153
|
-
const existing = byCategory.get(memory.category) || [];
|
|
154
|
-
existing.push(memory);
|
|
155
|
-
byCategory.set(memory.category, existing);
|
|
156
|
-
}
|
|
157
|
-
for (const [category, categoryMemories] of byCategory) {
|
|
158
|
-
sections.push(`
|
|
159
|
-
### ${this.formatCategory(category)}`);
|
|
160
|
-
for (const memory of categoryMemories) {
|
|
161
|
-
const confidence = memory.confidence >= 0.8 ? "(high confidence)" : memory.confidence >= 0.5 ? "" : "(tentative)";
|
|
162
|
-
sections.push(`- ${memory.content} ${confidence}`);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
const content = sections.join("\n");
|
|
166
|
-
return {
|
|
167
|
-
content: truncateToTokenBudget(content, tokenBudget),
|
|
168
|
-
memories: memories.length,
|
|
169
|
-
available: true
|
|
170
|
-
};
|
|
171
|
-
} catch (error) {
|
|
172
|
-
logger.warn("Failed to gather user knowledge from DiffMem", { error });
|
|
173
|
-
return { content: "", memories: 0, available: false };
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Format category name for display
|
|
126
|
+
* Gather user knowledge (stub — memory service removed in v1.14)
|
|
178
127
|
*/
|
|
179
|
-
|
|
180
|
-
return
|
|
128
|
+
async gatherUserKnowledge(_query, _tokenBudget) {
|
|
129
|
+
return { content: "", memories: 0, available: false };
|
|
181
130
|
}
|
|
182
131
|
/**
|
|
183
132
|
* Gather task context from StackMemory
|
|
@@ -258,12 +207,8 @@ class UnifiedContextAssembler {
|
|
|
258
207
|
}
|
|
259
208
|
}
|
|
260
209
|
}
|
|
261
|
-
function createUnifiedContextAssembler(stackMemoryRetrieval,
|
|
262
|
-
return new UnifiedContextAssembler(
|
|
263
|
-
stackMemoryRetrieval,
|
|
264
|
-
diffMemHooks,
|
|
265
|
-
config
|
|
266
|
-
);
|
|
210
|
+
function createUnifiedContextAssembler(stackMemoryRetrieval, config = {}) {
|
|
211
|
+
return new UnifiedContextAssembler(stackMemoryRetrieval, config);
|
|
267
212
|
}
|
|
268
213
|
export {
|
|
269
214
|
DEFAULT_UNIFIED_CONTEXT_CONFIG,
|
|
@@ -37,6 +37,18 @@ const SkillPackExampleSchema = z.object({
|
|
|
37
37
|
input: z.string().min(1),
|
|
38
38
|
output: z.string().min(1)
|
|
39
39
|
});
|
|
40
|
+
const KnownLicenseSchema = z.enum([
|
|
41
|
+
"MIT",
|
|
42
|
+
"Apache-2.0",
|
|
43
|
+
"ISC",
|
|
44
|
+
"BSD-2-Clause",
|
|
45
|
+
"BSD-3-Clause",
|
|
46
|
+
"CC-BY-4.0",
|
|
47
|
+
"CC-BY-SA-4.0",
|
|
48
|
+
"CC0-1.0",
|
|
49
|
+
"UNLICENSED"
|
|
50
|
+
]);
|
|
51
|
+
const LicenseSchema = KnownLicenseSchema.or(z.string().min(1));
|
|
40
52
|
const PackNameSchema = z.string().min(1).regex(
|
|
41
53
|
/^[\w-]+\/[\w-]+$/,
|
|
42
54
|
'name must be namespace/pack-name (e.g. "coding/typescript-react")'
|
|
@@ -46,7 +58,7 @@ const SkillPackManifestSchema = z.object({
|
|
|
46
58
|
version: SemverSchema,
|
|
47
59
|
description: z.string().min(1),
|
|
48
60
|
author: z.string().min(1),
|
|
49
|
-
license:
|
|
61
|
+
license: LicenseSchema.default("MIT"),
|
|
50
62
|
runtime: SkillPackRuntimeSchema.optional(),
|
|
51
63
|
ingestion: SkillPackIngestionSchema.optional(),
|
|
52
64
|
ontology: SkillPackOntologySchema.optional(),
|
|
@@ -55,6 +67,7 @@ const SkillPackManifestSchema = z.object({
|
|
|
55
67
|
instructions: z.string().optional()
|
|
56
68
|
});
|
|
57
69
|
export {
|
|
70
|
+
KnownLicenseSchema,
|
|
58
71
|
SkillPackExampleSchema,
|
|
59
72
|
SkillPackIngestionSchema,
|
|
60
73
|
SkillPackManifestSchema,
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
2
|
+
import { dirname as __pathDirname } from 'path';
|
|
3
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
4
|
+
const __dirname = __pathDirname(__filename);
|
|
5
|
+
import { EventEmitter } from "events";
|
|
6
|
+
import { CloudSyncEngine } from "./cloud-sync.js";
|
|
7
|
+
import { logger } from "../monitoring/logger.js";
|
|
8
|
+
class CloudSyncManager extends EventEmitter {
|
|
9
|
+
engine;
|
|
10
|
+
config;
|
|
11
|
+
periodicTimer;
|
|
12
|
+
debounceTimer;
|
|
13
|
+
running = false;
|
|
14
|
+
constructor(db, config) {
|
|
15
|
+
super();
|
|
16
|
+
this.config = config;
|
|
17
|
+
this.engine = new CloudSyncEngine(db, config);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Start the sync manager (periodic sync if configured)
|
|
21
|
+
*/
|
|
22
|
+
start() {
|
|
23
|
+
if (this.running) return;
|
|
24
|
+
this.running = true;
|
|
25
|
+
if (this.config.autoSync && this.config.syncIntervalMs > 0) {
|
|
26
|
+
this.periodicTimer = setInterval(() => {
|
|
27
|
+
this.performPush("periodic").catch(
|
|
28
|
+
(e) => logger.error("Periodic cloud sync failed", { error: String(e) })
|
|
29
|
+
);
|
|
30
|
+
}, this.config.syncIntervalMs);
|
|
31
|
+
}
|
|
32
|
+
logger.info("Cloud sync manager started", {
|
|
33
|
+
autoSync: this.config.autoSync,
|
|
34
|
+
intervalMs: this.config.syncIntervalMs
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Stop the sync manager
|
|
39
|
+
*/
|
|
40
|
+
stop() {
|
|
41
|
+
if (!this.running) return;
|
|
42
|
+
this.running = false;
|
|
43
|
+
if (this.periodicTimer) {
|
|
44
|
+
clearInterval(this.periodicTimer);
|
|
45
|
+
this.periodicTimer = void 0;
|
|
46
|
+
}
|
|
47
|
+
if (this.debounceTimer) {
|
|
48
|
+
clearTimeout(this.debounceTimer);
|
|
49
|
+
this.debounceTimer = void 0;
|
|
50
|
+
}
|
|
51
|
+
logger.info("Cloud sync manager stopped");
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Schedule a debounced push (used by frame lifecycle hooks)
|
|
55
|
+
*/
|
|
56
|
+
scheduleDebouncedPush(trigger) {
|
|
57
|
+
if (!this.config.enabled || !this.running) return;
|
|
58
|
+
if (this.debounceTimer) {
|
|
59
|
+
clearTimeout(this.debounceTimer);
|
|
60
|
+
}
|
|
61
|
+
this.debounceTimer = setTimeout(() => {
|
|
62
|
+
this.debounceTimer = void 0;
|
|
63
|
+
this.performPush(trigger).catch(
|
|
64
|
+
(e) => logger.error("Debounced cloud sync push failed", {
|
|
65
|
+
error: String(e)
|
|
66
|
+
})
|
|
67
|
+
);
|
|
68
|
+
}, this.config.debounceMs);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Perform a push
|
|
72
|
+
*/
|
|
73
|
+
async performPush(trigger, force = false) {
|
|
74
|
+
const result = await this.engine.push(force);
|
|
75
|
+
this.emit("push", { trigger, result });
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Perform a pull
|
|
80
|
+
*/
|
|
81
|
+
async performPull(trigger, tables) {
|
|
82
|
+
const result = await this.engine.pull(tables);
|
|
83
|
+
this.emit("pull", { trigger, result });
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Get sync status
|
|
88
|
+
*/
|
|
89
|
+
getStatus() {
|
|
90
|
+
return this.engine.status();
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Check if manager is running
|
|
94
|
+
*/
|
|
95
|
+
isRunning() {
|
|
96
|
+
return this.running;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const DEFAULT_SYNC_MANAGER_CONFIG = {
|
|
100
|
+
batchSize: 100,
|
|
101
|
+
conflictResolution: "newest_wins",
|
|
102
|
+
generationalPolicy: {
|
|
103
|
+
youngMaxAgeDays: 1,
|
|
104
|
+
matureMaxAgeDays: 7
|
|
105
|
+
},
|
|
106
|
+
timeoutMs: 3e4,
|
|
107
|
+
retryAttempts: 3,
|
|
108
|
+
retryBaseDelayMs: 1e3,
|
|
109
|
+
autoSync: false,
|
|
110
|
+
syncIntervalMs: 0,
|
|
111
|
+
debounceMs: 5e3
|
|
112
|
+
};
|
|
113
|
+
export {
|
|
114
|
+
CloudSyncManager,
|
|
115
|
+
DEFAULT_SYNC_MANAGER_CONFIG
|
|
116
|
+
};
|