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
|
@@ -5,6 +5,7 @@ import { join } from 'node:path'
|
|
|
5
5
|
import { z } from 'zod'
|
|
6
6
|
|
|
7
7
|
import type { SessionOrigin } from '@/agent/session-origin'
|
|
8
|
+
import { adapterNamespace } from '@/channels/adapter-namespace'
|
|
8
9
|
import { getConfig, resolveModel } from '@/config'
|
|
9
10
|
import { KNOWN_PROVIDERS } from '@/config/providers'
|
|
10
11
|
import type { PermissionService } from '@/permissions'
|
|
@@ -474,7 +475,12 @@ function principal(origin: SessionOrigin | undefined): string {
|
|
|
474
475
|
for (let depth = 0; root?.kind === 'subagent' && depth < 8; depth++) root = root.spawnedByOrigin
|
|
475
476
|
if (root?.kind === 'tui') return JSON.stringify(['tui', root.sessionId])
|
|
476
477
|
if (root?.kind === 'channel' && root.lastInboundAuthorId) {
|
|
477
|
-
|
|
478
|
+
const fields = [root.adapter, root.workspace, root.chat, root.thread, root.lastInboundAuthorId]
|
|
479
|
+
const authorNamespace = adapterNamespace(root.lastInboundAuthorAdapter ?? root.adapter)
|
|
480
|
+
// Legacy keys implicitly belong to the target platform. Preserve native
|
|
481
|
+
// and shared-account owners, but never let a foreign ID match those keys.
|
|
482
|
+
if (authorNamespace !== adapterNamespace(root.adapter)) fields.push(authorNamespace)
|
|
483
|
+
return JSON.stringify(fields)
|
|
478
484
|
}
|
|
479
485
|
throw new Error('Coding delegation requires an attributable interactive caller.')
|
|
480
486
|
}
|
|
@@ -14,6 +14,46 @@ const sessionSchema = z.object({
|
|
|
14
14
|
cwd: z.string(),
|
|
15
15
|
})
|
|
16
16
|
|
|
17
|
+
// OmO print mode emits one `message_update` record per streamed token, each
|
|
18
|
+
// repeating a full usage object (~100x amplification over the model output).
|
|
19
|
+
// The parser ignores them, so they are dropped before the output cap and the
|
|
20
|
+
// JSONL artifact; a single long tool call otherwise trips the cap mid-task.
|
|
21
|
+
export class OmoDeltaFilter {
|
|
22
|
+
private pending = ''
|
|
23
|
+
|
|
24
|
+
push(text: string): string {
|
|
25
|
+
this.pending += text
|
|
26
|
+
const end = this.pending.lastIndexOf('\n')
|
|
27
|
+
if (end === -1) {
|
|
28
|
+
if (this.pending.length > 4 * 1024 * 1024) throw new Error('OmO event exceeds the 4 MiB event limit.')
|
|
29
|
+
return ''
|
|
30
|
+
}
|
|
31
|
+
const lines = this.pending.slice(0, end + 1)
|
|
32
|
+
this.pending = this.pending.slice(end + 1)
|
|
33
|
+
return lines
|
|
34
|
+
.split('\n')
|
|
35
|
+
.slice(0, -1)
|
|
36
|
+
.filter((line) => !isMessageUpdate(line))
|
|
37
|
+
.map((line) => `${line}\n`)
|
|
38
|
+
.join('')
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
flush(): string {
|
|
42
|
+
const rest = this.pending
|
|
43
|
+
this.pending = ''
|
|
44
|
+
return rest
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function isMessageUpdate(line: string): boolean {
|
|
49
|
+
if (!line.startsWith('{"type":"message_update"')) return false
|
|
50
|
+
try {
|
|
51
|
+
return (JSON.parse(line) as { type?: unknown }).type === 'message_update'
|
|
52
|
+
} catch {
|
|
53
|
+
return false
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
17
57
|
export class OmoStreamParser {
|
|
18
58
|
sessionId: string | undefined
|
|
19
59
|
finalMessage = ''
|
|
@@ -12,9 +12,11 @@ import { ClaudeStreamParser, claudeArguments, claudeEnvironment, type CodingMode
|
|
|
12
12
|
import { CodexStreamParser, codexArguments, codexConfig, codexEnvironment } from './codex'
|
|
13
13
|
import { omoArguments, omoConfiguration, omoEnvironment, type OmoModel } from './omo'
|
|
14
14
|
import { hasOmoSession, prepareOmoDirectories } from './omo-state'
|
|
15
|
-
import { OmoStreamParser } from './omo-stream'
|
|
15
|
+
import { OmoDeltaFilter, OmoStreamParser } from './omo-stream'
|
|
16
16
|
import type { CodingWorkspace } from './worktree'
|
|
17
17
|
|
|
18
|
+
const OUTPUT_LIMIT_BYTES = 16 * 1024 * 1024
|
|
19
|
+
|
|
18
20
|
export type CodingRunResult = {
|
|
19
21
|
readonly state: 'completed' | 'incomplete' | 'failed' | 'cancelled'
|
|
20
22
|
readonly finalMessage: string
|
|
@@ -70,6 +72,8 @@ export async function runCodingAgent(
|
|
|
70
72
|
let exitCode: number | null = null
|
|
71
73
|
let failure = false
|
|
72
74
|
let missingSession = false
|
|
75
|
+
let outputCapExceeded = false
|
|
76
|
+
let deadlineExpired = false
|
|
73
77
|
const oom = readOomEvents()
|
|
74
78
|
try {
|
|
75
79
|
signal.throwIfAborted()
|
|
@@ -160,16 +164,20 @@ export async function runCodingAgent(
|
|
|
160
164
|
const consume = async (stream: NodeJS.ReadableStream, output: boolean): Promise<void> => {
|
|
161
165
|
const decoder = new TextDecoder()
|
|
162
166
|
const scrubber = new SecretScrubber([broker?.capability ?? ''])
|
|
167
|
+
const deltas = output && engine === 'omo' ? new OmoDeltaFilter() : undefined
|
|
163
168
|
let total = 0
|
|
164
169
|
for await (const chunk of stream) {
|
|
170
|
+
if (outputCapExceeded) continue
|
|
165
171
|
const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk))
|
|
166
|
-
|
|
167
|
-
|
|
172
|
+
const scrubbed = scrubber.push(decoder.decode(bytes, { stream: true }))
|
|
173
|
+
const text = deltas ? deltas.push(scrubbed) : scrubbed
|
|
174
|
+
total += Buffer.byteLength(text)
|
|
175
|
+
if (total > OUTPUT_LIMIT_BYTES) {
|
|
176
|
+
outputCapExceeded = true
|
|
168
177
|
failure = true
|
|
169
178
|
kill()
|
|
170
179
|
continue
|
|
171
180
|
}
|
|
172
|
-
const text = scrubber.push(decoder.decode(bytes, { stream: true }))
|
|
173
181
|
if (output) {
|
|
174
182
|
stdout += text
|
|
175
183
|
try {
|
|
@@ -180,7 +188,15 @@ export async function runCodingAgent(
|
|
|
180
188
|
}
|
|
181
189
|
} else stderr += text
|
|
182
190
|
}
|
|
183
|
-
const
|
|
191
|
+
const flushed = scrubber.push(decoder.decode(), true)
|
|
192
|
+
const final = deltas ? deltas.push(flushed) + deltas.flush() : flushed
|
|
193
|
+
if (outputCapExceeded) return
|
|
194
|
+
total += Buffer.byteLength(final)
|
|
195
|
+
if (total > OUTPUT_LIMIT_BYTES) {
|
|
196
|
+
outputCapExceeded = true
|
|
197
|
+
failure = true
|
|
198
|
+
return
|
|
199
|
+
}
|
|
184
200
|
if (output) {
|
|
185
201
|
stdout += final
|
|
186
202
|
stdoutTail = final
|
|
@@ -222,6 +238,9 @@ export async function runCodingAgent(
|
|
|
222
238
|
} catch {
|
|
223
239
|
failure = true
|
|
224
240
|
} finally {
|
|
241
|
+
// The broker can reject an expired capability before the event loop
|
|
242
|
+
// delivers our timeout callback. The deadline, not callback order, wins.
|
|
243
|
+
deadlineExpired = Date.now() >= deadline
|
|
225
244
|
clearTimeout(timer)
|
|
226
245
|
await broker?.close()
|
|
227
246
|
await cleanupPrepared?.()
|
|
@@ -231,6 +250,7 @@ export async function runCodingAgent(
|
|
|
231
250
|
await options.writeArtifact(join(options.workspace.taskRoot, 'output', `${invocation}.stderr`), stderr)
|
|
232
251
|
const timedOut =
|
|
233
252
|
timeout.signal.aborted ||
|
|
253
|
+
deadlineExpired ||
|
|
234
254
|
(options.signal?.reason instanceof DOMException && options.signal.reason.name === 'TimeoutError')
|
|
235
255
|
const state = timedOut
|
|
236
256
|
? 'incomplete'
|
|
@@ -256,8 +276,10 @@ export async function runCodingAgent(
|
|
|
256
276
|
? 'The recorded OmO session is missing or unsafe. Restore its task-local session file before resuming; partial work is preserved.'
|
|
257
277
|
: timedOut
|
|
258
278
|
? 'Invocation timed out; partial work is preserved.'
|
|
259
|
-
:
|
|
260
|
-
? 'The coding CLI
|
|
261
|
-
:
|
|
279
|
+
: outputCapExceeded
|
|
280
|
+
? 'The coding CLI exceeded the 16 MiB output limit and was stopped; partial work is preserved. Resume with a narrower prompt.'
|
|
281
|
+
: parser.permissionDenied
|
|
282
|
+
? 'The coding CLI reported a permission denial; review the task and continue explicitly.'
|
|
283
|
+
: 'Invocation did not complete. Inspect the saved output and partial diff; verify the installed CLI and sandbox.'),
|
|
262
284
|
}
|
|
263
285
|
}
|
package/src/config/config.ts
CHANGED
|
@@ -6,8 +6,11 @@ import type { KnownApi, Model } from '@earendil-works/pi-ai'
|
|
|
6
6
|
import { getBuiltinModel } from '@earendil-works/pi-ai/providers/all'
|
|
7
7
|
import { z } from 'zod'
|
|
8
8
|
|
|
9
|
+
import { BROWSER_ENGINE_IDS, BROWSER_EXTENSION_IDS } from '@/browser/registry'
|
|
9
10
|
import { channelsSchema, SEEDED_GITHUB_EVENT_ALLOWLISTS } from '@/channels/schema'
|
|
11
|
+
import { evalConfigSchema } from '@/eval/config'
|
|
10
12
|
import { commitSystemFileSync } from '@/git/system-commit'
|
|
13
|
+
import { parseMatchRule } from '@/permissions/match-rule'
|
|
11
14
|
import { rolesConfigSchema } from '@/permissions/schema'
|
|
12
15
|
import { secretFieldSchema } from '@/secrets/resolve'
|
|
13
16
|
|
|
@@ -197,7 +200,7 @@ const dockerfileObjectSchema = z.object({
|
|
|
197
200
|
tmux: dockerfileFeatureSchema.default(true),
|
|
198
201
|
// `fonts-noto-cjk` is an ~89MB metapackage that makes Chromium render
|
|
199
202
|
// Korean/Japanese/Chinese glyphs correctly in screenshots, `page.pdf()`,
|
|
200
|
-
// and any other raster output
|
|
203
|
+
// and any other raster output a browser engine produces. Without
|
|
201
204
|
// it CJK text renders as silent tofu boxes (□□□) — a confusing failure an
|
|
202
205
|
// agent cannot self-diagnose from a screenshot it took itself.
|
|
203
206
|
//
|
|
@@ -220,7 +223,7 @@ const dockerfileObjectSchema = z.object({
|
|
|
220
223
|
cloudflared: z.boolean().default(false),
|
|
221
224
|
// Install xvfb so the entrypoint shim can spawn an Xvfb virtual X
|
|
222
225
|
// server and export DISPLAY, giving headed Chrome (agent-browser
|
|
223
|
-
// --headed, Playwright headful) a real X11 display to connect to.
|
|
226
|
+
// --headed, the managed shared browser, Playwright headful) a real X11 display to connect to.
|
|
224
227
|
// Default `true` because modern bot detection (Akamai/Cloudflare Bot
|
|
225
228
|
// Manager) fingerprints `--headless` and `--headless=new` regardless
|
|
226
229
|
// of UA spoof, and headed-via-Xvfb is the cheapest path to a passing
|
|
@@ -252,6 +255,22 @@ const dockerfileObjectSchema = z.object({
|
|
|
252
255
|
|
|
253
256
|
export const dockerfileSchema = dockerfileObjectSchema.default(() => dockerfileObjectSchema.parse({}))
|
|
254
257
|
|
|
258
|
+
// Which browser drivers the agent gets and which extensions load into the
|
|
259
|
+
// TypeClaw-managed Chrome. Restart-required: engines and extensions install
|
|
260
|
+
// image layers and the managed browser is spawned at boot.
|
|
261
|
+
const browserObjectSchema = z.object({
|
|
262
|
+
engines: z
|
|
263
|
+
.array(z.enum(BROWSER_ENGINE_IDS))
|
|
264
|
+
.default(['agent-browser'])
|
|
265
|
+
.refine((ids) => new Set(ids).size === ids.length, { message: 'browser.engines must not repeat an engine' }),
|
|
266
|
+
extensions: z
|
|
267
|
+
.array(z.enum(BROWSER_EXTENSION_IDS))
|
|
268
|
+
.default([])
|
|
269
|
+
.refine((ids) => new Set(ids).size === ids.length, { message: 'browser.extensions must not repeat an extension' }),
|
|
270
|
+
})
|
|
271
|
+
|
|
272
|
+
export const browserSchema = browserObjectSchema.default(() => browserObjectSchema.parse({}))
|
|
273
|
+
|
|
255
274
|
export type DockerfileConfig = z.infer<typeof dockerfileSchema>
|
|
256
275
|
export type DockerfileFeatureToggle = z.infer<typeof dockerfileFeatureSchema>
|
|
257
276
|
|
|
@@ -291,6 +310,17 @@ export const gitSchema = z
|
|
|
291
310
|
|
|
292
311
|
export type GitConfig = z.infer<typeof gitSchema>
|
|
293
312
|
|
|
313
|
+
// Off by default: the host operator's `gh` login is the operator's identity, not
|
|
314
|
+
// the agent's. Copying it unconditionally handed every agent on a shared host the
|
|
315
|
+
// operator's personal GitHub token, so an agent only receives it on explicit opt-in.
|
|
316
|
+
const githubCliObjectSchema = z.object({
|
|
317
|
+
importHostAuth: z.boolean().default(false),
|
|
318
|
+
})
|
|
319
|
+
|
|
320
|
+
export const githubCliSchema = githubCliObjectSchema.default(() => githubCliObjectSchema.parse({}))
|
|
321
|
+
|
|
322
|
+
export type GithubCliConfig = z.infer<typeof githubCliSchema>
|
|
323
|
+
|
|
294
324
|
export const DEFAULT_LOG_RETENTION_DAYS = 14
|
|
295
325
|
export const MAX_LOG_RETENTION_DAYS = 3650
|
|
296
326
|
|
|
@@ -718,17 +748,19 @@ const richProfileSchema = z
|
|
|
718
748
|
}
|
|
719
749
|
})
|
|
720
750
|
|
|
721
|
-
const
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
751
|
+
const profileEntryInputSchema = z.union([singleModelRef, modelChainInputSchema, richProfileSchema])
|
|
752
|
+
const profileEntrySchema: z.ZodType<
|
|
753
|
+
ProfileEntry,
|
|
754
|
+
z.input<typeof profileEntryInputSchema>
|
|
755
|
+
> = profileEntryInputSchema.transform((value): ProfileEntry => {
|
|
756
|
+
if (typeof value === 'string' || Array.isArray(value)) {
|
|
757
|
+
const refs = (Array.isArray(value) ? value : [value]).map((ref) => asModelRef(ref))
|
|
758
|
+
return { refs }
|
|
759
|
+
}
|
|
760
|
+
const refsInput = value.models ?? value.model!
|
|
761
|
+
const refs = (Array.isArray(refsInput) ? refsInput : [refsInput]).map((ref) => asModelRef(ref))
|
|
762
|
+
return value.thinkingLevel === undefined ? { refs } : { refs, thinkingLevel: value.thinkingLevel }
|
|
763
|
+
})
|
|
732
764
|
|
|
733
765
|
// Built-in per-profile `thinkingLevel` defaults, materialized at parse time so
|
|
734
766
|
// resolved config / `typeclaw model list` / prompt dumps show the effective level
|
|
@@ -747,17 +779,60 @@ export const modelsSchema = z
|
|
|
747
779
|
.record(z.string().min(1), profileEntrySchema)
|
|
748
780
|
.refine((m) => 'default' in m, { message: 'models.default is required' })
|
|
749
781
|
// Fill only when unset, so an explicit level (including `off`) always wins.
|
|
750
|
-
.transform((models): Models =>
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
}
|
|
782
|
+
.transform((models): Models => withProfileThinkingDefaults(models) as Models)
|
|
783
|
+
|
|
784
|
+
function withProfileThinkingDefaults(models: Record<string, ProfileEntry>): Record<string, ProfileEntry> {
|
|
785
|
+
let next: Record<string, ProfileEntry> | undefined
|
|
786
|
+
for (const [profile, thinkingLevel] of Object.entries(PROFILE_THINKING_LEVEL_DEFAULTS)) {
|
|
787
|
+
const entry = models[profile]
|
|
788
|
+
if (entry !== undefined && entry.thinkingLevel === undefined) {
|
|
789
|
+
next ??= { ...models }
|
|
790
|
+
next[profile] = { ...entry, thinkingLevel }
|
|
758
791
|
}
|
|
759
|
-
|
|
792
|
+
}
|
|
793
|
+
return next ?? models
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
// Why `rule` can't scope a `modelOverrides` entry, or undefined when it can.
|
|
797
|
+
// Rules use the roles match-rule DSL, limited to channel scopes: `author:` is
|
|
798
|
+
// rejected because a session keeps one model for every author of a shared chat.
|
|
799
|
+
export function modelOverrideRuleError(rule: string): string | undefined {
|
|
800
|
+
const parsed = parseMatchRule(rule)
|
|
801
|
+
if (!parsed.ok) return parsed.error
|
|
802
|
+
if (parsed.value.kind === 'wildcard') return undefined
|
|
803
|
+
if (parsed.value.kind !== 'channel') {
|
|
804
|
+
return 'only channel rules (e.g. `slack:*`, `slack:T0123/C0123`, `*`) are allowed'
|
|
805
|
+
}
|
|
806
|
+
if (parsed.value.author !== undefined) return '`author:` is not supported; a session keeps one model for every author'
|
|
807
|
+
return undefined
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
// `modelOverrides` layers partial `models` blocks over the global one for the
|
|
811
|
+
// chats each entry's `match` covers, mirroring `roles.<name> = { match, ... }`.
|
|
812
|
+
// Per profile, the most specific matching rule wins (see `effectiveModels`);
|
|
813
|
+
// profiles an entry doesn't define fall through to `models`.
|
|
814
|
+
const modelOverrideSchema = z
|
|
815
|
+
.object({
|
|
816
|
+
match: z
|
|
817
|
+
.array(z.string())
|
|
818
|
+
.min(1, { message: 'match must list at least one rule (use "*" for every channel)' })
|
|
819
|
+
.superRefine((rules, ctx) => {
|
|
820
|
+
rules.forEach((rule, index) => {
|
|
821
|
+
const error = modelOverrideRuleError(rule)
|
|
822
|
+
if (error !== undefined)
|
|
823
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: [index], message: `"${rule}": ${error}` })
|
|
824
|
+
})
|
|
825
|
+
}),
|
|
826
|
+
models: z
|
|
827
|
+
.record(z.string().min(1), profileEntrySchema)
|
|
828
|
+
.refine((m) => Object.keys(m).length > 0, { message: 'models must define at least one profile' })
|
|
829
|
+
.transform(withProfileThinkingDefaults),
|
|
760
830
|
})
|
|
831
|
+
.strict()
|
|
832
|
+
|
|
833
|
+
export type ModelOverride = z.infer<typeof modelOverrideSchema>
|
|
834
|
+
|
|
835
|
+
export const modelOverridesSchema = z.record(z.string().min(1), modelOverrideSchema).default({})
|
|
761
836
|
|
|
762
837
|
// A model profile after normalisation: its fallback chain (always non-empty)
|
|
763
838
|
// plus an optional reasoning effort. `thinkingLevel` resolution is layered at
|
|
@@ -786,10 +861,15 @@ export const configSchema = z
|
|
|
786
861
|
default: { refs: [asModelRef(DEFAULT_MODEL_REF)] },
|
|
787
862
|
})) as unknown as z.ZodType<Models>,
|
|
788
863
|
customModels: customModelsSchema,
|
|
864
|
+
modelOverrides: modelOverridesSchema,
|
|
789
865
|
// Defaults to `[]` so the field can be omitted from `typeclaw.json` (no
|
|
790
866
|
// host paths exposed) without failing the whole config load. `typeclaw
|
|
791
867
|
// init` omits this field so users don't see noise for the empty case.
|
|
792
868
|
mounts: z.array(mountSchema).default([]),
|
|
869
|
+
// Read-only bind mounts of the host's user-installed font folders under
|
|
870
|
+
// the container's `/usr/share/fonts`, so fontconfig (and Chromium-rendered
|
|
871
|
+
// PDFs) picks them up with no setup. Off by default.
|
|
872
|
+
hostFonts: z.boolean().default(false),
|
|
793
873
|
mcpServers: mcpServersArraySchema,
|
|
794
874
|
plugins: z.array(z.string().min(1)).default([]),
|
|
795
875
|
// Additional names the agent answers to in channel engagement, on top
|
|
@@ -805,8 +885,11 @@ export const configSchema = z
|
|
|
805
885
|
portForward: portForwardSchema,
|
|
806
886
|
network: networkSchema,
|
|
807
887
|
sandbox: sandboxSchema,
|
|
888
|
+
eval: evalConfigSchema,
|
|
808
889
|
docker: dockerSchema,
|
|
890
|
+
browser: browserSchema,
|
|
809
891
|
git: gitSchema,
|
|
892
|
+
githubCli: githubCliSchema,
|
|
810
893
|
logs: logsSchema,
|
|
811
894
|
roles: rolesConfigSchema.optional(),
|
|
812
895
|
tunnels: tunnelsArraySchema,
|
|
@@ -818,6 +901,17 @@ export const configSchema = z
|
|
|
818
901
|
// block is omitted entirely. Read fresh per session via `getConfig()`, so
|
|
819
902
|
// it applies on reload without a restart.
|
|
820
903
|
branding: z.boolean().default(true),
|
|
904
|
+
// Auto-compaction budget. `maxTriggerTokens` sets the agent's own ceiling
|
|
905
|
+
// on the compaction trigger, so each agent can trade per-turn re-read cost
|
|
906
|
+
// against working room for its workload; omitted, the 200K default in
|
|
907
|
+
// src/agent/compaction.ts applies. The 80% window-relative trigger still
|
|
908
|
+
// applies. The floor is 3x the 20K recent window that compaction keeps, so
|
|
909
|
+
// a compaction cannot immediately retrigger. Read per session, so a reload
|
|
910
|
+
// applies to sessions created afterwards.
|
|
911
|
+
compaction: z
|
|
912
|
+
.object({ maxTriggerTokens: z.number().int().min(60_000).optional() })
|
|
913
|
+
.strict()
|
|
914
|
+
.default({}),
|
|
821
915
|
})
|
|
822
916
|
.catchall(z.unknown())
|
|
823
917
|
|
|
@@ -1069,9 +1163,11 @@ export type FieldEffect = 'applied' | 'restart-required' | 'ignored'
|
|
|
1069
1163
|
export const FIELD_EFFECTS: Record<string, FieldEffect> = {
|
|
1070
1164
|
$schema: 'ignored',
|
|
1071
1165
|
models: 'applied',
|
|
1166
|
+
modelOverrides: 'applied',
|
|
1072
1167
|
customModels: 'applied',
|
|
1073
1168
|
port: 'restart-required',
|
|
1074
1169
|
mounts: 'restart-required',
|
|
1170
|
+
hostFonts: 'restart-required',
|
|
1075
1171
|
mcpServers: 'restart-required',
|
|
1076
1172
|
plugins: 'restart-required',
|
|
1077
1173
|
alias: 'applied',
|
|
@@ -1081,9 +1177,12 @@ export const FIELD_EFFECTS: Record<string, FieldEffect> = {
|
|
|
1081
1177
|
portForward: 'restart-required',
|
|
1082
1178
|
network: 'restart-required',
|
|
1083
1179
|
sandbox: 'restart-required',
|
|
1180
|
+
eval: 'restart-required',
|
|
1084
1181
|
tunnels: 'restart-required',
|
|
1085
1182
|
'docker.file': 'restart-required', // Includes omoCli; installation changes rebuild the image.
|
|
1183
|
+
browser: 'restart-required',
|
|
1086
1184
|
'git.ignore': 'restart-required',
|
|
1185
|
+
githubCli: 'restart-required',
|
|
1087
1186
|
logs: 'ignored',
|
|
1088
1187
|
// Split: `match` lists are reload-safe (typeclaw role claim, hand-edits
|
|
1089
1188
|
// adding/removing match rules apply without a container restart);
|
|
@@ -1096,6 +1195,7 @@ export const FIELD_EFFECTS: Record<string, FieldEffect> = {
|
|
|
1096
1195
|
'roles.match': 'applied',
|
|
1097
1196
|
'roles.permissions': 'restart-required',
|
|
1098
1197
|
branding: 'applied',
|
|
1198
|
+
compaction: 'applied',
|
|
1099
1199
|
}
|
|
1100
1200
|
|
|
1101
1201
|
// Stable JSON for value comparison. Fields are small JSON-shaped objects, so
|
|
@@ -1166,10 +1266,13 @@ export function extractPluginConfigs(raw: unknown): Record<string, unknown> {
|
|
|
1166
1266
|
if (typeof raw !== 'object' || raw === null) return {}
|
|
1167
1267
|
const known = new Set([
|
|
1168
1268
|
'$schema',
|
|
1269
|
+
'browser',
|
|
1169
1270
|
'port',
|
|
1170
1271
|
'models',
|
|
1272
|
+
'modelOverrides',
|
|
1171
1273
|
'customModels',
|
|
1172
1274
|
'mounts',
|
|
1275
|
+
'hostFonts',
|
|
1173
1276
|
'plugins',
|
|
1174
1277
|
'alias',
|
|
1175
1278
|
'compose',
|
|
@@ -1179,6 +1282,7 @@ export function extractPluginConfigs(raw: unknown): Record<string, unknown> {
|
|
|
1179
1282
|
'network',
|
|
1180
1283
|
'docker',
|
|
1181
1284
|
'git',
|
|
1285
|
+
'githubCli',
|
|
1182
1286
|
'logs',
|
|
1183
1287
|
'roles',
|
|
1184
1288
|
'permissions',
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { SessionOrigin } from '@/agent/session-origin'
|
|
2
|
+
import { parseMatchRule, type MatchRule } from '@/permissions/match-rule'
|
|
3
|
+
import { matchesOrigin } from '@/permissions/resolve'
|
|
4
|
+
|
|
5
|
+
import type { Config, Models, ProfileEntry } from './config'
|
|
6
|
+
|
|
7
|
+
type ChannelOrigin = Extract<SessionOrigin, { kind: 'channel' }>
|
|
8
|
+
|
|
9
|
+
// The `models` map a session resolves profiles against: the global block with
|
|
10
|
+
// every matching `modelOverrides` entry layered on top. Per profile, the most
|
|
11
|
+
// specific matching rule wins (chat > workspace/bucket > platform > `*`), the
|
|
12
|
+
// later-declared entry on a tie; profiles no matching entry defines keep their
|
|
13
|
+
// global value. Subagents use the channel that (transitively) spawned them, so a
|
|
14
|
+
// chat's `fast`/`deep` also apply to its workers. TUI and cron stay global.
|
|
15
|
+
export function effectiveModels(
|
|
16
|
+
cfg: Pick<Config, 'models' | 'modelOverrides'>,
|
|
17
|
+
origin: SessionOrigin | undefined,
|
|
18
|
+
): Models {
|
|
19
|
+
const channel = channelOf(origin)
|
|
20
|
+
if (channel === undefined) return cfg.models
|
|
21
|
+
const winners = new Map<string, { entry: ProfileEntry; specificity: number }>()
|
|
22
|
+
for (const override of Object.values(cfg.modelOverrides)) {
|
|
23
|
+
const specificity = matchSpecificity(override.match, channel)
|
|
24
|
+
if (specificity === undefined) continue
|
|
25
|
+
for (const [profile, entry] of Object.entries(override.models)) {
|
|
26
|
+
const current = winners.get(profile)
|
|
27
|
+
if (current === undefined || specificity >= current.specificity) winners.set(profile, { entry, specificity })
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (winners.size === 0) return cfg.models
|
|
31
|
+
const merged: Record<string, ProfileEntry> = { ...cfg.models }
|
|
32
|
+
for (const [profile, { entry }] of winners) merged[profile] = entry
|
|
33
|
+
return merged as Models
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function channelOf(origin: SessionOrigin | undefined): ChannelOrigin | undefined {
|
|
37
|
+
let current = origin
|
|
38
|
+
while (current?.kind === 'subagent') current = current.spawnedByOrigin
|
|
39
|
+
return current?.kind === 'channel' ? current : undefined
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Highest specificity among the rules that match, or undefined when none do.
|
|
43
|
+
function matchSpecificity(rules: readonly string[], channel: ChannelOrigin): number | undefined {
|
|
44
|
+
let best: number | undefined
|
|
45
|
+
for (const raw of rules) {
|
|
46
|
+
const parsed = parseMatchRule(raw)
|
|
47
|
+
if (!parsed.ok || !matchesOrigin(parsed.value, channel)) continue
|
|
48
|
+
const specificity = ruleSpecificity(parsed.value)
|
|
49
|
+
if (best === undefined || specificity > best) best = specificity
|
|
50
|
+
}
|
|
51
|
+
return best
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function ruleSpecificity(rule: MatchRule): number {
|
|
55
|
+
if (rule.kind !== 'channel') return 0
|
|
56
|
+
if (rule.chat !== undefined) return 3
|
|
57
|
+
if (rule.workspace !== undefined || rule.bucket !== undefined) return 2
|
|
58
|
+
return 1
|
|
59
|
+
}
|