@aletheia-labs/dynamics 0.1.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/LICENSE +176 -0
- package/README.md +169 -0
- package/dist/authority-decay.d.ts +24 -0
- package/dist/authority-decay.d.ts.map +1 -0
- package/dist/authority-decay.js +75 -0
- package/dist/authority-decay.js.map +1 -0
- package/dist/dynamics-engine.d.ts +96 -0
- package/dist/dynamics-engine.d.ts.map +1 -0
- package/dist/dynamics-engine.js +216 -0
- package/dist/dynamics-engine.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/lineage.d.ts +35 -0
- package/dist/lineage.d.ts.map +1 -0
- package/dist/lineage.js +45 -0
- package/dist/lineage.js.map +1 -0
- package/dist/policy.d.ts +35 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +31 -0
- package/dist/policy.js.map +1 -0
- package/dist/recall-evidence.d.ts +38 -0
- package/dist/recall-evidence.d.ts.map +1 -0
- package/dist/recall-evidence.js +67 -0
- package/dist/recall-evidence.js.map +1 -0
- package/dist/reconsolidation-planner.d.ts +93 -0
- package/dist/reconsolidation-planner.d.ts.map +1 -0
- package/dist/reconsolidation-planner.js +230 -0
- package/dist/reconsolidation-planner.js.map +1 -0
- package/dist/sleep-cycle.d.ts +70 -0
- package/dist/sleep-cycle.d.ts.map +1 -0
- package/dist/sleep-cycle.js +77 -0
- package/dist/sleep-cycle.js.map +1 -0
- package/package.json +45 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { AgentIdSchema, IsoTimestampSchema, MemoryAtomSchema, scopeKey } from '@aletheia-labs/core';
|
|
2
|
+
export class ReconsolidationPlanner {
|
|
3
|
+
stores;
|
|
4
|
+
/**
|
|
5
|
+
* Create a reconsolidation planner over existing authority stores.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* The planner is read-only. It validates visibility, source events, scope,
|
|
9
|
+
* status, and conflict state before producing a successor draft.
|
|
10
|
+
*/
|
|
11
|
+
constructor(stores) {
|
|
12
|
+
this.stores = stores;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Plan a candidate successor atom and prior-atom deprecation.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Use this when new evidence should update the meaning of an existing atom.
|
|
19
|
+
* The plan never mutates storage and never upgrades authority: successor
|
|
20
|
+
* drafts start as `candidate` and carry `supersedes` lineage back to the
|
|
21
|
+
* previous atom.
|
|
22
|
+
*/
|
|
23
|
+
async plan(input) {
|
|
24
|
+
if (input.permittedVisibilities.length === 0) {
|
|
25
|
+
return abstain('no_permitted_visibilities', null, [], []);
|
|
26
|
+
}
|
|
27
|
+
if (input.sourceEventIds.length === 0) {
|
|
28
|
+
return abstain('empty_source_events', null, [], []);
|
|
29
|
+
}
|
|
30
|
+
const previousAtom = await this.stores.memoryStore.get(input.previousMemoryId, input.permittedVisibilities);
|
|
31
|
+
if (previousAtom === null) {
|
|
32
|
+
return abstain('previous_memory_missing_or_invisible', null, [], []);
|
|
33
|
+
}
|
|
34
|
+
if (!isReconsolidatableStatus(previousAtom.status)) {
|
|
35
|
+
return abstain('previous_status_not_reconsolidatable', previousAtom, [], []);
|
|
36
|
+
}
|
|
37
|
+
if (scopeKey(previousAtom.scope) !== scopeKey(input.scope)) {
|
|
38
|
+
return abstain('previous_memory_missing_or_invisible', null, [], []);
|
|
39
|
+
}
|
|
40
|
+
const sourceEvents = [];
|
|
41
|
+
for (const eventId of input.sourceEventIds) {
|
|
42
|
+
const event = await this.stores.eventLedger.get(eventId, input.permittedVisibilities);
|
|
43
|
+
if (event === null) {
|
|
44
|
+
return abstain('source_event_missing_or_invisible', previousAtom, sourceEvents, []);
|
|
45
|
+
}
|
|
46
|
+
if (scopeKey(event.scope) !== scopeKey(previousAtom.scope)) {
|
|
47
|
+
return abstain('source_event_scope_mismatch', previousAtom, sourceEvents, []);
|
|
48
|
+
}
|
|
49
|
+
sourceEvents.push(event);
|
|
50
|
+
}
|
|
51
|
+
const conflicts = await this.stores.conflictRegistry.query({
|
|
52
|
+
touchingMemoryIds: [previousAtom.memoryId],
|
|
53
|
+
statuses: ['unresolved', 'requires_human'],
|
|
54
|
+
scope: previousAtom.scope,
|
|
55
|
+
permittedVisibilities: input.permittedVisibilities,
|
|
56
|
+
});
|
|
57
|
+
const conflictIds = conflicts.map((conflict) => conflict.conflictId);
|
|
58
|
+
if (conflictIds.length > 0) {
|
|
59
|
+
return abstain('unresolved_conflict', previousAtom, sourceEvents, conflictIds);
|
|
60
|
+
}
|
|
61
|
+
const successorDraft = {
|
|
62
|
+
memoryId: input.successorMemoryId,
|
|
63
|
+
memoryType: input.memoryType,
|
|
64
|
+
content: input.claim,
|
|
65
|
+
sourceAgentId: input.proposedBy,
|
|
66
|
+
sourceEventIds: [...input.sourceEventIds],
|
|
67
|
+
sourceMemoryIds: [previousAtom.memoryId],
|
|
68
|
+
scope: previousAtom.scope,
|
|
69
|
+
visibility: previousAtom.visibility,
|
|
70
|
+
status: 'candidate',
|
|
71
|
+
// Conservative planner metadata only. The future apply gate must recompute
|
|
72
|
+
// or validate scores before insertion; these values never authorize action.
|
|
73
|
+
scores: {
|
|
74
|
+
confidence: 0.2,
|
|
75
|
+
evidence: sourceEvents.length / input.sourceEventIds.length,
|
|
76
|
+
authority: 0.2,
|
|
77
|
+
freshness: 0.5,
|
|
78
|
+
stability: 0.2,
|
|
79
|
+
consensus: 0.2,
|
|
80
|
+
},
|
|
81
|
+
validFrom: input.proposedAt,
|
|
82
|
+
validUntil: previousAtom.validUntil,
|
|
83
|
+
lastConfirmedAt: null,
|
|
84
|
+
links: [{ relation: 'supersedes', targetMemoryId: previousAtom.memoryId }],
|
|
85
|
+
};
|
|
86
|
+
const parsed = MemoryAtomSchema.safeParse(successorDraft);
|
|
87
|
+
if (!parsed.success) {
|
|
88
|
+
return abstain('invalid_successor_draft', previousAtom, sourceEvents, []);
|
|
89
|
+
}
|
|
90
|
+
const plannedTransitions = previousAtom.status === 'deprecated'
|
|
91
|
+
? []
|
|
92
|
+
: [
|
|
93
|
+
{
|
|
94
|
+
memoryId: previousAtom.memoryId,
|
|
95
|
+
nextStatus: 'deprecated',
|
|
96
|
+
reason: {
|
|
97
|
+
actor: input.proposedBy,
|
|
98
|
+
rationale: `phase2:reconsolidated_by:${input.successorMemoryId}`,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
];
|
|
102
|
+
return {
|
|
103
|
+
outcome: 'plan',
|
|
104
|
+
reasons: [],
|
|
105
|
+
previousAtom,
|
|
106
|
+
sourceEvents,
|
|
107
|
+
successorDraft: parsed.data,
|
|
108
|
+
plannedTransitions,
|
|
109
|
+
relatedConflictIds: [],
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
export class ReconsolidationApplier {
|
|
114
|
+
stores;
|
|
115
|
+
planner;
|
|
116
|
+
/**
|
|
117
|
+
* Create a human-confirmed reconsolidation applier.
|
|
118
|
+
*
|
|
119
|
+
* @remarks
|
|
120
|
+
* This wraps `ReconsolidationPlanner` and adds the explicit mutation path.
|
|
121
|
+
* Hosts should call `plan()` directly when they only need a preview.
|
|
122
|
+
*/
|
|
123
|
+
constructor(stores) {
|
|
124
|
+
this.stores = stores;
|
|
125
|
+
this.planner = new ReconsolidationPlanner(stores);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Apply a reconsolidation plan after human confirmation.
|
|
129
|
+
*
|
|
130
|
+
* @remarks
|
|
131
|
+
* The method fails closed with `ask_human` without valid confirmation. When
|
|
132
|
+
* confirmed, it inserts the successor candidate first and then applies
|
|
133
|
+
* planned deprecations through `MemoryStore.transitionStatus()`. If successor
|
|
134
|
+
* insertion fails, no prior atom is deprecated.
|
|
135
|
+
*/
|
|
136
|
+
async apply(input) {
|
|
137
|
+
const plan = await this.planner.plan(input);
|
|
138
|
+
if (plan.outcome !== 'plan' || plan.successorDraft === null) {
|
|
139
|
+
return {
|
|
140
|
+
outcome: 'fetch_abstain',
|
|
141
|
+
reasons: plan.reasons,
|
|
142
|
+
plan,
|
|
143
|
+
successorAtom: null,
|
|
144
|
+
transitionResults: [],
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
if (input.humanConfirmation === undefined) {
|
|
148
|
+
return {
|
|
149
|
+
outcome: 'ask_human',
|
|
150
|
+
reasons: ['human_confirmation_required'],
|
|
151
|
+
plan,
|
|
152
|
+
successorAtom: null,
|
|
153
|
+
transitionResults: [],
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
if (!validHumanConfirmation(input.humanConfirmation)) {
|
|
157
|
+
return {
|
|
158
|
+
outcome: 'ask_human',
|
|
159
|
+
reasons: ['invalid_human_confirmation'],
|
|
160
|
+
plan,
|
|
161
|
+
successorAtom: null,
|
|
162
|
+
transitionResults: [],
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
let successorAtom;
|
|
166
|
+
try {
|
|
167
|
+
successorAtom = await this.stores.memoryStore.insert(plan.successorDraft);
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
return {
|
|
171
|
+
outcome: 'rejected',
|
|
172
|
+
reasons: ['successor_insert_failed'],
|
|
173
|
+
plan,
|
|
174
|
+
successorAtom: null,
|
|
175
|
+
transitionResults: [],
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
const transitionResults = [];
|
|
179
|
+
for (const transition of plan.plannedTransitions) {
|
|
180
|
+
try {
|
|
181
|
+
transitionResults.push(await this.stores.memoryStore.transitionStatus(transition.memoryId, transition.nextStatus, confirmationReason(transition.reason, input.humanConfirmation), { at: input.humanConfirmation.confirmedAt }));
|
|
182
|
+
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
transitionResults.push({
|
|
185
|
+
kind: 'rejected',
|
|
186
|
+
reason: err instanceof Error ? err.message : 'transition threw',
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
const rejected = transitionResults.some((result) => result.kind === 'rejected');
|
|
191
|
+
return {
|
|
192
|
+
outcome: rejected ? 'partial_applied' : 'applied',
|
|
193
|
+
reasons: rejected ? ['transition_rejected'] : [],
|
|
194
|
+
plan,
|
|
195
|
+
successorAtom,
|
|
196
|
+
transitionResults,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function isReconsolidatableStatus(status) {
|
|
201
|
+
return (status === 'candidate' ||
|
|
202
|
+
status === 'verified' ||
|
|
203
|
+
status === 'trusted' ||
|
|
204
|
+
status === 'deprecated');
|
|
205
|
+
}
|
|
206
|
+
function validHumanConfirmation(confirmation) {
|
|
207
|
+
return (AgentIdSchema.safeParse(confirmation.confirmedBy).success &&
|
|
208
|
+
IsoTimestampSchema.safeParse(confirmation.confirmedAt).success &&
|
|
209
|
+
typeof confirmation.rationale === 'string' &&
|
|
210
|
+
confirmation.rationale.trim().length > 0);
|
|
211
|
+
}
|
|
212
|
+
function confirmationReason(plannedReason, confirmation) {
|
|
213
|
+
return {
|
|
214
|
+
actor: confirmation.confirmedBy,
|
|
215
|
+
rationale: `${plannedReason.rationale}; human_confirmed: ${confirmation.rationale}`,
|
|
216
|
+
...(plannedReason.conflictId !== undefined ? { conflictId: plannedReason.conflictId } : {}),
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
function abstain(reason, previousAtom, sourceEvents, relatedConflictIds) {
|
|
220
|
+
return {
|
|
221
|
+
outcome: 'fetch_abstain',
|
|
222
|
+
reasons: [reason],
|
|
223
|
+
previousAtom,
|
|
224
|
+
sourceEvents,
|
|
225
|
+
successorDraft: null,
|
|
226
|
+
plannedTransitions: [],
|
|
227
|
+
relatedConflictIds,
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
//# sourceMappingURL=reconsolidation-planner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reconsolidation-planner.js","sourceRoot":"","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AAkB;KACnB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { MemoryId } from '@aletheia-labs/core';
|
|
2
|
+
import type { DynamicsDecision, DynamicsTickInput, DynamicsTickResult } from './dynamics-engine.js';
|
|
3
|
+
export type SleepCycleMode = 'dry_run' | 'apply';
|
|
4
|
+
export interface SleepCycleInput extends DynamicsTickInput {
|
|
5
|
+
readonly cycleId?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface SleepCycleReport {
|
|
8
|
+
readonly cycleId: string;
|
|
9
|
+
readonly mode: SleepCycleMode;
|
|
10
|
+
readonly now: DynamicsTickResult['now'];
|
|
11
|
+
readonly scope: DynamicsTickResult['scope'];
|
|
12
|
+
readonly scopeKey: string;
|
|
13
|
+
readonly outcome: DynamicsTickResult['outcome'];
|
|
14
|
+
readonly reasons: readonly string[];
|
|
15
|
+
readonly decisions: readonly DynamicsDecision[];
|
|
16
|
+
readonly appliedMemoryIds: readonly MemoryId[];
|
|
17
|
+
readonly plannedMemoryIds: readonly MemoryId[];
|
|
18
|
+
readonly rejectedMemoryIds: readonly MemoryId[];
|
|
19
|
+
readonly skippedMemoryIds: readonly MemoryId[];
|
|
20
|
+
readonly appliedCount: number;
|
|
21
|
+
readonly plannedCount: number;
|
|
22
|
+
readonly rejectedCount: number;
|
|
23
|
+
readonly skippedCount: number;
|
|
24
|
+
}
|
|
25
|
+
export interface MultiCycleReport {
|
|
26
|
+
readonly reports: readonly SleepCycleReport[];
|
|
27
|
+
readonly appliedMemoryIds: readonly MemoryId[];
|
|
28
|
+
readonly plannedMemoryIds: readonly MemoryId[];
|
|
29
|
+
readonly rejectedMemoryIds: readonly MemoryId[];
|
|
30
|
+
readonly skippedMemoryIds: readonly MemoryId[];
|
|
31
|
+
readonly appliedCount: number;
|
|
32
|
+
readonly plannedCount: number;
|
|
33
|
+
readonly rejectedCount: number;
|
|
34
|
+
readonly skippedCount: number;
|
|
35
|
+
}
|
|
36
|
+
export interface SleepCycleEngine {
|
|
37
|
+
/**
|
|
38
|
+
* Run a lifecycle tick for a single explicit cycle input.
|
|
39
|
+
*/
|
|
40
|
+
tick(input: DynamicsTickInput): Promise<DynamicsTickResult>;
|
|
41
|
+
}
|
|
42
|
+
export declare class SleepCycleRunner {
|
|
43
|
+
private readonly engine;
|
|
44
|
+
/**
|
|
45
|
+
* Wrap a dynamics-compatible engine with report formatting helpers.
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
* The runner is an orchestrator, not a scheduler. It only runs when the host
|
|
49
|
+
* calls `run()` or `runMany()`.
|
|
50
|
+
*/
|
|
51
|
+
constructor(engine: SleepCycleEngine);
|
|
52
|
+
/**
|
|
53
|
+
* Run one explicit sleep cycle and return an audit-friendly report.
|
|
54
|
+
*
|
|
55
|
+
* @remarks
|
|
56
|
+
* The report mirrors the underlying `DynamicsEngine.tick()` result while
|
|
57
|
+
* grouping memory IDs by applied/planned/rejected/skipped outcome for logs,
|
|
58
|
+
* dashboards, or tests.
|
|
59
|
+
*/
|
|
60
|
+
run(input: SleepCycleInput): Promise<SleepCycleReport>;
|
|
61
|
+
/**
|
|
62
|
+
* Run a host-provided sequence of explicit cycles in order.
|
|
63
|
+
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* This is deterministic orchestration only. It does not retry, schedule,
|
|
66
|
+
* sleep, or watch the store; hosts decide when each cycle input exists.
|
|
67
|
+
*/
|
|
68
|
+
runMany(inputs: readonly SleepCycleInput[]): Promise<MultiCycleReport>;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=sleep-cycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sleep-cycle.d.ts","sourceRoot":"","sources":["../src/sleep-cycle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM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EAAE,SAAS,QAAQ,EAAE,CAAC;IAC/C,QAAQ,CAAC,iBAAiB,EAAE,SAAS,QAAQ,EAAE,CAAC;IAChD,QAAQ,CAAC,gBAAgB,EAAE,SAAS,QAAQ,EAAE,CAAC;IAC/C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAC7D;AAED,qBAAa,gBAAgB;IAQf,OAAO,CAAC,QAAQ,CAAC,MAAM;IAPnC;;;;;;OAMG;gBAC0B,MAAM,EAAE,gBAAgB;IAErD;;;;;;;OAOG;IACG,GAAG,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAwB5D;;;;;;OAMG;IACG,OAAO,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAkB7E"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { scopeKey } from '@aletheia-labs/core';
|
|
2
|
+
export class SleepCycleRunner {
|
|
3
|
+
engine;
|
|
4
|
+
/**
|
|
5
|
+
* Wrap a dynamics-compatible engine with report formatting helpers.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* The runner is an orchestrator, not a scheduler. It only runs when the host
|
|
9
|
+
* calls `run()` or `runMany()`.
|
|
10
|
+
*/
|
|
11
|
+
constructor(engine) {
|
|
12
|
+
this.engine = engine;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Run one explicit sleep cycle and return an audit-friendly report.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* The report mirrors the underlying `DynamicsEngine.tick()` result while
|
|
19
|
+
* grouping memory IDs by applied/planned/rejected/skipped outcome for logs,
|
|
20
|
+
* dashboards, or tests.
|
|
21
|
+
*/
|
|
22
|
+
async run(input) {
|
|
23
|
+
const result = await this.engine.tick(input);
|
|
24
|
+
const cycleId = input.cycleId ?? `sleep:${input.now}:${scopeKey(input.scope)}`;
|
|
25
|
+
return {
|
|
26
|
+
cycleId,
|
|
27
|
+
mode: input.applyTransitions === true ? 'apply' : 'dry_run',
|
|
28
|
+
now: result.now,
|
|
29
|
+
scope: result.scope,
|
|
30
|
+
scopeKey: scopeKey(result.scope),
|
|
31
|
+
outcome: result.outcome,
|
|
32
|
+
reasons: result.reasons,
|
|
33
|
+
decisions: result.decisions,
|
|
34
|
+
appliedMemoryIds: idsFor(result.decisions, 'applied'),
|
|
35
|
+
plannedMemoryIds: idsFor(result.decisions, 'planned'),
|
|
36
|
+
rejectedMemoryIds: idsFor(result.decisions, 'rejected'),
|
|
37
|
+
skippedMemoryIds: idsFor(result.decisions, 'skipped'),
|
|
38
|
+
appliedCount: result.appliedCount,
|
|
39
|
+
plannedCount: result.plannedCount,
|
|
40
|
+
rejectedCount: result.rejectedCount,
|
|
41
|
+
skippedCount: result.skippedCount,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Run a host-provided sequence of explicit cycles in order.
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
* This is deterministic orchestration only. It does not retry, schedule,
|
|
49
|
+
* sleep, or watch the store; hosts decide when each cycle input exists.
|
|
50
|
+
*/
|
|
51
|
+
async runMany(inputs) {
|
|
52
|
+
const reports = [];
|
|
53
|
+
for (const input of inputs) {
|
|
54
|
+
reports.push(await this.run(input));
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
reports,
|
|
58
|
+
appliedMemoryIds: uniqueFlatMap(reports, (report) => report.appliedMemoryIds),
|
|
59
|
+
plannedMemoryIds: uniqueFlatMap(reports, (report) => report.plannedMemoryIds),
|
|
60
|
+
rejectedMemoryIds: uniqueFlatMap(reports, (report) => report.rejectedMemoryIds),
|
|
61
|
+
skippedMemoryIds: uniqueFlatMap(reports, (report) => report.skippedMemoryIds),
|
|
62
|
+
appliedCount: reports.reduce((sum, report) => sum + report.appliedCount, 0),
|
|
63
|
+
plannedCount: reports.reduce((sum, report) => sum + report.plannedCount, 0),
|
|
64
|
+
rejectedCount: reports.reduce((sum, report) => sum + report.rejectedCount, 0),
|
|
65
|
+
skippedCount: reports.reduce((sum, report) => sum + report.skippedCount, 0),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function idsFor(decisions, outcome) {
|
|
70
|
+
return decisions
|
|
71
|
+
.filter((decision) => decision.outcome === outcome)
|
|
72
|
+
.map((decision) => decision.memoryId);
|
|
73
|
+
}
|
|
74
|
+
function uniqueFlatMap(reports, getIds) {
|
|
75
|
+
return [...new Set(reports.flatMap((report) => getIds(report)))];
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=sleep-cycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sleep-cycle.js","sourceRoot":"","sources":["../src/sleep-cycle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AA+C/C,MAAM,OAAO,gBAAgB;IAQE;IAP7B;;;;;;OAMG;IACH,YAA6B,MAAwB;QAAxB,WAAM,GAAN,MAAM,CAAkB;IAAG,CAAC;IAEzD;;;;;;;OAOG;IACH,KAAK,CAAC,GAAG,CAAC,KAAsB;QAC9B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7C,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,SAAS,KAAK,CAAC,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QAE/E,OAAO;YACL,OAA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
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aletheia-labs/dynamics",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Deterministic memory dynamics for Aletheia: decay, promotion, and conflict revisits.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md",
|
|
19
|
+
"LICENSE"
|
|
20
|
+
],
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@aletheia-labs/core": "0.1.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "^22.10.0",
|
|
26
|
+
"typescript": "^5.6.3",
|
|
27
|
+
"vitest": "^2.1.8"
|
|
28
|
+
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"aletheia",
|
|
34
|
+
"llm",
|
|
35
|
+
"memory",
|
|
36
|
+
"dynamics",
|
|
37
|
+
"agents"
|
|
38
|
+
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsc -p tsconfig.json",
|
|
41
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
42
|
+
"test": "vitest run",
|
|
43
|
+
"test:watch": "vitest"
|
|
44
|
+
}
|
|
45
|
+
}
|