typeclaw 0.49.0 → 0.51.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/bash-sandbox-env.d.ts +15 -0
- package/dist/types/agent/bash-sandbox-proc.d.ts +8 -0
- package/dist/types/agent/bash-sandbox.d.ts +94 -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 +8 -0
- package/dist/types/agent/index.d.ts +151 -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/output-allowance.d.ts +4 -0
- package/dist/types/agent/plugin-tools.d.ts +58 -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-composition.d.ts +17 -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 +27 -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 +760 -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 +827 -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 +1458 -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 +145 -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/eval/cell.d.ts +26 -0
- package/dist/types/eval/config.d.ts +19 -0
- package/dist/types/eval/dispatch.d.ts +7 -0
- package/dist/types/eval/kernel.d.ts +28 -0
- package/dist/types/eval/process.d.ts +23 -0
- package/dist/types/eval/protocol.d.ts +34 -0
- package/dist/types/eval/sandbox.d.ts +10 -0
- package/dist/types/eval/tool.d.ts +17 -0
- package/dist/types/eval/wire.d.ts +33 -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 +3 -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/require-parallel.ts +5 -32
- package/src/agent/bash-sandbox-env.ts +104 -0
- package/src/agent/bash-sandbox-proc.ts +70 -0
- package/src/agent/bash-sandbox.ts +225 -0
- package/src/agent/compaction.ts +22 -10
- package/src/agent/guard-types.ts +3 -0
- package/src/agent/guards.ts +4 -0
- package/src/agent/idle-compaction.ts +178 -0
- package/src/agent/index.ts +139 -172
- package/src/agent/live-subagents.ts +19 -0
- package/src/agent/multimodal/look-at.ts +22 -9
- package/src/agent/output-allowance.ts +7 -0
- package/src/agent/plugin-tools.ts +39 -377
- package/src/agent/reviewer-bash-policy.ts +41 -1
- package/src/agent/session-origin.ts +28 -11
- package/src/agent/subagent-cache-keepalive.ts +198 -0
- package/src/agent/subagent-completion-reminder.ts +2 -2
- package/src/agent/subagent-session.ts +6 -0
- package/src/agent/subagents.ts +46 -8
- package/src/agent/system-prompt-composition.ts +141 -0
- package/src/agent/system-prompt.ts +5 -5
- package/src/agent/todo/scope.ts +1 -1
- package/src/agent/tool-file-safety.ts +6 -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-read.ts +57 -10
- package/src/agent/tools/channel-reply.ts +33 -26
- package/src/agent/tools/channel-send.ts +21 -13
- package/src/agent/tools/channel-session-search.ts +35 -0
- package/src/agent/tools/curl-impersonate.ts +11 -4
- package/src/agent/tools/ddg.ts +84 -16
- package/src/agent/tools/spawn-subagent.ts +27 -11
- package/src/agent/tools/stream-snapshot.ts +15 -2
- package/src/agent/tools/subagent-access.ts +11 -4
- package/src/agent/tools-without-local-file-operands.ts +4 -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/fill-secret.ts +307 -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/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/explorer/explorer.ts +1 -1
- package/src/bundled-plugins/github-cli-auth/gh-command.ts +4 -0
- package/src/bundled-plugins/github-cli-auth/gh-review-detect.ts +40 -16
- package/src/bundled-plugins/github-cli-auth/git-auth-diagnostic.ts +95 -0
- package/src/bundled-plugins/github-cli-auth/graphql-auth-nudge.ts +12 -7
- package/src/bundled-plugins/github-cli-auth/index.ts +85 -60
- package/src/bundled-plugins/managed-browser/index.ts +179 -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/memory/dreaming.ts +4 -1
- package/src/bundled-plugins/memory/load-memory.ts +2 -4
- package/src/bundled-plugins/memory/memory-logger.ts +74 -2
- package/src/bundled-plugins/memory/transcript-preload.ts +103 -0
- package/src/bundled-plugins/memory/vector/hybrid.ts +25 -14
- package/src/bundled-plugins/operator/operator.ts +1 -1
- 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/security/index.ts +53 -34
- package/src/bundled-plugins/security/policies/outbound-secret-scan.ts +1 -0
- package/src/bundled-plugins/security/policies/private-surface-read.ts +166 -201
- package/src/channels/adapter-namespace.ts +13 -0
- package/src/channels/adapters/discord-bot-reference.ts +5 -4
- package/src/channels/adapters/discord-bot.ts +98 -5
- package/src/channels/adapters/discord-classify.ts +8 -3
- package/src/channels/adapters/discord.ts +29 -0
- package/src/channels/adapters/github/index.ts +16 -0
- package/src/channels/adapters/github/last-alive.ts +4 -16
- 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 +1 -0
- package/src/channels/adapters/slack-bot-slash-commands.ts +3 -1
- package/src/channels/adapters/slack-bot.ts +299 -67
- package/src/channels/adapters/slack-classify.ts +1 -0
- package/src/channels/catch-up.ts +137 -0
- package/src/channels/continuation-willingness.ts +2 -2
- package/src/channels/continuity-types.ts +1 -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 +5 -1
- package/src/channels/github-review-verdict-coordinator.ts +68 -2
- package/src/channels/github-token-bridge.ts +24 -0
- package/src/channels/last-alive.ts +34 -0
- package/src/channels/manager.ts +8 -1
- package/src/channels/router.ts +515 -243
- 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 +3 -2
- package/src/channels/types.ts +12 -2
- package/src/cli/channel.ts +2 -3
- package/src/cli/hostd.ts +3 -0
- package/src/cli/init.ts +2 -3
- package/src/cli/model.ts +132 -3
- package/src/coding-agent/index.ts +7 -1
- package/src/coding-agent/omo-stream.ts +40 -0
- package/src/coding-agent/runner.ts +30 -8
- package/src/config/config.ts +126 -22
- 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 +69 -4
- package/src/container/start.ts +132 -5
- package/src/doctor/checks.ts +33 -22
- package/src/doctor/index.ts +48 -12
- package/src/doctor/operational-incidents.ts +16 -1
- package/src/doctor/plugin-bridge.ts +14 -1
- package/src/doctor/stage.ts +14 -0
- package/src/doctor/types.ts +6 -0
- package/src/eval/cell.ts +93 -0
- package/src/eval/config.ts +32 -0
- package/src/eval/dispatch.ts +67 -0
- package/src/eval/entry.ts +261 -0
- package/src/eval/kernel.ts +154 -0
- package/src/eval/process.ts +113 -0
- package/src/eval/protocol.ts +26 -0
- package/src/eval/redeclare.ts +174 -0
- package/src/eval/sandbox.ts +114 -0
- package/src/eval/tool.ts +98 -0
- package/src/eval/wire.ts +93 -0
- package/src/hostd/daemon.ts +13 -1
- package/src/init/auto-upgrade.ts +7 -1
- package/src/init/dockerfile.ts +57 -12
- package/src/init/index.ts +4 -3
- 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/operations/classify-tool-outcome.ts +1 -1
- 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 +6 -1
- package/src/plugin/hooks.ts +137 -0
- package/src/plugin/index.ts +6 -0
- package/src/plugin/manager.ts +4 -0
- package/src/plugin/types.ts +60 -0
- package/src/run/bundled-plugins.ts +6 -0
- package/src/run/index.ts +24 -14
- package/src/run/llm-fetch-observer.ts +12 -15
- package/src/sandbox/canonical-secrets.ts +4 -0
- package/src/sandbox/dev-source.ts +26 -0
- package/src/sandbox/env-exposure.ts +20 -0
- package/src/sandbox/hidden-paths.ts +16 -2
- package/src/secrets/storage.ts +13 -0
- package/src/server/index.ts +46 -11
- package/src/skills/typeclaw-channel-github/SKILL.md +8 -8
- package/src/skills/typeclaw-config/SKILL.md +57 -5
- package/src/skills/typeclaw-config/references/dockerfile.md +2 -2
- package/src/skills/typeclaw-github-contributing/SKILL.md +1 -1
- package/src/skills/typeclaw-monorepo/SKILL.md +1 -1
- package/src/skills/typeclaw-permissions/SKILL.md +7 -7
- package/src/skills/typeclaw-troubleshooting/SKILL.md +12 -1
- package/typeclaw.schema.json +488 -5
- 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/agent/tools/ddg.ts
CHANGED
|
@@ -20,6 +20,13 @@ export { _setCurlBinaryForTest } from './curl-impersonate'
|
|
|
20
20
|
|
|
21
21
|
const DDG_LITE_URL = 'https://lite.duckduckgo.com/lite/'
|
|
22
22
|
|
|
23
|
+
// As of 2026-10 DDG-lite answers every desktop Chrome fingerprint (124-146,
|
|
24
|
+
// including the curl_chrome136 default) with a 202 challenge page from IPs
|
|
25
|
+
// where Firefox and Safari fingerprints still get a normal SERP. Try them in
|
|
26
|
+
// order and only treat the request as CAPTCHA'd when every profile is
|
|
27
|
+
// challenged. Both wrappers ship in the pinned curl-impersonate tarball.
|
|
28
|
+
export const DDG_PROFILES = ['curl_firefox147', 'curl_safari184'] as const
|
|
29
|
+
|
|
23
30
|
// Empirically derived: a clean source IP serves DDG-lite at concurrency ~4 but
|
|
24
31
|
// trips a sticky multi-minute CAPTCHA at 5-6 (see keyed-semaphore.ts header).
|
|
25
32
|
// The whole agent egresses from one IP and the scout subagent fans out parallel
|
|
@@ -33,6 +40,41 @@ const searchLimiter = createKeyedSemaphore({ concurrency: DDG_CONCURRENCY })
|
|
|
33
40
|
|
|
34
41
|
const DDG_KEY = 'ddg'
|
|
35
42
|
|
|
43
|
+
// The concurrency cap bounds parallelism, not rate: a subagent fan-out of ~10
|
|
44
|
+
// searches inside 30s still tripped DDG's gate behind a cap of 2 (production
|
|
45
|
+
// incident, 2026-10-27). Spacing every outbound request by a minimum interval
|
|
46
|
+
// turns such a burst into a queue instead of a volley.
|
|
47
|
+
export const DDG_MIN_REQUEST_INTERVAL_MS = 1_500
|
|
48
|
+
|
|
49
|
+
// Once DDG serves a challenge to every profile the source IP is boxed for
|
|
50
|
+
// minutes, and each further request keeps the box alive. Stop sending for a
|
|
51
|
+
// cooldown window: calls inside it fail fast without touching the network.
|
|
52
|
+
export const DDG_CAPTCHA_COOLDOWN_MS = 5 * 60_000
|
|
53
|
+
|
|
54
|
+
type Pacing = {
|
|
55
|
+
intervalMs: number
|
|
56
|
+
cooldownMs: number
|
|
57
|
+
now: () => number
|
|
58
|
+
sleep: (ms: number, signal?: AbortSignal) => Promise<void>
|
|
59
|
+
}
|
|
60
|
+
const DEFAULT_PACING: Pacing = {
|
|
61
|
+
intervalMs: DDG_MIN_REQUEST_INTERVAL_MS,
|
|
62
|
+
cooldownMs: DDG_CAPTCHA_COOLDOWN_MS,
|
|
63
|
+
now: () => Date.now(),
|
|
64
|
+
sleep: abortableSleep,
|
|
65
|
+
}
|
|
66
|
+
let pacing: Pacing = DEFAULT_PACING
|
|
67
|
+
let nextRequestAt = 0
|
|
68
|
+
let cooldownUntil = 0
|
|
69
|
+
|
|
70
|
+
// Test-only seam: swaps the clock/sleep and interval/cooldown, and resets the
|
|
71
|
+
// process-wide pacing state so tests don't leak a cooldown into each other.
|
|
72
|
+
export function _setDdgPacingForTest(override: Partial<Pacing> | null): void {
|
|
73
|
+
pacing = { ...DEFAULT_PACING, ...override }
|
|
74
|
+
nextRequestAt = 0
|
|
75
|
+
cooldownUntil = 0
|
|
76
|
+
}
|
|
77
|
+
|
|
36
78
|
export type DdgResult = {
|
|
37
79
|
title: string
|
|
38
80
|
url: string
|
|
@@ -55,11 +97,16 @@ export async function ddgSearch(query: string, limit: number, signal?: AbortSign
|
|
|
55
97
|
() =>
|
|
56
98
|
withSearchRetry(
|
|
57
99
|
async () => {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
100
|
+
for (const binary of DDG_PROFILES) {
|
|
101
|
+
if (pacing.now() < cooldownUntil) throw new DdgCaptchaError()
|
|
102
|
+
await waitForRequestSlot(signal)
|
|
103
|
+
// A concurrent search may have started the cooldown while this one waited.
|
|
104
|
+
if (pacing.now() < cooldownUntil) throw new DdgCaptchaError()
|
|
105
|
+
const html = await fetchDdgHtml(query, signal, binary)
|
|
106
|
+
if (!isCaptcha(html)) return parseDdgHtml(html).slice(0, limit)
|
|
61
107
|
}
|
|
62
|
-
|
|
108
|
+
cooldownUntil = pacing.now() + pacing.cooldownMs
|
|
109
|
+
throw new DdgCaptchaError()
|
|
63
110
|
},
|
|
64
111
|
{ ...retryOverride, shouldRetry: isTransientSearchError, signal },
|
|
65
112
|
),
|
|
@@ -67,18 +114,38 @@ export async function ddgSearch(query: string, limit: number, signal?: AbortSign
|
|
|
67
114
|
)
|
|
68
115
|
}
|
|
69
116
|
|
|
70
|
-
//
|
|
71
|
-
//
|
|
72
|
-
//
|
|
73
|
-
//
|
|
74
|
-
// `
|
|
75
|
-
//
|
|
76
|
-
//
|
|
77
|
-
// it won't fix itself on a re-run
|
|
117
|
+
// Only a bare connection timeout is retried: an egress timeout is almost
|
|
118
|
+
// always a momentary network blip (the incident that motivated this: an agent's
|
|
119
|
+
// egress timed out for a few minutes, then recovered). Retrying under the
|
|
120
|
+
// bounded `withSearchRetry` backoff turns an otherwise-unbounded model-driven
|
|
121
|
+
// retry loop into at most `attempts` code-level tries. A CAPTCHA is NOT retried:
|
|
122
|
+
// DDG's gate lasts minutes, far beyond the retry backoff, and every retry keeps
|
|
123
|
+
// the box alive — the cooldown above handles it instead. A hard network failure
|
|
124
|
+
// (DNS, refused, TLS) is NOT retried either; it won't fix itself on a re-run.
|
|
78
125
|
export function isTransientSearchError(error: unknown): boolean {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
126
|
+
return error instanceof CurlImpersonateError && isCurlExitTimeout(error)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function abortableSleep(ms: number, signal?: AbortSignal): Promise<void> {
|
|
130
|
+
return new Promise((resolve, reject) => {
|
|
131
|
+
if (signal?.aborted) return reject(signal.reason)
|
|
132
|
+
const onAbort = (): void => {
|
|
133
|
+
clearTimeout(timer)
|
|
134
|
+
reject(signal?.reason)
|
|
135
|
+
}
|
|
136
|
+
const timer = setTimeout(() => {
|
|
137
|
+
signal?.removeEventListener('abort', onAbort)
|
|
138
|
+
resolve()
|
|
139
|
+
}, ms)
|
|
140
|
+
signal?.addEventListener('abort', onAbort, { once: true })
|
|
141
|
+
})
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
async function waitForRequestSlot(signal?: AbortSignal): Promise<void> {
|
|
145
|
+
const now = pacing.now()
|
|
146
|
+
const slot = Math.max(now, nextRequestAt)
|
|
147
|
+
nextRequestAt = slot + pacing.intervalMs
|
|
148
|
+
if (slot > now) await pacing.sleep(slot - now, signal)
|
|
82
149
|
}
|
|
83
150
|
|
|
84
151
|
export class DdgCaptchaError extends Error {
|
|
@@ -88,9 +155,10 @@ export class DdgCaptchaError extends Error {
|
|
|
88
155
|
}
|
|
89
156
|
}
|
|
90
157
|
|
|
91
|
-
export async function fetchDdgHtml(query: string, signal?: AbortSignal): Promise<string> {
|
|
158
|
+
export async function fetchDdgHtml(query: string, signal?: AbortSignal, binary?: string): Promise<string> {
|
|
92
159
|
const response = await curlImpersonate({
|
|
93
160
|
url: DDG_LITE_URL,
|
|
161
|
+
binary,
|
|
94
162
|
method: 'POST',
|
|
95
163
|
formFields: [{ name: 'q', value: query }],
|
|
96
164
|
signal,
|
|
@@ -182,17 +182,6 @@ export function createSpawnSubagentTool(options: CreateSpawnSubagentToolOptions)
|
|
|
182
182
|
)
|
|
183
183
|
}
|
|
184
184
|
const subagentName = params.subagent_type
|
|
185
|
-
const { background, overrideNote } = resolveSpawnMode({
|
|
186
|
-
foreground: params.run_in_foreground,
|
|
187
|
-
fromSubagent: origin?.kind === 'subagent',
|
|
188
|
-
// Deep-profile spawns run for minutes; forcing them background from a
|
|
189
|
-
// top-level session keeps a foreground run from freezing the message
|
|
190
|
-
// loop. Per-spawn override wins over the declared profile.
|
|
191
|
-
isDeepProfile: (params.profile ?? subagent.profile) === 'deep',
|
|
192
|
-
canBackgroundFromSubagent: allowBackgroundFromSubagent === true,
|
|
193
|
-
subagentName,
|
|
194
|
-
})
|
|
195
|
-
|
|
196
185
|
const taskId = generateTaskId()
|
|
197
186
|
const payload: Record<string, unknown> = { requestId: taskId, prompt: params.prompt }
|
|
198
187
|
if (params.description !== undefined) payload.description = params.description
|
|
@@ -213,6 +202,17 @@ export function createSpawnSubagentTool(options: CreateSpawnSubagentToolOptions)
|
|
|
213
202
|
params.review_identity === undefined
|
|
214
203
|
? undefined
|
|
215
204
|
: githubReviewerWorkKey(params.review_identity.repo, params.review_identity.pull_request)
|
|
205
|
+
const { background, overrideNote } = resolveSpawnMode({
|
|
206
|
+
foreground: params.run_in_foreground,
|
|
207
|
+
fromSubagent: origin?.kind === 'subagent',
|
|
208
|
+
// Deep-profile spawns run for minutes; forcing them background from a
|
|
209
|
+
// top-level session keeps a foreground run from freezing the message
|
|
210
|
+
// loop. Judged on the profile the session will actually run, so an
|
|
211
|
+
// override the subagent's schema strips cannot unlock foreground.
|
|
212
|
+
isDeepProfile: effectiveSpawnProfile(subagent, payload) === 'deep',
|
|
213
|
+
canBackgroundFromSubagent: allowBackgroundFromSubagent === true,
|
|
214
|
+
subagentName,
|
|
215
|
+
})
|
|
216
216
|
|
|
217
217
|
const coalesceKey = subagentCoalesceKey({
|
|
218
218
|
parentSessionId,
|
|
@@ -659,6 +659,22 @@ export type SpawnModeResolution = {
|
|
|
659
659
|
overrideNote: string | undefined
|
|
660
660
|
}
|
|
661
661
|
|
|
662
|
+
// The profile the spawned session will actually run. A payload schema may strip
|
|
663
|
+
// a per-spawn `profile` (scout/explorer/browser pin their tier), so read it from
|
|
664
|
+
// the validated payload; an invalid payload fails at invocation, so judge it on
|
|
665
|
+
// the raw override until then.
|
|
666
|
+
export function effectiveSpawnProfile(
|
|
667
|
+
subagent: Pick<Subagent<any>, 'profile' | 'payloadSchema'>,
|
|
668
|
+
payload: Record<string, unknown>,
|
|
669
|
+
): string | undefined {
|
|
670
|
+
const raw = typeof payload.profile === 'string' ? payload.profile : undefined
|
|
671
|
+
if (subagent.payloadSchema === undefined) return raw ?? subagent.profile
|
|
672
|
+
const parsed = subagent.payloadSchema.safeParse(payload)
|
|
673
|
+
if (!parsed.success) return raw ?? subagent.profile
|
|
674
|
+
const kept = (parsed.data as { profile?: unknown } | null | undefined)?.profile
|
|
675
|
+
return typeof kept === 'string' && kept !== '' ? kept : subagent.profile
|
|
676
|
+
}
|
|
677
|
+
|
|
662
678
|
// Resolve foreground vs background for a spawn, with the runtime free to
|
|
663
679
|
// override the caller's request and report why. Two axes decide it: whether the
|
|
664
680
|
// caller is a top-level session (its turn services the live message loop) or a
|
|
@@ -108,7 +108,7 @@ function formatResult(
|
|
|
108
108
|
id: e.id,
|
|
109
109
|
ts: e.ts,
|
|
110
110
|
target: e.target,
|
|
111
|
-
payload: e.payload,
|
|
111
|
+
payload: snapshotPayload(e.payload),
|
|
112
112
|
...(e.replyTo !== undefined ? { replyTo: e.replyTo } : {}),
|
|
113
113
|
...(e.meta !== undefined ? { meta: e.meta } : {}),
|
|
114
114
|
})),
|
|
@@ -123,7 +123,7 @@ function formatResult(
|
|
|
123
123
|
|
|
124
124
|
const header = `${events.length} stream event(s) matching ${filterDesc} (oldest → newest):`
|
|
125
125
|
const lines = [header, '']
|
|
126
|
-
for (const event of events) {
|
|
126
|
+
for (const event of details.events) {
|
|
127
127
|
lines.push(formatEventLine(event))
|
|
128
128
|
}
|
|
129
129
|
return {
|
|
@@ -132,6 +132,19 @@ function formatResult(
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
// Stream payloads are runtime objects: a handler cron job contains a function.
|
|
136
|
+
// Tool details enter the transcript, which pi structuredClones before the next
|
|
137
|
+
// provider request. Project only this diagnostic view to its persisted JSON
|
|
138
|
+
// shape; never strip callbacks from the broker's live dispatch payload.
|
|
139
|
+
function snapshotPayload(payload: unknown): unknown {
|
|
140
|
+
try {
|
|
141
|
+
const json = JSON.stringify(payload)
|
|
142
|
+
return json === undefined ? '<unserializable>' : JSON.parse(json)
|
|
143
|
+
} catch {
|
|
144
|
+
return '<unserializable>'
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
135
148
|
function describeFilter(params: {
|
|
136
149
|
target_kind?: TargetKind
|
|
137
150
|
target_id?: string
|
|
@@ -16,7 +16,8 @@ export type AuthorizeLiveSubagentAccessArgs = {
|
|
|
16
16
|
// The caller's own session id. When the caller is itself a subagent, access
|
|
17
17
|
// is scoped to subagents IT spawned (live.parentSessionId === callerSessionId)
|
|
18
18
|
// so a nested subagent cannot read or cancel siblings or parent-branch runs.
|
|
19
|
-
//
|
|
19
|
+
// For main-session callers it identifies the spawning session: that session
|
|
20
|
+
// may always access its own runs; other sessions' runs stay role-capped.
|
|
20
21
|
callerSessionId?: string
|
|
21
22
|
}
|
|
22
23
|
|
|
@@ -25,8 +26,9 @@ export type AuthorizeLiveSubagentAccessArgs = {
|
|
|
25
26
|
// modes, both requiring the base permission first:
|
|
26
27
|
// - SUBAGENT caller: scoped to runs it spawned (live.parentSessionId ===
|
|
27
28
|
// callerSessionId). Ownership is the authorization; the role cap is skipped.
|
|
28
|
-
// - MAIN-SESSION caller:
|
|
29
|
-
//
|
|
29
|
+
// - MAIN-SESSION caller: the spawning session may always access its own run;
|
|
30
|
+
// any other session is capped to the requester's role — it must resolve to
|
|
31
|
+
// a role at least as high as the role that spawned the subagent.
|
|
30
32
|
//
|
|
31
33
|
// The ordering closes an existence oracle: the task-independent base-permission
|
|
32
34
|
// check runs BEFORE any registry lookup, and for non-owner callers an absent
|
|
@@ -84,7 +86,12 @@ export function authorizeLiveSubagentAccess(args: AuthorizeLiveSubagentAccessArg
|
|
|
84
86
|
if (live === undefined) {
|
|
85
87
|
return { ok: false, message: accessAll ? `Unknown task_id: ${taskId}.` : opaqueDenial }
|
|
86
88
|
}
|
|
87
|
-
|
|
89
|
+
// The session that spawned the run may always read/cancel it. In a shared
|
|
90
|
+
// channel session the origin follows the latest speaker, so a lower-role
|
|
91
|
+
// message (or the completion wake that follows it) would otherwise lock the
|
|
92
|
+
// agent out of its own subagent's result. The cap still stops a lower-role
|
|
93
|
+
// session from reaching a run spawned by a different session.
|
|
94
|
+
if (accessAll || (callerSessionId !== undefined && live.parentSessionId === callerSessionId)) {
|
|
88
95
|
return { ok: true, live }
|
|
89
96
|
}
|
|
90
97
|
|
|
@@ -14,8 +14,12 @@
|
|
|
14
14
|
// can both read it without a circular-init TDZ. Add a tool here ONLY after
|
|
15
15
|
// confirming it dereferences no argument as a local path.
|
|
16
16
|
export const TOOLS_WITHOUT_LOCAL_FILE_OPERANDS: ReadonlySet<string> = new Set([
|
|
17
|
+
// Source code is not a host-side path operand. Raw I/O is confined by the
|
|
18
|
+
// shared bash sandbox; tool.* operands enter their own wrapped definitions.
|
|
19
|
+
'eval',
|
|
17
20
|
'channel_read',
|
|
18
21
|
'channel_history',
|
|
22
|
+
'channel_handoff',
|
|
19
23
|
'channel_edit',
|
|
20
24
|
'channel_react',
|
|
21
25
|
'channel_fetch_attachment',
|
|
@@ -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
|
+
}
|