typeclaw 0.49.0 → 0.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/agent/attention-escalation.d.ts +18 -0
- package/dist/types/agent/auth.d.ts +7 -0
- package/dist/types/agent/bash-sandbox-env.d.ts +15 -0
- package/dist/types/agent/bash-sandbox-proc.d.ts +8 -0
- package/dist/types/agent/bash-sandbox.d.ts +94 -0
- package/dist/types/agent/compaction.d.ts +8 -0
- package/dist/types/agent/git-nudge.d.ts +6 -0
- package/dist/types/agent/guard-types.d.ts +25 -0
- package/dist/types/agent/guards.d.ts +7 -0
- package/dist/types/agent/idle-compaction.d.ts +8 -0
- package/dist/types/agent/index.d.ts +151 -0
- package/dist/types/agent/live-subagents.d.ts +113 -0
- package/dist/types/agent/llm-replay-sanitizer.d.ts +11 -0
- package/dist/types/agent/loop-guard.d.ts +67 -0
- package/dist/types/agent/model-fallback.d.ts +29 -0
- package/dist/types/agent/model-overrides.d.ts +8 -0
- package/dist/types/agent/multimodal/index.d.ts +2 -0
- package/dist/types/agent/multimodal/look-at.d.ts +60 -0
- package/dist/types/agent/multimodal/looker.d.ts +61 -0
- package/dist/types/agent/multimodal/read-redirect.d.ts +6 -0
- package/dist/types/agent/network/response-body.d.ts +1 -0
- package/dist/types/agent/network/safe-http.d.ts +46 -0
- package/dist/types/agent/output-allowance.d.ts +4 -0
- package/dist/types/agent/plugin-tools.d.ts +58 -0
- package/dist/types/agent/proactive-next-step-nudge.d.ts +2 -0
- package/dist/types/agent/prompt-cache-key.d.ts +3 -0
- package/dist/types/agent/provider-error.d.ts +23 -0
- package/dist/types/agent/reload-tool.d.ts +10 -0
- package/dist/types/agent/restart/index.d.ts +31 -0
- package/dist/types/agent/restart-handoff/index.d.ts +32 -0
- package/dist/types/agent/restart-handoff/paths.d.ts +1 -0
- package/dist/types/agent/retry-same-ref.d.ts +41 -0
- package/dist/types/agent/reviewer-activity.d.ts +3 -0
- package/dist/types/agent/reviewer-bash-policy.d.ts +8 -0
- package/dist/types/agent/self.d.ts +1 -0
- package/dist/types/agent/session-meta.d.ts +28 -0
- package/dist/types/agent/session-origin.d.ts +65 -0
- package/dist/types/agent/subagent-cache-keepalive.d.ts +38 -0
- package/dist/types/agent/subagent-completion-reminder.d.ts +29 -0
- package/dist/types/agent/subagent-drain.d.ts +25 -0
- package/dist/types/agent/subagent-session.d.ts +3 -0
- package/dist/types/agent/subagents.d.ts +153 -0
- package/dist/types/agent/system-prompt-composition.d.ts +17 -0
- package/dist/types/agent/system-prompt.d.ts +7 -0
- package/dist/types/agent/throttle-circuit.d.ts +25 -0
- package/dist/types/agent/todo/continuation-policy.d.ts +54 -0
- package/dist/types/agent/todo/continuation-state.d.ts +11 -0
- package/dist/types/agent/todo/continuation-wiring.d.ts +32 -0
- package/dist/types/agent/todo/continuation.d.ts +21 -0
- package/dist/types/agent/todo/scope.d.ts +6 -0
- package/dist/types/agent/todo/store.d.ts +16 -0
- package/dist/types/agent/tool-error-remediation.d.ts +1 -0
- package/dist/types/agent/tool-file-safety.d.ts +78 -0
- package/dist/types/agent/tool-not-found-nudge.d.ts +9 -0
- package/dist/types/agent/tool-result-budget.d.ts +15 -0
- package/dist/types/agent/tools/channel-disengage.d.ts +18 -0
- package/dist/types/agent/tools/channel-edit.d.ts +19 -0
- package/dist/types/agent/tools/channel-fetch-attachment.d.ts +36 -0
- package/dist/types/agent/tools/channel-handoff.d.ts +13 -0
- package/dist/types/agent/tools/channel-history-render.d.ts +3 -0
- package/dist/types/agent/tools/channel-history.d.ts +25 -0
- package/dist/types/agent/tools/channel-log.d.ts +5 -0
- package/dist/types/agent/tools/channel-react.d.ts +23 -0
- package/dist/types/agent/tools/channel-read.d.ts +27 -0
- package/dist/types/agent/tools/channel-reply.d.ts +47 -0
- package/dist/types/agent/tools/channel-send.d.ts +42 -0
- package/dist/types/agent/tools/channel-session-search.d.ts +10 -0
- package/dist/types/agent/tools/curl-impersonate.d.ts +37 -0
- package/dist/types/agent/tools/ddg.d.ts +27 -0
- package/dist/types/agent/tools/grant-role.d.ts +25 -0
- package/dist/types/agent/tools/keyed-semaphore.d.ts +10 -0
- package/dist/types/agent/tools/post-github-review.d.ts +38 -0
- package/dist/types/agent/tools/restart.d.ts +25 -0
- package/dist/types/agent/tools/runtime-notice.d.ts +3 -0
- package/dist/types/agent/tools/search-retry.d.ts +16 -0
- package/dist/types/agent/tools/skip-response.d.ts +17 -0
- package/dist/types/agent/tools/spawn-subagent.d.ts +77 -0
- package/dist/types/agent/tools/stream-snapshot.d.ts +23 -0
- package/dist/types/agent/tools/subagent-access.d.ts +20 -0
- package/dist/types/agent/tools/subagent-cancel.d.ts +23 -0
- package/dist/types/agent/tools/subagent-output.d.ts +50 -0
- package/dist/types/agent/tools/todo/index.d.ts +14 -0
- package/dist/types/agent/tools/webfetch/adaptive-html.d.ts +29 -0
- package/dist/types/agent/tools/webfetch/fetch.d.ts +26 -0
- package/dist/types/agent/tools/webfetch/html-lexical.d.ts +27 -0
- package/dist/types/agent/tools/webfetch/index.d.ts +1 -0
- package/dist/types/agent/tools/webfetch/inline-style-visibility.d.ts +3 -0
- package/dist/types/agent/tools/webfetch/strategies/grep.d.ts +11 -0
- package/dist/types/agent/tools/webfetch/strategies/jq.d.ts +4 -0
- package/dist/types/agent/tools/webfetch/strategies/raw.d.ts +1 -0
- package/dist/types/agent/tools/webfetch/strategies/readability.d.ts +16 -0
- package/dist/types/agent/tools/webfetch/strategies/selector.d.ts +4 -0
- package/dist/types/agent/tools/webfetch/strategies/snapshot.d.ts +1 -0
- package/dist/types/agent/tools/webfetch/tool.d.ts +15 -0
- package/dist/types/agent/tools/webfetch/types.d.ts +32 -0
- package/dist/types/agent/tools/websearch.d.ts +17 -0
- package/dist/types/agent/tools/wikipedia.d.ts +7 -0
- package/dist/types/agent/tools-without-local-file-operands.d.ts +1 -0
- package/dist/types/agent/turn-runner.d.ts +36 -0
- package/dist/types/agent-messenger/config-dir.d.ts +19 -0
- package/dist/types/browser/dockerfile.d.ts +2 -0
- package/dist/types/browser/registry.d.ts +49 -0
- package/dist/types/bundled-plugins/bun-hygiene/policy.d.ts +18 -0
- package/dist/types/bundled-plugins/github-cli-auth/git-askpass.d.ts +5 -0
- package/dist/types/bundled-plugins/guard/keys.d.ts +6 -0
- package/dist/types/bundled-plugins/guard/policies/managed-config.d.ts +7 -0
- package/dist/types/bundled-plugins/guard/policies/memory-topics-delete.d.ts +11 -0
- package/dist/types/bundled-plugins/guard/policies/memory-topics-write.d.ts +7 -0
- package/dist/types/bundled-plugins/guard/policies/non-workspace-write.d.ts +9 -0
- package/dist/types/bundled-plugins/guard/policies/skill-authoring.d.ts +20 -0
- package/dist/types/bundled-plugins/guard/policies/uncommitted-changes.d.ts +12 -0
- package/dist/types/bundled-plugins/guard/policy.d.ts +11 -0
- package/dist/types/bundled-plugins/memory/secret-detector.d.ts +11 -0
- package/dist/types/bundled-plugins/memory/slug.d.ts +4 -0
- package/dist/types/bundled-plugins/security/permissions.d.ts +20 -0
- package/dist/types/bundled-plugins/security/policies/private-surface-read.d.ts +34 -0
- package/dist/types/bundled-plugins/security/policies/ssrf.d.ts +18 -0
- package/dist/types/bundled-plugins/security/policy.d.ts +4 -0
- package/dist/types/channels/adapter-namespace.d.ts +2 -0
- package/dist/types/channels/adapters/mention-hints.d.ts +12 -0
- package/dist/types/channels/adapters/webex-id-ref.d.ts +5 -0
- package/dist/types/channels/background-handoff.d.ts +56 -0
- package/dist/types/channels/background-obligations.d.ts +135 -0
- package/dist/types/channels/catch-up.d.ts +26 -0
- package/dist/types/channels/commands.d.ts +2 -0
- package/dist/types/channels/completion-claim.d.ts +20 -0
- package/dist/types/channels/continuation-willingness.d.ts +1 -0
- package/dist/types/channels/continuity-types.d.ts +75 -0
- package/dist/types/channels/describe-error.d.ts +1 -0
- package/dist/types/channels/engagement.d.ts +34 -0
- package/dist/types/channels/github-false-receipt.d.ts +20 -0
- package/dist/types/channels/github-repo.d.ts +2 -0
- package/dist/types/channels/github-rereview-guard.d.ts +24 -0
- package/dist/types/channels/github-review-check.d.ts +135 -0
- package/dist/types/channels/github-review-claim.d.ts +3 -0
- package/dist/types/channels/github-review-turn-ledger.d.ts +71 -0
- package/dist/types/channels/github-review-verdict-coordinator.d.ts +117 -0
- package/dist/types/channels/github-token-bridge.d.ts +20 -0
- package/dist/types/channels/github-verdict-activity.d.ts +12 -0
- package/dist/types/channels/inbound-journal.d.ts +272 -0
- package/dist/types/channels/last-alive.d.ts +3 -0
- package/dist/types/channels/membership-cache.d.ts +27 -0
- package/dist/types/channels/membership.d.ts +21 -0
- package/dist/types/channels/outbound-flood-filter.d.ts +7 -0
- package/dist/types/channels/participants.d.ts +4 -0
- package/dist/types/channels/persistence.d.ts +32 -0
- package/dist/types/channels/recovery-notice.d.ts +26 -0
- package/dist/types/channels/recovery-outbox.d.ts +58 -0
- package/dist/types/channels/router.d.ts +760 -0
- package/dist/types/channels/schema.d.ts +501 -0
- package/dist/types/channels/session-handoff.d.ts +58 -0
- package/dist/types/channels/session-search.d.ts +29 -0
- package/dist/types/channels/types.d.ts +414 -0
- package/dist/types/channels/waiting-reactions.d.ts +25 -0
- package/dist/types/cli/builtins.d.ts +2 -0
- package/dist/types/cli/command-meta.d.ts +9 -0
- package/dist/types/coding-agent/broker-body.d.ts +7 -0
- package/dist/types/coding-agent/broker.d.ts +22 -0
- package/dist/types/coding-agent/claude.d.ts +22 -0
- package/dist/types/coding-agent/codex.d.ts +19 -0
- package/dist/types/coding-agent/index.d.ts +71 -0
- package/dist/types/coding-agent/omo-state.d.ts +2 -0
- package/dist/types/coding-agent/omo-stream.d.ts +22 -0
- package/dist/types/coding-agent/omo.d.ts +133 -0
- package/dist/types/coding-agent/runner.d.ts +35 -0
- package/dist/types/coding-agent/tool.d.ts +27 -0
- package/dist/types/coding-agent/worktree.d.ts +22 -0
- package/dist/types/commands/index.d.ts +45 -0
- package/dist/types/config/config.d.ts +827 -0
- package/dist/types/config/index.d.ts +3 -0
- package/dist/types/config/model-overrides.d.ts +3 -0
- package/dist/types/config/providers.d.ts +1458 -0
- package/dist/types/config/reloadable.d.ts +9 -0
- package/dist/types/container/agent-operation-lock.d.ts +31 -0
- package/dist/types/container/build-cache.d.ts +39 -0
- package/dist/types/container/compose-project.d.ts +1 -0
- package/dist/types/container/controller.d.ts +25 -0
- package/dist/types/container/docker-app.d.ts +23 -0
- package/dist/types/container/exit-reason.d.ts +10 -0
- package/dist/types/container/index.d.ts +14 -0
- package/dist/types/container/log-archive.d.ts +68 -0
- package/dist/types/container/log-colors.d.ts +3 -0
- package/dist/types/container/log-timestamps.d.ts +9 -0
- package/dist/types/container/logs.d.ts +37 -0
- package/dist/types/container/memory-limit.d.ts +13 -0
- package/dist/types/container/memory-oversubscription.d.ts +20 -0
- package/dist/types/container/oom-events.d.ts +18 -0
- package/dist/types/container/port.d.ts +18 -0
- package/dist/types/container/require-running.d.ts +16 -0
- package/dist/types/container/restart.d.ts +32 -0
- package/dist/types/container/shared.d.ts +93 -0
- package/dist/types/container/shell.d.ts +35 -0
- package/dist/types/container/start.d.ts +145 -0
- package/dist/types/container/stats.d.ts +31 -0
- package/dist/types/container/status.d.ts +25 -0
- package/dist/types/container/stop.d.ts +24 -0
- package/dist/types/container/tool-oom-priority.d.ts +4 -0
- package/dist/types/container/verify-running.d.ts +49 -0
- package/dist/types/cron/consumer.d.ts +42 -0
- package/dist/types/cron/count-state.d.ts +24 -0
- package/dist/types/cron/index.d.ts +21 -0
- package/dist/types/cron/list.d.ts +33 -0
- package/dist/types/cron/reloadable.d.ts +11 -0
- package/dist/types/cron/scheduler.d.ts +51 -0
- package/dist/types/cron/schema.d.ts +108 -0
- package/dist/types/dependencies/bin-resolver.d.ts +28 -0
- package/dist/types/dependencies/bins.d.ts +22 -0
- package/dist/types/dependencies/index.d.ts +2 -0
- package/dist/types/eval/cell.d.ts +26 -0
- package/dist/types/eval/config.d.ts +19 -0
- package/dist/types/eval/dispatch.d.ts +7 -0
- package/dist/types/eval/kernel.d.ts +28 -0
- package/dist/types/eval/process.d.ts +23 -0
- package/dist/types/eval/protocol.d.ts +34 -0
- package/dist/types/eval/sandbox.d.ts +10 -0
- package/dist/types/eval/tool.d.ts +17 -0
- package/dist/types/eval/wire.d.ts +33 -0
- package/dist/types/git/bound-gc-config.d.ts +4 -0
- package/dist/types/git/hookless.d.ts +1 -0
- package/dist/types/git/reconcile-ignored.d.ts +13 -0
- package/dist/types/git/resolve-agent-git.d.ts +8 -0
- package/dist/types/git/resolve-identity.d.ts +10 -0
- package/dist/types/git/run.d.ts +24 -0
- package/dist/types/git/system-commit.d.ts +2 -0
- package/dist/types/hostd/client.d.ts +13 -0
- package/dist/types/hostd/models.d.ts +1 -0
- package/dist/types/hostd/paths.d.ts +17 -0
- package/dist/types/hostd/protocol.d.ts +93 -0
- package/dist/types/hostd/spawn.d.ts +17 -0
- package/dist/types/hostd/version.d.ts +18 -0
- package/dist/types/init/auto-upgrade.d.ts +41 -0
- package/dist/types/init/cli-version.d.ts +7 -0
- package/dist/types/init/dockerfile.d.ts +34 -0
- package/dist/types/init/ensure-deps.d.ts +17 -0
- package/dist/types/init/env-file.d.ts +3 -0
- package/dist/types/init/gitignore.d.ts +5 -0
- package/dist/types/init/local-source-stamp.d.ts +3 -0
- package/dist/types/init/packagejson.d.ts +7 -0
- package/dist/types/init/paths.d.ts +3 -0
- package/dist/types/init/reconcile-plugin-deps.d.ts +13 -0
- package/dist/types/init/run-bun-install.d.ts +16 -0
- package/dist/types/init/windows-dev-link.d.ts +8 -0
- package/dist/types/mcp/catalog.d.ts +7 -0
- package/dist/types/mcp/client.d.ts +58 -0
- package/dist/types/mcp/manager.d.ts +56 -0
- package/dist/types/mcp/tools.d.ts +23 -0
- package/dist/types/models/embedding-model.d.ts +20 -0
- package/dist/types/models/transformers-version.d.ts +1 -0
- package/dist/types/network/internal-destinations.d.ts +29 -0
- package/dist/types/operations/classify-tool-outcome.d.ts +35 -0
- package/dist/types/operations/incidents.d.ts +47 -0
- package/dist/types/operations/index.d.ts +3 -0
- package/dist/types/operations/remediations.d.ts +25 -0
- package/dist/types/path-safety/real-intended-path.d.ts +9 -0
- package/dist/types/permissions/builtins.d.ts +25 -0
- package/dist/types/permissions/grant.d.ts +19 -0
- package/dist/types/permissions/index.d.ts +6 -0
- package/dist/types/permissions/match-rule.d.ts +28 -0
- package/dist/types/permissions/permissions.d.ts +42 -0
- package/dist/types/permissions/resolve.d.ts +25 -0
- package/dist/types/permissions/schema.d.ts +14 -0
- package/dist/types/plugin/context.d.ts +20 -0
- package/dist/types/plugin/core-tool-names.d.ts +4 -0
- package/dist/types/plugin/define.d.ts +46 -0
- package/dist/types/plugin/hooks.d.ts +52 -0
- package/dist/types/plugin/index.d.ts +11 -0
- package/dist/types/plugin/load-skill.d.ts +14 -0
- package/dist/types/plugin/loader.d.ts +25 -0
- package/dist/types/plugin/manager.d.ts +42 -0
- package/dist/types/plugin/registry.d.ts +73 -0
- package/dist/types/plugin/skills.d.ts +11 -0
- package/dist/types/plugin/types.d.ts +336 -0
- package/dist/types/plugin/zod-introspect.d.ts +11 -0
- package/dist/types/reload/client.d.ts +11 -0
- package/dist/types/reload/docker-exec-client.d.ts +11 -0
- package/dist/types/reload/format.d.ts +2 -0
- package/dist/types/reload/index.d.ts +6 -0
- package/dist/types/reload/recover.d.ts +22 -0
- package/dist/types/reload/registry.d.ts +10 -0
- package/dist/types/reload/types.d.ts +25 -0
- package/dist/types/role-claim/client.d.ts +20 -0
- package/dist/types/role-claim/code.d.ts +4 -0
- package/dist/types/role-claim/controller.d.ts +59 -0
- package/dist/types/role-claim/index.d.ts +6 -0
- package/dist/types/role-claim/match-rule.d.ts +9 -0
- package/dist/types/role-claim/pending.d.ts +35 -0
- package/dist/types/role-claim/reload-after-claim.d.ts +16 -0
- package/dist/types/run/llm-fetch-observer.d.ts +50 -0
- package/dist/types/sandbox/availability.d.ts +21 -0
- package/dist/types/sandbox/build.d.ts +7 -0
- package/dist/types/sandbox/canonical-secrets.d.ts +8 -0
- package/dist/types/sandbox/coding-agent.d.ts +20 -0
- package/dist/types/sandbox/dependency-bins.d.ts +19 -0
- package/dist/types/sandbox/dev-source.d.ts +4 -0
- package/dist/types/sandbox/env-exposure.d.ts +3 -0
- package/dist/types/sandbox/errors.d.ts +20 -0
- package/dist/types/sandbox/hidden-paths.d.ts +11 -0
- package/dist/types/sandbox/index.d.ts +14 -0
- package/dist/types/sandbox/package-install.d.ts +1 -0
- package/dist/types/sandbox/policy.d.ts +71 -0
- package/dist/types/sandbox/privileged-runtime.d.ts +13 -0
- package/dist/types/sandbox/quote.d.ts +2 -0
- package/dist/types/sandbox/runtime-private.d.ts +1 -0
- package/dist/types/sandbox/session-tmp.d.ts +6 -0
- package/dist/types/sandbox/symlinks.d.ts +6 -0
- package/dist/types/sandbox/writable-zones.d.ts +15 -0
- package/dist/types/secrets/coding-agent-auth.d.ts +25 -0
- package/dist/types/secrets/defaults.d.ts +21 -0
- package/dist/types/secrets/export-github-cli-store.d.ts +22 -0
- package/dist/types/secrets/hydrate.d.ts +7 -0
- package/dist/types/secrets/index.d.ts +7 -0
- package/dist/types/secrets/provision-github-cli-store.d.ts +45 -0
- package/dist/types/secrets/refresh-provider-oauth.d.ts +22 -0
- package/dist/types/secrets/resolve.d.ts +14 -0
- package/dist/types/secrets/schema.d.ts +840 -0
- package/dist/types/secrets/storage.d.ts +56 -0
- package/dist/types/shared/host-locale.d.ts +1 -0
- package/dist/types/shared/index.d.ts +5 -0
- package/dist/types/shared/local-time.d.ts +4 -0
- package/dist/types/shared/platform.d.ts +2 -0
- package/dist/types/shared/protocol.d.ts +424 -0
- package/dist/types/shared/style-text.d.ts +3 -0
- package/dist/types/shared/wsl.d.ts +17 -0
- package/dist/types/stream/broker.d.ts +2 -0
- package/dist/types/stream/index.d.ts +2 -0
- package/dist/types/stream/types.d.ts +71 -0
- package/package.json +13 -6
- package/scripts/build-plugin-types.ts +105 -0
- package/scripts/check-plugin-sdk.ts +111 -0
- package/scripts/require-parallel.ts +5 -32
- package/src/agent/bash-sandbox-env.ts +104 -0
- package/src/agent/bash-sandbox-proc.ts +70 -0
- package/src/agent/bash-sandbox.ts +225 -0
- package/src/agent/compaction.ts +22 -10
- package/src/agent/guard-types.ts +3 -0
- package/src/agent/guards.ts +4 -0
- package/src/agent/idle-compaction.ts +178 -0
- package/src/agent/index.ts +139 -172
- package/src/agent/live-subagents.ts +19 -0
- package/src/agent/multimodal/look-at.ts +22 -9
- package/src/agent/output-allowance.ts +7 -0
- package/src/agent/plugin-tools.ts +39 -377
- package/src/agent/reviewer-bash-policy.ts +41 -1
- package/src/agent/session-origin.ts +28 -11
- package/src/agent/subagent-cache-keepalive.ts +198 -0
- package/src/agent/subagent-completion-reminder.ts +2 -2
- package/src/agent/subagent-session.ts +6 -0
- package/src/agent/subagents.ts +46 -8
- package/src/agent/system-prompt-composition.ts +141 -0
- package/src/agent/system-prompt.ts +5 -5
- package/src/agent/todo/scope.ts +1 -1
- package/src/agent/tool-file-safety.ts +6 -1
- package/src/agent/tools/channel-edit.ts +20 -10
- package/src/agent/tools/channel-fetch-attachment.ts +12 -5
- package/src/agent/tools/channel-handoff.ts +72 -0
- package/src/agent/tools/channel-read.ts +57 -10
- package/src/agent/tools/channel-reply.ts +33 -26
- package/src/agent/tools/channel-send.ts +21 -13
- package/src/agent/tools/channel-session-search.ts +35 -0
- package/src/agent/tools/curl-impersonate.ts +11 -4
- package/src/agent/tools/ddg.ts +84 -16
- package/src/agent/tools/spawn-subagent.ts +27 -11
- package/src/agent/tools/stream-snapshot.ts +15 -2
- package/src/agent/tools/subagent-access.ts +11 -4
- package/src/agent/tools-without-local-file-operands.ts +4 -0
- package/src/browser/bsk-shim.mjs +74 -0
- package/src/browser/dockerfile.ts +84 -0
- package/src/browser/egress.ts +104 -0
- package/src/browser/fill-secret.ts +307 -0
- package/src/browser/managed-browser.ts +205 -0
- package/src/browser/registry.ts +110 -0
- package/src/browser/relay.ts +231 -0
- package/src/browser/sandbox-entry.ts +167 -0
- package/src/bundled-plugins/agent-browser/index.ts +2 -0
- package/src/bundled-plugins/browser-agent/browser-agent.ts +89 -0
- package/src/bundled-plugins/browser-agent/index.ts +12 -0
- package/src/bundled-plugins/doc-render/index.ts +0 -10
- package/src/bundled-plugins/doc-render/render.ts +83 -111
- package/src/bundled-plugins/doc-render/skills/typeclaw-render-pdf/SKILL.md +152 -257
- package/src/bundled-plugins/explorer/explorer.ts +1 -1
- package/src/bundled-plugins/github-cli-auth/gh-command.ts +4 -0
- package/src/bundled-plugins/github-cli-auth/gh-review-detect.ts +40 -16
- package/src/bundled-plugins/github-cli-auth/git-auth-diagnostic.ts +95 -0
- package/src/bundled-plugins/github-cli-auth/graphql-auth-nudge.ts +12 -7
- package/src/bundled-plugins/github-cli-auth/index.ts +85 -60
- package/src/bundled-plugins/managed-browser/index.ts +179 -0
- package/src/bundled-plugins/managed-browser/skills/browser-use/browser-use/SKILL.md +27 -0
- package/src/bundled-plugins/managed-browser/skills/browserskill/browserskill/SKILL.md +28 -0
- package/src/bundled-plugins/managed-browser/skills/omowright/omowright/SKILL.md +40 -0
- package/src/bundled-plugins/memory/dreaming.ts +4 -1
- package/src/bundled-plugins/memory/load-memory.ts +2 -4
- package/src/bundled-plugins/memory/memory-logger.ts +74 -2
- package/src/bundled-plugins/memory/transcript-preload.ts +103 -0
- package/src/bundled-plugins/memory/vector/hybrid.ts +25 -14
- package/src/bundled-plugins/operator/operator.ts +1 -1
- package/src/bundled-plugins/qa/index.ts +11 -0
- package/src/bundled-plugins/qa/qa.ts +160 -0
- package/src/bundled-plugins/qa/skills/qa-cli.ts +50 -0
- package/src/bundled-plugins/qa/skills/qa-general.ts +30 -0
- package/src/bundled-plugins/qa/skills/qa-http.ts +39 -0
- package/src/bundled-plugins/qa/skills/qa-pr.ts +51 -0
- package/src/bundled-plugins/qa/skills/qa-web.ts +49 -0
- package/src/bundled-plugins/security/index.ts +53 -34
- package/src/bundled-plugins/security/policies/outbound-secret-scan.ts +1 -0
- package/src/bundled-plugins/security/policies/private-surface-read.ts +166 -201
- package/src/channels/adapter-namespace.ts +13 -0
- package/src/channels/adapters/discord-bot-reference.ts +5 -4
- package/src/channels/adapters/discord-bot.ts +98 -5
- package/src/channels/adapters/discord-classify.ts +8 -3
- package/src/channels/adapters/discord.ts +29 -0
- package/src/channels/adapters/github/index.ts +16 -0
- package/src/channels/adapters/github/last-alive.ts +4 -16
- package/src/channels/adapters/slack-attachment-download.ts +14 -3
- package/src/channels/adapters/slack-bot-author-resolver.ts +4 -3
- package/src/channels/adapters/slack-bot-channel-resolver.ts +9 -6
- package/src/channels/adapters/slack-bot-classify.ts +1 -0
- package/src/channels/adapters/slack-bot-slash-commands.ts +3 -1
- package/src/channels/adapters/slack-bot.ts +299 -67
- package/src/channels/adapters/slack-classify.ts +1 -0
- package/src/channels/catch-up.ts +137 -0
- package/src/channels/continuation-willingness.ts +2 -2
- package/src/channels/continuity-types.ts +1 -0
- package/src/channels/engagement.ts +17 -1
- package/src/channels/github-false-receipt.ts +3 -3
- package/src/channels/github-rereview-guard.ts +9 -5
- package/src/channels/github-review-check.ts +5 -1
- package/src/channels/github-review-verdict-coordinator.ts +68 -2
- package/src/channels/github-token-bridge.ts +24 -0
- package/src/channels/last-alive.ts +34 -0
- package/src/channels/manager.ts +8 -1
- package/src/channels/router.ts +515 -243
- package/src/channels/session-handoff.fixture.ts +144 -0
- package/src/channels/session-handoff.ts +175 -0
- package/src/channels/session-search.ts +71 -0
- package/src/channels/subagent-completion-bridge.ts +3 -2
- package/src/channels/types.ts +12 -2
- package/src/cli/channel.ts +2 -3
- package/src/cli/hostd.ts +3 -0
- package/src/cli/init.ts +2 -3
- package/src/cli/model.ts +132 -3
- package/src/coding-agent/index.ts +7 -1
- package/src/coding-agent/omo-stream.ts +40 -0
- package/src/coding-agent/runner.ts +30 -8
- package/src/config/config.ts +126 -22
- package/src/config/model-overrides.ts +59 -0
- package/src/config/models-mutation.ts +185 -2
- package/src/config/providers-mutation.ts +12 -4
- package/src/config/providers.ts +69 -4
- package/src/container/start.ts +132 -5
- package/src/doctor/checks.ts +33 -22
- package/src/doctor/index.ts +48 -12
- package/src/doctor/operational-incidents.ts +16 -1
- package/src/doctor/plugin-bridge.ts +14 -1
- package/src/doctor/stage.ts +14 -0
- package/src/doctor/types.ts +6 -0
- package/src/eval/cell.ts +93 -0
- package/src/eval/config.ts +32 -0
- package/src/eval/dispatch.ts +67 -0
- package/src/eval/entry.ts +261 -0
- package/src/eval/kernel.ts +154 -0
- package/src/eval/process.ts +113 -0
- package/src/eval/protocol.ts +26 -0
- package/src/eval/redeclare.ts +174 -0
- package/src/eval/sandbox.ts +114 -0
- package/src/eval/tool.ts +98 -0
- package/src/eval/wire.ts +93 -0
- package/src/hostd/daemon.ts +13 -1
- package/src/init/auto-upgrade.ts +7 -1
- package/src/init/dockerfile.ts +57 -12
- package/src/init/index.ts +4 -3
- package/src/init/local-source-stamp.ts +68 -0
- package/src/init/models-dev.ts +4 -0
- package/src/init/validate-api-key.ts +3 -0
- package/src/operations/classify-tool-outcome.ts +1 -1
- package/src/permissions/builtins.ts +7 -0
- package/src/permissions/permissions.ts +18 -9
- package/src/permissions/resolve.ts +7 -1
- package/src/plugin/context.ts +2 -0
- package/src/plugin/core-tool-names.ts +6 -1
- package/src/plugin/hooks.ts +137 -0
- package/src/plugin/index.ts +6 -0
- package/src/plugin/manager.ts +4 -0
- package/src/plugin/types.ts +60 -0
- package/src/run/bundled-plugins.ts +6 -0
- package/src/run/index.ts +24 -14
- package/src/run/llm-fetch-observer.ts +12 -15
- package/src/sandbox/canonical-secrets.ts +4 -0
- package/src/sandbox/dev-source.ts +26 -0
- package/src/sandbox/env-exposure.ts +20 -0
- package/src/sandbox/hidden-paths.ts +16 -2
- package/src/secrets/storage.ts +13 -0
- package/src/server/index.ts +46 -11
- package/src/skills/typeclaw-channel-github/SKILL.md +8 -8
- package/src/skills/typeclaw-config/SKILL.md +57 -5
- package/src/skills/typeclaw-config/references/dockerfile.md +2 -2
- package/src/skills/typeclaw-github-contributing/SKILL.md +1 -1
- package/src/skills/typeclaw-monorepo/SKILL.md +1 -1
- package/src/skills/typeclaw-permissions/SKILL.md +7 -7
- package/src/skills/typeclaw-troubleshooting/SKILL.md +12 -1
- package/typeclaw.schema.json +488 -5
- package/src/bundled-plugins/doc-render/templates/lib.typ +0 -339
- package/src/bundled-plugins/github-cli-auth/gh-store.ts +0 -733
package/src/init/index.ts
CHANGED
|
@@ -760,8 +760,8 @@ function addCustomModel(
|
|
|
760
760
|
customModels[ref] = meta ?? {}
|
|
761
761
|
}
|
|
762
762
|
|
|
763
|
-
// agent-browser ships in every agent: the bundled SKILL.md (src/
|
|
764
|
-
// agent-browser/SKILL.md) is a discovery stub that calls `agent-browser
|
|
763
|
+
// agent-browser ships in every agent: the bundled SKILL.md (src/bundled-plugins/
|
|
764
|
+
// agent-browser/skills/agent-browser/SKILL.md) is a discovery stub that calls `agent-browser
|
|
765
765
|
// skills get core` at runtime, so the CLI must be installed for the skill
|
|
766
766
|
// to function. The Dockerfile pre-downloads Chromium too, so the agent
|
|
767
767
|
// can drive a browser without any first-run setup.
|
|
@@ -769,7 +769,7 @@ function addCustomModel(
|
|
|
769
769
|
// Must match the Dockerfile Layer 4 global install (dockerfile.ts); they are
|
|
770
770
|
// two installs of the same CLI and a skew is silent. Enforced by a guard test
|
|
771
771
|
// in packagejson.test.ts.
|
|
772
|
-
export const AGENT_BROWSER_VERSION = '^0.
|
|
772
|
+
export const AGENT_BROWSER_VERSION = '^0.39.1'
|
|
773
773
|
function buildPackageJson(root: string, name: string, platform: NodeJS.Platform): Record<string, unknown> {
|
|
774
774
|
return {
|
|
775
775
|
name,
|
|
@@ -812,6 +812,7 @@ export async function writeDockerAssets(root: string): Promise<DockerAssetsResul
|
|
|
812
812
|
await writeFile(
|
|
813
813
|
join(root, DOCKERFILE),
|
|
814
814
|
buildDockerfile(typeclawConfig.docker.file, {
|
|
815
|
+
browser: typeclawConfig.browser,
|
|
815
816
|
// A local-spec dev install must inline the heavy stack: its unreleased
|
|
816
817
|
// version has no published `typeclaw-base` tag, so resolving a base
|
|
817
818
|
// image version would pin a nonexistent `FROM ghcr.io/...:<version>`.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process'
|
|
2
|
+
import { createHash } from 'node:crypto'
|
|
3
|
+
import { mkdir, readFile, writeFile } from 'node:fs/promises'
|
|
4
|
+
import { dirname, join } from 'node:path'
|
|
5
|
+
import { promisify } from 'node:util'
|
|
6
|
+
|
|
7
|
+
const execFileAsync = promisify(execFile)
|
|
8
|
+
|
|
9
|
+
// Lives inside node_modules so a wiped or reinstalled node_modules also drops
|
|
10
|
+
// the stamp, which forces the next start to re-copy the checkout.
|
|
11
|
+
const STAMP_FILE = join('node_modules', '.typeclaw-local-source')
|
|
12
|
+
|
|
13
|
+
// Identifies the exact source a `file:` checkout would copy: committed HEAD plus
|
|
14
|
+
// uncommitted edits. Returns null when the checkout is not a Git repo, so the
|
|
15
|
+
// caller cannot tell whether the copy is stale and keeps its old behavior.
|
|
16
|
+
export async function localSourceFingerprint(sourceDir: string): Promise<string | null> {
|
|
17
|
+
try {
|
|
18
|
+
const git = async (...args: string[]) =>
|
|
19
|
+
(await execFileAsync('git', ['-C', sourceDir, ...args], { maxBuffer: 64 * 1024 * 1024 })).stdout
|
|
20
|
+
const [head, diff, untracked] = await Promise.all([
|
|
21
|
+
git('rev-parse', 'HEAD'),
|
|
22
|
+
git('diff', 'HEAD'),
|
|
23
|
+
git('ls-files', '--others', '--exclude-standard'),
|
|
24
|
+
])
|
|
25
|
+
// `git diff HEAD` skips untracked files, so hash their contents too: an edit
|
|
26
|
+
// to a new, not-yet-added file must still count as a source change.
|
|
27
|
+
const paths = untracked.split('\n').filter((path) => path !== '')
|
|
28
|
+
const untrackedHashes =
|
|
29
|
+
paths.length === 0
|
|
30
|
+
? ''
|
|
31
|
+
: (
|
|
32
|
+
await new Promise<string>((resolve, reject) => {
|
|
33
|
+
const child = execFile(
|
|
34
|
+
'git',
|
|
35
|
+
['-C', sourceDir, 'hash-object', '--stdin-paths'],
|
|
36
|
+
{ maxBuffer: 64 * 1024 * 1024 },
|
|
37
|
+
(error, stdout) => (error ? reject(error) : resolve(stdout)),
|
|
38
|
+
)
|
|
39
|
+
child.stdin?.end(paths.join('\n'))
|
|
40
|
+
})
|
|
41
|
+
).trim()
|
|
42
|
+
return createHash('sha256')
|
|
43
|
+
.update(head)
|
|
44
|
+
.update('\0')
|
|
45
|
+
.update(diff)
|
|
46
|
+
.update('\0')
|
|
47
|
+
.update(untracked)
|
|
48
|
+
.update('\0')
|
|
49
|
+
.update(untrackedHashes)
|
|
50
|
+
.digest('hex')
|
|
51
|
+
} catch {
|
|
52
|
+
return null
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export async function readLocalSourceStamp(cwd: string): Promise<string | null> {
|
|
57
|
+
try {
|
|
58
|
+
return (await readFile(join(cwd, STAMP_FILE), 'utf8')).trim()
|
|
59
|
+
} catch {
|
|
60
|
+
return null
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export async function writeLocalSourceStamp(cwd: string, fingerprint: string): Promise<void> {
|
|
65
|
+
const path = join(cwd, STAMP_FILE)
|
|
66
|
+
await mkdir(dirname(path), { recursive: true })
|
|
67
|
+
await writeFile(path, `${fingerprint}\n`)
|
|
68
|
+
}
|
package/src/init/models-dev.ts
CHANGED
|
@@ -52,6 +52,10 @@ const PROVIDER_TO_MODELS_DEV: Record<KnownProviderId, string | null> = {
|
|
|
52
52
|
// `kimi-for-coding` alias is surfaced regardless of upstream membership.
|
|
53
53
|
'moonshot-coding': 'moonshot',
|
|
54
54
|
opengateway: null,
|
|
55
|
+
// models.dev's `inception` catalog lists only Mercury 2 / 2.5 / Edit 2, which
|
|
56
|
+
// are retired for new users or don't serve chat. Surface the curated
|
|
57
|
+
// Mercury 3 record alone.
|
|
58
|
+
inception: null,
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
function upstreamProviderFor(
|
|
@@ -32,6 +32,8 @@ const PROVIDER_PROBE: Partial<Record<KnownProviderId, Probe>> = {
|
|
|
32
32
|
// validation, because init would vouch for a key that cannot complete a single
|
|
33
33
|
// request. /v1/me is the cheapest endpoint that actually 401s on a bad key.
|
|
34
34
|
opengateway: { url: 'https://apis.opengateway.ai/v1/me', authHeader: 'bearer', successShape: 'json-object' },
|
|
35
|
+
// inception has no probe: its /v1/models is public and returns 200 for any
|
|
36
|
+
// key, so probing it would vouch for garbage.
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
// When a base-URL override (ANTHROPIC_BASE_URL / OPENAI_BASE_URL) points at a
|
|
@@ -194,6 +196,7 @@ export const API_KEY_DASHBOARD_URL: Partial<Record<KnownProviderId, string>> = {
|
|
|
194
196
|
moonshot: 'https://platform.moonshot.ai/console/api-keys',
|
|
195
197
|
'moonshot-coding': 'https://www.kimi.com/code/console',
|
|
196
198
|
opengateway: 'https://opengateway.ai/docs/reference/guides/authentication',
|
|
199
|
+
inception: 'https://platform.inceptionlabs.ai',
|
|
197
200
|
}
|
|
198
201
|
|
|
199
202
|
// MiniMax sells the same `minimax` provider under two billing surfaces that
|
|
@@ -41,7 +41,7 @@ const COMMAND_NOT_FOUND = new RegExp(
|
|
|
41
41
|
|
|
42
42
|
// Pi's grep/find reject with these fixed literals when `ensureTool` returns no
|
|
43
43
|
// rg/fd path (pi packages/coding-agent/src/core/tools/{grep,find}.ts; published
|
|
44
|
-
// dist/core/tools/{grep,find}.js, identical in 0.87.1, 0.99.2, and 1.
|
|
44
|
+
// dist/core/tools/{grep,find}.js, identical in 0.87.1, 0.99.2, 1.0.0, and 1.4.0).
|
|
45
45
|
// Classification accepts the literal alone or followed by the exact `: `
|
|
46
46
|
// separator and untrusted context. Context is never parsed or persisted; the
|
|
47
47
|
// bin comes only from the closed grep->rg/find->fd tool mapping. This contract
|
|
@@ -39,6 +39,10 @@ export const CORE_PERMISSIONS = {
|
|
|
39
39
|
// permissions.ts), not the guest role, which is now grantable.
|
|
40
40
|
fsSeePrivate: 'fs.see.private',
|
|
41
41
|
fsSeeSecrets: 'fs.see.secrets',
|
|
42
|
+
// Drives the TypeClaw-managed shared browser (its logins span sessions and
|
|
43
|
+
// channels). Granted with fsSeePrivate because the browser's file exchange
|
|
44
|
+
// lives under workspace/, which that same tier already sees.
|
|
45
|
+
browserShared: 'browser.shared',
|
|
42
46
|
} as const
|
|
43
47
|
|
|
44
48
|
// Sentinel that `expandOwnerWildcard` swaps for the concrete union of
|
|
@@ -87,6 +91,7 @@ export const BUILTIN_ROLES: Readonly<Record<BuiltinRoleName, BuiltinRoleSpec>> =
|
|
|
87
91
|
CORE_PERMISSIONS.subagentOutput,
|
|
88
92
|
CORE_PERMISSIONS.subagentSpawnOperator,
|
|
89
93
|
CORE_PERMISSIONS.fsSeePrivate,
|
|
94
|
+
CORE_PERMISSIONS.browserShared,
|
|
90
95
|
CORE_PERMISSIONS.fsSeeSecrets,
|
|
91
96
|
'security.bypass.low',
|
|
92
97
|
'security.bypass.medium',
|
|
@@ -106,6 +111,7 @@ export const BUILTIN_ROLES: Readonly<Record<BuiltinRoleName, BuiltinRoleSpec>> =
|
|
|
106
111
|
CORE_PERMISSIONS.subagentOutput,
|
|
107
112
|
CORE_PERMISSIONS.subagentSpawnOperator,
|
|
108
113
|
CORE_PERMISSIONS.fsSeePrivate,
|
|
114
|
+
CORE_PERMISSIONS.browserShared,
|
|
109
115
|
CORE_PERMISSIONS.fsSeeSecrets,
|
|
110
116
|
'security.bypass.low',
|
|
111
117
|
'security.bypass.medium',
|
|
@@ -120,6 +126,7 @@ export const BUILTIN_ROLES: Readonly<Record<BuiltinRoleName, BuiltinRoleSpec>> =
|
|
|
120
126
|
CORE_PERMISSIONS.subagentCancel,
|
|
121
127
|
CORE_PERMISSIONS.subagentOutput,
|
|
122
128
|
CORE_PERMISSIONS.fsSeePrivate,
|
|
129
|
+
CORE_PERMISSIONS.browserShared,
|
|
123
130
|
'security.bypass.low',
|
|
124
131
|
],
|
|
125
132
|
},
|
|
@@ -8,6 +8,8 @@ import type { RoleConfig, RolesConfig } from './schema'
|
|
|
8
8
|
export type PermissionService = {
|
|
9
9
|
has(origin: SessionOrigin | undefined, permission: string): boolean
|
|
10
10
|
resolveRole(origin: SessionOrigin | undefined): string
|
|
11
|
+
// Discovery/delegation must distinguish an actual rule from the guest fallback.
|
|
12
|
+
resolveRole(origin: SessionOrigin | undefined, options: { requireMatch: true }): string | undefined
|
|
11
13
|
describe(origin: SessionOrigin | undefined): { role: string; permissions: readonly string[] }
|
|
12
14
|
// Orders two role names on the severity tower so callers can cap an
|
|
13
15
|
// action to the requester's role (a guest turn must not read the output
|
|
@@ -208,9 +210,9 @@ export function createPermissionService(opts: CreatePermissionServiceOptions = {
|
|
|
208
210
|
// chat ids — even denied traffic that resolves to guest — would otherwise
|
|
209
211
|
// grow the map without limit until the next role-table rebuild. See
|
|
210
212
|
// createBoundedCache for the eviction policy.
|
|
211
|
-
const roleCache = createBoundedCache<string>(ROLE_CACHE_MAX)
|
|
213
|
+
const roleCache = createBoundedCache<string | null>(ROLE_CACHE_MAX)
|
|
212
214
|
|
|
213
|
-
function computeRole(origin: SessionOrigin): string {
|
|
215
|
+
function computeRole(origin: SessionOrigin): string | null {
|
|
214
216
|
// Runtime-owned infrastructure (memory, backup) acts on the operator's
|
|
215
217
|
// behalf over operator-owned state. It is constructed only by runtime/
|
|
216
218
|
// bundled code — inbound channel/cron content cannot produce this kind —
|
|
@@ -230,25 +232,28 @@ export function createPermissionService(opts: CreatePermissionServiceOptions = {
|
|
|
230
232
|
}
|
|
231
233
|
|
|
232
234
|
const matchable = toMatchable(origin)
|
|
233
|
-
if (matchable === null) return
|
|
235
|
+
if (matchable === null) return null
|
|
234
236
|
|
|
235
237
|
for (const role of resolved) {
|
|
236
238
|
for (const rule of role.match) {
|
|
237
239
|
if (matchesOrigin(rule, matchable)) return role.name
|
|
238
240
|
}
|
|
239
241
|
}
|
|
240
|
-
return
|
|
242
|
+
return null
|
|
241
243
|
}
|
|
242
244
|
|
|
243
|
-
function resolveRole(origin: SessionOrigin | undefined): string
|
|
244
|
-
|
|
245
|
+
function resolveRole(origin: SessionOrigin | undefined): string
|
|
246
|
+
function resolveRole(origin: SessionOrigin | undefined, options: { requireMatch: true }): string | undefined
|
|
247
|
+
function resolveRole(origin: SessionOrigin | undefined, options?: { requireMatch: true }): string | undefined {
|
|
248
|
+
const fallback = options?.requireMatch ? undefined : 'guest'
|
|
249
|
+
if (origin === undefined) return fallback
|
|
245
250
|
const key = roleCacheKey(origin)
|
|
246
|
-
if (key === null) return computeRole(origin)
|
|
251
|
+
if (key === null) return computeRole(origin) ?? fallback
|
|
247
252
|
const cached = roleCache.get(key)
|
|
248
|
-
if (cached !== undefined) return cached
|
|
253
|
+
if (cached !== undefined) return cached ?? fallback
|
|
249
254
|
const role = computeRole(origin)
|
|
250
255
|
roleCache.set(key, role)
|
|
251
|
-
return role
|
|
256
|
+
return role ?? fallback
|
|
252
257
|
}
|
|
253
258
|
|
|
254
259
|
function invalidateRoleCache(): void {
|
|
@@ -409,6 +414,7 @@ function roleCacheKey(origin: SessionOrigin): string | null {
|
|
|
409
414
|
origin.chat,
|
|
410
415
|
origin.parentChat ?? '',
|
|
411
416
|
origin.lastInboundAuthorId ?? '',
|
|
417
|
+
origin.lastInboundAuthorAdapter ?? origin.adapter,
|
|
412
418
|
].join('\u0000')
|
|
413
419
|
default:
|
|
414
420
|
return null
|
|
@@ -427,6 +433,9 @@ function toMatchable(origin: SessionOrigin): Parameters<typeof matchesOrigin>[1]
|
|
|
427
433
|
chat: origin.chat,
|
|
428
434
|
...(origin.parentChat !== undefined ? { parentChat: origin.parentChat } : {}),
|
|
429
435
|
...(origin.lastInboundAuthorId !== undefined ? { lastInboundAuthorId: origin.lastInboundAuthorId } : {}),
|
|
436
|
+
...(origin.lastInboundAuthorAdapter !== undefined
|
|
437
|
+
? { lastInboundAuthorAdapter: origin.lastInboundAuthorAdapter }
|
|
438
|
+
: {}),
|
|
430
439
|
}
|
|
431
440
|
default:
|
|
432
441
|
return null
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { adapterNamespace } from '@/channels/adapter-namespace'
|
|
1
2
|
import { decodeWebexId } from '@/channels/adapters/webex-id-ref'
|
|
2
3
|
import type { AdapterId } from '@/channels/schema'
|
|
3
4
|
|
|
@@ -29,6 +30,7 @@ export type MatchableOrigin =
|
|
|
29
30
|
chat: string
|
|
30
31
|
parentChat?: string
|
|
31
32
|
lastInboundAuthorId?: string
|
|
33
|
+
lastInboundAuthorAdapter?: AdapterId
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
export function matchesOrigin(rule: MatchRule, origin: MatchableOrigin): boolean {
|
|
@@ -60,7 +62,11 @@ function matchesChannel(rule: Extract<MatchRule, { kind: 'channel' }>, origin: M
|
|
|
60
62
|
if (rule.chat !== undefined && !matchesChat(rule.chat, origin)) return false
|
|
61
63
|
}
|
|
62
64
|
|
|
63
|
-
if (rule.author !== undefined
|
|
65
|
+
if (rule.author !== undefined) {
|
|
66
|
+
if (adapterNamespace(origin.lastInboundAuthorAdapter ?? origin.adapter) !== adapterNamespace(origin.adapter))
|
|
67
|
+
return false
|
|
68
|
+
if (!matchesAuthor(rule.platform, rule.author, origin.lastInboundAuthorId)) return false
|
|
69
|
+
}
|
|
64
70
|
return true
|
|
65
71
|
}
|
|
66
72
|
|
package/src/plugin/context.ts
CHANGED
|
@@ -15,6 +15,7 @@ export type CreatePluginContextOptions<TConfig> = {
|
|
|
15
15
|
resolveGithubTokenForRepo?: ResolveGithubTokenForRepo
|
|
16
16
|
hasGithubAppTokenResolver?: () => boolean
|
|
17
17
|
getGithubAppSelfLogin?: () => string | null
|
|
18
|
+
resolveGithubPatForRepo?: ResolveGithubTokenForRepo
|
|
18
19
|
spawnSubagent: SpawnSubagentFn
|
|
19
20
|
isBooted: () => boolean
|
|
20
21
|
}
|
|
@@ -36,6 +37,7 @@ export function createPluginContext<TConfig>(opts: CreatePluginContextOptions<TC
|
|
|
36
37
|
resolveTokenForRepo: opts.resolveGithubTokenForRepo ?? githubTokenUnavailable,
|
|
37
38
|
hasAppTokenResolver: opts.hasGithubAppTokenResolver ?? (() => false),
|
|
38
39
|
getAppSelfLogin: opts.getGithubAppSelfLogin ?? (() => null),
|
|
40
|
+
resolvePatForRepo: opts.resolveGithubPatForRepo ?? githubTokenUnavailable,
|
|
39
41
|
},
|
|
40
42
|
spawnSubagent: async (name: string, payload?: unknown, options?: SpawnSubagentOptions) => {
|
|
41
43
|
if (!opts.isBooted()) {
|
|
@@ -12,4 +12,9 @@ export const PI_BUILTIN_TOOL_NAMES: readonly PiBuiltinToolName[] = [
|
|
|
12
12
|
|
|
13
13
|
export const CORE_SYSTEM_TOOL_NAMES = ['web_search', 'web_fetch', 'look_at', 'coding_agent'] as const
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
// eval is conditional and must not enter the always-registered system catalog.
|
|
16
|
+
export const CORE_TOOL_NAMES: ReadonlySet<string> = new Set([
|
|
17
|
+
...PI_BUILTIN_TOOL_NAMES,
|
|
18
|
+
...CORE_SYSTEM_TOOL_NAMES,
|
|
19
|
+
'eval',
|
|
20
|
+
])
|
package/src/plugin/hooks.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
ChannelMessageObservedEvent,
|
|
3
|
+
ChannelOutboundBeforeEvent,
|
|
2
4
|
HookContext,
|
|
3
5
|
Hooks,
|
|
4
6
|
PluginLogger,
|
|
@@ -45,6 +47,11 @@ export const END_HANDLER_TIMEOUT_MS = 60_000
|
|
|
45
47
|
// inline, AND regressions that re-introduce expensive inline prompt work.
|
|
46
48
|
export const PROMPT_HANDLER_TIMEOUT_MS = 20_000
|
|
47
49
|
|
|
50
|
+
// Observers should enqueue and return. These bounds abandon asynchronous work;
|
|
51
|
+
// they cannot preempt synchronous code in a full-trust, in-process plugin.
|
|
52
|
+
export const OBSERVED_HANDLER_TIMEOUT_MS = 10_000
|
|
53
|
+
export const OUTBOUND_HANDLER_TIMEOUT_MS = 30_000
|
|
54
|
+
|
|
48
55
|
export type RegisteredHook<K extends keyof Hooks> = {
|
|
49
56
|
pluginName: string
|
|
50
57
|
agentDir: string
|
|
@@ -61,12 +68,15 @@ export type HookBus = {
|
|
|
61
68
|
runSessionPrompt: (event: SessionPromptEvent) => Promise<void>
|
|
62
69
|
runSessionTurnStart: (event: SessionTurnStartEvent) => Promise<void>
|
|
63
70
|
runSessionTurnEnd: (event: SessionTurnEndEvent) => Promise<void>
|
|
71
|
+
runChannelMessageObserved: (event: ChannelMessageObservedEvent) => void
|
|
72
|
+
runChannelOutboundBefore: (event: ChannelOutboundBeforeEvent) => Promise<{ text: string }>
|
|
64
73
|
runToolBefore: (
|
|
65
74
|
event: ToolBeforeEvent,
|
|
66
75
|
guards?: readonly {
|
|
67
76
|
owner: string
|
|
68
77
|
key: string
|
|
69
78
|
tools: ReadonlySet<string>
|
|
79
|
+
skipOnCheckError?: true
|
|
70
80
|
check: (
|
|
71
81
|
event: Readonly<ToolBeforeEvent>,
|
|
72
82
|
) =>
|
|
@@ -89,6 +99,8 @@ export type CreateHookBusOptions = {
|
|
|
89
99
|
endHandlerTimeoutMs?: number
|
|
90
100
|
// Test seam: per-handler ceiling for session.prompt invocations.
|
|
91
101
|
promptHandlerTimeoutMs?: number
|
|
102
|
+
observedHandlerTimeoutMs?: number
|
|
103
|
+
outboundHandlerTimeoutMs?: number
|
|
92
104
|
}
|
|
93
105
|
|
|
94
106
|
type Registries = {
|
|
@@ -100,12 +112,16 @@ type Registries = {
|
|
|
100
112
|
'session.turn.end': RegisteredHook<'session.turn.end'>[]
|
|
101
113
|
'tool.before': Array<RegisteredHook<'tool.before'> | { pluginName: string; guardOwner: true; logger: PluginLogger }>
|
|
102
114
|
'tool.after': RegisteredHook<'tool.after'>[]
|
|
115
|
+
'channel.message.observed': RegisteredHook<'channel.message.observed'>[]
|
|
116
|
+
'channel.outbound.before': RegisteredHook<'channel.outbound.before'>[]
|
|
103
117
|
}
|
|
104
118
|
|
|
105
119
|
export function createHookBus(options: CreateHookBusOptions = {}): HookBus {
|
|
106
120
|
const idleHandlerTimeoutMs = options.idleHandlerTimeoutMs ?? IDLE_HANDLER_TIMEOUT_MS
|
|
107
121
|
const endHandlerTimeoutMs = options.endHandlerTimeoutMs ?? END_HANDLER_TIMEOUT_MS
|
|
108
122
|
const promptHandlerTimeoutMs = options.promptHandlerTimeoutMs ?? PROMPT_HANDLER_TIMEOUT_MS
|
|
123
|
+
const observedHandlerTimeoutMs = options.observedHandlerTimeoutMs ?? OBSERVED_HANDLER_TIMEOUT_MS
|
|
124
|
+
const outboundHandlerTimeoutMs = options.outboundHandlerTimeoutMs ?? OUTBOUND_HANDLER_TIMEOUT_MS
|
|
109
125
|
const r: Registries = {
|
|
110
126
|
'session.start': [],
|
|
111
127
|
'session.end': [],
|
|
@@ -115,6 +131,8 @@ export function createHookBus(options: CreateHookBusOptions = {}): HookBus {
|
|
|
115
131
|
'session.turn.end': [],
|
|
116
132
|
'tool.before': [],
|
|
117
133
|
'tool.after': [],
|
|
134
|
+
'channel.message.observed': [],
|
|
135
|
+
'channel.outbound.before': [],
|
|
118
136
|
}
|
|
119
137
|
|
|
120
138
|
function ctx(reg: { pluginName: string; agentDir: string; logger: PluginLogger }): HookContext {
|
|
@@ -123,6 +141,9 @@ export function createHookBus(options: CreateHookBusOptions = {}): HookBus {
|
|
|
123
141
|
|
|
124
142
|
return {
|
|
125
143
|
registerAll(pluginName, agentDir, logger, hooks) {
|
|
144
|
+
for (const name of Object.keys(hooks)) {
|
|
145
|
+
if (!Object.hasOwn(r, name)) logger.warn(`Ignoring unknown hook "${name}" (plugin ${pluginName}).`)
|
|
146
|
+
}
|
|
126
147
|
const base = { pluginName, agentDir, logger }
|
|
127
148
|
r['tool.before'].push({ pluginName, guardOwner: true, logger })
|
|
128
149
|
if (hooks['session.start']) r['session.start'].push({ ...base, handler: hooks['session.start'] })
|
|
@@ -133,6 +154,12 @@ export function createHookBus(options: CreateHookBusOptions = {}): HookBus {
|
|
|
133
154
|
if (hooks['session.turn.end']) r['session.turn.end'].push({ ...base, handler: hooks['session.turn.end'] })
|
|
134
155
|
if (hooks['tool.before']) r['tool.before'].push({ ...base, handler: hooks['tool.before'] })
|
|
135
156
|
if (hooks['tool.after']) r['tool.after'].push({ ...base, handler: hooks['tool.after'] })
|
|
157
|
+
if (hooks['channel.message.observed']) {
|
|
158
|
+
r['channel.message.observed'].push({ ...base, handler: hooks['channel.message.observed'] })
|
|
159
|
+
}
|
|
160
|
+
if (hooks['channel.outbound.before']) {
|
|
161
|
+
r['channel.outbound.before'].push({ ...base, handler: hooks['channel.outbound.before'] })
|
|
162
|
+
}
|
|
136
163
|
},
|
|
137
164
|
|
|
138
165
|
unregisterAll(pluginName) {
|
|
@@ -144,6 +171,8 @@ export function createHookBus(options: CreateHookBusOptions = {}): HookBus {
|
|
|
144
171
|
r['session.turn.end'] = r['session.turn.end'].filter((h) => h.pluginName !== pluginName)
|
|
145
172
|
r['tool.before'] = r['tool.before'].filter((h) => h.pluginName !== pluginName)
|
|
146
173
|
r['tool.after'] = r['tool.after'].filter((h) => h.pluginName !== pluginName)
|
|
174
|
+
r['channel.message.observed'] = r['channel.message.observed'].filter((h) => h.pluginName !== pluginName)
|
|
175
|
+
r['channel.outbound.before'] = r['channel.outbound.before'].filter((h) => h.pluginName !== pluginName)
|
|
147
176
|
},
|
|
148
177
|
|
|
149
178
|
async runSessionStart(event) {
|
|
@@ -231,6 +260,7 @@ export function createHookBus(options: CreateHookBusOptions = {}): HookBus {
|
|
|
231
260
|
result = await guard.check(event)
|
|
232
261
|
} catch (err) {
|
|
233
262
|
reg.logger.error(`guard ${guard.key} threw: ${err instanceof Error ? err.message : String(err)}`)
|
|
263
|
+
if (guard.skipOnCheckError) continue
|
|
234
264
|
return { block: true, reason: `guard ${guard.key} failed closed after its check threw` }
|
|
235
265
|
}
|
|
236
266
|
if (result === undefined) continue
|
|
@@ -266,6 +296,68 @@ export function createHookBus(options: CreateHookBusOptions = {}): HookBus {
|
|
|
266
296
|
}
|
|
267
297
|
},
|
|
268
298
|
|
|
299
|
+
runChannelMessageObserved(event) {
|
|
300
|
+
const regs = r['channel.message.observed']
|
|
301
|
+
if (regs.length === 0) return
|
|
302
|
+
let snapshot: ChannelMessageObservedEvent
|
|
303
|
+
try {
|
|
304
|
+
snapshot = deepFreeze(structuredClone(event))
|
|
305
|
+
} catch {
|
|
306
|
+
for (const reg of regs) reportChannelHookFailure(reg, 'channel.message.observed', 'snapshot failed')
|
|
307
|
+
return
|
|
308
|
+
}
|
|
309
|
+
for (const reg of regs) {
|
|
310
|
+
// Capture the registration set at receipt, even if a handler reloads it.
|
|
311
|
+
queueMicrotask(() => {
|
|
312
|
+
void runChannelHandler(
|
|
313
|
+
reg,
|
|
314
|
+
'channel.message.observed',
|
|
315
|
+
() => reg.handler(snapshot, ctx(reg)),
|
|
316
|
+
observedHandlerTimeoutMs,
|
|
317
|
+
)
|
|
318
|
+
})
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
|
|
322
|
+
async runChannelOutboundBefore(event) {
|
|
323
|
+
const regs = r['channel.outbound.before']
|
|
324
|
+
if (regs.length === 0) return { text: event.text }
|
|
325
|
+
let text = event.text
|
|
326
|
+
// Capture registrations before awaiting: a reload/addition belongs to the
|
|
327
|
+
// next logical delivery, not the chain currently being transformed.
|
|
328
|
+
const registrations = regs.slice()
|
|
329
|
+
for (const reg of registrations) {
|
|
330
|
+
const snapshot = Object.freeze({
|
|
331
|
+
...event,
|
|
332
|
+
text,
|
|
333
|
+
...(event.origin ? { origin: Object.freeze({ ...event.origin }) } : {}),
|
|
334
|
+
})
|
|
335
|
+
const result = await runChannelHandler(
|
|
336
|
+
reg,
|
|
337
|
+
'channel.outbound.before',
|
|
338
|
+
() => reg.handler(snapshot, ctx(reg)),
|
|
339
|
+
outboundHandlerTimeoutMs,
|
|
340
|
+
)
|
|
341
|
+
if (result === undefined) continue
|
|
342
|
+
try {
|
|
343
|
+
if (typeof result === 'object' && result !== null) {
|
|
344
|
+
const keys = Reflect.ownKeys(result)
|
|
345
|
+
if (keys.length === 1 && keys[0] === 'text') {
|
|
346
|
+
const replacement = result.text
|
|
347
|
+
if (typeof replacement === 'string' && replacement.trim().length > 0) {
|
|
348
|
+
if (event.text.trim().length > 0) text = replacement
|
|
349
|
+
continue
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
} catch {
|
|
354
|
+
// Invalid accessors cannot turn a fail-open transform into a failure.
|
|
355
|
+
}
|
|
356
|
+
reportChannelHookFailure(reg, 'channel.outbound.before', 'invalid result')
|
|
357
|
+
}
|
|
358
|
+
return { text }
|
|
359
|
+
},
|
|
360
|
+
|
|
269
361
|
count(name) {
|
|
270
362
|
if (name === 'tool.before') return r[name].filter((entry) => !('guardOwner' in entry)).length
|
|
271
363
|
return r[name].length
|
|
@@ -278,6 +370,51 @@ function reportHookError(reg: { logger: PluginLogger }, hook: keyof Hooks, err:
|
|
|
278
370
|
reg.logger.error(`hook ${hook} threw: ${message}`)
|
|
279
371
|
}
|
|
280
372
|
|
|
373
|
+
function reportChannelHookFailure(
|
|
374
|
+
reg: { pluginName: string; logger: PluginLogger },
|
|
375
|
+
hook: 'channel.message.observed' | 'channel.outbound.before',
|
|
376
|
+
kind: string,
|
|
377
|
+
): void {
|
|
378
|
+
try {
|
|
379
|
+
// Rejected/thrown values may contain message bodies or credentials.
|
|
380
|
+
reg.logger.error(`hook ${hook} ${kind} (plugin ${reg.pluginName})`)
|
|
381
|
+
} catch {
|
|
382
|
+
// Diagnostics must not break routing or fail-open delivery.
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
function runChannelHandler<T>(
|
|
387
|
+
reg: { pluginName: string; logger: PluginLogger },
|
|
388
|
+
hook: 'channel.message.observed' | 'channel.outbound.before',
|
|
389
|
+
invoke: () => T | Promise<T>,
|
|
390
|
+
timeoutMs: number,
|
|
391
|
+
): Promise<T | undefined> {
|
|
392
|
+
return new Promise((resolve) => {
|
|
393
|
+
let settled = false
|
|
394
|
+
const finish = (value?: T, failure?: string) => {
|
|
395
|
+
if (settled) return
|
|
396
|
+
settled = true
|
|
397
|
+
clearTimeout(timer)
|
|
398
|
+
if (failure) reportChannelHookFailure(reg, hook, failure)
|
|
399
|
+
resolve(value)
|
|
400
|
+
}
|
|
401
|
+
const timer = setTimeout(() => finish(undefined, 'timed out'), timeoutMs)
|
|
402
|
+
Promise.resolve()
|
|
403
|
+
.then(invoke)
|
|
404
|
+
.then(
|
|
405
|
+
(value) => finish(value),
|
|
406
|
+
() => finish(undefined, 'failed'),
|
|
407
|
+
)
|
|
408
|
+
})
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
function deepFreeze<T>(value: T): T {
|
|
412
|
+
if (value === null || typeof value !== 'object' || Object.isFrozen(value)) return value
|
|
413
|
+
Object.freeze(value)
|
|
414
|
+
for (const key of Object.keys(value)) deepFreeze((value as Record<string, unknown>)[key])
|
|
415
|
+
return value
|
|
416
|
+
}
|
|
417
|
+
|
|
281
418
|
async function raceWithTimeout<T>(work: Promise<T>, ms: number, label: string): Promise<T> {
|
|
282
419
|
let timer: ReturnType<typeof setTimeout> | null = null
|
|
283
420
|
const timeout = new Promise<never>((_, reject) => {
|
package/src/plugin/index.ts
CHANGED
|
@@ -17,6 +17,10 @@ export {
|
|
|
17
17
|
|
|
18
18
|
export type {
|
|
19
19
|
BuiltinToolRef,
|
|
20
|
+
ChannelMessageObservedEvent,
|
|
21
|
+
ChannelOutboundBeforeEvent,
|
|
22
|
+
ChannelOutboundBeforeResult,
|
|
23
|
+
ChannelOutboundOrigin,
|
|
20
24
|
CommandExecResult,
|
|
21
25
|
CommandStreams,
|
|
22
26
|
ContainerCommand,
|
|
@@ -54,6 +58,7 @@ export type {
|
|
|
54
58
|
SessionTurnEndEvent,
|
|
55
59
|
SessionTurnStartEvent,
|
|
56
60
|
SpawnSubagentOptions,
|
|
61
|
+
SlackObservedMessage,
|
|
57
62
|
Subagent,
|
|
58
63
|
SubagentContext,
|
|
59
64
|
Tool,
|
|
@@ -99,3 +104,4 @@ export {
|
|
|
99
104
|
type RegisteredTool,
|
|
100
105
|
} from './registry'
|
|
101
106
|
export { createHookBus, type HookBus } from './hooks'
|
|
107
|
+
export { createSubagentSessionManager } from '@/agent/subagent-session'
|
package/src/plugin/manager.ts
CHANGED
|
@@ -37,6 +37,7 @@ export type LoadPluginsOptions = {
|
|
|
37
37
|
resolveGithubTokenForRepo?: ResolveGithubTokenForRepo
|
|
38
38
|
hasGithubAppTokenResolver?: () => boolean
|
|
39
39
|
getGithubAppSelfLogin?: () => string | null
|
|
40
|
+
resolveGithubPatForRepo?: ResolveGithubTokenForRepo
|
|
40
41
|
// Bundled plugins resolved by the runtime (not from typeclaw.json). Loaded
|
|
41
42
|
// before user-declared `entries` so a config block named after a bundled
|
|
42
43
|
// plugin (e.g. "memory") is consumed by the bundled plugin, and so plugin-
|
|
@@ -129,6 +130,7 @@ export async function loadPlugins(opts: LoadPluginsOptions): Promise<LoadPlugins
|
|
|
129
130
|
resolveGithubTokenForRepo: opts.resolveGithubTokenForRepo,
|
|
130
131
|
hasGithubAppTokenResolver: opts.hasGithubAppTokenResolver,
|
|
131
132
|
getGithubAppSelfLogin: opts.getGithubAppSelfLogin,
|
|
133
|
+
resolveGithubPatForRepo: opts.resolveGithubPatForRepo,
|
|
132
134
|
spawnSubagent: (name, payload, options) => spawnSubagentImpl(name, payload, options),
|
|
133
135
|
isBooted: () => booted,
|
|
134
136
|
},
|
|
@@ -245,6 +247,7 @@ type RegisterOnePluginArgs = {
|
|
|
245
247
|
resolveGithubTokenForRepo?: ResolveGithubTokenForRepo
|
|
246
248
|
hasGithubAppTokenResolver?: () => boolean
|
|
247
249
|
getGithubAppSelfLogin?: () => string | null
|
|
250
|
+
resolveGithubPatForRepo?: ResolveGithubTokenForRepo
|
|
248
251
|
spawnSubagent: SpawnSubagentFn
|
|
249
252
|
isBooted: () => boolean
|
|
250
253
|
}
|
|
@@ -277,6 +280,7 @@ async function registerOnePlugin(args: RegisterOnePluginArgs): Promise<void> {
|
|
|
277
280
|
resolveGithubTokenForRepo: args.ctxDeps.resolveGithubTokenForRepo,
|
|
278
281
|
hasGithubAppTokenResolver: args.ctxDeps.hasGithubAppTokenResolver,
|
|
279
282
|
getGithubAppSelfLogin: args.ctxDeps.getGithubAppSelfLogin,
|
|
283
|
+
resolveGithubPatForRepo: args.ctxDeps.resolveGithubPatForRepo,
|
|
280
284
|
spawnSubagent: args.ctxDeps.spawnSubagent,
|
|
281
285
|
isBooted: args.ctxDeps.isBooted,
|
|
282
286
|
})
|
package/src/plugin/types.ts
CHANGED
|
@@ -73,6 +73,9 @@ export type RunSession = (override?: {
|
|
|
73
73
|
export type Subagent<P = unknown> = SubagentShared<P> & {
|
|
74
74
|
tools?: BuiltinToolRef[]
|
|
75
75
|
customTools?: Tool<any>[]
|
|
76
|
+
// Trusted plugin declaration, never a model payload or per-call override.
|
|
77
|
+
// Raw source readers use in-memory sessions rather than persisted transcripts.
|
|
78
|
+
ephemeral?: boolean
|
|
76
79
|
}
|
|
77
80
|
|
|
78
81
|
// Cron job map keys are local; the runtime prefixes with `__plugin_<plugin-name>_`
|
|
@@ -253,6 +256,57 @@ export type HookContext = {
|
|
|
253
256
|
logger: PluginLogger
|
|
254
257
|
}
|
|
255
258
|
|
|
259
|
+
// Raw Socket Mode message deliveries, not the router's admitted/wake events.
|
|
260
|
+
// Edits, deletes, self/bot messages and duplicates are intentionally included.
|
|
261
|
+
export type SlackObservedMessage = {
|
|
262
|
+
readonly type: 'message'
|
|
263
|
+
readonly channel: string
|
|
264
|
+
readonly ts?: string
|
|
265
|
+
readonly subtype?: string
|
|
266
|
+
readonly text?: string
|
|
267
|
+
readonly user?: string
|
|
268
|
+
readonly thread_ts?: string
|
|
269
|
+
readonly event_ts?: string
|
|
270
|
+
readonly deleted_ts?: string
|
|
271
|
+
readonly message?: Readonly<Record<string, unknown>>
|
|
272
|
+
readonly previous_message?: Readonly<Record<string, unknown>>
|
|
273
|
+
readonly [key: string]: unknown
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// Deep-frozen snapshot after transport ack, before classification/deduplication.
|
|
277
|
+
// Observe-only and best-effort: never awaited by routing, never starts a session.
|
|
278
|
+
// This is a Slack-bot capability, not a cross-adapter or durable event journal.
|
|
279
|
+
export type ChannelMessageObservedEvent = {
|
|
280
|
+
readonly adapter: 'slack-bot'
|
|
281
|
+
readonly workspace: string | null
|
|
282
|
+
readonly selfUserId: string | null
|
|
283
|
+
readonly receivedAt: number
|
|
284
|
+
readonly event: SlackObservedMessage
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// Last-mile text transform for trusted, in-process plugins; not a delivery gate.
|
|
288
|
+
// Only text can be replaced. Invalid/empty results, errors and timeouts retain
|
|
289
|
+
// the previous text. An attachment-only send cannot acquire a caption.
|
|
290
|
+
export type ChannelOutboundOrigin = {
|
|
291
|
+
readonly kind: SessionOrigin['kind']
|
|
292
|
+
readonly jobId?: string
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export type ChannelOutboundBeforeEvent = {
|
|
296
|
+
readonly adapter: string
|
|
297
|
+
readonly workspace: string
|
|
298
|
+
readonly chat: string
|
|
299
|
+
readonly thread?: string
|
|
300
|
+
readonly text: string
|
|
301
|
+
readonly op: 'send' | 'edit'
|
|
302
|
+
readonly messageId?: string
|
|
303
|
+
readonly source: 'tool' | 'system'
|
|
304
|
+
readonly outputKind?: 'substantive' | 'status' | 'meta'
|
|
305
|
+
readonly origin?: ChannelOutboundOrigin
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export type ChannelOutboundBeforeResult = { text: string } | undefined
|
|
309
|
+
|
|
256
310
|
export type Hooks = {
|
|
257
311
|
'session.start'?: (event: SessionStartEvent, ctx: HookContext) => Promise<void> | void
|
|
258
312
|
'session.end'?: (event: SessionEndEvent, ctx: HookContext) => Promise<void> | void
|
|
@@ -262,6 +316,11 @@ export type Hooks = {
|
|
|
262
316
|
'session.turn.end'?: (event: SessionTurnEndEvent, ctx: HookContext) => Promise<void> | void
|
|
263
317
|
'tool.before'?: (event: ToolBeforeEvent, ctx: HookContext) => Promise<ToolBeforeResult> | ToolBeforeResult
|
|
264
318
|
'tool.after'?: (event: ToolAfterEvent, ctx: HookContext) => Promise<void> | void
|
|
319
|
+
'channel.message.observed'?: (event: ChannelMessageObservedEvent, ctx: HookContext) => Promise<void> | void
|
|
320
|
+
'channel.outbound.before'?: (
|
|
321
|
+
event: ChannelOutboundBeforeEvent,
|
|
322
|
+
ctx: HookContext,
|
|
323
|
+
) => Promise<ChannelOutboundBeforeResult> | ChannelOutboundBeforeResult
|
|
265
324
|
}
|
|
266
325
|
|
|
267
326
|
export type HookName = keyof Hooks
|
|
@@ -310,6 +369,7 @@ export type PluginGithubServices = {
|
|
|
310
369
|
resolveTokenForRepo: ResolveGithubTokenForRepo
|
|
311
370
|
hasAppTokenResolver: () => boolean
|
|
312
371
|
getAppSelfLogin?: () => string | null
|
|
372
|
+
resolvePatForRepo?: ResolveGithubTokenForRepo
|
|
313
373
|
}
|
|
314
374
|
|
|
315
375
|
export type PluginExports = {
|