@hivemagnus/ardent 2.2.0 → 2.2.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.
|
@@ -6,11 +6,14 @@ import Database from 'better-sqlite3';
|
|
|
6
6
|
import { parse } from 'dotenv';
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
import { ContextCheckpoints } from './context-checkpoints.js';
|
|
9
|
-
import {
|
|
9
|
+
import { TaskStore } from './store.js';
|
|
10
10
|
import { loadConfig } from './config.js';
|
|
11
11
|
import { loadModelPolicy } from './model-policy.js';
|
|
12
12
|
import { compactWithCodex } from './codex.js';
|
|
13
13
|
import { resolveSources, validateCheckpoint } from '@hivemagnus/emberfold';
|
|
14
|
+
// Context-only adoption overlays this module on an older installed runtime, so it may import from
|
|
15
|
+
// that runtime's base modules only what every supported release exports (test/context-overlay-imports.test.ts).
|
|
16
|
+
const SessionContext = z.enum(['direct', 'peer', 'scheduled', 'mission', 'preview']);
|
|
14
17
|
const digest = (value) => createHash('sha256').update(JSON.stringify(value)).digest('hex');
|
|
15
18
|
const tableName = z.string().regex(/^[a-zA-Z_][a-zA-Z0-9_]*$/);
|
|
16
19
|
const snapshotSchema = z.object({ tables: z.array(z.object({ table: tableName,
|
|
@@ -186,7 +189,7 @@ export async function contextMaintenance(input) {
|
|
|
186
189
|
const current = new ContextCheckpoints(store, forbidden);
|
|
187
190
|
const { ContextCheckpoints: Previous } = previousReaderSchema.parse(await import(pathToFileURL(request.previous_module).href));
|
|
188
191
|
const previous = new Previous(store, forbidden);
|
|
189
|
-
const sessions = z.array(z.object({ id: z.string(), caller: z.string(), context:
|
|
192
|
+
const sessions = z.array(z.object({ id: z.string(), caller: z.string(), context: SessionContext })).max(10000)
|
|
190
193
|
.parse(store.db.prepare('SELECT s.id,s.caller,s.context FROM sessions s JOIN context_checkpoint_heads h ON h.session_id=s.id').all());
|
|
191
194
|
for (const session of sessions) {
|
|
192
195
|
const status = current.status(session.id, session.caller, session.context);
|