@stackmemoryai/stackmemory 1.7.0 → 1.8.1
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/dist/src/agents/core/agent-task-manager.js +3 -3
- package/dist/src/agents/verifiers/formatter-verifier.js +1 -1
- package/dist/src/agents/verifiers/llm-judge.js +2 -2
- package/dist/src/cli/commands/context-rehydrate.js +2 -2
- package/dist/src/cli/commands/log.js +1 -1
- package/dist/src/cli/commands/onboard.js +4 -4
- package/dist/src/cli/commands/search.js +3 -3
- package/dist/src/cli/commands/setup.js +1 -1
- package/dist/src/cli/commands/signup.js +1 -1
- package/dist/src/cli/commands/skills.js +2 -2
- package/dist/src/cli/commands/worktree.js +1 -1
- package/dist/src/core/config/config-manager.js +3 -1
- package/dist/src/core/config/types.js +7 -0
- package/dist/src/core/context/dual-stack-manager.js +2 -2
- package/dist/src/core/context/frame-database.js +38 -0
- package/dist/src/core/context/frame-enrichment.js +93 -0
- package/dist/src/core/context/frame-handoff-manager.js +1 -1
- package/dist/src/core/context/frame-manager.js +4 -4
- package/dist/src/core/context/rehydration.js +6 -6
- package/dist/src/core/database/sqlite-adapter.js +136 -15
- package/dist/src/core/digest/frame-digest-integration.js +1 -1
- package/dist/src/core/digest/hybrid-digest-generator.js +1 -1
- package/dist/src/core/digest/hybrid-digest.js +3 -3
- package/dist/src/core/errors/recovery.js +1 -1
- package/dist/src/core/extensions/loader.js +10 -10
- package/dist/src/core/extensions/plugin-system.js +1 -1
- package/dist/src/core/monitoring/logger.js +2 -2
- package/dist/src/core/monitoring/metrics.js +2 -2
- package/dist/src/core/monitoring/progress-tracker.js +2 -2
- package/dist/src/core/performance/lazy-context-loader.js +1 -1
- package/dist/src/core/performance/performance-benchmark.js +8 -8
- package/dist/src/core/performance/performance-profiler.js +2 -2
- package/dist/src/core/performance/streaming-jsonl-parser.js +1 -1
- package/dist/src/core/projects/project-isolation.js +1 -1
- package/dist/src/core/projects/project-manager.js +5 -5
- package/dist/src/core/session/clear-survival.js +3 -3
- package/dist/src/core/session/handoff-generator.js +1 -1
- package/dist/src/core/session/session-manager.js +4 -4
- package/dist/src/core/skills/skill-storage.js +2 -2
- package/dist/src/core/storage/remote-storage.js +2 -2
- package/dist/src/core/trace/cli-trace-wrapper.js +3 -3
- package/dist/src/core/trace/debug-trace.js +2 -2
- package/dist/src/core/trace/trace-detector.js +1 -1
- package/dist/src/core/worktree/worktree-manager.js +2 -2
- package/dist/src/features/analytics/api/analytics-api.js +1 -1
- package/dist/src/features/analytics/core/analytics-service.js +2 -2
- package/dist/src/features/analytics/queries/metrics-queries.js +1 -1
- package/dist/src/features/web/server/index.js +8 -8
- package/dist/src/integrations/anthropic/client.js +4 -4
- package/dist/src/integrations/claude-code/post-task-hooks.js +3 -3
- package/dist/src/integrations/claude-code/subagent-client.js +2 -2
- package/dist/src/integrations/diffmem/client.js +1 -1
- package/dist/src/integrations/linear/client.js +1 -1
- package/dist/src/integrations/linear/migration.js +1 -1
- package/dist/src/integrations/linear/oauth-server.js +2 -2
- package/dist/src/integrations/linear/sync.js +1 -1
- package/dist/src/integrations/linear/webhook-handler.js +2 -2
- package/dist/src/integrations/linear/webhook-server.js +2 -2
- package/dist/src/integrations/linear/webhook.js +2 -2
- package/dist/src/integrations/mcp/handlers/discovery-handlers.js +3 -3
- package/dist/src/integrations/mcp/handlers/linear-handlers.js +1 -1
- package/dist/src/integrations/mcp/handlers/skill-handlers.js +2 -2
- package/dist/src/integrations/mcp/handlers/task-handlers.js +2 -2
- package/dist/src/integrations/mcp/handlers/trace-handlers.js +1 -1
- package/dist/src/integrations/mcp/refactored-server.js +2 -2
- package/dist/src/integrations/mcp/remote-server.js +1 -1
- package/dist/src/integrations/mcp/server.js +4 -4
- package/dist/src/integrations/ralph/bridge/ralph-stackmemory-bridge.js +13 -13
- package/dist/src/integrations/ralph/context/stackmemory-context-loader.js +1 -1
- package/dist/src/integrations/ralph/learning/pattern-learner.js +3 -3
- package/dist/src/integrations/ralph/orchestration/multi-loop-orchestrator.js +1 -1
- package/dist/src/integrations/ralph/patterns/compounding-engineering-pattern.js +2 -2
- package/dist/src/integrations/ralph/patterns/extended-coherence-sessions.js +19 -19
- package/dist/src/integrations/ralph/patterns/oracle-worker-pattern.js +5 -5
- package/dist/src/integrations/ralph/performance/performance-optimizer.js +1 -1
- package/dist/src/integrations/ralph/recovery/crash-recovery.js +1 -1
- package/dist/src/integrations/ralph/state/state-reconciler.js +1 -1
- package/dist/src/integrations/ralph/swarm/git-workflow-manager.js +4 -4
- package/dist/src/integrations/ralph/swarm/swarm-coordinator.js +8 -8
- package/dist/src/integrations/ralph/visualization/ralph-debugger.js +3 -3
- package/dist/src/orchestrators/multimodal/harness.js +3 -3
- package/dist/src/servers/production/auth-middleware.js +2 -2
- package/package.json +1 -1
|
@@ -313,7 +313,7 @@ class HybridDigestGenerator {
|
|
|
313
313
|
* Determine priority based on frame characteristics
|
|
314
314
|
*/
|
|
315
315
|
determinePriority(input) {
|
|
316
|
-
const {
|
|
316
|
+
const { _frame, anchors, events } = input;
|
|
317
317
|
const decisionCount = anchors.filter((a) => a.type === "DECISION").length;
|
|
318
318
|
const errorCount = events.filter(
|
|
319
319
|
(e) => e.payload?.error || e.payload?.success === false
|
|
@@ -119,7 +119,7 @@ class EnhancedHybridDigestGenerator extends HybridDigestGenerator {
|
|
|
119
119
|
if (!this.llmProvider) {
|
|
120
120
|
throw new Error("No LLM provider configured");
|
|
121
121
|
}
|
|
122
|
-
const
|
|
122
|
+
const _prompt = this.buildEnhancedPrompt(input, deterministic);
|
|
123
123
|
const response = await this.llmProvider.generateSummary(
|
|
124
124
|
input,
|
|
125
125
|
deterministic,
|
|
@@ -162,7 +162,7 @@ class EnhancedHybridDigestGenerator extends HybridDigestGenerator {
|
|
|
162
162
|
/**
|
|
163
163
|
* Extract key decisions from AI response
|
|
164
164
|
*/
|
|
165
|
-
extractKeyDecisions(
|
|
165
|
+
extractKeyDecisions(_response) {
|
|
166
166
|
return [];
|
|
167
167
|
}
|
|
168
168
|
/**
|
|
@@ -178,7 +178,7 @@ class EnhancedHybridDigestGenerator extends HybridDigestGenerator {
|
|
|
178
178
|
/**
|
|
179
179
|
* Extract next steps from AI response
|
|
180
180
|
*/
|
|
181
|
-
extractNextSteps(
|
|
181
|
+
extractNextSteps(_response) {
|
|
182
182
|
return [];
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
@@ -155,7 +155,7 @@ class ExtensionLoader {
|
|
|
155
155
|
/**
|
|
156
156
|
* Load extension from source based on type
|
|
157
157
|
*/
|
|
158
|
-
async loadFromSource(type, uri,
|
|
158
|
+
async loadFromSource(type, uri, _options) {
|
|
159
159
|
switch (type) {
|
|
160
160
|
case "url":
|
|
161
161
|
return this.loadFromUrl(uri);
|
|
@@ -277,7 +277,7 @@ class ExtensionLoader {
|
|
|
277
277
|
*/
|
|
278
278
|
async loadFromNpm(packageName) {
|
|
279
279
|
try {
|
|
280
|
-
const { name,
|
|
280
|
+
const { name, _version } = this.parseNpmPackage(packageName);
|
|
281
281
|
let module;
|
|
282
282
|
try {
|
|
283
283
|
module = await import(name);
|
|
@@ -295,7 +295,7 @@ class ExtensionLoader {
|
|
|
295
295
|
const entryPoint = packageJson.main || "index.js";
|
|
296
296
|
const entryPath = path.join(nodeModulesPath, entryPoint);
|
|
297
297
|
module = await import(pathToFileURL(entryPath).href);
|
|
298
|
-
} catch
|
|
298
|
+
} catch {
|
|
299
299
|
return {
|
|
300
300
|
success: false,
|
|
301
301
|
error: `Package not found: ${name}. Try running: npm install ${name}`
|
|
@@ -321,7 +321,7 @@ class ExtensionLoader {
|
|
|
321
321
|
/**
|
|
322
322
|
* Evaluate extension code (for URL sources)
|
|
323
323
|
*/
|
|
324
|
-
async evaluateExtensionCode(code,
|
|
324
|
+
async evaluateExtensionCode(code, _sourceUrl) {
|
|
325
325
|
const dataUrl = `data:text/javascript;base64,${Buffer.from(code).toString("base64")}`;
|
|
326
326
|
try {
|
|
327
327
|
const module = await import(dataUrl);
|
|
@@ -473,12 +473,12 @@ class ExtensionLoader {
|
|
|
473
473
|
permissions,
|
|
474
474
|
// State management (always available, scoped to extension)
|
|
475
475
|
state: {
|
|
476
|
-
get: async (
|
|
476
|
+
get: async (_key) => {
|
|
477
477
|
return void 0;
|
|
478
478
|
},
|
|
479
|
-
set: async (
|
|
479
|
+
set: async (_key, _value) => {
|
|
480
480
|
},
|
|
481
|
-
delete: async (
|
|
481
|
+
delete: async (_key) => {
|
|
482
482
|
}
|
|
483
483
|
},
|
|
484
484
|
// Sandboxed fetch (always available)
|
|
@@ -511,7 +511,7 @@ class ExtensionLoader {
|
|
|
511
511
|
};
|
|
512
512
|
if (permSet.has("frames:read") || permSet.has("frames:write")) {
|
|
513
513
|
context.frames = {
|
|
514
|
-
get: async (
|
|
514
|
+
get: async (_frameId) => {
|
|
515
515
|
return void 0;
|
|
516
516
|
},
|
|
517
517
|
list: async () => {
|
|
@@ -519,10 +519,10 @@ class ExtensionLoader {
|
|
|
519
519
|
}
|
|
520
520
|
};
|
|
521
521
|
if (permSet.has("frames:write")) {
|
|
522
|
-
context.frames.create = async (
|
|
522
|
+
context.frames.create = async (_options) => {
|
|
523
523
|
throw new Error("Frame creation not implemented");
|
|
524
524
|
};
|
|
525
|
-
context.frames.update = async (
|
|
525
|
+
context.frames.update = async (_frameId, _data) => {
|
|
526
526
|
throw new Error("Frame update not implemented");
|
|
527
527
|
};
|
|
528
528
|
}
|
|
@@ -362,7 +362,7 @@ function createLinearPlugin() {
|
|
|
362
362
|
context.logger.info(`Sync complete: ${frames.length} frames`);
|
|
363
363
|
return frames;
|
|
364
364
|
},
|
|
365
|
-
watch(
|
|
365
|
+
watch(_callback) {
|
|
366
366
|
context?.logger.info("Watch mode enabled");
|
|
367
367
|
return () => {
|
|
368
368
|
context?.logger.info("Watch mode disabled");
|
|
@@ -112,7 +112,7 @@ class Logger {
|
|
|
112
112
|
if (!fs.existsSync(logDir)) {
|
|
113
113
|
fs.mkdirSync(logDir, { recursive: true });
|
|
114
114
|
}
|
|
115
|
-
} catch
|
|
115
|
+
} catch {
|
|
116
116
|
this.logFile = void 0;
|
|
117
117
|
if (!this.fileLoggingDisabledNotified) {
|
|
118
118
|
this.fileLoggingDisabledNotified = true;
|
|
@@ -131,7 +131,7 @@ class Logger {
|
|
|
131
131
|
if (this.logFile) {
|
|
132
132
|
try {
|
|
133
133
|
fs.appendFileSync(this.logFile, logLine);
|
|
134
|
-
} catch
|
|
134
|
+
} catch {
|
|
135
135
|
this.logFile = void 0;
|
|
136
136
|
if (!this.fileLoggingDisabledNotified) {
|
|
137
137
|
this.fileLoggingDisabledNotified = true;
|
|
@@ -6,7 +6,7 @@ import { EventEmitter } from "events";
|
|
|
6
6
|
import * as fs from "fs";
|
|
7
7
|
import * as path from "path";
|
|
8
8
|
import { logger } from "./logger.js";
|
|
9
|
-
function
|
|
9
|
+
function _getEnv(key, defaultValue) {
|
|
10
10
|
const value = process.env[key];
|
|
11
11
|
if (value === void 0) {
|
|
12
12
|
if (defaultValue !== void 0) return defaultValue;
|
|
@@ -14,7 +14,7 @@ function getEnv(key, defaultValue) {
|
|
|
14
14
|
}
|
|
15
15
|
return value;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function _getOptionalEnv(key) {
|
|
18
18
|
return process.env[key];
|
|
19
19
|
}
|
|
20
20
|
class MetricsCollector extends EventEmitter {
|
|
@@ -4,7 +4,7 @@ const __filename = __fileURLToPath(import.meta.url);
|
|
|
4
4
|
const __dirname = __pathDirname(__filename);
|
|
5
5
|
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
6
6
|
import { join } from "path";
|
|
7
|
-
function
|
|
7
|
+
function _getEnv(key, defaultValue) {
|
|
8
8
|
const value = process.env[key];
|
|
9
9
|
if (value === void 0) {
|
|
10
10
|
if (defaultValue !== void 0) return defaultValue;
|
|
@@ -12,7 +12,7 @@ function getEnv(key, defaultValue) {
|
|
|
12
12
|
}
|
|
13
13
|
return value;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function _getOptionalEnv(key) {
|
|
16
16
|
return process.env[key];
|
|
17
17
|
}
|
|
18
18
|
class ProgressTracker {
|
|
@@ -89,14 +89,14 @@ class PerformanceBenchmark {
|
|
|
89
89
|
}
|
|
90
90
|
const populateDuration = performance.now() - populateStart;
|
|
91
91
|
const accessStart = performance.now();
|
|
92
|
-
let
|
|
93
|
-
let
|
|
92
|
+
let _hits = 0;
|
|
93
|
+
let _misses = 0;
|
|
94
94
|
for (let i = 0; i < accessPatterns; i++) {
|
|
95
95
|
const index = Math.floor(Math.random() * itemCount * 1.2);
|
|
96
96
|
const key = `item-${index}`;
|
|
97
97
|
const result2 = cache.get(key);
|
|
98
|
-
if (result2)
|
|
99
|
-
else
|
|
98
|
+
if (result2) _hits++;
|
|
99
|
+
else _misses++;
|
|
100
100
|
}
|
|
101
101
|
const accessDuration = performance.now() - accessStart;
|
|
102
102
|
const stats = cache.getStats();
|
|
@@ -134,7 +134,7 @@ class PerformanceBenchmark {
|
|
|
134
134
|
let frames = [];
|
|
135
135
|
try {
|
|
136
136
|
frames = db.prepare("SELECT id FROM frames ORDER BY updated_at DESC LIMIT ?").all(frameCount);
|
|
137
|
-
} catch
|
|
137
|
+
} catch {
|
|
138
138
|
logger.warn("Frames table not found, using mock data for benchmark");
|
|
139
139
|
frames = Array.from({ length: Math.min(frameCount, 10) }, (_, i) => ({
|
|
140
140
|
id: `frame-${i}`
|
|
@@ -205,9 +205,9 @@ class PerformanceBenchmark {
|
|
|
205
205
|
const suiteStart = performance.now();
|
|
206
206
|
logger.info("Starting Performance Benchmark Suite");
|
|
207
207
|
const tasksFile = join(projectRoot, ".stackmemory", "tasks.jsonl");
|
|
208
|
-
const
|
|
209
|
-
const
|
|
210
|
-
const
|
|
208
|
+
const _jsonlResult = await this.benchmarkJSONLParsing(tasksFile);
|
|
209
|
+
const _cacheResult = await this.benchmarkContextCache();
|
|
210
|
+
const _lazyResult = await this.benchmarkLazyLoading(db, projectId);
|
|
211
211
|
const totalDuration = performance.now() - suiteStart;
|
|
212
212
|
const averageImprovement = this.results.filter((r) => r.improvement !== void 0).reduce((sum, r) => sum + (r.improvement || 0), 0) / this.results.filter((r) => r.improvement !== void 0).length;
|
|
213
213
|
const suite = {
|
|
@@ -4,7 +4,7 @@ const __filename = __fileURLToPath(import.meta.url);
|
|
|
4
4
|
const __dirname = __pathDirname(__filename);
|
|
5
5
|
import { logger } from "../monitoring/logger.js";
|
|
6
6
|
import { getQueryStatistics } from "../trace/db-trace-wrapper.js";
|
|
7
|
-
function
|
|
7
|
+
function _getEnv(key, defaultValue) {
|
|
8
8
|
const value = process.env[key];
|
|
9
9
|
if (value === void 0) {
|
|
10
10
|
if (defaultValue !== void 0) return defaultValue;
|
|
@@ -12,7 +12,7 @@ function getEnv(key, defaultValue) {
|
|
|
12
12
|
}
|
|
13
13
|
return value;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function _getOptionalEnv(key) {
|
|
16
16
|
return process.env[key];
|
|
17
17
|
}
|
|
18
18
|
class PerformanceProfiler {
|
|
@@ -7,7 +7,7 @@ import { createInterface } from "readline";
|
|
|
7
7
|
import { Transform, pipeline } from "stream";
|
|
8
8
|
import { promisify } from "util";
|
|
9
9
|
import { logger } from "../monitoring/logger.js";
|
|
10
|
-
const
|
|
10
|
+
const _pipelineAsync = promisify(pipeline);
|
|
11
11
|
class StreamingJSONLParser {
|
|
12
12
|
DEFAULT_BATCH_SIZE = 100;
|
|
13
13
|
DEFAULT_MAX_LINE_LENGTH = 1024 * 1024;
|
|
@@ -79,7 +79,7 @@ class ProjectManager {
|
|
|
79
79
|
});
|
|
80
80
|
return project;
|
|
81
81
|
} catch (error) {
|
|
82
|
-
const
|
|
82
|
+
const _wrappedError = errorHandler(error, {
|
|
83
83
|
projectPath: path,
|
|
84
84
|
operation: "detectProject"
|
|
85
85
|
});
|
|
@@ -120,7 +120,7 @@ class ProjectManager {
|
|
|
120
120
|
*/
|
|
121
121
|
getGitInfo(projectPath) {
|
|
122
122
|
const info = {};
|
|
123
|
-
const
|
|
123
|
+
const _errorHandler = createErrorHandler({
|
|
124
124
|
operation: "getGitInfo",
|
|
125
125
|
projectPath
|
|
126
126
|
});
|
|
@@ -349,7 +349,7 @@ class ProjectManager {
|
|
|
349
349
|
CREATE INDEX IF NOT EXISTS idx_contexts_project ON project_contexts(project_id);
|
|
350
350
|
`);
|
|
351
351
|
} catch (error) {
|
|
352
|
-
const
|
|
352
|
+
const _dbError = errorHandler(error, {
|
|
353
353
|
dbPath,
|
|
354
354
|
operation: "initializeDatabase"
|
|
355
355
|
});
|
|
@@ -450,7 +450,7 @@ class ProjectManager {
|
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
452
|
} catch (error) {
|
|
453
|
-
const
|
|
453
|
+
const _wrappedError = errorHandler(error, {
|
|
454
454
|
operation: "autoDiscoverOrganizations"
|
|
455
455
|
});
|
|
456
456
|
logger.error(
|
|
@@ -604,7 +604,7 @@ class ProjectManager {
|
|
|
604
604
|
`);
|
|
605
605
|
stmt.run(org.name, org.type, org.accountType, JSON.stringify(org));
|
|
606
606
|
} catch (error) {
|
|
607
|
-
const
|
|
607
|
+
const _wrappedError = errorHandler(error, {
|
|
608
608
|
orgName: org.name,
|
|
609
609
|
operation: "saveOrganization"
|
|
610
610
|
});
|
|
@@ -31,7 +31,7 @@ class ClearSurvival {
|
|
|
31
31
|
try {
|
|
32
32
|
const frames = await this.frameManager.getAllFrames();
|
|
33
33
|
const activeFrames = frames.filter((f) => f.status === "open").length;
|
|
34
|
-
const
|
|
34
|
+
const _sessionId = await this.dbManager.getCurrentSessionId();
|
|
35
35
|
const estimatedTokens = frames.length * 100;
|
|
36
36
|
const maxTokens = 1e4;
|
|
37
37
|
const percentageUsed = Math.min(100, estimatedTokens / maxTokens * 100);
|
|
@@ -41,7 +41,7 @@ class ClearSurvival {
|
|
|
41
41
|
sessionCount: 1,
|
|
42
42
|
percentageUsed
|
|
43
43
|
};
|
|
44
|
-
} catch
|
|
44
|
+
} catch {
|
|
45
45
|
return {
|
|
46
46
|
totalFrames: 50,
|
|
47
47
|
activeFrames: 3,
|
|
@@ -405,7 +405,7 @@ class ClearSurvival {
|
|
|
405
405
|
);
|
|
406
406
|
const content = await fs.readFile(latestPath, "utf-8");
|
|
407
407
|
return JSON.parse(content);
|
|
408
|
-
} catch
|
|
408
|
+
} catch {
|
|
409
409
|
return null;
|
|
410
410
|
}
|
|
411
411
|
}
|
|
@@ -293,7 +293,7 @@ class HandoffGenerator {
|
|
|
293
293
|
extractSuccessfulStrategies(approaches) {
|
|
294
294
|
return approaches.filter((a) => a.outcome === "successful").map((a) => a.approach);
|
|
295
295
|
}
|
|
296
|
-
async suggestNextActions(tasks, blockers,
|
|
296
|
+
async suggestNextActions(tasks, blockers, _framePath) {
|
|
297
297
|
const suggestions = [];
|
|
298
298
|
const inProgress = tasks.filter((t) => t.status === "in_progress");
|
|
299
299
|
if (inProgress.length > 0) {
|
|
@@ -7,7 +7,7 @@ import * as fs from "fs/promises";
|
|
|
7
7
|
import * as path from "path";
|
|
8
8
|
import { logger } from "../monitoring/logger.js";
|
|
9
9
|
import { SystemError, ErrorCode } from "../errors/index.js";
|
|
10
|
-
function
|
|
10
|
+
function _getEnv(key, defaultValue) {
|
|
11
11
|
const value = process.env[key];
|
|
12
12
|
if (value === void 0) {
|
|
13
13
|
if (defaultValue !== void 0) return defaultValue;
|
|
@@ -15,7 +15,7 @@ function getEnv(key, defaultValue) {
|
|
|
15
15
|
}
|
|
16
16
|
return value;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function _getOptionalEnv(key) {
|
|
19
19
|
return process.env[key];
|
|
20
20
|
}
|
|
21
21
|
var FrameQueryMode = /* @__PURE__ */ ((FrameQueryMode2) => {
|
|
@@ -132,7 +132,7 @@ class SessionManager {
|
|
|
132
132
|
const sessionPath = path.join(this.sessionsDir, `${sessionId}.json`);
|
|
133
133
|
const data = await fs.readFile(sessionPath, "utf-8");
|
|
134
134
|
return JSON.parse(data);
|
|
135
|
-
} catch
|
|
135
|
+
} catch {
|
|
136
136
|
try {
|
|
137
137
|
const historyPath = path.join(
|
|
138
138
|
this.sessionsDir,
|
|
@@ -264,7 +264,7 @@ class SessionManager {
|
|
|
264
264
|
async getProjectHash(projectPath) {
|
|
265
265
|
try {
|
|
266
266
|
const cwd = projectPath || process.cwd();
|
|
267
|
-
const
|
|
267
|
+
const _pathModule = await import("path");
|
|
268
268
|
let identifier;
|
|
269
269
|
try {
|
|
270
270
|
const { execSync } = await import("child_process");
|
|
@@ -6,7 +6,7 @@ import "dotenv/config";
|
|
|
6
6
|
import Redis from "ioredis";
|
|
7
7
|
import { v4 as uuidv4 } from "uuid";
|
|
8
8
|
import { logger } from "../monitoring/logger.js";
|
|
9
|
-
function
|
|
9
|
+
function _getEnv(key, defaultValue) {
|
|
10
10
|
const value = process.env[key];
|
|
11
11
|
if (value === void 0) {
|
|
12
12
|
if (defaultValue !== void 0) return defaultValue;
|
|
@@ -14,7 +14,7 @@ function getEnv(key, defaultValue) {
|
|
|
14
14
|
}
|
|
15
15
|
return value;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function _getOptionalEnv(key) {
|
|
18
18
|
return process.env[key];
|
|
19
19
|
}
|
|
20
20
|
import {
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "@aws-sdk/client-s3";
|
|
10
10
|
import { Storage } from "@google-cloud/storage";
|
|
11
11
|
import { logger } from "../monitoring/logger.js";
|
|
12
|
-
function
|
|
12
|
+
function _getEnv(key, defaultValue) {
|
|
13
13
|
const value = process.env[key];
|
|
14
14
|
if (value === void 0) {
|
|
15
15
|
if (defaultValue !== void 0) return defaultValue;
|
|
@@ -17,7 +17,7 @@ function getEnv(key, defaultValue) {
|
|
|
17
17
|
}
|
|
18
18
|
return value;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function _getOptionalEnv(key) {
|
|
21
21
|
return process.env[key];
|
|
22
22
|
}
|
|
23
23
|
var StorageTier = /* @__PURE__ */ ((StorageTier2) => {
|
|
@@ -4,7 +4,7 @@ const __filename = __fileURLToPath(import.meta.url);
|
|
|
4
4
|
const __dirname = __pathDirname(__filename);
|
|
5
5
|
import { trace } from "./debug-trace.js";
|
|
6
6
|
import { logger } from "../monitoring/logger.js";
|
|
7
|
-
function
|
|
7
|
+
function _getEnv(key, defaultValue) {
|
|
8
8
|
const value = process.env[key];
|
|
9
9
|
if (value === void 0) {
|
|
10
10
|
if (defaultValue !== void 0) return defaultValue;
|
|
@@ -12,7 +12,7 @@ function getEnv(key, defaultValue) {
|
|
|
12
12
|
}
|
|
13
13
|
return value;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function _getOptionalEnv(key) {
|
|
16
16
|
return process.env[key];
|
|
17
17
|
}
|
|
18
18
|
function wrapCommand(command) {
|
|
@@ -36,7 +36,7 @@ function wrapCommand(command) {
|
|
|
36
36
|
logger.info(`CLI Command: ${commandPath}`, context);
|
|
37
37
|
await trace.command(commandPath, context, async () => {
|
|
38
38
|
try {
|
|
39
|
-
const
|
|
39
|
+
const _result = await originalAction.apply(null, args);
|
|
40
40
|
logger.info(`CLI Command Completed: ${commandPath}`, {
|
|
41
41
|
duration: trace.exportTraces().find((t) => t.name === commandPath)?.duration
|
|
42
42
|
});
|
|
@@ -7,7 +7,7 @@ import { logger } from "../monitoring/logger.js";
|
|
|
7
7
|
import * as fs from "fs";
|
|
8
8
|
import * as path from "path";
|
|
9
9
|
import { v4 as uuidv4 } from "uuid";
|
|
10
|
-
function
|
|
10
|
+
function _getEnv(key, defaultValue) {
|
|
11
11
|
const value = process.env[key];
|
|
12
12
|
if (value === void 0) {
|
|
13
13
|
if (defaultValue !== void 0) return defaultValue;
|
|
@@ -15,7 +15,7 @@ function getEnv(key, defaultValue) {
|
|
|
15
15
|
}
|
|
16
16
|
return value;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function _getOptionalEnv(key) {
|
|
19
19
|
return process.env[key];
|
|
20
20
|
}
|
|
21
21
|
class TraceContext {
|
|
@@ -44,7 +44,7 @@ class TraceDetector {
|
|
|
44
44
|
* Add a tool call and check if it belongs to current trace
|
|
45
45
|
*/
|
|
46
46
|
addToolCall(tool) {
|
|
47
|
-
const
|
|
47
|
+
const _now = Date.now();
|
|
48
48
|
if (this.shouldStartNewTrace(tool)) {
|
|
49
49
|
if (this.activeTrace.length > 0) {
|
|
50
50
|
this.finalizeTrace();
|
|
@@ -186,7 +186,7 @@ class WorktreeManager {
|
|
|
186
186
|
branches: worktrees.map((w) => w.branch).filter(Boolean)
|
|
187
187
|
});
|
|
188
188
|
return worktrees;
|
|
189
|
-
} catch
|
|
189
|
+
} catch {
|
|
190
190
|
logger.debug("Not a git repository or git worktree not available");
|
|
191
191
|
return [];
|
|
192
192
|
}
|
|
@@ -380,7 +380,7 @@ class WorktreeManager {
|
|
|
380
380
|
/**
|
|
381
381
|
* Merge contexts into target database
|
|
382
382
|
*/
|
|
383
|
-
mergeContexts(contexts, targetDb,
|
|
383
|
+
mergeContexts(contexts, targetDb, _bidirectional) {
|
|
384
384
|
const stmt = targetDb.prepare(`
|
|
385
385
|
INSERT OR REPLACE INTO contexts (id, type, content, metadata, created_at)
|
|
386
386
|
VALUES (?, ?, ?, ?, ?)
|
|
@@ -9,7 +9,7 @@ import Database from "better-sqlite3";
|
|
|
9
9
|
import path from "path";
|
|
10
10
|
import fs from "fs";
|
|
11
11
|
import os from "os";
|
|
12
|
-
function
|
|
12
|
+
function _getEnv(key, defaultValue) {
|
|
13
13
|
const value = process.env[key];
|
|
14
14
|
if (value === void 0) {
|
|
15
15
|
if (defaultValue !== void 0) return defaultValue;
|
|
@@ -17,7 +17,7 @@ function getEnv(key, defaultValue) {
|
|
|
17
17
|
}
|
|
18
18
|
return value;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function _getOptionalEnv(key) {
|
|
21
21
|
return process.env[key];
|
|
22
22
|
}
|
|
23
23
|
class AnalyticsService {
|
|
@@ -52,7 +52,7 @@ class MetricsQueries {
|
|
|
52
52
|
CREATE INDEX IF NOT EXISTS idx_task_assignee ON task_analytics(assignee_id);
|
|
53
53
|
`);
|
|
54
54
|
} catch (error) {
|
|
55
|
-
const
|
|
55
|
+
const _dbError = errorHandler(error, {
|
|
56
56
|
operation: "initializeTables",
|
|
57
57
|
schema: "task_analytics"
|
|
58
58
|
});
|
|
@@ -12,7 +12,7 @@ import { FrameManager } from "../../../core/context/index.js";
|
|
|
12
12
|
import Database from "better-sqlite3";
|
|
13
13
|
import { existsSync } from "fs";
|
|
14
14
|
import { join } from "path";
|
|
15
|
-
function
|
|
15
|
+
function _getEnv(key, defaultValue) {
|
|
16
16
|
const value = process.env[key];
|
|
17
17
|
if (value === void 0) {
|
|
18
18
|
if (defaultValue !== void 0) return defaultValue;
|
|
@@ -20,7 +20,7 @@ function getEnv(key, defaultValue) {
|
|
|
20
20
|
}
|
|
21
21
|
return value;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function _getOptionalEnv(key) {
|
|
24
24
|
return process.env[key];
|
|
25
25
|
}
|
|
26
26
|
const app = express();
|
|
@@ -63,7 +63,7 @@ app.get("/api/tasks", (req, res) => {
|
|
|
63
63
|
try {
|
|
64
64
|
const tasks = taskReader.getTasks();
|
|
65
65
|
res.json({ tasks, total: tasks.length });
|
|
66
|
-
} catch
|
|
66
|
+
} catch {
|
|
67
67
|
res.status(500).json({ error: "Failed to fetch tasks" });
|
|
68
68
|
}
|
|
69
69
|
});
|
|
@@ -71,7 +71,7 @@ app.get("/api/tasks/active", (req, res) => {
|
|
|
71
71
|
try {
|
|
72
72
|
const tasks = taskReader.getActiveTasks();
|
|
73
73
|
res.json({ tasks, total: tasks.length });
|
|
74
|
-
} catch
|
|
74
|
+
} catch {
|
|
75
75
|
res.status(500).json({ error: "Failed to fetch active tasks" });
|
|
76
76
|
}
|
|
77
77
|
});
|
|
@@ -79,7 +79,7 @@ app.get("/api/tasks/by-state/:state", (req, res) => {
|
|
|
79
79
|
try {
|
|
80
80
|
const tasks = taskReader.getTasksByState(req.params.state);
|
|
81
81
|
res.json({ tasks, total: tasks.length });
|
|
82
|
-
} catch
|
|
82
|
+
} catch {
|
|
83
83
|
res.status(500).json({ error: "Failed to fetch tasks by state" });
|
|
84
84
|
}
|
|
85
85
|
});
|
|
@@ -87,7 +87,7 @@ app.get("/api/sessions", (req, res) => {
|
|
|
87
87
|
try {
|
|
88
88
|
const sessions = sessionManager?.getActiveSessions ? sessionManager.getActiveSessions() : [];
|
|
89
89
|
res.json({ sessions, total: sessions.length });
|
|
90
|
-
} catch
|
|
90
|
+
} catch {
|
|
91
91
|
res.status(500).json({ error: "Failed to fetch sessions" });
|
|
92
92
|
}
|
|
93
93
|
});
|
|
@@ -99,7 +99,7 @@ app.get("/api/frames", (req, res) => {
|
|
|
99
99
|
}
|
|
100
100
|
const frames = frameManager.getAllFrames();
|
|
101
101
|
res.json({ frames, total: frames.length });
|
|
102
|
-
} catch
|
|
102
|
+
} catch {
|
|
103
103
|
res.status(500).json({ error: "Failed to fetch frames" });
|
|
104
104
|
}
|
|
105
105
|
});
|
|
@@ -145,7 +145,7 @@ app.get("/api/analytics", (req, res) => {
|
|
|
145
145
|
}
|
|
146
146
|
};
|
|
147
147
|
res.json(analytics);
|
|
148
|
-
} catch
|
|
148
|
+
} catch {
|
|
149
149
|
res.status(500).json({ error: "Failed to fetch analytics" });
|
|
150
150
|
}
|
|
151
151
|
});
|
|
@@ -91,7 +91,7 @@ class AnthropicClient {
|
|
|
91
91
|
/**
|
|
92
92
|
* Mock response generators
|
|
93
93
|
*/
|
|
94
|
-
mockPlanningResponse(
|
|
94
|
+
mockPlanningResponse(_prompt) {
|
|
95
95
|
return JSON.stringify(
|
|
96
96
|
{
|
|
97
97
|
plan: {
|
|
@@ -135,7 +135,7 @@ class AnthropicClient {
|
|
|
135
135
|
2
|
|
136
136
|
);
|
|
137
137
|
}
|
|
138
|
-
mockCodeResponse(
|
|
138
|
+
mockCodeResponse(_prompt) {
|
|
139
139
|
return `
|
|
140
140
|
// Mock implementation
|
|
141
141
|
export function processTask(input: string): string {
|
|
@@ -149,7 +149,7 @@ export function validateInput(input: unknown): boolean {
|
|
|
149
149
|
}
|
|
150
150
|
`.trim();
|
|
151
151
|
}
|
|
152
|
-
mockTestingResponse(
|
|
152
|
+
mockTestingResponse(_prompt) {
|
|
153
153
|
return `
|
|
154
154
|
import { describe, test, expect } from 'vitest';
|
|
155
155
|
import { processTask, validateInput } from './implementation';
|
|
@@ -176,7 +176,7 @@ describe('validateInput', () => {
|
|
|
176
176
|
});
|
|
177
177
|
`.trim();
|
|
178
178
|
}
|
|
179
|
-
mockReviewResponse(
|
|
179
|
+
mockReviewResponse(_prompt) {
|
|
180
180
|
return JSON.stringify(
|
|
181
181
|
{
|
|
182
182
|
quality: 0.75,
|