@howaboua/pi-smart-btw 0.1.0 → 0.1.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/index.ts +12 -17
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -123,23 +123,18 @@ export default function (pi: ExtensionAPI) {
|
|
|
123
123
|
pi.sendUserMessage(injectionText(turns), state.ctx?.isIdle() ? undefined : { deliverAs: "followUp" });
|
|
124
124
|
};
|
|
125
125
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
pi.registerShortcut(key as any, { description: "Inject latest /btw answer into the main session", handler: async () => inject() });
|
|
139
|
-
}
|
|
140
|
-
for (const key of [cfg.dismissShortcut, FALLBACK_DISMISS_SHORTCUT].filter((key, index, keys) => keys.indexOf(key) === index)) {
|
|
141
|
-
pi.registerShortcut(key as any, { description: "Dismiss active /btw block", handler: async () => { await dismiss(); } });
|
|
142
|
-
}
|
|
126
|
+
readConfig();
|
|
127
|
+
pi.registerShortcut(FALLBACK_COMPOSE_SHORTCUT as any, {
|
|
128
|
+
description: "Prefill /btw in the prompt editor",
|
|
129
|
+
handler: async (ctx) => {
|
|
130
|
+
const current = ctx.ui.getEditorText();
|
|
131
|
+
const prefix = current.trim() ? `${current.trimEnd()} /btw ` : "/btw ";
|
|
132
|
+
ctx.ui.setEditorText(prefix);
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
pi.registerShortcut(FALLBACK_INJECT_SHORTCUT as any, { description: "Inject latest /btw answer into the main session", handler: async () => inject() });
|
|
137
|
+
pi.registerShortcut(FALLBACK_DISMISS_SHORTCUT as any, { description: "Dismiss active /btw block", handler: async () => { await dismiss(); } });
|
|
143
138
|
|
|
144
139
|
pi.registerCommand("btw", {
|
|
145
140
|
description: "Ask a fresh async side-session question. Re-run while open to ask a follow-up. UI: inject/dismiss shortcuts shown in the btw block.",
|