@ryan_nookpi/pi-extension-subagent 0.4.7 → 0.4.8

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/mentions.ts +17 -1
  2. package/package.json +1 -1
package/mentions.ts CHANGED
@@ -167,7 +167,23 @@ export function createAgentMentionAutocompleteProvider(
167
167
  },
168
168
 
169
169
  applyCompletion(lines, cursorLine, cursorCol, item, prefix) {
170
- return current.applyCompletion(lines, cursorLine, cursorCol, item, prefix);
170
+ if (!prefix.startsWith(">")) {
171
+ return current.applyCompletion(lines, cursorLine, cursorCol, item, prefix);
172
+ }
173
+
174
+ const currentLine = lines[cursorLine] ?? "";
175
+ const beforePrefix = currentLine.slice(0, cursorCol - prefix.length);
176
+ const afterCursor = currentLine.slice(cursorCol);
177
+ // Append a trailing space so the mention hits its trailing boundary and converts,
178
+ // but avoid doubling up when the cursor is already followed by whitespace.
179
+ const suffix = /^\s/.test(afterCursor) ? "" : " ";
180
+ const newLines = [...lines];
181
+ newLines[cursorLine] = `${beforePrefix}${item.value}${suffix}${afterCursor}`;
182
+ return {
183
+ lines: newLines,
184
+ cursorLine,
185
+ cursorCol: beforePrefix.length + item.value.length + suffix.length,
186
+ };
171
187
  },
172
188
 
173
189
  shouldTriggerFileCompletion(lines, cursorLine, cursorCol) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryan_nookpi/pi-extension-subagent",
3
- "version": "0.4.7",
3
+ "version": "0.4.8",
4
4
  "description": "Asynchronous subagent delegation for pi with run, batch, chain, and continuation workflows.",
5
5
  "license": "MIT",
6
6
  "repository": {