@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,51 @@
|
|
|
1
|
+
import type { PendingRequest } from "../ports/store/onboarding.js";
|
|
2
|
+
import type { InboundAction, InboundMessage } from "../ports/surface.js";
|
|
3
|
+
import type { Chat } from "./chat.js";
|
|
4
|
+
import type { RouterContext } from "./context.js";
|
|
5
|
+
import type { TurnStarter } from "./turn-start.js";
|
|
6
|
+
/** Opening a 1:1 chat and sending the steps may hold the card back this long, at most. */
|
|
7
|
+
export declare const ONBOARDING_DM_BUDGET_SECONDS = 15;
|
|
8
|
+
/** What a member asked in a group, kept for when they connect (`quote` and `sent` as the turn takes them). */
|
|
9
|
+
export interface GroupAsk {
|
|
10
|
+
readonly text: string;
|
|
11
|
+
readonly quote: string;
|
|
12
|
+
readonly sent: string;
|
|
13
|
+
/** Kept to run later (not for /new, /stop, /whoami, which mean nothing to replay). */
|
|
14
|
+
readonly keep: boolean;
|
|
15
|
+
/** What they lack is the identity binding (a review for a colleague needs it), not what a chat runs on. */
|
|
16
|
+
readonly identity: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A group member who has not connected an account (the Python `Agent._onboard_group_member`, `_send_onboarding_dm`,
|
|
20
|
+
* `_onboard_click`, `_resume_group_request`, `_targeted_in_group`): a card addressed to them (one per person per chat
|
|
21
|
+
* per day) and, once a day, a 1:1 message with the steps; what they asked runs in the group as soon as they connect
|
|
22
|
+
* (within the store's 15 minutes). Nothing here uses any credential, and the card carries no part of the request.
|
|
23
|
+
*/
|
|
24
|
+
export declare class Onboarding {
|
|
25
|
+
private readonly ctx;
|
|
26
|
+
private readonly starter;
|
|
27
|
+
constructor(ctx: RouterContext, starter: TurnStarter);
|
|
28
|
+
/** The person's 1:1 chat, opened within the budget; undefined when the channel cannot or does not in time. */
|
|
29
|
+
private openPersonal;
|
|
30
|
+
member(message: InboundMessage, chat: Chat, ask: GroupAsk): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* The steps in a 1:1 chat with the member: true when they have them (sent now, or with `claim` earlier today). False
|
|
33
|
+
* when it did not work; the in-group card is then the only help, and the day's message is not used up.
|
|
34
|
+
*/
|
|
35
|
+
sendSteps(chat: Chat, claim: boolean, identity?: boolean): Promise<boolean>;
|
|
36
|
+
/**
|
|
37
|
+
* Connect under an onboarding card. The store says whose card it is (never the card); anyone else gets their own card
|
|
38
|
+
* back with a line saying so. The person it is for gets the steps in a 1:1 chat, or in the card when that cannot be done.
|
|
39
|
+
*/
|
|
40
|
+
click(action: InboundAction, chat: Chat): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* The member connected while their group request waited: it runs there, as them, and the group is told so. `notify`
|
|
43
|
+
* (the chat where they connected) hears if this could not be done; a failure never undoes the connection.
|
|
44
|
+
*/
|
|
45
|
+
resume(notify: Chat, pending: PendingRequest, announce: boolean): Promise<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* A private message in a group (picked under "/"): an answer in the group would show everyone what only the bot was
|
|
48
|
+
* meant to see, so the sender gets one line in their 1:1 chat saying where to ask instead.
|
|
49
|
+
*/
|
|
50
|
+
targeted(chat: Chat): Promise<void>;
|
|
51
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { JsonObject } from "../json.js";
|
|
2
|
+
import type { InboundAction, InboundMessage } from "../ports/surface.js";
|
|
3
|
+
import { type Chat } from "./chat.js";
|
|
4
|
+
import type { CommandSets } from "./command-table.js";
|
|
5
|
+
import type { RouterContext } from "./context.js";
|
|
6
|
+
import type { PersonalText } from "./personal-text.js";
|
|
7
|
+
/**
|
|
8
|
+
* A 1:1 chat (the Python `Agent._dispatch` from the personal-chat check on): what needs no account first (`/link`, the
|
|
9
|
+
* language, a review request, feedback, a click that answers as the person's identity), then the person's credential, then
|
|
10
|
+
* their commands, their buttons, and the message on its way.
|
|
11
|
+
*/
|
|
12
|
+
export declare class PersonalRouter {
|
|
13
|
+
private readonly ctx;
|
|
14
|
+
private readonly sets;
|
|
15
|
+
private readonly text;
|
|
16
|
+
private readonly stopPress;
|
|
17
|
+
private readonly showHere;
|
|
18
|
+
constructor(ctx: RouterContext, sets: CommandSets, text: PersonalText);
|
|
19
|
+
route(event: InboundMessage | InboundAction, chat: Chat): Promise<void>;
|
|
20
|
+
/** Linked before the Claw user id was kept: it is read now. */
|
|
21
|
+
private backfill;
|
|
22
|
+
private message;
|
|
23
|
+
/** What a 1:1 message can do with no account: true when it was taken. */
|
|
24
|
+
private beforeCredential;
|
|
25
|
+
private handlerOf;
|
|
26
|
+
private click;
|
|
27
|
+
private ownClick;
|
|
28
|
+
}
|
|
29
|
+
/** What is stored for proactive messages: the channel's own reference, as it gave it. */
|
|
30
|
+
export declare function wireOf(event: {
|
|
31
|
+
readonly conversation: {
|
|
32
|
+
readonly wire: Readonly<Record<string, unknown>>;
|
|
33
|
+
};
|
|
34
|
+
}): JsonObject;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { InboundFile, InboundMessage } from "../ports/surface.js";
|
|
2
|
+
import type { Chat } from "./chat.js";
|
|
3
|
+
import type { CommandTable } from "./command-table.js";
|
|
4
|
+
import type { RouterContext } from "./context.js";
|
|
5
|
+
import type { TurnStarter } from "./turn-start.js";
|
|
6
|
+
/**
|
|
7
|
+
* A 1:1 message that is not one of the chat's commands, as it goes on (the Python `Agent._text_of`, `_on_text`,
|
|
8
|
+
* `_sent_on`, `_talks_to_agent`, `_session_control`, `_understand`, `_understood`, `_offer_github`, `_attachments`):
|
|
9
|
+
* to the remote agent the chat is attached to, to the person's assistant, or to Claw as a turn.
|
|
10
|
+
*/
|
|
11
|
+
export declare class PersonalText {
|
|
12
|
+
private readonly ctx;
|
|
13
|
+
private readonly commands;
|
|
14
|
+
private readonly starter;
|
|
15
|
+
constructor(ctx: RouterContext, commands: CommandTable, starter: TurnStarter);
|
|
16
|
+
/**
|
|
17
|
+
* What the person wrote, with a word of the commands menu read as its command and a sentence help teaches read as the
|
|
18
|
+
* command it means; a sentence for what this chat cannot do right now stays words.
|
|
19
|
+
*/
|
|
20
|
+
textOf(message: InboundMessage, group?: boolean): string;
|
|
21
|
+
onText(message: InboundMessage, chat: Chat, key: string): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Whether this 1:1 message goes to the remote session the chat is attached to: only words the person typed, and not
|
|
24
|
+
* those that start by naming the bot. A chat whose session card is the window keeps its chat box for the bot: only a
|
|
25
|
+
* reply that quotes the card goes to the session.
|
|
26
|
+
*/
|
|
27
|
+
talksToAgent(message: InboundMessage): boolean;
|
|
28
|
+
/** The files that go to Claw with a message; the person is told about the ones that do not, and they are counted. */
|
|
29
|
+
attachments(message: InboundMessage, chat: Chat, elsewhere?: boolean): Promise<readonly InboundFile[]>;
|
|
30
|
+
/** What the chat is attached to, for the assistant (only where remote agents are on). */
|
|
31
|
+
private attached;
|
|
32
|
+
/** A 1:1 message that is no command, as it goes on to the attached agent, the assistant or Claw. */
|
|
33
|
+
sentOn(message: InboundMessage, chat: Chat, key: string): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* A message to an attached chat that is about the sessions themselves (switch, open a new one), with the assistant on to
|
|
36
|
+
* read it: the words alone (a quote or a file goes to the agent with them).
|
|
37
|
+
*/
|
|
38
|
+
private sessionControl;
|
|
39
|
+
/** A message the assistant takes when it is on, else a turn of Claw's. */
|
|
40
|
+
private toAssistantOrTurn;
|
|
41
|
+
/** A prompt for the attached agent, within the task limit (the slot is held until the remote turn counts as running). */
|
|
42
|
+
private remotePrompt;
|
|
43
|
+
/**
|
|
44
|
+
* Beside a question about the person's own GitHub while Claw has no token of theirs: the connect card first; once they
|
|
45
|
+
* connect, the question is asked again as a message of its own (an id of its own), with a credential read again then.
|
|
46
|
+
*/
|
|
47
|
+
offerGithub(message: InboundMessage, chat: Chat, key: string, text: string, goOn: (message: InboundMessage, credential: string) => Promise<void>): Promise<void>;
|
|
48
|
+
understand(message: InboundMessage, chat: Chat, key: string): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* A message of a person the assistant understands: to their assistant, as they wrote it (with what it quotes and the
|
|
51
|
+
* addresses behind its links), with the chat's context, and as the person (their exchanged identity token, their key
|
|
52
|
+
* beside it for the model; with no token, on their key). Files go with it; files alone are a message too.
|
|
53
|
+
*/
|
|
54
|
+
understood(message: InboundMessage, chat: Chat, key: string): Promise<void>;
|
|
55
|
+
}
|
|
56
|
+
/** The message came with files, whether the channel gave a way to fetch them or not (Python `any(inbound_files(activity))`). */
|
|
57
|
+
export declare function hasFiles(message: InboundMessage): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* A review request does not take the files sent with it, and the person is told so (a review reads the pull request):
|
|
60
|
+
* what the review service calls after it took such a message.
|
|
61
|
+
*/
|
|
62
|
+
export declare function filesNotReviewed(ctx: RouterContext, chat: Chat, message: InboundMessage, text: string): Promise<void>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { InboundEvent, InboundMessage, UserRef } from "../ports/surface.js";
|
|
2
|
+
import type { ReviewSlots } from "./admission.js";
|
|
3
|
+
import { Chat } from "./chat.js";
|
|
4
|
+
import { CommandTable } from "./command-table.js";
|
|
5
|
+
import { RouterContext } from "./context.js";
|
|
6
|
+
import type { RouterDeps } from "./deps.js";
|
|
7
|
+
import { GroupRouter } from "./group-router.js";
|
|
8
|
+
import { Onboarding } from "./onboarding.js";
|
|
9
|
+
import { TurnStarter, type RunningTurn, type StartTurn } from "./turn-start.js";
|
|
10
|
+
/**
|
|
11
|
+
* The entry point of every inbound event (the Python `Agent.handle`, `_route`, `_settle_click`, `_dispatch`): idempotent
|
|
12
|
+
* per event id; a message over its sender's rate is dropped before anything is read for it; a group message not addressed
|
|
13
|
+
* to the bot goes to the group's observer; a group, a 1:1 chat, anything else is told where the bot works. Whatever a click
|
|
14
|
+
* handler left open is settled here, so a click never stays a "Working on it..." card.
|
|
15
|
+
*/
|
|
16
|
+
export declare class Router {
|
|
17
|
+
readonly ctx: RouterContext;
|
|
18
|
+
readonly starter: TurnStarter;
|
|
19
|
+
readonly onboarding: Onboarding;
|
|
20
|
+
readonly commands: CommandTable;
|
|
21
|
+
private readonly text;
|
|
22
|
+
private readonly personal;
|
|
23
|
+
readonly group: GroupRouter;
|
|
24
|
+
constructor(deps: RouterDeps);
|
|
25
|
+
handle(event: InboundEvent): Promise<void>;
|
|
26
|
+
private route;
|
|
27
|
+
/** The safety net under every card click: a click whose card is still the placeholder ends with a note. */
|
|
28
|
+
private settleOpen;
|
|
29
|
+
private vote;
|
|
30
|
+
private dispatch;
|
|
31
|
+
/** The message is /stop (typed, the menu word, or a sentence that means it): what a refused person can still send. */
|
|
32
|
+
private static isStop;
|
|
33
|
+
/**
|
|
34
|
+
* Counts a message against its sender's rate, across all their chats. False: over it, dropped, and the person is told
|
|
35
|
+
* once per burst. /stop is never counted or refused; a group message that does not mention the bot is not counted.
|
|
36
|
+
*/
|
|
37
|
+
private withinRate;
|
|
38
|
+
/** Start (or queue) a turn: the review service starts its reviews here. */
|
|
39
|
+
startTurn(request: StartTurn): Promise<RunningTurn | undefined>;
|
|
40
|
+
/** Admit up to `count` pull requests of one review request against the person's task limit. */
|
|
41
|
+
admitReviews(chat: Chat, activityId: string, count: number, boardKey: string): Promise<ReviewSlots>;
|
|
42
|
+
/** A command the assistant asked the chat to carry out, as if typed (no message: those that need one are refused). */
|
|
43
|
+
runCommand(text: string, chat: Chat): Promise<boolean>;
|
|
44
|
+
/** The person's 1:1 chat has a turn of the old kind running (the assistant lets it finish). */
|
|
45
|
+
hasPersonalTurn(userId: string): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* A work item was stopped from its card (the assistant's Stop): the review turn this router follows for it ends as
|
|
48
|
+
* stopped, not as a task that failed, as when a group's "停 N" stops it (Python `Agent._item_stopped`).
|
|
49
|
+
*/
|
|
50
|
+
itemStopped(itemId: string): void;
|
|
51
|
+
/** A chat as the router answers in it, for work that runs on its own (no client locale). */
|
|
52
|
+
chat(sender: UserRef, conversation: Chat["conversation"], scope?: string): Chat;
|
|
53
|
+
/** What the review service says when the files of a review request do not go with it. */
|
|
54
|
+
filesNotReviewed(chat: Chat, message: InboundMessage, text: string): Promise<void>;
|
|
55
|
+
/** The turns that run now, for a test to wait on. */
|
|
56
|
+
settled(): Promise<void>;
|
|
57
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { InboundAction } from "../ports/surface.js";
|
|
2
|
+
import type { Chat } from "./chat.js";
|
|
3
|
+
import type { RouterContext } from "./context.js";
|
|
4
|
+
/**
|
|
5
|
+
* A press on "Show here" (1:1 chat only; Python agent.py `_show`): that session's last answer is posted in the chat and the
|
|
6
|
+
* session becomes the chat's current one. The card is not trusted: the session is read with the PRESSER's own credential,
|
|
7
|
+
* and Claw refuses a session that is not theirs, so nothing is posted and nothing is switched then. The card is replaced on
|
|
8
|
+
* every outcome; where pressing again can help it comes back with its button.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ShowHere {
|
|
11
|
+
private readonly ctx;
|
|
12
|
+
constructor(ctx: RouterContext);
|
|
13
|
+
click(action: InboundAction, chat: Chat, key: string): Promise<void>;
|
|
14
|
+
/** The session's last answer (undefined: none finished); null when it could not be read (the card was replaced). */
|
|
15
|
+
private read;
|
|
16
|
+
/** The chat has this session again, and no repository waits for a new one. */
|
|
17
|
+
private switchTo;
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { InboundAction } from "../ports/surface.js";
|
|
2
|
+
import type { Chat } from "./chat.js";
|
|
3
|
+
import type { RouterContext } from "./context.js";
|
|
4
|
+
/**
|
|
5
|
+
* A press on a Stop card sent before the worker stopped sending them (the Python `Agent._turn_stop_click`, `_drop_tapped`,
|
|
6
|
+
* after internal #481: a turn from a phone is stopped by saying 停止 or /stop, and no card is offered any more). Such a card
|
|
7
|
+
* names no turn this worker runs, so the press stops nothing and says so; the pressed card is deleted, never edited (a phone
|
|
8
|
+
* does not redraw an edit), and where it cannot be deleted it is closed to a line.
|
|
9
|
+
*/
|
|
10
|
+
export declare class StopPress {
|
|
11
|
+
private readonly ctx;
|
|
12
|
+
constructor(ctx: RouterContext);
|
|
13
|
+
press(action: InboundAction, chat: Chat): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Take a pressed card away: deleted (settled, so the safety net leaves it alone); where the channel refuses the delete,
|
|
16
|
+
* closed to `line`, except in a chat that is an agent's window, where nothing is edited and the card is left as it is.
|
|
17
|
+
*/
|
|
18
|
+
private dropTapped;
|
|
19
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** A moment as a wall clock in a time zone shows it. */
|
|
2
|
+
export interface Wall {
|
|
3
|
+
readonly year: number;
|
|
4
|
+
readonly month: number;
|
|
5
|
+
readonly day: number;
|
|
6
|
+
readonly hour: number;
|
|
7
|
+
readonly minute: number;
|
|
8
|
+
/** "Mon", "Tue", ... (Python's `%a` in the C locale). */
|
|
9
|
+
readonly weekday: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Whether `name` is a time zone the worker takes (Python `ZoneInfo(name)` on the tz database's file names): a name the
|
|
13
|
+
* runtime knows, written as the database writes it ("Asia/Shanghai", "UTC", "Etc/GMT+8"; not "asia/shanghai" or "+08:00").
|
|
14
|
+
*/
|
|
15
|
+
export declare function isTimeZone(name: string): boolean;
|
|
16
|
+
/** The person's zone (`proactive.zone_of`): theirs when it is one, else the default. */
|
|
17
|
+
export declare function zoneOf(timezone: string): string;
|
|
18
|
+
/** `epochSeconds` on the wall clock of `zone`. */
|
|
19
|
+
export declare function wallClock(epochSeconds: number, zone: string): Wall;
|
|
20
|
+
export declare function two(value: number): string;
|
|
21
|
+
/** "HH:MM" of a wall clock. */
|
|
22
|
+
export declare function hhmm(wall: Wall): string;
|
|
23
|
+
/** Python's `%b`. */
|
|
24
|
+
export declare function monthName(wall: Wall): string;
|
|
25
|
+
/** Days from `then` to `now` on the calendar (both wall dates in one zone). */
|
|
26
|
+
export declare function daysBetween(then: Wall, now: Wall): number;
|
|
27
|
+
/**
|
|
28
|
+
* When a session was last used, in the person's zone: "today 12:40", "yesterday 18:05", else "03 Oct 09:15" (in Chinese
|
|
29
|
+
* "今天 12:40", "昨天 18:05", else "10月03日 09:15") (the Python `render.when_text`).
|
|
30
|
+
*/
|
|
31
|
+
export declare function whenText(at: number, now: number, zone: string, lang: string): string;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The turns this worker follows, per chat (the Python `Agent._turns`, `ActiveTurn`, `_queue_behind`, `_drop_turn`,
|
|
3
|
+
* `_item_stopped`). A chat has the turn Claw runs and at most one queued behind it; a review for a colleague is kept
|
|
4
|
+
* under a key of its own per pull request, so it neither waits for nor blocks the asker's chat turn.
|
|
5
|
+
*/
|
|
6
|
+
import type { Clock } from "../ports/clock.js";
|
|
7
|
+
/** A signal that is set once: what a message queued behind a turn waits for. */
|
|
8
|
+
export declare class Latch {
|
|
9
|
+
private done;
|
|
10
|
+
private readonly waiters;
|
|
11
|
+
get isSet(): boolean;
|
|
12
|
+
set(): void;
|
|
13
|
+
/** True when it was set within `ms` of `clock`, false when the wait ran out. */
|
|
14
|
+
wait(ms: number, clock: Clock): Promise<boolean>;
|
|
15
|
+
}
|
|
16
|
+
export declare class ActiveTurn {
|
|
17
|
+
/** A review for a colleague: its own session, so nothing is queued behind it. */
|
|
18
|
+
readonly review: boolean;
|
|
19
|
+
/** A review that is a work item of Claw's: a Stop on its card is this turn's stop as well. */
|
|
20
|
+
readonly itemId: string;
|
|
21
|
+
stopRequested: boolean;
|
|
22
|
+
/** The person pressed Deny on one of this turn's approval cards. */
|
|
23
|
+
toolDenied: boolean;
|
|
24
|
+
/** Claw took this turn's stop (its item's, or the interrupt): its failed end is the stop, not an error. */
|
|
25
|
+
stopConfirmed: boolean;
|
|
26
|
+
/** Set once Claw runs the turn's message, or the turn is over: a message sent behind it may go then. */
|
|
27
|
+
readonly running: Latch;
|
|
28
|
+
/** The turn is over (or never started). */
|
|
29
|
+
over: boolean;
|
|
30
|
+
constructor(
|
|
31
|
+
/** A review for a colleague: its own session, so nothing is queued behind it. */
|
|
32
|
+
review?: boolean,
|
|
33
|
+
/** A review that is a work item of Claw's: a Stop on its card is this turn's stop as well. */
|
|
34
|
+
itemId?: string);
|
|
35
|
+
}
|
|
36
|
+
/** What a turn is kept under: a person and a chat ("" the 1:1 chat), and for a review the item or the pull request. */
|
|
37
|
+
export interface TurnKey {
|
|
38
|
+
readonly userId: string;
|
|
39
|
+
readonly scope: string;
|
|
40
|
+
/** For a review: "review:<item id>" or "review:<pull request>"; "" for a chat turn. */
|
|
41
|
+
readonly review: string;
|
|
42
|
+
}
|
|
43
|
+
export type QueueRefusal = "still_working" | "one_waiting";
|
|
44
|
+
export declare class TurnRegistry {
|
|
45
|
+
private readonly turns;
|
|
46
|
+
/** The chat's turns, oldest first: the one Claw runs, then at most one queued behind it. */
|
|
47
|
+
of(key: TurnKey): readonly ActiveTurn[];
|
|
48
|
+
has(key: TurnKey): boolean;
|
|
49
|
+
/** Registers `turn` as the first of a chat that has none; false when the chat has one. */
|
|
50
|
+
claim(key: TurnKey, turn: ActiveTurn): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* `turn` behind the chat's running one: refused when a review is either of them, or when one already waits. Otherwise
|
|
53
|
+
* it is registered, and the caller waits for the front turn to run (`front`).
|
|
54
|
+
*/
|
|
55
|
+
enqueue(key: TurnKey, turn: ActiveTurn): {
|
|
56
|
+
readonly front: ActiveTurn;
|
|
57
|
+
} | QueueRefusal;
|
|
58
|
+
/** The turn is over (or never started): whatever waits behind it may go, and the chat no longer holds it. */
|
|
59
|
+
drop(key: TurnKey, turn: ActiveTurn): void;
|
|
60
|
+
/** A work item was stopped from its card: the review turn that follows it ends as stopped, not as a task that failed. */
|
|
61
|
+
itemStopped(itemId: string): void;
|
|
62
|
+
/** The person's turns, one per chat and one per review (what counts against their task limit). */
|
|
63
|
+
countFor(userId: string): number;
|
|
64
|
+
/** The review work items the person's turns follow (the board must not count them a second time). */
|
|
65
|
+
reviewItemsOf(userId: string): Set<string>;
|
|
66
|
+
get size(): number;
|
|
67
|
+
}
|
|
68
|
+
/** The key of a person's chat turn. */
|
|
69
|
+
export declare function chatTurnKey(userId: string, scope?: string): TurnKey;
|
|
70
|
+
/** The key of a review turn: its item when Claw made one (one open review per pull request), else the pull request. */
|
|
71
|
+
export declare function reviewTurnKey(userId: string, scope: string, itemId: string, pull: string): TurnKey;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { Lang } from "../locales/lang.js";
|
|
2
|
+
import type { Conversation, InboundFile, OutMessage } from "../ports/surface.js";
|
|
3
|
+
import type { CredentialProvider } from "./features.js";
|
|
4
|
+
/**
|
|
5
|
+
* The turn engine as the router starts it (the Python `turn.TurnContext` and `run_turn`). The router decides whether a
|
|
6
|
+
* turn may start (the person's task limit, the chat's queue) and in which session; the engine sends the message to
|
|
7
|
+
* Claw, follows the session's stream and shows progress and the answer. A review's own fields are declared by the review
|
|
8
|
+
* service on `ReviewRunFields` (declaration merging), so the router carries them without reading them.
|
|
9
|
+
*/
|
|
10
|
+
/** Fields of a review's run, declared by the review service: `declare module ".../turn-runner.js" { interface ReviewRunFields { ... } }`. */
|
|
11
|
+
export interface ReviewRunFields {
|
|
12
|
+
}
|
|
13
|
+
export interface TurnRun {
|
|
14
|
+
readonly conversation: Conversation;
|
|
15
|
+
/** The person the turn is for (whose approvals its cards are; Python `sender.aad_id`). */
|
|
16
|
+
readonly userId: string;
|
|
17
|
+
/** The person this turn acts for: their key, or an exchanged token. */
|
|
18
|
+
readonly credential: string;
|
|
19
|
+
readonly provider: CredentialProvider;
|
|
20
|
+
/** The session to continue; null: Claw creates one with this message. */
|
|
21
|
+
readonly sessionId: string | null;
|
|
22
|
+
/** What the person wrote (the session's title, the language of the answer). */
|
|
23
|
+
readonly text: string;
|
|
24
|
+
/** The message's id: the idempotency key of the send. */
|
|
25
|
+
readonly messageId: string;
|
|
26
|
+
readonly group: boolean;
|
|
27
|
+
readonly ownerName: string;
|
|
28
|
+
/** The model the session is pinned to ("" Claw's default). */
|
|
29
|
+
readonly model: string;
|
|
30
|
+
readonly fallbackModel: string;
|
|
31
|
+
/** The model the existing session is known to have ("" none known). */
|
|
32
|
+
readonly sessionModel: string;
|
|
33
|
+
/** The repository a NEW session is bound to (`/repo`); null: none. */
|
|
34
|
+
readonly repo: {
|
|
35
|
+
readonly url: string;
|
|
36
|
+
readonly branch: string;
|
|
37
|
+
} | null;
|
|
38
|
+
/** A card with what the session changed follows a finished answer. */
|
|
39
|
+
readonly showChanges: boolean;
|
|
40
|
+
/** The message(s) this one quotes, as text for the model ("" none). */
|
|
41
|
+
readonly quote: string;
|
|
42
|
+
/** `text` with the address behind each of its links ("" when it is `text`). */
|
|
43
|
+
readonly sent: string;
|
|
44
|
+
readonly files: readonly InboundFile[];
|
|
45
|
+
readonly lang: Lang;
|
|
46
|
+
/** The answer gets thumbs of the worker's own (a phone, whose own thumbs never reach the worker). */
|
|
47
|
+
readonly ownThumbs: boolean;
|
|
48
|
+
/** Claw pushes this person a run's end and its approvals. */
|
|
49
|
+
readonly notifies: boolean;
|
|
50
|
+
/** A review's own fields; undefined for a chat turn. */
|
|
51
|
+
readonly review: (ReviewRunFields & {
|
|
52
|
+
readonly kind: "review";
|
|
53
|
+
}) | undefined;
|
|
54
|
+
}
|
|
55
|
+
/** What the turn tells the router, and asks it, while it runs. */
|
|
56
|
+
export interface TurnHooks {
|
|
57
|
+
/** Claw took the message: `sessionId` is the turn's session; `sessionModel` the model it now has. */
|
|
58
|
+
onSession(sessionId: string, sessionModel: string): void;
|
|
59
|
+
/** Claw is running this turn's message: a message queued behind it may go. */
|
|
60
|
+
onRunning(): void;
|
|
61
|
+
/** The turn's record: started, delivered (its answer is in the chat) or not. */
|
|
62
|
+
onTurn(sessionId: string, what: "started" | "delivered" | "failed", messageId: string): void;
|
|
63
|
+
stopRequested(): boolean;
|
|
64
|
+
/** The person pressed Deny on one of this turn's approval cards. */
|
|
65
|
+
toolDenied(): boolean;
|
|
66
|
+
/** Claw took this turn's stop: its failed end is the stop, not an error. */
|
|
67
|
+
stopConfirmed(): boolean;
|
|
68
|
+
/** The "Report a problem" card for a turn that went wrong; undefined: none. */
|
|
69
|
+
reportView(): OutMessage | undefined;
|
|
70
|
+
}
|
|
71
|
+
/** How a turn ended, as far as the router and a review read it. */
|
|
72
|
+
export interface TurnOutcome {
|
|
73
|
+
readonly finalAnswer: string;
|
|
74
|
+
}
|
|
75
|
+
export interface TurnRunner {
|
|
76
|
+
run(run: TurnRun, hooks: TurnHooks): Promise<TurnOutcome>;
|
|
77
|
+
/**
|
|
78
|
+
* The answer of the session's last finished turn, read with `credential` (undefined: none finished yet). Claw refuses a
|
|
79
|
+
* session the credential does not own (a ClawError 401/403/404); one it cannot be reached for is a ClawUnreachable.
|
|
80
|
+
*/
|
|
81
|
+
lastAnswer(credential: string, sessionId: string): Promise<string | undefined>;
|
|
82
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Lang } from "../locales/lang.js";
|
|
2
|
+
import type { InboundFile } from "../ports/surface.js";
|
|
3
|
+
import type { Chat } from "./chat.js";
|
|
4
|
+
import type { RouterContext } from "./context.js";
|
|
5
|
+
import type { ReviewRunFields, TurnOutcome } from "./turn-runner.js";
|
|
6
|
+
/** What a waiting message gives the turn in front to start running in Claw (`_queue_behind`). */
|
|
7
|
+
export declare const SUBMIT_WAIT_SECONDS = 15;
|
|
8
|
+
/** Teams on a phone or a tablet: its own Stop under a reply is greyed out, and its own thumbs never reach the worker. */
|
|
9
|
+
export declare function isMobile(clientPlatform: string): boolean;
|
|
10
|
+
/** A review the review service starts as a turn here (its item runs in Claw already; the turn only follows it). */
|
|
11
|
+
export interface ReviewTurnStart {
|
|
12
|
+
/** The work item Claw made for it ("" none: the turn makes a session of its own). */
|
|
13
|
+
readonly itemId: string;
|
|
14
|
+
/** The item's session (null: none yet). */
|
|
15
|
+
readonly itemSessionId: string | null;
|
|
16
|
+
/** The pull request, as `owner/repo#N`: a review is kept per pull request when it has no item. */
|
|
17
|
+
readonly pull: string;
|
|
18
|
+
/** The model it runs on ("" the worker's review model). */
|
|
19
|
+
readonly model: string;
|
|
20
|
+
/** Its request's language: a review's own lines follow it. */
|
|
21
|
+
readonly lang: Lang;
|
|
22
|
+
/** The review's own fields of the run. */
|
|
23
|
+
readonly fields: ReviewRunFields & {
|
|
24
|
+
readonly kind: "review";
|
|
25
|
+
};
|
|
26
|
+
/** The review's session exists (it is not the chat's: only the review remembers it). */
|
|
27
|
+
onSession(sessionId: string): void;
|
|
28
|
+
/** After the turn, unless it failed. */
|
|
29
|
+
after(outcome: TurnOutcome): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
/** A turn that was started: it runs on its own, and `done` settles when it is over (it never rejects). */
|
|
32
|
+
export interface RunningTurn {
|
|
33
|
+
readonly done: Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
export interface StartTurn {
|
|
36
|
+
readonly chat: Chat;
|
|
37
|
+
/** What the turn calls Claw with (for a review: the asker's identity token). */
|
|
38
|
+
readonly credential: string;
|
|
39
|
+
readonly text: string;
|
|
40
|
+
readonly messageId: string;
|
|
41
|
+
readonly clientPlatform: string;
|
|
42
|
+
readonly quote?: string;
|
|
43
|
+
readonly sent?: string;
|
|
44
|
+
readonly files?: readonly InboundFile[];
|
|
45
|
+
readonly review?: ReviewTurnStart;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Starting and following a turn (the Python `Agent._start_turn`, `_queue_behind`, `_guarded`, `_record_session`,
|
|
49
|
+
* `_record_turn`): a new task is admitted under the person's task limit; a message sent while the chat's turn runs is
|
|
50
|
+
* queued in Claw behind it (one at most); a review has a session of its own and is neither queued nor queued behind.
|
|
51
|
+
*/
|
|
52
|
+
export declare class TurnStarter {
|
|
53
|
+
private readonly ctx;
|
|
54
|
+
private readonly running;
|
|
55
|
+
constructor(ctx: RouterContext);
|
|
56
|
+
/** The turns that run now (a test waits for them). */
|
|
57
|
+
settled(): Promise<void>;
|
|
58
|
+
/** The turn that runs (its end is `done`), or undefined when none was started (the person was told why). */
|
|
59
|
+
start(request: StartTurn): Promise<RunningTurn | undefined>;
|
|
60
|
+
/** True when admitted as the chat's first turn; false when the chat has one (queue behind it); undefined: refused. */
|
|
61
|
+
private admit;
|
|
62
|
+
/**
|
|
63
|
+
* Registers `turn` behind the chat's running one; false (the person is told why) when it may not go. It is sent only
|
|
64
|
+
* once Claw runs the turn in front: then Claw names that turn as the one it waits behind.
|
|
65
|
+
*/
|
|
66
|
+
private queueBehind;
|
|
67
|
+
private sessionOf;
|
|
68
|
+
private providerOf;
|
|
69
|
+
private ownThumbs;
|
|
70
|
+
/** What the run reads of the chat's session: its id, the model it has, the repository a new one is bound to. */
|
|
71
|
+
private sessionPart;
|
|
72
|
+
private runOf;
|
|
73
|
+
private hooks;
|
|
74
|
+
private guarded;
|
|
75
|
+
private tell;
|
|
76
|
+
/**
|
|
77
|
+
* The turn has a session: it is the chat's session, and a 1:1 chat remembers it for /sessions, with what a session
|
|
78
|
+
* this turn created was started with and the repository it is bound to (which uses up the `/repo` choice).
|
|
79
|
+
*/
|
|
80
|
+
private recordSession;
|
|
81
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { Lang } from "../locales/lang.js";
|
|
2
|
+
import type { OutMessage, ViewButton } from "../ports/surface.js";
|
|
3
|
+
import type { NoteButton, NoteFactory } from "./features.js";
|
|
4
|
+
/**
|
|
5
|
+
* The cards of connecting and of the chat's own commands (the Python `render.link_card`, `binding_request_card`,
|
|
6
|
+
* `onboarding_card`, `repo_card`, `session_card`, `confirm_button`, `repo_button`, `show_button`), as view models the
|
|
7
|
+
* channel renders (`teams/src/views/commands/`). A model carries what the card says, never card JSON.
|
|
8
|
+
*/
|
|
9
|
+
/** Connect by confirming as `who` on the platform, or on the console page with `/link CODE`. */
|
|
10
|
+
export interface LinkCardView {
|
|
11
|
+
readonly bot: string;
|
|
12
|
+
readonly who: string;
|
|
13
|
+
/** The console page that gives a `/link` code. */
|
|
14
|
+
readonly page: string;
|
|
15
|
+
readonly notice: string;
|
|
16
|
+
}
|
|
17
|
+
/** A one-time link to open and confirm, and the button to press after. */
|
|
18
|
+
export interface BindingCardView {
|
|
19
|
+
readonly bot: string;
|
|
20
|
+
readonly confirmUrl: string;
|
|
21
|
+
/** A first sentence ("" none). */
|
|
22
|
+
readonly lead: string;
|
|
23
|
+
readonly notice: string;
|
|
24
|
+
}
|
|
25
|
+
/** A group member who has not connected: addressed to them, one button only they can use. */
|
|
26
|
+
export interface OnboardingCardView {
|
|
27
|
+
readonly bot: string;
|
|
28
|
+
readonly name: string;
|
|
29
|
+
readonly channelUserId: string;
|
|
30
|
+
readonly promptId: string;
|
|
31
|
+
/** The steps are already in their 1:1 chat. */
|
|
32
|
+
readonly dmSent: boolean;
|
|
33
|
+
/** One extra line, for a card put back after someone else pressed its button ("" none). */
|
|
34
|
+
readonly note: string;
|
|
35
|
+
/** How long the request waits for them. */
|
|
36
|
+
readonly waitMinutes: number;
|
|
37
|
+
}
|
|
38
|
+
/** One repository `/repo` lists. */
|
|
39
|
+
export interface RepoCardView {
|
|
40
|
+
readonly repo: string;
|
|
41
|
+
/** "" the default branch. */
|
|
42
|
+
readonly branch: string;
|
|
43
|
+
readonly lang: Lang;
|
|
44
|
+
}
|
|
45
|
+
/** One session `/sessions` lists. */
|
|
46
|
+
export interface SessionCardView {
|
|
47
|
+
readonly sessionId: string;
|
|
48
|
+
/** What it was started with ("" none known). */
|
|
49
|
+
readonly title: string;
|
|
50
|
+
readonly repo: string;
|
|
51
|
+
readonly branch: string;
|
|
52
|
+
/** When it was last used here, as the person reads it ("today 12:40"). */
|
|
53
|
+
readonly when: string;
|
|
54
|
+
/** It is this chat's session now. */
|
|
55
|
+
readonly current: boolean;
|
|
56
|
+
readonly lang: Lang;
|
|
57
|
+
/** The console's address. */
|
|
58
|
+
readonly publicBaseUrl: string;
|
|
59
|
+
}
|
|
60
|
+
declare module "../ports/surface.js" {
|
|
61
|
+
interface ViewMap {
|
|
62
|
+
link: LinkCardView;
|
|
63
|
+
binding: BindingCardView;
|
|
64
|
+
onboarding: OnboardingCardView;
|
|
65
|
+
repo: RepoCardView;
|
|
66
|
+
session: SessionCardView;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/** Minutes a group request waits for its asker to connect (the store keeps it as long). */
|
|
70
|
+
export declare const ONBOARDING_REQUEST_MINUTES = 15;
|
|
71
|
+
/** The Confirm button of the older connect card (the person says they confirmed). */
|
|
72
|
+
export declare const CONFIRM_BUTTON: NoteButton;
|
|
73
|
+
/** The button a `/repo` card and its notes carry; it comes back from the client, so it is read again like typed text. */
|
|
74
|
+
export declare function repoButton(repo: string, branch: string, lang?: Lang): NoteButton;
|
|
75
|
+
/** The Show here button: it makes a session this chat's session again. */
|
|
76
|
+
export declare function showButton(sessionId: string, title?: string): NoteButton;
|
|
77
|
+
/** A Create PR button, under the changes card and on the notes that put it back (Python `create_pr_button`). */
|
|
78
|
+
export declare function createPrButton(sessionId: string): NoteButton;
|
|
79
|
+
/**
|
|
80
|
+
* A note button as the worker's click protocol carries it, field for field as the Python worker's `confirm_button`,
|
|
81
|
+
* `repo_button`, `show_button` and `create_pr_button` build it: the verb `primusclaw.<kind>`, and the data naming the
|
|
82
|
+
* kind first (`primusclaw: <kind>`), which is what a press is routed by.
|
|
83
|
+
*/
|
|
84
|
+
export declare function viewButtonOf(button: NoteButton): ViewButton;
|
|
85
|
+
/**
|
|
86
|
+
* The note card the router's clicks end as (Python `render.note_card(text, buttons, title, tone)`): what assembly passes
|
|
87
|
+
* as `RouterDeps.note`. A tone the note does not know is the default one.
|
|
88
|
+
*/
|
|
89
|
+
export declare const noteFactory: NoteFactory;
|
|
90
|
+
/** Builds the messages of the router's cards. */
|
|
91
|
+
export declare class CommandViews {
|
|
92
|
+
private readonly bot;
|
|
93
|
+
private readonly publicBaseUrl;
|
|
94
|
+
readonly note: NoteFactory;
|
|
95
|
+
constructor(bot: string, publicBaseUrl: string, note: NoteFactory);
|
|
96
|
+
link(who: string): OutMessage;
|
|
97
|
+
binding(confirmUrl: string, lead?: string): OutMessage;
|
|
98
|
+
onboarding(member: {
|
|
99
|
+
name: string;
|
|
100
|
+
channelUserId: string;
|
|
101
|
+
}, promptId: string, dmSent: boolean, note?: string): OutMessage;
|
|
102
|
+
repo(repo: string, branch: string, lang: Lang): OutMessage;
|
|
103
|
+
session(card: Omit<SessionCardView, "publicBaseUrl">): OutMessage;
|
|
104
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** What a masked value is replaced with. */
|
|
2
|
+
export declare const MASK = "[hidden]";
|
|
3
|
+
/**
|
|
4
|
+
* The JWT rule. A start that fails fails for every later "eyJ" inside the same first part (they share its end, the
|
|
5
|
+
* dot and the parts after it, and have fewer characters before the dot), so the scan goes on after that part.
|
|
6
|
+
*/
|
|
7
|
+
export declare function maskJwts(text: string): {
|
|
8
|
+
text: string;
|
|
9
|
+
masked: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* The secret rule: only the value is masked (the name, the separator and a quote stay). A name that fails fails for
|
|
13
|
+
* every later name in the same run of word characters (its `[\w-]*` reaches every place theirs can), so the scan goes
|
|
14
|
+
* on after that run.
|
|
15
|
+
*/
|
|
16
|
+
export declare function maskSecretValues(text: string): {
|
|
17
|
+
text: string;
|
|
18
|
+
masked: boolean;
|
|
19
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MASK } from "./redact-scan.js";
|
|
2
|
+
export { MASK };
|
|
3
|
+
/**
|
|
4
|
+
* The one line a channel adds to a message it masked (the Python worker's text, byte for byte). Masking an outbound
|
|
5
|
+
* activity or card is the channel's (the Teams package's), with `redactText` and this note.
|
|
6
|
+
*/
|
|
7
|
+
export declare const NOTE = "Some sensitive-looking values were hidden. Ask me in a 1:1 chat if you need them.";
|
|
8
|
+
/** `text` with credential-shaped values masked, and whether anything was masked. */
|
|
9
|
+
export declare function redactText(text: string): {
|
|
10
|
+
text: string;
|
|
11
|
+
masked: boolean;
|
|
12
|
+
};
|
|
13
|
+
/** A log line with credential shapes masked, and the values of credential-named URL query parameters. */
|
|
14
|
+
export declare function redactLogLine(text: string): string;
|