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/mate.d.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { type MateProgress } from "./mate-progress.js";
|
|
2
|
+
import type { ChatConfig, MateSession, MateThread, Store } from "./store.js";
|
|
3
|
+
import type { VerifiedApprover } from "./principal.js";
|
|
4
|
+
import { type MateHistoryMessage } from "./converse.js";
|
|
5
|
+
import { type SubscriptionMateRunner } from "./subscription-chat.js";
|
|
6
|
+
export declare const MATE_MESSAGE_MAX_CHARS = 2000;
|
|
7
|
+
/** The thread's recent history the model sees, most recent first until the cap. */
|
|
8
|
+
export declare const MATE_HISTORY_CAP_BYTES = 16384;
|
|
9
|
+
export declare const MATE_HISTORY_MAX_MESSAGES = 40;
|
|
10
|
+
export type MateTurnInput = {
|
|
11
|
+
store: Store;
|
|
12
|
+
who: VerifiedApprover;
|
|
13
|
+
session: MateSession;
|
|
14
|
+
thread: MateThread;
|
|
15
|
+
/** The installation's chat configuration: provider, model, pinned price, caps. */
|
|
16
|
+
config: ChatConfig;
|
|
17
|
+
/** Direct API key; subscription providers use their cached harness login. */
|
|
18
|
+
key: string | null;
|
|
19
|
+
message: string;
|
|
20
|
+
/** Stable browser send identity. A retry returns the original turn,
|
|
21
|
+
* including a failed one; it never dispatches the provider again. */
|
|
22
|
+
requestId?: string;
|
|
23
|
+
/** A central conversation saved this operator message before acknowledging
|
|
24
|
+
* delivery. Bind it to this turn instead of inserting a second copy. */
|
|
25
|
+
queuedMessageId?: number;
|
|
26
|
+
/** Called inside turn admission. A failed queue fence rolls admission back. */
|
|
27
|
+
onAdmitted?: (turn: number) => void;
|
|
28
|
+
/** Safe, server-authored context for this turn only. Kept out of the
|
|
29
|
+
* visible thread so a task-scoped composer still reads like a normal
|
|
30
|
+
* conversation. */
|
|
31
|
+
context?: string;
|
|
32
|
+
fetcher?: typeof fetch;
|
|
33
|
+
/** Injected by tests; production invokes the isolated local harness. */
|
|
34
|
+
subscriptionRunner?: SubscriptionMateRunner;
|
|
35
|
+
/** Live progress for someone watching (chat streaming): the steps, the
|
|
36
|
+
* tools in plain words, and the reply as it is written. Display only;
|
|
37
|
+
* never called with text that looks like a secret. */
|
|
38
|
+
onProgress?: (event: MateProgress) => void;
|
|
39
|
+
clock?: () => Date;
|
|
40
|
+
/** Where evidence lives — get_task reads a scout's report from here. */
|
|
41
|
+
evidenceRoot?: string;
|
|
42
|
+
/** How this surface delivers the images a turn selects: Telegram sends them as documents after the reply; absent means identity only. */
|
|
43
|
+
mediaDelivery?: "documents";
|
|
44
|
+
/**
|
|
45
|
+
* A channel's own standing, re-proved where the approver's is: before
|
|
46
|
+
* admission, before every provider dispatch, after every provider wait,
|
|
47
|
+
* and before any tool runs. The
|
|
48
|
+
* paired Telegram chat uses it to prove the binding, its generation and
|
|
49
|
+
* the enrolled ceiling are still what the turn opened under — account
|
|
50
|
+
* generation alone cannot see an unpairing or a project removed from
|
|
51
|
+
* enrollment. A refusal ends the turn with nothing kept.
|
|
52
|
+
*/
|
|
53
|
+
revalidate?: () => Promise<{
|
|
54
|
+
ok: true;
|
|
55
|
+
} | {
|
|
56
|
+
ok: false;
|
|
57
|
+
reason: string;
|
|
58
|
+
}>;
|
|
59
|
+
};
|
|
60
|
+
export type MateRefusal = "empty-message" | "secret-in-message" | "secret-in-context" | "standing" | "unpriced" | "ceiling-changed" | "not-yours" | "thread-closed" | "latched" | "concurrent" | "daily-cap" | "session-exhausted" | "session-ended" | "over-budget" | "monthly-budget" | "policy" | "invalid-request" | "request-changed" | "channel";
|
|
61
|
+
export type MateFailure = "provider-error" | "timeout" | "malformed-reply" | "secret-refused" | "latched" | "revoked" | "superseded";
|
|
62
|
+
export type MateTurnOutcome = {
|
|
63
|
+
ok: true;
|
|
64
|
+
replayed?: false;
|
|
65
|
+
turn: number;
|
|
66
|
+
reply: string;
|
|
67
|
+
activity: string;
|
|
68
|
+
proposals: number;
|
|
69
|
+
steps: number;
|
|
70
|
+
stoppedAtCap: boolean;
|
|
71
|
+
settledMicrousd: number;
|
|
72
|
+
} | {
|
|
73
|
+
ok: true;
|
|
74
|
+
replayed: true;
|
|
75
|
+
turn: number;
|
|
76
|
+
} | {
|
|
77
|
+
ok: false;
|
|
78
|
+
refused: MateRefusal;
|
|
79
|
+
message: string;
|
|
80
|
+
} | {
|
|
81
|
+
ok: false;
|
|
82
|
+
turn: number;
|
|
83
|
+
failed: MateFailure;
|
|
84
|
+
message: string;
|
|
85
|
+
unknownSpend: boolean;
|
|
86
|
+
};
|
|
87
|
+
export declare const MATE_REFUSAL_COPY: Record<MateRefusal, string>;
|
|
88
|
+
/** The last messages of the thread as provider-neutral history, newest kept first until the byte cap. */
|
|
89
|
+
export declare function historyFor(store: Store, thread: number, queuedMessageId?: number): MateHistoryMessage[];
|
|
90
|
+
/** "read 3 · proposed 1 · 2 steps" — counts only, never results (ruling 11). */
|
|
91
|
+
export declare function activitySummary(reads: number, proposals: number, steps: number): string;
|
|
92
|
+
export declare function runMateTurn(input: MateTurnInput): Promise<MateTurnOutcome>;
|
package/dist/mate.js
ADDED
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The mate's turn engine (mate arc §3): one reservation for the whole
|
|
3
|
+
* loop, one `chat_turn` step per provider request, tools executed
|
|
4
|
+
* in-process under the branded approver, results through `mateView`, and
|
|
5
|
+
* only operator text and assistant text kept (ruling 11). The console
|
|
6
|
+
* and the CLI drive this and render from the rows it writes.
|
|
7
|
+
*
|
|
8
|
+
* Slice-1 review, folded in: the session, thread, and credential are
|
|
9
|
+
* bound to the principal inside the store's admission (finding 2); the
|
|
10
|
+
* principal is re-proved after every network wait and the turn's own
|
|
11
|
+
* row is re-read, so a revocation mid-flight ends the loop before any
|
|
12
|
+
* tool runs (finding 5); a step whose cost is unknown charges the whole
|
|
13
|
+
* reservation (finding 1); the latch is re-checked before every dispatch
|
|
14
|
+
* (finding 11); usage that cannot be true is malformed, never a discount
|
|
15
|
+
* (finding 8); and everything the model sees passed `mateView` (finding 9).
|
|
16
|
+
*/
|
|
17
|
+
import { Buffer } from "node:buffer";
|
|
18
|
+
import { mateToolLabel } from "./mate-progress.js";
|
|
19
|
+
import { createHash } from "node:crypto";
|
|
20
|
+
import { RESULT_IMAGES_PER_TURN_CAP } from "./chat-evidence.js";
|
|
21
|
+
import { isVerifiedApprover, reproveApprover } from "./principal.js";
|
|
22
|
+
import { MATE_MAX_CALLS_PER_STEP, MATE_MAX_STEPS, MATE_TOOL_RESULT_CAP_BYTES, TURN_WALL_CLOCK_MS, composeMateRequest, credentialKeyOf, isDirectChatProvider, mateWorstCaseForPrice, performMateRequest, priceForConfig, settleForPrice, subscriptionCredentialKey, } from "./converse.js";
|
|
23
|
+
import { redactSecretLines, scanForSecrets } from "./evidence.js";
|
|
24
|
+
import { redactSecretAssignments } from "./builder.js";
|
|
25
|
+
import { MATE_CONTRACT } from "./mate-contract.js";
|
|
26
|
+
import { MATE_MAX_PROPOSALS_PER_TURN, MATE_TOOL_SCHEMAS, executeMateTool, isMateTool, mateViewContextFor, redactForMate, toolResultBytes } from "./mate-tools.js";
|
|
27
|
+
import { composeSubscriptionMatePrompt, performSubscriptionMateRequest } from "./subscription-chat.js";
|
|
28
|
+
import { leadContext } from './lead-context.js';
|
|
29
|
+
import { envValue } from "./names.js";
|
|
30
|
+
export const MATE_MESSAGE_MAX_CHARS = 2_000;
|
|
31
|
+
/** The thread's recent history the model sees, most recent first until the cap. */
|
|
32
|
+
export const MATE_HISTORY_CAP_BYTES = 16_384;
|
|
33
|
+
export const MATE_HISTORY_MAX_MESSAGES = 40;
|
|
34
|
+
export const MATE_REFUSAL_COPY = {
|
|
35
|
+
"empty-message": `a message is 1 to ${MATE_MESSAGE_MAX_CHARS} characters`,
|
|
36
|
+
"secret-in-message": "that looks like a credential — the mate never forwards or stores those",
|
|
37
|
+
"secret-in-context": "fleet context contains something credential-shaped — the mate refuses to send it; find and remove it first",
|
|
38
|
+
standing: "your approver standing changed — sign in again",
|
|
39
|
+
unpriced: "no pinned price for the chat model — re-save the chat configuration to pin one",
|
|
40
|
+
"ceiling-changed": "the admitted projects changed since this session was minted — mint a new one",
|
|
41
|
+
"not-yours": "that mate session is not yours to continue",
|
|
42
|
+
"thread-closed": "that thread is closed — start a new one",
|
|
43
|
+
latched: "a turn with unknown cost blocks this credential — acknowledge it first",
|
|
44
|
+
concurrent: "one turn at a time — the last one is still running",
|
|
45
|
+
"daily-cap": "the daily turn cap is reached",
|
|
46
|
+
"session-exhausted": "this mate session's spend ceiling would be exceeded — mint a new one to continue",
|
|
47
|
+
"session-ended": "this mate session has ended — mint a new one to continue",
|
|
48
|
+
"over-budget": "the weekly chat spend ceiling would be exceeded",
|
|
49
|
+
"monthly-budget": "a monthly budget this counts toward holds it: used up, or its cost can't be priced yet (the Spend page says which)",
|
|
50
|
+
policy: "the organisation policy doesn't allow this chat's provider or model (Settings → Policy says which)",
|
|
51
|
+
"invalid-request": "This message could not be identified. Reload the conversation before sending it.",
|
|
52
|
+
"request-changed": "That send was already received with different text or task context. Reload the conversation before sending a new message.",
|
|
53
|
+
channel: "this conversation's connection changed — reconnect it before sending again",
|
|
54
|
+
};
|
|
55
|
+
const READ_TOOLS = new Set(["get_brief", "get_project_context", "get_actions", "get_action_status", "get_skills", "get_acceptance_evidence", "recap", "list_repos", "list_tasks", "get_task", "get_result", "get_result_images", "get_controls", "get_agents", "get_project_knowledge", "get_task_conversation", "get_diff", "get_check_log", "get_project_tools", "get_flows", "get_flow_insights", "list_decisions", "get_decision", "queue"]);
|
|
56
|
+
/** The last messages of the thread as provider-neutral history, newest kept first until the byte cap. */
|
|
57
|
+
export function historyFor(store, thread, queuedMessageId) {
|
|
58
|
+
const rows = store.listMateMessages(thread, MATE_HISTORY_MAX_MESSAGES);
|
|
59
|
+
const kept = [];
|
|
60
|
+
let bytes = 0;
|
|
61
|
+
for (let index = rows.length - 1; index >= 0; index--) {
|
|
62
|
+
const row = rows[index];
|
|
63
|
+
// Other teammates may have already queued later messages. They do not
|
|
64
|
+
// enter model history until admitted, and the current message appears once.
|
|
65
|
+
if (queuedMessageId !== undefined && (row.id === queuedMessageId || row.role === 'operator' && row.turn === null))
|
|
66
|
+
continue;
|
|
67
|
+
bytes += Buffer.byteLength(row.text, "utf8");
|
|
68
|
+
if (bytes > MATE_HISTORY_CAP_BYTES)
|
|
69
|
+
break;
|
|
70
|
+
const author = queuedMessageId !== undefined && row.role === 'operator' && row.turn !== null ? store.getMateTurn(row.turn)?.approver : undefined;
|
|
71
|
+
kept.unshift(row.role === "operator" ? { role: "operator", text: author ? `From ${author}:\n${row.text}` : row.text } : { role: "assistant", text: row.text, calls: [] });
|
|
72
|
+
}
|
|
73
|
+
// A history must open with the operator: a leading assistant reply without its question is dropped.
|
|
74
|
+
while (kept[0]?.role === "assistant")
|
|
75
|
+
kept.shift();
|
|
76
|
+
return kept;
|
|
77
|
+
}
|
|
78
|
+
/** "read 3 · proposed 1 · 2 steps" — counts only, never results (ruling 11). */
|
|
79
|
+
export function activitySummary(reads, proposals, steps) {
|
|
80
|
+
return [`read ${reads}`, `proposed ${proposals}`, `${steps} step${steps === 1 ? "" : "s"}`].join(" · ");
|
|
81
|
+
}
|
|
82
|
+
/** A tool result as the model sees it, measured as embedded; over the cap it becomes a typed refusal. */
|
|
83
|
+
function capped(value) {
|
|
84
|
+
const text = JSON.stringify(value);
|
|
85
|
+
if (toolResultBytes(text) <= MATE_TOOL_RESULT_CAP_BYTES)
|
|
86
|
+
return text;
|
|
87
|
+
return JSON.stringify({ ok: false, message: "that result is over the size cap — ask for less: one project, one state, or a smaller limit" });
|
|
88
|
+
}
|
|
89
|
+
export async function runMateTurn(input) {
|
|
90
|
+
const { store, who, session, thread, config } = input;
|
|
91
|
+
const clock = input.clock ?? (() => new Date());
|
|
92
|
+
const fetcher = input.fetcher ?? fetch;
|
|
93
|
+
const refuse = (refused) => ({ ok: false, refused, message: MATE_REFUSAL_COPY[refused] });
|
|
94
|
+
const message = input.message.trim();
|
|
95
|
+
if (message === "" || message.length > MATE_MESSAGE_MAX_CHARS)
|
|
96
|
+
return refuse("empty-message");
|
|
97
|
+
// Secrets refuse BEFORE any row or request exists — nothing stored, nothing sent.
|
|
98
|
+
if (scanForSecrets(message).length > 0)
|
|
99
|
+
return refuse("secret-in-message");
|
|
100
|
+
// Ruling 3 + 10: a minted, intact principal, re-proved against the current row.
|
|
101
|
+
if (!isVerifiedApprover(who) || !reproveApprover(store, who).ok || who.generation !== session.approverGeneration)
|
|
102
|
+
return refuse("standing");
|
|
103
|
+
// Ruling 9: the session and the thread are bound to the ceiling this surface holds.
|
|
104
|
+
if (session.ceilingDigest !== who.ceilingDigest || thread.ceilingDigest !== who.ceilingDigest)
|
|
105
|
+
return refuse("ceiling-changed");
|
|
106
|
+
// Sprint 8: the lead and project chats run on a provider and model the organisation policy allows, or not at all.
|
|
107
|
+
const disallowed = store.agentPolicyRefusal(config.provider, config.model);
|
|
108
|
+
if (disallowed !== null)
|
|
109
|
+
return { ok: false, refused: "policy", message: disallowed };
|
|
110
|
+
const directProvider = isDirectChatProvider(config.provider) ? config.provider : null;
|
|
111
|
+
const subscriptionProvider = directProvider === null ? config.provider : null;
|
|
112
|
+
const direct = directProvider !== null;
|
|
113
|
+
const price = direct ? priceForConfig(config) : null;
|
|
114
|
+
if (direct && price === null)
|
|
115
|
+
return refuse("unpriced");
|
|
116
|
+
if (direct && input.key === null)
|
|
117
|
+
return refuse("unpriced");
|
|
118
|
+
// API accounting binds to the secret credential. A subscription has no
|
|
119
|
+
// API credential or dollar ledger, but changing harness still ends the
|
|
120
|
+
// old session through a stable provider-specific identity.
|
|
121
|
+
const credentialKey = direct
|
|
122
|
+
? credentialKeyOf(directProvider, input.key)
|
|
123
|
+
: subscriptionCredentialKey(subscriptionProvider);
|
|
124
|
+
const request = input.requestId;
|
|
125
|
+
if (request !== undefined && !/^[a-f0-9]{32}$/.test(request))
|
|
126
|
+
return refuse("invalid-request");
|
|
127
|
+
// Replays are read-only, but still require today's authority, not the
|
|
128
|
+
// session/thread snapshots supplied by a previous browser page.
|
|
129
|
+
const liveSession = store.getMateSession(session.id);
|
|
130
|
+
const liveThread = store.getMateThread(thread.id);
|
|
131
|
+
const sharedThread = liveThread !== null && store.canUseTeamMateThread(who.name, who.generation, liveThread.id);
|
|
132
|
+
if (liveSession?.approver !== who.name || (liveThread?.approver !== who.name && !sharedThread) || liveSession.credentialKey !== credentialKey)
|
|
133
|
+
return refuse("not-yours");
|
|
134
|
+
if (input.queuedMessageId !== undefined && (!sharedThread || !Number.isSafeInteger(input.queuedMessageId) || input.onAdmitted === undefined))
|
|
135
|
+
return refuse('invalid-request');
|
|
136
|
+
if (liveSession.endedAt !== null)
|
|
137
|
+
return refuse("session-ended");
|
|
138
|
+
if (liveThread.closedAt !== null)
|
|
139
|
+
return refuse("thread-closed");
|
|
140
|
+
if (liveSession.ceilingDigest !== who.ceilingDigest || liveThread.ceilingDigest !== who.ceilingDigest)
|
|
141
|
+
return refuse("ceiling-changed");
|
|
142
|
+
const digest = createHash("sha256").update(JSON.stringify([thread.id, message, input.context ?? null])).digest("hex");
|
|
143
|
+
const receipt = request === undefined ? null : store.mateRequestReceipt(session.id, request);
|
|
144
|
+
if (receipt !== null)
|
|
145
|
+
return receipt.digest === digest ? { ok: true, replayed: true, turn: receipt.turn } : refuse("request-changed");
|
|
146
|
+
// The channel's standing, proved before anything is admitted or sent.
|
|
147
|
+
if (input.revalidate !== undefined && !(await input.revalidate()).ok)
|
|
148
|
+
return refuse("channel");
|
|
149
|
+
let now = clock();
|
|
150
|
+
store.sweepStaleMateTurns(now);
|
|
151
|
+
const view = mateViewContextFor(store, who);
|
|
152
|
+
const document = redactForMate(leadContext(store, who.repos, now, input.evidenceRoot), view);
|
|
153
|
+
const authoredMessage = input.queuedMessageId === undefined ? message : `From ${who.name}:\n${message}`;
|
|
154
|
+
const historyMessage = input.context === undefined ? authoredMessage : `${redactForMate(input.context, view)}\n\n${authoredMessage}`;
|
|
155
|
+
const history = [...historyFor(store, thread.id, input.queuedMessageId), { role: "operator", text: historyMessage }];
|
|
156
|
+
const composeDirect = (key) => {
|
|
157
|
+
if (!direct)
|
|
158
|
+
throw new Error("not a direct chat provider");
|
|
159
|
+
return composeMateRequest({ provider: directProvider, model: config.model, key, system: MATE_CONTRACT, dataDocument: document, history, tools: MATE_TOOL_SCHEMAS });
|
|
160
|
+
};
|
|
161
|
+
const composeSubscription = () => composeSubscriptionMatePrompt({ system: MATE_CONTRACT, dataDocument: document, history, tools: MATE_TOOL_SCHEMAS });
|
|
162
|
+
// The exact outbound base is scanned whole. Only direct API traffic needs
|
|
163
|
+
// a worst-case dollar reservation; subscription traffic records zero.
|
|
164
|
+
const base = direct ? composeDirect("").body : composeSubscription();
|
|
165
|
+
if (scanForSecrets(base).length > 0)
|
|
166
|
+
return refuse("secret-in-context");
|
|
167
|
+
// Fit the bounded tool loop to the already-authorized remaining allowance.
|
|
168
|
+
// Context/history growth must not demand a larger budget for a simple reply.
|
|
169
|
+
// Each chosen step retains the same worst-case call/output accounting.
|
|
170
|
+
let maxSteps = MATE_MAX_STEPS;
|
|
171
|
+
const baseBytes = Buffer.byteLength(base, "utf8");
|
|
172
|
+
const reserveFor = (steps) => direct ? mateWorstCaseForPrice(price, baseBytes, { steps }) : 0;
|
|
173
|
+
if (direct) {
|
|
174
|
+
const remaining = Math.min(liveSession.ceilingMicrousd - liveSession.spentMicrousd, config.weeklyCeilingMicrousd - store.chatWeeklySpendMicrousd(credentialKey, now));
|
|
175
|
+
while (maxSteps > 1 && reserveFor(maxSteps) > remaining)
|
|
176
|
+
maxSteps--;
|
|
177
|
+
}
|
|
178
|
+
const reserved = reserveFor(maxSteps);
|
|
179
|
+
const admitted = store.transact(() => {
|
|
180
|
+
const existing = request === undefined ? null : store.mateRequestReceipt(session.id, request);
|
|
181
|
+
if (existing !== null)
|
|
182
|
+
return existing.digest === digest
|
|
183
|
+
? { ok: true, replayed: true, turnId: existing.turn }
|
|
184
|
+
: { ok: false, reason: "request-changed" };
|
|
185
|
+
const opened = store.openMateTurn({
|
|
186
|
+
approver: who.name,
|
|
187
|
+
session: session.id,
|
|
188
|
+
thread: thread.id,
|
|
189
|
+
credentialKey,
|
|
190
|
+
reservedMicrousd: reserved,
|
|
191
|
+
dailyTurns: config.dailyTurns,
|
|
192
|
+
weeklyCeilingMicrousd: config.weeklyCeilingMicrousd,
|
|
193
|
+
deadlineMs: TURN_WALL_CLOCK_MS + 10_000,
|
|
194
|
+
provider: config.provider,
|
|
195
|
+
}, now);
|
|
196
|
+
if (!opened.ok)
|
|
197
|
+
return opened;
|
|
198
|
+
const turnId = opened.id;
|
|
199
|
+
const started = store.startMateTurn(turnId, now);
|
|
200
|
+
if (!started.ok)
|
|
201
|
+
throw new Error("new mate turn could not start");
|
|
202
|
+
if (input.queuedMessageId === undefined)
|
|
203
|
+
store.appendMateMessage({ thread: thread.id, turn: turnId, role: "operator", text: message }, now);
|
|
204
|
+
else {
|
|
205
|
+
const bound = store.handle.prepare("UPDATE mate_message SET turn=? WHERE id=? AND thread=? AND role='operator' AND turn IS NULL AND text=?")
|
|
206
|
+
.run(turnId, input.queuedMessageId, thread.id, message);
|
|
207
|
+
if (Number(bound.changes) !== 1)
|
|
208
|
+
throw new Error('The queued message changed before admission.');
|
|
209
|
+
}
|
|
210
|
+
input.onAdmitted?.(turnId);
|
|
211
|
+
if (request !== undefined)
|
|
212
|
+
store.replay({ idempotencyKey: `mate-send:${session.id}:${request}`, actor: who.name, at: now }, "mate-send", () => ({ digest, turn: turnId }));
|
|
213
|
+
return { ok: true, turnId, generation: started.generation };
|
|
214
|
+
});
|
|
215
|
+
if (!admitted.ok)
|
|
216
|
+
return refuse(admitted.reason);
|
|
217
|
+
if ("replayed" in admitted)
|
|
218
|
+
return { ok: true, replayed: true, turn: admitted.turnId };
|
|
219
|
+
const turnId = admitted.turnId;
|
|
220
|
+
const started = { generation: admitted.generation };
|
|
221
|
+
const turnStartedAt = now.getTime();
|
|
222
|
+
const progress = (event) => { try {
|
|
223
|
+
input.onProgress?.(event);
|
|
224
|
+
}
|
|
225
|
+
catch { /* a watcher never breaks the turn */ } };
|
|
226
|
+
progress({ kind: "started", turn: turnId });
|
|
227
|
+
let proposals = 0;
|
|
228
|
+
let reads = 0;
|
|
229
|
+
let steps = 0;
|
|
230
|
+
const readDecisions = new Map();
|
|
231
|
+
const readResults = new Map();
|
|
232
|
+
let tokensIn = 0;
|
|
233
|
+
let tokensOut = 0;
|
|
234
|
+
let settled = 0;
|
|
235
|
+
const draft = (kind, payload) => {
|
|
236
|
+
if (proposals >= MATE_MAX_PROPOSALS_PER_TURN)
|
|
237
|
+
return null;
|
|
238
|
+
proposals++;
|
|
239
|
+
return store.draftMateProposal({ thread: thread.id, turn: turnId, kind, payload, ceilingDigest: who.ceilingDigest }, clock());
|
|
240
|
+
};
|
|
241
|
+
/** The screenshots a tool selected, kept under THIS turn: a failed turn deletes them with its drafts; a channel plans sends only from an answered turn. */
|
|
242
|
+
const selectEvidence = (rows) => {
|
|
243
|
+
store.recordMateTurnEvidence(turnId, rows, RESULT_IMAGES_PER_TURN_CAP, clock());
|
|
244
|
+
if (store.getMateTurn(turnId)?.state !== "running")
|
|
245
|
+
return [];
|
|
246
|
+
return store.listMateTurnEvidence(turnId).map(one => one.artifact);
|
|
247
|
+
};
|
|
248
|
+
/** The turn ends failed: its drafts are deleted, its cost settled — the whole reservation when any of it is unknown. */
|
|
249
|
+
const fail = (failed, message, unknownSpend) => {
|
|
250
|
+
now = clock();
|
|
251
|
+
store.finalizeMateTurn(turnId, started.generation, { state: "failed", settledMicrousd: settled, unknownSpend, tokensIn, tokensOut, failureReason: failed }, now);
|
|
252
|
+
return { ok: false, turn: turnId, failed, message, unknownSpend };
|
|
253
|
+
};
|
|
254
|
+
/** The turn's own row, re-read: still running under our generation, or someone ended it under us. */
|
|
255
|
+
const stillOurs = () => {
|
|
256
|
+
const row = store.getMateTurn(turnId);
|
|
257
|
+
return row !== null && row.state === "running" && row.generation === started.generation;
|
|
258
|
+
};
|
|
259
|
+
// The channel lookup can await external state. Re-read all local authority
|
|
260
|
+
// AFTER it resolves, immediately before sending context or using a tool.
|
|
261
|
+
const guard = (channel) => {
|
|
262
|
+
if (!stillOurs())
|
|
263
|
+
return { ok: false, turn: turnId, failed: "superseded", message: "this turn was ended before its next action", unknownSpend: false };
|
|
264
|
+
if (!channel.ok)
|
|
265
|
+
return fail("revoked", `this conversation's connection changed (${channel.reason}) — nothing it proposed was kept`, false);
|
|
266
|
+
const standing = reproveApprover(store, who);
|
|
267
|
+
const liveSession = store.getMateSession(session.id);
|
|
268
|
+
const liveThread = store.getMateThread(thread.id);
|
|
269
|
+
if (!standing.ok || liveSession === null || liveSession.endedAt !== null || liveThread === null || liveThread.closedAt !== null) {
|
|
270
|
+
return fail("revoked", "your standing or this conversation ended — nothing it proposed was kept", false);
|
|
271
|
+
}
|
|
272
|
+
return null;
|
|
273
|
+
};
|
|
274
|
+
let reply = null;
|
|
275
|
+
let stoppedAtCap = false;
|
|
276
|
+
let lastText = "";
|
|
277
|
+
while (steps < maxSteps) {
|
|
278
|
+
const blocked = guard(input.revalidate === undefined ? { ok: true } : await input.revalidate());
|
|
279
|
+
if (blocked !== null)
|
|
280
|
+
return blocked;
|
|
281
|
+
now = clock();
|
|
282
|
+
const remainingMs = TURN_WALL_CLOCK_MS - (now.getTime() - turnStartedAt);
|
|
283
|
+
if (remainingMs <= 0)
|
|
284
|
+
return fail("timeout", "the turn ran out of time before the model finished", false);
|
|
285
|
+
const request = direct ? composeDirect(input.key) : composeSubscription();
|
|
286
|
+
// Tool results join the outbound body: scanned again before every dispatch.
|
|
287
|
+
const outbound = typeof request === "string" ? request : request.body;
|
|
288
|
+
if (scanForSecrets(outbound).length > 0) {
|
|
289
|
+
return fail("secret-refused", "a tool result contained something credential-shaped — the turn stopped before sending it", false);
|
|
290
|
+
}
|
|
291
|
+
const step = store.openMateStep({ mateTurn: turnId, generation: started.generation, approver: who.name, credentialKey, provider: config.provider, model: config.model, deadlineMs: remainingMs + 10_000 }, now);
|
|
292
|
+
if (!step.ok) {
|
|
293
|
+
if (step.reason === "latched")
|
|
294
|
+
return fail("latched", "a turn with unknown cost latched this credential mid-conversation — acknowledge it first", false);
|
|
295
|
+
return { ok: false, turn: turnId, failed: "superseded", message: "this turn was ended before its next step", unknownSpend: false };
|
|
296
|
+
}
|
|
297
|
+
const stepStarted = store.startChatTurn(step.id, now);
|
|
298
|
+
if (!stepStarted.ok)
|
|
299
|
+
return fail("provider-error", "the step could not be dispatched", false);
|
|
300
|
+
steps++;
|
|
301
|
+
progress({ kind: "step", turn: turnId, step: steps });
|
|
302
|
+
const requestBytes = Buffer.byteLength(outbound, "utf8");
|
|
303
|
+
let result;
|
|
304
|
+
if (direct) {
|
|
305
|
+
const controller = new AbortController();
|
|
306
|
+
const timer = setTimeout(() => controller.abort(), remainingMs);
|
|
307
|
+
try {
|
|
308
|
+
result = await performMateRequest(request, directProvider, controller.signal, fetcher);
|
|
309
|
+
}
|
|
310
|
+
catch {
|
|
311
|
+
result = { ok: false, problem: "network" };
|
|
312
|
+
}
|
|
313
|
+
finally {
|
|
314
|
+
clearTimeout(timer);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
const runner = input.subscriptionRunner ?? performSubscriptionMateRequest;
|
|
319
|
+
try {
|
|
320
|
+
result = await runner({
|
|
321
|
+
provider: subscriptionProvider,
|
|
322
|
+
model: config.model,
|
|
323
|
+
system: MATE_CONTRACT,
|
|
324
|
+
dataDocument: document,
|
|
325
|
+
history,
|
|
326
|
+
tools: MATE_TOOL_SCHEMAS,
|
|
327
|
+
timeoutMs: remainingMs,
|
|
328
|
+
// The reply as it is written; text that looks like a secret is
|
|
329
|
+
// never shown (the finished reply is scanned again before saving).
|
|
330
|
+
...(input.onProgress === undefined ? {} : { onText: (text) => { if (scanForSecrets(text).length === 0)
|
|
331
|
+
progress({ kind: "text", turn: turnId, step: steps, text }); } }),
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
catch {
|
|
335
|
+
result = { ok: false, problem: "provider-error" };
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
now = clock();
|
|
339
|
+
const finishStep = (outcome) => store.finalizeChatTurn(step.id, stepStarted.generation, outcome, now);
|
|
340
|
+
if (!result.ok) {
|
|
341
|
+
if (!direct) {
|
|
342
|
+
finishStep({ state: "failed", failureReason: result.problem === "timeout" ? "timeout" : result.problem === "malformed-reply" ? "malformed-reply" : "provider-error", settledMicrousd: 0 });
|
|
343
|
+
const message = result.problem === "not-found"
|
|
344
|
+
? "the selected subscription CLI is not installed on this machine"
|
|
345
|
+
: result.problem === "timeout"
|
|
346
|
+
? "the subscription turn ran out of time"
|
|
347
|
+
: result.problem === "malformed-reply"
|
|
348
|
+
? "the subscription provider returned a malformed answer and it was discarded"
|
|
349
|
+
: "the subscription provider refused or could not complete the turn — check its login in the terminal";
|
|
350
|
+
return fail(result.problem === "timeout" ? "timeout" : result.problem === "malformed-reply" ? "malformed-reply" : "provider-error", message, false);
|
|
351
|
+
}
|
|
352
|
+
if (result.problem.startsWith("status-")) {
|
|
353
|
+
// The provider ANSWERED with an error: nothing billed for this step.
|
|
354
|
+
finishStep({ state: "failed", failureReason: "provider-error", settledMicrousd: 0 });
|
|
355
|
+
return fail("provider-error", "the provider refused the request — nothing was billed for that step", false);
|
|
356
|
+
}
|
|
357
|
+
if (result.problem === "timeout") {
|
|
358
|
+
finishStep({ state: "failed", failureReason: "timeout", settledMicrousd: null, unknownSpend: true });
|
|
359
|
+
return fail("timeout", "the turn timed out; that step's cost is unknown — the whole reservation is charged and the credential is blocked until you acknowledge it", true);
|
|
360
|
+
}
|
|
361
|
+
if (result.problem === "network") {
|
|
362
|
+
finishStep({ state: "failed", failureReason: "provider-error", settledMicrousd: null, unknownSpend: true });
|
|
363
|
+
return fail("provider-error", "the provider could not be reached after dispatch; cost unknown — the whole reservation is charged; acknowledge to re-enable chat", true);
|
|
364
|
+
}
|
|
365
|
+
finishStep({ state: "failed", failureReason: "malformed-reply", settledMicrousd: null, unknownSpend: true });
|
|
366
|
+
return fail("malformed-reply", "the provider's response was malformed and was discarded; cost unknown — the whole reservation is charged; acknowledge to re-enable chat", true);
|
|
367
|
+
}
|
|
368
|
+
const answer = result.answer;
|
|
369
|
+
// Usage that cannot be true — more input tokens than bytes sent — is a
|
|
370
|
+
// malformed reply with unknown cost, never a number to settle by.
|
|
371
|
+
if (direct && answer.tokensIn > requestBytes) {
|
|
372
|
+
finishStep({ state: "failed", failureReason: "malformed-reply", settledMicrousd: null, unknownSpend: true });
|
|
373
|
+
return fail("malformed-reply", "the provider reported usage that cannot be true; cost unknown — the whole reservation is charged; acknowledge to re-enable chat", true);
|
|
374
|
+
}
|
|
375
|
+
// The pinned math, or the provider's own reported charge when HIGHER.
|
|
376
|
+
const stepSettled = direct
|
|
377
|
+
? Math.max(settleForPrice(price, answer.tokensIn, answer.tokensOut), answer.reportedCostMicrousd ?? 0)
|
|
378
|
+
: 0;
|
|
379
|
+
finishStep({ state: "answered", tokensIn: answer.tokensIn, tokensOut: answer.tokensOut, settledMicrousd: stepSettled, replyBytes: Buffer.byteLength(answer.text, "utf8") });
|
|
380
|
+
tokensIn += answer.tokensIn;
|
|
381
|
+
tokensOut += answer.tokensOut;
|
|
382
|
+
settled += stepSettled;
|
|
383
|
+
lastText = answer.text;
|
|
384
|
+
// After the wait (finding 5): the row may have been failed under us by
|
|
385
|
+
// a revocation or the sweep — then nothing the model said runs; and the
|
|
386
|
+
// approver must still stand before any tool runs as them.
|
|
387
|
+
const changed = guard(input.revalidate === undefined ? { ok: true } : await input.revalidate());
|
|
388
|
+
if (changed !== null)
|
|
389
|
+
return changed;
|
|
390
|
+
if (answer.calls.length === 0) {
|
|
391
|
+
if (answer.text.trim() === "")
|
|
392
|
+
return fail("malformed-reply", "the model answered with nothing", false);
|
|
393
|
+
reply = answer.text;
|
|
394
|
+
break;
|
|
395
|
+
}
|
|
396
|
+
if (answer.calls.length > MATE_MAX_CALLS_PER_STEP)
|
|
397
|
+
return fail("malformed-reply", "the model asked for more tool calls than one step allows", false);
|
|
398
|
+
for (const call of answer.calls) {
|
|
399
|
+
if (!isMateTool(call.name))
|
|
400
|
+
return fail("malformed-reply", "the model called a tool that does not exist", false);
|
|
401
|
+
}
|
|
402
|
+
history.push({ role: "assistant", text: answer.text, calls: answer.calls });
|
|
403
|
+
for (const [index, call] of answer.calls.entries()) {
|
|
404
|
+
if (index > 0) {
|
|
405
|
+
const changed = guard(input.revalidate === undefined ? { ok: true } : await input.revalidate());
|
|
406
|
+
if (changed !== null)
|
|
407
|
+
return changed;
|
|
408
|
+
}
|
|
409
|
+
progress({ kind: "tool", turn: turnId, step: steps, label: mateToolLabel(call.name) });
|
|
410
|
+
const outcome = executeMateTool({ store, who, now: clock(), draft, selectEvidence, step: steps, readDecisions, readResults, ...(input.evidenceRoot === undefined ? {} : { evidenceRoot: input.evidenceRoot }), ...(input.mediaDelivery === undefined ? {} : { mediaDelivery: input.mediaDelivery }) }, call.name, call.args, view);
|
|
411
|
+
if (READ_TOOLS.has(call.name))
|
|
412
|
+
reads++;
|
|
413
|
+
// Opt-in, local diagnostics for end-to-end runs: what the lead asked of each tool and what came back, keys blanked.
|
|
414
|
+
if (envValue(process.env, "MATE_TRACE") === "1") {
|
|
415
|
+
const blanked = (_, value) => typeof value === "string" ? redactSecretAssignments(redactSecretLines(value, scanForSecrets(value))) : value;
|
|
416
|
+
process.stderr.write(`mate-trace ${JSON.stringify({ turn: turnId, step: steps, tool: call.name, args: call.args, ok: outcome.ok, ...(outcome.ok ? {} : { message: outcome.message }) }, blanked).slice(0, 4000)}\n`);
|
|
417
|
+
}
|
|
418
|
+
history.push({ role: "tool", callId: call.id, name: call.name, result: capped(outcome.ok ? outcome.body : { ok: false, message: outcome.message }) });
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
if (reply === null) {
|
|
422
|
+
stoppedAtCap = true;
|
|
423
|
+
reply = `${lastText.trim() === "" ? "" : `${lastText.trim()}\n\n`}(stopped after ${maxSteps} steps${maxSteps < MATE_MAX_STEPS ? " within this conversation’s remaining allowance" : ""})`;
|
|
424
|
+
}
|
|
425
|
+
// Ruling 11: model text is scanned before it becomes durable.
|
|
426
|
+
if (scanForSecrets(reply).length > 0)
|
|
427
|
+
return fail("secret-refused", "the model's reply contained something credential-shaped and was discarded", false);
|
|
428
|
+
now = clock();
|
|
429
|
+
const activity = activitySummary(reads, proposals, steps);
|
|
430
|
+
// One write (finding 12): settle, debit, promote the drafts, append the assistant text.
|
|
431
|
+
const finalized = store.finalizeMateTurn(turnId, started.generation, { state: "answered", settledMicrousd: settled, tokensIn, tokensOut, message: { text: reply, activity } }, now);
|
|
432
|
+
if (!finalized)
|
|
433
|
+
return { ok: false, turn: turnId, failed: "superseded", message: "this turn was ended before it could be kept", unknownSpend: false };
|
|
434
|
+
return { ok: true, turn: turnId, reply, activity, proposals, steps, stoppedAtCap, settledMicrousd: settled };
|
|
435
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { type ToolSpec } from "./project-tools.js";
|
|
2
|
+
import type { Store } from "./store.js";
|
|
3
|
+
/** Services verified to connect this way (their servers speak streamable HTTP and register clients on the spot). */
|
|
4
|
+
export declare const ONE_CLICK: readonly {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
url: string;
|
|
8
|
+
about: string;
|
|
9
|
+
}[];
|
|
10
|
+
/**
|
|
11
|
+
* The list, with one service standing in on this computer when the person
|
|
12
|
+
* running Toolroll says so ("stripe|Stripe|http://127.0.0.1:5123/mcp"
|
|
13
|
+
* in TOOLROLL_TEST_CONNECT): how the end-to-end check signs in for
|
|
14
|
+
* real without a real account. Only a loopback address is taken.
|
|
15
|
+
*/
|
|
16
|
+
export declare function oneClickServices(environment?: NodeJS.ProcessEnv): typeof ONE_CLICK;
|
|
17
|
+
export declare const oneClickOf: (id: string) => {
|
|
18
|
+
id: string;
|
|
19
|
+
label: string;
|
|
20
|
+
url: string;
|
|
21
|
+
about: string;
|
|
22
|
+
} | null;
|
|
23
|
+
/** Where each service stands in a project: connected by signing in, open to connect, or its name taken by a tool set up another way. */
|
|
24
|
+
export declare function connectionsOf(store: Store, repo: string): {
|
|
25
|
+
id: string;
|
|
26
|
+
label: string;
|
|
27
|
+
about: string;
|
|
28
|
+
state: "connected" | "open" | "taken";
|
|
29
|
+
}[];
|
|
30
|
+
/** Where a service sends the person back after they sign in. */
|
|
31
|
+
export declare const CONNECT_CALLBACK = "/settings/tools/connected";
|
|
32
|
+
type Fetch = typeof fetch;
|
|
33
|
+
type Server = {
|
|
34
|
+
authorize: string;
|
|
35
|
+
token: string;
|
|
36
|
+
register: string;
|
|
37
|
+
scopes: string[];
|
|
38
|
+
resource: string | null;
|
|
39
|
+
};
|
|
40
|
+
/** A sign-in on its way: what the callback needs to finish it (kept in the console's memory, 15 minutes). */
|
|
41
|
+
export type ConnectVisit = {
|
|
42
|
+
service: string;
|
|
43
|
+
repo: string;
|
|
44
|
+
by: string;
|
|
45
|
+
kit: string | null;
|
|
46
|
+
verifier: string;
|
|
47
|
+
clientId: string;
|
|
48
|
+
clientSecret: string | null;
|
|
49
|
+
token: string;
|
|
50
|
+
resource: string;
|
|
51
|
+
redirect: string;
|
|
52
|
+
expires: number;
|
|
53
|
+
};
|
|
54
|
+
/** A server's sign-in: the resource metadata its 401 names (or the well-known one), then its authorization server's metadata. */
|
|
55
|
+
export declare function discoverSignIn(mcpUrl: string, fetcher?: Fetch): Promise<Server | null>;
|
|
56
|
+
/**
|
|
57
|
+
* Start connecting a service: find its sign-in, register this console as a
|
|
58
|
+
* client, and hand back the address to send the person to (and the visit the
|
|
59
|
+
* callback finishes). The person's password was checked before this.
|
|
60
|
+
*/
|
|
61
|
+
export declare function startConnect(input: {
|
|
62
|
+
service: string;
|
|
63
|
+
repo: string;
|
|
64
|
+
by: string;
|
|
65
|
+
origin: string;
|
|
66
|
+
kit?: string | null;
|
|
67
|
+
}, fetcher?: Fetch, now?: number): Promise<{
|
|
68
|
+
ok: true;
|
|
69
|
+
go: string;
|
|
70
|
+
state: string;
|
|
71
|
+
visit: ConnectVisit;
|
|
72
|
+
} | {
|
|
73
|
+
ok: false;
|
|
74
|
+
said: string;
|
|
75
|
+
}>;
|
|
76
|
+
/** The spec a connected service joins the project with: its MCP address, signed in with the token its sign-in gave. */
|
|
77
|
+
export declare function connectedSpec(serviceId: string): ToolSpec | null;
|
|
78
|
+
/**
|
|
79
|
+
* Finish connecting: trade the code for tokens, add the tool to the project
|
|
80
|
+
* (or refresh its sign-in, when it's there already), keep the tokens in its
|
|
81
|
+
* secrets file, and test it.
|
|
82
|
+
*/
|
|
83
|
+
export declare function finishConnect(store: Store, visit: ConnectVisit, code: string, now: Date, options?: {
|
|
84
|
+
fetcher?: Fetch;
|
|
85
|
+
home?: string;
|
|
86
|
+
test?: boolean;
|
|
87
|
+
omitEnv?: readonly string[];
|
|
88
|
+
}): Promise<{
|
|
89
|
+
ok: true;
|
|
90
|
+
said: string;
|
|
91
|
+
} | {
|
|
92
|
+
ok: false;
|
|
93
|
+
said: string;
|
|
94
|
+
}>;
|
|
95
|
+
/** Keep connected services signed in: any token expiring within ten minutes is refreshed (the worker's pass, and before a teammate's call). */
|
|
96
|
+
export declare function refreshConnections(store: Store, repos: readonly string[], now: Date, options?: {
|
|
97
|
+
fetcher?: Fetch;
|
|
98
|
+
home?: string;
|
|
99
|
+
}): Promise<{
|
|
100
|
+
refreshed: number;
|
|
101
|
+
problems: string[];
|
|
102
|
+
}>;
|
|
103
|
+
export {};
|