apex-code 0.0.1-alpha.1 → 0.0.1-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +471 -0
- package/README.md +74 -680
- package/dist/cli/args.d.ts +21 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +119 -15
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/auth-command.d.ts.map +1 -1
- package/dist/cli/auth-command.js +3 -3
- package/dist/cli/auth-command.js.map +1 -1
- package/dist/cli/concurrent-session.d.ts +3 -0
- package/dist/cli/concurrent-session.d.ts.map +1 -0
- package/dist/cli/concurrent-session.js +13 -0
- package/dist/cli/concurrent-session.js.map +1 -0
- package/dist/cli/cost-command.d.ts +19 -0
- package/dist/cli/cost-command.d.ts.map +1 -0
- package/dist/cli/cost-command.js +107 -0
- package/dist/cli/cost-command.js.map +1 -0
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js +2 -1
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/cli/startup-ui.d.ts +1 -1
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +1 -2
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +99 -16
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +5 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +35 -20
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +2 -0
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +28 -0
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +140 -4
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +121 -9
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +364 -123
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +4 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +17 -14
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +11 -10
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +3 -0
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +4 -3
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +41 -32
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/context/deferred-schemas.d.ts +92 -0
- package/dist/core/context/deferred-schemas.d.ts.map +1 -0
- package/dist/core/context/deferred-schemas.js +74 -0
- package/dist/core/context/deferred-schemas.js.map +1 -0
- package/dist/core/context/eviction.d.ts +47 -0
- package/dist/core/context/eviction.d.ts.map +1 -0
- package/dist/core/context/eviction.js +83 -0
- package/dist/core/context/eviction.js.map +1 -0
- package/dist/core/context/pipeline.d.ts +90 -0
- package/dist/core/context/pipeline.d.ts.map +1 -0
- package/dist/core/context/pipeline.js +109 -0
- package/dist/core/context/pipeline.js.map +1 -0
- package/dist/core/credential-failover.d.ts +30 -0
- package/dist/core/credential-failover.d.ts.map +1 -0
- package/dist/core/credential-failover.js +46 -0
- package/dist/core/credential-failover.js.map +1 -0
- package/dist/core/credential-pool.d.ts +60 -0
- package/dist/core/credential-pool.d.ts.map +1 -0
- package/dist/core/credential-pool.js +84 -0
- package/dist/core/credential-pool.js.map +1 -0
- package/dist/core/defaults.d.ts +1 -0
- package/dist/core/defaults.d.ts.map +1 -1
- package/dist/core/defaults.js +9 -0
- package/dist/core/defaults.js.map +1 -1
- package/dist/core/delegation/agents.d.ts +15 -0
- package/dist/core/delegation/agents.d.ts.map +1 -0
- package/dist/core/delegation/agents.js +55 -0
- package/dist/core/delegation/agents.js.map +1 -0
- package/dist/core/delegation/ceiling.d.ts +29 -0
- package/dist/core/delegation/ceiling.d.ts.map +1 -0
- package/dist/core/delegation/ceiling.js +34 -0
- package/dist/core/delegation/ceiling.js.map +1 -0
- package/dist/core/delegation/runtime.d.ts +94 -0
- package/dist/core/delegation/runtime.d.ts.map +1 -0
- package/dist/core/delegation/runtime.js +117 -0
- package/dist/core/delegation/runtime.js.map +1 -0
- package/dist/core/durable-state/daemon.d.ts +37 -0
- package/dist/core/durable-state/daemon.d.ts.map +1 -0
- package/dist/core/durable-state/daemon.js +62 -0
- package/dist/core/durable-state/daemon.js.map +1 -0
- package/dist/core/durable-state/provenance.d.ts +7 -0
- package/dist/core/durable-state/provenance.d.ts.map +1 -0
- package/dist/core/durable-state/provenance.js +24 -0
- package/dist/core/durable-state/provenance.js.map +1 -0
- package/dist/core/durable-state/sqlite.d.ts +84 -0
- package/dist/core/durable-state/sqlite.d.ts.map +1 -0
- package/dist/core/durable-state/sqlite.js +355 -0
- package/dist/core/durable-state/sqlite.js.map +1 -0
- package/dist/core/environment.d.ts +12 -0
- package/dist/core/environment.d.ts.map +1 -0
- package/dist/core/environment.js +69 -0
- package/dist/core/environment.js.map +1 -0
- package/dist/core/evidence-policy.d.ts +17 -0
- package/dist/core/evidence-policy.d.ts.map +1 -0
- package/dist/core/evidence-policy.js +25 -0
- package/dist/core/evidence-policy.js.map +1 -0
- package/dist/core/evidence.d.ts +16 -0
- package/dist/core/evidence.d.ts.map +1 -0
- package/dist/core/evidence.js +51 -0
- package/dist/core/evidence.js.map +1 -0
- package/dist/core/experimental.d.ts +4 -0
- package/dist/core/experimental.d.ts.map +1 -1
- package/dist/core/experimental.js +6 -1
- package/dist/core/experimental.js.map +1 -1
- package/dist/core/extensions/index.d.ts +2 -2
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +115 -48
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/types.d.ts +44 -9
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js +3 -0
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts +1 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +1 -1
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts +1 -2
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +2 -17
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/http-idle-timeout.d.ts +12 -0
- package/dist/core/http-idle-timeout.d.ts.map +1 -0
- package/dist/core/http-idle-timeout.js +27 -0
- package/dist/core/http-idle-timeout.js.map +1 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/keybindings.d.ts +38 -13
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +26 -5
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/lsp/client.d.ts +78 -0
- package/dist/core/lsp/client.d.ts.map +1 -0
- package/dist/core/lsp/client.js +494 -0
- package/dist/core/lsp/client.js.map +1 -0
- package/dist/core/lsp/diagnostics.d.ts +47 -0
- package/dist/core/lsp/diagnostics.d.ts.map +1 -0
- package/dist/core/lsp/diagnostics.js +224 -0
- package/dist/core/lsp/diagnostics.js.map +1 -0
- package/dist/core/lsp/pool.d.ts +48 -0
- package/dist/core/lsp/pool.d.ts.map +1 -0
- package/dist/core/lsp/pool.js +150 -0
- package/dist/core/lsp/pool.js.map +1 -0
- package/dist/core/lsp/registry.d.ts +49 -0
- package/dist/core/lsp/registry.d.ts.map +1 -0
- package/dist/core/lsp/registry.js +215 -0
- package/dist/core/lsp/registry.js.map +1 -0
- package/dist/core/lsp/status.d.ts +23 -0
- package/dist/core/lsp/status.d.ts.map +1 -0
- package/dist/core/lsp/status.js +35 -0
- package/dist/core/lsp/status.js.map +1 -0
- package/dist/core/lsp/sync.d.ts +13 -0
- package/dist/core/lsp/sync.d.ts.map +1 -0
- package/dist/core/lsp/sync.js +71 -0
- package/dist/core/lsp/sync.js.map +1 -0
- package/dist/core/model-config.d.ts +18 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +25 -6
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-resolver.d.ts +21 -0
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +73 -8
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +73 -0
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +225 -8
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/models-store.d.ts.map +1 -1
- package/dist/core/models-store.js +2 -1
- package/dist/core/models-store.js.map +1 -1
- package/dist/core/observability/aggregate.d.ts +21 -0
- package/dist/core/observability/aggregate.d.ts.map +1 -0
- package/dist/core/observability/aggregate.js +36 -0
- package/dist/core/observability/aggregate.js.map +1 -0
- package/dist/core/observability/otlp.d.ts +66 -0
- package/dist/core/observability/otlp.d.ts.map +1 -0
- package/dist/core/observability/otlp.js +95 -0
- package/dist/core/observability/otlp.js.map +1 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +40 -16
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/permissions/gate.d.ts +42 -0
- package/dist/core/permissions/gate.d.ts.map +1 -0
- package/dist/core/permissions/gate.js +72 -0
- package/dist/core/permissions/gate.js.map +1 -0
- package/dist/core/permissions/modes.d.ts +18 -0
- package/dist/core/permissions/modes.d.ts.map +1 -0
- package/dist/core/permissions/modes.js +57 -0
- package/dist/core/permissions/modes.js.map +1 -0
- package/dist/core/permissions/responder.d.ts +30 -0
- package/dist/core/permissions/responder.d.ts.map +1 -0
- package/dist/core/permissions/responder.js +32 -0
- package/dist/core/permissions/responder.js.map +1 -0
- package/dist/core/permissions/rules.d.ts +34 -0
- package/dist/core/permissions/rules.d.ts.map +1 -0
- package/dist/core/permissions/rules.js +74 -0
- package/dist/core/permissions/rules.js.map +1 -0
- package/dist/core/permissions/startup.d.ts +45 -0
- package/dist/core/permissions/startup.d.ts.map +1 -0
- package/dist/core/permissions/startup.js +63 -0
- package/dist/core/permissions/startup.js.map +1 -0
- package/dist/core/permissions/store.d.ts +114 -0
- package/dist/core/permissions/store.d.ts.map +1 -0
- package/dist/core/permissions/store.js +229 -0
- package/dist/core/permissions/store.js.map +1 -0
- package/dist/core/pi-manifest.d.ts.map +1 -1
- package/dist/core/pi-manifest.js +2 -1
- package/dist/core/pi-manifest.js.map +1 -1
- package/dist/core/project-trust.d.ts.map +1 -1
- package/dist/core/project-trust.js +1 -1
- package/dist/core/project-trust.js.map +1 -1
- package/dist/core/provider-attribution.d.ts.map +1 -1
- package/dist/core/provider-attribution.js +6 -7
- package/dist/core/provider-attribution.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts +2 -2
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +22 -17
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +3 -2
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sandbox/bwrap-arguments.d.ts +52 -0
- package/dist/core/sandbox/bwrap-arguments.d.ts.map +1 -0
- package/dist/core/sandbox/bwrap-arguments.js +86 -0
- package/dist/core/sandbox/bwrap-arguments.js.map +1 -0
- package/dist/core/sandbox/child-entry.d.ts +2 -0
- package/dist/core/sandbox/child-entry.d.ts.map +1 -0
- package/dist/core/sandbox/child-entry.js +22 -0
- package/dist/core/sandbox/child-entry.js.map +1 -0
- package/dist/core/sandbox/cli-launch.d.ts +88 -0
- package/dist/core/sandbox/cli-launch.d.ts.map +1 -0
- package/dist/core/sandbox/cli-launch.js +272 -0
- package/dist/core/sandbox/cli-launch.js.map +1 -0
- package/dist/core/sandbox/cli-supervisor.d.ts +30 -0
- package/dist/core/sandbox/cli-supervisor.d.ts.map +1 -0
- package/dist/core/sandbox/cli-supervisor.js +123 -0
- package/dist/core/sandbox/cli-supervisor.js.map +1 -0
- package/dist/core/sandbox/default-hosts.d.ts +28 -0
- package/dist/core/sandbox/default-hosts.d.ts.map +1 -0
- package/dist/core/sandbox/default-hosts.js +69 -0
- package/dist/core/sandbox/default-hosts.js.map +1 -0
- package/dist/core/sandbox/full-access.d.ts +28 -0
- package/dist/core/sandbox/full-access.d.ts.map +1 -0
- package/dist/core/sandbox/full-access.js +63 -0
- package/dist/core/sandbox/full-access.js.map +1 -0
- package/dist/core/sandbox/git-identity.d.ts +57 -0
- package/dist/core/sandbox/git-identity.d.ts.map +1 -0
- package/dist/core/sandbox/git-identity.js +78 -0
- package/dist/core/sandbox/git-identity.js.map +1 -0
- package/dist/core/sandbox/host-approval.d.ts +42 -0
- package/dist/core/sandbox/host-approval.d.ts.map +1 -0
- package/dist/core/sandbox/host-approval.js +99 -0
- package/dist/core/sandbox/host-approval.js.map +1 -0
- package/dist/core/sandbox/linux-backend.d.ts +46 -0
- package/dist/core/sandbox/linux-backend.d.ts.map +1 -0
- package/dist/core/sandbox/linux-backend.js +304 -0
- package/dist/core/sandbox/linux-backend.js.map +1 -0
- package/dist/core/sandbox/macos-backend.d.ts +28 -0
- package/dist/core/sandbox/macos-backend.d.ts.map +1 -0
- package/dist/core/sandbox/macos-backend.js +313 -0
- package/dist/core/sandbox/macos-backend.js.map +1 -0
- package/dist/core/sandbox/network-proxy.d.ts +38 -0
- package/dist/core/sandbox/network-proxy.d.ts.map +1 -0
- package/dist/core/sandbox/network-proxy.js +153 -0
- package/dist/core/sandbox/network-proxy.js.map +1 -0
- package/dist/core/sandbox/network-refusal.d.ts +24 -0
- package/dist/core/sandbox/network-refusal.d.ts.map +1 -0
- package/dist/core/sandbox/network-refusal.js +72 -0
- package/dist/core/sandbox/network-refusal.js.map +1 -0
- package/dist/core/sandbox/policy.d.ts +40 -0
- package/dist/core/sandbox/policy.d.ts.map +1 -0
- package/dist/core/sandbox/policy.js +55 -0
- package/dist/core/sandbox/policy.js.map +1 -0
- package/dist/core/sandbox/profiles.d.ts +25 -0
- package/dist/core/sandbox/profiles.d.ts.map +1 -0
- package/dist/core/sandbox/profiles.js +23 -0
- package/dist/core/sandbox/profiles.js.map +1 -0
- package/dist/core/sandbox/rpc/command-client.d.ts +28 -0
- package/dist/core/sandbox/rpc/command-client.d.ts.map +1 -0
- package/dist/core/sandbox/rpc/command-client.js +86 -0
- package/dist/core/sandbox/rpc/command-client.js.map +1 -0
- package/dist/core/sandbox/rpc/command-proxy.d.ts +48 -0
- package/dist/core/sandbox/rpc/command-proxy.d.ts.map +1 -0
- package/dist/core/sandbox/rpc/command-proxy.js +120 -0
- package/dist/core/sandbox/rpc/command-proxy.js.map +1 -0
- package/dist/core/sandbox/rpc/credential-client.d.ts +20 -0
- package/dist/core/sandbox/rpc/credential-client.d.ts.map +1 -0
- package/dist/core/sandbox/rpc/credential-client.js +170 -0
- package/dist/core/sandbox/rpc/credential-client.js.map +1 -0
- package/dist/core/sandbox/rpc/credential-proxy.d.ts +44 -0
- package/dist/core/sandbox/rpc/credential-proxy.d.ts.map +1 -0
- package/dist/core/sandbox/rpc/credential-proxy.js +287 -0
- package/dist/core/sandbox/rpc/credential-proxy.js.map +1 -0
- package/dist/core/sandbox/rpc/framing.d.ts +35 -0
- package/dist/core/sandbox/rpc/framing.d.ts.map +1 -0
- package/dist/core/sandbox/rpc/framing.js +114 -0
- package/dist/core/sandbox/rpc/framing.js.map +1 -0
- package/dist/core/sandbox/rpc/git-credential-helper.d.ts +40 -0
- package/dist/core/sandbox/rpc/git-credential-helper.d.ts.map +1 -0
- package/dist/core/sandbox/rpc/git-credential-helper.js +152 -0
- package/dist/core/sandbox/rpc/git-credential-helper.js.map +1 -0
- package/dist/core/sandbox/rpc/git-credential-proxy.d.ts +48 -0
- package/dist/core/sandbox/rpc/git-credential-proxy.d.ts.map +1 -0
- package/dist/core/sandbox/rpc/git-credential-proxy.js +142 -0
- package/dist/core/sandbox/rpc/git-credential-proxy.js.map +1 -0
- package/dist/core/sandbox/supervisor-temp.d.ts +18 -0
- package/dist/core/sandbox/supervisor-temp.d.ts.map +1 -0
- package/dist/core/sandbox/supervisor-temp.js +21 -0
- package/dist/core/sandbox/supervisor-temp.js.map +1 -0
- package/dist/core/sandbox/supervisor.d.ts +51 -0
- package/dist/core/sandbox/supervisor.d.ts.map +1 -0
- package/dist/core/sandbox/supervisor.js +18 -0
- package/dist/core/sandbox/supervisor.js.map +1 -0
- package/dist/core/sandbox/terminal-handoff.d.ts +45 -0
- package/dist/core/sandbox/terminal-handoff.d.ts.map +1 -0
- package/dist/core/sandbox/terminal-handoff.js +176 -0
- package/dist/core/sandbox/terminal-handoff.js.map +1 -0
- package/dist/core/sandbox/terminal-size.d.ts +40 -0
- package/dist/core/sandbox/terminal-size.d.ts.map +1 -0
- package/dist/core/sandbox/terminal-size.js +105 -0
- package/dist/core/sandbox/terminal-size.js.map +1 -0
- package/dist/core/sandbox/violations.d.ts +23 -0
- package/dist/core/sandbox/violations.d.ts.map +1 -0
- package/dist/core/sandbox/violations.js +30 -0
- package/dist/core/sandbox/violations.js.map +1 -0
- package/dist/core/sdk.d.ts +32 -41
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +161 -6
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-export.d.ts +4 -0
- package/dist/core/session-export.d.ts.map +1 -0
- package/dist/core/session-export.js +32 -0
- package/dist/core/session-export.js.map +1 -0
- package/dist/core/session-lease.d.ts +31 -0
- package/dist/core/session-lease.d.ts.map +1 -0
- package/dist/core/session-lease.js +138 -0
- package/dist/core/session-lease.js.map +1 -0
- package/dist/core/session-manager.d.ts +46 -2
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +62 -4
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-share.d.ts +31 -0
- package/dist/core/session-share.d.ts.map +1 -0
- package/dist/core/session-share.js +45 -0
- package/dist/core/session-share.js.map +1 -0
- package/dist/core/settings-diagnostics.d.ts +9 -0
- package/dist/core/settings-diagnostics.d.ts.map +1 -0
- package/dist/core/settings-diagnostics.js +21 -0
- package/dist/core/settings-diagnostics.js.map +1 -0
- package/dist/core/settings-manager.d.ts +92 -9
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +138 -36
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts +19 -7
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +128 -52
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +5 -2
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/system-prompt.d.ts +2 -2
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +59 -68
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/timings.d.ts +1 -1
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/timings.js +3 -2
- package/dist/core/timings.js.map +1 -1
- package/dist/core/tools/ask-user.d.ts +25 -0
- package/dist/core/tools/ask-user.d.ts.map +1 -0
- package/dist/core/tools/ask-user.js +49 -0
- package/dist/core/tools/ask-user.js.map +1 -0
- package/dist/core/tools/bash-command-segments.d.ts +22 -0
- package/dist/core/tools/bash-command-segments.d.ts.map +1 -0
- package/dist/core/tools/bash-command-segments.js +128 -0
- package/dist/core/tools/bash-command-segments.js.map +1 -0
- package/dist/core/tools/bash.d.ts +40 -4
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +183 -32
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/contract.d.ts +183 -0
- package/dist/core/tools/contract.d.ts.map +1 -0
- package/dist/core/tools/contract.js +48 -0
- package/dist/core/tools/contract.js.map +1 -0
- package/dist/core/tools/delegate.d.ts +38 -0
- package/dist/core/tools/delegate.d.ts.map +1 -0
- package/dist/core/tools/delegate.js +90 -0
- package/dist/core/tools/delegate.js.map +1 -0
- package/dist/core/tools/diagnostics.d.ts +39 -0
- package/dist/core/tools/diagnostics.d.ts.map +1 -0
- package/dist/core/tools/diagnostics.js +62 -0
- package/dist/core/tools/diagnostics.js.map +1 -0
- package/dist/core/tools/edit-diff.d.ts +0 -5
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +2 -5
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts +12 -2
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +61 -10
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts +2 -2
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +13 -1
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts +4 -2
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +47 -10
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts +51 -6
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +145 -2
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/ls.d.ts +4 -2
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +17 -1
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/lsp.d.ts +62 -0
- package/dist/core/tools/lsp.d.ts.map +1 -0
- package/dist/core/tools/lsp.js +216 -0
- package/dist/core/tools/lsp.js.map +1 -0
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +1 -1
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/path-permission.d.ts +18 -0
- package/dist/core/tools/path-permission.d.ts.map +1 -0
- package/dist/core/tools/path-permission.js +28 -0
- package/dist/core/tools/path-permission.js.map +1 -0
- package/dist/core/tools/plan-present.d.ts +27 -0
- package/dist/core/tools/plan-present.d.ts.map +1 -0
- package/dist/core/tools/plan-present.js +55 -0
- package/dist/core/tools/plan-present.js.map +1 -0
- package/dist/core/tools/powershell.d.ts +16 -0
- package/dist/core/tools/powershell.d.ts.map +1 -0
- package/dist/core/tools/powershell.js +39 -0
- package/dist/core/tools/powershell.js.map +1 -0
- package/dist/core/tools/read.d.ts +2 -2
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +14 -0
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/skill-search.d.ts +32 -0
- package/dist/core/tools/skill-search.d.ts.map +1 -0
- package/dist/core/tools/skill-search.js +56 -0
- package/dist/core/tools/skill-search.js.map +1 -0
- package/dist/core/tools/test.d.ts +34 -0
- package/dist/core/tools/test.d.ts.map +1 -0
- package/dist/core/tools/test.js +75 -0
- package/dist/core/tools/test.js.map +1 -0
- package/dist/core/tools/todo-write.d.ts +31 -0
- package/dist/core/tools/todo-write.d.ts.map +1 -0
- package/dist/core/tools/todo-write.js +51 -0
- package/dist/core/tools/todo-write.js.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts +13 -2
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js +11 -1
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/core/tools/tool-schema.d.ts +22 -0
- package/dist/core/tools/tool-schema.d.ts.map +1 -0
- package/dist/core/tools/tool-schema.js +45 -0
- package/dist/core/tools/tool-schema.js.map +1 -0
- package/dist/core/tools/web-fetch.d.ts +26 -0
- package/dist/core/tools/web-fetch.d.ts.map +1 -0
- package/dist/core/tools/web-fetch.js +62 -0
- package/dist/core/tools/web-fetch.js.map +1 -0
- package/dist/core/tools/web-search-exa.d.ts +33 -0
- package/dist/core/tools/web-search-exa.d.ts.map +1 -0
- package/dist/core/tools/web-search-exa.js +128 -0
- package/dist/core/tools/web-search-exa.js.map +1 -0
- package/dist/core/tools/web-search.d.ts +26 -0
- package/dist/core/tools/web-search.d.ts.map +1 -0
- package/dist/core/tools/web-search.js +53 -0
- package/dist/core/tools/web-search.js.map +1 -0
- package/dist/core/tools/write.d.ts +16 -2
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +48 -2
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +2 -1
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/core/usage-performance-store.d.ts +56 -0
- package/dist/core/usage-performance-store.d.ts.map +1 -0
- package/dist/core/usage-performance-store.js +85 -0
- package/dist/core/usage-performance-store.js.map +1 -0
- package/dist/core/web-search-provider.d.ts +64 -0
- package/dist/core/web-search-provider.d.ts.map +1 -0
- package/dist/core/web-search-provider.js +149 -0
- package/dist/core/web-search-provider.js.map +1 -0
- package/dist/extensions/llama/index.d.ts.map +1 -1
- package/dist/extensions/llama/index.js +2 -0
- package/dist/extensions/llama/index.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +6 -2
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/index.d.ts +7 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +5 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +87 -22
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +6 -5
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +9 -6
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +72 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +338 -1
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts +7 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.js +11 -2
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts +4 -0
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +24 -6
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts +1 -4
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.js +17 -41
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
- package/dist/modes/interactive/components/first-use-hints.d.ts +8 -0
- package/dist/modes/interactive/components/first-use-hints.d.ts.map +1 -0
- package/dist/modes/interactive/components/first-use-hints.js +22 -0
- package/dist/modes/interactive/components/first-use-hints.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts +23 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +182 -21
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +2 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +2 -0
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +31 -9
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +236 -96
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +25 -5
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +226 -58
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.d.ts +72 -0
- package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-submenu.js +165 -0
- package/dist/modes/interactive/components/settings-submenu.js.map +1 -0
- package/dist/modes/interactive/components/splash-header.d.ts +66 -0
- package/dist/modes/interactive/components/splash-header.d.ts.map +1 -0
- package/dist/modes/interactive/components/splash-header.js +180 -0
- package/dist/modes/interactive/components/splash-header.js.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +15 -3
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +74 -17
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +16 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +113 -35
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tool-panel.d.ts +30 -0
- package/dist/modes/interactive/components/tool-panel.d.ts.map +1 -0
- package/dist/modes/interactive/components/tool-panel.js +130 -0
- package/dist/modes/interactive/components/tool-panel.js.map +1 -0
- package/dist/modes/interactive/external-editor.d.ts.map +1 -1
- package/dist/modes/interactive/external-editor.js +60 -10
- package/dist/modes/interactive/external-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +61 -5
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +642 -203
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/model-catalog-refresh.d.ts +7 -0
- package/dist/modes/interactive/model-catalog-refresh.d.ts.map +1 -0
- package/dist/modes/interactive/model-catalog-refresh.js +34 -0
- package/dist/modes/interactive/model-catalog-refresh.js.map +1 -0
- package/dist/modes/interactive/theme/apex.json +93 -0
- package/dist/modes/interactive/theme/dark.json +2 -0
- package/dist/modes/interactive/theme/light.json +3 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts +10 -2
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.js +25 -11
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.json +11 -3
- package/dist/modes/interactive/theme/theme.d.ts +14 -3
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +65 -10
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/json-event.d.ts +18 -12
- package/dist/modes/json-event.d.ts.map +1 -1
- package/dist/modes/json-event.js +22 -5
- package/dist/modes/json-event.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +2 -1
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/package-manager-cli.d.ts +1 -0
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +211 -14
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/rpc-entry.d.ts.map +1 -1
- package/dist/rpc-entry.js +2 -1
- package/dist/rpc-entry.js.map +1 -1
- package/dist/server/create-harness.d.ts +1 -1
- package/dist/server/create-harness.d.ts.map +1 -1
- package/dist/server/create-harness.js +8 -5
- package/dist/server/create-harness.js.map +1 -1
- package/dist/testing/replay/metrics.d.ts +24 -0
- package/dist/testing/replay/metrics.d.ts.map +1 -0
- package/dist/testing/replay/metrics.js +35 -0
- package/dist/testing/replay/metrics.js.map +1 -0
- package/dist/testing/replay/recorded-provider.d.ts +10 -0
- package/dist/testing/replay/recorded-provider.d.ts.map +1 -0
- package/dist/testing/replay/recorded-provider.js +108 -0
- package/dist/testing/replay/recorded-provider.js.map +1 -0
- package/dist/testing/replay/runner.d.ts +56 -0
- package/dist/testing/replay/runner.d.ts.map +1 -0
- package/dist/testing/replay/runner.js +406 -0
- package/dist/testing/replay/runner.js.map +1 -0
- package/dist/themes/apex-logo.d.ts +41 -0
- package/dist/themes/apex-logo.d.ts.map +1 -0
- package/dist/themes/apex-logo.js +35 -0
- package/dist/themes/apex-logo.js.map +1 -0
- package/dist/utils/apex-code-user-agent.d.ts +2 -0
- package/dist/utils/apex-code-user-agent.d.ts.map +1 -0
- package/dist/utils/apex-code-user-agent.js +5 -0
- package/dist/utils/apex-code-user-agent.js.map +1 -0
- package/dist/utils/changelog.d.ts +7 -2
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js +82 -13
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +1 -1
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/frontmatter.d.ts.map +1 -1
- package/dist/utils/frontmatter.js +2 -1
- package/dist/utils/frontmatter.js.map +1 -1
- package/dist/utils/management-http.d.ts +5 -3
- package/dist/utils/management-http.d.ts.map +1 -1
- package/dist/utils/management-http.js +14 -10
- package/dist/utils/management-http.js.map +1 -1
- package/dist/utils/shell.d.ts +3 -0
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +17 -5
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts +1 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +60 -1
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/dist/utils/text.d.ts +8 -0
- package/dist/utils/text.d.ts.map +1 -0
- package/dist/utils/text.js +9 -0
- package/dist/utils/text.js.map +1 -0
- package/dist/utils/tools-manager.d.ts +70 -2
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +280 -124
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/version-check.d.ts +7 -5
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js +25 -14
- package/dist/utils/version-check.js.map +1 -1
- package/dist/utils/windows-self-update.d.ts.map +1 -1
- package/dist/utils/windows-self-update.js +1 -1
- package/dist/utils/windows-self-update.js.map +1 -1
- package/docs/compaction.md +39 -24
- package/docs/containerization.md +24 -21
- package/docs/custom-provider.md +15 -12
- package/docs/development.md +11 -11
- package/docs/environment-variables.md +37 -77
- package/docs/extensions.md +68 -54
- package/docs/index.md +12 -24
- package/docs/json.md +18 -11
- package/docs/keybindings.md +18 -12
- package/docs/llama-cpp.md +9 -7
- package/docs/models.md +17 -11
- package/docs/packages.md +47 -43
- package/docs/prompt-templates.md +3 -3
- package/docs/providers.md +10 -10
- package/docs/quickstart.md +49 -32
- package/docs/rpc.md +35 -18
- package/docs/sdk.md +20 -6
- package/docs/security.md +18 -18
- package/docs/session-format.md +9 -9
- package/docs/sessions.md +13 -13
- package/docs/settings.md +83 -16
- package/docs/shell-aliases.md +1 -1
- package/docs/skills.md +66 -15
- package/docs/terminal-setup.md +44 -19
- package/docs/termux.md +4 -4
- package/docs/themes.md +32 -11
- package/docs/tmux.md +4 -4
- package/docs/tui.md +5 -5
- package/docs/usage.md +61 -53
- package/docs/windows.md +24 -2
- package/examples/extensions/border-status-editor.ts +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +2 -2
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/git-checkpoint.ts +2 -2
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/notify.ts +3 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/subagent/README.md +3 -1
- package/examples/extensions/subagent/agents.ts +40 -9
- package/examples/extensions/subagent/index.ts +27 -4
- package/examples/extensions/titlebar-spinner.ts +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/rpc-extension-ui.ts +1 -1
- package/examples/sdk/06-extensions.ts +1 -1
- package/examples/sdk/README.md +1 -1
- package/npm-shrinkwrap.json +280 -445
- package/package.json +9 -12
- package/dist/core/telemetry.d.ts +0 -3
- package/dist/core/telemetry.d.ts.map +0 -1
- package/dist/core/telemetry.js +0 -9
- package/dist/core/telemetry.js.map +0 -1
- package/dist/utils/pi-user-agent.d.ts +0 -2
- package/dist/utils/pi-user-agent.d.ts.map +0 -1
- package/dist/utils/pi-user-agent.js +0 -5
- package/dist/utils/pi-user-agent.js.map +0 -1
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
1
|
import { spawnSync } from "child_process";
|
|
3
|
-
import {
|
|
2
|
+
import { createHash } from "crypto";
|
|
3
|
+
import { chmodSync, createReadStream, createWriteStream, existsSync, mkdirSync, readdirSync, renameSync, rmSync, statSync, } from "fs";
|
|
4
4
|
import { arch, platform } from "os";
|
|
5
|
-
import { join } from "path";
|
|
5
|
+
import { basename, join, relative, resolve as resolvePath } from "path";
|
|
6
6
|
import { Readable } from "stream";
|
|
7
7
|
import { pipeline } from "stream/promises";
|
|
8
|
-
import {
|
|
8
|
+
import { getBinDir } from "../config.js";
|
|
9
|
+
import { getApexEnvironment } from "../core/environment.js";
|
|
9
10
|
import { fetchWithRetry } from "./management-http.js";
|
|
10
11
|
const TOOLS_DIR = getBinDir();
|
|
11
|
-
const NETWORK_TIMEOUT_MS = 10_000;
|
|
12
12
|
const DOWNLOAD_TIMEOUT_MS = 120_000;
|
|
13
13
|
function isOfflineModeEnabled() {
|
|
14
|
-
const value =
|
|
14
|
+
const value = getApexEnvironment("APEX_CODE_OFFLINE");
|
|
15
15
|
if (!value)
|
|
16
16
|
return false;
|
|
17
17
|
return value === "1" || value.toLowerCase() === "true" || value.toLowerCase() === "yes";
|
|
18
18
|
}
|
|
19
|
+
// Per-platform/architecture asset names live in MANAGED_TOOL_PINS (ADR 0017) as the
|
|
20
|
+
// single reviewed source of truth, not derived here.
|
|
19
21
|
const TOOLS = {
|
|
20
22
|
fd: {
|
|
21
23
|
name: "fd",
|
|
@@ -23,44 +25,12 @@ const TOOLS = {
|
|
|
23
25
|
binaryName: "fd",
|
|
24
26
|
systemBinaryNames: ["fd", "fdfind"],
|
|
25
27
|
tagPrefix: "v",
|
|
26
|
-
getAssetName: (version, plat, architecture) => {
|
|
27
|
-
if (plat === "darwin") {
|
|
28
|
-
const archStr = architecture === "arm64" ? "aarch64" : "x86_64";
|
|
29
|
-
return `fd-v${version}-${archStr}-apple-darwin.tar.gz`;
|
|
30
|
-
}
|
|
31
|
-
else if (plat === "linux") {
|
|
32
|
-
const archStr = architecture === "arm64" ? "aarch64" : "x86_64";
|
|
33
|
-
return `fd-v${version}-${archStr}-unknown-linux-gnu.tar.gz`;
|
|
34
|
-
}
|
|
35
|
-
else if (plat === "win32") {
|
|
36
|
-
const archStr = architecture === "arm64" ? "aarch64" : "x86_64";
|
|
37
|
-
return `fd-v${version}-${archStr}-pc-windows-msvc.zip`;
|
|
38
|
-
}
|
|
39
|
-
return null;
|
|
40
|
-
},
|
|
41
28
|
},
|
|
42
29
|
rg: {
|
|
43
30
|
name: "ripgrep",
|
|
44
31
|
repo: "BurntSushi/ripgrep",
|
|
45
32
|
binaryName: "rg",
|
|
46
33
|
tagPrefix: "",
|
|
47
|
-
getAssetName: (version, plat, architecture) => {
|
|
48
|
-
if (plat === "darwin") {
|
|
49
|
-
const archStr = architecture === "arm64" ? "aarch64" : "x86_64";
|
|
50
|
-
return `ripgrep-${version}-${archStr}-apple-darwin.tar.gz`;
|
|
51
|
-
}
|
|
52
|
-
else if (plat === "linux") {
|
|
53
|
-
if (architecture === "arm64") {
|
|
54
|
-
return `ripgrep-${version}-aarch64-unknown-linux-gnu.tar.gz`;
|
|
55
|
-
}
|
|
56
|
-
return `ripgrep-${version}-x86_64-unknown-linux-musl.tar.gz`;
|
|
57
|
-
}
|
|
58
|
-
else if (plat === "win32") {
|
|
59
|
-
const archStr = architecture === "arm64" ? "aarch64" : "x86_64";
|
|
60
|
-
return `ripgrep-${version}-${archStr}-pc-windows-msvc.zip`;
|
|
61
|
-
}
|
|
62
|
-
return null;
|
|
63
|
-
},
|
|
64
34
|
},
|
|
65
35
|
};
|
|
66
36
|
// Check if a command exists in PATH by trying to run it
|
|
@@ -75,14 +45,16 @@ function commandExists(cmd) {
|
|
|
75
45
|
}
|
|
76
46
|
}
|
|
77
47
|
// Get the path to a tool (system-wide or in our tools dir)
|
|
78
|
-
export function getToolPath(tool) {
|
|
48
|
+
export function getToolPath(tool, options = {}) {
|
|
79
49
|
const config = TOOLS[tool];
|
|
80
50
|
if (!config)
|
|
81
51
|
return null;
|
|
82
|
-
// Check our tools directory first
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
52
|
+
// Check our tools directory first. Existence alone is not enough: the sandbox
|
|
53
|
+
// projects host tools by bind-mounting over a file here, and bwrap leaves that
|
|
54
|
+
// mountpoint behind as an empty, non-executable stub once the namespace is gone.
|
|
55
|
+
const managedPath = join(options.toolsDirectory ?? TOOLS_DIR, config.binaryName + (platform() === "win32" ? ".exe" : ""));
|
|
56
|
+
if (isExecutableFile(managedPath, platform())) {
|
|
57
|
+
return managedPath;
|
|
86
58
|
}
|
|
87
59
|
// Check system PATH - if found, just return the command name (it's in PATH)
|
|
88
60
|
const systemBinaryNames = config.systemBinaryNames ?? [config.binaryName];
|
|
@@ -93,19 +65,113 @@ export function getToolPath(tool) {
|
|
|
93
65
|
}
|
|
94
66
|
return null;
|
|
95
67
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
68
|
+
const MANAGED_TOOL_PINS = {
|
|
69
|
+
rg: {
|
|
70
|
+
"linux:x64": {
|
|
71
|
+
version: "14.1.1",
|
|
72
|
+
assetName: "ripgrep-14.1.1-x86_64-unknown-linux-musl.tar.gz",
|
|
73
|
+
sha256: "4cf9f2741e6c465ffdb7c26f38056a59e2a2544b51f7cc128ef28337eeae4d8e",
|
|
74
|
+
expectedBytes: 2566310,
|
|
75
|
+
archiveKind: "tar.gz",
|
|
76
|
+
},
|
|
77
|
+
"linux:arm64": {
|
|
78
|
+
version: "14.1.1",
|
|
79
|
+
assetName: "ripgrep-14.1.1-aarch64-unknown-linux-gnu.tar.gz",
|
|
80
|
+
sha256: "c827481c4ff4ea10c9dc7a4022c8de5db34a5737cb74484d62eb94a95841ab2f",
|
|
81
|
+
expectedBytes: 2047405,
|
|
82
|
+
archiveKind: "tar.gz",
|
|
83
|
+
},
|
|
84
|
+
"darwin:x64": {
|
|
85
|
+
version: "14.1.1",
|
|
86
|
+
assetName: "ripgrep-14.1.1-x86_64-apple-darwin.tar.gz",
|
|
87
|
+
sha256: "fc87e78f7cb3fea12d69072e7ef3b21509754717b746368fd40d88963630e2b3",
|
|
88
|
+
expectedBytes: 2082672,
|
|
89
|
+
archiveKind: "tar.gz",
|
|
90
|
+
},
|
|
91
|
+
"darwin:arm64": {
|
|
92
|
+
version: "14.1.1",
|
|
93
|
+
assetName: "ripgrep-14.1.1-aarch64-apple-darwin.tar.gz",
|
|
94
|
+
sha256: "24ad76777745fbff131c8fbc466742b011f925bfa4fffa2ded6def23b5b937be",
|
|
95
|
+
expectedBytes: 1787248,
|
|
96
|
+
archiveKind: "tar.gz",
|
|
97
|
+
},
|
|
98
|
+
"win32:x64": {
|
|
99
|
+
version: "14.1.1",
|
|
100
|
+
assetName: "ripgrep-14.1.1-x86_64-pc-windows-msvc.zip",
|
|
101
|
+
sha256: "d0f534024c42afd6cb4d38907c25cd2b249b79bbe6cc1dbee8e3e37c2b6e25a1",
|
|
102
|
+
expectedBytes: 2058893,
|
|
103
|
+
archiveKind: "zip",
|
|
104
|
+
},
|
|
105
|
+
// No upstream win32/arm64 ripgrep release asset exists at 14.1.1; resolution
|
|
106
|
+
// fails closed for that combination rather than constructing a URL that 404s.
|
|
107
|
+
},
|
|
108
|
+
fd: {
|
|
109
|
+
"linux:x64": {
|
|
110
|
+
version: "10.4.2",
|
|
111
|
+
assetName: "fd-v10.4.2-x86_64-unknown-linux-gnu.tar.gz",
|
|
112
|
+
sha256: "def59805cd14b5651b68990855f426ad087f3b96881296d963910431ba3143c8",
|
|
113
|
+
expectedBytes: 1700779,
|
|
114
|
+
archiveKind: "tar.gz",
|
|
115
|
+
},
|
|
116
|
+
"linux:arm64": {
|
|
117
|
+
version: "10.4.2",
|
|
118
|
+
assetName: "fd-v10.4.2-aarch64-unknown-linux-gnu.tar.gz",
|
|
119
|
+
sha256: "6c51f7c5446b3338b1e401ff15dc194c590bb2fa64fd43ff3278300f073adec5",
|
|
120
|
+
expectedBytes: 1559490,
|
|
121
|
+
archiveKind: "tar.gz",
|
|
122
|
+
},
|
|
123
|
+
// Upstream stopped shipping an Intel macOS fd binary after 10.3.0 (see
|
|
124
|
+
// 7afd80d78, "pin fd for macos x64"); preserved here rather than special-cased.
|
|
125
|
+
"darwin:x64": {
|
|
126
|
+
version: "10.3.0",
|
|
127
|
+
assetName: "fd-v10.3.0-x86_64-apple-darwin.tar.gz",
|
|
128
|
+
sha256: "50d30f13fe3d5914b14c4fff5abcbd4d0cdab4b855970a6956f4f006c17117a3",
|
|
129
|
+
expectedBytes: 1430203,
|
|
130
|
+
archiveKind: "tar.gz",
|
|
131
|
+
},
|
|
132
|
+
"darwin:arm64": {
|
|
133
|
+
version: "10.4.2",
|
|
134
|
+
assetName: "fd-v10.4.2-aarch64-apple-darwin.tar.gz",
|
|
135
|
+
sha256: "623dc0afc81b92e4d4606b380d7bc91916ba7b97814263e554d50923a39e480a",
|
|
136
|
+
expectedBytes: 1328933,
|
|
137
|
+
archiveKind: "tar.gz",
|
|
138
|
+
},
|
|
139
|
+
"win32:x64": {
|
|
140
|
+
version: "10.4.2",
|
|
141
|
+
assetName: "fd-v10.4.2-x86_64-pc-windows-msvc.zip",
|
|
142
|
+
sha256: "b2816e506390a89941c63c9187d58a3cc10e9a55f2ef0685f9ea0eccaf7c98c8",
|
|
143
|
+
expectedBytes: 1525898,
|
|
144
|
+
archiveKind: "zip",
|
|
145
|
+
},
|
|
146
|
+
"win32:arm64": {
|
|
147
|
+
version: "10.4.2",
|
|
148
|
+
assetName: "fd-v10.4.2-aarch64-pc-windows-msvc.zip",
|
|
149
|
+
sha256: "4f9110c2d5b33a7f760bfa5510f4c113d828109f7277d421b1053a9943c0fc92",
|
|
150
|
+
expectedBytes: 1370473,
|
|
151
|
+
archiveKind: "zip",
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
/** Resolve reviewed, pinned metadata for a managed tool. Never queries "latest". */
|
|
156
|
+
export function resolveManagedToolArtifact(options) {
|
|
157
|
+
const config = TOOLS[options.tool];
|
|
158
|
+
const pin = MANAGED_TOOL_PINS[options.tool]?.[`${options.platform}:${options.architecture}`];
|
|
159
|
+
if (!config || !pin) {
|
|
160
|
+
throw new Error(`No reviewed pinned artifact for ${options.tool} on ${options.platform}/${options.architecture}`);
|
|
103
161
|
}
|
|
104
|
-
|
|
105
|
-
|
|
162
|
+
return {
|
|
163
|
+
version: pin.version,
|
|
164
|
+
url: `https://github.com/${config.repo}/releases/download/${config.tagPrefix}${pin.version}/${pin.assetName}`,
|
|
165
|
+
sha256: pin.sha256,
|
|
166
|
+
expectedBytes: pin.expectedBytes,
|
|
167
|
+
maxBytes: pin.expectedBytes * 4,
|
|
168
|
+
binaryName: config.binaryName,
|
|
169
|
+
archiveKind: pin.archiveKind,
|
|
170
|
+
};
|
|
106
171
|
}
|
|
107
|
-
// Download a file from URL
|
|
108
|
-
|
|
172
|
+
// Download a file from URL, aborting if the declared or received size exceeds the
|
|
173
|
+
// bounded ceiling (ADR 0017) rather than writing an unbounded stream to disk.
|
|
174
|
+
async function downloadFile(url, dest, maxBytes) {
|
|
109
175
|
const response = await fetchWithRetry(url, undefined, { timeoutMs: DOWNLOAD_TIMEOUT_MS });
|
|
110
176
|
if (!response.ok) {
|
|
111
177
|
throw new Error(`Failed to download: ${response.status}`);
|
|
@@ -113,8 +179,26 @@ async function downloadFile(url, dest) {
|
|
|
113
179
|
if (!response.body) {
|
|
114
180
|
throw new Error("No response body");
|
|
115
181
|
}
|
|
182
|
+
const declaredLength = Number(response.headers.get("content-length") ?? Number.NaN);
|
|
183
|
+
if (Number.isFinite(declaredLength) && declaredLength > maxBytes) {
|
|
184
|
+
throw new Error(`Refusing download: declared size ${declaredLength} exceeds bounded limit ${maxBytes}`);
|
|
185
|
+
}
|
|
186
|
+
let received = 0;
|
|
187
|
+
const source = Readable.fromWeb(response.body);
|
|
188
|
+
source.on("data", (chunk) => {
|
|
189
|
+
received += chunk.length;
|
|
190
|
+
if (received > maxBytes) {
|
|
191
|
+
source.destroy(new Error(`Refusing download: exceeded bounded limit ${maxBytes} bytes`));
|
|
192
|
+
}
|
|
193
|
+
});
|
|
116
194
|
const fileStream = createWriteStream(dest);
|
|
117
|
-
|
|
195
|
+
try {
|
|
196
|
+
await pipeline(source, fileStream);
|
|
197
|
+
}
|
|
198
|
+
catch (error) {
|
|
199
|
+
rmSync(dest, { force: true });
|
|
200
|
+
throw error;
|
|
201
|
+
}
|
|
118
202
|
}
|
|
119
203
|
function findBinaryRecursively(rootDir, binaryFileName) {
|
|
120
204
|
const stack = [rootDir];
|
|
@@ -209,80 +293,159 @@ function extractZipArchive(archivePath, extractDir, assetName) {
|
|
|
209
293
|
}
|
|
210
294
|
throw new Error(`Failed to extract ${assetName}: ${failures.join("; ")}`);
|
|
211
295
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
throw new Error(`Unknown tool: ${tool}`);
|
|
217
|
-
const plat = platform();
|
|
218
|
-
const architecture = arch();
|
|
219
|
-
// Get latest version
|
|
220
|
-
let version = await getLatestVersion(config.repo);
|
|
221
|
-
if (tool === "fd" && plat === "darwin" && architecture === "x64") {
|
|
222
|
-
version = "10.3.0";
|
|
296
|
+
async function sha256File(path) {
|
|
297
|
+
const hash = createHash("sha256");
|
|
298
|
+
for await (const chunk of createReadStream(path)) {
|
|
299
|
+
hash.update(chunk);
|
|
223
300
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
301
|
+
return hash.digest("hex");
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Verify a downloaded tool archive against its pinned digest, extract it into a
|
|
305
|
+
* per-install quarantine directory, confirm the located binary did not escape that
|
|
306
|
+
* quarantine, and only then atomically promote it into the live tools directory
|
|
307
|
+
* (ADR 0017). Rejects a digest mismatch or an out-of-bounds archive before anything
|
|
308
|
+
* is written to `destination`.
|
|
309
|
+
*/
|
|
310
|
+
export async function installManagedToolArchive(options) {
|
|
311
|
+
const { archivePath, destination, binaryName, archiveKind, expectedSha256, maxBytes } = options;
|
|
312
|
+
const { size } = statSync(archivePath);
|
|
313
|
+
if (size > maxBytes) {
|
|
314
|
+
throw new Error(`Refusing install: archive size ${size} exceeds bounded limit ${maxBytes}`);
|
|
228
315
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
await downloadFile(downloadUrl, archivePath);
|
|
237
|
-
// Extract into a unique temp directory. fd and rg downloads can run concurrently
|
|
238
|
-
// during startup, so sharing a fixed directory causes races.
|
|
239
|
-
const extractDir = join(TOOLS_DIR, `extract_tmp_${config.binaryName}_${process.pid}_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`);
|
|
240
|
-
mkdirSync(extractDir, { recursive: true });
|
|
316
|
+
const actualSha256 = await sha256File(archivePath);
|
|
317
|
+
if (actualSha256.toLowerCase() !== expectedSha256.toLowerCase()) {
|
|
318
|
+
throw new Error(`Refusing install: digest mismatch for ${basename(archivePath)}`);
|
|
319
|
+
}
|
|
320
|
+
mkdirSync(destination, { recursive: true });
|
|
321
|
+
const quarantineDirectory = join(destination, `.quarantine_${process.pid}_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`);
|
|
322
|
+
mkdirSync(quarantineDirectory, { recursive: true });
|
|
241
323
|
try {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
else if (assetName.endsWith(".zip")) {
|
|
246
|
-
extractZipArchive(archivePath, extractDir, assetName);
|
|
324
|
+
const assetName = basename(archivePath);
|
|
325
|
+
if (archiveKind === "tar.gz") {
|
|
326
|
+
extractTarGzArchive(archivePath, quarantineDirectory, assetName);
|
|
247
327
|
}
|
|
248
328
|
else {
|
|
249
|
-
|
|
329
|
+
extractZipArchive(archivePath, quarantineDirectory, assetName);
|
|
250
330
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
const binaryFileName = config.binaryName + binaryExt;
|
|
254
|
-
const extractedDir = join(extractDir, assetName.replace(/\.(tar\.gz|zip)$/, ""));
|
|
255
|
-
const extractedBinaryCandidates = [join(extractedDir, binaryFileName), join(extractDir, binaryFileName)];
|
|
256
|
-
let extractedBinary = extractedBinaryCandidates.find((candidate) => existsSync(candidate));
|
|
331
|
+
const binaryFileName = binaryName + (platform() === "win32" ? ".exe" : "");
|
|
332
|
+
const extractedBinary = findBinaryRecursively(quarantineDirectory, binaryFileName);
|
|
257
333
|
if (!extractedBinary) {
|
|
258
|
-
|
|
334
|
+
throw new Error(`Binary not found in verified archive: expected ${binaryFileName}`);
|
|
259
335
|
}
|
|
260
|
-
|
|
261
|
-
|
|
336
|
+
const resolvedBinary = resolvePath(extractedBinary);
|
|
337
|
+
const containmentPath = relative(resolvePath(quarantineDirectory), resolvedBinary);
|
|
338
|
+
if (containmentPath.startsWith("..") || resolvePath(containmentPath) === containmentPath) {
|
|
339
|
+
throw new Error(`Refusing install: archive entry escaped its quarantine directory: ${extractedBinary}`);
|
|
262
340
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
if (plat !== "win32") {
|
|
268
|
-
chmodSync(binaryPath, 0o755);
|
|
341
|
+
const finalPath = join(destination, binaryFileName);
|
|
342
|
+
renameSync(resolvedBinary, finalPath);
|
|
343
|
+
if (platform() !== "win32") {
|
|
344
|
+
chmodSync(finalPath, 0o755);
|
|
269
345
|
}
|
|
346
|
+
return finalPath;
|
|
347
|
+
}
|
|
348
|
+
finally {
|
|
349
|
+
rmSync(quarantineDirectory, { recursive: true, force: true });
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
// Download and install a tool from reviewed, pinned metadata (ADR 0017): bounded
|
|
353
|
+
// download, digest verification, quarantine extraction, then atomic promotion.
|
|
354
|
+
async function downloadTool(tool) {
|
|
355
|
+
const plat = platform();
|
|
356
|
+
const architecture = arch();
|
|
357
|
+
const artifact = resolveManagedToolArtifact({ tool, platform: plat, architecture });
|
|
358
|
+
mkdirSync(TOOLS_DIR, { recursive: true });
|
|
359
|
+
// Unique download filename: fd and rg downloads can run concurrently during
|
|
360
|
+
// startup, so sharing a fixed path causes races.
|
|
361
|
+
const archivePath = join(TOOLS_DIR, `download_${artifact.binaryName}_${process.pid}_${Date.now()}_${Math.random().toString(36).slice(2, 10)}${artifact.archiveKind === "zip" ? ".zip" : ".tar.gz"}`);
|
|
362
|
+
try {
|
|
363
|
+
await downloadFile(artifact.url, archivePath, artifact.maxBytes);
|
|
364
|
+
return await installManagedToolArchive({
|
|
365
|
+
archivePath,
|
|
366
|
+
destination: TOOLS_DIR,
|
|
367
|
+
binaryName: artifact.binaryName,
|
|
368
|
+
archiveKind: artifact.archiveKind,
|
|
369
|
+
expectedSha256: artifact.sha256,
|
|
370
|
+
maxBytes: artifact.maxBytes,
|
|
371
|
+
});
|
|
270
372
|
}
|
|
271
373
|
finally {
|
|
272
|
-
// Cleanup
|
|
273
374
|
rmSync(archivePath, { force: true });
|
|
274
|
-
rmSync(extractDir, { recursive: true, force: true });
|
|
275
375
|
}
|
|
276
|
-
|
|
376
|
+
}
|
|
377
|
+
function isExecutableFile(candidate, targetPlatform) {
|
|
378
|
+
try {
|
|
379
|
+
const stats = statSync(candidate);
|
|
380
|
+
if (!stats.isFile())
|
|
381
|
+
return false;
|
|
382
|
+
// Windows has no POSIX execute bit; presence of the file is the only signal.
|
|
383
|
+
return targetPlatform === "win32" || (stats.mode & 0o111) !== 0;
|
|
384
|
+
}
|
|
385
|
+
catch {
|
|
386
|
+
return false;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Absolute host path for a managed tool, or undefined when it is installed nowhere.
|
|
391
|
+
*
|
|
392
|
+
* `getToolPath` may return a bare command name because its caller spawns through PATH.
|
|
393
|
+
* A sandboxed child has no such luxury: its PATH still lists host directories that the
|
|
394
|
+
* OS boundary has already replaced, so the supervisor must resolve a real path here and
|
|
395
|
+
* project it in (ADR 0017, and the sandbox spec's tool-projection amendment).
|
|
396
|
+
*/
|
|
397
|
+
export function resolveHostToolBinary(tool, options = {}) {
|
|
398
|
+
const config = TOOLS[tool];
|
|
399
|
+
if (!config)
|
|
400
|
+
return undefined;
|
|
401
|
+
const targetPlatform = options.platform ?? platform();
|
|
402
|
+
const executableSuffix = targetPlatform === "win32" ? ".exe" : "";
|
|
403
|
+
const managedPath = join(options.toolsDirectory ?? TOOLS_DIR, config.binaryName + executableSuffix);
|
|
404
|
+
if (isExecutableFile(managedPath, targetPlatform)) {
|
|
405
|
+
return managedPath;
|
|
406
|
+
}
|
|
407
|
+
const pathEntries = (options.pathValue ?? process.env.PATH ?? "")
|
|
408
|
+
.split(targetPlatform === "win32" ? ";" : ":")
|
|
409
|
+
.filter((entry) => entry.length > 0);
|
|
410
|
+
// Preference runs by name first, matching getToolPath: a real `fd` anywhere on PATH
|
|
411
|
+
// beats a `fdfind` alias, rather than whichever directory happens to come first.
|
|
412
|
+
for (const systemBinaryName of config.systemBinaryNames ?? [config.binaryName]) {
|
|
413
|
+
for (const entry of pathEntries) {
|
|
414
|
+
const candidate = join(entry, systemBinaryName + executableSuffix);
|
|
415
|
+
if (isExecutableFile(candidate, targetPlatform)) {
|
|
416
|
+
return candidate;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return undefined;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Install any missing managed tool on the host, then report absolute paths for the ones
|
|
424
|
+
* that exist. Downloading here rather than inside the child means one install serves every
|
|
425
|
+
* workspace, and it happens on the side of the boundary that still has network access.
|
|
426
|
+
*/
|
|
427
|
+
export async function prepareHostToolBinaries(silent = false) {
|
|
428
|
+
const binaries = [];
|
|
429
|
+
for (const tool of ["fd", "rg"]) {
|
|
430
|
+
await ensureTool(tool, silent ? undefined : ({ message }) => console.error(message));
|
|
431
|
+
const hostPath = resolveHostToolBinary(tool);
|
|
432
|
+
if (hostPath) {
|
|
433
|
+
binaries.push({ name: TOOLS[tool].binaryName + (platform() === "win32" ? ".exe" : ""), path: hostPath });
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
return binaries;
|
|
277
437
|
}
|
|
278
438
|
// Termux package names for tools
|
|
279
439
|
const TERMUX_PACKAGES = {
|
|
280
440
|
fd: "fd",
|
|
281
441
|
rg: "ripgrep",
|
|
282
442
|
};
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
443
|
+
/**
|
|
444
|
+
* Ensure a tool is available, downloading if necessary.
|
|
445
|
+
* Reports progress through `onStatus`; status messages are otherwise silent.
|
|
446
|
+
* Returns the tool path, or undefined if unavailable.
|
|
447
|
+
*/
|
|
448
|
+
export async function ensureTool(tool, onStatus) {
|
|
286
449
|
const existingPath = getToolPath(tool);
|
|
287
450
|
if (existingPath) {
|
|
288
451
|
return existingPath;
|
|
@@ -291,35 +454,28 @@ export async function ensureTool(tool, silent = false) {
|
|
|
291
454
|
if (!config)
|
|
292
455
|
return undefined;
|
|
293
456
|
if (isOfflineModeEnabled()) {
|
|
294
|
-
|
|
295
|
-
console.log(chalk.yellow(`${config.name} not found. Offline mode enabled, skipping download.`));
|
|
296
|
-
}
|
|
457
|
+
onStatus?.({ type: "warning", message: `${config.name} not found. Offline mode enabled, skipping download.` });
|
|
297
458
|
return undefined;
|
|
298
459
|
}
|
|
299
460
|
// On Android/Termux, Linux binaries don't work due to Bionic libc incompatibility.
|
|
300
461
|
// Users must install via pkg.
|
|
301
462
|
if (platform() === "android") {
|
|
302
463
|
const pkgName = TERMUX_PACKAGES[tool] ?? tool;
|
|
303
|
-
|
|
304
|
-
console.log(chalk.yellow(`${config.name} not found. Install with: pkg install ${pkgName}`));
|
|
305
|
-
}
|
|
464
|
+
onStatus?.({ type: "warning", message: `${config.name} not found. Install with: pkg install ${pkgName}` });
|
|
306
465
|
return undefined;
|
|
307
466
|
}
|
|
308
467
|
// Tool not found - download it
|
|
309
|
-
|
|
310
|
-
console.log(chalk.dim(`${config.name} not found. Downloading...`));
|
|
311
|
-
}
|
|
468
|
+
onStatus?.({ type: "info", message: `${config.name} not found. Downloading...` });
|
|
312
469
|
try {
|
|
313
470
|
const path = await downloadTool(tool);
|
|
314
|
-
|
|
315
|
-
console.log(chalk.dim(`${config.name} installed to ${path}`));
|
|
316
|
-
}
|
|
471
|
+
onStatus?.({ type: "info", message: `${config.name} installed to ${path}` });
|
|
317
472
|
return path;
|
|
318
473
|
}
|
|
319
474
|
catch (e) {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
475
|
+
onStatus?.({
|
|
476
|
+
type: "warning",
|
|
477
|
+
message: `Failed to download ${config.name}: ${e instanceof Error ? e.message : e}`,
|
|
478
|
+
});
|
|
323
479
|
return undefined;
|
|
324
480
|
}
|
|
325
481
|
}
|