@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
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type AutocompleteProvider } from "@ashx-j/lunr-tui";
|
|
2
|
+
import type { SkillTagCharacter } from "../../core/settings-manager.ts";
|
|
3
|
+
export interface SkillTagAutocompleteSkill {
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface WrapSkillTagAutocompleteOptions {
|
|
8
|
+
character: SkillTagCharacter;
|
|
9
|
+
skills: readonly SkillTagAutocompleteSkill[];
|
|
10
|
+
}
|
|
11
|
+
export declare function extractSkillTagPrefix(textBeforeCursor: string, character: SkillTagCharacter): string | null;
|
|
12
|
+
export declare function wrapSkillTagAutocomplete(inner: AutocompleteProvider, options: WrapSkillTagAutocompleteOptions): AutocompleteProvider;
|
|
13
|
+
//# sourceMappingURL=skill-tag-autocomplete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-tag-autocomplete.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/skill-tag-autocomplete.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,oBAAoB,EAGzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAExE,MAAM,WAAW,yBAAyB;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,+BAA+B;IAC/C,SAAS,EAAE,iBAAiB,CAAC;IAC7B,MAAM,EAAE,SAAS,yBAAyB,EAAE,CAAC;CAC7C;AAED,wBAAgB,qBAAqB,CAAC,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAsB3G;AAED,wBAAgB,wBAAwB,CACvC,KAAK,EAAE,oBAAoB,EAC3B,OAAO,EAAE,+BAA+B,GACtC,oBAAoB,CAoDtB","sourcesContent":["import {\n\ttype AutocompleteItem,\n\ttype AutocompleteProvider,\n\ttype AutocompleteSuggestions,\n\tfuzzyFilter,\n} from \"@ashx-j/lunr-tui\";\nimport type { SkillTagCharacter } from \"../../core/settings-manager.ts\";\n\nexport interface SkillTagAutocompleteSkill {\n\tname: string;\n\tdescription?: string;\n}\n\nexport interface WrapSkillTagAutocompleteOptions {\n\tcharacter: SkillTagCharacter;\n\tskills: readonly SkillTagAutocompleteSkill[];\n}\n\nexport function extractSkillTagPrefix(textBeforeCursor: string, character: SkillTagCharacter): string | null {\n\tif (textBeforeCursor.trimStart().startsWith(\"/\")) {\n\t\treturn null;\n\t}\n\n\tlet tokenStart = 0;\n\tfor (let i = textBeforeCursor.length - 1; i >= 0; i--) {\n\t\tconst ch = textBeforeCursor[i];\n\t\tif (ch === \" \" || ch === \"\\t\") {\n\t\t\ttokenStart = i + 1;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tconst token = textBeforeCursor.slice(tokenStart);\n\tif (!token.startsWith(character)) {\n\t\treturn null;\n\t}\n\tif (character === \"~\" && (token.startsWith(\"~/\") || token.startsWith(\"~\\\\\"))) {\n\t\treturn null;\n\t}\n\treturn token;\n}\n\nexport function wrapSkillTagAutocomplete(\n\tinner: AutocompleteProvider,\n\toptions: WrapSkillTagAutocompleteOptions,\n): AutocompleteProvider {\n\tconst triggerCharacters = [...new Set([options.character, ...(inner.triggerCharacters ?? [])])];\n\n\treturn {\n\t\ttriggerCharacters,\n\t\tasync getSuggestions(lines, cursorLine, cursorCol, suggestionOptions): Promise<AutocompleteSuggestions | null> {\n\t\t\tconst currentLine = lines[cursorLine] || \"\";\n\t\t\tconst textBeforeCursor = currentLine.slice(0, cursorCol);\n\t\t\tconst prefix = extractSkillTagPrefix(textBeforeCursor, options.character);\n\t\t\tif (prefix === null) {\n\t\t\t\treturn inner.getSuggestions(lines, cursorLine, cursorCol, suggestionOptions);\n\t\t\t}\n\n\t\t\tconst query = prefix.slice(options.character.length);\n\t\t\tconst filtered = fuzzyFilter([...options.skills], query, (skill) => skill.name);\n\t\t\tif (filtered.length === 0) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tprefix,\n\t\t\t\titems: filtered.map((skill) => {\n\t\t\t\t\tconst item: AutocompleteItem = {\n\t\t\t\t\t\tvalue: `${options.character}${skill.name}`,\n\t\t\t\t\t\tlabel: skill.name,\n\t\t\t\t\t};\n\t\t\t\t\tif (skill.description) {\n\t\t\t\t\t\titem.description = skill.description;\n\t\t\t\t\t}\n\t\t\t\t\treturn item;\n\t\t\t\t}),\n\t\t\t};\n\t\t},\n\t\tapplyCompletion(lines, cursorLine, cursorCol, item, prefix) {\n\t\t\tif (!prefix.startsWith(options.character)) {\n\t\t\t\treturn inner.applyCompletion(lines, cursorLine, cursorCol, item, prefix);\n\t\t\t}\n\n\t\t\tconst currentLine = lines[cursorLine] || \"\";\n\t\t\tconst beforePrefix = currentLine.slice(0, Math.max(0, cursorCol - prefix.length));\n\t\t\tconst afterCursor = currentLine.slice(cursorCol);\n\t\t\tconst completed = `${item.value} `;\n\t\t\tconst newLines = [...lines];\n\t\t\tnewLines[cursorLine] = `${beforePrefix}${completed}${afterCursor}`;\n\t\t\treturn {\n\t\t\t\tlines: newLines,\n\t\t\t\tcursorLine,\n\t\t\t\tcursorCol: beforePrefix.length + completed.length,\n\t\t\t};\n\t\t},\n\t\tshouldTriggerFileCompletion: inner.shouldTriggerFileCompletion?.bind(inner),\n\t};\n}\n"]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { fuzzyFilter, } from "@ashx-j/lunr-tui";
|
|
2
|
+
export function extractSkillTagPrefix(textBeforeCursor, character) {
|
|
3
|
+
if (textBeforeCursor.trimStart().startsWith("/")) {
|
|
4
|
+
return null;
|
|
5
|
+
}
|
|
6
|
+
let tokenStart = 0;
|
|
7
|
+
for (let i = textBeforeCursor.length - 1; i >= 0; i--) {
|
|
8
|
+
const ch = textBeforeCursor[i];
|
|
9
|
+
if (ch === " " || ch === "\t") {
|
|
10
|
+
tokenStart = i + 1;
|
|
11
|
+
break;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const token = textBeforeCursor.slice(tokenStart);
|
|
15
|
+
if (!token.startsWith(character)) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
if (character === "~" && (token.startsWith("~/") || token.startsWith("~\\"))) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return token;
|
|
22
|
+
}
|
|
23
|
+
export function wrapSkillTagAutocomplete(inner, options) {
|
|
24
|
+
const triggerCharacters = [...new Set([options.character, ...(inner.triggerCharacters ?? [])])];
|
|
25
|
+
return {
|
|
26
|
+
triggerCharacters,
|
|
27
|
+
async getSuggestions(lines, cursorLine, cursorCol, suggestionOptions) {
|
|
28
|
+
const currentLine = lines[cursorLine] || "";
|
|
29
|
+
const textBeforeCursor = currentLine.slice(0, cursorCol);
|
|
30
|
+
const prefix = extractSkillTagPrefix(textBeforeCursor, options.character);
|
|
31
|
+
if (prefix === null) {
|
|
32
|
+
return inner.getSuggestions(lines, cursorLine, cursorCol, suggestionOptions);
|
|
33
|
+
}
|
|
34
|
+
const query = prefix.slice(options.character.length);
|
|
35
|
+
const filtered = fuzzyFilter([...options.skills], query, (skill) => skill.name);
|
|
36
|
+
if (filtered.length === 0) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
prefix,
|
|
41
|
+
items: filtered.map((skill) => {
|
|
42
|
+
const item = {
|
|
43
|
+
value: `${options.character}${skill.name}`,
|
|
44
|
+
label: skill.name,
|
|
45
|
+
};
|
|
46
|
+
if (skill.description) {
|
|
47
|
+
item.description = skill.description;
|
|
48
|
+
}
|
|
49
|
+
return item;
|
|
50
|
+
}),
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
applyCompletion(lines, cursorLine, cursorCol, item, prefix) {
|
|
54
|
+
if (!prefix.startsWith(options.character)) {
|
|
55
|
+
return inner.applyCompletion(lines, cursorLine, cursorCol, item, prefix);
|
|
56
|
+
}
|
|
57
|
+
const currentLine = lines[cursorLine] || "";
|
|
58
|
+
const beforePrefix = currentLine.slice(0, Math.max(0, cursorCol - prefix.length));
|
|
59
|
+
const afterCursor = currentLine.slice(cursorCol);
|
|
60
|
+
const completed = `${item.value} `;
|
|
61
|
+
const newLines = [...lines];
|
|
62
|
+
newLines[cursorLine] = `${beforePrefix}${completed}${afterCursor}`;
|
|
63
|
+
return {
|
|
64
|
+
lines: newLines,
|
|
65
|
+
cursorLine,
|
|
66
|
+
cursorCol: beforePrefix.length + completed.length,
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
shouldTriggerFileCompletion: inner.shouldTriggerFileCompletion?.bind(inner),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=skill-tag-autocomplete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-tag-autocomplete.js","sourceRoot":"","sources":["../../../src/modes/interactive/skill-tag-autocomplete.ts"],"names":[],"mappings":"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","sourcesContent":["import {\n\ttype AutocompleteItem,\n\ttype AutocompleteProvider,\n\ttype AutocompleteSuggestions,\n\tfuzzyFilter,\n} from \"@ashx-j/lunr-tui\";\nimport type { SkillTagCharacter } from \"../../core/settings-manager.ts\";\n\nexport interface SkillTagAutocompleteSkill {\n\tname: string;\n\tdescription?: string;\n}\n\nexport interface WrapSkillTagAutocompleteOptions {\n\tcharacter: SkillTagCharacter;\n\tskills: readonly SkillTagAutocompleteSkill[];\n}\n\nexport function extractSkillTagPrefix(textBeforeCursor: string, character: SkillTagCharacter): string | null {\n\tif (textBeforeCursor.trimStart().startsWith(\"/\")) {\n\t\treturn null;\n\t}\n\n\tlet tokenStart = 0;\n\tfor (let i = textBeforeCursor.length - 1; i >= 0; i--) {\n\t\tconst ch = textBeforeCursor[i];\n\t\tif (ch === \" \" || ch === \"\\t\") {\n\t\t\ttokenStart = i + 1;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tconst token = textBeforeCursor.slice(tokenStart);\n\tif (!token.startsWith(character)) {\n\t\treturn null;\n\t}\n\tif (character === \"~\" && (token.startsWith(\"~/\") || token.startsWith(\"~\\\\\"))) {\n\t\treturn null;\n\t}\n\treturn token;\n}\n\nexport function wrapSkillTagAutocomplete(\n\tinner: AutocompleteProvider,\n\toptions: WrapSkillTagAutocompleteOptions,\n): AutocompleteProvider {\n\tconst triggerCharacters = [...new Set([options.character, ...(inner.triggerCharacters ?? [])])];\n\n\treturn {\n\t\ttriggerCharacters,\n\t\tasync getSuggestions(lines, cursorLine, cursorCol, suggestionOptions): Promise<AutocompleteSuggestions | null> {\n\t\t\tconst currentLine = lines[cursorLine] || \"\";\n\t\t\tconst textBeforeCursor = currentLine.slice(0, cursorCol);\n\t\t\tconst prefix = extractSkillTagPrefix(textBeforeCursor, options.character);\n\t\t\tif (prefix === null) {\n\t\t\t\treturn inner.getSuggestions(lines, cursorLine, cursorCol, suggestionOptions);\n\t\t\t}\n\n\t\t\tconst query = prefix.slice(options.character.length);\n\t\t\tconst filtered = fuzzyFilter([...options.skills], query, (skill) => skill.name);\n\t\t\tif (filtered.length === 0) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tprefix,\n\t\t\t\titems: filtered.map((skill) => {\n\t\t\t\t\tconst item: AutocompleteItem = {\n\t\t\t\t\t\tvalue: `${options.character}${skill.name}`,\n\t\t\t\t\t\tlabel: skill.name,\n\t\t\t\t\t};\n\t\t\t\t\tif (skill.description) {\n\t\t\t\t\t\titem.description = skill.description;\n\t\t\t\t\t}\n\t\t\t\t\treturn item;\n\t\t\t\t}),\n\t\t\t};\n\t\t},\n\t\tapplyCompletion(lines, cursorLine, cursorCol, item, prefix) {\n\t\t\tif (!prefix.startsWith(options.character)) {\n\t\t\t\treturn inner.applyCompletion(lines, cursorLine, cursorCol, item, prefix);\n\t\t\t}\n\n\t\t\tconst currentLine = lines[cursorLine] || \"\";\n\t\t\tconst beforePrefix = currentLine.slice(0, Math.max(0, cursorCol - prefix.length));\n\t\t\tconst afterCursor = currentLine.slice(cursorCol);\n\t\t\tconst completed = `${item.value} `;\n\t\t\tconst newLines = [...lines];\n\t\t\tnewLines[cursorLine] = `${beforePrefix}${completed}${afterCursor}`;\n\t\t\treturn {\n\t\t\t\tlines: newLines,\n\t\t\t\tcursorLine,\n\t\t\t\tcursorCol: beforePrefix.length + completed.length,\n\t\t\t};\n\t\t},\n\t\tshouldTriggerFileCompletion: inner.shouldTriggerFileCompletion?.bind(inner),\n\t};\n}\n"]}
|
package/docs/compaction.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
# Compaction & Branch Summarization
|
|
2
2
|
|
|
3
|
-
LLMs have limited context windows. When conversations grow too long,
|
|
3
|
+
LLMs have limited context windows. When conversations grow too long, lunR uses compaction to summarize older content while preserving recent work. This page covers both auto-compaction and branch summarization.
|
|
4
4
|
|
|
5
|
-
**Source files** ([
|
|
6
|
-
- [`packages/coding-agent/src/core/compaction/compaction.ts`](https://github.com/
|
|
7
|
-
- [`packages/coding-agent/src/core/compaction/branch-summarization.ts`](https://github.com/
|
|
8
|
-
- [`packages/coding-agent/src/core/compaction/utils.ts`](https://github.com/
|
|
9
|
-
- [`packages/coding-agent/src/core/session-manager.ts`](https://github.com/
|
|
10
|
-
- [`packages/coding-agent/src/core/extensions/types.ts`](https://github.com/
|
|
5
|
+
**Source files** ([lunR](https://github.com/ashx-j/lunR)):
|
|
6
|
+
- [`packages/coding-agent/src/core/compaction/compaction.ts`](https://github.com/ashx-j/lunR/blob/master/packages/coding-agent/src/core/compaction/compaction.ts) - Auto-compaction logic
|
|
7
|
+
- [`packages/coding-agent/src/core/compaction/branch-summarization.ts`](https://github.com/ashx-j/lunR/blob/master/packages/coding-agent/src/core/compaction/branch-summarization.ts) - Branch summarization
|
|
8
|
+
- [`packages/coding-agent/src/core/compaction/utils.ts`](https://github.com/ashx-j/lunR/blob/master/packages/coding-agent/src/core/compaction/utils.ts) - Shared utilities (file tracking, serialization)
|
|
9
|
+
- [`packages/coding-agent/src/core/session-manager.ts`](https://github.com/ashx-j/lunR/blob/master/packages/coding-agent/src/core/session-manager.ts) - Entry types (`CompactionEntry`, `BranchSummaryEntry`)
|
|
10
|
+
- [`packages/coding-agent/src/core/extensions/types.ts`](https://github.com/ashx-j/lunR/blob/master/packages/coding-agent/src/core/extensions/types.ts) - Extension event types
|
|
11
11
|
|
|
12
|
-
For TypeScript definitions in your project, inspect `node_modules/@
|
|
12
|
+
For TypeScript definitions in your project, inspect `node_modules/@ashx-j/lunr/dist/`.
|
|
13
13
|
|
|
14
14
|
## Overview
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
lunR has two summarization mechanisms:
|
|
17
17
|
|
|
18
18
|
| Mechanism | Trigger | Purpose |
|
|
19
19
|
|-----------|---------|---------|
|
|
@@ -32,13 +32,13 @@ Auto-compaction triggers when:
|
|
|
32
32
|
contextTokens > contextWindow - reserveTokens
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
By default, `reserveTokens` is 16384 tokens (configurable in `~/.
|
|
35
|
+
By default, `reserveTokens` is 16384 tokens (configurable in `~/.lunr/agent/settings.json` or `<project-dir>/.lunr/settings.json`). This leaves room for the LLM's response.
|
|
36
36
|
|
|
37
37
|
You can also trigger manually with `/compact [instructions]`, where optional instructions focus the summary.
|
|
38
38
|
|
|
39
39
|
### How It Works
|
|
40
40
|
|
|
41
|
-
1. **Find cut point**: Walk backwards from newest message, accumulating token estimates until `keepRecentTokens` (default 20k, configurable in `~/.
|
|
41
|
+
1. **Find cut point**: Walk backwards from newest message, accumulating token estimates until `keepRecentTokens` (default 20k, configurable in `~/.lunr/agent/settings.json` or `<project-dir>/.lunr/settings.json`) is reached
|
|
42
42
|
2. **Extract messages**: Collect messages from the previous kept boundary (or session start) up to the cut point
|
|
43
43
|
3. **Generate summary**: Call LLM to summarize with structured format, passing the previous summary as iterative context when present
|
|
44
44
|
4. **Append entry**: Save `CompactionEntry` with summary and `firstKeptEntryId`
|
|
@@ -76,7 +76,7 @@ What the LLM sees:
|
|
|
76
76
|
prompt from cmp messages from firstKeptEntryId
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
On repeated compactions, the summarized span starts at the previous compaction's kept boundary (`firstKeptEntryId`), not at the compaction entry itself, falling back to the entry after the previous compaction if that kept entry cannot be found in the path. This preserves messages that survived the earlier compaction by including them in the next summarization pass as well.
|
|
79
|
+
On repeated compactions, the summarized span starts at the previous compaction's kept boundary (`firstKeptEntryId`), not at the compaction entry itself, falling back to the entry after the previous compaction if that kept entry cannot be found in the path. This preserves messages that survived the earlier compaction by including them in the next summarization pass as well. lunR also recalculates `tokensBefore` from the rebuilt session context before writing the new `CompactionEntry`, so the token count reflects the actual pre-compaction context being replaced.
|
|
80
80
|
|
|
81
81
|
### Split Turns
|
|
82
82
|
|
|
@@ -102,7 +102,7 @@ Split turn (one huge turn exceeds budget):
|
|
|
102
102
|
turnPrefixMessages = [usr, ass, tool, ass, tool, tool]
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
-
For split turns,
|
|
105
|
+
For split turns, lunR generates two summaries and merges them:
|
|
106
106
|
1. **History summary**: Previous context (if any)
|
|
107
107
|
2. **Turn prefix summary**: The early part of the split turn
|
|
108
108
|
|
|
@@ -118,7 +118,7 @@ Never cut at tool results (they must stay with their tool call).
|
|
|
118
118
|
|
|
119
119
|
### CompactionEntry Structure
|
|
120
120
|
|
|
121
|
-
Defined in [`session-manager.ts`](https://github.com/
|
|
121
|
+
Defined in [`session-manager.ts`](https://github.com/ashx-j/lunR/blob/master/packages/coding-agent/src/core/session-manager.ts):
|
|
122
122
|
|
|
123
123
|
```typescript
|
|
124
124
|
interface CompactionEntry<T = unknown> {
|
|
@@ -142,13 +142,13 @@ interface CompactionDetails {
|
|
|
142
142
|
|
|
143
143
|
Extensions can store any JSON-serializable data in `details`. The default compaction tracks file operations, but custom extension implementations can use their own structure.
|
|
144
144
|
|
|
145
|
-
See [`prepareCompaction()`](https://github.com/
|
|
145
|
+
See [`prepareCompaction()`](https://github.com/ashx-j/lunR/blob/master/packages/coding-agent/src/core/compaction/compaction.ts) and [`compact()`](https://github.com/ashx-j/lunR/blob/master/packages/coding-agent/src/core/compaction/compaction.ts) for the implementation.
|
|
146
146
|
|
|
147
147
|
## Branch Summarization
|
|
148
148
|
|
|
149
149
|
### When It Triggers
|
|
150
150
|
|
|
151
|
-
When you use `/tree` to navigate to a different branch,
|
|
151
|
+
When you use `/tree` to navigate to a different branch, lunR offers to summarize the work you're leaving. This injects context from the left branch into the new branch.
|
|
152
152
|
|
|
153
153
|
### How It Works
|
|
154
154
|
|
|
@@ -177,7 +177,7 @@ After navigation with summary:
|
|
|
177
177
|
|
|
178
178
|
### Cumulative File Tracking
|
|
179
179
|
|
|
180
|
-
Both compaction and branch summarization track files cumulatively. When generating a summary,
|
|
180
|
+
Both compaction and branch summarization track files cumulatively. When generating a summary, lunR extracts file operations from:
|
|
181
181
|
- Tool calls in the messages being summarized
|
|
182
182
|
- Previous compaction or branch summary `details` (if any)
|
|
183
183
|
|
|
@@ -185,7 +185,7 @@ This means file tracking accumulates across multiple compactions or nested branc
|
|
|
185
185
|
|
|
186
186
|
### BranchSummaryEntry Structure
|
|
187
187
|
|
|
188
|
-
Defined in [`session-manager.ts`](https://github.com/
|
|
188
|
+
Defined in [`session-manager.ts`](https://github.com/ashx-j/lunR/blob/master/packages/coding-agent/src/core/session-manager.ts):
|
|
189
189
|
|
|
190
190
|
```typescript
|
|
191
191
|
interface BranchSummaryEntry<T = unknown> {
|
|
@@ -208,7 +208,7 @@ interface BranchSummaryDetails {
|
|
|
208
208
|
|
|
209
209
|
Same as compaction, extensions can store custom data in `details`.
|
|
210
210
|
|
|
211
|
-
See [`collectEntriesForBranchSummary()`](https://github.com/
|
|
211
|
+
See [`collectEntriesForBranchSummary()`](https://github.com/ashx-j/lunR/blob/master/packages/coding-agent/src/core/compaction/branch-summarization.ts), [`prepareBranchEntries()`](https://github.com/ashx-j/lunR/blob/master/packages/coding-agent/src/core/compaction/branch-summarization.ts), and [`generateBranchSummary()`](https://github.com/ashx-j/lunR/blob/master/packages/coding-agent/src/core/compaction/branch-summarization.ts) for the implementation.
|
|
212
212
|
|
|
213
213
|
## Summary Format
|
|
214
214
|
|
|
@@ -252,7 +252,7 @@ path/to/changed.ts
|
|
|
252
252
|
|
|
253
253
|
### Message Serialization
|
|
254
254
|
|
|
255
|
-
Before summarization, messages are serialized to text via [`serializeConversation()`](https://github.com/
|
|
255
|
+
Before summarization, messages are serialized to text via [`serializeConversation()`](https://github.com/ashx-j/lunR/blob/master/packages/coding-agent/src/core/compaction/utils.ts):
|
|
256
256
|
|
|
257
257
|
```
|
|
258
258
|
[User]: What they said
|
|
@@ -268,7 +268,7 @@ Tool results are truncated to 2000 characters during serialization. Content beyo
|
|
|
268
268
|
|
|
269
269
|
## Custom Summarization via Extensions
|
|
270
270
|
|
|
271
|
-
Extensions can intercept and customize both compaction and branch summarization. See [`extensions/types.ts`](https://github.com/
|
|
271
|
+
Extensions can intercept and customize both compaction and branch summarization. See [`extensions/types.ts`](https://github.com/ashx-j/lunR/blob/master/packages/coding-agent/src/core/extensions/types.ts) for event type definitions.
|
|
272
272
|
|
|
273
273
|
### session_before_compact
|
|
274
274
|
|
|
@@ -311,7 +311,7 @@ pi.on("session_before_compact", async (event, ctx) => {
|
|
|
311
311
|
To generate a summary with your own model, convert messages to text using `serializeConversation`:
|
|
312
312
|
|
|
313
313
|
```typescript
|
|
314
|
-
import { convertToLlm, serializeConversation } from "@
|
|
314
|
+
import { convertToLlm, serializeConversation } from "@ashx-j/lunr";
|
|
315
315
|
|
|
316
316
|
pi.on("session_before_compact", async (event, ctx) => {
|
|
317
317
|
const { preparation } = event;
|
|
@@ -375,7 +375,7 @@ See `SessionBeforeTreeEvent` and `TreePreparation` in the types file.
|
|
|
375
375
|
|
|
376
376
|
## Settings
|
|
377
377
|
|
|
378
|
-
Configure compaction in `~/.
|
|
378
|
+
Configure compaction in `~/.lunr/agent/settings.json` or `<project-dir>/.lunr/settings.json`:
|
|
379
379
|
|
|
380
380
|
```json
|
|
381
381
|
{
|
package/docs/containerization.md
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
# Containerization
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
lunR runs with all permissions by default, but in some cases, you will want to have more control over what directories lunR can write to and which accesses it has.
|
|
4
4
|
|
|
5
5
|
There are two general options. You can either
|
|
6
|
-
1. run the whole `
|
|
7
|
-
2. run `
|
|
6
|
+
1. run the whole `lunr` process inside an isolated environment, or
|
|
7
|
+
2. run `lunr` on the host and route tool execution into an isolated environment.
|
|
8
8
|
|
|
9
9
|
## Choose a pattern
|
|
10
10
|
|
|
11
11
|
| Pattern | What is isolated | Best for | Notes |
|
|
12
12
|
| --- | --- | --- | --- |
|
|
13
13
|
| Gondolin extension | Built-in tools and `!` commands | Local micro-VM isolation while keeping auth on host | See [`examples/extensions/gondolin/`](../examples/extensions/gondolin/). |
|
|
14
|
-
| Plain Docker | Whole `
|
|
15
|
-
| OpenShell | Whole `
|
|
14
|
+
| Plain Docker | Whole `lunr` process in a local container | Simple local isolation | Provider API keys enter the container. |
|
|
15
|
+
| OpenShell | Whole `lunr` process in a policy-controlled sandbox | Local or remote managed sandbox | Requires an OpenShell gateway |
|
|
16
16
|
|
|
17
|
-
Extensions run wherever the `
|
|
17
|
+
Extensions run wherever the `lunr` process runs. If you run host `lunr` with a tool-routing extension, other custom extension tools still run on the host unless they also delegate their operations.
|
|
18
18
|
|
|
19
19
|
## Gondolin
|
|
20
20
|
|
|
21
21
|
[Gondolin](https://github.com/earendil-works/gondolin) is a local Linux micro-VM.
|
|
22
|
-
Use the [example extension](../examples/extensions/gondolin) when you want `
|
|
22
|
+
Use the [example extension](../examples/extensions/gondolin) when you want `lunr` on the host but all built-in tools routed into the VM.
|
|
23
23
|
|
|
24
24
|
Setup:
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
cp -R packages/coding-agent/examples/extensions/gondolin ~/.
|
|
28
|
-
cd ~/.
|
|
27
|
+
cp -R packages/coding-agent/examples/extensions/gondolin ~/.lunr/agent/extensions/gondolin
|
|
28
|
+
cd ~/.lunr/agent/extensions/gondolin
|
|
29
29
|
npm install --ignore-scripts
|
|
30
30
|
```
|
|
31
31
|
|
|
@@ -33,7 +33,7 @@ Run from the project you want mounted:
|
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
35
|
cd /path/to/project
|
|
36
|
-
|
|
36
|
+
lunr -e ~/.lunr/agent/extensions/gondolin
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
The extension mounts the host cwd at `/workspace` in the VM and overrides `read`, `write`, `edit`, `bash`, `grep`, `find`, and `ls`.
|
|
@@ -44,9 +44,9 @@ Requirements: Node.js >= 23.6.0 for `@earendil-works/gondolin`, plus QEMU (requi
|
|
|
44
44
|
|
|
45
45
|
## Plain Docker
|
|
46
46
|
|
|
47
|
-
Run the whole `
|
|
47
|
+
Run the whole `lunr` process in Docker when you want the simplest local container boundary.
|
|
48
48
|
|
|
49
|
-
`Dockerfile.
|
|
49
|
+
`Dockerfile.lunr`:
|
|
50
50
|
|
|
51
51
|
```dockerfile
|
|
52
52
|
FROM node:24-bookworm-slim
|
|
@@ -54,27 +54,27 @@ FROM node:24-bookworm-slim
|
|
|
54
54
|
RUN apt-get update \
|
|
55
55
|
&& apt-get install -y --no-install-recommends bash ca-certificates git ripgrep \
|
|
56
56
|
&& rm -rf /var/lib/apt/lists/*
|
|
57
|
-
RUN npm install -g --ignore-scripts @
|
|
57
|
+
RUN npm install -g --ignore-scripts @ashx-j/lunr
|
|
58
58
|
|
|
59
59
|
WORKDIR /workspace
|
|
60
|
-
ENTRYPOINT ["
|
|
60
|
+
ENTRYPOINT ["lunr"]
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
Build and run:
|
|
64
64
|
|
|
65
65
|
```bash
|
|
66
|
-
docker build -t
|
|
66
|
+
docker build -t lunr-sandbox -f Dockerfile.lunr .
|
|
67
67
|
|
|
68
68
|
docker run --rm -it \
|
|
69
69
|
-e ANTHROPIC_API_KEY \
|
|
70
70
|
-v "$PWD:/workspace" \
|
|
71
|
-
-v
|
|
72
|
-
|
|
71
|
+
-v lunr-agent-home:/root/.lunr/agent \
|
|
72
|
+
lunr-sandbox
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
The `-v "$PWD:/workspace"` mounts your current directory into the container at /workspace such that reads and writes in `/workspace` inside Docker directly affect your host files, like in the Gondolin example.
|
|
76
76
|
|
|
77
|
-
Use a named volume for `/root/.
|
|
77
|
+
Use a named volume for `/root/.lunr/agent` if you want container-local settings and sessions. Mounting your host `~/.lunr/agent` exposes host auth and session files to the container.
|
|
78
78
|
|
|
79
79
|
## OpenShell
|
|
80
80
|
|
|
@@ -89,23 +89,23 @@ openshell gateway add <gateway-url> --name <name>
|
|
|
89
89
|
openshell gateway select <name>
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
Launch `
|
|
92
|
+
Launch `lunr` inside an OpenShell sandbox:
|
|
93
93
|
|
|
94
94
|
```bash
|
|
95
|
-
openshell sandbox create --name
|
|
95
|
+
openshell sandbox create --name lunr-sandbox --from lunr -- lunr
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
In this pattern, the whole `
|
|
98
|
+
In this pattern, the whole `lunr` process runs inside the sandbox.
|
|
99
99
|
Built-in tools, `!` commands, and extension tools execute inside the OpenShell boundary.
|
|
100
100
|
|
|
101
101
|
If the gateway is remote, project files are not bind-mounted from the host, meaning writes in the sandbox are not reflected on your machine.
|
|
102
102
|
Clone the repository inside the sandbox or use OpenShell file transfer commands:
|
|
103
103
|
|
|
104
104
|
```bash
|
|
105
|
-
openshell sandbox upload
|
|
106
|
-
openshell sandbox download
|
|
105
|
+
openshell sandbox upload lunr-sandbox ./repo /workspace
|
|
106
|
+
openshell sandbox download lunr-sandbox /workspace/repo ./repo-out
|
|
107
107
|
```
|
|
108
108
|
|
|
109
109
|
OpenShell providers can keep raw model API keys outside the sandbox.
|
|
110
110
|
When inference routing is configured, code inside the sandbox can call `https://inference.local`, and the gateway injects the configured provider credentials upstream.
|
|
111
|
-
Configure
|
|
111
|
+
Configure lunR to use the corresponding OpenAI-compatible or Anthropic-compatible endpoint if you want model traffic to use this route.
|
package/docs/custom-provider.md
CHANGED
|
@@ -31,7 +31,7 @@ See these complete provider examples:
|
|
|
31
31
|
## Quick Reference
|
|
32
32
|
|
|
33
33
|
```typescript
|
|
34
|
-
import type { ExtensionAPI } from "@
|
|
34
|
+
import type { ExtensionAPI } from "@ashx-j/lunr";
|
|
35
35
|
|
|
36
36
|
export default function (pi: ExtensionAPI) {
|
|
37
37
|
// Override baseUrl for existing provider
|
|
@@ -60,7 +60,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
60
60
|
}
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
The extension factory can also be `async`. For dynamic model discovery, fetch and register models in the factory instead of `session_start`.
|
|
63
|
+
The extension factory can also be `async`. For dynamic model discovery, fetch and register models in the factory instead of `session_start`. lunR waits for the factory before startup continues, so the provider is available during interactive startup and to `lunr --list-models`.
|
|
64
64
|
|
|
65
65
|
## Override Existing Provider
|
|
66
66
|
|
|
@@ -97,7 +97,7 @@ To add a completely new provider, specify `models` along with the required confi
|
|
|
97
97
|
If the model list comes from a remote endpoint, use an async extension factory:
|
|
98
98
|
|
|
99
99
|
```typescript
|
|
100
|
-
import type { ExtensionAPI } from "@
|
|
100
|
+
import type { ExtensionAPI } from "@ashx-j/lunr";
|
|
101
101
|
|
|
102
102
|
export default async function (pi: ExtensionAPI) {
|
|
103
103
|
const response = await fetch("http://localhost:1234/v1/models");
|
|
@@ -260,7 +260,7 @@ The key is resolved for each request. An explicit request `Authorization` header
|
|
|
260
260
|
Add OAuth/SSO authentication that integrates with `/login`:
|
|
261
261
|
|
|
262
262
|
```typescript
|
|
263
|
-
import type { OAuthCredentials, OAuthLoginCallbacks } from "@
|
|
263
|
+
import type { OAuthCredentials, OAuthLoginCallbacks } from "@ashx-j/lunr-ai";
|
|
264
264
|
|
|
265
265
|
pi.registerProvider("corporate-ai", {
|
|
266
266
|
baseUrl: "https://ai.corp.com/v1",
|
|
@@ -354,7 +354,7 @@ interface OAuthLoginCallbacks {
|
|
|
354
354
|
|
|
355
355
|
### OAuthCredentials
|
|
356
356
|
|
|
357
|
-
Credentials are persisted in `~/.
|
|
357
|
+
Credentials are persisted in `~/.lunr/agent/auth.json`:
|
|
358
358
|
|
|
359
359
|
```typescript
|
|
360
360
|
interface OAuthCredentials {
|
|
@@ -369,12 +369,12 @@ interface OAuthCredentials {
|
|
|
369
369
|
For providers with non-standard APIs, implement `streamSimple`. Study the existing provider implementations before writing your own:
|
|
370
370
|
|
|
371
371
|
**Reference implementations:**
|
|
372
|
-
- [anthropic.ts](https://github.com/
|
|
373
|
-
- [mistral.ts](https://github.com/
|
|
374
|
-
- [openai-completions.ts](https://github.com/
|
|
375
|
-
- [openai-responses.ts](https://github.com/
|
|
376
|
-
- [google.ts](https://github.com/
|
|
377
|
-
- [amazon-bedrock.ts](https://github.com/
|
|
372
|
+
- [anthropic.ts](https://github.com/ashx-j/lunR/blob/master/packages/ai/src/providers/anthropic.ts) - Anthropic Messages API
|
|
373
|
+
- [mistral.ts](https://github.com/ashx-j/lunR/blob/master/packages/ai/src/providers/mistral.ts) - Mistral Conversations API
|
|
374
|
+
- [openai-completions.ts](https://github.com/ashx-j/lunR/blob/master/packages/ai/src/providers/openai-completions.ts) - OpenAI Chat Completions
|
|
375
|
+
- [openai-responses.ts](https://github.com/ashx-j/lunR/blob/master/packages/ai/src/providers/openai-responses.ts) - OpenAI Responses API
|
|
376
|
+
- [google.ts](https://github.com/ashx-j/lunR/blob/master/packages/ai/src/providers/google.ts) - Google Generative AI
|
|
377
|
+
- [amazon-bedrock.ts](https://github.com/ashx-j/lunR/blob/master/packages/ai/src/providers/amazon-bedrock.ts) - AWS Bedrock
|
|
378
378
|
|
|
379
379
|
### Stream Pattern
|
|
380
380
|
|
|
@@ -389,7 +389,7 @@ import {
|
|
|
389
389
|
type SimpleStreamOptions,
|
|
390
390
|
calculateCost,
|
|
391
391
|
createAssistantMessageEventStream,
|
|
392
|
-
} from "@
|
|
392
|
+
} from "@ashx-j/lunr-ai";
|
|
393
393
|
|
|
394
394
|
function streamMyProvider(
|
|
395
395
|
model: Model<any>,
|
|
@@ -532,14 +532,14 @@ calculateCost(model, output.usage);
|
|
|
532
532
|
|
|
533
533
|
### Context Overflow Errors
|
|
534
534
|
|
|
535
|
-
When a request exceeds the model's context window,
|
|
535
|
+
When a request exceeds the model's context window, lunR can recover automatically by compacting the conversation and retrying. This recovery only kicks in if lunR recognizes the failure as an overflow.
|
|
536
536
|
|
|
537
537
|
Detection runs on the finalized assistant message:
|
|
538
538
|
|
|
539
539
|
- `stopReason === "error"`
|
|
540
|
-
- `errorMessage` matches one of
|
|
540
|
+
- `errorMessage` matches one of lunR's known overflow patterns (see [`packages/ai/src/utils/overflow.ts`](https://github.com/ashx-j/lunR/blob/master/packages/ai/src/utils/overflow.ts))
|
|
541
541
|
|
|
542
|
-
If your provider returns overflow errors with a message
|
|
542
|
+
If your provider returns overflow errors with a message lunR does not recognize, normalize the error from the same extension that registers the provider. Use a `message_end` handler to rewrite the assistant message so its `errorMessage` starts with a phrase lunR recognizes. The generic fallback `context_length_exceeded` is the safest choice.
|
|
543
543
|
|
|
544
544
|
```typescript
|
|
545
545
|
const MY_PROVIDER_OVERFLOW_PATTERN = /your provider's overflow phrase/i;
|
|
@@ -571,7 +571,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
571
571
|
}
|
|
572
572
|
```
|
|
573
573
|
|
|
574
|
-
`message_end` runs before
|
|
574
|
+
`message_end` runs before lunR tracks the assistant message for auto-compaction, so the rewritten `errorMessage` is what pi checks. With this in place, lunR will:
|
|
575
575
|
|
|
576
576
|
1. Detect the overflow from `errorMessage`.
|
|
577
577
|
2. Drop the failed assistant message from live context.
|
|
@@ -581,7 +581,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
581
581
|
Guard the rewrite carefully:
|
|
582
582
|
|
|
583
583
|
- Scope it to your provider (`message.provider` and `ctx.model?.provider`) so unrelated errors from other providers are untouched.
|
|
584
|
-
- Match a provider-specific pattern, not
|
|
584
|
+
- Match a provider-specific pattern, not lunR's generic overflow patterns. Rewriting rate-limit or throttling errors (`rate limit`, `too many requests`) would falsely trigger compaction instead of lunR's normal retry-with-backoff path.
|
|
585
585
|
- Skip when `errorMessage` already includes `context_length_exceeded` so the handler is idempotent.
|
|
586
586
|
|
|
587
587
|
### Registration
|
|
@@ -600,7 +600,7 @@ pi.registerProvider("my-provider", {
|
|
|
600
600
|
|
|
601
601
|
## Testing Your Implementation
|
|
602
602
|
|
|
603
|
-
Test your provider against the same test suites used by built-in providers. Copy and adapt these test files from [packages/ai/test/](https://github.com/
|
|
603
|
+
Test your provider against the same test suites used by built-in providers. Copy and adapt these test files from [packages/ai/test/](https://github.com/ashx-j/lunR/tree/master/packages/ai/test):
|
|
604
604
|
|
|
605
605
|
| Test | Purpose |
|
|
606
606
|
|------|---------|
|
package/docs/development.md
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
# Development
|
|
2
2
|
|
|
3
|
-
See [AGENTS.md](https://github.com/
|
|
3
|
+
See [AGENTS.md](https://github.com/ashx-j/lunR/blob/master/AGENTS.md) for additional guidelines.
|
|
4
4
|
|
|
5
5
|
## Setup
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
git clone https://github.com/
|
|
9
|
-
cd
|
|
8
|
+
git clone https://github.com/ashx-j/lunR
|
|
9
|
+
cd lunR
|
|
10
10
|
npm install
|
|
11
11
|
npm run build
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Compile in order: tui → ai → agent → coding-agent. From this repo, `npx lunr` is the workspace bin (`packages/coding-agent/dist/cli.js`), not a published global install. Rebuild coding-agent `dist` after changes.
|
|
15
|
+
|
|
16
|
+
Run from the package:
|
|
15
17
|
|
|
16
18
|
```bash
|
|
17
|
-
|
|
19
|
+
npx lunr
|
|
18
20
|
```
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
lunR keeps the caller's current working directory.
|
|
21
23
|
|
|
22
24
|
## Forking / Rebranding
|
|
23
25
|
|
|
@@ -26,13 +28,13 @@ Configure via `package.json`:
|
|
|
26
28
|
```json
|
|
27
29
|
{
|
|
28
30
|
"piConfig": {
|
|
29
|
-
"name": "
|
|
30
|
-
"configDir": ".
|
|
31
|
+
"name": "lunr",
|
|
32
|
+
"configDir": ".lunr"
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
```
|
|
34
36
|
|
|
35
|
-
Change `name`, `configDir`, and `bin`
|
|
37
|
+
Change `name`, `configDir`, and `bin` for a fork. That affects the CLI banner and config directory. Environment variable names stay pinned: `PI_CODING_AGENT_DIR`, `PI_CODING_AGENT_SESSION_DIR`, `PI_PACKAGE_DIR`, `PI_OFFLINE`, `PI_SHARE_VIEWER_URL`. Do not invent `LUNR_*` replacements for those.
|
|
36
38
|
|
|
37
39
|
## Path Resolution
|
|
38
40
|
|
|
@@ -41,23 +43,22 @@ Three execution modes: npm install, standalone binary, tsx from source.
|
|
|
41
43
|
**Always use `src/config.ts`** for package assets:
|
|
42
44
|
|
|
43
45
|
```typescript
|
|
44
|
-
import { getPackageDir,
|
|
46
|
+
import { getPackageDir, getThemesDir } from "./config.js";
|
|
45
47
|
```
|
|
46
48
|
|
|
47
49
|
Never use `__dirname` directly for package assets.
|
|
48
50
|
|
|
49
51
|
## Debug Command
|
|
50
52
|
|
|
51
|
-
`/debug` (hidden) writes to `~/.
|
|
53
|
+
`/debug` (hidden) writes to `~/.lunr/agent/lunr-debug.log`:
|
|
52
54
|
- Rendered TUI lines with ANSI codes
|
|
53
55
|
- Last messages sent to the LLM
|
|
54
56
|
|
|
55
57
|
## Testing
|
|
56
58
|
|
|
57
59
|
```bash
|
|
58
|
-
|
|
59
|
-
npm test
|
|
60
|
-
npm test -- test/specific.test.ts # Run specific test
|
|
60
|
+
npx vitest --run # coding-agent tests
|
|
61
|
+
npm test -- test/specific.test.ts # specific test
|
|
61
62
|
```
|
|
62
63
|
|
|
63
64
|
## Project Structure
|
|
@@ -65,7 +66,7 @@ npm test -- test/specific.test.ts # Run specific test
|
|
|
65
66
|
```
|
|
66
67
|
packages/
|
|
67
68
|
ai/ # LLM provider abstraction
|
|
68
|
-
agent/ # Agent loop and message types
|
|
69
|
+
agent/ # Agent loop and message types
|
|
69
70
|
tui/ # Terminal UI components
|
|
70
71
|
coding-agent/ # CLI and interactive mode
|
|
71
72
|
```
|
package/docs/docs.json
CHANGED
|
@@ -12,9 +12,13 @@
|
|
|
12
12
|
"path": "quickstart.md"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
|
-
"title": "Using
|
|
15
|
+
"title": "Using lunR",
|
|
16
16
|
"path": "usage.md"
|
|
17
17
|
},
|
|
18
|
+
{
|
|
19
|
+
"title": "Built-in features",
|
|
20
|
+
"path": "features.md"
|
|
21
|
+
},
|
|
18
22
|
{
|
|
19
23
|
"title": "Providers",
|
|
20
24
|
"path": "providers.md"
|
|
@@ -65,7 +69,7 @@
|
|
|
65
69
|
"path": "themes.md"
|
|
66
70
|
},
|
|
67
71
|
{
|
|
68
|
-
"title": "
|
|
72
|
+
"title": "Packages",
|
|
69
73
|
"path": "packages.md"
|
|
70
74
|
},
|
|
71
75
|
{
|