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
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import type { StreamFn } from '@earendil-works/pi-agent-core'
|
|
2
|
+
|
|
3
|
+
import type { LiveSubagentRegistry } from './live-subagents'
|
|
4
|
+
|
|
5
|
+
const TTL_MS = 5 * 60_000
|
|
6
|
+
const INTERVAL_MS = TTL_MS * 0.9
|
|
7
|
+
export const MAX_SUBAGENT_CACHE_PINGS = 6
|
|
8
|
+
|
|
9
|
+
type Request = {
|
|
10
|
+
readonly model: Parameters<StreamFn>[0]
|
|
11
|
+
readonly context: Parameters<StreamFn>[1]
|
|
12
|
+
readonly options: NonNullable<Parameters<StreamFn>[2]>
|
|
13
|
+
readonly payload: Record<string, unknown>
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
17
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Inspect the actual cache markers, including hook overrides and env-derived
|
|
21
|
+
// retention. Never turn a no-cache or one-hour request into a five-minute one.
|
|
22
|
+
function hasShortCache(value: unknown): boolean {
|
|
23
|
+
if (Array.isArray(value)) return value.some(hasShortCache)
|
|
24
|
+
if (!isRecord(value)) return false
|
|
25
|
+
if (isRecord(value.cache_control) && value.cache_control.type === 'ephemeral') {
|
|
26
|
+
return value.cache_control.ttl === undefined || value.cache_control.ttl === '5m'
|
|
27
|
+
}
|
|
28
|
+
return Object.values(value).some(hasShortCache)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export class SubagentCacheKeepalive {
|
|
32
|
+
private request: Request | undefined
|
|
33
|
+
private refreshedAt = 0
|
|
34
|
+
private idle = false
|
|
35
|
+
private closed = false
|
|
36
|
+
private pings = 0
|
|
37
|
+
private cancelTimer: (() => void) | undefined
|
|
38
|
+
private controller: AbortController | undefined
|
|
39
|
+
private readonly unsubscribe: () => void
|
|
40
|
+
|
|
41
|
+
constructor(
|
|
42
|
+
private readonly sessionId: string,
|
|
43
|
+
private readonly registry: LiveSubagentRegistry,
|
|
44
|
+
private readonly stream: StreamFn,
|
|
45
|
+
private readonly clock = {
|
|
46
|
+
now: () => Date.now(),
|
|
47
|
+
schedule: (callback: () => void, delay: number): (() => void) => {
|
|
48
|
+
const timer = setTimeout(callback, delay)
|
|
49
|
+
timer.unref()
|
|
50
|
+
return () => clearTimeout(timer)
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
private readonly log: (line: string) => void = console.debug,
|
|
54
|
+
) {
|
|
55
|
+
this.unsubscribe = registry.subscribe((parent) => {
|
|
56
|
+
if (parent === sessionId) this.reconcile()
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
capture(model: Request['model'], context: Request['context'], options: Request['options'], payload: unknown): void {
|
|
61
|
+
this.request = undefined
|
|
62
|
+
if (
|
|
63
|
+
this.closed ||
|
|
64
|
+
model.api !== 'anthropic-messages' ||
|
|
65
|
+
options.cacheRetention === 'none' ||
|
|
66
|
+
!isRecord(payload) ||
|
|
67
|
+
!hasShortCache(payload)
|
|
68
|
+
) {
|
|
69
|
+
return
|
|
70
|
+
}
|
|
71
|
+
// Snapshot after all payload hooks and prompt-cache-key handling. Rebuilding
|
|
72
|
+
// from session state can reorder tools or include new messages/system text.
|
|
73
|
+
this.request = {
|
|
74
|
+
model: structuredClone(model),
|
|
75
|
+
context: structuredClone(context),
|
|
76
|
+
options: { ...options },
|
|
77
|
+
payload: structuredClone(payload),
|
|
78
|
+
}
|
|
79
|
+
this.refreshedAt = this.clock.now()
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
invalidate(): void {
|
|
83
|
+
this.request = undefined
|
|
84
|
+
this.stop()
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
startTurn(): void {
|
|
88
|
+
this.idle = false
|
|
89
|
+
this.pings = 0
|
|
90
|
+
this.stop()
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
settle(): void {
|
|
94
|
+
if (this.closed) return
|
|
95
|
+
this.idle = true
|
|
96
|
+
this.reconcile()
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
close(): void {
|
|
100
|
+
this.closed = true
|
|
101
|
+
this.request = undefined
|
|
102
|
+
this.stop()
|
|
103
|
+
this.unsubscribe()
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
private running(): boolean {
|
|
107
|
+
return this.registry
|
|
108
|
+
.list({ parentSessionId: this.sessionId })
|
|
109
|
+
.some((child) => child.background === true && child.status === 'running')
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
private stop(): void {
|
|
113
|
+
this.cancelTimer?.()
|
|
114
|
+
this.cancelTimer = undefined
|
|
115
|
+
this.controller?.abort()
|
|
116
|
+
this.controller = undefined
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
private reconcile(): void {
|
|
120
|
+
if (this.closed || !this.idle || !this.running()) {
|
|
121
|
+
this.stop()
|
|
122
|
+
return
|
|
123
|
+
}
|
|
124
|
+
if (!this.request || this.pings >= MAX_SUBAGENT_CACHE_PINGS || this.cancelTimer || this.controller) return
|
|
125
|
+
// A late callback or a long real turn must not buy a cold cache write.
|
|
126
|
+
const age = this.clock.now() - this.refreshedAt
|
|
127
|
+
if (age > INTERVAL_MS + (TTL_MS - INTERVAL_MS) / 2) return
|
|
128
|
+
this.cancelTimer = this.clock.schedule(
|
|
129
|
+
() => {
|
|
130
|
+
this.cancelTimer = undefined
|
|
131
|
+
void this.ping()
|
|
132
|
+
},
|
|
133
|
+
Math.max(0, INTERVAL_MS - age),
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
private async ping(): Promise<void> {
|
|
138
|
+
const request = this.request
|
|
139
|
+
if (
|
|
140
|
+
!request ||
|
|
141
|
+
!this.idle ||
|
|
142
|
+
this.closed ||
|
|
143
|
+
!this.running() ||
|
|
144
|
+
this.clock.now() - this.refreshedAt > INTERVAL_MS + (TTL_MS - INTERVAL_MS) / 2
|
|
145
|
+
) {
|
|
146
|
+
return
|
|
147
|
+
}
|
|
148
|
+
const controller = new AbortController()
|
|
149
|
+
this.controller = controller
|
|
150
|
+
this.pings += 1
|
|
151
|
+
const startedAt = this.clock.now()
|
|
152
|
+
// Legacy thinking requires max_tokens > budget_tokens. Preserve that budget:
|
|
153
|
+
// changing thinking settings invalidates the very cache we want to refresh.
|
|
154
|
+
const thinking = request.payload.thinking
|
|
155
|
+
const maxTokens =
|
|
156
|
+
isRecord(thinking) && thinking.type === 'enabled' && typeof thinking.budget_tokens === 'number'
|
|
157
|
+
? thinking.budget_tokens + 1
|
|
158
|
+
: 1
|
|
159
|
+
let prefilled = false
|
|
160
|
+
this.log(`[agent] subagent cache keepalive ${this.pings}/${MAX_SUBAGENT_CACHE_PINGS}`)
|
|
161
|
+
try {
|
|
162
|
+
const events = await this.stream(request.model, request.context, {
|
|
163
|
+
...request.options,
|
|
164
|
+
signal: controller.signal,
|
|
165
|
+
maxTokens,
|
|
166
|
+
maxRetries: 0,
|
|
167
|
+
timeoutMs: 15_000,
|
|
168
|
+
onPayload: () => ({ ...structuredClone(request.payload), max_tokens: maxTokens }),
|
|
169
|
+
onResponse: undefined,
|
|
170
|
+
// message_start follows prefill, unlike the SDK's synthetic start event.
|
|
171
|
+
// Stop here even for legacy thinking, without generating its full budget.
|
|
172
|
+
onProviderStreamEvent: (event) => {
|
|
173
|
+
if (isRecord(event) && event.type === 'message_start') {
|
|
174
|
+
prefilled = true
|
|
175
|
+
controller.abort()
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
})
|
|
179
|
+
const result = await events.result()
|
|
180
|
+
if (result.stopReason === 'error') {
|
|
181
|
+
this.log(`[agent] subagent cache keepalive failed: ${result.errorMessage ?? 'provider error'}`)
|
|
182
|
+
}
|
|
183
|
+
} catch (error) {
|
|
184
|
+
this.log(`[agent] subagent cache keepalive failed: ${error instanceof Error ? error.message : String(error)}`)
|
|
185
|
+
} finally {
|
|
186
|
+
// A new turn/completion/close may already have cancelled this ping.
|
|
187
|
+
if (this.controller === controller) {
|
|
188
|
+
this.controller = undefined
|
|
189
|
+
if (prefilled) {
|
|
190
|
+
this.refreshedAt = startedAt
|
|
191
|
+
this.reconcile()
|
|
192
|
+
} else if (this.request === request) {
|
|
193
|
+
this.request = undefined
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
@@ -101,8 +101,8 @@ export type SubagentCompletedPayload = {
|
|
|
101
101
|
hasRecoverableOutput?: boolean
|
|
102
102
|
// Present when the parent was a channel session. Lets the router fall back
|
|
103
103
|
// to the live successor session for the same channel key when the parent
|
|
104
|
-
// rolled over (SESSION_FRESHNESS_TTL_MS) or was
|
|
105
|
-
// subagent ran — otherwise the completion is silently dropped.
|
|
104
|
+
// rolled over after 60 minutes idle (SESSION_FRESHNESS_TTL_MS) or was
|
|
105
|
+
// idle-evicted while the subagent ran — otherwise the completion is silently dropped.
|
|
106
106
|
channelKey?: SubagentCompletedChannelKey
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SessionManager } from '@earendil-works/pi-coding-agent'
|
|
2
|
+
|
|
3
|
+
/** Plugin-owned privacy choice; model payloads cannot enable or disable persistence. */
|
|
4
|
+
export function createSubagentSessionManager(cwd: string, sessionDir: string, ephemeral = false): SessionManager {
|
|
5
|
+
return ephemeral ? SessionManager.inMemory(cwd) : SessionManager.create(cwd, sessionDir)
|
|
6
|
+
}
|
package/src/agent/subagents.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ToolDefinition } from '@earendil-works/pi-coding-agent'
|
|
2
2
|
import type { z } from 'zod'
|
|
3
3
|
|
|
4
|
-
import { getConfig, resolveModel } from '@/config'
|
|
4
|
+
import { getConfig, resolveModel, type ThinkingLevel } from '@/config'
|
|
5
|
+
import { effectiveModels } from '@/config/model-overrides'
|
|
5
6
|
import type { PermissionService } from '@/permissions'
|
|
6
7
|
import type { HookBus } from '@/plugin'
|
|
7
8
|
import type { Stream, Unsubscribe } from '@/stream'
|
|
@@ -64,6 +65,11 @@ export type SubagentShared<P = unknown> = {
|
|
|
64
65
|
// session construction. Unknown profile names fall back to `default` with
|
|
65
66
|
// a warning. See `Subagent` in `@/plugin/types` for the full contract.
|
|
66
67
|
profile?: string
|
|
68
|
+
// Thinking level for this subagent's session, overriding the profile's own
|
|
69
|
+
// level. Applies only when `profile` is configured: when it falls back to
|
|
70
|
+
// `default`, the session keeps `default`'s level, so e.g. `deep` + `low` means
|
|
71
|
+
// "the deep model at low effort if one exists, else the plain default".
|
|
72
|
+
thinkingLevel?: ThinkingLevel
|
|
67
73
|
payloadSchema?: z.ZodType<P>
|
|
68
74
|
handler?: (ctx: SubagentContext<P>, runSession: RunSession) => Promise<void>
|
|
69
75
|
toolResultBudget?: ToolResultBudget
|
|
@@ -222,6 +228,7 @@ export const defaultCreateSessionForSubagent: CreateSessionForSubagent = (subage
|
|
|
222
228
|
...(resolveSubagentProfile(subagent, options) !== undefined
|
|
223
229
|
? { profile: resolveSubagentProfile(subagent, options) }
|
|
224
230
|
: {}),
|
|
231
|
+
...(subagent.thinkingLevel !== undefined ? { thinkingLevel: subagent.thinkingLevel } : {}),
|
|
225
232
|
...(subagent.toolResultBudget !== undefined ? { toolResultBudget: subagent.toolResultBudget } : {}),
|
|
226
233
|
...(subagent.bashPolicy !== undefined ? { bashPolicy: subagent.bashPolicy } : {}),
|
|
227
234
|
})
|
|
@@ -309,7 +316,10 @@ export async function invokeSubagent(name: string, options: InvokeSubagentOption
|
|
|
309
316
|
const { session, dispose, hooks, sessionId, agentDir, origin, getTranscriptPath, backgroundDrain } =
|
|
310
317
|
normalizeSubagentSession(await createSessionForSubagent(subagent, sessionOptions))
|
|
311
318
|
let aborted = false
|
|
312
|
-
let activeModelRef = resolveFallbackChain(
|
|
319
|
+
let activeModelRef = resolveFallbackChain(
|
|
320
|
+
effectiveModels(getConfig(), sessionOptions.spawnedByOrigin),
|
|
321
|
+
resolveSubagentProfile(subagent, sessionOptions),
|
|
322
|
+
)[0]!
|
|
313
323
|
// Latency tolerance is decided ONCE here, from the REQUESTED profile — not the
|
|
314
324
|
// one resolveProfile() landed on. A `deep` subagent whose operator never
|
|
315
325
|
// configured `models.deep` still runs on a background path nobody is watching
|
|
@@ -380,7 +390,10 @@ export async function invokeSubagent(name: string, options: InvokeSubagentOption
|
|
|
380
390
|
allowEscalation: false,
|
|
381
391
|
})
|
|
382
392
|
const result = await promptPersistentTurnWithFallback({
|
|
383
|
-
refs: resolveFallbackChain(
|
|
393
|
+
refs: resolveFallbackChain(
|
|
394
|
+
effectiveModels(getConfig(), sessionOptions.spawnedByOrigin),
|
|
395
|
+
resolveSubagentProfile(subagent, sessionOptions),
|
|
396
|
+
),
|
|
384
397
|
currentModelRef: activeModelRef,
|
|
385
398
|
profile: resolveSubagentProfile(subagent, sessionOptions),
|
|
386
399
|
retryPolicy,
|
|
@@ -681,7 +694,7 @@ function raceSubagentCompletion(
|
|
|
681
694
|
// The tags a subagent can use to wrap its structured result: the reviewer's
|
|
682
695
|
// `<review>`, the researcher's `<report>`. Fixed literals — never user input —
|
|
683
696
|
// so the per-tag patterns below are injection-safe.
|
|
684
|
-
type FinalBlockTag = 'review' | 'report'
|
|
697
|
+
type FinalBlockTag = 'review' | 'report' | 'qa'
|
|
685
698
|
|
|
686
699
|
// A complete <TAG>...</TAG> block. The block IS the result: same-message
|
|
687
700
|
// preamble/trailing chatter or a later summary turn must not become the captured
|
|
@@ -692,6 +705,7 @@ type FinalBlockTag = 'review' | 'report'
|
|
|
692
705
|
const FINAL_BLOCK_RE: Readonly<Record<FinalBlockTag, RegExp>> = {
|
|
693
706
|
review: /<review>[\s\S]*?<\/review>/g,
|
|
694
707
|
report: /<report>[\s\S]*?<\/report>/g,
|
|
708
|
+
qa: /<qa>[\s\S]*?<\/qa>/g,
|
|
695
709
|
}
|
|
696
710
|
|
|
697
711
|
function lastTaggedBlock(text: string, tag: FinalBlockTag): string | null {
|
|
@@ -718,7 +732,11 @@ function lastTaggedBlock(text: string, tag: FinalBlockTag): string | null {
|
|
|
718
732
|
// only catches children that declare none.
|
|
719
733
|
const DRAIN_MAX_CHILD_WAIT_MS = 600_000
|
|
720
734
|
|
|
721
|
-
const REQUIRED_FINAL_BLOCK: Readonly<Record<string, FinalBlockTag>> = {
|
|
735
|
+
const REQUIRED_FINAL_BLOCK: Readonly<Record<string, FinalBlockTag>> = {
|
|
736
|
+
researcher: 'report',
|
|
737
|
+
reviewer: 'review',
|
|
738
|
+
qa: 'qa',
|
|
739
|
+
}
|
|
722
740
|
|
|
723
741
|
// Bounded re-prompt budget for the required-block guard, mirroring the channel
|
|
724
742
|
// empty-response guard's MAX_EMPTY_TURN_RETRIES. A subagent that owes a result
|
|
@@ -732,9 +750,11 @@ const MAX_REQUIRED_BLOCK_RETRIES = 2
|
|
|
732
750
|
// The tail is tag-specific: each block has different mandatory child fields.
|
|
733
751
|
function renderRequiredBlockRetryNudge(tag: FinalBlockTag): string {
|
|
734
752
|
const tail =
|
|
735
|
-
tag === '
|
|
736
|
-
?
|
|
737
|
-
:
|
|
753
|
+
tag === 'qa'
|
|
754
|
+
? `Do NOT run more commands or start more processes.\n\nEmit the block from the scenarios you have already executed: <summary>, <target>, every <scenario> with the verdict you actually observed (mark unexecuted ones not-run), <findings>, <coverage_gaps>, and a <verdict>. If required scenarios never ran, the verdict is inconclusive, never pass.`
|
|
755
|
+
: tag === 'report'
|
|
756
|
+
? 'in particular do NOT call write_report. Do NOT continue researching or spawn more subagents.\n\nIf the report file was not successfully written, still emit the block: set <report_file>none</report_file>, <confidence>low</confidence> (explain the report artifact was not completed), and note in <open_questions> that the run should be retried.'
|
|
757
|
+
: `Do NOT re-run gh, diff reads, or spawn more subagents.\n\nEmit the block from the analysis you have already done: include your <summary>, whatever <finding> items you can support with evidence, and a <verdict> (approve | request-changes | comment). Only use a real verdict if you actually reached one. If you could NOT analyze enough to decide, do NOT invent a verdict — set <verdict>${INCOMPLETE_REVIEW_VERDICT}</verdict> exactly (this signals an incomplete review; the parent will not treat it as approve/request-changes/comment, even on a re-review).`
|
|
738
758
|
return `---
|
|
739
759
|
**[SYSTEM MESSAGE — not from a human]**
|
|
740
760
|
|
|
@@ -800,6 +820,24 @@ ${headline}. The ${name} subagent could not complete a review in this run: ${cau
|
|
|
800
820
|
</findings>
|
|
801
821
|
<verdict>${INCOMPLETE_REVIEW_VERDICT}</verdict>
|
|
802
822
|
</review>`
|
|
823
|
+
}
|
|
824
|
+
if (tag === 'qa') {
|
|
825
|
+
return `<qa>
|
|
826
|
+
<summary>
|
|
827
|
+
The ${name} subagent could not complete a QA run: ${cause}. No scenario results are reliable — do not treat any earlier text as a pass. Rerun QA${providerFailed ? ' once the provider recovers' : ''}.
|
|
828
|
+
</summary>
|
|
829
|
+
<target>
|
|
830
|
+
unknown
|
|
831
|
+
</target>
|
|
832
|
+
<scenarios>
|
|
833
|
+
</scenarios>
|
|
834
|
+
<findings>
|
|
835
|
+
</findings>
|
|
836
|
+
<coverage_gaps>
|
|
837
|
+
The entire QA request remains untested.
|
|
838
|
+
</coverage_gaps>
|
|
839
|
+
<verdict>inconclusive</verdict>
|
|
840
|
+
</qa>`
|
|
803
841
|
}
|
|
804
842
|
return `<${tag}>\nThe ${name} subagent could not produce the required <${tag}> block (${cause}) and could not recover; rerun it or inspect the transcript.\n</${tag}>`
|
|
805
843
|
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import {
|
|
2
|
+
renderInteractiveSessionContext,
|
|
3
|
+
renderSessionOrigin,
|
|
4
|
+
type SessionOrigin,
|
|
5
|
+
type SessionRoleContext,
|
|
6
|
+
} from './session-origin'
|
|
7
|
+
import {
|
|
8
|
+
buildSystemPolicy,
|
|
9
|
+
DEFAULT_SUBAGENT_ROSTER,
|
|
10
|
+
renderRuntimeBlock,
|
|
11
|
+
renderRuntimeNondisclosureRule,
|
|
12
|
+
} from './system-prompt'
|
|
13
|
+
|
|
14
|
+
// Origins with a conversation partner waiting on the reply get the full-mode
|
|
15
|
+
// session context: the interactive orchestration context with the live public
|
|
16
|
+
// roster, the MCP catalog, and the git nudge. Unattended origins (cron fires,
|
|
17
|
+
// default subagents, system processes) skip that context and the roster/git/MCP
|
|
18
|
+
// work it needs — their origin block already says what is expected. Every
|
|
19
|
+
// origin gets the same shared policy either way.
|
|
20
|
+
//
|
|
21
|
+
// Exhaustive switch (not a boolean expression) so a future origin kind forces
|
|
22
|
+
// the author to make an explicit full-or-slim decision at compile time. The
|
|
23
|
+
// previous form silently defaulted new origins to slim, which would have
|
|
24
|
+
// stripped the interactive context from a new interactive surface by
|
|
25
|
+
// accident.
|
|
26
|
+
export function deriveSystemPromptMode(origin: SessionOrigin | undefined): SystemPromptMode {
|
|
27
|
+
if (origin === undefined) return 'full'
|
|
28
|
+
switch (origin.kind) {
|
|
29
|
+
case 'tui':
|
|
30
|
+
case 'channel':
|
|
31
|
+
return 'full'
|
|
32
|
+
case 'cron':
|
|
33
|
+
case 'subagent':
|
|
34
|
+
case 'system':
|
|
35
|
+
return 'slim'
|
|
36
|
+
default: {
|
|
37
|
+
const _exhaustive: never = origin
|
|
38
|
+
void _exhaustive
|
|
39
|
+
return 'full'
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Pure inputs for `composeSystemPrompt`. Each field maps 1:1 to a rendered
|
|
45
|
+
// section of the prompt; callers that don't want a section pass `undefined`
|
|
46
|
+
// (or `''` for `gitNudge`). Extracted so the debug dumper in
|
|
47
|
+
// `scripts/dump-system-prompt.ts` can reuse the exact same composition
|
|
48
|
+
// pipeline `createResourceLoader` uses, with no risk of drift if the
|
|
49
|
+
// section order changes.
|
|
50
|
+
//
|
|
51
|
+
// `mode` selects only the optional session context, never the policy: every
|
|
52
|
+
// standard session starts with `buildSystemPolicy(branding)`.
|
|
53
|
+
// - 'full' (default) — TUI, channel, and origin-less sessions: appends the
|
|
54
|
+
// interactive context (`renderInteractiveSessionContext`) with the roster.
|
|
55
|
+
// - 'slim' — cron, default subagents, system processes: no interactive
|
|
56
|
+
// context; the origin block covers per-kind specifics (no human, side
|
|
57
|
+
// effects via tools, narrow scope).
|
|
58
|
+
export type SystemPromptMode = 'full' | 'slim'
|
|
59
|
+
|
|
60
|
+
export type SystemPromptComposition = {
|
|
61
|
+
mode?: SystemPromptMode
|
|
62
|
+
// Whether the prompt discloses that the agent runs on TypeClaw. When false,
|
|
63
|
+
// the policy's opening is phrased generically, the `## Runtime` version
|
|
64
|
+
// block is dropped, and the runtime-disclosure rule is appended. Defaults to
|
|
65
|
+
// true. Mirrors `config.branding`.
|
|
66
|
+
branding?: boolean
|
|
67
|
+
self: string
|
|
68
|
+
// Pre-rendered interactive-context roster (from `renderPublicSubagentRoster`).
|
|
69
|
+
// Kept as a ready string so this composer stays pure and registry-free; the
|
|
70
|
+
// registry-aware caller renders it. Ignored in slim mode (no interactive
|
|
71
|
+
// context). Falls back to `DEFAULT_SUBAGENT_ROSTER` when omitted.
|
|
72
|
+
subagentRoster?: string
|
|
73
|
+
runtimeVersion?: string
|
|
74
|
+
origin?: SessionOrigin
|
|
75
|
+
roleContext?: SessionRoleContext
|
|
76
|
+
mcpCatalog?: string
|
|
77
|
+
gitNudge: string
|
|
78
|
+
proactiveNextStepNudge?: string
|
|
79
|
+
evalHint?: string
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Section-order contract for the system prompt. Kept as a pure string→string
|
|
83
|
+
// transform so it can be exercised without disk, plugin runtime, or auth.
|
|
84
|
+
//
|
|
85
|
+
// Cache-suffix ordering: least-volatile sections first, most-volatile last.
|
|
86
|
+
// This minimises the number of cached prompt bytes invalidated when a
|
|
87
|
+
// section changes (the provider's prompt cache hits up to the first byte
|
|
88
|
+
// that differs).
|
|
89
|
+
//
|
|
90
|
+
// 0. shared policy — identical for every standard session of an agent.
|
|
91
|
+
// 1. self — IDENTITY.md + SOUL.md (plus any plugin `session.prompt` append).
|
|
92
|
+
// 2. runtime block (or the runtime-disclosure rule when branding is off) —
|
|
93
|
+
// only changes on typeclaw releases.
|
|
94
|
+
// 3. interactive context (full mode) — stable per agent registry, so it
|
|
95
|
+
// precedes the per-session origin block.
|
|
96
|
+
// 4. origin block + role — stable across sessions of the same kind; channel
|
|
97
|
+
// origins carry per-conversation details.
|
|
98
|
+
// 5. MCP catalog — changes when servers connect or disconnect.
|
|
99
|
+
// 6. gitNudge — rare changes; agent folders force-commit sessions/ and
|
|
100
|
+
// memory/ after every turn, so the dirty-files list is empty most of
|
|
101
|
+
// the time.
|
|
102
|
+
// 7. proactive next-step nudge — deterministic per model family.
|
|
103
|
+
//
|
|
104
|
+
// The wall-clock anchor that used to live here as `## Now` moved out
|
|
105
|
+
// entirely. It is now injected into the user turn at each `session.prompt`
|
|
106
|
+
// site via `renderTurnTimeAnchor` (src/agent/system-prompt.ts) so the
|
|
107
|
+
// stamp reflects the moment of THIS turn, not session creation. Per-turn
|
|
108
|
+
// injection costs zero cached bytes — the user turn is the non-cacheable
|
|
109
|
+
// suffix anyway — and removes the staleness failure mode where a session
|
|
110
|
+
// opened Friday answered "today is Friday" on Thursday. Retrieved memory and
|
|
111
|
+
// the live channel role ride in the user turn for the same reason.
|
|
112
|
+
//
|
|
113
|
+
// pi appends project context (AGENTS.md), the skill catalog, and the cwd
|
|
114
|
+
// after this preamble when it builds the final system message.
|
|
115
|
+
export function composeSystemPrompt(parts: SystemPromptComposition): string {
|
|
116
|
+
const branding = parts.branding ?? true
|
|
117
|
+
let prompt = `${buildSystemPolicy(branding)}\n\n${parts.self}`
|
|
118
|
+
if (branding && parts.runtimeVersion !== undefined) {
|
|
119
|
+
prompt = `${prompt}\n\n${renderRuntimeBlock(parts.runtimeVersion)}`
|
|
120
|
+
}
|
|
121
|
+
if (!branding) {
|
|
122
|
+
prompt = `${prompt}\n\n${renderRuntimeNondisclosureRule()}`
|
|
123
|
+
}
|
|
124
|
+
if (parts.mode !== 'slim') {
|
|
125
|
+
prompt = `${prompt}\n\n${renderInteractiveSessionContext(parts.subagentRoster ?? DEFAULT_SUBAGENT_ROSTER)}`
|
|
126
|
+
}
|
|
127
|
+
if (parts.origin !== undefined) {
|
|
128
|
+
prompt = `${prompt}\n\n${renderSessionOrigin(parts.origin, Date.now(), parts.roleContext)}`
|
|
129
|
+
}
|
|
130
|
+
if (parts.mcpCatalog !== undefined && parts.mcpCatalog !== '') {
|
|
131
|
+
prompt = `${prompt}\n\n${parts.mcpCatalog}`
|
|
132
|
+
}
|
|
133
|
+
if (parts.gitNudge !== '') {
|
|
134
|
+
prompt = `${prompt}\n\n${parts.gitNudge}`
|
|
135
|
+
}
|
|
136
|
+
if (parts.proactiveNextStepNudge !== undefined && parts.proactiveNextStepNudge !== '') {
|
|
137
|
+
prompt = `${prompt}\n\n${parts.proactiveNextStepNudge}`
|
|
138
|
+
}
|
|
139
|
+
if (parts.evalHint) prompt = `${prompt}\n\n${parts.evalHint}`
|
|
140
|
+
return prompt
|
|
141
|
+
}
|
|
@@ -65,7 +65,7 @@ ${BUNX_PACKAGE_RUNNER_RULE}
|
|
|
65
65
|
|
|
66
66
|
## Doing the work
|
|
67
67
|
|
|
68
|
-
Act on the practical task behind the wording, in any language: a status question ("is the build red?") usually wants the answer and the obvious next step, and a capability or permission phrasing ("can you add a retry?") is a request to do it. Take the
|
|
68
|
+
Act on the practical task behind the wording, in any language: a status question ("is the build red?") usually wants the answer and the obvious next step, and a capability or permission phrasing ("can you add a retry?") is a request to do it. Take the conventional reading, stay within the apparent request, and do not invent a larger project. Ask only when plausible readings would materially change scope, permissions, cost, or risk; when no one can answer, follow the session origin's instructions instead. When the next action is clear, start in the same turn rather than replying with a plan.
|
|
69
69
|
|
|
70
70
|
The deliverable is the requested result backed by real tool output, not a description, stub, or plan of one; keep working until you have exercised it. If a tool, install, or network call blocks the real path, say so and try an alternative. Never substitute fabricated output (made-up data, file contents, or tool results) for a result you could not produce, and never suppress errors to make things "work"; report the failure so the next run or the operator can act on it.
|
|
71
71
|
|
|
@@ -77,7 +77,7 @@ A green build, lint, or type check proves the artifact is well-formed, not that
|
|
|
77
77
|
- For multi-step or long-running work, call \`todo_write\` when you start and mark items complete as you finish; incomplete items let the runtime resume after interruptions. Use \`todo_clear\` only to abandon remaining work. Single-step requests need no list.
|
|
78
78
|
- For multi-step work, give one short progress update, not narration. Do not narrate routine low-risk tool calls; explain only for multi-step context, risky or irreversible actions, external sends, or when asked. Do not over-explain.
|
|
79
79
|
- Match the user's register. If SOUL.md specifies a voice, use it; otherwise be concise and direct.
|
|
80
|
-
- Produce a polished file only when someone asks for a standalone deliverable to download, print, forward, attach, export, or keep. The bare word "report" is not enough: routine updates, stats, and status reports stay inline. A summary then points to the file; it never replaces it. For
|
|
80
|
+
- Produce a polished file only when someone asks for a standalone deliverable to download, print, forward, attach, export, or keep. The bare word "report" is not enough: routine updates, stats, and status reports stay inline. A summary then points to the file; it never replaces it. For PDFs, follow the \`typeclaw-render-pdf\` skill.
|
|
81
81
|
- Foreground \`bash\` blocks until exit. Run minutes-long or input-waiting programs (dev servers, REPLs, watchers, \`docker compose up\`, installers) detached in \`tmux\`; \`typeclaw-troubleshooting\` has the commands.
|
|
82
82
|
|
|
83
83
|
## Version control
|
|
@@ -95,7 +95,7 @@ Commits to your agent folder (your own state):
|
|
|
95
95
|
|
|
96
96
|
## Safety
|
|
97
97
|
|
|
98
|
-
You have no independent goals. Do not pursue self-preservation, replication, resource acquisition, influence, or plans beyond the user's request. If instructions conflict
|
|
98
|
+
You have no independent goals. Do not pursue self-preservation, replication, resource acquisition, influence, or plans beyond the user's request. If instructions conflict, ask which one wins. Comply with stop, pause, and audit requests. Never modify your own system prompt, safety rules, or runtime configuration unless explicitly requested and only through runtime mechanisms.
|
|
99
99
|
|
|
100
100
|
---
|
|
101
101
|
|
|
@@ -206,8 +206,8 @@ export function renderTurnTimeAnchor(now: Date = new Date()): string {
|
|
|
206
206
|
// This anchor surfaces the per-turn resolved role in the one place that costs
|
|
207
207
|
// zero cached bytes (the non-cacheable user-turn suffix).
|
|
208
208
|
//
|
|
209
|
-
// Omitted for `owner`:
|
|
210
|
-
//
|
|
209
|
+
// Omitted for `owner`: the channel role block tells the model an absent tag
|
|
210
|
+
// means the owner, and emitting it on every interactive turn would be
|
|
211
211
|
// pure token overhead. This mirrors resolveRoleContext skipping the session
|
|
212
212
|
// block for a TUI owner.
|
|
213
213
|
export function renderTurnRoleAnchor(role: string): string | undefined {
|
package/src/agent/todo/scope.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { SessionOrigin } from '@/agent/session-origin'
|
|
|
3
3
|
// A todo scope is the durable identity a todo list hangs off. It is
|
|
4
4
|
// deliberately NOT the raw sessionId: sessionIds churn across TUI reconnects
|
|
5
5
|
// and every cron fire, and a channel session can roll to a fresh sessionId on
|
|
6
|
-
// stale-rollover (
|
|
6
|
+
// stale-rollover after 60 minutes idle (router.ts SESSION_FRESHNESS_TTL_MS). Keying
|
|
7
7
|
// on origin identity instead lets a todo list survive those transitions so
|
|
8
8
|
// interrupted work can be resumed.
|
|
9
9
|
//
|
|
@@ -177,8 +177,13 @@ export async function enforceAndPinToolFiles(
|
|
|
177
177
|
let copiedBytes = 0
|
|
178
178
|
for (let i = 0; i < verified.length; i++) {
|
|
179
179
|
const input = verified[i] as VerifiedInput
|
|
180
|
-
const
|
|
180
|
+
const slot = path.join(dir, String(i))
|
|
181
|
+
// Files keep their original basename under a per-operand slot: tools that
|
|
182
|
+
// derive a name or type from the path (channel uploads, mime sniffing by
|
|
183
|
+
// extension) would otherwise see the bare index, e.g. a Discord file named `0`.
|
|
184
|
+
const pinned = input.kind === 'file' ? path.join(slot, path.basename(input.original)) : slot
|
|
181
185
|
if (input.kind === 'file') {
|
|
186
|
+
await mkdir(slot, { mode: 0o700 })
|
|
182
187
|
const source = await openInput(input.resolved, input.original)
|
|
183
188
|
try {
|
|
184
189
|
const opened = await source.stat()
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
} from '@/channels/router'
|
|
11
11
|
import { ADAPTER_IDS, type AdapterId } from '@/channels/schema'
|
|
12
12
|
import type { EditMessageResult } from '@/channels/types'
|
|
13
|
+
import type { ChannelOutboundOrigin } from '@/plugin'
|
|
13
14
|
|
|
14
15
|
import { type ChannelToolLogger, consoleChannelLogger, formatChannelToolFailure } from './channel-log'
|
|
15
16
|
import { renderOutboundEcho, TOOL_RESULT_PREFIX } from './channel-reply'
|
|
@@ -17,10 +18,15 @@ import { fenceToolResult } from './runtime-notice'
|
|
|
17
18
|
|
|
18
19
|
export type CreateChannelEditToolOptions = {
|
|
19
20
|
router: ChannelRouter
|
|
21
|
+
getOutboundOrigin?: () => ChannelOutboundOrigin | undefined
|
|
20
22
|
logger?: ChannelToolLogger
|
|
21
23
|
}
|
|
22
24
|
|
|
23
|
-
export function createChannelEditTool({
|
|
25
|
+
export function createChannelEditTool({
|
|
26
|
+
router,
|
|
27
|
+
getOutboundOrigin,
|
|
28
|
+
logger = consoleChannelLogger,
|
|
29
|
+
}: CreateChannelEditToolOptions) {
|
|
24
30
|
return defineTool({
|
|
25
31
|
name: 'channel_edit',
|
|
26
32
|
label: 'Channel Edit',
|
|
@@ -96,20 +102,24 @@ export function createChannelEditTool({ router, logger = consoleChannelLogger }:
|
|
|
96
102
|
const text = stripThinkBlocks(params.text)
|
|
97
103
|
if (text === '') return deny('the replacement text is empty after removing reasoning blocks')
|
|
98
104
|
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
const outboundOrigin = getOutboundOrigin?.()
|
|
106
|
+
const result = await router.editMessage(
|
|
107
|
+
{
|
|
108
|
+
adapter,
|
|
109
|
+
workspace: params.workspace,
|
|
110
|
+
chat: params.chat,
|
|
111
|
+
...(params.thread !== undefined ? { thread: params.thread } : {}),
|
|
112
|
+
messageId: params.message_id,
|
|
113
|
+
text,
|
|
114
|
+
},
|
|
115
|
+
outboundOrigin ? { origin: outboundOrigin } : undefined,
|
|
116
|
+
)
|
|
107
117
|
|
|
108
118
|
if (!result.ok) {
|
|
109
119
|
return deny(`${adapter}:${params.workspace}/${params.chat}: ${result.error}`, result.code)
|
|
110
120
|
}
|
|
111
121
|
|
|
112
|
-
const echo = renderOutboundEcho(text, undefined)
|
|
122
|
+
const echo = renderOutboundEcho(result.deliveredText ?? text, undefined)
|
|
113
123
|
const receipt = `edited ${adapter}:${params.workspace}/${params.chat} message ${params.message_id}: ${echo}`
|
|
114
124
|
return {
|
|
115
125
|
content: [{ type: 'text' as const, text: fenceToolResult(receipt) }],
|