@sendevia/pi-ask-author 1.0.0 → 1.0.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/README.md +3 -111
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
- 🖥️ **双栏响应式 TUI 交互**
|
|
16
16
|
- **左栏选项决策**:直观展示单选/多选状态、完成度指示徽标、选项标签与专属批注标识。
|
|
17
17
|
- **右栏实时预览**:光标移动时即时联动渲染当前选项的**剧情因果推导**与 **Markdown 正文草稿预览**。
|
|
18
|
-
-
|
|
18
|
+
- **自适应视口**:终端宽度不足时启用双栏,窄屏下改为单栏内联展开与折叠。
|
|
19
19
|
- 📖 **小说级富文本与草稿高亮**
|
|
20
20
|
- 内置紧凑轻量的终端 Markdown 渲染与小说语法高亮,完整支持 bold、italic、删除线、行内代码、引用区块。
|
|
21
21
|
- 对中文小说台词(引号内对话高亮)与分段排版做了专门处理,作者可以在终端内直接检视行文节奏与语感。
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
- **单题平铺模式**:快速发起单点决策(如重要剧情分歧、结局走向)。
|
|
27
27
|
- **多题批量问卷模式**:支持在单次弹窗内汇集多个关联决策(如脱离路线 + 战利品搜刮 + 下章基调),配有顶部 Tab 标签栏与完成度总览页(Summary Tab),作者在一处完成全部确认。
|
|
28
28
|
- 🎯 **确定性 LLM 封套与指令蒸馏 (Deterministic Envelopes)**
|
|
29
|
-
- 工具返回给 LLM 的文本采用固定的结构化 Markdown 封套(`[Author Decision Finalized]` / `[Author Decision Cancelled]` / `[Author Consultation Error]
|
|
29
|
+
- 工具返回给 LLM 的文本采用固定的结构化 Markdown 封套(`[Author Decision Finalized]` / `[Author Decision Cancelled]` / `[Author Consultation Error]`),前缀稳定,便于缓存命中。
|
|
30
30
|
- **草稿指令提取 (Draft Directives)**:选中的选项草稿预览会自动提炼为紧凑的单行 `[Draft directive: ...]` 指令,直接供 LLM 在后续正文执笔中原样复用或参考。
|
|
31
31
|
- 尾部附带执行指令,要求模型不再寒暄,直接进入下一步正文写作。
|
|
32
32
|
- ⚡ **高性能与极简依赖**
|
|
33
|
-
- 严格遵守 Pi
|
|
33
|
+
- 严格遵守 Pi 官方扩展生态规范,不引入其他第三方依赖。
|
|
34
34
|
- 资源回收:生命周期严格绑定 AbortSignal,定时器与事件监听幂等清理,渲染缓存按尺寸与状态键失效。
|
|
35
35
|
|
|
36
36
|
---
|
|
@@ -85,114 +85,6 @@ pi -e ./path/to/pi-ask-author
|
|
|
85
85
|
|
|
86
86
|
---
|
|
87
87
|
|
|
88
|
-
## 🤖 智能体提示词与调用规范 (Agent Guidelines)
|
|
89
|
-
|
|
90
|
-
在系统提示词或 Skill 中声明以下规则,可以引导 LLM 按预期调用该工具:
|
|
91
|
-
|
|
92
|
-
```markdown
|
|
93
|
-
Whenever plot branches, character decisions, scene atmosphere, or outline directions need confirmation:
|
|
94
|
-
|
|
95
|
-
- Call `ask_author` directly without conversational preambles.
|
|
96
|
-
- Always provide a concise `formTitle`.
|
|
97
|
-
- Use the `questions` array to batch interrelated decisions into ONE invocation; avoid consecutive single calls.
|
|
98
|
-
- Include causal plot deductions in `description` and scene draft excerpts in `preview`.
|
|
99
|
-
- Omit optional default fields (`id`, `description`, `minSelect`, `maxSelect`, `allowEmpty`, `allowCustom`) to maximize token economy and prompt caching.
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### 参数示例:多题批量问卷
|
|
103
|
-
|
|
104
|
-
```json
|
|
105
|
-
{
|
|
106
|
-
"formTitle": "第七幕逃生抉择与伏笔分配",
|
|
107
|
-
"questions": [
|
|
108
|
-
{
|
|
109
|
-
"title": "第一幕脱离路线选择",
|
|
110
|
-
"options": [
|
|
111
|
-
{
|
|
112
|
-
"label": "炸毁地下蒸汽管网断后",
|
|
113
|
-
"description": "引爆管网阻断追兵,代价是彻底暴露行踪并波及城区管线。",
|
|
114
|
-
"preview": "“听着,艾略特,”雷恩咬紧牙关按下阀门,“我数到三,你往排污井跳!”\n蒸汽在接缝处发出濒临极限的尖啸,暗红警示灯将二人面孔映得如同凝血。"
|
|
115
|
-
},
|
|
116
|
-
{ "label": "遁入旧排水暗渠迂回脱离", "description": "周旋于暗渠迷宫,隐匿行踪但有遭遇感染体风险。" }
|
|
117
|
-
]
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
"title": "主角搜刮战利品与剧情伏笔(多选)",
|
|
121
|
-
"multiSelect": true,
|
|
122
|
-
"options": [
|
|
123
|
-
{ "label": "过载超频模块", "description": "战斗中可触发高热熔毁,但易过载自伤。" },
|
|
124
|
-
{ "label": "加密军方识别铭牌", "description": "揭示军方秘密人体实验编号,引发信任危机。" }
|
|
125
|
-
]
|
|
126
|
-
}
|
|
127
|
-
]
|
|
128
|
-
}
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### 返回封套示例
|
|
132
|
-
|
|
133
|
-
```text
|
|
134
|
-
[Author Decision Finalized]
|
|
135
|
-
1. [第一幕脱离路线选择]: 【炸毁地下蒸汽管网断后】引爆管网阻断追兵,代价是彻底暴露行踪并波及城区管线。 [Author note: 注意描写气压表的指针爆表碎裂细节] [Draft directive: '听着,艾略特,'雷恩咬紧牙关按下阀门,'我数到三,你往排污井跳!' / 蒸汽在接缝处发出濒临极限的尖啸,暗红警示灯将二人面孔映得如同凝血。]
|
|
136
|
-
2. [主角搜刮战利品与剧情伏笔(多选)]: 【过载超频模块】战斗中可触发高热熔毁,但易过载自伤。; 【加密军方识别铭牌】揭示军方秘密人体实验编号,引发信任危机。
|
|
137
|
-
Execute workflow and writing strictly according to the author decisions and draft directives above without conversational acknowledgments.
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
---
|
|
141
|
-
|
|
142
|
-
## 🏗️ 架构与模块设计 (Architecture)
|
|
143
|
-
|
|
144
|
-
插件采用严格的单向无环依赖图分层构建,保证各个组件职责清晰、高内聚且易于测试:
|
|
145
|
-
|
|
146
|
-
```mermaid
|
|
147
|
-
flowchart LR
|
|
148
|
-
theme --> texts
|
|
149
|
-
theme --> novel-markdown
|
|
150
|
-
theme --> view-rows
|
|
151
|
-
theme --> view-summary
|
|
152
|
-
theme --> component
|
|
153
|
-
texts --> format
|
|
154
|
-
texts --> schema
|
|
155
|
-
texts --> model
|
|
156
|
-
texts --> novel-markdown
|
|
157
|
-
texts --> view-rows
|
|
158
|
-
texts --> view-summary
|
|
159
|
-
texts --> component
|
|
160
|
-
texts --> index
|
|
161
|
-
format --> sanitize
|
|
162
|
-
format --> model
|
|
163
|
-
format --> novel-markdown
|
|
164
|
-
format --> view-rows
|
|
165
|
-
format --> view-summary
|
|
166
|
-
format --> component
|
|
167
|
-
format --> index
|
|
168
|
-
schema --> sanitize
|
|
169
|
-
schema --> model
|
|
170
|
-
schema --> index
|
|
171
|
-
model --> novel-markdown
|
|
172
|
-
model --> view-rows
|
|
173
|
-
model --> view-summary
|
|
174
|
-
model --> component
|
|
175
|
-
model --> index
|
|
176
|
-
sanitize --> index
|
|
177
|
-
novel-markdown --> component
|
|
178
|
-
view-rows --> component
|
|
179
|
-
view-summary --> component
|
|
180
|
-
component --> index
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
箭头由被依赖模块指向依赖它的模块(`A --> B` 表示 `B` 导入 `A`)。
|
|
184
|
-
|
|
185
|
-
- **`index.ts`**:扩展主入口,注册 `ask_author` 工具与 `/ask-author` 命令,负责结果工厂构造与卡片记忆化渲染。
|
|
186
|
-
- **`component.ts`**:TUI 状态机核心组件,自行维护按键派生、光标记忆、视口滑动窗口与双栏排版。
|
|
187
|
-
- **`model.ts`**:问卷表单数据模型,负责规范化题目前期推导、选项校验与答案序列化。
|
|
188
|
-
- **`schema.ts`**:基于 TypeBox 构建的静态类型与运行时 Schema 单一数据源。
|
|
189
|
-
- **`texts.ts`**:常量、终端图标、小说语法表与面向作者/LLM 双向文案的集中字典。
|
|
190
|
-
- **`novel-markdown.ts`**:小说语法终端高亮层,在原生 Markdown 引擎解析前注入语义标记。
|
|
191
|
-
- **`sanitize.ts`**:入参防御性清洗与别名兼容。
|
|
192
|
-
- **`view-rows.ts` / `view-summary.ts`**:列表行与总览页的排版生成器。
|
|
193
|
-
|
|
194
|
-
---
|
|
195
|
-
|
|
196
88
|
## 🧪 开发与质量验证 (Development)
|
|
197
89
|
|
|
198
90
|
本项目开启 TypeScript 严格模式:
|