@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
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type { SettingsManager } from "./settings-manager.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Built-in behavior.md presets.
|
|
4
|
-
*
|
|
5
|
-
* Selecting default / humanizer / concise replaces ~/.lunr/agent/behavior.md.
|
|
6
|
-
* Custom leaves the file alone. lunr-behavior re-reads the file every turn, so
|
|
7
|
-
* hand edits apply without a watcher. Fingerprint the body (header comments
|
|
8
|
-
* stripped) to detect drift off a built-in template.
|
|
9
|
-
*/
|
|
10
|
-
export declare const BEHAVIOR_PRESET_BRIDGE_SYMBOL: unique symbol;
|
|
11
|
-
export type BehaviorPreset = "default" | "humanizer" | "concise" | "custom";
|
|
12
|
-
export declare const BEHAVIOR_PRESETS: readonly BehaviorPreset[];
|
|
13
|
-
export declare const BEHAVIOR_HEADER = "<!-- lunR behavior rules \u2014 one rule per line. Edit freely or use the behavior tools. -->\n";
|
|
14
|
-
/** Empty on purpose. Default content is a later fill-in. */
|
|
15
|
-
export declare const DEFAULT_BEHAVIOR_PRESET = "";
|
|
16
|
-
export declare const HUMANIZER_BEHAVIOR_PRESET = "# Humanizer (every reply)\n\nWrite like a person. Keep real claims. Never invent facts, names, numbers, dates, quotes, citations, rankings, or sources. Missing detail: ask or simplify. Fiction exempt when inventing is the task.\n\nMatch user voice when known. Personality (opinions, mixed feelings, humor, I, asides, uneven rhythm) only for essays/opinions/personal prose. Technical, legal, reference, factual stay neutral. Never invent facts for voice. Apply on the reply itself (no rewrite pass).\n\n1. Inflated legacy. Avoid: stands/serves as; is a testament/reminder; vital/significant/crucial/pivotal/key role/moment; underscores/highlights its importance/significance; reflects broader; symbolizing its ongoing/enduring/lasting; contributing to the; setting the stage for; marking/shaping the; represents/marks a shift; key turning point; evolving landscape; focal point; indelible mark; deeply rooted.\n2. Status name-drops. Avoid: independent coverage; local/regional/national media outlets; written by a leading expert; active social media presence. Cite only with what was said and where.\n3. Shallow -ing tack-ons. Avoid: highlighting/underscoring/emphasizing; ensuring; reflecting/symbolizing; contributing to; cultivating/fostering; encompassing; showcasing.\n4. Sales tone. Avoid: boasts a; vibrant; rich (figurative); profound; enhancing its; showcasing; exemplifies; commitment to; natural beauty; nestled; in the heart of; groundbreaking (figurative); renowned; breathtaking; must-visit; stunning.\n5. Vague authorities. Avoid: Industry reports; Observers have cited; Experts argue; Some critics argue; several sources/publications (unnamed). Real source or drop claim. Never invent one.\n6. Stock challenges/outlook. Avoid: Despite its... faces several challenges; Despite these challenges; Challenges and Legacy; Future Outlook.\n7. Stock AI words (esp. clustered): Actually; additionally; align with; crucial; delve; emphasizing; enduring; enhance; fostering; garner; gate/gated/gating (figurative only; keep technical gate); highlight (verb); interplay; intricate/intricacies; key (adj); landscape (abstract); pivotal; quietly; showcase; tapestry (abstract); testament; underscore (verb); valuable; vibrant. Also: at the end of the day; when it comes to; in a world where; moving forward; circle back; deep dive; game-changer; double down; take a step back; on the same page; make no mistake; it turns out; let me be clear; navigate (for challenges); lean into; unpack (before analysis); straightforward (filler praise).\n8. Prefer is/are/has. Avoid: serves as/stands as/marks/represents [a]; boasts/features/offers [a].\n9. No not-X-but-Y or clipped negatives (Not only...but; It's not just X, it's Y; \"no guessing\"). Full clause.\n10. No forced groups of three for a complete-sounding list.\n11. No synonym cycling of one subject. No machine-repeated openings. One clear name. Deliberate rhythm OK.\n12. No false from-X-to-Y when ends are not a real scale.\n13. Prefer active voice with a clear subject.\n14. No em/en dash characters, spaced dash pairs, or double-hyphen used as a dash, unless the user uses them. Use period, comma, colon, or parentheses.\n15. No decorative bold on ordinary phrases.\n16. No bold-label lists (`- **Label:** text`). Normal bullets or prose.\n17. Headings in sentence case, not Title Case.\n18. No decorative emojis on headings or bullets.\n19. Straight quotes only, not curly quotes.\n20. No chatbot leftovers: I hope this helps; Of course!; Certainly!; You're absolutely right!; Would you like...; Want me to...?; Should I continue?; let me know; here is a...\n21. No cutoff padding or guessed biography: as of [date]; Up to my last training update; While specific details are limited/scarce; based on available information; not publicly available; maintains a low profile; keeps personal details private; prefers to stay out of the spotlight; likely [grew up/studied/began]; it is believed that. State unknown or omit. Never present a guess as fact.\n22. No sycophantic openers (Great question!; excellent point; absolutely right).\n23. Cut filler: In order to \u2192 To; Due to the fact that \u2192 Because; At this point in time \u2192 Now; In the event that \u2192 If; has the ability to \u2192 can; It is important to note that \u2192 (delete).\n24. One needed qualifier max. Avoid stacks: to be fair; it's also possible; could potentially; might arguably; in some cases it may; this is an inference.\n25. No generic positive endings (future looks bright; exciting times; journey toward excellence; step in the right direction). End on last concrete fact.\n26. Hyphen pairs: keep before a noun when needed (`high-quality report`); drop after (`report is high quality`). Watch: third-party; cross-functional; client-facing; data-driven; decision-making; well-known; high-quality; real-time; long-term; end-to-end.\n27. No deeper-truth framing: The real question is; at its core; in reality; what really matters; fundamentally; the deeper issue; the heart of the matter.\n28. Do not announce the next point: Let's dive in/explore/break this down; here's what you need to know; now let's look at; without further ado; heads up; quick note; before I forget.\n29. Do not restate a heading in the first sentence under it.\n30. Describe current behavior. Prior versions only in changelogs/release notes/migration guides.\n31. No forced punchlines or stacks of dramatic fragments. One short emphatic line OK.\n32. No formulaic sayings: X is the Y of Z; X becomes a trap; X is not a tool but a mirror; the language/currency/architecture of.\n33. No fake-candid hooks: Honestly?; Look; Here's the thing; The thing is; Let's be honest; Real talk.\n34. Do not answer unraised objections: This isn't (mainly) about; I'm not saying/arguing; To be clear; Don't get me wrong; This is not to say; You could argue... but; Some might say... but. Direct claims OK.\n35. Do not reject fake alternatives: A tempting option/approach would be; One might be tempted to; An obvious approach would be; You might think... but; It would be easy to just; Some would suggest. Keep real options a reader might choose.\n\nDo not over-flag alone: polish; mixed register; dry prose without stock tells; formal words outside #7; salutations/sign-offs; one however/additionally; curly quotes alone; one dash alone; one short emphatic sentence; deliberate repeated openings; honestly/look mid-sentence; useful scope/legal/safety limits; real alternatives; unsourced web claims; clean formatting; watched phrases inside quotes, titles, names, or examples under discussion. Several patterns together beat one.\n\nKeep: specific odd details; mixed feelings; era slang; deliberate first person; short/long mix; genuine asides or self-corrections.";
|
|
17
|
-
export declare const CONCISE_BEHAVIOR_PRESET = "# Concise (every reply)\n\nBe extremely concise. Sacrifice grammar for concision.\n\nPlans are not novels. Terminals read bottom-up. Scanning beats reading. Fewer tokens = faster and cheaper.\n\n## Brevity swaps\n| Instead of | Write |\n|---|---|\n| The user will be able to... | User can... |\n| This component is responsible for... | Handles... |\n| In order to achieve this, we need to... | Requires: |\n| It should be noted that... | (delete) |\n\nPrefer: fragments over full sentences; tables over paragraphs; bullets over prose; diagrams over descriptions.\n\n## Output order (always)\n1. Brief overview (2-3 sentences max)\n2. Main content (tables, bullets, diagrams)\n3. Unresolved questions (if any)\n4. Numbered action steps (ALWAYS LAST)\n\nUnresolved questions go before action steps as short bullets. Catch ambiguity before it becomes a bug.\n\n## Action steps (last visible block)\nEnd every non-trivial reply with concrete numbered next steps. Most important = most visible at the bottom.\n\n```\n## Next steps\n1. ...\n2. ...\n```\n\nTrivial yes/no or single-fact answers may skip the scaffold. Any plan, fix, design, or multi-step answer must end on numbered steps.\n\n## Anti-patterns\n| Don't | Do |\n|---|---|\n| Long prose explanations | Bullet points |\n| Nested sub-bullets (3+ levels) | Flat structure, tables |\n| \"Let me explain...\" | Just explain |\n| Repeating context | Reference by ID/name |\n| Hedging language | Direct statements |\n\n## Shape\nBad: The authentication system will need to handle user login. In order to accomplish this, we will need to implement a JWT-based mechanism that allows users to securely log in.\n\nGood:\nAuth: JWT login\n\n| Piece | Detail |\n|---|---|\n| Endpoint | POST /auth/login |\n| Token | JWT, 24h |\n| Guard | verify on protected routes |\n\n## Unresolved questions\n- OAuth provider? (Google, GitHub, both)\n- Session duration?\n\n## Next steps\n1. Add auth module at src/auth/\n2. Add JWT dependency\n3. Implement login endpoint\n4. Add tests";
|
|
18
|
-
export declare function isBehaviorPreset(value: unknown): value is BehaviorPreset;
|
|
19
|
-
export declare function isBuiltinBehaviorPreset(preset: BehaviorPreset): boolean;
|
|
20
|
-
export declare function behaviorFilePath(agentDir?: string): string;
|
|
21
|
-
export declare function normalizeBehaviorBody(text: string): string;
|
|
22
|
-
export declare function builtinBehaviorBody(preset: Exclude<BehaviorPreset, "custom">): string;
|
|
23
|
-
export declare function wrapBehaviorFile(body: string): string;
|
|
24
|
-
export declare function detectBehaviorPreset(fileText: string): BehaviorPreset;
|
|
25
|
-
export declare function readBehaviorFile(agentDir?: string): string;
|
|
26
|
-
export declare function writeBehaviorFile(body: string, agentDir?: string): void;
|
|
27
|
-
export declare function writeBehaviorPreset(preset: Exclude<BehaviorPreset, "custom">, agentDir?: string): void;
|
|
28
|
-
export type ApplyBehaviorPresetResult = {
|
|
29
|
-
ok: true;
|
|
30
|
-
preset: BehaviorPreset;
|
|
31
|
-
} | {
|
|
32
|
-
ok: false;
|
|
33
|
-
reason: "needs-overwrite";
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Persist a preset and, for built-ins, replace behavior.md.
|
|
37
|
-
* Custom never writes. Switching onto a built-in while the file is custom
|
|
38
|
-
* requires `{ overwrite: true }` so the settings UI can confirm first.
|
|
39
|
-
*/
|
|
40
|
-
export declare function applyBehaviorPreset(settingsManager: SettingsManager, preset: BehaviorPreset, agentDir?: string, options?: {
|
|
41
|
-
overwrite?: boolean;
|
|
42
|
-
}): ApplyBehaviorPresetResult;
|
|
43
|
-
/**
|
|
44
|
-
* Align the stored preset with the file.
|
|
45
|
-
* Custom stored always wins (file is the source of truth).
|
|
46
|
-
* A custom file while a built-in is stored flips the setting to custom.
|
|
47
|
-
* A missing/empty file while a non-default built-in is stored restores that template.
|
|
48
|
-
* A different built-in already on disk is adopted (file wins).
|
|
49
|
-
*/
|
|
50
|
-
export declare function reconcileBehaviorPreset(settingsManager: SettingsManager, agentDir?: string): BehaviorPreset;
|
|
51
|
-
export interface BehaviorPresetBridge {
|
|
52
|
-
getPreset(): BehaviorPreset;
|
|
53
|
-
setPreset(preset: BehaviorPreset): void;
|
|
54
|
-
isCapExempt(): boolean;
|
|
55
|
-
/** Fingerprint the current file text; persist custom when a built-in selection drifted. */
|
|
56
|
-
syncFromFile(fileText: string): BehaviorPreset;
|
|
57
|
-
}
|
|
58
|
-
export declare function registerBehaviorPresetBridge(settingsManager: SettingsManager): void;
|
|
59
|
-
export declare function getBehaviorPresetBridge(): BehaviorPresetBridge | undefined;
|
|
60
|
-
//# sourceMappingURL=behavior-preset.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"behavior-preset.d.ts","sourceRoot":"","sources":["../../src/core/behavior-preset.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D;;;;;;;GAOG;AAEH,eAAO,MAAM,6BAA6B,eAAsC,CAAC;AAEjF,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE5E,eAAO,MAAM,gBAAgB,EAAE,SAAS,cAAc,EAAkD,CAAC;AAEzG,eAAO,MAAM,eAAe,oGACiE,CAAC;AAE9F,4DAA4D;AAC5D,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C,eAAO,MAAM,yBAAyB,qnNA4C8F,CAAC;AAErI,eAAO,MAAM,uBAAuB,q+DAgEvB,CAAC;AAEd,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAExE;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAEvE;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,GAAE,MAAsB,GAAG,MAAM,CAEzE;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAO1D;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,EAAE,QAAQ,CAAC,GAAG,MAAM,CAIrF;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIrD;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,CAMrE;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAI1D;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAKvE;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAEtG;AAED,MAAM,MAAM,yBAAyB,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,cAAc,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,iBAAiB,CAAA;CAAE,CAAC;AAExH;;;;GAIG;AACH,wBAAgB,mBAAmB,CAClC,eAAe,EAAE,eAAe,EAChC,MAAM,EAAE,cAAc,EACtB,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAO,GACnC,yBAAyB,CAY3B;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,eAAe,EAAE,eAAe,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,cAAc,CAe3G;AAED,MAAM,WAAW,oBAAoB;IACpC,SAAS,IAAI,cAAc,CAAC;IAC5B,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IACxC,WAAW,IAAI,OAAO,CAAC;IACvB,2FAA2F;IAC3F,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,CAAC;CAC/C;AA4BD,wBAAgB,4BAA4B,CAAC,eAAe,EAAE,eAAe,GAAG,IAAI,CAGnF;AAED,wBAAgB,uBAAuB,IAAI,oBAAoB,GAAG,SAAS,CAE1E","sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { getAgentDir } from \"../config.ts\";\nimport type { SettingsManager } from \"./settings-manager.ts\";\n\n/**\n * Built-in behavior.md presets.\n *\n * Selecting default / humanizer / concise replaces ~/.lunr/agent/behavior.md.\n * Custom leaves the file alone. lunr-behavior re-reads the file every turn, so\n * hand edits apply without a watcher. Fingerprint the body (header comments\n * stripped) to detect drift off a built-in template.\n */\n\nexport const BEHAVIOR_PRESET_BRIDGE_SYMBOL = Symbol.for(\"@lunr/behavior-preset\");\n\nexport type BehaviorPreset = \"default\" | \"humanizer\" | \"concise\" | \"custom\";\n\nexport const BEHAVIOR_PRESETS: readonly BehaviorPreset[] = [\"default\", \"humanizer\", \"concise\", \"custom\"];\n\nexport const BEHAVIOR_HEADER =\n\t\"<!-- lunR behavior rules — one rule per line. Edit freely or use the behavior tools. -->\\n\";\n\n/** Empty on purpose. Default content is a later fill-in. */\nexport const DEFAULT_BEHAVIOR_PRESET = \"\";\n\nexport const HUMANIZER_BEHAVIOR_PRESET = `# Humanizer (every reply)\n\nWrite like a person. Keep real claims. Never invent facts, names, numbers, dates, quotes, citations, rankings, or sources. Missing detail: ask or simplify. Fiction exempt when inventing is the task.\n\nMatch user voice when known. Personality (opinions, mixed feelings, humor, I, asides, uneven rhythm) only for essays/opinions/personal prose. Technical, legal, reference, factual stay neutral. Never invent facts for voice. Apply on the reply itself (no rewrite pass).\n\n1. Inflated legacy. Avoid: stands/serves as; is a testament/reminder; vital/significant/crucial/pivotal/key role/moment; underscores/highlights its importance/significance; reflects broader; symbolizing its ongoing/enduring/lasting; contributing to the; setting the stage for; marking/shaping the; represents/marks a shift; key turning point; evolving landscape; focal point; indelible mark; deeply rooted.\n2. Status name-drops. Avoid: independent coverage; local/regional/national media outlets; written by a leading expert; active social media presence. Cite only with what was said and where.\n3. Shallow -ing tack-ons. Avoid: highlighting/underscoring/emphasizing; ensuring; reflecting/symbolizing; contributing to; cultivating/fostering; encompassing; showcasing.\n4. Sales tone. Avoid: boasts a; vibrant; rich (figurative); profound; enhancing its; showcasing; exemplifies; commitment to; natural beauty; nestled; in the heart of; groundbreaking (figurative); renowned; breathtaking; must-visit; stunning.\n5. Vague authorities. Avoid: Industry reports; Observers have cited; Experts argue; Some critics argue; several sources/publications (unnamed). Real source or drop claim. Never invent one.\n6. Stock challenges/outlook. Avoid: Despite its... faces several challenges; Despite these challenges; Challenges and Legacy; Future Outlook.\n7. Stock AI words (esp. clustered): Actually; additionally; align with; crucial; delve; emphasizing; enduring; enhance; fostering; garner; gate/gated/gating (figurative only; keep technical gate); highlight (verb); interplay; intricate/intricacies; key (adj); landscape (abstract); pivotal; quietly; showcase; tapestry (abstract); testament; underscore (verb); valuable; vibrant. Also: at the end of the day; when it comes to; in a world where; moving forward; circle back; deep dive; game-changer; double down; take a step back; on the same page; make no mistake; it turns out; let me be clear; navigate (for challenges); lean into; unpack (before analysis); straightforward (filler praise).\n8. Prefer is/are/has. Avoid: serves as/stands as/marks/represents [a]; boasts/features/offers [a].\n9. No not-X-but-Y or clipped negatives (Not only...but; It's not just X, it's Y; \"no guessing\"). Full clause.\n10. No forced groups of three for a complete-sounding list.\n11. No synonym cycling of one subject. No machine-repeated openings. One clear name. Deliberate rhythm OK.\n12. No false from-X-to-Y when ends are not a real scale.\n13. Prefer active voice with a clear subject.\n14. No em/en dash characters, spaced dash pairs, or double-hyphen used as a dash, unless the user uses them. Use period, comma, colon, or parentheses.\n15. No decorative bold on ordinary phrases.\n16. No bold-label lists (\\`- **Label:** text\\`). Normal bullets or prose.\n17. Headings in sentence case, not Title Case.\n18. No decorative emojis on headings or bullets.\n19. Straight quotes only, not curly quotes.\n20. No chatbot leftovers: I hope this helps; Of course!; Certainly!; You're absolutely right!; Would you like...; Want me to...?; Should I continue?; let me know; here is a...\n21. No cutoff padding or guessed biography: as of [date]; Up to my last training update; While specific details are limited/scarce; based on available information; not publicly available; maintains a low profile; keeps personal details private; prefers to stay out of the spotlight; likely [grew up/studied/began]; it is believed that. State unknown or omit. Never present a guess as fact.\n22. No sycophantic openers (Great question!; excellent point; absolutely right).\n23. Cut filler: In order to → To; Due to the fact that → Because; At this point in time → Now; In the event that → If; has the ability to → can; It is important to note that → (delete).\n24. One needed qualifier max. Avoid stacks: to be fair; it's also possible; could potentially; might arguably; in some cases it may; this is an inference.\n25. No generic positive endings (future looks bright; exciting times; journey toward excellence; step in the right direction). End on last concrete fact.\n26. Hyphen pairs: keep before a noun when needed (\\`high-quality report\\`); drop after (\\`report is high quality\\`). Watch: third-party; cross-functional; client-facing; data-driven; decision-making; well-known; high-quality; real-time; long-term; end-to-end.\n27. No deeper-truth framing: The real question is; at its core; in reality; what really matters; fundamentally; the deeper issue; the heart of the matter.\n28. Do not announce the next point: Let's dive in/explore/break this down; here's what you need to know; now let's look at; without further ado; heads up; quick note; before I forget.\n29. Do not restate a heading in the first sentence under it.\n30. Describe current behavior. Prior versions only in changelogs/release notes/migration guides.\n31. No forced punchlines or stacks of dramatic fragments. One short emphatic line OK.\n32. No formulaic sayings: X is the Y of Z; X becomes a trap; X is not a tool but a mirror; the language/currency/architecture of.\n33. No fake-candid hooks: Honestly?; Look; Here's the thing; The thing is; Let's be honest; Real talk.\n34. Do not answer unraised objections: This isn't (mainly) about; I'm not saying/arguing; To be clear; Don't get me wrong; This is not to say; You could argue... but; Some might say... but. Direct claims OK.\n35. Do not reject fake alternatives: A tempting option/approach would be; One might be tempted to; An obvious approach would be; You might think... but; It would be easy to just; Some would suggest. Keep real options a reader might choose.\n\nDo not over-flag alone: polish; mixed register; dry prose without stock tells; formal words outside #7; salutations/sign-offs; one however/additionally; curly quotes alone; one dash alone; one short emphatic sentence; deliberate repeated openings; honestly/look mid-sentence; useful scope/legal/safety limits; real alternatives; unsourced web claims; clean formatting; watched phrases inside quotes, titles, names, or examples under discussion. Several patterns together beat one.\n\nKeep: specific odd details; mixed feelings; era slang; deliberate first person; short/long mix; genuine asides or self-corrections.`;\n\nexport const CONCISE_BEHAVIOR_PRESET = `# Concise (every reply)\n\nBe extremely concise. Sacrifice grammar for concision.\n\nPlans are not novels. Terminals read bottom-up. Scanning beats reading. Fewer tokens = faster and cheaper.\n\n## Brevity swaps\n| Instead of | Write |\n|---|---|\n| The user will be able to... | User can... |\n| This component is responsible for... | Handles... |\n| In order to achieve this, we need to... | Requires: |\n| It should be noted that... | (delete) |\n\nPrefer: fragments over full sentences; tables over paragraphs; bullets over prose; diagrams over descriptions.\n\n## Output order (always)\n1. Brief overview (2-3 sentences max)\n2. Main content (tables, bullets, diagrams)\n3. Unresolved questions (if any)\n4. Numbered action steps (ALWAYS LAST)\n\nUnresolved questions go before action steps as short bullets. Catch ambiguity before it becomes a bug.\n\n## Action steps (last visible block)\nEnd every non-trivial reply with concrete numbered next steps. Most important = most visible at the bottom.\n\n\\`\\`\\`\n## Next steps\n1. ...\n2. ...\n\\`\\`\\`\n\nTrivial yes/no or single-fact answers may skip the scaffold. Any plan, fix, design, or multi-step answer must end on numbered steps.\n\n## Anti-patterns\n| Don't | Do |\n|---|---|\n| Long prose explanations | Bullet points |\n| Nested sub-bullets (3+ levels) | Flat structure, tables |\n| \"Let me explain...\" | Just explain |\n| Repeating context | Reference by ID/name |\n| Hedging language | Direct statements |\n\n## Shape\nBad: The authentication system will need to handle user login. In order to accomplish this, we will need to implement a JWT-based mechanism that allows users to securely log in.\n\nGood:\nAuth: JWT login\n\n| Piece | Detail |\n|---|---|\n| Endpoint | POST /auth/login |\n| Token | JWT, 24h |\n| Guard | verify on protected routes |\n\n## Unresolved questions\n- OAuth provider? (Google, GitHub, both)\n- Session duration?\n\n## Next steps\n1. Add auth module at src/auth/\n2. Add JWT dependency\n3. Implement login endpoint\n4. Add tests`;\n\nexport function isBehaviorPreset(value: unknown): value is BehaviorPreset {\n\treturn value === \"default\" || value === \"humanizer\" || value === \"concise\" || value === \"custom\";\n}\n\nexport function isBuiltinBehaviorPreset(preset: BehaviorPreset): boolean {\n\treturn preset === \"default\" || preset === \"humanizer\" || preset === \"concise\";\n}\n\nexport function behaviorFilePath(agentDir: string = getAgentDir()): string {\n\treturn join(agentDir, \"behavior.md\");\n}\n\nexport function normalizeBehaviorBody(text: string): string {\n\treturn text\n\t\t.replace(/\\r\\n/g, \"\\n\")\n\t\t.split(\"\\n\")\n\t\t.filter((line) => !line.startsWith(\"<!--\"))\n\t\t.join(\"\\n\")\n\t\t.trim();\n}\n\nexport function builtinBehaviorBody(preset: Exclude<BehaviorPreset, \"custom\">): string {\n\tif (preset === \"humanizer\") return HUMANIZER_BEHAVIOR_PRESET;\n\tif (preset === \"concise\") return CONCISE_BEHAVIOR_PRESET;\n\treturn DEFAULT_BEHAVIOR_PRESET;\n}\n\nexport function wrapBehaviorFile(body: string): string {\n\tconst trimmed = body.replace(/\\r\\n/g, \"\\n\").trim();\n\tif (!trimmed) return BEHAVIOR_HEADER;\n\treturn `${BEHAVIOR_HEADER}${trimmed}\\n`;\n}\n\nexport function detectBehaviorPreset(fileText: string): BehaviorPreset {\n\tconst body = normalizeBehaviorBody(fileText);\n\tif (body === normalizeBehaviorBody(HUMANIZER_BEHAVIOR_PRESET)) return \"humanizer\";\n\tif (body === normalizeBehaviorBody(CONCISE_BEHAVIOR_PRESET)) return \"concise\";\n\tif (body === normalizeBehaviorBody(DEFAULT_BEHAVIOR_PRESET)) return \"default\";\n\treturn \"custom\";\n}\n\nexport function readBehaviorFile(agentDir?: string): string {\n\tconst file = behaviorFilePath(agentDir);\n\tif (!existsSync(file)) return \"\";\n\treturn readFileSync(file, \"utf-8\");\n}\n\nexport function writeBehaviorFile(body: string, agentDir?: string): void {\n\tconst file = behaviorFilePath(agentDir);\n\tconst dir = agentDir ?? getAgentDir();\n\tif (!existsSync(dir)) mkdirSync(dir, { recursive: true });\n\twriteFileSync(file, wrapBehaviorFile(body), \"utf-8\");\n}\n\nexport function writeBehaviorPreset(preset: Exclude<BehaviorPreset, \"custom\">, agentDir?: string): void {\n\twriteBehaviorFile(builtinBehaviorBody(preset), agentDir);\n}\n\nexport type ApplyBehaviorPresetResult = { ok: true; preset: BehaviorPreset } | { ok: false; reason: \"needs-overwrite\" };\n\n/**\n * Persist a preset and, for built-ins, replace behavior.md.\n * Custom never writes. Switching onto a built-in while the file is custom\n * requires `{ overwrite: true }` so the settings UI can confirm first.\n */\nexport function applyBehaviorPreset(\n\tsettingsManager: SettingsManager,\n\tpreset: BehaviorPreset,\n\tagentDir?: string,\n\toptions: { overwrite?: boolean } = {},\n): ApplyBehaviorPresetResult {\n\tif (preset === \"custom\") {\n\t\tsettingsManager.setBehaviorPreset(\"custom\");\n\t\treturn { ok: true, preset: \"custom\" };\n\t}\n\tconst fingerprint = detectBehaviorPreset(readBehaviorFile(agentDir));\n\tif (fingerprint === \"custom\" && !options.overwrite) {\n\t\treturn { ok: false, reason: \"needs-overwrite\" };\n\t}\n\twriteBehaviorPreset(preset, agentDir);\n\tsettingsManager.setBehaviorPreset(preset);\n\treturn { ok: true, preset };\n}\n\n/**\n * Align the stored preset with the file.\n * Custom stored always wins (file is the source of truth).\n * A custom file while a built-in is stored flips the setting to custom.\n * A missing/empty file while a non-default built-in is stored restores that template.\n * A different built-in already on disk is adopted (file wins).\n */\nexport function reconcileBehaviorPreset(settingsManager: SettingsManager, agentDir?: string): BehaviorPreset {\n\tconst stored = settingsManager.getBehaviorPreset();\n\tconst fingerprint = detectBehaviorPreset(readBehaviorFile(agentDir));\n\tif (stored === \"custom\") return \"custom\";\n\tif (fingerprint === stored) return stored;\n\tif (fingerprint === \"custom\") {\n\t\tsettingsManager.setBehaviorPreset(\"custom\");\n\t\treturn \"custom\";\n\t}\n\tif (fingerprint === \"default\" && stored !== \"default\") {\n\t\twriteBehaviorPreset(stored, agentDir);\n\t\treturn stored;\n\t}\n\tsettingsManager.setBehaviorPreset(fingerprint);\n\treturn fingerprint;\n}\n\nexport interface BehaviorPresetBridge {\n\tgetPreset(): BehaviorPreset;\n\tsetPreset(preset: BehaviorPreset): void;\n\tisCapExempt(): boolean;\n\t/** Fingerprint the current file text; persist custom when a built-in selection drifted. */\n\tsyncFromFile(fileText: string): BehaviorPreset;\n}\n\nlet activeSettingsManager: SettingsManager | undefined;\n\nconst bridge: BehaviorPresetBridge = {\n\tgetPreset(): BehaviorPreset {\n\t\treturn activeSettingsManager?.getBehaviorPreset() ?? \"default\";\n\t},\n\tsetPreset(preset: BehaviorPreset): void {\n\t\tactiveSettingsManager?.setBehaviorPreset(preset);\n\t},\n\tisCapExempt(): boolean {\n\t\tconst preset = activeSettingsManager?.getBehaviorPreset() ?? \"default\";\n\t\treturn isBuiltinBehaviorPreset(preset);\n\t},\n\tsyncFromFile(fileText: string): BehaviorPreset {\n\t\tconst fingerprint = detectBehaviorPreset(fileText);\n\t\tconst stored = activeSettingsManager?.getBehaviorPreset() ?? \"default\";\n\t\t// Per-turn: only flip a built-in to custom when the file drifted. Restoring a\n\t\t// missing template or adopting another built-in is reconcileBehaviorPreset.\n\t\tif (stored !== \"custom\" && fingerprint === \"custom\") {\n\t\t\tactiveSettingsManager?.setBehaviorPreset(\"custom\");\n\t\t\treturn \"custom\";\n\t\t}\n\t\treturn stored;\n\t},\n};\n\nexport function registerBehaviorPresetBridge(settingsManager: SettingsManager): void {\n\tactiveSettingsManager = settingsManager;\n\t(globalThis as Record<symbol, unknown>)[BEHAVIOR_PRESET_BRIDGE_SYMBOL] = bridge;\n}\n\nexport function getBehaviorPresetBridge(): BehaviorPresetBridge | undefined {\n\treturn (globalThis as Record<symbol, unknown>)[BEHAVIOR_PRESET_BRIDGE_SYMBOL] as BehaviorPresetBridge | undefined;\n}\n"]}
|
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { getAgentDir } from "../config.js";
|
|
4
|
-
/**
|
|
5
|
-
* Built-in behavior.md presets.
|
|
6
|
-
*
|
|
7
|
-
* Selecting default / humanizer / concise replaces ~/.lunr/agent/behavior.md.
|
|
8
|
-
* Custom leaves the file alone. lunr-behavior re-reads the file every turn, so
|
|
9
|
-
* hand edits apply without a watcher. Fingerprint the body (header comments
|
|
10
|
-
* stripped) to detect drift off a built-in template.
|
|
11
|
-
*/
|
|
12
|
-
export const BEHAVIOR_PRESET_BRIDGE_SYMBOL = Symbol.for("@lunr/behavior-preset");
|
|
13
|
-
export const BEHAVIOR_PRESETS = ["default", "humanizer", "concise", "custom"];
|
|
14
|
-
export const BEHAVIOR_HEADER = "<!-- lunR behavior rules — one rule per line. Edit freely or use the behavior tools. -->\n";
|
|
15
|
-
/** Empty on purpose. Default content is a later fill-in. */
|
|
16
|
-
export const DEFAULT_BEHAVIOR_PRESET = "";
|
|
17
|
-
export const HUMANIZER_BEHAVIOR_PRESET = `# Humanizer (every reply)
|
|
18
|
-
|
|
19
|
-
Write like a person. Keep real claims. Never invent facts, names, numbers, dates, quotes, citations, rankings, or sources. Missing detail: ask or simplify. Fiction exempt when inventing is the task.
|
|
20
|
-
|
|
21
|
-
Match user voice when known. Personality (opinions, mixed feelings, humor, I, asides, uneven rhythm) only for essays/opinions/personal prose. Technical, legal, reference, factual stay neutral. Never invent facts for voice. Apply on the reply itself (no rewrite pass).
|
|
22
|
-
|
|
23
|
-
1. Inflated legacy. Avoid: stands/serves as; is a testament/reminder; vital/significant/crucial/pivotal/key role/moment; underscores/highlights its importance/significance; reflects broader; symbolizing its ongoing/enduring/lasting; contributing to the; setting the stage for; marking/shaping the; represents/marks a shift; key turning point; evolving landscape; focal point; indelible mark; deeply rooted.
|
|
24
|
-
2. Status name-drops. Avoid: independent coverage; local/regional/national media outlets; written by a leading expert; active social media presence. Cite only with what was said and where.
|
|
25
|
-
3. Shallow -ing tack-ons. Avoid: highlighting/underscoring/emphasizing; ensuring; reflecting/symbolizing; contributing to; cultivating/fostering; encompassing; showcasing.
|
|
26
|
-
4. Sales tone. Avoid: boasts a; vibrant; rich (figurative); profound; enhancing its; showcasing; exemplifies; commitment to; natural beauty; nestled; in the heart of; groundbreaking (figurative); renowned; breathtaking; must-visit; stunning.
|
|
27
|
-
5. Vague authorities. Avoid: Industry reports; Observers have cited; Experts argue; Some critics argue; several sources/publications (unnamed). Real source or drop claim. Never invent one.
|
|
28
|
-
6. Stock challenges/outlook. Avoid: Despite its... faces several challenges; Despite these challenges; Challenges and Legacy; Future Outlook.
|
|
29
|
-
7. Stock AI words (esp. clustered): Actually; additionally; align with; crucial; delve; emphasizing; enduring; enhance; fostering; garner; gate/gated/gating (figurative only; keep technical gate); highlight (verb); interplay; intricate/intricacies; key (adj); landscape (abstract); pivotal; quietly; showcase; tapestry (abstract); testament; underscore (verb); valuable; vibrant. Also: at the end of the day; when it comes to; in a world where; moving forward; circle back; deep dive; game-changer; double down; take a step back; on the same page; make no mistake; it turns out; let me be clear; navigate (for challenges); lean into; unpack (before analysis); straightforward (filler praise).
|
|
30
|
-
8. Prefer is/are/has. Avoid: serves as/stands as/marks/represents [a]; boasts/features/offers [a].
|
|
31
|
-
9. No not-X-but-Y or clipped negatives (Not only...but; It's not just X, it's Y; "no guessing"). Full clause.
|
|
32
|
-
10. No forced groups of three for a complete-sounding list.
|
|
33
|
-
11. No synonym cycling of one subject. No machine-repeated openings. One clear name. Deliberate rhythm OK.
|
|
34
|
-
12. No false from-X-to-Y when ends are not a real scale.
|
|
35
|
-
13. Prefer active voice with a clear subject.
|
|
36
|
-
14. No em/en dash characters, spaced dash pairs, or double-hyphen used as a dash, unless the user uses them. Use period, comma, colon, or parentheses.
|
|
37
|
-
15. No decorative bold on ordinary phrases.
|
|
38
|
-
16. No bold-label lists (\`- **Label:** text\`). Normal bullets or prose.
|
|
39
|
-
17. Headings in sentence case, not Title Case.
|
|
40
|
-
18. No decorative emojis on headings or bullets.
|
|
41
|
-
19. Straight quotes only, not curly quotes.
|
|
42
|
-
20. No chatbot leftovers: I hope this helps; Of course!; Certainly!; You're absolutely right!; Would you like...; Want me to...?; Should I continue?; let me know; here is a...
|
|
43
|
-
21. No cutoff padding or guessed biography: as of [date]; Up to my last training update; While specific details are limited/scarce; based on available information; not publicly available; maintains a low profile; keeps personal details private; prefers to stay out of the spotlight; likely [grew up/studied/began]; it is believed that. State unknown or omit. Never present a guess as fact.
|
|
44
|
-
22. No sycophantic openers (Great question!; excellent point; absolutely right).
|
|
45
|
-
23. Cut filler: In order to → To; Due to the fact that → Because; At this point in time → Now; In the event that → If; has the ability to → can; It is important to note that → (delete).
|
|
46
|
-
24. One needed qualifier max. Avoid stacks: to be fair; it's also possible; could potentially; might arguably; in some cases it may; this is an inference.
|
|
47
|
-
25. No generic positive endings (future looks bright; exciting times; journey toward excellence; step in the right direction). End on last concrete fact.
|
|
48
|
-
26. Hyphen pairs: keep before a noun when needed (\`high-quality report\`); drop after (\`report is high quality\`). Watch: third-party; cross-functional; client-facing; data-driven; decision-making; well-known; high-quality; real-time; long-term; end-to-end.
|
|
49
|
-
27. No deeper-truth framing: The real question is; at its core; in reality; what really matters; fundamentally; the deeper issue; the heart of the matter.
|
|
50
|
-
28. Do not announce the next point: Let's dive in/explore/break this down; here's what you need to know; now let's look at; without further ado; heads up; quick note; before I forget.
|
|
51
|
-
29. Do not restate a heading in the first sentence under it.
|
|
52
|
-
30. Describe current behavior. Prior versions only in changelogs/release notes/migration guides.
|
|
53
|
-
31. No forced punchlines or stacks of dramatic fragments. One short emphatic line OK.
|
|
54
|
-
32. No formulaic sayings: X is the Y of Z; X becomes a trap; X is not a tool but a mirror; the language/currency/architecture of.
|
|
55
|
-
33. No fake-candid hooks: Honestly?; Look; Here's the thing; The thing is; Let's be honest; Real talk.
|
|
56
|
-
34. Do not answer unraised objections: This isn't (mainly) about; I'm not saying/arguing; To be clear; Don't get me wrong; This is not to say; You could argue... but; Some might say... but. Direct claims OK.
|
|
57
|
-
35. Do not reject fake alternatives: A tempting option/approach would be; One might be tempted to; An obvious approach would be; You might think... but; It would be easy to just; Some would suggest. Keep real options a reader might choose.
|
|
58
|
-
|
|
59
|
-
Do not over-flag alone: polish; mixed register; dry prose without stock tells; formal words outside #7; salutations/sign-offs; one however/additionally; curly quotes alone; one dash alone; one short emphatic sentence; deliberate repeated openings; honestly/look mid-sentence; useful scope/legal/safety limits; real alternatives; unsourced web claims; clean formatting; watched phrases inside quotes, titles, names, or examples under discussion. Several patterns together beat one.
|
|
60
|
-
|
|
61
|
-
Keep: specific odd details; mixed feelings; era slang; deliberate first person; short/long mix; genuine asides or self-corrections.`;
|
|
62
|
-
export const CONCISE_BEHAVIOR_PRESET = `# Concise (every reply)
|
|
63
|
-
|
|
64
|
-
Be extremely concise. Sacrifice grammar for concision.
|
|
65
|
-
|
|
66
|
-
Plans are not novels. Terminals read bottom-up. Scanning beats reading. Fewer tokens = faster and cheaper.
|
|
67
|
-
|
|
68
|
-
## Brevity swaps
|
|
69
|
-
| Instead of | Write |
|
|
70
|
-
|---|---|
|
|
71
|
-
| The user will be able to... | User can... |
|
|
72
|
-
| This component is responsible for... | Handles... |
|
|
73
|
-
| In order to achieve this, we need to... | Requires: |
|
|
74
|
-
| It should be noted that... | (delete) |
|
|
75
|
-
|
|
76
|
-
Prefer: fragments over full sentences; tables over paragraphs; bullets over prose; diagrams over descriptions.
|
|
77
|
-
|
|
78
|
-
## Output order (always)
|
|
79
|
-
1. Brief overview (2-3 sentences max)
|
|
80
|
-
2. Main content (tables, bullets, diagrams)
|
|
81
|
-
3. Unresolved questions (if any)
|
|
82
|
-
4. Numbered action steps (ALWAYS LAST)
|
|
83
|
-
|
|
84
|
-
Unresolved questions go before action steps as short bullets. Catch ambiguity before it becomes a bug.
|
|
85
|
-
|
|
86
|
-
## Action steps (last visible block)
|
|
87
|
-
End every non-trivial reply with concrete numbered next steps. Most important = most visible at the bottom.
|
|
88
|
-
|
|
89
|
-
\`\`\`
|
|
90
|
-
## Next steps
|
|
91
|
-
1. ...
|
|
92
|
-
2. ...
|
|
93
|
-
\`\`\`
|
|
94
|
-
|
|
95
|
-
Trivial yes/no or single-fact answers may skip the scaffold. Any plan, fix, design, or multi-step answer must end on numbered steps.
|
|
96
|
-
|
|
97
|
-
## Anti-patterns
|
|
98
|
-
| Don't | Do |
|
|
99
|
-
|---|---|
|
|
100
|
-
| Long prose explanations | Bullet points |
|
|
101
|
-
| Nested sub-bullets (3+ levels) | Flat structure, tables |
|
|
102
|
-
| "Let me explain..." | Just explain |
|
|
103
|
-
| Repeating context | Reference by ID/name |
|
|
104
|
-
| Hedging language | Direct statements |
|
|
105
|
-
|
|
106
|
-
## Shape
|
|
107
|
-
Bad: The authentication system will need to handle user login. In order to accomplish this, we will need to implement a JWT-based mechanism that allows users to securely log in.
|
|
108
|
-
|
|
109
|
-
Good:
|
|
110
|
-
Auth: JWT login
|
|
111
|
-
|
|
112
|
-
| Piece | Detail |
|
|
113
|
-
|---|---|
|
|
114
|
-
| Endpoint | POST /auth/login |
|
|
115
|
-
| Token | JWT, 24h |
|
|
116
|
-
| Guard | verify on protected routes |
|
|
117
|
-
|
|
118
|
-
## Unresolved questions
|
|
119
|
-
- OAuth provider? (Google, GitHub, both)
|
|
120
|
-
- Session duration?
|
|
121
|
-
|
|
122
|
-
## Next steps
|
|
123
|
-
1. Add auth module at src/auth/
|
|
124
|
-
2. Add JWT dependency
|
|
125
|
-
3. Implement login endpoint
|
|
126
|
-
4. Add tests`;
|
|
127
|
-
export function isBehaviorPreset(value) {
|
|
128
|
-
return value === "default" || value === "humanizer" || value === "concise" || value === "custom";
|
|
129
|
-
}
|
|
130
|
-
export function isBuiltinBehaviorPreset(preset) {
|
|
131
|
-
return preset === "default" || preset === "humanizer" || preset === "concise";
|
|
132
|
-
}
|
|
133
|
-
export function behaviorFilePath(agentDir = getAgentDir()) {
|
|
134
|
-
return join(agentDir, "behavior.md");
|
|
135
|
-
}
|
|
136
|
-
export function normalizeBehaviorBody(text) {
|
|
137
|
-
return text
|
|
138
|
-
.replace(/\r\n/g, "\n")
|
|
139
|
-
.split("\n")
|
|
140
|
-
.filter((line) => !line.startsWith("<!--"))
|
|
141
|
-
.join("\n")
|
|
142
|
-
.trim();
|
|
143
|
-
}
|
|
144
|
-
export function builtinBehaviorBody(preset) {
|
|
145
|
-
if (preset === "humanizer")
|
|
146
|
-
return HUMANIZER_BEHAVIOR_PRESET;
|
|
147
|
-
if (preset === "concise")
|
|
148
|
-
return CONCISE_BEHAVIOR_PRESET;
|
|
149
|
-
return DEFAULT_BEHAVIOR_PRESET;
|
|
150
|
-
}
|
|
151
|
-
export function wrapBehaviorFile(body) {
|
|
152
|
-
const trimmed = body.replace(/\r\n/g, "\n").trim();
|
|
153
|
-
if (!trimmed)
|
|
154
|
-
return BEHAVIOR_HEADER;
|
|
155
|
-
return `${BEHAVIOR_HEADER}${trimmed}\n`;
|
|
156
|
-
}
|
|
157
|
-
export function detectBehaviorPreset(fileText) {
|
|
158
|
-
const body = normalizeBehaviorBody(fileText);
|
|
159
|
-
if (body === normalizeBehaviorBody(HUMANIZER_BEHAVIOR_PRESET))
|
|
160
|
-
return "humanizer";
|
|
161
|
-
if (body === normalizeBehaviorBody(CONCISE_BEHAVIOR_PRESET))
|
|
162
|
-
return "concise";
|
|
163
|
-
if (body === normalizeBehaviorBody(DEFAULT_BEHAVIOR_PRESET))
|
|
164
|
-
return "default";
|
|
165
|
-
return "custom";
|
|
166
|
-
}
|
|
167
|
-
export function readBehaviorFile(agentDir) {
|
|
168
|
-
const file = behaviorFilePath(agentDir);
|
|
169
|
-
if (!existsSync(file))
|
|
170
|
-
return "";
|
|
171
|
-
return readFileSync(file, "utf-8");
|
|
172
|
-
}
|
|
173
|
-
export function writeBehaviorFile(body, agentDir) {
|
|
174
|
-
const file = behaviorFilePath(agentDir);
|
|
175
|
-
const dir = agentDir ?? getAgentDir();
|
|
176
|
-
if (!existsSync(dir))
|
|
177
|
-
mkdirSync(dir, { recursive: true });
|
|
178
|
-
writeFileSync(file, wrapBehaviorFile(body), "utf-8");
|
|
179
|
-
}
|
|
180
|
-
export function writeBehaviorPreset(preset, agentDir) {
|
|
181
|
-
writeBehaviorFile(builtinBehaviorBody(preset), agentDir);
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Persist a preset and, for built-ins, replace behavior.md.
|
|
185
|
-
* Custom never writes. Switching onto a built-in while the file is custom
|
|
186
|
-
* requires `{ overwrite: true }` so the settings UI can confirm first.
|
|
187
|
-
*/
|
|
188
|
-
export function applyBehaviorPreset(settingsManager, preset, agentDir, options = {}) {
|
|
189
|
-
if (preset === "custom") {
|
|
190
|
-
settingsManager.setBehaviorPreset("custom");
|
|
191
|
-
return { ok: true, preset: "custom" };
|
|
192
|
-
}
|
|
193
|
-
const fingerprint = detectBehaviorPreset(readBehaviorFile(agentDir));
|
|
194
|
-
if (fingerprint === "custom" && !options.overwrite) {
|
|
195
|
-
return { ok: false, reason: "needs-overwrite" };
|
|
196
|
-
}
|
|
197
|
-
writeBehaviorPreset(preset, agentDir);
|
|
198
|
-
settingsManager.setBehaviorPreset(preset);
|
|
199
|
-
return { ok: true, preset };
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Align the stored preset with the file.
|
|
203
|
-
* Custom stored always wins (file is the source of truth).
|
|
204
|
-
* A custom file while a built-in is stored flips the setting to custom.
|
|
205
|
-
* A missing/empty file while a non-default built-in is stored restores that template.
|
|
206
|
-
* A different built-in already on disk is adopted (file wins).
|
|
207
|
-
*/
|
|
208
|
-
export function reconcileBehaviorPreset(settingsManager, agentDir) {
|
|
209
|
-
const stored = settingsManager.getBehaviorPreset();
|
|
210
|
-
const fingerprint = detectBehaviorPreset(readBehaviorFile(agentDir));
|
|
211
|
-
if (stored === "custom")
|
|
212
|
-
return "custom";
|
|
213
|
-
if (fingerprint === stored)
|
|
214
|
-
return stored;
|
|
215
|
-
if (fingerprint === "custom") {
|
|
216
|
-
settingsManager.setBehaviorPreset("custom");
|
|
217
|
-
return "custom";
|
|
218
|
-
}
|
|
219
|
-
if (fingerprint === "default" && stored !== "default") {
|
|
220
|
-
writeBehaviorPreset(stored, agentDir);
|
|
221
|
-
return stored;
|
|
222
|
-
}
|
|
223
|
-
settingsManager.setBehaviorPreset(fingerprint);
|
|
224
|
-
return fingerprint;
|
|
225
|
-
}
|
|
226
|
-
let activeSettingsManager;
|
|
227
|
-
const bridge = {
|
|
228
|
-
getPreset() {
|
|
229
|
-
return activeSettingsManager?.getBehaviorPreset() ?? "default";
|
|
230
|
-
},
|
|
231
|
-
setPreset(preset) {
|
|
232
|
-
activeSettingsManager?.setBehaviorPreset(preset);
|
|
233
|
-
},
|
|
234
|
-
isCapExempt() {
|
|
235
|
-
const preset = activeSettingsManager?.getBehaviorPreset() ?? "default";
|
|
236
|
-
return isBuiltinBehaviorPreset(preset);
|
|
237
|
-
},
|
|
238
|
-
syncFromFile(fileText) {
|
|
239
|
-
const fingerprint = detectBehaviorPreset(fileText);
|
|
240
|
-
const stored = activeSettingsManager?.getBehaviorPreset() ?? "default";
|
|
241
|
-
// Per-turn: only flip a built-in to custom when the file drifted. Restoring a
|
|
242
|
-
// missing template or adopting another built-in is reconcileBehaviorPreset.
|
|
243
|
-
if (stored !== "custom" && fingerprint === "custom") {
|
|
244
|
-
activeSettingsManager?.setBehaviorPreset("custom");
|
|
245
|
-
return "custom";
|
|
246
|
-
}
|
|
247
|
-
return stored;
|
|
248
|
-
},
|
|
249
|
-
};
|
|
250
|
-
export function registerBehaviorPresetBridge(settingsManager) {
|
|
251
|
-
activeSettingsManager = settingsManager;
|
|
252
|
-
globalThis[BEHAVIOR_PRESET_BRIDGE_SYMBOL] = bridge;
|
|
253
|
-
}
|
|
254
|
-
export function getBehaviorPresetBridge() {
|
|
255
|
-
return globalThis[BEHAVIOR_PRESET_BRIDGE_SYMBOL];
|
|
256
|
-
}
|
|
257
|
-
//# sourceMappingURL=behavior-preset.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"behavior-preset.js","sourceRoot":"","sources":["../../src/core/behavior-preset.ts"],"names":[],"mappings":"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","sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { getAgentDir } from \"../config.ts\";\nimport type { SettingsManager } from \"./settings-manager.ts\";\n\n/**\n * Built-in behavior.md presets.\n *\n * Selecting default / humanizer / concise replaces ~/.lunr/agent/behavior.md.\n * Custom leaves the file alone. lunr-behavior re-reads the file every turn, so\n * hand edits apply without a watcher. Fingerprint the body (header comments\n * stripped) to detect drift off a built-in template.\n */\n\nexport const BEHAVIOR_PRESET_BRIDGE_SYMBOL = Symbol.for(\"@lunr/behavior-preset\");\n\nexport type BehaviorPreset = \"default\" | \"humanizer\" | \"concise\" | \"custom\";\n\nexport const BEHAVIOR_PRESETS: readonly BehaviorPreset[] = [\"default\", \"humanizer\", \"concise\", \"custom\"];\n\nexport const BEHAVIOR_HEADER =\n\t\"<!-- lunR behavior rules — one rule per line. Edit freely or use the behavior tools. -->\\n\";\n\n/** Empty on purpose. Default content is a later fill-in. */\nexport const DEFAULT_BEHAVIOR_PRESET = \"\";\n\nexport const HUMANIZER_BEHAVIOR_PRESET = `# Humanizer (every reply)\n\nWrite like a person. Keep real claims. Never invent facts, names, numbers, dates, quotes, citations, rankings, or sources. Missing detail: ask or simplify. Fiction exempt when inventing is the task.\n\nMatch user voice when known. Personality (opinions, mixed feelings, humor, I, asides, uneven rhythm) only for essays/opinions/personal prose. Technical, legal, reference, factual stay neutral. Never invent facts for voice. Apply on the reply itself (no rewrite pass).\n\n1. Inflated legacy. Avoid: stands/serves as; is a testament/reminder; vital/significant/crucial/pivotal/key role/moment; underscores/highlights its importance/significance; reflects broader; symbolizing its ongoing/enduring/lasting; contributing to the; setting the stage for; marking/shaping the; represents/marks a shift; key turning point; evolving landscape; focal point; indelible mark; deeply rooted.\n2. Status name-drops. Avoid: independent coverage; local/regional/national media outlets; written by a leading expert; active social media presence. Cite only with what was said and where.\n3. Shallow -ing tack-ons. Avoid: highlighting/underscoring/emphasizing; ensuring; reflecting/symbolizing; contributing to; cultivating/fostering; encompassing; showcasing.\n4. Sales tone. Avoid: boasts a; vibrant; rich (figurative); profound; enhancing its; showcasing; exemplifies; commitment to; natural beauty; nestled; in the heart of; groundbreaking (figurative); renowned; breathtaking; must-visit; stunning.\n5. Vague authorities. Avoid: Industry reports; Observers have cited; Experts argue; Some critics argue; several sources/publications (unnamed). Real source or drop claim. Never invent one.\n6. Stock challenges/outlook. Avoid: Despite its... faces several challenges; Despite these challenges; Challenges and Legacy; Future Outlook.\n7. Stock AI words (esp. clustered): Actually; additionally; align with; crucial; delve; emphasizing; enduring; enhance; fostering; garner; gate/gated/gating (figurative only; keep technical gate); highlight (verb); interplay; intricate/intricacies; key (adj); landscape (abstract); pivotal; quietly; showcase; tapestry (abstract); testament; underscore (verb); valuable; vibrant. Also: at the end of the day; when it comes to; in a world where; moving forward; circle back; deep dive; game-changer; double down; take a step back; on the same page; make no mistake; it turns out; let me be clear; navigate (for challenges); lean into; unpack (before analysis); straightforward (filler praise).\n8. Prefer is/are/has. Avoid: serves as/stands as/marks/represents [a]; boasts/features/offers [a].\n9. No not-X-but-Y or clipped negatives (Not only...but; It's not just X, it's Y; \"no guessing\"). Full clause.\n10. No forced groups of three for a complete-sounding list.\n11. No synonym cycling of one subject. No machine-repeated openings. One clear name. Deliberate rhythm OK.\n12. No false from-X-to-Y when ends are not a real scale.\n13. Prefer active voice with a clear subject.\n14. No em/en dash characters, spaced dash pairs, or double-hyphen used as a dash, unless the user uses them. Use period, comma, colon, or parentheses.\n15. No decorative bold on ordinary phrases.\n16. No bold-label lists (\\`- **Label:** text\\`). Normal bullets or prose.\n17. Headings in sentence case, not Title Case.\n18. No decorative emojis on headings or bullets.\n19. Straight quotes only, not curly quotes.\n20. No chatbot leftovers: I hope this helps; Of course!; Certainly!; You're absolutely right!; Would you like...; Want me to...?; Should I continue?; let me know; here is a...\n21. No cutoff padding or guessed biography: as of [date]; Up to my last training update; While specific details are limited/scarce; based on available information; not publicly available; maintains a low profile; keeps personal details private; prefers to stay out of the spotlight; likely [grew up/studied/began]; it is believed that. State unknown or omit. Never present a guess as fact.\n22. No sycophantic openers (Great question!; excellent point; absolutely right).\n23. Cut filler: In order to → To; Due to the fact that → Because; At this point in time → Now; In the event that → If; has the ability to → can; It is important to note that → (delete).\n24. One needed qualifier max. Avoid stacks: to be fair; it's also possible; could potentially; might arguably; in some cases it may; this is an inference.\n25. No generic positive endings (future looks bright; exciting times; journey toward excellence; step in the right direction). End on last concrete fact.\n26. Hyphen pairs: keep before a noun when needed (\\`high-quality report\\`); drop after (\\`report is high quality\\`). Watch: third-party; cross-functional; client-facing; data-driven; decision-making; well-known; high-quality; real-time; long-term; end-to-end.\n27. No deeper-truth framing: The real question is; at its core; in reality; what really matters; fundamentally; the deeper issue; the heart of the matter.\n28. Do not announce the next point: Let's dive in/explore/break this down; here's what you need to know; now let's look at; without further ado; heads up; quick note; before I forget.\n29. Do not restate a heading in the first sentence under it.\n30. Describe current behavior. Prior versions only in changelogs/release notes/migration guides.\n31. No forced punchlines or stacks of dramatic fragments. One short emphatic line OK.\n32. No formulaic sayings: X is the Y of Z; X becomes a trap; X is not a tool but a mirror; the language/currency/architecture of.\n33. No fake-candid hooks: Honestly?; Look; Here's the thing; The thing is; Let's be honest; Real talk.\n34. Do not answer unraised objections: This isn't (mainly) about; I'm not saying/arguing; To be clear; Don't get me wrong; This is not to say; You could argue... but; Some might say... but. Direct claims OK.\n35. Do not reject fake alternatives: A tempting option/approach would be; One might be tempted to; An obvious approach would be; You might think... but; It would be easy to just; Some would suggest. Keep real options a reader might choose.\n\nDo not over-flag alone: polish; mixed register; dry prose without stock tells; formal words outside #7; salutations/sign-offs; one however/additionally; curly quotes alone; one dash alone; one short emphatic sentence; deliberate repeated openings; honestly/look mid-sentence; useful scope/legal/safety limits; real alternatives; unsourced web claims; clean formatting; watched phrases inside quotes, titles, names, or examples under discussion. Several patterns together beat one.\n\nKeep: specific odd details; mixed feelings; era slang; deliberate first person; short/long mix; genuine asides or self-corrections.`;\n\nexport const CONCISE_BEHAVIOR_PRESET = `# Concise (every reply)\n\nBe extremely concise. Sacrifice grammar for concision.\n\nPlans are not novels. Terminals read bottom-up. Scanning beats reading. Fewer tokens = faster and cheaper.\n\n## Brevity swaps\n| Instead of | Write |\n|---|---|\n| The user will be able to... | User can... |\n| This component is responsible for... | Handles... |\n| In order to achieve this, we need to... | Requires: |\n| It should be noted that... | (delete) |\n\nPrefer: fragments over full sentences; tables over paragraphs; bullets over prose; diagrams over descriptions.\n\n## Output order (always)\n1. Brief overview (2-3 sentences max)\n2. Main content (tables, bullets, diagrams)\n3. Unresolved questions (if any)\n4. Numbered action steps (ALWAYS LAST)\n\nUnresolved questions go before action steps as short bullets. Catch ambiguity before it becomes a bug.\n\n## Action steps (last visible block)\nEnd every non-trivial reply with concrete numbered next steps. Most important = most visible at the bottom.\n\n\\`\\`\\`\n## Next steps\n1. ...\n2. ...\n\\`\\`\\`\n\nTrivial yes/no or single-fact answers may skip the scaffold. Any plan, fix, design, or multi-step answer must end on numbered steps.\n\n## Anti-patterns\n| Don't | Do |\n|---|---|\n| Long prose explanations | Bullet points |\n| Nested sub-bullets (3+ levels) | Flat structure, tables |\n| \"Let me explain...\" | Just explain |\n| Repeating context | Reference by ID/name |\n| Hedging language | Direct statements |\n\n## Shape\nBad: The authentication system will need to handle user login. In order to accomplish this, we will need to implement a JWT-based mechanism that allows users to securely log in.\n\nGood:\nAuth: JWT login\n\n| Piece | Detail |\n|---|---|\n| Endpoint | POST /auth/login |\n| Token | JWT, 24h |\n| Guard | verify on protected routes |\n\n## Unresolved questions\n- OAuth provider? (Google, GitHub, both)\n- Session duration?\n\n## Next steps\n1. Add auth module at src/auth/\n2. Add JWT dependency\n3. Implement login endpoint\n4. Add tests`;\n\nexport function isBehaviorPreset(value: unknown): value is BehaviorPreset {\n\treturn value === \"default\" || value === \"humanizer\" || value === \"concise\" || value === \"custom\";\n}\n\nexport function isBuiltinBehaviorPreset(preset: BehaviorPreset): boolean {\n\treturn preset === \"default\" || preset === \"humanizer\" || preset === \"concise\";\n}\n\nexport function behaviorFilePath(agentDir: string = getAgentDir()): string {\n\treturn join(agentDir, \"behavior.md\");\n}\n\nexport function normalizeBehaviorBody(text: string): string {\n\treturn text\n\t\t.replace(/\\r\\n/g, \"\\n\")\n\t\t.split(\"\\n\")\n\t\t.filter((line) => !line.startsWith(\"<!--\"))\n\t\t.join(\"\\n\")\n\t\t.trim();\n}\n\nexport function builtinBehaviorBody(preset: Exclude<BehaviorPreset, \"custom\">): string {\n\tif (preset === \"humanizer\") return HUMANIZER_BEHAVIOR_PRESET;\n\tif (preset === \"concise\") return CONCISE_BEHAVIOR_PRESET;\n\treturn DEFAULT_BEHAVIOR_PRESET;\n}\n\nexport function wrapBehaviorFile(body: string): string {\n\tconst trimmed = body.replace(/\\r\\n/g, \"\\n\").trim();\n\tif (!trimmed) return BEHAVIOR_HEADER;\n\treturn `${BEHAVIOR_HEADER}${trimmed}\\n`;\n}\n\nexport function detectBehaviorPreset(fileText: string): BehaviorPreset {\n\tconst body = normalizeBehaviorBody(fileText);\n\tif (body === normalizeBehaviorBody(HUMANIZER_BEHAVIOR_PRESET)) return \"humanizer\";\n\tif (body === normalizeBehaviorBody(CONCISE_BEHAVIOR_PRESET)) return \"concise\";\n\tif (body === normalizeBehaviorBody(DEFAULT_BEHAVIOR_PRESET)) return \"default\";\n\treturn \"custom\";\n}\n\nexport function readBehaviorFile(agentDir?: string): string {\n\tconst file = behaviorFilePath(agentDir);\n\tif (!existsSync(file)) return \"\";\n\treturn readFileSync(file, \"utf-8\");\n}\n\nexport function writeBehaviorFile(body: string, agentDir?: string): void {\n\tconst file = behaviorFilePath(agentDir);\n\tconst dir = agentDir ?? getAgentDir();\n\tif (!existsSync(dir)) mkdirSync(dir, { recursive: true });\n\twriteFileSync(file, wrapBehaviorFile(body), \"utf-8\");\n}\n\nexport function writeBehaviorPreset(preset: Exclude<BehaviorPreset, \"custom\">, agentDir?: string): void {\n\twriteBehaviorFile(builtinBehaviorBody(preset), agentDir);\n}\n\nexport type ApplyBehaviorPresetResult = { ok: true; preset: BehaviorPreset } | { ok: false; reason: \"needs-overwrite\" };\n\n/**\n * Persist a preset and, for built-ins, replace behavior.md.\n * Custom never writes. Switching onto a built-in while the file is custom\n * requires `{ overwrite: true }` so the settings UI can confirm first.\n */\nexport function applyBehaviorPreset(\n\tsettingsManager: SettingsManager,\n\tpreset: BehaviorPreset,\n\tagentDir?: string,\n\toptions: { overwrite?: boolean } = {},\n): ApplyBehaviorPresetResult {\n\tif (preset === \"custom\") {\n\t\tsettingsManager.setBehaviorPreset(\"custom\");\n\t\treturn { ok: true, preset: \"custom\" };\n\t}\n\tconst fingerprint = detectBehaviorPreset(readBehaviorFile(agentDir));\n\tif (fingerprint === \"custom\" && !options.overwrite) {\n\t\treturn { ok: false, reason: \"needs-overwrite\" };\n\t}\n\twriteBehaviorPreset(preset, agentDir);\n\tsettingsManager.setBehaviorPreset(preset);\n\treturn { ok: true, preset };\n}\n\n/**\n * Align the stored preset with the file.\n * Custom stored always wins (file is the source of truth).\n * A custom file while a built-in is stored flips the setting to custom.\n * A missing/empty file while a non-default built-in is stored restores that template.\n * A different built-in already on disk is adopted (file wins).\n */\nexport function reconcileBehaviorPreset(settingsManager: SettingsManager, agentDir?: string): BehaviorPreset {\n\tconst stored = settingsManager.getBehaviorPreset();\n\tconst fingerprint = detectBehaviorPreset(readBehaviorFile(agentDir));\n\tif (stored === \"custom\") return \"custom\";\n\tif (fingerprint === stored) return stored;\n\tif (fingerprint === \"custom\") {\n\t\tsettingsManager.setBehaviorPreset(\"custom\");\n\t\treturn \"custom\";\n\t}\n\tif (fingerprint === \"default\" && stored !== \"default\") {\n\t\twriteBehaviorPreset(stored, agentDir);\n\t\treturn stored;\n\t}\n\tsettingsManager.setBehaviorPreset(fingerprint);\n\treturn fingerprint;\n}\n\nexport interface BehaviorPresetBridge {\n\tgetPreset(): BehaviorPreset;\n\tsetPreset(preset: BehaviorPreset): void;\n\tisCapExempt(): boolean;\n\t/** Fingerprint the current file text; persist custom when a built-in selection drifted. */\n\tsyncFromFile(fileText: string): BehaviorPreset;\n}\n\nlet activeSettingsManager: SettingsManager | undefined;\n\nconst bridge: BehaviorPresetBridge = {\n\tgetPreset(): BehaviorPreset {\n\t\treturn activeSettingsManager?.getBehaviorPreset() ?? \"default\";\n\t},\n\tsetPreset(preset: BehaviorPreset): void {\n\t\tactiveSettingsManager?.setBehaviorPreset(preset);\n\t},\n\tisCapExempt(): boolean {\n\t\tconst preset = activeSettingsManager?.getBehaviorPreset() ?? \"default\";\n\t\treturn isBuiltinBehaviorPreset(preset);\n\t},\n\tsyncFromFile(fileText: string): BehaviorPreset {\n\t\tconst fingerprint = detectBehaviorPreset(fileText);\n\t\tconst stored = activeSettingsManager?.getBehaviorPreset() ?? \"default\";\n\t\t// Per-turn: only flip a built-in to custom when the file drifted. Restoring a\n\t\t// missing template or adopting another built-in is reconcileBehaviorPreset.\n\t\tif (stored !== \"custom\" && fingerprint === \"custom\") {\n\t\t\tactiveSettingsManager?.setBehaviorPreset(\"custom\");\n\t\t\treturn \"custom\";\n\t\t}\n\t\treturn stored;\n\t},\n};\n\nexport function registerBehaviorPresetBridge(settingsManager: SettingsManager): void {\n\tactiveSettingsManager = settingsManager;\n\t(globalThis as Record<symbol, unknown>)[BEHAVIOR_PRESET_BRIDGE_SYMBOL] = bridge;\n}\n\nexport function getBehaviorPresetBridge(): BehaviorPresetBridge | undefined {\n\treturn (globalThis as Record<symbol, unknown>)[BEHAVIOR_PRESET_BRIDGE_SYMBOL] as BehaviorPresetBridge | undefined;\n}\n"]}
|