@phuetz/code-buddy 1.6.0 → 2.0.0
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/LICENSE +90 -21
- package/README.md +145 -349
- package/codebuddy-runtime.json +24 -0
- package/dist/advanced/session-replay.js +3 -2
- package/dist/agent/agent-state.d.ts +4 -1
- package/dist/agent/agent-state.js +9 -3
- package/dist/agent/architect-mode.js +1 -1
- package/dist/agent/autonomous/agentic-coding-contract.d.ts +28 -28
- package/dist/agent/autonomous/agentic-coding-runner.d.ts +14 -4
- package/dist/agent/autonomous/agentic-coding-runner.js +176 -27
- package/dist/agent/autonomous/checkpoint-manager.js +3 -12
- package/dist/agent/autonomous/codex-autonomy-directive.d.ts +10 -0
- package/dist/agent/autonomous/codex-autonomy-directive.js +25 -0
- package/dist/agent/autonomous/edit-proposal-producer.js +2 -2
- package/dist/agent/autonomous/fleet-task-types.d.ts +2 -2
- package/dist/agent/autonomous/fleet-task-types.js +2 -2
- package/dist/agent/autonomous/fleet-tick-handler.d.ts +3 -3
- package/dist/agent/autonomous/fleet-tick-handler.js +14 -8
- package/dist/agent/autonomous/recursive-improvement.d.ts +23 -0
- package/dist/agent/autonomous/recursive-improvement.js +114 -0
- package/dist/agent/autonomous/verification-loop.js +4 -2
- package/dist/agent/codebuddy-agent.d.ts +93 -6
- package/dist/agent/codebuddy-agent.js +452 -58
- package/dist/agent/council-lesson-proposer.d.ts +80 -13
- package/dist/agent/council-lesson-proposer.js +201 -43
- package/dist/agent/deep-research-ckg.d.ts +176 -0
- package/dist/agent/deep-research-ckg.js +250 -0
- package/dist/agent/deep-research-storm.d.ts +222 -0
- package/dist/agent/deep-research-storm.js +689 -0
- package/dist/agent/deep-research.d.ts +329 -0
- package/dist/agent/deep-research.js +994 -0
- package/dist/agent/delegation/thread-delegation.d.ts +80 -0
- package/dist/agent/delegation/thread-delegation.js +472 -0
- package/dist/agent/delegation/thread-task-runner.d.ts +37 -0
- package/dist/agent/delegation/thread-task-runner.js +89 -0
- package/dist/agent/dev-loop/dev-loop.d.ts +120 -0
- package/dist/agent/dev-loop/dev-loop.js +404 -0
- package/dist/agent/dev-loop/structural-gate.d.ts +32 -0
- package/dist/agent/dev-loop/structural-gate.js +120 -0
- package/dist/agent/execution/agent-executor.d.ts +52 -31
- package/dist/agent/execution/agent-executor.js +1520 -547
- package/dist/agent/execution/context-pipeline.d.ts +54 -6
- package/dist/agent/execution/context-pipeline.js +285 -88
- package/dist/agent/execution/incremental-token-counter.d.ts +15 -0
- package/dist/agent/execution/incremental-token-counter.js +36 -0
- package/dist/agent/execution/ordered-tool-executor.d.ts +14 -0
- package/dist/agent/execution/ordered-tool-executor.js +54 -0
- package/dist/agent/execution/post-tool-handlers.d.ts +1 -1
- package/dist/agent/execution/post-tool-handlers.js +2 -2
- package/dist/agent/execution/query-classifier.d.ts +2 -0
- package/dist/agent/execution/query-classifier.js +2 -0
- package/dist/agent/execution/tool-dependency-graph.js +7 -0
- package/dist/agent/execution/tool-selection-strategy.d.ts +20 -0
- package/dist/agent/execution/tool-selection-strategy.js +145 -23
- package/dist/agent/facades/message-history-manager.d.ts +1 -1
- package/dist/agent/facades/message-history-manager.js +1 -1
- package/dist/agent/facades/model-routing-facade.d.ts +31 -1
- package/dist/agent/facades/model-routing-facade.js +86 -2
- package/dist/agent/facades/session-facade.d.ts +10 -2
- package/dist/agent/facades/session-facade.js +59 -1
- package/dist/agent/film/film-producer.d.ts +98 -0
- package/dist/agent/film/film-producer.js +289 -0
- package/dist/agent/film/scene-planner.d.ts +38 -0
- package/dist/agent/film/scene-planner.js +93 -0
- package/dist/agent/film/trailer-planner.d.ts +23 -0
- package/dist/agent/film/trailer-planner.js +242 -0
- package/dist/agent/film/video-studio.d.ts +72 -0
- package/dist/agent/film/video-studio.js +249 -0
- package/dist/agent/flow/planning-flow.d.ts +3 -0
- package/dist/agent/flow/planning-flow.js +70 -8
- package/dist/agent/hermes-claw-migrate.d.ts +62 -0
- package/dist/agent/hermes-claw-migrate.js +189 -15
- package/dist/agent/hermes-memory-providers.js +3 -3
- package/dist/agent/hermes-parity-manifest.js +69 -15
- package/dist/agent/infrastructure/agent-infrastructure.d.ts +1 -0
- package/dist/agent/infrastructure/agent-infrastructure.js +1 -1
- package/dist/agent/isolation/agent-workspace.js +5 -2
- package/dist/agent/learning/skill-background-writes.js +9 -4
- package/dist/agent/learning-agent.js +4 -4
- package/dist/agent/learning-background-writes.js +9 -5
- package/dist/agent/lesson-candidate-queue.d.ts +4 -0
- package/dist/agent/lesson-candidate-queue.js +9 -3
- package/dist/agent/lesson-provenance.js +9 -3
- package/dist/agent/lessons-tracker.d.ts +68 -1
- package/dist/agent/lessons-tracker.js +218 -36
- package/dist/agent/loop-detection-service.d.ts +56 -0
- package/dist/agent/loop-detection-service.js +207 -0
- package/dist/agent/middleware/auto-observation.d.ts +2 -0
- package/dist/agent/middleware/auto-observation.js +4 -2
- package/dist/agent/middleware/auto-repair-middleware.d.ts +2 -0
- package/dist/agent/middleware/auto-repair-middleware.js +27 -4
- package/dist/agent/middleware/changed-files.d.ts +19 -0
- package/dist/agent/middleware/changed-files.js +113 -0
- package/dist/agent/middleware/cost-limit.d.ts +0 -2
- package/dist/agent/middleware/cost-limit.js +0 -3
- package/dist/agent/middleware/index.d.ts +2 -0
- package/dist/agent/middleware/index.js +1 -0
- package/dist/agent/middleware/pipeline.d.ts +9 -0
- package/dist/agent/middleware/pipeline.js +18 -0
- package/dist/agent/middleware/plan-completion-audit.d.ts +76 -0
- package/dist/agent/middleware/plan-completion-audit.js +157 -0
- package/dist/agent/middleware/quality-gate-middleware.d.ts +43 -1
- package/dist/agent/middleware/quality-gate-middleware.js +198 -40
- package/dist/agent/middleware/types.d.ts +6 -0
- package/dist/agent/middleware/verification-enforcement.d.ts +10 -3
- package/dist/agent/middleware/verification-enforcement.js +43 -13
- package/dist/agent/middleware/workflow-guard.js +7 -0
- package/dist/agent/model-benchmark.js +11 -17
- package/dist/agent/model-tier.d.ts +2 -2
- package/dist/agent/model-tier.js +10 -7
- package/dist/agent/multi-agent/agent-memory-integration.js +3 -2
- package/dist/agent/multi-agent/base-agent.d.ts +12 -1
- package/dist/agent/multi-agent/base-agent.js +58 -10
- package/dist/agent/multi-agent/enhanced-coordination.js +1 -0
- package/dist/agent/multi-agent/metrics-persistence.js +28 -14
- package/dist/agent/multi-agent/multi-agent-system.d.ts +5 -0
- package/dist/agent/multi-agent/multi-agent-system.js +81 -4
- package/dist/agent/multi-agent/session-fleet-bridge.js +2 -1
- package/dist/agent/multi-agent/session-registry.js +9 -3
- package/dist/agent/multi-agent/team-manager.d.ts +11 -0
- package/dist/agent/multi-agent/team-manager.js +94 -5
- package/dist/agent/multi-agent/types.d.ts +10 -1
- package/dist/agent/multi-agent/workflow-multi-persistence.js +16 -8
- package/dist/agent/multi-agent/workflow-persistence.js +9 -6
- package/dist/agent/observer/trigger-registry.js +3 -5
- package/dist/agent/operating-modes.d.ts +3 -0
- package/dist/agent/operating-modes.js +15 -22
- package/dist/agent/pipelines.d.ts +2 -4
- package/dist/agent/pipelines.js +1 -1
- package/dist/agent/plan-mode.js +1 -1
- package/dist/agent/prompt-suggestions.js +2 -1
- package/dist/agent/prompt-tool-observation.d.ts +55 -0
- package/dist/agent/prompt-tool-observation.js +165 -0
- package/dist/agent/reasoning/tree-of-thought.js +1 -1
- package/dist/agent/repair/repair-engine.js +1 -1
- package/dist/agent/repo-profiler.d.ts +12 -1
- package/dist/agent/repo-profiler.js +21 -15
- package/dist/agent/repo-profiling/cache.js +6 -9
- package/dist/agent/research-worker-provider.d.ts +38 -0
- package/dist/agent/research-worker-provider.js +30 -0
- package/dist/agent/science/experiment-decision.d.ts +48 -0
- package/dist/agent/science/experiment-decision.js +65 -0
- package/dist/agent/science/experiment-empirical-gate.d.ts +83 -0
- package/dist/agent/science/experiment-empirical-gate.js +156 -0
- package/dist/agent/science/experiment-fitness.d.ts +112 -0
- package/dist/agent/science/experiment-fitness.js +188 -0
- package/dist/agent/science/experiment-loop.d.ts +196 -0
- package/dist/agent/science/experiment-loop.js +765 -0
- package/dist/agent/science/experiment-orchestrator.d.ts +203 -0
- package/dist/agent/science/experiment-orchestrator.js +454 -0
- package/dist/agent/science/experiment-sandbox-backends.d.ts +56 -0
- package/dist/agent/science/experiment-sandbox-backends.js +201 -0
- package/dist/agent/science/experiment-sandbox.d.ts +105 -0
- package/dist/agent/science/experiment-sandbox.js +196 -0
- package/dist/agent/science/experiment-variant-store.d.ts +108 -0
- package/dist/agent/science/experiment-variant-store.js +156 -0
- package/dist/agent/science/human-gate.d.ts +31 -0
- package/dist/agent/science/human-gate.js +32 -0
- package/dist/agent/self-improvement/authored-artifact-gate.js +28 -3
- package/dist/agent/self-improvement/authored-tool-runtime.d.ts +4 -2
- package/dist/agent/self-improvement/authored-tool-runtime.js +8 -3
- package/dist/agent/self-improvement/authored-tool-store.js +3 -2
- package/dist/agent/self-improvement/capability-benchmark.js +89 -2
- package/dist/agent/self-improvement/continuous-benchmark.d.ts +105 -0
- package/dist/agent/self-improvement/continuous-benchmark.js +355 -0
- package/dist/agent/self-improvement/delegation-facts.d.ts +105 -0
- package/dist/agent/self-improvement/delegation-facts.js +483 -0
- package/dist/agent/self-improvement/digest-sources.d.ts +56 -0
- package/dist/agent/self-improvement/digest-sources.js +294 -0
- package/dist/agent/self-improvement/digest.d.ts +169 -0
- package/dist/agent/self-improvement/digest.js +543 -0
- package/dist/agent/self-improvement/engine.d.ts +11 -6
- package/dist/agent/self-improvement/engine.js +13 -7
- package/dist/agent/self-improvement/evolution/ast-novelty.d.ts +20 -0
- package/dist/agent/self-improvement/evolution/ast-novelty.js +81 -0
- package/dist/agent/self-improvement/evolution/code-variant-store.d.ts +101 -0
- package/dist/agent/self-improvement/evolution/code-variant-store.js +229 -0
- package/dist/agent/self-improvement/evolution/evolution-engine.d.ts +199 -0
- package/dist/agent/self-improvement/evolution/evolution-engine.js +503 -0
- package/dist/agent/self-improvement/evolution/feature-map.d.ts +24 -0
- package/dist/agent/self-improvement/evolution/feature-map.js +88 -0
- package/dist/agent/self-improvement/evolution/model-bandit.d.ts +57 -0
- package/dist/agent/self-improvement/evolution/model-bandit.js +98 -0
- package/dist/agent/self-improvement/evolution/protected-paths.d.ts +31 -0
- package/dist/agent/self-improvement/evolution/protected-paths.js +105 -0
- package/dist/agent/self-improvement/evolution/research-weakness-source.d.ts +56 -0
- package/dist/agent/self-improvement/evolution/research-weakness-source.js +161 -0
- package/dist/agent/self-improvement/evolution/scrub-env.d.ts +22 -0
- package/dist/agent/self-improvement/evolution/scrub-env.js +40 -0
- package/dist/agent/self-improvement/evolution/variant-fitness.d.ts +86 -0
- package/dist/agent/self-improvement/evolution/variant-fitness.js +217 -0
- package/dist/agent/self-improvement/evolution/variant-planner.d.ts +41 -0
- package/dist/agent/self-improvement/evolution/variant-planner.js +156 -0
- package/dist/agent/self-improvement/evolution/weakness-selector.d.ts +38 -0
- package/dist/agent/self-improvement/evolution/weakness-selector.js +108 -0
- package/dist/agent/self-improvement/evolution/worktree-scorer.d.ts +44 -0
- package/dist/agent/self-improvement/evolution/worktree-scorer.js +99 -0
- package/dist/agent/self-improvement/evolutionary-archive.js +3 -2
- package/dist/agent/self-improvement/experience-source.d.ts +60 -7
- package/dist/agent/self-improvement/experience-source.js +78 -8
- package/dist/agent/self-improvement/index.d.ts +1 -0
- package/dist/agent/self-improvement/index.js +6 -3
- package/dist/agent/self-improvement/learning-store.d.ts +16 -0
- package/dist/agent/self-improvement/learning-store.js +83 -3
- package/dist/agent/self-improvement/llm-drafter.d.ts +3 -1
- package/dist/agent/self-improvement/llm-drafter.js +20 -2
- package/dist/agent/self-improvement/llm-tool-proposer.js +1 -1
- package/dist/agent/self-improvement/proposal-store.d.ts +46 -0
- package/dist/agent/self-improvement/proposal-store.js +87 -0
- package/dist/agent/self-improvement/proposer.d.ts +1 -1
- package/dist/agent/self-improvement/proposer.js +94 -2
- package/dist/agent/self-improvement/rule-store.js +5 -4
- package/dist/agent/self-improvement/sandbox-scorer.d.ts +1 -1
- package/dist/agent/self-improvement/sandbox-scorer.js +8 -4
- package/dist/agent/self-improvement/self-knowledge.d.ts +1 -1
- package/dist/agent/self-improvement/self-knowledge.js +8 -8
- package/dist/agent/self-improvement/skill-benchmark.js +27 -0
- package/dist/agent/self-improvement/skill-consolidator.js +16 -0
- package/dist/agent/self-improvement/skill-engine.d.ts +7 -0
- package/dist/agent/self-improvement/skill-engine.js +54 -28
- package/dist/agent/self-improvement/skill-gate.d.ts +4 -4
- package/dist/agent/self-improvement/skill-gate.js +38 -20
- package/dist/agent/self-improvement/skill-mutator.d.ts +20 -1
- package/dist/agent/self-improvement/skill-mutator.js +138 -19
- package/dist/agent/self-improvement/skill-proposer.js +2 -1
- package/dist/agent/self-improvement/skill-types.d.ts +4 -0
- package/dist/agent/self-improvement/strategy-engine.d.ts +54 -0
- package/dist/agent/self-improvement/strategy-engine.js +104 -0
- package/dist/agent/self-improvement/strategy-gate.d.ts +49 -0
- package/dist/agent/self-improvement/strategy-gate.js +243 -0
- package/dist/agent/self-improvement/strategy-live.d.ts +39 -0
- package/dist/agent/self-improvement/strategy-live.js +114 -0
- package/dist/agent/self-improvement/strategy-proposer.d.ts +30 -0
- package/dist/agent/self-improvement/strategy-proposer.js +114 -0
- package/dist/agent/self-improvement/strategy-replay.d.ts +40 -0
- package/dist/agent/self-improvement/strategy-replay.js +150 -0
- package/dist/agent/self-improvement/strategy-runtime.d.ts +43 -0
- package/dist/agent/self-improvement/strategy-runtime.js +56 -0
- package/dist/agent/self-improvement/strategy-store.d.ts +38 -0
- package/dist/agent/self-improvement/strategy-store.js +139 -0
- package/dist/agent/self-improvement/strategy-types.d.ts +229 -0
- package/dist/agent/self-improvement/strategy-types.js +90 -0
- package/dist/agent/self-improvement/tool-benchmark.js +164 -8
- package/dist/agent/self-improvement/tool-engine.d.ts +12 -3
- package/dist/agent/self-improvement/tool-engine.js +59 -31
- package/dist/agent/self-improvement/tool-gate.d.ts +2 -0
- package/dist/agent/self-improvement/tool-gate.js +26 -0
- package/dist/agent/self-improvement/tool-skill-mutator.d.ts +1 -1
- package/dist/agent/self-improvement/tool-skill-mutator.js +20 -2
- package/dist/agent/self-improvement/tool-types.d.ts +5 -3
- package/dist/agent/self-improvement/types.d.ts +7 -3
- package/dist/agent/session-end-flush.js +2 -1
- package/dist/agent/specialized/agent-registry.d.ts +1 -0
- package/dist/agent/specialized/agent-registry.js +118 -0
- package/dist/agent/specialized/excel-agent.js +15 -1
- package/dist/agent/specialized/index.d.ts +1 -0
- package/dist/agent/specialized/index.js +2 -0
- package/dist/agent/specialized/pdf-agent.js +4 -2
- package/dist/agent/specialized/swe-agent-adapter.js +8 -0
- package/dist/agent/specialized/swe-agent.d.ts +16 -1
- package/dist/agent/specialized/swe-agent.js +75 -7
- package/dist/agent/specialized/types.d.ts +31 -1
- package/dist/agent/specialized/types.js +26 -0
- package/dist/agent/specialized/verifier-agent.d.ts +53 -0
- package/dist/agent/specialized/verifier-agent.js +342 -0
- package/dist/agent/streaming/message-reducer.js +73 -19
- package/dist/agent/streaming/streaming-handler.d.ts +24 -0
- package/dist/agent/streaming/streaming-handler.js +136 -1
- package/dist/agent/subagents.d.ts +10 -4
- package/dist/agent/subagents.js +39 -6
- package/dist/agent/thinking/extended-thinking.js +1 -1
- package/dist/agent/todo-tracker.js +5 -4
- package/dist/agent/tool-executor.d.ts +10 -1
- package/dist/agent/tool-executor.js +29 -0
- package/dist/agent/tool-handler.d.ts +49 -2
- package/dist/agent/tool-handler.js +738 -181
- package/dist/agent/types.d.ts +3 -5
- package/dist/agent/wide-research-checkpoint.d.ts +77 -0
- package/dist/agent/wide-research-checkpoint.js +361 -0
- package/dist/agent/wide-research-files.d.ts +11 -0
- package/dist/agent/wide-research-files.js +189 -0
- package/dist/agent/wide-research.d.ts +148 -3
- package/dist/agent/wide-research.js +833 -56
- package/dist/analytics/code-evolution.js +20 -15
- package/dist/analytics/complexity-analyzer.js +2 -2
- package/dist/analytics/cost-report.d.ts +71 -0
- package/dist/analytics/cost-report.js +724 -0
- package/dist/analytics/dashboard.js +8 -7
- package/dist/analytics/index.d.ts +2 -0
- package/dist/analytics/index.js +2 -0
- package/dist/analytics/repo-explainer-collector.d.ts +13 -0
- package/dist/analytics/repo-explainer-collector.js +351 -0
- package/dist/analytics/repo-explainer.d.ts +224 -0
- package/dist/analytics/repo-explainer.js +605 -0
- package/dist/analytics/roi-tracker.js +11 -9
- package/dist/api/webhooks.js +9 -14
- package/dist/app/application-factory.d.ts +1 -1
- package/dist/app/application-factory.js +6 -5
- package/dist/auth/profile-manager.js +8 -4
- package/dist/avatar/avatar-event-bus.d.ts +16 -0
- package/dist/avatar/avatar-event-bus.js +53 -0
- package/dist/avatar/avatar-gateway-bridge.d.ts +26 -0
- package/dist/avatar/avatar-gateway-bridge.js +54 -0
- package/dist/avatar/avatar-protocol.d.ts +133 -0
- package/dist/avatar/avatar-protocol.js +241 -0
- package/dist/avatar/avatar-renderer-registry.d.ts +56 -0
- package/dist/avatar/avatar-renderer-registry.js +191 -0
- package/dist/avatar/avatar-renderer-simulator.d.ts +31 -0
- package/dist/avatar/avatar-renderer-simulator.js +160 -0
- package/dist/browser-automation/browser-manager.d.ts +15 -1
- package/dist/browser-automation/browser-manager.js +101 -0
- package/dist/browser-automation/browser-operator-executor.d.ts +89 -7
- package/dist/browser-automation/browser-operator-executor.js +1280 -58
- package/dist/browser-automation/browser-operator-runtime.d.ts +87 -0
- package/dist/browser-automation/browser-operator-runtime.js +441 -0
- package/dist/browser-automation/browser-operator-session.js +4 -3
- package/dist/browser-automation/browser-tool.d.ts +17 -2
- package/dist/browser-automation/browser-tool.js +101 -39
- package/dist/browser-automation/internet-scout-plan.d.ts +1 -0
- package/dist/browser-automation/internet-scout-plan.js +17 -0
- package/dist/browser-automation/profile-manager.js +5 -3
- package/dist/browser-automation/types.d.ts +25 -0
- package/dist/cache/advanced-lru-cache.js +4 -4
- package/dist/cache/cache-manager.js +9 -10
- package/dist/cache/embedding-cache.js +6 -5
- package/dist/cache/llm-response-cache.js +3 -4
- package/dist/capture/screen-recorder.d.ts +2 -0
- package/dist/capture/screen-recorder.js +6 -4
- package/dist/capture/screen-watcher.d.ts +6 -3
- package/dist/capture/screen-watcher.js +86 -9
- package/dist/channels/channel-cognitive-port.d.ts +46 -0
- package/dist/channels/channel-cognitive-port.js +182 -0
- package/dist/channels/channel-model-override.d.ts +47 -0
- package/dist/channels/channel-model-override.js +62 -0
- package/dist/channels/companion-channel-profile.d.ts +68 -0
- package/dist/channels/companion-channel-profile.js +142 -0
- package/dist/channels/companion-channel-turn.d.ts +30 -0
- package/dist/channels/companion-channel-turn.js +38 -0
- package/dist/channels/core.d.ts +37 -3
- package/dist/channels/core.js +63 -6
- package/dist/channels/discord/client.js +34 -14
- package/dist/channels/dm-pairing.d.ts +18 -4
- package/dist/channels/dm-pairing.js +199 -33
- package/dist/channels/gateway-lifecycle.d.ts +2 -0
- package/dist/channels/gateway-lifecycle.js +1 -0
- package/dist/channels/identity-links.d.ts +19 -1
- package/dist/channels/identity-links.js +68 -12
- package/dist/channels/matrix/index.js +6 -2
- package/dist/channels/pro/pro-features.js +17 -0
- package/dist/channels/pro/run-tracker.js +9 -4
- package/dist/channels/pro/scoped-auth.js +10 -8
- package/dist/channels/provider-failure-speech.d.ts +28 -0
- package/dist/channels/provider-failure-speech.js +128 -0
- package/dist/channels/reconnection-manager.d.ts +2 -0
- package/dist/channels/reconnection-manager.js +7 -2
- package/dist/channels/resolve-channel-secret.d.ts +43 -0
- package/dist/channels/resolve-channel-secret.js +82 -0
- package/dist/channels/slack/block-builder.d.ts +12 -0
- package/dist/channels/slack/block-builder.js +70 -2
- package/dist/channels/slack/client.js +62 -15
- package/dist/channels/slack/types.d.ts +20 -1
- package/dist/channels/telegram/client.d.ts +36 -3
- package/dist/channels/telegram/client.js +438 -84
- package/dist/channels/telegram/types.d.ts +2 -0
- package/dist/channels/webhook-server.js +8 -1
- package/dist/channels/whatsapp/index.js +2 -1
- package/dist/checkpoints/ghost-snapshot.js +15 -9
- package/dist/checkpoints/persistent-checkpoint-manager.js +15 -8
- package/dist/cli/command-routing.d.ts +22 -0
- package/dist/cli/command-routing.js +54 -0
- package/dist/cli/first-run.d.ts +17 -0
- package/dist/cli/first-run.js +40 -0
- package/dist/cli/headless-options.d.ts +22 -0
- package/dist/cli/headless-options.js +112 -0
- package/dist/cli/headless-prompt-progress.d.ts +22 -0
- package/dist/cli/headless-prompt-progress.js +35 -0
- package/dist/cli/headless.js +2 -2
- package/dist/cli/listen-port.d.ts +8 -0
- package/dist/cli/listen-port.js +20 -0
- package/dist/cli/permission-mode-option.d.ts +14 -0
- package/dist/cli/permission-mode-option.js +64 -0
- package/dist/cli/requested-profile.d.ts +15 -0
- package/dist/cli/requested-profile.js +27 -0
- package/dist/cli/unknown-option-hint.d.ts +16 -0
- package/dist/cli/unknown-option-hint.js +116 -0
- package/dist/cli/voice-command.d.ts +32 -0
- package/dist/cli/voice-command.js +96 -0
- package/dist/codebuddy/abort-signal.d.ts +7 -0
- package/dist/codebuddy/abort-signal.js +31 -0
- package/dist/codebuddy/client.d.ts +68 -0
- package/dist/codebuddy/client.js +460 -11
- package/dist/codebuddy/fleet-tool-defs.js +5 -0
- package/dist/codebuddy/llm-retry.d.ts +24 -0
- package/dist/codebuddy/llm-retry.js +124 -0
- package/dist/codebuddy/provider-error-classifier.d.ts +86 -0
- package/dist/codebuddy/provider-error-classifier.js +410 -0
- package/dist/codebuddy/provider-failover-error.d.ts +16 -0
- package/dist/codebuddy/provider-failover-error.js +50 -0
- package/dist/codebuddy/provider-failover-kind.d.ts +15 -0
- package/dist/codebuddy/provider-failover-kind.js +172 -0
- package/dist/codebuddy/provider-handoff.d.ts +35 -0
- package/dist/codebuddy/provider-handoff.js +294 -0
- package/dist/codebuddy/providers/ollama-native-transport.d.ts +130 -0
- package/dist/codebuddy/providers/ollama-native-transport.js +387 -0
- package/dist/codebuddy/providers/provider-agy-cli.d.ts +29 -0
- package/dist/codebuddy/providers/provider-agy-cli.js +264 -0
- package/dist/codebuddy/providers/provider-chatgpt-responses.d.ts +59 -7
- package/dist/codebuddy/providers/provider-chatgpt-responses.js +519 -164
- package/dist/codebuddy/providers/provider-gemini-cli.js +95 -13
- package/dist/codebuddy/providers/provider-gemini-native.d.ts +2 -0
- package/dist/codebuddy/providers/provider-gemini-native.js +199 -86
- package/dist/codebuddy/providers/provider-openai-compat.d.ts +82 -0
- package/dist/codebuddy/providers/provider-openai-compat.js +469 -45
- package/dist/codebuddy/stream-retry.d.ts +21 -8
- package/dist/codebuddy/stream-retry.js +44 -40
- package/dist/codebuddy/tool-definitions/advanced-tools.d.ts +4 -0
- package/dist/codebuddy/tool-definitions/advanced-tools.js +188 -0
- package/dist/codebuddy/tool-definitions/agent-tools.d.ts +5 -0
- package/dist/codebuddy/tool-definitions/agent-tools.js +195 -7
- package/dist/codebuddy/tool-definitions/browser-tools.d.ts +1 -0
- package/dist/codebuddy/tool-definitions/browser-tools.js +65 -1
- package/dist/codebuddy/tool-definitions/code-exec-tools.d.ts +8 -0
- package/dist/codebuddy/tool-definitions/code-exec-tools.js +29 -0
- package/dist/codebuddy/tool-definitions/code-explorer-tools.js +4 -0
- package/dist/codebuddy/tool-definitions/comfy-recipe-tools.d.ts +3 -0
- package/dist/codebuddy/tool-definitions/comfy-recipe-tools.js +37 -0
- package/dist/codebuddy/tool-definitions/core-tools.d.ts +2 -0
- package/dist/codebuddy/tool-definitions/core-tools.js +58 -2
- package/dist/codebuddy/tool-definitions/delegate-agent-tools.d.ts +11 -0
- package/dist/codebuddy/tool-definitions/delegate-agent-tools.js +50 -0
- package/dist/codebuddy/tool-definitions/design-tools.d.ts +6 -0
- package/dist/codebuddy/tool-definitions/design-tools.js +35 -0
- package/dist/codebuddy/tool-definitions/exit-plan-mode-tools.d.ts +1 -0
- package/dist/codebuddy/tool-definitions/exit-plan-mode-tools.js +23 -1
- package/dist/codebuddy/tool-definitions/index.d.ts +16 -7
- package/dist/codebuddy/tool-definitions/index.js +27 -8
- package/dist/codebuddy/tool-definitions/lsp-tools.d.ts +7 -1
- package/dist/codebuddy/tool-definitions/lsp-tools.js +104 -1
- package/dist/codebuddy/tool-definitions/meeting-tools.d.ts +4 -0
- package/dist/codebuddy/tool-definitions/meeting-tools.js +32 -0
- package/dist/codebuddy/tool-definitions/moa-tools.js +7 -2
- package/dist/codebuddy/tool-definitions/multimodal-tools.d.ts +14 -0
- package/dist/codebuddy/tool-definitions/multimodal-tools.js +615 -3
- package/dist/codebuddy/tool-definitions/research-tools.d.ts +20 -0
- package/dist/codebuddy/tool-definitions/research-tools.js +98 -0
- package/dist/codebuddy/tool-definitions/self-describe-tools.d.ts +4 -0
- package/dist/codebuddy/tool-definitions/self-describe-tools.js +28 -0
- package/dist/codebuddy/tool-definitions/self-evolution-tools.d.ts +4 -0
- package/dist/codebuddy/tool-definitions/self-evolution-tools.js +31 -0
- package/dist/codebuddy/tool-definitions/verify-tools.d.ts +14 -0
- package/dist/codebuddy/tool-definitions/verify-tools.js +36 -0
- package/dist/codebuddy/tool-definitions/web-tools.d.ts +4 -0
- package/dist/codebuddy/tool-definitions/web-tools.js +135 -0
- package/dist/codebuddy/tool-definitions/workspace-tools.d.ts +4 -0
- package/dist/codebuddy/tool-definitions/workspace-tools.js +43 -0
- package/dist/codebuddy/tools.d.ts +15 -17
- package/dist/codebuddy/tools.js +235 -55
- package/dist/cognition/budget-reservations.d.ts +27 -0
- package/dist/cognition/budget-reservations.js +70 -0
- package/dist/cognition/cognitive-bus-client.d.ts +94 -0
- package/dist/cognition/cognitive-bus-client.js +724 -0
- package/dist/cognition/cognitive-hub.d.ts +93 -0
- package/dist/cognition/cognitive-hub.js +366 -0
- package/dist/cognition/cognitive-mesh.d.ts +38 -0
- package/dist/cognition/cognitive-mesh.js +263 -0
- package/dist/cognition/cognitive-port.d.ts +35 -0
- package/dist/cognition/cognitive-port.js +80 -0
- package/dist/cognition/cognitive-wire-contract.d.ts +1542 -0
- package/dist/cognition/cognitive-wire-contract.js +164 -0
- package/dist/cognition/context-renderer.d.ts +52 -0
- package/dist/cognition/context-renderer.js +227 -0
- package/dist/cognition/global-workspace.d.ts +39 -0
- package/dist/cognition/global-workspace.js +181 -0
- package/dist/cognition/index.d.ts +9 -0
- package/dist/cognition/index.js +10 -0
- package/dist/cognition/llm-specialist.d.ts +40 -0
- package/dist/cognition/llm-specialist.js +93 -0
- package/dist/cognition/sensory-workspace.d.ts +57 -0
- package/dist/cognition/sensory-workspace.js +346 -0
- package/dist/cognition/types.d.ts +93 -0
- package/dist/cognition/types.js +7 -0
- package/dist/cognition/voice-specialists.d.ts +21 -0
- package/dist/cognition/voice-specialists.js +89 -0
- package/dist/cognition/world-model.d.ts +95 -0
- package/dist/cognition/world-model.js +228 -0
- package/dist/collaboration/ai-colab-manager.js +12 -13
- package/dist/collaboration/team-session.js +25 -11
- package/dist/commands/apply-permission-mode.d.ts +27 -0
- package/dist/commands/apply-permission-mode.js +35 -0
- package/dist/commands/assistant.d.ts +3 -0
- package/dist/commands/assistant.js +1022 -0
- package/dist/commands/campaign.d.ts +6 -0
- package/dist/commands/campaign.js +140 -0
- package/dist/commands/capsule.d.ts +2 -0
- package/dist/commands/capsule.js +104 -0
- package/dist/commands/changelog.d.ts +29 -0
- package/dist/commands/changelog.js +283 -0
- package/dist/commands/cli/acp-command.js +4 -1
- package/dist/commands/cli/backup-command.d.ts +9 -0
- package/dist/commands/cli/backup-command.js +47 -0
- package/dist/commands/cli/evolve-command.d.ts +26 -0
- package/dist/commands/cli/evolve-command.js +259 -0
- package/dist/commands/cli/fleet-commands.js +105 -0
- package/dist/commands/cli/improve-command.d.ts +2 -1
- package/dist/commands/cli/improve-command.js +309 -20
- package/dist/commands/cli/native-engine-commands.js +405 -28
- package/dist/commands/cli/sensory-command.d.ts +8 -0
- package/dist/commands/cli/sensory-command.js +27 -0
- package/dist/commands/cli/speak-command.js +87 -24
- package/dist/commands/cli/tools-commands.js +68 -36
- package/dist/commands/cli/utility-commands.js +34 -9
- package/dist/commands/client-dispatcher.d.ts +1 -0
- package/dist/commands/client-dispatcher.js +40 -21
- package/dist/commands/compress.js +3 -0
- package/dist/commands/cost.d.ts +33 -0
- package/dist/commands/cost.js +342 -0
- package/dist/commands/council-scoreboard.d.ts +8 -0
- package/dist/commands/council-scoreboard.js +68 -0
- package/dist/commands/council.d.ts +16 -24
- package/dist/commands/council.js +247 -255
- package/dist/commands/curator-cli.d.ts +14 -0
- package/dist/commands/curator-cli.js +57 -0
- package/dist/commands/delegate.js +82 -25
- package/dist/commands/dev/golden-path.d.ts +71 -0
- package/dist/commands/dev/golden-path.js +317 -0
- package/dist/commands/dev/index.d.ts +3 -0
- package/dist/commands/dev/index.js +151 -119
- package/dist/commands/dev/issue-pipeline.js +7 -7
- package/dist/commands/dev/workflows.d.ts +2 -0
- package/dist/commands/dev/workflows.js +39 -6
- package/dist/commands/enhanced-command-handler.d.ts +3 -0
- package/dist/commands/enhanced-command-handler.js +29 -12
- package/dist/commands/exchange.d.ts +2 -0
- package/dist/commands/exchange.js +193 -0
- package/dist/commands/explain.d.ts +12 -0
- package/dist/commands/explain.js +135 -0
- package/dist/commands/film.d.ts +18 -0
- package/dist/commands/film.js +239 -0
- package/dist/commands/flow.js +15 -5
- package/dist/commands/forge.d.ts +2 -0
- package/dist/commands/forge.js +102 -0
- package/dist/commands/goal-cli.d.ts +3 -0
- package/dist/commands/goal-cli.js +9 -4
- package/dist/commands/gpu-worker.d.ts +14 -0
- package/dist/commands/gpu-worker.js +135 -0
- package/dist/commands/handlers/agents-handler.d.ts +11 -2
- package/dist/commands/handlers/agents-handler.js +79 -13
- package/dist/commands/handlers/auth-handlers.js +12 -5
- package/dist/commands/handlers/backup-handlers.d.ts +40 -0
- package/dist/commands/handlers/backup-handlers.js +784 -57
- package/dist/commands/handlers/batch-handlers.d.ts +72 -2
- package/dist/commands/handlers/batch-handlers.js +443 -37
- package/dist/commands/handlers/branch-handlers.d.ts +1 -0
- package/dist/commands/handlers/channel-handlers.d.ts +7 -2
- package/dist/commands/handlers/channel-handlers.js +1705 -103
- package/dist/commands/handlers/companion-handler.js +130 -9
- package/dist/commands/handlers/daily-reset-handler.d.ts +1 -1
- package/dist/commands/handlers/daily-reset-handler.js +1 -1
- package/dist/commands/handlers/deepthink-handler.d.ts +2 -0
- package/dist/commands/handlers/deepthink-handler.js +49 -0
- package/dist/commands/handlers/extra-handlers.js +23 -24
- package/dist/commands/handlers/fleet-handler.d.ts +3 -4
- package/dist/commands/handlers/fleet-handler.js +82 -35
- package/dist/commands/handlers/goal-handler.d.ts +13 -0
- package/dist/commands/handlers/goal-handler.js +26 -7
- package/dist/commands/handlers/grill-me-handler.d.ts +2 -0
- package/dist/commands/handlers/grill-me-handler.js +41 -0
- package/dist/commands/handlers/heartbeat-handler.d.ts +2 -2
- package/dist/commands/handlers/heartbeat-handler.js +2 -2
- package/dist/commands/handlers/index.d.ts +3 -2
- package/dist/commands/handlers/index.js +4 -2
- package/dist/commands/handlers/memory-handlers.js +40 -0
- package/dist/commands/handlers/permissions-handlers.js +3 -2
- package/dist/commands/handlers/pr-handlers.js +15 -17
- package/dist/commands/handlers/security-handlers.d.ts +1 -1
- package/dist/commands/handlers/security-handlers.js +3 -3
- package/dist/commands/handlers/slash-session-handlers.d.ts +9 -0
- package/dist/commands/handlers/slash-session-handlers.js +134 -0
- package/dist/commands/handlers/swarm-handler.js +41 -2
- package/dist/commands/handlers/team-handlers.d.ts +28 -1
- package/dist/commands/handlers/team-handlers.js +243 -2
- package/dist/commands/handlers/think-handlers.js +2 -1
- package/dist/commands/handlers/vibe-handlers.js +8 -1
- package/dist/commands/handlers/worktree-handlers.js +23 -12
- package/dist/commands/headless-slash.d.ts +9 -0
- package/dist/commands/headless-slash.js +41 -3
- package/dist/commands/import.d.ts +34 -0
- package/dist/commands/import.js +478 -0
- package/dist/commands/index.d.ts +0 -1
- package/dist/commands/index.js +0 -1
- package/dist/commands/influencer.d.ts +2 -0
- package/dist/commands/influencer.js +87 -0
- package/dist/commands/intent.d.ts +6 -0
- package/dist/commands/intent.js +131 -0
- package/dist/commands/intents.d.ts +10 -0
- package/dist/commands/intents.js +163 -0
- package/dist/commands/lessons.js +91 -0
- package/dist/commands/llm-provider-resolution.d.ts +20 -0
- package/dist/commands/llm-provider-resolution.js +74 -13
- package/dist/commands/login-prerequisites.d.ts +11 -0
- package/dist/commands/login-prerequisites.js +23 -0
- package/dist/commands/loop-cli.d.ts +31 -0
- package/dist/commands/loop-cli.js +189 -0
- package/dist/commands/lora.d.ts +6 -0
- package/dist/commands/lora.js +445 -0
- package/dist/commands/maison-food.d.ts +10 -0
- package/dist/commands/maison-food.js +485 -0
- package/dist/commands/maison.d.ts +17 -0
- package/dist/commands/maison.js +236 -0
- package/dist/commands/mcp.d.ts +6 -0
- package/dist/commands/mcp.js +236 -7
- package/dist/commands/meeting.d.ts +8 -0
- package/dist/commands/meeting.js +31 -0
- package/dist/commands/pairing.js +7 -8
- package/dist/commands/papers/ask.d.ts +47 -0
- package/dist/commands/papers/ask.js +105 -0
- package/dist/commands/papers/index.d.ts +19 -0
- package/dist/commands/papers/index.js +54 -0
- package/dist/commands/provider.d.ts +9 -0
- package/dist/commands/provider.js +178 -10
- package/dist/commands/replay.d.ts +11 -0
- package/dist/commands/replay.js +131 -0
- package/dist/commands/research/deep.d.ts +66 -0
- package/dist/commands/research/deep.js +236 -0
- package/dist/commands/research/discover-searxng.d.ts +25 -0
- package/dist/commands/research/discover-searxng.js +62 -0
- package/dist/commands/research/index.d.ts +24 -2
- package/dist/commands/research/index.js +456 -79
- package/dist/commands/research/knowledge-ingest.d.ts +170 -0
- package/dist/commands/research/knowledge-ingest.js +449 -0
- package/dist/commands/research/wire-research-worker.d.ts +9 -0
- package/dist/commands/research/wire-research-worker.js +18 -0
- package/dist/commands/run-cli/index.d.ts +3 -1
- package/dist/commands/run-cli/index.js +53 -2
- package/dist/commands/science/deps.d.ts +95 -0
- package/dist/commands/science/deps.js +343 -0
- package/dist/commands/science/index.d.ts +31 -0
- package/dist/commands/science/index.js +285 -0
- package/dist/commands/science/loop-option.d.ts +40 -0
- package/dist/commands/science/loop-option.js +91 -0
- package/dist/commands/science/sandbox-option.d.ts +44 -0
- package/dist/commands/science/sandbox-option.js +42 -0
- package/dist/commands/scrape.d.ts +18 -0
- package/dist/commands/scrape.js +159 -0
- package/dist/commands/self.d.ts +9 -0
- package/dist/commands/self.js +56 -0
- package/dist/commands/shadow.d.ts +3 -0
- package/dist/commands/shadow.js +72 -0
- package/dist/commands/share.d.ts +13 -0
- package/dist/commands/share.js +71 -0
- package/dist/commands/shell-prefix.d.ts +4 -22
- package/dist/commands/shell-prefix.js +11 -73
- package/dist/commands/skills-cli/index.d.ts +2 -0
- package/dist/commands/skills-cli/index.js +190 -15
- package/dist/commands/slash/builtin-commands.js +41 -21
- package/dist/commands/slash-commands.js +4 -1
- package/dist/commands/token.d.ts +80 -0
- package/dist/commands/token.js +319 -0
- package/dist/commands/try.d.ts +72 -0
- package/dist/commands/try.js +357 -0
- package/dist/commands/update.d.ts +14 -1
- package/dist/commands/update.js +97 -15
- package/dist/commands/vision-train.d.ts +15 -0
- package/dist/commands/vision-train.js +214 -0
- package/dist/commands/whoami-status.d.ts +17 -0
- package/dist/commands/whoami-status.js +34 -0
- package/dist/commands/widgets.d.ts +2 -0
- package/dist/commands/widgets.js +179 -0
- package/dist/commands/ws.d.ts +7 -0
- package/dist/commands/ws.js +100 -0
- package/dist/companion/assistant-config.d.ts +79 -0
- package/dist/companion/assistant-config.js +1148 -0
- package/dist/companion/attached-image-grounding.d.ts +29 -0
- package/dist/companion/attached-image-grounding.js +285 -0
- package/dist/companion/away-mode.d.ts +80 -0
- package/dist/companion/away-mode.js +269 -0
- package/dist/companion/camera-share.d.ts +65 -0
- package/dist/companion/camera-share.js +321 -0
- package/dist/companion/camera.d.ts +8 -0
- package/dist/companion/camera.js +57 -31
- package/dist/companion/cards.js +7 -10
- package/dist/companion/check-in.js +23 -8
- package/dist/companion/companion-doctor.d.ts +58 -0
- package/dist/companion/companion-doctor.js +194 -0
- package/dist/companion/companion-history.d.ts +23 -0
- package/dist/companion/companion-history.js +22 -0
- package/dist/companion/companion-mode.d.ts +77 -1
- package/dist/companion/companion-mode.js +916 -6
- package/dist/companion/companion-photo-intake.d.ts +40 -0
- package/dist/companion/companion-photo-intake.js +112 -0
- package/dist/companion/companion-photo.d.ts +144 -0
- package/dist/companion/companion-photo.js +318 -0
- package/dist/companion/companion-turn.d.ts +88 -0
- package/dist/companion/companion-turn.js +223 -0
- package/dist/companion/companion-voice-character.d.ts +62 -0
- package/dist/companion/companion-voice-character.js +148 -0
- package/dist/companion/competitive-radar.js +14 -13
- package/dist/companion/continuity.d.ts +62 -0
- package/dist/companion/continuity.js +284 -0
- package/dist/companion/conversation-improvement-loop.d.ts +61 -0
- package/dist/companion/conversation-improvement-loop.js +317 -0
- package/dist/companion/conversation-quality-insights.d.ts +56 -0
- package/dist/companion/conversation-quality-insights.js +161 -0
- package/dist/companion/cooking-timer-runner.d.ts +20 -0
- package/dist/companion/cooking-timer-runner.js +98 -0
- package/dist/companion/core-adapter.d.ts +60 -0
- package/dist/companion/core-adapter.js +111 -0
- package/dist/companion/crisis-safety.d.ts +52 -0
- package/dist/companion/crisis-safety.js +150 -0
- package/dist/companion/daily-interaction-budget.d.ts +34 -0
- package/dist/companion/daily-interaction-budget.js +260 -0
- package/dist/companion/dialogue-percepts.d.ts +16 -0
- package/dist/companion/dialogue-percepts.js +50 -0
- package/dist/companion/event-followups.d.ts +58 -0
- package/dist/companion/event-followups.js +213 -0
- package/dist/companion/fashion-scene-catalog.d.ts +29 -0
- package/dist/companion/fashion-scene-catalog.js +141 -0
- package/dist/companion/gateway-inbox.js +25 -13
- package/dist/companion/gateway.d.ts +1 -0
- package/dist/companion/gateway.js +37 -17
- package/dist/companion/home-interaction-policy.d.ts +31 -0
- package/dist/companion/home-interaction-policy.js +89 -0
- package/dist/companion/household-time.d.ts +9 -0
- package/dist/companion/household-time.js +15 -0
- package/dist/companion/idle-loop.d.ts +53 -0
- package/dist/companion/idle-loop.js +254 -0
- package/dist/companion/impulses.js +148 -23
- package/dist/companion/inner-life.d.ts +60 -0
- package/dist/companion/inner-life.js +112 -0
- package/dist/companion/jokes.d.ts +21 -0
- package/dist/companion/jokes.js +175 -0
- package/dist/companion/lisa-selfie-cache.d.ts +36 -0
- package/dist/companion/lisa-selfie-cache.js +123 -0
- package/dist/companion/lisa-selfie-ingest.d.ts +36 -0
- package/dist/companion/lisa-selfie-ingest.js +205 -0
- package/dist/companion/lisa-selfie-refill.d.ts +32 -0
- package/dist/companion/lisa-selfie-refill.js +121 -0
- package/dist/companion/lisa-selfie-router.d.ts +40 -0
- package/dist/companion/lisa-selfie-router.js +156 -0
- package/dist/companion/lisa-selfie.d.ts +97 -0
- package/dist/companion/lisa-selfie.js +542 -0
- package/dist/companion/maison-voice-actions.d.ts +34 -0
- package/dist/companion/maison-voice-actions.js +192 -0
- package/dist/companion/migration.d.ts +63 -0
- package/dist/companion/migration.js +270 -0
- package/dist/companion/mission-board.js +7 -10
- package/dist/companion/mission-runner.js +2 -3
- package/dist/companion/mobile-conversation-log.d.ts +19 -0
- package/dist/companion/mobile-conversation-log.js +157 -0
- package/dist/companion/mobile-history.d.ts +34 -0
- package/dist/companion/mobile-history.js +123 -0
- package/dist/companion/mysoulmate-image-prompts.d.ts +26 -0
- package/dist/companion/mysoulmate-image-prompts.js +278 -0
- package/dist/companion/orchestrator.d.ts +32 -0
- package/dist/companion/orchestrator.js +49 -0
- package/dist/companion/percepts.d.ts +70 -0
- package/dist/companion/percepts.js +251 -18
- package/dist/companion/personas/copine.d.ts +8 -0
- package/dist/companion/personas/copine.js +195 -0
- package/dist/companion/personas/index.d.ts +19 -0
- package/dist/companion/personas/index.js +33 -0
- package/dist/companion/personas/types.d.ts +34 -0
- package/dist/companion/personas/types.js +8 -0
- package/dist/companion/photo-memory-fr.d.ts +36 -0
- package/dist/companion/photo-memory-fr.js +291 -0
- package/dist/companion/prefetch-config.d.ts +38 -0
- package/dist/companion/prefetch-config.js +119 -0
- package/dist/companion/prefetch-engine.d.ts +87 -0
- package/dist/companion/prefetch-engine.js +513 -0
- package/dist/companion/presence-loop.d.ts +85 -0
- package/dist/companion/presence-loop.js +297 -0
- package/dist/companion/privacy.js +3 -2
- package/dist/companion/proactive-engine.d.ts +97 -0
- package/dist/companion/proactive-engine.js +447 -0
- package/dist/companion/recent-said.d.ts +30 -0
- package/dist/companion/recent-said.js +98 -0
- package/dist/companion/relational-benchmark-scenarios.d.ts +191 -0
- package/dist/companion/relational-benchmark-scenarios.js +227 -0
- package/dist/companion/relational-context.d.ts +71 -0
- package/dist/companion/relational-context.js +302 -0
- package/dist/companion/relational-episode-evaluator.d.ts +117 -0
- package/dist/companion/relational-episode-evaluator.js +453 -0
- package/dist/companion/relationship-evolution.d.ts +2 -0
- package/dist/companion/relationship-evolution.js +30 -0
- package/dist/companion/relationship-state.d.ts +106 -0
- package/dist/companion/relationship-state.js +293 -0
- package/dist/companion/reminder-runner.d.ts +33 -0
- package/dist/companion/reminder-runner.js +183 -0
- package/dist/companion/reminders.d.ts +228 -0
- package/dist/companion/reminders.js +906 -0
- package/dist/companion/reply-augment.d.ts +87 -0
- package/dist/companion/reply-augment.js +464 -0
- package/dist/companion/safety-ledger.js +19 -12
- package/dist/companion/self-evaluation.js +22 -23
- package/dist/companion/shared-photo-memory.d.ts +65 -0
- package/dist/companion/shared-photo-memory.js +145 -0
- package/dist/companion/shared-photos.d.ts +88 -0
- package/dist/companion/shared-photos.js +321 -0
- package/dist/companion/signature-locations.d.ts +16 -0
- package/dist/companion/signature-locations.js +108 -0
- package/dist/companion/skill-curator.d.ts +9 -0
- package/dist/companion/skill-curator.js +147 -58
- package/dist/companion/untrusted-text.d.ts +22 -0
- package/dist/companion/untrusted-text.js +47 -0
- package/dist/companion/user-name.d.ts +18 -0
- package/dist/companion/user-name.js +22 -0
- package/dist/companion/visual-consent.d.ts +40 -0
- package/dist/companion/visual-consent.js +98 -0
- package/dist/companion/visual-grounding.d.ts +83 -0
- package/dist/companion/visual-grounding.js +474 -0
- package/dist/companion/voice-callbacks.d.ts +9 -0
- package/dist/companion/voice-callbacks.js +84 -0
- package/dist/companion/voice-guidance.d.ts +23 -0
- package/dist/companion/voice-guidance.js +85 -0
- package/dist/companion/voice-improvement-loop.d.ts +53 -0
- package/dist/companion/voice-improvement-loop.js +279 -0
- package/dist/companion/voice-incident-repair.d.ts +41 -0
- package/dist/companion/voice-incident-repair.js +214 -0
- package/dist/config/constants.d.ts +41 -0
- package/dist/config/constants.js +14 -0
- package/dist/config/env-schema.d.ts +2 -0
- package/dist/config/env-schema.js +714 -5
- package/dist/config/feature-flags.js +8 -12
- package/dist/config/feature-surface.d.ts +12 -0
- package/dist/config/feature-surface.js +86 -0
- package/dist/config/headless-local-prompt.d.ts +9 -0
- package/dist/config/headless-local-prompt.js +39 -0
- package/dist/config/local-runtime-context.d.ts +41 -0
- package/dist/config/local-runtime-context.js +430 -0
- package/dist/config/model-registry.js +4 -0
- package/dist/config/model-strengths.d.ts +14 -0
- package/dist/config/model-strengths.js +15 -0
- package/dist/config/model-tools.d.ts +56 -0
- package/dist/config/model-tools.js +819 -21
- package/dist/config/secret-ref.d.ts +22 -3
- package/dist/config/secret-ref.js +103 -41
- package/dist/config/toml-config.d.ts +20 -4
- package/dist/config/toml-config.js +40 -2
- package/dist/context/auto-compact-threshold.d.ts +1 -1
- package/dist/context/auto-compact-threshold.js +1 -1
- package/dist/context/codebase-map.js +9 -4
- package/dist/context/codebase-rag/codebase-rag.js +7 -6
- package/dist/context/codebase-rag/hnsw-store.js +9 -4
- package/dist/context/codebase-rag/vector-store.js +4 -4
- package/dist/context/compaction/parallel-summarizer.js +1 -0
- package/dist/context/compression.js +25 -29
- package/dist/context/context-manager-v2.d.ts +95 -7
- package/dist/context/context-manager-v2.js +442 -89
- package/dist/context/context-manager-v3.d.ts +4 -0
- package/dist/context/context-manager-v3.js +68 -9
- package/dist/context/cross-encoder-reranker.js +8 -3
- package/dist/context/default-context-engine.js +1 -1
- package/dist/context/enhanced-compression.d.ts +26 -2
- package/dist/context/enhanced-compression.js +81 -30
- package/dist/context/file-mentions.d.ts +46 -0
- package/dist/context/file-mentions.js +245 -0
- package/dist/context/importance-scorer.js +4 -3
- package/dist/context/jit-context.d.ts +7 -0
- package/dist/context/jit-context.js +22 -4
- package/dist/context/lm-resizer-compressor.d.ts +102 -0
- package/dist/context/lm-resizer-compressor.js +593 -0
- package/dist/context/precompaction-flush.js +1 -1
- package/dist/context/restorable-compression.d.ts +59 -14
- package/dist/context/restorable-compression.js +310 -60
- package/dist/context/segment-archive.d.ts +36 -0
- package/dist/context/segment-archive.js +220 -0
- package/dist/context/smart-compaction.d.ts +7 -0
- package/dist/context/smart-compaction.js +84 -15
- package/dist/context/token-counter.d.ts +6 -0
- package/dist/context/token-counter.js +41 -0
- package/dist/context/token-juice.d.ts +72 -0
- package/dist/context/token-juice.js +220 -0
- package/dist/context/tool-observation-optimizer.d.ts +90 -0
- package/dist/context/tool-observation-optimizer.js +231 -0
- package/dist/context/tool-pair-preserver.d.ts +1 -1
- package/dist/context/tool-pair-preserver.js +1 -1
- package/dist/context/transcript-repair.d.ts +16 -3
- package/dist/context/transcript-repair.js +72 -35
- package/dist/context/types.d.ts +2 -0
- package/dist/conversation/argument-obligations.d.ts +65 -0
- package/dist/conversation/argument-obligations.js +157 -0
- package/dist/conversation/companion-model-routing.d.ts +121 -0
- package/dist/conversation/companion-model-routing.js +810 -0
- package/dist/conversation/conversation-benchmark.d.ts +143 -0
- package/dist/conversation/conversation-benchmark.js +766 -0
- package/dist/conversation/conversation-blind-comparison.d.ts +135 -0
- package/dist/conversation/conversation-blind-comparison.js +451 -0
- package/dist/conversation/conversation-evaluator.d.ts +56 -0
- package/dist/conversation/conversation-evaluator.js +335 -0
- package/dist/conversation/conversation-orchestrator.d.ts +32 -0
- package/dist/conversation/conversation-orchestrator.js +59 -0
- package/dist/conversation/conversation-pilot-corpus.d.ts +33 -0
- package/dist/conversation/conversation-pilot-corpus.js +313 -0
- package/dist/conversation/conversation-quality.d.ts +31 -0
- package/dist/conversation/conversation-quality.js +280 -0
- package/dist/conversation/conversation-state.d.ts +23 -0
- package/dist/conversation/conversation-state.js +117 -0
- package/dist/conversation/cross-channel-bridge.d.ts +127 -0
- package/dist/conversation/cross-channel-bridge.js +785 -0
- package/dist/conversation/deliberation-thread.d.ts +18 -0
- package/dist/conversation/deliberation-thread.js +303 -0
- package/dist/conversation/dialogue-act.d.ts +11 -0
- package/dist/conversation/dialogue-act.js +132 -0
- package/dist/conversation/discourse-planner.d.ts +3 -0
- package/dist/conversation/discourse-planner.js +141 -0
- package/dist/conversation/fresh-context.d.ts +54 -0
- package/dist/conversation/fresh-context.js +258 -0
- package/dist/conversation/prefetched-turn-context.d.ts +45 -0
- package/dist/conversation/prefetched-turn-context.js +209 -0
- package/dist/conversation/relationship-safety.d.ts +37 -0
- package/dist/conversation/relationship-safety.js +407 -0
- package/dist/conversation/semantic-response-gate.d.ts +262 -0
- package/dist/conversation/semantic-response-gate.js +656 -0
- package/dist/conversation/semantic-response-runtime.d.ts +79 -0
- package/dist/conversation/semantic-response-runtime.js +419 -0
- package/dist/conversation/shared-relationship-state.d.ts +60 -0
- package/dist/conversation/shared-relationship-state.js +262 -0
- package/dist/conversation/types.d.ts +77 -0
- package/dist/conversation/types.js +3 -0
- package/dist/conversation/voice-continuity.d.ts +13 -0
- package/dist/conversation/voice-continuity.js +48 -0
- package/dist/council/conductor.d.ts +26 -0
- package/dist/council/conductor.js +292 -0
- package/dist/council/council-engine.d.ts +29 -0
- package/dist/council/council-engine.js +458 -0
- package/dist/council/deliberation-health.d.ts +58 -0
- package/dist/council/deliberation-health.js +108 -0
- package/dist/council/judge.d.ts +69 -0
- package/dist/council/judge.js +183 -0
- package/dist/council/peers.d.ts +19 -0
- package/dist/council/peers.js +47 -0
- package/dist/council/signals.d.ts +26 -0
- package/dist/council/signals.js +156 -0
- package/dist/council/task-types.d.ts +16 -0
- package/dist/council/task-types.js +58 -0
- package/dist/council/triage.d.ts +48 -0
- package/dist/council/triage.js +228 -0
- package/dist/council/types.d.ts +292 -0
- package/dist/council/types.js +20 -0
- package/dist/council/with-timeout.d.ts +10 -0
- package/dist/council/with-timeout.js +29 -0
- package/dist/curator/curator.d.ts +79 -0
- package/dist/curator/curator.js +317 -0
- package/dist/daemon/agent-task-executor.js +51 -0
- package/dist/daemon/autonomous-daemon.d.ts +2 -0
- package/dist/daemon/autonomous-daemon.js +4 -1
- package/dist/daemon/autonomous-loop.d.ts +9 -0
- package/dist/daemon/autonomous-loop.js +57 -1
- package/dist/daemon/autonomy-bench-candidates.d.ts +33 -0
- package/dist/daemon/autonomy-bench-candidates.js +68 -0
- package/dist/daemon/autonomy-briefing.d.ts +112 -0
- package/dist/daemon/autonomy-briefing.js +359 -0
- package/dist/daemon/autonomy-run-journal.d.ts +20 -0
- package/dist/daemon/autonomy-run-journal.js +41 -0
- package/dist/daemon/daily-reset.d.ts +2 -2
- package/dist/daemon/daily-reset.js +16 -15
- package/dist/daemon/ollama-task-executor.js +9 -1
- package/dist/database/database-manager.d.ts +1 -1
- package/dist/database/database-manager.js +6 -4
- package/dist/database/optional-sqlite.d.ts +20 -0
- package/dist/database/optional-sqlite.js +101 -0
- package/dist/design/design-system-registry.d.ts +21 -0
- package/dist/design/design-system-registry.js +106 -0
- package/dist/desktop/codebuddy-engine-adapter.d.ts +34 -0
- package/dist/desktop/codebuddy-engine-adapter.js +306 -21
- package/dist/desktop/electron-launch-args.d.ts +7 -0
- package/dist/desktop/electron-launch-args.js +13 -0
- package/dist/desktop/engine-adapter.d.ts +6 -0
- package/dist/desktop/launcher.js +2 -1
- package/dist/desktop/permission-bridge.d.ts +12 -1
- package/dist/desktop/permission-bridge.js +12 -5
- package/dist/desktop-automation/omniparser-runner.d.ts +1 -0
- package/dist/desktop-automation/omniparser-runner.js +12 -1
- package/dist/desktop-automation/smart-snapshot.js +7 -0
- package/dist/desktop-automation/windows-native-provider.js +1 -1
- package/dist/doctor/assistant-runtime.d.ts +90 -0
- package/dist/doctor/assistant-runtime.js +472 -0
- package/dist/doctor/env-sanity.d.ts +17 -0
- package/dist/doctor/env-sanity.js +74 -0
- package/dist/doctor/index.d.ts +37 -0
- package/dist/doctor/index.js +389 -37
- package/dist/doctor/llm-key-check.d.ts +17 -0
- package/dist/doctor/llm-key-check.js +100 -0
- package/dist/doctor/ollama-model-selection.d.ts +16 -0
- package/dist/doctor/ollama-model-selection.js +55 -0
- package/dist/embeddings/embedding-provider.d.ts +1 -0
- package/dist/embeddings/embedding-provider.js +21 -9
- package/dist/errors/crash-recovery.js +6 -4
- package/dist/events/index.d.ts +1 -1
- package/dist/events/types.d.ts +44 -0
- package/dist/export/repo-explanation.d.ts +10 -0
- package/dist/export/repo-explanation.js +334 -0
- package/dist/export/session-share.d.ts +34 -0
- package/dist/export/session-share.js +687 -0
- package/dist/fleet/autonomous-tick-broadcaster.d.ts +1 -1
- package/dist/fleet/capability-registry.d.ts +9 -0
- package/dist/fleet/capability-registry.js +268 -56
- package/dist/fleet/colab-store.d.ts +3 -4
- package/dist/fleet/colab-store.js +6 -26
- package/dist/fleet/compatible-model.d.ts +39 -0
- package/dist/fleet/compatible-model.js +148 -0
- package/dist/fleet/consolidation/collecte.d.ts +31 -0
- package/dist/fleet/consolidation/collecte.js +86 -0
- package/dist/fleet/consolidation/digest-texte.d.ts +11 -0
- package/dist/fleet/consolidation/digest-texte.js +52 -0
- package/dist/fleet/consolidation/thalamus.d.ts +35 -0
- package/dist/fleet/consolidation/thalamus.js +151 -0
- package/dist/fleet/consolidation/types.d.ts +66 -0
- package/dist/fleet/consolidation/types.js +22 -0
- package/dist/fleet/cost-tracker.d.ts +11 -0
- package/dist/fleet/cost-tracker.js +64 -17
- package/dist/fleet/fleet-cost-cap.d.ts +36 -0
- package/dist/fleet/fleet-cost-cap.js +175 -0
- package/dist/fleet/fleet-http-surface.d.ts +24 -0
- package/dist/fleet/fleet-http-surface.js +72 -0
- package/dist/fleet/fleet-listener.d.ts +1 -1
- package/dist/fleet/fleet-listener.js +4 -0
- package/dist/fleet/model-capability-heuristics.d.ts +31 -0
- package/dist/fleet/model-capability-heuristics.js +49 -0
- package/dist/fleet/model-inventory.d.ts +46 -0
- package/dist/fleet/model-inventory.js +242 -0
- package/dist/fleet/model-scoreboard.d.ts +118 -13
- package/dist/fleet/model-scoreboard.js +339 -27
- package/dist/fleet/model-selector.d.ts +83 -0
- package/dist/fleet/model-selector.js +218 -0
- package/dist/fleet/peer-chat-bridge.d.ts +9 -2
- package/dist/fleet/peer-chat-bridge.js +133 -19
- package/dist/fleet/peer-chat-client-factory.d.ts +28 -2
- package/dist/fleet/peer-chat-client-factory.js +195 -22
- package/dist/fleet/peer-ckg-bridge.d.ts +67 -0
- package/dist/fleet/peer-ckg-bridge.js +467 -0
- package/dist/fleet/peer-mission-exchange-bridge.d.ts +8 -0
- package/dist/fleet/peer-mission-exchange-bridge.js +127 -0
- package/dist/fleet/peer-session-bridge.d.ts +7 -1
- package/dist/fleet/peer-session-bridge.js +98 -17
- package/dist/fleet/peer-session-store.d.ts +2 -0
- package/dist/fleet/peer-session-store.js +6 -5
- package/dist/fleet/peer-text-sanitizer.d.ts +59 -0
- package/dist/fleet/peer-text-sanitizer.js +99 -0
- package/dist/fleet/peer-tool-bridge.js +38 -10
- package/dist/fleet/privacy-lint.js +80 -8
- package/dist/fleet/saga-store.d.ts +25 -1
- package/dist/fleet/saga-store.js +34 -6
- package/dist/fleet/task-router.d.ts +17 -1
- package/dist/fleet/task-router.js +65 -20
- package/dist/fleet/types.d.ts +9 -5
- package/dist/gateway/device-pairing.js +5 -11
- package/dist/gateway/ws-transport.d.ts +1 -5
- package/dist/gateway/ws-transport.js +2 -22
- package/dist/git/changelog.d.ts +36 -0
- package/dist/git/changelog.js +109 -0
- package/dist/git/worktree-sessions.js +1 -1
- package/dist/goals/counterfactual-forge.d.ts +70 -0
- package/dist/goals/counterfactual-forge.js +184 -0
- package/dist/goals/criterion-progress.d.ts +24 -0
- package/dist/goals/criterion-progress.js +59 -0
- package/dist/goals/evidence-artifact.d.ts +18 -0
- package/dist/goals/evidence-artifact.js +76 -0
- package/dist/goals/goal-decomposer.d.ts +15 -0
- package/dist/goals/goal-decomposer.js +89 -4
- package/dist/goals/goal-loop.d.ts +29 -0
- package/dist/goals/goal-loop.js +92 -6
- package/dist/goals/goal-manager.d.ts +1 -0
- package/dist/goals/goal-manager.js +4 -1
- package/dist/goals/goal-state.d.ts +10 -0
- package/dist/goals/goal-state.js +21 -1
- package/dist/goals/goal-store.js +4 -6
- package/dist/goals/index.d.ts +11 -0
- package/dist/goals/index.js +11 -0
- package/dist/goals/intent-graph.d.ts +40 -0
- package/dist/goals/intent-graph.js +133 -0
- package/dist/goals/mission-constitution.d.ts +59 -0
- package/dist/goals/mission-constitution.js +132 -0
- package/dist/goals/mission-exchange.d.ts +86 -0
- package/dist/goals/mission-exchange.js +216 -0
- package/dist/goals/outcome-capsule.d.ts +80 -0
- package/dist/goals/outcome-capsule.js +186 -0
- package/dist/goals/proof-ledger.d.ts +79 -0
- package/dist/goals/proof-ledger.js +181 -0
- package/dist/goals/proven-outcome-lessons.d.ts +11 -0
- package/dist/goals/proven-outcome-lessons.js +30 -0
- package/dist/goals/proven-outcome-memory.d.ts +55 -0
- package/dist/goals/proven-outcome-memory.js +125 -0
- package/dist/goals/shadow-twin.d.ts +57 -0
- package/dist/goals/shadow-twin.js +110 -0
- package/dist/gpu-worker/gpu-media-worker-server.d.ts +49 -0
- package/dist/gpu-worker/gpu-media-worker-server.js +637 -0
- package/dist/harness/contract.d.ts +84 -84
- package/dist/hooks/advanced-hooks.js +6 -4
- package/dist/hooks/env-persistence.js +5 -6
- package/dist/hooks/hook-manager.js +8 -7
- package/dist/hooks/hook-system.js +6 -4
- package/dist/hooks/lifecycle-hooks.js +6 -3
- package/dist/hooks/moltbot/moltbot-hooks-manager.js +8 -3
- package/dist/hooks/moltbot/session-persistence-manager.js +15 -7
- package/dist/hooks/moltbot/setup-utilities.js +6 -4
- package/dist/hooks/smart-hooks.js +6 -4
- package/dist/hooks/use-input-handler.js +9 -63
- package/dist/hooks/user-hooks.d.ts +10 -1
- package/dist/hooks/user-hooks.js +77 -1
- package/dist/identity/companion-identity.d.ts +4 -1
- package/dist/identity/companion-identity.js +134 -4
- package/dist/identity/identity-manager.d.ts +1 -1
- package/dist/identity/identity-manager.js +7 -6
- package/dist/identity/lisa-introspection.d.ts +36 -0
- package/dist/identity/lisa-introspection.js +411 -0
- package/dist/identity/operational-self-model.d.ts +143 -0
- package/dist/identity/operational-self-model.js +974 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +987 -223
- package/dist/input/context-mentions.d.ts +7 -1
- package/dist/input/context-mentions.js +18 -20
- package/dist/input/text-to-speech.d.ts +3 -0
- package/dist/input/text-to-speech.js +70 -27
- package/dist/input/voice-control.d.ts +1 -0
- package/dist/input/voice-control.js +24 -18
- package/dist/input/voice-input-enhanced.d.ts +1 -0
- package/dist/input/voice-input-enhanced.js +31 -16
- package/dist/integrations/ci-autofix-pipeline.js +15 -20
- package/dist/integrations/ide/server.js +3 -2
- package/dist/integrations/json-rpc/server.js +4 -2
- package/dist/integrations/mcp/mcp-server.js +4 -2
- package/dist/integrations/opentelemetry-integration.js +6 -4
- package/dist/integrations/pubcommander-bridge.d.ts +5 -0
- package/dist/integrations/pubcommander-bridge.js +61 -0
- package/dist/integrations/sentry-integration.js +9 -3
- package/dist/intelligence/semantic-search.js +9 -12
- package/dist/intelligence/user-preferences.js +8 -11
- package/dist/intents/intent-checker.d.ts +34 -0
- package/dist/intents/intent-checker.js +175 -0
- package/dist/intents/intent-generator.d.ts +12 -0
- package/dist/intents/intent-generator.js +86 -0
- package/dist/intents/intent-store.d.ts +62 -0
- package/dist/intents/intent-store.js +263 -0
- package/dist/interpreter/computer/skills.js +3 -2
- package/dist/interpreter/interpreter-service.js +18 -9
- package/dist/kanban/kanban-board-registry.js +6 -4
- package/dist/kanban/kanban-store.js +5 -7
- package/dist/knowledge/code-graph-persistence.js +8 -16
- package/dist/knowledge/graph-drift.js +14 -11
- package/dist/knowledge/knowledge-manager.js +2 -1
- package/dist/knowledge/scanners/index.d.ts +3 -0
- package/dist/knowledge/scanners/index.js +57 -29
- package/dist/knowledge/workspace-indexer.js +22 -15
- package/dist/life-rhythm/cooking-timer-store.d.ts +50 -0
- package/dist/life-rhythm/cooking-timer-store.js +240 -0
- package/dist/life-rhythm/day-context.d.ts +30 -0
- package/dist/life-rhythm/day-context.js +198 -0
- package/dist/life-rhythm/etalab-holiday-provider.d.ts +40 -0
- package/dist/life-rhythm/etalab-holiday-provider.js +318 -0
- package/dist/life-rhythm/home-mode-store.d.ts +32 -0
- package/dist/life-rhythm/home-mode-store.js +184 -0
- package/dist/life-rhythm/index.d.ts +6 -0
- package/dist/life-rhythm/index.js +7 -0
- package/dist/life-rhythm/types.d.ts +88 -0
- package/dist/life-rhythm/types.js +33 -0
- package/dist/life-rhythm/zoned-minute.d.ts +24 -0
- package/dist/life-rhythm/zoned-minute.js +113 -0
- package/dist/location/index.d.ts +2 -12
- package/dist/location/index.js +129 -56
- package/dist/logging/interaction-logger.js +29 -46
- package/dist/lora/dataset-v3-plan.d.ts +27 -0
- package/dist/lora/dataset-v3-plan.js +121 -0
- package/dist/lora/dataset.d.ts +26 -0
- package/dist/lora/dataset.js +165 -0
- package/dist/lora/fal-krea-trainer.d.ts +54 -0
- package/dist/lora/fal-krea-trainer.js +197 -0
- package/dist/lora/generate-training-set.d.ts +61 -0
- package/dist/lora/generate-training-set.js +190 -0
- package/dist/lora/identity-dataset-gate.d.ts +104 -0
- package/dist/lora/identity-dataset-gate.js +204 -0
- package/dist/lora/identity-dataset-promotion.d.ts +32 -0
- package/dist/lora/identity-dataset-promotion.js +269 -0
- package/dist/lora/index.d.ts +11 -0
- package/dist/lora/index.js +12 -0
- package/dist/lora/install-comfy.d.ts +14 -0
- package/dist/lora/install-comfy.js +63 -0
- package/dist/lora/lisa-avatar-bible.d.ts +85 -0
- package/dist/lora/lisa-avatar-bible.js +275 -0
- package/dist/lora/local-plan.d.ts +10 -0
- package/dist/lora/local-plan.js +205 -0
- package/dist/lora/pack-dataset.d.ts +7 -0
- package/dist/lora/pack-dataset.js +39 -0
- package/dist/lora/quality-gate.d.ts +31 -0
- package/dist/lora/quality-gate.js +90 -0
- package/dist/lora/types.d.ts +66 -0
- package/dist/lora/types.js +5 -0
- package/dist/lsp/lsp-client.d.ts +12 -0
- package/dist/lsp/lsp-client.js +45 -9
- package/dist/lsp/server.js +1 -1
- package/dist/mcp/approval-elicitation.d.ts +1 -0
- package/dist/mcp/approval-elicitation.js +2 -0
- package/dist/mcp/client.d.ts +15 -1
- package/dist/mcp/client.js +110 -24
- package/dist/mcp/config.d.ts +12 -1
- package/dist/mcp/config.js +55 -12
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/mcp-agent-tools.d.ts +1 -1
- package/dist/mcp/mcp-agent-tools.js +76 -73
- package/dist/mcp/mcp-ckg-tools.d.ts +31 -0
- package/dist/mcp/mcp-ckg-tools.js +121 -0
- package/dist/mcp/mcp-client.js +8 -5
- package/dist/mcp/mcp-desktop-tools.d.ts +1 -1
- package/dist/mcp/mcp-desktop-tools.js +105 -99
- package/dist/mcp/mcp-memory-tools.d.ts +1 -1
- package/dist/mcp/mcp-memory-tools.js +63 -61
- package/dist/mcp/mcp-oauth.js +5 -2
- package/dist/mcp/mcp-server.d.ts +48 -79
- package/dist/mcp/mcp-server.js +445 -478
- package/dist/mcp/mcp-session-tools.d.ts +1 -1
- package/dist/mcp/mcp-session-tools.js +95 -92
- package/dist/mcp/profiles.d.ts +18 -0
- package/dist/mcp/profiles.js +65 -0
- package/dist/mcp/prompt-footprint.d.ts +21 -0
- package/dist/mcp/prompt-footprint.js +39 -0
- package/dist/meals/allergens.d.ts +19 -0
- package/dist/meals/allergens.js +122 -0
- package/dist/meals/compatibility.d.ts +6 -0
- package/dist/meals/compatibility.js +109 -0
- package/dist/meals/food-inventory-store.d.ts +51 -0
- package/dist/meals/food-inventory-store.js +257 -0
- package/dist/meals/index.d.ts +10 -0
- package/dist/meals/index.js +11 -0
- package/dist/meals/meal-engine.d.ts +7 -0
- package/dist/meals/meal-engine.js +206 -0
- package/dist/meals/meal-plan-store.d.ts +73 -0
- package/dist/meals/meal-plan-store.js +271 -0
- package/dist/meals/private-json-store.d.ts +9 -0
- package/dist/meals/private-json-store.js +92 -0
- package/dist/meals/profile-store.d.ts +49 -0
- package/dist/meals/profile-store.js +296 -0
- package/dist/meals/profile-validator.d.ts +7 -0
- package/dist/meals/profile-validator.js +124 -0
- package/dist/meals/recipe-normalizer.d.ts +7 -0
- package/dist/meals/recipe-normalizer.js +162 -0
- package/dist/meals/store-validation.d.ts +21 -0
- package/dist/meals/store-validation.js +101 -0
- package/dist/meals/types.d.ts +170 -0
- package/dist/meals/types.js +12 -0
- package/dist/media/comfy-health-supervisor.d.ts +142 -0
- package/dist/media/comfy-health-supervisor.js +608 -0
- package/dist/media/comfyui-recipe-contract.d.ts +696 -0
- package/dist/media/comfyui-recipe-contract.js +580 -0
- package/dist/media/comfyui-recipe-engine.d.ts +3 -0
- package/dist/media/comfyui-recipe-engine.js +4 -0
- package/dist/media/comfyui-recipe-registry.d.ts +35 -0
- package/dist/media/comfyui-recipe-registry.js +385 -0
- package/dist/media/comfyui-recipe-runtime.d.ts +135 -0
- package/dist/media/comfyui-recipe-runtime.js +942 -0
- package/dist/media/content-tier.d.ts +25 -0
- package/dist/media/content-tier.js +29 -0
- package/dist/meeting/analyzer.d.ts +24 -0
- package/dist/meeting/analyzer.js +402 -0
- package/dist/meeting/index.d.ts +13 -0
- package/dist/meeting/index.js +48 -0
- package/dist/meeting/markdown.d.ts +3 -0
- package/dist/meeting/markdown.js +51 -0
- package/dist/meeting/output.d.ts +13 -0
- package/dist/meeting/output.js +155 -0
- package/dist/meeting/transcript.d.ts +25 -0
- package/dist/meeting/transcript.js +292 -0
- package/dist/meeting/types.d.ts +112 -0
- package/dist/meeting/types.js +9 -0
- package/dist/memory/adapters/network-memory-adapters.d.ts +19 -4
- package/dist/memory/adapters/network-memory-adapters.js +4 -4
- package/dist/memory/auto-memory.js +5 -2
- package/dist/memory/background-extractor.d.ts +43 -0
- package/dist/memory/background-extractor.js +368 -0
- package/dist/memory/buddy-memory-client.d.ts +40 -0
- package/dist/memory/buddy-memory-client.js +198 -0
- package/dist/memory/ckg-engine-policy.d.ts +19 -0
- package/dist/memory/ckg-engine-policy.js +45 -0
- package/dist/memory/ckg-fact-reconciliation.d.ts +81 -0
- package/dist/memory/ckg-fact-reconciliation.js +155 -0
- package/dist/memory/ckg-redaction.d.ts +2 -0
- package/dist/memory/ckg-redaction.js +25 -0
- package/dist/memory/coding-style-analyzer.js +2 -2
- package/dist/memory/collective-knowledge-graph.d.ts +380 -0
- package/dist/memory/collective-knowledge-graph.js +1228 -0
- package/dist/memory/enhanced-memory.d.ts +29 -0
- package/dist/memory/enhanced-memory.js +153 -63
- package/dist/memory/facts-memory.d.ts +9 -4
- package/dist/memory/facts-memory.js +21 -4
- package/dist/memory/hybrid-mmr.d.ts +71 -0
- package/dist/memory/hybrid-mmr.js +127 -0
- package/dist/memory/hybrid-search.js +4 -1
- package/dist/memory/knowledge-graph.d.ts +23 -2
- package/dist/memory/knowledge-graph.js +62 -47
- package/dist/memory/memory-candidate-queue.js +9 -4
- package/dist/memory/memory-consolidation.d.ts +8 -0
- package/dist/memory/memory-consolidation.js +66 -17
- package/dist/memory/memory-forgetting.d.ts +57 -0
- package/dist/memory/memory-forgetting.js +87 -0
- package/dist/memory/ocr-memory-pipeline.js +16 -10
- package/dist/memory/persistent-memory.d.ts +98 -0
- package/dist/memory/persistent-memory.js +711 -119
- package/dist/memory/presence-injector.d.ts +1 -1
- package/dist/memory/presence-injector.js +9 -4
- package/dist/memory/semantic-memory-search.js +12 -9
- package/dist/memory/subagent-memory.js +8 -8
- package/dist/memory/user-model.js +9 -4
- package/dist/metrics/metrics-collector.d.ts +1 -0
- package/dist/metrics/metrics-collector.js +11 -2
- package/dist/nodes/device-node.d.ts +5 -2
- package/dist/nodes/device-node.js +65 -19
- package/dist/nodes/index.d.ts +32 -2
- package/dist/nodes/index.js +208 -7
- package/dist/nodes/transports/adb-transport.d.ts +2 -6
- package/dist/nodes/transports/adb-transport.js +29 -13
- package/dist/nodes/transports/base-transport.d.ts +10 -0
- package/dist/observability/run-store.d.ts +6 -1
- package/dist/observability/run-store.js +89 -22
- package/dist/observability/run-trajectory-load.d.ts +16 -0
- package/dist/observability/run-trajectory-load.js +266 -0
- package/dist/observability/run-trajectory.d.ts +168 -0
- package/dist/observability/run-trajectory.js +468 -0
- package/dist/observability/run-viewer.d.ts +5 -1
- package/dist/observability/run-viewer.js +83 -9
- package/dist/observability/turn-metrics.d.ts +86 -0
- package/dist/observability/turn-metrics.js +201 -0
- package/dist/offline/offline-mode.js +10 -9
- package/dist/openclaw/gateway-bridge.js +3 -2
- package/dist/optimization/latency-optimizer.d.ts +2 -1
- package/dist/optimization/latency-optimizer.js +2 -2
- package/dist/optimization/model-routing.d.ts +3 -0
- package/dist/orchestration/orchestrator.js +4 -1
- package/dist/orchestration/types.d.ts +2 -0
- package/dist/performance/lazy-loader.js +2 -1
- package/dist/performance/tool-cache.d.ts +4 -0
- package/dist/performance/tool-cache.js +4 -2
- package/dist/persistence/conversation-branches.js +9 -2
- package/dist/persistence/session-store.d.ts +26 -0
- package/dist/persistence/session-store.js +56 -17
- package/dist/personas/persona-manager.d.ts +39 -1
- package/dist/personas/persona-manager.js +276 -38
- package/dist/plugins/bundled/groq-provider.js +10 -7
- package/dist/plugins/bundled/openrouter-provider.js +2 -1
- package/dist/plugins/code-explorer/CodeExplorerManager.d.ts +52 -4
- package/dist/plugins/code-explorer/CodeExplorerManager.js +201 -31
- package/dist/plugins/code-explorer/code-explorer-client.d.ts +36 -0
- package/dist/plugins/code-explorer/code-explorer-client.js +86 -0
- package/dist/plugins/code-explorer/index.d.ts +1 -3
- package/dist/plugins/code-explorer/index.js +0 -1
- package/dist/plugins/git-pinned-marketplace.js +3 -2
- package/dist/plugins/plugin-manager.js +6 -9
- package/dist/plugins/sandbox-worker.js +1 -1
- package/dist/prompts/system-base.js +27 -3
- package/dist/protocols/a2a/codebuddy-executor.d.ts +9 -0
- package/dist/protocols/a2a/codebuddy-executor.js +25 -6
- package/dist/protocols/a2a/index.d.ts +6 -0
- package/dist/protocols/a2a/index.js +32 -3
- package/dist/protocols/acp/acp-agentic-runner.d.ts +6 -2
- package/dist/protocols/acp/acp-agentic-runner.js +91 -15
- package/dist/protocols/acp/acp-session-store.js +28 -5
- package/dist/protocols/acp/acp-stdio-server.d.ts +13 -0
- package/dist/protocols/acp/acp-stdio-server.js +30 -3
- package/dist/providers/active-llm-model-pool.d.ts +45 -0
- package/dist/providers/active-llm-model-pool.js +139 -0
- package/dist/providers/active-llm-registry.js +48 -8
- package/dist/providers/auxiliary-provider.d.ts +1 -1
- package/dist/providers/auxiliary-provider.js +23 -10
- package/dist/providers/chatgpt-models.d.ts +71 -0
- package/dist/providers/chatgpt-models.js +302 -0
- package/dist/providers/codex-oauth.d.ts +8 -0
- package/dist/providers/codex-oauth.js +47 -39
- package/dist/providers/gemini-oauth.js +7 -6
- package/dist/providers/grok-provider.js +1 -1
- package/dist/providers/index.d.ts +3 -0
- package/dist/providers/index.js +3 -0
- package/dist/providers/local-model-resolver.d.ts +66 -0
- package/dist/providers/local-model-resolver.js +128 -0
- package/dist/providers/model-egress.d.ts +8 -0
- package/dist/providers/model-egress.js +62 -0
- package/dist/providers/model-provider-compat.d.ts +13 -0
- package/dist/providers/model-provider-compat.js +48 -0
- package/dist/providers/provider-catalog.d.ts +4 -1
- package/dist/providers/provider-catalog.js +494 -28
- package/dist/providers/provider-failover-notify.d.ts +15 -0
- package/dist/providers/provider-failover-notify.js +93 -0
- package/dist/providers/provider-failover-policy.d.ts +28 -0
- package/dist/providers/provider-failover-policy.js +188 -0
- package/dist/providers/provider-failover-user-notice.d.ts +13 -0
- package/dist/providers/provider-failover-user-notice.js +49 -0
- package/dist/providers/provider-fallback.d.ts +1 -0
- package/dist/providers/provider-fallback.js +1 -1
- package/dist/providers/provider-health.d.ts +46 -0
- package/dist/providers/provider-health.js +249 -0
- package/dist/providers/turboquant-provider.d.ts +1 -1
- package/dist/providers/xai-oauth.js +7 -34
- package/dist/queue/persistent-queue.js +9 -6
- package/dist/renderers/charts/special-charts.d.ts +7 -1
- package/dist/renderers/charts/special-charts.js +5 -0
- package/dist/renderers/weather-conditions.d.ts +20 -0
- package/dist/renderers/weather-conditions.js +74 -0
- package/dist/renderers/weather-renderer.js +4 -18
- package/dist/rendering/ansi.d.ts +4 -0
- package/dist/rendering/ansi.js +149 -0
- package/dist/rendering/index.d.ts +19 -0
- package/dist/rendering/index.js +18 -0
- package/dist/rendering/markdown-core.d.ts +13 -0
- package/dist/rendering/markdown-core.js +18 -0
- package/dist/rendering/plain.d.ts +2 -0
- package/dist/rendering/plain.js +91 -0
- package/dist/rendering/telegram-html.d.ts +27 -0
- package/dist/rendering/telegram-html.js +290 -0
- package/dist/research/auto-ingest.d.ts +45 -0
- package/dist/research/auto-ingest.js +85 -0
- package/dist/research/code-explorer-source.d.ts +29 -0
- package/dist/research/code-explorer-source.js +76 -0
- package/dist/research/connector-source.d.ts +25 -0
- package/dist/research/connector-source.js +314 -0
- package/dist/research/paper-qa/answer.d.ts +72 -0
- package/dist/research/paper-qa/answer.js +227 -0
- package/dist/research/paper-qa/corpus.d.ts +36 -0
- package/dist/research/paper-qa/corpus.js +102 -0
- package/dist/research/paper-qa/disk-embedding-cache.d.ts +28 -0
- package/dist/research/paper-qa/disk-embedding-cache.js +193 -0
- package/dist/research/paper-qa/index.d.ts +31 -0
- package/dist/research/paper-qa/index.js +24 -0
- package/dist/research/paper-qa/paper-qa-pipeline.d.ts +107 -0
- package/dist/research/paper-qa/paper-qa-pipeline.js +163 -0
- package/dist/research/paper-qa/passage-index.d.ts +203 -0
- package/dist/research/paper-qa/passage-index.js +405 -0
- package/dist/research/paper-qa/pdf-structure.d.ts +37 -0
- package/dist/research/paper-qa/pdf-structure.js +377 -0
- package/dist/research/paper-qa/persistent-corpus-index.d.ts +23 -0
- package/dist/research/paper-qa/persistent-corpus-index.js +122 -0
- package/dist/research/paper-qa/prose-chunker.d.ts +19 -0
- package/dist/research/paper-qa/prose-chunker.js +201 -0
- package/dist/research/paper-qa/provenance.d.ts +24 -0
- package/dist/research/paper-qa/provenance.js +40 -0
- package/dist/research/paper-qa/rcs.d.ts +78 -0
- package/dist/research/paper-qa/rcs.js +200 -0
- package/dist/research/paper-qa/types.d.ts +124 -0
- package/dist/research/paper-qa/types.js +13 -0
- package/dist/research/publication-sources.d.ts +34 -0
- package/dist/research/publication-sources.js +131 -0
- package/dist/research/relation-classifier.d.ts +13 -0
- package/dist/research/relation-classifier.js +58 -0
- package/dist/research/research-topics.d.ts +13 -0
- package/dist/research/research-topics.js +81 -0
- package/dist/review/apply-transaction.d.ts +40 -0
- package/dist/review/apply-transaction.js +112 -0
- package/dist/review/diff-model.d.ts +39 -0
- package/dist/review/diff-model.js +124 -0
- package/dist/review/llm-client.d.ts +30 -0
- package/dist/review/llm-client.js +98 -0
- package/dist/review/llm-reviewer.d.ts +16 -0
- package/dist/review/llm-reviewer.js +122 -0
- package/dist/review/review-engine.d.ts +54 -0
- package/dist/review/review-engine.js +0 -0
- package/dist/review/revision-loop.d.ts +67 -0
- package/dist/review/revision-loop.js +160 -0
- package/dist/review/static-gate.d.ts +13 -0
- package/dist/review/static-gate.js +110 -0
- package/dist/review/types.d.ts +122 -0
- package/dist/review/types.js +24 -0
- package/dist/review/write-gate.d.ts +55 -0
- package/dist/review/write-gate.js +121 -0
- package/dist/sandbox/auto-sandbox.d.ts +4 -2
- package/dist/sandbox/auto-sandbox.js +14 -1
- package/dist/sandbox/docker-sandbox.d.ts +39 -0
- package/dist/sandbox/docker-sandbox.js +292 -14
- package/dist/sandbox/execpolicy.d.ts +36 -1
- package/dist/sandbox/execpolicy.js +375 -40
- package/dist/sandbox/os-sandbox.d.ts +53 -0
- package/dist/sandbox/os-sandbox.js +315 -70
- package/dist/sandbox/sandbox-backend.d.ts +2 -0
- package/dist/scheduler/cron-scheduler.d.ts +1 -0
- package/dist/scheduler/cron-scheduler.js +142 -41
- package/dist/scripting/codebuddy-bindings.js +2 -1
- package/dist/search/bm25.js +5 -2
- package/dist/search/usearch-index.js +7 -5
- package/dist/security/audit-logger.js +14 -7
- package/dist/security/bash-allowlist/allowlist-store.d.ts +8 -2
- package/dist/security/bash-allowlist/allowlist-store.js +52 -12
- package/dist/security/bash-allowlist/approval-flow.d.ts +1 -1
- package/dist/security/bash-allowlist/approval-flow.js +10 -8
- package/dist/security/bash-allowlist/deny-guard.d.ts +14 -0
- package/dist/security/bash-allowlist/deny-guard.js +61 -0
- package/dist/security/bash-allowlist/types.d.ts +5 -0
- package/dist/security/bash-parser.d.ts +32 -0
- package/dist/security/bash-parser.js +129 -14
- package/dist/security/dangerous-patterns.js +18 -3
- package/dist/security/declarative-rules.d.ts +1 -1
- package/dist/security/declarative-rules.js +242 -65
- package/dist/security/dependency-vuln-scanner.js +4 -4
- package/dist/security/dev-origins.d.ts +40 -0
- package/dist/security/dev-origins.js +111 -0
- package/dist/security/docker-sandbox/manager.js +1 -1
- package/dist/security/env-blocklist.d.ts +7 -0
- package/dist/security/env-blocklist.js +22 -2
- package/dist/security/guardian-agent.d.ts +0 -5
- package/dist/security/guardian-agent.js +17 -6
- package/dist/security/index.d.ts +3 -0
- package/dist/security/index.js +2 -0
- package/dist/security/native-sandbox.d.ts +80 -0
- package/dist/security/native-sandbox.js +455 -0
- package/dist/security/pack-contents-policy.d.ts +49 -0
- package/dist/security/pack-contents-policy.js +139 -0
- package/dist/security/permission-config.js +2 -5
- package/dist/security/permission-modes.d.ts +11 -0
- package/dist/security/permission-modes.js +71 -7
- package/dist/security/policy-amendments.js +40 -22
- package/dist/security/policy-engine.js +39 -12
- package/dist/security/powershell-parser.d.ts +40 -0
- package/dist/security/powershell-parser.js +198 -0
- package/dist/security/remote-approval.d.ts +0 -1
- package/dist/security/remote-approval.js +3 -2
- package/dist/security/safe-binaries.d.ts +13 -1
- package/dist/security/safe-binaries.js +240 -32
- package/dist/security/safe-fetch.d.ts +7 -0
- package/dist/security/safe-fetch.js +101 -0
- package/dist/security/sandbox.js +2 -2
- package/dist/security/secret-patterns.d.ts +18 -0
- package/dist/security/secret-patterns.js +232 -0
- package/dist/security/secret-scrubber.d.ts +31 -0
- package/dist/security/secret-scrubber.js +170 -0
- package/dist/security/secrets-detector.d.ts +3 -1
- package/dist/security/secrets-detector.js +3 -106
- package/dist/security/security-modes.js +2 -1
- package/dist/security/session-encryption.d.ts +7 -2
- package/dist/security/session-encryption.js +28 -7
- package/dist/security/shell-env-policy.js +11 -2
- package/dist/security/skill-scanner.d.ts +2 -2
- package/dist/security/skill-scanner.js +237 -11
- package/dist/security/ssrf-guard.d.ts +13 -0
- package/dist/security/ssrf-guard.js +27 -0
- package/dist/security/text-deobfuscation.d.ts +41 -0
- package/dist/security/text-deobfuscation.js +256 -0
- package/dist/security/tool-permissions.js +2 -3
- package/dist/security/tool-policy/approval-scope.d.ts +11 -0
- package/dist/security/tool-policy/approval-scope.js +67 -0
- package/dist/security/tool-policy/policy-manager.d.ts +9 -0
- package/dist/security/tool-policy/policy-manager.js +28 -1
- package/dist/security/tool-policy/profiles.js +24 -0
- package/dist/security/tool-policy/tool-groups.js +26 -3
- package/dist/security/tool-policy/types.d.ts +3 -1
- package/dist/security/tool-policy/types.js +2 -0
- package/dist/security/trust-folders.js +3 -2
- package/dist/security/write-policy.d.ts +8 -0
- package/dist/security/write-policy.js +63 -1
- package/dist/self-model/evolution-notes.d.ts +51 -0
- package/dist/self-model/evolution-notes.js +324 -0
- package/dist/sensory/agent-reply.d.ts +136 -0
- package/dist/sensory/agent-reply.js +682 -0
- package/dist/sensory/alert.d.ts +18 -0
- package/dist/sensory/alert.js +105 -0
- package/dist/sensory/arrival-opener.d.ts +102 -0
- package/dist/sensory/arrival-opener.js +292 -0
- package/dist/sensory/audio-scene.d.ts +24 -0
- package/dist/sensory/audio-scene.js +74 -0
- package/dist/sensory/camera-keyframe-policy.d.ts +11 -0
- package/dist/sensory/camera-keyframe-policy.js +43 -0
- package/dist/sensory/conversation-cues.d.ts +55 -0
- package/dist/sensory/conversation-cues.js +140 -0
- package/dist/sensory/domain-event-bridge.d.ts +7 -0
- package/dist/sensory/domain-event-bridge.js +134 -0
- package/dist/sensory/dreaming.d.ts +17 -0
- package/dist/sensory/dreaming.js +52 -2
- package/dist/sensory/elevenlabs-library.d.ts +91 -0
- package/dist/sensory/elevenlabs-library.js +303 -0
- package/dist/sensory/episodic-journal.d.ts +69 -0
- package/dist/sensory/episodic-journal.js +240 -0
- package/dist/sensory/error-watch-reaction.d.ts +41 -0
- package/dist/sensory/error-watch-reaction.js +312 -0
- package/dist/sensory/heartbeat-fallback.d.ts +46 -0
- package/dist/sensory/heartbeat-fallback.js +171 -0
- package/dist/sensory/heartbeat-scheduler.d.ts +6 -0
- package/dist/sensory/heartbeat-scheduler.js +27 -7
- package/dist/sensory/hybrid-reply.d.ts +132 -0
- package/dist/sensory/hybrid-reply.js +1217 -0
- package/dist/sensory/reactions.d.ts +6 -0
- package/dist/sensory/reactions.js +10 -1
- package/dist/sensory/respond-decider.d.ts +124 -0
- package/dist/sensory/respond-decider.js +608 -0
- package/dist/sensory/rule-templates.d.ts +30 -0
- package/dist/sensory/rule-templates.js +100 -0
- package/dist/sensory/schedule-emitter.d.ts +24 -0
- package/dist/sensory/schedule-emitter.js +57 -0
- package/dist/sensory/screen-reaction.js +15 -1
- package/dist/sensory/semantic-vision-reaction.d.ts +36 -0
- package/dist/sensory/semantic-vision-reaction.js +342 -0
- package/dist/sensory/sensory-action-executor.d.ts +98 -0
- package/dist/sensory/sensory-action-executor.js +473 -0
- package/dist/sensory/sensory-bridge.d.ts +11 -1
- package/dist/sensory/sensory-bridge.js +59 -7
- package/dist/sensory/sensory-rules-engine.d.ts +81 -0
- package/dist/sensory/sensory-rules-engine.js +434 -0
- package/dist/sensory/sensory-status.d.ts +102 -0
- package/dist/sensory/sensory-status.js +291 -0
- package/dist/sensory/speech-engine-config.d.ts +68 -0
- package/dist/sensory/speech-engine-config.js +157 -0
- package/dist/sensory/speech-reaction.d.ts +183 -7
- package/dist/sensory/speech-reaction.js +2141 -35
- package/dist/sensory/speech-sanitizer.d.ts +12 -0
- package/dist/sensory/speech-sanitizer.js +143 -0
- package/dist/sensory/system-vitals-emitter.d.ts +130 -0
- package/dist/sensory/system-vitals-emitter.js +514 -0
- package/dist/sensory/tts-cache.d.ts +76 -0
- package/dist/sensory/tts-cache.js +0 -0
- package/dist/sensory/turn-detector.d.ts +28 -0
- package/dist/sensory/turn-detector.js +57 -0
- package/dist/sensory/vision-description-safety.d.ts +4 -0
- package/dist/sensory/vision-description-safety.js +25 -0
- package/dist/sensory/vision-reaction.d.ts +21 -7
- package/dist/sensory/vision-reaction.js +209 -18
- package/dist/sensory/voice-activity.d.ts +69 -0
- package/dist/sensory/voice-activity.js +271 -0
- package/dist/sensory/voice-clock.d.ts +19 -0
- package/dist/sensory/voice-clock.js +111 -0
- package/dist/sensory/voice-entrainment.d.ts +62 -0
- package/dist/sensory/voice-entrainment.js +176 -0
- package/dist/sensory/voice-interactions.d.ts +13 -0
- package/dist/sensory/voice-interactions.js +258 -0
- package/dist/sensory/voice-loop.d.ts +618 -0
- package/dist/sensory/voice-loop.js +3581 -0
- package/dist/sensory/voice-replay-lab.d.ts +32 -0
- package/dist/sensory/voice-replay-lab.js +109 -0
- package/dist/sensory/voice-stream.d.ts +121 -0
- package/dist/sensory/voice-stream.js +598 -0
- package/dist/sensory/voice-turn-coordinator.d.ts +88 -0
- package/dist/sensory/voice-turn-coordinator.js +258 -0
- package/dist/sensory/voice-turn-taking.d.ts +26 -0
- package/dist/sensory/voice-turn-taking.js +59 -0
- package/dist/server/agent-adapter.d.ts +49 -3
- package/dist/server/agent-adapter.js +26 -4
- package/dist/server/channel-a2a-bridge.js +1 -1
- package/dist/server/exposure-diagnostic.d.ts +25 -0
- package/dist/server/exposure-diagnostic.js +51 -0
- package/dist/server/heartbeat-monitor.d.ts +13 -0
- package/dist/server/heartbeat-monitor.js +8 -3
- package/dist/server/http-agent-sessions.d.ts +32 -0
- package/dist/server/http-agent-sessions.js +245 -0
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +913 -46
- package/dist/server/mcp/approval-elicitation.d.ts +144 -0
- package/dist/server/mcp/approval-elicitation.js +377 -0
- package/dist/server/middleware/auth.d.ts +11 -0
- package/dist/server/middleware/auth.js +54 -0
- package/dist/server/middleware/error-handler.d.ts +5 -0
- package/dist/server/middleware/error-handler.js +30 -4
- package/dist/server/middleware/index.d.ts +1 -1
- package/dist/server/middleware/index.js +1 -1
- package/dist/server/mobile/album.d.ts +46 -0
- package/dist/server/mobile/album.js +144 -0
- package/dist/server/mobile/assets/app.js +3036 -0
- package/dist/server/mobile/assets/emoji-data.js +508 -0
- package/dist/server/mobile/assets/icon-192.png +0 -0
- package/dist/server/mobile/assets/icon-512.png +0 -0
- package/dist/server/mobile/assets/icon-96.png +0 -0
- package/dist/server/mobile/assets/icon.svg +12 -0
- package/dist/server/mobile/assets/index.html +261 -0
- package/dist/server/mobile/assets/manifest.webmanifest +37 -0
- package/dist/server/mobile/assets/styles.css +831 -0
- package/dist/server/mobile/assets/sw.js +149 -0
- package/dist/server/mobile/chat-extras.d.ts +9 -0
- package/dist/server/mobile/chat-extras.js +24 -0
- package/dist/server/mobile/index.d.ts +22 -0
- package/dist/server/mobile/index.js +287 -0
- package/dist/server/mobile/link-preview.d.ts +24 -0
- package/dist/server/mobile/link-preview.js +139 -0
- package/dist/server/mobile/push.d.ts +38 -0
- package/dist/server/mobile/push.js +190 -0
- package/dist/server/mobile/status.d.ts +23 -0
- package/dist/server/mobile/status.js +107 -0
- package/dist/server/mobile/telegram-forward.d.ts +14 -0
- package/dist/server/mobile/telegram-forward.js +32 -0
- package/dist/server/mobile/voice-note.d.ts +54 -0
- package/dist/server/mobile/voice-note.js +305 -0
- package/dist/server/origin-check.d.ts +4 -5
- package/dist/server/origin-check.js +43 -8
- package/dist/server/routes/canvas.d.ts +7 -1
- package/dist/server/routes/canvas.js +138 -24
- package/dist/server/routes/chat.js +340 -203
- package/dist/server/routes/cognition.d.ts +3 -0
- package/dist/server/routes/cognition.js +75 -0
- package/dist/server/routes/health.js +93 -81
- package/dist/server/routes/index.d.ts +5 -1
- package/dist/server/routes/index.js +5 -1
- package/dist/server/routes/lessons.d.ts +13 -0
- package/dist/server/routes/lessons.js +111 -0
- package/dist/server/routes/memory.d.ts +12 -0
- package/dist/server/routes/memory.js +191 -131
- package/dist/server/routes/runs.d.ts +9 -0
- package/dist/server/routes/runs.js +50 -0
- package/dist/server/routes/sessions.js +8 -1
- package/dist/server/routes/tools.js +93 -74
- package/dist/server/routes/webhooks.js +56 -46
- package/dist/server/tunnel-manager.js +21 -1
- package/dist/server/types.d.ts +25 -1
- package/dist/server/webhook-agent-queue.d.ts +12 -0
- package/dist/server/webhook-agent-queue.js +58 -0
- package/dist/server/websocket/cognition-bridge.d.ts +13 -0
- package/dist/server/websocket/cognition-bridge.js +334 -0
- package/dist/server/websocket/confirmation-bridge.d.ts +22 -0
- package/dist/server/websocket/confirmation-bridge.js +178 -0
- package/dist/server/websocket/desktop-handler.d.ts +17 -0
- package/dist/server/websocket/desktop-handler.js +177 -16
- package/dist/server/websocket/handler.d.ts +123 -1
- package/dist/server/websocket/handler.js +852 -67
- package/dist/server/websocket/index.d.ts +2 -1
- package/dist/server/websocket/index.js +2 -1
- package/dist/server/websocket/peer-rpc.d.ts +1 -1
- package/dist/server/websocket/peer-rpc.js +25 -3
- package/dist/services/prompt-builder.d.ts +47 -2
- package/dist/services/prompt-builder.js +310 -99
- package/dist/sessions/timeline-snapshot.d.ts +35 -0
- package/dist/sessions/timeline-snapshot.js +144 -0
- package/dist/sessions/timeline.d.ts +33 -0
- package/dist/sessions/timeline.js +85 -0
- package/dist/shared/context-optimization-metadata.d.ts +29 -0
- package/dist/shared/context-optimization-metadata.js +73 -0
- package/dist/shared/engine-types.d.ts +26 -0
- package/dist/skills/bash-injection.d.ts +2 -2
- package/dist/skills/bash-injection.js +9 -2
- package/dist/skills/bundled/code-explorer.skill.md +50 -0
- package/dist/skills/bundled/file-edit.skill.md +62 -0
- package/dist/skills/bundled/git-commit.skill.md +66 -0
- package/dist/skills/bundled/pubcommander-control/SKILL.md +33 -0
- package/dist/skills/bundled/pubcommander-control/agents/openai.yaml +4 -0
- package/dist/skills/bundled/typescript-expert.skill.md +21 -0
- package/dist/skills/bundled/weather.skill.md +48 -0
- package/dist/skills/bundled/web-app-testing.skill.md +71 -0
- package/dist/skills/bundled/web-search.skill.md +56 -0
- package/dist/skills/hub.js +52 -30
- package/dist/skills/index.d.ts +6 -3
- package/dist/skills/index.js +19 -4
- package/dist/skills/parser.js +2 -0
- package/dist/skills/registry.d.ts +52 -0
- package/dist/skills/registry.js +291 -14
- package/dist/skills/skill-exchange.d.ts +61 -0
- package/dist/skills/skill-exchange.js +523 -0
- package/dist/skills/skill-importer.d.ts +2 -2
- package/dist/skills/skill-importer.js +76 -17
- package/dist/skills/skill-registry.js +3 -2
- package/dist/skills/skill-signing.d.ts +20 -0
- package/dist/skills/skill-signing.js +106 -0
- package/dist/skills/skill-sources.d.ts +3 -2
- package/dist/skills/skill-sources.js +5 -4
- package/dist/skills/types.d.ts +4 -0
- package/dist/spec/spec-store.js +7 -6
- package/dist/speculative/shadow-workspace.d.ts +79 -0
- package/dist/speculative/shadow-workspace.js +500 -0
- package/dist/talk-mode/index.d.ts +4 -4
- package/dist/talk-mode/index.js +3 -3
- package/dist/talk-mode/providers/elevenlabs-client.d.ts +48 -0
- package/dist/talk-mode/providers/elevenlabs-client.js +117 -0
- package/dist/talk-mode/providers/elevenlabs.js +12 -23
- package/dist/talk-mode/providers/index.d.ts +3 -1
- package/dist/talk-mode/providers/index.js +2 -0
- package/dist/talk-mode/providers/pocket-tts.d.ts +88 -0
- package/dist/talk-mode/providers/pocket-tts.js +334 -0
- package/dist/talk-mode/providers/voicebox-tts.d.ts +24 -0
- package/dist/talk-mode/providers/voicebox-tts.js +120 -0
- package/dist/talk-mode/types.d.ts +39 -1
- package/dist/tasks/background-tasks.js +22 -5
- package/dist/telemetry/otel-tracer.js +5 -2
- package/dist/templates/design-system-apply.d.ts +23 -0
- package/dist/templates/design-system-apply.js +100 -0
- package/dist/templates/project-scaffolding.d.ts +2 -0
- package/dist/templates/project-scaffolding.js +616 -1
- package/dist/themes/theme-manager.js +9 -6
- package/dist/themes/theme-schema.d.ts +46 -46
- package/dist/tools/advanced/multi-file-editor.js +3 -1
- package/dist/tools/advanced/operation-history.js +2 -1
- package/dist/tools/app-server-tool.d.ts +66 -0
- package/dist/tools/app-server-tool.js +423 -0
- package/dist/tools/apply-patch.d.ts +31 -1
- package/dist/tools/apply-patch.js +214 -19
- package/dist/tools/authored-tools-manifest-2.d.ts +17 -0
- package/dist/tools/authored-tools-manifest-2.js +133 -0
- package/dist/tools/authored-tools-manifest.d.ts +15 -0
- package/dist/tools/authored-tools-manifest.js +13 -0
- package/dist/tools/bash/bash-tool.d.ts +36 -3
- package/dist/tools/bash/bash-tool.js +240 -100
- package/dist/tools/bash/command-validator.d.ts +1 -1
- package/dist/tools/bash/command-validator.js +115 -40
- package/dist/tools/bash/execution-policy.d.ts +42 -0
- package/dist/tools/bash/execution-policy.js +278 -0
- package/dist/tools/bash/security-patterns.js +43 -5
- package/dist/tools/bash/streaming-executor.d.ts +1 -1
- package/dist/tools/bash/streaming-executor.js +124 -18
- package/dist/tools/build-project-tool.d.ts +25 -0
- package/dist/tools/build-project-tool.js +30 -0
- package/dist/tools/bundle-analyze-tool.d.ts +28 -0
- package/dist/tools/bundle-analyze-tool.js +39 -0
- package/dist/tools/code-exec-tool.d.ts +55 -23
- package/dist/tools/code-exec-tool.js +598 -111
- package/dist/tools/code-explorer-tool.d.ts +1 -1
- package/dist/tools/code-explorer-tool.js +25 -1
- package/dist/tools/code-review.js +5 -0
- package/dist/tools/code-stats-tool.d.ts +43 -0
- package/dist/tools/code-stats-tool.js +70 -0
- package/dist/tools/codebase-replace-tool.js +2 -2
- package/dist/tools/comfy-recipe-tool.d.ts +37 -0
- package/dist/tools/comfy-recipe-tool.js +693 -0
- package/dist/tools/community-search.d.ts +93 -0
- package/dist/tools/community-search.js +334 -0
- package/dist/tools/computer-control-harness.js +5 -2
- package/dist/tools/computer-control-tool.d.ts +8 -0
- package/dist/tools/computer-control-tool.js +71 -26
- package/dist/tools/context-expand-tool.d.ts +19 -0
- package/dist/tools/context-expand-tool.js +132 -0
- package/dist/tools/csv/csv-parse.d.ts +19 -0
- package/dist/tools/csv/csv-parse.js +132 -0
- package/dist/tools/csv/csv-wiring.d.ts +8 -0
- package/dist/tools/csv/csv-wiring.js +9 -0
- package/dist/tools/csv-analyze-tool.d.ts +11 -0
- package/dist/tools/csv-analyze-tool.js +114 -0
- package/dist/tools/csv-preview-tool.d.ts +34 -0
- package/dist/tools/csv-preview-tool.js +69 -0
- package/dist/tools/db-migration.js +11 -3
- package/dist/tools/deep-research-tool.d.ts +68 -0
- package/dist/tools/deep-research-tool.js +257 -0
- package/dist/tools/deferred-schema-state.d.ts +19 -0
- package/dist/tools/deferred-schema-state.js +33 -0
- package/dist/tools/dep-inspect-tool.d.ts +32 -0
- package/dist/tools/dep-inspect-tool.js +74 -0
- package/dist/tools/design-system-tool.d.ts +10 -0
- package/dist/tools/design-system-tool.js +95 -0
- package/dist/tools/device-tool.d.ts +2 -1
- package/dist/tools/device-tool.js +21 -0
- package/dist/tools/diagram-tool.js +8 -2
- package/dist/tools/diff-files-tool.d.ts +28 -0
- package/dist/tools/diff-files-tool.js +49 -0
- package/dist/tools/enhanced-search.js +32 -16
- package/dist/tools/env-doctor-tool.d.ts +30 -0
- package/dist/tools/env-doctor-tool.js +54 -0
- package/dist/tools/execute-code-rpc-invoker.js +2 -2
- package/dist/tools/execute-code-runner.d.ts +21 -0
- package/dist/tools/execute-code-runner.js +117 -8
- package/dist/tools/extension-forge-tool.d.ts +29 -0
- package/dist/tools/extension-forge-tool.js +288 -0
- package/dist/tools/fetch-tool.js +7 -3
- package/dist/tools/file-search-tool.d.ts +41 -0
- package/dist/tools/file-search-tool.js +99 -0
- package/dist/tools/format-project-tool.d.ts +28 -0
- package/dist/tools/format-project-tool.js +45 -0
- package/dist/tools/git-summary-tool.d.ts +36 -0
- package/dist/tools/git-summary-tool.js +65 -0
- package/dist/tools/git-tool.js +16 -4
- package/dist/tools/gpu-avatar-delivery.d.ts +16 -0
- package/dist/tools/gpu-avatar-delivery.js +67 -0
- package/dist/tools/gpu-media-worker.d.ts +96 -0
- package/dist/tools/gpu-media-worker.js +363 -0
- package/dist/tools/gui-tool.js +92 -13
- package/dist/tools/http-probe-tool.d.ts +25 -0
- package/dist/tools/http-probe-tool.js +40 -0
- package/dist/tools/image-tool.js +29 -16
- package/dist/tools/index.d.ts +6 -1
- package/dist/tools/index.js +5 -0
- package/dist/tools/interactive-bash.d.ts +29 -1
- package/dist/tools/interactive-bash.js +141 -21
- package/dist/tools/json-query-tool.d.ts +30 -0
- package/dist/tools/json-query-tool.js +49 -0
- package/dist/tools/license-check-tool.d.ts +22 -0
- package/dist/tools/license-check-tool.js +43 -0
- package/dist/tools/lint-project-tool.d.ts +52 -0
- package/dist/tools/lint-project-tool.js +143 -0
- package/dist/tools/local-binary-launch.d.ts +14 -0
- package/dist/tools/local-binary-launch.js +63 -0
- package/dist/tools/lsp-navigation-tools.d.ts +87 -0
- package/dist/tools/lsp-navigation-tools.js +470 -0
- package/dist/tools/markdown-convert.d.ts +51 -0
- package/dist/tools/markdown-convert.js +159 -0
- package/dist/tools/media-generation-tool.d.ts +90 -1
- package/dist/tools/media-generation-tool.js +1553 -11
- package/dist/tools/meeting-notes-tool.d.ts +25 -0
- package/dist/tools/meeting-notes-tool.js +240 -0
- package/dist/tools/merge-conflict-tool.js +1 -1
- package/dist/tools/metadata.d.ts +7 -1
- package/dist/tools/metadata.js +823 -13
- package/dist/tools/mixture-of-agents-tool.d.ts +7 -0
- package/dist/tools/mixture-of-agents-tool.js +230 -31
- package/dist/tools/multi-edit.js +42 -18
- package/dist/tools/ocr-tool.d.ts +43 -0
- package/dist/tools/ocr-tool.js +24 -18
- package/dist/tools/omission-placeholder-detector.js +12 -6
- package/dist/tools/paper-qa-tool.d.ts +73 -0
- package/dist/tools/paper-qa-tool.js +313 -0
- package/dist/tools/peer-chain-tool.js +4 -1
- package/dist/tools/peer-delegate-tool.d.ts +2 -0
- package/dist/tools/peer-delegate-tool.js +11 -1
- package/dist/tools/port-check-tool.d.ts +31 -0
- package/dist/tools/port-check-tool.js +25 -0
- package/dist/tools/project-map-tool.d.ts +39 -0
- package/dist/tools/project-map-tool.js +128 -0
- package/dist/tools/register-tool-handler.d.ts +2 -2
- package/dist/tools/register-tool-handler.js +7 -4
- package/dist/tools/registry/advanced-tools.js +1 -1
- package/dist/tools/registry/attention-tools.d.ts +3 -3
- package/dist/tools/registry/attention-tools.js +14 -10
- package/dist/tools/registry/authored-extra-tools.d.ts +20 -0
- package/dist/tools/registry/authored-extra-tools.js +147 -0
- package/dist/tools/registry/bash-tools.d.ts +2 -2
- package/dist/tools/registry/bash-tools.js +7 -3
- package/dist/tools/registry/browser-operator-tools.d.ts +1 -1
- package/dist/tools/registry/browser-operator-tools.js +17 -3
- package/dist/tools/registry/browser-tools.d.ts +1 -1
- package/dist/tools/registry/browser-tools.js +38 -33
- package/dist/tools/registry/code-explorer-tools.js +6 -1
- package/dist/tools/registry/comfy-recipe-tools.d.ts +2 -0
- package/dist/tools/registry/comfy-recipe-tools.js +5 -0
- package/dist/tools/registry/context-expand-tools.d.ts +3 -0
- package/dist/tools/registry/context-expand-tools.js +6 -0
- package/dist/tools/registry/csv-tools.d.ts +12 -0
- package/dist/tools/registry/csv-tools.js +62 -0
- package/dist/tools/registry/delegate-agent-tools.d.ts +64 -0
- package/dist/tools/registry/delegate-agent-tools.js +206 -0
- package/dist/tools/registry/design-tools.d.ts +12 -0
- package/dist/tools/registry/design-tools.js +80 -0
- package/dist/tools/registry/fleet-tools.js +6 -0
- package/dist/tools/registry/index.d.ts +25 -5
- package/dist/tools/registry/index.js +80 -6
- package/dist/tools/registry/interactive-adapters.d.ts +37 -0
- package/dist/tools/registry/interactive-adapters.js +116 -0
- package/dist/tools/registry/lsp-tools.d.ts +3 -3
- package/dist/tools/registry/lsp-tools.js +9 -3
- package/dist/tools/registry/meeting-tools.d.ts +3 -0
- package/dist/tools/registry/meeting-tools.js +6 -0
- package/dist/tools/registry/memory-tools.js +32 -20
- package/dist/tools/registry/misc-tools.d.ts +1 -1
- package/dist/tools/registry/misc-tools.js +7 -4
- package/dist/tools/registry/moa-tools.js +13 -0
- package/dist/tools/registry/multimodal-tools.d.ts +73 -1
- package/dist/tools/registry/multimodal-tools.js +581 -4
- package/dist/tools/registry/process-tools.d.ts +16 -0
- package/dist/tools/registry/process-tools.js +136 -1
- package/dist/tools/registry/remind-tools.d.ts +23 -0
- package/dist/tools/registry/remind-tools.js +120 -0
- package/dist/tools/registry/research-tools.d.ts +17 -0
- package/dist/tools/registry/research-tools.js +21 -0
- package/dist/tools/registry/search-tools.d.ts +6 -6
- package/dist/tools/registry/search-tools.js +30 -17
- package/dist/tools/registry/secrets-tools.d.ts +33 -0
- package/dist/tools/registry/secrets-tools.js +71 -0
- package/dist/tools/registry/self-describe-tools.d.ts +23 -0
- package/dist/tools/registry/self-describe-tools.js +156 -0
- package/dist/tools/registry/self-evolution-tools.d.ts +13 -0
- package/dist/tools/registry/self-evolution-tools.js +97 -0
- package/dist/tools/registry/text-editor-tools.d.ts +26 -4
- package/dist/tools/registry/text-editor-tools.js +102 -6
- package/dist/tools/registry/tool-alias-map.d.ts +8 -0
- package/dist/tools/registry/tool-alias-map.js +47 -0
- package/dist/tools/registry/tool-aliases.d.ts +3 -4
- package/dist/tools/registry/tool-aliases.js +12 -48
- package/dist/tools/registry/types.d.ts +5 -0
- package/dist/tools/registry/verify-tools.d.ts +50 -0
- package/dist/tools/registry/verify-tools.js +136 -0
- package/dist/tools/registry/video-studio-tools.d.ts +13 -0
- package/dist/tools/registry/video-studio-tools.js +21 -0
- package/dist/tools/registry/vision-tools.d.ts +15 -1
- package/dist/tools/registry/vision-tools.js +252 -27
- package/dist/tools/registry/web-test-tool.d.ts +66 -0
- package/dist/tools/registry/web-test-tool.js +321 -0
- package/dist/tools/registry/web-tools.d.ts +43 -0
- package/dist/tools/registry/web-tools.js +281 -1
- package/dist/tools/review-gate-helper.d.ts +44 -0
- package/dist/tools/review-gate-helper.js +110 -0
- package/dist/tools/route-peer-tool.js +62 -11
- package/dist/tools/sbom-generate-tool.d.ts +22 -0
- package/dist/tools/sbom-generate-tool.js +41 -0
- package/dist/tools/scaffold-app-tool.d.ts +48 -0
- package/dist/tools/scaffold-app-tool.js +144 -0
- package/dist/tools/screenshot-tool.js +5 -2
- package/dist/tools/search.d.ts +17 -0
- package/dist/tools/search.js +31 -8
- package/dist/tools/self-describe.d.ts +73 -0
- package/dist/tools/self-describe.js +298 -0
- package/dist/tools/stock-quote.d.ts +67 -0
- package/dist/tools/stock-quote.js +645 -0
- package/dist/tools/submit-plan-tool.js +1 -1
- package/dist/tools/test-runner-tool.d.ts +38 -0
- package/dist/tools/test-runner-tool.js +96 -0
- package/dist/tools/text-editor.js +91 -8
- package/dist/tools/text-to-speech-tool.d.ts +1 -1
- package/dist/tools/text-to-speech-tool.js +48 -2
- package/dist/tools/todo-scan-tool.d.ts +39 -0
- package/dist/tools/todo-scan-tool.js +53 -0
- package/dist/tools/tool-manager.js +8 -0
- package/dist/tools/tool-search.js +11 -3
- package/dist/tools/tool-selector.d.ts +7 -0
- package/dist/tools/tool-selector.js +27 -13
- package/dist/tools/tools-md-generator.js +2 -2
- package/dist/tools/types.d.ts +16 -0
- package/dist/tools/types.js +5 -1
- package/dist/tools/video/approved-media-source.d.ts +8 -0
- package/dist/tools/video/approved-media-source.js +59 -0
- package/dist/tools/video/book-manuscript-source.d.ts +49 -0
- package/dist/tools/video/book-manuscript-source.js +263 -0
- package/dist/tools/video/character-in-location.d.ts +42 -0
- package/dist/tools/video/character-in-location.js +161 -0
- package/dist/tools/video/cinematic-trailer-plan.d.ts +203 -0
- package/dist/tools/video/cinematic-trailer-plan.js +498 -0
- package/dist/tools/video/cloud-understand.d.ts +91 -0
- package/dist/tools/video/cloud-understand.js +214 -0
- package/dist/tools/video/comfy-client.d.ts +38 -0
- package/dist/tools/video/comfy-client.js +227 -0
- package/dist/tools/video/comfy-workflow-template.d.ts +70 -0
- package/dist/tools/video/comfy-workflow-template.js +194 -0
- package/dist/tools/video/describe-frame.d.ts +36 -0
- package/dist/tools/video/describe-frame.js +68 -0
- package/dist/tools/video/film-assemble.d.ts +234 -0
- package/dist/tools/video/film-assemble.js +959 -0
- package/dist/tools/video/film-project.d.ts +152 -0
- package/dist/tools/video/film-project.js +312 -0
- package/dist/tools/video/frame-dedup.d.ts +46 -0
- package/dist/tools/video/frame-dedup.js +110 -0
- package/dist/tools/video/frame-sample.d.ts +72 -0
- package/dist/tools/video/frame-sample.js +238 -0
- package/dist/tools/video/google-flow-driver.d.ts +131 -0
- package/dist/tools/video/google-flow-driver.js +312 -0
- package/dist/tools/video/google-flow-handoff.d.ts +75 -0
- package/dist/tools/video/google-flow-handoff.js +121 -0
- package/dist/tools/video/google-flow-plan-export.d.ts +21 -0
- package/dist/tools/video/google-flow-plan-export.js +123 -0
- package/dist/tools/video/google-flow-result-import.d.ts +92 -0
- package/dist/tools/video/google-flow-result-import.js +297 -0
- package/dist/tools/video/hybrid-video-router.d.ts +34 -0
- package/dist/tools/video/hybrid-video-router.js +113 -0
- package/dist/tools/video/localized-media.d.ts +50 -0
- package/dist/tools/video/localized-media.js +128 -0
- package/dist/tools/video/long-form-plan.d.ts +37 -0
- package/dist/tools/video/long-form-plan.js +83 -0
- package/dist/tools/video/long-form-production.d.ts +49 -0
- package/dist/tools/video/long-form-production.js +168 -0
- package/dist/tools/video/long-transcribe.d.ts +94 -0
- package/dist/tools/video/long-transcribe.js +206 -0
- package/dist/tools/video/media-fetch.d.ts +94 -0
- package/dist/tools/video/media-fetch.js +311 -0
- package/dist/tools/video/mermaid-render.d.ts +34 -0
- package/dist/tools/video/mermaid-render.js +127 -0
- package/dist/tools/video/narration.d.ts +96 -0
- package/dist/tools/video/narration.js +505 -0
- package/dist/tools/video/native-fashion-defects.d.ts +27 -0
- package/dist/tools/video/native-fashion-defects.js +80 -0
- package/dist/tools/video/scene-render.d.ts +108 -0
- package/dist/tools/video/scene-render.js +418 -0
- package/dist/tools/video/subtitles.d.ts +49 -0
- package/dist/tools/video/subtitles.js +116 -0
- package/dist/tools/video/video-ckg.d.ts +123 -0
- package/dist/tools/video/video-ckg.js +188 -0
- package/dist/tools/video/video-research-card.d.ts +58 -0
- package/dist/tools/video/video-research-card.js +468 -0
- package/dist/tools/video/video-understanding.d.ts +159 -0
- package/dist/tools/video/video-understanding.js +534 -0
- package/dist/tools/video/visual-gate-report.d.ts +139 -0
- package/dist/tools/video/visual-gate-report.js +379 -0
- package/dist/tools/video/voice-rights-registry.d.ts +13 -0
- package/dist/tools/video/voice-rights-registry.js +142 -0
- package/dist/tools/video/youtube-captions.d.ts +51 -0
- package/dist/tools/video/youtube-captions.js +102 -0
- package/dist/tools/video/youtube-master-quality.d.ts +163 -0
- package/dist/tools/video/youtube-master-quality.js +379 -0
- package/dist/tools/video/youtube-storyboard.d.ts +43 -0
- package/dist/tools/video/youtube-storyboard.js +194 -0
- package/dist/tools/video-flow-handoff-tool.d.ts +181 -0
- package/dist/tools/video-flow-handoff-tool.js +261 -0
- package/dist/tools/video-long-form-plan-tool.d.ts +31 -0
- package/dist/tools/video-long-form-plan-tool.js +87 -0
- package/dist/tools/video-quality-gate-tool.d.ts +97 -0
- package/dist/tools/video-quality-gate-tool.js +189 -0
- package/dist/tools/video-route-tool.d.ts +128 -0
- package/dist/tools/video-route-tool.js +126 -0
- package/dist/tools/video-studio-tool-helpers.d.ts +22 -0
- package/dist/tools/video-studio-tool-helpers.js +128 -0
- package/dist/tools/video-trailer-plan-tool.d.ts +60 -0
- package/dist/tools/video-trailer-plan-tool.js +103 -0
- package/dist/tools/vision/blender-render.d.ts +76 -0
- package/dist/tools/vision/blender-render.js +121 -0
- package/dist/tools/vision/image-processor.d.ts +1 -0
- package/dist/tools/vision/image-processor.js +8 -1
- package/dist/tools/vision/load-sharp.d.ts +53 -0
- package/dist/tools/vision/load-sharp.js +48 -0
- package/dist/tools/vision/mean-luma.d.ts +4 -0
- package/dist/tools/vision/mean-luma.js +189 -0
- package/dist/tools/vision/object-detection.d.ts +90 -0
- package/dist/tools/vision/object-detection.js +403 -0
- package/dist/tools/vision/vision-analysis.js +2 -1
- package/dist/tools/weather.d.ts +33 -0
- package/dist/tools/weather.js +183 -0
- package/dist/tools/web-scrape-tool.d.ts +63 -0
- package/dist/tools/web-scrape-tool.js +318 -0
- package/dist/tools/web-search.d.ts +67 -6
- package/dist/tools/web-search.js +231 -68
- package/dist/tools/workspace-tools.d.ts +39 -0
- package/dist/tools/workspace-tools.js +347 -0
- package/dist/tracks/track-manager.js +9 -8
- package/dist/triggers/webhook-trigger.js +10 -18
- package/dist/ui/components/ChatHistory.js +12 -0
- package/dist/ui/components/ChatInterface.js +6 -2
- package/dist/ui/components/FileAutocomplete.d.ts +6 -1
- package/dist/ui/components/FileAutocomplete.js +136 -76
- package/dist/ui/components/FuzzyPicker.d.ts +5 -0
- package/dist/ui/components/FuzzyPicker.js +1 -1
- package/dist/ui/http-server/server.js +2 -2
- package/dist/undo/checkpoint-manager.d.ts +3 -0
- package/dist/undo/checkpoint-manager.js +6 -1
- package/dist/utils/approval-pattern-tracker.js +5 -13
- package/dist/utils/ascii-banner.d.ts +1 -1
- package/dist/utils/ascii-banner.js +1 -1
- package/dist/utils/atomic-write.d.ts +77 -0
- package/dist/utils/atomic-write.js +530 -0
- package/dist/utils/audio-player.d.ts +1 -0
- package/dist/utils/audio-player.js +7 -3
- package/dist/utils/autonomy-manager.js +12 -3
- package/dist/utils/command-exists.d.ts +14 -0
- package/dist/utils/command-exists.js +43 -0
- package/dist/utils/config-validation/schema.d.ts +13 -13
- package/dist/utils/config-validation/schema.js +33 -1
- package/dist/utils/confirmation-service.d.ts +60 -1
- package/dist/utils/confirmation-service.js +204 -41
- package/dist/utils/cost-tracker.d.ts +66 -1
- package/dist/utils/cost-tracker.js +100 -17
- package/dist/utils/history-manager.js +6 -7
- package/dist/utils/init-project.js +17 -13
- package/dist/utils/input-validation/index.d.ts +16 -16
- package/dist/utils/installation-id.js +7 -22
- package/dist/utils/interactive-setup.js +7 -12
- package/dist/utils/json-salvage.d.ts +22 -0
- package/dist/utils/json-salvage.js +91 -0
- package/dist/utils/llm-retry.js +3 -0
- package/dist/utils/logger.d.ts +1 -0
- package/dist/utils/logger.js +16 -5
- package/dist/utils/model-router.js +8 -12
- package/dist/utils/model-utils.js +14 -0
- package/dist/utils/output-sanitizer.d.ts +4 -8
- package/dist/utils/output-sanitizer.js +10 -10
- package/dist/utils/output-schema-validator.d.ts +7 -0
- package/dist/utils/output-schema-validator.js +25 -1
- package/dist/utils/response-cache.js +11 -22
- package/dist/utils/ripgrep-path.d.ts +11 -0
- package/dist/utils/ripgrep-path.js +60 -0
- package/dist/utils/semantic-cache.js +4 -7
- package/dist/utils/settings-manager.d.ts +27 -4
- package/dist/utils/settings-manager.js +51 -39
- package/dist/utils/shell-completions.js +25 -34
- package/dist/utils/shell-configuration.d.ts +39 -0
- package/dist/utils/shell-configuration.js +106 -0
- package/dist/utils/stream-stall-guard.d.ts +39 -0
- package/dist/utils/stream-stall-guard.js +123 -0
- package/dist/utils/subprocess-env.d.ts +15 -0
- package/dist/utils/subprocess-env.js +112 -0
- package/dist/utils/telegram-api-base.d.ts +9 -0
- package/dist/utils/telegram-api-base.js +15 -0
- package/dist/utils/telemetry-config.js +16 -13
- package/dist/utils/update-notifier.js +5 -10
- package/dist/utils/validators.js +1 -2
- package/dist/versioning/config-migrator.js +3 -2
- package/dist/versioning/migration-manager.js +5 -4
- package/dist/versioning/version-detector.js +2 -1
- package/dist/vision-train/assets.d.ts +37 -0
- package/dist/vision-train/assets.js +97 -0
- package/dist/vision-train/ckg-publish.d.ts +26 -0
- package/dist/vision-train/ckg-publish.js +36 -0
- package/dist/vision-train/coco-to-labels.d.ts +63 -0
- package/dist/vision-train/coco-to-labels.js +63 -0
- package/dist/vision-train/curriculum.d.ts +29 -0
- package/dist/vision-train/curriculum.js +49 -0
- package/dist/vision-train/engine.d.ts +56 -0
- package/dist/vision-train/engine.js +55 -0
- package/dist/vision-train/report.d.ts +15 -0
- package/dist/vision-train/report.js +72 -0
- package/dist/vision-train/scorer.d.ts +67 -0
- package/dist/vision-train/scorer.js +114 -0
- package/dist/vision-train/yolo-labels.d.ts +13 -0
- package/dist/vision-train/yolo-labels.js +66 -0
- package/dist/voice/elevenlabs-voice.d.ts +53 -0
- package/dist/voice/elevenlabs-voice.js +412 -0
- package/dist/voice/kyutai-local-voice.d.ts +33 -0
- package/dist/voice/kyutai-local-voice.js +198 -0
- package/dist/voice/local-tts.d.ts +106 -3
- package/dist/voice/local-tts.js +672 -35
- package/dist/voice/local-whisper.d.ts +11 -0
- package/dist/voice/local-whisper.js +18 -2
- package/dist/voice/pcm-edges.d.ts +43 -0
- package/dist/voice/pcm-edges.js +210 -0
- package/dist/voice/perceived-latency-benchmark.d.ts +56 -0
- package/dist/voice/perceived-latency-benchmark.js +218 -0
- package/dist/voice/tts-bank.d.ts +72 -0
- package/dist/voice/tts-bank.js +172 -0
- package/dist/voice/tts-latency-benchmark.d.ts +36 -0
- package/dist/voice/tts-latency-benchmark.js +76 -0
- package/dist/voice/tts-volume.d.ts +86 -0
- package/dist/voice/tts-volume.js +378 -0
- package/dist/voice/two-speed-voice.d.ts +19 -0
- package/dist/voice/two-speed-voice.js +40 -0
- package/dist/voice/voice-to-code.js +1 -1
- package/dist/voice/voicebox-tts.d.ts +150 -0
- package/dist/voice/voicebox-tts.js +669 -0
- package/dist/voice/wake-word.d.ts +2 -0
- package/dist/voice/wake-word.js +30 -10
- package/dist/webhooks/webhook-manager.js +10 -18
- package/dist/widgets/auto-widget.d.ts +27 -0
- package/dist/widgets/auto-widget.js +111 -0
- package/dist/widgets/canvas-publish.d.ts +15 -0
- package/dist/widgets/canvas-publish.js +39 -0
- package/dist/widgets/curated/news.d.ts +2 -0
- package/dist/widgets/curated/news.js +46 -0
- package/dist/widgets/curated/stock.d.ts +1 -0
- package/dist/widgets/curated/stock.js +87 -0
- package/dist/widgets/curated/weather.d.ts +2 -0
- package/dist/widgets/curated/weather.js +93 -0
- package/dist/widgets/template-engine.d.ts +19 -0
- package/dist/widgets/template-engine.js +134 -0
- package/dist/widgets/widget-engine.d.ts +24 -0
- package/dist/widgets/widget-engine.js +153 -0
- package/dist/widgets/widget-gate.d.ts +19 -0
- package/dist/widgets/widget-gate.js +144 -0
- package/dist/widgets/widget-image-renderer.d.ts +4 -0
- package/dist/widgets/widget-image-renderer.js +164 -0
- package/dist/widgets/widget-matcher.d.ts +48 -0
- package/dist/widgets/widget-matcher.js +109 -0
- package/dist/widgets/widget-proposer.d.ts +17 -0
- package/dist/widgets/widget-proposer.js +75 -0
- package/dist/widgets/widget-registry.d.ts +36 -0
- package/dist/widgets/widget-registry.js +231 -0
- package/dist/widgets/widget-types.d.ts +100 -0
- package/dist/widgets/widget-types.js +17 -0
- package/dist/wizard/environment-detection.d.ts +67 -0
- package/dist/wizard/environment-detection.js +210 -0
- package/dist/wizard/onboarding.d.ts +21 -1
- package/dist/wizard/onboarding.js +202 -27
- package/dist/workflows/state-manager.js +8 -2
- package/dist/workspace/workspace-config.d.ts +37 -0
- package/dist/workspace/workspace-config.js +199 -0
- package/dist/workspace/workspace-isolation.d.ts +19 -0
- package/dist/workspace/workspace-isolation.js +124 -39
- package/dist/workspace/workspace-manager.js +19 -14
- package/examples/claude_desktop_config.json +8 -0
- package/package.json +75 -31
- package/.codebuddy/README.md +0 -65
- package/dist/agent/middleware/learning-first-middleware.d.ts +0 -79
- package/dist/agent/middleware/learning-first-middleware.js +0 -271
- package/dist/agent/middleware/tool-filter-middleware.d.ts +0 -45
- package/dist/agent/middleware/tool-filter-middleware.js +0 -122
- package/dist/codebuddy/tool-definitions/batch-tools.d.ts +0 -10
- package/dist/codebuddy/tool-definitions/batch-tools.js +0 -46
- package/dist/codebuddy/tool-definitions/graph-tools.d.ts +0 -13
- package/dist/codebuddy/tool-definitions/graph-tools.js +0 -78
- package/dist/plugins/code-explorer/CodeExplorerMCPClient.d.ts +0 -129
- package/dist/plugins/code-explorer/CodeExplorerMCPClient.js +0 -143
- package/dist/tools/registry/batch-tools.d.ts +0 -36
- package/dist/tools/registry/batch-tools.js +0 -135
- package/dist/tools/registry/graph-tools.d.ts +0 -45
- package/dist/tools/registry/graph-tools.js +0 -283
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
|
+
import os from 'os';
|
|
2
3
|
import path from 'path';
|
|
4
|
+
import { randomUUID } from 'crypto';
|
|
3
5
|
import { buildBrowserOperatorHarnessBundle } from './browser-operator-harness.js';
|
|
4
6
|
import { logger } from '../utils/logger.js';
|
|
5
7
|
import { ConfirmationService } from '../utils/confirmation-service.js';
|
|
8
|
+
import { getDataRedactionEngine } from '../security/data-redaction.js';
|
|
6
9
|
const INIT_TIMEOUT_MS = 30_000;
|
|
7
10
|
const NAVIGATION_TIMEOUT_MS = 60_000;
|
|
8
11
|
const ACTION_TIMEOUT_MS = 45_000;
|
|
9
12
|
const EXTRACT_TIMEOUT_MS = 60_000;
|
|
10
13
|
const WATCHDOG_INTERVAL_MS = 3_000;
|
|
14
|
+
export const BROWSER_OPERATOR_PROFILE_MARKER = '.codebuddy-browser-operator-profile.json';
|
|
15
|
+
export const BROWSER_OPERATOR_PROFILE_LOCK = '.codebuddy-browser-operator.lock';
|
|
16
|
+
const PROFILE_OWNER = 'code-buddy-browser-operator';
|
|
17
|
+
const PROFILE_MARKER_SCHEMA_VERSION = 1;
|
|
18
|
+
const PROFILE_LOCK_SCHEMA_VERSION = 1;
|
|
19
|
+
const PROFILE_LOCK_STALE_MS = 120_000;
|
|
20
|
+
const PROFILE_LOCK_UPDATE_MS = 15_000;
|
|
21
|
+
const MAX_PROFILE_CONTROL_FILE_BYTES = 4_096;
|
|
11
22
|
const MUTATING_ACTIONS = new Set([
|
|
12
23
|
'act',
|
|
13
24
|
'click',
|
|
@@ -29,6 +40,41 @@ const MUTATING_ACTIONS = new Set([
|
|
|
29
40
|
'set_offline',
|
|
30
41
|
'set_geolocation',
|
|
31
42
|
]);
|
|
43
|
+
const TARGET_INSPECTION_ACTIONS = new Set([
|
|
44
|
+
'act',
|
|
45
|
+
'click',
|
|
46
|
+
'double_click',
|
|
47
|
+
'right_click',
|
|
48
|
+
'type',
|
|
49
|
+
'fill',
|
|
50
|
+
'select',
|
|
51
|
+
'press',
|
|
52
|
+
'hover',
|
|
53
|
+
'upload_files',
|
|
54
|
+
'download',
|
|
55
|
+
]);
|
|
56
|
+
const SENSITIVE_SEMANTIC_SIGNALS = [
|
|
57
|
+
{
|
|
58
|
+
reason: 'payment, purchase, or money movement',
|
|
59
|
+
pattern: /(?:\bcheckout\b|\bpay(?:ment| now)?\b|\bpurchase\b|\bplace order\b|\bcomplete order\b|\border total\b|\bcart total\b|\bamount due\b|\btotal (?:due|to pay)\b|\bbilling\b|\bcredit card\b|\bcard number\b|\bcvv\b|\btransfer (?:funds|money)\b|\bdonat(?:e|ion)\b|paiement|payer|achat|commander|total de la commande|montant à payer|carte bancaire|facturation|virement|faire un don)/i,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
reason: 'external message, publication, or submission',
|
|
63
|
+
pattern: /(?:\bsend\b|\bsubmit\b|\bpublish\b|\bpost (?:comment|message|reply)\b|\bshare\b|\bupload\b|\bsend email\b|\bmessage preview\b|\brecipient(?:s)?\b|envoyer|soumettre|publier|partager|téléverser|televerser|aperçu du message|apercu du message|destinataire|envoyer.*courriel)/i,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
reason: 'destructive or account-changing effect',
|
|
67
|
+
pattern: /(?:\bdelete\b|\bremove\b|\btrash\b|\bdestroy\b|\berase\b|\bpermanent(?:ly)?\b|\bcannot be undone\b|\bclose account\b|\bcancel (?:account|subscription|booking)\b|\bunsubscribe\b|\brevoke\b|\breset password\b|\bchange password\b|\bgrant permission\b|\binvite user\b|supprimer|effacer|détruire|detruire|irréversible|irreversible|fermer le compte|annuler l'abonnement|résilier|resilier|révoquer|revoquer|mot de passe|accorder.*autorisation|inviter)/i,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
reason: 'booking or binding reservation',
|
|
71
|
+
pattern: /(?:\bbook now\b|\bconfirm booking\b|\bconfirm reservation\b|\bschedule appointment\b|\bcheck[- ]?in\b|confirmer la réservation|confirmer la reservation|prendre rendez-vous|réserver maintenant|reserver maintenant)/i,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
reason: 'credential or highly sensitive form field',
|
|
75
|
+
pattern: /(?:\bpassword\b|\bpasscode\b|\bone[- ]time code\b|\botp\b|\bsocial security\b|\biban\b|\bprivate key\b|mot de passe|code de sécurité|code de securite)/i,
|
|
76
|
+
},
|
|
77
|
+
];
|
|
32
78
|
const BROWSER_ACTIONS = new Set([
|
|
33
79
|
'navigate',
|
|
34
80
|
'go_back',
|
|
@@ -78,13 +124,30 @@ export class SecurityCheckpointDetected extends Error {
|
|
|
78
124
|
this.name = 'SecurityCheckpointDetected';
|
|
79
125
|
}
|
|
80
126
|
}
|
|
127
|
+
export class BrowserOperatorStopped extends Error {
|
|
128
|
+
constructor() {
|
|
129
|
+
super('Browser Operator stopped by the local operator.');
|
|
130
|
+
this.name = 'BrowserOperatorStopped';
|
|
131
|
+
}
|
|
132
|
+
}
|
|
81
133
|
export class BrowserOperatorExecutor {
|
|
82
134
|
session;
|
|
135
|
+
options;
|
|
83
136
|
stagehand = null;
|
|
84
137
|
page = null;
|
|
85
138
|
isStopped = false;
|
|
86
|
-
|
|
139
|
+
stopListeners = new Set();
|
|
140
|
+
navigationRoutePattern = '**/*';
|
|
141
|
+
navigationRouteTargets = [];
|
|
142
|
+
pendingNavigationChecks = new Set();
|
|
143
|
+
navigationRouteHandler = null;
|
|
144
|
+
navigationGuardBrowser = null;
|
|
145
|
+
navigationViolation = null;
|
|
146
|
+
profileLock = null;
|
|
147
|
+
semanticTargetSelectors = new Map();
|
|
148
|
+
constructor(session, options = {}) {
|
|
87
149
|
this.session = session;
|
|
150
|
+
this.options = options;
|
|
88
151
|
}
|
|
89
152
|
/**
|
|
90
153
|
* Grant consent for the session.
|
|
@@ -99,7 +162,16 @@ export class BrowserOperatorExecutor {
|
|
|
99
162
|
* Stop the session execution.
|
|
100
163
|
*/
|
|
101
164
|
stop() {
|
|
165
|
+
if (this.isStopped)
|
|
166
|
+
return;
|
|
102
167
|
this.isStopped = true;
|
|
168
|
+
for (const listener of this.stopListeners)
|
|
169
|
+
listener();
|
|
170
|
+
this.stopListeners.clear();
|
|
171
|
+
// Closing the owned Stagehand instance interrupts Playwright operations
|
|
172
|
+
// that would otherwise remain alive until their individual timeout.
|
|
173
|
+
void this.stagehand?.close().catch(() => undefined);
|
|
174
|
+
this.emit({ type: 'stopping', sessionId: this.session.sessionId, stopped: true });
|
|
103
175
|
logger.info(`BrowserOperatorExecutor: Stop signal received for session ${this.session.sessionId}`);
|
|
104
176
|
}
|
|
105
177
|
/**
|
|
@@ -110,7 +182,10 @@ export class BrowserOperatorExecutor {
|
|
|
110
182
|
logger.error('BrowserOperatorExecutor: Execution blocked. Consent required.');
|
|
111
183
|
throw new Error('BrowserOperatorConsentRequired: Execution blocked. Local browser operator requires human consent.');
|
|
112
184
|
}
|
|
185
|
+
assertSafeSessionId(this.session.sessionId);
|
|
186
|
+
const workspaceRoot = requireWorkspaceRoot(cwd);
|
|
113
187
|
logger.info(`BrowserOperatorExecutor: Starting execution for session ${this.session.sessionId} (mode: ${this.session.mode})`);
|
|
188
|
+
this.emit({ type: 'started', sessionId: this.session.sessionId });
|
|
114
189
|
const checkpointListeners = new Set();
|
|
115
190
|
let watchdogInterval = null;
|
|
116
191
|
let checkpointDetected = false;
|
|
@@ -133,7 +208,11 @@ export class BrowserOperatorExecutor {
|
|
|
133
208
|
if (checkpointDetected) {
|
|
134
209
|
throw new SecurityCheckpointDetected(checkpointReason);
|
|
135
210
|
}
|
|
211
|
+
if (this.isStopped) {
|
|
212
|
+
throw new BrowserOperatorStopped();
|
|
213
|
+
}
|
|
136
214
|
let checkpointListener = null;
|
|
215
|
+
let stopListener = null;
|
|
137
216
|
let timeoutHandle = null;
|
|
138
217
|
const operationPromise = Promise.resolve()
|
|
139
218
|
.then(operation)
|
|
@@ -143,15 +222,29 @@ export class BrowserOperatorExecutor {
|
|
|
143
222
|
checkpointListener = () => resolve({ kind: 'checkpoint' });
|
|
144
223
|
checkpointListeners.add(checkpointListener);
|
|
145
224
|
});
|
|
225
|
+
const stopPromise = new Promise((resolve) => {
|
|
226
|
+
stopListener = () => resolve({ kind: 'stopped' });
|
|
227
|
+
this.stopListeners.add(stopListener);
|
|
228
|
+
if (this.isStopped)
|
|
229
|
+
stopListener();
|
|
230
|
+
});
|
|
146
231
|
const timeoutPromise = new Promise((resolve) => {
|
|
147
232
|
timeoutHandle = setTimeout(() => resolve({ kind: 'timeout' }), timeoutMs);
|
|
148
233
|
timeoutHandle.unref?.();
|
|
149
234
|
});
|
|
150
235
|
try {
|
|
151
|
-
const result = await Promise.race([
|
|
236
|
+
const result = await Promise.race([
|
|
237
|
+
operationPromise,
|
|
238
|
+
checkpointPromise,
|
|
239
|
+
stopPromise,
|
|
240
|
+
timeoutPromise,
|
|
241
|
+
]);
|
|
152
242
|
if (result.kind === 'checkpoint') {
|
|
153
243
|
throw new SecurityCheckpointDetected(checkpointReason);
|
|
154
244
|
}
|
|
245
|
+
if (result.kind === 'stopped') {
|
|
246
|
+
throw new BrowserOperatorStopped();
|
|
247
|
+
}
|
|
155
248
|
if (result.kind === 'timeout') {
|
|
156
249
|
throw new Error(`${label} timed out after ${timeoutMs}ms`);
|
|
157
250
|
}
|
|
@@ -164,6 +257,9 @@ export class BrowserOperatorExecutor {
|
|
|
164
257
|
if (checkpointListener) {
|
|
165
258
|
checkpointListeners.delete(checkpointListener);
|
|
166
259
|
}
|
|
260
|
+
if (stopListener) {
|
|
261
|
+
this.stopListeners.delete(stopListener);
|
|
262
|
+
}
|
|
167
263
|
if (timeoutHandle) {
|
|
168
264
|
clearTimeout(timeoutHandle);
|
|
169
265
|
}
|
|
@@ -220,14 +316,29 @@ export class BrowserOperatorExecutor {
|
|
|
220
316
|
try {
|
|
221
317
|
await runGuarded('stagehand.init', INIT_TIMEOUT_MS, async () => {
|
|
222
318
|
const isHeadless = this.session.mode === 'isolated';
|
|
319
|
+
const persistentProfile = this.session.mode === 'local'
|
|
320
|
+
? resolvePersistentBrowserOperatorProfile()
|
|
321
|
+
: undefined;
|
|
322
|
+
if (persistentProfile) {
|
|
323
|
+
this.profileLock = acquirePersistentBrowserOperatorProfileLock(persistentProfile);
|
|
324
|
+
}
|
|
325
|
+
const stagehandEnvironment = this.session.mode === 'local'
|
|
326
|
+
? 'LOCAL'
|
|
327
|
+
: process.env.BROWSERBASE_API_KEY ? 'BROWSERBASE' : 'LOCAL';
|
|
223
328
|
const { Stagehand } = await import('@browserbasehq/stagehand');
|
|
224
329
|
this.stagehand = new Stagehand({
|
|
225
|
-
env:
|
|
330
|
+
env: stagehandEnvironment,
|
|
226
331
|
apiKey: process.env.BROWSERBASE_API_KEY,
|
|
227
332
|
projectId: process.env.BROWSERBASE_PROJECT_ID,
|
|
228
333
|
verbose: 1,
|
|
229
334
|
localBrowserLaunchOptions: {
|
|
230
335
|
headless: isHeadless,
|
|
336
|
+
...(persistentProfile
|
|
337
|
+
? {
|
|
338
|
+
userDataDir: persistentProfile,
|
|
339
|
+
preserveUserDataDir: true,
|
|
340
|
+
}
|
|
341
|
+
: {}),
|
|
231
342
|
},
|
|
232
343
|
});
|
|
233
344
|
await this.stagehand.init();
|
|
@@ -236,6 +347,10 @@ export class BrowserOperatorExecutor {
|
|
|
236
347
|
if (!this.page) {
|
|
237
348
|
throw new Error('Stagehand did not expose a browser page instance.');
|
|
238
349
|
}
|
|
350
|
+
await runGuarded('navigation guard init', INIT_TIMEOUT_MS, () => this.installNavigationGuard());
|
|
351
|
+
if (!this.isStopped) {
|
|
352
|
+
await this.assertNavigationBoundary();
|
|
353
|
+
}
|
|
239
354
|
startWatchdog();
|
|
240
355
|
for (const entry of this.session.actionLog) {
|
|
241
356
|
if (checkpointDetected) {
|
|
@@ -244,51 +359,110 @@ export class BrowserOperatorExecutor {
|
|
|
244
359
|
if (this.isStopped) {
|
|
245
360
|
entry.status = 'stopped';
|
|
246
361
|
entry.evidence = 'Session stopped by operator request.';
|
|
362
|
+
this.emitAction(entry);
|
|
247
363
|
continue;
|
|
248
364
|
}
|
|
249
365
|
const action = normalizeAction(entry);
|
|
250
366
|
if (!BROWSER_ACTIONS.has(action)) {
|
|
251
367
|
entry.status = 'completed';
|
|
252
368
|
entry.evidence = `Skipped non-browser step (${entry.tool}${entry.action ? `.${entry.action}` : ''}); execute it with its dedicated tool.`;
|
|
369
|
+
this.emitAction(entry);
|
|
253
370
|
continue;
|
|
254
371
|
}
|
|
255
372
|
if (action.includes('/')) {
|
|
256
373
|
entry.status = 'blocked';
|
|
257
374
|
entry.evidence = `Composite placeholder "${action}" needs a concrete observed ref, selector, or instruction.`;
|
|
258
375
|
this.isStopped = true;
|
|
376
|
+
this.emitAction(entry);
|
|
259
377
|
continue;
|
|
260
378
|
}
|
|
379
|
+
let semanticPreflight;
|
|
380
|
+
try {
|
|
381
|
+
semanticPreflight = await runGuarded('browser semantic preflight', ACTION_TIMEOUT_MS, () => this.semanticPreflight(entry, action));
|
|
382
|
+
}
|
|
383
|
+
catch (error) {
|
|
384
|
+
if (error instanceof SecurityCheckpointDetected || error instanceof BrowserOperatorStopped) {
|
|
385
|
+
throw error;
|
|
386
|
+
}
|
|
387
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
388
|
+
entry.status = 'blocked';
|
|
389
|
+
entry.evidence = `Failed: ${message}`;
|
|
390
|
+
this.isStopped = true;
|
|
391
|
+
this.emitAction(entry);
|
|
392
|
+
continue;
|
|
393
|
+
}
|
|
394
|
+
this.semanticTargetSelectors.set(entry.id, semanticPreflight.resolvedSelectors);
|
|
261
395
|
if (requiresStepConfirmation(entry, action)) {
|
|
262
396
|
const confirmationService = ConfirmationService.getInstance();
|
|
263
397
|
const result = await confirmationService.requestConfirmation({
|
|
264
398
|
operation: 'browser_write',
|
|
265
399
|
filename: action,
|
|
266
400
|
content: buildConfirmationMessage(entry, action),
|
|
401
|
+
// Browser interactions can have effects outside the workspace.
|
|
402
|
+
// Cowork auto-approves ordinary embedded file/bash work, so this
|
|
403
|
+
// one-shot gate must explicitly bypass every permissive shortcut.
|
|
404
|
+
forcePrompt: true,
|
|
267
405
|
});
|
|
268
406
|
if (!result.confirmed) {
|
|
269
407
|
this.isStopped = true;
|
|
270
408
|
entry.status = 'stopped';
|
|
271
409
|
entry.evidence = 'Consent denied by operator.';
|
|
410
|
+
this.emitAction(entry);
|
|
272
411
|
throw new Error('BrowserOperatorConsentDenied: Execution stopped by user.');
|
|
273
412
|
}
|
|
274
413
|
}
|
|
414
|
+
if (MUTATING_ACTIONS.has(action)) {
|
|
415
|
+
try {
|
|
416
|
+
semanticPreflight = await runGuarded('fresh browser semantic preflight', ACTION_TIMEOUT_MS, () => this.semanticPreflight(entry, action));
|
|
417
|
+
this.semanticTargetSelectors.set(entry.id, semanticPreflight.resolvedSelectors);
|
|
418
|
+
}
|
|
419
|
+
catch (error) {
|
|
420
|
+
if (error instanceof SecurityCheckpointDetected || error instanceof BrowserOperatorStopped) {
|
|
421
|
+
throw error;
|
|
422
|
+
}
|
|
423
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
424
|
+
entry.status = 'blocked';
|
|
425
|
+
entry.evidence = `Failed: ${message}`;
|
|
426
|
+
this.isStopped = true;
|
|
427
|
+
this.emitAction(entry);
|
|
428
|
+
continue;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
275
431
|
entry.status = 'running';
|
|
432
|
+
this.emitAction(entry);
|
|
276
433
|
logger.info(`BrowserOperatorExecutor: Running action ${entry.sequence}: ${entry.title}`);
|
|
277
434
|
try {
|
|
278
|
-
|
|
435
|
+
await this.assertNavigationBoundary();
|
|
436
|
+
const result = await this.executeBrowserAction(entry, action, workspaceRoot, runGuarded);
|
|
437
|
+
await this.assertNavigationBoundary();
|
|
279
438
|
entry.status = 'completed';
|
|
280
|
-
entry.evidence = result.evidence
|
|
439
|
+
entry.evidence = `${result.evidence}\n[Semantic preflight: ${semanticPreflight.risk}${semanticPreflight.targetInspected ? ', target inspected locally' : ''}]`;
|
|
281
440
|
}
|
|
282
441
|
catch (err) {
|
|
283
|
-
|
|
442
|
+
let actionError = err;
|
|
443
|
+
try {
|
|
444
|
+
await this.assertNavigationBoundary();
|
|
445
|
+
}
|
|
446
|
+
catch (navigationError) {
|
|
447
|
+
actionError = navigationError;
|
|
448
|
+
}
|
|
449
|
+
if (actionError instanceof SecurityCheckpointDetected) {
|
|
284
450
|
entry.status = 'blocked';
|
|
285
|
-
entry.evidence =
|
|
286
|
-
|
|
451
|
+
entry.evidence = actionError.message;
|
|
452
|
+
this.emitAction(entry);
|
|
453
|
+
throw actionError;
|
|
287
454
|
}
|
|
288
|
-
|
|
455
|
+
if (actionError instanceof BrowserOperatorStopped) {
|
|
456
|
+
entry.status = 'stopped';
|
|
457
|
+
entry.evidence = actionError.message;
|
|
458
|
+
this.isStopped = true;
|
|
459
|
+
this.emitAction(entry);
|
|
460
|
+
continue;
|
|
461
|
+
}
|
|
462
|
+
const message = actionError instanceof Error ? actionError.message : String(actionError);
|
|
289
463
|
entry.status = 'blocked';
|
|
290
464
|
entry.evidence = `Failed: ${message}`;
|
|
291
|
-
logger.error('BrowserOperatorExecutor: Action failed',
|
|
465
|
+
logger.error('BrowserOperatorExecutor: Action failed', actionError);
|
|
292
466
|
this.isStopped = true;
|
|
293
467
|
}
|
|
294
468
|
if (entry.evidence) {
|
|
@@ -302,6 +476,22 @@ export class BrowserOperatorExecutor {
|
|
|
302
476
|
}
|
|
303
477
|
}
|
|
304
478
|
}
|
|
479
|
+
this.emitAction(entry);
|
|
480
|
+
}
|
|
481
|
+
if (!this.isStopped) {
|
|
482
|
+
await this.assertNavigationBoundary();
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
catch (error) {
|
|
486
|
+
if (!(error instanceof BrowserOperatorStopped))
|
|
487
|
+
throw error;
|
|
488
|
+
this.isStopped = true;
|
|
489
|
+
for (const entry of this.session.actionLog) {
|
|
490
|
+
if (entry.status === 'planned' || entry.status === 'running') {
|
|
491
|
+
entry.status = 'stopped';
|
|
492
|
+
entry.evidence = error.message;
|
|
493
|
+
this.emitAction(entry);
|
|
494
|
+
}
|
|
305
495
|
}
|
|
306
496
|
}
|
|
307
497
|
finally {
|
|
@@ -314,23 +504,38 @@ export class BrowserOperatorExecutor {
|
|
|
314
504
|
catch {
|
|
315
505
|
// Ignore close failures.
|
|
316
506
|
}
|
|
507
|
+
finally {
|
|
508
|
+
// Keep request interception active until the owned browser has stopped;
|
|
509
|
+
// otherwise a delayed meta-refresh could slip through the teardown gap.
|
|
510
|
+
await this.uninstallNavigationGuard();
|
|
511
|
+
try {
|
|
512
|
+
this.profileLock?.release();
|
|
513
|
+
}
|
|
514
|
+
catch (error) {
|
|
515
|
+
logger.error('BrowserOperatorExecutor: failed to release the persistent browser profile lock', error);
|
|
516
|
+
}
|
|
517
|
+
finally {
|
|
518
|
+
this.profileLock = null;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
317
521
|
}
|
|
318
522
|
const proofFileName = `${this.session.sessionId}.browser-operator.json`;
|
|
319
523
|
const success = !this.isStopped && this.session.actionLog.every((entry) => entry.status === 'completed');
|
|
320
524
|
const stopped = this.isStopped;
|
|
321
525
|
const generatedAt = new Date().toISOString();
|
|
526
|
+
const redactedSession = redactSessionForProof(this.session);
|
|
322
527
|
const harness = buildBrowserOperatorHarnessBundle({
|
|
323
|
-
session:
|
|
528
|
+
session: redactedSession,
|
|
324
529
|
artifactRef: proofFileName,
|
|
325
530
|
success,
|
|
326
531
|
stopped,
|
|
327
532
|
createdAt: Date.parse(generatedAt),
|
|
328
533
|
});
|
|
329
534
|
const proofArtifact = {
|
|
330
|
-
sessionId:
|
|
535
|
+
sessionId: redactedSession.sessionId,
|
|
331
536
|
generatedAt,
|
|
332
|
-
goal:
|
|
333
|
-
mode:
|
|
537
|
+
goal: redactedSession.goal,
|
|
538
|
+
mode: redactedSession.mode,
|
|
334
539
|
engine: 'stagehand-browser-pilot',
|
|
335
540
|
capabilities: [
|
|
336
541
|
'navigation',
|
|
@@ -349,20 +554,27 @@ export class BrowserOperatorExecutor {
|
|
|
349
554
|
'uploads',
|
|
350
555
|
'watchdog',
|
|
351
556
|
],
|
|
352
|
-
consent:
|
|
353
|
-
actionLog:
|
|
557
|
+
consent: redactedSession.consent,
|
|
558
|
+
actionLog: redactedSession.actionLog,
|
|
354
559
|
success,
|
|
355
560
|
stopped,
|
|
356
561
|
harness,
|
|
357
562
|
};
|
|
358
|
-
const
|
|
359
|
-
|
|
360
|
-
|
|
563
|
+
const artifactDirectory = ensureSafeArtifactDirectory(workspaceRoot, this.session.sessionId);
|
|
564
|
+
const proofPath = nextAvailableArtifactPath(path.join(artifactDirectory, proofFileName));
|
|
565
|
+
writePrivateArtifact(proofPath, JSON.stringify(proofArtifact, null, 2));
|
|
361
566
|
logger.info(`BrowserOperatorExecutor: Execution complete. Proof written to ${proofFileName}`);
|
|
567
|
+
this.emit({
|
|
568
|
+
type: 'completed',
|
|
569
|
+
sessionId: this.session.sessionId,
|
|
570
|
+
success: proofArtifact.success,
|
|
571
|
+
stopped: proofArtifact.stopped,
|
|
572
|
+
});
|
|
362
573
|
return {
|
|
363
574
|
success: proofArtifact.success,
|
|
364
575
|
stopped: proofArtifact.stopped,
|
|
365
576
|
actionLog: this.session.actionLog,
|
|
577
|
+
proofPath,
|
|
366
578
|
};
|
|
367
579
|
}
|
|
368
580
|
async executeBrowserAction(entry, action, cwd, runGuarded) {
|
|
@@ -371,9 +583,10 @@ export class BrowserOperatorExecutor {
|
|
|
371
583
|
const timeoutMs = getTimeout(inputs, timeoutForAction(action));
|
|
372
584
|
switch (action) {
|
|
373
585
|
case 'navigate': {
|
|
374
|
-
const
|
|
375
|
-
if (!
|
|
586
|
+
const requestedUrl = getString(inputs.url) || this.session.query;
|
|
587
|
+
if (!requestedUrl)
|
|
376
588
|
throw new Error('navigate requires inputs.url or session.query');
|
|
589
|
+
const url = await this.guardNavigationUrl(requestedUrl);
|
|
377
590
|
await runGuarded('page.goto', NAVIGATION_TIMEOUT_MS, () => page.goto(url, {
|
|
378
591
|
waitUntil: getString(inputs.waitUntil) || 'domcontentloaded',
|
|
379
592
|
timeout: getTimeout(inputs, NAVIGATION_TIMEOUT_MS),
|
|
@@ -418,7 +631,7 @@ export class BrowserOperatorExecutor {
|
|
|
418
631
|
}
|
|
419
632
|
case 'act':
|
|
420
633
|
return {
|
|
421
|
-
evidence: await runGuarded('page.act', timeoutMs, () => this.
|
|
634
|
+
evidence: await runGuarded('page.act', timeoutMs, () => this.executeBoundSemanticAct(entry)),
|
|
422
635
|
};
|
|
423
636
|
case 'click':
|
|
424
637
|
case 'double_click':
|
|
@@ -443,11 +656,15 @@ export class BrowserOperatorExecutor {
|
|
|
443
656
|
if (!key)
|
|
444
657
|
throw new Error('press requires inputs.key');
|
|
445
658
|
await runGuarded('page.keyboard.press', timeoutMs, () => {
|
|
659
|
+
const inspectedSelector = this.semanticSelector(entry);
|
|
660
|
+
const locator = inspectedSelector ? page.locator?.(inspectedSelector) : undefined;
|
|
661
|
+
if (locator?.press)
|
|
662
|
+
return locator.press(key);
|
|
446
663
|
if (page.keyboard?.press)
|
|
447
664
|
return page.keyboard.press(key);
|
|
448
665
|
if (page.keyPress)
|
|
449
666
|
return page.keyPress(key);
|
|
450
|
-
|
|
667
|
+
throw new Error('No deterministic key press API is available for the locally inspected target.');
|
|
451
668
|
});
|
|
452
669
|
return { evidence: `Pressed ${key}` };
|
|
453
670
|
}
|
|
@@ -525,7 +742,7 @@ export class BrowserOperatorExecutor {
|
|
|
525
742
|
return { evidence: `Set ${Object.keys(getRecord(inputs.storageData)).length} sessionStorage entries` };
|
|
526
743
|
case 'upload_files':
|
|
527
744
|
return {
|
|
528
|
-
evidence: await runGuarded('upload files', timeoutMs, () => this.uploadFiles(entry)),
|
|
745
|
+
evidence: await runGuarded('upload files', timeoutMs, () => this.uploadFiles(entry, cwd)),
|
|
529
746
|
};
|
|
530
747
|
case 'download':
|
|
531
748
|
return {
|
|
@@ -534,7 +751,9 @@ export class BrowserOperatorExecutor {
|
|
|
534
751
|
case 'tabs':
|
|
535
752
|
return { evidence: `Tabs: ${formatStructured(await this.listTabs())}` };
|
|
536
753
|
case 'new_tab': {
|
|
537
|
-
const
|
|
754
|
+
const requestedUrl = getString(inputs.url);
|
|
755
|
+
const url = requestedUrl ? await this.guardNavigationUrl(requestedUrl) : undefined;
|
|
756
|
+
const tab = await runGuarded('new tab', timeoutMs, () => this.newTab(url));
|
|
538
757
|
return { evidence: `New tab opened: ${formatStructured(tab)}` };
|
|
539
758
|
}
|
|
540
759
|
case 'focus_tab':
|
|
@@ -554,6 +773,472 @@ export class BrowserOperatorExecutor {
|
|
|
554
773
|
}
|
|
555
774
|
return this.page;
|
|
556
775
|
}
|
|
776
|
+
semanticSelector(entry, index = 0) {
|
|
777
|
+
return this.semanticTargetSelectors.get(entry.id)?.[index] ?? '';
|
|
778
|
+
}
|
|
779
|
+
async executeBoundSemanticAct(entry) {
|
|
780
|
+
const page = this.requirePage();
|
|
781
|
+
const inputs = entry.inputs ?? {};
|
|
782
|
+
const instruction = getString(inputs.instruction) || getString(inputs.text) || entry.title;
|
|
783
|
+
const selector = this.semanticSelector(entry);
|
|
784
|
+
if (!selector) {
|
|
785
|
+
throw new Error('BrowserOperatorTargetInspectionRequired: semantic act has no locally bound target selector.');
|
|
786
|
+
}
|
|
787
|
+
const locator = page.locator?.(selector);
|
|
788
|
+
if (/(?:\bclick\b|\bopen\b|\bchoose\b|\bcontinue\b|cliquer|ouvrir|choisir|continuer)/i.test(instruction)) {
|
|
789
|
+
if (locator?.click) {
|
|
790
|
+
await locator.click({ button: 'left', clickCount: 1 });
|
|
791
|
+
}
|
|
792
|
+
else if (page.click) {
|
|
793
|
+
await page.click(selector, { button: 'left', clickCount: 1 });
|
|
794
|
+
}
|
|
795
|
+
else {
|
|
796
|
+
throw new Error('No deterministic click API is available for the locally inspected semantic target.');
|
|
797
|
+
}
|
|
798
|
+
return `Performed locally bound semantic click on ${selector}`;
|
|
799
|
+
}
|
|
800
|
+
const value = getString(inputs.value) || (inputs.instruction ? getString(inputs.text) : '');
|
|
801
|
+
if (value && /(?:\btype\b|\bfill\b|\benter\b|saisir|remplir)/i.test(instruction)) {
|
|
802
|
+
if (locator?.fill) {
|
|
803
|
+
await locator.fill(value);
|
|
804
|
+
}
|
|
805
|
+
else if (page.fill) {
|
|
806
|
+
await page.fill(selector, value);
|
|
807
|
+
}
|
|
808
|
+
else {
|
|
809
|
+
throw new Error('No deterministic fill API is available for the locally inspected semantic target.');
|
|
810
|
+
}
|
|
811
|
+
return `Performed locally bound semantic fill on ${selector}`;
|
|
812
|
+
}
|
|
813
|
+
throw new Error('BrowserOperatorSemanticActBlocked: semantic instruction cannot be bound to a deterministic local interaction. Use click, fill, type, select, or press explicitly.');
|
|
814
|
+
}
|
|
815
|
+
async semanticPreflight(entry, action) {
|
|
816
|
+
if (!MUTATING_ACTIONS.has(action)) {
|
|
817
|
+
return { risk: 'read', targetInspected: false, reasons: [], resolvedSelectors: [] };
|
|
818
|
+
}
|
|
819
|
+
const page = this.requirePage();
|
|
820
|
+
const targetInspectionRequired = TARGET_INSPECTION_ACTIONS.has(action);
|
|
821
|
+
let inspection = null;
|
|
822
|
+
if (targetInspectionRequired) {
|
|
823
|
+
if (typeof page.evaluate !== 'function') {
|
|
824
|
+
throw new Error('BrowserOperatorTargetInspectionRequired: mutating action blocked because local DOM inspection is unavailable.');
|
|
825
|
+
}
|
|
826
|
+
const request = buildSemanticInspectionRequest(entry, action);
|
|
827
|
+
let rawInspection;
|
|
828
|
+
try {
|
|
829
|
+
rawInspection = await page.evaluate((input) => {
|
|
830
|
+
const bound = (value, max = 600) => String(value ?? '').replace(/\s+/g, ' ').trim().slice(0, max);
|
|
831
|
+
const isInspectableTarget = (element) => Boolean(element && !['HTML', 'BODY', 'HEAD', 'SCRIPT', 'STYLE'].includes(element.tagName));
|
|
832
|
+
const targetText = (element) => {
|
|
833
|
+
const html = element;
|
|
834
|
+
return bound(html.innerText || element.textContent || '', 300);
|
|
835
|
+
};
|
|
836
|
+
const selectorFor = (element) => {
|
|
837
|
+
const escape = (value) => {
|
|
838
|
+
const css = globalThis.CSS;
|
|
839
|
+
return css?.escape ? css.escape(value) : value.replace(/[^a-zA-Z0-9_-]/g, '\\$&');
|
|
840
|
+
};
|
|
841
|
+
const id = element.getAttribute('id');
|
|
842
|
+
if (id)
|
|
843
|
+
return `#${escape(id)}`;
|
|
844
|
+
for (const attribute of ['data-testid', 'data-test-id', 'data-test']) {
|
|
845
|
+
const value = element.getAttribute(attribute);
|
|
846
|
+
if (value)
|
|
847
|
+
return `[${attribute}="${value.replace(/"/g, '\\"')}"]`;
|
|
848
|
+
}
|
|
849
|
+
const name = element.getAttribute('name');
|
|
850
|
+
if (name)
|
|
851
|
+
return `${element.tagName.toLowerCase()}[name="${name.replace(/"/g, '\\"')}"]`;
|
|
852
|
+
const aria = element.getAttribute('aria-label');
|
|
853
|
+
if (aria)
|
|
854
|
+
return `${element.tagName.toLowerCase()}[aria-label="${aria.replace(/"/g, '\\"')}"]`;
|
|
855
|
+
const parent = element.parentElement;
|
|
856
|
+
if (!parent)
|
|
857
|
+
return element.tagName.toLowerCase();
|
|
858
|
+
const peers = Array.from(parent.children).filter((candidate) => candidate.tagName === element.tagName);
|
|
859
|
+
return `${selectorFor(parent)} > ${element.tagName.toLowerCase()}:nth-of-type(${Math.max(1, peers.indexOf(element) + 1)})`;
|
|
860
|
+
};
|
|
861
|
+
const labelsFor = (element) => {
|
|
862
|
+
const labels = [];
|
|
863
|
+
const control = element;
|
|
864
|
+
if (control.labels) {
|
|
865
|
+
labels.push(...Array.from(control.labels).map((label) => targetText(label)));
|
|
866
|
+
}
|
|
867
|
+
const wrappingLabel = element.closest('label');
|
|
868
|
+
if (wrappingLabel)
|
|
869
|
+
labels.push(targetText(wrappingLabel));
|
|
870
|
+
const labelledBy = element.getAttribute('aria-labelledby') || '';
|
|
871
|
+
for (const id of labelledBy.split(/\s+/).filter(Boolean)) {
|
|
872
|
+
const label = document.getElementById(id);
|
|
873
|
+
if (label)
|
|
874
|
+
labels.push(targetText(label));
|
|
875
|
+
}
|
|
876
|
+
return bound([...new Set(labels.filter(Boolean))].join(' | '), 500);
|
|
877
|
+
};
|
|
878
|
+
const describe = (element) => {
|
|
879
|
+
const html = element;
|
|
880
|
+
const form = element.closest('form');
|
|
881
|
+
const neighborhoodRoot = element.closest('[role="dialog"],dialog,form,fieldset,section,article,li')
|
|
882
|
+
|| element.parentElement;
|
|
883
|
+
return {
|
|
884
|
+
text: targetText(element),
|
|
885
|
+
ariaLabel: bound(element.getAttribute('aria-label'), 300),
|
|
886
|
+
labels: labelsFor(element),
|
|
887
|
+
neighborhood: bound(neighborhoodRoot?.innerText || neighborhoodRoot?.textContent, 800),
|
|
888
|
+
formAction: bound(form?.getAttribute('action') || form?.action, 500),
|
|
889
|
+
formText: bound(form?.innerText || form?.textContent, 800),
|
|
890
|
+
role: bound(element.getAttribute('role') || html.tagName, 80),
|
|
891
|
+
inputType: bound(element.getAttribute('type'), 80),
|
|
892
|
+
name: bound(element.getAttribute('name') || element.id, 200),
|
|
893
|
+
href: bound(element.getAttribute('href') || element.href, 500),
|
|
894
|
+
};
|
|
895
|
+
};
|
|
896
|
+
const candidates = () => Array.from(document.querySelectorAll('button,a[href],input,textarea,select,[role="button"],[role="menuitem"],[contenteditable="true"]')).filter(isInspectableTarget);
|
|
897
|
+
const findByIntent = (intent) => {
|
|
898
|
+
const normalized = bound(intent, 500).toLowerCase();
|
|
899
|
+
const tokens = normalized.split(/[^\p{L}\p{N}]+/u).filter((token) => token.length > 2);
|
|
900
|
+
let best = null;
|
|
901
|
+
for (const element of candidates()) {
|
|
902
|
+
const context = describe(element);
|
|
903
|
+
const haystack = `${context.text} ${context.ariaLabel} ${context.labels} ${context.name} ${context.role}`.toLowerCase();
|
|
904
|
+
const score = (normalized && haystack.includes(normalized) ? 20 : 0)
|
|
905
|
+
+ tokens.filter((token) => haystack.includes(token)).length * 3;
|
|
906
|
+
if (score > 0 && (!best || score > best.score))
|
|
907
|
+
best = { element, score };
|
|
908
|
+
}
|
|
909
|
+
return best?.element ?? null;
|
|
910
|
+
};
|
|
911
|
+
try {
|
|
912
|
+
const targets = [];
|
|
913
|
+
for (const group of input.selectorGroups) {
|
|
914
|
+
const target = group.map((selector) => document.querySelector(selector)).find(isInspectableTarget) ?? null;
|
|
915
|
+
if (target)
|
|
916
|
+
targets.push(target);
|
|
917
|
+
}
|
|
918
|
+
if (input.useActiveElement && isInspectableTarget(document.activeElement)) {
|
|
919
|
+
targets.push(document.activeElement);
|
|
920
|
+
}
|
|
921
|
+
if (targets.length === 0
|
|
922
|
+
&& (input.selectorGroups.length === 0 || input.allowIntentFallback && input.selectorGroups.length === 1)
|
|
923
|
+
&& input.intent) {
|
|
924
|
+
const intentTarget = findByIntent(input.intent);
|
|
925
|
+
if (intentTarget)
|
|
926
|
+
targets.push(intentTarget);
|
|
927
|
+
}
|
|
928
|
+
const expectedTargets = input.selectorGroups.length > 0 ? input.selectorGroups.length : 1;
|
|
929
|
+
const uniqueTargets = [...new Set(targets)];
|
|
930
|
+
return {
|
|
931
|
+
inspected: true,
|
|
932
|
+
targetFound: uniqueTargets.length >= expectedTargets,
|
|
933
|
+
url: bound(location.href, 1_000),
|
|
934
|
+
documentTitle: bound(document.title, 300),
|
|
935
|
+
contexts: uniqueTargets.slice(0, 12).map(describe),
|
|
936
|
+
resolvedSelectors: uniqueTargets.slice(0, 12).map(selectorFor),
|
|
937
|
+
};
|
|
938
|
+
}
|
|
939
|
+
catch (error) {
|
|
940
|
+
return {
|
|
941
|
+
inspected: true,
|
|
942
|
+
targetFound: false,
|
|
943
|
+
url: bound(location.href, 1_000),
|
|
944
|
+
documentTitle: bound(document.title, 300),
|
|
945
|
+
contexts: [],
|
|
946
|
+
resolvedSelectors: [],
|
|
947
|
+
error: error instanceof Error ? bound(error.message, 300) : 'target inspection failed',
|
|
948
|
+
};
|
|
949
|
+
}
|
|
950
|
+
}, request);
|
|
951
|
+
}
|
|
952
|
+
catch (error) {
|
|
953
|
+
throw new Error(`BrowserOperatorTargetInspectionRequired: mutating action blocked because local target inspection failed (${error instanceof Error ? error.message : String(error)}).`);
|
|
954
|
+
}
|
|
955
|
+
inspection = normalizeTargetInspection(rawInspection);
|
|
956
|
+
if (!inspection
|
|
957
|
+
|| !inspection.targetFound
|
|
958
|
+
|| inspection.contexts.length === 0
|
|
959
|
+
|| inspection.resolvedSelectors.length === 0) {
|
|
960
|
+
const detail = inspection?.error ? ` (${inspection.error})` : '';
|
|
961
|
+
throw new Error(`BrowserOperatorTargetInspectionRequired: mutating action blocked because its exact local target could not be inspected${detail}.`);
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
const currentUrl = typeof page.url === 'function' ? String(page.url() ?? '') : '';
|
|
965
|
+
const semanticContext = [
|
|
966
|
+
action,
|
|
967
|
+
entry.title,
|
|
968
|
+
entry.reason,
|
|
969
|
+
semanticInputDescription(entry, action),
|
|
970
|
+
currentUrl,
|
|
971
|
+
inspection?.url,
|
|
972
|
+
inspection?.documentTitle,
|
|
973
|
+
...(inspection?.contexts.flatMap((context) => [
|
|
974
|
+
context.text,
|
|
975
|
+
context.ariaLabel,
|
|
976
|
+
context.labels,
|
|
977
|
+
context.neighborhood,
|
|
978
|
+
context.formAction,
|
|
979
|
+
context.formText,
|
|
980
|
+
context.role,
|
|
981
|
+
context.inputType,
|
|
982
|
+
context.name,
|
|
983
|
+
context.href,
|
|
984
|
+
]) ?? []),
|
|
985
|
+
].filter(Boolean).join('\n');
|
|
986
|
+
const reasons = SENSITIVE_SEMANTIC_SIGNALS
|
|
987
|
+
.filter(({ pattern }) => pattern.test(semanticContext))
|
|
988
|
+
.map(({ reason }) => reason);
|
|
989
|
+
if (reasons.length > 0) {
|
|
990
|
+
throw new Error(`BrowserOperatorSensitiveEffectBlocked: semantic preflight detected ${[...new Set(reasons)].join(', ')}. Generic browser confirmation never authorizes this effect; a dedicated effect-specific approval receipt is required and is not available.`);
|
|
991
|
+
}
|
|
992
|
+
return {
|
|
993
|
+
risk: 'low',
|
|
994
|
+
targetInspected: targetInspectionRequired,
|
|
995
|
+
reasons: [],
|
|
996
|
+
resolvedSelectors: inspection?.resolvedSelectors ?? [],
|
|
997
|
+
};
|
|
998
|
+
}
|
|
999
|
+
async guardNavigationUrl(rawUrl) {
|
|
1000
|
+
let url;
|
|
1001
|
+
try {
|
|
1002
|
+
url = new URL(rawUrl);
|
|
1003
|
+
}
|
|
1004
|
+
catch {
|
|
1005
|
+
throw new Error('Navigation blocked: invalid URL.');
|
|
1006
|
+
}
|
|
1007
|
+
if (!['http:', 'https:'].includes(url.protocol) || url.username || url.password) {
|
|
1008
|
+
throw new Error('Navigation blocked: only credential-free HTTP(S) URLs are allowed.');
|
|
1009
|
+
}
|
|
1010
|
+
let check;
|
|
1011
|
+
if (this.options.urlGuard) {
|
|
1012
|
+
try {
|
|
1013
|
+
check = await this.options.urlGuard(url.toString());
|
|
1014
|
+
}
|
|
1015
|
+
catch (error) {
|
|
1016
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
1017
|
+
throw new Error(`Navigation blocked: URL guard failed (${reason}).`);
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
else {
|
|
1021
|
+
try {
|
|
1022
|
+
const { isDevOriginAllowed } = await import('../security/dev-origins.js');
|
|
1023
|
+
if (isDevOriginAllowed(url.toString()))
|
|
1024
|
+
return url.toString();
|
|
1025
|
+
const { assertSafeUrl } = await import('../security/ssrf-guard.js');
|
|
1026
|
+
check = await assertSafeUrl(url.toString());
|
|
1027
|
+
}
|
|
1028
|
+
catch (error) {
|
|
1029
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
1030
|
+
throw new Error(`Navigation blocked: URL guard unavailable (${reason}).`);
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
if (!check.safe) {
|
|
1034
|
+
throw new Error(`Navigation blocked: ${check.reason || 'URL not allowed'}`);
|
|
1035
|
+
}
|
|
1036
|
+
return url.toString();
|
|
1037
|
+
}
|
|
1038
|
+
/**
|
|
1039
|
+
* Install a browser-context request gate before the first planned action.
|
|
1040
|
+
* Context-level routing is important here: it covers redirect hops and pages
|
|
1041
|
+
* opened by a click/semantic action, not only explicit page.goto calls.
|
|
1042
|
+
*/
|
|
1043
|
+
async installNavigationGuard() {
|
|
1044
|
+
if (this.navigationRouteHandler)
|
|
1045
|
+
return;
|
|
1046
|
+
this.navigationRouteHandler = async (route, request) => {
|
|
1047
|
+
const check = this.handleNavigationRoute(route, request);
|
|
1048
|
+
this.pendingNavigationChecks.add(check);
|
|
1049
|
+
try {
|
|
1050
|
+
await check;
|
|
1051
|
+
}
|
|
1052
|
+
finally {
|
|
1053
|
+
this.pendingNavigationChecks.delete(check);
|
|
1054
|
+
}
|
|
1055
|
+
};
|
|
1056
|
+
const routeTargets = [];
|
|
1057
|
+
const page = this.requirePage();
|
|
1058
|
+
const stagehandContext = this.stagehand?.context;
|
|
1059
|
+
if (isNavigationRouteTarget(stagehandContext)) {
|
|
1060
|
+
routeTargets.push(stagehandContext);
|
|
1061
|
+
}
|
|
1062
|
+
let pageContext;
|
|
1063
|
+
try {
|
|
1064
|
+
pageContext = typeof page.context === 'function' ? page.context() : undefined;
|
|
1065
|
+
}
|
|
1066
|
+
catch {
|
|
1067
|
+
pageContext = undefined;
|
|
1068
|
+
}
|
|
1069
|
+
if (isNavigationRouteTarget(pageContext) && !routeTargets.includes(pageContext)) {
|
|
1070
|
+
routeTargets.push(pageContext);
|
|
1071
|
+
}
|
|
1072
|
+
if (routeTargets.length === 0) {
|
|
1073
|
+
const connectUrl = this.stagehand?.connectURL?.();
|
|
1074
|
+
if (connectUrl) {
|
|
1075
|
+
const { chromium } = await import('playwright-core');
|
|
1076
|
+
this.navigationGuardBrowser = await chromium.connectOverCDP(connectUrl, {
|
|
1077
|
+
timeout: INIT_TIMEOUT_MS,
|
|
1078
|
+
});
|
|
1079
|
+
routeTargets.push(...this.navigationGuardBrowser.contexts());
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
if (routeTargets.length === 0) {
|
|
1083
|
+
// urlGuard is explicitly documented as a deterministic test injection.
|
|
1084
|
+
// Legacy test doubles do not expose network routing; production Stagehand
|
|
1085
|
+
// exposes connectURL(), so a real runtime without interception fails closed.
|
|
1086
|
+
if (this.options.urlGuard) {
|
|
1087
|
+
logger.warn('BrowserOperatorExecutor: navigation request interception unavailable on injected test backend; retaining post-action URL verification.');
|
|
1088
|
+
return;
|
|
1089
|
+
}
|
|
1090
|
+
this.navigationRouteHandler = null;
|
|
1091
|
+
throw new Error('Navigation blocked: browser request interception is unavailable.');
|
|
1092
|
+
}
|
|
1093
|
+
for (const target of routeTargets) {
|
|
1094
|
+
await target.route(this.navigationRoutePattern, this.navigationRouteHandler);
|
|
1095
|
+
this.navigationRouteTargets.push(target);
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
async uninstallNavigationGuard() {
|
|
1099
|
+
const handler = this.navigationRouteHandler;
|
|
1100
|
+
this.navigationRouteHandler = null;
|
|
1101
|
+
if (!handler)
|
|
1102
|
+
return;
|
|
1103
|
+
const targets = this.navigationRouteTargets.splice(0);
|
|
1104
|
+
await Promise.allSettled(targets.map(async (target) => {
|
|
1105
|
+
await target.unroute?.(this.navigationRoutePattern, handler);
|
|
1106
|
+
}));
|
|
1107
|
+
this.navigationGuardBrowser = null;
|
|
1108
|
+
this.pendingNavigationChecks.clear();
|
|
1109
|
+
}
|
|
1110
|
+
async handleNavigationRoute(route, requestArgument) {
|
|
1111
|
+
const request = requestArgument ?? route.request?.();
|
|
1112
|
+
if (!request) {
|
|
1113
|
+
this.recordNavigationViolation(new Error('Navigation blocked: intercepted request metadata is unavailable.'));
|
|
1114
|
+
await abortNavigationRoute(route);
|
|
1115
|
+
return;
|
|
1116
|
+
}
|
|
1117
|
+
let isNavigationRequest;
|
|
1118
|
+
try {
|
|
1119
|
+
isNavigationRequest = typeof request.isNavigationRequest === 'function'
|
|
1120
|
+
? request.isNavigationRequest()
|
|
1121
|
+
: request.resourceType?.() === 'document';
|
|
1122
|
+
}
|
|
1123
|
+
catch {
|
|
1124
|
+
this.recordNavigationViolation(new Error('Navigation blocked: intercepted request type is unavailable.'));
|
|
1125
|
+
await abortNavigationRoute(route);
|
|
1126
|
+
return;
|
|
1127
|
+
}
|
|
1128
|
+
if (!isNavigationRequest) {
|
|
1129
|
+
await continueNavigationRoute(route);
|
|
1130
|
+
return;
|
|
1131
|
+
}
|
|
1132
|
+
let requestedUrl = '';
|
|
1133
|
+
try {
|
|
1134
|
+
requestedUrl = request.url?.() ?? '';
|
|
1135
|
+
if (!requestedUrl) {
|
|
1136
|
+
throw new Error('empty intercepted URL');
|
|
1137
|
+
}
|
|
1138
|
+
await this.guardNavigationUrl(requestedUrl);
|
|
1139
|
+
}
|
|
1140
|
+
catch (error) {
|
|
1141
|
+
this.recordNavigationViolation(normalizeNavigationError(error));
|
|
1142
|
+
await abortNavigationRoute(route);
|
|
1143
|
+
return;
|
|
1144
|
+
}
|
|
1145
|
+
try {
|
|
1146
|
+
await continueNavigationRoute(route);
|
|
1147
|
+
}
|
|
1148
|
+
catch (error) {
|
|
1149
|
+
if (!this.isStopped) {
|
|
1150
|
+
logger.warn(`BrowserOperatorExecutor: failed to continue a guarded navigation request: ${error instanceof Error ? error.message : String(error)}`);
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
/**
|
|
1155
|
+
* Await in-flight route decisions and validate every visible top-level URL.
|
|
1156
|
+
* This second boundary catches custom Stagehand actions whose navigation may
|
|
1157
|
+
* be abstracted away from the active page object.
|
|
1158
|
+
*/
|
|
1159
|
+
async assertNavigationBoundary() {
|
|
1160
|
+
while (this.pendingNavigationChecks.size > 0) {
|
|
1161
|
+
await Promise.allSettled([...this.pendingNavigationChecks]);
|
|
1162
|
+
}
|
|
1163
|
+
if (this.navigationViolation)
|
|
1164
|
+
throw this.navigationViolation;
|
|
1165
|
+
for (const browserPage of this.navigationPages()) {
|
|
1166
|
+
if (typeof browserPage.url !== 'function')
|
|
1167
|
+
continue;
|
|
1168
|
+
let currentUrl;
|
|
1169
|
+
try {
|
|
1170
|
+
currentUrl = String(browserPage.url() ?? '').trim();
|
|
1171
|
+
}
|
|
1172
|
+
catch (error) {
|
|
1173
|
+
this.recordNavigationViolation(new Error(`Navigation blocked: current page URL is unavailable (${error instanceof Error ? error.message : String(error)}).`));
|
|
1174
|
+
break;
|
|
1175
|
+
}
|
|
1176
|
+
if (!currentUrl || currentUrl === 'about:blank' || currentUrl.startsWith('about:blank#'))
|
|
1177
|
+
continue;
|
|
1178
|
+
try {
|
|
1179
|
+
await this.guardNavigationUrl(currentUrl);
|
|
1180
|
+
}
|
|
1181
|
+
catch (error) {
|
|
1182
|
+
this.recordNavigationViolation(normalizeNavigationError(error));
|
|
1183
|
+
break;
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
if (this.navigationViolation)
|
|
1187
|
+
throw this.navigationViolation;
|
|
1188
|
+
}
|
|
1189
|
+
navigationPages() {
|
|
1190
|
+
const pages = [];
|
|
1191
|
+
const append = (candidate) => {
|
|
1192
|
+
if (candidate && typeof candidate === 'object' && !pages.includes(candidate)) {
|
|
1193
|
+
pages.push(candidate);
|
|
1194
|
+
}
|
|
1195
|
+
};
|
|
1196
|
+
append(this.page);
|
|
1197
|
+
try {
|
|
1198
|
+
const contextPages = this.stagehand?.context?.pages?.();
|
|
1199
|
+
if (Array.isArray(contextPages))
|
|
1200
|
+
contextPages.forEach(append);
|
|
1201
|
+
}
|
|
1202
|
+
catch {
|
|
1203
|
+
// The active page still provides a final-URL boundary.
|
|
1204
|
+
}
|
|
1205
|
+
try {
|
|
1206
|
+
for (const context of this.navigationGuardBrowser?.contexts() ?? []) {
|
|
1207
|
+
const contextPages = context.pages?.();
|
|
1208
|
+
if (Array.isArray(contextPages))
|
|
1209
|
+
contextPages.forEach(append);
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
catch {
|
|
1213
|
+
// The request route remains the primary pre-navigation boundary.
|
|
1214
|
+
}
|
|
1215
|
+
return pages;
|
|
1216
|
+
}
|
|
1217
|
+
recordNavigationViolation(error) {
|
|
1218
|
+
if (!this.navigationViolation) {
|
|
1219
|
+
this.navigationViolation = error;
|
|
1220
|
+
logger.error(`BrowserOperatorExecutor: ${error.message}`);
|
|
1221
|
+
}
|
|
1222
|
+
this.isStopped = true;
|
|
1223
|
+
for (const listener of this.stopListeners)
|
|
1224
|
+
listener();
|
|
1225
|
+
this.stopListeners.clear();
|
|
1226
|
+
}
|
|
1227
|
+
emitAction(action) {
|
|
1228
|
+
this.emit({
|
|
1229
|
+
type: 'action',
|
|
1230
|
+
sessionId: this.session.sessionId,
|
|
1231
|
+
action: redactActionLogEntry(action),
|
|
1232
|
+
});
|
|
1233
|
+
}
|
|
1234
|
+
emit(event) {
|
|
1235
|
+
try {
|
|
1236
|
+
this.options.onEvent?.(event);
|
|
1237
|
+
}
|
|
1238
|
+
catch {
|
|
1239
|
+
// Observability callbacks must never alter execution semantics.
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
557
1242
|
context() {
|
|
558
1243
|
if (this.stagehand?.context) {
|
|
559
1244
|
return this.stagehand.context;
|
|
@@ -575,18 +1260,6 @@ export class BrowserOperatorExecutor {
|
|
|
575
1260
|
}
|
|
576
1261
|
return context.activePage?.() ?? context.pages?.()[0] ?? null;
|
|
577
1262
|
}
|
|
578
|
-
async semanticAct(instruction) {
|
|
579
|
-
const page = this.requirePage();
|
|
580
|
-
if (page.act) {
|
|
581
|
-
await page.act({ action: instruction });
|
|
582
|
-
return `Successfully performed semantic action: ${instruction}`;
|
|
583
|
-
}
|
|
584
|
-
if (!this.stagehand?.act) {
|
|
585
|
-
throw new Error('Stagehand semantic action API is not available.');
|
|
586
|
-
}
|
|
587
|
-
await this.stagehand.act(instruction);
|
|
588
|
-
return `Successfully performed semantic action: ${instruction}`;
|
|
589
|
-
}
|
|
590
1263
|
async clickLike(action, entry) {
|
|
591
1264
|
const page = this.requirePage();
|
|
592
1265
|
const inputs = entry.inputs ?? {};
|
|
@@ -597,7 +1270,7 @@ export class BrowserOperatorExecutor {
|
|
|
597
1270
|
const button = action === 'right_click' ? 'right' : getString(inputs.button) || 'left';
|
|
598
1271
|
const clickCount = action === 'double_click' ? 2 : getNumber(inputs.clickCount) ?? 1;
|
|
599
1272
|
let resolved = null;
|
|
600
|
-
let effectiveSelector = selector;
|
|
1273
|
+
let effectiveSelector = selector || this.semanticSelector(entry);
|
|
601
1274
|
if (!effectiveSelector && target && ref === undefined) {
|
|
602
1275
|
resolved = await this.tryIdentifyElement(target, inputs);
|
|
603
1276
|
effectiveSelector = resolved?.selector ?? '';
|
|
@@ -615,10 +1288,7 @@ export class BrowserOperatorExecutor {
|
|
|
615
1288
|
}
|
|
616
1289
|
return `Clicked selector ${effectiveSelector}${resolved ? ` (${resolved.source}: ${resolved.description})` : ''}`;
|
|
617
1290
|
}
|
|
618
|
-
|
|
619
|
-
? `click on "${text}"`
|
|
620
|
-
: `click ${ref !== undefined ? `element with reference ${ref}` : entry.title}`;
|
|
621
|
-
return this.semanticAct(instruction);
|
|
1291
|
+
throw new Error(`BrowserOperatorTargetInspectionRequired: no deterministic selector remained for ${text || ref || entry.title}.`);
|
|
622
1292
|
}
|
|
623
1293
|
async typeText(entry) {
|
|
624
1294
|
const page = this.requirePage();
|
|
@@ -629,7 +1299,7 @@ export class BrowserOperatorExecutor {
|
|
|
629
1299
|
if (!text)
|
|
630
1300
|
throw new Error('type requires inputs.text or inputs.value');
|
|
631
1301
|
let resolved = null;
|
|
632
|
-
let effectiveSelector = selector;
|
|
1302
|
+
let effectiveSelector = selector || this.semanticSelector(entry);
|
|
633
1303
|
if (!effectiveSelector && target && inputs.ref === undefined) {
|
|
634
1304
|
resolved = await this.tryIdentifyElement(target, inputs);
|
|
635
1305
|
effectiveSelector = resolved?.selector ?? '';
|
|
@@ -653,7 +1323,7 @@ export class BrowserOperatorExecutor {
|
|
|
653
1323
|
}
|
|
654
1324
|
return `Typed ${text.length} chars into ${effectiveSelector}${resolved ? ` (${resolved.source}: ${resolved.description})` : ''}`;
|
|
655
1325
|
}
|
|
656
|
-
|
|
1326
|
+
throw new Error(`BrowserOperatorTargetInspectionRequired: no deterministic selector remained for ${getString(inputs.ref) || entry.title}.`);
|
|
657
1327
|
}
|
|
658
1328
|
async fillFields(entry) {
|
|
659
1329
|
const inputs = entry.inputs ?? {};
|
|
@@ -667,11 +1337,15 @@ export class BrowserOperatorExecutor {
|
|
|
667
1337
|
if (Object.keys(fields).length === 0) {
|
|
668
1338
|
throw new Error('fill requires inputs.fields, or selector + value');
|
|
669
1339
|
}
|
|
1340
|
+
let fieldIndex = 0;
|
|
670
1341
|
for (const [target, fieldValue] of Object.entries(fields)) {
|
|
1342
|
+
const inspectedSelector = this.semanticSelector(entry, fieldIndex++);
|
|
671
1343
|
await this.typeText({
|
|
672
1344
|
...entry,
|
|
673
1345
|
inputs: isNumeric(target)
|
|
674
|
-
?
|
|
1346
|
+
? inspectedSelector
|
|
1347
|
+
? { ...inputs, selector: inspectedSelector, text: String(fieldValue) }
|
|
1348
|
+
: { ...inputs, ref: Number(target), text: String(fieldValue) }
|
|
675
1349
|
: { ...inputs, selector: target, text: String(fieldValue) },
|
|
676
1350
|
});
|
|
677
1351
|
}
|
|
@@ -688,7 +1362,7 @@ export class BrowserOperatorExecutor {
|
|
|
688
1362
|
if (!value)
|
|
689
1363
|
throw new Error('select requires value, label, or index');
|
|
690
1364
|
let resolved = null;
|
|
691
|
-
let effectiveSelector = selector;
|
|
1365
|
+
let effectiveSelector = selector || this.semanticSelector(entry);
|
|
692
1366
|
if (!effectiveSelector) {
|
|
693
1367
|
const target = getElementIntent(entry, 'select');
|
|
694
1368
|
if (target) {
|
|
@@ -708,14 +1382,14 @@ export class BrowserOperatorExecutor {
|
|
|
708
1382
|
}
|
|
709
1383
|
return `Selected ${value} in ${effectiveSelector}${resolved ? ` (${resolved.source}: ${resolved.description})` : ''}`;
|
|
710
1384
|
}
|
|
711
|
-
|
|
1385
|
+
throw new Error(`BrowserOperatorTargetInspectionRequired: no deterministic selector remained for ${entry.title}.`);
|
|
712
1386
|
}
|
|
713
1387
|
async hover(entry) {
|
|
714
1388
|
const page = this.requirePage();
|
|
715
1389
|
const inputs = entry.inputs ?? {};
|
|
716
1390
|
const selector = getString(inputs.selector);
|
|
717
1391
|
let resolved = null;
|
|
718
|
-
let effectiveSelector = selector;
|
|
1392
|
+
let effectiveSelector = selector || this.semanticSelector(entry);
|
|
719
1393
|
if (!effectiveSelector) {
|
|
720
1394
|
const target = getElementIntent(entry, 'hover');
|
|
721
1395
|
if (target) {
|
|
@@ -736,7 +1410,7 @@ export class BrowserOperatorExecutor {
|
|
|
736
1410
|
}
|
|
737
1411
|
return `Hovered ${effectiveSelector}${resolved ? ` (${resolved.source}: ${resolved.description})` : ''}`;
|
|
738
1412
|
}
|
|
739
|
-
|
|
1413
|
+
throw new Error(`BrowserOperatorTargetInspectionRequired: no deterministic selector remained for ${getString(inputs.text) || getString(inputs.ref) || entry.title}.`);
|
|
740
1414
|
}
|
|
741
1415
|
async tryIdentifyElement(target, inputs = {}) {
|
|
742
1416
|
try {
|
|
@@ -958,14 +1632,19 @@ export class BrowserOperatorExecutor {
|
|
|
958
1632
|
throw new Error('Screenshot API is not available.');
|
|
959
1633
|
}
|
|
960
1634
|
const inputs = entry.inputs ?? {};
|
|
961
|
-
const
|
|
962
|
-
|
|
1635
|
+
const artifactDirectory = ensureSafeArtifactDirectory(cwd, this.session.sessionId);
|
|
1636
|
+
const artifactPath = resolveArtifactOutputPath(artifactDirectory, getString(inputs.outputPath), `evidence_${safeArtifactName(entry.id)}.png`);
|
|
963
1637
|
const buffer = await page.screenshot({
|
|
964
1638
|
fullPage: inputs.fullPage === true,
|
|
965
|
-
path: page.screenshot.length === 0 ? undefined : artifactPath,
|
|
966
1639
|
});
|
|
967
1640
|
if (Buffer.isBuffer(buffer)) {
|
|
968
|
-
|
|
1641
|
+
writePrivateArtifact(artifactPath, buffer);
|
|
1642
|
+
}
|
|
1643
|
+
else if (typeof buffer === 'string') {
|
|
1644
|
+
writePrivateArtifact(artifactPath, Buffer.from(buffer, 'base64'));
|
|
1645
|
+
}
|
|
1646
|
+
else {
|
|
1647
|
+
throw new Error('Screenshot API did not return image bytes.');
|
|
969
1648
|
}
|
|
970
1649
|
return artifactPath;
|
|
971
1650
|
}
|
|
@@ -1000,10 +1679,12 @@ export class BrowserOperatorExecutor {
|
|
|
1000
1679
|
entries: Object.fromEntries(Object.entries(data).map(([key, value]) => [key, String(value)])),
|
|
1001
1680
|
});
|
|
1002
1681
|
}
|
|
1003
|
-
async uploadFiles(entry) {
|
|
1682
|
+
async uploadFiles(entry, workspaceRoot) {
|
|
1004
1683
|
const page = this.requirePage();
|
|
1005
1684
|
const inputs = entry.inputs ?? {};
|
|
1006
|
-
const files = Array.isArray(inputs.files)
|
|
1685
|
+
const files = Array.isArray(inputs.files)
|
|
1686
|
+
? inputs.files.map((file) => requireWorkspaceFile(String(file), workspaceRoot))
|
|
1687
|
+
: [];
|
|
1007
1688
|
if (files.length === 0)
|
|
1008
1689
|
throw new Error('upload_files requires inputs.files');
|
|
1009
1690
|
const selector = getString(inputs.selector) || 'input[type="file"]';
|
|
@@ -1024,11 +1705,13 @@ export class BrowserOperatorExecutor {
|
|
|
1024
1705
|
page.waitForEvent('download', { timeout: getTimeout(inputs, ACTION_TIMEOUT_MS) }),
|
|
1025
1706
|
this.clickLike('click', entry),
|
|
1026
1707
|
]);
|
|
1027
|
-
const suggestedFilename = download.suggestedFilename?.() ?? `download-${Date.now()}
|
|
1028
|
-
const
|
|
1029
|
-
|
|
1708
|
+
const suggestedFilename = safeArtifactName(download.suggestedFilename?.() ?? `download-${Date.now()}`);
|
|
1709
|
+
const artifactDirectory = ensureSafeArtifactDirectory(cwd, this.session.sessionId);
|
|
1710
|
+
const outputPath = resolveArtifactOutputPath(artifactDirectory, getString(inputs.downloadPath), suggestedFilename);
|
|
1711
|
+
assertArtifactDoesNotExist(outputPath);
|
|
1030
1712
|
if (download.saveAs) {
|
|
1031
1713
|
await download.saveAs(outputPath);
|
|
1714
|
+
fs.chmodSync(outputPath, 0o600);
|
|
1032
1715
|
}
|
|
1033
1716
|
return `Downloaded ${suggestedFilename} to ${outputPath}`;
|
|
1034
1717
|
}
|
|
@@ -1086,6 +1769,375 @@ export class BrowserOperatorExecutor {
|
|
|
1086
1769
|
this.page = remaining[0] ?? this.page;
|
|
1087
1770
|
}
|
|
1088
1771
|
}
|
|
1772
|
+
/**
|
|
1773
|
+
* Local Browser Operator sessions reuse a dedicated Code Buddy profile so an
|
|
1774
|
+
* operator can sign in once in the visible window. We never point Stagehand at
|
|
1775
|
+
* the user's normal Chrome profile: that would broaden access to unrelated
|
|
1776
|
+
* tabs and make profile-lock corruption possible.
|
|
1777
|
+
*/
|
|
1778
|
+
export function resolvePersistentBrowserOperatorProfile(configured = process.env.CODEBUDDY_BROWSER_OPERATOR_PROFILE_DIR) {
|
|
1779
|
+
const requested = configured?.trim()
|
|
1780
|
+
? path.resolve(configured.trim())
|
|
1781
|
+
: path.join(os.homedir(), '.codebuddy', 'browser-operator-profile');
|
|
1782
|
+
fs.mkdirSync(requested, { recursive: true, mode: 0o700 });
|
|
1783
|
+
const info = fs.lstatSync(requested);
|
|
1784
|
+
if (!info.isDirectory() || info.isSymbolicLink()) {
|
|
1785
|
+
throw new Error('Browser Operator persistent profile must be a real directory.');
|
|
1786
|
+
}
|
|
1787
|
+
fs.chmodSync(requested, 0o700);
|
|
1788
|
+
const profilePath = fs.realpathSync(requested);
|
|
1789
|
+
const markerPath = path.join(profilePath, BROWSER_OPERATOR_PROFILE_MARKER);
|
|
1790
|
+
if (!fs.existsSync(markerPath)) {
|
|
1791
|
+
const entries = fs.readdirSync(profilePath);
|
|
1792
|
+
if (entries.length > 0) {
|
|
1793
|
+
throw new Error('Browser Operator persistent profile is non-empty and has no Code Buddy ownership marker. Choose a new empty directory; existing Chrome/Edge profiles are never adopted.');
|
|
1794
|
+
}
|
|
1795
|
+
createBrowserOperatorProfileMarker(markerPath);
|
|
1796
|
+
}
|
|
1797
|
+
validateBrowserOperatorProfileMarker(markerPath);
|
|
1798
|
+
return profilePath;
|
|
1799
|
+
}
|
|
1800
|
+
/**
|
|
1801
|
+
* Acquire the cross-process lease protecting the dedicated Chrome profile.
|
|
1802
|
+
* The lock is refreshed while held, recovered only when its owner is dead or
|
|
1803
|
+
* its heartbeat is stale, and released only when the random owner token still
|
|
1804
|
+
* matches. Callers must retain it until Stagehand has fully closed.
|
|
1805
|
+
*/
|
|
1806
|
+
export function acquirePersistentBrowserOperatorProfileLock(profilePath, options = {}) {
|
|
1807
|
+
const resolvedProfile = resolvePersistentBrowserOperatorProfile(profilePath);
|
|
1808
|
+
const lockPath = path.join(resolvedProfile, BROWSER_OPERATOR_PROFILE_LOCK);
|
|
1809
|
+
const staleMs = Math.max(2_000, options.staleMs ?? PROFILE_LOCK_STALE_MS);
|
|
1810
|
+
const updateMs = Math.max(500, Math.min(options.updateMs ?? PROFILE_LOCK_UPDATE_MS, Math.floor(staleMs / 2)));
|
|
1811
|
+
const now = options.now ?? Date.now;
|
|
1812
|
+
const pid = options.pid ?? process.pid;
|
|
1813
|
+
const host = options.hostname ?? os.hostname();
|
|
1814
|
+
const isProcessAlive = options.isProcessAlive ?? defaultIsProcessAlive;
|
|
1815
|
+
const token = randomUUID();
|
|
1816
|
+
const metadata = {
|
|
1817
|
+
schemaVersion: PROFILE_LOCK_SCHEMA_VERSION,
|
|
1818
|
+
owner: PROFILE_OWNER,
|
|
1819
|
+
token,
|
|
1820
|
+
pid,
|
|
1821
|
+
hostname: host,
|
|
1822
|
+
acquiredAt: new Date(now()).toISOString(),
|
|
1823
|
+
};
|
|
1824
|
+
for (let attempt = 0; attempt < 4; attempt++) {
|
|
1825
|
+
try {
|
|
1826
|
+
createPrivateControlFile(lockPath, JSON.stringify(metadata, null, 2));
|
|
1827
|
+
return createHeldBrowserOperatorProfileLock({
|
|
1828
|
+
profilePath: resolvedProfile,
|
|
1829
|
+
lockPath,
|
|
1830
|
+
token,
|
|
1831
|
+
updateMs,
|
|
1832
|
+
});
|
|
1833
|
+
}
|
|
1834
|
+
catch (error) {
|
|
1835
|
+
if (!isErrnoCode(error, 'EEXIST'))
|
|
1836
|
+
throw error;
|
|
1837
|
+
const snapshot = readBrowserOperatorProfileLockSnapshot(lockPath);
|
|
1838
|
+
if (!isBrowserOperatorProfileLockStale(snapshot, {
|
|
1839
|
+
staleMs,
|
|
1840
|
+
now: now(),
|
|
1841
|
+
hostname: host,
|
|
1842
|
+
isProcessAlive,
|
|
1843
|
+
})) {
|
|
1844
|
+
throw new Error('Browser Operator persistent profile is already in use by another process.');
|
|
1845
|
+
}
|
|
1846
|
+
reclaimStaleBrowserOperatorProfileLock(lockPath, snapshot, token);
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
throw new Error('Browser Operator could not acquire the persistent profile lock safely.');
|
|
1850
|
+
}
|
|
1851
|
+
function createBrowserOperatorProfileMarker(markerPath) {
|
|
1852
|
+
const marker = {
|
|
1853
|
+
schemaVersion: PROFILE_MARKER_SCHEMA_VERSION,
|
|
1854
|
+
owner: PROFILE_OWNER,
|
|
1855
|
+
profileId: randomUUID(),
|
|
1856
|
+
createdAt: new Date().toISOString(),
|
|
1857
|
+
};
|
|
1858
|
+
try {
|
|
1859
|
+
createPrivateControlFile(markerPath, JSON.stringify(marker, null, 2));
|
|
1860
|
+
}
|
|
1861
|
+
catch (error) {
|
|
1862
|
+
// Two Code Buddy processes may initialize the same empty directory at the
|
|
1863
|
+
// same instant. The winner's marker is validated below by both processes.
|
|
1864
|
+
if (!isErrnoCode(error, 'EEXIST'))
|
|
1865
|
+
throw error;
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
function validateBrowserOperatorProfileMarker(markerPath) {
|
|
1869
|
+
const info = fs.lstatSync(markerPath);
|
|
1870
|
+
if (!info.isFile() || info.isSymbolicLink() || info.size > MAX_PROFILE_CONTROL_FILE_BYTES) {
|
|
1871
|
+
throw new Error('Browser Operator profile ownership marker is unsafe or invalid.');
|
|
1872
|
+
}
|
|
1873
|
+
let marker;
|
|
1874
|
+
try {
|
|
1875
|
+
marker = JSON.parse(fs.readFileSync(markerPath, 'utf8'));
|
|
1876
|
+
}
|
|
1877
|
+
catch {
|
|
1878
|
+
throw new Error('Browser Operator profile ownership marker is unreadable.');
|
|
1879
|
+
}
|
|
1880
|
+
if (marker.schemaVersion !== PROFILE_MARKER_SCHEMA_VERSION
|
|
1881
|
+
|| marker.owner !== PROFILE_OWNER
|
|
1882
|
+
|| typeof marker.profileId !== 'string'
|
|
1883
|
+
|| marker.profileId.length < 16
|
|
1884
|
+
|| typeof marker.createdAt !== 'string'
|
|
1885
|
+
|| !Number.isFinite(Date.parse(marker.createdAt))) {
|
|
1886
|
+
throw new Error('Browser Operator profile ownership marker does not belong to Code Buddy.');
|
|
1887
|
+
}
|
|
1888
|
+
fs.chmodSync(markerPath, 0o600);
|
|
1889
|
+
}
|
|
1890
|
+
function createPrivateControlFile(filePath, content) {
|
|
1891
|
+
const fd = fs.openSync(filePath, 'wx', 0o600);
|
|
1892
|
+
try {
|
|
1893
|
+
fs.writeFileSync(fd, content, 'utf8');
|
|
1894
|
+
fs.fsyncSync(fd);
|
|
1895
|
+
}
|
|
1896
|
+
finally {
|
|
1897
|
+
fs.closeSync(fd);
|
|
1898
|
+
}
|
|
1899
|
+
fs.chmodSync(filePath, 0o600);
|
|
1900
|
+
}
|
|
1901
|
+
function createHeldBrowserOperatorProfileLock(input) {
|
|
1902
|
+
let released = false;
|
|
1903
|
+
const update = setInterval(() => {
|
|
1904
|
+
try {
|
|
1905
|
+
const current = readBrowserOperatorProfileLockSnapshot(input.lockPath);
|
|
1906
|
+
if (current.metadata?.token !== input.token) {
|
|
1907
|
+
clearInterval(update);
|
|
1908
|
+
logger.error('BrowserOperatorExecutor: persistent profile lock ownership was compromised.');
|
|
1909
|
+
return;
|
|
1910
|
+
}
|
|
1911
|
+
const timestamp = new Date();
|
|
1912
|
+
fs.utimesSync(input.lockPath, timestamp, timestamp);
|
|
1913
|
+
}
|
|
1914
|
+
catch (error) {
|
|
1915
|
+
clearInterval(update);
|
|
1916
|
+
logger.error('BrowserOperatorExecutor: persistent profile lock heartbeat failed', error);
|
|
1917
|
+
}
|
|
1918
|
+
}, input.updateMs);
|
|
1919
|
+
update.unref?.();
|
|
1920
|
+
return {
|
|
1921
|
+
profilePath: input.profilePath,
|
|
1922
|
+
lockPath: input.lockPath,
|
|
1923
|
+
token: input.token,
|
|
1924
|
+
release: () => {
|
|
1925
|
+
if (released)
|
|
1926
|
+
return;
|
|
1927
|
+
released = true;
|
|
1928
|
+
clearInterval(update);
|
|
1929
|
+
let snapshot;
|
|
1930
|
+
try {
|
|
1931
|
+
snapshot = readBrowserOperatorProfileLockSnapshot(input.lockPath);
|
|
1932
|
+
}
|
|
1933
|
+
catch (error) {
|
|
1934
|
+
if (isErrnoCode(error, 'ENOENT'))
|
|
1935
|
+
return;
|
|
1936
|
+
throw error;
|
|
1937
|
+
}
|
|
1938
|
+
if (snapshot.metadata?.token !== input.token) {
|
|
1939
|
+
throw new Error('Browser Operator refused to release a persistent profile lock owned by another process.');
|
|
1940
|
+
}
|
|
1941
|
+
fs.unlinkSync(input.lockPath);
|
|
1942
|
+
},
|
|
1943
|
+
};
|
|
1944
|
+
}
|
|
1945
|
+
function readBrowserOperatorProfileLockSnapshot(lockPath) {
|
|
1946
|
+
const stat = fs.lstatSync(lockPath);
|
|
1947
|
+
if (!stat.isFile() || stat.isSymbolicLink()) {
|
|
1948
|
+
throw new Error('Browser Operator persistent profile lock is not a safe regular file.');
|
|
1949
|
+
}
|
|
1950
|
+
if (stat.size > MAX_PROFILE_CONTROL_FILE_BYTES) {
|
|
1951
|
+
return { stat, metadata: null };
|
|
1952
|
+
}
|
|
1953
|
+
try {
|
|
1954
|
+
const value = JSON.parse(fs.readFileSync(lockPath, 'utf8'));
|
|
1955
|
+
const valid = value.schemaVersion === PROFILE_LOCK_SCHEMA_VERSION
|
|
1956
|
+
&& value.owner === PROFILE_OWNER
|
|
1957
|
+
&& typeof value.token === 'string'
|
|
1958
|
+
&& value.token.length >= 16
|
|
1959
|
+
&& Number.isSafeInteger(value.pid)
|
|
1960
|
+
&& Number(value.pid) > 0
|
|
1961
|
+
&& typeof value.hostname === 'string'
|
|
1962
|
+
&& value.hostname.length > 0
|
|
1963
|
+
&& typeof value.acquiredAt === 'string'
|
|
1964
|
+
&& Number.isFinite(Date.parse(value.acquiredAt));
|
|
1965
|
+
return { stat, metadata: valid ? value : null };
|
|
1966
|
+
}
|
|
1967
|
+
catch {
|
|
1968
|
+
return { stat, metadata: null };
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
function isBrowserOperatorProfileLockStale(snapshot, input) {
|
|
1972
|
+
const heartbeatExpired = snapshot.stat.mtimeMs < input.now - input.staleMs;
|
|
1973
|
+
if (!snapshot.metadata)
|
|
1974
|
+
return heartbeatExpired;
|
|
1975
|
+
if (snapshot.metadata.hostname !== input.hostname)
|
|
1976
|
+
return heartbeatExpired;
|
|
1977
|
+
return !input.isProcessAlive(snapshot.metadata.pid);
|
|
1978
|
+
}
|
|
1979
|
+
function reclaimStaleBrowserOperatorProfileLock(lockPath, expected, contenderToken) {
|
|
1980
|
+
const quarantinePath = `${lockPath}.stale-${contenderToken}`;
|
|
1981
|
+
try {
|
|
1982
|
+
fs.renameSync(lockPath, quarantinePath);
|
|
1983
|
+
}
|
|
1984
|
+
catch (error) {
|
|
1985
|
+
if (isErrnoCode(error, 'ENOENT'))
|
|
1986
|
+
return;
|
|
1987
|
+
throw error;
|
|
1988
|
+
}
|
|
1989
|
+
let moved;
|
|
1990
|
+
try {
|
|
1991
|
+
moved = readBrowserOperatorProfileLockSnapshot(quarantinePath);
|
|
1992
|
+
}
|
|
1993
|
+
catch (error) {
|
|
1994
|
+
restoreUnexpectedProfileLock(quarantinePath, lockPath);
|
|
1995
|
+
throw error;
|
|
1996
|
+
}
|
|
1997
|
+
const sameFile = moved.stat.dev === expected.stat.dev
|
|
1998
|
+
&& moved.stat.ino === expected.stat.ino
|
|
1999
|
+
&& moved.stat.size === expected.stat.size
|
|
2000
|
+
&& moved.metadata?.token === expected.metadata?.token;
|
|
2001
|
+
if (!sameFile) {
|
|
2002
|
+
restoreUnexpectedProfileLock(quarantinePath, lockPath);
|
|
2003
|
+
throw new Error('Browser Operator profile lock changed during stale recovery; acquisition was aborted.');
|
|
2004
|
+
}
|
|
2005
|
+
fs.unlinkSync(quarantinePath);
|
|
2006
|
+
}
|
|
2007
|
+
function restoreUnexpectedProfileLock(quarantinePath, lockPath) {
|
|
2008
|
+
try {
|
|
2009
|
+
fs.linkSync(quarantinePath, lockPath);
|
|
2010
|
+
}
|
|
2011
|
+
catch (error) {
|
|
2012
|
+
if (!isErrnoCode(error, 'EEXIST')) {
|
|
2013
|
+
logger.error('BrowserOperatorExecutor: could not restore a concurrently replaced profile lock', error);
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
finally {
|
|
2017
|
+
try {
|
|
2018
|
+
fs.unlinkSync(quarantinePath);
|
|
2019
|
+
}
|
|
2020
|
+
catch {
|
|
2021
|
+
// Best effort: never overwrite a newer owner's lock during recovery.
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
function defaultIsProcessAlive(pid) {
|
|
2026
|
+
try {
|
|
2027
|
+
process.kill(pid, 0);
|
|
2028
|
+
return true;
|
|
2029
|
+
}
|
|
2030
|
+
catch (error) {
|
|
2031
|
+
return isErrnoCode(error, 'EPERM');
|
|
2032
|
+
}
|
|
2033
|
+
}
|
|
2034
|
+
function isErrnoCode(error, code) {
|
|
2035
|
+
return Boolean(error && typeof error === 'object' && error.code === code);
|
|
2036
|
+
}
|
|
2037
|
+
function buildSemanticInspectionRequest(entry, action) {
|
|
2038
|
+
const inputs = entry.inputs ?? {};
|
|
2039
|
+
const selectorGroups = [];
|
|
2040
|
+
let allowIntentFallback = false;
|
|
2041
|
+
const selector = getString(inputs.selector);
|
|
2042
|
+
if (selector)
|
|
2043
|
+
selectorGroups.push([selector]);
|
|
2044
|
+
if (action === 'fill') {
|
|
2045
|
+
const fields = getRecord(inputs.fields);
|
|
2046
|
+
for (const key of Object.keys(fields)) {
|
|
2047
|
+
if (isNumeric(key)) {
|
|
2048
|
+
selectorGroups.push(referenceSelectorGroup(key));
|
|
2049
|
+
allowIntentFallback = true;
|
|
2050
|
+
}
|
|
2051
|
+
else if (key !== selector) {
|
|
2052
|
+
selectorGroups.push([key]);
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
if (inputs.ref !== undefined && selectorGroups.length === 0) {
|
|
2057
|
+
selectorGroups.push(referenceSelectorGroup(String(inputs.ref)));
|
|
2058
|
+
allowIntentFallback = true;
|
|
2059
|
+
}
|
|
2060
|
+
if (action === 'upload_files' && selectorGroups.length === 0) {
|
|
2061
|
+
selectorGroups.push(['input[type="file"]']);
|
|
2062
|
+
}
|
|
2063
|
+
return {
|
|
2064
|
+
selectorGroups,
|
|
2065
|
+
intent: getElementIntent(entry, action) || entry.title || action,
|
|
2066
|
+
useActiveElement: action === 'press',
|
|
2067
|
+
allowIntentFallback,
|
|
2068
|
+
};
|
|
2069
|
+
}
|
|
2070
|
+
function referenceSelectorGroup(ref) {
|
|
2071
|
+
const escaped = ref.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
2072
|
+
return [
|
|
2073
|
+
`[data-ref="${escaped}"]`,
|
|
2074
|
+
`[data-stagehand-ref="${escaped}"]`,
|
|
2075
|
+
`[aria-ref="${escaped}"]`,
|
|
2076
|
+
];
|
|
2077
|
+
}
|
|
2078
|
+
function semanticInputDescription(entry, action) {
|
|
2079
|
+
const inputs = entry.inputs ?? {};
|
|
2080
|
+
const values = [
|
|
2081
|
+
inputs.selector,
|
|
2082
|
+
inputs.target,
|
|
2083
|
+
inputs.llmTarget,
|
|
2084
|
+
inputs.element,
|
|
2085
|
+
inputs.description,
|
|
2086
|
+
inputs.instruction,
|
|
2087
|
+
inputs.label,
|
|
2088
|
+
inputs.name,
|
|
2089
|
+
inputs.placeholder,
|
|
2090
|
+
inputs.role,
|
|
2091
|
+
inputs.href,
|
|
2092
|
+
inputs.formAction,
|
|
2093
|
+
inputs.key,
|
|
2094
|
+
...Object.keys(getRecord(inputs.fields)),
|
|
2095
|
+
];
|
|
2096
|
+
// Typed values may contain arbitrary prose or secrets and are neither needed
|
|
2097
|
+
// for effect classification nor safe to copy into inspection evidence.
|
|
2098
|
+
if (action === 'click' || action === 'act' || action === 'double_click' || action === 'right_click') {
|
|
2099
|
+
values.push(inputs.text);
|
|
2100
|
+
}
|
|
2101
|
+
return values.filter((value) => value !== undefined && value !== null).map(String).join(' ');
|
|
2102
|
+
}
|
|
2103
|
+
function normalizeTargetInspection(value) {
|
|
2104
|
+
if (!value || typeof value !== 'object')
|
|
2105
|
+
return null;
|
|
2106
|
+
const record = value;
|
|
2107
|
+
if (record.inspected !== true || !Array.isArray(record.contexts))
|
|
2108
|
+
return null;
|
|
2109
|
+
const contexts = record.contexts.slice(0, 12).flatMap((candidate) => {
|
|
2110
|
+
if (!candidate || typeof candidate !== 'object')
|
|
2111
|
+
return [];
|
|
2112
|
+
const context = candidate;
|
|
2113
|
+
return [{
|
|
2114
|
+
text: boundedSemanticText(context.text, 300),
|
|
2115
|
+
ariaLabel: boundedSemanticText(context.ariaLabel, 300),
|
|
2116
|
+
labels: boundedSemanticText(context.labels, 500),
|
|
2117
|
+
neighborhood: boundedSemanticText(context.neighborhood, 800),
|
|
2118
|
+
formAction: boundedSemanticText(context.formAction, 500),
|
|
2119
|
+
formText: boundedSemanticText(context.formText, 800),
|
|
2120
|
+
role: boundedSemanticText(context.role, 80),
|
|
2121
|
+
inputType: boundedSemanticText(context.inputType, 80),
|
|
2122
|
+
name: boundedSemanticText(context.name, 200),
|
|
2123
|
+
href: boundedSemanticText(context.href, 500),
|
|
2124
|
+
}];
|
|
2125
|
+
});
|
|
2126
|
+
return {
|
|
2127
|
+
inspected: true,
|
|
2128
|
+
targetFound: record.targetFound === true,
|
|
2129
|
+
url: boundedSemanticText(record.url, 1_000),
|
|
2130
|
+
documentTitle: boundedSemanticText(record.documentTitle, 300),
|
|
2131
|
+
contexts,
|
|
2132
|
+
resolvedSelectors: Array.isArray(record.resolvedSelectors)
|
|
2133
|
+
? record.resolvedSelectors.slice(0, 12).map((selector) => boundedSemanticText(selector, 1_000)).filter(Boolean)
|
|
2134
|
+
: [],
|
|
2135
|
+
...(record.error ? { error: boundedSemanticText(record.error, 300) } : {}),
|
|
2136
|
+
};
|
|
2137
|
+
}
|
|
2138
|
+
function boundedSemanticText(value, maxLength) {
|
|
2139
|
+
return String(value ?? '').replace(/\s+/g, ' ').trim().slice(0, maxLength);
|
|
2140
|
+
}
|
|
1089
2141
|
function normalizeAction(entry) {
|
|
1090
2142
|
const rawAction = String(entry.action || entry.tool || '').trim().toLowerCase();
|
|
1091
2143
|
return rawAction
|
|
@@ -1143,6 +2195,32 @@ function scoreObservedElement(candidate, target) {
|
|
|
1143
2195
|
+ (candidate.method === 'click' ? 1 : 0)
|
|
1144
2196
|
+ (candidate.selector.startsWith('#') ? 1 : 0);
|
|
1145
2197
|
}
|
|
2198
|
+
function isNavigationRouteTarget(value) {
|
|
2199
|
+
return Boolean(value && typeof value === 'object' && typeof value.route === 'function');
|
|
2200
|
+
}
|
|
2201
|
+
async function continueNavigationRoute(route) {
|
|
2202
|
+
if (typeof route.continue !== 'function') {
|
|
2203
|
+
throw new Error('Navigation blocked: intercepted request cannot be continued safely.');
|
|
2204
|
+
}
|
|
2205
|
+
await route.continue();
|
|
2206
|
+
}
|
|
2207
|
+
async function abortNavigationRoute(route) {
|
|
2208
|
+
if (typeof route.abort !== 'function')
|
|
2209
|
+
return;
|
|
2210
|
+
try {
|
|
2211
|
+
await route.abort('blockedbyclient');
|
|
2212
|
+
}
|
|
2213
|
+
catch {
|
|
2214
|
+
// The browser may already be closing after the fail-closed stop signal.
|
|
2215
|
+
}
|
|
2216
|
+
}
|
|
2217
|
+
function normalizeNavigationError(error) {
|
|
2218
|
+
if (error instanceof Error && /^Navigation blocked:/i.test(error.message)) {
|
|
2219
|
+
return error;
|
|
2220
|
+
}
|
|
2221
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
2222
|
+
return new Error(`Navigation blocked: intercepted browser navigation was rejected (${reason}).`);
|
|
2223
|
+
}
|
|
1146
2224
|
function timeoutForAction(action) {
|
|
1147
2225
|
if (action === 'navigate')
|
|
1148
2226
|
return NAVIGATION_TIMEOUT_MS;
|
|
@@ -1204,4 +2282,148 @@ function formatStructured(value) {
|
|
|
1204
2282
|
function truncate(value, maxLength) {
|
|
1205
2283
|
return value.length > maxLength ? `${value.slice(0, maxLength)}\n... (truncated)` : value;
|
|
1206
2284
|
}
|
|
2285
|
+
const SAFE_SESSION_ID = /^[a-zA-Z0-9._-]{1,128}$/;
|
|
2286
|
+
const SENSITIVE_FIELD_HINT = /password|passcode|secret|token|credential|api[_ -]?key|private[_ -]?key/i;
|
|
2287
|
+
function assertSafeSessionId(sessionId) {
|
|
2288
|
+
if (!SAFE_SESSION_ID.test(sessionId)) {
|
|
2289
|
+
throw new Error('Browser Operator session id is invalid.');
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
2292
|
+
function requireWorkspaceRoot(input) {
|
|
2293
|
+
try {
|
|
2294
|
+
const root = fs.realpathSync(path.resolve(input));
|
|
2295
|
+
if (!fs.statSync(root).isDirectory())
|
|
2296
|
+
throw new Error('not a directory');
|
|
2297
|
+
return root;
|
|
2298
|
+
}
|
|
2299
|
+
catch {
|
|
2300
|
+
throw new Error('Browser Operator workspace root must be an existing directory.');
|
|
2301
|
+
}
|
|
2302
|
+
}
|
|
2303
|
+
function isPathInside(root, candidate) {
|
|
2304
|
+
const relative = path.relative(root, candidate);
|
|
2305
|
+
return relative === '' || (!relative.startsWith(`..${path.sep}`) && relative !== '..' && !path.isAbsolute(relative));
|
|
2306
|
+
}
|
|
2307
|
+
function ensureSafeArtifactDirectory(workspaceRoot, sessionId) {
|
|
2308
|
+
assertSafeSessionId(sessionId);
|
|
2309
|
+
const root = requireWorkspaceRoot(workspaceRoot);
|
|
2310
|
+
let current = root;
|
|
2311
|
+
for (const segment of ['.codebuddy', 'runs', sessionId, 'artifacts']) {
|
|
2312
|
+
current = path.join(current, segment);
|
|
2313
|
+
if (fs.existsSync(current)) {
|
|
2314
|
+
const info = fs.lstatSync(current);
|
|
2315
|
+
if (info.isSymbolicLink() || !info.isDirectory()) {
|
|
2316
|
+
throw new Error(`Unsafe Browser Operator artifact directory: ${current}`);
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
else {
|
|
2320
|
+
fs.mkdirSync(current, { mode: 0o700 });
|
|
2321
|
+
}
|
|
2322
|
+
const real = fs.realpathSync(current);
|
|
2323
|
+
if (!isPathInside(root, real)) {
|
|
2324
|
+
throw new Error('Browser Operator artifact directory escaped the workspace.');
|
|
2325
|
+
}
|
|
2326
|
+
}
|
|
2327
|
+
return current;
|
|
2328
|
+
}
|
|
2329
|
+
function safeArtifactName(input) {
|
|
2330
|
+
const safe = path.basename(input)
|
|
2331
|
+
.replace(/[^a-zA-Z0-9._-]+/g, '-')
|
|
2332
|
+
.replace(/^\.+/, '')
|
|
2333
|
+
.slice(0, 160);
|
|
2334
|
+
return safe || 'artifact';
|
|
2335
|
+
}
|
|
2336
|
+
function resolveArtifactOutputPath(artifactDirectory, requestedPath, fallbackName) {
|
|
2337
|
+
const candidate = requestedPath
|
|
2338
|
+
? path.resolve(artifactDirectory, requestedPath)
|
|
2339
|
+
: path.join(artifactDirectory, safeArtifactName(fallbackName));
|
|
2340
|
+
if (path.dirname(candidate) !== artifactDirectory || !isPathInside(artifactDirectory, candidate)) {
|
|
2341
|
+
throw new Error('Browser Operator artifact output must stay inside its private artifact directory.');
|
|
2342
|
+
}
|
|
2343
|
+
return candidate;
|
|
2344
|
+
}
|
|
2345
|
+
function assertArtifactDoesNotExist(filePath) {
|
|
2346
|
+
if (fs.existsSync(filePath)) {
|
|
2347
|
+
const info = fs.lstatSync(filePath);
|
|
2348
|
+
if (info.isSymbolicLink()) {
|
|
2349
|
+
throw new Error('Browser Operator refused a symlink artifact target.');
|
|
2350
|
+
}
|
|
2351
|
+
throw new Error(`Browser Operator artifact already exists: ${path.basename(filePath)}`);
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
function nextAvailableArtifactPath(preferredPath) {
|
|
2355
|
+
if (!fs.existsSync(preferredPath))
|
|
2356
|
+
return preferredPath;
|
|
2357
|
+
const extension = path.extname(preferredPath);
|
|
2358
|
+
const stem = preferredPath.slice(0, preferredPath.length - extension.length);
|
|
2359
|
+
for (let index = 1; index <= 1_000; index++) {
|
|
2360
|
+
const candidate = `${stem}.${index}${extension}`;
|
|
2361
|
+
if (!fs.existsSync(candidate))
|
|
2362
|
+
return candidate;
|
|
2363
|
+
}
|
|
2364
|
+
throw new Error('Browser Operator could not reserve a unique proof artifact name.');
|
|
2365
|
+
}
|
|
2366
|
+
function writePrivateArtifact(filePath, content) {
|
|
2367
|
+
assertArtifactDoesNotExist(filePath);
|
|
2368
|
+
const fd = fs.openSync(filePath, 'wx', 0o600);
|
|
2369
|
+
try {
|
|
2370
|
+
fs.writeFileSync(fd, content);
|
|
2371
|
+
fs.fsyncSync(fd);
|
|
2372
|
+
}
|
|
2373
|
+
finally {
|
|
2374
|
+
fs.closeSync(fd);
|
|
2375
|
+
}
|
|
2376
|
+
fs.chmodSync(filePath, 0o600);
|
|
2377
|
+
}
|
|
2378
|
+
function requireWorkspaceFile(input, workspaceRoot) {
|
|
2379
|
+
const root = requireWorkspaceRoot(workspaceRoot);
|
|
2380
|
+
const candidate = path.resolve(root, input);
|
|
2381
|
+
if (!isPathInside(root, candidate)) {
|
|
2382
|
+
throw new Error('Browser Operator upload path must stay inside the workspace.');
|
|
2383
|
+
}
|
|
2384
|
+
try {
|
|
2385
|
+
const info = fs.lstatSync(candidate);
|
|
2386
|
+
if (info.isSymbolicLink() || !info.isFile())
|
|
2387
|
+
throw new Error('not a regular file');
|
|
2388
|
+
const real = fs.realpathSync(candidate);
|
|
2389
|
+
if (!isPathInside(root, real))
|
|
2390
|
+
throw new Error('escaped workspace');
|
|
2391
|
+
return real;
|
|
2392
|
+
}
|
|
2393
|
+
catch {
|
|
2394
|
+
throw new Error(`Browser Operator upload file is unavailable or unsafe: ${input}`);
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
function redactActionLogEntry(entry) {
|
|
2398
|
+
const cloned = JSON.parse(JSON.stringify(entry));
|
|
2399
|
+
const inputs = cloned.inputs ?? {};
|
|
2400
|
+
const hint = [
|
|
2401
|
+
cloned.title,
|
|
2402
|
+
cloned.reason,
|
|
2403
|
+
inputs.selector,
|
|
2404
|
+
inputs.target,
|
|
2405
|
+
inputs.label,
|
|
2406
|
+
inputs.name,
|
|
2407
|
+
inputs.placeholder,
|
|
2408
|
+
].filter(Boolean).join(' ');
|
|
2409
|
+
if (SENSITIVE_FIELD_HINT.test(hint)) {
|
|
2410
|
+
for (const key of ['value', 'text', 'instruction']) {
|
|
2411
|
+
if (inputs[key] !== undefined)
|
|
2412
|
+
inputs[key] = '[REDACTED]';
|
|
2413
|
+
}
|
|
2414
|
+
}
|
|
2415
|
+
if (inputs.fields && typeof inputs.fields === 'object' && !Array.isArray(inputs.fields)) {
|
|
2416
|
+
inputs.fields = Object.fromEntries(Object.entries(inputs.fields).map(([key, value]) => [
|
|
2417
|
+
key,
|
|
2418
|
+
SENSITIVE_FIELD_HINT.test(key) ? '[REDACTED]' : value,
|
|
2419
|
+
]));
|
|
2420
|
+
}
|
|
2421
|
+
cloned.inputs = inputs;
|
|
2422
|
+
return getDataRedactionEngine().redactObject(cloned);
|
|
2423
|
+
}
|
|
2424
|
+
function redactSessionForProof(session) {
|
|
2425
|
+
const cloned = JSON.parse(JSON.stringify(session));
|
|
2426
|
+
cloned.actionLog = cloned.actionLog.map(redactActionLogEntry);
|
|
2427
|
+
return getDataRedactionEngine().redactObject(cloned);
|
|
2428
|
+
}
|
|
1207
2429
|
//# sourceMappingURL=browser-operator-executor.js.map
|