@adam0white/human-framework 2.8.0 → 2.9.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.
- package/dist/agenda/agenda.d.ts +9 -1
- package/dist/agenda/agenda.js +37 -16
- package/dist/beliefs/beliefs.d.ts +22 -0
- package/dist/beliefs/beliefs.js +51 -0
- package/dist/cognition/cognition.js +8 -6
- package/dist/conscience/conscience.d.ts +7 -3
- package/dist/conscience/conscience.js +5 -1
- package/dist/core/math.d.ts +1 -0
- package/dist/core/math.js +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/migrate.js +16 -1
- package/dist/person.js +121 -98
- package/dist/promptings/promptings.d.ts +15 -2
- package/dist/promptings/promptings.js +82 -26
- package/dist/prospection/prospection.js +8 -2
- package/dist/restore.d.ts +9 -0
- package/dist/restore.js +20 -0
- package/dist/review/review.js +16 -2
- package/dist/sim/sim.d.ts +7 -2
- package/dist/sim/sim.js +118 -93
- package/dist/types.d.ts +41 -5
- package/dist/types.js +1 -1
- package/dist/will/will.js +94 -65
- package/package.json +1 -1
package/dist/agenda/agenda.d.ts
CHANGED
|
@@ -108,13 +108,21 @@ export declare const violatesAbstention: (c: Commitment, action: string, start:
|
|
|
108
108
|
* keeps by the same rule, so a pull never leads to an activity that cannot keep the commitment.
|
|
109
109
|
*/
|
|
110
110
|
export declare const spanMeetsWindow: (c: Commitment, start: Minute, end: Minute) => boolean;
|
|
111
|
+
/**
|
|
112
|
+
* The agenda's utility terms for one offer: `commitment:<id>` toward a pending commitment it serves,
|
|
113
|
+
* `abstain:<id>` against an act that would break an open abstention, and `goal:<id>` toward an active goal it
|
|
114
|
+
* advances. Goal terms are never negative, by design: a goal draws a person toward what advances it and is silent
|
|
115
|
+
* about everything else, so it cannot weigh against a temptation. A host that wants an act opposed links it to a
|
|
116
|
+
* held norm (`norms: violates`), an `abstain` commitment, or a commitment kept by the alternative.
|
|
117
|
+
*/
|
|
111
118
|
export declare function agendaTerms(p: Person, aff: Affordance, now: Minute): Term[];
|
|
112
119
|
/**
|
|
113
120
|
* Apply a finished activity. Only completed outcomes count. A completed violating action breaks every open
|
|
114
121
|
* abstention whose window its span overlaps (returned as `broken`; the composite routes them like missed
|
|
115
122
|
* commitments, with a breach when a norm is linked). One completion keeps the earliest-ending
|
|
116
123
|
* matching pending commitment whose window the activity's span [startedAt, outcome.at] overlaps (see
|
|
117
|
-
* `spanMeetsWindow`; `startedAt` defaults to `outcome.at`)
|
|
124
|
+
* `spanMeetsWindow`; `startedAt` defaults to `outcome.at`), except that when `outcome.fulfills` lists two or more
|
|
125
|
+
* ids, every listed commitment that qualifies is kept and no other (2.9.0); goals advance by their listed amount.
|
|
118
126
|
* Matching is by action (and target), or explicitly by `outcome.fulfills` / `outcome.advances` (the composite
|
|
119
127
|
* defaults these to the activity's `Affordance.fulfills` / `advances`), mirroring `agendaTerms`.
|
|
120
128
|
*/
|
package/dist/agenda/agenda.js
CHANGED
|
@@ -489,7 +489,7 @@ function deadlinePressure(g, now) {
|
|
|
489
489
|
return 1 + AGENDA_DEFAULTS.goalDeadlineBoost * clamp01((now - g.adoptedAt) / span);
|
|
490
490
|
}
|
|
491
491
|
/** Shared existing amount and urgency reader; no future knowledge is consulted here. @internal */
|
|
492
|
-
|
|
492
|
+
function goalValue(g, aff, now) {
|
|
493
493
|
const amount = goalAmount(g, aff);
|
|
494
494
|
return amount > 0
|
|
495
495
|
? g.importance * clamp01(amount * AGENDA_DEFAULTS.goalAmountGain) * deadlinePressure(g, now)
|
|
@@ -504,6 +504,13 @@ export function temporalGoalValue(p, g, aff, now, completion) {
|
|
|
504
504
|
dpow(0.5, Math.max(0, completion - now) / g.temporal.halfLifeMinutes)
|
|
505
505
|
: base;
|
|
506
506
|
}
|
|
507
|
+
/**
|
|
508
|
+
* The agenda's utility terms for one offer: `commitment:<id>` toward a pending commitment it serves,
|
|
509
|
+
* `abstain:<id>` against an act that would break an open abstention, and `goal:<id>` toward an active goal it
|
|
510
|
+
* advances. Goal terms are never negative, by design: a goal draws a person toward what advances it and is silent
|
|
511
|
+
* about everything else, so it cannot weigh against a temptation. A host that wants an act opposed links it to a
|
|
512
|
+
* held norm (`norms: violates`), an `abstain` commitment, or a commitment kept by the alternative.
|
|
513
|
+
*/
|
|
507
514
|
export function agendaTerms(p, aff, now) {
|
|
508
515
|
return agendaTermsWithGoalEstimates(p, aff, now);
|
|
509
516
|
}
|
|
@@ -599,7 +606,8 @@ function excuseUnderNecessity(p, c, at, catalog) {
|
|
|
599
606
|
* abstention whose window its span overlaps (returned as `broken`; the composite routes them like missed
|
|
600
607
|
* commitments, with a breach when a norm is linked). One completion keeps the earliest-ending
|
|
601
608
|
* matching pending commitment whose window the activity's span [startedAt, outcome.at] overlaps (see
|
|
602
|
-
* `spanMeetsWindow`; `startedAt` defaults to `outcome.at`)
|
|
609
|
+
* `spanMeetsWindow`; `startedAt` defaults to `outcome.at`), except that when `outcome.fulfills` lists two or more
|
|
610
|
+
* ids, every listed commitment that qualifies is kept and no other (2.9.0); goals advance by their listed amount.
|
|
603
611
|
* Matching is by action (and target), or explicitly by `outcome.fulfills` / `outcome.advances` (the composite
|
|
604
612
|
* defaults these to the activity's `Affordance.fulfills` / `advances`), mirroring `agendaTerms`.
|
|
605
613
|
*/
|
|
@@ -627,21 +635,34 @@ export function onFinished(p, outcome, startedAt = outcome.at, opts = {}) {
|
|
|
627
635
|
broken.push(c);
|
|
628
636
|
oweFor(p, c, 'broken', outcome.at);
|
|
629
637
|
}
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
638
|
+
// Commitments named explicitly (2.9.0): when `fulfills` lists two or more ids, every listed commitment that is
|
|
639
|
+
// eligible is kept and no other (one dinner keeps a word to a friend and the daily call). With one id listed, or
|
|
640
|
+
// none of several eligible, one completion keeps the earliest-ending match, explicit or by action, as before.
|
|
641
|
+
const eligible = (c) => c.status === 'pending' && c.kind !== 'abstain' && spanMeetsWindow(c, start, outcome.at);
|
|
642
|
+
const named = outcome.fulfills
|
|
643
|
+
? p.agenda.commitments.filter((c) => (outcome.fulfills?.includes(c.id) ?? false) && eligible(c))
|
|
644
|
+
: [];
|
|
645
|
+
if (new Set(outcome.fulfills ?? []).size > 1 && named.length > 0) {
|
|
646
|
+
for (const c of named) {
|
|
647
|
+
c.status = 'kept';
|
|
648
|
+
kept.push(c);
|
|
649
|
+
}
|
|
641
650
|
}
|
|
642
|
-
|
|
643
|
-
best
|
|
644
|
-
|
|
651
|
+
else {
|
|
652
|
+
let best;
|
|
653
|
+
for (const c of p.agenda.commitments) {
|
|
654
|
+
if (!eligible(c))
|
|
655
|
+
continue;
|
|
656
|
+
const explicit = outcome.fulfills?.includes(c.id) ?? false;
|
|
657
|
+
if (!explicit && !matchesCommitment(c, outcome.action, outcome.targetId))
|
|
658
|
+
continue;
|
|
659
|
+
if (!best || c.until < best.until)
|
|
660
|
+
best = c;
|
|
661
|
+
}
|
|
662
|
+
if (best) {
|
|
663
|
+
best.status = 'kept';
|
|
664
|
+
kept.push(best);
|
|
665
|
+
}
|
|
645
666
|
}
|
|
646
667
|
for (const g of p.agenda.goals) {
|
|
647
668
|
if (g.status !== 'active')
|
|
@@ -39,7 +39,29 @@ export interface AttendContext {
|
|
|
39
39
|
}
|
|
40
40
|
/** Attention as limited capacity: keep the K most relevant percepts plus any that cannot be ignored. */
|
|
41
41
|
export declare function attend(p: Person, percepts: Percept[], ctx: AttendContext): Percept[];
|
|
42
|
+
/** Information-source trust, independent of relationship trust and advising-voice trust. */
|
|
42
43
|
export declare function trustOf(p: Person, sourceId: EntityId): Unit;
|
|
44
|
+
/**
|
|
45
|
+
* Set authored trust in an information source, clamped to 0..1. Writes only `memory.sourceTrust`;
|
|
46
|
+
* it does not change relationship trust or advising-voice trust. Nonfinite trust and self ids throw.
|
|
47
|
+
* Later `believe` (including testimony through `perceive`) reads this trust; `confirm` recalibrates it.
|
|
48
|
+
*/
|
|
49
|
+
export declare function seedSourceTrust(p: Person, sourceId: EntityId, trust: Unit): Unit;
|
|
50
|
+
/**
|
|
51
|
+
* Set or replace an authored belief without applying source trust or recording an observation.
|
|
52
|
+
* `credence` is the probability that `value` holds, clamped to 0..1 and stored as bounded signed
|
|
53
|
+
* log-odds. `at` defaults to the person's current minute. Nonfinite credence or time throws.
|
|
54
|
+
* Only `memory.beliefs` changes, with ordinary belief eviction. An omitted source leaves no sources;
|
|
55
|
+
* a named source records its claim for later `confirm`, without changing any trust store now. The person's own id
|
|
56
|
+
* and 'self' are refused (they mark observation): use `confirm` for something the person saw.
|
|
57
|
+
* It does not apply reputation to relationships; use `seedTie` to author a relationship.
|
|
58
|
+
*/
|
|
59
|
+
export declare function seedBelief(p: Person, prop: string, spec: {
|
|
60
|
+
value: boolean;
|
|
61
|
+
credence: Unit;
|
|
62
|
+
at?: Minute;
|
|
63
|
+
source?: EntityId;
|
|
64
|
+
}): Belief;
|
|
43
65
|
/** Testimony or inference: add reliability-weighted log-odds evidence for (or against) `prop`. */
|
|
44
66
|
export declare function believe(p: Person, prop: string, value: boolean, confidence: Unit, sourceId: EntityId, now: Minute): Belief;
|
|
45
67
|
export declare function credence(p: Person, prop: string): Unit;
|
package/dist/beliefs/beliefs.js
CHANGED
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
* gained, the trust-asymmetry finding). It does NOT model motivated reasoning, belief networks or
|
|
9
9
|
* inference between propositions, source memory errors, or social consensus effects; parameters are
|
|
10
10
|
* engineering defaults for game time scales.
|
|
11
|
+
*
|
|
12
|
+
* Three independent stores: `social.relationships[].trust` moves through authored ties, social events
|
|
13
|
+
* (including forgiveness), judged acts and reputation; `will.voices[].trust` moves through followed-advice
|
|
14
|
+
* outcomes, insisting, commands, `noteVoicePromise`, `seedVoice` and `adoptVoiceTrust` (also used by upbringing).
|
|
15
|
+
* This module owns `memory.sourceTrust`: `seedSourceTrust` authors it and `confirm` recalibrates it.
|
|
16
|
+
* `believe`, including testimony delivered by `perceive`, weights claims by source trust, read by `trustOf`.
|
|
11
17
|
*/
|
|
12
18
|
import { clamp, clamp01, decay, dpow, expit, logit } from '../core/index.js';
|
|
13
19
|
import { MINUTES_PER_DAY } from '../types.js';
|
|
@@ -97,11 +103,31 @@ export function attend(p, percepts, ctx) {
|
|
|
97
103
|
}
|
|
98
104
|
return out;
|
|
99
105
|
}
|
|
106
|
+
/** Information-source trust, independent of relationship trust and advising-voice trust. */
|
|
100
107
|
export function trustOf(p, sourceId) {
|
|
101
108
|
if (sourceId === p.id || sourceId === 'self')
|
|
102
109
|
return BELIEF_DEFAULTS.selfTrust;
|
|
103
110
|
return p.memory.sourceTrust[sourceId] ?? BELIEF_DEFAULTS.defaultTrust;
|
|
104
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Set authored trust in an information source, clamped to 0..1. Writes only `memory.sourceTrust`;
|
|
114
|
+
* it does not change relationship trust or advising-voice trust. Nonfinite trust and self ids throw.
|
|
115
|
+
* Later `believe` (including testimony through `perceive`) reads this trust; `confirm` recalibrates it.
|
|
116
|
+
*/
|
|
117
|
+
export function seedSourceTrust(p, sourceId, trust) {
|
|
118
|
+
if (!Number.isFinite(trust))
|
|
119
|
+
throw new Error('human: source trust must be finite');
|
|
120
|
+
if (sourceId === p.id || sourceId === 'self')
|
|
121
|
+
throw new Error('human: self trust cannot be seeded');
|
|
122
|
+
const value = clamp01(trust);
|
|
123
|
+
Object.defineProperty(p.memory.sourceTrust, sourceId, {
|
|
124
|
+
value,
|
|
125
|
+
writable: true,
|
|
126
|
+
enumerable: true,
|
|
127
|
+
configurable: true,
|
|
128
|
+
});
|
|
129
|
+
return value;
|
|
130
|
+
}
|
|
105
131
|
/** Testimony weight from trust: 0 at or below the floor, never negative, so low trust alone never flips a claim. @internal */
|
|
106
132
|
export function testimonyWeight(trust) {
|
|
107
133
|
const d = BELIEF_DEFAULTS;
|
|
@@ -141,6 +167,31 @@ function ensureBelief(p, prop, now) {
|
|
|
141
167
|
}
|
|
142
168
|
return b;
|
|
143
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* Set or replace an authored belief without applying source trust or recording an observation.
|
|
172
|
+
* `credence` is the probability that `value` holds, clamped to 0..1 and stored as bounded signed
|
|
173
|
+
* log-odds. `at` defaults to the person's current minute. Nonfinite credence or time throws.
|
|
174
|
+
* Only `memory.beliefs` changes, with ordinary belief eviction. An omitted source leaves no sources;
|
|
175
|
+
* a named source records its claim for later `confirm`, without changing any trust store now. The person's own id
|
|
176
|
+
* and 'self' are refused (they mark observation): use `confirm` for something the person saw.
|
|
177
|
+
* It does not apply reputation to relationships; use `seedTie` to author a relationship.
|
|
178
|
+
*/
|
|
179
|
+
export function seedBelief(p, prop, spec) {
|
|
180
|
+
const at = spec.at ?? p.now;
|
|
181
|
+
if (!Number.isFinite(spec.credence))
|
|
182
|
+
throw new Error('human: belief credence must be finite');
|
|
183
|
+
if (!Number.isFinite(at))
|
|
184
|
+
throw new Error('human: belief time must be finite');
|
|
185
|
+
// The person's own id and 'self' mark direct observation (`observedDiscount`, `confirm`); authoring is not seeing.
|
|
186
|
+
if (spec.source === p.id || spec.source === 'self')
|
|
187
|
+
throw new Error('human: an authored belief cannot name the person as its source; use confirm for an observation');
|
|
188
|
+
const b = ensureBelief(p, prop, at);
|
|
189
|
+
const limit = BELIEF_DEFAULTS.maxLogOdds;
|
|
190
|
+
b.logOdds = clamp((spec.value ? 1 : -1) * logit(clamp01(spec.credence)), -limit, limit);
|
|
191
|
+
b.updatedAt = at;
|
|
192
|
+
b.sources = spec.source === undefined ? [] : [{ id: spec.source, value: spec.value }];
|
|
193
|
+
return b;
|
|
194
|
+
}
|
|
144
195
|
/** Testimony or inference: add reliability-weighted log-odds evidence for (or against) `prop`. */
|
|
145
196
|
export function believe(p, prop, value, confidence, sourceId, now) {
|
|
146
197
|
const d = BELIEF_DEFAULTS;
|
|
@@ -225,7 +225,7 @@ export function socialContext(ctx) {
|
|
|
225
225
|
};
|
|
226
226
|
}
|
|
227
227
|
/** Same perceived-body effort estimate for actual offers and received successors. @internal */
|
|
228
|
-
|
|
228
|
+
function effortValue(p, aff, ctx) {
|
|
229
229
|
const K = COGNITION_DEFAULTS;
|
|
230
230
|
const per = ctx.body.perceived;
|
|
231
231
|
const effort = clamp01(aff.effort);
|
|
@@ -239,7 +239,7 @@ export function effortValue(p, aff, ctx) {
|
|
|
239
239
|
return -K.effortScale * effortCost;
|
|
240
240
|
}
|
|
241
241
|
/** Same material valuation for actual offers and received successor costs. @internal */
|
|
242
|
-
|
|
242
|
+
function materialValue(p, material, scarcity) {
|
|
243
243
|
const K = COGNITION_DEFAULTS;
|
|
244
244
|
const v = p.values;
|
|
245
245
|
const weight = (v.security + v.achievement + v.power) / 3;
|
|
@@ -254,11 +254,11 @@ export function consider(p, aff, ctx) {
|
|
|
254
254
|
const K = COGNITION_DEFAULTS;
|
|
255
255
|
const scarcity = clamp01(Number.isFinite(ctx.scarcity) ? ctx.scarcity : 0);
|
|
256
256
|
const terms = [];
|
|
257
|
-
const push = (source, value) => {
|
|
257
|
+
const push = (source, value, ref) => {
|
|
258
258
|
const v = round(value);
|
|
259
259
|
// A non-finite term (bad host number) is dropped; the will vetoes the offer as invalid.
|
|
260
260
|
if (v !== 0 && Number.isFinite(v))
|
|
261
|
-
terms.push({ source, value: v });
|
|
261
|
+
terms.push(ref === undefined ? { source, value: v } : { source, value: v, ref });
|
|
262
262
|
};
|
|
263
263
|
// Needs: urgency × believed gain × believed success.
|
|
264
264
|
const expected = expectedEffect(p, aff);
|
|
@@ -459,7 +459,7 @@ export function consider(p, aff, ctx) {
|
|
|
459
459
|
// Evening review (2.7.0, opt-in): a resolve formed after a lapse leans on that commitment's own term.
|
|
460
460
|
if (p.review)
|
|
461
461
|
for (const t of reviewTerms(p, terms))
|
|
462
|
-
push(t.source, t.value);
|
|
462
|
+
push(t.source, t.value, t.ref);
|
|
463
463
|
let utility = 0;
|
|
464
464
|
for (const t of terms)
|
|
465
465
|
utility += t.value;
|
|
@@ -541,12 +541,14 @@ export function decide(p, affordances, ctx) {
|
|
|
541
541
|
const prompts = [];
|
|
542
542
|
const tagsOf = new Map(sorted.map((a) => [a.id, a.tags]));
|
|
543
543
|
for (const c of res.considered) {
|
|
544
|
-
const
|
|
544
|
+
const tags = tagsOf.get(c.affordanceId);
|
|
545
|
+
const seen = promptIn(c.terms, tags);
|
|
545
546
|
if (seen)
|
|
546
547
|
prompts.push({
|
|
547
548
|
affordanceId: c.affordanceId,
|
|
548
549
|
action: c.action,
|
|
549
550
|
...seen,
|
|
551
|
+
...(tags !== undefined ? { tags } : {}),
|
|
550
552
|
// A vetoed option was not turned from: the will blocked it, so the response earns no practice.
|
|
551
553
|
turnApplied: c.vetoed === undefined && c.terms.some((t) => t.source === 'promptings:turn'),
|
|
552
554
|
});
|
|
@@ -100,9 +100,13 @@ export declare function recordDeed(p: Person, aff: Affordance, intention: string
|
|
|
100
100
|
* The person repents a breach: regret, stopping and resolve. When another person was wronged,
|
|
101
101
|
* restitution is also required, so the breach closes only after `recordRepair` for that victim.
|
|
102
102
|
* Returns whether the breach is now closed. This records the person's acts, not acceptance.
|
|
103
|
+
* The unused `_now` parameter is optional since 2.9.1 and is removed in 3.0.
|
|
103
104
|
*/
|
|
104
|
-
export declare function repent(p: Person, id: string, _now
|
|
105
|
-
/**
|
|
106
|
-
|
|
105
|
+
export declare function repent(p: Person, id: string, _now?: Minute): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Restitution/apology delivered to a wronged person (host-attested): closes their open breaches.
|
|
108
|
+
* The unused `_now` parameter is optional since 2.9.1 and is removed in 3.0.
|
|
109
|
+
*/
|
|
110
|
+
export declare function recordRepair(p: Person, victimId: string, _now?: Minute): number;
|
|
107
111
|
/** Felt weight of open breaches, saturating: 1 - Π(1 - weight). Input for guilt in affect. */
|
|
108
112
|
export declare function guiltLoad(p: Person): Unit;
|
|
@@ -351,6 +351,7 @@ export function recordDeed(p, aff, intention, now, completed, opts = {}) {
|
|
|
351
351
|
* The person repents a breach: regret, stopping and resolve. When another person was wronged,
|
|
352
352
|
* restitution is also required, so the breach closes only after `recordRepair` for that victim.
|
|
353
353
|
* Returns whether the breach is now closed. This records the person's acts, not acceptance.
|
|
354
|
+
* The unused `_now` parameter is optional since 2.9.1 and is removed in 3.0.
|
|
354
355
|
*/
|
|
355
356
|
export function repent(p, id, _now) {
|
|
356
357
|
const breach = p.conscience.breaches.find((b) => b.id === id);
|
|
@@ -361,7 +362,10 @@ export function repent(p, id, _now) {
|
|
|
361
362
|
breach.repaired = true;
|
|
362
363
|
return true;
|
|
363
364
|
}
|
|
364
|
-
/**
|
|
365
|
+
/**
|
|
366
|
+
* Restitution/apology delivered to a wronged person (host-attested): closes their open breaches.
|
|
367
|
+
* The unused `_now` parameter is optional since 2.9.1 and is removed in 3.0.
|
|
368
|
+
*/
|
|
365
369
|
export function recordRepair(p, victimId, _now) {
|
|
366
370
|
let count = 0;
|
|
367
371
|
for (const b of p.conscience.breaches) {
|
package/dist/core/math.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare const clampSigned: (value: number) => number;
|
|
|
5
5
|
export declare const lerp: (a: number, b: number, t: number) => number;
|
|
6
6
|
export declare const sigmoid: (x: number) => number;
|
|
7
7
|
export declare const logit: (p: number) => number;
|
|
8
|
+
/** @deprecated since 2.9.1, removed in 3.0; use sigmoid */
|
|
8
9
|
export declare const expit: typeof sigmoid;
|
|
9
10
|
/** Exponential decay of `value` toward `target` over `dt` minutes with the given half-life. */
|
|
10
11
|
export declare function decay(value: number, dt: number, halfLife: number, target?: number): number;
|
package/dist/core/math.js
CHANGED
|
@@ -36,6 +36,7 @@ export const logit = (p) => {
|
|
|
36
36
|
const q = clamp(p, 1e-6, 1 - 1e-6);
|
|
37
37
|
return dlog(q / (1 - q));
|
|
38
38
|
};
|
|
39
|
+
/** @deprecated since 2.9.1, removed in 3.0; use sigmoid */
|
|
39
40
|
export const expit = sigmoid;
|
|
40
41
|
/** Exponential decay of `value` toward `target` over `dt` minutes with the given half-life. */
|
|
41
42
|
export function decay(value, dt, halfLife, target = 0) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/** Human Framework
|
|
2
|
-
export declare const FRAMEWORK_VERSION = "2.
|
|
1
|
+
/** Human Framework public surface. */
|
|
2
|
+
export declare const FRAMEWORK_VERSION = "2.9.1";
|
|
3
3
|
export type { CrisisEvent, PracticeKind } from './affect/index.ts';
|
|
4
4
|
export { AFFECT_DEFAULTS, actionTendencies, advanceAffect, appraise, breakAllows, breakBehaviour, breakHazard, CRISIS_DEFAULTS, checkCrisis, createAffect, easeBreak, emotionLevel, enableBreaks, feel, inBreak, readAffect, regulate, release as releaseEmotion, skipCrisis, strain, tendencyEmotions, } from './affect/index.ts';
|
|
5
5
|
export type { GoalTemplate, PrayerCalendar, PrayerSchedule, PrayerTimes, Retimer, } from './agenda/index.ts';
|
|
@@ -31,7 +31,7 @@ export * from './person.ts';
|
|
|
31
31
|
export * from './promptings/index.ts';
|
|
32
32
|
export type { ConsequenceEvidence } from './prospection/index.ts';
|
|
33
33
|
export { bodyForecastFor, bodyForecastTerm, consequenceEvidence, FORECAST_DEFAULTS, forecastLine, forecastThresholds, PROSPECTION_DEFAULTS, } from './prospection/index.ts';
|
|
34
|
-
export
|
|
34
|
+
export { fingerprint, restore, snapshot } from './restore.ts';
|
|
35
35
|
export * from './review/index.ts';
|
|
36
36
|
export * from './scenarios/index.ts';
|
|
37
37
|
export * from './sim/index.ts';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/** Human Framework
|
|
2
|
-
export const FRAMEWORK_VERSION = '2.
|
|
1
|
+
/** Human Framework public surface. */
|
|
2
|
+
export const FRAMEWORK_VERSION = '2.9.1';
|
|
3
3
|
export { AFFECT_DEFAULTS, actionTendencies, advanceAffect, appraise, breakAllows, breakBehaviour, breakHazard, CRISIS_DEFAULTS, checkCrisis, createAffect, easeBreak, emotionLevel, enableBreaks, feel, inBreak, readAffect, regulate, release as releaseEmotion, skipCrisis, strain, tendencyEmotions, } from './affect/index.js';
|
|
4
4
|
// `agenda.release` collides with `affect.release`; the agenda one is re-exported under a clearer name.
|
|
5
5
|
export { AGENDA_DEFAULTS, abandonGoal, adoptGoal, advanceAgenda, agendaTerms, applyExemptions, CARE_DEFAULTS, calendarRetimer, careDuty, commitmentPressure, createAgenda, DEFAULT_PRAYER_TIMES, EID_PRAYER_IMPORTANCE, EXEMPTION_DEFAULTS, eidPrayer, eidWindow, fastWindow, iftarWindow, inMakruhTime, isUnderWay, MAKRUH_DEFAULTS, makruhWindows, missedExcuse, onFinished, owedMakeUps, PRAYER_IMPORTANCE, PURPOSE_DEFAULTS, prayerWindows, pressureReachedAt, promise, proposeGoals, RAMADAN_DEFAULTS, ramadanFast, ramadanMeals, release as releaseCommitment, retimeCommitments, revisePurposes, scheduleMakeUp, spanMeetsWindow, suhoorWindow, timesFor, violatesAbstention, } from './agenda/index.js';
|
|
@@ -27,7 +27,7 @@ export * from './partnering/index.js';
|
|
|
27
27
|
export * from './person.js';
|
|
28
28
|
export * from './promptings/index.js';
|
|
29
29
|
export { bodyForecastFor, bodyForecastTerm, consequenceEvidence, FORECAST_DEFAULTS, forecastLine, forecastThresholds, PROSPECTION_DEFAULTS, } from './prospection/index.js';
|
|
30
|
-
export
|
|
30
|
+
export { fingerprint, restore, snapshot } from './restore.js';
|
|
31
31
|
export * from './review/index.js';
|
|
32
32
|
export * from './scenarios/index.js';
|
|
33
33
|
export * from './sim/index.js';
|
package/dist/migrate.js
CHANGED
|
@@ -8,7 +8,17 @@
|
|
|
8
8
|
* field of the optional surroundings slice (`ambient.now` → `ambient.percept`) and changes no behaviour (the optional `social.impressions` and `social.reserve`, like `retention`, are optional and start
|
|
9
9
|
* absent in a migrated save); `restore` then fills and sanitizes
|
|
10
10
|
* the slices as for any save. 2.0.0 to 2.1.0 adds optional conditional method state, absent
|
|
11
|
-
* until explicitly used, so existing hosts retain their previous behavior; that step stamps the version.
|
|
11
|
+
* until explicitly used, so existing hosts retain their previous behavior; that step stamps the version.
|
|
12
|
+
* 2.1.0 to 2.2.0 preserves optional method records and stamps the version; successful alternatives now
|
|
13
|
+
* retain independent support. 2.2.0 to 2.3.0 stamps the version; received consequences and temporal goals
|
|
14
|
+
* remain absent unless explicitly supplied. 2.3.0 to 2.4.0 stamps the version; promptings remain absent
|
|
15
|
+
* unless enabled. 2.4.0 to 2.5.0 stamps the version; the bodily forecast reads only offers that declare
|
|
16
|
+
* `followedBy`. 2.5.0 to 2.6.0 stamps the version; the fatigue store stays absent unless enabled. 2.6.0 to
|
|
17
|
+
* 2.7.0 stamps the version; the evening review stays absent unless enabled. 2.7.0 to 2.8.0 stamps the
|
|
18
|
+
* version; fullness stays absent unless enabled, and alongside partners and reconsideration are opt-in.
|
|
19
|
+
* 2.8.0 to 2.9.0 stamps the version; prompting cues and practice half-lives stay absent unless supplied,
|
|
20
|
+
* review terms may carry refs, and an outcome naming several commitments now keeps each rather than only
|
|
21
|
+
* the earliest-ending one. A migrated save continues under the current engine's rules: it restores and runs,
|
|
12
22
|
* but it does not reproduce what the old engine would have done next where the rules changed (1.4.0 to 1.5.0
|
|
13
23
|
* changed how standing advice is heard; 1.8.0 to 1.9.0 changed the omission rule). Saves older than 1.4.0 and unknown versions are refused with an error.
|
|
14
24
|
*
|
|
@@ -58,6 +68,11 @@ export const MIGRATIONS = {
|
|
|
58
68
|
note: 'the surroundings field `ambient.now` is renamed `ambient.percept`; per-person retention is optional and starts absent; behaviour unchanged',
|
|
59
69
|
apply: renameAmbient,
|
|
60
70
|
},
|
|
71
|
+
'2.8.0': {
|
|
72
|
+
to: '2.9.0',
|
|
73
|
+
note: 'prompting responses may carry a cue and the slice a practice half-life (both optional, absent as before); review terms may carry a ref; an outcome naming two or more commitments in fulfills now keeps each of them, where 2.8.0 kept the earliest-ending one',
|
|
74
|
+
apply: stamp,
|
|
75
|
+
},
|
|
61
76
|
'2.7.0': {
|
|
62
77
|
to: '2.8.0',
|
|
63
78
|
note: 'fullness (body.fullness) is optional and starts absent; offers may name alongside partners and decisions may reconsider; existing hosts retain exact behavior',
|