lumiverse-spindle-types 0.6.10 → 0.6.12
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/package.json +1 -1
- package/src/api.ts +33 -1
- package/src/dom.ts +7 -0
- package/src/index.ts +2 -0
- package/src/spindle-api.ts +2 -0
- package/test/interceptor-consumer.ts +15 -0
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -1522,7 +1522,7 @@ export type WorldBookEntryUpdateDTO = WorldBookEntryCreateDTO;
|
|
|
1522
1522
|
export type RegexPlacementDTO = "user_input" | "ai_output" | "world_info" | "reasoning";
|
|
1523
1523
|
export type RegexScopeDTO = "global" | "character" | "chat";
|
|
1524
1524
|
export type RegexTargetDTO = "prompt" | "response" | "display";
|
|
1525
|
-
export type RegexMacroModeDTO = "none" | "raw" | "escaped" | "after";
|
|
1525
|
+
export type RegexMacroModeDTO = "none" | "find" | "raw" | "escaped" | "after";
|
|
1526
1526
|
|
|
1527
1527
|
export interface RegexScriptDTO {
|
|
1528
1528
|
id: string;
|
|
@@ -1607,6 +1607,7 @@ export interface WorldInfoInterceptorEntryDTO {
|
|
|
1607
1607
|
readonly keysecondary: readonly string[];
|
|
1608
1608
|
readonly position: number;
|
|
1609
1609
|
readonly depth: number;
|
|
1610
|
+
readonly role: string | null;
|
|
1610
1611
|
readonly priority: number;
|
|
1611
1612
|
readonly probability: number;
|
|
1612
1613
|
readonly use_probability: boolean;
|
|
@@ -1614,6 +1615,9 @@ export interface WorldInfoInterceptorEntryDTO {
|
|
|
1614
1615
|
readonly automation_id: string | null;
|
|
1615
1616
|
readonly selective: boolean;
|
|
1616
1617
|
readonly selective_logic: number;
|
|
1618
|
+
readonly group_name: string;
|
|
1619
|
+
readonly group_override: boolean;
|
|
1620
|
+
readonly group_weight: number;
|
|
1617
1621
|
readonly match_whole_words: boolean;
|
|
1618
1622
|
readonly case_sensitive: boolean;
|
|
1619
1623
|
readonly use_regex: boolean;
|
|
@@ -1624,6 +1628,11 @@ export interface WorldInfoInterceptorEntryDTO {
|
|
|
1624
1628
|
readonly exclude_greeting: boolean;
|
|
1625
1629
|
readonly scan_depth: number | null;
|
|
1626
1630
|
readonly order_value: number;
|
|
1631
|
+
readonly sticky: number;
|
|
1632
|
+
readonly cooldown: number;
|
|
1633
|
+
readonly delay: number;
|
|
1634
|
+
/** Latest prompt-local chat placement supplied by an earlier handler. */
|
|
1635
|
+
readonly placement?: WorldInfoInterceptorPlacementDTO;
|
|
1627
1636
|
/** Attachment scope that contributed the entry's book to this chat. */
|
|
1628
1637
|
readonly book_source?: WorldBookSourceDTO;
|
|
1629
1638
|
}
|
|
@@ -1660,6 +1669,24 @@ export interface WorldInfoActivationOverridesDTO {
|
|
|
1660
1669
|
readonly disableRecursion?: true;
|
|
1661
1670
|
}
|
|
1662
1671
|
|
|
1672
|
+
export type WorldInfoInterceptorRoleDTO = "system" | "user" | "assistant";
|
|
1673
|
+
|
|
1674
|
+
/**
|
|
1675
|
+
* Prompt-local placement relative to the selected chat history, including its
|
|
1676
|
+
* greeting when present.
|
|
1677
|
+
*
|
|
1678
|
+
* Selected placements use the host's world-info insertion order. Each inserted
|
|
1679
|
+
* entry becomes part of the history sequence used to place the next entry. The
|
|
1680
|
+
* host does not persist these values to the world book.
|
|
1681
|
+
*/
|
|
1682
|
+
export interface WorldInfoInterceptorPlacementDTO {
|
|
1683
|
+
readonly type: "chat_depth";
|
|
1684
|
+
readonly role: WorldInfoInterceptorRoleDTO;
|
|
1685
|
+
/** Non-negative integer passed to the selected direction's depth rule. */
|
|
1686
|
+
readonly depth: number;
|
|
1687
|
+
readonly direction: "from_start" | "from_end";
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1663
1690
|
/**
|
|
1664
1691
|
* Context passed to a `registerWorldInfoInterceptor` handler. Fires inside
|
|
1665
1692
|
* `assemblePrompt` immediately before `activateWorldInfo` runs, so any
|
|
@@ -1691,6 +1718,11 @@ export interface WorldInfoInterceptorMutationDTO {
|
|
|
1691
1718
|
* `content` (or the stored entry content when `content` is omitted).
|
|
1692
1719
|
*/
|
|
1693
1720
|
readonly selectionContent?: string;
|
|
1721
|
+
/**
|
|
1722
|
+
* Overrides this entry's chat-history placement for the current prompt.
|
|
1723
|
+
* Omit it to retain the stored native position, depth, and role.
|
|
1724
|
+
*/
|
|
1725
|
+
readonly placement?: WorldInfoInterceptorPlacementDTO;
|
|
1694
1726
|
}
|
|
1695
1727
|
|
|
1696
1728
|
/**
|
package/src/dom.ts
CHANGED
|
@@ -858,6 +858,13 @@ export interface SpindleDisplayResolverRegistry {
|
|
|
858
858
|
registerResolver(resolver: SpindleDisplayResolver): () => void;
|
|
859
859
|
/** Ask the host to invalidate cached display resolutions whose dependencies (a `<scope>:<name>` set) changed. */
|
|
860
860
|
invalidate(touchedVars: string[]): void;
|
|
861
|
+
/** Update the active chat's transient expression display without a backend round trip. */
|
|
862
|
+
setExpression(expression: {
|
|
863
|
+
chatId: string;
|
|
864
|
+
characterId: string;
|
|
865
|
+
label: string;
|
|
866
|
+
imageId: string;
|
|
867
|
+
}): void;
|
|
861
868
|
}
|
|
862
869
|
|
|
863
870
|
/** Context object provided to frontend extension modules */
|
package/src/index.ts
CHANGED
|
@@ -115,6 +115,8 @@ export type {
|
|
|
115
115
|
WorldInfoInterceptorMessageDTO,
|
|
116
116
|
WorldInfoActivationSettingsDTO,
|
|
117
117
|
WorldInfoActivationOverridesDTO,
|
|
118
|
+
WorldInfoInterceptorRoleDTO,
|
|
119
|
+
WorldInfoInterceptorPlacementDTO,
|
|
118
120
|
WorldInfoInterceptorCtxDTO,
|
|
119
121
|
WorldInfoInterceptorMutationDTO,
|
|
120
122
|
WorldInfoInterceptorResultDTO,
|
package/src/spindle-api.ts
CHANGED
|
@@ -1358,6 +1358,8 @@ export interface SpindleAPI {
|
|
|
1358
1358
|
* `preAssemblyGenerationContext >= 1`: generation contexts carry
|
|
1359
1359
|
* `dryRun`/`userId` and `cancelGeneration` is honored.
|
|
1360
1360
|
* `worldInfoActivationCapture >= 1`: world info activation capture is supported.
|
|
1361
|
+
* `worldInfoRuntimePlacement >= 1`: world info mutations accept prompt-local
|
|
1362
|
+
* chat-depth placement.
|
|
1361
1363
|
*/
|
|
1362
1364
|
contracts?: Readonly<Record<string, number>>;
|
|
1363
1365
|
|
|
@@ -130,7 +130,22 @@ declare const spindle: SpindleAPI;
|
|
|
130
130
|
spindle.registerWorldInfoInterceptor(async (worldInfoContext) => {
|
|
131
131
|
const globalScanDepth: number | null =
|
|
132
132
|
worldInfoContext.activationSettings.globalScanDepth;
|
|
133
|
+
const role: string | null | undefined = worldInfoContext.entries[0]?.role;
|
|
134
|
+
const priorPlacement = worldInfoContext.entries[0]?.placement;
|
|
133
135
|
void globalScanDepth;
|
|
136
|
+
void role;
|
|
137
|
+
void priorPlacement;
|
|
138
|
+
return {
|
|
139
|
+
mutated: [{
|
|
140
|
+
id: "entry-id",
|
|
141
|
+
placement: {
|
|
142
|
+
type: "chat_depth",
|
|
143
|
+
role: "system",
|
|
144
|
+
depth: 2,
|
|
145
|
+
direction: "from_start",
|
|
146
|
+
},
|
|
147
|
+
}],
|
|
148
|
+
};
|
|
134
149
|
});
|
|
135
150
|
spindle.registerMessageContentProcessor(async (messageContext) => {
|
|
136
151
|
const isUser: boolean = messageContext.isUser;
|