@duckmind/dm-darwin-x64 0.66.5 → 0.66.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dm +2 -2
- package/extensions/.dm-extensions.json +755 -37
- package/extensions/dm-lens/clients/actionable-warnings.js +63 -11
- package/extensions/dm-lens/clients/advisory-provenance.js +5 -3
- package/extensions/dm-lens/clients/agent-nudge.js +106 -2
- package/extensions/dm-lens/clients/analysis-root.js +103 -0
- package/extensions/dm-lens/clients/ast-grep-client.js +18 -7
- package/extensions/dm-lens/clients/ast-grep-rule-manager.js +35 -12
- package/extensions/dm-lens/clients/biome-client.js +18 -12
- package/extensions/dm-lens/clients/blocker-freshness.js +1 -9
- package/extensions/dm-lens/clients/bounded-pid-file-lock.js +141 -30
- package/extensions/dm-lens/clients/bounded-telemetry.js +3 -0
- package/extensions/dm-lens/clients/cache/rule-cache.js +2 -17
- package/extensions/dm-lens/clients/cache-manager.js +105 -17
- package/extensions/dm-lens/clients/cargo-manifest.js +23 -3
- package/extensions/dm-lens/clients/complexity-client.js +1 -1
- package/extensions/dm-lens/clients/config-core/normalize.js +9 -0
- package/extensions/dm-lens/clients/config-core/schema.js +3 -0
- package/extensions/dm-lens/clients/config-schema.js +105 -2
- package/extensions/dm-lens/clients/confirmed-delete.js +11 -0
- package/extensions/dm-lens/clients/custom-rule-locations.js +28 -0
- package/extensions/dm-lens/clients/dead-code-client.js +81 -12
- package/extensions/dm-lens/clients/deferred-runner-blockers.js +108 -0
- package/extensions/dm-lens/clients/deferred-test-targets.js +31 -0
- package/extensions/dm-lens/clients/degradation-ledger.js +21 -3
- package/extensions/dm-lens/clients/demoted-finding-render.js +5 -2
- package/extensions/dm-lens/clients/dependency-checker.js +13 -4
- package/extensions/dm-lens/clients/diagnostic-line-freshness.js +3 -5
- package/extensions/dm-lens/clients/dispatch/adopted-root-runners.js +22 -0
- package/extensions/dm-lens/clients/dispatch/dispatcher.js +105 -27
- package/extensions/dm-lens/clients/dispatch/facts/comment-facts.js +5 -2
- package/extensions/dm-lens/clients/dispatch/facts/function-facts.js +1 -1
- package/extensions/dm-lens/clients/dispatch/facts/import-facts.js +2 -2
- package/extensions/dm-lens/clients/dispatch/facts/tree-sitter-facts.js +2 -2
- package/extensions/dm-lens/clients/dispatch/facts/try-catch-facts.js +1 -1
- package/extensions/dm-lens/clients/dispatch/finding-policy.js +12 -4
- package/extensions/dm-lens/clients/dispatch/integration.js +60 -15
- package/extensions/dm-lens/clients/dispatch/known-runner-ids.js +13 -0
- package/extensions/dm-lens/clients/dispatch/pending-runner-findings.js +66 -11
- package/extensions/dm-lens/clients/dispatch/plan.js +6 -0
- package/extensions/dm-lens/clients/dispatch/rule-id-normalize.js +9 -2
- package/extensions/dm-lens/clients/dispatch/rule-policy.js +33 -4
- package/extensions/dm-lens/clients/dispatch/runners/ast-grep-napi.js +9 -5
- package/extensions/dm-lens/clients/dispatch/runners/biome-check.js +5 -2
- package/extensions/dm-lens/clients/dispatch/runners/cue-vet.js +7 -3
- package/extensions/dm-lens/clients/dispatch/runners/detekt.js +3 -3
- package/extensions/dm-lens/clients/dispatch/runners/fact-rules.js +3 -3
- package/extensions/dm-lens/clients/dispatch/runners/fish-indent.js +10 -6
- package/extensions/dm-lens/clients/dispatch/runners/gleam-check.js +8 -5
- package/extensions/dm-lens/clients/dispatch/runners/go-vet.js +2 -1
- package/extensions/dm-lens/clients/dispatch/runners/lsp.js +28 -8
- package/extensions/dm-lens/clients/dispatch/runners/oxlint.js +2 -2
- package/extensions/dm-lens/clients/dispatch/runners/php-lint.js +6 -7
- package/extensions/dm-lens/clients/dispatch/runners/prisma-validate.js +18 -8
- package/extensions/dm-lens/clients/dispatch/runners/psscriptanalyzer.js +3 -3
- package/extensions/dm-lens/clients/dispatch/runners/pyright.js +1 -1
- package/extensions/dm-lens/clients/dispatch/runners/rust-clippy.js +25 -6
- package/extensions/dm-lens/clients/dispatch/runners/shellcheck.js +71 -4
- package/extensions/dm-lens/clients/dispatch/runners/shfmt.js +5 -1
- package/extensions/dm-lens/clients/dispatch/runners/spellcheck.js +3 -3
- package/extensions/dm-lens/clients/dispatch/runners/swiftlint.js +3 -3
- package/extensions/dm-lens/clients/dispatch/runners/taplo.js +17 -5
- package/extensions/dm-lens/clients/dispatch/runners/tree-sitter.js +12 -5
- package/extensions/dm-lens/clients/dispatch/runners/trivy-config.js +3 -3
- package/extensions/dm-lens/clients/dispatch/runners/utils/runner-helpers.js +127 -46
- package/extensions/dm-lens/clients/dispatch/runners/utils/tool-failure.js +11 -6
- package/extensions/dm-lens/clients/dispatch/runners/vale.js +3 -3
- package/extensions/dm-lens/clients/dispatch/runners/yaml-rule-parser.js +8 -1
- package/extensions/dm-lens/clients/dispatch/types.js +21 -1
- package/extensions/dm-lens/clients/dispatch/utils/format-utils.js +13 -0
- package/extensions/dm-lens/clients/effective-config.js +14 -3
- package/extensions/dm-lens/clients/ephemeral-root.js +71 -0
- package/extensions/dm-lens/clients/file-kinds.js +9 -0
- package/extensions/dm-lens/clients/file-mutation-queue.js +95 -0
- package/extensions/dm-lens/clients/file-utils.js +87 -8
- package/extensions/dm-lens/clients/finding-delivery-gate.js +5 -2
- package/extensions/dm-lens/clients/fix-run-restore.js +416 -0
- package/extensions/dm-lens/clients/format-events-publish.js +82 -2
- package/extensions/dm-lens/clients/format-service.js +10 -5
- package/extensions/dm-lens/clients/formatters.js +29 -12
- package/extensions/dm-lens/clients/generation-guard.js +50 -8
- package/extensions/dm-lens/clients/generation-lock.js +184 -0
- package/extensions/dm-lens/clients/git-guard.js +19 -1
- package/extensions/dm-lens/clients/gitleaks-client.js +13 -4
- package/extensions/dm-lens/clients/grammar-source.js +5 -0
- package/extensions/dm-lens/clients/grammar-wasm-imports.js +48 -0
- package/extensions/dm-lens/clients/gzip-stage-write.js +15 -7
- package/extensions/dm-lens/clients/hard-failure-summary.js +28 -0
- package/extensions/dm-lens/clients/hook-budgets.js +1 -0
- package/extensions/dm-lens/clients/inline-blocker-fields.js +8 -0
- package/extensions/dm-lens/clients/install-diagnostics.js +31 -16
- package/extensions/dm-lens/clients/installer/index.js +238 -58
- package/extensions/dm-lens/clients/instance-reaper.js +164 -52
- package/extensions/dm-lens/clients/instance-registry-lock.js +117 -76
- package/extensions/dm-lens/clients/instance-registry-tail.js +17 -0
- package/extensions/dm-lens/clients/instance-registry.js +248 -91
- package/extensions/dm-lens/clients/io-bridge-contract.js +7 -0
- package/extensions/dm-lens/clients/io-bridge.js +372 -0
- package/extensions/dm-lens/clients/jscpd-client.js +83 -35
- package/extensions/dm-lens/clients/knip-client.js +75 -6
- package/extensions/dm-lens/clients/knip-scan-roots.js +29 -0
- package/extensions/dm-lens/clients/language-policy.js +2 -0
- package/extensions/dm-lens/clients/language-profile.js +4 -1
- package/extensions/dm-lens/clients/language-registry.js +4 -1
- package/extensions/dm-lens/clients/latency-logger.js +11 -1
- package/extensions/dm-lens/clients/lens-config.js +10 -1
- package/extensions/dm-lens/clients/lens-engine.js +1 -1
- package/extensions/dm-lens/clients/lens-flag-registry.js +14 -24
- package/extensions/dm-lens/clients/lsp/aggregation.js +9 -8
- package/extensions/dm-lens/clients/lsp/auxiliary-lifecycle.js +23 -0
- package/extensions/dm-lens/clients/lsp/capabilities.js +98 -0
- package/extensions/dm-lens/clients/lsp/cascade-tier.js +8 -3
- package/extensions/dm-lens/clients/lsp/client.js +282 -48
- package/extensions/dm-lens/clients/lsp/config.js +247 -15
- package/extensions/dm-lens/clients/lsp/document-drift.js +23 -11
- package/extensions/dm-lens/clients/lsp/edits.js +137 -85
- package/extensions/dm-lens/clients/lsp/grouping.js +38 -0
- package/extensions/dm-lens/clients/lsp/index.js +484 -275
- package/extensions/dm-lens/clients/lsp/launch.js +106 -6
- package/extensions/dm-lens/clients/lsp/pending-aux-coverage.js +37 -7
- package/extensions/dm-lens/clients/lsp/resolved-config.js +188 -0
- package/extensions/dm-lens/clients/lsp/server-covers.js +8 -0
- package/extensions/dm-lens/clients/lsp/server-traits.js +39 -0
- package/extensions/dm-lens/clients/lsp/server.js +259 -34
- package/extensions/dm-lens/clients/lsp/service-singleton.js +59 -0
- package/extensions/dm-lens/clients/lsp/session-roots.js +1 -1
- package/extensions/dm-lens/clients/lsp/wait-policy/classification.js +2 -1
- package/extensions/dm-lens/clients/lsp/wait-policy/strategies.js +25 -4
- package/extensions/dm-lens/clients/lsp/workspace-diagnostics-cache.js +6 -3
- package/extensions/dm-lens/clients/lsp-budget.js +9 -5
- package/extensions/dm-lens/clients/lsp-document-symbols.js +1 -1
- package/extensions/dm-lens/clients/lsp-lazy.js +1 -1
- package/extensions/dm-lens/clients/lsp-mutation.js +44 -8
- package/extensions/dm-lens/clients/lsp-status.js +5 -7
- package/extensions/dm-lens/clients/mcp/analyze.js +24 -11
- package/extensions/dm-lens/clients/mcp/ipc.js +26 -7
- package/extensions/dm-lens/clients/mcp/session.js +1 -1
- package/extensions/dm-lens/clients/memory-sampler.js +48 -3
- package/extensions/dm-lens/clients/module-report-lsp.js +1 -1
- package/extensions/dm-lens/clients/module-report.js +9 -3
- package/extensions/dm-lens/clients/mutating-tool.js +12 -3
- package/extensions/dm-lens/clients/mutation-attribution.js +8 -0
- package/extensions/dm-lens/clients/mutation-bridge.js +181 -48
- package/extensions/dm-lens/clients/ndjson-logger.js +33 -0
- package/extensions/dm-lens/clients/observed-mutation-sources.js +1 -1
- package/extensions/dm-lens/clients/observed-mutation.js +40 -20
- package/extensions/dm-lens/clients/opaque-mutation-scan.js +40 -13
- package/extensions/dm-lens/clients/opengrep-client.js +6 -3
- package/extensions/dm-lens/clients/package-manager.js +61 -6
- package/extensions/dm-lens/clients/path-utils.js +77 -18
- package/extensions/dm-lens/clients/performance-report.js +1 -1
- package/extensions/dm-lens/clients/persist-worker-stats.js +8 -0
- package/extensions/dm-lens/clients/persistent-reverify.js +5 -1
- package/extensions/dm-lens/clients/pipeline.js +310 -114
- package/extensions/dm-lens/clients/probe-home-state.js +6 -1
- package/extensions/dm-lens/clients/process-bridge.js +28 -0
- package/extensions/dm-lens/clients/process-snapshot.js +115 -2
- package/extensions/dm-lens/clients/project-changes.js +81 -19
- package/extensions/dm-lens/clients/project-diagnostics/fresh-fetch.js +18 -13
- package/extensions/dm-lens/clients/project-lens-config.js +32 -5
- package/extensions/dm-lens/clients/project-scale.js +1 -1
- package/extensions/dm-lens/clients/project-snapshot-fingerprint.js +17 -12
- package/extensions/dm-lens/clients/project-snapshot-persist-worker.js +2 -3
- package/extensions/dm-lens/clients/project-snapshot.js +229 -64
- package/extensions/dm-lens/clients/python-environment.js +44 -2
- package/extensions/dm-lens/clients/quiet-window.js +6 -3
- package/extensions/dm-lens/clients/read-bridge.js +28 -20
- package/extensions/dm-lens/clients/read-expansion.js +1 -1
- package/extensions/dm-lens/clients/read-guard-branch.js +129 -0
- package/extensions/dm-lens/clients/read-guard-logger.js +11 -3
- package/extensions/dm-lens/clients/read-guard-tool-lines.js +16 -8
- package/extensions/dm-lens/clients/read-guard.js +516 -176
- package/extensions/dm-lens/clients/review-graph/builder.js +132 -54
- package/extensions/dm-lens/clients/review-graph/git-identity.js +59 -1
- package/extensions/dm-lens/clients/review-graph/import-resolvers.js +6 -8
- package/extensions/dm-lens/clients/runtime-agent-end.js +271 -68
- package/extensions/dm-lens/clients/runtime-coordinator.js +386 -74
- package/extensions/dm-lens/clients/runtime-session.js +174 -31
- package/extensions/dm-lens/clients/runtime-tool-call.js +92 -17
- package/extensions/dm-lens/clients/runtime-tool-result.js +477 -137
- package/extensions/dm-lens/clients/runtime-turn.js +949 -355
- package/extensions/dm-lens/clients/safe-spawn.js +12 -4
- package/extensions/dm-lens/clients/scanner-temp-root.js +8 -0
- package/extensions/dm-lens/clients/scratch-tree-policy.js +9 -0
- package/extensions/dm-lens/clients/search-read-registration.js +2 -1
- package/extensions/dm-lens/clients/session-lifecycle.js +120 -18
- package/extensions/dm-lens/clients/session-scope.js +456 -0
- package/extensions/dm-lens/clients/session-state-store.js +23 -20
- package/extensions/dm-lens/clients/sg-runner.js +24 -6
- package/extensions/dm-lens/clients/sgconfig.js +35 -5
- package/extensions/dm-lens/clients/startup-scan.js +10 -2
- package/extensions/dm-lens/clients/test-runner-client.js +258 -48
- package/extensions/dm-lens/clients/test-runner-delivery.js +46 -9
- package/extensions/dm-lens/clients/test-target-roots.js +20 -0
- package/extensions/dm-lens/clients/tool-agreement.js +282 -19
- package/extensions/dm-lens/clients/tool-config.js +1 -0
- package/extensions/dm-lens/clients/tool-event.js +6 -0
- package/extensions/dm-lens/clients/tool-probe.js +8 -0
- package/extensions/dm-lens/clients/tool-set-policy.js +36 -26
- package/extensions/dm-lens/clients/tree-sitter-client.js +304 -34
- package/extensions/dm-lens/clients/tree-sitter-query-loader.js +76 -2
- package/extensions/dm-lens/clients/tree-sitter-shared.js +2 -2
- package/extensions/dm-lens/clients/tree-sitter-symbol-extractor.js +3 -1
- package/extensions/dm-lens/clients/trivy-client.js +40 -7
- package/extensions/dm-lens/clients/turn-end/delivery-holds.js +59 -0
- package/extensions/dm-lens/clients/widget-state.js +36 -2
- package/extensions/dm-lens/clients/word-index.js +73 -5
- package/extensions/dm-lens/clients/workspace-topology.js +11 -4
- package/extensions/dm-lens/clients/write-ordering-guard.js +4 -0
- package/extensions/dm-lens/config/dependency-cruiser-eager-allowlist.json +9 -3
- package/extensions/dm-lens/dist/clients/actionable-warnings-logger.js +24 -0
- package/extensions/dm-lens/dist/clients/actionable-warnings.js +1062 -0
- package/extensions/dm-lens/dist/clients/advisory-provenance.js +387 -0
- package/extensions/dm-lens/dist/clients/agent-behavior-client.js +94 -0
- package/extensions/dm-lens/dist/clients/agent-nudge.js +253 -0
- package/extensions/dm-lens/dist/clients/analysed-root.js +1 -0
- package/extensions/dm-lens/dist/clients/analysis-root.js +100 -0
- package/extensions/dm-lens/dist/clients/ast-grep-client.js +587 -0
- package/extensions/dm-lens/dist/clients/ast-grep-rule-manager.js +137 -0
- package/extensions/dm-lens/dist/clients/ast-grep-tool-logger.js +85 -0
- package/extensions/dm-lens/dist/clients/ast-grep-types.js +1 -0
- package/extensions/dm-lens/dist/clients/ast-grep-yaml-synth.js +109 -0
- package/extensions/dm-lens/dist/clients/atomic-write-staging.js +66 -0
- package/extensions/dm-lens/dist/clients/atomic-write.js +37 -0
- package/extensions/dm-lens/dist/clients/availability-probe-flight.js +11 -0
- package/extensions/dm-lens/dist/clients/bash-file-access.js +830 -0
- package/extensions/dm-lens/dist/clients/biome-client.js +223 -0
- package/extensions/dm-lens/dist/clients/blocker-freshness.js +377 -0
- package/extensions/dm-lens/dist/clients/blocker-past-eof.js +49 -0
- package/extensions/dm-lens/dist/clients/bootstrap.js +246 -0
- package/extensions/dm-lens/dist/clients/bounded-cache.js +105 -0
- package/extensions/dm-lens/dist/clients/bounded-pid-file-lock.js +275 -0
- package/extensions/dm-lens/dist/clients/bounded-telemetry.js +107 -0
- package/extensions/dm-lens/dist/clients/build-identity.js +45 -0
- package/extensions/dm-lens/dist/clients/bundled-resource-health.js +41 -0
- package/extensions/dm-lens/dist/clients/bus-events-logger.js +48 -0
- package/extensions/dm-lens/dist/clients/bus-publish.js +117 -0
- package/extensions/dm-lens/dist/clients/cache/rule-cache.js +87 -0
- package/extensions/dm-lens/dist/clients/cache-manager.js +428 -0
- package/extensions/dm-lens/dist/clients/cache-observability.js +847 -0
- package/extensions/dm-lens/dist/clients/call-graph.js +628 -0
- package/extensions/dm-lens/dist/clients/cargo-manifest.js +171 -0
- package/extensions/dm-lens/dist/clients/cascade-budget.js +52 -0
- package/extensions/dm-lens/dist/clients/cascade-format.js +160 -0
- package/extensions/dm-lens/dist/clients/cascade-logger.js +22 -0
- package/extensions/dm-lens/dist/clients/cascade-types.js +1 -0
- package/extensions/dm-lens/dist/clients/child-unref.js +59 -0
- package/extensions/dm-lens/dist/clients/code-quality-warnings.js +192 -0
- package/extensions/dm-lens/dist/clients/codebase-model.js +110 -0
- package/extensions/dm-lens/dist/clients/collateral-test-role.js +8 -0
- package/extensions/dm-lens/dist/clients/complexity-client.js +398 -0
- package/extensions/dm-lens/dist/clients/config-core/deny.js +117 -0
- package/extensions/dm-lens/dist/clients/config-core/index.js +2 -0
- package/extensions/dm-lens/dist/clients/config-core/merge.js +228 -0
- package/extensions/dm-lens/dist/clients/config-core/normalize.js +226 -0
- package/extensions/dm-lens/dist/clients/config-core/process-spec.js +147 -0
- package/extensions/dm-lens/dist/clients/config-core/provenance.js +54 -0
- package/extensions/dm-lens/dist/clients/config-core/records.js +79 -0
- package/extensions/dm-lens/dist/clients/config-core/resolve.js +48 -0
- package/extensions/dm-lens/dist/clients/config-core/safe-object.js +22 -0
- package/extensions/dm-lens/dist/clients/config-core/schema.js +93 -0
- package/extensions/dm-lens/dist/clients/config-diagnostic-codes.js +90 -0
- package/extensions/dm-lens/dist/clients/config-locations.js +175 -0
- package/extensions/dm-lens/dist/clients/config-resolve.js +359 -0
- package/extensions/dm-lens/dist/clients/config-schema.js +230 -0
- package/extensions/dm-lens/dist/clients/config-warn.js +146 -0
- package/extensions/dm-lens/dist/clients/confirmed-delete.js +11 -0
- package/extensions/dm-lens/dist/clients/console-guard-install.js +4 -0
- package/extensions/dm-lens/dist/clients/cooperative-budget.js +36 -0
- package/extensions/dm-lens/dist/clients/custom-rule-locations.js +28 -0
- package/extensions/dm-lens/dist/clients/dead-code-client.js +408 -0
- package/extensions/dm-lens/dist/clients/dead-code-logger.js +18 -0
- package/extensions/dm-lens/dist/clients/deadline-utils.js +117 -0
- package/extensions/dm-lens/dist/clients/debug-handles.js +121 -0
- package/extensions/dm-lens/dist/clients/debug-heap.js +80 -0
- package/extensions/dm-lens/dist/clients/deferred-lsp-work.js +33 -0
- package/extensions/dm-lens/dist/clients/deferred-runner-blockers.js +106 -0
- package/extensions/dm-lens/dist/clients/deferred-test-targets.js +31 -0
- package/extensions/dm-lens/dist/clients/degradation-ledger.js +289 -0
- package/extensions/dm-lens/dist/clients/demoted-finding-render.js +64 -0
- package/extensions/dm-lens/dist/clients/dependency-checker.js +534 -0
- package/extensions/dm-lens/dist/clients/deps/ast-grep-napi.js +17 -0
- package/extensions/dm-lens/dist/clients/deps/dm-host-deps.js +10 -0
- package/extensions/dm-lens/dist/clients/deps/dm-tui-compat.js +58 -0
- package/extensions/dm-lens/dist/clients/deps/js-yaml.js +7 -0
- package/extensions/dm-lens/dist/clients/deps/minimatch.js +6 -0
- package/extensions/dm-lens/dist/clients/deps/pidusage.js +5 -0
- package/extensions/dm-lens/dist/clients/deps/typebox.js +5 -0
- package/extensions/dm-lens/dist/clients/deps/vscode-jsonrpc.js +8 -0
- package/extensions/dm-lens/dist/clients/deps/web-tree-sitter.js +11 -0
- package/extensions/dm-lens/dist/clients/diagnostic-dispositions.js +318 -0
- package/extensions/dm-lens/dist/clients/diagnostic-line-freshness.js +142 -0
- package/extensions/dm-lens/dist/clients/diagnostic-logger.js +60 -0
- package/extensions/dm-lens/dist/clients/diagnostic-tracker.js +89 -0
- package/extensions/dm-lens/dist/clients/diagnostics-publish.js +134 -0
- package/extensions/dm-lens/dist/clients/dispatch/adopted-root-runners.js +22 -0
- package/extensions/dm-lens/dist/clients/dispatch/ast-grep-catalog.js +16 -0
- package/extensions/dm-lens/dist/clients/dispatch/auxiliary-lsp.js +158 -0
- package/extensions/dm-lens/dist/clients/dispatch/collect-later-tier.js +25 -0
- package/extensions/dm-lens/dist/clients/dispatch/diagnostic-taxonomy.js +58 -0
- package/extensions/dm-lens/dist/clients/dispatch/dispatcher.js +1017 -0
- package/extensions/dm-lens/dist/clients/dispatch/fact-provider-types.js +1 -0
- package/extensions/dm-lens/dist/clients/dispatch/fact-rule-runner.js +17 -0
- package/extensions/dm-lens/dist/clients/dispatch/fact-runner.js +18 -0
- package/extensions/dm-lens/dist/clients/dispatch/fact-scheduler.js +52 -0
- package/extensions/dm-lens/dist/clients/dispatch/fact-store.js +199 -0
- package/extensions/dm-lens/dist/clients/dispatch/facts/comment-facts.js +23 -0
- package/extensions/dm-lens/dist/clients/dispatch/facts/file-content.js +18 -0
- package/extensions/dm-lens/dist/clients/dispatch/facts/function-facts.js +281 -0
- package/extensions/dm-lens/dist/clients/dispatch/facts/import-facts.js +169 -0
- package/extensions/dm-lens/dist/clients/dispatch/facts/tree-sitter-facts.js +19 -0
- package/extensions/dm-lens/dist/clients/dispatch/facts/try-catch-facts.js +95 -0
- package/extensions/dm-lens/dist/clients/dispatch/finding-policy.js +164 -0
- package/extensions/dm-lens/dist/clients/dispatch/indent-detect.js +227 -0
- package/extensions/dm-lens/dist/clients/dispatch/inline-suppressions.js +52 -0
- package/extensions/dm-lens/dist/clients/dispatch/integration.js +1502 -0
- package/extensions/dm-lens/dist/clients/dispatch/known-runner-ids.js +13 -0
- package/extensions/dm-lens/dist/clients/dispatch/lazy.js +8 -0
- package/extensions/dm-lens/dist/clients/dispatch/pending-runner-findings.js +130 -0
- package/extensions/dm-lens/dist/clients/dispatch/plan.js +284 -0
- package/extensions/dm-lens/dist/clients/dispatch/priorities.js +14 -0
- package/extensions/dm-lens/dist/clients/dispatch/rule-id-normalize.js +49 -0
- package/extensions/dm-lens/dist/clients/dispatch/rule-ignores.js +21 -0
- package/extensions/dm-lens/dist/clients/dispatch/rule-policy.js +102 -0
- package/extensions/dm-lens/dist/clients/dispatch/rules/async-noise.js +31 -0
- package/extensions/dm-lens/dist/clients/dispatch/rules/async-unnecessary-wrapper.js +27 -0
- package/extensions/dm-lens/dist/clients/dispatch/rules/cors-wildcard.js +35 -0
- package/extensions/dm-lens/dist/clients/dispatch/rules/error-obscuring.js +29 -0
- package/extensions/dm-lens/dist/clients/dispatch/rules/error-swallowing.js +29 -0
- package/extensions/dm-lens/dist/clients/dispatch/rules/framework-call-noise.js +31 -0
- package/extensions/dm-lens/dist/clients/dispatch/rules/high-complexity.js +56 -0
- package/extensions/dm-lens/dist/clients/dispatch/rules/high-fan-out.js +45 -0
- package/extensions/dm-lens/dist/clients/dispatch/rules/high-import-coupling.js +31 -0
- package/extensions/dm-lens/dist/clients/dispatch/rules/missing-error-propagation.js +45 -0
- package/extensions/dm-lens/dist/clients/dispatch/rules/no-commented-credentials.js +46 -0
- package/extensions/dm-lens/dist/clients/dispatch/rules/pass-through-wrappers.js +38 -0
- package/extensions/dm-lens/dist/clients/dispatch/rules/placeholder-comments.js +40 -0
- package/extensions/dm-lens/dist/clients/dispatch/rules/unsafe-boundary.js +101 -0
- package/extensions/dm-lens/dist/clients/dispatch/runner-context.js +46 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/actionlint.js +98 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/ast-grep-napi.js +694 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/biome-check.js +205 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/cpp-check.js +190 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/credo.js +66 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/cue-vet.js +171 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/dart-analyze.js +151 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/detekt.js +157 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/dotnet-build.js +157 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/elixir-check.js +153 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/eslint.js +99 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/fact-rules.js +20 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/fish-indent.js +66 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/gleam-check.js +110 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/go-vet.js +52 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/golangci-lint.js +89 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/hadolint.js +83 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/helm-lint.js +144 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/helm-render.js +593 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/htmlhint.js +103 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/index.js +100 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/javac.js +82 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/ktlint.js +93 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/lsp.js +226 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/markdownlint.js +129 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/mypy.js +70 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/oxlint.js +305 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/php-lint.js +66 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/phpstan.js +90 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/prisma-validate.js +66 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/psscriptanalyzer.js +307 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/pyright.js +118 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/rubocop.js +79 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/ruff.js +69 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/rust-clippy.js +166 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/shellcheck.js +177 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/shfmt.js +85 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/spellcheck.js +74 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/spotbugs.js +208 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/sqlfluff.js +136 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/stylelint.js +118 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/swiftlint.js +143 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/taplo.js +108 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/terragrunt.js +110 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/tflint.js +104 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/tree-sitter.js +521 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/trivy-config.js +155 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils/availability-policy.js +285 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils/candidate-probe.js +61 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils/diagnostic-parsers.js +61 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils/lazy-installer.js +130 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils/runner-helpers.js +1143 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils/spawn-outcome.js +40 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils/tool-failure.js +120 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils/toolchain-availability.js +88 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils.js +8 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/vale.js +106 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/yaml-rule-parser.js +170 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/yamllint.js +83 -0
- package/extensions/dm-lens/dist/clients/dispatch/runners/zig-check.js +72 -0
- package/extensions/dm-lens/dist/clients/dispatch/suppress-writer.js +57 -0
- package/extensions/dm-lens/dist/clients/dispatch/tool-profile.js +30 -0
- package/extensions/dm-lens/dist/clients/dispatch/types.js +27 -0
- package/extensions/dm-lens/dist/clients/dispatch/utils/format-utils.js +58 -0
- package/extensions/dm-lens/dist/clients/dispatch/utils/lsp-diagnostics.js +31 -0
- package/extensions/dm-lens/dist/clients/disposition-logger.js +19 -0
- package/extensions/dm-lens/dist/clients/disposition-publish.js +88 -0
- package/extensions/dm-lens/dist/clients/durable-store.js +77 -0
- package/extensions/dm-lens/dist/clients/effective-config.js +170 -0
- package/extensions/dm-lens/dist/clients/env-utils.js +26 -0
- package/extensions/dm-lens/dist/clients/ephemeral-root.js +67 -0
- package/extensions/dm-lens/dist/clients/error-class.js +3 -0
- package/extensions/dm-lens/dist/clients/eval-timestamp.js +2 -0
- package/extensions/dm-lens/dist/clients/event-loop-hold.js +119 -0
- package/extensions/dm-lens/dist/clients/event-loop-monitor.js +84 -0
- package/extensions/dm-lens/dist/clients/extension-log.js +230 -0
- package/extensions/dm-lens/dist/clients/extension-mode.js +20 -0
- package/extensions/dm-lens/dist/clients/feature-hints.js +88 -0
- package/extensions/dm-lens/dist/clients/file-kinds.js +313 -0
- package/extensions/dm-lens/dist/clients/file-mutation-queue.js +95 -0
- package/extensions/dm-lens/dist/clients/file-role.js +50 -0
- package/extensions/dm-lens/dist/clients/file-time.js +112 -0
- package/extensions/dm-lens/dist/clients/file-utils.js +706 -0
- package/extensions/dm-lens/dist/clients/finding-delivery-gate.js +132 -0
- package/extensions/dm-lens/dist/clients/finding-identity.js +23 -0
- package/extensions/dm-lens/dist/clients/fix-run-restore.js +413 -0
- package/extensions/dm-lens/dist/clients/fix-worklog.js +75 -0
- package/extensions/dm-lens/dist/clients/format-events-publish.js +310 -0
- package/extensions/dm-lens/dist/clients/format-service.js +159 -0
- package/extensions/dm-lens/dist/clients/formatters-lazy.js +8 -0
- package/extensions/dm-lens/dist/clients/formatters.js +1367 -0
- package/extensions/dm-lens/dist/clients/freshness-cadence.js +1 -0
- package/extensions/dm-lens/dist/clients/freshness.js +8 -0
- package/extensions/dm-lens/dist/clients/generated-artifacts.js +209 -0
- package/extensions/dm-lens/dist/clients/generation-guard.js +147 -0
- package/extensions/dm-lens/dist/clients/generation-lock.js +181 -0
- package/extensions/dm-lens/dist/clients/git-guard.js +786 -0
- package/extensions/dm-lens/dist/clients/git-tracked-ignore.js +120 -0
- package/extensions/dm-lens/dist/clients/gitleaks-client.js +290 -0
- package/extensions/dm-lens/dist/clients/go-client.js +47 -0
- package/extensions/dm-lens/dist/clients/govulncheck-client.js +411 -0
- package/extensions/dm-lens/dist/clients/gradle-ktfmt-style.js +177 -0
- package/extensions/dm-lens/dist/clients/grammar-source.js +229 -0
- package/extensions/dm-lens/dist/clients/grammar-wasm-imports.js +48 -0
- package/extensions/dm-lens/dist/clients/gzip-stage-write.js +93 -0
- package/extensions/dm-lens/dist/clients/hard-failure-summary.js +28 -0
- package/extensions/dm-lens/dist/clients/hashline-anchor.js +222 -0
- package/extensions/dm-lens/dist/clients/hook-budgets.js +17 -0
- package/extensions/dm-lens/dist/clients/host-edit-normalize.js +87 -0
- package/extensions/dm-lens/dist/clients/host-ports.js +35 -0
- package/extensions/dm-lens/dist/clients/indent-retarget.js +102 -0
- package/extensions/dm-lens/dist/clients/inline-blocker-dispositions.js +103 -0
- package/extensions/dm-lens/dist/clients/inline-blocker-fields.js +8 -0
- package/extensions/dm-lens/dist/clients/install-diagnostics.js +135 -0
- package/extensions/dm-lens/dist/clients/installer/index.js +3935 -0
- package/extensions/dm-lens/dist/clients/installer/managed-tool-refresh-session.js +17 -0
- package/extensions/dm-lens/dist/clients/installer/managed-tool-refresh.js +522 -0
- package/extensions/dm-lens/dist/clients/instance-reaper-state.js +3 -0
- package/extensions/dm-lens/dist/clients/instance-reaper.js +682 -0
- package/extensions/dm-lens/dist/clients/instance-registry-lock.js +166 -0
- package/extensions/dm-lens/dist/clients/instance-registry-tail.js +17 -0
- package/extensions/dm-lens/dist/clients/instance-registry.js +595 -0
- package/extensions/dm-lens/dist/clients/io-bridge-contract.js +7 -0
- package/extensions/dm-lens/dist/clients/io-bridge.js +357 -0
- package/extensions/dm-lens/dist/clients/jscpd-client.js +300 -0
- package/extensions/dm-lens/dist/clients/json-cache-read.js +25 -0
- package/extensions/dm-lens/dist/clients/knip-client.js +534 -0
- package/extensions/dm-lens/dist/clients/knip-scan-roots.js +26 -0
- package/extensions/dm-lens/dist/clients/language-policy.js +244 -0
- package/extensions/dm-lens/dist/clients/language-profile.js +263 -0
- package/extensions/dm-lens/dist/clients/language-registry.js +427 -0
- package/extensions/dm-lens/dist/clients/latency-logger.js +202 -0
- package/extensions/dm-lens/dist/clients/lazy-import.js +14 -0
- package/extensions/dm-lens/dist/clients/ledger-bounds.js +21 -0
- package/extensions/dm-lens/dist/clients/lens-config.js +246 -0
- package/extensions/dm-lens/dist/clients/lens-engine.js +181 -0
- package/extensions/dm-lens/dist/clients/lens-events.js +105 -0
- package/extensions/dm-lens/dist/clients/lens-flag-registry.js +292 -0
- package/extensions/dm-lens/dist/clients/lens-map.js +980 -0
- package/extensions/dm-lens/dist/clients/live-bus-emitter.js +53 -0
- package/extensions/dm-lens/dist/clients/log-cleanup.js +138 -0
- package/extensions/dm-lens/dist/clients/lsp/aggregation.js +89 -0
- package/extensions/dm-lens/dist/clients/lsp/auxiliary-lifecycle.js +23 -0
- package/extensions/dm-lens/dist/clients/lsp/capabilities.js +94 -0
- package/extensions/dm-lens/dist/clients/lsp/cascade-tier.js +208 -0
- package/extensions/dm-lens/dist/clients/lsp/client.js +2943 -0
- package/extensions/dm-lens/dist/clients/lsp/config.js +471 -0
- package/extensions/dm-lens/dist/clients/lsp/content-limits.js +21 -0
- package/extensions/dm-lens/dist/clients/lsp/diagnostic-binding.js +79 -0
- package/extensions/dm-lens/dist/clients/lsp/document-drift.js +324 -0
- package/extensions/dm-lens/dist/clients/lsp/edits.js +982 -0
- package/extensions/dm-lens/dist/clients/lsp/grouping.js +38 -0
- package/extensions/dm-lens/dist/clients/lsp/index.js +4639 -0
- package/extensions/dm-lens/dist/clients/lsp/inferred-project.js +121 -0
- package/extensions/dm-lens/dist/clients/lsp/jvm-runtime.js +194 -0
- package/extensions/dm-lens/dist/clients/lsp/language.js +23 -0
- package/extensions/dm-lens/dist/clients/lsp/launch.js +564 -0
- package/extensions/dm-lens/dist/clients/lsp/lombok.js +146 -0
- package/extensions/dm-lens/dist/clients/lsp/path-utils.js +1 -0
- package/extensions/dm-lens/dist/clients/lsp/pending-aux-coverage.js +120 -0
- package/extensions/dm-lens/dist/clients/lsp/position-encoding.js +28 -0
- package/extensions/dm-lens/dist/clients/lsp/resolved-config.js +183 -0
- package/extensions/dm-lens/dist/clients/lsp/ruby-drive-dirs.js +42 -0
- package/extensions/dm-lens/dist/clients/lsp/server-covers.js +8 -0
- package/extensions/dm-lens/dist/clients/lsp/server-traits.js +39 -0
- package/extensions/dm-lens/dist/clients/lsp/server.js +2640 -0
- package/extensions/dm-lens/dist/clients/lsp/service-singleton.js +59 -0
- package/extensions/dm-lens/dist/clients/lsp/session-roots.js +52 -0
- package/extensions/dm-lens/dist/clients/lsp/spawn-history.js +15 -0
- package/extensions/dm-lens/dist/clients/lsp/sync-kind.js +30 -0
- package/extensions/dm-lens/dist/clients/lsp/tsserver-sync.js +156 -0
- package/extensions/dm-lens/dist/clients/lsp/wait-policy/capability-snapshot.js +1 -0
- package/extensions/dm-lens/dist/clients/lsp/wait-policy/classification.js +37 -0
- package/extensions/dm-lens/dist/clients/lsp/wait-policy/index.js +3 -0
- package/extensions/dm-lens/dist/clients/lsp/wait-policy/strategies.js +196 -0
- package/extensions/dm-lens/dist/clients/lsp/watch-queue.js +40 -0
- package/extensions/dm-lens/dist/clients/lsp/workspace-diagnostics-cache.js +270 -0
- package/extensions/dm-lens/dist/clients/lsp/workspace-diagnostics-session.js +7 -0
- package/extensions/dm-lens/dist/clients/lsp/workspace-sweep-hold.js +93 -0
- package/extensions/dm-lens/dist/clients/lsp-budget.js +87 -0
- package/extensions/dm-lens/dist/clients/lsp-document-symbols.js +93 -0
- package/extensions/dm-lens/dist/clients/lsp-lazy.js +8 -0
- package/extensions/dm-lens/dist/clients/lsp-mutation.js +309 -0
- package/extensions/dm-lens/dist/clients/lsp-status.js +35 -0
- package/extensions/dm-lens/dist/clients/map-with-concurrency.js +20 -0
- package/extensions/dm-lens/dist/clients/mcp/analyze.js +265 -0
- package/extensions/dm-lens/dist/clients/mcp/host-shim.js +14 -0
- package/extensions/dm-lens/dist/clients/mcp/ipc.js +321 -0
- package/extensions/dm-lens/dist/clients/mcp/review.js +137 -0
- package/extensions/dm-lens/dist/clients/mcp/session.js +305 -0
- package/extensions/dm-lens/dist/clients/memory-sampler.js +145 -0
- package/extensions/dm-lens/dist/clients/message-end-attribution.js +18 -0
- package/extensions/dm-lens/dist/clients/metrics-client.js +80 -0
- package/extensions/dm-lens/dist/clients/metrics-history.js +255 -0
- package/extensions/dm-lens/dist/clients/middle-man-analysis.js +161 -0
- package/extensions/dm-lens/dist/clients/model-provider.js +31 -0
- package/extensions/dm-lens/dist/clients/module-report-lsp.js +140 -0
- package/extensions/dm-lens/dist/clients/module-report.js +1648 -0
- package/extensions/dm-lens/dist/clients/mutating-tool.js +386 -0
- package/extensions/dm-lens/dist/clients/mutation-attribution.js +176 -0
- package/extensions/dm-lens/dist/clients/mutation-bridge.js +231 -0
- package/extensions/dm-lens/dist/clients/ndjson-logger.js +504 -0
- package/extensions/dm-lens/dist/clients/observed-mutation-sources.js +43 -0
- package/extensions/dm-lens/dist/clients/observed-mutation.js +729 -0
- package/extensions/dm-lens/dist/clients/oldtext-autopatch.js +100 -0
- package/extensions/dm-lens/dist/clients/opaque-mutation-scan.js +340 -0
- package/extensions/dm-lens/dist/clients/opengrep-client.js +219 -0
- package/extensions/dm-lens/dist/clients/opengrep-config.js +52 -0
- package/extensions/dm-lens/dist/clients/package-manager.js +358 -0
- package/extensions/dm-lens/dist/clients/package-root.js +25 -0
- package/extensions/dm-lens/dist/clients/partial-edit-apply.js +337 -0
- package/extensions/dm-lens/dist/clients/path-attribution-telemetry.js +31 -0
- package/extensions/dm-lens/dist/clients/path-keyed-map.js +57 -0
- package/extensions/dm-lens/dist/clients/path-utils.js +535 -0
- package/extensions/dm-lens/dist/clients/performance-report.js +291 -0
- package/extensions/dm-lens/dist/clients/persist-debounce.js +37 -0
- package/extensions/dm-lens/dist/clients/persist-worker-stats.js +8 -0
- package/extensions/dm-lens/dist/clients/persistent-reverify.js +166 -0
- package/extensions/dm-lens/dist/clients/php-cs-fixer-config.js +15 -0
- package/extensions/dm-lens/dist/clients/pipeline.js +1279 -0
- package/extensions/dm-lens/dist/clients/post-autofix-notice.js +19 -0
- package/extensions/dm-lens/dist/clients/print-mode.js +3 -0
- package/extensions/dm-lens/dist/clients/probe-home-state.js +67 -0
- package/extensions/dm-lens/dist/clients/process-bridge.js +48 -0
- package/extensions/dm-lens/dist/clients/process-singletons.js +69 -0
- package/extensions/dm-lens/dist/clients/process-snapshot.js +130 -0
- package/extensions/dm-lens/dist/clients/project-changes.js +174 -0
- package/extensions/dm-lens/dist/clients/project-conventions.js +152 -0
- package/extensions/dm-lens/dist/clients/project-diagnostics/cache.js +91 -0
- package/extensions/dm-lens/dist/clients/project-diagnostics/extractors.js +53 -0
- package/extensions/dm-lens/dist/clients/project-diagnostics/fresh-fetch.js +413 -0
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/call-graph-impact.js +64 -0
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/dead-code.js +38 -0
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/gitleaks.js +21 -0
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/govulncheck.js +23 -0
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/jscpd.js +28 -0
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/knip.js +45 -0
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/madge.js +34 -0
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/opengrep.js +32 -0
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/runner-findings.js +79 -0
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/trivy.js +41 -0
- package/extensions/dm-lens/dist/clients/project-diagnostics/scanner.js +349 -0
- package/extensions/dm-lens/dist/clients/project-diagnostics/types.js +1 -0
- package/extensions/dm-lens/dist/clients/project-lens-config.js +464 -0
- package/extensions/dm-lens/dist/clients/project-report.js +527 -0
- package/extensions/dm-lens/dist/clients/project-scale.js +60 -0
- package/extensions/dm-lens/dist/clients/project-scan-policy.js +4 -0
- package/extensions/dm-lens/dist/clients/project-snapshot-fingerprint.js +44 -0
- package/extensions/dm-lens/dist/clients/project-snapshot-persist-worker.js +13 -0
- package/extensions/dm-lens/dist/clients/project-snapshot.js +1333 -0
- package/extensions/dm-lens/dist/clients/project-trust.js +104 -0
- package/extensions/dm-lens/dist/clients/python-environment.js +162 -0
- package/extensions/dm-lens/dist/clients/python-provenance.js +551 -0
- package/extensions/dm-lens/dist/clients/quiet-window-config.js +16 -0
- package/extensions/dm-lens/dist/clients/quiet-window.js +129 -0
- package/extensions/dm-lens/dist/clients/read-bridge.js +53 -0
- package/extensions/dm-lens/dist/clients/read-expansion.js +218 -0
- package/extensions/dm-lens/dist/clients/read-guard-branch.js +126 -0
- package/extensions/dm-lens/dist/clients/read-guard-logger.js +186 -0
- package/extensions/dm-lens/dist/clients/read-guard-tool-lines.js +1050 -0
- package/extensions/dm-lens/dist/clients/read-guard.js +1429 -0
- package/extensions/dm-lens/dist/clients/recent-touches.js +126 -0
- package/extensions/dm-lens/dist/clients/redact/secrets.js +386 -0
- package/extensions/dm-lens/dist/clients/resource-sampler.js +344 -0
- package/extensions/dm-lens/dist/clients/reverse-deps.js +227 -0
- package/extensions/dm-lens/dist/clients/review-graph/builder.js +3708 -0
- package/extensions/dm-lens/dist/clients/review-graph/format.js +30 -0
- package/extensions/dm-lens/dist/clients/review-graph/git-identity.js +168 -0
- package/extensions/dm-lens/dist/clients/review-graph/import-resolvers.js +323 -0
- package/extensions/dm-lens/dist/clients/review-graph/persist-worker.js +8 -0
- package/extensions/dm-lens/dist/clients/review-graph/query.js +195 -0
- package/extensions/dm-lens/dist/clients/review-graph/revision-drift.js +3 -0
- package/extensions/dm-lens/dist/clients/review-graph/service.js +60 -0
- package/extensions/dm-lens/dist/clients/review-graph/shared-extraction-ir.js +54 -0
- package/extensions/dm-lens/dist/clients/review-graph/symbol-id.js +29 -0
- package/extensions/dm-lens/dist/clients/review-graph/tsconfig-paths.js +253 -0
- package/extensions/dm-lens/dist/clients/review-graph/types.js +1 -0
- package/extensions/dm-lens/dist/clients/review-graph/workspace-modules.js +374 -0
- package/extensions/dm-lens/dist/clients/review-graph-logger.js +51 -0
- package/extensions/dm-lens/dist/clients/ruff-client.js +109 -0
- package/extensions/dm-lens/dist/clients/rules-scanner.js +113 -0
- package/extensions/dm-lens/dist/clients/run-duration.js +9 -0
- package/extensions/dm-lens/dist/clients/runtime-agent-end.js +800 -0
- package/extensions/dm-lens/dist/clients/runtime-config.js +39 -0
- package/extensions/dm-lens/dist/clients/runtime-context.js +155 -0
- package/extensions/dm-lens/dist/clients/runtime-coordinator.js +1117 -0
- package/extensions/dm-lens/dist/clients/runtime-session.js +1768 -0
- package/extensions/dm-lens/dist/clients/runtime-tool-call.js +935 -0
- package/extensions/dm-lens/dist/clients/runtime-tool-result.js +1630 -0
- package/extensions/dm-lens/dist/clients/runtime-turn.js +2900 -0
- package/extensions/dm-lens/dist/clients/rust-client.js +48 -0
- package/extensions/dm-lens/dist/clients/safe-spawn.js +1275 -0
- package/extensions/dm-lens/dist/clients/sanitize.js +174 -0
- package/extensions/dm-lens/dist/clients/scan-utils.js +7 -0
- package/extensions/dm-lens/dist/clients/scanner-temp-root.js +8 -0
- package/extensions/dm-lens/dist/clients/scratch-tree-policy.js +63 -0
- package/extensions/dm-lens/dist/clients/search-read-registration.js +60 -0
- package/extensions/dm-lens/dist/clients/secret-findings.js +69 -0
- package/extensions/dm-lens/dist/clients/security-scan-client.js +208 -0
- package/extensions/dm-lens/dist/clients/session-event-guard.js +111 -0
- package/extensions/dm-lens/dist/clients/session-lifecycle.js +269 -0
- package/extensions/dm-lens/dist/clients/session-scope.js +451 -0
- package/extensions/dm-lens/dist/clients/session-start-observability.js +47 -0
- package/extensions/dm-lens/dist/clients/session-state-store.js +66 -0
- package/extensions/dm-lens/dist/clients/session-summary.js +8 -0
- package/extensions/dm-lens/dist/clients/sessionstart-logger.js +22 -0
- package/extensions/dm-lens/dist/clients/sg-runner.js +645 -0
- package/extensions/dm-lens/dist/clients/sgconfig.js +306 -0
- package/extensions/dm-lens/dist/clients/shared-checkout-guard.js +177 -0
- package/extensions/dm-lens/dist/clients/single-flight.js +52 -0
- package/extensions/dm-lens/dist/clients/situational-tool-telemetry.js +85 -0
- package/extensions/dm-lens/dist/clients/skills-resolver.js +38 -0
- package/extensions/dm-lens/dist/clients/slow-fs.js +77 -0
- package/extensions/dm-lens/dist/clients/smells-rollup.js +118 -0
- package/extensions/dm-lens/dist/clients/source-filter.js +320 -0
- package/extensions/dm-lens/dist/clients/source-walker.js +96 -0
- package/extensions/dm-lens/dist/clients/spawn-output-cap.js +35 -0
- package/extensions/dm-lens/dist/clients/spawn-timeout-cooldown.js +51 -0
- package/extensions/dm-lens/dist/clients/stale-marker.js +1 -0
- package/extensions/dm-lens/dist/clients/startup-scan.js +230 -0
- package/extensions/dm-lens/dist/clients/startup-timing.js +67 -0
- package/extensions/dm-lens/dist/clients/string-utils.js +6 -0
- package/extensions/dm-lens/dist/clients/subagent-mode.js +40 -0
- package/extensions/dm-lens/dist/clients/symbol-containment.js +16 -0
- package/extensions/dm-lens/dist/clients/symbol-types.js +1 -0
- package/extensions/dm-lens/dist/clients/test-runner-client.js +1697 -0
- package/extensions/dm-lens/dist/clients/test-runner-delivery.js +293 -0
- package/extensions/dm-lens/dist/clients/test-target-roots.js +17 -0
- package/extensions/dm-lens/dist/clients/todo-scanner.js +164 -0
- package/extensions/dm-lens/dist/clients/tool-agreement.js +640 -0
- package/extensions/dm-lens/dist/clients/tool-config.js +219 -0
- package/extensions/dm-lens/dist/clients/tool-cwd.js +235 -0
- package/extensions/dm-lens/dist/clients/tool-definition.js +22 -0
- package/extensions/dm-lens/dist/clients/tool-event.js +24 -0
- package/extensions/dm-lens/dist/clients/tool-policy.js +2393 -0
- package/extensions/dm-lens/dist/clients/tool-probe.js +13 -0
- package/extensions/dm-lens/dist/clients/tool-render.js +79 -0
- package/extensions/dm-lens/dist/clients/tool-set-policy.js +77 -0
- package/extensions/dm-lens/dist/clients/tree-sitter-cache.js +206 -0
- package/extensions/dm-lens/dist/clients/tree-sitter-client.js +3057 -0
- package/extensions/dm-lens/dist/clients/tree-sitter-logger.js +77 -0
- package/extensions/dm-lens/dist/clients/tree-sitter-navigator.js +198 -0
- package/extensions/dm-lens/dist/clients/tree-sitter-query-loader.js +389 -0
- package/extensions/dm-lens/dist/clients/tree-sitter-shared.js +87 -0
- package/extensions/dm-lens/dist/clients/tree-sitter-symbol-extractor.js +959 -0
- package/extensions/dm-lens/dist/clients/trivy-client.js +335 -0
- package/extensions/dm-lens/dist/clients/tui-fit.js +26 -0
- package/extensions/dm-lens/dist/clients/turn-context.js +48 -0
- package/extensions/dm-lens/dist/clients/turn-end/delivery-holds.js +59 -0
- package/extensions/dm-lens/dist/clients/turn-end/lane.js +1 -0
- package/extensions/dm-lens/dist/clients/turn-end/lanes/govulncheck.js +54 -0
- package/extensions/dm-lens/dist/clients/turn-end/lanes/secrets.js +131 -0
- package/extensions/dm-lens/dist/clients/turn-summary-render.js +56 -0
- package/extensions/dm-lens/dist/clients/turn-summary.js +84 -0
- package/extensions/dm-lens/dist/clients/typos-config.js +9 -0
- package/extensions/dm-lens/dist/clients/user-notify.js +15 -0
- package/extensions/dm-lens/dist/clients/vanished-instance-marker.js +18 -0
- package/extensions/dm-lens/dist/clients/warm-attach.js +210 -0
- package/extensions/dm-lens/dist/clients/widget-state.js +997 -0
- package/extensions/dm-lens/dist/clients/word-index-logger.js +21 -0
- package/extensions/dm-lens/dist/clients/word-index-store.js +222 -0
- package/extensions/dm-lens/dist/clients/word-index.js +1494 -0
- package/extensions/dm-lens/dist/clients/workspace-topology.js +268 -0
- package/extensions/dm-lens/dist/clients/write-ordering-guard.js +28 -0
- package/extensions/dm-lens/dist/clients/zizmor-config.js +160 -0
- package/extensions/dm-lens/dist/i18n.js +67 -0
- package/extensions/dm-lens/dist/index.js +1973 -0
- package/extensions/dm-lens/dist/mcp/analyze-cli.js +205 -0
- package/extensions/dm-lens/dist/mcp/build-staleness.js +55 -0
- package/extensions/dm-lens/dist/mcp/cli.js +96 -0
- package/extensions/dm-lens/dist/mcp/server.js +1239 -0
- package/extensions/dm-lens/dist/mcp/tool-arguments.js +134 -0
- package/extensions/dm-lens/dist/mcp/worker.js +41 -0
- package/extensions/dm-lens/dist/scripts/lib/process-scan.mjs +375 -0
- package/extensions/dm-lens/dist/scripts/lib/skills-predicate.mjs +53 -0
- package/extensions/dm-lens/dist/scripts/lib/web-tree-sitter-dir.mjs +51 -0
- package/extensions/dm-lens/dist/tools/activate-tools.js +62 -0
- package/extensions/dm-lens/dist/tools/ast-grep-outline.js +126 -0
- package/extensions/dm-lens/dist/tools/ast-grep-replace.js +227 -0
- package/extensions/dm-lens/dist/tools/ast-grep-search.js +687 -0
- package/extensions/dm-lens/dist/tools/effective-config.js +59 -0
- package/extensions/dm-lens/dist/tools/lens-diagnostic-mark.js +251 -0
- package/extensions/dm-lens/dist/tools/lens-diagnostics.js +1518 -0
- package/extensions/dm-lens/dist/tools/lsp-diagnostics.js +1198 -0
- package/extensions/dm-lens/dist/tools/lsp-navigation.js +1249 -0
- package/extensions/dm-lens/dist/tools/lsp-structured-output.js +277 -0
- package/extensions/dm-lens/dist/tools/module-report.js +332 -0
- package/extensions/dm-lens/dist/tools/project-report.js +72 -0
- package/extensions/dm-lens/dist/tools/render-compact.js +272 -0
- package/extensions/dm-lens/dist/tools/scan-progress.js +31 -0
- package/extensions/dm-lens/dist/tools/shared.js +32 -0
- package/extensions/dm-lens/dist/tools/symbol-search.js +133 -0
- package/extensions/dm-lens/i18n.js +3 -3
- package/extensions/dm-lens/index.js +431 -214
- package/extensions/dm-lens/mcp/analyze-cli.js +63 -36
- package/extensions/dm-lens/mcp/cli.js +20 -0
- package/extensions/dm-lens/mcp/server.js +40 -3
- package/extensions/dm-lens/mcp/tool-arguments.js +134 -0
- package/extensions/dm-lens/mcp/worker.js +8 -0
- package/extensions/dm-lens/package.json +1 -1
- package/extensions/dm-lens/rules/ast-grep-rules/rule-tests/advisory-registry-subset-test.yml +41 -0
- package/extensions/dm-lens/rules/ast-grep-rules/rule-tests/no-identity-operator-on-literals-test.yml +12 -2
- package/extensions/dm-lens/rules/ast-grep-rules/rule-tests/throw-new-error-js-test.yml +2 -0
- package/extensions/dm-lens/rules/ast-grep-rules/rule-tests/throw-new-error-test.yml +2 -0
- package/extensions/dm-lens/rules/ast-grep-rules/rules/advisory-registry-subset.yml +50 -0
- package/extensions/dm-lens/rules/ast-grep-rules/rules/no-identity-operator-on-literals.yml +20 -12
- package/extensions/dm-lens/rules/ast-grep-rules/rules/throw-new-error-js.yml +2 -2
- package/extensions/dm-lens/rules/ast-grep-rules/rules/throw-new-error.yml +2 -2
- package/extensions/dm-lens/scripts/lib/process-scan.mjs +126 -7
- package/extensions/dm-lens/scripts/lib/web-tree-sitter-dir.mjs +6 -0
- package/extensions/dm-lens/tools/activate-tools.js +3 -2
- package/extensions/dm-lens/tools/ast-grep-outline.js +2 -3
- package/extensions/dm-lens/tools/ast-grep-replace.js +6 -5
- package/extensions/dm-lens/tools/ast-grep-search.js +2 -2
- package/extensions/dm-lens/tools/lens-diagnostic-mark.js +12 -1
- package/extensions/dm-lens/tools/lens-diagnostics.js +74 -37
- package/extensions/dm-lens/tools/lsp-diagnostics.js +140 -25
- package/extensions/dm-lens/tools/lsp-navigation.js +64 -7
- package/extensions/dm-lens/tools/module-report.js +6 -6
- package/extensions/dm-lens/tools/shared.js +6 -0
- package/extensions/dm-mcp-adapter/THIRD_PARTY_NOTICES.md +1 -1
- package/extensions/dm-mcp-adapter/cli.js +265 -23
- package/extensions/dm-mcp-adapter/commands.js +83 -17
- package/extensions/dm-mcp-adapter/config.js +517 -92
- package/extensions/dm-mcp-adapter/direct-tool-surface.js +10 -8
- package/extensions/dm-mcp-adapter/direct-tools.js +54 -36
- package/extensions/dm-mcp-adapter/dist/abort.js +35 -0
- package/extensions/dm-mcp-adapter/dist/agent-dir.js +45 -0
- package/extensions/dm-mcp-adapter/dist/agent-plugin-loader.js +392 -0
- package/extensions/dm-mcp-adapter/dist/agent-plugin-provenance.js +26 -0
- package/extensions/dm-mcp-adapter/dist/bearer-command-resolver.js +182 -0
- package/extensions/dm-mcp-adapter/dist/claude-plugin-loader.js +350 -0
- package/extensions/dm-mcp-adapter/dist/config.js +1735 -0
- package/extensions/dm-mcp-adapter/dist/consent-manager.js +84 -0
- package/extensions/dm-mcp-adapter/dist/elicitation-handler.js +370 -0
- package/extensions/dm-mcp-adapter/dist/errors.js +225 -0
- package/extensions/dm-mcp-adapter/dist/http-ca.js +75 -0
- package/extensions/dm-mcp-adapter/dist/jev-client.js +359 -0
- package/extensions/dm-mcp-adapter/dist/jev-contracts.js +1 -0
- package/extensions/dm-mcp-adapter/dist/jev-key-store.js +189 -0
- package/extensions/dm-mcp-adapter/dist/json-schema-validator.js +70 -0
- package/extensions/dm-mcp-adapter/dist/lifecycle.js +387 -0
- package/extensions/dm-mcp-adapter/dist/logger.js +115 -0
- package/extensions/dm-mcp-adapter/dist/mcp-auth-fetch.js +86 -0
- package/extensions/dm-mcp-adapter/dist/mcp-auth-flow.js +956 -0
- package/extensions/dm-mcp-adapter/dist/mcp-auth.js +998 -0
- package/extensions/dm-mcp-adapter/dist/mcp-bearer-store.js +182 -0
- package/extensions/dm-mcp-adapter/dist/mcp-callback-server.js +380 -0
- package/extensions/dm-mcp-adapter/dist/mcp-oauth-provider.js +525 -0
- package/extensions/dm-mcp-adapter/dist/mcp-probe.js +151 -0
- package/extensions/dm-mcp-adapter/dist/mcp-tasks.js +300 -0
- package/extensions/dm-mcp-adapter/dist/mcp-trace.js +220 -0
- package/extensions/dm-mcp-adapter/dist/metadata-cache.js +323 -0
- package/extensions/dm-mcp-adapter/dist/npx-resolver.js +465 -0
- package/extensions/dm-mcp-adapter/dist/output-shape.js +312 -0
- package/extensions/dm-mcp-adapter/dist/package-mcp-loader.js +144 -0
- package/extensions/dm-mcp-adapter/dist/project-server-trust.js +186 -0
- package/extensions/dm-mcp-adapter/dist/request-headers-command.js +294 -0
- package/extensions/dm-mcp-adapter/dist/resource-tools.js +7 -0
- package/extensions/dm-mcp-adapter/dist/runtime-owner.js +94 -0
- package/extensions/dm-mcp-adapter/dist/sampling-handler.js +213 -0
- package/extensions/dm-mcp-adapter/dist/secure-keyring.js +191 -0
- package/extensions/dm-mcp-adapter/dist/server-manager.js +1594 -0
- package/extensions/dm-mcp-adapter/dist/session-approvals.js +127 -0
- package/extensions/dm-mcp-adapter/dist/session-recovery.js +83 -0
- package/extensions/dm-mcp-adapter/dist/state.js +1 -0
- package/extensions/dm-mcp-adapter/dist/ts-shape.js +157 -0
- package/extensions/dm-mcp-adapter/dist/types.js +286 -0
- package/extensions/dm-mcp-adapter/dist/ui-app-bridge-helpers.js +36 -0
- package/extensions/dm-mcp-adapter/dist/ui-resource-handler.js +204 -0
- package/extensions/dm-mcp-adapter/dist/ui-stream-types.js +58 -0
- package/extensions/dm-mcp-adapter/dist/ui-tool-visibility.js +26 -0
- package/extensions/dm-mcp-adapter/dist/unix-socket-transport.js +83 -0
- package/extensions/dm-mcp-adapter/dist/utils.js +418 -0
- package/extensions/dm-mcp-adapter/elicitation-handler.js +67 -2
- package/extensions/dm-mcp-adapter/failure-backoff.js +9 -0
- package/extensions/dm-mcp-adapter/host-managed.js +400 -0
- package/extensions/dm-mcp-adapter/http-ca.js +4 -0
- package/extensions/dm-mcp-adapter/index.js +347 -57
- package/extensions/dm-mcp-adapter/init.js +92 -44
- package/extensions/dm-mcp-adapter/jev-client.js +5 -5
- package/extensions/dm-mcp-adapter/jev-key-store.js +15 -2
- package/extensions/dm-mcp-adapter/mcp-auth-flow.js +10 -2
- package/extensions/dm-mcp-adapter/mcp-auth.js +2 -1
- package/extensions/dm-mcp-adapter/mcp-callback-server.js +1 -1
- package/extensions/dm-mcp-adapter/mcp-code.js +174 -87
- package/extensions/dm-mcp-adapter/mcp-keyring-helper.cjs +1 -1
- package/extensions/dm-mcp-adapter/mcp-oauth-provider.js +3 -2
- package/extensions/dm-mcp-adapter/mcp-output-guard.js +19 -5
- package/extensions/dm-mcp-adapter/mcp-panel.js +59 -12
- package/extensions/dm-mcp-adapter/mcp-script-wasm.js +22 -0
- package/extensions/dm-mcp-adapter/mcp-script-worker.mjs +227 -111
- package/extensions/dm-mcp-adapter/mcp-setup-panel.js +500 -258
- package/extensions/dm-mcp-adapter/mcp-status.js +9 -2
- package/extensions/dm-mcp-adapter/mcp-trace.js +5 -0
- package/extensions/dm-mcp-adapter/metadata-cache.js +68 -11
- package/extensions/dm-mcp-adapter/namespace-tools.js +20 -5
- package/extensions/dm-mcp-adapter/onboarding-state.js +11 -1
- package/extensions/dm-mcp-adapter/output-shape.js +312 -0
- package/extensions/dm-mcp-adapter/package-mcp-loader.js +15 -6
- package/extensions/dm-mcp-adapter/package.json +6 -15
- package/extensions/dm-mcp-adapter/panel-keys.js +13 -0
- package/extensions/dm-mcp-adapter/pi-builtin-mcp.js +26 -0
- package/extensions/dm-mcp-adapter/pi-signin-import.js +121 -0
- package/extensions/dm-mcp-adapter/project-server-trust.js +186 -0
- package/extensions/dm-mcp-adapter/prompts.js +80 -7
- package/extensions/dm-mcp-adapter/proxy-modes.js +219 -158
- package/extensions/dm-mcp-adapter/runtime-protocol.js +342 -0
- package/extensions/dm-mcp-adapter/search-ranking.js +8 -6
- package/extensions/dm-mcp-adapter/semantic-search.js +5 -4
- package/extensions/dm-mcp-adapter/server-manager.js +108 -26
- package/extensions/dm-mcp-adapter/session-recovery.js +3 -2
- package/extensions/dm-mcp-adapter/skills/mcp-scripting/SKILL.md +24 -28
- package/extensions/dm-mcp-adapter/skills/mcp-scripting/references/jev.md +3 -0
- package/extensions/dm-mcp-adapter/test-runner.mjs +1 -1
- package/extensions/dm-mcp-adapter/tool-approval.js +17 -7
- package/extensions/dm-mcp-adapter/tool-metadata.js +4 -2
- package/extensions/dm-mcp-adapter/tool-parameters.js +4 -0
- package/extensions/dm-mcp-adapter/tool-result-renderer.js +68 -7
- package/extensions/dm-mcp-adapter/ts-shape.js +1 -1
- package/extensions/dm-mcp-adapter/ui-server.js +24 -20
- package/extensions/dm-mcp-adapter/unix-socket-transport.js +1 -1
- package/extensions/dm-mcp-adapter/utils.js +37 -1
- package/extensions/dm-ponytail/extensions/ponytail.mjs +37 -17
- package/extensions/dm-ponytail/hooks/claude-codex-hooks.json +3 -3
- package/extensions/dm-ponytail/hooks/copilot-hooks.json +4 -4
- package/extensions/dm-ponytail/hooks/ponytail-activate.js +46 -13
- package/extensions/dm-ponytail/hooks/ponytail-config.js +6 -5
- package/extensions/dm-ponytail/hooks/ponytail-instructions.js +29 -33
- package/extensions/dm-ponytail/hooks/ponytail-map.js +116 -0
- package/extensions/dm-ponytail/hooks/ponytail-mode-tracker.js +26 -13
- package/extensions/dm-ponytail/hooks/ponytail-runtime.js +23 -9
- package/extensions/dm-ponytail/hooks/ponytail-subagent.js +15 -3
- package/extensions/dm-ponytail/hooks/qoder-hooks.json +3 -3
- package/extensions/dm-ponytail/package.json +1 -1
- package/extensions/dm-ponytail/pi-extension/index.js +37 -17
- package/extensions/dm-ponytail/pi-extension/package.json +1 -1
- package/extensions/dm-ponytail/skills/plugin.json +5 -0
- package/extensions/dm-ponytail/skills/ponytail/SKILL.md +33 -101
- package/extensions/dm-ponytail/skills/ponytail-audit/SKILL.md +89 -27
- package/extensions/dm-ponytail/skills/ponytail-debt/SKILL.md +13 -12
- package/extensions/dm-ponytail/skills/ponytail-gain/SKILL.md +21 -18
- package/extensions/dm-ponytail/skills/ponytail-help/SKILL.md +13 -14
- package/extensions/dm-ponytail/skills/ponytail-review/SKILL.md +96 -52
- package/extensions/dm-subagents/agents/oracle.md +8 -19
- package/extensions/dm-subagents/agents/researcher.md +0 -3
- package/extensions/dm-subagents/agents/reviewer.md +17 -61
- package/extensions/dm-subagents/agents/scout.md +1 -4
- package/extensions/dm-subagents/agents/worker.md +8 -25
- package/extensions/dm-subagents/index.js +5 -0
- package/extensions/dm-subagents/install.mjs +47 -62
- package/extensions/dm-subagents/package.json +6 -5
- package/extensions/dm-subagents/prompts/council.md +1 -1
- package/extensions/dm-subagents/prompts/review-loop.md +1 -1
- package/extensions/dm-subagents/skills/council-mode/SKILL.md +1 -1
- package/extensions/dm-subagents/skills/dm-subagents/SKILL.md +13 -6
- package/extensions/dm-subagents/skills/dm-subagents/references/constraints-and-recipes.md +3 -3
- package/extensions/dm-subagents/skills/dm-subagents/references/execution-controls.md +79 -78
- package/extensions/dm-subagents/skills/dm-subagents/references/management-authoring-rpc.md +18 -14
- package/extensions/dm-subagents/skills/dm-subagents/references/multi-lane-orchestration.md +1 -1
- package/extensions/dm-subagents/skills/dm-subagents/references/prompting-and-roles.md +46 -49
- package/extensions/dm-subagents/src/agents/advertised-agent-prompt.js +18 -32
- package/extensions/dm-subagents/src/agents/agent-management.js +7 -2
- package/extensions/dm-subagents/src/agents/agent-memory.js +3 -3
- package/extensions/dm-subagents/src/agents/agent-scope.js +3 -0
- package/extensions/dm-subagents/src/agents/agent-serializer.js +12 -1
- package/extensions/dm-subagents/src/agents/agents.js +217 -120
- package/extensions/dm-subagents/src/api/inspectors.js +10 -0
- package/extensions/dm-subagents/src/api/preflight.js +43 -6
- package/extensions/dm-subagents/src/extension/config.js +35 -2
- package/extensions/dm-subagents/src/extension/control-notices.js +3 -7
- package/extensions/dm-subagents/src/extension/declaration-pinning.js +127 -0
- package/extensions/dm-subagents/src/extension/doctor.js +4 -7
- package/extensions/dm-subagents/src/extension/fanout-child.js +15 -7
- package/extensions/dm-subagents/src/extension/herdr-dm-bridge.js +2 -0
- package/extensions/dm-subagents/src/extension/index.js +231 -332
- package/extensions/dm-subagents/src/extension/public-execution.js +63 -33
- package/extensions/dm-subagents/src/extension/reply-workflow-script.js +65 -0
- package/extensions/dm-subagents/src/extension/rpc.js +42 -16
- package/extensions/dm-subagents/src/extension/schemas.js +73 -152
- package/extensions/dm-subagents/src/extension/subagent-guide.js +92 -7
- package/extensions/dm-subagents/src/extension/subagent-options.js +47 -0
- package/extensions/dm-subagents/src/extension/tool-activation.js +57 -89
- package/extensions/dm-subagents/src/extension/tool-description.js +56 -47
- package/extensions/dm-subagents/src/extension/upgrade-notice.js +36 -0
- package/extensions/dm-subagents/src/inspectors/actions.js +34 -11
- package/extensions/dm-subagents/src/inspectors/plugins.js +71 -2
- package/extensions/dm-subagents/src/inspectors/tmux/actions.js +173 -0
- package/extensions/dm-subagents/src/inspectors/tmux/client.js +63 -0
- package/extensions/dm-subagents/src/inspectors/tmux/plugin.js +14 -0
- package/extensions/dm-subagents/src/integrations/herdr-status.js +26 -49
- package/extensions/dm-subagents/src/integrations/program-status.js +179 -0
- package/extensions/dm-subagents/src/intercom/native-supervisor-channel.js +77 -4
- package/extensions/dm-subagents/src/intercom/result-intercom.js +3 -2
- package/extensions/dm-subagents/src/intercom/supervisor-ui.js +2 -152
- package/extensions/dm-subagents/src/missions/goal-driver.js +47 -34
- package/extensions/dm-subagents/src/missions/store.js +33 -4
- package/extensions/dm-subagents/src/profiles/profiles.js +22 -15
- package/extensions/dm-subagents/src/runs/background/active-async-capacity.js +49 -6
- package/extensions/dm-subagents/src/runs/background/async-execution.js +301 -139
- package/extensions/dm-subagents/src/runs/background/async-job-tracker.js +65 -24
- package/extensions/dm-subagents/src/runs/background/async-resume.js +9 -3
- package/extensions/dm-subagents/src/runs/background/async-retention.js +40 -15
- package/extensions/dm-subagents/src/runs/background/await-async-run.js +68 -0
- package/extensions/dm-subagents/src/runs/background/binary-bootstrap.js +2 -1
- package/extensions/dm-subagents/src/runs/background/calendar-schedule.js +90 -0
- package/extensions/dm-subagents/src/runs/background/chain-root-attachment.js +11 -8
- package/extensions/dm-subagents/src/runs/background/control-channel.js +89 -5
- package/extensions/dm-subagents/src/runs/background/fleet-view.js +5 -5
- package/extensions/dm-subagents/src/runs/background/notify.js +170 -11
- package/extensions/dm-subagents/src/runs/background/pid-namespace.js +17 -0
- package/extensions/dm-subagents/src/runs/background/result-files.js +80 -6
- package/extensions/dm-subagents/src/runs/background/result-watcher.js +92 -65
- package/extensions/dm-subagents/src/runs/background/resume-guidance.js +2 -2
- package/extensions/dm-subagents/src/runs/background/run-child-session.js +34 -10
- package/extensions/dm-subagents/src/runs/background/run-id-resolver.js +8 -6
- package/extensions/dm-subagents/src/runs/background/run-status.js +25 -15
- package/extensions/dm-subagents/src/runs/background/runner-aliases.js +4 -2
- package/extensions/dm-subagents/src/runs/background/runner-child-launch.js +3 -0
- package/extensions/dm-subagents/src/runs/background/runner-http-dispatcher.js +2 -1
- package/extensions/dm-subagents/src/runs/background/scheduled-runs.js +270 -79
- package/extensions/dm-subagents/src/runs/background/stale-run-reconciler.js +18 -3
- package/extensions/dm-subagents/src/runs/background/subagent-runner-bootstrap.js +4 -1
- package/extensions/dm-subagents/src/runs/background/subagent-runner.js +123 -33
- package/extensions/dm-subagents/src/runs/background/subagent-wait.js +33 -20
- package/extensions/dm-subagents/src/runs/background/terminal-run-index.js +42 -1
- package/extensions/dm-subagents/src/runs/background/wait-completions.js +1 -0
- package/extensions/dm-subagents/src/runs/background/wait-tool.js +36 -26
- package/extensions/dm-subagents/src/runs/background/workflow-terminal-proof.js +39 -26
- package/extensions/dm-subagents/src/runs/foreground/async-stop-action.js +58 -26
- package/extensions/dm-subagents/src/runs/foreground/command-action.js +37 -0
- package/extensions/dm-subagents/src/runs/foreground/execution.js +132 -32
- package/extensions/dm-subagents/src/runs/foreground/foreground-history.js +1 -0
- package/extensions/dm-subagents/src/runs/foreground/prompt-audit.js +5 -5
- package/extensions/dm-subagents/src/runs/foreground/subagent-executor.js +683 -325
- package/extensions/dm-subagents/src/runs/shared/async-status-projection.js +3 -0
- package/extensions/dm-subagents/src/runs/shared/child-commands.js +252 -0
- package/extensions/dm-subagents/src/runs/shared/child-hooks.js +6 -5
- package/extensions/dm-subagents/src/runs/shared/child-launch.js +13 -1
- package/extensions/dm-subagents/src/runs/shared/child-session.js +183 -34
- package/extensions/dm-subagents/src/runs/shared/child-tool-plan.js +17 -14
- package/extensions/dm-subagents/src/runs/shared/claude-code-adapter.js +87 -1
- package/extensions/dm-subagents/src/runs/shared/dm-spawn.js +11 -85
- package/extensions/dm-subagents/src/runs/shared/dynamic-fanout.js +3 -0
- package/extensions/dm-subagents/src/runs/shared/effective-system-prompt.js +1 -2
- package/extensions/dm-subagents/src/runs/shared/external-cli-preflight.js +57 -6
- package/extensions/dm-subagents/src/runs/shared/external-cli-runner.js +6 -3
- package/extensions/dm-subagents/src/runs/shared/herdr-placed-run.js +13 -6
- package/extensions/dm-subagents/src/runs/shared/mcp-config-sources.js +1 -1
- package/extensions/dm-subagents/src/runs/shared/mcp-direct-tool-allowlist.js +66 -14
- package/extensions/dm-subagents/src/runs/shared/model-resolution-diagnostic.js +25 -5
- package/extensions/dm-subagents/src/runs/shared/model-resolution.js +55 -11
- package/extensions/dm-subagents/src/runs/shared/model-scope.js +23 -10
- package/extensions/dm-subagents/src/runs/shared/nested-events.js +3 -0
- package/extensions/dm-subagents/src/runs/shared/parallel-handoff.js +55 -7
- package/extensions/dm-subagents/src/runs/shared/partial-output.js +26 -0
- package/extensions/dm-subagents/src/runs/shared/run-history.js +41 -0
- package/extensions/dm-subagents/src/runs/shared/runner-launcher.js +21 -0
- package/extensions/dm-subagents/src/runs/shared/single-output.js +67 -26
- package/extensions/dm-subagents/src/runs/shared/structured-output.js +24 -7
- package/extensions/dm-subagents/src/runs/shared/subagent-control.js +32 -20
- package/extensions/dm-subagents/src/runs/shared/subagent-prompt-runtime.js +68 -29
- package/extensions/dm-subagents/src/runs/shared/tool-availability.js +1 -1
- package/extensions/dm-subagents/src/runs/shared/workflow-async-child-guidance.js +1 -1
- package/extensions/dm-subagents/src/runs/shared/worktree-cleanup-apply.js +169 -0
- package/extensions/dm-subagents/src/runs/shared/worktree-cleanup-plan.js +41 -20
- package/extensions/dm-subagents/src/runs/shared/worktree-lock.js +38 -0
- package/extensions/dm-subagents/src/runs/shared/worktree.js +10 -1
- package/extensions/dm-subagents/src/shared/atomic-json.js +2 -1
- package/extensions/dm-subagents/src/shared/disabled-features.js +101 -0
- package/extensions/dm-subagents/src/shared/dm-declarations.js +14 -0
- package/extensions/dm-subagents/src/shared/dm-safeguards.js +41 -0
- package/extensions/dm-subagents/src/shared/dm-settlement.js +48 -0
- package/extensions/dm-subagents/src/shared/edit-distance.js +23 -0
- package/extensions/dm-subagents/src/shared/extension-context.js +4 -0
- package/extensions/dm-subagents/src/shared/file-lease.js +89 -0
- package/extensions/dm-subagents/src/shared/fork-context.js +0 -1
- package/extensions/dm-subagents/src/shared/formatters.js +1 -6
- package/extensions/dm-subagents/src/shared/model-info.js +23 -0
- package/extensions/dm-subagents/src/shared/package-version.js +12 -0
- package/extensions/dm-subagents/src/shared/parent-wake.js +67 -0
- package/extensions/dm-subagents/src/shared/pruned-fork.js +6 -2
- package/extensions/dm-subagents/src/shared/required-child-extensions.js +35 -5
- package/extensions/dm-subagents/src/shared/runtime-module-path.js +9 -0
- package/extensions/dm-subagents/src/shared/settings-file-lease.js +31 -0
- package/extensions/dm-subagents/src/shared/types.js +3 -1
- package/extensions/dm-subagents/src/shared/utils.js +7 -7
- package/extensions/dm-subagents/src/slash/prompt-template-bridge.js +2 -2
- package/extensions/dm-subagents/src/slash/slash-commands.js +25 -15
- package/extensions/dm-subagents/src/slash/subagent-cost.js +38 -7
- package/extensions/dm-subagents/src/slash/subagents-admin.js +1 -1
- package/extensions/dm-subagents/src/tui/dm-mouse-region.js +12 -0
- package/extensions/dm-subagents/src/tui/fleet-status.js +12 -6
- package/extensions/dm-subagents/src/tui/fleet-transcript.js +6 -2
- package/extensions/dm-subagents/src/tui/fleet.js +20 -6
- package/extensions/dm-subagents/src/tui/render.js +126 -72
- package/extensions/dm-subagents/src/tui/running-tone.js +20 -0
- package/extensions/dm-subagents/src/tui/subagent-messages.js +249 -0
- package/extensions/dm-subagents/src/watchdog/diff-tool.js +19 -11
- package/extensions/dm-subagents/src/watchdog/permission-arbiter.js +2 -2
- package/extensions/dm-subagents/src/watchdog/register-child.js +2 -2
- package/extensions/dm-subagents/src/watchdog/register-main.js +4 -24
- package/extensions/dm-subagents/src/watchdog/render.js +1 -19
- package/extensions/dm-subagents/src/watchdog/review.js +3 -3
- package/extensions/dm-subagents/src/watchdog/runtime.js +6 -2
- package/extensions/dm-subagents/src/watchdog/settings.js +22 -17
- package/extensions/dm-subagents/src/watchdog/tool-actions.js +2 -2
- package/extensions/dm-subagents/src/watchdog/turn-delta.js +1 -1
- package/extensions/dm-subagents/src/workflows/chat-progress.js +2 -2
- package/extensions/dm-subagents/src/workflows/scripted-workflow.js +116 -45
- package/extensions/dm-subagents/src/workflows/structured-workflow-scripts.js +154 -0
- package/extensions/dm-subagents/src/workflows/workflow-checklist.js +3 -0
- package/extensions/dm-subagents/src/workflows/workflow-receipt.js +7 -4
- package/extensions/dm-subagents/src/workflows/workflow-resources.js +52 -17
- package/extensions/dm-subagents/src/workflows/workflow-reuse.js +87 -0
- package/extensions/dm-subagents/src/workflows/workflow-revival.js +80 -0
- package/extensions/dm-tty/control.js +150 -0
- package/extensions/dm-tty/index.js +122 -0
- package/extensions/dm-tty/package.json +20 -0
- package/extensions/dm-tty/pty.js +213 -0
- package/extensions/dm-tty/pty_bridge.py +266 -0
- package/extensions/dm-tty/server.js +438 -0
- package/extensions/dm-tty/sessions.js +97 -0
- package/extensions/dm-tty/standalone.js +75 -0
- package/extensions/dm-tty/web/client.js +1141 -0
- package/extensions/dm-tty/web/index.html +117 -0
- package/extensions/dm-tty/web/style.css +73 -0
- package/extensions/dm-web-access/brave-rate-limit.js +160 -0
- package/extensions/dm-web-access/brave.js +62 -11
- package/extensions/dm-web-access/ceramic.js +197 -0
- package/extensions/dm-web-access/chrome-cookies.js +69 -21
- package/extensions/dm-web-access/curator-page.js +12 -2
- package/extensions/dm-web-access/curator-server.js +10 -0
- package/extensions/dm-web-access/declared-web-links.js +1 -1
- package/extensions/dm-web-access/degoog.js +288 -0
- package/extensions/dm-web-access/dist/index.js +28404 -0
- package/extensions/dm-web-access/dist/mcp-cli.js +28186 -0
- package/extensions/dm-web-access/duckduckgo.js +6 -3
- package/extensions/dm-web-access/endpoint-pdf-extract.js +210 -0
- package/extensions/dm-web-access/exa.js +17 -35
- package/extensions/dm-web-access/extract.js +63 -10
- package/extensions/dm-web-access/firecrawl.js +30 -4
- package/extensions/dm-web-access/gemini-search.js +117 -37
- package/extensions/dm-web-access/gemini-web.js +7 -7
- package/extensions/dm-web-access/github-extract.js +28 -2
- package/extensions/dm-web-access/github-issue-pr.js +88 -73
- package/extensions/dm-web-access/index.js +230 -1161
- package/extensions/dm-web-access/keenable.js +197 -0
- package/extensions/dm-web-access/mcp-cli.js +30 -0
- package/extensions/dm-web-access/mcp-server.js +51 -0
- package/extensions/dm-web-access/mcp-tool-definitions.js +93 -0
- package/extensions/dm-web-access/openai-search.js +70 -20
- package/extensions/dm-web-access/opencode-session-headers.js +1 -1
- package/extensions/dm-web-access/package.json +4 -1
- package/extensions/dm-web-access/page-query.js +5 -10
- package/extensions/dm-web-access/parallel-mcp.js +2 -1
- package/extensions/dm-web-access/pdf-extract.js +34 -1
- package/extensions/dm-web-access/perplexity.js +68 -51
- package/extensions/dm-web-access/query-rewrite.js +3 -4
- package/extensions/dm-web-access/scripts/build.js +8 -0
- package/extensions/dm-web-access/ssrf-protection.js +10 -8
- package/extensions/dm-web-access/storage.js +79 -76
- package/extensions/dm-web-access/summary-model-scope.js +5 -64
- package/extensions/dm-web-access/summary-review.js +35 -9
- package/extensions/dm-web-access/tavily.js +69 -22
- package/extensions/dm-web-access/tool-activation.js +44 -26
- package/extensions/dm-web-access/tool-arguments.js +21 -0
- package/extensions/dm-web-access/utils.js +17 -7
- package/extensions/dm-web-access/video-extract.js +1 -1
- package/extensions/dm-web-access/web-tool-contract.js +0 -0
- package/extensions/dm-web-access/web-tool-core.js +1312 -0
- package/extensions/dm-web-access/you.js +155 -0
- package/extensions/dm-web-access/youtube-extract.js +2 -2
- package/extensions/dm-web-access/zai.js +159 -0
- package/package.json +13 -9
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
import { Box, Text, truncateToWidth } from "@duckmind/dm-tui";
|
|
2
2
|
import { Type } from "typebox";
|
|
3
|
-
import pLimit from "p-limit";
|
|
4
3
|
import { normalizeFetchContentParams } from "./fetch-params.js";
|
|
5
|
-
import { resolveAuthFetchProfile } from "./auth-fetch.js";
|
|
6
|
-
import { findContent } from "./content-find.js";
|
|
7
4
|
import { answerFromPage } from "./page-query.js";
|
|
8
5
|
import { rewriteSearchQuery } from "./query-rewrite.js";
|
|
9
|
-
import { clearCloneCache } from "./github-extract.js";
|
|
10
|
-
import { ALL_SEARCH_PROVIDERS,
|
|
11
|
-
import { formatSeconds, getWebSearchConfigDir,
|
|
6
|
+
import { clearCloneCache, releaseClonesUnusedSince, touchClones } from "./github-extract.js";
|
|
7
|
+
import { ALL_SEARCH_PROVIDERS, getAllowedSearchProviders, getConfiguredSearchRouting, providerLabel, RESOLVED_SEARCH_PROVIDERS, search } from "./gemini-search.js";
|
|
8
|
+
import { formatSeconds, getWebSearchConfigDir, resolveCuratorNetworkConfig, runWithProxy } from "./utils.js";
|
|
12
9
|
import {
|
|
13
|
-
|
|
14
|
-
deleteResult,
|
|
10
|
+
deleteHeldResult,
|
|
15
11
|
generateId,
|
|
16
12
|
getAllResults,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
holdResults,
|
|
14
|
+
loadSessionResults,
|
|
15
|
+
releaseResults,
|
|
16
|
+
storeFetchedContentResult
|
|
21
17
|
} from "./storage.js";
|
|
22
18
|
import { activityMonitor } from "./activity.js";
|
|
23
19
|
import { startCuratorServer } from "./curator-server.js";
|
|
@@ -38,14 +34,16 @@ import { isGeminiApiAvailable } from "./gemini-api.js";
|
|
|
38
34
|
import { getActiveGoogleEmail, getGeminiWebAvailabilityDiagnostic, getGeminiWebAvailabilityDiagnosticDetails, isGeminiWebAvailable } from "./gemini-web.js";
|
|
39
35
|
import { isBrowserCookieAccessAllowed } from "./gemini-web-config.js";
|
|
40
36
|
import { isBraveAvailable } from "./brave.js";
|
|
41
|
-
import { isCurrentModelHostedSearchEligible, isOpenAISearchAvailable } from "./openai-search.js";
|
|
37
|
+
import { isCurrentModelHostedSearchEligible, isOpenAISearchAvailable, isOpenAISubscriptionModelSelected } from "./openai-search.js";
|
|
42
38
|
import { isParallelAvailable } from "./parallel.js";
|
|
43
39
|
import { isParallelMcpAvailable } from "./parallel-mcp.js";
|
|
40
|
+
import { parseStringifiedArrays } from "./tool-arguments.js";
|
|
44
41
|
import { isTinyFishAvailable } from "./tinyfish.js";
|
|
45
42
|
import { isSearch1APIAvailable } from "./search1api.js";
|
|
46
43
|
import { isSearchinfinityAvailable } from "./searchinfinity.js";
|
|
47
44
|
import { isQueritAvailable } from "./querit.js";
|
|
48
45
|
import { isTavilyAvailable } from "./tavily.js";
|
|
46
|
+
import { isYouAvailable } from "./you.js";
|
|
49
47
|
import { isFirecrawlAvailable } from "./firecrawl.js";
|
|
50
48
|
import { isJinaSearchAvailable } from "./jina-search.js";
|
|
51
49
|
import { isSerpdiveAvailable } from "./serpdive.js";
|
|
@@ -53,6 +51,7 @@ import { isKagiAvailable } from "./kagi.js";
|
|
|
53
51
|
import { isBochaAvailable } from "./bocha.js";
|
|
54
52
|
import { isOllamaAvailable } from "./ollama.js";
|
|
55
53
|
import { isSearXNGAvailable } from "./searxng.js";
|
|
54
|
+
import { isDegoogAvailable } from "./degoog.js";
|
|
56
55
|
import { isDuckDuckGoAvailable } from "./duckduckgo.js";
|
|
57
56
|
import { isAnySearchAvailable } from "./anysearch.js";
|
|
58
57
|
import { isXaiSearchAvailable } from "./xai-search.js";
|
|
@@ -63,19 +62,40 @@ import { isSerpBaseAvailable } from "./serpbase.js";
|
|
|
63
62
|
import { isSerpApiAvailable } from "./serpapi.js";
|
|
64
63
|
import { isSerperAvailable } from "./serper.js";
|
|
65
64
|
import { isSerplyAvailable } from "./serply.js";
|
|
65
|
+
import { isKeenableAvailable } from "./keenable.js";
|
|
66
|
+
import { isCeramicAvailable } from "./ceramic.js";
|
|
66
67
|
import { isBaizhiAvailable } from "./baizhi.js";
|
|
68
|
+
import { isZaiAvailable } from "./zai.js";
|
|
67
69
|
import { isValyuAvailable } from "./valyu.js";
|
|
68
70
|
import { isXcrawlAvailable } from "./xcrawl.js";
|
|
69
71
|
import { buildSearchErrorPlan } from "./render-search-error.js";
|
|
70
|
-
import { findModelWithProviderRouting,
|
|
72
|
+
import { findModelWithProviderRouting, getDmScopedModels, isModelInScope, splitThinkingSuffix } from "./summary-model-scope.js";
|
|
71
73
|
import { registerCuratorRunLifecycle, resolveWebSearchWorkflow } from "./curator-run.js";
|
|
72
|
-
import {
|
|
73
|
-
buildResearchArtifact,
|
|
74
|
-
withClaimAssessment,
|
|
75
|
-
storeResearchArtifact,
|
|
76
|
-
getResearchArtifact
|
|
77
|
-
} from "./source-check.js";
|
|
78
74
|
import { registerWebToolActivation } from "./tool-activation.js";
|
|
75
|
+
import {
|
|
76
|
+
createWebToolCore,
|
|
77
|
+
DEFAULT_TOOL_NAMES,
|
|
78
|
+
expandQueryString,
|
|
79
|
+
fetchAllContent,
|
|
80
|
+
fetchUncoveredContent,
|
|
81
|
+
getMaxInlineContentChars,
|
|
82
|
+
isToolEnabled,
|
|
83
|
+
loadConfig,
|
|
84
|
+
markToolError,
|
|
85
|
+
normalizeProviderInput,
|
|
86
|
+
normalizeQueryList,
|
|
87
|
+
normalizeRecencyFilter,
|
|
88
|
+
parseConfigRoot,
|
|
89
|
+
registeredFetchToolNames,
|
|
90
|
+
resolveFetchModeConfig,
|
|
91
|
+
resolveRequestedProvider,
|
|
92
|
+
runSearchQueries,
|
|
93
|
+
storedContentSourceNames,
|
|
94
|
+
stripThumbnails,
|
|
95
|
+
toCuratorProvider,
|
|
96
|
+
WEB_SEARCH_CONFIG_PATH,
|
|
97
|
+
withRegisteredFetchOptions
|
|
98
|
+
} from "./web-tool-core.js";
|
|
79
99
|
function StringEnum(values, options) {
|
|
80
100
|
return Type.Unsafe({
|
|
81
101
|
type: "string",
|
|
@@ -84,22 +104,31 @@ function StringEnum(values, options) {
|
|
|
84
104
|
...options?.default && { default: options.default }
|
|
85
105
|
});
|
|
86
106
|
}
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
107
|
+
const nullableString = (description) => Type.Union([Type.String(), Type.Null()], { description });
|
|
108
|
+
const webSearchOutputSchema = Type.Object({
|
|
109
|
+
responseId: Type.String({ description: "Id of the stored search results" }),
|
|
110
|
+
fetchId: nullableString("Stored page content id when includeContent fetched or started fetching content, else null"),
|
|
111
|
+
queries: Type.Array(Type.Object({
|
|
112
|
+
query: Type.String(),
|
|
113
|
+
answer: Type.String({ description: "Provider answer text, empty when the provider returned only results" }),
|
|
114
|
+
error: nullableString("Why this query failed, null on success"),
|
|
115
|
+
provider: Type.Optional(Type.String()),
|
|
116
|
+
providers: Type.Optional(Type.Array(Type.String())),
|
|
117
|
+
results: Type.Array(Type.Object({ title: Type.String(), url: Type.String(), snippet: Type.String() }))
|
|
118
|
+
}))
|
|
119
|
+
});
|
|
120
|
+
const fetchContentOutputSchema = Type.Object({
|
|
121
|
+
responseId: nullableString("Id of the stored content, null when nothing was stored"),
|
|
122
|
+
urls: Type.Array(Type.Object({
|
|
123
|
+
url: Type.String(),
|
|
124
|
+
title: Type.String(),
|
|
125
|
+
content: Type.String({ description: "Full extracted content, not limited by the inline character cap" }),
|
|
126
|
+
error: nullableString("Why this URL failed, null on success"),
|
|
127
|
+
mimeType: Type.Optional(Type.String()),
|
|
128
|
+
status: Type.Optional(Type.Number()),
|
|
129
|
+
duration: Type.Optional(Type.Number())
|
|
130
|
+
}))
|
|
131
|
+
});
|
|
103
132
|
function renderSearchErrorPlan(plan, expanded, theme) {
|
|
104
133
|
if (expanded) {
|
|
105
134
|
return new Text(plan.expanded.map((l, i) => i === 0 ? theme.fg("error", l) : theme.fg("toolOutput", l)).join(`
|
|
@@ -115,24 +144,6 @@ function renderSearchErrorPlan(plan, expanded, theme) {
|
|
|
115
144
|
}
|
|
116
145
|
return box;
|
|
117
146
|
}
|
|
118
|
-
function parseConfigRoot(raw) {
|
|
119
|
-
let parsed;
|
|
120
|
-
try {
|
|
121
|
-
parsed = JSON.parse(raw);
|
|
122
|
-
} catch (err) {
|
|
123
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
124
|
-
throw new Error(`Failed to parse ${WEB_SEARCH_CONFIG_PATH}: ${message}`);
|
|
125
|
-
}
|
|
126
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
127
|
-
throw new Error(`Invalid config in ${WEB_SEARCH_CONFIG_PATH}: expected a JSON object`);
|
|
128
|
-
}
|
|
129
|
-
return parsed;
|
|
130
|
-
}
|
|
131
|
-
function loadConfig() {
|
|
132
|
-
if (!existsSync(WEB_SEARCH_CONFIG_PATH))
|
|
133
|
-
return {};
|
|
134
|
-
return parseConfigRoot(readFileSync(WEB_SEARCH_CONFIG_PATH, "utf-8"));
|
|
135
|
-
}
|
|
136
147
|
function saveConfig(updates) {
|
|
137
148
|
let config = {};
|
|
138
149
|
if (existsSync(WEB_SEARCH_CONFIG_PATH)) {
|
|
@@ -145,45 +156,17 @@ function saveConfig(updates) {
|
|
|
145
156
|
writeFileSync(WEB_SEARCH_CONFIG_PATH, JSON.stringify(config, null, 2) + `
|
|
146
157
|
`);
|
|
147
158
|
}
|
|
148
|
-
const DEFAULT_TOOL_NAMES = {
|
|
149
|
-
webSearch: "web_search",
|
|
150
|
-
sourceCheck: "source_check",
|
|
151
|
-
fetchContent: "fetch_content",
|
|
152
|
-
getSearchContent: "get_search_content"
|
|
153
|
-
};
|
|
154
159
|
const TOOL_NAME_PATTERN = /^[A-Za-z][A-Za-z0-9_-]{0,63}$/;
|
|
155
160
|
const DEFAULT_SHORTCUTS = { curate: "ctrl+shift+s", activity: "ctrl+shift+w" };
|
|
156
161
|
const DEFAULT_CURATOR_TIMEOUT_SECONDS = 20;
|
|
157
162
|
const DEFAULT_REMOTE_CURATOR_TIMEOUT_SECONDS = 60;
|
|
158
163
|
const MAX_CURATOR_TIMEOUT_SECONDS = 600;
|
|
159
164
|
const MAX_SUMMARY_GENERATION_DEADLINE_MS = 600000;
|
|
160
|
-
const SEARCH_QUERY_CONCURRENCY = 3;
|
|
161
|
-
const FETCH_MODES = ["readable", "raw", "answer"];
|
|
162
165
|
const FETCH_MODE_DESCRIPTIONS = {
|
|
163
166
|
readable: "extract readable content as markdown",
|
|
164
167
|
raw: "return the exact textual body using direct HTTP only",
|
|
165
168
|
answer: "answer a prompt using only fetched content"
|
|
166
169
|
};
|
|
167
|
-
function resolveFetchModeConfig(config) {
|
|
168
|
-
const configuredModes = config.fetch?.allowedModes ?? FETCH_MODES;
|
|
169
|
-
if (!Array.isArray(configuredModes) || configuredModes.length === 0 || configuredModes.some((mode) => !FETCH_MODES.includes(mode))) {
|
|
170
|
-
throw new Error(`fetch.allowedModes in ${WEB_SEARCH_CONFIG_PATH} must be a non-empty array containing only "readable", "raw", or "answer"`);
|
|
171
|
-
}
|
|
172
|
-
const allowedModes = configuredModes;
|
|
173
|
-
const duplicateMode = allowedModes.find((mode, index) => allowedModes.indexOf(mode) !== index);
|
|
174
|
-
if (duplicateMode) {
|
|
175
|
-
throw new Error(`fetch.allowedModes in ${WEB_SEARCH_CONFIG_PATH} must not contain duplicates: "${duplicateMode}"`);
|
|
176
|
-
}
|
|
177
|
-
const defaultMode = config.fetch?.defaultMode ?? "readable";
|
|
178
|
-
if (!allowedModes.includes(defaultMode)) {
|
|
179
|
-
throw new Error(`fetch.defaultMode in ${WEB_SEARCH_CONFIG_PATH} must be one of fetch.allowedModes`);
|
|
180
|
-
}
|
|
181
|
-
return { defaultMode, allowedModes };
|
|
182
|
-
}
|
|
183
|
-
function runSearchQueries(queries, run) {
|
|
184
|
-
const limit = pLimit(SEARCH_QUERY_CONCURRENCY);
|
|
185
|
-
return Promise.all(queries.map((query, index) => limit(() => run(query, index))));
|
|
186
|
-
}
|
|
187
170
|
function curatorResultIndex(queryIndex, entryIndex, queryCount) {
|
|
188
171
|
return entryIndex * queryCount + queryIndex;
|
|
189
172
|
}
|
|
@@ -196,24 +179,9 @@ function searchProviderSchema(description, allowedProviders) {
|
|
|
196
179
|
Type.Array(StringEnum([...allowedProviders]), { minItems: 1 })
|
|
197
180
|
], { description });
|
|
198
181
|
}
|
|
199
|
-
function isToolEnabled(config, key) {
|
|
200
|
-
const override = config.tools?.[key]?.enabled;
|
|
201
|
-
if (typeof override === "boolean")
|
|
202
|
-
return override;
|
|
203
|
-
return key !== "webSearch" && key !== "sourceCheck" || config.webSearch?.enabled !== false;
|
|
204
|
-
}
|
|
205
182
|
function isCommandEnabled(config, name) {
|
|
206
183
|
return config.commands?.[name]?.enabled !== false;
|
|
207
184
|
}
|
|
208
|
-
function joinToolNames(names) {
|
|
209
|
-
if (names.length === 0)
|
|
210
|
-
return "stored content";
|
|
211
|
-
if (names.length === 1)
|
|
212
|
-
return names[0];
|
|
213
|
-
if (names.length === 2)
|
|
214
|
-
return `${names[0]} or ${names[1]}`;
|
|
215
|
-
return `${names.slice(0, -1).join(", ")}, or ${names[names.length - 1]}`;
|
|
216
|
-
}
|
|
217
185
|
function resolveToolNames(config) {
|
|
218
186
|
if (config.toolNames !== undefined && (!config.toolNames || typeof config.toolNames !== "object" || Array.isArray(config.toolNames))) {
|
|
219
187
|
throw new Error(`toolNames in ${WEB_SEARCH_CONFIG_PATH} must be an object`);
|
|
@@ -253,36 +221,12 @@ function loadConfigForExtensionInit() {
|
|
|
253
221
|
return {};
|
|
254
222
|
}
|
|
255
223
|
}
|
|
256
|
-
function normalizeProviderInput(value, label = "provider") {
|
|
257
|
-
if (value === undefined)
|
|
258
|
-
return;
|
|
259
|
-
return normalizeSearchProviderSelection(value, label);
|
|
260
|
-
}
|
|
261
|
-
function resolveRequestedProvider(requested) {
|
|
262
|
-
const normalizedRequested = normalizeProviderInput(requested);
|
|
263
|
-
if (normalizedRequested && normalizedRequested !== "auto") {
|
|
264
|
-
assertSearchProviderSelectionAllowed(normalizedRequested, "Requested provider");
|
|
265
|
-
return normalizedRequested;
|
|
266
|
-
}
|
|
267
|
-
const config = loadConfig();
|
|
268
|
-
const provider = normalizeProviderInput(config.searchProvider ?? config.provider, `provider in ${WEB_SEARCH_CONFIG_PATH}`) ?? "auto";
|
|
269
|
-
assertSearchProviderSelectionAllowed(provider, `configured provider in ${WEB_SEARCH_CONFIG_PATH}`);
|
|
270
|
-
return provider;
|
|
271
|
-
}
|
|
272
|
-
function toCuratorProvider(provider) {
|
|
273
|
-
if (Array.isArray(provider))
|
|
274
|
-
return "all";
|
|
275
|
-
return provider === "auto" ? undefined : provider;
|
|
276
|
-
}
|
|
277
224
|
function resolveCuratorSearchProvider(requested, current) {
|
|
278
225
|
const normalized = normalizeProviderInput(requested);
|
|
279
226
|
if (!normalized || normalized === "auto")
|
|
280
227
|
return current;
|
|
281
228
|
return normalized === "all" && Array.isArray(current) ? current : normalized;
|
|
282
229
|
}
|
|
283
|
-
function normalizeRecencyFilter(value) {
|
|
284
|
-
return value === "day" || value === "week" || value === "month" || value === "year" ? value : undefined;
|
|
285
|
-
}
|
|
286
230
|
function normalizeCuratorTimeoutSeconds(value) {
|
|
287
231
|
if (typeof value !== "number" || !Number.isFinite(value))
|
|
288
232
|
return;
|
|
@@ -291,31 +235,6 @@ function normalizeCuratorTimeoutSeconds(value) {
|
|
|
291
235
|
return;
|
|
292
236
|
return Math.min(normalized, MAX_CURATOR_TIMEOUT_SECONDS);
|
|
293
237
|
}
|
|
294
|
-
function normalizeQueryList(queryList) {
|
|
295
|
-
const normalized = [];
|
|
296
|
-
for (const query of queryList) {
|
|
297
|
-
if (typeof query !== "string")
|
|
298
|
-
continue;
|
|
299
|
-
const trimmed = query.trim();
|
|
300
|
-
if (trimmed.length > 0)
|
|
301
|
-
normalized.push(trimmed);
|
|
302
|
-
}
|
|
303
|
-
return normalized;
|
|
304
|
-
}
|
|
305
|
-
function expandQueryString(query) {
|
|
306
|
-
if (typeof query !== "string")
|
|
307
|
-
return [];
|
|
308
|
-
const trimmed = query.trim();
|
|
309
|
-
if (trimmed.startsWith("[") && trimmed.endsWith("]")) {
|
|
310
|
-
try {
|
|
311
|
-
const parsed = JSON.parse(trimmed);
|
|
312
|
-
if (Array.isArray(parsed) && parsed.every((entry) => typeof entry === "string")) {
|
|
313
|
-
return parsed.map((entry) => entry.trim()).filter((entry) => entry.length > 0);
|
|
314
|
-
}
|
|
315
|
-
} catch {}
|
|
316
|
-
}
|
|
317
|
-
return [query];
|
|
318
|
-
}
|
|
319
238
|
function getCuratorTimeoutSeconds() {
|
|
320
239
|
const source = loadConfig();
|
|
321
240
|
const explicit = normalizeCuratorTimeoutSeconds(source.curatorTimeoutSeconds);
|
|
@@ -330,6 +249,13 @@ export function getSummaryGenerationDeadlineMs() {
|
|
|
330
249
|
}
|
|
331
250
|
return Math.min(value, MAX_SUMMARY_GENERATION_DEADLINE_MS);
|
|
332
251
|
}
|
|
252
|
+
export function getSummaryInstructions() {
|
|
253
|
+
const value = loadConfig().summaryInstructions;
|
|
254
|
+
if (typeof value !== "string")
|
|
255
|
+
return;
|
|
256
|
+
const trimmed = value.trim();
|
|
257
|
+
return trimmed.length > 0 ? trimmed : undefined;
|
|
258
|
+
}
|
|
333
259
|
function shouldAutoOpenCuratorBrowser(config) {
|
|
334
260
|
if (config.autoOpenBrowser === false)
|
|
335
261
|
return false;
|
|
@@ -351,6 +277,7 @@ async function getProviderAvailability(ctx) {
|
|
|
351
277
|
searchinfinity: allowedProviders.has("searchinfinity") && isSearchinfinityAvailable(),
|
|
352
278
|
querit: allowedProviders.has("querit") && isQueritAvailable(),
|
|
353
279
|
tavily: allowedProviders.has("tavily") && isTavilyAvailable(),
|
|
280
|
+
you: allowedProviders.has("you") && isYouAvailable(),
|
|
354
281
|
firecrawl: allowedProviders.has("firecrawl") && isFirecrawlAvailable(),
|
|
355
282
|
jina: allowedProviders.has("jina") && isJinaSearchAvailable(),
|
|
356
283
|
serpdive: allowedProviders.has("serpdive") && isSerpdiveAvailable(),
|
|
@@ -358,6 +285,7 @@ async function getProviderAvailability(ctx) {
|
|
|
358
285
|
bocha: allowedProviders.has("bocha") && isBochaAvailable(),
|
|
359
286
|
ollama: allowedProviders.has("ollama") && isOllamaAvailable(),
|
|
360
287
|
searxng: allowedProviders.has("searxng") && isSearXNGAvailable(),
|
|
288
|
+
degoog: allowedProviders.has("degoog") && isDegoogAvailable(),
|
|
361
289
|
duckduckgo: allowedProviders.has("duckduckgo") && isDuckDuckGoAvailable(),
|
|
362
290
|
perplexity: allowedProviders.has("perplexity") && isPerplexityAvailable(),
|
|
363
291
|
exa: allowedProviders.has("exa") && isExaAvailable(),
|
|
@@ -373,7 +301,10 @@ async function getProviderAvailability(ctx) {
|
|
|
373
301
|
serper: allowedProviders.has("serper") && isSerperAvailable(),
|
|
374
302
|
serply: allowedProviders.has("serply") && isSerplyAvailable(),
|
|
375
303
|
baizhi: allowedProviders.has("baizhi") && isBaizhiAvailable(),
|
|
376
|
-
|
|
304
|
+
zai: allowedProviders.has("zai") && isZaiAvailable(),
|
|
305
|
+
valyu: allowedProviders.has("valyu") && isValyuAvailable(),
|
|
306
|
+
keenable: allowedProviders.has("keenable") && isKeenableAvailable(),
|
|
307
|
+
ceramic: allowedProviders.has("ceramic") && isCeramicAvailable()
|
|
377
308
|
};
|
|
378
309
|
return {
|
|
379
310
|
all: ALL_SEARCH_PROVIDERS.some((provider) => provider === "gemini" ? geminiApiAvail : providers[provider]),
|
|
@@ -387,9 +318,6 @@ async function getOptionalGeminiWebAvailability() {
|
|
|
387
318
|
return null;
|
|
388
319
|
}
|
|
389
320
|
}
|
|
390
|
-
function shouldUseOpenAICodexDefault(ctx) {
|
|
391
|
-
return ctx?.model?.provider === "openai-codex";
|
|
392
|
-
}
|
|
393
321
|
function shouldPreferOpenAI(options, preferOpenAICodexDefault) {
|
|
394
322
|
if (options?.recencyFilter)
|
|
395
323
|
return false;
|
|
@@ -410,7 +338,7 @@ async function loadCuratorBootstrap(requestedProvider, ctx, options) {
|
|
|
410
338
|
};
|
|
411
339
|
}
|
|
412
340
|
export function resolveCuratorDefaultProvider(provider, available, ctx, options) {
|
|
413
|
-
return resolveProvider(provider, available, options,
|
|
341
|
+
return resolveProvider(provider, available, options, isOpenAISubscriptionModelSelected(ctx), ctx);
|
|
414
342
|
}
|
|
415
343
|
function firstAvailableProvider(available, preferOpenAI, fallback) {
|
|
416
344
|
if (available.searxng)
|
|
@@ -453,210 +381,11 @@ function resolveProvider(provider, available, options, preferOpenAICodexDefault
|
|
|
453
381
|
}
|
|
454
382
|
return provider;
|
|
455
383
|
}
|
|
456
|
-
const pendingFetches = new Map;
|
|
457
|
-
let sessionActive = false;
|
|
458
384
|
let widgetVisible = false;
|
|
459
385
|
let widgetUnsubscribe = null;
|
|
460
386
|
const pendingCurates = new Map;
|
|
461
387
|
const activeCurators = new Map;
|
|
462
388
|
const glimpseWins = new Map;
|
|
463
|
-
const DEFAULT_MAX_INLINE_CONTENT_CHARS = 30000;
|
|
464
|
-
const MIN_INLINE_CONTENT_CHARS = 1000;
|
|
465
|
-
const MAX_INLINE_CONTENT_CHARS = 200000;
|
|
466
|
-
function getMaxInlineContentChars(config = loadConfig()) {
|
|
467
|
-
const value = config.maxInlineContentChars;
|
|
468
|
-
if (typeof value !== "number" || !Number.isFinite(value) || !Number.isInteger(value) || value < MIN_INLINE_CONTENT_CHARS) {
|
|
469
|
-
return DEFAULT_MAX_INLINE_CONTENT_CHARS;
|
|
470
|
-
}
|
|
471
|
-
return Math.min(value, MAX_INLINE_CONTENT_CHARS);
|
|
472
|
-
}
|
|
473
|
-
function stripThumbnails(results) {
|
|
474
|
-
return results.map(({ thumbnail, frames, ...rest }) => rest);
|
|
475
|
-
}
|
|
476
|
-
function storeFetchResult(pi, responseId, data, authProfile) {
|
|
477
|
-
if (authProfile?.cache === "off")
|
|
478
|
-
return false;
|
|
479
|
-
pi.appendEntry("web-search-results", storeFetchedContentResult(responseId, data));
|
|
480
|
-
return true;
|
|
481
|
-
}
|
|
482
|
-
function initialContentSlice(content, maxChars) {
|
|
483
|
-
let endOffset = Math.min(content.length, maxChars);
|
|
484
|
-
if (endOffset < content.length) {
|
|
485
|
-
const lineBreak = content.lastIndexOf(`
|
|
486
|
-
`, endOffset);
|
|
487
|
-
if (lineBreak >= Math.floor(maxChars * 0.8))
|
|
488
|
-
endOffset = lineBreak + 1;
|
|
489
|
-
}
|
|
490
|
-
const text = content.slice(0, endOffset);
|
|
491
|
-
return {
|
|
492
|
-
text,
|
|
493
|
-
endOffset,
|
|
494
|
-
totalBytes: Buffer.byteLength(content),
|
|
495
|
-
totalLines: content.length === 0 ? 0 : content.split(`
|
|
496
|
-
`).length,
|
|
497
|
-
shownBytes: Buffer.byteLength(text),
|
|
498
|
-
shownLines: text.length === 0 ? 0 : text.split(`
|
|
499
|
-
`).length
|
|
500
|
-
};
|
|
501
|
-
}
|
|
502
|
-
function normalizeFindQueries(value) {
|
|
503
|
-
const queries = (Array.isArray(value) ? value : [value]).map((query) => query.trim()).filter(Boolean);
|
|
504
|
-
if (queries.length === 0)
|
|
505
|
-
throw new Error("findText must contain at least one non-empty string");
|
|
506
|
-
return queries;
|
|
507
|
-
}
|
|
508
|
-
function normalizeFindMode(value) {
|
|
509
|
-
if (value === undefined)
|
|
510
|
-
return;
|
|
511
|
-
if (value === "exact" || value === "case-insensitive" || value === "fuzzy")
|
|
512
|
-
return value;
|
|
513
|
-
throw new Error('findMode must be "exact", "case-insensitive", or "fuzzy"');
|
|
514
|
-
}
|
|
515
|
-
function normalizeGetSearchContentParams(params) {
|
|
516
|
-
const normalized = { ...params, findMode: normalizeFindMode(params.findMode) };
|
|
517
|
-
if (normalized.query?.trim() === "")
|
|
518
|
-
delete normalized.query;
|
|
519
|
-
if (normalized.url?.trim() === "")
|
|
520
|
-
delete normalized.url;
|
|
521
|
-
if (normalized.findText !== undefined) {
|
|
522
|
-
delete normalized.offset;
|
|
523
|
-
delete normalized.limit;
|
|
524
|
-
}
|
|
525
|
-
return normalized;
|
|
526
|
-
}
|
|
527
|
-
function formatInputValue(value) {
|
|
528
|
-
if (typeof value === "string")
|
|
529
|
-
return JSON.stringify(value);
|
|
530
|
-
if (typeof value === "number")
|
|
531
|
-
return Number.isNaN(value) ? "NaN" : String(value);
|
|
532
|
-
try {
|
|
533
|
-
const serialized = JSON.stringify(value);
|
|
534
|
-
return serialized === undefined ? String(value) : serialized;
|
|
535
|
-
} catch {
|
|
536
|
-
return String(value);
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
function formatSearchSummary(results, answer) {
|
|
540
|
-
if (results.length === 0) {
|
|
541
|
-
return answer ? `${answer}
|
|
542
|
-
|
|
543
|
-
---
|
|
544
|
-
|
|
545
|
-
**Sources:**
|
|
546
|
-
No sources returned.` : "No results found.";
|
|
547
|
-
}
|
|
548
|
-
let output = answer ? `${answer}
|
|
549
|
-
|
|
550
|
-
---
|
|
551
|
-
|
|
552
|
-
**Sources:**
|
|
553
|
-
` : "";
|
|
554
|
-
output += results.map((r, i) => `${i + 1}. ${r.title}
|
|
555
|
-
${r.url}`).join(`
|
|
556
|
-
|
|
557
|
-
`);
|
|
558
|
-
return output;
|
|
559
|
-
}
|
|
560
|
-
function formatSourceCheckResult(artifact, getSearchContentTool = DEFAULT_TOOL_NAMES.getSearchContent) {
|
|
561
|
-
const assessment = artifact.claims?.[0];
|
|
562
|
-
const lines = [`# Source check: ${artifact.query}`, ""];
|
|
563
|
-
if (assessment) {
|
|
564
|
-
lines.push(`**Status:** ${assessment.status} (confidence ${assessment.confidence.toFixed(2)})`);
|
|
565
|
-
lines.push(`**Rationale:** ${assessment.rationale}`);
|
|
566
|
-
if (assessment.supporting_passages.length > 0)
|
|
567
|
-
lines.push(`**Supporting passages:** ${assessment.supporting_passages.join(", ")}`);
|
|
568
|
-
if (assessment.contradicting_passages.length > 0)
|
|
569
|
-
lines.push(`**Contradicting passages:** ${assessment.contradicting_passages.join(", ")}`);
|
|
570
|
-
lines.push("");
|
|
571
|
-
}
|
|
572
|
-
if (artifact.sources.length > 0) {
|
|
573
|
-
lines.push("## Sources");
|
|
574
|
-
for (const source of artifact.sources)
|
|
575
|
-
lines.push(`${source.rank}. [${source.quality}] ${source.title}
|
|
576
|
-
${source.url}`);
|
|
577
|
-
lines.push("");
|
|
578
|
-
}
|
|
579
|
-
if (artifact.errors?.length)
|
|
580
|
-
lines.push(`Search errors: ${artifact.errors.map((entry) => `${entry.query}: ${entry.error}`).join("; ")}`);
|
|
581
|
-
lines.push(getSearchContentTool ? `Artifact responseId: ${artifact.id} (retrievable via ${getSearchContentTool}).` : `Artifact responseId: ${artifact.id}. Content retrieval is not registered.`);
|
|
582
|
-
return lines.join(`
|
|
583
|
-
`);
|
|
584
|
-
}
|
|
585
|
-
function duplicateQuerySet(results) {
|
|
586
|
-
const counts = new Map;
|
|
587
|
-
for (const result of results) {
|
|
588
|
-
counts.set(result.query, (counts.get(result.query) ?? 0) + 1);
|
|
589
|
-
}
|
|
590
|
-
const duplicates = new Set;
|
|
591
|
-
for (const [query, count] of counts) {
|
|
592
|
-
if (count > 1)
|
|
593
|
-
duplicates.add(query);
|
|
594
|
-
}
|
|
595
|
-
return duplicates;
|
|
596
|
-
}
|
|
597
|
-
function formatQueryHeader(query, provider, duplicateQueries) {
|
|
598
|
-
const suffix = duplicateQueries.has(query) && provider ? ` (${provider})` : "";
|
|
599
|
-
return `## Query: "${query}"${suffix}
|
|
600
|
-
|
|
601
|
-
`;
|
|
602
|
-
}
|
|
603
|
-
function hasFullInlineCoverage(urls, inlineContent) {
|
|
604
|
-
if (!inlineContent || inlineContent.length === 0)
|
|
605
|
-
return false;
|
|
606
|
-
const coveredUrls = new Set(inlineContent.map((c) => c.url));
|
|
607
|
-
return urls.every((url) => coveredUrls.has(url));
|
|
608
|
-
}
|
|
609
|
-
function formatFullResults(queryData) {
|
|
610
|
-
let output = `## Results for: "${queryData.query}"
|
|
611
|
-
|
|
612
|
-
`;
|
|
613
|
-
const providers = queryData.providers ?? (queryData.provider ? [queryData.provider] : []);
|
|
614
|
-
if (providers.length > 0)
|
|
615
|
-
output += `**Provider${providers.length === 1 ? "" : "s"}:** ${providers.join(", ")}
|
|
616
|
-
|
|
617
|
-
`;
|
|
618
|
-
if (queryData.answer) {
|
|
619
|
-
output += `${queryData.answer}
|
|
620
|
-
|
|
621
|
-
---
|
|
622
|
-
|
|
623
|
-
`;
|
|
624
|
-
}
|
|
625
|
-
for (const r of queryData.results) {
|
|
626
|
-
output += `### ${r.title}
|
|
627
|
-
${r.url}${r.snippet ? `
|
|
628
|
-
|
|
629
|
-
${r.snippet}` : ""}
|
|
630
|
-
|
|
631
|
-
`;
|
|
632
|
-
}
|
|
633
|
-
return output;
|
|
634
|
-
}
|
|
635
|
-
function boundSearchPresentation(text, guidance, truncationGuidance, maxChars) {
|
|
636
|
-
const fullText = `${text}${guidance}`;
|
|
637
|
-
if (fullText.length <= maxChars) {
|
|
638
|
-
return { text: fullText, truncated: false, originalChars: text.length, returnedChars: text.length, omittedChars: 0 };
|
|
639
|
-
}
|
|
640
|
-
const marker = `
|
|
641
|
-
|
|
642
|
-
---
|
|
643
|
-
[Output truncated.]${truncationGuidance}`;
|
|
644
|
-
const prefixLength = maxChars - marker.length;
|
|
645
|
-
const bounded = `${text.slice(0, prefixLength)}${marker}`;
|
|
646
|
-
return {
|
|
647
|
-
text: bounded,
|
|
648
|
-
truncated: true,
|
|
649
|
-
originalChars: text.length,
|
|
650
|
-
returnedChars: prefixLength,
|
|
651
|
-
omittedChars: text.length - prefixLength
|
|
652
|
-
};
|
|
653
|
-
}
|
|
654
|
-
function abortPendingFetches() {
|
|
655
|
-
for (const controller of pendingFetches.values()) {
|
|
656
|
-
controller.abort();
|
|
657
|
-
}
|
|
658
|
-
pendingFetches.clear();
|
|
659
|
-
}
|
|
660
389
|
function closeCurator(callId) {
|
|
661
390
|
if (callId !== undefined) {
|
|
662
391
|
const win = glimpseWins.get(callId);
|
|
@@ -853,12 +582,9 @@ function formatEntryLine(entry, theme) {
|
|
|
853
582
|
}
|
|
854
583
|
return `${typeStr.padEnd(4)} ${target.padEnd(32)} ${statusStr.padStart(5)} ${duration.padStart(5)} ${indicator}`;
|
|
855
584
|
}
|
|
856
|
-
|
|
857
|
-
|
|
585
|
+
const liveInstances = new Map;
|
|
586
|
+
function refreshUi(ctx) {
|
|
858
587
|
closeCurator();
|
|
859
|
-
clearCloneCache();
|
|
860
|
-
sessionActive = true;
|
|
861
|
-
restoreFromSession(ctx);
|
|
862
588
|
widgetUnsubscribe?.();
|
|
863
589
|
widgetUnsubscribe = null;
|
|
864
590
|
activityMonitor.clear();
|
|
@@ -870,6 +596,10 @@ function handleSessionChange(ctx) {
|
|
|
870
596
|
export default function dm_web_access_default(pi) {
|
|
871
597
|
const initConfig = loadConfigForExtensionInit();
|
|
872
598
|
const fetchModeConfig = resolveFetchModeConfig(initConfig);
|
|
599
|
+
const toolActivation = initConfig.toolActivation ?? "auto";
|
|
600
|
+
if (toolActivation !== "auto" && toolActivation !== "dynamic" && toolActivation !== "eager") {
|
|
601
|
+
throw new Error(`toolActivation in ${WEB_SEARCH_CONFIG_PATH} must be "auto", "dynamic", or "eager"`);
|
|
602
|
+
}
|
|
873
603
|
const allowedSearchProviders = initConfig.webSearch?.allowedProviders === undefined ? RESOLVED_SEARCH_PROVIDERS : getAllowedSearchProviders();
|
|
874
604
|
const allEligibleProviders = allowedSearchProviders.filter((provider) => ALL_SEARCH_PROVIDERS.includes(provider));
|
|
875
605
|
const allExcludedProviders = allowedSearchProviders.filter((provider) => !ALL_SEARCH_PROVIDERS.includes(provider));
|
|
@@ -880,27 +610,72 @@ export default function dm_web_access_default(pi) {
|
|
|
880
610
|
const sourceCheckEnabled = isToolEnabled(initConfig, "sourceCheck");
|
|
881
611
|
const fetchContentEnabled = isToolEnabled(initConfig, "fetchContent");
|
|
882
612
|
const getSearchContentEnabled = isToolEnabled(initConfig, "getSearchContent");
|
|
883
|
-
const
|
|
884
|
-
|
|
885
|
-
|
|
613
|
+
const coreSettings = {
|
|
614
|
+
toolNames,
|
|
615
|
+
enabledTools: {
|
|
616
|
+
webSearch: webSearchEnabled,
|
|
617
|
+
sourceCheck: sourceCheckEnabled,
|
|
618
|
+
fetchContent: fetchContentEnabled,
|
|
619
|
+
getSearchContent: getSearchContentEnabled
|
|
620
|
+
},
|
|
621
|
+
maxInlineContentChars: getMaxInlineContentChars(initConfig),
|
|
622
|
+
fetchModes: fetchModeConfig
|
|
886
623
|
};
|
|
887
|
-
const
|
|
888
|
-
|
|
889
|
-
...sourceCheckEnabled ? [toolNames.sourceCheck] : [],
|
|
890
|
-
...fetchContentEnabled ? [toolNames.fetchContent] : []
|
|
891
|
-
]);
|
|
624
|
+
const registeredToolNames = registeredFetchToolNames(coreSettings);
|
|
625
|
+
const storedContentSources = storedContentSourceNames(coreSettings);
|
|
892
626
|
const searchQueryDescription = webSearchEnabled ? `Get content for this query (${toolNames.webSearch})` : "Get content for a stored search query";
|
|
893
627
|
const fetchContentStorageNote = getSearchContentEnabled ? `Full original content is stored for retrieval with ${toolNames.getSearchContent}.` : "Full original content is stored internally, but the retrieval tool is not registered.";
|
|
894
628
|
const fetchModeDescription = fetchModeConfig.allowedModes.map((mode) => `${mode}${mode === fetchModeConfig.defaultMode ? " (default)" : ""}: ${FETCH_MODE_DESCRIPTIONS[mode]}`).join("; ");
|
|
895
629
|
const curateKey = initConfig.shortcuts?.curate || DEFAULT_SHORTCUTS.curate;
|
|
896
630
|
const activityKey = initConfig.shortcuts?.activity || DEFAULT_SHORTCUTS.activity;
|
|
897
|
-
|
|
631
|
+
const instance = {};
|
|
632
|
+
const pendingFetches = new Map;
|
|
633
|
+
let sessionActive = false;
|
|
634
|
+
const ownedResults = new Set;
|
|
635
|
+
function abortPendingFetches() {
|
|
636
|
+
for (const controller of pendingFetches.values()) {
|
|
637
|
+
controller.abort();
|
|
638
|
+
}
|
|
639
|
+
pendingFetches.clear();
|
|
640
|
+
}
|
|
641
|
+
function own(id) {
|
|
642
|
+
if (ownedResults.has(id))
|
|
643
|
+
return;
|
|
644
|
+
ownedResults.add(id);
|
|
645
|
+
holdResults([id]);
|
|
646
|
+
}
|
|
647
|
+
function publish(data) {
|
|
648
|
+
own(data.id);
|
|
649
|
+
pi.appendEntry("web-search-results", data);
|
|
650
|
+
}
|
|
651
|
+
function endSession() {
|
|
652
|
+
sessionActive = false;
|
|
653
|
+
abortPendingFetches();
|
|
654
|
+
releaseResults(ownedResults);
|
|
655
|
+
ownedResults.clear();
|
|
656
|
+
liveInstances.delete(instance);
|
|
657
|
+
if (liveInstances.size === 0)
|
|
658
|
+
clearCloneCache();
|
|
659
|
+
else
|
|
660
|
+
releaseClonesUnusedSince(Math.min(...liveInstances.values()));
|
|
661
|
+
}
|
|
662
|
+
function startSession(ctx) {
|
|
663
|
+
endSession();
|
|
664
|
+
liveInstances.set(instance, Date.now());
|
|
665
|
+
sessionActive = true;
|
|
666
|
+
const restored = loadSessionResults(ctx);
|
|
667
|
+
for (const data of restored)
|
|
668
|
+
own(data.id);
|
|
669
|
+
touchClones(restored.flatMap((data) => data.type === "fetch" ? (data.urls ?? data.urlMetadata ?? []).map((u) => u.url) : []));
|
|
670
|
+
refreshUi(ctx);
|
|
671
|
+
}
|
|
672
|
+
function startBackgroundFetch(urls, proxy, provided) {
|
|
898
673
|
if (urls.length === 0)
|
|
899
674
|
return null;
|
|
900
675
|
const fetchId = generateId();
|
|
901
676
|
const controller = new AbortController;
|
|
902
677
|
pendingFetches.set(fetchId, controller);
|
|
903
|
-
Promise.resolve().then(() => runWithProxy(proxy, () => fetchAllContent(
|
|
678
|
+
Promise.resolve().then(() => fetchUncoveredContent(urls, provided, (missing) => runWithProxy(proxy, () => fetchAllContent(missing, controller.signal, withRegisteredFetchOptions(undefined, registeredToolNames, proxy))))).then((fetched) => {
|
|
904
679
|
if (!sessionActive || !pendingFetches.has(fetchId))
|
|
905
680
|
return;
|
|
906
681
|
const data = {
|
|
@@ -909,7 +684,7 @@ export default function dm_web_access_default(pi) {
|
|
|
909
684
|
timestamp: Date.now(),
|
|
910
685
|
urls: stripThumbnails(fetched)
|
|
911
686
|
};
|
|
912
|
-
|
|
687
|
+
publish(storeFetchedContentResult(fetchId, data));
|
|
913
688
|
const ok = fetched.filter((f) => !f.error).length;
|
|
914
689
|
const availability = ok === fetched.length ? "Full page content now available." : ok > 0 ? "Partial page content now available." : "No page content was fetched. Stored fetch diagnostics are available.";
|
|
915
690
|
pi.sendMessage({
|
|
@@ -934,18 +709,18 @@ export default function dm_web_access_default(pi) {
|
|
|
934
709
|
});
|
|
935
710
|
return fetchId;
|
|
936
711
|
}
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
id,
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
712
|
+
const core = createWebToolCore({
|
|
713
|
+
settings: coreSettings,
|
|
714
|
+
storeFetchedContent(id, data) {
|
|
715
|
+
publish(storeFetchedContentResult(id, data));
|
|
716
|
+
},
|
|
717
|
+
publishResult(data) {
|
|
718
|
+
publish(data);
|
|
719
|
+
},
|
|
720
|
+
startBackgroundFetch,
|
|
721
|
+
answerFromPage: (request, ctx, signal) => answerFromPage(request, ctx, signal)
|
|
722
|
+
});
|
|
723
|
+
const buildSearchReturn = core.buildSearchReturn;
|
|
949
724
|
function normalizeSummaryMeta(meta, summaryText) {
|
|
950
725
|
const normalizedText = summaryText.trim();
|
|
951
726
|
if (!meta) {
|
|
@@ -1005,7 +780,7 @@ export default function dm_web_access_default(pi) {
|
|
|
1005
780
|
throw new Error("No selected results available for summary generation");
|
|
1006
781
|
}
|
|
1007
782
|
try {
|
|
1008
|
-
return await generateSummaryDraft(selectedResults, summaryContext, signal, modelOverride, feedback, undefined, getSummaryGenerationDeadlineMs());
|
|
783
|
+
return await generateSummaryDraft(selectedResults, summaryContext, signal, modelOverride, feedback, undefined, getSummaryGenerationDeadlineMs(), getSummaryInstructions());
|
|
1009
784
|
} catch (err) {
|
|
1010
785
|
const isEmptyResponse = err instanceof Error && err.message.includes("Summary model returned empty response");
|
|
1011
786
|
if (!isEmptyResponse)
|
|
@@ -1031,25 +806,14 @@ export default function dm_web_access_default(pi) {
|
|
|
1031
806
|
seen.add(value);
|
|
1032
807
|
summaryModels.push({ value, label: value });
|
|
1033
808
|
};
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
for (const model of availableModels) {
|
|
1040
|
-
if (!modelMatchesEnabledPatterns(model, enabledModelPatterns))
|
|
1041
|
-
continue;
|
|
1042
|
-
const value = `${model.provider}/${model.id}`;
|
|
1043
|
-
availableValues.add(value);
|
|
1044
|
-
addModel(model.provider, model.id);
|
|
1045
|
-
}
|
|
1046
|
-
} catch (err) {
|
|
1047
|
-
scopeLoaded = false;
|
|
1048
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
1049
|
-
console.error(`Failed to load summary models: ${message}`);
|
|
809
|
+
for (const model of summaryContext.modelRegistry.getAvailable()) {
|
|
810
|
+
if (!isModelInScope(model, summaryContext.scopedModels))
|
|
811
|
+
continue;
|
|
812
|
+
availableValues.add(`${model.provider}/${model.id}`);
|
|
813
|
+
addModel(model.provider, model.id);
|
|
1050
814
|
}
|
|
1051
815
|
const currentModelValue = summaryContext.model ? `${summaryContext.model.provider}/${summaryContext.model.id}` : null;
|
|
1052
|
-
if (
|
|
816
|
+
if (summaryContext.model && currentModelValue && !seen.has(currentModelValue) && isModelInScope(summaryContext.model, summaryContext.scopedModels)) {
|
|
1053
817
|
addModel(summaryContext.model.provider, summaryContext.model.id);
|
|
1054
818
|
}
|
|
1055
819
|
const config = loadConfig();
|
|
@@ -1080,10 +844,10 @@ export default function dm_web_access_default(pi) {
|
|
|
1080
844
|
return selector;
|
|
1081
845
|
};
|
|
1082
846
|
let defaultSummaryModel = null;
|
|
1083
|
-
if (
|
|
847
|
+
if (configuredSummaryModel.length > 0) {
|
|
1084
848
|
defaultSummaryModel = availableValues.has(configuredSummaryModel) ? configuredSummaryModel : resolveAvailableModelValue(configuredSummaryModel);
|
|
1085
849
|
}
|
|
1086
|
-
if (
|
|
850
|
+
if (!defaultSummaryModel) {
|
|
1087
851
|
for (const preferred of preferredDefaults) {
|
|
1088
852
|
const model = findModelWithProviderRouting(summaryContext.modelRegistry, preferred.provider, preferred.id);
|
|
1089
853
|
const value = model ? `${model.provider}/${model.id}` : null;
|
|
@@ -1111,130 +875,6 @@ export default function dm_web_access_default(pi) {
|
|
|
1111
875
|
summaryMeta: deterministic.meta
|
|
1112
876
|
};
|
|
1113
877
|
}
|
|
1114
|
-
function buildSearchReturn(opts) {
|
|
1115
|
-
const sc = opts.results.filter((r) => !r.error).length;
|
|
1116
|
-
const tr = opts.results.reduce((sum, r) => sum + r.results.length, 0);
|
|
1117
|
-
const hasApprovedSummary = typeof opts.approvedSummary === "string" && opts.approvedSummary.trim().length > 0;
|
|
1118
|
-
const maxInlineContentChars = getMaxInlineContentChars(initConfig);
|
|
1119
|
-
let output = "";
|
|
1120
|
-
if (hasApprovedSummary) {
|
|
1121
|
-
output = opts.approvedSummary.trim();
|
|
1122
|
-
} else {
|
|
1123
|
-
if (opts.curated) {
|
|
1124
|
-
output += `[These results were manually curated by the user in the browser. Use them as-is — do not re-search or discard.]
|
|
1125
|
-
|
|
1126
|
-
`;
|
|
1127
|
-
}
|
|
1128
|
-
const providerNames = opts.results.map((result) => {
|
|
1129
|
-
const providers = result.providers ?? (result.provider ? [result.provider] : []);
|
|
1130
|
-
return providers.join(", ") || "unknown";
|
|
1131
|
-
});
|
|
1132
|
-
output += opts.results.length === 1 ? `**Provider:** ${providerNames[0]}
|
|
1133
|
-
|
|
1134
|
-
` : `**Providers used:** ${providerNames.map((name, index) => `Query ${index + 1}: ${name}`).join("; ")}
|
|
1135
|
-
|
|
1136
|
-
`;
|
|
1137
|
-
const duplicateQueries = opts.curated ? duplicateQuerySet(opts.results) : new Set;
|
|
1138
|
-
for (const { query, answer, results, error, provider } of opts.results) {
|
|
1139
|
-
if (opts.queryList.length > 1) {
|
|
1140
|
-
output += opts.curated ? formatQueryHeader(query, provider, duplicateQueries) : `## Query: "${query}"
|
|
1141
|
-
|
|
1142
|
-
`;
|
|
1143
|
-
}
|
|
1144
|
-
if (error)
|
|
1145
|
-
output += `Error: ${error}
|
|
1146
|
-
|
|
1147
|
-
`;
|
|
1148
|
-
else
|
|
1149
|
-
output += formatSearchSummary(results, answer) + `
|
|
1150
|
-
|
|
1151
|
-
`;
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
const hasInlineReady = hasFullInlineCoverage(opts.urls, opts.inlineContent);
|
|
1155
|
-
let fetchId = null;
|
|
1156
|
-
if (hasInlineReady && opts.inlineContent) {
|
|
1157
|
-
fetchId = generateId();
|
|
1158
|
-
const data = {
|
|
1159
|
-
id: fetchId,
|
|
1160
|
-
type: "fetch",
|
|
1161
|
-
timestamp: Date.now(),
|
|
1162
|
-
urls: opts.inlineContent
|
|
1163
|
-
};
|
|
1164
|
-
pi.appendEntry("web-search-results", storeFetchedContentResult(fetchId, data));
|
|
1165
|
-
} else if (opts.includeContent) {
|
|
1166
|
-
fetchId = startBackgroundFetch(opts.urls, opts.proxy);
|
|
1167
|
-
}
|
|
1168
|
-
const searchId = storeAndPublishSearch(opts.results);
|
|
1169
|
-
const isBackgroundFetch = fetchId !== null && !hasInlineReady;
|
|
1170
|
-
const unboundedPresentation = output.trim();
|
|
1171
|
-
const buildGuidance = (forTruncation) => {
|
|
1172
|
-
let value = "";
|
|
1173
|
-
if (hasInlineReady && opts.inlineContent && fetchId) {
|
|
1174
|
-
value += `
|
|
1175
|
-
---
|
|
1176
|
-
Full content for ${opts.inlineContent.length} sources is ready as responseId "${fetchId}". `;
|
|
1177
|
-
value += getSearchContentEnabled ? `Use ${toolNames.getSearchContent}({ responseId: "${fetchId}", urlIndex: 0, offset: 0, limit: ${maxInlineContentChars} }) to retrieve the first bounded page.` : forTruncation ? `Enable ${toolNames.getSearchContent} to retrieve the full stored content.` : "";
|
|
1178
|
-
} else if (isBackgroundFetch && fetchId) {
|
|
1179
|
-
value += `
|
|
1180
|
-
---
|
|
1181
|
-
Content fetching in background as responseId "${fetchId}". Will notify when ready.`;
|
|
1182
|
-
}
|
|
1183
|
-
if (getSearchContentEnabled || forTruncation) {
|
|
1184
|
-
value += `
|
|
1185
|
-
---
|
|
1186
|
-
Full search results are stored as responseId "${searchId}". `;
|
|
1187
|
-
value += getSearchContentEnabled ? `Use ${toolNames.getSearchContent}({ responseId: "${searchId}", queryIndex: 0, offset: 0, limit: ${maxInlineContentChars} }) to retrieve the first bounded page${opts.results.length > 1 ? `; repeat with queryIndex 1 through ${opts.results.length - 1}` : ""}.` : `Enable ${toolNames.getSearchContent} to retrieve the full stored results.`;
|
|
1188
|
-
}
|
|
1189
|
-
return value;
|
|
1190
|
-
};
|
|
1191
|
-
const presentation = hasApprovedSummary ? { text: unboundedPresentation, truncated: false, originalChars: unboundedPresentation.length, returnedChars: unboundedPresentation.length, omittedChars: 0 } : boundSearchPresentation(unboundedPresentation, buildGuidance(false), buildGuidance(true), maxInlineContentChars);
|
|
1192
|
-
return {
|
|
1193
|
-
content: [{ type: "text", text: presentation.text }],
|
|
1194
|
-
details: {
|
|
1195
|
-
queries: opts.queryList,
|
|
1196
|
-
queryCount: opts.queryList.length,
|
|
1197
|
-
successfulQueries: sc,
|
|
1198
|
-
totalResults: tr,
|
|
1199
|
-
includeContent: opts.includeContent,
|
|
1200
|
-
fetchId,
|
|
1201
|
-
fetchUrls: isBackgroundFetch ? opts.urls : undefined,
|
|
1202
|
-
searchId,
|
|
1203
|
-
queryProviders: opts.results.map((result) => ({
|
|
1204
|
-
query: result.query,
|
|
1205
|
-
providers: result.providers ?? (result.provider ? [result.provider] : [])
|
|
1206
|
-
})),
|
|
1207
|
-
truncated: presentation.truncated,
|
|
1208
|
-
originalChars: presentation.originalChars,
|
|
1209
|
-
returnedChars: presentation.returnedChars,
|
|
1210
|
-
omittedChars: presentation.omittedChars,
|
|
1211
|
-
...opts.curated ? {
|
|
1212
|
-
curated: true,
|
|
1213
|
-
curatedFrom: opts.curatedFrom,
|
|
1214
|
-
curatedQueries: opts.results.map((r) => ({
|
|
1215
|
-
query: r.query,
|
|
1216
|
-
provider: r.provider || null,
|
|
1217
|
-
answer: r.answer || null,
|
|
1218
|
-
sources: r.results.map((s) => ({ title: s.title, url: s.url })),
|
|
1219
|
-
error: r.error
|
|
1220
|
-
}))
|
|
1221
|
-
} : {},
|
|
1222
|
-
...opts.workflow && hasApprovedSummary ? {
|
|
1223
|
-
summary: {
|
|
1224
|
-
text: opts.approvedSummary.trim(),
|
|
1225
|
-
workflow: opts.workflow,
|
|
1226
|
-
model: opts.summaryMeta?.model ?? null,
|
|
1227
|
-
durationMs: opts.summaryMeta?.durationMs ?? 0,
|
|
1228
|
-
tokenEstimate: opts.summaryMeta?.tokenEstimate ?? 0,
|
|
1229
|
-
fallbackUsed: opts.summaryMeta?.fallbackUsed === true,
|
|
1230
|
-
fallbackReason: opts.summaryMeta?.fallbackReason,
|
|
1231
|
-
phase: opts.summaryMeta?.phase,
|
|
1232
|
-
edited: opts.summaryMeta?.edited === true
|
|
1233
|
-
}
|
|
1234
|
-
} : {}
|
|
1235
|
-
}
|
|
1236
|
-
};
|
|
1237
|
-
}
|
|
1238
878
|
function filterByQueryIndices(selectedQueryIndices, results) {
|
|
1239
879
|
const filteredResults = [];
|
|
1240
880
|
const filteredUrls = [];
|
|
@@ -1405,6 +1045,7 @@ Open manually: ${handle.url}` }],
|
|
|
1405
1045
|
recencyFilter: pc.recencyFilter,
|
|
1406
1046
|
domainFilter: pc.domainFilter,
|
|
1407
1047
|
includeContent: pc.includeContent,
|
|
1048
|
+
category: pc.category,
|
|
1408
1049
|
signal: addSearchSignal,
|
|
1409
1050
|
extensionContext: ctx
|
|
1410
1051
|
});
|
|
@@ -1524,14 +1165,24 @@ Open manually: ${handle.url}` }],
|
|
|
1524
1165
|
}
|
|
1525
1166
|
}
|
|
1526
1167
|
});
|
|
1527
|
-
|
|
1528
|
-
|
|
1168
|
+
const nestedSearchCallIds = new Set;
|
|
1169
|
+
if (webSearchEnabled)
|
|
1170
|
+
pi.on("tool_call", (event) => {
|
|
1171
|
+
if ("parentToolCallId" in event && event.parentToolCallId && event.toolName === toolNames.webSearch)
|
|
1172
|
+
nestedSearchCallIds.add(event.toolCallId);
|
|
1173
|
+
});
|
|
1174
|
+
pi.on("session_start", async (_event, ctx) => {
|
|
1175
|
+
nestedSearchCallIds.clear();
|
|
1176
|
+
startSession(ctx);
|
|
1177
|
+
});
|
|
1178
|
+
pi.on("session_tree", async (_event, ctx) => {
|
|
1179
|
+
nestedSearchCallIds.clear();
|
|
1180
|
+
startSession(ctx);
|
|
1181
|
+
});
|
|
1529
1182
|
pi.on("session_shutdown", () => {
|
|
1530
|
-
|
|
1531
|
-
|
|
1183
|
+
nestedSearchCallIds.clear();
|
|
1184
|
+
endSession();
|
|
1532
1185
|
closeCurator();
|
|
1533
|
-
clearCloneCache();
|
|
1534
|
-
clearResults();
|
|
1535
1186
|
widgetUnsubscribe?.();
|
|
1536
1187
|
widgetUnsubscribe = null;
|
|
1537
1188
|
activityMonitor.clear();
|
|
@@ -1541,7 +1192,8 @@ Open manually: ${handle.url}` }],
|
|
|
1541
1192
|
pi.registerTool({
|
|
1542
1193
|
name: toolNames.webSearch,
|
|
1543
1194
|
label: "Web Search",
|
|
1544
|
-
|
|
1195
|
+
prepareArguments: (args) => parseStringifiedArrays(args, ["provider", "queries", "domainFilter"]),
|
|
1196
|
+
description: `Search the web and return source-linked results or provider answers.${getSearchContentEnabled ? ` Full results are stored for retrieval with ${toolNames.getSearchContent} using the returned responseId.` : ""} For research, prefer queries with 2-4 varied angles over a single query. Omit provider to use the configured default; set it only to override that.`,
|
|
1545
1197
|
promptSnippet: "Use for web research questions. Prefer {queries:[...]} with 2-4 varied angles over a single query for broader coverage. Omit provider unless explicitly overriding the configured default.",
|
|
1546
1198
|
parameters: Type.Object({
|
|
1547
1199
|
query: Type.Optional(Type.String({ description: "Single search query. For research tasks, prefer 'queries' with multiple varied angles instead." })),
|
|
@@ -1550,6 +1202,7 @@ Open manually: ${handle.url}` }],
|
|
|
1550
1202
|
includeContent: Type.Optional(Type.Boolean({ description: "Fetch full page content (async)" })),
|
|
1551
1203
|
recencyFilter: Type.Optional(StringEnum(["day", "week", "month", "year"], { description: "Filter by recency" })),
|
|
1552
1204
|
domainFilter: Type.Optional(Type.Array(Type.String(), { description: "Limit to domains (prefix with - to exclude)" })),
|
|
1205
|
+
category: Type.Optional(Type.String({ description: "Exa only: result category, e.g. news, research paper" })),
|
|
1553
1206
|
provider: Type.Optional(searchProviderSchema(`Search provider or non-empty list of allowed providers to search simultaneously; ${allPolicyDescription}; omit this field to use the configured provider, or use auto when none is configured`, allowedSearchProviders)),
|
|
1554
1207
|
workflow: Type.Optional(StringEnum(["none", "summary-review", "auto-summary"], {
|
|
1555
1208
|
description: "Search workflow mode: none = no curator (default), summary-review = open curator with auto summary draft, auto-summary = generate summary without opening curator"
|
|
@@ -1558,12 +1211,14 @@ Open manually: ${handle.url}` }],
|
|
|
1558
1211
|
description: "http(s) or socks proxy URL (e.g. http://host:port or socks5h://host:port) used for every outbound request in this call (search APIs and content fetches). Node fetch ignores HTTP(S)_PROXY env vars, so set this (or `proxy` in web-search.json) when direct access is blocked; empty string forces direct access."
|
|
1559
1212
|
}))
|
|
1560
1213
|
}),
|
|
1214
|
+
outputSchema: webSearchOutputSchema,
|
|
1561
1215
|
async execute(callId, params, signal, onUpdate, ctx) {
|
|
1562
|
-
|
|
1216
|
+
const nested = nestedSearchCallIds.delete(callId);
|
|
1217
|
+
return markToolError(await runWithProxy(typeof params.proxy === "string" ? params.proxy : undefined, async () => {
|
|
1563
1218
|
const rawQueryList = Array.isArray(params.queries) ? params.queries : params.query !== undefined ? expandQueryString(params.query) : [];
|
|
1564
1219
|
const queryList = normalizeQueryList(rawQueryList);
|
|
1565
1220
|
const configWorkflow = loadConfigForExtensionInit().workflow;
|
|
1566
|
-
const workflow = curatorRunState.resolve(params.workflow, configWorkflow, ctx?.hasUI !== false);
|
|
1221
|
+
const workflow = nested && params.workflow === undefined ? "none" : curatorRunState.resolve(params.workflow, configWorkflow, ctx?.hasUI !== false);
|
|
1567
1222
|
const shouldCurate = workflow === "summary-review";
|
|
1568
1223
|
const recencyFilter = normalizeRecencyFilter(params.recencyFilter);
|
|
1569
1224
|
if (queryList.length === 0) {
|
|
@@ -1605,8 +1260,7 @@ Open manually: ${handle.url}` }],
|
|
|
1605
1260
|
model: ctx.model,
|
|
1606
1261
|
modelRegistry: ctx.modelRegistry,
|
|
1607
1262
|
sessionManager: ctx.sessionManager,
|
|
1608
|
-
|
|
1609
|
-
isProjectTrusted: () => ctx.isProjectTrusted()
|
|
1263
|
+
scopedModels: getDmScopedModels(ctx)
|
|
1610
1264
|
};
|
|
1611
1265
|
const summaryModelChoices = await loadSummaryModelChoices(summaryContext);
|
|
1612
1266
|
const pc = {
|
|
@@ -1621,6 +1275,7 @@ Open manually: ${handle.url}` }],
|
|
|
1621
1275
|
numResults: params.numResults,
|
|
1622
1276
|
recencyFilter,
|
|
1623
1277
|
domainFilter: params.domainFilter,
|
|
1278
|
+
category: params.category,
|
|
1624
1279
|
availableProviders,
|
|
1625
1280
|
defaultProvider,
|
|
1626
1281
|
searchProvider,
|
|
@@ -1681,6 +1336,7 @@ Open manually: ${handle.url}` }],
|
|
|
1681
1336
|
recencyFilter,
|
|
1682
1337
|
domainFilter: params.domainFilter,
|
|
1683
1338
|
includeContent: params.includeContent,
|
|
1339
|
+
category: params.category,
|
|
1684
1340
|
signal: searchSignal,
|
|
1685
1341
|
extensionContext: ctx
|
|
1686
1342
|
});
|
|
@@ -1764,93 +1420,32 @@ Open manually: ${handle.url}` }],
|
|
|
1764
1420
|
}
|
|
1765
1421
|
return promise;
|
|
1766
1422
|
}
|
|
1767
|
-
let
|
|
1768
|
-
const allUrls = [];
|
|
1769
|
-
const allInlineContent = [];
|
|
1770
|
-
const resolvedProvider = resolveRequestedProvider(params.provider);
|
|
1771
|
-
const queryResponses = await runSearchQueries(queryList, async (query) => {
|
|
1772
|
-
signal?.throwIfAborted();
|
|
1773
|
-
onUpdate?.({
|
|
1774
|
-
content: [{ type: "text", text: `Searching "${query}" (${completedSearches}/${queryList.length} complete)...` }],
|
|
1775
|
-
details: { phase: "search", progress: completedSearches / queryList.length, currentQuery: query }
|
|
1776
|
-
});
|
|
1777
|
-
try {
|
|
1778
|
-
const { answer, results, inlineContent, provider, providerResponses } = await search(query, {
|
|
1779
|
-
provider: resolvedProvider,
|
|
1780
|
-
numResults: params.numResults,
|
|
1781
|
-
recencyFilter,
|
|
1782
|
-
domainFilter: params.domainFilter,
|
|
1783
|
-
includeContent: params.includeContent,
|
|
1784
|
-
signal,
|
|
1785
|
-
extensionContext: ctx
|
|
1786
|
-
});
|
|
1787
|
-
const providers = providerResponses?.map((response) => response.provider) ?? [provider];
|
|
1788
|
-
return { result: { query, answer, results, error: null, provider, providers }, inlineContent };
|
|
1789
|
-
} catch (err) {
|
|
1790
|
-
if (signal?.aborted || isAbortError(err))
|
|
1791
|
-
throw err;
|
|
1792
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
1793
|
-
const requestedProvider = toCuratorProvider(resolvedProvider);
|
|
1794
|
-
return {
|
|
1795
|
-
result: { query, answer: "", results: [], error: message, provider: requestedProvider },
|
|
1796
|
-
inlineContent: undefined
|
|
1797
|
-
};
|
|
1798
|
-
} finally {
|
|
1799
|
-
completedSearches++;
|
|
1800
|
-
if (!signal?.aborted) {
|
|
1801
|
-
onUpdate?.({
|
|
1802
|
-
content: [{ type: "text", text: `Completed ${completedSearches}/${queryList.length} searches.` }],
|
|
1803
|
-
details: { phase: "search", progress: completedSearches / queryList.length, currentQuery: query }
|
|
1804
|
-
});
|
|
1805
|
-
}
|
|
1806
|
-
}
|
|
1807
|
-
});
|
|
1808
|
-
const searchResults = queryResponses.map((response) => response.result);
|
|
1809
|
-
for (const response of queryResponses) {
|
|
1810
|
-
for (const result of response.result.results) {
|
|
1811
|
-
if (!allUrls.includes(result.url))
|
|
1812
|
-
allUrls.push(result.url);
|
|
1813
|
-
}
|
|
1814
|
-
if (response.inlineContent)
|
|
1815
|
-
allInlineContent.push(...response.inlineContent);
|
|
1816
|
-
}
|
|
1817
|
-
let approvedSummary;
|
|
1818
|
-
let summaryMeta;
|
|
1423
|
+
let summarize;
|
|
1819
1424
|
if (workflow === "auto-summary") {
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1425
|
+
summarize = async (searchResults) => {
|
|
1426
|
+
if (!ctx) {
|
|
1427
|
+
return {
|
|
1428
|
+
content: [{ type: "text", text: "Error: Auto-summary requires an active extension context." }],
|
|
1429
|
+
details: { error: "Missing extension context" }
|
|
1430
|
+
};
|
|
1431
|
+
}
|
|
1432
|
+
onUpdate?.({
|
|
1433
|
+
content: [{ type: "text", text: "Generating summary..." }],
|
|
1434
|
+
details: { phase: "generating-summary", progress: 1 }
|
|
1435
|
+
});
|
|
1436
|
+
const summaryContext = {
|
|
1437
|
+
model: ctx.model,
|
|
1438
|
+
modelRegistry: ctx.modelRegistry,
|
|
1439
|
+
sessionManager: ctx.sessionManager,
|
|
1440
|
+
scopedModels: getDmScopedModels(ctx)
|
|
1824
1441
|
};
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
details: { phase: "generating-summary", progress: 1 }
|
|
1829
|
-
});
|
|
1830
|
-
const summaryContext = {
|
|
1831
|
-
model: ctx.model,
|
|
1832
|
-
modelRegistry: ctx.modelRegistry,
|
|
1833
|
-
sessionManager: ctx.sessionManager,
|
|
1834
|
-
cwd: ctx.cwd,
|
|
1835
|
-
isProjectTrusted: () => ctx.isProjectTrusted()
|
|
1442
|
+
const summaryModelChoices = await loadSummaryModelChoices(summaryContext);
|
|
1443
|
+
const generated = await generateSummaryDraft(searchResults, summaryContext, signal, summaryModelChoices.defaultSummaryModel ?? undefined, undefined, undefined, getSummaryGenerationDeadlineMs(), getSummaryInstructions());
|
|
1444
|
+
return { approvedSummary: generated.summary, summaryMeta: generated.meta };
|
|
1836
1445
|
};
|
|
1837
|
-
const summaryModelChoices = await loadSummaryModelChoices(summaryContext);
|
|
1838
|
-
const generated = await generateSummaryDraft(searchResults, summaryContext, signal, summaryModelChoices.defaultSummaryModel ?? undefined, undefined, undefined, getSummaryGenerationDeadlineMs());
|
|
1839
|
-
approvedSummary = generated.summary;
|
|
1840
|
-
summaryMeta = generated.meta;
|
|
1841
1446
|
}
|
|
1842
|
-
return
|
|
1843
|
-
|
|
1844
|
-
results: searchResults,
|
|
1845
|
-
urls: allUrls,
|
|
1846
|
-
includeContent: params.includeContent ?? false,
|
|
1847
|
-
inlineContent: allInlineContent.length > 0 ? allInlineContent : undefined,
|
|
1848
|
-
workflow: workflow === "auto-summary" ? "auto-summary" : undefined,
|
|
1849
|
-
approvedSummary,
|
|
1850
|
-
summaryMeta,
|
|
1851
|
-
proxy: typeof params.proxy === "string" ? params.proxy : undefined
|
|
1852
|
-
});
|
|
1853
|
-
});
|
|
1447
|
+
return core.webSearch(params, signal, { extensionContext: ctx, onUpdate, summarize, awaitContent: nested });
|
|
1448
|
+
}));
|
|
1854
1449
|
},
|
|
1855
1450
|
renderCall(args, theme) {
|
|
1856
1451
|
const input = args;
|
|
@@ -1861,13 +1456,11 @@ Open manually: ${handle.url}` }],
|
|
|
1861
1456
|
}
|
|
1862
1457
|
if (queryList.length === 1) {
|
|
1863
1458
|
const q = queryList[0];
|
|
1864
|
-
|
|
1865
|
-
return new Text(theme.fg("toolTitle", theme.bold("search ")) + theme.fg("accent", `"${display}"`), 0, 0);
|
|
1459
|
+
return new Text(theme.fg("toolTitle", theme.bold("search ")) + theme.fg("accent", `"${q}"`), 0, 0);
|
|
1866
1460
|
}
|
|
1867
1461
|
const lines = [theme.fg("toolTitle", theme.bold("search ")) + theme.fg("accent", `${queryList.length} queries`)];
|
|
1868
1462
|
for (const q of queryList.slice(0, 5)) {
|
|
1869
|
-
|
|
1870
|
-
lines.push(theme.fg("muted", ` "${display}"`));
|
|
1463
|
+
lines.push(theme.fg("muted", ` "${q}"`));
|
|
1871
1464
|
}
|
|
1872
1465
|
if (queryList.length > 5) {
|
|
1873
1466
|
lines.push(theme.fg("muted", ` ... and ${queryList.length - 5} more`));
|
|
@@ -2075,84 +1668,7 @@ Open manually: ${handle.url}` }],
|
|
|
2075
1668
|
}))
|
|
2076
1669
|
}),
|
|
2077
1670
|
async execute(_callId, params, signal, _onUpdate, ctx) {
|
|
2078
|
-
return
|
|
2079
|
-
const claim = typeof params.claim === "string" ? params.claim.trim() : "";
|
|
2080
|
-
if (!claim) {
|
|
2081
|
-
return { content: [{ type: "text", text: "Error: 'claim' is required." }], details: { error: "Missing claim" } };
|
|
2082
|
-
}
|
|
2083
|
-
const requestedQueries = Array.isArray(params.queries) ? params.queries.filter((query) => typeof query === "string").map((query) => query.trim()).filter(Boolean) : [];
|
|
2084
|
-
const queries = (requestedQueries.length > 0 ? requestedQueries : [claim]).slice(0, 8);
|
|
2085
|
-
const numResults = typeof params.numResults === "number" && Number.isFinite(params.numResults) ? Math.min(20, Math.max(1, Math.floor(params.numResults))) : 5;
|
|
2086
|
-
const domainFilter = Array.isArray(params.domainFilter) ? params.domainFilter.filter((domain) => typeof domain === "string") : undefined;
|
|
2087
|
-
const recencyFilter = normalizeRecencyFilter(params.recencyFilter);
|
|
2088
|
-
const resultsByUrl = new Map;
|
|
2089
|
-
const summaries = [];
|
|
2090
|
-
const errors = [];
|
|
2091
|
-
let provider;
|
|
2092
|
-
for (const query of queries) {
|
|
2093
|
-
if (signal?.aborted)
|
|
2094
|
-
break;
|
|
2095
|
-
try {
|
|
2096
|
-
const response = await search(query, {
|
|
2097
|
-
provider: resolveRequestedProvider(params.provider),
|
|
2098
|
-
numResults,
|
|
2099
|
-
recencyFilter,
|
|
2100
|
-
domainFilter,
|
|
2101
|
-
signal,
|
|
2102
|
-
extensionContext: ctx
|
|
2103
|
-
});
|
|
2104
|
-
if (signal?.aborted)
|
|
2105
|
-
break;
|
|
2106
|
-
provider ??= response.provider;
|
|
2107
|
-
if (response.answer)
|
|
2108
|
-
summaries.push(`${query}: ${response.answer}`);
|
|
2109
|
-
for (const result of response.results) {
|
|
2110
|
-
if (!resultsByUrl.has(result.url))
|
|
2111
|
-
resultsByUrl.set(result.url, result);
|
|
2112
|
-
}
|
|
2113
|
-
} catch (err) {
|
|
2114
|
-
if (signal?.aborted || isAbortError(err))
|
|
2115
|
-
break;
|
|
2116
|
-
errors.push({ query, error: err instanceof Error ? err.message : String(err) });
|
|
2117
|
-
}
|
|
2118
|
-
}
|
|
2119
|
-
const results = [...resultsByUrl.values()].slice(0, 20).map((result, index) => ({ ...result, rank: index + 1 }));
|
|
2120
|
-
let fetched = [];
|
|
2121
|
-
if (params.fetchContent && results.length > 0) {
|
|
2122
|
-
const urls = results.slice(0, 5).map((result) => result.url);
|
|
2123
|
-
try {
|
|
2124
|
-
fetched = await fetchAllContent(urls, signal, withRegisteredFetchOptions(undefined, registeredToolNames, typeof params.proxy === "string" ? params.proxy : undefined));
|
|
2125
|
-
} catch (err) {
|
|
2126
|
-
if (signal?.aborted || isAbortError(err))
|
|
2127
|
-
throw err;
|
|
2128
|
-
fetched = urls.map((url) => ({ url, title: "", content: "", error: err instanceof Error ? err.message : String(err) }));
|
|
2129
|
-
}
|
|
2130
|
-
}
|
|
2131
|
-
const artifact = withClaimAssessment(buildResearchArtifact({
|
|
2132
|
-
query: claim,
|
|
2133
|
-
provider,
|
|
2134
|
-
summary: summaries.length > 0 ? summaries.join(`
|
|
2135
|
-
|
|
2136
|
-
`) : undefined,
|
|
2137
|
-
results,
|
|
2138
|
-
fetched,
|
|
2139
|
-
recency: recencyFilter,
|
|
2140
|
-
domainFilter
|
|
2141
|
-
}), [claim]);
|
|
2142
|
-
if (errors.length > 0)
|
|
2143
|
-
artifact.errors = errors;
|
|
2144
|
-
storeResearchArtifact(artifact);
|
|
2145
|
-
pi.appendEntry("web-search-results", {
|
|
2146
|
-
id: artifact.id,
|
|
2147
|
-
type: "research",
|
|
2148
|
-
timestamp: artifact.timestamp,
|
|
2149
|
-
artifact
|
|
2150
|
-
});
|
|
2151
|
-
return {
|
|
2152
|
-
content: [{ type: "text", text: formatSourceCheckResult(artifact, getSearchContentEnabled ? toolNames.getSearchContent : null) }],
|
|
2153
|
-
details: { responseId: artifact.id, artifact, sourceCount: artifact.sources.length, passageCount: artifact.passages.length }
|
|
2154
|
-
};
|
|
2155
|
-
});
|
|
1671
|
+
return markToolError(await core.sourceCheck(params, signal, { extensionContext: ctx }));
|
|
2156
1672
|
}
|
|
2157
1673
|
});
|
|
2158
1674
|
if (fetchContentEnabled)
|
|
@@ -2196,170 +1712,9 @@ Open manually: ${handle.url}` }],
|
|
|
2196
1712
|
description: "http(s) or socks proxy URL (e.g. http://host:port or socks5h://host:port) used for this fetch. Needed when the target is unreachable directly; localhost and NO_PROXY hosts always bypass the proxy. Empty string forces direct access."
|
|
2197
1713
|
}))
|
|
2198
1714
|
}),
|
|
1715
|
+
outputSchema: fetchContentOutputSchema,
|
|
2199
1716
|
async execute(_toolCallId, params, signal, onUpdate, ctx) {
|
|
2200
|
-
|
|
2201
|
-
try {
|
|
2202
|
-
normalized = normalizeFetchContentParams(params);
|
|
2203
|
-
} catch (err) {
|
|
2204
|
-
const error = err instanceof Error ? err.message : String(err);
|
|
2205
|
-
return { content: [{ type: "text", text: `Error: ${error}` }], details: { error } };
|
|
2206
|
-
}
|
|
2207
|
-
const { urlList, options } = normalized;
|
|
2208
|
-
const mode = options.mode ?? fetchModeConfig.defaultMode;
|
|
2209
|
-
if (!fetchModeConfig.allowedModes.includes(mode)) {
|
|
2210
|
-
const error = `Fetch mode "${mode}" is disabled by fetch.allowedModes.`;
|
|
2211
|
-
return { content: [{ type: "text", text: `Error: ${error}` }], details: { error } };
|
|
2212
|
-
}
|
|
2213
|
-
return runWithProxy(options.proxy, async () => {
|
|
2214
|
-
if (mode === "answer" && !options.prompt) {
|
|
2215
|
-
return { content: [{ type: "text", text: "Error: mode answer requires prompt." }], details: { error: "mode answer requires prompt" } };
|
|
2216
|
-
}
|
|
2217
|
-
if (mode === "raw" && (options.forceClone === true || options.timestamp || options.frames || options.prompt || options.model || options.answerModel)) {
|
|
2218
|
-
return { content: [{ type: "text", text: "Error: mode raw cannot be combined with forceClone, prompt, timestamp, frames, model, or answerModel." }], details: { error: "Incompatible raw mode options" } };
|
|
2219
|
-
}
|
|
2220
|
-
if (mode !== "answer" && options.answerModel) {
|
|
2221
|
-
return { content: [{ type: "text", text: "Error: answerModel requires mode answer." }], details: { error: "answerModel requires mode answer" } };
|
|
2222
|
-
}
|
|
2223
|
-
if (mode === "answer" && options.model) {
|
|
2224
|
-
return { content: [{ type: "text", text: "Error: use answerModel, not model, with mode answer." }], details: { error: "model is incompatible with mode answer" } };
|
|
2225
|
-
}
|
|
2226
|
-
if (mode === "answer" && options.auth !== undefined) {
|
|
2227
|
-
return { content: [{ type: "text", text: "Error: auth cannot be combined with mode answer." }], details: { error: "auth cannot be combined with mode answer" } };
|
|
2228
|
-
}
|
|
2229
|
-
let authFetchProfile;
|
|
2230
|
-
if (options.auth !== undefined) {
|
|
2231
|
-
try {
|
|
2232
|
-
authFetchProfile = resolveAuthFetchProfile(options.auth);
|
|
2233
|
-
} catch (err) {
|
|
2234
|
-
const error = err instanceof Error ? err.message : String(err);
|
|
2235
|
-
return { content: [{ type: "text", text: `Error: ${error}` }], details: { error } };
|
|
2236
|
-
}
|
|
2237
|
-
}
|
|
2238
|
-
if (urlList.length === 0) {
|
|
2239
|
-
return {
|
|
2240
|
-
content: [{ type: "text", text: "Error: No URL provided." }],
|
|
2241
|
-
details: { error: "No URL provided" }
|
|
2242
|
-
};
|
|
2243
|
-
}
|
|
2244
|
-
onUpdate?.({
|
|
2245
|
-
content: [{ type: "text", text: `Fetching ${urlList.length} URL(s)...` }],
|
|
2246
|
-
details: { phase: "fetch", progress: 0 }
|
|
2247
|
-
});
|
|
2248
|
-
const { answerModel: _answerModel, auth: _auth, ...extractionOptions } = { ...options, mode };
|
|
2249
|
-
const { prompt: _prompt, ...answerExtractionOptions } = extractionOptions;
|
|
2250
|
-
const fetchOptions = {
|
|
2251
|
-
...mode === "answer" ? answerExtractionOptions : extractionOptions,
|
|
2252
|
-
...authFetchProfile ? { authFetchProfile } : {}
|
|
2253
|
-
};
|
|
2254
|
-
const fetchResults = await fetchAllContent(urlList, signal, withRegisteredFetchOptions(fetchOptions, registeredToolNames, options.proxy));
|
|
2255
|
-
const presentedResults = mode === "answer" ? await Promise.all(fetchResults.map(async (result) => {
|
|
2256
|
-
if (result.error)
|
|
2257
|
-
return result;
|
|
2258
|
-
if (result.thumbnail || result.mimeType?.startsWith("image/")) {
|
|
2259
|
-
return { ...result, error: "Page answer requires textual fetched content" };
|
|
2260
|
-
}
|
|
2261
|
-
try {
|
|
2262
|
-
const answer = await answerFromPage({
|
|
2263
|
-
question: options.prompt,
|
|
2264
|
-
pageText: result.content,
|
|
2265
|
-
sourceUrl: result.url,
|
|
2266
|
-
...options.answerModel ? { model: options.answerModel } : {}
|
|
2267
|
-
}, ctx, signal);
|
|
2268
|
-
return { ...result, content: answer.text };
|
|
2269
|
-
} catch (err) {
|
|
2270
|
-
return { ...result, error: `Page answer failed: ${err instanceof Error ? err.message : String(err)}` };
|
|
2271
|
-
}
|
|
2272
|
-
})) : fetchResults;
|
|
2273
|
-
const successful = presentedResults.filter((r) => !r.error).length;
|
|
2274
|
-
const totalChars = presentedResults.reduce((sum, r) => sum + r.content.length, 0);
|
|
2275
|
-
const responseId = generateId();
|
|
2276
|
-
const data = {
|
|
2277
|
-
id: responseId,
|
|
2278
|
-
type: "fetch",
|
|
2279
|
-
timestamp: Date.now(),
|
|
2280
|
-
urls: stripThumbnails(fetchResults)
|
|
2281
|
-
};
|
|
2282
|
-
const storedContent = storeFetchResult(pi, responseId, data, authFetchProfile);
|
|
2283
|
-
if (urlList.length === 1) {
|
|
2284
|
-
const result = presentedResults[0];
|
|
2285
|
-
if (result.error) {
|
|
2286
|
-
return {
|
|
2287
|
-
content: [{ type: "text", text: `Error: ${result.error}` }],
|
|
2288
|
-
details: { urls: urlList, urlCount: 1, successful: 0, error: result.error, ...storedContent ? { responseId } : {}, prompt: params.prompt, timestamp: params.timestamp, frames: params.frames }
|
|
2289
|
-
};
|
|
2290
|
-
}
|
|
2291
|
-
const fullLength = result.content.length;
|
|
2292
|
-
const slice = initialContentSlice(result.content, getMaxInlineContentChars());
|
|
2293
|
-
const truncated = slice.endOffset < fullLength;
|
|
2294
|
-
let output = slice.text;
|
|
2295
|
-
if (truncated) {
|
|
2296
|
-
output += `
|
|
2297
|
-
|
|
2298
|
-
---
|
|
2299
|
-
Showing ${slice.endOffset} of ${fullLength} chars, ${slice.shownBytes} of ${slice.totalBytes} bytes, and ${slice.shownLines} of ${slice.totalLines} lines. `;
|
|
2300
|
-
output += storedContent ? getSearchContentEnabled ? `Use ${toolNames.getSearchContent}({ responseId: "${responseId}", urlIndex: 0, offset: ${slice.endOffset} }) for the next slice.` : "Content retrieval is not registered." : "Authenticated fetch cache is off; repeat the fetch to read more.";
|
|
2301
|
-
}
|
|
2302
|
-
const content = [];
|
|
2303
|
-
if (result.frames?.length) {
|
|
2304
|
-
for (const frame of result.frames) {
|
|
2305
|
-
content.push({ type: "image", data: frame.data, mimeType: frame.mimeType });
|
|
2306
|
-
content.push({ type: "text", text: `Frame at ${frame.timestamp}` });
|
|
2307
|
-
}
|
|
2308
|
-
} else if (result.thumbnail) {
|
|
2309
|
-
content.push({ type: "image", data: result.thumbnail.data, mimeType: result.thumbnail.mimeType });
|
|
2310
|
-
}
|
|
2311
|
-
content.push({ type: "text", text: output });
|
|
2312
|
-
const imageCount = (result.frames?.length ?? 0) + (result.thumbnail ? 1 : 0);
|
|
2313
|
-
return {
|
|
2314
|
-
content,
|
|
2315
|
-
details: {
|
|
2316
|
-
urls: urlList,
|
|
2317
|
-
urlCount: 1,
|
|
2318
|
-
successful: 1,
|
|
2319
|
-
totalChars: fullLength,
|
|
2320
|
-
title: result.title,
|
|
2321
|
-
...storedContent ? { responseId } : {},
|
|
2322
|
-
truncated,
|
|
2323
|
-
hasImage: imageCount > 0,
|
|
2324
|
-
imageCount,
|
|
2325
|
-
prompt: params.prompt,
|
|
2326
|
-
timestamp: params.timestamp,
|
|
2327
|
-
frames: params.frames,
|
|
2328
|
-
duration: result.duration,
|
|
2329
|
-
mode,
|
|
2330
|
-
mimeType: result.mimeType,
|
|
2331
|
-
status: result.status,
|
|
2332
|
-
totalBytes: slice.totalBytes,
|
|
2333
|
-
totalLines: slice.totalLines,
|
|
2334
|
-
shownBytes: slice.shownBytes,
|
|
2335
|
-
shownLines: slice.shownLines
|
|
2336
|
-
}
|
|
2337
|
-
};
|
|
2338
|
-
}
|
|
2339
|
-
let output = `## Fetched URLs
|
|
2340
|
-
|
|
2341
|
-
`;
|
|
2342
|
-
for (const { url, title, content, error } of presentedResults) {
|
|
2343
|
-
if (error) {
|
|
2344
|
-
output += `- ${url}: Error - ${error}
|
|
2345
|
-
`;
|
|
2346
|
-
} else {
|
|
2347
|
-
output += `- ${title || url} (${content.length} chars)
|
|
2348
|
-
`;
|
|
2349
|
-
}
|
|
2350
|
-
}
|
|
2351
|
-
output += storedContent ? getSearchContentEnabled ? `
|
|
2352
|
-
---
|
|
2353
|
-
Use ${toolNames.getSearchContent}({ responseId: "${responseId}", urlIndex: 0 }) to retrieve bounded content slices.` : `
|
|
2354
|
-
---
|
|
2355
|
-
Content retrieval is not registered.` : `
|
|
2356
|
-
---
|
|
2357
|
-
Authenticated fetch cache is off; repeat the fetch to read content.`;
|
|
2358
|
-
return {
|
|
2359
|
-
content: [{ type: "text", text: output }],
|
|
2360
|
-
details: { urls: urlList, urlCount: urlList.length, successful, totalChars, ...storedContent ? { responseId } : {} }
|
|
2361
|
-
};
|
|
2362
|
-
});
|
|
1717
|
+
return markToolError(await core.fetchContent(params, signal, { extensionContext: ctx, onUpdate }));
|
|
2363
1718
|
},
|
|
2364
1719
|
renderCall(args, theme) {
|
|
2365
1720
|
let normalized;
|
|
@@ -2375,13 +1730,11 @@ Authenticated fetch cache is off; repeat the fetch to read content.`;
|
|
|
2375
1730
|
}
|
|
2376
1731
|
const lines = [];
|
|
2377
1732
|
if (urlList.length === 1) {
|
|
2378
|
-
|
|
2379
|
-
lines.push(theme.fg("toolTitle", theme.bold("fetch ")) + theme.fg("accent", display));
|
|
1733
|
+
lines.push(theme.fg("toolTitle", theme.bold("fetch ")) + theme.fg("accent", urlList[0]));
|
|
2380
1734
|
} else {
|
|
2381
1735
|
lines.push(theme.fg("toolTitle", theme.bold("fetch ")) + theme.fg("accent", `${urlList.length} URLs`));
|
|
2382
1736
|
for (const u of urlList.slice(0, 5)) {
|
|
2383
|
-
|
|
2384
|
-
lines.push(theme.fg("muted", " " + display));
|
|
1737
|
+
lines.push(theme.fg("muted", " " + u));
|
|
2385
1738
|
}
|
|
2386
1739
|
if (urlList.length > 5) {
|
|
2387
1740
|
lines.push(theme.fg("muted", ` ... and ${urlList.length - 5} more`));
|
|
@@ -2504,291 +1857,7 @@ Authenticated fetch cache is off; repeat the fetch to read content.`;
|
|
|
2504
1857
|
findMode: Type.Optional(StringEnum(["exact", "case-insensitive", "fuzzy"], { description: "Matching mode for findText (default: case-insensitive). Requires findText." }))
|
|
2505
1858
|
}),
|
|
2506
1859
|
async execute(_toolCallId, rawParams) {
|
|
2507
|
-
|
|
2508
|
-
if (params.findMode !== undefined && params.findText === undefined) {
|
|
2509
|
-
return {
|
|
2510
|
-
content: [{ type: "text", text: `findMode ${formatInputValue(params.findMode)} requires findText; provide findText or omit findMode.` }],
|
|
2511
|
-
details: { error: "findMode requires findText" }
|
|
2512
|
-
};
|
|
2513
|
-
}
|
|
2514
|
-
const data = getResult(params.responseId);
|
|
2515
|
-
if (!data) {
|
|
2516
|
-
return {
|
|
2517
|
-
content: [{ type: "text", text: `Error: No stored results for responseId ${formatInputValue(params.responseId)}. Use a responseId returned by ${storedContentSources}.` }],
|
|
2518
|
-
details: { error: "Not found", responseId: params.responseId }
|
|
2519
|
-
};
|
|
2520
|
-
}
|
|
2521
|
-
if (data.type === "research") {
|
|
2522
|
-
const artifact = getResearchArtifact(params.responseId);
|
|
2523
|
-
if (!artifact) {
|
|
2524
|
-
return {
|
|
2525
|
-
content: [{ type: "text", text: `Error: stored research artifact for responseId ${formatInputValue(params.responseId)} was not found. Use a responseId returned by ${storedContentSources}.` }],
|
|
2526
|
-
details: { error: "Artifact not found", responseId: params.responseId }
|
|
2527
|
-
};
|
|
2528
|
-
}
|
|
2529
|
-
const serialized = JSON.stringify(artifact, null, 2);
|
|
2530
|
-
if (params.findText !== undefined) {
|
|
2531
|
-
try {
|
|
2532
|
-
const found = findContent(serialized, normalizeFindQueries(params.findText), params.findMode ?? "case-insensitive");
|
|
2533
|
-
const { text, ...findDetails } = found;
|
|
2534
|
-
return {
|
|
2535
|
-
content: [{ type: "text", text }],
|
|
2536
|
-
details: { responseId: artifact.id, type: "research", contentLength: serialized.length, findMode: params.findMode ?? "case-insensitive", ...findDetails }
|
|
2537
|
-
};
|
|
2538
|
-
} catch (err) {
|
|
2539
|
-
const error = err instanceof Error ? err.message : String(err);
|
|
2540
|
-
return {
|
|
2541
|
-
content: [{ type: "text", text: `Unable to find ${formatInputValue(params.findText)} in research artifact for responseId ${formatInputValue(params.responseId)}: ${error}. Check findText and use a supported findMode.` }],
|
|
2542
|
-
details: { error, responseId: params.responseId, type: "research" }
|
|
2543
|
-
};
|
|
2544
|
-
}
|
|
2545
|
-
}
|
|
2546
|
-
const offset = params.offset ?? 0;
|
|
2547
|
-
const limit = params.limit ?? maxInlineContentChars;
|
|
2548
|
-
if (!Number.isInteger(offset) || offset < 0) {
|
|
2549
|
-
return {
|
|
2550
|
-
content: [{ type: "text", text: `Invalid offset: received ${formatInputValue(offset)} for responseId ${formatInputValue(params.responseId)}; offset must be a non-negative integer. Use 0 or a larger integer.` }],
|
|
2551
|
-
details: { error: "Invalid offset", offset }
|
|
2552
|
-
};
|
|
2553
|
-
}
|
|
2554
|
-
if (!Number.isInteger(limit) || limit <= 0 || limit > maxInlineContentChars) {
|
|
2555
|
-
return {
|
|
2556
|
-
content: [{ type: "text", text: `Invalid limit: received ${formatInputValue(limit)} for responseId ${formatInputValue(params.responseId)}; limit must be an integer from 1 to ${maxInlineContentChars}. Use a value in that range.` }],
|
|
2557
|
-
details: { error: "Invalid limit", limit, maxLimit: maxInlineContentChars }
|
|
2558
|
-
};
|
|
2559
|
-
}
|
|
2560
|
-
if (offset > serialized.length) {
|
|
2561
|
-
return {
|
|
2562
|
-
content: [{ type: "text", text: `Offset ${offset} is out of range for responseId ${formatInputValue(params.responseId)}. Received offset ${offset}; valid range is 0-${serialized.length}. Use an offset within that range.` }],
|
|
2563
|
-
details: { error: "Offset out of range", offset, contentLength: serialized.length }
|
|
2564
|
-
};
|
|
2565
|
-
}
|
|
2566
|
-
const endOffset = Math.min(offset + limit, serialized.length);
|
|
2567
|
-
const artifactSlice = serialized.slice(offset, endOffset);
|
|
2568
|
-
const hasMore = endOffset < serialized.length;
|
|
2569
|
-
return {
|
|
2570
|
-
content: [{ type: "text", text: artifactSlice }],
|
|
2571
|
-
details: { responseId: artifact.id, type: "research", contentLength: serialized.length, offset, limit, returnedChars: artifactSlice.length, nextOffset: hasMore ? endOffset : null, truncated: hasMore }
|
|
2572
|
-
};
|
|
2573
|
-
}
|
|
2574
|
-
if (data.type === "search" && data.queries) {
|
|
2575
|
-
let queryData;
|
|
2576
|
-
if (params.query !== undefined) {
|
|
2577
|
-
queryData = data.queries.find((q) => q.query === params.query);
|
|
2578
|
-
if (!queryData) {
|
|
2579
|
-
const available = data.queries.map((q) => `"${q.query}"`).join(", ");
|
|
2580
|
-
return {
|
|
2581
|
-
content: [{ type: "text", text: `Query ${formatInputValue(params.query)} was not found for responseId ${formatInputValue(params.responseId)}. Received query=${formatInputValue(params.query)}. Available queries: ${available || "none"}. Use one of the available queries or queryIndex.` }],
|
|
2582
|
-
details: { error: "Query not found" }
|
|
2583
|
-
};
|
|
2584
|
-
}
|
|
2585
|
-
} else if (params.queryIndex !== undefined) {
|
|
2586
|
-
queryData = data.queries[params.queryIndex];
|
|
2587
|
-
if (!queryData) {
|
|
2588
|
-
const available = data.queries.map((q, i) => `${i}: "${q.query}"`).join(", ");
|
|
2589
|
-
return {
|
|
2590
|
-
content: [{ type: "text", text: `Query index ${formatInputValue(params.queryIndex)} is out of range for responseId ${formatInputValue(params.responseId)}. Received queryIndex=${formatInputValue(params.queryIndex)}; valid indexes are 0-${data.queries.length - 1}. Available queries: ${available || "none"}. Use one of the available indexes.` }],
|
|
2591
|
-
details: { error: "Index out of range" }
|
|
2592
|
-
};
|
|
2593
|
-
}
|
|
2594
|
-
} else {
|
|
2595
|
-
const available = data.queries.map((q, i) => `${i}: "${q.query}"`).join(", ");
|
|
2596
|
-
return {
|
|
2597
|
-
content: [{ type: "text", text: `Specify query or queryIndex for responseId ${formatInputValue(params.responseId)}. Available queries: ${available || "none"}.` }],
|
|
2598
|
-
details: { error: "No query specified" }
|
|
2599
|
-
};
|
|
2600
|
-
}
|
|
2601
|
-
if (queryData.error) {
|
|
2602
|
-
return {
|
|
2603
|
-
content: [{ type: "text", text: `Error retrieving query ${formatInputValue(queryData.query)} from responseId ${formatInputValue(params.responseId)}: ${queryData.error}. Check the stored search result and retry with another query or queryIndex if needed.` }],
|
|
2604
|
-
details: { error: queryData.error, query: queryData.query }
|
|
2605
|
-
};
|
|
2606
|
-
}
|
|
2607
|
-
const fullResults = formatFullResults(queryData);
|
|
2608
|
-
if (params.findText !== undefined) {
|
|
2609
|
-
try {
|
|
2610
|
-
const found = findContent(fullResults, normalizeFindQueries(params.findText), params.findMode ?? "case-insensitive");
|
|
2611
|
-
const { text, ...findDetails } = found;
|
|
2612
|
-
return {
|
|
2613
|
-
content: [{ type: "text", text }],
|
|
2614
|
-
details: { responseId: params.responseId, query: queryData.query, resultCount: queryData.results.length, contentLength: fullResults.length, findMode: params.findMode ?? "case-insensitive", ...findDetails }
|
|
2615
|
-
};
|
|
2616
|
-
} catch (err) {
|
|
2617
|
-
const error = err instanceof Error ? err.message : String(err);
|
|
2618
|
-
return {
|
|
2619
|
-
content: [{ type: "text", text: `Unable to find ${formatInputValue(params.findText)} in query ${formatInputValue(queryData.query)} for responseId ${formatInputValue(params.responseId)}: ${error}. Check findText and use a supported findMode.` }],
|
|
2620
|
-
details: { error, query: queryData.query }
|
|
2621
|
-
};
|
|
2622
|
-
}
|
|
2623
|
-
}
|
|
2624
|
-
const offset = params.offset ?? 0;
|
|
2625
|
-
const limit = params.limit ?? maxInlineContentChars;
|
|
2626
|
-
if (!Number.isInteger(offset) || offset < 0) {
|
|
2627
|
-
return {
|
|
2628
|
-
content: [{ type: "text", text: `Invalid offset: received ${formatInputValue(offset)} for query ${formatInputValue(queryData.query)}; offset must be a non-negative integer. Use 0 or a larger integer.` }],
|
|
2629
|
-
details: { error: "Invalid offset", offset }
|
|
2630
|
-
};
|
|
2631
|
-
}
|
|
2632
|
-
if (!Number.isInteger(limit) || limit <= 0 || limit > maxInlineContentChars) {
|
|
2633
|
-
return {
|
|
2634
|
-
content: [{ type: "text", text: `Invalid limit: received ${formatInputValue(limit)} for query ${formatInputValue(queryData.query)}; limit must be an integer from 1 to ${maxInlineContentChars}. Use a value in that range.` }],
|
|
2635
|
-
details: { error: "Invalid limit", limit, maxLimit: maxInlineContentChars }
|
|
2636
|
-
};
|
|
2637
|
-
}
|
|
2638
|
-
if (offset > fullResults.length) {
|
|
2639
|
-
return {
|
|
2640
|
-
content: [{ type: "text", text: `Offset ${offset} is out of range for query ${formatInputValue(queryData.query)} in responseId ${formatInputValue(params.responseId)}. Received offset ${offset}; valid range is 0-${fullResults.length}. Use an offset within that range.` }],
|
|
2641
|
-
details: { error: "Offset out of range", offset, contentLength: fullResults.length }
|
|
2642
|
-
};
|
|
2643
|
-
}
|
|
2644
|
-
const queryIndex = data.queries.indexOf(queryData);
|
|
2645
|
-
let returnedChars = Math.min(limit, fullResults.length - offset);
|
|
2646
|
-
let endOffset = offset + returnedChars;
|
|
2647
|
-
let continuation = "";
|
|
2648
|
-
while (endOffset < fullResults.length) {
|
|
2649
|
-
continuation = `
|
|
2650
|
-
|
|
2651
|
-
---
|
|
2652
|
-
Showing chars ${offset}-${endOffset} of ${fullResults.length}. Use ${toolNames.getSearchContent}({ responseId: "${params.responseId}", queryIndex: ${queryIndex}, offset: ${endOffset}, limit: ${limit} }) for the next slice.`;
|
|
2653
|
-
const overflow = returnedChars + continuation.length - maxInlineContentChars;
|
|
2654
|
-
if (overflow <= 0)
|
|
2655
|
-
break;
|
|
2656
|
-
returnedChars -= overflow;
|
|
2657
|
-
endOffset = offset + returnedChars;
|
|
2658
|
-
}
|
|
2659
|
-
const resultSlice = fullResults.slice(offset, endOffset);
|
|
2660
|
-
const hasMore = endOffset < fullResults.length;
|
|
2661
|
-
const text = `${resultSlice}${hasMore ? continuation : ""}`;
|
|
2662
|
-
return {
|
|
2663
|
-
content: [{ type: "text", text }],
|
|
2664
|
-
details: {
|
|
2665
|
-
responseId: params.responseId,
|
|
2666
|
-
query: queryData.query,
|
|
2667
|
-
resultCount: queryData.results.length,
|
|
2668
|
-
contentLength: fullResults.length,
|
|
2669
|
-
offset,
|
|
2670
|
-
limit,
|
|
2671
|
-
returnedChars,
|
|
2672
|
-
nextOffset: hasMore ? endOffset : null,
|
|
2673
|
-
truncated: hasMore
|
|
2674
|
-
}
|
|
2675
|
-
};
|
|
2676
|
-
}
|
|
2677
|
-
if (data.type === "fetch" && data.urls) {
|
|
2678
|
-
let urlData;
|
|
2679
|
-
let selectedUrlIndex = -1;
|
|
2680
|
-
if (params.url !== undefined) {
|
|
2681
|
-
selectedUrlIndex = data.urls.findIndex((u) => u.url === params.url);
|
|
2682
|
-
urlData = data.urls[selectedUrlIndex];
|
|
2683
|
-
if (!urlData) {
|
|
2684
|
-
const available = data.urls.map((u) => u.url).join(`
|
|
2685
|
-
`);
|
|
2686
|
-
return {
|
|
2687
|
-
content: [{ type: "text", text: `URL ${formatInputValue(params.url)} was not found for responseId ${formatInputValue(params.responseId)}. Received url=${formatInputValue(params.url)}. Available URLs:
|
|
2688
|
-
${available || " none"}
|
|
2689
|
-
Use one of the available URLs or urlIndex.` }],
|
|
2690
|
-
details: { error: "URL not found" }
|
|
2691
|
-
};
|
|
2692
|
-
}
|
|
2693
|
-
} else if (params.urlIndex !== undefined) {
|
|
2694
|
-
selectedUrlIndex = params.urlIndex;
|
|
2695
|
-
urlData = data.urls[selectedUrlIndex];
|
|
2696
|
-
if (!urlData) {
|
|
2697
|
-
const available = data.urls.map((u, i) => `${i}: ${u.url}`).join(`
|
|
2698
|
-
`);
|
|
2699
|
-
return {
|
|
2700
|
-
content: [{ type: "text", text: `URL index ${formatInputValue(params.urlIndex)} is out of range for responseId ${formatInputValue(params.responseId)}. Received urlIndex=${formatInputValue(params.urlIndex)}; valid indexes are 0-${data.urls.length - 1}. Available URLs:
|
|
2701
|
-
${available || " none"}
|
|
2702
|
-
Use one of the available indexes.` }],
|
|
2703
|
-
details: { error: "Index out of range" }
|
|
2704
|
-
};
|
|
2705
|
-
}
|
|
2706
|
-
} else {
|
|
2707
|
-
const available = data.urls.map((u, i) => `${i}: ${u.url}`).join(`
|
|
2708
|
-
`);
|
|
2709
|
-
return {
|
|
2710
|
-
content: [{ type: "text", text: `Specify url or urlIndex for responseId ${formatInputValue(params.responseId)}. Available URLs:
|
|
2711
|
-
${available || " none"}` }],
|
|
2712
|
-
details: { error: "No URL specified" }
|
|
2713
|
-
};
|
|
2714
|
-
}
|
|
2715
|
-
if (urlData.error) {
|
|
2716
|
-
return {
|
|
2717
|
-
content: [{ type: "text", text: `Error retrieving URL ${formatInputValue(urlData.url)} from responseId ${formatInputValue(params.responseId)}: ${urlData.error}. Check the stored fetch result and retry with another URL or urlIndex if needed.` }],
|
|
2718
|
-
details: { error: urlData.error, url: urlData.url }
|
|
2719
|
-
};
|
|
2720
|
-
}
|
|
2721
|
-
if (params.findText !== undefined) {
|
|
2722
|
-
try {
|
|
2723
|
-
const found = findContent(urlData.content, normalizeFindQueries(params.findText), params.findMode ?? "case-insensitive");
|
|
2724
|
-
const { text, ...findDetails } = found;
|
|
2725
|
-
return {
|
|
2726
|
-
content: [{ type: "text", text: `# ${urlData.title || urlData.url}
|
|
2727
|
-
|
|
2728
|
-
${text}` }],
|
|
2729
|
-
details: { url: urlData.url, title: urlData.title, contentLength: urlData.content.length, findMode: params.findMode ?? "case-insensitive", ...findDetails }
|
|
2730
|
-
};
|
|
2731
|
-
} catch (err) {
|
|
2732
|
-
const error = err instanceof Error ? err.message : String(err);
|
|
2733
|
-
return {
|
|
2734
|
-
content: [{ type: "text", text: `Unable to find ${formatInputValue(params.findText)} in URL ${formatInputValue(urlData.url)} for responseId ${formatInputValue(params.responseId)}: ${error}. Check findText and use a supported findMode.` }],
|
|
2735
|
-
details: { error, url: urlData.url }
|
|
2736
|
-
};
|
|
2737
|
-
}
|
|
2738
|
-
}
|
|
2739
|
-
const offset = params.offset ?? 0;
|
|
2740
|
-
const limit = params.limit ?? maxInlineContentChars;
|
|
2741
|
-
if (!Number.isInteger(offset) || offset < 0) {
|
|
2742
|
-
return {
|
|
2743
|
-
content: [{ type: "text", text: `Invalid offset: received ${formatInputValue(offset)} for URL ${formatInputValue(urlData.url)}; offset must be a non-negative integer. Use 0 or a larger integer.` }],
|
|
2744
|
-
details: { error: "Invalid offset", offset }
|
|
2745
|
-
};
|
|
2746
|
-
}
|
|
2747
|
-
if (!Number.isInteger(limit) || limit <= 0 || limit > maxInlineContentChars) {
|
|
2748
|
-
return {
|
|
2749
|
-
content: [{ type: "text", text: `Invalid limit: received ${formatInputValue(limit)} for URL ${formatInputValue(urlData.url)}; limit must be an integer from 1 to ${maxInlineContentChars}. Use a value in that range.` }],
|
|
2750
|
-
details: { error: "Invalid limit", limit, maxLimit: maxInlineContentChars }
|
|
2751
|
-
};
|
|
2752
|
-
}
|
|
2753
|
-
if (offset > urlData.content.length) {
|
|
2754
|
-
return {
|
|
2755
|
-
content: [{ type: "text", text: `Offset ${offset} is out of range for URL ${formatInputValue(urlData.url)} in responseId ${formatInputValue(params.responseId)}. Received offset ${offset}; valid range is 0-${urlData.content.length}. Use an offset within that range.` }],
|
|
2756
|
-
details: { error: "Offset out of range", offset, contentLength: urlData.content.length }
|
|
2757
|
-
};
|
|
2758
|
-
}
|
|
2759
|
-
const endOffset = Math.min(offset + limit, urlData.content.length);
|
|
2760
|
-
const contentSlice = urlData.content.slice(offset, endOffset);
|
|
2761
|
-
const hasMore = endOffset < urlData.content.length;
|
|
2762
|
-
let text = `# ${urlData.title || urlData.url}
|
|
2763
|
-
|
|
2764
|
-
${contentSlice}`;
|
|
2765
|
-
if (hasMore || offset > 0) {
|
|
2766
|
-
text += `
|
|
2767
|
-
|
|
2768
|
-
---
|
|
2769
|
-
Showing chars ${offset}-${endOffset} of ${urlData.content.length}.`;
|
|
2770
|
-
if (hasMore) {
|
|
2771
|
-
text += ` Use ${toolNames.getSearchContent}({ responseId: "${params.responseId}", urlIndex: ${selectedUrlIndex}, offset: ${endOffset}, limit: ${limit} }) for the next slice.`;
|
|
2772
|
-
}
|
|
2773
|
-
}
|
|
2774
|
-
return {
|
|
2775
|
-
content: [{ type: "text", text }],
|
|
2776
|
-
details: {
|
|
2777
|
-
url: urlData.url,
|
|
2778
|
-
title: urlData.title,
|
|
2779
|
-
contentLength: urlData.content.length,
|
|
2780
|
-
offset,
|
|
2781
|
-
limit,
|
|
2782
|
-
returnedChars: contentSlice.length,
|
|
2783
|
-
nextOffset: hasMore ? endOffset : null,
|
|
2784
|
-
truncated: hasMore
|
|
2785
|
-
}
|
|
2786
|
-
};
|
|
2787
|
-
}
|
|
2788
|
-
return {
|
|
2789
|
-
content: [{ type: "text", text: `Invalid stored data for responseId ${formatInputValue(params.responseId)}: received type ${formatInputValue(data.type)}. Use a responseId returned by ${storedContentSources}.` }],
|
|
2790
|
-
details: { error: "Invalid data" }
|
|
2791
|
-
};
|
|
1860
|
+
return markToolError(await core.getSearchContent(rawParams));
|
|
2792
1861
|
},
|
|
2793
1862
|
renderCall(args, theme) {
|
|
2794
1863
|
const { responseId, query, queryIndex, url, urlIndex, offset, findText } = args;
|
|
@@ -2846,13 +1915,13 @@ Showing chars ${offset}-${endOffset} of ${urlData.content.length}.`;
|
|
|
2846
1915
|
}
|
|
2847
1916
|
});
|
|
2848
1917
|
}
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
1918
|
+
if (toolActivation !== "eager")
|
|
1919
|
+
registerWebToolActivation(pi, [
|
|
1920
|
+
...webSearchEnabled ? [{ name: toolNames.webSearch, capability: "search" }] : [],
|
|
1921
|
+
...sourceCheckEnabled ? [{ name: toolNames.sourceCheck, capability: "source-check" }] : [],
|
|
1922
|
+
...fetchContentEnabled ? [{ name: toolNames.fetchContent, capability: "fetch" }] : [],
|
|
1923
|
+
...getSearchContentEnabled ? [{ name: toolNames.getSearchContent, capability: "stored-content" }] : []
|
|
1924
|
+
], toolActivation);
|
|
2856
1925
|
if (isCommandEnabled(initConfig, "websearch"))
|
|
2857
1926
|
pi.registerCommand("websearch", {
|
|
2858
1927
|
description: "Open web search curator",
|
|
@@ -2881,8 +1950,7 @@ Showing chars ${offset}-${endOffset} of ${urlData.content.length}.`;
|
|
|
2881
1950
|
model: ctx.model,
|
|
2882
1951
|
modelRegistry: ctx.modelRegistry,
|
|
2883
1952
|
sessionManager: ctx.sessionManager,
|
|
2884
|
-
|
|
2885
|
-
isProjectTrusted: () => ctx.isProjectTrusted()
|
|
1953
|
+
scopedModels: getDmScopedModels(ctx)
|
|
2886
1954
|
};
|
|
2887
1955
|
const summaryModelChoices = await loadSummaryModelChoices(summaryContext);
|
|
2888
1956
|
ctx.ui.notify("Opening web search curator...", "info");
|
|
@@ -3179,7 +2247,7 @@ Showing chars ${offset}-${endOffset} of ${urlData.content.length}.`;
|
|
|
3179
2247
|
pi.registerCommand("search", {
|
|
3180
2248
|
description: "Browse stored web search results",
|
|
3181
2249
|
handler: async (_args, ctx) => {
|
|
3182
|
-
const results = getAllResults();
|
|
2250
|
+
const results = getAllResults().filter((r) => ownedResults.has(r.id));
|
|
3183
2251
|
if (results.length === 0) {
|
|
3184
2252
|
ctx.ui.notify("No stored search results", "info");
|
|
3185
2253
|
return;
|
|
@@ -3208,7 +2276,8 @@ Showing chars ${offset}-${endOffset} of ${urlData.content.length}.`;
|
|
|
3208
2276
|
const actions = ["View details", "Delete"];
|
|
3209
2277
|
const action = await ctx.ui.select(`Result ${selected.id.slice(0, 6)}`, actions);
|
|
3210
2278
|
if (action === "Delete") {
|
|
3211
|
-
|
|
2279
|
+
deleteHeldResult(selected.id);
|
|
2280
|
+
ownedResults.delete(selected.id);
|
|
3212
2281
|
ctx.ui.notify(`Deleted ${selected.id.slice(0, 6)}`, "info");
|
|
3213
2282
|
} else if (action === "View details") {
|
|
3214
2283
|
let info = `ID: ${selected.id}
|