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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from 'node:async_hooks'
|
|
2
2
|
import { mkdir } from 'node:fs/promises'
|
|
3
|
-
import {
|
|
3
|
+
import { relative, sep } from 'node:path'
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
createBashToolDefinition as piCreateBashToolDefinition,
|
|
@@ -19,10 +19,8 @@ import { Type } from 'typebox'
|
|
|
19
19
|
import { z } from 'zod'
|
|
20
20
|
|
|
21
21
|
import { ACKNOWLEDGE_GUARDS } from '@/bundled-plugins/guard/keys'
|
|
22
|
-
import { config, getSandboxWritablePathSpecs } from '@/config/config'
|
|
23
22
|
import { readOomEvents, toolOomNote } from '@/container/oom-events'
|
|
24
23
|
import { withToolOomPriorityCommand } from '@/container/tool-oom-priority'
|
|
25
|
-
import { readEnvFile } from '@/init/env-file'
|
|
26
24
|
import {
|
|
27
25
|
classifyToolOutcome,
|
|
28
26
|
deriveMechanicallyVerifiedIncidentFingerprints,
|
|
@@ -47,38 +45,28 @@ import type {
|
|
|
47
45
|
} from '@/plugin'
|
|
48
46
|
import { PI_BUILTIN_TOOL_NAMES, type PiBuiltinToolName } from '@/plugin/core-tool-names'
|
|
49
47
|
import {
|
|
50
|
-
buildSandboxedCommand,
|
|
51
|
-
canWriteAgentRootInSandbox,
|
|
52
|
-
canMountRealProc,
|
|
53
|
-
cleanupPrivilegedSandboxRuntime,
|
|
54
48
|
commandNeedsRealProc,
|
|
55
|
-
DEFAULT_SANDBOX_ENV,
|
|
56
|
-
DEPENDENCY_BIN_SANDBOX_DIR,
|
|
57
49
|
dependencyBinUnavailableHint,
|
|
58
|
-
ensureBwrapAvailable,
|
|
59
|
-
ensureHiddenMaskTargets,
|
|
60
50
|
ensureSessionTmpDir,
|
|
61
|
-
getProcBindSafetyVerdict,
|
|
62
51
|
isGitControlPath,
|
|
63
52
|
mapVirtualTmpPath,
|
|
64
|
-
reconcileDependencyBinWrappers,
|
|
65
53
|
resolveHiddenPaths,
|
|
66
|
-
resolvePrivilegedSandboxRuntime,
|
|
67
|
-
resolveProcBindSafetyWithRetry,
|
|
68
|
-
resolveProcSelfExe,
|
|
69
|
-
resolveProtectedZones,
|
|
70
|
-
resolveSandboxSymlinks,
|
|
71
|
-
resolveWritableZones,
|
|
72
54
|
SandboxPolicyError,
|
|
73
|
-
SandboxDegradedProcError,
|
|
74
|
-
SandboxProcProbeUnverifiedError,
|
|
75
|
-
type SandboxMount,
|
|
76
|
-
type DependencyBinReconciliation,
|
|
77
|
-
subtractMasked,
|
|
78
|
-
verifyHiddenMaskTargets,
|
|
79
|
-
verifyPrivilegedSandboxRuntime,
|
|
80
55
|
} from '@/sandbox'
|
|
81
|
-
|
|
56
|
+
|
|
57
|
+
import {
|
|
58
|
+
prepareBashSandbox,
|
|
59
|
+
type BashSandboxBoundary,
|
|
60
|
+
type DeferredBashPreparation,
|
|
61
|
+
type PreparedBashSandbox,
|
|
62
|
+
} from './bash-sandbox'
|
|
63
|
+
export {
|
|
64
|
+
buildBashFilesystemPolicy,
|
|
65
|
+
type BashSandboxBoundary,
|
|
66
|
+
type DeferredBashPreparation,
|
|
67
|
+
type DeferredBashPreparationResult,
|
|
68
|
+
} from './bash-sandbox'
|
|
69
|
+
export { buildSandboxEnvPolicy } from './bash-sandbox-env'
|
|
82
70
|
|
|
83
71
|
import type { InternalGuard } from './guard-types'
|
|
84
72
|
import { createLoopGuard, type LoopGuard, type LoopGuardDecision } from './loop-guard'
|
|
@@ -112,25 +100,8 @@ export const TYPECLAW_INTERNAL_BASH_PREPARE = '__typeclawBashPrepare'
|
|
|
112
100
|
|
|
113
101
|
type BashEnvOverlay = Record<string, string>
|
|
114
102
|
type BashEnvWithhold = string[]
|
|
115
|
-
export type DeferredBashPreparationResult = {
|
|
116
|
-
command: string
|
|
117
|
-
env?: Record<string, string>
|
|
118
|
-
mount: Extract<SandboxMount, { type: 'ro-bind' }>
|
|
119
|
-
cleanup: () => Promise<void>
|
|
120
|
-
}
|
|
121
|
-
export type DeferredBashPreparation = () => Promise<DeferredBashPreparationResult>
|
|
122
103
|
const SECRET_BASH_ENV_NAMES = new Set(['GH_TOKEN', 'GITHUB_TOKEN'])
|
|
123
104
|
|
|
124
|
-
// Transport classifier for the TRUSTED hook-injected overlay only (e.g.
|
|
125
|
-
// github-cli-auth's per-repo GH_TOKEN). Token/secret-shaped names use `inherit`
|
|
126
|
-
// so their value never renders into the bwrap argv; plain names (GH_REPO) go
|
|
127
|
-
// via `set`. This is NOT a .env exposure filter — the overlay is populated by
|
|
128
|
-
// trusted runtime hooks, not operator .env.
|
|
129
|
-
const OVERLAY_SECRET_NAME_PATTERN = /(?:^|_)(?:TOKEN|SECRET|PASSWORD|API_KEY|PRIVATE_KEY|AUTH)$/i
|
|
130
|
-
function isOverlaySecretName(name: string): boolean {
|
|
131
|
-
return SECRET_BASH_ENV_NAMES.has(name) || OVERLAY_SECRET_NAME_PATTERN.test(name)
|
|
132
|
-
}
|
|
133
|
-
|
|
134
105
|
type BashSpawnEnvContext = {
|
|
135
106
|
overlay?: BashEnvOverlay
|
|
136
107
|
withhold?: BashEnvWithhold
|
|
@@ -308,20 +279,6 @@ export type WrapToolOptions = {
|
|
|
308
279
|
getLoopGuardTurn?: () => number | undefined
|
|
309
280
|
}
|
|
310
281
|
|
|
311
|
-
export type BashSandboxBoundary = {
|
|
312
|
-
ensureAvailable: () => Promise<void>
|
|
313
|
-
buildCommand: typeof buildSandboxedCommand
|
|
314
|
-
resolveProcStrategy?: () => Promise<ProcStrategyResolution>
|
|
315
|
-
resolveRuntime?: typeof resolvePrivilegedSandboxRuntime
|
|
316
|
-
verifyRuntime?: typeof verifyPrivilegedSandboxRuntime
|
|
317
|
-
cleanupRuntime?: typeof cleanupPrivilegedSandboxRuntime
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
const DEFAULT_BASH_SANDBOX_BOUNDARY: BashSandboxBoundary = {
|
|
321
|
-
ensureAvailable: ensureBwrapAvailable,
|
|
322
|
-
buildCommand: buildSandboxedCommand,
|
|
323
|
-
}
|
|
324
|
-
|
|
325
282
|
export type WrapSystemToolOptions = {
|
|
326
283
|
agentDir: string
|
|
327
284
|
sessionId: string
|
|
@@ -657,7 +614,7 @@ export function wrapBuiltinToolDefinition<TParams extends TSchema, TDetails = un
|
|
|
657
614
|
let executionError: unknown
|
|
658
615
|
let cleanupError: unknown
|
|
659
616
|
let sandboxedRealProcSucceeded = false
|
|
660
|
-
const sandboxBoundary = opts.bashSandboxBoundary
|
|
617
|
+
const sandboxBoundary = opts.bashSandboxBoundary
|
|
661
618
|
const incidentLedger = opts.incidentLedger ?? new IncidentLedger(opts.agentDir)
|
|
662
619
|
const originalArgs = { ...mutableArgs }
|
|
663
620
|
const executeAttempt = async (): Promise<void> => {
|
|
@@ -677,17 +634,19 @@ export function wrapBuiltinToolDefinition<TParams extends TSchema, TDetails = un
|
|
|
677
634
|
'model-driven bash has no permission service; refusing unsandboxed execution',
|
|
678
635
|
)
|
|
679
636
|
}
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
opts.
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
637
|
+
if (typeof attemptArgs.command !== 'string') throw new SandboxPolicyError('bash command must be a string')
|
|
638
|
+
preparedSandboxRuntime = await prepareBashSandbox({
|
|
639
|
+
command: attemptArgs.command,
|
|
640
|
+
permissions: opts.permissions,
|
|
641
|
+
origin: liveOrigin,
|
|
642
|
+
agentDir: opts.agentDir,
|
|
643
|
+
sessionId: opts.sessionId,
|
|
644
|
+
envOverlay: bashEnvOverlay,
|
|
645
|
+
envWithhold: bashEnvWithhold,
|
|
646
|
+
deferredPreparation: bashPreparation,
|
|
647
|
+
boundary: sandboxBoundary,
|
|
648
|
+
})
|
|
649
|
+
attemptArgs.command = preparedSandboxRuntime.commandString
|
|
691
650
|
}
|
|
692
651
|
|
|
693
652
|
tmpRedirect =
|
|
@@ -820,7 +779,16 @@ export function wrapBuiltinToolDefinition<TParams extends TSchema, TDetails = un
|
|
|
820
779
|
renderSandboxPolicyNote(preparedSandboxRuntime.withheld, opts.agentDir),
|
|
821
780
|
)
|
|
822
781
|
}
|
|
823
|
-
|
|
782
|
+
const errorResult = toErrorResult(finalError)
|
|
783
|
+
await runToolAfterSafely(opts, tool.name, toolCallId, errorResult)
|
|
784
|
+
const annotatedMessage = errorResult.content
|
|
785
|
+
.filter((part) => part.type === 'text')
|
|
786
|
+
.map((part) => part.text)
|
|
787
|
+
.join('\n')
|
|
788
|
+
if (annotatedMessage !== (finalError instanceof Error ? finalError.message : String(finalError))) {
|
|
789
|
+
if (finalError instanceof Error) finalError.message = annotatedMessage
|
|
790
|
+
else finalError = new Error(annotatedMessage)
|
|
791
|
+
}
|
|
824
792
|
throw finalError
|
|
825
793
|
}
|
|
826
794
|
if (pinnedFiles === undefined) throw new Error('tool file boundary was not initialized')
|
|
@@ -892,154 +860,6 @@ export function buildBuiltinPiToolOverrides(opts: WrapSystemToolOptions): ToolDe
|
|
|
892
860
|
return defaultBuiltinPiToolDefinitions(opts.agentDir).map((tool) => wrapBuiltinToolDefinition(tool, opts))
|
|
893
861
|
}
|
|
894
862
|
|
|
895
|
-
type BashFilesystemPolicyOptions = {
|
|
896
|
-
agentDir: string
|
|
897
|
-
canWriteAgentRoot: boolean
|
|
898
|
-
masks: { dirs: string[]; files: string[] }
|
|
899
|
-
writable: { dirs: string[]; files: string[] }
|
|
900
|
-
protected: { dirs: string[]; files: string[] }
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
type PreparedBashSandbox = {
|
|
904
|
-
verify: () => Promise<void>
|
|
905
|
-
cleanup: () => Promise<void>
|
|
906
|
-
spawnEnv?: Record<string, string>
|
|
907
|
-
dependencyBins?: DependencyBinReconciliation
|
|
908
|
-
withheld: {
|
|
909
|
-
paths: { dirs: string[]; files: string[] }
|
|
910
|
-
envNames: string[]
|
|
911
|
-
}
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
export function buildBashFilesystemPolicy(options: BashFilesystemPolicyOptions) {
|
|
915
|
-
const { agentDir, canWriteAgentRoot, masks, writable, protected: protectedZones } = options
|
|
916
|
-
if (canWriteAgentRoot) {
|
|
917
|
-
return { writableRoot: { dir: agentDir }, masks, protected: protectedZones }
|
|
918
|
-
}
|
|
919
|
-
return { masks, writable, protected: protectedZones }
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
// Rewrites mutableArgs.command in place so the bash builtin runs inside bwrap
|
|
923
|
-
// with role-derived private-directory masks and unconditional canonical-secret
|
|
924
|
-
// file masks. When masks are needed but bwrap is unavailable
|
|
925
|
-
// we throw rather than run unsandboxed — fail closed, never leak the masked
|
|
926
|
-
// surface. Runs after the tool.before guards have inspected the raw command.
|
|
927
|
-
async function applyBashSandbox(
|
|
928
|
-
mutableArgs: Record<string, unknown>,
|
|
929
|
-
permissions: PermissionService,
|
|
930
|
-
origin: SessionOrigin | undefined,
|
|
931
|
-
agentDir: string,
|
|
932
|
-
sessionId: string,
|
|
933
|
-
envOverlay: BashEnvOverlay | undefined,
|
|
934
|
-
envWithhold: BashEnvWithhold | undefined,
|
|
935
|
-
deferredPreparation: DeferredBashPreparation | undefined,
|
|
936
|
-
boundary: BashSandboxBoundary,
|
|
937
|
-
): Promise<PreparedBashSandbox> {
|
|
938
|
-
const originalCommand = mutableArgs.command
|
|
939
|
-
if (typeof originalCommand !== 'string') {
|
|
940
|
-
return {
|
|
941
|
-
verify: async () => {},
|
|
942
|
-
cleanup: async () => {},
|
|
943
|
-
withheld: { paths: { dirs: [], files: [] }, envNames: [] },
|
|
944
|
-
}
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
let preparation: DeferredBashPreparationResult | undefined
|
|
948
|
-
let privilegedRuntime: Awaited<ReturnType<typeof resolvePrivilegedSandboxRuntime>> | undefined
|
|
949
|
-
const cleanup = async (): Promise<void> => {
|
|
950
|
-
const tasks: Promise<void>[] = []
|
|
951
|
-
if (privilegedRuntime !== undefined) {
|
|
952
|
-
tasks.push((boundary.cleanupRuntime ?? cleanupPrivilegedSandboxRuntime)(privilegedRuntime))
|
|
953
|
-
}
|
|
954
|
-
if (preparation !== undefined) tasks.push(preparation.cleanup())
|
|
955
|
-
const outcomes = await Promise.allSettled(tasks)
|
|
956
|
-
const failure = outcomes.find((outcome) => outcome.status === 'rejected')
|
|
957
|
-
if (failure?.status === 'rejected') throw failure.reason
|
|
958
|
-
}
|
|
959
|
-
try {
|
|
960
|
-
preparation = await deferredPreparation?.()
|
|
961
|
-
const command = preparation?.command ?? originalCommand
|
|
962
|
-
const preparedEnvOverlay = preparation?.env === undefined ? envOverlay : { ...envOverlay, ...preparation.env }
|
|
963
|
-
const { dirs, files } = resolveHiddenPaths(permissions, origin, agentDir)
|
|
964
|
-
const envNames = resolveExposableBashEnvNames(agentDir)
|
|
965
|
-
const sandboxEnvOverlay = buildRoleScopedConfigEnv(agentDir, dirs, preparedEnvOverlay)
|
|
966
|
-
const effectiveEnvWithhold = (envWithhold ?? []).filter((name) => !Object.hasOwn(sandboxEnvOverlay ?? {}, name))
|
|
967
|
-
const maskTargets = await ensureHiddenMaskTargets({ dirs, files })
|
|
968
|
-
await boundary.ensureAvailable()
|
|
969
|
-
const sessionTmp = await ensureSessionTmpDir(sessionId)
|
|
970
|
-
const dependencyBins = await reconcileDependencyBinWrappers({ agentDir, sessionTmp })
|
|
971
|
-
const writable = subtractMasked(await resolveWritableZones(agentDir, getSandboxWritablePathSpecs(config)), {
|
|
972
|
-
dirs,
|
|
973
|
-
files,
|
|
974
|
-
})
|
|
975
|
-
const writableRoot = canWriteAgentRootInSandbox(permissions, origin)
|
|
976
|
-
const baseProtectedZones =
|
|
977
|
-
writableRoot || writable.dirs.includes(join(agentDir, '.git'))
|
|
978
|
-
? subtractMasked(await resolveProtectedZones(agentDir), { dirs, files })
|
|
979
|
-
: { dirs: [], files: [] }
|
|
980
|
-
const protectedZones = {
|
|
981
|
-
dirs: baseProtectedZones.dirs,
|
|
982
|
-
files: [...new Set([...baseProtectedZones.files, ...dependencyBins.protectedFiles])],
|
|
983
|
-
}
|
|
984
|
-
const writableDirSet = new Set(writable.dirs)
|
|
985
|
-
const sandboxHome = DEFAULT_SANDBOX_ENV.HOME ?? '/tmp'
|
|
986
|
-
const symlinks = resolveSandboxSymlinks(agentDir, config.sandbox.symlinks, sandboxHome).filter((op) =>
|
|
987
|
-
writableDirSet.has(op.target),
|
|
988
|
-
)
|
|
989
|
-
const { strategy: proc, degradeReason } = await (boundary.resolveProcStrategy ?? resolveProcStrategy)()
|
|
990
|
-
if (proc === 'tmpfs' && commandNeedsRealProc(command)) {
|
|
991
|
-
throw degradeReason === 'unverified' ? new SandboxProcProbeUnverifiedError() : new SandboxDegradedProcError()
|
|
992
|
-
}
|
|
993
|
-
privilegedRuntime = await (boundary.resolveRuntime ?? resolvePrivilegedSandboxRuntime)({
|
|
994
|
-
agentDir,
|
|
995
|
-
command,
|
|
996
|
-
env: sandboxEnvOverlay,
|
|
997
|
-
})
|
|
998
|
-
await verifyHiddenMaskTargets(maskTargets)
|
|
999
|
-
const { commandString, spawnEnv } = boundary.buildCommand(command, {
|
|
1000
|
-
mounts: [
|
|
1001
|
-
{ type: 'ro-bind', source: agentDir, dest: agentDir },
|
|
1002
|
-
{ type: 'bind', source: sessionTmp, dest: '/tmp' },
|
|
1003
|
-
// `/tmp` is writable, but PATH entries must remain runtime-owned for
|
|
1004
|
-
// the lifetime of this command. Last-op-wins makes this narrow re-bind
|
|
1005
|
-
// read-only without adding any broader filesystem exposure.
|
|
1006
|
-
{ type: 'ro-bind', source: dependencyBins.wrapperDir, dest: DEPENDENCY_BIN_SANDBOX_DIR },
|
|
1007
|
-
...(privilegedRuntime?.mounts ?? []),
|
|
1008
|
-
...(preparation === undefined ? [] : [preparation.mount]),
|
|
1009
|
-
],
|
|
1010
|
-
...(writableRoot
|
|
1011
|
-
? { writableRoot: { dir: agentDir }, masks: maskTargets, protected: protectedZones }
|
|
1012
|
-
: { masks: maskTargets, writable, protected: protectedZones }),
|
|
1013
|
-
symlinks,
|
|
1014
|
-
network: 'inherit',
|
|
1015
|
-
cwd: agentDir,
|
|
1016
|
-
proc,
|
|
1017
|
-
procSelfExe: resolveProcSelfExe(),
|
|
1018
|
-
...spreadSandboxEnv(
|
|
1019
|
-
buildSandboxEnvPolicy(sandboxEnvOverlay, privilegedRuntime?.env, envNames.exposable, envWithhold),
|
|
1020
|
-
),
|
|
1021
|
-
})
|
|
1022
|
-
mutableArgs.command = commandString
|
|
1023
|
-
// The overlay carries command-scoped secret VALUES (e.g. a per-repo GH_TOKEN)
|
|
1024
|
-
// that live in neither process.env nor argv; resolveSpawnEnv snapshots
|
|
1025
|
-
// inherited names from process.env only, so merge the overlay values in here
|
|
1026
|
-
// to complete the exact bwrap-parent env.
|
|
1027
|
-
const mergedSpawnEnv =
|
|
1028
|
-
spawnEnv !== undefined && sandboxEnvOverlay !== undefined ? { ...spawnEnv, ...sandboxEnvOverlay } : spawnEnv
|
|
1029
|
-
const runtimeForResult = privilegedRuntime
|
|
1030
|
-
return {
|
|
1031
|
-
verify: async () => (boundary.verifyRuntime ?? verifyPrivilegedSandboxRuntime)(runtimeForResult),
|
|
1032
|
-
cleanup,
|
|
1033
|
-
spawnEnv: mergedSpawnEnv,
|
|
1034
|
-
dependencyBins,
|
|
1035
|
-
withheld: { paths: maskTargets, envNames: [...new Set([...envNames.withheld, ...effectiveEnvWithhold])] },
|
|
1036
|
-
}
|
|
1037
|
-
} catch (error) {
|
|
1038
|
-
await cleanup()
|
|
1039
|
-
throw error
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
|
|
1043
863
|
function bashResultIsCommandNotFound(result: ToolResult): boolean {
|
|
1044
864
|
if (isRecord(result.details) && result.details.exitCode === 127) return true
|
|
1045
865
|
return (result.content as ContentPart[]).some(
|
|
@@ -1077,164 +897,6 @@ function appendTextResult(result: ToolResult, text: string): ToolResult {
|
|
|
1077
897
|
return { ...result, content: [...(result.content as ContentPart[]), { type: 'text', text }] }
|
|
1078
898
|
}
|
|
1079
899
|
|
|
1080
|
-
export function buildSandboxEnvPolicy(
|
|
1081
|
-
overlay: BashEnvOverlay | undefined,
|
|
1082
|
-
runtimeEnv: Record<string, string> | undefined,
|
|
1083
|
-
exposableEnvNames: readonly string[] = [],
|
|
1084
|
-
withhold: readonly string[] = [],
|
|
1085
|
-
): { inherit?: string[]; set?: Record<string, string>; withhold?: string[] } {
|
|
1086
|
-
const requestedWithhold = new Set(withhold)
|
|
1087
|
-
const overlayNames = new Set(Object.keys(overlay ?? {}))
|
|
1088
|
-
// The overlay is a deliberate command-scoped replacement, while withholding
|
|
1089
|
-
// only removes ambient values; an overlay therefore wins for the same name.
|
|
1090
|
-
const effectiveWithhold = [...requestedWithhold].filter((name) => !overlayNames.has(name))
|
|
1091
|
-
const effectiveWithholdSet = new Set(effectiveWithhold)
|
|
1092
|
-
const set = Object.fromEntries(Object.entries(runtimeEnv ?? {}).filter(([key]) => !requestedWithhold.has(key)))
|
|
1093
|
-
const inherit: string[] = []
|
|
1094
|
-
const inheritSeen = new Set<string>()
|
|
1095
|
-
const pushInherit = (key: string): void => {
|
|
1096
|
-
if (effectiveWithholdSet.has(key) || Object.hasOwn(set, key) || inheritSeen.has(key)) return
|
|
1097
|
-
inheritSeen.add(key)
|
|
1098
|
-
inherit.push(key)
|
|
1099
|
-
}
|
|
1100
|
-
for (const [key, value] of Object.entries(overlay ?? {})) {
|
|
1101
|
-
if (Object.hasOwn(set, key)) continue
|
|
1102
|
-
if (isOverlaySecretName(key)) pushInherit(key)
|
|
1103
|
-
else set[key] = value
|
|
1104
|
-
}
|
|
1105
|
-
// Operator-declared .env vars pass through by NAME (inherit), keeping values
|
|
1106
|
-
// out of the rendered bwrap argv. Sandbox-integrity names were already dropped
|
|
1107
|
-
// in resolveExposableEnvNames — these are the survivors.
|
|
1108
|
-
for (const key of exposableEnvNames) pushInherit(key)
|
|
1109
|
-
// Pass the entrypoint-exported Xvfb display (start_xvfb: `export DISPLAY=:99`)
|
|
1110
|
-
// through --clearenv, else sandboxed `agent-browser --headed` dies with
|
|
1111
|
-
// "Missing X server or $DISPLAY". Passing the runtime's OWN value (not a fixed
|
|
1112
|
-
// ":99") keeps `docker.file.xvfb=false` advertising no display. Rendered via
|
|
1113
|
-
// `set` (a display number is neither a credential nor shell-injectable), and no
|
|
1114
|
-
// /tmp/.X11-unix bind is needed: Chrome reaches Xvfb over the netns-scoped
|
|
1115
|
-
// abstract X11 socket while bash keeps network:'inherit'.
|
|
1116
|
-
const display = process.env['DISPLAY']
|
|
1117
|
-
if (
|
|
1118
|
-
display !== undefined &&
|
|
1119
|
-
display !== '' &&
|
|
1120
|
-
!effectiveWithholdSet.has('DISPLAY') &&
|
|
1121
|
-
!Object.hasOwn(set, 'DISPLAY') &&
|
|
1122
|
-
!inheritSeen.has('DISPLAY')
|
|
1123
|
-
) {
|
|
1124
|
-
set['DISPLAY'] = display
|
|
1125
|
-
}
|
|
1126
|
-
return {
|
|
1127
|
-
...(inherit.length > 0 ? { inherit } : {}),
|
|
1128
|
-
...(Object.keys(set).length > 0 ? { set } : {}),
|
|
1129
|
-
...(effectiveWithhold.length > 0 ? { withhold: effectiveWithhold } : {}),
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
function spreadSandboxEnv(policy: ReturnType<typeof buildSandboxEnvPolicy>): {
|
|
1134
|
-
env?: ReturnType<typeof buildSandboxEnvPolicy>
|
|
1135
|
-
} {
|
|
1136
|
-
return Object.keys(policy).length > 0 ? { env: policy } : {}
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
function resolveExposableBashEnvNames(agentDir: string): { exposable: string[]; withheld: string[] } {
|
|
1140
|
-
const declaredEnv = readEnvFile(agentDir)
|
|
1141
|
-
const exposable = resolveExposableEnvNames(declaredEnv, process.env)
|
|
1142
|
-
const exposableSet = new Set(exposable)
|
|
1143
|
-
const withheld = [...declaredEnv]
|
|
1144
|
-
.filter(([name, value]) => value.length > 0 && !exposableSet.has(name))
|
|
1145
|
-
.map(([name]) => name)
|
|
1146
|
-
return { exposable, withheld }
|
|
1147
|
-
}
|
|
1148
|
-
|
|
1149
|
-
function buildRoleScopedConfigEnv(
|
|
1150
|
-
agentDir: string,
|
|
1151
|
-
hiddenDirs: string[],
|
|
1152
|
-
envOverlay: BashEnvOverlay | undefined,
|
|
1153
|
-
): BashEnvOverlay | undefined {
|
|
1154
|
-
// Low-trust roles have workspace/ masked. Do not let container-global config
|
|
1155
|
-
// env vars point CLIs back at that private surface: apps that honor XDG should
|
|
1156
|
-
// still run, but their config must land in the sandbox's per-session /tmp.
|
|
1157
|
-
// Trusted/owner have only the unconditional credential-dir masks, not the
|
|
1158
|
-
// workspace root mask, so their command broker decides whether to set GWS.
|
|
1159
|
-
const workspaceHidden = hiddenDirs.includes(join(agentDir, 'workspace'))
|
|
1160
|
-
if (!workspaceHidden) return envOverlay
|
|
1161
|
-
|
|
1162
|
-
return {
|
|
1163
|
-
...envOverlay,
|
|
1164
|
-
XDG_CONFIG_HOME: '/tmp/.config',
|
|
1165
|
-
GWS_CONFIG_HOME: '/tmp/.config/gws',
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
|
-
// Picks the /proc strategy for a sandboxed bash call. The branch order is:
|
|
1170
|
-
// 'real-proc' ONLY when the operator explicitly opted in (sandbox.realProc) AND
|
|
1171
|
-
// the kernel permits the mount (canMountRealProc) — it adds PID isolation but
|
|
1172
|
-
// needs CAP_SYS_ADMIN (unshare --mount-proc), so it is a deliberate, narrow
|
|
1173
|
-
// opt-in; else 'proc-bind' (--ro-bind /proc, NO CAP_SYS_ADMIN) when its userns
|
|
1174
|
-
// leak-block is verified safe; else 'tmpfs'. Because sandbox.realProc DEFAULTS
|
|
1175
|
-
// FALSE, the first branch is normally skipped and proc-bind is the de-facto
|
|
1176
|
-
// default — which is the point: the common path needs no broad outer capability.
|
|
1177
|
-
// 'tmpfs' is the last-resort degraded mode where external packages can't run;
|
|
1178
|
-
// reached only when proc-bind is DEFINITIVELY unavailable (a real cross-userns
|
|
1179
|
-
// environ leak → fail closed) or its safety stays unverifiable after retries.
|
|
1180
|
-
//
|
|
1181
|
-
// Read from the boot-time `config` snapshot, NOT live getConfig(): sandbox is
|
|
1182
|
-
// restart-required, and the strategy MUST track the boot-time CAP_SYS_ADMIN
|
|
1183
|
-
// grant. A `typeclaw reload` flipping realProc would otherwise emit `unshare
|
|
1184
|
-
// --mount-proc` in a container booted WITHOUT the cap (or vice versa). Both
|
|
1185
|
-
// probes are cached process-globally, so this resolves to one spawn per
|
|
1186
|
-
// container lifetime regardless of how many bash calls hit it.
|
|
1187
|
-
// A tmpfs degrade carries WHY it happened so the caller can pick a permanent vs
|
|
1188
|
-
// retryable error. 'definitive': the probe returned a real cross-userns leak
|
|
1189
|
-
// ('unsafe') — the ONLY verdict proven permanent, so it fails closed for good.
|
|
1190
|
-
// 'unverified': the safety probe never reached a definitive verdict within its
|
|
1191
|
-
// retry budget. That covers BOTH a transient load spike AND a durable
|
|
1192
|
-
// incapability (no usable namespaces, a bwrap that starts but cannot set up its
|
|
1193
|
-
// sandbox): the probe cannot prove a NEGATIVE capability — only a leak is
|
|
1194
|
-
// definitive — so a genuinely incapable host also lands here and simply keeps
|
|
1195
|
-
// re-degrading on each call. Since 'inconclusive' is never cached, that costs a
|
|
1196
|
-
// re-probe but is correct: the only false case is "capable but briefly
|
|
1197
|
-
// saturated", which recovers; an incapable host stays degraded either way.
|
|
1198
|
-
// Absent when the strategy is not tmpfs.
|
|
1199
|
-
type ProcStrategyResolution =
|
|
1200
|
-
| { strategy: 'real-proc' | 'proc-bind'; degradeReason?: undefined }
|
|
1201
|
-
| { strategy: 'tmpfs'; degradeReason: 'definitive' | 'unverified' }
|
|
1202
|
-
|
|
1203
|
-
async function resolveProcStrategy(): Promise<ProcStrategyResolution> {
|
|
1204
|
-
if (config.sandbox.realProc && (await canMountRealProc())) return { strategy: 'real-proc' }
|
|
1205
|
-
// Retry an 'inconclusive' proc-bind probe (transient under load) before
|
|
1206
|
-
// degrading — a single such hiccup must not break external-package runs on a
|
|
1207
|
-
// capable host. 'unsafe' still fails closed with no retry.
|
|
1208
|
-
const verdict = await resolveProcBindSafetyWithRetry(
|
|
1209
|
-
() => getProcBindSafetyVerdict(),
|
|
1210
|
-
(ms) => Bun.sleep(ms),
|
|
1211
|
-
)
|
|
1212
|
-
if (verdict === 'safe') return { strategy: 'proc-bind' }
|
|
1213
|
-
// Degraded last resort: no working /proc strategy. External package runners
|
|
1214
|
-
// (bunx/bun run <pkg-bin>) will fail with Bun's opaque "NotDir" because
|
|
1215
|
-
// /proc/self/{fd,maps} are absent. Only a proven 'unsafe' (a real cross-userns
|
|
1216
|
-
// leak) is DEFINITIVE — warn once (a real operator-facing limit). An
|
|
1217
|
-
// 'inconclusive' is reported as retryable upstream and NOT warned (it would cry
|
|
1218
|
-
// wolf every boot storm); a durably-incapable host re-degrades quietly here,
|
|
1219
|
-
// since the probe cannot distinguish it from transient load.
|
|
1220
|
-
if (verdict === 'unsafe') {
|
|
1221
|
-
warnTmpfsProcFallbackOnce()
|
|
1222
|
-
return { strategy: 'tmpfs', degradeReason: 'definitive' }
|
|
1223
|
-
}
|
|
1224
|
-
return { strategy: 'tmpfs', degradeReason: 'unverified' }
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
|
-
let tmpfsProcFallbackWarned = false
|
|
1228
|
-
function warnTmpfsProcFallbackOnce(): void {
|
|
1229
|
-
if (tmpfsProcFallbackWarned) return
|
|
1230
|
-
tmpfsProcFallbackWarned = true
|
|
1231
|
-
console.warn(
|
|
1232
|
-
'[sandbox] degraded /proc mode: neither real-proc nor proc-bind is available on this host, ' +
|
|
1233
|
-
'so sandboxed external package runners (bunx / bun run <pkg-bin>) will fail. ' +
|
|
1234
|
-
'This needs a runtime with working user namespaces.',
|
|
1235
|
-
)
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
900
|
// The builtin file tools that take a single filesystem `path` arg. They run in
|
|
1239
901
|
// the main process rather than bwrap, so each must apply the same
|
|
1240
902
|
// /tmp -> session-dir mapping that
|
|
@@ -599,8 +599,12 @@ function classifySegment(segment: Segment): void {
|
|
|
599
599
|
|
|
600
600
|
export function enforceReviewerReadonlyBashPolicy(command: string): void {
|
|
601
601
|
if (typeof command !== 'string' || command.trim().length === 0) return
|
|
602
|
+
// Single-quoted text is literal to bash, so backticks or `$(` inside a quoted
|
|
603
|
+
// jq filter or markdown review body are not substitutions. Double quotes stay
|
|
604
|
+
// in the scan because bash still substitutes inside them.
|
|
605
|
+
const scanned = stripSingleQuotedText(command)
|
|
602
606
|
for (const { pattern, reason } of FAIL_CLOSED_CONSTRUCTS) {
|
|
603
|
-
if (pattern.test(
|
|
607
|
+
if (pattern.test(scanned)) {
|
|
604
608
|
throw new SubagentBashPolicyError(`command uses ${reason}, which the reviewer policy cannot analyze safely.`)
|
|
605
609
|
}
|
|
606
610
|
}
|
|
@@ -608,6 +612,42 @@ export function enforceReviewerReadonlyBashPolicy(command: string): void {
|
|
|
608
612
|
for (const segment of segments) classifySegment(segment)
|
|
609
613
|
}
|
|
610
614
|
|
|
615
|
+
// A `'` inside double quotes or after a backslash does not open a quote, so a
|
|
616
|
+
// plain regex would let `"it's `id`" 'x'` hide a live substitution.
|
|
617
|
+
function stripSingleQuotedText(command: string): string {
|
|
618
|
+
let out = ''
|
|
619
|
+
let inDouble = false
|
|
620
|
+
for (let i = 0; i < command.length; i++) {
|
|
621
|
+
const ch = command[i] as string
|
|
622
|
+
if (ch === '\\') {
|
|
623
|
+
out += command.slice(i, i + 2)
|
|
624
|
+
i++
|
|
625
|
+
continue
|
|
626
|
+
}
|
|
627
|
+
if (ch === '"') inDouble = !inDouble
|
|
628
|
+
// Bash ignores an unquoted `#` comment through the newline, so quotes inside
|
|
629
|
+
// it would mis-pair here and in splitIntoSegments and hide the next line.
|
|
630
|
+
if (ch === '#' && !inDouble && (i === 0 || /[\s;&|()]/.test(command[i - 1] as string))) {
|
|
631
|
+
const newline = command.indexOf('\n', i)
|
|
632
|
+
const comment = command.slice(i, newline === -1 ? undefined : newline)
|
|
633
|
+
if (/['"]/.test(comment)) {
|
|
634
|
+
throw new SubagentBashPolicyError(
|
|
635
|
+
'a shell comment containing quotes cannot be analyzed safely; drop the comment.',
|
|
636
|
+
)
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
if (ch === "'" && !inDouble) {
|
|
640
|
+
const end = command.indexOf("'", i + 1)
|
|
641
|
+
if (end === -1) return command
|
|
642
|
+
out += "''"
|
|
643
|
+
i = end
|
|
644
|
+
continue
|
|
645
|
+
}
|
|
646
|
+
out += ch
|
|
647
|
+
}
|
|
648
|
+
return out
|
|
649
|
+
}
|
|
650
|
+
|
|
611
651
|
export function enforceSubagentBashPolicy(policy: SubagentBashPolicy, command: string): void {
|
|
612
652
|
if (policy.kind === 'readonly-reviewer') enforceReviewerReadonlyBashPolicy(command)
|
|
613
653
|
}
|
|
@@ -43,6 +43,9 @@ export type SessionOrigin =
|
|
|
43
43
|
parentChat?: string
|
|
44
44
|
parentChatName?: string
|
|
45
45
|
lastInboundAuthorId?: string
|
|
46
|
+
// Runtime-authenticated source of a delegated author, never model input.
|
|
47
|
+
// Foreign namespaces may match authorless rules, not local author IDs.
|
|
48
|
+
lastInboundAuthorAdapter?: AdapterId
|
|
46
49
|
reactionRef?: ReactionRef
|
|
47
50
|
participants?: readonly ChannelParticipant[]
|
|
48
51
|
membership?: MembershipCount
|
|
@@ -294,7 +297,9 @@ export function renderInteractiveSessionContext(subagentRoster: string): string
|
|
|
294
297
|
'',
|
|
295
298
|
'- Spawns run in the background by default: a `<system-reminder>` arrives when the subagent completes — do not poll `subagent_output`. Pass `run_in_foreground: true` for a quick result you need this turn; deep-profile subagents always run in the background from here. In channel sessions a completion reminder is not a user message: surface the result via `channel_reply`/`channel_send`.',
|
|
296
299
|
'- Broad search: spawn 2-5 `explorer`/`scout` workers in parallel, end your response, then collect each completion once. Use `scout` for narrow lookups and `researcher` for decomposed, multi-source, cross-validated synthesis. When the user *explicitly* asks to research or investigate, you MUST spawn `researcher`: answering from training memory or one inline `web_search` does not satisfy the request, and `scout`/`explorer` fan-out does not replace `researcher`.',
|
|
297
|
-
'- Delegate
|
|
300
|
+
'- Delegate the search, not the judgment. When an answer depends on reasoning across raw records — transactions, logs, messages, database rows — use `explorer` to locate them, then read or query the decisive records yourself before concluding. A subagent summary drops the cross-record patterns an answer usually hinges on (sequences, matching amounts, what stopped and what started), and a subagent that found nothing is not evidence that the records hold nothing.',
|
|
301
|
+
'- Delegate-and-converse: for side-effectful or noisy work over ~30s, spawn one background subagent and stay responsive — `operator` for side effects, `scout` for a quick lookup, `researcher` for deep investigation, `planner` for risk-aware sequencing, `qa` to prove a PR, repo, or deployed product actually works by running it. Pass `profile: "deep"` only when the work needs stronger reasoning than the default tier.',
|
|
302
|
+
'- Web browsing: never drive a browser yourself. Any task that needs a real browser — navigating, clicking, forms, logins, screenshots, JS-rendered pages — goes to `browser`. Plain lookups stay with `scout`/`web_fetch`.',
|
|
298
303
|
'- Troubleshooting: after ~3 non-converging attempts at the same failure, stop and hand the loop to `operator` (background; `profile: "deep"` when genuinely hard) with the symptom, attempts, and success condition. Read `typeclaw-troubleshooting` before spawning.',
|
|
299
304
|
"- Status: when asked about a running subagent, call `subagent_output({ task_id })` and report its `status_summary` — don't guess.",
|
|
300
305
|
"- Don't fire more than 5 subagents per turn, spawn for known answers or single-file lookups, poll output in a loop, or ask research subagents to decide: they report; you decide. Most subagents are leaves; only `operator` and `reviewer` may delegate one level deeper.",
|
|
@@ -342,7 +347,7 @@ function renderChannelRolePolicy(): string {
|
|
|
342
347
|
'',
|
|
343
348
|
'Channel sessions may include multiple speakers; never carry one speaker’s',
|
|
344
349
|
'role onto later messages. The current speaker’s authoritative role is the',
|
|
345
|
-
'`<your-role>` turn tag;
|
|
350
|
+
'`<your-role>` turn tag; no tag means the speaker is the owner.',
|
|
346
351
|
'',
|
|
347
352
|
'Tool calls/channel admission are gated by that speaker’s permissions;',
|
|
348
353
|
'`blocked:` or "denied by permissions" means they lack the needed grant.',
|
|
@@ -476,6 +481,14 @@ function renderChannelOrigin(
|
|
|
476
481
|
'One verdict, one surface. After submitting the review, use',
|
|
477
482
|
'`skip_response({ reason: "verdict posted as review" })`.',
|
|
478
483
|
'',
|
|
484
|
+
'**A direct (re-)review request always gets an answer.** If someone asks',
|
|
485
|
+
'you to review again but your standing verdict already covers the',
|
|
486
|
+
'current head, do not `skip_response`; silence reads as broken. Reply in',
|
|
487
|
+
'one line that your earlier verdict on `<short sha>` stands and what would',
|
|
488
|
+
'change it. Phrase it as past ("I approved ... earlier"), e.g. "I approved',
|
|
489
|
+
'`abc1234` earlier and it is still the head, so that verdict stands. Push',
|
|
490
|
+
'new commits or point me at something specific to re-check."',
|
|
491
|
+
'',
|
|
479
492
|
'**Never post your own coordination state.** Write only what a PR',
|
|
480
493
|
'participant needs. Do not narrate carriers, review rounds, sessions,',
|
|
481
494
|
'a verdict not yet being registered, or sticky review state.',
|
|
@@ -623,16 +636,16 @@ function renderChannelOrigin(
|
|
|
623
636
|
...(origin.adapter === 'github'
|
|
624
637
|
? [
|
|
625
638
|
'tool call, keep working and post the answer with a single final',
|
|
626
|
-
'`channel_reply({ text,
|
|
639
|
+
'`channel_reply({ text, continue_after_reply: false })`.',
|
|
627
640
|
'Do not post an "On it" ack comment first — the runtime',
|
|
628
641
|
'already added an :eyes: reaction; use `channel_react` for explicit ack.',
|
|
629
642
|
]
|
|
630
643
|
: [
|
|
631
644
|
'tool call, send a one-line ack first via `channel_reply({ text: "On it.",',
|
|
632
|
-
'
|
|
633
|
-
'final `channel_reply({ text,
|
|
645
|
+
'continue_after_reply: true })`, keep working, then send the answer with a',
|
|
646
|
+
'final `channel_reply({ text, continue_after_reply: false })`.',
|
|
634
647
|
'The ack is not your reply; the answer is. Once the answer lands, end your turn.',
|
|
635
|
-
'`
|
|
648
|
+
'`continue_after_reply: true` is mandatory on the ack or the turn ends there',
|
|
636
649
|
'and drops the fetch/subagent/actual answer.',
|
|
637
650
|
]),
|
|
638
651
|
'',
|
|
@@ -647,7 +660,7 @@ function renderChannelOrigin(
|
|
|
647
660
|
'',
|
|
648
661
|
'Do not send a second reply just to rephrase, restate, or "confirm" what you already said.',
|
|
649
662
|
'',
|
|
650
|
-
'To reply here, call `channel_reply({ text,
|
|
663
|
+
'To reply here, call `channel_reply({ text, continue_after_reply })`. Addressing (including the',
|
|
651
664
|
`thread${origin.thread !== null ? '' : ' — none here, this is a channel-root session'}) is filled in; you don't need`,
|
|
652
665
|
'to copy these fields:',
|
|
653
666
|
'',
|
|
@@ -660,8 +673,12 @@ function renderChannelOrigin(
|
|
|
660
673
|
'}',
|
|
661
674
|
'```',
|
|
662
675
|
'',
|
|
663
|
-
'
|
|
664
|
-
'
|
|
676
|
+
'When work belongs to ANOTHER conversation, first use `channel_session_search` to find its owning session,',
|
|
677
|
+
'then pass that target to `channel_handoff`. Search by conversation name, topic, or participant, across adapters.',
|
|
678
|
+
"The owning session reads its current context and answers through its own account; don't read or post there",
|
|
679
|
+
'directly from this session. This applies to channels, threads, groups, and DMs regardless of where you started.',
|
|
680
|
+
'`channel_send` is for an explicit direct post, not a substitute for handing ongoing work to its owner.',
|
|
681
|
+
'If `channel_read` reports an access error with a handoff target, use it rather than asking the user to fix permissions.',
|
|
665
682
|
'',
|
|
666
683
|
...renderResearchReportDeliveryGuidance(platformInfo),
|
|
667
684
|
...renderMentionGuidance(platformInfo, origin.participants ?? [], now, origin.self),
|
|
@@ -713,13 +730,13 @@ function renderResearchReportDeliveryGuidance(platformInfo: PlatformInfo): strin
|
|
|
713
730
|
`**Ship explicit deliverables as PDFs.** ${platformInfo.displayName} accepts file`,
|
|
714
731
|
'attachments. When the user clearly asks for a PDF/file/export/attachment, a standalone',
|
|
715
732
|
'document/brief, or when a `researcher` subagent returns `research-<slug>.md` in',
|
|
716
|
-
'`<report>`,
|
|
733
|
+
'`<report>`, design it as a PDF with `typeclaw-render-pdf` and deliver via',
|
|
717
734
|
'`channel_send({ ..., attachments: [{ path, filename }] })` plus a 1–2 line',
|
|
718
735
|
'summary. Do not treat the bare word "report" as enough: routine daily stats,',
|
|
719
736
|
'user trends, status reports, and other operational updates should stay inline',
|
|
720
737
|
'unless the user asks for a downloadable/exported artifact. A `researcher`',
|
|
721
738
|
'`<summary>` is a teaser, NOT the deliverable. Never use an ad-hoc library',
|
|
722
|
-
'(jsPDF, pdfkit, raw-text dump); it breaks
|
|
739
|
+
'(jsPDF, pdfkit, raw-text dump); it produces unstyled text and breaks CJK.',
|
|
723
740
|
"For Korean/Japanese/Chinese, follow the skill's CJK guidance and never ship",
|
|
724
741
|
'tofu boxes. Do not paste the full markdown into chat; do not attach the raw `.md`',
|
|
725
742
|
'unless explicitly asked; inline text is right for routine updates.',
|