@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,107 @@
|
|
|
1
|
+
import type { Lang } from "../locales/lang.js";
|
|
2
|
+
import type { Conversation, InboundAction, InboundMessage, InboundVote, OutMessage, UserRef } from "./surface.js";
|
|
3
|
+
/**
|
|
4
|
+
* How features plug into the router (the Python worker's `Agent._dispatch` and `Agent._route_group`). The router only
|
|
5
|
+
* dispatches: it reads who sent what and where, applies the chat's own rules (rate, account, language, the chat's
|
|
6
|
+
* commands), and hands the event to the first feature that takes it. A feature registers
|
|
7
|
+
*
|
|
8
|
+
* - `MessageInterceptor`s: read a message before the router's own reading of it (a review request, a feedback
|
|
9
|
+
* answer, an observed group's message). Run in the order the assembly lists them; the first that takes it ends it.
|
|
10
|
+
* - `CommandHandler`s: carry out a command word the router does not own (`/brief`, `/github`, `/board`).
|
|
11
|
+
* - `ClickHandler`s: answer the buttons of the cards the feature posts, by the card's verb.
|
|
12
|
+
*
|
|
13
|
+
* Every handler is given the conversation to answer in and the person's language at that moment; a click handler
|
|
14
|
+
* settles the click it was given (`ClickRoute.settle`), and the router settles whatever a handler left open.
|
|
15
|
+
*/
|
|
16
|
+
/** What every routed event carries. */
|
|
17
|
+
export interface RouteBase {
|
|
18
|
+
readonly sender: UserRef;
|
|
19
|
+
/** Where to answer. In a group chat the conversation masks credential shapes in everything it posts. */
|
|
20
|
+
readonly conversation: Conversation;
|
|
21
|
+
/** The chat a person's state is kept under: "" for their 1:1 chat, the conversation id of a group chat. */
|
|
22
|
+
readonly scope: string;
|
|
23
|
+
/** The language the person is answered in now (it can change while the event is handled: read it when saying). */
|
|
24
|
+
lang(): Lang;
|
|
25
|
+
}
|
|
26
|
+
export interface MessageRoute extends RouteBase {
|
|
27
|
+
readonly message: InboundMessage;
|
|
28
|
+
/**
|
|
29
|
+
* The message as commands read it: a word of the commands menu as its command (`help` is `/help`) and a sentence help
|
|
30
|
+
* teaches as the command it means (`停一下` is `/stop`). `message.text` is what the person wrote.
|
|
31
|
+
*/
|
|
32
|
+
readonly text: string;
|
|
33
|
+
}
|
|
34
|
+
/** How a click handler replaces the clicked card. */
|
|
35
|
+
export interface SettleOptions {
|
|
36
|
+
/** The outcome's one line, said as a new message when `card` is more than a note (a phone does not redraw an edit). */
|
|
37
|
+
readonly fallback?: string;
|
|
38
|
+
/** False for a handler that has already posted its outcome as a message of its own. */
|
|
39
|
+
readonly announce?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface ClickRoute extends RouteBase {
|
|
42
|
+
readonly action: InboundAction;
|
|
43
|
+
/**
|
|
44
|
+
* THE way a handler ends a click: the clicked card is replaced (by `card`, or by a note card saying `card` when it is
|
|
45
|
+
* text), and the outcome is also said as a new message. True when the card was replaced. Never throws for a failed
|
|
46
|
+
* edit once the outcome was said.
|
|
47
|
+
*/
|
|
48
|
+
settle(card: OutMessage | string, options?: SettleOptions): Promise<boolean>;
|
|
49
|
+
}
|
|
50
|
+
/** A message read before the router's own reading of it. */
|
|
51
|
+
export interface MessageInterceptor {
|
|
52
|
+
/** For logs and tests. */
|
|
53
|
+
readonly name: string;
|
|
54
|
+
/** True when it took the message: nothing after it reads the message. */
|
|
55
|
+
intercept(route: MessageRoute): Promise<boolean>;
|
|
56
|
+
}
|
|
57
|
+
export interface CommandRoute extends RouteBase {
|
|
58
|
+
/** What Claw is called with for this person (their linked key, or an exchanged token). */
|
|
59
|
+
readonly credential: string;
|
|
60
|
+
/** The message the command came in; undefined for a command the assistant asked the chat to carry out. */
|
|
61
|
+
readonly message: InboundMessage | undefined;
|
|
62
|
+
}
|
|
63
|
+
/** A command word the router does not carry out itself (`/brief`, `/board`, `/github`, `/agent`). */
|
|
64
|
+
export interface CommandHandler {
|
|
65
|
+
/** The command word, lower case, without the slash. */
|
|
66
|
+
readonly name: string;
|
|
67
|
+
/**
|
|
68
|
+
* Read before the account check (it needs no Claw credential: `/github`, `/lang`). Such a handler is given an empty
|
|
69
|
+
* credential.
|
|
70
|
+
*/
|
|
71
|
+
readonly beforeCredential?: boolean;
|
|
72
|
+
/** Carry out `/name args`; false when it did not take it (the message then goes on as the person's words). */
|
|
73
|
+
run(route: CommandRoute, args: string): Promise<boolean>;
|
|
74
|
+
}
|
|
75
|
+
/** The buttons of a feature's cards, by verb (the card data's `primusclaw` field). */
|
|
76
|
+
export interface ClickHandler {
|
|
77
|
+
readonly verbs: readonly string[];
|
|
78
|
+
/**
|
|
79
|
+
* A click in a 1:1 chat, before the person's credential is read: true when it was answered with no Claw key (a
|
|
80
|
+
* person with no linked key, an answer given with an exchanged identity token only).
|
|
81
|
+
*/
|
|
82
|
+
beforeCredential?(click: ClickRoute): Promise<boolean>;
|
|
83
|
+
/** A click in a 1:1 chat, with the person's credential. */
|
|
84
|
+
withCredential?(click: ClickRoute, credential: string): Promise<void>;
|
|
85
|
+
/** A click in a group chat: true when answered (a group answers only the buttons that may be pressed there). */
|
|
86
|
+
inGroup?(click: ClickRoute): Promise<boolean>;
|
|
87
|
+
}
|
|
88
|
+
export interface VoteRoute extends RouteBase {
|
|
89
|
+
readonly vote: InboundVote;
|
|
90
|
+
}
|
|
91
|
+
/** The channel's own thumbs under an answer (feedback's). */
|
|
92
|
+
export interface VoteHandler {
|
|
93
|
+
vote(route: VoteRoute): Promise<void>;
|
|
94
|
+
}
|
|
95
|
+
/** The handlers a feature brings, in the order they are tried. */
|
|
96
|
+
export interface RouteHandlers {
|
|
97
|
+
/** Read in a 1:1 chat before the account check. */
|
|
98
|
+
readonly personalInterceptors: readonly MessageInterceptor[];
|
|
99
|
+
/** Read in a group chat after the group's own commands, before the account check. */
|
|
100
|
+
readonly groupInterceptors: readonly MessageInterceptor[];
|
|
101
|
+
readonly commands: readonly CommandHandler[];
|
|
102
|
+
readonly clicks: readonly ClickHandler[];
|
|
103
|
+
/** The channel's thumbs (undefined: they are dropped). */
|
|
104
|
+
readonly votes?: VoteHandler;
|
|
105
|
+
}
|
|
106
|
+
/** No handlers. */
|
|
107
|
+
export declare const noRouteHandlers: RouteHandlers;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the worker's secrets come from. The names are the settings they replace; how a source finds each one (an
|
|
3
|
+
* environment variable, a mounted file, a vault entry) is that source's business.
|
|
4
|
+
*/
|
|
5
|
+
export declare const SECRET_NAMES: readonly ["TEAMS_ENCRYPTION_KEYS", "TEAMS_EXCHANGE_CLIENT_SECRET", "FEEDBACK_GITHUB_APP_KEY"];
|
|
6
|
+
export type SecretName = (typeof SECRET_NAMES)[number];
|
|
7
|
+
/** The sources a deployment may name in SECRETS_SOURCE. */
|
|
8
|
+
export declare const SECRETS_SOURCES: readonly ["env", "keyvault"];
|
|
9
|
+
export type SecretsSourceName = (typeof SECRETS_SOURCES)[number];
|
|
10
|
+
/** A secret could not be read. The message names the secret and the reason, never a value. */
|
|
11
|
+
export declare class SecretsUnavailable extends Error {
|
|
12
|
+
readonly name = "SecretsUnavailable";
|
|
13
|
+
}
|
|
14
|
+
export interface SecretSource {
|
|
15
|
+
readonly name: SecretsSourceName;
|
|
16
|
+
/**
|
|
17
|
+
* Every one of `names`, read once at start and kept in memory only; throws SecretsUnavailable when one cannot be read
|
|
18
|
+
* (the worker stops before it takes a message: it never runs with a missing or stale secret).
|
|
19
|
+
*/
|
|
20
|
+
load(names: readonly SecretName[]): Promise<ReadonlyMap<SecretName, string>>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** Tool approvals pushed to a chat (table `approvals`): one approval is one card, whichever way it arrives. */
|
|
2
|
+
import type { JsonObject } from "./json.js";
|
|
3
|
+
export type ApprovalState = "pending" | "approved" | "denied" | "expired" | (string & {});
|
|
4
|
+
export interface Approval {
|
|
5
|
+
readonly sessionId: string;
|
|
6
|
+
readonly toolUseId: string;
|
|
7
|
+
readonly userId: string;
|
|
8
|
+
readonly tool: string;
|
|
9
|
+
readonly expiresAt: number;
|
|
10
|
+
readonly state: ApprovalState;
|
|
11
|
+
}
|
|
12
|
+
/** An approval card that was recorded and never reached the chat: what it takes to send it again. */
|
|
13
|
+
export interface UnsentCard {
|
|
14
|
+
readonly sessionId: string;
|
|
15
|
+
readonly toolUseId: string;
|
|
16
|
+
readonly userId: string;
|
|
17
|
+
readonly expiresAt: number;
|
|
18
|
+
readonly envelope: JsonObject;
|
|
19
|
+
}
|
|
20
|
+
export interface NewApproval {
|
|
21
|
+
readonly userId: string;
|
|
22
|
+
readonly sessionId: string;
|
|
23
|
+
readonly toolUseId: string;
|
|
24
|
+
readonly tool: string;
|
|
25
|
+
readonly expiresAt: number;
|
|
26
|
+
/** The card as it will be published, kept until `approvalSent` so a worker that dies before the send leaves it to the next. */
|
|
27
|
+
readonly envelope?: JsonObject | null;
|
|
28
|
+
}
|
|
29
|
+
export interface ApprovalRepository {
|
|
30
|
+
/** True when this call recorded it; false when a card for the same approval was recorded before. */
|
|
31
|
+
saveApproval(approval: NewApproval): boolean;
|
|
32
|
+
/** The card reached the chat: nothing is left to send. */
|
|
33
|
+
approvalSent(sessionId: string, toolUseId: string): void;
|
|
34
|
+
/** Its card is being sent right now by this process and may still fail. */
|
|
35
|
+
approvalInFlight(sessionId: string, toolUseId: string): boolean;
|
|
36
|
+
/** The card never reached the chat: take the record back (a row answered meanwhile stays). */
|
|
37
|
+
forgetApproval(sessionId: string, toolUseId: string): void;
|
|
38
|
+
/** Cards recorded and never sent, each marked in flight; ones out of time are closed as expired instead. */
|
|
39
|
+
claimUnsentApprovals(): UnsentCard[];
|
|
40
|
+
/** A claimed card could not be sent: the next sweep tries again. */
|
|
41
|
+
approvalSendFailed(sessionId: string, toolUseId: string): void;
|
|
42
|
+
getApproval(sessionId: string, toolUseId: string): Approval | null;
|
|
43
|
+
/** Move an approval to `state`; true if this call did it (only from 'pending' unless `onlyIfPending` is false). */
|
|
44
|
+
closeApproval(sessionId: string, toolUseId: string, state: ApprovalState, options?: {
|
|
45
|
+
readonly onlyIfPending?: boolean;
|
|
46
|
+
}): boolean;
|
|
47
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cards and messages of the assistant (tables `assistant_cards`, `auto_replies`, `assistant_action_cards`,
|
|
3
|
+
* `assistant_confirm_cards`, `assistant_messages`). A card's buttons carry only its id; what a press means is read
|
|
4
|
+
* from here, so a forged, old or someone else's card changes nothing.
|
|
5
|
+
*/
|
|
6
|
+
import type { JsonObject } from "./json.js";
|
|
7
|
+
/** 'open', 'busy' (a press is being carried out), 'done', or (work-item cards) 'ended'. */
|
|
8
|
+
export type CardState = "open" | "busy" | "done" | "ended" | (string & {});
|
|
9
|
+
export interface MoveOptions {
|
|
10
|
+
/** Only a card in this state moves, so of two presses exactly one is carried out. */
|
|
11
|
+
readonly onlyFrom?: CardState | null;
|
|
12
|
+
}
|
|
13
|
+
/** A card for result `version` of a work item. */
|
|
14
|
+
export interface AssistantCard {
|
|
15
|
+
readonly cardId: string;
|
|
16
|
+
readonly userId: string;
|
|
17
|
+
readonly itemId: string;
|
|
18
|
+
readonly version: number;
|
|
19
|
+
/** It has an Accept button (a result waits); else only Stop. */
|
|
20
|
+
readonly canAccept: boolean;
|
|
21
|
+
readonly state: CardState;
|
|
22
|
+
readonly createdAt: number;
|
|
23
|
+
/** How the item ended, as the card shows it (state 'ended'). */
|
|
24
|
+
readonly ended: string;
|
|
25
|
+
}
|
|
26
|
+
/** An open work-item card that went out and can be edited. */
|
|
27
|
+
export interface PlacedCard {
|
|
28
|
+
readonly cardId: string;
|
|
29
|
+
readonly userId: string;
|
|
30
|
+
readonly itemId: string;
|
|
31
|
+
readonly activityId: string;
|
|
32
|
+
readonly reference: JsonObject;
|
|
33
|
+
readonly render: JsonObject;
|
|
34
|
+
readonly createdAt: number;
|
|
35
|
+
}
|
|
36
|
+
/** A button for one of the assistant's own commands (`/{name} {args}`). */
|
|
37
|
+
export interface ActionCard {
|
|
38
|
+
readonly cardId: string;
|
|
39
|
+
readonly userId: string;
|
|
40
|
+
/** The message the assistant answered: the action must be one that message declared. */
|
|
41
|
+
readonly channelMessageId: string;
|
|
42
|
+
readonly name: string;
|
|
43
|
+
readonly args: string;
|
|
44
|
+
readonly state: CardState;
|
|
45
|
+
readonly createdAt: number;
|
|
46
|
+
}
|
|
47
|
+
/** A card for a write Claw holds until the person answers. */
|
|
48
|
+
export interface ConfirmCard {
|
|
49
|
+
readonly cardId: string;
|
|
50
|
+
readonly userId: string;
|
|
51
|
+
readonly confirmationId: string;
|
|
52
|
+
/** trigger_create | trigger_cancel | devenv_send | github_comment */
|
|
53
|
+
readonly kind: string;
|
|
54
|
+
/** What the button that lets it through says. */
|
|
55
|
+
readonly label: string;
|
|
56
|
+
readonly state: CardState;
|
|
57
|
+
readonly createdAt: number;
|
|
58
|
+
}
|
|
59
|
+
export interface AssistantMessage {
|
|
60
|
+
readonly userId: string;
|
|
61
|
+
/** The actions (and handoffs) the message declared. */
|
|
62
|
+
readonly actions: ReadonlySet<string>;
|
|
63
|
+
}
|
|
64
|
+
export interface AssistantCardRepository {
|
|
65
|
+
/** Record a card before it is sent; the id is all its buttons carry. */
|
|
66
|
+
addAssistantCard(userId: string, itemId: string, version: number, canAccept: boolean): string;
|
|
67
|
+
getAssistantCard(cardId: string): AssistantCard | null;
|
|
68
|
+
/** An open card moves to 'ended'; true if this call moved it. */
|
|
69
|
+
endAssistantCard(cardId: string, ended: string): boolean;
|
|
70
|
+
/** The card went out as the channel message `activityId` in `reference`, showing `render`. */
|
|
71
|
+
placeAssistantCard(cardId: string, placement: {
|
|
72
|
+
readonly activityId: string;
|
|
73
|
+
readonly reference: JsonObject;
|
|
74
|
+
readonly render: JsonObject;
|
|
75
|
+
}): void;
|
|
76
|
+
/** Open, posted cards: of `itemId`, or (none given) all posted since `since`, oldest first. */
|
|
77
|
+
placedAssistantCards(filter: {
|
|
78
|
+
readonly itemId: string;
|
|
79
|
+
} | {
|
|
80
|
+
readonly since?: number;
|
|
81
|
+
}): PlacedCard[];
|
|
82
|
+
moveAssistantCard(cardId: string, state: CardState, options?: MoveOptions): boolean;
|
|
83
|
+
/** Automatic replies were turned on for `itemId` on `pull`. */
|
|
84
|
+
setAutoReply(userId: string, itemId: string, pull: string): void;
|
|
85
|
+
autoReply(userId: string, itemId: string): string | null;
|
|
86
|
+
clearAutoReply(userId: string, itemId: string): void;
|
|
87
|
+
}
|
|
88
|
+
export interface AssistantButtonRepository {
|
|
89
|
+
addActionCard(userId: string, channelMessageId: string, name: string, args: string): string;
|
|
90
|
+
/** Null once it is older than ASSISTANT_MESSAGE_KEEP_SECONDS. */
|
|
91
|
+
getActionCard(cardId: string): ActionCard | null;
|
|
92
|
+
moveActionCard(cardId: string, state: CardState, options?: MoveOptions): boolean;
|
|
93
|
+
addConfirmCard(userId: string, confirmationId: string, kind: string, label?: string): string;
|
|
94
|
+
/** Null once it is older than CONFIRM_CARD_KEEP_SECONDS. */
|
|
95
|
+
getConfirmCard(cardId: string): ConfirmCard | null;
|
|
96
|
+
moveConfirmCard(cardId: string, state: CardState, options?: MoveOptions): boolean;
|
|
97
|
+
}
|
|
98
|
+
export interface AssistantMessageRepository {
|
|
99
|
+
/** A message this worker sent to the person's assistant, with the actions it declared and the Claw users it named. */
|
|
100
|
+
noteAssistantMessage(channelMessageId: string, userId: string, actions: readonly string[], people?: readonly string[]): void;
|
|
101
|
+
/** The Claw user ids the message named, while it is kept (empty otherwise). */
|
|
102
|
+
assistantMessagePeople(channelMessageId: string): ReadonlySet<string>;
|
|
103
|
+
assistantMessage(channelMessageId: string): AssistantMessage | null;
|
|
104
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feedback (tables `feedback_reports`, `feedback_asks`, `feedback_offers`, `feedback_prompts`). A report is written
|
|
3
|
+
* before anything is sent to GitHub, so one that cannot be delivered yet is never lost.
|
|
4
|
+
*/
|
|
5
|
+
import type { IssueRef } from "../../plugins/feedback-sink.js";
|
|
6
|
+
export interface FeedbackReport {
|
|
7
|
+
readonly id: number;
|
|
8
|
+
readonly userId: string;
|
|
9
|
+
readonly scope: string;
|
|
10
|
+
readonly sessionId: string;
|
|
11
|
+
readonly text: string;
|
|
12
|
+
readonly scene: string;
|
|
13
|
+
readonly createdAt: number;
|
|
14
|
+
/** 'pending' (not yet in GitHub) or 'filed'. */
|
|
15
|
+
readonly state: "pending" | "filed" | (string & {});
|
|
16
|
+
readonly issueNumber: number | null;
|
|
17
|
+
readonly issueUrl: string;
|
|
18
|
+
/** Filed as a comment on an earlier report's issue. */
|
|
19
|
+
readonly asComment: boolean;
|
|
20
|
+
readonly attempts: number;
|
|
21
|
+
readonly nextAttemptAt: number;
|
|
22
|
+
readonly lastError: string;
|
|
23
|
+
readonly reporterName: string;
|
|
24
|
+
readonly reporterEmail: string;
|
|
25
|
+
}
|
|
26
|
+
export interface NewFeedbackReport {
|
|
27
|
+
readonly userId: string;
|
|
28
|
+
readonly scope: string;
|
|
29
|
+
readonly sessionId: string;
|
|
30
|
+
readonly text: string;
|
|
31
|
+
readonly scene: string;
|
|
32
|
+
readonly reporterName?: string;
|
|
33
|
+
readonly reporterEmail?: string;
|
|
34
|
+
}
|
|
35
|
+
export type FeedbackOfferState = "open" | "sending" | "done" | "declined" | (string & {});
|
|
36
|
+
export interface FeedbackOffer {
|
|
37
|
+
readonly offerId: string;
|
|
38
|
+
readonly userId: string;
|
|
39
|
+
readonly issueNumber: number;
|
|
40
|
+
readonly sessionId: string;
|
|
41
|
+
readonly turnId: string;
|
|
42
|
+
readonly createdAt: number;
|
|
43
|
+
readonly state: FeedbackOfferState;
|
|
44
|
+
}
|
|
45
|
+
export interface FeedbackPrompt {
|
|
46
|
+
readonly promptId: string;
|
|
47
|
+
/** The person whose message went wrong: in a group, the only one who may press the button. */
|
|
48
|
+
readonly userId: string;
|
|
49
|
+
/** '' for the 1:1 chat, the conversation id for a group. */
|
|
50
|
+
readonly scope: string;
|
|
51
|
+
readonly createdAt: number;
|
|
52
|
+
}
|
|
53
|
+
export interface FeedbackRepository {
|
|
54
|
+
/** Returns the new report's id. */
|
|
55
|
+
addFeedbackReport(report: NewFeedbackReport): number;
|
|
56
|
+
getFeedbackReport(reportId: number): FeedbackReport | null;
|
|
57
|
+
/** The issue of the newest filed report of the same person, chat and session within FEEDBACK_DEDUPE_SECONDS. */
|
|
58
|
+
feedbackTarget(report: FeedbackReport): IssueRef | null;
|
|
59
|
+
markFeedbackFiled(reportId: number, issue: IssueRef, asComment: boolean): void;
|
|
60
|
+
/** `error` is kept to 80 characters. */
|
|
61
|
+
markFeedbackFailed(reportId: number, error: string, retryAt: number): void;
|
|
62
|
+
/** Undelivered reports whose retry time has come, oldest first. */
|
|
63
|
+
dueFeedback(limit: number): FeedbackReport[];
|
|
64
|
+
pendingFeedbackCount(): number;
|
|
65
|
+
/** A bare /feedback: the person's next message in this chat is the report. */
|
|
66
|
+
openFeedbackAsk(userId: string, scope: string): void;
|
|
67
|
+
/** True (and closed) when an unexpired ask is open. */
|
|
68
|
+
takeFeedbackAsk(userId: string, scope: string): boolean;
|
|
69
|
+
hasFeedbackAsk(userId: string, scope: string): boolean;
|
|
70
|
+
addFeedbackOffer(userId: string, issueNumber: number, sessionId: string, turnId: string): string;
|
|
71
|
+
getFeedbackOffer(offerId: string): FeedbackOffer | null;
|
|
72
|
+
/** `onlyFrom` defaults to 'open'; null moves from any state. */
|
|
73
|
+
moveFeedbackOffer(offerId: string, state: FeedbackOfferState, options?: {
|
|
74
|
+
readonly onlyFrom?: FeedbackOfferState | null;
|
|
75
|
+
}): boolean;
|
|
76
|
+
/** A "Report a problem" button; its owner is kept here, not on the card. */
|
|
77
|
+
addFeedbackPrompt(userId: string, scope: string): string;
|
|
78
|
+
/** Null once older than FEEDBACK_PROMPT_TTL_SECONDS. */
|
|
79
|
+
getFeedbackPrompt(promptId: string): FeedbackPrompt | null;
|
|
80
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/** GitHub review delegation: held writes, sessions that act as someone, followed reviews and rationed notices
|
|
2
|
+
* (tables `github_confirmations`, `acting_sessions`, `review_notices`, `asker_follows`, `github_notices`). */
|
|
3
|
+
import type { JsonObject } from "./json.js";
|
|
4
|
+
export type ConfirmationState = "pending" | "sending" | "done" | (string & {});
|
|
5
|
+
/** A write that waits for the person the review acts for. A click is checked against this row, never the card. */
|
|
6
|
+
export interface GithubConfirmation {
|
|
7
|
+
/** Claw's id. */
|
|
8
|
+
readonly confirmationId: string;
|
|
9
|
+
readonly sessionId: string;
|
|
10
|
+
/** The only person who may answer. */
|
|
11
|
+
readonly actorId: string;
|
|
12
|
+
readonly requesterId: string;
|
|
13
|
+
readonly repo: string;
|
|
14
|
+
readonly pr: number;
|
|
15
|
+
readonly reference: JsonObject;
|
|
16
|
+
readonly expiresAt: number;
|
|
17
|
+
readonly state: ConfirmationState;
|
|
18
|
+
readonly createdAt: number;
|
|
19
|
+
/** 'merge', or 'review'. */
|
|
20
|
+
readonly kind: string;
|
|
21
|
+
/** Of a review: APPROVE, REQUEST_CHANGES or COMMENT; '' for a merge. */
|
|
22
|
+
readonly event: string;
|
|
23
|
+
}
|
|
24
|
+
export type NewGithubConfirmation = Omit<GithubConfirmation, "state" | "createdAt" | "kind" | "event"> & {
|
|
25
|
+
readonly kind?: string;
|
|
26
|
+
readonly event?: string;
|
|
27
|
+
};
|
|
28
|
+
export interface GithubConfirmationRepository {
|
|
29
|
+
/** False when it is already recorded (the same one is never sent twice). */
|
|
30
|
+
addGithubConfirmation(confirmation: NewGithubConfirmation): boolean;
|
|
31
|
+
getGithubConfirmation(confirmationId: string): GithubConfirmation | null;
|
|
32
|
+
/** Still waiting for this person's answer, oldest first. */
|
|
33
|
+
pendingGithubConfirmations(actorId: string): GithubConfirmation[];
|
|
34
|
+
/** False when it was not in `onlyFrom` (default 'pending'). */
|
|
35
|
+
moveGithubConfirmation(confirmationId: string, state: ConfirmationState, options?: {
|
|
36
|
+
readonly onlyFrom?: ConfirmationState;
|
|
37
|
+
}): boolean;
|
|
38
|
+
/** The card could not be sent: a pending row goes. */
|
|
39
|
+
forgetGithubConfirmation(confirmationId: string): void;
|
|
40
|
+
}
|
|
41
|
+
export interface ReviewNotice {
|
|
42
|
+
readonly sessionId: string;
|
|
43
|
+
readonly actorId: string;
|
|
44
|
+
readonly requesterId: string;
|
|
45
|
+
readonly pull: string;
|
|
46
|
+
readonly delivered: boolean;
|
|
47
|
+
readonly reason: string;
|
|
48
|
+
}
|
|
49
|
+
export interface AskerFollow {
|
|
50
|
+
readonly itemId: string;
|
|
51
|
+
readonly batchId: string;
|
|
52
|
+
readonly review: unknown;
|
|
53
|
+
readonly reference: unknown;
|
|
54
|
+
readonly said: string;
|
|
55
|
+
readonly reviewerTold: boolean;
|
|
56
|
+
readonly deadline: number;
|
|
57
|
+
}
|
|
58
|
+
export interface ReviewDelegationRepository {
|
|
59
|
+
/** A session that acts as another person (a review for a colleague). */
|
|
60
|
+
noteActingSession(sessionId: string, requesterId: string, actorId: string): void;
|
|
61
|
+
isActingSession(sessionId: string): boolean;
|
|
62
|
+
/** The audit of the notice a reviewer is sent after something was left on GitHub as them. */
|
|
63
|
+
noteReviewNotice(notice: ReviewNotice): void;
|
|
64
|
+
/** In the order written. */
|
|
65
|
+
reviewNotices(): ReviewNotice[];
|
|
66
|
+
addAskerFollow(follow: {
|
|
67
|
+
readonly itemId: string;
|
|
68
|
+
readonly batchId: string;
|
|
69
|
+
readonly review: JsonObject;
|
|
70
|
+
readonly reference: JsonObject;
|
|
71
|
+
readonly deadline: number;
|
|
72
|
+
}): void;
|
|
73
|
+
/** Oldest first. */
|
|
74
|
+
askerFollows(): AskerFollow[];
|
|
75
|
+
askerFollowSaid(itemId: string, said: string): void;
|
|
76
|
+
askerFollowReviewerTold(itemId: string): void;
|
|
77
|
+
dropAskerFollow(itemId: string): void;
|
|
78
|
+
/** One notice of this kind per person per `interval` seconds. */
|
|
79
|
+
claimGithubNotice(userId: string, kind: string, interval: number): boolean;
|
|
80
|
+
releaseGithubNotice(userId: string, kind: string): void;
|
|
81
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Work done at most once: activity ids and Claw events (tables `processed`, `event_claims`). */
|
|
2
|
+
export type EventClaim = {
|
|
3
|
+
readonly state: "claimed";
|
|
4
|
+
readonly holder: string;
|
|
5
|
+
} | {
|
|
6
|
+
readonly state: "done" | "busy";
|
|
7
|
+
readonly holder: "";
|
|
8
|
+
};
|
|
9
|
+
export interface IdempotencyRepository {
|
|
10
|
+
/** Marks `activityId` processed; true only for the one caller that marked it. */
|
|
11
|
+
claimProcessed(activityId: string): boolean;
|
|
12
|
+
/** Claim a Claw event for sending; of any number of copies on the same store, one is sent. */
|
|
13
|
+
claimEvent(key: string): EventClaim;
|
|
14
|
+
/** The event reached the chat: every later copy is a duplicate for PROCESSED_TTL_SECONDS. */
|
|
15
|
+
finishEvent(key: string): void;
|
|
16
|
+
/** The send failed or was put off: only the claim `holder` took is let go. */
|
|
17
|
+
releaseEvent(key: string, holder: string): void;
|
|
18
|
+
seen(activityId: string): boolean;
|
|
19
|
+
/** Also prunes expired processed ids, pending requests and delivered reports. */
|
|
20
|
+
markProcessed(activityId: string): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The store port: durable state as repositories grouped by aggregate. One implementation (runtime's SQLite store)
|
|
3
|
+
* keeps all of them in one database file whose tables and columns are the Python worker's, so either worker can open it.
|
|
4
|
+
*
|
|
5
|
+
* Naming: `userId` is the person's stable channel id (the Entra object id on Teams, column `aad_id`); `clawUserId` is
|
|
6
|
+
* the Claw account a link records; `channelUserId` is the channel's own user id (Teams' `29:` id). Times are epoch
|
|
7
|
+
* seconds from the injected clock.
|
|
8
|
+
*
|
|
9
|
+
* Every method is synchronous: the store is local and each method is one indivisible step, which is what the
|
|
10
|
+
* check-then-write methods (`redeemPending`, `claimEvent`, `move*` with `onlyFrom`) rely on.
|
|
11
|
+
*/
|
|
12
|
+
import type { ApprovalRepository } from "./approvals.js";
|
|
13
|
+
import type { AssistantButtonRepository, AssistantCardRepository, AssistantMessageRepository } from "./assistant.js";
|
|
14
|
+
import type { FeedbackRepository } from "./feedback.js";
|
|
15
|
+
import type { GithubConfirmationRepository, ReviewDelegationRepository } from "./github.js";
|
|
16
|
+
import type { IdempotencyRepository } from "./idempotency.js";
|
|
17
|
+
import type { LinkRepository } from "./link.js";
|
|
18
|
+
import type { NotifySubscriptionRepository } from "./notify.js";
|
|
19
|
+
import type { ObserveRepository } from "./observe.js";
|
|
20
|
+
import type { OnboardingRepository } from "./onboarding.js";
|
|
21
|
+
import type { ConversationRefRepository, HeldEventRepository, MemberDirectoryRepository, PrefsRepository } from "./people.js";
|
|
22
|
+
import type { RemotePermissionRepository, RemoteSessionNameRepository, RemoteStateRepository } from "./remote.js";
|
|
23
|
+
import type { RepoHistoryRepository, SessionRepository } from "./sessions.js";
|
|
24
|
+
import type { TurnAnswerRepository } from "./turns.js";
|
|
25
|
+
export interface StorePort {
|
|
26
|
+
readonly links: LinkRepository;
|
|
27
|
+
readonly references: ConversationRefRepository;
|
|
28
|
+
readonly prefs: PrefsRepository;
|
|
29
|
+
readonly held: HeldEventRepository;
|
|
30
|
+
readonly members: MemberDirectoryRepository;
|
|
31
|
+
readonly notifySubs: NotifySubscriptionRepository;
|
|
32
|
+
readonly approvals: ApprovalRepository;
|
|
33
|
+
readonly observe: ObserveRepository;
|
|
34
|
+
readonly assistantCards: AssistantCardRepository;
|
|
35
|
+
readonly assistantButtons: AssistantButtonRepository;
|
|
36
|
+
readonly assistantMessages: AssistantMessageRepository;
|
|
37
|
+
readonly remoteState: RemoteStateRepository;
|
|
38
|
+
readonly remoteSessionNames: RemoteSessionNameRepository;
|
|
39
|
+
readonly remotePermissions: RemotePermissionRepository;
|
|
40
|
+
readonly sessions: SessionRepository;
|
|
41
|
+
readonly repoHistory: RepoHistoryRepository;
|
|
42
|
+
readonly turns: TurnAnswerRepository;
|
|
43
|
+
readonly feedback: FeedbackRepository;
|
|
44
|
+
readonly onboarding: OnboardingRepository;
|
|
45
|
+
readonly githubConfirmations: GithubConfirmationRepository;
|
|
46
|
+
readonly reviewDelegation: ReviewDelegationRepository;
|
|
47
|
+
readonly idempotency: IdempotencyRepository;
|
|
48
|
+
/** The store's clock, in epoch seconds. */
|
|
49
|
+
now(): number;
|
|
50
|
+
}
|
|
51
|
+
export type * from "./approvals.js";
|
|
52
|
+
export type * from "./assistant.js";
|
|
53
|
+
export type * from "./feedback.js";
|
|
54
|
+
export type * from "./github.js";
|
|
55
|
+
export type * from "./idempotency.js";
|
|
56
|
+
export type * from "./link.js";
|
|
57
|
+
export type * from "./notify.js";
|
|
58
|
+
export type * from "./observe.js";
|
|
59
|
+
export type * from "./onboarding.js";
|
|
60
|
+
export type * from "./people.js";
|
|
61
|
+
export type * from "./remote.js";
|
|
62
|
+
export type * from "./sessions.js";
|
|
63
|
+
export type * from "./turns.js";
|
|
64
|
+
export { isJsonObject } from "./json.js";
|
|
65
|
+
export * from "./policy.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { JsonObject } from "../../json.js";
|
|
2
|
+
export type { JsonObject };
|
|
3
|
+
/** A JSON object as opposed to an array or a scalar (what a `*_json` column of an object holds when it is well formed). */
|
|
4
|
+
export declare function isJsonObject(value: unknown): value is JsonObject;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account links: the SaFE key a person linked from the console with a short `/link` code (tables `links`,
|
|
3
|
+
* `pending_keys`, `link_attempts`). Keys are encrypted at rest; codes are kept only as a keyed hash.
|
|
4
|
+
*/
|
|
5
|
+
/** How many wrong `/link` codes are allowed in `windowSeconds`: per person, and of all people together. */
|
|
6
|
+
export interface LinkLimits {
|
|
7
|
+
readonly perUser: number;
|
|
8
|
+
readonly global: number;
|
|
9
|
+
readonly windowSeconds: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The answer to a typed code: `invalid` is one answer for wrong, expired and used codes; `limited` (this person has too
|
|
13
|
+
* many wrong codes in the window) and `global_limit` (everyone together has) refuse even a correct code.
|
|
14
|
+
*/
|
|
15
|
+
export type RedeemOutcome = "ok" | "invalid" | "limited" | "global_limit";
|
|
16
|
+
export interface LinkRepository {
|
|
17
|
+
/** Hold a key the console just minted under a fresh code and return the code. Nothing a chat sends can create one. */
|
|
18
|
+
stashPending(key: string): string;
|
|
19
|
+
/** How long a wrong code counts against its person and everyone. */
|
|
20
|
+
readonly linkWindowSeconds: number;
|
|
21
|
+
/** Bind the pending key of `code` to the person who typed it. Spaces are ignored and case does not matter. */
|
|
22
|
+
redeemPending(userId: string, name: string, code: string, activityId?: string): RedeemOutcome;
|
|
23
|
+
/** Delete the pending keys nobody redeemed in time and return them, so the caller can revoke them. */
|
|
24
|
+
takeExpiredPending(): string[];
|
|
25
|
+
/** The key of exactly this person; there is no fallback to any other key. */
|
|
26
|
+
getKey(userId: string): string | null;
|
|
27
|
+
/** Forget the person's link and everything kept for them that a key is needed for. */
|
|
28
|
+
unlink(userId: string): void;
|
|
29
|
+
/** The Claw user id of the account the person is linked to. */
|
|
30
|
+
setClawUserId(userId: string, clawUserId: string): void;
|
|
31
|
+
/** Linked before the Claw user id was kept (or the lookup failed at link time). */
|
|
32
|
+
needsClawUserId(userId: string): boolean;
|
|
33
|
+
clawUserIdOf(userId: string): string | null;
|
|
34
|
+
/** Every linked person, in a stable order. */
|
|
35
|
+
linkedUsers(): string[];
|
|
36
|
+
userForClawUser(clawUserId: string): string | null;
|
|
37
|
+
/** Every person whose link records this Claw user (one, normally). */
|
|
38
|
+
usersForClawUser(clawUserId: string): string[];
|
|
39
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-person notification subscriptions (tables `notify_subs`, `notify_sub_attempts`). Claw signs a subscription's
|
|
3
|
+
* events with its own secret and names neither the subscription nor the person, so each person gets a URL with a
|
|
4
|
+
* random route token of its own, and the token finds the secret (encrypted at rest) and the person.
|
|
5
|
+
*/
|
|
6
|
+
export interface NotifySubscription {
|
|
7
|
+
readonly route: string;
|
|
8
|
+
readonly subscriptionId: string;
|
|
9
|
+
}
|
|
10
|
+
export interface NotifyRoute {
|
|
11
|
+
readonly userId: string;
|
|
12
|
+
readonly secret: string;
|
|
13
|
+
}
|
|
14
|
+
export interface NotifySubscriptionRepository {
|
|
15
|
+
saveNotifySub(userId: string, sub: NotifySubscription & {
|
|
16
|
+
readonly secret: string;
|
|
17
|
+
readonly typesVersion?: number;
|
|
18
|
+
}): void;
|
|
19
|
+
/** Which set of event types the subscription was made or changed for (0: the original two); null: none. */
|
|
20
|
+
notifyTypesVersion(userId: string): number | null;
|
|
21
|
+
setNotifyTypesVersion(userId: string, typesVersion: number): void;
|
|
22
|
+
getNotifySub(userId: string): NotifySubscription | null;
|
|
23
|
+
/** Null when the route is unknown or its secret cannot be decrypted. */
|
|
24
|
+
notifySubByRoute(route: string): NotifyRoute | null;
|
|
25
|
+
forgetNotifySub(userId: string): void;
|
|
26
|
+
/** True (and the attempt is recorded) when none was made in the last `minInterval` seconds. */
|
|
27
|
+
claimNotifyAttempt(userId: string, minInterval: number): boolean;
|
|
28
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** Group chats the assistant observes, and the suggestions shown on /board (tables `observed_groups`, `observe_cards`). */
|
|
2
|
+
import type { JsonObject } from "./json.js";
|
|
3
|
+
export interface GroupObserver {
|
|
4
|
+
readonly userId: string;
|
|
5
|
+
readonly scope: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ObservedGroup {
|
|
8
|
+
readonly conversationId: string;
|
|
9
|
+
readonly scope: string;
|
|
10
|
+
readonly name: string;
|
|
11
|
+
/** Observing is on now. */
|
|
12
|
+
readonly on: boolean;
|
|
13
|
+
}
|
|
14
|
+
export type ObserveCardState = "open" | "busy" | "accepted" | "dismissed" | "unsure" | (string & {});
|
|
15
|
+
export interface ObserveCard {
|
|
16
|
+
readonly cardId: string;
|
|
17
|
+
readonly userId: string;
|
|
18
|
+
readonly conversationId: string;
|
|
19
|
+
readonly runId: string;
|
|
20
|
+
readonly seq: number;
|
|
21
|
+
readonly tool: string;
|
|
22
|
+
readonly args: string;
|
|
23
|
+
readonly message: string;
|
|
24
|
+
readonly state: ObserveCardState;
|
|
25
|
+
}
|
|
26
|
+
export interface NewObserveCard {
|
|
27
|
+
readonly userId: string;
|
|
28
|
+
readonly conversationId: string;
|
|
29
|
+
readonly runId: string;
|
|
30
|
+
readonly seq: number;
|
|
31
|
+
readonly tool: string;
|
|
32
|
+
readonly args: string;
|
|
33
|
+
readonly message: string;
|
|
34
|
+
}
|
|
35
|
+
export interface ObserveRepository {
|
|
36
|
+
/** `/observe on`: one observer per group, the last to turn it on. `name` is kept to 200 characters. */
|
|
37
|
+
observeGroup(conversationId: string, observer: GroupObserver & {
|
|
38
|
+
readonly reference: JsonObject;
|
|
39
|
+
readonly name?: string;
|
|
40
|
+
}): void;
|
|
41
|
+
/** `/observe off`: returns whose observer it was, or null when it was not on. The row stays for /board. */
|
|
42
|
+
unobserveGroup(conversationId: string): string | null;
|
|
43
|
+
groupObserver(conversationId: string): GroupObserver | null;
|
|
44
|
+
/** Every group this person turned observing on in, newest first. */
|
|
45
|
+
observedBy(userId: string): ObservedGroup[];
|
|
46
|
+
observedReference(conversationId: string): JsonObject | null;
|
|
47
|
+
addObserveCard(card: NewObserveCard): string;
|
|
48
|
+
getObserveCard(cardId: string): ObserveCard | null;
|
|
49
|
+
/** Accepted, dismissed or unsure already (on any card of it): not offered again. */
|
|
50
|
+
observeSuggestionSettled(userId: string, runId: string, seq: number): boolean;
|
|
51
|
+
/** With `onlyFrom`, of two presses on one suggestion only one moves it; 'busy' also refuses a suggestion already in hand. */
|
|
52
|
+
moveObserveCard(cardId: string, state: ObserveCardState, onlyFrom?: ObserveCardState): boolean;
|
|
53
|
+
}
|