@primusclaw/personal-agent 0.0.0-stage → 0.1.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/LICENSE +37 -0
- package/dist/index.js +31873 -0
- package/dist/types/approvals/approval-view.d.ts +70 -0
- package/dist/types/approvals/click.d.ts +8 -0
- package/dist/types/approvals/decide.d.ts +64 -0
- package/dist/types/approvals/handler.d.ts +22 -0
- package/dist/types/approvals/index.d.ts +9 -0
- package/dist/types/approvals/questions.d.ts +36 -0
- package/dist/types/approvals/records.d.ts +43 -0
- package/dist/types/approvals/sensitive.d.ts +13 -0
- package/dist/types/approvals/turn-cards.d.ts +7 -0
- package/dist/types/approvals/views.d.ts +67 -0
- package/dist/types/assistant/action-handler.d.ts +13 -0
- package/dist/types/assistant/actions.d.ts +63 -0
- package/dist/types/assistant/auto-reply.d.ts +14 -0
- package/dist/types/assistant/board.d.ts +68 -0
- package/dist/types/assistant/chat.d.ts +166 -0
- package/dist/types/assistant/citation-sources.d.ts +20 -0
- package/dist/types/assistant/citations.d.ts +38 -0
- package/dist/types/assistant/confirm-outcome.d.ts +11 -0
- package/dist/types/assistant/devenv-hide-outcome.d.ts +4 -0
- package/dist/types/assistant/events.d.ts +53 -0
- package/dist/types/assistant/failures.d.ts +16 -0
- package/dist/types/assistant/files.d.ts +37 -0
- package/dist/types/assistant/finish.d.ts +8 -0
- package/dist/types/assistant/follow.d.ts +75 -0
- package/dist/types/assistant/index.d.ts +12 -0
- package/dist/types/assistant/informative.d.ts +9 -0
- package/dist/types/assistant/item-of.d.ts +2 -0
- package/dist/types/assistant/receipt.d.ts +113 -0
- package/dist/types/assistant/receipts.d.ts +71 -0
- package/dist/types/assistant/say.d.ts +63 -0
- package/dist/types/assistant/tracked-stream.d.ts +30 -0
- package/dist/types/assistant/turn-in-front.d.ts +25 -0
- package/dist/types/assistant/views.d.ts +80 -0
- package/dist/types/assistant/watch-clicks.d.ts +34 -0
- package/dist/types/assistant/work-clicks.d.ts +53 -0
- package/dist/types/assistant/work-handler.d.ts +23 -0
- package/dist/types/assistant/work-items.d.ts +66 -0
- package/dist/types/branding.d.ts +5 -0
- package/dist/types/brief/brief.d.ts +40 -0
- package/dist/types/brief/index.d.ts +3 -0
- package/dist/types/brief/template.d.ts +8 -0
- package/dist/types/capabilities/capability.d.ts +49 -0
- package/dist/types/capabilities/command-text.d.ts +11 -0
- package/dist/types/capabilities/entries-chat.d.ts +3 -0
- package/dist/types/capabilities/entries-notify.d.ts +3 -0
- package/dist/types/capabilities/entries-settings.d.ts +3 -0
- package/dist/types/capabilities/help.d.ts +24 -0
- package/dist/types/capabilities/natural.d.ts +19 -0
- package/dist/types/capabilities/phrases.d.ts +42 -0
- package/dist/types/capabilities/registry.d.ts +12 -0
- package/dist/types/capabilities/sessions-words.d.ts +9 -0
- package/dist/types/capabilities/spoken.d.ts +19 -0
- package/dist/types/capabilities/visibility.d.ts +32 -0
- package/dist/types/claw/credential.d.ts +8 -0
- package/dist/types/claw/errors.d.ts +61 -0
- package/dist/types/claw/lenient.d.ts +23 -0
- package/dist/types/claw/message-text.d.ts +28 -0
- package/dist/types/claw/model.d.ts +118 -0
- package/dist/types/claw/py-value.d.ts +7 -0
- package/dist/types/claw/remote.d.ts +138 -0
- package/dist/types/claw/requester-view.d.ts +15 -0
- package/dist/types/claw/service-refusal.d.ts +4 -0
- package/dist/types/claw/sse.d.ts +12 -0
- package/dist/types/claw/started-review.d.ts +7 -0
- package/dist/types/claw/work-item.d.ts +25 -0
- package/dist/types/commands/agent-args.d.ts +9 -0
- package/dist/types/commands/names.d.ts +19 -0
- package/dist/types/commands/parse.d.ts +33 -0
- package/dist/types/commands/repo.d.ts +17 -0
- package/dist/types/config/settings.d.ts +124 -0
- package/dist/types/direct-chat/direct-chat.d.ts +73 -0
- package/dist/types/direct-chat/index.d.ts +2 -0
- package/dist/types/errors.d.ts +15 -0
- package/dist/types/feedback/deadline.d.ts +10 -0
- package/dist/types/feedback/delivery.d.ts +34 -0
- package/dist/types/feedback/exchange.d.ts +19 -0
- package/dist/types/feedback/flow.d.ts +36 -0
- package/dist/types/feedback/handlers.d.ts +16 -0
- package/dist/types/feedback/history.d.ts +20 -0
- package/dist/types/feedback/identifiers.d.ts +16 -0
- package/dist/types/feedback/index.d.ts +16 -0
- package/dist/types/feedback/iso-time.d.ts +2 -0
- package/dist/types/feedback/issue-text.d.ts +50 -0
- package/dist/types/feedback/log-text.d.ts +13 -0
- package/dist/types/feedback/markdown.d.ts +4 -0
- package/dist/types/feedback/reporting.d.ts +25 -0
- package/dist/types/feedback/scene.d.ts +65 -0
- package/dist/types/feedback/service.d.ts +74 -0
- package/dist/types/feedback/thumbs.d.ts +59 -0
- package/dist/types/feedback/views.d.ts +35 -0
- package/dist/types/guardrails/correlation.d.ts +8 -0
- package/dist/types/guardrails/guardrails.d.ts +49 -0
- package/dist/types/guardrails/index.d.ts +4 -0
- package/dist/types/guardrails/operations.d.ts +22 -0
- package/dist/types/guardrails/sha256.d.ts +1 -0
- package/dist/types/inbound-text/index.d.ts +9 -0
- package/dist/types/inbound-text/marked-text.d.ts +20 -0
- package/dist/types/inbound-text/quote-block.d.ts +26 -0
- package/dist/types/inbound-text/redact.d.ts +8 -0
- package/dist/types/inbound-text/when.d.ts +2 -0
- package/dist/types/inbound-text/with-links.d.ts +20 -0
- package/dist/types/index.d.ts +73 -0
- package/dist/types/json.d.ts +5 -0
- package/dist/types/language/detect.d.ts +21 -0
- package/dist/types/limits/inbound-stats.d.ts +42 -0
- package/dist/types/limits/index.d.ts +5 -0
- package/dist/types/limits/rate-limiter.d.ts +32 -0
- package/dist/types/limits/user-limits.d.ts +18 -0
- package/dist/types/limits/wait-words.d.ts +3 -0
- package/dist/types/locales/account.d.ts +49 -0
- package/dist/types/locales/approval-decisions.d.ts +28 -0
- package/dist/types/locales/approval.d.ts +31 -0
- package/dist/types/locales/assistant-actions.d.ts +65 -0
- package/dist/types/locales/assistant-board.d.ts +14 -0
- package/dist/types/locales/assistant-cards.d.ts +81 -0
- package/dist/types/locales/assistant-chat.d.ts +13 -0
- package/dist/types/locales/assistant-devenv-hide.d.ts +23 -0
- package/dist/types/locales/assistant-work-clicks.d.ts +98 -0
- package/dist/types/locales/assistant.d.ts +5 -0
- package/dist/types/locales/brief.d.ts +29 -0
- package/dist/types/locales/catalog.d.ts +24 -0
- package/dist/types/locales/claw.d.ts +5 -0
- package/dist/types/locales/commands.d.ts +12 -0
- package/dist/types/locales/connector-reasons.d.ts +95 -0
- package/dist/types/locales/connector-setup.d.ts +20 -0
- package/dist/types/locales/feedback.d.ts +75 -0
- package/dist/types/locales/group.d.ts +33 -0
- package/dist/types/locales/guardrails.d.ts +22 -0
- package/dist/types/locales/help-lead.d.ts +15 -0
- package/dist/types/locales/index.d.ts +16 -0
- package/dist/types/locales/lang.d.ts +9 -0
- package/dist/types/locales/limits.d.ts +19 -0
- package/dist/types/locales/link.d.ts +40 -0
- package/dist/types/locales/observe.d.ts +113 -0
- package/dist/types/locales/proactive-lines.d.ts +12 -0
- package/dist/types/locales/proactive.d.ts +62 -0
- package/dist/types/locales/remote-agents.d.ts +216 -0
- package/dist/types/locales/remote-leads.d.ts +13 -0
- package/dist/types/locales/remote-window-card.d.ts +46 -0
- package/dist/types/locales/remote-window.d.ts +21 -0
- package/dist/types/locales/remote.d.ts +365 -0
- package/dist/types/locales/review-account.d.ts +43 -0
- package/dist/types/locales/review-github.d.ts +19 -0
- package/dist/types/locales/review-receipt.d.ts +45 -0
- package/dist/types/locales/review-request.d.ts +21 -0
- package/dist/types/locales/review-start.d.ts +46 -0
- package/dist/types/locales/routing.d.ts +21 -0
- package/dist/types/locales/sessions.d.ts +38 -0
- package/dist/types/locales/settings.d.ts +46 -0
- package/dist/types/locales/steps.d.ts +42 -0
- package/dist/types/locales/transparency.d.ts +18 -0
- package/dist/types/locales/turn.d.ts +70 -0
- package/dist/types/locales/typed-answer.d.ts +32 -0
- package/dist/types/note/note.d.ts +22 -0
- package/dist/types/observability/ip-address.d.ts +13 -0
- package/dist/types/observability/metrics-catalog.d.ts +17 -0
- package/dist/types/observability/security-events.d.ts +26 -0
- package/dist/types/observability/security-fields.d.ts +8 -0
- package/dist/types/observability/security-log.d.ts +21 -0
- package/dist/types/observe/board.d.ts +18 -0
- package/dist/types/observe/command.d.ts +6 -0
- package/dist/types/observe/index.d.ts +6 -0
- package/dist/types/observe/observer.d.ts +45 -0
- package/dist/types/observe/suggestions.d.ts +16 -0
- package/dist/types/observe/views.d.ts +19 -0
- package/dist/types/own.d.ts +9 -0
- package/dist/types/plugins/feedback-sink.d.ts +31 -0
- package/dist/types/plugins/identity-lookup.d.ts +21 -0
- package/dist/types/plugins/index.d.ts +31 -0
- package/dist/types/plugins/integrations.d.ts +34 -0
- package/dist/types/plugins/key-revoker.d.ts +10 -0
- package/dist/types/plugins/model-refusal-policy.d.ts +25 -0
- package/dist/types/plugins/route-extension.d.ts +27 -0
- package/dist/types/plugins/token-exchange.d.ts +36 -0
- package/dist/types/ports/claw/assistant.d.ts +55 -0
- package/dist/types/ports/claw/index.d.ts +28 -0
- package/dist/types/ports/claw/remote-agents.d.ts +53 -0
- package/dist/types/ports/claw/sessions.d.ts +105 -0
- package/dist/types/ports/claw/settings.d.ts +62 -0
- package/dist/types/ports/claw/work-items.d.ts +32 -0
- package/dist/types/ports/clock.d.ts +17 -0
- package/dist/types/ports/crypto.d.ts +15 -0
- package/dist/types/ports/github.d.ts +97 -0
- package/dist/types/ports/index.d.ts +18 -0
- package/dist/types/ports/logger.d.ts +19 -0
- package/dist/types/ports/metrics.d.ts +21 -0
- package/dist/types/ports/random.d.ts +15 -0
- package/dist/types/ports/request-scope.d.ts +31 -0
- package/dist/types/ports/routing.d.ts +107 -0
- package/dist/types/ports/secret-source.d.ts +21 -0
- package/dist/types/ports/store/approvals.d.ts +47 -0
- package/dist/types/ports/store/assistant.d.ts +104 -0
- package/dist/types/ports/store/feedback.d.ts +80 -0
- package/dist/types/ports/store/github.d.ts +81 -0
- package/dist/types/ports/store/idempotency.d.ts +21 -0
- package/dist/types/ports/store/index.d.ts +65 -0
- package/dist/types/ports/store/json.d.ts +4 -0
- package/dist/types/ports/store/link.d.ts +39 -0
- package/dist/types/ports/store/notify.d.ts +28 -0
- package/dist/types/ports/store/observe.d.ts +53 -0
- package/dist/types/ports/store/onboarding.d.ts +49 -0
- package/dist/types/ports/store/people.d.ts +77 -0
- package/dist/types/ports/store/policy.d.ts +60 -0
- package/dist/types/ports/store/remote.d.ts +114 -0
- package/dist/types/ports/store/sessions.d.ts +59 -0
- package/dist/types/ports/store/turns.d.ts +30 -0
- package/dist/types/ports/surface.d.ts +394 -0
- package/dist/types/ports/turn-cards.d.ts +52 -0
- package/dist/types/proactive/deliver.d.ts +52 -0
- package/dist/types/proactive/deps.d.ts +77 -0
- package/dist/types/proactive/events.d.ts +10 -0
- package/dist/types/proactive/index.d.ts +6 -0
- package/dist/types/proactive/proactive.d.ts +62 -0
- package/dist/types/proactive/quiet.d.ts +27 -0
- package/dist/types/proactive/release.d.ts +24 -0
- package/dist/types/proactive/said-memory.d.ts +21 -0
- package/dist/types/proactive/views.d.ts +67 -0
- package/dist/types/protocol/claw-api/assistant-events.d.ts +223 -0
- package/dist/types/protocol/claw-api/index.d.ts +5 -0
- package/dist/types/protocol/claw-api/notifications.d.ts +85 -0
- package/dist/types/protocol/claw-api/reviews.d.ts +63 -0
- package/dist/types/protocol/claw-api/session-events.d.ts +34 -0
- package/dist/types/protocol/claw-api/work-items.d.ts +75 -0
- package/dist/types/protocol/remote-agents.d.ts +230 -0
- package/dist/types/protocol.d.ts +10 -0
- package/dist/types/public-error/classify.d.ts +21 -0
- package/dist/types/public-error/index.d.ts +4 -0
- package/dist/types/public-error/patterns.d.ts +20 -0
- package/dist/types/public-error/public-error-log.d.ts +15 -0
- package/dist/types/public-error/public-errors.d.ts +20 -0
- package/dist/types/remote/actions.d.ts +36 -0
- package/dist/types/remote/agents.d.ts +37 -0
- package/dist/types/remote/answer.d.ts +9 -0
- package/dist/types/remote/board.d.ts +108 -0
- package/dist/types/remote/cards.d.ts +4 -0
- package/dist/types/remote/chat-key.d.ts +13 -0
- package/dist/types/remote/chats.d.ts +76 -0
- package/dist/types/remote/clicks-machine.d.ts +24 -0
- package/dist/types/remote/clicks-start.d.ts +36 -0
- package/dist/types/remote/clicks.d.ts +61 -0
- package/dist/types/remote/commands.d.ts +60 -0
- package/dist/types/remote/connector/reasons.d.ts +31 -0
- package/dist/types/remote/connector/setup.d.ts +62 -0
- package/dist/types/remote/context.d.ts +101 -0
- package/dist/types/remote/conversations.d.ts +37 -0
- package/dist/types/remote/ended.d.ts +25 -0
- package/dist/types/remote/events.d.ts +65 -0
- package/dist/types/remote/fields.d.ts +7 -0
- package/dist/types/remote/follow/control.d.ts +39 -0
- package/dist/types/remote/follow/follower.d.ts +85 -0
- package/dist/types/remote/follow/inbox.d.ts +16 -0
- package/dist/types/remote/follow/speaker.d.ts +122 -0
- package/dist/types/remote/follow/steps.d.ts +9 -0
- package/dist/types/remote/follow/timings.d.ts +29 -0
- package/dist/types/remote/health.d.ts +20 -0
- package/dist/types/remote/index.d.ts +21 -0
- package/dist/types/remote/inert.d.ts +18 -0
- package/dist/types/remote/limits.d.ts +48 -0
- package/dist/types/remote/lines.d.ts +66 -0
- package/dist/types/remote/links/answer.d.ts +7 -0
- package/dist/types/remote/links/domains.d.ts +19 -0
- package/dist/types/remote/links/hosts.d.ts +2 -0
- package/dist/types/remote/links/scans.d.ts +27 -0
- package/dist/types/remote/listing.d.ts +38 -0
- package/dist/types/remote/lists.d.ts +56 -0
- package/dist/types/remote/machines.d.ts +54 -0
- package/dist/types/remote/marks.d.ts +5 -0
- package/dist/types/remote/model.d.ts +51 -0
- package/dist/types/remote/options.d.ts +20 -0
- package/dist/types/remote/permissions.d.ts +41 -0
- package/dist/types/remote/ports.d.ts +143 -0
- package/dist/types/remote/prompt.d.ts +60 -0
- package/dist/types/remote/refusals.d.ts +40 -0
- package/dist/types/remote/remote-agents.d.ts +84 -0
- package/dist/types/remote/reported.d.ts +8 -0
- package/dist/types/remote/session-ops.d.ts +57 -0
- package/dist/types/remote/sessions.d.ts +80 -0
- package/dist/types/remote/setup.d.ts +26 -0
- package/dist/types/remote/state.d.ts +55 -0
- package/dist/types/remote/tail.d.ts +63 -0
- package/dist/types/remote/targets.d.ts +66 -0
- package/dist/types/remote/tasks.d.ts +20 -0
- package/dist/types/remote/time.d.ts +15 -0
- package/dist/types/remote/turn-state.d.ts +29 -0
- package/dist/types/remote/turns/chat-turn.d.ts +50 -0
- package/dist/types/remote/turns/display.d.ts +18 -0
- package/dist/types/remote/turns/outcome.d.ts +41 -0
- package/dist/types/remote/turns/runner.d.ts +55 -0
- package/dist/types/remote/turns/signer.d.ts +14 -0
- package/dist/types/remote/turns/window-turn.d.ts +29 -0
- package/dist/types/remote/views.d.ts +13 -0
- package/dist/types/remote/watches.d.ts +64 -0
- package/dist/types/remote/window/closer.d.ts +14 -0
- package/dist/types/remote/window/index.d.ts +2 -0
- package/dist/types/remote/window/output.d.ts +28 -0
- package/dist/types/remote/window/view.d.ts +73 -0
- package/dist/types/remote-view/agents-view.d.ts +88 -0
- package/dist/types/remote-view/conversations-view.d.ts +51 -0
- package/dist/types/remote-view/hidden-view.d.ts +20 -0
- package/dist/types/remote-view/index.d.ts +40 -0
- package/dist/types/remote-view/live-view.d.ts +44 -0
- package/dist/types/remote-view/machine-views.d.ts +73 -0
- package/dist/types/remote-view/messages.d.ts +3 -0
- package/dist/types/remote-view/permission-view.d.ts +55 -0
- package/dist/types/remote-view/sessions-view.d.ts +70 -0
- package/dist/types/remote-view/status-view.d.ts +52 -0
- package/dist/types/remote-view/window-view.d.ts +68 -0
- package/dist/types/result.d.ts +31 -0
- package/dist/types/review/connect/connections.d.ts +24 -0
- package/dist/types/review/connect/github-connect.d.ts +50 -0
- package/dist/types/review/connect/questions.d.ts +6 -0
- package/dist/types/review/connect/review-ask.d.ts +1 -0
- package/dist/types/review/consent.d.ts +13 -0
- package/dist/types/review/handoff.d.ts +22 -0
- package/dist/types/review/held.d.ts +15 -0
- package/dist/types/review/index.d.ts +14 -0
- package/dist/types/review/intent-check.d.ts +36 -0
- package/dist/types/review/outcome.d.ts +36 -0
- package/dist/types/review/progress.d.ts +50 -0
- package/dist/types/review/prompts.d.ts +2 -0
- package/dist/types/review/receipt.d.ts +45 -0
- package/dist/types/review/refusals.d.ts +44 -0
- package/dist/types/review/request-parse.d.ts +40 -0
- package/dist/types/review/review-turn.d.ts +83 -0
- package/dist/types/review/service/account.d.ts +52 -0
- package/dist/types/review/service/chat.d.ts +18 -0
- package/dist/types/review/service/confirm.d.ts +49 -0
- package/dist/types/review/service/deps.d.ts +100 -0
- package/dist/types/review/service/follow.d.ts +53 -0
- package/dist/types/review/service/github-review.d.ts +72 -0
- package/dist/types/review/service/handoff-action.d.ts +32 -0
- package/dist/types/review/service/identity.d.ts +27 -0
- package/dist/types/review/service/item-cards.d.ts +39 -0
- package/dist/types/review/service/items.d.ts +57 -0
- package/dist/types/review/service/launch.d.ts +37 -0
- package/dist/types/review/service/notices.d.ts +42 -0
- package/dist/types/review/service/request.d.ts +58 -0
- package/dist/types/review/service/reviewer.d.ts +48 -0
- package/dist/types/review/service/routed-turn.d.ts +20 -0
- package/dist/types/review/service/start.d.ts +65 -0
- package/dist/types/review/service/turns.d.ts +38 -0
- package/dist/types/review/summary.d.ts +11 -0
- package/dist/types/review/views.d.ts +91 -0
- package/dist/types/review-text/asks.d.ts +13 -0
- package/dist/types/review-text/bare-numbers.d.ts +29 -0
- package/dist/types/review-text/index.d.ts +10 -0
- package/dist/types/review-text/markers.d.ts +6 -0
- package/dist/types/review-text/names.d.ts +60 -0
- package/dist/types/review-text/pull-ref.d.ts +25 -0
- package/dist/types/review-text/text/scan.d.ts +19 -0
- package/dist/types/review-text/text/unicode.d.ts +22 -0
- package/dist/types/routing/admission.d.ts +83 -0
- package/dist/types/routing/chat.d.ts +52 -0
- package/dist/types/routing/command-table.d.ts +32 -0
- package/dist/types/routing/commands-account.d.ts +26 -0
- package/dist/types/routing/commands-session.d.ts +40 -0
- package/dist/types/routing/commands-settings.d.ts +17 -0
- package/dist/types/routing/context.d.ts +38 -0
- package/dist/types/routing/credentials.d.ts +53 -0
- package/dist/types/routing/deps.d.ts +116 -0
- package/dist/types/routing/features.d.ts +256 -0
- package/dist/types/routing/group-remote.d.ts +26 -0
- package/dist/types/routing/group-router.d.ts +42 -0
- package/dist/types/routing/identity.d.ts +18 -0
- package/dist/types/routing/index.d.ts +26 -0
- package/dist/types/routing/link-commands.d.ts +26 -0
- package/dist/types/routing/lock.d.ts +5 -0
- package/dist/types/routing/onboarding.d.ts +51 -0
- package/dist/types/routing/personal-router.d.ts +34 -0
- package/dist/types/routing/personal-text.d.ts +62 -0
- package/dist/types/routing/router.d.ts +57 -0
- package/dist/types/routing/show-here.d.ts +18 -0
- package/dist/types/routing/stop-press.d.ts +19 -0
- package/dist/types/routing/time.d.ts +31 -0
- package/dist/types/routing/turn-registry.d.ts +71 -0
- package/dist/types/routing/turn-runner.d.ts +82 -0
- package/dist/types/routing/turn-start.d.ts +81 -0
- package/dist/types/routing/views.d.ts +104 -0
- package/dist/types/security/redact-scan.d.ts +19 -0
- package/dist/types/security/redact-text.d.ts +14 -0
- package/dist/types/security/redact.d.ts +2 -0
- package/dist/types/subscriptions/event-types.d.ts +29 -0
- package/dist/types/subscriptions/index.d.ts +3 -0
- package/dist/types/subscriptions/ports.d.ts +9 -0
- package/dist/types/subscriptions/subscriptions.d.ts +69 -0
- package/dist/types/text/neutral.d.ts +1 -0
- package/dist/types/text/plain.d.ts +6 -0
- package/dist/types/text/py-chars.d.ts +12 -0
- package/dist/types/text/py-json.d.ts +23 -0
- package/dist/types/text/py-number.d.ts +18 -0
- package/dist/types/text/py-regex-escapes.d.ts +32 -0
- package/dist/types/text/py-regex.d.ts +36 -0
- package/dist/types/text/py-text.d.ts +64 -0
- package/dist/types/turn/answer-parts.d.ts +23 -0
- package/dist/types/turn/changes.d.ts +42 -0
- package/dist/types/turn/clip.d.ts +6 -0
- package/dist/types/turn/deliveries.d.ts +31 -0
- package/dist/types/turn/engine/claw-errors.d.ts +7 -0
- package/dist/types/turn/engine/consume.d.ts +35 -0
- package/dist/types/turn/engine/context.d.ts +157 -0
- package/dist/types/turn/engine/extras.d.ts +16 -0
- package/dist/types/turn/engine/fallback.d.ts +17 -0
- package/dist/types/turn/engine/outcome.d.ts +33 -0
- package/dist/types/turn/engine/run-turn.d.ts +22 -0
- package/dist/types/turn/engine/submit.d.ts +23 -0
- package/dist/types/turn/files.d.ts +10 -0
- package/dist/types/turn/github-outcome.d.ts +16 -0
- package/dist/types/turn/index.d.ts +26 -0
- package/dist/types/turn/json.d.ts +10 -0
- package/dist/types/turn/last-answer.d.ts +44 -0
- package/dist/types/turn/live-view.d.ts +67 -0
- package/dist/types/turn/plan.d.ts +31 -0
- package/dist/types/turn/ports.d.ts +15 -0
- package/dist/types/turn/progress/answer-messages.d.ts +20 -0
- package/dist/types/turn/progress/status-message.d.ts +144 -0
- package/dist/types/turn/progress/status-policy.d.ts +66 -0
- package/dist/types/turn/progress/status-text.d.ts +10 -0
- package/dist/types/turn/progress/stream-handle.d.ts +39 -0
- package/dist/types/turn/records.d.ts +10 -0
- package/dist/types/turn/runner.d.ts +106 -0
- package/dist/types/turn/step-labels.d.ts +28 -0
- package/dist/types/turn/step.d.ts +26 -0
- package/dist/types/turn/stop-buttons.d.ts +62 -0
- package/dist/types/turn/task.d.ts +33 -0
- package/dist/types/turn/turn-state.d.ts +70 -0
- package/dist/types/turn/views.d.ts +23 -0
- package/dist/types/typed-answer/index.d.ts +8 -0
- package/dist/types/typed-answer/mode.d.ts +38 -0
- package/dist/types/typed-answer/patterns.d.ts +25 -0
- package/dist/types/typed-answer/prompt.d.ts +5 -0
- package/dist/types/typed-answer/read.d.ts +16 -0
- package/dist/types/understanding/commands.d.ts +14 -0
- package/dist/types/understanding/context.d.ts +49 -0
- package/dist/types/understanding/index.d.ts +11 -0
- package/dist/types/understanding/limits.d.ts +6 -0
- package/dist/types/understanding/people.d.ts +31 -0
- package/dist/types/understanding/record.d.ts +10 -0
- package/dist/types/understanding/review-stop.d.ts +7 -0
- package/dist/types/understanding/sequence-matcher.d.ts +7 -0
- package/dist/types/validate.d.ts +15 -0
- package/package.json +35 -4
- package/README.md +0 -3
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { FeedbackSink } from "../plugins/feedback-sink.js";
|
|
2
|
+
import type { ClawSessionsPort } from "../ports/claw/sessions.js";
|
|
3
|
+
import { type Clock } from "../ports/clock.js";
|
|
4
|
+
import type { Logger } from "../ports/logger.js";
|
|
5
|
+
import type { FeedbackRepository } from "../ports/store/feedback.js";
|
|
6
|
+
import type { LinkRepository } from "../ports/store/link.js";
|
|
7
|
+
import { FeedbackDelivery, type ReportDeliveryKind } from "./delivery.js";
|
|
8
|
+
import { type TurnText } from "./exchange.js";
|
|
9
|
+
import { type IssueWording, type Mask } from "./issue-text.js";
|
|
10
|
+
import { type Scene } from "./scene.js";
|
|
11
|
+
import type { FeedbackOfferView, FeedbackReportView } from "./views.js";
|
|
12
|
+
/** What the deployment says about itself in a report (image tags read at start; "" when not said). */
|
|
13
|
+
export interface WorkerInfo {
|
|
14
|
+
readonly pluginId: string;
|
|
15
|
+
readonly version: string;
|
|
16
|
+
readonly workerImage: string;
|
|
17
|
+
readonly apiImage: string;
|
|
18
|
+
readonly brainImage: string;
|
|
19
|
+
}
|
|
20
|
+
export interface Reporter {
|
|
21
|
+
readonly userId: string;
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly email: string;
|
|
24
|
+
/** "" for the 1:1 chat, the conversation id of a group. */
|
|
25
|
+
readonly scope: string;
|
|
26
|
+
/** The conversation, for its log lines. */
|
|
27
|
+
readonly conversationId: string;
|
|
28
|
+
}
|
|
29
|
+
/** The worker's own recent log lines of one chat (ids and levels only), newest last. */
|
|
30
|
+
export interface LogTail {
|
|
31
|
+
tail(userId: string, conversationId: string): readonly string[];
|
|
32
|
+
}
|
|
33
|
+
export interface FeedbackServiceDeps {
|
|
34
|
+
readonly reports: FeedbackRepository;
|
|
35
|
+
readonly links: Pick<LinkRepository, "clawUserIdOf">;
|
|
36
|
+
readonly sessions: Pick<ClawSessionsPort, "events" | "stream" | "turn">;
|
|
37
|
+
readonly sink: FeedbackSink | undefined;
|
|
38
|
+
readonly clock: Clock;
|
|
39
|
+
readonly log: Logger;
|
|
40
|
+
readonly mask: Mask;
|
|
41
|
+
readonly turnText: TurnText;
|
|
42
|
+
readonly wording: IssueWording;
|
|
43
|
+
readonly publicBaseUrl: string;
|
|
44
|
+
readonly worker: WorkerInfo;
|
|
45
|
+
readonly logs?: LogTail;
|
|
46
|
+
}
|
|
47
|
+
export interface ReportResult {
|
|
48
|
+
readonly kind: ReportDeliveryKind;
|
|
49
|
+
readonly number?: number;
|
|
50
|
+
readonly url?: string;
|
|
51
|
+
readonly sessionId: string;
|
|
52
|
+
/** The newest turn of the session: what "my last question and answer" means. */
|
|
53
|
+
readonly lastTurnId: string;
|
|
54
|
+
}
|
|
55
|
+
export type OfferOutcome = "invalid" | "declined" | "added" | "empty" | "retry";
|
|
56
|
+
export declare class FeedbackService {
|
|
57
|
+
private readonly deps;
|
|
58
|
+
readonly delivery: FeedbackDelivery;
|
|
59
|
+
private readonly history;
|
|
60
|
+
constructor(deps: FeedbackServiceDeps);
|
|
61
|
+
get configured(): boolean;
|
|
62
|
+
/** Record the report, then try to deliver it: the record comes first, so nothing is lost on a failure. */
|
|
63
|
+
report(who: Reporter, text: string, key: string | undefined, sessionId: string | undefined): Promise<ReportResult>;
|
|
64
|
+
/** The scene of this chat. Whatever cannot be read is said so in it, and the report goes ahead without it. */
|
|
65
|
+
collect(who: Reporter, key: string | undefined, sessionId: string | undefined): Promise<Scene>;
|
|
66
|
+
private readTurns;
|
|
67
|
+
/** The Yes/No offer for a report that reached the sink, when there is a turn to include; else undefined. */
|
|
68
|
+
makeOffer(userId: string, result: ReportResult): FeedbackOfferView | undefined;
|
|
69
|
+
/** The Report a problem button under a message of `userId`'s that went wrong (in a group only they can use it). */
|
|
70
|
+
reportView(userId: string, scope: string): FeedbackReportView;
|
|
71
|
+
/** A press on Yes or No under the offer; the offer is read from the store, never from the card. */
|
|
72
|
+
answerOffer(userId: string, key: string, offerId: string, include: boolean): Promise<[OfferOutcome, number]>;
|
|
73
|
+
private addExchange;
|
|
74
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ClawAssistantPort } from "../ports/claw/assistant.js";
|
|
2
|
+
import type { ClawSessionsPort } from "../ports/claw/sessions.js";
|
|
3
|
+
import type { Logger } from "../ports/logger.js";
|
|
4
|
+
import type { ClickHandler, RouteBase, VoteHandler } from "../ports/routing.js";
|
|
5
|
+
import type { SessionRepository } from "../ports/store/sessions.js";
|
|
6
|
+
import { type InboundVote, type OutMessage, type UserRef } from "../ports/surface.js";
|
|
7
|
+
import type { Mask } from "./issue-text.js";
|
|
8
|
+
import type { FeedbackReporting } from "./reporting.js";
|
|
9
|
+
/**
|
|
10
|
+
* The worker's own thumbs under a final answer, for a client whose thumbs never reach it (Python render.py
|
|
11
|
+
* `thumbs_card`): the turn engine's `TurnCards.thumbs()`, sent as it is. Its fallback text is the card's question.
|
|
12
|
+
*/
|
|
13
|
+
export declare function thumbsMessage(): OutMessage;
|
|
14
|
+
/** The comment a vote carries, clipped (Claw takes up to 8192). */
|
|
15
|
+
export declare const VOTE_REASON_MAX = 2000;
|
|
16
|
+
export type Reaction = "like" | "dislike";
|
|
17
|
+
export interface ThumbsDeps {
|
|
18
|
+
readonly reporting: FeedbackReporting;
|
|
19
|
+
readonly sessions: Pick<SessionRepository, "getSession">;
|
|
20
|
+
readonly claw: {
|
|
21
|
+
readonly sessions: Pick<ClawSessionsPort, "vote">;
|
|
22
|
+
readonly assistant: Pick<ClawAssistantPort, "session">;
|
|
23
|
+
};
|
|
24
|
+
readonly credential: (sender: UserRef) => Promise<string | undefined>;
|
|
25
|
+
/** A 1:1 chat that talks to the person's assistant (its answers are in the assistant's session). */
|
|
26
|
+
readonly assistantOn: (userId: string) => boolean;
|
|
27
|
+
/** SHA-256 of a text, as lowercase hex (the runtime's crypto). */
|
|
28
|
+
readonly sha256Hex: (text: string) => string;
|
|
29
|
+
readonly mask: Mask;
|
|
30
|
+
readonly log: Logger;
|
|
31
|
+
}
|
|
32
|
+
/** The key a thumb is stored under in Claw: `teams:<message id>`, hashed when Claw would refuse it as it is. */
|
|
33
|
+
export declare function voteMessageId(sha256Hex: (text: string) => string, messageId: string): string | undefined;
|
|
34
|
+
export declare class FeedbackThumbs {
|
|
35
|
+
private readonly deps;
|
|
36
|
+
private readonly counts;
|
|
37
|
+
private readonly background;
|
|
38
|
+
constructor(deps: ThumbsDeps);
|
|
39
|
+
/** The bot's own thumbs card and the comment card a thumbs-down turns it into. */
|
|
40
|
+
readonly clicks: ClickHandler;
|
|
41
|
+
/** The thumbs counted since start. */
|
|
42
|
+
get counted(): Readonly<Record<Reaction, number>>;
|
|
43
|
+
/** Resolves when every vote and report started so far has finished (for an orderly stop, and for tests). */
|
|
44
|
+
settled(): Promise<void>;
|
|
45
|
+
/** The channel's own thumbs, as the router hands them on (Python agent.py: an invoke `thumb_of` reads). */
|
|
46
|
+
readonly votes: VoteHandler;
|
|
47
|
+
/** The channel's own thumbs: the person has written their comment in the channel's form. */
|
|
48
|
+
onVote(route: RouteBase, vote: InboundVote): void;
|
|
49
|
+
private click;
|
|
50
|
+
/** Send or Skip under a thumbs-down: filed with what was typed (Skip: without), the card ends as a note. */
|
|
51
|
+
private noteClick;
|
|
52
|
+
private count;
|
|
53
|
+
private track;
|
|
54
|
+
/** The vote, in the background, never said to the person: one that is not recorded is logged with why. */
|
|
55
|
+
private vote;
|
|
56
|
+
private voteInClaw;
|
|
57
|
+
/** A thumbs-down is filed like /feedback, in the background. */
|
|
58
|
+
private fileThumb;
|
|
59
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The views of feedback, as core knows them (a channel renders each one; Teams: `teams/src/views/feedback/`). They carry
|
|
3
|
+
* ids only: whose a button is, and which issue or turn it means, is looked up in the store when it is pressed.
|
|
4
|
+
*/
|
|
5
|
+
/** Thumbs up and down under a final answer, where the channel's own thumbs do not reach the worker (Teams mobile). */
|
|
6
|
+
export type ThumbsView = Readonly<Record<string, never>>;
|
|
7
|
+
/** What a thumbs-down on `ThumbsView` turns into: an optional comment, Send or Skip. */
|
|
8
|
+
export type ThumbCommentView = Readonly<Record<string, never>>;
|
|
9
|
+
/** "Report a problem" under a message that went wrong. In a group only the asker may use it, and the card says so. */
|
|
10
|
+
export interface FeedbackReportView {
|
|
11
|
+
readonly promptId: string;
|
|
12
|
+
readonly group: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** Yes or No: add the reporter's last question and answer to the issue. */
|
|
15
|
+
export interface FeedbackOfferView {
|
|
16
|
+
readonly offerId: string;
|
|
17
|
+
readonly issueNumber: number;
|
|
18
|
+
}
|
|
19
|
+
/** The offer after a Yes that could not be carried out: a note saying so, with Yes and No again. */
|
|
20
|
+
export interface FeedbackOfferRetryView extends FeedbackOfferView {
|
|
21
|
+
readonly note: string;
|
|
22
|
+
}
|
|
23
|
+
declare module "../ports/surface.js" {
|
|
24
|
+
interface ViewMap {
|
|
25
|
+
thumbs: ThumbsView;
|
|
26
|
+
thumbComment: ThumbCommentView;
|
|
27
|
+
feedbackReport: FeedbackReportView;
|
|
28
|
+
feedbackOffer: FeedbackOfferView;
|
|
29
|
+
feedbackOfferRetry: FeedbackOfferRetryView;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/** The longest comment a thumbs-down card takes (the card's own limit; the handler clips again). */
|
|
33
|
+
export declare const THUMB_COMMENT_MAX = 1000;
|
|
34
|
+
/** The question the offer asks. */
|
|
35
|
+
export declare function offerTitle(issueNumber: number): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** One part of an operation's correlation id: an id, a number, a flag or nothing. */
|
|
2
|
+
export type CorrelationPart = string | number | boolean | null | undefined;
|
|
3
|
+
/**
|
|
4
|
+
* The id that ties the records of one operation together, derived from what every step of it knows (a Claw session
|
|
5
|
+
* and an approval id; a session, a repository and a pull request), so that nothing has to be stored to carry it:
|
|
6
|
+
* 32 hex characters.
|
|
7
|
+
*/
|
|
8
|
+
export declare function correlationId(...parts: CorrelationPart[]): string;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Limit } from "../config/settings.js";
|
|
2
|
+
import type { Lang } from "../locales/lang.js";
|
|
3
|
+
import type { SecurityEventName } from "../observability/security-events.js";
|
|
4
|
+
import type { Clock } from "../ports/clock.js";
|
|
5
|
+
import { type SensitiveOperation } from "./operations.js";
|
|
6
|
+
/** Ids of what an audit record is about (a session, a repository, a pull request); never text a person wrote. */
|
|
7
|
+
export type AuditFields = Readonly<Record<string, unknown>>;
|
|
8
|
+
/** Logs one security event (the observability module's `securityEvent`, bound to the worker's logger and metrics). */
|
|
9
|
+
export type AuditSink = (event: SecurityEventName, fields: AuditFields) => void;
|
|
10
|
+
/** An operation a limit refused, and when it can be done again. */
|
|
11
|
+
export declare class Refused {
|
|
12
|
+
readonly operation: SensitiveOperation;
|
|
13
|
+
readonly limit: Limit;
|
|
14
|
+
readonly retryAfterSeconds: number;
|
|
15
|
+
constructor(operation: SensitiveOperation, limit: Limit, retryAfterSeconds: number);
|
|
16
|
+
/** The sentence the person is told: what was refused, the limit, and when it can be done again. */
|
|
17
|
+
text(lang?: Lang): string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The per-person limits of the operations that act with someone's authority: a sliding window of how many times one
|
|
21
|
+
* person did each. Past it the operation is refused, with a `rate_limited` security event. Only the operation that adds
|
|
22
|
+
* authority is limited (approving, confirming, starting a review, switching to a mode that does not ask). The counts
|
|
23
|
+
* live in memory (one replica; a restart only ever lets a person do more, never less). One per worker.
|
|
24
|
+
*/
|
|
25
|
+
export declare class Guardrails {
|
|
26
|
+
private readonly clock;
|
|
27
|
+
private readonly audit;
|
|
28
|
+
readonly limits: ReadonlyMap<SensitiveOperation, Limit>;
|
|
29
|
+
/** `person\u001foperation` -> when it was done and the ticket it was taken with, oldest first */
|
|
30
|
+
private readonly done;
|
|
31
|
+
constructor(clock: Clock, audit: AuditSink, limits?: ReadonlyMap<string, Limit>);
|
|
32
|
+
private now;
|
|
33
|
+
/** The operation's limit; an operation that is not one refuses (Python's KeyError), never a property of Object.prototype. */
|
|
34
|
+
private limitOf;
|
|
35
|
+
/**
|
|
36
|
+
* Counts one `operation` by `person` and returns null, or, at the limit, counts nothing, logs a `rate_limited`
|
|
37
|
+
* security event (with `fields`: ids of what was refused) and returns the refusal. `ticket` names this count, for
|
|
38
|
+
* `giveBack` to undo exactly it.
|
|
39
|
+
*/
|
|
40
|
+
take(person: string, operation: SensitiveOperation, ticket?: object, fields?: AuditFields): Refused | null;
|
|
41
|
+
/**
|
|
42
|
+
* Undoes the `take` made with `ticket`: the operation was not done after all, so it must not use up the person's
|
|
43
|
+
* allowance. Exactly that count goes, never another one, and only once. A take without a ticket is never given back.
|
|
44
|
+
*/
|
|
45
|
+
giveBack(person: string, operation: SensitiveOperation, ticket: object | undefined): void;
|
|
46
|
+
private forget;
|
|
47
|
+
/** How many (person, operation) the guardrails remember. */
|
|
48
|
+
get remembered(): number;
|
|
49
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Limit } from "../config/settings.js";
|
|
2
|
+
/**
|
|
3
|
+
* The operations that act with someone's authority and are limited per person; the keys are the `operation`
|
|
4
|
+
* category of the security events.
|
|
5
|
+
*/
|
|
6
|
+
export declare const SENSITIVE_OPERATIONS: {
|
|
7
|
+
readonly pr_review: "start a review of a pull request for a colleague (each pull request), or post a held review with one's own GitHub account";
|
|
8
|
+
readonly pr_merge: "confirm a merge that Claw holds for the person whose GitHub account it uses";
|
|
9
|
+
readonly approval: "approve a tool call held for approval: a Claw session's approval card, or a remote agent's permission card";
|
|
10
|
+
readonly remote_agent: string;
|
|
11
|
+
};
|
|
12
|
+
export type SensitiveOperation = keyof typeof SENSITIVE_OPERATIONS;
|
|
13
|
+
export declare const SENSITIVE_OPERATION_NAMES: SensitiveOperation[];
|
|
14
|
+
/** The defaults, per person: a busy coding agent asks for many approvals, a person merges a few pull requests an hour. */
|
|
15
|
+
export declare const DEFAULT_LIMITS: Readonly<Record<SensitiveOperation, Limit>>;
|
|
16
|
+
/** TEAMS_LIMIT_PR_MERGE=20/3600; 0 turns that limit off. */
|
|
17
|
+
export declare const ENV_PREFIX = "TEAMS_LIMIT_";
|
|
18
|
+
/**
|
|
19
|
+
* The limits from the environment: `TEAMS_LIMIT_<OPERATION>` is `COUNT/SECONDS` (`20/3600`), or `0` to turn that
|
|
20
|
+
* limit off. Unset takes the default. Anything else throws (the worker stops at start: a typo must not lift a limit).
|
|
21
|
+
*/
|
|
22
|
+
export declare function parseLimits(env: (name: string) => string): Map<SensitiveOperation, Limit>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sha256Hex(text: string): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The texts the model is sent for an inbound message, built from core's inbound types alone: the quote block, the
|
|
3
|
+
* text with the addresses behind its links, and the text with its mentions marked.
|
|
4
|
+
*/
|
|
5
|
+
export * from "./marked-text.js";
|
|
6
|
+
export * from "./quote-block.js";
|
|
7
|
+
export * from "./redact.js";
|
|
8
|
+
export * from "./when.js";
|
|
9
|
+
export * from "./with-links.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The text of a group message with each person it @mentions replaced by a marker ⟦i⟧ (the Python worker's
|
|
3
|
+
* `activity.marked_text`), so a reader of the text (a review request: "请 ⟦0⟧ 帮我 review") can tell a person who was
|
|
4
|
+
* @mentioned from a name that was only typed; mention i is the i-th of the list returned. The addresses behind the
|
|
5
|
+
* links are added as `withLinks` adds them.
|
|
6
|
+
*
|
|
7
|
+
* Input is channel-neutral: the message's text (the bot's own mention already removed by the channel adapter) and its
|
|
8
|
+
* mentions, each replaced where it stands (`offset`), so a name typed before the same person's mention stays a name.
|
|
9
|
+
*/
|
|
10
|
+
import type { InboundLink, InboundMention } from "../ports/surface.js";
|
|
11
|
+
import { type WithLinksOptions } from "./with-links.js";
|
|
12
|
+
export interface MarkedText {
|
|
13
|
+
readonly text: string;
|
|
14
|
+
/** The mentions that were found in the text, in marker order. */
|
|
15
|
+
readonly mentions: readonly InboundMention[];
|
|
16
|
+
}
|
|
17
|
+
export interface MarkedTextOptions extends WithLinksOptions {
|
|
18
|
+
readonly links?: readonly InboundLink[];
|
|
19
|
+
}
|
|
20
|
+
export declare function markedText(text: string, mentions: readonly InboundMention[], options?: MarkedTextOptions): MarkedText;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The message(s) a person quoted, as text for the model (the Python worker's `activity.quote_block` and `with_quote`).
|
|
3
|
+
* Each quote is a line that says it is a quote and who wrote it ("Quoted your earlier reply" when that was the bot),
|
|
4
|
+
* then the quoted text with every line after "> ", so nothing a quote says can pass for a line of its own. In a group
|
|
5
|
+
* the author's name and the text are masked as an outbound message is; all the quotes of a message share one budget of
|
|
6
|
+
* QUOTE_CHARS characters, cut after the mask (a cut cannot leave half a credential).
|
|
7
|
+
*/
|
|
8
|
+
import { type Logger } from "../ports/logger.js";
|
|
9
|
+
import type { InboundQuote } from "../ports/surface.js";
|
|
10
|
+
import { type Redact } from "./redact.js";
|
|
11
|
+
/** The most quoted text, over all the quotes of one message, that is sent on (code points). */
|
|
12
|
+
export declare const QUOTE_CHARS = 4000;
|
|
13
|
+
/** The most quoted messages that are shown. */
|
|
14
|
+
export declare const QUOTE_COUNT = 5;
|
|
15
|
+
/** The longest author name shown. */
|
|
16
|
+
export declare const NAME_CHARS = 80;
|
|
17
|
+
export interface QuoteBlockOptions {
|
|
18
|
+
/** A group conversation: names and texts are masked. */
|
|
19
|
+
readonly group?: boolean;
|
|
20
|
+
readonly redact?: Redact;
|
|
21
|
+
readonly logger?: Logger;
|
|
22
|
+
}
|
|
23
|
+
/** `activity.quote_block`: the quotes as text for the model, "" when there are none. */
|
|
24
|
+
export declare function quoteBlock(quotes: readonly InboundQuote[], options?: QuoteBlockOptions): string;
|
|
25
|
+
/** `activity.with_quote`: what the model is sent, the quote (`quoteBlock`) before what the person wrote. */
|
|
26
|
+
export declare function withQuote(text: string, quote: string): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The masking the inbound texts apply in a group conversation (credential-shaped values: the Python worker's
|
|
3
|
+
* `redact.redact_text(...)[0]`), passed in by the caller. The texts here do not own a masking rule of their own.
|
|
4
|
+
*/
|
|
5
|
+
/** Masks credential-shaped values in `text`. */
|
|
6
|
+
export type Redact = (text: string) => string;
|
|
7
|
+
/** No masking: the default where a caller passes none (a 1:1 conversation needs none). */
|
|
8
|
+
export declare const noRedact: Redact;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A message's text with the address behind each of its links: what is sent on to the model, and what a review request
|
|
3
|
+
* reads (the Python worker's `activity.with_links` / `_with_links`). A link shown as other words ("fix the plugin
|
|
4
|
+
* check" over a pull request's address) gets its address right after those words; a link whose words are not in the
|
|
5
|
+
* text gets a line of its own. The commands are never read from this text, only from the words alone.
|
|
6
|
+
*/
|
|
7
|
+
import type { InboundLink } from "../ports/surface.js";
|
|
8
|
+
import { type Redact } from "./redact.js";
|
|
9
|
+
export interface WithLinksOptions {
|
|
10
|
+
/** A group conversation: every member sees what is sent on, so a credential in an address is masked. */
|
|
11
|
+
readonly group?: boolean;
|
|
12
|
+
readonly redact?: Redact;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* `text` with the address of every link it does not already carry: after the first place the link's words stand that
|
|
16
|
+
* no earlier link took, or on a line of its own (`_with_links`). Places are looked up in the original text only.
|
|
17
|
+
*/
|
|
18
|
+
export declare function insertLinks(text: string, links: readonly InboundLink[]): string;
|
|
19
|
+
/** `activity.with_links(text, activity)`: `insertLinks`, the addresses masked in a group. */
|
|
20
|
+
export declare function withLinks(text: string, links: readonly InboundLink[], options?: WithLinksOptions): string;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @primusclaw/personal-agent: the channel-neutral core of the personal agent.
|
|
3
|
+
*
|
|
4
|
+
* Layers (enforced by .dependency-cruiser.cjs and test/core-is-channel-neutral.test.ts): this package imports nothing
|
|
5
|
+
* but itself, zod and the Claw wire contract (through ./protocol.ts). Everything else reaches it through a port
|
|
6
|
+
* (`ports/`) or a plugin (`plugins/`), implemented by the runtime package, a channel package or a deployment.
|
|
7
|
+
*/
|
|
8
|
+
export * from "./errors.js";
|
|
9
|
+
export * from "./brief/index.js";
|
|
10
|
+
export * from "./feedback/index.js";
|
|
11
|
+
export * from "./json.js";
|
|
12
|
+
export * from "./own.js";
|
|
13
|
+
export * from "./guardrails/index.js";
|
|
14
|
+
export * from "./limits/index.js";
|
|
15
|
+
export * from "./review-text/index.js";
|
|
16
|
+
export { INTENT_PROMPT, MODE_PROMPT } from "./locales/review-github.js";
|
|
17
|
+
export * from "./typed-answer/index.js";
|
|
18
|
+
export * from "./understanding/index.js";
|
|
19
|
+
export * from "./locales/index.js";
|
|
20
|
+
export * from "./observe/index.js";
|
|
21
|
+
export * from "./plugins/index.js";
|
|
22
|
+
export * from "./ports/crypto.js";
|
|
23
|
+
export * from "./ports/index.js";
|
|
24
|
+
export * from "./ports/store/index.js";
|
|
25
|
+
export * from "./protocol.js";
|
|
26
|
+
export * from "./result.js";
|
|
27
|
+
export * from "./text/py-regex.js";
|
|
28
|
+
export * from "./text/py-text.js";
|
|
29
|
+
export * from "./validate.js";
|
|
30
|
+
export * from "./claw/credential.js";
|
|
31
|
+
export * from "./claw/errors.js";
|
|
32
|
+
export * from "./claw/model.js";
|
|
33
|
+
export * from "./claw/remote.js";
|
|
34
|
+
export * from "./config/settings.js";
|
|
35
|
+
export * from "./observability/security-events.js";
|
|
36
|
+
export * as turn from "./turn/index.js";
|
|
37
|
+
export { fetchChanges } from "./turn/changes.js";
|
|
38
|
+
export * from "./note/note.js";
|
|
39
|
+
export * from "./branding.js";
|
|
40
|
+
export * from "./claw/message-text.js";
|
|
41
|
+
export * from "./claw/requester-view.js";
|
|
42
|
+
export * from "./claw/service-refusal.js";
|
|
43
|
+
export * from "./claw/sse.js";
|
|
44
|
+
export * from "./claw/started-review.js";
|
|
45
|
+
export * from "./claw/work-item.js";
|
|
46
|
+
export * from "./locales/claw.js";
|
|
47
|
+
export * from "./public-error/index.js";
|
|
48
|
+
export * from "./security/redact.js";
|
|
49
|
+
export * from "./observability/ip-address.js";
|
|
50
|
+
export * from "./observability/security-fields.js";
|
|
51
|
+
export * from "./observability/security-log.js";
|
|
52
|
+
export * from "./claw/py-value.js";
|
|
53
|
+
export * from "./observability/metrics-catalog.js";
|
|
54
|
+
export * from "./language/detect.js";
|
|
55
|
+
export * from "./inbound-text/index.js";
|
|
56
|
+
export * from "./routing/index.js";
|
|
57
|
+
export * from "./approvals/index.js";
|
|
58
|
+
export * from "./assistant/index.js";
|
|
59
|
+
export * from "./assistant/work-items.js";
|
|
60
|
+
export type * from "./assistant/views.js";
|
|
61
|
+
export * from "./direct-chat/index.js";
|
|
62
|
+
export * from "./proactive/index.js";
|
|
63
|
+
export * from "./proactive/views.js";
|
|
64
|
+
export * from "./subscriptions/index.js";
|
|
65
|
+
export * from "./review/index.js";
|
|
66
|
+
export * as remoteDomain from "./remote/index.js";
|
|
67
|
+
export * as remoteView from "./remote-view/index.js";
|
|
68
|
+
export { RemoteAgents } from "./remote/remote-agents.js";
|
|
69
|
+
export type { RemoteContext, RemoteErrors, RemoteGuard, RemoteSettings } from "./remote/context.js";
|
|
70
|
+
export { ConnectorSetup, setupFrom } from "./remote/connector/setup.js";
|
|
71
|
+
export { CredentialUnavailable as FollowCredentialUnavailable } from "./remote/follow/follower.js";
|
|
72
|
+
export type { FollowReach } from "./remote/follow/speaker.js";
|
|
73
|
+
export { DEFAULT_TIMINGS as REMOTE_FOLLOW_TIMINGS, WATCH_TIMINGS as REMOTE_WATCH_TIMINGS, } from "./remote/follow/timings.js";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which language a person is answered in (teams_agent/approval_view.py: has_cjk, written_lang, pick_lang, answer_lang).
|
|
3
|
+
*
|
|
4
|
+
* The client's locale is passed in, never read from ambient state: the caller that handles an inbound message knows it.
|
|
5
|
+
*/
|
|
6
|
+
import type { Lang } from "../locales/lang.js";
|
|
7
|
+
export declare function hasCjk(text: unknown): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* The language a message is written in, when it says so: "zh" with Chinese in it, "en" for a sentence in English (three words or
|
|
10
|
+
* more, one of them glue, a lower-case -ed/-ing form, or the first a verb of a request); otherwise undefined.
|
|
11
|
+
*/
|
|
12
|
+
export declare function writtenLang(text: unknown): Lang | undefined;
|
|
13
|
+
/** Chinese when the first text that has any non-space character has Chinese in it, else English. */
|
|
14
|
+
export declare function pickLang(...texts: unknown[]): Lang;
|
|
15
|
+
/**
|
|
16
|
+
* The language a person is answered in: `said` (the conversation's chosen or learnt language) when set; else the locale of the
|
|
17
|
+
* Teams client the message being handled came from; else that of `texts` (`pickLang`).
|
|
18
|
+
*/
|
|
19
|
+
export declare function answerLang(said: string, clientLocale: string, ...texts: unknown[]): Lang;
|
|
20
|
+
/** Python's `str(x or "")`: the text of a value, "" for anything falsy. */
|
|
21
|
+
export declare function asText(value: unknown): string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Clock } from "../ports/clock.js";
|
|
2
|
+
import type { Logger } from "../ports/logger.js";
|
|
3
|
+
import { type MetricsPort } from "../ports/metrics.js";
|
|
4
|
+
/** One `inbound_stats` line per this many seconds (when anything happened). */
|
|
5
|
+
export declare const STATS_INTERVAL_SECONDS = 60;
|
|
6
|
+
/** What one `inbound_stats` line says. */
|
|
7
|
+
export interface InboundSnapshot {
|
|
8
|
+
readonly event: "inbound_stats";
|
|
9
|
+
readonly interval_seconds: number;
|
|
10
|
+
readonly handled: number;
|
|
11
|
+
readonly failed: number;
|
|
12
|
+
readonly lag_max_ms: number;
|
|
13
|
+
readonly lag_avg_ms: number;
|
|
14
|
+
readonly handle_max_ms: number;
|
|
15
|
+
readonly handle_avg_ms: number;
|
|
16
|
+
readonly rate_limited: number;
|
|
17
|
+
readonly concurrency_limited: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Counters for the inbound path, logged as one `inbound_stats` line per interval in which anything happened: messages
|
|
21
|
+
* handled, the longest and average time a message waited in the queue (lag), the longest and average handling time,
|
|
22
|
+
* failures, and refusals by a limit. Each message and refusal is also counted in `metrics`, for /metrics.
|
|
23
|
+
*/
|
|
24
|
+
export declare class InboundStats {
|
|
25
|
+
private readonly clock;
|
|
26
|
+
private readonly logger;
|
|
27
|
+
private readonly metrics;
|
|
28
|
+
private readonly intervalSeconds;
|
|
29
|
+
private counts;
|
|
30
|
+
private since;
|
|
31
|
+
constructor(clock: Clock, logger: Logger, metrics?: MetricsPort, intervalSeconds?: number);
|
|
32
|
+
private now;
|
|
33
|
+
/** Messages handled since the last line. */
|
|
34
|
+
get handled(): number;
|
|
35
|
+
processed(lagMs: number | null, handleMs: number, ok: boolean): void;
|
|
36
|
+
limited(reason: string): void;
|
|
37
|
+
/** Files a person sent that did not reach Claw, counted for /metrics only. */
|
|
38
|
+
filesDropped(path: string, count: number): void;
|
|
39
|
+
snapshot(): InboundSnapshot;
|
|
40
|
+
flushDue(): void;
|
|
41
|
+
flush(): void;
|
|
42
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Clock } from "../ports/clock.js";
|
|
2
|
+
/** Checks between two passes that forget idle people. */
|
|
3
|
+
export declare const PRUNE_EVERY = 1000;
|
|
4
|
+
/** The answer for one message. */
|
|
5
|
+
export interface Verdict {
|
|
6
|
+
readonly allowed: boolean;
|
|
7
|
+
/** Refused, and this is the first refusal of the burst: tell the person (once). */
|
|
8
|
+
readonly notify: boolean;
|
|
9
|
+
/** Refused: seconds until one message more fits in the window. */
|
|
10
|
+
readonly retryAfterSeconds: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A sliding window per person: at most `limit` accepted messages in any `windowSeconds`. Refused messages are not
|
|
14
|
+
* counted, so a person who keeps sending while refused is let through again as soon as the oldest accepted message
|
|
15
|
+
* leaves the window. A person is told once per burst, not once per dropped message.
|
|
16
|
+
*/
|
|
17
|
+
export declare class MessageRateLimiter {
|
|
18
|
+
readonly limit: number;
|
|
19
|
+
readonly windowSeconds: number;
|
|
20
|
+
private readonly clock;
|
|
21
|
+
private readonly hits;
|
|
22
|
+
/** person -> the end of the burst they were told about */
|
|
23
|
+
private readonly toldUntil;
|
|
24
|
+
private checks;
|
|
25
|
+
constructor(limit: number, windowSeconds: number, clock: Clock);
|
|
26
|
+
private now;
|
|
27
|
+
check(user: string): Verdict;
|
|
28
|
+
/** Forget people with nothing in the window (memory stays bounded by the people active in the last window). */
|
|
29
|
+
prune(): void;
|
|
30
|
+
/** How many people the limiter remembers. */
|
|
31
|
+
get remembered(): number;
|
|
32
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { UserLimits } from "../config/settings.js";
|
|
2
|
+
/** TEAMS_USER_MESSAGE_LIMIT: messages per window and person. */
|
|
3
|
+
export declare const DEFAULT_MESSAGE_LIMIT = 20;
|
|
4
|
+
/** TEAMS_USER_MESSAGE_WINDOW_SECONDS. */
|
|
5
|
+
export declare const DEFAULT_MESSAGE_WINDOW_SECONDS = 60;
|
|
6
|
+
/**
|
|
7
|
+
* TEAMS_USER_MAX_CONCURRENT_TASKS. A review request starts up to 10 pull requests at once, each a task; the default
|
|
8
|
+
* leaves room for that beside the person's 1:1 chat and a group.
|
|
9
|
+
*/
|
|
10
|
+
export declare const DEFAULT_MAX_CONCURRENT_TASKS = 12;
|
|
11
|
+
/**
|
|
12
|
+
* A message to the assistant may start a work item, which shows on the board only once the assistant decided to make
|
|
13
|
+
* one: until then (or for this long, when it starts none) it holds one task slot.
|
|
14
|
+
*/
|
|
15
|
+
export declare const ASSISTANT_PENDING_SECONDS = 90;
|
|
16
|
+
export declare const DEFAULT_USER_LIMITS: UserLimits;
|
|
17
|
+
/** `limits`, or a RangeError naming the first field that is not a positive whole number (they cannot be turned off). */
|
|
18
|
+
export declare function userLimits(limits?: UserLimits): UserLimits;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** `/whoami`, `/memory`, `/lang` and the first lines of help. */
|
|
2
|
+
export declare const accountText: import("./catalog.js").Catalog<{
|
|
3
|
+
connectedTo: (p: {
|
|
4
|
+
name: string;
|
|
5
|
+
email: string;
|
|
6
|
+
}) => string;
|
|
7
|
+
whoamiFirst: (p: {
|
|
8
|
+
name: string;
|
|
9
|
+
email: string;
|
|
10
|
+
}) => string;
|
|
11
|
+
whoamiUnknown: string;
|
|
12
|
+
memoryUnreadable: (p: {
|
|
13
|
+
page: string;
|
|
14
|
+
}) => string;
|
|
15
|
+
memoryUnavailable: string;
|
|
16
|
+
memoryOff: (p: {
|
|
17
|
+
page: string;
|
|
18
|
+
}) => string;
|
|
19
|
+
nothingRemembered: string;
|
|
20
|
+
memoryOn: (p: {
|
|
21
|
+
lines: string;
|
|
22
|
+
page: string;
|
|
23
|
+
}) => string;
|
|
24
|
+
memoryUsage: string;
|
|
25
|
+
memoryNotChanged: (p: {
|
|
26
|
+
page: string;
|
|
27
|
+
}) => string;
|
|
28
|
+
memoryTurnedOn: (p: {
|
|
29
|
+
page: string;
|
|
30
|
+
}) => string;
|
|
31
|
+
memoryTurnedOff: (p: {
|
|
32
|
+
page: string;
|
|
33
|
+
}) => string;
|
|
34
|
+
langChosen: (p: {
|
|
35
|
+
lang: string;
|
|
36
|
+
}) => "好的,以后用中文回复你。发 `/lang auto` 改回按你写的话自动选。" | "OK, I answer you in English from now on. Send `/lang auto` to have it follow what you write again.";
|
|
37
|
+
langUsage: string;
|
|
38
|
+
langWhySet: string;
|
|
39
|
+
langWhyWritten: string;
|
|
40
|
+
langWhyClient: string;
|
|
41
|
+
langIs: (p: {
|
|
42
|
+
name: string;
|
|
43
|
+
why: string;
|
|
44
|
+
}) => string;
|
|
45
|
+
}>;
|
|
46
|
+
/** The languages' names: [Chinese, English]. */
|
|
47
|
+
export declare const LANG_NAMES: Readonly<Record<"zh" | "en", readonly [string, string]>>;
|
|
48
|
+
/** `/memory on|off` in the words people use for it. */
|
|
49
|
+
export declare const MEMORY_SWITCH: Readonly<Record<string, boolean>>;
|