Move Void memory maintenance into daemon
This commit is contained in:
parent
9709760039
commit
21d12a3874
7 changed files with 261 additions and 5 deletions
|
|
@ -444,6 +444,12 @@ export const voidThoughtMemorySchema = z.object({
|
|||
updatedAt: timestampSchema,
|
||||
}).strict();
|
||||
|
||||
const scheduledRunSchema = z.object({
|
||||
runner: nonEmptyStringSchema,
|
||||
ranAt: timestampSchema,
|
||||
summary: z.string().trim().min(1).max(1000),
|
||||
}).strict();
|
||||
|
||||
export const voidScheduledRuntimeSchema = z.object({
|
||||
schemaVersion: z.literal(1),
|
||||
sleepCycle: z.object({
|
||||
|
|
@ -461,11 +467,7 @@ export const voidScheduledRuntimeSchema = z.object({
|
|||
lastSpokeAt: timestampSchema.optional(),
|
||||
lastHeraldAt: timestampSchema.optional(),
|
||||
}).strict(),
|
||||
lastRuns: z.array(z.object({
|
||||
runner: nonEmptyStringSchema,
|
||||
ranAt: timestampSchema,
|
||||
summary: z.string().trim().min(1).max(1000),
|
||||
}).strict()).default([]),
|
||||
lastRuns: z.array(scheduledRunSchema).default([]),
|
||||
updatedAt: timestampSchema,
|
||||
}).strict();
|
||||
|
||||
|
|
@ -735,6 +737,10 @@ export const voidSelfStateOperationSchema = z.discriminatedUnion("operation", [
|
|||
operation: z.literal("update_speaking_pressure"),
|
||||
speakingPressure: voidScheduledRuntimeSchema.shape.speakingPressure,
|
||||
}).strict(),
|
||||
z.object({
|
||||
operation: z.literal("record_scheduled_run"),
|
||||
run: scheduledRunSchema,
|
||||
}).strict(),
|
||||
z.object({
|
||||
operation: z.literal("propose_memory_distillation"),
|
||||
proposalId: nonEmptyStringSchema,
|
||||
|
|
|
|||
|
|
@ -467,6 +467,13 @@ function applyTypedOperation(
|
|||
state.scheduledRuntime.speakingPressure = operation.speakingPressure;
|
||||
state.scheduledRuntime.updatedAt = new Date().toISOString();
|
||||
return;
|
||||
case "record_scheduled_run":
|
||||
state.scheduledRuntime.lastRuns = [
|
||||
...state.scheduledRuntime.lastRuns.filter((entry) => entry.runner !== operation.run.runner),
|
||||
operation.run,
|
||||
].slice(-64);
|
||||
state.scheduledRuntime.updatedAt = operation.run.ranAt;
|
||||
return;
|
||||
case "propose_memory_distillation":
|
||||
return;
|
||||
case "apply_memory_distillation":
|
||||
|
|
|
|||
Loading…
Reference in a new issue