@dsh-agentic-roleplay/state 0.3.6 → 0.4.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/lib/index.d.ts +19 -2
- package/lib/index.js +56 -45
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -3457,7 +3457,7 @@ declare class RoleplayState extends Service {
|
|
|
3457
3457
|
private closeAll;
|
|
3458
3458
|
}
|
|
3459
3459
|
declare const name = "@dsh-agentic-roleplay/state";
|
|
3460
|
-
declare function apply(ctx: Context, config: Config):
|
|
3460
|
+
declare function apply(ctx: Context, config: Config): RoleplayState;
|
|
3461
3461
|
//#endregion
|
|
3462
3462
|
//#region src/tools/character.d.ts
|
|
3463
3463
|
declare function createCharacterTools(link: () => AgentLink, characterId: CharacterId): ToolDefinition[];
|
|
@@ -3545,6 +3545,23 @@ type DiceLink = Pick<AgentLink, 'turn'> & {
|
|
|
3545
3545
|
};
|
|
3546
3546
|
/** How a roll reads to the agent that asked for it: what fell, what it adds up to, and what the world's check makes of it. */
|
|
3547
3547
|
declare function describeRoll(roll: DiceRoll, check?: DiceCheck): string;
|
|
3548
|
+
interface CheckRolled {
|
|
3549
|
+
roll: number;
|
|
3550
|
+
check: string;
|
|
3551
|
+
total: number;
|
|
3552
|
+
result: 'succeeded' | 'partial' | 'failed';
|
|
3553
|
+
label: string;
|
|
3554
|
+
critical: boolean;
|
|
3555
|
+
text: string;
|
|
3556
|
+
}
|
|
3557
|
+
/** Rolls one of the story's checks for a character and records it: the one place that decides what a check roll is, for the tool and for whatever rolls on an agent's behalf. */
|
|
3558
|
+
declare function rollForCheck(link: DiceLink, args: {
|
|
3559
|
+
check: string;
|
|
3560
|
+
reason: string;
|
|
3561
|
+
character: string;
|
|
3562
|
+
target?: number;
|
|
3563
|
+
bonus?: number;
|
|
3564
|
+
}, roller?: Roller, by?: 'agent' | 'player'): CheckRolled;
|
|
3548
3565
|
/**
|
|
3549
3566
|
* Tools that roll dice for an agent, so that numbers are not made up. `roll_check` rolls a check the story defines and reads
|
|
3550
3567
|
* the result with the check's own bands; `roll_dice` rolls plain notation for what has no check. The roller is the system's
|
|
@@ -3862,5 +3879,5 @@ type LintTarget = Pick<RecordsTarget, 'characters' | 'locations' | 'placements'
|
|
|
3862
3879
|
*/
|
|
3863
3880
|
declare function lintWorld(target: LintTarget): LintFinding[];
|
|
3864
3881
|
//#endregion
|
|
3865
|
-
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, type Calendar, type CalendarDay, Character, CharacterControl, CharacterDefinition, CharacterFilter, CharacterId, CharacterIntent, CharacterKind, CharacterMemory, CharacterMemoryPatch, type CharacterMove, CharacterPatch, type CharacterRepository, CharacterRole, CharacterSpeech, CharacterStart, CharacterState, CharacterStatePatch, type CharacterStateRepository, CharacterTier, type CheckRoll, type Clarity, type Clock, ClockMode, ClockState, Comparison, Config, ConflictError, ConsolidationItem, ConsolidationItemId, ConsolidationKind, type ConsolidationRepository, ContainerSpec, ContainerState, CorruptDataError, DAY, DAY_PARTS, DEFAULT_CONFIDENCE, DEFAULT_MEMORY_POLICY, DEFAULT_SLOTS, DICE_COMPARISONS, DICE_READINGS, DICE_RESULTS, type DayPart, type Delivery, DiceBand, DiceCheck, DiceCheckDefinition, DiceCheckId, DiceComparison, type DiceLink, DiceReading, DiceReadout, DiceResult, DiceRoll, DiceRollId, EMOTION_VARIABLES, ENGAGEMENT_GRACE, ENGAGEMENT_STATUSES, EVIDENCE_RELATIONS, EXIT_STATES, type EditChecker, type EditResult, EmbeddingIndexInfo, EmotionStart, EmotionVector, Engagement, EngagementFilter, EngagementId, EngagementPatch, EngagementStatus, EntityKnowledge, type EventEdit, EventId, type EventRepository, EvidenceRelation, 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, type Hemisphere, Holder, Holding, type Holiday, 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, LANGUAGES, LIST_CHECKS_TOOL, LORE_KINDS, LORE_SCOPES, LORE_SUBJECT_KINDS, Language, type LintFinding, type LintSeverity, type LintTarget, type LocalTime, Location, LocationDefinition, LocationFeature, LocationId, LocationPatch, type LocationRepository, Lore, LoreDefinition, LoreId, LoreKind, LorePatch, LoreScope, LoreSubject, LoreSubjectDefinition, LoreSubjectKind, MAX_DICE_BANDS, MAX_DICE_CHECKS, MAX_DICE_PER_ROLL, MAX_DICE_SIDES, MAX_DICE_TERMS, MAX_LOCATION_FEATURES, MAX_ROUTINE_WINDOWS, MAX_SHOWN, MAX_TRIGGERS, MAX_VARIABLES, MEMBERSHIP_STATUSES, MEMORY_CONFIDENCES, MEMORY_KINDS, MIGRATION_BACKUP_FOLDER, MINUTE, MONTH_NAMES, MembershipPatch, MembershipStatus, MemoryConfidence, MemoryEvidence, MemoryId, MemoryKind, type MemoryPolicy, type MemoryRepository, MessageValues, type MetadataRepository, Move, type MoveContext, MovePlan, NO_CALENDAR, type NewBelief, NewCharacter, NewCharacterMemory, type NewCharacterSpec, NewCharacterState, NewDiceRoll, 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 Notation, 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, type PlainRoll, PlotDefinition, PlotDevelopment, PlotNudgeMode, PlotProgress, PlotStatus, RECALL_ITEM_KINDS, ROLL_CHECK_TOOL, ROLL_DICE_TOOL, 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, type Roller, RoutineDefinition, RoutineWindow, type RunResult, LATEST_VERSION as SCHEMA_VERSION, SEASONS, SECOND, SELF, SESSION_DATABASE_FILE, SLOT_ID, SUMMARY_LEVELS, SchemaError, type Season, 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, Translate, 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, checkProblems, clarityAt, clockTime, conditionHolds, createCharacterTools, createDiceTools, createSession, createSessionStore, createTools, dayMatches, dayPart, dayTokenProblems, deleteSession, deliverNotes, denseScore, describeDuration, describeHolder, describeInstant, describeRoll, describeValue, finishRecall, fuseScores, holidaysOn, inAudience, inWindow, isSessionId, isTimeZone, itemKey, jitter, judgedStatements, languageOf, lapseNotes, lintWorld, listSessions, localIso, localTime, locationKey, mentioned, migrationBackupPath, moveCharacter, name, nextOccurrence, nextTimeOfDay, nodeSqliteDriver, notationRange, occurrenceAt, openSession, openSessionStore, overlap, parseDayToken, parseInstant, parseNotation, parseRecordsEdit, parseTimeOfDay, parseTriggerDefinition, placeholdersOf, planItemChange, planKnownMove, planMove, planVariableChange, poolCandidates, rankGoals, readBands, readCalendar, readRecords, readTriggerDefinition, recall, recallCandidates, recallPool, recordsEditSchema, renderWords, retention, rollCheck, rollNotation, rollPlain, runTriggers, seasonOf, seededRoll, sessionDatabase, sessionFolder, shownVariables, subjectOf, systemClock, systemRoller, systemTimeZone, tokens, translated, translation, translator, triggerReferenceProblems, valueIssue, writeCalendar, zonedInstant };
|
|
3882
|
+
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, type Calendar, type CalendarDay, Character, CharacterControl, CharacterDefinition, CharacterFilter, CharacterId, CharacterIntent, CharacterKind, CharacterMemory, CharacterMemoryPatch, type CharacterMove, CharacterPatch, type CharacterRepository, CharacterRole, CharacterSpeech, CharacterStart, CharacterState, CharacterStatePatch, type CharacterStateRepository, CharacterTier, type CheckRoll, type CheckRolled, type Clarity, type Clock, ClockMode, ClockState, Comparison, Config, ConflictError, ConsolidationItem, ConsolidationItemId, ConsolidationKind, type ConsolidationRepository, ContainerSpec, ContainerState, CorruptDataError, DAY, DAY_PARTS, DEFAULT_CONFIDENCE, DEFAULT_MEMORY_POLICY, DEFAULT_SLOTS, DICE_COMPARISONS, DICE_READINGS, DICE_RESULTS, type DayPart, type Delivery, DiceBand, DiceCheck, DiceCheckDefinition, DiceCheckId, DiceComparison, type DiceLink, DiceReading, DiceReadout, DiceResult, DiceRoll, DiceRollId, EMOTION_VARIABLES, ENGAGEMENT_GRACE, ENGAGEMENT_STATUSES, EVIDENCE_RELATIONS, EXIT_STATES, type EditChecker, type EditResult, EmbeddingIndexInfo, EmotionStart, EmotionVector, Engagement, EngagementFilter, EngagementId, EngagementPatch, EngagementStatus, EntityKnowledge, type EventEdit, EventId, type EventRepository, EvidenceRelation, 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, type Hemisphere, Holder, Holding, type Holiday, 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, LANGUAGES, LIST_CHECKS_TOOL, LORE_KINDS, LORE_SCOPES, LORE_SUBJECT_KINDS, Language, type LintFinding, type LintSeverity, type LintTarget, type LocalTime, Location, LocationDefinition, LocationFeature, LocationId, LocationPatch, type LocationRepository, Lore, LoreDefinition, LoreId, LoreKind, LorePatch, LoreScope, LoreSubject, LoreSubjectDefinition, LoreSubjectKind, MAX_DICE_BANDS, MAX_DICE_CHECKS, MAX_DICE_PER_ROLL, MAX_DICE_SIDES, MAX_DICE_TERMS, MAX_LOCATION_FEATURES, MAX_ROUTINE_WINDOWS, MAX_SHOWN, MAX_TRIGGERS, MAX_VARIABLES, MEMBERSHIP_STATUSES, MEMORY_CONFIDENCES, MEMORY_KINDS, MIGRATION_BACKUP_FOLDER, MINUTE, MONTH_NAMES, MembershipPatch, MembershipStatus, MemoryConfidence, MemoryEvidence, MemoryId, MemoryKind, type MemoryPolicy, type MemoryRepository, MessageValues, type MetadataRepository, Move, type MoveContext, MovePlan, NO_CALENDAR, type NewBelief, NewCharacter, NewCharacterMemory, type NewCharacterSpec, NewCharacterState, NewDiceRoll, 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 Notation, 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, type PlainRoll, PlotDefinition, PlotDevelopment, PlotNudgeMode, PlotProgress, PlotStatus, RECALL_ITEM_KINDS, ROLL_CHECK_TOOL, ROLL_DICE_TOOL, 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, type Roller, RoutineDefinition, RoutineWindow, type RunResult, LATEST_VERSION as SCHEMA_VERSION, SEASONS, SECOND, SELF, SESSION_DATABASE_FILE, SLOT_ID, SUMMARY_LEVELS, SchemaError, type Season, 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, Translate, 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, checkProblems, clarityAt, clockTime, conditionHolds, createCharacterTools, createDiceTools, createSession, createSessionStore, createTools, dayMatches, dayPart, dayTokenProblems, deleteSession, deliverNotes, denseScore, describeDuration, describeHolder, describeInstant, describeRoll, describeValue, finishRecall, fuseScores, holidaysOn, inAudience, inWindow, isSessionId, isTimeZone, itemKey, jitter, judgedStatements, languageOf, lapseNotes, lintWorld, listSessions, localIso, localTime, locationKey, mentioned, migrationBackupPath, moveCharacter, name, nextOccurrence, nextTimeOfDay, nodeSqliteDriver, notationRange, occurrenceAt, openSession, openSessionStore, overlap, parseDayToken, parseInstant, parseNotation, parseRecordsEdit, parseTimeOfDay, parseTriggerDefinition, placeholdersOf, planItemChange, planKnownMove, planMove, planVariableChange, poolCandidates, rankGoals, readBands, readCalendar, readRecords, readTriggerDefinition, recall, recallCandidates, recallPool, recordsEditSchema, renderWords, retention, rollCheck, rollForCheck, rollNotation, rollPlain, runTriggers, seasonOf, seededRoll, sessionDatabase, sessionFolder, shownVariables, subjectOf, systemClock, systemRoller, systemTimeZone, tokens, translated, translation, translator, triggerReferenceProblems, valueIssue, writeCalendar, zonedInstant };
|
|
3866
3883
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.js
CHANGED
|
@@ -467,6 +467,13 @@ const ZH = {
|
|
|
467
467
|
"Background": "背景",
|
|
468
468
|
"Appearance": "外貌",
|
|
469
469
|
"How you speak": "说话方式",
|
|
470
|
+
"Talk to {name}.": "和{name}聊聊。",
|
|
471
|
+
"Go to {place}.": "前往{place}。",
|
|
472
|
+
"Take a closer look at {thing}.": "仔细看看{thing}。",
|
|
473
|
+
"Look around carefully.": "仔细观察四周。",
|
|
474
|
+
"Wait and see what happens.": "先等等,看看会发生什么。",
|
|
475
|
+
"Ask what is going on.": "问问这是怎么回事。",
|
|
476
|
+
"Think about what to do next.": "想想接下来该怎么办。",
|
|
470
477
|
"You are {name}.": "你是{name}。",
|
|
471
478
|
"You are also called {names}.": "你也被称作{names}。",
|
|
472
479
|
"age: {value}": "年龄:{value}",
|
|
@@ -506,6 +513,7 @@ const ZH = {
|
|
|
506
513
|
"Places: ": "地点:",
|
|
507
514
|
"Routes: ": "路径:",
|
|
508
515
|
"Things: ": "物品:",
|
|
516
|
+
"Background you know, to read with recall_my_lore when it bears on the moment: ": "你所知的背景(与当下相关时用 recall_my_lore 查阅):",
|
|
509
517
|
"Your day and what you are after (plans, not orders: keep them, put them off or drop them as the moment and your character suggest):": "你的日程与你想达成的事(只是计划,不是命令:依当下情形和你的性格,可以照做、推迟或放弃):",
|
|
510
518
|
"Your day, now: {activity}{place}, until {until}{note}.": "你此刻的日程:{activity}{place},持续到{until}{note}。",
|
|
511
519
|
"Your day, next: {activity}{place}, from {from}.": "你接下来的日程:{activity}{place},{from}开始。",
|
|
@@ -867,7 +875,7 @@ var SqliteRoutineRepository = class {
|
|
|
867
875
|
this.db.run("INSERT INTO routine_windows (character_id, ordinal, days, filters, start_minute, end_minute, activity, location_id, feature_key, position, interruptible) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", [
|
|
868
876
|
characterId,
|
|
869
877
|
index,
|
|
870
|
-
toJson([...new Set(window.days)].sort()),
|
|
878
|
+
toJson([...new Set(window.days)].sort((a, b) => a - b)),
|
|
871
879
|
toJson([...new Set(window.on ?? [])]),
|
|
872
880
|
window.start,
|
|
873
881
|
window.end,
|
|
@@ -10931,6 +10939,50 @@ function describeRoll(roll, check) {
|
|
|
10931
10939
|
if (roll.readout !== void 0) lines.push(`That is: ${roll.readout.label}${roll.readout.critical ? " (critical)" : ""}; the result is ${roll.readout.result}. This is decided by the dice: do not change it, narrate it.${check === void 0 || roll.character === void 0 ? "" : ` In resolve_round give ${roll.character}'s outcome this result and cite the roll: roll ${roll.id}.`}`);
|
|
10932
10940
|
return lines.join(" ");
|
|
10933
10941
|
}
|
|
10942
|
+
/** Rolls one of the story's checks for a character and records it: the one place that decides what a check roll is, for the tool and for whatever rolls on an agent's behalf. */
|
|
10943
|
+
function rollForCheck(link, args, roller = systemRoller, by = "agent") {
|
|
10944
|
+
const { session, turn } = link;
|
|
10945
|
+
const check = session.dice.check(args.check);
|
|
10946
|
+
if (check === void 0) throw new NotFoundError(`there is no check "${args.check}"; list_checks shows the story's checks`);
|
|
10947
|
+
const who = session.characters.list().find((entry) => characterKey(entry) === args.character);
|
|
10948
|
+
if (who === void 0) throw new NotFoundError(`there is no character "${args.character}"; list_characters shows the keys`);
|
|
10949
|
+
let modifier;
|
|
10950
|
+
if (check.modifier !== void 0) {
|
|
10951
|
+
const value = session.variables.value(check.modifier, "character", who.id);
|
|
10952
|
+
if (typeof value !== "number") throw new NotFoundError(`the character's ${check.modifier} is not a number, so the check cannot add it`);
|
|
10953
|
+
modifier = value;
|
|
10954
|
+
}
|
|
10955
|
+
const bonus = Math.max(-10, Math.min(10, args.bonus ?? 0));
|
|
10956
|
+
const made = rollCheck(check, {
|
|
10957
|
+
...modifier === void 0 ? {} : { modifier },
|
|
10958
|
+
bonus,
|
|
10959
|
+
...args.target === void 0 ? {} : { target: args.target }
|
|
10960
|
+
}, roller);
|
|
10961
|
+
const roll = session.dice.record({
|
|
10962
|
+
turn,
|
|
10963
|
+
check: check.key,
|
|
10964
|
+
expression: check.dice,
|
|
10965
|
+
faces: made.faces,
|
|
10966
|
+
kept: made.kept,
|
|
10967
|
+
modifier: made.modifier,
|
|
10968
|
+
...made.target === void 0 ? {} : { target: made.target },
|
|
10969
|
+
total: made.total,
|
|
10970
|
+
value: made.value,
|
|
10971
|
+
readout: made.readout,
|
|
10972
|
+
reason: args.reason,
|
|
10973
|
+
character: args.character,
|
|
10974
|
+
by
|
|
10975
|
+
});
|
|
10976
|
+
return {
|
|
10977
|
+
roll: roll.id,
|
|
10978
|
+
check: check.key,
|
|
10979
|
+
total: roll.total,
|
|
10980
|
+
result: made.readout.result,
|
|
10981
|
+
label: made.readout.label,
|
|
10982
|
+
critical: made.readout.critical,
|
|
10983
|
+
text: describeRoll(roll, check)
|
|
10984
|
+
};
|
|
10985
|
+
}
|
|
10934
10986
|
const rolled = (_args, value) => [{
|
|
10935
10987
|
type: "text",
|
|
10936
10988
|
text: value.text
|
|
@@ -11012,48 +11064,7 @@ function createDiceTools(resolve, options = {}) {
|
|
|
11012
11064
|
},
|
|
11013
11065
|
isConcurrencySafe: () => false,
|
|
11014
11066
|
execute(args, exec) {
|
|
11015
|
-
|
|
11016
|
-
const check = session.dice.check(args.check);
|
|
11017
|
-
if (check === void 0) throw new NotFoundError(`there is no check "${args.check}"; list_checks shows the story's checks`);
|
|
11018
|
-
if (session.characters.list().every((entry) => characterKey(entry) !== args.character)) throw new NotFoundError(`there is no character "${args.character}"; list_characters shows the keys`);
|
|
11019
|
-
let modifier;
|
|
11020
|
-
if (check.modifier !== void 0) {
|
|
11021
|
-
const who = session.characters.list().find((entry) => characterKey(entry) === args.character);
|
|
11022
|
-
if (who === void 0) throw new NotFoundError(`there is no character "${args.character}"; list_characters shows the keys`);
|
|
11023
|
-
const value = session.variables.value(check.modifier, "character", who.id);
|
|
11024
|
-
if (typeof value !== "number") throw new NotFoundError(`the character's ${check.modifier} is not a number, so the check cannot add it`);
|
|
11025
|
-
modifier = value;
|
|
11026
|
-
}
|
|
11027
|
-
const bonus = Math.max(-10, Math.min(10, args.bonus ?? 0));
|
|
11028
|
-
const made = rollCheck(check, {
|
|
11029
|
-
...modifier === void 0 ? {} : { modifier },
|
|
11030
|
-
bonus,
|
|
11031
|
-
...args.target === void 0 ? {} : { target: args.target }
|
|
11032
|
-
}, roller);
|
|
11033
|
-
const roll = session.dice.record({
|
|
11034
|
-
turn,
|
|
11035
|
-
check: check.key,
|
|
11036
|
-
expression: check.dice,
|
|
11037
|
-
faces: made.faces,
|
|
11038
|
-
kept: made.kept,
|
|
11039
|
-
modifier: made.modifier,
|
|
11040
|
-
...made.target === void 0 ? {} : { target: made.target },
|
|
11041
|
-
total: made.total,
|
|
11042
|
-
value: made.value,
|
|
11043
|
-
readout: made.readout,
|
|
11044
|
-
reason: args.reason,
|
|
11045
|
-
character: args.character,
|
|
11046
|
-
by: options.by ?? "agent"
|
|
11047
|
-
});
|
|
11048
|
-
return Promise.resolve({
|
|
11049
|
-
roll: roll.id,
|
|
11050
|
-
check: check.key,
|
|
11051
|
-
total: roll.total,
|
|
11052
|
-
result: made.readout.result,
|
|
11053
|
-
label: made.readout.label,
|
|
11054
|
-
critical: made.readout.critical,
|
|
11055
|
-
text: describeRoll(roll, check)
|
|
11056
|
-
});
|
|
11067
|
+
return Promise.resolve(rollForCheck(linkOf(exec.agent), args, roller, options.by));
|
|
11057
11068
|
}
|
|
11058
11069
|
}),
|
|
11059
11070
|
defineTool({
|
|
@@ -12904,7 +12915,7 @@ var RoleplayState = class extends Service {
|
|
|
12904
12915
|
};
|
|
12905
12916
|
const name = "@dsh-agentic-roleplay/state";
|
|
12906
12917
|
function apply(ctx, config) {
|
|
12907
|
-
new RoleplayState(ctx, config);
|
|
12918
|
+
return new RoleplayState(ctx, config);
|
|
12908
12919
|
}
|
|
12909
12920
|
//#endregion
|
|
12910
12921
|
//#region src/tools/character.ts
|
|
@@ -13128,6 +13139,6 @@ function createCharacterTools(link, characterId) {
|
|
|
13128
13139
|
];
|
|
13129
13140
|
}
|
|
13130
13141
|
//#endregion
|
|
13131
|
-
export { ACCURACIES, CHARACTER_CONTROLS, CHARACTER_KINDS, CHARACTER_ROLES, CHARACTER_TIERS, CLOCK_MODES, COMPARISONS, CONSOLIDATION_KINDS, CONTAINER_STATES, Config, ConflictError, CorruptDataError, DAY, DAY_PARTS, DEFAULT_CONFIDENCE, DEFAULT_MEMORY_POLICY, DEFAULT_SLOTS, DICE_COMPARISONS, DICE_READINGS, DICE_RESULTS, EMOTION_VARIABLES, ENGAGEMENT_GRACE, ENGAGEMENT_STATUSES, EVIDENCE_RELATIONS, EXIT_STATES, HOUR, IMPORTANCE_MAX, IMPORTANCE_MIN, INTENT_HORIZONS, INTENT_STATUSES, INTENT_TYPES, ITEM_ACTIONS, InvalidEditError, InvalidMoveError, InvalidValueError, KNOWLEDGE_KINDS, LANGUAGES, LIST_CHECKS_TOOL, LORE_KINDS, LORE_SCOPES, LORE_SUBJECT_KINDS, MAX_DICE_BANDS, MAX_DICE_CHECKS, MAX_DICE_PER_ROLL, MAX_DICE_SIDES, MAX_DICE_TERMS, MAX_LOCATION_FEATURES, MAX_ROUTINE_WINDOWS, MAX_SHOWN, MAX_TRIGGERS, MAX_VARIABLES, MEMBERSHIP_STATUSES, MEMORY_CONFIDENCES, MEMORY_KINDS, MIGRATION_BACKUP_FOLDER, MINUTE, MONTH_NAMES, NO_CALENDAR, NotFoundError, PERCEPTION_MODES, PLACEABLE_KINDS, PLOT_NUDGE_MODES, PLOT_STATUSES, RECALL_ITEM_KINDS, ROLL_CHECK_TOOL, ROLL_DICE_TOOL, RoleplayState, LATEST_VERSION as SCHEMA_VERSION, SEASONS, 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, checkProblems, clarityAt, clockTime, conditionHolds, createCharacterTools, createDiceTools, createSession, createSessionStore, createTools, dayMatches, dayPart, dayTokenProblems, deleteSession, deliverNotes, denseScore, describeDuration, describeHolder, describeInstant, describeRoll, describeValue, finishRecall, fuseScores, holidaysOn, inAudience, inWindow, isSessionId, isTimeZone, itemKey, jitter, judgedStatements, languageOf, lapseNotes, lintWorld, listSessions, localIso, localTime, locationKey, mentioned, migrationBackupPath, moveCharacter, name, nextOccurrence, nextTimeOfDay, nodeSqliteDriver, notationRange, occurrenceAt, openSession, openSessionStore, overlap, parseDayToken, parseInstant, parseNotation, parseRecordsEdit, parseTimeOfDay, parseTriggerDefinition, placeholdersOf, planItemChange, planKnownMove, planMove, planVariableChange, poolCandidates, rankGoals, readBands, readCalendar, readRecords, readTriggerDefinition, recall, recallCandidates, recallPool, recordsEditSchema, renderWords, retention, rollCheck, rollNotation, rollPlain, runTriggers, seasonOf, seededRoll, sessionDatabase, sessionFolder, shownVariables, subjectOf, systemClock, systemRoller, systemTimeZone, tokens, translated, translation, translator, triggerReferenceProblems, valueIssue, writeCalendar, zonedInstant };
|
|
13142
|
+
export { ACCURACIES, CHARACTER_CONTROLS, CHARACTER_KINDS, CHARACTER_ROLES, CHARACTER_TIERS, CLOCK_MODES, COMPARISONS, CONSOLIDATION_KINDS, CONTAINER_STATES, Config, ConflictError, CorruptDataError, DAY, DAY_PARTS, DEFAULT_CONFIDENCE, DEFAULT_MEMORY_POLICY, DEFAULT_SLOTS, DICE_COMPARISONS, DICE_READINGS, DICE_RESULTS, EMOTION_VARIABLES, ENGAGEMENT_GRACE, ENGAGEMENT_STATUSES, EVIDENCE_RELATIONS, EXIT_STATES, HOUR, IMPORTANCE_MAX, IMPORTANCE_MIN, INTENT_HORIZONS, INTENT_STATUSES, INTENT_TYPES, ITEM_ACTIONS, InvalidEditError, InvalidMoveError, InvalidValueError, KNOWLEDGE_KINDS, LANGUAGES, LIST_CHECKS_TOOL, LORE_KINDS, LORE_SCOPES, LORE_SUBJECT_KINDS, MAX_DICE_BANDS, MAX_DICE_CHECKS, MAX_DICE_PER_ROLL, MAX_DICE_SIDES, MAX_DICE_TERMS, MAX_LOCATION_FEATURES, MAX_ROUTINE_WINDOWS, MAX_SHOWN, MAX_TRIGGERS, MAX_VARIABLES, MEMBERSHIP_STATUSES, MEMORY_CONFIDENCES, MEMORY_KINDS, MIGRATION_BACKUP_FOLDER, MINUTE, MONTH_NAMES, NO_CALENDAR, NotFoundError, PERCEPTION_MODES, PLACEABLE_KINDS, PLOT_NUDGE_MODES, PLOT_STATUSES, RECALL_ITEM_KINDS, ROLL_CHECK_TOOL, ROLL_DICE_TOOL, RoleplayState, LATEST_VERSION as SCHEMA_VERSION, SEASONS, 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, checkProblems, clarityAt, clockTime, conditionHolds, createCharacterTools, createDiceTools, createSession, createSessionStore, createTools, dayMatches, dayPart, dayTokenProblems, deleteSession, deliverNotes, denseScore, describeDuration, describeHolder, describeInstant, describeRoll, describeValue, finishRecall, fuseScores, holidaysOn, inAudience, inWindow, isSessionId, isTimeZone, itemKey, jitter, judgedStatements, languageOf, lapseNotes, lintWorld, listSessions, localIso, localTime, locationKey, mentioned, migrationBackupPath, moveCharacter, name, nextOccurrence, nextTimeOfDay, nodeSqliteDriver, notationRange, occurrenceAt, openSession, openSessionStore, overlap, parseDayToken, parseInstant, parseNotation, parseRecordsEdit, parseTimeOfDay, parseTriggerDefinition, placeholdersOf, planItemChange, planKnownMove, planMove, planVariableChange, poolCandidates, rankGoals, readBands, readCalendar, readRecords, readTriggerDefinition, recall, recallCandidates, recallPool, recordsEditSchema, renderWords, retention, rollCheck, rollForCheck, rollNotation, rollPlain, runTriggers, seasonOf, seededRoll, sessionDatabase, sessionFolder, shownVariables, subjectOf, systemClock, systemRoller, systemTimeZone, tokens, translated, translation, translator, triggerReferenceProblems, valueIssue, writeCalendar, zonedInstant };
|
|
13132
13143
|
|
|
13133
13144
|
//# sourceMappingURL=index.js.map
|