@bubblebrain-ai/bubble 0.0.63 → 0.0.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +437 -11
- package/dist/agent/abort-errors.d.ts +18 -0
- package/dist/agent/abort-errors.js +51 -0
- package/dist/agent/budget-ledger.d.ts +20 -0
- package/dist/agent/budget-ledger.js +45 -0
- package/dist/agent/categories.d.ts +100 -0
- package/dist/agent/categories.js +203 -0
- package/dist/agent/change-tracker.d.ts +40 -0
- package/dist/agent/change-tracker.js +89 -0
- package/dist/agent/child-runner.d.ts +64 -0
- package/dist/agent/child-runner.js +405 -0
- package/dist/agent/input-controller.d.ts +14 -0
- package/dist/agent/input-controller.js +43 -0
- package/dist/agent/internal-reminder-sanitizer.d.ts +25 -0
- package/dist/agent/internal-reminder-sanitizer.js +297 -0
- package/dist/agent/profiles.d.ts +76 -0
- package/dist/agent/profiles.js +526 -0
- package/dist/agent/provider-fingerprint.d.ts +6 -0
- package/dist/agent/provider-fingerprint.js +89 -0
- package/dist/agent/resident-history.d.ts +7 -0
- package/dist/agent/resident-history.js +61 -0
- package/dist/agent/result-integrator.d.ts +22 -0
- package/dist/agent/result-integrator.js +50 -0
- package/dist/agent/routing-catalog.d.ts +131 -0
- package/dist/agent/routing-catalog.js +260 -0
- package/dist/agent/structured-output.d.ts +37 -0
- package/dist/agent/structured-output.js +193 -0
- package/dist/agent/subagent/router.d.ts +65 -0
- package/dist/agent/subagent/router.js +203 -0
- package/dist/agent/subagent/runtime.d.ts +235 -0
- package/dist/agent/subagent/runtime.js +835 -0
- package/dist/agent/subagent-control.d.ts +100 -0
- package/dist/agent/subagent-control.js +70 -0
- package/dist/agent/subagent-lifecycle-reminder.d.ts +3 -0
- package/dist/agent/subagent-lifecycle-reminder.js +112 -0
- package/dist/agent/subagent-route-format.d.ts +8 -0
- package/dist/agent/subagent-route-format.js +18 -0
- package/dist/agent/subagent-scheduler.d.ts +105 -0
- package/dist/agent/subagent-scheduler.js +287 -0
- package/dist/agent/subagent-store.d.ts +57 -0
- package/dist/agent/subagent-store.js +180 -0
- package/dist/agent/subagent-summary.d.ts +30 -0
- package/dist/agent/subagent-summary.js +74 -0
- package/dist/agent/subagent-wait-guidance.d.ts +2 -0
- package/dist/agent/subagent-wait-guidance.js +8 -0
- package/dist/agent/subtask-policy.d.ts +13 -0
- package/dist/agent/subtask-policy.js +56 -0
- package/dist/agent/task-lifecycle-reminder.d.ts +26 -0
- package/dist/agent/task-lifecycle-reminder.js +59 -0
- package/dist/agent/tool-intent.d.ts +45 -0
- package/dist/agent/tool-intent.js +318 -0
- package/dist/agent/tool-visibility.d.ts +10 -0
- package/dist/agent/tool-visibility.js +6 -0
- package/dist/agent/transcript-helpers.d.ts +20 -0
- package/dist/agent/transcript-helpers.js +63 -0
- package/dist/agent/update-queue.d.ts +13 -0
- package/dist/agent/update-queue.js +69 -0
- package/dist/agent/workflow/control.d.ts +60 -0
- package/dist/agent/workflow/control.js +62 -0
- package/dist/agent/workflow/errors.d.ts +16 -0
- package/dist/agent/workflow/errors.js +24 -0
- package/dist/agent/workflow/runs.d.ts +73 -0
- package/dist/agent/workflow/runs.js +160 -0
- package/dist/agent/workflow/runtime.d.ts +88 -0
- package/dist/agent/workflow/runtime.js +319 -0
- package/dist/agent/worktree.d.ts +29 -0
- package/dist/agent/worktree.js +73 -0
- package/dist/agent.d.ts +460 -0
- package/dist/agent.js +2210 -0
- package/dist/anthropic-thinking.d.ts +4 -0
- package/dist/anthropic-thinking.js +11 -0
- package/dist/approval/controller.d.ts +71 -0
- package/dist/approval/controller.js +286 -0
- package/dist/approval/danger.d.ts +13 -0
- package/dist/approval/danger.js +55 -0
- package/dist/approval/diff-hunks.d.ts +12 -0
- package/dist/approval/diff-hunks.js +32 -0
- package/dist/approval/protected-paths.d.ts +1 -0
- package/dist/approval/protected-paths.js +35 -0
- package/dist/approval/session-cache.d.ts +21 -0
- package/dist/approval/session-cache.js +38 -0
- package/dist/approval/tool-helper.d.ts +14 -0
- package/dist/approval/tool-helper.js +47 -0
- package/dist/approval/types.d.ts +146 -0
- package/dist/approval/types.js +8 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +3 -0
- package/dist/bubble-home.d.ts +8 -0
- package/dist/bubble-home.js +19 -0
- package/dist/checkpoints.d.ts +57 -0
- package/dist/checkpoints.js +0 -0
- package/dist/cli.d.ts +37 -0
- package/dist/cli.js +175 -0
- package/dist/clipboard.d.ts +14 -0
- package/dist/clipboard.js +132 -0
- package/dist/config.d.ts +96 -0
- package/dist/config.js +287 -0
- package/dist/context/budget.d.ts +28 -0
- package/dist/context/budget.js +130 -0
- package/dist/context/checkpoint.d.ts +18 -0
- package/dist/context/checkpoint.js +117 -0
- package/dist/context/compact-llm.d.ts +25 -0
- package/dist/context/compact-llm.js +175 -0
- package/dist/context/compact.d.ts +124 -0
- package/dist/context/compact.js +635 -0
- package/dist/context/compaction-files.d.ts +44 -0
- package/dist/context/compaction-files.js +148 -0
- package/dist/context/llm-compactor.d.ts +53 -0
- package/dist/context/llm-compactor.js +424 -0
- package/dist/context/overflow.d.ts +9 -0
- package/dist/context/overflow.js +50 -0
- package/dist/context/projector.d.ts +34 -0
- package/dist/context/projector.js +251 -0
- package/dist/context/prune.d.ts +26 -0
- package/dist/context/prune.js +171 -0
- package/dist/context/session-write-lock.d.ts +20 -0
- package/dist/context/session-write-lock.js +162 -0
- package/dist/context/token-estimator.d.ts +14 -0
- package/dist/context/token-estimator.js +106 -0
- package/dist/context/tool-images.d.ts +3 -0
- package/dist/context/tool-images.js +35 -0
- package/dist/context/tool-output-truncate.d.ts +24 -0
- package/dist/context/tool-output-truncate.js +181 -0
- package/dist/context/usage.d.ts +34 -0
- package/dist/context/usage.js +230 -0
- package/dist/debug-trace.d.ts +27 -0
- package/dist/debug-trace.js +401 -0
- package/dist/diff-stats.d.ts +5 -0
- package/dist/diff-stats.js +21 -0
- package/dist/external-runtime/grok-acp.d.ts +56 -0
- package/dist/external-runtime/grok-acp.js +386 -0
- package/dist/external-runtime/grok-binary.d.ts +25 -0
- package/dist/external-runtime/grok-binary.js +108 -0
- package/dist/external-runtime/grok-errors.d.ts +7 -0
- package/dist/external-runtime/grok-errors.js +15 -0
- package/dist/external-runtime/grok-input-policy.d.ts +58 -0
- package/dist/external-runtime/grok-input-policy.js +52 -0
- package/dist/external-runtime/grok-ndjson.d.ts +14 -0
- package/dist/external-runtime/grok-ndjson.js +193 -0
- package/dist/external-runtime/grok-network.d.ts +15 -0
- package/dist/external-runtime/grok-network.js +81 -0
- package/dist/external-runtime/grok-preflight.d.ts +28 -0
- package/dist/external-runtime/grok-preflight.js +194 -0
- package/dist/external-runtime/grok-process.d.ts +26 -0
- package/dist/external-runtime/grok-process.js +184 -0
- package/dist/external-runtime/grok-profile.d.ts +32 -0
- package/dist/external-runtime/grok-profile.js +419 -0
- package/dist/external-runtime/grok-provider.d.ts +31 -0
- package/dist/external-runtime/grok-provider.js +41 -0
- package/dist/external-runtime/grok-runtime.d.ts +91 -0
- package/dist/external-runtime/grok-runtime.js +882 -0
- package/dist/external-runtime/index.d.ts +13 -0
- package/dist/external-runtime/index.js +13 -0
- package/dist/external-runtime/session-policy.d.ts +11 -0
- package/dist/external-runtime/session-policy.js +30 -0
- package/dist/external-runtime/types.d.ts +65 -0
- package/dist/external-runtime/types.js +1 -0
- package/dist/feedback/collect.d.ts +7 -0
- package/dist/feedback/collect.js +119 -0
- package/dist/feedback/config.d.ts +14 -0
- package/dist/feedback/config.js +16 -0
- package/dist/feedback/redact.d.ts +1 -0
- package/dist/feedback/redact.js +25 -0
- package/dist/feedback/submit.d.ts +6 -0
- package/dist/feedback/submit.js +43 -0
- package/dist/feedback/types.d.ts +22 -0
- package/dist/feedback/types.js +1 -0
- package/dist/feishu/agent-host/approval-card.d.ts +11 -0
- package/dist/feishu/agent-host/approval-card.js +85 -0
- package/dist/feishu/agent-host/approval-ui.d.ts +59 -0
- package/dist/feishu/agent-host/approval-ui.js +214 -0
- package/dist/feishu/agent-host/run-driver.d.ts +51 -0
- package/dist/feishu/agent-host/run-driver.js +397 -0
- package/dist/feishu/agent-host/runtime-deps.d.ts +33 -0
- package/dist/feishu/agent-host/runtime-deps.js +8 -0
- package/dist/feishu/card/budget.d.ts +40 -0
- package/dist/feishu/card/budget.js +134 -0
- package/dist/feishu/card/renderer.d.ts +29 -0
- package/dist/feishu/card/renderer.js +245 -0
- package/dist/feishu/card/run-state-types.d.ts +49 -0
- package/dist/feishu/card/run-state-types.js +15 -0
- package/dist/feishu/card/run-state.d.ts +21 -0
- package/dist/feishu/card/run-state.js +223 -0
- package/dist/feishu/channel/channel.d.ts +52 -0
- package/dist/feishu/channel/channel.js +74 -0
- package/dist/feishu/config.d.ts +24 -0
- package/dist/feishu/config.js +97 -0
- package/dist/feishu/format.d.ts +6 -0
- package/dist/feishu/format.js +14 -0
- package/dist/feishu/index.d.ts +4 -0
- package/dist/feishu/index.js +4 -0
- package/dist/feishu/logger.d.ts +31 -0
- package/dist/feishu/logger.js +62 -0
- package/dist/feishu/paths.d.ts +12 -0
- package/dist/feishu/paths.js +38 -0
- package/dist/feishu/process-registry.d.ts +29 -0
- package/dist/feishu/process-registry.js +90 -0
- package/dist/feishu/router/commands.d.ts +38 -0
- package/dist/feishu/router/commands.js +286 -0
- package/dist/feishu/router/event-router.d.ts +40 -0
- package/dist/feishu/router/event-router.js +208 -0
- package/dist/feishu/router/whitelist.d.ts +23 -0
- package/dist/feishu/router/whitelist.js +20 -0
- package/dist/feishu/runtime/active-runs.d.ts +32 -0
- package/dist/feishu/runtime/active-runs.js +84 -0
- package/dist/feishu/runtime/pending-queue.d.ts +36 -0
- package/dist/feishu/runtime/pending-queue.js +98 -0
- package/dist/feishu/runtime/process-pool.d.ts +29 -0
- package/dist/feishu/runtime/process-pool.js +49 -0
- package/dist/feishu/schema.d.ts +17 -0
- package/dist/feishu/schema.js +252 -0
- package/dist/feishu/scope/scope-registry.d.ts +39 -0
- package/dist/feishu/scope/scope-registry.js +148 -0
- package/dist/feishu/scope/session-binder.d.ts +44 -0
- package/dist/feishu/scope/session-binder.js +100 -0
- package/dist/feishu/scope/session-store.d.ts +24 -0
- package/dist/feishu/scope/session-store.js +73 -0
- package/dist/feishu/secrets.d.ts +37 -0
- package/dist/feishu/secrets.js +129 -0
- package/dist/feishu/serve.d.ts +12 -0
- package/dist/feishu/serve.js +302 -0
- package/dist/feishu/types.d.ts +75 -0
- package/dist/feishu/types.js +23 -0
- package/dist/feishu/wizard.d.ts +24 -0
- package/dist/feishu/wizard.js +121 -0
- package/dist/goal/command.d.ts +20 -0
- package/dist/goal/command.js +76 -0
- package/dist/goal/engine.d.ts +33 -0
- package/dist/goal/engine.js +65 -0
- package/dist/goal/format.d.ts +18 -0
- package/dist/goal/format.js +112 -0
- package/dist/goal/prompts.d.ts +13 -0
- package/dist/goal/prompts.js +84 -0
- package/dist/goal/store.d.ts +64 -0
- package/dist/goal/store.js +174 -0
- package/dist/goal/tools.d.ts +13 -0
- package/dist/goal/tools.js +67 -0
- package/dist/goal/usage.d.ts +2 -0
- package/dist/goal/usage.js +3 -0
- package/dist/hooks/config.d.ts +9 -0
- package/dist/hooks/config.js +278 -0
- package/dist/hooks/controller.d.ts +24 -0
- package/dist/hooks/controller.js +254 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/log.d.ts +14 -0
- package/dist/hooks/log.js +54 -0
- package/dist/hooks/runner.d.ts +5 -0
- package/dist/hooks/runner.js +225 -0
- package/dist/hooks/trust.d.ts +37 -0
- package/dist/hooks/trust.js +143 -0
- package/dist/hooks/types.d.ts +173 -0
- package/dist/hooks/types.js +46 -0
- package/dist/loop/engine.d.ts +29 -0
- package/dist/loop/engine.js +63 -0
- package/dist/lsp/config.d.ts +18 -0
- package/dist/lsp/config.js +58 -0
- package/dist/lsp/diagnostics.d.ts +24 -0
- package/dist/lsp/diagnostics.js +103 -0
- package/dist/lsp/index.d.ts +3 -0
- package/dist/lsp/index.js +3 -0
- package/dist/lsp/service.d.ts +97 -0
- package/dist/lsp/service.js +815 -0
- package/dist/main.d.ts +5 -0
- package/dist/main.js +984 -0
- package/dist/mcp/client.d.ts +68 -0
- package/dist/mcp/client.js +177 -0
- package/dist/mcp/config.d.ts +30 -0
- package/dist/mcp/config.js +144 -0
- package/dist/mcp/manager.d.ts +67 -0
- package/dist/mcp/manager.js +328 -0
- package/dist/mcp/name.d.ts +26 -0
- package/dist/mcp/name.js +40 -0
- package/dist/mcp/transports.d.ts +54 -0
- package/dist/mcp/transports.js +267 -0
- package/dist/mcp/types.d.ts +111 -0
- package/dist/mcp/types.js +14 -0
- package/dist/memory/db.d.ts +65 -0
- package/dist/memory/db.js +332 -0
- package/dist/memory/index.d.ts +10 -0
- package/dist/memory/index.js +10 -0
- package/dist/memory/paths.d.ts +18 -0
- package/dist/memory/paths.js +38 -0
- package/dist/memory/phase1.d.ts +23 -0
- package/dist/memory/phase1.js +292 -0
- package/dist/memory/phase2.d.ts +19 -0
- package/dist/memory/phase2.js +119 -0
- package/dist/memory/prompts.d.ts +19 -0
- package/dist/memory/prompts.js +104 -0
- package/dist/memory/reset.d.ts +1 -0
- package/dist/memory/reset.js +13 -0
- package/dist/memory/session-policy.d.ts +25 -0
- package/dist/memory/session-policy.js +55 -0
- package/dist/memory/start.d.ts +24 -0
- package/dist/memory/start.js +50 -0
- package/dist/memory/storage.d.ts +11 -0
- package/dist/memory/storage.js +95 -0
- package/dist/memory/store.d.ts +43 -0
- package/dist/memory/store.js +193 -0
- package/dist/memory/usage.d.ts +1 -0
- package/dist/memory/usage.js +38 -0
- package/dist/model-catalog.d.ts +65 -0
- package/dist/model-catalog.js +399 -0
- package/dist/model-config.d.ts +40 -0
- package/dist/model-config.js +74 -0
- package/dist/model-data.generated.d.ts +16 -0
- package/dist/model-data.generated.js +275 -0
- package/dist/model-pricing.d.ts +54 -0
- package/dist/model-pricing.js +256 -0
- package/dist/model-selection.d.ts +7 -0
- package/dist/model-selection.js +18 -0
- package/dist/network/chatgpt-transport.d.ts +16 -0
- package/dist/network/chatgpt-transport.js +232 -0
- package/dist/network/errors.d.ts +47 -0
- package/dist/network/errors.js +48 -0
- package/dist/network/provider-transport-log.d.ts +12 -0
- package/dist/network/provider-transport-log.js +32 -0
- package/dist/network/provider-transport.d.ts +37 -0
- package/dist/network/provider-transport.js +256 -0
- package/dist/network/retry.d.ts +34 -0
- package/dist/network/retry.js +97 -0
- package/dist/network/system-proxy.d.ts +18 -0
- package/dist/network/system-proxy.js +175 -0
- package/dist/oauth/grok.d.ts +26 -0
- package/dist/oauth/grok.js +251 -0
- package/dist/oauth/index.d.ts +4 -0
- package/dist/oauth/index.js +3 -0
- package/dist/oauth/openai-codex.d.ts +15 -0
- package/dist/oauth/openai-codex.js +193 -0
- package/dist/oauth/refresh-control.d.ts +12 -0
- package/dist/oauth/refresh-control.js +42 -0
- package/dist/oauth/storage.d.ts +88 -0
- package/dist/oauth/storage.js +357 -0
- package/dist/oauth/types.d.ts +15 -0
- package/dist/oauth/types.js +1 -0
- package/dist/orchestrator/default-hooks.d.ts +22 -0
- package/dist/orchestrator/default-hooks.js +127 -0
- package/dist/orchestrator/hooks.d.ts +69 -0
- package/dist/orchestrator/hooks.js +52 -0
- package/dist/permission/mode.d.ts +19 -0
- package/dist/permission/mode.js +16 -0
- package/dist/permissions/rule.d.ts +42 -0
- package/dist/permissions/rule.js +293 -0
- package/dist/permissions/settings.d.ts +97 -0
- package/dist/permissions/settings.js +289 -0
- package/dist/permissions/shell-command.d.ts +36 -0
- package/dist/permissions/shell-command.js +226 -0
- package/dist/permissions/trust-prompt.d.ts +10 -0
- package/dist/permissions/trust-prompt.js +34 -0
- package/dist/permissions/trust.d.ts +26 -0
- package/dist/permissions/trust.js +113 -0
- package/dist/permissions/types.d.ts +61 -0
- package/dist/permissions/types.js +14 -0
- package/dist/print-output.d.ts +98 -0
- package/dist/print-output.js +117 -0
- package/dist/prompt/compose.d.ts +19 -0
- package/dist/prompt/compose.js +110 -0
- package/dist/prompt/delegation.d.ts +14 -0
- package/dist/prompt/delegation.js +100 -0
- package/dist/prompt/environment.d.ts +12 -0
- package/dist/prompt/environment.js +55 -0
- package/dist/prompt/provider-prompts/anthropic.d.ts +1 -0
- package/dist/prompt/provider-prompts/anthropic.js +5 -0
- package/dist/prompt/provider-prompts/codex.d.ts +1 -0
- package/dist/prompt/provider-prompts/codex.js +5 -0
- package/dist/prompt/provider-prompts/deepseek.d.ts +1 -0
- package/dist/prompt/provider-prompts/deepseek.js +7 -0
- package/dist/prompt/provider-prompts/default.d.ts +1 -0
- package/dist/prompt/provider-prompts/default.js +6 -0
- package/dist/prompt/provider-prompts/gemini.d.ts +1 -0
- package/dist/prompt/provider-prompts/gemini.js +5 -0
- package/dist/prompt/provider-prompts/glm.d.ts +1 -0
- package/dist/prompt/provider-prompts/glm.js +7 -0
- package/dist/prompt/provider-prompts/gpt.d.ts +1 -0
- package/dist/prompt/provider-prompts/gpt.js +5 -0
- package/dist/prompt/provider-prompts/kimi.d.ts +1 -0
- package/dist/prompt/provider-prompts/kimi.js +8 -0
- package/dist/prompt/reminders.d.ts +33 -0
- package/dist/prompt/reminders.js +135 -0
- package/dist/prompt/routing.d.ts +14 -0
- package/dist/prompt/routing.js +71 -0
- package/dist/prompt/runtime.d.ts +12 -0
- package/dist/prompt/runtime.js +40 -0
- package/dist/prompt/task-reminders.d.ts +12 -0
- package/dist/prompt/task-reminders.js +64 -0
- package/dist/provider-ai-sdk.d.ts +59 -0
- package/dist/provider-ai-sdk.js +584 -0
- package/dist/provider-anthropic.d.ts +126 -0
- package/dist/provider-anthropic.js +940 -0
- package/dist/provider-ark-responses.d.ts +29 -0
- package/dist/provider-ark-responses.js +518 -0
- package/dist/provider-artifacts.d.ts +7 -0
- package/dist/provider-artifacts.js +60 -0
- package/dist/provider-error-record.d.ts +43 -0
- package/dist/provider-error-record.js +213 -0
- package/dist/provider-grok.d.ts +50 -0
- package/dist/provider-grok.js +110 -0
- package/dist/provider-model-policy.d.ts +16 -0
- package/dist/provider-model-policy.js +33 -0
- package/dist/provider-openai-codex.d.ts +66 -0
- package/dist/provider-openai-codex.js +781 -0
- package/dist/provider-registry.d.ts +197 -0
- package/dist/provider-registry.js +1194 -0
- package/dist/provider-transform.d.ts +12 -0
- package/dist/provider-transform.js +293 -0
- package/dist/provider-zen-errors.d.ts +9 -0
- package/dist/provider-zen-errors.js +36 -0
- package/dist/provider.d.ts +85 -0
- package/dist/provider.js +925 -0
- package/dist/question/controller.d.ts +22 -0
- package/dist/question/controller.js +98 -0
- package/dist/question/index.d.ts +2 -0
- package/dist/question/index.js +2 -0
- package/dist/question/normalize.d.ts +6 -0
- package/dist/question/normalize.js +11 -0
- package/dist/question/types.d.ts +42 -0
- package/dist/question/types.js +6 -0
- package/dist/reasoning-debug.d.ts +7 -0
- package/dist/reasoning-debug.js +33 -0
- package/dist/rewind.d.ts +20 -0
- package/dist/rewind.js +29 -0
- package/dist/sdk/index.d.ts +319 -0
- package/dist/sdk/index.js +1068 -0
- package/dist/sdk/replay-event-log.d.ts +26 -0
- package/dist/sdk/replay-event-log.js +122 -0
- package/dist/sdk/session-turn-coordinator.d.ts +45 -0
- package/dist/sdk/session-turn-coordinator.js +227 -0
- package/dist/session-context-fence.d.ts +16 -0
- package/dist/session-context-fence.js +26 -0
- package/dist/session-log.d.ts +25 -0
- package/dist/session-log.js +444 -0
- package/dist/session-title.d.ts +16 -0
- package/dist/session-title.js +131 -0
- package/dist/session-types.d.ts +86 -0
- package/dist/session-types.js +1 -0
- package/dist/session.d.ts +135 -0
- package/dist/session.js +664 -0
- package/dist/skills/discovery.d.ts +12 -0
- package/dist/skills/discovery.js +166 -0
- package/dist/skills/format.d.ts +32 -0
- package/dist/skills/format.js +68 -0
- package/dist/skills/frontmatter.d.ts +5 -0
- package/dist/skills/frontmatter.js +60 -0
- package/dist/skills/invocation.d.ts +8 -0
- package/dist/skills/invocation.js +33 -0
- package/dist/skills/registry.d.ts +28 -0
- package/dist/skills/registry.js +79 -0
- package/dist/skills/types.d.ts +34 -0
- package/dist/skills/types.js +1 -0
- package/dist/slash-commands/commands.d.ts +10 -0
- package/dist/slash-commands/commands.js +1251 -0
- package/dist/slash-commands/feishu.d.ts +17 -0
- package/dist/slash-commands/feishu.js +400 -0
- package/dist/slash-commands/index.d.ts +4 -0
- package/dist/slash-commands/index.js +8 -0
- package/dist/slash-commands/registry.d.ts +32 -0
- package/dist/slash-commands/registry.js +73 -0
- package/dist/slash-commands/types.d.ts +109 -0
- package/dist/slash-commands/types.js +1 -0
- package/dist/slash-commands/unified.d.ts +38 -0
- package/dist/slash-commands/unified.js +38 -0
- package/dist/stats/usage.d.ts +59 -0
- package/dist/stats/usage.js +485 -0
- package/dist/stream-json.d.ts +13 -0
- package/dist/stream-json.js +74 -0
- package/dist/system-prompt.d.ts +40 -0
- package/dist/system-prompt.js +7 -0
- package/dist/tasks/manager.d.ts +145 -0
- package/dist/tasks/manager.js +634 -0
- package/dist/tasks/process-utils.d.ts +10 -0
- package/dist/tasks/process-utils.js +49 -0
- package/dist/tasks/promotion.d.ts +17 -0
- package/dist/tasks/promotion.js +30 -0
- package/dist/tasks/wake.d.ts +53 -0
- package/dist/tasks/wake.js +125 -0
- package/dist/text-display.d.ts +3 -0
- package/dist/text-display.js +25 -0
- package/dist/tools/agent-lifecycle.d.ts +30 -0
- package/dist/tools/agent-lifecycle.js +790 -0
- package/dist/tools/bash.d.ts +23 -0
- package/dist/tools/bash.js +443 -0
- package/dist/tools/child-tools.d.ts +41 -0
- package/dist/tools/child-tools.js +122 -0
- package/dist/tools/edit-apply.d.ts +25 -0
- package/dist/tools/edit-apply.js +274 -0
- package/dist/tools/edit.d.ts +18 -0
- package/dist/tools/edit.js +200 -0
- package/dist/tools/exa-mcp.d.ts +3 -0
- package/dist/tools/exa-mcp.js +74 -0
- package/dist/tools/exit-plan-mode.d.ts +22 -0
- package/dist/tools/exit-plan-mode.js +79 -0
- package/dist/tools/file-mutation-queue.d.ts +2 -0
- package/dist/tools/file-mutation-queue.js +43 -0
- package/dist/tools/file-state.d.ts +48 -0
- package/dist/tools/file-state.js +76 -0
- package/dist/tools/grep.d.ts +9 -0
- package/dist/tools/grep.js +387 -0
- package/dist/tools/index.d.ts +63 -0
- package/dist/tools/index.js +76 -0
- package/dist/tools/ls.d.ts +3 -0
- package/dist/tools/ls.js +85 -0
- package/dist/tools/lsp.d.ts +4 -0
- package/dist/tools/lsp.js +95 -0
- package/dist/tools/memory.d.ts +8 -0
- package/dist/tools/memory.js +77 -0
- package/dist/tools/path-utils.d.ts +8 -0
- package/dist/tools/path-utils.js +53 -0
- package/dist/tools/prompt-metadata.d.ts +3 -0
- package/dist/tools/prompt-metadata.js +17 -0
- package/dist/tools/question.d.ts +3 -0
- package/dist/tools/question.js +177 -0
- package/dist/tools/read.d.ts +8 -0
- package/dist/tools/read.js +309 -0
- package/dist/tools/sensitive-paths.d.ts +11 -0
- package/dist/tools/sensitive-paths.js +106 -0
- package/dist/tools/server-manager.d.ts +6 -0
- package/dist/tools/server-manager.js +6 -0
- package/dist/tools/server.d.ts +6 -0
- package/dist/tools/server.js +249 -0
- package/dist/tools/skill-search.d.ts +10 -0
- package/dist/tools/skill-search.js +134 -0
- package/dist/tools/skill.d.ts +7 -0
- package/dist/tools/skill.js +81 -0
- package/dist/tools/task-tools.d.ts +10 -0
- package/dist/tools/task-tools.js +133 -0
- package/dist/tools/tool-search.d.ts +23 -0
- package/dist/tools/tool-search.js +145 -0
- package/dist/tools/web-fetch.d.ts +6 -0
- package/dist/tools/web-fetch.js +76 -0
- package/dist/tools/web-search.d.ts +5 -0
- package/dist/tools/web-search.js +50 -0
- package/dist/tools/write.d.ts +10 -0
- package/dist/tools/write.js +155 -0
- package/dist/tui/animation-clock.d.ts +14 -0
- package/dist/tui/animation-clock.js +34 -0
- package/dist/tui/app.d.ts +176 -0
- package/dist/tui/app.js +1659 -0
- package/dist/tui/components/approval-dialog.d.ts +43 -0
- package/dist/tui/components/approval-dialog.js +212 -0
- package/dist/tui/components/bottom-sheet.d.ts +9 -0
- package/dist/tui/components/bottom-sheet.js +32 -0
- package/dist/tui/components/context-info.d.ts +54 -0
- package/dist/tui/components/context-info.js +388 -0
- package/dist/tui/components/feedback-dialog.d.ts +56 -0
- package/dist/tui/components/feedback-dialog.js +262 -0
- package/dist/tui/components/feishu-setup-dialog.d.ts +65 -0
- package/dist/tui/components/feishu-setup-dialog.js +332 -0
- package/dist/tui/components/image-preview.d.ts +32 -0
- package/dist/tui/components/image-preview.js +130 -0
- package/dist/tui/components/plan-dialog.d.ts +34 -0
- package/dist/tui/components/plan-dialog.js +196 -0
- package/dist/tui/components/provider-key-input.d.ts +18 -0
- package/dist/tui/components/provider-key-input.js +49 -0
- package/dist/tui/components/question-dialog.d.ts +25 -0
- package/dist/tui/components/question-dialog.js +263 -0
- package/dist/tui/components/responsive-transcript.d.ts +31 -0
- package/dist/tui/components/responsive-transcript.js +77 -0
- package/dist/tui/components/rewind-picker.d.ts +62 -0
- package/dist/tui/components/rewind-picker.js +317 -0
- package/dist/tui/components/session-picker.d.ts +49 -0
- package/dist/tui/components/session-picker.js +303 -0
- package/dist/tui/components/skills-panel.d.ts +63 -0
- package/dist/tui/components/skills-panel.js +582 -0
- package/dist/tui/components/stats-panel.d.ts +40 -0
- package/dist/tui/components/stats-panel.js +301 -0
- package/dist/tui/components/streaming-message.d.ts +69 -0
- package/dist/tui/components/streaming-message.js +398 -0
- package/dist/tui/components/subagent-inspector.d.ts +28 -0
- package/dist/tui/components/subagent-inspector.js +127 -0
- package/dist/tui/components/task-inspector.d.ts +26 -0
- package/dist/tui/components/task-inspector.js +70 -0
- package/dist/tui/components/tasks-pane.d.ts +126 -0
- package/dist/tui/components/tasks-pane.js +566 -0
- package/dist/tui/components/transcript.d.ts +103 -0
- package/dist/tui/components/transcript.js +858 -0
- package/dist/tui/components/welcome.d.ts +20 -0
- package/dist/tui/components/welcome.js +133 -0
- package/dist/tui/components/workflow-inspector.d.ts +30 -0
- package/dist/tui/components/workflow-inspector.js +136 -0
- package/dist/tui/composer-autocomplete.d.ts +76 -0
- package/dist/tui/composer-autocomplete.js +465 -0
- package/dist/tui/composer-style.d.ts +7 -0
- package/dist/tui/composer-style.js +29 -0
- package/dist/tui/controller/agent-event-reducer.d.ts +75 -0
- package/dist/tui/controller/agent-event-reducer.js +239 -0
- package/dist/tui/controller/composer-controller.d.ts +95 -0
- package/dist/tui/controller/composer-controller.js +502 -0
- package/dist/tui/controller/controller.d.ts +199 -0
- package/dist/tui/controller/controller.js +1034 -0
- package/dist/tui/controller/effects.d.ts +71 -0
- package/dist/tui/controller/effects.js +1 -0
- package/dist/tui/controller/goal-runtime-controller.d.ts +47 -0
- package/dist/tui/controller/goal-runtime-controller.js +202 -0
- package/dist/tui/controller/input-queue-machine.d.ts +71 -0
- package/dist/tui/controller/input-queue-machine.js +121 -0
- package/dist/tui/controller/intents.d.ts +56 -0
- package/dist/tui/controller/intents.js +6 -0
- package/dist/tui/controller/overlay-controller.d.ts +64 -0
- package/dist/tui/controller/overlay-controller.js +129 -0
- package/dist/tui/controller/ports.d.ts +57 -0
- package/dist/tui/controller/ports.js +9 -0
- package/dist/tui/controller/session-transition.d.ts +54 -0
- package/dist/tui/controller/session-transition.js +68 -0
- package/dist/tui/controller/state.d.ts +14 -0
- package/dist/tui/controller/state.js +36 -0
- package/dist/tui/controller/task-runtime-controller.d.ts +66 -0
- package/dist/tui/controller/task-runtime-controller.js +158 -0
- package/dist/tui/detect-theme.d.ts +4 -0
- package/dist/tui/detect-theme.js +116 -0
- package/dist/tui/display-history.d.ts +64 -0
- package/dist/tui/display-history.js +283 -0
- package/dist/tui/display-sanitizer.d.ts +3 -0
- package/dist/tui/display-sanitizer.js +38 -0
- package/dist/tui/edit-diff.d.ts +11 -0
- package/dist/tui/edit-diff.js +57 -0
- package/dist/tui/file-mentions.d.ts +29 -0
- package/dist/tui/file-mentions.js +174 -0
- package/dist/tui/footer.d.ts +37 -0
- package/dist/tui/footer.js +80 -0
- package/dist/tui/formatting/edit-diff.d.ts +11 -0
- package/dist/tui/formatting/edit-diff.js +52 -0
- package/dist/tui/formatting/summary.d.ts +43 -0
- package/dist/tui/formatting/summary.js +150 -0
- package/dist/tui/fullscreen.d.ts +48 -0
- package/dist/tui/fullscreen.js +256 -0
- package/dist/tui/image-display.d.ts +23 -0
- package/dist/tui/image-display.js +92 -0
- package/dist/tui/image-paste.d.ts +113 -0
- package/dist/tui/image-paste.js +565 -0
- package/dist/tui/input-history.d.ts +47 -0
- package/dist/tui/input-history.js +250 -0
- package/dist/tui/markdown-style.d.ts +5 -0
- package/dist/tui/markdown-style.js +23 -0
- package/dist/tui/model/composer-buffer.d.ts +55 -0
- package/dist/tui/model/composer-buffer.js +317 -0
- package/dist/tui/model/composer-types.d.ts +17 -0
- package/dist/tui/model/composer-types.js +1 -0
- package/dist/tui/model/display-history.d.ts +78 -0
- package/dist/tui/model/display-history.js +124 -0
- package/dist/tui/model/display-reconstruct.d.ts +3 -0
- package/dist/tui/model/display-reconstruct.js +130 -0
- package/dist/tui/model/file-mentions.d.ts +31 -0
- package/dist/tui/model/file-mentions.js +178 -0
- package/dist/tui/model/image-attachment.d.ts +15 -0
- package/dist/tui/model/image-attachment.js +1 -0
- package/dist/tui/model/image-paste.d.ts +119 -0
- package/dist/tui/model/image-paste.js +610 -0
- package/dist/tui/model/input-history.d.ts +1 -0
- package/dist/tui/model/input-history.js +1 -0
- package/dist/tui/model/input-queue.d.ts +12 -0
- package/dist/tui/model/input-queue.js +17 -0
- package/dist/tui/model/key-events.d.ts +9 -0
- package/dist/tui/model/key-events.js +8 -0
- package/dist/tui/model/paste-operation-tracker.d.ts +13 -0
- package/dist/tui/model/paste-operation-tracker.js +25 -0
- package/dist/tui/model/recent-activity.d.ts +8 -0
- package/dist/tui/model/recent-activity.js +71 -0
- package/dist/tui/model/subagent-view.d.ts +87 -0
- package/dist/tui/model/subagent-view.js +336 -0
- package/dist/tui/model/submit-dedupe.d.ts +5 -0
- package/dist/tui/model/submit-dedupe.js +25 -0
- package/dist/tui/model/sync-output.d.ts +17 -0
- package/dist/tui/model/sync-output.js +35 -0
- package/dist/tui/model/task-lifecycle.d.ts +57 -0
- package/dist/tui/model/task-lifecycle.js +124 -0
- package/dist/tui/model/terminal-env.d.ts +15 -0
- package/dist/tui/model/terminal-env.js +22 -0
- package/dist/tui/model/terminal-mouse.d.ts +28 -0
- package/dist/tui/model/terminal-mouse.js +82 -0
- package/dist/tui/model/theme-style.d.ts +10 -0
- package/dist/tui/model/theme-style.js +79 -0
- package/dist/tui/model/theme.d.ts +72 -0
- package/dist/tui/model/theme.js +121 -0
- package/dist/tui/model/trace-groups.d.ts +45 -0
- package/dist/tui/model/trace-groups.js +558 -0
- package/dist/tui/model/trace-interaction.d.ts +63 -0
- package/dist/tui/model/trace-interaction.js +87 -0
- package/dist/tui/model/width.d.ts +18 -0
- package/dist/tui/model/width.js +130 -0
- package/dist/tui/model-picker-data.d.ts +9 -0
- package/dist/tui/model-picker-data.js +39 -0
- package/dist/tui/model-switch.d.ts +49 -0
- package/dist/tui/model-switch.js +67 -0
- package/dist/tui/paste-placeholder.d.ts +11 -0
- package/dist/tui/paste-placeholder.js +52 -0
- package/dist/tui/recent-activity.d.ts +8 -0
- package/dist/tui/recent-activity.js +71 -0
- package/dist/tui/run-session-picker.d.ts +9 -0
- package/dist/tui/run-session-picker.js +64 -0
- package/dist/tui/run.d.ts +72 -0
- package/dist/tui/run.js +139 -0
- package/dist/tui/session-display.d.ts +6 -0
- package/dist/tui/session-display.js +12 -0
- package/dist/tui/session-picker-data.d.ts +18 -0
- package/dist/tui/session-picker-data.js +21 -0
- package/dist/tui/terminal/multiplexer.d.ts +5 -0
- package/dist/tui/terminal/multiplexer.js +14 -0
- package/dist/tui/testing/fake-agent.d.ts +24 -0
- package/dist/tui/testing/fake-agent.js +22 -0
- package/dist/tui/testing/spy-host.d.ts +21 -0
- package/dist/tui/testing/spy-host.js +55 -0
- package/dist/tui/trace-groups.d.ts +43 -0
- package/dist/tui/trace-groups.js +554 -0
- package/dist/tui/wordmark.d.ts +18 -0
- package/dist/tui/wordmark.js +208 -0
- package/dist/types.d.ts +503 -0
- package/dist/types.js +4 -0
- package/dist/update/index.d.ts +61 -0
- package/dist/update/index.js +267 -0
- package/dist/variant/thinking-level.d.ts +5 -0
- package/dist/variant/thinking-level.js +26 -0
- package/dist/variant/variant-resolver.d.ts +28 -0
- package/dist/variant/variant-resolver.js +62 -0
- package/node_modules/@bubblebrain-ai/pi-tui/LICENSE +21 -0
- package/node_modules/@bubblebrain-ai/pi-tui/README.md +854 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/alt-screen-search.d.ts +26 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/alt-screen-search.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/alt-screen-search.js +121 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/alt-screen-search.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/autocomplete.d.ts +86 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/autocomplete.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/autocomplete.js +649 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/autocomplete.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/alt-screen-flash.d.ts +13 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/alt-screen-flash.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/alt-screen-flash.js +36 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/alt-screen-flash.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/box.d.ts +22 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/box.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/box.js +99 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/box.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/cancellable-loader.d.ts +22 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/cancellable-loader.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/cancellable-loader.js +36 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/cancellable-loader.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/editor.d.ts +330 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/editor.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/editor.js +2344 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/editor.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/h-stack.d.ts +7 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/h-stack.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/h-stack.js +43 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/h-stack.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/image.d.ts +28 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/image.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/image.js +82 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/image.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/input.d.ts +48 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/input.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/input.js +390 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/input.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/loader.d.ts +31 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/loader.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/loader.js +67 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/loader.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/markdown.d.ts +103 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/markdown.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/markdown.js +797 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/markdown.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/scroll-view.d.ts +56 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/scroll-view.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/scroll-view.js +179 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/scroll-view.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/select-list.d.ts +53 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/select-list.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/select-list.js +175 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/select-list.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/settings-list.d.ts +50 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/settings-list.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/settings-list.js +174 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/settings-list.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/spacer.d.ts +12 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/spacer.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/spacer.js +22 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/spacer.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/stack.d.ts +32 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/stack.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/stack.js +109 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/stack.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/text.d.ts +19 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/text.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/text.js +81 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/text.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/truncated-text.d.ts +13 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/truncated-text.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/truncated-text.js +48 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/truncated-text.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/v-stack.d.ts +8 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/v-stack.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/v-stack.js +26 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/v-stack.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/editor-component.d.ts +39 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/editor-component.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/editor-component.js +2 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/editor-component.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/fuzzy.d.ts +16 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/fuzzy.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/fuzzy.js +110 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/fuzzy.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/index.d.ts +31 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/index.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/index.js +42 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/index.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/keybindings.d.ts +273 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/keybindings.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/keybindings.js +231 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/keybindings.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/keys.d.ts +184 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/keys.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/keys.js +1174 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/keys.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/kill-ring.d.ts +28 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/kill-ring.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/kill-ring.js +46 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/kill-ring.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/latex.d.ts +10 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/latex.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/latex.js +1268 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/latex.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/layout-node.d.ts +40 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/layout-node.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/layout-node.js +6 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/layout-node.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/layout.d.ts +42 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/layout.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/layout.js +335 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/layout.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/native-modifiers.d.ts +3 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/native-modifiers.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/native-modifiers.js +60 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/native-modifiers.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/stdin-buffer.d.ts +56 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/stdin-buffer.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/stdin-buffer.js +363 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/stdin-buffer.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal-colors.d.ts +10 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal-colors.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal-colors.js +59 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal-colors.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal-image.d.ts +116 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal-image.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal-image.js +518 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal-image.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal.d.ts +142 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal.js +544 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/testing.d.ts +11 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/testing.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/testing.js +11 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/testing.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui-alt-screen.d.ts +141 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui-alt-screen.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui-alt-screen.js +1340 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui-alt-screen.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui-main-screen.d.ts +39 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui-main-screen.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui-main-screen.js +536 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui-main-screen.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui.d.ts +340 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui.js +1020 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/undo-stack.d.ts +17 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/undo-stack.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/undo-stack.js +27 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/undo-stack.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/utils.d.ts +96 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/utils.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/utils.js +1193 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/utils.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/word-navigation.d.ts +25 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/word-navigation.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/word-navigation.js +96 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/word-navigation.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/test/virtual-terminal.d.ts +73 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/test/virtual-terminal.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/test/virtual-terminal.js +188 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/test/virtual-terminal.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/native/darwin/README.md +20 -0
- package/node_modules/@bubblebrain-ai/pi-tui/native/darwin/build.sh +62 -0
- package/node_modules/@bubblebrain-ai/pi-tui/native/darwin/prebuilds/darwin-arm64/darwin-modifiers.node +0 -0
- package/node_modules/@bubblebrain-ai/pi-tui/native/darwin/prebuilds/darwin-x64/darwin-modifiers.node +0 -0
- package/node_modules/@bubblebrain-ai/pi-tui/native/darwin/src/darwin-modifiers.c +70 -0
- package/node_modules/@bubblebrain-ai/pi-tui/native/win32/README.md +22 -0
- package/node_modules/@bubblebrain-ai/pi-tui/native/win32/build.mjs +229 -0
- package/node_modules/@bubblebrain-ai/pi-tui/native/win32/prebuilds/win32-arm64/win32-console-mode.node +0 -0
- package/node_modules/@bubblebrain-ai/pi-tui/native/win32/prebuilds/win32-x64/win32-console-mode.node +0 -0
- package/node_modules/@bubblebrain-ai/pi-tui/native/win32/src/win32-console-mode.c +119 -0
- package/node_modules/@bubblebrain-ai/pi-tui/package.json +66 -0
- package/node_modules/get-east-asian-width/index.d.ts +60 -0
- package/node_modules/get-east-asian-width/index.js +30 -0
- package/node_modules/get-east-asian-width/license +9 -0
- package/node_modules/get-east-asian-width/lookup-data.js +21 -0
- package/node_modules/get-east-asian-width/lookup.js +138 -0
- package/node_modules/get-east-asian-width/package.json +71 -0
- package/node_modules/get-east-asian-width/readme.md +65 -0
- package/node_modules/get-east-asian-width/utilities.js +24 -0
- package/node_modules/marked/LICENSE +44 -0
- package/node_modules/marked/README.md +115 -0
- package/node_modules/marked/bin/main.js +284 -0
- package/node_modules/marked/bin/marked.js +16 -0
- package/node_modules/marked/lib/marked.d.ts +760 -0
- package/node_modules/marked/lib/marked.esm.js +77 -0
- package/node_modules/marked/lib/marked.esm.js.map +7 -0
- package/node_modules/marked/lib/marked.umd.js +79 -0
- package/node_modules/marked/lib/marked.umd.js.map +7 -0
- package/node_modules/marked/man/marked.1 +113 -0
- package/node_modules/marked/man/marked.1.md +93 -0
- package/node_modules/marked/package.json +103 -0
- package/package.json +96 -17
- package/bin/bubble.js +0 -39
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { realpathSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
const queues = new Map();
|
|
4
|
+
function queueKey(filePath) {
|
|
5
|
+
const resolved = resolve(filePath);
|
|
6
|
+
try {
|
|
7
|
+
return realpathSync.native(resolved);
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return resolved;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export async function withFileMutationQueue(filePath, fn) {
|
|
14
|
+
return withQueueKey(queueKey(filePath), fn);
|
|
15
|
+
}
|
|
16
|
+
export async function withFileMutationQueues(filePaths, fn) {
|
|
17
|
+
const keys = [...new Set(filePaths.map(queueKey))].sort();
|
|
18
|
+
const run = (index) => {
|
|
19
|
+
if (index >= keys.length)
|
|
20
|
+
return fn();
|
|
21
|
+
return withQueueKey(keys[index], () => run(index + 1));
|
|
22
|
+
};
|
|
23
|
+
return run(0);
|
|
24
|
+
}
|
|
25
|
+
async function withQueueKey(key, fn) {
|
|
26
|
+
const current = queues.get(key) ?? Promise.resolve();
|
|
27
|
+
let release;
|
|
28
|
+
const next = new Promise((resolveNext) => {
|
|
29
|
+
release = resolveNext;
|
|
30
|
+
});
|
|
31
|
+
const chained = current.then(() => next);
|
|
32
|
+
queues.set(key, chained);
|
|
33
|
+
await current;
|
|
34
|
+
try {
|
|
35
|
+
return await fn();
|
|
36
|
+
}
|
|
37
|
+
finally {
|
|
38
|
+
release();
|
|
39
|
+
if (queues.get(key) === chained) {
|
|
40
|
+
queues.delete(key);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export type FileObservationSource = "read" | "write" | "edit";
|
|
2
|
+
export interface FileVersion {
|
|
3
|
+
hash: string;
|
|
4
|
+
mtimeMs: number;
|
|
5
|
+
size: number;
|
|
6
|
+
}
|
|
7
|
+
export type FileFreshnessResult = {
|
|
8
|
+
ok: true;
|
|
9
|
+
version: FileVersion;
|
|
10
|
+
} | {
|
|
11
|
+
ok: false;
|
|
12
|
+
reason: "unobserved" | "missing" | "changed";
|
|
13
|
+
observed?: FileVersion;
|
|
14
|
+
current?: FileVersion;
|
|
15
|
+
};
|
|
16
|
+
export interface ReadHistoryEntry {
|
|
17
|
+
argOffset: number | undefined;
|
|
18
|
+
argLimit: number | undefined;
|
|
19
|
+
effectiveOffset: number;
|
|
20
|
+
effectiveLimit: number;
|
|
21
|
+
returnedLines: number;
|
|
22
|
+
totalLines: number;
|
|
23
|
+
mtimeMs: number;
|
|
24
|
+
truncated: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare class FileStateTracker {
|
|
27
|
+
private readonly cwd;
|
|
28
|
+
private readonly observed;
|
|
29
|
+
private readonly readHistory;
|
|
30
|
+
constructor(cwd: string);
|
|
31
|
+
getReadHistory(filePath: string): ReadHistoryEntry | undefined;
|
|
32
|
+
setReadHistory(filePath: string, entry: ReadHistoryEntry): void;
|
|
33
|
+
/**
|
|
34
|
+
* Drops all read-dedup state. Call this whenever conversation history is
|
|
35
|
+
* compacted or pruned, because the dedup stub points the model back at
|
|
36
|
+
* earlier tool_result content that may no longer be resident.
|
|
37
|
+
*/
|
|
38
|
+
invalidateReadHistory(): void;
|
|
39
|
+
observe(filePath: string, source: FileObservationSource, content?: string): Promise<FileVersion>;
|
|
40
|
+
checkFresh(filePath: string): Promise<FileFreshnessResult>;
|
|
41
|
+
private resolvePath;
|
|
42
|
+
private computeVersion;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Inside the workspace both as written and where symlinks actually lead, so
|
|
46
|
+
* a link inside the repository cannot carry an auto-approved write outside.
|
|
47
|
+
*/
|
|
48
|
+
export declare function isWithinWorkspace(cwd: string, filePath: string): boolean;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { stat, readFile } from "node:fs/promises";
|
|
3
|
+
import { isAbsolute, relative, resolve, sep } from "node:path";
|
|
4
|
+
import { resolveThroughLinks } from "./path-utils.js";
|
|
5
|
+
export class FileStateTracker {
|
|
6
|
+
cwd;
|
|
7
|
+
observed = new Map();
|
|
8
|
+
readHistory = new Map();
|
|
9
|
+
constructor(cwd) {
|
|
10
|
+
this.cwd = cwd;
|
|
11
|
+
}
|
|
12
|
+
getReadHistory(filePath) {
|
|
13
|
+
return this.readHistory.get(this.resolvePath(filePath));
|
|
14
|
+
}
|
|
15
|
+
setReadHistory(filePath, entry) {
|
|
16
|
+
this.readHistory.set(this.resolvePath(filePath), entry);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Drops all read-dedup state. Call this whenever conversation history is
|
|
20
|
+
* compacted or pruned, because the dedup stub points the model back at
|
|
21
|
+
* earlier tool_result content that may no longer be resident.
|
|
22
|
+
*/
|
|
23
|
+
invalidateReadHistory() {
|
|
24
|
+
this.readHistory.clear();
|
|
25
|
+
}
|
|
26
|
+
async observe(filePath, source, content) {
|
|
27
|
+
const absolute = this.resolvePath(filePath);
|
|
28
|
+
const version = await this.computeVersion(absolute, content);
|
|
29
|
+
this.observed.set(absolute, { ...version, source, observedAt: Date.now() });
|
|
30
|
+
return version;
|
|
31
|
+
}
|
|
32
|
+
async checkFresh(filePath) {
|
|
33
|
+
const absolute = this.resolvePath(filePath);
|
|
34
|
+
const observed = this.observed.get(absolute);
|
|
35
|
+
if (!observed) {
|
|
36
|
+
return { ok: false, reason: "unobserved" };
|
|
37
|
+
}
|
|
38
|
+
let current;
|
|
39
|
+
try {
|
|
40
|
+
current = await this.computeVersion(absolute);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return { ok: false, reason: "missing", observed };
|
|
44
|
+
}
|
|
45
|
+
if (current.hash === observed.hash && current.size === observed.size) {
|
|
46
|
+
return { ok: true, version: current };
|
|
47
|
+
}
|
|
48
|
+
return { ok: false, reason: "changed", observed, current };
|
|
49
|
+
}
|
|
50
|
+
resolvePath(filePath) {
|
|
51
|
+
return resolve(this.cwd, filePath);
|
|
52
|
+
}
|
|
53
|
+
async computeVersion(filePath, content) {
|
|
54
|
+
const [stats, bytes] = await Promise.all([
|
|
55
|
+
stat(filePath),
|
|
56
|
+
content === undefined ? readFile(filePath) : Promise.resolve(Buffer.from(content, "utf-8")),
|
|
57
|
+
]);
|
|
58
|
+
return {
|
|
59
|
+
hash: createHash("sha256").update(bytes).digest("hex"),
|
|
60
|
+
mtimeMs: stats.mtimeMs,
|
|
61
|
+
size: stats.size,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Inside the workspace both as written and where symlinks actually lead, so
|
|
67
|
+
* a link inside the repository cannot carry an auto-approved write outside.
|
|
68
|
+
*/
|
|
69
|
+
export function isWithinWorkspace(cwd, filePath) {
|
|
70
|
+
return isInside(resolve(cwd), resolve(filePath))
|
|
71
|
+
&& isInside(resolveThroughLinks(cwd), resolveThroughLinks(filePath));
|
|
72
|
+
}
|
|
73
|
+
function isInside(root, path) {
|
|
74
|
+
const rel = relative(root, path);
|
|
75
|
+
return rel === "" || (rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute(rel));
|
|
76
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Grep tool - bounded, streaming search using ripgrep.
|
|
3
|
+
*
|
|
4
|
+
* The limits in this file are model-context safety boundaries, not UI-only
|
|
5
|
+
* truncation. We stop rg as soon as a global budget is filled so a repository
|
|
6
|
+
* search can never materialize a multi-megabyte tool result in memory/history.
|
|
7
|
+
*/
|
|
8
|
+
import type { ToolRegistryEntry } from "../types.js";
|
|
9
|
+
export declare function createGrepTool(cwd: string): ToolRegistryEntry;
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Grep tool - bounded, streaming search using ripgrep.
|
|
3
|
+
*
|
|
4
|
+
* The limits in this file are model-context safety boundaries, not UI-only
|
|
5
|
+
* truncation. We stop rg as soon as a global budget is filled so a repository
|
|
6
|
+
* search can never materialize a multi-megabyte tool result in memory/history.
|
|
7
|
+
*/
|
|
8
|
+
import { spawn } from "node:child_process";
|
|
9
|
+
import { resolve as resolvePath } from "node:path";
|
|
10
|
+
import { StringDecoder } from "node:string_decoder";
|
|
11
|
+
import { isSensitivePath } from "./sensitive-paths.js";
|
|
12
|
+
import { analyzeToolIntent } from "../agent/tool-intent.js";
|
|
13
|
+
import { resolveToolPath } from "./path-utils.js";
|
|
14
|
+
const DEFAULT_MATCH_LIMIT = 100;
|
|
15
|
+
const MAX_MATCH_LIMIT = 1_000;
|
|
16
|
+
const MAX_RENDERED_LINE_CODE_POINTS = 1_000;
|
|
17
|
+
const MAX_RESULT_BYTES = 40 * 1024;
|
|
18
|
+
const MAX_RAW_STDOUT_BYTES = 5 * 1024 * 1024;
|
|
19
|
+
const MAX_STDERR_BYTES = 64 * 1024;
|
|
20
|
+
const MAX_FILE_SIZE = "5M";
|
|
21
|
+
const MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
|
|
22
|
+
const GREP_TIMEOUT_MS = 30_000;
|
|
23
|
+
const KILL_GRACE_MS = 250;
|
|
24
|
+
const RESULT_NOTICE_RESERVE_BYTES = 1_024;
|
|
25
|
+
export function createGrepTool(cwd) {
|
|
26
|
+
return {
|
|
27
|
+
name: "grep",
|
|
28
|
+
readOnly: true,
|
|
29
|
+
effect: "read",
|
|
30
|
+
description: [
|
|
31
|
+
"Search file contents using regex (via ripgrep).",
|
|
32
|
+
`Returns at most ${DEFAULT_MATCH_LIMIT} matches by default (explicit limit is capped at ${MAX_MATCH_LIMIT}),`,
|
|
33
|
+
`${MAX_RESULT_BYTES / 1024}KiB total, and ${MAX_RENDERED_LINE_CODE_POINTS} Unicode characters per rendered match.`,
|
|
34
|
+
`Files larger than ${MAX_FILE_SIZE} are skipped. Narrow path/glob/pattern when a result is marked truncated.`,
|
|
35
|
+
].join(" "),
|
|
36
|
+
parameters: {
|
|
37
|
+
type: "object",
|
|
38
|
+
properties: {
|
|
39
|
+
pattern: { type: "string", description: "Regex pattern to search for" },
|
|
40
|
+
path: { type: "string", description: "Directory or file to search in (optional, default: cwd)" },
|
|
41
|
+
glob: { type: "string", description: "Glob pattern to filter files (optional, e.g. '*.ts')" },
|
|
42
|
+
limit: {
|
|
43
|
+
type: "number",
|
|
44
|
+
description: `Maximum matches to return (default ${DEFAULT_MATCH_LIMIT}, hard maximum ${MAX_MATCH_LIMIT})`,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
required: ["pattern"],
|
|
48
|
+
},
|
|
49
|
+
async execute(args, ctx) {
|
|
50
|
+
const searchPath = args.path ? resolveToolPath(cwd, args.path) : cwd;
|
|
51
|
+
const pattern = String(args.pattern);
|
|
52
|
+
const matchLimit = normalizeMatchLimit(args.limit);
|
|
53
|
+
const intent = analyzeToolIntent({
|
|
54
|
+
name: "grep",
|
|
55
|
+
parsedArgs: {
|
|
56
|
+
pattern,
|
|
57
|
+
path: args.path,
|
|
58
|
+
glob: args.glob,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
if (isSensitivePath(searchPath)) {
|
|
62
|
+
return {
|
|
63
|
+
content: `Error: Search blocked for sensitive credential storage: ${searchPath}`,
|
|
64
|
+
isError: true,
|
|
65
|
+
status: "blocked",
|
|
66
|
+
metadata: {
|
|
67
|
+
kind: "security",
|
|
68
|
+
path: searchPath,
|
|
69
|
+
pattern,
|
|
70
|
+
searchSignature: intent.search?.signature,
|
|
71
|
+
searchFamily: intent.search?.familyKey,
|
|
72
|
+
reason: "Sensitive credential storage is not searchable from general-purpose tasks.",
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
const rgArgs = [
|
|
77
|
+
"--json",
|
|
78
|
+
"--line-number",
|
|
79
|
+
"--color=never",
|
|
80
|
+
"--max-columns",
|
|
81
|
+
String(MAX_RENDERED_LINE_CODE_POINTS),
|
|
82
|
+
"--max-columns-preview",
|
|
83
|
+
"--max-filesize",
|
|
84
|
+
MAX_FILE_SIZE,
|
|
85
|
+
];
|
|
86
|
+
if (args.glob)
|
|
87
|
+
rgArgs.push("--glob", String(args.glob));
|
|
88
|
+
rgArgs.push("--", pattern, searchPath);
|
|
89
|
+
return executeBoundedGrep({
|
|
90
|
+
cwd,
|
|
91
|
+
searchPath,
|
|
92
|
+
pattern,
|
|
93
|
+
rgArgs,
|
|
94
|
+
matchLimit,
|
|
95
|
+
abortSignal: ctx.abortSignal,
|
|
96
|
+
baseMetadata: {
|
|
97
|
+
kind: "search",
|
|
98
|
+
path: searchPath,
|
|
99
|
+
pattern,
|
|
100
|
+
searchSignature: intent.search?.signature,
|
|
101
|
+
searchFamily: intent.search?.familyKey,
|
|
102
|
+
maxFileSizeBytes: MAX_FILE_SIZE_BYTES,
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function executeBoundedGrep(options) {
|
|
109
|
+
return new Promise((resolve) => {
|
|
110
|
+
const child = spawn("rg", options.rgArgs, {
|
|
111
|
+
cwd: options.cwd,
|
|
112
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
113
|
+
});
|
|
114
|
+
const decoder = new StringDecoder("utf8");
|
|
115
|
+
const matches = [];
|
|
116
|
+
// The root check alone is not enough: ripgrep searches inside an explicit
|
|
117
|
+
// hidden root, so `path: ~/.aws` would reach ~/.aws/credentials. Every
|
|
118
|
+
// matched file gets the same check the read tool applies (cached per file).
|
|
119
|
+
const sensitiveByPath = new Map();
|
|
120
|
+
const isSensitiveMatch = (absolutePath) => {
|
|
121
|
+
let sensitive = sensitiveByPath.get(absolutePath);
|
|
122
|
+
if (sensitive === undefined) {
|
|
123
|
+
sensitive = isSensitivePath(absolutePath);
|
|
124
|
+
sensitiveByPath.set(absolutePath, sensitive);
|
|
125
|
+
}
|
|
126
|
+
return sensitive;
|
|
127
|
+
};
|
|
128
|
+
let stdoutBuffer = "";
|
|
129
|
+
let stdoutBytes = 0;
|
|
130
|
+
let stderrBytes = 0;
|
|
131
|
+
let stderr = "";
|
|
132
|
+
let stopReason;
|
|
133
|
+
let spawnError;
|
|
134
|
+
let settled = false;
|
|
135
|
+
let killTimer;
|
|
136
|
+
const requestStop = (reason) => {
|
|
137
|
+
if (stopReason)
|
|
138
|
+
return;
|
|
139
|
+
stopReason = reason;
|
|
140
|
+
if (child.exitCode === null && child.signalCode === null) {
|
|
141
|
+
child.kill("SIGTERM");
|
|
142
|
+
killTimer = setTimeout(() => {
|
|
143
|
+
if (child.exitCode === null && child.signalCode === null)
|
|
144
|
+
child.kill("SIGKILL");
|
|
145
|
+
}, KILL_GRACE_MS);
|
|
146
|
+
killTimer.unref?.();
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
const processJsonLine = (line) => {
|
|
150
|
+
if (!line.trim() || stopReason)
|
|
151
|
+
return;
|
|
152
|
+
try {
|
|
153
|
+
const event = JSON.parse(line);
|
|
154
|
+
if (event.type !== "match")
|
|
155
|
+
return;
|
|
156
|
+
const rawPath = decodeRgField(event.data?.path);
|
|
157
|
+
// A path that is not valid UTF-8 cannot be checked (or read back by
|
|
158
|
+
// the model), so its matches are dropped rather than shown unchecked.
|
|
159
|
+
if (event.data?.path && !rawPath)
|
|
160
|
+
return;
|
|
161
|
+
const absolutePath = rawPath ? resolvePath(options.cwd, rawPath) : undefined;
|
|
162
|
+
if (absolutePath && isSensitiveMatch(absolutePath))
|
|
163
|
+
return;
|
|
164
|
+
const lineNumber = event.data?.line_number;
|
|
165
|
+
const rawText = decodeRgField(event.data?.lines, "[non-UTF-8 match bytes omitted]") ?? "";
|
|
166
|
+
const displayPath = rawPath || "<non-UTF-8 path>";
|
|
167
|
+
const normalizedText = rawText.replace(/\r\n/g, "\n").replace(/\r/g, "").replace(/\n$/, "");
|
|
168
|
+
const rendered = truncateCodePoints(`${displayPath}:${typeof lineNumber === "number" ? lineNumber : "?"}: ${normalizedText}`, MAX_RENDERED_LINE_CODE_POINTS);
|
|
169
|
+
matches.push({
|
|
170
|
+
rendered,
|
|
171
|
+
...(absolutePath ? { absolutePath } : {}),
|
|
172
|
+
});
|
|
173
|
+
// We stop at N rather than pretending we proved there are N+1 matches.
|
|
174
|
+
// The notice says "limit reached / may be incomplete", which is honest
|
|
175
|
+
// even for the exact-fit case and avoids continuing a huge tree walk.
|
|
176
|
+
if (matches.length >= options.matchLimit)
|
|
177
|
+
requestStop("match_limit");
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
// A truncated/invalid JSON event is not useful to the model. Raw byte
|
|
181
|
+
// accounting remains authoritative and will stop pathological lines.
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
const processDecodedText = (text) => {
|
|
185
|
+
stdoutBuffer += text;
|
|
186
|
+
while (!stopReason) {
|
|
187
|
+
const newline = stdoutBuffer.indexOf("\n");
|
|
188
|
+
if (newline < 0)
|
|
189
|
+
break;
|
|
190
|
+
const line = stdoutBuffer.slice(0, newline);
|
|
191
|
+
stdoutBuffer = stdoutBuffer.slice(newline + 1);
|
|
192
|
+
processJsonLine(line);
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
child.stdout.on("data", (value) => {
|
|
196
|
+
if (stopReason)
|
|
197
|
+
return;
|
|
198
|
+
const chunk = Buffer.isBuffer(value) ? value : Buffer.from(value);
|
|
199
|
+
const remaining = Math.max(0, MAX_RAW_STDOUT_BYTES - stdoutBytes);
|
|
200
|
+
const accepted = chunk.subarray(0, remaining);
|
|
201
|
+
stdoutBytes += accepted.length;
|
|
202
|
+
if (accepted.length > 0)
|
|
203
|
+
processDecodedText(decoder.write(accepted));
|
|
204
|
+
if (accepted.length < chunk.length || stdoutBytes >= MAX_RAW_STDOUT_BYTES) {
|
|
205
|
+
requestStop("stdout_limit");
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
child.stdout.on("end", () => {
|
|
209
|
+
if (stopReason)
|
|
210
|
+
return;
|
|
211
|
+
processDecodedText(decoder.end());
|
|
212
|
+
if (stdoutBuffer) {
|
|
213
|
+
processJsonLine(stdoutBuffer);
|
|
214
|
+
stdoutBuffer = "";
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
child.stderr.on("data", (value) => {
|
|
218
|
+
if (stopReason)
|
|
219
|
+
return;
|
|
220
|
+
const chunk = Buffer.isBuffer(value) ? value : Buffer.from(value);
|
|
221
|
+
const remaining = Math.max(0, MAX_STDERR_BYTES - stderrBytes);
|
|
222
|
+
const accepted = chunk.subarray(0, remaining);
|
|
223
|
+
stderrBytes += accepted.length;
|
|
224
|
+
if (accepted.length > 0)
|
|
225
|
+
stderr += accepted.toString("utf8");
|
|
226
|
+
if (accepted.length < chunk.length || stderrBytes >= MAX_STDERR_BYTES) {
|
|
227
|
+
requestStop("stderr_limit");
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
const timeout = setTimeout(() => requestStop("timeout"), GREP_TIMEOUT_MS);
|
|
231
|
+
timeout.unref?.();
|
|
232
|
+
const onAbort = () => requestStop("aborted");
|
|
233
|
+
options.abortSignal?.addEventListener("abort", onAbort, { once: true });
|
|
234
|
+
if (options.abortSignal?.aborted)
|
|
235
|
+
onAbort();
|
|
236
|
+
child.on("error", (error) => {
|
|
237
|
+
spawnError = error;
|
|
238
|
+
});
|
|
239
|
+
child.on("close", (code) => {
|
|
240
|
+
if (settled)
|
|
241
|
+
return;
|
|
242
|
+
settled = true;
|
|
243
|
+
clearTimeout(timeout);
|
|
244
|
+
if (killTimer)
|
|
245
|
+
clearTimeout(killTimer);
|
|
246
|
+
options.abortSignal?.removeEventListener("abort", onAbort);
|
|
247
|
+
if (stopReason === "aborted") {
|
|
248
|
+
resolve({
|
|
249
|
+
content: "Search cancelled.",
|
|
250
|
+
isError: true,
|
|
251
|
+
status: "cancelled",
|
|
252
|
+
metadata: { ...options.baseMetadata, matches: 0, truncated: false, paths: [] },
|
|
253
|
+
});
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
if (spawnError) {
|
|
257
|
+
resolve({
|
|
258
|
+
content: `Error calling grep: ${spawnError.message}`,
|
|
259
|
+
isError: true,
|
|
260
|
+
status: "command_error",
|
|
261
|
+
metadata: { ...options.baseMetadata, matches: 0, truncated: false, paths: [] },
|
|
262
|
+
});
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const naturalCommandError = !stopReason && code !== 0 && code !== 1;
|
|
266
|
+
const stoppedWithoutMatches = !!stopReason && matches.length === 0;
|
|
267
|
+
if (matches.length === 0 && !stoppedWithoutMatches && !naturalCommandError) {
|
|
268
|
+
resolve({
|
|
269
|
+
content: "No matches found.",
|
|
270
|
+
status: "no_match",
|
|
271
|
+
metadata: { ...options.baseMetadata, matches: 0, truncated: false, paths: [] },
|
|
272
|
+
});
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
if (naturalCommandError && matches.length === 0) {
|
|
276
|
+
resolve({
|
|
277
|
+
content: `Error calling grep: ${stderr.trim() || `ripgrep exited with code ${code}`}`,
|
|
278
|
+
isError: true,
|
|
279
|
+
status: "command_error",
|
|
280
|
+
metadata: { ...options.baseMetadata, matches: 0, truncated: false, paths: [] },
|
|
281
|
+
});
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
const formatted = formatMatches(matches, options.matchLimit, stopReason, naturalCommandError ? stderr.trim() : "");
|
|
285
|
+
const truncated = !!stopReason || formatted.byteTruncated || naturalCommandError;
|
|
286
|
+
const paths = [...new Set(formatted.emittedMatches.flatMap((match) => match.absolutePath ? [match.absolutePath] : []))];
|
|
287
|
+
resolve({
|
|
288
|
+
content: formatted.content,
|
|
289
|
+
...(naturalCommandError && matches.length === 0 ? { isError: true } : {}),
|
|
290
|
+
status: stopReason === "timeout" && matches.length === 0
|
|
291
|
+
? "timeout"
|
|
292
|
+
: truncated
|
|
293
|
+
? "partial"
|
|
294
|
+
: "success",
|
|
295
|
+
metadata: {
|
|
296
|
+
...options.baseMetadata,
|
|
297
|
+
matches: formatted.emittedMatches.length,
|
|
298
|
+
collectedMatches: matches.length,
|
|
299
|
+
truncated,
|
|
300
|
+
truncationReason: stopReason ?? (formatted.byteTruncated ? "result_bytes" : naturalCommandError ? "command_error" : undefined),
|
|
301
|
+
rawStdoutBytes: stdoutBytes,
|
|
302
|
+
paths,
|
|
303
|
+
},
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
function formatMatches(matches, matchLimit, stopReason, commandWarning) {
|
|
309
|
+
const emitted = [];
|
|
310
|
+
let bodyBytes = 0;
|
|
311
|
+
const bodyBudget = MAX_RESULT_BYTES - RESULT_NOTICE_RESERVE_BYTES;
|
|
312
|
+
for (const match of matches) {
|
|
313
|
+
const lineBytes = Buffer.byteLength(match.rendered, "utf8") + (emitted.length > 0 ? 1 : 0);
|
|
314
|
+
if (bodyBytes + lineBytes > bodyBudget)
|
|
315
|
+
break;
|
|
316
|
+
emitted.push(match);
|
|
317
|
+
bodyBytes += lineBytes;
|
|
318
|
+
}
|
|
319
|
+
const byteTruncated = emitted.length < matches.length;
|
|
320
|
+
const notices = [];
|
|
321
|
+
if (stopReason === "match_limit") {
|
|
322
|
+
notices.push(`Search stopped after reaching the global limit of ${matchLimit} matches; results may be incomplete. Narrow path/glob/pattern to continue.`);
|
|
323
|
+
}
|
|
324
|
+
else if (stopReason === "stdout_limit") {
|
|
325
|
+
notices.push(`Raw ripgrep output reached ${formatBytes(MAX_RAW_STDOUT_BYTES)}; results are incomplete. Narrow the search.`);
|
|
326
|
+
}
|
|
327
|
+
else if (stopReason === "stderr_limit") {
|
|
328
|
+
notices.push(`ripgrep diagnostics reached ${formatBytes(MAX_STDERR_BYTES)}; results are incomplete.`);
|
|
329
|
+
}
|
|
330
|
+
else if (stopReason === "timeout") {
|
|
331
|
+
notices.push(`Search timed out after ${GREP_TIMEOUT_MS / 1000}s; results are incomplete. Narrow the search.`);
|
|
332
|
+
}
|
|
333
|
+
if (byteTruncated) {
|
|
334
|
+
notices.push(`Showing ${emitted.length} of ${matches.length} collected matches because tool output is capped at ${formatBytes(MAX_RESULT_BYTES)}.`);
|
|
335
|
+
}
|
|
336
|
+
if (commandWarning)
|
|
337
|
+
notices.push(`ripgrep also reported: ${truncateCodePoints(commandWarning, 300)}`);
|
|
338
|
+
let content = emitted.map((match) => match.rendered).join("\n");
|
|
339
|
+
if (notices.length > 0)
|
|
340
|
+
content += `${content ? "\n" : ""}[${notices.join(" ")}]`;
|
|
341
|
+
// The reserve above normally guarantees this. Keep an exact byte backstop so
|
|
342
|
+
// future notice copy cannot accidentally violate the model-facing contract.
|
|
343
|
+
if (Buffer.byteLength(content, "utf8") > MAX_RESULT_BYTES) {
|
|
344
|
+
content = truncateUtf8Prefix(content, MAX_RESULT_BYTES);
|
|
345
|
+
}
|
|
346
|
+
return { content, emittedMatches: emitted, byteTruncated };
|
|
347
|
+
}
|
|
348
|
+
function normalizeMatchLimit(value) {
|
|
349
|
+
if (typeof value !== "number" || !Number.isFinite(value))
|
|
350
|
+
return DEFAULT_MATCH_LIMIT;
|
|
351
|
+
return Math.min(MAX_MATCH_LIMIT, Math.max(1, Math.floor(value)));
|
|
352
|
+
}
|
|
353
|
+
function decodeRgField(value, invalidBytesFallback) {
|
|
354
|
+
if (!value || typeof value !== "object")
|
|
355
|
+
return undefined;
|
|
356
|
+
const record = value;
|
|
357
|
+
if (typeof record.text === "string")
|
|
358
|
+
return record.text;
|
|
359
|
+
if (typeof record.bytes === "string") {
|
|
360
|
+
try {
|
|
361
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(Buffer.from(record.bytes, "base64"));
|
|
362
|
+
}
|
|
363
|
+
catch {
|
|
364
|
+
return invalidBytesFallback;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
return undefined;
|
|
368
|
+
}
|
|
369
|
+
function truncateCodePoints(value, maxCodePoints) {
|
|
370
|
+
const points = Array.from(value);
|
|
371
|
+
if (points.length <= maxCodePoints)
|
|
372
|
+
return value;
|
|
373
|
+
const marker = "... [truncated]";
|
|
374
|
+
return `${points.slice(0, Math.max(0, maxCodePoints - Array.from(marker).length)).join("")}${marker}`;
|
|
375
|
+
}
|
|
376
|
+
function truncateUtf8Prefix(value, maxBytes) {
|
|
377
|
+
const bytes = Buffer.from(value, "utf8");
|
|
378
|
+
if (bytes.length <= maxBytes)
|
|
379
|
+
return value;
|
|
380
|
+
let end = maxBytes;
|
|
381
|
+
while (end > 0 && (bytes[end] & 0xc0) === 0x80)
|
|
382
|
+
end -= 1;
|
|
383
|
+
return bytes.subarray(0, end).toString("utf8");
|
|
384
|
+
}
|
|
385
|
+
function formatBytes(bytes) {
|
|
386
|
+
return bytes % 1024 === 0 ? `${bytes / 1024}KiB` : `${bytes} bytes`;
|
|
387
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool registry factory.
|
|
3
|
+
*/
|
|
4
|
+
export { createReadTool } from "./read.js";
|
|
5
|
+
export { createBashTool } from "./bash.js";
|
|
6
|
+
export { createManagedServerTools } from "./server.js";
|
|
7
|
+
export { createWriteTool } from "./write.js";
|
|
8
|
+
export { createEditTool } from "./edit.js";
|
|
9
|
+
export { buildToolPromptOptions } from "./prompt-metadata.js";
|
|
10
|
+
export { createLsTool } from "./ls.js";
|
|
11
|
+
export { createGrepTool } from "./grep.js";
|
|
12
|
+
export { createLspTool } from "./lsp.js";
|
|
13
|
+
export { createWebFetchTool } from "./web-fetch.js";
|
|
14
|
+
export { createWebSearchTool } from "./web-search.js";
|
|
15
|
+
export { createSkillTool } from "./skill.js";
|
|
16
|
+
export { createSkillSearchTool } from "./skill-search.js";
|
|
17
|
+
export { createAgentLifecycleTools, createCloseAgentTool, createSendInputTool, createSpawnAgentTool, createWaitAgentTool } from "./agent-lifecycle.js";
|
|
18
|
+
export { createExitPlanModeTool, type PlanController } from "./exit-plan-mode.js";
|
|
19
|
+
export { createToolSearchTool, type ToolSearchController } from "./tool-search.js";
|
|
20
|
+
export { createQuestionTool } from "./question.js";
|
|
21
|
+
export { createMemoryTool } from "./memory.js";
|
|
22
|
+
import type { ToolRegistryEntry } from "../types.js";
|
|
23
|
+
import type { ApprovalController } from "../approval/types.js";
|
|
24
|
+
import type { SkillRegistry } from "../skills/registry.js";
|
|
25
|
+
import { type PlanController } from "./exit-plan-mode.js";
|
|
26
|
+
import { type LspService } from "../lsp/index.js";
|
|
27
|
+
import { type ToolSearchController } from "./tool-search.js";
|
|
28
|
+
import type { QuestionController } from "../question/index.js";
|
|
29
|
+
import type { CheckpointStore } from "../checkpoints.js";
|
|
30
|
+
import { FileStateTracker } from "./file-state.js";
|
|
31
|
+
import type { GoalStore } from "../goal/store.js";
|
|
32
|
+
import type { ProcessManager } from "../tasks/manager.js";
|
|
33
|
+
import type { PromotionChannel } from "../tasks/promotion.js";
|
|
34
|
+
export interface CreateAllToolsOptions {
|
|
35
|
+
planController?: PlanController;
|
|
36
|
+
approvalController?: ApprovalController;
|
|
37
|
+
questionController?: QuestionController;
|
|
38
|
+
toolSearchController?: ToolSearchController;
|
|
39
|
+
lspService?: LspService;
|
|
40
|
+
fileStateTracker?: FileStateTracker;
|
|
41
|
+
/**
|
|
42
|
+
* Lazy accessor for the session's checkpoint store (the session manager may
|
|
43
|
+
* not exist yet when tools are created). Used by edit/write to snapshot
|
|
44
|
+
* files before mutating them so /rewind can restore.
|
|
45
|
+
*/
|
|
46
|
+
checkpoints?: () => CheckpointStore | undefined;
|
|
47
|
+
/** Shared goal state; when present, registers the update_goal tool. */
|
|
48
|
+
goalStore?: GoalStore;
|
|
49
|
+
/**
|
|
50
|
+
* Unified process manager (background tasks + managed servers). Background
|
|
51
|
+
* tasks are a per-host capability (background-tasks design §2.0): pass the
|
|
52
|
+
* manager AND set allowBackgroundTasks only in hosts that wire the full
|
|
53
|
+
* completion story (currently the interactive TUI). Without it, bash
|
|
54
|
+
* rejects run_in_background and the task tools are not registered.
|
|
55
|
+
*/
|
|
56
|
+
processManager?: ProcessManager;
|
|
57
|
+
allowBackgroundTasks?: boolean;
|
|
58
|
+
/** Ctrl+B send-to-background requests from the TUI (design §2.5). */
|
|
59
|
+
promotionChannel?: PromotionChannel;
|
|
60
|
+
/** Grok-style foreground wait budget before a Bash Execute is demoted. */
|
|
61
|
+
autoBackgroundAfterMs?: number | false;
|
|
62
|
+
}
|
|
63
|
+
export declare function createAllTools(cwd: string, skillRegistry?: SkillRegistry, options?: CreateAllToolsOptions): ToolRegistryEntry[];
|