toolroll 0.5.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/LICENSE +21 -0
- package/README.md +1113 -0
- package/THIRD_PARTY_NOTICES.md +449 -0
- package/dist/accent-colors.d.ts +48 -0
- package/dist/accent-colors.js +122 -0
- package/dist/action-ledger.d.ts +26 -0
- package/dist/action-ledger.js +75 -0
- package/dist/agent-fence.d.ts +42 -0
- package/dist/agent-fence.js +183 -0
- package/dist/agentconfig.d.ts +216 -0
- package/dist/agentconfig.js +454 -0
- package/dist/api-tokens.d.ts +16 -0
- package/dist/api-tokens.js +27 -0
- package/dist/approval-policy.d.ts +69 -0
- package/dist/approval-policy.js +137 -0
- package/dist/approval-rules-ui.d.ts +25 -0
- package/dist/approval-rules-ui.js +39 -0
- package/dist/assignment-adapters.d.ts +180 -0
- package/dist/assignment-adapters.js +239 -0
- package/dist/assignment-brief.d.ts +71 -0
- package/dist/assignment-brief.js +129 -0
- package/dist/assignment-delivery.d.ts +56 -0
- package/dist/assignment-delivery.js +160 -0
- package/dist/assignment-presentation.d.ts +26 -0
- package/dist/assignment-presentation.js +80 -0
- package/dist/assignment-status.d.ts +62 -0
- package/dist/assignment-status.js +152 -0
- package/dist/assignment-ui.d.ts +71 -0
- package/dist/assignment-ui.js +103 -0
- package/dist/assignment.d.ts +222 -0
- package/dist/assignment.js +399 -0
- package/dist/attest.d.ts +56 -0
- package/dist/attest.js +153 -0
- package/dist/backend.d.ts +97 -0
- package/dist/backend.js +166 -0
- package/dist/backup-ui.d.ts +22 -0
- package/dist/backup-ui.js +59 -0
- package/dist/backup.d.ts +84 -0
- package/dist/backup.js +421 -0
- package/dist/beads.d.ts +34 -0
- package/dist/beads.js +135 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +22 -0
- package/dist/board.d.ts +150 -0
- package/dist/board.js +210 -0
- package/dist/boot-identity.d.ts +63 -0
- package/dist/boot-identity.js +99 -0
- package/dist/browser/THIRD_PARTY_NOTICES.txt +2295 -0
- package/dist/browser/workspace.css +4 -0
- package/dist/browser/workspace.js +225 -0
- package/dist/browser-crew.d.ts +11 -0
- package/dist/browser-crew.js +50 -0
- package/dist/browser-shell.d.ts +8 -0
- package/dist/browser-shell.js +60 -0
- package/dist/browser-workspace.d.ts +780 -0
- package/dist/browser-workspace.js +47 -0
- package/dist/budget-alerts.d.ts +19 -0
- package/dist/budget-alerts.js +46 -0
- package/dist/builder.d.ts +370 -0
- package/dist/builder.js +3262 -0
- package/dist/capscan.d.ts +35 -0
- package/dist/capscan.js +113 -0
- package/dist/chat-acceptance.d.ts +71 -0
- package/dist/chat-acceptance.js +120 -0
- package/dist/chat-actions.d.ts +265 -0
- package/dist/chat-actions.js +1273 -0
- package/dist/chat-channel.d.ts +109 -0
- package/dist/chat-channel.js +652 -0
- package/dist/chat-continuity.d.ts +32 -0
- package/dist/chat-continuity.js +317 -0
- package/dist/chat-controls.d.ts +113 -0
- package/dist/chat-controls.js +53 -0
- package/dist/chat-delivery-state.d.ts +159 -0
- package/dist/chat-delivery-state.js +309 -0
- package/dist/chat-delivery.d.ts +38 -0
- package/dist/chat-delivery.js +693 -0
- package/dist/chat-display.d.ts +1 -0
- package/dist/chat-display.js +18 -0
- package/dist/chat-evidence.d.ts +123 -0
- package/dist/chat-evidence.js +207 -0
- package/dist/chat-flow.d.ts +44 -0
- package/dist/chat-flow.js +215 -0
- package/dist/chat-inbox.d.ts +57 -0
- package/dist/chat-inbox.js +123 -0
- package/dist/chat-polish.d.ts +16 -0
- package/dist/chat-polish.js +135 -0
- package/dist/chat-review.d.ts +46 -0
- package/dist/chat-review.js +98 -0
- package/dist/chat-rooms.d.ts +123 -0
- package/dist/chat-rooms.js +216 -0
- package/dist/chat-task-actions.d.ts +44 -0
- package/dist/chat-task-actions.js +79 -0
- package/dist/check-progress.d.ts +51 -0
- package/dist/check-progress.js +290 -0
- package/dist/child-database.d.ts +12 -0
- package/dist/child-database.js +30 -0
- package/dist/claim.d.ts +688 -0
- package/dist/claim.js +1740 -0
- package/dist/cli.d.ts +137 -0
- package/dist/cli.js +1461 -0
- package/dist/codex-limits.d.ts +15 -0
- package/dist/codex-limits.js +145 -0
- package/dist/coding-context.d.ts +55 -0
- package/dist/coding-context.js +92 -0
- package/dist/coding-handoff.d.ts +57 -0
- package/dist/coding-handoff.js +277 -0
- package/dist/coding-provider.d.ts +72 -0
- package/dist/coding-provider.js +424 -0
- package/dist/coding-shipping-ui.d.ts +4 -0
- package/dist/coding-shipping-ui.js +12 -0
- package/dist/coding-types.d.ts +62 -0
- package/dist/coding-types.js +1 -0
- package/dist/coding-ui.d.ts +17 -0
- package/dist/coding-ui.js +364 -0
- package/dist/coding-update.d.ts +15 -0
- package/dist/coding-update.js +149 -0
- package/dist/coding-workspace.d.ts +124 -0
- package/dist/coding-workspace.js +768 -0
- package/dist/container-state.d.ts +5 -0
- package/dist/container-state.js +62 -0
- package/dist/containment.d.ts +197 -0
- package/dist/containment.js +559 -0
- package/dist/contest.d.ts +318 -0
- package/dist/contest.js +753 -0
- package/dist/control-setup.d.ts +35 -0
- package/dist/control-setup.js +40 -0
- package/dist/control-ui.d.ts +29 -0
- package/dist/control-ui.js +53 -0
- package/dist/controller-service.d.ts +1 -0
- package/dist/controller-service.js +19 -0
- package/dist/controller-supervisor.d.ts +30 -0
- package/dist/controller-supervisor.js +104 -0
- package/dist/converse.d.ts +304 -0
- package/dist/converse.js +849 -0
- package/dist/coordinator-proposals.d.ts +29 -0
- package/dist/coordinator-proposals.js +137 -0
- package/dist/coordinator.d.ts +186 -0
- package/dist/coordinator.js +447 -0
- package/dist/credentials-ui.d.ts +25 -0
- package/dist/credentials-ui.js +48 -0
- package/dist/daemon.d.ts +209 -0
- package/dist/daemon.js +604 -0
- package/dist/decision.d.ts +120 -0
- package/dist/decision.js +388 -0
- package/dist/demo.d.ts +55 -0
- package/dist/demo.js +992 -0
- package/dist/desktop-access.d.ts +28 -0
- package/dist/desktop-access.js +88 -0
- package/dist/desktop-bundle.d.ts +16 -0
- package/dist/desktop-bundle.js +74 -0
- package/dist/desktop-host.d.ts +54 -0
- package/dist/desktop-host.js +508 -0
- package/dist/desktop-update-gate.d.ts +12 -0
- package/dist/desktop-update-gate.js +91 -0
- package/dist/desktop-update-recovery.d.ts +14 -0
- package/dist/desktop-update-recovery.js +243 -0
- package/dist/desktop-update.d.ts +110 -0
- package/dist/desktop-update.js +740 -0
- package/dist/discord-api.d.ts +20 -0
- package/dist/discord-api.js +138 -0
- package/dist/discord-chat.d.ts +16 -0
- package/dist/discord-chat.js +381 -0
- package/dist/discord-settings.d.ts +7 -0
- package/dist/discord-settings.js +75 -0
- package/dist/discord.d.ts +10 -0
- package/dist/discord.js +169 -0
- package/dist/discover.d.ts +75 -0
- package/dist/discover.js +150 -0
- package/dist/dispatch.d.ts +100 -0
- package/dist/dispatch.js +311 -0
- package/dist/dispose.d.ts +161 -0
- package/dist/dispose.js +803 -0
- package/dist/email-settings.d.ts +34 -0
- package/dist/email-settings.js +50 -0
- package/dist/envelope.d.ts +47 -0
- package/dist/envelope.js +105 -0
- package/dist/evidence-pack.d.ts +185 -0
- package/dist/evidence-pack.js +258 -0
- package/dist/evidence.d.ts +345 -0
- package/dist/evidence.js +782 -0
- package/dist/exec.d.ts +285 -0
- package/dist/exec.js +1841 -0
- package/dist/exhaustion.d.ts +85 -0
- package/dist/exhaustion.js +141 -0
- package/dist/export-ui.d.ts +4 -0
- package/dist/export-ui.js +17 -0
- package/dist/export.d.ts +48 -0
- package/dist/export.js +305 -0
- package/dist/flow-actions.d.ts +77 -0
- package/dist/flow-actions.js +203 -0
- package/dist/flow-code.d.ts +50 -0
- package/dist/flow-code.js +159 -0
- package/dist/flow-draft.d.ts +38 -0
- package/dist/flow-draft.js +80 -0
- package/dist/flow-engine.d.ts +66 -0
- package/dist/flow-engine.js +416 -0
- package/dist/flow-insights.d.ts +95 -0
- package/dist/flow-insights.js +149 -0
- package/dist/flow-live.d.ts +24 -0
- package/dist/flow-live.js +150 -0
- package/dist/flow-people.d.ts +24 -0
- package/dist/flow-people.js +91 -0
- package/dist/flow-replies.d.ts +48 -0
- package/dist/flow-replies.js +113 -0
- package/dist/flow-scripts.d.ts +38 -0
- package/dist/flow-scripts.js +73 -0
- package/dist/flow-secrets.d.ts +13 -0
- package/dist/flow-secrets.js +45 -0
- package/dist/flow-sort.d.ts +82 -0
- package/dist/flow-sort.js +153 -0
- package/dist/flow-steps.d.ts +40 -0
- package/dist/flow-steps.js +408 -0
- package/dist/flow-triggers.d.ts +244 -0
- package/dist/flow-triggers.js +959 -0
- package/dist/flows-ui.d.ts +20 -0
- package/dist/flows-ui.js +175 -0
- package/dist/flows.d.ts +229 -0
- package/dist/flows.js +968 -0
- package/dist/fonts.d.ts +19 -0
- package/dist/fonts.js +19 -0
- package/dist/gaps.d.ts +35 -0
- package/dist/gaps.js +101 -0
- package/dist/gate-failure.d.ts +40 -0
- package/dist/gate-failure.js +66 -0
- package/dist/git.d.ts +54 -0
- package/dist/git.js +94 -0
- package/dist/google-mail.d.ts +58 -0
- package/dist/google-mail.js +151 -0
- package/dist/grant.d.ts +136 -0
- package/dist/grant.js +238 -0
- package/dist/graph.d.ts +164 -0
- package/dist/graph.js +383 -0
- package/dist/guides.d.ts +22 -0
- package/dist/guides.js +363 -0
- package/dist/held.d.ts +150 -0
- package/dist/held.js +799 -0
- package/dist/invoke.d.ts +112 -0
- package/dist/invoke.js +780 -0
- package/dist/issues.d.ts +41 -0
- package/dist/issues.js +131 -0
- package/dist/job-object-helper.ps1 +252 -0
- package/dist/jsonl-discriminants.d.ts +11 -0
- package/dist/jsonl-discriminants.js +93 -0
- package/dist/keys.d.ts +104 -0
- package/dist/keys.js +229 -0
- package/dist/kits-ui.d.ts +17 -0
- package/dist/kits-ui.js +46 -0
- package/dist/kits.d.ts +86 -0
- package/dist/kits.js +215 -0
- package/dist/knowledge-cli.d.ts +101 -0
- package/dist/knowledge-cli.js +92 -0
- package/dist/knowledge-ui.d.ts +24 -0
- package/dist/knowledge-ui.js +40 -0
- package/dist/lead-context.d.ts +8 -0
- package/dist/lead-context.js +56 -0
- package/dist/lead-follow.d.ts +22 -0
- package/dist/lead-follow.js +167 -0
- package/dist/lead-status.d.ts +75 -0
- package/dist/lead-status.js +285 -0
- package/dist/ledger-chain.d.ts +46 -0
- package/dist/ledger-chain.js +187 -0
- package/dist/ledger-csv.d.ts +4 -0
- package/dist/ledger-csv.js +11 -0
- package/dist/ledger-view.d.ts +24 -0
- package/dist/ledger-view.js +58 -0
- package/dist/limits-ui.d.ts +26 -0
- package/dist/limits-ui.js +67 -0
- package/dist/link.d.ts +72 -0
- package/dist/link.js +217 -0
- package/dist/live.d.ts +96 -0
- package/dist/live.js +366 -0
- package/dist/liveness.d.ts +30 -0
- package/dist/liveness.js +42 -0
- package/dist/log.d.ts +7 -0
- package/dist/log.js +25 -0
- package/dist/mailbox.d.ts +57 -0
- package/dist/mailbox.js +150 -0
- package/dist/maintenance.d.ts +11 -0
- package/dist/maintenance.js +35 -0
- package/dist/mate-cli.d.ts +52 -0
- package/dist/mate-cli.js +345 -0
- package/dist/mate-contract.d.ts +10 -0
- package/dist/mate-contract.js +30 -0
- package/dist/mate-doors.d.ts +69 -0
- package/dist/mate-doors.js +548 -0
- package/dist/mate-progress.d.ts +29 -0
- package/dist/mate-progress.js +121 -0
- package/dist/mate-tools.d.ts +94 -0
- package/dist/mate-tools.js +1878 -0
- package/dist/mate.d.ts +92 -0
- package/dist/mate.js +435 -0
- package/dist/mcp-connect.d.ts +103 -0
- package/dist/mcp-connect.js +252 -0
- package/dist/mcp.d.ts +27 -0
- package/dist/mcp.js +651 -0
- package/dist/memory-cli.d.ts +466 -0
- package/dist/memory-cli.js +111 -0
- package/dist/memory-pass.d.ts +160 -0
- package/dist/memory-pass.js +409 -0
- package/dist/metrics.d.ts +3 -0
- package/dist/metrics.js +56 -0
- package/dist/mobile-viewport.d.ts +3 -0
- package/dist/mobile-viewport.js +37 -0
- package/dist/model-catalog.d.ts +118 -0
- package/dist/model-catalog.js +376 -0
- package/dist/models-cli.d.ts +102 -0
- package/dist/models-cli.js +66 -0
- package/dist/models-ui.d.ts +34 -0
- package/dist/models-ui.js +68 -0
- package/dist/modes.d.ts +80 -0
- package/dist/modes.js +182 -0
- package/dist/monitoring-settings.d.ts +44 -0
- package/dist/monitoring-settings.js +173 -0
- package/dist/monitoring-ui.d.ts +20 -0
- package/dist/monitoring-ui.js +51 -0
- package/dist/monitoring.d.ts +34 -0
- package/dist/monitoring.js +221 -0
- package/dist/names.d.ts +67 -0
- package/dist/names.js +102 -0
- package/dist/observations.d.ts +40 -0
- package/dist/observations.js +211 -0
- package/dist/oidc.d.ts +71 -0
- package/dist/oidc.js +182 -0
- package/dist/onboard.d.ts +108 -0
- package/dist/onboard.js +325 -0
- package/dist/openrouter-models.d.ts +30 -0
- package/dist/openrouter-models.js +120 -0
- package/dist/operate.d.ts +118 -0
- package/dist/operate.js +11321 -0
- package/dist/peek-cli.d.ts +97 -0
- package/dist/peek-cli.js +215 -0
- package/dist/peek.d.ts +134 -0
- package/dist/peek.js +578 -0
- package/dist/phase-routing.d.ts +307 -0
- package/dist/phase-routing.js +658 -0
- package/dist/plan-auto.d.ts +14 -0
- package/dist/plan-auto.js +92 -0
- package/dist/plan.d.ts +186 -0
- package/dist/plan.js +401 -0
- package/dist/planner-source.d.ts +251 -0
- package/dist/planner-source.js +460 -0
- package/dist/planner.d.ts +75 -0
- package/dist/planner.js +992 -0
- package/dist/policy-ui.d.ts +20 -0
- package/dist/policy-ui.js +41 -0
- package/dist/policy.d.ts +111 -0
- package/dist/policy.js +231 -0
- package/dist/prepared-evidence.d.ts +16 -0
- package/dist/prepared-evidence.js +96 -0
- package/dist/pricing.d.ts +45 -0
- package/dist/pricing.js +77 -0
- package/dist/principal.d.ts +42 -0
- package/dist/principal.js +82 -0
- package/dist/probe.d.ts +46 -0
- package/dist/probe.js +79 -0
- package/dist/process-custody.d.ts +17 -0
- package/dist/process-custody.js +91 -0
- package/dist/process-liveness.d.ts +10 -0
- package/dist/process-liveness.js +81 -0
- package/dist/process-recovery-anchor.d.ts +75 -0
- package/dist/process-recovery-anchor.js +188 -0
- package/dist/process-recovery-coalition.d.ts +25 -0
- package/dist/process-recovery-coalition.js +105 -0
- package/dist/process-recovery-eligibility.d.ts +178 -0
- package/dist/process-recovery-eligibility.js +170 -0
- package/dist/process-recovery-native.d.ts +172 -0
- package/dist/process-recovery-native.js +592 -0
- package/dist/process-recovery-provenance.d.ts +163 -0
- package/dist/process-recovery-provenance.js +292 -0
- package/dist/process-recovery-services.d.ts +56 -0
- package/dist/process-recovery-services.js +191 -0
- package/dist/process-recovery-settlement.d.ts +32 -0
- package/dist/process-recovery-settlement.js +132 -0
- package/dist/process-recovery.d.ts +41 -0
- package/dist/process-recovery.js +91 -0
- package/dist/process-tree.d.ts +41 -0
- package/dist/process-tree.js +264 -0
- package/dist/project-access.d.ts +14 -0
- package/dist/project-access.js +34 -0
- package/dist/project-cli.d.ts +18 -0
- package/dist/project-cli.js +104 -0
- package/dist/project-delete-ui.d.ts +22 -0
- package/dist/project-delete-ui.js +48 -0
- package/dist/project-delete.d.ts +55 -0
- package/dist/project-delete.js +413 -0
- package/dist/project-knowledge.d.ts +111 -0
- package/dist/project-knowledge.js +241 -0
- package/dist/project-learning.d.ts +100 -0
- package/dist/project-learning.js +438 -0
- package/dist/project-memory.d.ts +81 -0
- package/dist/project-memory.js +264 -0
- package/dist/project-skills.d.ts +152 -0
- package/dist/project-skills.js +660 -0
- package/dist/project-tools.d.ts +219 -0
- package/dist/project-tools.js +796 -0
- package/dist/project.d.ts +61 -0
- package/dist/project.js +125 -0
- package/dist/prompt.d.ts +22 -0
- package/dist/prompt.js +72 -0
- package/dist/proof.d.ts +513 -0
- package/dist/proof.js +1140 -0
- package/dist/proposal.d.ts +82 -0
- package/dist/proposal.js +210 -0
- package/dist/provider-connection.d.ts +22 -0
- package/dist/provider-connection.js +98 -0
- package/dist/provider-limits.d.ts +35 -0
- package/dist/provider-limits.js +95 -0
- package/dist/provider.d.ts +279 -0
- package/dist/provider.js +935 -0
- package/dist/publish.d.ts +107 -0
- package/dist/publish.js +650 -0
- package/dist/pulls.d.ts +118 -0
- package/dist/pulls.js +240 -0
- package/dist/push.d.ts +95 -0
- package/dist/push.js +353 -0
- package/dist/quality.d.ts +8 -0
- package/dist/quality.js +6 -0
- package/dist/recipe-ui.d.ts +18 -0
- package/dist/recipe-ui.js +152 -0
- package/dist/recipes.d.ts +81 -0
- package/dist/recipes.js +332 -0
- package/dist/remote.d.ts +67 -0
- package/dist/remote.js +122 -0
- package/dist/render.d.ts +64 -0
- package/dist/render.js +587 -0
- package/dist/report-summary.d.ts +13 -0
- package/dist/report-summary.js +15 -0
- package/dist/repos.d.ts +65 -0
- package/dist/repos.js +277 -0
- package/dist/repository-context-ui.d.ts +2 -0
- package/dist/repository-context-ui.js +10 -0
- package/dist/repository-context.d.ts +67 -0
- package/dist/repository-context.js +376 -0
- package/dist/restart-certification.d.ts +134 -0
- package/dist/restart-certification.js +226 -0
- package/dist/result-actions.d.ts +28 -0
- package/dist/result-actions.js +270 -0
- package/dist/result-completion.d.ts +18 -0
- package/dist/result-completion.js +66 -0
- package/dist/result-review.d.ts +213 -0
- package/dist/result-review.js +430 -0
- package/dist/retention-ui.d.ts +12 -0
- package/dist/retention-ui.js +39 -0
- package/dist/retention.d.ts +72 -0
- package/dist/retention.js +288 -0
- package/dist/review-context.d.ts +243 -0
- package/dist/review-context.js +1043 -0
- package/dist/review-evidence.d.ts +33 -0
- package/dist/review-evidence.js +56 -0
- package/dist/reviewer.d.ts +97 -0
- package/dist/reviewer.js +202 -0
- package/dist/routine.d.ts +228 -0
- package/dist/routine.js +764 -0
- package/dist/runner.d.ts +266 -0
- package/dist/runner.js +399 -0
- package/dist/scan.d.ts +32 -0
- package/dist/scan.js +92 -0
- package/dist/scope.d.ts +695 -0
- package/dist/scope.js +1176 -0
- package/dist/scout-report.d.ts +42 -0
- package/dist/scout-report.js +108 -0
- package/dist/scout.d.ts +69 -0
- package/dist/scout.js +351 -0
- package/dist/serve.d.ts +313 -0
- package/dist/serve.js +21776 -0
- package/dist/session-brief.d.ts +8 -0
- package/dist/session-brief.js +24 -0
- package/dist/session-cli.d.ts +13 -0
- package/dist/session-cli.js +284 -0
- package/dist/session-contract.d.ts +183 -0
- package/dist/session-contract.js +122 -0
- package/dist/session-http.d.ts +19 -0
- package/dist/session-http.js +154 -0
- package/dist/session-server.d.ts +12 -0
- package/dist/session-server.js +37 -0
- package/dist/session-service.d.ts +22 -0
- package/dist/session-service.js +157 -0
- package/dist/setup-guide.d.ts +39 -0
- package/dist/setup-guide.js +93 -0
- package/dist/sign-in-guard.d.ts +45 -0
- package/dist/sign-in-guard.js +74 -0
- package/dist/skills-ui.d.ts +11 -0
- package/dist/skills-ui.js +58 -0
- package/dist/skills.d.ts +97 -0
- package/dist/skills.js +276 -0
- package/dist/slack-api.d.ts +55 -0
- package/dist/slack-api.js +229 -0
- package/dist/slack-chat.d.ts +28 -0
- package/dist/slack-chat.js +413 -0
- package/dist/slack-settings.d.ts +7 -0
- package/dist/slack-settings.js +75 -0
- package/dist/slack-state.d.ts +13 -0
- package/dist/slack-state.js +9 -0
- package/dist/slack.d.ts +13 -0
- package/dist/slack.js +167 -0
- package/dist/spend-ui.d.ts +28 -0
- package/dist/spend-ui.js +95 -0
- package/dist/spend.d.ts +142 -0
- package/dist/spend.js +313 -0
- package/dist/sqlite-runtime.d.ts +3 -0
- package/dist/sqlite-runtime.js +6 -0
- package/dist/sso-settings.d.ts +33 -0
- package/dist/sso-settings.js +103 -0
- package/dist/sso-ui.d.ts +22 -0
- package/dist/sso-ui.js +39 -0
- package/dist/storage.d.ts +15 -0
- package/dist/storage.js +84 -0
- package/dist/store.d.ts +7754 -0
- package/dist/store.js +23279 -0
- package/dist/structured-output.d.ts +58 -0
- package/dist/structured-output.js +103 -0
- package/dist/style-asset.d.ts +7 -0
- package/dist/style-asset.js +41 -0
- package/dist/subscription-chat.d.ts +46 -0
- package/dist/subscription-chat.js +275 -0
- package/dist/summary.d.ts +33 -0
- package/dist/summary.js +71 -0
- package/dist/supervisor.mjs +297 -0
- package/dist/surface.d.ts +63 -0
- package/dist/surface.js +352 -0
- package/dist/sync.d.ts +94 -0
- package/dist/sync.js +279 -0
- package/dist/task-composer.d.ts +13 -0
- package/dist/task-composer.js +52 -0
- package/dist/task-control.d.ts +165 -0
- package/dist/task-control.js +214 -0
- package/dist/task-outcome-cli.d.ts +10 -0
- package/dist/task-outcome-cli.js +92 -0
- package/dist/task-text.d.ts +30 -0
- package/dist/task-text.js +41 -0
- package/dist/team-cli.d.ts +15 -0
- package/dist/team-cli.js +618 -0
- package/dist/team-contract.d.ts +92 -0
- package/dist/team-contract.js +1 -0
- package/dist/team-http.d.ts +17 -0
- package/dist/team-http.js +144 -0
- package/dist/team-leads.d.ts +81 -0
- package/dist/team-leads.js +565 -0
- package/dist/team-runtime.d.ts +27 -0
- package/dist/team-runtime.js +264 -0
- package/dist/team-ui.d.ts +3 -0
- package/dist/team-ui.js +9 -0
- package/dist/team-updates.d.ts +8 -0
- package/dist/team-updates.js +57 -0
- package/dist/teammate-admin.d.ts +53 -0
- package/dist/teammate-admin.js +111 -0
- package/dist/teammate-desk.d.ts +60 -0
- package/dist/teammate-desk.js +154 -0
- package/dist/teammate-memory.d.ts +64 -0
- package/dist/teammate-memory.js +196 -0
- package/dist/teammate-question.d.ts +59 -0
- package/dist/teammate-question.js +175 -0
- package/dist/teammate-tools.d.ts +108 -0
- package/dist/teammate-tools.js +271 -0
- package/dist/teammate-week.d.ts +68 -0
- package/dist/teammate-week.js +132 -0
- package/dist/teammate-work.d.ts +76 -0
- package/dist/teammate-work.js +280 -0
- package/dist/teammates-ui.d.ts +20 -0
- package/dist/teammates-ui.js +166 -0
- package/dist/teammates.d.ts +180 -0
- package/dist/teammates.js +253 -0
- package/dist/teams-api.d.ts +33 -0
- package/dist/teams-api.js +204 -0
- package/dist/teams-chat.d.ts +26 -0
- package/dist/teams-chat.js +215 -0
- package/dist/teams-settings.d.ts +12 -0
- package/dist/teams-settings.js +57 -0
- package/dist/teams.d.ts +21 -0
- package/dist/teams.js +124 -0
- package/dist/telegram-flow.d.ts +49 -0
- package/dist/telegram-flow.js +110 -0
- package/dist/telegram-mate.d.ts +137 -0
- package/dist/telegram-mate.js +707 -0
- package/dist/telegram-progress.d.ts +14 -0
- package/dist/telegram-progress.js +129 -0
- package/dist/telegram-settings.d.ts +9 -0
- package/dist/telegram-settings.js +36 -0
- package/dist/telegram-status.d.ts +75 -0
- package/dist/telegram-status.js +265 -0
- package/dist/telegram-team.d.ts +85 -0
- package/dist/telegram-team.js +359 -0
- package/dist/telegram.d.ts +230 -0
- package/dist/telegram.js +1931 -0
- package/dist/templates.d.ts +65 -0
- package/dist/templates.js +118 -0
- package/dist/tool-launcher.d.ts +1 -0
- package/dist/tool-launcher.js +101 -0
- package/dist/tools-ui.d.ts +30 -0
- package/dist/tools-ui.js +40 -0
- package/dist/transitions-recipes.d.ts +1 -0
- package/dist/transitions-recipes.js +203 -0
- package/dist/tree-proof.d.ts +34 -0
- package/dist/tree-proof.js +58 -0
- package/dist/verification-evidence.d.ts +44 -0
- package/dist/verification-evidence.js +238 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +10 -0
- package/dist/webhooks.d.ts +91 -0
- package/dist/webhooks.js +283 -0
- package/dist/work-index.d.ts +68 -0
- package/dist/work-index.js +384 -0
- package/dist/work-summary.d.ts +57 -0
- package/dist/work-summary.js +116 -0
- package/dist/workspace-motion.d.ts +4 -0
- package/dist/workspace-motion.js +133 -0
- package/dist/workspace-revision.d.ts +19 -0
- package/dist/workspace-revision.js +92 -0
- package/dist/workspace-ui.d.ts +204 -0
- package/dist/workspace-ui.js +411 -0
- package/dist/worktree-notices.d.ts +13 -0
- package/dist/worktree-notices.js +17 -0
- package/dist/worktree.d.ts +249 -0
- package/dist/worktree.js +720 -0
- package/package.json +122 -0
- package/scripts/canary-assertions.mjs +42 -0
- package/scripts/crash-canary.mjs +253 -0
- package/scripts/fixtures/crash-process.mjs +74 -0
- package/scripts/fixtures/pilot-scenarios.mjs +85 -0
- package/scripts/fixtures/restart-service.mjs +27 -0
- package/scripts/launchd-certification.mjs +143 -0
- package/scripts/pilot.mjs +121 -0
- package/scripts/proof-preflight.mjs +140 -0
- package/scripts/provider-canary.mjs +379 -0
- package/scripts/recovery-canary.mjs +135 -0
- package/scripts/restart-certification.mjs +98 -0
package/dist/teams.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/** Microsoft Teams: the leased delivery loop hosted by the ordinary worker,
|
|
2
|
+
* and the HTTPS receiver the console mounts for the Bot Framework. Teams
|
|
3
|
+
* has no client-initiated socket, so inbound activities arrive over HTTPS
|
|
4
|
+
* and everything else runs from the database like the other channels. */
|
|
5
|
+
import { randomBytes } from "node:crypto";
|
|
6
|
+
import { setTimeout as sleep } from "node:timers/promises";
|
|
7
|
+
import { ChatState } from "./chat-delivery-state.js";
|
|
8
|
+
import { chatObject as object } from "./chat-delivery.js";
|
|
9
|
+
import { loadTeamsCredentials, teamsAccessToken, teamsApi, verifyTeamsToken, TeamsError } from "./teams-api.js";
|
|
10
|
+
import { deliverTeamsPart, planTeamsNotifications, planTeamsRooms, processTeamsEvent, receiveTeams } from "./teams-chat.js";
|
|
11
|
+
export const TEAMS_ACTIVITY_BYTES = 64 * 1024;
|
|
12
|
+
export const TEAMS_MESSAGES_PATH = "/teams/messages";
|
|
13
|
+
/** The receiver: prove the Bot Framework token for this app, save the activity, acknowledge. Nothing runs here. */
|
|
14
|
+
export async function handleTeamsHttp(request, response, options) {
|
|
15
|
+
const url = new URL(request.url ?? "/", "http://standing-orders.local");
|
|
16
|
+
if (url.pathname !== TEAMS_MESSAGES_PATH)
|
|
17
|
+
return false;
|
|
18
|
+
const reply = (status, body = "{}") => { response.writeHead(status, { "content-type": "application/json; charset=utf-8", "cache-control": "no-store" }); response.end(body); request.resume(); return true; };
|
|
19
|
+
if (request.method !== "POST")
|
|
20
|
+
return reply(405);
|
|
21
|
+
const credentials = loadTeamsCredentials(options.dir);
|
|
22
|
+
if (credentials === null)
|
|
23
|
+
return reply(404);
|
|
24
|
+
const claims = await verifyTeamsToken(request.headers.authorization, credentials.app, options.fetcher ?? fetch);
|
|
25
|
+
if (claims === null)
|
|
26
|
+
return reply(401);
|
|
27
|
+
if (Number(request.headers["content-length"] ?? 0) > TEAMS_ACTIVITY_BYTES)
|
|
28
|
+
return reply(413);
|
|
29
|
+
let raw = "";
|
|
30
|
+
try {
|
|
31
|
+
await new Promise((resolve, reject) => {
|
|
32
|
+
request.setEncoding("utf8");
|
|
33
|
+
request.on("data", (chunk) => { raw += chunk; if (raw.length > TEAMS_ACTIVITY_BYTES)
|
|
34
|
+
reject(new Error("too-large")); });
|
|
35
|
+
request.on("end", resolve);
|
|
36
|
+
request.on("error", reject);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
return reply(error instanceof Error && error.message === "too-large" ? 413 : 400);
|
|
41
|
+
}
|
|
42
|
+
let activity;
|
|
43
|
+
try {
|
|
44
|
+
activity = JSON.parse(raw);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return reply(400);
|
|
48
|
+
}
|
|
49
|
+
const state = new ChatState(options.store, "teams");
|
|
50
|
+
try {
|
|
51
|
+
receiveTeams(state, credentials, activity, claims.serviceUrl, options.clock?.() ?? new Date());
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return reply(500, JSON.stringify({ error: "not saved" }));
|
|
55
|
+
}
|
|
56
|
+
// Teams expects 200 for a handled activity; an unhandled shape is also 200,
|
|
57
|
+
// so that a stranger learns nothing from the answer.
|
|
58
|
+
return reply(200);
|
|
59
|
+
}
|
|
60
|
+
/** The worker-side loop: a lease per installation, one pass a second. */
|
|
61
|
+
export async function followTeams(options) {
|
|
62
|
+
const owner = randomBytes(16).toString("hex"), state = new ChatState(options.store, "teams");
|
|
63
|
+
const pause = async (ms) => { try {
|
|
64
|
+
await sleep(ms, undefined, { signal: options.signal });
|
|
65
|
+
}
|
|
66
|
+
catch { /* shutdown */ } };
|
|
67
|
+
while (!options.signal.aborted) {
|
|
68
|
+
const credentials = loadTeamsCredentials(options.dir);
|
|
69
|
+
if (!credentials || !state.lease(credentials.installation, owner, new Date())) {
|
|
70
|
+
await pause(2000);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
let alive = true;
|
|
74
|
+
const same = () => {
|
|
75
|
+
const current = loadTeamsCredentials(options.dir);
|
|
76
|
+
return alive && !options.signal.aborted && current?.installation === credentials.installation && current.secret === credentials.secret && state.owns(credentials.installation, owner);
|
|
77
|
+
};
|
|
78
|
+
const problem = (message) => state.prepare("UPDATE chat_runtime SET problem=? WHERE installation=? AND owner=?").run(message, credentials.installation, owner);
|
|
79
|
+
const stop = () => { alive = false; };
|
|
80
|
+
options.signal.addEventListener("abort", stop, { once: true });
|
|
81
|
+
const heartbeat = setInterval(() => { if (!same() || !state.lease(credentials.installation, owner, new Date()))
|
|
82
|
+
stop(); }, 10_000);
|
|
83
|
+
const chat = { ...options, identity: credentials, owner, api: teamsApi(credentials, options.fetcher), canNotify: options.notifications, current: same };
|
|
84
|
+
try {
|
|
85
|
+
// Connected means the app can sign in; inbound reachability is the operator's endpoint to verify.
|
|
86
|
+
try {
|
|
87
|
+
await teamsAccessToken(credentials, options.fetcher);
|
|
88
|
+
state.prepare("UPDATE chat_runtime SET connected=?,problem=NULL WHERE installation=? AND owner=?").run(new Date().toISOString(), credentials.installation, owner);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
problem(error instanceof TeamsError ? error.message : "Microsoft sign-in failed. Check the Teams app credentials.");
|
|
92
|
+
await pause(30_000);
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
while (same()) {
|
|
96
|
+
const retry = state.prepare("SELECT retry_at FROM chat_runtime WHERE installation=?").get(credentials.installation)?.retry_at;
|
|
97
|
+
if (typeof retry === "string" && retry > new Date().toISOString()) {
|
|
98
|
+
await pause(1000);
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
await processTeamsEvent(chat);
|
|
102
|
+
if (same())
|
|
103
|
+
await planTeamsRooms(chat);
|
|
104
|
+
if (same())
|
|
105
|
+
await deliverTeamsPart(chat);
|
|
106
|
+
if (same() && options.notifications())
|
|
107
|
+
await planTeamsNotifications(chat);
|
|
108
|
+
await pause(1000);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
if (alive)
|
|
113
|
+
problem("Teams delivery is unavailable. Retrying shortly.");
|
|
114
|
+
}
|
|
115
|
+
finally {
|
|
116
|
+
clearInterval(heartbeat);
|
|
117
|
+
alive = false;
|
|
118
|
+
options.signal.removeEventListener("abort", stop);
|
|
119
|
+
state.prepare("UPDATE chat_runtime SET owner=NULL,lease_until=NULL,connected=NULL WHERE installation=? AND owner=?").run(credentials.installation, owner);
|
|
120
|
+
}
|
|
121
|
+
await pause(5000);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
export { object };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type FlowStage } from "./flows.js";
|
|
2
|
+
import type { InlineButton } from "./telegram-mate.js";
|
|
3
|
+
import type { FlowCardRow, FlowRow, Store, TelegramBinding, TelegramFlowAction, TelegramFlowPrompt } from "./store.js";
|
|
4
|
+
export declare const FLOW_DECIDE_KEY: RegExp;
|
|
5
|
+
type Waiting = {
|
|
6
|
+
card: FlowCardRow;
|
|
7
|
+
flow: FlowRow;
|
|
8
|
+
stage: FlowStage;
|
|
9
|
+
draft: FlowStage | null;
|
|
10
|
+
};
|
|
11
|
+
/** The card, if it is still at that visit, waiting at a decision. */
|
|
12
|
+
export declare function flowDecisionAt(store: Store, cardId: number, entry: number): Waiting | null;
|
|
13
|
+
/** Buttons for one visit, minted before the send; `place` stamps the message they landed on. */
|
|
14
|
+
export declare function flowButtons(store: Store, binding: TelegramBinding, waiting: Waiting, now: Date): {
|
|
15
|
+
keyboard: InlineButton[][];
|
|
16
|
+
tokens: string[];
|
|
17
|
+
};
|
|
18
|
+
export type FlowTapEffect = {
|
|
19
|
+
kind: "ack";
|
|
20
|
+
text: string;
|
|
21
|
+
} | {
|
|
22
|
+
kind: "edit";
|
|
23
|
+
text: string;
|
|
24
|
+
} | {
|
|
25
|
+
kind: "prompt";
|
|
26
|
+
text: string;
|
|
27
|
+
placeholder: string;
|
|
28
|
+
prompt: Omit<TelegramFlowPrompt, "messageId">;
|
|
29
|
+
};
|
|
30
|
+
/** A tapped flow button, applied inside the update's transaction. */
|
|
31
|
+
export declare function applyFlowTap(store: Store, binding: TelegramBinding, action: TelegramFlowAction, message: {
|
|
32
|
+
chatId: string;
|
|
33
|
+
messageId: string;
|
|
34
|
+
text: string;
|
|
35
|
+
}, repos: readonly string[] | null, now: Date): FlowTapEffect[];
|
|
36
|
+
export type FlowReplyEffect = {
|
|
37
|
+
kind: "say";
|
|
38
|
+
text: string;
|
|
39
|
+
}
|
|
40
|
+
/** The edited draft, back for a decision: send it with these buttons, then place them. */
|
|
41
|
+
| {
|
|
42
|
+
kind: "decide";
|
|
43
|
+
text: string;
|
|
44
|
+
keyboard: InlineButton[][];
|
|
45
|
+
tokens: string[];
|
|
46
|
+
};
|
|
47
|
+
/** A reply to an Edit or Send back prompt, applied inside the update's transaction. */
|
|
48
|
+
export declare function applyFlowReply(store: Store, binding: TelegramBinding, prompt: TelegramFlowPrompt, text: string, repos: readonly string[] | null, now: Date): FlowReplyEffect[];
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flow decisions on Telegram (v86). A card waiting at a "Person decides"
|
|
3
|
+
* zone reaches the decider with the draft in front of it (when a Draft zone
|
|
4
|
+
* sends it there) and three buttons: Approve, Edit, Send back.
|
|
5
|
+
*
|
|
6
|
+
* - Approve decides it through the same door as the console
|
|
7
|
+
* (decideFlowCard), as the paired person, for exactly the visit the
|
|
8
|
+
* message was about.
|
|
9
|
+
* - Edit asks for the person's own version as a reply; it replaces the
|
|
10
|
+
* draft on the card and comes back with fresh buttons, so what is
|
|
11
|
+
* approved is always what they read.
|
|
12
|
+
* - Send back asks what should change; the reply is the note.
|
|
13
|
+
*
|
|
14
|
+
* Every button is one opaque token for one visit of one card, placed on the
|
|
15
|
+
* message it rides. A card that moved on answers so; a tap from anyone but
|
|
16
|
+
* the paired person and chat never reaches here (telegram.ts checks it).
|
|
17
|
+
*/
|
|
18
|
+
import { randomBytes } from "node:crypto";
|
|
19
|
+
import { keptDraft } from "./flow-draft.js";
|
|
20
|
+
import { decideFlowCard, draftFor, flowDefinitionOf } from "./flow-engine.js";
|
|
21
|
+
import { deciderOf } from "./flows.js";
|
|
22
|
+
export const FLOW_DECIDE_KEY = /^flow-decide:([1-9][0-9]{0,14}):([1-9][0-9]{0,9})$/;
|
|
23
|
+
const DRAFT_LIMIT = 4000;
|
|
24
|
+
/** The card, if it is still at that visit, waiting at a decision. */
|
|
25
|
+
export function flowDecisionAt(store, cardId, entry) {
|
|
26
|
+
const card = store.getFlowCard(cardId);
|
|
27
|
+
const flow = card === null ? null : store.getFlow(card.flow);
|
|
28
|
+
const definition = flow === null ? null : flowDefinitionOf(flow);
|
|
29
|
+
if (card === null || flow === null || definition === null || card.state !== "active" || card.entry !== entry)
|
|
30
|
+
return null;
|
|
31
|
+
const stage = definition.stages.find(one => one.id === card.stage);
|
|
32
|
+
if (stage === undefined || stage.kind !== "approval")
|
|
33
|
+
return null;
|
|
34
|
+
return { card, flow, stage, draft: draftFor(definition, stage) };
|
|
35
|
+
}
|
|
36
|
+
/** Buttons for one visit, minted before the send; `place` stamps the message they landed on. */
|
|
37
|
+
export function flowButtons(store, binding, waiting, now) {
|
|
38
|
+
const mint = (action) => ({ action, token: randomBytes(16).toString("hex") });
|
|
39
|
+
const approve = mint("approve");
|
|
40
|
+
const edit = waiting.draft !== null && waiting.card.outputs[waiting.draft.id] !== undefined ? mint("edit") : null;
|
|
41
|
+
const back = waiting.stage.onFail !== null ? mint("send-back") : null;
|
|
42
|
+
const all = [approve, edit, back].filter((one) => one !== null);
|
|
43
|
+
store.createTelegramFlowActions({ binding: binding.id, chatId: binding.chatId, card: waiting.card.id, entry: waiting.card.entry }, all, now);
|
|
44
|
+
const second = [edit === null ? null : { text: "✏️ Edit", callback_data: edit.token }, back === null ? null : { text: "↩️ Send back", callback_data: back.token }]
|
|
45
|
+
.filter((one) => one !== null);
|
|
46
|
+
return { keyboard: [[{ text: "✅ Approve", callback_data: approve.token }], ...(second.length === 0 ? [] : [second])], tokens: all.map(one => one.token) };
|
|
47
|
+
}
|
|
48
|
+
/** A tapped flow button, applied inside the update's transaction. */
|
|
49
|
+
export function applyFlowTap(store, binding, action, message, repos, now) {
|
|
50
|
+
if (action.consumedAt !== null || action.expiresAt <= now.toISOString())
|
|
51
|
+
return [{ kind: "ack", text: "That was already decided, or these buttons are too old." }];
|
|
52
|
+
const waiting = flowDecisionAt(store, action.card, action.entry);
|
|
53
|
+
if (waiting === null)
|
|
54
|
+
return [{ kind: "ack", text: "That card has moved on since; nothing was changed." }];
|
|
55
|
+
const decider = deciderOf(waiting.stage, waiting.flow);
|
|
56
|
+
if (decider !== null && decider !== binding.approver)
|
|
57
|
+
return [{ kind: "ack", text: `Only ${decider} decides here.` }];
|
|
58
|
+
if (action.action === "approve") {
|
|
59
|
+
if (repos === null)
|
|
60
|
+
return [{ kind: "ack", text: "Couldn't check your projects just now. Try again in a moment." }];
|
|
61
|
+
const decided = decideFlowCard(store, { card: waiting.card.id, decision: "approve", note: null, actor: binding.approver, repos, entry: action.entry }, now);
|
|
62
|
+
if (!decided.ok)
|
|
63
|
+
return [{ kind: "ack", text: decided.message.slice(0, 190) }];
|
|
64
|
+
store.retireTelegramFlowVisit(action.card, action.entry, now);
|
|
65
|
+
return [{ kind: "ack", text: "Approved" }, { kind: "edit", text: `${message.text}\n\n✅ You approved it. ${decided.said}`.slice(0, 4000) }];
|
|
66
|
+
}
|
|
67
|
+
const prompt = { chatId: binding.chatId, binding: binding.id, card: action.card, entry: action.entry, mode: action.action };
|
|
68
|
+
if (action.action === "edit") {
|
|
69
|
+
return [{ kind: "ack", text: "Send your version" }, { kind: "prompt", prompt, placeholder: "Your version of the draft",
|
|
70
|
+
text: `Send your version of the draft for “${waiting.card.title}” as a reply to this message. It replaces the draft, and comes back here for you to approve.` }];
|
|
71
|
+
}
|
|
72
|
+
const back = waiting.stage.onFail === null ? "the zone before" : titleOf(waiting, waiting.stage.onFail);
|
|
73
|
+
return [{ kind: "ack", text: "What should change?" }, { kind: "prompt", prompt, placeholder: "What should change",
|
|
74
|
+
text: `What should change on “${waiting.card.title}”? Reply to this message and it goes back to ${back} with your note.` }];
|
|
75
|
+
}
|
|
76
|
+
const titleOf = (waiting, id) => flowDefinitionOf(waiting.flow)?.stages.find(one => one.id === id)?.title ?? id;
|
|
77
|
+
/** A reply to an Edit or Send back prompt, applied inside the update's transaction. */
|
|
78
|
+
export function applyFlowReply(store, binding, prompt, text, repos, now) {
|
|
79
|
+
if (prompt.binding !== binding.id)
|
|
80
|
+
return [];
|
|
81
|
+
const waiting = flowDecisionAt(store, prompt.card, prompt.entry);
|
|
82
|
+
if (waiting === null) {
|
|
83
|
+
store.retireTelegramFlowVisit(prompt.card, prompt.entry, now);
|
|
84
|
+
return [{ kind: "say", text: "That card has moved on since; nothing was changed." }];
|
|
85
|
+
}
|
|
86
|
+
const said = text.trim();
|
|
87
|
+
if (said === "")
|
|
88
|
+
return [{ kind: "say", text: prompt.mode === "edit" ? "Send the text itself as a reply." : "Say what should change." }];
|
|
89
|
+
if (prompt.mode === "edit") {
|
|
90
|
+
if (waiting.draft === null)
|
|
91
|
+
return [{ kind: "say", text: "This decision has no draft to edit." }];
|
|
92
|
+
if (said.length > DRAFT_LIMIT)
|
|
93
|
+
return [{ kind: "say", text: `Keep it under ${DRAFT_LIMIT} characters.` }];
|
|
94
|
+
const kept = keptDraft(said);
|
|
95
|
+
store.updateFlowCard(waiting.card.id, { outputs: { ...waiting.card.outputs, [waiting.draft.id]: kept } }, now);
|
|
96
|
+
store.addFlowComment({ card: waiting.card.id, author: binding.approver, body: "Edited the draft in Telegram.", mentions: [] }, now);
|
|
97
|
+
store.retireTelegramFlowVisit(prompt.card, prompt.entry, now);
|
|
98
|
+
const fresh = flowDecisionAt(store, prompt.card, prompt.entry);
|
|
99
|
+
const buttons = flowButtons(store, binding, fresh, now);
|
|
100
|
+
return [{ kind: "decide", keyboard: buttons.keyboard, tokens: buttons.tokens,
|
|
101
|
+
text: `${waiting.flow.name}: your version of the draft for “${waiting.card.title}”\n\n${kept}\n\nApprove to send it as written.` }];
|
|
102
|
+
}
|
|
103
|
+
if (repos === null)
|
|
104
|
+
return [{ kind: "say", text: "Couldn't check your projects just now. Reply again in a moment." }];
|
|
105
|
+
const decided = decideFlowCard(store, { card: waiting.card.id, decision: "send-back", note: said.slice(0, 2000), actor: binding.approver, repos, entry: prompt.entry }, now);
|
|
106
|
+
if (!decided.ok)
|
|
107
|
+
return [{ kind: "say", text: decided.message }];
|
|
108
|
+
store.retireTelegramFlowVisit(prompt.card, prompt.entry, now);
|
|
109
|
+
return [{ kind: "say", text: `↩️ ${decided.said}` }];
|
|
110
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { type PhoneLink } from "./chat-channel.js";
|
|
2
|
+
export { channelRepos as telegramConversationRepos, resolveChannelMate as resolveTelegramMate, tooLongText, whichTaskText, replyContextFor, NO_PHONE_LINK, NO_TASK_LINK, proposalLink, confirmedLink, proposalPreview, proposalOutcomeText, handoffCardText, confirmedCardText, CHAT_ACTION_PARITY as TELEGRAM_ACTION_PARITY, parityGaps, type PhoneLink, type ResolvedMate, type ParitySupport } from "./chat-channel.js";
|
|
3
|
+
import { type DoorOptions } from "./mate-doors.js";
|
|
4
|
+
import type { Store, TelegramBinding } from "./store.js";
|
|
5
|
+
import type { SubscriptionMateRunner } from "./subscription-chat.js";
|
|
6
|
+
import type { TelegramTransport } from "./telegram.js";
|
|
7
|
+
/** How long one claimed turn may go without a heartbeat before another poller may take it over. */
|
|
8
|
+
export declare const CONVERSATION_CLAIM_MS: number;
|
|
9
|
+
/** A busy engine (one turn at a time) defers a queued message this long, up to the age bound below. */
|
|
10
|
+
export declare const CONVERSATION_RETRY_MS = 5000;
|
|
11
|
+
export declare const CONVERSATION_MAX_AGE_MS: number;
|
|
12
|
+
/** A card's buttons and an armed irreversible challenge live this long. */
|
|
13
|
+
export declare const CARD_TTL_MS: number;
|
|
14
|
+
export declare const CHALLENGE_TTL_MS: number;
|
|
15
|
+
export type TelegramConversationOptions = {
|
|
16
|
+
/** Where evidence lives — the same root the console and CLI read results from. */
|
|
17
|
+
evidenceRoot: string;
|
|
18
|
+
/** Injected by tests; production invokes the isolated local harness. */
|
|
19
|
+
subscriptionRunner?: SubscriptionMateRunner;
|
|
20
|
+
/** The held-session supervisor in this process, when there is one (a stop fences through it). */
|
|
21
|
+
held?: DoorOptions["held"];
|
|
22
|
+
/**
|
|
23
|
+
* The https origin a phone link may open, read again on EVERY call (a
|
|
24
|
+
* card is linked immediately before it is sent or edited, never from a
|
|
25
|
+
* stored URL), or null when no trusted origin is configured. Production
|
|
26
|
+
* wires `phoneOrigin` from webhooks.ts; absent, no card carries a link.
|
|
27
|
+
*/
|
|
28
|
+
phoneOrigin?: () => string | null;
|
|
29
|
+
};
|
|
30
|
+
/** One Bot API call, the shape telegram.ts injects. */
|
|
31
|
+
export type Transport = TelegramTransport;
|
|
32
|
+
/**
|
|
33
|
+
* The phone's project ceiling: the enrolled registry, canonicalized and
|
|
34
|
+
* deduplicated IN ORDER exactly as the console's managed list is, then
|
|
35
|
+
* narrowed to what this approver's account may access. Order matters —
|
|
36
|
+
* `r1..rN` is an index and the ceiling digest hashes the order — so a
|
|
37
|
+
* console session over the same enrollment shares its digest here.
|
|
38
|
+
*/
|
|
39
|
+
/** The engine's request identity for one inbound message: exact bot, binding and update, never text. */
|
|
40
|
+
export declare function telegramRequestId(botId: string, bindingId: number, updateId: number): string;
|
|
41
|
+
/** The one channel problem that is transient: the registry could not be read now. Retried, never a refusal. */
|
|
42
|
+
export declare const UNREADABLE_REGISTRY = "current project access could not be read";
|
|
43
|
+
/**
|
|
44
|
+
* Is the channel still what a turn opened under? The live binding must be
|
|
45
|
+
* the SAME row and generation, its approver still an approver, and the
|
|
46
|
+
* enrolled ceiling (reloaded now) still the exact list the principal
|
|
47
|
+
* holds — or, for a reply recovered after a restart, the ceiling digest
|
|
48
|
+
* its session was minted under. A string names what changed; null means
|
|
49
|
+
* nothing did.
|
|
50
|
+
*/
|
|
51
|
+
export declare function telegramChannelProblem(store: Store, expected: {
|
|
52
|
+
botId: string;
|
|
53
|
+
bindingId: number;
|
|
54
|
+
approverGeneration: number;
|
|
55
|
+
} & ({
|
|
56
|
+
repos: readonly string[];
|
|
57
|
+
} | {
|
|
58
|
+
ceilingDigest: string;
|
|
59
|
+
}), readProjects: () => Promise<readonly string[]>): Promise<string | null>;
|
|
60
|
+
export declare function phoneLinkButton(origin: string | null, link: PhoneLink | null): InlineButton[] | null;
|
|
61
|
+
/** One inline button: an opaque callback token (a real in-chat act) or a url (navigation, never authority). */
|
|
62
|
+
export type InlineButton = {
|
|
63
|
+
text: string;
|
|
64
|
+
callback_data: string;
|
|
65
|
+
} | {
|
|
66
|
+
text: string;
|
|
67
|
+
url: string;
|
|
68
|
+
};
|
|
69
|
+
type Keyboard = InlineButton[][];
|
|
70
|
+
/** What a part persists: callback tokens only. A url is minted at send time, never stored. */
|
|
71
|
+
type CallbackKeyboard = {
|
|
72
|
+
text: string;
|
|
73
|
+
callback_data: string;
|
|
74
|
+
}[][];
|
|
75
|
+
/** Mint the card's tokens before the send, so a tap can never name a token that does not exist. */
|
|
76
|
+
export declare function mintCardTokens(store: Store, binding: TelegramBinding, proposal: number, now: Date, messageId?: string, chatId?: string): {
|
|
77
|
+
keyboard: CallbackKeyboard;
|
|
78
|
+
tokens: string[];
|
|
79
|
+
};
|
|
80
|
+
export type CardEffect = {
|
|
81
|
+
kind: "ack";
|
|
82
|
+
text: string;
|
|
83
|
+
} | {
|
|
84
|
+
kind: "edit";
|
|
85
|
+
text: string;
|
|
86
|
+
keyboard?: Keyboard;
|
|
87
|
+
} | {
|
|
88
|
+
kind: "signal";
|
|
89
|
+
run: () => void;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* One tap on a proposal card, applied inside the update's own transaction
|
|
93
|
+
* by the bridge (which already proved the live binding, the exact sender
|
|
94
|
+
* and the exact chat). Returns what to tell Telegram afterwards. The
|
|
95
|
+
* principal is minted from the binding row against the CURRENT enrolled
|
|
96
|
+
* ceiling; the door re-proves standing, ceiling, session and the
|
|
97
|
+
* proposal's own terms again inside its transaction.
|
|
98
|
+
*/
|
|
99
|
+
export declare function applyProposalTap(store: Store, binding: TelegramBinding, token: string, message: {
|
|
100
|
+
message_id: number;
|
|
101
|
+
chat?: {
|
|
102
|
+
id: number;
|
|
103
|
+
};
|
|
104
|
+
}, repos: readonly string[] | null, options: TelegramConversationOptions, now: Date): {
|
|
105
|
+
effects: CardEffect[];
|
|
106
|
+
confirmed: boolean;
|
|
107
|
+
ignored: boolean;
|
|
108
|
+
};
|
|
109
|
+
/** A handoff card as sent or repainted: its persisted words, plus the one line saying why no link rides it. */
|
|
110
|
+
export type ConversationReport = {
|
|
111
|
+
answered: number;
|
|
112
|
+
refused: number;
|
|
113
|
+
problems: string[];
|
|
114
|
+
};
|
|
115
|
+
/** A part's next attempt after a failed send: bounded backoff by attempt, or Telegram's own retry_after when it named a longer one. */
|
|
116
|
+
export declare const PART_RETRY_MS: readonly [5000, 15000, 60000, 300000];
|
|
117
|
+
/** Unsent parts are retried this long after the message arrived (the card's own lifetime); then the row fails, explicitly unsent. */
|
|
118
|
+
export declare const DELIVERY_MAX_AGE_MS: number;
|
|
119
|
+
export declare function splitParts(text: string): string[];
|
|
120
|
+
/**
|
|
121
|
+
* Run every claimable queued message for this bot, one at a time, each
|
|
122
|
+
* outside any SQLite transaction. The caller holds the poll lease and
|
|
123
|
+
* renews it; the row's own claim is renewed here. Bounded per call so a
|
|
124
|
+
* flood cannot pin one pass forever.
|
|
125
|
+
*/
|
|
126
|
+
export declare function processTelegramConversations(args: {
|
|
127
|
+
store: Store;
|
|
128
|
+
botId: string;
|
|
129
|
+
transport: Transport;
|
|
130
|
+
owner: string;
|
|
131
|
+
clock: () => Date;
|
|
132
|
+
readProjects: () => Promise<readonly string[]>;
|
|
133
|
+
options: TelegramConversationOptions;
|
|
134
|
+
report: ConversationReport;
|
|
135
|
+
signal?: AbortSignal;
|
|
136
|
+
limit?: number;
|
|
137
|
+
}): Promise<void>;
|