@oh-my-pi/pi-coding-agent 16.2.8 → 16.2.11

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 (67) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/dist/cli.js +3160 -3096
  3. package/dist/types/config/settings-schema.d.ts +41 -13
  4. package/dist/types/extensibility/skills.d.ts +29 -0
  5. package/dist/types/modes/components/mcp-add-wizard.d.ts +8 -0
  6. package/dist/types/modes/components/todo-reminder.d.ts +3 -1
  7. package/dist/types/modes/controllers/mcp-command-controller.d.ts +9 -0
  8. package/dist/types/modes/controllers/tool-args-reveal.d.ts +5 -0
  9. package/dist/types/modes/interactive-mode.d.ts +0 -1
  10. package/dist/types/modes/skill-command.d.ts +1 -1
  11. package/dist/types/modes/types.d.ts +0 -1
  12. package/dist/types/session/agent-session.d.ts +1 -1
  13. package/dist/types/stt/asr-client.d.ts +7 -3
  14. package/dist/types/stt/index.d.ts +1 -0
  15. package/dist/types/stt/stt-controller.d.ts +2 -0
  16. package/dist/types/stt/submit-trigger.d.ts +30 -0
  17. package/dist/types/task/index.d.ts +1 -1
  18. package/dist/types/task/types.d.ts +6 -6
  19. package/dist/types/tiny/models.d.ts +22 -8
  20. package/package.json +14 -13
  21. package/scripts/bundle-dist.ts +23 -4
  22. package/scripts/generate-docs-index.ts +116 -24
  23. package/src/async/job-manager.ts +27 -3
  24. package/src/cli/grep-cli.ts +1 -1
  25. package/src/commit/agentic/agent.ts +1 -1
  26. package/src/commit/agentic/prompts/system.md +1 -1
  27. package/src/commit/agentic/tools/analyze-file.ts +2 -2
  28. package/src/config/model-discovery.ts +118 -76
  29. package/src/config/settings-schema.ts +15 -1
  30. package/src/debug/profiler.ts +7 -1
  31. package/src/extensibility/skills.ts +77 -0
  32. package/src/internal-urls/docs-index.generated.txt +2 -2
  33. package/src/lsp/config.ts +17 -3
  34. package/src/mcp/oauth-flow.ts +35 -8
  35. package/src/modes/acp/acp-agent.ts +6 -9
  36. package/src/modes/components/mcp-add-wizard.ts +43 -3
  37. package/src/modes/components/model-selector.ts +21 -9
  38. package/src/modes/components/todo-reminder.ts +5 -1
  39. package/src/modes/controllers/event-controller.ts +40 -15
  40. package/src/modes/controllers/mcp-command-controller.ts +84 -3
  41. package/src/modes/controllers/selector-controller.ts +57 -35
  42. package/src/modes/controllers/tool-args-reveal.ts +12 -0
  43. package/src/modes/interactive-mode.ts +5 -10
  44. package/src/modes/rpc/rpc-mode.ts +5 -8
  45. package/src/modes/skill-command.ts +8 -20
  46. package/src/modes/types.ts +0 -1
  47. package/src/prompts/agents/tester.md +107 -0
  48. package/src/prompts/system/orchestrate-notice.md +2 -2
  49. package/src/prompts/system/system-prompt.md +2 -5
  50. package/src/prompts/system/thinking-loop-redirect.md +10 -0
  51. package/src/prompts/system/workflow-notice.md +1 -1
  52. package/src/prompts/tools/task.md +2 -9
  53. package/src/session/agent-session.ts +53 -18
  54. package/src/stt/asr-client.ts +87 -27
  55. package/src/stt/downloader.ts +8 -2
  56. package/src/stt/index.ts +1 -0
  57. package/src/stt/stt-controller.ts +31 -2
  58. package/src/stt/submit-trigger.ts +74 -0
  59. package/src/task/agents.ts +4 -4
  60. package/src/task/executor.ts +2 -4
  61. package/src/task/index.ts +32 -10
  62. package/src/task/types.ts +5 -5
  63. package/src/tiny/models.ts +10 -0
  64. package/src/tools/ast-grep.ts +34 -12
  65. package/src/tools/grep.ts +11 -8
  66. package/src/utils/git.ts +22 -1
  67. package/src/prompts/agents/oracle.md +0 -54
@@ -384,6 +384,83 @@ export function getSkillSlashCommandName(skill: Pick<Skill, "name">): string {
384
384
  return `skill:${skill.name}`;
385
385
  }
386
386
 
387
+ /**
388
+ * Parsed `/skill:<name>` invocation: either at the start of the draft (the
389
+ * traditional slash-command position) or as a `/skill:<name>` token embedded
390
+ * mid-prompt. For the mid-prompt form the surrounding prose is threaded
391
+ * through as `args` so the skill sees the full user request.
392
+ */
393
+ export interface ParsedSkillInvocation {
394
+ /** Bare skill name without the leading `skill:` prefix. */
395
+ name: string;
396
+ /** User-supplied arguments (everything outside the `/skill:<name>` token). */
397
+ args: string;
398
+ }
399
+
400
+ const MID_PROMPT_SKILL_RE = /(^|\s)\/skill:([^\s/]+)(\s|$)/;
401
+
402
+ /**
403
+ * Detect a `/skill:<name>` invocation in a user draft.
404
+ *
405
+ * Returns `undefined` when the text contains no skill token. Otherwise:
406
+ * - Leading form (`/skill:foo bar baz`): name=`foo`, args=`bar baz`.
407
+ * - Mid-prompt form (`fix the bug /skill:foo focus on auth`): name=`foo`,
408
+ * args=`fix the bug focus on auth` — the surrounding prose collapsed
409
+ * into a single args string.
410
+ *
411
+ * Mid-prompt detection is disabled when the draft itself starts with a
412
+ * different slash command (e.g. `/compact /skill:foo`) or a local-execution
413
+ * sigil — `!cmd` / `!!cmd` for the bash tool and `$ cmd` / `$$ cmd` for the
414
+ * python tool. Those handlers run after the skill-command dispatcher and
415
+ * their bodies routinely contain `/skill:<name>` references that are not
416
+ * meant as skill invocations.
417
+ */
418
+ export function parseSkillInvocation(text: string): ParsedSkillInvocation | undefined {
419
+ const trimmedStart = text.trimStart();
420
+ if (trimmedStart.startsWith("/skill:")) {
421
+ const spaceIndex = trimmedStart.indexOf(" ");
422
+ const name =
423
+ spaceIndex === -1 ? trimmedStart.slice("/skill:".length) : trimmedStart.slice("/skill:".length, spaceIndex);
424
+ if (!name) return undefined;
425
+ const args = spaceIndex === -1 ? "" : trimmedStart.slice(spaceIndex + 1).trim();
426
+ return { name, args };
427
+ }
428
+ if (trimmedStart.startsWith("/")) return undefined;
429
+ if (startsWithLocalExecutionPrefix(trimmedStart)) return undefined;
430
+ const match = MID_PROMPT_SKILL_RE.exec(text);
431
+ if (!match) return undefined;
432
+ const leading = match[1] ?? "";
433
+ const trailing = match[3] ?? "";
434
+ const tokenStart = match.index + leading.length;
435
+ const tokenEnd = match.index + match[0].length - trailing.length;
436
+ const name = match[2] ?? "";
437
+ if (!name) return undefined;
438
+ const before = text.slice(0, tokenStart).trimEnd();
439
+ const after = text.slice(tokenEnd).trimStart();
440
+ const args = [before, after]
441
+ .filter(part => part.length > 0)
442
+ .join(" ")
443
+ .trim();
444
+ return { name, args };
445
+ }
446
+
447
+ /**
448
+ * Whether the (already left-trimmed) draft begins with a TUI local-execution
449
+ * sigil that downstream branches will consume verbatim — `!`/`!!` for the bash
450
+ * tool and `$`/`$$` followed by ASCII whitespace for the python tool. Mirrors
451
+ * `pythonCommandPrefixLength` in `modes/controllers/input-controller` so the
452
+ * two checks agree without forcing a circular import.
453
+ */
454
+ function startsWithLocalExecutionPrefix(trimmedStart: string): boolean {
455
+ if (trimmedStart.startsWith("!")) return true;
456
+ if (trimmedStart.charCodeAt(0) !== 36 /* $ */) return false;
457
+ if (trimmedStart.charCodeAt(1) === 123 /* { */) return false;
458
+ const sigilLength = trimmedStart.charCodeAt(1) === 36 /* $ */ ? 2 : 1;
459
+ const next = trimmedStart.charCodeAt(sigilLength);
460
+ if (Number.isNaN(next)) return true;
461
+ return next === 32 /* space */ || next === 9 /* tab */ || next === 10 /* LF */ || next === 13 /* CR */;
462
+ }
463
+
387
464
  export async function buildSkillPromptMessage(
388
465
  skill: Pick<Skill, "name" | "filePath">,
389
466
  args: string,