@herbertgao/pi-extensions 2026.9.20 → 2026.10.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/README.md +18 -13
- package/THIRD_PARTY_NOTICES.md +31 -5
- package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-audit.md +1 -1
- package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-debt.md +1 -1
- package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-gain.md +1 -1
- package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-review.md +1 -1
- package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail.md +1 -1
- package/node_modules/@dietrichgebert/ponytail/.opencode/plugins/index.js +4 -0
- package/node_modules/@dietrichgebert/ponytail/.opencode/plugins/ponytail-frontmatter.cjs +43 -3
- package/node_modules/@dietrichgebert/ponytail/.opencode/plugins/ponytail.mjs +142 -59
- package/node_modules/@dietrichgebert/ponytail/.qoder-plugin/plugin.json +1 -1
- package/node_modules/@dietrichgebert/ponytail/README.es.md +87 -204
- package/node_modules/@dietrichgebert/ponytail/README.ja.md +212 -0
- package/node_modules/@dietrichgebert/ponytail/README.ko.md +92 -226
- package/node_modules/@dietrichgebert/ponytail/README.md +58 -244
- package/node_modules/@dietrichgebert/ponytail/README.zh-CN.md +212 -0
- package/node_modules/@dietrichgebert/ponytail/hooks/claude-codex-hooks.json +3 -3
- package/node_modules/@dietrichgebert/ponytail/hooks/copilot-hooks.json +4 -4
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-activate.js +63 -16
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-config.js +8 -7
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-mode-tracker.js +46 -23
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-runtime.js +39 -7
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-subagent.js +20 -3
- package/node_modules/@dietrichgebert/ponytail/hooks/qoder-hooks.json +3 -3
- package/node_modules/@dietrichgebert/ponytail/package.json +2 -2
- package/node_modules/@dietrichgebert/ponytail/pi-extension/index.js +47 -17
- package/node_modules/@dietrichgebert/ponytail/scripts/uninstall.js +21 -7
- package/node_modules/@dietrichgebert/ponytail/skills/plugin.json +5 -0
- package/node_modules/@dietrichgebert/ponytail/skills/ponytail-audit/SKILL.md +7 -2
- package/node_modules/@dietrichgebert/ponytail/skills/ponytail-debt/SKILL.md +1 -1
- package/node_modules/@dietrichgebert/ponytail/skills/ponytail-gain/SKILL.md +16 -14
- package/node_modules/@dietrichgebert/ponytail/skills/ponytail-help/SKILL.md +3 -3
- package/node_modules/@dietrichgebert/ponytail/skills/ponytail-review/SKILL.md +12 -7
- package/node_modules/@herbertgao/pi-bark/README.md +39 -3
- package/node_modules/@herbertgao/pi-bark/package.json +1 -1
- package/node_modules/@herbertgao/pi-bark/src/index.ts +275 -15
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +50 -50
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +7 -7
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +25 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +24 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/compact-thinking.ts +7 -4
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/footer.ts +47 -5
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/mcp-chip.ts +136 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +56 -11
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/default-mode.ts +36 -4
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/interaction.ts +11 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/codemode.ts +303 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-header.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-highlight.ts +36 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-presentation.ts +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-write-render.ts +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/index.ts +88 -34
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/line-width-safety.ts +6 -5
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/write-execution.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +31 -6
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/message-display.ts +3 -3
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/names.ts +3 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/result.ts +173 -36
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/ansi-text.ts +1 -0
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +6 -4
- package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +6 -0
- package/node_modules/@herbertgao/pi-subagents/package.json +1 -1
- package/node_modules/@herbertgao/pi-subagents/src/mention-clone.ts +3 -2
- package/node_modules/@herbertgao/sol-pi/CONTRIBUTING.md +22 -0
- package/node_modules/@herbertgao/sol-pi/README.md +36 -17
- package/node_modules/@herbertgao/sol-pi/THIRD_PARTY_NOTICES.md +10 -6
- package/node_modules/@herbertgao/sol-pi/agents-install.md +15 -12
- package/node_modules/@herbertgao/sol-pi/docs/compatibility.md +24 -8
- package/node_modules/@herbertgao/sol-pi/docs/configuration.md +2 -2
- package/node_modules/@herbertgao/sol-pi/docs/star-history.md +18 -0
- package/node_modules/@herbertgao/sol-pi/package.json +4 -2
- package/node_modules/@herbertgao/sol-pi/scripts/check-sol-pi-config.mjs +1 -1
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/config.ts +1 -1
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/action-fusion/file-queue.ts +23 -4
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/action-fusion/index.ts +32 -1
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/action-fusion/then-run.ts +3 -2
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/observation-pack/observation.ts +1 -1
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/economics.ts +27 -7
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/extension.ts +137 -41
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/index.ts +1 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/plan.ts +2 -1
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/projection.ts +58 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/state.ts +28 -6
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/tools.ts +2 -1
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/runtime-paths.ts +15 -2
- package/node_modules/@juicesharp/rpiv-ask-user-question/package.json +2 -2
- package/node_modules/@narumitw/pi-caffeinate/package.json +4 -4
- package/node_modules/@pi-plugins/fast-mode/README.md +7 -1
- package/node_modules/@pi-plugins/fast-mode/dist/index.d.mts.map +1 -1
- package/node_modules/@pi-plugins/fast-mode/dist/index.mjs +7 -1
- package/node_modules/@pi-plugins/fast-mode/dist/index.mjs.map +1 -1
- package/node_modules/@pi-plugins/fast-mode/package.json +5 -5
- package/node_modules/pi-antigravity/README.md +3 -0
- package/node_modules/pi-antigravity/package.json +8 -8
- package/node_modules/pi-antigravity/src/auth/oauth.ts +6 -3
- package/node_modules/pi-antigravity/src/index.ts +114 -110
- package/node_modules/pi-antigravity/src/stream/stream.ts +1 -1
- package/node_modules/pi-antigravity/src/utils/util.ts +18 -1
- package/node_modules/pi-multi-account/CHANGELOG.md +20 -0
- package/node_modules/pi-multi-account/README.md +46 -8
- package/node_modules/pi-multi-account/config-file-transaction.ts +42 -0
- package/node_modules/pi-multi-account/index.ts +255 -269
- package/node_modules/pi-multi-account/model-pins.ts +36 -0
- package/node_modules/pi-multi-account/package.json +9 -7
- package/node_modules/pi-multi-account/slot-proxy-auth.ts +12 -2
- package/node_modules/pi-multi-account/slot-proxy.ts +27 -5
- package/node_modules/pi-typesafe/README.md +1 -1
- package/node_modules/pi-typesafe/dist/backends.d.ts +15 -5
- package/node_modules/pi-typesafe/dist/backends.js +18 -0
- package/node_modules/pi-typesafe/dist/client.d.ts +4 -3
- package/node_modules/pi-typesafe/dist/client.js +22 -7
- package/node_modules/pi-typesafe/dist/index.d.ts +2 -2
- package/node_modules/pi-typesafe/dist/index.js +1 -1
- package/node_modules/pi-typesafe/dist/usage.d.ts +14 -4
- package/node_modules/pi-typesafe/dist/usage.js +147 -42
- package/node_modules/pi-typesafe/package.json +1 -1
- package/node_modules/pi-web-access/CHANGELOG.md +65 -0
- package/node_modules/pi-web-access/README.md +63 -14
- package/node_modules/pi-web-access/brave-rate-limit.ts +176 -0
- package/node_modules/pi-web-access/brave.ts +28 -11
- package/node_modules/pi-web-access/curator-page.ts +5 -1
- package/node_modules/pi-web-access/curator-server.ts +2 -0
- package/node_modules/pi-web-access/declared-web-links.ts +2 -2
- package/node_modules/pi-web-access/degoog.ts +323 -0
- package/node_modules/pi-web-access/dist/index.js +3647 -2740
- package/node_modules/pi-web-access/dist/mcp-cli.js +27443 -0
- package/node_modules/pi-web-access/exa.ts +5 -1
- package/node_modules/pi-web-access/extract.ts +41 -3
- package/node_modules/pi-web-access/firecrawl.ts +35 -4
- package/node_modules/pi-web-access/gemini-search.ts +36 -16
- package/node_modules/pi-web-access/gemini-web.ts +14 -9
- package/node_modules/pi-web-access/index.ts +164 -1207
- package/node_modules/pi-web-access/keenable.ts +221 -0
- package/node_modules/pi-web-access/mcp-cli.ts +40 -0
- package/node_modules/pi-web-access/mcp-server.ts +81 -0
- package/node_modules/pi-web-access/mcp-tool-definitions.ts +117 -0
- package/node_modules/pi-web-access/openai-search.ts +58 -11
- package/node_modules/pi-web-access/package.json +23 -5
- package/node_modules/pi-web-access/perplexity.ts +64 -56
- package/node_modules/pi-web-access/summary-review.ts +8 -2
- package/node_modules/pi-web-access/tool-arguments.ts +20 -0
- package/node_modules/pi-web-access/video-extract.ts +1 -1
- package/node_modules/pi-web-access/web-tool-contract.ts +86 -0
- package/node_modules/pi-web-access/web-tool-core.ts +1502 -0
- package/node_modules/pi-web-access/youtube-extract.ts +2 -5
- package/node_modules/{@herbertgao/resume-from → resume-from}/README.md +16 -12
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/adapter.d.ts +0 -5
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/adapter.js +2 -3
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/contract.d.ts +2 -2
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/reader.d.ts +3 -0
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/reader.js +27 -15
- package/node_modules/{@herbertgao/resume-from/dist/adapters/codex → resume-from/dist/adapters/claude-code}/redaction.js +16 -3
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/writer.d.ts +2 -4
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/writer.js +1 -1
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/contract.d.ts +2 -4
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/index.js +1 -2
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/read.d.ts +16 -0
- package/node_modules/resume-from/dist/adapters/codex/read.js +723 -0
- package/node_modules/{@herbertgao/resume-from/dist/adapters/pi → resume-from/dist/adapters/codex}/redaction.js +16 -3
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/rollout.d.ts +44 -4
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/rollout.js +88 -4
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/write.d.ts +2 -2
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/write.js +2 -2
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/contract.d.ts +5 -1
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/adapter.js +10 -6
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/contract.d.ts +2 -2
- package/node_modules/{@herbertgao/resume-from/dist/adapters/claude-code → resume-from/dist/adapters/pi}/redaction.js +16 -3
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/serialize.d.ts +2 -4
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/serialize.js +2 -2
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/render.d.ts +1 -1
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/render.js +4 -4
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/runner.js +2 -2
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/contract.d.ts +2 -2
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/command.js +31 -8
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/wiring.d.ts +1 -1
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/wiring.js +1 -2
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/confirmation.d.ts +4 -1
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/confirmation.js +2 -2
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/contract.d.ts +8 -6
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/contract.d.ts +10 -5
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/finder.d.ts +2 -1
- package/node_modules/resume-from/dist/import/discovery/finder.js +269 -0
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/contract.d.ts +3 -3
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/lander.js +3 -3
- package/node_modules/resume-from/dist/import/pipeline.d.ts +28 -0
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/pipeline.js +31 -11
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/builder.d.ts +2 -2
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/builder.js +9 -5
- package/node_modules/resume-from/dist/import/preview/warnings.d.ts +14 -0
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/warnings.js +26 -20
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/wiring.js +12 -2
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/repo/contract.d.ts +9 -3
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/repo/git.d.ts +4 -4
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/repo/git.js +7 -4
- package/node_modules/resume-from/dist/platform/repo/reader.d.ts +3 -0
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/repo/reader.js +60 -20
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/session/contract.d.ts +8 -1
- package/node_modules/{@herbertgao/resume-from → resume-from}/package.json +19 -32
- package/node_modules/{@herbertgao/resume-from → resume-from}/shims/pi/extensions/resume-from.js +2 -2
- package/package.json +21 -21
- package/node_modules/@dietrichgebert/ponytail/assets/benchmark-3model.svg +0 -21
- package/node_modules/@dietrichgebert/ponytail/assets/benchmark-agentic.svg +0 -62
- package/node_modules/@dietrichgebert/ponytail/assets/logo-dark.png +0 -0
- package/node_modules/@dietrichgebert/ponytail/assets/logo-dark.svg +0 -115
- package/node_modules/@dietrichgebert/ponytail/assets/logo-greenpt-dark.svg +0 -27
- package/node_modules/@dietrichgebert/ponytail/assets/logo-greenpt.svg +0 -27
- package/node_modules/@dietrichgebert/ponytail/assets/logo.png +0 -0
- package/node_modules/@dietrichgebert/ponytail/assets/retriever-icon.png +0 -0
- package/node_modules/@dietrichgebert/ponytail/assets/retriever-logo-dark.svg +0 -4
- package/node_modules/@dietrichgebert/ponytail/assets/retriever-logo-light.svg +0 -4
- package/node_modules/@dietrichgebert/ponytail/assets/social-preview.png +0 -0
- package/node_modules/@dietrichgebert/ponytail/assets/waitlist-banner-es.png +0 -0
- package/node_modules/@dietrichgebert/ponytail/assets/waitlist-banner-ko.png +0 -0
- package/node_modules/@dietrichgebert/ponytail/assets/waitlist-banner.png +0 -0
- package/node_modules/@herbertgao/resume-from/dist/adapters/codex/read.js +0 -270
- package/node_modules/@herbertgao/resume-from/dist/import/discovery/finder.js +0 -129
- package/node_modules/@herbertgao/resume-from/dist/import/pipeline.d.ts +0 -17
- package/node_modules/@herbertgao/resume-from/dist/import/preview/warnings.d.ts +0 -11
- package/node_modules/@herbertgao/resume-from/dist/platform/repo/reader.d.ts +0 -8
- /package/node_modules/{@herbertgao/resume-from → resume-from}/LICENSE +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/entries.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/entries.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/layout.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/layout.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/readback.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/readback.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/redaction.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/validation.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/validation.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/readback.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/readback.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/redaction.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/validation.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/validation.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/adapter.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/format.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/format.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/parse.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/parse.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/redaction.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/validate.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/validate.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/bin.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/bin.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/contract.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/agents.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/agents.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/args.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/args.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/contract.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/presentation.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/presentation.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/runner.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/entry.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/entry.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/command.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/contract.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/picker.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/picker.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/presentation.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/presentation.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/register.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/register.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/ui.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/ui.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/profile.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/profile.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/registry.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/registry.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/errors.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/errors.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/homes.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/homes.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/ordering.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/ordering.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/errors.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/errors.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/errors.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/errors.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/handover.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/handover.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/lander.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/marker.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/marker.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/contract.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/format.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/format.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/transfer/contract.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/transfer/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/transfer/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/transfer/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/transfer/rules.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/transfer/rules.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/wiring.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/contract.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/defaults.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/defaults.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/errors.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/errors.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/loader.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/loader.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/paths.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/paths.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/validate.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/validate.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/repo/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/repo/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/repo/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/store/contract.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/store/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/store/file-committer.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/store/file-committer.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/store/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/store/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/tokens/contract.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/tokens/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/tokens/estimator.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/tokens/estimator.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/tokens/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/tokens/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/session/contract.js +0 -0
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
"sessionStart": [
|
|
5
5
|
{
|
|
6
6
|
"type": "command",
|
|
7
|
-
"bash": "node \"
|
|
8
|
-
"powershell": "node \"
|
|
7
|
+
"bash": "node -e \"require(require('node:path').join(process.env.PLUGIN_ROOT.replaceAll(String.fromCharCode(92), '/'), 'hooks/ponytail-activate.js'))\" || exit 0",
|
|
8
|
+
"powershell": "if (Get-Command node -ErrorAction SilentlyContinue) { node -e \"require(require('node:path').join(process.env.PLUGIN_ROOT.replaceAll(String.fromCharCode(92), '/'), 'hooks/ponytail-activate.js'))\" }",
|
|
9
9
|
"timeoutSec": 5
|
|
10
10
|
}
|
|
11
11
|
],
|
|
12
12
|
"userPromptSubmitted": [
|
|
13
13
|
{
|
|
14
14
|
"type": "command",
|
|
15
|
-
"bash": "node \"
|
|
16
|
-
"powershell": "node \"
|
|
15
|
+
"bash": "node -e \"require(require('node:path').join(process.env.PLUGIN_ROOT.replaceAll(String.fromCharCode(92), '/'), 'hooks/ponytail-mode-tracker.js'))\" || exit 0",
|
|
16
|
+
"powershell": "if (Get-Command node -ErrorAction SilentlyContinue) { node -e \"require(require('node:path').join(process.env.PLUGIN_ROOT.replaceAll(String.fromCharCode(92), '/'), 'hooks/ponytail-mode-tracker.js'))\" }",
|
|
17
17
|
"timeoutSec": 5
|
|
18
18
|
}
|
|
19
19
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// ponytail — Claude Code SessionStart activation hook (also Codex, Copilot,
|
|
3
|
-
// Grok and Cursor sessionStart)
|
|
3
|
+
// Grok, CodeBuddy and Cursor sessionStart)
|
|
4
4
|
//
|
|
5
5
|
// Runs on every session start:
|
|
6
6
|
// 1. Writes flag file at $CLAUDE_CONFIG_DIR/.ponytail-active (defaults to ~/.claude; statusline reads this)
|
|
@@ -15,6 +15,7 @@ const {
|
|
|
15
15
|
clearMode,
|
|
16
16
|
cursorRuleNotice,
|
|
17
17
|
cursorRulePath,
|
|
18
|
+
isCodeBuddy,
|
|
18
19
|
isCodex,
|
|
19
20
|
isCopilot,
|
|
20
21
|
isCursor,
|
|
@@ -30,8 +31,6 @@ const mode = getDefaultMode();
|
|
|
30
31
|
// "off" mode — skip activation entirely, don't write flag or emit rules
|
|
31
32
|
if (mode === 'off') {
|
|
32
33
|
clearMode();
|
|
33
|
-
const hookOutput = (isCodex || isCopilot || isCursor) ? '' : 'OK';
|
|
34
|
-
writeHookOutput('SessionStart', 'off', hookOutput);
|
|
35
34
|
process.exit(0);
|
|
36
35
|
}
|
|
37
36
|
|
|
@@ -61,27 +60,75 @@ try {
|
|
|
61
60
|
let output = getPonytailInstructions(mode);
|
|
62
61
|
|
|
63
62
|
// 3. Detect missing statusline config — nudge Claude to help set it up
|
|
64
|
-
if (!isCodex && !isCopilot && !isCursor) try {
|
|
65
|
-
|
|
63
|
+
if (!isCodex && !isCopilot && !isCursor && !isCodeBuddy) try {
|
|
64
|
+
const isWindows = process.platform === 'win32';
|
|
65
|
+
let statusCommand = null;
|
|
66
66
|
if (fs.existsSync(settingsPath)) {
|
|
67
67
|
// Strip UTF-8 BOM some editors prepend on Windows (breaks JSON.parse)
|
|
68
68
|
const raw = fs.readFileSync(settingsPath, 'utf8').replace(/^\uFEFF/, '');
|
|
69
69
|
const settings = JSON.parse(raw);
|
|
70
70
|
if (settings.statusLine) {
|
|
71
|
-
|
|
71
|
+
statusCommand = String(settings.statusLine.command || '');
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
// A statusLine already set up before #1032 can still run a script from a
|
|
76
|
+
// plugin version that has since been deleted. Only absolute paths are checked,
|
|
77
|
+
// so ~ or $HOME forms are never mistaken for missing files.
|
|
78
|
+
const ref = statusCommand &&
|
|
79
|
+
statusCommand.match(/"([^"]*ponytail-statusline\.(?:sh|ps1))"|(\S*ponytail-statusline\.(?:sh|ps1))/);
|
|
80
|
+
const refPath = ref ? (ref[1] || ref[2]) : null;
|
|
81
|
+
// isShellSafe keeps quotes, newlines and shell metacharacters from
|
|
82
|
+
// settings.json out of the model context.
|
|
83
|
+
// On Windows only drive-letter or UNC paths count: a Git Bash path such as
|
|
84
|
+
// /c/Users/... is absolute to Node but does not resolve, so it would be
|
|
85
|
+
// flagged as broken while it works.
|
|
86
|
+
const checkable = refPath && isShellSafe(refPath) && path.isAbsolute(refPath) &&
|
|
87
|
+
(!isWindows || /^([A-Za-z]:[\\/]|\\\\)/.test(refPath));
|
|
88
|
+
const stalePath = checkable && !fs.existsSync(refPath) ? refPath : null;
|
|
89
|
+
|
|
90
|
+
// The plugin root is a versioned cache dir (.../ponytail/4.12.0/) that Claude
|
|
91
|
+
// Code deletes on update, so a statusLine pointing into it goes blank after the
|
|
92
|
+
// next update (#1032). Point it at a copy in the config dir instead. A statusLine
|
|
93
|
+
// that already runs ponytail keeps its script type, so its copy stays fresh.
|
|
94
|
+
const usePs1 = refPath ? refPath.endsWith('.ps1') : isWindows;
|
|
95
|
+
const scriptName = usePs1 ? 'ponytail-statusline.ps1' : 'ponytail-statusline.sh';
|
|
96
|
+
const scriptPath = path.join(claudeDir, scriptName);
|
|
97
|
+
|
|
75
98
|
// Nudge at most once — the flag file marks that the user has already seen
|
|
76
99
|
// (and implicitly declined) the statusline setup offer. Repeating it every
|
|
77
|
-
// session start turns a helpful hint into a nag.
|
|
100
|
+
// session start turns a helpful hint into a nag. A broken path is nudged once
|
|
101
|
+
// per path: the flag records it.
|
|
78
102
|
const nudgeFlagPath = path.join(claudeDir, '.ponytail-statusline-nudged');
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
103
|
+
let nudged = null;
|
|
104
|
+
try { nudged = fs.readFileSync(nudgeFlagPath, 'utf8'); } catch (e) { /* not nudged yet */ }
|
|
105
|
+
const nudge = stalePath ? nudged !== stalePath : statusCommand === null && nudged === null;
|
|
106
|
+
|
|
107
|
+
// Refresh the copy every session so script fixes ship with plugin updates.
|
|
108
|
+
// Copy to a new temp file, then rename: the rename replaces a symlink at
|
|
109
|
+
// scriptPath instead of writing through it, and a concurrent session never
|
|
110
|
+
// runs a half-written script.
|
|
111
|
+
if (nudge || fs.existsSync(scriptPath)) {
|
|
112
|
+
const tmpPath = scriptPath + '.' + process.pid + '.tmp';
|
|
113
|
+
try {
|
|
114
|
+
fs.copyFileSync(path.join(__dirname, scriptName), tmpPath, fs.constants.COPYFILE_EXCL);
|
|
115
|
+
fs.chmodSync(tmpPath, 0o644);
|
|
116
|
+
fs.renameSync(tmpPath, scriptPath);
|
|
117
|
+
} finally {
|
|
118
|
+
try { fs.unlinkSync(tmpPath); } catch (e) { /* renamed */ }
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (nudge) {
|
|
123
|
+
try { fs.writeFileSync(nudgeFlagPath, stalePath || ''); } catch (e) { /* best-effort */ }
|
|
124
|
+
if (stalePath) {
|
|
125
|
+
output += "\n\n" +
|
|
126
|
+
"STATUSLINE BROKEN: The statusLine in " + settingsPath + " runs " + stalePath +
|
|
127
|
+
", which no longer exists (the ponytail plugin was updated and its old version removed), " +
|
|
128
|
+
"so the ponytail badge is blank. Replace that path with " + scriptPath + ", which survives updates, " +
|
|
129
|
+
"quoting it for your shell. Keep the rest of the command. " +
|
|
130
|
+
"Proactively offer to fix this for the user on first interaction.";
|
|
131
|
+
} else if (isShellSafe(scriptPath)) {
|
|
85
132
|
const command = isWindows
|
|
86
133
|
? `powershell -ExecutionPolicy Bypass -File "${scriptPath}"`
|
|
87
134
|
: `bash "${scriptPath}"`;
|
|
@@ -94,13 +141,13 @@ if (!isCodex && !isCopilot && !isCursor) try {
|
|
|
94
141
|
statusLineSnippet + " " +
|
|
95
142
|
"Proactively offer to set this up for the user on first interaction.";
|
|
96
143
|
} else {
|
|
97
|
-
// ponytail:
|
|
144
|
+
// ponytail: config dir path has shell metacharacters; don't embed it in a
|
|
98
145
|
// command snippet; have the agent wire it up by hand instead.
|
|
99
146
|
output += "\n\n" +
|
|
100
147
|
"STATUSLINE SETUP NEEDED: The ponytail plugin includes a statusline badge showing active mode. " +
|
|
101
|
-
"Its
|
|
148
|
+
"Its path contains characters unsafe to embed in a shell command, so configure it manually: " +
|
|
102
149
|
"add a statusLine command of type \"command\" that runs " + scriptName +
|
|
103
|
-
" from
|
|
150
|
+
" from " + claudeDir + " to " + settingsPath + ", quoting/escaping the path for your shell. " +
|
|
104
151
|
"Proactively offer to set this up for the user on first interaction.";
|
|
105
152
|
}
|
|
106
153
|
}
|
|
@@ -75,12 +75,12 @@ function getClaudeDir() {
|
|
|
75
75
|
|
|
76
76
|
function getDefaultMode() {
|
|
77
77
|
// 1. Environment variable (highest priority)
|
|
78
|
-
const envMode = process.env.PONYTAIL_DEFAULT_MODE;
|
|
79
78
|
// ponytail: a default must be a runtime level (off/lite/full/ultra); review is
|
|
80
|
-
// a session-only mode, never a valid default (#377).
|
|
81
|
-
//
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
// a session-only mode, never a valid default (#377). Normalize here so values
|
|
80
|
+
// with whitespace or mixed casing still resolve correctly.
|
|
81
|
+
const envMode = normalizeMode(process.env.PONYTAIL_DEFAULT_MODE);
|
|
82
|
+
if (envMode) {
|
|
83
|
+
return envMode;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
// 2. Config file
|
|
@@ -88,8 +88,9 @@ function getDefaultMode() {
|
|
|
88
88
|
const configPath = getConfigPath();
|
|
89
89
|
// Strip UTF-8 BOM (common on Windows-saved files) so JSON.parse doesn't choke
|
|
90
90
|
const config = JSON.parse(fs.readFileSync(configPath, 'utf8').replace(/^\uFEFF/, ''));
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
const configMode = normalizeMode(config.defaultMode);
|
|
92
|
+
if (configMode) {
|
|
93
|
+
return configMode;
|
|
93
94
|
}
|
|
94
95
|
} catch (e) {
|
|
95
96
|
// Config file doesn't exist or is invalid — fall through
|
|
@@ -7,6 +7,7 @@ const {
|
|
|
7
7
|
clearMode,
|
|
8
8
|
cursorRuleNotice,
|
|
9
9
|
cursorRulePath,
|
|
10
|
+
isCodex,
|
|
10
11
|
isCursor,
|
|
11
12
|
isQoder,
|
|
12
13
|
readMode,
|
|
@@ -49,9 +50,10 @@ function finish() {
|
|
|
49
50
|
let mode = null;
|
|
50
51
|
let isReportOnly = false;
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
// /ponytail-review is a one-shot skill, not a session level (#736).
|
|
54
|
+
// Matching it here used to setMode('review'), which latched
|
|
55
|
+
// INDEPENDENT_MODES for the rest of the session.
|
|
56
|
+
if (cmd === '/ponytail' || cmd === '/ponytail:ponytail') {
|
|
55
57
|
// `/ponytail default <mode>` persists the default to config (survives
|
|
56
58
|
// restarts). Plain switches stay session-scoped ("sticks until session
|
|
57
59
|
// end"), so this is the only path that writes config. review is not a
|
|
@@ -69,19 +71,28 @@ function finish() {
|
|
|
69
71
|
else if (arg === 'ultra') mode = 'ultra';
|
|
70
72
|
else if (arg === 'off') mode = 'off';
|
|
71
73
|
else if (arg === '') {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
// Bare /ponytail switches ponytail on: off → the default level (full if
|
|
75
|
+
// the default is off too); already on → keep the level, report it (#639).
|
|
76
|
+
const live = readMode();
|
|
77
|
+
if (live && live !== 'off') {
|
|
78
|
+
isReportOnly = true;
|
|
79
|
+
mode = live;
|
|
80
|
+
} else {
|
|
81
|
+
mode = getDefaultMode() === 'off' ? 'full' : getDefaultMode();
|
|
82
|
+
}
|
|
76
83
|
}
|
|
77
84
|
}
|
|
78
85
|
|
|
79
86
|
if (isReportOnly) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
87
|
+
// On Qoder the ruleset block below already reports; a second write
|
|
88
|
+
// here would put two JSON objects on stdout.
|
|
89
|
+
if (!isQoder) {
|
|
90
|
+
writeHookOutput(
|
|
91
|
+
'UserPromptSubmit',
|
|
92
|
+
mode,
|
|
93
|
+
'PONYTAIL MODE ACTIVE — level: ' + mode,
|
|
94
|
+
);
|
|
95
|
+
}
|
|
85
96
|
} else if (mode && mode !== 'off') {
|
|
86
97
|
setMode(mode);
|
|
87
98
|
modeSwitched = true;
|
|
@@ -89,18 +100,21 @@ function finish() {
|
|
|
89
100
|
// switch happens we fold the confirmation into the ruleset output
|
|
90
101
|
// below (one JSON on stdout) instead of emitting two separate writes.
|
|
91
102
|
if (!isQoder) {
|
|
92
|
-
// Cursor
|
|
93
|
-
// for the new level,
|
|
94
|
-
//
|
|
103
|
+
// Cursor (#817) and Codex have no /ponytail command that would load
|
|
104
|
+
// the skill body for the new level, and the SessionStart ruleset is
|
|
105
|
+
// filtered to the start level, so the tracker delivers that level's
|
|
106
|
+
// ruleset along with the confirmation.
|
|
95
107
|
const header = 'PONYTAIL MODE CHANGED — level: ' + mode;
|
|
96
108
|
writeHookOutput(
|
|
97
109
|
'UserPromptSubmit',
|
|
98
110
|
mode,
|
|
99
|
-
isCursor ? header + '\n\n' + getPonytailInstructions(mode) : header,
|
|
111
|
+
(isCodex || isCursor) ? header + '\n\n' + getPonytailInstructions(mode) : header,
|
|
100
112
|
);
|
|
101
113
|
}
|
|
102
114
|
} else if (mode === 'off') {
|
|
103
|
-
|
|
115
|
+
if (isQoder) setMode('off');
|
|
116
|
+
else clearMode();
|
|
117
|
+
|
|
104
118
|
deactivated = true;
|
|
105
119
|
writeHookOutput('UserPromptSubmit', 'off', 'PONYTAIL MODE OFF');
|
|
106
120
|
}
|
|
@@ -108,7 +122,9 @@ function finish() {
|
|
|
108
122
|
|
|
109
123
|
// Detect deactivation
|
|
110
124
|
if (!modeSwitched && !deactivated && isDeactivationCommand(prompt)) {
|
|
111
|
-
|
|
125
|
+
if (isQoder) setMode('off');
|
|
126
|
+
else clearMode();
|
|
127
|
+
|
|
112
128
|
deactivated = true;
|
|
113
129
|
writeHookOutput('UserPromptSubmit', 'off', 'PONYTAIL MODE OFF');
|
|
114
130
|
}
|
|
@@ -142,14 +158,21 @@ function finish() {
|
|
|
142
158
|
}
|
|
143
159
|
|
|
144
160
|
process.stdin.on('data', chunk => { input += chunk; });
|
|
145
|
-
|
|
161
|
+
// Exit on 'end', not just finish(): the fallback timer below must stay ref'd
|
|
162
|
+
// (see #790) so it can actually fire when stdin is stuck, and a ref'd timer
|
|
163
|
+
// would otherwise keep the process alive for its full 1000ms on this normal
|
|
164
|
+
// fast path.
|
|
165
|
+
process.stdin.on('end', () => { finish(); process.exit(0); });
|
|
146
166
|
|
|
147
167
|
// Never hang the session. On Windows, Claude Code runs this hook through a
|
|
148
168
|
// PowerShell `if {}` wrapper that can swallow the piped prompt JSON, so stdin
|
|
149
169
|
// 'end' never fires and the hook blocks forever — freezing the session (#443).
|
|
150
170
|
// On error, or after a short fallback, process whatever arrived (recovering the
|
|
151
|
-
// mode if data came without EOF) and exit.
|
|
152
|
-
//
|
|
153
|
-
// never
|
|
171
|
+
// mode if data came without EOF) and exit. The fallback timer MUST stay ref'd:
|
|
172
|
+
// on Windows a stuck ref'd stdin handle keeps the event loop alive, and an
|
|
173
|
+
// unref'd timer competing with it is never scheduled — so the fallback was
|
|
174
|
+
// dead code in exactly the #443/#790 case it exists for, and the hook hung
|
|
175
|
+
// until Claude Code's external 5s watchdog killed it (#790). Mirrors the
|
|
176
|
+
// best-effort, never-block contract the other lifecycle hooks already follow.
|
|
154
177
|
process.stdin.on('error', () => { finish(); process.exit(0); });
|
|
155
|
-
setTimeout(() => { finish(); process.exit(0); }, 1000)
|
|
178
|
+
setTimeout(() => { finish(); process.exit(0); }, 1000);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const os = require('os');
|
|
4
|
+
const { createHash } = require('crypto');
|
|
4
5
|
const { getClaudeDir, getConfigDir } = require('./ponytail-config');
|
|
5
6
|
|
|
6
7
|
const STATE_FILE = '.ponytail-active';
|
|
@@ -20,13 +21,16 @@ const isCopilot = Boolean(process.env.COPILOT_PLUGIN_DATA) ||
|
|
|
20
21
|
isVsCodeCopilotRoot(process.env.CLAUDE_PLUGIN_ROOT);
|
|
21
22
|
const isCodex = !isCopilot && Boolean(process.env.PLUGIN_DATA);
|
|
22
23
|
const isQoder = !isCopilot && !isCodex && Boolean(process.env.QODER_SESSION_ID);
|
|
24
|
+
// CodeBuddy (#854) loads the Claude-format plugin and sets CLAUDE_PLUGIN_ROOT
|
|
25
|
+
// too, but adds CODEBUDDY_PLUGIN_ROOT only for its own plugin hook processes.
|
|
26
|
+
const isCodeBuddy = !isCopilot && !isCodex && !isQoder && Boolean(process.env.CODEBUDDY_PLUGIN_ROOT);
|
|
23
27
|
// Cursor (#817): CURSOR_VERSION is set only in the environment Cursor builds
|
|
24
28
|
// for hook processes (Cursor 3.20.17 assigns it in exactly one place, the hook
|
|
25
29
|
// env builder), so it never leaks into a Claude Code session running inside
|
|
26
30
|
// Cursor's terminal. Cursor also sets it when it runs a Claude-format plugin's
|
|
27
31
|
// hooks next to CLAUDE_PLUGIN_ROOT, and it needs Cursor-shaped JSON either
|
|
28
32
|
// way, so this check comes after the hosts with their own data dirs.
|
|
29
|
-
const isCursor = !isCopilot && !isCodex && !isQoder && Boolean(process.env.CURSOR_VERSION);
|
|
33
|
+
const isCursor = !isCopilot && !isCodex && !isQoder && !isCodeBuddy && Boolean(process.env.CURSOR_VERSION);
|
|
30
34
|
|
|
31
35
|
let stateDir = getClaudeDir();
|
|
32
36
|
if (isCodex) stateDir = process.env.PLUGIN_DATA;
|
|
@@ -34,23 +38,43 @@ if (isCodex) stateDir = process.env.PLUGIN_DATA;
|
|
|
34
38
|
// getClaudeDir() rather than building a path from undefined.
|
|
35
39
|
if (isCopilot) stateDir = process.env.COPILOT_PLUGIN_DATA || getClaudeDir();
|
|
36
40
|
if (isQoder) stateDir = path.join(os.homedir(), '.qoder');
|
|
41
|
+
if (isCodeBuddy) stateDir = process.env.CODEBUDDY_CONFIG_DIR || path.join(os.homedir(), '.codebuddy');
|
|
37
42
|
if (isCursor) stateDir = path.join(os.homedir(), '.cursor');
|
|
38
43
|
|
|
39
44
|
const statePath = path.join(stateDir, STATE_FILE);
|
|
40
45
|
|
|
46
|
+
// Claude Code hands every hook its project dir, so the live mode is kept per
|
|
47
|
+
// project and concurrent sessions in different repos stop overwriting each other
|
|
48
|
+
// (#662, #809). Hosts without it keep the single shared flag.
|
|
49
|
+
// ponytail: sessions in the SAME repo still share one mode, and the statusline
|
|
50
|
+
// scripts read the shared flag (last write wins); key by session_id if either matters.
|
|
51
|
+
const projectDir = (process.env.CLAUDE_PROJECT_DIR || '').trim();
|
|
52
|
+
// Replacing separators with '_' aliases e.g. /work/a/b and /work/a_b (#662).
|
|
53
|
+
// Do not read old sanitized keys: they cannot be assigned to one project safely.
|
|
54
|
+
const projectStatePath = projectDir
|
|
55
|
+
? path.join(stateDir, 'ponytail-modes',
|
|
56
|
+
createHash('sha256').update(path.normalize(projectDir)).digest('hex'))
|
|
57
|
+
: null;
|
|
58
|
+
|
|
59
|
+
// The shared flag is still written, for the statusline and project-less hosts.
|
|
41
60
|
function setMode(mode) {
|
|
42
|
-
|
|
43
|
-
|
|
61
|
+
for (const file of [projectStatePath, statePath]) {
|
|
62
|
+
if (!file) continue;
|
|
63
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
64
|
+
fs.writeFileSync(file, mode);
|
|
65
|
+
}
|
|
44
66
|
}
|
|
45
67
|
|
|
46
68
|
function clearMode() {
|
|
47
|
-
|
|
69
|
+
for (const file of [projectStatePath, statePath]) {
|
|
70
|
+
if (file) try { fs.unlinkSync(file); } catch (e) {}
|
|
71
|
+
}
|
|
48
72
|
}
|
|
49
73
|
|
|
50
74
|
// Live mode written by activate/mode-tracker. Absent flag = ponytail off.
|
|
51
75
|
function readMode() {
|
|
52
76
|
try {
|
|
53
|
-
return fs.readFileSync(statePath, 'utf8').trim() || null;
|
|
77
|
+
return fs.readFileSync(projectStatePath || statePath, 'utf8').trim() || null;
|
|
54
78
|
} catch (e) {
|
|
55
79
|
return null;
|
|
56
80
|
}
|
|
@@ -85,7 +109,13 @@ function writeHookOutput(event, mode, context = '') {
|
|
|
85
109
|
return;
|
|
86
110
|
}
|
|
87
111
|
if (isCodex) {
|
|
88
|
-
|
|
112
|
+
// No systemMessage: Codex maps it to a yellow `warning:` entry (and de-greens the
|
|
113
|
+
// completed-hook bullet), reading as an error every session (#605). The mode still
|
|
114
|
+
// shows via the additionalContext "hook context:" line — active level when on,
|
|
115
|
+
// "PONYTAIL MODE OFF" when off (that path passes context too).
|
|
116
|
+
// ponytail: if openai/codex#16933 lands and hides additionalContext, restore a
|
|
117
|
+
// non-warning mode signal here.
|
|
118
|
+
const output = {};
|
|
89
119
|
if (context) {
|
|
90
120
|
output.hookSpecificOutput = {
|
|
91
121
|
hookEventName: event,
|
|
@@ -95,9 +125,10 @@ function writeHookOutput(event, mode, context = '') {
|
|
|
95
125
|
process.stdout.write(JSON.stringify(output));
|
|
96
126
|
return;
|
|
97
127
|
}
|
|
98
|
-
if (isQoder) {
|
|
128
|
+
if (isQoder || isCodeBuddy) {
|
|
99
129
|
// Qoder: hookSpecificOutput JSON, same shape as Codex minus systemMessage.
|
|
100
130
|
// UserPromptSubmit additionalContext is injected into the Agent's conversation.
|
|
131
|
+
// CodeBuddy would take raw stdout too, but also echoes it into the chat.
|
|
101
132
|
const output = {};
|
|
102
133
|
if (context) {
|
|
103
134
|
output.hookSpecificOutput = {
|
|
@@ -134,6 +165,7 @@ module.exports = {
|
|
|
134
165
|
clearMode,
|
|
135
166
|
cursorRuleNotice,
|
|
136
167
|
cursorRulePath,
|
|
168
|
+
isCodeBuddy,
|
|
137
169
|
isCodex,
|
|
138
170
|
isCopilot,
|
|
139
171
|
isCursor,
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
const { getPonytailInstructions } = require('./ponytail-instructions');
|
|
14
14
|
const { readMode, writeHookOutput } = require('./ponytail-runtime');
|
|
15
|
+
const vm = require('vm');
|
|
15
16
|
|
|
16
17
|
const mode = readMode();
|
|
17
18
|
|
|
@@ -64,14 +65,30 @@ function finish() {
|
|
|
64
65
|
} catch (e) {
|
|
65
66
|
// Unparseable payload — fall through and inject to be safe.
|
|
66
67
|
}
|
|
67
|
-
|
|
68
|
+
// .test() is synchronous, so a backtracking-heavy matcher like (a+)+$ would
|
|
69
|
+
// block the event loop and the fallback timer below could never fire (#658).
|
|
70
|
+
// Run it under a vm timeout; a timeout fails open like every other doubt.
|
|
71
|
+
let matches = true;
|
|
72
|
+
try {
|
|
73
|
+
if (agentType) {
|
|
74
|
+
matches = vm.runInNewContext('re.test(s)', { re: matcherRe, s: agentType }, { timeout: 100 });
|
|
75
|
+
}
|
|
76
|
+
} catch (e) {
|
|
77
|
+
matches = true;
|
|
78
|
+
}
|
|
79
|
+
if (!matches) {
|
|
68
80
|
process.exit(0);
|
|
69
81
|
}
|
|
70
82
|
inject();
|
|
71
83
|
}
|
|
72
84
|
|
|
73
85
|
process.stdin.on('data', chunk => { input += chunk; });
|
|
74
|
-
|
|
86
|
+
// Exit on 'end' (not just finish()) so the ref'd fallback timer below can't
|
|
87
|
+
// add its full 1000ms to the normal fast path.
|
|
88
|
+
process.stdin.on('end', () => { finish(); process.exit(0); });
|
|
75
89
|
// Never block the session (#443): recover on stdin error or a short fallback.
|
|
90
|
+
// The fallback stays ref'd: on Windows a stuck ref'd stdin keeps the loop
|
|
91
|
+
// alive and an unref'd timer is never scheduled, so the hook hung to the
|
|
92
|
+
// external watchdog instead of exiting at 1s (#790).
|
|
76
93
|
process.stdin.on('error', () => { finish(); process.exit(0); });
|
|
77
|
-
setTimeout(() => { finish(); process.exit(0); }, 1000)
|
|
94
|
+
setTimeout(() => { finish(); process.exit(0); }, 1000);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"_comment": "
|
|
2
|
+
"_comment": "Loaded live by .qoder-plugin/plugin.json (\"hooks\": \"./hooks/qoder-hooks.json\"). Qoder expands ${QODER_PLUGIN_ROOT} (the plugin install root) at runtime; see https://docs.qoder.com/en/cli/plugins#writing-plugin-hooks.",
|
|
3
3
|
"hooks": {
|
|
4
4
|
"UserPromptSubmit": [
|
|
5
5
|
{
|
|
6
6
|
"hooks": [
|
|
7
7
|
{
|
|
8
8
|
"type": "command",
|
|
9
|
-
"command": "node
|
|
9
|
+
"command": "node \"${QODER_PLUGIN_ROOT}/hooks/ponytail-mode-tracker.js\""
|
|
10
10
|
}
|
|
11
11
|
]
|
|
12
12
|
}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"hooks": [
|
|
18
18
|
{
|
|
19
19
|
"type": "command",
|
|
20
|
-
"command": "node
|
|
20
|
+
"command": "node \"${QODER_PLUGIN_ROOT}/hooks/ponytail-subagent.js\""
|
|
21
21
|
}
|
|
22
22
|
]
|
|
23
23
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dietrichgebert/ponytail",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.13.0",
|
|
4
4
|
"description": "Lazy senior dev mode for AI agents. The best code is the code you never wrote.",
|
|
5
5
|
"keywords": ["opencode-plugin", "opencode", "ponytail", "pi-package", "pi", "skills", "qoder"],
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
".qoder/",
|
|
30
30
|
".qoder-plugin/",
|
|
31
31
|
"pi-extension/",
|
|
32
|
+
"!pi-extension/test/",
|
|
32
33
|
"scripts/uninstall.js",
|
|
33
34
|
"scripts/cursor-hooks.js",
|
|
34
|
-
"assets/",
|
|
35
35
|
"LICENSE"
|
|
36
36
|
],
|
|
37
37
|
"scripts": {
|
|
@@ -36,11 +36,13 @@ export function resolveSessionMode(entries, fallbackMode = DEFAULT_MODE) {
|
|
|
36
36
|
return fallback;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
export function parsePonytailCommand(text, defaultMode = DEFAULT_MODE) {
|
|
39
|
+
export function parsePonytailCommand(text, defaultMode = DEFAULT_MODE, currentMode = null) {
|
|
40
40
|
const fallback = normalizePersistedMode(defaultMode) || DEFAULT_MODE;
|
|
41
41
|
const normalizedText = String(text || "").trim().toLowerCase();
|
|
42
42
|
|
|
43
43
|
if (!normalizedText) {
|
|
44
|
+
// Bare /ponytail switches ponytail on, or reports the level when it already is (#639).
|
|
45
|
+
if (currentMode && currentMode !== "off") return { type: "status" };
|
|
44
46
|
return { type: "set-mode", mode: fallback === "off" ? "full" : fallback };
|
|
45
47
|
}
|
|
46
48
|
|
|
@@ -78,7 +80,7 @@ export default function ponytailExtension(pi) {
|
|
|
78
80
|
let theme;
|
|
79
81
|
try { theme = c.ui.theme; if (!theme?.fg) return; } catch { return; }
|
|
80
82
|
if (currentMode === "off") {
|
|
81
|
-
c.ui.setStatus("ponytail",
|
|
83
|
+
c.ui.setStatus("ponytail", undefined);
|
|
82
84
|
return;
|
|
83
85
|
}
|
|
84
86
|
const levelIcons = { lite: "🌿", full: "⚡", ultra: "🔥" };
|
|
@@ -102,19 +104,22 @@ export default function ponytailExtension(pi) {
|
|
|
102
104
|
const normalized = String(args || "").trim();
|
|
103
105
|
const message = normalized ? `${skillName} ${normalized}` : skillName;
|
|
104
106
|
|
|
107
|
+
// pi.sendUserMessage does not expand skill commands on its own, so without
|
|
108
|
+
// expandPromptTemplates the alias lands as the literal text
|
|
109
|
+
// "/skill:ponytail-review" and the skill body never reaches the agent.
|
|
105
110
|
if (ctx?.isIdle?.() === false) {
|
|
106
|
-
pi.sendUserMessage(message, { deliverAs: "followUp" });
|
|
111
|
+
pi.sendUserMessage(message, { expandPromptTemplates: true, deliverAs: "followUp" });
|
|
107
112
|
ctx?.ui?.notify?.(`${skillName} queued as follow-up.`, "info");
|
|
108
113
|
return;
|
|
109
114
|
}
|
|
110
115
|
|
|
111
|
-
pi.sendUserMessage(message);
|
|
116
|
+
pi.sendUserMessage(message, { expandPromptTemplates: true });
|
|
112
117
|
};
|
|
113
118
|
|
|
114
119
|
pi.registerCommand("ponytail", {
|
|
115
120
|
description: PONYTAIL_COMMAND_DESCRIPTION,
|
|
116
121
|
handler: async (args, ctx) => {
|
|
117
|
-
const parsed = parsePonytailCommand(args, configuredDefaultMode);
|
|
122
|
+
const parsed = parsePonytailCommand(args, configuredDefaultMode, currentMode);
|
|
118
123
|
|
|
119
124
|
if (parsed.type === "status") {
|
|
120
125
|
ctx?.ui?.notify?.(`Ponytail: current ${currentMode} • default ${configuredDefaultMode}`, "info");
|
|
@@ -148,49 +153,57 @@ export default function ponytailExtension(pi) {
|
|
|
148
153
|
|
|
149
154
|
pi.registerCommand("ponytail-review", {
|
|
150
155
|
description: "Run /skill:ponytail-review",
|
|
151
|
-
handler: (
|
|
156
|
+
handler: (args, ctx) => sendAlias("/skill:ponytail-review", args, ctx),
|
|
152
157
|
});
|
|
153
158
|
|
|
154
159
|
pi.registerCommand("ponytail-audit", {
|
|
155
160
|
description: "Run /skill:ponytail-audit",
|
|
156
|
-
handler: (
|
|
161
|
+
handler: (args, ctx) => sendAlias("/skill:ponytail-audit", args, ctx),
|
|
157
162
|
});
|
|
158
163
|
|
|
159
164
|
pi.registerCommand("ponytail-gain", {
|
|
160
165
|
description: "Run /skill:ponytail-gain",
|
|
161
|
-
handler: (
|
|
166
|
+
handler: (args, ctx) => sendAlias("/skill:ponytail-gain", args, ctx),
|
|
162
167
|
});
|
|
163
168
|
|
|
164
169
|
pi.registerCommand("ponytail-debt", {
|
|
165
170
|
description: "Run /skill:ponytail-debt",
|
|
166
|
-
handler: (
|
|
171
|
+
handler: (args, ctx) => sendAlias("/skill:ponytail-debt", args, ctx),
|
|
167
172
|
});
|
|
168
173
|
|
|
169
174
|
pi.registerCommand("ponytail-help", {
|
|
170
175
|
description: "Run /skill:ponytail-help",
|
|
171
|
-
handler: (
|
|
176
|
+
handler: (args, ctx) => sendAlias("/skill:ponytail-help", args, ctx),
|
|
172
177
|
});
|
|
173
178
|
|
|
174
|
-
pi.on("input", async (event) => {
|
|
179
|
+
pi.on("input", async (event, ctx) => {
|
|
175
180
|
if (event?.source === "extension") return;
|
|
176
181
|
|
|
177
182
|
const text = String(event?.text || "");
|
|
178
183
|
if (currentMode !== "off" && isDeactivationCommand(text)) {
|
|
179
|
-
setMode("off");
|
|
184
|
+
setMode("off", ctx);
|
|
180
185
|
}
|
|
181
186
|
});
|
|
182
187
|
|
|
183
|
-
|
|
188
|
+
const restoreSessionMode = (ctx) => {
|
|
184
189
|
const entries = ctx?.sessionManager?.getBranch?.() || ctx?.sessionManager?.getEntries?.() || [];
|
|
185
|
-
configuredDefaultMode = getDefaultMode();
|
|
186
|
-
hideStatus = getHideStatus();
|
|
187
190
|
currentMode = resolveSessionMode(entries, configuredDefaultMode);
|
|
188
191
|
syncStatus(ctx);
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
pi.on("session_start", async (_event, ctx) => {
|
|
195
|
+
configuredDefaultMode = getDefaultMode();
|
|
196
|
+
hideStatus = getHideStatus();
|
|
197
|
+
restoreSessionMode(ctx);
|
|
189
198
|
if (!getQuietStartup()) {
|
|
190
199
|
ctx?.ui?.notify?.(`Ponytail loaded: ${currentMode}`, "info");
|
|
191
200
|
}
|
|
192
201
|
});
|
|
193
202
|
|
|
203
|
+
pi.on("session_tree", async (_event, ctx) => {
|
|
204
|
+
restoreSessionMode(ctx);
|
|
205
|
+
});
|
|
206
|
+
|
|
194
207
|
pi.on("agent_start", async (_event, ctx) => {
|
|
195
208
|
isActive = true;
|
|
196
209
|
syncStatus(ctx);
|
|
@@ -202,10 +215,27 @@ export default function ponytailExtension(pi) {
|
|
|
202
215
|
});
|
|
203
216
|
|
|
204
217
|
pi.on("before_agent_start", async (event) => {
|
|
205
|
-
if (!currentMode || currentMode === "off")
|
|
218
|
+
if (!currentMode || currentMode === "off") {
|
|
219
|
+
// Clear a stale section when the mode is off so a previous turn does not linger (#953).
|
|
220
|
+
if (event?.systemPromptOptions?.sections) delete event.systemPromptOptions.sections.ponytail;
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
const instructions = getPonytailInstructions(currentMode);
|
|
224
|
+
// Prefer structured sections so Pi can keep the cached prefix when other
|
|
225
|
+
// extensions change their own section (#953). Fall back to replacement
|
|
226
|
+
// for older Pi versions without systemPromptOptions.sections.
|
|
227
|
+
const sections = event?.systemPromptOptions?.sections;
|
|
228
|
+
if (sections && typeof sections === "object") {
|
|
229
|
+
sections.ponytail = instructions;
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
// OMP passes the system prompt as an array of parts; keep it one (#776).
|
|
233
|
+
if (Array.isArray(event?.systemPrompt)) {
|
|
234
|
+
return { systemPrompt: [...event.systemPrompt, instructions] };
|
|
235
|
+
}
|
|
206
236
|
// Guard a null/undefined event or a missing systemPrompt: don't crash, and
|
|
207
237
|
// don't prepend the literal string "undefined" to the prompt (#439, #440).
|
|
208
238
|
const base = event?.systemPrompt ? `${event.systemPrompt}\n\n` : "";
|
|
209
|
-
return { systemPrompt: `${base}${
|
|
239
|
+
return { systemPrompt: `${base}${instructions}` };
|
|
210
240
|
});
|
|
211
241
|
}
|