@ryan_nookpi/pi-extension-subagent 0.4.5 → 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.
package/cli.ts CHANGED
@@ -15,7 +15,7 @@ export type SubagentCliParseResult =
15
15
  | { type: "help" }
16
16
  | { type: "agents" }
17
17
  | { type: "params"; params: Record<string, unknown> }
18
- | { type: "error"; message: string };
18
+ | { type: "error"; message: string; showHelp?: boolean };
19
19
 
20
20
  export const SUBAGENT_CLI_HELP_TEXT = [
21
21
  "Subagent CLI (LLM interface)",
@@ -451,7 +451,8 @@ export function parseSubagentToolCommand(
451
451
  if ("error" in tokenized) {
452
452
  return {
453
453
  type: "error",
454
- message: `❌ Syntax error: ${tokenized.error}\n\nCheck that quotes are balanced and the command is well-formed.\n\n✓ Correct: subagent run worker -- "task with spaces"`,
454
+ message: `❌ Syntax error: ${tokenized.error}\nClose the quote or wrap the task after \`--\` in matching quotes.`,
455
+ showHelp: false,
455
456
  };
456
457
  }
457
458
 
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.5",
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": {
package/tool-execute.ts CHANGED
@@ -774,8 +774,13 @@ export function createSubagentToolExecute(pi: ExtensionAPI, store: SubagentStore
774
774
  }
775
775
 
776
776
  if (parsedCommand.type === "error") {
777
+ const errorText =
778
+ parsedCommand.showHelp === false
779
+ ? parsedCommand.message
780
+ : `${parsedCommand.message}\n\n${SUBAGENT_CLI_HELP_TEXT}`;
781
+
777
782
  return {
778
- content: [{ type: "text", text: `${parsedCommand.message}\n\n${SUBAGENT_CLI_HELP_TEXT}` }],
783
+ content: [{ type: "text", text: errorText }],
779
784
  details: createEmptyDetails("single", false, null),
780
785
  isError: true,
781
786
  };
package/widget.ts CHANGED
@@ -119,9 +119,10 @@ function getContextShort(run: CommandRunState, ctx: WidgetRenderCtx, theme: Widg
119
119
  if (usedContextPercent === undefined) return "";
120
120
  const contextBar = formatCompactContextBar(usedContextPercent);
121
121
  if (!contextBar) return "";
122
+ const contextLabel = `${contextBar} ${usedContextPercent}%`;
122
123
  const contextBarColor =
123
124
  remainingContextPercent !== undefined ? getContextBarColorByRemaining(remainingContextPercent) : undefined;
124
- return contextBarColor ? theme.fg(contextBarColor, contextBar) : theme.fg("dim", contextBar);
125
+ return contextBarColor ? theme.fg(contextBarColor, contextLabel) : theme.fg("dim", contextLabel);
125
126
  }
126
127
 
127
128
  function buildPrimaryLabelText(run: CommandRunState): string {