@dsh-agentic-roleplay/state 0.2.1 → 0.3.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/lib/index.d.ts CHANGED
@@ -1088,6 +1088,8 @@ interface TriggerAnnouncement {
1088
1088
  /** When it is to happen, a local time, as told with the announcement; the time the condition waits for when it is a plain one, if left out. */
1089
1089
  at?: string;
1090
1090
  }
1091
+ /** In a cue, the key of the character it is said to: in a `while` condition and in the words of the cue. */
1092
+ declare const SELF = "@self";
1091
1093
  /** What happens when a trigger fires. */
1092
1094
  type TriggerEffect =
1093
1095
  /** A checked change of the story's records, in the format of an edit (events, variable changes, exit and item changes, moves, goals, engagements). */
@@ -1095,16 +1097,22 @@ type TriggerEffect =
1095
1097
  type: 'edit';
1096
1098
  edit: Record<string, unknown>;
1097
1099
  } |
1098
- /** Something the game master is told to weave into the story, until it says it did or a few turns pass. */
1100
+ /**
1101
+ * Something the game master is told to weave into the story, until it says it did or a few turns pass. It is written when it is told, not when
1102
+ * the trigger fired: `text` may name things the story has by `{kind:key}` and so is said as the story stands then (see `TEMPLATE_KINDS`), and
1103
+ * `while` is a condition that must still hold then, or the beat is withdrawn instead.
1104
+ */
1099
1105
  {
1100
1106
  type: 'beat';
1101
1107
  text: string;
1108
+ while?: TriggerCondition;
1102
1109
  } |
1103
- /** Something the audience notices, said to each of them the next time they act. */
1110
+ /** Something the audience notices, said to each of them the next time they act; written, and withdrawn, as a beat is, for each of them (`SELF` is the one it is said to). */
1104
1111
  {
1105
1112
  type: 'cue';
1106
1113
  audience: TriggerAudience;
1107
1114
  text: string;
1115
+ while?: TriggerCondition;
1108
1116
  };
1109
1117
  declare const TRIGGER_STATUSES: readonly ["dormant", "fired", "failed", "expired"];
1110
1118
  type TriggerStatus = (typeof TRIGGER_STATUSES)[number];
@@ -2389,12 +2397,12 @@ declare function parseTriggerDefinition(value: unknown, path: string, checkEdit:
2389
2397
  } | {
2390
2398
  problems: string[];
2391
2399
  };
2392
- type Reading = Pick<RecordsTarget, 'characters' | 'locations' | 'items' | 'variables' | 'triggers'>;
2400
+ type Reading$1 = Pick<RecordsTarget, 'characters' | 'locations' | 'items' | 'variables' | 'triggers'>;
2393
2401
  /**
2394
2402
  * What in a trigger names something the story does not have: a character, place, item or variable in a condition, the characters of a cue,
2395
2403
  * a trigger it waits for. (What an edit effect touches is checked when it is applied.)
2396
2404
  */
2397
- declare function triggerReferenceProblems(target: Reading, definition: TriggerDefinition, otherKeys?: Iterable<string>): string[];
2405
+ declare function triggerReferenceProblems(target: Reading$1, definition: TriggerDefinition, otherKeys?: Iterable<string>): string[];
2398
2406
  interface TriggerClock {
2399
2407
  now: number;
2400
2408
  zone: string;
@@ -2461,6 +2469,30 @@ declare function lapseNotes(target: RecordsTarget, turn: number, kept: {
2461
2469
  cues: number;
2462
2470
  }): TriggerNote[];
2463
2471
  //#endregion
2472
+ //#region src/records/deferred.d.ts
2473
+ type Reading = RecordsTarget;
2474
+ /** The words cannot be written as the story stands: something they name is not there. */
2475
+ declare class UnwritableError extends Error {}
2476
+ /** Words as the story stands now. @throws {UnwritableError} when something they name is not there. */
2477
+ declare function renderWords(target: Reading, text: string, clock: TriggerClock, self?: string): string;
2478
+ interface Delivery {
2479
+ /** What is to be told now, in words as the story stands. */
2480
+ shown: {
2481
+ note: TriggerNote;
2482
+ text: string;
2483
+ }[];
2484
+ /** What is not to be told, and why: the beat or cue no longer applies, or cannot be written. */
2485
+ withdrawn: {
2486
+ note: TriggerNote;
2487
+ reason: string;
2488
+ }[];
2489
+ }
2490
+ /**
2491
+ * Decides, at the moment notes are about to be told, what is still to be told and in what words. A note whose effect says something must
2492
+ * still hold and does not hold any more is withdrawn; so is one whose words name something that is not there. Nothing is changed.
2493
+ */
2494
+ declare function deliverNotes(target: Reading, notes: readonly TriggerNote[], clock: TriggerClock): Delivery;
2495
+ //#endregion
2464
2496
  //#region src/records/movement.d.ts
2465
2497
  interface MoveContext {
2466
2498
  locations: Pick<LocationRepository, 'get' | 'allExits'>;
@@ -3008,6 +3040,8 @@ interface SessionStore {
3008
3040
  beats: number;
3009
3041
  cues: number;
3010
3042
  }): TriggerNote[];
3043
+ /** Which of these notes are still to be told, and in what words as the story stands now; the others are withdrawn, with the reason. Nothing is changed. */
3044
+ deliverNotes(notes: readonly TriggerNote[], clock: TriggerClock): Delivery;
3011
3045
  /** Write a consistent copy of the whole database to `path`, which must not exist. */
3012
3046
  snapshotTo(path: string): void;
3013
3047
  close(): void;
@@ -3353,6 +3387,60 @@ declare function addLocalDays(instant: number, zone: string, days: number): {
3353
3387
  weekday: number;
3354
3388
  };
3355
3389
  //#endregion
3390
+ //#region src/records/template.d.ts
3391
+ /**
3392
+ * What the words of a cue or a beat may name by `{kind:key}`, filled in from the story when they are told. The key is how the world's files
3393
+ * name the thing (`@self` in a cue is the character it is said to), and a name follows the story: a renamed character is renamed in the words.
3394
+ */
3395
+ declare const TEMPLATE_KINDS: {
3396
+ /** The name of a character. */
3397
+ readonly character: {
3398
+ readonly args: 1;
3399
+ readonly about: "a character";
3400
+ };
3401
+ /** The name of a place. */
3402
+ readonly place: {
3403
+ readonly args: 1;
3404
+ readonly about: "a place";
3405
+ };
3406
+ /** The name of an item. */
3407
+ readonly item: {
3408
+ readonly args: 1;
3409
+ readonly about: "an item";
3410
+ };
3411
+ /** The name of the place a character is in now. */
3412
+ readonly where: {
3413
+ readonly args: 1;
3414
+ readonly about: "a character";
3415
+ };
3416
+ /** Who holds an item now, or the place it lies in. */
3417
+ readonly holder: {
3418
+ readonly args: 1;
3419
+ readonly about: "an item";
3420
+ };
3421
+ /** What a variable is now, in words: `{value:key}` for a world variable, `{value:key:subject}` for the character, item or place it is about. */
3422
+ readonly value: {
3423
+ readonly args: 2;
3424
+ readonly about: "a variable";
3425
+ };
3426
+ /** The time of day in the story, as `19:30`. */
3427
+ readonly time: {
3428
+ readonly args: 0;
3429
+ readonly about: "";
3430
+ };
3431
+ };
3432
+ type TemplateKind = keyof typeof TEMPLATE_KINDS;
3433
+ interface Placeholder {
3434
+ raw: string;
3435
+ kind: TemplateKind;
3436
+ args: string[];
3437
+ }
3438
+ /** The placeholders in some words, and what is wrong with any that is not one. Anything that does not look like `{word}` or `{word:key}` is plain text. */
3439
+ declare function placeholdersOf(text: string): {
3440
+ found: Placeholder[];
3441
+ problems: string[];
3442
+ };
3443
+ //#endregion
3356
3444
  //#region src/records/lint.d.ts
3357
3445
  type LintSeverity = 'error' | 'warning' | 'info';
3358
3446
  interface LintFinding {
@@ -3373,5 +3461,5 @@ type LintTarget = Pick<RecordsTarget, 'characters' | 'locations' | 'placements'
3373
3461
  */
3374
3462
  declare function lintWorld(target: LintTarget): LintFinding[];
3375
3463
  //#endregion
3376
- export { ACCURACIES, Accuracy, type Agenda, type AgendaEngagement, type AgendaOptions, type AgentLink, type AgentResolver, type Announcement, type BeliefEdit, CHARACTER_CONTROLS, CHARACTER_KINDS, CHARACTER_ROLES, CHARACTER_TIERS, CLOCK_MODES, COMPARISONS, CONSOLIDATION_KINDS, CONTAINER_STATES, Character, CharacterControl, CharacterDefinition, CharacterFilter, CharacterId, CharacterIntent, CharacterKind, CharacterMemory, CharacterMemoryPatch, type CharacterMove, CharacterPatch, type CharacterRepository, CharacterRole, CharacterSpeech, CharacterStart, CharacterState, CharacterStatePatch, type CharacterStateRepository, CharacterTier, type Clarity, type Clock, ClockMode, ClockState, Comparison, Config, ConflictError, ConsolidationItem, ConsolidationItemId, ConsolidationKind, type ConsolidationRepository, ContainerSpec, ContainerState, CorruptDataError, DAY, DAY_PARTS, DEFAULT_MEMORY_POLICY, DEFAULT_SLOTS, type DayPart, EMOTION_VARIABLES, ENGAGEMENT_GRACE, ENGAGEMENT_STATUSES, EXIT_STATES, type EditChecker, type EditResult, EmbeddingIndexInfo, EmotionStart, EmotionVector, Engagement, EngagementFilter, EngagementId, EngagementPatch, EngagementStatus, EntityKnowledge, type EventEdit, EventId, type EventRepository, Exit, type ExitChange, ExitDefinition, ExitId, ExitOpener, ExitPatch, ExitState, Faction, FactionDefinition, FactionId, FactionIntent, type FactionIntentRepository, FactionMembership, FactionMembershipDefinition, type FactionMembershipRepository, FactionPatch, FactionRelationship, FactionRelationshipDefinition, type FactionRelationshipRepository, type FactionRepository, FactionState, FactionStatePatch, type FactionStateRepository, type FiredTrigger, HOUR, Holder, Holding, IMPORTANCE_MAX, IMPORTANCE_MIN, INTENT_HORIZONS, INTENT_STATUSES, INTENT_TYPES, ITEM_ACTIONS, Intent, IntentFilter, IntentHorizon, IntentId, IntentPatch, type IntentRepository, IntentStatus, IntentType, InvalidEditError, InvalidMoveError, InvalidValueError, Item, type ItemAction, type ItemChange, type ItemChangeSpec, type ItemContext, ItemDefinition, type ItemEditSpec, type ItemEffect, ItemId, ItemPatch, type ItemPlan, type ItemRepository, JsonValue, KNOWLEDGE_KINDS, KnowledgeDefinition, KnowledgeKind, type KnowledgeRepository, type KnownMoveContext, LORE_KINDS, LORE_SUBJECT_KINDS, type LintFinding, type LintSeverity, type LintTarget, type LocalTime, Location, LocationDefinition, LocationFeature, LocationId, LocationPatch, type LocationRepository, Lore, LoreDefinition, LoreId, LoreKind, LorePatch, LoreSubject, LoreSubjectDefinition, LoreSubjectKind, MAX_LOCATION_FEATURES, MAX_ROUTINE_WINDOWS, MAX_SHOWN, MAX_TRIGGERS, MAX_VARIABLES, MEMBERSHIP_STATUSES, MEMORY_KINDS, MIGRATION_BACKUP_FOLDER, MINUTE, MembershipPatch, MembershipStatus, MemoryId, MemoryKind, type MemoryPolicy, type MemoryRepository, type MetadataRepository, Move, type MoveContext, MovePlan, type NewBelief, NewCharacter, NewCharacterMemory, type NewCharacterSpec, NewCharacterState, NewEngagement, type NewEvent, NewExit, type NewExitBetween, type NewExit$1 as NewExitEdit, NewFaction, NewFactionState, NewItem, type NewItemSpec, NewLocation, NewLore, NewPerception, type NewPlace, NewPlacement, NewRelationship, NewSession, NewStoryEvent, NewSummary, NewTriggerNote, NotFoundError, type Occurrence, type OpenOptions, PERCEPTION_MODES, PLACEABLE_KINDS, PLOT_NUDGE_MODES, PLOT_STATUSES, PendingCommit, type PendingCommitRepository, PendingEmbedding, type PerceivedBy, PerceivedEvent, Perception, type PerceptionAddition, type PerceptionEdit, PerceptionId, PerceptionMode, PerceptionPatch, type PlaceEdit, PlaceableKind, Placement, type PlacementRepository, PlotDefinition, PlotDevelopment, PlotNudgeMode, PlotProgress, PlotStatus, RECALL_ITEM_KINDS, type RankedGoal, type RecallCandidate, type RecallEvidence, RecallHit, type RecallIndexRepository, RecallItemKind, type RecallPool, type RecallQuery, type RecallSearch, type RecallSource, type RecallWhy, type Recalled, type RecordsEdit, type RecordsScope, type RecordsTarget, type RecordsView, Relationship, RelationshipDefinition, RelationshipId, RelationshipPatch, type RelationshipRepository, type RelationshipRetraction, type RelationshipSet, RoleplayState, RoutineDefinition, RoutineWindow, type RunResult, LATEST_VERSION as SCHEMA_VERSION, SECOND, SESSION_DATABASE_FILE, SLOT_ID, SUMMARY_LEVELS, SchemaError, type SemanticRanker, type Session, type SessionInit, type SessionListing, SessionMetadata, type SessionStore, type ShownVariable, Slot, type SlotRepository, SocialSubjectKind, type SqlDatabase, type SqlDriver, type SqlValue, StateError, type StatePatch, type StoreOptions, StoredRoutineWindow, StoredVariable, StoryEvent, StoryEventFilter, StoryEventPatch, StoryThread, Summary, SummaryId, SummaryLevel, type SummaryRepository, THREAD_STATUSES, TIME_CHANGE_KINDS, TRIGGER_NOTE_KINDS, TRIGGER_STATUSES, ThreadId, type ThreadRepository, ThreadStatus, TimeChange, TimeChangeFilter, TimeChangeKind, Trigger, TriggerAnnouncement, TriggerAudience, type TriggerClock, TriggerCondition, TriggerDefinition, TriggerEffect, TriggerId, TriggerNote, TriggerNoteKind, type TriggerRun, type TriggerRunOptions, TriggerStatus, VARIABLE_KEY, VARIABLE_KINDS, VARIABLE_SUBJECTS, VARIABLE_VISIBILITIES, VISUAL_SUBJECT_KINDS, type VariableAudience, VariableBand, type VariableChangeSpec, type VariableContext, VariableDefinition, VariableDefinitionInput, type VariableEffect, VariableKind, type VariablePlan, VariableSubject, VariableValue, VariableVisibility, type VectorSearch, type VectorSupport, VisualIdentity, VisualIdentityInput, VisualIdentityPatch, type VisualIdentityRepository, VisualSubjectKind, WEEKDAY_NAMES, WorldReference, addLocalDays, agendaAt, announcements, apply, applyItemPlan, applyRecordsEdit, audienceIds, catchUpPlan, changeItem, changeVariable, characterKey, clarityAt, clockTime, conditionHolds, createCharacterTools, createSession, createSessionStore, createTools, dayPart, deleteSession, denseScore, describeDuration, describeHolder, describeInstant, describeValue, finishRecall, fuseScores, inAudience, inWindow, isSessionId, isTimeZone, itemKey, jitter, judgedStatements, lapseNotes, lintWorld, listSessions, localIso, localTime, locationKey, mentioned, migrationBackupPath, moveCharacter, name, nextOccurrence, nextTimeOfDay, nodeSqliteDriver, occurrenceAt, openSession, openSessionStore, overlap, parseInstant, parseRecordsEdit, parseTimeOfDay, parseTriggerDefinition, planItemChange, planKnownMove, planMove, planVariableChange, poolCandidates, rankGoals, readRecords, readTriggerDefinition, recall, recallCandidates, recallPool, recordsEditSchema, retention, runTriggers, seededRoll, sessionDatabase, sessionFolder, shownVariables, subjectOf, systemClock, systemTimeZone, tokens, triggerReferenceProblems, valueIssue, zonedInstant };
3464
+ export { ACCURACIES, Accuracy, type Agenda, type AgendaEngagement, type AgendaOptions, type AgentLink, type AgentResolver, type Announcement, type BeliefEdit, CHARACTER_CONTROLS, CHARACTER_KINDS, CHARACTER_ROLES, CHARACTER_TIERS, CLOCK_MODES, COMPARISONS, CONSOLIDATION_KINDS, CONTAINER_STATES, Character, CharacterControl, CharacterDefinition, CharacterFilter, CharacterId, CharacterIntent, CharacterKind, CharacterMemory, CharacterMemoryPatch, type CharacterMove, CharacterPatch, type CharacterRepository, CharacterRole, CharacterSpeech, CharacterStart, CharacterState, CharacterStatePatch, type CharacterStateRepository, CharacterTier, type Clarity, type Clock, ClockMode, ClockState, Comparison, Config, ConflictError, ConsolidationItem, ConsolidationItemId, ConsolidationKind, type ConsolidationRepository, ContainerSpec, ContainerState, CorruptDataError, DAY, DAY_PARTS, DEFAULT_MEMORY_POLICY, DEFAULT_SLOTS, type DayPart, type Delivery, EMOTION_VARIABLES, ENGAGEMENT_GRACE, ENGAGEMENT_STATUSES, EXIT_STATES, type EditChecker, type EditResult, EmbeddingIndexInfo, EmotionStart, EmotionVector, Engagement, EngagementFilter, EngagementId, EngagementPatch, EngagementStatus, EntityKnowledge, type EventEdit, EventId, type EventRepository, Exit, type ExitChange, ExitDefinition, ExitId, ExitOpener, ExitPatch, ExitState, Faction, FactionDefinition, FactionId, FactionIntent, type FactionIntentRepository, FactionMembership, FactionMembershipDefinition, type FactionMembershipRepository, FactionPatch, FactionRelationship, FactionRelationshipDefinition, type FactionRelationshipRepository, type FactionRepository, FactionState, FactionStatePatch, type FactionStateRepository, type FiredTrigger, HOUR, Holder, Holding, IMPORTANCE_MAX, IMPORTANCE_MIN, INTENT_HORIZONS, INTENT_STATUSES, INTENT_TYPES, ITEM_ACTIONS, Intent, IntentFilter, IntentHorizon, IntentId, IntentPatch, type IntentRepository, IntentStatus, IntentType, InvalidEditError, InvalidMoveError, InvalidValueError, Item, type ItemAction, type ItemChange, type ItemChangeSpec, type ItemContext, ItemDefinition, type ItemEditSpec, type ItemEffect, ItemId, ItemPatch, type ItemPlan, type ItemRepository, JsonValue, KNOWLEDGE_KINDS, KnowledgeDefinition, KnowledgeKind, type KnowledgeRepository, type KnownMoveContext, LORE_KINDS, LORE_SUBJECT_KINDS, type LintFinding, type LintSeverity, type LintTarget, type LocalTime, Location, LocationDefinition, LocationFeature, LocationId, LocationPatch, type LocationRepository, Lore, LoreDefinition, LoreId, LoreKind, LorePatch, LoreSubject, LoreSubjectDefinition, LoreSubjectKind, MAX_LOCATION_FEATURES, MAX_ROUTINE_WINDOWS, MAX_SHOWN, MAX_TRIGGERS, MAX_VARIABLES, MEMBERSHIP_STATUSES, MEMORY_KINDS, MIGRATION_BACKUP_FOLDER, MINUTE, MembershipPatch, MembershipStatus, MemoryId, MemoryKind, type MemoryPolicy, type MemoryRepository, type MetadataRepository, Move, type MoveContext, MovePlan, type NewBelief, NewCharacter, NewCharacterMemory, type NewCharacterSpec, NewCharacterState, NewEngagement, type NewEvent, NewExit, type NewExitBetween, type NewExit$1 as NewExitEdit, NewFaction, NewFactionState, NewItem, type NewItemSpec, NewLocation, NewLore, NewPerception, type NewPlace, NewPlacement, NewRelationship, NewSession, NewStoryEvent, NewSummary, NewTriggerNote, NotFoundError, type Occurrence, type OpenOptions, PERCEPTION_MODES, PLACEABLE_KINDS, PLOT_NUDGE_MODES, PLOT_STATUSES, PendingCommit, type PendingCommitRepository, PendingEmbedding, type PerceivedBy, PerceivedEvent, Perception, type PerceptionAddition, type PerceptionEdit, PerceptionId, PerceptionMode, PerceptionPatch, type PlaceEdit, PlaceableKind, type Placeholder, Placement, type PlacementRepository, PlotDefinition, PlotDevelopment, PlotNudgeMode, PlotProgress, PlotStatus, RECALL_ITEM_KINDS, type RankedGoal, type RecallCandidate, type RecallEvidence, RecallHit, type RecallIndexRepository, RecallItemKind, type RecallPool, type RecallQuery, type RecallSearch, type RecallSource, type RecallWhy, type Recalled, type RecordsEdit, type RecordsScope, type RecordsTarget, type RecordsView, Relationship, RelationshipDefinition, RelationshipId, RelationshipPatch, type RelationshipRepository, type RelationshipRetraction, type RelationshipSet, RoleplayState, RoutineDefinition, RoutineWindow, type RunResult, LATEST_VERSION as SCHEMA_VERSION, SECOND, SELF, SESSION_DATABASE_FILE, SLOT_ID, SUMMARY_LEVELS, SchemaError, type SemanticRanker, type Session, type SessionInit, type SessionListing, SessionMetadata, type SessionStore, type ShownVariable, Slot, type SlotRepository, SocialSubjectKind, type SqlDatabase, type SqlDriver, type SqlValue, StateError, type StatePatch, type StoreOptions, StoredRoutineWindow, StoredVariable, StoryEvent, StoryEventFilter, StoryEventPatch, StoryThread, Summary, SummaryId, SummaryLevel, type SummaryRepository, TEMPLATE_KINDS, THREAD_STATUSES, TIME_CHANGE_KINDS, TRIGGER_NOTE_KINDS, TRIGGER_STATUSES, type TemplateKind, ThreadId, type ThreadRepository, ThreadStatus, TimeChange, TimeChangeFilter, TimeChangeKind, Trigger, TriggerAnnouncement, TriggerAudience, type TriggerClock, TriggerCondition, TriggerDefinition, TriggerEffect, TriggerId, TriggerNote, TriggerNoteKind, type TriggerRun, type TriggerRunOptions, TriggerStatus, UnwritableError, VARIABLE_KEY, VARIABLE_KINDS, VARIABLE_SUBJECTS, VARIABLE_VISIBILITIES, VISUAL_SUBJECT_KINDS, type VariableAudience, VariableBand, type VariableChangeSpec, type VariableContext, VariableDefinition, VariableDefinitionInput, type VariableEffect, VariableKind, type VariablePlan, VariableSubject, VariableValue, VariableVisibility, type VectorSearch, type VectorSupport, VisualIdentity, VisualIdentityInput, VisualIdentityPatch, type VisualIdentityRepository, VisualSubjectKind, WEEKDAY_NAMES, WorldReference, addLocalDays, agendaAt, announcements, apply, applyItemPlan, applyRecordsEdit, audienceIds, catchUpPlan, changeItem, changeVariable, characterKey, clarityAt, clockTime, conditionHolds, createCharacterTools, createSession, createSessionStore, createTools, dayPart, deleteSession, deliverNotes, denseScore, describeDuration, describeHolder, describeInstant, describeValue, finishRecall, fuseScores, inAudience, inWindow, isSessionId, isTimeZone, itemKey, jitter, judgedStatements, lapseNotes, lintWorld, listSessions, localIso, localTime, locationKey, mentioned, migrationBackupPath, moveCharacter, name, nextOccurrence, nextTimeOfDay, nodeSqliteDriver, occurrenceAt, openSession, openSessionStore, overlap, parseInstant, parseRecordsEdit, parseTimeOfDay, parseTriggerDefinition, placeholdersOf, planItemChange, planKnownMove, planMove, planVariableChange, poolCandidates, rankGoals, readRecords, readTriggerDefinition, recall, recallCandidates, recallPool, recordsEditSchema, renderWords, retention, runTriggers, seededRoll, sessionDatabase, sessionFolder, shownVariables, subjectOf, systemClock, systemTimeZone, tokens, triggerReferenceProblems, valueIssue, zonedInstant };
3377
3465
  //# sourceMappingURL=index.d.ts.map
package/lib/index.js CHANGED
@@ -346,6 +346,8 @@ const COMPARISONS = [
346
346
  "gt",
347
347
  "ge"
348
348
  ];
349
+ /** In a cue, the key of the character it is said to: in a `while` condition and in the words of the cue. */
350
+ const SELF = "@self";
349
351
  const TRIGGER_STATUSES = [
350
352
  "dormant",
351
353
  "fired",
@@ -835,14 +837,14 @@ function parseInstant(text, zone) {
835
837
  /** `Tuesday 4 October 1912, 21:40`. */
836
838
  function describeInstant(instant, zone) {
837
839
  const local = localTime(instant, zone);
838
- return `${WEEKDAYS[local.weekday]} ${local.day} ${MONTHS[local.month - 1]} ${local.year}, ${pad(local.hour)}:${pad(local.minute)}`;
840
+ return `${WEEKDAYS[local.weekday]} ${local.day} ${MONTHS[local.month - 1]} ${local.year}, ${pad$1(local.hour)}:${pad$1(local.minute)}`;
839
841
  }
840
842
  /** `1912-10-04T21:40:00` as the wall clock of a zone reads, the form a file or a person can write back. */
841
843
  function localIso(instant, zone) {
842
844
  const local = localTime(instant, zone);
843
- return `${String(local.year).padStart(4, "0")}-${pad(local.month)}-${pad(local.day)}T${pad(local.hour)}:${pad(local.minute)}:${pad(local.second)}`;
845
+ return `${String(local.year).padStart(4, "0")}-${pad$1(local.month)}-${pad$1(local.day)}T${pad$1(local.hour)}:${pad$1(local.minute)}:${pad$1(local.second)}`;
844
846
  }
845
- const pad = (value) => String(value).padStart(2, "0");
847
+ const pad$1 = (value) => String(value).padStart(2, "0");
846
848
  const DAY_PARTS = [
847
849
  "night",
848
850
  "morning",
@@ -946,7 +948,7 @@ function catchUpPlan(cursor, now, limits = {}) {
946
948
  /** `21:40`: the clock of a zone at an instant. */
947
949
  function clockTime(instant, zone) {
948
950
  const local = localTime(instant, zone);
949
- return `${pad(local.hour)}:${pad(local.minute)}`;
951
+ return `${pad$1(local.hour)}:${pad$1(local.minute)}`;
950
952
  }
951
953
  /** The local calendar day `days` after the one the instant falls on, as year, month and day. */
952
954
  function addLocalDays(instant, zone, days) {
@@ -964,7 +966,7 @@ function addLocalDays(instant, zone, days) {
964
966
  };
965
967
  }
966
968
  /** `07:30` for a minute of the day. */
967
- const minuteText = (minute) => `${pad(Math.floor(minute / 60))}:${pad(minute % 60)}`;
969
+ const minuteText = (minute) => `${pad$1(Math.floor(minute / 60))}:${pad$1(minute % 60)}`;
968
970
  //#endregion
969
971
  //#region src/records/agenda-edit.ts
970
972
  const MAX_PLAN_STEPS = 8;
@@ -1664,6 +1666,78 @@ function moveCharacter(context, characterId, move) {
1664
1666
  return result.plan;
1665
1667
  }
1666
1668
  //#endregion
1669
+ //#region src/records/template.ts
1670
+ /**
1671
+ * What the words of a cue or a beat may name by `{kind:key}`, filled in from the story when they are told. The key is how the world's files
1672
+ * name the thing (`@self` in a cue is the character it is said to), and a name follows the story: a renamed character is renamed in the words.
1673
+ */
1674
+ const TEMPLATE_KINDS = {
1675
+ /** The name of a character. */
1676
+ character: {
1677
+ args: 1,
1678
+ about: "a character"
1679
+ },
1680
+ /** The name of a place. */
1681
+ place: {
1682
+ args: 1,
1683
+ about: "a place"
1684
+ },
1685
+ /** The name of an item. */
1686
+ item: {
1687
+ args: 1,
1688
+ about: "an item"
1689
+ },
1690
+ /** The name of the place a character is in now. */
1691
+ where: {
1692
+ args: 1,
1693
+ about: "a character"
1694
+ },
1695
+ /** Who holds an item now, or the place it lies in. */
1696
+ holder: {
1697
+ args: 1,
1698
+ about: "an item"
1699
+ },
1700
+ /** What a variable is now, in words: `{value:key}` for a world variable, `{value:key:subject}` for the character, item or place it is about. */
1701
+ value: {
1702
+ args: 2,
1703
+ about: "a variable"
1704
+ },
1705
+ /** The time of day in the story, as `19:30`. */
1706
+ time: {
1707
+ args: 0,
1708
+ about: ""
1709
+ }
1710
+ };
1711
+ const PATTERN = /\{([a-z]+)(?::([^{}]*))?\}/g;
1712
+ /** The placeholders in some words, and what is wrong with any that is not one. Anything that does not look like `{word}` or `{word:key}` is plain text. */
1713
+ function placeholdersOf(text) {
1714
+ const found = [];
1715
+ const problems = [];
1716
+ for (const match of text.matchAll(PATTERN)) {
1717
+ const [raw, word, rest] = match;
1718
+ if (!(word in TEMPLATE_KINDS)) {
1719
+ problems.push(`${raw}: there is no "${word}"; the words may name ${Object.keys(TEMPLATE_KINDS).join(", ")}`);
1720
+ continue;
1721
+ }
1722
+ const kind = word;
1723
+ const args = rest === void 0 ? [] : rest.split(":").map((part) => part.trim());
1724
+ const { args: wanted } = TEMPLATE_KINDS[kind];
1725
+ if (!(kind === "value" ? args.length >= 1 && args.length <= 2 : args.length === wanted) || args.some((part) => part === "")) {
1726
+ problems.push(`${raw}: ${kind === "time" ? "{time} takes nothing" : kind === "value" ? "{value:variable} or {value:variable:subject}" : `{${kind}:key} takes the key of ${TEMPLATE_KINDS[kind].about}`}`);
1727
+ continue;
1728
+ }
1729
+ found.push({
1730
+ raw,
1731
+ kind,
1732
+ args
1733
+ });
1734
+ }
1735
+ return {
1736
+ found,
1737
+ problems
1738
+ };
1739
+ }
1740
+ //#endregion
1667
1741
  //#region src/sqlite/variable-repository.ts
1668
1742
  const MAX_BANDS = 8;
1669
1743
  const MAX_OPTIONS = 12;
@@ -2206,6 +2280,21 @@ function parseAnnouncement(value, path, problems) {
2206
2280
  ...at === void 0 ? {} : { at }
2207
2281
  };
2208
2282
  }
2283
+ /** Whether words or a condition name the character a cue is said to. */
2284
+ function usesSelf(words, condition) {
2285
+ return placeholdersOf(words).found.some((placeholder) => placeholder.args.includes("@self")) || condition !== void 0 && mentionsSelf(condition);
2286
+ }
2287
+ function mentionsSelf(condition) {
2288
+ switch (condition.type) {
2289
+ case "place": return condition.character === SELF;
2290
+ case "variable": return condition.subject === SELF;
2291
+ case "item": return condition.item === "@self" || condition.heldBy === "@self";
2292
+ case "all":
2293
+ case "any": return condition.conditions.some(mentionsSelf);
2294
+ case "not": return mentionsSelf(condition.condition);
2295
+ default: return false;
2296
+ }
2297
+ }
2209
2298
  function parseEffect(value, path, problems, checkEdit) {
2210
2299
  if (!isObject$2(value)) {
2211
2300
  problems.push(`${path}: an effect is an object`);
@@ -2225,6 +2314,10 @@ function parseEffect(value, path, problems, checkEdit) {
2225
2314
  problems.push(`${path}.edit: ${error instanceof InvalidEditError ? error.problems.join("; ") : String(error)}`);
2226
2315
  return;
2227
2316
  }
2317
+ if (value["while"] !== void 0) {
2318
+ problems.push(`${path}.while: only a beat or a cue can wait on a condition when it is told`);
2319
+ return;
2320
+ }
2228
2321
  return {
2229
2322
  type: "edit",
2230
2323
  edit: value["edit"]
@@ -2239,16 +2332,26 @@ function parseEffect(value, path, problems, checkEdit) {
2239
2332
  problems.push(`${path}.text: required text of at most ${MAX_TEXT$1} characters`);
2240
2333
  return;
2241
2334
  }
2242
- if (value["type"] === "beat") return {
2243
- type: "beat",
2244
- text: words
2245
- };
2335
+ const template = placeholdersOf(words);
2336
+ for (const problem of template.problems) problems.push(`${path}.text: ${problem}`);
2337
+ const waiting = value["while"] === void 0 ? void 0 : parseCondition(value["while"], `${path}.while`, problems, { nodes: 0 });
2338
+ if (value["while"] !== void 0 && waiting === void 0) return void 0;
2339
+ if (waiting !== void 0 && judgedStatements(waiting).length > 0) problems.push(`${path}.while: a statement a model judges (judged) cannot be waited on when something is told; use what the story records`);
2340
+ if (value["type"] === "beat") {
2341
+ if (usesSelf(words, waiting)) problems.push(`${path}: only a cue is said to someone, so only a cue can name ${SELF}`);
2342
+ return template.problems.length > 0 ? void 0 : {
2343
+ type: "beat",
2344
+ text: words,
2345
+ ...waiting === void 0 ? {} : { while: waiting }
2346
+ };
2347
+ }
2246
2348
  if (value["type"] === "cue") {
2247
2349
  const audience = value["audience"] !== void 0 ? parseAudience(value["audience"], `${path}.audience`, problems) : parseAudience({ characters: value["characters"] }, `${path}.characters`, problems);
2248
- return audience === void 0 ? void 0 : {
2350
+ return audience === void 0 || template.problems.length > 0 ? void 0 : {
2249
2351
  type: "cue",
2250
2352
  audience,
2251
- text: words
2353
+ text: words,
2354
+ ...waiting === void 0 ? {} : { while: waiting }
2252
2355
  };
2253
2356
  }
2254
2357
  problems.push(`${path}.type: one of edit, beat, cue`);
@@ -2300,8 +2403,8 @@ function parseTriggerDefinition(value, path, checkEdit) {
2300
2403
  ...announce === void 0 ? {} : { announce }
2301
2404
  } };
2302
2405
  }
2303
- function conditionProblems(target, condition, path, known) {
2304
- const character = (key) => target.characters.list().some((entry) => characterKey(entry) === key) ? [] : [`${path}: there is no character "${key}"`];
2406
+ function conditionProblems(target, condition, path, known, self = false) {
2407
+ const character = (key) => self && key === "@self" || target.characters.list().some((entry) => characterKey(entry) === key) ? [] : [`${path}: there is no character "${key}"`];
2305
2408
  const place = (key) => target.locations.list().some((entry) => locationKey(entry) === key) ? [] : [`${path}: there is no place "${key}"`];
2306
2409
  switch (condition.type) {
2307
2410
  case "time": return [];
@@ -2310,11 +2413,11 @@ function conditionProblems(target, condition, path, known) {
2310
2413
  const def = target.variables.def(condition.variable);
2311
2414
  if (def === void 0) return [`${path}: there is no variable "${condition.variable}"`];
2312
2415
  if (def.subject === "world" ? condition.subject !== void 0 : condition.subject === void 0) return [`${path}: ${def.subject === "world" ? "a world variable has no subject" : `give the ${def.subject} it is about as subject`}`];
2313
- const subject = condition.subject === void 0 ? void 0 : subjectOf(target, def.subject, condition.subject);
2314
- return [...condition.subject !== void 0 && subject === void 0 ? [`${path}: there is no ${def.subject} "${condition.subject}"`] : [], ...def.kind !== "number" && condition.op !== "eq" && condition.op !== "ne" ? [`${path}: ${def.kind} variables compare with eq or ne only`] : []];
2416
+ const subject = condition.subject === void 0 || self && condition.subject === "@self" ? void 0 : subjectOf(target, def.subject, condition.subject);
2417
+ return [...condition.subject !== void 0 && subject === void 0 && !(self && condition.subject === "@self") ? [`${path}: there is no ${def.subject} "${condition.subject}"`] : [], ...def.kind !== "number" && condition.op !== "eq" && condition.op !== "ne" ? [`${path}: ${def.kind} variables compare with eq or ne only`] : []];
2315
2418
  }
2316
2419
  case "item": return [
2317
- ...target.items.list().some((entry) => itemKey(entry) === condition.item) ? [] : [`${path}: there is no item "${condition.item}"`],
2420
+ ...self && condition.item === "@self" || target.items.list().some((entry) => itemKey(entry) === condition.item) ? [] : [`${path}: there is no item "${condition.item}"`],
2318
2421
  ...condition.heldBy === void 0 ? [] : character(condition.heldBy),
2319
2422
  ...condition.at === void 0 ? [] : place(condition.at)
2320
2423
  ];
@@ -2322,9 +2425,33 @@ function conditionProblems(target, condition, path, known) {
2322
2425
  case "fired": return known.has(condition.trigger) ? [] : [`${path}: there is no trigger "${condition.trigger}"`];
2323
2426
  case "judged": return [];
2324
2427
  case "all":
2325
- case "any": return condition.conditions.flatMap((part, index) => conditionProblems(target, part, `${path}.conditions[${index}]`, known));
2326
- case "not": return conditionProblems(target, condition.condition, `${path}.condition`, known);
2327
- }
2428
+ case "any": return condition.conditions.flatMap((part, index) => conditionProblems(target, part, `${path}.conditions[${index}]`, known, self));
2429
+ case "not": return conditionProblems(target, condition.condition, `${path}.condition`, known, self);
2430
+ }
2431
+ }
2432
+ /** What the words of a cue or beat name by `{kind:key}` that the story does not have. */
2433
+ function wordsProblems(target, words, path, self) {
2434
+ return placeholdersOf(words).found.flatMap((placeholder) => {
2435
+ const key = placeholder.args[0];
2436
+ const selfKey = self && key === "@self";
2437
+ const missing = (what) => [`${path}: ${placeholder.raw}: there is no ${what} "${key}"`];
2438
+ switch (placeholder.kind) {
2439
+ case "character":
2440
+ case "where": return selfKey || target.characters.list().some((entry) => characterKey(entry) === key) ? [] : missing("character");
2441
+ case "place": return target.locations.list().some((entry) => locationKey(entry) === key) ? [] : missing("place");
2442
+ case "item":
2443
+ case "holder": return target.items.list().some((entry) => itemKey(entry) === key) ? [] : missing("item");
2444
+ case "value": {
2445
+ const def = target.variables.def(key);
2446
+ if (def === void 0) return missing("variable");
2447
+ const subject = placeholder.args[1];
2448
+ if (def.subject === "world") return subject === void 0 ? [] : [`${path}: ${placeholder.raw}: a world variable has no subject`];
2449
+ if (subject === void 0) return [`${path}: ${placeholder.raw}: give the ${def.subject} it is about`];
2450
+ return self && subject === "@self" || subjectOf(target, def.subject, subject) !== void 0 ? [] : [`${path}: ${placeholder.raw}: there is no ${def.subject} "${subject}"`];
2451
+ }
2452
+ case "time": return [];
2453
+ }
2454
+ });
2328
2455
  }
2329
2456
  /**
2330
2457
  * What in a trigger names something the story does not have: a character, place, item or variable in a condition, the characters of a cue,
@@ -2338,10 +2465,12 @@ function triggerReferenceProblems(target, definition, otherKeys = []) {
2338
2465
  return who.characters.flatMap((key) => target.characters.list().some((entry) => characterKey(entry) === key) ? [] : [`${path}: there is no character "${key}"`]);
2339
2466
  };
2340
2467
  const cues = definition.effects.flatMap((effect, index) => effect.type !== "cue" ? [] : audience(effect.audience, `effects[${index}]`));
2468
+ const said = definition.effects.flatMap((effect, index) => effect.type === "edit" ? [] : [...effect.while === void 0 ? [] : conditionProblems(target, effect.while, `effects[${index}].while`, known, effect.type === "cue"), ...wordsProblems(target, effect.text, `effects[${index}].text`, effect.type === "cue")]);
2341
2469
  const announced = definition.announce === void 0 ? [] : audience(definition.announce.audience, "announce");
2342
2470
  return [
2343
2471
  ...conditionProblems(target, definition.condition, "when", known),
2344
2472
  ...cues,
2473
+ ...said,
2345
2474
  ...announced
2346
2475
  ].map((problem) => `${definition.key}: ${problem}`);
2347
2476
  }
@@ -3683,7 +3812,7 @@ function recordsEditSchema(options = {}) {
3683
3812
  },
3684
3813
  effects: {
3685
3814
  type: "array",
3686
- description: "What happens, one to six: {type:\"edit\", edit:{...}} a change of the records in the same format as edit_records (events with a location are seen by those there, variable_changes, exit_changes, item_changes, moves, intents_added, engagements); {type:\"beat\", text} something the game master is told to weave into the story; {type:\"cue\", characters:[keys] (or audience: \"everyone\" | {place:key}), text} something those characters notice; in the events of an edit, perceived_by may be \"everyone\".",
3815
+ description: "What happens, one to six: {type:\"edit\", edit:{...}} a change of the records in the same format as edit_records (events with a location are seen by those there, variable_changes, exit_changes, item_changes, moves, intents_added, engagements); {type:\"beat\", text, while?} something the game master is told to weave into the story; {type:\"cue\", characters:[keys] (or audience: \"everyone\" | {place:key}), text, while?} something those characters notice; a beat or cue is written when it is told, which may be turns after the trigger fired: its text may name things as {character:key}, {place:key}, {item:key}, {where:character} (the place a character is in), {holder:item} (who has it or where it lies), {value:variable} or {value:variable:subject}, {time}, and is told as the story stands then, and `while` is a condition (as above, nothing judged) that must still hold then or it is withdrawn; in a cue \"@self\" stands for the character it is said to (for example while:{type:\"place\", character:\"@self\", location:\"cellar\"}); in the events of an edit, perceived_by may be \"everyone\".",
3687
3816
  items: {
3688
3817
  type: "object",
3689
3818
  properties: { type: {
@@ -5211,6 +5340,139 @@ function lapseNotes(target, turn, kept) {
5211
5340
  return lapsed;
5212
5341
  }
5213
5342
  //#endregion
5343
+ //#region src/records/deferred.ts
5344
+ /** The words cannot be written as the story stands: something they name is not there. */
5345
+ var UnwritableError = class extends Error {};
5346
+ const pad = (value) => String(value).padStart(2, "0");
5347
+ function resolve$1(target, placeholder, clock, self) {
5348
+ const key = (index) => placeholder.args[index] === "@self" ? self ?? "@self" : placeholder.args[index];
5349
+ const character = (wanted) => {
5350
+ const found = target.characters.list().find((entry) => characterKey(entry) === wanted);
5351
+ if (found === void 0) throw new UnwritableError(`${placeholder.raw}: there is no character "${wanted}"`);
5352
+ return found;
5353
+ };
5354
+ const place = (wanted) => {
5355
+ const found = target.locations.list().find((entry) => locationKey(entry) === wanted);
5356
+ if (found === void 0) throw new UnwritableError(`${placeholder.raw}: there is no place "${wanted}"`);
5357
+ return found;
5358
+ };
5359
+ const item = (wanted) => {
5360
+ const found = target.items.list().find((entry) => itemKey(entry) === wanted);
5361
+ if (found === void 0) throw new UnwritableError(`${placeholder.raw}: there is no item "${wanted}"`);
5362
+ return found;
5363
+ };
5364
+ switch (placeholder.kind) {
5365
+ case "character": return character(key(0)).name;
5366
+ case "place": return place(key(0)).name;
5367
+ case "item": return item(key(0)).name;
5368
+ case "where": {
5369
+ const who = character(key(0));
5370
+ const at = target.placements.get("character", who.id);
5371
+ const found = at === void 0 ? void 0 : target.locations.get(at.locationId);
5372
+ if (found === void 0) throw new UnwritableError(`${placeholder.raw}: ${who.name} is nowhere in particular`);
5373
+ return found.name;
5374
+ }
5375
+ case "holder": {
5376
+ const thing = item(key(0));
5377
+ const where = target.items.where(thing.id);
5378
+ const holder = where.characterId !== void 0 ? target.characters.get(where.characterId)?.name : where.locationId !== void 0 ? target.locations.get(where.locationId)?.name : void 0;
5379
+ if (holder === void 0) throw new UnwritableError(`${placeholder.raw}: ${thing.name} is nowhere that is known`);
5380
+ return holder;
5381
+ }
5382
+ case "value": {
5383
+ const def = target.variables.def(placeholder.args[0]);
5384
+ if (def === void 0) throw new UnwritableError(`${placeholder.raw}: there is no variable "${placeholder.args[0]}"`);
5385
+ const subject = def.subject === "world" ? { id: 0 } : placeholder.args[1] === void 0 ? void 0 : subjectOf(target, def.subject, key(1));
5386
+ if (subject === void 0) throw new UnwritableError(`${placeholder.raw}: ${def.subject === "world" ? "a world variable has no subject" : `give the ${def.subject} it is about`}`);
5387
+ return describeValue(def, target.variables.value(def.key, def.subject, subject.id));
5388
+ }
5389
+ case "time": {
5390
+ const local = localTime(clock.now, clock.zone);
5391
+ return `${pad(local.hour)}:${pad(local.minute)}`;
5392
+ }
5393
+ }
5394
+ }
5395
+ /** Words as the story stands now. @throws {UnwritableError} when something they name is not there. */
5396
+ function renderWords(target, text, clock, self) {
5397
+ const { found } = placeholdersOf(text);
5398
+ let at = 0;
5399
+ let out = "";
5400
+ for (const placeholder of found) {
5401
+ const start = text.indexOf(placeholder.raw, at);
5402
+ out += text.slice(at, start) + resolve$1(target, placeholder, clock, self);
5403
+ at = start + placeholder.raw.length;
5404
+ }
5405
+ return out + text.slice(at);
5406
+ }
5407
+ /** A condition with `@self` taken as a character. */
5408
+ function bindSelf(condition, self) {
5409
+ const bound = (value) => value === "@self" ? self : value;
5410
+ switch (condition.type) {
5411
+ case "place": return {
5412
+ ...condition,
5413
+ character: bound(condition.character)
5414
+ };
5415
+ case "variable": return condition.subject === void 0 ? condition : {
5416
+ ...condition,
5417
+ subject: bound(condition.subject)
5418
+ };
5419
+ case "item": return {
5420
+ ...condition,
5421
+ item: bound(condition.item),
5422
+ ...condition.heldBy === void 0 ? {} : { heldBy: bound(condition.heldBy) }
5423
+ };
5424
+ case "all":
5425
+ case "any": return {
5426
+ ...condition,
5427
+ conditions: condition.conditions.map((part) => bindSelf(part, self))
5428
+ };
5429
+ case "not": return {
5430
+ ...condition,
5431
+ condition: bindSelf(condition.condition, self)
5432
+ };
5433
+ default: return condition;
5434
+ }
5435
+ }
5436
+ /** The effect of a trigger that a note was made from: the beat or cue whose words it carries. */
5437
+ function noteEffect(trigger, note) {
5438
+ return trigger?.effects.find((effect) => effect.type === note.kind && effect.text === note.text);
5439
+ }
5440
+ /**
5441
+ * Decides, at the moment notes are about to be told, what is still to be told and in what words. A note whose effect says something must
5442
+ * still hold and does not hold any more is withdrawn; so is one whose words name something that is not there. Nothing is changed.
5443
+ */
5444
+ function deliverNotes(target, notes, clock) {
5445
+ const delivery = {
5446
+ shown: [],
5447
+ withdrawn: []
5448
+ };
5449
+ for (const note of notes) {
5450
+ const effect = noteEffect(target.triggers.get(note.triggerId), note);
5451
+ const self = note.kind === "cue" && note.characterIds[0] !== void 0 ? target.characters.list().find((entry) => entry.id === note.characterIds[0]) : void 0;
5452
+ const who = self === void 0 ? void 0 : characterKey(self);
5453
+ if (effect?.while !== void 0 && !conditionHolds(target, who === void 0 ? effect.while : bindSelf(effect.while, who), clock)) {
5454
+ delivery.withdrawn.push({
5455
+ note,
5456
+ reason: "what it was waiting on no longer holds"
5457
+ });
5458
+ continue;
5459
+ }
5460
+ try {
5461
+ delivery.shown.push({
5462
+ note,
5463
+ text: renderWords(target, note.text, clock, who)
5464
+ });
5465
+ } catch (error) {
5466
+ if (!(error instanceof UnwritableError)) throw error;
5467
+ delivery.withdrawn.push({
5468
+ note,
5469
+ reason: error.message
5470
+ });
5471
+ }
5472
+ }
5473
+ return delivery;
5474
+ }
5475
+ //#endregion
5214
5476
  //#region src/memory/recall.ts
5215
5477
  const DAY$1 = 864e5;
5216
5478
  const DEFAULT_MEMORY_POLICY = {
@@ -9239,6 +9501,9 @@ var SqliteSessionStore = class {
9239
9501
  runTriggers(options) {
9240
9502
  return runTriggers(this, options);
9241
9503
  }
9504
+ deliverNotes(notes, clock) {
9505
+ return deliverNotes(this, notes, clock);
9506
+ }
9242
9507
  lapseNotes(turn, kept) {
9243
9508
  return this.transaction(() => lapseNotes(this, turn, kept));
9244
9509
  }
@@ -11324,6 +11589,7 @@ var RoleplayState = class extends Service {
11324
11589
  edit: (edit, options) => store.edit(edit, options),
11325
11590
  runTriggers: (options) => store.runTriggers(options),
11326
11591
  lapseNotes: (turn, kept) => store.lapseNotes(turn, kept),
11592
+ deliverNotes: (notes, clock) => store.deliverNotes(notes, clock),
11327
11593
  records: (scope) => store.records(scope)
11328
11594
  };
11329
11595
  this.sessions.set(key, {
@@ -11560,6 +11826,6 @@ function createCharacterTools(link, characterId) {
11560
11826
  ];
11561
11827
  }
11562
11828
  //#endregion
11563
- export { ACCURACIES, CHARACTER_CONTROLS, CHARACTER_KINDS, CHARACTER_ROLES, CHARACTER_TIERS, CLOCK_MODES, COMPARISONS, CONSOLIDATION_KINDS, CONTAINER_STATES, Config, ConflictError, CorruptDataError, DAY, DAY_PARTS, DEFAULT_MEMORY_POLICY, DEFAULT_SLOTS, EMOTION_VARIABLES, ENGAGEMENT_GRACE, ENGAGEMENT_STATUSES, EXIT_STATES, HOUR, IMPORTANCE_MAX, IMPORTANCE_MIN, INTENT_HORIZONS, INTENT_STATUSES, INTENT_TYPES, ITEM_ACTIONS, InvalidEditError, InvalidMoveError, InvalidValueError, KNOWLEDGE_KINDS, LORE_KINDS, LORE_SUBJECT_KINDS, MAX_LOCATION_FEATURES, MAX_ROUTINE_WINDOWS, MAX_SHOWN, MAX_TRIGGERS, MAX_VARIABLES, MEMBERSHIP_STATUSES, MEMORY_KINDS, MIGRATION_BACKUP_FOLDER, MINUTE, NotFoundError, PERCEPTION_MODES, PLACEABLE_KINDS, PLOT_NUDGE_MODES, PLOT_STATUSES, RECALL_ITEM_KINDS, RoleplayState, LATEST_VERSION as SCHEMA_VERSION, SECOND, SESSION_DATABASE_FILE, SLOT_ID, SUMMARY_LEVELS, SchemaError, StateError, THREAD_STATUSES, TIME_CHANGE_KINDS, TRIGGER_NOTE_KINDS, TRIGGER_STATUSES, VARIABLE_KEY, VARIABLE_KINDS, VARIABLE_SUBJECTS, VARIABLE_VISIBILITIES, VISUAL_SUBJECT_KINDS, WEEKDAY_NAMES, addLocalDays, agendaAt, announcements, apply, applyItemPlan, applyRecordsEdit, audienceIds, catchUpPlan, changeItem, changeVariable, characterKey, clarityAt, clockTime, conditionHolds, createCharacterTools, createSession, createSessionStore, createTools, dayPart, deleteSession, denseScore, describeDuration, describeHolder, describeInstant, describeValue, finishRecall, fuseScores, inAudience, inWindow, isSessionId, isTimeZone, itemKey, jitter, judgedStatements, lapseNotes, lintWorld, listSessions, localIso, localTime, locationKey, mentioned, migrationBackupPath, moveCharacter, name, nextOccurrence, nextTimeOfDay, nodeSqliteDriver, occurrenceAt, openSession, openSessionStore, overlap, parseInstant, parseRecordsEdit, parseTimeOfDay, parseTriggerDefinition, planItemChange, planKnownMove, planMove, planVariableChange, poolCandidates, rankGoals, readRecords, readTriggerDefinition, recall, recallCandidates, recallPool, recordsEditSchema, retention, runTriggers, seededRoll, sessionDatabase, sessionFolder, shownVariables, subjectOf, systemClock, systemTimeZone, tokens, triggerReferenceProblems, valueIssue, zonedInstant };
11829
+ export { ACCURACIES, CHARACTER_CONTROLS, CHARACTER_KINDS, CHARACTER_ROLES, CHARACTER_TIERS, CLOCK_MODES, COMPARISONS, CONSOLIDATION_KINDS, CONTAINER_STATES, Config, ConflictError, CorruptDataError, DAY, DAY_PARTS, DEFAULT_MEMORY_POLICY, DEFAULT_SLOTS, EMOTION_VARIABLES, ENGAGEMENT_GRACE, ENGAGEMENT_STATUSES, EXIT_STATES, HOUR, IMPORTANCE_MAX, IMPORTANCE_MIN, INTENT_HORIZONS, INTENT_STATUSES, INTENT_TYPES, ITEM_ACTIONS, InvalidEditError, InvalidMoveError, InvalidValueError, KNOWLEDGE_KINDS, LORE_KINDS, LORE_SUBJECT_KINDS, MAX_LOCATION_FEATURES, MAX_ROUTINE_WINDOWS, MAX_SHOWN, MAX_TRIGGERS, MAX_VARIABLES, MEMBERSHIP_STATUSES, MEMORY_KINDS, MIGRATION_BACKUP_FOLDER, MINUTE, NotFoundError, PERCEPTION_MODES, PLACEABLE_KINDS, PLOT_NUDGE_MODES, PLOT_STATUSES, RECALL_ITEM_KINDS, RoleplayState, LATEST_VERSION as SCHEMA_VERSION, SECOND, SELF, SESSION_DATABASE_FILE, SLOT_ID, SUMMARY_LEVELS, SchemaError, StateError, TEMPLATE_KINDS, THREAD_STATUSES, TIME_CHANGE_KINDS, TRIGGER_NOTE_KINDS, TRIGGER_STATUSES, UnwritableError, VARIABLE_KEY, VARIABLE_KINDS, VARIABLE_SUBJECTS, VARIABLE_VISIBILITIES, VISUAL_SUBJECT_KINDS, WEEKDAY_NAMES, addLocalDays, agendaAt, announcements, apply, applyItemPlan, applyRecordsEdit, audienceIds, catchUpPlan, changeItem, changeVariable, characterKey, clarityAt, clockTime, conditionHolds, createCharacterTools, createSession, createSessionStore, createTools, dayPart, deleteSession, deliverNotes, denseScore, describeDuration, describeHolder, describeInstant, describeValue, finishRecall, fuseScores, inAudience, inWindow, isSessionId, isTimeZone, itemKey, jitter, judgedStatements, lapseNotes, lintWorld, listSessions, localIso, localTime, locationKey, mentioned, migrationBackupPath, moveCharacter, name, nextOccurrence, nextTimeOfDay, nodeSqliteDriver, occurrenceAt, openSession, openSessionStore, overlap, parseInstant, parseRecordsEdit, parseTimeOfDay, parseTriggerDefinition, placeholdersOf, planItemChange, planKnownMove, planMove, planVariableChange, poolCandidates, rankGoals, readRecords, readTriggerDefinition, recall, recallCandidates, recallPool, recordsEditSchema, renderWords, retention, runTriggers, seededRoll, sessionDatabase, sessionFolder, shownVariables, subjectOf, systemClock, systemTimeZone, tokens, triggerReferenceProblems, valueIssue, zonedInstant };
11564
11830
 
11565
11831
  //# sourceMappingURL=index.js.map