@primusclaw/personal-agent 0.0.0-stage → 0.1.1
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 +31875 -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,16 @@
|
|
|
1
|
+
import { type Delivery } from "../deliveries.js";
|
|
2
|
+
import { type TurnContext } from "./context.js";
|
|
3
|
+
/** Under a message that says something went wrong: one button that starts /feedback. */
|
|
4
|
+
export declare function offerReport(ctx: TurnContext): Promise<void>;
|
|
5
|
+
/** Under the final answer of a turn from a client whose thumbs never reach us: the worker's own thumbs. */
|
|
6
|
+
export declare function offerThumbs(ctx: TurnContext): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Under a finished answer: what the session changed, with Create PR and Open diff in Claw. Nothing is shown for anything
|
|
9
|
+
* that is not a plain success: no changes, a sandbox that is gone, a slow or failed call.
|
|
10
|
+
*/
|
|
11
|
+
export declare function offerChanges(ctx: TurnContext, sessionId: string): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* After the answer: the files the agent delivered. A 1:1 chat gets a card for each (a small image shown in it), a group
|
|
14
|
+
* chat one line each with the link and nothing of the file.
|
|
15
|
+
*/
|
|
16
|
+
export declare function offerDeliveries(ctx: TurnContext, sessionId: string, deliveries: readonly Delivery[]): Promise<void>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** A turn refused for want of the user's model key, run once more on a model that needs none. */
|
|
2
|
+
import type { StatusMessage } from "../progress/status-message.js";
|
|
3
|
+
import type { Step } from "../step.js";
|
|
4
|
+
import { TurnState } from "../turn-state.js";
|
|
5
|
+
import { type TurnContext } from "./context.js";
|
|
6
|
+
export interface Rerun {
|
|
7
|
+
readonly state: TurnState;
|
|
8
|
+
readonly ok: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Runs the turn once more on the fallback model: the session is pinned to it for this one turn and put back on the
|
|
12
|
+
* worker's model afterwards. Undefined when there is nothing to run it on, or Claw would not move the session: the caller
|
|
13
|
+
* then tells the user to upload the key.
|
|
14
|
+
*/
|
|
15
|
+
export declare function rerunOnFallback(ctx: TurnContext, sessionId: string, status: StatusMessage<Step>, onSession: (sessionId: string) => void, running: {
|
|
16
|
+
called: boolean;
|
|
17
|
+
}): Promise<Rerun | undefined>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { TurnState } from "../turn-state.js";
|
|
2
|
+
import type { PublicErrors } from "../../public-error/public-errors.js";
|
|
3
|
+
import { type ClawError } from "../../claw/errors.js";
|
|
4
|
+
import { type TurnContext } from "./context.js";
|
|
5
|
+
/** The chat stops following a turn after this; the run itself does not stop. */
|
|
6
|
+
export declare const TURN_DEADLINE_SECONDS: number;
|
|
7
|
+
/** What the chat says when the turn's time is up and the run is still going. */
|
|
8
|
+
export declare function stillRunningText(ctx: TurnContext, deadlineSeconds?: number): string;
|
|
9
|
+
/** What a Claw refusal before the turn ran is said as. The log gets the status and Claw's error word only, never the body. */
|
|
10
|
+
export declare function clawFailure(errors: PublicErrors, err: ClawError, review?: boolean): string;
|
|
11
|
+
/**
|
|
12
|
+
* A review whose stream showed its GitHub result before the turn broke off: its result line, to go above what the chat
|
|
13
|
+
* is told, since the progress message that showed it is replaced. '' otherwise.
|
|
14
|
+
*/
|
|
15
|
+
export declare function resultLead(ctx: TurnContext, state: TurnState | undefined): string;
|
|
16
|
+
export interface Ending {
|
|
17
|
+
/** What the turn answered, with its failure cut off. */
|
|
18
|
+
readonly answer: string;
|
|
19
|
+
/** `answer` as the chat shows it (a review's one message). */
|
|
20
|
+
readonly shown: string;
|
|
21
|
+
readonly link: string;
|
|
22
|
+
readonly ok: boolean;
|
|
23
|
+
readonly stopped: boolean;
|
|
24
|
+
/** A stop Claw confirmed: said as stopped only. */
|
|
25
|
+
readonly confirmed: boolean;
|
|
26
|
+
/** The line in front of an answer a fallback model gave. */
|
|
27
|
+
readonly lead: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The messages that end a turn. Claw ends a turn it was told to stop as failed: a stop it confirmed is said as stopped
|
|
31
|
+
* only; a stop asked for but not confirmed leaves a failure said as one.
|
|
32
|
+
*/
|
|
33
|
+
export declare function endingParts(ctx: TurnContext, ending: Ending): string[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type TurnContext } from "./context.js";
|
|
2
|
+
/** Claw's 403 to a session made as someone else once it has review items. */
|
|
3
|
+
export declare const ACTING_AS_MUST_BE_SELF = "acting_as_must_be_self";
|
|
4
|
+
/** The chat stopped following the turn after TURN_DEADLINE_SECONDS. */
|
|
5
|
+
export declare class DeadlineExpired extends Error {
|
|
6
|
+
constructor();
|
|
7
|
+
}
|
|
8
|
+
/** What the caller decides while the turn runs. */
|
|
9
|
+
export interface TurnControls {
|
|
10
|
+
/** Records the session the turn runs in. */
|
|
11
|
+
readonly onSession: (sessionId: string) => void;
|
|
12
|
+
/** A stop was asked for (/stop, an item's Stop). */
|
|
13
|
+
readonly stopRequested: () => boolean;
|
|
14
|
+
/** The user denied a tool in this turn. */
|
|
15
|
+
readonly toolDenied?: () => boolean;
|
|
16
|
+
/** Claw confirmed the stop: the turn is said as stopped only. */
|
|
17
|
+
readonly stopConfirmed?: () => boolean;
|
|
18
|
+
/** The turn is cancelled: no live edit is sent after it, and the run's record is still kept. */
|
|
19
|
+
readonly signal?: AbortSignal;
|
|
20
|
+
}
|
|
21
|
+
/** Runs the turn and always leaves the user a message; `controls.onSession` records the session id. */
|
|
22
|
+
export declare function runTurn(ctx: TurnContext, controls: TurnControls): Promise<void>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { SendOptions } from "../../ports/claw/sessions.js";
|
|
2
|
+
import { type TurnContext } from "./context.js";
|
|
3
|
+
/**
|
|
4
|
+
* The id of the newest event the session holds, read just before the message is sent: the turn's events come after it, so
|
|
5
|
+
* its stream starts there and not with the session's history. Best effort: undefined starts where Claw starts it.
|
|
6
|
+
*/
|
|
7
|
+
export declare function turnStart(ctx: TurnContext, sessionId: string, signal?: AbortSignal): Promise<string | undefined>;
|
|
8
|
+
/**
|
|
9
|
+
* The turn Claw is running on the session just before this message is sent, if any: a message sent now is queued behind
|
|
10
|
+
* it, and the queued turn is told from older ones by starting after it. Best effort.
|
|
11
|
+
*/
|
|
12
|
+
export declare function turnInFront(ctx: TurnContext, sessionId: string, signal?: AbortSignal): Promise<string | undefined>;
|
|
13
|
+
/** The model key and the acting flag for the two calls that start a model turn (only when the turn has them). */
|
|
14
|
+
export declare function sendOptions(ctx: TurnContext): SendOptions;
|
|
15
|
+
/**
|
|
16
|
+
* Fetches the files the user sent and puts them in `sessionId` before the message goes, so the agent finds them when it
|
|
17
|
+
* reads the message. With no session, or when it was deleted, one is made without a message. A file that could not be
|
|
18
|
+
* fetched or that Claw did not take is named to the user, and the message still goes. Returns the session.
|
|
19
|
+
*/
|
|
20
|
+
export declare function putFiles(ctx: TurnContext, sessionId: string | undefined, signal?: AbortSignal): Promise<string | undefined>;
|
|
21
|
+
export type Submitted = readonly [sessionId: string, messageId: string | undefined, behind: string | undefined];
|
|
22
|
+
/** (session, message id, turn in front); the message id is undefined when Claw queued the message behind a running turn. */
|
|
23
|
+
export declare function submit(ctx: TurnContext, signal?: AbortSignal): Promise<Submitted>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** A file's name said back to the user is cut to this. */
|
|
2
|
+
export declare const SHOWN_NAME_MAX = 100;
|
|
3
|
+
/** The folder the files of one message go to, so two messages never overwrite each other's files. */
|
|
4
|
+
export declare function uploadFolder(messageId: string): string;
|
|
5
|
+
/** The line the model reads after the user's words: where the files are, and that what is in them is the user's data. */
|
|
6
|
+
export declare function filesNote(paths: readonly string[]): string;
|
|
7
|
+
/** A file's name as it is said back in a message: in a code span, one line, its backticks turned to quotes, clipped. */
|
|
8
|
+
export declare function shownName(name: string): string;
|
|
9
|
+
/** What the user is told about files that did not reach the agent (the reasons are this worker's own words). */
|
|
10
|
+
export declare function failedFilesLine(failed: ReadonlyArray<readonly [name: string, why: string]>): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** (tool, status, review event): one call's outcome. */
|
|
2
|
+
export type GithubOutcome = readonly [tool: string, status: string, event: string];
|
|
3
|
+
/**
|
|
4
|
+
* What a finished call left on GitHub: (tool, status, review event) for a review posted, a merge or a place in the merge
|
|
5
|
+
* queue, or a try that says it already wrote (`wrote: true`); undefined for anything that left nothing.
|
|
6
|
+
*/
|
|
7
|
+
export declare function githubWrite(tool: string, description: unknown): GithubOutcome | undefined;
|
|
8
|
+
/** How many inline comments a review gh_review_submit posted carried (`"comments": N`); 0 when it does not say. */
|
|
9
|
+
export declare function reviewComments(description: unknown): number;
|
|
10
|
+
/** The sentence of what the pull request does that a write call gave (`"pr_summary"`), clipped as shown; '' for none. */
|
|
11
|
+
export declare function githubPrSummary(tool: string, description: unknown): string;
|
|
12
|
+
/**
|
|
13
|
+
* How a finished call came out, whatever it was: (tool, status, review event) with the `status` of its answer, or "error"
|
|
14
|
+
* when the call failed and its answer says no status. Undefined for any other tool, and for a call not finished.
|
|
15
|
+
*/
|
|
16
|
+
export declare function githubResult(tool: string, status: string, description: unknown): GithubOutcome | undefined;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The turn engine and the answer's views (the Python worker's turn.py and the answer/progress/plan part of render.py):
|
|
3
|
+
* submit a message to Claw, follow the session's stream, show progress, answer. Exported as the `turn` namespace.
|
|
4
|
+
*/
|
|
5
|
+
export { answerParts, deepLink, MAX_ANSWER_CHARS, MAX_ANSWER_MESSAGES, replyParts, wholeParts, } from "./answer-parts.js";
|
|
6
|
+
export { type Changes, type FileChange, parseChanges, type RepoChanges, repoName, totalAdditions, totalDeletions, totalFiles, } from "./changes.js";
|
|
7
|
+
export { clip, plain, SUMMARY_MAX, TITLE_MAX } from "./clip.js";
|
|
8
|
+
export { assistantDeliveries, DELIVERIES_MAX, type Delivery, deliveryLine, deliveryOf, INLINE_IMAGE_MAX_BYTES, sizeText, } from "./deliveries.js";
|
|
9
|
+
export { type TurnContext, type TurnDeps, type TurnHooks, type TurnRecord, type TurnRequest, type TurnStyle, newRecord, } from "./engine/context.js";
|
|
10
|
+
export { stillRunningText, TURN_DEADLINE_SECONDS } from "./engine/outcome.js";
|
|
11
|
+
export { runTurn, type TurnControls } from "./engine/run-turn.js";
|
|
12
|
+
export { filesNote, failedFilesLine, shownName, uploadFolder } from "./files.js";
|
|
13
|
+
export { type GithubOutcome, githubPrSummary, githubResult, githubWrite, reviewComments } from "./github-outcome.js";
|
|
14
|
+
export { lastAnswer, LAST_ANSWER_TAIL, type LastAnswerDeps } from "./last-answer.js";
|
|
15
|
+
export { LIVE_HEADER, LIVE_HEADERS, LiveView } from "./live-view.js";
|
|
16
|
+
export { failedLine, isShell, Label, labelFor, lookupLabel, skillInCommand } from "./step-labels.js";
|
|
17
|
+
export { planText, type Todo, todosOf } from "./plan.js";
|
|
18
|
+
export type { TurnClaw, TurnSurface } from "./ports.js";
|
|
19
|
+
export { StatusMessage, type StatusOptions, turnStatusMessage, type TurnStatusOptions, } from "./progress/status-message.js";
|
|
20
|
+
export { defaultStreamFinish, type LiveViewLike, type StatusPolicy, STREAM_TEXT_MAX, type StreamFinish, type StreamFinishInput, TurnStatusPolicy, } from "./progress/status-policy.js";
|
|
21
|
+
export type { Step } from "./step.js";
|
|
22
|
+
export { TurnState } from "./turn-state.js";
|
|
23
|
+
export { type ChangesModel, type DeliveryModel, viewMessage } from "./views.js";
|
|
24
|
+
export { type ReviewTurnOptions, type ReviewTurnOutcome, type TurnApprovals, TurnEngine, type TurnEngineDeps, } from "./runner.js";
|
|
25
|
+
export { OFFER_KEEP_SECONDS, type Offer, STOP_CARD_DELAY_SECONDS, STOP_KINDS, StopButtons, type StopButtonsDeps, type StopKind, stopMessage, type StopModel, } from "./stop-buttons.js";
|
|
26
|
+
export { stopText } from "../locales/turn.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Reading the untyped JSON of a stream event's `data` field by field, with the Python worker's truthiness. */
|
|
2
|
+
import type { JsonObject, JsonValue } from "../json.js";
|
|
3
|
+
export type { JsonObject, JsonValue };
|
|
4
|
+
export declare function isObject(value: unknown): value is JsonObject;
|
|
5
|
+
/** `value` when it is an object, else an empty one (Python: `data.get(x) or {}`). */
|
|
6
|
+
export declare function objectOr(value: unknown): JsonObject;
|
|
7
|
+
/** Python truthiness of a JSON value. */
|
|
8
|
+
export declare function truthy(value: unknown): boolean;
|
|
9
|
+
/** Python's `str(value or "")` for a field that should be text: '' for anything falsy, a number as Python prints it. */
|
|
10
|
+
export declare function textOf(value: unknown): string;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Clock } from "../ports/clock.js";
|
|
2
|
+
import type { Logger } from "../ports/logger.js";
|
|
3
|
+
import { type TurnClaw } from "./ports.js";
|
|
4
|
+
import { TurnState } from "./turn-state.js";
|
|
5
|
+
import type { PublicErrors } from "../public-error/public-errors.js";
|
|
6
|
+
import type { SseEvent } from "../claw/model.js";
|
|
7
|
+
export declare const READ_OVERALL_SECONDS = 20;
|
|
8
|
+
/** After a turn has finished, this much silence means the history replay is over. */
|
|
9
|
+
export declare const READ_IDLE_SECONDS = 2;
|
|
10
|
+
/** Events read for the last answer: the last finished turn is in it even behind a long running one. */
|
|
11
|
+
export declare const LAST_ANSWER_TAIL = 2000;
|
|
12
|
+
/** A replay larger than this is refused unread: a Claw that predates `tail` sends everything. */
|
|
13
|
+
export declare const LAST_ANSWER_MAX_BYTES: number;
|
|
14
|
+
/** Turns whose state is kept while the history is read: the newest ones (the last finished turn is kept apart). */
|
|
15
|
+
export declare const LAST_ANSWER_TURNS = 8;
|
|
16
|
+
/**
|
|
17
|
+
* The turns of a history read for its last answer: one TurnState per message, and only the newest LAST_ANSWER_TURNS of
|
|
18
|
+
* them, so a long history does not leave a state behind for every turn it ever had.
|
|
19
|
+
*/
|
|
20
|
+
export declare class Turns {
|
|
21
|
+
readonly states: Map<string, TurnState>;
|
|
22
|
+
current: string;
|
|
23
|
+
lastDone: TurnState | undefined;
|
|
24
|
+
feed(event: SseEvent): void;
|
|
25
|
+
}
|
|
26
|
+
/** Replay rows `{event_id, event_type, data}` as the events the stream would have sent for them. */
|
|
27
|
+
export declare function replayed(rows: ReadonlyArray<{
|
|
28
|
+
event_id?: unknown;
|
|
29
|
+
event_type?: unknown;
|
|
30
|
+
data?: unknown;
|
|
31
|
+
}>): SseEvent[];
|
|
32
|
+
export interface LastAnswerDeps {
|
|
33
|
+
readonly claw: TurnClaw;
|
|
34
|
+
readonly clock: Clock;
|
|
35
|
+
readonly log: Logger;
|
|
36
|
+
readonly errors: PublicErrors;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The answer of the session's last finished turn (undefined: no turn has finished), read with `key`. Reads the last
|
|
40
|
+
* LAST_ANSWER_TAIL events, never the whole history; when the replay cannot be read (other than refused), the stream's
|
|
41
|
+
* history is read, keeping only the newest turns' states. Claw refuses either (401/403/404) for a session the key does not
|
|
42
|
+
* own, which is what stops anybody reading somebody else's session.
|
|
43
|
+
*/
|
|
44
|
+
export declare function lastAnswer(deps: LastAnswerDeps, key: string, sessionId: string): Promise<string | undefined>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a chat shows while a turn runs: the agent's own short lines between tool calls, and at most one line for the step
|
|
3
|
+
* running now.
|
|
4
|
+
*
|
|
5
|
+
* The lines are the main agent's visible text (one per step) and a "⚠️ ... failed, continuing" line for a step that
|
|
6
|
+
* failed. The step running now is one "⏳ <label>" line at the end, replaced in place by the next step and gone when the
|
|
7
|
+
* step is over: a finished step leaves nothing, so the view never grows a list of tools. The label is humanized (never a
|
|
8
|
+
* raw tool name) and consecutive repeats of the same step collapse into one line with a count. Every line is its own
|
|
9
|
+
* paragraph, because Teams runs lines that are only separated by a single newline together.
|
|
10
|
+
*
|
|
11
|
+
* Hidden reasoning, subagent text and tool inputs never reach this class (TurnState.feed does not put them on a Step).
|
|
12
|
+
* The view is bounded: `render` keeps the newest blocks that fit LIVE_MAX_CHARS. Brain's setup steps are not steps: while
|
|
13
|
+
* setup is running `preparing` adds one transient line at the end, and a setup step that failed is one line per name. The
|
|
14
|
+
* agent's own checklist (`todo_write`) sits under the header with a budget of its own.
|
|
15
|
+
*/
|
|
16
|
+
import { type Lang } from "../locales/lang.js";
|
|
17
|
+
import type { Step } from "./step.js";
|
|
18
|
+
import { type Integrations } from "../plugins/integrations.js";
|
|
19
|
+
export declare const LIVE_HEADER: string;
|
|
20
|
+
/** The progress message's first line, in the person's language. */
|
|
21
|
+
export declare const LIVE_HEADERS: Readonly<Record<Lang, string>>;
|
|
22
|
+
/** The live view of a running turn: only the newest part, well under Teams' limit. */
|
|
23
|
+
export declare const LIVE_MAX_CHARS = 2500;
|
|
24
|
+
/** A long turn does not grow the view without bound. */
|
|
25
|
+
export declare const LIVE_KEEP_BLOCKS = 40;
|
|
26
|
+
export declare const LIVE_TOOL_NAME_MAX = 60;
|
|
27
|
+
/** The one line of the step that is running now. */
|
|
28
|
+
export declare const RUNNING_MARK = "\u23F3";
|
|
29
|
+
export declare const PREPARING_LINE: string;
|
|
30
|
+
/** The agent's newest line in a floating status (a 1:1 chat) is clipped to this. */
|
|
31
|
+
export declare const STATUS_NARRATION_MAX = 200;
|
|
32
|
+
export declare function preparationFailureLine(name: string, count?: number): string;
|
|
33
|
+
export declare class LiveView {
|
|
34
|
+
readonly lang: string;
|
|
35
|
+
/** A deployment's MCP servers, whose steps read as "Querying <name>". */
|
|
36
|
+
private readonly integrations;
|
|
37
|
+
/** The first line of every render (a subclass names what is working). */
|
|
38
|
+
header: string;
|
|
39
|
+
/** Setup is running: one transient line at the end. */
|
|
40
|
+
preparing: boolean;
|
|
41
|
+
private todos;
|
|
42
|
+
private blocks;
|
|
43
|
+
private running;
|
|
44
|
+
/** The newest step, and how often in a row it has started. */
|
|
45
|
+
private group;
|
|
46
|
+
constructor(lang?: string,
|
|
47
|
+
/** A deployment's MCP servers, whose steps read as "Querying <name>". */
|
|
48
|
+
integrations?: Integrations);
|
|
49
|
+
/** Fold one step in; true when what `render` returns changed. */
|
|
50
|
+
apply(step: Step): boolean;
|
|
51
|
+
/** Only a failed setup step gets here: one line per name, with a count. */
|
|
52
|
+
private loadFailed;
|
|
53
|
+
private start;
|
|
54
|
+
private finish;
|
|
55
|
+
private runningLine;
|
|
56
|
+
private failedText;
|
|
57
|
+
private preparingLine;
|
|
58
|
+
private paragraphs;
|
|
59
|
+
/**
|
|
60
|
+
* The view as the few short lines of a floating status: in a 1:1 chat (`private`) where the plan stands and the agent's
|
|
61
|
+
* newest line; in every chat a step that failed last and the step running now. A group sees no words of the agent's or
|
|
62
|
+
* of its plan: only the humanized step lines, which come from a fixed list. Nothing yet: [].
|
|
63
|
+
*/
|
|
64
|
+
statusLines(isPrivate: boolean): string[];
|
|
65
|
+
private privateLines;
|
|
66
|
+
render(): string;
|
|
67
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type JsonObject } from "./json.js";
|
|
2
|
+
export declare const TODO_TOOLS: ReadonlySet<string>;
|
|
3
|
+
export declare const TODO_STATUSES: readonly ["pending", "in_progress", "completed", "cancelled"];
|
|
4
|
+
export type TodoStatus = (typeof TODO_STATUSES)[number];
|
|
5
|
+
/** Items read from one event; a list longer than this is not a plan a person reads. */
|
|
6
|
+
export declare const TODO_MAX_ITEMS = 100;
|
|
7
|
+
/** One item is clipped to this: a phone shows about 40 characters a line. */
|
|
8
|
+
export declare const TODO_ITEM_MAX = 80;
|
|
9
|
+
/** A plan with more items than this is folded. */
|
|
10
|
+
export declare const TODO_FULL_MAX = 8;
|
|
11
|
+
/** A folded plan shows this many items in progress ... */
|
|
12
|
+
export declare const TODO_FOLD_ACTIVE = 2;
|
|
13
|
+
/** ... and this many of the ones that come next. */
|
|
14
|
+
export declare const TODO_FOLD_NEXT = 3;
|
|
15
|
+
export declare const TODO_MARKS: Readonly<Record<TodoStatus, string>>;
|
|
16
|
+
/** One item of the plan: its text (one clipped line) and its status. */
|
|
17
|
+
export type Todo = readonly [text: string, status: TodoStatus];
|
|
18
|
+
/** The plan's count line ("**Plan: 1 of 3 done**"), for the floating status too. */
|
|
19
|
+
export declare function planHead(lang: string, done: number, total: number): string;
|
|
20
|
+
/**
|
|
21
|
+
* The agent's list from a `todo_write` toolUsed event; undefined when the event says nothing about it (another tool, a
|
|
22
|
+
* call that failed, no list in the event). An empty list is a list: the agent cleared it. Malformed items are skipped,
|
|
23
|
+
* never raised: an item that is not an object or has no text; a status Brain does not know counts as pending.
|
|
24
|
+
*/
|
|
25
|
+
export declare function todosOf(tool: string, status: string, data: JsonObject): Todo[] | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* The plan as the live view shows it: a count line, then one paragraph per item. A plan of more than TODO_FULL_MAX items
|
|
28
|
+
* is folded to the last finished item, the ones in progress, the next few and one line that counts the rest. A plan that
|
|
29
|
+
* is all done is its count line alone; a list with nothing in it to do or done (empty, or all cancelled) is no plan: "".
|
|
30
|
+
*/
|
|
31
|
+
export declare function planText(todos: readonly Todo[], lang?: string): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the turn engine needs from the world: the calls of the ports other lines own that it makes (W0: Conversation,
|
|
3
|
+
* Clock; W2: the Claw sessions port). Nothing here knows Teams, HTTP or a card's JSON.
|
|
4
|
+
*/
|
|
5
|
+
import type { Clock } from "../ports/clock.js";
|
|
6
|
+
import type { ClawSessionsPort } from "../ports/claw/sessions.js";
|
|
7
|
+
import type { Conversation } from "../ports/surface.js";
|
|
8
|
+
/** Monotonic seconds of `clock`: the unit the turn's intervals are written in. */
|
|
9
|
+
export declare function nowSeconds(clock: Clock): number;
|
|
10
|
+
/** Sleep `seconds` of `clock`; rejects with the signal's reason when it is aborted. */
|
|
11
|
+
export declare function sleepSeconds(clock: Clock, seconds: number, signal?: AbortSignal): Promise<void>;
|
|
12
|
+
/** The conversation the turn answers in: the calls of the Conversation port it makes. */
|
|
13
|
+
export type TurnSurface = Pick<Conversation, "typing" | "send" | "post" | "update" | "delete" | "openStream" | "outgoing" | "deliver">;
|
|
14
|
+
/** The calls of Claw's sessions port a turn makes. */
|
|
15
|
+
export type TurnClaw = Pick<ClawSessionsPort, "create" | "sendMessage" | "setModel" | "lastEventId" | "turn" | "stream" | "uploadFiles" | "events" | "deliveryLink" | "changes">;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { OutMessage, SuggestedReply, UserRef } from "../../ports/surface.js";
|
|
2
|
+
export interface FinishOptions {
|
|
3
|
+
/** The parts are an answer: rich text with the markdown converted (the live edits stay plain markdown). */
|
|
4
|
+
readonly rich?: boolean;
|
|
5
|
+
/** The chat's thumbs go under the LAST part, and nowhere else. */
|
|
6
|
+
readonly feedback?: boolean;
|
|
7
|
+
/** The asker of a review in a group: their answer @mentions them, and only them. */
|
|
8
|
+
readonly mention?: UserRef | undefined;
|
|
9
|
+
/** What the agent wrote: the chat's AI label. */
|
|
10
|
+
readonly ai?: boolean;
|
|
11
|
+
/** Suggested replies under the last part. */
|
|
12
|
+
readonly replies?: readonly SuggestedReply[] | undefined;
|
|
13
|
+
}
|
|
14
|
+
/** A plain markdown message. */
|
|
15
|
+
export declare function plainMessage(text: string, ai?: boolean): OutMessage;
|
|
16
|
+
/**
|
|
17
|
+
* The messages that carry `parts`: each rich or markdown and, for an agent's answer, labelled as AI. Its links stay links
|
|
18
|
+
* and never become citations: an address the model wrote is not a source.
|
|
19
|
+
*/
|
|
20
|
+
export declare function answerMessages(parts: readonly string[], options: FinishOptions): OutMessage[];
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { Clock } from "../../ports/clock.js";
|
|
2
|
+
import type { Logger } from "../../ports/logger.js";
|
|
3
|
+
import { type Integrations } from "../../plugins/integrations.js";
|
|
4
|
+
import { type TurnSurface } from "../ports.js";
|
|
5
|
+
import type { Step } from "../step.js";
|
|
6
|
+
import { type FinishOptions } from "./answer-messages.js";
|
|
7
|
+
import { type StatusPolicy } from "./status-policy.js";
|
|
8
|
+
/** A Claw turn's status options: its view is a LiveView in the turn's language. */
|
|
9
|
+
export interface TurnStatusOptions extends Omit<StatusOptions<Step>, "policy"> {
|
|
10
|
+
/** The agent's text is streamed into the answer's bubble. */
|
|
11
|
+
readonly streamText?: boolean;
|
|
12
|
+
/** A deployment's MCP servers, named in progress lines. */
|
|
13
|
+
readonly integrations?: Integrations;
|
|
14
|
+
}
|
|
15
|
+
/** The status message of a Claw turn (`TurnStatusPolicy`). */
|
|
16
|
+
export declare function turnStatusMessage(surface: TurnSurface, options: TurnStatusOptions): StatusMessage<Step>;
|
|
17
|
+
/** The live view is edited at most this often (the chat throttles edits). */
|
|
18
|
+
export declare const LIVE_MIN_INTERVAL = 1.5;
|
|
19
|
+
/** Brain's setup shows one "Preparing" line only if it lasts this long. */
|
|
20
|
+
export declare const PREPARING_AFTER_SECONDS = 1.5;
|
|
21
|
+
/** The progress message is retired this long after the last progress edit: a late edit must not land on DONE_LINE. */
|
|
22
|
+
export declare const FINAL_SETTLE_SECONDS = 1;
|
|
23
|
+
/** ... and one that is late anyway is covered by sending DONE_LINE once more this long afterwards. */
|
|
24
|
+
export declare const REASSERT_SECONDS = 6;
|
|
25
|
+
/** The chat closes a stream this long after it opened; this one is closed by its final message before that. */
|
|
26
|
+
export declare const STREAM_CLOSE_SECONDS: number;
|
|
27
|
+
export interface StatusOptions<S> {
|
|
28
|
+
readonly clock: Clock;
|
|
29
|
+
readonly log: Logger;
|
|
30
|
+
readonly lang?: string;
|
|
31
|
+
/** What is shown of the turn's steps and words (a Claw turn's: `TurnStatusPolicy`, see `turnStatusMessage`). */
|
|
32
|
+
readonly policy: StatusPolicy<S>;
|
|
33
|
+
/** Shown at the top from the first post on (a review's acknowledgement). */
|
|
34
|
+
readonly lead?: string;
|
|
35
|
+
/** The person's message a live stream answers; undefined: no stream here (the progress message). */
|
|
36
|
+
readonly streamReplyTo?: string | undefined;
|
|
37
|
+
/** Every member sees the floating status: it carries no words of the agent's. */
|
|
38
|
+
readonly group?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export declare class StatusMessage<S> {
|
|
41
|
+
private readonly surface;
|
|
42
|
+
private readonly clock;
|
|
43
|
+
private readonly log;
|
|
44
|
+
private readonly lang;
|
|
45
|
+
private readonly policy;
|
|
46
|
+
private readonly lead;
|
|
47
|
+
private readonly group;
|
|
48
|
+
/** undefined: the progress message (no stream here, or the chat refused it). */
|
|
49
|
+
private stream;
|
|
50
|
+
/** The stream itself, kept after a refusal: it is still closed when it can be. */
|
|
51
|
+
private readonly live;
|
|
52
|
+
private posted;
|
|
53
|
+
private flusher;
|
|
54
|
+
private opening;
|
|
55
|
+
private expiry;
|
|
56
|
+
private again;
|
|
57
|
+
private preparingTimer;
|
|
58
|
+
private lastText;
|
|
59
|
+
private lastAt;
|
|
60
|
+
private begunAt;
|
|
61
|
+
private sending;
|
|
62
|
+
private closed;
|
|
63
|
+
/** When the last live progress edit left. */
|
|
64
|
+
private editedAt;
|
|
65
|
+
/** Brain's setup has started and no real step has followed yet. */
|
|
66
|
+
private preparing;
|
|
67
|
+
/** A line shown above the live view (a review's result). */
|
|
68
|
+
private headlineText;
|
|
69
|
+
/** The stream is being closed before the chat's limit ... */
|
|
70
|
+
private expiring;
|
|
71
|
+
/** ... and has been: the answer comes as a message of its own. */
|
|
72
|
+
private streamOver;
|
|
73
|
+
/** The turn was cancelled (`close(true)`). */
|
|
74
|
+
private hard;
|
|
75
|
+
constructor(surface: TurnSurface, options: StatusOptions<S>);
|
|
76
|
+
begin(): void;
|
|
77
|
+
private openStream;
|
|
78
|
+
/** The chat did not take the stream: the turn is shown by the progress message from here on. */
|
|
79
|
+
private fallBack;
|
|
80
|
+
private statusLines;
|
|
81
|
+
/** Close the stream with STILL_WORKING before the chat's limit; the answer, whenever it comes, is a message of its own. */
|
|
82
|
+
private closeInTime;
|
|
83
|
+
/** The chat's id of the posted message; undefined when the post failed or its id never came (nothing is edited then). */
|
|
84
|
+
private messageId;
|
|
85
|
+
/**
|
|
86
|
+
* Track Brain's setup. The first setup step starts a timer; if no real step has come by the time it fires,
|
|
87
|
+
* "Preparing…" is shown. A real step ends setup and retracts the line. Call it before `progress` for the same step.
|
|
88
|
+
*/
|
|
89
|
+
note(step: Step): void;
|
|
90
|
+
private stopPreparingTimer;
|
|
91
|
+
private announcePreparing;
|
|
92
|
+
/** Make sure the newest live view gets sent. */
|
|
93
|
+
private kick;
|
|
94
|
+
/** Show `line` above the live view from the next edit on (a review's result the moment the stream shows it). */
|
|
95
|
+
headline(line: string): void;
|
|
96
|
+
private render;
|
|
97
|
+
/** Fold the step into what is shown and make sure the newest of it gets sent. */
|
|
98
|
+
progress(step: S): void;
|
|
99
|
+
/** The text for the answer's bubble ('' when there is none); what was streamed when it no longer grows from that. */
|
|
100
|
+
private streamable;
|
|
101
|
+
/** Whether the turn is still shown by its stream (a refusal hands it to the progress message). */
|
|
102
|
+
private streaming;
|
|
103
|
+
private flush;
|
|
104
|
+
/**
|
|
105
|
+
* The newest status (or streamed text) to the stream, at most every LIVE_MIN_INTERVAL seconds. A request the chat
|
|
106
|
+
* refuses with 429 or 400 is skipped (the next one says the newer thing); any other refusal ends the stream.
|
|
107
|
+
*/
|
|
108
|
+
private flushStream;
|
|
109
|
+
private update;
|
|
110
|
+
/**
|
|
111
|
+
* Stop sending progress. A sleeping flusher is cancelled; one that is mid-send finishes that one send, unless the turn
|
|
112
|
+
* itself was cancelled (`hard`). A stream still open when the turn is cancelled is closed with INTERRUPTED, in the
|
|
113
|
+
* background (the floating status must not spin until the chat's limit).
|
|
114
|
+
*/
|
|
115
|
+
close(hard?: boolean): void;
|
|
116
|
+
private interrupt;
|
|
117
|
+
/**
|
|
118
|
+
* The turn is over: the user gets `parts`, in order. With a stream the first part is its final message (in the place
|
|
119
|
+
* of the status) and the others follow; without one they are NEW messages, and the progress message is then retired.
|
|
120
|
+
* The thumbs (`feedback`) and suggested replies go under the LAST part, and nowhere else.
|
|
121
|
+
*/
|
|
122
|
+
finish(parts: readonly string[], options?: FinishOptions): Promise<void>;
|
|
123
|
+
/** Stop the live view and wait for what is still on its way: the stream's opening, the last edit, a closing stream. */
|
|
124
|
+
private quiesce;
|
|
125
|
+
/**
|
|
126
|
+
* The stream opened and the chat later refused an update of it, so the progress message took over: the stream is still
|
|
127
|
+
* closed, with the first part of the answer when the chat takes that. Returns what is left to send as messages.
|
|
128
|
+
*/
|
|
129
|
+
private closeRefusedStream;
|
|
130
|
+
/**
|
|
131
|
+
* The stream's final message is the first part of the answer (the chat then draws its AI label and thumbs); the other
|
|
132
|
+
* parts follow as messages. A final the chat refuses is sent as a message of its own, so the answer is never lost.
|
|
133
|
+
*/
|
|
134
|
+
private finishStream;
|
|
135
|
+
/** Wait until FINAL_SETTLE_SECONDS have passed since the last progress edit left. */
|
|
136
|
+
private settle;
|
|
137
|
+
/**
|
|
138
|
+
* The answer is posted below: delete the progress message. The chat may refuse, and a queue cannot delete; the message
|
|
139
|
+
* is then edited down to one line, so it does not sit above the answer as stale progress. Never fails the turn.
|
|
140
|
+
*/
|
|
141
|
+
private retire;
|
|
142
|
+
/** Live edits went out, so one may still arrive after `message` replaced the progress message: send it once more. */
|
|
143
|
+
private reassert;
|
|
144
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a StatusMessage shows of a turn, and how it closes its live stream: injected, so that a turn of another kind (a
|
|
3
|
+
* remote agent's) shows its own steps and words through the same status message. `TurnStatusPolicy` is a Claw turn's.
|
|
4
|
+
*/
|
|
5
|
+
import type { OutMessage } from "../../ports/surface.js";
|
|
6
|
+
import { LiveView } from "../live-view.js";
|
|
7
|
+
import type { Step } from "../step.js";
|
|
8
|
+
import { type FinishOptions } from "./answer-messages.js";
|
|
9
|
+
/** The agent's text streamed into a bubble stops growing here; the answer still comes whole. */
|
|
10
|
+
export declare const STREAM_TEXT_MAX = 6000;
|
|
11
|
+
/** What a status message needs of a live view: its first line, its text, its status lines and the setup flag. */
|
|
12
|
+
export interface LiveViewLike {
|
|
13
|
+
readonly header: string;
|
|
14
|
+
/** Setup is running: one transient line at the end. */
|
|
15
|
+
preparing: boolean;
|
|
16
|
+
render(): string;
|
|
17
|
+
/** The view as a floating status's lines; `withWords`: the agent's own words and plan may be shown (a 1:1 chat). */
|
|
18
|
+
statusLines(withWords: boolean): string[];
|
|
19
|
+
}
|
|
20
|
+
/** Everything the stream's last message is decided from. */
|
|
21
|
+
export interface StreamFinishInput {
|
|
22
|
+
/** What the bubble shows now. */
|
|
23
|
+
readonly streamed: string;
|
|
24
|
+
/** What the policy would stream now (`streamable(streamed)`). */
|
|
25
|
+
readonly streamable: string;
|
|
26
|
+
/** The answer's messages as they would be sent without a stream. */
|
|
27
|
+
readonly messages: readonly OutMessage[];
|
|
28
|
+
readonly parts: readonly string[];
|
|
29
|
+
readonly options: FinishOptions;
|
|
30
|
+
}
|
|
31
|
+
/** The stream's final message, and what follows it as messages of their own. */
|
|
32
|
+
export interface StreamFinish {
|
|
33
|
+
readonly final: OutMessage;
|
|
34
|
+
readonly rest: readonly OutMessage[];
|
|
35
|
+
}
|
|
36
|
+
export interface StatusPolicy<S> {
|
|
37
|
+
readonly view: LiveViewLike;
|
|
38
|
+
/** Fold one step in; true when what is shown changed. */
|
|
39
|
+
applyStep(step: S): boolean;
|
|
40
|
+
/** The text the bubble should hold now, given what it shows (`streamed`); '' when there is nothing to stream. */
|
|
41
|
+
streamable(streamed: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* The final message when the bubble holds streamed text (`input.streamed` not ''); undefined: the default (the text
|
|
44
|
+
* as it stands, and the answer after it unless it ends with the answer).
|
|
45
|
+
*/
|
|
46
|
+
finishStream?(input: StreamFinishInput): StreamFinish | undefined;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The default way a stream that holds text closes: the final keeps all of it (the chat refuses a stream whose content
|
|
50
|
+
* shrinks). When it ends with the answer, that is the whole of it (thumbs and replies go on it); otherwise the answer
|
|
51
|
+
* follows as messages of its own.
|
|
52
|
+
*/
|
|
53
|
+
export declare function defaultStreamFinish(input: StreamFinishInput): StreamFinish;
|
|
54
|
+
/**
|
|
55
|
+
* A Claw turn's status: the LiveView of its steps, and with `streamText` the agent's whole model turns and the one being
|
|
56
|
+
* written, streamed into the answer's bubble up to STREAM_TEXT_MAX.
|
|
57
|
+
*/
|
|
58
|
+
export declare class TurnStatusPolicy implements StatusPolicy<Step> {
|
|
59
|
+
readonly view: LiveView;
|
|
60
|
+
private readonly streamText;
|
|
61
|
+
private readonly said;
|
|
62
|
+
private partial;
|
|
63
|
+
constructor(view: LiveView, streamText: boolean);
|
|
64
|
+
applyStep(step: Step): boolean;
|
|
65
|
+
streamable(streamed: string): string;
|
|
66
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** A status update is at most this many characters ... */
|
|
2
|
+
export declare const STATUS_MAX_CHARS = 1000;
|
|
3
|
+
/** ... and this many bytes of UTF-8. */
|
|
4
|
+
export declare const STATUS_MAX_BYTES = 1024;
|
|
5
|
+
export declare const STATUS_JOIN = " \u00B7 ";
|
|
6
|
+
/**
|
|
7
|
+
* Status lines as one status update: whitespace collapsed, the lines joined by " · ", cut to the limits by keeping the
|
|
8
|
+
* END (the newest) after a leading "…", never in the middle of a character's combining marks.
|
|
9
|
+
*/
|
|
10
|
+
export declare function statusText(lines: readonly string[]): string;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One live stream in reply to one user message, as the turn follows it: whether it is open, whether it can still be
|
|
3
|
+
* closed, what was streamed into it, and how old it is. The channel adapter behind `openStream` paces the requests and
|
|
4
|
+
* keeps one stream per conversation; this keeps the turn's view of it (the Python worker's `TeamsStream` state).
|
|
5
|
+
*/
|
|
6
|
+
import type { Clock } from "../../ports/clock.js";
|
|
7
|
+
import type { OutMessage, StreamRefused } from "../../ports/surface.js";
|
|
8
|
+
import { type Result } from "../../result.js";
|
|
9
|
+
import { type TurnSurface } from "../ports.js";
|
|
10
|
+
/** A refusal that leaves the stream usable: throttled (429), or this one update not taken (400). */
|
|
11
|
+
export declare function isPassing(refusal: StreamRefused): boolean;
|
|
12
|
+
export declare class StreamHandle {
|
|
13
|
+
private readonly surface;
|
|
14
|
+
private readonly replyTo;
|
|
15
|
+
private readonly clock;
|
|
16
|
+
private stream;
|
|
17
|
+
private broken;
|
|
18
|
+
private closed;
|
|
19
|
+
private openedAt;
|
|
20
|
+
/** The text streamed into the bubble so far ('' : only status so far). */
|
|
21
|
+
streamed: string;
|
|
22
|
+
constructor(surface: TurnSurface, replyTo: string, clock: Clock);
|
|
23
|
+
/** Updates can be sent: it opened, and neither failed nor closed. */
|
|
24
|
+
get open(): boolean;
|
|
25
|
+
/** A final message can still be tried: it opened and is not closed (a refused update leaves it closable). */
|
|
26
|
+
get closable(): boolean;
|
|
27
|
+
/** Seconds since it opened. */
|
|
28
|
+
age(): number;
|
|
29
|
+
/** Open it with its first status. */
|
|
30
|
+
start(status: string): Promise<Result<void, StreamRefused>>;
|
|
31
|
+
private refused;
|
|
32
|
+
private usable;
|
|
33
|
+
/** A new status (shown only until text is streamed). */
|
|
34
|
+
inform(status: string): Promise<Result<void, StreamRefused>>;
|
|
35
|
+
/** The streamed text so far: what was streamed before must be the start of it (the channel refuses anything else). */
|
|
36
|
+
emit(text: string): Promise<Result<void, StreamRefused>>;
|
|
37
|
+
/** Close it with `message`, the message that stays in the chat. */
|
|
38
|
+
final(message: OutMessage): Promise<Result<void, StreamRefused>>;
|
|
39
|
+
}
|