@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,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the review delegation service is built from: ports (store, Claw, GitHub, the channel, the token exchange, time),
|
|
3
|
+
* and the hooks of the chat it runs in (the router starts its turns, admits its tasks and onboards people). Nothing here
|
|
4
|
+
* is a concrete adapter: the assembly passes them, and tests pass fakes.
|
|
5
|
+
*/
|
|
6
|
+
import type { JsonObject } from "../../json.js";
|
|
7
|
+
import type { Guardrails } from "../../guardrails/guardrails.js";
|
|
8
|
+
import type { Lang } from "../../locales/lang.js";
|
|
9
|
+
import type { TokenExchange } from "../../plugins/token-exchange.js";
|
|
10
|
+
import type { ClawPort } from "../../ports/claw/index.js";
|
|
11
|
+
import type { Clock } from "../../ports/clock.js";
|
|
12
|
+
import type { DeviceFlow, GithubCredentials, IntentReader, PullReader } from "../../ports/github.js";
|
|
13
|
+
import type { Logger } from "../../ports/logger.js";
|
|
14
|
+
import type { StorePort } from "../../ports/store/index.js";
|
|
15
|
+
import type { Conversation, ConversationRef, InboundMessage, Surface, UserRef } from "../../ports/surface.js";
|
|
16
|
+
import type { PublicErrors } from "../../public-error/public-errors.js";
|
|
17
|
+
import type { ReviewTurn } from "../review-turn.js";
|
|
18
|
+
import type { ReviewTurnOptions } from "../../turn/runner.js";
|
|
19
|
+
import type { Redact } from "../summary.js";
|
|
20
|
+
/** The per-person limits of the operations that act with someone's authority (W2's `Guardrails`). */
|
|
21
|
+
export type Guard = Pick<Guardrails, "take" | "giveBack">;
|
|
22
|
+
/** The audit trail of what was done with a person's GitHub account (`guardrails.audit`). */
|
|
23
|
+
export type Audit = (event: string, fields: Readonly<Record<string, unknown>>) => void;
|
|
24
|
+
/** The task slots a request's reviews may use (`Agent._admit_reviews`). */
|
|
25
|
+
export interface ReviewTaskSlots {
|
|
26
|
+
readonly granted: number;
|
|
27
|
+
readonly running: number;
|
|
28
|
+
readonly limit: number;
|
|
29
|
+
/** The Claw items the slots hold (counted once on the asker's board). */
|
|
30
|
+
readonly itemIds: Set<string>;
|
|
31
|
+
/** A review is now followed as a turn (or did not start): its slot is let go. */
|
|
32
|
+
followed(itemId: string): void;
|
|
33
|
+
release(): void;
|
|
34
|
+
}
|
|
35
|
+
/** A review turn the router started: `ended` settles when the turn has ended, whichever way. */
|
|
36
|
+
export interface StartedReviewTurn {
|
|
37
|
+
readonly ended: Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
export interface StartReviewTurn {
|
|
40
|
+
readonly message: InboundMessage;
|
|
41
|
+
readonly sender: UserRef;
|
|
42
|
+
/** The asker's exchanged identity token. */
|
|
43
|
+
readonly token: string;
|
|
44
|
+
readonly prompt: string;
|
|
45
|
+
readonly conversation: Conversation;
|
|
46
|
+
readonly scope: string;
|
|
47
|
+
readonly review: ReviewTurn;
|
|
48
|
+
/** The asker's own linked key, the model key of a review of their own ('' none). */
|
|
49
|
+
readonly modelKey: string;
|
|
50
|
+
/** What the turn engine is given for a review (`TurnRun.review.turn`). */
|
|
51
|
+
readonly turn: ReviewTurnOptions;
|
|
52
|
+
}
|
|
53
|
+
/** What the chat the service runs in does for it. */
|
|
54
|
+
export interface ReviewHost {
|
|
55
|
+
/** Starts the review's turn; undefined when it did not start (the asker was told why). */
|
|
56
|
+
startTurn(request: StartReviewTurn): Promise<StartedReviewTurn | undefined>;
|
|
57
|
+
/** The usual onboarding of a group member who is not connected (`identity`: they connect at the identity service). */
|
|
58
|
+
onboard(message: InboundMessage, sender: UserRef, conversation: Conversation, scope: string): Promise<void>;
|
|
59
|
+
/** The steps that link a person's own Primus key (`/link`), after `lead`. */
|
|
60
|
+
askLink(person: UserRef, conversation: Conversation, lead: string): Promise<void>;
|
|
61
|
+
/** The card that binds a person at the identity service, after `lead`. */
|
|
62
|
+
connectIdentity(person: UserRef, conversation: Conversation, lead: string): Promise<void>;
|
|
63
|
+
/** The task slots `count` reviews may use; undefined: no task limit here. */
|
|
64
|
+
admitReviews?(message: InboundMessage, sender: UserRef, count: number, modelKey: string): Promise<ReviewTaskSlots>;
|
|
65
|
+
/** '' when what waits for this person reaches their chat (their subscription made or mended first), else why not. */
|
|
66
|
+
reviewerReach?(userId: string): Promise<string>;
|
|
67
|
+
}
|
|
68
|
+
/** The channel's fields a followed review keeps to reach the reviewer again after a restart (Teams: service url, tenant, bot). */
|
|
69
|
+
export type FollowWire = (asked: ConversationRef) => Readonly<Record<string, string>>;
|
|
70
|
+
/** A conversation reference again, from what the store kept of it (the channel's own reference); undefined when unreadable. */
|
|
71
|
+
export type RestoreRef = (stored: JsonObject) => ConversationRef | undefined;
|
|
72
|
+
export interface ReviewDeps {
|
|
73
|
+
readonly store: StorePort;
|
|
74
|
+
readonly claw: ClawPort;
|
|
75
|
+
readonly credentials: GithubCredentials;
|
|
76
|
+
readonly device: DeviceFlow;
|
|
77
|
+
readonly pulls: PullReader;
|
|
78
|
+
/** undefined: requests are read by the rules alone. */
|
|
79
|
+
readonly intent: IntentReader | undefined;
|
|
80
|
+
readonly surface: Surface;
|
|
81
|
+
readonly exchange: TokenExchange;
|
|
82
|
+
readonly clock: Clock;
|
|
83
|
+
readonly logger: Logger;
|
|
84
|
+
readonly errors: PublicErrors;
|
|
85
|
+
/** Credential shapes masked: what a group, and a reviewer's own chat, are sent. */
|
|
86
|
+
readonly mask: Redact;
|
|
87
|
+
readonly guard: Guard;
|
|
88
|
+
readonly audit: Audit;
|
|
89
|
+
readonly host: ReviewHost;
|
|
90
|
+
readonly followWire: FollowWire;
|
|
91
|
+
readonly restoreRef: RestoreRef;
|
|
92
|
+
/** The owners whose public repositories may be reviewed (REVIEW owners). */
|
|
93
|
+
readonly owners: readonly string[];
|
|
94
|
+
/** The "Add the app" link on a card for a person who may not have the app ('' none). */
|
|
95
|
+
readonly installUrl: string;
|
|
96
|
+
/** What a review runs on when its request names no model ('' Claw's default). */
|
|
97
|
+
readonly defaultModel: string;
|
|
98
|
+
}
|
|
99
|
+
/** The language of a text a person wrote, as the review service answers in it. */
|
|
100
|
+
export type ReviewLang = Lang;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type Conversation } from "../../ports/surface.js";
|
|
2
|
+
import { type ReviewTurn } from "../review-turn.js";
|
|
3
|
+
import type { ReviewDeps } from "./deps.js";
|
|
4
|
+
import type { ItemCards } from "./item-cards.js";
|
|
5
|
+
import type { Notices } from "./notices.js";
|
|
6
|
+
/** How often the asker's view of a review someone else runs is read. */
|
|
7
|
+
export declare const REQUESTER_VIEW_MS = 30000;
|
|
8
|
+
export declare const REQUESTER_VIEW_LIMIT_SECONDS: number;
|
|
9
|
+
/** News is held this long for more to join it, at most this long in all. */
|
|
10
|
+
export declare const VIEW_SETTLE_MS = 90000;
|
|
11
|
+
export declare const VIEW_HOLD_MS = 600000;
|
|
12
|
+
/** How often a last line is tried before it is left (to the next worker that starts). */
|
|
13
|
+
export declare const DEADLINE_TRIES = 10;
|
|
14
|
+
export declare class AskerFollow {
|
|
15
|
+
private readonly deps;
|
|
16
|
+
private readonly cards;
|
|
17
|
+
private readonly notices;
|
|
18
|
+
/** item id -> the follow of its request. */
|
|
19
|
+
private readonly viewing;
|
|
20
|
+
/** Items the asker stopped from their card: their end is said there, not again. */
|
|
21
|
+
private readonly stopped;
|
|
22
|
+
/** For tests: the interval between reads. */
|
|
23
|
+
viewMs: number;
|
|
24
|
+
constructor(deps: ReviewDeps, cards: ItemCards, notices: Notices);
|
|
25
|
+
following(itemId: string): boolean;
|
|
26
|
+
/** Settles when every follow started so far has ended. */
|
|
27
|
+
idle(): Promise<void>;
|
|
28
|
+
/** Whether the asker stopped this item from its card (forgotten once asked). */
|
|
29
|
+
takeStopped(itemId: string): boolean;
|
|
30
|
+
/** The asker stopped the item from their card, where that is said: its end is not said a second time. */
|
|
31
|
+
itemStopped(itemId: string): void;
|
|
32
|
+
/** Follows the reviews one request asked of someone else, together, for their asker. */
|
|
33
|
+
follow(reviews: readonly ReviewTurn[], conversation: Conversation): void;
|
|
34
|
+
private start;
|
|
35
|
+
/** Every review that was followed when the last worker stopped is followed again, from what its asker was told last. */
|
|
36
|
+
resume(): number;
|
|
37
|
+
/** Reads each open item's view every `viewMs`; news is held a little, then said in one message. */
|
|
38
|
+
private watch;
|
|
39
|
+
private tryFlush;
|
|
40
|
+
/** The deadline: what is held is said, then that the rest is still open; the rows go once the asker has been told. */
|
|
41
|
+
private atDeadline;
|
|
42
|
+
/** The asker's view of one item now; undefined when it is not followed any more, "running" for a moment's trouble. */
|
|
43
|
+
private viewOf;
|
|
44
|
+
private round;
|
|
45
|
+
/** An item the asker stopped on its card: that card is left as the press made it, and said there. */
|
|
46
|
+
private endStopped;
|
|
47
|
+
/** What one view is: news to hold, back to what was said, a start, or an end. */
|
|
48
|
+
private note;
|
|
49
|
+
/** Says the held news in one message; what is said is recorded first, and put back when the message did not go. */
|
|
50
|
+
private flush;
|
|
51
|
+
/** A line for the asker where they asked: in a group it @mentions them (and only them). */
|
|
52
|
+
sayToAsker(review: ReviewTurn, conversation: Conversation, text: string): Promise<void>;
|
|
53
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { Lang } from "../../locales/lang.js";
|
|
2
|
+
import type { JsonObject } from "../../json.js";
|
|
3
|
+
import type { GithubState } from "../../ports/github.js";
|
|
4
|
+
import type { Random } from "../../ports/random.js";
|
|
5
|
+
import type { MessageRoute, RouteHandlers } from "../../ports/routing.js";
|
|
6
|
+
import type { Conversation, InboundMessage, UserRef } from "../../ports/surface.js";
|
|
7
|
+
import type { ReviewTurnOptions, ReviewTurnOutcome } from "../../turn/runner.js";
|
|
8
|
+
import { UNKNOWN } from "../connect/connections.js";
|
|
9
|
+
import { GithubConnect, type ConnectRequest } from "../connect/github-connect.js";
|
|
10
|
+
import type { ReviewHandoff } from "../handoff.js";
|
|
11
|
+
import { type ReviewTurn } from "../review-turn.js";
|
|
12
|
+
import { GithubAccount } from "./account.js";
|
|
13
|
+
import type { ReviewDeps } from "./deps.js";
|
|
14
|
+
import { type PostWorkCard } from "./notices.js";
|
|
15
|
+
export declare class GithubReview {
|
|
16
|
+
private readonly deps;
|
|
17
|
+
readonly account: GithubAccount;
|
|
18
|
+
readonly connect: GithubConnect;
|
|
19
|
+
private readonly reviewers;
|
|
20
|
+
private readonly requests;
|
|
21
|
+
private readonly notices;
|
|
22
|
+
private readonly cards;
|
|
23
|
+
private readonly follows;
|
|
24
|
+
private readonly items;
|
|
25
|
+
private readonly turns;
|
|
26
|
+
private readonly held;
|
|
27
|
+
private readonly checks;
|
|
28
|
+
private readonly launch;
|
|
29
|
+
constructor(deps: ReviewDeps, random: Random, postWorkCard: PostWorkCard);
|
|
30
|
+
/** Settles when the background work started so far (device flows, follows, hints) has ended. For tests. */
|
|
31
|
+
idle(): Promise<void>;
|
|
32
|
+
/** Which channel id is whose, from a message of theirs: a mention in a group can then be read without the member list. */
|
|
33
|
+
remember(message: InboundMessage): void;
|
|
34
|
+
private context;
|
|
35
|
+
/**
|
|
36
|
+
* A message that may be "请 XX 帮我 review 合入 <PR> [<PR> ...]". True when it was one (answered here, or started), false
|
|
37
|
+
* for any other message. Whoever is named is the only account that is ever used: no one stands in for them.
|
|
38
|
+
*/
|
|
39
|
+
request(route: MessageRoute): Promise<boolean>;
|
|
40
|
+
/**
|
|
41
|
+
* A review the person's assistant handed back: started exactly as the same request typed here is, as the reviewer, with
|
|
42
|
+
* the reviewer's own exchanged token and linked key, and answered in `conversation`.
|
|
43
|
+
*/
|
|
44
|
+
handoff(message: InboundMessage, sender: UserRef, conversation: Conversation, handoff: ReviewHandoff): Promise<void>;
|
|
45
|
+
/** A 1:1 message that asks, in the person's own words, to change or see the confirmation setting. True when it was one. */
|
|
46
|
+
modeMessage(sender: UserRef, text: string, conversation: Conversation): Promise<boolean>;
|
|
47
|
+
/** What the turn engine is given for a review. */
|
|
48
|
+
turnOptions(review: ReviewTurn, modelKey: string): ReviewTurnOptions;
|
|
49
|
+
/** A review's turn has ended (the router calls this with what the engine collected). */
|
|
50
|
+
afterTurn(review: ReviewTurn, finalAnswer: string, outcome: ReviewTurnOutcome, asked: Conversation): Promise<void>;
|
|
51
|
+
/** The asker stopped an item from its card, where that is said. */
|
|
52
|
+
itemStopped(itemId: string): void;
|
|
53
|
+
/** Called once the worker runs: the follows of the last worker are taken up again. */
|
|
54
|
+
resume(): number;
|
|
55
|
+
/** Open review cards are checked for an item that is over, now and then every CARD_SWEEP_MS, until `signal` aborts. */
|
|
56
|
+
sweepCards(signal: AbortSignal): Promise<void>;
|
|
57
|
+
/** The open confirmations of the person (the assistant's context). */
|
|
58
|
+
pendingConfirmations(userId: string): readonly JsonObject[];
|
|
59
|
+
/** Beside a question about the person's own GitHub: the connect card, before the question goes on (`GithubConnect.offer`). */
|
|
60
|
+
offerConnect(request: ConnectRequest): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* The person's GitHub binding at the identity service, as /whoami shows it (Python `Agent._github_connections`): their
|
|
63
|
+
* state, null when they have none, UNKNOWN when the identity service could not say just now (never "not connected").
|
|
64
|
+
*/
|
|
65
|
+
connectionState(userId: string): Promise<GithubState | null | typeof UNKNOWN>;
|
|
66
|
+
/** Help's values of the person's GitHub ("github", "delegation", "confirm_mode"); those it cannot read are left out. */
|
|
67
|
+
helpValues(userId: string, lang: Lang): Promise<Readonly<Record<string, string>>>;
|
|
68
|
+
private within;
|
|
69
|
+
/** What the review delegation brings the router. */
|
|
70
|
+
routeHandlers(): RouteHandlers;
|
|
71
|
+
private click;
|
|
72
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A review the person's assistant handed back (`review_for_other`, an `assistant.action` with a typed `review`): the assistant
|
|
3
|
+
* understood the message, and the review runs on the reviewer's own credentials, which only this worker holds (teams_agent/agent.py
|
|
4
|
+
* `_review_handoff`, `_run_handoff`). It is started exactly as the same request typed here would be, only for a message this worker
|
|
5
|
+
* sent for this person that declared the handoff, only of someone that message named, and once per event id. It runs in the
|
|
6
|
+
* background (a review's checks outlast a delivery) and answers in one message: the assistant says nothing about it, so the answer
|
|
7
|
+
* closes the receipt under the person's message when that is still open.
|
|
8
|
+
*/
|
|
9
|
+
import { type Receipts } from "../../assistant/receipts.js";
|
|
10
|
+
import type { ReviewDeps } from "./deps.js";
|
|
11
|
+
import type { GithubReview } from "./github-review.js";
|
|
12
|
+
export interface HandoffActionDeps {
|
|
13
|
+
readonly review: Pick<GithubReview, "handoff">;
|
|
14
|
+
readonly receipts: Receipts;
|
|
15
|
+
/** The assistant understands the person's messages. */
|
|
16
|
+
readonly understands: (userId: string) => boolean;
|
|
17
|
+
/** The person's assistant can answer them. */
|
|
18
|
+
readonly reachable: (userId: string) => boolean;
|
|
19
|
+
}
|
|
20
|
+
type Event = Readonly<Record<string, unknown>>;
|
|
21
|
+
export declare class ReviewHandoffAction {
|
|
22
|
+
private readonly deps;
|
|
23
|
+
private readonly action;
|
|
24
|
+
private readonly running;
|
|
25
|
+
constructor(deps: ReviewDeps, action: HandoffActionDeps);
|
|
26
|
+
/** Settles when every handoff taken so far has run. For tests. */
|
|
27
|
+
idle(): Promise<void>;
|
|
28
|
+
/** The handoff `event` for `userId`, taken and started in the background ('delivered'), or 'dropped'. */
|
|
29
|
+
take(userId: string, event: Event): "delivered" | "dropped";
|
|
30
|
+
private run;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { GithubConnection } from "../../claw/model.js";
|
|
2
|
+
import { type ReviewMode } from "../review-turn.js";
|
|
3
|
+
import type { ReviewDeps } from "./deps.js";
|
|
4
|
+
/** Claw answers 404 for the setting: its API is not deployed yet, and every review is confirmed as by default. */
|
|
5
|
+
export declare const NOT_YET = "not_yet";
|
|
6
|
+
export type ModeRead = ReviewMode | typeof NOT_YET | "";
|
|
7
|
+
/** The exchanged token that acts as `userId`, or why there is none. */
|
|
8
|
+
export declare function tokenFor(deps: ReviewDeps, userId: string): Promise<{
|
|
9
|
+
readonly token: string;
|
|
10
|
+
} | {
|
|
11
|
+
readonly failed: "not_bound" | "unavailable";
|
|
12
|
+
readonly reason: string;
|
|
13
|
+
}>;
|
|
14
|
+
/** A failed call of Claw's (an answer, no answer, an answer not understood); anything else is a bug and is thrown on. */
|
|
15
|
+
export declare function clawFailure(err: unknown): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The person's confirmation setting as Claw holds it, read as them; '' when it cannot be read, NOT_YET for a Claw without
|
|
18
|
+
* it. A value this worker does not know is the default, as Claw itself reads it.
|
|
19
|
+
*/
|
|
20
|
+
export declare function modeOf(deps: ReviewDeps, userId: string): Promise<ModeRead>;
|
|
21
|
+
/** Writes the person's confirmation setting as them: true, NOT_YET for a Claw without it, false when it was not written. */
|
|
22
|
+
export declare function writeMode(deps: ReviewDeps, userId: string, mode: ReviewMode): Promise<true | false | typeof NOT_YET>;
|
|
23
|
+
/**
|
|
24
|
+
* What Claw says about the person's GitHub tools, asked as them, and whether it could say: [null, true] for a Claw without
|
|
25
|
+
* the answer, [null, false] when it could not be asked.
|
|
26
|
+
*/
|
|
27
|
+
export declare function connectionOf(deps: ReviewDeps, userId: string): Promise<readonly [GithubConnection | null, boolean]>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { PlacedCard } from "../../ports/store/assistant.js";
|
|
2
|
+
import type { Conversation } from "../../ports/surface.js";
|
|
3
|
+
import { type ReviewTurn } from "../review-turn.js";
|
|
4
|
+
import type { ReviewDeps } from "./deps.js";
|
|
5
|
+
/** The plain end a card gets when Teams refused the full one. */
|
|
6
|
+
export declare const ITEM_CARD_ENDED_PLAIN_ZH = "\u5DF2\u7ED3\u675F\uFF0C\u89C1\u4E0A\u65B9\u7ED3\u679C";
|
|
7
|
+
/** Open review cards are checked this often for an item that is over. */
|
|
8
|
+
export declare const CARD_SWEEP_MS = 120000;
|
|
9
|
+
/** ... posted within this long (all the store keeps: a review held for its reviewer may end late). */
|
|
10
|
+
export declare const CARD_SWEEP_MAX_AGE_SECONDS: number;
|
|
11
|
+
export declare class ItemCards {
|
|
12
|
+
private readonly deps;
|
|
13
|
+
/** Item ids whose end is said by a follow here (their cards are not swept). */
|
|
14
|
+
private readonly followed;
|
|
15
|
+
/** item id -> where its card with Stop was sent. */
|
|
16
|
+
private readonly cardAt;
|
|
17
|
+
/** item id -> how it ended (and the review's summary), for an item that ended before its card went out. */
|
|
18
|
+
private readonly endedBeforeCard;
|
|
19
|
+
constructor(deps: ReviewDeps,
|
|
20
|
+
/** Item ids whose end is said by a follow here (their cards are not swept). */
|
|
21
|
+
followed: (itemId: string) => boolean);
|
|
22
|
+
has(itemId: string): boolean;
|
|
23
|
+
forget(itemId: string): void;
|
|
24
|
+
/** A card for each review item in `target` (the asker's own chat). Best effort: an item without a card stays on the board. */
|
|
25
|
+
post(target: Conversation, ownerId: string, reviews: readonly ReviewTurn[], shownModel: (r: ReviewTurn) => string): Promise<void>;
|
|
26
|
+
/** A review that waited for a slot has started: each open card that still says it is queued becomes the running card. */
|
|
27
|
+
started(itemId: string): Promise<void>;
|
|
28
|
+
/** The review item ended: every card of it still open shows how, in place of its buttons. */
|
|
29
|
+
end(itemId: string, ended: string, prSummary?: string): Promise<void>;
|
|
30
|
+
/** Edits one open card into its end; a plain end when the channel refuses the full one. False when this call did not end it. */
|
|
31
|
+
close(card: PlacedCard, ended: string, prSummary?: string): Promise<boolean>;
|
|
32
|
+
/** How the item of one open card ended, read as the card's owner; undefined while it runs or when it cannot be read now. */
|
|
33
|
+
private endOf;
|
|
34
|
+
/**
|
|
35
|
+
* Every open card of a review item posted within `maxAge`, whose item is over, is edited into its end: what a follow did
|
|
36
|
+
* not end is ended here. Returns how many cards it ended.
|
|
37
|
+
*/
|
|
38
|
+
closeEnded(maxAge?: number): Promise<number>;
|
|
39
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { PullRef } from "../../claw/model.js";
|
|
2
|
+
import type { ReviewTurn } from "../review-turn.js";
|
|
3
|
+
import type { ReviewDeps } from "./deps.js";
|
|
4
|
+
import type { Actor } from "./reviewer.js";
|
|
5
|
+
/** How long Claw's answer to whether it chooses a review's model is reused. */
|
|
6
|
+
export declare const CLAW_MODELS_MS = 300000;
|
|
7
|
+
/** What asking for the items came to. */
|
|
8
|
+
export type ItemsAsked = {
|
|
9
|
+
readonly kind: "started";
|
|
10
|
+
readonly reviews: ReviewTurn[];
|
|
11
|
+
}
|
|
12
|
+
/** A Claw without review items: the sessions are made here. */
|
|
13
|
+
| {
|
|
14
|
+
readonly kind: "no_items";
|
|
15
|
+
}
|
|
16
|
+
/** Claw started none, or could not be asked: what the asker is told. */
|
|
17
|
+
| {
|
|
18
|
+
readonly kind: "refused";
|
|
19
|
+
readonly text: string;
|
|
20
|
+
};
|
|
21
|
+
export interface ItemsRequest {
|
|
22
|
+
readonly token: string;
|
|
23
|
+
readonly modelKey: string;
|
|
24
|
+
readonly actor: Actor;
|
|
25
|
+
readonly actingAs: string;
|
|
26
|
+
readonly merge: boolean;
|
|
27
|
+
readonly model: string;
|
|
28
|
+
/** Asked of someone else: their exchanged token and own key ('' a review of one's own). */
|
|
29
|
+
readonly actingToken: string;
|
|
30
|
+
readonly actingKey: string;
|
|
31
|
+
/** The asker's own words, quoted to the reviewer as untrusted. */
|
|
32
|
+
readonly note: string;
|
|
33
|
+
readonly handoffId: string;
|
|
34
|
+
}
|
|
35
|
+
export declare class ReviewItems {
|
|
36
|
+
private readonly deps;
|
|
37
|
+
private clawModels;
|
|
38
|
+
/** The pull requests a review was asked for and has not ended (a Claw without review items: this worker's memory). */
|
|
39
|
+
private readonly reviewing;
|
|
40
|
+
constructor(deps: ReviewDeps);
|
|
41
|
+
/** Whether Claw chooses a review's model itself, asked at most every CLAW_MODELS_MS; the last answer stands when it cannot say. */
|
|
42
|
+
clawChoosesModels(token: string): Promise<boolean>;
|
|
43
|
+
/** Asks Claw for one item per review; see `ItemsAsked`. Refused pull requests go in `refused`. */
|
|
44
|
+
start(request: ItemsRequest, reviews: readonly ReviewTurn[], refused: [PullRef, string][]): Promise<ItemsAsked>;
|
|
45
|
+
private ask;
|
|
46
|
+
/** What a refusal leaves: the reviews to ask for again, no items here, or the one line for the asker. */
|
|
47
|
+
private afterRefusal;
|
|
48
|
+
private checkReason;
|
|
49
|
+
private taken;
|
|
50
|
+
/**
|
|
51
|
+
* A Claw without review items: the pull requests this worker is reviewing already are refused, and the others are taken
|
|
52
|
+
* (in `held`) until their review ends. This worker's memory is all there is then.
|
|
53
|
+
*/
|
|
54
|
+
hold(reviews: readonly ReviewTurn[], refused: [PullRef, string][], held: PullRef[]): ReviewTurn[];
|
|
55
|
+
/** A review taken in this worker's memory has ended (or never started): its pull request is free again. */
|
|
56
|
+
release(pull: PullRef): void;
|
|
57
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { PullRef } from "../../claw/model.js";
|
|
2
|
+
import { type ReviewTurn } from "../review-turn.js";
|
|
3
|
+
import type { ReviewDeps } from "./deps.js";
|
|
4
|
+
import type { AskerFollow } from "./follow.js";
|
|
5
|
+
import type { ItemCards } from "./item-cards.js";
|
|
6
|
+
import type { ReviewItems } from "./items.js";
|
|
7
|
+
import type { Notices } from "./notices.js";
|
|
8
|
+
import type { Settled } from "./start.js";
|
|
9
|
+
import type { ReviewTurns } from "./turns.js";
|
|
10
|
+
export declare class ReviewLaunch {
|
|
11
|
+
private readonly deps;
|
|
12
|
+
private readonly items;
|
|
13
|
+
private readonly notices;
|
|
14
|
+
private readonly cards;
|
|
15
|
+
private readonly follows;
|
|
16
|
+
private readonly turns;
|
|
17
|
+
constructor(deps: ReviewDeps, items: ReviewItems, notices: Notices, cards: ItemCards, follows: AskerFollow, turns: ReviewTurns);
|
|
18
|
+
/** The model a review's card and receipt name: the one Claw says it runs on, else the one asked for (or the default). */
|
|
19
|
+
shownModel(review: ReviewTurn): string;
|
|
20
|
+
launch(s: Settled, held: PullRef[], handed: PullRef[]): Promise<void>;
|
|
21
|
+
/** Claw's items for the reviews (or the reviews this worker takes itself); undefined when the asker was told why not. */
|
|
22
|
+
private startItems;
|
|
23
|
+
private nothingStarted;
|
|
24
|
+
/** The acknowledgement: one message for several reviews, else at the top of the review's progress message. */
|
|
25
|
+
private acknowledge;
|
|
26
|
+
private severalText;
|
|
27
|
+
/** A turn for each review of one's own; the asker follows the reviews asked of someone else together. */
|
|
28
|
+
private run;
|
|
29
|
+
private startTurn;
|
|
30
|
+
/**
|
|
31
|
+
* A review asked of someone else whose session was made here, refused by a newer Claw (`acting_as_must_be_self`): asked for
|
|
32
|
+
* once more as the reviewer's item, exactly as the start asks. True: the asker was told; false: the turn says its failure.
|
|
33
|
+
*/
|
|
34
|
+
asItem(review: ReviewTurn, s: Settled): Promise<boolean>;
|
|
35
|
+
/** The cards with Stop, in the asker's own chat (a group's request too). */
|
|
36
|
+
postCards(s: Settled, reviews: readonly ReviewTurn[]): Promise<void>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { WorkItem, PullRef } from "../../claw/model.js";
|
|
2
|
+
import type { Conversation, ConversationRef, UserRef } from "../../ports/surface.js";
|
|
3
|
+
import { type ReviewTurn } from "../review-turn.js";
|
|
4
|
+
import type { ReviewDeps } from "./deps.js";
|
|
5
|
+
import type { Actor } from "./reviewer.js";
|
|
6
|
+
/** A person who was named but has not bound GitHub (or the asker who has not linked) is told how at most once a day. */
|
|
7
|
+
export declare const BIND_NOTICE_SECONDS: number;
|
|
8
|
+
/** Puts a card of a work item in a chat and keeps where it went (the assistant's work card; owned by the assistant line). */
|
|
9
|
+
export type PostWorkCard = (conversation: Conversation, owner: string, item: WorkItem, text: string) => Promise<void>;
|
|
10
|
+
export declare class Notices {
|
|
11
|
+
private readonly deps;
|
|
12
|
+
private readonly postWorkCard;
|
|
13
|
+
constructor(deps: ReviewDeps, postWorkCard: PostWorkCard);
|
|
14
|
+
/** The asker's exchanged token, to read what a review's session holds as them; undefined when there is none now. */
|
|
15
|
+
requesterToken(review: ReviewTurn): Promise<string | undefined>;
|
|
16
|
+
/**
|
|
17
|
+
* Claw did not take the asker's credentials for this review (401): what they can do goes to them alone. A key that belongs
|
|
18
|
+
* to another Primus account than the one connected at the identity service (`key_subject_mismatch`) is linked again from
|
|
19
|
+
* the right account; any other is linked again.
|
|
20
|
+
*/
|
|
21
|
+
tellRequesterRefused(review: ReviewTurn, code: string): Promise<void>;
|
|
22
|
+
/** A person's own 1:1 chat. */
|
|
23
|
+
personalChatOf(person: Actor, via: ConversationRef): Promise<Conversation | undefined>;
|
|
24
|
+
/** The reviewer's own 1:1 chat. */
|
|
25
|
+
reviewerChat(review: ReviewTurn): Promise<Conversation | undefined>;
|
|
26
|
+
tellReviewer(review: ReviewTurn, text: string): Promise<void>;
|
|
27
|
+
/** The reviewer hears, in their own chat, that someone asked a review of them and that it is an item on their board. */
|
|
28
|
+
tellReviewerStarted(review: ReviewTurn): Promise<void>;
|
|
29
|
+
/** The reviewer's item as Claw shows it to them, read with their own key; undefined when it cannot be. */
|
|
30
|
+
private reviewersItem;
|
|
31
|
+
/** The reviewer's item waits for them: what it asks and how to answer, with the item's card when it can be read as them. */
|
|
32
|
+
tellReviewerWaiting(review: ReviewTurn, prSummary: string): Promise<void>;
|
|
33
|
+
private waitingText;
|
|
34
|
+
/** For a review handed to someone else: '' when what waits for them reaches their chat, else one line for the asker. */
|
|
35
|
+
reachNote(review: ReviewTurn | undefined): Promise<string>;
|
|
36
|
+
/** Sends what `send` says into the person's own chat, at most once a day for this kind; true when they have it. */
|
|
37
|
+
onceADay(person: Actor, via: ConversationRef, kind: string, send: (chat: Conversation) => Promise<void>): Promise<boolean>;
|
|
38
|
+
/** The asker has no Primus key of their own linked, and a review runs on it: one line where asked, and the steps in their chat. */
|
|
39
|
+
requesterMustLink(via: ConversationRef, group: boolean, requester: Actor, conversation: Conversation, pulls: readonly PullRef[]): Promise<void>;
|
|
40
|
+
/** The person named cannot be acted as yet: one line where asked and, once a day, the steps in their own chat. */
|
|
41
|
+
noGithub(via: ConversationRef, group: boolean, sender: UserRef, actor: Actor, pulls: readonly PullRef[], conversation: Conversation, known: boolean): Promise<void>;
|
|
42
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { InboundMessage, UserRef } from "../../ports/surface.js";
|
|
2
|
+
import { type PullKey } from "../../review-text/pull-ref.js";
|
|
3
|
+
import { type ReviewAsk } from "../request-parse.js";
|
|
4
|
+
import type { ReviewDeps } from "./deps.js";
|
|
5
|
+
/** A message as the request is read from it. */
|
|
6
|
+
export interface Asking {
|
|
7
|
+
readonly message: InboundMessage;
|
|
8
|
+
readonly sender: UserRef;
|
|
9
|
+
readonly group: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** The message with each bare number written as owner/repo#N, the repository read, and what was and was not taken. */
|
|
12
|
+
export interface Expanded {
|
|
13
|
+
readonly message: InboundMessage;
|
|
14
|
+
readonly repo: string;
|
|
15
|
+
readonly taken: readonly PullKey[];
|
|
16
|
+
readonly stray: readonly number[];
|
|
17
|
+
}
|
|
18
|
+
/** What reading a request came to: not one (chat), a question asked back, or the request. */
|
|
19
|
+
export type Reading = {
|
|
20
|
+
readonly kind: "chat";
|
|
21
|
+
} | {
|
|
22
|
+
readonly kind: "question";
|
|
23
|
+
readonly text: string;
|
|
24
|
+
} | {
|
|
25
|
+
readonly kind: "ask";
|
|
26
|
+
readonly ask: ReviewAsk;
|
|
27
|
+
};
|
|
28
|
+
export declare class RequestReader {
|
|
29
|
+
private readonly deps;
|
|
30
|
+
/** A repository name GitHub answered for (lower case) -> its "owner/name". */
|
|
31
|
+
private readonly reposSeen;
|
|
32
|
+
constructor(deps: ReviewDeps);
|
|
33
|
+
private marked;
|
|
34
|
+
/**
|
|
35
|
+
* A request that names pull requests by number alone: the message with each number as owner/repo#N, and the repository
|
|
36
|
+
* it was read as: the one written just before the numbers; the one other repository the message names; the asker's most
|
|
37
|
+
* recent /repo of an allowed owner. Otherwise one question back: the repository is never guessed.
|
|
38
|
+
*/
|
|
39
|
+
barePulls(asking: Asking): Promise<Expanded | string>;
|
|
40
|
+
private recentRepo;
|
|
41
|
+
private chooseRepos;
|
|
42
|
+
/**
|
|
43
|
+
* The one "owner/name" among the allowed owners that GitHub has a public repository `name` for; '' when none or more
|
|
44
|
+
* than one has; undefined when GitHub could not be asked. With one allowed owner, a GitHub that cannot be asked leaves only
|
|
45
|
+
* one repository a name that looks like one can be: that owner's (Claw's own read of the pull request refuses a wrong one).
|
|
46
|
+
*/
|
|
47
|
+
private repoNamed;
|
|
48
|
+
/**
|
|
49
|
+
* What the message asks: the model's reading held to the message, when the message names a pull request and the asker
|
|
50
|
+
* has a key to read it with; else, or when the model gives no reading in time, the rules'.
|
|
51
|
+
*/
|
|
52
|
+
read(asking: Asking): Promise<Reading>;
|
|
53
|
+
/**
|
|
54
|
+
* Every "请 X ..." line must name the reviewer too; and whether it merges is what the words say, never only the model's
|
|
55
|
+
* reading. A reading that names nobody, or someone else, where the rules read a name is a question, never a guess.
|
|
56
|
+
*/
|
|
57
|
+
private heldToRules;
|
|
58
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ConversationRef, RosterMember } from "../../ports/surface.js";
|
|
2
|
+
import type { ReviewAsk } from "../request-parse.js";
|
|
3
|
+
import type { ReviewDeps } from "./deps.js";
|
|
4
|
+
/** A group's member list is read again after this long (names are matched against it). */
|
|
5
|
+
export declare const ROSTER_CACHE_MS = 300000;
|
|
6
|
+
/** The member list is given up on after this long. */
|
|
7
|
+
export declare const ROSTER_MS = 10000;
|
|
8
|
+
/** The person a request names. */
|
|
9
|
+
export interface Actor {
|
|
10
|
+
readonly userId: string;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly channelUserId: string;
|
|
13
|
+
}
|
|
14
|
+
/** Who was named could not be settled; `text` is what the asker is told. */
|
|
15
|
+
export interface ActorUnknown {
|
|
16
|
+
readonly unknown: string;
|
|
17
|
+
}
|
|
18
|
+
/** Where the request was asked, as the roster reads it. */
|
|
19
|
+
export interface Asked {
|
|
20
|
+
readonly conversation: ConversationRef;
|
|
21
|
+
readonly group: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare class ReviewerReader {
|
|
24
|
+
private readonly deps;
|
|
25
|
+
/** group conversation id -> (when read, its members). */
|
|
26
|
+
private readonly rosters;
|
|
27
|
+
constructor(deps: ReviewDeps);
|
|
28
|
+
/**
|
|
29
|
+
* The members of the group chat, or undefined when the channel cannot read them. In a 1:1 chat, which has no group,
|
|
30
|
+
* everyone the worker has seen write to it.
|
|
31
|
+
*/
|
|
32
|
+
roster(asked: Asked): Promise<readonly RosterMember[] | undefined>;
|
|
33
|
+
/** Who the request names, or the question to ask back. */
|
|
34
|
+
resolve(asked: Asked, ask: ReviewAsk): Promise<Actor | ActorUnknown>;
|
|
35
|
+
private mentioned;
|
|
36
|
+
private typed;
|
|
37
|
+
/**
|
|
38
|
+
* (channel id -> name of everyone the message may name, how many people it names). Everyone it mentions is one, and so
|
|
39
|
+
* is every member whose name it writes as words of its own; members found at the very same words are one name written
|
|
40
|
+
* (one that fits several people: the reviewer's own check asks which), and a member also mentioned is that mention.
|
|
41
|
+
*/
|
|
42
|
+
peopleNamed(asked: Asked, markedText: string, ask: ReviewAsk): Promise<{
|
|
43
|
+
people: Map<string, string>;
|
|
44
|
+
count: number;
|
|
45
|
+
}>;
|
|
46
|
+
/** The names of the people a message names, as the asker is told them. */
|
|
47
|
+
static namesOf(people: ReadonlyMap<string, string>): string;
|
|
48
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A review's turn as the router starts it (`StartTurn.review`): the review service's `ReviewHost.startTurn` on the router's
|
|
3
|
+
* own `startTurn`, so the worker's assembly only injects the router and the chat it builds. As Python's `_guarded` does for a
|
|
4
|
+
* review: the session is the review's (never the chat's stored one), it is noted as an acting session as soon as it exists,
|
|
5
|
+
* and the review service reads the turn once it is over.
|
|
6
|
+
*/
|
|
7
|
+
import type { Chat } from "../../routing/chat.js";
|
|
8
|
+
import type { ReviewTurnStart, RunningTurn, StartTurn } from "../../routing/turn-start.js";
|
|
9
|
+
import type { ReviewTurnOutcome } from "../../turn/runner.js";
|
|
10
|
+
import type { Conversation } from "../../ports/surface.js";
|
|
11
|
+
import type { ReviewTurn } from "../review-turn.js";
|
|
12
|
+
import type { ReviewDeps, ReviewHost, StartReviewTurn } from "./deps.js";
|
|
13
|
+
/** What follows a review's turn (`GithubReview.afterTurn`). */
|
|
14
|
+
export type AfterReviewTurn = (review: ReviewTurn, finalAnswer: string, outcome: ReviewTurnOutcome, asked: Conversation) => Promise<void>;
|
|
15
|
+
/** The router's `startTurn`. */
|
|
16
|
+
export type StartRouterTurn = (request: StartTurn) => Promise<RunningTurn | undefined>;
|
|
17
|
+
/** The review part of the router's `StartTurn` for one review's turn. */
|
|
18
|
+
export declare function reviewTurnStart(request: StartReviewTurn, store: Pick<ReviewDeps["store"], "reviewDelegation">, afterTurn: AfterReviewTurn): ReviewTurnStart;
|
|
19
|
+
/** `ReviewHost.startTurn` on the router's `startTurn`, with the chat `chatOf` builds for the request. */
|
|
20
|
+
export declare function routedReviewTurns(start: StartRouterTurn, chatOf: (request: StartReviewTurn) => Chat, store: Pick<ReviewDeps["store"], "reviewDelegation">, afterTurn: AfterReviewTurn): ReviewHost["startTurn"];
|