typeclaw 0.48.13 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/agent/attention-escalation.d.ts +18 -0
- package/dist/types/agent/auth.d.ts +7 -0
- package/dist/types/agent/compaction.d.ts +8 -0
- package/dist/types/agent/git-nudge.d.ts +6 -0
- package/dist/types/agent/guard-types.d.ts +25 -0
- package/dist/types/agent/guards.d.ts +7 -0
- package/dist/types/agent/idle-compaction.d.ts +7 -0
- package/dist/types/agent/index.d.ts +163 -0
- package/dist/types/agent/live-subagents.d.ts +113 -0
- package/dist/types/agent/llm-replay-sanitizer.d.ts +11 -0
- package/dist/types/agent/loop-guard.d.ts +67 -0
- package/dist/types/agent/model-fallback.d.ts +29 -0
- package/dist/types/agent/model-overrides.d.ts +8 -0
- package/dist/types/agent/multimodal/index.d.ts +2 -0
- package/dist/types/agent/multimodal/look-at.d.ts +60 -0
- package/dist/types/agent/multimodal/looker.d.ts +61 -0
- package/dist/types/agent/multimodal/read-redirect.d.ts +6 -0
- package/dist/types/agent/network/response-body.d.ts +1 -0
- package/dist/types/agent/network/safe-http.d.ts +46 -0
- package/dist/types/agent/plugin-tools.d.ts +129 -0
- package/dist/types/agent/proactive-next-step-nudge.d.ts +2 -0
- package/dist/types/agent/prompt-cache-key.d.ts +3 -0
- package/dist/types/agent/provider-error.d.ts +23 -0
- package/dist/types/agent/reload-tool.d.ts +10 -0
- package/dist/types/agent/restart/index.d.ts +31 -0
- package/dist/types/agent/restart-handoff/index.d.ts +32 -0
- package/dist/types/agent/restart-handoff/paths.d.ts +1 -0
- package/dist/types/agent/retry-same-ref.d.ts +41 -0
- package/dist/types/agent/reviewer-activity.d.ts +3 -0
- package/dist/types/agent/reviewer-bash-policy.d.ts +8 -0
- package/dist/types/agent/self.d.ts +1 -0
- package/dist/types/agent/session-meta.d.ts +28 -0
- package/dist/types/agent/session-origin.d.ts +65 -0
- package/dist/types/agent/subagent-cache-keepalive.d.ts +38 -0
- package/dist/types/agent/subagent-completion-reminder.d.ts +29 -0
- package/dist/types/agent/subagent-drain.d.ts +25 -0
- package/dist/types/agent/subagent-session.d.ts +3 -0
- package/dist/types/agent/subagents.d.ts +153 -0
- package/dist/types/agent/system-prompt.d.ts +7 -0
- package/dist/types/agent/throttle-circuit.d.ts +25 -0
- package/dist/types/agent/todo/continuation-policy.d.ts +54 -0
- package/dist/types/agent/todo/continuation-state.d.ts +11 -0
- package/dist/types/agent/todo/continuation-wiring.d.ts +32 -0
- package/dist/types/agent/todo/continuation.d.ts +21 -0
- package/dist/types/agent/todo/scope.d.ts +6 -0
- package/dist/types/agent/todo/store.d.ts +16 -0
- package/dist/types/agent/tool-error-remediation.d.ts +1 -0
- package/dist/types/agent/tool-file-safety.d.ts +78 -0
- package/dist/types/agent/tool-not-found-nudge.d.ts +9 -0
- package/dist/types/agent/tool-result-budget.d.ts +15 -0
- package/dist/types/agent/tools/channel-disengage.d.ts +18 -0
- package/dist/types/agent/tools/channel-edit.d.ts +19 -0
- package/dist/types/agent/tools/channel-fetch-attachment.d.ts +36 -0
- package/dist/types/agent/tools/channel-handoff.d.ts +13 -0
- package/dist/types/agent/tools/channel-history-render.d.ts +3 -0
- package/dist/types/agent/tools/channel-history.d.ts +25 -0
- package/dist/types/agent/tools/channel-log.d.ts +5 -0
- package/dist/types/agent/tools/channel-react.d.ts +23 -0
- package/dist/types/agent/tools/channel-read.d.ts +27 -0
- package/dist/types/agent/tools/channel-reply.d.ts +47 -0
- package/dist/types/agent/tools/channel-send.d.ts +42 -0
- package/dist/types/agent/tools/channel-session-search.d.ts +10 -0
- package/dist/types/agent/tools/curl-impersonate.d.ts +37 -0
- package/dist/types/agent/tools/ddg.d.ts +18 -0
- package/dist/types/agent/tools/grant-role.d.ts +25 -0
- package/dist/types/agent/tools/keyed-semaphore.d.ts +10 -0
- package/dist/types/agent/tools/post-github-review.d.ts +38 -0
- package/dist/types/agent/tools/restart.d.ts +25 -0
- package/dist/types/agent/tools/runtime-notice.d.ts +3 -0
- package/dist/types/agent/tools/search-retry.d.ts +16 -0
- package/dist/types/agent/tools/skip-response.d.ts +17 -0
- package/dist/types/agent/tools/spawn-subagent.d.ts +77 -0
- package/dist/types/agent/tools/stream-snapshot.d.ts +23 -0
- package/dist/types/agent/tools/subagent-access.d.ts +20 -0
- package/dist/types/agent/tools/subagent-cancel.d.ts +23 -0
- package/dist/types/agent/tools/subagent-output.d.ts +50 -0
- package/dist/types/agent/tools/todo/index.d.ts +14 -0
- package/dist/types/agent/tools/webfetch/adaptive-html.d.ts +29 -0
- package/dist/types/agent/tools/webfetch/fetch.d.ts +26 -0
- package/dist/types/agent/tools/webfetch/html-lexical.d.ts +27 -0
- package/dist/types/agent/tools/webfetch/index.d.ts +1 -0
- package/dist/types/agent/tools/webfetch/inline-style-visibility.d.ts +3 -0
- package/dist/types/agent/tools/webfetch/strategies/grep.d.ts +11 -0
- package/dist/types/agent/tools/webfetch/strategies/jq.d.ts +4 -0
- package/dist/types/agent/tools/webfetch/strategies/raw.d.ts +1 -0
- package/dist/types/agent/tools/webfetch/strategies/readability.d.ts +16 -0
- package/dist/types/agent/tools/webfetch/strategies/selector.d.ts +4 -0
- package/dist/types/agent/tools/webfetch/strategies/snapshot.d.ts +1 -0
- package/dist/types/agent/tools/webfetch/tool.d.ts +15 -0
- package/dist/types/agent/tools/webfetch/types.d.ts +32 -0
- package/dist/types/agent/tools/websearch.d.ts +17 -0
- package/dist/types/agent/tools/wikipedia.d.ts +7 -0
- package/dist/types/agent/tools-without-local-file-operands.d.ts +1 -0
- package/dist/types/agent/turn-runner.d.ts +36 -0
- package/dist/types/agent-messenger/config-dir.d.ts +19 -0
- package/dist/types/browser/dockerfile.d.ts +2 -0
- package/dist/types/browser/registry.d.ts +49 -0
- package/dist/types/bundled-plugins/bun-hygiene/policy.d.ts +18 -0
- package/dist/types/bundled-plugins/github-cli-auth/git-askpass.d.ts +5 -0
- package/dist/types/bundled-plugins/guard/keys.d.ts +6 -0
- package/dist/types/bundled-plugins/guard/policies/managed-config.d.ts +7 -0
- package/dist/types/bundled-plugins/guard/policies/memory-topics-delete.d.ts +11 -0
- package/dist/types/bundled-plugins/guard/policies/memory-topics-write.d.ts +7 -0
- package/dist/types/bundled-plugins/guard/policies/non-workspace-write.d.ts +9 -0
- package/dist/types/bundled-plugins/guard/policies/skill-authoring.d.ts +20 -0
- package/dist/types/bundled-plugins/guard/policies/uncommitted-changes.d.ts +12 -0
- package/dist/types/bundled-plugins/guard/policy.d.ts +11 -0
- package/dist/types/bundled-plugins/memory/secret-detector.d.ts +11 -0
- package/dist/types/bundled-plugins/memory/slug.d.ts +4 -0
- package/dist/types/bundled-plugins/security/permissions.d.ts +20 -0
- package/dist/types/bundled-plugins/security/policies/private-surface-read.d.ts +34 -0
- package/dist/types/bundled-plugins/security/policies/ssrf.d.ts +18 -0
- package/dist/types/bundled-plugins/security/policy.d.ts +4 -0
- package/dist/types/channels/adapter-namespace.d.ts +2 -0
- package/dist/types/channels/adapters/mention-hints.d.ts +12 -0
- package/dist/types/channels/adapters/webex-id-ref.d.ts +5 -0
- package/dist/types/channels/background-handoff.d.ts +56 -0
- package/dist/types/channels/background-obligations.d.ts +135 -0
- package/dist/types/channels/catch-up.d.ts +26 -0
- package/dist/types/channels/commands.d.ts +2 -0
- package/dist/types/channels/completion-claim.d.ts +20 -0
- package/dist/types/channels/continuation-willingness.d.ts +1 -0
- package/dist/types/channels/continuity-types.d.ts +75 -0
- package/dist/types/channels/describe-error.d.ts +1 -0
- package/dist/types/channels/engagement.d.ts +34 -0
- package/dist/types/channels/github-false-receipt.d.ts +20 -0
- package/dist/types/channels/github-repo.d.ts +2 -0
- package/dist/types/channels/github-rereview-guard.d.ts +24 -0
- package/dist/types/channels/github-review-check.d.ts +135 -0
- package/dist/types/channels/github-review-claim.d.ts +3 -0
- package/dist/types/channels/github-review-turn-ledger.d.ts +71 -0
- package/dist/types/channels/github-review-verdict-coordinator.d.ts +117 -0
- package/dist/types/channels/github-token-bridge.d.ts +20 -0
- package/dist/types/channels/github-verdict-activity.d.ts +12 -0
- package/dist/types/channels/inbound-journal.d.ts +272 -0
- package/dist/types/channels/last-alive.d.ts +3 -0
- package/dist/types/channels/membership-cache.d.ts +27 -0
- package/dist/types/channels/membership.d.ts +21 -0
- package/dist/types/channels/outbound-flood-filter.d.ts +7 -0
- package/dist/types/channels/participants.d.ts +4 -0
- package/dist/types/channels/persistence.d.ts +32 -0
- package/dist/types/channels/recovery-notice.d.ts +26 -0
- package/dist/types/channels/recovery-outbox.d.ts +58 -0
- package/dist/types/channels/router.d.ts +798 -0
- package/dist/types/channels/schema.d.ts +501 -0
- package/dist/types/channels/session-handoff.d.ts +58 -0
- package/dist/types/channels/session-search.d.ts +29 -0
- package/dist/types/channels/types.d.ts +414 -0
- package/dist/types/channels/waiting-reactions.d.ts +25 -0
- package/dist/types/cli/builtins.d.ts +2 -0
- package/dist/types/cli/command-meta.d.ts +9 -0
- package/dist/types/coding-agent/broker-body.d.ts +7 -0
- package/dist/types/coding-agent/broker.d.ts +22 -0
- package/dist/types/coding-agent/claude.d.ts +22 -0
- package/dist/types/coding-agent/codex.d.ts +19 -0
- package/dist/types/coding-agent/index.d.ts +71 -0
- package/dist/types/coding-agent/omo-state.d.ts +2 -0
- package/dist/types/coding-agent/omo-stream.d.ts +22 -0
- package/dist/types/coding-agent/omo.d.ts +133 -0
- package/dist/types/coding-agent/runner.d.ts +35 -0
- package/dist/types/coding-agent/tool.d.ts +27 -0
- package/dist/types/coding-agent/worktree.d.ts +22 -0
- package/dist/types/commands/index.d.ts +45 -0
- package/dist/types/config/config.d.ts +814 -0
- package/dist/types/config/index.d.ts +3 -0
- package/dist/types/config/model-overrides.d.ts +3 -0
- package/dist/types/config/providers.d.ts +1456 -0
- package/dist/types/config/reloadable.d.ts +9 -0
- package/dist/types/container/agent-operation-lock.d.ts +31 -0
- package/dist/types/container/build-cache.d.ts +39 -0
- package/dist/types/container/compose-project.d.ts +1 -0
- package/dist/types/container/controller.d.ts +25 -0
- package/dist/types/container/docker-app.d.ts +23 -0
- package/dist/types/container/exit-reason.d.ts +10 -0
- package/dist/types/container/index.d.ts +14 -0
- package/dist/types/container/log-archive.d.ts +68 -0
- package/dist/types/container/log-colors.d.ts +3 -0
- package/dist/types/container/log-timestamps.d.ts +9 -0
- package/dist/types/container/logs.d.ts +37 -0
- package/dist/types/container/memory-limit.d.ts +13 -0
- package/dist/types/container/memory-oversubscription.d.ts +20 -0
- package/dist/types/container/oom-events.d.ts +18 -0
- package/dist/types/container/port.d.ts +18 -0
- package/dist/types/container/require-running.d.ts +16 -0
- package/dist/types/container/restart.d.ts +32 -0
- package/dist/types/container/shared.d.ts +93 -0
- package/dist/types/container/shell.d.ts +35 -0
- package/dist/types/container/start.d.ts +144 -0
- package/dist/types/container/stats.d.ts +31 -0
- package/dist/types/container/status.d.ts +25 -0
- package/dist/types/container/stop.d.ts +24 -0
- package/dist/types/container/tool-oom-priority.d.ts +4 -0
- package/dist/types/container/verify-running.d.ts +49 -0
- package/dist/types/cron/consumer.d.ts +42 -0
- package/dist/types/cron/count-state.d.ts +24 -0
- package/dist/types/cron/index.d.ts +21 -0
- package/dist/types/cron/list.d.ts +33 -0
- package/dist/types/cron/reloadable.d.ts +11 -0
- package/dist/types/cron/scheduler.d.ts +51 -0
- package/dist/types/cron/schema.d.ts +108 -0
- package/dist/types/dependencies/bin-resolver.d.ts +28 -0
- package/dist/types/dependencies/bins.d.ts +22 -0
- package/dist/types/dependencies/index.d.ts +2 -0
- package/dist/types/git/bound-gc-config.d.ts +4 -0
- package/dist/types/git/hookless.d.ts +1 -0
- package/dist/types/git/reconcile-ignored.d.ts +13 -0
- package/dist/types/git/resolve-agent-git.d.ts +8 -0
- package/dist/types/git/resolve-identity.d.ts +10 -0
- package/dist/types/git/run.d.ts +24 -0
- package/dist/types/git/system-commit.d.ts +2 -0
- package/dist/types/hostd/client.d.ts +13 -0
- package/dist/types/hostd/models.d.ts +1 -0
- package/dist/types/hostd/paths.d.ts +17 -0
- package/dist/types/hostd/protocol.d.ts +93 -0
- package/dist/types/hostd/spawn.d.ts +17 -0
- package/dist/types/hostd/version.d.ts +18 -0
- package/dist/types/init/auto-upgrade.d.ts +41 -0
- package/dist/types/init/cli-version.d.ts +7 -0
- package/dist/types/init/dockerfile.d.ts +34 -0
- package/dist/types/init/ensure-deps.d.ts +17 -0
- package/dist/types/init/env-file.d.ts +3 -0
- package/dist/types/init/gitignore.d.ts +5 -0
- package/dist/types/init/local-source-stamp.d.ts +3 -0
- package/dist/types/init/packagejson.d.ts +7 -0
- package/dist/types/init/paths.d.ts +3 -0
- package/dist/types/init/reconcile-plugin-deps.d.ts +13 -0
- package/dist/types/init/run-bun-install.d.ts +16 -0
- package/dist/types/init/windows-dev-link.d.ts +8 -0
- package/dist/types/mcp/catalog.d.ts +7 -0
- package/dist/types/mcp/client.d.ts +58 -0
- package/dist/types/mcp/manager.d.ts +56 -0
- package/dist/types/mcp/tools.d.ts +23 -0
- package/dist/types/models/embedding-model.d.ts +20 -0
- package/dist/types/models/transformers-version.d.ts +1 -0
- package/dist/types/network/internal-destinations.d.ts +29 -0
- package/dist/types/operations/classify-tool-outcome.d.ts +35 -0
- package/dist/types/operations/incidents.d.ts +47 -0
- package/dist/types/operations/index.d.ts +3 -0
- package/dist/types/operations/remediations.d.ts +25 -0
- package/dist/types/path-safety/real-intended-path.d.ts +9 -0
- package/dist/types/permissions/builtins.d.ts +25 -0
- package/dist/types/permissions/grant.d.ts +19 -0
- package/dist/types/permissions/index.d.ts +6 -0
- package/dist/types/permissions/match-rule.d.ts +28 -0
- package/dist/types/permissions/permissions.d.ts +42 -0
- package/dist/types/permissions/resolve.d.ts +25 -0
- package/dist/types/permissions/schema.d.ts +14 -0
- package/dist/types/plugin/context.d.ts +20 -0
- package/dist/types/plugin/core-tool-names.d.ts +4 -0
- package/dist/types/plugin/define.d.ts +46 -0
- package/dist/types/plugin/hooks.d.ts +52 -0
- package/dist/types/plugin/index.d.ts +11 -0
- package/dist/types/plugin/load-skill.d.ts +14 -0
- package/dist/types/plugin/loader.d.ts +25 -0
- package/dist/types/plugin/manager.d.ts +42 -0
- package/dist/types/plugin/registry.d.ts +73 -0
- package/dist/types/plugin/skills.d.ts +11 -0
- package/dist/types/plugin/types.d.ts +336 -0
- package/dist/types/plugin/zod-introspect.d.ts +11 -0
- package/dist/types/reload/client.d.ts +11 -0
- package/dist/types/reload/docker-exec-client.d.ts +11 -0
- package/dist/types/reload/format.d.ts +2 -0
- package/dist/types/reload/index.d.ts +6 -0
- package/dist/types/reload/recover.d.ts +22 -0
- package/dist/types/reload/registry.d.ts +10 -0
- package/dist/types/reload/types.d.ts +25 -0
- package/dist/types/role-claim/client.d.ts +20 -0
- package/dist/types/role-claim/code.d.ts +4 -0
- package/dist/types/role-claim/controller.d.ts +59 -0
- package/dist/types/role-claim/index.d.ts +6 -0
- package/dist/types/role-claim/match-rule.d.ts +9 -0
- package/dist/types/role-claim/pending.d.ts +35 -0
- package/dist/types/role-claim/reload-after-claim.d.ts +16 -0
- package/dist/types/run/llm-fetch-observer.d.ts +50 -0
- package/dist/types/sandbox/availability.d.ts +21 -0
- package/dist/types/sandbox/build.d.ts +7 -0
- package/dist/types/sandbox/canonical-secrets.d.ts +8 -0
- package/dist/types/sandbox/coding-agent.d.ts +20 -0
- package/dist/types/sandbox/dependency-bins.d.ts +19 -0
- package/dist/types/sandbox/dev-source.d.ts +4 -0
- package/dist/types/sandbox/env-exposure.d.ts +1 -0
- package/dist/types/sandbox/errors.d.ts +20 -0
- package/dist/types/sandbox/hidden-paths.d.ts +11 -0
- package/dist/types/sandbox/index.d.ts +14 -0
- package/dist/types/sandbox/package-install.d.ts +1 -0
- package/dist/types/sandbox/policy.d.ts +71 -0
- package/dist/types/sandbox/privileged-runtime.d.ts +13 -0
- package/dist/types/sandbox/quote.d.ts +2 -0
- package/dist/types/sandbox/runtime-private.d.ts +1 -0
- package/dist/types/sandbox/session-tmp.d.ts +6 -0
- package/dist/types/sandbox/symlinks.d.ts +6 -0
- package/dist/types/sandbox/writable-zones.d.ts +15 -0
- package/dist/types/secrets/coding-agent-auth.d.ts +25 -0
- package/dist/types/secrets/defaults.d.ts +21 -0
- package/dist/types/secrets/export-github-cli-store.d.ts +22 -0
- package/dist/types/secrets/hydrate.d.ts +7 -0
- package/dist/types/secrets/index.d.ts +7 -0
- package/dist/types/secrets/provision-github-cli-store.d.ts +45 -0
- package/dist/types/secrets/refresh-provider-oauth.d.ts +22 -0
- package/dist/types/secrets/resolve.d.ts +14 -0
- package/dist/types/secrets/schema.d.ts +840 -0
- package/dist/types/secrets/storage.d.ts +56 -0
- package/dist/types/shared/host-locale.d.ts +1 -0
- package/dist/types/shared/index.d.ts +5 -0
- package/dist/types/shared/local-time.d.ts +4 -0
- package/dist/types/shared/platform.d.ts +2 -0
- package/dist/types/shared/protocol.d.ts +424 -0
- package/dist/types/shared/style-text.d.ts +3 -0
- package/dist/types/shared/wsl.d.ts +17 -0
- package/dist/types/stream/broker.d.ts +2 -0
- package/dist/types/stream/index.d.ts +2 -0
- package/dist/types/stream/types.d.ts +71 -0
- package/package.json +13 -6
- package/scripts/build-plugin-types.ts +105 -0
- package/scripts/check-plugin-sdk.ts +111 -0
- package/scripts/dump-system-prompt.ts +52 -110
- package/scripts/require-parallel.ts +5 -32
- package/src/agent/guard-types.ts +3 -0
- package/src/agent/guards.ts +4 -0
- package/src/agent/idle-compaction.ts +174 -0
- package/src/agent/index.ts +210 -80
- package/src/agent/live-sessions.ts +2 -2
- package/src/agent/live-subagents.ts +20 -0
- package/src/agent/multimodal/look-at.ts +22 -9
- package/src/agent/plugin-tools.ts +66 -12
- package/src/agent/prompt-cache-key.ts +42 -0
- package/src/agent/provider-error.ts +179 -10
- package/src/agent/restart-handoff/index.ts +7 -14
- package/src/agent/reviewer-activity.ts +68 -0
- package/src/agent/reviewer-bash-policy.ts +41 -1
- package/src/agent/session-origin.ts +58 -9
- package/src/agent/subagent-cache-keepalive.ts +198 -0
- package/src/agent/subagent-session.ts +6 -0
- package/src/agent/subagents.ts +59 -9
- package/src/agent/system-prompt.ts +68 -202
- package/src/agent/todo/continuation-policy.ts +12 -4
- package/src/agent/tool-file-safety.ts +119 -15
- package/src/agent/tool-not-found-nudge.ts +1 -1
- package/src/agent/tools/channel-edit.ts +20 -10
- package/src/agent/tools/channel-fetch-attachment.ts +12 -5
- package/src/agent/tools/channel-handoff.ts +72 -0
- package/src/agent/tools/channel-history-render.ts +2 -1
- package/src/agent/tools/channel-read.ts +57 -10
- package/src/agent/tools/channel-reply.ts +55 -30
- package/src/agent/tools/channel-send.ts +69 -19
- package/src/agent/tools/channel-session-search.ts +35 -0
- package/src/agent/tools/curl-impersonate.ts +22 -6
- package/src/agent/tools/ddg.ts +13 -5
- package/src/agent/tools/post-github-review.ts +77 -15
- package/src/agent/tools/skip-response.ts +2 -2
- package/src/agent/tools/spawn-subagent.ts +190 -23
- package/src/agent/tools/stream-snapshot.ts +15 -2
- package/src/agent/tools/subagent-access.ts +11 -4
- package/src/agent/tools/subagent-output.ts +8 -0
- package/src/browser/bsk-shim.mjs +74 -0
- package/src/browser/dockerfile.ts +84 -0
- package/src/browser/egress.ts +104 -0
- package/src/browser/managed-browser.ts +205 -0
- package/src/browser/registry.ts +110 -0
- package/src/browser/relay.ts +231 -0
- package/src/browser/sandbox-entry.ts +167 -0
- package/src/bundled-plugins/agent-browser/index.ts +2 -0
- package/src/bundled-plugins/backup/README.md +10 -9
- package/src/bundled-plugins/backup/runner.ts +140 -58
- package/src/bundled-plugins/backup/subagents.ts +58 -26
- package/src/bundled-plugins/browser-agent/browser-agent.ts +89 -0
- package/src/bundled-plugins/browser-agent/index.ts +12 -0
- package/src/bundled-plugins/doc-render/index.ts +0 -10
- package/src/bundled-plugins/doc-render/render.ts +83 -111
- package/src/bundled-plugins/doc-render/skills/typeclaw-render-pdf/SKILL.md +152 -257
- package/src/bundled-plugins/github-cli-auth/gh-command.ts +38 -2
- package/src/bundled-plugins/github-cli-auth/git-auth-diagnostic.ts +95 -0
- package/src/bundled-plugins/github-cli-auth/granted-push.ts +135 -0
- package/src/bundled-plugins/github-cli-auth/index.ts +158 -70
- package/src/bundled-plugins/github-cli-auth/review-account.ts +23 -0
- package/src/bundled-plugins/github-cli-auth/review-checkout.ts +9 -2
- package/src/bundled-plugins/github-cli-auth/review-recorder.ts +45 -7
- package/src/bundled-plugins/managed-browser/index.ts +74 -0
- package/src/bundled-plugins/managed-browser/skills/browser-use/browser-use/SKILL.md +27 -0
- package/src/bundled-plugins/managed-browser/skills/browserskill/browserskill/SKILL.md +28 -0
- package/src/bundled-plugins/managed-browser/skills/omowright/omowright/SKILL.md +40 -0
- package/src/bundled-plugins/operator/operator.ts +15 -4
- package/src/bundled-plugins/qa/index.ts +11 -0
- package/src/bundled-plugins/qa/qa.ts +160 -0
- package/src/bundled-plugins/qa/skills/qa-cli.ts +50 -0
- package/src/bundled-plugins/qa/skills/qa-general.ts +30 -0
- package/src/bundled-plugins/qa/skills/qa-http.ts +39 -0
- package/src/bundled-plugins/qa/skills/qa-pr.ts +51 -0
- package/src/bundled-plugins/qa/skills/qa-web.ts +49 -0
- package/src/bundled-plugins/reviewer/skills/code-review.ts +1 -1
- package/src/bundled-plugins/security/index.ts +103 -36
- package/src/bundled-plugins/security/policies/git-exfil.ts +24 -12
- package/src/bundled-plugins/security/policies/outbound-secret-scan.ts +1 -0
- package/src/channels/adapter-namespace.ts +13 -0
- package/src/channels/adapters/discord-bot-reactions.ts +18 -0
- package/src/channels/adapters/discord-bot.ts +219 -72
- package/src/channels/adapters/discord-reactions.ts +18 -0
- package/src/channels/adapters/discord.ts +114 -8
- package/src/channels/adapters/github/inbound.ts +103 -8
- package/src/channels/adapters/github/index.ts +267 -19
- package/src/channels/adapters/github/last-alive.ts +15 -0
- package/src/channels/adapters/github/outbound.ts +54 -18
- package/src/channels/adapters/github/pending-review-store.ts +141 -0
- package/src/channels/adapters/github/permission-guidance.ts +1 -0
- package/src/channels/adapters/github/reactions.ts +100 -0
- package/src/channels/adapters/github/reconcile-cooldown-store.ts +197 -67
- package/src/channels/adapters/github/reconcile-open-prs.ts +418 -33
- package/src/channels/adapters/github/recovery.ts +106 -0
- package/src/channels/adapters/github/review-check.ts +510 -0
- package/src/channels/adapters/github/review-submitter.ts +34 -2
- package/src/channels/adapters/instagram.ts +32 -14
- package/src/channels/adapters/kakaotalk.ts +22 -7
- package/src/channels/adapters/line.ts +18 -3
- package/src/channels/adapters/outbound-account.ts +20 -0
- package/src/channels/adapters/own-reactions.ts +66 -0
- package/src/channels/adapters/recovery-correlation.ts +214 -0
- package/src/channels/adapters/slack-attachment-download.ts +14 -3
- package/src/channels/adapters/slack-bot-author-resolver.ts +4 -3
- package/src/channels/adapters/slack-bot-channel-resolver.ts +9 -6
- package/src/channels/adapters/slack-bot-classify.ts +19 -11
- package/src/channels/adapters/slack-bot-dedupe.ts +111 -28
- package/src/channels/adapters/slack-bot-reactions.ts +18 -0
- package/src/channels/adapters/slack-bot-slash-commands.ts +3 -1
- package/src/channels/adapters/slack-bot.ts +424 -124
- package/src/channels/adapters/slack-classify.ts +26 -4
- package/src/channels/adapters/slack-inbound-revision.ts +96 -0
- package/src/channels/adapters/slack-reactions.ts +18 -0
- package/src/channels/adapters/slack-thread-ts.ts +6 -0
- package/src/channels/adapters/slack.ts +48 -3
- package/src/channels/adapters/teams.ts +14 -4
- package/src/channels/adapters/telegram-bot.ts +56 -10
- package/src/channels/adapters/webex-bot.ts +12 -2
- package/src/channels/adapters/webex.ts +12 -2
- package/src/channels/background-handoff.ts +434 -0
- package/src/channels/background-obligations.ts +893 -0
- package/src/channels/catch-up.ts +137 -0
- package/src/channels/continuation-willingness.ts +2 -2
- package/src/channels/continuity-types.ts +272 -0
- package/src/channels/engagement.ts +17 -1
- package/src/channels/github-false-receipt.ts +3 -3
- package/src/channels/github-rereview-guard.ts +9 -5
- package/src/channels/github-review-check.ts +598 -0
- package/src/channels/github-review-turn-ledger.ts +102 -28
- package/src/channels/github-review-verdict-coordinator.ts +72 -12
- package/src/channels/github-token-bridge.ts +35 -5
- package/src/channels/inbound-journal.ts +1738 -0
- package/src/channels/index.ts +6 -1
- package/src/channels/last-alive.ts +34 -0
- package/src/channels/manager.ts +25 -8
- package/src/channels/recovery-dispatcher.ts +264 -0
- package/src/channels/recovery-notice.ts +94 -0
- package/src/channels/recovery-outbox.ts +459 -0
- package/src/channels/router.ts +2951 -736
- package/src/channels/schema.ts +8 -1
- package/src/channels/session-handoff.fixture.ts +144 -0
- package/src/channels/session-handoff.ts +175 -0
- package/src/channels/session-search.ts +71 -0
- package/src/channels/subagent-completion-bridge.ts +17 -14
- package/src/channels/types.ts +133 -18
- package/src/channels/waiting-reactions.ts +664 -0
- package/src/cli/channel.ts +2 -3
- package/src/cli/compose.ts +7 -4
- package/src/cli/hostd.ts +49 -3
- package/src/cli/init.ts +2 -3
- package/src/cli/inspect.ts +11 -14
- package/src/cli/model.ts +132 -3
- package/src/coding-agent/broker-body.ts +38 -0
- package/src/coding-agent/broker.ts +290 -0
- package/src/coding-agent/claude.ts +95 -0
- package/src/coding-agent/codex.ts +104 -0
- package/src/coding-agent/index.ts +512 -0
- package/src/coding-agent/omo-state.ts +69 -0
- package/src/coding-agent/omo-stream.ts +138 -0
- package/src/coding-agent/omo.ts +192 -0
- package/src/coding-agent/runner.ts +285 -0
- package/src/coding-agent/tool.ts +62 -0
- package/src/coding-agent/worktree.ts +355 -0
- package/src/compose/restart.ts +10 -3
- package/src/compose/start.ts +20 -3
- package/src/config/config.ts +121 -25
- package/src/config/model-overrides.ts +59 -0
- package/src/config/models-mutation.ts +185 -2
- package/src/config/providers-mutation.ts +12 -4
- package/src/config/providers.ts +71 -9
- package/src/container/exit-reason.ts +44 -0
- package/src/container/index.ts +5 -0
- package/src/container/log-archive.ts +51 -13
- package/src/container/memory-limit.ts +1 -1
- package/src/container/memory-oversubscription.ts +36 -6
- package/src/container/oom-events.ts +86 -0
- package/src/container/restart.ts +2 -0
- package/src/container/shared.ts +8 -1
- package/src/container/start.ts +120 -17
- package/src/container/stop.ts +6 -2
- package/src/container/tool-oom-priority.ts +32 -0
- package/src/cron/consumer.ts +10 -4
- package/src/cron/reloadable.ts +23 -2
- package/src/doctor/checks.ts +22 -8
- package/src/hostd/daemon.ts +33 -11
- package/src/hostd/spawn.ts +106 -5
- package/src/hostd/version.ts +20 -0
- package/src/hostd/watchdog.ts +241 -0
- package/src/init/auto-upgrade.ts +7 -1
- package/src/init/dockerfile.ts +112 -602
- package/src/init/index.ts +6 -6
- package/src/init/local-source-stamp.ts +68 -0
- package/src/init/models-dev.ts +4 -0
- package/src/init/validate-api-key.ts +3 -0
- package/src/mcp/client.ts +3 -1
- package/src/operations/classify-tool-outcome.ts +45 -1
- package/src/operations/incidents.ts +10 -5
- package/src/permissions/builtins.ts +7 -0
- package/src/permissions/permissions.ts +18 -9
- package/src/permissions/resolve.ts +7 -1
- package/src/plugin/context.ts +2 -0
- package/src/plugin/core-tool-names.ts +1 -1
- package/src/plugin/define.ts +1 -0
- package/src/plugin/hooks.ts +137 -0
- package/src/plugin/index.ts +7 -0
- package/src/plugin/manager.ts +4 -0
- package/src/plugin/types.ts +66 -1
- package/src/run/background-handoff-boot.ts +86 -0
- package/src/run/bundled-plugins.ts +6 -0
- package/src/run/index.ts +107 -97
- package/src/run/llm-fetch-observer.ts +12 -15
- package/src/run/resource-sample.ts +19 -0
- package/src/sandbox/build.ts +4 -0
- package/src/sandbox/canonical-secrets.ts +4 -0
- package/src/sandbox/coding-agent.ts +214 -0
- package/src/sandbox/dev-source.ts +26 -0
- package/src/sandbox/hidden-paths.ts +16 -2
- package/src/sandbox/policy.ts +1 -0
- package/src/sandbox/runtime-private.ts +4 -1
- package/src/secrets/coding-agent-auth.ts +97 -0
- package/src/secrets/index.ts +0 -16
- package/src/secrets/storage.ts +13 -0
- package/src/server/command-runner.ts +6 -2
- package/src/server/index.ts +101 -40
- package/src/skills/typeclaw-channel-github/SKILL.md +15 -13
- package/src/skills/typeclaw-claude-code/SKILL.md +25 -260
- package/src/skills/typeclaw-claude-code/references/auth-flow.md +7 -23
- package/src/skills/typeclaw-claude-code/references/headless-sessions.md +11 -0
- package/src/skills/typeclaw-claude-code/references/results-and-worktrees.md +13 -0
- package/src/skills/typeclaw-codex-cli/SKILL.md +35 -270
- package/src/skills/typeclaw-codex-cli/references/auth-flow.md +13 -20
- package/src/skills/typeclaw-codex-cli/references/headless-sessions.md +26 -0
- package/src/skills/typeclaw-codex-cli/references/results-and-worktrees.md +28 -0
- package/src/skills/typeclaw-config/SKILL.md +60 -26
- package/src/skills/typeclaw-config/references/dockerfile.md +14 -13
- package/src/skills/typeclaw-cron/SKILL.md +1 -1
- package/src/skills/typeclaw-github-contributing/SKILL.md +3 -3
- package/src/skills/typeclaw-memory/SKILL.md +3 -3
- package/src/skills/typeclaw-monorepo/SKILL.md +1 -1
- package/src/skills/typeclaw-omo-cli/SKILL.md +52 -0
- package/src/skills/typeclaw-omo-cli/references/auth-flow.md +11 -0
- package/src/skills/typeclaw-omo-cli/references/headless-sessions.md +11 -0
- package/src/skills/typeclaw-omo-cli/references/results-and-worktrees.md +23 -0
- package/src/skills/typeclaw-permissions/SKILL.md +7 -7
- package/src/skills/typeclaw-plugins/SKILL.md +15 -15
- package/src/skills/typeclaw-skills/SKILL.md +19 -2
- package/src/skills/typeclaw-troubleshooting/SKILL.md +26 -2
- package/typeclaw.schema.json +448 -6
- package/src/bundled-plugins/doc-render/templates/lib.typ +0 -339
- package/src/bundled-plugins/github-cli-auth/gh-store.ts +0 -733
- package/src/secrets/claude-credentials-json.ts +0 -129
- package/src/secrets/codex-auth-json.ts +0 -102
- package/src/secrets/export-claude-credentials-file.ts +0 -270
- package/src/secrets/export-codex-auth-file.ts +0 -250
- package/src/skills/typeclaw-claude-code/references/stop-hook.md +0 -101
- package/src/skills/typeclaw-claude-code/references/tmux-driving.md +0 -243
- package/src/skills/typeclaw-codex-cli/references/stop-hook.md +0 -92
- package/src/skills/typeclaw-codex-cli/references/tmux-driving.md +0 -239
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Installed as /usr/local/bin/bsk. The BrowserSkill daemon socket is
|
|
2
|
+
// runtime-private; this gives the real CLI a per-call BSK_HOME whose socket is
|
|
3
|
+
// bridged to TypeClaw's token-gated relay, so only sessions handed the token
|
|
4
|
+
// (roles with browser.shared) can drive the shared browser through bsk.
|
|
5
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
|
|
6
|
+
import { connect, createServer } from 'node:net'
|
|
7
|
+
import { tmpdir } from 'node:os'
|
|
8
|
+
import { join } from 'node:path'
|
|
9
|
+
|
|
10
|
+
const relay = process.env.TYPECLAW_BSK_RELAY
|
|
11
|
+
const token = process.env.TYPECLAW_BSK_TOKEN
|
|
12
|
+
if (!relay || !token) {
|
|
13
|
+
console.error(
|
|
14
|
+
'bsk: the shared browser is unavailable in this session (it needs the browser.shared permission, or the browser failed to start; the operator log says which).',
|
|
15
|
+
)
|
|
16
|
+
process.exit(2)
|
|
17
|
+
}
|
|
18
|
+
const separator = relay.lastIndexOf(':')
|
|
19
|
+
const host = relay.slice(0, separator)
|
|
20
|
+
const port = Number(relay.slice(separator + 1))
|
|
21
|
+
|
|
22
|
+
const home = mkdtempSync(join(tmpdir(), 'typeclaw-bsk-'))
|
|
23
|
+
mkdirSync(join(home, 'run'), { mode: 0o700 })
|
|
24
|
+
const server = createServer((inbound) => {
|
|
25
|
+
const outbound = connect(port, host, () => {
|
|
26
|
+
outbound.write(token + '\n')
|
|
27
|
+
inbound.pipe(outbound)
|
|
28
|
+
outbound.pipe(inbound)
|
|
29
|
+
})
|
|
30
|
+
const close = () => {
|
|
31
|
+
inbound.destroy()
|
|
32
|
+
outbound.destroy()
|
|
33
|
+
}
|
|
34
|
+
inbound.on('error', close)
|
|
35
|
+
outbound.on('error', close)
|
|
36
|
+
inbound.on('close', close)
|
|
37
|
+
outbound.on('close', close)
|
|
38
|
+
})
|
|
39
|
+
const sockPath = join(home, 'run', 'daemon.sock')
|
|
40
|
+
await new Promise((resolve) => server.listen(sockPath, resolve))
|
|
41
|
+
// The CLI locates its daemon through daemon.json and cross-checks its pid
|
|
42
|
+
// against the daemon, so mirror the real file and point only sock_path here.
|
|
43
|
+
const daemon = await describeDaemon().then(JSON.parse, () => {
|
|
44
|
+
console.error(
|
|
45
|
+
'bsk: the shared browser refused this session or its BrowserSkill daemon is not running; the operator log says which.',
|
|
46
|
+
)
|
|
47
|
+
rmSync(home, { recursive: true, force: true })
|
|
48
|
+
process.exit(2)
|
|
49
|
+
})
|
|
50
|
+
writeFileSync(join(home, 'daemon.json'), JSON.stringify({ ...daemon, sock_path: sockPath }))
|
|
51
|
+
|
|
52
|
+
function describeDaemon() {
|
|
53
|
+
return new Promise((resolve, reject) => {
|
|
54
|
+
const socket = connect(port, host, () => socket.write(token + ' describe\n'))
|
|
55
|
+
let text = ''
|
|
56
|
+
socket.on('data', (chunk) => {
|
|
57
|
+
text += chunk
|
|
58
|
+
})
|
|
59
|
+
socket.on('end', () => (text === '' ? reject(new Error('daemon not available')) : resolve(text)))
|
|
60
|
+
socket.on('error', reject)
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const child = Bun.spawn(
|
|
65
|
+
[process.env.TYPECLAW_BSK_BIN ?? '/usr/local/lib/typeclaw-browser/bsk/bsk', ...process.argv.slice(2)],
|
|
66
|
+
{
|
|
67
|
+
env: { ...process.env, BSK_HOME: home, BSK_AUTO_START: '0' },
|
|
68
|
+
stdio: ['inherit', 'inherit', 'inherit'],
|
|
69
|
+
},
|
|
70
|
+
)
|
|
71
|
+
const code = await child.exited
|
|
72
|
+
server.close()
|
|
73
|
+
rmSync(home, { recursive: true, force: true })
|
|
74
|
+
process.exit(code)
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs'
|
|
2
|
+
import { dirname, join } from 'node:path'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
BROWSER_ENGINES,
|
|
6
|
+
BROWSER_EXTENSIONS,
|
|
7
|
+
BROWSER_ROOT,
|
|
8
|
+
BSK_BIN,
|
|
9
|
+
BSK_SHIM,
|
|
10
|
+
type BrowserConfig,
|
|
11
|
+
extensionDir,
|
|
12
|
+
} from './registry'
|
|
13
|
+
|
|
14
|
+
const UV_VERSION = '0.13.3'
|
|
15
|
+
|
|
16
|
+
// Per-agent layers for the non-default engines and extensions. Rendered after
|
|
17
|
+
// the base heavy stack in both the versioned and inline heads, so the shared
|
|
18
|
+
// Chrome (installed by agent-browser's layer) is always present first.
|
|
19
|
+
export function renderBrowserLayers(browser: BrowserConfig): string {
|
|
20
|
+
const layers: string[] = []
|
|
21
|
+
for (const id of browser.engines) {
|
|
22
|
+
const install = BROWSER_ENGINES[id].install
|
|
23
|
+
if (install.kind === 'bun-global') layers.push(renderBunGlobalEngine(id, install.spec))
|
|
24
|
+
if (install.kind === 'uv-tool') layers.push(renderUvToolEngine(install.package, install.version, install.python))
|
|
25
|
+
}
|
|
26
|
+
for (const id of browser.extensions) layers.push(renderExtension(id))
|
|
27
|
+
return layers.map((layer) => `${layer}\n\n`).join('')
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function renderBunGlobalEngine(id: string, spec: string): string {
|
|
31
|
+
const root = `${BROWSER_ROOT}/${id}`
|
|
32
|
+
const module = `${root}/index.js`
|
|
33
|
+
return `# Browser engine ${id}: installed under /usr so sandboxed bash can import it.
|
|
34
|
+
RUN mkdir -p ${root} \\
|
|
35
|
+
&& cd ${root} \\
|
|
36
|
+
&& printf '{}' > package.json \\
|
|
37
|
+
&& BUN_INSTALL_CACHE_DIR=/tmp/typeclaw-browser-bun-cache bun add ${spec} \\
|
|
38
|
+
&& printf '%s\\n' 'export * from "${root}/node_modules/${id}/src/index.js"' > ${module} \\
|
|
39
|
+
&& rm -rf /tmp/typeclaw-browser-bun-cache \\
|
|
40
|
+
&& chmod -R a+rX ${root} \\
|
|
41
|
+
&& bun -e 'await import("${module}")'`
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function renderUvToolEngine(pkg: string, version: string, python: string): string {
|
|
45
|
+
return `# Browser engine ${pkg}: pinned uv tool with a uv-managed Python under /usr.
|
|
46
|
+
COPY --from=ghcr.io/astral-sh/uv:${UV_VERSION} /uv /usr/local/bin/uv
|
|
47
|
+
RUN UV_TOOL_DIR=${BROWSER_ROOT}/uv-tools UV_TOOL_BIN_DIR=/usr/local/bin UV_PYTHON_INSTALL_DIR=${BROWSER_ROOT}/python UV_CACHE_DIR=/tmp/typeclaw-uv-cache \\
|
|
48
|
+
uv tool install --python ${python} ${pkg}==${version} \\
|
|
49
|
+
&& rm -rf /tmp/typeclaw-uv-cache \\
|
|
50
|
+
&& chmod -R a+rX ${BROWSER_ROOT} \\
|
|
51
|
+
&& ${pkg} --version > /dev/null`
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function renderExtension(id: keyof typeof BROWSER_EXTENSIONS): string {
|
|
55
|
+
const spec = BROWSER_EXTENSIONS[id]
|
|
56
|
+
const dir = extensionDir(id)
|
|
57
|
+
const { amd64, arm64 } = spec.cli.urlByArch
|
|
58
|
+
return `# Browser extension ${id} ${spec.version}: release zip unpacked for --load-extension, plus its CLI.
|
|
59
|
+
RUN case "\${TARGETARCH:-$(uname -m)}" in \\
|
|
60
|
+
arm64|aarch64) url=${arm64.url}; sha=${arm64.sha256} ;; \\
|
|
61
|
+
amd64|x86_64) url=${amd64.url}; sha=${amd64.sha256} ;; \\
|
|
62
|
+
*) echo "Unsupported ${id} architecture" >&2; exit 1 ;; \\
|
|
63
|
+
esac \\
|
|
64
|
+
&& mkdir -p /tmp/typeclaw-ext ${dir} \\
|
|
65
|
+
&& curl -fsSL "$url" -o /tmp/typeclaw-ext/cli.tar.gz \\
|
|
66
|
+
&& echo "$sha /tmp/typeclaw-ext/cli.tar.gz" | sha256sum -c - \\
|
|
67
|
+
&& tar -xzf /tmp/typeclaw-ext/cli.tar.gz -C /tmp/typeclaw-ext \\
|
|
68
|
+
&& mkdir -p ${dirname(BSK_BIN)} \\
|
|
69
|
+
&& install -m 0755 "$(find /tmp/typeclaw-ext -type f -name ${spec.cli.name} | head -n 1)" ${BSK_BIN} \\
|
|
70
|
+
&& printf '%s' '${readFileSync(join(import.meta.dir, 'bsk-shim.mjs')).toString('base64')}' | base64 -d > ${BSK_SHIM} \\
|
|
71
|
+
&& printf '#!/bin/sh\\nexec bun ${BSK_SHIM} "$@"\\n' > /usr/local/bin/${spec.cli.name} \\
|
|
72
|
+
&& chmod 0755 /usr/local/bin/${spec.cli.name} \\
|
|
73
|
+
&& chmod -R a+rX ${dirname(BSK_BIN)} \\
|
|
74
|
+
&& curl -fsSL ${spec.zip.url} -o /tmp/typeclaw-ext/ext.zip \\
|
|
75
|
+
&& echo "${spec.zip.sha256} /tmp/typeclaw-ext/ext.zip" | sha256sum -c - \\
|
|
76
|
+
&& apt-get update \\
|
|
77
|
+
&& apt-get install -y --no-install-recommends unzip \\
|
|
78
|
+
&& rm -rf /var/lib/apt/lists/* \\
|
|
79
|
+
&& unzip -q /tmp/typeclaw-ext/ext.zip -d ${dir} \\
|
|
80
|
+
&& test -f ${dir}/manifest.json \\
|
|
81
|
+
&& chmod -R a+rX ${dir} \\
|
|
82
|
+
&& rm -rf /tmp/typeclaw-ext \\
|
|
83
|
+
&& ${BSK_BIN} --version > /dev/null`
|
|
84
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { connect, createServer, type Server, type Socket } from 'node:net'
|
|
2
|
+
|
|
3
|
+
// Minimal SOCKS5 (RFC 1928) CONNECT-only server on a Unix socket. It is the
|
|
4
|
+
// managed Chrome's only route out of its network-isolated sandbox. Destinations
|
|
5
|
+
// are dialed from the container's network namespace, so the container egress
|
|
6
|
+
// filter (`network.blockInternal`) applies exactly as it does to model bash,
|
|
7
|
+
// and a dev server bash started on container loopback stays reachable.
|
|
8
|
+
|
|
9
|
+
const VERSION = 0x05
|
|
10
|
+
const NO_AUTH = 0x00
|
|
11
|
+
const NO_ACCEPTABLE_METHOD = 0xff
|
|
12
|
+
const CMD_CONNECT = 0x01
|
|
13
|
+
const ATYP_IPV4 = 0x01
|
|
14
|
+
const ATYP_DOMAIN = 0x03
|
|
15
|
+
const ATYP_IPV6 = 0x04
|
|
16
|
+
const REPLY_OK = 0x00
|
|
17
|
+
const REPLY_FAILURE = 0x01
|
|
18
|
+
const REPLY_COMMAND_UNSUPPORTED = 0x07
|
|
19
|
+
|
|
20
|
+
export async function startSocksEgress(socketPath: string): Promise<{ close: () => Promise<void> }> {
|
|
21
|
+
const server = createServer(handleClient)
|
|
22
|
+
await new Promise<void>((resolve, reject) => {
|
|
23
|
+
server.once('error', reject)
|
|
24
|
+
server.listen(socketPath, () => resolve())
|
|
25
|
+
})
|
|
26
|
+
return { close: () => closeServer(server) }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function handleClient(client: Socket): void {
|
|
30
|
+
let buffered = Buffer.alloc(0)
|
|
31
|
+
let stage: 'greeting' | 'request' = 'greeting'
|
|
32
|
+
const onData = (chunk: Buffer): void => {
|
|
33
|
+
buffered = Buffer.concat([buffered, chunk])
|
|
34
|
+
if (stage === 'greeting') {
|
|
35
|
+
if (buffered.length < 2 || buffered.length < 2 + buffered[1]!) return
|
|
36
|
+
const methods = buffered.subarray(2, 2 + buffered[1]!)
|
|
37
|
+
if (buffered[0] !== VERSION || !methods.includes(NO_AUTH)) {
|
|
38
|
+
client.end(Buffer.from([VERSION, NO_ACCEPTABLE_METHOD]))
|
|
39
|
+
return
|
|
40
|
+
}
|
|
41
|
+
buffered = buffered.subarray(2 + buffered[1]!)
|
|
42
|
+
stage = 'request'
|
|
43
|
+
client.write(Buffer.from([VERSION, NO_AUTH]))
|
|
44
|
+
}
|
|
45
|
+
const target = parseConnectRequest(buffered)
|
|
46
|
+
if (target === 'incomplete') return
|
|
47
|
+
client.off('data', onData)
|
|
48
|
+
client.pause()
|
|
49
|
+
if (target === 'unsupported') {
|
|
50
|
+
client.end(reply(REPLY_COMMAND_UNSUPPORTED))
|
|
51
|
+
return
|
|
52
|
+
}
|
|
53
|
+
const upstream = connect({ host: target.host, port: target.port })
|
|
54
|
+
upstream.once('connect', () => {
|
|
55
|
+
client.write(reply(REPLY_OK))
|
|
56
|
+
if (target.rest.length > 0) upstream.write(target.rest)
|
|
57
|
+
client.pipe(upstream)
|
|
58
|
+
upstream.pipe(client)
|
|
59
|
+
client.resume()
|
|
60
|
+
})
|
|
61
|
+
upstream.once('error', () => client.end(reply(REPLY_FAILURE)))
|
|
62
|
+
upstream.on('close', () => client.destroy())
|
|
63
|
+
client.on('close', () => upstream.destroy())
|
|
64
|
+
}
|
|
65
|
+
client.on('data', onData)
|
|
66
|
+
client.on('error', () => client.destroy())
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
type ConnectTarget = { host: string; port: number; rest: Buffer }
|
|
70
|
+
|
|
71
|
+
function parseConnectRequest(buf: Buffer): ConnectTarget | 'incomplete' | 'unsupported' {
|
|
72
|
+
if (buf.length < 5) return 'incomplete'
|
|
73
|
+
if (buf[0] !== VERSION || buf[1] !== CMD_CONNECT) return 'unsupported'
|
|
74
|
+
const atyp = buf[3]
|
|
75
|
+
let host: string
|
|
76
|
+
let offset: number
|
|
77
|
+
if (atyp === ATYP_IPV4) {
|
|
78
|
+
if (buf.length < 10) return 'incomplete'
|
|
79
|
+
host = [...buf.subarray(4, 8)].join('.')
|
|
80
|
+
offset = 8
|
|
81
|
+
} else if (atyp === ATYP_DOMAIN) {
|
|
82
|
+
const length = buf[4]!
|
|
83
|
+
if (buf.length < 5 + length + 2) return 'incomplete'
|
|
84
|
+
host = buf.subarray(5, 5 + length).toString('latin1')
|
|
85
|
+
offset = 5 + length
|
|
86
|
+
} else if (atyp === ATYP_IPV6) {
|
|
87
|
+
if (buf.length < 22) return 'incomplete'
|
|
88
|
+
const groups: string[] = []
|
|
89
|
+
for (let i = 4; i < 20; i += 2) groups.push(buf.readUInt16BE(i).toString(16))
|
|
90
|
+
host = groups.join(':')
|
|
91
|
+
offset = 20
|
|
92
|
+
} else {
|
|
93
|
+
return 'unsupported'
|
|
94
|
+
}
|
|
95
|
+
return { host, port: buf.readUInt16BE(offset), rest: buf.subarray(offset + 2) }
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function reply(code: number): Buffer {
|
|
99
|
+
return Buffer.from([VERSION, code, 0x00, ATYP_IPV4, 0, 0, 0, 0, 0, 0])
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function closeServer(server: Server): Promise<void> {
|
|
103
|
+
return new Promise((resolve) => server.close(() => resolve()))
|
|
104
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { randomBytes } from 'node:crypto'
|
|
2
|
+
import { existsSync } from 'node:fs'
|
|
3
|
+
import { mkdir, realpath, rm } from 'node:fs/promises'
|
|
4
|
+
import { dirname, join } from 'node:path'
|
|
5
|
+
|
|
6
|
+
import { createAndOpenAnchoredDirectory } from '@/agent/tool-file-safety'
|
|
7
|
+
import { getProcBindSafetyVerdict, resolveProcSelfExe } from '@/sandbox/availability'
|
|
8
|
+
import { buildSandboxedCommand } from '@/sandbox/build'
|
|
9
|
+
import { BROWSER_PROFILE_RELATIVE_DIR } from '@/sandbox/canonical-secrets'
|
|
10
|
+
import { rejectHardlinkAliases } from '@/sandbox/hidden-paths'
|
|
11
|
+
import type { SandboxMount, SandboxProcStrategy } from '@/sandbox/policy'
|
|
12
|
+
import { shellQuote } from '@/sandbox/quote'
|
|
13
|
+
|
|
14
|
+
import { startSocksEgress } from './egress'
|
|
15
|
+
import { BSK_BIN, CHROME_LAUNCHER, type BrowserConfig, extensionDir } from './registry'
|
|
16
|
+
import { cdpWebSocketUrl, startCdpRelay, startTokenStreamRelay } from './relay'
|
|
17
|
+
import { devtoolsSocket, egressSocket, type SandboxEntryConfig } from './sandbox-entry'
|
|
18
|
+
|
|
19
|
+
// Runtime-private (container /tmp is not the model's /tmp: sandboxed bash binds
|
|
20
|
+
// a per-session directory over it), so the sockets stay out of bash. The profile
|
|
21
|
+
// lives in the agent folder so logins survive restarts; it is masked from every
|
|
22
|
+
// model tool as a runtime-owned secret dir.
|
|
23
|
+
const RUN_DIR = '/tmp/typeclaw-browser'
|
|
24
|
+
const READY_TIMEOUT_MS = 60_000
|
|
25
|
+
const READY_POLL_MS = 250
|
|
26
|
+
const RESTART_BACKOFF_MS = [1_000, 2_000, 5_000, 10_000, 30_000, 60_000] as const
|
|
27
|
+
const HEALTHY_RESET_MS = 5 * 60_000
|
|
28
|
+
|
|
29
|
+
export type ManagedBrowserLogger = { info: (m: string) => void; warn: (m: string) => void; error: (m: string) => void }
|
|
30
|
+
|
|
31
|
+
export type ManagedBrowser = {
|
|
32
|
+
cdpUrl: string
|
|
33
|
+
filesDir: string
|
|
34
|
+
// Loopback address of the token-gated BrowserSkill daemon relay.
|
|
35
|
+
bskRelay: string | undefined
|
|
36
|
+
token: string
|
|
37
|
+
stop: () => Promise<void>
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Workspace-relative so roles that can see workspace/ (the same tier that holds
|
|
41
|
+
// `browser.shared` by default) can exchange uploads and downloads with Chrome.
|
|
42
|
+
export function browserFilesRoot(agentDir: string): string {
|
|
43
|
+
return join(agentDir, 'workspace', '.typeclaw-browser')
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export async function startManagedBrowser(options: {
|
|
47
|
+
agentDir: string
|
|
48
|
+
browser: BrowserConfig
|
|
49
|
+
logger: ManagedBrowserLogger
|
|
50
|
+
}): Promise<ManagedBrowser> {
|
|
51
|
+
const { agentDir, browser, logger } = options
|
|
52
|
+
const filesDir = join(browserFilesRoot(agentDir), 'files')
|
|
53
|
+
// Runtime-private: the daemon socket has no auth of its own, so bash reaches
|
|
54
|
+
// it only through the token relay below, never by pointing BSK_HOME here.
|
|
55
|
+
const bskHome = browser.extensions.includes('browserskill') ? join(RUN_DIR, 'bsk') : undefined
|
|
56
|
+
await rm(RUN_DIR, { recursive: true, force: true })
|
|
57
|
+
await mkdir(join(RUN_DIR, 'home'), { recursive: true })
|
|
58
|
+
if (bskHome !== undefined) await mkdir(bskHome, { recursive: true, mode: 0o700 })
|
|
59
|
+
// Workspace is model-writable, so a component could be a planted symlink to
|
|
60
|
+
// the agent root. Open each component no-follow and bind the held descriptor,
|
|
61
|
+
// so Chrome gets exactly the directory validated here for the whole boot.
|
|
62
|
+
const exchange = await createAndOpenAnchoredDirectory(filesDir)
|
|
63
|
+
const profileDir = join(agentDir, BROWSER_PROFILE_RELATIVE_DIR)
|
|
64
|
+
const profile = await createAndOpenAnchoredDirectory(profileDir)
|
|
65
|
+
// Bash skips the bounded per-call alias scan for the profile (see
|
|
66
|
+
// isCanonicalSecretDir), so refuse a pre-existing alias here, before Chrome writes.
|
|
67
|
+
await rejectHardlinkAliases(profileDir).catch(async (error: unknown) => {
|
|
68
|
+
await profile.close()
|
|
69
|
+
throw error
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
const egress = await startSocksEgress(egressSocket(RUN_DIR))
|
|
73
|
+
const entry: SandboxEntryConfig = {
|
|
74
|
+
chrome: CHROME_LAUNCHER,
|
|
75
|
+
runDir: RUN_DIR,
|
|
76
|
+
profileDir,
|
|
77
|
+
downloadsDir: filesDir,
|
|
78
|
+
extensionDirs: browser.extensions.map((id) => extensionDir(id)),
|
|
79
|
+
headless: process.env['DISPLAY'] === undefined,
|
|
80
|
+
...(bskHome === undefined ? {} : { bsk: { home: bskHome } }),
|
|
81
|
+
}
|
|
82
|
+
const launch = await buildLaunch(entry, filesDir, profileDir)
|
|
83
|
+
const token = randomBytes(32).toString('hex')
|
|
84
|
+
const relay = await startCdpRelay({ token, upstreamSocket: devtoolsSocket(RUN_DIR) })
|
|
85
|
+
const bskRelay =
|
|
86
|
+
bskHome === undefined
|
|
87
|
+
? undefined
|
|
88
|
+
: await startTokenStreamRelay({
|
|
89
|
+
token,
|
|
90
|
+
upstreamSocket: join(bskHome, 'run', 'daemon.sock'),
|
|
91
|
+
describe: () => Bun.file(join(bskHome, 'daemon.json')).text(),
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
let stopped = false
|
|
95
|
+
let child: ReturnType<typeof Bun.spawn> | undefined
|
|
96
|
+
const supervise = async (): Promise<void> => {
|
|
97
|
+
let attempt = 0
|
|
98
|
+
while (!stopped) {
|
|
99
|
+
const startedAt = Date.now()
|
|
100
|
+
child = Bun.spawn(launch.argv, { env: launch.env, stdio: ['ignore', 'ignore', 'pipe', exchange.fd, profile.fd] })
|
|
101
|
+
void waitUntilReady(devtoolsSocket(RUN_DIR)).then(
|
|
102
|
+
() => {
|
|
103
|
+
logger.info(`managed browser ready (engines: ${browser.engines.join(', ') || 'none'})`)
|
|
104
|
+
if (bskHome !== undefined) void reportBrowserSkill(bskHome, logger)
|
|
105
|
+
},
|
|
106
|
+
(error: unknown) => logger.warn(`managed browser not ready: ${String(error)}`),
|
|
107
|
+
)
|
|
108
|
+
const code = await child.exited
|
|
109
|
+
if (stopped) return
|
|
110
|
+
const stderr = await new Response(child.stderr as ReadableStream).text().catch(() => '')
|
|
111
|
+
if (Date.now() - startedAt > HEALTHY_RESET_MS) attempt = 0
|
|
112
|
+
const delay = RESTART_BACKOFF_MS[Math.min(attempt, RESTART_BACKOFF_MS.length - 1)]!
|
|
113
|
+
attempt += 1
|
|
114
|
+
logger.warn(
|
|
115
|
+
`managed browser exited with code ${code}; restarting in ${delay / 1000}s` +
|
|
116
|
+
(stderr.trim() === '' ? '' : `: ${stderr.trim().split('\n').slice(-3).join(' | ')}`),
|
|
117
|
+
)
|
|
118
|
+
await Bun.sleep(delay)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
void supervise()
|
|
122
|
+
|
|
123
|
+
return {
|
|
124
|
+
cdpUrl: cdpWebSocketUrl(relay.port, token),
|
|
125
|
+
filesDir,
|
|
126
|
+
bskRelay: bskRelay === undefined ? undefined : `127.0.0.1:${bskRelay.port}`,
|
|
127
|
+
token,
|
|
128
|
+
stop: async () => {
|
|
129
|
+
stopped = true
|
|
130
|
+
child?.kill()
|
|
131
|
+
await Promise.allSettled([relay.close(), egress.close(), bskRelay?.close(), exchange.close(), profile.close()])
|
|
132
|
+
},
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
async function buildLaunch(
|
|
137
|
+
entry: SandboxEntryConfig,
|
|
138
|
+
filesDir: string,
|
|
139
|
+
profileDir: string,
|
|
140
|
+
): Promise<{ argv: string[]; env: Record<string, string> }> {
|
|
141
|
+
const entryFile = await realpath(join(import.meta.dir, 'sandbox-entry.ts'))
|
|
142
|
+
const mounts: SandboxMount[] = [
|
|
143
|
+
{ type: 'bind', source: RUN_DIR, dest: RUN_DIR },
|
|
144
|
+
// fd 3 is the anchored exchange directory passed in the spawn's stdio.
|
|
145
|
+
{ type: 'bind-fd', fd: 3, dest: filesDir },
|
|
146
|
+
{ type: 'bind-fd', fd: 4, dest: profileDir },
|
|
147
|
+
{ type: 'ro-bind', source: dirname(entryFile), dest: dirname(entryFile) },
|
|
148
|
+
]
|
|
149
|
+
if (existsSync('/tmp/.X11-unix')) mounts.push({ type: 'ro-bind', source: '/tmp/.X11-unix', dest: '/tmp/.X11-unix' })
|
|
150
|
+
const proc: SandboxProcStrategy = (await getProcBindSafetyVerdict()) === 'safe' ? 'proc-bind' : 'tmpfs'
|
|
151
|
+
const display = process.env['DISPLAY']
|
|
152
|
+
const { argv, spawnEnv } = buildSandboxedCommand(
|
|
153
|
+
`exec bun ${shellQuote(entryFile)} ${shellQuote(JSON.stringify(entry))}`,
|
|
154
|
+
{
|
|
155
|
+
network: 'none',
|
|
156
|
+
proc,
|
|
157
|
+
procSelfExe: resolveProcSelfExe(),
|
|
158
|
+
mounts,
|
|
159
|
+
cwd: RUN_DIR,
|
|
160
|
+
env: { set: { HOME: join(RUN_DIR, 'home'), ...(display === undefined ? {} : { DISPLAY: display }) } },
|
|
161
|
+
},
|
|
162
|
+
)
|
|
163
|
+
return { argv, env: spawnEnv }
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
async function waitUntilReady(socket: string): Promise<void> {
|
|
167
|
+
const deadline = Date.now() + READY_TIMEOUT_MS
|
|
168
|
+
let lastError: unknown
|
|
169
|
+
while (Date.now() < deadline) {
|
|
170
|
+
try {
|
|
171
|
+
const response = await fetch('http://127.0.0.1/json/version', { unix: socket } as RequestInit)
|
|
172
|
+
if (response.ok) return
|
|
173
|
+
lastError = new Error(`DevTools answered ${response.status}`)
|
|
174
|
+
} catch (error) {
|
|
175
|
+
lastError = error
|
|
176
|
+
}
|
|
177
|
+
await Bun.sleep(READY_POLL_MS)
|
|
178
|
+
}
|
|
179
|
+
throw new Error(`DevTools did not answer within ${READY_TIMEOUT_MS / 1000}s (${String(lastError)})`)
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Operator-log only: a disconnected extension degrades one tool, so it never
|
|
183
|
+
// becomes a channel message.
|
|
184
|
+
async function reportBrowserSkill(bskHome: string, logger: ManagedBrowserLogger): Promise<void> {
|
|
185
|
+
for (let attempt = 0; attempt < 20; attempt++) {
|
|
186
|
+
const status = Bun.spawn([BSK_BIN, 'status', '--json'], {
|
|
187
|
+
env: { PATH: process.env['PATH'] ?? '/usr/local/bin:/usr/bin:/bin', BSK_HOME: bskHome, BSK_AUTO_START: '0' },
|
|
188
|
+
stdout: 'pipe',
|
|
189
|
+
stderr: 'ignore',
|
|
190
|
+
})
|
|
191
|
+
const out = await new Response(status.stdout).text()
|
|
192
|
+
await status.exited
|
|
193
|
+
try {
|
|
194
|
+
const parsed = JSON.parse(out) as { browsers?: unknown[] }
|
|
195
|
+
if ((parsed.browsers?.length ?? 0) > 0) {
|
|
196
|
+
logger.info('BrowserSkill extension connected')
|
|
197
|
+
return
|
|
198
|
+
}
|
|
199
|
+
} catch {
|
|
200
|
+
// daemon not answering yet; retry below
|
|
201
|
+
}
|
|
202
|
+
await Bun.sleep(1_000)
|
|
203
|
+
}
|
|
204
|
+
logger.warn('BrowserSkill extension did not connect to its daemon; bsk commands will fail until it does')
|
|
205
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// Browser engines and extensions that `typeclaw.json#browser` can enable.
|
|
2
|
+
//
|
|
3
|
+
// An engine is a driver the model runs from bash (a CLI or a library). Every
|
|
4
|
+
// engine except the legacy agent-browser default attaches to the one
|
|
5
|
+
// TypeClaw-managed Chrome over CDP, so tabs and logins persist across bash
|
|
6
|
+
// calls and every engine sees the same extensions. An extension is loaded into
|
|
7
|
+
// that managed Chrome once, so every engine benefits from it.
|
|
8
|
+
|
|
9
|
+
export const BROWSER_ENGINE_IDS = ['agent-browser', 'omowright', 'browser-use'] as const
|
|
10
|
+
export type BrowserEngineId = (typeof BROWSER_ENGINE_IDS)[number]
|
|
11
|
+
|
|
12
|
+
export const BROWSER_EXTENSION_IDS = ['browserskill'] as const
|
|
13
|
+
export type BrowserExtensionId = (typeof BROWSER_EXTENSION_IDS)[number]
|
|
14
|
+
|
|
15
|
+
export type BrowserEngineInstall =
|
|
16
|
+
// Already in every image: agent-browser installs the Chrome every engine shares.
|
|
17
|
+
| { kind: 'image' }
|
|
18
|
+
| { kind: 'bun-global'; spec: string }
|
|
19
|
+
| { kind: 'uv-tool'; package: string; version: string; python: string }
|
|
20
|
+
|
|
21
|
+
export type BrowserEngineSpec = {
|
|
22
|
+
id: BrowserEngineId
|
|
23
|
+
install: BrowserEngineInstall
|
|
24
|
+
// Env for sandboxed bash when the managed browser is running, keyed off its
|
|
25
|
+
// CDP URL. Also carries phone-home opt-outs.
|
|
26
|
+
env: (cdpUrl: string) => Record<string, string>
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type BrowserExtensionSpec = {
|
|
30
|
+
id: BrowserExtensionId
|
|
31
|
+
version: string
|
|
32
|
+
zip: { url: string; sha256: string }
|
|
33
|
+
cli: { name: string; urlByArch: Record<'amd64' | 'arm64', { url: string; sha256: string }> }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const BROWSER_ROOT = '/usr/local/lib/typeclaw-browser'
|
|
37
|
+
|
|
38
|
+
// Installed by the base image for agent-browser; the launcher adds --no-sandbox
|
|
39
|
+
// because Chrome's own sandbox cannot run inside bwrap.
|
|
40
|
+
export const CHROME_LAUNCHER = '/usr/local/lib/typeclaw-agent-browser/chrome'
|
|
41
|
+
|
|
42
|
+
export const BSK_BIN = `${BROWSER_ROOT}/bsk/bsk`
|
|
43
|
+
export const BSK_SHIM = `${BROWSER_ROOT}/bsk/shim.mjs`
|
|
44
|
+
// BrowserSkill's extension dials its daemon here, inside the browser sandbox.
|
|
45
|
+
export const BSK_DAEMON_PORT = 52800
|
|
46
|
+
|
|
47
|
+
export const OMOWRIGHT_MODULE = `${BROWSER_ROOT}/omowright/index.js`
|
|
48
|
+
|
|
49
|
+
const OMOWRIGHT_COMMIT = 'a3f0c2b54fc41804beca7eb6ab26ee54804742a9'
|
|
50
|
+
const BROWSER_USE_VERSION = '0.13.11'
|
|
51
|
+
const BSK_VERSION = '0.3.3'
|
|
52
|
+
const BSK_RELEASES = 'https://github.com/Tencent/BrowserSkill/releases/download'
|
|
53
|
+
|
|
54
|
+
export const BROWSER_ENGINES: Record<BrowserEngineId, BrowserEngineSpec> = {
|
|
55
|
+
'agent-browser': {
|
|
56
|
+
id: 'agent-browser',
|
|
57
|
+
install: { kind: 'image' },
|
|
58
|
+
env: (cdpUrl) => ({ AGENT_BROWSER_CDP: cdpUrl }),
|
|
59
|
+
},
|
|
60
|
+
omowright: {
|
|
61
|
+
id: 'omowright',
|
|
62
|
+
install: { kind: 'bun-global', spec: `github:code-yeongyu/omowright#${OMOWRIGHT_COMMIT}` },
|
|
63
|
+
env: (cdpUrl) => ({ OMOWRIGHT_CDP_URL: cdpUrl }),
|
|
64
|
+
},
|
|
65
|
+
'browser-use': {
|
|
66
|
+
id: 'browser-use',
|
|
67
|
+
install: { kind: 'uv-tool', package: 'browser-use', version: BROWSER_USE_VERSION, python: '3.12' },
|
|
68
|
+
env: (cdpUrl) => ({ BU_CDP_WS: cdpUrl, ANONYMIZED_TELEMETRY: 'false' }),
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export const BROWSER_EXTENSIONS: Record<BrowserExtensionId, BrowserExtensionSpec> = {
|
|
73
|
+
browserskill: {
|
|
74
|
+
id: 'browserskill',
|
|
75
|
+
version: BSK_VERSION,
|
|
76
|
+
zip: {
|
|
77
|
+
url: `${BSK_RELEASES}/ext-v${BSK_VERSION}/browser-skill-extension-v${BSK_VERSION}-chrome.zip`,
|
|
78
|
+
sha256: '10ef76e68f352893fa22dd4cce2f1b96cb90ed957b815d656e13180d07d3c6ea',
|
|
79
|
+
},
|
|
80
|
+
cli: {
|
|
81
|
+
name: 'bsk',
|
|
82
|
+
urlByArch: {
|
|
83
|
+
amd64: {
|
|
84
|
+
url: `${BSK_RELEASES}/cli-v${BSK_VERSION}/bsk-v${BSK_VERSION}-x86_64-unknown-linux-musl.tar.gz`,
|
|
85
|
+
sha256: '141b73489bec99d768cf18042919f0e054c9f614e6ecdfd754028d2b606e9106',
|
|
86
|
+
},
|
|
87
|
+
arm64: {
|
|
88
|
+
url: `${BSK_RELEASES}/cli-v${BSK_VERSION}/bsk-v${BSK_VERSION}-aarch64-unknown-linux-musl.tar.gz`,
|
|
89
|
+
sha256: '747e4c416da46650c7d8127a47dd8f08e813e0f69366c4db1af226d0b63a575d',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export type BrowserConfig = {
|
|
97
|
+
engines: readonly BrowserEngineId[]
|
|
98
|
+
extensions: readonly BrowserExtensionId[]
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// The managed Chrome exists only for engines that attach over CDP or for
|
|
102
|
+
// extensions. The default `["agent-browser"]` keeps today's per-session
|
|
103
|
+
// agent-browser browser, so existing agents see no change.
|
|
104
|
+
export function needsManagedBrowser(config: BrowserConfig): boolean {
|
|
105
|
+
return config.extensions.length > 0 || config.engines.some((id) => id !== 'agent-browser')
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function extensionDir(id: BrowserExtensionId): string {
|
|
109
|
+
return `${BROWSER_ROOT}/extensions/${id}`
|
|
110
|
+
}
|