@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,394 @@
|
|
|
1
|
+
import type { JsonObject } from "../json.js";
|
|
2
|
+
import type { Result } from "../result.js";
|
|
3
|
+
/**
|
|
4
|
+
* The chat channel, as core sees it. A channel adapter (Microsoft Teams in `@primusclaw/personal-agent-teams`) turns
|
|
5
|
+
* what its platform delivers into `InboundEvent`s and implements `Surface` to post back; core never sees an activity,
|
|
6
|
+
* a card's JSON or a Bot Connector envelope.
|
|
7
|
+
*
|
|
8
|
+
* Shapes follow the Python worker's `messenger.Messenger` (one conversation's outbound operations) and
|
|
9
|
+
* `activity.py` (what is read from an inbound activity). Identifiers on the wire and in storage keep their spelling;
|
|
10
|
+
* these names are core's.
|
|
11
|
+
*/
|
|
12
|
+
/** The kinds of conversation core tells apart: a 1:1 chat with the bot, a group chat, a channel of a team. */
|
|
13
|
+
export type ConversationKind = "personal" | "group" | "channel";
|
|
14
|
+
/**
|
|
15
|
+
* A person on the channel. `id` is the person's stable directory id (Teams: the Entra object id, stored as `aad_id`);
|
|
16
|
+
* `channelUserId` is the channel's own id of them in this bot's conversations (Teams: the "29:..." id).
|
|
17
|
+
*/
|
|
18
|
+
export interface UserRef {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly channelUserId: string;
|
|
21
|
+
/** The display name the channel gave, as given ("" when none). */
|
|
22
|
+
readonly name: string;
|
|
23
|
+
/** Only when the channel supplied one (never looked up); "" otherwise. */
|
|
24
|
+
readonly email: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Where to post. Core reads `id`, `kind` and `tenantId`; `wire` is the channel's own reference (Teams: the Bot
|
|
28
|
+
* Framework conversation reference that `activity.reference_of` built), kept and handed back unchanged. It is what the
|
|
29
|
+
* store persists for proactive messages, so its JSON stays byte-for-byte what the Python worker stored.
|
|
30
|
+
*/
|
|
31
|
+
export interface ConversationRef {
|
|
32
|
+
readonly id: string;
|
|
33
|
+
readonly kind: ConversationKind;
|
|
34
|
+
/** The organisation the conversation belongs to ("" when the channel has none). */
|
|
35
|
+
readonly tenantId: string;
|
|
36
|
+
readonly wire: Readonly<Record<string, unknown>>;
|
|
37
|
+
}
|
|
38
|
+
/** The id the channel gave a message the bot posted (Teams: the activity id). */
|
|
39
|
+
export type MessageId = string;
|
|
40
|
+
/** One event a channel delivers that core acts on. Everything else (typing, installs, delivery acks) stays in the adapter. */
|
|
41
|
+
export type InboundEvent = InboundMessage | InboundAction | InboundVote;
|
|
42
|
+
/** Where an inbound message came from when not from the person's own typing. */
|
|
43
|
+
export type Provenance = "typed" | "on_behalf";
|
|
44
|
+
interface InboundBase {
|
|
45
|
+
/** The channel's id of the event; processing is idempotent per id ("" when the channel gave none). */
|
|
46
|
+
readonly id: string;
|
|
47
|
+
readonly sender: UserRef;
|
|
48
|
+
readonly conversation: ConversationRef;
|
|
49
|
+
/** The locale of the person's client ("" when not said), e.g. "zh-CN". */
|
|
50
|
+
readonly locale: string;
|
|
51
|
+
/**
|
|
52
|
+
* The client the person used ("Windows", "Mac", "Web", "iOS", "Android"; "" when not said), letters and digits only,
|
|
53
|
+
* at most 16 (Python `activity.client_platform`).
|
|
54
|
+
*/
|
|
55
|
+
readonly clientPlatform: string;
|
|
56
|
+
}
|
|
57
|
+
/** A link in a message: its address and the text it was shown with. */
|
|
58
|
+
export interface InboundLink {
|
|
59
|
+
readonly url: string;
|
|
60
|
+
readonly title: string;
|
|
61
|
+
}
|
|
62
|
+
/** A message the person quoted or replied to. */
|
|
63
|
+
export interface InboundQuote {
|
|
64
|
+
/** The channel's id of the quoted message ("" when not said): tells whether a reply quotes a card the bot posted. */
|
|
65
|
+
readonly messageId: string;
|
|
66
|
+
readonly author: string;
|
|
67
|
+
readonly text: string;
|
|
68
|
+
/** Whether the quoted message is one this bot posted. */
|
|
69
|
+
readonly fromBot: boolean;
|
|
70
|
+
/** When it was written, as the channel said it ("" when not said). */
|
|
71
|
+
readonly sentAt: string;
|
|
72
|
+
/**
|
|
73
|
+
* The channel says the quoted message was deleted. Independent of `text`: a deleted quote may still carry a preview,
|
|
74
|
+
* which is shown as any quote's text; only when `text` is empty does `deleted` decide what is said instead ("the
|
|
75
|
+
* quoted message was deleted" rather than "its text is not available"), as Python `quote_block` does.
|
|
76
|
+
*/
|
|
77
|
+
readonly deleted: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Where the adapter read the quote (for a log line, never the text): a structured entity, the message's HTML, or a
|
|
80
|
+
* placeholder that came with no data (Python `Quote.source`).
|
|
81
|
+
*/
|
|
82
|
+
readonly source: "entity" | "html" | "placeholder";
|
|
83
|
+
}
|
|
84
|
+
/** Someone the message @mentions (never the bot itself: the adapter removes its own mention). */
|
|
85
|
+
export interface InboundMention {
|
|
86
|
+
/** The channel's id of the person (Teams: "29:..."). */
|
|
87
|
+
readonly channelUserId: string;
|
|
88
|
+
/** Their directory id (Teams: the Entra object id); "" when the channel did not give it. */
|
|
89
|
+
readonly userId: string;
|
|
90
|
+
readonly name: string;
|
|
91
|
+
/** The mention as it appears in the message text. */
|
|
92
|
+
readonly shown: string;
|
|
93
|
+
/**
|
|
94
|
+
* Where `shown` starts in `InboundMessage.text`, in code points: a mention is replaced at its position, never at the
|
|
95
|
+
* first occurrence of the name ("Dana, ask @Dana" mentions the second "Dana").
|
|
96
|
+
*/
|
|
97
|
+
readonly offset: number;
|
|
98
|
+
}
|
|
99
|
+
/** A file that came with a message. The bytes are fetched through `Surface.fetchFile`, never by core directly. */
|
|
100
|
+
export interface InboundFile {
|
|
101
|
+
readonly name: string;
|
|
102
|
+
/** The file type as the channel said it (extension or media type), lower case. */
|
|
103
|
+
readonly type: string;
|
|
104
|
+
/** Opaque to core: what the adapter needs to fetch it. */
|
|
105
|
+
readonly handle: Readonly<Record<string, unknown>>;
|
|
106
|
+
}
|
|
107
|
+
export interface InboundMessage extends InboundBase {
|
|
108
|
+
readonly type: "message";
|
|
109
|
+
/** What the person wrote, the bot's own mention removed. */
|
|
110
|
+
readonly text: string;
|
|
111
|
+
/** The bot itself is @mentioned; a mention of someone else does not count (Python `activity.is_mentioned`). */
|
|
112
|
+
readonly mentioned: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* A targeted (private) message: in a group chat the person picked the bot under "/" and only the bot sees what they
|
|
115
|
+
* wrote (Python `activity.is_targeted`; Teams marks it on the recipient, `isTargeted`).
|
|
116
|
+
*/
|
|
117
|
+
readonly targeted: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* The message starts by naming the bot ("@<bot name> ...", typed as words or as the bot's mention put first): in a
|
|
120
|
+
* 1:1 chat attached to a remote session, the way the person says these words are for the bot and not for the session
|
|
121
|
+
* (Python `activity.addressed_to_bot`, with the configured bot name).
|
|
122
|
+
*/
|
|
123
|
+
readonly namesBotFirst: boolean;
|
|
124
|
+
/** The conversation's name (a group chat's title; "" in 1:1 or when the channel gave none). */
|
|
125
|
+
readonly conversationName: string;
|
|
126
|
+
/** The people the message @mentions, in order, the bot excluded. */
|
|
127
|
+
readonly mentions: readonly InboundMention[];
|
|
128
|
+
readonly links: readonly InboundLink[];
|
|
129
|
+
readonly quotes: readonly InboundQuote[];
|
|
130
|
+
readonly files: readonly InboundFile[];
|
|
131
|
+
/**
|
|
132
|
+
* The names of attachments the channel gave no way to fetch (a file shared as a link), told back to the person
|
|
133
|
+
* (Python `inbound.inbound_files`' second result, said with `inbound.unreadable_line`).
|
|
134
|
+
*/
|
|
135
|
+
readonly unreadableFiles: readonly string[];
|
|
136
|
+
readonly provenance: Provenance;
|
|
137
|
+
}
|
|
138
|
+
/** A button pressed on a card the bot posted. */
|
|
139
|
+
export interface InboundAction extends InboundBase {
|
|
140
|
+
readonly type: "action";
|
|
141
|
+
/**
|
|
142
|
+
* Which action: the `primusclaw` field of the button's data, the worker's own kind that routing dispatches on
|
|
143
|
+
* (Python `activity._card_data`'s kind: "decision", "answer", "remote", ...). The adapter copies it, never interprets
|
|
144
|
+
* it; "" when the data names none.
|
|
145
|
+
*/
|
|
146
|
+
readonly verb: string;
|
|
147
|
+
/**
|
|
148
|
+
* The click came as an Action.Execute invoke, which the ingress answered with a placeholder card that the handler
|
|
149
|
+
* must replace (Python `activity.is_card_click`); false for an Action.Submit message.
|
|
150
|
+
*/
|
|
151
|
+
readonly invoke: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* The channel's own verb of the click, for a log line only: clipped to 40 characters, "unknown" when absent (Python
|
|
154
|
+
* `activity.card_verb`). It comes from the client: never dispatch on it.
|
|
155
|
+
*/
|
|
156
|
+
readonly clickVerb: string;
|
|
157
|
+
/** The data the card attached to the button: unvalidated, each handler reads it through its own schema. */
|
|
158
|
+
readonly data: Readonly<Record<string, unknown>>;
|
|
159
|
+
/** The message that holds the card, which the handler replaces to settle the click ("" when not said). */
|
|
160
|
+
readonly cardMessageId: MessageId;
|
|
161
|
+
}
|
|
162
|
+
/** A thumbs up or down on a message the bot posted, with the comment the person gave. */
|
|
163
|
+
export interface InboundVote extends InboundBase {
|
|
164
|
+
readonly type: "vote";
|
|
165
|
+
readonly messageId: MessageId;
|
|
166
|
+
readonly reaction: "like" | "dislike";
|
|
167
|
+
readonly comment: string;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* The semantic views core can show (a card on Teams). Each feature adds its own by declaration merging, next to its
|
|
171
|
+
* view model:
|
|
172
|
+
*
|
|
173
|
+
* declare module "../ports/surface.js" {
|
|
174
|
+
* interface ViewMap { approval: ApprovalView }
|
|
175
|
+
* }
|
|
176
|
+
*
|
|
177
|
+
* A channel adapter renders every key (`Renderers<ViewMap>` in the Teams package), so a view without a renderer does
|
|
178
|
+
* not compile. A view carries no channel markup: no card JSON, no HTML.
|
|
179
|
+
*/
|
|
180
|
+
export interface ViewMap {
|
|
181
|
+
}
|
|
182
|
+
/** One view: its name and its model. */
|
|
183
|
+
export type View = {
|
|
184
|
+
readonly [K in keyof ViewMap]: {
|
|
185
|
+
readonly name: K;
|
|
186
|
+
readonly model: ViewMap[K];
|
|
187
|
+
};
|
|
188
|
+
}[keyof ViewMap];
|
|
189
|
+
/** A source a reply cites (`[n]` in its text). */
|
|
190
|
+
export interface Citation {
|
|
191
|
+
/** The `n` of the `[n]` in the text that cites it. */
|
|
192
|
+
readonly position: number;
|
|
193
|
+
readonly title: string;
|
|
194
|
+
readonly url: string;
|
|
195
|
+
readonly abstract: string;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* A reply to tap: the button's `title` and the text it sends as the person's message, `value` (they differ: "Back to
|
|
199
|
+
* Clawy" sends "back to Clawy"; Teams: an imBack action).
|
|
200
|
+
*/
|
|
201
|
+
export interface SuggestedReply {
|
|
202
|
+
readonly title: string;
|
|
203
|
+
readonly value: string;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* A button on a view: one that sends an action back to the worker (`verb` and its `data`, which arrive as an
|
|
207
|
+
* `InboundAction`), or one that opens a link. This is the worker's own click protocol, not channel markup; a channel
|
|
208
|
+
* renders it as its own button (Teams: Action.Execute / Action.OpenUrl).
|
|
209
|
+
*/
|
|
210
|
+
export type ViewButton = {
|
|
211
|
+
readonly title: string;
|
|
212
|
+
readonly verb: string;
|
|
213
|
+
readonly data: JsonObject;
|
|
214
|
+
readonly style?: ButtonStyle;
|
|
215
|
+
} | {
|
|
216
|
+
readonly title: string;
|
|
217
|
+
readonly url: string;
|
|
218
|
+
readonly style?: ButtonStyle;
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* How a button is emphasised (Teams: the action's `style`), carried as written so card JSON matches the Python worker
|
|
222
|
+
* byte for byte: an explicit "default" (the feedback offer's No) is not the same JSON as no style at all.
|
|
223
|
+
*/
|
|
224
|
+
export type ButtonStyle = "default" | "positive" | "destructive";
|
|
225
|
+
/** What a message is. */
|
|
226
|
+
export type OutBody =
|
|
227
|
+
/** Plain text, sent as markdown. */
|
|
228
|
+
{
|
|
229
|
+
readonly type: "text";
|
|
230
|
+
readonly text: string;
|
|
231
|
+
}
|
|
232
|
+
/** Markdown the channel renders richly (Teams: converted to its HTML subset); `lead` bolds a first label line. */
|
|
233
|
+
| {
|
|
234
|
+
readonly type: "rich";
|
|
235
|
+
readonly markdown: string;
|
|
236
|
+
readonly lead: boolean;
|
|
237
|
+
}
|
|
238
|
+
/** A view the channel renders (Teams: an Adaptive Card). `fallbackText` is what a client that cannot show it shows. */
|
|
239
|
+
| {
|
|
240
|
+
readonly type: "view";
|
|
241
|
+
readonly view: View;
|
|
242
|
+
readonly fallbackText: string;
|
|
243
|
+
};
|
|
244
|
+
/** One outbound message: the body and what goes with it. Every decoration is optional; a channel drops what it lacks. */
|
|
245
|
+
export interface OutMessage {
|
|
246
|
+
readonly body: OutBody;
|
|
247
|
+
/** What an agent wrote (an answer): carries the channel's "AI generated" label when that is on. */
|
|
248
|
+
readonly aiGenerated?: boolean;
|
|
249
|
+
/** Ask the channel's own thumbs up / down under the message. */
|
|
250
|
+
readonly feedback?: boolean;
|
|
251
|
+
/** People to @mention, in the order given. */
|
|
252
|
+
readonly mentions?: readonly UserRef[];
|
|
253
|
+
/** Replies to tap (at most three are shown). */
|
|
254
|
+
readonly suggestions?: readonly SuggestedReply[];
|
|
255
|
+
readonly citations?: readonly Citation[];
|
|
256
|
+
}
|
|
257
|
+
/** What the channel can do, so core picks the shape that works instead of trying and failing. */
|
|
258
|
+
export interface SurfaceCaps {
|
|
259
|
+
/** A live, growing status/answer bubble (`LiveStream`). */
|
|
260
|
+
readonly streaming: boolean;
|
|
261
|
+
/** `post` returns the id of the new message (so it can be edited later). */
|
|
262
|
+
readonly messageIds: boolean;
|
|
263
|
+
readonly edit: boolean;
|
|
264
|
+
readonly delete: boolean;
|
|
265
|
+
/** Views are rendered (otherwise their `fallbackText` is sent). */
|
|
266
|
+
readonly views: boolean;
|
|
267
|
+
readonly citations: boolean;
|
|
268
|
+
readonly suggestions: boolean;
|
|
269
|
+
}
|
|
270
|
+
/** A message could not be removed (the channel cannot delete, or it refused). The message is still there. */
|
|
271
|
+
export interface DeleteUnsupported {
|
|
272
|
+
readonly kind: "delete_unsupported";
|
|
273
|
+
readonly reason: string;
|
|
274
|
+
}
|
|
275
|
+
/** A stream request was not taken: refused (`status`, the channel's `code`), unanswered (status 0), or not supported. */
|
|
276
|
+
export interface StreamRefused {
|
|
277
|
+
readonly kind: "stream_refused";
|
|
278
|
+
readonly reason: string;
|
|
279
|
+
readonly status: number;
|
|
280
|
+
readonly code: string;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* A live bubble that shows progress and then the answer (Teams: a streaming message). The text of a stream only grows;
|
|
284
|
+
* `finish` replaces it with the final message and closes it. Every call may be refused; the caller then shows the same
|
|
285
|
+
* thing the way it would without a stream.
|
|
286
|
+
*/
|
|
287
|
+
export interface LiveStream {
|
|
288
|
+
/**
|
|
289
|
+
* The id of the stream's message (Teams: the id the first stream request was answered with), so that what the same
|
|
290
|
+
* turn later amends or replaces after the stream closed edits this message instead of posting a new one (the Python
|
|
291
|
+
* worker keeps the stream id for that). "" when the channel did not say it.
|
|
292
|
+
*/
|
|
293
|
+
readonly id: MessageId;
|
|
294
|
+
/**
|
|
295
|
+
* Informative status lines ("Thinking…", the step in progress). Once `options.signal` aborts, an update not yet sent
|
|
296
|
+
* or on its way is given up at once (refused); the stream takes no more.
|
|
297
|
+
*/
|
|
298
|
+
inform(text: string, options?: UpdateOptions): Promise<Result<void, StreamRefused>>;
|
|
299
|
+
/** The answer text so far; each call carries the whole text, which must start with the previous one. As `inform`. */
|
|
300
|
+
emit(text: string, options?: UpdateOptions): Promise<Result<void, StreamRefused>>;
|
|
301
|
+
finish(message: OutMessage): Promise<Result<void, StreamRefused>>;
|
|
302
|
+
}
|
|
303
|
+
export interface UpdateOptions {
|
|
304
|
+
readonly signal?: AbortSignal;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* A message built for one conversation and not yet sent: the channel's own envelope (Teams: the Python worker's
|
|
308
|
+
* `{"operation": "send", "reference": ..., "activity": ...}`), opaque to core. A flow that must keep what it is about to
|
|
309
|
+
* send until it has been sent (an approval card, a question card) stores it first and `deliver`s it after; another
|
|
310
|
+
* worker can deliver a stored one again. Stored as JSON, byte-for-byte what the Python worker stored.
|
|
311
|
+
*/
|
|
312
|
+
export type Envelope = JsonObject;
|
|
313
|
+
/**
|
|
314
|
+
* One conversation's outbound side (the Python `Messenger`). In a group conversation the adapter masks credential
|
|
315
|
+
* shapes in everything it posts, since every member sees it.
|
|
316
|
+
*/
|
|
317
|
+
export interface Conversation {
|
|
318
|
+
readonly ref: ConversationRef;
|
|
319
|
+
/** The messages this conversation has tried to replace (a clicked card is settled when its id is here). */
|
|
320
|
+
readonly edited: ReadonlySet<MessageId>;
|
|
321
|
+
/**
|
|
322
|
+
* Count message `id` as settled without editing it (it is about to be deleted): the safety net that closes an
|
|
323
|
+
* unsettled click then leaves it alone instead of editing a deleted message (Python `messenger.edited.add(id)`).
|
|
324
|
+
*/
|
|
325
|
+
markSettled(id: MessageId): void;
|
|
326
|
+
typing(): Promise<void>;
|
|
327
|
+
/** Post and do not wait for the new message's id. */
|
|
328
|
+
send(message: OutMessage): Promise<void>;
|
|
329
|
+
/** Post and return the new message's id; undefined when the channel never said it (keep sending, do not edit). */
|
|
330
|
+
post(message: OutMessage): Promise<MessageId | undefined>;
|
|
331
|
+
/**
|
|
332
|
+
* Replace message `id`. With `signal`, an edit not yet sent when it is aborted is not sent, and the promise rejects
|
|
333
|
+
* with the signal's reason (a stop that must not let a late progress edit overwrite what it shows).
|
|
334
|
+
*/
|
|
335
|
+
update(id: MessageId, message: OutMessage, options?: UpdateOptions): Promise<void>;
|
|
336
|
+
delete(id: MessageId): Promise<Result<void, DeleteUnsupported>>;
|
|
337
|
+
/** The envelope `send` would publish for `message` (masked in a group), built without sending it. */
|
|
338
|
+
outgoing(message: OutMessage): Envelope;
|
|
339
|
+
/** Publish an envelope `outgoing` built (possibly in another process, from storage). */
|
|
340
|
+
deliver(envelope: Envelope): Promise<void>;
|
|
341
|
+
/**
|
|
342
|
+
* A live stream that answers `replyTo` (the person's message), showing `status` as its first informative update.
|
|
343
|
+
* Success means that first update has been sent and the channel took it; refused when the channel cannot stream here
|
|
344
|
+
* or did not take it. What a caller tracks about the stream (whether text was streamed, its age, whether it can still
|
|
345
|
+
* be closed) is kept by core's own stream wrapper, not by the port.
|
|
346
|
+
*/
|
|
347
|
+
openStream(replyTo: MessageId, status: string): Promise<Result<LiveStream, StreamRefused>>;
|
|
348
|
+
}
|
|
349
|
+
/** A file's bytes, fetched by the adapter; refused when the channel would not give them. */
|
|
350
|
+
export interface FetchedFile {
|
|
351
|
+
readonly name: string;
|
|
352
|
+
/** The media type the file is uploaded with (e.g. "image/png", "text/plain"). */
|
|
353
|
+
readonly mediaType: string;
|
|
354
|
+
readonly bytes: Uint8Array;
|
|
355
|
+
}
|
|
356
|
+
export interface FileRefused {
|
|
357
|
+
readonly kind: "file_refused";
|
|
358
|
+
/** Why ("too_large", "not_allowed", "unreachable", ...); never a URL or a body. */
|
|
359
|
+
readonly reason: string;
|
|
360
|
+
}
|
|
361
|
+
/** A member of a conversation, as the channel's roster lists them ("" for what it does not give). */
|
|
362
|
+
export interface RosterMember {
|
|
363
|
+
readonly channelUserId: string;
|
|
364
|
+
readonly userId: string;
|
|
365
|
+
readonly name: string;
|
|
366
|
+
readonly givenName: string;
|
|
367
|
+
readonly surname: string;
|
|
368
|
+
readonly email: string;
|
|
369
|
+
readonly userPrincipalName: string;
|
|
370
|
+
}
|
|
371
|
+
/** The channel. */
|
|
372
|
+
export interface Surface {
|
|
373
|
+
readonly caps: SurfaceCaps;
|
|
374
|
+
conversation(ref: ConversationRef): Conversation;
|
|
375
|
+
fetchFile(file: InboundFile): Promise<Result<FetchedFile, FileRefused>>;
|
|
376
|
+
/**
|
|
377
|
+
* The bot's 1:1 conversation with `user`, created through the organisation of `via` (a conversation both are in);
|
|
378
|
+
* undefined when the channel cannot open it (the bot is not in their roster, the channel refuses).
|
|
379
|
+
*/
|
|
380
|
+
openPersonal(via: ConversationRef, user: {
|
|
381
|
+
readonly channelUserId: string;
|
|
382
|
+
readonly userId: string;
|
|
383
|
+
}): Promise<Conversation | undefined>;
|
|
384
|
+
/** The members of `conversation`; undefined when the channel cannot list them. */
|
|
385
|
+
members(conversation: ConversationRef): Promise<readonly RosterMember[] | undefined>;
|
|
386
|
+
}
|
|
387
|
+
/** A plain-text message: the common case. */
|
|
388
|
+
export declare function textMessage(text: string): OutMessage;
|
|
389
|
+
/** A rich (markdown) message; `lead` bolds a first label line. */
|
|
390
|
+
export declare function richMessage(markdown: string, options?: {
|
|
391
|
+
lead?: boolean;
|
|
392
|
+
aiGenerated?: boolean;
|
|
393
|
+
}): OutMessage;
|
|
394
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The cards of other features that a turn shows while it runs or after it ends: the approval card of a held tool call, the card
|
|
3
|
+
* of an agent's question (both the approvals feature's), and the worker's own thumbs under a final answer (the feedback
|
|
4
|
+
* feature's). The turn engine knows only this port, never those features' views; whoever assembles the worker passes the
|
|
5
|
+
* features' implementation in. Each method returns the message to show; the turn sends it.
|
|
6
|
+
*/
|
|
7
|
+
import type { Lang } from "../locales/lang.js";
|
|
8
|
+
import type { JsonObject } from "../json.js";
|
|
9
|
+
import type { OutMessage } from "./surface.js";
|
|
10
|
+
/** A held tool call, as the turn engine passes it on (Python turn.py `permission_card(...)` arguments). */
|
|
11
|
+
export interface ApprovalAsk {
|
|
12
|
+
/** The tool's name (Brain's `tool`, "tool" when it named none). */
|
|
13
|
+
readonly tool: string;
|
|
14
|
+
/** The call's input as Brain sent it. */
|
|
15
|
+
readonly input: unknown;
|
|
16
|
+
readonly sessionId: string;
|
|
17
|
+
/** "" when Brain sent none. */
|
|
18
|
+
readonly toolUseId: string;
|
|
19
|
+
/** Asked in a group chat: everyone sees the card, only the owner may answer. */
|
|
20
|
+
readonly group: boolean;
|
|
21
|
+
/** The person whose turn it is ("" when not known). */
|
|
22
|
+
readonly ownerName: string;
|
|
23
|
+
/** Brain's permissionRequest event itself (summary, tool_description, intent). */
|
|
24
|
+
readonly event: JsonObject;
|
|
25
|
+
/** The card's language. */
|
|
26
|
+
readonly lang: Lang;
|
|
27
|
+
}
|
|
28
|
+
/** An agent's question, as the turn engine passes it on (Python turn.py `question_card(card_questions(...), ...)` arguments). */
|
|
29
|
+
export interface QuestionAsk {
|
|
30
|
+
/**
|
|
31
|
+
* The questions as Brain sent them (its userQuestion event's `questions`), not yet read. The implementation reads them as
|
|
32
|
+
* Python `card_questions` does (validates, drops what is malformed, limits questions and options) before it builds the
|
|
33
|
+
* card: reading them is the approvals feature's, so the turn engine passes them on untouched.
|
|
34
|
+
*/
|
|
35
|
+
readonly questions: unknown;
|
|
36
|
+
readonly sessionId: string;
|
|
37
|
+
/** The question's action id ("" when Brain sent none). */
|
|
38
|
+
readonly toolUseId: string;
|
|
39
|
+
readonly group: boolean;
|
|
40
|
+
readonly ownerName: string;
|
|
41
|
+
}
|
|
42
|
+
export interface TurnCards {
|
|
43
|
+
/** The approval card of a held tool call (Python render.py `permission_card`); its fallback text names the tool. */
|
|
44
|
+
approval(ask: ApprovalAsk): OutMessage;
|
|
45
|
+
/**
|
|
46
|
+
* The card of an agent's question, with no note: Python turn.py's `question_card(card_questions(questions), session_id,
|
|
47
|
+
* tool_use_id, group, owner_name)`, the reading included.
|
|
48
|
+
*/
|
|
49
|
+
question(ask: QuestionAsk): OutMessage;
|
|
50
|
+
/** The worker's own thumbs under a final answer, for a client whose thumbs never reach it (Python render.py `thumbs_card`). */
|
|
51
|
+
thumbs(): OutMessage;
|
|
52
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { messageWords } from "../assistant/receipt.js";
|
|
2
|
+
import type { JsonObject } from "../json.js";
|
|
3
|
+
import type { ProactiveDeps } from "./deps.js";
|
|
4
|
+
import { type AnsweredInChat } from "./events.js";
|
|
5
|
+
/** What the person asked, as the name of a run in its card and in the line before a lost turn's answer. */
|
|
6
|
+
export declare const PROMPT_TITLE_MAX = 60;
|
|
7
|
+
export declare class Deliveries {
|
|
8
|
+
private readonly deps;
|
|
9
|
+
private readonly answeredInChat;
|
|
10
|
+
constructor(deps: ProactiveDeps, answeredInChat: (event: JsonObject, now: number) => AnsweredInChat);
|
|
11
|
+
/** Send the message for `event`; false when nothing was sent (an approval already in a chat, an event that says nothing). */
|
|
12
|
+
send(userId: string, reference: JsonObject, event: JsonObject): Promise<boolean>;
|
|
13
|
+
/** An approval's card, recorded BEFORE it goes out (atomically: the turn may show the same approval) and WITH its envelope. */
|
|
14
|
+
private sendApproval;
|
|
15
|
+
/** What the assistant said (or a work item that needs the person and was not said). */
|
|
16
|
+
private sendSaid;
|
|
17
|
+
/** The client locale of the message being handled ("" for a push or a sweep: Python CLIENT_LOCALE's default). */
|
|
18
|
+
private clientLocale;
|
|
19
|
+
/** The chat is an agent's window now: direct chat is on for the person and the chat is attached to a session. */
|
|
20
|
+
private agentsWindow;
|
|
21
|
+
private attached;
|
|
22
|
+
/**
|
|
23
|
+
* The first reply closes the receipt under the person's message, in its place (with the words already streamed in it kept);
|
|
24
|
+
* otherwise it is a message of its own. Its other parts, and the files, follow as messages.
|
|
25
|
+
*/
|
|
26
|
+
private closeReceiptWith;
|
|
27
|
+
/** The one text message of `event` as an edit can carry it; undefined when it is more than that (several, or a card). */
|
|
28
|
+
private oneText;
|
|
29
|
+
/**
|
|
30
|
+
* A say that adds to an earlier one of the same turn (`amends`): that message is edited to hold both. False when it is not
|
|
31
|
+
* one, this process no longer has that message, or the edit was not taken: it is then sent as a message of its own.
|
|
32
|
+
*/
|
|
33
|
+
private amend;
|
|
34
|
+
/** A say that takes the place of the first one of its turn (`replaces`): that message is edited into this one. */
|
|
35
|
+
private replace;
|
|
36
|
+
private edit;
|
|
37
|
+
/**
|
|
38
|
+
* The approval card of a pushed permission request: true when sent, false when not needed (a card for it is in a chat already,
|
|
39
|
+
* or it ran out while held), undefined when it offers nothing that can be answered (its words go as they are).
|
|
40
|
+
*/
|
|
41
|
+
private sendRemoteAsk;
|
|
42
|
+
/** A run started by a chat turn is named by what the person asked there (Claw names it by its session's first message). */
|
|
43
|
+
namedByPrompt(event: JsonObject): JsonObject;
|
|
44
|
+
/**
|
|
45
|
+
* The run finished after the chat turn answering it died with its worker: its answer is sent, after one line that says why it
|
|
46
|
+
* comes now. False when it cannot be read: the card is shown instead.
|
|
47
|
+
*/
|
|
48
|
+
private answerLostTurn;
|
|
49
|
+
private offerChanges;
|
|
50
|
+
}
|
|
51
|
+
/** The words of a message (for tests and callers that check what was said). */
|
|
52
|
+
export { messageWords };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/** What the delivery of unasked messages needs (teams_agent/proactive.py `Proactive.__init__`, and what it imported). */
|
|
2
|
+
import type { RequestScope } from "../ports/request-scope.js";
|
|
3
|
+
import type { DirectChat } from "../direct-chat/direct-chat.js";
|
|
4
|
+
import type { JsonObject } from "../json.js";
|
|
5
|
+
import type { ClawWorkItemsPort } from "../ports/claw/index.js";
|
|
6
|
+
import type { Clock } from "../ports/clock.js";
|
|
7
|
+
import type { Logger } from "../ports/logger.js";
|
|
8
|
+
import type { StorePort } from "../ports/store/index.js";
|
|
9
|
+
import type { Conversation, Envelope, OutMessage } from "../ports/surface.js";
|
|
10
|
+
import type { Receipts } from "../assistant/receipts.js";
|
|
11
|
+
import type { DeliveryLink, SayPlanner } from "../assistant/say.js";
|
|
12
|
+
import type { SaidMessages } from "./said-memory.js";
|
|
13
|
+
export type ProactiveStore = Pick<StorePort, "now" | "prefs" | "held" | "references" | "approvals" | "remotePermissions" | "remoteState" | "turns" | "links" | "assistantCards">;
|
|
14
|
+
/** A permission request an agent on the person's machine pushed (`assistant.say` with `remote.ask`), to be drawn as its card. */
|
|
15
|
+
export interface RemoteAskRequest {
|
|
16
|
+
readonly ask: Readonly<Record<string, unknown>>;
|
|
17
|
+
readonly options: readonly unknown[];
|
|
18
|
+
readonly sessionId: string;
|
|
19
|
+
readonly machine: string;
|
|
20
|
+
readonly agent: string;
|
|
21
|
+
/** Which work item asks ("#seq title"; "" none). */
|
|
22
|
+
readonly about: string;
|
|
23
|
+
readonly expiresAt: number;
|
|
24
|
+
readonly zone: string;
|
|
25
|
+
readonly lang: string;
|
|
26
|
+
}
|
|
27
|
+
/** The remote agents' side of a push (W6/W6b): reading a request's options, its card, and what an agent said on its own. */
|
|
28
|
+
export interface RemotePushViews {
|
|
29
|
+
/** The options a request offers (remote_view.parse_options); [] when none can be answered. */
|
|
30
|
+
options(raw: unknown): readonly unknown[];
|
|
31
|
+
askCard(request: RemoteAskRequest): OutMessage;
|
|
32
|
+
/** What a remote agent (`label`) said on its own, as messages (remote_view.unsolicited_parts). */
|
|
33
|
+
saidParts(label: string, text: string): readonly string[];
|
|
34
|
+
}
|
|
35
|
+
/** The turns' side of a run's end (W4b): a lost turn's answer, and what the session changed. */
|
|
36
|
+
export interface RunFollowUps {
|
|
37
|
+
/** The messages of a finished run's answer after `lead` (turn.last_answer + answer_parts); undefined when it cannot be read. */
|
|
38
|
+
lostAnswer(key: string, sessionId: string, lead: string): Promise<readonly string[] | undefined>;
|
|
39
|
+
/** The card of what the session changed, when the sandbox still has it (best effort, never throws). */
|
|
40
|
+
offerChanges(key: string, sessionId: string, conversation: Conversation): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
export interface ProactiveDeps {
|
|
43
|
+
readonly store: ProactiveStore;
|
|
44
|
+
/** The conversation a stored reference posts to. */
|
|
45
|
+
readonly conversationFor: (reference: JsonObject) => Conversation;
|
|
46
|
+
/**
|
|
47
|
+
* Publish a stored envelope as it was built (it carries its own conversation: a group's card goes back to that group), the
|
|
48
|
+
* Python worker's `outbox.publish(card.envelope)`.
|
|
49
|
+
*/
|
|
50
|
+
readonly deliverStored: (envelope: Envelope) => Promise<void>;
|
|
51
|
+
/** `post` gives back the new message's id (it can be added to later). */
|
|
52
|
+
readonly messageIds: boolean;
|
|
53
|
+
readonly say: SayPlanner;
|
|
54
|
+
readonly receipts: Receipts;
|
|
55
|
+
readonly directChat: DirectChat;
|
|
56
|
+
readonly said: SaidMessages;
|
|
57
|
+
/** Claw's links for delivered files; undefined: files are named. */
|
|
58
|
+
readonly deliveryLink: DeliveryLink | undefined;
|
|
59
|
+
/** Whether an item's automatic replies are still on (undefined: what was recorded stands). */
|
|
60
|
+
readonly claw: Pick<ClawWorkItemsPort, "watches"> | undefined;
|
|
61
|
+
readonly remote: RemotePushViews;
|
|
62
|
+
readonly runs: RunFollowUps | undefined;
|
|
63
|
+
readonly publicBaseUrl: string;
|
|
64
|
+
/** ASSISTANT_REPLY_WINDOW_SECONDS. */
|
|
65
|
+
readonly replyWindowSeconds: number;
|
|
66
|
+
readonly clock: Clock;
|
|
67
|
+
readonly logger: Logger;
|
|
68
|
+
/** A run's event as a card may show it (`publicRunEvent` bound to the public-error service): internal errors withheld. */
|
|
69
|
+
readonly publicEvent: (event: JsonObject) => JsonObject;
|
|
70
|
+
/** The bot's display name (branding; "Clawy" by default). */
|
|
71
|
+
readonly botName: string;
|
|
72
|
+
/**
|
|
73
|
+
* The inbound event being handled, if any (Python CLIENT_LOCALE): held messages released while a message of the person's is
|
|
74
|
+
* handled (`/resume`, quiet hours off) answer in their client's language; a push or a sweep reads none. Default: none.
|
|
75
|
+
*/
|
|
76
|
+
readonly requestScope?: RequestScope;
|
|
77
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** What the delivery of unasked messages adds to Claw's events, and reads of them, shared by its modules. */
|
|
2
|
+
import type { JsonObject } from "../json.js";
|
|
3
|
+
/** Epoch seconds, added by this worker to a held approval event. */
|
|
4
|
+
export declare const EXPIRES_KEY = "_expires_at";
|
|
5
|
+
/** What a remote agent said on its own, held: not a Claw notification, made by this worker. */
|
|
6
|
+
export declare const REMOTE_SAID = "remote.said";
|
|
7
|
+
/** When the event's run finished (`occurred_at` with an offset), else `now`. */
|
|
8
|
+
export declare function finishedAt(event: JsonObject, now: number): number;
|
|
9
|
+
/** Whether this worker's own turn answered the run in the chat ("lost": a turn of an earlier process died answering it). */
|
|
10
|
+
export type AnsweredInChat = "delivered" | "running" | "lost" | null;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** What the assembly wires of proactive delivery (one line each; the views are exported from the package root). */
|
|
2
|
+
export type { ProactiveDeps } from "./deps.js";
|
|
3
|
+
export type { RunFollowUps } from "./deps.js";
|
|
4
|
+
export { Proactive } from "./proactive.js";
|
|
5
|
+
export { Release } from "./release.js";
|
|
6
|
+
export { SaidMessages } from "./said-memory.js";
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* When an unasked message may reach a person (teams_agent/proactive.py `Proactive.handle`): quiet hours, /pause, held notices
|
|
3
|
+
* and approvals. Claw only says that something happened; when to bother a person is decided here.
|
|
4
|
+
*
|
|
5
|
+
* What the assistant says is an answer more than a push: for the reply window after the person last wrote it is delivered even in
|
|
6
|
+
* quiet hours or a pause; outside it, it is held. An approval is never pushed to wake anyone; one that runs out while held is
|
|
7
|
+
* refused. A run's end that the chat's own turn already answered is not shown again; one whose turn is still answering is asked
|
|
8
|
+
* again ("retry").
|
|
9
|
+
*/
|
|
10
|
+
import type { JsonObject } from "../json.js";
|
|
11
|
+
import { Deliveries } from "./deliver.js";
|
|
12
|
+
import type { ProactiveDeps } from "./deps.js";
|
|
13
|
+
import { EXPIRES_KEY, REMOTE_SAID, finishedAt, type AnsweredInChat } from "./events.js";
|
|
14
|
+
import { type Muted } from "./quiet.js";
|
|
15
|
+
export { EXPIRES_KEY, REMOTE_SAID, finishedAt };
|
|
16
|
+
export type Outcome = "delivered" | "held" | "dropped" | "retry";
|
|
17
|
+
/** The turn deadline plus slack: a turn older than this died with its worker. */
|
|
18
|
+
export declare const TURN_RUNNING_MAX_SECONDS: number;
|
|
19
|
+
export declare const SKEW_SLACK_SECONDS = 60;
|
|
20
|
+
/** A notification that comes as its run's chat turn ends waits for the turn, up to this, within Claw's 5 s delivery timeout. */
|
|
21
|
+
export declare const TURN_SETTLE_WAIT_SECONDS = 3.5;
|
|
22
|
+
export declare const TURN_SETTLE_POLL_SECONDS = 0.1;
|
|
23
|
+
/** A chat attached this close to a session's end may not have been shown it: it is told. */
|
|
24
|
+
export declare const ATTACHED_SLACK_SECONDS = 2;
|
|
25
|
+
export declare class Proactive {
|
|
26
|
+
private readonly deps;
|
|
27
|
+
/** An attached chat hears its session between turns (REMOTE_PUSH_ENABLED): set by the assembly that owns both. */
|
|
28
|
+
showsAttached: boolean;
|
|
29
|
+
readonly deliveries: Deliveries;
|
|
30
|
+
constructor(deps: ProactiveDeps);
|
|
31
|
+
muted(userId: string): Muted | undefined;
|
|
32
|
+
/** The person wrote (or pressed a button) within the reply window: what the assistant says now is a reply. */
|
|
33
|
+
inReplyWindow(userId: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* May something the person did not ask for be pushed now (what a remote agent says on its own)? Not in quiet hours or a pause;
|
|
36
|
+
* but a person who wrote a moment ago is in the conversation, which lifts quiet hours (never an explicit /pause).
|
|
37
|
+
*/
|
|
38
|
+
reachable(userId: string): boolean;
|
|
39
|
+
/** Hold what a remote agent (`label`) said on its own while the person may not be woken; credential shapes masked first. */
|
|
40
|
+
holdRemote(userId: string, label: string, text: string, eventId: string): void;
|
|
41
|
+
/** What became of `event` for the person: delivered, held, dropped, or retry (a chat turn is still answering that run). */
|
|
42
|
+
handle(userId: string, reference: JsonObject, event: JsonObject): Promise<Outcome>;
|
|
43
|
+
/** A reply of the assistant: delivered in the reply window or when nothing mutes, held otherwise. */
|
|
44
|
+
private answerOrHold;
|
|
45
|
+
private pushOrHold;
|
|
46
|
+
/**
|
|
47
|
+
* An approval event with its expiry added, or the outcome it already has: malformed or out of time (dropped), or a card for it
|
|
48
|
+
* is in a chat already (dropped; "retry" while that card is still being sent, since it may yet fail).
|
|
49
|
+
*/
|
|
50
|
+
private approval;
|
|
51
|
+
/**
|
|
52
|
+
* A session's finish or failure that the chat already showed: it was attached to that very session, and following it, since
|
|
53
|
+
* before this happened. Decided when the push arrives, never when a held one is released.
|
|
54
|
+
*/
|
|
55
|
+
private shownInChat;
|
|
56
|
+
/** Whether this worker's own turn answered the run in the chat ("lost": a turn of an earlier process died answering it). */
|
|
57
|
+
answeredInChat(event: JsonObject, now: number): AnsweredInChat;
|
|
58
|
+
/** `answeredInChat` once the chat turn answering this run has ended, or "running" when it has not within the settle wait. */
|
|
59
|
+
private settled;
|
|
60
|
+
}
|
|
61
|
+
/** `datetime.fromtimestamp(seconds, timezone.utc).isoformat()`: microseconds only when there are any, and "+00:00". */
|
|
62
|
+
export declare function pythonIsoUtc(seconds: number): string;
|