@ashx-j/lunr 0.2.11 → 0.2.13
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/CHANGELOG.md +13 -0
- package/README.md +211 -236
- package/dist/builtin-extensions/ashxj-tui.d.ts +3 -0
- package/dist/builtin-extensions/ashxj-tui.d.ts.map +1 -1
- package/dist/builtin-extensions/ashxj-tui.js +28 -11
- package/dist/builtin-extensions/ashxj-tui.js.map +1 -1
- package/dist/builtin-extensions/index.d.ts.map +1 -1
- package/dist/builtin-extensions/index.js +0 -2
- package/dist/builtin-extensions/index.js.map +1 -1
- package/dist/builtin-extensions/lunr-cron.d.ts +1 -1
- package/dist/builtin-extensions/lunr-cron.d.ts.map +1 -1
- package/dist/builtin-extensions/lunr-cron.js +1 -1
- package/dist/builtin-extensions/lunr-cron.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/chain-validation.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/chain-validation.js +3 -3
- package/dist/builtin-extensions/pi-subagents/src/extension/chain-validation.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/doctor.d.ts +0 -2
- package/dist/builtin-extensions/pi-subagents/src/extension/doctor.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/doctor.js +1 -23
- package/dist/builtin-extensions/pi-subagents/src/extension/doctor.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.js +6 -7
- package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js +7 -14
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts +12 -9
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js +38 -34
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts +3 -3
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js +32 -47
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.d.ts +2 -2
- package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts +7 -10
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js +90 -109
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.d.ts +3 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.js +37 -50
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/run-status.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/run-status.js +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/run-status.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/scheduled-runs.d.ts +4 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/scheduled-runs.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/scheduled-runs.js +5 -5
- package/dist/builtin-extensions/pi-subagents/src/runs/background/scheduled-runs.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js +31 -13
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-clarify.d.ts +2 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-clarify.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-clarify.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts +4 -3
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js +48 -20
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.d.ts +2 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js +90 -64
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts +6 -8
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +262 -161
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.d.ts +2 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.js +24 -33
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts +25 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js +51 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/dynamic-fanout.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/dynamic-fanout.js +20 -3
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/dynamic-fanout.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.d.ts +4 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts +5 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js +9 -3
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js +2 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.d.ts +2 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.js +20 -17
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.d.ts +70 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js +153 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/settings.d.ts +13 -8
- package/dist/builtin-extensions/pi-subagents/src/shared/settings.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/settings.js +20 -51
- package/dist/builtin-extensions/pi-subagents/src/shared/settings.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts +80 -20
- package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/types.js +10 -2
- package/dist/builtin-extensions/pi-subagents/src/shared/types.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.d.ts +2 -2
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js +20 -32
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts +2 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js +23 -449
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts +2 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js +13 -11
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/runtime.d.ts +2 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/runtime.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/runtime.js +18 -17
- package/dist/builtin-extensions/pi-subagents/src/watchdog/runtime.js.map +1 -1
- package/dist/builtin-extensions/simple-pi-memory.d.ts +2 -2
- package/dist/builtin-extensions/simple-pi-memory.d.ts.map +1 -1
- package/dist/builtin-extensions/simple-pi-memory.js +41 -17
- package/dist/builtin-extensions/simple-pi-memory.js.map +1 -1
- package/dist/catalog/models.json +1 -1
- package/dist/catalog/providers/amazon-bedrock.json +1 -1
- package/dist/catalog/providers/azure-openai-responses.json +1 -1
- package/dist/catalog/providers/cloudflare-ai-gateway.json +1 -1
- package/dist/catalog/providers/cloudflare-workers-ai.json +1 -1
- package/dist/catalog/providers/fireworks.json +1 -1
- package/dist/catalog/providers/github-copilot.json +1 -1
- package/dist/catalog/providers/huggingface.json +1 -1
- package/dist/catalog/providers/minimax-cn.json +1 -1
- package/dist/catalog/providers/minimax.json +1 -1
- package/dist/catalog/providers/mistral.json +1 -1
- package/dist/catalog/providers/nvidia.json +1 -1
- package/dist/catalog/providers/openai.json +1 -1
- package/dist/catalog/providers/opencode-go.json +1 -1
- package/dist/catalog/providers/opencode.json +1 -1
- package/dist/catalog/providers/openrouter.json +1 -1
- package/dist/catalog/providers/qwen-cloud-cn.json +1 -1
- package/dist/catalog/providers/qwen-cloud.json +1 -1
- package/dist/catalog/providers/qwen-token-plan-cn.json +1 -1
- package/dist/catalog/providers/qwen-token-plan.json +1 -1
- package/dist/catalog/providers/together.json +1 -1
- package/dist/catalog/providers/vercel-ai-gateway.json +1 -1
- package/dist/catalog/providers/zai-coding-cn.json +1 -1
- package/dist/catalog/providers/zai.json +1 -1
- package/dist/catalog/publication.json +3 -3
- package/dist/core/agent-session.d.ts +7 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +34 -4
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/context-breakdown.d.ts +3 -1
- package/dist/core/context-breakdown.d.ts.map +1 -1
- package/dist/core/context-breakdown.js +5 -2
- package/dist/core/context-breakdown.js.map +1 -1
- package/dist/core/customize.d.ts +2 -0
- package/dist/core/customize.d.ts.map +1 -1
- package/dist/core/customize.js +6 -0
- package/dist/core/customize.js.map +1 -1
- package/dist/core/memory-cap.d.ts +4 -8
- package/dist/core/memory-cap.d.ts.map +1 -1
- package/dist/core/memory-cap.js +8 -8
- package/dist/core/memory-cap.js.map +1 -1
- package/dist/core/permissions.d.ts +2 -0
- package/dist/core/permissions.d.ts.map +1 -1
- package/dist/core/permissions.js +30 -14
- package/dist/core/permissions.js.map +1 -1
- package/dist/core/plan-mode.d.ts.map +1 -1
- package/dist/core/plan-mode.js +1 -9
- package/dist/core/plan-mode.js.map +1 -1
- package/dist/core/rollback.d.ts.map +1 -1
- package/dist/core/rollback.js +1 -1
- package/dist/core/rollback.js.map +1 -1
- package/dist/core/settings-manager.d.ts +16 -5
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +37 -10
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -5
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/subagent-permission-inherit.d.ts +34 -22
- package/dist/core/subagent-permission-inherit.d.ts.map +1 -1
- package/dist/core/subagent-permission-inherit.js +37 -80
- package/dist/core/subagent-permission-inherit.js.map +1 -1
- package/dist/core/swarm.d.ts.map +1 -1
- package/dist/core/swarm.js +13 -7
- package/dist/core/swarm.js.map +1 -1
- package/dist/core/system-prompt.d.ts +6 -4
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +38 -48
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/usage-adapters/openai-codex.d.ts +1 -1
- package/dist/core/usage-adapters/openai-codex.d.ts.map +1 -1
- package/dist/core/usage-adapters/openai-codex.js +22 -17
- package/dist/core/usage-adapters/openai-codex.js.map +1 -1
- package/dist/core/usage-service.d.ts +10 -1
- package/dist/core/usage-service.d.ts.map +1 -1
- package/dist/core/usage-service.js +17 -6
- package/dist/core/usage-service.js.map +1 -1
- package/dist/gateway/agent-bridge.d.ts.map +1 -1
- package/dist/gateway/agent-bridge.js +1 -4
- package/dist/gateway/agent-bridge.js.map +1 -1
- package/dist/gateway/cron.d.ts.map +1 -1
- package/dist/gateway/cron.js +1 -4
- package/dist/gateway/cron.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +0 -5
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts +2 -0
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +21 -0
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +7 -4
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +122 -162
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/usage-view.d.ts +1 -1
- package/dist/modes/interactive/components/usage-view.d.ts.map +1 -1
- package/dist/modes/interactive/components/usage-view.js +7 -4
- package/dist/modes/interactive/components/usage-view.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -2
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +55 -96
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/skill-tag-autocomplete.d.ts +13 -0
- package/dist/modes/interactive/skill-tag-autocomplete.d.ts.map +1 -0
- package/dist/modes/interactive/skill-tag-autocomplete.js +72 -0
- package/dist/modes/interactive/skill-tag-autocomplete.js.map +1 -0
- package/docs/compaction.md +23 -23
- package/docs/containerization.md +24 -24
- package/docs/custom-provider.md +18 -18
- package/docs/development.md +16 -15
- package/docs/docs.json +6 -2
- package/docs/extensions.md +82 -80
- package/docs/features.md +102 -0
- package/docs/index.md +25 -19
- package/docs/json.md +7 -7
- package/docs/keybindings.md +4 -4
- package/docs/models.md +2 -2
- package/docs/packages.md +38 -42
- package/docs/prompt-templates.md +4 -4
- package/docs/providers.md +22 -10
- package/docs/quickstart.md +81 -46
- package/docs/rpc.md +7 -13
- package/docs/sdk.md +43 -41
- package/docs/security.md +18 -18
- package/docs/session-format.md +9 -9
- package/docs/sessions.md +13 -12
- package/docs/settings.md +63 -24
- package/docs/shell-aliases.md +2 -2
- package/docs/skills.md +21 -11
- package/docs/terminal-setup.md +5 -5
- package/docs/termux.md +7 -7
- package/docs/themes.md +12 -14
- package/docs/tmux.md +4 -4
- package/docs/tui.md +23 -23
- package/docs/usage.md +112 -87
- package/docs/windows.md +10 -2
- package/examples/README.md +3 -1
- package/examples/extensions/README.md +6 -6
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/doom-overlay/README.md +2 -2
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/plan-mode/README.md +3 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/subagent/README.md +13 -11
- package/examples/extensions/todo.ts +2 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/sdk/README.md +9 -5
- package/package.json +6 -7
- package/dist/builtin-extensions/lunr-behavior.d.ts +0 -44
- package/dist/builtin-extensions/lunr-behavior.d.ts.map +0 -1
- package/dist/builtin-extensions/lunr-behavior.js +0 -213
- package/dist/builtin-extensions/lunr-behavior.js.map +0 -1
- package/dist/builtin-extensions/pi-subagents/agents/context-builder.md +0 -46
- package/dist/builtin-extensions/pi-subagents/agents/deep-researcher.md +0 -36
- package/dist/builtin-extensions/pi-subagents/agents/delegate.md +0 -12
- package/dist/builtin-extensions/pi-subagents/agents/oracle.md +0 -73
- package/dist/builtin-extensions/pi-subagents/agents/planner.md +0 -55
- package/dist/builtin-extensions/pi-subagents/agents/research-writer.md +0 -37
- package/dist/builtin-extensions/pi-subagents/agents/researcher.md +0 -52
- package/dist/builtin-extensions/pi-subagents/agents/reviewer.md +0 -79
- package/dist/builtin-extensions/pi-subagents/agents/scout.md +0 -50
- package/dist/builtin-extensions/pi-subagents/agents/worker.md +0 -55
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-management.d.ts +0 -20
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-management.d.ts.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-management.js +0 -1273
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-management.js.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-memory.d.ts +0 -49
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-memory.d.ts.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-memory.js +0 -252
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-memory.js.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-scope.d.ts +0 -3
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-scope.d.ts.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-scope.js +0 -6
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-scope.js.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-selection.d.ts +0 -3
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-selection.d.ts.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-selection.js +0 -23
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-selection.js.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-serializer.d.ts +0 -8
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-serializer.d.ts.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-serializer.js +0 -143
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-serializer.js.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agents.d.ts +0 -176
- package/dist/builtin-extensions/pi-subagents/src/agents/agents.d.ts.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agents.js +0 -1326
- package/dist/builtin-extensions/pi-subagents/src/agents/agents.js.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/chain-serializer.d.ts +0 -7
- package/dist/builtin-extensions/pi-subagents/src/agents/chain-serializer.d.ts.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/chain-serializer.js +0 -307
- package/dist/builtin-extensions/pi-subagents/src/agents/chain-serializer.js.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/identity.d.ts +0 -8
- package/dist/builtin-extensions/pi-subagents/src/agents/identity.d.ts.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/identity.js +0 -30
- package/dist/builtin-extensions/pi-subagents/src/agents/identity.js.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/proactive-skills.d.ts +0 -35
- package/dist/builtin-extensions/pi-subagents/src/agents/proactive-skills.d.ts.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/proactive-skills.js +0 -151
- package/dist/builtin-extensions/pi-subagents/src/agents/proactive-skills.js.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/profiles/profiles.d.ts +0 -131
- package/dist/builtin-extensions/pi-subagents/src/profiles/profiles.d.ts.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/profiles/profiles.js +0 -491
- package/dist/builtin-extensions/pi-subagents/src/profiles/profiles.js.map +0 -1
- package/dist/core/behavior-preset.d.ts +0 -60
- package/dist/core/behavior-preset.d.ts.map +0 -1
- package/dist/core/behavior-preset.js +0 -257
- package/dist/core/behavior-preset.js.map +0 -1
package/docs/extensions.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
>
|
|
1
|
+
> lunR can create extensions. Ask it to build one for your use case.
|
|
2
2
|
|
|
3
3
|
# Extensions
|
|
4
4
|
|
|
5
|
-
Extensions are TypeScript modules that extend
|
|
5
|
+
Extensions are TypeScript modules that extend lunR's behavior. They can subscribe to lifecycle events, register custom tools callable by the LLM, add commands, and more.
|
|
6
6
|
|
|
7
|
-
> **Placement for /reload:** Put extensions in `~/.
|
|
7
|
+
> **Placement for /reload:** Put extensions in `~/.lunr/agent/extensions/` (global) or `.lunr/extensions/` (project-local) for auto-discovery. Use `lunr -e ./path.ts` only for quick tests. Extensions in auto-discovered locations can be hot-reloaded with `/reload`.
|
|
8
8
|
|
|
9
9
|
**Key capabilities:**
|
|
10
10
|
- **Custom tools** - Register tools the LLM can call via `pi.registerTool()`
|
|
@@ -55,10 +55,10 @@ See [examples/extensions/](../examples/extensions/) for working implementations.
|
|
|
55
55
|
|
|
56
56
|
## Quick Start
|
|
57
57
|
|
|
58
|
-
Create `~/.
|
|
58
|
+
Create `~/.lunr/agent/extensions/my-extension.ts`:
|
|
59
59
|
|
|
60
60
|
```typescript
|
|
61
|
-
import type { ExtensionAPI } from "@
|
|
61
|
+
import type { ExtensionAPI } from "@ashx-j/lunr";
|
|
62
62
|
import { Type } from "typebox";
|
|
63
63
|
|
|
64
64
|
export default function (pi: ExtensionAPI) {
|
|
@@ -103,21 +103,21 @@ export default function (pi: ExtensionAPI) {
|
|
|
103
103
|
Test with `--extension` (or `-e`) flag:
|
|
104
104
|
|
|
105
105
|
```bash
|
|
106
|
-
|
|
106
|
+
lunr -e ./my-extension.ts
|
|
107
107
|
```
|
|
108
108
|
|
|
109
109
|
## Extension Locations
|
|
110
110
|
|
|
111
111
|
> **Security:** Extensions run with your full system permissions and can execute arbitrary code. Only install from sources you trust.
|
|
112
112
|
|
|
113
|
-
Extensions are auto-discovered from trusted locations. Project-local `.
|
|
113
|
+
Extensions are auto-discovered from trusted locations. Project-local `.lunr/extensions` entries load only after the project is trusted.
|
|
114
114
|
|
|
115
115
|
| Location | Scope |
|
|
116
116
|
|----------|-------|
|
|
117
|
-
| `~/.
|
|
118
|
-
| `~/.
|
|
119
|
-
| `.
|
|
120
|
-
| `.
|
|
117
|
+
| `~/.lunr/agent/extensions/*.ts` | Global (all projects) |
|
|
118
|
+
| `~/.lunr/agent/extensions/*/index.ts` | Global (subdirectory) |
|
|
119
|
+
| `.lunr/extensions/*.ts` | Project-local |
|
|
120
|
+
| `.lunr/extensions/*/index.ts` | Project-local (subdirectory) |
|
|
121
121
|
|
|
122
122
|
Additional paths via `settings.json`:
|
|
123
123
|
|
|
@@ -134,20 +134,22 @@ Additional paths via `settings.json`:
|
|
|
134
134
|
}
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
-
To share extensions via npm or git as
|
|
137
|
+
To share extensions via npm or git as packages, see [packages.md](packages.md).
|
|
138
138
|
|
|
139
139
|
## Available Imports
|
|
140
140
|
|
|
141
141
|
| Package | Purpose |
|
|
142
142
|
|---------|---------|
|
|
143
|
-
| `@
|
|
143
|
+
| `@ashx-j/lunr` | Extension types (`ExtensionAPI`, `ExtensionContext`, events) |
|
|
144
144
|
| `typebox` | Schema definitions for tool parameters |
|
|
145
|
-
| `@
|
|
146
|
-
| `@
|
|
145
|
+
| `@ashx-j/lunr-ai` | AI utilities (`StringEnum` for Google-compatible enums) |
|
|
146
|
+
| `@ashx-j/lunr-tui` | TUI components for custom rendering |
|
|
147
|
+
|
|
148
|
+
The factory argument is conventionally named `pi` (`export default function (pi: ExtensionAPI)`). Keep that. The jiti loader aliases both published names (`@ashx-j/lunr`, `@ashx-j/lunr-ai`, `@ashx-j/lunr-tui`, `@ashx-j/lunr-agent`) and workspace names (`@earendil-works/pi-coding-agent`, `@earendil-works/pi-ai`, `@earendil-works/pi-tui`, `@earendil-works/pi-agent-core`).
|
|
147
149
|
|
|
148
150
|
npm dependencies work too. Add a `package.json` next to your extension (or in a parent directory), run `npm install`, and imports from `node_modules/` are resolved automatically.
|
|
149
151
|
|
|
150
|
-
For distributed
|
|
152
|
+
For distributed packages installed with `lunr install` (npm or git), runtime deps must be in `dependencies`. Package installation uses production installs (`npm install --omit=dev`) by default, so `devDependencies` are not available at runtime; when `npmCommand` is configured, git packages use plain `install` for compatibility with wrappers.
|
|
151
153
|
|
|
152
154
|
Node.js built-ins (`node:fs`, `node:path`, etc.) are also available.
|
|
153
155
|
|
|
@@ -156,7 +158,7 @@ Node.js built-ins (`node:fs`, `node:path`, etc.) are also available.
|
|
|
156
158
|
An extension exports a default factory function that receives `ExtensionAPI`. The factory can be synchronous or asynchronous:
|
|
157
159
|
|
|
158
160
|
```typescript
|
|
159
|
-
import type { ExtensionAPI } from "@
|
|
161
|
+
import type { ExtensionAPI } from "@ashx-j/lunr";
|
|
160
162
|
|
|
161
163
|
export default function (pi: ExtensionAPI) {
|
|
162
164
|
// Subscribe to events
|
|
@@ -185,7 +187,7 @@ If the factory returns a `Promise`, pi awaits it before continuing startup. That
|
|
|
185
187
|
Use an async factory for one-time startup work such as fetching remote configuration or dynamically discovering available models.
|
|
186
188
|
|
|
187
189
|
```typescript
|
|
188
|
-
import type { ExtensionAPI } from "@
|
|
190
|
+
import type { ExtensionAPI } from "@ashx-j/lunr";
|
|
189
191
|
|
|
190
192
|
export default async function (pi: ExtensionAPI) {
|
|
191
193
|
const response = await fetch("http://localhost:1234/v1/models");
|
|
@@ -215,7 +217,7 @@ export default async function (pi: ExtensionAPI) {
|
|
|
215
217
|
}
|
|
216
218
|
```
|
|
217
219
|
|
|
218
|
-
This pattern makes the fetched models available during normal startup and to `
|
|
220
|
+
This pattern makes the fetched models available during normal startup and to `lunr --list-models`.
|
|
219
221
|
|
|
220
222
|
### Long-lived resources and shutdown
|
|
221
223
|
|
|
@@ -228,14 +230,14 @@ Defer background resource startup until `session_start` or the command/tool/even
|
|
|
228
230
|
**Single file** - simplest, for small extensions:
|
|
229
231
|
|
|
230
232
|
```
|
|
231
|
-
~/.
|
|
233
|
+
~/.lunr/agent/extensions/
|
|
232
234
|
└── my-extension.ts
|
|
233
235
|
```
|
|
234
236
|
|
|
235
237
|
**Directory with index.ts** - for multi-file extensions:
|
|
236
238
|
|
|
237
239
|
```
|
|
238
|
-
~/.
|
|
240
|
+
~/.lunr/agent/extensions/
|
|
239
241
|
└── my-extension/
|
|
240
242
|
├── index.ts # Entry point (exports default function)
|
|
241
243
|
├── tools.ts # Helper module
|
|
@@ -245,7 +247,7 @@ Defer background resource startup until `session_start` or the command/tool/even
|
|
|
245
247
|
**Package with dependencies** - for extensions that need npm packages:
|
|
246
248
|
|
|
247
249
|
```
|
|
248
|
-
~/.
|
|
250
|
+
~/.lunr/agent/extensions/
|
|
249
251
|
└── my-extension/
|
|
250
252
|
├── package.json # Declares dependencies and entry points
|
|
251
253
|
├── package-lock.json
|
|
@@ -275,7 +277,7 @@ Run `npm install` in the extension directory, then imports from `node_modules/`
|
|
|
275
277
|
### Lifecycle Overview
|
|
276
278
|
|
|
277
279
|
```
|
|
278
|
-
|
|
280
|
+
lunR starts
|
|
279
281
|
│
|
|
280
282
|
├─► project_trust (user/global and CLI extensions only, before project resources load)
|
|
281
283
|
├─► session_start { reason: "startup" }
|
|
@@ -351,7 +353,7 @@ exit (Ctrl+C, Ctrl+D, SIGHUP, SIGTERM)
|
|
|
351
353
|
|
|
352
354
|
#### project_trust
|
|
353
355
|
|
|
354
|
-
Fired before
|
|
356
|
+
Fired before lunR decides whether to trust a project with dynamic configs (`.lunr` or `.agents/skills`). It runs during startup and when session replacement (for example `/resume`) enters a cwd whose trust has not been resolved in the current process. Only user/global extensions and CLI `-e` extensions participate; project-local extensions are not loaded until after trust is resolved.
|
|
355
357
|
|
|
356
358
|
```typescript
|
|
357
359
|
pi.on("project_trust", async (event, ctx) => {
|
|
@@ -364,7 +366,7 @@ pi.on("project_trust", async (event, ctx) => {
|
|
|
364
366
|
});
|
|
365
367
|
```
|
|
366
368
|
|
|
367
|
-
A `project_trust` handler must return `{ trusted: "yes" | "no" | "undecided" }`. A user/global or CLI extension that returns `"yes"` or `"no"` owns the decision; the first yes/no decision wins and suppresses the built-in trust prompt. Use `remember: true` to persist a yes/no decision; otherwise it applies only to the current process. Return `"undecided"` to let later handlers or the built-in trust flow decide. Check `ctx.hasUI` before prompting. If no handler returns yes/no, normal trust resolution continues: saved `trust.json` decisions apply first, then `defaultProjectTrust` controls whether
|
|
369
|
+
A `project_trust` handler must return `{ trusted: "yes" | "no" | "undecided" }`. A user/global or CLI extension that returns `"yes"` or `"no"` owns the decision; the first yes/no decision wins and suppresses the built-in trust prompt. Use `remember: true` to persist a yes/no decision; otherwise it applies only to the current process. Return `"undecided"` to let later handlers or the built-in trust flow decide. Check `ctx.hasUI` before prompting. If no handler returns yes/no, normal trust resolution continues: saved `trust.json` decisions apply first, then `defaultProjectTrust` controls whether lunR asks, trusts, or declines by default.
|
|
368
370
|
|
|
369
371
|
### Resource Events
|
|
370
372
|
|
|
@@ -428,7 +430,7 @@ pi.on("session_before_switch", async (event, ctx) => {
|
|
|
428
430
|
});
|
|
429
431
|
```
|
|
430
432
|
|
|
431
|
-
After a successful switch or new-session action,
|
|
433
|
+
After a successful switch or new-session action, lunR emits `session_shutdown` for the old extension instance, reloads and rebinds extensions for the new session, then emits `session_start` with `reason: "new" | "resume"` and `previousSessionFile`.
|
|
432
434
|
Do cleanup work in `session_shutdown`, then reestablish any in-memory state in `session_start`.
|
|
433
435
|
|
|
434
436
|
#### session_before_fork
|
|
@@ -445,7 +447,7 @@ pi.on("session_before_fork", async (event, ctx) => {
|
|
|
445
447
|
});
|
|
446
448
|
```
|
|
447
449
|
|
|
448
|
-
After a successful fork or clone,
|
|
450
|
+
After a successful fork or clone, lunR emits `session_shutdown` for the old extension instance, reloads and rebinds extensions for the new session, then emits `session_start` with `reason: "fork"` and `previousSessionFile`.
|
|
449
451
|
Do cleanup work in `session_shutdown`, then reestablish any in-memory state in `session_start`.
|
|
450
452
|
|
|
451
453
|
#### session_before_compact / session_compact
|
|
@@ -544,13 +546,13 @@ pi.on("before_agent_start", async (event, ctx) => {
|
|
|
544
546
|
});
|
|
545
547
|
```
|
|
546
548
|
|
|
547
|
-
The `systemPromptOptions` field gives extensions access to the same structured data
|
|
549
|
+
The `systemPromptOptions` field gives extensions access to the same structured data lunR uses to build the system prompt. This lets you inspect what lunR has loaded — custom prompts, guidelines, tool snippets, context files, skills — without re-discovering resources or re-parsing flags. Use it when your extension needs to make deep, informed changes to the system prompt while respecting user-provided configuration.
|
|
548
550
|
|
|
549
551
|
Inside `before_agent_start`, `event.systemPrompt` and `ctx.getSystemPrompt()` both reflect the chained system prompt as of the current handler. Later `before_agent_start` handlers can still modify it again.
|
|
550
552
|
|
|
551
553
|
#### agent_start / agent_end / agent_settled
|
|
552
554
|
|
|
553
|
-
`agent_start` fires when a low-level agent run begins. `agent_end` fires when that run ends, but
|
|
555
|
+
`agent_start` fires when a low-level agent run begins. `agent_end` fires when that run ends, but lunR may still auto-retry, auto-compact and retry, or continue with queued follow-up messages. Use `agent_settled` for status integrations that need to know lunR will not continue running automatically.
|
|
554
556
|
|
|
555
557
|
```typescript
|
|
556
558
|
pi.on("agent_start", async (_event, ctx) => {});
|
|
@@ -672,7 +674,7 @@ Runs once per provider request; retries reuse the same headers rather than re-fi
|
|
|
672
674
|
|
|
673
675
|
Fired after the provider-specific payload is built, right before the request is sent. Handlers run in extension load order. Returning `undefined` keeps the payload unchanged. Returning any other value replaces the payload for later handlers and for the actual request.
|
|
674
676
|
|
|
675
|
-
This hook can rewrite provider-level system instructions or remove them entirely. Those payload-level changes are not reflected by `ctx.getSystemPrompt()`, which reports
|
|
677
|
+
This hook can rewrite provider-level system instructions or remove them entirely. Those payload-level changes are not reflected by `ctx.getSystemPrompt()`, which reports lunR's system prompt string rather than the final serialized provider payload.
|
|
676
678
|
|
|
677
679
|
```typescript
|
|
678
680
|
pi.on("before_provider_request", (event, ctx) => {
|
|
@@ -745,7 +747,7 @@ Use this to update extension UI when `pi.setThinkingLevel()`, model changes, or
|
|
|
745
747
|
|
|
746
748
|
Fired after `tool_execution_start`, before the tool executes. **Can block.** Use `isToolCallEventType` to narrow and get typed inputs.
|
|
747
749
|
|
|
748
|
-
Before `tool_call` runs,
|
|
750
|
+
Before `tool_call` runs, lunR waits for previously emitted Agent events to finish draining through `AgentSession`. This means `ctx.sessionManager` is up to date through the current assistant tool-calling message.
|
|
749
751
|
|
|
750
752
|
In the default parallel tool execution mode, sibling tool calls from the same assistant message are preflighted sequentially, then executed concurrently. `tool_call` is not guaranteed to see sibling tool results from that same assistant message in `ctx.sessionManager`.
|
|
751
753
|
|
|
@@ -758,7 +760,7 @@ Behavior guarantees:
|
|
|
758
760
|
- Return values from `tool_call` only control blocking via `{ block: true, reason?: string }`
|
|
759
761
|
|
|
760
762
|
```typescript
|
|
761
|
-
import { isToolCallEventType } from "@
|
|
763
|
+
import { isToolCallEventType } from "@ashx-j/lunr";
|
|
762
764
|
|
|
763
765
|
pi.on("tool_call", async (event, ctx) => {
|
|
764
766
|
// event.toolName - "bash", "read", "write", "edit", etc.
|
|
@@ -794,7 +796,7 @@ export type MyToolInput = Static<typeof myToolSchema>;
|
|
|
794
796
|
Use `isToolCallEventType` with explicit type parameters:
|
|
795
797
|
|
|
796
798
|
```typescript
|
|
797
|
-
import { isToolCallEventType } from "@
|
|
799
|
+
import { isToolCallEventType } from "@ashx-j/lunr";
|
|
798
800
|
import type { MyToolInput } from "my-extension";
|
|
799
801
|
|
|
800
802
|
pi.on("tool_call", (event) => {
|
|
@@ -818,7 +820,7 @@ In parallel tool mode, `tool_result` and `tool_execution_end` may interleave in
|
|
|
818
820
|
Use `ctx.signal` for nested async work inside the handler. This lets Esc cancel model calls, `fetch()`, and other abort-aware operations started by the extension.
|
|
819
821
|
|
|
820
822
|
```typescript
|
|
821
|
-
import { isBashToolResult } from "@
|
|
823
|
+
import { isBashToolResult } from "@ashx-j/lunr";
|
|
822
824
|
|
|
823
825
|
pi.on("tool_result", async (event, ctx) => {
|
|
824
826
|
// event.toolName, event.toolCallId, event.input
|
|
@@ -846,7 +848,7 @@ pi.on("tool_result", async (event, ctx) => {
|
|
|
846
848
|
Fired when user executes `!` or `!!` commands. **Can intercept.**
|
|
847
849
|
|
|
848
850
|
```typescript
|
|
849
|
-
import { createLocalBashOperations } from "@
|
|
851
|
+
import { createLocalBashOperations } from "@ashx-j/lunr";
|
|
850
852
|
|
|
851
853
|
pi.on("user_bash", (event, ctx) => {
|
|
852
854
|
// event.command - the bash command
|
|
@@ -856,7 +858,7 @@ pi.on("user_bash", (event, ctx) => {
|
|
|
856
858
|
// Option 1: Provide custom operations (e.g., SSH)
|
|
857
859
|
return { operations: remoteBashOps };
|
|
858
860
|
|
|
859
|
-
// Option 2: Wrap
|
|
861
|
+
// Option 2: Wrap lunR's built-in local bash backend
|
|
860
862
|
const local = createLocalBashOperations();
|
|
861
863
|
return {
|
|
862
864
|
operations: {
|
|
@@ -942,10 +944,10 @@ Current run mode: `"tui"`, `"rpc"`, `"json"`, or `"print"`. Use `ctx.mode === "t
|
|
|
942
944
|
|
|
943
945
|
Current working directory.
|
|
944
946
|
|
|
945
|
-
Use `CONFIG_DIR_NAME` instead of hardcoding `.
|
|
947
|
+
Use `CONFIG_DIR_NAME` instead of hardcoding `.lunr` when constructing project-local config paths. Rebranded distributions can use a different config directory name.
|
|
946
948
|
|
|
947
949
|
```typescript
|
|
948
|
-
import { CONFIG_DIR_NAME, type ExtensionAPI } from "@
|
|
950
|
+
import { CONFIG_DIR_NAME, type ExtensionAPI } from "@ashx-j/lunr";
|
|
949
951
|
import { join } from "node:path";
|
|
950
952
|
|
|
951
953
|
export default function (pi: ExtensionAPI) {
|
|
@@ -989,7 +991,7 @@ Use this for abort-aware nested work started by extension handlers, for example:
|
|
|
989
991
|
- file or process helpers that accept `AbortSignal`
|
|
990
992
|
|
|
991
993
|
`ctx.signal` is typically defined during active turn events such as `tool_call`, `tool_result`, `message_update`, and `turn_end`.
|
|
992
|
-
It is usually `undefined` in idle or non-turn contexts such as session events, extension commands, and shortcuts fired while
|
|
994
|
+
It is usually `undefined` in idle or non-turn contexts such as session events, extension commands, and shortcuts fired while lunR is idle.
|
|
993
995
|
|
|
994
996
|
```typescript
|
|
995
997
|
pi.on("tool_result", async (event, ctx) => {
|
|
@@ -1006,7 +1008,7 @@ pi.on("tool_result", async (event, ctx) => {
|
|
|
1006
1008
|
|
|
1007
1009
|
### ctx.isIdle() / ctx.abort() / ctx.hasPendingMessages()
|
|
1008
1010
|
|
|
1009
|
-
Control flow helpers. `ctx.isIdle()` is false while
|
|
1011
|
+
Control flow helpers. `ctx.isIdle()` is false while lunR is processing an agent run, automatic retry, auto-compaction retry, or queued continuation.
|
|
1010
1012
|
|
|
1011
1013
|
### ctx.shutdown()
|
|
1012
1014
|
|
|
@@ -1055,7 +1057,7 @@ ctx.compact({
|
|
|
1055
1057
|
|
|
1056
1058
|
### ctx.getSystemPrompt()
|
|
1057
1059
|
|
|
1058
|
-
Returns
|
|
1060
|
+
Returns lunR's current system prompt string.
|
|
1059
1061
|
|
|
1060
1062
|
- During `before_agent_start`, this reflects chained system-prompt changes made so far for the current turn.
|
|
1061
1063
|
- It does not include later `context` message mutations.
|
|
@@ -1075,7 +1077,7 @@ Command handlers receive `ExtensionCommandContext`, which extends `ExtensionCont
|
|
|
1075
1077
|
|
|
1076
1078
|
### ctx.getSystemPromptOptions()
|
|
1077
1079
|
|
|
1078
|
-
Returns the base inputs
|
|
1080
|
+
Returns the base inputs lunR currently uses to build the system prompt.
|
|
1079
1081
|
|
|
1080
1082
|
```typescript
|
|
1081
1083
|
const options = ctx.getSystemPromptOptions();
|
|
@@ -1198,7 +1200,7 @@ Options:
|
|
|
1198
1200
|
To discover available sessions, use the static `SessionManager.list()` or `SessionManager.listAll()` methods:
|
|
1199
1201
|
|
|
1200
1202
|
```typescript
|
|
1201
|
-
import { SessionManager } from "@
|
|
1203
|
+
import { SessionManager } from "@ashx-j/lunr";
|
|
1202
1204
|
|
|
1203
1205
|
pi.registerCommand("switch", {
|
|
1204
1206
|
description: "Switch to another session",
|
|
@@ -1292,7 +1294,7 @@ Tools run with `ExtensionContext`, so they cannot call `ctx.reload()` directly.
|
|
|
1292
1294
|
Example tool the LLM can call to trigger reload:
|
|
1293
1295
|
|
|
1294
1296
|
```typescript
|
|
1295
|
-
import type { ExtensionAPI } from "@
|
|
1297
|
+
import type { ExtensionAPI } from "@ashx-j/lunr";
|
|
1296
1298
|
import { Type } from "typebox";
|
|
1297
1299
|
|
|
1298
1300
|
export default function (pi: ExtensionAPI) {
|
|
@@ -1341,7 +1343,7 @@ See [dynamic-tools.ts](../examples/extensions/dynamic-tools.ts) for a full examp
|
|
|
1341
1343
|
|
|
1342
1344
|
```typescript
|
|
1343
1345
|
import { Type } from "typebox";
|
|
1344
|
-
import { StringEnum } from "@
|
|
1346
|
+
import { StringEnum } from "@ashx-j/lunr-ai";
|
|
1345
1347
|
|
|
1346
1348
|
pi.registerTool({
|
|
1347
1349
|
name: "my_tool",
|
|
@@ -1500,7 +1502,7 @@ pi.registerCommand("stats", {
|
|
|
1500
1502
|
Optional: add argument auto-completion for `/command ...`:
|
|
1501
1503
|
|
|
1502
1504
|
```typescript
|
|
1503
|
-
import type { AutocompleteItem } from "@
|
|
1505
|
+
import type { AutocompleteItem } from "@ashx-j/lunr-tui";
|
|
1504
1506
|
|
|
1505
1507
|
pi.registerCommand("deploy", {
|
|
1506
1508
|
description: "Deploy to an environment",
|
|
@@ -1558,7 +1560,7 @@ Register a custom TUI renderer for custom messages with your `customType`. Custo
|
|
|
1558
1560
|
Register a custom TUI renderer for custom entries with your `customType`. Custom entries are created with `pi.appendEntry()` and do not participate in LLM context.
|
|
1559
1561
|
|
|
1560
1562
|
```typescript
|
|
1561
|
-
import { Box, Text } from "@
|
|
1563
|
+
import { Box, Text } from "@ashx-j/lunr-tui";
|
|
1562
1564
|
|
|
1563
1565
|
pi.registerEntryRenderer("status-card", (entry, { expanded }, theme) => {
|
|
1564
1566
|
const data = entry.data as { title: string; count: number };
|
|
@@ -1677,7 +1679,7 @@ Register or override a model provider dynamically. Useful for proxies, custom en
|
|
|
1677
1679
|
|
|
1678
1680
|
Calls made during the extension factory function are queued and applied once the runner initialises. Calls made after that — for example from a command handler following a user setup flow — take effect immediately without requiring a `/reload`.
|
|
1679
1681
|
|
|
1680
|
-
Dynamic providers can implement `refreshModels`.
|
|
1682
|
+
Dynamic providers can implement `refreshModels`. lunR calls it during model refresh, publishes the returned list synchronously through the provider, and passes the canonical credential/store/network/signal context. The extension decides whether to persist the catalog through `context.store`; live servers such as llama.cpp can ignore it.
|
|
1681
1683
|
|
|
1682
1684
|
```typescript
|
|
1683
1685
|
// Register a new provider with custom models
|
|
@@ -1832,7 +1834,7 @@ Pass the real target file path to `withFileMutationQueue()`, not the raw user ar
|
|
|
1832
1834
|
Queue the entire mutation window on that target path. That includes read-modify-write logic, not just the final write.
|
|
1833
1835
|
|
|
1834
1836
|
```typescript
|
|
1835
|
-
import { withFileMutationQueue } from "@
|
|
1837
|
+
import { withFileMutationQueue } from "@ashx-j/lunr";
|
|
1836
1838
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
1837
1839
|
import { dirname, resolve } from "node:path";
|
|
1838
1840
|
|
|
@@ -1857,8 +1859,8 @@ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
|
1857
1859
|
|
|
1858
1860
|
```typescript
|
|
1859
1861
|
import { Type } from "typebox";
|
|
1860
|
-
import { StringEnum } from "@
|
|
1861
|
-
import { Text } from "@
|
|
1862
|
+
import { StringEnum } from "@ashx-j/lunr-ai";
|
|
1863
|
+
import { Text } from "@ashx-j/lunr-tui";
|
|
1862
1864
|
|
|
1863
1865
|
pi.registerTool({
|
|
1864
1866
|
name: "my_tool",
|
|
@@ -1926,7 +1928,7 @@ async execute(toolCallId, params) {
|
|
|
1926
1928
|
}
|
|
1927
1929
|
```
|
|
1928
1930
|
|
|
1929
|
-
**Important:** Use `StringEnum` from `@
|
|
1931
|
+
**Important:** Use `StringEnum` from `@ashx-j/lunr-ai` for string enums. `Type.Union`/`Type.Literal` doesn't work with Google's API.
|
|
1930
1932
|
|
|
1931
1933
|
**Argument preparation:** `prepareArguments(args)` is optional. If defined, it runs before schema validation and before `execute()`. Use it to mimic an older accepted input shape when pi resumes an older session whose stored tool call arguments no longer match the current schema. Return the object you want validated against `parameters`. Keep the public schema strict. Do not add deprecated compatibility fields to `parameters` just to keep old resumed sessions working.
|
|
1932
1934
|
|
|
@@ -1981,13 +1983,13 @@ Extensions can override built-in tools (`read`, `bash`, `edit`, `write`, `grep`,
|
|
|
1981
1983
|
|
|
1982
1984
|
```bash
|
|
1983
1985
|
# Extension's read tool replaces built-in read
|
|
1984
|
-
|
|
1986
|
+
lunr -e ./tool-override.ts
|
|
1985
1987
|
```
|
|
1986
1988
|
|
|
1987
1989
|
Alternatively, use `--no-builtin-tools` to start without any built-in tools while keeping extension tools enabled:
|
|
1988
1990
|
```bash
|
|
1989
1991
|
# No built-in tools, only extension tools
|
|
1990
|
-
|
|
1992
|
+
lunr --no-builtin-tools -e ./my-extension.ts
|
|
1991
1993
|
```
|
|
1992
1994
|
|
|
1993
1995
|
See [examples/extensions/tool-override.ts](../examples/extensions/tool-override.ts) for a complete example that overrides `read` with logging and access control.
|
|
@@ -1999,20 +2001,20 @@ See [examples/extensions/tool-override.ts](../examples/extensions/tool-override.
|
|
|
1999
2001
|
**Your implementation must match the exact result shape**, including the `details` type. The UI and session logic depend on these shapes for rendering and state tracking.
|
|
2000
2002
|
|
|
2001
2003
|
Built-in tool implementations:
|
|
2002
|
-
- [read.ts](https://github.com/
|
|
2003
|
-
- [bash.ts](https://github.com/
|
|
2004
|
-
- [edit.ts](https://github.com/
|
|
2005
|
-
- [write.ts](https://github.com/
|
|
2006
|
-
- [grep.ts](https://github.com/
|
|
2007
|
-
- [find.ts](https://github.com/
|
|
2008
|
-
- [ls.ts](https://github.com/
|
|
2004
|
+
- [read.ts](https://github.com/ashx-j/lunR/blob/master/packages/coding-agent/src/core/tools/read.ts) - `ReadToolDetails`
|
|
2005
|
+
- [bash.ts](https://github.com/ashx-j/lunR/blob/master/packages/coding-agent/src/core/tools/bash.ts) - `BashToolDetails`
|
|
2006
|
+
- [edit.ts](https://github.com/ashx-j/lunR/blob/master/packages/coding-agent/src/core/tools/edit.ts)
|
|
2007
|
+
- [write.ts](https://github.com/ashx-j/lunR/blob/master/packages/coding-agent/src/core/tools/write.ts)
|
|
2008
|
+
- [grep.ts](https://github.com/ashx-j/lunR/blob/master/packages/coding-agent/src/core/tools/grep.ts) - `GrepToolDetails`
|
|
2009
|
+
- [find.ts](https://github.com/ashx-j/lunR/blob/master/packages/coding-agent/src/core/tools/find.ts) - `FindToolDetails`
|
|
2010
|
+
- [ls.ts](https://github.com/ashx-j/lunR/blob/master/packages/coding-agent/src/core/tools/ls.ts) - `LsToolDetails`
|
|
2009
2011
|
|
|
2010
2012
|
### Remote Execution
|
|
2011
2013
|
|
|
2012
2014
|
Built-in tools support pluggable operations for delegating to remote systems (SSH, containers, etc.):
|
|
2013
2015
|
|
|
2014
2016
|
```typescript
|
|
2015
|
-
import { createReadTool, createBashTool, type ReadOperations } from "@
|
|
2017
|
+
import { createReadTool, createBashTool, type ReadOperations } from "@ashx-j/lunr";
|
|
2016
2018
|
|
|
2017
2019
|
// Create tool with custom operations
|
|
2018
2020
|
const remoteRead = createReadTool(cwd, {
|
|
@@ -2038,12 +2040,12 @@ pi.registerTool({
|
|
|
2038
2040
|
|
|
2039
2041
|
**Operations interfaces:** `ReadOperations`, `WriteOperations`, `EditOperations`, `BashOperations`, `LsOperations`, `GrepOperations`, `FindOperations`
|
|
2040
2042
|
|
|
2041
|
-
For `user_bash`, extensions can reuse
|
|
2043
|
+
For `user_bash`, extensions can reuse lunR's local shell backend via `createLocalBashOperations()` instead of reimplementing local process spawning, shell resolution, and process-tree termination.
|
|
2042
2044
|
|
|
2043
2045
|
The bash tool also supports a spawn hook to adjust the command, cwd, or env before execution:
|
|
2044
2046
|
|
|
2045
2047
|
```typescript
|
|
2046
|
-
import { createBashTool } from "@
|
|
2048
|
+
import { createBashTool } from "@ashx-j/lunr";
|
|
2047
2049
|
|
|
2048
2050
|
const bashTool = createBashTool(cwd, {
|
|
2049
2051
|
spawnHook: ({ command, cwd, env }) => ({
|
|
@@ -2073,7 +2075,7 @@ import {
|
|
|
2073
2075
|
formatSize, // Human-readable size (e.g., "50KB", "1.5MB")
|
|
2074
2076
|
DEFAULT_MAX_BYTES, // 50KB
|
|
2075
2077
|
DEFAULT_MAX_LINES, // 2000
|
|
2076
|
-
} from "@
|
|
2078
|
+
} from "@ashx-j/lunr";
|
|
2077
2079
|
|
|
2078
2080
|
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
2079
2081
|
const output = await runCommand();
|
|
@@ -2128,7 +2130,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
2128
2130
|
|
|
2129
2131
|
### Custom Rendering
|
|
2130
2132
|
|
|
2131
|
-
Tools can provide `renderCall` and `renderResult` for custom TUI display. See [tui.md](tui.md) for the full component API and [tool-execution.ts](https://github.com/
|
|
2133
|
+
Tools can provide `renderCall` and `renderResult` for custom TUI display. See [tui.md](tui.md) for the full component API and [tool-execution.ts](https://github.com/ashx-j/lunR/blob/master/packages/coding-agent/src/modes/interactive/components/tool-execution.ts) for how tool rows are composed.
|
|
2132
2134
|
|
|
2133
2135
|
By default, tool output is wrapped in a `Box` that handles padding and background. A defined `renderCall` or `renderResult` must return a `Component`. If a slot renderer is not defined, `tool-execution.ts` uses fallback rendering for that slot.
|
|
2134
2136
|
|
|
@@ -2164,7 +2166,7 @@ Use `context.state` for cross-slot shared state. Keep slot-local caches on the r
|
|
|
2164
2166
|
Renders the tool call or header:
|
|
2165
2167
|
|
|
2166
2168
|
```typescript
|
|
2167
|
-
import { Text } from "@
|
|
2169
|
+
import { Text } from "@ashx-j/lunr-tui";
|
|
2168
2170
|
|
|
2169
2171
|
renderCall(args, theme, context) {
|
|
2170
2172
|
const text = (context.lastComponent as Text | undefined) ?? new Text("", 0, 0);
|
|
@@ -2209,7 +2211,7 @@ If a slot intentionally has no visible content, return an empty `Component` such
|
|
|
2209
2211
|
Use `keyHint()` to display keybinding hints that respect the active keybinding configuration:
|
|
2210
2212
|
|
|
2211
2213
|
```typescript
|
|
2212
|
-
import { keyHint } from "@
|
|
2214
|
+
import { keyHint } from "@ashx-j/lunr";
|
|
2213
2215
|
|
|
2214
2216
|
renderResult(result, { expanded }, theme, context) {
|
|
2215
2217
|
let text = theme.fg("success", "✓ Done");
|
|
@@ -2253,7 +2255,7 @@ If a slot renderer is not defined or throws:
|
|
|
2253
2255
|
|
|
2254
2256
|
### Dynamic Tool Loading
|
|
2255
2257
|
|
|
2256
|
-
Extensions can register many tools while keeping only a small initial set active. A tool can then add more tools with `pi.setActiveTools()` during execution.
|
|
2258
|
+
Extensions can register many tools while keeping only a small initial set active. A tool can then add more tools with `pi.setActiveTools()` during execution. lunR detects purely additive changes, records the newly available tool names on that tool result, and applies the updated active set before the next model request.
|
|
2257
2259
|
|
|
2258
2260
|
This works with every model. Models with native deferred-loading support preserve the stable prompt prefix and load the new definitions at the tool-result position. Other models use the fallback described below.
|
|
2259
2261
|
|
|
@@ -2262,8 +2264,8 @@ The lifecycle is:
|
|
|
2262
2264
|
1. Register every tool with `pi.registerTool()` so it appears in `pi.getAllTools()`.
|
|
2263
2265
|
2. Keep loader tools, such as `search_tools`, active and leave searchable tools inactive.
|
|
2264
2266
|
3. During loader execution, call `pi.setActiveTools([...currentTools, ...matchingTools])`. The change must be additive: do not remove currently active tools in the same call.
|
|
2265
|
-
4.
|
|
2266
|
-
5. Before the next model response,
|
|
2267
|
+
4. lunR records which tools were added on the loader's tool result.
|
|
2268
|
+
5. Before the next model response, lunR exposes the added definitions using native deferred loading when supported, or the normal active tool list otherwise.
|
|
2267
2269
|
|
|
2268
2270
|
You do not need to return provider-specific tool references or mark the loader as a special search tool. The active-tool change is the signal. Names passed to `pi.setActiveTools()` must already be registered; unknown names are ignored.
|
|
2269
2271
|
|
|
@@ -2274,15 +2276,15 @@ You do not need to return provider-specific tool references or mark the loader a
|
|
|
2274
2276
|
- **Native representation:** Deferred definitions use `defer_loading`; the load point uses `tool_reference` content.
|
|
2275
2277
|
- **OpenAI**
|
|
2276
2278
|
- **Models:** `gpt-5.4` and newer family
|
|
2277
|
-
- **Native representation:**
|
|
2279
|
+
- **Native representation:** lunR adds completed client `tool_search_call` and `tool_search_output` items at the load point.
|
|
2278
2280
|
|
|
2279
2281
|
For a verified custom model or proxy, native handling can be enabled with `compat.supportsToolReferences: true` for `anthropic-messages`, or `compat.supportsToolSearch: true` for `openai-responses` and `openai-codex-responses`. Leave these disabled unless the endpoint and model accept the corresponding native protocol.
|
|
2280
2282
|
|
|
2281
2283
|
#### Fallback behavior
|
|
2282
2284
|
|
|
2283
|
-
For all other models and providers, dynamic activation still works:
|
|
2285
|
+
For all other models and providers, dynamic activation still works: lunR sends the complete current active tool list normally on the next request. The model can call the newly activated tools, but adding their definitions may invalidate the provider's cached prompt prefix.
|
|
2284
2286
|
|
|
2285
|
-
|
|
2287
|
+
lunR also uses this safe fallback when the active set is not purely additive, such as replacing one group of tools with another. Tool removals therefore work, but they do not use deferred loading.
|
|
2286
2288
|
|
|
2287
2289
|
For the best cache behavior, keep the loader tool active for the whole session and add tools instead of replacing the active set. Also note that activating a tool with `promptSnippet` or `promptGuidelines` rebuilds the system prompt; that system-prompt change can invalidate the prefix even when the provider supports deferred schemas. Lazily loaded tools should usually rely on their tool `description` and omit active-only prompt metadata.
|
|
2288
2290
|
|
|
@@ -2291,7 +2293,7 @@ For the best cache behavior, keep the loader tool active for the whole session a
|
|
|
2291
2293
|
The following extension registers two searchable tools, removes them from the initial active set, and keeps only `search_tools` as their loader. The example uses simple keyword matching, but the search implementation could use BM25, embeddings, a remote catalog, or project-specific routing.
|
|
2292
2294
|
|
|
2293
2295
|
```typescript
|
|
2294
|
-
import type { ExtensionAPI } from "@
|
|
2296
|
+
import type { ExtensionAPI } from "@ashx-j/lunr";
|
|
2295
2297
|
import { Type } from "typebox";
|
|
2296
2298
|
|
|
2297
2299
|
const SEARCHABLE_TOOL_NAMES = new Set(["lookup_weather", "search_issues"]);
|
|
@@ -2622,7 +2624,7 @@ See [github-issue-autocomplete.ts](../examples/extensions/github-issue-autocompl
|
|
|
2622
2624
|
For complex UI, use `ctx.ui.custom()`. This temporarily replaces the editor with your component until `done()` is called:
|
|
2623
2625
|
|
|
2624
2626
|
```typescript
|
|
2625
|
-
import { Text, Component } from "@
|
|
2627
|
+
import { Text, Component } from "@ashx-j/lunr-tui";
|
|
2626
2628
|
|
|
2627
2629
|
const result = await ctx.ui.custom<boolean>((tui, theme, keybindings, done) => {
|
|
2628
2630
|
const text = new Text("Press Enter to confirm, Escape to cancel", 1, 1);
|
|
@@ -2687,8 +2689,8 @@ See [tui.md](tui.md) for the full `OverlayOptions` and `OverlayHandle` API and [
|
|
|
2687
2689
|
Replace the main input editor with a custom implementation (vim mode, emacs mode, etc.):
|
|
2688
2690
|
|
|
2689
2691
|
```typescript
|
|
2690
|
-
import { CustomEditor, type ExtensionAPI } from "@
|
|
2691
|
-
import { matchesKey } from "@
|
|
2692
|
+
import { CustomEditor, type ExtensionAPI } from "@ashx-j/lunr";
|
|
2693
|
+
import { matchesKey } from "@ashx-j/lunr-tui";
|
|
2692
2694
|
|
|
2693
2695
|
class VimEditor extends CustomEditor {
|
|
2694
2696
|
private mode: "normal" | "insert" = "insert";
|
|
@@ -2738,7 +2740,7 @@ See [tui.md](tui.md) Pattern 7 for a complete example with mode indicator.
|
|
|
2738
2740
|
Register a custom renderer for messages with your `customType`. Use message renderers for content that should participate in LLM context:
|
|
2739
2741
|
|
|
2740
2742
|
```typescript
|
|
2741
|
-
import { Text } from "@
|
|
2743
|
+
import { Text } from "@ashx-j/lunr-tui";
|
|
2742
2744
|
|
|
2743
2745
|
pi.registerMessageRenderer("my-extension", (message, options, theme) => {
|
|
2744
2746
|
const { expanded } = options;
|
|
@@ -2797,7 +2799,7 @@ theme.strikethrough(text)
|
|
|
2797
2799
|
For syntax highlighting in custom tool renderers:
|
|
2798
2800
|
|
|
2799
2801
|
```typescript
|
|
2800
|
-
import { highlightCode, getLanguageFromPath } from "@
|
|
2802
|
+
import { highlightCode, getLanguageFromPath } from "@ashx-j/lunr";
|
|
2801
2803
|
|
|
2802
2804
|
// Highlight code with explicit language
|
|
2803
2805
|
const highlighted = highlightCode("const x = 1;", "typescript", theme);
|