@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.
Files changed (2) hide show
  1. package/index.ts +12 -17
  2. 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
- const cfg = readConfig();
127
- for (const key of [cfg.composeShortcut, FALLBACK_COMPOSE_SHORTCUT].filter((key, index, keys) => keys.indexOf(key) === index)) {
128
- pi.registerShortcut(key as any, {
129
- description: "Prefill /btw in the prompt editor",
130
- handler: async (ctx) => {
131
- const current = ctx.ui.getEditorText();
132
- const prefix = current.trim() ? `${current.trimEnd()} /btw ` : "/btw ";
133
- ctx.ui.setEditorText(prefix);
134
- },
135
- });
136
- }
137
- for (const key of [cfg.injectShortcut, FALLBACK_INJECT_SHORTCUT].filter((key, index, keys) => keys.indexOf(key) === index)) {
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.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@howaboua/pi-smart-btw",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Async side-session questions for Pi with explicit injection into the main chat.",
5
5
  "type": "module",
6
6
  "license": "MIT",