oh-pi 0.1.63 → 0.1.64
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
CHANGED
|
@@ -191,9 +191,21 @@ export default function antColonyExtension(pi: ExtensionAPI) {
|
|
|
191
191
|
promise: null as any, // set below
|
|
192
192
|
};
|
|
193
193
|
|
|
194
|
+
let lastPhase = "";
|
|
195
|
+
|
|
194
196
|
const callbacks: QueenCallbacks = {
|
|
195
197
|
onSignal(signal) {
|
|
196
198
|
colony.phase = signal.message;
|
|
199
|
+
// 阶段切换时注入消息到主进程对话流
|
|
200
|
+
if (signal.phase !== lastPhase) {
|
|
201
|
+
lastPhase = signal.phase;
|
|
202
|
+
const pct = Math.round(signal.progress * 100);
|
|
203
|
+
pi.sendMessage({
|
|
204
|
+
customType: "ant-colony-progress",
|
|
205
|
+
content: `[COLONY_SIGNAL:${signal.phase.toUpperCase()}] 🐜 ${signal.message} (${pct}%, ${formatCost(signal.cost)})`,
|
|
206
|
+
display: false,
|
|
207
|
+
}, { triggerTurn: false, deliverAs: "followUp" });
|
|
208
|
+
}
|
|
197
209
|
throttledRender();
|
|
198
210
|
},
|
|
199
211
|
onPhase(phase, detail) {
|