@adam0white/human-framework 2.17.0 → 2.18.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/README.md +13 -0
- package/dist/chapter-clock.d.ts +26 -0
- package/dist/chapter-clock.js +36 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -476,3 +476,16 @@ Narration remains unchanged unless requested. Set `person.lexicon.variety`,
|
|
|
476
476
|
`perceive` adds a third `{ reputationTraits }` argument. See the architecture's
|
|
477
477
|
[narration and social host options](../../docs/framework.md#narration-and-social-host-options-opt-in)
|
|
478
478
|
for cause-aware reviews and actor-addressed recall. These options change no default continuation.
|
|
479
|
+
|
|
480
|
+
### Bounded chapter clock (2.18.0, opt-in)
|
|
481
|
+
|
|
482
|
+
`createChapterClock(seed, nowMs)` and `advanceChapterClock(clock, nowMs)` are pure helpers for hosts that author coarse between-chapter life. They do not step a `Person`. The clock quantizes a supplied integer millisecond value into real-hour slots. A return processes at most the newest24 slots and reports the omitted count. Its watermark never moves backward. Repeating the same return produces no new slots. Each retained slot's draw depends only on its absolute slot and pinned seed.
|
|
483
|
+
|
|
484
|
+
```ts
|
|
485
|
+
const clock = createChapterClock(23, 0);
|
|
486
|
+
const returnInput = advanceChapterClock(clock, 48 * 3_600_000);
|
|
487
|
+
// returnInput.slots.length === 24; returnInput.skipped === 24
|
|
488
|
+
// Pin clock, returned draws and the admitted initial host state in the replay.
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
The host owns elapsed-time pacing, narrative interpretation, storage, consent and persona admission. A slot is an opportunity for coarse fiction. It is not proof of a lived day, settled duty, completed project or recovered body. Existing actor state and engine2.17.0 continuation remain unchanged unless the host explicitly uses the helper.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scope: pure, bounded host chapter scheduling from a supplied real-time clock. A slot is a coarse
|
|
3
|
+
* narrative opportunity, not a lived day. This helper touches no Person, resolves no obligations,
|
|
4
|
+
* and performs no body recovery. Hosts own fiction, persistence, admission and consent.
|
|
5
|
+
*/
|
|
6
|
+
export declare const CHAPTER_CLOCK: {
|
|
7
|
+
readonly version: 'hf-chapter-clock/1';
|
|
8
|
+
readonly quantumMs: 3600000;
|
|
9
|
+
readonly maxSlots: 24;
|
|
10
|
+
};
|
|
11
|
+
export interface ChapterClock {
|
|
12
|
+
version: 'hf-chapter-clock/1';
|
|
13
|
+
watermark: number;
|
|
14
|
+
seed: number;
|
|
15
|
+
}
|
|
16
|
+
export interface ChapterAdvance {
|
|
17
|
+
clock: ChapterClock;
|
|
18
|
+
slots: {
|
|
19
|
+
at: number;
|
|
20
|
+
draw: number;
|
|
21
|
+
}[];
|
|
22
|
+
skipped: number;
|
|
23
|
+
}
|
|
24
|
+
export declare function createChapterClock(seed: number, nowMs: number): ChapterClock;
|
|
25
|
+
/** Stateless seeded draw per absolute slot: splitting returns does not alter a retained slot's result. */
|
|
26
|
+
export declare function advanceChapterClock(clock: ChapterClock, nowMs: number): ChapterAdvance;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scope: pure, bounded host chapter scheduling from a supplied real-time clock. A slot is a coarse
|
|
3
|
+
* narrative opportunity, not a lived day. This helper touches no Person, resolves no obligations,
|
|
4
|
+
* and performs no body recovery. Hosts own fiction, persistence, admission and consent.
|
|
5
|
+
*/
|
|
6
|
+
export const CHAPTER_CLOCK = { version: 'hf-chapter-clock/1', quantumMs: 3_600_000, maxSlots: 24 };
|
|
7
|
+
function slot(nowMs) {
|
|
8
|
+
if (!Number.isSafeInteger(nowMs) || nowMs < 0)
|
|
9
|
+
throw new Error('Invalid chapter clock.');
|
|
10
|
+
return Math.floor(nowMs / CHAPTER_CLOCK.quantumMs);
|
|
11
|
+
}
|
|
12
|
+
export function createChapterClock(seed, nowMs) {
|
|
13
|
+
if (!Number.isInteger(seed) || seed < 0 || seed > 0xffffffff)
|
|
14
|
+
throw new Error('Invalid chapter seed.');
|
|
15
|
+
return { version: CHAPTER_CLOCK.version, watermark: slot(nowMs), seed };
|
|
16
|
+
}
|
|
17
|
+
/** Stateless seeded draw per absolute slot: splitting returns does not alter a retained slot's result. */
|
|
18
|
+
export function advanceChapterClock(clock, nowMs) {
|
|
19
|
+
if (clock.version !== CHAPTER_CLOCK.version ||
|
|
20
|
+
!Number.isSafeInteger(clock.watermark) ||
|
|
21
|
+
clock.watermark < 0 ||
|
|
22
|
+
!Number.isInteger(clock.seed) ||
|
|
23
|
+
clock.seed < 0 ||
|
|
24
|
+
clock.seed > 0xffffffff)
|
|
25
|
+
throw new Error('Unsupported chapter clock.');
|
|
26
|
+
const end = Math.max(clock.watermark, slot(nowMs));
|
|
27
|
+
const count = Math.min(CHAPTER_CLOCK.maxSlots, end - clock.watermark);
|
|
28
|
+
const slots = Array.from({ length: count }, (_, i) => {
|
|
29
|
+
const at = end - count + i + 1;
|
|
30
|
+
let h = (clock.seed ^ (at >>> 0) ^ Math.floor(at / 0x100000000)) >>> 0;
|
|
31
|
+
h = Math.imul(h ^ (h >>> 16), 0x21f0aaad) >>> 0;
|
|
32
|
+
h = Math.imul(h ^ (h >>> 15), 0x735a2d97) >>> 0;
|
|
33
|
+
return { at, draw: ((h ^ (h >>> 15)) >>> 0) / 0x100000000 };
|
|
34
|
+
});
|
|
35
|
+
return { clock: { ...clock, watermark: end }, slots, skipped: end - clock.watermark - count };
|
|
36
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/** Human Framework public surface. */
|
|
2
|
-
export declare const FRAMEWORK_VERSION = "2.
|
|
2
|
+
export declare const FRAMEWORK_VERSION = "2.18.0";
|
|
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, MakeUpReceipt, PrayerCalendar, PrayerSchedule, PrayerTimes, Retimer, } from './agenda/index.ts';
|
|
6
6
|
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, isContinuingCommitment, isUnderWay, MAKRUH_DEFAULTS, makruhWindows, missedExcuse, onFinished, owedMakeUps, PRAYER_IMPORTANCE, PURPOSE_DEFAULTS, prayerWindows, pressureReachedAt, promise, proposeGoals, RAMADAN_DEFAULTS, ramadanFast, ramadanMeals, release as releaseCommitment, retimeCommitments, retirePaidMakeUps, revisePurposes, scheduleMakeUp, spanMeetsWindow, suhoorWindow, timesFor, violatesAbstention, } from './agenda/index.ts';
|
|
7
7
|
export * from './beliefs/index.ts';
|
|
8
8
|
export * from './body/index.ts';
|
|
9
|
+
export * from './chapter-clock.ts';
|
|
9
10
|
export * from './character/index.ts';
|
|
10
11
|
export * from './chronicle/index.ts';
|
|
11
12
|
export type { ConsiderContext, DecideContext, Decision, SocialContext } from './cognition/index.ts';
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/** Human Framework public surface. */
|
|
2
|
-
export const FRAMEWORK_VERSION = '2.
|
|
2
|
+
export const FRAMEWORK_VERSION = '2.18.0';
|
|
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, isContinuingCommitment, isUnderWay, MAKRUH_DEFAULTS, makruhWindows, missedExcuse, onFinished, owedMakeUps, PRAYER_IMPORTANCE, PURPOSE_DEFAULTS, prayerWindows, pressureReachedAt, promise, proposeGoals, RAMADAN_DEFAULTS, ramadanFast, ramadanMeals, release as releaseCommitment, retimeCommitments, retirePaidMakeUps, revisePurposes, scheduleMakeUp, spanMeetsWindow, suhoorWindow, timesFor, violatesAbstention, } from './agenda/index.js';
|
|
6
6
|
export * from './beliefs/index.js';
|
|
7
7
|
export * from './body/index.js';
|
|
8
|
+
export * from './chapter-clock.js';
|
|
8
9
|
export * from './character/index.js';
|
|
9
10
|
export * from './chronicle/index.js';
|
|
10
11
|
// `cognition.decide` is the raw scorer; the composite's `decide` (person.ts) is the one hosts call.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adam0white/human-framework",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.18.0",
|
|
4
4
|
"description": "Deterministic, explainable simulated people: body, needs, affect, memory, beliefs, skills, habits, relationships, values and a will that can refuse a suggestion",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"simulation",
|