@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
|
@@ -4,10 +4,6 @@ import * as fs from "node:fs";
|
|
|
4
4
|
import * as path from "node:path";
|
|
5
5
|
import { keyText } from "@ashx-j/lunr";
|
|
6
6
|
import { Key, matchesKey } from "@ashx-j/lunr-tui";
|
|
7
|
-
import { BUILTIN_AGENT_NAMES, discoverAgents, discoverAgentsAll } from "../agents/agents.js";
|
|
8
|
-
import { DEFAULT_PROVIDER_MODELS_MAX_AGE_DAYS, applySubagentProfile, checkSubagentProfile, generateProfilesForProvider, listSubagentProfiles, readSubagentProfile, refreshProviderModelCatalog, } from "../profiles/profiles.js";
|
|
9
|
-
import { isDynamicParallelStep, isParallelStep } from "../shared/settings.js";
|
|
10
|
-
import { findModelInfo, toModelInfo } from "../shared/model-info.js";
|
|
11
7
|
import { formatTokens, shortenPath } from "../shared/formatters.js";
|
|
12
8
|
import { listAsyncRuns, formatAsyncRunProgressLabel } from "../runs/background/async-status.js";
|
|
13
9
|
import { scheduledRunStorePath } from "../runs/background/scheduled-runs.js";
|
|
@@ -46,6 +42,10 @@ const parseInlineConfig = (raw) => {
|
|
|
46
42
|
case "model":
|
|
47
43
|
config.model = val || undefined;
|
|
48
44
|
break;
|
|
45
|
+
case "permissions":
|
|
46
|
+
if (val === "full" || val === "read-only")
|
|
47
|
+
config.permissions = val;
|
|
48
|
+
break;
|
|
49
49
|
case "skill":
|
|
50
50
|
case "skills":
|
|
51
51
|
config.skill = val === "false" ? false : val.split("+").filter(Boolean);
|
|
@@ -91,138 +91,19 @@ const parseAgentToken = (token) => {
|
|
|
91
91
|
const extractExecutionFlags = (rawArgs) => {
|
|
92
92
|
let args = rawArgs.trim();
|
|
93
93
|
let bg = false;
|
|
94
|
-
let fork = false;
|
|
95
94
|
while (true) {
|
|
96
95
|
if (args.endsWith(" --bg") || args === "--bg") {
|
|
97
96
|
bg = true;
|
|
98
97
|
args = args === "--bg" ? "" : args.slice(0, -5).trim();
|
|
99
98
|
continue;
|
|
100
99
|
}
|
|
101
|
-
if (args.endsWith(" --fork") || args === "--fork") {
|
|
102
|
-
fork = true;
|
|
103
|
-
args = args === "--fork" ? "" : args.slice(0, -7).trim();
|
|
104
|
-
continue;
|
|
105
|
-
}
|
|
106
100
|
break;
|
|
107
101
|
}
|
|
108
|
-
return { args, bg
|
|
109
|
-
};
|
|
110
|
-
const makeAgentCompletions = (state, multiAgent) => (prefix) => {
|
|
111
|
-
if (!state.baseCwd)
|
|
112
|
-
return null;
|
|
113
|
-
const agents = discoverAgents(state.baseCwd, "both").agents;
|
|
114
|
-
if (!multiAgent) {
|
|
115
|
-
if (prefix.includes(" "))
|
|
116
|
-
return null;
|
|
117
|
-
return agents.filter((a) => a.name.startsWith(prefix)).map((a) => ({ value: a.name, label: a.name }));
|
|
118
|
-
}
|
|
119
|
-
// Find the start of the current chain step: after the last top-level `->` arrow or `(`,
|
|
120
|
-
// or after a `|` *inside* a group. A `|` at depth 0 is plain task text (only `(` opens a
|
|
121
|
-
// group), so it must not restart agent completion — otherwise `scout -- do x | wr` would
|
|
122
|
-
// wrongly resume suggesting agents past the `--` task. Quotes are tracked so separators
|
|
123
|
-
// inside a task are ignored.
|
|
124
|
-
let inSingle = false, inDouble = false, depth = 0, segStart = 0;
|
|
125
|
-
for (let i = 0; i < prefix.length; i++) {
|
|
126
|
-
const ch = prefix[i];
|
|
127
|
-
if (inSingle) {
|
|
128
|
-
if (ch === "'")
|
|
129
|
-
inSingle = false;
|
|
130
|
-
continue;
|
|
131
|
-
}
|
|
132
|
-
if (inDouble) {
|
|
133
|
-
if (ch === '"')
|
|
134
|
-
inDouble = false;
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
if (ch === "'") {
|
|
138
|
-
inSingle = true;
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
if (ch === '"') {
|
|
142
|
-
inDouble = true;
|
|
143
|
-
continue;
|
|
144
|
-
}
|
|
145
|
-
if (ch === "(") {
|
|
146
|
-
if (!prefix.slice(segStart, i).includes(" -- ")) {
|
|
147
|
-
depth++;
|
|
148
|
-
segStart = i + 1;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
else if (ch === ")") {
|
|
152
|
-
if (depth > 0) {
|
|
153
|
-
depth--;
|
|
154
|
-
segStart = i + 1;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
else if (ch === "|" && depth > 0)
|
|
158
|
-
segStart = i + 1;
|
|
159
|
-
else if (ch === ">" && prefix[i - 1] === "-" && depth === 0)
|
|
160
|
-
segStart = i + 1;
|
|
161
|
-
}
|
|
162
|
-
// Inside an open quote, or once the task has started (`--` / a quote), we are no
|
|
163
|
-
// longer typing an agent name.
|
|
164
|
-
if (inSingle || inDouble)
|
|
165
|
-
return null;
|
|
166
|
-
const segment = prefix.slice(segStart);
|
|
167
|
-
if (segment.includes(" -- ") || segment.includes('"') || segment.includes("'"))
|
|
168
|
-
return null;
|
|
169
|
-
const lastWord = (segment.match(/(\S*)$/) || ["", ""])[1];
|
|
170
|
-
let beforeLastWord = prefix.slice(0, prefix.length - lastWord.length);
|
|
171
|
-
// A bare `->` or `|` just typed (no trailing space) needs a separating space;
|
|
172
|
-
// `(` glues naturally to the agent name.
|
|
173
|
-
if (lastWord === "" && /[>|]$/.test(beforeLastWord))
|
|
174
|
-
beforeLastWord = `${beforeLastWord} `;
|
|
175
|
-
return agents.filter((a) => a.name.startsWith(lastWord)).map((a) => ({ value: `${beforeLastWord}${a.name}`, label: a.name }));
|
|
176
|
-
};
|
|
177
|
-
const discoverSavedChains = (cwd) => {
|
|
178
|
-
const chainsByName = new Map();
|
|
179
|
-
for (const chain of discoverAgentsAll(cwd).chains) {
|
|
180
|
-
chainsByName.set(chain.name, chain);
|
|
181
|
-
}
|
|
182
|
-
return Array.from(chainsByName.values());
|
|
183
|
-
};
|
|
184
|
-
const makeChainCompletions = (state) => (prefix) => {
|
|
185
|
-
if (prefix.includes(" ") || !state.baseCwd)
|
|
186
|
-
return null;
|
|
187
|
-
return discoverSavedChains(state.baseCwd)
|
|
188
|
-
.filter((chain) => chain.name.startsWith(prefix))
|
|
189
|
-
.map((chain) => ({ value: chain.name, label: chain.name }));
|
|
190
|
-
};
|
|
191
|
-
const makeBuiltinAgentNameCompletions = () => (prefix) => {
|
|
192
|
-
if (prefix.includes(" "))
|
|
193
|
-
return null;
|
|
194
|
-
return BUILTIN_AGENT_NAMES
|
|
195
|
-
.filter((name) => name.startsWith(prefix))
|
|
196
|
-
.map((name) => ({ value: name, label: name }));
|
|
197
|
-
};
|
|
198
|
-
const makeProviderCompletions = (state) => (prefix) => {
|
|
199
|
-
if (prefix.includes(" "))
|
|
200
|
-
return null;
|
|
201
|
-
const available = state.lastUiContext?.modelRegistry?.getAvailable?.();
|
|
202
|
-
if (!Array.isArray(available))
|
|
203
|
-
return null;
|
|
204
|
-
const providers = [...new Set(available
|
|
205
|
-
.map((model) => typeof model?.provider === "string" ? model.provider : "")
|
|
206
|
-
.filter(Boolean))]
|
|
207
|
-
.sort((a, b) => a.localeCompare(b));
|
|
208
|
-
return providers
|
|
209
|
-
.filter((provider) => provider.startsWith(prefix))
|
|
210
|
-
.map((provider) => ({ value: provider, label: provider }));
|
|
102
|
+
return { args, bg };
|
|
211
103
|
};
|
|
212
104
|
function sendSlashText(pi, text) {
|
|
213
105
|
pi.sendMessage({ customType: SLASH_TEXT_RESULT_TYPE, content: text, display: true });
|
|
214
106
|
}
|
|
215
|
-
async function withSlashStatus(ctx, text, run) {
|
|
216
|
-
if (ctx.hasUI)
|
|
217
|
-
ctx.ui.setStatus("subagent-slash-text", text);
|
|
218
|
-
try {
|
|
219
|
-
return await run();
|
|
220
|
-
}
|
|
221
|
-
finally {
|
|
222
|
-
if (ctx.hasUI)
|
|
223
|
-
ctx.ui.setStatus("subagent-slash-text", undefined);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
107
|
function commandForTarget(target) {
|
|
227
108
|
return target.kind === "scheduled"
|
|
228
109
|
? `subagent({ action: "schedule-cancel", id: ${JSON.stringify(target.id)} })`
|
|
@@ -469,68 +350,6 @@ function buildSubagentCostReport(ctx) {
|
|
|
469
350
|
lines.push("────────────────────────────", formatCostUsage("Children", childTotal), formatCostUsage("Total", total));
|
|
470
351
|
return lines.join("\n");
|
|
471
352
|
}
|
|
472
|
-
function parseSingleRequiredArg(args, usage) {
|
|
473
|
-
const parts = args.trim().split(/\s+/).filter(Boolean);
|
|
474
|
-
if (parts.length !== 1)
|
|
475
|
-
return { ok: false, message: usage };
|
|
476
|
-
return { ok: true, value: parts[0] };
|
|
477
|
-
}
|
|
478
|
-
function getProfileWorkerModel(profile) {
|
|
479
|
-
const model = profile.subagents?.agentOverrides?.worker?.model;
|
|
480
|
-
return typeof model === "string" && model.trim() ? model.trim() : undefined;
|
|
481
|
-
}
|
|
482
|
-
function loadSavedOutputSchema(chain, stepAgent, outputSchema) {
|
|
483
|
-
if (outputSchema === undefined)
|
|
484
|
-
return undefined;
|
|
485
|
-
if (typeof outputSchema === "string") {
|
|
486
|
-
const schemaPath = path.isAbsolute(outputSchema)
|
|
487
|
-
? outputSchema
|
|
488
|
-
: path.join(path.dirname(chain.filePath), outputSchema);
|
|
489
|
-
const parsed = JSON.parse(fs.readFileSync(schemaPath, "utf-8"));
|
|
490
|
-
assertJsonSchemaObject(parsed, `outputSchema for chain '${chain.name}' step '${stepAgent}' (${schemaPath})`);
|
|
491
|
-
return parsed;
|
|
492
|
-
}
|
|
493
|
-
assertJsonSchemaObject(outputSchema, `outputSchema for chain '${chain.name}' step '${stepAgent}'`);
|
|
494
|
-
return outputSchema;
|
|
495
|
-
}
|
|
496
|
-
const mapSavedChainSteps = (chain, worktree = false) => {
|
|
497
|
-
return chain.steps.map((step) => {
|
|
498
|
-
if (isParallelStep(step)) {
|
|
499
|
-
const parallel = step.parallel.map((task) => {
|
|
500
|
-
const { outputSchema: rawOutputSchema, ...rest } = task;
|
|
501
|
-
const outputSchema = loadSavedOutputSchema(chain, task.agent, rawOutputSchema);
|
|
502
|
-
return { ...rest, ...(outputSchema ? { outputSchema } : {}) };
|
|
503
|
-
});
|
|
504
|
-
return { ...step, parallel, ...(worktree ? { worktree: true } : {}) };
|
|
505
|
-
}
|
|
506
|
-
if (isDynamicParallelStep(step)) {
|
|
507
|
-
const { outputSchema: rawOutputSchema, ...parallelRest } = step.parallel;
|
|
508
|
-
const outputSchema = loadSavedOutputSchema(chain, step.parallel.agent, rawOutputSchema);
|
|
509
|
-
const collectSchema = loadSavedOutputSchema(chain, `${step.collect.as} collection`, step.collect.outputSchema);
|
|
510
|
-
return {
|
|
511
|
-
...step,
|
|
512
|
-
parallel: { ...parallelRest, ...(outputSchema ? { outputSchema } : {}) },
|
|
513
|
-
collect: { ...step.collect, ...(collectSchema ? { outputSchema: collectSchema } : {}) },
|
|
514
|
-
};
|
|
515
|
-
}
|
|
516
|
-
const outputSchema = loadSavedOutputSchema(chain, step.agent, step.outputSchema);
|
|
517
|
-
return {
|
|
518
|
-
agent: step.agent,
|
|
519
|
-
task: step.task || undefined,
|
|
520
|
-
...(step.phase ? { phase: step.phase } : {}),
|
|
521
|
-
...(step.label ? { label: step.label } : {}),
|
|
522
|
-
...(step.as ? { as: step.as } : {}),
|
|
523
|
-
...(outputSchema ? { outputSchema } : {}),
|
|
524
|
-
...(step.acceptance !== undefined ? { acceptance: step.acceptance } : {}),
|
|
525
|
-
output: step.output,
|
|
526
|
-
outputMode: step.outputMode,
|
|
527
|
-
reads: step.reads,
|
|
528
|
-
progress: step.progress,
|
|
529
|
-
skill: step.skill ?? step.skills,
|
|
530
|
-
model: step.model,
|
|
531
|
-
};
|
|
532
|
-
});
|
|
533
|
-
};
|
|
534
353
|
async function requestSlashRun(pi, ctx, requestId, params) {
|
|
535
354
|
return new Promise((resolve, reject) => {
|
|
536
355
|
let done = false;
|
|
@@ -955,7 +774,7 @@ export function parseChainExpression(input) {
|
|
|
955
774
|
}
|
|
956
775
|
const parseAgentArgs = (state, args, command, ctx) => {
|
|
957
776
|
const input = args.trim();
|
|
958
|
-
const usage = `Usage: /${command}
|
|
777
|
+
const usage = `Usage: /${command} description1 "task1" -> description2 "task2"`;
|
|
959
778
|
let steps;
|
|
960
779
|
let sharedTask;
|
|
961
780
|
let perStep = false;
|
|
@@ -993,15 +812,8 @@ const parseAgentArgs = (state, args, command, ctx) => {
|
|
|
993
812
|
ctx.ui.notify("Subagent session cwd is not initialized yet", "error");
|
|
994
813
|
return null;
|
|
995
814
|
}
|
|
996
|
-
const agents = discoverAgents(state.baseCwd, "both").agents;
|
|
997
|
-
for (const step of steps) {
|
|
998
|
-
if (!agents.find((a) => a.name === step.name)) {
|
|
999
|
-
ctx.ui.notify(`Unknown agent: ${step.name}`, "error");
|
|
1000
|
-
return null;
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
815
|
if (command === "chain" && !steps[0]?.task && (perStep || !sharedTask)) {
|
|
1004
|
-
ctx.ui.notify(`First step must have a task: /chain
|
|
816
|
+
ctx.ui.notify(`First step must have a task: /chain description "task" -> description2`, "error");
|
|
1005
817
|
return null;
|
|
1006
818
|
}
|
|
1007
819
|
if (command === "parallel" && !steps.some((s) => s.task) && !sharedTask) {
|
|
@@ -1041,7 +853,8 @@ const mapParsedTaskToStepObject = (step, fallbackTask, isFirst, opts) => {
|
|
|
1041
853
|
if (config.acceptance !== undefined)
|
|
1042
854
|
validateInlineAcceptanceInput(config.acceptance, name);
|
|
1043
855
|
return {
|
|
1044
|
-
|
|
856
|
+
description: name,
|
|
857
|
+
permissions: config.permissions ?? "full",
|
|
1045
858
|
...(stepTask ? { task: stepTask } : isFirst && fallbackTask ? { task: fallbackTask } : {}),
|
|
1046
859
|
...(config.output !== undefined ? { output: config.output } : {}),
|
|
1047
860
|
...(config.outputMode !== undefined ? { outputMode: config.outputMode } : {}),
|
|
@@ -1086,18 +899,10 @@ export function buildChainExpressionSteps(state, input, ctx) {
|
|
|
1086
899
|
notify("Subagent session cwd is not initialized yet");
|
|
1087
900
|
return null;
|
|
1088
901
|
}
|
|
1089
|
-
const agents = discoverAgents(state.baseCwd, "both").agents;
|
|
1090
|
-
const stepAgentNames = expression.steps.flatMap((step) => step.kind === "group" ? step.tasks.map((t) => t.name) : [step.name]);
|
|
1091
|
-
for (const name of stepAgentNames) {
|
|
1092
|
-
if (!agents.find((a) => a.name === name)) {
|
|
1093
|
-
notify(`Unknown agent: ${name}`);
|
|
1094
|
-
return null;
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
902
|
// Every task inside a parallel group needs its own task; there is no shared-task fallback.
|
|
1098
903
|
for (const step of expression.steps) {
|
|
1099
904
|
if (step.kind === "group" && step.tasks.some((t) => !t.task)) {
|
|
1100
|
-
notify('Each
|
|
905
|
+
notify('Each child in a parallel group needs a task: (description "a" | description2 "b")');
|
|
1101
906
|
return null;
|
|
1102
907
|
}
|
|
1103
908
|
}
|
|
@@ -1106,7 +911,7 @@ export function buildChainExpressionSteps(state, input, ctx) {
|
|
|
1106
911
|
? firstStep.tasks.some((t) => Boolean(t.task))
|
|
1107
912
|
: Boolean(firstStep.task);
|
|
1108
913
|
if (!firstHasTask) {
|
|
1109
|
-
notify('First step must have a task: /chain
|
|
914
|
+
notify('First step must have a task: /chain description "task" -> description2');
|
|
1110
915
|
return null;
|
|
1111
916
|
}
|
|
1112
917
|
const sharedTask = firstStep.kind === "group"
|
|
@@ -1155,32 +960,26 @@ export function registerSlashCommands(pi, state) {
|
|
|
1155
960
|
}
|
|
1156
961
|
};
|
|
1157
962
|
pi.registerCommand("run", {
|
|
1158
|
-
description: "Run a
|
|
1159
|
-
getArgumentCompletions: makeAgentCompletions(state, false),
|
|
963
|
+
description: "Run a prompt-defined child: /run description[output=file] task [--bg]",
|
|
1160
964
|
handler: async (args, ctx) => {
|
|
1161
965
|
const { args: cleanedArgs, bg } = extractExecutionFlags(args);
|
|
1162
966
|
const input = cleanedArgs.trim();
|
|
1163
967
|
const firstSpace = input.indexOf(" ");
|
|
1164
968
|
if (!input) {
|
|
1165
|
-
ctx.ui.notify("Usage: /run <
|
|
969
|
+
ctx.ui.notify("Usage: /run <description> <task> [--bg]", "error");
|
|
1166
970
|
return;
|
|
1167
971
|
}
|
|
1168
|
-
const { name:
|
|
972
|
+
const { name: description, config: inline } = parseAgentToken(firstSpace === -1 ? input : input.slice(0, firstSpace));
|
|
1169
973
|
const task = firstSpace === -1 ? "" : input.slice(firstSpace + 1).trim();
|
|
1170
|
-
if (!
|
|
1171
|
-
ctx.ui.notify("
|
|
1172
|
-
return;
|
|
1173
|
-
}
|
|
1174
|
-
const agents = discoverAgents(state.baseCwd, "both").agents;
|
|
1175
|
-
if (!agents.find((a) => a.name === agentName)) {
|
|
1176
|
-
ctx.ui.notify(`Unknown agent: ${agentName}`, "error");
|
|
974
|
+
if (!description || !task) {
|
|
975
|
+
ctx.ui.notify("Usage: /run <description> <task> [--bg]", "error");
|
|
1177
976
|
return;
|
|
1178
977
|
}
|
|
1179
978
|
let finalTask = task;
|
|
1180
979
|
if (inline.reads && Array.isArray(inline.reads) && inline.reads.length > 0) {
|
|
1181
980
|
finalTask = `[Read from: ${inline.reads.join(", ")}]\n\n${finalTask}`;
|
|
1182
981
|
}
|
|
1183
|
-
const params = {
|
|
982
|
+
const params = { description, permissions: inline.permissions ?? "full", task: finalTask, clarify: false };
|
|
1184
983
|
if (inline.output !== undefined)
|
|
1185
984
|
params.output = inline.output;
|
|
1186
985
|
if (inline.outputMode !== undefined)
|
|
@@ -1195,61 +994,28 @@ export function registerSlashCommands(pi, state) {
|
|
|
1195
994
|
},
|
|
1196
995
|
});
|
|
1197
996
|
pi.registerCommand("chain", {
|
|
1198
|
-
description: "Run
|
|
1199
|
-
getArgumentCompletions: makeAgentCompletions(state, true),
|
|
997
|
+
description: "Run prompt-defined children in sequence: /chain inspect \"task\" -> implement [--bg]",
|
|
1200
998
|
handler: async (args, ctx) => {
|
|
1201
999
|
const { args: cleanedArgs, bg } = extractExecutionFlags(args);
|
|
1202
1000
|
const built = buildChainExpressionSteps(state, cleanedArgs, ctx);
|
|
1203
1001
|
if (!built)
|
|
1204
1002
|
return;
|
|
1205
|
-
const params = { chain: built.chain, task: built.task, clarify: false
|
|
1206
|
-
if (bg)
|
|
1207
|
-
params.async = true;
|
|
1208
|
-
await runSlashSubagent(pi, ctx, params);
|
|
1209
|
-
},
|
|
1210
|
-
});
|
|
1211
|
-
pi.registerCommand("run-chain", {
|
|
1212
|
-
description: "Run a saved chain: /run-chain chainName -- task [--bg]",
|
|
1213
|
-
getArgumentCompletions: makeChainCompletions(state),
|
|
1214
|
-
handler: async (args, ctx) => {
|
|
1215
|
-
const { args: cleanedArgs, bg } = extractExecutionFlags(args);
|
|
1216
|
-
const delimiterIndex = cleanedArgs.indexOf(" -- ");
|
|
1217
|
-
const usage = "Usage: /run-chain <chainName> -- <task> [--bg]";
|
|
1218
|
-
if (delimiterIndex === -1) {
|
|
1219
|
-
ctx.ui.notify(usage, "error");
|
|
1220
|
-
return;
|
|
1221
|
-
}
|
|
1222
|
-
const chainName = cleanedArgs.slice(0, delimiterIndex).trim();
|
|
1223
|
-
const task = cleanedArgs.slice(delimiterIndex + 4).trim();
|
|
1224
|
-
if (!chainName || !task) {
|
|
1225
|
-
ctx.ui.notify(usage, "error");
|
|
1226
|
-
return;
|
|
1227
|
-
}
|
|
1228
|
-
if (!state.baseCwd) {
|
|
1229
|
-
ctx.ui.notify("Subagent session cwd is not initialized yet", "error");
|
|
1230
|
-
return;
|
|
1231
|
-
}
|
|
1232
|
-
const chain = discoverSavedChains(state.baseCwd).find((candidate) => candidate.name === chainName);
|
|
1233
|
-
if (!chain) {
|
|
1234
|
-
ctx.ui.notify(`Unknown chain: ${chainName}`, "error");
|
|
1235
|
-
return;
|
|
1236
|
-
}
|
|
1237
|
-
const params = { chain: mapSavedChainSteps(chain), task, clarify: false, agentScope: "both" };
|
|
1003
|
+
const params = { chain: built.chain, task: built.task, clarify: false };
|
|
1238
1004
|
if (bg)
|
|
1239
1005
|
params.async = true;
|
|
1240
1006
|
await runSlashSubagent(pi, ctx, params);
|
|
1241
1007
|
},
|
|
1242
1008
|
});
|
|
1243
1009
|
pi.registerCommand("parallel", {
|
|
1244
|
-
description: "Run
|
|
1245
|
-
getArgumentCompletions: makeAgentCompletions(state, true),
|
|
1010
|
+
description: "Run prompt-defined children in parallel: /parallel inspect \"task1\" -> review \"task2\" [--bg]",
|
|
1246
1011
|
handler: async (args, ctx) => {
|
|
1247
1012
|
const { args: cleanedArgs, bg } = extractExecutionFlags(args);
|
|
1248
1013
|
const parsed = parseAgentArgs(state, cleanedArgs, "parallel", ctx);
|
|
1249
1014
|
if (!parsed)
|
|
1250
1015
|
return;
|
|
1251
1016
|
const tasks = parsed.steps.map(({ name, config, task: stepTask }) => ({
|
|
1252
|
-
|
|
1017
|
+
description: name,
|
|
1018
|
+
permissions: config.permissions ?? "full",
|
|
1253
1019
|
task: stepTask ?? parsed.task,
|
|
1254
1020
|
...(config.output !== undefined ? { output: config.output } : {}),
|
|
1255
1021
|
...(config.outputMode !== undefined ? { outputMode: config.outputMode } : {}),
|
|
@@ -1258,7 +1024,7 @@ export function registerSlashCommands(pi, state) {
|
|
|
1258
1024
|
...(config.skill !== undefined ? { skill: config.skill } : {}),
|
|
1259
1025
|
...(config.progress !== undefined ? { progress: config.progress } : {}),
|
|
1260
1026
|
}));
|
|
1261
|
-
const params = { tasks, clarify: false
|
|
1027
|
+
const params = { tasks, clarify: false };
|
|
1262
1028
|
if (bg)
|
|
1263
1029
|
params.async = true;
|
|
1264
1030
|
await runSlashSubagent(pi, ctx, params);
|
|
@@ -1327,197 +1093,5 @@ export function registerSlashCommands(pi, state) {
|
|
|
1327
1093
|
pi,
|
|
1328
1094
|
run: (params, ctx) => runSlashSubagent(pi, ctx, params),
|
|
1329
1095
|
});
|
|
1330
|
-
pi.registerCommand("subagents-models", {
|
|
1331
|
-
description: "Show runtime-loaded builtin subagent models",
|
|
1332
|
-
getArgumentCompletions: makeBuiltinAgentNameCompletions(),
|
|
1333
|
-
handler: async (args, ctx) => {
|
|
1334
|
-
const trimmed = args.trim();
|
|
1335
|
-
if (!trimmed) {
|
|
1336
|
-
await runSlashSubagent(pi, ctx, { action: "models" });
|
|
1337
|
-
return;
|
|
1338
|
-
}
|
|
1339
|
-
const parts = trimmed.split(/\s+/).filter(Boolean);
|
|
1340
|
-
if (parts.length !== 1) {
|
|
1341
|
-
ctx.ui.notify("Usage: /subagents-models [builtin-agent-name]", "error");
|
|
1342
|
-
return;
|
|
1343
|
-
}
|
|
1344
|
-
const agent = parts[0];
|
|
1345
|
-
if (!BUILTIN_AGENT_NAMES.includes(agent)) {
|
|
1346
|
-
ctx.ui.notify(`Unknown builtin agent: ${agent}`, "error");
|
|
1347
|
-
return;
|
|
1348
|
-
}
|
|
1349
|
-
await runSlashSubagent(pi, ctx, { action: "models", agent });
|
|
1350
|
-
},
|
|
1351
|
-
});
|
|
1352
|
-
pi.registerCommand("subagents-profiles", {
|
|
1353
|
-
description: "List saved subagent profiles",
|
|
1354
|
-
handler: async (_args, _ctx) => {
|
|
1355
|
-
const profiles = listSubagentProfiles();
|
|
1356
|
-
if (profiles.length === 0) {
|
|
1357
|
-
sendSlashText(pi, "Subagent profiles\n\nNo subagent profiles found in ~/.pi/agent/profiles/pi-subagents/");
|
|
1358
|
-
return;
|
|
1359
|
-
}
|
|
1360
|
-
sendSlashText(pi, `Subagent profiles\n\n${profiles.join("\n")}`);
|
|
1361
|
-
},
|
|
1362
|
-
});
|
|
1363
|
-
pi.registerCommand("subagents-load-profile", {
|
|
1364
|
-
description: "Load a subagent profile into ~/.pi/agent/settings.json",
|
|
1365
|
-
getArgumentCompletions: (prefix) => {
|
|
1366
|
-
if (prefix.includes(" "))
|
|
1367
|
-
return null;
|
|
1368
|
-
return listSubagentProfiles()
|
|
1369
|
-
.filter((name) => name.startsWith(prefix))
|
|
1370
|
-
.map((name) => ({ value: name, label: name }));
|
|
1371
|
-
},
|
|
1372
|
-
handler: async (args, ctx) => {
|
|
1373
|
-
const parsed = parseSingleRequiredArg(args, "Usage: /subagents-load-profile <name>");
|
|
1374
|
-
if (!parsed.ok) {
|
|
1375
|
-
ctx.ui.notify(parsed.message, "error");
|
|
1376
|
-
return;
|
|
1377
|
-
}
|
|
1378
|
-
try {
|
|
1379
|
-
await withSlashStatus(ctx, `Loading profile ${parsed.value}…`, async () => {
|
|
1380
|
-
const { profile } = readSubagentProfile(parsed.value);
|
|
1381
|
-
const workerModel = getProfileWorkerModel(profile);
|
|
1382
|
-
const result = applySubagentProfile(parsed.value);
|
|
1383
|
-
const lines = [
|
|
1384
|
-
`Loaded subagent profile: ${parsed.value}`,
|
|
1385
|
-
`Profile: ${result.filePath}`,
|
|
1386
|
-
`Updated: ${result.settingsPath}`,
|
|
1387
|
-
];
|
|
1388
|
-
if (workerModel && typeof pi.setModel === "function" && typeof ctx.modelRegistry?.find === "function" && typeof ctx.modelRegistry?.getAvailable === "function") {
|
|
1389
|
-
const shouldSwitch = await ctx.ui.confirm("", `Profile loaded. Also switch this session to the profile worker model?\n\n${workerModel}`);
|
|
1390
|
-
if (shouldSwitch) {
|
|
1391
|
-
const modelInfo = findModelInfo(workerModel, ctx.modelRegistry.getAvailable().map(toModelInfo));
|
|
1392
|
-
const model = modelInfo ? ctx.modelRegistry.find(modelInfo.provider, modelInfo.id) : undefined;
|
|
1393
|
-
if (!modelInfo || !model) {
|
|
1394
|
-
lines.push(`Could not switch current session model: '${workerModel}' is not available in the current model registry.`);
|
|
1395
|
-
}
|
|
1396
|
-
else {
|
|
1397
|
-
const success = await pi.setModel(model);
|
|
1398
|
-
if (success)
|
|
1399
|
-
lines.push(`Current session model switched to: ${modelInfo.fullId}`);
|
|
1400
|
-
else
|
|
1401
|
-
lines.push(`Could not switch current session model to '${workerModel}': no API key or provider access is available.`);
|
|
1402
|
-
}
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1405
|
-
else if (workerModel) {
|
|
1406
|
-
lines.push(`Profile worker model: ${workerModel}`);
|
|
1407
|
-
}
|
|
1408
|
-
sendSlashText(pi, lines.join("\n"));
|
|
1409
|
-
});
|
|
1410
|
-
}
|
|
1411
|
-
catch (error) {
|
|
1412
|
-
ctx.ui.notify(error instanceof Error ? error.message : String(error), "error");
|
|
1413
|
-
}
|
|
1414
|
-
},
|
|
1415
|
-
});
|
|
1416
|
-
pi.registerCommand("subagents-refresh-provider-models", {
|
|
1417
|
-
description: "Refresh the cached model catalog for one provider",
|
|
1418
|
-
getArgumentCompletions: makeProviderCompletions(state),
|
|
1419
|
-
handler: async (args, ctx) => {
|
|
1420
|
-
const trimmed = args.trim();
|
|
1421
|
-
const force = /(?:^|\s)--force$/.test(trimmed) || /(?:^|\s)force$/.test(trimmed);
|
|
1422
|
-
const withoutForce = trimmed.replace(/(?:^|\s)(?:--force|force)$/, "").trim();
|
|
1423
|
-
const parsed = parseSingleRequiredArg(withoutForce, "Usage: /subagents-refresh-provider-models <provider> [--force]");
|
|
1424
|
-
if (!parsed.ok) {
|
|
1425
|
-
ctx.ui.notify(parsed.message, "error");
|
|
1426
|
-
return;
|
|
1427
|
-
}
|
|
1428
|
-
try {
|
|
1429
|
-
await withSlashStatus(ctx, `Refreshing provider models for ${parsed.value}…`, async () => {
|
|
1430
|
-
const result = await refreshProviderModelCatalog(pi, ctx, parsed.value, { force, maxAgeDays: DEFAULT_PROVIDER_MODELS_MAX_AGE_DAYS });
|
|
1431
|
-
const lines = [
|
|
1432
|
-
"Provider model catalog",
|
|
1433
|
-
`Provider: ${parsed.value}`,
|
|
1434
|
-
`Status: ${result.reused ? "fresh cache reused" : "refreshed"}`,
|
|
1435
|
-
`File: ${result.filePath}`,
|
|
1436
|
-
`Models: ${result.catalog.models.length}`,
|
|
1437
|
-
`Refreshed at: ${result.catalog.refreshedAt}`,
|
|
1438
|
-
];
|
|
1439
|
-
if (result.heuristicFallbackCount > 0) {
|
|
1440
|
-
lines.push(`Warning: ${result.heuristicFallbackCount} model${result.heuristicFallbackCount === 1 ? " was" : "s were"} classified with name heuristics fallback.`);
|
|
1441
|
-
}
|
|
1442
|
-
sendSlashText(pi, lines.join("\n"));
|
|
1443
|
-
});
|
|
1444
|
-
}
|
|
1445
|
-
catch (error) {
|
|
1446
|
-
ctx.ui.notify(error instanceof Error ? error.message : String(error), "error");
|
|
1447
|
-
}
|
|
1448
|
-
},
|
|
1449
|
-
});
|
|
1450
|
-
pi.registerCommand("subagents-generate-profiles", {
|
|
1451
|
-
description: "Generate <provider>.quota and <provider>.quality subagent profiles",
|
|
1452
|
-
getArgumentCompletions: makeProviderCompletions(state),
|
|
1453
|
-
handler: async (args, ctx) => {
|
|
1454
|
-
const parsed = parseSingleRequiredArg(args, "Usage: /subagents-generate-profiles <provider>");
|
|
1455
|
-
if (!parsed.ok) {
|
|
1456
|
-
ctx.ui.notify(parsed.message, "error");
|
|
1457
|
-
return;
|
|
1458
|
-
}
|
|
1459
|
-
try {
|
|
1460
|
-
await withSlashStatus(ctx, `Generating profiles for ${parsed.value}…`, async () => {
|
|
1461
|
-
const result = await generateProfilesForProvider(pi, ctx, parsed.value, { maxAgeDays: DEFAULT_PROVIDER_MODELS_MAX_AGE_DAYS });
|
|
1462
|
-
const lines = [
|
|
1463
|
-
"Generated subagent profiles",
|
|
1464
|
-
`Provider: ${parsed.value}`,
|
|
1465
|
-
`Catalog: ${result.catalogPath}`,
|
|
1466
|
-
`Quota: ${result.quotaPath}`,
|
|
1467
|
-
` cheap=${result.quotaModels.cheap}`,
|
|
1468
|
-
` medium=${result.quotaModels.medium}`,
|
|
1469
|
-
` strong=${result.quotaModels.strong}`,
|
|
1470
|
-
`Quality: ${result.qualityPath}`,
|
|
1471
|
-
` cheap=${result.qualityModels.cheap}`,
|
|
1472
|
-
` medium=${result.qualityModels.medium}`,
|
|
1473
|
-
` strong=${result.qualityModels.strong}`,
|
|
1474
|
-
];
|
|
1475
|
-
if (result.selectedHeuristicFallbackCount > 0) {
|
|
1476
|
-
lines.push(`Warning: generated profiles depend on heuristic-only classification for ${result.selectedHeuristicFallbackCount} selected model${result.selectedHeuristicFallbackCount === 1 ? "" : "s"}.`);
|
|
1477
|
-
}
|
|
1478
|
-
else if (result.heuristicFallbackCount > 0) {
|
|
1479
|
-
lines.push(`Warning: provider catalog still contains ${result.heuristicFallbackCount} heuristic-classified model${result.heuristicFallbackCount === 1 ? "" : "s"}.`);
|
|
1480
|
-
}
|
|
1481
|
-
sendSlashText(pi, lines.join("\n"));
|
|
1482
|
-
});
|
|
1483
|
-
}
|
|
1484
|
-
catch (error) {
|
|
1485
|
-
ctx.ui.notify(error instanceof Error ? error.message : String(error), "error");
|
|
1486
|
-
}
|
|
1487
|
-
},
|
|
1488
|
-
});
|
|
1489
|
-
pi.registerCommand("subagents-check-profile", {
|
|
1490
|
-
description: "Check whether a saved profile still points to usable models",
|
|
1491
|
-
getArgumentCompletions: (prefix) => {
|
|
1492
|
-
if (prefix.includes(" "))
|
|
1493
|
-
return null;
|
|
1494
|
-
return listSubagentProfiles()
|
|
1495
|
-
.filter((name) => name.startsWith(prefix))
|
|
1496
|
-
.map((name) => ({ value: name, label: name }));
|
|
1497
|
-
},
|
|
1498
|
-
handler: async (args, ctx) => {
|
|
1499
|
-
const parsed = parseSingleRequiredArg(args, "Usage: /subagents-check-profile <name>");
|
|
1500
|
-
if (!parsed.ok) {
|
|
1501
|
-
ctx.ui.notify(parsed.message, "error");
|
|
1502
|
-
return;
|
|
1503
|
-
}
|
|
1504
|
-
try {
|
|
1505
|
-
await withSlashStatus(ctx, `Checking profile ${parsed.value}…`, async () => {
|
|
1506
|
-
const result = await checkSubagentProfile(pi, ctx, parsed.value);
|
|
1507
|
-
const lines = [
|
|
1508
|
-
"Subagent profile check",
|
|
1509
|
-
`Profile: ${result.profileName}`,
|
|
1510
|
-
`File: ${result.filePath}`,
|
|
1511
|
-
"",
|
|
1512
|
-
...result.results.map((entry) => `${entry.agent} → ${entry.model} — registry ${entry.inRegistry ? "ok" : "missing"}; probe ${entry.probe.status}${entry.probe.message ? ` (${entry.probe.message.split(/\r?\n/, 1)[0]})` : ""}`),
|
|
1513
|
-
];
|
|
1514
|
-
sendSlashText(pi, lines.join("\n"));
|
|
1515
|
-
});
|
|
1516
|
-
}
|
|
1517
|
-
catch (error) {
|
|
1518
|
-
ctx.ui.notify(error instanceof Error ? error.message : String(error), "error");
|
|
1519
|
-
}
|
|
1520
|
-
},
|
|
1521
|
-
});
|
|
1522
1096
|
}
|
|
1523
1097
|
//# sourceMappingURL=slash-commands.js.map
|