@codelia/storage 0.1.84 → 0.1.85
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/index.cjs +73 -0
- package/dist/index.d.cts +41 -2
- package/dist/index.d.ts +41 -2
- package/dist/index.js +72 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -37,6 +37,7 @@ __export(index_exports, {
|
|
|
37
37
|
ProjectsPolicyStore: () => ProjectsPolicyStore,
|
|
38
38
|
RUN_LOG_RETENTION_MS: () => RUN_LOG_RETENTION_MS,
|
|
39
39
|
RunEventStoreFactoryImpl: () => RunEventStoreFactoryImpl,
|
|
40
|
+
SessionGoalStore: () => SessionGoalStore,
|
|
40
41
|
SessionStateStoreImpl: () => SessionStateStoreImpl,
|
|
41
42
|
SessionStoreWriterImpl: () => SessionStoreWriterImpl,
|
|
42
43
|
StoragePathServiceImpl: () => StoragePathServiceImpl,
|
|
@@ -1499,6 +1500,75 @@ async function readOriginalMessage(file, options) {
|
|
|
1499
1500
|
return null;
|
|
1500
1501
|
}
|
|
1501
1502
|
|
|
1503
|
+
// src/session-goals.ts
|
|
1504
|
+
function initSessionGoals(db) {
|
|
1505
|
+
db.exec(`
|
|
1506
|
+
CREATE TABLE IF NOT EXISTS session_goals (
|
|
1507
|
+
session_id TEXT PRIMARY KEY,
|
|
1508
|
+
payload TEXT NOT NULL
|
|
1509
|
+
);
|
|
1510
|
+
CREATE TABLE IF NOT EXISTS goal_continuations (
|
|
1511
|
+
continuation_id TEXT PRIMARY KEY,
|
|
1512
|
+
session_id TEXT NOT NULL,
|
|
1513
|
+
goal_id TEXT NOT NULL,
|
|
1514
|
+
run_id TEXT NOT NULL
|
|
1515
|
+
);
|
|
1516
|
+
CREATE INDEX IF NOT EXISTS goal_continuations_session ON goal_continuations (session_id);
|
|
1517
|
+
`);
|
|
1518
|
+
}
|
|
1519
|
+
var SessionGoalStore = class {
|
|
1520
|
+
constructor(getDb) {
|
|
1521
|
+
this.getDb = getDb;
|
|
1522
|
+
}
|
|
1523
|
+
getDb;
|
|
1524
|
+
load(db, sessionId) {
|
|
1525
|
+
const row = db.get(
|
|
1526
|
+
"SELECT payload FROM session_goals WHERE session_id = ?",
|
|
1527
|
+
[sessionId]
|
|
1528
|
+
);
|
|
1529
|
+
return row ? JSON.parse(row.payload) : null;
|
|
1530
|
+
}
|
|
1531
|
+
async read(sessionId, continuationId) {
|
|
1532
|
+
const db = await this.getDb();
|
|
1533
|
+
const entry = this.load(db, sessionId);
|
|
1534
|
+
const acceptedRunId = continuationId && entry ? db.get(
|
|
1535
|
+
"SELECT run_id FROM goal_continuations WHERE session_id = ? AND goal_id = ? AND continuation_id = ?",
|
|
1536
|
+
[sessionId, entry.goal.goal_id, continuationId]
|
|
1537
|
+
)?.run_id : void 0;
|
|
1538
|
+
return { entry, acceptedRunId };
|
|
1539
|
+
}
|
|
1540
|
+
async update(sessionId, update) {
|
|
1541
|
+
const db = await this.getDb();
|
|
1542
|
+
db.exec("BEGIN IMMEDIATE");
|
|
1543
|
+
try {
|
|
1544
|
+
const tx = {
|
|
1545
|
+
entry: this.load(db, sessionId),
|
|
1546
|
+
consume: (continuationId, goalId, runId) => db.run(
|
|
1547
|
+
"INSERT INTO goal_continuations (continuation_id, session_id, goal_id, run_id) VALUES (?, ?, ?, ?)",
|
|
1548
|
+
[continuationId, sessionId, goalId, runId]
|
|
1549
|
+
)
|
|
1550
|
+
};
|
|
1551
|
+
const result = update(tx);
|
|
1552
|
+
if (tx.entry) {
|
|
1553
|
+
db.run(
|
|
1554
|
+
"INSERT INTO session_goals (session_id, payload) VALUES (?, ?) ON CONFLICT(session_id) DO UPDATE SET payload = excluded.payload",
|
|
1555
|
+
[sessionId, JSON.stringify(tx.entry)]
|
|
1556
|
+
);
|
|
1557
|
+
} else {
|
|
1558
|
+
db.run("DELETE FROM session_goals WHERE session_id = ?", [sessionId]);
|
|
1559
|
+
db.run("DELETE FROM goal_continuations WHERE session_id = ?", [
|
|
1560
|
+
sessionId
|
|
1561
|
+
]);
|
|
1562
|
+
}
|
|
1563
|
+
db.exec("COMMIT");
|
|
1564
|
+
return result;
|
|
1565
|
+
} catch (error) {
|
|
1566
|
+
db.exec("ROLLBACK");
|
|
1567
|
+
throw error;
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
};
|
|
1571
|
+
|
|
1502
1572
|
// src/session-state.ts
|
|
1503
1573
|
var LEGACY_STATE_DIRNAME = "state";
|
|
1504
1574
|
var MESSAGES_DIRNAME = "messages";
|
|
@@ -1562,6 +1632,7 @@ var deserializeMessages = (payload) => {
|
|
|
1562
1632
|
var SessionStateStoreImpl = class {
|
|
1563
1633
|
/** Root that `session_runs.rel_path` values are relative to. */
|
|
1564
1634
|
sessionsDir;
|
|
1635
|
+
goals = new SessionGoalStore(() => this.requireDb("goals"));
|
|
1565
1636
|
legacyStateDir;
|
|
1566
1637
|
messagesDir;
|
|
1567
1638
|
contextsDir;
|
|
@@ -1761,6 +1832,7 @@ var SessionStateStoreImpl = class {
|
|
|
1761
1832
|
value TEXT NOT NULL
|
|
1762
1833
|
);
|
|
1763
1834
|
`);
|
|
1835
|
+
initSessionGoals(db);
|
|
1764
1836
|
db.exec("COMMIT");
|
|
1765
1837
|
} catch (error) {
|
|
1766
1838
|
db.exec("ROLLBACK");
|
|
@@ -3458,6 +3530,7 @@ ${snippet}`;
|
|
|
3458
3530
|
ProjectsPolicyStore,
|
|
3459
3531
|
RUN_LOG_RETENTION_MS,
|
|
3460
3532
|
RunEventStoreFactoryImpl,
|
|
3533
|
+
SessionGoalStore,
|
|
3461
3534
|
SessionStateStoreImpl,
|
|
3462
3535
|
SessionStoreWriterImpl,
|
|
3463
3536
|
StoragePathServiceImpl,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _codelia_core from '@codelia/core';
|
|
2
2
|
import { StoragePaths, ResolveStorageOptions, RunEventStoreFactory, RunEventStoreInit, SessionStore, ConversationSearchResult, ConversationMessage, SessionStateStore, SessionState, SessionStateSummary, StoragePathService, SessionRecord, ToolOutputCacheStore, ToolOutputCacheRecord, ToolOutputRef, ToolOutputCacheReadOptions, ToolOutputCacheSearchOptions } from '@codelia/core';
|
|
3
3
|
export { ResolveStorageOptions, StorageLayout, StoragePathService, StoragePaths } from '@codelia/core';
|
|
4
|
-
import { GeneratedImageMetadata, ImageArtifactRef, ImageMediaType, AttachedImageMetadata, ImageArtifactMetadata, AttachmentRef, ApprovalMode, SubagentLineage, AgentMessage, TaskTerminationReason, TaskUsage } from '@codelia/shared-types';
|
|
4
|
+
import { GeneratedImageMetadata, ImageArtifactRef, ImageMediaType, AttachedImageMetadata, ImageArtifactMetadata, AttachmentRef, ApprovalMode, GoalRecord, SubagentLineage, AgentMessage, TaskTerminationReason, TaskUsage } from '@codelia/shared-types';
|
|
5
5
|
|
|
6
6
|
type AttachmentWriteOptions = {
|
|
7
7
|
artifactId?: string;
|
|
@@ -180,6 +180,44 @@ declare function readOriginalMessage(file: string, options: {
|
|
|
180
180
|
limit?: number;
|
|
181
181
|
}): Promise<ConversationMessage | null>;
|
|
182
182
|
|
|
183
|
+
type GoalRunClaim = {
|
|
184
|
+
run_id: string;
|
|
185
|
+
revision: number;
|
|
186
|
+
activation_id: string;
|
|
187
|
+
continuation_id?: string;
|
|
188
|
+
owner_pid: number;
|
|
189
|
+
owner_identity: string | null;
|
|
190
|
+
pending_seq?: number;
|
|
191
|
+
accounted_seq?: number;
|
|
192
|
+
};
|
|
193
|
+
type StoredSessionGoal = {
|
|
194
|
+
goal: GoalRecord;
|
|
195
|
+
claim?: GoalRunClaim;
|
|
196
|
+
blocker?: {
|
|
197
|
+
key: string;
|
|
198
|
+
runs: number;
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
type Sqlite = {
|
|
202
|
+
exec(sql: string): void;
|
|
203
|
+
run(sql: string, params?: unknown[]): void;
|
|
204
|
+
get<T>(sql: string, params?: unknown[]): T | undefined;
|
|
205
|
+
};
|
|
206
|
+
type GoalTransaction = {
|
|
207
|
+
entry: StoredSessionGoal | null;
|
|
208
|
+
consume(continuationId: string, goalId: string, runId: string): void;
|
|
209
|
+
};
|
|
210
|
+
declare class SessionGoalStore {
|
|
211
|
+
private readonly getDb;
|
|
212
|
+
constructor(getDb: () => Promise<Sqlite>);
|
|
213
|
+
private load;
|
|
214
|
+
read(sessionId: string, continuationId?: string): Promise<{
|
|
215
|
+
entry: StoredSessionGoal | null;
|
|
216
|
+
acceptedRunId?: string;
|
|
217
|
+
}>;
|
|
218
|
+
update<T>(sessionId: string, update: (tx: GoalTransaction) => T): Promise<T>;
|
|
219
|
+
}
|
|
220
|
+
|
|
183
221
|
type SessionStateStoreOptions = {
|
|
184
222
|
paths?: StoragePaths;
|
|
185
223
|
onError?: (error: unknown, context: {
|
|
@@ -190,6 +228,7 @@ type SessionStateStoreOptions = {
|
|
|
190
228
|
declare class SessionStateStoreImpl implements SessionStateStore, SessionRunRecorder {
|
|
191
229
|
/** Root that `session_runs.rel_path` values are relative to. */
|
|
192
230
|
readonly sessionsDir: string;
|
|
231
|
+
readonly goals: SessionGoalStore;
|
|
193
232
|
private readonly legacyStateDir;
|
|
194
233
|
private readonly messagesDir;
|
|
195
234
|
private readonly contextsDir;
|
|
@@ -400,4 +439,4 @@ declare class ToolOutputCacheStoreImpl implements ToolOutputCacheStore {
|
|
|
400
439
|
private resolvePath;
|
|
401
440
|
}
|
|
402
441
|
|
|
403
|
-
export { type AttachmentStore, FileAttachmentStore, IMAGE_MAX_BYTES, ImageArtifactStore, type McpAuthFile, McpAuthStore, type McpOAuthTokens, type ProjectsPolicyFile, ProjectsPolicyStore, RUN_LOG_RETENTION_MS, RunEventStoreFactoryImpl, type RunLogCleanupResult, type SessionRunEntry, type SessionRunRecorder, SessionStateStoreImpl, SessionStoreWriterImpl, StoragePathServiceImpl, type StoredAttachment, type TaskArtifact, type TaskKind, type TaskRecord, TaskRegistryStore, type TaskResult, type TaskState, type TaskTruncatedOutput, type TaskWorkspaceMode, ToolOutputCacheStoreImpl, cleanupRunLogs, createAttachmentId, detectImageAttachmentType, ensureStorageDirs, getProcessIdentity, isAttachmentId, readRunLogLines, resolveIndexedRunLog, resolveRunLogPath, resolveStoragePaths, scanSessionRunLogs, validateImageAttachment, validateImagePng };
|
|
442
|
+
export { type AttachmentStore, FileAttachmentStore, type GoalRunClaim, IMAGE_MAX_BYTES, ImageArtifactStore, type McpAuthFile, McpAuthStore, type McpOAuthTokens, type ProjectsPolicyFile, ProjectsPolicyStore, RUN_LOG_RETENTION_MS, RunEventStoreFactoryImpl, type RunLogCleanupResult, SessionGoalStore, type SessionRunEntry, type SessionRunRecorder, SessionStateStoreImpl, SessionStoreWriterImpl, StoragePathServiceImpl, type StoredAttachment, type StoredSessionGoal, type TaskArtifact, type TaskKind, type TaskRecord, TaskRegistryStore, type TaskResult, type TaskState, type TaskTruncatedOutput, type TaskWorkspaceMode, ToolOutputCacheStoreImpl, cleanupRunLogs, createAttachmentId, detectImageAttachmentType, ensureStorageDirs, getProcessIdentity, isAttachmentId, readRunLogLines, resolveIndexedRunLog, resolveRunLogPath, resolveStoragePaths, scanSessionRunLogs, validateImageAttachment, validateImagePng };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _codelia_core from '@codelia/core';
|
|
2
2
|
import { StoragePaths, ResolveStorageOptions, RunEventStoreFactory, RunEventStoreInit, SessionStore, ConversationSearchResult, ConversationMessage, SessionStateStore, SessionState, SessionStateSummary, StoragePathService, SessionRecord, ToolOutputCacheStore, ToolOutputCacheRecord, ToolOutputRef, ToolOutputCacheReadOptions, ToolOutputCacheSearchOptions } from '@codelia/core';
|
|
3
3
|
export { ResolveStorageOptions, StorageLayout, StoragePathService, StoragePaths } from '@codelia/core';
|
|
4
|
-
import { GeneratedImageMetadata, ImageArtifactRef, ImageMediaType, AttachedImageMetadata, ImageArtifactMetadata, AttachmentRef, ApprovalMode, SubagentLineage, AgentMessage, TaskTerminationReason, TaskUsage } from '@codelia/shared-types';
|
|
4
|
+
import { GeneratedImageMetadata, ImageArtifactRef, ImageMediaType, AttachedImageMetadata, ImageArtifactMetadata, AttachmentRef, ApprovalMode, GoalRecord, SubagentLineage, AgentMessage, TaskTerminationReason, TaskUsage } from '@codelia/shared-types';
|
|
5
5
|
|
|
6
6
|
type AttachmentWriteOptions = {
|
|
7
7
|
artifactId?: string;
|
|
@@ -180,6 +180,44 @@ declare function readOriginalMessage(file: string, options: {
|
|
|
180
180
|
limit?: number;
|
|
181
181
|
}): Promise<ConversationMessage | null>;
|
|
182
182
|
|
|
183
|
+
type GoalRunClaim = {
|
|
184
|
+
run_id: string;
|
|
185
|
+
revision: number;
|
|
186
|
+
activation_id: string;
|
|
187
|
+
continuation_id?: string;
|
|
188
|
+
owner_pid: number;
|
|
189
|
+
owner_identity: string | null;
|
|
190
|
+
pending_seq?: number;
|
|
191
|
+
accounted_seq?: number;
|
|
192
|
+
};
|
|
193
|
+
type StoredSessionGoal = {
|
|
194
|
+
goal: GoalRecord;
|
|
195
|
+
claim?: GoalRunClaim;
|
|
196
|
+
blocker?: {
|
|
197
|
+
key: string;
|
|
198
|
+
runs: number;
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
type Sqlite = {
|
|
202
|
+
exec(sql: string): void;
|
|
203
|
+
run(sql: string, params?: unknown[]): void;
|
|
204
|
+
get<T>(sql: string, params?: unknown[]): T | undefined;
|
|
205
|
+
};
|
|
206
|
+
type GoalTransaction = {
|
|
207
|
+
entry: StoredSessionGoal | null;
|
|
208
|
+
consume(continuationId: string, goalId: string, runId: string): void;
|
|
209
|
+
};
|
|
210
|
+
declare class SessionGoalStore {
|
|
211
|
+
private readonly getDb;
|
|
212
|
+
constructor(getDb: () => Promise<Sqlite>);
|
|
213
|
+
private load;
|
|
214
|
+
read(sessionId: string, continuationId?: string): Promise<{
|
|
215
|
+
entry: StoredSessionGoal | null;
|
|
216
|
+
acceptedRunId?: string;
|
|
217
|
+
}>;
|
|
218
|
+
update<T>(sessionId: string, update: (tx: GoalTransaction) => T): Promise<T>;
|
|
219
|
+
}
|
|
220
|
+
|
|
183
221
|
type SessionStateStoreOptions = {
|
|
184
222
|
paths?: StoragePaths;
|
|
185
223
|
onError?: (error: unknown, context: {
|
|
@@ -190,6 +228,7 @@ type SessionStateStoreOptions = {
|
|
|
190
228
|
declare class SessionStateStoreImpl implements SessionStateStore, SessionRunRecorder {
|
|
191
229
|
/** Root that `session_runs.rel_path` values are relative to. */
|
|
192
230
|
readonly sessionsDir: string;
|
|
231
|
+
readonly goals: SessionGoalStore;
|
|
193
232
|
private readonly legacyStateDir;
|
|
194
233
|
private readonly messagesDir;
|
|
195
234
|
private readonly contextsDir;
|
|
@@ -400,4 +439,4 @@ declare class ToolOutputCacheStoreImpl implements ToolOutputCacheStore {
|
|
|
400
439
|
private resolvePath;
|
|
401
440
|
}
|
|
402
441
|
|
|
403
|
-
export { type AttachmentStore, FileAttachmentStore, IMAGE_MAX_BYTES, ImageArtifactStore, type McpAuthFile, McpAuthStore, type McpOAuthTokens, type ProjectsPolicyFile, ProjectsPolicyStore, RUN_LOG_RETENTION_MS, RunEventStoreFactoryImpl, type RunLogCleanupResult, type SessionRunEntry, type SessionRunRecorder, SessionStateStoreImpl, SessionStoreWriterImpl, StoragePathServiceImpl, type StoredAttachment, type TaskArtifact, type TaskKind, type TaskRecord, TaskRegistryStore, type TaskResult, type TaskState, type TaskTruncatedOutput, type TaskWorkspaceMode, ToolOutputCacheStoreImpl, cleanupRunLogs, createAttachmentId, detectImageAttachmentType, ensureStorageDirs, getProcessIdentity, isAttachmentId, readRunLogLines, resolveIndexedRunLog, resolveRunLogPath, resolveStoragePaths, scanSessionRunLogs, validateImageAttachment, validateImagePng };
|
|
442
|
+
export { type AttachmentStore, FileAttachmentStore, type GoalRunClaim, IMAGE_MAX_BYTES, ImageArtifactStore, type McpAuthFile, McpAuthStore, type McpOAuthTokens, type ProjectsPolicyFile, ProjectsPolicyStore, RUN_LOG_RETENTION_MS, RunEventStoreFactoryImpl, type RunLogCleanupResult, SessionGoalStore, type SessionRunEntry, type SessionRunRecorder, SessionStateStoreImpl, SessionStoreWriterImpl, StoragePathServiceImpl, type StoredAttachment, type StoredSessionGoal, type TaskArtifact, type TaskKind, type TaskRecord, TaskRegistryStore, type TaskResult, type TaskState, type TaskTruncatedOutput, type TaskWorkspaceMode, ToolOutputCacheStoreImpl, cleanupRunLogs, createAttachmentId, detectImageAttachmentType, ensureStorageDirs, getProcessIdentity, isAttachmentId, readRunLogLines, resolveIndexedRunLog, resolveRunLogPath, resolveStoragePaths, scanSessionRunLogs, validateImageAttachment, validateImagePng };
|
package/dist/index.js
CHANGED
|
@@ -1463,6 +1463,75 @@ async function readOriginalMessage(file, options) {
|
|
|
1463
1463
|
return null;
|
|
1464
1464
|
}
|
|
1465
1465
|
|
|
1466
|
+
// src/session-goals.ts
|
|
1467
|
+
function initSessionGoals(db) {
|
|
1468
|
+
db.exec(`
|
|
1469
|
+
CREATE TABLE IF NOT EXISTS session_goals (
|
|
1470
|
+
session_id TEXT PRIMARY KEY,
|
|
1471
|
+
payload TEXT NOT NULL
|
|
1472
|
+
);
|
|
1473
|
+
CREATE TABLE IF NOT EXISTS goal_continuations (
|
|
1474
|
+
continuation_id TEXT PRIMARY KEY,
|
|
1475
|
+
session_id TEXT NOT NULL,
|
|
1476
|
+
goal_id TEXT NOT NULL,
|
|
1477
|
+
run_id TEXT NOT NULL
|
|
1478
|
+
);
|
|
1479
|
+
CREATE INDEX IF NOT EXISTS goal_continuations_session ON goal_continuations (session_id);
|
|
1480
|
+
`);
|
|
1481
|
+
}
|
|
1482
|
+
var SessionGoalStore = class {
|
|
1483
|
+
constructor(getDb) {
|
|
1484
|
+
this.getDb = getDb;
|
|
1485
|
+
}
|
|
1486
|
+
getDb;
|
|
1487
|
+
load(db, sessionId) {
|
|
1488
|
+
const row = db.get(
|
|
1489
|
+
"SELECT payload FROM session_goals WHERE session_id = ?",
|
|
1490
|
+
[sessionId]
|
|
1491
|
+
);
|
|
1492
|
+
return row ? JSON.parse(row.payload) : null;
|
|
1493
|
+
}
|
|
1494
|
+
async read(sessionId, continuationId) {
|
|
1495
|
+
const db = await this.getDb();
|
|
1496
|
+
const entry = this.load(db, sessionId);
|
|
1497
|
+
const acceptedRunId = continuationId && entry ? db.get(
|
|
1498
|
+
"SELECT run_id FROM goal_continuations WHERE session_id = ? AND goal_id = ? AND continuation_id = ?",
|
|
1499
|
+
[sessionId, entry.goal.goal_id, continuationId]
|
|
1500
|
+
)?.run_id : void 0;
|
|
1501
|
+
return { entry, acceptedRunId };
|
|
1502
|
+
}
|
|
1503
|
+
async update(sessionId, update) {
|
|
1504
|
+
const db = await this.getDb();
|
|
1505
|
+
db.exec("BEGIN IMMEDIATE");
|
|
1506
|
+
try {
|
|
1507
|
+
const tx = {
|
|
1508
|
+
entry: this.load(db, sessionId),
|
|
1509
|
+
consume: (continuationId, goalId, runId) => db.run(
|
|
1510
|
+
"INSERT INTO goal_continuations (continuation_id, session_id, goal_id, run_id) VALUES (?, ?, ?, ?)",
|
|
1511
|
+
[continuationId, sessionId, goalId, runId]
|
|
1512
|
+
)
|
|
1513
|
+
};
|
|
1514
|
+
const result = update(tx);
|
|
1515
|
+
if (tx.entry) {
|
|
1516
|
+
db.run(
|
|
1517
|
+
"INSERT INTO session_goals (session_id, payload) VALUES (?, ?) ON CONFLICT(session_id) DO UPDATE SET payload = excluded.payload",
|
|
1518
|
+
[sessionId, JSON.stringify(tx.entry)]
|
|
1519
|
+
);
|
|
1520
|
+
} else {
|
|
1521
|
+
db.run("DELETE FROM session_goals WHERE session_id = ?", [sessionId]);
|
|
1522
|
+
db.run("DELETE FROM goal_continuations WHERE session_id = ?", [
|
|
1523
|
+
sessionId
|
|
1524
|
+
]);
|
|
1525
|
+
}
|
|
1526
|
+
db.exec("COMMIT");
|
|
1527
|
+
return result;
|
|
1528
|
+
} catch (error) {
|
|
1529
|
+
db.exec("ROLLBACK");
|
|
1530
|
+
throw error;
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
};
|
|
1534
|
+
|
|
1466
1535
|
// src/session-state.ts
|
|
1467
1536
|
var LEGACY_STATE_DIRNAME = "state";
|
|
1468
1537
|
var MESSAGES_DIRNAME = "messages";
|
|
@@ -1526,6 +1595,7 @@ var deserializeMessages = (payload) => {
|
|
|
1526
1595
|
var SessionStateStoreImpl = class {
|
|
1527
1596
|
/** Root that `session_runs.rel_path` values are relative to. */
|
|
1528
1597
|
sessionsDir;
|
|
1598
|
+
goals = new SessionGoalStore(() => this.requireDb("goals"));
|
|
1529
1599
|
legacyStateDir;
|
|
1530
1600
|
messagesDir;
|
|
1531
1601
|
contextsDir;
|
|
@@ -1725,6 +1795,7 @@ var SessionStateStoreImpl = class {
|
|
|
1725
1795
|
value TEXT NOT NULL
|
|
1726
1796
|
);
|
|
1727
1797
|
`);
|
|
1798
|
+
initSessionGoals(db);
|
|
1728
1799
|
db.exec("COMMIT");
|
|
1729
1800
|
} catch (error) {
|
|
1730
1801
|
db.exec("ROLLBACK");
|
|
@@ -3434,6 +3505,7 @@ export {
|
|
|
3434
3505
|
ProjectsPolicyStore,
|
|
3435
3506
|
RUN_LOG_RETENTION_MS,
|
|
3436
3507
|
RunEventStoreFactoryImpl,
|
|
3508
|
+
SessionGoalStore,
|
|
3437
3509
|
SessionStateStoreImpl,
|
|
3438
3510
|
SessionStoreWriterImpl,
|
|
3439
3511
|
StoragePathServiceImpl,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codelia/storage",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.85",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"typecheck": "tsc --noEmit"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@codelia/core": "0.1.
|
|
28
|
-
"@codelia/shared-types": "0.1.
|
|
27
|
+
"@codelia/core": "0.1.85",
|
|
28
|
+
"@codelia/shared-types": "0.1.85",
|
|
29
29
|
"better-sqlite3": "^12.6.2",
|
|
30
30
|
"image-size": "^2.0.2",
|
|
31
31
|
"sharp": "^0.34.5"
|