@stackmemoryai/stackmemory 0.1.0 → 0.2.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/dist/scripts/initialize.js +15 -15
- package/dist/scripts/initialize.js.map +1 -1
- package/dist/scripts/status.js +21 -11
- package/dist/scripts/status.js.map +1 -1
- package/dist/src/beads/beads-task-store.d.ts +117 -0
- package/dist/src/beads/beads-task-store.d.ts.map +1 -0
- package/dist/src/beads/beads-task-store.js +318 -0
- package/dist/src/beads/beads-task-store.js.map +1 -0
- package/dist/src/beads/task-aware-context.d.ts +103 -0
- package/dist/src/beads/task-aware-context.d.ts.map +1 -0
- package/dist/src/beads/task-aware-context.js +395 -0
- package/dist/src/beads/task-aware-context.js.map +1 -0
- package/dist/src/beads-task-store.d.ts +117 -0
- package/dist/src/beads-task-store.d.ts.map +1 -0
- package/dist/src/beads-task-store.js +318 -0
- package/dist/src/beads-task-store.js.map +1 -0
- package/dist/src/cli/cli.d.ts +7 -0
- package/dist/src/cli/cli.d.ts.map +1 -0
- package/dist/src/cli/cli.js +471 -0
- package/dist/src/cli/cli.js.map +1 -0
- package/dist/src/core/error-handler.d.ts +46 -0
- package/dist/src/core/error-handler.d.ts.map +1 -0
- package/dist/src/core/error-handler.js +212 -0
- package/dist/src/core/error-handler.js.map +1 -0
- package/dist/src/core/frame-manager.d.ts +106 -0
- package/dist/src/core/frame-manager.d.ts.map +1 -0
- package/dist/src/core/frame-manager.js +387 -0
- package/dist/src/core/frame-manager.js.map +1 -0
- package/dist/src/core/logger.d.ts +24 -0
- package/dist/src/core/logger.d.ts.map +1 -0
- package/dist/src/core/logger.js +121 -0
- package/dist/src/core/logger.js.map +1 -0
- package/dist/src/core/logger.test.d.ts +2 -0
- package/dist/src/core/logger.test.d.ts.map +1 -0
- package/dist/src/core/logger.test.js +31 -0
- package/dist/src/core/logger.test.js.map +1 -0
- package/dist/src/index.d.ts +4 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -4
- package/dist/src/index.js.map +1 -1
- package/dist/src/integrations/linear-auth.d.ts +99 -0
- package/dist/src/integrations/linear-auth.d.ts.map +1 -0
- package/dist/src/integrations/linear-auth.js +319 -0
- package/dist/src/integrations/linear-auth.js.map +1 -0
- package/dist/src/integrations/linear-auto-sync.d.ts +77 -0
- package/dist/src/integrations/linear-auto-sync.d.ts.map +1 -0
- package/dist/src/integrations/linear-auto-sync.js +268 -0
- package/dist/src/integrations/linear-auto-sync.js.map +1 -0
- package/dist/src/integrations/linear-client.d.ts +86 -0
- package/dist/src/integrations/linear-client.d.ts.map +1 -0
- package/dist/src/integrations/linear-client.js +275 -0
- package/dist/src/integrations/linear-client.js.map +1 -0
- package/dist/src/integrations/linear-config.d.ts +51 -0
- package/dist/src/integrations/linear-config.d.ts.map +1 -0
- package/dist/src/integrations/linear-config.js +103 -0
- package/dist/src/integrations/linear-config.js.map +1 -0
- package/dist/src/integrations/linear-sync.d.ts +95 -0
- package/dist/src/integrations/linear-sync.d.ts.map +1 -0
- package/dist/src/integrations/linear-sync.js +340 -0
- package/dist/src/integrations/linear-sync.js.map +1 -0
- package/dist/src/mcp/mcp-server.d.ts +38 -0
- package/dist/src/mcp/mcp-server.d.ts.map +1 -0
- package/dist/src/mcp/mcp-server.js +812 -0
- package/dist/src/mcp/mcp-server.js.map +1 -0
- package/dist/src/pebbles/pebbles-task-store.d.ts +117 -0
- package/dist/src/pebbles/pebbles-task-store.d.ts.map +1 -0
- package/dist/src/pebbles/pebbles-task-store.js +335 -0
- package/dist/src/pebbles/pebbles-task-store.js.map +1 -0
- package/dist/src/pebbles/task-aware-context.d.ts +103 -0
- package/dist/src/pebbles/task-aware-context.d.ts.map +1 -0
- package/dist/src/pebbles/task-aware-context.js +412 -0
- package/dist/src/pebbles/task-aware-context.js.map +1 -0
- package/dist/src/task-aware-context.d.ts +103 -0
- package/dist/src/task-aware-context.d.ts.map +1 -0
- package/dist/src/task-aware-context.js +395 -0
- package/dist/src/task-aware-context.js.map +1 -0
- package/package.json +40 -9
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StackMemory Frame Manager - Call Stack Implementation
|
|
3
|
+
* Manages nested frames representing the call stack of work
|
|
4
|
+
*/
|
|
5
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
6
|
+
import { logger } from './logger.js';
|
|
7
|
+
import { StackMemoryError, ErrorCode } from './error-handler.js';
|
|
8
|
+
export class FrameManager {
|
|
9
|
+
db;
|
|
10
|
+
currentRunId;
|
|
11
|
+
projectId;
|
|
12
|
+
activeStack = []; // Stack of active frame IDs
|
|
13
|
+
constructor(db, projectId, runId) {
|
|
14
|
+
this.db = db;
|
|
15
|
+
this.projectId = projectId;
|
|
16
|
+
this.currentRunId = runId || uuidv4();
|
|
17
|
+
this.initializeSchema();
|
|
18
|
+
this.loadActiveStack();
|
|
19
|
+
}
|
|
20
|
+
initializeSchema() {
|
|
21
|
+
// Enhanced frames table matching architecture
|
|
22
|
+
this.db.exec(`
|
|
23
|
+
CREATE TABLE IF NOT EXISTS frames (
|
|
24
|
+
frame_id TEXT PRIMARY KEY,
|
|
25
|
+
run_id TEXT NOT NULL,
|
|
26
|
+
project_id TEXT NOT NULL,
|
|
27
|
+
parent_frame_id TEXT REFERENCES frames(frame_id),
|
|
28
|
+
depth INTEGER NOT NULL DEFAULT 0,
|
|
29
|
+
type TEXT NOT NULL,
|
|
30
|
+
name TEXT NOT NULL,
|
|
31
|
+
state TEXT DEFAULT 'active',
|
|
32
|
+
inputs TEXT DEFAULT '{}',
|
|
33
|
+
outputs TEXT DEFAULT '{}',
|
|
34
|
+
digest_text TEXT,
|
|
35
|
+
digest_json TEXT DEFAULT '{}',
|
|
36
|
+
created_at INTEGER DEFAULT (unixepoch()),
|
|
37
|
+
closed_at INTEGER
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
CREATE TABLE IF NOT EXISTS events (
|
|
41
|
+
event_id TEXT PRIMARY KEY,
|
|
42
|
+
run_id TEXT NOT NULL,
|
|
43
|
+
frame_id TEXT NOT NULL,
|
|
44
|
+
seq INTEGER NOT NULL,
|
|
45
|
+
event_type TEXT NOT NULL,
|
|
46
|
+
payload TEXT NOT NULL,
|
|
47
|
+
ts INTEGER DEFAULT (unixepoch()),
|
|
48
|
+
FOREIGN KEY(frame_id) REFERENCES frames(frame_id)
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
CREATE TABLE IF NOT EXISTS anchors (
|
|
52
|
+
anchor_id TEXT PRIMARY KEY,
|
|
53
|
+
frame_id TEXT NOT NULL,
|
|
54
|
+
project_id TEXT NOT NULL,
|
|
55
|
+
type TEXT NOT NULL,
|
|
56
|
+
text TEXT NOT NULL,
|
|
57
|
+
priority INTEGER DEFAULT 0,
|
|
58
|
+
created_at INTEGER DEFAULT (unixepoch()),
|
|
59
|
+
metadata TEXT DEFAULT '{}',
|
|
60
|
+
FOREIGN KEY(frame_id) REFERENCES frames(frame_id)
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
CREATE INDEX IF NOT EXISTS idx_frames_run ON frames(run_id);
|
|
64
|
+
CREATE INDEX IF NOT EXISTS idx_frames_parent ON frames(parent_frame_id);
|
|
65
|
+
CREATE INDEX IF NOT EXISTS idx_frames_state ON frames(state);
|
|
66
|
+
CREATE INDEX IF NOT EXISTS idx_events_frame ON events(frame_id);
|
|
67
|
+
CREATE INDEX IF NOT EXISTS idx_events_seq ON events(frame_id, seq);
|
|
68
|
+
CREATE INDEX IF NOT EXISTS idx_anchors_frame ON anchors(frame_id);
|
|
69
|
+
`);
|
|
70
|
+
}
|
|
71
|
+
loadActiveStack() {
|
|
72
|
+
// Load currently active frames for this run
|
|
73
|
+
const activeFrames = this.db
|
|
74
|
+
.prepare(`
|
|
75
|
+
SELECT frame_id, parent_frame_id, depth
|
|
76
|
+
FROM frames
|
|
77
|
+
WHERE run_id = ? AND state = 'active'
|
|
78
|
+
ORDER BY depth ASC
|
|
79
|
+
`)
|
|
80
|
+
.all(this.currentRunId);
|
|
81
|
+
// Rebuild stack order
|
|
82
|
+
this.activeStack = this.buildStackOrder(activeFrames);
|
|
83
|
+
logger.info('Loaded active stack', {
|
|
84
|
+
runId: this.currentRunId,
|
|
85
|
+
stackDepth: this.activeStack.length,
|
|
86
|
+
activeFrames: this.activeStack,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
buildStackOrder(frames) {
|
|
90
|
+
const stack = [];
|
|
91
|
+
// Find root frame (no parent)
|
|
92
|
+
const rootFrame = frames.find((f) => !f.parent_frame_id);
|
|
93
|
+
if (!rootFrame)
|
|
94
|
+
return [];
|
|
95
|
+
// Build stack by following parent-child relationships
|
|
96
|
+
let currentFrame = rootFrame;
|
|
97
|
+
stack.push(currentFrame.frame_id);
|
|
98
|
+
while (currentFrame) {
|
|
99
|
+
const childFrame = frames.find((f) => f.parent_frame_id === currentFrame.frame_id);
|
|
100
|
+
if (!childFrame)
|
|
101
|
+
break;
|
|
102
|
+
stack.push(childFrame.frame_id);
|
|
103
|
+
currentFrame = childFrame;
|
|
104
|
+
}
|
|
105
|
+
return stack;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Create a new frame and push to stack
|
|
109
|
+
*/
|
|
110
|
+
createFrame(options) {
|
|
111
|
+
const frameId = uuidv4();
|
|
112
|
+
const parentFrameId = options.parentFrameId || this.getCurrentFrameId();
|
|
113
|
+
const depth = parentFrameId ? this.getFrameDepth(parentFrameId) + 1 : 0;
|
|
114
|
+
const frame = {
|
|
115
|
+
frame_id: frameId,
|
|
116
|
+
run_id: this.currentRunId,
|
|
117
|
+
project_id: this.projectId,
|
|
118
|
+
parent_frame_id: parentFrameId,
|
|
119
|
+
depth,
|
|
120
|
+
type: options.type,
|
|
121
|
+
name: options.name,
|
|
122
|
+
state: 'active',
|
|
123
|
+
inputs: options.inputs || {},
|
|
124
|
+
created_at: Math.floor(Date.now() / 1000),
|
|
125
|
+
};
|
|
126
|
+
this.db
|
|
127
|
+
.prepare(`
|
|
128
|
+
INSERT INTO frames (
|
|
129
|
+
frame_id, run_id, project_id, parent_frame_id, depth, type, name, state, inputs, created_at
|
|
130
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
131
|
+
`)
|
|
132
|
+
.run(frame.frame_id, frame.run_id, frame.project_id, frame.parent_frame_id, frame.depth, frame.type, frame.name, frame.state, JSON.stringify(frame.inputs), frame.created_at);
|
|
133
|
+
// Push to active stack
|
|
134
|
+
this.activeStack.push(frameId);
|
|
135
|
+
logger.info('Created frame', {
|
|
136
|
+
frameId,
|
|
137
|
+
type: options.type,
|
|
138
|
+
name: options.name,
|
|
139
|
+
depth,
|
|
140
|
+
parentFrameId,
|
|
141
|
+
stackDepth: this.activeStack.length,
|
|
142
|
+
});
|
|
143
|
+
return frameId;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Close the current frame and generate digest
|
|
147
|
+
*/
|
|
148
|
+
closeFrame(frameId, outputs) {
|
|
149
|
+
const targetFrameId = frameId || this.getCurrentFrameId();
|
|
150
|
+
if (!targetFrameId) {
|
|
151
|
+
throw new StackMemoryError(ErrorCode.OPERATION_FAILED, 'No active frame to close');
|
|
152
|
+
}
|
|
153
|
+
// Get frame details
|
|
154
|
+
const frame = this.getFrame(targetFrameId);
|
|
155
|
+
if (!frame) {
|
|
156
|
+
throw new StackMemoryError(ErrorCode.OPERATION_FAILED, `Frame not found: ${targetFrameId}`);
|
|
157
|
+
}
|
|
158
|
+
if (frame.state === 'closed') {
|
|
159
|
+
logger.warn('Attempted to close already closed frame', {
|
|
160
|
+
frameId: targetFrameId,
|
|
161
|
+
});
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
// Generate digest before closing
|
|
165
|
+
const digest = this.generateDigest(targetFrameId);
|
|
166
|
+
const finalOutputs = { ...outputs, ...digest.structured };
|
|
167
|
+
// Update frame to closed state
|
|
168
|
+
this.db
|
|
169
|
+
.prepare(`
|
|
170
|
+
UPDATE frames
|
|
171
|
+
SET state = 'closed',
|
|
172
|
+
outputs = ?,
|
|
173
|
+
digest_text = ?,
|
|
174
|
+
digest_json = ?,
|
|
175
|
+
closed_at = unixepoch()
|
|
176
|
+
WHERE frame_id = ?
|
|
177
|
+
`)
|
|
178
|
+
.run(JSON.stringify(finalOutputs), digest.text, JSON.stringify(digest.structured), targetFrameId);
|
|
179
|
+
// Remove from active stack
|
|
180
|
+
this.activeStack = this.activeStack.filter((id) => id !== targetFrameId);
|
|
181
|
+
// Close all child frames recursively
|
|
182
|
+
this.closeChildFrames(targetFrameId);
|
|
183
|
+
logger.info('Closed frame', {
|
|
184
|
+
frameId: targetFrameId,
|
|
185
|
+
name: frame.name,
|
|
186
|
+
duration: Math.floor(Date.now() / 1000) - frame.created_at,
|
|
187
|
+
digestLength: digest.text.length,
|
|
188
|
+
stackDepth: this.activeStack.length,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
closeChildFrames(parentFrameId) {
|
|
192
|
+
const children = this.db
|
|
193
|
+
.prepare(`
|
|
194
|
+
SELECT frame_id FROM frames
|
|
195
|
+
WHERE parent_frame_id = ? AND state = 'active'
|
|
196
|
+
`)
|
|
197
|
+
.all(parentFrameId);
|
|
198
|
+
children.forEach((child) => {
|
|
199
|
+
this.closeFrame(child.frame_id);
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Generate digest for a frame
|
|
204
|
+
*/
|
|
205
|
+
generateDigest(frameId) {
|
|
206
|
+
const frame = this.getFrame(frameId);
|
|
207
|
+
const events = this.getFrameEvents(frameId);
|
|
208
|
+
const anchors = this.getFrameAnchors(frameId);
|
|
209
|
+
if (!frame) {
|
|
210
|
+
throw new StackMemoryError(ErrorCode.OPERATION_FAILED, `Cannot generate digest: frame not found ${frameId}`);
|
|
211
|
+
}
|
|
212
|
+
// Extract key information
|
|
213
|
+
const decisions = anchors.filter((a) => a.type === 'DECISION');
|
|
214
|
+
const constraints = anchors.filter((a) => a.type === 'CONSTRAINT');
|
|
215
|
+
const risks = anchors.filter((a) => a.type === 'RISK');
|
|
216
|
+
const toolCalls = events.filter((e) => e.event_type === 'tool_call');
|
|
217
|
+
const artifacts = events.filter((e) => e.event_type === 'artifact');
|
|
218
|
+
// Generate structured digest
|
|
219
|
+
const structured = {
|
|
220
|
+
result: frame.name,
|
|
221
|
+
decisions: decisions.map((d) => ({ id: d.anchor_id, text: d.text })),
|
|
222
|
+
constraints: constraints.map((c) => ({ id: c.anchor_id, text: c.text })),
|
|
223
|
+
risks: risks.map((r) => ({ id: r.anchor_id, text: r.text })),
|
|
224
|
+
artifacts: artifacts.map((a) => ({
|
|
225
|
+
kind: a.payload.kind || 'unknown',
|
|
226
|
+
ref: a.payload.ref,
|
|
227
|
+
})),
|
|
228
|
+
tool_calls_count: toolCalls.length,
|
|
229
|
+
duration_seconds: frame.closed_at
|
|
230
|
+
? frame.closed_at - frame.created_at
|
|
231
|
+
: 0,
|
|
232
|
+
};
|
|
233
|
+
// Generate text summary
|
|
234
|
+
const text = this.generateDigestText(frame, structured, events.length);
|
|
235
|
+
return { text, structured };
|
|
236
|
+
}
|
|
237
|
+
generateDigestText(frame, structured, eventCount) {
|
|
238
|
+
let summary = `Completed: ${frame.name}\n`;
|
|
239
|
+
if (structured.decisions.length > 0) {
|
|
240
|
+
summary += `\nDecisions made:\n${structured.decisions.map((d) => `- ${d.text}`).join('\n')}`;
|
|
241
|
+
}
|
|
242
|
+
if (structured.constraints.length > 0) {
|
|
243
|
+
summary += `\nConstraints established:\n${structured.constraints.map((c) => `- ${c.text}`).join('\n')}`;
|
|
244
|
+
}
|
|
245
|
+
if (structured.risks.length > 0) {
|
|
246
|
+
summary += `\nRisks identified:\n${structured.risks.map((r) => `- ${r.text}`).join('\n')}`;
|
|
247
|
+
}
|
|
248
|
+
summary += `\nActivity: ${eventCount} events, ${structured.tool_calls_count} tool calls`;
|
|
249
|
+
if (structured.duration_seconds > 0) {
|
|
250
|
+
summary += `, ${Math.floor(structured.duration_seconds / 60)}m ${structured.duration_seconds % 60}s duration`;
|
|
251
|
+
}
|
|
252
|
+
return summary;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Add event to current frame
|
|
256
|
+
*/
|
|
257
|
+
addEvent(eventType, payload, frameId) {
|
|
258
|
+
const targetFrameId = frameId || this.getCurrentFrameId();
|
|
259
|
+
if (!targetFrameId) {
|
|
260
|
+
throw new StackMemoryError(ErrorCode.OPERATION_FAILED, 'No active frame for event');
|
|
261
|
+
}
|
|
262
|
+
const eventId = uuidv4();
|
|
263
|
+
const seq = this.getNextEventSequence(targetFrameId);
|
|
264
|
+
this.db
|
|
265
|
+
.prepare(`
|
|
266
|
+
INSERT INTO events (event_id, run_id, frame_id, seq, event_type, payload)
|
|
267
|
+
VALUES (?, ?, ?, ?, ?, ?)
|
|
268
|
+
`)
|
|
269
|
+
.run(eventId, this.currentRunId, targetFrameId, seq, eventType, JSON.stringify(payload));
|
|
270
|
+
return eventId;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Add anchor to frame
|
|
274
|
+
*/
|
|
275
|
+
addAnchor(type, text, priority = 0, metadata = {}, frameId) {
|
|
276
|
+
const targetFrameId = frameId || this.getCurrentFrameId();
|
|
277
|
+
if (!targetFrameId) {
|
|
278
|
+
throw new StackMemoryError(ErrorCode.OPERATION_FAILED, 'No active frame for anchor');
|
|
279
|
+
}
|
|
280
|
+
const anchorId = uuidv4();
|
|
281
|
+
this.db
|
|
282
|
+
.prepare(`
|
|
283
|
+
INSERT INTO anchors (anchor_id, frame_id, project_id, type, text, priority, metadata)
|
|
284
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
285
|
+
`)
|
|
286
|
+
.run(anchorId, targetFrameId, this.projectId, type, text, priority, JSON.stringify(metadata));
|
|
287
|
+
return anchorId;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Get hot stack context for current active frames
|
|
291
|
+
*/
|
|
292
|
+
getHotStackContext(maxEvents = 20) {
|
|
293
|
+
return this.activeStack
|
|
294
|
+
.map((frameId) => {
|
|
295
|
+
const frame = this.getFrame(frameId);
|
|
296
|
+
if (!frame)
|
|
297
|
+
return null;
|
|
298
|
+
return {
|
|
299
|
+
frameId,
|
|
300
|
+
header: {
|
|
301
|
+
goal: frame.name,
|
|
302
|
+
constraints: this.extractConstraints(frame.inputs),
|
|
303
|
+
definitions: frame.inputs.definitions,
|
|
304
|
+
},
|
|
305
|
+
anchors: this.getFrameAnchors(frameId),
|
|
306
|
+
recentEvents: this.getFrameEvents(frameId, maxEvents),
|
|
307
|
+
activeArtifacts: this.getActiveArtifacts(frameId),
|
|
308
|
+
};
|
|
309
|
+
})
|
|
310
|
+
.filter(Boolean);
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Get active frame path (root to current)
|
|
314
|
+
*/
|
|
315
|
+
getActiveFramePath() {
|
|
316
|
+
return this.activeStack
|
|
317
|
+
.map((frameId) => this.getFrame(frameId))
|
|
318
|
+
.filter(Boolean);
|
|
319
|
+
}
|
|
320
|
+
// Utility methods
|
|
321
|
+
getCurrentFrameId() {
|
|
322
|
+
return this.activeStack[this.activeStack.length - 1];
|
|
323
|
+
}
|
|
324
|
+
getStackDepth() {
|
|
325
|
+
return this.activeStack.length;
|
|
326
|
+
}
|
|
327
|
+
getFrameDepth(frameId) {
|
|
328
|
+
const frame = this.getFrame(frameId);
|
|
329
|
+
return frame?.depth || 0;
|
|
330
|
+
}
|
|
331
|
+
getFrame(frameId) {
|
|
332
|
+
const row = this.db
|
|
333
|
+
.prepare(`
|
|
334
|
+
SELECT * FROM frames WHERE frame_id = ?
|
|
335
|
+
`)
|
|
336
|
+
.get(frameId);
|
|
337
|
+
if (!row)
|
|
338
|
+
return undefined;
|
|
339
|
+
return {
|
|
340
|
+
...row,
|
|
341
|
+
inputs: JSON.parse(row.inputs || '{}'),
|
|
342
|
+
outputs: JSON.parse(row.outputs || '{}'),
|
|
343
|
+
digest_json: JSON.parse(row.digest_json || '{}'),
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
getFrameEvents(frameId, limit) {
|
|
347
|
+
const query = limit
|
|
348
|
+
? `SELECT * FROM events WHERE frame_id = ? ORDER BY seq DESC LIMIT ?`
|
|
349
|
+
: `SELECT * FROM events WHERE frame_id = ? ORDER BY seq ASC`;
|
|
350
|
+
const params = limit ? [frameId, limit] : [frameId];
|
|
351
|
+
const rows = this.db.prepare(query).all(...params);
|
|
352
|
+
return rows.map((row) => ({
|
|
353
|
+
...row,
|
|
354
|
+
payload: JSON.parse(row.payload),
|
|
355
|
+
}));
|
|
356
|
+
}
|
|
357
|
+
getFrameAnchors(frameId) {
|
|
358
|
+
const rows = this.db
|
|
359
|
+
.prepare(`
|
|
360
|
+
SELECT * FROM anchors WHERE frame_id = ? ORDER BY priority DESC, created_at ASC
|
|
361
|
+
`)
|
|
362
|
+
.all(frameId);
|
|
363
|
+
return rows.map((row) => ({
|
|
364
|
+
...row,
|
|
365
|
+
metadata: JSON.parse(row.metadata || '{}'),
|
|
366
|
+
}));
|
|
367
|
+
}
|
|
368
|
+
getNextEventSequence(frameId) {
|
|
369
|
+
const result = this.db
|
|
370
|
+
.prepare(`
|
|
371
|
+
SELECT MAX(seq) as max_seq FROM events WHERE frame_id = ?
|
|
372
|
+
`)
|
|
373
|
+
.get(frameId);
|
|
374
|
+
return (result.max_seq || 0) + 1;
|
|
375
|
+
}
|
|
376
|
+
extractConstraints(inputs) {
|
|
377
|
+
return inputs.constraints;
|
|
378
|
+
}
|
|
379
|
+
getActiveArtifacts(frameId) {
|
|
380
|
+
const artifacts = this.getFrameEvents(frameId)
|
|
381
|
+
.filter((e) => e.event_type === 'artifact')
|
|
382
|
+
.map((e) => e.payload.ref)
|
|
383
|
+
.filter(Boolean);
|
|
384
|
+
return artifacts;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
//# sourceMappingURL=frame-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1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AAG,IAAI,CAAC,EAAE;aACnB,OAAO,CACN;;KAEH,CACE;aACA,GAAG,CAAC,OAAO,CAA+B,CAAC;QAE9C,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAEO,kBAAkB,CACxB,MAA2B;QAE3B,OAAO,MAAM,CAAC,WAAW,CAAC;IAC5B,CAAC;IAEO,kBAAkB,CAAC,OAAe;QACxC,MAAM,SAAS,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;aAC3C,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,UAAU,CAAC;aAC1C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC;aACzB,MAAM,CAAC,OAAO,CAAC,CAAC;QAEnB,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured logging utility for StackMemory CLI
|
|
3
|
+
*/
|
|
4
|
+
export declare enum LogLevel {
|
|
5
|
+
ERROR = 0,
|
|
6
|
+
WARN = 1,
|
|
7
|
+
INFO = 2,
|
|
8
|
+
DEBUG = 3
|
|
9
|
+
}
|
|
10
|
+
export declare class Logger {
|
|
11
|
+
private static instance;
|
|
12
|
+
private logLevel;
|
|
13
|
+
private logFile?;
|
|
14
|
+
private constructor();
|
|
15
|
+
static getInstance(): Logger;
|
|
16
|
+
private ensureLogDirectory;
|
|
17
|
+
private writeLog;
|
|
18
|
+
error(message: string, error?: Error, context?: Record<string, unknown>): void;
|
|
19
|
+
warn(message: string, context?: Record<string, unknown>): void;
|
|
20
|
+
info(message: string, context?: Record<string, unknown>): void;
|
|
21
|
+
debug(message: string, context?: Record<string, unknown>): void;
|
|
22
|
+
}
|
|
23
|
+
export declare const logger: Logger;
|
|
24
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/core/logger.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,oBAAY,QAAQ;IAClB,KAAK,IAAI;IACT,IAAI,IAAI;IACR,IAAI,IAAI;IACR,KAAK,IAAI;CACV;AAUD,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAS;IAChC,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,OAAO,CAAC,CAAS;IAEzB,OAAO;IA0BP,MAAM,CAAC,WAAW,IAAI,MAAM;IAO5B,OAAO,CAAC,kBAAkB;IAS1B,OAAO,CAAC,QAAQ;IAgChB,KAAK,CACH,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,KAAK,EACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,IAAI;IAUP,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAS9D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAS9D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CAQhE;AAGD,eAAO,MAAM,MAAM,QAAuB,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured logging utility for StackMemory CLI
|
|
3
|
+
*/
|
|
4
|
+
import * as fs from 'fs';
|
|
5
|
+
import * as path from 'path';
|
|
6
|
+
export var LogLevel;
|
|
7
|
+
(function (LogLevel) {
|
|
8
|
+
LogLevel[LogLevel["ERROR"] = 0] = "ERROR";
|
|
9
|
+
LogLevel[LogLevel["WARN"] = 1] = "WARN";
|
|
10
|
+
LogLevel[LogLevel["INFO"] = 2] = "INFO";
|
|
11
|
+
LogLevel[LogLevel["DEBUG"] = 3] = "DEBUG";
|
|
12
|
+
})(LogLevel || (LogLevel = {}));
|
|
13
|
+
export class Logger {
|
|
14
|
+
static instance;
|
|
15
|
+
logLevel = LogLevel.INFO;
|
|
16
|
+
logFile;
|
|
17
|
+
constructor() {
|
|
18
|
+
// Set log level from environment
|
|
19
|
+
const envLevel = process.env.STACKMEMORY_LOG_LEVEL?.toUpperCase();
|
|
20
|
+
switch (envLevel) {
|
|
21
|
+
case 'ERROR':
|
|
22
|
+
this.logLevel = LogLevel.ERROR;
|
|
23
|
+
break;
|
|
24
|
+
case 'WARN':
|
|
25
|
+
this.logLevel = LogLevel.WARN;
|
|
26
|
+
break;
|
|
27
|
+
case 'DEBUG':
|
|
28
|
+
this.logLevel = LogLevel.DEBUG;
|
|
29
|
+
break;
|
|
30
|
+
default:
|
|
31
|
+
this.logLevel = LogLevel.INFO;
|
|
32
|
+
}
|
|
33
|
+
// Set up log file if in debug mode or if specified
|
|
34
|
+
if (this.logLevel === LogLevel.DEBUG || process.env.STACKMEMORY_LOG_FILE) {
|
|
35
|
+
this.logFile =
|
|
36
|
+
process.env.STACKMEMORY_LOG_FILE ||
|
|
37
|
+
path.join(process.env.HOME || '.', '.stackmemory', 'logs', 'cli.log');
|
|
38
|
+
this.ensureLogDirectory();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
static getInstance() {
|
|
42
|
+
if (!Logger.instance) {
|
|
43
|
+
Logger.instance = new Logger();
|
|
44
|
+
}
|
|
45
|
+
return Logger.instance;
|
|
46
|
+
}
|
|
47
|
+
ensureLogDirectory() {
|
|
48
|
+
if (this.logFile) {
|
|
49
|
+
const logDir = path.dirname(this.logFile);
|
|
50
|
+
if (!fs.existsSync(logDir)) {
|
|
51
|
+
fs.mkdirSync(logDir, { recursive: true });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
writeLog(entry) {
|
|
56
|
+
const logLine = JSON.stringify(entry) + '\n';
|
|
57
|
+
// Always write to file if configured
|
|
58
|
+
if (this.logFile) {
|
|
59
|
+
try {
|
|
60
|
+
fs.appendFileSync(this.logFile, logLine);
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
// Silent failure to prevent recursive logging
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Console output based on level
|
|
67
|
+
if (entry.level <= this.logLevel) {
|
|
68
|
+
const levelNames = ['ERROR', 'WARN', 'INFO', 'DEBUG'];
|
|
69
|
+
const levelName = levelNames[entry.level] || 'UNKNOWN';
|
|
70
|
+
const consoleMessage = `[${entry.timestamp}] ${levelName}: ${entry.message}`;
|
|
71
|
+
if (entry.level === LogLevel.ERROR) {
|
|
72
|
+
console.error(consoleMessage);
|
|
73
|
+
if (entry.error) {
|
|
74
|
+
console.error(entry.error.stack);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
else if (entry.level === LogLevel.WARN) {
|
|
78
|
+
console.warn(consoleMessage);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
console.log(consoleMessage);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
error(message, error, context) {
|
|
86
|
+
this.writeLog({
|
|
87
|
+
timestamp: new Date().toISOString(),
|
|
88
|
+
level: LogLevel.ERROR,
|
|
89
|
+
message,
|
|
90
|
+
context,
|
|
91
|
+
error,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
warn(message, context) {
|
|
95
|
+
this.writeLog({
|
|
96
|
+
timestamp: new Date().toISOString(),
|
|
97
|
+
level: LogLevel.WARN,
|
|
98
|
+
message,
|
|
99
|
+
context,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
info(message, context) {
|
|
103
|
+
this.writeLog({
|
|
104
|
+
timestamp: new Date().toISOString(),
|
|
105
|
+
level: LogLevel.INFO,
|
|
106
|
+
message,
|
|
107
|
+
context,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
debug(message, context) {
|
|
111
|
+
this.writeLog({
|
|
112
|
+
timestamp: new Date().toISOString(),
|
|
113
|
+
level: LogLevel.DEBUG,
|
|
114
|
+
message,
|
|
115
|
+
context,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// Export singleton instance
|
|
120
|
+
export const logger = Logger.getInstance();
|
|
121
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/core/logger.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,MAAM,CAAN,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,yCAAS,CAAA;IACT,uCAAQ,CAAA;IACR,uCAAQ,CAAA;IACR,yCAAS,CAAA;AACX,CAAC,EALW,QAAQ,KAAR,QAAQ,QAKnB;AAUD,MAAM,OAAO,MAAM;IACT,MAAM,CAAC,QAAQ,CAAS;IACxB,QAAQ,GAAa,QAAQ,CAAC,IAAI,CAAC;IACnC,OAAO,CAAU;IAEzB;QACE,iCAAiC;QACjC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,WAAW,EAAE,CAAC;QAClE,QAAQ,QAAQ,EAAE,CAAC;YACjB,KAAK,OAAO;gBACV,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC;gBAC/B,MAAM;YACR,KAAK,MAAM;gBACT,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC;gBAC9B,MAAM;YACR,KAAK,OAAO;gBACV,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC;gBAC/B,MAAM;YACR;gBACE,IAAI,CAAC,QAAQ,GAAG,QAA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P,OAAO;SACR,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,OAAe,EAAE,OAAiC;QACrD,IAAI,CAAC,QAAQ,CAAC;YACZ,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,KAAK,EAAE,QAAQ,CAAC,IAAI;YACpB,OAAO;YACP,OAAO;SACR,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,OAAiC;QACtD,IAAI,CAAC,QAAQ,CAAC;YACZ,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,KAAK,EAAE,QAAQ,CAAC,KAAK;YACrB,OAAO;YACP,OAAO;SACR,CAAC,CAAC;IACL,CAAC;CACF;AAED,4BAA4B;AAC5B,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.test.d.ts","sourceRoot":"","sources":["../../../src/core/logger.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
2
|
+
import { logger, LogLevel } from './logger.js';
|
|
3
|
+
describe('Logger', () => {
|
|
4
|
+
let consoleSpy;
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
consoleSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
|
|
7
|
+
});
|
|
8
|
+
afterEach(() => {
|
|
9
|
+
consoleSpy.mockRestore();
|
|
10
|
+
});
|
|
11
|
+
it('should have logger instance', () => {
|
|
12
|
+
expect(logger).toBeDefined();
|
|
13
|
+
});
|
|
14
|
+
it('should log info messages', () => {
|
|
15
|
+
logger.info('test message');
|
|
16
|
+
expect(consoleSpy).toHaveBeenCalled();
|
|
17
|
+
});
|
|
18
|
+
it('should have working methods', () => {
|
|
19
|
+
expect(typeof logger.debug).toBe('function');
|
|
20
|
+
expect(typeof logger.info).toBe('function');
|
|
21
|
+
expect(typeof logger.warn).toBe('function');
|
|
22
|
+
expect(typeof logger.error).toBe('function');
|
|
23
|
+
});
|
|
24
|
+
it('should have log levels defined', () => {
|
|
25
|
+
expect(LogLevel.DEBUG).toBe(3);
|
|
26
|
+
expect(LogLevel.INFO).toBe(2);
|
|
27
|
+
expect(LogLevel.WARN).toBe(1);
|
|
28
|
+
expect(LogLevel.ERROR).toBe(0);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=logger.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.test.js","sourceRoot":"","sources":["../../../src/core/logger.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE/C,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,IAAI,UAAuC,CAAC;IAE5C,UAAU,CAAC,GAAG,EAAE;QACd,UAAU,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,UAAU,CAAC,WAAW,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACrC,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE;QAClC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC5B,MAAM,CAAC,UAAU,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACrC,MAAM,CAAC,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7C,MAAM,CAAC,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5C,MAAM,CAAC,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5C,MAAM,CAAC,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACxC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC/B,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC9B,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC9B,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* StackMemory - Lossless memory runtime for AI coding tools
|
|
3
3
|
* Main entry point for the StackMemory package
|
|
4
4
|
*/
|
|
5
|
-
export { FrameManager, type FrameType, type FrameState } from './frame-manager.js';
|
|
6
|
-
export { logger, Logger, LogLevel } from './logger.js';
|
|
7
|
-
export { StackMemoryError, ErrorCode, ErrorHandler } from './error-handler.js';
|
|
8
|
-
export { default as LocalStackMemoryMCP } from './mcp-server.js';
|
|
5
|
+
export { FrameManager, type FrameType, type FrameState, } from './core/frame-manager.js';
|
|
6
|
+
export { logger, Logger, LogLevel } from './core/logger.js';
|
|
7
|
+
export { StackMemoryError, ErrorCode, ErrorHandler, } from './core/error-handler.js';
|
|
8
|
+
export { default as LocalStackMemoryMCP } from './mcp/mcp-server.js';
|
|
9
9
|
export interface StackMemoryConfig {
|
|
10
10
|
projectRoot?: string;
|
|
11
11
|
dbPath?: string;
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,YAAY,EACZ,KAAK,SAAS,EACd,KAAK,UAAU,GAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAGrE,MAAM,WAAW,iBAAiB;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CAChD;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
package/dist/src/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* StackMemory - Lossless memory runtime for AI coding tools
|
|
3
3
|
* Main entry point for the StackMemory package
|
|
4
4
|
*/
|
|
5
|
-
export { FrameManager } from './frame-manager.js';
|
|
6
|
-
export { logger, Logger, LogLevel } from './logger.js';
|
|
7
|
-
export { StackMemoryError, ErrorCode, ErrorHandler } from './error-handler.js';
|
|
8
|
-
export { default as LocalStackMemoryMCP } from './mcp-server.js';
|
|
5
|
+
export { FrameManager, } from './core/frame-manager.js';
|
|
6
|
+
export { logger, Logger, LogLevel } from './core/logger.js';
|
|
7
|
+
export { StackMemoryError, ErrorCode, ErrorHandler, } from './core/error-handler.js';
|
|
8
|
+
export { default as LocalStackMemoryMCP } from './mcp/mcp-server.js';
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,YAAY,GAGb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,qBAAqB,CAAC"}
|